From 4fc0ab7e543f68ab62c471f2780b05e3bd8f2974 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Thu, 5 Nov 2026 18:24:54 +0000 Subject: [PATCH 01/11] Import Goldberg-Seymour edge-coloring theorem --- LeanPool/GoldbergSeymour.lean | 42 + .../AbsentOwnerReplacement.lean | 2879 ++++++ LeanPool/GoldbergSeymour/AbsorbingVertex.lean | 41 + .../GoldbergSeymour/AbsorbingVertices.lean | 31 + LeanPool/GoldbergSeymour/AdjacentEdges.lean | 28 + .../AlgorithmFiveFiveBaseStage.lean | 321 + ...AlgorithmFiveFiveInitialGoodHierarchy.lean | 387 + ...AlgorithmFiveFiveParallelStrictGrowth.lean | 145 + .../AlgorithmFiveFiveSeed.lean | 640 ++ .../AlgorithmFiveSixFixedRootRefresh.lean | 624 ++ .../AlgorithmThreeOneChoiceDataExists.lean | 158 + .../AlgorithmThreeOneInitialSeriesExists.lean | 119 + .../AlgorithmThreeOneStepExists.lean | 1073 ++ .../BalancedGlobalMaximumTriple.lean | 34 + LeanPool/GoldbergSeymour/BaseControl.lean | 1725 ++++ .../GoldbergSeymour/BaseDisplayedEdges.lean | 147 + .../GoldbergSeymour/BaseExtraReplacement.lean | 1254 +++ LeanPool/GoldbergSeymour/Basic2.lean | 73 + .../GoldbergSeymour/Basic2TerminalPE.lean | 1542 +++ .../GoldbergSeymour/Basic2TerminalSERE.lean | 958 ++ .../GoldbergSeymour/BoundaryColorEdges.lean | 32 + .../GoldbergSeymour/BoundaryColorVertex.lean | 29 + LeanPool/GoldbergSeymour/BoundaryEdges.lean | 32 + .../BoundaryMissingColorAugmentation.lean | 53 + .../CertifiedETTPredecessor.lean | 89 + .../CertifiedETTRestriction.lean | 85 + .../CertifiedSeriesRoundsBound.lean | 129 + LeanPool/GoldbergSeymour/ChangeLemma.lean | 305 + .../ChangeLemmaBothInside.lean | 1364 +++ .../ChangeLemmaBothOutside.lean | 284 + .../ChangeLemmaBothOutside/Preparation1.lean | 5332 ++++++++++ .../ChangeLemmaBothOutside/Preparation2.lean | 250 + .../ChangeLemmaBothOutside/Preparation3.lean | 243 + .../ChangeLemmaBothOutside/Preparation4.lean | 243 + .../ChangeLemmaBothOutside/Preparation5.lean | 439 + .../ChangeLemmaBothOutside/Preparation6.lean | 1240 +++ .../ChangeLemmaInsideOutside.lean | 240 + .../ChangeLemmaMixedClosedFinal.lean | 5845 +++++++++++ .../ChangeLemmaMixedLargestClosed.lean | 8794 +++++++++++++++++ .../ChangeLemmaMixedNoClosed.lean | 5838 +++++++++++ .../ChangeLemmaMixedZeroNonclosed.lean | 2828 ++++++ LeanPool/GoldbergSeymour/ChromaticIndex.lean | 29 + .../ChromaticIndexRestrict.lean | 37 + .../GoldbergSeymour/ChromaticIndexSpec.lean | 36 + .../ClosedColorExitPathBoundaryEdge.lean | 133 + .../GoldbergSeymour/ClosedCoreElementary.lean | 54 + .../ClosedSetTwoColorComponentAvoidance.lean | 94 + .../ColoredVertexSetClosed.lean | 30 + .../ColoredVertexSetElementary.lean | 29 + .../ColoredVertexSetStronglyClosed.lean | 30 + LeanPool/GoldbergSeymour/ColoringExists.lean | 37 + .../CombinedStableClosurePreserved.lean | 218 + .../CombinedStableColoring.lean | 30 + ...mmonMissingColorsAtUncoloredEndpoints.lean | 176 + .../ConditionNineTransport.lean | 229 + .../CopyAugmentationPrefix.lean | 104 + .../CoreClosurePresentation.lean | 104 + .../CorrespondingExtendedTashkinovTree.lean | 63 + ...rrespondingExtendedTashkinovTreeTrans.lean | 42 + ...ondingExtendedTashkinovTreeTransTrees.lean | 447 + .../CorrespondingTerminalClosureEq.lean | 243 + LeanPool/GoldbergSeymour/Critical.lean | 30 + .../GoldbergSeymour/CriticalCoreExists.lean | 133 + .../CriticalGraphElementaryWitness.lean | 753 ++ ...ntaryOrGoodHierarchyConstructionLarge.lean | 523 + LeanPool/GoldbergSeymour/DefectiveColor.lean | 29 + .../DefectiveColorComponentPath.lean | 653 ++ LeanPool/GoldbergSeymour/DefectiveColors.lean | 32 + LeanPool/GoldbergSeymour/DefectiveEdge.lean | 29 + LeanPool/GoldbergSeymour/DefectiveVertex.lean | 29 + LeanPool/GoldbergSeymour/Degree.lean | 29 + LeanPool/GoldbergSeymour/DeleteEdge.lean | 29 + LeanPool/GoldbergSeymour/Density.lean | 35 + LeanPool/GoldbergSeymour/DensityCeil.lean | 30 + .../GoldbergSeymour/DensityLowerBound.lean | 170 + LeanPool/GoldbergSeymour/DensityMonotone.lean | 66 + LeanPool/GoldbergSeymour/DensityValue.lean | 30 + LeanPool/GoldbergSeymour/DisplayedEdges.lean | 540 + .../ETTFirstAppearanceIndex.lean | 44 + .../ETTStrongInterchangeable.lean | 52 + ...lierPECycleFirstNonrevisitingInternal.lean | 1545 +++ LeanPool/GoldbergSeymour/Elementary.lean | 29 + ...ntaryClosedExitPairDistinctComponents.lean | 960 ++ ...ElementaryClosedExitPairExtendsTriple.lean | 65 + ...ElementaryClosedExitPairSameComponent.lean | 696 ++ .../ElementaryClosedMissingColorOdd.lean | 164 + ...edNoninterchangeableDisjointExitPaths.lean | 1124 +++ ...ntaryClosedNoninterchangeableExitPair.lean | 60 + .../ElementaryEndpointExclusion.lean | 125 + .../GoldbergSeymour/ElementaryPrefixSwap.lean | 128 + ...ementarySingleBoundaryInterchangeable.lean | 916 ++ .../ElementaryTerminalComponent.lean | 172 + .../GoldbergSeymour/ElementaryTransfer.lean | 39 + .../EligibleIndexBoundConstruction.lean | 590 ++ .../EligibleIndexBoundPreparation.lean | 5116 ++++++++++ LeanPool/GoldbergSeymour/EligibleOddSet.lean | 30 + .../EmptyCommonMissingLocation.lean | 133 + .../ExtendedTashkinovColoringSequence.lean | 32 + .../ExtendedTashkinovLadderStage.lean | 32 + .../ExtendedTashkinovRungNumber.lean | 31 + .../ExtendedTashkinovTree.lean | 40 + .../ExtendedTashkinovTreePrefix.lean | 121 + LeanPool/GoldbergSeymour/ExtensionBase.lean | 152 + .../ExtensionBaseActiveIndices.lean | 41 + .../ExtensionBaseAlgorithmA.lean | 127 + .../ExtensionBaseAlgorithmAColorState.lean | 877 ++ .../ExtensionBaseAlgorithmAInduction.lean | 397 + .../ExtensionBaseAlgorithmASingleStep.lean | 154 + .../ExtensionBaseAlgorithmATraceExists.lean | 120 + .../ExtensionBaseAlgorithmB.lean | 98 + .../ExtensionBaseAlgorithmBInduction.lean | 726 ++ .../ExtensionBaseAlgorithmBInvariant.lean | 74 + .../ExtensionBaseAlgorithmBSingleStep.lean | 152 + .../ExtensionBaseAlgorithmBTrace.lean | 58 + .../ExtensionBaseAlgorithmBTraceExists.lean | 122 + .../ExtensionBaseAlgorithmC.lean | 2091 ++++ .../ExtensionBaseAlgorithmCInvariant.lean | 79 + .../ExtensionBaseAlgorithmCTrace.lean | 61 + .../ExtensionBaseAuxiliary.lean | 6495 ++++++++++++ .../ExtensionBaseBranchLemmas.lean | 6108 ++++++++++++ .../ExtensionBaseBranchPreparation.lean | 4355 ++++++++ .../ExtensionBaseCaseOneIndices.lean | 32 + .../ExtensionBaseCaseOneSelection.lean | 561 ++ .../ExtensionBaseCaseTwoContradiction.lean | 1686 ++++ .../ExtensionBaseCaseTwoObservation19.lean | 163 + .../ExtensionBaseCaseTwoObservation20.lean | 210 + .../ExtensionBaseCaseTwoObservation21.lean | 1020 ++ .../ExtensionBaseCaseTwoObservation23.lean | 398 + .../GoldbergSeymour/ExtensionBaseClaim43.lean | 157 + .../ExtensionBaseClaim43EdgeEffects.lean | 439 + .../ExtensionBaseClaim43MissingColors.lean | 1056 ++ .../ExtensionBaseClaim43Stability.lean | 353 + .../ExtensionBaseClaim43TreeEdges.lean | 167 + .../GoldbergSeymour/ExtensionBaseClaim44.lean | 1728 ++++ .../GoldbergSeymour/ExtensionBaseClaim45.lean | 1873 ++++ .../ExtensionBaseClaim45Singleton.lean | 1210 +++ .../GoldbergSeymour/ExtensionBaseClaim46.lean | 1933 ++++ .../ExtensionBaseClaimMissingColors.lean | 690 ++ ...tensionBaseClaimStrongInterchangeable.lean | 218 + .../ExtensionBaseClaimTreeEdgeColors.lean | 333 + .../GoldbergSeymour/ExtensionBaseClosure.lean | 162 + .../ExtensionBaseDeltaExclusion.lean | 197 + ...xtensionBaseLeastActiveDeltaTransport.lean | 314 + .../ExtensionBasePESlotDeltaNotMissing.lean | 120 + .../ExtensionBasePreparations.lean | 1151 +++ .../ExtensionBaseRestorationIndices.lean | 35 + .../ExtensionBaseRestorationInvariant.lean | 69 + .../ExtensionBaseRestorationTrace.lean | 55 + ...nsionBaseSameSupportStoredPairOverlap.lean | 502 + .../ExtensionBaseStepLemmas.lean | 4243 ++++++++ .../ExtensionBaseStoredPairOverlap.lean | 299 + .../ExtensionBaseStrictDeltaExclusion.lean | 1254 +++ .../ExtensionBaseSupportClass.lean | 35 + .../ExtensionBaseSupportClassColors.lean | 123 + .../ExtensionBaseSupportClassEnumeration.lean | 337 + .../ExtensionBaseSupportOrder.lean | 645 ++ LeanPool/GoldbergSeymour/ExtensionRules.lean | 223 + .../ExtensionRulesEarlierIndices.lean | 797 ++ .../ExtensionRulesPEFirstAppearanceBound.lean | 90 + ...tensionRulesTerminalEarlierAppearance.lean | 1770 ++++ .../ExtensionRulesTerminalLastAppearance.lean | 724 ++ .../ExtensionRulesTerminalStoredDisjoint.lean | 1878 ++++ .../FiniteStrictGrowthReachesTerminal.lean | 53 + .../GoldbergSeymour/FirstEntryClipping.lean | 161 + .../FixedPairMaximalTashkinovTree.lean | 34 + .../GeneralHighIndexElementary.lean | 41 + .../GoldbergSeymour/GlobalMaximumTriple.lean | 31 + .../GlobalMaximumTripleExists.lean | 188 + LeanPool/GoldbergSeymour/GoodHierarchy.lean | 67 + ...dHierarchyCommonOriginalBaseTransport.lean | 181 + .../GoodHierarchyElementaryLarge.lean | 1080 ++ .../GoodHierarchyInitialPairsNonPE.lean | 137 + .../GoodHierarchyInitialPairsPE.lean | 293 + .../GoodHierarchyNewMissingClosed.lean | 155 + .../GoodHierarchyPrefixConstruction.lean | 131 + .../GoodHierarchyPrefixPreparation.lean | 324 + .../GoodHierarchyPrefixRepackage.lean | 370 + .../GoodHierarchyReservedDisjoint.lean | 79 + .../GoodHierarchyRestrictedAugmentation.lean | 116 + ...ierarchyRestrictedEndpointMinusClosed.lean | 185 + ...archyRestrictedEndpointReconstruction.lean | 128 + .../GoodHierarchyRestrictedMaximalChain.lean | 392 + ...oodHierarchySameDividerReconstruction.lean | 1461 +++ .../GoodHierarchySameDividerTransport.lean | 402 + .../GoodHierarchyTerminalPrefixRepackage.lean | 363 + .../GoldbergSeymour/HasKEdgeColoring.lean | 29 + LeanPool/GoldbergSeymour/HierarchyBase.lean | 58 + .../HierarchyBaseCorrespondingTransport.lean | 351 + .../GoldbergSeymour/HierarchyBaseExists.lean | 275 + .../HierarchyCaseThreePreparation.lean | 1631 +++ .../GoldbergSeymour/HierarchyClaimNine.lean | 1596 +++ .../HierarchyClaimNineFirstUseAfterSeed.lean | 1753 ++++ .../HierarchyClaimNineFirstUseSeed.lean | 3828 +++++++ .../HierarchyClaimNinePENormalization.lean | 2482 +++++ .../HierarchyClaimNineUnusedTailColor.lean | 999 ++ .../HierarchyCounterexample.lean | 40 + .../HierarchyCounterexampleLess.lean | 28 + .../HierarchyCounterexampleMeasure.lean | 34 + ...eOneAdditionPositiveDividerImpossible.lean | 3750 +++++++ ...ampleOneAdditionZeroDividerImpossible.lean | 1717 ++++ ...erarchyCounterexamplePathNumberBounds.lean | 97 + ...hyCounterexamplePenultimateElementary.lean | 777 ++ ...HierarchyCounterexampleTailAtLeastTwo.lean | 204 + ...hyCounterexampleTerminalCommonMissing.lean | 163 + ...HierarchyEligibleCommonMissingIndices.lean | 44 + .../HierarchyFirstMissingPosition.lean | 36 + ...archyFirstMissingPositionPrefixCutoff.lean | 113 + .../HierarchyFullTailLength.lean | 34 + .../HierarchyFullTailPrefix.lean | 39 + .../GoldbergSeymour/HierarchyLEMStable.lean | 1147 +++ .../GoldbergSeymour/HierarchyMeasures.lean | 67 + ...HierarchyMinimumCounterexampleContext.lean | 71 + .../HierarchyNonparallelFirstEdge.lean | 218 + .../HierarchyNormalizationLemmas.lean | 163 + .../HierarchyOrderedExitReduction.lean | 979 ++ .../HierarchyOutsideKempeStable.lean | 147 + .../GoldbergSeymour/HierarchyPathNumber.lean | 43 + .../GoldbergSeymour/HierarchyPrefixData.lean | 83 + .../HierarchyReplacementPresentation.lean | 49 + ...HierarchyReplacementPresentationTrans.lean | 567 ++ .../HierarchySegmentColors.lean | 40 + ...rarchySituationOneAdvanceInsideStored.lean | 1042 ++ ...archySituationOneAdvanceOutsideStored.lean | 2110 ++++ .../HierarchySituationOneImpossible.lean | 46 + ...ySituationOnePenultimateCommonMissing.lean | 104 + ...hySituationOneShorteningContradiction.lean | 6947 +++++++++++++ ...rchySituationThreeClaimJMinusOneEmpty.lean | 1081 ++ ...ySituationThreeClaimJMinusOneNonempty.lean | 4782 +++++++++ .../HierarchySituationThreeColorChoice.lean | 465 + ...nThreeComponentIntersectionShortening.lean | 4062 ++++++++ .../HierarchySituationThreeDisjointData.lean | 125 + ...rchySituationThreeDisjointPreparation.lean | 366 + ...ionThreeDisjointThetaStoredImpossible.lean | 3383 +++++++ ...ointThetaUnstoredBetaStoredImpossible.lean | 4098 ++++++++ ...isjointThetaUnstoredOutsideImpossible.lean | 1596 +++ ...archySituationThreeEligibleIndexBound.lean | 1685 ++++ .../HierarchySituationThreeImpossible.lean | 113 + .../HierarchySituationTwoCaseOneData.lean | 46 + .../HierarchySituationTwoCaseOneTwoData.lean | 47 + .../HierarchySituationTwoCaseThreeData.lean | 40 + ...chySituationTwoCaseThreeNormalization.lean | 1304 +++ ...hySituationTwoCaseThreeNormalizedData.lean | 56 + ...HierarchySituationTwoCaseThreeOneData.lean | 34 + ...HierarchySituationTwoCaseThreeTwoData.lean | 34 + .../HierarchySituationTwoCaseTwoData.lean | 39 + ...ierarchySituationTwoCaseTwoExclusions.lean | 402 + .../HierarchySituationTwoCaseTwoTwoData.lean | 40 + .../HierarchySituationTwoCommonTailData.lean | 51 + .../HierarchySituationTwoImpossible.lean | 1331 +++ ...onTwoOutsidePenultimateReconstruction.lean | 154 + .../HierarchySituationTwoReorderedTrees.lean | 59 + ...hySituationTwoReorderedTreesCertified.lean | 252 + .../Preparation1.lean | 1423 +++ .../Preparation2.lean | 494 + .../HierarchySituationTwoSubcaseOneOne.lean | 59 + ...tuationTwoSubcaseOneOneNonexceptional.lean | 4636 +++++++++ ...uationTwoSubcaseOneOneStoredException.lean | 4381 ++++++++ .../HierarchySituationTwoSubcaseOneTwo.lean | 3188 ++++++ .../HierarchySituationTwoSubcaseThreeOne.lean | 145 + .../Preparation1.lean | 5033 ++++++++++ .../Preparation2.lean | 1607 +++ .../HierarchySituationTwoSubcaseThreeTwo.lean | 4623 +++++++++ .../HierarchySituationTwoSubcaseTwoOne.lean | 54 + ...tuationTwoSubcaseTwoOneNonexceptional.lean | 5027 ++++++++++ ...uationTwoSubcaseTwoOneStoredException.lean | 2031 ++++ .../HierarchySituationTwoSubcaseTwoTwo.lean | 6258 ++++++++++++ .../HierarchySituationTwoTailData.lean | 50 + .../GoldbergSeymour/HierarchySplitter.lean | 492 + .../HierarchyStageInterchangeability.lean | 107 + .../HierarchyStageMissingColors.lean | 36 + .../HierarchyStarredStage.lean | 32 + .../HierarchyStoredColorsAntitone.lean | 80 + .../HierarchyStoredColorsAt.lean | 35 + .../HierarchyStoredColorsCardinality.lean | 49 + .../HierarchyTailMissingColorExclusion.lean | 974 ++ .../GoldbergSeymour/HierarchyTailPrefix.lean | 34 + .../HierarchyTerminalStoredColors.lean | 35 + ...erarchyTerminalStoredColorsSubsetLast.lean | 107 + .../HierarchyWeaklyStable.lean | 48 + .../HkuIncidentColorPreserved.lean | 618 ++ .../HkuMissingStoredMonotone.lean | 353 + .../HkuParallelBoundaryStructure.lean | 952 ++ .../HkuTreeColorsControlled.lean | 966 ++ .../HkuUnsupportedVertexColors.lean | 528 + LeanPool/GoldbergSeymour/Imports.lean | 736 ++ LeanPool/GoldbergSeymour/Incident.lean | 28 + LeanPool/GoldbergSeymour/IncidentCore.lean | 43 + .../IncidentCoreChromaticIndex.lean | 59 + .../IncidentCoreColoringTransport.lean | 98 + .../GoldbergSeymour/IncidentCoreCritical.lean | 44 + .../GoldbergSeymour/IncidentCoreDegree.lean | 38 + .../GoldbergSeymour/IncidentCoreDensity.lean | 59 + .../IncidentCoreElementaryTransfer.lean | 39 + .../IncidentCoreEndpoints.lean | 32 + .../IncidentCoreIncidence.lean | 42 + .../IncidentCoreInternalEdges.lean | 50 + .../GoldbergSeymour/IncidentCoreKTriple.lean | 44 + .../IncidentCoreMaximumDegree.lean | 58 + .../IncidentCoreMissingColors.lean | 46 + .../IncidentCoreNoIsolated.lean | 30 + .../IncidentCoreReduction.lean | 44 + .../IncidentCoreTashkinovOrder.lean | 108 + .../IncidentCoreTreeTransport.lean | 185 + LeanPool/GoldbergSeymour/IncidentVertex.lean | 28 + .../IncidentVertexFintype.lean | 36 + .../InterchangePEClosedCore.lean | 904 ++ .../InterchangePEClosureConstituent.lean | 870 ++ .../InterchangePECommonMissingClosed.lean | 297 + .../InterchangePEMixedCore.lean | 206 + .../InterchangePETreeAwayFromDelta.lean | 1464 +++ .../InterchangePETreeConstituent.lean | 711 ++ LeanPool/GoldbergSeymour/InternalEdges.lean | 30 + .../GoldbergSeymour/IsFullEdgeColoring.lean | 28 + .../GoldbergSeymour/IsOneEdgeUncolored.lean | 28 + .../GoldbergSeymour/IsProperEdgeColoring.lean | 30 + LeanPool/GoldbergSeymour/KTriple.lean | 36 + .../GoldbergSeymour/KempeOrientation.lean | 64 + .../LargeOrderTerminalWitness.lean | 198 + .../GoldbergSeymour/LateOwnerReplacement.lean | 1231 +++ .../GoldbergSeymour/LooplessMultigraph.lean | 32 + .../LowerRoundInductionHypothesis.lean | 45 + .../GoldbergSeymour/LowerRoundProperties.lean | 123 + .../MaximumDefectiveChoice.lean | 59 + .../MaximumDefectiveChoiceExists.lean | 144 + LeanPool/GoldbergSeymour/MaximumDegree.lean | 29 + .../MaximumDegreeRestrict.lean | 53 + LeanPool/GoldbergSeymour/MaximumProperty.lean | 53 + .../MaximumPropertyAppend.lean | 209 + .../MaximumPropertyPrefix.lean | 110 + .../MaximumPropertyTransport.lean | 197 + .../MaximumStableClosureExists.lean | 77 + .../MinimumContextTransport.lean | 96 + .../GoldbergSeymour/MinusClosedTransport.lean | 95 + .../MissingColorIncidenceEndpoint.lean | 79 + LeanPool/GoldbergSeymour/MissingColors.lean | 30 + .../MissingColorsNonemptyOfMaximumDegree.lean | 77 + .../MixedNoClosedTransport.lean | 342 + LeanPool/GoldbergSeymour/ModColoring.lean | 47 + .../GoldbergSeymour/NestedOddMissingPair.lean | 143 + LeanPool/GoldbergSeymour/NineN.lean | 622 ++ LeanPool/GoldbergSeymour/NormalCycleEdge.lean | 42 + .../NormalGlobalMaximumTriple.lean | 68 + .../GoldbergSeymour/NormalTripleTrunk.lean | 33 + .../NormalizePositiveTerminalMaximum.lean | 478 + LeanPool/GoldbergSeymour/NormalizedDatum.lean | 203 + .../OneAdditionPreparatoryLemmas.lean | 169 + .../GoldbergSeymour/OneDividerRefresh.lean | 2079 ++++ .../OppositeRootComponents.lean | 104 + .../OrderedExitCounterexample.lean | 220 + .../GoldbergSeymour/OrderedTreeUnion.lean | 48 + .../OrderedTreeUnionAugmentationSequence.lean | 327 + .../OrderedTreeUnionExists.lean | 875 ++ .../GoldbergSeymour/OutsideExitTransport.lean | 436 + .../OutsideKempeGoodHierarchy.lean | 617 ++ .../OutsideKempeRecoloring.lean | 40 + .../OutsideKempeRecoloringStable.lean | 274 + .../GoldbergSeymour/OutsidePrefixBranch.lean | 1877 ++++ .../OutsideSwapPrefixEffects.lean | 441 + .../GoldbergSeymour/OutsideTreeColorSwap.lean | 36 + .../OutsideTreeColorSwapStable.lean | 218 + .../ParallelBaseFourCommonMissingColors.lean | 107 + .../ParallelClosureUnionElementary.lean | 124 + .../ParallelCommonMissingClosed.lean | 521 + .../ParallelCoreAugmentationStrict.lean | 509 + .../ParallelExtensionColor.lean | 47 + .../ParallelExtensionColorAppend.lean | 86 + .../ParallelExtensionColorExists.lean | 395 + .../ParallelExtensionUndoStable.lean | 1797 ++++ .../ParallelInterchangeability.lean | 65 + .../ParallelSpecialClosurePreparation.lean | 235 + .../ParallelStepRootComponentSetup.lean | 637 ++ .../ParallelSupportClosureProperties.lean | 1684 ++++ .../ParallelTerminalAwayInterchangeable.lean | 523 + .../ParallelTerminalFacts.lean | 84 + .../ParallelTerminalPEPreprocessing.lean | 1670 ++++ ...rallelTwoConstituentPathContradiction.lean | 361 + .../GoldbergSeymour/PartialEdgeColoring.lean | 28 + .../PositivePrefixNoRevisiting.lean | 6569 ++++++++++++ .../PositivePrefixPresentation.lean | 186 + .../PositiveWellDefinedness.lean | 217 + LeanPool/GoldbergSeymour/Preamble.lean | 24 + .../PredecessorElementary.lean | 72 + .../PrefixSegmentTransport.lean | 79 + LeanPool/GoldbergSeymour/PresentColors.lean | 33 + .../ProperColoringRestricts.lean | 40 + .../RecoloredPrefixReconstruction.lean | 270 + LeanPool/GoldbergSeymour/RestrictEdges.lean | 31 + ...ctedAugmentationCorrespondingEndpoint.lean | 367 + .../GoldbergSeymour/RetainedHierarchy.lean | 389 + .../RevisitingCertificatePreparation.lean | 159 + .../RevisitingExtensionCertificate.lean | 77 + .../RevisitingExtensionCertificateAppend.lean | 230 + .../RevisitingExtensionSeedStoredColor.lean | 110 + .../RevisitingTerminalPreparation.lean | 3677 +++++++ .../RevisitingTerminalStatements.lean | 3452 +++++++ .../RutgersClosedPresentation.lean | 49 + .../RutgersCounterexample.lean | 90 + .../RutgersCounterexampleMeasure.lean | 33 + .../RutgersCounterexampleMinimumExists.lean | 182 + .../RutgersCurrentRungInterchangeability.lean | 219 + ...utgersMiddleExitOutsideTerminalLadder.lean | 1404 +++ .../RutgersStrictShortening.lean | 3281 ++++++ .../SameColorSeriesPreserved.lean | 343 + .../GoldbergSeymour/SameGoodHierarchy.lean | 43 + .../GoldbergSeymour/SameHierarchyStages.lean | 39 + .../ScheideAbsorbingElementary.lean | 322 + .../ScheideBalancedCandidate.lean | 45 + ...ScheideBalancedCandidateMaximumExists.lean | 115 + .../ScheideBalancedCandidateMaximumOrder.lean | 1144 +++ ...heideBalancedCandidateNormalTransport.lean | 230 + .../ScheideBalancedExists.lean | 69 + .../ScheideBalancedFromMaxNormal.lean | 64 + .../ScheideDefectiveChainBoundaryEdges.lean | 693 ++ .../ScheideDefectiveChainDepartureReturn.lean | 363 + ...ScheideDefectiveChainLastReturnNoFree.lean | 888 ++ .../ScheideDefectiveChainPath.lean | 34 + .../ScheideDefectiveChainPathExists.lean | 41 + .../ScheideDefectiveCrossingSelection.lean | 554 ++ .../ScheideDefectiveDeletedTreePair.lean | 811 ++ .../ScheideDefectiveLastReturnExists.lean | 369 + .../ScheideDefectiveNoCross.lean | 786 ++ .../ScheideDefectiveReturnContradiction.lean | 1276 +++ .../ScheideDefectiveReturnData.lean | 72 + ...heideDefectiveSecondTerminalComponent.lean | 1143 +++ .../ScheideDefectiveSetup.lean | 95 + .../ScheideDefectiveSetupExists.lean | 668 ++ .../ScheideDefectiveSwitchEffect.lean | 270 + .../ScheideDefectiveTailExternal.lean | 41 + .../ScheideDefectiveTerminalComponent.lean | 890 ++ .../ScheideDefectiveThirdBoundaryEdge.lean | 1367 +++ ...eideDeletedMissingReplacementInternal.lean | 955 ++ .../ScheideDepartureReturn.lean | 41 + .../ScheideEnlargedBoundarySelection.lean | 1134 +++ .../ScheideEnlargedClosed.lean | 1067 ++ .../ScheideEnlargedElementary.lean | 76 + .../ScheideEnlargedStrictAugmentation.lean | 200 + .../ScheideEnlargedStronglyClosed.lean | 42 + .../ScheideEnlargedSwitchTransport.lean | 754 ++ .../ScheideEnlargedVertexSet.lean | 38 + .../GoldbergSeymour/ScheideExitNoFree.lean | 817 ++ .../GoldbergSeymour/ScheideExitVertex.lean | 42 + .../ScheideExitVertexTreeExit.lean | 284 + .../GoldbergSeymour/ScheideExitVertices.lean | 31 + .../ScheideGlobalMaximumBoundaryFacts.lean | 284 + .../ScheideGlobalMaximumFixedPairMaximal.lean | 55 + .../ScheideGlobalMaximumFourFree.lean | 228 + .../ScheideGlobalMaximumMissingCounts.lean | 145 + .../ScheideGlobalMaximumOrder.lean | 74 + .../ScheideGlobalMaximumUnused.lean | 74 + .../GoldbergSeymour/ScheideGraphHeight.lean | 34 + .../ScheideGraphHeightOdd.lean | 358 + .../ScheideHeightFiveGammaEdges.lean | 3326 +++++++ .../ScheideHeightFiveOutsideLinks.lean | 2530 +++++ .../ScheideKempePathHeightBound.lean | 97 + .../ScheideLargeHeightElementary.lean | 78 + .../ScheideLargeHeightFullTrunk.lean | 245 + .../ScheideLargeHeightOneTailPair.lean | 1113 +++ .../GoldbergSeymour/ScheideLastExitPath.lean | 70 + .../ScheideMaximalContainsEveryTree.lean | 135 + .../ScheideMaximalElementaryClosed.lean | 176 + .../ScheideMaximalExtendsEveryTree.lean | 568 ++ .../ScheideMaximalKempePath.lean | 783 ++ .../ScheideMaximalOddOrder.lean | 208 + .../ScheideMaximumExtensionNormalWitness.lean | 208 + .../GoldbergSeymour/ScheideNormalisation.lean | 116 + .../ScheideOrderNineBlockCompletion.lean | 2969 ++++++ .../ScheideOrderNineBlockStructure.lean | 2999 ++++++ .../ScheideOrderNineExitLocalization.lean | 237 + .../ScheideOrderNineParameters.lean | 77 + .../ScheideOrderNineRebasingPreparation.lean | 3816 +++++++ ...heideOrderNineStructuralConfiguration.lean | 81 + .../ScheideOriginalDefectiveConfinement.lean | 609 ++ ...cheideOriginalNondefectiveConfinement.lean | 400 + .../ScheideReducedConfiguration.lean | 35 + .../ScheideReplacementAbsorbing.lean | 837 ++ ...cheideReplacementBoundaryAtLeastThree.lean | 1172 +++ ...ScheideReplacementBoundaryAtMostThree.lean | 747 ++ .../ScheideReplacementBoundaryParity.lean | 745 ++ .../ScheideReplacementBoundaryUnique.lean | 181 + .../ScheideReplacementConfinement.lean | 347 + .../ScheideReplacementData.lean | 127 + .../ScheideReplacementExitNotDefective.lean | 234 + .../ScheideReplacementFamilyExists.lean | 176 + .../ScheideReplacementInternalMissing.lean | 161 + .../ScheideReplacementMaximum.lean | 438 + ...eideReplacementMissingDeletedInternal.lean | 940 ++ .../ScheideReplacementPairFixed.lean | 192 + .../ScheideReplacementPairsLaminar.lean | 126 + .../ScheideReplacementPathPrefix.lean | 348 + .../ScheideReplacementTreeSplice.lean | 649 ++ .../ScheideReplacementUnionClosed.lean | 466 + .../ScheideReplacementUsedWitness.lean | 344 + .../ScheideReversedKempePathTree.lean | 520 + .../ScheideReversedPathCertificate.lean | 61 + .../ScheideReversedPathPreparation.lean | 528 + .../ScheideSelectedBlockDeletion.lean | 1048 ++ .../ScheideSingleBoundaryCrossing.lean | 59 + .../ScheideSmallHeightElementary.lean | 1353 +++ .../ScheideStructuralConfiguration.lean | 67 + .../ScheideStructuralExitsInBase.lean | 67 + .../ScheideStructuralInternalPair.lean | 2245 +++++ .../ScheideStructuralLemma.lean | 108 + .../ScheideStructuralReducedAssembly.lean | 2447 +++++ .../ScheideStructuralReduction.lean | 46 + .../ScheideStructuralReordering.lean | 1270 +++ .../ScheideStructuralReorderingData.lean | 102 + .../ScheideStructuralSelection.lean | 156 + .../ScheideStructuralSelectionData.lean | 51 + .../ScheideSymmetricDefectiveInternal.lean | 252 + .../ScheideSymmetricMissingInternal.lean | 47 + ...ideSymmetricOriginalBoundaryAvoidance.lean | 992 ++ .../ScheideSymmetricOriginalFreePath.lean | 461 + .../ScheideSymmetricOriginalPathOrder.lean | 989 ++ ...SymmetricReplacementBoundaryAvoidance.lean | 1170 +++ ...etricReplacementBoundaryConfiguration.lean | 614 ++ .../ScheideSymmetricReplacementFreePath.lean | 836 ++ .../ScheideSymmetricReplacementPathOrder.lean | 1508 +++ .../ScheideTrunkRotationColoring.lean | 856 ++ .../ScheideTrunkRotationCycle.lean | 373 + .../ScheideTrunkRotationNormal.lean | 1167 +++ .../ScheideTrunkRotationPreserves.lean | 107 + .../ScheideTrunkRotationTree.lean | 1267 +++ .../ScheideTwoColorLastExitPath.lean | 606 ++ .../SimpleExtensionSeedStoredColor.lean | 152 + LeanPool/GoldbergSeymour/SplitSwapData.lean | 139 + .../GoldbergSeymour/SplitSwapPreparation.lean | 2329 +++++ LeanPool/GoldbergSeymour/StableChange.lean | 204 + .../StableChangeCaseThree.lean | 309 + .../StableChangeCaseThree/Preparation1.lean | 2274 +++++ .../StableChangeCaseThree/Preparation2.lean | 300 + .../StableChangeCaseThree/Preparation3.lean | 661 ++ .../StableChangeCaseThree/Preparation4.lean | 380 + .../StableChangeCaseThree/Preparation5.lean | 536 + .../StableChangeCasesOneTwo.lean | 1512 +++ .../StableChangeCasesOneTwoFullTail.lean | 1643 +++ .../StableChangeCasesOneTwoSplitTail.lean | 1236 +++ .../StableChangeCasesOneTwoStarredTail.lean | 1300 +++ LeanPool/GoldbergSeymour/StableColoring.lean | 31 + .../StableColoringBeforeVertex.lean | 37 + .../StableColoringEquivalence.lean | 125 + .../StableColoringExitExtension.lean | 518 + .../StableColoringFullCertificate.lean | 136 + .../StableColoringIncidentEdgeCriterion.lean | 163 + .../StableSeriesCycleComponentTransport.lean | 1237 +++ .../StarredPrefixPreparation.lean | 1690 ++++ .../Step1CaseOneInsidePositiveDivider.lean | 191 + .../Step1CaseOneInsideStar.lean | 208 + .../Step1CaseOneInsideZeroNonPE.lean | 218 + .../Step1CaseOneInsideZeroPE.lean | 594 ++ .../Step1CaseOneOutsideStar.lean | 1681 ++++ .../Step1CaseTwoInsidePositiveDivider.lean | 771 ++ .../Step1CaseTwoInsideStar.lean | 153 + .../Step1CaseTwoInsideZeroNonPE.lean | 1185 +++ .../Step1CaseTwoInsideZeroPE.lean | 584 ++ .../Step1CaseTwoOutsidePrefixHierarchy.lean | 1996 ++++ .../Step1CaseTwoOutsidePrefixTwoEdges.lean | 250 + .../Step1CaseTwoOutsideRecoloredPrefix.lean | 1178 +++ ...1CaseTwoOutsideRestrictedAugmentation.lean | 364 + .../Step1CaseTwoOutsideStar.lean | 165 + .../Step1CaseTwoOutsideTwoEdgeExtension.lean | 519 + .../Step1ExitLegGlobalMinimum.lean | 256 + .../GoldbergSeymour/Step1ExitLegMinimum.lean | 152 + .../Step1ExitLegMinimumExists.lean | 1077 ++ .../Step1ExitLegPrecoloringElementary.lean | 80 + .../Step1ExitLegPresentation.lean | 93 + .../Step1ExitLegPresentationExists.lean | 261 + .../Step1ExitLegThetaPositive.lean | 509 + .../Step1ExitLegThetaZeroNonparallel.lean | 476 + .../Step1ExitLegThetaZeroParallel.lean | 204 + .../Step1ZeroDividerAnchor.lean | 65 + .../Step1ZeroDividerAnchorNonPE.lean | 1184 +++ .../Step1ZeroDividerAnchorPE.lean | 1172 +++ ...trongInterchangeabilityKempePreserved.lean | 554 ++ .../StronglyClosedWitnessElementary.lean | 1035 ++ .../SupportingPEColorChain.lean | 179 + .../SupportingPEMissingTransport.lean | 680 ++ .../SupportingPEStoredIntersection.lean | 887 ++ LeanPool/GoldbergSeymour/TashTree.lean | 35 + LeanPool/GoldbergSeymour/TashTreeBadPair.lean | 34 + .../TashTreeCaseNoRepeatedOnPath.lean | 84 + .../TashTreeCasePathIndexLast.lean | 53 + .../TashTreeCaseRepeatedOnPath.lean | 56 + .../TashTreeControlledInterchange.lean | 256 + ...ControlledRepeatedSuffixContradiction.lean | 138 + ...ashTreeDisjointComponentNormalization.lean | 161 + .../TashTreeEarlyBetaNormalization.lean | 766 ++ .../TashTreeFourUnusedColors.lean | 359 + .../TashTreeGammaEpsilonSetup.lean | 224 + .../TashTreeLastIndexDeletion.lean | 489 + .../TashTreeLastIndexFirstNormalForm.lean | 776 ++ ...shTreeLastIndexIntersectionShortening.lean | 116 + .../TashTreeLastIndexSecondNormalForm.lean | 424 + .../TashTreeLastIndexThirdNormalForm.lean | 823 ++ .../TashTreeMinimumBadLengthAtLeastTwo.lean | 156 + .../TashTreeMinimumBadPair.lean | 33 + .../TashTreeMinimumBadPairExists.lean | 61 + .../TashTreeMinimumBadPathIndex.lean | 61 + .../TashTreeNoMinimumBadPair.lean | 46 + .../TashTreeNoRepeatedDisjointReduction.lean | 204 + ...hTreeNoRepeatedIntersectionShortening.lean | 329 + .../GoldbergSeymour/TashTreePathIndex.lean | 35 + .../TashTreePathIndexTwoReplacement.lean | 265 + .../TashTreeProperInitialSegmentRankLess.lean | 58 + .../TashTreeProperPrefixElementary.lean | 77 + .../GoldbergSeymour/TashTreeRankLess.lean | 30 + .../TashTreeRhoOneAdvance.lean | 47 + .../TashTreeRhoOneIterate.lean | 69 + .../TashTreeRhoOneRepeatedColor.lean | 143 + .../TashTreeRhoOneTerminalReplacement.lean | 50 + .../TashTreeSuffixAdvance.lean | 285 + .../TashTreeSuffixIterate.lean | 75 + .../GoldbergSeymour/TashTreeSuffixPath.lean | 33 + .../TashTreeSuffixTerminalReplacement.lean | 386 + .../TashkinovAlternatingSegmentAppend.lean | 739 ++ .../TashkinovAugmentation.lean | 33 + .../TashkinovAugmentationSequence.lean | 29 + ...AugmentationSequenceColoringTransport.lean | 149 + ...inovAugmentationSequenceComponentSwap.lean | 144 + ...novAugmentationSequenceInitialSegment.lean | 57 + ...TashkinovAugmentationSequencePosition.lean | 150 + ...ntationSequencePreservesTashkinovTree.lean | 74 + ...TashkinovAugmentationSequenceRestrict.lean | 101 + ...entationSequenceStrictBoundaryWitness.lean | 79 + .../TashkinovAugmentationSequenceSuffix.lean | 94 + .../GoldbergSeymour/TashkinovClosure.lean | 30 + .../TashkinovClosureExists.lean | 211 + ...inovClosureOfRouteAndAllMissingClosed.lean | 45 + .../TashkinovClosureVertexSetUnique.lean | 130 + .../TashkinovExtensionKind.lean | 33 + .../GoldbergSeymour/TashkinovHierarchy.lean | 49 + LeanPool/GoldbergSeymour/TashkinovOrder.lean | 39 + .../GoldbergSeymour/TashkinovOrderBound.lean | 39 + LeanPool/GoldbergSeymour/TashkinovSeries.lean | 31 + .../TashkinovSeriesAppend.lean | 59 + .../TashkinovSeriesColoringProperties.lean | 54 + .../GoldbergSeymour/TashkinovSeriesData.lean | 49 + .../TashkinovSeriesDataAppend.lean | 41 + .../TashkinovSeriesDataPrefix.lean | 38 + .../TashkinovSeriesFinalETTExists.lean | 110 + .../TashkinovSeriesPrefix.lean | 45 + .../GoldbergSeymour/TashkinovSeriesStep.lean | 154 + .../TashkinovSeriesStepAppend.lean | 1459 +++ .../TashkinovSeriesStepPrefix.lean | 1615 +++ .../TashkinovStoredColors.lean | 35 + .../TashkinovStoredColorsAppend.lean | 84 + .../TashkinovStoredColorsCardinality.lean | 687 ++ .../TashkinovStoredColorsPrefix.lean | 56 + LeanPool/GoldbergSeymour/TashkinovTree.lean | 33 + ...inovTreeComponentSwapWitnessTransport.lean | 178 + .../TashkinovTreeFromLengthOnePrefix.lean | 96 + LeanPool/GoldbergSeymour/Tchange.lean | 194 + .../TchangeCounterexample.lean | 93 + .../TchangeCounterexampleMeasure.lean | 30 + .../TchangeKempeClosureData.lean | 82 + .../TchangeKempeClosurePreparation.lean | 1045 ++ .../TchangeOutsideSwapPreparation.lean | 688 ++ .../TchangeStrictShortening.lean | 594 ++ LeanPool/GoldbergSeymour/Td.lean | 90 + .../TdEarlierPEWitnessIdentification.lean | 121 + .../TdReplacementPrefixExact.lean | 1704 ++++ .../GoldbergSeymour/TdTerminalRERebuild.lean | 7908 +++++++++++++++ .../TdTerminalSEPERebuild.lean | 3305 +++++++ ...chnicalCurrentLadderMissingBoundLarge.lean | 419 + .../TechnicalCurrentRungElementaryLarge.lean | 200 + .../TechnicalInductionContext.lean | 181 + .../GoldbergSeymour/TechnicalTheoremBase.lean | 226 + .../TechnicalTheoremLarge.lean | 335 + .../TerminalClosureMaximum.lean | 47 + .../TerminalHierarchyPrefixConstruction.lean | 445 + .../TerminalHierarchyPrefixPreparation.lean | 454 + .../TerminalHierarchyRestore.lean | 772 ++ .../TerminalKempeStageSwitch.lean | 1733 ++++ .../TerminalPrefixReconstruction.lean | 224 + LeanPool/GoldbergSeymour/TerminalRoute.lean | 166 + .../TerminalSeriesRebuildPreparation.lean | 5777 +++++++++++ .../TerminalSeriesRebuildTransport.lean | 7016 +++++++++++++ .../GoldbergSeymour/TerminalStableRoute.lean | 236 + .../GoldbergSeymour/TerminalStoredColors.lean | 66 + LeanPool/GoldbergSeymour/ThetaExclusion.lean | 138 + LeanPool/GoldbergSeymour/ThmGS.lean | 37 + LeanPool/GoldbergSeymour/ThmGS2.lean | 66 + LeanPool/GoldbergSeymour/ThmScheide.lean | 43 + .../GoldbergSeymour/TreeColorSetClosed.lean | 30 + .../TreeColorSetMinusClosed.lean | 31 + .../TreeColorUnusedThrough.lean | 31 + .../TreeColoringInvariant.lean | 32 + LeanPool/GoldbergSeymour/TreeExit.lean | 32 + .../TreeExitComponentMeetsTreeOnlyAtExit.lean | 203 + LeanPool/GoldbergSeymour/TreeExitPath.lean | 39 + LeanPool/GoldbergSeymour/TreeFreeColors.lean | 31 + .../GoldbergSeymour/TreeIncidentEdge.lean | 30 + .../GoldbergSeymour/TreeInterchangeable.lean | 35 + .../GoldbergSeymour/TreeMissingColors.lean | 32 + .../TreeMissingColorsCardLowerBound.lean | 334 + LeanPool/GoldbergSeymour/TreeSequence.lean | 46 + .../TreeSequenceAdjoinEdge.lean | 30 + .../TreeSequenceAdjoinEdgeUnique.lean | 158 + .../TreeSequenceBoundaryEdgeAppendExists.lean | 174 + .../GoldbergSeymour/TreeSequenceEdgeSet.lean | 30 + .../TreeSequenceInitialSegment.lean | 31 + .../TreeSequenceInitialSegmentFacts.lean | 79 + ...TreeSequenceInitialSegmentVertexSetEq.lean | 57 + ...SequenceInitialSegmentVertexSetStrict.lean | 46 + ...SequenceInitialSegmentVertexSetSubset.lean | 40 + .../GoldbergSeymour/TreeSequencePrefix.lean | 53 + .../TreeSequenceVertexSet.lean | 30 + LeanPool/GoldbergSeymour/TreeUsedColors.lean | 34 + LeanPool/GoldbergSeymour/TreeVertexOrder.lean | 29 + .../GoldbergSeymour/TreeVerticesBefore.lean | 31 + LeanPool/GoldbergSeymour/TrunkRotation.lean | 65 + .../GoldbergSeymour/TwoColorComponent.lean | 29 + .../TwoColorComponentCycle.lean | 31 + .../TwoColorComponentNearestSegment.lean | 534 + .../TwoColorComponentSpanningPath.lean | 165 + .../TwoColorComponentSwap.lean | 53 + ...woColorComponentSwapDisjointPairGraph.lean | 104 + .../TwoColorComponentSwapMissingBehavior.lean | 163 + .../TwoColorComponentSwapNonElementary.lean | 335 + ...mponentSwapPreservesDisjointComponent.lean | 143 + .../TwoColorComponentSwapProper.lean | 106 + .../TwoColorComponentTashkinovSplice.lean | 76 + .../TwoColorComponentsDisjoint.lean | 38 + LeanPool/GoldbergSeymour/TwoColorCycle.lean | 34 + .../TwoColorIncidenceDegreeAtMostTwo.lean | 161 + .../TwoColorIncidenceGraph.lean | 54 + ...InterchangeableDistinctComponentCycle.lean | 208 + .../TwoColorNontrivialPathComponent.lean | 30 + .../TwoColorPathComponent.lean | 31 + .../TwoColorPathComponentNotCycle.lean | 42 + LeanPool/projects/goldberg-seymour.yaml | 53 + 730 files changed, 433402 insertions(+) create mode 100644 LeanPool/GoldbergSeymour.lean create mode 100644 LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean create mode 100644 LeanPool/GoldbergSeymour/AbsorbingVertex.lean create mode 100644 LeanPool/GoldbergSeymour/AbsorbingVertices.lean create mode 100644 LeanPool/GoldbergSeymour/AdjacentEdges.lean create mode 100644 LeanPool/GoldbergSeymour/AlgorithmFiveFiveBaseStage.lean create mode 100644 LeanPool/GoldbergSeymour/AlgorithmFiveFiveInitialGoodHierarchy.lean create mode 100644 LeanPool/GoldbergSeymour/AlgorithmFiveFiveParallelStrictGrowth.lean create mode 100644 LeanPool/GoldbergSeymour/AlgorithmFiveFiveSeed.lean create mode 100644 LeanPool/GoldbergSeymour/AlgorithmFiveSixFixedRootRefresh.lean create mode 100644 LeanPool/GoldbergSeymour/AlgorithmThreeOneChoiceDataExists.lean create mode 100644 LeanPool/GoldbergSeymour/AlgorithmThreeOneInitialSeriesExists.lean create mode 100644 LeanPool/GoldbergSeymour/AlgorithmThreeOneStepExists.lean create mode 100644 LeanPool/GoldbergSeymour/BalancedGlobalMaximumTriple.lean create mode 100644 LeanPool/GoldbergSeymour/BaseControl.lean create mode 100644 LeanPool/GoldbergSeymour/BaseDisplayedEdges.lean create mode 100644 LeanPool/GoldbergSeymour/BaseExtraReplacement.lean create mode 100644 LeanPool/GoldbergSeymour/Basic2.lean create mode 100644 LeanPool/GoldbergSeymour/Basic2TerminalPE.lean create mode 100644 LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean create mode 100644 LeanPool/GoldbergSeymour/BoundaryColorEdges.lean create mode 100644 LeanPool/GoldbergSeymour/BoundaryColorVertex.lean create mode 100644 LeanPool/GoldbergSeymour/BoundaryEdges.lean create mode 100644 LeanPool/GoldbergSeymour/BoundaryMissingColorAugmentation.lean create mode 100644 LeanPool/GoldbergSeymour/CertifiedETTPredecessor.lean create mode 100644 LeanPool/GoldbergSeymour/CertifiedETTRestriction.lean create mode 100644 LeanPool/GoldbergSeymour/CertifiedSeriesRoundsBound.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemma.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation2.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation3.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation4.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation5.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaInsideOutside.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean create mode 100644 LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean create mode 100644 LeanPool/GoldbergSeymour/ChromaticIndex.lean create mode 100644 LeanPool/GoldbergSeymour/ChromaticIndexRestrict.lean create mode 100644 LeanPool/GoldbergSeymour/ChromaticIndexSpec.lean create mode 100644 LeanPool/GoldbergSeymour/ClosedColorExitPathBoundaryEdge.lean create mode 100644 LeanPool/GoldbergSeymour/ClosedCoreElementary.lean create mode 100644 LeanPool/GoldbergSeymour/ClosedSetTwoColorComponentAvoidance.lean create mode 100644 LeanPool/GoldbergSeymour/ColoredVertexSetClosed.lean create mode 100644 LeanPool/GoldbergSeymour/ColoredVertexSetElementary.lean create mode 100644 LeanPool/GoldbergSeymour/ColoredVertexSetStronglyClosed.lean create mode 100644 LeanPool/GoldbergSeymour/ColoringExists.lean create mode 100644 LeanPool/GoldbergSeymour/CombinedStableClosurePreserved.lean create mode 100644 LeanPool/GoldbergSeymour/CombinedStableColoring.lean create mode 100644 LeanPool/GoldbergSeymour/CommonMissingColorsAtUncoloredEndpoints.lean create mode 100644 LeanPool/GoldbergSeymour/ConditionNineTransport.lean create mode 100644 LeanPool/GoldbergSeymour/CopyAugmentationPrefix.lean create mode 100644 LeanPool/GoldbergSeymour/CoreClosurePresentation.lean create mode 100644 LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTree.lean create mode 100644 LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTrans.lean create mode 100644 LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTransTrees.lean create mode 100644 LeanPool/GoldbergSeymour/CorrespondingTerminalClosureEq.lean create mode 100644 LeanPool/GoldbergSeymour/Critical.lean create mode 100644 LeanPool/GoldbergSeymour/CriticalCoreExists.lean create mode 100644 LeanPool/GoldbergSeymour/CriticalGraphElementaryWitness.lean create mode 100644 LeanPool/GoldbergSeymour/CurrentElementaryOrGoodHierarchyConstructionLarge.lean create mode 100644 LeanPool/GoldbergSeymour/DefectiveColor.lean create mode 100644 LeanPool/GoldbergSeymour/DefectiveColorComponentPath.lean create mode 100644 LeanPool/GoldbergSeymour/DefectiveColors.lean create mode 100644 LeanPool/GoldbergSeymour/DefectiveEdge.lean create mode 100644 LeanPool/GoldbergSeymour/DefectiveVertex.lean create mode 100644 LeanPool/GoldbergSeymour/Degree.lean create mode 100644 LeanPool/GoldbergSeymour/DeleteEdge.lean create mode 100644 LeanPool/GoldbergSeymour/Density.lean create mode 100644 LeanPool/GoldbergSeymour/DensityCeil.lean create mode 100644 LeanPool/GoldbergSeymour/DensityLowerBound.lean create mode 100644 LeanPool/GoldbergSeymour/DensityMonotone.lean create mode 100644 LeanPool/GoldbergSeymour/DensityValue.lean create mode 100644 LeanPool/GoldbergSeymour/DisplayedEdges.lean create mode 100644 LeanPool/GoldbergSeymour/ETTFirstAppearanceIndex.lean create mode 100644 LeanPool/GoldbergSeymour/ETTStrongInterchangeable.lean create mode 100644 LeanPool/GoldbergSeymour/EarlierPECycleFirstNonrevisitingInternal.lean create mode 100644 LeanPool/GoldbergSeymour/Elementary.lean create mode 100644 LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean create mode 100644 LeanPool/GoldbergSeymour/ElementaryClosedExitPairExtendsTriple.lean create mode 100644 LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean create mode 100644 LeanPool/GoldbergSeymour/ElementaryClosedMissingColorOdd.lean create mode 100644 LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableDisjointExitPaths.lean create mode 100644 LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableExitPair.lean create mode 100644 LeanPool/GoldbergSeymour/ElementaryEndpointExclusion.lean create mode 100644 LeanPool/GoldbergSeymour/ElementaryPrefixSwap.lean create mode 100644 LeanPool/GoldbergSeymour/ElementarySingleBoundaryInterchangeable.lean create mode 100644 LeanPool/GoldbergSeymour/ElementaryTerminalComponent.lean create mode 100644 LeanPool/GoldbergSeymour/ElementaryTransfer.lean create mode 100644 LeanPool/GoldbergSeymour/EligibleIndexBoundConstruction.lean create mode 100644 LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/EligibleOddSet.lean create mode 100644 LeanPool/GoldbergSeymour/EmptyCommonMissingLocation.lean create mode 100644 LeanPool/GoldbergSeymour/ExtendedTashkinovColoringSequence.lean create mode 100644 LeanPool/GoldbergSeymour/ExtendedTashkinovLadderStage.lean create mode 100644 LeanPool/GoldbergSeymour/ExtendedTashkinovRungNumber.lean create mode 100644 LeanPool/GoldbergSeymour/ExtendedTashkinovTree.lean create mode 100644 LeanPool/GoldbergSeymour/ExtendedTashkinovTreePrefix.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBase.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseActiveIndices.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmA.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAColorState.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAInduction.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmASingleStep.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmATraceExists.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmB.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInvariant.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBSingleStep.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTrace.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTraceExists.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmCInvariant.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmCTrace.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseCaseOneIndices.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseCaseOneSelection.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation19.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation20.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation21.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation23.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaim43.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaim43EdgeEffects.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaim43MissingColors.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaim43Stability.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaim43TreeEdges.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaim45.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaimMissingColors.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaimStrongInterchangeable.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClaimTreeEdgeColors.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseClosure.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseDeltaExclusion.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseLeastActiveDeltaTransport.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBasePESlotDeltaNotMissing.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBasePreparations.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseRestorationIndices.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseRestorationInvariant.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseRestorationTrace.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseSameSupportStoredPairOverlap.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseStoredPairOverlap.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseStrictDeltaExclusion.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseSupportClass.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseSupportClassColors.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseSupportClassEnumeration.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionBaseSupportOrder.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionRules.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionRulesEarlierIndices.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionRulesPEFirstAppearanceBound.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionRulesTerminalEarlierAppearance.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionRulesTerminalLastAppearance.lean create mode 100644 LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean create mode 100644 LeanPool/GoldbergSeymour/FiniteStrictGrowthReachesTerminal.lean create mode 100644 LeanPool/GoldbergSeymour/FirstEntryClipping.lean create mode 100644 LeanPool/GoldbergSeymour/FixedPairMaximalTashkinovTree.lean create mode 100644 LeanPool/GoldbergSeymour/GeneralHighIndexElementary.lean create mode 100644 LeanPool/GoldbergSeymour/GlobalMaximumTriple.lean create mode 100644 LeanPool/GoldbergSeymour/GlobalMaximumTripleExists.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchy.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyCommonOriginalBaseTransport.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyElementaryLarge.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyInitialPairsNonPE.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyInitialPairsPE.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyNewMissingClosed.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyPrefixConstruction.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyPrefixRepackage.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyReservedDisjoint.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyRestrictedAugmentation.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyRestrictedEndpointMinusClosed.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyRestrictedEndpointReconstruction.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyRestrictedMaximalChain.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchySameDividerTransport.lean create mode 100644 LeanPool/GoldbergSeymour/GoodHierarchyTerminalPrefixRepackage.lean create mode 100644 LeanPool/GoldbergSeymour/HasKEdgeColoring.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyBase.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyBaseCorrespondingTransport.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyBaseExists.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyCaseThreePreparation.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyClaimNine.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyClaimNinePENormalization.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyClaimNineUnusedTailColor.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyCounterexample.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyCounterexampleLess.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyCounterexampleMeasure.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionPositiveDividerImpossible.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionZeroDividerImpossible.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyCounterexamplePathNumberBounds.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyCounterexamplePenultimateElementary.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyCounterexampleTailAtLeastTwo.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyCounterexampleTerminalCommonMissing.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyEligibleCommonMissingIndices.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyFirstMissingPosition.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyFullTailLength.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyFullTailPrefix.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyLEMStable.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyMeasures.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyMinimumCounterexampleContext.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyNonparallelFirstEdge.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyNormalizationLemmas.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyOrderedExitReduction.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyOutsideKempeStable.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyPathNumber.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyPrefixData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyReplacementPresentation.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyReplacementPresentationTrans.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySegmentColors.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationOneImpossible.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationOnePenultimateCommonMissing.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeColorChoice.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationThreeImpossible.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneTwoData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalization.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalizedData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeOneData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeTwoData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoExclusions.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoTwoData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoCommonTailData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoImpossible.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoOutsidePenultimateReconstruction.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTrees.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation1.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation2.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOne.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation2.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOne.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySituationTwoTailData.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchySplitter.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyStageInterchangeability.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyStageMissingColors.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyStarredStage.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyStoredColorsAntitone.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyStoredColorsAt.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyStoredColorsCardinality.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyTailMissingColorExclusion.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyTailPrefix.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyTerminalStoredColors.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyTerminalStoredColorsSubsetLast.lean create mode 100644 LeanPool/GoldbergSeymour/HierarchyWeaklyStable.lean create mode 100644 LeanPool/GoldbergSeymour/HkuIncidentColorPreserved.lean create mode 100644 LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean create mode 100644 LeanPool/GoldbergSeymour/HkuParallelBoundaryStructure.lean create mode 100644 LeanPool/GoldbergSeymour/HkuTreeColorsControlled.lean create mode 100644 LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean create mode 100644 LeanPool/GoldbergSeymour/Imports.lean create mode 100644 LeanPool/GoldbergSeymour/Incident.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCore.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreChromaticIndex.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreColoringTransport.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreCritical.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreDegree.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreDensity.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreElementaryTransfer.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreEndpoints.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreIncidence.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreInternalEdges.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreKTriple.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreMaximumDegree.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreMissingColors.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreNoIsolated.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreReduction.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreTashkinovOrder.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentCoreTreeTransport.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentVertex.lean create mode 100644 LeanPool/GoldbergSeymour/IncidentVertexFintype.lean create mode 100644 LeanPool/GoldbergSeymour/InterchangePEClosedCore.lean create mode 100644 LeanPool/GoldbergSeymour/InterchangePEClosureConstituent.lean create mode 100644 LeanPool/GoldbergSeymour/InterchangePECommonMissingClosed.lean create mode 100644 LeanPool/GoldbergSeymour/InterchangePEMixedCore.lean create mode 100644 LeanPool/GoldbergSeymour/InterchangePETreeAwayFromDelta.lean create mode 100644 LeanPool/GoldbergSeymour/InterchangePETreeConstituent.lean create mode 100644 LeanPool/GoldbergSeymour/InternalEdges.lean create mode 100644 LeanPool/GoldbergSeymour/IsFullEdgeColoring.lean create mode 100644 LeanPool/GoldbergSeymour/IsOneEdgeUncolored.lean create mode 100644 LeanPool/GoldbergSeymour/IsProperEdgeColoring.lean create mode 100644 LeanPool/GoldbergSeymour/KTriple.lean create mode 100644 LeanPool/GoldbergSeymour/KempeOrientation.lean create mode 100644 LeanPool/GoldbergSeymour/LargeOrderTerminalWitness.lean create mode 100644 LeanPool/GoldbergSeymour/LateOwnerReplacement.lean create mode 100644 LeanPool/GoldbergSeymour/LooplessMultigraph.lean create mode 100644 LeanPool/GoldbergSeymour/LowerRoundInductionHypothesis.lean create mode 100644 LeanPool/GoldbergSeymour/LowerRoundProperties.lean create mode 100644 LeanPool/GoldbergSeymour/MaximumDefectiveChoice.lean create mode 100644 LeanPool/GoldbergSeymour/MaximumDefectiveChoiceExists.lean create mode 100644 LeanPool/GoldbergSeymour/MaximumDegree.lean create mode 100644 LeanPool/GoldbergSeymour/MaximumDegreeRestrict.lean create mode 100644 LeanPool/GoldbergSeymour/MaximumProperty.lean create mode 100644 LeanPool/GoldbergSeymour/MaximumPropertyAppend.lean create mode 100644 LeanPool/GoldbergSeymour/MaximumPropertyPrefix.lean create mode 100644 LeanPool/GoldbergSeymour/MaximumPropertyTransport.lean create mode 100644 LeanPool/GoldbergSeymour/MaximumStableClosureExists.lean create mode 100644 LeanPool/GoldbergSeymour/MinimumContextTransport.lean create mode 100644 LeanPool/GoldbergSeymour/MinusClosedTransport.lean create mode 100644 LeanPool/GoldbergSeymour/MissingColorIncidenceEndpoint.lean create mode 100644 LeanPool/GoldbergSeymour/MissingColors.lean create mode 100644 LeanPool/GoldbergSeymour/MissingColorsNonemptyOfMaximumDegree.lean create mode 100644 LeanPool/GoldbergSeymour/MixedNoClosedTransport.lean create mode 100644 LeanPool/GoldbergSeymour/ModColoring.lean create mode 100644 LeanPool/GoldbergSeymour/NestedOddMissingPair.lean create mode 100644 LeanPool/GoldbergSeymour/NineN.lean create mode 100644 LeanPool/GoldbergSeymour/NormalCycleEdge.lean create mode 100644 LeanPool/GoldbergSeymour/NormalGlobalMaximumTriple.lean create mode 100644 LeanPool/GoldbergSeymour/NormalTripleTrunk.lean create mode 100644 LeanPool/GoldbergSeymour/NormalizePositiveTerminalMaximum.lean create mode 100644 LeanPool/GoldbergSeymour/NormalizedDatum.lean create mode 100644 LeanPool/GoldbergSeymour/OneAdditionPreparatoryLemmas.lean create mode 100644 LeanPool/GoldbergSeymour/OneDividerRefresh.lean create mode 100644 LeanPool/GoldbergSeymour/OppositeRootComponents.lean create mode 100644 LeanPool/GoldbergSeymour/OrderedExitCounterexample.lean create mode 100644 LeanPool/GoldbergSeymour/OrderedTreeUnion.lean create mode 100644 LeanPool/GoldbergSeymour/OrderedTreeUnionAugmentationSequence.lean create mode 100644 LeanPool/GoldbergSeymour/OrderedTreeUnionExists.lean create mode 100644 LeanPool/GoldbergSeymour/OutsideExitTransport.lean create mode 100644 LeanPool/GoldbergSeymour/OutsideKempeGoodHierarchy.lean create mode 100644 LeanPool/GoldbergSeymour/OutsideKempeRecoloring.lean create mode 100644 LeanPool/GoldbergSeymour/OutsideKempeRecoloringStable.lean create mode 100644 LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean create mode 100644 LeanPool/GoldbergSeymour/OutsideSwapPrefixEffects.lean create mode 100644 LeanPool/GoldbergSeymour/OutsideTreeColorSwap.lean create mode 100644 LeanPool/GoldbergSeymour/OutsideTreeColorSwapStable.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelBaseFourCommonMissingColors.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelClosureUnionElementary.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelCommonMissingClosed.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelCoreAugmentationStrict.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelExtensionColor.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelExtensionColorAppend.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelExtensionColorExists.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelInterchangeability.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelSpecialClosurePreparation.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelStepRootComponentSetup.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelTerminalAwayInterchangeable.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelTerminalFacts.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelTerminalPEPreprocessing.lean create mode 100644 LeanPool/GoldbergSeymour/ParallelTwoConstituentPathContradiction.lean create mode 100644 LeanPool/GoldbergSeymour/PartialEdgeColoring.lean create mode 100644 LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean create mode 100644 LeanPool/GoldbergSeymour/PositivePrefixPresentation.lean create mode 100644 LeanPool/GoldbergSeymour/PositiveWellDefinedness.lean create mode 100644 LeanPool/GoldbergSeymour/Preamble.lean create mode 100644 LeanPool/GoldbergSeymour/PredecessorElementary.lean create mode 100644 LeanPool/GoldbergSeymour/PrefixSegmentTransport.lean create mode 100644 LeanPool/GoldbergSeymour/PresentColors.lean create mode 100644 LeanPool/GoldbergSeymour/ProperColoringRestricts.lean create mode 100644 LeanPool/GoldbergSeymour/RecoloredPrefixReconstruction.lean create mode 100644 LeanPool/GoldbergSeymour/RestrictEdges.lean create mode 100644 LeanPool/GoldbergSeymour/RestrictedAugmentationCorrespondingEndpoint.lean create mode 100644 LeanPool/GoldbergSeymour/RetainedHierarchy.lean create mode 100644 LeanPool/GoldbergSeymour/RevisitingCertificatePreparation.lean create mode 100644 LeanPool/GoldbergSeymour/RevisitingExtensionCertificate.lean create mode 100644 LeanPool/GoldbergSeymour/RevisitingExtensionCertificateAppend.lean create mode 100644 LeanPool/GoldbergSeymour/RevisitingExtensionSeedStoredColor.lean create mode 100644 LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/RevisitingTerminalStatements.lean create mode 100644 LeanPool/GoldbergSeymour/RutgersClosedPresentation.lean create mode 100644 LeanPool/GoldbergSeymour/RutgersCounterexample.lean create mode 100644 LeanPool/GoldbergSeymour/RutgersCounterexampleMeasure.lean create mode 100644 LeanPool/GoldbergSeymour/RutgersCounterexampleMinimumExists.lean create mode 100644 LeanPool/GoldbergSeymour/RutgersCurrentRungInterchangeability.lean create mode 100644 LeanPool/GoldbergSeymour/RutgersMiddleExitOutsideTerminalLadder.lean create mode 100644 LeanPool/GoldbergSeymour/RutgersStrictShortening.lean create mode 100644 LeanPool/GoldbergSeymour/SameColorSeriesPreserved.lean create mode 100644 LeanPool/GoldbergSeymour/SameGoodHierarchy.lean create mode 100644 LeanPool/GoldbergSeymour/SameHierarchyStages.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideAbsorbingElementary.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideBalancedCandidate.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumExists.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumOrder.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideBalancedCandidateNormalTransport.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideBalancedExists.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideBalancedFromMaxNormal.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveChainBoundaryEdges.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveChainDepartureReturn.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveChainLastReturnNoFree.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveChainPath.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveChainPathExists.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveCrossingSelection.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveLastReturnExists.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveReturnData.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveSecondTerminalComponent.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveSetup.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveSetupExists.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveSwitchEffect.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveTailExternal.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveTerminalComponent.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDeletedMissingReplacementInternal.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideDepartureReturn.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideEnlargedBoundarySelection.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideEnlargedClosed.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideEnlargedElementary.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideEnlargedStrictAugmentation.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideEnlargedStronglyClosed.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideEnlargedSwitchTransport.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideEnlargedVertexSet.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideExitNoFree.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideExitVertex.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideExitVertexTreeExit.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideExitVertices.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideGlobalMaximumBoundaryFacts.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideGlobalMaximumFixedPairMaximal.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideGlobalMaximumFourFree.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideGlobalMaximumMissingCounts.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideGlobalMaximumOrder.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideGlobalMaximumUnused.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideGraphHeight.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideGraphHeightOdd.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideKempePathHeightBound.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideLargeHeightElementary.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideLargeHeightFullTrunk.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideLargeHeightOneTailPair.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideLastExitPath.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideMaximalContainsEveryTree.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideMaximalElementaryClosed.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideMaximalExtendsEveryTree.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideMaximalKempePath.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideMaximalOddOrder.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideMaximumExtensionNormalWitness.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideNormalisation.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideOrderNineBlockCompletion.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideOrderNineExitLocalization.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideOrderNineParameters.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideOrderNineRebasingPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideOrderNineStructuralConfiguration.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideOriginalDefectiveConfinement.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideOriginalNondefectiveConfinement.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReducedConfiguration.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementAbsorbing.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtLeastThree.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementBoundaryParity.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementBoundaryUnique.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementConfinement.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementData.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementExitNotDefective.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementFamilyExists.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementInternalMissing.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementMaximum.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementPairFixed.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementPairsLaminar.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementPathPrefix.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementTreeSplice.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementUnionClosed.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReplacementUsedWitness.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReversedKempePathTree.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReversedPathCertificate.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideReversedPathPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSingleBoundaryCrossing.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSmallHeightElementary.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideStructuralConfiguration.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideStructuralExitsInBase.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideStructuralInternalPair.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideStructuralLemma.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideStructuralReduction.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideStructuralReordering.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideStructuralReorderingData.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideStructuralSelection.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideStructuralSelectionData.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSymmetricDefectiveInternal.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSymmetricMissingInternal.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSymmetricOriginalBoundaryAvoidance.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSymmetricOriginalFreePath.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSymmetricOriginalPathOrder.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryAvoidance.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryConfiguration.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSymmetricReplacementFreePath.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideSymmetricReplacementPathOrder.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideTrunkRotationColoring.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideTrunkRotationCycle.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideTrunkRotationNormal.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideTrunkRotationPreserves.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideTrunkRotationTree.lean create mode 100644 LeanPool/GoldbergSeymour/ScheideTwoColorLastExitPath.lean create mode 100644 LeanPool/GoldbergSeymour/SimpleExtensionSeedStoredColor.lean create mode 100644 LeanPool/GoldbergSeymour/SplitSwapData.lean create mode 100644 LeanPool/GoldbergSeymour/SplitSwapPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/StableChange.lean create mode 100644 LeanPool/GoldbergSeymour/StableChangeCaseThree.lean create mode 100644 LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean create mode 100644 LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation2.lean create mode 100644 LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation3.lean create mode 100644 LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation4.lean create mode 100644 LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation5.lean create mode 100644 LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean create mode 100644 LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean create mode 100644 LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean create mode 100644 LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean create mode 100644 LeanPool/GoldbergSeymour/StableColoring.lean create mode 100644 LeanPool/GoldbergSeymour/StableColoringBeforeVertex.lean create mode 100644 LeanPool/GoldbergSeymour/StableColoringEquivalence.lean create mode 100644 LeanPool/GoldbergSeymour/StableColoringExitExtension.lean create mode 100644 LeanPool/GoldbergSeymour/StableColoringFullCertificate.lean create mode 100644 LeanPool/GoldbergSeymour/StableColoringIncidentEdgeCriterion.lean create mode 100644 LeanPool/GoldbergSeymour/StableSeriesCycleComponentTransport.lean create mode 100644 LeanPool/GoldbergSeymour/StarredPrefixPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseOneInsidePositiveDivider.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseOneInsideStar.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroNonPE.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroPE.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseOneOutsideStar.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseTwoInsidePositiveDivider.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseTwoInsideStar.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroNonPE.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroPE.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixHierarchy.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixTwoEdges.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRecoloredPrefix.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRestrictedAugmentation.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseTwoOutsideStar.lean create mode 100644 LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ExitLegGlobalMinimum.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ExitLegMinimum.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ExitLegMinimumExists.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ExitLegPrecoloringElementary.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ExitLegPresentation.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ExitLegPresentationExists.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ExitLegThetaPositive.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroNonparallel.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroParallel.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ZeroDividerAnchor.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorNonPE.lean create mode 100644 LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorPE.lean create mode 100644 LeanPool/GoldbergSeymour/StrongInterchangeabilityKempePreserved.lean create mode 100644 LeanPool/GoldbergSeymour/StronglyClosedWitnessElementary.lean create mode 100644 LeanPool/GoldbergSeymour/SupportingPEColorChain.lean create mode 100644 LeanPool/GoldbergSeymour/SupportingPEMissingTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean create mode 100644 LeanPool/GoldbergSeymour/TashTree.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeBadPair.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeCaseNoRepeatedOnPath.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeCasePathIndexLast.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeCaseRepeatedOnPath.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeControlledInterchange.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeControlledRepeatedSuffixContradiction.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeDisjointComponentNormalization.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeEarlyBetaNormalization.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeFourUnusedColors.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeGammaEpsilonSetup.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeLastIndexDeletion.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeLastIndexFirstNormalForm.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeLastIndexIntersectionShortening.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeLastIndexSecondNormalForm.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeLastIndexThirdNormalForm.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeMinimumBadLengthAtLeastTwo.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeMinimumBadPair.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeMinimumBadPairExists.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeMinimumBadPathIndex.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeNoMinimumBadPair.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeNoRepeatedDisjointReduction.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeNoRepeatedIntersectionShortening.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreePathIndex.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreePathIndexTwoReplacement.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeProperInitialSegmentRankLess.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeProperPrefixElementary.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeRankLess.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeRhoOneAdvance.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeRhoOneIterate.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeRhoOneRepeatedColor.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeRhoOneTerminalReplacement.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeSuffixAdvance.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeSuffixIterate.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeSuffixPath.lean create mode 100644 LeanPool/GoldbergSeymour/TashTreeSuffixTerminalReplacement.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAlternatingSegmentAppend.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentation.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentationSequence.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceColoringTransport.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceComponentSwap.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePosition.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePreservesTashkinovTree.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceRestrict.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceStrictBoundaryWitness.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceSuffix.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovClosure.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovClosureExists.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovClosureOfRouteAndAllMissingClosed.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovClosureVertexSetUnique.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovExtensionKind.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovHierarchy.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovOrder.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovOrderBound.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeries.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesAppend.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesColoringProperties.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesData.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesDataAppend.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesDataPrefix.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesFinalETTExists.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesPrefix.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesStep.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesStepAppend.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesStepPrefix.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovStoredColors.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovStoredColorsAppend.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovStoredColorsCardinality.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovStoredColorsPrefix.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovTree.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovTreeComponentSwapWitnessTransport.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovTreeFromLengthOnePrefix.lean create mode 100644 LeanPool/GoldbergSeymour/Tchange.lean create mode 100644 LeanPool/GoldbergSeymour/TchangeCounterexample.lean create mode 100644 LeanPool/GoldbergSeymour/TchangeCounterexampleMeasure.lean create mode 100644 LeanPool/GoldbergSeymour/TchangeKempeClosureData.lean create mode 100644 LeanPool/GoldbergSeymour/TchangeKempeClosurePreparation.lean create mode 100644 LeanPool/GoldbergSeymour/TchangeOutsideSwapPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/TchangeStrictShortening.lean create mode 100644 LeanPool/GoldbergSeymour/Td.lean create mode 100644 LeanPool/GoldbergSeymour/TdEarlierPEWitnessIdentification.lean create mode 100644 LeanPool/GoldbergSeymour/TdReplacementPrefixExact.lean create mode 100644 LeanPool/GoldbergSeymour/TdTerminalRERebuild.lean create mode 100644 LeanPool/GoldbergSeymour/TdTerminalSEPERebuild.lean create mode 100644 LeanPool/GoldbergSeymour/TechnicalCurrentLadderMissingBoundLarge.lean create mode 100644 LeanPool/GoldbergSeymour/TechnicalCurrentRungElementaryLarge.lean create mode 100644 LeanPool/GoldbergSeymour/TechnicalInductionContext.lean create mode 100644 LeanPool/GoldbergSeymour/TechnicalTheoremBase.lean create mode 100644 LeanPool/GoldbergSeymour/TechnicalTheoremLarge.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalClosureMaximum.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalHierarchyPrefixConstruction.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalPrefixReconstruction.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalRoute.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalStableRoute.lean create mode 100644 LeanPool/GoldbergSeymour/TerminalStoredColors.lean create mode 100644 LeanPool/GoldbergSeymour/ThetaExclusion.lean create mode 100644 LeanPool/GoldbergSeymour/ThmGS.lean create mode 100644 LeanPool/GoldbergSeymour/ThmGS2.lean create mode 100644 LeanPool/GoldbergSeymour/ThmScheide.lean create mode 100644 LeanPool/GoldbergSeymour/TreeColorSetClosed.lean create mode 100644 LeanPool/GoldbergSeymour/TreeColorSetMinusClosed.lean create mode 100644 LeanPool/GoldbergSeymour/TreeColorUnusedThrough.lean create mode 100644 LeanPool/GoldbergSeymour/TreeColoringInvariant.lean create mode 100644 LeanPool/GoldbergSeymour/TreeExit.lean create mode 100644 LeanPool/GoldbergSeymour/TreeExitComponentMeetsTreeOnlyAtExit.lean create mode 100644 LeanPool/GoldbergSeymour/TreeExitPath.lean create mode 100644 LeanPool/GoldbergSeymour/TreeFreeColors.lean create mode 100644 LeanPool/GoldbergSeymour/TreeIncidentEdge.lean create mode 100644 LeanPool/GoldbergSeymour/TreeInterchangeable.lean create mode 100644 LeanPool/GoldbergSeymour/TreeMissingColors.lean create mode 100644 LeanPool/GoldbergSeymour/TreeMissingColorsCardLowerBound.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequence.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdge.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdgeUnique.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceBoundaryEdgeAppendExists.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceEdgeSet.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceInitialSegment.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentFacts.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetEq.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetStrict.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetSubset.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequencePrefix.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceVertexSet.lean create mode 100644 LeanPool/GoldbergSeymour/TreeUsedColors.lean create mode 100644 LeanPool/GoldbergSeymour/TreeVertexOrder.lean create mode 100644 LeanPool/GoldbergSeymour/TreeVerticesBefore.lean create mode 100644 LeanPool/GoldbergSeymour/TrunkRotation.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponent.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentCycle.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentNearestSegment.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentSpanningPath.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentSwap.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentSwapDisjointPairGraph.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentSwapMissingBehavior.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentSwapNonElementary.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentSwapPreservesDisjointComponent.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentSwapProper.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentTashkinovSplice.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentsDisjoint.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorCycle.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorIncidenceDegreeAtMostTwo.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorIncidenceGraph.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorInterchangeableDistinctComponentCycle.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorNontrivialPathComponent.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorPathComponent.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorPathComponentNotCycle.lean create mode 100644 LeanPool/projects/goldberg-seymour.yaml diff --git a/LeanPool/GoldbergSeymour.lean b/LeanPool/GoldbergSeymour.lean new file mode 100644 index 0000000000..ff79f86024 --- /dev/null +++ b/LeanPool/GoldbergSeymour.lean @@ -0,0 +1,42 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ + +module + +public import LeanPool.GoldbergSeymour.ThmGS + +/-! +# The Goldberg–Seymour edge-coloring theorem + +Source: arxiv:1901.10316v2, url:https://github.com/wpegden/goldberg_seymour/tree/88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 +Authors: Wesley Pegden +Status: verified +Main declarations: `GoldbergSeymour.goldbergSeymour`, `GoldbergSeymour.GeneralHighIndexElementary` +Tags: graph-theory, edge-coloring, multigraphs, tashkinov-trees +MSC: 05C15 +-/ + +/-! +Formalized by Trellis, operated by Wesley Pegden, following the mathematical +theorem of Guantao Chen, Guangming Jing and Wenan Zang, arXiv:1901.10316v2. +Adapted from wpegden/goldberg_seymour at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The Goldberg–Seymour bound for the chromatic index of a finite loopless multigraph. -/ +theorem goldbergSeymour {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) : + ChromaticIndex G ≤ max (MaximumDegree G + 1) (DensityCeil G) := by + classical + exact ThmGS G + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean b/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean new file mode 100644 index 0000000000..10b4588e3a --- /dev/null +++ b/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean @@ -0,0 +1,2879 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.NineN +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# P2905_T2_Absent Owner Replacement + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperHNcard363Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hell : ell = T.length - A.length) (hNine : (2 : ℕ) + * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun (i : ℕ) ↦ + TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ + (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : + Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) (ell - (2 : ℕ))))) (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 + : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi + (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) + ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k)))), + let r0 : Fin T.length := (⟨T.length - (2 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r1 : Fin T.length := (⟨T.length - (1 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let N : Finset (Fin k) := (phi (T.edge r0)).toList.toFinset ∪ (phi (T.edge + r1)).toList.toFinset; N.card ≤ (2 : ℕ) + +private abbrev helperHSuffixN373Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hell : ell = T.length - A.length), X.length = + T.length - (2 : ℕ) → + ∀ (hNine : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun (i : + ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ + (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : + Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) (ell - (2 : ℕ))))) (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 + : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi + (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) + ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k)))), + let r0 : Fin T.length := (⟨T.length - (2 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r1 : Fin T.length := (⟨T.length - (1 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let N : Finset (Fin k) := (phi (T.edge r0)).toList.toFinset ∪ (phi (T.edge + r1)).toList.toFinset; (↑r0 : ℕ) = T.length - (2 : ℕ) → (↑r1 : ℕ) = T.length - (1 : ℕ) → + ∀ (c : Fin k) (r : Fin T.length), X.length ≤ (↑r : ℕ) → phi (T.edge r) = some c → c ∈ N + +private abbrev helperHbetaExists392Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (C.good.gamma q); + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; + ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hell : ell = T.length - A.length), + TreeSequenceVertexSet base.core ⊆ TreeSequenceVertexSet A → + ∀ (hNine : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun (i : + ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ + (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : + Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) (ell - (2 : ℕ))))), + let U : Finset (Fin k) := ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi + (T.edge r) = some c} : Finset (Fin k)); + let Avail : Finset (Fin k) := (TreeMissingColors phi X \ M0) \ U; + ∀ (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix + T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi + (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) + ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k)))), Disjoint Gamma D → + let r0 : Fin T.length := (⟨T.length - (2 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r1 : Fin T.length := (⟨T.length - (1 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let N : Finset (Fin k) := (phi (T.edge r0)).toList.toFinset ∪ (phi (T.edge + r1)).toList.toFinset; N.card ≤ (2 : ℕ) → + let Free : Finset (Fin k) := Avail \ (Gamma ∪ D); ((Avail \ (Gamma ∪ D)).card ≤ (4 : ℕ) → + ∃ (rho : Fin (7 : ℕ) → Fin k), Function.Injective rho ∧ + ∀ (i : Fin (7 : ℕ)), rho i ∈ D ∧ rho i ∈ TreeMissingColors phi X ∧ Disjoint (C.good.gamma q + (rho i) ∪ ({rho i} : Finset (Fin k))) U) → + ∃ beta ∈ TreeMissingColors phi X, beta ∉ M0 ∧ beta ∉ Gamma ∧ beta ∉ U ∧ beta ∉ N + +private abbrev helperFirstMem500Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; (3 : ℕ) ≤ T.length - A.length → ell = T.length - + A.length → (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun + (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ + (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : + Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) (ell - (2 : ℕ)))) → (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ + ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi + (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) + ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) → (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ + ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi + (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) + ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) → + ∀ (c : Fin k), (↑(HierarchyFirstMissingPosition phi T c) : ℕ) < T.length → c ∈ MissingColors G + phi (T.vertex (HierarchyFirstMissingPosition phi T c)) + +private abbrev helperHibLt530Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha : + Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hell : ell = T.length - A.length) (hXprefix : + TreeSequenceInitialSegment X T), X.length = T.length - (2 : ℕ) → + ∀ (hNine : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun (i : + ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ + (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : + Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) (ell - (2 : ℕ))))) (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 + : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi + (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) + ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k)))), + let r0 : Fin T.length := (⟨T.length - (2 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); (↑r0 : ℕ) = T.length - (2 : ℕ) → + ∀ (beta : Fin k) (ubIdx : Fin (X.length + (1 : ℕ))), (↑(HierarchyFirstMissingPosition phi T + beta) : ℕ) ≤ (↑(Fin.castLE (Nat.succ_le_succ hXprefix.1) ubIdx) : ℕ) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) < T.length + +private abbrev helperHcase665Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha : + Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hell : ell = T.length - A.length) (hXprefix : + TreeSequenceInitialSegment X T) (hNine : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ + (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ + (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : + ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : + Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) (ell - (2 : ℕ))))) (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 + : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi + (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + omega + )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) + ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k)))) (beta : Fin k) (ubIdx : Fin (X.length + (1 + : ℕ))), alpha ∈ HierarchyStageMissingColors H q → (0 : ℕ) < H.dividerCount ∧ alpha ∈ + TreeMissingColors phi (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + have := hXprefix.1 + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + phi Tn ∨ alpha ∈ TreeMissingColors phi A ∧ alpha ∉ TashkinovStoredColors ett.series.data + (Fin.last ett.rounds) ∧ beta ∉ TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) + +private abbrev helperContinuation2632Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (alpha : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (C.good.gamma q); + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; + ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hA : TreeSequenceInitialSegment A T) (hell : ell = + T.length - A.length) (hBprefix : TreeSequenceInitialSegment B T) (hXprefix : + TreeSequenceInitialSegment X T) (hlenX : X.length = T.length - (2 : ℕ)) (hAB : + TreeSequenceInitialSegment A B) (hcoreB : TreeSequenceVertexSet base.core ⊆ + TreeSequenceVertexSet B) (hNine : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ + (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : A.length ≤ T.length := hA.1; + have this_2 : B.length ≤ T.length := hBprefix.1; + have this_3 : X.length ≤ T.length := hXprefix.1; + have this_4 : A.length ≤ B.length := hAB.1; + have this_5 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_6 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length)) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors + G phi v) \ (fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ + (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : A.length ≤ T.length := hA.1; + have this_2 : B.length ≤ T.length := hBprefix.1; + have this_3 : X.length ≤ T.length := hXprefix.1; + have this_4 : A.length ≤ B.length := hAB.1; + have this_5 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_6 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length)) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors + G phi v) \ (fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : A.length ≤ T.length := hA.1; + have this_2 : B.length ≤ T.length := hBprefix.1; + have this_3 : X.length ≤ T.length := hXprefix.1; + have this_4 : A.length ≤ B.length := hAB.1; + have this_5 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_6 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length)) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ + ({eta h} : Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) (ell - (2 : ℕ))))) (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 + : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : A.length ≤ T.length := hA.1; + have this_2 : B.length ≤ T.length := hBprefix.1; + have this_3 : X.length ≤ T.length := hXprefix.1; + have this_4 : A.length ≤ B.length := hAB.1; + have this_5 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_6 : (1 : ℕ) ≤ T.length := T.positive; + have this_7 : (1 : ℕ) ≤ (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length := (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length) ↦ + by omega + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length)) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors + G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi + (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + - (2 : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : A.length ≤ T.length := hA.1; + have this_2 : B.length ≤ T.length := hBprefix.1; + have this_3 : X.length ≤ T.length := hXprefix.1; + have this_4 : A.length ≤ B.length := hAB.1; + have this_5 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_6 : (1 : ℕ) ≤ T.length := T.positive; + have this_7 : (1 : ℕ) ≤ (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length := (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length) ↦ + by omega + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length)) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors + G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : A.length ≤ T.length := hA.1; + have this_2 : B.length ≤ T.length := hBprefix.1; + have this_3 : X.length ≤ T.length := hXprefix.1; + have this_4 : A.length ≤ B.length := hAB.1; + have this_5 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_6 : (1 : ℕ) ≤ T.length := T.positive; + have this_7 : (1 : ℕ) ≤ (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length := (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length) ↦ + by omega + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length)) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset + (Fin k))) ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k)))), + let r0 : Fin T.length := (⟨T.length - (2 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; + by omega + ⟩ : Fin T.length); + ∀ (hr0val : (↑r0 : ℕ) = T.length - (2 : ℕ)) (beta : Fin k) (hbM0 : beta ∉ M0) (hbGamma : beta + ∉ Gamma), + let hia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let hib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hvB : T.vertex hib ∈ TreeSequenceVertexSet B) (hterminalPath : Disjoint (TwoColorComponent + G phi alpha beta (Sum.inl (T.vertex (Fin.last T.length)))) (TwoColorComponent G phi alpha + beta (Sum.inl (T.vertex hia))) ∧ TwoColorPathComponent G phi alpha beta (Sum.inl (T.vertex + (Fin.last T.length))) ∧ + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G phi x), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (hbetaTerminal : beta ∈ MissingColors G sigma (T.vertex (Fin.last T.length))) (hbetaX : beta + ∈ TreeMissingColors sigma X) (hcut : A.length + (ell - (2 : ℕ)) = T.length - (2 : ℕ)) + (hstable : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma), + MaximumProperty ettA) ∧ ( + ∀ (hq : (0 : ℕ) < H.dividerCount), + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), MaximumProperty ettA ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = base.core ∧ baseA.closure + = base.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq (Dnq.biUnion (C.good.gamma (⟨C.hierarchy.dividerCount + - (1 : ℕ), + by omega + ⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) ∧ + ∃ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), MaximumProperty + corrT.replacementETT ∧ + ∃ (baseT : HierarchyBase corrT.replacementETT sigma) (K : TashkinovHierarchy + corrT.replacementETT baseT) (goodT : GoodHierarchy K), SameGoodHierarchy C.good goodT), + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∃ beta ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), beta ∈ TreeMissingColors + P.coloring (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) ∧ + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc; beta ∉ (HierarchyStoredColorsAt H + q).biUnion (P.counterexample.good.gamma q) ∪ (TreeSequenceVertexSet P.replacementBase.core + \ TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v + +private abbrev helperContinuation2387Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (alpha : Fin k) + (hterminal : alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (C.good.gamma q); + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; + ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hA : TreeSequenceInitialSegment A T) (hell : ell = + T.length - A.length) (hBprefix : TreeSequenceInitialSegment B T) (hXprefix : + TreeSequenceInitialSegment X T) (hlenB : B.length = T.length - (1 : ℕ)) (hlenX : X.length + = T.length - (2 : ℕ)) (hAB : TreeSequenceInitialSegment A B) (hElem : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B)) (hcoreB : + TreeSequenceVertexSet base.core ⊆ TreeSequenceVertexSet B) (hAlphaAvoid : + ∀ (r : Fin T.length), A.length ≤ (↑r : ℕ) → phi (T.edge r) ≠ some alpha) (hNine : (2 : ℕ) * + ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun (i : ℕ) ↦ + TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length) ( + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := hA.1 + have := hBprefix.1 + have := hXprefix.1 + have := hAB.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length)) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors + G phi v) \ (fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ + (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := hA.1 + have := hBprefix.1 + have := hXprefix.1 + have := hAB.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length)) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors + G phi v) \ (fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H + (Fin.last H.dividerCount)).length + i) T.length) ( + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := hA.1 + have := hBprefix.1 + have := hXprefix.1 + have := hAB.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length)) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ + ({eta h} : Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) + = some c} : Finset (Fin k))) (ell - (2 : ℕ))))), + let U : Finset (Fin k) := ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi + (T.edge r) = some c} : Finset (Fin k)); + ∀ (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix + T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length) ( + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := hA.1 + have := hBprefix.1 + have := hXprefix.1 + have := hAB.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + all_goals omega) + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length)) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors + G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi + (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + - (2 : ℕ))) T.length) ( + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := hA.1 + have := hBprefix.1 + have := hXprefix.1 + have := hAB.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + all_goals omega) + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length)) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors + G phi v) \ ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ + HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ + TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := hA.1 + have := hBprefix.1 + have := hXprefix.1 + have := hAB.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + all_goals omega) + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length)) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset + (Fin k))) ({c : Fin k | + ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) + ∧ phi (T.edge r) = some c} : Finset (Fin k)))), + let r0 : Fin T.length := (⟨T.length - (2 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r1 : Fin T.length := (⟨T.length - (1 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let N : Finset (Fin k) := (phi (T.edge r0)).toList.toFinset ∪ (phi (T.edge + r1)).toList.toFinset; + ∀ (hr0val : (↑r0 : ℕ) = T.length - (2 : ℕ)) (hSuffixN : + ∀ (c : Fin k) (r : Fin T.length), X.length ≤ (↑r : ℕ) → phi (T.edge r) = some c → c ∈ N) (beta + : Fin k) (hbX : beta ∈ TreeMissingColors phi X) (hbM0 : beta ∉ M0) (hbGamma : beta ∉ + Gamma) (hbU : beta ∉ U) (hbN : beta ∉ N) (hXB : TreeSequenceInitialSegment X B) (haB : + alpha ∈ TreeMissingColors phi B) (hbB : beta ∈ TreeMissingColors phi B) (ubIdx : Fin + (X.length + (1 : ℕ))) (firstMem : + ∀ (c : Fin k) (hlt : (↑(HierarchyFirstMissingPosition phi T c) : ℕ) < T.length), c ∈ + MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c))) (hiaLe : + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ A.length) (hibLt : + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) < T.length) (hbetaFirst : beta ∈ + MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta))), + let hia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let hib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hne : alpha ≠ beta) (hStageMiss : alpha ∈ HierarchyStageMissingColors H q) (hSame : + TwoColorComponent G phi alpha beta (Sum.inl (T.vertex hia)) = TwoColorComponent G phi + alpha beta (Sum.inl (T.vertex hib))), + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∃ beta ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), beta ∈ TreeMissingColors + P.coloring (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) ∧ + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc; beta ∉ (HierarchyStoredColorsAt H + q).biUnion (P.counterexample.good.gamma q) ∪ (TreeSequenceVertexSet P.replacementBase.core + \ TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v + +private abbrev helperContinuation212Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + ∀ alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)), alpha ∈ TreeMissingColors phi + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) → + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), alpha ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let _ : Finset (Fin k) := D.biUnion (C.good.gamma q); + let _ : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion + fun (v : V) ↦ MissingColors G phi v; (3 : ℕ) ≤ T.length - A.length → + TreeSequenceInitialSegment A T → ell = T.length - A.length → TreeSequenceInitialSegment B + T → TreeSequenceInitialSegment X T → B.length = T.length - (1 : ℕ) → X.length = T.length - + (2 : ℕ) → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U W + → S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment A B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → TreeSequenceVertexSet + base.core ⊆ TreeSequenceVertexSet A → TreeSequenceVertexSet base.core ⊆ + TreeSequenceVertexSet B → ( + ∀ (r : Fin T.length), A.length ≤ (↑r : ℕ) → phi (T.edge r) ≠ some alpha) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∃ beta ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), beta ∈ TreeMissingColors + P.coloring (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) ∧ + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc; beta ∉ (HierarchyStoredColorsAt H + q).biUnion (P.counterexample.good.gamma q) ∪ (TreeSequenceVertexSet P.replacementBase.core + \ TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v + +private theorem helper_firstLe_242.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ G k e0 T phi c i hi + let _ := Fintype.ofFinite V + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex j) + have hm : i ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ + have hn : candidates.Nonempty := ⟨i, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + have hle := Finset.min'_le candidates i hm + change (candidates.min' hn).val ≤ i.val at hle + exact hle + +private theorem helper_hiaLt_371.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha : + Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; (3 : ℕ) ≤ T.length - A.length → + let hia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; (↑hia : ℕ) ≤ + A.length → (↑hia : ℕ) < T.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha H q A htailA hia hiaBound + have hAshort : A.length < T.length := by + have h := htailA + clear * - h + omega + exact Nat.lt_of_le_of_lt hiaBound hAshort + +private theorem helper_hvB_389.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment B T → B.length = T.length - (1 : ℕ) → + ∀ (beta : Fin k), (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) < T.length → + let hib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; T.vertex hib ∈ + TreeSequenceVertexSet B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ell B hBprefix hlenB beta hibLt hib + have hibBound : hib.val < B.length + 1 := by + have h := hlenB + clear * - h hibLt + omega + let iB : Fin (B.length + 1) := ⟨hib.val, hibBound⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hBprefix.1) iB = hib := Fin.ext rfl + have hvEq : T.vertex hib = B.vertex iB := by + rw [← hcast] + exact hBprefix.2.1 iB + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨iB, hvEq.symm⟩ + +private theorem helper_hcut_466.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; (3 : ℕ) ≤ T.length - A.length → + TreeSequenceInitialSegment A T → ell = T.length - A.length → A.length + (ell - (2 : ℕ)) = + T.length - (2 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell htailA hA hell + rw [hell] + have ha : A.length ≤ T.length := hA.1 + have ht : 3 ≤ T.length - A.length := htailA + clear * - ha ht + omega + +private theorem helper_vertexMemB_487.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment B T → B.length = T.length - (1 : ℕ) → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) < T.length → T.vertex i ∈ TreeSequenceVertexSet B + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ell B hBprefix hlenB i hi + have hbnd : i.val < B.length + 1 := by + have h := hlenB + clear * - h hi + omega + let j : Fin (B.length + 1) := ⟨i.val, hbnd⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hBprefix.1) j = i := Fin.ext rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨j, ?_⟩ + have hvEq : T.vertex i = B.vertex j := by + rw [← hcast] + exact hBprefix.2.1 j + exact hvEq.symm + +private theorem helper_firstLeFor_501.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (psi : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G psi (T.vertex i) → + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ G k e0 T psi c i hi + let _ := Fintype.ofFinite V + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + have hm : i ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ + have hn : candidates.Nonempty := ⟨i, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + have hle := Finset.min'_le candidates i hm + change (candidates.min' hn).val ≤ i.val at hle + exact hle + +private theorem helper_seriesFacts_583.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G + (ett.series.data.coloring j) ∧ IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + classical + intro V E _ _ _ G k e0 input T phi ett j + have certificate := ett.series.certified j + cases certificate with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact ⟨currentProper, currentOneUncolored⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact ⟨previousProper, previousOneUncolored⟩ + +private theorem helper_branch_724.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (alpha : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (C.good.gamma q); + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; TreeSequenceVertexSet base.core ⊆ + TreeSequenceVertexSet B → + ∀ beta ∉ M0, beta ∉ Gamma → + let hia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let hib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; T.vertex hib ∈ + TreeSequenceVertexSet B → (Disjoint (TwoColorComponent G phi alpha beta (Sum.inl (T.vertex + (Fin.last T.length)))) (TwoColorComponent G phi alpha beta (Sum.inl (T.vertex hia))) ∧ + TwoColorPathComponent G phi alpha beta (Sum.inl (T.vertex (Fin.last T.length))) ∧ + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G phi x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P.coloring = sigma + → P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc = Tn → base.core = P.replacementBase.core + → + let qNew : Fin (P.counterexample.hierarchy.dividerCount + (1 : ℕ)) := Fin.last + P.counterexample.hierarchy.dividerCount; HierarchyStoredColorsAt + P.counterexample.hierarchy qNew = D → ( + ∀ rho ∈ D, C.good.gamma q rho = P.counterexample.good.gamma qNew rho) → + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc; beta ∉ (HierarchyStoredColorsAt H + q).biUnion (P.counterexample.good.gamma q) ∪ (TreeSequenceVertexSet P.replacementBase.core + \ TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha H q ell B Tn D Gamma M0 hcoreB beta + hbM0 hbGamma hia hib hvB hterminalPath sigma P hP hterminalTree hcoreEq qNew hD hGammaEq + change beta ∉ + (HierarchyStoredColorsAt P.counterexample.hierarchy qNew).biUnion + (P.counterexample.good.gamma qNew) ∪ + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet + (P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc)).biUnion + fun v => MissingColors G P.coloring v) + intro hbad + rcases Finset.mem_union.mp hbad with hGammaNew | hMnew + · obtain ⟨rho, hrho, hbetaGammaNew⟩ := Finset.mem_biUnion.mp hGammaNew + have hrhoOld : rho ∈ D := by rw [← hD]; exact hrho + have hbetaGammaOld : beta ∈ C.good.gamma q rho := by + rw [hGammaEq rho hrhoOld] + exact hbetaGammaNew + exact hbGamma (Finset.mem_biUnion.mpr ⟨rho, hrhoOld, hbetaGammaOld⟩) + · obtain ⟨v, hv, hbetaV⟩ := Finset.mem_biUnion.mp hMnew + obtain ⟨hvCoreNew, hvNotTnew⟩ := Finset.mem_sdiff.mp hv + have hvCoreOld : v ∈ TreeSequenceVertexSet base.core := by + rw [hcoreEq] + exact hvCoreNew + have hvNotTn : v ∉ TreeSequenceVertexSet Tn := by + intro hvTn + apply hvNotTnew + rw [hterminalTree] + exact hvTn + have hvB : v ∈ TreeSequenceVertexSet B := hcoreB hvCoreOld + have hbetaPhi : beta ∈ MissingColors G phi v := by + rw [hP] at hbetaV + rw [hterminalPath.2.2 v hvB] at hbetaV + exact hbetaV + have hbetaM0 : beta ∈ M0 := + Finset.mem_biUnion.mpr + ⟨v, Finset.mem_sdiff.mpr ⟨hvCoreOld, hvNotTn⟩, hbetaPhi⟩ + exact hbM0 hbetaM0 + +private theorem helper_hNcard_363.{u_1, u_2} : + helperHNcard363Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell htailA hell hNine hNineAt hNi r0 r1 N + dsimp [N] + calc + _ ≤ (phi (T.edge r0)).toList.length + (phi (T.edge r1)).toList.length := + (Finset.card_union_le _ _).trans (Nat.add_le_add + (List.toFinset_card_le _) (List.toFinset_card_le _)) + _ ≤ 2 := by + cases phi (T.edge r0) <;> cases phi (T.edge r1) <;> simp + +private theorem helper_hSuffixN_373.{u_1, u_2} : + helperHSuffixN373Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell X htailA hell hlenX hNine hNineAt hNi + r0 r1 N hr0val hr1val c r hr hc + have hindex : r.val = r0.val ∨ r.val = r1.val := by + have := hlenX + omega + rcases hindex with hindex | hindex + · have hr0 : r = r0 := Fin.ext hindex + subst r + simp [N, hc] + · have hr1 : r = r1 := Fin.ext hindex + subst r + simp [N, hc] + +private theorem helper_hbetaExists_392.{u_1, u_2} : + helperHbetaExists392Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell X Tn D Gamma M0 htailA hell hcoreA + hNine U Avail hNineAt hNi hGammaD r0 r1 N hNcard Free hNineSmall + by_cases hlarge : 5 ≤ Free.card + · have hremain : (Free \ N).Nonempty := by + apply Finset.card_pos.mp + have hc := Finset.card_le_card_sdiff_add_card (s := Free) (t := N) + omega + obtain ⟨beta, hb⟩ := hremain + have hbfree := (Finset.mem_sdiff.mp hb).1 + have hbN := (Finset.mem_sdiff.mp hb).2 + obtain ⟨hbAvail, hbGD⟩ := Finset.mem_sdiff.mp hbfree + obtain ⟨hbMissExtra, hbU⟩ := Finset.mem_sdiff.mp hbAvail + obtain ⟨hbMiss, hbExtra⟩ := Finset.mem_sdiff.mp hbMissExtra + refine ⟨beta, hbMiss, hbExtra, ?_, hbU, hbN⟩ + · intro hb + exact hbGD (Finset.mem_union_left _ hb) + · obtain ⟨rho, hinj, hrho⟩ := hNineSmall (by change Free.card ≤ 4; omega) + let block := fun i : Fin 7 => C.good.gamma q (rho i) ∪ {rho i} + have hblocks : ∀ i j : Fin 7, i ≠ j → Disjoint (block i) (block j) := by + intro i j hij + have hneq : rho i ≠ rho j := fun heq => hij (hinj heq) + rw [Finset.disjoint_left] + intro c hci hcj + simp only [block, Finset.mem_union, Finset.mem_singleton] at hci hcj + rcases hci with hci | hci <;> rcases hcj with hcj | hcj + · exact Finset.disjoint_left.mp (C.good.disjointPairs q (rho i) (rho j) + (hrho i).1 (hrho j).1 hneq) hci hcj + · exact Finset.disjoint_left.mp hGammaD + (Finset.mem_biUnion.mpr ⟨rho i, (hrho i).1, hci⟩) (hcj.symm ▸ (hrho j).1) + · exact Finset.disjoint_left.mp hGammaD + (Finset.mem_biUnion.mpr ⟨rho j, (hrho j).1, hcj⟩) (hci.symm ▸ (hrho i).1) + · exact hneq (hci.symm.trans hcj) + have hsomeBlock : ∃ i : Fin 7, Disjoint (block i) N := by + by_contra hnone + push Not at hnone + let f : Fin 7 → {c // c ∈ N} := fun i => + ⟨Classical.choose (Finset.not_disjoint_iff.mp (hnone i)), + (Classical.choose_spec (Finset.not_disjoint_iff.mp (hnone i))).2⟩ + have hf : Function.Injective f := by + intro i j hij + by_contra hne + have hfi := Classical.choose_spec (Finset.not_disjoint_iff.mp (hnone i)) + have hfj := Classical.choose_spec (Finset.not_disjoint_iff.mp (hnone j)) + have heq : Classical.choose (Finset.not_disjoint_iff.mp (hnone i)) = + Classical.choose (Finset.not_disjoint_iff.mp (hnone j)) := + congrArg Subtype.val hij + exact (Finset.disjoint_left.mp (hblocks i j hne) hfi.1 (heq ▸ hfj.1)) + have hc := Fintype.card_le_of_injective f hf + have hcard : Fintype.card {c // c ∈ N} = N.card := Fintype.card_coe N + rw [hcard] at hc + have : 7 ≤ 2 := by simpa using hc.trans hNcard + omega + obtain ⟨i, hiBlock⟩ := hsomeBlock + let beta := rho i + have hbTailMissing : beta ∈ TreeMissingColors phi X := (hrho i).2.1 + have hbD : beta ∈ D := (hrho i).1 + have hbGamma : beta ∉ Gamma := by + intro hb + exact (Finset.disjoint_left.mp hGammaD hb hbD) + have hbM0 : beta ∉ M0 := by + intro hb + obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hb + have hvA : v ∈ TreeSequenceVertexSet A := + hcoreA (Finset.mem_sdiff.mp hv).1 + have hbA : beta ∈ TreeMissingColors phi A := Finset.mem_biUnion.mpr ⟨v, hvA, hmiss⟩ + exact (Finset.mem_sdiff.mp hbD).2 hbA + have hbU : beta ∉ U := by + intro hbU + simp only [U, Finset.mem_filter, Finset.mem_univ, true_and] at hbU + obtain ⟨r, hr, hlt, hcol⟩ := hbU + have hblock := (hrho i).2.2 + exact (Finset.disjoint_left.mp hblock + (Finset.mem_union_right _ (Finset.mem_singleton.mpr rfl)) + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, r, hr, hlt, hcol⟩)) + have hbN : beta ∉ N := by + intro hb + exact (Finset.disjoint_left.mp hiBlock + (Finset.mem_union_right _ (Finset.mem_singleton.mpr rfl)) hb) + refine ⟨beta, hbTailMissing, hbM0, hbGamma, hbU, hbN⟩ + +private theorem helper_firstMem_500.{u_1, u_2} : + helperFirstMem500Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell htailA hell hNine hNineAt hNi c hlt + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hh : (HierarchyFirstMissingPosition phi T c).val = T.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + +private theorem helper_hibLt_530.{u_1, u_2} : + helperHibLt530Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha H q A ell X htailA hell hXprefix hlenX + hNine hNineAt hNi r0 hr0val beta ubIdx hibLe + have hidxVal : + (Fin.castLE (Nat.succ_le_succ hXprefix.1) ubIdx).val = ubIdx.val := rfl + have huval : ubIdx.val < T.length := by omega + have hcastLt : + (Fin.castLE (Nat.succ_le_succ hXprefix.1) ubIdx).val < T.length := by + rw [hidxVal] + exact huval + exact hibLe.trans_lt hcastLt + +private theorem helper_hcase_665.{u_1, u_2} : + helperHcase665Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha H q A ell X Tn htailA hell hXprefix hNine + hNineAt hNi beta ubIdx hStageMiss + by_cases hd : 0 < H.dividerCount + · left + refine ⟨hd, ?_⟩ + let r : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hq : q = r.succ := by + apply Fin.ext + simp [q, r] + omega + have hm := hStageMiss + unfold HierarchyStageMissingColors at hm + rw [hq] at hm + change alpha ∈ TreeMissingColors phi (H.stage r.succ.castSucc) at hm + have hidx : r.succ.castSucc = ⟨H.dividerCount, by omega⟩ := by + apply Fin.ext + simp [r] + omega + simpa only [hidx] using hm + · have hz : H.dividerCount = 0 := by omega + right + refine ⟨hz, Or.inl ?_⟩ + have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hm := hStageMiss + unfold HierarchyStageMissingColors at hm + rw [hq] at hm + simpa [Tn] using hm + +private theorem helper_continuation_2632.{u_1, u_2} : + helperContinuation2632Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha H q A ell X B Tn D Gamma M0 htailA hA + hell hBprefix hXprefix hlenX hAB hcoreB hNine hNineAt hNi r0 hr0val beta hbM0 hbGamma hia + hib hvB hterminalPath sigma hbetaTerminal hbetaX hcut hstable + rcases hstable with ⟨_, _, _, _, hCorr⟩ + obtain ⟨corr, hmax, baseT, K, goodT, sameGood⟩ := hCorr + have seriesFacts := @helper_seriesFacts_583 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := fun j => (seriesFacts j).1 + replacementOneUncolored := fun j => (seriesFacts j).2 + replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } + let PRefl : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { coloring := phi + corresponding := corrRefl + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + minimumContext := ctx } + have hVpair : ∃ v ∈ TreeSequenceVertexSet T, + beta ∈ MissingColors G sigma v ∧ v ≠ T.vertex (Fin.last T.length) := by + obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hbetaX + obtain ⟨i, hi⟩ : ∃ i : Fin (X.length + 1), X.vertex i = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hv + let j : Fin (T.length + 1) := Fin.castLE (Nat.succ_le_succ hXprefix.1) i + have hvT : v = T.vertex j := by + rw [← hi] + exact hXprefix.2.1 i + have hjval : j.val = i.val := rfl + have hiLE : i.val ≤ X.length := by + have hiLt := i.isLt + omega + have hilen : i.val ≤ T.length - 2 := hiLE.trans_eq hlenX + have hjlt : j.val < T.length := by + rw [hjval] + have hlen : T.length - 2 < T.length := by omega + exact Nat.lt_of_le_of_lt hilen hlen + refine ⟨v, ?_, hmiss, ?_⟩ + · rw [hvT] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + · intro heq + have hidx := T.vertex_injective (hvT.symm.trans heq) + have hval := congrArg Fin.val hidx + simp only [Fin.val_last] at hval + omega + let Cnew : HierarchyCounterexample baseT := + { positive := by rw [corr.rungAgreement]; exact C.positive + hierarchy := K + good := goodT + maximum := hmax + notElementary := by + intro he + obtain ⟨v, hv, hmissV, hneV⟩ := hVpair + have hterm : T.vertex (Fin.last T.length) ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last T.length, rfl⟩ + have hdisj := Finset.disjoint_left.mp (he hv hterm hneV) + exact hdisj hmissV hbetaTerminal } + obtain ⟨P, hP⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx PRefl sigma corr baseT Cnew sameGood + have terminalTreeOf (rho : PartialEdgeColoring E k) + (c : CorrespondingExtendedTashkinovTree G k e0 ett rho T) : + c.replacementETT.series.data.tree + (Fin.last c.replacementETT.rounds).castSucc = Tn := by + rcases c with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive series above strict below generating => + cases rungAgreement + have hseries : series = replacementSeries := eq_of_heq seriesPresentation + cases hseries + let i : Fin ett.rounds := + ⟨ett.rounds - 1, by have hp := ett.roundsPositive; omega⟩ + have hi : i.succ = Fin.last ett.rounds := by + apply Fin.ext + change ett.rounds - 1 + 1 = ett.rounds + exact Nat.sub_add_cancel ett.roundsPositive + simpa [Tn, hi] using ladderTreesAgree i + have hterminalTree := terminalTreeOf P.coloring P.corresponding + have hcoreEq : base.core = P.replacementBase.core := P.sameGood.1.1 + have hcount : H.dividerCount = P.counterexample.hierarchy.dividerCount := + P.sameGood.2.choose + let qNew : Fin (P.counterexample.hierarchy.dividerCount + 1) := + Fin.last P.counterexample.hierarchy.dividerCount + have hqCast : Fin.cast (congrArg (fun n => n + 1) hcount) q = qNew := by + apply Fin.ext + simp [qNew, q] + have hsg := P.sameGood.2.choose_spec q + have hD : HierarchyStoredColorsAt P.counterexample.hierarchy qNew = D := by + have h := hsg.1 + rw [hqCast] at h + exact h.symm + have hGammaEq (rho : Fin k) (hrho : rho ∈ D) : + C.good.gamma q rho = P.counterexample.good.gamma qNew rho := by + have h := hsg.2 rho hrho + rw [hqCast] at h + exact h + refine ⟨P, beta, ?_, ?_, ?_⟩ + · rw [hP] + exact hbetaTerminal + · rw [hP] + exact hbetaX + · exact @helper_branch_724 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@alpha) (@hcoreB) (@beta) + (@hbM0) (@hbGamma) (@hvB) (@hterminalPath) (@P) (@hP) (@hterminalTree) (@hcoreEq) (@hD) + (@hGammaEq) + +private theorem helper_continuation_2387.{u_1, u_2} : + helperContinuation2387Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha hterminal H q A ell X B Tn D Gamma M0 + htailA hA hell hBprefix hXprefix hlenB hlenX hAB hElem hcoreB hAlphaAvoid hNine U hNineAt + hNi r0 r1 N hr0val hSuffixN beta hbX hbM0 hbGamma hbU hbN hXB haB hbB ubIdx firstMem hiaLe + hibLt hbetaFirst hia hib hne hStageMiss hSame + have hiaBound : hia.val ≤ A.length := by simpa [hia] using hiaLe + have hiaLt := @helper_hiaLt_371 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@htailA) (@hiaBound) + have hAlphaFirst := firstMem alpha hiaLt + have huB : T.vertex hia ∈ TreeSequenceVertexSet B := by + let iA : Fin (A.length + 1) := ⟨hia.val, by omega⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hA.1) iA = hia := Fin.ext rfl + have hvA : A.vertex iA ∈ TreeSequenceVertexSet A := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨iA, rfl⟩ + have hvEq : T.vertex hia = A.vertex iA := by + rw [← hcast] + exact hA.2.1 iA + rw [hvEq] + exact TreeSequenceInitialSegmentVertexSetSubset hAB hvA + have hvB := @helper_hvB_389 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBprefix) (@hlenB) (@beta) (@hibLt) + have hwu : T.vertex (Fin.last T.length) ≠ T.vertex hia := by + intro heq + have hidx := T.vertex_injective heq + have hval := congrArg Fin.val hidx + simp only [Fin.val_last] at hval + omega + have hwv : T.vertex (Fin.last T.length) ≠ T.vertex hib := by + intro heq + have hidx := T.vertex_injective heq + have hval := congrArg Fin.val hidx + simp only [Fin.val_last] at hval + omega + have hterminalPath := + P2905_T2_ElementaryTerminalComponent G phi alpha beta hne ctx.proper + (TreeSequenceVertexSet B) hElem + (T.vertex hia) (T.vertex hib) (T.vertex (Fin.last T.length)) + huB hvB hwu hwv hAlphaFirst hbetaFirst (Or.inl hterminal) hSame + let sigma := TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) + have hsigma : sigma = TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) := rfl + have hswapMissing := TwoColorComponentSwapMissingBehavior + G phi alpha beta hne ctx.proper (Sum.inl (T.vertex (Fin.last T.length))) + have hbetaTerminal : beta ∈ MissingColors G sigma (T.vertex (Fin.last T.length)) := by + exact hswapMissing.2.1 _ rfl hterminal + have hbetaX : beta ∈ TreeMissingColors sigma X := by + obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hbX + have hvB' : v ∈ TreeSequenceVertexSet B := TreeSequenceInitialSegmentVertexSetSubset hXB hv + have heq := hterminalPath.2.2 v hvB' + exact Finset.mem_biUnion.mpr ⟨v, hv, heq ▸ hmiss⟩ + have hmissingPrefix : + alpha ∈ TreeMissingColors phi B ∧ beta ∈ TreeMissingColors phi B := ⟨haB, hbB⟩ + have hcase := @helper_hcase_665 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@htailA) (@hell) + (@hXprefix) (@hNine) (@hNineAt) (@hNi) (@beta) (@ubIdx) (@hStageMiss) + have hcut := @helper_hcut_466 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htailA) (@hA) (@hell) + have htailEdges : ∀ r : Fin T.length, A.length ≤ r.val → + sigma (T.edge r) = phi (T.edge r) := by + intro r hr + have hnotAlpha := hAlphaAvoid r hr + have hnotBeta : phi (T.edge r) ≠ some beta := by + intro hc + by_cases hbefore : r.val < X.length + · apply hbU + simp only [U, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨r, hr, ?_, hc⟩ + rw [hlenX] at hbefore + omega + · apply hbN + exact hSuffixN beta r (by omega) hc + simp [sigma, TwoColorComponentSwap, hnotAlpha, hnotBeta] + have vertexMemB := @helper_vertexMemB_487 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBprefix) (@hlenB) + have firstLeFor := @helper_firstLeFor_501 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) + (@T) + have firstMemFor (psi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + have missingAtB (i : Fin (T.length + 1)) (hi : i.val < T.length) : + MissingColors G sigma (T.vertex i) = MissingColors G phi (T.vertex i) := + hterminalPath.2.2 (T.vertex i) (vertexMemB i hi) + have firstPosEq (c : Fin k) : + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition phi T c := by + let ps := HierarchyFirstMissingPosition sigma T c + let po := HierarchyFirstMissingPosition phi T c + by_cases hEarly : po.val < T.length + · have hmissOld := firstMemFor phi c hEarly + have hmissNew : c ∈ MissingColors G sigma (T.vertex po) := by + rw [missingAtB po hEarly] + exact hmissOld + have hleNew := firstLeFor sigma c po hmissNew + by_cases hNewEarly : ps.val < T.length + · have hmissNewFirst := firstMemFor sigma c hNewEarly + have hmissOldFirst : c ∈ MissingColors G phi (T.vertex ps) := by + rw [← missingAtB ps hNewEarly] + exact hmissNewFirst + have hleOld := firstLeFor phi c ps hmissOldFirst + apply Fin.ext + omega + · have hNewLast : ps.val = T.length := by + have hlt := ps.isLt + omega + have hltOld : po.val < T.length := hEarly + have hleNew' : ps.val ≤ po.val := hleNew + omega + · have hOldLast : po.val = T.length := by + have hlt := po.isLt + omega + by_cases hNewEarly : ps.val < T.length + · have hmissNewFirst := firstMemFor sigma c hNewEarly + have hmissOldFirst : c ∈ MissingColors G phi (T.vertex ps) := by + rw [← missingAtB ps hNewEarly] + exact hmissNewFirst + have hleOld := firstLeFor phi c ps hmissOldFirst + omega + · have hNewLast : ps.val = T.length := by + have hlt := ps.isLt + omega + apply Fin.ext + omega + have hstoredFirst : + ∀ rho, rho ∈ D → + HierarchyFirstMissingPosition sigma T rho = + HierarchyFirstMissingPosition phi T rho := by + intro rho _ + exact firstPosEq rho + have hstable := StableChangeCasesOneTwoFullTail G k e0 input T phi ett + base C ctx alpha beta hne hmissingPrefix + (Sum.inl (T.vertex (Fin.last T.length))) hterminalPath.2.1 sigma rfl hcase + hterminalPath.1 htailEdges hterminalPath.2.2 hstoredFirst + exact @helper_continuation_2632 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@alpha) + (@htailA) (@hA) (@hell) (@hBprefix) (@hXprefix) (@hlenX) (@hAB) (@hcoreB) (@hNine) + (@hNineAt) (@hNi) (@hr0val) (@beta) (@hbM0) (@hbGamma) (@hvB) (@hterminalPath) + (@hbetaTerminal) (@hbetaX) (@hcut) (@hstable) +private theorem helper_continuation_212.{u_1, u_2} : + helperContinuation212Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha hterminal hstar eta heta hgamma H q A + ell X B Tn D Gamma M0 htailA hA hell hBprefix hXprefix hlenB hlenX commonPrefix hAB hElem + hcoreA hcoreB hAlphaAvoid + have hNineIndex : ell - 2 < ell := by omega + have hNine := NineN G k e0 input T phi ett C.positive base H C.good hElem + ctx.largeMissingSet (ell - 2) hNineIndex + let U := (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < A.length + (ell - 2) ∧ phi (T.edge r) = some c + let Avail := (TreeMissingColors phi X \ M0) \ U + have hNineAt := hNine + dsimp [Tn, q, A, ell, HierarchyFullTailLength] at hNineAt + have hNi := hNineAt + have hNiCard : 2 * ett.rounds + 11 ≤ Avail.card := by + exact hNi.1 + have hGoodAvoid := GoodHierarchyReservedDisjoint C.good q + have hGammaD : Disjoint Gamma D := by + simpa [Gamma, D] using hGoodAvoid.2 + have hEtaNotA : eta ∉ TreeMissingColors phi A := by + intro hm + have hD := (Finset.mem_sdiff.mp heta).2 + exact hD hm + have hAlphaNotD : alpha ∉ D := by + intro ha + have hAlphaGamma : alpha ∈ Gamma := Finset.mem_biUnion.mpr ⟨eta, heta, hgamma⟩ + exact Finset.disjoint_left.mp hGammaD hAlphaGamma ha + let r0 : Fin T.length := ⟨T.length - 2, by have := htailA; omega⟩ + let r1 : Fin T.length := ⟨T.length - 1, by have := htailA; omega⟩ + let N := (phi (T.edge r0)).toList.toFinset ∪ (phi (T.edge r1)).toList.toFinset + have hNcard := @helper_hNcard_363 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htailA) (@hell) + (@hNine) (@hNineAt) (@hNi) + have hr0val : r0.val = T.length - 2 := by simp [r0] + have hr1val : r1.val = T.length - 1 := by simp [r1] + have hSuffixN := @helper_hSuffixN_373 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htailA) (@hell) + (@hlenX) (@hNine) (@hNineAt) (@hNi) (@hr0val) (@hr1val) + let Free := Avail \ (Gamma ∪ D) + have hNineSmall := hNi.2 + change (Avail \ (Gamma ∪ D)).card ≤ 4 → + ∃ rho : Fin 7 → Fin k, Function.Injective rho ∧ + ∀ i, rho i ∈ D ∧ rho i ∈ TreeMissingColors phi X ∧ + Disjoint (C.good.gamma q (rho i) ∪ {rho i}) U at hNineSmall + have hbetaExists := @helper_hbetaExists_392 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htailA) (@hell) + (@hcoreA) (@hNine) (@hNineAt) (@hNi) (@hGammaD) (@hNcard) (@hNineSmall) + obtain ⟨beta, hbX, hbM0, hbGamma, hbU, hbN⟩ := hbetaExists + have missingMono (psi : PartialEdgeColoring E k) {S R : TreeSequence G e0} + (hSR : TreeSequenceInitialSegment S R) : + TreeMissingColors psi S ⊆ TreeMissingColors psi R := by + intro c hc + obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hSR hv, hmiss⟩ + have hAX : TreeSequenceInitialSegment A X := commonPrefix hA hXprefix (by + rw [hlenX] + omega) + have hXB : TreeSequenceInitialSegment X B := commonPrefix hXprefix hBprefix (by + rw [hlenX, hlenB] + omega) + have haB : alpha ∈ TreeMissingColors phi B := missingMono phi hAB hstar + have hbB : beta ∈ TreeMissingColors phi B := missingMono phi hXB hbX + obtain ⟨ua, hua, hma⟩ := Finset.mem_biUnion.mp hstar + obtain ⟨uaIdx, huaIdx⟩ : + ∃ i : Fin (A.length + 1), A.vertex i = ua := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hua + obtain ⟨ub, hub, hmb⟩ := Finset.mem_biUnion.mp hbX + obtain ⟨ubIdx, hubIdx⟩ : + ∃ i : Fin (X.length + 1), X.vertex i = ub := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hub + have firstLe := @helper_firstLe_242 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@phi) + have firstMem := @helper_firstMem_500 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htailA) (@hell) + (@hNine) (@hNineAt) (@hNi) + have hiaLe : (HierarchyFirstMissingPosition phi T alpha).val ≤ A.length := by + let iT := Fin.castLE (Nat.succ_le_succ hA.1) uaIdx + have hmiss : alpha ∈ MissingColors G phi (T.vertex iT) := by + rw [hA.2.1 uaIdx, huaIdx] + exact hma + have hle := firstLe alpha iT hmiss + change (HierarchyFirstMissingPosition phi T alpha).val ≤ uaIdx.val at hle + have hi := uaIdx.isLt + omega + have hbetaWitness : beta ∈ MissingColors G phi + (T.vertex (Fin.castLE (Nat.succ_le_succ hXprefix.1) ubIdx)) := by + rw [hXprefix.2.1 ubIdx, hubIdx] + exact hmb + have hibLe : (HierarchyFirstMissingPosition phi T beta).val ≤ + (Fin.castLE (Nat.succ_le_succ hXprefix.1) ubIdx).val := + firstLe beta _ hbetaWitness + have hibLt := @helper_hibLt_530 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@htailA) (@hell) + (@hXprefix) (@hlenX) (@hNine) (@hNineAt) (@hNi) (@hr0val) (@beta) (@ubIdx) (@hibLe) + have hbetaFirst : beta ∈ MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T beta)) := + firstMem beta hibLt + let hia := HierarchyFirstMissingPosition phi T alpha + let hib := HierarchyFirstMissingPosition phi T beta + have hiaVal : hia.val ≤ A.length := by simpa [hia] using hiaLe + have hbetaPosAfterA (hbetaNotA : beta ∉ TreeMissingColors phi A) : + A.length < hib.val := by + by_contra hle + have hiA : hib.val ≤ A.length := by omega + let iA : Fin (A.length + 1) := ⟨hib.val, by omega⟩ + have hidx : Fin.castLE (Nat.succ_le_succ hA.1) iA = hib := Fin.ext rfl + have vertexMem (S : TreeSequence G e0) (i : Fin (S.length + 1)) : + S.vertex i ∈ TreeSequenceVertexSet S := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, rfl⟩ + have hbA : beta ∈ TreeMissingColors phi A := by + refine Finset.mem_biUnion.mpr ⟨A.vertex iA, vertexMem A iA, ?_⟩ + rw [← hA.2.1 iA, hidx] + simpa [hib] using hbetaFirst + exact hbetaNotA hbA + have horderedUnused : + (alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex hia) (T.vertex hib) ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ t.val < hib.val ∧ + phi (T.edge t) = some c) := by + intro hout + by_cases hbA : beta ∈ TreeMissingColors phi A + · rcases hout with hna | hnb + · exact (hna hstar).elim + · exact (hnb hbA).elim + · have hlt : hia.val < hib.val := by + have := hbetaPosAfterA hbA + omega + refine ⟨⟨hia, hib, rfl, rfl, hlt⟩, ?_⟩ + intro ha + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at ha + obtain ⟨t, htA, _, htc⟩ := ha + exact hAlphaAvoid t htA htc + have hne : alpha ≠ beta := by + intro heq + exact hbGamma (heq ▸ Finset.mem_biUnion.mpr ⟨eta, heta, hgamma⟩) + have hchange := ChangeLemma G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality hElem ctx.largeMissingSet alpha beta hne + ⟨haB, hbB⟩ horderedUnused + have hStageMiss : alpha ∈ HierarchyStageMissingColors H q := + (Finset.mem_sdiff.mp (C.good.avoidance q eta heta hgamma)).1 + have hSame : TwoColorComponent G phi alpha beta (Sum.inl (T.vertex hia)) = + TwoColorComponent G phi alpha beta (Sum.inl (T.vertex hib)) := by + by_cases hd : 0 < H.dividerCount + · apply hchange.1 + refine ⟨hd, Or.inl ?_⟩ + let r : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hq : q = r.succ := by + apply Fin.ext + simp [q, r] + omega + have hm := hStageMiss + unfold HierarchyStageMissingColors at hm + rw [hq] at hm + change alpha ∈ TreeMissingColors phi (H.stage r.succ.castSucc) at hm + have hidx : r.succ.castSucc = ⟨H.dividerCount, by omega⟩ := by + apply Fin.ext + simp [r] + omega + rw [hidx] at hm + exact hm + · have hz : H.dividerCount = 0 := by omega + apply hchange.2.1 + refine ⟨hz, Or.inl ?_⟩ + have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hm := hStageMiss + unfold HierarchyStageMissingColors at hm + rw [hq] at hm + exact hm + exact @helper_continuation_2387 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@alpha) + (@hterminal) (@htailA) (@hA) (@hell) (@hBprefix) (@hXprefix) (@hlenB) (@hlenX) (@hAB) + (@hElem) (@hcoreB) (@hAlphaAvoid) (@hNine) (@hNineAt) (@hNi) (@hr0val) (@hSuffixN) (@beta) + (@hbX) (@hbM0) (@hbGamma) (@hbU) (@hbN) (@hXB) (@haB) (@hbB) (@ubIdx) (@firstMem) (@hiaLe) + (@hibLt) (@hbetaFirst) (@hne) (@hStageMiss) (@hSame) +theorem P2905_T2_AbsentOwnerReplacement {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hpathLower : 2 ≤ HierarchyPathNumber C.hierarchy) + (hpathUpper : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (alpha : Fin k) + (hterminal : alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length))) + (hstar : alpha ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount))) + (eta : Fin k) (heta : eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last + C.hierarchy.dividerCount)) + (hgamma : alpha ∈ C.good.gamma (Fin.last C.hierarchy.dividerCount) eta) + (habsent : eta ∉ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1))) : + ∃ P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + ∃ beta : Fin k, + beta ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ + beta ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2)) ∧ + (let H := P.counterexample.hierarchy + let q := Fin.last H.dividerCount + let Tn := P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc + beta ∉ (HierarchyStoredColorsAt H q).biUnion + (P.counterexample.good.gamma q) ∪ + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v)) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength C + let X := HierarchyFullTailPrefix C (ell - 2) + let B := HierarchyFullTailPrefix C (ell - 1) + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (C.good.gamma q) + let M0 := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G phi v + have htail : 3 ≤ ell := by + change 2 ≤ HierarchyPathNumber H at hpathLower + change HierarchyPathNumber H < ell at hpathUpper + omega + have htailA : 3 ≤ T.length - A.length := by + simpa [ell, HierarchyFullTailLength, H] using htail + have hA : TreeSequenceInitialSegment A T := by + have starNext (i : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H i) (H.stage i.succ) := + Fin.cases H.coreInsideFirst (fun i => H.nested i.succ) i + simpa only [Fin.succ_last, H.terminalStage] using + starNext (Fin.last H.dividerCount) + have hell : ell = T.length - A.length := rfl + have hBprefix : TreeSequenceInitialSegment B T := by + exact ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hXprefix : TreeSequenceInitialSegment X T := by + exact ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hlenB : B.length = T.length - 1 := by + change min (A.length + (ell - 1)) T.length = T.length - 1 + simp only [ell, HierarchyFullTailLength] at * + omega + have hlenX : X.length = T.length - 2 := by + change min (A.length + (ell - 2)) T.length = T.length - 2 + simp only [ell, HierarchyFullTailLength] at * + omega + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + have hAB : TreeSequenceInitialSegment A B := by + apply commonPrefix hA hBprefix + rw [hlenB] + omega + have hElem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have hcoreA : TreeSequenceVertexSet base.core ⊆ TreeSequenceVertexSet A := by + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + simp [A, HierarchyStarredStage, hq] + · let r : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hq : q = r.succ := by apply Fin.ext; simp [q, r]; omega + have hAs : A = H.stage r.succ.castSucc := by + change HierarchyStarredStage H q = _ + rw [hq] + rfl + rw [hAs] + have stageMono : Monotone (fun j : Fin (H.dividerCount + 2) => + TreeSequenceVertexSet (H.stage j)) := by + apply Fin.monotone_iff_le_succ.mpr + intro j + exact TreeSequenceInitialSegmentVertexSetSubset (H.nested j) + exact (TreeSequenceInitialSegmentVertexSetSubset H.coreInsideFirst).trans + (stageMono (by change 1 ≤ r.val + 1; omega)) + have hTnCore : TreeSequenceVertexSet Tn ⊆ TreeSequenceVertexSet base.core := by + by_cases hp : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨u⟩⟩ := base.parallel hp + exact TreeSequenceInitialSegmentVertexSetSubset u.leftSegment + · have hc := base.nonparallel hp + change base.core = Tn at hc + rw [hc] + have hcoreB : TreeSequenceVertexSet base.core ⊆ TreeSequenceVertexSet B := by + exact hcoreA.trans (TreeSequenceInitialSegmentVertexSetSubset + (commonPrefix hA hBprefix (by rw [hlenB]; omega))) + have hTnB : TreeSequenceVertexSet Tn ⊆ TreeSequenceVertexSet B := hTnCore.trans hcoreB + have hownerAbsent : eta ∉ TreeMissingColors phi B := by + simpa [B, ell] using habsent + have hfirstEta : HierarchyFirstMissingPosition phi T eta = Fin.last T.length := by + classical + unfold HierarchyFirstMissingPosition + dsimp only + split + · rename_i hc + have candidateLast (i : Fin (T.length + 1)) + (hi : i ∈ Finset.univ.filter + (fun i => eta ∈ MissingColors G phi (T.vertex i))) : + i = Fin.last T.length := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hi + apply Fin.ext + by_cases heq : i.val = T.length + · exact heq + · have hlt : i.val < T.length := by have := i.isLt; omega + have hiBval : i.val < B.length + 1 := by rw [hlenB]; omega + let j : Fin (B.length + 1) := ⟨i.val, hiBval⟩ + have hij : Fin.castLE (Nat.succ_le_succ hBprefix.1) j = i := Fin.ext rfl + have hvB : T.vertex i ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, by rw [← hBprefix.2.1 j, hij]⟩ + have hmB : eta ∈ TreeMissingColors phi B := + Finset.mem_biUnion.mpr ⟨T.vertex i, hvB, hi⟩ + exact False.elim (hownerAbsent hmB) + have hm := Finset.min'_mem + (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G phi (T.vertex i)) hc + rw [candidateLast _ hm] + · rfl + have hAlphaAvoid : ∀ r : Fin T.length, A.length ≤ r.val → + phi (T.edge r) ≠ some alpha := by + intro r hr hcol + have havoid := C.good.avoidance q eta heta + have hseg : alpha ∉ HierarchySegmentColors H q eta := by + exact (Finset.mem_sdiff.mp (havoid hgamma)).2 + have hqstage : H.stage q.succ = T := by + simpa only [q, Fin.succ_last] using H.terminalStage + have hTedge : A.length ≤ r.val ∧ r.val < min (HierarchyFirstMissingPosition phi T eta).val + (H.stage q.succ).length := by + rw [hfirstEta, Fin.val_last, hqstage] + simp only [min_self] + exact ⟨hr, r.isLt⟩ + have : alpha ∈ HierarchySegmentColors H q eta := by + let hlen : (H.stage q.succ).length = T.length := congrArg TreeSequence.length hqstage + let s : Fin (H.stage q.succ).length := Fin.cast hlen.symm r + have hsval : s.val = r.val := rfl + have hstageT : TreeSequenceInitialSegment (H.stage q.succ) T := by + rw [hqstage] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have hcast : Fin.castLE hstageT.1 s = r := by + apply Fin.ext + rfl + have hedge := hstageT.2.2 s + rw [hcast] at hedge + have hcol' : phi ((H.stage q.succ).edge s) = some alpha := by + rw [← hedge] + exact hcol + simp only [HierarchySegmentColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨s, ?_⟩ + rw [hfirstEta, Fin.val_last] + refine ⟨?_, ?_, hcol'⟩ + · simpa [hsval] using hr + · rw [hsval] + have hslt := s.isLt + have hrl := r.isLt + omega + exact hseg this + exact @helper_continuation_212 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@alpha) + (@hterminal) (@hstar) (@eta) (@heta) (@hgamma) (@htailA) (@hA) (@hell) (@hBprefix) + (@hXprefix) (@hlenB) (@hlenX) (@commonPrefix) (@hAB) (@hElem) (@hcoreA) (@hcoreB) + (@hAlphaAvoid) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AbsorbingVertex.lean b/LeanPool/GoldbergSeymour/AbsorbingVertex.lean new file mode 100644 index 0000000000..c8ae295373 --- /dev/null +++ b/LeanPool/GoldbergSeymour/AbsorbingVertex.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple + +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TwoColorComponent + +/-! +# Absorbing Vertex + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- +An outside vertex whose two-color components select unique missing-color witnesses in the tree. -/ +def AbsorbingVertex {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (v : V) : Prop := + v ∉ TreeSequenceVertexSet T ∧ + ∀ delta ∈ MissingColors G phi v, + ∀ gamma ∈ TreeFreeColors phi T, + gamma ≠ delta → + ∃ u : V, + u ∈ TreeSequenceVertexSet T ∧ + gamma ∈ MissingColors G phi u ∧ + Sum.inl u ∈ TwoColorComponent G phi gamma delta (Sum.inl v) ∧ + ∀ w ∈ TreeSequenceVertexSet T, gamma ∈ MissingColors G phi w → w = u + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AbsorbingVertices.lean b/LeanPool/GoldbergSeymour/AbsorbingVertices.lean new file mode 100644 index 0000000000..af1bc015b3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/AbsorbingVertices.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AbsorbingVertex + +/-! +# Absorbing Vertices + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Outside vertices satisfying the absorbing-vertex condition for the given coloring and tree. -/ +noncomputable def AbsorbingVertices {V E : Type*} [Fintype V] [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) : Finset V := by + classical + exact Finset.univ.filter fun v => AbsorbingVertex T phi v + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AdjacentEdges.lean b/LeanPool/GoldbergSeymour/AdjacentEdges.lean new file mode 100644 index 0000000000..2d2c9fb77a --- /dev/null +++ b/LeanPool/GoldbergSeymour/AdjacentEdges.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Incident + +/-! +# Adjacent Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Two edges are adjacent when they have a common incident vertex. -/ +def AdjacentEdges {V E : Type*} (G : LooplessMultigraph V E) (e f : E) : Prop := + ∃ v, Incident G v e ∧ Incident G v f + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AlgorithmFiveFiveBaseStage.lean b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveBaseStage.lean new file mode 100644 index 0000000000..4e1b3bf69a --- /dev/null +++ b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveBaseStage.lean @@ -0,0 +1,321 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveInitialGoodHierarchy +public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveParallelStrictGrowth + +public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedAugmentation + +/-! +# Algorithm Five Five Base Stage + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem AlgorithmFiveFiveBaseStage {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hmod : ModColoring ett phi) + (base : HierarchyBase ett phi) + (hcoreStrict : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + base.core.length) + (hcoreClosure : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + TashkinovClosure phi base.core + (ett.series.data.tree (Fin.last (ett.rounds + 1)))) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (hparallelFacts : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + (∃ alpha : Fin k, + alpha ∈ TreeMissingColors phi base.core ∧ + ¬ TreeColorSetClosed G phi base.core {alpha}) ∧ + TreeColorSetClosed G phi base.core + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure) ∧ + 4 ≤ (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure).card) : + ∃ (J U : TreeSequence G e0) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + (((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ J = base.core) ∨ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ f : E, + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f J)) ∧ + TashkinovAugmentationSequence phi J U ∧ + TreeSequenceInitialSegment J U ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → base.core.length < U.length) ∧ + (ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < U.length) ∧ + MaximumProperty corrU.replacementETT ∧ + ∃ baseU : HierarchyBase corrU.replacementETT phi, + baseU.core = base.core ∧ + baseU.closure = base.closure ∧ + baseU.supportPosition.val = base.supportPosition.val ∧ + ∃ KU : TashkinovHierarchy corrU.replacementETT baseU, + KU.dividerCount = 0 ∧ + KU.stage 0 = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + KU.stage (Fin.last (KU.dividerCount + 1)) = U ∧ + ∃ goodU : GoodHierarchy KU, ( + (∀ eta : Fin k, + eta ∈ HierarchyStoredColorsAt KU + (Fin.last KU.dividerCount) → + (goodU.gamma (Fin.last KU.dividerCount) eta).card = 2 ∧ + goodU.gamma (Fin.last KU.dividerCount) eta ⊆ + TreeMissingColors phi + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) \ + HierarchySegmentColors KU + (Fin.last KU.dividerCount) eta) ∧ + (∀ eta theta : Fin k, + eta ∈ HierarchyStoredColorsAt KU + (Fin.last KU.dividerCount) → + theta ∈ HierarchyStoredColorsAt KU + (Fin.last KU.dividerCount) → eta ≠ theta → + Disjoint + (goodU.gamma (Fin.last KU.dividerCount) eta) + (goodU.gamma (Fin.last KU.dividerCount) theta)) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + ¬ TreeColorSetMinusClosed G phi base.core + ((HierarchyStoredColorsAt KU + (Fin.last KU.dividerCount)).biUnion + (goodU.gamma (Fin.last KU.dividerCount))) ∧ + 4 ≤ ((TreeMissingColors phi + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure) \ + (HierarchyStoredColorsAt KU + (Fin.last KU.dividerCount)).biUnion + (goodU.gamma (Fin.last KU.dividerCount))).card)) ∧ + TreeColorSetMinusClosed G phi U + ((HierarchyTerminalStoredColors KU).biUnion + (goodU.gamma (Fin.last KU.dividerCount)))) := by + classical + obtain ⟨J, corrJ, hMPJ, hJfinal, baseJ, hcoreJ, hclosureJ, hsupportJ, + KJ, hzeroJ, hstageZeroJ, hstageTerminalJ, hseedFull⟩ := + AlgorithmFiveFiveSeed G k e0 input T phi ett hMP base hcoreStrict + hcoreClosure + have hseed : + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ J = base.core) ∨ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ f : E, + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f J)) := by + rcases hseedFull with hparallel | hnonparallel + · exact Or.inl hparallel + · rcases hnonparallel with ⟨hkind, f, hf, hadjoin, hroute⟩ + exact Or.inr ⟨hkind, f, hf, hadjoin⟩ + obtain ⟨goodJ, hmissingJ, hparallelJ⟩ := + AlgorithmFiveFiveInitialGoodHierarchy G k e0 input T phi ett base J corrJ + baseJ KJ hcoreJ hclosureJ hzeroJ hstageZeroJ hseed hlarge + hparallelFacts + obtain ⟨m, chain, U, hfirst, hlast, hsteps, hlengths, hsegments, + hvertices, hsequence, havoid, hmaximal, corrU, hMPU, baseU, hcoreU, + hclosureU, hsupportU, KU, hcount, hstages, hdividers, goodU, hgamma, + hstored, hminus⟩ := + GoodHierarchyRestrictedAugmentation G k e0 input T phi phi ett hmod hMP + J corrJ baseJ KJ goodJ + have hJU : TreeSequenceInitialSegment J U := by + have h := hsegments (0 : Fin (m + 1)) (Fin.last m) (by simp) + rw [hfirst, hlast] at h + exact h + have hUlength : U.length = J.length + m := by + calc + U.length = (chain (Fin.last m)).length := by rw [hlast] + _ = J.length + (Fin.last m).val := hlengths (Fin.last m) + _ = J.length + m := by simp + have hzeroEndpoint : m = 0 → U = J := by + intro hm + subst m + calc + U = chain (Fin.last 0) := hlast.symm + _ = chain 0 := by congr + _ = J := hfirst + have hstrictPE : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.core.length < U.length := by + intro hPE + have hJcore : J = base.core := by + rcases hseed with hparallel | hnonparallel + · exact hparallel.2 + · rcases hnonparallel.1 with hSE | hRE + · rw [hPE] at hSE + simp at hSE + · rw [hPE] at hRE + simp at hRE + have hJcoreJ : J = baseJ.core := hJcore.trans hcoreJ.symm + have hgrowth := AlgorithmFiveFiveParallelStrictGrowth G k e0 input T phi + phi ett J corrJ baseJ KJ goodJ hzeroJ hPE hJcoreJ m U hUlength + hzeroEndpoint hmaximal + rwa [hJcore] at hgrowth + have hstrictNonPE : + ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + U.length := by + intro hnonPE + rcases hseed with hparallel | hnonparallel + · exact (hnonPE hparallel.1).elim + · rcases hnonparallel with ⟨hkind, f, hf, hadjoin⟩ + rcases hadjoin with ⟨hlen, hinitial, hedge⟩ + omega + have hzeroU : KU.dividerCount = 0 := by omega + let lastU : Fin (KU.dividerCount + 1) := Fin.last KU.dividerCount + let lastJ : Fin (KJ.dividerCount + 1) := Fin.last KJ.dividerCount + let oldIndex : Fin (KJ.dividerCount + 1) := + Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) lastU + have holdLast : oldIndex = lastJ := by + apply Fin.ext + simp [oldIndex, lastU, lastJ] + have htransport := hstages lastU + dsimp only at htransport + have hstageTransport : KU.stage lastU.castSucc = KJ.stage lastJ.castSucc := by + simpa [oldIndex, holdLast] using htransport.1 + have hstoredTransport : HierarchyStoredColorsAt KU lastU = + HierarchyStoredColorsAt KJ lastJ := by + simpa [oldIndex, holdLast] using htransport.2.2.1 + have hmissingTransport : HierarchyStageMissingColors KU lastU = + HierarchyStageMissingColors KJ lastJ := by + simpa [oldIndex, holdLast] using htransport.2.2.2 + have hgammaTransport : ∀ eta : Fin k, + goodU.gamma lastU eta = goodJ.gamma lastJ eta := by + intro eta + simpa [oldIndex, holdLast] using hgamma lastU eta + have hmissingU : HierarchyStageMissingColors KU lastU = + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + exact hmissingTransport.trans hmissingJ + have hunionTransport : + (HierarchyStoredColorsAt KU lastU).biUnion (goodU.gamma lastU) = + (HierarchyStoredColorsAt KJ lastJ).biUnion (goodJ.gamma lastJ) := by + apply Finset.ext + intro c + simp only [Finset.mem_biUnion] + constructor + · rintro ⟨eta, heta, hc⟩ + refine ⟨eta, ?_, ?_⟩ + · rwa [← hstoredTransport] + · rwa [← hgammaTransport eta] + · rintro ⟨eta, heta, hc⟩ + refine ⟨eta, ?_, ?_⟩ + · rwa [hstoredTransport] + · rwa [hgammaTransport eta] + have hstageZeroU : KU.stage 0 = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + have hzeroOld : + Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) + (0 : Fin (KU.dividerCount + 1)) = + (0 : Fin (KJ.dividerCount + 1)) := by + apply Fin.ext + rfl + have hs := (hstages (0 : Fin (KU.dividerCount + 1))).1 + rw [hzeroOld] at hs + calc + KU.stage 0 = KU.stage (0 : Fin (KU.dividerCount + 1)).castSucc := by + congr 1 + _ = KJ.stage (0 : Fin (KJ.dividerCount + 1)).castSucc := hs + _ = KJ.stage 0 := by congr 1 + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := hstageZeroJ + have hpairData : + (∀ eta : Fin k, + eta ∈ HierarchyStoredColorsAt KU lastU → + (goodU.gamma lastU eta).card = 2 ∧ + goodU.gamma lastU eta ⊆ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) \ + HierarchySegmentColors KU lastU eta) := by + intro eta heta + refine ⟨goodU.twoColors lastU eta heta, ?_⟩ + have ha := goodU.avoidance lastU eta heta + rwa [hmissingU] at ha + have hdisjointData : + ∀ eta theta : Fin k, eta ∈ HierarchyStoredColorsAt KU lastU → theta ∈ HierarchyStoredColorsAt + KU lastU → eta ≠ theta → Disjoint (goodU.gamma lastU eta) (goodU.gamma lastU theta) := by + intro eta theta heta htheta hne + exact goodU.disjointPairs lastU eta theta heta htheta hne + have hparallelData : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + ¬ TreeColorSetMinusClosed G phi base.core + ((HierarchyStoredColorsAt KU lastU).biUnion + (goodU.gamma lastU)) ∧ + 4 ≤ ((TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure) \ + (HierarchyStoredColorsAt KU lastU).biUnion + (goodU.gamma lastU)).card := by + intro hPE + have hp := hparallelJ hPE + rwa [hunionTransport] + refine ⟨J, U, corrU, hseed, hsequence, hJU, hstrictPE, hstrictNonPE, + hMPU, baseU, ?_, ?_, ?_, KU, hzeroU, hstageZeroU, KU.terminalStage, + goodU, ?_⟩ + · exact hcoreU.trans hcoreJ + · exact hclosureU.trans hclosureJ + · exact hsupportU.trans hsupportJ + · change + ((∀ eta : Fin k, + eta ∈ HierarchyStoredColorsAt KU lastU → + (goodU.gamma lastU eta).card = 2 ∧ + goodU.gamma lastU eta ⊆ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) \ + HierarchySegmentColors KU lastU eta) ∧ + (∀ eta theta : Fin k, + eta ∈ HierarchyStoredColorsAt KU lastU → + theta ∈ HierarchyStoredColorsAt KU lastU → eta ≠ theta → + Disjoint (goodU.gamma lastU eta) (goodU.gamma lastU theta)) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + ¬ TreeColorSetMinusClosed G phi base.core + ((HierarchyStoredColorsAt KU lastU).biUnion + (goodU.gamma lastU)) ∧ + 4 ≤ ((TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure) \ + (HierarchyStoredColorsAt KU lastU).biUnion + (goodU.gamma lastU)).card)) ∧ + TreeColorSetMinusClosed G phi U + ((HierarchyTerminalStoredColors KU).biUnion + (goodU.gamma lastU)) + exact ⟨⟨hpairData, hdisjointData, hparallelData⟩, hminus⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AlgorithmFiveFiveInitialGoodHierarchy.lean b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveInitialGoodHierarchy.lean new file mode 100644 index 0000000000..bdb08044ef --- /dev/null +++ b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveInitialGoodHierarchy.lean @@ -0,0 +1,387 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveSeed + +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyInitialPairsNonPE +public import LeanPool.GoldbergSeymour.GoodHierarchyInitialPairsPE + +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Algorithm Five Five Initial Good Hierarchy + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem AlgorithmFiveFiveInitialGoodHierarchy_branch_196.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (J : TreeSequence G e0) (corrJ : + CorrespondingExtendedTashkinovTree G k e0 ett phi J) (baseJ : HierarchyBase + corrJ.replacementETT phi) (KJ : TashkinovHierarchy corrJ.replacementETT baseJ), baseJ.core + = base.core → KJ.stage 0 = ett.series.data.tree (Fin.last ett.rounds).castSucc → + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ J = + base.core ∨ (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f J) → + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc; + corrJ.replacementETT.series.data.tree (Fin.last corrJ.replacementETT.rounds).castSucc = Tn + → corrJ.replacementETT.series.data.kind (Fin.last corrJ.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) → 2 * corrJ.replacementETT.rounds + 11 ≤ + (TreeMissingColors phi (corrJ.replacementETT.series.data.tree (Fin.last + corrJ.replacementETT.rounds).castSucc)).card → KJ.stage (Fin.succ 0) = J → + ¬ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + ∃ (gamma : Fin k → Finset (Fin k)), ( + ∀ eta ∈ HierarchyStoredColorsAt KJ 0, (gamma eta).card = 2 ∧ gamma eta ⊆ TreeMissingColors phi + Tn) ∧ ( + ∀ (eta theta : Fin k), eta ∈ HierarchyStoredColorsAt KJ 0 → theta ∈ HierarchyStoredColorsAt KJ + 0 → eta ≠ theta → Disjoint (gamma eta) (gamma theta)) ∧ ( + ∀ eta ∈ HierarchyStoredColorsAt KJ 0, Disjoint (gamma eta) (HierarchySegmentColors KJ 0 eta)) + ∧ (corrJ.replacementETT.series.data.kind (Fin.last corrJ.replacementETT.rounds) = some + TashkinovExtensionKind.PE → ¬TreeColorSetMinusClosed G phi baseJ.core + ((HierarchyStoredColorsAt KJ 0).biUnion gamma) ∧ 4 ≤ ((TreeMissingColors phi + (corrJ.replacementETT.series.data.tree (Fin.last corrJ.replacementETT.rounds).castSucc) ∩ + TreeMissingColors phi baseJ.closure) \ (HierarchyStoredColorsAt KJ 0).biUnion gamma).card) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base J corrJ baseJ KJ hbaseCore _ hseed Tn htree hkind + hlargeJ hterminal hPE + have hnonPEJ : corrJ.replacementETT.series.data.kind + (Fin.last corrJ.replacementETT.rounds) ≠ + some TashkinovExtensionKind.PE := by + simpa only [hkind] using hPE + obtain ⟨gamma, hpairs, hd⟩ := + GoodHierarchyInitialPairsNonPE KJ hnonPEJ hlargeJ + have hpairs' : ∀ eta, eta ∈ HierarchyStoredColorsAt KJ 0 → + (gamma eta).card = 2 ∧ gamma eta ⊆ TreeMissingColors phi Tn := by + simpa only [htree] using hpairs + obtain ⟨hkinds, f, hf, hadjoin⟩ := hseed.resolve_left + (fun h => hPE h.1) + have hcore : baseJ.core = Tn := + hbaseCore.trans (base.nonparallel hPE) + have hseedColor : ∃ c : Fin k, + phi f = some c ∧ c ∉ TreeMissingColors phi Tn := by + have hstep := ett.series.certified (Fin.last ett.rounds) + generalize htarget : (Fin.last ett.rounds : Fin (ett.rounds + 1)) = + target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val htarget + have := ett.roundsPositive + simp only [Fin.val_last, Fin.val_zero] at hv + omega + | PE i pp po pc pn nr choice sa gamma gr ss sp so sr ew cc cp co + cs ce ck cv coo cd cg closed ordered strict => + exact (hPE (by simpa only [htarget] using ck)).elim + | SE i pp po pc pn nr choice sa cc cs ce ck cv co cd cg ad ae + closed ordered strict => + have hi : i.succ = Fin.last ett.rounds := htarget.symm + have he : f = choice.edge := by + apply Finset.singleton_injective + exact hf.symm.trans (by simpa only [hi] using ce) + have hphi : phi = choice.selected := + ett.generatingColoring.trans (by simpa only [hi] using cc) + have hreverse : StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) + choice.selected (ett.series.data.coloring i.castSucc) := + (sc2 G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc)).symm + (x := ⟨ett.series.data.coloring i.castSucc, pp, po⟩) + (y := ⟨choice.selected, choice.selectedProper, + choice.selectedOneUncolored⟩) choice.selectedStable + have hclosed : ColoredVertexSetClosed G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) := by + intro g c v hg hv hgc hmiss + have hincident : TreeIncidentEdge + (ett.series.data.tree i.succ.castSucc) g := by + have hg' := hg + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hg' + obtain ⟨u, hu, w, hw, hends⟩ := hg' + refine ⟨u, hu, ?_⟩ + simp [Incident, hends] + have hm : c ∈ TreeMissingColors choice.selected + (ett.series.data.tree i.succ.castSucc) := + Finset.mem_biUnion.mpr ⟨v, hv, hmiss⟩ + have hgc' := hreverse.1 g hincident + ⟨c, Finset.mem_union_left _ hm, hgc⟩ + exact pc hg hv (hgc'.trans hgc) (by + rw [hreverse.2 v hv] + exact hmiss) + have hb : choice.edge ∈ BoundaryEdges G + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) := by + obtain ⟨c, hc, hec⟩ := choice.edgeDefective + simp only [BoundaryColorEdges, Finset.mem_filter] at hec + exact hec.1 + refine ⟨choice.color, ?_, ?_⟩ + · simpa only [hphi, he] using choice.edgeColor + · have hnot : choice.color ∉ TreeMissingColors choice.selected + (ett.series.data.tree i.succ.castSucc) := by + intro hm + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp hm + exact hclosed hb hv choice.edgeColor hmv + simpa only [Tn, hi, hphi] using hnot + | RE i pp po pc pn available cc cs ce ck cv co cd cg ad ae + closed ordered strict => + have hi : i.succ = Fin.last ett.rounds := htarget.symm + have he : f = available.edge := by + apply Finset.singleton_injective + exact hf.symm.trans (by simpa only [hi] using ce) + have hphi : phi = ett.series.data.coloring i.castSucc := + ett.generatingColoring.trans (by simpa only [hi] using cc) + have hcolored : ∃ c : Fin k, + ett.series.data.coloring i.castSucc available.edge = some c := by + let rotated := available.cycle.walk.rotate + (Sum.inr available.edge) available.edgeOnCycle + have hrotated : rotated.IsCycle := + available.cycle.isCycle.rotate available.edgeOnCycle + have hadj := rotated.adj_snd hrotated.not_nil + cases hv : rotated.snd with + | inl v => + rw [hv] at hadj + rcases hadj.2 with hc | hc + · exact ⟨available.gamma, hc⟩ + · exact ⟨available.delta, hc⟩ + | inr g => + rw [hv] at hadj + exact hadj.elim + obtain ⟨c, hc⟩ := hcolored + refine ⟨c, by simpa only [hphi, he] using hc, ?_⟩ + have hnot : c ∉ TreeMissingColors + (ett.series.data.coloring i.castSucc) + (ett.series.data.tree i.succ.castSucc) := by + intro hm + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp hm + exact pc available.edgeBoundary hv hc hmv + simpa only [Tn, hi, hphi] using hnot + obtain ⟨seedColor, hcolor, hnotMissing⟩ := hseedColor + refine ⟨gamma, hpairs', hd, ?_, fun h => (hnonPEJ h).elim⟩ + intro eta heta + apply Finset.disjoint_left.mpr + intro c hcg hcs + have hcs' : c ∈ Finset.univ.filter (fun c => + ∃ r : Fin J.length, Tn.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi J eta).val J.length ∧ + phi (J.edge r) = some c) := by + unfold HierarchySegmentColors at hcs + dsimp only at hcs + rw [hterminal] at hcs + simpa only [HierarchyStarredStage, Fin.cases_zero, hcore] using hcs + obtain ⟨_, r, hlo, hhi, hc⟩ := Finset.mem_filter.mp hcs' + obtain ⟨hlen, hinitial, hedge⟩ := hadjoin + change J.length = Tn.length + 1 at hlen + have hr : r = Fin.cast hlen.symm (Fin.last Tn.length) := by + apply Fin.ext + have := r.isLt + simp only [Fin.val_cast, Fin.val_last] + omega + rw [hr, hedge, hcolor] at hc + have hec : seedColor = c := Option.some.inj hc + exact hnotMissing (hec.symm ▸ (hpairs' eta heta).2 hcg) + +theorem AlgorithmFiveFiveInitialGoodHierarchy {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (J : TreeSequence G e0) + (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett phi J) + (baseJ : HierarchyBase corrJ.replacementETT phi) + (KJ : TashkinovHierarchy corrJ.replacementETT baseJ) + (hbaseCore : baseJ.core = base.core) + (hbaseClosure : baseJ.closure = base.closure) + (hzero : KJ.dividerCount = 0) + (_ : KJ.stage 0 = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (hseed : + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ J = base.core) ∨ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ f : E, + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f J))) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (hparallelFacts : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + (∃ alpha : Fin k, + alpha ∈ TreeMissingColors phi base.core ∧ + ¬ TreeColorSetClosed G phi base.core {alpha}) ∧ + TreeColorSetClosed G phi base.core + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure) ∧ + 4 ≤ (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure).card) : + ∃ goodJ : GoodHierarchy KJ, + HierarchyStageMissingColors KJ (Fin.last KJ.dividerCount) = + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + ¬ TreeColorSetMinusClosed G phi base.core + ((HierarchyStoredColorsAt KJ + (Fin.last KJ.dividerCount)).biUnion + (goodJ.gamma (Fin.last KJ.dividerCount))) ∧ + 4 ≤ ((TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure) \ + (HierarchyStoredColorsAt KJ + (Fin.last KJ.dividerCount)).biUnion + (goodJ.gamma (Fin.last KJ.dividerCount))).card) := by + classical + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + have htransport : + ∀ (n : ℕ) (s : TashkinovSeries G k n e0 corrJ.replacementInput), n = ett.rounds → HEq s + corrJ.replacementSeries → s.data.tree (Fin.last n).castSucc = Tn ∧ s.data.kind (Fin.last + n) = ett.series.data.kind (Fin.last ett.rounds) := by + intro n s hn hs + subst n + have hs' : s = corrJ.replacementSeries := eq_of_heq hs + subst s + refine ⟨?_, corrJ.extensionKindsAgree (Fin.last ett.rounds)⟩ + let i : Fin ett.rounds := ⟨ett.rounds - 1, by + have := ett.roundsPositive + omega⟩ + have hi : i.succ = Fin.last ett.rounds := by + apply Fin.ext + dsimp [i] + have := ett.roundsPositive + omega + simpa only [hi] using corrJ.ladderTreesAgree i + obtain ⟨htree, hkind⟩ := htransport corrJ.replacementETT.rounds + corrJ.replacementETT.series corrJ.rungAgreement corrJ.seriesPresentation + have hlargeJ : 2 * corrJ.replacementETT.rounds + 11 ≤ + (TreeMissingColors phi + (corrJ.replacementETT.series.data.tree + (Fin.last corrJ.replacementETT.rounds).castSucc)).card := by + rw [htree, corrJ.rungAgreement] + exact hlarge + have hindex : ∀ j : Fin (KJ.dividerCount + 1), j = 0 := by + intro j + apply Fin.ext + have := j.isLt + simp only [Fin.val_zero] + omega + have hmissing : ∀ j : Fin (KJ.dividerCount + 1), + HierarchyStageMissingColors KJ j = TreeMissingColors phi Tn := by + intro j + rw [hindex j] + simpa only [HierarchyStageMissingColors, Fin.cases_zero] using + congrArg (TreeMissingColors phi) htree + have hterminal : KJ.stage (0 : Fin (KJ.dividerCount + 1)).succ = J := by + have hi : (0 : Fin (KJ.dividerCount + 1)).succ = + Fin.last (KJ.dividerCount + 1) := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_zero, Fin.val_last] + omega + rw [hi] + exact KJ.terminalStage + obtain ⟨gamma, hpairs, hdisjoint, havoid, hparallel⟩ : + ∃ gamma : Fin k → Finset (Fin k), + (∀ eta, eta ∈ HierarchyStoredColorsAt KJ 0 → + (gamma eta).card = 2 ∧ gamma eta ⊆ TreeMissingColors phi Tn) ∧ + (∀ eta theta, eta ∈ HierarchyStoredColorsAt KJ 0 → + theta ∈ HierarchyStoredColorsAt KJ 0 → eta ≠ theta → + Disjoint (gamma eta) (gamma theta)) ∧ + (∀ eta, eta ∈ HierarchyStoredColorsAt KJ 0 → + Disjoint (gamma eta) (HierarchySegmentColors KJ 0 eta)) ∧ + (corrJ.replacementETT.series.data.kind + (Fin.last corrJ.replacementETT.rounds) = + some TashkinovExtensionKind.PE → + ¬ TreeColorSetMinusClosed G phi baseJ.core + ((HierarchyStoredColorsAt KJ 0).biUnion gamma) ∧ + 4 ≤ ((TreeMissingColors phi + (corrJ.replacementETT.series.data.tree + (Fin.last corrJ.replacementETT.rounds).castSucc) ∩ + TreeMissingColors phi baseJ.closure) \ + (HierarchyStoredColorsAt KJ 0).biUnion gamma).card) := by + by_cases hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · have hPEJ := hkind.trans hPE + obtain ⟨hnc, hcc, hfour⟩ := hparallelFacts hPE + obtain ⟨gamma, hpairs, hd, hn, hf⟩ := GoodHierarchyInitialPairsPE KJ + hPEJ hlargeJ (by simpa only [hbaseCore] using hnc) + (by simpa only [htree, hbaseCore, hbaseClosure] using hcc) + (by simpa only [htree, hbaseClosure] using hfour) + have hJ : J = base.core := by + rcases hseed with h | h + · exact h.2 + · rcases h.1 with h | h <;> rw [hPE] at h <;> cases h + have hstar : HierarchyStarredStage KJ 0 = J := by + simpa only [HierarchyStarredStage, Fin.cases_zero, hbaseCore] using hJ.symm + refine ⟨gamma, ?_, hd, ?_, fun _ => ⟨hn, hf⟩⟩ + · simpa only [htree] using hpairs + · intro eta heta + apply Finset.disjoint_left.mpr + intro c hcg hcs + obtain ⟨_, r, hlo, hhi, hc⟩ := Finset.mem_filter.mp hcs + change (HierarchyStarredStage KJ 0).length ≤ r.val at hlo + rw [hstar] at hlo + have hr : r.val < J.length := by + simpa only [hterminal] using r.isLt + omega + · exact @AlgorithmFiveFiveInitialGoodHierarchy_branch_196 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base J corrJ baseJ KJ hbaseCore (by + assumption) hseed htree hkind hlargeJ hterminal hPE + let goodJ : GoodHierarchy KJ := { + gamma := fun _ => gamma + twoColors := by + intro j eta heta + rw [hindex j] at heta + exact (hpairs eta heta).1 + avoidance := by + intro j eta heta c hc + rw [hindex j] at heta ⊢ + apply Finset.mem_sdiff.mpr + refine ⟨?_, ?_⟩ + · rw [hmissing] + exact (hpairs eta heta).2 hc + · exact fun hs => Finset.disjoint_left.mp (havoid eta heta) hc hs + disjointPairs := by + intro j eta theta heta htheta hne + rw [hindex j] at heta htheta + exact hdisjoint eta theta heta htheta hne + uniqueRefresh := by + intro i + have := i.isLt + omega + parallelBase := hparallel + minusClosed := by + intro i + have := i.isLt + omega } + refine ⟨goodJ, hmissing _, ?_⟩ + intro hPE + have hp := hparallel (hkind.trans hPE) + simpa only [goodJ, hindex (Fin.last KJ.dividerCount), htree, + hbaseCore, hbaseClosure] using hp + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AlgorithmFiveFiveParallelStrictGrowth.lean b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveParallelStrictGrowth.lean new file mode 100644 index 0000000000..43ab1ca584 --- /dev/null +++ b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveParallelStrictGrowth.lean @@ -0,0 +1,145 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryMissingColorAugmentation +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy + +/-! +# Algorithm Five Five Parallel Strict Growth + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem AlgorithmFiveFiveParallelStrictGrowth {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (J : TreeSequence G e0) + (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett phi J) + (baseJ : HierarchyBase corrJ.replacementETT phi) + (KJ : TashkinovHierarchy corrJ.replacementETT baseJ) + (goodJ : GoodHierarchy KJ) + (hzero : KJ.dividerCount = 0) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (hJcore : J = baseJ.core) + (m : ℕ) (U : TreeSequence G e0) + (hUlength : U.length = J.length + m) + (hzeroEndpoint : m = 0 → U = J) + (hmaximal : ∀ W : TreeSequence G e0, + TashkinovAugmentation phi U W → + (∀ eta : Fin k, + eta ∈ HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount) → + Disjoint (goodJ.gamma (Fin.last KJ.dividerCount) eta) + (Finset.univ.filter fun c => + ∃ r : Fin W.length, + (HierarchyStarredStage KJ + (Fin.last KJ.dividerCount)).length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi W eta).val + W.length ∧ + phi (W.edge r) = some c)) → + False) : + J.length < U.length := by + classical + have hpeReplacement : + corrJ.replacementETT.series.data.kind + (Fin.last corrJ.replacementETT.rounds) = + some TashkinovExtensionKind.PE := by + rcases corrJ with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have seriesSame : replacementData = replacementSeries := + eq_of_heq seriesPresentation + cases seriesSame + exact (extensionKindsAgree (Fin.last ett.rounds)).trans hPE + have hnot := (goodJ.parallelBase hpeReplacement).1 + have hlast : Fin.last KJ.dividerCount = 0 := by + apply Fin.ext + simp [hzero] + have hstar : + HierarchyStarredStage KJ (Fin.last KJ.dividerCount) = J := by + rw [hlast] + simp [HierarchyStarredStage, hJcore] + let C := (HierarchyStoredColorsAt KJ 0).biUnion (goodJ.gamma 0) + have hnotC : ¬ TreeColorSetMinusClosed G phi baseJ.core C := by + simpa [C] using hnot + change ¬ TreeColorSetClosed G phi baseJ.core + (TreeMissingColors phi baseJ.core \ C) at hnotC + simp only [TreeColorSetClosed] at hnotC + push Not at hnotC + rcases hnotC with ⟨c, hc, hboundary⟩ + have hcJ : c ∈ TreeMissingColors phi J := by + have := (Finset.mem_sdiff.mp hc).1 + simpa [hJcore] using this + have hcOutside : c ∉ C := (Finset.mem_sdiff.mp hc).2 + obtain ⟨f, hf⟩ := hboundary + have hcolor : phi f = some c := + (Finset.mem_filter.mp (show f ∈ BoundaryColorEdges G phi + (TreeSequenceVertexSet baseJ.core) c from hf)).2 + have hboundaryJ : + f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet J) c := by + simpa [hJcore] using hf + obtain ⟨W, hAdjoin, hAugment, _⟩ := + BoundaryMissingColorAugmentation G k e0 phi J c f hboundaryJ hcJ + rcases hAdjoin with ⟨hlen, hInitial, hLastEdge⟩ + have hwindow : + ∀ eta : Fin k, Finset.univ.filter (fun d => + ∃ r : Fin W.length, (HierarchyStarredStage KJ (Fin.last KJ.dividerCount)).length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi W eta).val W.length ∧ phi (W.edge r) = some + d) ⊆ {c} := by + intro eta d hd + rcases (Finset.mem_filter.mp hd).2 with ⟨r, hrlo, hrhi, hphi⟩ + have hrval : r.val = J.length := by + rw [hstar] at hrlo + have hrlt : r.val < W.length := lt_of_lt_of_le hrhi (min_le_right _ _) + omega + have hr : r = Fin.cast hlen.symm (Fin.last J.length) := by + apply Fin.ext + simp [hrval] + rw [hr, hLastEdge] at hphi + have hcolor' : phi f = some c := hcolor + rw [hcolor'] at hphi + exact Finset.mem_singleton.mpr (Option.some.inj hphi.symm) + have hdisjoint : + ∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount) → Disjoint + (goodJ.gamma (Fin.last KJ.dividerCount) eta) (Finset.univ.filter fun d => + ∃ r : Fin W.length, (HierarchyStarredStage KJ (Fin.last KJ.dividerCount)).length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi W eta).val W.length ∧ phi (W.edge r) = some + d) := by + intro eta heta + apply Finset.disjoint_left.mpr + intro d hdGamma hdWindow + rw [hlast] at hdGamma + have hdC : d ∈ C := by + apply Finset.mem_biUnion.mpr + refine ⟨eta, ?_, hdGamma⟩ + simpa [hlast] using heta + have hdc : d = c := Finset.mem_singleton.mp (hwindow eta hdWindow) + subst d + exact hcOutside hdC + by_contra hstrict + have hm : m = 0 := by omega + have hUeq := hzeroEndpoint hm + exact hmaximal W (by simpa [hUeq] using hAugment) hdisjoint + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AlgorithmFiveFiveSeed.lean b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveSeed.lean new file mode 100644 index 0000000000..05623c333c --- /dev/null +++ b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveSeed.lean @@ -0,0 +1,640 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree + +public import LeanPool.GoldbergSeymour.MaximumProperty + +public import LeanPool.GoldbergSeymour.TashkinovHierarchy + +/-! +# Algorithm Five Five Seed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable abbrev seedCorrespondingTree.{u_1, u_2} : + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq E] → + (G : GoldbergSeymour.LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : GoldbergSeymour.PartialEdgeColoring E k) → + (T : GoldbergSeymour.TreeSequence G e0) → + (phi : GoldbergSeymour.PartialEdgeColoring E k) → + (ett : GoldbergSeymour.ExtendedTashkinovTree G k e0 input T phi) → + (∀ (j : Fin (ett.rounds + (1 : ℕ))), + GoldbergSeymour.IsProperEdgeColoring G + (ett.series.data.coloring j)) → + (∀ (j : Fin (ett.rounds + (1 : ℕ))), + GoldbergSeymour.IsOneEdgeUncolored (ett.series.data.coloring j) + e0) → + (∀ (X : GoldbergSeymour.TreeSequence G e0) (C : Finset (Fin k)) + (q : GoldbergSeymour.PartialEdgeColoring E k), + GoldbergSeymour.StableColoring X C q q) → + (J : GoldbergSeymour.TreeSequence G e0) → + GoldbergSeymour.TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) J → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + J.length → + GoldbergSeymour.TreeSequenceInitialSegment J + (ett.series.data.tree + (Fin.last (ett.rounds + (1 : ℕ)))) → + GoldbergSeymour.CorrespondingExtendedTashkinovTree G k e0 + ett phi J := by + classical + intro V E _ _ _ G k e0 input T phi ett seriesProper seriesOneUncolored selfStable J hpen + hstrict hJ + let replacementETT : ExtendedTashkinovTree G k e0 input J phi := + { rounds := ett.rounds + roundsPositive := ett.roundsPositive + series := ett.series + abovePenultimate := hpen + strictAbovePenultimate := hstrict + belowFinal := hJ + generatingColoring := ett.generatingColoring } + refine + { replacementInput := input + replacementSeries := ett.series + replacementETT := replacementETT + rungAgreement := rfl + seriesPresentation := by dsimp [replacementETT]; rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun j => rfl + storedColorsAgree := fun j => rfl + connectingEdgesAgree := fun j => rfl + extensionKindsAgree := fun j => rfl + replacementProper := fun j => seriesProper j + replacementOneUncolored := fun j => seriesOneUncolored j + replacementStable := fun j => selfStable _ _ _ } + +private noncomputable abbrev seedZeroDividerHierarchy.{u_1, u_2} : + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : GoldbergSeymour.LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : GoldbergSeymour.PartialEdgeColoring E k) → + (T : GoldbergSeymour.TreeSequence G e0) → + (phi : GoldbergSeymour.PartialEdgeColoring E k) → + (ett : GoldbergSeymour.ExtendedTashkinovTree G k e0 input T phi) → + (J : GoldbergSeymour.TreeSequence G e0) → + (corr : + GoldbergSeymour.CorrespondingExtendedTashkinovTree G k e0 ett + phi J) → + (baseJ : GoldbergSeymour.HierarchyBase corr.replacementETT phi) → + GoldbergSeymour.TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) J → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + J.length → + GoldbergSeymour.TreeSequenceInitialSegment baseJ.core J → + ett.series.data.tree (Fin.last ett.rounds).castSucc = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc → + GoldbergSeymour.TashkinovHierarchy corr.replacementETT + baseJ := by + classical + intro V E _ _ _ _ G k e0 input T phi ett + exact fun (J : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi J) + (baseJ : HierarchyBase corr.replacementETT phi) + (hpen : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) J) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < J.length) + (hcore : TreeSequenceInitialSegment baseJ.core J) + (hbaseStage : ett.series.data.tree (Fin.last ett.rounds).castSucc = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) => + ({ dividerCount := 0 + stage := fun q => if q.val = 0 then + ett.series.data.tree (Fin.last ett.rounds).castSucc else J + baseStage := by simp [hbaseStage] + terminalStage := by simp + nested := by + intro j + have hj : j = 0 := Fin.eq_zero j + subst j + simpa using hpen + strict := by + intro j + have hj : j = 0 := Fin.eq_zero j + subst j + simpa using hstrict + dividerPosition := fun q => Fin.elim0 q + dividerPositive := fun q => Fin.elim0 q + dividerIncreasing := fun q r h => Fin.elim0 q + dividerStage := fun q => Fin.elim0 q + coreInsideFirst := hcore } : TashkinovHierarchy corr.replacementETT baseJ) + +private theorem helper_branch_246.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : MaximumProperty ett) (base : HierarchyBase ett phi), + let terminalIndex : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ (_ : ( + ∀ (A B : TreeSequence G e0) (_ : TashkinovAugmentationSequence phi A B), + TreeSequenceInitialSegment A B)) (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOneUncolored : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0) + (selfStable : + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (q : PartialEdgeColoring E k), StableColoring X + C q q), + let _ : (J : TreeSequence G e0) → TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) J → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + J.length → TreeSequenceInitialSegment J (ett.series.data.tree (Fin.last (ett.rounds + (1 : + ℕ)))) → CorrespondingExtendedTashkinovTree G k e0 ett phi J := @seedCorrespondingTree (@V) + (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@seriesProper) (@seriesOneUncolored) (@selfStable); + let _ : (J : TreeSequence G e0) → (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi J) + → (baseJ : HierarchyBase corr.replacementETT phi) → TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) J → (ett.series.data.tree (Fin.last + ett.rounds).castSucc).length < J.length → TreeSequenceInitialSegment baseJ.core J → + ett.series.data.tree (Fin.last ett.rounds).castSucc = corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc → TashkinovHierarchy corr.replacementETT + baseJ := @seedZeroDividerHierarchy (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett); + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (_ : ett.series.data.connectingEdges i.succ = + { choice.edge }) (_ : ett.series.data.kind i.succ = some TashkinovExtensionKind.SE) + (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : terminalIndex = i.succ), + ∃ (J : TreeSequence G e0) (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett phi J), + MaximumProperty corrJ.replacementETT ∧ TreeSequenceInitialSegment J (ett.series.data.tree + (Fin.last (ett.rounds + (1 : ℕ)))) ∧ + ∃ (baseJ : HierarchyBase corrJ.replacementETT phi), baseJ.core = base.core ∧ baseJ.closure = + base.closure ∧ (↑baseJ.supportPosition : ℕ) = (↑base.supportPosition : ℕ) ∧ + ∃ (KJ : TashkinovHierarchy corrJ.replacementETT baseJ), KJ.dividerCount = (0 : ℕ) ∧ KJ.stage + (0 : Fin (KJ.dividerCount + (2 : ℕ))) = ett.series.data.tree (Fin.last + ett.rounds).castSucc ∧ KJ.stage (Fin.last (KJ.dividerCount + (1 : ℕ))) = J ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ J = + base.core ∨ (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges (Fin.last ett.rounds) = { f } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f J ∧ + TashkinovAugmentationSequence phi J (ett.series.data.tree (Fin.last (ett.rounds + (1 : + ℕ))))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP base terminalIndex initialFromSequence + seriesProper seriesOneUncolored selfStable buildCorresponding buildHierarchy i choice + currentEdges currentKind adjoined adjoinedExactly closedExtension terminalEquality + have indexEquality : i.succ = Fin.last ett.rounds := by + apply Fin.ext + dsimp [terminalIndex] at terminalEquality + omega + have hkind : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE := by simpa [indexEquality] using currentKind + have hseq : TashkinovAugmentationSequence phi adjoined + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [ett.generatingColoring, indexEquality] using closedExtension.1 + have hJ : TreeSequenceInitialSegment adjoined + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := + initialFromSequence _ _ hseq + have hpen : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) adjoined := by + simpa [indexEquality] using adjoinedExactly.2.1 + have hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + adjoined.length := by + have hlen := adjoinedExactly.1 + have hlen' : adjoined.length = + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length + 1 := by + simpa [indexEquality] using hlen + omega + let corr := buildCorresponding adjoined hpen hstrict hJ + refine ⟨adjoined, corr, ?_, hJ, ?_⟩ + · simpa only [MaximumProperty] using hMP + · let baseJ : HierarchyBase corr.replacementETT phi := by + dsimp [corr] + exact { + core := base.core + closure := base.closure + supportPosition := base.supportPosition + supportPositive := base.supportPositive + terminalMissingColors := base.terminalMissingColors + parallel := base.parallel + nonparallel := base.nonparallel } + refine ⟨baseJ, rfl, rfl, ?_, ?_⟩ + · simp [baseJ] + · have hbase : base.core = + ett.series.data.tree (Fin.last ett.rounds).castSucc := + base.nonparallel (by simp [hkind]) + have hb : baseJ.core = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + dsimp [baseJ] + exact hbase + have hc : TreeSequenceInitialSegment baseJ.core adjoined := by + rw [hb] + exact hpen + let KJ := buildHierarchy adjoined corr baseJ hpen hstrict hc (by rfl) + exact ⟨KJ, rfl, rfl, rfl, + Or.inr ⟨Or.inl hkind, + ⟨choice.edge, by simpa [indexEquality] using currentEdges, + (by simpa [indexEquality] using adjoinedExactly), hseq⟩⟩⟩ + +private theorem helper_branch_303.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : MaximumProperty ett) (base : HierarchyBase ett phi) (_ : ( + ∀ (_ : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE), + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < base.core.length)) (_ : ( + ∀ (_ : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE), + TashkinovClosure phi base.core (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ)))))), + let terminalIndex : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ (_ : ( + ∀ (A B : TreeSequence G e0) (_ : TashkinovAugmentationSequence phi A B), + TreeSequenceInitialSegment A B)) (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOneUncolored : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0) + (selfStable : + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (q : PartialEdgeColoring E k), StableColoring X + C q q), + let _ : (J : TreeSequence G e0) → TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) J → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + J.length → TreeSequenceInitialSegment J (ett.series.data.tree (Fin.last (ett.rounds + (1 : + ℕ)))) → CorrespondingExtendedTashkinovTree G k e0 ett phi J := @seedCorrespondingTree (@V) + (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@seriesProper) (@seriesOneUncolored) (@selfStable); + let _ : (J : TreeSequence G e0) → (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi J) + → (baseJ : HierarchyBase corr.replacementETT phi) → TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) J → (ett.series.data.tree (Fin.last + ett.rounds).castSucc).length < J.length → TreeSequenceInitialSegment baseJ.core J → + ett.series.data.tree (Fin.last ett.rounds).castSucc = corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc → TashkinovHierarchy corr.replacementETT + baseJ := @seedZeroDividerHierarchy (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett); + ∀ (i : Fin ett.rounds) (_ : ett.series.data.kind i.succ = some TashkinovExtensionKind.PE) (_ : + terminalIndex = i.succ), + ∃ (J : TreeSequence G e0) (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett phi J), + MaximumProperty corrJ.replacementETT ∧ TreeSequenceInitialSegment J (ett.series.data.tree + (Fin.last (ett.rounds + (1 : ℕ)))) ∧ + ∃ (baseJ : HierarchyBase corrJ.replacementETT phi), baseJ.core = base.core ∧ baseJ.closure = + base.closure ∧ (↑baseJ.supportPosition : ℕ) = (↑base.supportPosition : ℕ) ∧ + ∃ (KJ : TashkinovHierarchy corrJ.replacementETT baseJ), KJ.dividerCount = (0 : ℕ) ∧ KJ.stage + (0 : Fin (KJ.dividerCount + (2 : ℕ))) = ett.series.data.tree (Fin.last + ett.rounds).castSucc ∧ KJ.stage (Fin.last (KJ.dividerCount + (1 : ℕ))) = J ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ J = + base.core ∨ (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges (Fin.last ett.rounds) = { f } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f J ∧ + TashkinovAugmentationSequence phi J (ett.series.data.tree (Fin.last (ett.rounds + (1 : + ℕ))))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP base hcoreStrict hcoreClosure terminalIndex + initialFromSequence seriesProper seriesOneUncolored selfStable buildCorresponding + buildHierarchy i currentKind terminalEquality + have indexEquality : i.succ = Fin.last ett.rounds := by + apply Fin.ext + dsimp [terminalIndex] at terminalEquality + omega + have hkind : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := by simpa [indexEquality] using currentKind + have hseq := hcoreClosure hkind + have hJ : TreeSequenceInitialSegment base.core + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := + initialFromSequence _ _ hseq.1 + rcases base.parallel hkind with ⟨chosen, hclosed, hunion⟩ + rcases hunion with ⟨union⟩ + have hpen : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) base.core := + union.leftSegment + have hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + base.core.length := hcoreStrict hkind + let corr := buildCorresponding base.core hpen hstrict hJ + refine ⟨base.core, corr, ?_, hJ, ?_⟩ + · simpa only [MaximumProperty] using hMP + · let baseJ : HierarchyBase corr.replacementETT phi := by + dsimp [corr] + exact { + core := base.core + closure := base.closure + supportPosition := base.supportPosition + supportPositive := base.supportPositive + terminalMissingColors := base.terminalMissingColors + parallel := base.parallel + nonparallel := base.nonparallel } + refine ⟨baseJ, rfl, rfl, ?_, ?_⟩ + · simp [baseJ] + · let KJ := buildHierarchy base.core corr baseJ hpen hstrict (by + simpa [baseJ] using (show TreeSequenceInitialSegment base.core base.core from + ⟨le_rfl, (fun i => rfl), (fun i => rfl)⟩)) (by rfl) + exact ⟨KJ, rfl, rfl, rfl, Or.inl ⟨hkind, rfl⟩⟩ + +private theorem helper_branch_346.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : MaximumProperty ett) (base : HierarchyBase ett phi), + let terminalIndex : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ (_ : ( + ∀ (A B : TreeSequence G e0) (_ : TashkinovAugmentationSequence phi A B), + TreeSequenceInitialSegment A B)) (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOneUncolored : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0) + (selfStable : + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (q : PartialEdgeColoring E k), StableColoring X + C q q), + let _ : (J : TreeSequence G e0) → TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) J → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + J.length → TreeSequenceInitialSegment J (ett.series.data.tree (Fin.last (ett.rounds + (1 : + ℕ)))) → CorrespondingExtendedTashkinovTree G k e0 ett phi J := @seedCorrespondingTree (@V) + (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@seriesProper) (@seriesOneUncolored) (@selfStable); + let _ : (J : TreeSequence G e0) → (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi J) + → (baseJ : HierarchyBase corr.replacementETT phi) → TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) J → (ett.series.data.tree (Fin.last + ett.rounds).castSucc).length < J.length → TreeSequenceInitialSegment baseJ.core J → + ett.series.data.tree (Fin.last ett.rounds).castSucc = corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc → TashkinovHierarchy corr.replacementETT + baseJ := @seedZeroDividerHierarchy (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett); + ∀ (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data i.castSucc) + (_ : ett.series.data.connectingEdges i.succ = { available.edge }) (_ : + ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) (adjoined : TreeSequence G + e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) available.edge + adjoined) (_ : TashkinovClosure (ett.series.data.coloring i.succ) adjoined + (ett.series.data.tree i.succ.succ)) (_ : terminalIndex = i.succ), + ∃ (J : TreeSequence G e0) (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett phi J), + MaximumProperty corrJ.replacementETT ∧ TreeSequenceInitialSegment J (ett.series.data.tree + (Fin.last (ett.rounds + (1 : ℕ)))) ∧ + ∃ (baseJ : HierarchyBase corrJ.replacementETT phi), baseJ.core = base.core ∧ baseJ.closure = + base.closure ∧ (↑baseJ.supportPosition : ℕ) = (↑base.supportPosition : ℕ) ∧ + ∃ (KJ : TashkinovHierarchy corrJ.replacementETT baseJ), KJ.dividerCount = (0 : ℕ) ∧ KJ.stage + (0 : Fin (KJ.dividerCount + (2 : ℕ))) = ett.series.data.tree (Fin.last + ett.rounds).castSucc ∧ KJ.stage (Fin.last (KJ.dividerCount + (1 : ℕ))) = J ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ J = + base.core ∨ (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges (Fin.last ett.rounds) = { f } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f J ∧ + TashkinovAugmentationSequence phi J (ett.series.data.tree (Fin.last (ett.rounds + (1 : + ℕ))))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP base terminalIndex initialFromSequence + seriesProper seriesOneUncolored selfStable buildCorresponding buildHierarchy i available + currentEdges currentKind adjoined adjoinedExactly closedExtension terminalEquality + have indexEquality : i.succ = Fin.last ett.rounds := by + apply Fin.ext + dsimp [terminalIndex] at terminalEquality + omega + have hkind : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE := by simpa [indexEquality] using currentKind + have hseq : TashkinovAugmentationSequence phi adjoined + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [ett.generatingColoring, indexEquality] using closedExtension.1 + have hJ : TreeSequenceInitialSegment adjoined + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := + initialFromSequence _ _ hseq + have hpen : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) adjoined := by + simpa [indexEquality] using adjoinedExactly.2.1 + have hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + adjoined.length := by + have hlen := adjoinedExactly.1 + have hlen' : adjoined.length = + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length + 1 := by + simpa [indexEquality] using hlen + omega + let corr := buildCorresponding adjoined hpen hstrict hJ + refine ⟨adjoined, corr, ?_, hJ, ?_⟩ + · simpa only [MaximumProperty] using hMP + · let baseJ : HierarchyBase corr.replacementETT phi := by + dsimp [corr] + exact { + core := base.core + closure := base.closure + supportPosition := base.supportPosition + supportPositive := base.supportPositive + terminalMissingColors := base.terminalMissingColors + parallel := base.parallel + nonparallel := base.nonparallel } + refine ⟨baseJ, rfl, rfl, ?_, ?_⟩ + · simp [baseJ] + · have hbase : base.core = + ett.series.data.tree (Fin.last ett.rounds).castSucc := + base.nonparallel (by simp [hkind]) + have hb : baseJ.core = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + dsimp [baseJ] + exact hbase + have hc : TreeSequenceInitialSegment baseJ.core adjoined := by + rw [hb] + exact hpen + let KJ := buildHierarchy adjoined corr baseJ hpen hstrict hc (by rfl) + exact ⟨KJ, rfl, rfl, rfl, + Or.inr ⟨Or.inr hkind, + ⟨available.edge, by simpa [indexEquality] using currentEdges, + (by simpa [indexEquality] using adjoinedExactly), hseq⟩⟩⟩ + +theorem AlgorithmFiveFiveSeed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (base : HierarchyBase ett phi) + (hcoreStrict : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + base.core.length) + (hcoreClosure : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + TashkinovClosure phi base.core + (ett.series.data.tree (Fin.last (ett.rounds + 1)))) : + ∃ (J : TreeSequence G e0) + (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett phi J), + MaximumProperty corrJ.replacementETT ∧ + TreeSequenceInitialSegment J + (ett.series.data.tree (Fin.last (ett.rounds + 1))) ∧ + ∃ baseJ : HierarchyBase corrJ.replacementETT phi, + baseJ.core = base.core ∧ + baseJ.closure = base.closure ∧ + baseJ.supportPosition.val = base.supportPosition.val ∧ + ∃ KJ : TashkinovHierarchy corrJ.replacementETT baseJ, + KJ.dividerCount = 0 ∧ + KJ.stage 0 = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + KJ.stage (Fin.last (KJ.dividerCount + 1)) = J ∧ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ + J = base.core) ∨ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ f : E, + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + f J ∧ + TashkinovAugmentationSequence phi J + (ett.series.data.tree (Fin.last (ett.rounds + 1))))) := by + let terminalIndex : Fin (ett.rounds + 1) := Fin.last ett.rounds + have terminal := ett.series.certified terminalIndex + generalize terminalEquality : terminalIndex = chosenIndex at terminal + have initialTrans : ∀ (A B C : TreeSequence G e0), + TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C → + TreeSequenceInitialSegment A C := by + intro A B C hab hbc + rcases hab with ⟨hab, hva, hea⟩ + rcases hbc with ⟨hbc, hvb, heb⟩ + refine ⟨Nat.le_trans hab hbc, ?_, ?_⟩ + · intro i + calc + C.vertex (Fin.castLE (Nat.succ_le_succ (Nat.le_trans hab hbc)) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hbc) + (Fin.castLE (Nat.succ_le_succ hab) i)) := by congr 1 + _ = B.vertex (Fin.castLE (Nat.succ_le_succ hab) i) := hvb _ + _ = A.vertex i := hva _ + · intro i + calc + C.edge (Fin.castLE (Nat.le_trans hab hbc) i) = + C.edge (Fin.castLE hbc (Fin.castLE hab i)) := by congr 1 + _ = B.edge (Fin.castLE hab i) := heb _ + _ = A.edge i := hea _ + have initialFromSequence : ∀ (A B : TreeSequence G e0), + TashkinovAugmentationSequence phi A B → + TreeSequenceInitialSegment A B := by + intro A B hseq + unfold TashkinovAugmentationSequence at hseq + induction hseq using Relation.ReflTransGen.head_induction_on with + | refl => + refine ⟨le_rfl, ?_, ?_⟩ + · intro i; rfl + · intro i; rfl + | head hstep htail ih => + rcases hstep with ⟨hlen, hseg, color, hcolor, hmiss⟩ + exact initialTrans _ _ _ hseg ih + have seriesProper : ∀ j : Fin (ett.rounds + 1), + IsProperEdgeColoring G (ett.series.data.coloring j) := by + intro j + have certificate := ett.series.certified j + cases certificate with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.1 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedProper + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact currentProper + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact previousProper + have seriesOneUncolored : ∀ j : Fin (ett.rounds + 1), + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + intro j + have certificate := ett.series.certified j + cases certificate with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.2 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedOneUncolored + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact currentOneUncolored + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact previousOneUncolored + have selfStable : ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) + (q : PartialEdgeColoring E k), StableColoring X C q q := by + intro X C q + exact ⟨fun f hf h => rfl, fun v hv => rfl⟩ + let buildCorresponding : + ∀ (J : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) J → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + J.length → TreeSequenceInitialSegment J (ett.series.data.tree (Fin.last (ett.rounds + 1))) + → CorrespondingExtendedTashkinovTree G k e0 ett phi J := @seedCorrespondingTree (@V) (@E) + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@seriesProper) (@seriesOneUncolored) (@selfStable) + let buildHierarchy := @seedZeroDividerHierarchy (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + cases terminal with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + have impossible : (0 : ℕ) < ett.rounds := ett.roundsPositive + dsimp [terminalIndex] at terminalEquality + have valueEquality := congrArg Fin.val terminalEquality + dsimp [terminalIndex] at valueEquality + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_246 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett hMP base initialFromSequence seriesProper seriesOneUncolored + selfStable i choice currentEdges currentKind adjoined adjoinedExactly + closedExtension terminalEquality + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact @helper_branch_303 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett hMP base hcoreStrict hcoreClosure initialFromSequence + seriesProper seriesOneUncolored selfStable i currentKind terminalEquality + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + exact @helper_branch_346 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett hMP base initialFromSequence seriesProper seriesOneUncolored + selfStable i available currentEdges currentKind adjoined adjoinedExactly + closedExtension terminalEquality +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AlgorithmFiveSixFixedRootRefresh.lean b/LeanPool/GoldbergSeymour/AlgorithmFiveSixFixedRootRefresh.lean new file mode 100644 index 0000000000..2e5ee2dd12 --- /dev/null +++ b/LeanPool/GoldbergSeymour/AlgorithmFiveSixFixedRootRefresh.lean @@ -0,0 +1,624 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StarredPrefixPreparation +public import LeanPool.GoldbergSeymour.NestedOddMissingPair +public import LeanPool.GoldbergSeymour.OneDividerRefresh + +/-! +# Algorithm Five Six Fixed Root Refresh + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hTnW_292.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (J W : TreeSequence G e0), + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ∀ (_ : TreeSequenceInitialSegment Tn J) (_ : TreeSequenceInitialSegment J W), + TreeSequenceInitialSegment Tn W := by + classical + intro V E _ _ _ G k e0 input T phi ett J W Tn hTnJ hJWsegment + refine ⟨hTnJ.1.trans hJWsegment.1, ?_, ?_⟩ + · intro i + exact (hJWsegment.2.1 (Fin.castLE (Nat.succ_le_succ hTnJ.1) i)).trans + (hTnJ.2.1 i) + · intro i + exact (hJWsegment.2.2 (Fin.castLE hTnJ.1 i)).trans (hTnJ.2.2 i) + +private theorem helper_hcarry_334.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : HierarchyBase ett phi) (U : TreeSequence G e0) (corrU : + CorrespondingExtendedTashkinovTree G k e0 ett phi U) (baseU : HierarchyBase + corrU.replacementETT phi) (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : + GoodHierarchy H) (W : TreeSequence G e0) (corrW : CorrespondingExtendedTashkinovTree G k + e0 ett phi W) (baseW : HierarchyBase corrW.replacementETT phi) (HW : TashkinovHierarchy + corrW.replacementETT baseW) (hcountW : HW.dividerCount = H.dividerCount + (1 : ℕ)) (V' : + TreeSequence G e0) (corrV : CorrespondingExtendedTashkinovTree G k e0 ett phi V') (baseV : + HierarchyBase corrV.replacementETT phi) (K : TashkinovHierarchy corrV.replacementETT + baseV) (hcount : K.dividerCount = HW.dividerCount) (_ : ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jo : Fin (HW.dividerCount + (1 : ℕ)) := Fin.cast ( + by omega + ) j; K.stage j.castSucc = HW.stage jo.castSucc ∧ HierarchyStarredStage K j = + HierarchyStarredStage HW jo ∧ HierarchyStoredColorsAt K j = HierarchyStoredColorsAt HW jo + ∧ HierarchyStageMissingColors K j = HierarchyStageMissingColors HW jo)) (j : Fin + (HW.dividerCount + (1 : ℕ))), K.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (K.dividerCount + (2 : ℕ))) = HW.stage j.castSucc ∧ HierarchyStarredStage K (⟨(↑j : + ℕ), + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStarredStage HW j ∧ HierarchyStoredColorsAt K + (⟨(↑j : ℕ), + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStoredColorsAt HW j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base U corrU baseU H good W corrW baseW HW hcountW V' + corrV baseV K hcount hstagesV j + have hh := hstagesV (⟨j.val, by omega⟩ : Fin (K.dividerCount + 1)) + dsimp only at hh + have hi : Fin.cast (congrArg (fun n : Nat => n + 1) hcount) + (⟨j.val, by omega⟩ : Fin (K.dividerCount + 1)) = j := Fin.ext rfl + rw [hi] at hh + exact ⟨hh.1, hh.2.1, hh.2.2.1⟩ + +private theorem helper_hprecedingV_354.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : HierarchyBase ett phi) (U : TreeSequence G e0) (corrU : + CorrespondingExtendedTashkinovTree G k e0 ett phi U) (baseU : HierarchyBase + corrU.replacementETT phi) (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : + GoodHierarchy H) (W : TreeSequence G e0) (corrW : CorrespondingExtendedTashkinovTree G k + e0 ett phi W) (baseW : HierarchyBase corrW.replacementETT phi) (HW : TashkinovHierarchy + corrW.replacementETT baseW) (hcountW : HW.dividerCount = H.dividerCount + (1 : ℕ)) (_ : + HW.stage (Fin.last HW.dividerCount).castSucc = U) (V' : TreeSequence G e0) (corrV : + CorrespondingExtendedTashkinovTree G k e0 ett phi V') (baseV : HierarchyBase + corrV.replacementETT phi) (K : TashkinovHierarchy corrV.replacementETT baseV) (hcount : + K.dividerCount = HW.dividerCount) (_ : ( + ∀ (j : Fin (HW.dividerCount + (1 : ℕ))), K.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (K.dividerCount + (2 : ℕ))) = HW.stage j.castSucc ∧ HierarchyStarredStage K (⟨(↑j : + ℕ), + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStarredStage HW j ∧ HierarchyStoredColorsAt K + (⟨(↑j : ℕ), + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStoredColorsAt HW j)) (_ : (⟨HW.dividerCount, + by omega + ⟩ : Fin (K.dividerCount + (2 : ℕ))) = (Fin.last K.dividerCount).castSucc), K.stage (Fin.last + K.dividerCount).castSucc = U := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base U corrU baseU H good W corrW baseW HW hcountW + hprecedingW V' corrV baseV K hcount hcarry hlastStageIndex + have hh := (hcarry (Fin.last HW.dividerCount)).1 + change K.stage ⟨HW.dividerCount, by omega⟩ = + HW.stage (Fin.last HW.dividerCount).castSucc at hh + rw [hlastStageIndex] at hh + exact hh.trans hprecedingW + +private theorem helper_hstarV_360.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : HierarchyBase ett phi) (U : TreeSequence G e0) (corrU : + CorrespondingExtendedTashkinovTree G k e0 ett phi U) (baseU : HierarchyBase + corrU.replacementETT phi) (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : + GoodHierarchy H) (W : TreeSequence G e0) (corrW : CorrespondingExtendedTashkinovTree G k + e0 ett phi W) (baseW : HierarchyBase corrW.replacementETT phi) (HW : TashkinovHierarchy + corrW.replacementETT baseW) (hcountW : HW.dividerCount = H.dividerCount + (1 : ℕ)) (_ : + HierarchyStarredStage HW (Fin.last HW.dividerCount) = U) (V' : TreeSequence G e0) (corrV : + CorrespondingExtendedTashkinovTree G k e0 ett phi V') (baseV : HierarchyBase + corrV.replacementETT phi) (K : TashkinovHierarchy corrV.replacementETT baseV) (hcount : + K.dividerCount = HW.dividerCount) (_ : ( + ∀ (j : Fin (HW.dividerCount + (1 : ℕ))), K.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (K.dividerCount + (2 : ℕ))) = HW.stage j.castSucc ∧ HierarchyStarredStage K (⟨(↑j : + ℕ), + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStarredStage HW j ∧ HierarchyStoredColorsAt K + (⟨(↑j : ℕ), + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStoredColorsAt HW j)) (_ : (⟨HW.dividerCount, + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = Fin.last K.dividerCount), HierarchyStarredStage K + (Fin.last K.dividerCount) = U := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base U corrU baseU H good W corrW baseW HW hcountW + hstarW V' corrV baseV K hcount hcarry hlastIndex + have hh := (hcarry (Fin.last HW.dividerCount)).2.1 + change HierarchyStarredStage K ⟨HW.dividerCount, by omega⟩ = + HierarchyStarredStage HW (Fin.last HW.dividerCount) at hh + rw [hlastIndex] at hh + exact hh.trans hstarW + +private theorem helper_hnewStoredV_366.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : HierarchyBase ett phi) (U : TreeSequence G e0) (corrU : + CorrespondingExtendedTashkinovTree G k e0 ett phi U) (baseU : HierarchyBase + corrU.replacementETT phi) (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : + GoodHierarchy H) (W : TreeSequence G e0) (corrW : CorrespondingExtendedTashkinovTree G k + e0 ett phi W) (baseW : HierarchyBase corrW.replacementETT phi) (HW : TashkinovHierarchy + corrW.replacementETT baseW) (hcountW : HW.dividerCount = H.dividerCount + (1 : ℕ)) (_ : + HierarchyStoredColorsAt HW (Fin.last HW.dividerCount) = HierarchyTerminalStoredColors H) + (V' : TreeSequence G e0) (corrV : CorrespondingExtendedTashkinovTree G k e0 ett phi V') + (baseV : HierarchyBase corrV.replacementETT phi) (K : TashkinovHierarchy + corrV.replacementETT baseV) (hcount : K.dividerCount = HW.dividerCount) (_ : ( + ∀ (j : Fin (HW.dividerCount + (1 : ℕ))), K.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (K.dividerCount + (2 : ℕ))) = HW.stage j.castSucc ∧ HierarchyStarredStage K (⟨(↑j : + ℕ), + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStarredStage HW j ∧ HierarchyStoredColorsAt K + (⟨(↑j : ℕ), + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStoredColorsAt HW j)) (_ : (⟨HW.dividerCount, + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = Fin.last K.dividerCount), HierarchyStoredColorsAt K + (Fin.last K.dividerCount) = HierarchyTerminalStoredColors H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base U corrU baseU H good W corrW baseW HW hcountW + hnewStoredW V' corrV baseV K hcount hcarry hlastIndex + have hh := (hcarry (Fin.last HW.dividerCount)).2.2 + change HierarchyStoredColorsAt K ⟨HW.dividerCount, by omega⟩ = + HierarchyStoredColorsAt HW (Fin.last HW.dividerCount) at hh + rw [hlastIndex] at hh + exact hh.trans hnewStoredW + +private theorem helper_branch_397.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : HierarchyBase ett phi) (U : TreeSequence G e0) (corrU : + CorrespondingExtendedTashkinovTree G k e0 ett phi U) (baseU : HierarchyBase + corrU.replacementETT phi) (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : + GoodHierarchy H) (W : TreeSequence G e0) (corrW : CorrespondingExtendedTashkinovTree G k + e0 ett phi W) (baseW : HierarchyBase corrW.replacementETT phi) (HW : TashkinovHierarchy + corrW.replacementETT baseW) (hcountW : HW.dividerCount = H.dividerCount + (1 : ℕ)) (_ : ( + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), HW.stage (Fin.castLE ( + by omega + ) j) = H.stage j)) (V' : TreeSequence G e0) (corrV : CorrespondingExtendedTashkinovTree G k e0 + ett phi V') (baseV : HierarchyBase corrV.replacementETT phi) (K : TashkinovHierarchy + corrV.replacementETT baseV) (hcount : K.dividerCount = HW.dividerCount) (_ : + K.dividerCount = H.dividerCount + (1 : ℕ)) (_ : ( + ∀ (j : Fin (HW.dividerCount + (1 : ℕ))), K.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (K.dividerCount + (2 : ℕ))) = HW.stage j.castSucc ∧ HierarchyStarredStage K (⟨(↑j : + ℕ), + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStarredStage HW j ∧ HierarchyStoredColorsAt K + (⟨(↑j : ℕ), + by omega + ⟩ : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStoredColorsAt HW j)) (j : Fin (H.dividerCount + + (2 : ℕ))), K.stage (Fin.castLE ( + by omega + ) j) = H.stage j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base U corrU baseU H good W corrW baseW HW hcountW + hstagesW V' corrV baseV K hcount hcountV hcarry j + have hh := (hcarry (⟨j.val, by omega⟩ : Fin (HW.dividerCount + 1))).1 + calc + K.stage (Fin.castLE (by omega) j) = + HW.stage (Fin.castLE (by omega) j) := by + convert hh using 1 <;> congr 1 + _ = H.stage j := hstagesW j + +private theorem helper_branch_404.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : HierarchyBase ett phi) (U : TreeSequence G e0) (corrU : + CorrespondingExtendedTashkinovTree G k e0 ett phi U) (baseU : HierarchyBase + corrU.replacementETT phi) (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : + GoodHierarchy H) (W : TreeSequence G e0) (corrW : CorrespondingExtendedTashkinovTree G k + e0 ett phi W) (baseW : HierarchyBase corrW.replacementETT phi) (HW : TashkinovHierarchy + corrW.replacementETT baseW) (hcountW : HW.dividerCount = H.dividerCount + (1 : ℕ)) (_ : ( + ∀ (i : Fin H.dividerCount), (↑(HW.dividerPosition (Fin.castLE ( + by omega + ) i)) : ℕ) = (↑(H.dividerPosition i) : ℕ))) (V' : TreeSequence G e0) (corrV : + CorrespondingExtendedTashkinovTree G k e0 ett phi V') (baseV : HierarchyBase + corrV.replacementETT phi) (K : TashkinovHierarchy corrV.replacementETT baseV) (hcount : + K.dividerCount = HW.dividerCount) (_ : ( + ∀ (i : Fin K.dividerCount), (↑(K.dividerPosition i) : ℕ) = (↑(HW.dividerPosition (Fin.cast + hcount i)) : ℕ))) (_ : K.dividerCount = H.dividerCount + (1 : ℕ)) (i : Fin + H.dividerCount), (↑(K.dividerPosition (Fin.castLE ( + by omega + ) i)) : ℕ) = (↑(H.dividerPosition i) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base U corrU baseU H good W corrW baseW HW hcountW + hdividersW V' corrV baseV K hcount hdividersV hcountV i + have hh := hdividersV (Fin.castLE (by omega) i) + have hi : Fin.cast hcount (Fin.castLE (by omega) i) = + Fin.castLE (by omega) i := Fin.ext rfl + rw [hi] at hh + exact hh.trans (hdividersW i) + +private theorem helper_branch_410.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 + ett phi U) (baseU : HierarchyBase corrU.replacementETT phi) (H : TashkinovHierarchy + corrU.replacementETT baseU) (W : TreeSequence G e0) (corrW : + CorrespondingExtendedTashkinovTree G k e0 ett phi W) (baseW : HierarchyBase + corrW.replacementETT phi) (HW : TashkinovHierarchy corrW.replacementETT baseW) (hcountW : + HW.dividerCount = H.dividerCount + (1 : ℕ)) (_ : (↑(HW.dividerPosition (Fin.cast ( + by omega + ) (Fin.last H.dividerCount))) : ℕ) = U.length) (V' : TreeSequence G e0) (corrV : + CorrespondingExtendedTashkinovTree G k e0 ett phi V') (baseV : HierarchyBase + corrV.replacementETT phi) (K : TashkinovHierarchy corrV.replacementETT baseV) (hcount : + K.dividerCount = HW.dividerCount) (_ : ( + ∀ (i : Fin K.dividerCount), (↑(K.dividerPosition i) : ℕ) = (↑(HW.dividerPosition (Fin.cast + hcount i)) : ℕ))) (_ : K.dividerCount = H.dividerCount + (1 : ℕ)), (↑(K.dividerPosition + (Fin.cast ( + by omega + ) (Fin.last H.dividerCount))) : ℕ) = U.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett U corrU baseU H W corrW baseW HW hcountW hnewDividerW + V' corrV baseV K hcount hdividersV hcountV + have hh := hdividersV (Fin.cast hcountV.symm (Fin.last H.dividerCount)) + have hi : Fin.cast hcount (Fin.cast hcountV.symm (Fin.last H.dividerCount)) = + Fin.cast hcountW.symm (Fin.last H.dividerCount) := Fin.ext rfl + rw [hi] at hh + exact hh.trans hnewDividerW + +theorem AlgorithmFiveSixFixedRootRefresh + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (ctx : TechnicalInductionContext G k e0 ett.rounds) + (hMP : MaximumProperty ett) + (base : HierarchyBase ett phi) + (hdegree : MaximumDegree G + 1 <= k) + (hlargeOrder : 11 <= TashkinovOrder G) + (hmissingBound : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = ett.rounds -> MaximumProperty current -> + forall (base' : HierarchyBase current generating') + (K : TashkinovHierarchy current base'), + GoodHierarchy K -> + 2 * current.rounds + 11 ≤ + (TreeMissingColors generating' + (current.series.data.tree + ((Fin.last current.rounds : Fin (current.rounds + 1))).castSucc)).card) + (U : TreeSequence G e0) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (hMPU : MaximumProperty corrU.replacementETT) + (baseU : HierarchyBase corrU.replacementETT phi) + (hbaseCore : baseU.core = base.core) + (hbaseClosure : baseU.closure = base.closure) + (_ : baseU.supportPosition.val = base.supportPosition.val) + (H : TashkinovHierarchy corrU.replacementETT baseU) + (good : GoodHierarchy H) + (hminus : TreeColorSetMinusClosed G phi U + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (hnotClosed : ¬ TreeColorSetClosed G phi U (TreeMissingColors phi U)) + (J : TreeSequence G e0) + (hanchor : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE /\ J = base.core /\ + TashkinovAugmentationSequence phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) J) \/ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE \/ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) /\ + exists f0 : E, + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f0} /\ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f0 J)) + (hanchorStrict : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE -> base.core.length < U.length) /\ + (ett.series.data.kind (Fin.last ett.rounds) != + some TashkinovExtensionKind.PE -> + (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length < U.length)) + (hroute : TashkinovAugmentationSequence phi J U) : + exists (alpha beta eta gammaOne gammaTwo : Fin k) (f : E) (W : TreeSequence G e0), + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) : + TreeSequence G e0)) ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet U) ∧ + ((HierarchyStarredStage H (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) : + TreeSequence G e0)).length < + U.length ∧ + Odd + (TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) : + TreeSequence G e0)).card ∧ + Odd (TreeSequenceVertexSet U).card ∧ + alpha ∈ + TreeMissingColors phi U \ + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount : Fin (H.dividerCount + 1))) : + Finset (Fin k)) ∧ + TreeColorSetClosed G phi U { alpha } ∧ + beta ∈ TreeMissingColors phi U ∧ + beta ∈ + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount : Fin (H.dividerCount + 1))) : + Finset (Fin k)) ∧ + eta ∈ HierarchyTerminalStoredColors H ∧ + beta ∈ good.gamma (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) eta ∧ + (∀ theta : Fin k, + theta ∈ HierarchyTerminalStoredColors H → + beta ∈ good.gamma (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) theta → + theta = eta) ∧ + f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet U) beta ∧ + phi f = some beta ∧ + TreeSequenceAdjoinEdge U f W ∧ + TashkinovAugmentation phi U W ∧ + gammaOne != gammaTwo ∧ + gammaOne ∈ + (TreeSequenceVertexSet U \ + TreeSequenceVertexSet + (HierarchyStarredStage H + (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) : + TreeSequence G e0)).biUnion + (MissingColors G phi) ∧ + gammaTwo ∈ + (TreeSequenceVertexSet U \ + TreeSequenceVertexSet + (HierarchyStarredStage H + (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) : + TreeSequence G e0)).biUnion + (MissingColors G phi) ∧ + Disjoint { gammaOne, gammaTwo } + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount : Fin (H.dividerCount + 1))) : + Finset (Fin k)) ∧ + beta ∉ ({ gammaOne, gammaTwo } : Finset (Fin k)) ∧ + exists (corrW : CorrespondingExtendedTashkinovTree G k e0 ett phi W), + MaximumProperty corrW.replacementETT ∧ + TashkinovAugmentationSequence phi J W ∧ + exists baseW : HierarchyBase corrW.replacementETT phi, + baseW.core = base.core ∧ + baseW.closure = base.closure ∧ + baseW.supportPosition.val = base.supportPosition.val ∧ + exists HW : TashkinovHierarchy corrW.replacementETT baseW, + exists hcountW : HW.dividerCount = H.dividerCount + 1, + (∀ j : Fin (H.dividerCount + 2), HW.stage (Fin.castLE (by omega) j) = H.stage j) ∧ + HW.stage (Fin.last HW.dividerCount).castSucc = U ∧ + HierarchyStarredStage HW (Fin.last HW.dividerCount) = U ∧ + HW.stage (Fin.last HW.dividerCount).succ = W ∧ + (∀ i : Fin H.dividerCount, + (HW.dividerPosition (Fin.castLE (by omega) i)).val = (H.dividerPosition i).val) ∧ + (HW.dividerPosition (Fin.cast hcountW.symm (Fin.last H.dividerCount))).val = U.length ∧ + (∀ j : Fin (H.dividerCount + 1), + HierarchyStoredColorsAt HW (Fin.castLE (by omega) j) = + HierarchyStoredColorsAt H j) ∧ + HierarchyStoredColorsAt HW (Fin.last HW.dividerCount) = + HierarchyTerminalStoredColors H ∧ + exists goodW : GoodHierarchy HW, + (∀ j : Fin (H.dividerCount + 1), + ∀ theta : Fin k, goodW.gamma (Fin.castLE (by omega) j) theta = good.gamma j theta) ∧ + goodW.gamma (Fin.last HW.dividerCount) eta = { gammaOne, gammaTwo } ∧ + (∀ theta : Fin k, + theta ∈ HierarchyTerminalStoredColors H → + theta != eta → + goodW.gamma (Fin.last HW.dividerCount) theta = + good.gamma (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) theta) ∧ + exists (V' : TreeSequence G e0) (corrV : + CorrespondingExtendedTashkinovTree G k e0 ett phi V'), + MaximumProperty corrV.replacementETT ∧ + U.length < V'.length ∧ + TashkinovAugmentationSequence phi J V' ∧ + exists baseV : HierarchyBase corrV.replacementETT phi, + baseV.core = base.core ∧ + baseV.closure = base.closure ∧ + baseV.supportPosition.val = base.supportPosition.val ∧ + exists K : TashkinovHierarchy corrV.replacementETT baseV, + exists hcountV : K.dividerCount = H.dividerCount + 1, + (∀ j : Fin (H.dividerCount + 2), K.stage (Fin.castLE (by omega) j) = H.stage j) ∧ + K.stage (Fin.last K.dividerCount).castSucc = U ∧ + HierarchyStarredStage K (Fin.last K.dividerCount) = U ∧ + K.stage (Fin.last K.dividerCount).succ = V' ∧ + (∀ i : Fin H.dividerCount, + (K.dividerPosition (Fin.castLE (by omega) i)).val = (H.dividerPosition i).val) ∧ + (K.dividerPosition (Fin.cast hcountV.symm (Fin.last H.dividerCount))).val = U.length ∧ + (∀ j : Fin (H.dividerCount + 1), + HierarchyStoredColorsAt K (Fin.castLE (by omega) j) = HierarchyStoredColorsAt H j) ∧ + HierarchyStoredColorsAt K (Fin.last K.dividerCount) = HierarchyTerminalStoredColors H ∧ + exists goodV : GoodHierarchy K, + (∀ j : Fin (H.dividerCount + 1), + ∀ theta : Fin k, goodV.gamma (Fin.castLE (by omega) j) theta = good.gamma j theta) ∧ + goodV.gamma (Fin.last K.dividerCount) eta = { gammaOne, gammaTwo } ∧ + (∀ theta : Fin k, + theta ∈ HierarchyTerminalStoredColors H → + theta != eta → + goodV.gamma (Fin.last K.dividerCount) theta = + good.gamma (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) theta) ∧ + TreeColorSetMinusClosed G phi V' + ((HierarchyTerminalStoredColors K).biUnion (goodV.gamma (Fin.last K.dividerCount))) := by + classical + let lastH : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H lastH + let Dplus := HierarchyTerminalStoredColors H + have hstrict : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE -> base.core.length < U.length) ∧ + (ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE -> + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < U.length) := by + simpa only [bne_iff_ne] using hanchorStrict + obtain ⟨hproper, hone, helemA, helemU, hAU, hAUstrict, hoddA, hgap⟩ := + P2940_T1_StarredPrefixPreparation G k e0 input T phi ett ctx hMP base + hdegree hlargeOrder hmissingBound U corrU hMPU baseU hbaseCore H good hstrict + have hDsub : Dplus ⊆ HierarchyStoredColorsAt H lastH := + (HierarchyTerminalStoredColorsSubsetLast H).1 + have hreserved : forall eta, eta ∈ Dplus -> + good.gamma lastH eta ⊆ TreeMissingColors phi A := by + intro eta heta + exact (GoodHierarchyReservedDisjoint good lastH).1 eta (hDsub heta) + obtain ⟨alpha, beta, eta, gammaOne, gammaTwo, f, W, hoddU, halpha, + halphaClosed, hbeta, hbetaReserved, heta, hbetaEta, howner, hf, + hfc, hadjoin, haug, hne, hg1, hg2, hfresh, hbetaPair⟩ := + P2940_T1_NestedOddMissingPair G k e0 phi A U hproper helemU hAU hAUstrict + hoddA hdegree Dplus (good.gamma lastH) hreserved + (fun a b ha hb hab => good.disjointPairs lastH a b + (hDsub ha) (hDsub hb) hab) hgap hminus hnotClosed + have hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) phi := by + rw [← ett.generatingColoring] + exact (sc2 G e0 _ _).refl ⟨phi, hproper, hone⟩ + have hmod : ModColoring ett phi := + ctx.currentSix ett rfl hMP phi hproper hone hstable + have hUW : TashkinovAugmentationSequence phi U W := + Relation.ReflTransGen.single haug + have hJW : TashkinovAugmentationSequence phi J W := hroute.trans hUW + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + have hTnJ : TreeSequenceInitialSegment Tn J := by + rcases hanchor with hPE | hnonPE + · exact TashkinovAugmentationSequenceInitialSegment phi Tn J hPE.2.2 + · obtain ⟨_, f0, _, hadjoinJ⟩ := hnonPE + exact hadjoinJ.2.1 + have hJWsegment := TashkinovAugmentationSequenceInitialSegment phi J W hJW + have hTnW := + @helper_hTnW_292 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@J) (@W) (@hTnJ) (@hJWsegment) + have hTnStrictW : Tn.length < W.length := by + have hTnLeJ := hTnJ.1 + have hJLeU := (TashkinovAugmentationSequenceInitialSegment phi J U hroute).1 + have hlengthW := hadjoin.1 + omega + have heligibleW : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence phi Tn W) ∨ + ((ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + exists (f0 : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f0} ∧ + TreeSequenceAdjoinEdge Tn f0 seed ∧ TashkinovAugmentationSequence phi seed W) := by + rcases hanchor with hPE | hnonPE + · exact Or.inl ⟨hPE.1, hPE.2.2.trans hJW⟩ + · obtain ⟨hkind, f0, hedges, hadjoinJ⟩ := hnonPE + exact Or.inr ⟨hkind, f0, J, hedges, hadjoinJ, hJW⟩ + obtain ⟨corrW⟩ := hmod.2.2 W hTnW hTnStrictW heligibleW + have hMPW := MaximumPropertyTransport G k e0 ett phi hmod W corrW hMP + obtain ⟨baseW, hcoreW, hclosureW, hsupportW⟩ := + HierarchyBaseCorrespondingTransport G k e0 input T W phi ett corrW base + obtain ⟨HW, hcountW, hstagesW, hprecedingW, hstarW, hterminalW, + hdividersW, hnewDividerW, hstoredW, hnewStoredW, goodW, + hgammaW, hrefreshW, hcopiedW⟩ := + P2940_T1_OneDividerRefresh G k e0 input T phi ett U W corrU corrW baseU baseW + (hcoreW.trans hbaseCore.symm) (hclosureW.trans hbaseClosure.symm) H good + helemU eta beta gammaOne gammaTwo f heta hbetaEta hfc hadjoin hne hg1 hg2 + hfresh hminus + obtain ⟨m, chain, V', hfirst, hlast, hsteps, hlengths, hsegments, + hvertices, hWV, havoid, hmaximal, corrV, hMPV, baseV, hcoreV, + hclosureV, hsupportV, K, hcount, hstagesV, hdividersV, goodV, + hgammaV, hterminalStoredV, hminusV⟩ := + GoodHierarchyRestrictedAugmentation G k e0 input T phi phi ett hmod hMP + W corrW baseW HW goodW + have hcountV : K.dividerCount = H.dividerCount + 1 := hcount.trans hcountW + have hcarry := @helper_hcarry_334 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@U) (@corrU) (@baseU) (@H) + (@good) (@W) (@corrW) (@baseW) (@HW) (@hcountW) (@V') (@corrV) (@baseV) (@K) (@hcount) + (@hstagesV) + have hcarryGamma (j : Fin (HW.dividerCount + 1)) (theta : Fin k) : + goodV.gamma ⟨j.val, by omega⟩ theta = goodW.gamma j theta := by + have hh := hgammaV (⟨j.val, by omega⟩ : Fin (K.dividerCount + 1)) theta + have hi : Fin.cast (congrArg (fun n : Nat => n + 1) hcount) + (⟨j.val, by omega⟩ : Fin (K.dividerCount + 1)) = j := Fin.ext rfl + rwa [hi] at hh + have hlastIndex : (⟨HW.dividerCount, by omega⟩ : Fin (K.dividerCount + 1)) = + Fin.last K.dividerCount := Fin.ext (by simpa using hcount.symm) + have hlastStageIndex : (⟨HW.dividerCount, by omega⟩ : Fin (K.dividerCount + 2)) = + (Fin.last K.dividerCount).castSucc := Fin.ext (by simpa using hcount.symm) + have hprecedingV := + @helper_hprecedingV_354 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@U) (@corrU) (@baseU) (@H) (@good) + (@W) (@corrW) (@baseW) (@HW) (@hcountW) (@hprecedingW) (@V') (@corrV) (@baseV) (@K) + (@hcount) (@hcarry) (@hlastStageIndex) + have hstarV := + @helper_hstarV_360 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@U) (@corrU) (@baseU) (@H) (@good) (@W) + (@corrW) (@baseW) (@HW) (@hcountW) (@hstarW) (@V') (@corrV) (@baseV) (@K) (@hcount) + (@hcarry) (@hlastIndex) + have hnewStoredV := + @helper_hnewStoredV_366 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@U) (@corrU) (@baseU) (@H) (@good) + (@W) (@corrW) (@baseW) (@HW) (@hcountW) (@hnewStoredW) (@V') (@corrV) (@baseV) (@K) + (@hcount) (@hcarry) (@hlastIndex) + have hlastGamma (theta : Fin k) : goodV.gamma (Fin.last K.dividerCount) theta = + goodW.gamma (Fin.last HW.dividerCount) theta := by + have hh := hcarryGamma (Fin.last HW.dividerCount) theta + change goodV.gamma ⟨HW.dividerCount, by omega⟩ theta = + goodW.gamma (Fin.last HW.dividerCount) theta at hh + rwa [hlastIndex] at hh + have hstrictV : U.length < V'.length := by + have hlen := hadjoin.1 + have hinit := TashkinovAugmentationSequenceInitialSegment phi W V' hWV + have hle := hinit.1 + omega + refine ⟨alpha, beta, eta, gammaOne, gammaTwo, f, W, helemA, helemU, + hAUstrict, hoddA, hoddU, halpha, halphaClosed, hbeta, hbetaReserved, + heta, hbetaEta, howner, hf, hfc, hadjoin, haug, ?_, hg1, hg2, hfresh, + hbetaPair, corrW, hMPW, hJW, baseW, hcoreW, hclosureW, hsupportW, + HW, hcountW, hstagesW, hprecedingW, hstarW, hterminalW, hdividersW, + hnewDividerW, hstoredW, hnewStoredW, goodW, hgammaW, hrefreshW, ?_, + V', corrV, hMPV, hstrictV, hJW.trans hWV, baseV, hcoreV.trans hcoreW, + hclosureV.trans hclosureW, hsupportV.trans hsupportW, K, hcountV, + ?_, hprecedingV, hstarV, K.terminalStage, ?_, ?_, ?_, hnewStoredV, + goodV, ?_, (hlastGamma eta).trans hrefreshW, ?_, hminusV⟩ + · simpa only [bne_iff_ne] using hne + · intro theta htheta hthetaNe + exact hcopiedW theta htheta (by simpa only [bne_iff_ne] using hthetaNe) + · exact @helper_branch_397 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@U) (@corrU) (@baseU) (@H) (@good) + (@W) (@corrW) (@baseW) (@HW) (@hcountW) (@hstagesW) (@V') (@corrV) (@baseV) (@K) (@hcount) + (@hcountV) (@hcarry) + · exact @helper_branch_404 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@U) (@corrU) (@baseU) (@H) (@good) + (@W) (@corrW) (@baseW) (@HW) (@hcountW) (@hdividersW) (@V') (@corrV) (@baseV) (@K) + (@hcount) (@hdividersV) (@hcountV) + · exact @helper_branch_410 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@U) (@corrU) (@baseU) (@H) (@W) (@corrW) + (@baseW) (@HW) (@hcountW) (@hnewDividerW) (@V') (@corrV) (@baseV) (@K) (@hcount) + (@hdividersV) (@hcountV) + · intro j + have hh := (hcarry (Fin.castLE (by omega) j)).2.2 + exact hh.trans (hstoredW j) + · intro j theta + exact (hcarryGamma (Fin.castLE (by omega) j) theta).trans (hgammaW j theta) + · intro theta htheta hthetaNe + exact (hlastGamma theta).trans + (hcopiedW theta htheta (by simpa only [bne_iff_ne] using hthetaNe)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AlgorithmThreeOneChoiceDataExists.lean b/LeanPool/GoldbergSeymour/AlgorithmThreeOneChoiceDataExists.lean new file mode 100644 index 0000000000..95a10cdc36 --- /dev/null +++ b/LeanPool/GoldbergSeymour/AlgorithmThreeOneChoiceDataExists.lean @@ -0,0 +1,158 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableColoringExitExtension + +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoiceExists + +public import LeanPool.GoldbergSeymour.ParallelExtensionColorExists + +/-! +# Algorithm Three One Choice Data Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem AlgorithmThreeOneChoiceDataExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : Nat) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) + (i : Fin (rounds + 1)) + (hdegree : MaximumDegree G + 1 ≤ k) + (hproper : IsProperEdgeColoring G (series.data.coloring i)) + (hone : IsOneEdgeUncolored (series.data.coloring i) e0) + (hclosed : ColoredVertexSetClosed G (series.data.coloring i) + (TreeSequenceVertexSet (series.data.tree i.succ))) + (hnotStrong : ¬ ColoredVertexSetStronglyClosed G + (series.data.coloring i) + (TreeSequenceVertexSet (series.data.tree i.succ))) : + Nonempty (RevisitingExtensionCertificate series.data i) ∨ + (¬ Nonempty (RevisitingExtensionCertificate series.data i) ∧ + exists choice : MaximumDefectiveChoice G e0 (series.data.tree i.succ) + (TashkinovStoredColors series.data i) (series.data.coloring i), + forall pi : PartialEdgeColoring E k, + IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (series.data.tree i.succ) + (insert choice.color (TashkinovStoredColors series.data i)) + choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (series.data.tree i.succ))) ∨ + (¬ Nonempty (RevisitingExtensionCertificate series.data i) ∧ + exists choice : MaximumDefectiveChoice G e0 (series.data.tree i.succ) + (TashkinovStoredColors series.data i) (series.data.coloring i), + (exists rho : PartialEdgeColoring E k, + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (series.data.tree i.succ) + (insert choice.color (TashkinovStoredColors series.data i)) + choice.selected rho ∧ + ¬ Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (series.data.tree i.succ))) ∧ + exists gamma : Fin k, + ParallelExtensionColor series.data i choice.selected + choice.vertex gamma ∧ + exists sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ + StableColoring (series.data.tree i.succ) + (insert choice.color (TashkinovStoredColors series.data i)) + choice.selected sigma ∧ + TreeExit (series.data.tree i.succ) sigma gamma choice.color + choice.vertex) := by + classical + by_cases revisiting : Nonempty (RevisitingExtensionCertificate series.data i) + · exact Or.inl revisiting + · right + obtain ⟨choice⟩ := MaximumDefectiveChoiceExists G e0 + (series.data.tree i.succ) (TashkinovStoredColors series.data i) + (series.data.coloring i) hproper hone hclosed hnotStrong + by_cases seriesCase : forall pi : PartialEdgeColoring E k, + IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (series.data.tree i.succ) + (insert choice.color (TashkinovStoredColors series.data i)) + choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (series.data.tree i.succ)) + · exact Or.inl ⟨revisiting, choice, seriesCase⟩ + · right + have failure : exists rho : PartialEdgeColoring E k, + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (series.data.tree i.succ) + (insert choice.color (TashkinovStoredColors series.data i)) + choice.selected rho ∧ + ¬ Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (series.data.tree i.succ)) := by + push Not at seriesCase + exact seriesCase + obtain ⟨gamma, gammaRule⟩ := ParallelExtensionColorExists G k rounds + e0 input series i choice hdegree + have edgeBoundary : choice.edge ∈ BoundaryEdges G + (TreeSequenceVertexSet (series.data.tree i.succ)) := by + rcases choice.edgeDefective with ⟨color, _, hmem⟩ + exact (Finset.mem_filter.mp hmem).1 + have boundaryIncident : forall f : E, + f ∈ BoundaryEdges G (TreeSequenceVertexSet (series.data.tree i.succ)) → + TreeIncidentEdge (series.data.tree i.succ) f := by + intro f hf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hf + obtain ⟨v, hv, u, hu, hends⟩ := hf + exact ⟨v, hv, by change v ∈ G.ends f; rw [hends]; simp⟩ + have selectedClosed : ColoredVertexSetClosed G choice.selected + (TreeSequenceVertexSet (series.data.tree i.succ)) := by + intro f color v hf hv hfcolor hmissing + have oldMissing : color ∈ MissingColors G (series.data.coloring i) v := by + rw [← choice.selectedStable.2 v hv] + exact hmissing + have oldTreeMissing : color ∈ + TreeMissingColors (series.data.coloring i) (series.data.tree i.succ) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, oldMissing⟩ + have fixed := (sc1 G e0 (series.data.tree i.succ) + (TashkinovStoredColors series.data i) (series.data.coloring i) + choice.selected hproper hone choice.selectedProper + choice.selectedOneUncolored).mp choice.selectedStable f + (boundaryIncident f hf) + (Or.inr ⟨color, Finset.mem_union_left _ oldTreeMissing, hfcolor⟩) + have oldColor : series.data.coloring i f = some color := by + rw [← fixed] + exact hfcolor + exact (hclosed hf hv oldColor) oldMissing + have commonMissing : exists rho : PartialEdgeColoring E k, + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (series.data.tree i.succ) + (insert choice.color (TashkinovStoredColors series.data i)) + choice.selected rho ∧ + exists beta, beta ∈ MissingColors G rho choice.otherEndpoint ∧ + beta ∈ TreeMissingColors rho (series.data.tree i.succ) := by + obtain ⟨rho, rhoProper, rhoOne, rhoStable, rhoNonDisjoint⟩ := failure + rw [Finset.not_disjoint_iff] at rhoNonDisjoint + obtain ⟨beta, betaOutside, betaTree⟩ := rhoNonDisjoint + exact ⟨rho, rhoProper, rhoOne, rhoStable, beta, betaOutside, betaTree⟩ + have orientedEnds : G.ends choice.edge = + s(choice.otherEndpoint, choice.vertex) := by + exact choice.edgeEnds.trans Sym2.eq_swap + obtain ⟨sigma, sigmaProper, sigmaOne, sigmaStable, sigmaExit⟩ := + LEM_extable G k e0 choice.edge (series.data.tree i.succ) + (TashkinovStoredColors series.data i) choice.selected + choice.otherEndpoint choice.vertex choice.color hdegree + choice.selectedProper choice.selectedOneUncolored selectedClosed + edgeBoundary orientedEnds choice.otherOutside choice.vertexDefective.1 + choice.edgeColor commonMissing gamma gammaRule.1 + exact ⟨revisiting, choice, failure, gamma, gammaRule, sigma, + sigmaProper, sigmaOne, sigmaStable, sigmaExit⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AlgorithmThreeOneInitialSeriesExists.lean b/LeanPool/GoldbergSeymour/AlgorithmThreeOneInitialSeriesExists.lean new file mode 100644 index 0000000000..62e3d10018 --- /dev/null +++ b/LeanPool/GoldbergSeymour/AlgorithmThreeOneInitialSeriesExists.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GlobalMaximumTripleExists +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovTreeFromLengthOnePrefix + +/-! +# Algorithm Three One Initial Series Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem AlgorithmThreeOneInitialSeriesExists + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) + (hcritical : Critical G) (hindex : ChromaticIndex G = k + 1) + (hdegree : MaximumDegree G + 1 <= k) : + exists (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (series : TashkinovSeries G k 0 e0 phi), + GlobalMaximumTriple G k e0 phi T ∧ + series.data.tree 0 = TreeSequencePrefix T 1 (by omega) T.positive ∧ + series.data.tree 1 = T ∧ + series.data.coloring 0 = phi ∧ + series.data.stored 0 = ∅ ∧ + series.data.connectingEdges 0 = ∅ ∧ + series.data.kind 0 = none ∧ + series.data.chosenVertex 0 = none ∧ + series.data.outsideVertex 0 = none ∧ + series.data.delta 0 = none ∧ + series.data.gamma 0 = none ∧ + (TreeSequenceVertexSet (series.data.tree 1)).card = TashkinovOrder G ∧ + 3 <= (TreeSequenceVertexSet (series.data.tree 1)).card ∧ + Odd (TreeSequenceVertexSet (series.data.tree 1)).card ∧ + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (series.data.tree 1)) ∧ + ColoredVertexSetClosed G phi + (TreeSequenceVertexSet (series.data.tree 1)) := by + classical + obtain ⟨e0, phi, T, hglobal⟩ := + GlobalMaximumTripleExists G k hcritical hindex hdegree + let seed := TreeSequencePrefix T 1 (by omega) T.positive + have hroute : TashkinovAugmentationSequence phi seed T := by + exact TashkinovTreeFromLengthOnePrefix phi T hglobal.2.1 + have hfacts := ScheideGlobalMaximumOrder G k e0 phi T hglobal + let data : TashkinovSeriesData G k 0 e0 := { + tree := Fin.cases seed (fun _ => T) + coloring := fun _ => phi + stored := fun _ => ∅ + connectingEdges := fun _ => ∅ + kind := fun _ => none + chosenVertex := fun _ => none + outsideVertex := fun _ => none + delta := fun _ => none + gamma := fun _ => none } + have dataTreeZero : data.tree 0 = seed := by + rfl + have dataTreeOne : data.tree 1 = T := by + rfl + let series : TashkinovSeries G k 0 e0 phi := { + data := data + certified := by + intro i + have hi : i = 0 := by + apply Fin.ext + omega + subst i + apply TashkinovSeriesStep.initial hglobal.1 + · simp [data, seed, TreeSequencePrefix] + · simp [data] + · simp [data] + · simp [data] + · simp [data] + · simp [data] + · simp [data] + · simp [data] + · simp [data] + · rw [dataTreeZero, dataTreeOne] + exact ⟨hroute, hfacts.2.2.2.2⟩ } + have seriesTreeOne : series.data.tree 1 = T := by + simpa [series] using dataTreeOne + refine ⟨e0, phi, T, series, hglobal, ?_⟩ + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · simpa [series, seed] using dataTreeZero + · simpa [series] using dataTreeOne + · rfl + · rfl + · rfl + · rfl + · rfl + · rfl + · rfl + · rfl + · rw [seriesTreeOne] + exact hfacts.1.symm + · rw [seriesTreeOne] + exact hfacts.2.1 + · rw [seriesTreeOne] + exact hfacts.2.2.1 + · rw [seriesTreeOne] + exact hfacts.2.2.2.1 + · rw [seriesTreeOne] + exact hfacts.2.2.2.2 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/AlgorithmThreeOneStepExists.lean b/LeanPool/GoldbergSeymour/AlgorithmThreeOneStepExists.lean new file mode 100644 index 0000000000..4ec04618ad --- /dev/null +++ b/LeanPool/GoldbergSeymour/AlgorithmThreeOneStepExists.lean @@ -0,0 +1,1073 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AlgorithmThreeOneChoiceDataExists + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovClosureExists +public import LeanPool.GoldbergSeymour.TashkinovSeriesAppend + +public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Algorithm Three One Step Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_branch_102.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (_ : series.data.tree (Fin.last rounds : Fin + (rounds + (1 : ℕ))).succ = series.data.tree (Fin.last (rounds + (1 : ℕ)))) (_ : + IsProperEdgeColoring G (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ))))) + (_ : IsOneEdgeUncolored (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ)))) + e0) (_ : ColoredVertexSetClosed G (series.data.coloring (Fin.last rounds : Fin (rounds + + (1 : ℕ)))) (TreeSequenceVertexSet (series.data.tree (Fin.last rounds : Fin (rounds + (1 : + ℕ))).succ : TreeSequence G e0))) (_ : ¬ColoredVertexSetStronglyClosed G + (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ)))) (TreeSequenceVertexSet + (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ : TreeSequence G e0))) + (_ : ( + ∀ (A B C : TreeSequence G e0) (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : Nonempty + (RevisitingExtensionCertificate series.data (Fin.last rounds : Fin (rounds + (1 : ℕ))))), + ∃ (newTree : TreeSequence G e0) (newColoring : PartialEdgeColoring E k) (newStored : Finset + (Fin k)) (newConnectingEdges : Finset E) (newKind : Option TashkinovExtensionKind) + (newChosenVertex : Option V) (newOutsideVertex : Option V) (newDelta : Option (Fin k)) + (newGamma : Option (Fin k)) (extended : TashkinovSeries G k (rounds + (1 : ℕ)) e0 input), + extended.data = TashkinovSeriesDataAppend series.data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma ∧ + (series.data.tree (Fin.last (rounds + (1 : ℕ)))).length < newTree.length := by + classical + intro V E _ _ _ G k rounds e0 input series + set i : Fin (rounds + (1 : ℕ)) := Fin.last rounds + set T : TreeSequence G e0 := series.data.tree i.succ + intro hiTree proper one closed notStrong segmentTrans revisiting + obtain ⟨cert⟩ := revisiting + obtain ⟨adjoined, hadjoined⟩ := TreeSequenceBoundaryEdgeAppendExists + T cert.edge (by simpa [T] using cert.edgeBoundary) + obtain ⟨newTree, hclosure⟩ := + TashkinovClosureExists (series.data.coloring i) adjoined + have hclosureSegment : TreeSequenceInitialSegment adjoined newTree := + TashkinovAugmentationSequenceInitialSegment _ _ _ hclosure.1 + have hordered : TreeSequenceInitialSegment T newTree := + segmentTrans T adjoined newTree hadjoined.2.1 hclosureSegment + have hstrict : T.length < newTree.length := by + rcases hadjoined with ⟨hlen, hadjoined⟩ + have hle := hclosureSegment.1 + omega + let newColoring := series.data.coloring i + let newStored : Finset (Fin k) := {cert.delta, cert.gamma} + let newEdges : Finset E := {cert.edge} + let newKind := some TashkinovExtensionKind.RE + let newVertex := some cert.insideEndpoint + let newOutside := some cert.outsideEndpoint + let newDelta := some cert.delta + let newGamma := some cert.gamma + let appended := TashkinovSeriesDataAppend series.data newTree newColoring + newStored newEdges newKind newVertex newOutside newDelta newGamma + obtain ⟨newCert, hgamma, hdelta, hedge, hins, hout⟩ := + (RevisitingExtensionCertificateAppend series.data newTree newColoring + newStored newEdges newKind newVertex newOutside newDelta newGamma i).2 cert + have lastStep : TashkinovSeriesStep G k (rounds + 1) e0 input appended + (Fin.last (rounds + 1)) := by + have hlast : i.succ = Fin.last (rounds + 1) := by ext; simp [i] + rw [← hlast] + apply TashkinovSeriesStep.RE (i := i) (available := newCert) + (adjoined := adjoined) + · simpa [appended, TashkinovSeriesDataAppend, i] using proper + · simpa [appended, TashkinovSeriesDataAppend, i] using one + · simp only [TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + exact closed + · simp only [TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + exact notStrong + · simp [TashkinovSeriesDataAppend, newColoring, i] + · simp [TashkinovSeriesDataAppend, newStored, hdelta, hgamma, i] + · simp [TashkinovSeriesDataAppend, newEdges, hedge, i] + · simp [TashkinovSeriesDataAppend, newKind, i] + · simp [TashkinovSeriesDataAppend, newVertex, hins, i] + · simp [TashkinovSeriesDataAppend, newOutside, hout, i] + · simp [TashkinovSeriesDataAppend, newDelta, hdelta, i] + · simp [TashkinovSeriesDataAppend, newGamma, hgamma, i] + · simpa [appended, TashkinovSeriesDataAppend, T, hedge, i] using hadjoined + · simpa [appended, TashkinovSeriesDataAppend, newColoring, i] using hclosure + · simpa [appended, TashkinovSeriesDataAppend, T, i] using hordered + · simpa [appended, TashkinovSeriesDataAppend, T, i] using hstrict + obtain ⟨extended, hextended⟩ := TashkinovSeriesAppend G k rounds e0 input + series newTree newColoring newStored newEdges newKind newVertex newOutside + newDelta newGamma lastStep + refine ⟨newTree, newColoring, newStored, newEdges, newKind, newVertex, + newOutside, newDelta, newGamma, extended, hextended, ?_⟩ + simpa [T, hiTree] using hstrict + +private noncomputable abbrev helperNewChoice236.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k rounds : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (series : TashkinovSeries G k rounds e0 input) → + let i : Fin (rounds + (1 : ℕ)) := Fin.last rounds; + let T : TreeSequence G e0 := series.data.tree i.succ; + (choice : + MaximumDefectiveChoice G e0 T (TashkinovStoredColors series.data i) + (series.data.coloring i)) → + (newTree : TreeSequence G e0) → + let newColoring : PartialEdgeColoring E k := choice.selected; + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := + some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appended : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend series.data newTree newColoring newStored + newEdges newKind newVertex newOutside newDelta newGamma; + TashkinovStoredColors appended i.castSucc = + TashkinovStoredColors series.data i → + MaximumDefectiveChoice G e0 (appended.tree i.succ.castSucc) + (TashkinovStoredColors appended i.castSucc) + (appended.coloring i.castSucc) := by + classical + intro V E _ _ _ G k rounds e0 input series i T choice newTree newColoring newStored newEdges + newKind newVertex newOutside newDelta newGamma appended storedEq + exact { + selected := choice.selected + selectedProper := choice.selectedProper + selectedOneUncolored := choice.selectedOneUncolored + selectedStable := by + rw [storedEq] + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using choice.selectedStable + vertex := choice.vertex + vertexDefective := by + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using choice.vertexDefective + maximal := by + rw [storedEq] + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using choice.maximal + edge := choice.edge + edgeDefective := by + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using choice.edgeDefective + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := by + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using choice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := choice.edgeColor } + +private theorem helper_branch_172.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (_ : series.data.tree (Fin.last rounds : Fin + (rounds + (1 : ℕ))).succ = series.data.tree (Fin.last (rounds + (1 : ℕ)))) (_ : + IsProperEdgeColoring G (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ))))) + (_ : IsOneEdgeUncolored (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ)))) + e0) (_ : ColoredVertexSetClosed G (series.data.coloring (Fin.last rounds : Fin (rounds + + (1 : ℕ)))) (TreeSequenceVertexSet (series.data.tree (Fin.last rounds : Fin (rounds + (1 : + ℕ))).succ : TreeSequence G e0))) (_ : ¬ColoredVertexSetStronglyClosed G + (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ)))) (TreeSequenceVertexSet + (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ : TreeSequence G e0))) + (_ : ( + ∀ (A B C : TreeSequence G e0) (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : (¬Nonempty + (RevisitingExtensionCertificate series.data (Fin.last rounds : Fin (rounds + (1 : ℕ)))) ∧ + ∃ (choice : MaximumDefectiveChoice G e0 (series.data.tree (Fin.last rounds : Fin (rounds + (1 + : ℕ))).succ) (TashkinovStoredColors series.data (Fin.last rounds : Fin (rounds + (1 : + ℕ)))) (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ))))), + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ) (insert + choice.color (TashkinovStoredColors series.data (Fin.last rounds : Fin (rounds + (1 : + ℕ))))) choice.selected pi → Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (series.data.tree (Fin.last rounds : Fin (rounds + (1 : + ℕ))).succ)))), + ∃ (newTree : TreeSequence G e0) (newColoring : PartialEdgeColoring E k) (newStored : Finset + (Fin k)) (newConnectingEdges : Finset E) (newKind : Option TashkinovExtensionKind) + (newChosenVertex : Option V) (newOutsideVertex : Option V) (newDelta : Option (Fin k)) + (newGamma : Option (Fin k)) (extended : TashkinovSeries G k (rounds + (1 : ℕ)) e0 input), + extended.data = TashkinovSeriesDataAppend series.data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma ∧ + (series.data.tree (Fin.last (rounds + (1 : ℕ)))).length < newTree.length := by + classical + intro V E _ _ _ G k rounds e0 input series + set i : Fin (rounds + (1 : ℕ)) := Fin.last rounds + set T : TreeSequence G e0 := series.data.tree i.succ + intro hiTree proper one closed notStrong segmentTrans seriesCase + rcases seriesCase with ⟨noRevisiting, choice, seriesAlternative⟩ + have hedgeBoundary : choice.edge ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + rcases choice.edgeDefective with ⟨c, hcdef, hcmem⟩ + exact (Finset.mem_filter.mp hcmem).1 + obtain ⟨adjoined, hadjoined⟩ := TreeSequenceBoundaryEdgeAppendExists + T choice.edge hedgeBoundary + obtain ⟨newTree, hclosure⟩ := + TashkinovClosureExists choice.selected adjoined + have hclosureSegment : TreeSequenceInitialSegment adjoined newTree := + TashkinovAugmentationSequenceInitialSegment _ _ _ hclosure.1 + have hordered : TreeSequenceInitialSegment T newTree := + segmentTrans T adjoined newTree hadjoined.2.1 hclosureSegment + have hstrict : T.length < newTree.length := by + rcases hadjoined with ⟨hlen, hadjoined⟩ + have hle := hclosureSegment.1 + omega + let newColoring := choice.selected + let newStored : Finset (Fin k) := {choice.color} + let newEdges : Finset E := {choice.edge} + let newKind := some TashkinovExtensionKind.SE + let newVertex := some choice.vertex + let newOutside := some choice.otherEndpoint + let newDelta := some choice.color + let newGamma : Option (Fin k) := none + let appended := TashkinovSeriesDataAppend series.data newTree newColoring + newStored newEdges newKind newVertex newOutside newDelta newGamma + have storedEq : TashkinovStoredColors appended i.castSucc = + TashkinovStoredColors series.data i := by + exact TashkinovStoredColorsAppend series.data newTree newColoring + newStored newEdges newKind newVertex newOutside newDelta newGamma i + let newChoice := @helperNewChoice236 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@rounds) (@e0) (@input) (@series) (@choice) (@newTree) (@storedEq) + have newNoRevisiting : ¬ Nonempty + (RevisitingExtensionCertificate appended i.castSucc) := by + rintro ⟨newCert⟩ + obtain ⟨oldCert, hgamma, hdelta, hedge, hins, hout⟩ := + (RevisitingExtensionCertificateAppend series.data newTree newColoring + newStored newEdges newKind newVertex newOutside newDelta newGamma i).1 + newCert + exact noRevisiting ⟨oldCert⟩ + have newSeriesAlternative : + ∀ pi : PartialEdgeColoring E k, IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (appended.tree i.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors appended i.castSucc)) newChoice.selected pi → Disjoint + (MissingColors G pi newChoice.otherEndpoint) (TreeMissingColors pi (appended.tree + i.succ.castSucc)) := by + intro pi piProper piOne piStable + have result := seriesAlternative pi piProper piOne + change StableColoring (appended.tree i.succ.castSucc) + (insert choice.color (TashkinovStoredColors appended i.castSucc)) + choice.selected pi at piStable + rw [storedEq] at piStable + have oldStable : StableColoring (series.data.tree i.succ) + (insert choice.color (TashkinovStoredColors series.data i)) + choice.selected pi := by + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using piStable + simpa only [newChoice, appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using result oldStable + have lastStep : TashkinovSeriesStep G k (rounds + 1) e0 input appended + (Fin.last (rounds + 1)) := by + have hlast : i.succ = Fin.last (rounds + 1) := by ext; simp [i] + rw [← hlast] + apply TashkinovSeriesStep.SE (i := i) (choice := newChoice) + (adjoined := adjoined) + · simpa [appended, TashkinovSeriesDataAppend, i] using proper + · simpa [appended, TashkinovSeriesDataAppend, i] using one + · simp only [TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + exact closed + · simp only [TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + exact notStrong + · exact newNoRevisiting + · exact newSeriesAlternative + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, i] + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, i] + · simpa [appended, TashkinovSeriesDataAppend, T, newChoice, i] using hadjoined + · simpa [appended, TashkinovSeriesDataAppend, newColoring, i] using hclosure + · simpa [appended, TashkinovSeriesDataAppend, T, i] using hordered + · simpa [appended, TashkinovSeriesDataAppend, T, i] using hstrict + obtain ⟨extended, hextended⟩ := TashkinovSeriesAppend G k rounds e0 input + series newTree newColoring newStored newEdges newKind newVertex newOutside + newDelta newGamma lastStep + refine ⟨newTree, newColoring, newStored, newEdges, newKind, newVertex, + newOutside, newDelta, newGamma, extended, hextended, ?_⟩ + simpa [T, hiTree] using hstrict + +private theorem helper_hdeltaMissing_463.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (choice : MaximumDefectiveChoice G e0 + (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ) (TashkinovStoredColors + series.data (Fin.last rounds : Fin (rounds + (1 : ℕ)))) (series.data.coloring (Fin.last + rounds : Fin (rounds + (1 : ℕ))))) (gamma : Fin k) (secondStable : PartialEdgeColoring E + k) (_ : gamma ∈ MissingColors G secondStable choice.vertex) (_ : gamma ≠ choice.color), + choice.color ∈ MissingColors G (TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) : PartialEdgeColoring E k) choice.vertex := by + classical + intro V E _ _ _ G k rounds e0 input series + set i : Fin (rounds + (1 : ℕ)) := Fin.last rounds + intro choice gamma secondStable hgammaMissing hgammaNe + set newColoring : PartialEdgeColoring E k := TwoColorComponentSwap G secondStable gamma + choice.color (Sum.inl choice.vertex) + unfold MissingColors + simp only [Finset.mem_sdiff] + constructor + · exact Finset.mem_univ _ + · intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + rcases hpresent with ⟨f, hfIncident, hfCurrent⟩ + have hfOld : secondStable f = some gamma ∨ + secondStable f = some choice.color := by + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · simp [newColoring, TwoColorComponentSwap, hfComponent] at hfCurrent + by_cases hfg : secondStable f = some gamma + · exact Or.inl hfg + · by_cases hfd : secondStable f = some choice.color + · exact Or.inr hfd + · simp [hfg, hfd] at hfCurrent + · right + simpa [newColoring, TwoColorComponentSwap, hfComponent] using hfCurrent + have hfComponent : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl choice.vertex) + rcases hfOld with hfg | hfd + · exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, hfIncident, hfg]) + · exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, hfIncident, hfd]) + have hgammaPresent : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + rcases hfOld with hfg | hfd + · exact ⟨f, hfIncident, hfg⟩ + · exfalso + have hswap : newColoring f = some gamma := by + simp [newColoring, TwoColorComponentSwap, hfComponent, hfd] + exact hgammaNe (Option.some.inj (hswap.symm.trans hfCurrent)) + have hgammaNotPresent : gamma ∉ + PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgammaMissing + exact hgammaNotPresent hgammaPresent + +private theorem helper_hgOutside_474.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (choice : MaximumDefectiveChoice G e0 + (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ) (TashkinovStoredColors + series.data (Fin.last rounds : Fin (rounds + (1 : ℕ)))) (series.data.coloring (Fin.last + rounds : Fin (rounds + (1 : ℕ))))) (gamma : Fin k) (secondStable : PartialEdgeColoring E + k) (_ : IsProperEdgeColoring G secondStable) (_ : TreeExit (series.data.tree (Fin.last + rounds : Fin (rounds + (1 : ℕ))).succ) secondStable gamma choice.color choice.vertex), + ∀ g ∈ BoundaryColorEdges G choice.selected (TreeSequenceVertexSet (series.data.tree (Fin.last + rounds : Fin (rounds + (1 : ℕ))).succ : TreeSequence G e0) : Finset V) choice.color, g ≠ + choice.edge → secondStable g = some choice.color → secondStable choice.edge = some + choice.color → gamma ∈ MissingColors G secondStable choice.vertex → Sum.inr g ∉ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) := by + classical + intro V E _ _ _ G k rounds e0 input series + set i : Fin (rounds + (1 : ℕ)) := Fin.last rounds + set T : TreeSequence G e0 := series.data.tree i.succ + intro choice gamma secondStable secondStableProper exitWitness + set X : Finset V := TreeSequenceVertexSet T + intro g hgBoundary hgne hgSecond hchoiceSecond hgammaMissing hgComponent + rcases (Finset.mem_filter.mp hgBoundary).1 with hgRaw' + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hgRaw' + obtain ⟨w, hw, u, hu, hends⟩ := hgRaw' + have hwIncident : Incident G w g := by + simp [Incident, hends] + have hwComponent : Sum.inl w ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl w) = + (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl choice.vertex) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, hwIncident, hgSecond])).trans hgComponent + have hwEq := (TreeExitComponentMeetsTreeOnlyAtExit T secondStable + gamma choice.color choice.vertex secondStableProper hgammaMissing + exitWitness w hw).mp hwComponent + subst w + exact (secondStableProper hgne + ⟨choice.vertex, hwIncident, choice.edgeIncident⟩ hgSecond) + hchoiceSecond + +private theorem helper_currentOne_507.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (choice : MaximumDefectiveChoice G e0 + (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ) (TashkinovStoredColors + series.data (Fin.last rounds : Fin (rounds + (1 : ℕ)))) (series.data.coloring (Fin.last + rounds : Fin (rounds + (1 : ℕ))))) (gamma : Fin k) (secondStable : PartialEdgeColoring E + k) (_ : IsOneEdgeUncolored secondStable e0), IsOneEdgeUncolored (TwoColorComponentSwap G + secondStable gamma choice.color (Sum.inl choice.vertex) : PartialEdgeColoring E k) e0 := by + classical + intro V E _ _ _ G k rounds e0 input series + set i : Fin (rounds + (1 : ℕ)) := Fin.last rounds + intro choice gamma secondStable secondStableOne + set newColoring : PartialEdgeColoring E k := TwoColorComponentSwap G secondStable gamma + choice.color (Sum.inl choice.vertex) + unfold IsOneEdgeUncolored + constructor + · simp [newColoring, TwoColorComponentSwap, secondStableOne.1] + · intro f hf + obtain ⟨c, hc⟩ := secondStableOne.2 f hf + by_cases hcomponent : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · by_cases hcg : c = gamma + · exact ⟨choice.color, by + simp [newColoring, TwoColorComponentSwap, hcomponent, hc, hcg]⟩ + · by_cases hcd : c = choice.color + · exact ⟨gamma, by + simp [newColoring, TwoColorComponentSwap, hcomponent, hc, + hcd]⟩ + · exact ⟨c, by + simp [newColoring, TwoColorComponentSwap, hcomponent, hc, + hcg, hcd]⟩ + · exact ⟨c, by + simpa [newColoring, TwoColorComponentSwap, hcomponent] using hc⟩ + +private theorem helper_hchoiceBoundary_591.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), + let i : Fin (rounds + (1 : ℕ)) := Fin.last rounds; + let T : TreeSequence G e0 := series.data.tree i.succ; + ∀ (choice : MaximumDefectiveChoice G e0 T (TashkinovStoredColors series.data i) + (series.data.coloring i)), + let X : Finset V := TreeSequenceVertexSet T; choice.edge ∈ BoundaryColorEdges G + choice.selected X choice.color := by + classical + intro V E _ _ _ G k rounds e0 input series i T choice X + rcases choice.edgeDefective with ⟨c, hcDefective, hcBoundary⟩ + have hcColor : choice.selected choice.edge = some c := + (Finset.mem_filter.mp hcBoundary).2 + have hc : c = choice.color := + Option.some.inj (hcColor.symm.trans choice.edgeColor) + simpa [X, hc] using hcBoundary + +private theorem helper_hdefective_599.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), + let i : Fin (rounds + (1 : ℕ)) := Fin.last rounds; + let T : TreeSequence G e0 := series.data.tree i.succ; + ∀ (choice : MaximumDefectiveChoice G e0 T (TashkinovStoredColors series.data i) + (series.data.coloring i)), + let X : Finset V := TreeSequenceVertexSet T; DefectiveColor G choice.selected X choice.color + := by + classical + intro V E _ _ _ G k rounds e0 input series i T choice X + rcases choice.edgeDefective with ⟨c, hcDefective, hcBoundary⟩ + have hcColor : choice.selected choice.edge = some c := + (Finset.mem_filter.mp hcBoundary).2 + have hc : c = choice.color := + Option.some.inj (hcColor.symm.trans choice.edgeColor) + simpa [X, hc] using hcDefective + +private theorem helper_boundaryIncident_618.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input), + let i : Fin (rounds + (1 : ℕ)) := Fin.last rounds; + let T : TreeSequence G e0 := series.data.tree i.succ; + let X : Finset V := TreeSequenceVertexSet T; + ∀ {f : E} (_ : f ∈ BoundaryEdges G X), + TreeIncidentEdge T f := by + classical + intro V E _ _ _ G k rounds e0 input series i T X f hf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hf + obtain ⟨v, hv, u, hu, hends⟩ := hf + exact ⟨v, hv, by simp [Incident, hends]⟩ + +private theorem helper_hgSecond_629.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), + let i : Fin (rounds + (1 : ℕ)) := Fin.last rounds; + let T : TreeSequence G e0 := series.data.tree i.succ; + ∀ (choice : MaximumDefectiveChoice G e0 T (TashkinovStoredColors series.data i) + (series.data.coloring i)) (secondStable : PartialEdgeColoring E k) (_ : StableColoring T + (insert choice.color (TashkinovStoredColors series.data i) : Finset (Fin k)) + choice.selected secondStable), + let X : Finset V := TreeSequenceVertexSet T; + ∀ g ∈ BoundaryColorEdges G choice.selected X choice.color, ( + ∀ {f : E}, f ∈ BoundaryEdges G X → TreeIncidentEdge T f) → g ∈ BoundaryEdges G X → + secondStable g = some choice.color := by + classical + intro V E _ _ _ G k rounds e0 input series i T choice secondStable secondStableRelation X g + hgBoundary boundaryIncident hgRaw + have fixed := secondStableRelation.1 g (boundaryIncident hgRaw) + ⟨choice.color, + Finset.mem_union.mpr (Or.inr (Finset.mem_insert_self _ _)), + (Finset.mem_filter.mp hgBoundary).2⟩ + exact fixed.trans (Finset.mem_filter.mp hgBoundary).2 + +private theorem helper_hchoiceSecond_635.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), + let i : Fin (rounds + (1 : ℕ)) := Fin.last rounds; + let T : TreeSequence G e0 := series.data.tree i.succ; + ∀ (choice : MaximumDefectiveChoice G e0 T (TashkinovStoredColors series.data i) + (series.data.coloring i)) (secondStable : PartialEdgeColoring E k) (_ : StableColoring T + (insert choice.color (TashkinovStoredColors series.data i) : Finset (Fin k)) + choice.selected secondStable), + let X : Finset V := TreeSequenceVertexSet T; + ∀ (_ : ( + ∀ {f : E} (_ : f ∈ BoundaryEdges G X), TreeIncidentEdge T f)) (_ : choice.edge ∈ BoundaryEdges + G X), secondStable choice.edge = some choice.color := by + classical + intro V E _ _ _ G k rounds e0 input series i T choice secondStable secondStableRelation X + boundaryIncident hchoiceRaw + have fixed := secondStableRelation.1 choice.edge + (boundaryIncident hchoiceRaw) + ⟨choice.color, + Finset.mem_union.mpr (Or.inr (Finset.mem_insert_self _ _)), + choice.edgeColor⟩ + exact fixed.trans choice.edgeColor + +private theorem helper_hgammaNe_645.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), + let i : Fin (rounds + (1 : ℕ)) := Fin.last rounds; + let T : TreeSequence G e0 := series.data.tree i.succ; + ∀ (choice : MaximumDefectiveChoice G e0 T (TashkinovStoredColors series.data i) + (series.data.coloring i)) (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (_ : + secondStable choice.edge = some choice.color) (_ : gamma ∈ MissingColors G secondStable + choice.vertex), gamma ≠ choice.color := by + classical + intro V E _ _ _ G k rounds e0 input series i T choice gamma secondStable hchoiceSecond + hgammaMissing h + have hpresent : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, h ▸ hchoiceSecond⟩ + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgammaMissing + exact hnot hpresent + +private theorem helper_hstrict_682.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), + let i : Fin (rounds + (1 : ℕ)) := Fin.last rounds; + let T : TreeSequence G e0 := series.data.tree i.succ; + ∀ (choice : MaximumDefectiveChoice G e0 T (TashkinovStoredColors series.data i) + (series.data.coloring i)) (gamma : Fin k) (secondStable : PartialEdgeColoring E k), + let X : Finset V := TreeSequenceVertexSet T; + let newColoring : PartialEdgeColoring E k := TwoColorComponentSwap G secondStable gamma + choice.color (Sum.inl choice.vertex); + ∀ (_ : ¬ColoredVertexSetClosed G newColoring X) (newTree : TreeSequence G e0) (_ : + TashkinovClosure newColoring T newTree) (_ : TreeSequenceInitialSegment T newTree), + T.length < newTree.length := by + classical + intro V E _ _ _ G k rounds e0 input series i T choice gamma secondStable X newColoring + hnotClosed newTree hclosure hordered + rcases hclosure with ⟨hreach, hnewClosed⟩ + unfold TashkinovAugmentationSequence at hreach + cases hreach with + | refl => exact (hnotClosed hnewClosed).elim + | tail hprefix hlast => + have hsegment := + TashkinovAugmentationSequenceInitialSegment newColoring _ _ hprefix + have hle := hsegment.1 + rcases hlast with ⟨hlen, hseg, hc, hcolor, hmissing⟩ + rw [hlen] + omega + +private theorem helper_newNoRevisiting_738.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), + let i : Fin (rounds + (1 : ℕ)) := Fin.last rounds; + let T : TreeSequence G e0 := series.data.tree i.succ; + ∀ (_ : ¬Nonempty (RevisitingExtensionCertificate series.data i)) (choice : + MaximumDefectiveChoice G e0 T (TashkinovStoredColors series.data i) (series.data.coloring + i)) (gamma : Fin k) (secondStable : PartialEdgeColoring E k), + let newColoring : PartialEdgeColoring E k := TwoColorComponentSwap G secondStable gamma + choice.color (Sum.inl choice.vertex); + ∀ (newTree : TreeSequence G e0), + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appended : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + series.data newTree newColoring newStored newEdges newKind newVertex newOutside newDelta + newGamma; ¬Nonempty (RevisitingExtensionCertificate appended i.castSucc) := by + classical + intro V E _ _ _ G k rounds e0 input series i T noRevisiting choice gamma secondStable + newColoring newTree newStored newEdges newKind newVertex newOutside newDelta newGamma appended + rintro ⟨newCert⟩ + obtain ⟨oldCert, hcertGamma, hcertDelta, hcertEdge, + hcertInside, hcertOutside⟩ := + (RevisitingExtensionCertificateAppend series.data newTree newColoring + newStored newEdges newKind newVertex newOutside newDelta newGamma i).1 + newCert + exact noRevisiting ⟨oldCert⟩ + +private noncomputable abbrev helperNewChoice890.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k rounds : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (series : TashkinovSeries G k rounds e0 input) → + let i : Fin (rounds + (1 : ℕ)) := Fin.last rounds; + let T : TreeSequence G e0 := series.data.tree i.succ; + (choice : + MaximumDefectiveChoice G e0 T (TashkinovStoredColors series.data i) + (series.data.coloring i)) → + (gamma : Fin k) → + (secondStable : PartialEdgeColoring E k) → + let newColoring : PartialEdgeColoring E k := + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex); + (newTree : TreeSequence G e0) → + let newStored : Finset (Fin k) := + (insert choice.color ({ gamma } : Finset (Fin k)) : + Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := + some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appended : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend series.data newTree newColoring + newStored newEdges newKind newVertex newOutside newDelta + newGamma; + TashkinovStoredColors appended i.castSucc = + TashkinovStoredColors series.data i → + MaximumDefectiveChoice G e0 (appended.tree i.succ.castSucc) + (TashkinovStoredColors appended i.castSucc) + (appended.coloring i.castSucc) := by + classical + intro V E _ _ _ G k rounds e0 input series i T choice gamma secondStable newColoring newTree + newStored newEdges newKind newVertex newOutside newDelta newGamma appended storedEq + exact { + selected := choice.selected + selectedProper := choice.selectedProper + selectedOneUncolored := choice.selectedOneUncolored + selectedStable := by + rw [storedEq] + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using choice.selectedStable + vertex := choice.vertex + vertexDefective := by + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using choice.vertexDefective + maximal := by + rw [storedEq] + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using choice.maximal + edge := choice.edge + edgeDefective := by + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using choice.edgeDefective + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := by + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using choice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := choice.edgeColor } + +private theorem helper_branch_295.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (_ : series.data.tree (Fin.last rounds : Fin + (rounds + (1 : ℕ))).succ = series.data.tree (Fin.last (rounds + (1 : ℕ)))) (_ : + IsProperEdgeColoring G (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ))))) + (_ : IsOneEdgeUncolored (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ)))) + e0) (_ : ColoredVertexSetClosed G (series.data.coloring (Fin.last rounds : Fin (rounds + + (1 : ℕ)))) (TreeSequenceVertexSet (series.data.tree (Fin.last rounds : Fin (rounds + (1 : + ℕ))).succ : TreeSequence G e0))) (_ : ¬ColoredVertexSetStronglyClosed G + (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ)))) (TreeSequenceVertexSet + (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ : TreeSequence G e0))) + (_ : (¬Nonempty (RevisitingExtensionCertificate series.data (Fin.last rounds : Fin (rounds + + (1 : ℕ)))) ∧ + ∃ (choice : MaximumDefectiveChoice G e0 (series.data.tree (Fin.last rounds : Fin (rounds + (1 + : ℕ))).succ) (TashkinovStoredColors series.data (Fin.last rounds : Fin (rounds + (1 : + ℕ)))) (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ))))), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ) (insert + choice.color (TashkinovStoredColors series.data (Fin.last rounds : Fin (rounds + (1 : + ℕ))))) choice.selected rho ∧ ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (series.data.tree (Fin.last rounds : Fin (rounds + (1 : + ℕ))).succ))) ∧ + ∃ (gamma : Fin k), ParallelExtensionColor series.data (Fin.last rounds : Fin (rounds + (1 : + ℕ))) choice.selected choice.vertex gamma ∧ + ∃ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma + e0 ∧ StableColoring (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ) + (insert choice.color (TashkinovStoredColors series.data (Fin.last rounds : Fin (rounds + + (1 : ℕ))))) choice.selected sigma ∧ TreeExit (series.data.tree (Fin.last rounds : Fin + (rounds + (1 : ℕ))).succ) sigma gamma choice.color choice.vertex)), + ∃ (newTree : TreeSequence G e0) (newColoring : PartialEdgeColoring E k) (newStored : Finset + (Fin k)) (newConnectingEdges : Finset E) (newKind : Option TashkinovExtensionKind) + (newChosenVertex : Option V) (newOutsideVertex : Option V) (newDelta : Option (Fin k)) + (newGamma : Option (Fin k)) (extended : TashkinovSeries G k (rounds + (1 : ℕ)) e0 input), + extended.data = TashkinovSeriesDataAppend series.data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma ∧ + (series.data.tree (Fin.last (rounds + (1 : ℕ)))).length < newTree.length := by + classical + intro V E _ _ _ G k rounds e0 input series + set i : Fin (rounds + (1 : ℕ)) := Fin.last rounds + set T : TreeSequence G e0 := series.data.tree i.succ + intro hiTree proper one closed notStrong parallelCase + rcases parallelCase with ⟨noRevisiting, choice, + seriesAlternativeFails, gamma, gammaRule, secondStable, + secondStableProper, secondStableOne, secondStableRelation, exitWitness⟩ + let X := TreeSequenceVertexSet T + have hchoiceBoundary := + @helper_hchoiceBoundary_591 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@choice) + have hdefective := + @helper_hdefective_599 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@choice) + obtain ⟨g, hgBoundary, hgne⟩ : ∃ g, + g ∈ BoundaryColorEdges G choice.selected X choice.color ∧ + g ≠ choice.edge := by + obtain ⟨a, ha, b, hb, hab⟩ := + Finset.one_lt_card.mp (show 1 < + (BoundaryColorEdges G choice.selected X choice.color).card by + exact lt_of_lt_of_le Nat.one_lt_two hdefective) + by_cases haChoice : a = choice.edge + · exact ⟨b, hb, by + intro hbChoice + exact hab (haChoice.trans hbChoice.symm)⟩ + · exact ⟨a, ha, haChoice⟩ + have boundaryIncident := + @helper_boundaryIncident_618 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) + have hgRaw : g ∈ BoundaryEdges G X := + (Finset.mem_filter.mp hgBoundary).1 + have hchoiceRaw : choice.edge ∈ BoundaryEdges G X := + (Finset.mem_filter.mp hchoiceBoundary).1 + have hgSecond := + @helper_hgSecond_629 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@rounds) + (@e0) (@input) (@series) (@choice) (@secondStable) (@secondStableRelation) (@g) + (@hgBoundary) (@boundaryIncident) (@hgRaw) + have hchoiceSecond := + @helper_hchoiceSecond_635 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@choice) (@secondStable) (@secondStableRelation) + (@boundaryIncident) (@hchoiceRaw) + have hgammaMissing : gamma ∈ MissingColors G secondStable choice.vertex := by + rw [secondStableRelation.2 choice.vertex choice.vertexDefective.1] + exact gammaRule.1 + have hgammaNe := + @helper_hgammaNe_645 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@rounds) + (@e0) (@input) (@series) (@choice) (@gamma) (@secondStable) (@hchoiceSecond) + (@hgammaMissing) + have hgOutside := + @helper_hgOutside_474 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@choice) (@gamma) (@secondStable) (by assumption) (by + assumption) (@g) (by assumption) (by assumption) (by assumption) (by assumption) (by + assumption) + let newColoring := TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) + have hgCurrent : newColoring g = some choice.color := by + simp [newColoring, TwoColorComponentSwap, hgOutside, hgSecond] + have currentProper : IsProperEdgeColoring G newColoring := by + exact TwoColorComponentSwapProper G secondStable gamma choice.color + hgammaNe secondStableProper (Sum.inl choice.vertex) + have currentOne := + @helper_currentOne_507 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@choice) (@gamma) (@secondStable) (by assumption) + have hdeltaMissing := + @helper_hdeltaMissing_463 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@choice) (@gamma) (@secondStable) (by assumption) (by + assumption) + have hnotClosed : ¬ ColoredVertexSetClosed G newColoring X := by + intro hcurrentClosed + exact (hcurrentClosed hgRaw choice.vertexDefective.1 hgCurrent) + hdeltaMissing + obtain ⟨newTree, hclosure⟩ := TashkinovClosureExists newColoring T + have hordered : TreeSequenceInitialSegment T newTree := + TashkinovAugmentationSequenceInitialSegment _ _ _ hclosure.1 + have hstrict := + @helper_hstrict_682 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@rounds) + (@e0) (@input) (@series) (@choice) (@gamma) (@secondStable) (@hnotClosed) (@newTree) + (@hclosure) (@hordered) + let newStored : Finset (Fin k) := {choice.color, gamma} + let newEdges : Finset E := {choice.edge} + let newKind := some TashkinovExtensionKind.PE + let newVertex := some choice.vertex + let newOutside := some choice.otherEndpoint + let newDelta := some choice.color + let newGamma := some gamma + let appended := TashkinovSeriesDataAppend series.data newTree newColoring + newStored newEdges newKind newVertex newOutside newDelta newGamma + have storedEq : TashkinovStoredColors appended i.castSucc = + TashkinovStoredColors series.data i := by + exact TashkinovStoredColorsAppend series.data newTree newColoring + newStored newEdges newKind newVertex newOutside newDelta newGamma i + let newChoice := @helperNewChoice890 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@rounds) (@e0) (@input) (@series) (@choice) (@gamma) (@secondStable) (@newTree) + (@storedEq) + have newNoRevisiting := + @helper_newNoRevisiting_738 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@noRevisiting) (@choice) (@gamma) (@secondStable) + (@newTree) + have newFailure : ∃ rho : PartialEdgeColoring E k, + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (appended.tree i.succ.castSucc) + (insert newChoice.color (TashkinovStoredColors appended i.castSucc)) + newChoice.selected rho ∧ + ¬ Disjoint (MissingColors G rho newChoice.otherEndpoint) + (TreeMissingColors rho (appended.tree i.succ.castSucc)) := by + obtain ⟨rho, rhoProper, rhoOne, rhoStable, rhoFailure⟩ := + seriesAlternativeFails + refine ⟨rho, rhoProper, rhoOne, ?_, ?_⟩ + · change StableColoring (appended.tree i.succ.castSucc) + (insert choice.color (TashkinovStoredColors appended i.castSucc)) + choice.selected rho + rw [storedEq] + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using rhoStable + · simpa only [newChoice, appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using rhoFailure + have newGammaRule : ParallelExtensionColor appended i.castSucc + newChoice.selected newChoice.vertex gamma := by + change ParallelExtensionColor appended i.castSucc + choice.selected choice.vertex gamma + exact (ParallelExtensionColorAppend series.data newTree newColoring + newStored newEdges newKind newVertex newOutside newDelta newGamma i + choice.selected choice.vertex gamma).2 gammaRule + have newSecondStableRelation : StableColoring + (appended.tree i.succ.castSucc) + (insert newChoice.color (TashkinovStoredColors appended i.castSucc)) + newChoice.selected secondStable := by + change StableColoring (appended.tree i.succ.castSucc) + (insert choice.color (TashkinovStoredColors appended i.castSucc)) + choice.selected secondStable + rw [storedEq] + simpa only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using secondStableRelation + have newExit : TreeExit (appended.tree i.succ.castSucc) secondStable + gamma newChoice.color newChoice.vertex := by + simpa only [newChoice, appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] using exitWitness + have lastStep : TashkinovSeriesStep G k (rounds + 1) e0 input appended + (Fin.last (rounds + 1)) := by + have hlast : i.succ = Fin.last (rounds + 1) := by ext; simp [i] + rw [← hlast] + apply TashkinovSeriesStep.PE (i := i) (choice := newChoice) + (gamma := gamma) (secondStable := secondStable) + · simpa [appended, TashkinovSeriesDataAppend, i] using proper + · simpa [appended, TashkinovSeriesDataAppend, i] using one + · simp only [TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + exact closed + · simp only [TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + exact notStrong + · exact newNoRevisiting + · exact newFailure + · exact newGammaRule + · exact secondStableProper + · exact secondStableOne + · exact newSecondStableRelation + · exact newExit + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simpa [appended, TashkinovSeriesDataAppend, newColoring, i] using + currentProper + · simpa [appended, TashkinovSeriesDataAppend, newColoring, i] using + currentOne + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, i] + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, newChoice, i] + · simp [TashkinovSeriesDataAppend, i] + · simpa [appended, TashkinovSeriesDataAppend, newColoring, T, i] using + hclosure + · simpa [appended, TashkinovSeriesDataAppend, T, i] using hordered + · simpa [appended, TashkinovSeriesDataAppend, T, i] using hstrict + obtain ⟨extended, hextended⟩ := TashkinovSeriesAppend G k rounds e0 input + series newTree newColoring newStored newEdges newKind newVertex newOutside + newDelta newGamma lastStep + refine ⟨newTree, newColoring, newStored, newEdges, newKind, newVertex, + newOutside, newDelta, newGamma, extended, hextended, ?_⟩ + simpa [T, hiTree] using hstrict + +private theorem helper_branch_160.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (_ : series.data.tree (Fin.last rounds : Fin + (rounds + (1 : ℕ))).succ = series.data.tree (Fin.last (rounds + (1 : ℕ)))) (_ : + IsProperEdgeColoring G (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ))))) + (_ : IsOneEdgeUncolored (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ)))) + e0) (_ : ColoredVertexSetClosed G (series.data.coloring (Fin.last rounds : Fin (rounds + + (1 : ℕ)))) (TreeSequenceVertexSet (series.data.tree (Fin.last rounds : Fin (rounds + (1 : + ℕ))).succ : TreeSequence G e0))) (_ : ¬ColoredVertexSetStronglyClosed G + (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ)))) (TreeSequenceVertexSet + (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ : TreeSequence G e0))) + (_ : ( + ∀ (A B C : TreeSequence G e0) (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : ((¬Nonempty + (RevisitingExtensionCertificate series.data (Fin.last rounds : Fin (rounds + (1 : ℕ)))) ∧ + ∃ (choice : MaximumDefectiveChoice G e0 (series.data.tree (Fin.last rounds : Fin (rounds + (1 + : ℕ))).succ) (TashkinovStoredColors series.data (Fin.last rounds : Fin (rounds + (1 : + ℕ)))) (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ))))), + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ) (insert + choice.color (TashkinovStoredColors series.data (Fin.last rounds : Fin (rounds + (1 : + ℕ))))) choice.selected pi → Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ))) + ∨ ¬Nonempty (RevisitingExtensionCertificate series.data (Fin.last rounds : Fin (rounds + + (1 : ℕ)))) ∧ + ∃ (choice : MaximumDefectiveChoice G e0 (series.data.tree (Fin.last rounds : Fin (rounds + (1 + : ℕ))).succ) (TashkinovStoredColors series.data (Fin.last rounds : Fin (rounds + (1 : + ℕ)))) (series.data.coloring (Fin.last rounds : Fin (rounds + (1 : ℕ))))), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ) (insert + choice.color (TashkinovStoredColors series.data (Fin.last rounds : Fin (rounds + (1 : + ℕ))))) choice.selected rho ∧ ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (series.data.tree (Fin.last rounds : Fin (rounds + (1 : + ℕ))).succ))) ∧ + ∃ (gamma : Fin k), ParallelExtensionColor series.data (Fin.last rounds : Fin (rounds + (1 : + ℕ))) choice.selected choice.vertex gamma ∧ + ∃ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma + e0 ∧ StableColoring (series.data.tree (Fin.last rounds : Fin (rounds + (1 : ℕ))).succ) + (insert choice.color (TashkinovStoredColors series.data (Fin.last rounds : Fin (rounds + + (1 : ℕ))))) choice.selected sigma ∧ TreeExit (series.data.tree (Fin.last rounds : Fin + (rounds + (1 : ℕ))).succ) sigma gamma choice.color choice.vertex)), + ∃ (newTree : TreeSequence G e0) (newColoring : PartialEdgeColoring E k) (newStored : Finset + (Fin k)) (newConnectingEdges : Finset E) (newKind : Option TashkinovExtensionKind) + (newChosenVertex : Option V) (newOutsideVertex : Option V) (newDelta : Option (Fin k)) + (newGamma : Option (Fin k)) (extended : TashkinovSeries G k (rounds + (1 : ℕ)) e0 input), + extended.data = TashkinovSeriesDataAppend series.data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma ∧ + (series.data.tree (Fin.last (rounds + (1 : ℕ)))).length < newTree.length := by + classical + intro V E _ _ _ G k rounds e0 input series + set i : Fin (rounds + (1 : ℕ)) := Fin.last rounds + set T : TreeSequence G e0 := series.data.tree i.succ + intro hiTree proper one closed notStrong segmentTrans seriesOrParallel + rcases seriesOrParallel with seriesCase | parallelCase + · exact @helper_branch_172 V E inferInstance inferInstance inferInstance G k + rounds e0 input series hiTree proper one closed notStrong segmentTrans seriesCase + · exact @helper_branch_295 V E inferInstance inferInstance inferInstance G k + rounds e0 input series hiTree proper one closed notStrong parallelCase +theorem AlgorithmThreeOneStepExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : Nat) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) + (hdegree : MaximumDegree G + 1 ≤ k) + (hproper : IsProperEdgeColoring G + (series.data.coloring (Fin.last rounds))) + (hone : IsOneEdgeUncolored + (series.data.coloring (Fin.last rounds)) e0) + (hclosed : ColoredVertexSetClosed G + (series.data.coloring (Fin.last rounds)) + (TreeSequenceVertexSet (series.data.tree (Fin.last (rounds + 1))))) + (hnotStrong : ¬ ColoredVertexSetStronglyClosed G + (series.data.coloring (Fin.last rounds)) + (TreeSequenceVertexSet (series.data.tree (Fin.last (rounds + 1))))) : + ∃ (newTree : TreeSequence G e0) + (newColoring : PartialEdgeColoring E k) + (newStored : Finset (Fin k)) (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) + (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)) + (extended : TashkinovSeries G k (rounds + 1) e0 input), + extended.data = TashkinovSeriesDataAppend series.data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex + newOutsideVertex newDelta newGamma ∧ + (series.data.tree (Fin.last (rounds + 1))).length < newTree.length := by + classical + let i : Fin (rounds + 1) := Fin.last rounds + let T := series.data.tree i.succ + have hiColor : series.data.coloring i = + series.data.coloring (Fin.last rounds) := by rfl + have hiTree : series.data.tree i.succ = + series.data.tree (Fin.last (rounds + 1)) := by + congr 1 + have proper : IsProperEdgeColoring G (series.data.coloring i) := by + simpa [hiColor] using hproper + have one : IsOneEdgeUncolored (series.data.coloring i) e0 := by + simpa [hiColor] using hone + have closed : ColoredVertexSetClosed G (series.data.coloring i) + (TreeSequenceVertexSet T) := by + change ColoredVertexSetClosed G + (series.data.coloring (Fin.last rounds)) + (TreeSequenceVertexSet (series.data.tree (Fin.last (rounds + 1)))) + exact hclosed + have notStrong : ¬ ColoredVertexSetStronglyClosed G + (series.data.coloring i) (TreeSequenceVertexSet T) := by + simpa [T, hiColor, hiTree] using hnotStrong + have segmentTrans : ∀ (A B C : TreeSequence G e0), + TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C → + TreeSequenceInitialSegment A C := by + intros + apply TreeSequenceInitialSegment.trans <;> assumption + rcases AlgorithmThreeOneChoiceDataExists G k rounds e0 input series i + hdegree proper one closed notStrong with revisiting | seriesOrParallel + · exact @helper_branch_102 V E inferInstance inferInstance inferInstance G k + rounds e0 input series hiTree proper one closed notStrong segmentTrans revisiting + · exact @helper_branch_160 V E inferInstance inferInstance inferInstance G k + rounds e0 input series hiTree proper one closed notStrong segmentTrans seriesOrParallel +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/BalancedGlobalMaximumTriple.lean b/LeanPool/GoldbergSeymour/BalancedGlobalMaximumTriple.lean new file mode 100644 index 0000000000..6a86500a75 --- /dev/null +++ b/LeanPool/GoldbergSeymour/BalancedGlobalMaximumTriple.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideGraphHeight + +/-! +# Balanced Global Maximum Triple + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A normal maximum triple of maximal graph height, with paired colors beyond its trunk. -/ +def BalancedGlobalMaximumTriple {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {T : TreeSequence G e0} (N : NormalGlobalMaximumTriple G k e0 phi T) : Prop := + N.height = ScheideGraphHeight G ∧ + ∀ j : ℕ, + ∀ hlow : N.height < 2 * j, + ∀ hupp : 2 * j < T.length + 1, + phi (T.edge ⟨2 * j - 2, by omega⟩) = phi (T.edge ⟨2 * j - 1, by omega⟩) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/BaseControl.lean b/LeanPool/GoldbergSeymour/BaseControl.lean new file mode 100644 index 0000000000..6c23b36288 --- /dev/null +++ b/LeanPool/GoldbergSeymour/BaseControl.lean @@ -0,0 +1,1725 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix + +public import LeanPool.GoldbergSeymour.ChangeLemmaBothInside +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability + +/-! +# P2813_T1_Base Control + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBaseStableProof1297Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (hprefixElementary : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) (Nat.min_le_right + (A.length + (ell - (1 : ℕ))) T.length); ColoredVertexSetElementary G phi + (TreeSequenceVertexSet Ty)) (alpha beta : Fin k) (hne : alpha ≠ beta) (z : V ⊕ E) (sigma : + PartialEdgeColoring E k) (hcase : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; (0 : ℕ) < H.dividerCount ∧ + alpha ∈ TreeMissingColors phi Tnq ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + phi Tn ∨ alpha ∈ TreeMissingColors phi A ∧ alpha ∉ Dn ∧ beta ∉ Dn)) (hproper : + IsProperEdgeColoring G phi) (hone : IsOneEdgeUncolored phi e0) (hlower : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + LowerRoundProperties lower), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + ∀ (trans : + ∀ {U W Z : TreeSequence G e0} (hUW : TreeSequenceInitialSegment U W) (hWZ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z) (starChain : + ∀ (r s : Fin (H.dividerCount + (1 : ℕ))) (hrs : r ≤ s), TreeSequenceInitialSegment + (HierarchyStarredStage H r) (HierarchyStarredStage H s)) (hAT : TreeSequenceInitialSegment + A T) (haMissing : alpha ∈ MissingColors G phi a) (pathMissing : + ∀ (c d : Fin k) (hcd : c ≠ d) (v : V) (hc : c ∈ MissingColors G phi v), TwoColorPathComponent + G phi c d (Sum.inl v)) (interchangeableSwap : + ∀ (B : TreeSequence G e0) (c d : Fin k) (hi : TreeInterchangeable G B phi c d), + TreeInterchangeable G B phi d c) (hcombined : CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data n) phi phi) (nonPEMissingClosed : + ∀ (hnonPE : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE) (c : Fin k) (hc : c ∈ + TreeMissingColors phi Tn), TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k))) + (coreChain : TreeSequenceInitialSegment Tn base.core) (TnA : TreeSequenceInitialSegment Tn + A) (closureA : + ∀ (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE), TreeSequenceVertexSet + base.closure ⊆ TreeSequenceVertexSet A) (firstIn : + ∀ (B : TreeSequence G e0) (hBT : TreeSequenceInitialSegment B T) (c : Fin k) (hc : c ∈ + TreeMissingColors phi B), T.vertex (HierarchyFirstMissingPosition phi T c) ∈ + TreeSequenceVertexSet B) (halphaA : alpha ∈ TreeMissingColors phi A) (haA : a ∈ + TreeSequenceVertexSet A) (haOutside : Sum.inl a ∉ TwoColorComponent G phi alpha beta z) + (missingUnique : + ∀ (c : Fin k) (hc : c ∈ TreeMissingColors phi A) (v : V) (hv : v ∈ TreeSequenceVertexSet A) + (hvc : c ∈ MissingColors G phi v) (hcm : c ∈ MissingColors G phi (T.vertex + (HierarchyFirstMissingPosition phi T c))), v = T.vertex (HierarchyFirstMissingPosition phi + T c)) (outsideOfInter : + ∀ (B : TreeSequence G e0) (v : V) (hv : v ∈ TreeSequenceVertexSet B) (hp : + TwoColorPathComponent G phi alpha beta (Sum.inl v)) (hi : TreeInterchangeable G B phi + alpha beta) (hout : Sum.inl v ∉ TwoColorComponent G phi alpha beta z), + OutsideKempeRecoloring B phi sigma alpha beta) (outsideMono : + ∀ (B S : TreeSequence G e0) (hBS : TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet S) (hout : + OutsideKempeRecoloring S phi sigma alpha beta), OutsideKempeRecoloring B phi sigma alpha + beta) (outsideStable : + ∀ (B : TreeSequence G e0) (D : Finset (Fin k)) (hout : OutsideKempeRecoloring B phi sigma + alpha beta), StableColoring B D phi sigma ∧ + ∀ (f : E), TreeIncidentEdge B f → sigma f = phi f) (closedOutside : + ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c : Fin k) (hc : c = alpha ∨ c = beta) (hm : c ∈ + TreeMissingColors phi (HierarchyStarredStage H r)) (hcl : TreeColorSetClosed G phi + (HierarchyStarredStage H r) ({ c } : Finset (Fin k))), OutsideKempeRecoloring + (HierarchyStarredStage H r) phi sigma alpha beta) (maxClosed : + ∀ (c : Fin k) (hex : + ∃ (r : Fin (H.dividerCount + (1 : ℕ))), TreeColorSetClosed G phi (HierarchyStarredStage H r) + ({ c } : Finset (Fin k))), + ∃ (r : Fin (H.dividerCount + (1 : ℕ))), TreeColorSetClosed G phi (HierarchyStarredStage H r) + ({ c } : Finset (Fin k)) ∧ + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑r : ℕ) < (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ c } : Finset (Fin k))) (missingAtMax : + ∀ (c : Fin k) (hcA : c ∈ TreeMissingColors phi A) (r : Fin (H.dividerCount + (1 : ℕ))) (hmax : + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑r : ℕ) < (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ c } : Finset (Fin k))), c ∈ TreeMissingColors phi + (HierarchyStarredStage H r)) (preStepElementary : + let i : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; Decidable.byContradiction fun (a : ¬ett.rounds + - (1 : ℕ) < ett.rounds) ↦ + by omega + ⟩ : Fin ett.rounds); ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn)) (lastZero : + ∀ (hq : H.dividerCount = (0 : ℕ)), A = base.core), + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let baseStable : Prop := if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma else StableColoring Tn Dn phi sigma; + ∀ (stableNoAffected : + ∀ (B : TreeSequence G e0) (D : Finset (Fin k)) (hBA : TreeSequenceVertexSet B ⊆ + TreeSequenceVertexSet A) (hna : alpha ∉ TreeMissingColors phi B ∪ D) (hnb : beta ∉ + TreeMissingColors phi B ∪ D), StableColoring B D phi sigma) (stableFromCore : + ∀ (hout : OutsideKempeRecoloring base.core phi sigma alpha beta), baseStable), baseStable + +private abbrev helperContinuation1245Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (hprefixElementary : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) (Nat.min_le_right + (A.length + (ell - (1 : ℕ))) T.length); ColoredVertexSetElementary G phi + (TreeSequenceVertexSet Ty)) (alpha beta : Fin k) (hne : alpha ≠ beta) (hmissingPrefix : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) (Nat.min_le_right + (A.length + (ell - (1 : ℕ))) T.length); alpha ∈ TreeMissingColors phi Ty ∧ beta ∈ + TreeMissingColors phi Ty) (z : V ⊕ E) (hpath : TwoColorPathComponent G phi alpha beta z) + (sigma : PartialEdgeColoring E k) (hsigma : sigma = TwoColorComponentSwap G phi alpha beta + z) (hcase : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; (0 : ℕ) < H.dividerCount ∧ + alpha ∈ TreeMissingColors phi Tnq ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + phi Tn ∨ alpha ∈ TreeMissingColors phi A ∧ alpha ∉ Dn ∧ beta ∉ Dn)) (hdisjoint : + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); Disjoint + (TwoColorComponent G phi alpha beta z) (TwoColorComponent G phi alpha beta (Sum.inl va))) + (hproper : IsProperEdgeColoring G phi) (hone : IsOneEdgeUncolored phi e0) (hlower : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + LowerRoundProperties lower) (hfewer : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating'), other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') (a : + GoodHierarchy K), K.dividerCount < C.hierarchy.dividerCount → ColoredVertexSetElementary G + generating' (TreeSequenceVertexSet T')) (hlarge : + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; (2 : ℕ) * ett.rounds + (11 : ℕ) + ≤ (TreeMissingColors phi Tn).card), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + ∀ (trans : + ∀ {U W Z : TreeSequence G e0} (hUW : TreeSequenceInitialSegment U W) (hWZ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z) (starChain : + ∀ (r s : Fin (H.dividerCount + (1 : ℕ))) (hrs : r ≤ s), TreeSequenceInitialSegment + (HierarchyStarredStage H r) (HierarchyStarredStage H s)) (hAT : TreeSequenceInitialSegment + A T) (helemStar : + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r))) (haMissing : alpha ∈ MissingColors G + phi a) (hbMissing : beta ∈ MissingColors G phi b) (pathMissing : + ∀ (c d : Fin k) (hcd : c ≠ d) (v : V) (hc : c ∈ MissingColors G phi v), TwoColorPathComponent + G phi c d (Sum.inl v)) (graphSwap : + ∀ (c d : Fin k), TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c) + (componentSwap : + ∀ (c d : Fin k) (z : V ⊕ E), TwoColorComponent G phi c d z = TwoColorComponent G phi d c z) + (interchangeableSwap : + ∀ (B : TreeSequence G e0) (c d : Fin k) (hi : TreeInterchangeable G B phi c d), + TreeInterchangeable G B phi d c) (hcombined : CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data n) phi phi) (nonPEMissingClosed : + ∀ (hnonPE : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE) (c : Fin k) (hc : c ∈ + TreeMissingColors phi Tn), TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k))) + (coreChain : TreeSequenceInitialSegment Tn base.core) (TnA : TreeSequenceInitialSegment Tn + A) (closureA : + ∀ (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE), TreeSequenceVertexSet + base.closure ⊆ TreeSequenceVertexSet A) (firstIn : + ∀ (B : TreeSequence G e0) (hBT : TreeSequenceInitialSegment B T) (c : Fin k) (hc : c ∈ + TreeMissingColors phi B), T.vertex (HierarchyFirstMissingPosition phi T c) ∈ + TreeSequenceVertexSet B) (halphaA : alpha ∈ TreeMissingColors phi A) (haA : a ∈ + TreeSequenceVertexSet A) (hsame : + ∀ (hbA : beta ∈ TreeMissingColors phi A), TwoColorComponent G phi alpha beta (Sum.inl a) = + TwoColorComponent G phi alpha beta (Sum.inl b)) (haOutside : Sum.inl a ∉ TwoColorComponent + G phi alpha beta z) (hbOutside : + ∀ (hbA : beta ∈ TreeMissingColors phi A), Sum.inl b ∉ TwoColorComponent G phi alpha beta z) + (missingUnique : + ∀ (c : Fin k) (hc : c ∈ TreeMissingColors phi A) (v : V) (hv : v ∈ TreeSequenceVertexSet A) + (hvc : c ∈ MissingColors G phi v) (hcm : c ∈ MissingColors G phi (T.vertex + (HierarchyFirstMissingPosition phi T c))), v = T.vertex (HierarchyFirstMissingPosition phi + T c)) (edgeOfVertex : + ∀ {v : V} {f : E} (hv : Sum.inl v ∈ TwoColorComponent G phi alpha beta z) (hinc : Incident G v + f) (hc : phi f = some alpha ∨ phi f = some beta), Sum.inr f ∈ TwoColorComponent G phi + alpha beta z), + let H : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); (if + ett.series.data.kind n = some TashkinovExtensionKind.PE then CombinedStableColoring Tn + base.closure Dn phi sigma else StableColoring Tn Dn phi sigma) ∧ ( + ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) ∧ + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ + ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c : Fin k), c = alpha ∨ c = beta → c ∈ + TreeMissingColors phi (HierarchyStarredStage H r) → TreeColorSetClosed G phi + (HierarchyStarredStage H r) ({ c } : Finset (Fin k)) → OutsideKempeRecoloring + (HierarchyStarredStage H r) phi sigma alpha beta + +private theorem helper_trans_125.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W + Z → TreeSequenceInitialSegment U Z := by + classical + intro V E G e0 U W Z hUW hWZ + refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ + · intro j + exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) j)).trans + (hUW.2.1 j) + · intro j + exact (hWZ.2.2 (Fin.castLE hUW.1 j)).trans (hUW.2.2 j) + +private theorem helper_stageChain_136.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ + j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H trans j + induction j with + | zero => + intro hj i hi + have hi0 : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have heq' : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) + (H.nested ⟨j, by omega⟩) + +private theorem helper_starChain_162.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → ( + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ + j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ))))) → ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H r) + (H.stage r.succ)) → + ∀ (r s : Fin (H.dividerCount + (1 : ℕ))), r ≤ s → TreeSequenceInitialSegment + (HierarchyStarredStage H r) (HierarchyStarredStage H s) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H trans stageChain starStage r s hrs + by_cases heq : r = s + · subst s + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have hrlt : r.val < s.val := by + have := Fin.le_iff_val_le_val.mp hrs + have : r.val ≠ s.val := fun h => heq (Fin.ext h) + omega + have hs : s ≠ 0 := by intro hs; subst s; simp at hrlt + have hstar : HierarchyStarredStage H s = H.stage s.castSucc := by + rw [← Fin.succ_pred s hs] + rfl + rw [hstar] + exact trans (starStage r) + (stageChain s.val (by omega) r.succ (by simp; omega)) + +private theorem helper_hATy_184.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); TreeSequenceInitialSegment A T → TreeSequenceInitialSegment A Ty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hAT + have hlen : A.length ≤ Ty.length := by + change A.length ≤ min (A.length + ((T.length - A.length) - 1)) T.length + exact Nat.le_min.mpr ⟨Nat.le_add_right _ _, hAT.1⟩ + refine ⟨hlen, ?_, ?_⟩ + · intro j + change T.vertex _ = A.vertex j + exact hAT.2.1 j + · intro j + change T.edge _ = A.edge j + exact hAT.2.2 j + +private theorem helper_missingFirst_210.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + TreeSequenceInitialSegment Ty T → + ∀ c ∈ TreeMissingColors phi Ty, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hTyT c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hvT := TreeSequenceInitialSegmentVertexSetSubset hTyT hv + obtain ⟨j, hj⟩ : ∃ j, T.vertex j = v := by + simpa [TreeSequenceVertexSet] using hvT + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex j) + have hcandidates : candidates.Nonempty := by + refine ⟨j, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩⟩ + simpa [hj] using hcv + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hcandidates] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hcandidates)).2 + +private theorem helper_pathMissing_230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → + ∀ (c d : Fin k), c ≠ d → + ∀ (v : V), c ∈ MissingColors G phi v → TwoColorPathComponent G phi c d (Sum.inl v) := by + classical + intro V E _ _ G k phi hproper c d hcd v hc + let _ := Fintype.ofFinite V + refine ⟨hcd, Sum.inl v, ?_, ?_⟩ + · change (TwoColorIncidenceGraph G phi c d).connectedComponentMk + (Sum.inl v) = + (TwoColorIncidenceGraph G phi c d).connectedComponentMk (Sum.inl v) + rfl + · let : Fintype + ((TwoColorIncidenceGraph G phi c d).neighborSet (Sum.inl v)) := + Fintype.ofFinite _ + have hcard : Fintype.card + ((TwoColorIncidenceGraph G phi c d).neighborSet (Sum.inl v)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact MissingColorIncidenceEndpoint G phi c d hcd hproper v hc + intro x hx y hy + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hcard ⟨x, hx⟩ ⟨y, hy⟩) + +private theorem helper_interchangeableSwap_258.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (_ : V ⊕ E), ( + ∀ (c d : Fin k), TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c) → ( + ∀ (c d : Fin k) (z : V ⊕ E), TwoColorComponent G phi c d z = TwoColorComponent G phi d c z) → + ∀ (B : TreeSequence G e0) (c d : Fin k), TreeInterchangeable G B phi c d → TreeInterchangeable + G B phi d c := by + classical + intro V E _ _ G k e0 phi z graphSwap componentSwap B c d hi + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + clear * - hi componentSwap graphSwap + intro z w hz hw hzB hwB + have pathSwap (z : Sum V E) + (hz : TwoColorPathComponent G phi d c z) : + TwoColorPathComponent G phi c d z := by + refine ⟨hz.1.symm, ?_⟩ + simpa only [componentSwap c d, graphSwap c d] using hz.2 + rw [← componentSwap c d z, ← componentSwap c d w] + apply hi z w (pathSwap z hz) (pathSwap w hw) + · simpa only [componentSwap c d] using hzB + · simpa only [componentSwap c d] using hwB + +private theorem helper_hnonPEClosed_278.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → ett.series.data.kind n ≠ some + TashkinovExtensionKind.PE → ColoredVertexSetClosed G phi (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone n Tn trans hnonPE + have hp : 0 < ett.rounds := C.positive + clear * - ett phi n Tn G hproper hone hnonPE hp + have stableClosed (B : TreeSequence G e0) (D : Finset (Fin k)) + (psi : PartialEdgeColoring E k) + (hppsi : IsProperEdgeColoring G psi) + (hopsi : IsOneEdgeUncolored psi e0) + (hcpsi : ColoredVertexSetClosed G psi (TreeSequenceVertexSet B)) + (hs : StableColoring B D psi phi) : + ColoredVertexSetClosed G phi (TreeSequenceVertexSet B) := by + clear * - G phi e0 hproper hone B D psi hppsi hopsi hcpsi hs + intro f c x hf hx hfc hcm + have hincident : TreeIncidentEdge B f := by + obtain ⟨u, hu, v, hv, huv⟩ := by + simpa [BoundaryEdges] using hf + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [huv] + exact Sym2.mem_mk_left _ _ + have hcmPrev : c ∈ MissingColors G psi x := by + rw [← hs.2 x hx] + exact hcm + have hcTree : c ∈ TreeMissingColors psi B := + Finset.mem_biUnion.mpr ⟨x, hx, hcmPrev⟩ + have hfixed : phi f = psi f := + (sc1 G e0 B D psi phi hppsi hopsi hproper hone).mp hs + f hincident (Or.inr ⟨c, Finset.mem_union_left _ hcTree, hfc⟩) + exact hcpsi hf hx (hfixed.symm.trans hfc) hcmPrev + have hphi : phi = ett.series.data.coloring n := ett.generatingColoring + have hstep := ett.series.certified n + generalize targetEq : n = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hn : n ≠ 0 := by + intro hh + have hv := congrArg Fin.val hh + simp [n] at hv + omega + exact (hn targetEq).elim + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact (hnonPE (by rw [targetEq]; exact currentKind)).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i.succ = n := targetEq.symm + have htree : ett.series.data.tree i.succ.castSucc = Tn := by + simp [Tn, hi] + have hselected : choice.selected = phi := + currentColoring.symm.trans + ((congrArg ett.series.data.coloring hi).trans hphi.symm) + have hs : StableColoring Tn + (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc) phi := by + simpa only [htree, hselected] using choice.selectedStable + exact @stableClosed Tn _ _ previousProper previousOneUncolored + (by rw [← htree]; exact previousClosed) hs + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i.succ = n := targetEq.symm + have htree : ett.series.data.tree i.succ.castSucc = Tn := by + simp [Tn, hi] + have hcol : ett.series.data.coloring i.castSucc = phi := + currentColoring.symm.trans + ((congrArg ett.series.data.coloring hi).trans hphi.symm) + have hc : ColoredVertexSetClosed G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn) := by + rw [← htree] + exact previousClosed + exact @Eq.mp _ _ + (congrArg (fun psi => ColoredVertexSetClosed G psi + (TreeSequenceVertexSet Tn)) hcol) hc + +private theorem helper_nonPEMissingClosed_364.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; (ett.series.data.kind n ≠ some + TashkinovExtensionKind.PE → ColoredVertexSetClosed G phi (TreeSequenceVertexSet Tn)) → + ett.series.data.kind n ≠ some TashkinovExtensionKind.PE → + ∀ c ∈ TreeMissingColors phi Tn, TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k)) := by + classical + intro V E _ _ _ G k e0 input T phi ett n Tn hnonPEClosed hnonPE c hc d hd + have hdc : d = c := Finset.mem_singleton.mp hd + subst d + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨x, hx, hcx⟩ := Finset.mem_biUnion.mp hc + have hfd : f ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) ∧ + phi f = some c := by simpa [BoundaryColorEdges] using hf + exact hnonPEClosed hnonPE hfd.1 hx hfd.2 hcx + +private theorem helper_closureA_384.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; TreeSequenceInitialSegment + base.core A → ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n coreA hp + obtain ⟨u⟩ := (base.parallel hp).2.2 + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreA + rw [u.vertexSet] + exact Finset.mem_union_right _ hv + +private theorem helper_firstIn_391.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k), ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → + ∀ (B : TreeSequence G e0), TreeSequenceInitialSegment B T → + ∀ c ∈ TreeMissingColors phi B, T.vertex (HierarchyFirstMissingPosition phi T c) ∈ + TreeSequenceVertexSet B := by + classical + intro V E _ _ G k e0 T phi trans B hBT c hc + let _ := Fintype.ofFinite V + clear * - B hBT c hc + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + obtain ⟨i, hi⟩ : ∃ i, B.vertex i = v := by + simpa [TreeSequenceVertexSet] using hv + let iT := Fin.castLE (Nat.succ_le_succ hBT.1) i + let S := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex j) + have hiS : iT ∈ S := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + simpa only [iT, hBT.2.1 i, hi] using hvc + have hS : S.Nonempty := ⟨iT, hiS⟩ + have hpos : HierarchyFirstMissingPosition phi T c = S.min' hS := by + simp only [HierarchyFirstMissingPosition, S, dite_eq_left hS] + have hbound : (HierarchyFirstMissingPosition phi T c).val ≤ B.length := by + have hh := Finset.min'_le S iT hiS + rw [← hpos] at hh + have := i.isLt + change (HierarchyFirstMissingPosition phi T c).val ≤ i.val at hh + omega + let j : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition phi T c).val, by omega⟩ + have hj : Fin.castLE (Nat.succ_le_succ hBT.1) j = + HierarchyFirstMissingPosition phi T c := Fin.ext rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, (hBT.2.1 j).symm.trans (congrArg T.vertex hj)⟩ + +private theorem helper_halphaA_419.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k), ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; (0 : ℕ) < H.dividerCount ∧ + alpha ∈ TreeMissingColors phi Tnq ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + phi Tn ∨ alpha ∈ TreeMissingColors phi A ∧ alpha ∉ Dn ∧ beta ∉ Dn)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; TreeSequenceInitialSegment Tn A + → alpha ∈ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hcase H q A n Tn TnA + rcases hcase with ⟨hq, ha⟩ | ⟨hq, ha | ha⟩ + · have hq0 : q ≠ 0 := by + intro hz + have hv := congrArg Fin.val hz + change H.dividerCount = 0 at hv + change 0 < H.dividerCount at hq + omega + have hstar : A = H.stage q.castSucc := by + dsimp only [A] + rw [← Fin.succ_pred q hq0] + rfl + have hstage : q.castSucc = + (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := Fin.ext rfl + simpa only [hstar, hstage] using ha + · obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp ha + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset TnA hv, hvm⟩ + · exact ha.1 + +private theorem helper_outsideOfInter_535.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (alpha beta : Fin k), alpha ≠ beta → + ∀ (z : V ⊕ E), TwoColorPathComponent G phi alpha beta z → + ∀ (sigma : PartialEdgeColoring E k), sigma = TwoColorComponentSwap G phi alpha beta z → + ∀ (B : TreeSequence G e0), + ∀ v ∈ TreeSequenceVertexSet B, TwoColorPathComponent G phi alpha beta (Sum.inl v) → + TreeInterchangeable G B phi alpha beta → Sum.inl v ∉ TwoColorComponent G phi alpha beta z + → OutsideKempeRecoloring B phi sigma alpha beta := by + classical + intro V E _ _ G k e0 phi alpha beta hne z hpath sigma hsigma B v hv hp hi hout + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + have avoid (w : V) (hw : w ∈ TreeSequenceVertexSet B) : + Sum.inl w ∉ TwoColorComponent G phi alpha beta z := by + intro hc + have heq := hi z (Sum.inl v) hpath hp ⟨w, hw, hc⟩ ⟨v, hv, rfl⟩ + apply hout + rw [heq] + rfl + refine ⟨hne, {z}, ?_, ?_⟩ + · intro w hw v hv hvB + have hwz := Finset.mem_singleton.mp hw + subst w + exact avoid v hvB hv + · intro f + rw [hsigma] + simp only [TwoColorComponentSwap, Finset.mem_singleton, exists_eq_left] + +private theorem helper_sigmaOne_571.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (alpha beta : Fin k) (z : V ⊕ E) (sigma : PartialEdgeColoring E + k), sigma = TwoColorComponentSwap G phi alpha beta z → IsOneEdgeUncolored phi e0 → + IsOneEdgeUncolored sigma e0 := by + classical + intro V E G k e0 phi alpha beta z sigma hsigma hone + rw [hsigma] + constructor + · simp [TwoColorComponentSwap, hone.1] + · intro f hfe + obtain ⟨c, hc⟩ := hone.2 f hfe + by_cases hf : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · by_cases ha : phi f = some alpha + · exact ⟨beta, by simp [TwoColorComponentSwap, hf, ha]⟩ + · by_cases hb : phi f = some beta + · exact ⟨alpha, by simp [TwoColorComponentSwap, hf, hb]⟩ + · exact ⟨c, by + simp only [TwoColorComponentSwap, ite_eq_left hf, ite_eq_right ha, ite_eq_right hb] + exact hc⟩ + · exact ⟨c, by simp [TwoColorComponentSwap, hf, hc]⟩ + +private theorem helper_nonPEInter_586.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + LowerRoundProperties lower) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → ett.series.data.kind n ≠ some + TashkinovExtensionKind.PE → + ∀ (c d : Fin k), c ∈ TreeMissingColors phi Tn → TreeInterchangeable G Tn phi c d := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower n Tn trans hp c d hc + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have hprev : StableColoring Tn + (TashkinovStoredColors ett.series.data j.castSucc) + (ett.series.data.coloring j.castSucc) phi := by + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => + have hv := congrArg Fin.val hi + simp [n] at hv + have := C.positive + omega + | SE ji _ _ _ _ _ choice _ coloring stored edges kind vertex outside + delta gamma seed adjoin closure ordered strict => + have hji : ji = j := Fin.ext (by + have hv := congrArg Fin.val hi + simp [n, j] at hv ⊢ + omega) + subst ji + have hc : phi = choice.selected := by + simpa only [← hj, coloring, n] using ett.generatingColoring + simpa only [hj, Tn, hc] using choice.selectedStable + | RE ji _ _ _ _ available coloring stored edges kind vertex outside + delta gamma seed adjoin closure ordered strict => + have hji : ji = j := Fin.ext (by + have hv := congrArg Fin.val hi + simp [n, j] at hv ⊢ + omega) + subst ji + have hc : phi = ett.series.data.coloring j.castSucc := by + simpa only [← hj, coloring, n] using ett.generatingColoring + refine ⟨?_, ?_⟩ + · intro f _ _ + exact congrFun hc f + · intro v _ + exact congrArg (fun psi => MissingColors G psi v) hc + | PE ji _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper + one stored edges kind vertex outside delta gammaEq closure ordered strict => + exact (hp (by simpa [← hi] using kind)).elim + have hm : c ∈ TreeMissingColors phi Tn := hc + by_cases hn : 1 < ett.rounds + · obtain ⟨lower, hr, hmax, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T phi ett C.maximum + (ett.rounds - 1) (by omega) (by omega) + let nl : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hcidx : Fin.castLE (by omega) nl = j.castSucc := + Fin.ext (by simp [nl, j, hr]) + have htidx : Fin.castLE (by omega) (Fin.last (lower.rounds + 1)) = + n.castSucc := Fin.ext (by simp [n, hr]; omega) + have ht : lower.series.data.tree (Fin.last (lower.rounds + 1)) = Tn := + (htrees _).trans (congrArg ett.series.data.tree htidx) + obtain ⟨hc, _, _, _, _, _, _, _, hd, _⟩ := hdata nl + rw [hcidx] at hc hd + have hs : StableColoring + (lower.series.data.tree (Fin.last (lower.rounds + 1))) + (TashkinovStoredColors lower.series.data nl) + (lower.series.data.coloring nl) phi := by + rw [ht, hc, hd] + exact hprev + have hi := (hlower lower (by omega) (by omega) hmax).2.1 + phi hproper hone hs c d (Or.inl (by rw [ht]; exact hm)) + simpa only [ht] using hi + · have hn1 : ett.rounds = 1 := by have := C.positive; omega + have hj0 : j.castSucc = (0 : Fin (ett.rounds + 1)) := + Fin.ext (by simp [j, hn1]) + have ht1 : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn1]) + have hs : StableColoring (ett.series.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors ett.series.data 0) + (ett.series.data.coloring 0) phi := by + simpa only [Tn, ht1, hj0] using hprev + have hi := (TechnicalTheoremBase G k ett.rounds e0 input ett.series).2 + phi hproper hone hs c d + (Or.inl (by simpa only [Tn, ht1] using hm)) + have hTn1 : Tn = ett.series.data.tree ⟨1, by omega⟩ := + congrArg ett.series.data.tree ht1 + change TreeInterchangeable G Tn phi c d + rw [hTn1] + exact hi + +private theorem helper_closedStar_669.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + LowerRoundProperties lower) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating'), other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') (_ : + GoodHierarchy K), K.dividerCount < C.hierarchy.dividerCount → ColoredVertexSetElementary G + generating' (TreeSequenceVertexSet T')) → ( + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; (2 : ℕ) * ett.rounds + (11 : ℕ) + ≤ (TreeMissingColors phi Tn).card) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; CombinedStableColoring Tn + base.closure (TashkinovStoredColors ett.series.data n) phi phi → (ett.series.data.kind n ≠ + some TashkinovExtensionKind.PE → + ∀ (c d : Fin k), c ∈ TreeMissingColors phi Tn → TreeInterchangeable G Tn phi c d) → + ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c d : Fin k), c ≠ d → c ∈ TreeMissingColors phi + (HierarchyStarredStage H r) → TreeColorSetClosed G phi (HierarchyStarredStage H r) ({ c } + : Finset (Fin k)) → TreeInterchangeable G (HierarchyStarredStage H r) phi c d := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge H n Tn + hcombined nonPEInter r c d hcd hc hclosed + cases r using Fin.cases with + | zero => + change TreeInterchangeable G base.core phi c d + change c ∈ TreeMissingColors phi base.core at hc + change TreeColorSetClosed G phi base.core {c} at hclosed + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hp base hproper hone hcombined c d).2.2.1 hc hclosed + · rw [base.nonparallel hp] at hc ⊢ + exact nonPEInter hp c d hc + | succ i => + exact step1 G k e0 input T phi ett C.maximum C.positive hproper hone + hlower base H C.good hfewer hlarge i c d hc hcd hclosed + +private theorem helper_closedOutside_690.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k), alpha ≠ beta → + ∀ (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → ( + ∀ (r s : Fin (H.dividerCount + (1 : ℕ))), r ≤ s → TreeSequenceInitialSegment + (HierarchyStarredStage H r) (HierarchyStarredStage H s)) → TreeSequenceInitialSegment A T + → alpha ∈ MissingColors G phi a → ( + ∀ (c d : Fin k), c ≠ d → + ∀ (v : V), c ∈ MissingColors G phi v → TwoColorPathComponent G phi c d (Sum.inl v)) → ( + ∀ (B : TreeSequence G e0) (c d : Fin k), TreeInterchangeable G B phi c d → TreeInterchangeable + G B phi d c) → ( + ∀ (B : TreeSequence G e0), TreeSequenceInitialSegment B T → + ∀ c ∈ TreeMissingColors phi B, T.vertex (HierarchyFirstMissingPosition phi T c) ∈ + TreeSequenceVertexSet B) → Sum.inl a ∉ TwoColorComponent G phi alpha beta z → (beta ∈ + TreeMissingColors phi A → Sum.inl b ∉ TwoColorComponent G phi alpha beta z) → ( + ∀ (B : TreeSequence G e0), + ∀ v ∈ TreeSequenceVertexSet B, TwoColorPathComponent G phi alpha beta (Sum.inl v) → + TreeInterchangeable G B phi alpha beta → Sum.inl v ∉ TwoColorComponent G phi alpha beta z + → OutsideKempeRecoloring B phi sigma alpha beta) → ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c d : Fin k), c ≠ d → c ∈ TreeMissingColors phi + (HierarchyStarredStage H r) → TreeColorSetClosed G phi (HierarchyStarredStage H r) ({ c } + : Finset (Fin k)) → TreeInterchangeable G (HierarchyStarredStage H r) phi c d) → + TwoColorPathComponent G phi alpha beta (Sum.inl b) → + ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c : Fin k), c = alpha ∨ c = beta → c ∈ + TreeMissingColors phi (HierarchyStarredStage H r) → TreeColorSetClosed G phi + (HierarchyStarredStage H r) ({ c } : Finset (Fin k)) → OutsideKempeRecoloring + (HierarchyStarredStage H r) phi sigma alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne z sigma H q A a b trans + starChain hAT haMissing pathMissing interchangeableSwap firstIn haOutside hbOutside + outsideOfInter closedStar betaPath r c hc hm hcl + have hrT := trans (starChain r q (Fin.le_last r)) hAT + rcases hc with hc | hc + · subst c + exact outsideOfInter _ a (firstIn _ hrT alpha hm) + (pathMissing alpha beta hne a haMissing) + (closedStar r alpha beta hne hm hcl) haOutside + · subst c + have hbA : beta ∈ TreeMissingColors phi A := by + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset (starChain r q (Fin.le_last r)) hv, hvm⟩ + exact outsideOfInter _ b (firstIn _ hrT beta hm) betaPath + (interchangeableSwap _ beta alpha (closedStar r beta alpha hne.symm hm hcl)) + (hbOutside hbA) + +private theorem helper_maxClosed_714.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (c : Fin k), ( + ∃ (r : Fin (H.dividerCount + (1 : ℕ))), TreeColorSetClosed G phi (HierarchyStarredStage H r) + ({ c } : Finset (Fin k))) → + ∃ (r : Fin (H.dividerCount + (1 : ℕ))), TreeColorSetClosed G phi (HierarchyStarredStage H r) + ({ c } : Finset (Fin k)) ∧ + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑r : ℕ) < (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ c } : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H c hex + let S := Finset.univ.filter fun r : Fin (H.dividerCount + 1) => + TreeColorSetClosed G phi (HierarchyStarredStage H r) {c} + have hS : S.Nonempty := by + obtain ⟨r, hr⟩ := hex + exact ⟨r, by simp [S, hr]⟩ + refine ⟨S.max' hS, (Finset.mem_filter.mp (Finset.max'_mem S hS)).2, ?_⟩ + intro s hs hcl + have hmem : s ∈ S := by simp [S, hcl] + have hle := Finset.le_max' S s hmem + change s.val ≤ (S.max' hS).val at hle + omega + +private theorem helper_missingAtMax_731.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; ( + ∀ (r s : Fin (H.dividerCount + (1 : ℕ))), r ≤ s → TreeSequenceInitialSegment + (HierarchyStarredStage H r) (HierarchyStarredStage H s)) → ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r))) → ( + ∀ {B S : TreeSequence G e0}, TreeSequenceInitialSegment B S → TreeMissingColors phi B ⊆ + TreeMissingColors phi S) → + ∀ c ∈ TreeMissingColors phi A, + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ( + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑r : ℕ) < (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ c } : Finset (Fin k))) → c ∈ TreeMissingColors phi + (HierarchyStarredStage H r) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A starChain helemStar missingSubset c hcA r + hmax + let P (j : ℕ) := ∃ hj : j ≤ H.dividerCount, + c ∈ TreeMissingColors phi (HierarchyStarredStage H ⟨j, by omega⟩) + have hex : ∃ j, P j := ⟨H.dividerCount, le_rfl, hcA⟩ + let s := Nat.find hex + obtain ⟨hs, hsm⟩ : P s := Nat.find_spec hex + by_cases hsr : s ≤ r.val + · exact missingSubset (starChain ⟨s, by omega⟩ r hsr) hsm + · have hspos : 0 < s := by omega + let i : Fin H.dividerCount := ⟨s - 1, by omega⟩ + have his : i.succ = (⟨s, by omega⟩ : Fin (H.dividerCount + 1)) := + Fin.ext (by simp [i]; omega) + have hprev : c ∉ TreeMissingColors phi (HierarchyStarredStage H i.castSucc) := by + intro hm + have hh : P (s - 1) := ⟨by omega, hm⟩ + have hmin := Nat.find_min' hex hh + change s ≤ s - 1 at hmin + omega + have hsm' : c ∈ TreeMissingColors phi (H.stage i.succ.castSucc) := by + simpa only [← his, HierarchyStarredStage, Fin.cases_succ] using hsm + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hsm' + have hvnew : v ∉ TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc) := by + intro hh + exact hprev (Finset.mem_biUnion.mpr ⟨v, hh, hvm⟩) + have hnew := GoodHierarchyNewMissingClosed C.good i (helemStar i.succ) c + (Finset.mem_biUnion.mpr ⟨v, Finset.mem_sdiff.mpr ⟨hv, hvnew⟩, hvm⟩) + apply False.elim + apply hmax i.succ (by simp [i]; omega) + intro d hd + have heq : d = c := Finset.mem_singleton.mp hd + subst d + exact hnew + +private theorem helper_branch_773.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ {u : V}, ett.rounds = (1 : ℕ) → u ∈ TreeSequenceVertexSet Tn → + ∀ {v : V}, v ∈ TreeSequenceVertexSet Tn → u ≠ v → Disjoint (MissingColors G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; Decidable.byContradiction fun (a : ¬ett.rounds + - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds).castSucc) u) (MissingColors G (ett.series.data.coloring (⟨ett.rounds - (1 + : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; Decidable.byContradiction fun (a : ¬ett.rounds + - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds).castSucc) v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C n Tn _ hn + have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = + 0 := + Fin.ext (by simp [hn]) + have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn]) + dsimp only [Tn] + rw [hcolor, htree] + exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + +private theorem helper_branch_781.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + LowerRoundProperties lower) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ {u : V}, ¬ett.rounds = (1 : ℕ) → u ∈ TreeSequenceVertexSet Tn → + ∀ {v : V}, v ∈ TreeSequenceVertexSet Tn → u ≠ v → Disjoint (MissingColors G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; Decidable.byContradiction fun (a : ¬ett.rounds + - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds).castSucc) u) (MissingColors G (ett.series.data.coloring (⟨ett.rounds - (1 + : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; Decidable.byContradiction fun (a : ¬ett.rounds + - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds).castSucc) v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hlower n Tn _ hn + have hmore : 1 < ett.rounds := by have := C.positive; omega + obtain ⟨predecessor, hr, hmaximum, _, _⟩ := + CertifiedETTPredecessor G k e0 input T phi ett C.maximum hmore + have htree : n.castSucc = (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext rfl + dsimp only [Tn] + rw [htree] + exact (hlower predecessor (by omega) (by omega) hmaximum).1 + +private theorem helper_stableNoAffected_799.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → ( + ∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → ( + ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (B : TreeSequence G e0) (D : Finset (Fin k)), TreeSequenceVertexSet B ⊆ + TreeSequenceVertexSet A → alpha ∉ TreeMissingColors phi B ∪ D → beta ∉ TreeMissingColors + phi B ∪ D → StableColoring B D phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma H q A trans fixedValue + missingA B D hBA hna hnb + refine ⟨?_, fun v hv => missingA v (hBA hv)⟩ + intro f hf hcol + obtain ⟨c, hc, hfc⟩ := hcol + apply fixedValue + · intro ha + have heq : c = alpha := Option.some.inj (hfc.symm.trans ha) + subst c + exact hna hc + · intro hb + have heq : c = beta := Option.some.inj (hfc.symm.trans hb) + subst c + exact hnb hc + +private theorem helper_stableFromCore_816.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (alpha beta : Fin k) (sigma : + PartialEdgeColoring E k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; TreeSequenceInitialSegment Tn + base.core → ( + ∀ (B S : TreeSequence G e0), TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet S → + OutsideKempeRecoloring S phi sigma alpha beta → OutsideKempeRecoloring B phi sigma alpha + beta) → ( + ∀ (B : TreeSequence G e0) (D : Finset (Fin k)), OutsideKempeRecoloring B phi sigma alpha beta + → StableColoring B D phi sigma ∧ + ∀ (f : E), TreeIncidentEdge B f → sigma f = phi f) → + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let baseStable : Prop := if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma else StableColoring Tn Dn phi sigma; + OutsideKempeRecoloring base.core phi sigma alpha beta → baseStable := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base alpha beta sigma n Tn coreChain outsideMono + outsideStable Dn baseStable hout + have hn := (outsideStable Tn Dn (outsideMono Tn base.core + (TreeSequenceInitialSegmentVertexSetSubset coreChain) hout)).1 + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · simp only [baseStable, hp, ite_true] + have hR : TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet base.core := by + obtain ⟨u⟩ := (base.parallel hp).2.2 + rw [u.vertexSet] + exact Finset.subset_union_right + exact ⟨hn, (outsideStable base.closure ∅ + (outsideMono base.closure base.core hR hout)).1⟩ + · simpa only [baseStable, hp, ite_false] using hn + +private theorem helper_branch_833.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; ( + ∀ (r s : Fin (H.dividerCount + (1 : ℕ))), r ≤ s → TreeSequenceInitialSegment + (HierarchyStarredStage H r) (HierarchyStarredStage H s)) → ( + ∀ (B S : TreeSequence G e0), TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet S → + OutsideKempeRecoloring S phi sigma alpha beta → OutsideKempeRecoloring B phi sigma alpha + beta) → ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c : Fin k), c = alpha ∨ c = beta → c ∈ + TreeMissingColors phi (HierarchyStarredStage H r) → TreeColorSetClosed G phi + (HierarchyStarredStage H r) ({ c } : Finset (Fin k)) → OutsideKempeRecoloring + (HierarchyStarredStage H r) phi sigma alpha beta) → ( + ∀ (c : Fin k), ( + ∃ (r : Fin (H.dividerCount + (1 : ℕ))), TreeColorSetClosed G phi (HierarchyStarredStage H r) + ({ c } : Finset (Fin k))) → + ∃ (r : Fin (H.dividerCount + (1 : ℕ))), TreeColorSetClosed G phi (HierarchyStarredStage H r) + ({ c } : Finset (Fin k)) ∧ + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑r : ℕ) < (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ c } : Finset (Fin k))) → ( + ∀ c ∈ TreeMissingColors phi A, + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ( + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑r : ℕ) < (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ c } : Finset (Fin k))) → c ∈ TreeMissingColors phi + (HierarchyStarredStage H r)) → + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let baseStable : Prop := if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma else StableColoring Tn Dn phi sigma; + (OutsideKempeRecoloring base.core phi sigma alpha beta → baseStable) → ( + ∃ (c : Fin k), (c = alpha ∨ c = beta) ∧ c ∈ TreeMissingColors phi A ∧ + ∃ (r : Fin (H.dividerCount + (1 : ℕ))), TreeColorSetClosed G phi (HierarchyStarredStage H r) + ({ c } : Finset (Fin k))) → baseStable := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma H q A n Tn starChain + outsideMono closedOutside maxClosed missingAtMax Dn baseStable stableFromCore hex + obtain ⟨c, hc, hm, hr⟩ := hex + obtain ⟨r, hcl, hmax⟩ := maxClosed c hr + have hmr := missingAtMax c hm r hmax + have hout := closedOutside r c hc hmr hcl + exact stableFromCore (outsideMono base.core _ + (TreeSequenceInitialSegmentVertexSetSubset (starChain 0 r (Fin.zero_le _))) hout) + +private theorem helper_missingA_1163.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k) (_ : alpha ≠ beta) (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) (Nat.min_le_right + (A.length + (ell - (1 : ℕ))) T.length); alpha ∈ TreeMissingColors phi Ty ∧ beta ∈ + TreeMissingColors phi Ty) (z : V ⊕ E) (_ : TwoColorPathComponent G phi alpha beta z) + (sigma : PartialEdgeColoring E k) (_ : sigma = TwoColorComponentSwap G phi alpha beta z) + (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; (0 : ℕ) < H.dividerCount ∧ + alpha ∈ TreeMissingColors phi Tnq ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + phi Tn ∨ alpha ∈ TreeMissingColors phi A ∧ alpha ∉ Dn ∧ beta ∉ Dn)) (_ : + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); Disjoint + (TwoColorComponent G phi alpha beta z) (TwoColorComponent G phi alpha beta (Sum.inl va))) + (_ : IsProperEdgeColoring G phi), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + ∀ (_ : alpha ∈ MissingColors G phi a) (_ : beta ∈ MissingColors G phi b) (_ : alpha ∈ + TreeMissingColors phi A) (_ : a ∈ TreeSequenceVertexSet A) (_ : + ∀ (_ : beta ∈ TreeMissingColors phi A), TwoColorComponent G phi alpha beta (Sum.inl a) = + TwoColorComponent G phi alpha beta (Sum.inl b)) (_ : Sum.inl a ∉ TwoColorComponent G phi + alpha beta z) (_ : + ∀ (_ : beta ∈ TreeMissingColors phi A), Sum.inl b ∉ TwoColorComponent G phi alpha beta z) (_ : + ∀ (c : Fin k) (_ : c ∈ TreeMissingColors phi A) (v : V) (_ : v ∈ TreeSequenceVertexSet A) (_ : + c ∈ MissingColors G phi v) (_ : c ∈ MissingColors G phi (T.vertex + (HierarchyFirstMissingPosition phi T c))), v = T.vertex (HierarchyFirstMissingPosition phi + T c)) (_ : + ∀ {v : V} {f : E} (_ : Sum.inl v ∈ TwoColorComponent G phi alpha beta z) (_ : Incident G v f) + (_ : phi f = some alpha ∨ phi f = some beta), Sum.inr f ∈ TwoColorComponent G phi alpha + beta z) (_ : + ∀ (f : E) (_ : phi f ≠ some alpha) (_ : phi f ≠ some beta), sigma f = phi f) (v : V) (_ : v ∈ + TreeSequenceVertexSet A), MissingColors G sigma v = MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne hmissingPrefix z hpath sigma + hsigma hcase hdisjoint hproper H q A a b haMissing hbMissing halphaA haA hsame haOutside + hbOutside missingUnique edgeOfVertex fixedValue v hv + have behavior := TwoColorComponentSwapMissingBehavior G phi alpha beta hne hproper z + rw [hsigma] + by_cases hout : Sum.inl v ∉ TwoColorComponent G phi alpha beta z + · exact behavior.1 v hout + · have hin : Sum.inl v ∈ TwoColorComponent G phi alpha beta z := not_not.mp hout + have hna : alpha ∉ MissingColors G phi v := by + intro hm + have heq := missingUnique alpha halphaA v hv hm haMissing + subst v + exact haOutside hin + have hnb : beta ∉ MissingColors G phi v := by + intro hm + have hbA : beta ∈ TreeMissingColors phi A := Finset.mem_biUnion.mpr ⟨v, hv, hm⟩ + have heq := missingUnique beta hbA v hv hm hbMissing + subst v + exact hbOutside hbA hin + have newPresent (c d : Fin k) (hcd : c = alpha ∧ d = beta ∨ c = beta ∧ d = alpha) + (hd : d ∉ MissingColors G phi v) : + c ∉ MissingColors G (TwoColorComponentSwap G phi alpha beta z) v := by + have hp : d ∈ PresentColors G phi v := by simpa [MissingColors] using hd + obtain ⟨f, hf, hcol⟩ : ∃ f, Incident G v f ∧ phi f = some d := by + simpa [PresentColors] using hp + have hfe : Sum.inr f ∈ TwoColorComponent G phi alpha beta z := by + apply edgeOfVertex hin hf + rcases hcd with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inr hcol + · exact Or.inl hcol + have hnew : TwoColorComponentSwap G phi alpha beta z f = some c := by + rcases hcd with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · simp [TwoColorComponentSwap, hfe, hcol, hne.symm] + · simp [TwoColorComponentSwap, hfe, hcol] + have hpnew : c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hf, hnew⟩ + simpa [MissingColors] using hpnew + apply Finset.ext + intro c + by_cases hca : c = alpha + · subst c + simp only [hna, newPresent alpha beta (Or.inl ⟨rfl, rfl⟩) hnb] + · by_cases hcb : c = beta + · subst c + simp only [hnb, newPresent beta alpha (Or.inr ⟨rfl, rfl⟩) hna] + · exact behavior.2.2.2 v c hca hcb + +private theorem helper_baseStableProof_1297.{u_1, u_2} : + helperBaseStableProof1297Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hprefixElementary alpha beta hne z sigma hcase + hproper hone hlower H q A n Tn a trans starChain hAT haMissing pathMissing + interchangeableSwap hcombined nonPEMissingClosed coreChain TnA closureA firstIn halphaA haA + haOutside missingUnique outsideOfInter outsideMono outsideStable closedOutside maxClosed + missingAtMax preStepElementary lastZero Dn baseStable stableNoAffected stableFromCore + by_cases hex : ∃ c : Fin k, (c = alpha ∨ c = beta) ∧ + c ∈ TreeMissingColors phi A ∧ + ∃ r, TreeColorSetClosed G phi (HierarchyStarredStage H r) {c} + · exact @helper_branch_833 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@sigma) + (@starChain) (@outsideMono) (@closedOutside) (@maxClosed) (@missingAtMax) (@stableFromCore) + (@hex) + · have noClosed (c : Fin k) (hc : c = alpha ∨ c = beta) + (hm : c ∈ TreeMissingColors phi A) (r : Fin (H.dividerCount + 1)) : + ¬ TreeColorSetClosed G phi (HierarchyStarredStage H r) {c} := by + intro hr + exact hex ⟨c, hc, hm, r, hr⟩ + have hpe : ett.series.data.kind n = some TashkinovExtensionKind.PE := by + by_contra hp + by_cases hq : 0 < H.dividerCount + · have hh := (rutcor G k e0 input T phi ett base H C.good hq + hprefixElementary preStepElementary alpha halphaA).2 + (noClosed alpha (Or.inl rfl) halphaA) + exact hp hh.2.1 + · have hz : H.dividerCount = 0 := by omega + have hm : alpha ∈ TreeMissingColors phi Tn := by + simpa only [lastZero hz, base.nonparallel hp] using halphaA + apply noClosed alpha (Or.inl rfl) halphaA 0 + change TreeColorSetClosed G phi base.core {alpha} + rw [base.nonparallel hp] + exact nonPEMissingClosed hp alpha hm + have haCore : a ∈ TreeSequenceVertexSet base.core := by + by_cases hq : 0 < H.dividerCount + · have hh := (rutcor G k e0 input T phi ett base H C.good hq + hprefixElementary preStepElementary alpha halphaA).2 + (noClosed alpha (Or.inl rfl) halphaA) + exact TreeSequenceInitialSegmentVertexSetSubset coreChain + (Finset.mem_sdiff.mp hh.2.2.1).1 + · simpa only [lastZero (by omega)] using haA + have haNnotR : ¬ (a ∈ TreeSequenceVertexSet Tn ∧ a ∈ TreeSequenceVertexSet base.closure) := by + intro hh + have hmN : alpha ∈ TreeMissingColors phi Tn := Finset.mem_biUnion.mpr ⟨a, hh.1, haMissing⟩ + have hmR : alpha ∈ TreeMissingColors phi base.closure := Finset.mem_biUnion.mpr ⟨a, hh.2, + haMissing⟩ + have hcl := ParallelCommonMissingClosed G k e0 input T phi phi ett + C.positive base ett.generatingColoring hpe preStepElementary alpha + (Finset.mem_inter.mpr ⟨hmN, hmR⟩) + apply noClosed alpha (Or.inl rfl) halphaA 0 + intro c hc + have heq : c = alpha := Finset.mem_singleton.mp hc + subst c + exact hcl + have hRsub := closureA hpe + have hi := interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hpe base hproper hone hcombined alpha beta + have hj := interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hpe base hproper hone hcombined beta alpha + by_cases haN : a ∈ TreeSequenceVertexSet Tn + · have hmN : alpha ∈ TreeMissingColors phi Tn := Finset.mem_biUnion.mpr ⟨a, haN, haMissing⟩ + have houtN := outsideOfInter Tn a haN (pathMissing alpha beta hne a haMissing) + (hi.2.1 hmN) haOutside + by_cases hbR : beta ∈ TreeMissingColors phi base.closure + · exact stableFromCore (outsideOfInter base.core a haCore + (pathMissing alpha beta hne a haMissing) (hi.2.2.2 hmN hbR) haOutside) + · have hnaR : alpha ∉ TreeMissingColors phi base.closure := by + intro hm + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + have heq := missingUnique alpha halphaA v (hRsub hv) hvm haMissing + subst v + exact haNnotR ⟨haN, hv⟩ + have hn := (outsideStable Tn Dn houtN).1 + have hr := stableNoAffected base.closure ∅ hRsub + (by simpa only [Finset.union_empty] using hnaR) + (by simpa only [Finset.union_empty] using hbR) + simpa only [baseStable, hpe, ite_true, CombinedStableColoring] using And.intro hn hr + · obtain ⟨u⟩ := (base.parallel hpe).2.2 + have haR : a ∈ TreeSequenceVertexSet base.closure := by + have hh : a ∈ TreeSequenceVertexSet Tn ∨ a ∈ TreeSequenceVertexSet base.closure := by + simpa only [u.vertexSet, Finset.mem_union] using haCore + exact hh.resolve_left haN + have hmR : alpha ∈ TreeMissingColors phi base.closure := Finset.mem_biUnion.mpr ⟨a, haR, + haMissing⟩ + have houtR := outsideOfInter base.closure a haR (pathMissing alpha beta hne a haMissing) + (hi.1 hmR) haOutside + by_cases hbN : beta ∈ TreeMissingColors phi Tn + · exact stableFromCore (outsideOfInter base.core a haCore + (pathMissing alpha beta hne a haMissing) + (interchangeableSwap base.core beta alpha (hj.2.2.2 hbN hmR)) haOutside) + · have hnaN : alpha ∉ TreeMissingColors phi Tn := by + intro hm + have ha := firstIn Tn (trans TnA hAT) alpha hm + exact haN ha + have hzero : H.dividerCount = 0 := by + by_contra hn + have hq : 0 < H.dividerCount := by omega + have hh := (rutcor G k e0 input T phi ett base H C.good hq + hprefixElementary preStepElementary alpha halphaA).2 + (noClosed alpha (Or.inl rfl) halphaA) + exact haN (Finset.mem_sdiff.mp hh.2.2.1).1 + have hDn : alpha ∉ Dn ∧ beta ∉ Dn := by + rcases hcase with h | ⟨hq, h | h⟩ + · have hp : 0 < H.dividerCount := h.1 + omega + · exact (hnaN h).elim + · exact h.2 + have hn := stableNoAffected Tn Dn (TreeSequenceInitialSegmentVertexSetSubset TnA) + (by simpa only [Finset.mem_union, not_or] using And.intro hnaN hDn.1) + (by simpa only [Finset.mem_union, not_or] using And.intro hbN hDn.2) + have hr := (outsideStable base.closure ∅ houtR).1 + simpa only [baseStable, hpe, ite_true, CombinedStableColoring] using And.intro hn hr + +private theorem helper_continuation_1245.{u_1, u_2} : + helperContinuation1245Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hprefixElementary alpha beta hne hmissingPrefix + z hpath sigma hsigma hcase hdisjoint hproper hone hlower hfewer hlarge H q A n Tn a b trans + starChain hAT helemStar haMissing hbMissing pathMissing graphSwap componentSwap + interchangeableSwap hcombined nonPEMissingClosed coreChain TnA closureA firstIn halphaA haA + hsame haOutside hbOutside missingUnique edgeOfVertex + have fixedValue (f : E) (ha : phi f ≠ some alpha) (hb : phi f ≠ some beta) : + sigma f = phi f := by + rw [hsigma] + simp only [TwoColorComponentSwap] + split_ifs <;> simp_all + have missingA := @helper_missingA_1163 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) + (@hmissingPrefix) (@z) (@hpath) (@sigma) (@hsigma) (@hcase) (@hdisjoint) (@hproper) + (@haMissing) (@hbMissing) (@halphaA) (@haA) (@hsame) (@haOutside) (@hbOutside) + (@missingUnique) (@edgeOfVertex) (@fixedValue) + have outsideOfInter := @helper_outsideOfInter_535 (@V) (@E) inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@alpha) (@beta) (@hne) (@z) (@hpath) + (@sigma) (@hsigma) + have outsideMono (B S : TreeSequence G e0) + (hBS : TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet S) + (hout : OutsideKempeRecoloring S phi sigma alpha beta) : + OutsideKempeRecoloring B phi sigma alpha beta := by + rcases hout with ⟨hn, roots, ha, hb⟩ + exact ⟨hn, roots, fun z hz v hv hm => ha z hz v hv (hBS hm), hb⟩ + have outsideStable (B : TreeSequence G e0) (D : Finset (Fin k)) + (hout : OutsideKempeRecoloring B phi sigma alpha beta) : + StableColoring B D phi sigma ∧ + (∀ f, TreeIncidentEdge B f → sigma f = phi f) := by + have hh := OutsideKempeRecoloringStable G e0 B D phi sigma alpha beta hproper hone hout + exact ⟨hh.2.2.1, hh.2.2.2.2⟩ + have sigmaProper : IsProperEdgeColoring G sigma := by + rw [hsigma] + exact TwoColorComponentSwapProper G phi alpha beta hne hproper z + have sigmaOne := @helper_sigmaOne_571 (@V) (@E) (@G) (@k) (@e0) (@phi) (@alpha) (@beta) (@z) + (@sigma) (@hsigma) (@hone) + have nonPEInter := @helper_nonPEInter_586 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@trans) + have closedStar := @helper_closedStar_669 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hfewer) (@hlarge) (@hcombined) (@nonPEInter) + have betaPath : TwoColorPathComponent G phi alpha beta (Sum.inl b) := by + have hp := pathMissing beta alpha hne.symm b hbMissing + refine ⟨hne, ?_⟩ + simpa only [componentSwap alpha beta, graphSwap alpha beta] using hp.2 + have closedOutside := @helper_closedOutside_690 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hne) (@z) (@sigma) (@trans) (@starChain) (@hAT) (@haMissing) (@pathMissing) + (@interchangeableSwap) (@firstIn) (@haOutside) (@hbOutside) (@outsideOfInter) (@closedStar) + (@betaPath) + have missingSubset {B S : TreeSequence G e0} (hBS : TreeSequenceInitialSegment B S) : + TreeMissingColors phi B ⊆ TreeMissingColors phi S := by + intro c hc + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hBS hv, hvm⟩ + have maxClosed := @helper_maxClosed_714 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + have missingAtMax := @helper_missingAtMax_731 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@starChain) + (@helemStar) (@missingSubset) + have preStepElementary : + let i : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn) := by + dsimp only + by_cases hn : ett.rounds = 1 + · exact @helper_branch_773 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) _ (@hn) + · exact @helper_branch_781 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hlower) _ (@hn) + have lastZero (hq : H.dividerCount = 0) : A = base.core := by + have hz : q = 0 := Fin.ext hq + dsimp only [A] + rw [hz] + rfl + let Dn := TashkinovStoredColors ett.series.data n + let baseStable : Prop := + if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma + have stableNoAffected := @helper_stableNoAffected_799 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@sigma) (@trans) (@fixedValue) (@missingA) + have stableFromCore := @helper_stableFromCore_816 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@alpha) + (@beta) (@sigma) (@coreChain) (@outsideMono) (@outsideStable) + have baseStableProof := @helper_baseStableProof_1297 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hprefixElementary) (@alpha) (@beta) (@hne) (@z) (@sigma) (@hcase) (@hproper) (@hone) + (@hlower) (@trans) (@starChain) (@hAT) (@haMissing) (@pathMissing) (@interchangeableSwap) + (@hcombined) (@nonPEMissingClosed) (@coreChain) (@TnA) (@closureA) (@firstIn) (@halphaA) + (@haA) (@haOutside) (@missingUnique) (@outsideOfInter) (@outsideMono) (@outsideStable) + (@closedOutside) (@maxClosed) (@missingAtMax) (@preStepElementary) (@lastZero) + (@stableNoAffected) (@stableFromCore) + exact ⟨baseStableProof, missingA, sigmaProper, sigmaOne, closedOutside⟩ + +theorem P2813_T1_BaseControl {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (hprefixElementary : + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)))) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + alpha ∈ TreeMissingColors phi (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) ∧ + beta ∈ TreeMissingColors phi (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1))) + (z : Sum V E) (hpath : TwoColorPathComponent G phi alpha beta z) + (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hcase : + (0 < C.hierarchy.dividerCount ∧ + alpha ∈ TreeMissingColors phi + (C.hierarchy.stage ⟨C.hierarchy.dividerCount, by omega⟩)) ∨ + (C.hierarchy.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∨ + (alpha ∈ TreeMissingColors phi + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) ∧ + alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) ∧ + beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds))))) + (hdisjoint : + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) : + let H := C.hierarchy + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) ∧ + (∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) ∧ + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ + (∀ (r : Fin (H.dividerCount + 1)) (c : Fin k), + (c = alpha ∨ c = beta) → + c ∈ TreeMissingColors phi (HierarchyStarredStage H r) → + TreeColorSetClosed G phi (HierarchyStarredStage H r) {c} → + OutsideKempeRecoloring (HierarchyStarredStage H r) phi sigma alpha beta) := by + classical + rcases ctx with ⟨hproper, hone, hlower, hfewer, hminimal, hlarge⟩ + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let a := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let b := T.vertex (HierarchyFirstMissingPosition phi T beta) + let Ty := TreeSequencePrefix T + (min (A.length + ((T.length - A.length) - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have trans := @helper_trans_125 (@V) (@E) (@G) (@e0) + have stageChain := @helper_stageChain_136 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) + have starStage (r : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H r) + (H.stage r.succ) := by + clear * - H r + refine Fin.cases ?_ (fun i => ?_) r + · exact H.coreInsideFirst + · exact H.nested i.succ + have starChain := @helper_starChain_162 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) (@stageChain) + (@starStage) + have hAT : TreeSequenceInitialSegment A T := by + have hh := starStage q + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa [hlast, H.terminalStage] using hh + have hATy := @helper_hATy_184 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) + have hTyT : TreeSequenceInitialSegment Ty T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have helemA : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by + intro u hu v hv hne' + exact hprefixElementary + (TreeSequenceInitialSegmentVertexSetSubset hATy hu) + (TreeSequenceInitialSegmentVertexSetSubset hATy hv) hne' + have helemStar (r : Fin (H.dividerCount + 1)) : + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r)) := by + have hsub := TreeSequenceInitialSegmentVertexSetSubset + (starChain r q (Fin.le_last r)) + intro u hu v hv hne' + exact helemA (hsub hu) (hsub hv) hne' + have missingFirst := @helper_missingFirst_210 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hTyT) + have haMissing : alpha ∈ MissingColors G phi a := + missingFirst alpha hmissingPrefix.1 + have hbMissing : beta ∈ MissingColors G phi b := + missingFirst beta hmissingPrefix.2 + have pathMissing := @helper_pathMissing_230 (@V) (@E) inferInstance inferInstance (@G) (@k) (@phi) + (@hproper) + have graphSwap (c d : Fin k) : + TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c := by + clear * - G phi c d + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + have componentSwap (c d : Fin k) (z : Sum V E) : + TwoColorComponent G phi c d z = TwoColorComponent G phi d c z := by + unfold TwoColorComponent + rw [graphSwap] + have interchangeableSwap := @helper_interchangeableSwap_258 (@V) (@E) inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@z) (@graphSwap) (@componentSwap) + have stableRefl (B : TreeSequence G e0) (D : Finset (Fin k)) : + StableColoring B D phi phi := + ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ + have hcombined : CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data n) phi phi := + ⟨stableRefl _ _, stableRefl _ _⟩ + have hnonPEClosed := @helper_hnonPEClosed_278 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@trans) + have nonPEMissingClosed := @helper_nonPEMissingClosed_364 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hnonPEClosed) + have coreChain : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (base.parallel hp).2.2.some.leftSegment + · rw [base.nonparallel hp] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have coreA : TreeSequenceInitialSegment base.core A := starChain 0 q (Fin.zero_le _) + have TnA := trans coreChain coreA + have closureA := @helper_closureA_384 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@coreA) + have firstIn := @helper_firstIn_391 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@phi) (@trans) + have halphaA := @helper_halphaA_419 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hcase) (@TnA) + have haA : a ∈ TreeSequenceVertexSet A := firstIn A hAT alpha halphaA + have hsame (hbA : beta ∈ TreeMissingColors phi A) : + TwoColorComponent G phi alpha beta (Sum.inl a) = + TwoColorComponent G phi alpha beta (Sum.inl b) := by + have hh := ChangeLemmaBothInside G k e0 input T phi ett base C hproper hone + hlower hfewer hminimal hprefixElementary hlarge alpha beta hne hmissingPrefix + (fun h => (h.elim (fun hn => hn halphaA) (fun hn => hn hbA)).elim) + ⟨haA, firstIn A hAT beta hbA⟩ + rcases hcase with ⟨hq, hm⟩ | ⟨hq, hm⟩ + · exact hh.1 ⟨hq, Or.inl hm⟩ + · apply hh.2.1 + refine ⟨hq, ?_⟩ + rcases hm with hm | hm + · exact Or.inl hm + · right + apply Finset.disjoint_left.mpr + intro c hc hd + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with rfl | rfl + · exact hm.2.1 hd + · exact hm.2.2 hd + have haOutside : Sum.inl a ∉ TwoColorComponent G phi alpha beta z := by + intro ha + exact Set.disjoint_left.mp hdisjoint ha (show Sum.inl a ∈ + TwoColorComponent G phi alpha beta (Sum.inl a) from rfl) + have hbOutside (hbA : beta ∈ TreeMissingColors phi A) : + Sum.inl b ∉ TwoColorComponent G phi alpha beta z := by + intro hb + apply Set.disjoint_left.mp hdisjoint hb + rw [hsame hbA] + rfl + have missingUnique (c : Fin k) (hc : c ∈ TreeMissingColors phi A) + (v : V) (hv : v ∈ TreeSequenceVertexSet A) + (hvc : c ∈ MissingColors G phi v) + (hcm : c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c))) : + v = T.vertex (HierarchyFirstMissingPosition phi T c) := by + by_contra hn + exact Finset.disjoint_left.mp + (helemA hv (firstIn A hAT c hc) hn) hvc hcm + have edgeOfVertex {v : V} {f : E} + (hv : Sum.inl v ∈ TwoColorComponent G phi alpha beta z) + (hinc : Incident G v f) (hc : phi f = some alpha ∨ phi f = some beta) : + Sum.inr f ∈ TwoColorComponent G phi alpha beta z := by + have hadj : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inr f) (Sum.inl v) := ⟨hinc, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv + exact @helper_continuation_1245 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hprefixElementary) + (@alpha) (@beta) (@hne) (@hmissingPrefix) (@z) (@hpath) (@sigma) (@hsigma) (@hcase) + (@hdisjoint) (@hproper) (@hone) (@hlower) (@hfewer) (@hlarge) (@trans) (@starChain) (@hAT) + (@helemStar) (@haMissing) (@hbMissing) (@pathMissing) (@graphSwap) (@componentSwap) + (@interchangeableSwap) (@hcombined) (@nonPEMissingClosed) (@coreChain) (@TnA) (@closureA) + (@firstIn) (@halphaA) (@haA) (@hsame) (@haOutside) (@hbOutside) (@missingUnique) + (@edgeOfVertex) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/BaseDisplayedEdges.lean b/LeanPool/GoldbergSeymour/BaseDisplayedEdges.lean new file mode 100644 index 0000000000..1f1f2baa21 --- /dev/null +++ b/LeanPool/GoldbergSeymour/BaseDisplayedEdges.lean @@ -0,0 +1,147 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.CombinedStableColoring + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# P2813_T1_Base Displayed Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem P2813_T1_BaseDisplayedEdges {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (sigma : PartialEdgeColoring E k) + (hone : IsOneEdgeUncolored phi e0) + (hsone : IsOneEdgeUncolored sigma e0) + (hstable : + let n := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) : + ∀ t : Fin base.core.length, + sigma (base.core.edge t) = phi (base.core.edge t) := by + classical + let n := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + change (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) at hstable + have hnStable : StableColoring Tn Dn phi sigma := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (ite_eq_left hp ▸ hstable).1 + · simpa only [hp, ite_false] using hstable + have treeFixed (t : Fin Tn.length) : + sigma (Tn.edge t) = phi (Tn.edge t) := by + by_cases ht : t.val = 0 + · have he : Tn.edge t = e0 := by + rw [show t = ⟨0, Tn.positive⟩ from Fin.ext ht] + exact Tn.first_edge + rw [he, hone.1, hsone.1] + · obtain ⟨c, hc⟩ := hone.2 (Tn.edge t) (by + intro he + have hh : Tn.edge t = Tn.edge ⟨0, Tn.positive⟩ := + he.trans Tn.first_edge.symm + have hv := congrArg Fin.val (Tn.edge_injective hh) + exact ht hv) + let j : Fin ett.rounds := ⟨ett.rounds - 1, by + have := ett.roundsPositive; omega⟩ + have hj : j.succ = n := Fin.ext (by + dsimp [j, n]; have := ett.roundsPositive; omega) + have hu : c ∈ TreeUsedColors (ett.series.data.coloring j.succ) + (ett.series.data.tree j.succ.castSucc) := by + simp only [hj, ← ett.generatingColoring, n] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, by omega, hc⟩ + have hm : c ∈ TreeMissingColors phi Tn ∪ Dn := by + simpa only [hj, ← ett.generatingColoring, Tn, Dn, n] using + (HkuTreeColorsControlled G k ett.rounds e0 input ett.series j).2.1 hu + have hi : TreeIncidentEdge Tn (Tn.edge t) := by + obtain ⟨i, hi⟩ := Tn.attaches t + refine ⟨Tn.vertex t.succ, ?_, ?_⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + exact ⟨t.succ, rfl⟩ + · rw [Incident, hi] + exact Sym2.mem_mk_left _ _ + exact hnStable.1 _ hi ⟨c, hm, hc⟩ + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · have hrStable : StableColoring base.closure ∅ phi sigma := + (ite_eq_left hp ▸ hstable).2 + obtain ⟨union⟩ := (base.parallel hp).2.2 + let P := TreeSequencePrefix Tn base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt) + have hPN : TreeSequenceInitialSegment P Tn := + ⟨Nat.le_of_lt_succ base.supportPosition.isLt, fun _ => rfl, fun _ => rfl⟩ + have hseq : TashkinovAugmentationSequence phi P base.closure := + (base.parallel hp).2.1.1 + have hPR := TashkinovAugmentationSequenceInitialSegment phi P base.closure hseq + have closureFixed (t : Fin base.closure.length) : + sigma (base.closure.edge t) = phi (base.closure.edge t) := by + by_cases ht : t.val < P.length + · let u : Fin P.length := ⟨t.val, ht⟩ + have he : Fin.castLE hPR.1 u = t := Fin.ext rfl + rw [← he, hPR.2.2 u, ← hPN.2.2 u] + exact treeFixed _ + · obtain ⟨hlen, hinit, c, hcol, hm⟩ := + (TashkinovAugmentationSequencePosition phi P base.closure hseq t (by omega)).1 + have hcolR : phi (base.closure.edge t) = some c := by + convert hcol using 1 + congr 2 + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + have hprefix : TreeSequenceInitialSegment + (TreeSequencePrefix base.closure t.val + (le_trans P.positive (by omega)) (Nat.le_of_lt t.isLt)) + base.closure := ⟨Nat.le_of_lt t.isLt, fun _ => rfl, fun _ => rfl⟩ + have hmR : c ∈ TreeMissingColors phi base.closure := + Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hprefix hv, hvm⟩ + have hiR : TreeIncidentEdge base.closure (base.closure.edge t) := by + obtain ⟨i, hi⟩ := base.closure.attaches t + refine ⟨base.closure.vertex t.succ, ?_, ?_⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + exact ⟨t.succ, rfl⟩ + · rw [Incident, hi] + exact Sym2.mem_mk_left _ _ + exact hrStable.1 _ hiR ⟨c, Finset.mem_union_left ∅ hmR, hcolR⟩ + intro t + by_cases ht : t.val < Tn.length + · let u : Fin Tn.length := ⟨t.val, ht⟩ + have he : Fin.castLE union.leftSegment.1 u = t := Fin.ext rfl + rw [← he, union.leftSegment.2.2 u] + exact treeFixed u + · obtain ⟨i, hi, _⟩ := union.newEntryFromRight t (Nat.le_of_not_gt ht) + rw [hi] + exact closureFixed i + · rw [base.nonparallel hp] + exact treeFixed + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean b/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean new file mode 100644 index 0000000000..3097e6a5fa --- /dev/null +++ b/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean @@ -0,0 +1,1254 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoStarredTail +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# P2905_T2_Base Extra Replacement + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation903Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + ∀ alpha ∉ (HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount)).biUnion + (C.good.gamma (Fin.last C.hierarchy.dividerCount)), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (C.good.gamma q); + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → TreeSequenceInitialSegment base.core B → + ∀ beta ∈ TreeMissingColors phi Tn, beta ∉ Gamma ∧ beta ∉ M0 → beta ∈ TreeMissingColors phi A → + alpha ∈ TreeMissingColors phi A → beta ≠ alpha → beta ∈ TreeMissingColors phi B ∧ alpha ∈ + TreeMissingColors phi B → (T.vertex (HierarchyFirstMissingPosition phi T beta) ∈ + TreeSequenceVertexSet A ∧ beta ∈ MissingColors G phi (T.vertex + (HierarchyFirstMissingPosition phi T beta))) ∧ (↑(HierarchyFirstMissingPosition phi T + beta) : ℕ) ≤ A.length → + let u : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + let _ : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let w : V := T.vertex (Fin.last T.length); B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → w ≠ u → Disjoint (TwoColorComponent G phi beta alpha + (Sum.inl w)) (TwoColorComponent G phi beta alpha (Sum.inl u)) → TwoColorPathComponent G + phi beta alpha (Sum.inl w) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G phi beta alpha + (Sum.inl w)) x = MissingColors G phi x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta alpha (Sum.inl w); + sigma = TwoColorComponentSwap G phi beta alpha (Sum.inl w) → beta ∈ MissingColors G sigma + w → ( + ∀ c ∈ TreeMissingColors phi A, c ∈ TreeMissingColors sigma A) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∃ beta ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), beta ∈ TreeMissingColors + P.coloring (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) ∧ + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc; beta ∉ (HierarchyStoredColorsAt H + q).biUnion (P.counterexample.good.gamma q) ∪ (TreeSequenceVertexSet P.replacementBase.core + \ TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v + +private theorem helper_hCoreB_124.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + ∀ alpha ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment base.core B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha hstar H q A ell B segTrans hAB + have hcoreA : TreeSequenceInitialSegment base.core A := by + by_cases hq : H.dividerCount = 0 + · have hA : A = base.core := by + simp [A, q, HierarchyStarredStage, hq, Fin.last] + rw [hA] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have hstar : A = H.stage q.castSucc := by + have hAstage : A = H.stage ⟨H.dividerCount, by omega⟩ := by + have hlast : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp + omega + dsimp [A, q, HierarchyStarredStage] + rw [hlast] + simp only [Fin.cases] + apply congrArg H.stage + apply Fin.ext + simp + omega + have hidx : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = q.castSucc := by + apply Fin.ext + rfl + rw [hAstage, hidx] + have chain : TreeSequenceInitialSegment (H.stage 1) A := by + have reach : ∀ (m : ℕ) (hm : m ≤ H.dividerCount) (hlow : 1 ≤ m), + TreeSequenceInitialSegment (H.stage 1) (H.stage ⟨m, by omega⟩) := by + intro m + induction m with + | zero => intro hm hlow; omega + | succ m ih => + intro hm hlow + by_cases hm : m = 0 + · subst m + have hidx : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) := rfl + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have hprev := ih (by omega) (by omega) + let j : Fin (H.dividerCount + 1) := ⟨m, by omega⟩ + have hstep := H.nested j + have heq₁ : j.castSucc = (⟨m, by omega⟩ : Fin (H.dividerCount + 2)) := by + apply Fin.ext + rfl + have heq₂ : j.succ = (⟨m + 1, by omega⟩ : Fin (H.dividerCount + 2)) := by + apply Fin.ext + rfl + rw [heq₁, heq₂] at hstep + exact segTrans hprev hstep + have hf := reach H.dividerCount (by omega) (by omega) + rw [hstar] + have hidx : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = q.castSucc := by + apply Fin.ext + rfl + rw [← hidx] + exact hf + exact segTrans H.coreInsideFirst chain + exact segTrans hcoreA hAB + +private theorem helper_hcoreA_183.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → TreeSequenceInitialSegment base.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A segTrans + by_cases hq : H.dividerCount = 0 + · have hA : A = base.core := by simp [A, q, HierarchyStarredStage, hq, Fin.last] + rw [hA] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have hAstage : A = H.stage ⟨H.dividerCount, by omega⟩ := by + have hlast : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp + omega + dsimp [A, q, HierarchyStarredStage] + rw [hlast] + simp only [Fin.cases] + apply congrArg H.stage + apply Fin.ext + simp + omega + have chain : TreeSequenceInitialSegment (H.stage 1) A := by + have reach : ∀ (m : ℕ) (hm : m ≤ H.dividerCount) (hlow : 1 ≤ m), + TreeSequenceInitialSegment (H.stage 1) (H.stage ⟨m, by omega⟩) := by + intro m + induction m with + | zero => intro hm hlow; omega + | succ m ih => + intro hm hlow + by_cases hm0 : m = 0 + · subst m + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have hprev := ih (by omega) (by omega) + let j : Fin (H.dividerCount + 1) := ⟨m, by omega⟩ + have hstep := H.nested j + have heq₁ : j.castSucc = (⟨m, by omega⟩ : Fin (H.dividerCount + 2)) := by + apply Fin.ext + rfl + have heq₂ : j.succ = (⟨m + 1, by omega⟩ : Fin (H.dividerCount + 2)) := by + apply Fin.ext + rfl + rw [heq₁, heq₂] at hstep + exact segTrans hprev hstep + have hf := reach H.dividerCount (by omega) (by omega) + rw [hAstage] + exact hf + exact segTrans H.coreInsideFirst chain + +private theorem helper_firstWitness_341.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; TreeSequenceInitialSegment A T → + ∀ c ∈ TreeMissingColors phi A, (T.vertex (HierarchyFirstMissingPosition phi T c) ∈ + TreeSequenceVertexSet A ∧ c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition + phi T c))) ∧ (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ A.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hAT c hc + unfold TreeMissingColors at hc + simp only [Finset.mem_biUnion] at hc + obtain ⟨v, hv, hvc⟩ := hc + unfold TreeSequenceVertexSet at hv + simp only [Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨ia, hia⟩ := hv + let iaT : Fin (T.length + 1) := Fin.castLE (Nat.succ_le_succ hAT.1) ia + have hvertex : T.vertex iaT = A.vertex ia := hAT.2.1 ia + have hca : c ∈ MissingColors G phi (T.vertex iaT) := by rw [hvertex, hia]; exact hvc + let candidates : Finset (Fin (T.length + 1)) := + Finset.univ.filter fun i => c ∈ MissingColors G phi (T.vertex i) + have hcand : candidates.Nonempty := ⟨iaT, by simp [candidates, hca]⟩ + have hpos : HierarchyFirstMissingPosition phi T c = candidates.min' hcand := by + simp [HierarchyFirstMissingPosition, candidates, hcand] + have hmin : (HierarchyFirstMissingPosition phi T c).val ≤ iaT.val := by + rw [hpos] + exact Finset.min'_le candidates iaT (by simp [candidates, hca]) + have hbound : (HierarchyFirstMissingPosition phi T c).val ≤ A.length := by + dsimp [iaT] at hmin + exact le_trans hmin (Nat.le_of_lt_succ ia.isLt) + let x : Fin (A.length + 1) := + ⟨(HierarchyFirstMissingPosition phi T c).val, Nat.lt_succ_of_le hbound⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hAT.1) x = + HierarchyFirstMissingPosition phi T c := Fin.ext rfl + have hmiss : c ∈ MissingColors G phi (A.vertex x) := by + have hm := Finset.min'_mem candidates hcand + have hm' : c ∈ MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T c)) := by + rw [hpos] + exact (Finset.mem_filter.mp hm).2 + rw [← hcast, hAT.2.1 x] at hm' + exact hm' + constructor + · simp only [TreeSequenceVertexSet, Finset.mem_image] + constructor + · exact ⟨x, Finset.mem_univ _, (hAT.2.1 x).symm.trans (congrArg T.vertex hcast)⟩ + · have hvertexEq := (hAT.2.1 x).symm.trans (congrArg T.vertex hcast) + rw [hvertexEq] at hmiss + exact hmiss + · exact hbound + +private theorem helper_hstoredFirst_499.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha : + Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ (beta : Fin k), beta ∈ TreeMissingColors phi B ∧ alpha ∈ TreeMissingColors phi B → + let w : V := T.vertex (Fin.last T.length); B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G phi beta alpha + (Sum.inl w)) x = MissingColors G phi x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta alpha (Sum.inl w); ( + ∀ (eta : Fin k), HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi + B eta) → ( + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k), (↑(HierarchyFirstMissingPosition psi T eta) : + ℕ) < T.length → eta ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T + eta))) → ( + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (T.length + (1 : ℕ))), eta ∈ + MissingColors G psi (T.vertex i) → (↑(HierarchyFirstMissingPosition psi T eta) : ℕ) ≤ (↑i + : ℕ)) → ( + ∀ (eta : Fin k) (psi : PartialEdgeColoring E k), (↑(HierarchyFirstMissingPosition psi T eta) : + ℕ) = B.length → eta ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T + eta)) → eta ∈ MissingColors G psi (B.vertex (Fin.last B.length))) → + ∀ eta ∈ D, HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition phi T eta + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha H q ell B D beta hmissB w hlenB hBT + hmissEq sigma hfirstEqB posMissing posLe transportAtLast eta heta + have hcut : min (HierarchyFirstMissingPosition sigma T eta).val B.length = + min (HierarchyFirstMissingPosition phi T eta).val B.length := by + rw [← HierarchyFirstMissingPositionPrefixCutoff sigma B T hBT eta B.length le_rfl, + hfirstEqB eta, + HierarchyFirstMissingPositionPrefixCutoff phi B T hBT eta B.length le_rfl] + apply Fin.ext + by_cases hs : (HierarchyFirstMissingPosition sigma T eta).val < B.length + · have hsmin : min (HierarchyFirstMissingPosition sigma T eta).val B.length = + (HierarchyFirstMissingPosition sigma T eta).val := Nat.min_eq_left (by omega) + rw [hsmin] at hcut + have hphi : (HierarchyFirstMissingPosition phi T eta).val < B.length := by + have := Nat.min_le_right + (HierarchyFirstMissingPosition phi T eta).val B.length + omega + have hpmin : min (HierarchyFirstMissingPosition phi T eta).val B.length = + (HierarchyFirstMissingPosition phi T eta).val := Nat.min_eq_left (by omega) + rw [hpmin] at hcut + exact hcut + · have hsge : B.length ≤ (HierarchyFirstMissingPosition sigma T eta).val := by omega + have hpge : B.length ≤ (HierarchyFirstMissingPosition phi T eta).val := by + by_contra h + have hp : (HierarchyFirstMissingPosition phi T eta).val < B.length := by omega + have hmin : min (HierarchyFirstMissingPosition phi T eta).val B.length = + (HierarchyFirstMissingPosition phi T eta).val := Nat.min_eq_left (by omega) + rw [hmin] at hcut + omega + by_cases hse : (HierarchyFirstMissingPosition sigma T eta).val = B.length + · have hmissS : eta ∈ MissingColors G sigma + (T.vertex (HierarchyFirstMissingPosition sigma T eta)) := + posMissing sigma eta (by rw [hse]; omega) + have hmissB := transportAtLast eta sigma hse hmissS + have hvB : B.vertex (Fin.last B.length) ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last B.length, rfl⟩ + have hmissOld : eta ∈ MissingColors G phi (B.vertex (Fin.last B.length)) := by + rw [hmissEq _ hvB] at hmissB + exact hmissB + have hmissOldCast : eta ∈ MissingColors G phi + (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) (Fin.last B.length))) := by + rw [hBT.2.1 (Fin.last B.length)] + exact hmissOld + have hposOld : (HierarchyFirstMissingPosition phi T eta).val ≤ B.length := + posLe phi eta (Fin.castLE (Nat.succ_le_succ hBT.1) (Fin.last B.length)) + hmissOldCast + have hpEq : (HierarchyFirstMissingPosition phi T eta).val = B.length := by omega + exact hse.trans hpEq.symm + · have hphiNe : (HierarchyFirstMissingPosition phi T eta).val ≠ B.length := by + intro he + have hmissOld : eta ∈ MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T eta)) := + posMissing phi eta (by rw [he]; omega) + have hmissB := transportAtLast eta phi he hmissOld + have hvB : B.vertex (Fin.last B.length) ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.last B.length, rfl⟩ + have hmissSigmaB : eta ∈ MissingColors G sigma (B.vertex (Fin.last B.length)) := by + rw [hmissEq _ hvB] + exact hmissB + have hmissSigmaCast : eta ∈ MissingColors G sigma + (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) (Fin.last B.length))) := by + rw [hBT.2.1 (Fin.last B.length)] + exact hmissSigmaB + have hposSigma : (HierarchyFirstMissingPosition sigma T eta).val ≤ B.length := + posLe sigma eta (Fin.castLE (Nat.succ_le_succ hBT.1) (Fin.last B.length)) + hmissSigmaCast + have : (HierarchyFirstMissingPosition sigma T eta).val = B.length := by + have hmin : min (HierarchyFirstMissingPosition sigma T eta).val B.length = + (HierarchyFirstMissingPosition sigma T eta).val := Nat.min_eq_left hposSigma + rw [he] at hcut + simpa [hmin] using hcut + exact hse this + have hsEq : (HierarchyFirstMissingPosition sigma T eta).val = T.length := by + have hge : B.length + 1 ≤ (HierarchyFirstMissingPosition sigma T eta).val := by omega + rw [hlenB] at hge + have hle := Nat.le_of_lt_succ (HierarchyFirstMissingPosition sigma T eta).isLt + omega + have hpEq : (HierarchyFirstMissingPosition phi T eta).val = T.length := by + have hge : B.length + 1 ≤ + (HierarchyFirstMissingPosition phi T eta).val := by omega + rw [hlenB] at hge + have hle := Nat.le_of_lt_succ (HierarchyFirstMissingPosition phi T eta).isLt + omega + exact hsEq.trans hpEq.symm + +private theorem helper_hfinalTree_741.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : Fin k) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H' : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let Tn' : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc; H.dividerCount = H'.dividerCount → Tn' = + Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha H n Tn beta P H' Tn' hcount + let corr := P.corresponding + change corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc + let terminalIndex : Fin ett.rounds := + ⟨ett.rounds - 1, by have hp := C.positive; omega⟩ + have terminalSucc : terminalIndex.succ = Fin.last ett.rounds := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_last] + have hp := C.positive + have hi : terminalIndex.val = ett.rounds - 1 := rfl + rw [hi] + omega + have terminalTree : terminalIndex.castSucc.succ = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_last, Fin.val_castSucc] + have hp := C.positive + have hi : terminalIndex.val = ett.rounds - 1 := rfl + rw [hi] + omega + have presentation : corr.replacementETT.series = + corr.rungAgreement.symm ▸ corr.replacementSeries := by + have typeLink : TashkinovSeries G k ett.rounds e0 corr.replacementInput = + TashkinovSeries G k corr.replacementETT.rounds e0 corr.replacementInput := + congrArg (fun r => TashkinovSeries G k r e0 corr.replacementInput) + corr.rungAgreement.symm + have castProof : HEq corr.replacementSeries + (corr.rungAgreement.symm ▸ corr.replacementSeries) := by + simp + exact eq_of_heq (HEq.trans corr.seriesPresentation castProof) + have castTree {a b : Nat} (h : a = b) + (s : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 2)) : + (cast (congrArg (fun r => TashkinovSeries G k r e0 corr.replacementInput) h) s).data.tree i = + s.data.tree (Fin.cast (congrArg (fun r => r + 2) h.symm) i) := by + cases h + rfl + have transportEq : corr.rungAgreement.symm ▸ corr.replacementSeries = + cast (congrArg (fun r => TashkinovSeries G k r e0 corr.replacementInput) + corr.rungAgreement.symm) corr.replacementSeries := by + symm + apply cast_eq_iff_heq.mpr + simp + rw [presentation] + calc + (corr.rungAgreement.symm ▸ corr.replacementSeries).data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + corr.replacementSeries.data.tree + (Fin.cast (congrArg (fun r => r + 2) corr.rungAgreement) + (Fin.last corr.replacementETT.rounds).castSucc) := by + rw [transportEq] + simpa using castTree corr.rungAgreement.symm corr.replacementSeries + (Fin.last corr.replacementETT.rounds).castSucc + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + simpa [terminalTree, terminalSucc, corr] using + corr.ladderTreesAgree terminalIndex + +private theorem helper_hExtraEq_799.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (alpha : Fin k), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; TreeSequenceInitialSegment base.core B → + ∀ (beta : Fin k), + let _ : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let w : V := T.vertex (Fin.last T.length); ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G phi beta alpha + (Sum.inl w)) x = MissingColors G phi x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta alpha (Sum.inl w); + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P.coloring = sigma + → + let Tn' : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc; base.core = P.replacementBase.core → Tn' + = Tn → ((TreeSequenceVertexSet P.replacementBase.core \ TreeSequenceVertexSet Tn').biUnion + fun (v : V) ↦ MissingColors G P.coloring v) = M0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha ell B n Tn M0 hCoreB beta v w hmissEq + sigma P hPcolor Tn' hcore hfinalTree + apply Finset.ext + intro c + change c ∈ (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn').biUnion (fun v => MissingColors G P.coloring v) ↔ + c ∈ (TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet Tn).biUnion (fun v => MissingColors G phi v) + rw [Finset.mem_biUnion, Finset.mem_biUnion] + have hcoreSet : TreeSequenceVertexSet base.core = + TreeSequenceVertexSet P.replacementBase.core := congrArg TreeSequenceVertexSet hcore + have htreeSet : TreeSequenceVertexSet Tn = TreeSequenceVertexSet Tn' := + congrArg TreeSequenceVertexSet hfinalTree.symm + constructor + · rintro ⟨v, hv, hc⟩ + have hvOld : v ∈ TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet Tn := by + rw [hcoreSet, htreeSet] + exact hv + refine ⟨v, hvOld, ?_⟩ + have hvCore : v ∈ TreeSequenceVertexSet base.core := + (Finset.mem_sdiff.mp hvOld).1 + have hvB := TreeSequenceInitialSegmentVertexSetSubset hCoreB hvCore + have hmiss := hmissEq v hvB + rw [hPcolor] at hc + exact hmiss ▸ hc + · rintro ⟨v, hv, hc⟩ + have hvNew : v ∈ TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn' := by + rw [← hcoreSet, ← htreeSet] + exact hv + refine ⟨v, hvNew, ?_⟩ + have hvCore : v ∈ TreeSequenceVertexSet base.core := + (Finset.mem_sdiff.mp hv).1 + have hvB := TreeSequenceInitialSegmentVertexSetSubset hCoreB hvCore + have hmiss := hmissEq v hvB + exact hPcolor ▸ hmiss.symm ▸ hc + +private theorem helper_hsame_665.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha : + Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ beta ∈ TreeMissingColors phi Tn, beta ∈ TreeMissingColors phi A → ( + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + have sameComponent : Prop := TwoColorComponent G phi beta alpha (Sum.inl va) = + TwoColorComponent G phi beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta ∈ + TreeMissingColors phi Tnq ∨ Disjoint { beta, alpha } Dnq) → sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ (beta ∈ TreeMissingColors phi Tn ∨ Disjoint { beta, alpha } + Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors phi A ∧ TreeColorSetClosed G phi A + { beta } → sameComponent ∧ TreeInterchangeable G A phi beta alpha)) → TwoColorComponent G + phi beta alpha (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta alpha (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T + alpha))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha H q A n Tn beta hbetaTn hbetaA hchange + by_cases hq : H.dividerCount = 0 + · have hq' : C.hierarchy.dividerCount = 0 := by simpa [H] using hq + have hpart := hchange.2.1 ⟨hq', Or.inl hbetaTn⟩ + exact hpart + · have hqpos : 0 < H.dividerCount := by omega + have hq' : C.hierarchy.dividerCount > 0 := by simpa [H] using hqpos + have hstage : H.stage ⟨H.dividerCount, by omega⟩ = A := by + have hAstage : A = H.stage ⟨H.dividerCount, by omega⟩ := by + have hlast : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp + omega + dsimp [A, q, HierarchyStarredStage] + rw [hlast] + simp only [Fin.cases] + apply congrArg H.stage + apply Fin.ext + simp + omega + exact hAstage.symm + have hpart := hchange.1 ⟨hqpos, Or.inl (by + rw [hstage] + exact hbetaA)⟩ + exact hpart + +private theorem helper_seriesProper_846.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j) := by + classical + intro V E _ _ _ G k e0 input T phi ett j + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.1 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedProper + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => exact currentProper + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact previousProper + +private theorem helper_seriesOne_873.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (j : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + classical + intro V E _ _ _ G k e0 input T phi ett j + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.2 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedOneUncolored + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => exact currentOneUncolored + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact previousOneUncolored + +private theorem helper_hMdis_717.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; ColoredVertexSetElementary G phi + (TreeSequenceVertexSet B) → TreeSequenceInitialSegment base.core B → + TreeSequenceInitialSegment Tn B → Disjoint (TreeMissingColors phi Tn) M0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ell B n Tn M0 hpen hCoreB hTnB + rw [Finset.disjoint_left] + intro c hc hM + simp only [Finset.mem_biUnion, Finset.mem_sdiff, M0] at hM + obtain ⟨v, hv, hvc⟩ := hM + have hvCore : v ∈ TreeSequenceVertexSet base.core := hv.1 + have hvNotTn : v ∉ TreeSequenceVertexSet Tn := hv.2 + have hvB := TreeSequenceInitialSegmentVertexSetSubset hCoreB hvCore + have hTnB' := TreeSequenceInitialSegmentVertexSetSubset hTnB + have hcTn : c ∈ TreeMissingColors phi Tn := hc + obtain ⟨w, hw, hcw⟩ := Finset.mem_biUnion.mp hcTn + have hwB := hTnB' hw + have hne : v ≠ w := by + intro heq + subst w + exact hvNotTn hw + exact (Finset.disjoint_left.mp (hpen hvB hwB hne) hvc hcw) + +private theorem helper_hbetaSet_749.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (C.good.gamma q); + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; Disjoint (TreeMissingColors phi Tn) M0 → + Gamma.card ≤ (2 : ℕ) * ett.rounds → (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors + phi Tn).card → (TreeMissingColors phi Tn \ (Gamma ∪ M0)).Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q n Tn D Gamma M0 hMdis hGammacard hlarge + have hInter : (TreeMissingColors phi Tn ∩ (Gamma ∪ M0)).card ≤ Gamma.card := by + apply Finset.card_le_card + intro c hc + simp only [Finset.mem_inter] at hc + rcases Finset.mem_union.mp hc.2 with h | h + · exact h + · exact (Finset.disjoint_left.mp hMdis hc.1 h).elim + have hcard : (TreeMissingColors phi Tn \ (Gamma ∪ M0)).card ≥ 11 := by + have hInter' : ((Gamma ∪ M0) ∩ TreeMissingColors phi Tn).card ≤ Gamma.card := by + simpa [Finset.inter_comm] using hInter + rw [Finset.card_sdiff] + omega + exact Finset.card_pos.mp (by omega) + +private theorem helper_hfirstEqB_873.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha : + Fin k), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (beta : Fin k), + let w : V := T.vertex (Fin.last T.length); ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G phi beta alpha + (Sum.inl w)) x = MissingColors G phi x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta alpha (Sum.inl w); + ∀ (eta : Fin k), HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi + B eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha ell B beta w hmissEq sigma eta + have hc : (Finset.univ.filter fun j : Fin (B.length + 1) => + eta ∈ MissingColors G sigma (B.vertex j)) = + (Finset.univ.filter fun j : Fin (B.length + 1) => + eta ∈ MissingColors G phi (B.vertex j)) := by + apply Finset.filter_congr + intro j _ + rw [hmissEq (B.vertex j) (by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨j, rfl⟩)] + unfold HierarchyFirstMissingPosition + rw [hc] + +private theorem helper_hcase_921.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha : + Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ beta ∈ TreeMissingColors phi Tn, beta ∈ TreeMissingColors phi A → (0 : ℕ) < H.dividerCount ∧ + beta ∈ TreeMissingColors phi (H.stage (⟨H.dividerCount, Decidable.byContradiction fun (a : + ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (beta ∈ TreeMissingColors + phi Tn ∨ beta ∈ TreeMissingColors phi A ∧ beta ∉ TashkinovStoredColors ett.series.data n ∧ + alpha ∉ TashkinovStoredColors ett.series.data n) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha H q A n Tn beta hbetaTn hbetaA + by_cases hq : H.dividerCount = 0 + · exact Or.inr ⟨hq, Or.inl hbetaTn⟩ + · have hqpos : 0 < H.dividerCount := by omega + have hAstage : A = H.stage ⟨H.dividerCount, by omega⟩ := by + have hlast : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp + omega + dsimp [A, q, HierarchyStarredStage] + rw [hlast] + simp only [Fin.cases] + apply congrArg H.stage + apply Fin.ext + simp + omega + exact Or.inl ⟨hqpos, hAstage ▸ hbetaA⟩ + +private theorem helper_continuation_903.{u_1, u_2} : + helperContinuation903Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha hgamma H q A ell B n Tn D Gamma M0 + hAT hAB hCoreB beta hbetaTn hbetaNot hbetaA halphaA hne hmissB huData u v w hlenB hBT hwu + hdisjoint hpath hmissEq sigma hsigma hbetaW hmissSigmaA + have hstarSigma : beta ∈ TreeMissingColors sigma A ∧ + alpha ∈ TreeMissingColors sigma A := by + exact ⟨hmissSigmaA beta hbetaA, hmissSigmaA alpha halphaA⟩ + have hgammaOutside : beta ∉ Gamma ∧ alpha ∉ Gamma := by + exact ⟨hbetaNot.1, hgamma⟩ + have hpenultimateMissing : ∀ x, x ∈ TreeSequenceVertexSet B → + MissingColors G sigma x = MissingColors G phi x := hmissEq + have hfirstEqB (eta : Fin k) : + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by + exact @helper_hfirstEqB_873 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C alpha beta hmissEq eta + have posMissing (psi : PartialEdgeColoring E k) (eta : Fin k) + (hp : (HierarchyFirstMissingPosition psi T eta).val < T.length) : + eta ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T eta)) := by + unfold HierarchyFirstMissingPosition at hp ⊢ + by_cases hc : (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G psi (T.vertex i)).Nonempty + · rw [dite_eq_left hc] at hp ⊢ + exact (Finset.mem_filter.mp (Finset.min'_mem _ hc)).2 + · simp [dite_eq_right hc, Fin.val_last] at hp + have posLe (psi : PartialEdgeColoring E k) (eta : Fin k) + (i : Fin (T.length + 1)) + (hm : eta ∈ MissingColors G psi (T.vertex i)) : + (HierarchyFirstMissingPosition psi T eta).val ≤ i.val := by + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + eta ∈ MissingColors G psi (T.vertex j) + have hc : candidates.Nonempty := ⟨i, by simp [candidates, hm]⟩ + have heq : HierarchyFirstMissingPosition psi T eta = candidates.min' hc := by + simp [HierarchyFirstMissingPosition, candidates, hc] + rw [heq] + exact Finset.min'_le candidates i (by simp [candidates, hm]) + have transportAtLast (eta : Fin k) (psi : PartialEdgeColoring E k) + (hp : (HierarchyFirstMissingPosition psi T eta).val = B.length) + (hm : eta ∈ MissingColors G psi + (T.vertex (HierarchyFirstMissingPosition psi T eta))) : + eta ∈ MissingColors G psi (B.vertex (Fin.last B.length)) := by + have hcast : Fin.castLE (Nat.succ_le_succ hBT.1) (Fin.last B.length) = + HierarchyFirstMissingPosition psi T eta := by + apply Fin.ext + simp [hp] + rw [← hBT.2.1 (Fin.last B.length), hcast] + exact hm + have hstoredFirst : ∀ eta, eta ∈ D → + HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition phi T eta := by + exact @helper_hstoredFirst_499 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C alpha beta hmissB hlenB hBT hmissEq hfirstEqB posMissing + posLe transportAtLast + have hcase : + (0 < H.dividerCount ∧ beta ∈ TreeMissingColors phi + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ + (beta ∈ TreeMissingColors phi Tn ∨ + (beta ∈ TreeMissingColors phi A ∧ + beta ∉ TashkinovStoredColors ett.series.data n ∧ + alpha ∉ TashkinovStoredColors ett.series.data n))) := by + exact @helper_hcase_921 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C alpha beta hbetaTn hbetaA + have stableResult := StableChangeCasesOneTwoStarredTail G k e0 input T phi + ett base C ctx beta alpha hne hmissB (Sum.inl w) hpath sigma hsigma hcase + hdisjoint hstarSigma hgammaOutside hpenultimateMissing hstoredFirst + rcases stableResult with ⟨weak, mod, corrT, maxT, baseT, K, goodT, sameT⟩ + have seriesProper : ∀ j : Fin (ett.rounds + 1), + IsProperEdgeColoring G (ett.series.data.coloring j) := by + exact @helper_seriesProper_846 V E inferInstance inferInstance inferInstance G k e0 input T + phi ett + have seriesOne : ∀ j : Fin (ett.rounds + 1), + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + exact @helper_seriesOne_873 V E inferInstance inferInstance inferInstance G k e0 input T phi ett + let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := { + replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := seriesProper + replacementOneUncolored := seriesOne + replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := { + coloring := phi + corresponding := selfCorr + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + minimumContext := ctx } + have hbetaU : beta ∈ MissingColors G sigma u := by + have hOld := huData.1.2 + have huB := TreeSequenceInitialSegmentVertexSetSubset hAB huData.1.1 + change beta ∈ MissingColors G phi u at hOld + exact (hmissEq u huB).symm ▸ hOld + let Cnew : HierarchyCounterexample baseT := { + positive := by simpa [corrT.rungAgreement] using C.positive + hierarchy := K + good := goodT + maximum := maxT + notElementary := by + intro helem + have huT := TreeSequenceInitialSegmentVertexSetSubset hAT huData.1.1 + have hwT : w ∈ TreeSequenceVertexSet T := by + simp [w, TreeSequenceVertexSet] + exact (Finset.disjoint_left.mp (helem huT hwT hwu.symm) hbetaU hbetaW) } + have transResult := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx P0 sigma corrT baseT Cnew sameT + rcases transResult with ⟨P, hPcolor⟩ + let H' := P.counterexample.hierarchy + let q' : Fin (H'.dividerCount + 1) := Fin.last H'.dividerCount + let Tn' := P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc + have hStages := P.sameGood.1 + have hcore : base.core = P.replacementBase.core := hStages.1 + have hcount : H.dividerCount = H'.dividerCount := P.sameGood.2.choose + have hAt := (P.sameGood.2.choose_spec) q + have hqcast : Fin.cast (congrArg (fun m => m + 1) hcount) q = q' := by + apply Fin.ext + simp [q, q'] + have hD' : D = HierarchyStoredColorsAt H' q' := by + simpa [D, q', hqcast] using hAt.1 + have hGammaPair : ∀ eta, eta ∈ D → + C.good.gamma q eta = P.counterexample.good.gamma q' eta := by + intro eta heta + simpa [q', hqcast] using hAt.2 eta heta + have hGammaEq : + (HierarchyStoredColorsAt H' q').biUnion (P.counterexample.good.gamma q') = Gamma := by + apply Finset.ext + intro c + change c ∈ (HierarchyStoredColorsAt H' q').biUnion + (P.counterexample.good.gamma q') ↔ c ∈ D.biUnion (C.good.gamma q) + rw [Finset.mem_biUnion, Finset.mem_biUnion] + constructor + · rintro ⟨eta, heta, hc⟩ + have hetaD : eta ∈ D := hD'.symm ▸ heta + exact ⟨eta, hetaD, (hGammaPair eta hetaD).symm ▸ hc⟩ + · rintro ⟨eta, heta, hc⟩ + exact ⟨eta, hD' ▸ heta, (hGammaPair eta heta) ▸ hc⟩ + have hfinalTree : Tn' = Tn := by + exact @helper_hfinalTree_741 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx alpha beta P hcount + have hExtraEq : + ((TreeSequenceVertexSet P.replacementBase.core \ TreeSequenceVertexSet Tn').biUnion + fun v => MissingColors G P.coloring v) = M0 := by + exact @helper_hExtraEq_799 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx alpha hCoreB beta hmissEq P hPcolor hcore hfinalTree + refine ⟨P, beta, ?_, ?_, ?_⟩ + · rw [hPcolor] + simpa [w] using hbetaW + · rw [hPcolor] + simpa [A, H, q] using hstarSigma.1 + · change beta ∉ + (HierarchyStoredColorsAt H' q').biUnion (P.counterexample.good.gamma q') ∪ + ((TreeSequenceVertexSet P.replacementBase.core \ TreeSequenceVertexSet Tn').biUnion + fun v => MissingColors G P.coloring v) + rw [hGammaEq, hExtraEq] + simpa [Finset.mem_union] using hbetaNot + +private theorem helper_continuation_882.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), (2 : ℕ) ≤ + HierarchyPathNumber C.hierarchy → HierarchyPathNumber C.hierarchy < + HierarchyFullTailLength C → + ∀ alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)), alpha ∈ TreeMissingColors phi + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) → (alpha ∈ + (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) → alpha ∉ + (HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount)).biUnion + (C.good.gamma (Fin.last C.hierarchy.dividerCount)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (C.good.gamma q); + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; ColoredVertexSetElementary G phi + (TreeSequenceVertexSet B) → TreeSequenceInitialSegment A T → TreeSequenceInitialSegment A + B → TreeSequenceInitialSegment base.core B → TreeSequenceInitialSegment Tn A → ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeMissingColors phi X ⊆ + TreeMissingColors phi Y) → + ∀ beta ∈ TreeMissingColors phi Tn, beta ∉ Gamma ∧ beta ∉ M0 → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∃ beta ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), beta ∈ TreeMissingColors + P.coloring (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) ∧ + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc; beta ∉ (HierarchyStoredColorsAt H + q).biUnion (P.counterexample.good.gamma q) ∪ (TreeSequenceVertexSet P.replacementBase.core + \ TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hpathLower hpathUpper alpha hterminal hstar + hextra hgamma H q A ell B n Tn D Gamma M0 hpen hAT hAB hCoreB hTnA treeMissingMono beta + hbetaTn hbetaNot + have hbetaA : beta ∈ TreeMissingColors phi A := + treeMissingMono hTnA hbetaTn + have halphaA : alpha ∈ TreeMissingColors phi A := by + simpa [A, q, H] using hstar + have hne : beta ≠ alpha := by + intro heq + exact hbetaNot.2 (heq ▸ hextra) + have hmissB : beta ∈ TreeMissingColors phi B ∧ alpha ∈ TreeMissingColors phi B := by + exact ⟨treeMissingMono hAB hbetaA, treeMissingMono hAB halphaA⟩ + have horderedUnused : + let ia := HierarchyFirstMissingPosition phi T beta + let ib := HierarchyFirstMissingPosition phi T alpha + (beta ∉ TreeMissingColors phi A ∨ alpha ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + beta ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ib.val ∧ phi (T.edge t) = some c) := by + intro ia ib hnot + rcases hnot with hn | hn + · exact False.elim (hn hbetaA) + · exact False.elim (hn halphaA) + have hchange := ChangeLemma G k e0 input T phi ett base C ctx.proper + ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality hpen ctx.largeMissingSet beta alpha hne hmissB + horderedUnused + have hsame : + TwoColorComponent G phi beta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T alpha))) := by + exact @helper_hsame_665 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C alpha beta hbetaTn hbetaA hchange + have firstWitness (c : Fin k) (hc : c ∈ TreeMissingColors phi A) : + (T.vertex (HierarchyFirstMissingPosition phi T c) ∈ TreeSequenceVertexSet A ∧ + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c))) ∧ + (HierarchyFirstMissingPosition phi T c).val ≤ A.length := by + exact @helper_firstWitness_341 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C hAT c hc + have huData := firstWitness beta hbetaA + have hvData := firstWitness alpha halphaA + let u := T.vertex (HierarchyFirstMissingPosition phi T beta) + let v := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let w := T.vertex (Fin.last T.length) + have hell : 3 ≤ ell := by + have hp := hpathLower + have hq := hpathUpper + dsimp [ell, HierarchyFullTailLength] at hq + omega + have hlenAT : A.length < T.length := by + change 3 ≤ T.length - A.length at hell + omega + have hlenB : B.length + 1 = T.length := by + change min (A.length + (T.length - A.length - 1)) T.length + 1 = T.length + change 3 ≤ T.length - A.length at hell + have hsum : A.length + (T.length - A.length - 1) = T.length - 1 := by omega + rw [hsum, Nat.min_eq_left (by omega)] + omega + have hBT : TreeSequenceInitialSegment B T := by + refine ⟨Nat.min_le_right _ _, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have hwu : w ≠ u := by + intro heq + have hidx := T.vertex_injective heq.symm + have hpos : (HierarchyFirstMissingPosition phi T beta).val < T.length := + lt_of_le_of_lt huData.2 hlenAT + have : (HierarchyFirstMissingPosition phi T beta).val = T.length := by + exact congrArg Fin.val hidx + omega + have hwv : w ≠ v := by + intro heq + have hidx := T.vertex_injective heq.symm + have hpos : (HierarchyFirstMissingPosition phi T alpha).val < T.length := + lt_of_le_of_lt hvData.2 hlenAT + have hlast : (HierarchyFirstMissingPosition phi T alpha).val = T.length := congrArg Fin.val hidx + omega + have hterminalAlpha : alpha ∈ MissingColors G phi w := by simpa [w] using hterminal + have terminalData := P2905_T2_ElementaryTerminalComponent G phi beta alpha hne + ctx.proper (TreeSequenceVertexSet B) hpen u v w + (TreeSequenceInitialSegmentVertexSetSubset hAB huData.1.1) + (TreeSequenceInitialSegmentVertexSetSubset hAB hvData.1.1) hwu hwv + huData.1.2 hvData.1.2 (Or.inr hterminalAlpha) hsame + have hdisjoint := terminalData.1 + have hpath := terminalData.2.1 + have hmissEq := terminalData.2.2 + let sigma := TwoColorComponentSwap G phi beta alpha (Sum.inl w) + have hsigma : sigma = TwoColorComponentSwap G phi beta alpha (Sum.inl w) := rfl + obtain ⟨outside, betaGain, alphaGain, unaffected⟩ := + TwoColorComponentSwapMissingBehavior G phi beta alpha hne ctx.proper (Sum.inl w) + have hbetaW : beta ∈ MissingColors G sigma w := by + exact alphaGain w (by rfl) hterminalAlpha + have hmissSigmaA : ∀ c ∈ TreeMissingColors phi A, + c ∈ TreeMissingColors sigma A := by + intro c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + obtain ⟨x, hx, hcx⟩ := hc + have hxB := TreeSequenceInitialSegmentVertexSetSubset hAB hx + exact ⟨x, hx, (hmissEq x hxB).symm ▸ hcx⟩ + exact @helper_continuation_903 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx alpha hgamma hAT hAB hCoreB beta hbetaTn hbetaNot hbetaA + halphaA hne hmissB huData hlenB hBT hwu hdisjoint hpath hmissEq hsigma hbetaW hmissSigmaA +theorem P2905_T2_BaseExtraReplacement {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hpathLower : 2 ≤ HierarchyPathNumber C.hierarchy) + (hpathUpper : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (alpha : Fin k) + (hterminal : alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length))) + (hstar : alpha ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount))) + (hextra : alpha ∈ ((TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion + fun v => MissingColors G phi v)) + (hgamma : alpha ∉ (HierarchyStoredColorsAt C.hierarchy (Fin.last + C.hierarchy.dividerCount)).biUnion (C.good.gamma (Fin.last C.hierarchy.dividerCount))) : + ∃ P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + ∃ beta : Fin k, + beta ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ + beta ∈ + TreeMissingColors P.coloring + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) ∧ + (let H := P.counterexample.hierarchy + let q := Fin.last H.dividerCount + let Tn := + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc + beta ∉ + (HierarchyStoredColorsAt H q).biUnion (P.counterexample.good.gamma q) ∪ + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v)) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (ell - 1) + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (C.good.gamma q) + let M0 := ((TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet Tn).biUnion fun v => MissingColors G phi v) + have segTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : TreeSequenceInitialSegment X Z := by + rcases hXY with ⟨hxy, hvxy, hexy⟩ + rcases hYZ with ⟨hyz, hvyz, heyz⟩ + refine ⟨hxy.trans hyz, ?_, ?_⟩ + · intro i + exact (hvyz (Fin.castLE (Nat.succ_le_succ hxy) i)).trans (hvxy i) + · intro i + exact (heyz (Fin.castLE hxy i)).trans (hexy i) + have commonPrefix {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + have hpen : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) := by + intro u hu v hv huv + exact HierarchyCounterexamplePenultimateElementary G k e0 input T phi + ett base C ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet (u := u) hu (v := v) hv huv + have hAT : TreeSequenceInitialSegment A T := by + have hstep : TreeSequenceInitialSegment + (HierarchyStarredStage H q) (H.stage q.succ) := by + cases q using Fin.cases with + | zero => exact H.coreInsideFirst + | succ i => exact H.nested i.succ + have hlast : q.succ = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [q] + rw [← H.terminalStage] + simpa only [hlast] using hstep + have hlenAB : A.length ≤ B.length := by + change A.length ≤ min (A.length + (ell - 1)) T.length + have hp := hpathUpper + have hl := hpathLower + dsimp [ell, H, HierarchyFullTailLength] at hp hl + have ht := hAT.1 + omega + have hAB : TreeSequenceInitialSegment A B := commonPrefix hAT + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ hlenAB + have hTnCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · obtain ⟨_, _, hu⟩ := base.parallel hp + rcases hu with ⟨u⟩ + exact u.leftSegment + · have heq : base.core = Tn := base.nonparallel hp + rw [heq] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have hCoreB : TreeSequenceInitialSegment base.core B := by + exact @helper_hCoreB_124 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C alpha hstar segTrans hAB + have hTnB : TreeSequenceInitialSegment Tn B := segTrans hTnCore hCoreB + have hcoreA : TreeSequenceInitialSegment base.core A := by + exact @helper_hcoreA_183 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C segTrans + have hTnA : TreeSequenceInitialSegment Tn A := segTrans hTnCore hcoreA + have treeMissingMono {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) : + TreeMissingColors phi X ⊆ TreeMissingColors phi Y := by + intro c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + obtain ⟨v, hv, hvc⟩ := hc + exact ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hvc⟩ + have hMdis : Disjoint (TreeMissingColors phi Tn) M0 := by + exact @helper_hMdis_717 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C hpen hCoreB hTnB + have hDcard : D.card ≤ ett.rounds := by + simpa [D, H, q] using HierarchyStoredColorsCardinality H (Fin.last H.dividerCount) + have hGammacard : Gamma.card ≤ 2 * ett.rounds := by + calc + Gamma.card ≤ ∑ eta ∈ D, (C.good.gamma q eta).card := Finset.card_biUnion_le + _ = D.card * 2 := by + calc + (∑ eta ∈ D, (C.good.gamma q eta).card) = ∑ eta ∈ D, 2 := by + apply Finset.sum_congr rfl + intro eta heta + exact C.good.twoColors q eta heta + _ = D.card * 2 := by simp + _ ≤ 2 * ett.rounds := by omega + have hlarge : 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card := by + simpa [Tn, n] using ctx.largeMissingSet + have hbetaSet : (TreeMissingColors phi Tn \ (Gamma ∪ M0)).Nonempty := by + exact @helper_hbetaSet_749 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C hMdis hGammacard hlarge + obtain ⟨beta, hbeta⟩ := hbetaSet + have hbetaTn : beta ∈ TreeMissingColors phi Tn := (Finset.mem_sdiff.mp hbeta).1 + have hbetaNot : beta ∉ Gamma ∧ beta ∉ M0 := by + have := (Finset.mem_sdiff.mp hbeta).2 + simpa [Finset.mem_union] using this + exact @helper_continuation_882 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx hpathLower hpathUpper alpha hterminal hstar hextra hgamma + hpen hAT hAB hCoreB hTnA treeMissingMono beta hbetaTn hbetaNot +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Basic2.lean b/LeanPool/GoldbergSeymour/Basic2.lean new file mode 100644 index 0000000000..839b016c21 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Basic2.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Basic2TerminalPE +public import LeanPool.GoldbergSeymour.Basic2TerminalSERE + +/-! +# Basic2 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem Basic2 {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring Tn + (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma → + ∀ (delta : Fin k), + DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → + (∃ w, BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tn) delta w ∧ + TreeVertexOrder Tn w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (vi : V), + (ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ + ett.series.data.kind q.succ = + some TashkinovExtensionKind.SE) → + ett.series.data.chosenVertex q.succ = some vi → + ETTFirstAppearanceIndex ett v hvFinal ≤ q.val + 1 → + v = vi ∨ TreeVertexOrder T v vi := by + classical + have hterminal : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE := by + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + generalize htarget : n = target + cases ett.series.certified target <;> simp_all [n] + rcases hterminal with hterminalPE | hterminalSERE + · exact Basic2TerminalPE G k e0 input T generating ett hMP hpositive + hlower hterminalPE + · exact Basic2TerminalSERE G k e0 input T generating ett hMP hpositive + hlower hterminalSERE + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean b/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean new file mode 100644 index 0000000000..3f36f23b28 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean @@ -0,0 +1,1542 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBase + +public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable + +/-! +# Basic2Terminal PE + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hdeltaCurrentMissing_266.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G + secondStable) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)) (_ : ett.series.data.coloring previous.succ + = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) (_ : + terminal = previous.succ) (_ : gamma ∈ MissingColors G secondStable choice.vertex) (_ : + secondStable choice.edge = some choice.color) (_ : gamma ≠ choice.color) (_ : Sum.inr + choice.edge ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex)), choice.color ∈ MissingColors G (ett.series.data.coloring terminal) + choice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive terminal previous gamma secondStable + secondStableProper choice currentColoring hterminalEq hgammaSecond hchoiceSecond + hgammaDeltaNe hchoiceSecondComponent + rw [hterminalEq, MissingColors] + simp only [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + rcases hpresent with ⟨f, hfIncident, hfCurrent⟩ + rw [currentColoring] at hfCurrent + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · by_cases hfg : secondStable f = some gamma + · have hp : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hfIncident, hfg⟩ + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgammaSecond + exact hnot hp + · by_cases hfd : secondStable f = some choice.color + · have heq : choice.color = gamma := by + simpa [TwoColorComponentSwap, hfComponent, hfg, hfd, + hgammaDeltaNe] using hfCurrent + exact hgammaDeltaNe heq.symm + · simp [TwoColorComponentSwap, hfComponent, hfg, hfd] at hfCurrent + · have hfd : secondStable f = some choice.color := by + simpa [TwoColorComponentSwap, hfComponent] using hfCurrent + by_cases hfeq : f = choice.edge + · subst f + exact hfComponent hchoiceSecondComponent + · exact (secondStableProper hfeq + ⟨choice.vertex, hfIncident, choice.edgeIncident⟩ + hfd hchoiceSecond).elim + +private theorem helper_hrecoveredOne_399.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : IsOneEdgeUncolored sigma e0), + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)) (_ : gamma ≠ choice.color), + let recovered : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex); IsOneEdgeUncolored recovered e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hone previous gamma choice + hgammaDeltaNe recovered + unfold IsOneEdgeUncolored + constructor + · by_cases he : Sum.inr e0 ∈ + TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) + · simp [recovered, TwoColorComponentSwap, he, hone.1] + · simp [recovered, TwoColorComponentSwap, he, hone.1] + · intro e he0 + obtain ⟨c, hc⟩ := hone.2 e he0 + by_cases he : Sum.inr e ∈ + TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) + · by_cases hcg : c = gamma + · exact ⟨choice.color, by + simp [recovered, TwoColorComponentSwap, he, hc, hcg]⟩ + · by_cases hcd : c = choice.color + · exact ⟨gamma, by + simp [recovered, TwoColorComponentSwap, he, hc, hcd, + hgammaDeltaNe.symm]⟩ + · exact ⟨c, by + simp [recovered, TwoColorComponentSwap, he, hc, hcg, hcd]⟩ + · exact ⟨c, by + simp [recovered, TwoColorComponentSwap, he, hc]⟩ + +private theorem helper_targetEdgeOutside_444.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (delta : Fin k), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)) (_ : choice.color ∈ MissingColors G sigma + choice.vertex) (_ : delta ≠ gamma) (_ : ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), Sum.inl x ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) ↔ x = choice.vertex)) + (_ : ( + ∀ (f : E) (_ : Sum.inr f ∈ TwoColorComponent G sigma gamma choice.color (Sum.inl + choice.vertex)), sigma f = some gamma ∨ sigma f = some choice.color)) (f : E), + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), Incident G x f → sigma f + = some delta → Sum.inr f ∉ TwoColorComponent G sigma gamma choice.color (Sum.inl + choice.vertex) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma delta terminal previous gamma + choice hdeltaSigmaMissing hdeltaGammaNe hcomponent hcomponentEdgeColor f x hx hxf hfd + hfComponent + rcases hcomponentEdgeColor f hfComponent with hfg | hfc + · apply hdeltaGammaNe + exact Option.some.inj (hfd.symm.trans hfg) + · have hxComponent : Sum.inl x ∈ + TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G sigma gamma choice.color).connectedComponentMk + (Sum.inl x) = + (TwoColorIncidenceGraph G sigma gamma choice.color).connectedComponentMk + (Sum.inl choice.vertex) + calc + _ = (TwoColorIncidenceGraph G sigma gamma choice.color).connectedComponentMk + (Sum.inr f) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, hxf, hfc] + _ = _ := hfComponent + have hxEq : x = choice.vertex := (hcomponent x hx).mp hxComponent + have hnot : choice.color ∉ PresentColors G sigma choice.vertex := by + simpa [MissingColors] using hdeltaSigmaMissing + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, by simpa [hxEq] using hxf, hfc⟩ + +private theorem helper_appearanceInStage_289.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + let _ : DecidableEq V := Classical.decEq V; + ∀ + (_ : + (∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment + (ett.series.data.tree (⟨a, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree (⟨b, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))))) + (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin ett.rounds) (x : V) + (hxFinal : x ∈ TreeSequenceVertexSet T) (s : ℕ) (_ : (1 : ℕ) ≤ s) + (_hsRound : s ≤ ett.rounds) (_ : ETTFirstAppearanceIndex ett x hxFinal ≤ s), + x ∈ + TreeSequenceVertexSet + (ett.series.data.tree (⟨s, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 input T generating ett this stageToStage v hvFinal q x hxFinal s + hsPositive hsRound hbound + unfold ETTFirstAppearanceIndex at hbound + dsimp at hbound + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + x ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hnonempty : candidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett + (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hxFinal + let m := candidates.min' hnonempty + have hmBound : m.val + 1 ≤ s := by + dsimp [m, candidates] + convert hbound using 1 + have hmRounds : m.val < ett.rounds := by omega + let mi : Fin ett.rounds := ⟨m.val, hmRounds⟩ + have hmEq : m = mi.castSucc := by + apply Fin.ext + rfl + have hmem := Finset.min'_mem candidates hnonempty + change m ∈ candidates at hmem + have hxStart : x ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨m.val + 1, by omega⟩) := by + rw [hmEq] at hmem + have hstage : ExtendedTashkinovLadderStage ett mi.castSucc = + ett.series.data.tree mi.succ.castSucc := by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T + (fun j => ett.series.data.tree j.succ.castSucc) mi + have hxMi : x ∈ TreeSequenceVertexSet + (ett.series.data.tree mi.succ.castSucc) := by + simpa only [candidates, Finset.mem_filter, Finset.mem_univ, + true_and, hstage] using hmem + convert hxMi using 1 + apply congrArg TreeSequenceVertexSet + apply congrArg ett.series.data.tree + apply Fin.ext + simp [mi] + exact TreeSequenceInitialSegmentVertexSetSubset + (stageToStage (m.val + 1) s (by omega) hmBound hsRound) hxStart + +private theorem helper_earlierInPrefix_364.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), + ∀ v ∈ TreeSequenceVertexSet T, + ∀ (_ : Fin ett.rounds) {A B : TreeSequence G e0} (x y : V), TreeSequenceInitialSegment A B → y + ∈ TreeSequenceVertexSet A → TreeVertexOrder B x y → x ∈ TreeSequenceVertexSet A ∧ + TreeVertexOrder A x y := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal q A B x y hAB hyA hxy + rcases hAB with ⟨hlen, hvertices, _⟩ + rcases Finset.mem_image.mp hyA with ⟨iyA, _, hiyA⟩ + rcases hxy with ⟨ixB, iyB, hixB, hiyB, hlt⟩ + let iyCast := Fin.castLE (Nat.succ_le_succ hlen) iyA + have hiyEq : iyB = iyCast := by + apply B.vertex_injective + exact hiyB.trans ((hvertices iyA).trans hiyA).symm + have hixBound : ixB.val < A.length + 1 := by + rw [hiyEq] at hlt + simp [iyCast] at hlt + omega + let ixA : Fin (A.length + 1) := ⟨ixB.val, hixBound⟩ + have hixCast : Fin.castLE (Nat.succ_le_succ hlen) ixA = ixB := by + apply Fin.ext + rfl + have hixA : A.vertex ixA = x := by + exact (hvertices ixA).symm.trans (by simpa [hixCast] using hixB) + constructor + · apply Finset.mem_image.mpr + exact ⟨ixA, Finset.mem_univ _, hixA⟩ + · refine ⟨ixA, iyA, hixA, hiyA, ?_⟩ + rw [hiyEq] at hlt + simpa [ixA, iyCast] using hlt + +private theorem helper_hstableR_473.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), + let _ : DecidableEq V := Classical.decEq V; + ∀ (sigma : PartialEdgeColoring E k) (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin + ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)), + let recovered : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex); + ∀ (_ : StableColoring (ett.series.data.tree terminal.castSucc) (TashkinovStoredColors + ett.series.data previous.castSucc) (ett.series.data.coloring previous.castSucc) + recovered), + let r : ℕ := ett.rounds - (1 : ℕ); + ∀ (hrBefore : r < ett.rounds) (_ : TreeSequenceInitialSegment (ett.series.data.tree (⟨r, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree terminal.castSucc)) (lower : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = r), StableColoring + (ett.series.data.tree (⟨r, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc) recovered := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive this sigma v hvFinal q terminal + previous gamma choice recovered hrecoveredStable r hrBefore hRTerminal lower hr + constructor + · intro f hf hcontrol + apply hrecoveredStable.1 f + · rcases hf with ⟨x, hx, hxf⟩ + exact ⟨x, TreeSequenceInitialSegmentVertexSetSubset + hRTerminal hx, hxf⟩ + · rcases hcontrol with ⟨c, hc, hcf⟩ + refine ⟨c, ?_, hcf⟩ + rcases Finset.mem_union.mp hc with hc | hc + · apply Finset.mem_union.mpr + left + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨x, hx, hxc⟩ + exact ⟨x, TreeSequenceInitialSegmentVertexSetSubset + hRTerminal hx, hxc⟩ + · exact Finset.mem_union.mpr (Or.inr hc) + · intro x hx + exact hrecoveredStable.2 x + (TreeSequenceInitialSegmentVertexSetSubset hRTerminal hx) + +private theorem helper_hfirstLower_518.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), + let _ : DecidableEq V := Classical.decEq V; + ∀ (v : V) (_ : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (hqBefore : (↑q : ℕ) + (1 : + ℕ) < ett.rounds), + let r : ℕ := ett.rounds - (1 : ℕ); + ∀ (hrBefore : r < ett.rounds) (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨(↑q : ℕ) + + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (lower : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = r) (_ : ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE ( + by omega + ) i))) (hvLower : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))), + let qLower : Fin lower.rounds := (⟨(↑q : ℕ), + by omega + ⟩ : Fin lower.rounds); ETTFirstAppearanceIndex lower v hvLower ≤ (↑qLower : ℕ) + (1 : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive this v hvFinal q hqBefore r hrBefore + hvAtQ lower hr htree hvLower qLower + unfold ETTFirstAppearanceIndex + dsimp + have hqTreeCast : Fin.castLE (by omega) qLower.succ.castSucc = + (⟨q.val + 1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + have hmem : qLower.castSucc ∈ + Finset.univ.filter + (fun i : Fin (lower.rounds + 1) => + v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage lower i)) := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage lower qLower.castSucc = + lower.series.data.tree qLower.succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc lower.rounds + (fun _ : Fin (lower.rounds + 1) => TreeSequence G e0) + (ett.series.data.tree ⟨r + 1, by omega⟩) + (fun j => lower.series.data.tree j.succ.castSucc) qLower] + rw [htree qLower.succ.castSucc, hqTreeCast] + exact hvAtQ + have hle := Finset.min'_le + (Finset.univ.filter + (fun i : Fin (lower.rounds + 1) => + v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage lower i))) qLower.castSucc hmem + have hnat := Fin.le_iff_val_le_val.mp hle + simpa [qLower] using Nat.succ_le_succ hnat + +private theorem helper_continuation_618.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G + k e0 ett.rounds → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → + ∀ (u w : V), TreeVertexOrder A u w → TreeVertexOrder B u w) → + ∀ (sigma : PartialEdgeColoring E k) (delta : Fin k) (v : V) (_ : v ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (vi : V), ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE ∨ ett.series.data.kind q.succ = some TashkinovExtensionKind.SE → + ett.series.data.chosenVertex q.succ = some vi → v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) → + ∀ (w : V), ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc = + ett.series.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree ((⟨ett.rounds - + (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc) (TashkinovStoredColors ett.series.data + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (ett.series.data.coloring ((⟨ett.rounds - (1 : + ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc)), IsProperEdgeColoring G + (TwoColorComponentSwap G sigma gamma choice.color (Sum.inl choice.vertex) : + PartialEdgeColoring E k) → IsOneEdgeUncolored (TwoColorComponentSwap G sigma gamma + choice.color (Sum.inl choice.vertex) : PartialEdgeColoring E k) e0 → StableColoring + (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc) + (TashkinovStoredColors ett.series.data ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (ett.series.data.coloring ((⟨ett.rounds - (1 : + ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (TwoColorComponentSwap G sigma gamma + choice.color (Sum.inl choice.vertex) : PartialEdgeColoring E k) → + ∀ (hqBefore : (↑q : ℕ) + (1 : ℕ) < ett.rounds), (1 : ℕ) ≤ (ett.rounds - (1 : ℕ) : ℕ) → + ∀ (hrBefore : (ett.rounds - (1 : ℕ) : ℕ) < ett.rounds), v ∈ TreeSequenceVertexSet + (ett.series.data.tree (⟨(↑q : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) → TreeSequenceInitialSegment (ett.series.data.tree + (⟨(ett.rounds - (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + + (1 : ℕ))).castSucc) → TreeVertexOrder (ett.series.data.tree (⟨(ett.rounds - (1 : ℕ) : + ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) w v → DefectiveColor G (TwoColorComponentSwap G sigma gamma + choice.color (Sum.inl choice.vertex) : PartialEdgeColoring E k) (TreeSequenceVertexSet + (ett.series.data.tree (⟨(ett.rounds - (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) delta → BoundaryColorVertex G (TwoColorComponentSwap G sigma + gamma choice.color (Sum.inl choice.vertex) : PartialEdgeColoring E k) + (TreeSequenceVertexSet (ett.series.data.tree (⟨(ett.rounds - (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) delta v → BoundaryColorVertex G (TwoColorComponentSwap G + sigma gamma choice.color (Sum.inl choice.vertex) : PartialEdgeColoring E k) + (TreeSequenceVertexSet (ett.series.data.tree (⟨(ett.rounds - (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) delta w → + ∀ (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (⟨(ett.rounds - (1 : ℕ) : + ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(ett.rounds - (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = (ett.rounds - (1 : ℕ) : ℕ)), + MaximumProperty lower → ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE ( + by omega + ) i)) → ( + ∀ (i : Fin (lower.rounds + (1 : ℕ))), lower.series.data.coloring i = ett.series.data.coloring + (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.connectingEdges i = ett.series.data.connectingEdges (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.chosenVertex i = ett.series.data.chosenVertex (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.outsideVertex i = ett.series.data.outsideVertex (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.delta i = ett.series.data.delta (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.gamma i = ett.series.data.gamma (Fin.castLE ( + by omega + ) i) ∧ TashkinovStoredColors lower.series.data i = TashkinovStoredColors ett.series.data + (Fin.castLE ( + by omega + ) i) ∧ lower.series.certified i ≍ ett.series.certified (Fin.castLE ( + by omega + ) i)) → Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + + (1 : ℕ)) ↦ + by omega + ) (Fin.last lower.rounds : Fin (lower.rounds + (1 : ℕ))) = ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc → Fin.castLE (Decidable.byContradiction fun (a + : ¬lower.rounds + (1 : ℕ) + (1 : ℕ) ≤ ett.rounds + (1 : ℕ) + (1 : ℕ)) ↦ + by omega + ) (Fin.last lower.rounds : Fin (lower.rounds + (1 : ℕ))).castSucc = ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc.castSucc → v = vi ∨ TreeVertexOrder T v vi := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive hlower orderTransfer sigma delta v hvFinal + q vi hkind hchosen hvN w + set terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds + set previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : + Fin ett.rounds) + intro htreeTerminal gamma choice + set recovered : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex) + intro hrecoveredProper hrecoveredOne hrecoveredStable hqBefore + set r : ℕ := ett.rounds - (1 : ℕ) + intro hrPositive hrBefore hvAtQ hRTerminal hwvR hdefectiveR hvBoundaryR hwBoundaryR lower hr + hmaxLower htree hdata + set nLower : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds + intro hnCast hnTreeCast + have hrTree : ett.series.data.tree ⟨r, by omega⟩ = + ett.series.data.tree previous.castSucc.castSucc := by + apply congrArg ett.series.data.tree + apply Fin.ext + simp [previous, r] + have hdisplay : ett.series.data.tree ⟨r + 1, by omega⟩ = + ett.series.data.tree terminal.castSucc := by + congr 1 + apply Fin.ext + simp [r, terminal] + omega + have hvLower : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨r + 1, by omega⟩) := by + rw [hdisplay] + exact hvN + rcases hdata nLower with + ⟨hnColor, hnRawStored, hnEdges, hnKind, hnVertex, hnOutside, + hnDelta, hnGamma, hnStored, hnCert⟩ + have hnColor' : lower.series.data.coloring nLower = + ett.series.data.coloring previous.castSucc := by + rw [hnColor, hnCast] + have hnStored' : TashkinovStoredColors lower.series.data nLower = + TashkinovStoredColors ett.series.data previous.castSucc := by + rw [hnStored, hnCast] + have hnTree' : lower.series.data.tree nLower.castSucc = + ett.series.data.tree ⟨r, by omega⟩ := by + rw [htree nLower.castSucc, hnTreeCast, ← hrTree] + have hstableR := + @helper_hstableR_473 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive sigma v hvFinal q gamma choice hrecoveredStable hrBefore + hRTerminal lower hr + have hstableLower : StableColoring + (lower.series.data.tree nLower.castSucc) + (TashkinovStoredColors lower.series.data nLower) + (lower.series.data.coloring nLower) recovered := by + rw [hnTree', hnStored', hnColor'] + exact hstableR + let qLower : Fin lower.rounds := ⟨q.val, by omega⟩ + have hqCast : Fin.castLE (by omega) qLower.succ = q.succ := by + apply Fin.ext + rfl + rcases hdata qLower.succ with + ⟨_, _, _, hqKind, hqVertex, _, _, _, _, _⟩ + have hkindLower : lower.series.data.kind qLower.succ = + some TashkinovExtensionKind.PE ∨ + lower.series.data.kind qLower.succ = + some TashkinovExtensionKind.SE := by + rw [hqKind, hqCast] + exact hkind + have hchosenLower : lower.series.data.chosenVertex qLower.succ = + some vi := by + rw [hqVertex, hqCast] + exact hchosen + have hfirstLower := + @helper_hfirstLower_518 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive v hvFinal q hqBefore hrBefore hvAtQ lower hr htree hvLower + have hdefectiveLower : DefectiveColor G recovered + (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) + delta := by + rw [hnTree'] + exact hdefectiveR + have hvBoundaryLower : BoundaryColorVertex G recovered + (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) + delta v := by + rw [hnTree'] + exact hvBoundaryR + have hwBoundaryLower : BoundaryColorVertex G recovered + (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) + delta w := by + rw [hnTree'] + exact hwBoundaryR + have hwvLower : TreeVertexOrder + (lower.series.data.tree nLower.castSucc) w v := by + rw [hnTree'] + exact hwvR + have hlowerFive := + (hlower lower (by omega) (by omega) hmaxLower).2.2.2.2.1 + have hresult := hlowerFive recovered hrecoveredProper hrecoveredOne + hstableLower delta hdefectiveLower v hvBoundaryLower + ⟨w, hwBoundaryLower, hwvLower⟩ hvLower qLower vi hkindLower + hchosenLower hfirstLower + rcases hresult with heq | horder + · exact Or.inl heq + · apply Or.inr + have hdisplayToT : TreeSequenceInitialSegment + (ett.series.data.tree ⟨r + 1, by omega⟩) T := by + rw [hdisplay] + rw [htreeTerminal] + exact ett.abovePenultimate + exact orderTransfer hdisplayToT v vi horder + +private theorem helper_branch_567.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)) (sigma : PartialEdgeColoring E k) (delta : + Fin k) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (vi : V) (_ : + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ ett.series.data.kind q.succ + = some TashkinovExtensionKind.SE) (_ : ett.series.data.chosenVertex q.succ = some vi) (_ : + ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (_ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (a : E) (_ : Incident G v a) (w : + V) (_ : TreeVertexOrder (ett.series.data.tree (Fin.last ett.rounds).castSucc) w v) (b : E) + (_ : Incident G w b), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ett.series.data.tree terminal.castSucc = ett.series.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)), + let recovered : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex); + ∀ (_ : IsProperEdgeColoring G recovered) (_ : IsOneEdgeUncolored recovered e0) (_ : + StableColoring (ett.series.data.tree terminal.castSucc) (TashkinovStoredColors + ett.series.data previous.castSucc) (ett.series.data.coloring previous.castSucc) recovered) + (_ : recovered a = some delta) (_ : recovered b = some delta), + ∀ za ∉ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), G.ends a = s(v, za) → + ∀ zb ∉ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), G.ends b = s(w, zb) → a + ≠ b → ¬q.succ = terminal → v = vi ∨ TreeVertexOrder T v vi := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower this stageToStage orderTransfer + sigma delta v hvFinal q vi hkind hchosen hfirstBound hvN a hva w hwv b hwb terminal previous + htreeTerminal gamma choice recovered hrecoveredProper hrecoveredOne hrecoveredStable + haRecoveredValue hbRecoveredValue za hzaOutside haEnds zb hzbOutside hbEnds hab hqTerminal + have hqBefore : q.val + 1 < ett.rounds := by + have hle : q.val + 1 ≤ ett.rounds := by omega + have hne : q.val + 1 ≠ ett.rounds := by + intro heq + apply hqTerminal + apply Fin.ext + simpa [terminal] using heq + omega + have appearanceInStage := + @helper_appearanceInStage_289 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett stageToStage v hvFinal q + let r := ett.rounds - 1 + have hrPositive : 1 ≤ r := by + dsimp [r] + omega + have hrBefore : r < ett.rounds := by + dsimp [r] + omega + have hfirstToR : ETTFirstAppearanceIndex ett v hvFinal ≤ r := by + dsimp [r] + omega + have hvR : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨r, by omega⟩) := + appearanceInStage v hvFinal r hrPositive (by dsimp [r]; omega) + hfirstToR + have hvAtQ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨q.val + 1, by omega⟩) := + appearanceInStage v hvFinal (q.val + 1) (by omega) (by omega) + hfirstBound + have hRTerminal : TreeSequenceInitialSegment + (ett.series.data.tree ⟨r, by omega⟩) + (ett.series.data.tree terminal.castSucc) := by + rw [htreeTerminal] + exact stageToStage r ett.rounds hrPositive (by dsimp [r]; omega) + le_rfl + have earlierInPrefix := + @helper_earlierInPrefix_364 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett v hvFinal q + obtain ⟨hwR, hwvR⟩ := earlierInPrefix w v hRTerminal hvR hwv + have hzaR : za ∉ TreeSequenceVertexSet + (ett.series.data.tree ⟨r, by omega⟩) := by + intro hza + exact hzaOutside + (TreeSequenceInitialSegmentVertexSetSubset hRTerminal hza) + have hzbR : zb ∉ TreeSequenceVertexSet + (ett.series.data.tree ⟨r, by omega⟩) := by + intro hzb + exact hzbOutside + (TreeSequenceInitialSegmentVertexSetSubset hRTerminal hzb) + have haR : a ∈ BoundaryColorEdges G recovered + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta := by + simp only [BoundaryColorEdges, Finset.mem_filter] + refine ⟨?_, haRecoveredValue⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨v, hvR, za, hzaR, haEnds⟩ + have hbR : b ∈ BoundaryColorEdges G recovered + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta := by + simp only [BoundaryColorEdges, Finset.mem_filter] + refine ⟨?_, hbRecoveredValue⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨w, hwR, zb, hzbR, hbEnds⟩ + have hdefectiveR : DefectiveColor G recovered + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta := by + unfold DefectiveColor + have hc : 1 < (BoundaryColorEdges G recovered + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta).card := Finset.one_lt_card.mpr + ⟨a, haR, b, hbR, hab⟩ + omega + have hvBoundaryR : BoundaryColorVertex G recovered + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta v := ⟨hvR, a, haR, hva⟩ + have hwBoundaryR : BoundaryColorVertex G recovered + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta w := ⟨hwR, b, hbR, hwb⟩ + obtain ⟨lower, hr, hmaxLower, htree, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP r + hrPositive hrBefore + let nLower : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hnCast : Fin.castLE (by omega) nLower = previous.castSucc := by + apply Fin.ext + simp [nLower, hr, previous, r] + have hnTreeCast : Fin.castLE (by omega) nLower.castSucc = + previous.castSucc.castSucc := by + apply Fin.ext + simp [nLower, hr, previous, r] + exact @helper_continuation_618 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett hpositive hlower orderTransfer sigma delta v hvFinal q vi hkind + hchosen hvN w htreeTerminal gamma choice hrecoveredProper hrecoveredOne hrecoveredStable + hqBefore hrPositive hrBefore hvAtQ hRTerminal hwvR hdefectiveR hvBoundaryR hwBoundaryR + lower hr hmaxLower htree hdata hnCast hnTreeCast +private theorem helper_hgammaControl_803.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), + ∀ v ∈ TreeSequenceVertexSet T, + ∀ (_ : Fin ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)), ett.series.data.stored previous.succ = + { choice.color, gamma } → terminal = previous.succ → gamma ∈ TreeMissingColors + (ett.series.data.coloring terminal) (ett.series.data.tree terminal.castSucc) ∪ + TashkinovStoredColors ett.series.data terminal := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v hvFinal q terminal previous gamma + choice currentStored hterminalEq + by_cases hm : gamma ∈ + TreeMissingColors (ett.series.data.coloring terminal) + (ett.series.data.tree terminal.castSucc) + · exact Finset.mem_union_left _ hm + · apply Finset.mem_union_right + rw [TashkinovStoredColors] + simp only [show terminal.val ≠ 0 by simp [terminal]; omega, + ite_false, Finset.mem_sdiff] + refine ⟨?_, hm⟩ + simp only [Finset.mem_biUnion] + refine ⟨terminal, Finset.mem_univ _, ?_⟩ + rw [hterminalEq, currentStored] + simp + +private theorem helper_hgammaBoundarySigma_844.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)) (_ : gamma ∈ TreeMissingColors + (ett.series.data.coloring terminal) (ett.series.data.tree terminal.castSucc) ∪ + TashkinovStoredColors ett.series.data terminal) (_ : ( + ∀ (f : E) (_ : TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f) (_ : (( + ∃ c ∈ TreeMissingColors (ett.series.data.coloring terminal) (ett.series.data.tree + terminal.castSucc) ∪ TashkinovStoredColors ett.series.data terminal, + ett.series.data.coloring terminal f = some c) ∨ + ∃ c ∈ TreeMissingColors (ett.series.data.coloring terminal) (ett.series.data.tree + terminal.castSucc) ∪ TashkinovStoredColors ett.series.data terminal, sigma f = some c)), + sigma f = ett.series.data.coloring terminal f)) (_ : ( + ∀ {f : E} (_ : f ∈ BoundaryEdges G (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc))), TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f)) (_ : + BoundaryColorEdges G (ett.series.data.coloring terminal) (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) gamma = { choice.edge }), BoundaryColorEdges G + sigma (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) gamma = + { choice.edge } := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma terminal previous gamma choice + hgammaControl hfixBoth boundaryIncident hgammaBoundaryCurrent + rw [← hgammaBoundaryCurrent] + apply Finset.ext + intro f + simp only [BoundaryColorEdges, Finset.mem_filter] + constructor + · rintro ⟨hfBoundary, hfSigma⟩ + refine ⟨hfBoundary, ?_⟩ + have hfix := hfixBoth f (boundaryIncident hfBoundary) + (Or.inr ⟨gamma, hgammaControl, hfSigma⟩) + exact hfix.symm.trans hfSigma + · rintro ⟨hfBoundary, hfCurrent⟩ + refine ⟨hfBoundary, ?_⟩ + have hfix := hfixBoth f (boundaryIncident hfBoundary) + (Or.inl ⟨gamma, hgammaControl, hfCurrent⟩) + exact hfix.trans hfCurrent + +private theorem helper_hcomponentEdgeColor_904.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : V), + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)) (f : E) (_ : Sum.inr f ∈ TwoColorComponent G + sigma gamma choice.color (Sum.inl choice.vertex)), sigma f = some gamma ∨ sigma f = some + choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma v previous gamma choice f hf + have hs : Sum.inr f ∈ + (TwoColorIncidenceGraph G sigma gamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G sigma gamma choice.color) + (u := Sum.inr f) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp hf + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G sigma gamma choice.color).mem_support.mp hs + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + +private theorem helper_boundaryEndpoint_945.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigma : PartialEdgeColoring E k) (delta : Fin k), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), + ∀ f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc)) delta, Incident G x f → + ∃ z ∉ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), G.ends f = s(x, z) := by + classical + intro V E _ _ _ G k e0 input T generating ett sigma delta terminal x hx f hf hxf + have hfBoundary := (Finset.mem_filter.mp hf).1 + rcases (by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] using hfBoundary) with ⟨u, hu, z, hz, hends⟩ + have hxEnds : x = u ∨ x = z := by + change x ∈ G.ends f at hxf + rw [hends] at hxf + simpa using hxf + rcases hxEnds with hxu | hxz + · exact ⟨z, hz, by simpa [hxu] using hends⟩ + · exact (hz (hxz ▸ hx)).elim + +private theorem helper_branch_1001.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)) (sigma : PartialEdgeColoring E k) (delta : + Fin k) (v : V) (q : Fin ett.rounds) (vi : V) (_ : ett.series.data.chosenVertex q.succ = + some vi) (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) (a : E) (_ : Incident G v a), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : previous.succ = terminal) (_ : ett.series.data.tree terminal.castSucc = + ett.series.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)) (_ : + ett.series.data.chosenVertex previous.succ = some choice.vertex), + let recovered : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex); + ∀ (_ : IsProperEdgeColoring G recovered) (_ : IsOneEdgeUncolored recovered e0) (_ : + StableColoring (ett.series.data.tree terminal.castSucc) (TashkinovStoredColors + ett.series.data previous.castSucc) (ett.series.data.coloring previous.castSucc) recovered) + (_ : a ∈ BoundaryColorEdges G recovered (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc)) delta) (_ : DefectiveColor G recovered (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) delta) (_ : q.succ = terminal), v = vi ∨ + TreeVertexOrder T v vi := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive orderTransfer sigma delta v q vi + hchosen hvN a hva terminal previous hpreviousSucc htreeTerminal gamma choice currentVertex + recovered hrecoveredProper hrecoveredOne hrecoveredStable haRecovered hdefectiveRecovered + hqTerminal + have hchoice : choice.vertex = vi := by + apply Option.some.inj + exact currentVertex.symm.trans + (by simpa [hqTerminal, hpreviousSucc] using hchosen) + have hvDefective : DefectiveVertex G recovered + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) v := + ⟨hvN, a, ⟨delta, hdefectiveRecovered, haRecovered⟩, hva⟩ + have hmaximal := choice.maximal recovered v hrecoveredProper + hrecoveredOne (by simpa [hpreviousSucc] using hrecoveredStable) + (by simpa [hpreviousSucc] using hvDefective) + rcases hmaximal with heq | horder + · exact Or.inl (heq.trans hchoice) + · apply Or.inr + have hsegment : TreeSequenceInitialSegment + (ett.series.data.tree terminal.castSucc) T := by + rw [htreeTerminal] + exact ett.abovePenultimate + exact orderTransfer hsegment v vi + (by simpa [hpreviousSucc, hchoice] using horder) + +private theorem helper_continuation_1207.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)) (sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (delta : Fin k) (v : V) + (hvFinal : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (vi : V) (_ : + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ ett.series.data.kind q.succ + = some TashkinovExtensionKind.SE) (_ : ett.series.data.chosenVertex q.succ = some vi) (_ : + ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (_ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + ∀ a ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) delta, Incident G v a → + ∀ (w : V), TreeVertexOrder (ett.series.data.tree (Fin.last ett.rounds).castSucc) w v → w ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc) → + ∀ b ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) delta, Incident G w b → + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); previous.succ = terminal → ett.series.data.tree terminal.castSucc = + ett.series.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)), ett.series.data.chosenVertex previous.succ + = some choice.vertex → terminal = previous.succ → gamma ≠ choice.color → choice.color ∈ + MissingColors G sigma choice.vertex → delta ≠ gamma → ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), Sum.inl x ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) ↔ x = choice.vertex) + → StableColoring (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors + ett.series.data previous.castSucc) (ett.series.data.coloring previous.castSucc) + (TwoColorComponentSwap G sigma gamma choice.color (Sum.inl choice.vertex)) → v = vi ∨ + TreeVertexOrder T v vi := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower + let this : DecidableEq V := + Classical.decEq V + intro stageToStage orderTransfer sigma hproper hone delta v hvFinal q vi hkind hchosen + hfirstBound hvN a haColor hva w hwv hwN b hbColor hwb terminal previous hpreviousSucc + htreeTerminal gamma choice currentVertex hterminalEq hgammaDeltaNe hdeltaSigmaMissing + hdeltaGammaNe hcomponent hundonePrevious + let recovered := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex) + have hrecoveredProper : IsProperEdgeColoring G recovered := by + exact TwoColorComponentSwapProper G sigma gamma choice.color + hgammaDeltaNe hproper (Sum.inl choice.vertex) + have hrecoveredOne := + @helper_hrecoveredOne_399 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive sigma hone gamma choice hgammaDeltaNe + have hrecoveredStable : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc) recovered := by + simpa [recovered, hterminalEq] using hundonePrevious + have hcomponentEdgeColor := + @helper_hcomponentEdgeColor_904 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hpositive sigma v gamma choice + have targetEdgeOutside := + @helper_targetEdgeOutside_444 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hpositive sigma delta gamma choice hdeltaSigmaMissing + hdeltaGammaNe hcomponent hcomponentEdgeColor + have haSigma : sigma a = some delta := (Finset.mem_filter.mp haColor).2 + have hbSigma : sigma b = some delta := (Finset.mem_filter.mp hbColor).2 + have haOutside := targetEdgeOutside a v hvN hva haSigma + have hbOutside := targetEdgeOutside b w hwN hwb hbSigma + have haRecoveredValue : recovered a = some delta := by + simp [recovered, TwoColorComponentSwap, haOutside, haSigma] + have hbRecoveredValue : recovered b = some delta := by + simp [recovered, TwoColorComponentSwap, hbOutside, hbSigma] + have haRecovered : a ∈ BoundaryColorEdges G recovered + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) + delta := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨(Finset.mem_filter.mp haColor).1, haRecoveredValue⟩ + have hbRecovered : b ∈ BoundaryColorEdges G recovered + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) + delta := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨(Finset.mem_filter.mp hbColor).1, hbRecoveredValue⟩ + have boundaryEndpoint := + @helper_boundaryEndpoint_945 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett sigma delta + obtain ⟨za, hzaOutside, haEnds⟩ := + boundaryEndpoint v hvN a haColor hva + obtain ⟨zb, hzbOutside, hbEnds⟩ := + boundaryEndpoint w hwN b hbColor hwb + have hwne : w ≠ v := by + intro hwvEq + rcases hwv with ⟨iw, iv, hiw, hiv, hlt⟩ + have hieq : iw = iv := by + apply (ett.series.data.tree terminal.castSucc).vertex_injective + exact hiw.trans (hiv.trans hwvEq.symm).symm + omega + have hab : a ≠ b := by + intro habEq + subst b + have hwEnds : w = v ∨ w = za := by + change w ∈ G.ends a at hwb + rw [haEnds] at hwb + simpa using hwb + rcases hwEnds with hwvEq | hwza + · exact hwne hwvEq + · exact hzaOutside (hwza ▸ hwN) + have hdefectiveRecovered : DefectiveColor G recovered + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) + delta := by + unfold DefectiveColor + have hc : 1 < (BoundaryColorEdges G recovered + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) + delta).card := Finset.one_lt_card.mpr + ⟨a, haRecovered, b, hbRecovered, hab⟩ + omega + have hvBoundaryRecovered : BoundaryColorVertex G recovered + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) + delta v := ⟨hvN, a, haRecovered, hva⟩ + have hwBoundaryRecovered : BoundaryColorVertex G recovered + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) + delta w := ⟨hwN, b, hbRecovered, hwb⟩ + by_cases hqTerminal : q.succ = terminal + · exact @helper_branch_1001 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive orderTransfer sigma delta v q vi hchosen hvN a hva hpreviousSucc + htreeTerminal gamma choice currentVertex hrecoveredProper hrecoveredOne hrecoveredStable + haRecovered hdefectiveRecovered hqTerminal + · exact @helper_branch_567 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hMP hpositive hlower stageToStage orderTransfer sigma delta v + hvFinal q vi hkind hchosen hfirstBound hvN a hva w hwv b hwb htreeTerminal gamma choice + hrecoveredProper hrecoveredOne hrecoveredStable haRecoveredValue hbRecoveredValue za + hzaOutside haEnds zb hzbOutside hbEnds hab hqTerminal + +private theorem helper_hchoiceSecond_1447.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (_ : v ∈ + TreeSequenceVertexSet T) (_ : Fin ett.rounds), + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)), StableColoring + (ett.series.data.tree previous.succ.castSucc) (insert choice.color (TashkinovStoredColors + ett.series.data previous.castSucc) : Finset (Fin k)) choice.selected secondStable → + secondStable choice.edge = some choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v hvFinal q previous secondStable + choice secondStableRelation + have hfix := secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), choice.edgeColor⟩ + exact hfix.trans choice.edgeColor + +private theorem helper_hgammaDeltaNe_1453.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (_ : v ∈ + TreeSequenceVertexSet T) (_ : Fin ett.rounds), + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)), gamma ∈ MissingColors G + secondStable choice.vertex → secondStable choice.edge = some choice.color → gamma ≠ + choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v hvFinal q previous gamma secondStable + choice hgammaSecond hchoiceSecond heq + have hpresent : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨choice.edge, choice.edgeIncident, heq ▸ hchoiceSecond⟩ + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgammaSecond + exact hnot hpresent + +private theorem helper_boundaryIncident_1485.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ {f : E}, + f ∈ BoundaryEdges G (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) → + TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f := by + classical + intro V E _ _ _ G k e0 input T generating ett terminal f hf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hf + rcases hf with ⟨x, hx, y, hy, hxy⟩ + exact ⟨x, hx, by simp [Incident, hxy]⟩ + +private theorem helper_hdeltaGammaNe_1506.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) delta → + ∀ (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin ett.rounds), + ∀ a ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) delta, + ∀ b ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) delta, + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)), BoundaryColorEdges G sigma + (TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)) gamma = + ({ choice.edge } : Finset E) → delta ≠ gamma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma delta hdefective v hvFinal q a + haColor b hbColor previous gamma choice hgammaBoundarySigma heq + subst delta + unfold DefectiveColor at hdefective + rw [hgammaBoundarySigma] at hdefective + simp at hdefective + +private theorem helper_hcomponent_1512.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + let _ : DecidableEq V := Classical.decEq V; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma → + ∀ (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); previous.succ = terminal → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)), ett.series.data.kind previous.succ = some + TashkinovExtensionKind.PE → ett.series.data.chosenVertex previous.succ = some + choice.vertex → ett.series.data.delta previous.succ = some choice.color → + ett.series.data.gamma previous.succ = some gamma → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), Sum.inl x ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) ↔ x = choice.vertex + := by + classical + intro V E _ _ edgeDecidable G k e0 input T generating ett hMP hpositive hlower this sigma hproper + hone hstable v hvFinal q terminal previous hpreviousSucc gamma choice currentKind + currentVertex currentDelta currentGamma + have hbase := @ExtensionBase V E _ _ edgeDecidable + G k e0 input T generating ett hMP hpositive + hlower choice.vertex gamma choice.color + (by simpa only [← hpreviousSucc, terminal] using currentKind) + (by simpa only [← hpreviousSucc, terminal] using currentVertex) + (by simpa only [← hpreviousSucc, terminal] using currentGamma) + (by simpa only [← hpreviousSucc, terminal] using currentDelta) + sigma hproper hone hstable + simpa [terminal] using hbase + +private theorem helper_branch_195.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)) (sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (_ : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring (Fin.last ett.rounds)) + sigma) (delta : Fin k) (_ : DefectiveColor G sigma (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) delta) (v : V) (hvFinal : v ∈ + TreeSequenceVertexSet T) (q : Fin ett.rounds) (vi : V) (_ : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ ett.series.data.kind q.succ = some + TashkinovExtensionKind.SE) (_ : ett.series.data.chosenVertex q.succ = some vi) (_ : + ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (_ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + ∀ a ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) delta, Incident G v a → + ∀ (w : V), TreeVertexOrder (ett.series.data.tree (Fin.last ett.rounds).castSucc) w v → w ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc) → + ∀ b ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) delta, Incident G w b → + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); previous.succ = terminal → ett.series.data.tree terminal.castSucc = + ett.series.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → + ∀ (ci : Fin ett.rounds), IsProperEdgeColoring G (ett.series.data.coloring ci.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring ci.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring ci.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring + ci.castSucc) (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate ett.series.data ci.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree ci.succ.castSucc) + (TashkinovStoredColors ett.series.data ci.castSucc) (ett.series.data.coloring + ci.castSucc)), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc))) → + ∀ (gamma : Fin k), ParallelExtensionColor ett.series.data ci.castSucc choice.selected + choice.vertex gamma → + ∀ (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected secondStable → + TreeExit (ett.series.data.tree ci.succ.castSucc) secondStable gamma choice.color + choice.vertex → ett.series.data.coloring ci.succ = TwoColorComponentSwap G secondStable + gamma choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G + (ett.series.data.coloring ci.succ) → IsOneEdgeUncolored (ett.series.data.coloring ci.succ) + e0 → ett.series.data.stored ci.succ = { choice.color, gamma } → + ett.series.data.connectingEdges ci.succ = { choice.edge } → ett.series.data.kind ci.succ = + some TashkinovExtensionKind.PE → ett.series.data.chosenVertex ci.succ = some choice.vertex + → ett.series.data.outsideVertex ci.succ = some choice.otherEndpoint → + ett.series.data.delta ci.succ = some choice.color → ett.series.data.gamma ci.succ = some + gamma → TashkinovClosure (ett.series.data.coloring ci.succ) (ett.series.data.tree + ci.succ.castSucc) (ett.series.data.tree ci.succ.succ) → TreeSequenceInitialSegment + (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ) → + (ett.series.data.tree ci.succ.castSucc).length < (ett.series.data.tree + ci.succ.succ).length → terminal = ci.succ → v = vi ∨ TreeVertexOrder T v vi := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower + let this : DecidableEq V := + Classical.decEq V + intro stageToStage orderTransfer sigma hproper hone hstable delta hdefective v hvFinal q vi + hkind hchosen hfirstBound hvN a haColor hva w hwv hwN b hbColor hwb terminal previous + hpreviousSucc htreeTerminal ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule + secondStable secondStableProper secondStableRelation exitWitness currentColoring + currentProper currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension strictExtension + hslot + have hci : ci = previous := by + apply Fin.ext + have hs := congrArg Fin.val hslot + simp [terminal, previous] at hs ⊢ + omega + subst ci + have hterminalEq : terminal = previous.succ := hslot + have htreeEq : ett.series.data.tree terminal.castSucc = + ett.series.data.tree previous.succ.castSucc := by + rw [hterminalEq] + have hchoiceVertex : choice.vertex ∈ + TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc) := by + simpa [htreeEq] using choice.vertexDefective.1 + have hgammaSecond : gamma ∈ MissingColors G secondStable + choice.vertex := by + rw [secondStableRelation.2 choice.vertex choice.vertexDefective.1] + exact gammaRule.1 + have hchoiceSecond := + @helper_hchoiceSecond_1447 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hvFinal) (@q) + (@secondStable) (@choice) (@secondStableRelation) + have hgammaDeltaNe := + @helper_hgammaDeltaNe_1453 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hvFinal) (@q) (@gamma) + (@secondStable) (@choice) (@hgammaSecond) (@hchoiceSecond) + have hchoiceSecondComponent : Sum.inr choice.edge ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hchoiceSecond] + have hdeltaCurrentMissing := + @helper_hdeltaCurrentMissing_266 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hpositive gamma secondStable secondStableProper choice + currentColoring hterminalEq hgammaSecond hchoiceSecond hgammaDeltaNe hchoiceSecondComponent + have hdeltaSigmaMissing : choice.color ∈ MissingColors G sigma + choice.vertex := by + rw [hstable.2 choice.vertex hchoiceVertex] + exact hdeltaCurrentMissing + have hgammaControl := + @helper_hgammaControl_803 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive v hvFinal q gamma choice currentStored hterminalEq + have hfixBoth := (sc1 G e0 + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma + (by simpa [hterminalEq] using currentProper) + (by simpa [hterminalEq] using currentOneUncolored) + hproper hone).mp hstable + have boundaryIncident := + @helper_boundaryIncident_1485 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) + have hgammaBoundaryCurrent : + BoundaryColorEdges G (ett.series.data.coloring terminal) + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) + gamma = {choice.edge} := by + have hbound := HkuParallelBoundaryStructure G k ett.rounds e0 input + ett.series previous choice.edge choice.color gamma choice.vertex + currentKind currentEdges currentDelta currentGamma currentVertex + simpa [hterminalEq] using hbound.1 + have hgammaBoundarySigma := + @helper_hgammaBoundarySigma_844 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hpositive sigma gamma choice hgammaControl hfixBoth + boundaryIncident hgammaBoundaryCurrent + have hdeltaGammaNe := + @helper_hdeltaGammaNe_1506 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@delta) (@hdefective) + (@v) (@hvFinal) (@q) (@a) (@haColor) (@b) (@hbColor) (@gamma) (@choice) + (@hgammaBoundarySigma) + have hcomponent := + @helper_hcomponent_1512 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@hlower) (@sigma) + (@hproper) (@hone) (@hstable) (@v) (@hvFinal) (@q) (@hpreviousSucc) (@gamma) (@choice) + (@currentKind) (@currentVertex) (@currentDelta) (@currentGamma) + obtain ⟨selected, recoveredSecond, hselectedProper, hselectedOne, + hselectedStable, hrecoveredSecondProper, hrecoveredSecondOne, + hrecoveredSecondStable, hcurrentSwap, hundoneSecond, + hundoneSelected, hundonePrevious⟩ := + ParallelExtensionUndoStable G k ett.rounds e0 input ett.series previous + choice.vertex gamma choice.color currentKind currentVertex currentGamma + currentDelta sigma hproper hone + (by simpa only [hpreviousSucc, terminal] using hstable) + choice.vertexDefective.1 + (by simpa only [hpreviousSucc, terminal] using hcomponent) + exact @helper_continuation_1207 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett hMP hpositive hlower stageToStage orderTransfer sigma hproper + hone delta v hvFinal q vi hkind hchosen hfirstBound hvN a haColor hva w hwv hwN b hbColor + hwb hpreviousSucc htreeTerminal gamma choice currentVertex hterminalEq hgammaDeltaNe + hdeltaSigmaMissing hdeltaGammaNe hcomponent hundonePrevious +theorem Basic2TerminalPE {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hterminalKind : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors ett.series.data n) (ett.series.data.coloring n) + sigma → + ∀ (delta : Fin k), + DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → + (∃ w, + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ + TreeVertexOrder Tn w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (vi : V), + (ett.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ + ett.series.data.kind q.succ = some TashkinovExtensionKind.SE) → + ett.series.data.chosenVertex q.succ = some vi → + ETTFirstAppearanceIndex ett v hvFinal ≤ q.val + 1 → + v = vi ∨ TreeVertexOrder T v vi := by + classical + let : DecidableEq V := Classical.decEq V + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + apply TreeSequenceInitialSegment.trans <;> assumption + have stepSegment : ∀ i : Fin (ett.rounds + 1), 0 < i.val → + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) + (ett.series.data.tree i.succ) := by + intro i hi + have cert := ett.series.certified i + cases cert with + | initial => exact (by simp at hi) + | SE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | RE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + have stageToStage : ∀ (a b : ℕ) (_ha : 1 ≤ a) (_hab : a ≤ b) + (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) + (ett.series.data.tree ⟨b, by omega⟩) := by + intro a b ha hab hb + have chain : ∀ (d : ℕ) (_hd : a + d ≤ b), + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) + (ett.series.data.tree ⟨a + d, by omega⟩) := by + intro d hd + induction d with + | zero => simpa using segmentRefl (ett.series.data.tree ⟨a, by omega⟩) + | succ d ih => + have hprev := ih (by omega) + let idx : Fin (ett.rounds + 1) := ⟨a + d, by omega⟩ + have hone := stepSegment idx (by dsimp [idx]; omega) + have hone' : TreeSequenceInitialSegment + (ett.series.data.tree ⟨a + d, by omega⟩) + (ett.series.data.tree ⟨a + (d + 1), by omega⟩) := by + simpa [idx, Nat.add_assoc] using hone + exact segmentTrans hprev hone' + have hchain := chain (b - a) (by omega) + convert hchain using 1; apply congrArg ett.series.data.tree; + apply Fin.ext; simp; omega + have orderTransfer : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ u w, + TreeVertexOrder A u w → TreeVertexOrder B u w := by + intro A B hAB u w huw + rcases hAB with ⟨hlen, hvertices, _⟩ + rcases huw with ⟨iu, iw, hu, hw, hi⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) iu, + Fin.castLE (Nat.succ_le_succ hlen) iw, + (hvertices iu).trans hu, (hvertices iw).trans hw, hi⟩ + dsimp only + intro sigma hproper hone hstable delta hdefective v hvBoundary + hvNonminimum hvFinal q vi hkind hchosen hfirstBound + rcases hvBoundary with ⟨hvN, a, haColor, hva⟩ + rcases hvNonminimum with + ⟨w, ⟨hwN, b, hbColor, hwb⟩, hwv⟩ + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let previous : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hpreviousSucc : previous.succ = terminal := by + apply Fin.ext + simp [previous, terminal] + omega + have htreeTerminal : + ett.series.data.tree terminal.castSucc = + ett.series.data.tree ⟨ett.rounds, by omega⟩ := by + congr 1 + have cert := ett.series.certified terminal + generalize hslot : terminal = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hz := congrArg Fin.val hslot + simp [terminal] at hz + omega + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hterm := hterminalKind + change ett.series.data.kind terminal = + some TashkinovExtensionKind.PE at hterm + rw [hslot, currentKind] at hterm + simp at hterm + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hterm := hterminalKind + change ett.series.data.kind terminal = + some TashkinovExtensionKind.PE at hterm + rw [hslot, currentKind] at hterm + simp at hterm + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_195 V E inferInstance inferInstance inferInstance G + k e0 input T generating ett hMP hpositive hlower stageToStage orderTransfer sigma + hproper hone hstable delta hdefective v hvFinal q vi hkind hchosen hfirstBound hvN + a haColor hva w hwv hwN b hbColor hwb hpreviousSucc htreeTerminal ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails gamma gammaRule secondStable secondStableProper + secondStableRelation exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension hslot +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean b/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean new file mode 100644 index 0000000000..a272391d74 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean @@ -0,0 +1,958 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBase + +public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable + +/-! +# Basic2Terminal SERE + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hpreviousStable_168.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : ett.series.data.kind + (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.RE), + let _ : DecidableEq V := Classical.decEq V; + ∀ (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma) (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin + ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : previous.succ = terminal), StableColoring (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) (ett.series.data.coloring + previous.castSucc) sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive hterminalKind this sigma hproper hone + hstable v hvFinal q terminal previous hpreviousSucc + have cert := ett.series.certified terminal + generalize hslot : terminal = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hz := congrArg Fin.val hslot + simp [terminal] at hz + omega + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hterm := hterminalKind + change ett.series.data.kind terminal = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind terminal = + some TashkinovExtensionKind.RE at hterm + rw [hslot] at hterm + rw [currentKind] at hterm + have hbad : some TashkinovExtensionKind.PE = + some TashkinovExtensionKind.SE ∨ + some TashkinovExtensionKind.PE = + some TashkinovExtensionKind.RE := hterm + simp at hbad + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hci : ci = previous := by + apply Fin.ext + have hs := congrArg Fin.val hslot + simp [terminal, previous] at hs ⊢ + omega + subst ci + have hmonotone := + (HkuMissingStoredMonotone G k ett.rounds e0 input ett.series previous).1 + have hterminalColor : ett.series.data.coloring terminal = choice.selected := by + rw [hslot] + exact currentColoring + have hcurrentStable : StableColoring + (ett.series.data.tree previous.succ.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) + choice.selected sigma := by + constructor + · intro f hf hcontrol + rcases hcontrol with ⟨c, hc, hcf⟩ + have holdControl : c ∈ + TreeMissingColors (ett.series.data.coloring previous.castSucc) + (ett.series.data.tree previous.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data previous.castSucc := by + rcases Finset.mem_union.mp hc with hc | hc + · apply Finset.mem_union.mpr + left + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨x, hx, hxc⟩ + refine ⟨x, hx, ?_⟩ + rw [← choice.selectedStable.2 x hx] + exact hxc + · exact Finset.mem_union.mpr (Or.inr hc) + have hnewControl := hmonotone holdControl + have hnewControl' : c ∈ + TreeMissingColors (ett.series.data.coloring terminal) + (ett.series.data.tree terminal.castSucc) ∪ + TashkinovStoredColors ett.series.data terminal := by + simpa [hslot] using hnewControl + have hf' : TreeIncidentEdge + (ett.series.data.tree terminal.castSucc) f := by + simpa [hslot] using hf + have hcf' : ett.series.data.coloring terminal f = some c := by + rw [hterminalColor] + exact hcf + have hs := hstable.1 f hf' ⟨c, hnewControl', hcf'⟩ + rw [hterminalColor] at hs + exact hs + · intro x hx + have hs := hstable.2 x (by simpa [hpreviousSucc] using hx) + rw [hterminalColor] at hs + exact hs + have hresult := (sc2 G e0 + (ett.series.data.tree previous.succ.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc)).trans + (x := ⟨ett.series.data.coloring previous.castSucc, + ⟨previousProper, previousOneUncolored⟩⟩) + (y := ⟨choice.selected, + ⟨choice.selectedProper, choice.selectedOneUncolored⟩⟩) + (z := ⟨sigma, ⟨hproper, hone⟩⟩) + choice.selectedStable hcurrentStable + simpa [hpreviousSucc] using hresult + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hci : ci = previous := by + apply Fin.ext + have hs := congrArg Fin.val hslot + simp [terminal, previous] at hs ⊢ + omega + subst ci + have hmonotone := + (HkuMissingStoredMonotone G k ett.rounds e0 input ett.series previous).1 + have hterminalColor : ett.series.data.coloring terminal = + ett.series.data.coloring previous.castSucc := by + rw [hslot] + exact currentColoring + constructor + · intro f hf hcontrol + rcases hcontrol with ⟨c, hc, hcf⟩ + have hnewControl := hmonotone hc + have hnewControl' : c ∈ + TreeMissingColors (ett.series.data.coloring terminal) + (ett.series.data.tree terminal.castSucc) ∪ + TashkinovStoredColors ett.series.data terminal := by + simpa [hslot] using hnewControl + have hf' : TreeIncidentEdge + (ett.series.data.tree terminal.castSucc) f := by + simpa [hslot] using hf + have hcf' : ett.series.data.coloring terminal f = some c := by + rw [hterminalColor] + exact hcf + have hs := hstable.1 f hf' ⟨c, hnewControl', hcf'⟩ + rw [hterminalColor] at hs + exact hs + · intro x hx + have hs := hstable.2 x (by simpa [hpreviousSucc] using hx) + rw [hterminalColor] at hs + exact hs + +private theorem helper_branch_305.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : ett.series.data.kind + (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.RE), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)) (sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (delta : Fin k) (_ : + DefectiveColor G sigma (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) delta) (v : V) (_ : v ∈ TreeSequenceVertexSet T) (q : Fin + ett.rounds) (vi : V) (_ : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ + ett.series.data.kind q.succ = some TashkinovExtensionKind.SE) (_ : + ett.series.data.chosenVertex q.succ = some vi) (_ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + ∀ a ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) delta, Incident G v a → + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); previous.succ = terminal → ett.series.data.tree terminal.castSucc = + ett.series.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → StableColoring (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) (ett.series.data.coloring + previous.castSucc) sigma → q.succ = terminal → v = vi ∨ TreeVertexOrder T v vi := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive hterminalKind this orderTransfer sigma + hproper hone delta hdefective v hvFinal q vi hkind hchosen hvN a haColor hva terminal + previous hpreviousSucc htreeTerminal hpreviousStable hqTerminal + have cert := ett.series.certified terminal + generalize hslot : terminal = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hz := congrArg Fin.val hslot + simp [terminal] at hz + omega + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hterm := hterminalKind + change ett.series.data.kind terminal = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind terminal = + some TashkinovExtensionKind.RE at hterm + rw [hslot] at hterm + rw [currentKind] at hterm + have hbad : some TashkinovExtensionKind.PE = + some TashkinovExtensionKind.SE ∨ + some TashkinovExtensionKind.PE = + some TashkinovExtensionKind.RE := hterm + simp at hbad + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE ∨ + some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.SE := by + rw [← currentKind] + simpa [hslot, hqTerminal] using hkind + simp at hbad + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hci : ci = previous := by + apply Fin.ext + have hs := congrArg Fin.val hslot + simp [terminal, previous] at hs ⊢ + omega + subst ci + have hchoice : choice.vertex = vi := by + apply Option.some.inj + exact currentVertex.symm.trans (by simpa [hslot, hqTerminal] using hchosen) + have hvDefective : DefectiveVertex G sigma + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) v := + ⟨hvN, a, ⟨delta, hdefective, haColor⟩, hva⟩ + have hmaximal := choice.maximal sigma v hproper hone (by + simpa only [hpreviousSucc] using hpreviousStable) (by + simpa [hslot] using hvDefective) + rcases hmaximal with heq | horder + · exact Or.inl (heq.trans hchoice) + · apply Or.inr + have hsegment : TreeSequenceInitialSegment + (ett.series.data.tree terminal.castSucc) T := by + rw [htreeTerminal] + exact ett.abovePenultimate + exact orderTransfer hsegment v vi (by simpa [hslot, hchoice] using horder) + +private theorem helper_appearanceInStage_400.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin + ett.rounds) (x : V) (hxFinal : x ∈ TreeSequenceVertexSet T) (s : ℕ) (_ : (1 : ℕ) ≤ s) + (_hsRound : s ≤ ett.rounds) (_ : ETTFirstAppearanceIndex ett x hxFinal ≤ s), x ∈ + TreeSequenceVertexSet (ett.series.data.tree (⟨s, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 input T generating ett this stageToStage v hvFinal q x hxFinal s + hsPositive hsRound hbound + unfold ETTFirstAppearanceIndex at hbound + dsimp at hbound + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + x ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hnonempty : candidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett + (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hxFinal + let m := candidates.min' hnonempty + have hmBound : m.val + 1 ≤ s := by + dsimp [m, candidates] + convert hbound using 1 + have hmRounds : m.val < ett.rounds := by omega + let mi : Fin ett.rounds := ⟨m.val, hmRounds⟩ + have hmEq : m = mi.castSucc := by + apply Fin.ext + rfl + have hmem := Finset.min'_mem candidates hnonempty + change m ∈ candidates at hmem + have hxStart : x ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨m.val + 1, by omega⟩) := by + rw [hmEq] at hmem + have hstage : ExtendedTashkinovLadderStage ett mi.castSucc = + ett.series.data.tree mi.succ.castSucc := by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T + (fun j => ett.series.data.tree j.succ.castSucc) mi + have hxMi : x ∈ TreeSequenceVertexSet + (ett.series.data.tree mi.succ.castSucc) := by + simpa only [candidates, Finset.mem_filter, Finset.mem_univ, true_and, + hstage] using hmem + convert hxMi using 1 + apply congrArg TreeSequenceVertexSet + apply congrArg ett.series.data.tree + apply Fin.ext + simp [mi] + exact TreeSequenceInitialSegmentVertexSetSubset + (stageToStage (m.val + 1) s (by omega) hmBound hsRound) hxStart + +private theorem helper_earlierInPrefix_473.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + ∀ v ∈ TreeSequenceVertexSet T, + ∀ (_ : Fin ett.rounds) {A B : TreeSequence G e0} (x y : V), + TreeSequenceInitialSegment A B → + y ∈ TreeSequenceVertexSet A → + TreeVertexOrder B x y → x ∈ TreeSequenceVertexSet A ∧ TreeVertexOrder A x y := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal q A B x y hAB hyA hxy + rcases hAB with ⟨hlen, hvertices, _⟩ + rcases Finset.mem_image.mp hyA with ⟨iyA, _, hiyA⟩ + rcases hxy with ⟨ixB, iyB, hixB, hiyB, hlt⟩ + let iyCast := Fin.castLE (Nat.succ_le_succ hlen) iyA + have hiyEq : iyB = iyCast := by + apply B.vertex_injective + exact hiyB.trans ((hvertices iyA).trans hiyA).symm + have hixBound : ixB.val < A.length + 1 := by + rw [hiyEq] at hlt + simp [iyCast] at hlt + omega + let ixA : Fin (A.length + 1) := ⟨ixB.val, hixBound⟩ + have hixCast : Fin.castLE (Nat.succ_le_succ hlen) ixA = ixB := by + apply Fin.ext + rfl + have hixA : A.vertex ixA = x := by + exact (hvertices ixA).symm.trans (by simpa [hixCast] using hixB) + constructor + · apply Finset.mem_image.mpr + exact ⟨ixA, Finset.mem_univ _, hixA⟩ + · refine ⟨ixA, iyA, hixA, hiyA, ?_⟩ + rw [hiyEq] at hlt + simpa [ixA, iyCast] using hlt + +private theorem helper_hfirstLower_662.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), + let _ : DecidableEq V := Classical.decEq V; + ∀ (v : V) (_ : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (hqBefore : (↑q : ℕ) + (1 : + ℕ) < ett.rounds), + let r : ℕ := ett.rounds - (1 : ℕ); + ∀ (hrBefore : r < ett.rounds) (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨(↑q : ℕ) + + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (lower : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (⟨r + (1 : ℕ), ( + by omega + )⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, ( + by omega + )⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = r) (_ : ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE (( + by omega + )) i))) (hvLower : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))), + let qLower : Fin lower.rounds := (⟨(↑q : ℕ), + by omega + ⟩ : Fin lower.rounds); ETTFirstAppearanceIndex lower v hvLower ≤ (↑qLower : ℕ) + (1 : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive this v hvFinal q hqBefore r hrBefore + hvAtQ lower hr htree hvLower qLower + unfold ETTFirstAppearanceIndex + dsimp + have hqTreeCast : Fin.castLE (by omega) qLower.succ.castSucc = + (⟨q.val + 1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + have hmem : qLower.castSucc ∈ + Finset.univ.filter + (fun i : Fin (lower.rounds + 1) => + v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage lower i)) := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage lower qLower.castSucc = + lower.series.data.tree qLower.succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc lower.rounds + (fun _ : Fin (lower.rounds + 1) => TreeSequence G e0) + (ett.series.data.tree ⟨r + 1, by omega⟩) + (fun j => lower.series.data.tree j.succ.castSucc) qLower] + rw [htree qLower.succ.castSucc, hqTreeCast] + exact hvAtQ + have hle := Finset.min'_le + (Finset.univ.filter + (fun i : Fin (lower.rounds + 1) => + v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage lower i))) qLower.castSucc hmem + have hnat := Fin.le_iff_val_le_val.mp hle + simpa [qLower] using Nat.succ_le_succ hnat + +private theorem helper_boundaryEndpoint_620.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigma : PartialEdgeColoring E k) (delta : Fin k), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), + ∀ f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc)) delta, Incident G x f → + ∃ z ∉ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), G.ends f = s(x, z) := by + classical + intro V E _ _ _ G k e0 input T generating ett sigma delta terminal x hx f hf hxf + have hfBoundary := (Finset.mem_filter.mp hf).1 + rcases (by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] using hfBoundary) with ⟨u, hu, z, hz, hends⟩ + have hxEnds : x = u ∨ x = z := by + change x ∈ G.ends f at hxf + rw [hends] at hxf + simpa using hxf + rcases hxEnds with hxu | hxz + · exact ⟨z, hz, by simpa [hxu] using hends⟩ + · exact (hz (hxz ▸ hx)).elim + +private theorem helper_hstableR_735.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), + let _ : DecidableEq V := Classical.decEq V; + ∀ (sigma : PartialEdgeColoring E k) (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin + ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : StableColoring (ett.series.data.tree terminal.castSucc) (TashkinovStoredColors + ett.series.data previous.castSucc) (ett.series.data.coloring previous.castSucc) sigma), + let r : ℕ := ett.rounds - (1 : ℕ); + ∀ (hrBefore : r < ett.rounds) (_ : TreeSequenceInitialSegment (ett.series.data.tree (⟨r, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree terminal.castSucc)) (lower : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (⟨r + (1 : ℕ), ( + by omega + )⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, ( + by omega + )⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = r), StableColoring + (ett.series.data.tree (⟨r, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc) sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive this sigma v hvFinal q terminal + previous hpreviousStable r hrBefore hRTerminal lower hr + constructor + · intro f hf hcontrol + apply hpreviousStable.1 f + · rcases hf with ⟨x, hx, hxf⟩ + exact ⟨x, TreeSequenceInitialSegmentVertexSetSubset hRTerminal hx, + hxf⟩ + · rcases hcontrol with ⟨c, hc, hcf⟩ + refine ⟨c, ?_, hcf⟩ + rcases Finset.mem_union.mp hc with hc | hc + · apply Finset.mem_union.mpr + left + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨x, hx, hxc⟩ + exact ⟨x, TreeSequenceInitialSegmentVertexSetSubset hRTerminal hx, + hxc⟩ + · exact Finset.mem_union.mpr (Or.inr hc) + · intro x hx + exact hpreviousStable.2 x + (TreeSequenceInitialSegmentVertexSetSubset hRTerminal hx) + +private theorem helper_continuation_767.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)) (sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (delta : Fin k) (v : V) (_ + : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (vi : V) (_ : ett.series.data.kind + q.succ = some TashkinovExtensionKind.PE ∨ ett.series.data.kind q.succ = some + TashkinovExtensionKind.SE) (_ : ett.series.data.chosenVertex q.succ = some vi) (_ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (a : E) (_ : + Incident G v a) (w : V) (b : E) (_ : Incident G w b) (_ : ett.series.data.tree (Fin.last + ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc = ett.series.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (_ : StableColoring (ett.series.data.tree (Fin.last + ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc) (TashkinovStoredColors ett.series.data + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (ett.series.data.coloring ((⟨ett.rounds - (1 : + ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) sigma) (hqBefore : (↑q : ℕ) + (1 : ℕ) < + ett.rounds) (_ : (1 : ℕ) ≤ (ett.rounds - (1 : ℕ) : ℕ)) (hrBefore : (ett.rounds - (1 : ℕ) : + ℕ) < ett.rounds) (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨(ett.rounds - (1 : + ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨(↑q : + ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (_ : TreeSequenceInitialSegment (ett.series.data.tree + (⟨(ett.rounds - (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + + (1 : ℕ))).castSucc)) (_ : w ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨(ett.rounds + - (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (_ : TreeVertexOrder (ett.series.data.tree (⟨(ett.rounds - + (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) w v) (_ : a ∈ BoundaryColorEdges G sigma + (TreeSequenceVertexSet (ett.series.data.tree (⟨(ett.rounds - (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) delta) (_ : b ∈ BoundaryColorEdges G sigma + (TreeSequenceVertexSet (ett.series.data.tree (⟨(ett.rounds - (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) delta) (_ : DefectiveColor G sigma (TreeSequenceVertexSet + (ett.series.data.tree (⟨(ett.rounds - (1 : ℕ) : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) delta), v = vi ∨ TreeVertexOrder T v vi := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower orderTransfer sigma hproper + hone delta v hvFinal q vi hkind hchosen hvN a hva w b hwb + set terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last + ett.rounds + set previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : + Fin ett.rounds) + intro htreeTerminal hpreviousStable hqBefore + set r : ℕ := ett.rounds - (1 : ℕ) + intro hrPositive hrBefore hvR hvAtQ hRTerminal hwR hwvR haR hbR hdefectiveR + have hvBoundaryR : BoundaryColorVertex G sigma + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta v := ⟨hvR, a, haR, hva⟩ + have hwBoundaryR : BoundaryColorVertex G sigma + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta w := ⟨hwR, b, hbR, hwb⟩ + obtain ⟨lower, hr, hmaxLower, htree, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP r + hrPositive hrBefore + let nLower : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hnCast : Fin.castLE (by omega) nLower = previous.castSucc := by + apply Fin.ext + simp [nLower, hr, previous, r] + have hnTreeCast : Fin.castLE (by omega) nLower.castSucc = + previous.castSucc.castSucc := by + apply Fin.ext + simp [nLower, hr, previous, r] + have hrTree : ett.series.data.tree ⟨r, by omega⟩ = + ett.series.data.tree previous.castSucc.castSucc := by + apply congrArg ett.series.data.tree + apply Fin.ext + simp [previous, r] + have hdisplay : ett.series.data.tree ⟨r + 1, by omega⟩ = + ett.series.data.tree terminal.castSucc := by + congr 1 + apply Fin.ext + simp [r, terminal] + omega + have hvLower : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨r + 1, by omega⟩) := by + rw [hdisplay] + exact hvN + rcases hdata nLower with + ⟨hnColor, hnRawStored, hnEdges, hnKind, hnVertex, hnOutside, + hnDelta, hnGamma, hnStored, hnCert⟩ + have hnColor' : lower.series.data.coloring nLower = + ett.series.data.coloring previous.castSucc := by + rw [hnColor, hnCast] + have hnStored' : TashkinovStoredColors lower.series.data nLower = + TashkinovStoredColors ett.series.data previous.castSucc := by + rw [hnStored, hnCast] + have hnTree' : lower.series.data.tree nLower.castSucc = + ett.series.data.tree ⟨r, by omega⟩ := by + rw [htree nLower.castSucc, hnTreeCast, ← hrTree] + have hstableR := + @helper_hstableR_735 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive sigma v hvFinal q hpreviousStable hrBefore hRTerminal lower hr + have hstableLower : StableColoring + (lower.series.data.tree nLower.castSucc) + (TashkinovStoredColors lower.series.data nLower) + (lower.series.data.coloring nLower) sigma := by + rw [hnTree', hnStored', hnColor'] + exact hstableR + let qLower : Fin lower.rounds := ⟨q.val, by omega⟩ + have hqCast : Fin.castLE (by omega) qLower.succ = q.succ := by + apply Fin.ext + rfl + rcases hdata qLower.succ with + ⟨_, _, _, hqKind, hqVertex, _, _, _, _, _⟩ + have hkindLower : lower.series.data.kind qLower.succ = + some TashkinovExtensionKind.PE ∨ + lower.series.data.kind qLower.succ = + some TashkinovExtensionKind.SE := by + rw [hqKind, hqCast] + exact hkind + have hchosenLower : lower.series.data.chosenVertex qLower.succ = some vi := by + rw [hqVertex, hqCast] + exact hchosen + have hfirstLower := + @helper_hfirstLower_662 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive v hvFinal q hqBefore hrBefore hvAtQ lower hr htree hvLower + have hdefectiveLower : DefectiveColor G sigma + (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) + delta := by + rw [hnTree'] + exact hdefectiveR + have hvBoundaryLower : BoundaryColorVertex G sigma + (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) + delta v := by + rw [hnTree'] + exact hvBoundaryR + have hwBoundaryLower : BoundaryColorVertex G sigma + (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) + delta w := by + rw [hnTree'] + exact hwBoundaryR + have hwvLower : TreeVertexOrder + (lower.series.data.tree nLower.castSucc) w v := by + rw [hnTree'] + exact hwvR + have hlowerFive := + (hlower lower (by omega) (by omega) hmaxLower).2.2.2.2.1 + have hresult := hlowerFive sigma hproper hone hstableLower delta + hdefectiveLower v hvBoundaryLower ⟨w, hwBoundaryLower, hwvLower⟩ + hvLower qLower vi hkindLower hchosenLower hfirstLower + rcases hresult with heq | horder + · exact Or.inl heq + · apply Or.inr + have hdisplayToT : TreeSequenceInitialSegment + (ett.series.data.tree ⟨r + 1, by omega⟩) T := by + rw [hdisplay] + rw [htreeTerminal] + exact ett.abovePenultimate + exact orderTransfer hdisplayToT v vi horder + +private theorem helper_branch_373.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)) (sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (delta : Fin k) (v : V) + (hvFinal : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (vi : V) (_ : + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ ett.series.data.kind q.succ + = some TashkinovExtensionKind.SE) (_ : ett.series.data.chosenVertex q.succ = some vi) (_ : + ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (_ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + ∀ a ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) delta, Incident G v a → + ∀ (w : V), TreeVertexOrder (ett.series.data.tree (Fin.last ett.rounds).castSucc) w v → w ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc) → + ∀ b ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) delta, Incident G w b → + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ett.series.data.tree terminal.castSucc = ett.series.data.tree + (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → StableColoring (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) (ett.series.data.coloring + previous.castSucc) sigma → ¬q.succ = terminal → v = vi ∨ TreeVertexOrder T v vi := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower this stageToStage orderTransfer + sigma hproper hone delta v hvFinal q vi hkind hchosen hfirstBound hvN a haColor hva w hwv hwN + b hbColor hwb terminal previous htreeTerminal hpreviousStable hqTerminal + have hqBefore : q.val + 1 < ett.rounds := by + have hle : q.val + 1 ≤ ett.rounds := by omega + have hne : q.val + 1 ≠ ett.rounds := by + intro heq + apply hqTerminal + apply Fin.ext + simpa [terminal] using heq + omega + have appearanceInStage := + @helper_appearanceInStage_400 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett stageToStage v hvFinal q + let r := ett.rounds - 1 + have hrPositive : 1 ≤ r := by + dsimp [r] + omega + have hrBefore : r < ett.rounds := by + dsimp [r] + omega + have hfirstToR : ETTFirstAppearanceIndex ett v hvFinal ≤ r := by + dsimp [r] + omega + have hvR : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨r, by omega⟩) := + appearanceInStage v hvFinal r hrPositive (by dsimp [r]; omega) hfirstToR + have hvAtQ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨q.val + 1, by omega⟩) := + appearanceInStage v hvFinal (q.val + 1) (by omega) (by omega) + hfirstBound + have hRTerminal : TreeSequenceInitialSegment + (ett.series.data.tree ⟨r, by omega⟩) + (ett.series.data.tree terminal.castSucc) := by + rw [htreeTerminal] + exact stageToStage r ett.rounds hrPositive (by dsimp [r]; omega) le_rfl + have earlierInPrefix := + @helper_earlierInPrefix_473 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett v hvFinal q + obtain ⟨hwR, hwvR⟩ := earlierInPrefix w v hRTerminal hvR hwv + have boundaryEndpoint := + @helper_boundaryEndpoint_620 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett sigma delta + obtain ⟨za, hzaOutside, haEnds⟩ := + boundaryEndpoint v hvN a haColor hva + obtain ⟨zb, hzbOutside, hbEnds⟩ := + boundaryEndpoint w hwN b hbColor hwb + have hzaR : za ∉ TreeSequenceVertexSet + (ett.series.data.tree ⟨r, by omega⟩) := by + intro hza + exact hzaOutside (TreeSequenceInitialSegmentVertexSetSubset hRTerminal hza) + have hzbR : zb ∉ TreeSequenceVertexSet + (ett.series.data.tree ⟨r, by omega⟩) := by + intro hzb + exact hzbOutside (TreeSequenceInitialSegmentVertexSetSubset hRTerminal hzb) + have haR : a ∈ BoundaryColorEdges G sigma + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta := by + simp only [BoundaryColorEdges, Finset.mem_filter] + refine ⟨?_, (Finset.mem_filter.mp haColor).2⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hvR, za, hzaR, haEnds⟩ + have hbR : b ∈ BoundaryColorEdges G sigma + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta := by + simp only [BoundaryColorEdges, Finset.mem_filter] + refine ⟨?_, (Finset.mem_filter.mp hbColor).2⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwR, zb, hzbR, hbEnds⟩ + have hwne : w ≠ v := by + intro hwvEq + rcases hwv with ⟨iw, iv, hiw, hiv, hlt⟩ + have hieq : iw = iv := by + apply (ett.series.data.tree terminal.castSucc).vertex_injective + exact hiw.trans (hiv.trans hwvEq.symm).symm + omega + have hab : a ≠ b := by + intro habEq + subst b + have hwEnds : w = v ∨ w = za := by + change w ∈ G.ends a at hwb + rw [haEnds] at hwb + simpa using hwb + rcases hwEnds with hwvEq | hwza + · exact hwne hwvEq + · exact hzaOutside (hwza ▸ hwN) + have hdefectiveR : DefectiveColor G sigma + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta := by + unfold DefectiveColor + have hc : 1 < (BoundaryColorEdges G sigma + (TreeSequenceVertexSet (ett.series.data.tree ⟨r, by omega⟩)) + delta).card := Finset.one_lt_card.mpr + ⟨a, haR, b, hbR, hab⟩ + omega + exact @helper_continuation_767 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett hMP hpositive hlower orderTransfer sigma hproper hone delta v + hvFinal q vi hkind hchosen hvN a hva w b hwb htreeTerminal hpreviousStable hqBefore + hrPositive hrBefore hvR hvAtQ hRTerminal hwR hwvR haR hbR hdefectiveR +theorem Basic2TerminalSERE {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hterminalKind : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring Tn + (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma → + ∀ (delta : Fin k), + DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → + (∃ w, BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tn) delta w ∧ + TreeVertexOrder Tn w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (vi : V), + (ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ + ett.series.data.kind q.succ = + some TashkinovExtensionKind.SE) → + ett.series.data.chosenVertex q.succ = some vi → + ETTFirstAppearanceIndex ett v hvFinal ≤ q.val + 1 → + v = vi ∨ TreeVertexOrder T v vi := by + classical + let : DecidableEq V := Classical.decEq V + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨hab.trans hbc, ?_, ?_⟩ + · intro i + have hmid := hvbc (Fin.castLE (Nat.succ_le_succ hab) i) + exact (by simpa using hmid.trans (hvab i)) + · intro i + have hmid := hebc (Fin.castLE hab i) + exact (by simpa using hmid.trans (heab i)) + have stepSegment : ∀ i : Fin (ett.rounds + 1), 0 < i.val → + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) + (ett.series.data.tree i.succ) := by + intro i hi + have cert := ett.series.certified i + cases cert with + | initial => exact (by simp at hi) + | SE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | RE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + have stageToStage : ∀ (a b : ℕ) (_ha : 1 ≤ a) (_hab : a ≤ b) + (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) + (ett.series.data.tree ⟨b, by omega⟩) := by + intro a b ha hab hb + have chain : ∀ (d : ℕ) (_hd : a + d ≤ b), + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) + (ett.series.data.tree ⟨a + d, by omega⟩) := by + intro d hd + induction d with + | zero => simpa using segmentRefl (ett.series.data.tree ⟨a, by omega⟩) + | succ d ih => + have hprev := ih (by omega) + let idx : Fin (ett.rounds + 1) := ⟨a + d, by omega⟩ + have hone := stepSegment idx (by dsimp [idx]; omega) + have hone' : TreeSequenceInitialSegment + (ett.series.data.tree ⟨a + d, by omega⟩) + (ett.series.data.tree ⟨a + (d + 1), by omega⟩) := by + simpa [idx, Nat.add_assoc] using hone + exact segmentTrans hprev hone' + have hchain := chain (b - a) (by omega) + convert hchain using 1; apply congrArg ett.series.data.tree; + apply Fin.ext; simp; omega + have orderTransfer : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ u w, + TreeVertexOrder A u w → TreeVertexOrder B u w := by + intro A B hAB u w huw + rcases hAB with ⟨hlen, hvertices, _⟩ + rcases huw with ⟨iu, iw, hu, hw, hi⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) iu, + Fin.castLE (Nat.succ_le_succ hlen) iw, + (hvertices iu).trans hu, (hvertices iw).trans hw, hi⟩ + dsimp only + intro sigma hproper hone hstable delta hdefective v hvBoundary + hvNonminimum hvFinal q vi hkind hchosen hfirstBound + rcases hvBoundary with ⟨hvN, a, haColor, hva⟩ + rcases hvNonminimum with + ⟨w, ⟨hwN, b, hbColor, hwb⟩, hwv⟩ + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let previous : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hpreviousSucc : previous.succ = terminal := by + apply Fin.ext + simp [previous, terminal] + omega + have htreeTerminal : + ett.series.data.tree terminal.castSucc = + ett.series.data.tree ⟨ett.rounds, by omega⟩ := by + congr 1 + have hpreviousStable := + @helper_hpreviousStable_168 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett hpositive hterminalKind sigma hproper hone hstable v hvFinal q + hpreviousSucc + by_cases hqTerminal : q.succ = terminal + · exact @helper_branch_305 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive hterminalKind orderTransfer sigma hproper hone delta hdefective v + hvFinal q vi hkind hchosen hvN a haColor hva hpreviousSucc htreeTerminal hpreviousStable + hqTerminal + · exact @helper_branch_373 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hMP hpositive hlower stageToStage orderTransfer sigma hproper hone + delta v hvFinal q vi hkind hchosen hfirstBound hvN a haColor hva w hwv hwN b hbColor hwb + htreeTerminal hpreviousStable hqTerminal +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/BoundaryColorEdges.lean b/LeanPool/GoldbergSeymour/BoundaryColorEdges.lean new file mode 100644 index 0000000000..9889f72345 --- /dev/null +++ b/LeanPool/GoldbergSeymour/BoundaryColorEdges.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.PartialEdgeColoring + +/-! +# Boundary Color Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Edges crossing the vertex-set boundary and carrying the specified color. -/ +noncomputable def BoundaryColorEdges {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) (X : Finset V) + (alpha : Fin k) : Finset E := by + classical + exact (BoundaryEdges G X).filter fun f => phi f = some alpha + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/BoundaryColorVertex.lean b/LeanPool/GoldbergSeymour/BoundaryColorVertex.lean new file mode 100644 index 0000000000..c26b6b60ed --- /dev/null +++ b/LeanPool/GoldbergSeymour/BoundaryColorVertex.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges + +/-! +# Boundary Color Vertex + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A vertex inside the set incident to a boundary edge of the specified color. -/ +def BoundaryColorVertex {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (X : Finset V) (delta : Fin k) (v : V) : Prop := + v ∈ X ∧ ∃ f ∈ BoundaryColorEdges G phi X delta, Incident G v f + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/BoundaryEdges.lean b/LeanPool/GoldbergSeymour/BoundaryEdges.lean new file mode 100644 index 0000000000..0796615442 --- /dev/null +++ b/LeanPool/GoldbergSeymour/BoundaryEdges.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Incident + +/-! +# Boundary Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- Edges with one endpoint in the vertex set and one endpoint outside it. -/ +noncomputable def BoundaryEdges {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) + (U : Finset V) : Finset E := by + classical + exact Finset.univ.filter fun e => ∃ u ∈ U, ∃ v ∉ U, G.ends e = s(u, v) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/BoundaryMissingColorAugmentation.lean b/LeanPool/GoldbergSeymour/BoundaryMissingColorAugmentation.lean new file mode 100644 index 0000000000..a0ac14a0fe --- /dev/null +++ b/LeanPool/GoldbergSeymour/BoundaryMissingColorAugmentation.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.TashkinovAugmentation + +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetStrict + +/-! +# Boundary Missing Color Augmentation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem BoundaryMissingColorAugmentation {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (X : TreeSequence G e0) + (c : Fin k) (f : E) + (hf : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet X) c) + (hc : c ∈ TreeMissingColors phi X) : + ∃ Xplus : TreeSequence G e0, + TreeSequenceAdjoinEdge X f Xplus ∧ + TashkinovAugmentation phi X Xplus ∧ + TreeSequenceVertexSet X ⊂ TreeSequenceVertexSet Xplus := by + classical + change f ∈ (BoundaryEdges G (TreeSequenceVertexSet X)).filter + (fun g => phi g = some c) at hf + rw [Finset.mem_filter] at hf + obtain ⟨Xplus, hAdjoin⟩ := + TreeSequenceBoundaryEdgeAppendExists X f hf.1 + obtain ⟨hLength, hInitial, hLastEdge⟩ := hAdjoin + refine ⟨Xplus, ⟨hLength, hInitial, hLastEdge⟩, ?_, ?_⟩ + · refine ⟨hLength, hInitial, c, ?_, hc⟩ + rw [hLastEdge] + exact hf.2 + · apply TreeSequenceInitialSegmentVertexSetStrict hInitial + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CertifiedETTPredecessor.lean b/LeanPool/GoldbergSeymour/CertifiedETTPredecessor.lean new file mode 100644 index 0000000000..29bd2bcdc2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/CertifiedETTPredecessor.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTreePrefix +public import LeanPool.GoldbergSeymour.MaximumPropertyPrefix + +/-! +# Certified ETTPredecessor + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem CertifiedETTPredecessor {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (hrounds : 1 < ett.rounds) : + ∃ predecessor : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree ⟨ett.rounds, by omega⟩) + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩), + ∃ hr : predecessor.rounds = ett.rounds - 1, + MaximumProperty predecessor ∧ + (∀ i : Fin (predecessor.rounds + 2), + predecessor.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) ∧ + (∀ i : Fin (predecessor.rounds + 1), + predecessor.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + predecessor.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + predecessor.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + predecessor.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + predecessor.series.data.chosenVertex i = + ett.series.data.chosenVertex (Fin.castLE (by omega) i) ∧ + predecessor.series.data.outsideVertex i = + ett.series.data.outsideVertex (Fin.castLE (by omega) i) ∧ + predecessor.series.data.delta i = + ett.series.data.delta (Fin.castLE (by omega) i) ∧ + predecessor.series.data.gamma i = + ett.series.data.gamma (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors predecessor.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i) ∧ + HEq (predecessor.series.certified i) + (ett.series.certified (Fin.castLE (by omega) i))) := by + have hmPositive : 1 ≤ ett.rounds - 1 := by omega + have hmBefore : ett.rounds - 1 < ett.rounds := by omega + have hidx : ett.rounds - 1 + 1 = ett.rounds := + Nat.sub_add_cancel (by omega) + have hprefix := ExtendedTashkinovTreePrefix G k e0 input T generating ett + (ett.rounds - 1) hmPositive hmBefore + ⟨ett.rounds, by omega⟩ hidx.symm + ⟨ett.rounds - 1, by omega⟩ rfl + obtain ⟨predecessor, hr, tree_eq, full_data_eq⟩ := hprefix + have data_eq : ∀ i : Fin (predecessor.rounds + 1), + predecessor.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + predecessor.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + predecessor.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors predecessor.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i) := by + intro i + rcases full_data_eq i with ⟨hc, _, he, hk, _, _, _, _, hs, _⟩ + exact ⟨hc, he, hk, hs⟩ + have hmax : MaximumProperty predecessor := + MaximumPropertyPrefix G k e0 input T generating ett hMP + (ett.rounds - 1) hmPositive hmBefore predecessor hr tree_eq data_eq + exact ⟨predecessor, hr, hmax, tree_eq, full_data_eq⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CertifiedETTRestriction.lean b/LeanPool/GoldbergSeymour/CertifiedETTRestriction.lean new file mode 100644 index 0000000000..f38c9cd95d --- /dev/null +++ b/LeanPool/GoldbergSeymour/CertifiedETTRestriction.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor + +/-! +# Certified ETTRestriction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem CertifiedETTRestriction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (r : ℕ) + (hrPositive : 1 ≤ r) (hrBefore : r < ett.rounds) : + ∃ restricted : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree ⟨r + 1, by omega⟩) + (ett.series.data.coloring ⟨r, by omega⟩), + ∃ hr : restricted.rounds = r, + MaximumProperty restricted ∧ + (∀ i : Fin (restricted.rounds + 2), + restricted.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) ∧ + (∀ i : Fin (restricted.rounds + 1), + restricted.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + restricted.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + restricted.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + restricted.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + restricted.series.data.chosenVertex i = + ett.series.data.chosenVertex (Fin.castLE (by omega) i) ∧ + restricted.series.data.outsideVertex i = + ett.series.data.outsideVertex (Fin.castLE (by omega) i) ∧ + restricted.series.data.delta i = + ett.series.data.delta (Fin.castLE (by omega) i) ∧ + restricted.series.data.gamma i = + ett.series.data.gamma (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors restricted.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i) ∧ + HEq (restricted.series.certified i) + (ett.series.certified (Fin.castLE (by omega) i))) := by + have hprefix := ExtendedTashkinovTreePrefix G k e0 input T generating ett + r hrPositive hrBefore + ⟨r + 1, by omega⟩ rfl + ⟨r, by omega⟩ rfl + obtain ⟨restricted, hr, tree_eq, full_data_eq⟩ := hprefix + have data_eq : ∀ i : Fin (restricted.rounds + 1), + restricted.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + restricted.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + restricted.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors restricted.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i) := by + intro i + rcases full_data_eq i with ⟨hc, _, he, hk, _, _, _, _, hs, _⟩ + exact ⟨hc, he, hk, hs⟩ + have hmax : MaximumProperty restricted := + MaximumPropertyPrefix G k e0 input T generating ett hMP + r hrPositive hrBefore restricted hr tree_eq data_eq + exact ⟨restricted, hr, hmax, tree_eq, full_data_eq⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CertifiedSeriesRoundsBound.lean b/LeanPool/GoldbergSeymour/CertifiedSeriesRoundsBound.lean new file mode 100644 index 0000000000..3ef7c3d005 --- /dev/null +++ b/LeanPool/GoldbergSeymour/CertifiedSeriesRoundsBound.lean @@ -0,0 +1,129 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeries + +/-! +# Certified Series Rounds Bound + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma CertifiedSeriesRoundsBound + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : Nat) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) : + rounds + 2 <= Fintype.card V := by + classical + have stepStrict : forall r : Fin rounds, + (series.data.tree r.succ.castSucc).length < + (series.data.tree r.succ.succ).length := by + intro r + have fact := series.certified r.succ + generalize hi : r.succ = z at fact + cases fact with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + simp_all + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hsame : i = r := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + simpa [hi] using strictExtension + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hsame : i = r := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + simpa [hi] using strictExtension + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hsame : i = r := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + simpa [hi] using strictExtension + have chain : forall j : Nat, forall hj : j <= rounds, + (series.data.tree (1 : Fin (rounds + 2))).length + j <= + (series.data.tree (Fin.castLE (by omega : j + 2 <= rounds + 2) + (Fin.last (j + 1)))).length := by + intro j + induction j with + | zero => + intro hj + have hindex : + Fin.castLE (by omega : 0 + 2 <= rounds + 2) (Fin.last (0 + 1)) = + (1 : Fin (rounds + 2)) := by + apply Fin.ext + simp + rw [hindex] + simp + | succ j ih => + intro hj + have hprev := ih (by omega) + let r : Fin rounds := ⟨j, by omega⟩ + have hstep := stepStrict r + have oldIndex : r.succ.castSucc = + Fin.castLE (by omega : j + 2 <= rounds + 2) (Fin.last (j + 1)) := by + apply Fin.ext + simp [r] + have newIndex : r.succ.succ = + Fin.castLE (by omega : j + 3 <= rounds + 2) (Fin.last (j + 2)) := by + apply Fin.ext + simp [r] + rw [oldIndex, newIndex] at hstep + have targetIndex : + Fin.castLE (by omega : Nat.succ j + 2 <= rounds + 2) + (Fin.last (Nat.succ j + 1)) = + Fin.castLE (by omega : j + 3 <= rounds + 2) + (Fin.last (j + 2)) := by + apply Fin.ext + simp + rw [targetIndex] + omega + have hchain := chain rounds (le_rfl) + have finalIndex : + Fin.castLE (by omega : rounds + 2 <= rounds + 2) (Fin.last (rounds + 1)) = + Fin.last (rounds + 1) := by + apply Fin.ext + simp + rw [finalIndex] at hchain + have hpositive := (series.data.tree (1 : Fin (rounds + 2))).positive + have hcard : + (series.data.tree (Fin.last (rounds + 1))).length + 1 <= + Fintype.card V := by + simpa using Fintype.card_le_of_injective + (series.data.tree (Fin.last (rounds + 1))).vertex + (series.data.tree (Fin.last (rounds + 1))).vertex_injective + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemma.lean b/LeanPool/GoldbergSeymour/ChangeLemma.lean new file mode 100644 index 0000000000..7445ab824c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemma.lean @@ -0,0 +1,305 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemmaBothInside +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside +public import LeanPool.GoldbergSeymour.ChangeLemmaInsideOutside + +/-! +# Change Lemma + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ChangeLemma_missing_to_vertex_211.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), let H := + C.hierarchy; let q := Fin.last H.dividerCount; let A := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → ∀ c ∈ TreeMissingColors phi A, T.vertex + (HierarchyFirstMissingPosition phi T c) ∈ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hAsegment c hc + unfold TreeMissingColors at hc + simp only [Finset.mem_biUnion] at hc + rcases hc with ⟨v, hv, hvc⟩ + unfold HierarchyFirstMissingPosition + unfold TreeSequenceVertexSet at hv + simp only [Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨ia, hia⟩ + rcases hAsegment with ⟨hlen, hvseg, heseg⟩ + let iaT : Fin (T.length + 1) := Fin.castLE (Nat.succ_le_succ hlen) ia + have hvertex : T.vertex iaT = A.vertex ia := by + exact hvseg ia + have hca : c ∈ MissingColors G phi (T.vertex iaT) := by + rw [hvertex, hia] + exact hvc + let candidates : Finset (Fin (T.length + 1)) := + Finset.univ.filter fun i => c ∈ MissingColors G phi (T.vertex i) + have hcand : candidates.Nonempty := ⟨iaT, by simp [candidates, hca]⟩ + have hpos : HierarchyFirstMissingPosition phi T c = candidates.min' hcand := by + simp [HierarchyFirstMissingPosition, candidates, hcand] + have hmin : HierarchyFirstMissingPosition phi T c ≤ iaT := by + rw [hpos] + exact Finset.min'_le candidates iaT (by simp [candidates, hca]) + have hbound : (HierarchyFirstMissingPosition phi T c).val ≤ A.length := by + dsimp [iaT] at hmin + change (HierarchyFirstMissingPosition phi T c).val ≤ iaT.val at hmin + exact le_trans hmin (Nat.le_of_lt_succ ia.isLt) + let x : Fin (A.length + 1) := + ⟨(HierarchyFirstMissingPosition phi T c).val, Nat.lt_succ_of_le hbound⟩ + have hx : T.vertex (Fin.castLE (Nat.succ_le_succ hlen) x) = + T.vertex (HierarchyFirstMissingPosition phi T c) := by + apply congrArg T.vertex + apply Fin.ext + rfl + simp only [TreeSequenceVertexSet, Finset.mem_image] + refine ⟨x, Finset.mem_univ _, ?_⟩ + rw [← hvseg x] + simpa [HierarchyFirstMissingPosition, candidates, hcand] using hx + +theorem ChangeLemma {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty) + (horderedUnused : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + (alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c)) : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let Dnq := HierarchyStoredColorsAt H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let sameComponent := TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) + (0 < H.dividerCount ∧ + (alpha ∈ TreeMissingColors phi Tnq ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) Dn) → + sameComponent) ∧ + (alpha ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A {alpha} → + sameComponent ∧ TreeInterchangeable G A phi alpha beta) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + have segmentTrans : ∀ X Y Z : TreeSequence G e0, + TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z := by + intro X Y Z hxy hyz + rcases hxy with ⟨hxy, hvxy, hexy⟩ + rcases hyz with ⟨hyz, hvyz, heyz⟩ + have h : X.length ≤ Z.length := by omega + refine ⟨h, ?_, ?_⟩ + · intro i + have hi := hvyz (Fin.castLE (Nat.succ_le_succ hxy) i) + have hj := hvxy i + have he : Fin.castLE (Nat.succ_le_succ h) i = + Fin.castLE (Nat.succ_le_succ hyz) (Fin.castLE (Nat.succ_le_succ hxy) i) := by + apply Fin.ext + rfl + rw [he] + exact hi.trans hj + · intro i + have hi := heyz (Fin.castLE hxy i) + have hj := hexy i + have he : Fin.castLE h i = Fin.castLE hyz (Fin.castLE hxy i) := by + apply Fin.ext + rfl + rw [he] + exact hi.trans hj + have stageToEnd : ∀ i : Fin (H.dividerCount + 1), + TreeSequenceInitialSegment (H.stage i.castSucc) + (H.stage (Fin.last (H.dividerCount + 1))) := by + have forward : ∀ i : Fin (H.dividerCount + 1), ∀ r : ℕ, + ∀ hbound : i.val + r ≤ H.dividerCount + 1, + TreeSequenceInitialSegment (H.stage i.castSucc) + (H.stage ⟨i.val + r, by omega⟩) := by + intro i r + induction r with + | zero => + intro h + exact ⟨Nat.le_refl _, by intro j; rfl, by intro j; rfl⟩ + | succ r ih => + intro hbound + let j : Fin (H.dividerCount + 1) := ⟨i.val + r, by omega⟩ + have hfirst := ih (by omega) + have hstep := H.nested j + have hmid : H.stage j.castSucc = H.stage ⟨i.val + r, by omega⟩ := by + congr 1 + have hlast : H.stage j.succ = + H.stage ⟨i.val + Nat.succ r, by omega⟩ := by + apply congrArg H.stage + apply Fin.ext + rfl + rw [← hmid] at hfirst + rw [hlast] at hstep + exact segmentTrans _ _ _ hfirst hstep + intro i + have hf := forward i (H.dividerCount + 1 - i.val) (by omega) + simpa [Fin.last] using hf + have hAsegment : TreeSequenceInitialSegment A T := by + rw [show T = H.stage (Fin.last (H.dividerCount + 1)) from H.terminalStage.symm] + by_cases hq : H.dividerCount = 0 + · have hA : A = base.core := by + dsimp [A, q, HierarchyStarredStage] + have hz : Fin.last H.dividerCount = + (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [hq] + rw [hz] + rfl + have hs : H.stage (Fin.last (H.dividerCount + 1)) = H.stage 1 := by + apply congrArg H.stage + apply Fin.ext + simp [hq] + simpa [hA, hs] using H.coreInsideFirst + · have hs : A = H.stage q.castSucc := by + have hqsucc : ∃ r : Fin H.dividerCount, q = r.succ := by + refine ⟨⟨H.dividerCount - 1, by omega⟩, ?_⟩ + apply Fin.ext + simp [q] + omega + rcases hqsucc with ⟨r, hr⟩ + change HierarchyStarredStage H q = H.stage q.castSucc + rw [hr] + dsimp [HierarchyStarredStage] + rw [hs] + exact stageToEnd q + have missing_to_vertex : + ∀ c : Fin k, c ∈ TreeMissingColors phi A → T.vertex (HierarchyFirstMissingPosition phi T c) ∈ + TreeSequenceVertexSet A := by + exact @ChangeLemma_missing_to_vertex_211 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C hAsegment + have prefixClosed : ∀ u v : V, TreeVertexOrder T u v → + v ∈ TreeSequenceVertexSet A → u ∈ TreeSequenceVertexSet A := by + intro u v huv hv + rcases huv with ⟨i, j, hi, hj, hij⟩ + unfold TreeSequenceVertexSet at hv + simp only [Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨x, hx⟩ + rcases hAsegment with ⟨hlen, hvseg, heseg⟩ + have heq : T.vertex j = T.vertex (Fin.castLE (Nat.succ_le_succ hlen) x) := by + exact hj.trans (hx.symm.trans (hvseg x).symm) + have hijx := T.vertex_injective heq + have hib : i.val ≤ A.length := by + have : i.val < j.val := hij + have : j.val = x.val := congrArg Fin.val hijx + omega + let y : Fin (A.length + 1) := ⟨i.val, Nat.lt_succ_of_le hib⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image] + refine ⟨y, Finset.mem_univ _, ?_⟩ + have heqy : T.vertex (Fin.castLE (Nat.succ_le_succ hlen) y) = T.vertex i := by + apply congrArg T.vertex + apply Fin.ext + rfl + rw [← hvseg y] + exact heqy.symm.trans hi + by_cases ha : T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ + TreeSequenceVertexSet A + · by_cases hb : T.vertex (HierarchyFirstMissingPosition phi T beta) ∈ + TreeSequenceVertexSet A + · exact ChangeLemmaBothInside G k e0 input T phi ett base C hproper hone + hlower hfewer hminimal hprefixElementary hlarge alpha beta hne + hmissingPrefix horderedUnused ⟨ha, hb⟩ + · exact ChangeLemmaInsideOutside G k e0 input T phi ett base C hproper hone + hlower hfewer hminimal hprefixElementary hlarge alpha beta hne + hmissingPrefix horderedUnused ⟨ha, hb⟩ + · by_cases hb : T.vertex (HierarchyFirstMissingPosition phi T beta) ∈ + TreeSequenceVertexSet A + · have hna : alpha ∉ TreeMissingColors phi A := by + intro h + exact ha (missing_to_vertex alpha h) + have ho := horderedUnused (Or.inl hna) + exact (ha (prefixClosed _ _ ho.1 hb)).elim + · have hmain := ChangeLemmaBothOutside G k e0 input T phi ett base C hproper hone + hlower hfewer hminimal hprefixElementary hlarge alpha beta hne + hmissingPrefix horderedUnused ⟨ha, hb⟩ + refine ⟨hmain.1, hmain.2, ?_⟩ + intro h + exact (ha (missing_to_vertex alpha h.1)).elim + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean new file mode 100644 index 0000000000..65ac8e716c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean @@ -0,0 +1,1364 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess + +public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction + +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability + +public import Mathlib.Tactic.ClearExcept + +/-! +# Change Lemma Both Inside + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hnonPEClosed_372.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : + IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (alpha beta : Fin k) (_ : ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T + (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k)))), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : + ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), ColoredVertexSetClosed G phi + (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone alpha beta _ n Tn trans hnonPE + have hp : 0 < ett.rounds := C.positive + clear * - ett phi n Tn G hproper hone hnonPE hp + have stableClosed (B : TreeSequence G e0) (D : Finset (Fin k)) + (psi : PartialEdgeColoring E k) + (hppsi : IsProperEdgeColoring G psi) + (hopsi : IsOneEdgeUncolored psi e0) + (hcpsi : ColoredVertexSetClosed G psi (TreeSequenceVertexSet B)) + (hs : StableColoring B D psi phi) : + ColoredVertexSetClosed G phi (TreeSequenceVertexSet B) := by + clear * - G phi e0 hproper hone B D psi hppsi hopsi hcpsi hs + intro f c x hf hx hfc hcm + have hincident : TreeIncidentEdge B f := by + obtain ⟨u, hu, v, hv, huv⟩ := by + simpa [BoundaryEdges] using hf + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [huv] + exact Sym2.mem_mk_left _ _ + have hcmPrev : c ∈ MissingColors G psi x := by + rw [← hs.2 x hx] + exact hcm + have hcTree : c ∈ TreeMissingColors psi B := + Finset.mem_biUnion.mpr ⟨x, hx, hcmPrev⟩ + have hfixed : phi f = psi f := + (sc1 G e0 B D psi phi hppsi hopsi hproper hone).mp hs + f hincident (Or.inr ⟨c, Finset.mem_union_left _ hcTree, hfc⟩) + exact hcpsi hf hx (hfixed.symm.trans hfc) hcmPrev + have hphi : phi = ett.series.data.coloring n := ett.generatingColoring + have hstep := ett.series.certified n + generalize targetEq : n = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hn : n ≠ 0 := by + intro hh + have hv := congrArg Fin.val hh + simp [n] at hv + omega + exact (hn targetEq).elim + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact (hnonPE (by rw [targetEq]; exact currentKind)).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i.succ = n := targetEq.symm + have htree : ett.series.data.tree i.succ.castSucc = Tn := by + simp [Tn, hi] + have hselected : choice.selected = phi := + currentColoring.symm.trans + ((congrArg ett.series.data.coloring hi).trans hphi.symm) + have hs : StableColoring Tn + (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc) phi := by + simpa only [htree, hselected] using choice.selectedStable + exact @stableClosed Tn _ _ previousProper previousOneUncolored + (by rw [← htree]; exact previousClosed) hs + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i.succ = n := targetEq.symm + have htree : ett.series.data.tree i.succ.castSucc = Tn := by + simp [Tn, hi] + have hcol : ett.series.data.coloring i.castSucc = phi := + currentColoring.symm.trans + ((congrArg ett.series.data.coloring hi).trans hphi.symm) + have hc : ColoredVertexSetClosed G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn) := by + rw [← htree] + exact previousClosed + exact @Eq.mp _ _ + (congrArg (fun psi => ColoredVertexSetClosed G psi + (TreeSequenceVertexSet Tn)) hcol) hc + +private theorem helper_closedStar_471.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : + IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating') (_ : other.rounds = ett.rounds) (_ : MaximumProperty other) (base' : + HierarchyBase other generating') (K : TashkinovHierarchy other base') (_ : GoodHierarchy + K) (_ : K.dividerCount < C.hierarchy.dividerCount), ColoredVertexSetElementary G + generating' (TreeSequenceVertexSet T'))) (_ : ( + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; (2 : ℕ) * ett.rounds + (11 : ℕ) + ≤ (TreeMissingColors phi Tn).card)), + let H : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r)))) (_ : CombinedStableColoring Tn + base.closure (TashkinovStoredColors ett.series.data n) phi phi) (_ : ( + ∀ (_ : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), + ∀ c ∈ TreeMissingColors phi Tn, TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k)))) (r : + Fin (H.dividerCount + (1 : ℕ))) (c d : Fin k) (_ : c ≠ d) (_ : c ∈ TreeMissingColors phi + (HierarchyStarredStage H r)) (_ : d ∈ TreeMissingColors phi (HierarchyStarredStage H r)) + (_ : TreeColorSetClosed G phi (HierarchyStarredStage H r) ({ c } : Finset (Fin k))), + TreeInterchangeable G (HierarchyStarredStage H r) phi c d := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge H n Tn + helemStar hcombined nonPEMissingClosed r c d hcd hc hd hclosed + cases r using Fin.cases with + | zero => + change c ∈ TreeMissingColors phi base.core at hc + change d ∈ TreeMissingColors phi base.core at hd + change TreeColorSetClosed G phi base.core {c} at hclosed + change TreeInterchangeable G base.core phi c d + by_cases hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hPE base hproper hone hcombined c d).2.2.1 hc hclosed + · have hcore : base.core = Tn := base.nonparallel hPE + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Tn) := by + rw [← hcore] + exact helemStar 0 + have hempty : BoundaryColorEdges G phi (TreeSequenceVertexSet Tn) d = ∅ := + nonPEMissingClosed hPE d (by simpa only [hcore] using hd) + d (Finset.mem_singleton_self _) + rw [hcore] + exact ElementarySingleBoundaryInterchangeable G phi Tn c d hproper helem + (by simpa only [hcore] using hclosed c (Finset.mem_singleton_self _)) + (by rw [hempty]; simp) + | succ i => + exact step1 G k e0 input T phi ett C.maximum C.positive hproper hone + hlower base H C.good hfewer hlarge i c d hc hcd hclosed + +private theorem helper_coreSame_500.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : + IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + ∀ (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r)))) (_ : alpha ∈ MissingColors G phi a) + (_ : beta ∈ MissingColors G phi b) (_ : ( + ∀ (B : TreeSequence G e0) (c d : Fin k) (_ : TreeInterchangeable G B phi c d), + TreeInterchangeable G B phi d c)) (_ : ( + ∀ (B : TreeSequence G e0) (_ : a ∈ TreeSequenceVertexSet B) (_ : b ∈ TreeSequenceVertexSet B) + (_ : TreeInterchangeable G B phi alpha beta), TwoColorComponent G phi alpha beta (Sum.inl + a) = TwoColorComponent G phi alpha beta (Sum.inl b))) (_ : ( + ∀ (B : TreeSequence G e0) (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B)) (_ + : TreeColorSetClosed G phi B ({ alpha } : Finset (Fin k))) (_ : TreeColorSetClosed G phi B + ({ beta } : Finset (Fin k))), TreeInterchangeable G B phi alpha beta)) (_ : + CombinedStableColoring Tn base.closure (TashkinovStoredColors ett.series.data n) phi phi) + (_ : ( + ∀ (_ : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), + ∀ c ∈ TreeMissingColors phi Tn, TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k)))) (_ : a + ∈ TreeSequenceVertexSet base.core) (_ : b ∈ TreeSequenceVertexSet base.core), + TwoColorComponent G phi alpha beta (Sum.inl a) = TwoColorComponent G phi alpha beta + (Sum.inl b) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H n Tn a b + helemStar haMissing hbMissing interchangeableSwap equalFromInterchange bothClosed hcombined + nonPEMissingClosed haCore hbCore + by_cases hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨hu⟩⟩ := base.parallel hPE + have haUnion : a ∈ TreeSequenceVertexSet Tn ∨ + a ∈ TreeSequenceVertexSet base.closure := by + simpa only [hu.vertexSet, Finset.mem_union] using haCore + have hbUnion : b ∈ TreeSequenceVertexSet Tn ∨ + b ∈ TreeSequenceVertexSet base.closure := by + simpa only [hu.vertexSet, Finset.mem_union] using hbCore + have hi := interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hPE base hproper hone hcombined alpha beta + have hj := interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hPE base hproper hone hcombined beta alpha + rcases haUnion with haN | haR <;> rcases hbUnion with hbN | hbR + · exact equalFromInterchange Tn haN hbN + (hi.2.1 (Finset.mem_biUnion.mpr ⟨a, haN, haMissing⟩)) + · exact equalFromInterchange base.core haCore hbCore + (hi.2.2.2 (Finset.mem_biUnion.mpr ⟨a, haN, haMissing⟩) + (Finset.mem_biUnion.mpr ⟨b, hbR, hbMissing⟩)) + · exact equalFromInterchange base.core haCore hbCore + (interchangeableSwap base.core beta alpha + (hj.2.2.2 (Finset.mem_biUnion.mpr ⟨b, hbN, hbMissing⟩) + (Finset.mem_biUnion.mpr ⟨a, haR, haMissing⟩))) + · exact equalFromInterchange base.closure haR hbR + (hi.1 (Finset.mem_biUnion.mpr ⟨a, haR, haMissing⟩)) + · have hcore : base.core = Tn := base.nonparallel hPE + have haN : a ∈ TreeSequenceVertexSet Tn := by simpa only [hcore] using haCore + have hbN : b ∈ TreeSequenceVertexSet Tn := by simpa only [hcore] using hbCore + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Tn) := by + rw [← hcore] + exact helemStar 0 + exact equalFromInterchange Tn haN hbN + (bothClosed Tn helem + (nonPEMissingClosed hPE alpha (Finset.mem_biUnion.mpr ⟨a, haN, haMissing⟩)) + (nonPEMissingClosed hPE beta (Finset.mem_biUnion.mpr ⟨b, hbN, hbMissing⟩))) + +private theorem helper_hsame_542.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k) (_ : alpha ≠ beta), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + ∀ (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A)) (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r)))) (_ : alpha ∈ MissingColors G phi a) + (_ : beta ∈ MissingColors G phi b) (_ : a ∈ TreeSequenceVertexSet A) (_ : b ∈ + TreeSequenceVertexSet A) (_ : ( + ∀ (B : TreeSequence G e0) (c d : Fin k) (_ : TreeInterchangeable G B phi c d), + TreeInterchangeable G B phi d c)) (_ : ( + ∀ (B : TreeSequence G e0) (_ : a ∈ TreeSequenceVertexSet B) (_ : b ∈ TreeSequenceVertexSet B) + (_ : TreeInterchangeable G B phi alpha beta), TwoColorComponent G phi alpha beta (Sum.inl + a) = TwoColorComponent G phi alpha beta (Sum.inl b))) (_ : ( + ∀ (B : TreeSequence G e0) (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B)) (_ + : TreeColorSetClosed G phi B ({ alpha } : Finset (Fin k))) (_ : TreeColorSetClosed G phi B + ({ beta } : Finset (Fin k))), TreeInterchangeable G B phi alpha beta)) (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c d : Fin k) (_ : c ≠ d) (_ : c ∈ TreeMissingColors + phi (HierarchyStarredStage H r)) (_ : d ∈ TreeMissingColors phi (HierarchyStarredStage H + r)) (_ : TreeColorSetClosed G phi (HierarchyStarredStage H r) ({ c } : Finset (Fin k))), + TreeInterchangeable G (HierarchyStarredStage H r) phi c d)) (_ : ( + ∀ (_ : a ∈ TreeSequenceVertexSet base.core) (_ : b ∈ TreeSequenceVertexSet base.core), + TwoColorComponent G phi alpha beta (Sum.inl a) = TwoColorComponent G phi alpha beta + (Sum.inl b))) (_ : alpha ∈ TreeMissingColors phi A) (_ : beta ∈ TreeMissingColors phi A), + TwoColorComponent G phi alpha beta (Sum.inl a) = TwoColorComponent G phi alpha beta + (Sum.inl b) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A a b helemA helemStar + haMissing hbMissing haA hbA interchangeableSwap equalFromInterchange bothClosed closedStar + coreSame haMissingA hbMissingA + by_cases haClosed : TreeColorSetClosed G phi A {alpha} + · by_cases hbClosed : TreeColorSetClosed G phi A {beta} + · exact equalFromInterchange A haA hbA (bothClosed A helemA haClosed hbClosed) + · exact equalFromInterchange A haA hbA + (closedStar q alpha beta hne haMissingA hbMissingA haClosed) + · by_cases hbClosed : TreeColorSetClosed G phi A {beta} + · exact equalFromInterchange A haA hbA + (interchangeableSwap A beta alpha + (closedStar q beta alpha hne.symm hbMissingA haMissingA hbClosed)) + · -- Descend to the least starred stage containing both witnesses. + let P (r : ℕ) : Prop := ∃ hr : r ≤ H.dividerCount, + a ∈ TreeSequenceVertexSet (HierarchyStarredStage H ⟨r, by omega⟩) ∧ + b ∈ TreeSequenceVertexSet (HierarchyStarredStage H ⟨r, by omega⟩) + have hex : ∃ r, P r := ⟨H.dividerCount, le_rfl, haA, hbA⟩ + let r := Nat.find hex + obtain ⟨hr, har, hbr⟩ : P r := Nat.find_spec hex + by_cases hr0 : r = 0 + · have hz : (⟨r, by omega⟩ : Fin (H.dividerCount + 1)) = 0 := Fin.ext hr0 + rw [hz] at har hbr + exact coreSame har hbr + · let i : Fin H.dividerCount := ⟨r - 1, by omega⟩ + have hri : (⟨r, by omega⟩ : Fin (H.dividerCount + 1)) = i.succ := by + apply Fin.ext + simp [i] + omega + have haCurrent : a ∈ TreeSequenceVertexSet (H.stage i.succ.castSucc) := by + simpa only [hri, HierarchyStarredStage, Fin.cases_succ] using har + have hbCurrent : b ∈ TreeSequenceVertexSet (H.stage i.succ.castSucc) := by + simpa only [hri, HierarchyStarredStage, Fin.cases_succ] using hbr + have hnotPrevious : ¬ (a ∈ TreeSequenceVertexSet + (HierarchyStarredStage H i.castSucc) ∧ + b ∈ TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)) := by + intro hab + have hprev : P (r - 1) := ⟨by omega, hab.1, hab.2⟩ + have hmin := Nat.find_min' hex hprev + change r ≤ r - 1 at hmin + omega + have helemCurrent : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (H.stage i.succ.castSucc)) := helemStar i.succ + have ham : alpha ∈ TreeMissingColors phi (H.stage i.succ.castSucc) := + Finset.mem_biUnion.mpr ⟨a, haCurrent, haMissing⟩ + have hbm : beta ∈ TreeMissingColors phi (H.stage i.succ.castSucc) := + Finset.mem_biUnion.mpr ⟨b, hbCurrent, hbMissing⟩ + by_cases haPrev : a ∈ TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc) + · have hbPrev : b ∉ TreeSequenceVertexSet + (HierarchyStarredStage H i.castSucc) := fun hb => hnotPrevious ⟨haPrev, hb⟩ + have hnew := GoodHierarchyNewMissingClosed C.good i helemCurrent beta + (Finset.mem_biUnion.mpr + ⟨b, Finset.mem_sdiff.mpr ⟨hbCurrent, hbPrev⟩, hbMissing⟩) + have hclosed : TreeColorSetClosed G phi (H.stage i.succ.castSucc) {beta} := by + intro d hd + have hd' := Finset.mem_singleton.mp hd + simpa only [hd'] using hnew + exact equalFromInterchange (H.stage i.succ.castSucc) haCurrent hbCurrent + (interchangeableSwap _ beta alpha + (closedStar i.succ beta alpha hne.symm hbm ham hclosed)) + · have hnew := GoodHierarchyNewMissingClosed C.good i helemCurrent alpha + (Finset.mem_biUnion.mpr + ⟨a, Finset.mem_sdiff.mpr ⟨haCurrent, haPrev⟩, haMissing⟩) + have hclosed : TreeColorSetClosed G phi (H.stage i.succ.castSucc) {alpha} := by + intro d hd + have hd' := Finset.mem_singleton.mp hd + simpa only [hd'] using hnew + exact equalFromInterchange (H.stage i.succ.castSucc) haCurrent hbCurrent + (closedStar i.succ alpha beta hne ham hbm hclosed) + +private theorem helper_stageChain_600.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (j : ℕ) (hj : j < + H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : ℕ) ≤ j), + TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H trans j + induction j with + | zero => + intro hj i hi + have hi0 : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have heq' : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) + (H.nested ⟨j, by omega⟩) + +private theorem helper_starChain_626.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : ( + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : + ℕ) ≤ j), TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + + (2 : ℕ)))))) (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H r) + (H.stage r.succ))) (r s : Fin (H.dividerCount + (1 : ℕ))) (_ : r ≤ s), + TreeSequenceInitialSegment (HierarchyStarredStage H r) (HierarchyStarredStage H s) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H trans stageChain starStage r s hrs + by_cases heq : r = s + · subst s + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have hrlt : r.val < s.val := by + have := Fin.le_iff_val_le_val.mp hrs + have : r.val ≠ s.val := fun h => heq (Fin.ext h) + omega + have hs : s ≠ 0 := by intro hs; subst s; simp at hrlt + have hstar : HierarchyStarredStage H s = H.stage s.castSucc := by + rw [← Fin.succ_pred s hs] + rfl + rw [hstar] + exact trans (starStage r) + (stageChain s.val (by omega) r.succ (by simp; omega)) + +private theorem helper_pathMissing_696.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : + IsProperEdgeColoring G phi) (alpha beta : Fin k) (_ : ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T + (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k)))) (c d : Fin k) (_ : c ≠ d) (v : V) (_ : c ∈ MissingColors G phi v), + TwoColorPathComponent G phi c d (Sum.inl v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper alpha beta _ c d hcd v hc + clear * - c d hcd v hc hproper + refine ⟨hcd, Sum.inl v, ?_, ?_⟩ + · change (TwoColorIncidenceGraph G phi c d).connectedComponentMk + (Sum.inl v) = + (TwoColorIncidenceGraph G phi c d).connectedComponentMk (Sum.inl v) + rfl + · let : Fintype + ((TwoColorIncidenceGraph G phi c d).neighborSet (Sum.inl v)) := + Fintype.ofFinite _ + have hcard : Fintype.card + ((TwoColorIncidenceGraph G phi c d).neighborSet (Sum.inl v)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact MissingColorIncidenceEndpoint G phi c d hcd hproper v hc + intro x hx y hy + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hcard ⟨x, hx⟩ ⟨y, hy⟩) + +private theorem helper_hATy_738.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega) + (by omega); + ∀ (_ : TreeSequenceInitialSegment A T), + TreeSequenceInitialSegment A Ty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hAT + have hlen : A.length ≤ Ty.length := by + change A.length ≤ min (A.length + ((T.length - A.length) - 1)) T.length + exact Nat.le_min.mpr ⟨Nat.le_add_right _ _, hAT.1⟩ + refine ⟨hlen, ?_, ?_⟩ + · intro j + change T.vertex _ = A.vertex j + exact hAT.2.1 j + · intro j + change T.edge _ = A.edge j + exact hAT.2.2 j + +private theorem helper_missingFirst_764.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega) + (by omega); + ∀ (_ : TreeSequenceInitialSegment Ty T), + ∀ c ∈ TreeMissingColors phi Ty, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hTyT c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hvT := TreeSequenceInitialSegmentVertexSetSubset hTyT hv + obtain ⟨j, hj⟩ : ∃ j, T.vertex j = v := by + simpa [TreeSequenceVertexSet] using hvT + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex j) + have hcandidates : candidates.Nonempty := by + refine ⟨j, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩⟩ + simpa [hj] using hcv + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hcandidates] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hcandidates)).2 + +private theorem helper_interchangeableSwap_801.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (_ : ( + ∀ (c d : Fin k), TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c)) (_ : ( + ∀ (c d : Fin k) (z : V ⊕ E), TwoColorComponent G phi c d z = TwoColorComponent G phi d c z)) + (B : TreeSequence G e0) (c d : Fin k) (_ : TreeInterchangeable G B phi c d), + TreeInterchangeable G B phi d c := by + classical + intro V E _ _ G k e0 phi graphSwap componentSwap B c d hi z w hz hw hzB hwB + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + have pathSwap (z : Sum V E) + (hz : TwoColorPathComponent G phi d c z) : + TwoColorPathComponent G phi c d z := by + refine ⟨hz.1.symm, ?_⟩ + simpa only [componentSwap c d, graphSwap c d] using hz.2 + rw [← componentSwap c d z, ← componentSwap c d w] + apply hi z w (pathSwap z hz) (pathSwap w hw) + · simpa only [componentSwap c d] using hzB + · simpa only [componentSwap c d] using hwB + +private theorem helper_trans_800.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) + (_ : TreeSequenceInitialSegment W Z), + TreeSequenceInitialSegment U Z := by + classical + intro V E G e0 U W Z hUW hWZ + refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ + · intro j + exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) j)).trans + (hUW.2.1 j) + · intro j + exact (hWZ.2.2 (Fin.castLE hUW.1 j)).trans (hUW.2.2 j) + +private theorem helper_equalFromInterchange_881.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (_ : + alpha ≠ beta), + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + ∀ (_ : alpha ∈ MissingColors G phi a) (_ : beta ∈ MissingColors G phi b) (_ : ( + ∀ (c d : Fin k) (_ : c ≠ d) (v : V) (_ : c ∈ MissingColors G phi v), TwoColorPathComponent G + phi c d (Sum.inl v))) (_ : ( + ∀ (c d : Fin k), TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c)) (_ : ( + ∀ (c d : Fin k) (z : V ⊕ E), TwoColorComponent G phi c d z = TwoColorComponent G phi d c z)) + (B : TreeSequence G e0) (_ : a ∈ TreeSequenceVertexSet B) (_ : b ∈ TreeSequenceVertexSet + B) (_ : TreeInterchangeable G B phi alpha beta), TwoColorComponent G phi alpha beta + (Sum.inl a) = TwoColorComponent G phi alpha beta (Sum.inl b) := by + classical + intro V E _ _ G k e0 T phi alpha beta hne a b haMissing hbMissing pathMissing graphSwap + componentSwap B haB hbB hi + let _ := Fintype.ofFinite V + have hpb : TwoColorPathComponent G phi alpha beta (Sum.inl b) := by + have hh := pathMissing beta alpha hne.symm b hbMissing + refine ⟨hne, ?_⟩ + simpa only [componentSwap alpha beta, graphSwap alpha beta] using hh.2 + apply hi _ _ (pathMissing alpha beta hne a haMissing) hpb + · exact ⟨a, haB, rfl⟩ + · exact ⟨b, hbB, rfl⟩ + +private theorem helper_nonPEMissingClosed_914.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k) (_ : ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T + (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k)))), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ (_ : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), ColoredVertexSetClosed G phi + (TreeSequenceVertexSet Tn))) (_ : ett.series.data.kind n ≠ some + TashkinovExtensionKind.PE), + ∀ c ∈ TreeMissingColors phi Tn, TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta _ n Tn hnonPEClosed hnonPE c hc d hd + have hdc : d = c := Finset.mem_singleton.mp hd + subst d + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨x, hx, hcx⟩ := Finset.mem_biUnion.mp hc + have hfd : f ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) ∧ + phi f = some c := by simpa [BoundaryColorEdges] using hf + exact hnonPEClosed hnonPE hfd.1 hx hfd.2 hcx + +private theorem helper_trans_889.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) + (_ : TreeSequenceInitialSegment W Z), + TreeSequenceInitialSegment U Z := by + classical + intro V E G e0 U W Z hUW hWZ + exact @helper_trans_800 (@V) (@E) (@G) (@e0) (@U) (@W) (@Z) (@hUW) (@hWZ) + +private theorem helper_stageChain_894.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (j : ℕ) (hj : j < + H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : ℕ) ≤ j), + TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H trans + exact @helper_stageChain_600 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) + +private theorem helper_starStage_899.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H r) (H.stage r.succ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H r + refine Fin.cases ?_ (fun i => ?_) r + · exact H.coreInsideFirst + · exact H.nested i.succ + +private theorem helper_starChain_906.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : ( + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : + ℕ) ≤ j), TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + + (2 : ℕ)))))) (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H r) + (H.stage r.succ))) (r s : Fin (H.dividerCount + (1 : ℕ))) (_ : r ≤ s), + TreeSequenceInitialSegment (HierarchyStarredStage H r) (HierarchyStarredStage H s) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H trans stageChain starStage r s hrs + exact @helper_starChain_626 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) (@stageChain) + (@starStage) (@r) (@s) (@hrs) + +private theorem helper_hAT_912.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H r) + (H.stage r.succ))), TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A starStage + have hh := starStage q + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa [hlast, H.terminalStage] using hh + +private theorem helper_hATy_916.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega) + (by omega); + ∀ (_ : TreeSequenceInitialSegment A T), + TreeSequenceInitialSegment A Ty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hAT + exact @helper_hATy_738 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) + +private theorem helper_helemStar_926.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ( + ∀ (r s : Fin (H.dividerCount + (1 : ℕ))) (_ : r ≤ s), TreeSequenceInitialSegment + (HierarchyStarredStage H r) (HierarchyStarredStage H s))) (_ : ColoredVertexSetElementary + G phi (TreeSequenceVertexSet A)) (r : Fin (H.dividerCount + (1 : ℕ))), + ColoredVertexSetElementary G phi (TreeSequenceVertexSet (HierarchyStarredStage H r)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A starChain helemA r + have hsub := TreeSequenceInitialSegmentVertexSetSubset + (starChain r q (Fin.le_last r)) + intro u hu v hv hne' + exact helemA (hsub hu) (hsub hv) hne' + +private theorem helper_missingFirst_933.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega) + (by omega); + ∀ (_ : TreeSequenceInitialSegment Ty T), + ∀ c ∈ TreeMissingColors phi Ty, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hTyT c hc + exact @helper_missingFirst_764 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hTyT) (@c) (@hc) + +private theorem helper_pathMissing_944.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : + IsProperEdgeColoring G phi) (alpha beta : Fin k) (_ : ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T + (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k)))) (c d : Fin k) (_ : c ≠ d) (v : V) (_ : c ∈ MissingColors G phi v), + TwoColorPathComponent G phi c d (Sum.inl v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper alpha beta _ c d hcd v hc + exact @helper_pathMissing_696 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@alpha) (@beta) (by assumption) (@c) (@d) (@hcd) (@v) (@hc) + +private theorem helper_graphSwap_950.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k) (_ : ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T + (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k)))) (c d : Fin k), TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph + G phi d c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta _ c d + clear * - G phi c d + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + +private theorem helper_componentSwap_955.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (phi : + PartialEdgeColoring E k) (_ : ( + ∀ (c d : Fin k), TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c)) (c d : + Fin k) (z : V ⊕ E), TwoColorComponent G phi c d z = TwoColorComponent G phi d c z := by + classical + intro V E G k phi graphSwap c d z + unfold TwoColorComponent + rw [graphSwap] + +private theorem helper_interchangeableSwap_959.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (_ : ( + ∀ (c d : Fin k), TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c)) (_ : ( + ∀ (c d : Fin k) (z : V ⊕ E), TwoColorComponent G phi c d z = TwoColorComponent G phi d c z)) + (B : TreeSequence G e0) (c d : Fin k) (_ : TreeInterchangeable G B phi c d), + TreeInterchangeable G B phi d c := by + classical + intro V E _ _ G k e0 phi graphSwap componentSwap B c d hi + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + exact @helper_interchangeableSwap_801 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@graphSwap) (@componentSwap) (@B) (@c) (@d) (@hi) + +private theorem helper_equalFromInterchange_964.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (_ : + alpha ≠ beta), + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + ∀ (_ : alpha ∈ MissingColors G phi a) (_ : beta ∈ MissingColors G phi b) (_ : ( + ∀ (c d : Fin k) (_ : c ≠ d) (v : V) (_ : c ∈ MissingColors G phi v), TwoColorPathComponent G + phi c d (Sum.inl v))) (_ : ( + ∀ (c d : Fin k), TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c)) (_ : ( + ∀ (c d : Fin k) (z : V ⊕ E), TwoColorComponent G phi c d z = TwoColorComponent G phi d c z)) + (B : TreeSequence G e0) (_ : a ∈ TreeSequenceVertexSet B) (_ : b ∈ TreeSequenceVertexSet + B) (_ : TreeInterchangeable G B phi alpha beta), TwoColorComponent G phi alpha beta + (Sum.inl a) = TwoColorComponent G phi alpha beta (Sum.inl b) := by + classical + intro V E _ _ G k e0 T phi alpha beta hne a b haMissing hbMissing pathMissing graphSwap + componentSwap B haB hbB hi + let _ := Fintype.ofFinite V + exact @helper_equalFromInterchange_881 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) + (@T) (@phi) (@alpha) (@beta) (@hne) (@haMissing) (@hbMissing) (@pathMissing) (@graphSwap) + (@componentSwap) (@B) (@haB) (@hbB) (@hi) + +private theorem helper_bothClosed_972.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G phi) + (alpha beta : Fin k) (B : TreeSequence G e0) + (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B)) + (_ : TreeColorSetClosed G phi B ({ alpha } : Finset (Fin k))) + (_ : TreeColorSetClosed G phi B ({ beta } : Finset (Fin k))), + TreeInterchangeable G B phi alpha beta := by + classical + intro V E _ _ G k e0 phi hproper alpha beta B helem hc hd + apply ElementarySingleBoundaryInterchangeable G phi B alpha beta + hproper helem (hc alpha (Finset.mem_singleton_self _)) + rw [hd beta (Finset.mem_singleton_self _)] + simp + +private theorem helper_hnonPEClosed_987.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : + IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (alpha beta : Fin k) (_ : ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T + (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k)))), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : + ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), ColoredVertexSetClosed G phi + (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone alpha beta _ n Tn trans hnonPE + exact @helper_hnonPEClosed_372 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@alpha) (@beta) (by assumption) (@trans) (@hnonPE) + +private theorem helper_nonPEMissingClosed_993.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k) (_ : ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T + (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k)))), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ (_ : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), ColoredVertexSetClosed G phi + (TreeSequenceVertexSet Tn))) (_ : ett.series.data.kind n ≠ some + TashkinovExtensionKind.PE), + ∀ c ∈ TreeMissingColors phi Tn, TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta _ n Tn hnonPEClosed hnonPE c hc + exact @helper_nonPEMissingClosed_914 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (by assumption) (@hnonPEClosed) (@hnonPE) (@c) (@hc) + +private theorem helper_closedStar_1000.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : + IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating') (_ : other.rounds = ett.rounds) (_ : MaximumProperty other) (base' : + HierarchyBase other generating') (K : TashkinovHierarchy other base') (_ : GoodHierarchy + K) (_ : K.dividerCount < C.hierarchy.dividerCount), ColoredVertexSetElementary G + generating' (TreeSequenceVertexSet T'))) (_ : ( + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; (2 : ℕ) * ett.rounds + (11 : ℕ) + ≤ (TreeMissingColors phi Tn).card)), + let H : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r)))) (_ : CombinedStableColoring Tn + base.closure (TashkinovStoredColors ett.series.data n) phi phi) (_ : ( + ∀ (_ : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), + ∀ c ∈ TreeMissingColors phi Tn, TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k)))) (r : + Fin (H.dividerCount + (1 : ℕ))) (c d : Fin k) (_ : c ≠ d) (_ : c ∈ TreeMissingColors phi + (HierarchyStarredStage H r)) (_ : d ∈ TreeMissingColors phi (HierarchyStarredStage H r)) + (_ : TreeColorSetClosed G phi (HierarchyStarredStage H r) ({ c } : Finset (Fin k))), + TreeInterchangeable G (HierarchyStarredStage H r) phi c d := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge H n Tn + helemStar hcombined nonPEMissingClosed r c d hcd hc hd hclosed + exact @helper_closedStar_471 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hfewer) (@hlarge) (@helemStar) (@hcombined) (@nonPEMissingClosed) (@r) (@c) + (@d) (@hcd) (@hc) (@hd) (@hclosed) + +private theorem helper_coreSame_1010.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : + IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + ∀ (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r)))) (_ : alpha ∈ MissingColors G phi a) + (_ : beta ∈ MissingColors G phi b) (_ : ( + ∀ (B : TreeSequence G e0) (c d : Fin k) (_ : TreeInterchangeable G B phi c d), + TreeInterchangeable G B phi d c)) (_ : ( + ∀ (B : TreeSequence G e0) (_ : a ∈ TreeSequenceVertexSet B) (_ : b ∈ TreeSequenceVertexSet B) + (_ : TreeInterchangeable G B phi alpha beta), TwoColorComponent G phi alpha beta (Sum.inl + a) = TwoColorComponent G phi alpha beta (Sum.inl b))) (_ : ( + ∀ (B : TreeSequence G e0) (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B)) (_ + : TreeColorSetClosed G phi B ({ alpha } : Finset (Fin k))) (_ : TreeColorSetClosed G phi B + ({ beta } : Finset (Fin k))), TreeInterchangeable G B phi alpha beta)) (_ : + CombinedStableColoring Tn base.closure (TashkinovStoredColors ett.series.data n) phi phi) + (_ : ( + ∀ (_ : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), + ∀ c ∈ TreeMissingColors phi Tn, TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k)))) (_ : a + ∈ TreeSequenceVertexSet base.core) (_ : b ∈ TreeSequenceVertexSet base.core), + TwoColorComponent G phi alpha beta (Sum.inl a) = TwoColorComponent G phi alpha beta + (Sum.inl b) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H n Tn a b + helemStar haMissing hbMissing interchangeableSwap equalFromInterchange bothClosed hcombined + nonPEMissingClosed haCore hbCore + exact @helper_coreSame_500 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) + (@alpha) (@beta) (@helemStar) (@haMissing) (@hbMissing) (@interchangeableSwap) + (@equalFromInterchange) (@bothClosed) (@hcombined) (@nonPEMissingClosed) (@haCore) (@hbCore) + +private theorem helper_hsame_1022.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k) (_ : alpha ≠ beta), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + ∀ (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A)) (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r)))) (_ : alpha ∈ MissingColors G phi a) + (_ : beta ∈ MissingColors G phi b) (_ : a ∈ TreeSequenceVertexSet A) (_ : b ∈ + TreeSequenceVertexSet A) (_ : ( + ∀ (B : TreeSequence G e0) (c d : Fin k) (_ : TreeInterchangeable G B phi c d), + TreeInterchangeable G B phi d c)) (_ : ( + ∀ (B : TreeSequence G e0) (_ : a ∈ TreeSequenceVertexSet B) (_ : b ∈ TreeSequenceVertexSet B) + (_ : TreeInterchangeable G B phi alpha beta), TwoColorComponent G phi alpha beta (Sum.inl + a) = TwoColorComponent G phi alpha beta (Sum.inl b))) (_ : ( + ∀ (B : TreeSequence G e0) (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B)) (_ + : TreeColorSetClosed G phi B ({ alpha } : Finset (Fin k))) (_ : TreeColorSetClosed G phi B + ({ beta } : Finset (Fin k))), TreeInterchangeable G B phi alpha beta)) (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c d : Fin k) (_ : c ≠ d) (_ : c ∈ TreeMissingColors + phi (HierarchyStarredStage H r)) (_ : d ∈ TreeMissingColors phi (HierarchyStarredStage H + r)) (_ : TreeColorSetClosed G phi (HierarchyStarredStage H r) ({ c } : Finset (Fin k))), + TreeInterchangeable G (HierarchyStarredStage H r) phi c d)) (_ : ( + ∀ (_ : a ∈ TreeSequenceVertexSet base.core) (_ : b ∈ TreeSequenceVertexSet base.core), + TwoColorComponent G phi alpha beta (Sum.inl a) = TwoColorComponent G phi alpha beta + (Sum.inl b))) (_ : alpha ∈ TreeMissingColors phi A) (_ : beta ∈ TreeMissingColors phi A), + TwoColorComponent G phi alpha beta (Sum.inl a) = TwoColorComponent G phi alpha beta + (Sum.inl b) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A a b helemA helemStar + haMissing hbMissing haA hbA interchangeableSwap equalFromInterchange bothClosed closedStar + coreSame haMissingA hbMissingA + exact @helper_hsame_542 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) + (@helemA) (@helemStar) (@haMissing) (@hbMissing) (@haA) (@hbA) (@interchangeableSwap) + (@equalFromInterchange) (@bothClosed) (@closedStar) (@coreSame) (@haMissingA) (@hbMissingA) + +private theorem helper_continuation_1524.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : + IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating') (_ : other.rounds = ett.rounds) (_ : MaximumProperty other) (base' : + HierarchyBase other generating') (K : TashkinovHierarchy other base') (_ : GoodHierarchy + K) (_ : K.dividerCount < C.hierarchy.dividerCount), ColoredVertexSetElementary G + generating' (TreeSequenceVertexSet T'))) (_ : ( + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; (2 : ℕ) * ett.rounds + (11 : ℕ) + ≤ (TreeMissingColors phi Tn).card)) (alpha beta : Fin k) (_ : alpha ≠ beta) (_ : ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T + (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k)))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + ∀ (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet A)) (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r)))) (_ : alpha ∈ MissingColors G phi a) + (_ : beta ∈ MissingColors G phi b) (_ : a ∈ TreeSequenceVertexSet A) (_ : b ∈ + TreeSequenceVertexSet A) (_ : ( + ∀ (B : TreeSequence G e0) (c d : Fin k) (_ : TreeInterchangeable G B phi c d), + TreeInterchangeable G B phi d c)) (_ : ( + ∀ (B : TreeSequence G e0) (_ : a ∈ TreeSequenceVertexSet B) (_ : b ∈ TreeSequenceVertexSet B) + (_ : TreeInterchangeable G B phi alpha beta), TwoColorComponent G phi alpha beta (Sum.inl + a) = TwoColorComponent G phi alpha beta (Sum.inl b))) (_ : ( + ∀ (B : TreeSequence G e0) (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B)) (_ + : TreeColorSetClosed G phi B ({ alpha } : Finset (Fin k))) (_ : TreeColorSetClosed G phi B + ({ beta } : Finset (Fin k))), TreeInterchangeable G B phi alpha beta)) (_ : + CombinedStableColoring Tn base.closure (TashkinovStoredColors ett.series.data n) phi phi), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + let sameComponent : Prop := TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (alpha ∈ + TreeMissingColors phi Tnq ∨ Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + phi Tn ∨ Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (alpha ∈ TreeMissingColors phi A ∧ TreeColorSetClosed G phi A ({ alpha } + : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A phi alpha beta) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge alpha beta + hne _ H q A n Tn a b trans helemA helemStar haMissing hbMissing haA hbA interchangeableSwap + equalFromInterchange bothClosed hcombined + have hnonPEClosed + (hnonPE : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE) : + ColoredVertexSetClosed G phi (TreeSequenceVertexSet Tn) := by + exact @helper_hnonPEClosed_987 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@alpha) (@beta) (by assumption) (@trans) (@hnonPE) + have nonPEMissingClosed + (hnonPE : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE) + (c : Fin k) (hc : c ∈ TreeMissingColors phi Tn) : + TreeColorSetClosed G phi Tn {c} := by + exact @helper_nonPEMissingClosed_993 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (by assumption) (@hnonPEClosed) (@hnonPE) (@c) (@hc) + have closedStar := @helper_closedStar_1000 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hfewer) (@hlarge) (@helemStar) (@hcombined) (@nonPEMissingClosed) + have coreSame := @helper_coreSame_1010 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@alpha) (@beta) (@helemStar) (@haMissing) (@hbMissing) (@interchangeableSwap) + (@equalFromInterchange) (@bothClosed) (@hcombined) (@nonPEMissingClosed) + have haMissingA : alpha ∈ TreeMissingColors phi A := + Finset.mem_biUnion.mpr ⟨a, haA, haMissing⟩ + have hbMissingA : beta ∈ TreeMissingColors phi A := + Finset.mem_biUnion.mpr ⟨b, hbA, hbMissing⟩ + have hsame := + @helper_hsame_1022 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@helemA) + (@helemStar) (@haMissing) (@hbMissing) (@haA) (@hbA) (@interchangeableSwap) + (@equalFromInterchange) (@bothClosed) (@closedStar) (@coreSame) (@haMissingA) (@hbMissingA) + refine ⟨fun _ => hsame, fun _ => hsame, ?_⟩ + intro hc + exact ⟨hsame, closedStar q alpha beta hne hc.1 hbMissingA hc.2⟩ + +theorem ChangeLemmaBothInside {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty) + (_ : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + (alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c)) + (hlocation : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + va ∈ TreeSequenceVertexSet A ∧ + vb ∈ TreeSequenceVertexSet A) : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let Dnq := HierarchyStoredColorsAt H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let sameComponent := TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) + (0 < H.dividerCount ∧ + (alpha ∈ TreeMissingColors phi Tnq ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) Dn) → + sameComponent) ∧ + (alpha ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A {alpha} → + sameComponent ∧ TreeInterchangeable G A phi alpha beta) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let a := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let b := T.vertex (HierarchyFirstMissingPosition phi T beta) + let Ty := TreeSequencePrefix T + (min (A.length + ((T.length - A.length) - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have trans := @helper_trans_889 (@V) (@E) (@G) (@e0) + have stageChain := + @helper_stageChain_894 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) + have starStage := @helper_starStage_899 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + have starChain := @helper_starChain_906 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) (@stageChain) + (@starStage) + have hAT := + @helper_hAT_912 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@starStage) + have hATy := + @helper_hATy_916 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) + have hTyT : TreeSequenceInitialSegment Ty T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have helemA : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by + intro u hu v hv hne' + exact hprefixElementary + (TreeSequenceInitialSegmentVertexSetSubset hATy hu) + (TreeSequenceInitialSegmentVertexSetSubset hATy hv) hne' + have helemStar := @helper_helemStar_926 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@starChain) (@helemA) + have missingFirst := @helper_missingFirst_933 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hTyT) + have haMissing : alpha ∈ MissingColors G phi a := + missingFirst alpha hmissingPrefix.1 + have hbMissing : beta ∈ MissingColors G phi b := + missingFirst beta hmissingPrefix.2 + have haA : a ∈ TreeSequenceVertexSet A := hlocation.1 + have hbA : b ∈ TreeSequenceVertexSet A := hlocation.2 + have pathMissing (c d : Fin k) (hcd : c ≠ d) (v : V) + (hc : c ∈ MissingColors G phi v) : + TwoColorPathComponent G phi c d (Sum.inl v) := by + exact @helper_pathMissing_944 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@alpha) (@beta) (by assumption) (@c) (@d) (@hcd) (@v) (@hc) + have graphSwap (c d : Fin k) : + TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c := by + exact @helper_graphSwap_950 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (by assumption) + (@c) (@d) + have componentSwap := @helper_componentSwap_955 (@V) (@E) (@G) (@k) (@phi) (@graphSwap) + have interchangeableSwap := @helper_interchangeableSwap_959 (@V) (@E) inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@graphSwap) (@componentSwap) + have equalFromInterchange := @helper_equalFromInterchange_964 (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@phi) (@alpha) (@beta) (@hne) (@haMissing) (@hbMissing) + (@pathMissing) (@graphSwap) (@componentSwap) + have bothClosed := @helper_bothClosed_972 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@hproper) (@alpha) (@beta) + have stableRefl (B : TreeSequence G e0) (D : Finset (Fin k)) : + StableColoring B D phi phi := + ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ + have hcombined : CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data n) phi phi := + ⟨stableRefl _ _, stableRefl _ _⟩ + exact @helper_continuation_1524 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hfewer) (@hlarge) (@alpha) (@beta) (@hne) (by assumption) (@trans) (@helemA) + (@helemStar) (@haMissing) (@hbMissing) (@haA) (@hbA) (@interchangeableSwap) + (@equalFromInterchange) (@bothClosed) (@hcombined) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean new file mode 100644 index 0000000000..15e801161a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean @@ -0,0 +1,284 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation6 + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Change Lemma Both Outside + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open ChangeLemmaBothOutsidePreparation + +theorem ChangeLemmaBothOutside {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (_ : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty) + (horderedUnused : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + (alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c)) + (hlocation : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + va ∉ TreeSequenceVertexSet A ∧ + vb ∉ TreeSequenceVertexSet A) : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let _ := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let Dnq := HierarchyStoredColorsAt H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let sameComponent := TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) + (0 < H.dividerCount ∧ + (alpha ∈ TreeMissingColors phi Tnq ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) Dn) → + sameComponent) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + let va := T.vertex ia + let vb := T.vertex ib + let ell := T.length - A.length + let yLength := min (A.length + (ell - 1)) T.length + let Y := TreeSequencePrefix T yLength + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have segRefl (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + exact @helper_segTrans_973 (@V) (@E) (@G) (@e0) (@S) (@U) (@W) (@hSU) (@hUW) + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + exact @helper_commonPrefix_982 (@V) (@E) (@G) (@e0) (@S) (@U) (@W) (@hSW) (@hUW) (@hlen) + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + induction d with + | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + have stageToT (j : Fin (H.dividerCount + 2)) : + TreeSequenceInitialSegment (H.stage j) T := by + exact @helper_stageToT_998 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@stageSegment) (@j) + have lastZero (hz : H.dividerCount = 0) : A = base.core := by + simp [A, q, HierarchyStarredStage, hz, Fin.last] + have lastPositive (hz : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact @helper_lastPositive_1007 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hz) + have coreToA : TreeSequenceInitialSegment base.core A := by + exact @helper_coreToA_1018 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@segRefl) (@segTrans) + (@stageSegment) (@lastZero) (@lastPositive) + have TnToCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (base.parallel hp).2.2).leftSegment + · rw [base.nonparallel hp] + exact segRefl _ + have TnToA := segTrans TnToCore coreToA + have AToT : TreeSequenceInitialSegment A T := by + exact @helper_AToT_1032 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@segTrans) (@stageToT) + (@lastZero) (@lastPositive) + have ordinaryToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + exact @helper_ordinaryToA_1038 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@stageSegment) + (@lastPositive) (@TnToA) (@j) + have starredToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + exact Fin.cases coreToA (fun i => ordinaryToA i.succ) j + have YToT : TreeSequenceInitialSegment Y T := + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + have hmissingY : alpha ∈ TreeMissingColors phi Y ∧ beta ∈ TreeMissingColors phi Y := + hmissingPrefix + have hElementaryY : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) := + hprefixElementary + have firstMissing (c : Fin k) (hc : c ∈ TreeMissingColors phi Y) : + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (HierarchyFirstMissingPosition phi T c).val ≤ Y.length := by + exact @helper_firstMissing_1057 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@YToT) (@c) (@hc) + have ha := firstMissing alpha hmissingY.1 + have hb := firstMissing beta hmissingY.2 + have vertexY (i : Fin (T.length + 1)) (hi : i.val ≤ Y.length) : + T.vertex i ∈ TreeSequenceVertexSet Y := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have haY : va ∈ TreeSequenceVertexSet Y := vertexY ia ha.2 + have hbY : vb ∈ TreeSequenceVertexSet Y := vertexY ib hb.2 + have hout : va ∉ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A := hlocation + have outsideIndex (i : Fin (T.length + 1)) + (hi : T.vertex i ∉ TreeSequenceVertexSet A) : A.length < i.val := by + exact @helper_outsideIndex_1087 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@AToT) (@i) (@hi) + have hAia := outsideIndex ia hout.1 + have hAib := outsideIndex ib hout.2 + have AToY : TreeSequenceInitialSegment A Y := + commonPrefix AToT YToT (by omega) + have missingNotA (c : Fin k) (i : Fin (T.length + 1)) + (hmi : c ∈ MissingColors G phi (T.vertex i)) + (hiy : T.vertex i ∈ TreeSequenceVertexSet Y) + (hia : T.vertex i ∉ TreeSequenceVertexSet A) : c ∉ TreeMissingColors phi A := by + exact @helper_missingNotA_1098 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@hElementaryY) (@AToY) (@c) (@i) (@hmi) (@hiy) (@hia) + exact @helper_continuation_4272 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hminimal) (@alpha) (@beta) (@hne) (@hmissingPrefix) (@horderedUnused) + (@hlocation) (@segRefl) (@segTrans) (@commonPrefix) (@lastPositive) (@coreToA) (@TnToA) + (@AToT) (@ordinaryToA) (@starredToA) (@YToT) (@hmissingY) (@hElementaryY) (@ha) (@hb) + (@vertexY) (@haY) (@hbY) (@hout) (@hAia) (@hAib) (@missingNotA) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean new file mode 100644 index 0000000000..13ad25fa2b --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean @@ -0,0 +1,5332 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# ChangeLemmaBothOutside: supporting constructions, part 1 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +/-- Dependent contract shared by the outside change lemma proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperFinish4308Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + alpha ∈ TreeMissingColors phi Ty ∧ beta ∈ TreeMissingColors phi Ty) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + va ∉ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + alpha ∈ TreeMissingColors phi Y ∧ beta ∈ TreeMissingColors phi Y → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + va ∈ TreeSequenceVertexSet Y → + vb ∈ TreeSequenceVertexSet Y → + va ∉ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A → + A.length < (↑ia : ℕ) → + ∀ (hAib : A.length < (↑ib : ℕ)), + alpha ∉ TreeMissingColors phi A → + beta ∉ TreeMissingColors phi A → + TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + (↑ia : ℕ) < (↑ib : ℕ) → + va ≠ vb → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A B → + A.length < B.length → + TreeSequenceInitialSegment B Y → + B.length < T.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.1, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive Tn + have := GoldbergSeymour.TreeSequence.positive Y + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (ett.1 + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.1, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive Tn + have := GoldbergSeymour.TreeSequence.positive Y + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { + rounds := ett.1, roundsPositive := rpB, + series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + { rounds := ett.1, roundsPositive := rpB, + series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series ≍ + ett.series → + ∀ + (baseB : + HierarchyBase + { + rounds := ett.1, roundsPositive := rpB, + series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + baseB.closure = base.closure → + (↑baseB.supportPosition : ℕ) = + (↑base.supportPosition : ℕ) → + ∀ + (HB : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, + series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (hcountB : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := + GoldbergSeymour.TreeSequence.positive Tn + have := GoldbergSeymour.TreeSequence.positive Y + have := GoldbergSeymour.TreeSequence.positive B + omega) + j; + HB.stage j.castSucc = H.stage jo.castSucc ∧ + HierarchyStarredStage HB j = + HierarchyStarredStage H jo) → + (∀ (i : Fin HB.dividerCount), + (↑(HB.dividerPosition i) : ℕ) = + (↑(H.dividerPosition (Fin.cast hcountB i)) : + ℕ)) → + ∀ (goodB : GoodHierarchy HB), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (by + have := + GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive A + have := + GoldbergSeymour.TreeSequence.positive Tn + have := + GoldbergSeymour.TreeSequence.positive Y + have := + GoldbergSeymour.TreeSequence.positive B + omega) + j; + HierarchyStoredColorsAt HB j = + HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HB j = + HierarchyStageMissingColors H jo ∧ + ∀ (eta : Fin k), + goodB.gamma j eta = C.good.gamma jo eta ∧ + HierarchySegmentColors HB j eta ⊆ + HierarchySegmentColors H jo eta) → + let ettB : + ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, + series := ett.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }; + (∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeMissingColors phi S ⊆ + TreeMissingColors phi U) → + ((0 : ℕ) < H.dividerCount ∧ + (alpha ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := + GoldbergSeymour.TreeSequence.positive + T + have := + GoldbergSeymour.TreeSequence.positive + A + have := + GoldbergSeymour.TreeSequence.positive + Tn + have := + GoldbergSeymour.TreeSequence.positive + Y + have := + GoldbergSeymour.TreeSequence.positive + B + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∨ + Disjoint + (insert alpha + ({ beta } : Finset (Fin k)) : + Finset (Fin k)) + (HierarchyStoredColorsAt H q)) ∨ + H.dividerCount = (0 : ℕ) ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint + (insert alpha + ({ beta } : Finset (Fin k)) : + Finset (Fin k)) + Dn) → + alpha ∉ Dn ∧ beta ∉ Dn) → + alpha ∉ Dn ∧ beta ∉ Dn → + TwoColorComponent G phi alpha beta + (Sum.inl va) = + TwoColorComponent G phi alpha beta + (Sum.inl vb) + +/-- Dependent contract shared by the outside change lemma proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation4272Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (by + have := A.positive + have := T.positive + omega) + (by omega); + alpha ∈ TreeMissingColors phi Ty ∧ beta ∈ TreeMissingColors phi Ty) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + va ∉ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + TreeSequenceInitialSegment Y T → + alpha ∈ TreeMissingColors phi Y ∧ beta ∈ TreeMissingColors phi Y → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + va ∈ TreeSequenceVertexSet Y → + vb ∈ TreeSequenceVertexSet Y → + va ∉ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A → + A.length < (↑ia : ℕ) → + A.length < (↑ib : ℕ) → + (∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + let sameComponent : Prop := + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (alpha ∈ TreeMissingColors phi Tnq ∨ + Disjoint + (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint + (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) + +/-- Dependent contract shared by the outside change lemma proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperHstarLast5289Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega) + j; + { dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, + dividerStage := hsdivider, coreInsideFirst := hscore : + TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A + +/-- Dependent contract shared by the outside change lemma proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation4653Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬yLength ≤ T.length) ↦ by omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + vb ∈ TreeSequenceVertexSet Y → + A.length < (↑ia : ℕ) → + ∀ (hAib : A.length < (↑ib : ℕ)), + alpha ∉ TreeMissingColors phi A → + beta ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + (↑ia : ℕ) < (↑ib : ℕ) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(↑ib : ℕ) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + B.length < T.length → + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction + fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction + fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)), + MaximumProperty + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, + series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, + series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (hcountB : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction + fun + (a : + ¬HB.dividerCount + (1 : ℕ) = H.dividerCount + (1 : ℕ)) ↦ + by omega) + j; + HB.stage j.castSucc = H.stage jo.castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H jo) → + (∀ (i : Fin HB.dividerCount), + (↑(HB.dividerPosition i) : ℕ) = + (↑(H.dividerPosition (Fin.cast hcountB i)) : ℕ)) → + ∀ (goodB : GoodHierarchy HB), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction + fun + (a : + ¬HB.dividerCount + (1 : ℕ) = H.dividerCount + (1 : ℕ)) ↦ + by omega) + j; + HierarchyStoredColorsAt HB j = HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HB j = + HierarchyStageMissingColors H jo ∧ + ∀ (eta : Fin k), + goodB.gamma j eta = C.good.gamma jo eta ∧ + HierarchySegmentColors HB j eta ⊆ + HierarchySegmentColors H jo eta) → + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, + series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }; + ((0 : ℕ) < H.dividerCount ∧ + (alpha ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction + fun + (a : ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ + by omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∨ + Disjoint + (insert alpha ({ beta } : Finset (Fin k)) : + Finset (Fin k)) + (HierarchyStoredColorsAt H q)) ∨ + H.dividerCount = (0 : ℕ) ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint + (insert alpha ({ beta } : Finset (Fin k)) : + Finset (Fin k)) + Dn) → + alpha ∉ Dn ∧ beta ∉ Dn) → + alpha ∉ Dn ∧ beta ∉ Dn → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (have C : Set (V ⊕ E) := + TwoColorComponent G phi alpha beta (Sum.inl vb); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (v : V), + Sum.inl v ∉ C → + MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + alpha ∈ MissingColors G phi v → + beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → + alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → + (c ∈ MissingColors G phi' v ↔ + c ∈ MissingColors G phi v)) → + (∀ (f : E) (c : Fin k), + c ≠ alpha → + c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + (∀ (f : E), + phi f ≠ some alpha → + phi f ≠ some beta → sigma f = phi f) → + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → + MissingColors G sigma v = MissingColors G phi v) → + ¬ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ + TreeSequenceVertexSet A → + TreeMissingColors sigma S = + TreeMissingColors phi S) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ + TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), + alpha ∉ D ∧ beta ∉ D → + StableColoring S D phi sigma) → + StableColoring Tn Dn phi sigma → + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + (∀ (c : Fin k), + c = alpha ∨ c = beta → + c ∉ TreeMissingColors phi Tn ∪ Dn) → + (ett.series.data.kind n = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = + ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed + B ∧ + phi f ≠ some alpha ∧ + phi f ≠ some beta) → + False + +theorem helper_missingBefore_438.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : alpha ≠ beta), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ∀ (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y)) + (_ : + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length) + (_ : + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length) + (_ : va ∈ TreeSequenceVertexSet Y) (_ : vb ∈ TreeSequenceVertexSet Y) + (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (_ : TreeSequenceInitialSegment B Y), + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (_ : Sum.inl va ∉ K) + (_ : + (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v))) + (_ : + (∀ {v : V} {f : E} (_ : Sum.inl v ∈ K) (_ : Incident G v f) + (_ : phi f = some alpha ∨ phi f = some beta), Sum.inr f ∈ K)), + ∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → + MissingColors G sigma v = MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ia ib va vb ell yLength Y + hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb + by_cases hvK : Sum.inl v ∈ K + · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) + have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv + have han : alpha ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 + have hbn : beta ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 + have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by + simpa [MissingColors, PresentColors] using han + have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by + simpa [MissingColors, PresentColors] using hbn + obtain ⟨fa, hfa, hfca⟩ := hpa + obtain ⟨fb, hfb, hfcb⟩ := hpb + have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) + have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) + have hnewa : sigma fb = some alpha := by + simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] + have hnewb : sigma fa = some beta := by + simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] + have hana : alpha ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fb, hfb, hnewa⟩ + have hbnb : beta ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fa, hfa, hnewb⟩ + ext c + by_cases hca : c = alpha + · subst c; simp [hana, han] + · by_cases hcb : c = beta + · subst c; simp [hbnb, hbn] + · exact behavior.2.2.2 v c hca hcb + · exact behavior.1 v hvK + +theorem helper_terminalRoute_532.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ + (_ : + (∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) + (_ : TreeSequenceInitialSegment U W) (_ : S.length ≤ U.length), + TreeSequenceInitialSegment S U)) + (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (_ : TreeSequenceInitialSegment Tn B) (_ : Tn.length < B.length) + (_ : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (_ : (∀ (c : Fin k) (_ : c = alpha ∨ c = beta), c ∉ TreeMissingColors phi Tn ∪ Dn)) + (_ : (∀ c ∈ ett.series.data.stored n, c ∈ TreeMissingColors phi Tn ∪ Dn)), + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed B ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib commonPrefix hAib B + rpB aboveB strictB belowB genB baseB HB TnToB TnStrictB BToFinal notControlled storedOrMissing + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => have hv := congrArg Fin.val hi; simp [n] at hv; have := C.positive; omega + | SE j _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedB : TreeSequenceInitialSegment seed B := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + BToFinal (by + have hl := adjoin.1 + rw [hj] at hl + change seed.length = Tn.length + 1 at hl + omega) + have hcol : phi choice.edge = some choice.color := by + have hg : phi = choice.selected := by + simpa only [← hj, coloring, n] using ett.generatingColoring + simpa only [hg] using choice.edgeColor + have hc : choice.color ∈ ett.series.data.stored n := by rw [← hj, stored]; simp + have hnot (c : Fin k) (he : c = alpha ∨ c = beta) : phi choice.edge ≠ some c := by + intro hc' + have heq := Option.some.inj (hcol.symm.trans hc') + exact notControlled c he (heq ▸ storedOrMissing choice.color hc) + exact Or.inr ⟨Or.inl (by simpa [hj] using kind), choice.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + TashkinovAugmentationSequenceRestrict phi seed B _ hroute hseedB BToFinal, + hnot alpha (Or.inl rfl), hnot beta (Or.inr rfl)⟩ + | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + refine Or.inl ⟨by simpa [hj] using kind, ?_⟩ + apply TashkinovAugmentationSequenceRestrict phi Tn B _ _ TnToB BToFinal + simpa [Tn, hj, hlast, ← ett.generatingColoring, n] using closure.1 + | RE j _ _ _ _ available coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedB : TreeSequenceInitialSegment seed B := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + BToFinal (by + have hl := adjoin.1 + rw [hj] at hl + change seed.length = Tn.length + 1 at hl + omega) + have hcol : phi available.edge = some available.gamma ∨ + phi available.edge = some available.delta := by + have hg : phi = ett.series.data.coloring j.castSucc := by + simpa only [← hj, coloring, n] using ett.generatingColoring + simp only [hg] + have hadj := available.returnPath.adj_snd + (SimpleGraph.Walk.not_nil_of_ne (by intro he; cases he)) + cases hh : available.returnPath.snd with + | inl v => + have hc : (TwoColorIncidenceGraph G (ett.series.data.coloring j.castSucc) + available.gamma available.delta).Adj (Sum.inr available.edge) (Sum.inl v) := + hh ▸ hadj + exact hc.2 + | inr f => + have hc : (TwoColorIncidenceGraph G (ett.series.data.coloring j.castSucc) + available.gamma available.delta).Adj (Sum.inr available.edge) (Sum.inr f) := + hh ▸ hadj + exact False.elim hc + have hcontrol : ∃ c, phi available.edge = some c ∧ + c ∈ TreeMissingColors phi Tn ∪ Dn := by + rcases hcol with h | h + · exact ⟨available.gamma, h, storedOrMissing _ (by rw [← hj, stored]; simp)⟩ + · exact ⟨available.delta, h, storedOrMissing _ (by rw [← hj, stored]; simp)⟩ + have hnot (c : Fin k) (he : c = alpha ∨ c = beta) : phi available.edge ≠ some c := by + intro hc' + obtain ⟨d, hd, hdmem⟩ := hcontrol + have heq := Option.some.inj (hd.symm.trans hc') + exact notControlled c he (heq ▸ hdmem) + exact Or.inr ⟨Or.inr (by simpa [hj] using kind), available.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + TashkinovAugmentationSequenceRestrict phi seed B _ hroute hseedB BToFinal, + hnot alpha (Or.inl rfl), hnot beta (Or.inr rfl)⟩ + +theorem helper_augmentationControlled_640.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ∀ (_ : TreeSequenceInitialSegment A T) + (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y)) + (_ : + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length) + (_ : + (∀ (i : Fin (T.length + (1 : ℕ))) (_ : (↑i : ℕ) ≤ Y.length), + T.vertex i ∈ TreeSequenceVertexSet Y)) + (_ : vb ∈ TreeSequenceVertexSet Y) (hAib : A.length < (↑ib : ℕ)) + (_ : alpha ∉ TreeMissingColors phi A) + (_ : + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k))), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : B.length < T.length) (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence phi S B) (t : Fin B.length) + (_ : S.length ≤ (↑t : ℕ)), + phi (B.edge t) ≠ some alpha ∧ + phi (B.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell yLength Y AToT + hElementaryY hb vertexY hbY hAib halphaA horder B BToT BstrictT rpB aboveB strictB belowB + genB baseB HB S hseq t ht + have hstep := (TashkinovAugmentationSequencePosition phi S B hseq t ht).1 + obtain ⟨hl, hinit, c, hcol, hm⟩ := hstep + have hcolB : phi (B.edge t) = some c := by + convert hcol using 1 + congr 2 + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨iv, hiv⟩ := hv + let ivT : Fin (T.length + 1) := ⟨iv.val, by + have htB := BToT.1 + have := iv.isLt + simp only [TreeSequencePrefix] at this + omega⟩ + have hcvT : c ∈ MissingColors G phi (T.vertex ivT) := by + have he : (TreeSequencePrefix B t.val (le_trans S.positive ht) (Nat.le_of_lt + t.isLt)).vertex iv = + T.vertex ivT := rfl + rw [← he, hiv] + exact hcv + have hnotA : c ≠ alpha := by + intro he; subst c + by_cases htA : t.val ≤ A.length + · apply halphaA + have hivA : ivT.val ≤ A.length := by + change iv.val ≤ A.length + have hiv : iv.val ≤ t.val := Nat.le_of_lt_succ iv.isLt + omega + have hvA : T.vertex ivT ∈ TreeSequenceVertexSet A := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨ivT.val, by omega⟩, (AToT.2.1 ⟨ivT.val, by omega⟩).symm⟩ + exact Finset.mem_biUnion.mpr ⟨T.vertex ivT, hvA, hcvT⟩ + · apply horder.2 + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, Fin.castLE BToT.1 t, + by change A.length ≤ t.val; omega, t.isLt, by rw [BToT.2.2 t]; exact hcolB⟩ + have hnotB : c ≠ beta := by + intro he; subst c + have hivB : ivT.val < ib.val := by + have := iv.isLt + simp only [TreeSequencePrefix] at this + have htB : t.val < ib.val := t.isLt + dsimp [ivT] + omega + have hivY : ivT.val ≤ Y.length := by omega + have hvY := vertexY ivT hivY + have hneV : T.vertex ivT ≠ vb := by + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + omega + exact Finset.disjoint_left.mp (hElementaryY hvY hbY hneV) hcvT hb.1 + exact ⟨fun hc => hnotA (Option.some.inj (hcolB.symm.trans hc)), + fun hc => hnotB (Option.some.inj (hcolB.symm.trans hc))⟩ + +theorem helper_routeTransport_711.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ + (_ : + (∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) + (_ : TreeSequenceInitialSegment U W), TreeSequenceInitialSegment S W)) + (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (_ : TreeSequenceInitialSegment B T) (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (_ : + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v)) + (_ : (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t))) + (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence phi S B), + TashkinovAugmentationSequence sigma S B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb segTrans hAib B BToT rpB + aboveB strictB belowB genB baseB HB sigma missingBefore edgesFixed S hs + unfold TashkinovAugmentationSequence at hs ⊢ + induction hs using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head U W hstep htail ih => + have hWB := TashkinovAugmentationSequenceInitialSegment phi W B htail + obtain ⟨hlen, hUW, c, hcol, hm⟩ := hstep + have hUB := segTrans hUW hWB + have hlt : U.length < B.length := by have := hWB.1; omega + refine Relation.ReflTransGen.head ⟨hlen, hUW, c, ?_, ?_⟩ ih + · have hf := edgesFixed (Fin.castLE hWB.1 (Fin.cast hlen.symm (Fin.last U.length))) + rw [hWB.2.2] at hf + exact hf.trans hcol + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + have hvB := TreeSequenceInitialSegmentVertexSetSubset hUB hv + have hvb : v ≠ vb := by + intro he + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + have ht := hUB.2.1 i + have htT := BToT.2.1 (Fin.castLE (Nat.succ_le_succ hUB.1) i) + have eqv : T.vertex (Fin.castLE (Nat.succ_le_succ BToT.1) + (Fin.castLE (Nat.succ_le_succ hUB.1) i)) = T.vertex ib := htT.trans (ht.trans + (hi.trans he)) + have hh := congrArg Fin.val (T.vertex_injective eqv) + have := i.isLt + change i.val = ib.val at hh + change U.length < ib.val at hlt + omega + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [missingBefore v hvB hvb]; exact hcv⟩ + +theorem helper_replacement_742.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (_ : TreeSequenceInitialSegment base.core A) (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (_ : + MaximumProperty + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : baseB.core = base.core) + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) + (_ : + (∀ (S : TreeSequence G e0) (_ : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) + (D : Finset (Fin k)) (_ : alpha ∉ D ∧ beta ∉ D), StableColoring S D phi sigma)) + (_ : StableColoring Tn Dn phi sigma) (_ : TreeSequenceInitialSegment Tn B) + (_ : Tn.length < B.length) + (_ : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed B ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta)) + (_ : + (∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence phi S B), + TashkinovAugmentationSequence sigma S B)), + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : + TashkinovHierarchy corr.replacementETT baseS), + SameHierarchyStages HB HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn Dn ib + vb coreToA hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma + sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport + by_cases hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE + · have closureSubset : TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hPE + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [← hcoreB, u.vertexSet] + exact Finset.mem_union_right _ hv + have hcombined : CombinedStableColoring Tn baseB.closure Dn phi sigma := + ⟨stableTn, stable baseB.closure closureSubset ∅ (by simp)⟩ + have hseq : TashkinovAugmentationSequence sigma Tn B := by + rcases terminalRoute with ⟨_, hs⟩ | ⟨hk, _⟩ + · exact routeTransport Tn hs + · rcases hk with hk | hk <;> rw [hPE] at hk <;> cases hk + exact HierarchySplitter G k e0 input B phi sigma ettB hMPB C.positive + hlower baseB HB hPE hproper hone sigmaProper sigmaOne hcombined hseq + · have hmod : ModColoring ettB sigma := + Td G k e0 input B phi ettB hMPB C.positive hlower sigma sigmaProper sigmaOne + (by simpa only [ettB, ← ett.generatingColoring, n, Tn, Dn] using stableTn) + have hroute : + ((ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B) ∨ + ((ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.SE ∨ + ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ettB.series.data.connectingEdges (Fin.last ettB.rounds) = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed B)) + := by + rcases terminalRoute with ⟨hp, _⟩ | ⟨hk, f, seed, hedges, hadjoin, hs, _⟩ + · exact (hPE hp).elim + · exact Or.inr ⟨hk, f, seed, hedges, hadjoin, routeTransport seed hs⟩ + obtain ⟨corr⟩ := hmod.2.2 B TnToB TnStrictB hroute + have hMP := MaximumPropertyTransport G k e0 ettB sigma hmod B corr hMPB + refine ⟨corr, hMP, ?_⟩ + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ + rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let rep : ExtendedTashkinovTree G k e0 newInput B sigma := + ⟨ett.rounds, rp, newSeries, above, strict, below, gen⟩ + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j + have hkind := hkinds n + let pos : Fin ((newSeries.data.tree n.castSucc).length + 1) := + Fin.cast (congrArg (fun S : TreeSequence G e0 => S.length + 1) htree.symm) + baseB.supportPosition + let baseS : HierarchyBase rep sigma := + { core := baseB.core + closure := baseB.closure + supportPosition := pos + supportPositive := by simpa [pos] using baseB.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only [rep] + intro hp + exact (hPE (hkind.symm.trans hp)).elim + nonparallel := by + dsimp only [rep] + intro hp + exact (baseB.nonparallel hPE).trans htree.symm } + let HS : TashkinovHierarchy rep baseS := + { dividerCount := HB.dividerCount + stage := HB.stage + baseStage := HB.baseStage.trans htree.symm + terminalStage := HB.terminalStage + nested := HB.nested + strict := HB.strict + dividerPosition := HB.dividerPosition + dividerPositive := HB.dividerPositive + dividerIncreasing := HB.dividerIncreasing + dividerStage := HB.dividerStage + coreInsideFirst := HB.coreInsideFirst } + refine ⟨baseS, HS, ?_⟩ + refine ⟨rfl, rfl, HEq.rfl, HEq.rfl, ?_, ?_⟩ + · exact ⟨fun hp => (hPE hp).elim, fun hp => (hPE (hkind.symm.trans hp)).elim⟩ + · intro hp; exact (hPE hp).elim + +theorem helper_pathLe_1004.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let _ : ℕ := T.length - A.length; + ∀ (_ : TreeSequenceInitialSegment A T) (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : A.length < B.length) (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (_ : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (_ : stages (Fin.last (count + (1 : ℕ))) = B) + (_ : + (∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ))) + (_ : + (∀ (j : Fin (count + (1 : ℕ))), + (stages j.castSucc).length < (stages j.succ).length)) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (_ : + (∀ (i j : Fin count) (_ : (↑i : ℕ) < (↑j : ℕ)), + (↑(positions i) : ℕ) < (↑(positions j) : ℕ))) + (_ : + (∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega))) + (_ : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (_ : HierarchyStarredStage HS (Fin.last count) = A), + HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB baseB ettB sigma corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + let tailB := B.length - A.length + let candidatesT := (Finset.Icc 1 ell).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + let candidatesB := (Finset.Icc 1 tailB).filter fun i => + ∀ t : Fin B.length, A.length + i ≤ t.val → + G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) + have htail : 1 ≤ tailB := by dsimp [tailB]; omega + have htailT : 1 ≤ ell := by dsimp [ell]; omega + have htmem : ell ∈ candidatesT := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htailT, le_rfl⟩, ?_⟩ + intro t ht + have hAT := AToT.1 + have := t.isLt + dsimp [ell] at ht + omega + have hbmem : tailB ∈ candidatesB := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htail, le_rfl⟩, ?_⟩ + intro t ht + have := t.isLt + dsimp [tailB] at ht + omega + have hnT : candidatesT.Nonempty := ⟨ell, htmem⟩ + have hnB : candidatesB.Nonempty := ⟨tailB, hbmem⟩ + have hmT := Finset.min'_mem candidatesT hnT + have hbounds := Finset.mem_Icc.mp (Finset.mem_filter.mp hmT).1 + have hminB : candidatesB.min' hnB ≤ candidatesT.min' hnT := by + by_cases ht : candidatesT.min' hnT ≤ tailB + · apply Finset.min'_le + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hbounds.1, ht⟩, ?_⟩ + intro t hpos + have he := (Finset.mem_filter.mp hmT).2 (Fin.castLE BToT.1 t) hpos + have hv0 := BToT.2.1 t.castSucc + have hv1 := BToT.2.1 t.succ + have hi0 : (Fin.castLE BToT.1 t).castSucc = + Fin.castLE (Nat.succ_le_succ BToT.1) t.castSucc := Fin.ext rfl + have hi1 : (Fin.castLE BToT.1 t).succ = + Fin.castLE (Nat.succ_le_succ BToT.1) t.succ := Fin.ext rfl + simpa only [BToT.2.2, hi0, hi1, hv0, hv1] using he + · exact le_trans (Finset.min'_le candidatesB tailB hbmem) (by omega) + unfold HierarchyPathNumber + rw [hstarLast] + change (if h : candidatesB.Nonempty then candidatesB.min' h else tailB) ≤ + (if h : candidatesT.Nonempty then candidatesT.min' h else ell) + rw [dite_eq_left hnB, dite_eq_left hnT] + exact hminB + +theorem helper_segTrans_973.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W := by + classical + intro V E G e0 S U W hSU hUW + refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + +theorem helper_commonPrefix_982.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U := by + classical + intro V E G e0 S U W hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +theorem helper_stageToT_998.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (H.stage j) T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H stageSegment j + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) + simpa [he, H.terminalStage] using hs + +theorem helper_lastPositive_1007.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hz + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm + +theorem helper_coreToA_1018.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment base.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A segRefl segTrans stageSegment lastZero + lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segRefl _ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + +theorem helper_AToT_1032.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A segTrans stageToT lastZero lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) + · rw [lastPositive hz] + exact stageToT _ + +theorem helper_ordinaryToA_1038.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment Tn A → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n Tn stageSegment lastPositive TnToA j + by_cases hz : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) + rw [hj, H.baseStage] + exact TnToA + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + rw [lastPositive hz] + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> + simp only [Fin.val_castSucc]; omega + +theorem helper_firstMissing_1057.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment Y T → + ∀ c ∈ TreeMissingColors phi Y, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell yLength Y YToT c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let it := Fin.castLE (Nat.succ_le_succ YToT.1) i + have hci : c ∈ MissingColors G phi (T.vertex it) := by + rw [YToT.2.1 i, hi] + exact hcv + let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) + have hit : it ∈ candidates := by simp [candidates, hci] + have hnon : candidates.Nonempty := ⟨it, hit⟩ + have hmem := Finset.min'_mem candidates hnon + have hle := Finset.min'_le candidates it hit + refine ⟨?_, ?_⟩ + · simpa [HierarchyFirstMissingPosition, candidates, hnon] using + (Finset.mem_filter.mp hmem).2 + · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt + have hval : (candidates.min' hnon).val ≤ it.val := hle + simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv + +theorem helper_outsideIndex_1087.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ _ : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + ∀ (i : Fin (T.length + (1 : ℕ))), + T.vertex i ∉ TreeSequenceVertexSet A → + A.length < (↑i : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A AToT i hi + by_contra h + have hle : i.val ≤ A.length := by omega + apply hi + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ + +theorem helper_missingNotA_1098.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + TreeSequenceInitialSegment A Y → + ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ell yLength Y hElementaryY + AToY c i hmi hiy hia hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) + exact (Finset.disjoint_left.mp + (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi + +theorem helper_BstrictT_1127.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + A.length < B.length → + TreeSequenceInitialSegment B Y → + B.length < T.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib ell yLength Y AToT hAib B + ABstrict BToY + have hAT := AToT.1 + have hY : Y.length = min (A.length + (T.length - A.length - 1)) T.length := rfl + have hBY := BToY.1 + have hAB := ABstrict + omega + +theorem helper_outsideStored_1149.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + alpha ∉ TreeMissingColors phi A → + beta ∉ TreeMissingColors phi A → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + (∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeMissingColors phi S ⊆ TreeMissingColors phi U) → + (0 : ℕ) < H.dividerCount ∧ + (alpha ∈ + TreeMissingColors phi + (H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ + Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) + (HierarchyStoredColorsAt H q)) ∨ + H.dividerCount = (0 : ℕ) ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + alpha ∉ Dn ∧ + beta ∉ Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib lastPositive TnToA + hAib halphaA hbetaA B rpB aboveB strictB belowB genB baseB HB missingSubset hcase + rcases hcase with ⟨hp, hm | hd⟩ | ⟨hz, hm | hd⟩ + · exact (halphaA (by simpa [lastPositive (by omega)] using hm)).elim + · have hn (c : Fin k) (hc : c ∈ ({alpha, beta} : Finset (Fin k))) + (hcm : c ∉ TreeMissingColors phi A) : c ∉ Dn := by + intro hcd + apply Finset.disjoint_left.mp hd hc + exact Finset.mem_sdiff.mpr ⟨hcd, hcm⟩ + exact ⟨hn alpha (by simp) halphaA, hn beta (by simp) hbetaA⟩ + · exact (halphaA (missingSubset TnToA hm)).elim + · exact ⟨fun hc => Finset.disjoint_left.mp hd (by simp) hc, + fun hc => Finset.disjoint_left.mp hd (by simp) hc⟩ + +theorem helper_unaffected_1187.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta + (Sum.inl vb); + ∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ib vb ell yLength Y ha hb + K sigma f c hca hcb + by_cases hf : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hca.symm, hcb.symm] + · by_cases hb : phi f = some beta + · simp [sigma, TwoColorComponentSwap, K, hf, hb, hne.symm, + hca.symm, hcb.symm] + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hb] + · simp [sigma, TwoColorComponentSwap, K, hf] + +theorem helper_sigmaOne_1202.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta hne H q A ib vb ell yLength Y + ha hb K sigma unaffected + refine ⟨?_, ?_⟩ + · simp [sigma, TwoColorComponentSwap, hone.1] + · intro f hf + obtain ⟨c, hc⟩ := hone.2 f hf + by_cases ha : c = alpha + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · by_cases hb : c = beta + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc, hne.symm]⟩ + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨c, (unaffected f c ha hb).mpr hc⟩ + +theorem helper_stable_1247.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + alpha ∉ TreeMissingColors phi A → + beta ∉ TreeMissingColors phi A → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), + alpha ∉ D ∧ beta ∉ D → + StableColoring S D phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb halphaA hbetaA sigma + unaffected missingA S hS D hD + refine ⟨?_, fun v hv => missingA v (hS hv)⟩ + intro f hf hcontrol + obtain ⟨c, hc, hcol⟩ := hcontrol + have hnot (d : Fin k) (hdA : d ∉ TreeMissingColors phi A) (hdD : d ∉ D) : c ≠ d := by + intro he; subst c + rcases Finset.mem_union.mp hc with hm | hm + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + exact hdA (Finset.mem_biUnion.mpr ⟨v, hS hv, hcv⟩) + · exact hdD hm + exact ((unaffected f c (hnot alpha halphaA hD.1) (hnot beta hbetaA hD.2)).mpr hcol).trans + hcol.symm + +theorem helper_storedOrMissing_1276.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + ∀ c ∈ ett.series.data.stored n, + c ∈ TreeMissingColors phi Tn ∪ Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib hAib B rpB aboveB + strictB belowB genB baseB HB c hc + by_cases hm : c ∈ TreeMissingColors phi Tn + · exact Finset.mem_union_left _ hm + · apply Finset.mem_union_right + unfold Dn TashkinovStoredColors + have hn : n.val ≠ 0 := by dsimp [n]; have := C.positive; omega + simp only [ite_eq_right hn] + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · exact Finset.mem_biUnion.mpr ⟨n, Finset.mem_univ _, by simp [hc]⟩ + · have hg : ett.series.data.coloring n = phi := ett.generatingColoring.symm + simpa only [hg, Tn] using hm + +theorem helper_treeControlled_1302.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + (∀ (c : Fin k), c = alpha ∨ c = beta → c ∉ TreeMissingColors phi Tn ∪ Dn) → + ∀ (t : Fin Tn.length), + phi (Tn.edge t) ≠ some alpha ∧ + phi (Tn.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta H q A n Tn Dn ib hAib B rpB + aboveB strictB belowB genB baseB HB notControlled t + by_cases ht : t.val = 0 + · have he : Tn.edge t = e0 := by + rw [show t = ⟨0, Tn.positive⟩ from Fin.ext ht] + exact Tn.first_edge + simp [he, hone.1] + · let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have hused (c : Fin k) (hc : phi (Tn.edge t) = some c) : + c ∈ TreeMissingColors phi Tn ∪ Dn := by + have hu : c ∈ TreeUsedColors (ett.series.data.coloring j.succ) + (ett.series.data.tree j.succ.castSucc) := by + simp only [hj, ← ett.generatingColoring, n] + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨t, by omega, hc⟩ + simpa [hj, ← ett.generatingColoring, Tn, Dn, n] using + (HkuTreeColorsControlled G k ett.rounds e0 input ett.series j).2.1 hu + exact ⟨fun hc => notControlled alpha (Or.inl rfl) (hused alpha hc), + fun hc => notControlled beta (Or.inr rfl) (hused beta hc)⟩ + +theorem helper_augmentationControlled_1322.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment A T → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + B.length < T.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), + S.length ≤ (↑t : ℕ) → + phi (B.edge t) ≠ some alpha ∧ + phi (B.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell yLength Y AToT + hElementaryY hb vertexY hbY hAib halphaA horder B BToT BstrictT rpB aboveB strictB belowB + genB baseB HB S hseq t ht + exact @helper_augmentationControlled_640 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@AToT) (@hElementaryY) (@hb) (@vertexY) (@hbY) (@hAib) (@halphaA) + (@horder) (@BToT) (@BstrictT) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@HB) (@S) (@hseq) (@t) (@ht) + +theorem helper_allControlled_1331.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + TreeSequenceInitialSegment Tn B → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed B ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta) → + (∀ (t : Fin Tn.length), phi (Tn.edge t) ≠ some alpha ∧ phi (Tn.edge t) ≠ some beta) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), + S.length ≤ (↑t : ℕ) → + phi (B.edge t) ≠ some alpha ∧ phi (B.edge t) ≠ some beta) → + ∀ (t : Fin B.length), + phi (B.edge t) ≠ some alpha ∧ + phi (B.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib hAib B rpB aboveB + strictB belowB genB baseB HB TnToB terminalRoute treeControlled augmentationControlled t + by_cases ht : t.val < Tn.length + · have he := TnToB.2.2 ⟨t.val, ht⟩ + have hi : Fin.castLE TnToB.1 ⟨t.val, ht⟩ = t := Fin.ext rfl + rw [hi] at he + rw [he] + exact treeControlled _ + · rcases terminalRoute with ⟨hp, hs⟩ | ⟨hk, f, seed, hedges, hadjoin, hs, hfa, hfb⟩ + · exact augmentationControlled Tn hs t (by omega) + · by_cases he : t.val = Tn.length + · have hSB := TashkinovAugmentationSequenceInitialSegment phi seed B hs + have hi := hSB.2.2 (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) + have hj : Fin.castLE hSB.1 (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) = t := + Fin.ext (by simpa using he.symm) + rw [hj, hadjoin.2.2] at hi + simpa [hi] using And.intro hfa hfb + · exact augmentationControlled seed hs t (by have := hadjoin.1; omega) + +theorem helper_replacement_1357.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), alpha ∉ D ∧ beta ∉ D → StableColoring S D phi sigma) → + StableColoring Tn Dn phi sigma → + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed B ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : + TashkinovHierarchy corr.replacementETT baseS), + SameHierarchyStages HB HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn Dn ib + vb coreToA hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma + sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport + exact @helper_replacement_742 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) + (@belowB) (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) + (@stableTn) (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) + +theorem helper_storedS_1369.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT → + ∀ (baseS : HierarchyBase corr.replacementETT sigma) + (HS : TashkinovHierarchy corr.replacementETT baseS), + SameHierarchyStages HB HS → + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB HB ettB sigma treeMissingEq corr hMPS baseS HS hsame + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ + rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j + have hm := treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) + unfold Dn TashkinovStoredColors + simp only [ettB, hstored, ← hgen, ← ett.generatingColoring, htree, hm, n, Tn] + +theorem helper_closureBToA_1398.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib coreToA hAib B rpB aboveB + strictB belowB genB baseB hcoreB hp + obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hp + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [← hcoreB, u.vertexSet] + exact Finset.mem_union_right _ hv + +theorem helper_minusEq_1405.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + alpha ∉ TreeMissingColors phi A → + beta ∉ TreeMissingColors phi A → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb halphaA hbetaA sigma + unaffected treeMissingEq S hS D + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [treeMissingEq S hS] + have boundaryEq (c : Fin k) (hc : c ∈ TreeMissingColors phi S) : + BoundaryColorEdges G sigma (TreeSequenceVertexSet S) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet S) c := by + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hcA : c ∈ TreeMissingColors phi A := Finset.mem_biUnion.mpr ⟨v, hS hv, hcv⟩ + have hca : c ≠ alpha := by intro he; exact halphaA (he ▸ hcA) + have hcb : c ≠ beta := by intro he; exact hbetaA (he ▸ hcA) + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + exact and_congr_right (fun _ => unaffected f c hca hcb) + exact ⟨fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).symm.trans (hs c hc), + fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).trans (hs c hc)⟩ + +theorem helper_storedEq_1440.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + change TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) \ TreeMissingColors sigma (HierarchyStarredStage + HS j) = + Dn \ TreeMissingColors phi (HierarchyStarredStage HB j) + rw [storedS, starEq, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starBToA j))] + +theorem helper_missingEq_1447.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := + hsbase.symm.trans hbbase + rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] + · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) + +theorem helper_firstEq_1458.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + alpha ∉ Dn ∧ beta ∉ Dn → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → + ∀ eta ∈ Dn, + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B hDn sigma + behavior eta he + have hea : eta ≠ alpha := by intro h; exact hDn.1 (h ▸ he) + have heb : eta ≠ beta := by intro h; exact hDn.2 (h ▸ he) + have hcandidates : (Finset.univ.filter fun i => eta ∈ MissingColors G sigma (B.vertex i)) = + (Finset.univ.filter fun i => eta ∈ MissingColors G phi (B.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact behavior.2.2.2 _ eta hea heb + unfold HierarchyFirstMissingPosition + rw [hcandidates] + +theorem helper_segmentEq_1469.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ eta ∈ Dn, + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt HB j, + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta he + have heDn : eta ∈ Dn := (Finset.mem_sdiff.mp he).1 + have hedge (t : Fin (stages j.succ).length) : + sigma ((stages j.succ).edge t) = phi ((stages j.succ).edge t) := by + have hSB := stageBToB j.succ + have hf := edgesFixed (Fin.castLE hSB.1 t) + rw [hSB.2.2] at hf + exact hf + unfold HierarchySegmentColors + simp only [starEq, firstEq eta heDn, HS, HB, hedge] + +theorem helper_refreshEq_1481.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + rw [starEq] + apply Finset.biUnion_congr rfl + intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ) + (Finset.mem_sdiff.mp hv).1) + +theorem helper_hstarLast_1534.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + rw [starEq] + have hs := (hstagesB (Fin.last count)).2 + have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := + Fin.ext (by simp [q]) + simpa only [hj] using hs + +theorem helper_pathLe_1546.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0), + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc → + stages (Fin.last (count + (1 : ℕ))) = B → + (∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) → + (∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) → + ∀ (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)), + (∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) → + (∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) → + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ)))) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB baseB ettB sigma corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + exact @helper_pathLe_1004 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) + (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@hstarLast) + +theorem helper_augmentationControlled_3288.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment A T → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + B.length < T.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), + S.length ≤ (↑t : ℕ) → + phi (B.edge t) ≠ some alpha ∧ + phi (B.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell yLength Y AToT + hElementaryY hb vertexY hbY hAib halphaA horder B BToT BstrictT rpB aboveB strictB belowB + genB baseB HB S hseq t ht + exact @helper_augmentationControlled_1322 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@AToT) (@hElementaryY) (@hb) (@vertexY) (@hbY) (@hAib) (@halphaA) + (@horder) (@BToT) (@BstrictT) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@HB) (@S) (@hseq) (@t) (@ht) + +theorem helper_replacement_3311.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), alpha ∉ D ∧ beta ∉ D → StableColoring S D phi sigma) → + StableColoring Tn Dn phi sigma → + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed B ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : + TashkinovHierarchy corr.replacementETT baseS), + SameHierarchyStages HB HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn Dn ib + vb coreToA hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma + sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport + exact @helper_replacement_1357 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) + (@belowB) (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) + (@stableTn) (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) + +theorem helper_storedEq_3373.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact @helper_storedEq_1440 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) + (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +theorem helper_missingEq_3382.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + exact @helper_missingEq_1447 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) + (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) + (@hbcore) (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) + (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@j) + +theorem helper_segmentEq_3397.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ eta ∈ Dn, + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt HB j, + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta he + exact @helper_segmentEq_1469 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) (@he) + +theorem helper_refreshEq_3407.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + exact @helper_refreshEq_1481 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@i) + +theorem helper_hstarLast_3462.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + exact @helper_hstarLast_1534 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) + (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) + +theorem helper_pathLe_3476.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0), + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc → + stages (Fin.last (count + (1 : ℕ))) = B → + (∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) → + (∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) → + ∀ (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)), + (∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) → + (∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) → + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ)))) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB baseB ettB sigma corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + exact @helper_pathLe_1546 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) + (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@hstarLast) + +theorem helper_augmentationControlled_5115.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + TreeSequenceInitialSegment A T → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment B T → + B.length < T.length → + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + have _ : (1 : ℕ) ≤ Tn.length := Tn.positive; + have _ : (1 : ℕ) ≤ Y.length := Y.positive; + have _ : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + have _ : (1 : ℕ) ≤ Tn.length := Tn.positive; + have _ : (1 : ℕ) ≤ Y.length := Y.positive; + have _ : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), + S.length ≤ (↑t : ℕ) → + phi (B.edge t) ≠ some alpha ∧ + phi (B.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb ell yLength Y AToT + hElementaryY hb vertexY hbY hAib halphaA horder B BToT BstrictT rpB aboveB strictB belowB + genB baseB HB S hseq t ht + exact @helper_augmentationControlled_3288 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@AToT) (@hElementaryY) (@hb) (@vertexY) (@hbY) (@hAib) (@halphaA) + (@horder) (@BToT) (@BstrictT) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@HB) (@S) (@hseq) (@t) (@ht) + +theorem helper_replacement_5138.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + have _ : (1 : ℕ) ≤ Tn.length := Tn.positive; + have _ : (1 : ℕ) ≤ Y.length := Y.positive; + have _ : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + have _ : (1 : ℕ) ≤ Tn.length := Tn.positive; + have _ : (1 : ℕ) ≤ Y.length := Y.positive; + have _ : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)), + MaximumProperty + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), alpha ∉ D ∧ beta ∉ D → StableColoring S D phi sigma) → + StableColoring Tn Dn phi sigma → + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed B ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : + TashkinovHierarchy corr.replacementETT baseS), + SameHierarchyStages HB HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn Dn ib + vb ell yLength Y coreToA hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB + sigma sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport + exact @helper_replacement_3311 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) + (@belowB) (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) + (@stableTn) (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) + +end GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation2.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation2.lean new file mode 100644 index 0000000000..772c85939f --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation2.lean @@ -0,0 +1,250 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation1 + +/-! +# ChangeLemmaBothOutside: supporting constructions, part 2 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +/-- Dependent contract shared by the outside change lemma proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperStoredEq5200Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j + +theorem helper_storedEq_5200.{u_1, u_2} : + helperStoredEq5200Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib vb ell yLength Y + hAib B rpB aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS + count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing + hbdivider hbcore starBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested + hsstrict hsdivider hscore HB HS starEq j + exact @helper_storedEq_3373 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) + (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +end GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation3.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation3.lean new file mode 100644 index 0000000000..7eab39223a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation3.lean @@ -0,0 +1,243 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation2 + +/-! +# ChangeLemmaBothOutside: supporting constructions, part 3 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +/-- Dependent contract shared by the outside change lemma proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperMissingEq5209Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j + +theorem helper_missingEq_5209.{u_1, u_2} : + helperMissingEq5209Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb ell yLength Y TnToA + hAib B rpB aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count + stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider + hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict + hsdivider hscore HB HS j + exact @helper_missingEq_3382 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) + (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) + (@hbcore) (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) + (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@j) + +end GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation4.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation4.lean new file mode 100644 index 0000000000..b113eb724a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation4.lean @@ -0,0 +1,243 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation3 + +/-! +# ChangeLemmaBothOutside: supporting constructions, part 4 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +/-- Dependent contract shared by the outside change lemma proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperSegmentEq5224Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : + TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ eta ∈ Dn, + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt HB j, + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta + +theorem helper_segmentEq_5224.{u_1, u_2} : + helperSegmentEq5224Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib vb ell yLength Y + hAib B rpB aboveB strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages + hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore + stageBToB positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider + hscore HB HS starEq firstEq j eta he + exact @helper_segmentEq_3397 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) (@he) + +end GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation5.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation5.lean new file mode 100644 index 0000000000..4feb049649 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation5.lean @@ -0,0 +1,439 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation4 + +/-! +# ChangeLemmaBothOutside: supporting constructions, part 5 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +/-- Dependent contract shared by the outside change lemma proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperRefreshEq5234Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : + TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v + +theorem helper_refreshEq_5234.{u_1, u_2} : + helperRefreshEq5234Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb ell yLength Y hAib + B rpB aboveB strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq i + exact @helper_refreshEq_3407 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@i) + +theorem helper_hstarLast_5289.{u_1, u_2} : + helperHstarLast5289Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb ell yLength Y hAib + B rpB aboveB strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq + exact @helper_hstarLast_3462 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) + (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) + +/-- Dependent contract shared by the outside change lemma proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperPathLe5303Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + have this : (1 : ℕ) ≤ Y.length := Y.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0), + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc → + stages (Fin.last (count + (1 : ℕ))) = B → + (∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) → + (∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) → + ∀ (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)), + (∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) → + (∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) → + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ)))) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), + (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H + +theorem helper_pathLe_5303.{u_1, u_2} : + helperPathLe5303Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb ell yLength Y AToT + hAib B BToT ABstrict rpB aboveB strictB belowB genB baseB ettB sigma corr baseS count + stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider + hbcore positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider + hscore HS hstarLast + exact @helper_pathLe_3476 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) + (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@hstarLast) + +end GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean new file mode 100644 index 0000000000..16a3c01f17 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean @@ -0,0 +1,1240 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation5 + +/-! +# ChangeLemmaBothOutside: supporting constructions, part 6 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +/-- Typed data construction shared by the outside change lemma proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperGoodS6400.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (alpha beta : Fin k) → + + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := + ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := + HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + (coreToA : TreeSequenceInitialSegment base.core A) → + (TnToA : TreeSequenceInitialSegment Tn A) → + (hAib : A.length < (↑ib : ℕ)) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) (by omega) + (by omega); + (rpB : (1 : ℕ) ≤ ett.rounds) → + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) → + (strictB : + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) → + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree + (Fin.last (ett.rounds + (1 : ℕ))))) → + (genB : + phi = + ett.series.data.coloring + (Fin.last ett.rounds)) → + (baseB : + HierarchyBase + { rounds := ett.rounds, + roundsPositive := rpB, + series := ett.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B + phi } + phi) → + (hcoreB : baseB.core = base.core) → + let ettB : + ExtendedTashkinovTree G k e0 input B + phi := + { rounds := ett.rounds, + roundsPositive := rpB, + series := ett.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B + phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta + (Sum.inl vb); + (treeMissingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ + TreeSequenceVertexSet A → + TreeMissingColors sigma S = + TreeMissingColors phi S) → + (corr : + CorrespondingExtendedTashkinovTree + G k e0 ettB sigma B) → + (baseS : + HierarchyBase + corr.replacementETT sigma) → + (closureBToA : + ∀ + (_ : + ett.series.data.kind n = + some + TashkinovExtensionKind.PE), + TreeSequenceVertexSet + baseB.closure ⊆ + TreeSequenceVertexSet A) → + (minusEq : + ∀ (S : TreeSequence G e0) + (_ : + TreeSequenceVertexSet + S ⊆ + TreeSequenceVertexSet + A) + (D : Finset (Fin k)), + TreeColorSetMinusClosed G + sigma S D ↔ + TreeColorSetMinusClosed + G phi S D) → + (count : ℕ) → + (stages : + Fin (count + (2 : ℕ)) → + TreeSequence G e0) → + (hbbase : + stages + (0 : + Fin + (count + + (2 : ℕ))) = + { + rounds := + ett.rounds, + roundsPositive := + rpB, + series := + ett.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + genB : + ExtendedTashkinovTree + G k e0 input + B + phi }.series.data.tree + (Fin.last + { + rounds := + ett.rounds, + roundsPositive := + rpB, + series := + ett.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + genB : + ExtendedTashkinovTree + G k e0 + input B + phi }.rounds).castSucc) → + (hbterminal : + stages + (Fin.last + (count + + (1 : ℕ))) = + B) → + (hbnested : + ∀ + (j : + Fin + (count + + (1 : ℕ))), + TreeSequenceInitialSegment + (stages + j.castSucc) + (stages + j.succ)) → + (hbstrict : + ∀ + (j : + Fin + (count + + (1 : + ℕ))), + (stages + j.castSucc).length < + (stages + j.succ).length) → + (positions : + Fin count → + Fin + (B.length + + (1 : + ℕ))) → + (hbpositive : + ∀ + (i : + Fin + count), + (1 : ℕ) ≤ + (↑(positions + i) : + ℕ)) → + (hbincreasing : + ∀ + (i j : + Fin + count), + (↑i : + ℕ) < + (↑j : + ℕ) → + (↑(positions + i) : + ℕ) < + (↑(positions + j) : + ℕ)) → + (hbdivider : + ∀ + (i : + Fin + count), + stages + (⟨(↑i : + ℕ) + + (1 : + ℕ), + by + omega⟩ : + Fin + (count + + (2 : + ℕ))) = + TreeSequencePrefix + B + (↑(positions + i) : + ℕ) + (hbpositive + i) + (Nat.le_of_lt_succ + (positions + i).isLt)) → + (hbcore : + TreeSequenceInitialSegment + baseB.core + (stages + (⟨(1 : + ℕ), + by + omega⟩ : + Fin + (count + + (2 : + ℕ))))) → + (goodB : + GoodHierarchy + { + dividerCount := + count, + stage := + stages, + baseStage := + hbbase, + terminalStage := + hbterminal, + nested := + hbnested, + strict := + hbstrict, + dividerPosition := + positions, + dividerPositive := + hbpositive, + dividerIncreasing := + hbincreasing, + dividerStage := + hbdivider, + coreInsideFirst := + hbcore : + TashkinovHierarchy + { + rounds := + ett.rounds, + roundsPositive := + rpB, + series := + ett.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + genB : + ExtendedTashkinovTree + G + k + e0 + input + B + phi } + baseB }) → + (stageBToA : + ∀ + (j : + Fin + ({ + dividerCount := + count, + stage := + stages, + baseStage := + hbbase, + terminalStage := + hbterminal, + nested := + hbnested, + strict := + hbstrict, + dividerPosition := + positions, + dividerPositive := + hbpositive, + dividerIncreasing := + hbincreasing, + dividerStage := + hbdivider, + coreInsideFirst := + hbcore : + TashkinovHierarchy + { + rounds := + ett.rounds, + roundsPositive := + rpB, + series := + ett.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + genB : + ExtendedTashkinovTree + G + k + e0 + input + B + phi } + baseB }.dividerCount + + (1 : + ℕ))), + TreeSequenceInitialSegment + ({ + dividerCount := + count, + stage := + stages, + baseStage := + hbbase, + terminalStage := + hbterminal, + nested := + hbnested, + strict := + hbstrict, + dividerPosition := + positions, + dividerPositive := + hbpositive, + dividerIncreasing := + hbincreasing, + dividerStage := + hbdivider, + coreInsideFirst := + hbcore : + TashkinovHierarchy + { + rounds := + ett.rounds, + roundsPositive := + rpB, + series := + ett.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + genB : + ExtendedTashkinovTree + G + k + e0 + input + B + phi } + baseB }.stage + j.castSucc) + A) → + (hcore : + baseB.core = + baseS.core) → + (hpe : + { + rounds := + ett.rounds, + roundsPositive := + rpB, + series := + ett.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + genB : + ExtendedTashkinovTree + G + k + e0 + input + B + phi }.series.data.kind + (Fin.last + { + rounds := + ett.rounds, + roundsPositive := + rpB, + series := + ett.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + genB : + ExtendedTashkinovTree + G + k + e0 + input + B + phi }.rounds) = + some + TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind + (Fin.last + corr.replacementETT.rounds) = + some + TashkinovExtensionKind.PE) → + (hclosure : + { + rounds := + ett.rounds, + roundsPositive := + rpB, + series := + ett.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + genB : + ExtendedTashkinovTree + G + k + e0 + input + B + phi }.series.data.kind + (Fin.last + { + rounds := + ett.rounds, + roundsPositive := + rpB, + series := + ett.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + genB : + ExtendedTashkinovTree + G + k + e0 + input + B + phi }.rounds) = + some + TashkinovExtensionKind.PE → + baseB.closure = + baseS.closure) → + (positionsS : + Fin + count → + Fin + (B.length + + (1 : + ℕ))) → + (hspositive : + ∀ + (i : + Fin + count), + (1 : + ℕ) ≤ + (↑(positionsS + i) : + ℕ)) → + (hsincreasing : + ∀ + (i + j : + Fin + count), + (↑i : + ℕ) < + (↑j : + ℕ) → + (↑(positionsS + i) : + ℕ) < + (↑(positionsS + j) : + ℕ)) → + (hsbase : + stages + (0 : + Fin + (count + + (2 : + ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc) → + (hsterminal : + stages + (Fin.last + (count + + (1 : + ℕ))) = + B) → + (hsnested : + ∀ + (j : + Fin + (count + + (1 : + ℕ))), + TreeSequenceInitialSegment + (stages + j.castSucc) + (stages + j.succ)) → + (hsstrict : + ∀ + (j : + Fin + (count + + (1 : + ℕ))), + (stages + j.castSucc).length < + (stages + j.succ).length) → + (hsdivider : + ∀ + (i : + Fin + count), + stages + (⟨(↑i : + ℕ) + + (1 : + ℕ), + by + omega⟩ : + Fin + (count + + (2 : + ℕ))) = + TreeSequencePrefix + B + (↑(positionsS + i) : + ℕ) + (hspositive + i) + (Nat.le_of_lt_succ + (positionsS + i).isLt)) → + (hscore : + TreeSequenceInitialSegment + baseS.core + (stages + (⟨(1 : + ℕ), + by + omega⟩ : + Fin + (count + + (2 : + ℕ))))) → + let + HB : + TashkinovHierarchy + ettB + baseB := + { + dividerCount := + count, + stage := + stages, + baseStage := + hbbase, + terminalStage := + hbterminal, + nested := + hbnested, + strict := + hbstrict, + dividerPosition := + positions, + dividerPositive := + hbpositive, + dividerIncreasing := + hbincreasing, + dividerStage := + hbdivider, + coreInsideFirst := + hbcore : + TashkinovHierarchy + ettB + baseB }; + let + HS : + TashkinovHierarchy + corr.replacementETT + baseS := + { + dividerCount := + count, + stage := + stages, + baseStage := + hsbase, + terminalStage := + hsterminal, + nested := + hsnested, + strict := + hsstrict, + dividerPosition := + positionsS, + dividerPositive := + hspositive, + dividerIncreasing := + hsincreasing, + dividerStage := + hsdivider, + coreInsideFirst := + hscore : + TashkinovHierarchy + corr.replacementETT + baseS }; + (storedEq : + ∀ + (j : + Fin + (count + + (1 : + ℕ))), + HierarchyStoredColorsAt + HS + j = + HierarchyStoredColorsAt + HB + j) → + (missingEq : + ∀ + (j : + Fin + (count + + (1 : + ℕ))), + HierarchyStageMissingColors + HS + j = + HierarchyStageMissingColors + HB + j) → + (segmentEq : + ∀ + (j : + Fin + (count + + (1 : + ℕ))) + (eta : + Fin + k) + (_ : + eta ∈ + HierarchyStoredColorsAt + HB + j), + HierarchySegmentColors + HS + j + eta = + HierarchySegmentColors + HB + j + eta) → + (refreshEq : + ∀ + (i : + Fin + count), + ((TreeSequenceVertexSet + (HS.stage + i.succ.castSucc) \ + TreeSequenceVertexSet + (HierarchyStarredStage + HS + i.castSucc)).biUnion + fun + (v : + V) ↦ + MissingColors + G + sigma + v) = + (TreeSequenceVertexSet + (HB.stage + i.succ.castSucc) \ + TreeSequenceVertexSet + (HierarchyStarredStage + HB + i.castSucc)).biUnion + fun + (v : + V) ↦ + MissingColors + G + phi + v) → + GoodHierarchy + HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb coreToA TnToA hAib B + rpB aboveB strictB belowB genB baseB hcoreB ettB sigma treeMissingEq corr baseS closureBToA + minusEq count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing + hbdivider hbcore goodB stageBToA hcore hpe hclosure positionsS hspositive hsincreasing hsbase + hsterminal hsnested hsstrict hsdivider hscore HB HS storedEq missingEq segmentEq refreshEq + exact { + gamma := goodB.gamma + twoColors := by intro j eta he; exact goodB.twoColors j eta (storedEq j ▸ he) + avoidance := by + intro j eta he + rw [missingEq, segmentEq j eta (storedEq j ▸ he)] + exact goodB.avoidance j eta (storedEq j ▸ he) + disjointPairs := by + intro j eta theta he ht hne + exact goodB.disjointPairs j eta theta (storedEq j ▸ he) (storedEq j ▸ ht) hne + uniqueRefresh := by + intro i + simpa only [storedEq, refreshEq] using goodB.uniqueRefresh i + parallelBase := by + dsimp only + intro hp + have hpOld := hpe.mpr hp + have hc := hclosure hpOld + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := hsbase.symm.trans hbbase + change ¬TreeColorSetMinusClosed G sigma baseS.core + ((HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)) ∧ + 4 ≤ ((TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseS.closure) \ + (HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)).card + rw [← hcore, ← hc, storedEq, htree, + treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA), + treeMissingEq _ (closureBToA hpOld), + minusEq _ (by rw [hcoreB]; exact TreeSequenceInitialSegmentVertexSetSubset coreToA)] + exact goodB.parallelBase hpOld + minusClosed := by + intro i + rw [storedEq, minusEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ))] + exact goodB.minusClosed i } + +theorem helper_continuation_4653.{u_1, u_2} : + helperContinuation4653Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hminimal alpha beta hne H q + A n Tn Dn ia ib vb ell yLength Y segRefl segTrans coreToA TnToA AToT ordinaryToA starredToA + hElementaryY hb vertexY hbY hAia hAib halphaA hbetaA horder habIndex B BToT ABstrict + BstrictT rpB aboveB strictB belowB genB hMPB baseB hcoreB HB hcountB hstagesB hdividersB + goodB hgoodB ettB outsideStored hDn sigma behavior unaffected fixedValue sigmaProper + sigmaOne missingBefore sigmaNotElementary missingA treeMissingEq stable stableTn TnToB + TnStrictB notControlled terminalRoute + have treeControlled (t : Fin Tn.length) : + phi (Tn.edge t) ≠ some alpha ∧ phi (Tn.edge t) ≠ some beta := by + exact @helper_treeControlled_1302 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hone) (@alpha) + (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@HB) + (@notControlled) (@t) + have augmentationControlled (S : TreeSequence G e0) + (hseq : TashkinovAugmentationSequence phi S B) (t : Fin B.length) + (ht : S.length ≤ t.val) : + phi (B.edge t) ≠ some alpha ∧ phi (B.edge t) ≠ some beta := by + exact @helper_augmentationControlled_5115 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@AToT) (@hElementaryY) (@hb) (@vertexY) (@hbY) (@hAib) (@halphaA) (@horder) (@BToT) + (@BstrictT) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@HB) (@S) (@hseq) + (@t) (@ht) + have allControlled (t : Fin B.length) : + phi (B.edge t) ≠ some alpha ∧ phi (B.edge t) ≠ some beta := by + exact @helper_allControlled_1331 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@HB) (@TnToB) + (@terminalRoute) (@treeControlled) (@augmentationControlled) (@t) + have edgesFixed (t : Fin B.length) : sigma (B.edge t) = phi (B.edge t) := + fixedValue _ (allControlled t).1 (allControlled t).2 + have routeTransport (S : TreeSequence G e0) (hs : TashkinovAugmentationSequence phi S B) : + TashkinovAugmentationSequence sigma S B := by + exact @helper_routeTransport_711 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@segTrans) (@hAib) (@BToT) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@HB) (@missingBefore) (@edgesFixed) (@S) (@hs) + have replacement : + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B, + MaximumProperty corr.replacementETT ∧ + ∃ baseS : HierarchyBase corr.replacementETT sigma, + ∃ HS : TashkinovHierarchy corr.replacementETT baseS, + SameHierarchyStages HB HS := by + exact @helper_replacement_5138 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) + (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) + (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) + obtain ⟨corr, hMPS, baseS, HS, hsame⟩ := replacement + have storedS : TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = Dn := by + exact @helper_storedS_1369 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@HB) + (@treeMissingEq) (@corr) (@hMPS) (@baseS) (@HS) (@hsame) + have hrS : corr.replacementETT.rounds = ett.rounds := corr.rungAgreement + have stageBToA (j : Fin (HB.dividerCount + 1)) : + TreeSequenceInitialSegment (HB.stage j.castSucc) A := by + rw [(hstagesB j).1] + exact ordinaryToA _ + have starBToA (j : Fin (HB.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage HB j) A := by + rw [(hstagesB j).2] + exact starredToA _ + have stageBToB (j : Fin (HB.dividerCount + 2)) : + TreeSequenceInitialSegment (HB.stage j) B := by + exact Fin.reverseInduction + (motive := fun j => TreeSequenceInitialSegment (HB.stage j) B) + (by simpa only [HB.terminalStage] using segRefl B) + (fun i hi => segTrans (HB.nested i) hi) j + have closureBToA (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + exact @helper_closureBToA_1398 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@hcoreB) (@hp) + have minusEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) (D : Finset (Fin k)) : + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D := by + exact @helper_minusEq_1405 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@halphaA) (@hbetaA) (@unaffected) (@treeMissingEq) (@S) (@hS) (@D) + rcases HB with ⟨count, stages, hbbase, hbterminal, hbnested, hbstrict, positions, + hbpositive, hbincreasing, hbdivider, hbcore⟩ + rcases HS with ⟨countS, stagesS, hsbase, hsterminal, hsnested, hsstrict, positionsS, + hspositive, hsincreasing, hsdivider, hscore⟩ + rcases hsame with ⟨hcore, hcount, hstages, hpositions, hpe, hclosure⟩ + dsimp only at hcount hstages hpositions + cases hcount + have hstage : stages = stagesS := eq_of_heq hstages + cases hstage + let HB : TashkinovHierarchy ettB baseB := + ⟨count, stages, hbbase, hbterminal, hbnested, hbstrict, positions, + hbpositive, hbincreasing, hbdivider, hbcore⟩ + let HS : TashkinovHierarchy corr.replacementETT baseS := + ⟨count, stages, hsbase, hsterminal, hsnested, hsstrict, positionsS, + hspositive, hsincreasing, hsdivider, hscore⟩ + have starEq (j : Fin (count + 1)) : + HierarchyStarredStage HS j = HierarchyStarredStage HB j := by + exact Fin.cases hcore.symm (fun i => rfl) j + have storedEq (j : Fin (count + 1)) : + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + exact @helper_storedEq_5200 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) + (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + have missingEq (j : Fin (count + 1)) : + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + exact @helper_missingEq_5209 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@j) + -- Only stored colors require a transported first-missing cutoff. + have firstEq (eta : Fin k) (he : eta ∈ Dn) : + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by + exact @helper_firstEq_1458 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@hDn) (@behavior) (@eta) (@he) + have segmentEq (j : Fin (count + 1)) (eta : Fin k) + (he : eta ∈ HierarchyStoredColorsAt HB j) : + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + exact @helper_segmentEq_5224 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) (@he) + have refreshEq (i : Fin count) : + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun v => MissingColors G phi v) := by + exact @helper_refreshEq_5234 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@i) + let goodS : GoodHierarchy HS := by + exact @helperGoodS6400 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@coreToA) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@hcoreB) (@treeMissingEq) (@corr) (@baseS) (@closureBToA) (@minusEq) (@count) (@stages) + (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) + (@hbincreasing) (@hbdivider) (@hbcore) (@goodB) (@stageBToA) (@hcore) (@hpe) (@hclosure) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@storedEq) (@missingEq) (@segmentEq) (@refreshEq) + let CS : HierarchyCounterexample baseS := + { positive := by rw [hrS]; exact C.positive + hierarchy := HS + good := goodS + maximum := hMPS + notElementary := sigmaNotElementary } + have hstarLast : HierarchyStarredStage HS (Fin.last count) = A := by + exact @helper_hstarLast_5289 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) + (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) + (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) (@hspositive) + (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) + (@starEq) + have hlastOrd : HS.stage (Fin.last count).castSucc = H.stage q.castSucc := by + have hs := (hstagesB (Fin.last count)).1 + have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := + Fin.ext (by simp [q]) + simpa only [hj] using hs + -- Path candidates restrict to the shorter prefix; the second measure decreases strictly. + have pathLe : HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + exact @helper_pathLe_5303 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) + (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@positionsS) (@hspositive) + (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) + (@hstarLast) + have tailLess : B.length - (HS.stage (Fin.last count).castSucc).length < + T.length - (H.stage q.castSucc).length := by + rw [hlastOrd] + have hlen := (ordinaryToA q).1 + omega + have hless : HierarchyCounterexampleLess (HierarchyCounterexampleMeasure CS) + (HierarchyCounterexampleMeasure C) := by + change HierarchyPathNumber HS < HierarchyPathNumber H ∨ + (HierarchyPathNumber HS = HierarchyPathNumber H ∧ + B.length - (HS.stage (Fin.last count).castSucc).length < + T.length - (H.stage q.castSucc).length) + rcases lt_or_eq_of_le pathLe with hlt | heq + · exact Or.inl hlt + · exact Or.inr ⟨heq, tailLess⟩ + exact hminimal CS hrS hcountB hless + +theorem helper_finish_4308.{u_1, u_2} : + helperFinish4308Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hminimal alpha beta hne + hmissingPrefix horderedUnused hlocation H q A n Tn Dn ia ib va vb ell yLength Y segRefl + segTrans commonPrefix coreToA TnToA AToT ordinaryToA starredToA hmissingY hElementaryY ha + hb vertexY haY hbY hout hAia hAib halphaA hbetaA horder habIndex havb B BToT AToB ABstrict + BToY BstrictT rpB aboveB strictB belowB genB hMPB hsB baseB hcoreB hclosureB hsupportB HB + hcountB hstagesB hdividersB goodB hgoodB ettB missingSubset outsideStored hDn + by_contra hcomponents + let K := TwoColorComponent G phi alpha beta (Sum.inl vb) + let sigma := TwoColorComponentSwap G phi alpha beta (Sum.inl vb) + have hdisjoint : Disjoint (TwoColorComponent G phi alpha beta (Sum.inl va)) K := + (TwoColorComponentsDisjoint G phi alpha beta (Sum.inl va) (Sum.inl vb)).resolve_left + hcomponents + have haK : Sum.inl va ∉ K := by + intro h + exact Set.disjoint_left.mp hdisjoint (show Sum.inl va ∈ + TwoColorComponent G phi alpha beta (Sum.inl va) from rfl) h + have behavior := TwoColorComponentSwapMissingBehavior G phi alpha beta hne hproper + (Sum.inl vb) + have edgeOfVertex {v : V} {f : E} (hv : Sum.inl v ∈ K) + (hf : Incident G v f) (hc : phi f = some alpha ∨ phi f = some beta) : + Sum.inr f ∈ K := by + have hadj : (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inr f) (Sum.inl v) := + ⟨hf, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv + have unaffected (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + sigma f = some c ↔ phi f = some c := by + exact @helper_unaffected_1187 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@ha) (@hb) (@f) (@c) (@hca) (@hcb) + have fixedValue (f : E) (ha : phi f ≠ some alpha) (hb : phi f ≠ some beta) : + sigma f = phi f := by + simp [sigma, TwoColorComponentSwap, ha, hb] + have sigmaProper : IsProperEdgeColoring G sigma := + TwoColorComponentSwapProper G phi alpha beta hne hproper _ + have sigmaOne : IsOneEdgeUncolored sigma e0 := by + exact @helper_sigmaOne_1202 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hone) (@alpha) + (@beta) (@hne) (@ha) (@hb) (@unaffected) + have vertexB (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : + T.vertex i ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have haB : va ∈ TreeSequenceVertexSet B := vertexB ia (le_of_lt habIndex) + have hbB : vb ∈ TreeSequenceVertexSet B := vertexB ib le_rfl + -- Elementarity fixes missing sets before the swapped endpoint, even inside its component. + have missingBefore (v : V) (hv : v ∈ TreeSequenceVertexSet B) (hvb : v ≠ vb) : + MissingColors G sigma v = MissingColors G phi v := by + exact @helper_missingBefore_438 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@hElementaryY) (@ha) (@hb) (@haY) (@hbY) (@hAib) (@BToY) (@haK) (@behavior) + (@edgeOfVertex) (@v) (@hv) (@hvb) + have hnewa : alpha ∈ MissingColors G sigma va := by + rw [behavior.1 va haK] + exact ha.1 + have hnewb : alpha ∈ MissingColors G sigma vb := + behavior.2.2.1 vb (show Sum.inl vb ∈ K from rfl) hb.1 + have sigmaNotElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := + fun he => Finset.disjoint_left.mp (he haB hbB havb) hnewa hnewb + have missingA (v : V) (hv : v ∈ TreeSequenceVertexSet A) : + MissingColors G sigma v = MissingColors G phi v := + missingBefore v (TreeSequenceInitialSegmentVertexSetSubset AToB hv) + (by intro he; exact hout.2 (he ▸ hv)) + have treeMissingEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) : + TreeMissingColors sigma S = TreeMissingColors phi S := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => missingA v (hS hv)) + have stable (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) + (D : Finset (Fin k)) (hD : alpha ∉ D ∧ beta ∉ D) : + StableColoring S D phi sigma := by + exact @helper_stable_1247 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@halphaA) + (@hbetaA) (@unaffected) (@missingA) (@S) (@hS) (@D) (@hD) + have stableTn : StableColoring Tn Dn phi sigma := + stable Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) Dn hDn + have TnToB := segTrans TnToA AToB + have TnStrictB : Tn.length < B.length := lt_of_le_of_lt TnToA.1 ABstrict + have BToFinal := segTrans BToT ett.belowFinal + have notControlled (c : Fin k) (hc : c = alpha ∨ c = beta) : + c ∉ TreeMissingColors phi Tn ∪ Dn := by + intro hm + rcases Finset.mem_union.mp hm with hm | hm + · rcases hc with rfl | rfl + · exact halphaA (missingSubset TnToA hm) + · exact hbetaA (missingSubset TnToA hm) + · rcases hc with rfl | rfl + · exact hDn.1 hm + · exact hDn.2 hm + have storedOrMissing (c : Fin k) (hc : c ∈ ett.series.data.stored n) : + c ∈ TreeMissingColors phi Tn ∪ Dn := by + exact @helper_storedOrMissing_1276 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@HB) (@c) (@hc) + -- Nonparallel extensions retain the certified connecting edge and one-edge seed. + have terminalRoute : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed B ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta) := by + exact @helper_terminalRoute_532 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@commonPrefix) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@HB) + (@TnToB) (@TnStrictB) (@BToFinal) (@notControlled) (@storedOrMissing) + exact @helper_continuation_4653 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hminimal) (@alpha) (@beta) (@hne) (@segRefl) (@segTrans) (@coreToA) (@TnToA) + (@AToT) (@ordinaryToA) (@starredToA) (@hElementaryY) (@hb) (@vertexY) (@hbY) (@hAia) + (@hAib) (@halphaA) (@hbetaA) (@horder) (@habIndex) (@BToT) (@ABstrict) (@BstrictT) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@hcountB) + (@hstagesB) (@hdividersB) (@goodB) (@hgoodB) (@outsideStored) (@hDn) (@behavior) + (@unaffected) (@fixedValue) (@sigmaProper) (@sigmaOne) (@missingBefore) + (@sigmaNotElementary) (@missingA) (@treeMissingEq) (@stable) (@stableTn) (@TnToB) + (@TnStrictB) (@notControlled) (@terminalRoute) +theorem helper_continuation_4272.{u_1, u_2} : + helperContinuation4272Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hminimal alpha beta hne + hmissingPrefix horderedUnused hlocation H q A n Tn Dn ia ib va vb ell yLength Y segRefl + segTrans commonPrefix lastPositive coreToA TnToA AToT ordinaryToA starredToA YToT hmissingY + hElementaryY ha hb vertexY haY hbY hout hAia hAib missingNotA + have halphaA : alpha ∉ TreeMissingColors phi A := missingNotA alpha ia ha.1 haY hout.1 + have hbetaA : beta ∉ TreeMissingColors phi A := missingNotA beta ib hb.1 hbY hout.2 + have horder := horderedUnused (Or.inl halphaA) + have habIndex : ia.val < ib.val := by + obtain ⟨i, j, hi, hj, hij⟩ := horder.1 + have hei := T.vertex_injective hi + have hej := T.vertex_injective hj + simpa [hei, hej] using hij + have havb : va ≠ vb := by + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + omega + -- Keep the exact ordered prefix ending at the beta-missing vertex. + let B := TreeSequencePrefix T ib.val (by have := A.positive; omega) + (Nat.le_of_lt_succ ib.isLt) + have BToT : TreeSequenceInitialSegment B T := + ⟨Nat.le_of_lt_succ ib.isLt, (by intro i; rfl), (by intro i; rfl)⟩ + have AToB : TreeSequenceInitialSegment A B := commonPrefix AToT BToT (by exact le_of_lt hAib) + have ABstrict : A.length < B.length := hAib + have BToY : TreeSequenceInitialSegment B Y := commonPrefix BToT YToT hb.2 + have BstrictT : B.length < T.length := by + exact @helper_BstrictT_1127 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) + (@ABstrict) (@BToY) + obtain ⟨ettB, hMPB, hrB, hsB, baseB, hcoreB, hclosureB, hsupportB, + HB, hcountB, hstagesB, hdividersB, goodB, hgoodB⟩ := + GoodHierarchyTerminalPrefixRepackage G k e0 input T phi phi ett C.maximum + base H C.good B AToB ABstrict BToT + rcases ettB with ⟨rB, rpB, seriesB, aboveB, strictB, belowB, genB⟩ + cases hrB + have heqB : seriesB = ett.series := eq_of_heq hsB + cases heqB + let ettB : ExtendedTashkinovTree G k e0 input B phi := + ⟨ett.rounds, rpB, ett.series, aboveB, strictB, belowB, genB⟩ + have missingSubset {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U) : + TreeMissingColors phi S ⊆ TreeMissingColors phi U := by + intro c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hSU hv, hcv⟩ + have outsideStored (hcase : + (0 < H.dividerCount ∧ (alpha ∈ TreeMissingColors phi (H.stage ⟨H.dividerCount, by omega⟩) ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) (HierarchyStoredColorsAt H q))) ∨ + (H.dividerCount = 0 ∧ (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) Dn))) : + alpha ∉ Dn ∧ beta ∉ Dn := by + exact @helper_outsideStored_1149 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@lastPositive) (@TnToA) (@hAib) (@halphaA) (@hbetaA) (@rpB) (@aboveB) (@strictB) + (@belowB) (@genB) (@baseB) (@HB) (@missingSubset) (@hcase) + have finish (hDn : alpha ∉ Dn ∧ beta ∉ Dn) : + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) := by + exact @helper_finish_4308 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) + (@hminimal) (@alpha) (@beta) (@hne) (@hmissingPrefix) (@horderedUnused) (@hlocation) + (@segRefl) (@segTrans) (@commonPrefix) (@coreToA) (@TnToA) (@AToT) (@ordinaryToA) + (@starredToA) (@hmissingY) (@hElementaryY) (@ha) (@hb) (@vertexY) (@haY) (@hbY) (@hout) + (@hAia) (@hAib) (@halphaA) (@hbetaA) (@horder) (@habIndex) (@havb) (@BToT) (@AToB) + (@ABstrict) (@BToY) (@BstrictT) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@hMPB) + (@hsB) (@baseB) (@hcoreB) (@hclosureB) (@hsupportB) (@HB) (@hcountB) (@hstagesB) + (@hdividersB) (@goodB) (@hgoodB) (@missingSubset) (@outsideStored) (@hDn) + exact ⟨fun h => finish (outsideStored (Or.inl h)), + fun h => finish (outsideStored (Or.inr h))⟩ + +end GoldbergSeymour.ChangeLemmaBothOutsidePreparation + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaInsideOutside.lean b/LeanPool/GoldbergSeymour/ChangeLemmaInsideOutside.lean new file mode 100644 index 0000000000..b89aab5b8a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaInsideOutside.lean @@ -0,0 +1,240 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemmaMixedClosedFinal +public import LeanPool.GoldbergSeymour.ChangeLemmaMixedLargestClosed +public import LeanPool.GoldbergSeymour.ChangeLemmaMixedNoClosed +public import LeanPool.GoldbergSeymour.ChangeLemmaMixedZeroNonclosed + +/-! +# Change Lemma Inside Outside + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ChangeLemmaInsideOutside {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty) + (horderedUnused : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + (alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c)) + (hlocation : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + va ∈ TreeSequenceVertexSet A ∧ + vb ∉ TreeSequenceVertexSet A) : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let Dnq := HierarchyStoredColorsAt H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let sameComponent := TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) + (0 < H.dividerCount ∧ + (alpha ∈ TreeMissingColors phi Tnq ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) Dn) → + sameComponent) ∧ + (alpha ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A {alpha} → + sameComponent ∧ TreeInterchangeable G A phi alpha beta) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := T.length - A.length + let prefixLength := min (A.length + (ell - 1)) T.length + let Ty := TreeSequencePrefix T prefixLength + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let sameComponent := TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) + have hmissingPrefix' : alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty := by + simpa [H, q, A, ell, prefixLength, Ty] using hmissingPrefix + have firstMissingIsMissing : + ∀ c : Fin k, c ∈ TreeMissingColors phi Ty → c ∈ MissingColors G phi (T.vertex + (HierarchyFirstMissingPosition phi T c)) := by + intro c hc + unfold TreeMissingColors at hc + simp only [Finset.mem_biUnion] at hc + obtain ⟨v, hv, hcv⟩ := hc + unfold TreeSequenceVertexSet at hv + simp only [Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, rfl⟩ := hv + let iT : Fin (T.length + 1) := Fin.castLE + (Nat.succ_le_succ (Nat.min_le_right _ _)) i + have hci : c ∈ MissingColors G phi (T.vertex iT) := by + simpa [Ty, prefixLength, TreeSequencePrefix, iT] using hcv + let candidates : Finset (Fin (T.length + 1)) := + Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) + have hcandidates : candidates.Nonempty := by + refine ⟨iT, ?_⟩ + simp [candidates, hci] + have hmin := Finset.min'_mem candidates hcandidates + have hmin' : c ∈ MissingColors G phi + (T.vertex (candidates.min' hcandidates)) := + (Finset.mem_filter.mp hmin).2 + simpa [HierarchyFirstMissingPosition, candidates, hcandidates] using hmin' + have hlocation' : va ∈ TreeSequenceVertexSet A ∧ + vb ∉ TreeSequenceVertexSet A := by + simpa [H, q, A, va, vb] using hlocation + have hmissingA : alpha ∈ TreeMissingColors phi A := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr + ⟨va, hlocation'.1, firstMissingIsMissing alpha hmissingPrefix'.1⟩ + have closedCase (hclosed : TreeColorSetClosed G phi A {alpha}) : + sameComponent ∧ TreeInterchangeable G A phi alpha beta := by + simpa [H, q, A, va, vb, sameComponent] using + (ChangeLemmaMixedClosedFinal G k e0 input T phi ett base C hproper hone + hlower hfewer hminimal hprefixElementary hlarge alpha beta hne + hmissingPrefix horderedUnused hlocation ⟨hmissingA, hclosed⟩) + have positiveNonclosedCase (hpositive : 0 < H.dividerCount) + (hnotclosed : ¬ TreeColorSetClosed G phi A {alpha}) : + sameComponent := by + by_cases hex : ∃ r : Fin (H.dividerCount + 1), + TreeColorSetClosed G phi (HierarchyStarredStage H r) {alpha} + · let closedStages : Finset (Fin (H.dividerCount + 1)) := + Finset.univ.filter fun r => + TreeColorSetClosed G phi (HierarchyStarredStage H r) {alpha} + have hclosedStages : closedStages.Nonempty := by + obtain ⟨r, hr⟩ := hex + exact ⟨r, by simp [closedStages, hr]⟩ + obtain ⟨r, hrmem, hrmax⟩ := + Finset.exists_max_image closedStages (fun s => s.val) hclosedStages + have hrclosed : TreeColorSetClosed G phi + (HierarchyStarredStage H r) {alpha} := by + exact (Finset.mem_filter.mp hrmem).2 + have hrne : r.val ≠ H.dividerCount := by + intro hre + apply hnotclosed + have hrq : r = q := by + apply Fin.ext + simpa [q, Fin.last] using hre + simpa [A, hrq] using hrclosed + have hrlt : r.val < H.dividerCount := by omega + have hlater : ∀ s : Fin (H.dividerCount + 1), r.val < s.val → + ¬ TreeColorSetClosed G phi + (HierarchyStarredStage H s) {alpha} := by + intro s hrs hsclosed + have hsmem : s ∈ closedStages := by + simp [closedStages, hsclosed] + have hle := hrmax s hsmem + omega + simpa [H, q, A, va, vb, sameComponent] using + (ChangeLemmaMixedLargestClosed G k e0 input T phi ett base C hproper hone + hlower hfewer hminimal hprefixElementary hlarge alpha beta hne + hmissingPrefix horderedUnused hlocation r + ⟨hpositive, hrlt, hrclosed, hlater⟩) + · have hnone : + ∀ s : Fin (H.dividerCount + 1), ¬ TreeColorSetClosed G phi (HierarchyStarredStage H s) {alpha} + := by + intro s hs + exact hex ⟨s, hs⟩ + simpa [H, q, A, va, vb, sameComponent] using + (ChangeLemmaMixedNoClosed G k e0 input T phi ett base C hproper hone + hlower hfewer hminimal hprefixElementary hlarge alpha beta hne + hmissingPrefix horderedUnused hlocation ⟨hpositive, hnone⟩) + refine ⟨?_, ?_, ?_⟩ + · rintro ⟨hpositive, halt⟩ + by_cases hclosed : TreeColorSetClosed G phi A {alpha} + · exact (closedCase hclosed).1 + · exact positiveNonclosedCase hpositive hclosed + · rintro ⟨hzero, halt⟩ + by_cases hclosed : TreeColorSetClosed G phi A {alpha} + · exact (closedCase hclosed).1 + · simpa [H, q, A, va, vb, sameComponent] using + (ChangeLemmaMixedZeroNonclosed G k e0 input T phi ett base C hproper hone + hlower hfewer hminimal hprefixElementary hlarge alpha beta hne + hmissingPrefix horderedUnused hlocation ⟨hzero, hclosed, halt⟩) + · intro hclosed + exact closedCase hclosed.2 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean new file mode 100644 index 0000000000..bbbe1a1d9f --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean @@ -0,0 +1,5845 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess + +public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction + +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition + +/-! +# Change Lemma Mixed Closed Final + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation5185Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + B.length < T.length → + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (hcountB : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + HB.stage j.castSucc = H.stage jo.castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H jo) → + (∀ (i : Fin HB.dividerCount), + (↑(HB.dividerPosition i) : ℕ) = + (↑(H.dividerPosition (Fin.cast hcountB i)) : ℕ)) → + ∀ (goodB : GoodHierarchy HB), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + HierarchyStoredColorsAt HB j = HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HB j = HierarchyStageMissingColors H jo ∧ + ∀ (eta : Fin k), + goodB.gamma j eta = C.good.gamma jo eta ∧ + HierarchySegmentColors HB j eta ⊆ HierarchySegmentColors H jo eta) → + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT → + ∀ (baseS : HierarchyBase corr.replacementETT sigma) + (HS : TashkinovHierarchy corr.replacementETT baseS), + SameHierarchyStages HB HS → + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + corr.replacementETT.rounds = ett.rounds → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) A) → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage HB j) A) → + (∀ (j : Fin (HB.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (HB.stage j) B) → + False + +private abbrev helperContinuation5094Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + by omega) + (by omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ + MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ + MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + vb ∈ TreeSequenceVertexSet Y → + va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A → + ∀ (hAib : A.length < (↑ib : ℕ)), + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + va ≠ vb → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A B → + A.length < B.length → + B.length < T.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (hcountB : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast (by omega) j; + HB.stage j.castSucc = H.stage jo.castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H jo) → + (∀ (i : Fin HB.dividerCount), + (↑(HB.dividerPosition i) : ℕ) = + (↑(H.dividerPosition (Fin.cast hcountB i)) : ℕ)) → + ∀ (goodB : GoodHierarchy HB), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast (by omega) j; + HierarchyStoredColorsAt HB j = + HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HB j = + HierarchyStageMissingColors H jo ∧ + ∀ (eta : Fin k), + goodB.gamma j eta = C.good.gamma jo eta ∧ + HierarchySegmentColors HB j eta ⊆ + HierarchySegmentColors H jo eta) → + let _ : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, + series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }; + let K : Set (V ⊕ E) := + TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, Sum.inl v ∉ K) → + (have C : Set (V ⊕ E) := + TwoColorComponent G phi alpha beta (Sum.inl vb); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (v : V), + Sum.inl v ∉ C → + MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + alpha ∈ MissingColors G phi v → + beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → + alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → + (c ∈ MissingColors G phi' v ↔ + c ∈ MissingColors G phi v)) → + (∀ (f : E), + phi f ≠ some alpha → + phi f ≠ some beta → sigma f = phi f) → + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + va ∈ TreeSequenceVertexSet B → + vb ∈ TreeSequenceVertexSet B → + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → + MissingColors G sigma v = MissingColors G phi v) → + alpha ∈ MissingColors G sigma va → False + +private abbrev helperContinuation5074Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + alpha ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ alpha } : Finset (Fin k))) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + TreeSequenceInitialSegment Y T → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + va ∈ TreeSequenceVertexSet Y → + vb ∈ TreeSequenceVertexSet Y → + va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A → + A.length < (↑ib : ℕ) → + (∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + let sameComponent : Prop := + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb); + sameComponent ∧ TreeInterchangeable G A phi alpha beta + +private theorem helper_segTrans_199.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W := by + classical + intro V E G e0 S U W hSU hUW + refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + +private theorem helper_commonPrefix_209.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U := by + classical + intro V E G e0 S U W hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +private theorem helper_stageSegment_219.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H segRefl segTrans a d hbound + induction d with + | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + +private theorem helper_stageToT_227.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (H.stage j) T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H stageSegment j + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) + simpa [he, H.terminalStage] using hs + +private theorem helper_lastPositive_238.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hz + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm + +private theorem helper_coreToA_250.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment base.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A segRefl segTrans stageSegment lastZero + lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segRefl _ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + +private theorem helper_TnToCore_259.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + TreeSequenceInitialSegment Tn base.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base n Tn segRefl + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (base.parallel hp).2.2).leftSegment + · rw [base.nonparallel hp] + exact segRefl _ + +private theorem helper_AToT_266.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A segTrans stageToT lastZero lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) + · rw [lastPositive hz] + exact stageToT _ + +private theorem helper_ordinaryToA_273.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment Tn A → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n Tn stageSegment lastZero lastPositive + TnToA j + by_cases hz : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) + rw [hj, H.baseStage] + exact TnToA + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + rw [lastPositive hz] + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> + simp only [Fin.val_castSucc]; omega + +private theorem helper_firstMissing_293.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment Y T → + ∀ c ∈ TreeMissingColors phi Y, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell yLength Y YToT c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let it := Fin.castLE (Nat.succ_le_succ YToT.1) i + have hci : c ∈ MissingColors G phi (T.vertex it) := by + rw [YToT.2.1 i, hi] + exact hcv + let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) + have hit : it ∈ candidates := by simp [candidates, hci] + have hnon : candidates.Nonempty := ⟨it, hit⟩ + have hmem := Finset.min'_mem candidates hnon + have hle := Finset.min'_le candidates it hit + refine ⟨?_, ?_⟩ + · simpa [HierarchyFirstMissingPosition, candidates, hnon] using + (Finset.mem_filter.mp hmem).2 + · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt + have hval : (candidates.min' hnon).val ≤ it.val := hle + simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv + +private theorem helper_outsideIndex_325.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + ∀ (i : Fin (T.length + (1 : ℕ))), + T.vertex i ∉ TreeSequenceVertexSet A → + A.length < (↑i : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A AToT i hi + by_contra h + have hle : i.val ≤ A.length := by omega + apply hi + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ + +private theorem helper_missingNotA_336.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + TreeSequenceInitialSegment A Y → + ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ell yLength Y hElementaryY + AToY c i hmi hiy hia + clear * - hmi hiy hia AToY hElementaryY + intro hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) + exact (Finset.disjoint_left.mp + (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi + +private theorem helper_habIndex_350.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + (↑ia : ℕ) < (↑ib : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta ia ib horder + obtain ⟨i, j, hi, hj, hij⟩ := horder.1 + have hei := T.vertex_injective hi + have hej := T.vertex_injective hj + simpa [hei, hej] using hij + +private theorem helper_BstrictT_369.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + A.length < B.length → + TreeSequenceInitialSegment B Y → + B.length < T.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib ell yLength Y AToT hAib B + ABstrict BToY + clear * - AToT BToY ABstrict Y + have hAT := AToT.1 + have hY : Y.length = min (A.length + (T.length - A.length - 1)) T.length := rfl + have hBY := BToY.1 + have hAB := ABstrict + omega + +private theorem helper_branch_392.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (H.dividerCount = (0 : ℕ) → A = base.core) → + alpha ∈ TreeMissingColors phi A → + TreeColorSetClosed G phi A ({ alpha } : Finset (Fin k)) → + H.dividerCount = (0 : ℕ) → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeInterchangeable G base.core phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn Dn + lastZero halphaA halphaClosed hz hp + have hs : CombinedStableColoring Tn base.closure Dn phi phi := + ⟨⟨(by intros; rfl), (by intros; rfl)⟩, + ⟨(by intros; rfl), (by intros; rfl)⟩⟩ + exact (interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hp base hproper hone hs alpha beta).2.2.1 + (by simpa [lastZero hz] using halphaA) + (by simpa [lastZero hz] using halphaClosed) + +private theorem helper_branch_399.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (H.dividerCount = (0 : ℕ) → A = base.core) → + alpha ∈ TreeMissingColors phi A → + H.dividerCount = (0 : ℕ) → + ¬ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeInterchangeable G base.core phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn + lastZero halphaA hz hp + rw [base.nonparallel hp] + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have hprev : StableColoring Tn + (TashkinovStoredColors ett.series.data j.castSucc) + (ett.series.data.coloring j.castSucc) phi := by + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => + have hv := congrArg Fin.val hi + simp [n] at hv + have := C.positive + omega + | SE ji _ _ _ _ _ choice _ coloring stored edges kind vertex outside + delta gamma seed adjoin closure ordered strict => + have hji : ji = j := Fin.ext (by + have hv := congrArg Fin.val hi + simp [n, j] at hv ⊢ + omega) + subst ji + have hc : phi = choice.selected := by + simpa only [← hj, coloring, n] using ett.generatingColoring + simpa only [hj, Tn, hc] using choice.selectedStable + | RE ji _ _ _ _ available coloring stored edges kind vertex outside + delta gamma seed adjoin closure ordered strict => + have hji : ji = j := Fin.ext (by + have hv := congrArg Fin.val hi + simp [n, j] at hv ⊢ + omega) + subst ji + have hc : phi = ett.series.data.coloring j.castSucc := by + simpa only [← hj, coloring, n] using ett.generatingColoring + refine ⟨?_, ?_⟩ + · intro f _ _ + exact congrFun hc f + · intro v _ + exact congrArg (fun psi => MissingColors G psi v) hc + | PE ji _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper + one stored edges kind vertex outside delta gammaEq closure ordered strict => + exact (hp (by simpa [← hi] using kind)).elim + have hm : alpha ∈ TreeMissingColors phi Tn := by + simpa only [lastZero hz, base.nonparallel hp] using halphaA + by_cases hn : 1 < ett.rounds + · obtain ⟨lower, hr, hmax, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T phi ett C.maximum + (ett.rounds - 1) (by omega) (by omega) + let nl : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hcidx : Fin.castLE (by omega) nl = j.castSucc := + Fin.ext (by simp [nl, j, hr]) + have htidx : Fin.castLE (by omega) (Fin.last (lower.rounds + 1)) = + n.castSucc := Fin.ext (by simp [n, hr]; omega) + have ht : lower.series.data.tree (Fin.last (lower.rounds + 1)) = Tn := + (htrees _).trans (congrArg ett.series.data.tree htidx) + obtain ⟨hc, _, _, _, _, _, _, _, hd, _⟩ := hdata nl + rw [hcidx] at hc hd + have hs : StableColoring + (lower.series.data.tree (Fin.last (lower.rounds + 1))) + (TashkinovStoredColors lower.series.data nl) + (lower.series.data.coloring nl) phi := by + rw [ht, hc, hd] + exact hprev + have hi := (hlower lower (by omega) (by omega) hmax).2.1 + phi hproper hone hs alpha beta (Or.inl (by rw [ht]; exact hm)) + simpa only [ht] using hi + · have hn1 : ett.rounds = 1 := by have := C.positive; omega + have hj0 : j.castSucc = (0 : Fin (ett.rounds + 1)) := + Fin.ext (by simp [j, hn1]) + have ht1 : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn1]) + have hs : StableColoring (ett.series.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors ett.series.data 0) + (ett.series.data.coloring 0) phi := by + simpa only [Tn, ht1, hj0] using hprev + have hi := (TechnicalTheoremBase G k ett.rounds e0 input ett.series).2 + phi hproper hone hs alpha beta + (Or.inl (by simpa only [Tn, ht1] using hm)) + have hTn1 : Tn = ett.series.data.tree ⟨1, by omega⟩ := + congrArg ett.series.data.tree ht1 + change TreeInterchangeable G Tn phi alpha beta + rw [hTn1] + exact hi + +private theorem helper_branch_481.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + alpha ∈ TreeMissingColors phi A → + TreeColorSetClosed G phi A ({ alpha } : Finset (Fin k)) → + ¬H.dividerCount = (0 : ℕ) → + TreeInterchangeable G A phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge alpha beta + hne H q A lastPositive halphaA halphaClosed hz + let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hi : i.succ.castSucc = (⟨H.dividerCount, by omega⟩ : + Fin (H.dividerCount + 2)) := Fin.ext (by simp [i]; omega) + rw [lastPositive hz] + rw [← hi] + apply step1 G k e0 input T phi ett C.maximum C.positive hproper hone + hlower base H C.good hfewer hlarge i alpha beta + · simpa [hi, ← lastPositive hz] using halphaA + · exact hne + · simpa [hi, ← lastPositive hz] using halphaClosed + +private theorem helper_pathMissing_495.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi → + ∀ (v : V) (c d : Fin k), + c ≠ d → + c ∈ MissingColors G phi v → + TwoColorPathComponent G phi c d (Sum.inl v) := by + classical + intro V E _ _ G k phi hproper v c d hcd hc + let _ := Fintype.ofFinite V + refine ⟨hcd, Sum.inl v, rfl, ?_⟩ + intro x hx y hy + cases x with + | inr f => + cases y with + | inr g => + have hfc : phi f = some d := hx.2.resolve_left (by + intro he + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) + have hgc : phi g = some d := hy.2.resolve_left (by + intro he + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) + congr 1 + by_contra hfg + exact hproper hfg ⟨v, hx.1, hy.1⟩ hfc hgc + | inl w => exact False.elim hy + | inl w => exact False.elim hx + +private theorem helper_pathB_520.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + TwoColorPathComponent G phi alpha beta (Sum.inl vb) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper alpha beta hne H q A ib vb ell yLength + Y hb + refine ⟨hne, Sum.inl vb, rfl, ?_⟩ + intro x hx y hy + cases x with + | inr f => + cases y with + | inr g => + have hfc : phi f = some alpha := hx.2.resolve_right (by + intro he + exact (Finset.mem_sdiff.mp hb.1).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) + have hgc : phi g = some alpha := hy.2.resolve_right (by + intro he + exact (Finset.mem_sdiff.mp hb.1).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) + congr 1 + by_contra hfg + exact hproper hfg ⟨vb, hx.1, hy.1⟩ hfc hgc + | inl w => exact False.elim hy + | inl w => exact False.elim hx + +private theorem helper_unaffected_555.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta + (Sum.inl vb); + ∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ib vb ell yLength Y ha hb + K sigma f c hca hcb + clear * - hca hcb K sigma hne + by_cases hf : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hca.symm, hcb.symm] + · by_cases hb : phi f = some beta + · simp [sigma, TwoColorComponentSwap, K, hf, hb, hne.symm, + hca.symm, hcb.symm] + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hb] + · simp [sigma, TwoColorComponentSwap, K, hf] + +private theorem helper_sigmaOne_572.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta hne H q A ib vb ell yLength Y + ha hb K sigma unaffected + clear * - hone sigma K unaffected hne + refine ⟨?_, ?_⟩ + · simp [sigma, TwoColorComponentSwap, hone.1] + · intro f hf + obtain ⟨c, hc⟩ := hone.2 f hf + by_cases ha : c = alpha + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · by_cases hb : c = beta + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc, hne.symm]⟩ + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨c, (unaffected f c ha hb).mpr hc⟩ + +private theorem helper_missingBefore_597.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + va ∈ TreeSequenceVertexSet Y → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B Y → + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + Sum.inl va ∉ K → + (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → + (∀ {v : V} {f : E}, + Sum.inl v ∈ K → + Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ K) → + ∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → + MissingColors G sigma v = MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ia ib va vb ell yLength Y + hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb + by_cases hvK : Sum.inl v ∈ K + · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) + have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv + have han : alpha ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 + have hbn : beta ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 + have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by + simpa [MissingColors, PresentColors] using han + have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by + simpa [MissingColors, PresentColors] using hbn + obtain ⟨fa, hfa, hfca⟩ := hpa + obtain ⟨fb, hfb, hfcb⟩ := hpb + have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) + have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) + have hnewa : sigma fb = some alpha := by + simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] + have hnewb : sigma fa = some beta := by + simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] + have hana : alpha ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fb, hfb, hnewa⟩ + have hbnb : beta ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fa, hfa, hnewb⟩ + ext c + by_cases hca : c = alpha + · subst c; simp [hana, han] + · by_cases hcb : c = beta + · subst c; simp [hbnb, hbn] + · exact behavior.2.2.2 v c hca hcb + · exact behavior.1 v hvK + +private theorem helper_incidentFixed_651.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, Sum.inl v ∉ K) → + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + ∀ (f : E), + TreeIncidentEdge A f → + sigma f = phi f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell yLength Y ha hb K + sigma avoidA fixedValue f hf + clear * - hf sigma K avoidA fixedValue + obtain ⟨v, hv, hvf⟩ := hf + by_cases hK : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · exact False.elim (avoidA v hv + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, Or.inl ha⟩)).trans hK)) + · by_cases hb : phi f = some beta + · exact False.elim (avoidA v hv + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, Or.inr hb⟩)).trans hK)) + · exact fixedValue f ha hb + · simp [sigma, TwoColorComponentSwap, K, hK] + +private theorem helper_stable_667.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + (∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), + StableColoring S D phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb sigma missingA + incidentFixed S hS D + refine ⟨?_, fun v hv => missingA v (hS hv)⟩ + intro f hf _ + obtain ⟨v, hv, hvf⟩ := hf + exact incidentFixed f ⟨v, hS hv, hvf⟩ + +private theorem helper_terminalRoute_680.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ)))) → + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib commonPrefix hAib B + TnToB TnStrictB BToFinal + clear * - ett C n Tn B BToFinal TnToB TnStrictB commonPrefix + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => have hv := congrArg Fin.val hi; simp [n] at hv; have := C.positive; omega + | SE j _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedB : TreeSequenceInitialSegment seed B := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + BToFinal (by + have hl := adjoin.1 + rw [hj] at hl + change seed.length = Tn.length + 1 at hl + omega) + exact Or.inr ⟨Or.inl (by simpa [hj] using kind), choice.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + TashkinovAugmentationSequenceRestrict phi seed B _ hroute hseedB BToFinal⟩ + | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + refine Or.inl ⟨by simpa [hj] using kind, ?_⟩ + apply TashkinovAugmentationSequenceRestrict phi Tn B _ _ TnToB BToFinal + simpa [Tn, hj, hlast, ← ett.generatingColoring, n] using closure.1 + | RE j _ _ _ _ available coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedB : TreeSequenceInitialSegment seed B := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + BToFinal (by + have hl := adjoin.1 + rw [hj] at hl + change seed.length = Tn.length + 1 at hl + omega) + exact Or.inr ⟨Or.inr (by simpa [hj] using kind), available.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + TashkinovAugmentationSequenceRestrict phi seed B _ hroute hseedB BToFinal⟩ + +private theorem helper_displayedIncident_729.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + ∀ (t : Fin S.length), + TreeIncidentEdge A (S.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A S hSA t + obtain ⟨i, hi⟩ := S.attaches t + refine ⟨S.vertex t.succ, TreeSequenceInitialSegmentVertexSetSubset hSA + (by simp [TreeSequenceVertexSet]), ?_⟩ + simp [Incident, hi] + +private theorem helper_augmentationFixed_737.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A B → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + (∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + ∀ (t : Fin S.length), TreeIncidentEdge A (S.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), + S.length ≤ (↑t : ℕ) → + sigma (B.edge t) = phi (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell yLength Y segRefl + hElementaryY hb vertexY hbY hAib horder B BToT AToB sigma fixedValue incidentFixed + displayedIncident S hseq t ht + by_cases htA : t.val < A.length + · have he := AToB.2.2 ⟨t.val, htA⟩ + have hi : Fin.castLE AToB.1 ⟨t.val, htA⟩ = t := Fin.ext rfl + rw [hi] at he + rw [he] + exact incidentFixed _ (displayedIncident A (segRefl A) _) + · have hstep := (TashkinovAugmentationSequencePosition phi S B hseq t ht).1 + obtain ⟨hl, hinit, c, hcol, hm⟩ := hstep + have hcolB : phi (B.edge t) = some c := by + convert hcol using 1 + congr 2 + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨iv, hiv⟩ := hv + let ivT : Fin (T.length + 1) := ⟨iv.val, by + have htB := BToT.1 + have := iv.isLt + simp only [TreeSequencePrefix] at this + omega⟩ + have hcvT : c ∈ MissingColors G phi (T.vertex ivT) := by + have he : (TreeSequencePrefix B t.val (le_trans S.positive ht) + (Nat.le_of_lt t.isLt)).vertex iv = T.vertex ivT := rfl + rw [← he, hiv] + exact hcv + have hnotA : c ≠ alpha := by + intro he + subst c + apply horder.2 + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, Fin.castLE BToT.1 t, + by change A.length ≤ t.val; omega, t.isLt, + by rw [BToT.2.2 t]; exact hcolB⟩ + have hnotB : c ≠ beta := by + intro he + subst c + have hivB : ivT.val < ib.val := by + have := iv.isLt + simp only [TreeSequencePrefix] at this + have htB : t.val < ib.val := t.isLt + dsimp [ivT] + omega + have hvY := vertexY ivT (by omega) + have hneV : T.vertex ivT ≠ vb := by + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + omega + exact Finset.disjoint_left.mp (hElementaryY hvY hbY hneV) hcvT hb.1 + exact fixedValue _ (fun hc => hnotA (Option.some.inj (hcolB.symm.trans hc))) + (fun hc => hnotB (Option.some.inj (hcolB.symm.trans hc))) + +private theorem helper_seedFixed_790.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + ∀ (f : E) (seed : TreeSequence G e0), + TreeSequenceAdjoinEdge Tn f seed → + sigma f = phi f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA sigma + incidentFixed f seed hadjoin + obtain ⟨i, hi⟩ := seed.attaches (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) + let j : Fin (Tn.length + 1) := ⟨i.val, by have := i.isLt; simpa using this⟩ + have hv : seed.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ + (Fin.cast hadjoin.1.symm (Fin.last Tn.length)).isLt))) = Tn.vertex j := + hadjoin.2.1.2.1 j + apply incidentFixed + refine ⟨Tn.vertex j, TreeSequenceInitialSegmentVertexSetSubset TnToA + (by simp [TreeSequenceVertexSet]), ?_⟩ + rw [← hadjoin.2.2, Incident, hi] + simp [← hv] + +private theorem helper_edgesFixed_804.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + TreeSequenceInitialSegment Tn B → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + ∀ (t : Fin S.length), TreeIncidentEdge A (S.edge t)) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), S.length ≤ (↑t : ℕ) → sigma (B.edge t) = phi (B.edge t)) → + (∀ (f : E) (seed : TreeSequence G e0), + TreeSequenceAdjoinEdge Tn f seed → sigma f = phi f) → + ∀ (t : Fin B.length), + sigma (B.edge t) = phi (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B sigma + incidentFixed TnToB terminalRoute displayedIncident augmentationFixed seedFixed t + by_cases ht : t.val < Tn.length + · have he := TnToB.2.2 ⟨t.val, ht⟩ + have hi : Fin.castLE TnToB.1 ⟨t.val, ht⟩ = t := Fin.ext rfl + rw [hi] at he + rw [he] + exact incidentFixed _ (displayedIncident Tn TnToA _) + · rcases terminalRoute with ⟨hp, hs⟩ | ⟨hk, f, seed, hedges, hadjoin, hs⟩ + · exact augmentationFixed Tn hs t (by omega) + · by_cases he : t.val = Tn.length + · have hSB := TashkinovAugmentationSequenceInitialSegment phi seed B hs + have hi := hSB.2.2 (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) + have hj : Fin.castLE hSB.1 (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) = t := + Fin.ext (by simpa using he.symm) + rw [hj, hadjoin.2.2] at hi + simpa [hi] using seedFixed f seed hadjoin + · exact augmentationFixed seed hs t (by have := hadjoin.1; omega) + +private theorem helper_routeTransport_823.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + TashkinovAugmentationSequence sigma S B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb segTrans hAib B BToT + sigma missingBefore edgesFixed S hs + unfold TashkinovAugmentationSequence at hs ⊢ + induction hs using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head U W hstep htail ih => + have hWB := TashkinovAugmentationSequenceInitialSegment phi W B htail + obtain ⟨hlen, hUW, c, hcol, hm⟩ := hstep + have hUB := segTrans hUW hWB + have hlt : U.length < B.length := by have := hWB.1; omega + refine Relation.ReflTransGen.head ⟨hlen, hUW, c, ?_, ?_⟩ ih + · have hf := edgesFixed (Fin.castLE hWB.1 (Fin.cast hlen.symm (Fin.last U.length))) + rw [hWB.2.2] at hf + exact hf.trans hcol + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + have hvB := TreeSequenceInitialSegmentVertexSetSubset hUB hv + have hvb : v ≠ vb := by + intro he + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + have ht := hUB.2.1 i + have htT := BToT.2.1 (Fin.castLE (Nat.succ_le_succ hUB.1) i) + have eqv : T.vertex (Fin.castLE (Nat.succ_le_succ BToT.1) + (Fin.castLE (Nat.succ_le_succ hUB.1) i)) = T.vertex ib := htT.trans (ht.trans + (hi.trans he)) + have hh := congrArg Fin.val (T.vertex_injective eqv) + have := i.isLt + change i.val = ib.val at hh + change U.length < ib.val at hlt + omega + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [missingBefore v hvB hvb]; exact hcv⟩ + +private theorem helper_replacement_855.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), StableColoring S D phi sigma) → + StableColoring Tn Dn phi sigma → + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : + TashkinovHierarchy corr.replacementETT baseS), SameHierarchyStages HB HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn Dn ib + vb coreToA hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma + sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport + by_cases hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE + · have closureSubset : TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hPE + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [← hcoreB, u.vertexSet] + exact Finset.mem_union_right _ hv + have hcombined : CombinedStableColoring Tn baseB.closure Dn phi sigma := + ⟨stableTn, stable baseB.closure closureSubset ∅⟩ + have hseq : TashkinovAugmentationSequence sigma Tn B := by + rcases terminalRoute with ⟨_, hs⟩ | ⟨hk, _⟩ + · exact routeTransport Tn hs + · rcases hk with hk | hk <;> rw [hPE] at hk <;> cases hk + exact HierarchySplitter G k e0 input B phi sigma ettB hMPB C.positive + hlower baseB HB hPE hproper hone sigmaProper sigmaOne hcombined hseq + · have hmod : ModColoring ettB sigma := + Td G k e0 input B phi ettB hMPB C.positive hlower sigma sigmaProper sigmaOne + (by simpa only [ettB, ← ett.generatingColoring, n, Tn, Dn] using stableTn) + have hroute : + ((ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B) ∨ + ((ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.SE ∨ + ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ettB.series.data.connectingEdges (Fin.last ettB.rounds) = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed B)) := by + rcases terminalRoute with ⟨hp, _⟩ | ⟨hk, f, seed, hedges, hadjoin, hs⟩ + · exact (hPE hp).elim + · exact Or.inr ⟨hk, f, seed, hedges, hadjoin, routeTransport seed hs⟩ + obtain ⟨corr⟩ := hmod.2.2 B TnToB TnStrictB hroute + have hMP := MaximumPropertyTransport G k e0 ettB sigma hmod B corr hMPB + refine ⟨corr, hMP, ?_⟩ + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ + rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let rep : ExtendedTashkinovTree G k e0 newInput B sigma := + ⟨ett.rounds, rp, newSeries, above, strict, below, gen⟩ + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j + have hkind := hkinds n + let pos : Fin ((newSeries.data.tree n.castSucc).length + 1) := + Fin.cast (congrArg (fun S : TreeSequence G e0 => S.length + 1) htree.symm) + baseB.supportPosition + let baseS : HierarchyBase rep sigma := + { core := baseB.core + closure := baseB.closure + supportPosition := pos + supportPositive := by simpa [pos] using baseB.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only [rep] + intro hp + exact (hPE (hkind.symm.trans hp)).elim + nonparallel := by + dsimp only [rep] + intro hp + exact (baseB.nonparallel hPE).trans htree.symm } + let HS : TashkinovHierarchy rep baseS := + { dividerCount := HB.dividerCount + stage := HB.stage + baseStage := HB.baseStage.trans htree.symm + terminalStage := HB.terminalStage + nested := HB.nested + strict := HB.strict + dividerPosition := HB.dividerPosition + dividerPositive := HB.dividerPositive + dividerIncreasing := HB.dividerIncreasing + dividerStage := HB.dividerStage + coreInsideFirst := HB.coreInsideFirst } + refine ⟨baseS, HS, ?_⟩ + refine ⟨rfl, rfl, HEq.rfl, HEq.rfl, ?_, ?_⟩ + · exact ⟨fun hp => (hPE hp).elim, fun hp => (hPE (hkind.symm.trans hp)).elim⟩ + · intro hp; exact (hPE hp).elim + +private theorem helper_storedS_942.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib vb TnToA hAib B rpB + aboveB strictB belowB genB ettB sigma treeMissingEq corr + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ + rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j + have hm := treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) + unfold Dn TashkinovStoredColors + simp only [ettB, hstored, ← hgen, ← ett.generatingColoring, htree, hm, n, Tn] + +private theorem helper_stageBToB_968.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (j : Fin (HB.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (HB.stage j) B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib segRefl segTrans hAib B rpB + aboveB strictB belowB genB baseB HB j + clear * - HB j B segRefl segTrans + exact Fin.reverseInduction + (motive := fun j => TreeSequenceInitialSegment (HB.stage j) B) + (by simpa only [HB.terminalStage] using segRefl B) + (fun i hi => segTrans (HB.nested i) hi) j + +private theorem helper_closureBToA_975.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib coreToA hAib B rpB aboveB + strictB belowB genB baseB hcoreB hp + clear * - hp baseB coreToA hcoreB + obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hp + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [← hcoreB, u.vertexSet] + exact Finset.mem_union_right _ hv + +private theorem helper_minusEq_983.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb sigma treeMissingEq + incidentFixed S hS D + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [treeMissingEq S hS] + have boundaryEq (c : Fin k) (hc : c ∈ TreeMissingColors phi S) : + BoundaryColorEdges G sigma (TreeSequenceVertexSet S) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet S) c := by + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + apply and_congr_right + intro hf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf + obtain ⟨u, hu, v, hv, he⟩ := hf + have hfix : sigma f = phi f := incidentFixed f ⟨u, hS hu, by simp [Incident, he]⟩ + rw [hfix] + exact ⟨fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).symm.trans (hs c hc), + fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).trans (hs c hc)⟩ + +private theorem helper_storedEq_1020.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + change TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) \ TreeMissingColors sigma (HierarchyStarredStage HS + j) = + Dn \ TreeMissingColors phi (HierarchyStarredStage HB j) + rw [storedS, starEq, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starBToA j))] + +private theorem helper_missingEq_1027.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := + hsbase.symm.trans hbbase + rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] + · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) + +private theorem helper_firstLe_1038.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), + eta ∈ MissingColors G psi (B.vertex i) → + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib hAib B psi eta i hc + clear * - psi eta i hc + let candidates := Finset.univ.filter fun j => eta ∈ MissingColors G psi (B.vertex j) + have hi : i ∈ candidates := by simp [candidates, hc] + have hn : candidates.Nonempty := ⟨i, hi⟩ + simpa [HierarchyFirstMissingPosition, candidates, hn] using + (show (candidates.min' hn).val ≤ i.val from Finset.min'_le candidates i hi) + +private theorem helper_firstStrict_1047.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k), + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib hAib B psi eta h + clear * - psi eta h + unfold HierarchyFirstMissingPosition at h ⊢ + dsimp only at h ⊢ + split_ifs with hn + · exact (Finset.mem_filter.mp (Finset.min'_mem _ hn)).2 + · simp only [dite_eq_right hn, Fin.val_last] at h + omega + +private theorem helper_firstEq_1057.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + (∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), + eta ∈ MissingColors G psi (B.vertex i) → + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ)) → + (∀ (psi : PartialEdgeColoring E k) (eta : Fin k), + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta))) → + ∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B BToT sigma + missingBefore firstLe firstStrict eta + have beforeLast (i : Fin (B.length + 1)) (hi : i.val < B.length) : + MissingColors G sigma (B.vertex i) = MissingColors G phi (B.vertex i) := by + apply missingBefore + · simp [TreeSequenceVertexSet] + · intro he + have heT := (BToT.2.1 i).trans he + have heval := congrArg Fin.val (T.vertex_injective heT) + have hbLen : B.length = ib.val := rfl + change i.val = ib.val at heval + omega + apply Fin.ext + apply Nat.le_antisymm + · by_cases h : (HierarchyFirstMissingPosition phi B eta).val < B.length + · apply firstLe sigma eta + rw [beforeLast _ h] + exact firstStrict phi eta h + · have := (HierarchyFirstMissingPosition sigma B eta).isLt + omega + · by_cases h : (HierarchyFirstMissingPosition sigma B eta).val < B.length + · apply firstLe phi eta + rw [← beforeLast _ h] + exact firstStrict sigma eta h + · have := (HierarchyFirstMissingPosition phi B eta).isLt + omega + +private theorem helper_segmentEq_1084.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + have hedge (t : Fin (stages j.succ).length) : + sigma ((stages j.succ).edge t) = phi ((stages j.succ).edge t) := by + have hSB := stageBToB j.succ + have hf := edgesFixed (Fin.castLE hSB.1 t) + rw [hSB.2.2] at hf + exact hf + unfold HierarchySegmentColors + simp only [starEq, firstEq eta, HS, HB, hedge] + +private theorem helper_refreshEq_1096.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + rw [starEq] + apply Finset.biUnion_congr rfl + intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ) + (Finset.mem_sdiff.mp hv).1) + +private theorem helper_hstarLast_1150.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + rw [starEq] + have hs := (hstagesB (Fin.last count)).2 + have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := + Fin.ext (by simp [q]) + simpa only [hj] using hs + +private theorem helper_pathLe_1162.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let _ : ℕ := T.length - A.length; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + let tailB := B.length - A.length + let candidatesT := (Finset.Icc 1 ell).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + let candidatesB := (Finset.Icc 1 tailB).filter fun i => + ∀ t : Fin B.length, A.length + i ≤ t.val → + G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) + have htail : 1 ≤ tailB := by dsimp [tailB]; omega + have htailT : 1 ≤ ell := by dsimp [ell]; omega + have htmem : ell ∈ candidatesT := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htailT, le_rfl⟩, ?_⟩ + intro t ht + have hAT := AToT.1 + have := t.isLt + dsimp [ell] at ht + omega + have hbmem : tailB ∈ candidatesB := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htail, le_rfl⟩, ?_⟩ + intro t ht + have := t.isLt + dsimp [tailB] at ht + omega + have hnT : candidatesT.Nonempty := ⟨ell, htmem⟩ + have hnB : candidatesB.Nonempty := ⟨tailB, hbmem⟩ + have hmT := Finset.min'_mem candidatesT hnT + have hbounds := Finset.mem_Icc.mp (Finset.mem_filter.mp hmT).1 + have hminB : candidatesB.min' hnB ≤ candidatesT.min' hnT := by + by_cases ht : candidatesT.min' hnT ≤ tailB + · apply Finset.min'_le + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hbounds.1, ht⟩, ?_⟩ + intro t hpos + have he := (Finset.mem_filter.mp hmT).2 (Fin.castLE BToT.1 t) hpos + have hv0 := BToT.2.1 t.castSucc + have hv1 := BToT.2.1 t.succ + have hi0 : (Fin.castLE BToT.1 t).castSucc = + Fin.castLE (Nat.succ_le_succ BToT.1) t.castSucc := Fin.ext rfl + have hi1 : (Fin.castLE BToT.1 t).succ = + Fin.castLE (Nat.succ_le_succ BToT.1) t.succ := Fin.ext rfl + simpa only [BToT.2.2, hi0, hi1, hv0, hv1] using he + · exact le_trans (Finset.min'_le candidatesB tailB hbmem) (by omega) + unfold HierarchyPathNumber + rw [hstarLast] + change (if h : candidatesB.Nonempty then candidatesB.min' h else tailB) ≤ + (if h : candidatesT.Nonempty then candidatesT.min' h else ell) + rw [dite_eq_left hnB, dite_eq_left hnT] + exact hminB + +private theorem helper_hinter_3043.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + alpha ∈ TreeMissingColors phi A → + TreeColorSetClosed G phi A ({ alpha } : Finset (Fin k)) → + TreeInterchangeable G A phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge alpha beta + hne H q A n Tn Dn lastZero lastPositive halphaA halphaClosed + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact @helper_branch_392 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@alpha) (@beta) (@lastZero) (@halphaA) (@halphaClosed) (@hz) (@hp) + · exact @helper_branch_399 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@alpha) (@beta) (@lastZero) (@halphaA) (@hz) (@hp) + · exact @helper_branch_481 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) + (@hfewer) (@hlarge) (@alpha) (@beta) (@hne) (@lastPositive) (@halphaA) (@halphaClosed) (@hz) + +private theorem helper_replacement_3186.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), StableColoring S D phi sigma) → + StableColoring Tn Dn phi sigma → + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : + TashkinovHierarchy corr.replacementETT baseS), SameHierarchyStages HB HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn Dn ib + vb coreToA hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma + sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport + exact @helper_replacement_855 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) + (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) + (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) + +private theorem helper_storedEq_3248.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact @helper_storedEq_1020 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) + (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +private theorem helper_missingEq_3257.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + exact @helper_missingEq_1027 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@j) + +private theorem helper_segmentEq_3284.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + exact @helper_segmentEq_1084 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + +private theorem helper_refreshEq_3294.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + exact @helper_refreshEq_1096 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@i) + +private theorem helper_hstarLast_3349.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + exact @helper_hstarLast_1150 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) + (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) + (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) (@hspositive) + (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) + (@starEq) + +private theorem helper_pathLe_3363.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + exact @helper_pathLe_1162 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) + (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) + (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) + (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) + +private theorem helper_replacement_4227.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), StableColoring S D phi sigma) → + StableColoring Tn Dn phi sigma → + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : + TashkinovHierarchy corr.replacementETT baseS), SameHierarchyStages HB HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn Dn ib + vb coreToA hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma + sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport + exact @helper_replacement_3186 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) + (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) + (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) + +private theorem helper_storedEq_4289.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact @helper_storedEq_3248 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) + (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +private theorem helper_missingEq_4298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + exact @helper_missingEq_3257 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@j) + +private theorem helper_segmentEq_4325.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + exact @helper_segmentEq_3284 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + +private theorem helper_refreshEq_4335.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + exact @helper_refreshEq_3294 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@i) + +private theorem helper_hstarLast_4390.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + exact @helper_hstarLast_3349 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) + (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) + (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) (@hspositive) + (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) + (@starEq) + +private theorem helper_pathLe_4404.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + exact @helper_pathLe_3363 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) + (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) + (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) + (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) + +private theorem helper_continuation_5185.{u_1, u_2} : + helperContinuation5185Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hminimal alpha beta hne H q A n Tn Dn ib vb + coreToA TnToA AToT ordinaryToA hAib B BToT ABstrict BstrictT rpB aboveB strictB belowB genB + baseB hcoreB HB hcountB hstagesB hdividersB goodB hgoodB ettB sigma missingBefore + sigmaNotElementary missingA treeMissingEq incidentFixed edgesFixed corr hMPS baseS HS hsame + storedS hrS stageBToA starBToA stageBToB + have closureBToA (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + exact @helper_closureBToA_975 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@hcoreB) (@hp) + have minusEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) (D : Finset (Fin k)) : + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D := by + exact @helper_minusEq_983 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@treeMissingEq) (@incidentFixed) (@S) (@hS) (@D) + rcases HB with ⟨count, stages, hbbase, hbterminal, hbnested, hbstrict, positions, + hbpositive, hbincreasing, hbdivider, hbcore⟩ + rcases HS with ⟨countS, stagesS, hsbase, hsterminal, hsnested, hsstrict, positionsS, + hspositive, hsincreasing, hsdivider, hscore⟩ + rcases hsame with ⟨hcore, hcount, hstages, hpositions, hpe, hclosure⟩ + dsimp only at hcount hstages hpositions + cases hcount + have hstage : stages = stagesS := eq_of_heq hstages + cases hstage + let HB : TashkinovHierarchy ettB baseB := + ⟨count, stages, hbbase, hbterminal, hbnested, hbstrict, positions, + hbpositive, hbincreasing, hbdivider, hbcore⟩ + let HS : TashkinovHierarchy corr.replacementETT baseS := + ⟨count, stages, hsbase, hsterminal, hsnested, hsstrict, positionsS, + hspositive, hsincreasing, hsdivider, hscore⟩ + have starEq (j : Fin (count + 1)) : + HierarchyStarredStage HS j = HierarchyStarredStage HB j := by + exact Fin.cases hcore.symm (fun i => rfl) j + have storedEq (j : Fin (count + 1)) : + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + exact @helper_storedEq_4289 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) + (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + have missingEq (j : Fin (count + 1)) : + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + exact @helper_missingEq_4298 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@j) + -- A change only at the last vertex leaves the totalized first position unchanged. + have firstLe (psi : PartialEdgeColoring E k) (eta : Fin k) + (i : Fin (B.length + 1)) (hc : eta ∈ MissingColors G psi (B.vertex i)) : + (HierarchyFirstMissingPosition psi B eta).val ≤ i.val := by + exact @helper_firstLe_1038 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@psi) + (@eta) (@i) (@hc) + have firstStrict (psi : PartialEdgeColoring E k) (eta : Fin k) + (h : (HierarchyFirstMissingPosition psi B eta).val < B.length) : + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by + exact @helper_firstStrict_1047 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@psi) (@eta) (@h) + have firstEq (eta : Fin k) : + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by + exact @helper_firstEq_1057 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@BToT) + (@missingBefore) (@firstLe) (@firstStrict) (@eta) + have segmentEq (j : Fin (count + 1)) (eta : Fin k) + (he : eta ∈ HierarchyStoredColorsAt HB j) : + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + exact @helper_segmentEq_4325 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + have refreshEq (i : Fin count) : + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun v => MissingColors G phi v) := by + exact @helper_refreshEq_4335 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@i) + let goodS : GoodHierarchy HS := + { gamma := goodB.gamma + twoColors := by intro j eta he; exact goodB.twoColors j eta (storedEq j ▸ he) + avoidance := by + intro j eta he + rw [missingEq, segmentEq j eta (storedEq j ▸ he)] + exact goodB.avoidance j eta (storedEq j ▸ he) + disjointPairs := by + intro j eta theta he ht hne + exact goodB.disjointPairs j eta theta (storedEq j ▸ he) (storedEq j ▸ ht) hne + uniqueRefresh := by + intro i + simpa only [storedEq, refreshEq] using goodB.uniqueRefresh i + parallelBase := by + dsimp only + intro hp + have hpOld := hpe.mpr hp + have hc := hclosure hpOld + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := hsbase.symm.trans hbbase + change ¬TreeColorSetMinusClosed G sigma baseS.core + ((HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)) ∧ + 4 ≤ ((TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseS.closure) \ + (HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)).card + rw [← hcore, ← hc, storedEq, htree, + treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA), + treeMissingEq _ (closureBToA hpOld), + minusEq _ (by rw [hcoreB]; exact TreeSequenceInitialSegmentVertexSetSubset coreToA)] + exact goodB.parallelBase hpOld + minusClosed := by + intro i + rw [storedEq, minusEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ))] + exact goodB.minusClosed i } + let CS : HierarchyCounterexample baseS := + { positive := by rw [hrS]; exact C.positive + hierarchy := HS + good := goodS + maximum := hMPS + notElementary := sigmaNotElementary } + have hstarLast : HierarchyStarredStage HS (Fin.last count) = A := by + exact @helper_hstarLast_4390 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) + (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) + (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) (@hspositive) + (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) + (@starEq) + have hlastOrd : HS.stage (Fin.last count).castSucc = H.stage q.castSucc := by + have hs := (hstagesB (Fin.last count)).1 + have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := + Fin.ext (by simp [q]) + simpa only [hj] using hs + -- Path candidates restrict to the shorter prefix; the second measure decreases strictly. + have pathLe : HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + exact @helper_pathLe_4404 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) + (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) + (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) + (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) + have tailLess : B.length - (HS.stage (Fin.last count).castSucc).length < + T.length - (H.stage q.castSucc).length := by + clear * - hlastOrd ordinaryToA BstrictT ABstrict AToT + rw [hlastOrd] + have hlen := (ordinaryToA q).1 + omega + have hless : HierarchyCounterexampleLess (HierarchyCounterexampleMeasure CS) + (HierarchyCounterexampleMeasure C) := by + change HierarchyPathNumber HS < HierarchyPathNumber H ∨ + (HierarchyPathNumber HS = HierarchyPathNumber H ∧ + B.length - (HS.stage (Fin.last count).castSucc).length < + T.length - (H.stage q.castSucc).length) + rcases lt_or_eq_of_le pathLe with hlt | heq + · exact Or.inl hlt + · exact Or.inr ⟨heq, tailLess⟩ + exact hminimal CS hrS hcountB hless + +private theorem helper_continuation_5094.{u_1, u_2} : + helperContinuation5094Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hminimal alpha beta hne H q + A n Tn Dn ia ib va vb ell yLength Y segRefl segTrans commonPrefix coreToA TnToA AToT + ordinaryToA starredToA hElementaryY ha hb vertexY hbY hout hAib horder havb B BToT AToB + ABstrict BstrictT rpB aboveB strictB belowB genB hMPB baseB hcoreB HB hcountB hstagesB + hdividersB goodB hgoodB ettB K sigma avoidA behavior fixedValue sigmaProper sigmaOne haB + hbB missingBefore hnewa + have hnewb : alpha ∈ MissingColors G sigma vb := + behavior.2.2.1 vb (show Sum.inl vb ∈ K from rfl) hb.1 + have sigmaNotElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := + fun he => Finset.disjoint_left.mp (he haB hbB havb) hnewa hnewb + have missingA (v : V) (hv : v ∈ TreeSequenceVertexSet A) : + MissingColors G sigma v = MissingColors G phi v := + missingBefore v (TreeSequenceInitialSegmentVertexSetSubset AToB hv) + (by intro he; exact hout.2 (he ▸ hv)) + have treeMissingEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) : + TreeMissingColors sigma S = TreeMissingColors phi S := by + clear * - hS missingA + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => missingA v (hS hv)) + have incidentFixed (f : E) (hf : TreeIncidentEdge A f) : sigma f = phi f := by + exact @helper_incidentFixed_651 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@ha) (@hb) (@avoidA) (@fixedValue) (@f) (@hf) + have stable (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) + (D : Finset (Fin k)) : StableColoring S D phi sigma := by + exact @helper_stable_667 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@missingA) + (@incidentFixed) (@S) (@hS) (@D) + have stableTn : StableColoring Tn Dn phi sigma := + stable Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) Dn + have TnToB := segTrans TnToA AToB + have TnStrictB : Tn.length < B.length := lt_of_le_of_lt TnToA.1 ABstrict + have BToFinal := segTrans BToT ett.belowFinal + -- Nonparallel extensions retain the certified connecting edge and one-edge seed. + have terminalRoute : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed B) := by + exact @helper_terminalRoute_680 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@commonPrefix) (@hAib) (@TnToB) (@TnStrictB) (@BToFinal) + have displayedIncident (S : TreeSequence G e0) + (hSA : TreeSequenceInitialSegment S A) (t : Fin S.length) : + TreeIncidentEdge A (S.edge t) := by + exact @helper_displayedIncident_729 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@S) (@hSA) (@t) + have augmentationFixed (S : TreeSequence G e0) + (hseq : TashkinovAugmentationSequence phi S B) (t : Fin B.length) + (ht : S.length ≤ t.val) : sigma (B.edge t) = phi (B.edge t) := by + exact @helper_augmentationFixed_737 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@segRefl) (@hElementaryY) (@hb) (@vertexY) (@hbY) (@hAib) (@horder) (@BToT) (@AToB) + (@fixedValue) (@incidentFixed) (@displayedIncident) (@S) (@hseq) (@t) (@ht) + have seedFixed (f : E) (seed : TreeSequence G e0) + (hadjoin : TreeSequenceAdjoinEdge Tn f seed) : sigma f = phi f := by + exact @helper_seedFixed_790 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@TnToA) + (@incidentFixed) (@f) (@seed) (@hadjoin) + have edgesFixed (t : Fin B.length) : sigma (B.edge t) = phi (B.edge t) := by + exact @helper_edgesFixed_804 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@TnToA) (@hAib) (@incidentFixed) (@TnToB) (@terminalRoute) (@displayedIncident) + (@augmentationFixed) (@seedFixed) (@t) + have routeTransport (S : TreeSequence G e0) (hs : TashkinovAugmentationSequence phi S B) : + TashkinovAugmentationSequence sigma S B := by + exact @helper_routeTransport_823 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@segTrans) (@hAib) (@BToT) (@missingBefore) (@edgesFixed) (@S) (@hs) + have replacement : + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B, + MaximumProperty corr.replacementETT ∧ + ∃ baseS : HierarchyBase corr.replacementETT sigma, + ∃ HS : TashkinovHierarchy corr.replacementETT baseS, + SameHierarchyStages HB HS := by + exact @helper_replacement_4227 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) + (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) + (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) + obtain ⟨corr, hMPS, baseS, HS, hsame⟩ := replacement + have storedS : TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = Dn := by + exact @helper_storedS_942 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@TnToA) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@treeMissingEq) (@corr) + have hrS : corr.replacementETT.rounds = ett.rounds := corr.rungAgreement + have stageBToA (j : Fin (HB.dividerCount + 1)) : + TreeSequenceInitialSegment (HB.stage j.castSucc) A := by + clear * - hstagesB ordinaryToA j + rw [(hstagesB j).1] + exact ordinaryToA _ + have starBToA (j : Fin (HB.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage HB j) A := by + clear * - hstagesB starredToA j + rw [(hstagesB j).2] + exact starredToA _ + have stageBToB (j : Fin (HB.dividerCount + 2)) : + TreeSequenceInitialSegment (HB.stage j) B := by + exact @helper_stageBToB_968 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@segRefl) + (@segTrans) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@HB) (@j) + exact @helper_continuation_5185 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hminimal) (@alpha) + (@beta) (@hne) (@coreToA) (@TnToA) (@AToT) (@ordinaryToA) (@hAib) (@BToT) (@ABstrict) + (@BstrictT) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@hcoreB) (@HB) + (@hcountB) (@hstagesB) (@hdividersB) (@goodB) (@hgoodB) (@missingBefore) + (@sigmaNotElementary) (@missingA) (@treeMissingEq) (@incidentFixed) (@edgesFixed) (@corr) + (@hMPS) (@baseS) (@HS) (@hsame) (@storedS) (@hrS) (@stageBToA) (@starBToA) (@stageBToB) +private theorem helper_continuation_5074.{u_1, u_2} : + helperContinuation5074Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge + alpha beta hne horderedUnused hbranch H q A n Tn Dn ia ib va vb ell yLength Y segRefl + segTrans commonPrefix lastZero lastPositive coreToA TnToA AToT ordinaryToA starredToA YToT + hElementaryY ha hb vertexY haY hbY hout hAib missingNotA + have halphaA : alpha ∈ TreeMissingColors phi A := hbranch.1 + have halphaClosed : TreeColorSetClosed G phi A {alpha} := hbranch.2 + have hbetaA : beta ∉ TreeMissingColors phi A := missingNotA beta ib hb.1 hbY hout.2 + have horder := horderedUnused (Or.inr hbetaA) + have habIndex : ia.val < ib.val := by + exact @helper_habIndex_350 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@horder) + have havb : va ≠ vb := by + clear * - habIndex + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + omega + -- Keep the exact ordered prefix ending at the beta-missing vertex. + let B := TreeSequencePrefix T ib.val (by have := A.positive; omega) + (Nat.le_of_lt_succ ib.isLt) + have BToT : TreeSequenceInitialSegment B T := + ⟨Nat.le_of_lt_succ ib.isLt, (by intro i; rfl), (by intro i; rfl)⟩ + have AToB : TreeSequenceInitialSegment A B := commonPrefix AToT BToT (by exact le_of_lt hAib) + have ABstrict : A.length < B.length := hAib + have BToY : TreeSequenceInitialSegment B Y := commonPrefix BToT YToT hb.2 + have BstrictT : B.length < T.length := by + exact @helper_BstrictT_369 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) + (@ABstrict) (@BToY) + obtain ⟨ettB, hMPB, hrB, hsB, baseB, hcoreB, hclosureB, hsupportB, + HB, hcountB, hstagesB, hdividersB, goodB, hgoodB⟩ := + GoodHierarchyTerminalPrefixRepackage G k e0 input T phi phi ett C.maximum + base H C.good B AToB ABstrict BToT + rcases ettB with ⟨rB, rpB, seriesB, aboveB, strictB, belowB, genB⟩ + cases hrB + have heqB : seriesB = ett.series := eq_of_heq hsB + cases heqB + let ettB : ExtendedTashkinovTree G k e0 input B phi := + ⟨ett.rounds, rpB, ett.series, aboveB, strictB, belowB, genB⟩ + have hinter : TreeInterchangeable G A phi alpha beta := by + exact @helper_hinter_3043 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) + (@hfewer) (@hlarge) (@alpha) (@beta) (@hne) (@lastZero) (@lastPositive) (@halphaA) + (@halphaClosed) + refine ⟨?_, hinter⟩ + by_contra hcomponents + let K := TwoColorComponent G phi alpha beta (Sum.inl vb) + let sigma := TwoColorComponentSwap G phi alpha beta (Sum.inl vb) + have pathMissing (v : V) (c d : Fin k) (hcd : c ≠ d) + (hc : c ∈ MissingColors G phi v) : + TwoColorPathComponent G phi c d (Sum.inl v) := by + exact @helper_pathMissing_495 (@V) (@E) inferInstance inferInstance (@G) (@k) + (@phi) (@hproper) (@v) (@c) (@d) (@hcd) (@hc) + have pathA : TwoColorPathComponent G phi alpha beta (Sum.inl va) := + pathMissing va alpha beta hne ha.1 + have pathB : TwoColorPathComponent G phi alpha beta (Sum.inl vb) := by + exact @helper_pathB_520 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@alpha) (@beta) + (@hne) (@hb) + have avoidA (v : V) (hv : v ∈ TreeSequenceVertexSet A) : Sum.inl v ∉ K := by + clear * - hcomponents hinter hout pathA pathB K hv + intro hK + exact hcomponents (hinter _ _ pathA pathB ⟨va, hout.1, rfl⟩ ⟨v, hv, hK⟩) + have haK : Sum.inl va ∉ K := avoidA va hout.1 + have behavior := TwoColorComponentSwapMissingBehavior G phi alpha beta hne hproper + (Sum.inl vb) + have edgeOfVertex {v : V} {f : E} (hv : Sum.inl v ∈ K) + (hf : Incident G v f) (hc : phi f = some alpha ∨ phi f = some beta) : + Sum.inr f ∈ K := by + clear * - hv hf hc K + have hadj : (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inr f) (Sum.inl v) := + ⟨hf, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv + have unaffected (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + sigma f = some c ↔ phi f = some c := by + exact @helper_unaffected_555 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@ha) (@hb) (@f) (@c) (@hca) (@hcb) + have fixedValue (f : E) (ha : phi f ≠ some alpha) (hb : phi f ≠ some beta) : + sigma f = phi f := by + clear * - ha hb sigma + simp [sigma, TwoColorComponentSwap, ha, hb] + have sigmaProper : IsProperEdgeColoring G sigma := + TwoColorComponentSwapProper G phi alpha beta hne hproper _ + have sigmaOne : IsOneEdgeUncolored sigma e0 := by + exact @helper_sigmaOne_572 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hone) (@alpha) (@beta) (@hne) + (@ha) (@hb) (@unaffected) + have vertexB (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : + T.vertex i ∈ TreeSequenceVertexSet B := by + clear * - i hi B + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have haB : va ∈ TreeSequenceVertexSet B := vertexB ia (le_of_lt habIndex) + have hbB : vb ∈ TreeSequenceVertexSet B := vertexB ib le_rfl + -- Elementarity fixes missing sets before the swapped endpoint, even inside its component. + have missingBefore (v : V) (hv : v ∈ TreeSequenceVertexSet B) (hvb : v ≠ vb) : + MissingColors G sigma v = MissingColors G phi v := by + exact @helper_missingBefore_597 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@hElementaryY) (@ha) (@hb) (@haY) (@hbY) (@hAib) (@BToY) (@haK) (@behavior) + (@edgeOfVertex) (@v) (@hv) (@hvb) + have hnewa : alpha ∈ MissingColors G sigma va := by + rw [behavior.1 va haK] + exact ha.1 + exact @helper_continuation_5094 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hminimal) (@alpha) (@beta) (@hne) (@segRefl) (@segTrans) (@commonPrefix) + (@coreToA) (@TnToA) (@AToT) (@ordinaryToA) (@starredToA) (@hElementaryY) (@ha) (@hb) + (@vertexY) (@hbY) (@hout) (@hAib) (@horder) (@havb) (@BToT) (@AToB) (@ABstrict) (@BstrictT) + (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@hcountB) + (@hstagesB) (@hdividersB) (@goodB) (@hgoodB) (@avoidA) (@behavior) (@fixedValue) + (@sigmaProper) (@sigmaOne) (@haB) (@hbB) (@missingBefore) (@hnewa) +theorem ChangeLemmaMixedClosedFinal {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty) + (horderedUnused : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + (alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c)) + (hlocation : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + va ∈ TreeSequenceVertexSet A ∧ + vb ∉ TreeSequenceVertexSet A) + (hbranch : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + alpha ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A {alpha}) + : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let sameComponent := + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) + sameComponent ∧ TreeInterchangeable G A phi alpha beta := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + let va := T.vertex ia + let vb := T.vertex ib + let ell := T.length - A.length + let yLength := min (A.length + (ell - 1)) T.length + let Y := TreeSequencePrefix T yLength + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have segRefl (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + exact @helper_segTrans_199 (@V) (@E) (@G) (@e0) (@S) (@U) (@W) (@hSU) (@hUW) + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + exact @helper_commonPrefix_209 (@V) (@E) (@G) (@e0) (@S) (@U) (@W) (@hSW) (@hUW) (@hlen) + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + exact @helper_stageSegment_219 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@segRefl) + (@segTrans) (@a) (@d) (@hbound) + have stageToT (j : Fin (H.dividerCount + 2)) : + TreeSequenceInitialSegment (H.stage j) T := by + exact @helper_stageToT_227 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@stageSegment) (@j) + have lastZero (hz : H.dividerCount = 0) : A = base.core := by + clear * - hz A q + simp [A, q, HierarchyStarredStage, hz, Fin.last] + have lastPositive (hz : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact @helper_lastPositive_238 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hz) + have coreToA : TreeSequenceInitialSegment base.core A := by + exact @helper_coreToA_250 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@segRefl) (@segTrans) + (@stageSegment) (@lastZero) (@lastPositive) + have TnToCore : TreeSequenceInitialSegment Tn base.core := by + exact @helper_TnToCore_259 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@segRefl) + have TnToA := segTrans TnToCore coreToA + have AToT : TreeSequenceInitialSegment A T := by + exact @helper_AToT_266 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@segTrans) (@stageToT) (@lastZero) + (@lastPositive) + have ordinaryToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + exact @helper_ordinaryToA_273 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@stageSegment) + (@lastZero) (@lastPositive) (@TnToA) (@j) + have starredToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + exact Fin.cases coreToA (fun i => ordinaryToA i.succ) j + have YToT : TreeSequenceInitialSegment Y T := + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + have hmissingY : alpha ∈ TreeMissingColors phi Y ∧ beta ∈ TreeMissingColors phi Y := + hmissingPrefix + have hElementaryY : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) := + hprefixElementary + have firstMissing (c : Fin k) (hc : c ∈ TreeMissingColors phi Y) : + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (HierarchyFirstMissingPosition phi T c).val ≤ Y.length := by + exact @helper_firstMissing_293 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@YToT) (@c) (@hc) + have ha := firstMissing alpha hmissingY.1 + have hb := firstMissing beta hmissingY.2 + have vertexY (i : Fin (T.length + 1)) (hi : i.val ≤ Y.length) : + T.vertex i ∈ TreeSequenceVertexSet Y := by + clear * - i hi Y + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have haY : va ∈ TreeSequenceVertexSet Y := vertexY ia ha.2 + have hbY : vb ∈ TreeSequenceVertexSet Y := vertexY ib hb.2 + have hout : va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A := hlocation + have outsideIndex (i : Fin (T.length + 1)) + (hi : T.vertex i ∉ TreeSequenceVertexSet A) : A.length < i.val := by + exact @helper_outsideIndex_325 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@AToT) (@i) (@hi) + have hAib := outsideIndex ib hout.2 + have AToY : TreeSequenceInitialSegment A Y := + commonPrefix AToT YToT (by omega) + have missingNotA (c : Fin k) (i : Fin (T.length + 1)) + (hmi : c ∈ MissingColors G phi (T.vertex i)) + (hiy : T.vertex i ∈ TreeSequenceVertexSet Y) + (hia : T.vertex i ∉ TreeSequenceVertexSet A) : c ∉ TreeMissingColors phi A := by + exact @helper_missingNotA_336 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@hElementaryY) (@AToY) (@c) (@i) (@hmi) (@hiy) (@hia) + exact @helper_continuation_5074 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hfewer) (@hminimal) (@hlarge) (@alpha) (@beta) (@hne) (@horderedUnused) + (@hbranch) (@segRefl) (@segTrans) (@commonPrefix) (@lastZero) (@lastPositive) (@coreToA) + (@TnToA) (@AToT) (@ordinaryToA) (@starredToA) (@YToT) (@hElementaryY) (@ha) (@hb) + (@vertexY) (@haY) (@hbY) (@hout) (@hAib) (@missingNotA) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean new file mode 100644 index 0000000000..9ccb1a37b9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean @@ -0,0 +1,8794 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess + +public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction + +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition + +/-! +# Change Lemma Mixed Largest Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation4549Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (by have := A.positive; have := T.positive; omega) (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A) → + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + (0 : ℕ) < H.dividerCount → + (↑r : ℕ) < H.dividerCount → + TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → + (∀ (s : Fin (H.dividerCount + (1 : ℕ))), + (↑r : ℕ) < (↑s : ℕ) → + ¬TreeColorSetClosed G phi (HierarchyStarredStage H s) + ({ alpha } : Finset (Fin k))) → + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let _ : V := T.vertex ia; + let _ : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + ((↑r : ℕ) = (0 : ℕ) → R = base.core) → + ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → + TreeSequenceInitialSegment R A → + TreeSequenceInitialSegment base.core R → + TreeSequenceInitialSegment Tn R → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≤ (↑r : ℕ) → + TreeSequenceInitialSegment (H.stage j.castSucc) R) → + TreeSequenceInitialSegment Y T → + alpha ∈ TreeMissingColors phi Y ∧ + beta ∈ TreeMissingColors phi Y → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + (∀ c ∈ TreeMissingColors phi Y, + c ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let _ : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := + T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := + T.vertex (HierarchyFirstMissingPosition phi T beta); + let sameComponent : Prop := + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb); + sameComponent + +private abbrev helperContinuation4559Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (x : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + (0 : ℕ) < H.dividerCount → + (↑r : ℕ) < H.dividerCount → + TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → + (∀ (s : Fin (H.dividerCount + (1 : ℕ))), + (↑r : ℕ) < (↑s : ℕ) → + ¬TreeColorSetClosed G phi (HierarchyStarredStage H s) + ({ alpha } : Finset (Fin k))) → + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + ((↑r : ℕ) = (0 : ℕ) → R = base.core) → + ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → + TreeSequenceInitialSegment R A → + TreeSequenceInitialSegment base.core R → + TreeSequenceInitialSegment Tn R → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≤ (↑r : ℕ) → + TreeSequenceInitialSegment (H.stage j.castSucc) R) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + va ∈ TreeSequenceVertexSet Y → + vb ∈ TreeSequenceVertexSet Y → + va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A → + ∀ (hAib : A.length < (↑ib : ℕ)), + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑r : ℕ) ≤ (↑j : ℕ) → + alpha ∈ + TreeMissingColors phi (HierarchyStarredStage H j)) → + alpha ∈ TreeMissingColors phi R → + va ∈ TreeSequenceVertexSet R → + alpha ∉ + ({c : Fin k | + ∃ (t : Fin A.length), + R.length ≤ (↑t : ℕ) ∧ phi (A.edge t) = some c} : + Finset (Fin k)) → + beta ∉ TreeMissingColors phi A → + TreeVertexOrder T + (T.vertex + (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex + (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < + (↑(HierarchyFirstMissingPosition phi T beta) : + ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + (↑ia : ℕ) < (↑ib : ℕ) → + va ≠ vb → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A B → + A.length < B.length → + TreeSequenceInitialSegment B Y → + B.length < T.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.1, by omega⟩ : + Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree + (Fin.last (ett.1 + (1 : ℕ))))) + (genB : + phi = + ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { + rounds := ett.1, roundsPositive := rpB, + series := ett.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { + rounds := ett.1, roundsPositive := rpB, + series := ett.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, + series := ett.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B + phi } + baseB) + (hcountB : + HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : + Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (by + have := + GoldbergSeymour.TreeSequence.positive + T + have := + GoldbergSeymour.TreeSequence.positive + A + have := + GoldbergSeymour.TreeSequence.positive + B + omega) + j; + HB.stage j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage HB j = + HierarchyStarredStage H jo) → + (∀ (i : Fin HB.dividerCount), + (↑(HB.dividerPosition i) : ℕ) = + (↑(H.dividerPosition + (Fin.cast hcountB i)) : + ℕ)) → + ∀ (goodB : GoodHierarchy HB), + (∀ + (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : + Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (by + have := + GoldbergSeymour.TreeSequence.positive + T + have := + GoldbergSeymour.TreeSequence.positive + A + have := + GoldbergSeymour.TreeSequence.positive + B + omega) + j; + HierarchyStoredColorsAt HB j = + HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HB j = + HierarchyStageMissingColors H jo ∧ + ∀ (eta : Fin k), + goodB.gamma j eta = + C.good.gamma jo eta ∧ + HierarchySegmentColors HB j eta ⊆ + HierarchySegmentColors H jo + eta) → + let ettB : + ExtendedTashkinovTree G k e0 input B + phi := + { + rounds := ett.rounds, + roundsPositive := rpB, + series := ett.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B + phi }; + let H : TashkinovHierarchy ett base := + C.hierarchy; + let q : + Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let x : TreeSequence G e0 := + HierarchyStarredStage H q; + let va : V := + T.vertex + (HierarchyFirstMissingPosition phi T + alpha); + let vb : V := + T.vertex + (HierarchyFirstMissingPosition phi T + beta); + let sameComponent : Prop := + TwoColorComponent G phi alpha beta + (Sum.inl va) = + TwoColorComponent G phi alpha beta + (Sum.inl vb); + sameComponent + +private abbrev helperHstarLast5324Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt beta + have := Fin.isLt ib + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + have := Fin.isLt i + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := Fin.isLt beta + have := Fin.isLt q + have := Fin.isLt ib + have := Fin.isLt i + have := aboveB.1 + have := belowB.1 + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := Fin.isLt beta + have := Fin.isLt q + have := Fin.isLt ib + have := aboveB.1 + have := belowB.1 + have := hbcore.1 + omega) + j; + { dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + have := Fin.isLt i + have := hbcore.1 + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := Fin.isLt beta + have := Fin.isLt q + have := Fin.isLt ib + have := Fin.isLt i + have := aboveB.1 + have := belowB.1 + have := hbcore.1 + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + have := hbcore.1 + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, + dividerStage := hsdivider, coreInsideFirst := hscore : + TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A + +private abbrev helperContinuation5082Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + (∀ (s : Fin (H.dividerCount + (1 : ℕ))), + (↑r : ℕ) < (↑s : ℕ) → + ¬TreeColorSetClosed G phi (HierarchyStarredStage H s) ({ alpha } : Finset (Fin k))) → + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬yLength ≤ T.length) ↦ by omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + TreeSequenceInitialSegment R A → + TreeSequenceInitialSegment base.core R → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≤ (↑r : ℕ) → TreeSequenceInitialSegment (H.stage j.castSucc) R) → + beta ∈ + MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + ∀ (hAib : A.length < (↑ib : ℕ)), + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑r : ℕ) ≤ (↑j : ℕ) → + alpha ∈ TreeMissingColors phi (HierarchyStarredStage H j)) → + beta ∉ TreeMissingColors phi A → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(↑ib : ℕ) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + B.length < T.length → + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (hcountB : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction + fun (a : ¬HB.dividerCount + (1 : ℕ) = H.dividerCount + (1 : ℕ)) ↦ + by omega) + j; + HB.stage j.castSucc = H.stage jo.castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H jo) → + (∀ (i : Fin HB.dividerCount), + (↑(HB.dividerPosition i) : ℕ) = + (↑(H.dividerPosition (Fin.cast hcountB i)) : ℕ)) → + ∀ (goodB : GoodHierarchy HB), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction + fun + (a : ¬HB.dividerCount + (1 : ℕ) = H.dividerCount + (1 : ℕ)) ↦ + by omega) + j; + HierarchyStoredColorsAt HB j = HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HB j = + HierarchyStageMissingColors H jo ∧ + ∀ (eta : Fin k), + goodB.gamma j eta = C.good.gamma jo eta ∧ + HierarchySegmentColors HB j eta ⊆ + HierarchySegmentColors H jo eta) → + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, + series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E) (c : Fin k), + c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT → + ∀ (baseS : HierarchyBase corr.replacementETT sigma) + (HS : TashkinovHierarchy corr.replacementETT baseS), + SameHierarchyStages HB HS → + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + False + +private abbrev helperPathLe3869Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) + (belowB : TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : + TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H + +private abbrev helperStoredEq5179Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt beta + have := Fin.isLt ib + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + have := Fin.isLt i + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := Fin.isLt beta + have := Fin.isLt q + have := Fin.isLt ib + have := Fin.isLt i + have := aboveB.1 + have := belowB.1 + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + have := Fin.isLt i + have := hbcore.1 + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := Fin.isLt beta + have := Fin.isLt q + have := Fin.isLt ib + have := Fin.isLt i + have := aboveB.1 + have := belowB.1 + have := hbcore.1 + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + have := hbcore.1 + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j + +private abbrev helperSegmentEq5215Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt beta + have := Fin.isLt ib + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + have := Fin.isLt i + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := Fin.isLt beta + have := Fin.isLt q + have := Fin.isLt ib + have := Fin.isLt i + have := aboveB.1 + have := belowB.1 + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + have := Fin.isLt i + have := hbcore.1 + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := Fin.isLt beta + have := Fin.isLt q + have := Fin.isLt ib + have := Fin.isLt i + have := aboveB.1 + have := belowB.1 + have := hbcore.1 + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + have := hbcore.1 + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : + TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta + +private abbrev helperRefreshEq5225Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt beta + have := Fin.isLt ib + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + have := Fin.isLt i + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := Fin.isLt beta + have := Fin.isLt q + have := Fin.isLt ib + have := Fin.isLt i + have := aboveB.1 + have := belowB.1 + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + have := Fin.isLt i + have := hbcore.1 + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := Fin.isLt beta + have := Fin.isLt q + have := Fin.isLt ib + have := Fin.isLt i + have := aboveB.1 + have := belowB.1 + have := hbcore.1 + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + have := hbcore.1 + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : + TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v + +private abbrev helperMissingEq5953Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j + +private abbrev helperPathLe6085Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : + TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H + +private abbrev helperParallelBase6126Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (TnToA : TreeSequenceInitialSegment Tn A) (coreToR : TreeSequenceInitialSegment base.core R) + (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi) + (hcoreB : baseB.core = base.core), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (treeMissingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) + (closureBToA : + ∀ (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A) + (minusEq : + ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R) + (D : Finset (Fin k)), + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D) + (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (goodB : + GoodHierarchy + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }) + (hcore : baseB.core = baseS.core) + (hpe : + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.kind + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.kind + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = baseS.closure) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (storedEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j), + let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last corr.replacementETT.rounds; + let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; + corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma baseS.core + ((HierarchyStoredColorsAt HS (0 : Fin (HS.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (HS.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma baseS.closure : Finset (Fin k)) \ + (HierarchyStoredColorsAt HS (0 : Fin (HS.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (HS.dividerCount + (1 : ℕ))))).card + +private abbrev helperStoredEq7501Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (treeMissingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) + (storedS : + TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = + Dn) + (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (starBToA : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (starEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j + +private abbrev helperSegmentEq7714Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (edgesFixed : ∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (stageBToB : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (starEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (firstEq : + ∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta) + (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta + +private abbrev helperMissingEq7904Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (TnToA : TreeSequenceInitialSegment Tn A) (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (treeMissingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (stageBToA : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j + +private abbrev helperRefreshEq8147Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (missingA : ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (stageBToA : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (starEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v + +private abbrev helperStoredEq8334Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (treeMissingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) + (storedS : + TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = + Dn) + (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (starBToA : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (starEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j + +private theorem lexicographicMeasureDecreases {a b c d : ℕ} + (hab : a ≤ b) (hcd : c < d) : HierarchyCounterexampleLess (a, c) (b, d) := by + rcases lt_or_eq_of_le hab with h | h + · exact Or.inl h + · exact Or.inr ⟨h, hcd⟩ + +private theorem helper_segTrans_213.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W := by + classical + intro V E G e0 S U W hSU hUW + refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + +private theorem helper_commonPrefix_223.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U := by + classical + intro V E G e0 S U W hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +private theorem helper_stageSegment_233.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H segRefl segTrans a d hbound + clear * - H hbound segRefl segTrans + induction d with + | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + +private theorem helper_stageToT_241.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (H.stage j) T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H stageSegment j + clear * - H j stageSegment + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) + simpa [he, H.terminalStage] using hs + +private theorem helper_lastPositive_252.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A hz + clear * - hz A q + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm + +private theorem helper_coreToA_264.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment base.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A segRefl segTrans stageSegment lastZero + lastPositive + clear * - H base A lastZero lastPositive segRefl segTrans stageSegment + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segRefl _ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + +private theorem helper_TnToCore_273.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + TreeSequenceInitialSegment Tn base.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base n Tn segRefl + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (base.parallel hp).2.2).leftSegment + · rw [base.nonparallel hp] + exact segRefl _ + +private theorem helper_AToT_280.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A segTrans stageToT lastZero lastPositive + clear * - H A lastZero lastPositive segTrans stageToT + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) + · rw [lastPositive hz] + exact stageToT _ + +private theorem helper_ordinaryToA_287.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment Tn A → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A n Tn stageSegment lastZero lastPositive + TnToA j + clear * - H A TnToA stageSegment lastZero lastPositive + by_cases hz : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) + rw [hj, H.baseStage] + exact TnToA + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + rw [lastPositive hz] + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> + simp only [Fin.val_castSucc]; omega + +private theorem helper_starPositive_301.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → + HierarchyStarredStage H j = H.stage j.castSucc := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H j hj + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ j + · exact (hj (congrArg Fin.val hz)).elim + · rw [hi] + rfl + +private theorem helper_coreToStar_308.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H segRefl segTrans stageSegment starPositive j + clear * - j H segRefl segTrans stageSegment starPositive + by_cases hz : j.val = 0 + · have hj : j = 0 := Fin.ext hz + rw [hj] + exact segRefl _ + · rw [starPositive j hz] + have hs := stageSegment 1 (j.val - 1) (by omega) + have he : 1 + (j.val - 1) = j.val := by omega + convert segTrans H.coreInsideFirst hs using 1 + apply congrArg H.stage + apply Fin.ext + simpa using he.symm + +private theorem helper_ordinaryToR_330.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + (↑r : ℕ) < H.dividerCount → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ((↑r : ℕ) = (0 : ℕ) → R = base.core) → + ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → + TreeSequenceInitialSegment Tn R → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≤ (↑r : ℕ) → + TreeSequenceInitialSegment (H.stage j.castSucc) R := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H R hrq n Tn stageSegment rZero rPositive + TnToR j hj + by_cases hr : r.val = 0 + · have hj0 : j.castSucc = (0 : Fin (H.dividerCount + 2)) := by + apply Fin.ext + simp only [Fin.val_castSucc, Fin.val_zero] + omega + rw [hj0, H.baseStage] + exact TnToR + · rw [rPositive hr] + have hs := stageSegment j.val (r.val - j.val) (by omega) + convert hs using 1 + · exact congrArg H.stage (Fin.ext rfl) + · apply congrArg H.stage + apply Fin.ext + simp only [Fin.val_castSucc] + omega + +private theorem helper_firstMissing_354.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment Y T → + ∀ c ∈ TreeMissingColors phi Y, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A ell yLength Y YToT c hc + clear * - hc YToT + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let it := Fin.castLE (Nat.succ_le_succ YToT.1) i + have hci : c ∈ MissingColors G phi (T.vertex it) := by + rw [YToT.2.1 i, hi] + exact hcv + let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) + have hit : it ∈ candidates := by simp [candidates, hci] + have hnon : candidates.Nonempty := ⟨it, hit⟩ + have hmem := Finset.min'_mem candidates hnon + have hle := Finset.min'_le candidates it hit + refine ⟨?_, ?_⟩ + · simpa [HierarchyFirstMissingPosition, candidates, hnon] using + (Finset.mem_filter.mp hmem).2 + · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt + have hval : (candidates.min' hnon).val ≤ it.val := hle + simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv + +private theorem helper_outsideIndex_386.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + ∀ (i : Fin (T.length + (1 : ℕ))), + T.vertex i ∉ TreeSequenceVertexSet A → + A.length < (↑i : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A AToT i hi + by_contra h + have hle : i.val ≤ A.length := by omega + apply hi + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ + +private theorem helper_missingNotA_397.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + TreeSequenceInitialSegment A Y → + ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H q A ell yLength Y + hElementaryY AToY c i hmi hiy hia + clear * - hmi hiy hia AToY hElementaryY + intro hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) + exact (Finset.disjoint_left.mp + (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi + +private theorem helper_elementaryStar_409.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + TreeSequenceInitialSegment A Y → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ColoredVertexSetElementary G phi (TreeSequenceVertexSet (HierarchyStarredStage H j)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A ell yLength Y segTrans starredToA + hElementaryY AToY j + clear * - j starredToA AToY hElementaryY segTrans + intro u hu v hv huv + have hs := segTrans (starredToA j) AToY + exact hElementaryY (TreeSequenceInitialSegmentVertexSetSubset hs hu) + (TreeSequenceInitialSegmentVertexSetSubset hs hv) huv + +private theorem helper_descend_417.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + alpha ≠ beta → + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (s : Fin (H.dividerCount + (1 : ℕ))), + (↑r : ℕ) < (↑s : ℕ) → + ¬TreeColorSetClosed G phi (HierarchyStarredStage H s) + ({ alpha } : Finset (Fin k))) → + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + alpha ∈ TreeMissingColors phi A → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H j))) → + ∀ (d : ℕ) (j : Fin (H.dividerCount + (1 : ℕ))), + H.dividerCount ≤ (↑j : ℕ) + d → + (↑r : ℕ) ≤ (↑j : ℕ) → + alpha ∈ TreeMissingColors phi (HierarchyStarredStage H j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H hmaximal q A halphaA + elementaryStar + clear * - halphaA q C hmaximal elementaryStar r H + intro d + induction d with + | zero => + intro j hj _ + have hjq : j = q := Fin.ext (by simp [q]; omega) + simpa [hjq, q] using halphaA + | succ d ih => + intro j hj hrj + by_cases hjq : j = q + · simpa [hjq, q] using halphaA + · have hjlt : j.val < H.dividerCount := by + have hne : j.val ≠ H.dividerCount := by + intro hh; apply hjq; apply Fin.ext; simpa [q] using hh + omega + let i : Fin H.dividerCount := ⟨j.val, hjlt⟩ + have hic : i.castSucc = j := Fin.ext rfl + have hnext := ih i.succ (by dsimp [i]; omega) (by dsimp [i]; omega) + by_contra hold + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hnext + have hvo : v ∉ TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc) := by + intro hvo + exact hold (Finset.mem_biUnion.mpr ⟨v, by simpa [hic] using hvo, hvm⟩) + have hnew : alpha ∈ + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun v => MissingColors G phi v) := + Finset.mem_biUnion.mpr ⟨v, Finset.mem_sdiff.mpr ⟨hv, hvo⟩, hvm⟩ + have hc := GoodHierarchyNewMissingClosed C.good i (elementaryStar i.succ) alpha hnew + apply hmaximal i.succ (by dsimp [i]; omega) + intro c hc' + have : c = alpha := Finset.mem_singleton.mp hc' + subst c + exact hc + +private theorem helper_haR_458.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let va : V := T.vertex ia; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment R A → + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + alpha ∈ TreeMissingColors phi R → + va ∈ TreeSequenceVertexSet R := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha r H R q A ia va ell yLength Y segTrans + AToT RToA ha halphaR + have hRT := segTrans RToA AToT + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp halphaR + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let it := Fin.castLE (Nat.succ_le_succ hRT.1) i + have hci : alpha ∈ MissingColors G phi (T.vertex it) := by + rw [hRT.2.1 i, hi] + exact hcv + let candidates := Finset.univ.filter fun j => alpha ∈ MissingColors G phi (T.vertex j) + have hit : it ∈ candidates := by simp [candidates, hci] + have hn : candidates.Nonempty := ⟨it, hit⟩ + have hle : ia.val ≤ R.length := by + have hmin : (candidates.min' hn).val ≤ it.val := Finset.min'_le candidates it hit + have hiv : it.val ≤ R.length := Nat.le_of_lt_succ i.isLt + simpa [ia, HierarchyFirstMissingPosition, candidates, hn] using le_trans hmin hiv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨ia.val, by omega⟩, (hRT.2.1 ⟨ia.val, by omega⟩).symm⟩ + +private theorem helper_branch_487.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + LowerRoundInductionHypothesis G k e0 ett.rounds → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let j : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + ∀ {u : V}, + u ∈ TreeSequenceVertexSet Tn → + ∀ {v : V}, + v ∈ TreeSequenceVertexSet Tn → + u ≠ v → + (1 : ℕ) < ett.rounds → + Disjoint (MissingColors G (ett.series.data.coloring j.castSucc) u) + (MissingColors G (ett.series.data.coloring j.castSucc) v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hlower n Tn j u hu v hv huv hn + obtain ⟨lower, hr, hmax, _, _⟩ := + CertifiedETTRestriction G k e0 input T phi ett C.maximum + (ett.rounds - 1) (by omega) (by omega) + have he : ColoredVertexSetElementary G + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) + (TreeSequenceVertexSet (ett.series.data.tree ⟨ett.rounds - 1 + 1, by omega⟩)) := + (hlower lower (by omega) (by omega) hmax).1 + have ht : (⟨ett.rounds - 1 + 1, by omega⟩ : Fin (ett.rounds + 2)) = n.castSucc := + Fin.ext (by simp [n]; omega) + have hu' : u ∈ TreeSequenceVertexSet (ett.series.data.tree + ⟨ett.rounds - 1 + 1, by omega⟩) := by simpa only [ht] using hu + have hv' : v ∈ TreeSequenceVertexSet (ett.series.data.tree + ⟨ett.rounds - 1 + 1, by omega⟩) := by simpa only [ht] using hv + exact he hu' hv' huv + +private theorem helper_branch_501.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let j : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + ∀ {u : V}, + u ∈ TreeSequenceVertexSet Tn → + ∀ {v : V}, + v ∈ TreeSequenceVertexSet Tn → + u ≠ v → + ¬(1 : ℕ) < ett.rounds → + Disjoint (MissingColors G (ett.series.data.coloring j.castSucc) u) + (MissingColors G (ett.series.data.coloring j.castSucc) v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C n Tn j u hu v hv huv hn + have hn1 : ett.rounds = 1 := by have := C.positive; omega + have hj0 : j.castSucc = (0 : Fin (ett.rounds + 1)) := Fin.ext (by simp [j, hn1]) + have ht1 : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn1]) + have he : ColoredVertexSetElementary G (ett.series.data.coloring 0) + (TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩)) := + (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + have hu' : u ∈ TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩) := by + simpa only [Tn, ht1] using hu + have hv' : v ∈ TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩) := by + simpa only [Tn, ht1] using hv + simpa only [hj0] using he hu' hv' huv + +private theorem helper_habIndex_519.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + (↑ia : ℕ) < (↑ib : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta ia ib horder + obtain ⟨i, j, hi, hj, hij⟩ := horder.1 + have hei := T.vertex_injective hi + have hej := T.vertex_injective hj + simpa [hei, hej] using hij + +private theorem helper_BstrictT_538.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + A.length < B.length → + TreeSequenceInitialSegment B Y → + B.length < T.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib ell yLength Y AToT hAib B + ABstrict BToY + clear * - AToT BToY ABstrict Y + have hAT := AToT.1 + have hY : Y.length = min (A.length + (T.length - A.length - 1)) T.length := rfl + have hBY := BToY.1 + have hAB := ABstrict + omega + +private theorem helper_branch_561.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ((↑r : ℕ) = (0 : ℕ) → R = base.core) → + alpha ∈ TreeMissingColors phi R → + (↑r : ℕ) = (0 : ℕ) → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeInterchangeable G base.core phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R hclosed n + Tn Dn rZero halphaR hz hp + have hs : CombinedStableColoring Tn base.closure Dn phi phi := + ⟨⟨(by intros; rfl), (by intros; rfl)⟩, + ⟨(by intros; rfl), (by intros; rfl)⟩⟩ + exact (interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hp base hproper hone hs alpha beta).2.2.1 + (by simpa [rZero hz] using halphaR) + (by simpa [rZero hz] using hclosed) + +private theorem helper_branch_568.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ((↑r : ℕ) = (0 : ℕ) → R = base.core) → + alpha ∈ TreeMissingColors phi R → + (↑r : ℕ) = (0 : ℕ) → + ¬ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeInterchangeable G base.core phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R n Tn rZero + halphaR hz hp + rw [base.nonparallel hp] + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have hprev : StableColoring Tn + (TashkinovStoredColors ett.series.data j.castSucc) + (ett.series.data.coloring j.castSucc) phi := by + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => + have hv := congrArg Fin.val hi + simp [n] at hv + have := C.positive + omega + | SE ji _ _ _ _ _ choice _ coloring stored edges kind vertex outside + delta gamma seed adjoin closure ordered strict => + have hji : ji = j := Fin.ext (by + have hv := congrArg Fin.val hi + simp [n, j] at hv ⊢ + omega) + subst ji + have hc : phi = choice.selected := by + simpa only [← hj, coloring, n] using ett.generatingColoring + simpa only [hj, Tn, hc] using choice.selectedStable + | RE ji _ _ _ _ available coloring stored edges kind vertex outside + delta gamma seed adjoin closure ordered strict => + have hji : ji = j := Fin.ext (by + have hv := congrArg Fin.val hi + simp [n, j] at hv ⊢ + omega) + subst ji + have hc : phi = ett.series.data.coloring j.castSucc := by + simpa only [← hj, coloring, n] using ett.generatingColoring + refine ⟨?_, ?_⟩ + · intro f _ _ + exact congrFun hc f + · intro v _ + exact congrArg (fun psi => MissingColors G psi v) hc + | PE ji _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper + one stored edges kind vertex outside delta gammaEq closure ordered strict => + exact (hp (by simpa [← hi] using kind)).elim + have hm : alpha ∈ TreeMissingColors phi Tn := by + simpa only [rZero hz, base.nonparallel hp] using halphaR + by_cases hn : 1 < ett.rounds + · obtain ⟨lower, hr, hmax, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T phi ett C.maximum + (ett.rounds - 1) (by omega) (by omega) + let nl : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hcidx : Fin.castLE (by omega) nl = j.castSucc := + Fin.ext (by simp [nl, j, hr]) + have htidx : Fin.castLE (by omega) (Fin.last (lower.rounds + 1)) = + n.castSucc := Fin.ext (by simp [n, hr]; omega) + have ht : lower.series.data.tree (Fin.last (lower.rounds + 1)) = Tn := + (htrees _).trans (congrArg ett.series.data.tree htidx) + obtain ⟨hc, _, _, _, _, _, _, _, hd, _⟩ := hdata nl + rw [hcidx] at hc hd + have hs : StableColoring + (lower.series.data.tree (Fin.last (lower.rounds + 1))) + (TashkinovStoredColors lower.series.data nl) + (lower.series.data.coloring nl) phi := by + rw [ht, hc, hd] + exact hprev + have hi := (hlower lower (by omega) (by omega) hmax).2.1 + phi hproper hone hs alpha beta (Or.inl (by rw [ht]; exact hm)) + simpa only [ht] using hi + · have hn1 : ett.rounds = 1 := by have := C.positive; omega + have hj0 : j.castSucc = (0 : Fin (ett.rounds + 1)) := + Fin.ext (by simp [j, hn1]) + have ht1 : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn1]) + have hs : StableColoring (ett.series.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors ett.series.data 0) + (ett.series.data.coloring 0) phi := by + simpa only [Tn, ht1, hj0] using hprev + have hi := (TechnicalTheoremBase G k ett.rounds e0 input ett.series).2 + phi hproper hone hs alpha beta + (Or.inl (by simpa only [Tn, ht1] using hm)) + have hTn1 : Tn = ett.series.data.tree ⟨1, by omega⟩ := + congrArg ett.series.data.tree ht1 + change TreeInterchangeable G Tn phi alpha beta + rw [hTn1] + exact hi + +private theorem helper_branch_650.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + (↑r : ℕ) < H.dividerCount → + TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → + ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → + alpha ∈ TreeMissingColors phi R → + ¬(↑r : ℕ) = (0 : ℕ) → + TreeInterchangeable G R phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge alpha beta + hne r H R hrq hclosed rPositive halphaR hz + let i : Fin H.dividerCount := ⟨r.val - 1, by omega⟩ + have hi : i.succ.castSucc = r.castSucc := Fin.ext (by simp [i]; omega) + rw [rPositive hz] + rw [← hi] + apply step1 G k e0 input T phi ett C.maximum C.positive hproper hone + hlower base H C.good hfewer hlarge i alpha beta + · simpa [hi, ← rPositive hz] using halphaR + · exact hne + · simpa [hi, ← rPositive hz] using hclosed + +private theorem helper_pathMissing_662.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi → + ∀ (v : V) (c d : Fin k), + c ≠ d → + c ∈ MissingColors G phi v → + TwoColorPathComponent G phi c d (Sum.inl v) := by + classical + intro V E _ _ G k phi hproper v c d hcd hc + let _ := Fintype.ofFinite V + refine ⟨hcd, Sum.inl v, rfl, ?_⟩ + intro x hx y hy + cases x with + | inr f => + cases y with + | inr g => + have hfc : phi f = some d := hx.2.resolve_left (by + intro he + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) + have hgc : phi g = some d := hy.2.resolve_left (by + intro he + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) + congr 1 + by_contra hfg + exact hproper hfg ⟨v, hx.1, hy.1⟩ hfc hgc + | inl w => exact False.elim hy + | inl w => exact False.elim hx + +private theorem helper_pathB_687.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + TwoColorPathComponent G phi alpha beta (Sum.inl vb) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper alpha beta hne r H q A ib vb ell + yLength Y hb + clear * - hb hproper hne + refine ⟨hne, Sum.inl vb, rfl, ?_⟩ + intro x hx y hy + cases x with + | inr f => + cases y with + | inr g => + have hfc : phi f = some alpha := hx.2.resolve_right (by + intro he + exact (Finset.mem_sdiff.mp hb.1).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) + have hgc : phi g = some alpha := hy.2.resolve_right (by + intro he + exact (Finset.mem_sdiff.mp hb.1).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) + congr 1 + by_contra hfg + exact hproper hfg ⟨vb, hx.1, hy.1⟩ hfc hgc + | inl w => exact False.elim hy + | inl w => exact False.elim hx + +private theorem helper_unaffected_722.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), + alpha ≠ beta → + ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta + (Sum.inl vb); + ∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H q A ib vb ell yLength Y ha + hb K sigma f c hca hcb + clear * - hca hcb K sigma hne + by_cases hf : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hca.symm, hcb.symm] + · by_cases hb : phi f = some beta + · simp [sigma, TwoColorComponentSwap, K, hf, hb, hne.symm, + hca.symm, hcb.symm] + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hb] + · simp [sigma, TwoColorComponentSwap, K, hf] + +private theorem helper_sigmaOne_739.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta hne r H q A ib vb ell yLength Y + ha hb K sigma unaffected + clear * - hone sigma K unaffected hne + refine ⟨?_, ?_⟩ + · simp [sigma, TwoColorComponentSwap, hone.1] + · intro f hf + obtain ⟨c, hc⟩ := hone.2 f hf + by_cases ha : c = alpha + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · by_cases hb : c = beta + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc, hne.symm]⟩ + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨c, (unaffected f c ha hb).mpr hc⟩ + +private theorem helper_missingBefore_764.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + va ∈ TreeSequenceVertexSet Y → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B Y → + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + Sum.inl va ∉ K → + (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → + (∀ {v : V} {f : E}, + Sum.inl v ∈ K → + Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ K) → + ∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → + MissingColors G sigma v = MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H q A ia ib va vb ell yLength + Y hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb + clear * - hv hvb K haK haY hbY ha hb hElementaryY BToY behavior edgeOfVertex sigma hne + by_cases hvK : Sum.inl v ∈ K + · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) + have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv + have han : alpha ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 + have hbn : beta ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 + have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by + simpa [MissingColors, PresentColors] using han + have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by + simpa [MissingColors, PresentColors] using hbn + obtain ⟨fa, hfa, hfca⟩ := hpa + obtain ⟨fb, hfb, hfcb⟩ := hpb + have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) + have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) + have hnewa : sigma fb = some alpha := by + simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] + have hnewb : sigma fa = some beta := by + simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] + have hana : alpha ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fb, hfb, hnewa⟩ + have hbnb : beta ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fa, hfa, hnewb⟩ + ext c + by_cases hca : c = alpha + · subst c; simp [hana, han] + · by_cases hcb : c = beta + · subst c; simp [hbnb, hbn] + · exact behavior.2.2.2 v c hca hcb + · exact behavior.1 v hvK + +private theorem helper_incidentFixed_818.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet R, Sum.inl v ∉ K) → + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + ∀ (f : E), + TreeIncidentEdge R f → + sigma f = phi f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb ell yLength Y ha hb + K sigma avoidR fixedValue f hf + clear * - hf sigma K avoidR fixedValue + obtain ⟨v, hv, hvf⟩ := hf + by_cases hK : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · exact False.elim (avoidR v hv + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, Or.inl ha⟩)).trans hK)) + · by_cases hb : phi f = some beta + · exact False.elim (avoidR v hv + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, Or.inr hb⟩)).trans hK)) + · exact fixedValue f ha hb + · simp [sigma, TwoColorComponentSwap, K, hK] + +private theorem helper_stable_834.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment R A → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → + ∀ (D : Finset (Fin k)), + StableColoring S D phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb RToA sigma missingA + incidentFixed S hS D + refine ⟨?_, fun v hv => missingA v (TreeSequenceInitialSegmentVertexSetSubset RToA (hS hv))⟩ + intro f hf _ + obtain ⟨v, hv, hvf⟩ := hf + exact incidentFixed f ⟨v, hS hv, hvf⟩ + +private theorem helper_terminalRoute_847.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ)))) → + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib commonPrefix hAib B + TnToB TnStrictB BToFinal + clear * - ett C n Tn B BToFinal TnToB TnStrictB commonPrefix + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => have hv := congrArg Fin.val hi; simp [n] at hv; have := C.positive; omega + | SE j _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedB : TreeSequenceInitialSegment seed B := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + BToFinal (by + have hl := adjoin.1 + rw [hj] at hl + change seed.length = Tn.length + 1 at hl + omega) + exact Or.inr ⟨Or.inl (by simpa [hj] using kind), choice.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + TashkinovAugmentationSequenceRestrict phi seed B _ hroute hseedB BToFinal⟩ + | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + refine Or.inl ⟨by simpa [hj] using kind, ?_⟩ + apply TashkinovAugmentationSequenceRestrict phi Tn B _ _ TnToB BToFinal + simpa [Tn, hj, hlast, ← ett.generatingColoring, n] using closure.1 + | RE j _ _ _ _ available coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedB : TreeSequenceInitialSegment seed B := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + BToFinal (by + have hl := adjoin.1 + rw [hj] at hl + change seed.length = Tn.length + 1 at hl + omega) + exact Or.inr ⟨Or.inr (by simpa [hj] using kind), available.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + TashkinovAugmentationSequenceRestrict phi seed B _ hroute hseedB BToFinal⟩ + +private theorem helper_displayedIncident_896.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S R → + ∀ (t : Fin S.length), + TreeIncidentEdge R (S.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H R S hSA t + obtain ⟨i, hi⟩ := S.attaches t + refine ⟨S.vertex t.succ, TreeSequenceInitialSegmentVertexSetSubset hSA + (by simp [TreeSequenceVertexSet]), ?_⟩ + simp [Incident, hi] + +private theorem helper_augmentationFixed_904.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + TreeSequenceInitialSegment R A → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + alpha ∉ + ({c : Fin k | ∃ (t : Fin A.length), R.length ≤ (↑t : ℕ) ∧ phi (A.edge t) = some c} : + Finset (Fin k)) → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A B → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S R → + ∀ (t : Fin S.length), TreeIncidentEdge R (S.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), + S.length ≤ (↑t : ℕ) → + sigma (B.edge t) = phi (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb ell yLength Y + segRefl segTrans RToA hElementaryY hb vertexY hbY hAib unusedRA horder B BToT AToB sigma + fixedValue incidentFixed displayedIncident S hseq t ht + by_cases htA : t.val < R.length + · have hRB := segTrans RToA AToB + have he := hRB.2.2 ⟨t.val, htA⟩ + have hi : Fin.castLE hRB.1 ⟨t.val, htA⟩ = t := Fin.ext rfl + rw [hi] at he + rw [he] + exact incidentFixed _ (displayedIncident R (segRefl R) _) + · have hstep := (TashkinovAugmentationSequencePosition phi S B hseq t ht).1 + obtain ⟨hl, hinit, c, hcol, hm⟩ := hstep + have hcolB : phi (B.edge t) = some c := by + convert hcol using 1 + congr 2 + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨iv, hiv⟩ := hv + let ivT : Fin (T.length + 1) := ⟨iv.val, by + have htB := BToT.1 + have := iv.isLt + simp only [TreeSequencePrefix] at this + omega⟩ + have hcvT : c ∈ MissingColors G phi (T.vertex ivT) := by + have he : (TreeSequencePrefix B t.val (le_trans S.positive ht) + (Nat.le_of_lt t.isLt)).vertex iv = T.vertex ivT := rfl + rw [← he, hiv] + exact hcv + have hnotA : c ≠ alpha := by + intro he + subst c + by_cases htLast : t.val < A.length + · apply unusedRA + let u : Fin A.length := ⟨t.val, htLast⟩ + have he := AToB.2.2 u + have hi : Fin.castLE AToB.1 u = t := Fin.ext rfl + rw [hi] at he + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, u, + by change R.length ≤ t.val; omega, + by rw [← he]; exact hcolB⟩ + · apply horder.2 + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, Fin.castLE BToT.1 t, + by change A.length ≤ t.val; omega, t.isLt, + by rw [BToT.2.2 t]; exact hcolB⟩ + have hnotB : c ≠ beta := by + intro he + subst c + have hivB : ivT.val < ib.val := by + have := iv.isLt + simp only [TreeSequencePrefix] at this + have htB : t.val < ib.val := t.isLt + dsimp [ivT] + omega + have hvY := vertexY ivT (by omega) + have hneV : T.vertex ivT ≠ vb := by + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + omega + exact Finset.disjoint_left.mp (hElementaryY hvY hbY hneV) hcvT hb.1 + exact fixedValue _ (fun hc => hnotA (Option.some.inj (hcolB.symm.trans hc))) + (fun hc => hnotB (Option.some.inj (hcolB.symm.trans hc))) + +private theorem helper_seedFixed_967.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn R → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → + ∀ (f : E) (seed : TreeSequence G e0), + TreeSequenceAdjoinEdge Tn f seed → + sigma f = phi f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R n Tn ib vb TnToR sigma + incidentFixed f seed hadjoin + obtain ⟨i, hi⟩ := seed.attaches (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) + let j : Fin (Tn.length + 1) := ⟨i.val, by have := i.isLt; simpa using this⟩ + have hv : seed.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ + (Fin.cast hadjoin.1.symm (Fin.last Tn.length)).isLt))) = Tn.vertex j := + hadjoin.2.1.2.1 j + apply incidentFixed + refine ⟨Tn.vertex j, TreeSequenceInitialSegmentVertexSetSubset TnToR + (by simp [TreeSequenceVertexSet]), ?_⟩ + rw [← hadjoin.2.2, Incident, hi] + simp [← hv] + +private theorem helper_edgesFixed_981.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn R → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → + TreeSequenceInitialSegment Tn B → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S R → + ∀ (t : Fin S.length), TreeIncidentEdge R (S.edge t)) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), S.length ≤ (↑t : ℕ) → sigma (B.edge t) = phi (B.edge t)) → + (∀ (f : E) (seed : TreeSequence G e0), + TreeSequenceAdjoinEdge Tn f seed → sigma f = phi f) → + ∀ (t : Fin B.length), + sigma (B.edge t) = phi (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A n Tn ib vb TnToR hAib B + sigma incidentFixed TnToB terminalRoute displayedIncident augmentationFixed seedFixed t + by_cases ht : t.val < Tn.length + · have he := TnToB.2.2 ⟨t.val, ht⟩ + have hi : Fin.castLE TnToB.1 ⟨t.val, ht⟩ = t := Fin.ext rfl + rw [hi] at he + rw [he] + exact incidentFixed _ (displayedIncident Tn TnToR _) + · rcases terminalRoute with ⟨hp, hs⟩ | ⟨hk, f, seed, hedges, hadjoin, hs⟩ + · exact augmentationFixed Tn hs t (by omega) + · by_cases he : t.val = Tn.length + · have hSB := TashkinovAugmentationSequenceInitialSegment phi seed B hs + have hi := hSB.2.2 (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) + have hj : Fin.castLE hSB.1 (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) = t := + Fin.ext (by simpa using he.symm) + rw [hj, hadjoin.2.2] at hi + simpa [hi] using seedFixed f seed hadjoin + · exact augmentationFixed seed hs t (by have := hadjoin.1; omega) + +private theorem helper_routeTransport_1000.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + TashkinovAugmentationSequence sigma S B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb segTrans hAib B BToT + sigma missingBefore edgesFixed S hs + clear * - S hs edgesFixed BToT segTrans missingBefore + unfold TashkinovAugmentationSequence at hs ⊢ + induction hs using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head U W hstep htail ih => + have hWB := TashkinovAugmentationSequenceInitialSegment phi W B htail + obtain ⟨hlen, hUW, c, hcol, hm⟩ := hstep + have hUB := segTrans hUW hWB + have hlt : U.length < B.length := by have := hWB.1; omega + refine Relation.ReflTransGen.head ⟨hlen, hUW, c, ?_, ?_⟩ ih + · have hf := edgesFixed (Fin.castLE hWB.1 (Fin.cast hlen.symm (Fin.last U.length))) + rw [hWB.2.2] at hf + exact hf.trans hcol + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + have hvB := TreeSequenceInitialSegmentVertexSetSubset hUB hv + have hvb : v ≠ vb := by + intro he + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + have ht := hUB.2.1 i + have htT := BToT.2.1 (Fin.castLE (Nat.succ_le_succ hUB.1) i) + have eqv : T.vertex (Fin.castLE (Nat.succ_le_succ BToT.1) + (Fin.castLE (Nat.succ_le_succ hUB.1) i)) = T.vertex ib := htT.trans (ht.trans + (hi.trans he)) + have hh := congrArg Fin.val (T.vertex_injective eqv) + have := i.isLt + change i.val = ib.val at hh + change U.length < ib.val at hlt + omega + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [missingBefore v hvB hvb]; exact hcv⟩ + +private theorem helper_replacement_1032.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment base.core R → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → + ∀ (D : Finset (Fin k)), StableColoring S D phi sigma) → + StableColoring Tn Dn phi sigma → + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : + TashkinovHierarchy corr.replacementETT baseS), + SameHierarchyStages HB HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R q A n Tn + Dn ib vb coreToR hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma + sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport + by_cases hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE + · have closureSubset : TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet R := by + obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hPE + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToR + rw [← hcoreB, u.vertexSet] + exact Finset.mem_union_right _ hv + have hcombined : CombinedStableColoring Tn baseB.closure Dn phi sigma := + ⟨stableTn, stable baseB.closure closureSubset ∅⟩ + have hseq : TashkinovAugmentationSequence sigma Tn B := by + rcases terminalRoute with ⟨_, hs⟩ | ⟨hk, _⟩ + · exact routeTransport Tn hs + · rcases hk with hk | hk <;> rw [hPE] at hk <;> cases hk + exact HierarchySplitter G k e0 input B phi sigma ettB hMPB C.positive + hlower baseB HB hPE hproper hone sigmaProper sigmaOne hcombined hseq + · have hmod : ModColoring ettB sigma := + Td G k e0 input B phi ettB hMPB C.positive hlower sigma sigmaProper sigmaOne + (by simpa only [ettB, ← ett.generatingColoring, n, Tn, Dn] using stableTn) + have hroute : + ((ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B) ∨ + ((ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.SE ∨ + ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ettB.series.data.connectingEdges (Fin.last ettB.rounds) = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed B)) := by + rcases terminalRoute with ⟨hp, _⟩ | ⟨hk, f, seed, hedges, hadjoin, hs⟩ + · exact (hPE hp).elim + · exact Or.inr ⟨hk, f, seed, hedges, hadjoin, routeTransport seed hs⟩ + obtain ⟨corr⟩ := hmod.2.2 B TnToB TnStrictB hroute + have hMP := MaximumPropertyTransport G k e0 ettB sigma hmod B corr hMPB + refine ⟨corr, hMP, ?_⟩ + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ + rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let rep : ExtendedTashkinovTree G k e0 newInput B sigma := + ⟨ett.rounds, rp, newSeries, above, strict, below, gen⟩ + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j + have hkind := hkinds n + let pos : Fin ((newSeries.data.tree n.castSucc).length + 1) := + Fin.cast (congrArg (fun S : TreeSequence G e0 => S.length + 1) htree.symm) + baseB.supportPosition + let baseS : HierarchyBase rep sigma := + { core := baseB.core + closure := baseB.closure + supportPosition := pos + supportPositive := by simpa [pos] using baseB.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only [rep] + intro hp + exact (hPE (hkind.symm.trans hp)).elim + nonparallel := by + dsimp only [rep] + intro hp + exact (baseB.nonparallel hPE).trans htree.symm } + let HS : TashkinovHierarchy rep baseS := + { dividerCount := HB.dividerCount + stage := HB.stage + baseStage := HB.baseStage.trans htree.symm + terminalStage := HB.terminalStage + nested := HB.nested + strict := HB.strict + dividerPosition := HB.dividerPosition + dividerPositive := HB.dividerPositive + dividerIncreasing := HB.dividerIncreasing + dividerStage := HB.dividerStage + coreInsideFirst := HB.coreInsideFirst } + refine ⟨baseS, HS, ?_⟩ + refine ⟨rfl, rfl, HEq.rfl, HEq.rfl, ?_, ?_⟩ + · exact ⟨fun hp => (hPE hp).elim, fun hp => (hPE (hkind.symm.trans hp)).elim⟩ + · intro hp; exact (hPE hp).elim + +private theorem helper_storedS_1119.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn Dn ib vb TnToA hAib B + rpB aboveB strictB belowB genB ettB sigma treeMissingEq corr + clear * - corr ett n Tn Dn ettB C treeMissingEq TnToA + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ + rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j + have hm := treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) + unfold Dn TashkinovStoredColors + simp only [ettB, hstored, ← hgen, ← ett.generatingColoring, htree, hm, n, Tn] + +private theorem helper_stageBToB_1145.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (j : Fin (HB.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (HB.stage j) B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib segRefl segTrans hAib B + rpB aboveB strictB belowB genB baseB HB j + clear * - HB j B segRefl segTrans + exact Fin.reverseInduction + (motive := fun j => TreeSequenceInitialSegment (HB.stage j) B) + (by simpa only [HB.terminalStage] using segRefl B) + (fun i hi => segTrans (HB.nested i) hi) j + +private theorem helper_closureBToA_1152.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n ib coreToA hAib B rpB + aboveB strictB belowB genB baseB hcoreB hp + clear * - hp baseB coreToA hcoreB + obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hp + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [← hcoreB, u.vertexSet] + exact Finset.mem_union_right _ hv + +private theorem helper_minusEq_1160.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment R A → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → + ∀ (D : Finset (Fin k)), + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb RToA sigma + treeMissingEq incidentFixed S hS D + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [treeMissingEq S (fun v hv => TreeSequenceInitialSegmentVertexSetSubset RToA (hS hv))] + have boundaryEq (c : Fin k) (hc : c ∈ TreeMissingColors phi S) : + BoundaryColorEdges G sigma (TreeSequenceVertexSet S) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet S) c := by + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + apply and_congr_right + intro hf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf + obtain ⟨u, hu, v, hv, he⟩ := hf + have hfix : sigma f = phi f := incidentFixed f ⟨u, hS hu, by simp [Incident, he]⟩ + rw [hfix] + exact ⟨fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).symm.trans (hs c hc), + fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).trans (hs c hc)⟩ + +private theorem helper_storedEq_1197.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + change TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) \ TreeMissingColors sigma (HierarchyStarredStage HS + j) = + Dn \ TreeMissingColors phi (HierarchyStarredStage HB j) + rw [storedS, starEq, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starBToA j))] + +private theorem helper_missingEq_1204.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := + hsbase.symm.trans hbbase + rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] + · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) + +private theorem helper_firstLe_1215.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), + eta ∈ MissingColors G psi (B.vertex i) → + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib hAib B psi eta i hc + clear * - psi eta i hc + let candidates := Finset.univ.filter fun j => eta ∈ MissingColors G psi (B.vertex j) + have hi : i ∈ candidates := by simp [candidates, hc] + have hn : candidates.Nonempty := ⟨i, hi⟩ + simpa [HierarchyFirstMissingPosition, candidates, hn] using + (show (candidates.min' hn).val ≤ i.val from Finset.min'_le candidates i hi) + +private theorem helper_firstStrict_1224.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k), + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib hAib B psi eta h + clear * - psi eta h + unfold HierarchyFirstMissingPosition at h ⊢ + dsimp only at h ⊢ + split_ifs with hn + · exact (Finset.mem_filter.mp (Finset.min'_mem _ hn)).2 + · simp only [dite_eq_right hn, Fin.val_last] at h + omega + +private theorem helper_firstEq_1234.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + (∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), + eta ∈ MissingColors G psi (B.vertex i) → + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ)) → + (∀ (psi : PartialEdgeColoring E k) (eta : Fin k), + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta))) → + ∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B BToT sigma + missingBefore firstLe firstStrict eta + clear * - eta B BToT ib missingBefore firstLe firstStrict + have beforeLast (i : Fin (B.length + 1)) (hi : i.val < B.length) : + MissingColors G sigma (B.vertex i) = MissingColors G phi (B.vertex i) := by + apply missingBefore + · simp [TreeSequenceVertexSet] + · intro he + have heT := (BToT.2.1 i).trans he + have heval := congrArg Fin.val (T.vertex_injective heT) + have hbLen : B.length = ib.val := rfl + change i.val = ib.val at heval + omega + apply Fin.ext + apply Nat.le_antisymm + · by_cases h : (HierarchyFirstMissingPosition phi B eta).val < B.length + · apply firstLe sigma eta + rw [beforeLast _ h] + exact firstStrict phi eta h + · have := (HierarchyFirstMissingPosition sigma B eta).isLt + omega + · by_cases h : (HierarchyFirstMissingPosition sigma B eta).val < B.length + · apply firstLe phi eta + rw [← beforeLast _ h] + exact firstStrict sigma eta h + · have := (HierarchyFirstMissingPosition phi B eta).isLt + omega + +private theorem helper_segmentEq_1261.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + clear * - j eta starEq firstEq edgesFixed stageBToB + have hedge (t : Fin (stages j.succ).length) : + sigma ((stages j.succ).edge t) = phi ((stages j.succ).edge t) := by + have hSB := stageBToB j.succ + have hf := edgesFixed (Fin.castLE hSB.1 t) + rw [hSB.2.2] at hf + exact hf + unfold HierarchySegmentColors + simp only [starEq, firstEq eta, HS, HB, hedge] + +private theorem helper_refreshEq_1273.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + clear * - i starEq missingA stageBToA + rw [starEq] + apply Finset.biUnion_congr rfl + intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ) + (Finset.mem_sdiff.mp hv).1) + +private theorem helper_hstarLast_1371.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + rw [starEq] + have hs := (hstagesB (Fin.last count)).2 + have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := + Fin.ext (by simp [q]) + simpa only [hj] using hs + +private theorem helper_pathLe_1383.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let _ : ℕ := T.length - A.length; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb ell AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + clear * - HS H A T B q ell count hstarLast BToT AToT ABstrict + let tailB := B.length - A.length + let candidatesT := (Finset.Icc 1 ell).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + let candidatesB := (Finset.Icc 1 tailB).filter fun i => + ∀ t : Fin B.length, A.length + i ≤ t.val → + G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) + have htail : 1 ≤ tailB := by dsimp [tailB]; omega + have htailT : 1 ≤ ell := by dsimp [ell]; omega + have htmem : ell ∈ candidatesT := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htailT, le_rfl⟩, ?_⟩ + intro t ht + have hAT := AToT.1 + have := t.isLt + dsimp [ell] at ht + omega + have hbmem : tailB ∈ candidatesB := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htail, le_rfl⟩, ?_⟩ + intro t ht + have := t.isLt + dsimp [tailB] at ht + omega + have hnT : candidatesT.Nonempty := ⟨ell, htmem⟩ + have hnB : candidatesB.Nonempty := ⟨tailB, hbmem⟩ + have hmT := Finset.min'_mem candidatesT hnT + have hbounds := Finset.mem_Icc.mp (Finset.mem_filter.mp hmT).1 + have hminB : candidatesB.min' hnB ≤ candidatesT.min' hnT := by + by_cases ht : candidatesT.min' hnT ≤ tailB + · apply Finset.min'_le + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hbounds.1, ht⟩, ?_⟩ + intro t hpos + have he := (Finset.mem_filter.mp hmT).2 (Fin.castLE BToT.1 t) hpos + have hv0 := BToT.2.1 t.castSucc + have hv1 := BToT.2.1 t.succ + have hi0 : (Fin.castLE BToT.1 t).castSucc = + Fin.castLE (Nat.succ_le_succ BToT.1) t.castSucc := Fin.ext rfl + have hi1 : (Fin.castLE BToT.1 t).succ = + Fin.castLE (Nat.succ_le_succ BToT.1) t.succ := Fin.ext rfl + simpa only [BToT.2.2, hi0, hi1, hv0, hv1] using he + · exact le_trans (Finset.min'_le candidatesB tailB hbmem) (by omega) + unfold HierarchyPathNumber + rw [hstarLast] + change (if h : candidatesB.Nonempty then candidatesB.min' h else tailB) ≤ + (if h : candidatesT.Nonempty then candidatesT.min' h else ell) + rw [dite_eq_left hnB, dite_eq_left hnT] + exact hminB + +private theorem helper_hinter_3502.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + (0 : ℕ) < H.dividerCount → + (↑r : ℕ) < H.dividerCount → + TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ((↑r : ℕ) = (0 : ℕ) → R = base.core) → + ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → + alpha ∈ TreeMissingColors phi R → + TreeInterchangeable G R phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge alpha beta + hne r H R hq hrq hclosed n Tn Dn rZero rPositive halphaR + by_cases hz : r.val = 0 + · rw [rZero hz] + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact helper_branch_561 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@alpha) (@beta) (@r) (@hclosed) (@rZero) (@halphaR) (@hz) (@hp) + · exact helper_branch_568 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@alpha) (@beta) (@r) (@rZero) (@halphaR) (@hz) (@hp) + · exact helper_branch_650 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@hfewer) (@hlarge) (@alpha) (@beta) (@hne) (@r) (@hrq) (@hclosed) + (@rPositive) (@halphaR) (@hz) + +private theorem helper_augmentationFixed_3623.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + TreeSequenceInitialSegment R A → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + alpha ∉ + ({c : Fin k | ∃ (t : Fin A.length), R.length ≤ (↑t : ℕ) ∧ phi (A.edge t) = some c} : + Finset (Fin k)) → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A B → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S R → + ∀ (t : Fin S.length), TreeIncidentEdge R (S.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), + S.length ≤ (↑t : ℕ) → + sigma (B.edge t) = phi (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb ell yLength Y + segRefl segTrans RToA hElementaryY hb vertexY hbY hAib unusedRA horder B BToT AToB sigma + fixedValue incidentFixed displayedIncident S hseq t ht + exact helper_augmentationFixed_904 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@r) (@segRefl) (@segTrans) (@RToA) (@hElementaryY) (@hb) (@vertexY) + (@hbY) (@hAib) (@unusedRA) (@horder) (@BToT) (@AToB) (@fixedValue) (@incidentFixed) + (@displayedIncident) (@S) (@hseq) (@t) (@ht) + +private theorem helper_replacement_3646.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment base.core R → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → + ∀ (D : Finset (Fin k)), StableColoring S D phi sigma) → + StableColoring Tn Dn phi sigma → + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : + TashkinovHierarchy corr.replacementETT baseS), + SameHierarchyStages HB HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R q A n Tn + Dn ib vb coreToR hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma + sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport + exact helper_replacement_1032 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hproper) (@hone) + (@hlower) (@alpha) (@beta) (@r) (@coreToR) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) + (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) + (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) + +private theorem helper_storedEq_3710.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact helper_storedEq_1197 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) + (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) + (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +private theorem helper_missingEq_3719.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + exact helper_missingEq_1204 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) + (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) + (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) + (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@j) + +private theorem helper_segmentEq_3746.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + exact helper_segmentEq_1261 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) + (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + +private theorem helper_refreshEq_3756.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + exact helper_refreshEq_1273 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) + (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@i) + +private theorem helper_hstarLast_3855.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + exact helper_hstarLast_1371 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) + (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) + +private theorem helper_pathLe_3869.{u_1, u_2} : + helperPathLe3869Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + exact helper_pathLe_1383 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@AToT) + (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) + (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) + (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) + +private theorem helper_storedEq_5179.{u_1, u_2} : + helperStoredEq5179Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact helper_storedEq_3710 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) + (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) + (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +private theorem helper_segmentEq_5215.{u_1, u_2} : + helperSegmentEq5215Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + exact helper_segmentEq_3746 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) + (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + +private theorem helper_refreshEq_5225.{u_1, u_2} : + helperRefreshEq5225Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + exact helper_refreshEq_3756 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) + (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@i) + +private theorem helper_hstarLast_5324.{u_1, u_2} : + helperHstarLast5324Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + exact helper_hstarLast_3855 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) + (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) + +private theorem helper_missingEq_5953.{u_1, u_2} : + helperMissingEq5953Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + exact helper_missingEq_3719 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) + (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) + (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) + (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@j) + +private theorem helper_pathLe_6085.{u_1, u_2} : + helperPathLe6085Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + exact helper_pathLe_3869 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@AToT) + (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) + (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) + (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) + +private theorem helper_parallelBase_6126.{u_1, u_2} : + helperParallelBase6126Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A n Tn ib vb TnToA coreToR + hAib B rpB aboveB strictB belowB genB baseB hcoreB ettB sigma treeMissingEq corr baseS + closureBToA minusEq count stages hbbase hbterminal hbnested hbstrict positions hbpositive + hbincreasing hbdivider hbcore goodB hcore hpe hclosure positionsS hspositive hsincreasing + hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS storedEq + dsimp only + intro hp + have hpOld := hpe.mpr hp + have hc := hclosure hpOld + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := hsbase.symm.trans hbbase + change ¬TreeColorSetMinusClosed G sigma baseS.core + ((HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)) ∧ + 4 ≤ ((TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseS.closure) \ + (HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)).card + rw [← hcore, ← hc, storedEq, htree, + treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA), + treeMissingEq _ (closureBToA hpOld), + minusEq _ (by rw [hcoreB]; exact TreeSequenceInitialSegmentVertexSetSubset coreToR)] + exact goodB.parallelBase hpOld + +private theorem helper_segmentEq_6319.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (by + omega) + (by + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (_ : ∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))) + (_ : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (_ : + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (_ : + ∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) + (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + exact helper_segmentEq_5215 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + +private theorem helper_missingEq_6484.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (_ : TreeSequenceInitialSegment Tn A) (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (by + omega) + (by + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (_ : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))) + (_ : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + exact helper_missingEq_5953 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) + (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@j) + +private theorem helper_refreshEq_6699.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (by + omega) + (by + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (_ : + ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))) + (_ : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (_ : + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + exact helper_refreshEq_5225 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@i) + +private theorem helper_segmentEq_6920.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (by + omega) + (by + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (_ : ∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))) + (_ : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (_ : + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (_ : + ∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) + (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + exact helper_segmentEq_6319 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + +private theorem helper_missingEq_7097.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (_ : TreeSequenceInitialSegment Tn A) (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (by + omega) + (by + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (_ : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))) + (_ : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + exact helper_missingEq_6484 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) + (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@j) + +private theorem helper_refreshEq_7327.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (by + omega) + (by + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.rounds, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (_ : + ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))) + (_ : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (_ : + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + exact helper_refreshEq_6699 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@i) + +private theorem helper_storedEq_7501.{u_1, u_2} : + helperStoredEq7501Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact helper_storedEq_5179 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) + (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) + (@starBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +private theorem helper_segmentEq_7714.{u_1, u_2} : + helperSegmentEq7714Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + exact helper_segmentEq_6920 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + +private theorem helper_missingEq_7904.{u_1, u_2} : + helperMissingEq7904Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + exact helper_missingEq_7097 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) + (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@j) + +private theorem helper_refreshEq_8147.{u_1, u_2} : + helperRefreshEq8147Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + exact helper_refreshEq_7327 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@i) + +private theorem helper_storedEq_8334.{u_1, u_2} : + helperStoredEq8334Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact helper_storedEq_7501 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) + (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) + (@starBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +private theorem helper_continuation_5082.{u_1, u_2} : + helperContinuation5082Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hminimal alpha beta hne r H R hmaximal q A n Tn + Dn ib vb ell yLength Y segRefl segTrans coreToA TnToA AToT ordinaryToA starredToA + starPositive RToA coreToR ordinaryToR hb hAib missingStar hbetaA B BToT ABstrict BstrictT + rpB aboveB strictB belowB genB baseB hcoreB HB hcountB hstagesB hdividersB goodB hgoodB + ettB sigma unaffected missingBefore sigmaNotElementary missingA treeMissingEq incidentFixed + edgesFixed corr hMPS baseS HS hsame storedS + have hrS : corr.replacementETT.rounds = ett.rounds := corr.rungAgreement + have stageBToA (j : Fin (HB.dividerCount + 1)) : + TreeSequenceInitialSegment (HB.stage j.castSucc) A := by + clear * - hstagesB ordinaryToA j + rw [(hstagesB j).1] + exact ordinaryToA _ + have starBToA (j : Fin (HB.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage HB j) A := by + clear * - hstagesB starredToA j + rw [(hstagesB j).2] + exact starredToA _ + have stageBToB := + helper_stageBToB_1145 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@segRefl) (@segTrans) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) + (@baseB) (@HB) + have closureBToA := + helper_closureBToA_1152 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@r) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) + (@baseB) (@hcoreB) + have minusEq := + helper_minusEq_1160 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@RToA) + (@treeMissingEq) (@incidentFixed) + rcases HB with ⟨count, stages, hbbase, hbterminal, hbnested, hbstrict, positions, + hbpositive, hbincreasing, hbdivider, hbcore⟩ + rcases HS with ⟨countS, stagesS, hsbase, hsterminal, hsnested, hsstrict, positionsS, + hspositive, hsincreasing, hsdivider, hscore⟩ + rcases hsame with ⟨hcore, hcount, hstages, hpositions, hpe, hclosure⟩ + dsimp only at hcount hstages hpositions + cases hcount + have hstage : stages = stagesS := eq_of_heq hstages + cases hstage + let HB : TashkinovHierarchy ettB baseB := + ⟨count, stages, hbbase, hbterminal, hbnested, hbstrict, positions, + hbpositive, hbincreasing, hbdivider, hbcore⟩ + let HS : TashkinovHierarchy corr.replacementETT baseS := + ⟨count, stages, hsbase, hsterminal, hsnested, hsstrict, positionsS, + hspositive, hsincreasing, hsdivider, hscore⟩ + have starEq (j : Fin (count + 1)) : + HierarchyStarredStage HS j = HierarchyStarredStage HB j := by + exact Fin.cases hcore.symm (fun i => rfl) j + have storedEq (j : Fin (count + 1)) : + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + exact helper_storedEq_8334 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) + (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) + (@starBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) + (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + have missingEq := + helper_missingEq_7904 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) + (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) + (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) + (@hsnested) (@hsstrict) (@hsdivider) (@hscore) + -- A change only at the last vertex leaves the totalized first position unchanged. + have firstLe := + helper_firstLe_1215 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) + have firstStrict := + helper_firstStrict_1224 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@r) (@hAib) + have firstEq := + helper_firstEq_1234 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) + (@BToT) (@missingBefore) (@firstLe) (@firstStrict) + have segmentEq (j : Fin (count + 1)) (eta : Fin k) + (he : eta ∈ HierarchyStoredColorsAt HB j) := + helper_segmentEq_7714 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + have refreshEq (i : Fin count) : + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun v => MissingColors G phi v) := by + exact helper_refreshEq_8147 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@i) + let goodS : GoodHierarchy HS := + { gamma := goodB.gamma + twoColors := by intro j eta he; exact goodB.twoColors j eta (storedEq j ▸ he) + avoidance := by + intro j eta he + rw [missingEq, segmentEq j eta (storedEq j ▸ he)] + exact goodB.avoidance j eta (storedEq j ▸ he) + disjointPairs := by + intro j eta theta he ht hne + exact goodB.disjointPairs j eta theta (storedEq j ▸ he) (storedEq j ▸ ht) hne + uniqueRefresh := by + intro i + simpa only [storedEq, refreshEq] using goodB.uniqueRefresh i + parallelBase := by + exact helper_parallelBase_6126 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@r) (@TnToA) (@coreToR) (@hAib) (@rpB) (@aboveB) (@strictB) + (@belowB) (@genB) (@baseB) (@hcoreB) (@treeMissingEq) (@corr) (@baseS) (@closureBToA) + (@minusEq) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@goodB) (@hcore) + (@hpe) (@hclosure) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) + (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@storedEq) + minusClosed := by + intro i + rw [storedEq] + let jo := Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) i.succ + have hstage : HB.stage i.succ.castSucc = H.stage jo.castSucc := (hstagesB i.succ).1 + by_cases hj : jo.val ≤ r.val + · have hsub : TreeSequenceVertexSet (HB.stage i.succ.castSucc) ⊆ + TreeSequenceVertexSet R := by + rw [hstage] + exact TreeSequenceInitialSegmentVertexSetSubset (ordinaryToR jo hj) + rw [minusEq _ hsub] + exact goodB.minusClosed i + · have hjpos : jo.val ≠ 0 := by omega + have hm : alpha ∈ TreeMissingColors phi (HB.stage i.succ.castSucc) := by + rw [hstage, ← starPositive jo hjpos] + exact missingStar jo (by omega) + have hn : ¬ TreeColorSetClosed G phi (HB.stage i.succ.castSucc) {alpha} := by + rw [hstage, ← starPositive jo hjpos] + exact hmaximal jo (by omega) + have reserved : alpha ∈ (HierarchyStoredColorsAt HB i.succ).biUnion + (goodB.gamma i.castSucc) := by + by_contra hh + apply hn + intro c hc + have he : c = alpha := Finset.mem_singleton.mp hc + subst c + exact goodB.minusClosed i alpha (Finset.mem_sdiff.mpr ⟨hm, hh⟩) + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ))] + intro c hc + have hca : c ≠ alpha := by + intro he + subst c + exact (Finset.mem_sdiff.mp hc).2 reserved + have hcb : c ≠ beta := by + intro he + subst c + apply hbetaA + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp (Finset.mem_sdiff.mp hc).1 + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ) hv, hcv⟩ + have old := goodB.minusClosed i c hc + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + apply Finset.notMem_empty f + rw [← old] + obtain ⟨hb, hfc⟩ := Finset.mem_filter.mp hf + exact Finset.mem_filter.mpr ⟨hb, (unaffected f c hca hcb).mp hfc⟩ } + let CS : HierarchyCounterexample baseS := + { positive := by rw [hrS]; exact C.positive + hierarchy := HS + good := goodS + maximum := hMPS + notElementary := sigmaNotElementary } + have hstarLast := + helper_hstarLast_5324 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) + have hlastOrd : HS.stage (Fin.last count).castSucc = H.stage q.castSucc := by + have hs := (hstagesB (Fin.last count)).1 + have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := + Fin.ext (by simp [q]) + simpa only [hj] using hs + -- Path candidates restrict to the shorter prefix; the second measure decreases strictly. + have pathLe := + helper_pathLe_6085 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@AToT) (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) + (@genB) (@corr) (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) + (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) + have tailLess : B.length - (HS.stage (Fin.last count).castSucc).length < + T.length - (H.stage q.castSucc).length := by + clear * - hlastOrd ordinaryToA BstrictT ABstrict AToT + rw [hlastOrd] + have hlen := (ordinaryToA q).1 + omega + exact hminimal CS hrS hcountB (lexicographicMeasureDecreases pathLe tailLess) + +private theorem helper_continuation_4559.{u_1, u_2} : + helperContinuation4559Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge + alpha beta hne r H R hq hrq hclosed hmaximal q A n Tn Dn ia ib va vb ell yLength Y segRefl + segTrans commonPrefix coreToA TnToA AToT ordinaryToA starredToA starPositive rZero + rPositive RToA coreToR TnToR ordinaryToR hElementaryY ha hb vertexY haY hbY hout hAib + missingStar halphaR haR unusedRA hbetaA horder habIndex havb B BToT AToB ABstrict BToY + BstrictT rpB aboveB strictB belowB genB hMPB baseB hcoreB HB hcountB hstagesB hdividersB + goodB hgoodB ettB + have hinter := + helper_hinter_3502 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@hfewer) (@hlarge) (@alpha) (@beta) (@hne) (@r) (@hq) (@hrq) + (@hclosed) (@rZero) (@rPositive) (@halphaR) + by_contra hcomponents + let K := TwoColorComponent G phi alpha beta (Sum.inl vb) + let sigma := TwoColorComponentSwap G phi alpha beta (Sum.inl vb) + have pathMissing (v : V) (c d : Fin k) (hcd : c ≠ d) + (hc : c ∈ MissingColors G phi v) := + helper_pathMissing_662 (@G) (@k) (@phi) (@hproper) (@v) (@c) (@d) (@hcd) (@hc) + have pathA : TwoColorPathComponent G phi alpha beta (Sum.inl va) := + pathMissing va alpha beta hne ha.1 + have pathB := + helper_pathB_687 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@alpha) (@beta) + (@hne) (@r) (@hb) + have avoidR (v : V) (hv : v ∈ TreeSequenceVertexSet R) : Sum.inl v ∉ K := by + clear * - hcomponents hinter haR pathA pathB K hv + intro hK + exact hcomponents (hinter _ _ pathA pathB ⟨va, haR, rfl⟩ ⟨v, hv, hK⟩) + have haK : Sum.inl va ∉ K := avoidR va haR + have behavior := TwoColorComponentSwapMissingBehavior G phi alpha beta hne hproper + (Sum.inl vb) + have edgeOfVertex {v : V} {f : E} (hv : Sum.inl v ∈ K) + (hf : Incident G v f) (hc : phi f = some alpha ∨ phi f = some beta) : + Sum.inr f ∈ K := by + clear * - hv hf hc K + have hadj : (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inr f) (Sum.inl v) := + ⟨hf, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv + have unaffected := + helper_unaffected_722 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) + (@hne) (@r) (@ha) (@hb) + have fixedValue (f : E) (ha : phi f ≠ some alpha) (hb : phi f ≠ some beta) : + sigma f = phi f := by + clear * - ha hb sigma + simp [sigma, TwoColorComponentSwap, ha, hb] + have sigmaProper : IsProperEdgeColoring G sigma := + TwoColorComponentSwapProper G phi alpha beta hne hproper _ + have sigmaOne := + helper_sigmaOne_739 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hone) + (@alpha) (@beta) (@hne) + (@r) (@ha) (@hb) (@unaffected) + have vertexB (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : + T.vertex i ∈ TreeSequenceVertexSet B := by + clear * - i hi B + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have haB : va ∈ TreeSequenceVertexSet B := vertexB ia (le_of_lt habIndex) + have hbB : vb ∈ TreeSequenceVertexSet B := vertexB ib le_rfl + -- Elementarity fixes missing sets before the swapped endpoint, even inside its component. + have missingBefore (v : V) (hv : v ∈ TreeSequenceVertexSet B) (hvb : v ≠ vb) := + helper_missingBefore_764 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@hne) (@r) (@hElementaryY) (@ha) (@hb) (@haY) (@hbY) (@hAib) (@BToY) + (@haK) (@behavior) (@edgeOfVertex) (@v) (@hv) (@hvb) + have hnewa : alpha ∈ MissingColors G sigma va := by + rw [behavior.1 va haK] + exact ha.1 + have hnewb : alpha ∈ MissingColors G sigma vb := + behavior.2.2.1 vb (show Sum.inl vb ∈ K from rfl) hb.1 + have sigmaNotElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := + fun he => Finset.disjoint_left.mp (he haB hbB havb) hnewa hnewb + have missingA (v : V) (hv : v ∈ TreeSequenceVertexSet A) : + MissingColors G sigma v = MissingColors G phi v := + missingBefore v (TreeSequenceInitialSegmentVertexSetSubset AToB hv) + (by intro he; exact hout.2 (he ▸ hv)) + have treeMissingEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) : + TreeMissingColors sigma S = TreeMissingColors phi S := by + clear * - hS missingA + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => missingA v (hS hv)) + have incidentFixed := + helper_incidentFixed_818 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@r) (@ha) (@hb) (@avoidR) (@fixedValue) + have stable := + helper_stable_834 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@RToA) + (@missingA) (@incidentFixed) + have stableTn : StableColoring Tn Dn phi sigma := + stable Tn (TreeSequenceInitialSegmentVertexSetSubset TnToR) Dn + have TnToB := segTrans TnToA AToB + have TnStrictB : Tn.length < B.length := lt_of_le_of_lt TnToA.1 ABstrict + have BToFinal := segTrans BToT ett.belowFinal + -- Nonparallel extensions retain the certified connecting edge and one-edge seed. + have terminalRoute := + helper_terminalRoute_847 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@r) (@commonPrefix) (@hAib) (@TnToB) (@TnStrictB) (@BToFinal) + have displayedIncident := + helper_displayedIncident_896 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@r) + have augmentationFixed := + helper_augmentationFixed_3623 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@r) (@segRefl) (@segTrans) (@RToA) (@hElementaryY) (@hb) (@vertexY) + (@hbY) (@hAib) (@unusedRA) (@horder) (@BToT) (@AToB) (@fixedValue) (@incidentFixed) + (@displayedIncident) + have seedFixed := + helper_seedFixed_967 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@TnToR) + (@incidentFixed) + have edgesFixed := + helper_edgesFixed_981 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@TnToR) (@hAib) (@incidentFixed) (@TnToB) (@terminalRoute) + (@displayedIncident) + (@augmentationFixed) (@seedFixed) + have routeTransport := + helper_routeTransport_1000 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@r) (@segTrans) (@hAib) (@BToT) (@missingBefore) (@edgesFixed) + have replacement := + helper_replacement_3646 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hproper) (@hone) + (@hlower) (@alpha) (@beta) (@r) (@coreToR) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) + (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) + (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) + obtain ⟨corr, hMPS, baseS, HS, hsame⟩ := replacement + have storedS := + helper_storedS_1119 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@TnToA) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@treeMissingEq) (@corr) + exact helper_continuation_5082 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hminimal) (@alpha) (@beta) (@hne) (@r) (@hmaximal) (@segRefl) (@segTrans) (@coreToA) + (@TnToA) (@AToT) (@ordinaryToA) (@starredToA) (@starPositive) (@RToA) (@coreToR) + (@ordinaryToR) (@hb) (@hAib) (@missingStar) (@hbetaA) (@BToT) (@ABstrict) (@BstrictT) + (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@hcoreB) (@HB) (@hcountB) + (@hstagesB) (@hdividersB) (@goodB) (@hgoodB) (@unaffected) (@missingBefore) + (@sigmaNotElementary) (@missingA) (@treeMissingEq) (@incidentFixed) (@edgesFixed) (@corr) + (@hMPS) (@baseS) (@HS) (@hsame) (@storedS) +private theorem helper_continuation_4549.{u_1, u_2} : + helperContinuation4549Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal + hprefixElementary hlarge alpha beta hne horderedUnused hlocation r H R hq hrq hclosed + hmaximal q A n Tn Dn ia ib va vb ell yLength Y segRefl segTrans commonPrefix coreToA TnToA + AToT ordinaryToA starredToA starPositive rZero rPositive RToA coreToR TnToR ordinaryToR + YToT hmissingY hElementaryY firstMissing + have ha := firstMissing alpha hmissingY.1 + have hb := firstMissing beta hmissingY.2 + have vertexY (i : Fin (T.length + 1)) (hi : i.val ≤ Y.length) : + T.vertex i ∈ TreeSequenceVertexSet Y := by + clear * - i hi Y + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have haY : va ∈ TreeSequenceVertexSet Y := vertexY ia ha.2 + have hbY : vb ∈ TreeSequenceVertexSet Y := vertexY ib hb.2 + have hout : va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A := hlocation + have outsideIndex (i : Fin (T.length + 1)) + (hi : T.vertex i ∉ TreeSequenceVertexSet A) : A.length < i.val := by + exact helper_outsideIndex_386 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@AToT) (@i) (@hi) + have hAib := outsideIndex ib hout.2 + have AToY : TreeSequenceInitialSegment A Y := + commonPrefix AToT YToT (by omega) + have missingNotA := + helper_missingNotA_397 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@hne) (@r) (@hElementaryY) (@AToY) + have halphaA : alpha ∈ TreeMissingColors phi A := + Finset.mem_biUnion.mpr ⟨va, hout.1, ha.1⟩ + have elementaryStar (j : Fin (H.dividerCount + 1)) : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet (HierarchyStarredStage H j)) := by + exact helper_elementaryStar_409 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) + (@segTrans) (@starredToA) (@hElementaryY) (@AToY) (@j) + -- Missingness descends from an actual final-stage witness. + have descend : ∀ d (j : Fin (H.dividerCount + 1)), + H.dividerCount ≤ j.val + d → r.val ≤ j.val → + alpha ∈ TreeMissingColors phi (HierarchyStarredStage H j) := by + exact helper_descend_417 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hne) (@r) + (@hmaximal) (@halphaA) (@elementaryStar) + have missingStar (j : Fin (H.dividerCount + 1)) (hj : r.val ≤ j.val) : + alpha ∈ TreeMissingColors phi (HierarchyStarredStage H j) := + descend H.dividerCount j (by omega) hj + have halphaR : alpha ∈ TreeMissingColors phi R := missingStar r le_rfl + have haR := + helper_haR_458 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@r) + (@segTrans) (@AToT) (@RToA) (@ha) (@halphaR) + have preStepElementary : + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + ColoredVertexSetElementary G (ett.series.data.coloring j.castSucc) + (TreeSequenceVertexSet Tn) := by + clear * - ett C hlower Tn n + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + change ColoredVertexSetElementary G (ett.series.data.coloring j.castSucc) + (TreeSequenceVertexSet Tn) + intro u hu v hv huv + by_cases hn : 1 < ett.rounds + · exact @helper_branch_487 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hlower) (@u) (@hu) (@v) (@hv) + (@huv) (@hn) + · exact @helper_branch_501 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@u) (@hu) (@v) (@hv) (@huv) (@hn) + have unusedRA : alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin A.length, R.length ≤ t.val ∧ phi (A.edge t) = some c) := + (rutcor G k e0 input T phi ett base H C.good hq hprefixElementary + preStepElementary alpha halphaA).1 ⟨r, hclosed⟩ r hclosed hmaximal + have hbetaA : beta ∉ TreeMissingColors phi A := missingNotA beta ib hb.1 hbY hout.2 + have horder := horderedUnused (Or.inr hbetaA) + have habIndex := + helper_habIndex_519 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@horder) + have havb : va ≠ vb := by + clear * - habIndex + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + omega + -- Keep the exact ordered prefix ending at the beta-missing vertex. + let B := TreeSequencePrefix T ib.val (by have := A.positive; omega) + (Nat.le_of_lt_succ ib.isLt) + have BToT : TreeSequenceInitialSegment B T := + ⟨Nat.le_of_lt_succ ib.isLt, (by intro i; rfl), (by intro i; rfl)⟩ + have AToB : TreeSequenceInitialSegment A B := commonPrefix AToT BToT (by exact le_of_lt hAib) + have ABstrict : A.length < B.length := hAib + have BToY : TreeSequenceInitialSegment B Y := commonPrefix BToT YToT hb.2 + have BstrictT := + helper_BstrictT_538 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@AToT) + (@hAib) (@ABstrict) (@BToY) + obtain ⟨ettB, hMPB, hrB, hsB, baseB, hcoreB, hclosureB, hsupportB, + HB, hcountB, hstagesB, hdividersB, goodB, hgoodB⟩ := + GoodHierarchyTerminalPrefixRepackage G k e0 input T phi phi ett C.maximum + base H C.good B AToB ABstrict BToT + rcases ettB with ⟨rB, rpB, seriesB, aboveB, strictB, belowB, genB⟩ + cases hrB + have heqB : seriesB = ett.series := eq_of_heq hsB + cases heqB + let ettB : ExtendedTashkinovTree G k e0 input B phi := + ⟨ett.rounds, rpB, ett.series, aboveB, strictB, belowB, genB⟩ + exact helper_continuation_4559 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hproper) (@hone) (@hlower) (@hfewer) (@hminimal) (@hlarge) (@alpha) (@beta) (@hne) (@r) + (@hq) (@hrq) (@hclosed) (@hmaximal) (@segRefl) (@segTrans) (@commonPrefix) (@coreToA) + (@TnToA) (@AToT) (@ordinaryToA) (@starredToA) (@starPositive) (@rZero) (@rPositive) (@RToA) + (@coreToR) (@TnToR) (@ordinaryToR) (@hElementaryY) (@ha) (@hb) (@vertexY) (@haY) (@hbY) + (@hout) (@hAib) (@missingStar) (@halphaR) (@haR) (@unusedRA) (@hbetaA) (@horder) + (@habIndex) (@havb) (@BToT) (@AToB) (@ABstrict) (@BToY) (@BstrictT) (@rpB) (@aboveB) + (@strictB) (@belowB) (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@hcountB) (@hstagesB) + (@hdividersB) (@goodB) (@hgoodB) +theorem ChangeLemmaMixedLargestClosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty) + (horderedUnused : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + (alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c)) + (hlocation : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + va ∈ TreeSequenceVertexSet A ∧ + vb ∉ TreeSequenceVertexSet A) + (r : Fin (C.hierarchy.dividerCount + 1)) + (hbranch : + let H := C.hierarchy + 0 < H.dividerCount ∧ + r.val < H.dividerCount ∧ + TreeColorSetClosed G phi (HierarchyStarredStage H r) {alpha} ∧ + ∀ s : Fin (H.dividerCount + 1), r.val < s.val → + ¬ TreeColorSetClosed G phi + (HierarchyStarredStage H s) {alpha}) + : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let _ := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let sameComponent := + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) + sameComponent := by + classical + let H := C.hierarchy + let R := HierarchyStarredStage H r + have hq : 0 < H.dividerCount := hbranch.1 + have hrq : r.val < H.dividerCount := hbranch.2.1 + have hclosed : TreeColorSetClosed G phi R {alpha} := hbranch.2.2.1 + have hmaximal : ∀ s : Fin (H.dividerCount + 1), r.val < s.val → + ¬ TreeColorSetClosed G phi (HierarchyStarredStage H s) {alpha} := hbranch.2.2.2 + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + let va := T.vertex ia + let vb := T.vertex ib + let ell := T.length - A.length + let yLength := min (A.length + (ell - 1)) T.length + let Y := TreeSequencePrefix T yLength + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have segRefl (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) := + helper_segTrans_213 (@G) (@e0) (@hSU) (@hUW) + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) := + helper_commonPrefix_223 (@G) (@e0) (@hSW) (@hUW) (@hlen) + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) := + helper_stageSegment_233 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) + (@segRefl) (@segTrans) (@a) (@d) (@hbound) + have stageToT := + helper_stageToT_241 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) + (@stageSegment) + have lastZero (hz : H.dividerCount = 0) : A = base.core := by + clear * - hz A q + simp [A, q, HierarchyStarredStage, hz, Fin.last] + have lastPositive := + helper_lastPositive_252 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) + have coreToA := + helper_coreToA_264 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) + (@segRefl) (@segTrans) (@stageSegment) (@lastZero) (@lastPositive) + have TnToCore := + helper_TnToCore_273 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@segRefl) + have TnToA := segTrans TnToCore coreToA + have AToT := + helper_AToT_280 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) + (@segTrans) (@stageToT) (@lastZero) (@lastPositive) + have ordinaryToA := + helper_ordinaryToA_287 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) + (@stageSegment) (@lastZero) (@lastPositive) (@TnToA) + have starredToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + exact Fin.cases coreToA (fun i => ordinaryToA i.succ) j + have starPositive := + helper_starPositive_301 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + have coreToStar := + helper_coreToStar_308 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) + (@segRefl) (@segTrans) (@stageSegment) (@starPositive) + have rZero (hz : r.val = 0) : R = base.core := by + have hr : r = 0 := Fin.ext hz + simp [R, hr, HierarchyStarredStage] + have rPositive (hz : r.val ≠ 0) : R = H.stage r.castSucc := + starPositive r hz + have RToA : TreeSequenceInitialSegment R A := starredToA r + have coreToR : TreeSequenceInitialSegment base.core R := coreToStar r + have TnToR := segTrans TnToCore coreToR + have ordinaryToR := + helper_ordinaryToR_330 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) + (@hrq) + (@stageSegment) (@rZero) (@rPositive) (@TnToR) + have YToT : TreeSequenceInitialSegment Y T := + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + have hmissingY : alpha ∈ TreeMissingColors phi Y ∧ beta ∈ TreeMissingColors phi Y := + hmissingPrefix + have hElementaryY : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) := + hprefixElementary + have firstMissing := + helper_firstMissing_354 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) + (@YToT) + exact helper_continuation_4549 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hproper) (@hone) (@hlower) (@hfewer) (@hminimal) (@hprefixElementary) (@hlarge) (@alpha) + (@beta) (@hne) (@horderedUnused) (@hlocation) (@r) (@hq) (@hrq) (@hclosed) (@hmaximal) + (@segRefl) (@segTrans) (@commonPrefix) (@coreToA) (@TnToA) (@AToT) (@ordinaryToA) + (@starredToA) (@starPositive) (@rZero) (@rPositive) (@RToA) (@coreToR) (@TnToR) + (@ordinaryToR) (@YToT) (@hmissingY) (@hElementaryY) (@firstMissing) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean new file mode 100644 index 0000000000..6212bcf94b --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean @@ -0,0 +1,5838 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +public import LeanPool.GoldbergSeymour.MixedNoClosedTransport + +/-! +# Change Lemma Mixed No Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open MixedNoClosedTransport + +private abbrev helperContinuation4887Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hminimal : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (alpha beta : Fin k) (hne : alpha ≠ beta), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (coreToA : TreeSequenceInitialSegment base.core A) (TnToA : TreeSequenceInitialSegment Tn A) + (AToT : TreeSequenceInitialSegment A T) + (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) + (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (Nat.le_of_lt_succ ib.isLt); + ∀ (BToT : TreeSequenceInitialSegment B T) (ABstrict : A.length < B.length) + (BstrictT : B.length < T.length) (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) + (belowB : TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (hcoreB : baseB.core = base.core), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (missingBefore : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet B) (hvb : v ≠ vb), + MissingColors G sigma v = MissingColors G phi v) + (sigmaNotElementary : ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B)) + (missingA : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet A), + MissingColors G sigma v = MissingColors G phi v) + (treeMissingEq : + ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A), + TreeMissingColors sigma S = TreeMissingColors phi S) + (edgesFixed : ∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (hMPS : MaximumProperty corr.replacementETT) (baseS : HierarchyBase corr.replacementETT sigma) + (hrS : corr.replacementETT.rounds = ett.rounds) + (closureBToA : + ∀ (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A) + (minusEq : + ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) + (D : Finset (Fin k)) (haD : alpha ∈ D), + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D) + (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount) + (hstagesB : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage (Fin.cast (by omega) j).castSucc ∧ + HierarchyStarredStage + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H (Fin.cast (by omega) j)) + (goodB : + GoodHierarchy + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }) + (stageBToA : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) + (stageBToB : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) + (reservedB : + ∀ + (i : + Fin + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount), + alpha ∈ + (HierarchyStoredColorsAt + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + i.succ).biUnion + (goodB.gamma i.castSucc)) + (reservedZeroB : + alpha ∈ + (HierarchyStoredColorsAt + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + (0 : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ)))).biUnion + (goodB.gamma + (0 : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))))) + (hcore : baseB.core = baseS.core) + (hpe : + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.kind + (Fin.last + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.kind + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = baseS.closure) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (starEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (storedEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j), + False + +private abbrev helperContinuation5697Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hminimal : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hbranch : + let H : TashkinovHierarchy ett base := C.hierarchy; + (0 : ℕ) < H.dividerCount ∧ + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), + ¬TreeColorSetClosed G phi (HierarchyStarredStage H s) ({ alpha } : Finset (Fin k))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ Tn.length := Tn.positive; + Decidable.byContradiction fun (a : ¬yLength ≤ T.length) ↦ by omega); + ∀ (segRefl : ∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) + (segTrans : + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) + (coreToA : TreeSequenceInitialSegment base.core A) (TnToA : TreeSequenceInitialSegment Tn A) + (AToT : TreeSequenceInitialSegment A T) + (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) + (starredToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) + (hElementaryY : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y)) + (ha : + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length) + (haY : va ∈ TreeSequenceVertexSet Y) (hAib : A.length < (↑ib : ℕ)) + (AToY : TreeSequenceInitialSegment A Y) (hbetaA : beta ∉ TreeMissingColors phi A), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (Nat.le_of_lt_succ ib.isLt); + ∀ (BToT : TreeSequenceInitialSegment B T) (ABstrict : A.length < B.length) + (BstrictT : B.length < T.length) (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) + (belowB : TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (hMPB : + MaximumProperty + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }) + (baseB : + HierarchyBase + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (hcoreB : baseB.core = base.core) (hclosureB : baseB.closure = base.closure) + (HB : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (hcountB : HB.dividerCount = H.dividerCount) + (hstagesB : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HB.stage j.castSucc = H.stage (Fin.cast (by omega) j).castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H (Fin.cast (by omega) j)) + (hdividersB : + ∀ (i : Fin HB.dividerCount), + (↑(HB.dividerPosition i) : ℕ) = (↑(H.dividerPosition (Fin.cast hcountB i)) : ℕ)) + (goodB : GoodHierarchy HB) + (hgoodB : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt HB j = HierarchyStoredColorsAt H (Fin.cast (by omega) j) ∧ + HierarchyStageMissingColors HB j = HierarchyStageMissingColors H (Fin.cast (by omega) j) ∧ + ∀ (eta : Fin k), + goodB.gamma j eta = + C.good.gamma (Fin.cast (by exact congrArg (fun n : ℕ => n + 1) hcountB) j) eta ∧ + HierarchySegmentColors HB j eta ⊆ HierarchySegmentColors H (Fin.cast (by omega) j) eta), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + ∀ + (preElementary : + ColoredVertexSetElementary G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + have this : (1 : ℕ) ≤ ett.rounds := ett.roundsPositive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by + omega⟩ : + Fin (ett.rounds + (1 : ℕ)))) + (TreeSequenceVertexSet Tn)) + (reserved : + ∀ (j : Fin H.dividerCount), + alpha ∈ (HierarchyStoredColorsAt H j.succ).biUnion (C.good.gamma j.castSucc) ∧ + alpha ∈ (HierarchyStoredColorsAt H j.castSucc).biUnion (C.good.gamma j.castSucc)) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) + (haOutsideClosure : va ∉ TreeSequenceVertexSet base.closure), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (unaffected : + ∀ (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta), sigma f = some c ↔ phi f = some c) + (fixedValue : ∀ (f : E) (ha : phi f ≠ some alpha) (hb : phi f ≠ some beta), sigma f = phi f) + (sigmaProper : IsProperEdgeColoring G sigma) (sigmaOne : IsOneEdgeUncolored sigma e0) + (missingBefore : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet B) (hvb : v ≠ vb), + MissingColors G sigma v = MissingColors G phi v) + (sigmaNotElementary : ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B)) + (missingA : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet A), + MissingColors G sigma v = MissingColors G phi v) + (treeMissingEq : + ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A), + TreeMissingColors sigma S = TreeMissingColors phi S) + (stableTn : StableColoring Tn Dn phi sigma) + (terminalRoute : TashkinovAugmentationSequence phi Tn B) + (edgesFixed : ∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) + (routeTransport : + ∀ (S : TreeSequence G e0) (hs : TashkinovAugmentationSequence phi S B), + TashkinovAugmentationSequence sigma S B) + (closureSubset : TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A), False + +private abbrev helperContinuation2989Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + (0 : ℕ) < H.dividerCount ∧ + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), + ¬TreeColorSetClosed G phi (HierarchyStarredStage H s) ({ alpha } : Finset (Fin k))) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive Tn + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive Tn + omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + TreeSequenceInitialSegment Y T → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + va ∈ TreeSequenceVertexSet Y → + vb ∈ TreeSequenceVertexSet Y → + va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A → + A.length < (↑ib : ℕ) → + TreeSequenceInitialSegment A Y → + (∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let _ : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + let sameComponent : Prop := + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb); + sameComponent + +private abbrev helperPathLe3336Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) + (belowB : TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : + TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H + +private abbrev helperHless4484Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (coreToA : TreeSequenceInitialSegment base.core A) (TnToA : TreeSequenceInitialSegment Tn A) + (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (Nat.le_of_lt_succ ib.isLt); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) + (belowB : TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (hcoreB : baseB.core = base.core), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (sigmaNotElementary : ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B)) + (treeMissingEq : + ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A), + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (hMPS : MaximumProperty corr.replacementETT) (baseS : HierarchyBase corr.replacementETT sigma) + (hrS : corr.replacementETT.rounds = ett.rounds) + (closureBToA : + ∀ (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A) + (minusEq : + ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) + (D : Finset (Fin k)) (haD : alpha ∈ D), + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D) + (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (goodB : + GoodHierarchy + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }) + (stageBToA : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) + (reservedB : + ∀ + (i : + Fin + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount), + alpha ∈ + (HierarchyStoredColorsAt + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + i.succ).biUnion + (goodB.gamma i.castSucc)) + (reservedZeroB : + alpha ∈ + (HierarchyStoredColorsAt + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + (0 : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ)))).biUnion + (goodB.gamma + (0 : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))))) + (hcore : baseB.core = baseS.core) + (hpe : + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.kind + (Fin.last + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.kind + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = baseS.closure) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (storedEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j) + (missingEq : + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j) + (segmentEq : + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k) (he : eta ∈ HierarchyStoredColorsAt HB j), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta) + (refreshEq : + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v), + let goodS : GoodHierarchy HS := + { + gamma := goodB.gamma, + twoColors := + fun (j : Fin (HS.dividerCount + (1 : ℕ))) (eta : Fin k) + (he : eta ∈ HierarchyStoredColorsAt HS j) ↦ + goodB.twoColors j eta (storedEq j ▸ he), + avoidance := + fun (j : Fin (HS.dividerCount + (1 : ℕ))) (eta : Fin k) + (he : eta ∈ HierarchyStoredColorsAt HS j) ↦ + ((Eq.symm + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ goodB.gamma j eta ⊆ _a \ HierarchySegmentColors HS j eta) + (missingEq j)))) ▸ + ((Eq.symm + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + goodB.gamma j eta ⊆ HierarchyStageMissingColors HB j \ _a) + (segmentEq j eta (storedEq j ▸ he))))) ▸ + goodB.avoidance j eta (storedEq j ▸ he))), + disjointPairs := + fun (j : Fin (HS.dividerCount + (1 : ℕ))) (eta theta : Fin k) + (he : eta ∈ HierarchyStoredColorsAt HS j) (ht : theta ∈ HierarchyStoredColorsAt HS j) + (hne : eta ≠ theta) ↦ + goodB.disjointPairs j eta theta (storedEq j ▸ he) (storedEq j ▸ ht) hne, + uniqueRefresh := fun (i : Fin HS.dividerCount) ↦ + ((Eq.symm + (id + (congrArg ExistsUnique + (funext fun (eta : Fin k) ↦ + congr + (congrArg And + (congrFun' + (congrArg Membership.mem ((fun (j : Fin (count + (1 : ℕ))) ↦ storedEq j) i.succ)) + eta)) + (congr + (congrArg And + (congrArg (LE.le (goodB.gamma i.succ eta)) + ((fun (i : Fin count) ↦ refreshEq i) i))) + (forall_congr fun (theta : Fin k) ↦ + implies_congr + (congrFun' + (congrArg Membership.mem + ((fun (j : Fin (count + (1 : ℕ))) ↦ storedEq j) i.succ)) + theta) + (Eq.refl + (theta ≠ eta → goodB.gamma i.succ theta = goodB.gamma i.castSucc theta)))))))) ▸ + goodB.uniqueRefresh i), + parallelBase := + helper_parallelBase_4040 G k e0 input T phi ett base C alpha beta coreToA TnToA hAib rpB + aboveB strictB belowB genB baseB hcoreB treeMissingEq corr baseS closureBToA minusEq + count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing + hbdivider hbcore goodB reservedZeroB hcore hpe hclosure positionsS hspositive + hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore storedEq, + minusClosed := fun (i : Fin HS.dividerCount) ↦ + ((Eq.symm + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + TreeColorSetMinusClosed G sigma (HS.stage i.succ.castSucc) + (_a.biUnion (goodB.gamma i.castSucc))) + (storedEq i.succ)))) ▸ + ((Eq.symm + (id + (congrArg (fun (_a : Prop) ↦ _a) + (propext + (minusEq + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + i.succ.castSucc) + (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) + ((HierarchyStoredColorsAt + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + i.succ).biUnion + (goodB.gamma i.castSucc)) + (reservedB i)))))) ▸ + goodB.minusClosed i)) : + GoodHierarchy HS }; + let CS : HierarchyCounterexample baseS := + { + positive := by omega, hierarchy := HS, good := goodS, maximum := hMPS, + notElementary := sigmaNotElementary : HierarchyCounterexample baseS }; + ∀ (pathLe : HierarchyPathNumber HS ≤ HierarchyPathNumber H) + (tailLess : + B.length - (HS.stage (Fin.last count).castSucc).length < + T.length - (H.stage q.castSucc).length), + HierarchyCounterexampleLess (HierarchyCounterexampleMeasure CS) + (HierarchyCounterexampleMeasure C) + +private theorem helper_segTrans_202.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W := by + classical + intro V E G e0 S U W hSU hUW + refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + +private theorem helper_commonPrefix_212.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U := by + classical + intro V E G e0 S U W hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +private theorem helper_stageSegment_222.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H segRefl segTrans a d hbound + induction d with + | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + +private theorem helper_stageToT_230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (H.stage j) T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H stageSegment j + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) + simpa [he, H.terminalStage] using hs + +private theorem helper_lastPositive_241.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hz + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm + +private theorem helper_coreToA_253.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment base.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A segRefl segTrans stageSegment lastZero + lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segRefl _ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + +private theorem helper_TnToCore_262.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + TreeSequenceInitialSegment Tn base.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base n Tn segRefl + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (base.parallel hp).2.2).leftSegment + · rw [base.nonparallel hp] + exact segRefl _ + +private theorem helper_AToT_269.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A segTrans stageToT lastZero lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) + · rw [lastPositive hz] + exact stageToT _ + +private theorem helper_ordinaryToA_276.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment Tn A → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n Tn stageSegment lastZero lastPositive + TnToA j + by_cases hz : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) + rw [hj, H.baseStage] + exact TnToA + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + rw [lastPositive hz] + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> + simp only [Fin.val_castSucc]; omega + +private theorem helper_firstMissing_296.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment Y T → + ∀ c ∈ TreeMissingColors phi Y, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell yLength Y YToT c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let it := Fin.castLE (Nat.succ_le_succ YToT.1) i + have hci : c ∈ MissingColors G phi (T.vertex it) := by + rw [YToT.2.1 i, hi] + exact hcv + let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) + have hit : it ∈ candidates := by simp [candidates, hci] + have hnon : candidates.Nonempty := ⟨it, hit⟩ + have hmem := Finset.min'_mem candidates hnon + have hle := Finset.min'_le candidates it hit + refine ⟨?_, ?_⟩ + · simpa [HierarchyFirstMissingPosition, candidates, hnon] using + (Finset.mem_filter.mp hmem).2 + · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt + have hval : (candidates.min' hnon).val ≤ it.val := hle + simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv + +private theorem helper_outsideIndex_328.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + ∀ (i : Fin (T.length + (1 : ℕ))), + T.vertex i ∉ TreeSequenceVertexSet A → + A.length < (↑i : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A AToT i hi + by_contra h + have hle : i.val ≤ A.length := by omega + apply hi + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ + +private theorem helper_missingNotA_339.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + TreeSequenceInitialSegment A Y → + ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ell yLength Y hElementaryY + AToY c i hmi hiy hia + clear * - hmi hiy hia AToY hElementaryY + intro hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) + exact (Finset.disjoint_left.mp + (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi + +private theorem helper_habIndex_353.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + (↑ia : ℕ) < (↑ib : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta ia ib horder + obtain ⟨i, j, hi, hj, hij⟩ := horder.1 + have hei := T.vertex_injective hi + have hej := T.vertex_injective hj + simpa [hei, hej] using hij + +private theorem helper_BstrictT_372.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + A.length < B.length → + TreeSequenceInitialSegment B Y → + B.length < T.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib ell yLength Y AToT hAib B + ABstrict BToY + clear * - AToT BToY ABstrict Y + have hAT := AToT.1 + have hY : Y.length = min (A.length + (T.length - A.length - 1)) T.length := rfl + have hBY := BToY.1 + have hAB := ABstrict + omega + +private theorem helper_branch_398.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + {u : V}, + ¬(1 : ℕ) < ett.rounds → + u ∈ TreeSequenceVertexSet Tn → + ∀ {v : V}, + v ∈ TreeSequenceVertexSet Tn → + u ≠ v → + Disjoint + (MissingColors G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ)))) + u) + (MissingColors G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ)))) + v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib hAib B rpB aboveB + strictB belowB genB baseB HB _ hn + have hn1 : ett.rounds = 1 := by have := ett.roundsPositive; omega + have hzero : (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) = 0 := + Fin.ext (by simp [hn1]) + have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn1]) + intro hu v hv huv + have hTn1 : Tn = ett.series.data.tree ⟨1, by omega⟩ := + congrArg ett.series.data.tree htree + rw [hTn1] at hu hv + rw [hzero] + exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 hu hv huv + +private theorem helper_hinter_417.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (_ : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + alpha ∈ TreeMissingColors phi Tn → + TreeInterchangeable G Tn phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta n Tn Dn hPE + halphaTn + have hs : CombinedStableColoring Tn base.closure Dn phi phi := + ⟨⟨(by intros; rfl), (by intros; rfl)⟩, + ⟨(by intros; rfl), (by intros; rfl)⟩⟩ + exact (interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hPE base hproper hone hs alpha beta).2.1 halphaTn + +private theorem helper_pathMissing_426.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi), + IsProperEdgeColoring G phi → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (v : V) (c d : Fin k), + c ≠ d → + c ∈ MissingColors G phi v → + TwoColorPathComponent G phi c d (Sum.inl v) := by + classical + intro V E _ _ _ G k e0 input T phi ett hproper _ v c d hcd hc + clear * - hc hcd hproper + refine ⟨hcd, Sum.inl v, rfl, ?_⟩ + intro x hx y hy + cases x with + | inr f => + cases y with + | inr g => + have hfc : phi f = some d := hx.2.resolve_left (by + intro he + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) + have hgc : phi g = some d := hy.2.resolve_left (by + intro he + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) + congr 1 + by_contra hfg + exact hproper hfg ⟨v, hx.1, hy.1⟩ hfc hgc + | inl w => exact False.elim hy + | inl w => exact False.elim hx + +private theorem helper_pathB_451.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + TwoColorPathComponent G phi alpha beta (Sum.inl vb) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper _ alpha beta hne H q A ib vb ell + yLength Y hb + clear * - hb hproper hne + refine ⟨hne, Sum.inl vb, rfl, ?_⟩ + intro x hx y hy + cases x with + | inr f => + cases y with + | inr g => + have hfc : phi f = some alpha := hx.2.resolve_right (by + intro he + exact (Finset.mem_sdiff.mp hb.1).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) + have hgc : phi g = some alpha := hy.2.resolve_right (by + intro he + exact (Finset.mem_sdiff.mp hb.1).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) + congr 1 + by_contra hfg + exact hproper hfg ⟨vb, hx.1, hy.1⟩ hfc hgc + | inl w => exact False.elim hy + | inl w => exact False.elim hx + +private theorem helper_unaffected_486.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta + (Sum.inl vb); + ∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ib vb ell yLength Y ha hb + K sigma f c hca hcb + clear * - hca hcb K sigma hne + by_cases hf : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hca.symm, hcb.symm] + · by_cases hb : phi f = some beta + · simp [sigma, TwoColorComponentSwap, K, hf, hb, hne.symm, + hca.symm, hcb.symm] + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hb] + · simp [sigma, TwoColorComponentSwap, K, hf] + +private theorem helper_sigmaOne_503.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta hne H q A ib vb ell yLength Y + ha hb K sigma unaffected + clear * - hone sigma K unaffected hne + refine ⟨?_, ?_⟩ + · simp [sigma, TwoColorComponentSwap, hone.1] + · intro f hf + obtain ⟨c, hc⟩ := hone.2 f hf + by_cases ha : c = alpha + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · by_cases hb : c = beta + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc, hne.symm]⟩ + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨c, (unaffected f c ha hb).mpr hc⟩ + +private theorem helper_missingBefore_528.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + va ∈ TreeSequenceVertexSet Y → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B Y → + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + Sum.inl va ∉ K → + (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → + (∀ {v : V} {f : E}, + Sum.inl v ∈ K → + Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ K) → + ∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → + MissingColors G sigma v = MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ia ib va vb ell yLength Y + hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb + by_cases hvK : Sum.inl v ∈ K + · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) + have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv + have han : alpha ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 + have hbn : beta ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 + have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by + simpa [MissingColors, PresentColors] using han + have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by + simpa [MissingColors, PresentColors] using hbn + obtain ⟨fa, hfa, hfca⟩ := hpa + obtain ⟨fb, hfb, hfcb⟩ := hpb + have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) + have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) + have hnewa : sigma fb = some alpha := by + simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] + have hnewb : sigma fa = some beta := by + simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] + have hana : alpha ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fb, hfb, hnewa⟩ + have hbnb : beta ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fa, hfa, hnewb⟩ + ext c + by_cases hca : c = alpha + · subst c; simp [hana, han] + · by_cases hcb : c = beta + · subst c; simp [hbnb, hbn] + · exact behavior.2.2.2 v c hca hcb + · exact behavior.1 v hvK + +private theorem helper_incidentFixed_582.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet Tn, Sum.inl v ∉ K) → + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + ∀ (f : E), + TreeIncidentEdge Tn f → + sigma f = phi f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb ell yLength Y ha hb + K sigma avoidTn fixedValue f hf + clear * - hf sigma K avoidTn fixedValue + obtain ⟨v, hv, hvf⟩ := hf + by_cases hK : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · exact False.elim (avoidTn v hv + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, Or.inl ha⟩)).trans hK)) + · by_cases hb : phi f = some beta + · exact False.elim (avoidTn v hv + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, Or.inr hb⟩)).trans hK)) + · exact fixedValue f ha hb + · simp [sigma, TwoColorComponentSwap, K, hK] + +private theorem helper_terminalRoute_605.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceInitialSegment Tn B → + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ)))) → + TashkinovAugmentationSequence phi Tn B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib hAib B hPE TnToB BToFinal + clear * - ett C n Tn B BToFinal TnToB hPE + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => + have hv := congrArg Fin.val hi + simp [n] at hv + have := C.positive + omega + | SE j _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hp := hPE + change ett.series.data.kind n = some TashkinovExtensionKind.PE at hp + rw [hi, kind] at hp + cases hp + | RE j _ _ _ _ available coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hp := hPE + change ett.series.data.kind n = some TashkinovExtensionKind.PE at hp + rw [hi, kind] at hp + cases hp + | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + apply TashkinovAugmentationSequenceRestrict phi Tn B _ _ TnToB BToFinal + simpa [Tn, hj, hlast, ← ett.generatingColoring, n] using closure.1 + +private theorem helper_displayedIncident_634.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S Tn → + ∀ (t : Fin S.length), + TreeIncidentEdge Tn (S.edge t) := by + classical + intro V E _ _ _ G k e0 input T phi ett n Tn S hSTn t + obtain ⟨i, hi⟩ := S.attaches t + refine ⟨S.vertex t.succ, TreeSequenceInitialSegmentVertexSetSubset hSTn + (by simp [TreeSequenceVertexSet]), ?_⟩ + simp [Incident, hi] + +private theorem helper_augmentationFixed_642.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A B → + alpha ∉ + ({c : Fin k | + ∃ (t : Fin (HierarchyStarredStage H (Fin.last H.dividerCount)).length), + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length ≤ (↑t : ℕ) ∧ + phi ((HierarchyStarredStage H (Fin.last H.dividerCount)).edge t) = some c} : + Finset (Fin k)) → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + TashkinovAugmentationSequence phi Tn B → + ∀ (t : Fin B.length), + Tn.length ≤ (↑t : ℕ) → + sigma (B.edge t) = phi (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb ell yLength Y + hElementaryY hb vertexY hbY hAib horder B BToT AToB alphaUnused sigma fixedValue + terminalRoute t ht + have hstep := (TashkinovAugmentationSequencePosition phi Tn B terminalRoute t ht).1 + obtain ⟨hl, hinit, c, hcol, hm⟩ := hstep + have hcolB : phi (B.edge t) = some c := by + convert hcol using 1 + congr 2 + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨iv, hiv⟩ := hv + let ivT : Fin (T.length + 1) := ⟨iv.val, by + have htB := BToT.1 + have := iv.isLt + simp only [TreeSequencePrefix] at this + omega⟩ + have hcvT : c ∈ MissingColors G phi (T.vertex ivT) := by + have he : (TreeSequencePrefix B t.val (le_trans Tn.positive ht) + (Nat.le_of_lt t.isLt)).vertex iv = T.vertex ivT := rfl + rw [← he, hiv] + exact hcv + have hnotA : c ≠ alpha := by + intro he + subst c + by_cases htA : t.val < A.length + · apply alphaUnused + let ta : Fin A.length := ⟨t.val, htA⟩ + have he := AToB.2.2 ta + have hi : Fin.castLE AToB.1 ta = t := Fin.ext rfl + rw [hi] at he + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, ta, ht, by rw [← he]; exact hcolB⟩ + · apply horder.2 + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, Fin.castLE BToT.1 t, + by change A.length ≤ t.val; omega, t.isLt, + by rw [BToT.2.2 t]; exact hcolB⟩ + have hnotB : c ≠ beta := by + intro he + subst c + have hivB : ivT.val < ib.val := by + have := iv.isLt + simp only [TreeSequencePrefix] at this + have htB : t.val < ib.val := t.isLt + dsimp [ivT] + omega + have hvY := vertexY ivT (by omega) + have hneV : T.vertex ivT ≠ vb := by + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + omega + exact Finset.disjoint_left.mp (hElementaryY hvY hbY hneV) hcvT hb.1 + exact fixedValue _ (fun hc => hnotA (Option.some.inj (hcolB.symm.trans hc))) + (fun hc => hnotB (Option.some.inj (hcolB.symm.trans hc))) + +private theorem helper_edgesFixed_695.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), TreeIncidentEdge Tn f → sigma f = phi f) → + TreeSequenceInitialSegment Tn B → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S Tn → + ∀ (t : Fin S.length), TreeIncidentEdge Tn (S.edge t)) → + (∀ (t : Fin B.length), Tn.length ≤ (↑t : ℕ) → sigma (B.edge t) = phi (B.edge t)) → + ∀ (t : Fin B.length), + sigma (B.edge t) = phi (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb segRefl hAib B + sigma incidentFixed TnToB displayedIncident augmentationFixed t + by_cases ht : t.val < Tn.length + · have he := TnToB.2.2 ⟨t.val, ht⟩ + have hi : Fin.castLE TnToB.1 ⟨t.val, ht⟩ = t := Fin.ext rfl + rw [hi] at he + rw [he] + exact incidentFixed _ (displayedIncident Tn (segRefl Tn) _) + · exact augmentationFixed t (by omega) + +private theorem helper_routeTransport_704.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + TashkinovAugmentationSequence sigma S B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb segTrans hAib B BToT + sigma missingBefore edgesFixed S hs + unfold TashkinovAugmentationSequence at hs ⊢ + induction hs using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head U W hstep htail ih => + have hWB := TashkinovAugmentationSequenceInitialSegment phi W B htail + obtain ⟨hlen, hUW, c, hcol, hm⟩ := hstep + have hUB := segTrans hUW hWB + have hlt : U.length < B.length := by have := hWB.1; omega + refine Relation.ReflTransGen.head ⟨hlen, hUW, c, ?_, ?_⟩ ih + · have hf := edgesFixed (Fin.castLE hWB.1 (Fin.cast hlen.symm (Fin.last U.length))) + rw [hWB.2.2] at hf + exact hf.trans hcol + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + have hvB := TreeSequenceInitialSegmentVertexSetSubset hUB hv + have hvb : v ≠ vb := by + intro he + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + have ht := hUB.2.1 i + have htT := BToT.2.1 (Fin.castLE (Nat.succ_le_succ hUB.1) i) + have eqv : T.vertex (Fin.castLE (Nat.succ_le_succ BToT.1) + (Fin.castLE (Nat.succ_le_succ hUB.1) i)) = T.vertex ib := htT.trans (ht.trans + (hi.trans he)) + have hh := congrArg Fin.val (T.vertex_injective eqv) + have := i.isLt + change i.val = ib.val at hh + change U.length < ib.val at hlt + omega + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [missingBefore v hvB hvb]; exact hcv⟩ + +private theorem helper_closureSubset_736.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib coreToA hAib B rpB aboveB + strictB belowB genB baseB hcoreB hPE + obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hPE + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [← hcoreB, u.vertexSet] + exact Finset.mem_union_right _ hv + +private theorem helper_alphaNotClosure_742.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + va ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + TreeSequenceInitialSegment A Y → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.closure = base.closure → + va ∉ TreeSequenceVertexSet base.closure → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A → + alpha ∉ TreeMissingColors phi baseB.closure := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ia ib va ell yLength Y + hElementaryY ha haY hAib AToY B rpB aboveB strictB belowB genB baseB hclosureB + haOutsideClosure closureSubset hm + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + have hneV : v ≠ va := by + intro he + apply haOutsideClosure + rw [← hclosureB] + exact he ▸ hv + exact Finset.disjoint_left.mp + (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY (closureSubset hv)) + haY hneV) hvm ha.1 + +private theorem helper_stableClosure_758.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A → + alpha ∉ TreeMissingColors phi baseB.closure → + beta ∉ TreeMissingColors phi baseB.closure → + StableColoring baseB.closure ∅ phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB sigma fixedValue missingA closureSubset alphaNotClosure + betaNotClosure + refine ⟨?_, fun v hv => missingA v (closureSubset hv)⟩ + intro f _ hf + obtain ⟨c, hc, hfc⟩ := hf + have hm : c ∈ TreeMissingColors phi baseB.closure := by simpa using hc + have hca : c ≠ alpha := fun he => alphaNotClosure (he ▸ hm) + have hcb : c ≠ beta := fun he => betaNotClosure (he ▸ hm) + exact fixedValue f (fun he => hca (Option.some.inj (hfc.symm.trans he))) + (fun he => hcb (Option.some.inj (hfc.symm.trans he))) + +private theorem helper_storedS_778.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib vb TnToA hAib B rpB + aboveB strictB belowB genB ettB sigma treeMissingEq corr + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ + rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j + have hm := treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) + unfold Dn TashkinovStoredColors + simp only [ettB, hstored, ← hgen, ← ett.generatingColoring, htree, hm, n, Tn] + +private theorem helper_stageBToB_804.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (j : Fin (HB.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (HB.stage j) B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib segRefl segTrans hAib B rpB + aboveB strictB belowB genB baseB HB j + clear * - HB j B segRefl segTrans + exact Fin.reverseInduction + (motive := fun j => TreeSequenceInitialSegment (HB.stage j) B) + (by simpa only [HB.terminalStage] using segRefl B) + (fun i hi => segTrans (HB.nested i) hi) j + +private theorem helper_closureBToA_811.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib coreToA hAib B rpB aboveB + strictB belowB genB baseB hcoreB hp + clear * - hp baseB coreToA hcoreB + obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hp + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [← hcoreB, u.vertexSet] + exact Finset.mem_union_right _ hv + +private theorem helper_reservedB_819.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (hcountB : HB.dividerCount = H.dividerCount) (goodB : GoodHierarchy HB), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + HierarchyStoredColorsAt HB j = HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HB j = HierarchyStageMissingColors H jo ∧ + ∀ (eta : Fin k), + goodB.gamma j eta = C.good.gamma jo eta ∧ + HierarchySegmentColors HB j eta ⊆ HierarchySegmentColors H jo eta) → + (∀ (j : Fin H.dividerCount), + alpha ∈ (HierarchyStoredColorsAt H j.succ).biUnion (C.good.gamma j.castSucc) ∧ + alpha ∈ + (HierarchyStoredColorsAt H j.castSucc).biUnion (C.good.gamma j.castSucc)) → + ∀ (i : Fin HB.dividerCount), + alpha ∈ (HierarchyStoredColorsAt HB i.succ).biUnion (goodB.gamma i.castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib hAib B rpB aboveB strictB + belowB genB baseB HB hcountB goodB hgoodB reserved i + let io : Fin H.dividerCount := Fin.cast hcountB i + have hs := (hgoodB i.succ).1 + have hg := fun eta => ((hgoodB i.castSucc).2.2 eta).1 + have hiSucc : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) i.succ = io.succ := + Fin.ext rfl + have hiCast : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) i.castSucc = io.castSucc := + Fin.ext rfl + rw [hiSucc] at hs + simp only [hiCast] at hg + rw [hs] + have hgfun : goodB.gamma i.castSucc = C.good.gamma io.castSucc := funext hg + rw [hgfun] + exact (reserved io).1 + +private theorem helper_reservedZeroB_834.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + (let H : TashkinovHierarchy ett base := C.hierarchy; + (0 : ℕ) < H.dividerCount ∧ + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), + ¬TreeColorSetClosed G phi (HierarchyStarredStage H s) + ({ alpha } : Finset (Fin k))) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (hcountB : HB.dividerCount = H.dividerCount) (goodB : GoodHierarchy HB), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + HierarchyStoredColorsAt HB j = HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HB j = HierarchyStageMissingColors H jo ∧ + ∀ (eta : Fin k), + goodB.gamma j eta = C.good.gamma jo eta ∧ + HierarchySegmentColors HB j eta ⊆ HierarchySegmentColors H jo eta) → + (∀ (j : Fin H.dividerCount), + alpha ∈ (HierarchyStoredColorsAt H j.succ).biUnion (C.good.gamma j.castSucc) ∧ + alpha ∈ + (HierarchyStoredColorsAt H j.castSucc).biUnion (C.good.gamma j.castSucc)) → + alpha ∈ + (HierarchyStoredColorsAt HB (0 : Fin (HB.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (HB.dividerCount + (1 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hbranch H q A n ib hAib B rpB aboveB + strictB belowB genB baseB HB hcountB goodB hgoodB reserved + let zero : Fin H.dividerCount := ⟨0, hbranch.1⟩ + have hs := (hgoodB 0).1 + have hg := fun eta => ((hgoodB 0).2.2 eta).1 + have hi : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) + (0 : Fin (HB.dividerCount + 1)) = 0 := Fin.ext rfl + rw [hi] at hs + simp only [hi] at hg + rw [hs, show goodB.gamma 0 = C.good.gamma 0 from funext hg] + exact (reserved zero).2 + +private theorem helper_minusEq_845.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + beta ∉ TreeMissingColors phi A → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → TreeMissingColors sigma S = + TreeMissingColors phi S) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), + alpha ∈ D → (TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G + phi S D) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hbetaA sigma unaffected + treeMissingEq S hS D haD + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [treeMissingEq S hS] + have boundaryEq (c : Fin k) (hc : c ∈ TreeMissingColors phi S \ D) : + BoundaryColorEdges G sigma (TreeSequenceVertexSet S) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet S) c := by + have hca : c ≠ alpha := fun he => (Finset.mem_sdiff.mp hc).2 (he ▸ haD) + have hcb : c ≠ beta := by + intro he + apply hbetaA + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp (Finset.mem_sdiff.mp hc).1 + exact Finset.mem_biUnion.mpr ⟨v, hS hv, he ▸ hvm⟩ + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + exact and_congr_right (fun _ => unaffected f c hca hcb) + exact ⟨fun hs c hc => (boundaryEq c hc).symm.trans (hs c hc), + fun hs c hc => (boundaryEq c hc).trans (hs c hc)⟩ + +private theorem helper_storedEq_884.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + change TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) \ TreeMissingColors sigma (HierarchyStarredStage HS + j) = + Dn \ TreeMissingColors phi (HierarchyStarredStage HB j) + rw [storedS, starEq, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starBToA j))] + +private theorem helper_missingEq_891.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := + hsbase.symm.trans hbbase + rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] + · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) + +private theorem helper_firstLe_902.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), + eta ∈ MissingColors G psi (B.vertex i) → + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib hAib B psi eta i hc + clear * - psi eta i hc + let candidates := Finset.univ.filter fun j => eta ∈ MissingColors G psi (B.vertex j) + have hi : i ∈ candidates := by simp [candidates, hc] + have hn : candidates.Nonempty := ⟨i, hi⟩ + simpa [HierarchyFirstMissingPosition, candidates, hn] using + (show (candidates.min' hn).val ≤ i.val from Finset.min'_le candidates i hi) + +private theorem helper_firstStrict_911.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k), + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib hAib B psi eta h + clear * - psi eta h + unfold HierarchyFirstMissingPosition at h ⊢ + dsimp only at h ⊢ + split_ifs with hn + · exact (Finset.mem_filter.mp (Finset.min'_mem _ hn)).2 + · simp only [dite_eq_right hn, Fin.val_last] at h + omega + +private theorem helper_firstEq_921.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + (∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), + eta ∈ MissingColors G psi (B.vertex i) → + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ)) → + (∀ (psi : PartialEdgeColoring E k) (eta : Fin k), + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta))) → + ∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B BToT sigma + missingBefore firstLe firstStrict eta + have beforeLast (i : Fin (B.length + 1)) (hi : i.val < B.length) : + MissingColors G sigma (B.vertex i) = MissingColors G phi (B.vertex i) := by + apply missingBefore + · simp [TreeSequenceVertexSet] + · intro he + have heT := (BToT.2.1 i).trans he + have heval := congrArg Fin.val (T.vertex_injective heT) + have hbLen : B.length = ib.val := rfl + change i.val = ib.val at heval + omega + apply Fin.ext + apply Nat.le_antisymm + · by_cases h : (HierarchyFirstMissingPosition phi B eta).val < B.length + · apply firstLe sigma eta + rw [beforeLast _ h] + exact firstStrict phi eta h + · have := (HierarchyFirstMissingPosition sigma B eta).isLt + omega + · by_cases h : (HierarchyFirstMissingPosition sigma B eta).val < B.length + · apply firstLe phi eta + rw [← beforeLast _ h] + exact firstStrict sigma eta h + · have := (HierarchyFirstMissingPosition phi B eta).isLt + omega + +private theorem helper_segmentEq_948.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + have hedge (t : Fin (stages j.succ).length) : + sigma ((stages j.succ).edge t) = phi ((stages j.succ).edge t) := by + have hSB := stageBToB j.succ + have hf := edgesFixed (Fin.castLE hSB.1 t) + rw [hSB.2.2] at hf + exact hf + unfold HierarchySegmentColors + simp only [starEq, firstEq eta, HS, HB, hedge] + +private theorem helper_refreshEq_960.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + rw [starEq] + apply Finset.biUnion_congr rfl + intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ) + (Finset.mem_sdiff.mp hv).1) + +private theorem helper_hstarLast_1016.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + rw [starEq] + have hs := (hstagesB (Fin.last count)).2 + have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := + Fin.ext (by simp [q]) + simpa only [hj] using hs + +private theorem helper_pathLe_1028.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let _ : ℕ := T.length - A.length; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + let tailB := B.length - A.length + let candidatesT := (Finset.Icc 1 ell).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + let candidatesB := (Finset.Icc 1 tailB).filter fun i => + ∀ t : Fin B.length, A.length + i ≤ t.val → + G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) + have htail : 1 ≤ tailB := by dsimp [tailB]; omega + have htailT : 1 ≤ ell := by dsimp [ell]; omega + have htmem : ell ∈ candidatesT := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htailT, le_rfl⟩, ?_⟩ + intro t ht + have hAT := AToT.1 + have := t.isLt + dsimp [ell] at ht + omega + have hbmem : tailB ∈ candidatesB := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htail, le_rfl⟩, ?_⟩ + intro t ht + have := t.isLt + dsimp [tailB] at ht + omega + have hnT : candidatesT.Nonempty := ⟨ell, htmem⟩ + have hnB : candidatesB.Nonempty := ⟨tailB, hbmem⟩ + have hmT := Finset.min'_mem candidatesT hnT + have hbounds := Finset.mem_Icc.mp (Finset.mem_filter.mp hmT).1 + have hminB : candidatesB.min' hnB ≤ candidatesT.min' hnT := by + by_cases ht : candidatesT.min' hnT ≤ tailB + · apply Finset.min'_le + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hbounds.1, ht⟩, ?_⟩ + intro t hpos + have he := (Finset.mem_filter.mp hmT).2 (Fin.castLE BToT.1 t) hpos + have hv0 := BToT.2.1 t.castSucc + have hv1 := BToT.2.1 t.succ + have hi0 : (Fin.castLE BToT.1 t).castSucc = + Fin.castLE (Nat.succ_le_succ BToT.1) t.castSucc := Fin.ext rfl + have hi1 : (Fin.castLE BToT.1 t).succ = + Fin.castLE (Nat.succ_le_succ BToT.1) t.succ := Fin.ext rfl + simpa only [BToT.2.2, hi0, hi1, hv0, hv1] using he + · exact le_trans (Finset.min'_le candidatesB tailB hbmem) (by omega) + unfold HierarchyPathNumber + rw [hstarLast] + change (if h : candidatesB.Nonempty then candidatesB.min' h else tailB) ≤ + (if h : candidatesT.Nonempty then candidatesT.min' h else ell) + rw [dite_eq_left hnB, dite_eq_left hnT] + exact hminB + +private theorem helper_storedEq_3219.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact helper_storedEq_884 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) + (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +private theorem helper_missingEq_3228.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + exact helper_missingEq_891 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@TnToA) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@j) + +private theorem helper_segmentEq_3255.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + exact helper_segmentEq_948 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) (@baseS) (@count) + (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) + (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) (@hspositive) + (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) + (@starEq) (@firstEq) (@j) (@eta) + +private theorem helper_refreshEq_3265.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + exact helper_refreshEq_960 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) (@baseS) (@count) + (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) + (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) (@hspositive) + (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) + (@starEq) (@i) + +private theorem helper_hstarLast_3322.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage + (Fin.cast + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega) + j).castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H + (Fin.cast + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega) + j)) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + exact helper_hstarLast_1016 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) + (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) + (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) (@hspositive) + (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) + (@starEq) + +private theorem helper_pathLe_3336.{u_1, u_2} : + helperPathLe3336Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + exact helper_pathLe_1028 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@AToT) (@hAib) + (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) + (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) + (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) + +private theorem helper_hless_4484.{u_1, u_2} : + helperHless4484Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb coreToA TnToA hAib + B rpB aboveB strictB belowB genB baseB hcoreB ettB sigma sigmaNotElementary treeMissingEq + corr hMPS baseS hrS closureBToA minusEq count stages hbbase hbterminal hbnested hbstrict + positions hbpositive hbincreasing hbdivider hbcore goodB stageBToA reservedB reservedZeroB + hcore hpe hclosure positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict + hsdivider hscore HB HS storedEq missingEq segmentEq refreshEq goodS CS pathLe tailLess + change HierarchyPathNumber HS < HierarchyPathNumber H ∨ + (HierarchyPathNumber HS = HierarchyPathNumber H ∧ + B.length - (HS.stage (Fin.last count).castSucc).length < + T.length - (H.stage q.castSucc).length) + rcases lt_or_eq_of_le pathLe with hlt | heq + · exact Or.inl hlt + · exact Or.inr ⟨heq, tailLess⟩ + +private theorem helper_continuation_4887.{u_1, u_2} : + helperContinuation4887Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hminimal alpha beta hne H q A n Tn ib vb + coreToA TnToA AToT ordinaryToA hAib B BToT ABstrict BstrictT rpB aboveB strictB belowB genB + baseB hcoreB ettB sigma missingBefore sigmaNotElementary missingA treeMissingEq edgesFixed + corr hMPS baseS hrS closureBToA minusEq count stages hbbase hbterminal hbnested hbstrict + positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB goodB stageBToA + stageBToB reservedB reservedZeroB hcore hpe hclosure positionsS hspositive hsincreasing + hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq storedEq + have missingEq (j : Fin (count + 1)) : + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + exact helper_missingEq_3228 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) + (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) + (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) + (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@j) + -- A change only at the last vertex leaves the totalized first position unchanged. + have firstLe (psi : PartialEdgeColoring E k) (eta : Fin k) + (i : Fin (B.length + 1)) (hc : eta ∈ MissingColors G psi (B.vertex i)) : + (HierarchyFirstMissingPosition psi B eta).val ≤ i.val := by + exact helper_firstLe_902 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) (@psi) + (@eta) (@i) (@hc) + have firstStrict (psi : PartialEdgeColoring E k) (eta : Fin k) + (h : (HierarchyFirstMissingPosition psi B eta).val < B.length) : + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by + exact helper_firstStrict_911 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@hAib) (@psi) (@eta) (@h) + have firstEq (eta : Fin k) : + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by + exact helper_firstEq_921 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) (@BToT) + (@missingBefore) (@firstLe) (@firstStrict) (@eta) + have segmentEq (j : Fin (count + 1)) (eta : Fin k) + (he : eta ∈ HierarchyStoredColorsAt HB j) : + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + exact helper_segmentEq_3255 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + have refreshEq (i : Fin count) : + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun v => MissingColors G phi v) := by + exact helper_refreshEq_3265 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) + (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@i) + let goodS : GoodHierarchy HS := + { gamma := goodB.gamma + twoColors := by intro j eta he; exact goodB.twoColors j eta (storedEq j ▸ he) + avoidance := by + intro j eta he + rw [missingEq, segmentEq j eta (storedEq j ▸ he)] + exact goodB.avoidance j eta (storedEq j ▸ he) + disjointPairs := by + intro j eta theta he ht hne + exact goodB.disjointPairs j eta theta (storedEq j ▸ he) (storedEq j ▸ ht) hne + uniqueRefresh := by + intro i + simpa only [storedEq, refreshEq] using goodB.uniqueRefresh i + parallelBase := by + apply helper_parallelBase_4040 <;> assumption + minusClosed := by + intro i + rw [storedEq, minusEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) + _ (reservedB i)] + exact goodB.minusClosed i } + let CS : HierarchyCounterexample baseS := + { positive := by rw [hrS]; exact C.positive + hierarchy := HS + good := goodS + maximum := hMPS + notElementary := sigmaNotElementary } + have hstarLast : HierarchyStarredStage HS (Fin.last count) = A := by + exact helper_hstarLast_3322 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) + (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) + have hlastOrd : HS.stage (Fin.last count).castSucc = H.stage q.castSucc := by + have hs := (hstagesB (Fin.last count)).1 + have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := + Fin.ext (by simp [q]) + simpa only [hj] using hs + -- Path candidates restrict to the shorter prefix; the second measure decreases strictly. + have pathLe : HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + exact helper_pathLe_3336 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@AToT) (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) + (@corr) (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) + (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) + have tailLess : B.length - (HS.stage (Fin.last count).castSucc).length < + T.length - (H.stage q.castSucc).length := by + clear * - hlastOrd ordinaryToA BstrictT ABstrict AToT + rw [hlastOrd] + have hlen := (ordinaryToA q).1 + omega + have hless : HierarchyCounterexampleLess (HierarchyCounterexampleMeasure CS) + (HierarchyCounterexampleMeasure C) := by + apply helper_hless_4484 <;> assumption + exact hminimal CS hrS hcountB hless + +private theorem helper_storedEq_5399.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by + omega) + (Nat.le_of_lt_succ ib.isLt); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.1, by + omega⟩ : + Fin (ett.1 + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.1, by + omega⟩ : + Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (_ : + ∀ (S : TreeSequence G e0) (_ : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A), + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) + (_ : + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn) + (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))) + (_ : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (_ : + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact helper_storedEq_3219 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) + (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) + (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +private theorem helper_storedEq_5598.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by + omega) + (Nat.le_of_lt_succ ib.isLt); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.1, by + omega⟩ : + Fin (ett.1 + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree + (⟨ett.1, by + omega⟩ : + Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (_ : + ∀ (S : TreeSequence G e0) (_ : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A), + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) + (_ : + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn) + (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))) + (_ : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages + (⟨(1 : ℕ), by + omega⟩ : + Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (_ : + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact @helper_storedEq_5399 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) + (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +private theorem helper_continuation_5697.{u_1, u_2} : + helperContinuation5697Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hminimal alpha beta hne + hbranch H q A n Tn Dn ia ib va vb ell yLength Y segRefl segTrans coreToA TnToA AToT + ordinaryToA starredToA hElementaryY ha haY hAib AToY hbetaA B BToT ABstrict BstrictT rpB + aboveB strictB belowB genB hMPB baseB hcoreB hclosureB HB hcountB hstagesB hdividersB goodB + hgoodB ettB preElementary reserved hPE haOutsideClosure sigma unaffected fixedValue + sigmaProper sigmaOne missingBefore sigmaNotElementary missingA treeMissingEq stableTn + terminalRoute edgesFixed routeTransport closureSubset + have alphaNotClosure : alpha ∉ TreeMissingColors phi baseB.closure := by + exact helper_alphaNotClosure_742 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@hElementaryY) (@ha) (@haY) (@hAib) (@AToY) (@rpB) (@aboveB) (@strictB) (@belowB) + (@genB) (@baseB) (@hclosureB) (@haOutsideClosure) (@closureSubset) + have betaNotClosure : beta ∉ TreeMissingColors phi baseB.closure := by + intro hm + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + exact hbetaA (Finset.mem_biUnion.mpr ⟨v, closureSubset hv, hvm⟩) + have stableClosure : StableColoring baseB.closure ∅ phi sigma := by + exact helper_stableClosure_758 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@fixedValue) (@missingA) + (@closureSubset) (@alphaNotClosure) (@betaNotClosure) + have replacement : + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B, + MaximumProperty corr.replacementETT ∧ + ∃ baseS : HierarchyBase corr.replacementETT sigma, + ∃ HS : TashkinovHierarchy corr.replacementETT baseS, + SameHierarchyStages HB HS := by + have hseq := routeTransport Tn terminalRoute + exact HierarchySplitter G k e0 input B phi sigma ettB hMPB C.positive + hlower baseB HB hPE hproper hone sigmaProper sigmaOne + ⟨stableTn, stableClosure⟩ hseq + obtain ⟨corr, hMPS, baseS, HS, hsame⟩ := replacement + have storedS : TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = Dn := by + exact helper_storedS_778 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@TnToA) + (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@treeMissingEq) (@corr) + have hrS : corr.replacementETT.rounds = ett.rounds := corr.rungAgreement + have stageBToA (j : Fin (HB.dividerCount + 1)) : + TreeSequenceInitialSegment (HB.stage j.castSucc) A := by + clear * - hstagesB ordinaryToA j + rw [(hstagesB j).1] + exact ordinaryToA _ + have starBToA (j : Fin (HB.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage HB j) A := by + clear * - hstagesB starredToA j + rw [(hstagesB j).2] + exact starredToA _ + have stageBToB (j : Fin (HB.dividerCount + 2)) : + TreeSequenceInitialSegment (HB.stage j) B := by + apply helper_stageBToB_804 <;> assumption + have closureBToA (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + exact helper_closureBToA_811 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@hcoreB) (@hp) + have reservedB (i : Fin HB.dividerCount) : + alpha ∈ (HierarchyStoredColorsAt HB i.succ).biUnion (goodB.gamma i.castSucc) := by + exact helper_reservedB_819 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@HB) (@hcountB) (@goodB) (@hgoodB) + (@reserved) (@i) + have reservedZeroB : + alpha ∈ (HierarchyStoredColorsAt HB 0).biUnion (goodB.gamma 0) := by + exact helper_reservedZeroB_834 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@hbranch) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@HB) + (@hcountB) (@goodB) (@hgoodB) (@reserved) + have minusEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) (D : Finset (Fin k)) + (haD : alpha ∈ D) : + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D := by + exact helper_minusEq_845 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hbetaA) + (@unaffected) (@treeMissingEq) (@S) (@hS) (@D) (@haD) + rcases HB with ⟨count, stages, hbbase, hbterminal, hbnested, hbstrict, positions, + hbpositive, hbincreasing, hbdivider, hbcore⟩ + rcases HS with ⟨countS, stagesS, hsbase, hsterminal, hsnested, hsstrict, positionsS, + hspositive, hsincreasing, hsdivider, hscore⟩ + rcases hsame with ⟨hcore, hcount, hstages, hpositions, hpe, hclosure⟩ + dsimp only at hcount hstages hpositions + cases hcount + have hstage : stages = stagesS := eq_of_heq hstages + cases hstage + let HB : TashkinovHierarchy ettB baseB := + ⟨count, stages, hbbase, hbterminal, hbnested, hbstrict, positions, + hbpositive, hbincreasing, hbdivider, hbcore⟩ + let HS : TashkinovHierarchy corr.replacementETT baseS := + ⟨count, stages, hsbase, hsterminal, hsnested, hsstrict, positionsS, + hspositive, hsincreasing, hsdivider, hscore⟩ + have starEq (j : Fin (count + 1)) : + HierarchyStarredStage HS j = HierarchyStarredStage HB j := by + exact Fin.cases hcore.symm (fun i => rfl) j + have storedEq (j : Fin (count + 1)) : + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + exact @helper_storedEq_5598 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) + (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) + (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + exact @helper_continuation_4887 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hminimal) (@alpha) + (@beta) (@hne) (@coreToA) (@TnToA) (@AToT) (@ordinaryToA) (@hAib) (@BToT) (@ABstrict) + (@BstrictT) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@hcoreB) + (@missingBefore) (@sigmaNotElementary) (@missingA) (@treeMissingEq) (@edgesFixed) (@corr) + (@hMPS) (@baseS) (@hrS) (@closureBToA) (@minusEq) (@count) (@stages) (@hbbase) + (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) + (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@goodB) (@stageBToA) (@stageBToB) + (@reservedB) (@reservedZeroB) (@hcore) (@hpe) (@hclosure) (@positionsS) (@hspositive) + (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) + (@starEq) (@storedEq) + +private theorem helper_continuation_2989.{u_1, u_2} : + helperContinuation2989Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hminimal hprefixElementary + _ alpha beta hne horderedUnused hbranch H q A n Tn Dn ia ib va vb ell yLength Y segRefl + segTrans commonPrefix coreToA TnToA AToT ordinaryToA starredToA YToT hElementaryY ha hb + vertexY haY hbY hout hAib AToY missingNotA + have halphaA : alpha ∈ TreeMissingColors phi A := + Finset.mem_biUnion.mpr ⟨va, hout.1, ha.1⟩ + have hbetaA : beta ∉ TreeMissingColors phi A := missingNotA beta ib hb.1 hbY hout.2 + have horder := horderedUnused (Or.inr hbetaA) + have habIndex : ia.val < ib.val := by + exact helper_habIndex_353 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@horder) + have havb : va ≠ vb := by + clear * - habIndex + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + omega + -- Keep the exact ordered prefix ending at the beta-missing vertex. + let B := TreeSequencePrefix T ib.val (by have := A.positive; omega) + (Nat.le_of_lt_succ ib.isLt) + have BToT : TreeSequenceInitialSegment B T := + ⟨Nat.le_of_lt_succ ib.isLt, (by intro i; rfl), (by intro i; rfl)⟩ + have AToB : TreeSequenceInitialSegment A B := commonPrefix AToT BToT (by exact le_of_lt hAib) + have ABstrict : A.length < B.length := hAib + have BToY : TreeSequenceInitialSegment B Y := commonPrefix BToT YToT hb.2 + have BstrictT : B.length < T.length := by + exact helper_BstrictT_372 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@AToT) (@hAib) + (@ABstrict) (@BToY) + obtain ⟨ettB, hMPB, hrB, hsB, baseB, hcoreB, hclosureB, hsupportB, + HB, hcountB, hstagesB, hdividersB, goodB, hgoodB⟩ := + GoodHierarchyTerminalPrefixRepackage G k e0 input T phi phi ett C.maximum + base H C.good B AToB ABstrict BToT + rcases ettB with ⟨rB, rpB, seriesB, aboveB, strictB, belowB, genB⟩ + cases hrB + have heqB : seriesB = ett.series := eq_of_heq hsB + cases heqB + let ettB : ExtendedTashkinovTree G k e0 input B phi := + ⟨ett.rounds, rpB, ett.series, aboveB, strictB, belowB, genB⟩ + have preElementary : + ColoredVertexSetElementary G + (ett.series.data.coloring ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩) + (TreeSequenceVertexSet Tn) := by + clear * - ett C hlower G k e0 input T phi Tn n + by_cases hn : 1 < ett.rounds + · obtain ⟨lower, hr, hmax, _, _⟩ := + CertifiedETTPredecessor G k e0 input T phi ett C.maximum hn + exact (hlower lower (by omega) (by omega) hmax).1 + · apply helper_branch_398 <;> assumption + obtain ⟨reserved, hPE, haLocation, alphaUnused⟩ := + (rutcor G k e0 input T phi ett base H C.good hbranch.1 + hprefixElementary preElementary alpha halphaA).2 hbranch.2 + have haTn : va ∈ TreeSequenceVertexSet Tn := (Finset.mem_sdiff.mp haLocation).1 + have haOutsideClosure : va ∉ TreeSequenceVertexSet base.closure := + (Finset.mem_sdiff.mp haLocation).2 + have halphaTn : alpha ∈ TreeMissingColors phi Tn := + Finset.mem_biUnion.mpr ⟨va, haTn, ha.1⟩ + have hinter : TreeInterchangeable G Tn phi alpha beta := by + exact helper_hinter_417 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) + (@alpha) (@beta) (@hPE) (@halphaTn) + by_contra hcomponents + let K := TwoColorComponent G phi alpha beta (Sum.inl vb) + let sigma := TwoColorComponentSwap G phi alpha beta (Sum.inl vb) + have pathMissing (v : V) (c d : Fin k) (hcd : c ≠ d) + (hc : c ∈ MissingColors G phi v) : + TwoColorPathComponent G phi c d (Sum.inl v) := by + exact helper_pathMissing_426 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hproper) (by + assumption) (@v) (@c) (@d) (@hcd) (@hc) + have pathA : TwoColorPathComponent G phi alpha beta (Sum.inl va) := + pathMissing va alpha beta hne ha.1 + have pathB : TwoColorPathComponent G phi alpha beta (Sum.inl vb) := by + exact helper_pathB_451 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (by + assumption) (@alpha) (@beta) (@hne) (@hb) + have avoidTn (v : V) (hv : v ∈ TreeSequenceVertexSet Tn) : Sum.inl v ∉ K := by + clear * - hcomponents hinter haTn pathA pathB K hv + intro hK + exact hcomponents (hinter _ _ pathA pathB ⟨va, haTn, rfl⟩ ⟨v, hv, hK⟩) + have haK : Sum.inl va ∉ K := avoidTn va haTn + have behavior := TwoColorComponentSwapMissingBehavior G phi alpha beta hne hproper + (Sum.inl vb) + have edgeOfVertex {v : V} {f : E} (hv : Sum.inl v ∈ K) + (hf : Incident G v f) (hc : phi f = some alpha ∨ phi f = some beta) : + Sum.inr f ∈ K := by + clear * - hv hf hc K + have hadj : (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inr f) (Sum.inl v) := + ⟨hf, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv + have unaffected (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + sigma f = some c ↔ phi f = some c := by + exact helper_unaffected_486 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) + (@hne) (@ha) (@hb) (@f) (@c) (@hca) (@hcb) + have fixedValue (f : E) (ha : phi f ≠ some alpha) (hb : phi f ≠ some beta) : + sigma f = phi f := by + clear * - ha hb sigma + simp [sigma, TwoColorComponentSwap, ha, hb] + have sigmaProper : IsProperEdgeColoring G sigma := + TwoColorComponentSwapProper G phi alpha beta hne hproper _ + have sigmaOne : IsOneEdgeUncolored sigma e0 := by + exact helper_sigmaOne_503 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hone) + (@alpha) (@beta) (@hne) + (@ha) (@hb) (@unaffected) + have vertexB (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : + T.vertex i ∈ TreeSequenceVertexSet B := by + clear * - i hi B + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have haB : va ∈ TreeSequenceVertexSet B := vertexB ia (le_of_lt habIndex) + have hbB : vb ∈ TreeSequenceVertexSet B := vertexB ib le_rfl + -- Elementarity fixes missing sets before the swapped endpoint, even inside its component. + have missingBefore (v : V) (hv : v ∈ TreeSequenceVertexSet B) (hvb : v ≠ vb) : + MissingColors G sigma v = MissingColors G phi v := by + exact @helper_missingBefore_528 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@hElementaryY) (@ha) (@hb) (@haY) (@hbY) (@hAib) (@BToY) (@haK) (@behavior) + (@edgeOfVertex) (@v) (@hv) (@hvb) + have hnewa : alpha ∈ MissingColors G sigma va := by + rw [behavior.1 va haK] + exact ha.1 + have hnewb : alpha ∈ MissingColors G sigma vb := + behavior.2.2.1 vb (show Sum.inl vb ∈ K from rfl) hb.1 + have sigmaNotElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := + fun he => Finset.disjoint_left.mp (he haB hbB havb) hnewa hnewb + have missingA (v : V) (hv : v ∈ TreeSequenceVertexSet A) : + MissingColors G sigma v = MissingColors G phi v := + missingBefore v (TreeSequenceInitialSegmentVertexSetSubset AToB hv) + (by intro he; exact hout.2 (he ▸ hv)) + have treeMissingEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) : + TreeMissingColors sigma S = TreeMissingColors phi S := by + clear * - hS missingA + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => missingA v (hS hv)) + have incidentFixed (f : E) (hf : TreeIncidentEdge Tn f) : sigma f = phi f := by + exact helper_incidentFixed_582 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@ha) (@hb) (@avoidTn) (@fixedValue) (@f) (@hf) + have stableTn : StableColoring Tn Dn phi sigma := by + refine ⟨fun f hf _ => incidentFixed f hf, ?_⟩ + intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset TnToA hv) + have TnToB := segTrans TnToA AToB + have TnStrictB : Tn.length < B.length := lt_of_le_of_lt TnToA.1 ABstrict + have BToFinal := segTrans BToT ett.belowFinal + have terminalRoute : TashkinovAugmentationSequence phi Tn B := by + exact helper_terminalRoute_605 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@hAib) (@hPE) (@TnToB) (@BToFinal) + have displayedIncident (S : TreeSequence G e0) + (hSTn : TreeSequenceInitialSegment S Tn) (t : Fin S.length) : + TreeIncidentEdge Tn (S.edge t) := by + exact helper_displayedIncident_634 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@S) (@hSTn) (@t) + have augmentationFixed (t : Fin B.length) (ht : Tn.length ≤ t.val) : + sigma (B.edge t) = phi (B.edge t) := by + exact helper_augmentationFixed_642 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@hElementaryY) (@hb) (@vertexY) (@hbY) (@hAib) (@horder) (@BToT) (@AToB) (@alphaUnused) + (@fixedValue) (@terminalRoute) (@t) (@ht) + have edgesFixed (t : Fin B.length) : sigma (B.edge t) = phi (B.edge t) := by + exact helper_edgesFixed_695 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) + (@segRefl) (@hAib) (@incidentFixed) (@TnToB) (@displayedIncident) (@augmentationFixed) (@t) + have routeTransport (S : TreeSequence G e0) (hs : TashkinovAugmentationSequence phi S B) : + TashkinovAugmentationSequence sigma S B := by + exact @helper_routeTransport_704 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@segTrans) (@hAib) (@BToT) (@missingBefore) (@edgesFixed) (@S) (@hs) + have closureSubset : TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + exact helper_closureSubset_736 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@hcoreB) (@hPE) + exact @helper_continuation_5697 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hminimal) (@alpha) (@beta) (@hne) (@hbranch) (@segRefl) (@segTrans) (@coreToA) + (@TnToA) (@AToT) (@ordinaryToA) (@starredToA) (@hElementaryY) (@ha) (@haY) (@hAib) (@AToY) + (@hbetaA) (@BToT) (@ABstrict) (@BstrictT) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) + (@hMPB) (@baseB) (@hcoreB) (@hclosureB) (@HB) (@hcountB) (@hstagesB) (@hdividersB) (@goodB) + (@hgoodB) (@preElementary) (@reserved) (@hPE) (@haOutsideClosure) (@unaffected) + (@fixedValue) (@sigmaProper) (@sigmaOne) (@missingBefore) (@sigmaNotElementary) (@missingA) + (@treeMissingEq) (@stableTn) (@terminalRoute) (@edgesFixed) (@routeTransport) (@closureSubset) +theorem ChangeLemmaMixedNoClosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (_ : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty) + (horderedUnused : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + (alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c)) + (hlocation : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + va ∈ TreeSequenceVertexSet A ∧ + vb ∉ TreeSequenceVertexSet A) + (hbranch : + let H := C.hierarchy + 0 < H.dividerCount ∧ + ∀ s : Fin (H.dividerCount + 1), + ¬ TreeColorSetClosed G phi + (HierarchyStarredStage H s) {alpha}) + : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let _ := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let sameComponent := + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) + sameComponent := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + let va := T.vertex ia + let vb := T.vertex ib + let ell := T.length - A.length + let yLength := min (A.length + (ell - 1)) T.length + let Y := TreeSequencePrefix T yLength + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have segRefl (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + exact helper_segTrans_202 (@G) (@e0) (@hSU) (@hUW) + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + exact helper_commonPrefix_212 (@G) (@e0) (@hSW) (@hUW) (@hlen) + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + apply helper_stageSegment_222 <;> assumption + have stageToT (j : Fin (H.dividerCount + 2)) : + TreeSequenceInitialSegment (H.stage j) T := by + exact helper_stageToT_230 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@stageSegment) (@j) + have lastZero (hz : H.dividerCount = 0) : A = base.core := by + clear * - hz A q + simp [A, q, HierarchyStarredStage, hz, Fin.last] + have lastPositive (hz : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact helper_lastPositive_241 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hz) + have coreToA : TreeSequenceInitialSegment base.core A := by + apply helper_coreToA_253 <;> assumption + have TnToCore : TreeSequenceInitialSegment Tn base.core := by + exact helper_TnToCore_262 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@segRefl) + have TnToA := segTrans TnToCore coreToA + have AToT : TreeSequenceInitialSegment A T := by + apply helper_AToT_269 <;> assumption + have ordinaryToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + exact helper_ordinaryToA_276 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@stageSegment) + (@lastZero) (@lastPositive) (@TnToA) (@j) + have starredToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + exact Fin.cases coreToA (fun i => ordinaryToA i.succ) j + have YToT : TreeSequenceInitialSegment Y T := + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + have hmissingY : alpha ∈ TreeMissingColors phi Y ∧ beta ∈ TreeMissingColors phi Y := + hmissingPrefix + have hElementaryY : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) := + hprefixElementary + have firstMissing (c : Fin k) (hc : c ∈ TreeMissingColors phi Y) : + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (HierarchyFirstMissingPosition phi T c).val ≤ Y.length := by + exact helper_firstMissing_296 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@YToT) (@c) (@hc) + have ha := firstMissing alpha hmissingY.1 + have hb := firstMissing beta hmissingY.2 + have vertexY (i : Fin (T.length + 1)) (hi : i.val ≤ Y.length) : + T.vertex i ∈ TreeSequenceVertexSet Y := by + clear * - i hi Y + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have haY : va ∈ TreeSequenceVertexSet Y := vertexY ia ha.2 + have hbY : vb ∈ TreeSequenceVertexSet Y := vertexY ib hb.2 + have hout : va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A := hlocation + have outsideIndex (i : Fin (T.length + 1)) + (hi : T.vertex i ∉ TreeSequenceVertexSet A) : A.length < i.val := by + exact helper_outsideIndex_328 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@AToT) (@i) (@hi) + have hAib := outsideIndex ib hout.2 + have AToY : TreeSequenceInitialSegment A Y := + commonPrefix AToT YToT (by omega) + have missingNotA (c : Fin k) (i : Fin (T.length + 1)) + (hmi : c ∈ MissingColors G phi (T.vertex i)) + (hiy : T.vertex i ∈ TreeSequenceVertexSet Y) + (hia : T.vertex i ∉ TreeSequenceVertexSet A) : c ∉ TreeMissingColors phi A := by + exact helper_missingNotA_339 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@hne) (@hElementaryY) (@AToY) (@c) (@i) (@hmi) (@hiy) (@hia) + apply helper_continuation_2989 <;> assumption +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean new file mode 100644 index 0000000000..6c51b581b1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean @@ -0,0 +1,2828 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability +public import LeanPool.GoldbergSeymour.InterchangePECommonMissingClosed +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Change Lemma Mixed Zero Nonclosed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation2160Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → LowerRoundInductionHypothesis G k + e0 ett.rounds → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + ∀ (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; H.dividerCount = (0 : ℕ) → HierarchyStarredStage H (Fin.last + H.dividerCount) = A → va ∈ TreeSequenceVertexSet A → ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → + ∀ (i : Fin (Y.length + (1 : ℕ))), Y.vertex i ∈ TreeSequenceVertexSet X ↔ (↑i : ℕ) ≤ X.length) + → A.length < T.length → + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + by omega + ) (Nat.min_le_right (A.length + (T.length - A.length - (1 : ℕ))) T.length); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty) → TreeSequenceInitialSegment + Ty T → (alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + ∧ (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → (beta ∈ MissingColors G + phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ (↑j : ℕ)) → va ∈ TreeSequenceVertexSet + Ty → vb ∈ TreeSequenceVertexSet Ty → va ≠ vb → beta ∉ TreeMissingColors phi A → alpha ∈ + TreeMissingColors phi A → ett.series.data.kind n = some TashkinovExtensionKind.PE → + TwoColorPathComponent G phi alpha beta (Sum.inl va) → TwoColorPathComponent G phi alpha + beta (Sum.inl vb) → ¬TwoColorComponent G phi alpha beta (Sum.inl va) = TwoColorComponent G + phi alpha beta (Sum.inl vb) → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → ( + have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors + G phi v)) → ( + ∀ (f : E) (v : V), Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ + component → Sum.inl v ∈ component) → TwoColorIncidenceGraph G sigma alpha beta = + TwoColorIncidenceGraph G phi alpha beta → ( + ∀ (z : V ⊕ E), TwoColorComponent G sigma alpha beta z = TwoColorComponent G phi alpha beta z) + → ( + ∀ (v : V), Sum.inl v ∈ component → (alpha ∈ MissingColors G sigma v ↔ beta ∈ MissingColors G + phi v) ∧ (beta ∈ MissingColors G sigma v ↔ alpha ∈ MissingColors G phi v)) → Sum.inl vb ∈ + component → Sum.inl va ∉ component → alpha ∈ MissingColors G sigma va → alpha ∈ + MissingColors G sigma vb → CombinedStableColoring Tn base.closure Dn phi sigma → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) (Nat.le_of_lt_succ ib.isLt); TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B + → TreeSequenceInitialSegment Tn B → B.length < T.length → TashkinovAugmentationSequence + phi Tn B → TreeMissingColors sigma A = TreeMissingColors phi A → TreeMissingColors sigma + Tn = TreeMissingColors phi Tn → TreeMissingColors sigma base.closure = TreeMissingColors + phi base.closure → ( + ∀ {X : TreeSequence G e0}, TashkinovAugmentationSequence phi Tn X → TreeSequenceInitialSegment + X B → TashkinovAugmentationSequence sigma Tn X ∧ + ∀ (t : Fin X.length), sigma (X.edge t) = phi (X.edge t)) → False + +private abbrev helperCaseContinuation2060Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → LowerRoundInductionHypothesis G k + e0 ett.rounds → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + ∀ (alpha beta : Fin k), alpha ≠ beta → ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; alpha ∉ + TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A → TreeVertexOrder T (T.vertex ia) + (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))) → ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; H.dividerCount = (0 : ℕ) ∧ + ¬TreeColorSetClosed G phi A ({ alpha } : Finset (Fin k)) ∧ (alpha ∈ TreeMissingColors phi + Tn ∨ Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; H.dividerCount = (0 : ℕ) → HierarchyStarredStage H (Fin.last + H.dividerCount) = A → HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A → TreeSequenceInitialSegment A T → va ∈ + TreeSequenceVertexSet A → vb ∉ TreeSequenceVertexSet A → ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → + ∀ (i : Fin (Y.length + (1 : ℕ))), Y.vertex i ∈ TreeSequenceVertexSet X ↔ (↑i : ℕ) ≤ X.length) + → A.length < T.length → + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) (Nat.min_le_right (A.length + (T.length - A.length - (1 : ℕ))) T.length); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty) → TreeSequenceInitialSegment + Ty T → ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) → (alpha ∈ MissingColors + G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → (beta ∈ MissingColors G + phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ (↑j : ℕ)) → va ∈ TreeSequenceVertexSet + Ty → vb ∈ TreeSequenceVertexSet Ty → va ≠ vb → beta ∉ TreeMissingColors phi A → alpha ∈ + TreeMissingColors phi A → ett.series.data.kind n = some TashkinovExtensionKind.PE → + OrderedTreeUnion (ett.series.data.tree (Fin.last ett.rounds).castSucc) base.closure + base.core → TreeSequenceInitialSegment Tn A → TreeSequenceVertexSet base.closure ⊆ + TreeSequenceVertexSet A → CombinedStableColoring Tn base.closure Dn phi phi → va ∈ + TreeSequenceVertexSet Tn ∧ va ∉ TreeSequenceVertexSet base.closure ∨ va ∈ + TreeSequenceVertexSet base.closure ∧ va ∉ TreeSequenceVertexSet Tn → TwoColorPathComponent + G phi alpha beta (Sum.inl va) → TwoColorPathComponent G phi alpha beta (Sum.inl vb) → + ¬TwoColorComponent G phi alpha beta (Sum.inl va) = TwoColorComponent G phi alpha beta + (Sum.inl vb) → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → ( + have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors + G phi v)) → ( + ∀ (f : E) (v : V), Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ + component → Sum.inl v ∈ component) → False + +private noncomputable abbrev helperGoodK2169.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (alpha beta : Fin k) → + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := + TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := + HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta root; + (hAib : A.length < (↑ib : ℕ)) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); + (hmissingTreeTn : + TreeMissingColors sigma Tn = TreeMissingColors phi Tn) → + (hmissingTreeR : + TreeMissingColors sigma base.closure = + TreeMissingColors phi base.closure) → + (ettB : ExtendedTashkinovTree G k e0 input B phi) → + (baseB : HierarchyBase ettB phi) → + (hclosureB : baseB.closure = base.closure) → + (HB : TashkinovHierarchy ettB baseB) → + (goodB : GoodHierarchy HB) → + (hBdata : + ettB.series.data.tree + (Fin.last ettB.rounds).castSucc = + Tn ∧ + TashkinovStoredColors ettB.series.data + (Fin.last ettB.rounds) = + Dn ∧ + ettB.series.data.kind + (Fin.last ettB.rounds) = + some TashkinovExtensionKind.PE) → + (corr : + CorrespondingExtendedTashkinovTree G k e0 + ettB sigma B) → + (baseSigma : + HierarchyBase corr.replacementETT + sigma) → + (K : + TashkinovHierarchy corr.replacementETT + baseSigma) → + (hnewdata : + corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc = + Tn ∧ + TashkinovStoredColors + corr.replacementETT.series.data + (Fin.last + corr.replacementETT.rounds) = + Dn ∧ + corr.replacementETT.series.data.kind + (Fin.last + corr.replacementETT.rounds) = + some + TashkinovExtensionKind.PE) → + (hcountK : K.dividerCount = (0 : ℕ)) → + (hcoreNew : baseSigma.core = A) → + (hclosureNew : + baseSigma.closure = + base.closure) → + (hstoredEq : + HierarchyStoredColorsAt K + (0 : + Fin + (K.dividerCount + + (1 : ℕ))) = + HierarchyStoredColorsAt HB + (0 : + Fin + (HB.dividerCount + + (1 : ℕ)))) → + (hstageMissingEq : + HierarchyStageMissingColors + K + (0 : + Fin + (K.dividerCount + + (1 : ℕ))) = + HierarchyStageMissingColors + HB + (0 : + Fin + (HB.dividerCount + + (1 : ℕ)))) → + (hsegmentSubset : + ∀ (eta : Fin k) + (_ : + eta ∈ + HierarchyStoredColorsAt + K + (0 : + Fin + (K.dividerCount + + (1 : + ℕ)))), + HierarchySegmentColors + K + (0 : + Fin + (K.dividerCount + + (1 : ℕ))) + eta ⊆ + HierarchySegmentColors + HB + (0 : + Fin + (HB.dividerCount + + (1 : ℕ))) + eta) → + let reserved : + Finset (Fin k) := + (HierarchyStoredColorsAt + HB + (0 : + Fin + (HB.dividerCount + + (1 : + ℕ)))).biUnion + (goodB.gamma + (0 : + Fin + (HB.dividerCount + + (1 : ℕ)))); + (hnotMinus : + ¬TreeColorSetMinusClosed + G sigma A + reserved) → + GoodHierarchy K := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base alpha beta A n Tn Dn ib vb root sigma hAib B + hmissingTreeTn hmissingTreeR ettB baseB hclosureB HB goodB hBdata corr baseSigma K hnewdata + hcountK hcoreNew hclosureNew hstoredEq hstageMissingEq hsegmentSubset reserved hnotMinus + exact { + gamma := fun _ eta => goodB.gamma 0 eta + twoColors := by + intro j eta heta + have hj : j = 0 := Fin.ext (by have := j.isLt; change j.val = 0; omega) + subst j + exact goodB.twoColors 0 eta (hstoredEq ▸ heta) + avoidance := by + intro j eta heta c hc + have hj : j = 0 := Fin.ext (by have := j.isLt; change j.val = 0; omega) + subst j + have hold := goodB.avoidance 0 eta (hstoredEq ▸ heta) hc + exact Finset.mem_sdiff.mpr ⟨hstageMissingEq.symm ▸ (Finset.mem_sdiff.mp hold).1, + fun hseg => (Finset.mem_sdiff.mp hold).2 (hsegmentSubset eta heta hseg)⟩ + disjointPairs := by + intro j eta theta heta htheta hne' + have hj : j = 0 := Fin.ext (by have := j.isLt; change j.val = 0; omega) + subst j + exact goodB.disjointPairs 0 eta theta (hstoredEq ▸ heta) (hstoredEq ▸ htheta) hne' + uniqueRefresh := by intro i; have := i.isLt; omega + parallelBase := by + dsimp + intro hpe + have hreserved : (HierarchyStoredColorsAt K 0).biUnion + (fun eta => goodB.gamma 0 eta) = reserved := by rw [hstoredEq] + rw [hcoreNew, hclosureNew, hnewdata.1, hreserved, + hmissingTreeTn, hmissingTreeR] + refine ⟨hnotMinus, ?_⟩ + have hold := (goodB.parallelBase hBdata.2.2).2 + simpa only [hBdata.1, hclosureB] using hold + minusClosed := by intro i; have := i.isLt; omega } + +private abbrev helperContinuation2438Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (hproper : + IsProperEdgeColoring G phi) (hone : IsOneEdgeUncolored phi e0) (hlower : + LowerRoundInductionHypothesis G k e0 ett.rounds) (hminimal : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) (alpha beta : Fin k) (horderedUnused : + have H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + have ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; alpha ∉ + TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A → TreeVertexOrder T (T.vertex ia) + (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + ∀ (hzero : H.dividerCount = (0 : ℕ)) (hstar : HierarchyStarredStage H (Fin.last + H.dividerCount) = A) (hstarC : HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A) (hvaA : va ∈ TreeSequenceVertexSet A) (prefixPosition : + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → + ∀ (i : Fin (Y.length + (1 : ℕ))), Y.vertex i ∈ TreeSequenceVertexSet X ↔ (↑i : ℕ) ≤ X.length) + (hAlen : A.length < T.length), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) ( + by omega + ); + ∀ (hTy : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) (hTyT : + TreeSequenceInitialSegment Ty T) (ha : alpha ∈ MissingColors G phi (T.vertex + (HierarchyFirstMissingPosition phi T alpha)) ∧ (↑(HierarchyFirstMissingPosition phi T + alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) (hb : beta ∈ MissingColors + G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ (↑j : ℕ)) (hvaTy : va ∈ + TreeSequenceVertexSet Ty) (hvbTy : vb ∈ TreeSequenceVertexSet Ty) (hab : va ≠ vb) (hbetaA + : beta ∉ TreeMissingColors phi A) (halphaA : alpha ∈ TreeMissingColors phi A) (terminalPE + : ett.series.data.kind n = some TashkinovExtensionKind.PE) (union : OrderedTreeUnion + (ett.series.data.tree (Fin.last ett.rounds).castSucc) base.closure base.core) (hpathA : + TwoColorPathComponent G phi alpha beta (Sum.inl va)) (hpathB : TwoColorPathComponent G phi + alpha beta (Sum.inl vb)) (hdistinct : ¬TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb)), + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; + ∀ (hsProper : IsProperEdgeColoring G sigma) (hsOne : IsOneEdgeUncolored sigma e0) (hbehavior : + have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors + G phi v)) (edgeVertex : + ∀ (f : E) (v : V), Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ + component → Sum.inl v ∈ component) (hgraph : TwoColorIncidenceGraph G sigma alpha beta = + TwoColorIncidenceGraph G phi alpha beta) (hcomponents : + ∀ (z : V ⊕ E), TwoColorComponent G sigma alpha beta z = TwoColorComponent G phi alpha beta z) + (hmissingSwap : + ∀ (v : V) (hv : Sum.inl v ∈ component), (alpha ∈ MissingColors G sigma v ↔ beta ∈ + MissingColors G phi v) ∧ (beta ∈ MissingColors G sigma v ↔ alpha ∈ MissingColors G phi v)) + (hself : Sum.inl vb ∈ component) (hvaOutside : Sum.inl va ∉ component) (haSigma : alpha ∈ + MissingColors G sigma va) (hbSigma : alpha ∈ MissingColors G sigma vb) (hcombined : + CombinedStableColoring Tn base.closure Dn phi sigma) (segmentTrans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) (hYZ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) (commonPrefix : + ∀ {X Y Z : TreeSequence G e0} (hXZ : TreeSequenceInitialSegment X Z) (hYZ : + TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y) (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) (Nat.le_of_lt_succ ib.isLt); + ∀ (hBT : TreeSequenceInitialSegment B T) (hAB : TreeSequenceInitialSegment A B) (hTnB : + TreeSequenceInitialSegment Tn B) (hBstrict : B.length < T.length) (hrouteB : + TashkinovAugmentationSequence phi Tn B) (hpreserved : + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + have seed : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); ( + ∀ (j : Fin Tn.length), sigma (Tn.edge j) = phi (Tn.edge j)) ∧ ( + ∀ (j : Fin base.closure.length), sigma (base.closure.edge j) = phi (base.closure.edge j)) ∧ + TashkinovClosure sigma seed base.closure) (hfixedA : + ∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)), False + +private abbrev helperBranch2767Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : + IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating'), other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') (_ : + GoodHierarchy K), K.dividerCount < C.hierarchy.dividerCount → ColoredVertexSetElementary G + generating' (TreeSequenceVertexSet T')) (_ : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) (Nat.min_le_right + (A.length + (ell - (1 : ℕ))) T.length); ColoredVertexSetElementary G phi + (TreeSequenceVertexSet Ty)) (_ : + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; (2 : ℕ) * ett.rounds + (11 : ℕ) + ≤ (TreeMissingColors phi Tn).card) (alpha beta : Fin k) (_ : alpha ≠ beta) (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) (Nat.min_le_right + (A.length + (ell - (1 : ℕ))) T.length); alpha ∈ TreeMissingColors phi Ty ∧ beta ∈ + TreeMissingColors phi Ty) (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; alpha ∉ + TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A → TreeVertexOrder T (T.vertex ia) + (T.vertex ib) ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))) (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); va ∈ TreeSequenceVertexSet + A ∧ vb ∉ TreeSequenceVertexSet A) (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; H.dividerCount = (0 : ℕ) ∧ + ¬TreeColorSetClosed G phi A ({ alpha } : Finset (Fin k)) ∧ (alpha ∈ TreeMissingColors phi + Tn ∨ Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn)), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let _ : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + let sameComponent : Prop := TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb); sameComponent + +private theorem helper_hfirst_209.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (hzero : H.dividerCount = (0 : ℕ)), + H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) = T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H hzero + have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp only [Fin.val_last] + omega + rw [hi] + exact H.terminalStage + +private theorem helper_prefixPosition_223.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → + ∀ (i : Fin (Y.length + (1 : ℕ))), Y.vertex i ∈ TreeSequenceVertexSet X ↔ (↑i : ℕ) ≤ X.length + := by + classical + intro V E G e0 X Y hXY i + constructor + · intro hv + obtain ⟨j, _, hj⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + have he := Y.vertex_injective ((hXY.2.1 j).trans hj) + have hv := congrArg Fin.val he + simp only [Fin.val_castLE] at hv + have := j.isLt + omega + · intro hi + let j : Fin (X.length + 1) := ⟨i.val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hXY.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨j, Finset.mem_univ _, + (hXY.2.1 j).symm.trans (congrArg Y.vertex he)⟩ + +private theorem helper_firstMissing_262.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base), + let A : TreeSequence G e0 := base.core; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); TreeSequenceInitialSegment Ty T → + ∀ c ∈ TreeMissingColors phi Ty, c ∈ MissingColors G phi (T.vertex + (HierarchyFirstMissingPosition phi T c)) ∧ (↑(HierarchyFirstMissingPosition phi T c) : ℕ) + ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), c ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ (↑j : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C A Ty hTyT c hc + clear * - hc hTyT + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + obtain ⟨i, _, hi⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + let iT := Fin.castLE (Nat.succ_le_succ hTyT.1) i + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex j) + have him : iT ∈ candidates := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, by rw [hTyT.2.1 i, hi]; exact hvc⟩ + have hnonempty : candidates.Nonempty := ⟨iT, him⟩ + have hpos : HierarchyFirstMissingPosition phi T c = candidates.min' hnonempty := by + simp only [HierarchyFirstMissingPosition, candidates, dite_eq_left hnonempty] + rw [hpos] + refine ⟨(Finset.mem_filter.mp (Finset.min'_mem candidates hnonempty)).2, ?_, ?_⟩ + · have hle := Finset.min'_le candidates iT him + change (candidates.min' hnonempty).val ≤ i.val at hle + have := i.isLt + omega + · intro j hj + exact Finset.min'_le candidates j (Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩) + +private theorem helper_hbetaA_293.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (_ beta : + Fin k), + let A : TreeSequence G e0 := base.core; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; TreeSequenceInitialSegment A T → vb ∉ TreeSequenceVertexSet A → ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → + ∀ (i : Fin (Y.length + (1 : ℕ))), Y.vertex i ∈ TreeSequenceVertexSet X ↔ (↑i : ℕ) ≤ X.length) + → + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); (beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ (↑j : ℕ)) → beta ∉ TreeMissingColors + phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta A ib vb hAT hvbA prefixPosition Ty + hb hm + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + obtain ⟨i, _, hi⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + have hle := hb.2.2 (Fin.castLE (Nat.succ_le_succ hAT.1) i) + (by rw [hAT.2.1 i, hi]; exact hvm) + apply hvbA + apply (prefixPosition hAT ib).2 + have := i.isLt + simp only [Fin.val_castLE] at hle + omega + +private theorem helper_stableClosed_307.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (X : TreeSequence G e0) (D : Finset (Fin k)) (psi pi : PartialEdgeColoring E k), + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → StableColoring X D psi pi → ColoredVertexSetClosed G psi + (TreeSequenceVertexSet X) → ColoredVertexSetClosed G pi (TreeSequenceVertexSet X) := by + classical + intro V E _ _ G k e0 X D psi pi hpsi hpsiOne hpi hpiOne hs hc + have hr : StableColoring X D pi psi := + (sc2 G e0 X D).symm + (x := ⟨psi, hpsi, hpsiOne⟩) (y := ⟨pi, hpi, hpiOne⟩) hs + intro f c v hf hv hfc hvm + have hboundary := hf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hboundary + obtain ⟨u, hu, w, hw, he⟩ := hboundary + have hinc : TreeIncidentEdge X f := by + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [he] + exact Sym2.mem_mk_left _ _ + have hm : c ∈ TreeMissingColors pi X := Finset.mem_biUnion.mpr ⟨v, hv, hvm⟩ + have hfixed := hr.1 f hinc ⟨c, Finset.mem_union_left _ hm, hfc⟩ + exact hc hf hv (hfixed.trans hfc) (by rw [hr.2 v hv]; exact hvm) + +private theorem helper_closedSingleton_330.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha : + Fin k), + let A : TreeSequence G e0 := base.core; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let va : V := T.vertex ia; va ∈ TreeSequenceVertexSet A → + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); (alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → ColoredVertexSetClosed G + phi (TreeSequenceVertexSet A) → TreeColorSetClosed G phi A ({ alpha } : Finset (Fin k)) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha A ia va hvaA Ty ha hc + clear * - hc hvaA ha + intro c hcs + have he : c = alpha := Finset.mem_singleton.mp hcs + subst c + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨hf, hfc⟩ := Finset.mem_filter.mp hf + exact hc hf hvaA hfc ha.1 + +private theorem helper_terminalPE_340.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (alpha : Fin k), + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; ¬TreeColorSetClosed G phi A + ({ alpha } : Finset (Fin k)) → ( + ∀ (X : TreeSequence G e0) (D : Finset (Fin k)) (psi pi : PartialEdgeColoring E k), + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → StableColoring X D psi pi → ColoredVertexSetClosed G psi + (TreeSequenceVertexSet X) → ColoredVertexSetClosed G pi (TreeSequenceVertexSet X)) → + (ColoredVertexSetClosed G phi (TreeSequenceVertexSet A) → TreeColorSetClosed G phi A + ({ alpha } : Finset (Fin k))) → ett.series.data.kind n = some TashkinovExtensionKind.PE + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base alpha A n hnotclosed stableClosed closedSingleton + let p : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have hp : p.succ = n := by + apply Fin.ext + change p.val + 1 = ett.rounds + dsimp [p] + have := ett.roundsPositive + omega + have hphi : phi = ett.series.data.coloring p.succ := by + rw [hp] + exact ett.generatingColoring + generalize heq : p.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero p heq).elim + | PE ci pp po pc pn nr choice alt gamma gr second sp so sr ew + cc cp cu cs ce ck cv co cd cg cl oe st => + have hci : ci = p := Fin.ext (by have := congrArg Fin.val heq; simp at this; omega) + subst ci + rw [← hp] + exact ck + | RE ci pp po pc pn available cc cs ce ck cv co cd cg ad ae cl oe st => + have hci : ci = p := Fin.ext (by have := congrArg Fin.val heq; simp at this; omega) + subst ci + have hnot : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE := by + rw [← hp, ck] + simp + have hcore : A = ett.series.data.tree p.succ.castSucc := + (base.nonparallel hnot).trans (by rw [hp]) + exact False.elim (hnotclosed (closedSingleton (by + simp only [hcore, hphi, cc] + exact @pc))) + | SE ci pp po pc pn nr choice alt cc cs ce ck cv co cd cg ad ae cl oe st => + have hci : ci = p := Fin.ext (by have := congrArg Fin.val heq; simp at this; omega) + subst ci + have hnot : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE := by + rw [← hp, ck] + simp + have hcore : A = ett.series.data.tree p.succ.castSucc := + (base.nonparallel hnot).trans (by rw [hp]) + apply False.elim + apply hnotclosed + apply closedSingleton + simp only [hcore, hphi, cc] + exact stableClosed _ _ _ _ pp po choice.selectedProper + choice.selectedOneUncolored choice.selectedStable pc + +private theorem helper_hnotcommon_396.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → LowerRoundInductionHypothesis G k + e0 ett.rounds → + ∀ (alpha : Fin k), + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let va : V := T.vertex ia; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); (alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → ¬TreeColorSetClosed G phi + A ({ alpha } : Finset (Fin k)) → ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi phi → ¬(va ∈ TreeSequenceVertexSet Tn ∧ va ∈ + TreeSequenceVertexSet base.closure) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha A n Tn Dn ia va Ty ha + hnotclosed terminalPE hidentity + rintro ⟨hvT, hvR⟩ + exact hnotclosed (InterchangePECommonMissingClosed G k e0 input T phi phi + ett C.maximum C.positive hlower terminalPE base hproper hone hidentity alpha + (Finset.mem_biUnion.mpr ⟨va, hvT, ha.1⟩) + (Finset.mem_biUnion.mpr ⟨va, hvR, ha.1⟩)) + +private theorem helper_hsplit_403.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (alpha : Fin k), + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let va : V := T.vertex ia; va ∈ TreeSequenceVertexSet A → OrderedTreeUnion + (ett.series.data.tree (Fin.last ett.rounds).castSucc) base.closure base.core → ¬(va ∈ + TreeSequenceVertexSet Tn ∧ va ∈ TreeSequenceVertexSet base.closure) → va ∈ + TreeSequenceVertexSet Tn ∧ va ∉ TreeSequenceVertexSet base.closure ∨ va ∈ + TreeSequenceVertexSet base.closure ∧ va ∉ TreeSequenceVertexSet Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base alpha A n Tn ia va hvaA union hnotcommon + have hv : va ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet base.closure := by + rw [← union.vertexSet] + exact hvaA + rcases Finset.mem_union.mp hv with ht | hr + · exact Or.inl ⟨ht, fun hr => hnotcommon ⟨ht, hr⟩⟩ + · exact Or.inr ⟨hr, fun ht => hnotcommon ⟨ht, hr⟩⟩ + +private theorem helper_pathMissing_411.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → + ∀ (c d : Fin k), c ≠ d → + ∀ (v : V), c ∈ MissingColors G phi v → TwoColorPathComponent G phi c d (Sum.inl v) := by + classical + intro V E _ _ G k phi hproper c d hcd v hvm + let _ := Fintype.ofFinite V + refine ⟨hcd, Sum.inl v, ?_, ?_⟩ + · change (TwoColorIncidenceGraph G phi c d).connectedComponentMk (Sum.inl v) = + (TwoColorIncidenceGraph G phi c d).connectedComponentMk (Sum.inl v) + rfl + · let : Fintype ((TwoColorIncidenceGraph G phi c d).neighborSet (Sum.inl v)) := + Fintype.ofFinite _ + intro x hx y hy + have hcard : Fintype.card ((TwoColorIncidenceGraph G phi c d).neighborSet + (Sum.inl v)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact MissingColorIncidenceEndpoint G phi c d hcd hproper v hvm + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hcard ⟨x, hx⟩ ⟨y, hy⟩) + +private theorem helper_hpathB_430.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta + : Fin k), alpha ≠ beta → + let A : TreeSequence G e0 := base.core; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); (beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ (↑j : ℕ)) → ( + ∀ (c d : Fin k), c ≠ d → + ∀ (v : V), c ∈ MissingColors G phi v → TwoColorPathComponent G phi c d (Sum.inl v)) → + TwoColorPathComponent G phi alpha beta (Sum.inl vb) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne A ib vb Ty hb pathMissing + have hbpath := pathMissing beta alpha hne.symm vb hb.1 + have hgraph : TwoColorIncidenceGraph G phi beta alpha = + TwoColorIncidenceGraph G phi alpha beta := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + refine ⟨hne, ?_⟩ + have hp := hbpath.2 + change ∃ x ∈ ((TwoColorIncidenceGraph G phi beta alpha).connectedComponentMk + (Sum.inl vb) : Set (Sum V E)), + ((TwoColorIncidenceGraph G phi beta alpha).neighborSet x).Subsingleton at hp + rw [hgraph] at hp + exact hp + +private theorem helper_hsOne_451.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k), IsOneEdgeUncolored phi + e0 → + ∀ (alpha beta : Fin k), alpha ≠ beta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; IsOneEdgeUncolored sigma e0 + := by + classical + intro V E _ _ G k e0 T phi hone alpha beta hne ib vb root sigma component + let _ := Fintype.ofFinite V + constructor + · simp [sigma, TwoColorComponentSwap, hone.1] + · intro f hf + obtain ⟨c, hc⟩ := hone.2 f hf + by_cases hcomp : Sum.inr f ∈ component + · by_cases hca : c = alpha + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, component, hcomp, hc, hca]⟩ + · by_cases hcb : c = beta + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, component, hcomp, hc, hcb]⟩ + · exact ⟨c, by simp [sigma, TwoColorComponentSwap, component, hcomp, hc, hca, hcb]⟩ + · exact ⟨c, by simp [sigma, TwoColorComponentSwap, component, hcomp, hc]⟩ + +private theorem helper_hgraph_479.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta + : Fin k), alpha ≠ beta → + let A : TreeSequence G e0 := base.core; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); (alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → (beta ∈ MissingColors G + phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ (↑j : ℕ)) → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; TwoColorIncidenceGraph G sigma + alpha beta = TwoColorIncidenceGraph G phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne A ib vb Ty ha hb root sigma + component + clear * - hne component + ext x y + cases x with + | inl v => + cases y with + | inl w => rfl + | inr f => + by_cases hm : Sum.inr f ∈ component <;> + by_cases ha : phi f = some alpha <;> by_cases hb : phi f = some beta <;> + simp [TwoColorIncidenceGraph, sigma, TwoColorComponentSwap, component, + hm, ha, hb, hne, hne.symm] + | inr f => + cases y with + | inr g => rfl + | inl v => + by_cases hm : Sum.inr f ∈ component <;> + by_cases ha : phi f = some alpha <;> by_cases hb : phi f = some beta <;> + simp [TwoColorIncidenceGraph, sigma, TwoColorComponentSwap, component, + hm, ha, hb, hne, hne.symm] + +private theorem helper_hinvolution_504.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta + : Fin k), alpha ≠ beta → + let A : TreeSequence G e0 := base.core; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); (alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → (beta ∈ MissingColors G + phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ (↑j : ℕ)) → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; ( + ∀ (z : V ⊕ E), TwoColorComponent G sigma alpha beta z = TwoColorComponent G phi alpha beta z) + → TwoColorComponentSwap G sigma alpha beta root = phi := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne A ib vb Ty ha hb root sigma + component hcomponents + clear * - hne hcomponents component + funext f + unfold TwoColorComponentSwap + rw [hcomponents] + change (if Sum.inr f ∈ component then + if sigma f = some alpha then some beta else if sigma f = some beta then some alpha + else sigma f else sigma f) = phi f + by_cases hm : Sum.inr f ∈ component <;> + by_cases ha : phi f = some alpha <;> by_cases hb : phi f = some beta <;> + simp [sigma, TwoColorComponentSwap, component, hm, ha, hb, hne.symm] + +private theorem helper_hmissingSwap_517.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k), + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; ( + have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors + G phi v)) → ( + ∀ (z : V ⊕ E), TwoColorComponent G sigma alpha beta z = TwoColorComponent G phi alpha beta z) + → ( + have C : Set (V ⊕ E) := TwoColorComponent G sigma alpha beta root; + have phi' : PartialEdgeColoring E k := phi; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G sigma v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → alpha ∈ MissingColors G sigma v → beta ∈ MissingColors G phi' v) ∧ + ( + ∀ (v : V), Sum.inl v ∈ C → beta ∈ MissingColors G sigma v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors + G sigma v)) → + ∀ (v : V), Sum.inl v ∈ component → (alpha ∈ MissingColors G sigma v ↔ beta ∈ MissingColors G + phi v) ∧ (beta ∈ MissingColors G sigma v ↔ alpha ∈ MissingColors G phi v) := by + classical + intro V E _ _ G k e0 T phi alpha beta ib vb root sigma component hbehavior hcomponents hreverse v + hv + let _ := Fintype.ofFinite V + have hvs : Sum.inl v ∈ TwoColorComponent G sigma alpha beta root := by + rw [hcomponents] + exact hv + exact ⟨⟨hreverse.2.1 v hvs, hbehavior.2.2.1 v hv⟩, + ⟨hreverse.2.2.1 v hvs, hbehavior.2.1 v hv⟩⟩ + +private theorem helper_noMissing_538.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta + : Fin k), + let A : TreeSequence G e0 := base.core; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let va : V := T.vertex ia; va ∈ TreeSequenceVertexSet A → + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) → (alpha ∈ MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ (↑(HierarchyFirstMissingPosition + phi T alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → beta ∉ TreeMissingColors + phi A → + ∀ (X : TreeSequence G e0), TreeSequenceVertexSet X ⊆ TreeSequenceVertexSet A → va ∉ + TreeSequenceVertexSet X → alpha ∉ TreeMissingColors phi X ∧ beta ∉ TreeMissingColors phi X + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta A ia va hvaA Ty hAElementary ha + hbetaA X hXA hva + constructor + · intro hm + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + exact Finset.disjoint_left.mp (hAElementary hvaA (hXA hv) + (by intro he; exact hva (he ▸ hv))) ha.1 hvm + · intro hm + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + exact hbetaA (Finset.mem_biUnion.mpr ⟨v, hXA hv, hvm⟩) + +private theorem helper_stableNoMissing_550.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k), + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; ( + have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors + G phi v)) → ( + ∀ (v : V), Sum.inl v ∈ component → (alpha ∈ MissingColors G sigma v ↔ beta ∈ MissingColors G + phi v) ∧ (beta ∈ MissingColors G sigma v ↔ alpha ∈ MissingColors G phi v)) → + ∀ (X : TreeSequence G e0) (D : Finset (Fin k)), alpha ∉ TreeMissingColors phi X → beta ∉ + TreeMissingColors phi X → alpha ∉ D → beta ∉ D → StableColoring X D phi sigma := by + classical + intro V E _ _ G k e0 T phi alpha beta ib vb root sigma component hbehavior hmissingSwap X D hna + hnb hda hdb + let _ := Fintype.ofFinite V + constructor + · intro f hf hc + obtain ⟨c, hc, hfc⟩ := hc + have hca : c ≠ alpha := by + intro he; subst c; exact (Finset.notMem_union.mpr ⟨hna, hda⟩) hc + have hcb : c ≠ beta := by + intro he; subst c; exact (Finset.notMem_union.mpr ⟨hnb, hdb⟩) hc + simp [sigma, TwoColorComponentSwap, hfc, hca, hcb] + · intro v hv + by_cases hvc : Sum.inl v ∈ component + · apply Finset.ext + intro c + by_cases hca : c = alpha + · subst c + have hva : alpha ∉ MissingColors G phi v := fun hm => + hna (Finset.mem_biUnion.mpr ⟨v, hv, hm⟩) + have hvb : beta ∉ MissingColors G phi v := fun hm => + hnb (Finset.mem_biUnion.mpr ⟨v, hv, hm⟩) + simp only [hmissingSwap v hvc, hva, hvb] + · by_cases hcb : c = beta + · subst c + have hva : alpha ∉ MissingColors G phi v := fun hm => + hna (Finset.mem_biUnion.mpr ⟨v, hv, hm⟩) + have hvb : beta ∉ MissingColors G phi v := fun hm => + hnb (Finset.mem_biUnion.mpr ⟨v, hv, hm⟩) + simp only [hmissingSwap v hvc, hva, hvb] + · exact hbehavior.2.2.2 v c hca hcb + · exact hbehavior.1 v hvc + +private theorem helper_stableOutside_583.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k), + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; ( + have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors + G phi v)) → ( + ∀ (f : E) (v : V), Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ + component → Sum.inl v ∈ component) → + ∀ (X : TreeSequence G e0) (D : Finset (Fin k)), ( + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ component) → StableColoring X D phi sigma := by + classical + intro V E _ _ G k e0 T phi alpha beta ib vb root sigma component hbehavior edgeVertex X D hout + let _ := Fintype.ofFinite V + constructor + · intro f hf hc + obtain ⟨v, hv, hvf⟩ := hf + by_cases hm : Sum.inr f ∈ component + · have hfa : phi f ≠ some alpha := fun he => hout v hv (edgeVertex f v hvf (Or.inl he) hm) + have hfb : phi f ≠ some beta := fun he => hout v hv (edgeVertex f v hvf (Or.inr he) hm) + simp [sigma, TwoColorComponentSwap, component, hm, hfa, hfb] + · simp [sigma, TwoColorComponentSwap, component, hm] + · intro v hv + exact hbehavior.1 v (hout v hv) + +private theorem helper_hcombined_604.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → LowerRoundInductionHypothesis G k + e0 ett.rounds → + ∀ (alpha beta : Fin k), ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; H.dividerCount = (0 : ℕ) ∧ + ¬TreeColorSetClosed G phi A ({ alpha } : Finset (Fin k)) ∧ (alpha ∈ TreeMissingColors phi + Tn ∨ Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn)) → + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); (alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → ett.series.data.kind n = + some TashkinovExtensionKind.PE → TreeSequenceInitialSegment Tn A → TreeSequenceVertexSet + base.closure ⊆ TreeSequenceVertexSet A → CombinedStableColoring Tn base.closure Dn phi phi + → va ∈ TreeSequenceVertexSet Tn ∧ va ∉ TreeSequenceVertexSet base.closure ∨ va ∈ + TreeSequenceVertexSet base.closure ∧ va ∉ TreeSequenceVertexSet Tn → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; ( + ∀ (X : TreeSequence G e0), TreeSequenceVertexSet X ⊆ TreeSequenceVertexSet A → va ∉ + TreeSequenceVertexSet X → alpha ∉ TreeMissingColors phi X ∧ beta ∉ TreeMissingColors phi + X) → ( + ∀ (X : TreeSequence G e0) (D : Finset (Fin k)), alpha ∉ TreeMissingColors phi X → beta ∉ + TreeMissingColors phi X → alpha ∉ D → beta ∉ D → StableColoring X D phi sigma) → ( + ∀ (X : TreeSequence G e0) (D : Finset (Fin k)), ( + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ component) → StableColoring X D phi sigma) → ( + ∀ (X : TreeSequence G e0), va ∈ TreeSequenceVertexSet X → TreeInterchangeable G X phi alpha + beta → + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ component) → CombinedStableColoring Tn base.closure + Dn phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta hbranch A n Tn + Dn ia ib va vb Ty ha terminalPE hTnA hRA hidentity hsplit root sigma component noMissing + stableNoMissing stableOutside outsideFromInterchange + rcases hsplit with ⟨hvaT, hvaR⟩ | ⟨hvaR, hvaT⟩ + · have hn := noMissing base.closure hRA hvaR + have hi := (interchange G k e0 input T phi phi ett C.maximum C.positive hlower + terminalPE base hproper hone hidentity alpha beta).2.1 + (Finset.mem_biUnion.mpr ⟨va, hvaT, ha.1⟩) + exact ⟨stableOutside Tn Dn (outsideFromInterchange Tn hvaT hi), + stableNoMissing base.closure ∅ hn.1 hn.2 (by simp) (by simp)⟩ + · have hn := noMissing Tn (TreeSequenceInitialSegmentVertexSetSubset hTnA) hvaT + have hd : Disjoint ({alpha, beta} : Finset (Fin k)) Dn := + hbranch.2.2.resolve_left hn.1 + have hi := (interchange G k e0 input T phi phi ett C.maximum C.positive hlower + terminalPE base hproper hone hidentity alpha beta).1 + (Finset.mem_biUnion.mpr ⟨va, hvaR, ha.1⟩) + exact ⟨stableNoMissing Tn Dn hn.1 hn.2 + (fun hm => Finset.disjoint_left.mp hd (by simp) hm) + (fun hm => Finset.disjoint_left.mp hd (by simp) hm), + stableOutside base.closure ∅ (outsideFromInterchange base.closure hvaR hi)⟩ + +private theorem helper_commonPrefix_629.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y + Z → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by + classical + intro V E G e0 X Y Z hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + +private theorem helper_hroute_652.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TashkinovAugmentationSequence phi Tn + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 input T phi ett n Tn terminalPE + have cert := ett.series.certified n + generalize hn : n = target at cert + cases cert with + | initial triple sl cc cs ce ck cv co cd cg cl => + rw [hn, ck] at terminalPE + cases terminalPE + | SE i pp po pc pn nr ch alt cc cs ce ck cv co cd cg ad ae cl oe st => + rw [hn, ck] at terminalPE + cases terminalPE + | RE i pp po pc pn av cc cs ce ck cv co cd cg ad ae cl oe st => + rw [hn, ck] at terminalPE + cases terminalPE + | PE i pp po pc pn nr ch alt gamma gr second sp so sr ew + cc cp cu cs ce ck cv co cd cg cl oe st => + have hfinal : i.succ.succ = Fin.last (ett.rounds + 1) := by + apply Fin.ext + have hv := congrArg Fin.val hn + change ett.rounds = i.val + 1 at hv + simp only [Fin.val_succ, Fin.val_last] + omega + have hphi : phi = ett.series.data.coloring i.succ := ett.generatingColoring.trans + (congrArg ett.series.data.coloring hn) + simpa only [Tn, hn, hfinal, ← hphi] using cl.1 + +private theorem helper_hBdata_792.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : + Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ett.series.data.kind n = some TashkinovExtensionKind.PE → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) ( + by omega + ); + ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi), MaximumProperty ettB → ettB.rounds = + ett.rounds → ettB.series ≍ ett.series → + ∀ (baseB : HierarchyBase ettB phi), baseB.core = base.core → baseB.closure = base.closure → + (↑baseB.supportPosition : ℕ) = (↑base.supportPosition : ℕ) → + ∀ (HB : TashkinovHierarchy ettB baseB) (hcountB : HB.dividerCount = H.dividerCount), ( + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast ( + by omega + ) j; HB.stage j.castSucc = H.stage jo.castSucc ∧ HierarchyStarredStage HB j = + HierarchyStarredStage H jo) → ( + ∀ (i : Fin HB.dividerCount), (↑(HB.dividerPosition i) : ℕ) = (↑(H.dividerPosition (Fin.cast + hcountB i)) : ℕ)) → + ∀ (goodB : GoodHierarchy HB), ( + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast ( + by omega + ) j; HierarchyStoredColorsAt HB j = HierarchyStoredColorsAt H jo ∧ HierarchyStageMissingColors + HB j = HierarchyStageMissingColors H jo ∧ + ∀ (eta : Fin k), goodB.gamma j eta = C.good.gamma jo eta ∧ HierarchySegmentColors HB j eta ⊆ + HierarchySegmentColors H jo eta) → ettB.series.data.tree (Fin.last ettB.rounds).castSucc = + Tn ∧ TashkinovStoredColors ettB.series.data (Fin.last ettB.rounds) = Dn ∧ + ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.PE := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H A n Tn Dn ib terminalPE hAib B + ettB hMPB hrB hseriesB baseB hcoreB hclosureB hsupportB HB hcountB hstagesB hpositionsB + goodB hgoodDataB + cases ettB with + | mk r rp series above strict below generating => + dsimp only at hrB hseriesB ⊢ + cases hrB + have he : series = ett.series := eq_of_heq hseriesB + cases he + exact ⟨rfl, rfl, terminalPE⟩ + +private theorem helper_hnewdata_812.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta + : Fin k), + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) ( + by omega + ); + ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi), ettB.series.data.tree (Fin.last + ettB.rounds).castSucc = Tn ∧ TashkinovStoredColors ettB.series.data (Fin.last ettB.rounds) + = Dn ∧ ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.PE → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn ∧ + TashkinovStoredColors corr.replacementETT.series.data (Fin.last + corr.replacementETT.rounds) = Dn ∧ corr.replacementETT.series.data.kind (Fin.last + corr.replacementETT.rounds) = some TashkinovExtensionKind.PE := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta A n Tn Dn ib vb root sigma hAib B + ettB hBdata corr + clear * - hBdata + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, replacementStable⟩ + cases replacementETT with + | mk r rp series above strict below generating => + cases rungAgreement + have he : series = replacementSeries := eq_of_heq seriesPresentation + cases he + let p : Fin ettB.rounds := ⟨ettB.rounds - 1, by have := ettB.roundsPositive; omega⟩ + have hp : p.succ = Fin.last ettB.rounds := by + apply Fin.ext + change p.val + 1 = ettB.rounds + dsimp [p] + have := ettB.roundsPositive + omega + have htree : replacementSeries.data.tree (Fin.last ettB.rounds).castSucc = + ettB.series.data.tree (Fin.last ettB.rounds).castSucc := by + rw [← hp] + exact ladderTreesAgree p + have hstable : StableColoring + (ettB.series.data.tree (Fin.last ettB.rounds).castSucc) + (TashkinovStoredColors ettB.series.data (Fin.last ettB.rounds)) + (ettB.series.data.coloring (Fin.last ettB.rounds)) + (replacementSeries.data.coloring (Fin.last ettB.rounds)) := by + simpa only [hp] using replacementStable p + have hmissing : TreeMissingColors (replacementSeries.data.coloring (Fin.last ettB.rounds)) + (replacementSeries.data.tree (Fin.last ettB.rounds).castSucc) = + TreeMissingColors (ettB.series.data.coloring (Fin.last ettB.rounds)) + (ettB.series.data.tree (Fin.last ettB.rounds).castSucc) := by + rw [htree] + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => hstable.2 v hv) + have hstored : TashkinovStoredColors replacementSeries.data (Fin.last ettB.rounds) = + TashkinovStoredColors ettB.series.data (Fin.last ettB.rounds) := by + unfold TashkinovStoredColors + have hn : (Fin.last ettB.rounds).val ≠ 0 := by + simpa only [Fin.val_last] using Nat.ne_of_gt ettB.roundsPositive + simp only [ite_eq_right hn] + rw [hmissing] + congr 1 + apply Finset.biUnion_congr rfl + intro i hi + rw [storedColorsAgree i] + exact ⟨htree.trans hBdata.1, hstored.trans hBdata.2.1, + (extensionKindsAgree (Fin.last ettB.rounds)).trans hBdata.2.2⟩ + +private theorem helper_hstoredEq_870.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta + : Fin k), + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) ( + by omega + ); TreeMissingColors sigma A = TreeMissingColors phi A → + ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi) (baseB : HierarchyBase ettB phi), + baseB.core = base.core → + ∀ (HB : TashkinovHierarchy ettB baseB), ettB.series.data.tree (Fin.last ettB.rounds).castSucc + = Tn ∧ TashkinovStoredColors ettB.series.data (Fin.last ettB.rounds) = Dn ∧ + ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.PE → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) (baseSigma : HierarchyBase + corr.replacementETT sigma) (K : TashkinovHierarchy corr.replacementETT baseSigma), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn ∧ + TashkinovStoredColors corr.replacementETT.series.data (Fin.last + corr.replacementETT.rounds) = Dn ∧ corr.replacementETT.series.data.kind (Fin.last + corr.replacementETT.rounds) = some TashkinovExtensionKind.PE → baseSigma.core = A → + HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ))) = HierarchyStoredColorsAt + HB (0 : Fin (HB.dividerCount + (1 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta A n Tn Dn ib vb root sigma hAib B + hmissingTreeA ettB baseB hcoreB HB hBdata corr baseSigma K hnewdata hcoreNew + change TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) \ TreeMissingColors sigma baseSigma.core = + TashkinovStoredColors ettB.series.data (Fin.last ettB.rounds) \ + TreeMissingColors phi baseB.core + rw [hnewdata.2.1, hBdata.2.1, hcoreNew, hcoreB, hmissingTreeA] + +private theorem helper_halphaNotStored_882.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta + : Fin k), + let A : TreeSequence G e0 := base.core; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; alpha ∈ TreeMissingColors phi A → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) ( + by omega + ); TreeMissingColors sigma A = TreeMissingColors phi A → + ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi) (corr : CorrespondingExtendedTashkinovTree + G k e0 ettB sigma B) (baseSigma : HierarchyBase corr.replacementETT sigma) (K : + TashkinovHierarchy corr.replacementETT baseSigma), baseSigma.core = A → alpha ∉ + HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta A ib vb halphaA root sigma hAib B + hmissingTreeA ettB corr baseSigma K hcoreNew hm + exact (Finset.mem_sdiff.mp hm).2 (by + change alpha ∈ TreeMissingColors sigma baseSigma.core + rw [hcoreNew, hmissingTreeA] + exact halphaA) + +private theorem helper_hbetaNone_889.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta + : Fin k), + let A : TreeSequence G e0 := base.core; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty) → (alpha ∈ MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ (↑(HierarchyFirstMissingPosition + phi T alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → (beta ∈ MissingColors G + phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ (↑j : ℕ)) → va ∈ TreeSequenceVertexSet + Ty → vb ∈ TreeSequenceVertexSet Ty → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; ( + have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors + G phi v)) → ( + ∀ (v : V), Sum.inl v ∈ component → (alpha ∈ MissingColors G sigma v ↔ beta ∈ MissingColors G + phi v) ∧ (beta ∈ MissingColors G sigma v ↔ alpha ∈ MissingColors G phi v)) → Sum.inl vb ∈ + component → Sum.inl va ∉ component → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) ( + by omega + ); TreeSequenceInitialSegment B Ty → beta ∉ TreeMissingColors sigma B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta A ia ib va vb Ty hTy ha hb hvaTy + hvbTy root sigma component hbehavior hmissingSwap hself hvaOutside hAib B hBTy hm + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + have hvTy := TreeSequenceInitialSegmentVertexSetSubset hBTy hv + by_cases hvc : Sum.inl v ∈ component + · have hma : alpha ∈ MissingColors G phi v := (hmissingSwap v hvc).2.1 hvm + have hneVA : va ≠ v := by intro he; exact hvaOutside (he ▸ hvc) + exact Finset.disjoint_left.mp (hTy hvaTy hvTy hneVA) ha.1 hma + · have hmb : beta ∈ MissingColors G phi v := by rw [← hbehavior.1 v hvc]; exact hvm + have hneVB : vb ≠ v := by intro he; exact hvc (he ▸ hself) + exact Finset.disjoint_left.mp (hTy hvbTy hvTy hneVB) hb.1 hmb + +private theorem helper_hfirstEq_900.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta + : Fin k), + let A : TreeSequence G e0 := base.core; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; ( + have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors + G phi v)) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) ( + by omega + ); TreeSequenceInitialSegment B T → beta ∉ TreeMissingColors sigma B → + ∀ (eta : Fin k), eta ≠ alpha → (↑(HierarchyFirstMissingPosition sigma B eta) : ℕ) = + (↑(HierarchyFirstMissingPosition phi B eta) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta A ib vb root sigma hbehavior hAib B + hBT hbetaNone eta hena + clear * - hbetaNone hBT hbehavior hena + by_cases heb : eta = beta + · subst eta + have hempty : ¬ (Finset.univ.filter fun i : Fin (B.length + 1) => + beta ∈ MissingColors G sigma (B.vertex i)).Nonempty := by + rintro ⟨i, hi⟩ + apply hbetaNone + exact Finset.mem_biUnion.mpr ⟨B.vertex i, + (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, Finset.mem_univ _, rfl⟩, + (Finset.mem_filter.mp hi).2⟩ + have hnew : (HierarchyFirstMissingPosition sigma B beta).val = B.length := by + simp only [HierarchyFirstMissingPosition, dite_eq_right hempty, Fin.val_last] + have hcut := HierarchyFirstMissingPositionPrefixCutoff phi B T hBT beta B.length le_rfl + have hold : (HierarchyFirstMissingPosition phi B beta).val = B.length := by + have hi := (HierarchyFirstMissingPosition phi B beta).isLt + change min (HierarchyFirstMissingPosition phi B beta).val B.length = + min ib.val B.length at hcut + change min (HierarchyFirstMissingPosition phi B beta).val ib.val = + min ib.val ib.val at hcut + change (HierarchyFirstMissingPosition phi B beta).val < ib.val + 1 at hi + change (HierarchyFirstMissingPosition phi B beta).val = ib.val + omega + exact hnew.trans hold.symm + · have hcandidates : (Finset.univ.filter fun i : Fin (B.length + 1) => + eta ∈ MissingColors G sigma (B.vertex i)) = + (Finset.univ.filter fun i : Fin (B.length + 1) => + eta ∈ MissingColors G phi (B.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hbehavior.2.2.2 (B.vertex i) eta hena heb + unfold HierarchyFirstMissingPosition + rw [hcandidates] + +private theorem helper_hnextHB_935.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (_ beta : Fin k), + let A : TreeSequence G e0 := base.core; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi) (baseB : HierarchyBase ettB phi) + (HB : TashkinovHierarchy ettB baseB), + HB.dividerCount = (0 : ℕ) → + HB.stage (Fin.succ (0 : Fin (HB.dividerCount + (1 : ℕ)))) = B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta A ib hAib B ettB baseB HB hcountHB + clear * - hcountHB + have hi : (0 : Fin (HB.dividerCount + 1)).succ = Fin.last (HB.dividerCount + 1) := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_zero, Fin.val_last, hcountHB] + rw [hi, HB.terminalStage] + +private theorem helper_hnextK_941.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) + (alpha beta : Fin k), + let A : TreeSequence G e0 := base.core; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseSigma : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT baseSigma), + K.dividerCount = (0 : ℕ) → + K.stage (Fin.succ (0 : Fin (K.dividerCount + (1 : ℕ)))) = B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta A ib vb root sigma hAib B ettB corr + baseSigma K hcountK + clear * - hcountK + have hi : (0 : Fin (K.dividerCount + 1)).succ = Fin.last (K.dividerCount + 1) := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_zero, Fin.val_last, hcountK] + rw [hi, K.terminalStage] + +private theorem helper_hsegmentSubset_947.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta + : Fin k), + let A : TreeSequence G e0 := base.core; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) ( + by omega + ); ( + ∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi) (baseB : HierarchyBase ettB phi), + baseB.core = base.core → + ∀ (HB : TashkinovHierarchy ettB baseB) (corr : CorrespondingExtendedTashkinovTree G k e0 ettB + sigma B) (baseSigma : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT baseSigma), baseSigma.core = A → alpha ∉ HierarchyStoredColorsAt K (0 + : Fin (K.dividerCount + (1 : ℕ))) → ( + ∀ (eta : Fin k), eta ≠ alpha → (↑(HierarchyFirstMissingPosition sigma B eta) : ℕ) = + (↑(HierarchyFirstMissingPosition phi B eta) : ℕ)) → HB.stage (Fin.succ (0 : Fin + (HB.dividerCount + (1 : ℕ)))) = B → K.stage (Fin.succ (0 : Fin (K.dividerCount + (1 : + ℕ)))) = B → + ∀ eta ∈ HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ))), HierarchySegmentColors + K (0 : Fin (K.dividerCount + (1 : ℕ))) eta ⊆ HierarchySegmentColors HB (0 : Fin + (HB.dividerCount + (1 : ℕ))) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta A ib vb root sigma hAib B hfixedB + ettB baseB hcoreB HB corr baseSigma K hcoreNew halphaNotStored hfirstEq hnextHB hnextK eta + heta + clear * - halphaNotStored hnextK hnextHB hcoreNew hcoreB hfirstEq hfixedB heta + have hena : eta ≠ alpha := by intro he; exact halphaNotStored (he ▸ heta) + let colors (psi : PartialEdgeColoring E k) (a : ℕ) (W : TreeSequence G e0) := + Finset.univ.filter fun c => ∃ t : Fin W.length, + a ≤ t.val ∧ t.val < min (HierarchyFirstMissingPosition psi B eta).val W.length ∧ + psi (W.edge t) = some c + have hsegK : HierarchySegmentColors K 0 eta = colors sigma baseSigma.core.length B := by + change colors sigma baseSigma.core.length (K.stage (0 : Fin (K.dividerCount + 1)).succ) = _ + exact congrArg (colors sigma baseSigma.core.length) hnextK + have hsegHB : HierarchySegmentColors HB 0 eta = colors phi baseB.core.length B := by + change colors phi baseB.core.length (HB.stage (0 : Fin (HB.dividerCount + 1)).succ) = _ + exact congrArg (colors phi baseB.core.length) hnextHB + rw [hsegK, hsegHB] + dsimp only [colors] + rw [hcoreNew, hcoreB, hfirstEq eta hena] + intro c hc + obtain ⟨_, t, hlo, hhi, hcol⟩ := Finset.mem_filter.mp hc + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, hhi, + (hfixedB t).symm.trans hcol⟩ + +private theorem helper_hnotMinus_969.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; va ∈ TreeSequenceVertexSet A → beta ∉ TreeMissingColors phi A → + alpha ∈ TreeMissingColors phi A → ett.series.data.kind n = some TashkinovExtensionKind.PE + → TwoColorPathComponent G phi alpha beta (Sum.inl va) → TwoColorPathComponent G phi alpha + beta (Sum.inl vb) → ¬TwoColorComponent G phi alpha beta (Sum.inl va) = TwoColorComponent G + phi alpha beta (Sum.inl vb) → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → ( + ∀ (f : E) (v : V), Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ + component → Sum.inl v ∈ component) → TwoColorIncidenceGraph G sigma alpha beta = + TwoColorIncidenceGraph G phi alpha beta → ( + ∀ (z : V ⊕ E), TwoColorComponent G sigma alpha beta z = TwoColorComponent G phi alpha beta z) + → CombinedStableColoring Tn base.closure Dn phi sigma → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) ( + by omega + ); TreeMissingColors sigma A = TreeMissingColors phi A → + ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi) (baseB : HierarchyBase ettB phi), + baseB.core = base.core → + ∀ (HB : TashkinovHierarchy ettB baseB) (goodB : GoodHierarchy HB), ettB.series.data.tree + (Fin.last ettB.rounds).castSucc = Tn ∧ TashkinovStoredColors ettB.series.data (Fin.last + ettB.rounds) = Dn ∧ ettB.series.data.kind (Fin.last ettB.rounds) = some + TashkinovExtensionKind.PE → + let reserved : Finset (Fin k) := (HierarchyStoredColorsAt HB (0 : Fin (HB.dividerCount + (1 : + ℕ)))).biUnion (goodB.gamma (0 : Fin (HB.dividerCount + (1 : ℕ)))); + ¬TreeColorSetMinusClosed G sigma A reserved := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hlower alpha beta A n Tn Dn ia ib va vb hvaA + hbetaA halphaA terminalPE hpathA hpathB hdistinct root sigma component hsProper hsOne + edgeVertex hgraph hcomponents hcombined hAib B hmissingTreeA ettB baseB hcoreB HB goodB + hBdata reserved hclosed + apply (goodB.parallelBase hBdata.2.2).1 + change TreeColorSetClosed G phi baseB.core (TreeMissingColors phi baseB.core \ reserved) + rw [hcoreB] + intro c hc + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨hboundary, hcolor⟩ := Finset.mem_filter.mp hf + have hcs : c ∈ TreeMissingColors sigma A \ reserved := by + rw [hmissingTreeA] + exact hc + have hfixed : sigma f ≠ phi f := by + intro he + exact Finset.notMem_empty f (by + rw [← hclosed c hcs] + exact Finset.mem_filter.mpr ⟨hboundary, he.trans hcolor⟩) + have hecomp : Sum.inr f ∈ component := by + by_contra hn + exact hfixed (by simp [sigma, TwoColorComponentSwap, component, hn]) + have hcpair : c = alpha ∨ c = beta := by + by_contra hn + have hca : c ≠ alpha := fun he => hn (Or.inl he) + have hcb : c ≠ beta := fun he => hn (Or.inr he) + exact hfixed (by simp [sigma, TwoColorComponentSwap, component, hecomp, hcolor, hca, hcb]) + have hca : c = alpha := hcpair.resolve_right (by + intro he + exact hbetaA (he ▸ (Finset.mem_sdiff.mp hc).1)) + subst c + have hAlphaClosed : TreeColorSetClosed G sigma A {alpha} := by + intro c hc' + have he : c = alpha := Finset.mem_singleton.mp hc' + subst c + exact hclosed alpha hcs + have hAlphaSigmaA : alpha ∈ TreeMissingColors sigma A := by + rw [hmissingTreeA] + exact halphaA + have hInter := (interchange G k e0 input T phi sigma ett C.maximum C.positive hlower + terminalPE base hsProper hsOne hcombined alpha beta).2.2.1 hAlphaSigmaA hAlphaClosed + have pathTransport (z : Sum V E) (hp : TwoColorPathComponent G phi alpha beta z) : + TwoColorPathComponent G sigma alpha beta z := by + obtain ⟨hne', x, hx, hleaf⟩ := hp + refine ⟨hne', x, ?_, ?_⟩ + · rw [hcomponents] + exact hx + · exact (congrArg (fun g : SimpleGraph (Sum V E) => + Set.Subsingleton (g.neighborSet x)) hgraph).mpr hleaf + have hbnd := hboundary + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hbnd + obtain ⟨u, hu, w, hw, he⟩ := hbnd + have huf : Incident G u f := by change u ∈ G.ends f; rw [he]; exact Sym2.mem_mk_left _ _ + have hucomp := edgeVertex f u huf (Or.inl hcolor) hecomp + have heq := hInter (Sum.inl va) root (pathTransport _ hpathA) (pathTransport _ hpathB) + ⟨va, hvaA, by rw [hcomponents]; change _ = _; rfl⟩ + ⟨u, hu, by rw [hcomponents]; exact hucomp⟩ + rw [hcomponents, hcomponents] at heq + exact hdistinct heq + +private theorem helper_pathLE_1072.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; HierarchyStarredStage H (Fin.last H.dividerCount) = A → A.length < + T.length → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) ( + by omega + ); TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B → + ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi) (corr : CorrespondingExtendedTashkinovTree + G k e0 ettB sigma B) (baseSigma : HierarchyBase corr.replacementETT sigma) (K : + TashkinovHierarchy corr.replacementETT baseSigma), HierarchyStarredStage K (Fin.last + K.dividerCount) = A → HierarchyPathNumber K ≤ HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H A ib vb hstar hAlen root sigma + hAib B hBT hAB ettB corr baseSigma K hstarK + let ell := T.length - A.length + let ellB := B.length - A.length + let oldCandidates := (Finset.Icc 1 ell).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = Sym2.mk (T.vertex t.castSucc) (T.vertex t.succ) + let newCandidates := (Finset.Icc 1 ellB).filter fun i => + ∀ t : Fin B.length, A.length + i ≤ t.val → + G.ends (B.edge t) = Sym2.mk (B.vertex t.castSucc) (B.vertex t.succ) + have hell : 1 ≤ ell := by dsimp [ell]; omega + have hellB : 1 ≤ ellB := by + change 1 ≤ ib.val - A.length + omega + have holdMem : ell ∈ oldCandidates := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hell, le_rfl⟩, ?_⟩ + intro t ht + have := t.isLt + dsimp [ell] at ht + omega + have hnewMem : ellB ∈ newCandidates := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hellB, le_rfl⟩, ?_⟩ + intro t ht + have := t.isLt + have := hAB.1 + dsimp [ellB] at ht + omega + have holdNonempty : oldCandidates.Nonempty := ⟨ell, holdMem⟩ + have hnewNonempty : newCandidates.Nonempty := ⟨ellB, hnewMem⟩ + have hpathOld : HierarchyPathNumber H = oldCandidates.min' holdNonempty := by + unfold HierarchyPathNumber + simp only [hstar] + exact dite_eq_left holdNonempty + have hpathNew : HierarchyPathNumber K = newCandidates.min' hnewNonempty := by + unfold HierarchyPathNumber + simp only [hstarK] + exact dite_eq_left hnewNonempty + rw [hpathOld, hpathNew] + by_cases hr : oldCandidates.min' holdNonempty ≤ ellB + · have hmin := Finset.mem_filter.mp (Finset.min'_mem oldCandidates holdNonempty) + have hcandidate : oldCandidates.min' holdNonempty ∈ newCandidates := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr + ⟨(Finset.mem_Icc.mp hmin.1).1, hr⟩, ?_⟩ + intro t ht + let tT := Fin.castLE hBT.1 t + have he := hmin.2 tT (by exact ht) + have hv₁ := hBT.2.1 t.castSucc + have hv₂ := hBT.2.1 t.succ + have hi₁ : Fin.castLE (Nat.succ_le_succ hBT.1) t.castSucc = tT.castSucc := Fin.ext rfl + have hi₂ : Fin.castLE (Nat.succ_le_succ hBT.1) t.succ = tT.succ := Fin.ext rfl + rw [hi₁] at hv₁ + rw [hi₂] at hv₂ + rw [hBT.2.2 t, hv₁, hv₂] at he + exact he + exact Finset.min'_le newCandidates _ hcandidate + · exact le_trans (Finset.min'_le newCandidates ellB hnewMem) (Nat.le_of_lt + (Nat.lt_of_not_ge hr)) + +private theorem helper_hcombined_1980.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → LowerRoundInductionHypothesis G k + e0 ett.rounds → + ∀ (alpha beta : Fin k), ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; H.dividerCount = (0 : ℕ) ∧ + ¬TreeColorSetClosed G phi A ({ alpha } : Finset (Fin k)) ∧ (alpha ∈ TreeMissingColors phi + Tn ∨ Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn)) → + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); (alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Ty.length ∧ + ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → ett.series.data.kind n = + some TashkinovExtensionKind.PE → TreeSequenceInitialSegment Tn A → TreeSequenceVertexSet + base.closure ⊆ TreeSequenceVertexSet A → CombinedStableColoring Tn base.closure Dn phi phi + → va ∈ TreeSequenceVertexSet Tn ∧ va ∉ TreeSequenceVertexSet base.closure ∨ va ∈ + TreeSequenceVertexSet base.closure ∧ va ∉ TreeSequenceVertexSet Tn → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; ( + ∀ (X : TreeSequence G e0), TreeSequenceVertexSet X ⊆ TreeSequenceVertexSet A → va ∉ + TreeSequenceVertexSet X → alpha ∉ TreeMissingColors phi X ∧ beta ∉ TreeMissingColors phi + X) → ( + ∀ (X : TreeSequence G e0) (D : Finset (Fin k)), alpha ∉ TreeMissingColors phi X → beta ∉ + TreeMissingColors phi X → alpha ∉ D → beta ∉ D → StableColoring X D phi sigma) → ( + ∀ (X : TreeSequence G e0) (D : Finset (Fin k)), ( + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ component) → StableColoring X D phi sigma) → ( + ∀ (X : TreeSequence G e0), va ∈ TreeSequenceVertexSet X → TreeInterchangeable G X phi alpha + beta → + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ component) → CombinedStableColoring Tn base.closure + Dn phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta hbranch A n Tn + Dn ia ib va vb Ty ha terminalPE hTnA hRA hidentity hsplit root sigma component noMissing + stableNoMissing stableOutside outsideFromInterchange + exact helper_hcombined_604 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@alpha) (@beta) (@hbranch) (@ha) (@terminalPE) (@hTnA) (@hRA) + (@hidentity) (@hsplit) (@noMissing) (@stableNoMissing) (@stableOutside) + (@outsideFromInterchange) + +private theorem helper_hnotMinus_2199.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k), + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; va ∈ TreeSequenceVertexSet A → beta ∉ TreeMissingColors phi A → + alpha ∈ TreeMissingColors phi A → ett.series.data.kind n = some TashkinovExtensionKind.PE + → TwoColorPathComponent G phi alpha beta (Sum.inl va) → TwoColorPathComponent G phi alpha + beta (Sum.inl vb) → ¬TwoColorComponent G phi alpha beta (Sum.inl va) = TwoColorComponent G + phi alpha beta (Sum.inl vb) → + let root : V ⊕ E := Sum.inl vb; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; + let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → ( + ∀ (f : E) (v : V), Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ + component → Sum.inl v ∈ component) → TwoColorIncidenceGraph G sigma alpha beta = + TwoColorIncidenceGraph G phi alpha beta → ( + ∀ (z : V ⊕ E), TwoColorComponent G sigma alpha beta z = TwoColorComponent G phi alpha beta z) + → CombinedStableColoring Tn base.closure Dn phi sigma → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + (↑ib : ℕ)) ↦ + by omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); TreeMissingColors sigma A = TreeMissingColors phi A → + ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi) (baseB : HierarchyBase ettB phi), + baseB.core = base.core → + ∀ (HB : TashkinovHierarchy ettB baseB) (goodB : GoodHierarchy HB), ettB.series.data.tree + (Fin.last ettB.rounds).castSucc = Tn ∧ TashkinovStoredColors ettB.series.data (Fin.last + ettB.rounds) = Dn ∧ ettB.series.data.kind (Fin.last ettB.rounds) = some + TashkinovExtensionKind.PE → + let reserved : Finset (Fin k) := (HierarchyStoredColorsAt HB (0 : Fin (HB.dividerCount + (1 : + ℕ)))).biUnion (goodB.gamma (0 : Fin (HB.dividerCount + (1 : ℕ)))); + ¬TreeColorSetMinusClosed G sigma A reserved := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hlower alpha beta A n Tn Dn ia ib va vb hvaA + hbetaA halphaA terminalPE hpathA hpathB hdistinct root sigma component hsProper hsOne + edgeVertex hgraph hcomponents hcombined hAib B hmissingTreeA ettB baseB hcoreB HB goodB + hBdata reserved + exact helper_hnotMinus_969 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hlower) + (@alpha) (@beta) (@hvaA) (@hbetaA) (@halphaA) (@terminalPE) (@hpathA) (@hpathB) + (@hdistinct) (@hsProper) (@hsOne) (@edgeVertex) (@hgraph) (@hcomponents) (@hcombined) + (@hAib) (@hmissingTreeA) (@ettB) (@baseB) (@hcoreB) (@HB) (@goodB) (@hBdata) + +private theorem helper_continuation_2160.{u_1, u_2} : + helperContinuation2160Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hminimal alpha beta H A n + Tn Dn ia ib va vb hzero hstar hvaA prefixPosition hAlen Ty hTy hTyT ha hb hvaTy hvbTy hab + hbetaA halphaA terminalPE hpathA hpathB hdistinct root sigma component hsProper hsOne + hbehavior edgeVertex hgraph hcomponents hmissingSwap hself hvaOutside haSigma hbSigma + hcombined commonPrefix hAib B hBT hAB hTnB hBstrict hrouteB hmissingTreeA hmissingTreeTn + hmissingTreeR transport + obtain ⟨hrouteSigma, hfixedB⟩ := transport hrouteB ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + obtain ⟨ettB, hMPB, hrB, hseriesB, baseB, hcoreB, hclosureB, hsupportB, + HB, hcountB, hstagesB, hpositionsB, goodB, hgoodDataB⟩ := + GoodHierarchyTerminalPrefixRepackage G k e0 input T phi phi ett C.maximum base H C.good + B (by simpa only [hstar] using hAB) + (by simpa only [hstar] using (show A.length < B.length from hAib)) hBT + have hBdata : ettB.series.data.tree (Fin.last ettB.rounds).castSucc = Tn ∧ + TashkinovStoredColors ettB.series.data (Fin.last ettB.rounds) = Dn ∧ + ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.PE := by + exact helper_hBdata_792 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@terminalPE) + (@hAib) (@ettB) (@hMPB) (@hrB) (@hseriesB) (@baseB) (@hcoreB) (@hclosureB) (@hsupportB) + (@HB) (@hcountB) (@hstagesB) (@hpositionsB) (@goodB) (@hgoodDataB) + have hcombinedB : CombinedStableColoring + (ettB.series.data.tree (Fin.last ettB.rounds).castSucc) baseB.closure + (TashkinovStoredColors ettB.series.data (Fin.last ettB.rounds)) phi sigma := by + rw [hBdata.1, hBdata.2.1, hclosureB] + exact hcombined + obtain ⟨corr, hMPnew, baseSigma, K, hsame⟩ := HierarchySplitter G k e0 input B phi sigma + ettB hMPB ettB.roundsPositive + (fun lower hp hb hm => hlower lower hp (by rwa [hrB] at hb) hm) + baseB HB hBdata.2.2 hproper hone hsProper hsOne hcombinedB + (by rw [hBdata.1]; exact hrouteSigma) + have hnewdata : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = Dn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE := by + exact helper_hnewdata_812 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) + (@hAib) (@ettB) (@hBdata) (@corr) + have hcountHB : HB.dividerCount = 0 := hcountB.trans hzero + have hcountK : K.dividerCount = 0 := hsame.2.1.symm.trans hcountHB + have hcoreNew : baseSigma.core = A := hsame.1.symm.trans hcoreB + have hclosureNew : baseSigma.closure = base.closure := + (hsame.2.2.2.2.2 hBdata.2.2).symm.trans hclosureB + have hstoredEq : HierarchyStoredColorsAt K 0 = HierarchyStoredColorsAt HB 0 := by + exact helper_hstoredEq_870 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) + (@hAib) (@hmissingTreeA) (@ettB) (@baseB) (@hcoreB) (@HB) (@hBdata) (@corr) + (@baseSigma) (@K) (@hnewdata) (@hcoreNew) + have hstageMissingEq : HierarchyStageMissingColors K 0 = + HierarchyStageMissingColors HB 0 := by + change TreeMissingColors sigma + (corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) = + TreeMissingColors phi (ettB.series.data.tree (Fin.last ettB.rounds).castSucc) + rw [hnewdata.1, hBdata.1, hmissingTreeTn] + have halphaNotStored : alpha ∉ HierarchyStoredColorsAt K 0 := by + exact helper_halphaNotStored_882 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@halphaA) (@hAib) (@hmissingTreeA) (@ettB) (@corr) (@baseSigma) (@K) (@hcoreNew) + have hBTy : TreeSequenceInitialSegment B Ty := commonPrefix hBT hTyT hb.2.1 + have hbetaNone : beta ∉ TreeMissingColors sigma B := by + exact helper_hbetaNone_889 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) + (@hTy) (@ha) (@hb) (@hvaTy) (@hvbTy) (@hbehavior) (@hmissingSwap) (@hself) + (@hvaOutside) (@hAib) (@hBTy) + have hfirstEq (eta : Fin k) (hena : eta ≠ alpha) : + (HierarchyFirstMissingPosition sigma B eta).val = + (HierarchyFirstMissingPosition phi B eta).val := by + exact helper_hfirstEq_900 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) + (@hbehavior) (@hAib) (@hBT) (@hbetaNone) (@eta) (@hena) + have hnextHB : HB.stage (0 : Fin (HB.dividerCount + 1)).succ = B := by + exact helper_hnextHB_935 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) + (@ettB) (@baseB) (@HB) (@hcountHB) + have hnextK : K.stage (0 : Fin (K.dividerCount + 1)).succ = B := by + exact helper_hnextK_941 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hAib) + (@ettB) (@corr) (@baseSigma) (@K) (@hcountK) + have hsegmentSubset (eta : Fin k) (heta : eta ∈ HierarchyStoredColorsAt K 0) : + HierarchySegmentColors K 0 eta ⊆ HierarchySegmentColors HB 0 eta := by + exact helper_hsegmentSubset_947 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@hAib) (@hfixedB) (@ettB) (@baseB) (@hcoreB) (@HB) (@corr) (@baseSigma) (@K) + (@hcoreNew) (@halphaNotStored) (@hfirstEq) (@hnextHB) (@hnextK) (@eta) (@heta) + let reserved := (HierarchyStoredColorsAt HB 0).biUnion (goodB.gamma 0) + have hnotMinus : ¬ TreeColorSetMinusClosed G sigma A reserved := by + exact helper_hnotMinus_2199 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hlower) (@alpha) (@beta) (@hvaA) (@hbetaA) (@halphaA) (@terminalPE) (@hpathA) (@hpathB) + (@hdistinct) (@hsProper) (@hsOne) (@edgeVertex) (@hgraph) (@hcomponents) (@hcombined) + (@hAib) (@hmissingTreeA) (@ettB) (@baseB) (@hcoreB) (@HB) (@goodB) (@hBdata) + let goodK : GoodHierarchy K := by + exact @helperGoodK2169 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@alpha) (@beta) (@hAib) + (@hmissingTreeTn) (@hmissingTreeR) (@ettB) (@baseB) (@hclosureB) (@HB) (@goodB) (@hBdata) + (@corr) (@baseSigma) (@K) (@hnewdata) (@hcountK) (@hcoreNew) (@hclosureNew) (@hstoredEq) + (@hstageMissingEq) (@hsegmentSubset) (@hnotMinus) + have hvaB : va ∈ TreeSequenceVertexSet B := TreeSequenceInitialSegmentVertexSetSubset hAB hvaA + have hvbB : vb ∈ TreeSequenceVertexSet B := (prefixPosition hBT ib).2 le_rfl + have hnotElementaryB : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := by + intro he + exact Finset.disjoint_left.mp (he hvaB hvbB hab) haSigma hbSigma + let Cnew : HierarchyCounterexample baseSigma := + { positive := corr.replacementETT.roundsPositive + hierarchy := K + good := goodK + maximum := hMPnew + notElementary := hnotElementaryB } + have hstarK : HierarchyStarredStage K (Fin.last K.dividerCount) = A := by + have hi : Fin.last K.dividerCount = (0 : Fin (K.dividerCount + 1)) := Fin.ext hcountK + rw [hi] + exact hcoreNew + have pathLE : HierarchyPathNumber K ≤ HierarchyPathNumber H := by + exact helper_pathLE_1072 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hstar) + (@hAlen) (@hAib) (@hBT) (@hAB) (@ettB) (@corr) (@baseSigma) (@K) (@hstarK) + have hstageOld : (H.stage ⟨H.dividerCount, by omega⟩).length = Tn.length := by + have hi : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = 0 := Fin.ext hzero + rw [hi, H.baseStage] + have hstageNew : (K.stage ⟨K.dividerCount, by omega⟩).length = Tn.length := by + have hi : (⟨K.dividerCount, by omega⟩ : Fin (K.dividerCount + 2)) = 0 := Fin.ext hcountK + rw [hi, K.baseStage, hnewdata.1] + have hless : HierarchyCounterexampleLess (HierarchyCounterexampleMeasure Cnew) + (HierarchyCounterexampleMeasure C) := by + change HierarchyPathNumber K < HierarchyPathNumber H ∨ + (HierarchyPathNumber K = HierarchyPathNumber H ∧ + B.length - (K.stage ⟨K.dividerCount, by omega⟩).length < + T.length - (H.stage ⟨H.dividerCount, by omega⟩).length) + by_cases hlt : HierarchyPathNumber K < HierarchyPathNumber H + · exact Or.inl hlt + · refine Or.inr ⟨Nat.le_antisymm pathLE (Nat.le_of_not_gt hlt), ?_⟩ + rw [hstageNew, hstageOld] + have := hTnB.1 + omega + exact hminimal Cnew (corr.rungAgreement.trans hrB) (hcountK.trans hzero.symm) hless + +private theorem helper_continuation_2438.{u_1, u_2} : + helperContinuation2438Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hminimal alpha beta + horderedUnused H A n Tn Dn ia ib va vb hzero hstar hstarC hvaA prefixPosition hAlen Ty hTy + hTyT ha hb hvaTy hvbTy hab hbetaA halphaA terminalPE union hpathA hpathB hdistinct root + sigma component hsProper hsOne hbehavior edgeVertex hgraph hcomponents hmissingSwap hself + hvaOutside haSigma hbSigma hcombined segmentTrans commonPrefix hAib B hBT hAB hTnB hBstrict + hrouteB hpreserved hfixedA + have hmissingA (v : V) (hv : v ∈ TreeSequenceVertexSet A) : + MissingColors G sigma v = MissingColors G phi v := by + rw [union.vertexSet] at hv + rcases Finset.mem_union.mp hv with ht | hr + · exact hcombined.1.2 v ht + · exact hcombined.2.2 v hr + have hmissingTreeA : TreeMissingColors sigma A = TreeMissingColors phi A := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => hmissingA v hv) + have hmissingTreeTn : TreeMissingColors sigma Tn = TreeMissingColors phi Tn := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => hcombined.1.2 v hv) + have hmissingTreeR : TreeMissingColors sigma base.closure = TreeMissingColors phi + base.closure := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => hcombined.2.2 v hv) + have hunused : ∀ t : Fin T.length, A.length ≤ t.val → t.val < ib.val → + phi (T.edge t) ≠ some alpha := by + have ho := horderedUnused (by simpa only [hstarC] using Or.inr hbetaA) + intro t hlo hhi hc + apply ho.2 + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, by simpa only [hstarC] using hlo, hhi, hc⟩ + have transport : ∀ {X : TreeSequence G e0}, TashkinovAugmentationSequence phi Tn X → + TreeSequenceInitialSegment X B → + TashkinovAugmentationSequence sigma Tn X ∧ + ∀ t : Fin X.length, sigma (X.edge t) = phi (X.edge t) := by + intro X hs + induction hs with + | refl => intro _; exact ⟨Relation.ReflTransGen.refl, hpreserved.1⟩ + | @tail Y Z hTY hYZ ih => + intro hZB + obtain ⟨hlen, hseg, c, hcolor, hmiss⟩ := hYZ + have hYB := segmentTrans hseg hZB + obtain ⟨hTYs, hfixedY⟩ := ih hYB + let t : Fin Z.length := Fin.cast hlen.symm (Fin.last Y.length) + have ht : t.val = Y.length := by simp [t] + have hfixedLast : sigma (Z.edge t) = phi (Z.edge t) ∧ + c ∈ TreeMissingColors sigma Y := by + by_cases hyA : Y.length < A.length + · let a : Fin A.length := ⟨Y.length, hyA⟩ + have he : Z.edge t = A.edge a := by + have heZ := hZB.2.2 t + have heA := hAB.2.2 a + have hi : Fin.castLE hZB.1 t = Fin.castLE hAB.1 a := Fin.ext (by simp [t, a]) + exact heZ.symm.trans ((congrArg B.edge hi).trans heA) + refine ⟨by rw [he]; exact hfixedA a, ?_⟩ + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hmiss + have hvA := TreeSequenceInitialSegmentVertexSetSubset + (commonPrefix hYB hAB (Nat.le_of_lt hyA)) hv + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [hmissingA v hvA]; exact hvm⟩ + · have hZT := segmentTrans hZB hBT + have hca : c ≠ alpha := by + intro he + let tT := Fin.castLE hZT.1 t + apply hunused tT (by simp [tT, ht]; omega) (by + have := t.isLt + have := hZB.1 + change Z.length ≤ ib.val at this + simp only [tT, Fin.val_castLE] + omega) + rw [hZT.2.2 t] + simpa only [he] using hcolor + have hcb : c ≠ beta := by + intro he + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hmiss + obtain ⟨j, _, hj⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + have hYT := segmentTrans hYB hBT + have hle := hb.2.2 (Fin.castLE (Nat.succ_le_succ hYT.1) j) + (by rw [hYT.2.1 j, hj]; simpa only [he] using hvm) + have := j.isLt + have := t.isLt + have := hZB.1 + change Z.length ≤ ib.val at this + simp only [Fin.val_castLE] at hle + omega + refine ⟨?_, ?_⟩ + · have hc : phi (Z.edge t) = some c := hcolor + by_cases hm : Sum.inr (Z.edge t) ∈ component <;> + simp [sigma, TwoColorComponentSwap, component, hm, hc, hca, hcb] + · obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hmiss + exact Finset.mem_biUnion.mpr ⟨v, hv, (hbehavior.2.2.2 v c hca hcb).2 hvm⟩ + refine ⟨Relation.ReflTransGen.tail hTYs + ⟨hlen, hseg, c, hfixedLast.1.trans hcolor, hfixedLast.2⟩, ?_⟩ + intro s + by_cases hsY : s.val < Y.length + · let y : Fin Y.length := ⟨s.val, hsY⟩ + have hi : Fin.castLE hseg.1 y = s := Fin.ext rfl + have he : Z.edge s = Y.edge y := by simpa only [hi] using hseg.2.2 y + rw [he] + exact hfixedY y + · have hi : s = t := Fin.ext (by have := s.isLt; simp only [ht]; omega) + rw [hi] + exact hfixedLast.1 + exact @helper_continuation_2160 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hminimal) (@alpha) (@beta) (@hzero) (@hstar) (@hvaA) (@prefixPosition) (@hAlen) + (@hTy) (@hTyT) (@ha) (@hb) (@hvaTy) (@hvbTy) (@hab) (@hbetaA) (@halphaA) (@terminalPE) + (@hpathA) (@hpathB) (@hdistinct) (@hsProper) (@hsOne) (@hbehavior) (@edgeVertex) (@hgraph) + (@hcomponents) (@hmissingSwap) (@hself) (@hvaOutside) (@haSigma) (@hbSigma) (@hcombined) + (@commonPrefix) (@hAib) (@hBT) (@hAB) (@hTnB) (@hBstrict) (@hrouteB) (@hmissingTreeA) + (@hmissingTreeTn) (@hmissingTreeR) (@transport) + +private theorem helper_caseContinuation_2060.{u_1, u_2} : + helperCaseContinuation2060Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hminimal alpha beta hne + horderedUnused hbranch H A n Tn Dn ia ib va vb hzero hstar hstarC hAT hvaA hvbA + prefixPosition hAlen Ty hTy hTyT hAElementary ha hb hvaTy hvbTy hab hbetaA halphaA + terminalPE union hTnA hRA hidentity hsplit hpathA hpathB hdistinct root sigma component + hsProper hsOne hbehavior edgeVertex + have hgraph : TwoColorIncidenceGraph G sigma alpha beta = + TwoColorIncidenceGraph G phi alpha beta := by + exact helper_hgraph_479 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hne) (@ha) + (@hb) + have hcomponents (z : Sum V E) : TwoColorComponent G sigma alpha beta z = + TwoColorComponent G phi alpha beta z := by + exact congrArg (fun g : SimpleGraph (Sum V E) => + (g.connectedComponentMk z : Set (Sum V E))) hgraph + have hinvolution : TwoColorComponentSwap G sigma alpha beta root = phi := by + exact helper_hinvolution_504 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) + (@hne) (@ha) (@hb) (@hcomponents) + have hreverse := TwoColorComponentSwapMissingBehavior G sigma alpha beta hne hsProper root + rw [hinvolution] at hreverse + have hmissingSwap (v : V) (hv : Sum.inl v ∈ component) : + (alpha ∈ MissingColors G sigma v ↔ beta ∈ MissingColors G phi v) ∧ + (beta ∈ MissingColors G sigma v ↔ alpha ∈ MissingColors G phi v) := by + exact helper_hmissingSwap_517 (@G) (@k) (@e0) (@T) (@phi) (@alpha) (@beta) (@hbehavior) + (@hcomponents) (@hreverse) (@v) (@hv) + have hself : Sum.inl vb ∈ component := by + change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk (Sum.inl vb) = + (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk (Sum.inl vb) + rfl + have hvaOutside : Sum.inl va ∉ component := by + intro hv + have he : TwoColorComponent G phi alpha beta (Sum.inl va) = component := + congrArg SimpleGraph.ConnectedComponent.supp hv + exact hdistinct he + have haSigma : alpha ∈ MissingColors G sigma va := by + rw [hbehavior.1 va hvaOutside] + exact ha.1 + have hbSigma : alpha ∈ MissingColors G sigma vb := hbehavior.2.2.1 vb hself hb.1 + have noMissing (X : TreeSequence G e0) + (hXA : TreeSequenceVertexSet X ⊆ TreeSequenceVertexSet A) + (hva : va ∉ TreeSequenceVertexSet X) : + alpha ∉ TreeMissingColors phi X ∧ beta ∉ TreeMissingColors phi X := by + exact helper_noMissing_538 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) + (@hvaA) (@hAElementary) (@ha) (@hbetaA) (@X) (@hXA) (@hva) + have stableNoMissing (X : TreeSequence G e0) (D : Finset (Fin k)) + (hna : alpha ∉ TreeMissingColors phi X) + (hnb : beta ∉ TreeMissingColors phi X) + (hda : alpha ∉ D) (hdb : beta ∉ D) : StableColoring X D phi sigma := by + exact helper_stableNoMissing_550 (@G) (@k) (@e0) (@T) (@phi) (@alpha) (@beta) (@hbehavior) + (@hmissingSwap) (@X) (@D) (@hna) (@hnb) + (@hda) (@hdb) + have stableOutside (X : TreeSequence G e0) (D : Finset (Fin k)) + (hout : ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ component) : + StableColoring X D phi sigma := by + exact helper_stableOutside_583 (@G) (@k) (@e0) (@T) (@phi) (@alpha) (@beta) (@hbehavior) + (@edgeVertex) (@X) (@D) (@hout) + have outsideFromInterchange (X : TreeSequence G e0) + (hva : va ∈ TreeSequenceVertexSet X) + (hinter : TreeInterchangeable G X phi alpha beta) : + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ component := by + intro v hv hvc + exact hdistinct (hinter (Sum.inl va) root hpathA hpathB + ⟨va, hva, by change _ = _; rfl⟩ ⟨v, hv, hvc⟩) + have hcombined : CombinedStableColoring Tn base.closure Dn phi sigma := by + exact helper_hcombined_1980 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hproper) (@hone) (@hlower) (@alpha) (@beta) (@hbranch) (@ha) (@terminalPE) (@hTnA) + (@hRA) (@hidentity) (@hsplit) (@noMissing) (@stableNoMissing) (@stableOutside) + (@outsideFromInterchange) + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + apply TreeSequenceInitialSegment.trans <;> assumption + have commonPrefix {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) (hYZ : TreeSequenceInitialSegment Y Z) + (hXY : X.length ≤ Y.length) : TreeSequenceInitialSegment X Y := by + exact helper_commonPrefix_629 (@G) (@e0) (@hXZ) (@hYZ) (@hXY) + have hAib : A.length < ib.val := by + have hi := (prefixPosition hAT ib).not.mp hvbA + omega + let B := TreeSequencePrefix T ib.val (by have := A.positive; omega) + (Nat.le_of_lt_succ ib.isLt) + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.le_of_lt_succ ib.isLt, fun _ => rfl, fun _ => rfl⟩ + have hAB : TreeSequenceInitialSegment A B := commonPrefix hAT hBT (by exact Nat.le_of_lt hAib) + have hTnB : TreeSequenceInitialSegment Tn B := segmentTrans hTnA hAB + have hBstrict : B.length < T.length := by + change ib.val < T.length + have := hb.2.1 + change ib.val ≤ min (A.length + (T.length - A.length - 1)) T.length at this + omega + have hroute : TashkinovAugmentationSequence phi Tn + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + exact helper_hroute_652 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@terminalPE) + have hrouteB : TashkinovAugmentationSequence phi Tn B := + TashkinovAugmentationSequenceRestrict phi Tn B _ hroute hTnB + (segmentTrans hBT ett.belowFinal) + have hpreserved := CombinedStableClosurePreserved G k e0 input T phi phi sigma ett + C.positive base ett.generatingColoring terminalPE hproper hone hsProper hsOne hcombined + have hfixedA (t : Fin A.length) : sigma (A.edge t) = phi (A.edge t) := by + by_cases ht : t.val < Tn.length + · let s : Fin Tn.length := ⟨t.val, ht⟩ + have hi : Fin.castLE hTnA.1 s = t := Fin.ext rfl + have he : A.edge t = Tn.edge s := by simpa only [hi] using hTnA.2.2 s + rw [he] + exact hpreserved.1 s + · obtain ⟨s, he, hv⟩ := union.newEntryFromRight t (Nat.le_of_not_gt ht) + rw [he] + exact hpreserved.2.1 s + exact @helper_continuation_2438 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hminimal) (@alpha) (@beta) (@horderedUnused) (@hzero) (@hstar) (@hstarC) + (@hvaA) (@prefixPosition) (@hAlen) (@hTy) (@hTyT) (@ha) (@hb) (@hvaTy) (@hvbTy) (@hab) + (@hbetaA) (@halphaA) (@terminalPE) (@union) (@hpathA) (@hpathB) (@hdistinct) (@hsProper) + (@hsOne) (@hbehavior) (@edgeVertex) (@hgraph) (@hcomponents) (@hmissingSwap) (@hself) + (@hvaOutside) (@haSigma) (@hbSigma) (@hcombined) (@segmentTrans) (@commonPrefix) (@hAib) + (@hBT) (@hAB) (@hTnB) (@hBstrict) (@hrouteB) (@hpreserved) (@hfixedA) +private theorem helper_branch_2767.{u_1, u_2} : + helperBranch2767Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal + hprefixElementary hlarge alpha beta hne hmissingPrefix horderedUnused hlocation hbranch + classical + clear hfewer hlarge + let H := C.hierarchy + let A := base.core + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + let va := T.vertex ia + let vb := T.vertex ib + have hzero : H.dividerCount = 0 := hbranch.1 + have hstar : HierarchyStarredStage H (Fin.last H.dividerCount) = A := by + have hz : Fin.last H.dividerCount = (0 : Fin (H.dividerCount + 1)) := + Fin.ext hzero + rw [hz] + rfl + have hstarC : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A := hstar + have hfirst : H.stage ⟨1, by omega⟩ = T := by + exact helper_hfirst_209 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) + have hAT : TreeSequenceInitialSegment A T := by + simpa only [hfirst] using H.coreInsideFirst + have hvaA : va ∈ TreeSequenceVertexSet A := by + simpa only [hstarC] using hlocation.1 + have hvbA : vb ∉ TreeSequenceVertexSet A := by + simpa only [hstarC] using hlocation.2 + have prefixPosition {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) (i : Fin (Y.length + 1)) : + Y.vertex i ∈ TreeSequenceVertexSet X ↔ i.val ≤ X.length := by + exact helper_prefixPosition_223 (@G) (@e0) (@hXY) (@i) + have hAlen : A.length < T.length := by + have hi : ¬ ib.val ≤ A.length := fun h => hvbA ((prefixPosition hAT ib).2 h) + have := ib.isLt + omega + let Ty := TreeSequencePrefix T + (min (A.length + (T.length - A.length - 1)) T.length) + (by have := A.positive; have := T.positive; omega) (Nat.min_le_right _ _) + have hTy : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty) := by + have hp := @hprefixElementary + dsimp only at hp + simp only [hstarC] at hp + exact @hp + have hTyT : TreeSequenceInitialSegment Ty T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hATy : TreeSequenceInitialSegment A Ty := by + refine ⟨?_, fun i => hAT.2.1 i, fun i => hAT.2.2 i⟩ + change A.length ≤ min (A.length + (T.length - A.length - 1)) T.length + omega + have hAElementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by + intro u hu v hv huv + exact hTy (TreeSequenceInitialSegmentVertexSetSubset hATy hu) + (TreeSequenceInitialSegmentVertexSetSubset hATy hv) huv + have firstMissing (c : Fin k) (hc : c ∈ TreeMissingColors phi Ty) : + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (HierarchyFirstMissingPosition phi T c).val ≤ Ty.length ∧ + (∀ j : Fin (T.length + 1), c ∈ MissingColors G phi (T.vertex j) → + (HierarchyFirstMissingPosition phi T c).val ≤ j.val) := by + exact helper_firstMissing_262 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hTyT) (@c) (@hc) + have hmissingTy : alpha ∈ TreeMissingColors phi Ty ∧ beta ∈ TreeMissingColors phi Ty := by + simpa only [hstarC] using hmissingPrefix + have ha := firstMissing alpha hmissingTy.1 + have hb := firstMissing beta hmissingTy.2 + have hvaTy : va ∈ TreeSequenceVertexSet Ty := (prefixPosition hTyT ia).2 ha.2.1 + have hvbTy : vb ∈ TreeSequenceVertexSet Ty := (prefixPosition hTyT ib).2 hb.2.1 + have hab : va ≠ vb := by intro he; exact hvbA (he ▸ hvaA) + have hbetaA : beta ∉ TreeMissingColors phi A := by + exact @helper_hbetaA_293 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAT) + (@hvbA) (@prefixPosition) (@hb) + have halphaA : alpha ∈ TreeMissingColors phi A := Finset.mem_biUnion.mpr ⟨va, hvaA, ha.1⟩ + have hnotclosed : ¬ TreeColorSetClosed G phi A {alpha} := by + simpa only [hstarC] using hbranch.2.1 + have stableClosed (X : TreeSequence G e0) (D : Finset (Fin k)) + (psi pi : PartialEdgeColoring E k) + (hpsi : IsProperEdgeColoring G psi) (hpsiOne : IsOneEdgeUncolored psi e0) + (hpi : IsProperEdgeColoring G pi) (hpiOne : IsOneEdgeUncolored pi e0) + (hs : StableColoring X D psi pi) + (hc : ColoredVertexSetClosed G psi (TreeSequenceVertexSet X)) : + ColoredVertexSetClosed G pi (TreeSequenceVertexSet X) := by + exact helper_stableClosed_307 (@G) (@k) (@e0) (@X) (@D) (@psi) (@pi) (@hpsi) (@hpsiOne) + (@hpi) (@hpiOne) (@hs) (@hc) + have closedSingleton (hc : ColoredVertexSetClosed G phi (TreeSequenceVertexSet A)) : + TreeColorSetClosed G phi A {alpha} := by + exact helper_closedSingleton_330 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@hvaA) + (@ha) (@hc) + have terminalPE : ett.series.data.kind n = some TashkinovExtensionKind.PE := by + exact helper_terminalPE_340 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@alpha) + (@hnotclosed) (@stableClosed) (@closedSingleton) + obtain ⟨union⟩ := (base.parallel terminalPE).2.2 + have hTnA : TreeSequenceInitialSegment Tn A := union.leftSegment + have hRA : TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A := by + rw [union.vertexSet] + exact Finset.subset_union_right + have hidentity : CombinedStableColoring Tn base.closure Dn phi phi := + ⟨⟨fun _ _ _ => rfl, fun _ _ => rfl⟩, + ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩⟩ + have hnotcommon : ¬ (va ∈ TreeSequenceVertexSet Tn ∧ + va ∈ TreeSequenceVertexSet base.closure) := by + exact helper_hnotcommon_396 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hproper) + (@hone) (@hlower) (@alpha) (@ha) (@hnotclosed) (@terminalPE) (@hidentity) + have hsplit : (va ∈ TreeSequenceVertexSet Tn ∧ va ∉ TreeSequenceVertexSet base.closure) ∨ + (va ∈ TreeSequenceVertexSet base.closure ∧ va ∉ TreeSequenceVertexSet Tn) := by + exact helper_hsplit_403 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@alpha) + (@hvaA) (@union) + (@hnotcommon) + have pathMissing (c d : Fin k) (hcd : c ≠ d) (v : V) + (hvm : c ∈ MissingColors G phi v) : + TwoColorPathComponent G phi c d (Sum.inl v) := by + exact helper_pathMissing_411 (@G) (@k) (@phi) + (@hproper) (@c) (@d) (@hcd) (@v) (@hvm) + have hpathA : TwoColorPathComponent G phi alpha beta (Sum.inl va) := + pathMissing alpha beta hne va ha.1 + have hpathB : TwoColorPathComponent G phi alpha beta (Sum.inl vb) := by + exact helper_hpathB_430 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@hne) (@hb) + (@pathMissing) + change TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) + by_contra hdistinct + let root : Sum V E := Sum.inl vb + let sigma := TwoColorComponentSwap G phi alpha beta root + let component := TwoColorComponent G phi alpha beta root + have hsProper : IsProperEdgeColoring G sigma := + TwoColorComponentSwapProper G phi alpha beta hne hproper root + have hsOne : IsOneEdgeUncolored sigma e0 := by + exact helper_hsOne_451 (@G) (@k) (@e0) (@T) (@phi) + (@hone) (@alpha) (@beta) (@hne) + have hbehavior := TwoColorComponentSwapMissingBehavior G phi alpha beta hne hproper root + have edgeVertex (f : E) (v : V) (hvf : Incident G v f) + (hc : phi f = some alpha ∨ phi f = some beta) + (hf : Sum.inr f ∈ component) : Sum.inl v ∈ component := by + clear * - hvf hc hf component + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, hc⟩)).trans hf + have vertexEdge (f : E) (v : V) (hvf : Incident G v f) + (hc : phi f = some alpha ∨ phi f = some beta) + (hv : Sum.inl v ∈ component) : Sum.inr f ∈ component := by + clear * - hvf hc hv component + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inr f) (Sum.inl v) + from ⟨hvf, hc⟩)).trans hv + exact @helper_caseContinuation_2060 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hlower) (@hminimal) (@alpha) (@beta) (@hne) (@horderedUnused) (@hbranch) (@hzero) + (@hstar) (@hstarC) (@hAT) (@hvaA) (@hvbA) (@prefixPosition) (@hAlen) (@hTy) (@hTyT) + (@hAElementary) (@ha) (@hb) (@hvaTy) (@hvbTy) (@hab) (@hbetaA) (@halphaA) (@terminalPE) + (@union) (@hTnA) (@hRA) (@hidentity) (@hsplit) (@hpathA) (@hpathB) (@hdistinct) + (@hsProper) (@hsOne) (@hbehavior) (@edgeVertex) + +theorem ChangeLemmaMixedZeroNonclosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty) + (horderedUnused : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + (alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex ia) (T.vertex ib) ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c)) + (hlocation : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + va ∈ TreeSequenceVertexSet A ∧ + vb ∉ TreeSequenceVertexSet A) + (hbranch : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + H.dividerCount = 0 ∧ + ¬ TreeColorSetClosed G phi A {alpha} ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint ({alpha, beta} : Finset (Fin k)) Dn)) + : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let _ := HierarchyStarredStage H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let sameComponent := + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) + sameComponent := by + · exact @helper_branch_2767 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) + (@hfewer) (@hminimal) (@hprefixElementary) (@hlarge) (@alpha) (@beta) (@hne) + (@hmissingPrefix) (@horderedUnused) (@hlocation) (@hbranch) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChromaticIndex.lean b/LeanPool/GoldbergSeymour/ChromaticIndex.lean new file mode 100644 index 0000000000..b645df4f12 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChromaticIndex.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoringExists + +/-! +# Chromatic Index + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The least number of colors admitting a proper full edge coloring. -/ +noncomputable def ChromaticIndex {V E : Type*} [Fintype E] (G : LooplessMultigraph V E) : ℕ := by + classical + exact Nat.find (ColoringExists G) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChromaticIndexRestrict.lean b/LeanPool/GoldbergSeymour/ChromaticIndexRestrict.lean new file mode 100644 index 0000000000..79b60e5d04 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChromaticIndexRestrict.lean @@ -0,0 +1,37 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ChromaticIndexSpec +public import LeanPool.GoldbergSeymour.ProperColoringRestricts + +/-! +# Chromatic Index Restrict + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ChromaticIndexRestrict {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (F : Finset E) : + ChromaticIndex (RestrictEdges G F) ≤ ChromaticIndex G := by + classical + let _ := Fintype.ofFinite V + obtain ⟨φ, hproper, hfull⟩ := (ChromaticIndexSpec G).1 + apply (ChromaticIndexSpec (RestrictEdges G F)).2 (ChromaticIndex G) + refine ⟨(fun e => φ e.1), ProperColoringRestricts G F φ hproper, ?_⟩ + intro e + exact hfull e.1 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ChromaticIndexSpec.lean b/LeanPool/GoldbergSeymour/ChromaticIndexSpec.lean new file mode 100644 index 0000000000..bdc60faad4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ChromaticIndexSpec.lean @@ -0,0 +1,36 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ChromaticIndex + +/-! +# Chromatic Index Spec + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ChromaticIndexSpec {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) : + HasKEdgeColoring G (ChromaticIndex G) ∧ + ∀ k, HasKEdgeColoring G k → ChromaticIndex G ≤ k := by + classical + let _ := Fintype.ofFinite V + constructor + · exact Nat.find_spec (ColoringExists G) + · intro k hk + exact Nat.find_min' (ColoringExists G) hk + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ClosedColorExitPathBoundaryEdge.lean b/LeanPool/GoldbergSeymour/ClosedColorExitPathBoundaryEdge.lean new file mode 100644 index 0000000000..9b6e0797d5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ClosedColorExitPathBoundaryEdge.lean @@ -0,0 +1,133 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeExitPath + +/-! +# Closed Color Exit Path Boundary Edge + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +lemma ClosedColorExitPathBoundaryEdge {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (a b : Fin k) + (hclosed : TreeColorSetClosed G phi T {a}) + (u v : V) + (P : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl u) (Sum.inl v)) + (hP : TreeExitPath T phi a b u v P) : + ∃ f : E, + f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b ∧ + Incident G v f ∧ Sum.inr f ∈ P.support := by + classical + rcases hP with ⟨_, _, huX, hvX, _, honly⟩ + let H := TwoColorIncidenceGraph G phi a b + let X := TreeSequenceVertexSet T + let S : Set (Sum V E) := {y | match y with + | Sum.inl q => q ∈ X + | Sum.inr f => ∀ q, Incident G q f → q ∈ X} + have hSv : Sum.inl v ∈ S := by + simpa [S, X] using hvX + have hSu : Sum.inl u ∉ S := by + simpa [S, X] using huX + obtain ⟨d, hd, hds, hdt⟩ := + P.reverse.exists_boundary_dart S hSv hSu + have hadj := d.adj + have hdmem : d.toProd.1 ∈ P.reverse.support := + P.reverse.dart_fst_mem_support_of_mem_darts hd + have hdtmem : d.toProd.2 ∈ P.reverse.support := + P.reverse.dart_snd_mem_support_of_mem_darts hd + have hfirst : ∃ q : V, d.toProd.1 = Sum.inl q ∧ q ∈ X := by + cases h : d.toProd.1 with + | inl q => + rw [h] at hds + exact ⟨q, rfl, by simpa [S] using hds⟩ + | inr f => + exfalso + cases h2 : d.toProd.2 with + | inl r => + rw [h, h2] at hadj + change Incident G r f ∧ + (phi f = some a ∨ phi f = some b) at hadj + rw [h] at hds + have hall : ∀ q, Incident G q f → q ∈ X := by + simpa [S] using hds + have hrnot : r ∉ X := by + intro hr + apply hdt + simpa [S, h2] using hr + exact hrnot (hall r hadj.1) + | inr e => + rw [h, h2] at hadj + exact hadj.elim + obtain ⟨q, hq, hqX⟩ := hfirst + have hsecond : ∃ f : E, d.toProd.2 = Sum.inr f := by + cases h : d.toProd.2 with + | inl r => + rw [hq, h] at hadj + exact False.elim hadj + | inr f => exact ⟨f, rfl⟩ + obtain ⟨f, hf⟩ := hsecond + have hfadj : H.Adj (Sum.inl q) (Sum.inr f) := by + rw [hq, hf] at hadj + exact hadj + have hfdata : Incident G q f ∧ + (phi f = some a ∨ phi f = some b) := by + simpa [H, TwoColorIncidenceGraph] using hfadj + have hnotall : ¬ ∀ r, Incident G r f → r ∈ X := by + intro hall + apply hdt + simpa [S, hf, hall] + obtain ⟨r, hrf, hrX⟩ : ∃ r, Incident G r f ∧ r ∉ X := by + push Not at hnotall + exact hnotall + have hqr : q ≠ r := by + intro h + exact hrX (h ▸ hqX) + have hend : G.ends f = s(q, r) := + (Sym2.mem_and_mem_iff hqr).mp ⟨hfdata.1, hrf⟩ + have hfb : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, hqX, r, hrX, hend⟩ + have hfcolor : phi f = some b := by + rcases hfdata.2 with hfa | hfbeta + · have hfalpha : f ∈ BoundaryColorEdges G phi X a := by + simp [BoundaryColorEdges, hfb, hfa] + have hempty := hclosed a (by simp) + rw [hempty] at hfalpha + simp at hfalpha + · exact hfbeta + have hqP : Sum.inl q ∈ P.support := by + have hqrev : Sum.inl q ∈ P.reverse.support := by + rw [← hq] + exact hdmem + simpa [SimpleGraph.Walk.support_reverse] using hqrev + have hqv : q = v := (honly q (by simpa [X] using hqX)).mp hqP + have hfP : Sum.inr f ∈ P.support := by + have hfrev : Sum.inr f ∈ P.reverse.support := by + rw [← hf] + exact hdtmem + simpa [SimpleGraph.Walk.support_reverse] using hfrev + subst q + exact ⟨f, by simpa [X, BoundaryColorEdges] using + (show f ∈ BoundaryColorEdges G phi X b by + simp [BoundaryColorEdges, hfb, hfcolor]), hfdata.1, hfP⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ClosedCoreElementary.lean b/LeanPool/GoldbergSeymour/ClosedCoreElementary.lean new file mode 100644 index 0000000000..d636d0d177 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ClosedCoreElementary.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ParallelTerminalFacts +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.TashkinovClosureVertexSetUnique +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# P2634_T1_Closed Core Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2634_T1_ClosedCoreElementary + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (core : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) core) + (helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet core)) + (hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet core)) : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := by + classical + have hfinal := (P2634_T1_PETerminalFacts ett hPE).2.2 + have hvertices := TashkinovClosureVertexSetUnique phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) core + (ett.series.data.tree (Fin.last (ett.rounds + 1))) + ⟨hroute, hclosed⟩ hfinal + have hsubset := TreeSequenceInitialSegmentVertexSetSubset ett.belowFinal + rw [← hvertices] at hsubset + intro u hu v hv hne + exact helem (hsubset hu) (hsubset hv) hne + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ClosedSetTwoColorComponentAvoidance.lean b/LeanPool/GoldbergSeymour/ClosedSetTwoColorComponentAvoidance.lean new file mode 100644 index 0000000000..3c1750058a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ClosedSetTwoColorComponentAvoidance.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed + +public import LeanPool.GoldbergSeymour.TwoColorComponent + +/-! +# Closed Set Two Color Component Avoidance + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ClosedSetTwoColorComponentAvoidance {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) + (alpha beta : Fin k) (X : Finset V) (u a b : V) + (hclosed : ColoredVertexSetClosed G phi X) + (hu : u ∉ X) (haX : a ∈ X) (hbX : b ∈ X) + (ha : alpha ∈ MissingColors G phi a) + (hb : beta ∈ MissingColors G phi b) : + (∀ v ∈ X, Sum.inl v ∉ + TwoColorComponent G phi alpha beta (Sum.inl u)) ∧ + (∀ e : E, (∃ v ∈ X, Incident G v e) → Sum.inr e ∉ + TwoColorComponent G phi alpha beta (Sum.inl u)) := by + classical + let H := TwoColorIncidenceGraph G phi alpha beta + let K := TwoColorComponent G phi alpha beta (Sum.inl u) + let Outside : Sum V E → Prop + | Sum.inl v => v ∉ X + | Sum.inr e => ∀ v ∈ X, ¬ Incident G v e + have boundary_of_crossing {e : E} {v w : V} + (hv : v ∈ X) (hw : w ∉ X) + (hve : Incident G v e) (hwe : Incident G w e) : + e ∈ BoundaryEdges G X := by + have hvw : v ≠ w := by + intro h + exact hw (h ▸ hv) + have hends : G.ends e = s(v, w) := by + exact (Sym2.mem_and_mem_iff hvw).mp ⟨hve, hwe⟩ + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hv, w, hw, hends⟩ + have step {z z' : Sum V E} (hzz' : H.Adj z z') + (hz : Outside z) : Outside z' := by + cases z with + | inl v => + cases z' with + | inl w => simp [H, TwoColorIncidenceGraph] at hzz' + | inr e => + simp only [H, TwoColorIncidenceGraph] at hzz' + intro w hwX hwe + have hboundary : e ∈ BoundaryEdges G X := + boundary_of_crossing hwX hz hwe hzz'.1 + rcases hzz'.2 with healpha | hebeta + · exact (hclosed hboundary haX healpha) ha + · exact (hclosed hboundary hbX hebeta) hb + | inr e => + cases z' with + | inl v => + simp only [H, TwoColorIncidenceGraph] at hzz' + intro hvX + exact hz v hvX hzz'.1 + | inr f => simp [H, TwoColorIncidenceGraph] at hzz' + have component_outside : ∀ z, z ∈ K → Outside z := by + intro z hz + have hreach : H.Reachable (Sum.inl u) z := by + apply SimpleGraph.ConnectedComponent.exact + change H.connectedComponentMk z = H.connectedComponentMk (Sum.inl u) at hz + exact hz.symm + clear hz + rw [SimpleGraph.reachable_iff_reflTransGen] at hreach + induction hreach with + | refl => exact hu + | tail hreach hlast ih => exact step hlast ih + constructor + · intro v hvX hvK + exact (component_outside (Sum.inl v) hvK) hvX + · intro e heX heK + obtain ⟨v, hvX, hve⟩ := heX + exact (component_outside (Sum.inr e) heK) v hvX hve + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ColoredVertexSetClosed.lean b/LeanPool/GoldbergSeymour/ColoredVertexSetClosed.lean new file mode 100644 index 0000000000..65deaae9c8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ColoredVertexSetClosed.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.MissingColors + +/-! +# Colored Vertex Set Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Every boundary-edge color is present at every vertex of the set. -/ +def ColoredVertexSetClosed {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) + {k : ℕ} (phi : PartialEdgeColoring E k) (X : Finset V) : Prop := + ∀ {f c v}, f ∈ BoundaryEdges G X → v ∈ X → phi f = some c → c ∉ MissingColors G phi v + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ColoredVertexSetElementary.lean b/LeanPool/GoldbergSeymour/ColoredVertexSetElementary.lean new file mode 100644 index 0000000000..af37527912 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ColoredVertexSetElementary.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColors + +/-! +# Colored Vertex Set Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Distinct vertices of the set have disjoint sets of missing colors. -/ +def ColoredVertexSetElementary {V E : Type*} [Fintype E] (G : LooplessMultigraph V E) + {k : ℕ} (phi : PartialEdgeColoring E k) (X : Finset V) : Prop := + ∀ {u}, u ∈ X → ∀ {v}, v ∈ X → u ≠ v → Disjoint (MissingColors G phi u) (MissingColors G phi v) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ColoredVertexSetStronglyClosed.lean b/LeanPool/GoldbergSeymour/ColoredVertexSetStronglyClosed.lean new file mode 100644 index 0000000000..bfdc1e9833 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ColoredVertexSetStronglyClosed.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed + +/-! +# Colored Vertex Set Strongly Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A closed vertex set whose distinct boundary edges have distinct colors. -/ +def ColoredVertexSetStronglyClosed {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) (X : Finset V) : Prop := + ColoredVertexSetClosed G phi X ∧ + ∀ {f g c}, f ∈ BoundaryEdges G X → g ∈ BoundaryEdges G X → f ≠ g → phi f = some c → phi g ≠ some c + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ColoringExists.lean b/LeanPool/GoldbergSeymour/ColoringExists.lean new file mode 100644 index 0000000000..e778f7cf9f --- /dev/null +++ b/LeanPool/GoldbergSeymour/ColoringExists.lean @@ -0,0 +1,37 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.HasKEdgeColoring + +/-! +# Coloring Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Finitely many edges admit a proper full coloring, even if the vertex type is infinite. -/ +theorem ColoringExists {V E : Type*} [Finite E] + (G : LooplessMultigraph V E) : ∃ k, HasKEdgeColoring G k := by + classical + let _ := Fintype.ofFinite E + refine ⟨Fintype.card E, fun e => some (Fintype.equivFin E e), ?_, fun e => ?_⟩ + · intro e f c hne hadj he hf + apply hne + apply (Fintype.equivFin E).injective + exact Option.some.inj (he.trans hf.symm) + · exact ⟨Fintype.equivFin E e, rfl⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CombinedStableClosurePreserved.lean b/LeanPool/GoldbergSeymour/CombinedStableClosurePreserved.lean new file mode 100644 index 0000000000..5dd067a4e3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/CombinedStableClosurePreserved.lean @@ -0,0 +1,218 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled + +/-! +# Combined Stable Closure Preserved + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem CombinedStableClosurePreserved {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : 0 < ett.rounds) + (base : HierarchyBase ett phi) + (hphi : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (hproperPhi : IsProperEdgeColoring G phi) + (honePhi : IsOneEdgeUncolored phi e0) + (hproperSigma : IsProperEdgeColoring G sigma) + (honeSigma : IsOneEdgeUncolored sigma e0) + (hstable : CombinedStableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + let seed := TreeSequencePrefix Tn base.supportPosition.val + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt) + (∀ j : Fin Tn.length, sigma (Tn.edge j) = phi (Tn.edge j)) ∧ + (∀ j : Fin base.closure.length, + sigma (base.closure.edge j) = phi (base.closure.edge j)) ∧ + TashkinovClosure sigma seed base.closure := by + classical + dsimp + let n := ett.rounds + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + let seed := TreeSequencePrefix Tn base.supportPosition.val + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt) + have hfirst : StableColoring Tn + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma := by + exact hstable.1 + have hqpos : 0 < ett.rounds := hpositive + let q : Fin ett.rounds := ⟨ett.rounds - 1, Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ + have hq : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + have hcontrol := HkuTreeColorsControlled G k ett.rounds e0 input ett.series q + have hterminal : ∀ j : Fin Tn.length, sigma (Tn.edge j) = phi (Tn.edge j) := by + rw [hq] at hcontrol + have hh := hcontrol.2.2 sigma hproperSigma honeSigma + (by simpa [Tn, hphi] using hfirst) + simpa [Tn, hphi] using hh + have vertexTransfer {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + rcases hv with ⟨i, hi⟩ + rcases hab with ⟨hlen, hvertices, hedges⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, ?_⟩ + exact (hvertices i).trans hi + have edgeIncident {A : TreeSequence G e0} (j : Fin A.length) : + TreeIncidentEdge A (A.edge j) := by + rcases A.attaches j with ⟨i, hi⟩ + refine ⟨A.vertex j.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · change A.vertex j.succ ∈ G.ends (A.edge j) + rw [hi] + exact Sym2.mem_mk_left _ _ + have vertexInclusion {A B : TreeSequence G e0} + (hseq : TashkinovAugmentationSequence phi A B) : + ∀ v, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B := by + unfold TashkinovAugmentationSequence at hseq + induction hseq using Relation.ReflTransGen.head_induction_on with + | refl => intro v hv; exact hv + | head hstep htail ih => + intro v hv + exact ih v (vertexTransfer hstep.2.1 hv) + have hclosurePhi : TashkinovClosure phi seed base.closure := + (base.parallel hPE).2.1 + have hseqPhi : TashkinovAugmentationSequence phi seed base.closure := + hclosurePhi.1 + have hseed : ∀ j : Fin seed.length, + sigma (seed.edge j) = phi (seed.edge j) := by + intro j + exact hterminal (Fin.castLE (Nat.le_of_lt_succ base.supportPosition.isLt) j) + have hrev : StableColoring base.closure ∅ sigma phi := by + let a : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨phi, ⟨hproperPhi, honePhi⟩⟩ + let b : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨sigma, ⟨hproperSigma, honeSigma⟩⟩ + have hab : StableColoring base.closure ∅ a.1 b.1 := hstable.2 + have hba := (sc2 G e0 base.closure ∅).symm hab + exact hba + have hseqSigma : TashkinovAugmentationSequence sigma seed base.closure := by + have transport : ∀ {A : TreeSequence G e0}, + Relation.ReflTransGen (TashkinovAugmentation phi) A base.closure → + Relation.ReflTransGen (TashkinovAugmentation sigma) A base.closure := by + intro A hs + induction hs using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hstep htail ih => + have htailVertex := vertexInclusion htail + have hnew : TashkinovAugmentation sigma A B := by + rcases hstep with ⟨hlen, hseg, c, hcolor, hmiss⟩ + refine ⟨hlen, hseg, c, ?_, ?_⟩ + · let hlast : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + have hcolor' : phi (B.edge hlast) = some c := by + dsimp [hlast] + exact hcolor + have hinc : TreeIncidentEdge base.closure (B.edge hlast) := by + rcases edgeIncident hlast with ⟨v, hv, he⟩ + exact ⟨v, htailVertex v hv, he⟩ + have hcR : c ∈ TreeMissingColors phi base.closure := by + unfold TreeMissingColors at hmiss ⊢ + rcases Finset.mem_biUnion.mp hmiss with ⟨v, hv, hvc⟩ + exact Finset.mem_biUnion.mpr ⟨v, htailVertex v (vertexTransfer hseg hv), hvc⟩ + have heq := hstable.2.1 _ hinc + ⟨c, Finset.mem_union_left _ hcR, by + exact hcolor'⟩ + exact heq.trans (by + exact hcolor') + · unfold TreeMissingColors at hmiss ⊢ + rcases Finset.mem_biUnion.mp hmiss with ⟨v, hv, hvc⟩ + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [hstable.2.2 v (htailVertex v (vertexTransfer hseg hv))] + exact hvc + exact Relation.ReflTransGen.head hnew ih + exact transport (A := seed) hseqPhi + exact ⟨hterminal, by + have equalityReach : ∀ {A : TreeSequence G e0}, + Relation.ReflTransGen (TashkinovAugmentation phi) A base.closure → + (∀ j : Fin A.length, sigma (A.edge j) = phi (A.edge j)) → + ∀ j : Fin base.closure.length, + sigma (base.closure.edge j) = phi (base.closure.edge j) := by + intro A hreach + induction hreach using Relation.ReflTransGen.head_induction_on with + | refl => intro hA; exact hA + | @head A B hstep htail ih => + intro hA + rcases hstep with ⟨hlen, hseg, c, hcolor, hmiss⟩ + have htailVertex := vertexInclusion htail + have hB : ∀ j : Fin B.length, + sigma (B.edge j) = phi (B.edge j) := by + intro j + let hlast : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + have hlastVal : hlast.val = A.length := by simp [hlast] + by_cases hj : j.val < A.length + · let ja : Fin A.length := ⟨j.val, by omega⟩ + have he : B.edge (Fin.castLE hseg.1 ja) = A.edge ja := hseg.2.2 ja + have hjcast : Fin.castLE hseg.1 ja = j := by apply Fin.ext; rfl + rw [← hjcast] + exact (congrArg sigma he).trans ((hA ja).trans (congrArg phi he.symm)) + · have je : j = hlast := by apply Fin.ext; omega + subst je + have hi := edgeIncident hlast + rcases hi with ⟨v, hvv, hvi⟩ + have hinc : TreeIncidentEdge base.closure (B.edge hlast) := + ⟨v, htailVertex v hvv, hvi⟩ + have hcR : c ∈ TreeMissingColors phi base.closure := by + unfold TreeMissingColors at hmiss ⊢ + rcases Finset.mem_biUnion.mp hmiss with ⟨v, hvv, hvc⟩ + exact Finset.mem_biUnion.mpr ⟨v, htailVertex v (vertexTransfer hseg hvv), hvc⟩ + have hcolor' : phi (B.edge hlast) = some c := by + dsimp [hlast] + exact hcolor + exact hstable.2.1 _ hinc + ⟨c, Finset.mem_union_left _ hcR, hcolor'⟩ + exact ih hB + have hEq : ∀ j : Fin base.closure.length, + sigma (base.closure.edge j) = phi (base.closure.edge j) := + equalityReach hseqPhi hseed + exact ⟨hEq, ⟨hseqSigma, by + unfold ColoredVertexSetClosed + intro f c v hf hv hfc + have hinc : TreeIncidentEdge base.closure f := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf + rcases hf with ⟨u, hu, w, hw, he⟩ + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [he] + exact Sym2.mem_mk_left _ _ + have hm := hstable.2.2 v hv + intro hc + have hcR : c ∈ TreeMissingColors sigma base.closure := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨v, hv, hc⟩ + have heq := hrev.1 f hinc + ⟨c, Finset.mem_union_left _ hcR, hfc⟩ + have hcphi : c ∈ MissingColors G phi v := by + exact hm ▸ hc + apply (hclosurePhi.2 hf hv (by rw [heq]; exact hfc)) + exact hcphi⟩⟩⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CombinedStableColoring.lean b/LeanPool/GoldbergSeymour/CombinedStableColoring.lean new file mode 100644 index 0000000000..a25edcb177 --- /dev/null +++ b/LeanPool/GoldbergSeymour/CombinedStableColoring.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableColoring + +/-! +# Combined Stable Coloring + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Simultaneous stability on the ladder tree with stored colors and on the auxiliary closure. -/ +def CombinedStableColoring {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} (Tn R : TreeSequence G e0) (D : Finset (Fin k)) + (phi sigma : PartialEdgeColoring E k) : Prop := + StableColoring Tn D phi sigma ∧ StableColoring R ∅ phi sigma + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CommonMissingColorsAtUncoloredEndpoints.lean b/LeanPool/GoldbergSeymour/CommonMissingColorsAtUncoloredEndpoints.lean new file mode 100644 index 0000000000..89813cb64a --- /dev/null +++ b/LeanPool/GoldbergSeymour/CommonMissingColorsAtUncoloredEndpoints.lean @@ -0,0 +1,176 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring + +public import LeanPool.GoldbergSeymour.MaximumDegree + +public import LeanPool.GoldbergSeymour.TreeMissingColors + +/-! +# Common Missing Colors At Uncolored Endpoints + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem CommonMissingColorsAtUncoloredEndpoints + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (phi : PartialEdgeColoring E k) (A B : TreeSequence G e0) + (x y : V) (hends : G.ends e0 = s(x, y)) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hdegree : MaximumDegree G + 1 <= k) + (hxA : x ∈ TreeSequenceVertexSet A) + (hyA : y ∈ TreeSequenceVertexSet A) + (hxB : x ∈ TreeSequenceVertexSet B) + (hyB : y ∈ TreeSequenceVertexSet B) + (helem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet A ∪ TreeSequenceVertexSet B)) : + 4 <= (TreeMissingColors phi A ∩ TreeMissingColors phi B).card := by + classical + have hxy : x ≠ y := by + intro h + subst y + exact G.loopless e0 x hends + have hx0 : Incident G x e0 := by + simp [Incident, hends] + have hy0 : Incident G y e0 := by + simp [Incident, hends] + have colored_iff : + forall v e, (Incident G v e ∧ exists c, phi e = some c) ↔ Incident G v e ∧ e ≠ e0 := by + intro v e + constructor + · rintro ⟨hv, c, hc⟩ + refine ⟨hv, ?_⟩ + intro he + subst e + rw [hone.1] at hc + simp at hc + · rintro ⟨hv, he⟩ + obtain ⟨c, hc⟩ := hone.2 e he + exact ⟨hv, c, hc⟩ + have present_card : + forall v, (PresentColors G phi v).card = (Finset.univ.filter fun e => Incident G v e ∧ exists + c, phi e = some c).card := by + intro v + let colored := Finset.univ.filter fun e => + Incident G v e ∧ exists c, phi e = some c + let chooseColor : (e : E) -> e ∈ colored -> Fin k := + fun e he => Classical.choose (Finset.mem_filter.mp he).2.2 + have choose_spec : forall (e : E) (he : e ∈ colored), + phi e = some (chooseColor e he) := by + intro e he + exact Classical.choose_spec (Finset.mem_filter.mp he).2.2 + symm + apply Finset.card_bij chooseColor + · intro e he + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, (Finset.mem_filter.mp he).2.1, choose_spec e he⟩ + · intro e1 h1 e2 h2 heq + by_contra hne + have hi1 := (Finset.mem_filter.mp h1).2.1 + have hi2 := (Finset.mem_filter.mp h2).2.1 + have hadj : AdjacentEdges G e1 e2 := ⟨v, hi1, hi2⟩ + have hp := hproper hne hadj (choose_spec e1 h1) + exact hp (by simpa [heq] using choose_spec e2 h2) + · intro c hc + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc + obtain ⟨e, he, hce⟩ := hc + have heColored : e ∈ colored := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and, colored] + exact ⟨he, c, hce⟩ + refine ⟨e, heColored, ?_⟩ + exact Option.some.inj ((choose_spec e heColored).symm.trans hce) + have colored_card : + forall v, (Finset.univ.filter fun e => Incident G v e ∧ exists c, phi e = some c).card = if + Incident G v e0 then Degree G v - 1 else Degree G v := by + intro v + have hset : (Finset.univ.filter fun e => + Incident G v e ∧ exists c, phi e = some c) = + (Finset.univ.filter fun e => Incident G v e).filter + (fun e => e ≠ e0) := by + ext e + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + rw [colored_iff v e] + rw [hset] + by_cases hv : Incident G v e0 + · have hmem : e0 ∈ Finset.univ.filter (fun e => Incident G v e) := by + simp [hv] + rw [Finset.filter_ne', Finset.card_erase_of_mem hmem] + simp [Degree, hv] + · have hnot : e0 ∉ Finset.univ.filter (fun e => Incident G v e) := by + simp [hv] + rw [Finset.filter_ne', Finset.erase_eq_self.mpr hnot] + simp [Degree, hv] + have missing_two : forall v, Incident G v e0 -> + 2 <= (MissingColors G phi v).card := by + intro v hv0 + have hdeg : Degree G v <= MaximumDegree G := by + change Degree G v <= + (insert 0 (Finset.univ.image (fun w => Degree G w))).max' _ + exact Finset.le_max' _ _ + (Finset.mem_insert_of_mem (Finset.mem_image.mpr ⟨v, by simp, rfl⟩)) + have hmissing : (MissingColors G phi v).card = + k - (Degree G v - 1) := by + calc + (MissingColors G phi v).card = + k - (PresentColors G phi v).card := by + simp [MissingColors, Finset.card_sdiff] + _ = k - (Degree G v - 1) := by + rw [present_card v, colored_card v, ite_eq_left hv0] + have hdegpos : 0 < Degree G v := by + unfold Degree + exact Finset.card_pos.mpr ⟨e0, by simp [hv0]⟩ + rw [hmissing] + omega + have hxMissingA : MissingColors G phi x ⊆ TreeMissingColors phi A := by + intro c hc + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨x, hxA, hc⟩ + have hxMissingB : MissingColors G phi x ⊆ TreeMissingColors phi B := by + intro c hc + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨x, hxB, hc⟩ + have hyMissingA : MissingColors G phi y ⊆ TreeMissingColors phi A := by + intro c hc + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨y, hyA, hc⟩ + have hyMissingB : MissingColors G phi y ⊆ TreeMissingColors phi B := by + intro c hc + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨y, hyB, hc⟩ + have hxyDisjoint : Disjoint (MissingColors G phi x) (MissingColors G phi y) := by + apply helem + · exact Finset.mem_union_left _ hxA + · exact Finset.mem_union_left _ hyA + · exact hxy + let C := MissingColors G phi x ∪ MissingColors G phi y + have hCsubset : C ⊆ TreeMissingColors phi A ∩ TreeMissingColors phi B := by + intro c hc + rcases Finset.mem_union.mp hc with hc | hc + · exact Finset.mem_inter.mpr ⟨hxMissingA hc, hxMissingB hc⟩ + · exact Finset.mem_inter.mpr ⟨hyMissingA hc, hyMissingB hc⟩ + have hCcard : 4 <= C.card := by + rw [Finset.card_union_of_disjoint hxyDisjoint] + exact Nat.add_le_add (missing_two x hx0) (missing_two y hy0) + exact hCcard.trans (Finset.card_le_card hCsubset) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ConditionNineTransport.lean b/LeanPool/GoldbergSeymour/ConditionNineTransport.lean new file mode 100644 index 0000000000..8eca4b3107 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ConditionNineTransport.lean @@ -0,0 +1,229 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.SplitSwapData +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# P2880_T1_Condition Nine Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2880_T1_ConditionNineTransport + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha beta : Fin k) (sigma : PartialEdgeColoring E k) + (S : P2880_T1_SplitSwapData G k e0 input T phi ett base C ctx P + alpha beta sigma) + (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hR : R.coloring = sigma) + (hbeta : + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let j := HierarchyPathNumber C.hierarchy + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (j - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + let tailUsedThroughJ := + (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < A.length + j ∧ + P.coloring (T.edge r) = some c + beta ≠ alpha ∧ + beta ∈ TreeMissingColors P.coloring B ∧ + beta ∉ Gamma ∧ beta ∉ tailUsedThroughJ ∧ + (beta ∉ baseExtraMissing ∪ D ∨ + beta ∈ D ∧ + Disjoint (P.counterexample.good.gamma q beta ∪ {beta}) + tailUsedThroughJ)) : + let H := R.counterexample.hierarchy + let q := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let j := HierarchyPathNumber C.hierarchy + let B := HierarchyFullTailPrefix C (j - 2) + let n := Fin.last R.corresponding.replacementETT.rounds + let Tn := R.corresponding.replacementETT.series.data.tree n.castSucc + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (R.counterexample.good.gamma q) + let baseExtraMissing := + ((TreeSequenceVertexSet R.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun v => MissingColors G R.coloring v) + let tailUsedThroughJ := + (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, A.length ≤ r.val ∧ r.val < A.length + j ∧ + R.coloring (T.edge r) = some c + beta ∉ Gamma ∧ + ((beta ∉ baseExtraMissing ∧ beta ∉ tailUsedThroughJ ∧ + beta ∉ Gamma ∧ beta ∉ D) ∨ + (beta ∈ D ∧ beta ∈ TreeMissingColors R.coloring B ∧ + Disjoint (R.counterexample.good.gamma q beta ∪ {beta}) + tailUsedThroughJ)) := by + classical + dsimp only + have terminalLadder {inp gen nu : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 inp T gen) + (corr : CorrespondingExtendedTashkinovTree G k e0 original nu T) : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc := by + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, ladderTreesAgree, + storedColorsAgree, connectingEdgesAgree, extensionKindsAgree, replacementProper, + replacementOneUncolored, replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive series above strict below generating => + cases rungAgreement + have hseries : series = replacementSeries := eq_of_heq seriesPresentation + cases hseries + let i : Fin original.rounds := ⟨original.rounds - 1, by + have := original.roundsPositive + omega⟩ + have hi : i.succ = Fin.last original.rounds := by + apply Fin.ext + change original.rounds - 1 + 1 = original.rounds + exact Nat.sub_add_cancel original.roundsPositive + simpa only [hi] using ladderTreesAgree i + have hterminal : + R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc = + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc := + (terminalLadder ett R.corresponding).trans (terminalLadder ett P.corresponding).symm + have hcore : P.replacementBase.core = R.replacementBase.core := + P.sameGood.1.1.symm.trans R.sameGood.1.1 + obtain ⟨hstarP, _, _⟩ := P2752_T2_HierarchyMeasures C.hierarchy + P.counterexample.hierarchy P.sameGood.1 + obtain ⟨hstarR, _, _⟩ := P2752_T2_HierarchyMeasures C.hierarchy + R.counterexample.hierarchy R.sameGood.1 + have hstar : + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) := + hstarP.symm.trans hstarR + have lastColors (U : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt U.counterexample.hierarchy + (Fin.last U.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + U.counterexample.good.gamma + (Fin.last U.counterexample.hierarchy.dividerCount) eta := by + obtain ⟨hc, hcolors⟩ := U.sameGood.2 + have hlast : Fin.cast (congrArg (fun n : Nat => n + 1) hc) + (Fin.last C.hierarchy.dividerCount) = + Fin.last U.counterexample.hierarchy.dividerCount := Fin.ext hc + simpa only [hlast] using hcolors (Fin.last C.hierarchy.dividerCount) + have colorsP := lastColors P + have colorsR := lastColors R + have hstored : + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) := + colorsP.1.symm.trans colorsR.1 + have hgamma : ∀ eta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount), + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta = + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta := by + intro eta heta + have ho : eta ∈ HierarchyStoredColorsAt C.hierarchy + (Fin.last C.hierarchy.dividerCount) := colorsP.1.symm ▸ heta + exact (colorsP.2 eta ho).symm.trans (colorsR.2 eta ho) + have hGamma : + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount)) = + (HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).biUnion + (R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount)) := + Finset.biUnion_congr hstored hgamma + have hbaseMissing : + ((TreeSequenceVertexSet R.replacementBase.core \ + TreeSequenceVertexSet (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc)).biUnion + fun v => MissingColors G R.coloring v) = + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet (P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc)).biUnion + fun v => MissingColors G P.coloring v) := by + rw [← hcore, hterminal] + apply Finset.biUnion_congr rfl + intro v hv + rw [hR] + exact S.invariant.2 v (TreeSequenceInitialSegmentVertexSetSubset + S.coreInSplit (Finset.mem_sdiff.mp hv).1) + have hused : + (Finset.univ : Finset (Fin k)).filter (fun c => + ∃ r : Fin T.length, + (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length ≤ r.val ∧ + r.val < (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + + HierarchyPathNumber C.hierarchy ∧ R.coloring (T.edge r) = some c) = + (Finset.univ : Finset (Fin k)).filter (fun c => + ∃ r : Fin T.length, + (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).length ≤ r.val ∧ + r.val < (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).length + + HierarchyPathNumber C.hierarchy ∧ P.coloring (T.edge r) = some c) := by + rw [← hstar, hR] + apply Finset.filter_congr + intro c _ + constructor + · rintro ⟨r, hlo, hhi, hcolor⟩ + exact ⟨r, hlo, hhi, (S.fixedThroughJ r hlo hhi).symm.trans hcolor⟩ + · rintro ⟨r, hlo, hhi, hcolor⟩ + exact ⟨r, hlo, hhi, (S.fixedThroughJ r hlo hhi).trans hcolor⟩ + rcases hbeta with ⟨_, _, hnotGamma, hnotUsed, hchoice⟩ + have hnotGammaR := hGamma ▸ hnotGamma + refine ⟨hnotGammaR, ?_⟩ + rcases hchoice with hout | ⟨hD, hpair⟩ + · simp only [Finset.mem_union, not_or] at hout + refine Or.inl ⟨?_, ?_, hnotGammaR, ?_⟩ + · rw [hbaseMissing] + exact hout.1 + · rw [hused] + exact hnotUsed + · rw [← hstored] + exact hout.2 + · refine Or.inr ⟨hstored ▸ hD, ?_, ?_⟩ + · rw [hR] + exact S.missingTwoBefore.2 + · rw [← hgamma beta hD, hused] + exact hpair + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CopyAugmentationPrefix.lean b/LeanPool/GoldbergSeymour/CopyAugmentationPrefix.lean new file mode 100644 index 0000000000..3994410eb0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/CopyAugmentationPrefix.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# P2668_T2_Copy Augmentation Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2668_T2_CopyAugmentationPrefix + {V E : Type*} [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (hab : alpha ≠ beta) (hproper : IsProperEdgeColoring G phi) + (z : Sum V E) (S R : TreeSequence G e0) (X : Finset V) + (hElem : ColoredVertexSetElementary G phi X) + (hRX : TreeSequenceVertexSet R ⊆ X) + (u v : V) (huX : u ∈ X) (huR : u ∉ TreeSequenceVertexSet R) + (hvR : v ∈ TreeSequenceVertexSet R) (hvS : v ∉ TreeSequenceVertexSet S) + (hua : alpha ∈ MissingColors G phi u) + (hvb : beta ∈ MissingColors G phi v) + (hroute : TashkinovAugmentationSequence phi S R) : + ∃ B : TreeSequence G e0, TreeSequenceInitialSegment B R ∧ + B.vertex (Fin.last B.length) = v ∧ + TashkinovAugmentationSequence + (TwoColorComponentSwap G phi alpha beta z) S B := by + classical + let _ := Fintype.ofFinite V + let psi := TwoColorComponentSwap G phi alpha beta z + have unaffected := (TwoColorComponentSwapMissingBehavior + G phi alpha beta hab hproper z).2.2.2 + have copy : + ∀ (A : TreeSequence G e0), TashkinovAugmentationSequence phi A R → v ∉ TreeSequenceVertexSet A + → + ∃ B : TreeSequence G e0, TreeSequenceInitialSegment B R ∧ B.vertex (Fin.last B.length) = v ∧ + TashkinovAugmentationSequence psi A B := by + intro A hr + induction hr using Relation.ReflTransGen.head_induction_on with + | refl => intro hv; exact (hv hvR).elim + | @head A D hstep htail ih => + intro hvA + have hDR := TashkinovAugmentationSequenceInitialSegment phi D R htail + obtain ⟨hlen, hAD, c, hec, hc⟩ := hstep + obtain ⟨w, hwA, hcw⟩ := Finset.mem_biUnion.mp hc + have hwR : w ∈ TreeSequenceVertexSet R := + TreeSequenceInitialSegmentVertexSetSubset hDR + (TreeSequenceInitialSegmentVertexSetSubset hAD hwA) + have hwu : w ≠ u := by intro h; exact huR (h ▸ hwR) + have hwv : w ≠ v := by intro h; exact hvA (h ▸ hwA) + have hca : c ≠ alpha := by + intro h + exact (Finset.disjoint_left.mp + (hElem (hRX hwR) huX hwu)) (h ▸ hcw) hua + have hcb : c ≠ beta := by + intro h + exact (Finset.disjoint_left.mp + (hElem (hRX hwR) (hRX hvR) hwv)) (h ▸ hcw) hvb + have newStep : TashkinovAugmentation psi A D := by + refine ⟨hlen, hAD, c, ?_, ?_⟩ + · simp [psi, TwoColorComponentSwap, hec, hca, hcb] + · exact Finset.mem_biUnion.mpr + ⟨w, hwA, (unaffected w c hca hcb).mpr hcw⟩ + by_cases hvD : v ∈ TreeSequenceVertexSet D + · have hlast : D.vertex (Fin.last D.length) = v := by + obtain ⟨i, hi⟩ := by simpa [TreeSequenceVertexSet] using hvD + by_cases hilast : i = Fin.last D.length + · simpa [hilast] using hi + · have hiA : i.val < A.length + 1 := by + have hival : i.val ≠ D.length := by + intro h + apply hilast + exact Fin.ext h + have hibound := i.isLt + omega + let j : Fin (A.length + 1) := ⟨i.val, hiA⟩ + have hj : Fin.castLE (Nat.succ_le_succ hAD.1) j = i := by + apply Fin.ext + rfl + have hjv : A.vertex j = v := by + rw [← hAD.2.1 j, hj] + exact hi + exact (hvA (by simp [TreeSequenceVertexSet, ← hjv])).elim + exact ⟨D, hDR, hlast, Relation.ReflTransGen.single newStep⟩ + · obtain ⟨B, hBR, hlast, hAB⟩ := ih hvD + exact ⟨B, hBR, hlast, Relation.ReflTransGen.head newStep hAB⟩ + exact copy S hroute hvS + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CoreClosurePresentation.lean b/LeanPool/GoldbergSeymour/CoreClosurePresentation.lean new file mode 100644 index 0000000000..6121295fca --- /dev/null +++ b/LeanPool/GoldbergSeymour/CoreClosurePresentation.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingTerminalClosureEq + +public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment + +public import LeanPool.GoldbergSeymour.TashkinovClosureExists + +/-! +# P2634_T1_Core Closure Presentation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2634_T1_CoreClosurePresentation + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hmod : ModColoring ett phi) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (base : HierarchyBase ett phi) + (hroute : TashkinovAugmentationSequence phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) base.core) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + base.core.length) : + exists (Z : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi Z), + MaximumProperty corr.replacementETT /\ + TashkinovClosure phi base.core Z /\ + corr.replacementETT.series.data.tree + (Fin.last (corr.replacementETT.rounds + 1)) = Z /\ + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc /\ + corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE /\ + exists baseZ : HierarchyBase corr.replacementETT phi, + baseZ.core = base.core /\ baseZ.closure = base.closure /\ + baseZ.supportPosition.val = base.supportPosition.val := by + obtain ⟨Z, hclosure⟩ := TashkinovClosureExists phi base.core + have hsequence : TashkinovAugmentationSequence phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) Z := + hroute.trans hclosure.1 + have hsegment := TashkinovAugmentationSequenceInitialSegment phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) Z hsequence + have hcoreSegment := TashkinovAugmentationSequenceInitialSegment phi + base.core Z hclosure.1 + obtain ⟨corr⟩ := hmod.2.2 Z hsegment (lt_of_lt_of_le hstrict hcoreSegment.1) + (Or.inl ⟨hPE, hsequence⟩) + have hfinal := CorrespondingTerminalClosureEq G k e0 input T phi ett phi Z + (ett.series.data.tree (Fin.last ett.rounds).castSucc) corr + (Or.inl ⟨hPE, rfl⟩) ⟨hsequence, hclosure.2⟩ + have hmax := MaximumPropertyTransport G k e0 ett phi hmod Z corr hMP + obtain ⟨baseZ, hcore, hcl, hsupport⟩ := + HierarchyBaseCorrespondingTransport G k e0 input T Z phi ett corr base + have hindices : + corr.replacementETT.series.data.tree + (Fin.last (corr.replacementETT.rounds + 1)) = Z /\ + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc /\ + corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE := by + rcases corr with ⟨inputZ, seriesZ, ettZ, hr, hs, hc, ht, hd, he, hk, + hp, ho, hstable⟩ + cases ettZ with + | mk rounds positive series above strict below generating => + cases hr + have hseries : series = seriesZ := eq_of_heq hs + cases hseries + have hn : 0 < ett.rounds := by have := ett.roundsPositive; omega + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hq : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + refine ⟨hfinal, ?_, (hk (Fin.last ett.rounds)).trans hPE⟩ + simpa only [hq] using ht q + exact ⟨Z, corr, hmax, hclosure, hindices.1, hindices.2.1, + hindices.2.2, baseZ, hcore, hcl, hsupport⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTree.lean b/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTree.lean new file mode 100644 index 0000000000..e3f86e83e0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTree.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovColoringSequence +public import LeanPool.GoldbergSeymour.ExtendedTashkinovLadderStage +public import LeanPool.GoldbergSeymour.ExtendedTashkinovRungNumber + +/-! +# Corresponding Extended Tashkinov Tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A replacement extended tree preserving ladder trees, stored colors and extension data under a +new coloring. +-/ +structure CorrespondingExtendedTashkinovTree {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 input T generating) (sigmaN : PartialEdgeColoring E k) + (Tstar : TreeSequence G e0) where + /-- Initial coloring for the replacement extension series. -/ + replacementInput : PartialEdgeColoring E k + /-- Replacement series whose ladder and stored data agree with the original. -/ + replacementSeries : TashkinovSeries G k base.rounds e0 replacementInput + /-- The extended tree presented by the replacement series. -/ + replacementETT : ExtendedTashkinovTree G k e0 replacementInput Tstar sigmaN + rungAgreement : replacementETT.rounds = base.rounds + seriesPresentation : HEq replacementETT.series replacementSeries + finalGeneratingColoring : sigmaN = replacementSeries.data.coloring (Fin.last base.rounds) + ladderTreesAgree : + ∀ i : Fin base.rounds, + replacementSeries.data.tree i.succ.castSucc = base.series.data.tree i.succ.castSucc + storedColorsAgree : + ∀ i : Fin (base.rounds + 1), replacementSeries.data.stored i = base.series.data.stored i + connectingEdgesAgree : + ∀ i : Fin (base.rounds + 1), + replacementSeries.data.connectingEdges i = base.series.data.connectingEdges i + extensionKindsAgree : + ∀ i : Fin (base.rounds + 1), replacementSeries.data.kind i = base.series.data.kind i + replacementProper : + ∀ i : Fin (base.rounds + 1), IsProperEdgeColoring G (replacementSeries.data.coloring i) + replacementOneUncolored : + ∀ i : Fin (base.rounds + 1), IsOneEdgeUncolored (replacementSeries.data.coloring i) e0 + replacementStable : + ∀ i : Fin base.rounds, + StableColoring (base.series.data.tree i.succ.castSucc) + (TashkinovStoredColors base.series.data i.succ) (base.series.data.coloring i.succ) + (replacementSeries.data.coloring i.succ) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTrans.lean b/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTrans.lean new file mode 100644 index 0000000000..425d6e8edd --- /dev/null +++ b/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTrans.lean @@ -0,0 +1,42 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTransTrees + +/-! +# Corresponding Extended Tashkinov Tree Trans + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma CorrespondingExtendedTashkinovTreeTrans + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi sigma tau : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (first : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (second : CorrespondingExtendedTashkinovTree + G k e0 first.replacementETT tau T) : + exists composite : CorrespondingExtendedTashkinovTree G k e0 ett tau T, + composite.replacementInput = second.replacementInput /\ + HEq composite.replacementSeries second.replacementSeries /\ + HEq composite.replacementETT second.replacementETT := by + classical + exact CorrespondingExtendedTashkinovTreeTransTrees G k e0 input + T T T phi sigma tau ett first second + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTransTrees.lean b/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTransTrees.lean new file mode 100644 index 0000000000..726e3a7a2e --- /dev/null +++ b/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTransTrees.lean @@ -0,0 +1,447 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesColoringProperties + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree + +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Corresponding Extended Tashkinov Tree Trans Trees + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +section + +variable {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} + +private theorem projectLast : + ∀ {r s : Nat} {inputColoring : PartialEdgeColoring E k} (h : r = s) (x : TashkinovSeries G k r + e0 inputColoring), HEq ((h ▸ x).data.coloring (Fin.last s)) (x.data.coloring (Fin.last r)) + := by + intro r s inputColoring h x + cases h + rfl + +private theorem projectTree : + ∀ {r s : Nat} (h : r = s) {inputColoring : PartialEdgeColoring E k} (x : TashkinovSeries G k r + e0 inputColoring) (i : Fin r), HEq ((h ▸ x).data.tree ((h ▸ i).succ.castSucc)) + (x.data.tree i.succ.castSucc) := by + intro r s h inputColoring x i + cases h + rfl + +private theorem castBack : ∀ {r s : Nat} (h : r = s) (i : Fin s), + h ▸ (h.symm ▸ i) = i := by + intro r s h i + cases h + rfl + +private theorem castBackPlus : ∀ {r s : Nat} (h : r = s) (i : Fin (s + 1)), + h ▸ (h.symm ▸ i) = i := by + intro r s h i + cases h + rfl + +private theorem castValue : ∀ {r s : Nat} (h : r = s) (i : Fin r), + ((h ▸ i : Fin s) : Nat) = (i : Nat) := by + intro r s h i + cases h + rfl + +private theorem castValuePlus : ∀ {r s : Nat} (h : r = s) (i : Fin (r + 1)), + ((h ▸ i : Fin (s + 1)) : Nat) = (i : Nat) := by + intro r s h i + cases h + rfl + +private theorem succCast : ∀ {r s : Nat} (h : r = s) (i : Fin r), + (h ▸ i).succ = h ▸ i.succ := by + intro r s h i + cases h + rfl + +private theorem projectColoring : ∀ {r s : Nat} (h : r = s) + {inputColoring : PartialEdgeColoring E k} + (x : TashkinovSeries G k r e0 inputColoring) (i : Fin (r + 1)), + HEq ((h ▸ x).data.coloring (h ▸ i)) (x.data.coloring i) := by + intro r s h inputColoring x i + cases h + rfl + +private theorem projectStored : + ∀ {r s : Nat} (h : r = s) {inputColoring : PartialEdgeColoring E k} (x : TashkinovSeries G k r + e0 inputColoring) (i : Fin (r + 1)), HEq ((h ▸ x).data.stored (h ▸ i)) (x.data.stored i) + := by + intro r s h inputColoring x i + cases h + rfl + +private theorem projectEdges : ∀ {r s : Nat} (h : r = s) + {inputColoring : PartialEdgeColoring E k} + (x : TashkinovSeries G k r e0 inputColoring) (i : Fin (r + 1)), + HEq ((h ▸ x).data.connectingEdges (h ▸ i)) (x.data.connectingEdges i) := by + intro r s h inputColoring x i + cases h + rfl + +private theorem projectKind : + ∀ {r s : Nat} (h : r = s) {inputColoring : PartialEdgeColoring E k} (x : TashkinovSeries G k r + e0 inputColoring) (i : Fin (r + 1)), HEq ((h ▸ x).data.kind (h ▸ i)) (x.data.kind i) := by + intro r s h inputColoring x i + cases h + rfl + +private theorem replacementSeriesPresentation + {input : PartialEdgeColoring E k} {T0 T1 : TreeSequence G e0} + {phi sigma : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T0 phi} + (first : CorrespondingExtendedTashkinovTree G k e0 ett sigma T1) : + first.replacementETT.series = first.rungAgreement.symm ▸ first.replacementSeries := by + have castProof : HEq first.replacementSeries + (first.rungAgreement.symm ▸ first.replacementSeries) := by simp + exact eq_of_heq (HEq.trans first.seriesPresentation castProof) + +private theorem correspondingStoredColors + {input : PartialEdgeColoring E k} {T0 T1 : TreeSequence G e0} + {phi sigma : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T0 phi} + (first : CorrespondingExtendedTashkinovTree G k e0 ett sigma T1) + (i : Fin ett.rounds) : + TashkinovStoredColors first.replacementETT.series.data + (first.rungAgreement.symm ▸ i).succ = + TashkinovStoredColors ett.series.data i.succ := by + classical + let middleIndex := first.rungAgreement.symm ▸ i + have firstSeriesEq := replacementSeriesPresentation first + have treeBridge : + first.replacementETT.series.data.tree middleIndex.succ.castSucc = + ett.series.data.tree i.succ.castSucc := by + rw [firstSeriesEq] + exact (eq_of_heq (projectTree first.rungAgreement.symm + first.replacementSeries i)).trans (first.ladderTreesAgree i) + have storedBridge : + first.replacementETT.series.data.stored middleIndex.succ = + ett.series.data.stored i.succ := by + have middleSucc : middleIndex.succ = first.rungAgreement.symm ▸ i.succ := by + exact succCast first.rungAgreement.symm i + rw [middleSucc] + rw [firstSeriesEq] + exact (eq_of_heq (projectStored first.rungAgreement.symm + first.replacementSeries i.succ)).trans + (first.storedColorsAgree i.succ) + have middleColorBridge : + first.replacementETT.series.data.coloring middleIndex.succ = + first.replacementSeries.data.coloring i.succ := by + have middleSucc : middleIndex.succ = first.rungAgreement.symm ▸ i.succ := by + exact succCast first.rungAgreement.symm i + rw [middleSucc] + rw [firstSeriesEq] + exact eq_of_heq (projectColoring first.rungAgreement.symm + first.replacementSeries i.succ) + have raw : ∀ j : Fin (first.replacementETT.rounds + 1), + first.replacementETT.series.data.stored j = + ett.series.data.stored (first.rungAgreement ▸ j) := by + intro j + rw [firstSeriesEq] + have p := projectStored first.rungAgreement.symm + first.replacementSeries (first.rungAgreement ▸ j) + have pj := eq_of_heq p + rw [castBackPlus first.rungAgreement.symm j] at pj + exact pj.trans (first.storedColorsAgree (first.rungAgreement ▸ j)) + have missing : + TreeMissingColors + (first.replacementETT.series.data.coloring middleIndex.succ) + (first.replacementETT.series.data.tree middleIndex.succ.castSucc) = + TreeMissingColors (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) := by + rw [middleColorBridge, treeBridge] + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by + rw [← (first.replacementStable i).2 v hv] + exact hc⟩ + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by + rw [(first.replacementStable i).2 v hv] + exact hc⟩ + unfold TashkinovStoredColors + simp only [Fin.val_succ, Nat.add_eq_zero_iff, one_ne_zero, and_false, ↓reduceIte, + Fin.castSucc_succ] + ext c + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · rintro ⟨⟨j, hj, hc⟩, hn⟩ + refine ⟨⟨first.rungAgreement ▸ j, by simp, ?_⟩, ?_⟩ + · rw [← raw j] + have castJ := castValuePlus first.rungAgreement j + have castI := castValue first.rungAgreement.symm i + simpa [middleIndex, castJ, castI] using hc + · have hn' : c ∉ TreeMissingColors + (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) := by + rw [← missing] + exact hn + simpa [Fin.succ] using hn' + · rintro ⟨⟨j, hj, hc⟩, hn⟩ + refine ⟨⟨first.rungAgreement.symm ▸ j, by simp, ?_⟩, ?_⟩ + · have rr := raw (first.rungAgreement.symm ▸ j) + rw [rr] + have castJ := castValuePlus first.rungAgreement.symm j + have castI := castValue first.rungAgreement.symm i + rw [castBackPlus first.rungAgreement j] + simpa [middleIndex, castJ, castI] using hc + · have hn' : c ∉ TreeMissingColors + (first.replacementETT.series.data.coloring middleIndex.succ) + (first.replacementETT.series.data.tree middleIndex.succ.castSucc) := by + rw [missing] + exact hn + simpa [Fin.succ] using hn' + +private theorem correspondingStableComposition + {input : PartialEdgeColoring E k} {T0 T1 T2 : TreeSequence G e0} + {phi sigma tau : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T0 phi} + (first : CorrespondingExtendedTashkinovTree G k e0 ett sigma T1) + (second : CorrespondingExtendedTashkinovTree G k e0 first.replacementETT tau T2) + (i : Fin ett.rounds) : + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) + (ett.series.data.coloring i.succ) + ((first.rungAgreement ▸ second.replacementSeries).data.coloring i.succ) := by + classical + let transported : TashkinovSeries G k ett.rounds e0 second.replacementInput := + first.rungAgreement ▸ second.replacementSeries + have firstSeriesEq := replacementSeriesPresentation first + let middleIndex := first.rungAgreement.symm ▸ i + have treeBridge : + first.replacementETT.series.data.tree middleIndex.succ.castSucc = + ett.series.data.tree i.succ.castSucc := by + rw [firstSeriesEq] + exact (eq_of_heq (projectTree first.rungAgreement.symm + first.replacementSeries i)).trans (first.ladderTreesAgree i) + have storedBridge : + first.replacementETT.series.data.stored middleIndex.succ = + ett.series.data.stored i.succ := by + have middleSucc : middleIndex.succ = first.rungAgreement.symm ▸ i.succ := by + exact succCast first.rungAgreement.symm i + rw [middleSucc] + rw [firstSeriesEq] + exact (eq_of_heq (projectStored first.rungAgreement.symm + first.replacementSeries i.succ)).trans + (first.storedColorsAgree i.succ) + have middleColorBridge : + first.replacementETT.series.data.coloring middleIndex.succ = + first.replacementSeries.data.coloring i.succ := by + have middleSucc : middleIndex.succ = first.rungAgreement.symm ▸ i.succ := by + exact succCast first.rungAgreement.symm i + rw [middleSucc] + rw [firstSeriesEq] + exact eq_of_heq (projectColoring first.rungAgreement.symm + first.replacementSeries i.succ) + have storedColorBridge := correspondingStoredColors first i + have secondStable : StableColoring + (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) + (first.replacementSeries.data.coloring i.succ) + (second.replacementSeries.data.coloring middleIndex.succ) := by + have h := second.replacementStable middleIndex + rw [treeBridge, storedColorBridge, middleColorBridge] at h + exact h + have originalGood : IsProperEdgeColoring G (ett.series.data.coloring i.succ) ∧ + IsOneEdgeUncolored (ett.series.data.coloring i.succ) e0 := by + exact ett.series.coloringProperties i.succ + have middleGood : IsProperEdgeColoring G + (first.replacementSeries.data.coloring i.succ) ∧ + IsOneEdgeUncolored (first.replacementSeries.data.coloring i.succ) e0 := + ⟨first.replacementProper i.succ, first.replacementOneUncolored i.succ⟩ + have finalGood : IsProperEdgeColoring G + (second.replacementSeries.data.coloring middleIndex.succ) ∧ + IsOneEdgeUncolored (second.replacementSeries.data.coloring middleIndex.succ) e0 := + ⟨second.replacementProper middleIndex.succ, + second.replacementOneUncolored middleIndex.succ⟩ + have finalColor : transported.data.coloring i.succ = + second.replacementSeries.data.coloring middleIndex.succ := by + have hc := projectColoring first.rungAgreement + second.replacementSeries middleIndex.succ + have hi : i.succ = first.rungAgreement ▸ middleIndex.succ := by + calc + i.succ = first.rungAgreement ▸ + (first.rungAgreement.symm ▸ i.succ) := + (castBackPlus first.rungAgreement i.succ).symm + _ = first.rungAgreement ▸ middleIndex.succ := by + rw [succCast] + convert (eq_of_heq hc) using 1 + simpa [transported, middleIndex] using congrArg + (fun q => transported.data.coloring q) hi + rw [finalColor] + exact (sc2 G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ)).trans + (x := ⟨ett.series.data.coloring i.succ, originalGood⟩) + (y := ⟨first.replacementSeries.data.coloring i.succ, middleGood⟩) + (z := ⟨second.replacementSeries.data.coloring middleIndex.succ, finalGood⟩) + (first.replacementStable i) secondStable + +end + +lemma CorrespondingExtendedTashkinovTreeTransTrees + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) + (T0 T1 T2 : TreeSequence G e0) + (phi sigma tau : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T0 phi) + (first : CorrespondingExtendedTashkinovTree G k e0 ett sigma T1) + (second : CorrespondingExtendedTashkinovTree + G k e0 first.replacementETT tau T2) : + exists composite : CorrespondingExtendedTashkinovTree G k e0 ett tau T2, + composite.replacementInput = second.replacementInput /\ + HEq composite.replacementSeries second.replacementSeries /\ + HEq composite.replacementETT second.replacementETT := by + classical + have roundLink : second.replacementETT.rounds = ett.rounds := + second.rungAgreement.trans first.rungAgreement + let transported : TashkinovSeries G k ett.rounds e0 second.replacementInput := + first.rungAgreement ▸ second.replacementSeries + have seriesTransport : HEq transported second.replacementSeries := by + simp [transported] + have firstSeriesEq := replacementSeriesPresentation first + let composite : CorrespondingExtendedTashkinovTree G k e0 ett tau T2 := { + replacementInput := second.replacementInput + replacementSeries := transported + replacementETT := second.replacementETT + rungAgreement := roundLink + seriesPresentation := by + exact HEq.trans second.seriesPresentation seriesTransport.symm + finalGeneratingColoring := by + have finalTransport := projectLast first.rungAgreement second.replacementSeries + exact second.finalGeneratingColoring.trans (eq_of_heq finalTransport).symm + ladderTreesAgree := by + intro i + let middleIndex := first.rungAgreement.symm ▸ i + have secondStep := second.ladderTreesAgree middleIndex + have firstStep := first.ladderTreesAgree i + rw [firstSeriesEq] at secondStep + have transportedCast := projectTree first.rungAgreement + second.replacementSeries middleIndex + have firstCast := projectTree first.rungAgreement.symm + first.replacementSeries i + have firstStepCast : + (first.rungAgreement.symm ▸ first.replacementSeries).data.tree + middleIndex.succ.castSucc = + ett.series.data.tree i.succ.castSucc := by + exact (eq_of_heq firstCast).trans firstStep + have secondStepCast : + second.replacementSeries.data.tree middleIndex.succ.castSucc = + (first.rungAgreement.symm ▸ first.replacementSeries).data.tree + middleIndex.succ.castSucc := by + exact secondStep + have transportedCastEq : + transported.data.tree i.succ.castSucc = + second.replacementSeries.data.tree middleIndex.succ.castSucc := by + have indexBack : first.rungAgreement ▸ middleIndex = i := by + exact castBack first.rungAgreement i + convert (eq_of_heq transportedCast) using 1 + · simp [transported, indexBack] + exact transportedCastEq.trans (secondStepCast.trans firstStepCast) + storedColorsAgree := by + intro i + let middleIndex := first.rungAgreement.symm ▸ i + have a := second.storedColorsAgree middleIndex + rw [firstSeriesEq] at a + have b := first.storedColorsAgree i + have c := projectStored first.rungAgreement.symm first.replacementSeries i + have d := projectStored first.rungAgreement second.replacementSeries middleIndex + have hi : i = first.rungAgreement ▸ middleIndex := by + exact (castBackPlus first.rungAgreement i).symm + have dEq : transported.data.stored i = + second.replacementSeries.data.stored middleIndex := by + convert (eq_of_heq d) using 1 + simpa [transported, middleIndex, Fin.cast_eq_self] using congrArg + (fun q => transported.data.stored q) + hi + exact dEq.trans (a.trans ((eq_of_heq c).trans b)) + connectingEdgesAgree := by + intro i + let middleIndex := first.rungAgreement.symm ▸ i + have a := second.connectingEdgesAgree middleIndex + rw [firstSeriesEq] at a + have b := first.connectingEdgesAgree i + have c := projectEdges first.rungAgreement.symm first.replacementSeries i + have d := projectEdges first.rungAgreement second.replacementSeries middleIndex + have hi : i = first.rungAgreement ▸ middleIndex := by + exact (castBackPlus first.rungAgreement i).symm + have dEq : transported.data.connectingEdges i = + second.replacementSeries.data.connectingEdges middleIndex := by + convert (eq_of_heq d) using 1 + simpa [transported, middleIndex, Fin.cast_eq_self] using congrArg + (fun q => transported.data.connectingEdges q) + hi + exact dEq.trans (a.trans ((eq_of_heq c).trans b)) + extensionKindsAgree := by + intro i + let middleIndex := first.rungAgreement.symm ▸ i + have a := second.extensionKindsAgree middleIndex + rw [firstSeriesEq] at a + have b := first.extensionKindsAgree i + have c := projectKind first.rungAgreement.symm first.replacementSeries i + have d := projectKind first.rungAgreement second.replacementSeries middleIndex + have hi : i = first.rungAgreement ▸ middleIndex := by + exact (castBackPlus first.rungAgreement i).symm + have dEq : transported.data.kind i = + second.replacementSeries.data.kind middleIndex := by + convert (eq_of_heq d) using 1 + simpa [transported, middleIndex, Fin.cast_eq_self] using congrArg + (fun q => transported.data.kind q) + hi + exact dEq.trans (a.trans ((eq_of_heq c).trans b)) + replacementProper := by + intro i + let middleIndex := first.rungAgreement.symm ▸ i + have hc := projectColoring first.rungAgreement second.replacementSeries middleIndex + have hi : i = first.rungAgreement ▸ middleIndex := by + exact (castBackPlus first.rungAgreement i).symm + have hcEq : transported.data.coloring i = + second.replacementSeries.data.coloring middleIndex := by + convert (eq_of_heq hc) using 1 + simpa [transported, middleIndex, Fin.cast_eq_self] using congrArg + (fun q => transported.data.coloring q) + hi + rw [hcEq] + exact second.replacementProper middleIndex + replacementOneUncolored := by + intro i + let middleIndex := first.rungAgreement.symm ▸ i + have hc := projectColoring first.rungAgreement second.replacementSeries middleIndex + have hi : i = first.rungAgreement ▸ middleIndex := by + exact (castBackPlus first.rungAgreement i).symm + have hcEq : transported.data.coloring i = + second.replacementSeries.data.coloring middleIndex := by + convert (eq_of_heq hc) using 1 + simpa [transported, middleIndex, Fin.cast_eq_self] using congrArg + (fun q => transported.data.coloring q) + hi + rw [hcEq] + exact second.replacementOneUncolored middleIndex + replacementStable := correspondingStableComposition first second } + exact ⟨composite, rfl, seriesTransport, by rfl⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CorrespondingTerminalClosureEq.lean b/LeanPool/GoldbergSeymour/CorrespondingTerminalClosureEq.lean new file mode 100644 index 0000000000..9d885d4f5d --- /dev/null +++ b/LeanPool/GoldbergSeymour/CorrespondingTerminalClosureEq.lean @@ -0,0 +1,243 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.TashkinovClosureVertexSetUnique +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeUnique +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetEq + +/-! +# Corresponding Terminal Closure Eq + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem CorrespondingTerminalClosureEq + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (sigmaN : PartialEdgeColoring E k) (Tstar seed : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigmaN Tstar) + (seedRoute : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE /\ + seed = ett.series.data.tree (Fin.last ett.rounds).castSucc) \/ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE \/ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) /\ + exists f : E, + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} /\ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed)) + (chosenClosure : TashkinovClosure sigmaN seed Tstar) : + corr.replacementSeries.data.tree (Fin.last (ett.rounds + 1)) = Tstar := by + classical + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have seriesSame : replacementData = replacementSeries := + eq_of_heq seriesPresentation + cases seriesSame + let q : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt ett.roundsPositive) (by omega)⟩ + have hq : q.succ = Fin.last ett.rounds := by + apply Fin.ext + exact Nat.sub_add_cancel ett.roundsPositive + have hq2 : q.succ.succ = Fin.last (ett.rounds + 1) := by + rw [hq] + rfl + have ladderEq : replacementSeries.data.tree + (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rw [← hq] + exact ladderTreesAgree q + have kindEq : replacementSeries.data.kind (Fin.last ett.rounds) = + ett.series.data.kind (Fin.last ett.rounds) := + extensionKindsAgree (Fin.last ett.rounds) + have edgesEq : replacementSeries.data.connectingEdges (Fin.last ett.rounds) = + ett.series.data.connectingEdges (Fin.last ett.rounds) := + connectingEdgesAgree (Fin.last ett.rounds) + have finalStep := replacementSeries.certified (Fin.last ett.rounds) + generalize finalIndex : Fin.last ett.rounds = target at finalStep + cases finalStep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hnone : replacementSeries.data.kind (Fin.last ett.rounds) = none := by + rw [finalIndex, initialKind] + rcases seedRoute with hPE | hSER + · rw [← kindEq, hnone] at hPE + cases hPE.1 + · rcases hSER.1 with hSE | hRE + · rw [← kindEq, hnone] at hSE + cases hSE + · rw [← kindEq, hnone] at hRE + cases hRE + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val finalIndex + simp [q] at hv ⊢ + omega + subst i + have newKind : replacementSeries.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE := by + rw [← hq] + exact currentKind + rcases seedRoute with hPE | hSER + · have : (some TashkinovExtensionKind.SE) = + some TashkinovExtensionKind.PE := by + calc + some TashkinovExtensionKind.SE = + replacementSeries.data.kind (Fin.last ett.rounds) := newKind.symm + _ = ett.series.data.kind (Fin.last ett.rounds) := kindEq + _ = some TashkinovExtensionKind.PE := hPE.1 + cases this + · rcases hSER with ⟨oldKind, f, oldEdges, oldAdjoined⟩ + have edgeSingleton : ({choice.edge} : Finset E) = {f} := by + calc + {choice.edge} = replacementSeries.data.connectingEdges + (Fin.last ett.rounds) := by rw [← hq, currentEdges] + _ = ett.series.data.connectingEdges (Fin.last ett.rounds) := edgesEq + _ = {f} := oldEdges + have edgeEq : choice.edge = f := by simpa using edgeSingleton + have newAdjoined : TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f adjoined := by + rw [← ladderEq, ← edgeEq, ← hq] + exact adjoinedExactly + have adjoinedEq : adjoined = seed := + TreeSequenceAdjoinEdgeUnique _ _ _ _ newAdjoined oldAdjoined + have newClosure : TashkinovClosure sigmaN seed + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := by + rw [← adjoinedEq, finalGeneratingColoring, ← hq, ← hq2] + simpa using closedExtension + have vertexEq : TreeSequenceVertexSet Tstar = + TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := + TashkinovClosureVertexSetUnique sigmaN seed Tstar _ + chosenClosure newClosure + exact (TreeSequenceInitialSegmentVertexSetEq Tstar _ below vertexEq).symm + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val finalIndex + simp [q] at hv ⊢ + omega + subst i + have newKind : replacementSeries.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := by + rw [← hq] + exact currentKind + rcases seedRoute with hPE | hSER + · have seedEq : seed = + replacementSeries.data.tree (Fin.last ett.rounds).castSucc := + hPE.2.trans ladderEq.symm + have newClosure : TashkinovClosure sigmaN seed + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := by + rw [seedEq, finalGeneratingColoring, ← hq, ← hq2] + simpa using closedExtension + have vertexEq : TreeSequenceVertexSet Tstar = + TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := + TashkinovClosureVertexSetUnique sigmaN seed Tstar _ + chosenClosure newClosure + exact (TreeSequenceInitialSegmentVertexSetEq Tstar _ below vertexEq).symm + · rcases hSER.1 with hSE | hRE + · have : (some TashkinovExtensionKind.PE) = + some TashkinovExtensionKind.SE := by + calc + some TashkinovExtensionKind.PE = + replacementSeries.data.kind (Fin.last ett.rounds) := newKind.symm + _ = ett.series.data.kind (Fin.last ett.rounds) := kindEq + _ = some TashkinovExtensionKind.SE := hSE + cases this + · have : (some TashkinovExtensionKind.PE) = + some TashkinovExtensionKind.RE := by + calc + some TashkinovExtensionKind.PE = + replacementSeries.data.kind (Fin.last ett.rounds) := newKind.symm + _ = ett.series.data.kind (Fin.last ett.rounds) := kindEq + _ = some TashkinovExtensionKind.RE := hRE + cases this + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val finalIndex + simp [q] at hv ⊢ + omega + subst i + have newKind : replacementSeries.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE := by + rw [← hq] + exact currentKind + rcases seedRoute with hPE | hSER + · have : (some TashkinovExtensionKind.RE) = + some TashkinovExtensionKind.PE := by + calc + some TashkinovExtensionKind.RE = + replacementSeries.data.kind (Fin.last ett.rounds) := newKind.symm + _ = ett.series.data.kind (Fin.last ett.rounds) := kindEq + _ = some TashkinovExtensionKind.PE := hPE.1 + cases this + · rcases hSER with ⟨oldKind, f, oldEdges, oldAdjoined⟩ + have edgeSingleton : ({available.edge} : Finset E) = {f} := by + calc + {available.edge} = replacementSeries.data.connectingEdges + (Fin.last ett.rounds) := by rw [← hq, currentEdges] + _ = ett.series.data.connectingEdges (Fin.last ett.rounds) := edgesEq + _ = {f} := oldEdges + have edgeEq : available.edge = f := by simpa using edgeSingleton + have newAdjoined : TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f adjoined := by + rw [← ladderEq, ← edgeEq, ← hq] + exact adjoinedExactly + have adjoinedEq : adjoined = seed := + TreeSequenceAdjoinEdgeUnique _ _ _ _ newAdjoined oldAdjoined + have newClosure : TashkinovClosure sigmaN seed + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := by + rw [← adjoinedEq, finalGeneratingColoring, ← hq, ← hq2] + simpa using closedExtension + have vertexEq : TreeSequenceVertexSet Tstar = + TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := + TashkinovClosureVertexSetUnique sigmaN seed Tstar _ + chosenClosure newClosure + exact (TreeSequenceInitialSegmentVertexSetEq Tstar _ below vertexEq).symm + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Critical.lean b/LeanPool/GoldbergSeymour/Critical.lean new file mode 100644 index 0000000000..25fd768df3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Critical.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChromaticIndex +public import LeanPool.GoldbergSeymour.DeleteEdge + +/-! +# Critical + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Deleting any edge strictly decreases the chromatic index. -/ +def Critical {V E : Type*} [Fintype E] [DecidableEq E] (G : LooplessMultigraph V E) : + Prop := + ∀ e : E, ChromaticIndex (DeleteEdge G e) < ChromaticIndex G + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CriticalCoreExists.lean b/LeanPool/GoldbergSeymour/CriticalCoreExists.lean new file mode 100644 index 0000000000..dad90d66e1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/CriticalCoreExists.lean @@ -0,0 +1,133 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Finset.Powerset +public import Mathlib.Order.Northcott + +public import LeanPool.GoldbergSeymour.ChromaticIndexRestrict +public import LeanPool.GoldbergSeymour.Critical + +/-! +# Critical Core Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem CriticalCoreExists {V E : Type*} [Finite V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) : + ∃ F : Finset E, + ChromaticIndex (RestrictEdges G F) = ChromaticIndex G ∧ + Critical (RestrictEdges G F) := by + classical + let _ := Fintype.ofFinite V + let candidates : Finset (Finset E) := + (Finset.univ : Finset E).powerset.filter + (fun F => ChromaticIndex (RestrictEdges G F) = ChromaticIndex G) + have candidates_nonempty : candidates.Nonempty := by + refine ⟨Finset.univ, ?_⟩ + apply Finset.mem_filter.mpr + constructor + · exact Finset.mem_powerset.mpr (Finset.subset_univ _) + · have coloring := (ChromaticIndexSpec G).1 + obtain ⟨φ, hproper, hfull⟩ := coloring + apply le_antisymm + · exact ChromaticIndexRestrict G Finset.univ + · obtain ⟨ψ, hψ, hψfull⟩ := + (ChromaticIndexSpec (RestrictEdges G Finset.univ)).1 + apply (ChromaticIndexSpec G).2 + refine ⟨(fun e => ψ ⟨e, by simp⟩), ?_, ?_⟩ + · intro e f c hne hadj he hf + apply hψ (e := (⟨e, by simp⟩ : {x // x ∈ (Finset.univ : Finset E)})) + (f := (⟨f, by simp⟩ : {x // x ∈ (Finset.univ : Finset E)})) ?_ ?_ he hf + · intro h + apply hne + exact congrArg Subtype.val h + · simpa [AdjacentEdges, Incident, RestrictEdges] using hadj + · intro e + exact hψfull ⟨e, by simp⟩ + obtain ⟨F, hF, hmin⟩ := + Finset.exists_min_image candidates (fun X => X.card) candidates_nonempty + have hFeq : ChromaticIndex (RestrictEdges G F) = ChromaticIndex G := by + simpa [candidates] using hF + refine ⟨F, hFeq, ?_⟩ + intro e + have hle := ChromaticIndexRestrict G (F.erase e.1) + have hstrict : ChromaticIndex (RestrictEdges G (F.erase e.1)) < + ChromaticIndex (RestrictEdges G F) := by + apply lt_of_le_of_ne + · simpa [hFeq] using hle + · intro heq + have smaller : (F.erase e.1).card < F.card := Finset.card_erase_lt_of_mem e.property + have member : F.erase e.1 ∈ candidates := by + apply Finset.mem_filter.mpr + constructor + · apply Finset.mem_powerset.mpr + exact (Finset.erase_subset _ _).trans (Finset.subset_univ _) + · exact heq.trans hFeq + exact (Nat.not_lt_of_ge (hmin _ member)) smaller + have indexMatch : + ChromaticIndex (RestrictEdges (RestrictEdges G F) (F.attach.erase e)) = + ChromaticIndex (RestrictEdges G (F.erase e.1)) := by + let mapDirect : {x // x ∈ F.erase e.1} → + {x // x ∈ F.attach.erase e} := fun x => + ⟨⟨x.1, Finset.mem_of_mem_erase x.2⟩, by + apply Finset.mem_erase.mpr + constructor + · intro h + apply (Finset.mem_erase.mp x.2).1 + exact congrArg Subtype.val h + · exact Finset.mem_attach _ _⟩ + let mapNested : {x // x ∈ F.attach.erase e} → + {x // x ∈ F.erase e.1} := fun x => + ⟨x.1.1, by + apply Finset.mem_erase.mpr + constructor + · intro h + apply (Finset.mem_erase.mp x.2).1 + exact Subtype.ext h + · exact x.1.2⟩ + apply le_antisymm + · obtain ⟨φ, hφ, hfull⟩ := + (ChromaticIndexSpec (RestrictEdges G (F.erase e.1))).1 + apply (ChromaticIndexSpec (RestrictEdges (RestrictEdges G F) (F.attach.erase e))).2 + (ChromaticIndex (RestrictEdges G (F.erase e.1))) + refine ⟨(fun x => φ (mapNested x)), ?_, ?_⟩ + · intro x y c hne hadj hx hy + apply hφ (e := mapNested x) (f := mapNested y) ?_ ?_ hx hy + · intro h + apply hne + apply Subtype.ext + apply Subtype.ext + exact congrArg (fun z => z.1) h + · simpa [mapNested, AdjacentEdges, Incident, RestrictEdges] using hadj + · intro x + exact hfull (mapNested x) + · obtain ⟨φ, hφ, hfull⟩ := + (ChromaticIndexSpec (RestrictEdges (RestrictEdges G F) (F.attach.erase e))).1 + apply (ChromaticIndexSpec (RestrictEdges G (F.erase e.1))).2 + (ChromaticIndex (RestrictEdges (RestrictEdges G F) (F.attach.erase e))) + refine ⟨(fun x => φ (mapDirect x)), ?_, ?_⟩ + · intro x y c hne hadj hx hy + apply hφ (e := mapDirect x) (f := mapDirect y) ?_ ?_ hx hy + · intro h + apply hne + exact Subtype.ext (congrArg (fun z => z.1.1) h) + · simpa [mapDirect, AdjacentEdges, Incident, RestrictEdges] using hadj + · intro x + exact hfull (mapDirect x) + rw [DeleteEdge] + exact indexMatch ▸ hstrict + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CriticalGraphElementaryWitness.lean b/LeanPool/GoldbergSeymour/CriticalGraphElementaryWitness.lean new file mode 100644 index 0000000000..015fdeec24 --- /dev/null +++ b/LeanPool/GoldbergSeymour/CriticalGraphElementaryWitness.lean @@ -0,0 +1,753 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed +public import LeanPool.GoldbergSeymour.ChromaticIndexSpec +public import LeanPool.GoldbergSeymour.Critical +public import LeanPool.GoldbergSeymour.Density +public import LeanPool.GoldbergSeymour.DensityCeil +public import LeanPool.GoldbergSeymour.DensityLowerBound +public import LeanPool.GoldbergSeymour.DensityValue +public import LeanPool.GoldbergSeymour.Elementary +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.StronglyClosedWitnessElementary + +/-! +# egraph2 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_p_to_q_85.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ), Critical G → ChromaticIndex G = k + (1 : ℕ) → + let P : Prop := + ∀ (e0 : E) (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → IsOneEdgeUncolored + phi e0 → ColoredVertexSetElementary G phi Finset.univ; + let Q : Prop := + ∃ (e0 : E) (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi ∧ IsOneEdgeUncolored + phi e0 ∧ ColoredVertexSetElementary G phi Finset.univ; P → Q := by + classical + intro V E _ _ _ G k hcritical hindex P Q hp + have hedge : ∃ e : E, True := by + by_contra hn + have he : IsFullEdgeColoring (fun _ : E => (none : Option (Fin 0))) := by + intro e + exact False.elim (hn ⟨e, trivial⟩) + have hcol : HasKEdgeColoring G 0 := by + refine ⟨fun _ => none, ?_, he⟩ + intro e f c hne hadj hce + simp at hce + have hz : ChromaticIndex G ≤ 0 := (ChromaticIndexSpec G).2 0 hcol + omega + obtain ⟨e0, _⟩ := hedge + have hdel := hcritical e0 + have hle : ChromaticIndex (DeleteEdge G e0) ≤ k := by + have ht : ChromaticIndex (DeleteEdge G e0) < k + 1 := by + simpa [hindex] using hdel + omega + obtain ⟨psi, hpp, hfull⟩ := (ChromaticIndexSpec (DeleteEdge G e0)).1 + let phi : PartialEdgeColoring E k := fun e => + if he : e = e0 then none else + some (Fin.castLE hle (Classical.choose (hfull ⟨e, by simp [he]⟩))) + have hproper : IsProperEdgeColoring G phi := by + intro e f c hef hadj hce + by_cases he : e = e0 + · simp [phi, he] at hce + · by_cases hf : f = e0 + · simp [phi, hf] + · have hce' : Fin.castLE hle (Classical.choose (hfull ⟨e, by simp [he]⟩)) = c := by + have hc := Classical.choose_spec (hfull ⟨e, by simp [he]⟩) + have := Option.some.inj (show + some (Fin.castLE hle (Classical.choose (hfull ⟨e, by simp [he]⟩))) = some c by + simpa [phi, he] using hce) + exact this + have hpf := hpp (show (⟨e, by simp [he]⟩ : {e // e ∈ Finset.univ.erase e0}) ≠ + ⟨f, by simp [hf]⟩ by simpa using hef) + (by simpa [AdjacentEdges, Incident, DeleteEdge, RestrictEdges] using hadj) + (by simpa using Classical.choose_spec (hfull ⟨e, by simp [he]⟩)) + intro hbad + apply hpf + have hbad' := Option.some.inj (show + some (Fin.castLE hle (Classical.choose (hfull ⟨f, by simp [hf]⟩))) = some c by + simpa [phi, hf] using hbad) + have hsame : Classical.choose (hfull ⟨f, by simp [hf]⟩) = + Classical.choose (hfull ⟨e, by simp [he]⟩) := by + apply Fin.ext + exact (congrArg Fin.val hbad').trans (congrArg Fin.val hce').symm + rw [← hsame] + exact Classical.choose_spec (hfull ⟨f, by simp [hf]⟩) + have ho : IsOneEdgeUncolored phi e0 := by + constructor + · simp [phi] + · intro e he + refine ⟨Fin.castLE hle (Classical.choose (hfull ⟨e, by simp [he]⟩)), ?_⟩ + simp [phi, he] + exact ⟨e0, phi, hproper, ho, hp e0 phi hproper ho⟩ + +private theorem helper_continuation_315.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi → + ∀ (U : Finset V), EligibleOddSet U → ( + ∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ)) → U = Finset.univ → ( + ∀ (c : Fin k), (2 : ℕ) * ({e ∈ Finset.univ.erase e0 | phi e = some c} : Finset E).card = + U.card - (1 : ℕ)) → ColoredVertexSetElementary G phi Finset.univ := by + classical + intro V E _ _ _ G k e0 phi hp U hElig endpoint_card hUall hclass + unfold ColoredVertexSetElementary + intro u hu v hv hne + by_contra hdis + rw [Finset.not_disjoint_iff] at hdis + obtain ⟨c, hcu, hcv⟩ := hdis + have hcu' : c ∉ PresentColors G phi u := by + exact (Finset.mem_sdiff.mp hcu).2 + have hcv' : c ∉ PresentColors G phi v := by + exact (Finset.mem_sdiff.mp hcv).2 + let edges := (Finset.univ.erase e0).filter (fun e => phi e = some c) + have edge_disjoint : ∀ ⦃e⦄, e ∈ edges → ∀ ⦃f⦄, f ∈ edges → + e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + intro e hee f hef hne' + rw [Finset.disjoint_left] + intro z hze hzf + have hce := (Finset.mem_filter.mp hee).2 + have hcf := (Finset.mem_filter.mp hef).2 + exact hp hne' ⟨z, Sym2.mem_toFinset.mp hze, Sym2.mem_toFinset.mp hzf⟩ hce hcf + have union_card : (edges.biUnion fun e => (G.ends e).toFinset).card = + 2 * edges.card := by + have aux : ∀ s : Finset E, s ⊆ edges → + (s.biUnion fun e => (G.ends e).toFinset).card = 2 * s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset + (s.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro z hze hzs + obtain ⟨f, hf, hzf⟩ := Finset.mem_biUnion.mp hzs + have hh := edge_disjoint (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq' + exact hes (by simpa [heq'] using hf)) + exact (Finset.disjoint_left.mp hh) hze hzf + rw [Finset.card_union_of_disjoint hd, endpoint_card] + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem hes] + omega + exact aux edges (by intro e hee; exact hee) + have union_subset : edges.biUnion (fun e => (G.ends e).toFinset) ⊆ + (Finset.univ.erase u).erase v := by + intro z hz + obtain ⟨e, hee, hze⟩ := Finset.mem_biUnion.mp hz + have hce := (Finset.mem_filter.mp hee).2 + have hzu : z ≠ u := by + intro hzu + apply hcu' + refine Finset.mem_filter.mpr ⟨by simp, ?_⟩ + have hzinc : Incident G z e := Sym2.mem_toFinset.mp hze + rw [hzu] at hzinc + exact ⟨e, hzinc, hce⟩ + have hzv : z ≠ v := by + intro hzv + apply hcv' + refine Finset.mem_filter.mpr ⟨by simp, ?_⟩ + have hzinc : Incident G z e := Sym2.mem_toFinset.mp hze + rw [hzv] at hzinc + exact ⟨e, hzinc, hce⟩ + simp [hzu, hzv] + have hcard : 2 * edges.card ≤ U.card - 2 := by + have := Finset.card_le_card union_subset + have hcardUV : ((Finset.univ.erase u).erase v).card = Fintype.card V - 2 := by + have hu' : (Finset.univ : Finset V).card - 1 = + (Finset.univ.erase u).card := by + symm + exact Finset.card_erase_of_mem (by simp) + have hv' : v ∈ (Finset.univ.erase u : Finset V) := + Finset.mem_erase.mpr ⟨hne.symm, by simp⟩ + rw [Finset.card_erase_of_mem hv', ← hu'] + have hlarge : 3 ≤ Fintype.card V := by + simpa [hUall] using hElig.1 + simp + omega + calc + 2 * edges.card = (edges.biUnion fun e => (G.ends e).toFinset).card := union_card.symm + _ ≤ ((Finset.univ.erase u).erase v).card := this + _ = U.card - 2 := by rw [hcardUV, hUall]; simp + have hceq := hclass c + dsimp [edges] at hceq hcard + have hlarge : 3 ≤ U.card := hElig.1 + omega + +private theorem helper_continuation_337.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ), + MaximumDegree G + (1 : ℕ) ≤ k → ( + ∀ (v : V), + ∃ (e : E), Incident G v e) → Elementary G → + ∀ (e0 : E) (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → IsOneEdgeUncolored + phi e0 → + ∀ U ∈ ({U ∈ Finset.univ.powerset | EligibleOddSet U} : Finset (Finset V)), DensityValue G U = + Density G → (↑k : ℚ) < DensityValue G U → EligibleOddSet U → ( + ∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ)) → ( + ∀ (qphi : PartialEdgeColoring E k), IsProperEdgeColoring G qphi → + ∀ (W : Finset V), EligibleOddSet W → + ∀ (c : Fin k), (2 : ℕ) * ({e ∈ InternalEdges G W | qphi e = some c} : Finset E).card ≤ W.card + - (1 : ℕ)) → ( + ∀ S ⊆ InternalEdges G U, + ∀ (qphi : PartialEdgeColoring E k), IsProperEdgeColoring G qphi → ( + ∀ e ∈ S, + ∃ (c : Fin k), qphi e = some c) → (2 : ℕ) * S.card ≤ k * (U.card - (1 : ℕ))) → ( + ∀ (f : E), f ∈ InternalEdges G U) → ColoredVertexSetElementary G phi Finset.univ := by + classical + intro V E _ _ G k hdegree hnoisolated he e0 phi hp ho U hU hEq hvalue hElig endpoint_card + matching_card total_card edge_internal + have hUall : U = Finset.univ := by + apply Finset.eq_univ_of_forall + intro v + obtain ⟨e, he⟩ := hnoisolated v + have hi := edge_internal e + have hi' : ∀ z, Incident G z e → z ∈ U := by + simpa [InternalEdges] using hi + exact hi' v he + have hInternal : InternalEdges G U = (Finset.univ : Finset E) := by + ext e + simp [InternalEdges, hUall] + have hSsub : (Finset.univ.erase e0 : Finset E) ⊆ InternalEdges G U := by + intro e he + rw [hInternal] + simp + have hfullS : ∀ e, e ∈ (Finset.univ.erase e0 : Finset E) → + ∃ c, phi e = some c := by + intro e he + exact ho.2 e (Finset.mem_erase.mp he).1 + have hb := total_card (Finset.univ.erase e0) hSsub phi hp hfullS + have hstrictQ : (k : ℚ) * ((U.card : ℚ) - 1) < + 2 * (Finset.univ : Finset E).card := by + change (k : ℚ) < (2 * (InternalEdges G U).card : ℚ) / + ((U.card : ℚ) - 1) at hvalue + have hn : (0 : ℚ) < (U.card : ℚ) - 1 := by + have ht := hElig.1 + exact sub_pos.mpr (by exact_mod_cast (show 1 < U.card by omega)) + apply (lt_div_iff₀ hn).1 at hvalue + rw [hInternal] at hvalue + exact hvalue + have hstrict : k * (U.card - 1) < 2 * (Finset.univ : Finset E).card := by + have hcast : (↑(U.card - 1) : ℚ) = (U.card : ℚ) - 1 := by + have hU3 : 3 ≤ U.card := hElig.1 + rw [Nat.cast_sub (by omega)] + norm_num + have hq : (k : ℚ) * (↑(U.card - 1) : ℚ) < + 2 * (Finset.univ : Finset E).card := by + rw [hcast] + exact hstrictQ + exact_mod_cast hq + have heq : 2 * (Finset.univ : Finset E).card - 2 = k * (U.card - 1) := by + have hs := hElig.2 + obtain ⟨t, ht⟩ := hs + have hc := (show (Finset.univ.erase e0 : Finset E).card = + (Finset.univ : Finset E).card - 1 by simp) + rw [hc] at hb + have hprod : 2 ∣ k * (U.card - 1) := by + refine ⟨k * t, ?_⟩ + rw [ht] + simp [Nat.mul_assoc, Nat.mul_comm] + omega + have hclass : + ∀ c : Fin k, 2 * ((Finset.univ.erase e0).filter (fun e => phi e = some c)).card = U.card - 1 + := by + intro c + have hm := matching_card phi hp U hElig c + have hle : 2 * ((Finset.univ.erase e0).filter + (fun e => phi e = some c)).card ≤ U.card - 1 := by + have hsub : (Finset.univ.erase e0).filter (fun e => phi e = some c) = + (InternalEdges G U).filter (fun e => phi e = some c) := by + ext e + by_cases he : e = e0 + · simp [he, ho.1] + · simp [hInternal, he] + rw [hsub] + exact hm + have recurrenceColors : ∀ T : Finset (Fin k), + 2 * ((Finset.univ.erase e0).filter (fun e => ∃ d ∈ T, + phi e = some d)).card ≤ T.card * (U.card - 1) := by + intro T + induction T using Finset.induction_on with + | empty => simp + | @insert d T hdt ih => + let old := (Finset.univ.erase e0).filter (fun e => ∃ c ∈ T, phi e = some c) + let fresh := (Finset.univ.erase e0).filter (fun e => phi e = some d) + have split : (Finset.univ.erase e0).filter (fun e => ∃ c ∈ insert d T, + phi e = some c) = old ∪ fresh := by + ext e + simp only [old, fresh, Finset.mem_union, Finset.mem_filter, Finset.mem_insert] + aesop + have disj : Disjoint old fresh := by + rw [Finset.disjoint_left] + intro e he ho + have h1 := (Finset.mem_filter.mp he).2 + have h2 := (Finset.mem_filter.mp ho).2 + obtain ⟨c, hc, hce⟩ := h1 + have : c = d := by + apply Option.some.inj + exact hce.symm.trans h2 + exact hdt (this ▸ hc) + rw [split, Finset.card_union_of_disjoint disj] + have hdcard := matching_card phi hp U hElig d + have hfresh : 2 * fresh.card ≤ U.card - 1 := by + have hsubD : fresh = (InternalEdges G U).filter + (fun e => phi e = some d) := by + ext e + by_cases he : e = e0 + · simp [fresh, he, ho.1] + · simp [fresh, hInternal, he] + rw [hsubD] + exact hdcard + dsimp [old, fresh] at ih ⊢ + calc + 2 * ((old.card) + fresh.card) = 2 * old.card + 2 * fresh.card := by omega + _ ≤ T.card * (U.card - 1) + (U.card - 1) := Nat.add_le_add ih hfresh + _ = (insert d T).card * (U.card - 1) := by + rw [Finset.card_insert_of_notMem hdt] + simp [Nat.add_mul, Nat.add_comm] + have hother := recurrenceColors (Finset.univ.erase c : Finset (Fin k)) + have hpartition : (Finset.univ.erase e0 : Finset E) = + ((Finset.univ.erase e0).filter (fun e => phi e = some c)) ∪ + ((Finset.univ.erase e0).filter (fun e => ∃ d ∈ Finset.univ.erase c, + phi e = some d)) := by + ext e + by_cases he : e ∈ (Finset.univ.erase e0 : Finset E) + · obtain ⟨d, hd⟩ := hfullS e he + by_cases hdc : d = c + · simp only [Finset.mem_union, Finset.mem_filter] + constructor + · intro _ + exact Or.inl ⟨he, by simpa [hdc] using hd⟩ + · intro _ + exact he + · simp only [Finset.mem_union, Finset.mem_filter] + constructor + · intro _ + exact Or.inr ⟨he, d, Finset.mem_erase.mpr ⟨hdc, by simp⟩, hd⟩ + · intro _ + exact he + · simp [he] + have hsumcard : 2 * (Finset.univ.erase e0 : Finset E).card = + k * (U.card - 1) := by + have hc' : (Finset.univ.erase e0 : Finset E).card = + (Finset.univ : Finset E).card - 1 := by simp + rw [hc'] + omega + have hleOther : 2 * ((Finset.univ.erase e0).filter (fun e => ∃ d ∈ + Finset.univ.erase c, phi e = some d)).card ≤ + (k - 1) * (U.card - 1) := by + simpa using hother + have hclass' : 2 * ((Finset.univ.erase e0).filter + (fun e => phi e = some c)).card = U.card - 1 := by + rw [hpartition] at hsumcard + have hdj : Disjoint ((Finset.univ.erase e0).filter (fun e => phi e = some c)) + ((Finset.univ.erase e0).filter (fun e => ∃ d ∈ Finset.univ.erase c, + phi e = some d)) := by + rw [Finset.disjoint_left] + intro e he ho + obtain ⟨d, hd, hde⟩ := (Finset.mem_filter.mp ho).2 + have hcd : c = d := by + apply Option.some.inj + exact ((Finset.mem_filter.mp he).2).symm.trans hde + exact (Finset.mem_erase.mp hd).1 hcd.symm + rw [Finset.card_union_of_disjoint hdj] at hsumcard + have hm' := matching_card phi hp U hElig c + have hrel : k * (U.card - 1) = + (k - 1) * (U.card - 1) + (U.card - 1) := by + calc + k * (U.card - 1) = (k - 1 + 1) * (U.card - 1) := by + rw [Nat.sub_add_cancel (by omega)] + _ = (k - 1) * (U.card - 1) + (U.card - 1) := by + rw [Nat.add_mul] + simp + rw [hrel] at hsumcard + simp only [Finset.mem_erase, ne_eq, Finset.mem_univ, and_true, Nat.mul_add] at hsumcard + have hsum' : 2 * ((Finset.univ.erase e0).filter + (fun e => phi e = some c)).card + + 2 * ((Finset.univ.erase e0).filter (fun e => ∃ d ∈ + Finset.univ.erase c, phi e = some d)).card = + (k - 1) * (U.card - 1) + (U.card - 1) := by + simpa [Nat.mul_add] using hsumcard + omega + exact hclass' + exact @helper_continuation_315 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@hp) (@U) (@hElig) (@endpoint_card) (@hUall) (@hclass) +private theorem helper_matching_card_458.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ), + ( + ∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ)) → + ∀ (qphi : PartialEdgeColoring E k), IsProperEdgeColoring G qphi → + ∀ (W : Finset V), EligibleOddSet W → + ∀ (c : Fin k), (2 : ℕ) * ({e ∈ InternalEdges G W | qphi e = some c} : Finset E).card ≤ W.card + - (1 : ℕ) := by + classical + intro V E _ _ G k endpoint_card qphi hq W hW c + let edges := (InternalEdges G W).filter fun e => qphi e = some c + have disjoint_endpoints : ∀ ⦃e⦄, e ∈ edges → ∀ ⦃f⦄, f ∈ edges → + e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + intro e hee f hef hne + rw [Finset.disjoint_left] + intro v hev hvf + have hce := (Finset.mem_filter.mp hee).2 + have hcf := (Finset.mem_filter.mp hef).2 + have hadj : AdjacentEdges G e f := + ⟨v, (Sym2.mem_toFinset.mp hev), (Sym2.mem_toFinset.mp hvf)⟩ + have hbad := hq hne hadj hce + exact hbad hcf + have union_card_for : ∀ s : Finset E, s ⊆ edges → + (s.biUnion fun e => (G.ends e).toFinset).card = 2 * s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset + (s.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + have hde := disjoint_endpoints (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro h + exact hes (by simpa [h] using hf)) + exact (Finset.disjoint_left.mp hde) hev hvf + rw [Finset.card_union_of_disjoint hd, endpoint_card] + calc + 2 + (s.biUnion fun e => (G.ends e).toFinset).card = 2 + 2 * s.card := by + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + _ = 2 * (insert e s).card := by + rw [Finset.card_insert_of_notMem hes] + omega + have union_card := union_card_for edges (by intro e hee; exact hee) + have union_subset : edges.biUnion (fun e => (G.ends e).toFinset) ⊆ W := by + intro v hv + obtain ⟨e, hee, hev⟩ := Finset.mem_biUnion.mp hv + have heI := (Finset.mem_filter.mp hee).1 + have heI' : ∀ z, Incident G z e → z ∈ W := by + simpa [InternalEdges] using heI + exact heI' v (Sym2.mem_toFinset.mp hev) + have hcard : 2 * edges.card ≤ W.card := by + rw [← union_card] + exact Finset.card_le_card union_subset + have hstrict : 2 * edges.card < W.card := by + apply Nat.lt_of_le_of_ne hcard + intro heq + apply hW.2.not_two_dvd_nat + refine ⟨edges.card, ?_⟩ + omega + dsimp [edges] at hstrict ⊢ + omega + +private theorem helper_total_card_517.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ), + Elementary G → + ∀ (U : Finset V), EligibleOddSet U → ( + ∀ (qphi : PartialEdgeColoring E k), IsProperEdgeColoring G qphi → + ∀ (W : Finset V), EligibleOddSet W → + ∀ (c : Fin k), (2 : ℕ) * ({e ∈ InternalEdges G W | qphi e = some c} : Finset E).card ≤ W.card + - (1 : ℕ)) → + ∀ S ⊆ InternalEdges G U, + ∀ (qphi : PartialEdgeColoring E k), IsProperEdgeColoring G qphi → ( + ∀ e ∈ S, + ∃ (c : Fin k), qphi e = some c) → (2 : ℕ) * S.card ≤ k * (U.card - (1 : ℕ)) := by + classical + intro V E _ _ G k he U hElig matching_card S hS qphi hq hfullU + let colored := fun s : Finset (Fin k) => + S.filter (fun e => ∃ c ∈ s, qphi e = some c) + have recurrence : ∀ s : Finset (Fin k), + 2 * (colored s).card ≤ s.card * (U.card - 1) := by + intro s + induction s using Finset.induction_on with + | empty => simp [colored] + | @insert c s hcs ih => + let old := colored s + let fresh := S.filter (fun e => qphi e = some c) + have split : colored (insert c s) = old ∪ fresh := by + ext e + simp only [colored, old, fresh, Finset.mem_union, Finset.mem_filter, + Finset.mem_insert] + aesop + have disj : Disjoint old fresh := by + rw [Finset.disjoint_left] + intro e hee hef + have hs' := (Finset.mem_filter.mp hee).2 + have hc' := (Finset.mem_filter.mp hef).2 + obtain ⟨d, hd, hde⟩ := hs' + have hsame : d = c := by + have : some d = some c := hde.symm.trans hc' + simpa using this + exact hcs (hsame ▸ hd) + rw [split, Finset.card_union_of_disjoint disj] + have hm0 := matching_card qphi hq U hElig c + have hsubfresh : fresh ⊆ + (InternalEdges G U).filter (fun e => qphi e = some c) := by + intro e hee + have hee' : e ∈ S ∧ qphi e = some c := by simpa [fresh] using hee + exact Finset.mem_filter.mpr ⟨hS hee'.1, hee'.2⟩ + have hm : 2 * fresh.card ≤ U.card - 1 := by + have hh := Finset.card_le_card hsubfresh + omega + dsimp [old, fresh] at ih ⊢ + calc + 2 * ((colored s).card + fresh.card) = + 2 * (colored s).card + 2 * fresh.card := by omega + _ ≤ s.card * (U.card - 1) + (U.card - 1) := + Nat.add_le_add ih hm + _ = (insert c s).card * (U.card - 1) := by + rw [Finset.card_insert_of_notMem hcs] + simp [Nat.add_mul, Nat.add_comm] + have hall : colored (Finset.univ : Finset (Fin k)) = S := by + ext e + simp only [colored, Finset.mem_filter] + constructor + · rintro ⟨he, h⟩ + exact he + · intro hee + obtain ⟨c, hc⟩ := hfullU e hee + exact ⟨hee, ⟨c, Finset.mem_univ c, hc⟩⟩ + rw [← hall] + simpa using (recurrence (Finset.univ : Finset (Fin k))) + +private theorem helper_edge_internal_577.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ), Critical G → ChromaticIndex G = k + (1 : ℕ) → Elementary + G → (↑k : ℚ) < Density G → + ∀ (U : Finset V), DensityValue G U = Density G → (↑k : ℚ) < DensityValue G U → EligibleOddSet + U → ( + ∀ S ⊆ InternalEdges G U, + ∀ (qphi : PartialEdgeColoring E k), IsProperEdgeColoring G qphi → ( + ∀ e ∈ S, + ∃ (c : Fin k), qphi e = some c) → (2 : ℕ) * S.card ≤ k * (U.card - (1 : ℕ))) → + ∀ (f : E), f ∈ InternalEdges G U := by + classical + intro V E _ _ _ G k hcritical hindex he hdensity U hEq hvalue hElig total_card f + by_contra hf + have hdf := hcritical f + have hlf : ChromaticIndex (DeleteEdge G f) ≤ k := by + have ht : ChromaticIndex (DeleteEdge G f) < k + 1 := by + simpa [hindex] using hdf + omega + obtain ⟨psi, hpp, hfull⟩ := (ChromaticIndexSpec (DeleteEdge G f)).1 + let qphi : PartialEdgeColoring E k := fun e => + if he : e = f then none else + some (Fin.castLE hlf (Classical.choose (hfull ⟨e, by simp [he]⟩))) + have hq : IsProperEdgeColoring G qphi := by + intro e g c heg hadj hce + by_cases he : e = f + · simp [qphi, he] at hce + · by_cases hg : g = f + · simp [qphi, hg] + · have hce' : Fin.castLE hlf (Classical.choose (hfull ⟨e, by simp [he]⟩)) = c := by + have hc := Classical.choose_spec (hfull ⟨e, by simp [he]⟩) + exact Option.some.inj (show + some (Fin.castLE hlf (Classical.choose (hfull ⟨e, by simp [he]⟩))) = some c by + simpa [qphi, he] using hce) + have hpg := hpp (show (⟨e, by simp [he]⟩ : {e // e ∈ Finset.univ.erase f}) ≠ + ⟨g, by simp [hg]⟩ by simpa using heg) + (by simpa [AdjacentEdges, Incident, DeleteEdge, RestrictEdges] using hadj) + (by simpa using Classical.choose_spec (hfull ⟨e, by simp [he]⟩)) + intro hbad + apply hpg + have hbad' := Option.some.inj (show + some (Fin.castLE hlf (Classical.choose (hfull ⟨g, by simp [hg]⟩))) = some c by + simpa [qphi, hg] using hbad) + have hsame : Classical.choose (hfull ⟨g, by simp [hg]⟩) = + Classical.choose (hfull ⟨e, by simp [he]⟩) := by + apply Fin.ext + exact (congrArg Fin.val hbad').trans (congrArg Fin.val hce').symm + rw [← hsame] + exact Classical.choose_spec (hfull ⟨g, by simp [hg]⟩) + have hfullU : ∀ e, e ∈ InternalEdges G U → ∃ c, qphi e = some c := by + intro e he + have hne : e ≠ f := by + intro hef + apply hf + simpa [hef] using he + exact ⟨Fin.castLE hlf (Classical.choose (hfull ⟨e, by simp [hne]⟩)), by + simp [qphi, hne]⟩ + have hb := total_card (InternalEdges G U) (by intro e he; exact he) qphi hq hfullU + have hden : DensityValue G U ≤ k := by + change (2 * (InternalEdges G U).card : ℚ) / + ((U.card : ℚ) - 1) ≤ k + have hn : (0 : ℚ) < (U.card : ℚ) - 1 := by + have hU3 : 3 ≤ U.card := hElig.1 + exact sub_pos.mpr (by exact_mod_cast (show 1 < U.card by omega)) + apply (div_le_iff₀ hn).2 + change (2 * (InternalEdges G U).card : ℚ) ≤ + (k : ℚ) * ((U.card : ℚ) - 1) + have hcast : (↑(U.card - 1) : ℚ) = (U.card : ℚ) - 1 := by + have hU3 : 3 ≤ U.card := hElig.1 + rw [Nat.cast_sub (by omega)] + norm_num + rw [← hcast] + exact_mod_cast hb + have : (k : ℚ) < k := by exact lt_of_lt_of_le hvalue (by simpa using hden) + linarith + +private theorem helper_elem_to_p_142.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ), Critical G → ChromaticIndex G = k + (1 : ℕ) → + MaximumDegree G + (1 : ℕ) ≤ k → ( + ∀ (v : V), + ∃ (e : E), Incident G v e) → + let P : Prop := + ∀ (e0 : E) (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → IsOneEdgeUncolored + phi e0 → ColoredVertexSetElementary G phi Finset.univ; Elementary G → P := by + classical + intro V E _ _ _ G k hcritical hindex hdegree hnoisolated P he e0 phi hp ho + have hdensity : (k : ℚ) < Density G := by + have hc : k < DensityCeil G := by + calc + k < k + 1 := Nat.lt_succ_self k + _ = ChromaticIndex G := hindex.symm + _ = DensityCeil G := he + exact Nat.lt_ceil.mp hc + have hpos : 0 < Density G := by + have hk : 0 < k := by omega + exact lt_trans (by exact_mod_cast hk) hdensity + have hmem : Density G ∈ insert 0 + ((Finset.univ.powerset.filter (fun U : Finset V => EligibleOddSet U)).image + (DensityValue G)) := by + unfold Density + exact Finset.max'_mem _ _ + simp only [Finset.mem_insert, Finset.mem_image] at hmem + rcases hmem with hzero | ⟨U, hU, hEq⟩ + · linarith + have hvalue : (k : ℚ) < DensityValue G U := by + rw [hEq] + exact hdensity + have hElig : EligibleOddSet U := (Finset.mem_filter.mp hU).2 + have endpoint_card : ∀ e : E, (G.ends e).toFinset.card = 2 := by + intro e + apply Sym2.card_toFinset_of_not_isDiag + intro hd + exact G.loopless e ((G.ends e).diagElem hd) (Sym2.diag_diagElem hd).symm + have matching_card := @helper_matching_card_458 (@V) (@E) inferInstance inferInstance + (@G) (@k) (@endpoint_card) + have total_card := @helper_total_card_517 (@V) (@E) inferInstance inferInstance (@G) + (@k) (@he) (@U) (@hElig) (@matching_card) + have edge_internal := @helper_edge_internal_577 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@hcritical) (@hindex) (@he) (@hdensity) (@U) (@hEq) (@hvalue) + (@hElig) (@total_card) + exact @helper_continuation_337 (@V) (@E) inferInstance inferInstance (@G) (@k) + (@hdegree) (@hnoisolated) (@he) (@e0) (@phi) (@hp) (@ho) (@U) (@hU) (@hEq) (@hvalue) + (@hElig) (@endpoint_card) (@matching_card) (@total_card) (@edge_internal) +theorem egraph2 {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (hcritical : Critical G) (hindex : ChromaticIndex G = k + 1) + (hdegree : MaximumDegree G + 1 ≤ k) + (hnoisolated : ∀ v : V, ∃ e : E, Incident G v e) : + (Elementary G ↔ + ∀ (e0 : E) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → + ColoredVertexSetElementary G phi Finset.univ) ∧ + ((∀ (e0 : E) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → + ColoredVertexSetElementary G phi Finset.univ) ↔ + ∃ (e0 : E) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi ∧ IsOneEdgeUncolored phi e0 ∧ + ColoredVertexSetElementary G phi Finset.univ) ∧ + ((∃ (e0 : E) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi ∧ IsOneEdgeUncolored phi e0 ∧ + ColoredVertexSetElementary G phi Finset.univ) ↔ + ∃ (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V), + IsProperEdgeColoring G phi ∧ IsOneEdgeUncolored phi e0 ∧ + (∀ v, v ∈ G.ends e0 → v ∈ X) ∧ + ColoredVertexSetElementary G phi X ∧ + ColoredVertexSetStronglyClosed G phi X) := by + classical + let P := ∀ (e0 : E) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → + ColoredVertexSetElementary G phi Finset.univ + let Q := ∃ (e0 : E) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi ∧ IsOneEdgeUncolored phi e0 ∧ + ColoredVertexSetElementary G phi Finset.univ + let R := ∃ (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V), + IsProperEdgeColoring G phi ∧ IsOneEdgeUncolored phi e0 ∧ + (∀ v, v ∈ G.ends e0 → v ∈ X) ∧ + ColoredVertexSetElementary G phi X ∧ + ColoredVertexSetStronglyClosed G phi X + have q_to_r : Q → R := by + rintro ⟨e0, phi, hp, ho, he⟩ + refine ⟨e0, phi, Finset.univ, hp, ho, ?_, he, ?_⟩ + · simp + · constructor + · intro f c v hf hv hfv + exfalso + simp [BoundaryEdges] at hf + · intro f g c hf hg hne hfc hgc + exfalso + simp [BoundaryEdges] at hf + have p_to_q := @helper_p_to_q_85 V E inferInstance inferInstance inferInstance G k hcritical + hindex + have elem_to_p := @helper_elem_to_p_142 V E inferInstance inferInstance inferInstance G k + hcritical hindex hdegree hnoisolated + change (Elementary G ↔ P) ∧ (P ↔ Q) ∧ (Q ↔ R) + have r_to_q : R → Q := by + rintro ⟨e0, phi, X, hp, ho, he, hs, hc⟩ + have ha := StronglyClosedWitnessElementary G k hindex hdegree e0 phi X hp ho he hs hc + exact ⟨e0, phi, hp, ho, (elem_to_p ha) e0 phi hp ho⟩ + have q_to_p : Q → P := by + rintro ⟨w, psi, hwp, hwo, hwe⟩ e0 phi hp ho + have helem : Elementary G := by + apply StronglyClosedWitnessElementary G k hindex hdegree w psi Finset.univ + hwp hwo (by simp) hwe + constructor + · intro f c v hf hv hfv + exfalso + simp [BoundaryEdges] at hf + · intro f g c hf hg hne hfc hgc + exfalso + simp [BoundaryEdges] at hf + unfold ColoredVertexSetElementary + intro u hu v hv hne + exact elem_to_p helem e0 phi hp ho hu hv hne + have p_to_elem : P → Elementary G := by + intro h + rcases p_to_q h with ⟨w, psi, hwp, hwo, hwe⟩ + exact StronglyClosedWitnessElementary G k hindex hdegree w psi Finset.univ + hwp hwo (by simp) hwe (by + constructor + · intro f c v hf hv hfv + exfalso + simp [BoundaryEdges] at hf + · intro f g c hf hg hne hfc hgc + exfalso + simp [BoundaryEdges] at hf) + exact ⟨⟨elem_to_p, p_to_elem⟩, + ⟨p_to_q, q_to_p⟩, ⟨q_to_r, r_to_q⟩⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/CurrentElementaryOrGoodHierarchyConstructionLarge.lean b/LeanPool/GoldbergSeymour/CurrentElementaryOrGoodHierarchyConstructionLarge.lean new file mode 100644 index 0000000000..694c99d9d3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/CurrentElementaryOrGoodHierarchyConstructionLarge.lean @@ -0,0 +1,523 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AlgorithmFiveSixFixedRootRefresh + +public import LeanPool.GoldbergSeymour.FiniteStrictGrowthReachesTerminal + +public import LeanPool.GoldbergSeymour.ParallelSpecialClosurePreparation + +public import LeanPool.GoldbergSeymour.TashkinovClosureOfRouteAndAllMissingClosed + +/-! +# Current Elementary Or Good Hierarchy Construction Large + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_terminalFacts_87.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + IsProperEdgeColoring G generating ∧ + IsOneEdgeUncolored generating e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett terminal + have cert := ett.series.certified terminal + generalize ht : terminal = z at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + have hz : terminal = 0 := by simp [ht] + have : False := by + have hv := congrArg Fin.val hz + simp [terminal] at hv + have hp := ett.roundsPositive + omega + exact this.elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i.succ = terminal := by simp [ht] + have hg : generating = choice.selected := by + calc + generating = ett.series.data.coloring terminal := ett.generatingColoring + _ = choice.selected := by rw [← currentColoring, hi] + rw [hg] + exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i.succ = terminal := by simp [ht] + have hg : generating = ett.series.data.coloring terminal := ett.generatingColoring + rw [hg, ← hi] + exact ⟨currentProper, currentOneUncolored⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i.succ = terminal := by simp [ht] + have hg : generating = ett.series.data.coloring i.castSucc := by + calc + generating = ett.series.data.coloring terminal := ett.generatingColoring + _ = ett.series.data.coloring i.succ := by rw [hi] + _ = ett.series.data.coloring i.castSucc := currentColoring + rw [hg] + exact ⟨previousProper, previousOneUncolored⟩ + +private theorem helper_branch_193.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → TechnicalInductionContext G k e0 ett.rounds + → MaximumDegree G + (1 : ℕ) ≤ k → (11 : ℕ) ≤ TashkinovOrder G → + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree terminal.castSucc; + let _ : TreeSequence G e0 := ett.series.data.tree terminal.succ; (2 : ℕ) * ett.rounds + (11 : + ℕ) ≤ (TreeMissingColors generating Tn).card → + let base : HierarchyBase ett generating := Classical.choice (HierarchyBaseExists ett); ( + ∀ {A B C : TreeSequence G e0}, TashkinovAugmentationSequence generating A B → + TashkinovAugmentationSequence generating B C → TashkinovAugmentationSequence generating A + C) → + let _ : TreeSequence G e0 → Finset V → Prop := fun (J : TreeSequence G e0) (X : Finset V) => + ∃ (U : TreeSequence G e0), TreeSequenceVertexSet U = X ∧ + ∃ (corrU : CorrespondingExtendedTashkinovTree G k e0 ett generating U), MaximumProperty + corrU.replacementETT ∧ + ∃ (baseU : HierarchyBase corrU.replacementETT generating), baseU.core = base.core ∧ + baseU.closure = base.closure ∧ (↑baseU.supportPosition : ℕ) = (↑base.supportPosition : ℕ) + ∧ + ∃ (H : TashkinovHierarchy corrU.replacementETT baseU) (good : GoodHierarchy H), + TreeColorSetMinusClosed G generating U ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount))) ∧ TashkinovAugmentationSequence generating J U ∧ + (ett.series.data.kind terminal = some TashkinovExtensionKind.PE → base.core.length < + U.length) ∧ (ett.series.data.kind terminal ≠ some TashkinovExtensionKind.PE → Tn.length < + U.length); + let _ : Finset V → Prop := fun (X : Finset V) => + ∃ (U : TreeSequence G e0), TreeSequenceVertexSet U = X ∧ TreeColorSetClosed G generating U + (TreeMissingColors generating U); ett.series.data.kind terminal = some + TashkinovExtensionKind.PE → ColoredVertexSetElementary G generating (TreeSequenceVertexSet + T) ∨ + ∃ (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett generating + U), MaximumProperty corrU.replacementETT ∧ + ∃ (baseU : HierarchyBase corrU.replacementETT generating) (H : TashkinovHierarchy + corrU.replacementETT baseU) (_ : GoodHierarchy H), TreeColorSetClosed G generating U + (TreeMissingColors generating U) ∧ TreeSequenceVertexSet U = TreeSequenceVertexSet + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP ctx hdegree hlarge terminal Tn F hbound + base routeTrans State Terminal hk + have prep := ParallelSpecialClosurePreparation G k e0 input T generating ett ctx hMP + hk base hdegree (by simpa [Tn, terminal] using hbound) + rcases prep with ⟨hTNCore, hlen, hElem | package⟩ + · exact Or.inl hElem + · rcases package with ⟨U, corrU, hMPU, hroute, hinit, hlenU, baseU, hbc, hbl, hbs, H, hzero, + hstage0, + hstageU, good, hgood, hdisj, hminus, hcard, hterm⟩ + have hanchor : TashkinovAugmentationSequence generating Tn base.core := hTNCore + let grow : ∀ X, State base.core X → ¬ Terminal X → + ∃ Y, State base.core Y ∧ X ⊂ Y := by + intro X hstate hnot + rcases hstate with ⟨U0, hU0, corr, hMPc, basec, hbc', hbl', hbs', Hc, goodc, + hminusc, hroutec, hsizec⟩ + have hbase : base.core.length < U0.length := + hsizec.1 (by simpa [terminal] using hk) + have htn : Tn.length < U0.length := + lt_trans hlen hbase + have hmissing : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → + ∀ (base' : HierarchyBase current generating') (K : TashkinovHierarchy current base'), + GoodHierarchy K → 2 * current.rounds + 11 ≤ (TreeMissingColors generating' + (current.series.data.tree (Fin.last current.rounds).castSucc)).card := by + intro input' T' generating' current heq hmax base' K good' + have cctx : TechnicalInductionContext G k e0 current.rounds := + heq.symm ▸ ctx + exact TechnicalCurrentLadderMissingBoundLarge G k e0 input' T' + generating' current hmax cctx hdegree hlarge + have hnotc : ¬ TreeColorSetClosed G generating U0 + (TreeMissingColors generating U0) := by + intro hc + apply hnot + exact ⟨U0, hU0, hc⟩ + have hres := AlgorithmFiveSixFixedRootRefresh G k e0 input T generating + ett ctx hMP base hdegree hlarge hmissing U0 corr hMPc basec hbc' hbl' hbs' + Hc goodc hminusc hnotc base.core + (Or.inl ⟨hk, rfl, hanchor⟩) + (by + constructor + · exact fun _ => hbase + · intro h + have hn : ett.series.data.kind terminal ≠ some TashkinovExtensionKind.PE := by + simpa using h + exact (hn hk).elim) hroutec + rcases hres with + ⟨a,b,c,d,e,g,f,W,ha,hb,hc,hd,he,hf,hg,hh,hi,hj,hk',hl,hm,hn,ho,hp,hq,hr,hs,ht,hu,pack⟩ + rcases pack with ⟨corrW,hMPW,hrouteW,baseW,hbcW,hblW,hbsW,HW,hcountW,rW⟩ + rcases rW with ⟨r1,r2,r3,r4,r5,r6,r7,r8,goodW,s1,s2,s3,nested⟩ + rcases nested with ⟨V',corrV,hMPV,hlenV,hrouteV,baseV,hbcV,hblV,hbsV,KV,hcountV,rV⟩ + rcases rV with ⟨v1,v2,v3,v4,v5,v6,v7,goodV,v8,v9,v10,hminusV⟩ + refine ⟨TreeSequenceVertexSet s3, ?_, ?_⟩ + · exact ⟨s3, rfl, V', corrV, hrouteV, baseV, hbcV, hblV, hbsV, + goodV, hminusV, hlenV, ⟨fun _ => lt_trans hbase hMPV, + fun _ => lt_trans htn hMPV⟩⟩ + · have hs : TreeSequenceVertexSet U0 ⊂ TreeSequenceVertexSet s3 := + TreeSequenceInitialSegmentVertexSetStrict + (by + have hz := hbsV.nested (Fin.last hbsV.dividerCount) + have hl : hbsV.stage (Fin.last hbsV.dividerCount).castSucc = U0 := v1 + have hr : hbsV.stage (Fin.last hbsV.dividerCount).succ = s3 := v3 + rw [hl, hr] at hz + exact hz) hMPV + simpa [hU0] using hs + have hinitState : State base.core (TreeSequenceVertexSet U) := by + exact ⟨U, rfl, corrU, hMPU, baseU, hbc, hbl, hbs, H, good, + hterm, hroute, ⟨fun _ => hlenU, + fun _ => lt_trans hlen hlenU⟩⟩ + have hterm := FiniteStrictGrowthReachesTerminal + (State base.core) Terminal grow hinitState + rcases hterm with ⟨X, hstateX, hterminalX⟩ + rcases hterminalX with ⟨UF, hXF, hclosedF⟩ + rcases hstateX with ⟨UX, hUX, corrX, hMPX, baseX, hbcX, hblX, hbsX, HX, goodX, + hminusX, hrouteX, hsizeX⟩ + have hsame : TreeSequenceVertexSet UF = TreeSequenceVertexSet UX := + hXF.trans hUX.symm + have hclosedUX : TreeColorSetClosed G generating UX + (TreeMissingColors generating UX) := by + simpa [TreeColorSetClosed, TreeMissingColors, hXF, hUX] using hclosedF + refine Or.inr ⟨UX, corrX, hMPX, baseX, HX, goodX, hclosedUX, ?_⟩ + have hfinalPE : TashkinovClosure generating Tn F := by + have cert := ett.series.certified terminal + generalize ht : terminal = z at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + have hz : terminal = 0 := by simp [ht] + have hv := congrArg Fin.val hz + simp [terminal] at hv + have hp := ett.roundsPositive + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i.succ = terminal := by simp [ht] + have hk' := hk + rw [← hi, currentKind] at hk' + simp at hk' + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i.succ = terminal := by simp [ht] + have heq : generating = ett.series.data.coloring i.succ := by + calc + generating = ett.series.data.coloring terminal := ett.generatingColoring + _ = ett.series.data.coloring i.succ := by rw [hi] + simpa [Tn, F, heq, hi] using closedExtension + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i.succ = terminal := by simp [ht] + have hk' := hk + rw [← hi, currentKind] at hk' + simp at hk' + have hvertex : TreeSequenceVertexSet UX = TreeSequenceVertexSet F := by + have hcu : TashkinovClosure generating Tn UX := + TashkinovClosureOfRouteAndAllMissingClosed generating Tn UX + (routeTrans hTNCore hrouteX) hclosedUX + exact TashkinovClosureVertexSetUnique generating Tn UX F + hcu hfinalPE + exact hvertex + +private theorem helper_branch_322.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → TechnicalInductionContext G k e0 ett.rounds + → MaximumDegree G + (1 : ℕ) ≤ k → (11 : ℕ) ≤ TashkinovOrder G → + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree terminal.castSucc; + let _ : TreeSequence G e0 := ett.series.data.tree terminal.succ; ModColoring ett generating → + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors generating Tn).card → + let base : HierarchyBase ett generating := Classical.choice (HierarchyBaseExists ett); + (ett.series.data.kind terminal = some TashkinovExtensionKind.PE → Tn.length < + base.core.length) → + let _ : TreeSequence G e0 → Finset V → Prop := fun (J : TreeSequence G e0) (X : Finset V) => + ∃ (U : TreeSequence G e0), TreeSequenceVertexSet U = X ∧ + ∃ (corrU : CorrespondingExtendedTashkinovTree G k e0 ett generating U), MaximumProperty + corrU.replacementETT ∧ + ∃ (baseU : HierarchyBase corrU.replacementETT generating), baseU.core = base.core ∧ + baseU.closure = base.closure ∧ (↑baseU.supportPosition : ℕ) = (↑base.supportPosition : ℕ) + ∧ + ∃ (H : TashkinovHierarchy corrU.replacementETT baseU) (good : GoodHierarchy H), + TreeColorSetMinusClosed G generating U ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount))) ∧ TashkinovAugmentationSequence generating J U ∧ + (ett.series.data.kind terminal = some TashkinovExtensionKind.PE → base.core.length < + U.length) ∧ (ett.series.data.kind terminal ≠ some TashkinovExtensionKind.PE → Tn.length < + U.length); + let _ : Finset V → Prop := fun (X : Finset V) => + ∃ (U : TreeSequence G e0), TreeSequenceVertexSet U = X ∧ TreeColorSetClosed G generating U + (TreeMissingColors generating U); ¬ett.series.data.kind terminal = some + TashkinovExtensionKind.PE → ColoredVertexSetElementary G generating (TreeSequenceVertexSet + T) ∨ + ∃ (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett generating + U), MaximumProperty corrU.replacementETT ∧ + ∃ (baseU : HierarchyBase corrU.replacementETT generating) (H : TashkinovHierarchy + corrU.replacementETT baseU) (_ : GoodHierarchy H), TreeColorSetClosed G generating U + (TreeMissingColors generating U) ∧ TreeSequenceVertexSet U = TreeSequenceVertexSet + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP ctx hdegree hlarge terminal Tn F hmod + hbound base hstrict State Terminal hk + obtain ⟨J, U, corrU, hanch, hroute, hinit, hstrictU, hstrictN, hMPU, + baseU, hrest⟩ := (AlgorithmFiveFiveBaseStage G k e0 input T generating ett hMP hmod base + (fun h => hstrict h) (fun h => by + exfalso + apply hk + simpa [terminal] using h) hbound (by + intro h + exfalso + apply hk + simpa [terminal] using h)) + rcases hrest with ⟨hbc,hbl,hbs,H,hrest⟩ + rcases hrest with ⟨hzero,hstage0,hstageU,hrest⟩ + rcases hrest with ⟨good,⟨⟨hgood,hdisj,hpe⟩,hterm⟩⟩ + have hanch2 : + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ f : E, ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f J := by + rcases hanch with hbad | hgood + · exfalso + apply hk + simpa [terminal] using hbad.1 + · exact hgood + let grow : ∀ (X : Finset V), State J X → ¬ Terminal X → + ∃ (Y : Finset V), State J Y ∧ X ⊂ Y := by + intro X hstate hnot + rcases hstate with ⟨U0,hU0,corr,hMPc,basec,hbc',hbl',hbs',Hc,goodc,hminusc,hroutec,hsizec⟩ + have htn : Tn.length < U0.length := + hsizec.2 (by simpa [terminal] using hk) + have hnotc : ¬ TreeColorSetClosed G generating U0 + (TreeMissingColors generating U0) := by + intro hc + apply hnot + exact ⟨U0,hU0,hc⟩ + have hmissing : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → + ∀ (base' : HierarchyBase current generating') (K : TashkinovHierarchy current base'), + GoodHierarchy K → 2 * current.rounds + 11 ≤ (TreeMissingColors generating' + (current.series.data.tree (Fin.last current.rounds).castSucc)).card := by + intro input' T' generating' current heq hmax base' K good' + exact TechnicalCurrentLadderMissingBoundLarge G k e0 input' T' generating' + current hmax (heq.symm ▸ ctx) hdegree hlarge + have hres := AlgorithmFiveSixFixedRootRefresh G k e0 input T generating ett ctx + hMP base hdegree hlarge hmissing U0 corr hMPc basec hbc' hbl' hbs' Hc goodc + hminusc hnotc J (Or.inr hanch2) + ⟨(fun h => False.elim (hk (by simpa [terminal] using h))), fun _ => htn⟩ hroutec + rcases hres with + ⟨a,b,c,d,e,g,f,W,ha,hb,hc,hd,he,hf,hg,hh,hi,hj,hk',hl,hm,hn,ho,hp,hq,hr,hs,ht,hu,pack⟩ + rcases pack with ⟨corrW,hMPW,hrouteW,baseW,hbcW,hblW,hbsW,HW,hcountW,rW⟩ + rcases rW with ⟨r1,r2,r3,r4,r5,r6,r7,r8,goodW,s1,s2,s3,nested⟩ + rcases nested with ⟨V',corrV,hMPV,hlenV,hrouteV,baseV,hbcV,hblV,hbsV,KV,hcountV,rV⟩ + rcases rV with ⟨v1,v2,v3,v4,v5,v6,v7,goodV,v8,v9,v10,hminusV⟩ + refine ⟨TreeSequenceVertexSet s3, ?_, ?_⟩ + · exact ⟨s3,rfl,V',corrV,hrouteV,baseV,hbcV,hblV,hbsV,goodV,hminusV, + hlenV,⟨fun h => False.elim (hk (by simpa [terminal] using h)), + fun _ => lt_trans htn hMPV⟩⟩ + · have hs : TreeSequenceVertexSet U0 ⊂ TreeSequenceVertexSet s3 := + TreeSequenceInitialSegmentVertexSetStrict + (by + have hz := hbsV.nested (Fin.last hbsV.dividerCount) + have hl : hbsV.stage (Fin.last hbsV.dividerCount).castSucc = U0 := v1 + have hr : hbsV.stage (Fin.last hbsV.dividerCount).succ = s3 := v3 + rw [hl, hr] at hz + exact hz) hMPV + simpa [hU0] using hs + have hinitState : State J (TreeSequenceVertexSet U) := + ⟨U,rfl,corrU,hMPU,baseU,hbc,hbl,hbs,H,good,hterm,hroute, + ⟨fun h => False.elim (hk (by simpa [terminal] using h)), + fun _ => hstrictN (by simpa [terminal] using hk)⟩⟩ + rcases FiniteStrictGrowthReachesTerminal (State J) Terminal grow hinitState with + ⟨X,hstateX,hterminalX⟩ + rcases hterminalX with ⟨UF,hXF,hclosedF⟩ + rcases hstateX with ⟨UX,hUX,corrX,hMPX,baseX,hbcX,hblX,hbsX,HX,goodX,hminusX,hrouteX,hsizeX⟩ + have hclosedUX : TreeColorSetClosed G generating UX + (TreeMissingColors generating UX) := by + simpa [TreeColorSetClosed,TreeMissingColors,hXF,hUX] using hclosedF + refine Or.inr ⟨UX,corrX,hMPX,baseX,HX,goodX,hclosedUX,?_⟩ + have hfinalJ : TashkinovClosure generating J F := by + have cert := ett.series.certified terminal + generalize ht : terminal = z at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + have hz : terminal = 0 := by simp [ht] + have hv := congrArg Fin.val hz + simp [terminal] at hv + have hp := ett.roundsPositive + omega + | SE i pp po pc pn nr choice sa cc cs ce ck cv co cd cg ad ae closed ordered strict => + have hi : i.succ = terminal := by simp [ht] + obtain ⟨f,hf,hfad⟩ := hanch2.2 + have he : f = choice.edge := by + apply Finset.singleton_injective + calc + ({f} : Finset E) = ett.series.data.connectingEdges (Fin.last ett.rounds) := hf.symm + _ = ett.series.data.connectingEdges terminal := by rfl + _ = ett.series.data.connectingEdges i.succ := by rw [hi] + _ = {choice.edge} := ce + have hj : TreeSequenceAdjoinEdge Tn choice.edge J := by + simpa [Tn,hi,he] using hfad + have hae : TreeSequenceAdjoinEdge Tn choice.edge ad := by + simpa [Tn,hi] using ae + have hJ : J = ad := TreeSequenceAdjoinEdgeUnique Tn choice.edge J ad hj hae + rw [ett.generatingColoring] + simpa [hJ, F, hi] using closed + | PE i pp po pc pn nr choice sa gamma gr ss sp so sr ew cc cp co cs ce ck cv coo cd cg closed + ordered strict => + exact (hk (by simpa [ht] using ck)).elim + | RE i pp po pc pn av cc cs ce ck cv coo cd cg ad ae closed ordered strict => + have hi : i.succ = terminal := by simp [ht] + obtain ⟨f,hf,hfad⟩ := hanch2.2 + have he : f = av.edge := by + apply Finset.singleton_injective + calc + ({f} : Finset E) = ett.series.data.connectingEdges (Fin.last ett.rounds) := hf.symm + _ = ett.series.data.connectingEdges terminal := by rfl + _ = ett.series.data.connectingEdges i.succ := by rw [hi] + _ = {av.edge} := ce + have hj : TreeSequenceAdjoinEdge Tn av.edge J := by + simpa [Tn,hi,he] using hfad + have hae : TreeSequenceAdjoinEdge Tn av.edge ad := by + simpa [Tn,hi] using ae + have hJ : J = ad := TreeSequenceAdjoinEdgeUnique Tn av.edge J ad hj hae + rw [ett.generatingColoring] + simpa [hJ, F, hi] using closed + have hvertex := TashkinovClosureVertexSetUnique generating J UX F + (TashkinovClosureOfRouteAndAllMissingClosed generating J UX hrouteX hclosedUX) + hfinalJ + exact hvertex + +theorem CurrentElementaryOrGoodHierarchyConstructionLarge + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (ctx : TechnicalInductionContext G k e0 ett.rounds) + (hdegree : MaximumDegree G + 1 <= k) + (hlarge : 11 <= TashkinovOrder G) : + ColoredVertexSetElementary G generating (TreeSequenceVertexSet T) \/ + exists (U : TreeSequence G e0) + (corrU : CorrespondingExtendedTashkinovTree + G k e0 ett generating U), + MaximumProperty corrU.replacementETT /\ + exists baseU : HierarchyBase corrU.replacementETT generating, + exists H : TashkinovHierarchy corrU.replacementETT baseU, + exists _ : GoodHierarchy H, + TreeColorSetClosed G generating U + (TreeMissingColors generating U) /\ + TreeSequenceVertexSet U = + TreeSequenceVertexSet + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + classical + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree terminal.castSucc + let F : TreeSequence G e0 := ett.series.data.tree terminal.succ + have terminalFacts := + @helper_terminalFacts_87 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett + have stable : StableColoring Tn + (TashkinovStoredColors ett.series.data terminal) generating generating := by + unfold StableColoring + exact ⟨by intro f hf h; rfl, by intro v hv; rfl⟩ + have hmod : ModColoring ett generating := by + apply ctx.currentSix ett rfl hMP + · exact terminalFacts.1 + · exact terminalFacts.2 + · simpa only [ett.generatingColoring] using + (sc2 G e0 Tn + (TashkinovStoredColors ett.series.data terminal)).refl + ⟨generating, terminalFacts⟩ + have hbound : 2 * ett.rounds + 11 ≤ (TreeMissingColors generating Tn).card := by + simpa [terminal, Tn] using + (TechnicalCurrentLadderMissingBoundLarge G k e0 input T generating ett + hMP ctx hdegree hlarge) + let base : HierarchyBase ett generating := Classical.choice (HierarchyBaseExists ett) + have hstrict : + ett.series.data.kind terminal = some TashkinovExtensionKind.PE → + Tn.length < base.core.length := by + intro hk + exact (ParallelCoreAugmentationStrict ett base hk).2 + have routeTrans {A B C : TreeSequence G e0} + (hAB : TashkinovAugmentationSequence generating A B) + (hBC : TashkinovAugmentationSequence generating B C) : + TashkinovAugmentationSequence generating A C := by + exact Relation.ReflTransGen.trans hAB hBC + let State (J : TreeSequence G e0) (X : Finset V) : Prop := + ∃ U : TreeSequence G e0, + TreeSequenceVertexSet U = X ∧ + ∃ corrU : CorrespondingExtendedTashkinovTree G k e0 ett generating U, + MaximumProperty corrU.replacementETT ∧ + ∃ baseU : HierarchyBase corrU.replacementETT generating, + baseU.core = base.core ∧ baseU.closure = base.closure ∧ + baseU.supportPosition.val = base.supportPosition.val ∧ + ∃ H : TashkinovHierarchy corrU.replacementETT baseU, + ∃ good : GoodHierarchy H, + TreeColorSetMinusClosed G generating U + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount))) ∧ + TashkinovAugmentationSequence generating J U ∧ + (ett.series.data.kind terminal = some TashkinovExtensionKind.PE → + base.core.length < U.length) ∧ + (ett.series.data.kind terminal ≠ some TashkinovExtensionKind.PE → + Tn.length < U.length) + let Terminal (X : Finset V) : Prop := + ∃ U : TreeSequence G e0, TreeSequenceVertexSet U = X ∧ + TreeColorSetClosed G generating U (TreeMissingColors generating U) + have solve : ∀ (J : TreeSequence G e0) (anchor : Prop) + (strict : ∀ (U : TreeSequence G e0), State J (TreeSequenceVertexSet U) → + TreeSequenceVertexSet J ⊂ TreeSequenceVertexSet U), + ∀ X, State J X → Terminal X → + Terminal X := by + intro J anchor strict X hstate hterminal + exact hterminal + by_cases hk : ett.series.data.kind terminal = some TashkinovExtensionKind.PE + · exact @helper_branch_193 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating ett hMP ctx hdegree hlarge hbound routeTrans hk + · exact @helper_branch_322 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating ett hMP ctx hdegree hlarge hmod hbound hstrict hk +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DefectiveColor.lean b/LeanPool/GoldbergSeymour/DefectiveColor.lean new file mode 100644 index 0000000000..93f454d186 --- /dev/null +++ b/LeanPool/GoldbergSeymour/DefectiveColor.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges + +/-! +# Defective Color + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A color occurring on at least two boundary edges of the vertex set. -/ +def DefectiveColor {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (X : Finset V) (alpha : Fin k) : Prop := + 2 ≤ (BoundaryColorEdges G phi X alpha).card + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DefectiveColorComponentPath.lean b/LeanPool/GoldbergSeymour/DefectiveColorComponentPath.lean new file mode 100644 index 0000000000..f9e39e35bc --- /dev/null +++ b/LeanPool/GoldbergSeymour/DefectiveColorComponentPath.lean @@ -0,0 +1,653 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# P2968_T1_Defective Color Component Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hstart_91.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (phi : + PartialEdgeColoring E k) (alpha gamma : Fin k) (u : V) (a b' : V ⊕ E) (q : + (TwoColorIncidenceGraph G phi alpha gamma).Walk a b'), q.IsPath → + {x : V ⊕ E | x ∈ q.support} = TwoColorComponent G phi alpha gamma (Sum.inl u) → Sum.inl u + ∈ q.support → + ∀ (i : ℕ), q.getVert i = Sum.inl u → i ≤ q.length → i ≤ q.length → q.getVert i = Sum.inl u → i + = (0 : ℕ) ∨ i = q.length → + ∃ (w : V ⊕ E) (r : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) w), r.IsPath ∧ + {x : V ⊕ E | x ∈ r.support} = TwoColorComponent G phi alpha gamma (Sum.inl u) := by + classical + intro V E G k phi alpha gamma u a b' q hq hqs huq i hiq hi hi_le huvert hi_end + rcases hi_end with hi0 | hil + · have hu0 : q.getVert 0 = Sum.inl u := hi0 ▸ huvert + have haeq : a = Sum.inl u := q.getVert_zero.symm.trans hu0 + subst a + exact ⟨b', q, hq, hqs⟩ + · have hb_eq : b' = Sum.inl u := by + have hh : q.getVert q.length = Sum.inl u := hil ▸ huvert + exact (q.getVert_length.symm.trans hh) + subst b' + refine ⟨a, q.reverse, hq.reverse, ?_⟩ + ext x + rw [SimpleGraph.Walk.support_reverse] + simp [hqs] + +private theorem helper_hpos_120.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k) (alpha gamma : Fin k) (u : V) (ea : E) (w : V ⊕ E) + (qnew : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) w), + let q : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) w := qnew; + {x : V ⊕ E | x ∈ q.support} = TwoColorComponent G phi alpha gamma (Sum.inl u) → + Sum.inr ea ∈ TwoColorComponent G phi alpha gamma (Sum.inl u) → + (0 : ℕ) < q.length := by + classical + intro V E G k phi alpha gamma u ea w qnew q hqs hcea + by_contra hz + have : q.length = 0 := Nat.eq_zero_of_not_pos hz + have hm : Sum.inr ea ∈ {x | x ∈ q.support} := hqs.symm ▸ hcea + change Sum.inr ea ∈ q.support at hm + obtain ⟨j, hjget, hjle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hm + have hjzero : j = 0 := Nat.eq_zero_of_le_zero (this ▸ hjle) + have heq : Sum.inr ea = Sum.inl u := by + rw [← hjget, hjzero, q.getVert_zero] + exact (Sum.inr_ne_inl heq).elim + +private theorem helper_hbne_130.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k) (alpha gamma : Fin k) (u : V) (a b'_1 : V ⊕ E) (q_1 : + (TwoColorIncidenceGraph G phi alpha gamma).Walk a b'_1), + ∀ i ≤ q_1.length, + ∀ (w : V ⊕ E) (qnew : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) w), + let b' : V ⊕ E := w; + let q : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) w := qnew; q.IsPath → (0 : + ℕ) < q.length → b' ≠ Sum.inl u := by + classical + intro V E _ _ G k phi alpha gamma u a _ _ i hi w qnew b' q hq hpos he + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + have hl : q.getVert q.length = b' := q.getVert_length + have hz : q.getVert 0 = Sum.inl u := q.getVert_zero + have hi : q.getVert 0 = q.getVert q.length := hz.trans (he ▸ hl).symm + have hh := hq.getVert_injOn (show 0 ≤ q.length by omega) + (show q.length ≤ q.length by rfl) hi + omega + +private theorem helper_hend_239.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k) (alpha gamma : Fin k) (u : V) (w : V ⊕ E) (qnew : + (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) w), + let b' : V ⊕ E := w; + let q : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) w := qnew; ( + ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G phi alpha gamma).Adj b' y → y = q.getVert (q.length - + (1 : ℕ))) → (TwoColorIncidenceGraph G phi alpha gamma).Adj b' (q.getVert (q.length - (1 : + ℕ))) → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k phi alpha gamma) b' + (@Fintype.ofFinite (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k phi alpha gamma) b')) (@Subtype.finite (Sum V E) + (@Finite.instSum V E (inferInstance : Finite V) (inferInstance : Finite E)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k phi alpha gamma) + b')))) = (1 : ℕ) := by + classical + intro V E _ _ G k phi alpha gamma u w qnew b' q hnotedge hlastadj + let vertexEnumeration := Fintype.ofFinite V + let edgeEnumeration := Fintype.ofFinite E + apply (@SimpleGraph.degree_eq_one_iff_existsUnique_adj _ + (TwoColorIncidenceGraph G phi alpha gamma) b' (Fintype.ofFinite _)).mpr + refine ⟨q.getVert (q.length - 1), hlastadj, ?_⟩ + intro y hy + exact hnotedge y hy + +private theorem helper_continuation_311.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k) (u : V) + (_ : u ∈ TreeSequenceVertexSet T), + let X : Finset V := TreeSequenceVertexSet T; + ∀ (_ : IsProperEdgeColoring G phi) (_ : + ∀ {x : V}, x ∈ X → x ≠ u → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k phi + alpha gamma) (@Sum.inl V E x) (@Fintype.ofFinite (@Set.Elem (Sum V E) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k phi alpha gamma) + (@Sum.inl V E x))) (@Subtype.finite (Sum V E) (@Finite.instSum V E (inferInstance : Finite + V) (inferInstance : Finite E)) (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k phi alpha gamma) (@Sum.inl V E x))))) = (2 : ℕ)) (a b'_1 + : V ⊕ E) (_ : (TwoColorIncidenceGraph G phi alpha gamma).Walk a b'_1) (_ : ℕ) (w : V ⊕ E) + (qnew : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) w) (_ : qnew.IsPath) + (_ : {x : V ⊕ E | x ∈ qnew.support} = TwoColorComponent G phi alpha gamma (Sum.inl u)), + let b' : V ⊕ E := w; + let q : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) w := qnew; + ∀ (_ : q.IsPath) (_ : {x : V ⊕ E | x ∈ q.support} = TwoColorComponent G phi alpha gamma + (Sum.inl u)) (_ : (0 : ℕ) < q.length) (_ : b' ≠ Sum.inl u) (_ : q.IsPath) (_ : q.getVert + (0 : ℕ) = Sum.inl u) (_ : q.getVert q.length = b') (_ : + ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G phi alpha gamma).Adj b' y → y = q.getVert (q.length - + (1 : ℕ))), + ∃ (z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p := by + classical + intro V E _ _ G k e0 phi T alpha gamma u hu X hproper hdeg_X a _ _ i w qnew hqnew hqsnew b' q hq + hqs hpos hbne huq' hfirst hlast hnotedge + let vertexEnumeration := Fintype.ofFinite V + let edgeEnumeration := Fintype.ofFinite E + have hlastadj : (TwoColorIncidenceGraph G phi alpha gamma).Adj + b' (q.getVert (q.length - 1)) := by + have hh := q.adj_getVert_succ (show q.length - 1 < q.length by omega) + rw [show q.length - 1 + 1 = q.length by omega, hlast] at hh + exact hh.symm + have hend : @SimpleGraph.degree _ (TwoColorIncidenceGraph G phi alpha gamma) + b' (Fintype.ofFinite _) = 1 := by + exact helper_hend_239 (@G) (@k) (@phi) (@alpha) (@gamma) (@u) (@w) (@qnew) (@hnotedge) + (@hlastadj) + have hbvertex : ∃ z : V, b' = Sum.inl z := by + dsimp [b'] at * + cases hw : w with + | inl z => exact ⟨z, rfl⟩ + | inr e => + have htwo := TwoColorIncidenceDegreeAtMostTwo G phi alpha gamma hproper (Sum.inr e) + have hcq : b' ∈ q.support := by + change w ∈ q.support + simpa only [hlast] using q.getVert_mem_support q.length + obtain ⟨j, hsj, hj⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hcq + have hjpos : 0 < j := by + by_contra hjz + have hjzero : j = 0 := Nat.eq_zero_of_not_pos hjz + have hh := hsj + rw [hjzero, hfirst] at hh + exact Sum.inl_ne_inr (hh.trans hw) + have hprev := q.adj_getVert_succ (show j - 1 < q.length by omega) + rw [show j - 1 + 1 = j by omega] at hprev + have hprev2 : (TwoColorIncidenceGraph G phi alpha gamma).Adj + (q.getVert (j - 1)) (Sum.inr e) := by + simpa [b', hsj, hw] using hprev + have hinc : ∃ z, Incident G z e ∧ + (phi e = some alpha ∨ phi e = some gamma) := by + cases hp : q.getVert (j - 1) with + | inl z => + have htemp := hprev2 + rw [hp] at htemp + exact ⟨z, by simpa [TwoColorIncidenceGraph] using htemp⟩ + | inr f => + have htemp := hprev2 + rw [hp] at htemp + simp [TwoColorIncidenceGraph] at htemp + obtain ⟨z₁, hz₁, hcol⟩ := hinc + let p₁ := (Quot.out (G.ends e)).1 + let p₂ := (Quot.out (G.ends e)).2 + have heends : s(p₁, p₂) = G.ends e := Quot.out_eq _ + have hp₁ : Incident G p₁ e := by + change p₁ ∈ G.ends e + rw [← heends] + simp [p₁, p₂] + have hp₂ : Incident G p₂ e := by + change p₂ ∈ G.ends e + rw [← heends] + simp [p₁, p₂] + have hpne : p₁ ≠ p₂ := by + intro he + apply G.loopless e p₁ + rw [← heends, he] + have ha₁ : (TwoColorIncidenceGraph G phi alpha gamma).Adj + (Sum.inr e) (Sum.inl p₁) := by + simpa [TwoColorIncidenceGraph] using (show + Incident G p₁ e ∧ (phi e = some alpha ∨ phi e = some gamma) from + ⟨hp₁, hcol⟩) + have ha₂ : (TwoColorIncidenceGraph G phi alpha gamma).Adj + (Sum.inr e) (Sum.inl p₂) := by + simpa [TwoColorIncidenceGraph] using (show + Incident G p₂ e ∧ (phi e = some alpha ∨ phi e = some gamma) from + ⟨hp₂, hcol⟩) + have hlow : 2 ≤ @SimpleGraph.degree _ + (TwoColorIncidenceGraph G phi alpha gamma) (Sum.inr e) (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset (Sum V E) := {Sum.inl p₁, Sum.inl p₂} + have hs : s ⊆ @SimpleGraph.neighborFinset (Sum V E) + (TwoColorIncidenceGraph G phi alpha gamma) (Sum.inr e) (Fintype.ofFinite _) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using ha₁ + · simpa [SimpleGraph.mem_neighborFinset] using ha₂ + have hsiz : 2 ≤ s.card := by simp [s, hpne] + exact hsiz.trans (Finset.card_le_card hs) + have hone : @SimpleGraph.degree _ + (TwoColorIncidenceGraph G phi alpha gamma) (Sum.inr e) (Fintype.ofFinite _) = 1 := by + subst w + exact hend + omega + obtain ⟨z, hz⟩ := hbvertex + have hzout : z ∉ X := by + intro hzX + by_cases hzu : z = u + · exact hbne (by simp [hz, hzu]) + · have := hdeg_X hzX hzu + have hone : @SimpleGraph.degree _ + (TwoColorIncidenceGraph G phi alpha gamma) (Sum.inl z) (Fintype.ofFinite _) = 1 := by + have hh := hend + rw [hz] at hh + exact hh + omega + have hzq : w = Sum.inl z := hz + subst w + exact ⟨z, q, ⟨hu, hq, hzout, by + ext x + exact Set.ext_iff.mp hqs x⟩⟩ + +private theorem helper_hqs_196.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k) (u : V) + (_ : u ∈ TreeSequenceVertexSet T), + let X : Finset V := TreeSequenceVertexSet T; + ∀ (_ : IsProperEdgeColoring G phi) (ea : E) (_ : Incident G u ea) (_ : phi ea = some alpha) (_ + : @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k phi alpha gamma) + (@Sum.inl V E u) (@Fintype.ofFinite (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V + E) (@TwoColorIncidenceGraph V E G k phi alpha gamma) (@Sum.inl V E u))) (@Subtype.finite + (Sum V E) (@Finite.instSum V E (inferInstance : Finite V) (inferInstance : Finite E)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k phi alpha gamma) + (@Sum.inl V E u))))) = (1 : ℕ)) (_ : + ∀ {x : V}, x ∈ X → x ≠ u → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k phi + alpha gamma) (@Sum.inl V E x) (@Fintype.ofFinite (@Set.Elem (Sum V E) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k phi alpha gamma) + (@Sum.inl V E x))) (@Subtype.finite (Sum V E) (@Finite.instSum V E (inferInstance : Finite + V) (inferInstance : Finite E)) (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k phi alpha gamma) (@Sum.inl V E x))))) = (2 : ℕ)) (a b'_1 + : V ⊕ E) (q_1 : (TwoColorIncidenceGraph G phi alpha gamma).Walk a b'_1) (i : ℕ) (_ : i ≤ + q_1.length) (w : V ⊕ E) (qnew : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl + u) w) (_ : qnew.IsPath) (_ : {x : V ⊕ E | x ∈ qnew.support} = TwoColorComponent G phi + alpha gamma (Sum.inl u)), + let _ : V ⊕ E := w; + let q : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) w := qnew; + ∀ (_ : q.IsPath) (_ : {x : V ⊕ E | x ∈ q.support} = TwoColorComponent G phi alpha gamma + (Sum.inl u)), + ∃ (z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p := by + classical + intro V E _ _ G k e0 phi T alpha gamma u hu X hproper ea hea hca hdeg_u hdeg_X a _ _ i hi w qnew + hqnew hqsnew b' q hq hqs + let vertexEnumeration := Fintype.ofFinite V + let edgeEnumeration := Fintype.ofFinite E + have hadj : (TwoColorIncidenceGraph G phi alpha gamma).Adj (Sum.inl u) (Sum.inr ea) := by + simpa [TwoColorIncidenceGraph] using (show + Incident G u ea ∧ (phi ea = some alpha ∨ phi ea = some gamma) from + ⟨hea, Or.inl hca⟩) + have hcea : Sum.inr ea ∈ TwoColorComponent G phi alpha gamma (Sum.inl u) := by + apply (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).2 + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).symm + have hpos : 0 < q.length := by + exact helper_hpos_120 (@G) (@k) (@phi) (@alpha) (@gamma) (@u) (@ea) (@w) (@qnew) (@hqs) (@hcea) + have hbne : b' ≠ Sum.inl u := by + exact helper_hbne_130 (@G) (@k) (@phi) (@alpha) (@gamma) (@u) (@a) _ _ (@i) (@hi) (@w) + (@qnew) (@hq) (@hpos) + have huq' : q.IsPath := hq + have hfirst : q.getVert 0 = Sum.inl u := q.getVert_zero + have hlast : q.getVert q.length = b' := q.getVert_length + have hnotedge : ∀ y, (TwoColorIncidenceGraph G phi alpha gamma).Adj b' y → + y = q.getVert (q.length - 1) := by + intro y hy + have hcb : b' ∈ TwoColorComponent G phi alpha gamma (Sum.inl u) := by + have hm : b' ∈ {x | x ∈ q.support} := by + simp [b'] + exact hqs ▸ hm + have hcy : y ∈ TwoColorComponent G phi alpha gamma (Sum.inl u) := by + have heq := (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).1 hcb + apply (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).2 + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hy).symm.trans heq + have hyset : y ∈ {x | x ∈ q.support} := hqs.symm ▸ hcy + have hyq : y ∈ q.support := hyset + obtain ⟨j, hjget, hjle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hyq + have hjq : q.getVert j = y := hjget + have hjne : j ≠ q.length := by + intro he + have : y = b' := hjq ▸ he ▸ hlast + exact (by simpa [this] using hy.ne) + have hjlt : j < q.length := Nat.lt_of_le_of_ne hjle hjne + by_cases hjend : j + 1 = q.length + · calc + y = q.getVert j := hjq.symm + _ = q.getVert (q.length - 1) := by congr 1; omega + by_cases hj0 : j = 0 + · by_cases hn1 : q.length = 1 + · have heq : j = q.length - 1 := by omega + rw [← hjq, heq, hn1] + · have hq1 : (TwoColorIncidenceGraph G phi alpha gamma).Adj + (Sum.inl u) (q.getVert 1) := by + simpa [hfirst] using q.adj_getVert_succ (show 0 < q.length by omega) + have huunique := (@SimpleGraph.degree_eq_one_iff_existsUnique_adj _ + (TwoColorIncidenceGraph G phi alpha gamma) (Sum.inl u) + (Fintype.ofFinite _)).mp hdeg_u + have hyu : (TwoColorIncidenceGraph G phi alpha gamma).Adj + (Sum.inl u) b' := by + have hh := hy.symm + rw [← hjq, hj0, hfirst] at hh + exact hh + have heq := huunique.unique hq1 hyu + have hiq1 : q.getVert 1 ≠ b' := by + intro hh + have hxx := hq.getVert_injOn (show 1 ≤ q.length by omega) + (show q.length ≤ q.length by rfl) (hh.trans hlast.symm) + omega + exact (hiq1 heq).elim + · have hjpos : 0 < j := Nat.pos_of_ne_zero hj0 + have hleft := q.adj_getVert_succ (show j - 1 < q.length by omega) + rw [show j - 1 + 1 = j by omega] at hleft + have hright := q.adj_getVert_succ hjlt + have hthree : 3 ≤ @SimpleGraph.degree _ + (TwoColorIncidenceGraph G phi alpha gamma) (q.getVert j) (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset (Sum V E) := + {b', q.getVert (j - 1), q.getVert (j + 1)} + have hs : s ⊆ @SimpleGraph.neighborFinset (Sum V E) + (TwoColorIncidenceGraph G phi alpha gamma) (q.getVert j) (Fintype.ofFinite _) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · have hh := hy.symm + rw [← hjq] at hh + simpa [SimpleGraph.mem_neighborFinset] using hh + · simpa [SimpleGraph.mem_neighborFinset] using hleft.symm + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hdistinct : s.card = 3 := by + have hbnot : b' ∉ ({q.getVert (j - 1), q.getVert (j + 1)} : Finset (Sum V E)) := by + simp only [Finset.mem_insert, Finset.mem_singleton] + intro hh + rcases hh with hh | hh + · have heq := hh.symm.trans hlast.symm + have hidx := hq.getVert_injOn (show j - 1 ≤ q.length by omega) + (show q.length ≤ q.length by rfl) heq + have hidx' : j - 1 = q.length := hidx + have hbad : q.length ≤ j := by + omega + exact (Nat.not_le_of_gt hjlt) hbad + · have heq := hh.symm.trans hlast.symm + have hidx := hq.getVert_injOn (show j + 1 ≤ q.length by omega) + (show q.length ≤ q.length by rfl) heq + have hidx' : j + 1 = q.length := hidx + exact (hjend hidx').elim + have hlr : q.getVert (j - 1) ≠ q.getVert (j + 1) := by + intro hh + have := hq.getVert_injOn (show j - 1 ≤ q.length by omega) + (show j + 1 ≤ q.length by omega) hh + omega + simp [s, hbnot, hlr] + calc + 3 = s.card := hdistinct.symm + _ ≤ _ := Finset.card_le_card hs + have hup := TwoColorIncidenceDegreeAtMostTwo G phi alpha gamma hproper (q.getVert j) + omega + rename_i previousEndpoint previousWalk + exact @helper_continuation_311 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) + (@T) (@alpha) (@gamma) (@u) (@hu) (@hproper) (@hdeg_X) (@a) (@previousEndpoint) + (@previousWalk) (@i) (@w) (@qnew) (@hqnew) (@hqsnew) (@hq) (@hqs) (@hpos) (@hbne) (@huq') + (@hfirst) (@hlast) (@hnotedge) +private theorem helper_continuation_220.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k), + ∀ u ∈ TreeSequenceVertexSet T, + let X : Finset V := TreeSequenceVertexSet T; IsProperEdgeColoring G phi → + ∀ (ea : E), Incident G u ea → phi ea = some alpha → @SimpleGraph.degree (Sum V E) + (@TwoColorIncidenceGraph V E G k phi alpha gamma) (@Sum.inl V E u) (@Fintype.ofFinite + (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k + phi alpha gamma) (@Sum.inl V E u))) (@Subtype.finite (Sum V E) (@Finite.instSum V E + (inferInstance : Finite V) (inferInstance : Finite E)) (@Membership.mem (Sum V E) (Set + (Sum V E)) (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k phi alpha gamma) (@Sum.inl V E u))))) = (1 : ℕ) → ( + ∀ {x : V}, x ∈ X → x ≠ u → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k phi + alpha gamma) (@Sum.inl V E x) (@Fintype.ofFinite (@Set.Elem (Sum V E) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k phi alpha gamma) + (@Sum.inl V E x))) (@Subtype.finite (Sum V E) (@Finite.instSum V E (inferInstance : Finite + V) (inferInstance : Finite E)) (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k phi alpha gamma) (@Sum.inl V E x))))) = (2 : ℕ)) → + ∀ (a b' : V ⊕ E) (q : (TwoColorIncidenceGraph G phi alpha gamma).Walk a b'), q.IsPath → + {x : V ⊕ E | x ∈ q.support} = TwoColorComponent G phi alpha gamma (Sum.inl u) → Sum.inl u + ∈ q.support → + ∀ (i : ℕ), q.getVert i = Sum.inl u → i ≤ q.length → i ≤ q.length → q.getVert i = Sum.inl u → i + = (0 : ℕ) ∨ i = q.length → + ∃ (z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p := by + classical + intro V E _ _ G k e0 phi T alpha gamma u hu X hproper ea hea hca hdeg_u hdeg_X a b' q hq hqs huq i + hiq hi hi_le huvert hi_end + let vertexEnumeration := Fintype.ofFinite V + let edgeEnumeration := Fintype.ofFinite E + have hstart : ∃ w, ∃ r : (TwoColorIncidenceGraph G phi alpha gamma).Walk + (Sum.inl u) w, r.IsPath ∧ {x | x ∈ r.support} = + TwoColorComponent G phi alpha gamma (Sum.inl u) := by + exact helper_hstart_91 (@G) (@k) (@phi) (@alpha) (@gamma) (@u) (@a) (@b') (@q) (@hq) (@hqs) + (@huq) (@i) (@hiq) (@hi) (@hi_le) (@huvert) (@hi_end) + obtain ⟨w, qnew, hqnew, hqsnew⟩ := hstart + let b' := w + let q := qnew + have hq : q.IsPath := hqnew + have hqs : {x | x ∈ q.support} = TwoColorComponent G phi alpha gamma (Sum.inl u) := hqsnew + have hfinal : ∃ z p, ScheideDefectiveChainPath T phi alpha gamma u z p := by + exact @helper_hqs_196 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@alpha) (@gamma) (@u) (@hu) (@hproper) (@ea) (@hea) (@hca) (@hdeg_u) + (@hdeg_X) (@a) _ _ (@i) (@hi) (@w) (@qnew) (@hqnew) (@hqsnew) (@hq) (@hqs) + exact hfinal + +theorem P2968_T1_DefectiveColorComponentPath {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) + (alpha gamma : Fin k) + (halpha : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T)) + (u : V) (hu : u ∈ TreeSequenceVertexSet T) + (hgamma : gamma ∈ MissingColors G phi u) : + ∃ (z : V) + (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk + (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p := by + classical + let X := TreeSequenceVertexSet T + have hproper : IsProperEdgeColoring G phi := hglobal.1.2.2.2.1 + have horder := ScheideGlobalMaximumOrder G k e0 phi T hglobal + have helem : ColoredVertexSetElementary G phi X := horder.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi X := horder.2.2.2.2 + have hfacts := ScheideGlobalMaximumBoundaryFacts G k e0 phi T hglobal + have hcard : 3 ≤ (BoundaryColorEdges G phi X alpha).card := + (hfacts.2.2 alpha halpha).2 + obtain ⟨b, hb⟩ := Finset.card_pos.mp (by omega : 0 < (BoundaryColorEdges G phi X alpha).card) + have hb' : b ∈ BoundaryEdges G X ∧ phi b = some alpha := by + simpa [BoundaryColorEdges] using (Finset.mem_filter.mp hb) + have halpha_present : ∀ x ∈ X, alpha ∈ PresentColors G phi x := by + intro x hx + have hn : alpha ∉ MissingColors G phi x := by + intro hm + exact (hclosed hb'.1 hx hb'.2) hm + simpa [MissingColors] using hn + have hne : alpha ≠ gamma := by + intro heq + have hp := halpha_present u hu + subst gamma + have hm : alpha ∉ PresentColors G phi u := by simpa [MissingColors] using hgamma + exact hm hp + have huniq : ∀ {v : V} {e f : E}, Incident G v e → Incident G v f → + phi e = some alpha → phi f = some alpha → e = f := by + intro v e f he hf hce hcf + by_contra hne + exact hproper hne ⟨v, he, hf⟩ hce (by simp [hcf]) + have ha_u : ∃ e, Incident G u e ∧ phi e = some alpha := by + simpa [PresentColors] using halpha_present u hu + obtain ⟨ea, hea, hca⟩ := ha_u + have hdeg_u : @SimpleGraph.degree _ (TwoColorIncidenceGraph G phi alpha gamma) + (Sum.inl u) (Fintype.ofFinite _) = 1 := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + have heq : @SimpleGraph.neighborFinset (Sum V E) + (TwoColorIncidenceGraph G phi alpha gamma) (Sum.inl u) (Fintype.ofFinite _) = + ({Sum.inr ea} : Finset (Sum V E)) := by + ext y + cases y with + | inl v => + simp only [SimpleGraph.mem_neighborFinset] + simp [TwoColorIncidenceGraph] + | inr e => + simp only [SimpleGraph.mem_neighborFinset] + constructor + · intro hy + have hy' : Incident G u e ∧ (phi e = some alpha ∨ phi e = some gamma) := by + simpa [TwoColorIncidenceGraph] using hy + rcases hy'.2 with hα | hγ + · have : e = ea := huniq hy'.1 hea hα hca + simp [this] + · exfalso + have hm : gamma ∉ PresentColors G phi u := by simpa [MissingColors] using hgamma + exact hm (by simpa [PresentColors] using ⟨e, hy'.1, hγ⟩) + · intro hy + simp only [Finset.mem_singleton] at hy + injection hy with h + subst e + simpa [TwoColorIncidenceGraph] using (show + Incident G u ea ∧ (phi ea = some alpha ∨ phi ea = some gamma) from + ⟨hea, Or.inl hca⟩) + calc + _ = ({Sum.inr ea} : Finset (Sum V E)).card := congrArg Finset.card heq + _ = 1 := by simp + have huniqColor : ∀ (c : Fin k) {v : V} {e f : E}, Incident G v e → + Incident G v f → phi e = some c → phi f = some c → e = f := by + intro c v e f he hf hce hcf + by_contra hne + exact hproper hne ⟨v, he, hf⟩ hce hcf + have hdeg_X : ∀ {x : V}, x ∈ X → x ≠ u → + @SimpleGraph.degree _ (TwoColorIncidenceGraph G phi alpha gamma) + (Sum.inl x) (Fintype.ofFinite _) = 2 := by + intro x hx hxu + have hdis := helem hu hx hxu.symm + have hgam : gamma ∈ PresentColors G phi x := by + have hng : gamma ∉ MissingColors G phi x := by + intro hmx + exact Finset.disjoint_left.1 hdis hgamma hmx + simpa [MissingColors] using hng + obtain ⟨eaX, heaX, hcaX⟩ := + (by simpa [PresentColors] using (halpha_present x hx)) + obtain ⟨eg, heg, hcg⟩ := (by simpa [PresentColors] using hgam) + have hne_edges : eaX ≠ eg := by + intro heq + have : phi eaX = some gamma := heq ▸ hcg + exact hne (Option.some.inj (hcaX.symm.trans this)) + have heq : @SimpleGraph.neighborFinset (Sum V E) + (TwoColorIncidenceGraph G phi alpha gamma) (Sum.inl x) (Fintype.ofFinite _) = + ({Sum.inr eaX, Sum.inr eg} : Finset (Sum V E)) := by + ext y + cases y with + | inl v => + simp only [SimpleGraph.mem_neighborFinset] + simp [TwoColorIncidenceGraph] + | inr e => + simp only [SimpleGraph.mem_neighborFinset] + constructor + · intro hy + have hy' : Incident G x e ∧ (phi e = some alpha ∨ phi e = some gamma) := by + simpa [TwoColorIncidenceGraph] using hy + rcases hy'.2 with hα | hγ + · have hh : e = eaX := huniqColor alpha hy'.1 heaX hα hcaX + simp [hh] + · have hh : e = eg := huniqColor gamma hy'.1 heg hγ hcg + simp [hh] + · intro hy + simp only [Finset.mem_insert, Finset.mem_singleton] at hy + rcases hy with h | h + · injection h with h + subst e + simpa [TwoColorIncidenceGraph] using + (show Incident G x eaX ∧ (phi eaX = some alpha ∨ phi eaX = some gamma) from + ⟨by exact heaX, Or.inl hcaX⟩) + · injection h with h + subst e + simpa [TwoColorIncidenceGraph] using + (show Incident G x eg ∧ (phi eg = some alpha ∨ phi eg = some gamma) from + ⟨by exact heg, Or.inr hcg⟩) + calc + _ = ({Sum.inr eaX, Sum.inr eg} : Finset (Sum V E)).card := congrArg Finset.card heq + _ = 2 := by simp [hne_edges] + obtain ⟨a, b', q, hq, hqs⟩ := + TwoColorComponentSpanningPath G phi alpha gamma hproper (Sum.inl u) + have hcu : Sum.inl u ∈ TwoColorComponent G phi alpha gamma (Sum.inl u) := by + change Sum.inl u ∈ (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk (Sum.inl u) + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr (by rfl) + have huq : Sum.inl u ∈ q.support := by + have hh : Sum.inl u ∈ {x | x ∈ q.support} := hqs.symm ▸ hcu + exact hh + obtain ⟨i, hiq, hi⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp huq + have hi_le : i ≤ q.length := hi + have huvert : q.getVert i = Sum.inl u := hiq + have hi_end : i = 0 ∨ i = q.length := by + by_contra hn + have hi0 : 0 < i := Nat.pos_of_ne_zero (fun h => hn (Or.inl h)) + have hil : i < q.length := by + exact Nat.lt_of_le_of_ne hi_le (fun h => hn (Or.inr h)) + have hleft : (TwoColorIncidenceGraph G phi alpha gamma).Adj + (Sum.inl u) (q.getVert (i - 1)) := by + rw [← huvert] + have hh := q.adj_getVert_succ (show i - 1 < q.length by omega) + rw [show i - 1 + 1 = i by omega] at hh + exact hh.symm + have hright : (TwoColorIncidenceGraph G phi alpha gamma).Adj + (Sum.inl u) (q.getVert (i + 1)) := by + rw [← huvert] + exact q.adj_getVert_succ hil + have hne_lr : q.getVert (i - 1) ≠ q.getVert (i + 1) := by + intro heq + have := hq.getVert_injOn (show i - 1 ≤ q.length by omega) + (show i + 1 ≤ q.length by omega) heq + omega + have htwo : 2 ≤ @SimpleGraph.degree _ + (TwoColorIncidenceGraph G phi alpha gamma) (Sum.inl u) (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset (Sum V E) := {q.getVert (i - 1), q.getVert (i + 1)} + have hs : s ⊆ @SimpleGraph.neighborFinset (Sum V E) + (TwoColorIncidenceGraph G phi alpha gamma) (Sum.inl u) (Fintype.ofFinite _) := by + intro y hy + simp only [s, Finset.mem_insert, Finset.mem_singleton] at hy + rcases hy with rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc : 2 ≤ s.card := by simp [s, hne_lr] + exact hc.trans (Finset.card_le_card hs) + omega + exact @helper_continuation_220 (@V) (@E) inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@alpha) (@gamma) (@u) (@hu) (@hproper) (@ea) (@hea) (@hca) (@hdeg_u) + (@hdeg_X) (@a) (@b') (@q) (@hq) (@hqs) (@huq) (@i) (@hiq) (@hi) (@hi_le) (@huvert) (@hi_end) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DefectiveColors.lean b/LeanPool/GoldbergSeymour/DefectiveColors.lean new file mode 100644 index 0000000000..bdbcb51dd9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/DefectiveColors.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.Fin + +public import LeanPool.GoldbergSeymour.DefectiveColor + +/-! +# Defective Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Colors occurring on at least two edges of the vertex-set boundary. -/ +noncomputable def DefectiveColors {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) + {k : ℕ} (phi : PartialEdgeColoring E k) (X : Finset V) : Finset (Fin k) := by + classical + exact Finset.univ.filter fun alpha => DefectiveColor G phi X alpha + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DefectiveEdge.lean b/LeanPool/GoldbergSeymour/DefectiveEdge.lean new file mode 100644 index 0000000000..38bfd45a2c --- /dev/null +++ b/LeanPool/GoldbergSeymour/DefectiveEdge.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DefectiveColor + +/-! +# Defective Edge + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A boundary edge whose color is defective for the vertex set. -/ +def DefectiveEdge {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (X : Finset V) (f : E) : Prop := + ∃ alpha : Fin k, DefectiveColor G phi X alpha ∧ f ∈ BoundaryColorEdges G phi X alpha + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DefectiveVertex.lean b/LeanPool/GoldbergSeymour/DefectiveVertex.lean new file mode 100644 index 0000000000..73ba3aee5b --- /dev/null +++ b/LeanPool/GoldbergSeymour/DefectiveVertex.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DefectiveEdge + +/-! +# Defective Vertex + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A vertex inside the set incident to an edge of a defective boundary color. -/ +def DefectiveVertex {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (X : Finset V) (v : V) : Prop := + v ∈ X ∧ ∃ f : E, DefectiveEdge G phi X f ∧ Incident G v f + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Degree.lean b/LeanPool/GoldbergSeymour/Degree.lean new file mode 100644 index 0000000000..d612015be2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Degree.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Incident + +/-! +# Degree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The number of edges incident to a vertex, counting parallel edges separately. -/ +noncomputable def Degree {V E : Type*} [Fintype E] (G : LooplessMultigraph V E) (v : V) : ℕ := by + classical + exact (Finset.univ.filter fun e => Incident G v e).card + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DeleteEdge.lean b/LeanPool/GoldbergSeymour/DeleteEdge.lean new file mode 100644 index 0000000000..b22c7953a5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/DeleteEdge.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.RestrictEdges + +/-! +# Delete Edge + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The multigraph obtained by restricting to every edge except the distinguished edge. -/ +noncomputable def DeleteEdge {V E : Type*} [Fintype E] [DecidableEq E] (G : LooplessMultigraph V E) + (e0 : E) : LooplessMultigraph V { e // e ∈ Finset.univ.erase e0 } := + RestrictEdges G (Finset.univ.erase e0) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Density.lean b/LeanPool/GoldbergSeymour/Density.lean new file mode 100644 index 0000000000..1c43c5ce62 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Density.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Finset.Max +public import Mathlib.Data.Finset.Powerset +public import LeanPool.GoldbergSeymour.DensityValue +public import LeanPool.GoldbergSeymour.EligibleOddSet + +/-! +# Density + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The maximum of zero and the odd-set edge densities over eligible vertex sets. -/ +noncomputable def Density {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) : ℚ + := by + classical + let eligible := Finset.univ.powerset.filter fun U : Finset V => EligibleOddSet U + let values := eligible.image (DensityValue G) + exact (insert 0 values).max' (by simp) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DensityCeil.lean b/LeanPool/GoldbergSeymour/DensityCeil.lean new file mode 100644 index 0000000000..dc5354d2da --- /dev/null +++ b/LeanPool/GoldbergSeymour/DensityCeil.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Rat.Floor +public import LeanPool.GoldbergSeymour.Density + +/-! +# Density Ceil + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The natural-number ceiling of the maximum odd-set edge density. -/ +noncomputable def DensityCeil {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) : + ℕ := + ⌈Density G⌉₊ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DensityLowerBound.lean b/LeanPool/GoldbergSeymour/DensityLowerBound.lean new file mode 100644 index 0000000000..0420d9953c --- /dev/null +++ b/LeanPool/GoldbergSeymour/DensityLowerBound.lean @@ -0,0 +1,170 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChromaticIndexSpec +public import LeanPool.GoldbergSeymour.DensityCeil + +/-! +# Density Lower Bound + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem DensityLowerBound {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) : DensityCeil G ≤ ChromaticIndex G := by + classical + let k := ChromaticIndex G + obtain ⟨phi, hproper, hfull⟩ := (ChromaticIndexSpec G).1 + have endpoint_card : ∀ e : E, (G.ends e).toFinset.card = 2 := by + intro e + apply Sym2.card_toFinset_of_not_isDiag + intro hd + exact G.loopless e ((G.ends e).diagElem hd) (Sym2.diag_diagElem hd).symm + have matching_card : ∀ (U : Finset V), EligibleOddSet U → ∀ c : Fin k, + 2 * ((InternalEdges G U).filter (fun e => phi e = some c)).card ≤ U.card - 1 := by + intro U hU c + let edges := (InternalEdges G U).filter fun e => phi e = some c + have edges_subset : edges ⊆ InternalEdges G U := + Finset.filter_subset _ _ + have disjoint_endpoints : ∀ ⦃e⦄, e ∈ edges → ∀ ⦃f⦄, f ∈ edges → + e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + have heI := (Finset.mem_filter.mp he).1 + have hfI := (Finset.mem_filter.mp hf).1 + have hce := (Finset.mem_filter.mp he).2 + have hadj : AdjacentEdges G e f := ⟨v, (Sym2.mem_toFinset.mp hev), (Sym2.mem_toFinset.mp hvf)⟩ + have hne := hproper hef hadj hce + exact hne ((Finset.mem_filter.mp hf).2) + have union_card_for : ∀ s : Finset E, s ⊆ edges → + (s.biUnion fun e => (G.ends e).toFinset).card = 2 * s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset (s.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + have hde := disjoint_endpoints (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by intro h; exact hes (by simpa [h] using hf)) + exact (Finset.disjoint_left.mp hde) hev hvf + rw [Finset.card_union_of_disjoint hd, endpoint_card] + calc + 2 + (s.biUnion fun e => (G.ends e).toFinset).card = 2 + 2 * s.card := by + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + _ = 2 * (insert e s).card := by + rw [Finset.card_insert_of_notMem hes] + omega + have union_card := union_card_for edges (by intro e he; exact he) + have union_subset : edges.biUnion (fun e => (G.ends e).toFinset) ⊆ U := by + intro v hv + obtain ⟨e, he, hev⟩ := Finset.mem_biUnion.mp hv + have heI := (Finset.mem_filter.mp he).1 + exact (Finset.mem_filter.mp heI).2 v (Sym2.mem_toFinset.mp hev) + have hcard : 2 * edges.card ≤ U.card := by + rw [← union_card] + exact Finset.card_le_card union_subset + have hstrict : 2 * edges.card < U.card := by + apply Nat.lt_of_le_of_ne hcard + intro heq + apply hU.2.not_two_dvd_nat + refine ⟨edges.card, ?_⟩ + omega + have heq : edges = (InternalEdges G U).filter (fun e => phi e = some c) := rfl + rw [← heq] + omega + have total_card : ∀ (U : Finset V), EligibleOddSet U → + 2 * (InternalEdges G U).card ≤ k * (U.card - 1) := by + intro U hU + let colored := fun s : Finset (Fin k) => + (InternalEdges G U).filter (fun e => ∃ c ∈ s, phi e = some c) + have recurrence : ∀ s : Finset (Fin k), + 2 * (colored s).card ≤ s.card * (U.card - 1) := by + intro s + induction s using Finset.induction_on with + | empty => simp [colored] + | @insert c s hcs ih => + let old := colored s + let fresh := (InternalEdges G U).filter (fun e => phi e = some c) + have split : colored (insert c s) = old ∪ fresh := by + ext e + simp only [colored, old, fresh, Finset.mem_union, Finset.mem_filter, + Finset.mem_insert] + aesop + have disj : Disjoint old fresh := by + rw [Finset.disjoint_left] + intro e he ho + have ho' := (Finset.mem_filter.mp he).2 + have h1 := (Finset.mem_filter.mp ho).2 + let d := Classical.choose ho' + have hd := (Classical.choose_spec ho').1 + have h2 := (Classical.choose_spec ho').2 + have : d = c := by + have hc : some d = some c := by + calc + some d = phi e := h2.symm + _ = some c := h1 + simpa only [Option.some.injEq] using hc + change d ∈ s at hd + rw [this] at hd + exact hcs hd + rw [split, Finset.card_union_of_disjoint disj] + have hm := matching_card U hU c + dsimp [old, fresh] at ih ⊢ + calc + 2 * ((colored s).card + fresh.card) = + 2 * (colored s).card + 2 * fresh.card := by omega + _ ≤ s.card * (U.card - 1) + (U.card - 1) := + Nat.add_le_add ih (matching_card U hU c) + _ = (insert c s).card * (U.card - 1) := by + rw [Finset.card_insert_of_notMem hcs] + simp [Nat.add_mul, Nat.add_comm] + have hall : colored (Finset.univ : Finset (Fin k)) = InternalEdges G U := by + ext e + simp only [colored, Finset.mem_filter] + aesop + rw [← hall] + simpa using (recurrence (Finset.univ : Finset (Fin k))) + unfold DensityCeil + rw [Nat.ceil_le] + unfold Density + dsimp + rw [Finset.max'_le_iff] + intro x hx + simp only [Finset.mem_insert, Finset.mem_image] at hx + rcases hx with rfl | ⟨U, hU, rfl⟩ + · norm_num + · have heligible := (Finset.mem_filter.mp hU).2 + have htotal := total_card U heligible + dsimp [DensityValue] + have hpos : (0 : ℚ) < (U.card - 1 : ℚ) := by + have hu := heligible.1 + have hn : 1 < U.card := by omega + have hnq : (1 : ℚ) < (U.card : ℚ) := by exact_mod_cast hn + exact sub_pos.mpr hnq + apply (div_le_iff₀ hpos).2 + change (2 * (InternalEdges G U).card : ℚ) ≤ + (k : ℚ) * (U.card - 1 : ℚ) + have hcast : (U.card - 1 : ℚ) = (↑(U.card - 1) : ℚ) := by + have hu := heligible.1 + rw [Nat.cast_sub (by omega)] + norm_num + rw [hcast] + exact_mod_cast htotal + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DensityMonotone.lean b/LeanPool/GoldbergSeymour/DensityMonotone.lean new file mode 100644 index 0000000000..503cf6d714 --- /dev/null +++ b/LeanPool/GoldbergSeymour/DensityMonotone.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.Sets + +public import LeanPool.GoldbergSeymour.DensityCeil +public import LeanPool.GoldbergSeymour.RestrictEdges + +/-! +# Density Monotone + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem DensityMonotone {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (F : Finset E) : + DensityCeil (RestrictEdges G F) ≤ DensityCeil G := by + classical + unfold DensityCeil Density + dsimp + apply Nat.ceil_mono + apply Finset.max'_le + intro q hq + rcases Finset.mem_insert.mp hq with rfl | hq + · exact Finset.le_max' _ _ (Finset.mem_insert_self _ _) + · rcases Finset.mem_image.mp hq with ⟨U, hU, rfl⟩ + have hcard : (InternalEdges (RestrictEdges G F) U).card ≤ + (InternalEdges G U).card := by + rw [← Finset.card_image_iff.mpr (fun a ha b hb hab => Subtype.ext hab)] + apply Finset.card_le_card + intro e he + rcases Finset.mem_image.mp he with ⟨e', he', heq⟩ + subst e + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + have heprop := (Finset.mem_filter.mp he').2 + intro v hv + apply heprop v + simpa [Incident, RestrictEdges] using hv + have hden : 0 < U.card - 1 := by + have hsize : 3 ≤ U.card := (Finset.mem_filter.mp hU).2.1 + omega + have hvalue : DensityValue (RestrictEdges G F) U ≤ DensityValue G U := by + unfold DensityValue + apply div_le_div_of_nonneg_right + · exact_mod_cast Nat.mul_le_mul_left 2 hcard + · have hone : (1 : ℚ) ≤ U.card := by + exact_mod_cast (show 1 ≤ U.card by omega) + linarith + exact le_trans hvalue + (Finset.le_max' _ _ (Finset.mem_insert_of_mem + (Finset.mem_image.mpr ⟨U, hU, rfl⟩))) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DensityValue.lean b/LeanPool/GoldbergSeymour/DensityValue.lean new file mode 100644 index 0000000000..8e02b3ab45 --- /dev/null +++ b/LeanPool/GoldbergSeymour/DensityValue.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Rat.Cast.Order +public import LeanPool.GoldbergSeymour.InternalEdges + +/-! +# Density Value + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The rational density `2 * |E(U)| / (|U| - 1)` of a vertex set. -/ +noncomputable def DensityValue {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) + (U : Finset V) : ℚ := + (2 * (InternalEdges G U).card : ℚ) / (U.card - 1) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/DisplayedEdges.lean b/LeanPool/GoldbergSeymour/DisplayedEdges.lean new file mode 100644 index 0000000000..163ee138ac --- /dev/null +++ b/LeanPool/GoldbergSeymour/DisplayedEdges.lean @@ -0,0 +1,540 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable + +/-! +# P2813_T1_Displayed Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem P2813_T1_DisplayedEdges_missingAtMax_188.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (_ : + GoodHierarchy H), + let q := Fin.last H.dividerCount; + let A := HierarchyStarredStage H q; + ∀ (_ : ( + ∀ (r s : Fin (H.dividerCount + 1)) (_ : r ≤ s), TreeSequenceInitialSegment + (HierarchyStarredStage H r) (HierarchyStarredStage H s))) (_ : ( + ∀ (r : Fin (H.dividerCount + 1)), ColoredVertexSetElementary G phi (TreeSequenceVertexSet + (HierarchyStarredStage H r)))) (_ : ( + ∀ {B S : TreeSequence G e0} (_ : TreeSequenceInitialSegment B S), TreeMissingColors phi B ⊆ + TreeMissingColors phi S)), + ∀ c ∈ TreeMissingColors phi A, + ∀ (r : Fin (H.dividerCount + 1)), ( + ∀ (s : Fin (H.dividerCount + 1)), (↑r : ℕ) < (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) { c }) → c ∈ TreeMissingColors phi (HierarchyStarredStage H r) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good q A starChain helemStar missingSubset c + hcA r hmax + let P (j : ℕ) := ∃ hj : j ≤ H.dividerCount, + c ∈ TreeMissingColors phi (HierarchyStarredStage H ⟨j, by omega⟩) + have hex : ∃ j, P j := ⟨H.dividerCount, le_rfl, hcA⟩ + let s := Nat.find hex + obtain ⟨hs, hsm⟩ : P s := Nat.find_spec hex + by_cases hsr : s ≤ r.val + · exact missingSubset (starChain ⟨s, by omega⟩ r hsr) hsm + · have hspos : 0 < s := by omega + let i : Fin H.dividerCount := ⟨s - 1, by omega⟩ + have his : i.succ = (⟨s, by omega⟩ : Fin (H.dividerCount + 1)) := + Fin.ext (by simp [i]; omega) + have hprev : c ∉ TreeMissingColors phi (HierarchyStarredStage H i.castSucc) := by + intro hm + have hh : P (s - 1) := ⟨by omega, hm⟩ + have hmin := Nat.find_min' hex hh + change s ≤ s - 1 at hmin + omega + have hsm' : c ∈ TreeMissingColors phi (H.stage i.succ.castSucc) := by + simpa only [← his, HierarchyStarredStage, Fin.cases_succ] using hsm + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hsm' + have hvnew : v ∉ TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc) := by + intro hh + exact hprev (Finset.mem_biUnion.mpr ⟨v, hh, hvm⟩) + have hnew := GoodHierarchyNewMissingClosed good i (helemStar i.succ) c + (Finset.mem_biUnion.mpr ⟨v, Finset.mem_sdiff.mpr ⟨hv, hvnew⟩, hvm⟩) + apply False.elim + apply hmax i.succ (by simp [i]; omega) + intro d hd + have heq : d = c := Finset.mem_singleton.mp hd + subst d + exact hnew + +private theorem P2813_T1_DisplayedEdges_branch_320.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (alpha beta + : Fin k) (sigma : PartialEdgeColoring E k), + let q := Fin.last H.dividerCount; + let A := HierarchyStarredStage H q; + let n := Fin.last ett.rounds; + let Tn := ett.series.data.tree n.castSucc; + ∀ (_ : TreeSequenceInitialSegment A T) (_ : TreeSequenceInitialSegment Tn base.core) (_ : + StableColoring Tn (TashkinovStoredColors ett.series.data n) phi sigma) (_ : ( + ∀ (f : E) (_ : phi f ≠ some alpha) (_ : phi f ≠ some beta), sigma f = phi f)) (_ : ( + ∀ (t : Fin A.length) (_ : base.core.length ≤ (↑t : ℕ)) (c : Fin k) (_ : c = alpha ∨ c = beta) + (_ : c ∈ TreeMissingColors phi A) (_ : phi (A.edge t) = some c), sigma (A.edge t) = phi + (A.edge t))) (_ : ( + have n := Fin.last ett.rounds; + have Tn := ett.series.data.tree n.castSucc; + have Dn := TashkinovStoredColors ett.series.data n; ett.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence phi Tn T ∨ (ett.series.data.kind + n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind n = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TreeIncidentEdge Tn f ∧ ( + ∃ c ∈ TreeMissingColors phi Tn ∪ Dn, phi f = some c) ∧ TashkinovAugmentationSequence phi seed + T)) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence phi S T) (t : Fin A.length) (_ : + S.length ≤ (↑t : ℕ)) (c : Fin k) (_ : phi (A.edge t) = some c), c ∈ TreeMissingColors phi + A)) (t : Fin A.length) (_ : ¬(↑t : ℕ) < base.core.length), sigma (A.edge t) = phi (A.edge + t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H alpha beta sigma q A n Tn hAT coreChain + hnStable fixedValue missingEdge route augmentationMissing t ht + have htCore : base.core.length ≤ t.val := by omega + by_cases ha : phi (A.edge t) = some alpha + · by_cases hm : alpha ∈ TreeMissingColors phi A + · exact missingEdge t htCore alpha (Or.inl rfl) hm ha + · rcases route with ⟨hp, hseq⟩ | ⟨hp, f, seed, hedges, hseed, hincident, hcontrol, hseq⟩ + · exact (hm (augmentationMissing Tn hseq t (le_trans coreChain.1 htCore) alpha ha)).elim + · by_cases hs : seed.length ≤ t.val + · exact (hm (augmentationMissing seed hseq t hs alpha ha)).elim + · have hseedT := TashkinovAugmentationSequenceInitialSegment phi seed T hseq + have htSeed : t.val = Tn.length := by + have hseedLen : seed.length = Tn.length + 1 := hseed.1 + have hcoreLen : Tn.length ≤ base.core.length := coreChain.1 + omega + let u : Fin seed.length := ⟨t.val, by omega⟩ + have he : Fin.castLE hseedT.1 u = Fin.castLE hAT.1 t := Fin.ext rfl + have hf : A.edge t = f := by + rw [← hAT.2.2 t, ← he, hseedT.2.2 u] + have hu : u = Fin.cast hseed.1.symm (Fin.last Tn.length) := Fin.ext htSeed + rw [hu, hseed.2.2] + rw [hf] + exact hnStable.1 f hincident hcontrol + · by_cases hb : phi (A.edge t) = some beta + · by_cases hm : beta ∈ TreeMissingColors phi A + · exact missingEdge t htCore beta (Or.inr rfl) hm hb + · rcases route with ⟨hp, hseq⟩ | ⟨hp, f, seed, hedges, hseed, hincident, hcontrol, hseq⟩ + · exact (hm (augmentationMissing Tn hseq t (le_trans coreChain.1 htCore) beta hb)).elim + · by_cases hs : seed.length ≤ t.val + · exact (hm (augmentationMissing seed hseq t hs beta hb)).elim + · have hseedT := TashkinovAugmentationSequenceInitialSegment phi seed T hseq + have htSeed : t.val = Tn.length := by + have hseedLen : seed.length = Tn.length + 1 := hseed.1 + have hcoreLen : Tn.length ≤ base.core.length := coreChain.1 + omega + let u : Fin seed.length := ⟨t.val, by omega⟩ + have he : Fin.castLE hseedT.1 u = Fin.castLE hAT.1 t := Fin.ext rfl + have hf : A.edge t = f := by + rw [← hAT.2.2 t, ← he, hseedT.2.2 u] + have hu : u = Fin.cast hseed.1.symm (Fin.last Tn.length) := Fin.ext htSeed + rw [hu, hseed.2.2] + rw [hf] + exact hnStable.1 f hincident hcontrol + · exact fixedValue _ ha hb + +private theorem helper_trans_227.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W + Z → TreeSequenceInitialSegment U Z := by + classical + intro V E G e0 U W Z hUW hWZ + refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ + · intro j + exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) j)).trans + (hUW.2.1 j) + · intro j + exact (hWZ.2.2 (Fin.castLE hUW.1 j)).trans (hUW.2.2 j) + +private theorem helper_stageChain_238.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base), ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ + j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H trans j + induction j with + | zero => + intro hj i hi + have hi0 : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have heq' : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) + (H.nested ⟨j, by omega⟩) + +private theorem helper_starChain_264.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base), ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → ( + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ + j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ))))) → ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H r) + (H.stage r.succ)) → + ∀ (r s : Fin (H.dividerCount + (1 : ℕ))), r ≤ s → TreeSequenceInitialSegment + (HierarchyStarredStage H r) (HierarchyStarredStage H s) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H trans stageChain starStage r s hrs + by_cases heq : r = s + · subst s + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have hrlt : r.val < s.val := by + have := Fin.le_iff_val_le_val.mp hrs + have : r.val ≠ s.val := fun h => heq (Fin.ext h) + omega + have hs : s ≠ 0 := by intro hs; subst s; simp at hrlt + have hstar : HierarchyStarredStage H s = H.stage s.castSucc := by + rw [← Fin.succ_pred s hs] + rfl + rw [hstar] + exact trans (starStage r) + (stageChain s.val (by omega) r.succ (by simp; omega)) + +private theorem helper_hATy_286.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); TreeSequenceInitialSegment A T → TreeSequenceInitialSegment A Ty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H q A Ty hAT + have hlen : A.length ≤ Ty.length := by + change A.length ≤ min (A.length + ((T.length - A.length) - 1)) T.length + exact Nat.le_min.mpr ⟨Nat.le_add_right _ _, hAT.1⟩ + refine ⟨hlen, ?_, ?_⟩ + · intro j + change T.vertex _ = A.vertex j + exact hAT.2.1 j + · intro j + change T.edge _ = A.edge j + exact hAT.2.2 j + +private theorem helper_maxClosed_317.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (c : Fin k), + (∃ (r : Fin (H.dividerCount + (1 : ℕ))), + TreeColorSetClosed G phi (HierarchyStarredStage H r) ({ c } : Finset (Fin k))) → + ∃ (r : Fin (H.dividerCount + (1 : ℕ))), + TreeColorSetClosed G phi (HierarchyStarredStage H r) ({ c } : Finset (Fin k)) ∧ + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), + (↑r : ℕ) < (↑s : ℕ) → + ¬TreeColorSetClosed G phi (HierarchyStarredStage H s) ({ c } : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H c hex + let S := Finset.univ.filter fun r : Fin (H.dividerCount + 1) => + TreeColorSetClosed G phi (HierarchyStarredStage H r) {c} + have hS : S.Nonempty := by + obtain ⟨r, hr⟩ := hex + exact ⟨r, by simp [S, hr]⟩ + refine ⟨S.max' hS, (Finset.mem_filter.mp (Finset.max'_mem S hS)).2, ?_⟩ + intro s hs hcl + have hmem : s ∈ S := by simp [S, hcl] + have hle := Finset.le_max' S s hmem + change s.val ≤ (S.max' hS).val at hle + omega + +private theorem helper_hnStable_349.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (sigma : PartialEdgeColoring E k), ( + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; if ett.series.data.kind n + = some TashkinovExtensionKind.PE then CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; StableColoring Tn + (TashkinovStoredColors ett.series.data n) phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base sigma hbase n Tn + change (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure (TashkinovStoredColors ett.series.data n) phi sigma + else StableColoring Tn (TashkinovStoredColors ett.series.data n) phi sigma) at hbase + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (ite_eq_left hp ▸ hbase).1 + · simpa only [hp, ite_false] using hbase + +private theorem helper_hqPositive_362.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (t : Fin A.length), base.core.length ≤ (↑t : ℕ) → (0 : ℕ) < H.dividerCount := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H q A t ht + by_contra hn + have hz : q = 0 := Fin.ext (by dsimp [q]; omega) + have he : A = base.core := by dsimp only [A]; rw [hz]; rfl + have hlt := t.isLt + have hlen := congrArg TreeSequence.length he + omega + +private theorem helper_augmentationMissing_403.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → TreeSequenceInitialSegment A T → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence phi S T → + ∀ (t : Fin A.length), S.length ≤ (↑t : ℕ) → + ∀ (c : Fin k), phi (A.edge t) = some c → c ∈ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H q A trans hAT S hseq t ht c hcol + let tT := Fin.castLE hAT.1 t + obtain ⟨hlen, hinit, d, hcolor, hdm⟩ := + (TashkinovAugmentationSequencePosition phi S T hseq tT ht).1 + have hdcol : phi (T.edge tT) = some d := by + convert hcolor using 1 + congr 2 + have hdc : d = c := Option.some.inj + (hdcol.symm.trans (by rw [hAT.2.2 t]; exact hcol)) + subst d + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hdm + obtain ⟨i, hi⟩ : ∃ i, (TreeSequencePrefix T tT.val + (le_trans S.positive ht) (Nat.le_of_lt tT.isLt)).vertex i = v := by + simpa [TreeSequenceVertexSet] using hv + let iA : Fin (A.length + 1) := ⟨i.val, by + have hiBound : i.val < t.val + 1 := i.isLt + have := t.isLt + omega⟩ + have hvA : A.vertex iA = v := by + have hh := hAT.2.1 iA + exact hh.symm.trans hi + exact Finset.mem_biUnion.mpr ⟨v, by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨iA, hvA⟩, hvm⟩ + +theorem P2813_T1_DisplayedEdges {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hpreStepElementary : + let i : Fin ett.rounds := ⟨ett.rounds - 1, by + have := ett.roundsPositive; omega⟩ + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc))) + (hprefixElementary : + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (alpha beta : Fin k) (z : Sum V E) + (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hsone : IsOneEdgeUncolored sigma e0) + (hbase : + let n := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) + (houtside : + ∀ (r : Fin (H.dividerCount + 1)) (c : Fin k), + (c = alpha ∨ c = beta) → + c ∈ TreeMissingColors phi (HierarchyStarredStage H r) → + TreeColorSetClosed G phi (HierarchyStarredStage H r) {c} → + OutsideKempeRecoloring (HierarchyStarredStage H r) phi sigma alpha beta) : + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + ∀ t : Fin A.length, sigma (A.edge t) = phi (A.edge t) := by + classical + have coreFixed := P2813_T1_BaseDisplayedEdges G k e0 input T phi ett base + sigma hone hsone hbase + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Ty := TreeSequencePrefix T + (min (A.length + ((T.length - A.length) - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have trans := @helper_trans_227 (@V) (@E) (@G) (@e0) + have stageChain := @helper_stageChain_238 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@trans) + have starStage (r : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H r) + (H.stage r.succ) := by + clear * - H r + refine Fin.cases ?_ (fun i => ?_) r + · exact H.coreInsideFirst + · exact H.nested i.succ + have starChain := @helper_starChain_264 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@trans) (@stageChain) + (@starStage) + have hAT : TreeSequenceInitialSegment A T := by + have hh := starStage q + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa [hlast, H.terminalStage] using hh + have hATy := @helper_hATy_286 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@hAT) + have hTyT : TreeSequenceInitialSegment Ty T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have helemA : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by + intro u hu v hv hne' + exact hprefixElementary + (TreeSequenceInitialSegmentVertexSetSubset hATy hu) + (TreeSequenceInitialSegmentVertexSetSubset hATy hv) hne' + have helemStar (r : Fin (H.dividerCount + 1)) : + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H r)) := by + have hsub := TreeSequenceInitialSegmentVertexSetSubset + (starChain r q (Fin.le_last r)) + intro u hu v hv hne' + exact helemA (hsub hu) (hsub hv) hne' + have missingSubset {B S : TreeSequence G e0} (hBS : TreeSequenceInitialSegment B S) : + TreeMissingColors phi B ⊆ TreeMissingColors phi S := by + intro c hc + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hBS hv, hvm⟩ + have maxClosed := @helper_maxClosed_317 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) + have missingAtMax (c : Fin k) (hcA : c ∈ TreeMissingColors phi A) + (r : Fin (H.dividerCount + 1)) + (hmax : ∀ s : Fin (H.dividerCount + 1), r.val < s.val → + ¬ TreeColorSetClosed G phi (HierarchyStarredStage H s) {c}) : + c ∈ TreeMissingColors phi (HierarchyStarredStage H r) := by + exact @P2813_T1_DisplayedEdges_missingAtMax_188 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base H good starChain helemStar missingSubset c hcA + r hmax + have coreChain : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (base.parallel hp).2.2.some.leftSegment + · rw [base.nonparallel hp] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have coreA : TreeSequenceInitialSegment base.core A := starChain 0 q (Fin.zero_le _) + have TnA := trans coreChain coreA + have hnStable := @helper_hnStable_349 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@sigma) (@hbase) + have fixedValue (f : E) (ha : phi f ≠ some alpha) (hb : phi f ≠ some beta) : + sigma f = phi f := by + rw [hsigma] + simp only [TwoColorComponentSwap] + split_ifs <;> simp_all + have hqPositive := @helper_hqPositive_362 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) + have missingEdge (t : Fin A.length) (ht : base.core.length ≤ t.val) + (c : Fin k) (hc : c = alpha ∨ c = beta) + (hm : c ∈ TreeMissingColors phi A) (hcol : phi (A.edge t) = some c) : + sigma (A.edge t) = phi (A.edge t) := by + have hp := hqPositive t ht + by_cases hex : ∃ r, TreeColorSetClosed G phi (HierarchyStarredStage H r) {c} + · obtain ⟨r, hcl, hmax⟩ := maxClosed c hex + have hmr := missingAtMax c hm r hmax + have havoid := (rutcor G k e0 input T phi ett base H good hp + hprefixElementary hpreStepElementary c hm).1 hex r hcl hmax + by_cases htr : t.val < (HierarchyStarredStage H r).length + · let u : Fin (HierarchyStarredStage H r).length := ⟨t.val, htr⟩ + have hseg := starChain r q (Fin.le_last r) + have he : Fin.castLE hseg.1 u = t := Fin.ext rfl + rw [← he, hseg.2.2 u] + have hh := OutsideKempeRecoloringStable G e0 (HierarchyStarredStage H r) + ∅ phi sigma alpha beta hproper hone (houtside r c hc hmr hcl) + apply hh.2.2.2.2 + obtain ⟨i, hi⟩ := (HierarchyStarredStage H r).attaches u + refine ⟨(HierarchyStarredStage H r).vertex u.succ, ?_, ?_⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + exact ⟨u.succ, rfl⟩ + · simp [Incident, hi] + · exact False.elim (havoid (Finset.mem_filter.mpr + ⟨Finset.mem_univ _, t, by omega, hcol⟩)) + · have hnone : ∀ r, ¬ TreeColorSetClosed G phi (HierarchyStarredStage H r) {c} := + fun r hr => hex ⟨r, hr⟩ + have havoid := (rutcor G k e0 input T phi ett base H good hp + hprefixElementary hpreStepElementary c hm).2 hnone + exact False.elim (havoid.2.2.2 (Finset.mem_filter.mpr + ⟨Finset.mem_univ _, t, le_trans coreChain.1 ht, hcol⟩)) + have route := P2813_T1_TerminalRoute G k e0 input T phi ett + have augmentationMissing := @helper_augmentationMissing_403 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@trans) + (@hAT) + change ∀ t : Fin A.length, sigma (A.edge t) = phi (A.edge t) + intro t + by_cases ht : t.val < base.core.length + · let u : Fin base.core.length := ⟨t.val, ht⟩ + have he : Fin.castLE coreA.1 u = t := Fin.ext rfl + rw [← he, coreA.2.2 u] + exact coreFixed u + · exact @P2813_T1_DisplayedEdges_branch_320 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base H alpha beta sigma hAT coreChain hnStable + fixedValue missingEdge route augmentationMissing t ht +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ETTFirstAppearanceIndex.lean b/LeanPool/GoldbergSeymour/ETTFirstAppearanceIndex.lean new file mode 100644 index 0000000000..0e8f02fc3d --- /dev/null +++ b/LeanPool/GoldbergSeymour/ETTFirstAppearanceIndex.lean @@ -0,0 +1,44 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovLadderStage + +/-! +# ETTFirst Appearance Index + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The first ladder stage containing the vertex, numbered starting at one. -/ +noncomputable def ETTFirstAppearanceIndex {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (v : V) + (hv : v ∈ TreeSequenceVertexSet T) : ℕ := by + classical + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hfinal : + ExtendedTashkinovLadderStage ett (Fin.last ett.rounds) = T := by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last + have hlast : Fin.last ett.rounds ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [hfinal] + exact hv + exact (candidates.min' ⟨Fin.last ett.rounds, hlast⟩).val + 1 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ETTStrongInterchangeable.lean b/LeanPool/GoldbergSeymour/ETTStrongInterchangeable.lean new file mode 100644 index 0000000000..db87e2f798 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ETTStrongInterchangeable.lean @@ -0,0 +1,52 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +public import LeanPool.GoldbergSeymour.TwoColorComponentCycle + +/-! +# ETTStrong Interchangeable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The component-cycle and containment conditions for strong interchangeability after a parallel +extension. +-/ +def ETTStrongInterchangeable {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (t : Fin ett.rounds) (support : V) + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) : Prop := + alpha ≠ beta ∧ + ett.series.data.kind t.succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex t.succ = some support ∧ + ∃ epsilon : Fin ett.rounds, + t.val < epsilon.val ∧ + ett.series.data.kind epsilon.succ ≠ some TashkinovExtensionKind.RE ∧ + (∀ q : Fin ett.rounds, + t.val < q.val → + q.val < epsilon.val → ett.series.data.kind q.succ = some TashkinovExtensionKind.RE) ∧ + ∀ v : V, + v ∈ TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc) → + v ≠ support → + TwoColorComponentCycle G phi alpha beta (Sum.inl v) ∧ + Sum.inl support ∉ TwoColorComponent G phi alpha beta (Sum.inl v) ∧ + ∀ w : V, + Sum.inl w ∈ TwoColorComponent G phi alpha beta (Sum.inl v) → + w ∈ TreeSequenceVertexSet (ett.series.data.tree epsilon.succ.castSucc) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/EarlierPECycleFirstNonrevisitingInternal.lean b/LeanPool/GoldbergSeymour/EarlierPECycleFirstNonrevisitingInternal.lean new file mode 100644 index 0000000000..71b3e74888 --- /dev/null +++ b/LeanPool/GoldbergSeymour/EarlierPECycleFirstNonrevisitingInternal.lean @@ -0,0 +1,1545 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Earlier PECycle First Nonrevisiting Internal + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private abbrev helperContinuation1518Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k), + series.data.kind r.succ = some TashkinovExtensionKind.PE → series.data.gamma r.succ = some + gamma → series.data.delta r.succ = some delta → + ∀ (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), ( + ∃ v ∈ TreeSequenceVertexSet (series.data.tree r.succ.castSucc), Sum.inl v ∈ + cycle.walk.support) → (↑r : ℕ) + (1 : ℕ) < rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; (↑r : ℕ) < (↑p : ℕ) → ( + ∀ (j : Fin rounds), (↑r : ℕ) < (↑j : ℕ) → (↑j : ℕ) < (↑p : ℕ) → series.data.kind j.succ = some + TashkinovExtensionKind.RE) → + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + cycleP.walk.support = cycle.walk.support → TreeSequenceVertexSet (series.data.tree + r.succ.castSucc) ⊆ TreeSequenceVertexSet (series.data.tree p.succ.castSucc) → ¬Nonempty + (RevisitingExtensionCertificate series.data p.castSucc) → + ∀ f ∉ InternalEdges G (TreeSequenceVertexSet (series.data.tree p.succ.castSucc)), + ∀ (hfCycleP : Sum.inr f ∈ cycleP.walk.support), ( + ∀ {z : Sym2 V} {a b : V}, a ∈ z → b ∈ z → a ≠ b → z = s(a, b)) → + let edgeCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma delta).Walk + (Sum.inr f) (Sum.inr f) := cycleP.walk.rotate (Sum.inr f) hfCycleP; + ∀ (a : V), edgeCycle.getVert (1 : ℕ) = Sum.inl a → Incident G a f → + ∀ (b : V), edgeCycle.getVert (edgeCycle.length - (1 : ℕ)) = Sum.inl b → Incident G b f → a ≠ b + → G.ends f = s(a, b) → False + +private theorem helper_reColoring_116.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (_ : (↑r : ℕ) + (1 : ℕ) < rounds), + let candidates : Finset (Fin rounds) := {q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE}; + ∀ (_ : candidates.Nonempty) (j : Fin rounds) (_ : series.data.kind j.succ = some + TashkinovExtensionKind.RE), series.data.coloring j.succ = series.data.coloring j.castSucc + := by + classical + intro V E _ _ _ G k rounds e0 input series r hrTerminalLt candidates candidatesNonempty j hjKind + generalize hjSlot : j.succ = slot at hjKind ⊢ + cases series.certified slot with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero j hjSlot).elim + | SE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have : some TashkinovExtensionKind.SE = some TashkinovExtensionKind.RE := + currentKind.symm.trans (by simpa [hjSlot] using hjKind) + cases this + | PE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails actualGamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + have : some TashkinovExtensionKind.PE = some TashkinovExtensionKind.RE := + currentKind.symm.trans (by simpa [hjSlot] using hjKind) + cases this + | RE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + available currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have hi : i = j := by + apply Fin.ext + have := congrArg Fin.val hjSlot + simp only [Fin.val_succ] at this + omega + subst i + simpa [hjSlot] using currentColoring + +private theorem helper_stepVertexSubset_192.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (_ : (↑r : ℕ) + (1 : ℕ) < rounds), + let candidates : Finset (Fin rounds) := {q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE}; + ∀ (_ : candidates.Nonempty) (j : Fin rounds), TreeSequenceVertexSet (series.data.tree + j.succ.castSucc) ⊆ TreeSequenceVertexSet (series.data.tree j.succ.succ) := by + classical + intro V E _ _ _ G k rounds e0 input series r hrTerminalLt candidates candidatesNonempty j + generalize hjSlot : j.succ = slot + cases series.certified slot with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero j hjSlot).elim + | SE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have hi : i = j := by + apply Fin.ext + have := congrArg Fin.val hjSlot + simp only [Fin.val_succ] at this + omega + subst i + exact TreeSequenceInitialSegmentVertexSetSubset (by simpa [hjSlot] using orderedExtension) + | PE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails actualGamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + have hi : i = j := by + apply Fin.ext + have := congrArg Fin.val hjSlot + simp only [Fin.val_succ] at this + omega + subst i + exact TreeSequenceInitialSegmentVertexSetSubset (by simpa [hjSlot] using orderedExtension) + | RE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + available currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have hi : i = j := by + apply Fin.ext + have := congrArg Fin.val hjSlot + simp only [Fin.val_succ] at this + omega + subst i + exact TreeSequenceInitialSegmentVertexSetSubset (by simpa [hjSlot] using orderedExtension) + +private theorem helper_pNoRevisiting_258.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (_ : (↑r : ℕ) + (1 : ℕ) < rounds), + let candidates : Finset (Fin rounds) := {q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE}; + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (_ : series.data.kind p.succ ≠ some TashkinovExtensionKind.RE), ¬Nonempty + (RevisitingExtensionCertificate series.data p.castSucc) := by + classical + intro V E _ _ _ G k rounds e0 input series r hrTerminalLt candidates candidatesNonempty p pNotRE + generalize hpSlot : p.succ = slot + cases series.certified slot with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero p hpSlot).elim + | SE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have hi : i = p := by + apply Fin.ext + have := congrArg Fin.val hpSlot + simp only [Fin.val_succ] at this + omega + subst i + simpa using noRevisiting + | PE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails actualGamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + have hi : i = p := by + apply Fin.ext + have := congrArg Fin.val hpSlot + simp only [Fin.val_succ] at this + omega + subst i + simpa using noRevisiting + | RE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + available currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have hRE : series.data.kind p.succ = some TashkinovExtensionKind.RE := by + simpa [hpSlot] using currentKind + exact False.elim (pNotRE hRE) + +private theorem helper_hrTerminalLt_212 : + open scoped Classical in + ∀ (rounds : ℕ) (r : Fin rounds), r.succ ≠ Fin.last rounds → (↑r : ℕ) + (1 : ℕ) < rounds := by + classical + intro rounds r hrEarlier + have hrle : r.val + 1 ≤ rounds := by omega + have hrne : r.val + 1 ≠ rounds := by + intro h + apply hrEarlier + apply Fin.ext + simpa using h + omega + +private theorem helper_betweenRE_239.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (r : Fin rounds), (↑r : ℕ) + (1 : ℕ) < rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (j : Fin rounds), (↑r : ℕ) < (↑j : ℕ) → (↑j : ℕ) < (↑p : ℕ) → series.data.kind j.succ = some + TashkinovExtensionKind.RE := by + classical + intro V E _ _ _ G k rounds e0 input series r hrTerminalLt candidates candidatesNonempty p j hrj + hjp + by_contra hjNot + have hjMem : j ∈ candidates := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, hrj, hjNot⟩ + have hpj : p ≤ j := Finset.min'_le candidates j hjMem + omega + +private theorem helper_pKind_247.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (r : Fin rounds), + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; series.data.kind p.succ ≠ some + TashkinovExtensionKind.RE → series.data.kind p.succ = some TashkinovExtensionKind.SE ∨ + series.data.kind p.succ = some TashkinovExtensionKind.PE := by + classical + intro V E _ _ _ G k rounds e0 input series r candidates candidatesNonempty p pNotRE + generalize hpSlot : p.succ = slot at pNotRE ⊢ + cases series.certified slot with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero p hpSlot).elim + | SE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + exact Or.inl (by simpa [hpSlot] using currentKind) + | PE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails actualGamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + exact Or.inr (by simpa [hpSlot] using currentKind) + | RE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + available currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + exact False.elim (pNotRE (by simpa [hpSlot] using currentKind)) + +private theorem helper_coloringAlong_276.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (r : Fin rounds), (↑r : ℕ) + (1 : ℕ) < rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; ( + ∀ (j : Fin rounds), (↑r : ℕ) < (↑j : ℕ) → (↑j : ℕ) < (↑p : ℕ) → series.data.kind j.succ = some + TashkinovExtensionKind.RE) → ( + ∀ (j : Fin rounds), series.data.kind j.succ = some TashkinovExtensionKind.RE → + series.data.coloring j.succ = series.data.coloring j.castSucc) → + ∀ (n : ℕ), (↑r : ℕ) + (1 : ℕ) ≤ n → n ≤ (↑p : ℕ) → + ∀ (q : Fin (rounds + (1 : ℕ))), (↑q : ℕ) = n → series.data.coloring q = series.data.coloring + r.succ := by + classical + intro V E _ _ _ G k rounds e0 input series r hrTerminalLt candidates candidatesNonempty p + betweenRE reColoring n hrn + induction n, hrn using Nat.le_induction with + | base => + intro hnp q hq + have hqr : q = r.succ := by + apply Fin.ext + simp only [Fin.val_succ] + omega + simp [hqr] + | succ n hn ih => + intro hnp q hq + have hnltp : n < p.val := by omega + have hnr : r.val < n := by omega + let j : Fin rounds := ⟨n, by omega⟩ + have hjKind := betweenRE j (by simpa [j]) (by simpa [j]) + have hjColor := reColoring j hjKind + have hqSucc : q = j.succ := by + apply Fin.ext + simp [j, hq] + have hjCast : j.castSucc.val = n := by simp [j] + calc + series.data.coloring q = series.data.coloring j.succ := by rw [hqSucc] + _ = series.data.coloring j.castSucc := hjColor + _ = series.data.coloring r.succ := ih (by omega) j.castSucc hjCast + +private theorem helper_treeAlong_321.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (r : Fin rounds), (↑r : ℕ) + (1 : ℕ) < rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; ( + ∀ (j : Fin rounds), TreeSequenceVertexSet (series.data.tree j.succ.castSucc) ⊆ + TreeSequenceVertexSet (series.data.tree j.succ.succ)) → + ∀ (n : ℕ), (↑r : ℕ) ≤ n → n ≤ (↑p : ℕ) → + ∀ (q : Fin rounds), (↑q : ℕ) = n → TreeSequenceVertexSet (series.data.tree r.succ.castSucc) ⊆ + TreeSequenceVertexSet (series.data.tree q.succ.castSucc) := by + classical + intro V E _ _ _ G k rounds e0 input series r hrTerminalLt candidates candidatesNonempty p + stepVertexSubset n hrn + induction n, hrn using Nat.le_induction with + | base => + intro hnp q hq + have hqr : q = r := by apply Fin.ext; omega + simp [hqr] + | succ n hn ih => + intro hnp q hq + let prev : Fin rounds := ⟨n, by omega⟩ + have hprev := ih (by omega) prev rfl + have hstep := stepVertexSubset prev + have htree : prev.succ.succ = q.succ.castSucc := by + apply Fin.ext + simp [prev, hq] + simpa [htree] using Set.Subset.trans hprev hstep + +private theorem helper_edgeIdentity_353.{u_1} : + open scoped Classical in + ∀ {V : Type u_1} {z : Sym2 V} {a b : V}, a ∈ z → b ∈ z → a ≠ b → z = s(a, b) := by + classical + intro V z a b ha hb hab + induction z using Sym2.inductionOn with + | _ c d => + simp only [Sym2.mem_iff] at ha hb + rcases ha with rfl | rfl <;> rcases hb with rfl | rfl <;> simp_all + +private theorem helper_firstVertex_365.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E) (hfCycleP : Sum.inr f ∈ cycleP.walk.support), + let edgeCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma delta).Walk + (Sum.inr f) (Sum.inr f) := cycleP.walk.rotate (Sum.inr f) hfCycleP; + (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma delta).Adj + (edgeCycle.getVert (0 : ℕ)) (edgeCycle.getVert ((0 : ℕ) + (1 : ℕ))) → + ∃ (a : V), edgeCycle.getVert (1 : ℕ) = Sum.inl a := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle candidates candidatesNonempty p + pColoring cycleP f hfCycleP edgeCycle firstAdj + cases hfirst : edgeCycle.getVert 1 with + | inl a => exact ⟨a, rfl⟩ + | inr e => + exfalso + rw [edgeCycle.getVert_zero, hfirst] at firstAdj + simp [TwoColorIncidenceGraph] at firstAdj + +private theorem helper_lastVertex_378.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E) (hfCycleP : Sum.inr f ∈ cycleP.walk.support), + let edgeCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma delta).Walk + (Sum.inr f) (Sum.inr f) := cycleP.walk.rotate (Sum.inr f) hfCycleP; (3 : ℕ) ≤ + edgeCycle.length → (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Adj (edgeCycle.getVert (edgeCycle.length - (1 : ℕ))) (edgeCycle.getVert + (edgeCycle.length - (1 : ℕ) + (1 : ℕ))) → + ∃ (b : V), edgeCycle.getVert (edgeCycle.length - (1 : ℕ)) = Sum.inl b := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p pColoring cycleP f hfCycleP edgeCycle edgeCycleLength lastAdj + cases hlast : edgeCycle.getVert (edgeCycle.length - 1) with + | inl b => exact ⟨b, rfl⟩ + | inr e => + exfalso + have hidx : edgeCycle.length - 1 + 1 = edgeCycle.length := by omega + rw [hidx, edgeCycle.getVert_length, hlast] at lastAdj + simp [TwoColorIncidenceGraph] at lastAdj + +private theorem helper_hab_392.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E) (hfCycleP : Sum.inr f ∈ cycleP.walk.support), + let edgeCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma delta).Walk + (Sum.inr f) (Sum.inr f) := cycleP.walk.rotate (Sum.inr f) hfCycleP; edgeCycle.IsCycle → + ∀ (a : V), edgeCycle.getVert (1 : ℕ) = Sum.inl a → + ∀ (b : V), edgeCycle.getVert (edgeCycle.length - (1 : ℕ)) = Sum.inl b → a ≠ b := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle candidates candidatesNonempty p + pColoring cycleP f hfCycleP edgeCycle edgeCycleIsCycle a ha b hb habEq + apply edgeCycleIsCycle.snd_ne_penultimate + rw [show edgeCycle.snd = Sum.inl a by simpa using ha] + rw [show edgeCycle.penultimate = Sum.inl b by simpa using hb] + exact congrArg Sum.inl habEq + +private theorem helper_outsideOnCycle_401.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ f ∉ InternalEdges G (TreeSequenceVertexSet (series.data.tree p.succ.castSucc)), + ∀ (hfCycleP : Sum.inr f ∈ cycleP.walk.support), + let edgeCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma delta).Walk + (Sum.inr f) (Sum.inr f) := cycleP.walk.rotate (Sum.inr f) hfCycleP; + ∀ (a : V), edgeCycle.getVert (1 : ℕ) = Sum.inl a → Incident G a f → + ∀ (b : V), edgeCycle.getVert (edgeCycle.length - (1 : ℕ)) = Sum.inl b → Incident G b f → a ≠ b + → G.ends f = s(a, b) → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∃ y ∉ currentTree, Sum.inl y ∈ cycleP.walk.support := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle candidates candidatesNonempty p + pColoring cycleP f hfNotInternal hfCycleP edgeCycle a ha hfa b hb hfb hab hfEndsAB currentTree + by_cases haCurrent : a ∈ currentTree + · have hbOutside : b ∉ currentTree := by + intro hbCurrent + apply hfNotInternal + simp only [InternalEdges, Finset.mem_filter, Finset.mem_univ, true_and] + intro v hv + have hvEnds : v ∈ G.ends f := by simpa [Incident] using hv + rw [hfEndsAB] at hvEnds + rcases (by simpa only [Sym2.mem_iff] using hvEnds) with rfl | rfl + · exact haCurrent + · exact hbCurrent + refine ⟨b, hbOutside, ?_⟩ + apply (cycleP.walk.mem_support_rotate_iff (Sum.inr f) hfCycleP).mp + change Sum.inl b ∈ edgeCycle.support + rw [← hb] + exact edgeCycle.getVert_mem_support (edgeCycle.length - 1) + · refine ⟨a, haCurrent, ?_⟩ + apply (cycleP.walk.mem_support_rotate_iff (Sum.inr f) hfCycleP).mp + change Sum.inl a ∈ edgeCycle.support + rw [← ha] + exact edgeCycle.getVert_mem_support 1 + +private theorem helper_outsideIndicesNonempty_437.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E), Sum.inr f ∈ cycleP.walk.support → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + ∀ outsideVertex ∉ currentTree, + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + Sum.inl outsideVertex ∈ rootedCycle.support → + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); outsideIndices.Nonempty := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p pColoring cycleP f hfCycleP currentTree v0 hv0CycleP outsideVertex + outsideVertexNotCurrent rootedCycle outsideVertexRooted outsideIndices + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp outsideVertexRooted + let i : Fin (rootedCycle.length + 1) := ⟨n, by omega⟩ + refine ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩⟩ + exact ⟨outsideVertex, by simpa [i] using hn, outsideVertexNotCurrent⟩ + +private theorem helper_beforeFirstOutside_450.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E), Sum.inr f ∈ cycleP.walk.support → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (i : Fin (rootedCycle.length + (1 : ℕ))), (↑i : ℕ) < (↑firstOutside : ℕ) → + ∀ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v → v ∈ currentTree := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p pColoring cycleP f hfCycleP currentTree v0 hv0CycleP rootedCycle + outsideIndices outsideIndicesNonempty firstOutside i hi v hv + by_contra hvOutside + have hiMem : i ∈ outsideIndices := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, ⟨v, hv, hvOutside⟩⟩ + have hmin := Finset.min'_le outsideIndices i hiMem + omega + +private theorem helper_firstOutsidePositive_459.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E), Sum.inr f ∈ cycleP.walk.support → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), v0 ∈ currentTree → + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (y : V), rootedCycle.getVert (↑firstOutside : ℕ) = Sum.inl y → y ∉ currentTree → (0 : ℕ) < + (↑firstOutside : ℕ) := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p pColoring cycleP f hfCycleP currentTree v0 hv0CycleP hv0Current + rootedCycle outsideIndices outsideIndicesNonempty firstOutside y hyAt hyOutside + by_contra hnot + have hiZero : firstOutside.val = 0 := by omega + have hyv0 : y = v0 := by + apply Sum.inl.inj + calc + Sum.inl y = rootedCycle.getVert firstOutside.val := hyAt.symm + _ = rootedCycle.getVert 0 := by rw [hiZero] + _ = Sum.inl v0 := rootedCycle.getVert_zero + exact hyOutside (hyv0.symm ▸ hv0Current) + +private theorem helper_firstOutsideLt_469.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E), Sum.inr f ∈ cycleP.walk.support → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), v0 ∈ currentTree → + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (y : V), rootedCycle.getVert (↑firstOutside : ℕ) = Sum.inl y → y ∉ currentTree → + (↑firstOutside : ℕ) < rootedCycle.length := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p pColoring cycleP f hfCycleP currentTree v0 hv0CycleP hv0Current + rootedCycle outsideIndices outsideIndicesNonempty firstOutside y hyAt hyOutside + by_contra hnot + have hiLast : firstOutside.val = rootedCycle.length := by + have := firstOutside.isLt + omega + have hyv0 : y = v0 := by + apply Sum.inl.inj + calc + Sum.inl y = rootedCycle.getVert firstOutside.val := hyAt.symm + _ = rootedCycle.getVert rootedCycle.length := by rw [hiLast] + _ = Sum.inl v0 := rootedCycle.getVert_length + exact hyOutside (hyv0.symm ▸ hv0Current) + +private theorem helper_firstOutsideNotOne_481.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E), Sum.inr f ∈ cycleP.walk.support → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (y : V), rootedCycle.getVert (↑firstOutside : ℕ) = Sum.inl y → (↑firstOutside : ℕ) < + rootedCycle.length → (↑firstOutside : ℕ) ≠ (1 : ℕ) := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p pColoring cycleP f hfCycleP currentTree v0 hv0CycleP rootedCycle + outsideIndices outsideIndicesNonempty firstOutside y hyAt firstOutsideLt hiOne + have hAdj := rootedCycle.adj_getVert_succ (i := 0) (by omega) + have hyOne : rootedCycle.getVert 1 = Sum.inl y := by + simpa [hiOne] using hyAt + rw [rootedCycle.getVert_zero, hyOne] at hAdj + simp [TwoColorIncidenceGraph] at hAdj + +private theorem helper_crossingEdge_492.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (y : V), rootedCycle.getVert (↑firstOutside : ℕ) = Sum.inl y → (TwoColorIncidenceGraph G + (series.data.coloring p.castSucc) gamma delta).Adj (rootedCycle.getVert ((↑firstOutside : + ℕ) - (1 : ℕ))) (rootedCycle.getVert ((↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ))) → + (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) → + ∃ (g : E), rootedCycle.getVert ((↑firstOutside : ℕ) - (1 : ℕ)) = Sum.inr g := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle candidates candidatesNonempty p + pColoring cycleP currentTree v0 hv0CycleP rootedCycle outsideIndices outsideIndicesNonempty + firstOutside y hyAt crossingAdj crossingIndex + cases hnode : rootedCycle.getVert (firstOutside.val - 1) with + | inl v => + exfalso + rw [crossingIndex, hyAt, hnode] at crossingAdj + simp [TwoColorIncidenceGraph] at crossingAdj + | inr g => exact ⟨g, rfl⟩ + +private theorem helper_insideVertex_508.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (g : E), rootedCycle.getVert ((↑firstOutside : ℕ) - (1 : ℕ)) = Sum.inr g → + (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma delta).Adj + (rootedCycle.getVert ((↑firstOutside : ℕ) - (2 : ℕ))) (rootedCycle.getVert ((↑firstOutside + : ℕ) - (2 : ℕ) + (1 : ℕ))) → (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) + - (1 : ℕ) → + ∃ (x : V), rootedCycle.getVert ((↑firstOutside : ℕ) - (2 : ℕ)) = Sum.inl x := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle candidates candidatesNonempty p + pColoring cycleP currentTree v0 hv0CycleP rootedCycle outsideIndices outsideIndicesNonempty + firstOutside g hgAt beforeCrossingAdj beforeCrossingIndex + cases hnode : rootedCycle.getVert (firstOutside.val - 2) with + | inl x => exact ⟨x, rfl⟩ + | inr e => + exfalso + rw [beforeCrossingIndex, hgAt, hnode] at beforeCrossingAdj + simp [TwoColorIncidenceGraph] at beforeCrossingAdj + +private theorem helper_hxCurrent_517.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E), Sum.inr f ∈ cycleP.walk.support → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; ( + ∀ (i : Fin (rootedCycle.length + (1 : ℕ))), (↑i : ℕ) < (↑firstOutside : ℕ) → + ∀ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v → v ∈ currentTree) → (↑firstOutside : ℕ) < + rootedCycle.length → (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) → + (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) - (1 : ℕ) → + ∀ (x : V), rootedCycle.getVert ((↑firstOutside : ℕ) - (2 : ℕ)) = Sum.inl x → x ∈ currentTree + := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p pColoring cycleP f hfCycleP currentTree v0 hv0CycleP rootedCycle + outsideIndices outsideIndicesNonempty firstOutside beforeFirstOutside firstOutsideLt + crossingIndex beforeCrossingIndex x hxAt + apply beforeFirstOutside + (⟨firstOutside.val - 2, Nat.lt_succ_of_le + ((Nat.sub_le _ _).trans (Nat.le_of_lt firstOutsideLt))⟩ : + Fin (rootedCycle.length + 1)) + (show firstOutside.val - 2 < firstOutside.val by omega) x + simpa using hxAt + +private theorem helper_returnPrefixPositive_550.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E), Sum.inr f ∈ cycleP.walk.support → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); outsideIndices.Nonempty → + ∀ (g : E) (hgRooted : Sum.inr g ∈ rootedCycle.support), + let returnPrefix : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inr g) := rootedCycle.takeUntil (Sum.inr g) hgRooted; (0 : + ℕ) < returnPrefix.length := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p pColoring cycleP f hfCycleP currentTree v0 hv0CycleP rootedCycle + outsideIndices outsideIndicesNonempty g hgRooted returnPrefix + by_contra hnot + have hzero : returnPrefix.length = 0 := by omega + have hget := rootedCycle.getVert_length_takeUntil hgRooted + rw [hzero, rootedCycle.getVert_zero] at hget + cases hget + +private theorem helper_returnPrefixLength_556.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E), Sum.inr f ∈ cycleP.walk.support → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + rootedCycle.IsCycle → + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; (↑firstOutside : ℕ) < rootedCycle.length → (2 : ℕ) ≤ + (↑firstOutside : ℕ) → (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) → + ∀ (g : E), rootedCycle.getVert ((↑firstOutside : ℕ) - (1 : ℕ)) = Sum.inr g → (↑firstOutside : + ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) - (1 : ℕ) → + ∀ (hgRooted : Sum.inr g ∈ rootedCycle.support), + let returnPrefix : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inr g) := rootedCycle.takeUntil (Sum.inr g) hgRooted; (0 : + ℕ) < returnPrefix.length → returnPrefix.length = (↑firstOutside : ℕ) - (1 : ℕ) := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p pColoring cycleP f hfCycleP currentTree v0 hv0CycleP rootedCycle + rootedIsCycle outsideIndices outsideIndicesNonempty firstOutside firstOutsideLt + firstOutsideAtLeastTwo crossingIndex g hgAt beforeCrossingIndex hgRooted returnPrefix + returnPrefixPositive + have hprefixLe := rootedCycle.length_takeUntil_le_length hgRooted + apply rootedIsCycle.getVert_injOn + (by simp only [Set.mem_ofPred_eq]; exact ⟨returnPrefixPositive, hprefixLe⟩) + (by simp only [Set.mem_ofPred_eq]; constructor <;> omega) + calc + rootedCycle.getVert returnPrefix.length = Sum.inr g := + rootedCycle.getVert_length_takeUntil hgRooted + _ = rootedCycle.getVert (firstOutside.val - 1) := hgAt.symm + +private theorem helper_returnPathOnCycle_565.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + ∀ (g : E) (hgRooted : Sum.inr g ∈ rootedCycle.support), + let returnPrefix : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inr g) := rootedCycle.takeUntil (Sum.inr g) hgRooted; + let returnPath : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma delta).Walk + (Sum.inr g) (Sum.inl v0) := returnPrefix.reverse; + ∀ z ∈ returnPath.support, z ∈ cycleP.walk.support := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle candidates candidatesNonempty p + pColoring cycleP v0 hv0CycleP rootedCycle g hgRooted returnPrefix returnPath z hz + have hzPrefix : z ∈ returnPrefix.support := by + simpa [returnPath, SimpleGraph.Walk.support_reverse] using hz + have hzRooted := rootedCycle.support_takeUntil_subset_support hgRooted hzPrefix + exact (cycleP.walk.mem_support_rotate_iff (Sum.inl v0) hv0CycleP).mp hzRooted + +private theorem helper_returnPathInternal_572.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E), Sum.inr f ∈ cycleP.walk.support → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; ( + ∀ (i : Fin (rootedCycle.length + (1 : ℕ))), (↑i : ℕ) < (↑firstOutside : ℕ) → + ∀ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v → v ∈ currentTree) → (↑firstOutside : ℕ) < + rootedCycle.length → (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) → + ∀ (g : E), (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) - (1 : ℕ) → + ∀ (hgRooted : Sum.inr g ∈ rootedCycle.support), + let returnPrefix : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inr g) := rootedCycle.takeUntil (Sum.inr g) hgRooted; + let returnPath : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma delta).Walk + (Sum.inr g) (Sum.inl v0) := returnPrefix.reverse; returnPrefix.length = (↑firstOutside : + ℕ) - (1 : ℕ) → + ∀ (v : V), Sum.inl v ∈ returnPath.support → v ∈ currentTree := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p pColoring cycleP f hfCycleP currentTree v0 hv0CycleP rootedCycle + outsideIndices outsideIndicesNonempty firstOutside beforeFirstOutside firstOutsideLt + crossingIndex g beforeCrossingIndex hgRooted returnPrefix returnPath returnPrefixLength v hv + have hvPrefix : Sum.inl v ∈ returnPrefix.support := by + simpa [returnPath, SimpleGraph.Walk.support_reverse] using hv + obtain ⟨m, hm, hmle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hvPrefix + have hmRooted : rootedCycle.getVert m = Sum.inl v := by + rw [← rootedCycle.getVert_takeUntil hgRooted hmle] + exact hm + have hmFirst : m < firstOutside.val := by + rw [returnPrefixLength] at hmle + omega + apply beforeFirstOutside + (⟨m, by omega⟩ : Fin (rootedCycle.length + 1)) hmFirst v hmRooted + +private theorem helper_interveningForCertificate_587.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (r : Fin rounds) (gamma delta : Fin k) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta), (↑r : ℕ) + (1 : ℕ) < + rounds → + let candidates : Finset (Fin rounds) := ({q : Fin rounds | (↑r : ℕ) < (↑q : ℕ) ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE} : Finset (Fin rounds)); + ∀ (candidatesNonempty : candidates.Nonempty), + let p : Fin rounds := candidates.min' candidatesNonempty; ( + ∀ (j : Fin rounds), (↑r : ℕ) < (↑j : ℕ) → (↑j : ℕ) < (↑p : ℕ) → series.data.kind j.succ = some + TashkinovExtensionKind.RE) → + ∀ (pColoring : series.data.coloring p.castSucc = series.data.coloring r.succ), + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := @Eq.rec + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ + rounds r)) (fun (x : PartialEdgeColoring E k) (_ : @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) x) ↦ @TwoColorCycle V E G k x + gamma delta) cycle (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data + V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds p)) (@Eq.symm + (PartialEdgeColoring E k) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds p)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.succ rounds r)) pColoring); + ∀ (f : E), Sum.inr f ∈ cycleP.walk.support → + let currentTree : Finset V := TreeSequenceVertexSet (series.data.tree p.succ.castSucc); + ∀ (v0 : V) (hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G (series.data.coloring p.castSucc) gamma + delta).Walk (Sum.inl v0) (Sum.inl v0) := cycleP.walk.rotate (Sum.inl v0) hv0CycleP; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); outsideIndices.Nonempty → + ∀ (g : E), Sum.inr g ∈ rootedCycle.support → + ∀ (j : Fin (rounds + (1 : ℕ))), (0 : ℕ) < (↑j : ℕ) → (↑r.succ : ℕ) < (↑j : ℕ) → (↑j : ℕ) ≤ + (↑p.castSucc : ℕ) → series.data.kind j = some TashkinovExtensionKind.RE := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta cycle hrTerminalLt candidates + candidatesNonempty p betweenRE pColoring cycleP f hfCycleP currentTree v0 hv0CycleP + rootedCycle outsideIndices outsideIndicesNonempty g hgRooted j hjPositive hrj hjp + simp only [Fin.val_succ, Fin.val_castSucc] at hrj hjp + let q : Fin rounds := ⟨j.val - 1, by omega⟩ + have hqSucc : q.succ = j := by + apply Fin.ext + simp [q] + omega + rw [← hqSucc] + apply betweenRE q + · simp [q] + omega + · simp [q] + omega + +private theorem helper_continuation_1518.{u_1, u_2} : + helperContinuation1518Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k rounds e0 input series r gamma delta hkindr hgammar hdeltar cycle hmeets + hrTerminalLt candidates candidatesNonempty p hrp betweenRE pColoring cycleP cyclePSupport + treeSubset pNoRevisiting f hfNotInternal hfCycleP edgeIdentity edgeCycle a ha hfa b hb hfb + hab hfEndsAB + let currentTree := TreeSequenceVertexSet (series.data.tree p.succ.castSucc) + have outsideOnCycle : ∃ y : V, y ∉ currentTree ∧ Sum.inl y ∈ cycleP.walk.support := by + exact @helper_outsideOnCycle_401 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) + (@candidatesNonempty) (@pColoring) (@f) (@hfNotInternal) (@hfCycleP) (@a) (@ha) (@hfa) + (@b) (@hb) (@hfb) (@hab) (@hfEndsAB) + obtain ⟨v0, hv0Earlier, hv0Cycle⟩ := hmeets + have hv0CycleP : Sum.inl v0 ∈ cycleP.walk.support := by + rw [cyclePSupport] + exact hv0Cycle + have hv0Current : v0 ∈ currentTree := treeSubset hv0Earlier + obtain ⟨outsideVertex, outsideVertexNotCurrent, outsideVertexCycle⟩ := outsideOnCycle + let rootedCycle := cycleP.walk.rotate (Sum.inl v0) hv0CycleP + have rootedIsCycle : rootedCycle.IsCycle := cycleP.isCycle.rotate hv0CycleP + have outsideVertexRooted : Sum.inl outsideVertex ∈ rootedCycle.support := by + apply (cycleP.walk.mem_support_rotate_iff (Sum.inl v0) hv0CycleP).mpr + exact outsideVertexCycle + let outsideIndices : Finset (Fin (rootedCycle.length + 1)) := + Finset.univ.filter fun i => ∃ v : V, + rootedCycle.getVert i.val = Sum.inl v ∧ v ∉ currentTree + have outsideIndicesNonempty : outsideIndices.Nonempty := by + exact @helper_outsideIndicesNonempty_437 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) + (@hrTerminalLt) (@candidatesNonempty) (@pColoring) (@f) (@hfCycleP) (@v0) (@hv0CycleP) + (@outsideVertex) (@outsideVertexNotCurrent) (@outsideVertexRooted) + let firstOutside : Fin (rootedCycle.length + 1) := + outsideIndices.min' outsideIndicesNonempty + have firstOutsideSpec : ∃ y : V, + rootedCycle.getVert firstOutside.val = Sum.inl y ∧ y ∉ currentTree := + (Finset.mem_filter.mp + (Finset.min'_mem outsideIndices outsideIndicesNonempty)).2 + obtain ⟨y, hyAt, hyOutside⟩ := firstOutsideSpec + have beforeFirstOutside : ∀ i : Fin (rootedCycle.length + 1), + i.val < firstOutside.val → ∀ v : V, + rootedCycle.getVert i.val = Sum.inl v → v ∈ currentTree := by + exact @helper_beforeFirstOutside_450 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@hrTerminalLt) + (@candidatesNonempty) (@pColoring) (@f) (@hfCycleP) (@v0) (@hv0CycleP) + (@outsideIndicesNonempty) + have firstOutsidePositive : 0 < firstOutside.val := by + exact @helper_firstOutsidePositive_459 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) + (@hrTerminalLt) (@candidatesNonempty) (@pColoring) (@f) (@hfCycleP) (@v0) (@hv0CycleP) + (@hv0Current) (@outsideIndicesNonempty) (@y) (@hyAt) (@hyOutside) + have firstOutsideLt : firstOutside.val < rootedCycle.length := by + exact @helper_firstOutsideLt_469 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@hrTerminalLt) + (@candidatesNonempty) (@pColoring) (@f) (@hfCycleP) (@v0) (@hv0CycleP) (@hv0Current) + (@outsideIndicesNonempty) (@y) (@hyAt) (@hyOutside) + have firstOutsideNotOne : firstOutside.val ≠ 1 := by + exact @helper_firstOutsideNotOne_481 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@hrTerminalLt) + (@candidatesNonempty) (@pColoring) (@f) (@hfCycleP) (@v0) (@hv0CycleP) + (@outsideIndicesNonempty) (@y) (@hyAt) (@firstOutsideLt) + have firstOutsideAtLeastTwo : 2 ≤ firstOutside.val := by omega + have crossingAdj := rootedCycle.adj_getVert_succ + (i := firstOutside.val - 1) (by omega) + have crossingIndex : firstOutside.val - 1 + 1 = firstOutside.val := by omega + have crossingEdge : ∃ g : E, + rootedCycle.getVert (firstOutside.val - 1) = Sum.inr g := by + exact @helper_crossingEdge_492 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@candidatesNonempty) + (@pColoring) (@v0) (@hv0CycleP) (@outsideIndicesNonempty) (@y) (@hyAt) (@crossingAdj) + (@crossingIndex) + obtain ⟨g, hgAt⟩ := crossingEdge + have hgy : Incident G y g := by + rw [crossingIndex, hyAt, hgAt] at crossingAdj + simpa [TwoColorIncidenceGraph] using crossingAdj.1 + have beforeCrossingAdj := rootedCycle.adj_getVert_succ + (i := firstOutside.val - 2) (by omega) + have beforeCrossingIndex : firstOutside.val - 2 + 1 = + firstOutside.val - 1 := by omega + have insideVertex : ∃ x : V, + rootedCycle.getVert (firstOutside.val - 2) = Sum.inl x := by + exact @helper_insideVertex_508 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@candidatesNonempty) + (@pColoring) (@v0) (@hv0CycleP) (@outsideIndicesNonempty) (@g) (@hgAt) + (@beforeCrossingAdj) (@beforeCrossingIndex) + obtain ⟨x, hxAt⟩ := insideVertex + have hxCurrent : x ∈ currentTree := by + exact @helper_hxCurrent_517 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@hrTerminalLt) + (@candidatesNonempty) (@pColoring) (@f) (@hfCycleP) (@v0) (@hv0CycleP) + (@outsideIndicesNonempty) (@beforeFirstOutside) (@firstOutsideLt) (@crossingIndex) + (@beforeCrossingIndex) (@x) (@hxAt) + have hxg : Incident G x g := by + rw [beforeCrossingIndex, hgAt, hxAt] at beforeCrossingAdj + simpa [TwoColorIncidenceGraph] using beforeCrossingAdj.1 + have hxy : x ≠ y := by + intro h + exact hyOutside (h ▸ hxCurrent) + have hgEnds : G.ends g = s(x, y) := + edgeIdentity (by simpa [Incident] using hxg) (by simpa [Incident] using hgy) hxy + have hgBoundary : g ∈ BoundaryEdges G currentTree := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxCurrent, y, hyOutside, hgEnds⟩ + have hgRooted : Sum.inr g ∈ rootedCycle.support := by + rw [← hgAt] + exact rootedCycle.getVert_mem_support (firstOutside.val - 1) + have hgCycleP : Sum.inr g ∈ cycleP.walk.support := by + apply (cycleP.walk.mem_support_rotate_iff (Sum.inl v0) hv0CycleP).mp + exact hgRooted + have hyCycleP : Sum.inl y ∈ cycleP.walk.support := by + apply (cycleP.walk.mem_support_rotate_iff (Sum.inl v0) hv0CycleP).mp + rw [← hyAt] + exact rootedCycle.getVert_mem_support firstOutside.val + let returnPrefix := rootedCycle.takeUntil (Sum.inr g) hgRooted + let returnPath := returnPrefix.reverse + have returnPrefixPath : returnPrefix.IsPath := + rootedIsCycle.isPath_takeUntil hgRooted + have returnPathIsPath : returnPath.IsPath := returnPrefixPath.reverse + have returnPrefixPositive : 0 < returnPrefix.length := by + exact @helper_returnPrefixPositive_550 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) + (@hrTerminalLt) (@candidatesNonempty) (@pColoring) (@f) (@hfCycleP) (@v0) (@hv0CycleP) + (@outsideIndicesNonempty) (@g) (@hgRooted) + have returnPrefixLength : returnPrefix.length = firstOutside.val - 1 := by + exact @helper_returnPrefixLength_556 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@hrTerminalLt) + (@candidatesNonempty) (@pColoring) (@f) (@hfCycleP) (@v0) (@hv0CycleP) (@rootedIsCycle) + (@outsideIndicesNonempty) (@firstOutsideLt) (@firstOutsideAtLeastTwo) (@crossingIndex) + (@g) (@hgAt) (@beforeCrossingIndex) (@hgRooted) (@returnPrefixPositive) + have returnPathOnCycle : ∀ z ∈ returnPath.support, + z ∈ cycleP.walk.support := by + exact @helper_returnPathOnCycle_565 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) + (@candidatesNonempty) (@pColoring) (@v0) (@hv0CycleP) (@g) (@hgRooted) + have returnPathInternal : ∀ v, Sum.inl v ∈ returnPath.support → + v ∈ currentTree := by + exact @helper_returnPathInternal_572 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@hrTerminalLt) + (@candidatesNonempty) (@pColoring) (@f) (@hfCycleP) (@v0) (@hv0CycleP) + (@outsideIndicesNonempty) (@beforeFirstOutside) (@firstOutsideLt) (@crossingIndex) (@g) + (@beforeCrossingIndex) (@hgRooted) (@returnPrefixLength) + have interveningForCertificate : ∀ j : Fin (rounds + 1), + 0 < j.val → r.succ.val < j.val → j.val ≤ p.castSucc.val → + series.data.kind j = some TashkinovExtensionKind.RE := by + exact @helper_interveningForCertificate_587 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) + (@cycle) (@hrTerminalLt) (@candidatesNonempty) (@betweenRE) (@pColoring) (@f) (@hfCycleP) + (@v0) (@hv0CycleP) (@outsideIndicesNonempty) (@g) (@hgRooted) + have cert : RevisitingExtensionCertificate series.data p.castSucc := { + earlier := r.succ + earlierPositive := by simp + earlierAtMost := by simp; omega + earlierPE := hkindr + interveningRevisiting := interveningForCertificate + gamma := gamma + delta := delta + earlierGamma := hgammar + earlierDelta := hdeltar + cycle := cycleP + meetsEarlier := by + exact ⟨v0, hv0Earlier, hv0CycleP⟩ + leavesCurrent := by + exact ⟨y, by simpa [currentTree] using hyOutside, + hyCycleP⟩ + edge := g + edgeOnCycle := hgCycleP + edgeBoundary := by simpa [currentTree] using hgBoundary + insideEndpoint := x + outsideEndpoint := y + insideInCurrent := by simpa [currentTree] using hxCurrent + outsideNotCurrent := by simpa [currentTree] using hyOutside + edgeEnds := hgEnds + returnVertex := v0 + returnInEarlier := hv0Earlier + returnPath := returnPath + returnPathIsPath := returnPathIsPath + returnPathOnCycle := returnPathOnCycle + returnPathInternal := by + intro v hv + simpa [currentTree] using returnPathInternal v hv + } + exact pNoRevisiting ⟨cert⟩ + +theorem EarlierPECycleFirstNonrevisitingInternal {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) + (r : Fin rounds) (hrEarlier : r.succ ≠ Fin.last rounds) + (gamma delta : Fin k) + (hkindr : series.data.kind r.succ = some TashkinovExtensionKind.PE) + (hgammar : series.data.gamma r.succ = some gamma) + (hdeltar : series.data.delta r.succ = some delta) + (cycle : TwoColorCycle G (series.data.coloring r.succ) gamma delta) + (hmeets : ∃ v ∈ TreeSequenceVertexSet + (series.data.tree r.succ.castSucc), + Sum.inl v ∈ cycle.walk.support) + (hterminal : series.data.kind (Fin.last rounds) = + some TashkinovExtensionKind.PE) : + ∃ p : Fin rounds, + r.val < p.val ∧ + (series.data.kind p.succ = some TashkinovExtensionKind.SE ∨ + series.data.kind p.succ = some TashkinovExtensionKind.PE) ∧ + (∀ j : Fin rounds, + r.val < j.val → + j.val < p.val → series.data.kind j.succ = some TashkinovExtensionKind.RE) ∧ + series.data.coloring p.castSucc = series.data.coloring r.succ ∧ + ∀ f : E, + Sum.inr f ∈ cycle.walk.support → + f ∈ InternalEdges G (TreeSequenceVertexSet (series.data.tree p.succ.castSucc)) := by + classical + have hrTerminalLt : r.val + 1 < rounds := by + exact @helper_hrTerminalLt_212 (@rounds) (@r) (@hrEarlier) + let terminalIndex : Fin rounds := ⟨rounds - 1, by omega⟩ + have terminalIndexSucc : terminalIndex.succ = Fin.last rounds := by + apply Fin.ext + simp [terminalIndex] + omega + let candidates : Finset (Fin rounds) := Finset.univ.filter fun q => + r.val < q.val ∧ + series.data.kind q.succ ≠ some TashkinovExtensionKind.RE + have terminalMem : terminalIndex ∈ candidates := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, by simp [terminalIndex]; omega, ?_⟩ + rw [terminalIndexSucc, hterminal] + simp + have candidatesNonempty : candidates.Nonempty := ⟨terminalIndex, terminalMem⟩ + let p : Fin rounds := candidates.min' candidatesNonempty + have pMem : p ∈ candidates := Finset.min'_mem candidates candidatesNonempty + have hrp : r.val < p.val := (Finset.mem_filter.mp pMem).2.1 + have pNotRE : series.data.kind p.succ ≠ + some TashkinovExtensionKind.RE := (Finset.mem_filter.mp pMem).2.2 + have betweenRE : ∀ j : Fin rounds, r.val < j.val → j.val < p.val → + series.data.kind j.succ = some TashkinovExtensionKind.RE := by + exact @helper_betweenRE_239 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@r) (@hrTerminalLt) (@candidatesNonempty) + have pKind : series.data.kind p.succ = some TashkinovExtensionKind.SE ∨ + series.data.kind p.succ = some TashkinovExtensionKind.PE := by + exact @helper_pKind_247 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@r) (@candidatesNonempty) (@pNotRE) + have reColoring : ∀ j : Fin rounds, + series.data.kind j.succ = some TashkinovExtensionKind.RE → + series.data.coloring j.succ = series.data.coloring j.castSucc := by + exact @helper_reColoring_116 V E inferInstance inferInstance inferInstance G k rounds e0 + input series r hrTerminalLt candidatesNonempty + have coloringAlong : ∀ n : ℕ, r.val + 1 ≤ n → n ≤ p.val → + ∀ q : Fin (rounds + 1), q.val = n → + series.data.coloring q = series.data.coloring r.succ := by + exact @helper_coloringAlong_276 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@r) (@hrTerminalLt) (@candidatesNonempty) + (@betweenRE) (@reColoring) + have pColoring : series.data.coloring p.castSucc = + series.data.coloring r.succ := by + exact coloringAlong p.val (by omega) (by omega) p.castSucc rfl + let cycleP : TwoColorCycle G (series.data.coloring p.castSucc) gamma delta := + pColoring.symm ▸ cycle + have transportedCycleSupport : ∀ (phi psi : PartialEdgeColoring E k) + (h : phi = psi) (c : TwoColorCycle G psi gamma delta), + (h.symm ▸ c).walk.support = c.walk.support := by + intro phi psi h c + cases h + rfl + have cyclePSupport : cycleP.walk.support = cycle.walk.support := by + exact transportedCycleSupport _ _ pColoring cycle + have stepVertexSubset : ∀ j : Fin rounds, + TreeSequenceVertexSet (series.data.tree j.succ.castSucc) ⊆ + TreeSequenceVertexSet (series.data.tree j.succ.succ) := by + exact @helper_stepVertexSubset_192 V E inferInstance inferInstance + inferInstance G k rounds e0 input series r hrTerminalLt candidatesNonempty + have treeAlong : ∀ n : ℕ, r.val ≤ n → n ≤ p.val → + ∀ q : Fin rounds, q.val = n → + TreeSequenceVertexSet (series.data.tree r.succ.castSucc) ⊆ + TreeSequenceVertexSet (series.data.tree q.succ.castSucc) := by + exact @helper_treeAlong_321 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@r) (@hrTerminalLt) (@candidatesNonempty) + (@stepVertexSubset) + have treeSubset : TreeSequenceVertexSet (series.data.tree r.succ.castSucc) ⊆ + TreeSequenceVertexSet (series.data.tree p.succ.castSucc) := + treeAlong p.val (by omega) (by omega) p rfl + have pNoRevisiting : ¬ Nonempty + (RevisitingExtensionCertificate series.data p.castSucc) := by + exact @helper_pNoRevisiting_258 V E inferInstance inferInstance inferInstance G k rounds e0 + input series r hrTerminalLt candidatesNonempty pNotRE + refine ⟨p, hrp, pKind, betweenRE, pColoring, ?_⟩ + intro f hfCycle + by_contra hfNotInternal + have hfCycleP : Sum.inr f ∈ cycleP.walk.support := by + rw [cyclePSupport] + exact hfCycle + have edgeIdentity : ∀ {z : Sym2 V} {a b : V}, a ∈ z → b ∈ z → a ≠ b → + z = s(a, b) := by + exact @helper_edgeIdentity_353 (@V) + let edgeCycle := cycleP.walk.rotate (Sum.inr f) hfCycleP + have edgeCycleIsCycle : edgeCycle.IsCycle := by + exact cycleP.isCycle.rotate hfCycleP + have edgeCycleLength : 3 ≤ edgeCycle.length := edgeCycleIsCycle.three_le_length + have firstAdj := edgeCycle.adj_getVert_succ (i := 0) (by omega) + have firstVertex : ∃ a : V, edgeCycle.getVert 1 = Sum.inl a := by + exact @helper_firstVertex_365 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@candidatesNonempty) + (@pColoring) (@f) (@hfCycleP) (@firstAdj) + obtain ⟨a, ha⟩ := firstVertex + have hfa : Incident G a f := by + rw [edgeCycle.getVert_zero, ha] at firstAdj + simpa [edgeCycle, TwoColorIncidenceGraph] using firstAdj.1 + have lastAdj := edgeCycle.adj_getVert_succ + (i := edgeCycle.length - 1) (by omega) + have lastVertex : ∃ b : V, + edgeCycle.getVert (edgeCycle.length - 1) = Sum.inl b := by + exact @helper_lastVertex_378 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@hrTerminalLt) + (@candidatesNonempty) (@pColoring) (@f) (@hfCycleP) (@edgeCycleLength) (@lastAdj) + obtain ⟨b, hb⟩ := lastVertex + have hfb : Incident G b f := by + have hidx : edgeCycle.length - 1 + 1 = edgeCycle.length := by omega + rw [hidx, edgeCycle.getVert_length, hb] at lastAdj + simpa [edgeCycle, TwoColorIncidenceGraph] using lastAdj.1 + have hab : a ≠ b := by + exact @helper_hab_392 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@rounds) + (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@cycle) (@candidatesNonempty) + (@pColoring) (@f) (@hfCycleP) (@edgeCycleIsCycle) (@a) (@ha) (@b) (@hb) + have hfEndsAB : G.ends f = s(a, b) := + edgeIdentity (by simpa [Incident] using hfa) (by simpa [Incident] using hfb) hab + exact @helper_continuation_1518 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@r) (@gamma) (@delta) (@hkindr) (@hgammar) (@hdeltar) + (@cycle) (@hmeets) (@hrTerminalLt) (@candidatesNonempty) (@hrp) (@betweenRE) (@pColoring) + (@cyclePSupport) (@treeSubset) (@pNoRevisiting) (@f) (@hfNotInternal) (@hfCycleP) + (@edgeIdentity) (@a) (@ha) (@hfa) (@b) (@hb) (@hfb) (@hab) (@hfEndsAB) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Elementary.lean b/LeanPool/GoldbergSeymour/Elementary.lean new file mode 100644 index 0000000000..deece782d6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Elementary.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChromaticIndex +public import LeanPool.GoldbergSeymour.DensityCeil + +/-! +# Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The chromatic index equals the ceiling of the odd-set density. -/ +def Elementary {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) : Prop := + ChromaticIndex G = DensityCeil G + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean new file mode 100644 index 0000000000..4b70ff7f19 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean @@ -0,0 +1,960 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.TreeMissingColors + +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint + +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent + +/-! +# Elementary Closed Exit Pair Distinct Components + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ElementaryClosedExitPairDistinctComponents_missing_leaf_104.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → + ∀ (a b : Fin k), + let H := TwoColorIncidenceGraph G phi a b; + ∀ (v : V), a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v → (H.neighborSet (Sum.inl + v)).Subsingleton := by + classical + intro V E _ _ G k phi hproper a b H v hmissing z hz w hw + let _ := Fintype.ofFinite V + cases hzv : z with + | inl u => + rw [hzv] at hz + simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz + | inr e => + cases hwv : w with + | inl u => + rw [hwv] at hw + simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw + | inr f => + rw [hzv] at hz + rw [hwv] at hw + have he : Incident G v e ∧ + (phi e = some a ∨ phi e = some b) := by + simpa [H, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hz + have hf : Incident G v f ∧ + (phi f = some a ∨ phi f = some b) := by + simpa [H, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hw + apply congrArg Sum.inr + by_contra hef + rcases hmissing with ha | hb + · have hna : a ∉ PresentColors G phi v := by + simpa [MissingColors] using ha + have hea : phi e = some b := he.2.resolve_left (by + intro hea + apply hna + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some a from + ⟨e, he.1, hea⟩)) + have hfa : phi f = some b := hf.2.resolve_left (by + intro hfa + apply hna + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some a from + ⟨f, hf.1, hfa⟩)) + exact (hproper hef ⟨v, he.1, hf.1⟩ hea) hfa + · have hnb : b ∉ PresentColors G phi v := by + simpa [MissingColors] using hb + have heb : phi e = some a := he.2.resolve_right (by + intro heb + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some b from + ⟨e, he.1, heb⟩)) + have hfb : phi f = some a := hf.2.resolve_right (by + intro hfb + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some b from + ⟨f, hf.1, hfb⟩)) + exact (hproper hef ⟨v, he.1, hf.1⟩ heb) hfb + +private theorem ElementaryClosedExitPairDistinctComponents_fullPathFromLeaf_172.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : + ℕ} (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → ∀ (a b : Fin k), a ≠ b → + let H := TwoColorIncidenceGraph G phi a b; (∀ (v : V), (H.neighborSet (Sum.inl + v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v) → ∀ (v : V) (c : + V ⊕ E), Sum.inl v ∈ TwoColorComponent G phi a b c → (H.neighborSet (Sum.inl + v)).Subsingleton → (∃ (e : E), Sum.inr e ∈ TwoColorComponent G phi a b c) → ∃ (s : V) (p : + H.Walk (Sum.inl v) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = + TwoColorComponent G phi a b c ∧ v ≠ s ∧ (a ∈ MissingColors G phi s ∨ b ∈ MissingColors G + phi s) := by + classical + intro V E _ _ G k phi hproper a b hne H endpoint_missing v c hvC hvleaf hnontrivial + let _ := Fintype.ofFinite V + obtain ⟨u, w, p, hp, hps⟩ := + TwoColorComponentSpanningPath G phi a b hproper c + have hvP : Sum.inl v ∈ p.support := by + change Sum.inl v ∈ {y | y ∈ p.support} + rw [hps] + exact hvC + have hvEnd : Sum.inl v = u ∨ Sum.inl v = w := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hvleaf) hvP + obtain ⟨t, q, hq, hqs⟩ : ∃ (t : Sum V E) + (q : H.Walk (Sum.inl v) t), + q.IsPath ∧ {y | y ∈ q.support} = + TwoColorComponent G phi a b c := by + rcases hvEnd with hvu | hvw + · subst u + exact ⟨w, p, hp, hps⟩ + · subst w + refine ⟨u, p.reverse, hp.reverse, ?_⟩ + ext y + change y ∈ p.reverse.support ↔ + y ∈ TwoColorComponent G phi a b c + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] + exact Set.ext_iff.mp hps y + have hqnon : ¬ q.Nil := by + intro hnil + obtain ⟨e, heC⟩ := hnontrivial + have heQ : Sum.inr e ∈ q.support := by + change Sum.inr e ∈ {y | y ∈ q.support} + rw [hqs] + exact heC + rw [SimpleGraph.Walk.nil_iff_support_eq.mp hnil] at heQ + simp at heQ + have hend_neighbor : ∀ y, H.Adj t y → + y = q.getVert (q.length - 1) := by + intro y hty + have hyC : y ∈ TwoColorComponent G phi a b c := by + have htC : t ∈ TwoColorComponent G phi a b c := by + rw [← hqs] + change t ∈ q.support + simpa only [q.getVert_length] using + q.getVert_mem_support q.length + change H.connectedComponentMk y = H.connectedComponentMk c + change H.connectedComponentMk t = H.connectedComponentMk c at htC + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hty).symm.trans htC + have hySupport : y ∈ q.support := by + change y ∈ {z | z ∈ q.support} + rw [hqs] + exact hyC + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hySupport + have hnlt : n < q.length := by + have hnne : n ≠ q.length := by + intro heq + have hyt : y = t := by rw [← hn, heq, q.getVert_length] + exact hty.ne hyt.symm + omega + by_cases hpen : n + 1 = q.length + · rw [← hn] + congr 1 + omega + by_cases hn0 : n = 0 + · have hnext : H.Adj (Sum.inl v) (q.getVert 1) := by + simpa [hn0, q.getVert_zero] using q.adj_getVert_succ hnlt + have htstart : H.Adj (Sum.inl v) t := by + rw [← hn, hn0, q.getVert_zero] at hty + exact hty.symm + have hneNext : q.getVert 1 ≠ t := by + intro heq + have hindices := hq.getVert_injOn + (show 1 ≤ q.length by omega) (show q.length ≤ q.length by rfl) + (heq.trans q.getVert_length.symm) + omega + exact False.elim (hneNext (hvleaf hnext htstart)) + · have hleft : H.Adj y (q.getVert (n - 1)) := by + rw [← hn] + have hadj := q.adj_getVert_succ (i := n - 1) (by omega) + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ n)] using + hadj.symm + have hright : H.Adj y (q.getVert (n + 1)) := by + rw [← hn] + exact q.adj_getVert_succ hnlt + have htneLeft : t ≠ q.getVert (n - 1) := by + intro heq + have hindices := hq.getVert_injOn + (show q.length ≤ q.length by rfl) + (show n - 1 ≤ q.length by omega) + (q.getVert_length.trans heq) + omega + have htneRight : t ≠ q.getVert (n + 1) := by + intro heq + have hindices := hq.getVert_injOn + (show q.length ≤ q.length by rfl) + (show n + 1 ≤ q.length by omega) + (q.getVert_length.trans heq) + omega + have hlrne : q.getVert (n - 1) ≠ q.getVert (n + 1) := by + intro heq + have hindices := hq.getVert_injOn + (show n - 1 ≤ q.length by omega) + (show n + 1 ≤ q.length by omega) heq + omega + let : Fintype (H.neighborSet y) := Fintype.ofFinite _ + have hthree : 3 ≤ @SimpleGraph.degree _ H y + (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let ss : Finset (Sum V E) := + {t, q.getVert (n - 1), q.getVert (n + 1)} + have hss : ss ⊆ H.neighborFinset y := by + intro r hr + simp only [ss, Finset.mem_insert, Finset.mem_singleton] at hr + rcases hr with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hty.symm + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc3 : 3 ≤ ss.card := by + simp [ss, htneLeft, htneRight, hlrne] + exact hc3.trans (Finset.card_le_card hss) + have htwo : @SimpleGraph.degree _ H y + (Fintype.ofFinite _) ≤ 2 := by + simpa [H] using + TwoColorIncidenceDegreeAtMostTwo G phi a b hproper y + omega + have hendLeaf : Set.Subsingleton (H.neighborSet t) := by + intro y hy y' hy' + exact (hend_neighbor y hy).trans (hend_neighbor y' hy').symm + have hqpos : 0 < q.length := + SimpleGraph.Walk.not_nil_iff_lt_length.mp hqnon + have hendVertex : ∃ s : V, t = Sum.inl s := by + cases ht : t with + | inl s => exact ⟨s, rfl⟩ + | inr e => + have hlastAdj : H.Adj (q.getVert (q.length - 1)) t := by + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ q.length), + q.getVert_length] using + q.adj_getVert_succ (i := q.length - 1) (by omega) + have hecolor : phi e = some a ∨ phi e = some b := by + cases hprev : q.getVert (q.length - 1) with + | inl r => + rw [hprev, ht] at hlastAdj + have hdata : Incident G r e ∧ + (phi e = some a ∨ phi e = some b) := by + simpa [H, TwoColorIncidenceGraph] using hlastAdj + exact hdata.2 + | inr f => + rw [hprev, ht] at hlastAdj + have : False := by + simp [H, TwoColorIncidenceGraph] at hlastAdj + exact this.elim + induction hends : G.ends e using Sym2.inductionOn with + | _ r s => + have hrs : r ≠ s := by + intro hrs + subst s + exact G.loopless e r hends + have hrAdj : H.Adj t (Sum.inl r) := by + rw [ht] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G r e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨by simp [Incident, hends], hecolor⟩) + have hsAdj : H.Adj t (Sum.inl s) := by + rw [ht] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G s e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨by simp [Incident, hends], hecolor⟩) + exact False.elim + (hrs (Sum.inl.inj (hendLeaf hrAdj hsAdj))) + obtain ⟨s, hs⟩ := hendVertex + subst t + have hvs : v ≠ s := by + intro hvs + apply hqnon + exact hq.nil_iff_eq.mpr (by simp [hvs]) + exact ⟨s, q, hq, hqs, hvs, endpoint_missing s hendLeaf⟩ + +private theorem ElementaryClosedExitPairDistinctComponents_chooseFirst_361.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E + k) (a b : Fin k), + a ≠ b → + let H := TwoColorIncidenceGraph G phi a b; + ∀ {u v : V ⊕ E} (p : H.Walk u v) (S : Finset (V ⊕ E)), + {x ∈ S | x ∈ p.support}.Nonempty → + ∃ x ∈ S, ∃ (hx : x ∈ p.support), ∀ t ∈ S, t ∈ (p.takeUntil x hx).support → t = x := by + classical + intro V E _ _ _ _ G k phi a b hne H u v p S hnonempty + let := Fintype.ofFinite V + let := Fintype.ofFinite E + have firstErase : ∃ x ∈ S, ∃ (hx : x ∈ p.support), + {t ∈ S.erase x | t ∈ (p.takeUntil x hx).support} = ∅ := by + simp only [← Finset.subset_empty] + induction hn : p.length + S.card using Nat.strong_induction_on + generalizing S v with + | _ n ih => + simp only [Finset.Nonempty, Finset.mem_filter] at hnonempty + obtain ⟨x, hxS, hxP⟩ := hnonempty + obtain hempty | hmore := Finset.eq_empty_or_nonempty + {t ∈ S.erase x | t ∈ (p.takeUntil x hxP).support} + · exact ⟨x, hxS, hxP, hempty.le⟩ + · have hlt : (p.takeUntil x hxP).length + + (S.erase x).card < n := by + rw [← Finset.card_erase_add_one hxS] at hn + have hle := p.length_takeUntil_le_length hxP + omega + obtain ⟨y, hyS, hyP, hyempty⟩ := + ih _ hlt (p.takeUntil x hxP) (S.erase x) hmore rfl + refine ⟨y, Finset.mem_of_mem_erase hyS, + p.support_takeUntil_subset_support hxP hyP, ?_⟩ + rwa [p.takeUntil_takeUntil, Finset.erase_right_comm, + Finset.filter_erase, Finset.erase_eq_of_notMem] at hyempty + simp only [Finset.mem_filter, Finset.mem_erase, ne_eq, not_and, + and_imp] + rintro hxy - + exact p.notMem_support_takeUntil_support_takeUntil_subset + (Ne.symm hxy) hxP hyP + obtain ⟨x, hxS, hxP, hempty⟩ := firstErase + refine ⟨x, hxS, hxP, ?_⟩ + suffices {t ∈ S | t ∈ (p.takeUntil x hxP).support} ⊆ {x} by + simpa [Finset.subset_iff] using this + rwa [Finset.filter_erase, ← Finset.subset_empty, + ← Finset.subset_insert_iff, LawfulSingleton.insert_empty_eq] at hempty + +private theorem ElementaryClosedExitPairDistinctComponents_firstEntry_400.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) {k : ℕ} {e0 : E} (T : TreeSequence G e0) (phi : + PartialEdgeColoring E k) (a b : Fin k), a ≠ b → TreeColorSetClosed G phi T {a} → + let H := TwoColorIncidenceGraph G phi a b; + let X := TreeSequenceVertexSet T; ( + ∀ {u v : V ⊕ E} (p : H.Walk u v) (S : Finset (V ⊕ E)), {x ∈ S | x ∈ p.support}.Nonempty → + ∃ x ∈ S, + ∃ (hx : x ∈ p.support), + ∀ t ∈ S, t ∈ (p.takeUntil x hx).support → t = x) → + ∀ (r s : V) (Q : H.Walk (Sum.inl r) (Sum.inl s)), Q.IsPath → a ∈ MissingColors G phi r ∨ b ∈ + MissingColors G phi r → r ∉ X → ( + ∃ x ∈ X, Sum.inl x ∈ Q.support) → + ∃ (c : V) (_ : c ∈ X) (hcQ : Sum.inl c ∈ Q.support), + let L := Q.takeUntil (Sum.inl c) hcQ; TreeExitPath T phi a b r c L ∧ + ∃ (g : E), L.getVert (L.length - 1) = Sum.inr g ∧ Incident G c g ∧ g ∈ BoundaryEdges G X ∧ phi + g = some b := by + classical + intro V E _ _ _ _ G k e0 T phi a b hne hclosed H X chooseFirst r s Q hQ hmissing hrX hmeet + let S : Finset (Sum V E) := X.image Sum.inl + obtain ⟨q, hqS, hqQ, hqfirst⟩ := + chooseFirst Q S (by + obtain ⟨x, hxX, hxQ⟩ := hmeet + exact ⟨Sum.inl x, by simp [S, hxX, hxQ]⟩) + obtain ⟨c, hcX, hcq⟩ : ∃ c, c ∈ X ∧ Sum.inl c = q := by + simpa [S] using hqS + subst q + let L := Q.takeUntil (Sum.inl c) hqQ + have hLc : ∀ x ∈ X, (Sum.inl x ∈ L.support ↔ x = c) := by + intro x hxX + constructor + · intro hxL + have heq := hqfirst (Sum.inl x) (by simp [S, hxX]) hxL + exact Sum.inl.inj heq + · rintro rfl + exact L.end_mem_support + have hrc : r ≠ c := by + intro hrc + apply hrX + simpa [hrc] using hcX + have hLpath : L.IsPath := hQ.takeUntil _ + have hLlen : 2 ≤ L.length := by + have hpos : 0 < L.length := by + apply Nat.pos_of_ne_zero + intro hn + have hnil : L.Nil := SimpleGraph.Walk.length_eq_zero_iff.mp hn + exact hrc (Sum.inl.inj hnil.eq) + by_contra hnotTwo + have hlen : L.length = 1 := by omega + have hadj := L.adj_getVert_succ (i := 0) (by omega) + have hend : L.getVert 1 = Sum.inl c := by + have heq := L.getVert_length + rwa [hlen] at heq + rw [L.getVert_zero, hend] at hadj + simp [H, TwoColorIncidenceGraph] at hadj + have hExit : TreeExitPath T phi a b r c L := by + unfold TreeExitPath + exact ⟨hLpath, hLlen, hrX, hcX, hmissing, hLc⟩ + have hlastAdj := L.adj_getVert_succ (i := L.length - 1) (by omega) + have hlastSucc : L.length - 1 + 1 = L.length := by omega + rw [hlastSucc, L.getVert_length] at hlastAdj + cases hlast : L.getVert (L.length - 1) with + | inl v => + rw [hlast] at hlastAdj + simp [H, TwoColorIncidenceGraph] at hlastAdj + | inr g => + rw [hlast] at hlastAdj + have hgc : Incident G c g ∧ + (phi g = some a ∨ phi g = some b) := by + simpa [H, TwoColorIncidenceGraph] using hlastAdj + have hprevAdj := L.adj_getVert_succ (i := L.length - 2) (by omega) + have hprevSucc : L.length - 2 + 1 = L.length - 1 := by omega + rw [hprevSucc, hlast] at hprevAdj + cases hprev : L.getVert (L.length - 2) with + | inr f => + rw [hprev] at hprevAdj + simp [H, TwoColorIncidenceGraph] at hprevAdj + | inl x => + rw [hprev] at hprevAdj + have hxg : Incident G x g := by + have hdata : Incident G x g ∧ + (phi g = some a ∨ phi g = some b) := by + simpa [H, TwoColorIncidenceGraph] using hprevAdj + exact hdata.1 + have hxout : x ∉ X := by + intro hxX + have hxc := (hLc x hxX).mp (by + rw [← hprev] + exact L.getVert_mem_support (L.length - 2)) + have heq : L.getVert (L.length - 2) = + L.getVert L.length := by + rw [hprev, L.getVert_length, hxc] + have := hLpath.getVert_injOn (Nat.sub_le _ _) (by simp) heq + omega + have hcx : c ≠ x := by + intro hcx + exact hxout (hcx ▸ hcX) + have hends : G.ends g = s(c, x) := + (Sym2.mem_and_mem_iff hcx).mp ⟨hgc.1, hxg⟩ + have hboundary : g ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨c, hcX, x, hxout, hends⟩ + have hga : phi g ≠ some a := by + intro hga + have hgColor : g ∈ BoundaryColorEdges G phi X a := by + simp [BoundaryColorEdges, hboundary, hga] + have hclosedA : BoundaryColorEdges G phi X a = ∅ := by + dsimp [X] + exact hclosed a (by simp) + rw [hclosedA] at hgColor + simp at hgColor + refine ⟨c, hcX, hqQ, hExit, g, hlast, hgc.1, + hboundary, ?_⟩ + exact hgc.2.resolve_left hga + +private theorem ElementaryClosedExitPairDistinctComponents_pathPrefix_533.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → + let H := TwoColorIncidenceGraph G phi a b; ( + ∀ {u v : V ⊕ E} (p : H.Walk u v) {z : V ⊕ E}, z ∈ p.support → z ∈ TwoColorComponent G phi a b + u) → ( + ∀ {x y z w : V ⊕ E}, H.Adj x y → H.Adj x z → y ≠ z → H.Adj x w → w = y ∨ w = z) → + ∀ {u v w : V} (p : H.Walk (Sum.inl u) (Sum.inl v)) (q : H.Walk (Sum.inl u) (Sum.inl w)), + p.IsPath → q.IsPath → (H.neighborSet (Sum.inl u)).Subsingleton → + {z : V ⊕ E | z ∈ q.support} = TwoColorComponent G phi a b (Sum.inl u) → + ∃ (hvq : Sum.inl v ∈ q.support), p = q.takeUntil (Sum.inl v) hvq := by + classical + intro V E _ _ _ _ G k phi a b hne H walk_support_component neighbor_of_two u v w p q hp hq + huleaf hqs + let := Fintype.ofFinite V + let := Fintype.ofFinite E + have hvC : Sum.inl v ∈ + TwoColorComponent G phi a b (Sum.inl u) := + walk_support_component p p.end_mem_support + have hvq : Sum.inl v ∈ q.support := by + change Sum.inl v ∈ {z | z ∈ q.support} + rw [hqs] + exact hvC + let L := q.takeUntil (Sum.inl v) hvq + have hLpath : L.IsPath := hq.takeUntil _ + have hsync : ∀ n, n ≤ p.length → n ≤ L.length → + p.getVert n = L.getVert n := by + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro hnp hnL + by_cases hn0 : n = 0 + · subst n + simp [L] + by_cases hn1 : n = 1 + · subst n + have hpAdj := p.adj_getVert_succ (i := 0) (by omega) + have hLAdj := L.adj_getVert_succ (i := 0) (by omega) + rw [p.getVert_zero] at hpAdj + rw [L.getVert_zero] at hLAdj + exact huleaf hpAdj hLAdj + · have hcur : p.getVert (n - 1) = L.getVert (n - 1) := + ih (n - 1) (by omega) (by omega) (by omega) + have hprev : p.getVert (n - 2) = L.getVert (n - 2) := + ih (n - 2) (by omega) (by omega) (by omega) + have hpAdj : H.Adj (L.getVert (n - 1)) (p.getVert n) := by + have hadj := p.adj_getVert_succ (i := n - 1) (by omega) + have hsucc : n - 1 + 1 = n := by omega + rw [hsucc, hcur] at hadj + exact hadj + have hLleft : H.Adj (L.getVert (n - 1)) + (L.getVert (n - 2)) := by + have hadj := L.adj_getVert_succ (i := n - 2) (by omega) + have hsucc : n - 2 + 1 = n - 1 := by omega + rw [hsucc] at hadj + exact hadj.symm + have hLright : H.Adj (L.getVert (n - 1)) + (L.getVert n) := by + have hadj := L.adj_getVert_succ (i := n - 1) (by omega) + have hsucc : n - 1 + 1 = n := by omega + rwa [hsucc] at hadj + have hleftRight : L.getVert (n - 2) ≠ L.getVert n := by + intro heq + have hidx := hLpath.getVert_injOn + (show n - 2 ≤ L.length by omega) hnL heq + omega + have hpnextLeft : p.getVert n ≠ L.getVert (n - 2) := by + intro heq + have heq' : p.getVert n = p.getVert (n - 2) := + heq.trans hprev.symm + have hidx := hp.getVert_injOn hnp + (show n - 2 ≤ p.length by omega) heq' + omega + exact (neighbor_of_two hLleft hLright hleftRight hpAdj).resolve_left + hpnextLeft + have hplen : p.length ≤ L.length := by + by_contra hnot + have heq := hsync L.length (by omega) le_rfl + have hverts : p.getVert L.length = p.getVert p.length := by + exact heq.trans (L.getVert_length.trans p.getVert_length.symm) + have hidx := hp.getVert_injOn + (show L.length ≤ p.length by omega) + (show p.length ≤ p.length by rfl) hverts + omega + have hLlen : L.length ≤ p.length := by + by_contra hnot + have heq := hsync p.length le_rfl (by omega) + have hverts : L.getVert p.length = L.getVert L.length := by + exact heq.symm.trans (p.getVert_length.trans L.getVert_length.symm) + have hidx := hLpath.getVert_injOn + (show p.length ≤ L.length by omega) + (show L.length ≤ L.length by rfl) hverts + omega + have hlen : p.length = L.length := hplen.antisymm hLlen + have hpL : p = L := by + apply SimpleGraph.Walk.ext_getVert_le_length hlen + intro n hn + exact hsync n hn (hlen ▸ hn) + exact ⟨hvq, hpL⟩ + +private theorem ElementaryClosedExitPairDistinctComponents_oppositeExit_626.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) {k : ℕ} {e0 : E} (T : TreeSequence G e0) (phi : + PartialEdgeColoring E k), IsProperEdgeColoring G phi → + ∀ (a b : Fin k), a ≠ b → TreeColorSetClosed G phi T {a} → + let H := TwoColorIncidenceGraph G phi a b; + let X := TreeSequenceVertexSet T; ( + ∀ (v : V), a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v → (H.neighborSet (Sum.inl + v)).Subsingleton) → ( + ∀ (r s : V) (Q : H.Walk (Sum.inl r) (Sum.inl s)), Q.IsPath → a ∈ MissingColors G phi r ∨ b ∈ + MissingColors G phi r → r ∉ X → ( + ∃ x ∈ X, Sum.inl x ∈ Q.support) → + ∃ (c : V) (_ : c ∈ X) (hcQ : Sum.inl c ∈ Q.support), + let L := Q.takeUntil (Sum.inl c) hcQ; TreeExitPath T phi a b r c L ∧ + ∃ (g : E), L.getVert (L.length - 1) = Sum.inr g ∧ Incident G c g ∧ g ∈ BoundaryEdges G X ∧ phi + g = some b) → ( + ∀ {u v w : V} (p : H.Walk (Sum.inl u) (Sum.inl v)) (q : H.Walk (Sum.inl u) (Sum.inl w)), + p.IsPath → q.IsPath → (H.neighborSet (Sum.inl u)).Subsingleton → + {z : V ⊕ E | z ∈ q.support} = TwoColorComponent G phi a b (Sum.inl u) → + ∃ (hvq : Sum.inl v ∈ q.support), p = q.takeUntil (Sum.inl v) hvq) → + ∀ (u v s : V) (P : H.Walk (Sum.inl u) (Sum.inl v)) (R : H.Walk (Sum.inl u) (Sum.inl s)), + TreeExitPath T phi a b u v P → R.IsPath → {z : V ⊕ E | z ∈ R.support} = TwoColorComponent + G phi a b (Sum.inl u) → u ≠ s → a ∈ MissingColors G phi s ∨ b ∈ MissingColors G phi s → s + ∉ X → + ∃ (c : V) (L : H.Walk (Sum.inl s) (Sum.inl c)) (f : E), TreeExitPath T phi a b s c L ∧ ( + ∀ z ∈ P.support, z ∉ L.support) ∧ s ≠ u ∧ c ≠ v ∧ f ∈ BoundaryColorEdges G phi X b ∧ Incident + G c f ∧ Sum.inr f ∈ L.support ∧ + ∀ z ∈ L.support, z ∈ TwoColorComponent G phi a b (Sum.inl u) := by + classical + intro V E _ _ _ _ G k e0 T phi hproper a b hne hclosed H X missing_leaf firstEntry pathPrefix u + v s P R hP hRpath hRsupport hus hsMissing hsX + have huLeaf : Set.Subsingleton (H.neighborSet (Sum.inl u)) := + missing_leaf u hP.2.2.2.2.1 + obtain ⟨hvR, hPprefix⟩ := + pathPrefix P R hP.1 hRpath huLeaf hRsupport + obtain ⟨d, hdX, hdP, hExitD, g1, hg1last, hg1d, hg1B, hg1col⟩ := + firstEntry u v P hP.1 hP.2.2.2.2.1 hP.2.2.1 + ⟨v, hP.2.2.2.1, P.end_mem_support⟩ + have hdv : d = v := (hP.2.2.2.2.2 d hdX).mp hdP + subst d + let D := P.takeUntil (Sum.inl v) hdP + have hDlen : D.length = P.length := by + apply (hP.1.getVert_eq_end_iff + (P.length_takeUntil_le_length hdP)).mp + exact P.getVert_length_takeUntil hdP + have hDP : D = P := by + apply SimpleGraph.Walk.ext_getVert_le_length hDlen + intro n hn + exact P.getVert_takeUntil hdP hn + have hg1lastP : P.getVert (P.length - 1) = Sum.inr g1 := by + simpa [D, hDP] using hg1last + have hmeetRev : ∃ x ∈ X, Sum.inl x ∈ R.reverse.support := by + refine ⟨v, hP.2.2.2.1, ?_⟩ + simpa only [SimpleGraph.Walk.support_reverse, List.mem_reverse] using hvR + obtain ⟨c, hcX, hcR, hExit, g3, hg3last, hg3c, hg3B, hg3col⟩ := + firstEntry s u R.reverse hRpath.reverse hsMissing hsX hmeetRev + let L := R.reverse.takeUntil (Sum.inl c) hcR + have hPLe : P.length ≤ R.length := by + rw [hPprefix] + exact R.length_takeUntil_le_length hvR + have hLLe : L.length ≤ R.length := by + have hle := R.reverse.length_takeUntil_le_length hcR + simpa [L] using hle + have hvIdx : R.getVert P.length = Sum.inl v := by + rw [hPprefix] + exact R.getVert_length_takeUntil hvR + have hcIdxRev : R.reverse.getVert L.length = Sum.inl c := by + exact R.reverse.getVert_length_takeUntil hcR + have hcIdx : R.getVert (R.length - L.length) = Sum.inl c := + (SimpleGraph.Walk.getVert_reverse R L.length).symm.trans hcIdxRev + have hg1Idx : R.getVert (P.length - 1) = Sum.inr g1 := by + have hpred : P.length - 1 ≤ + (R.takeUntil (Sum.inl v) hvR).length := by + rw [← hPprefix] + omega + rw [← R.getVert_takeUntil hvR hpred, ← hPprefix] + exact hg1lastP + have hg3IdxRev : R.reverse.getVert (L.length - 1) = Sum.inr g3 := by + have hpred : L.length - 1 ≤ + (R.reverse.takeUntil (Sum.inl c) hcR).length := by + dsimp [L] + omega + rw [← R.reverse.getVert_takeUntil hcR hpred] + exact hg3last + have hg3Idx : R.getVert (R.length - (L.length - 1)) = Sum.inr g3 := + (SimpleGraph.Walk.getVert_reverse R (L.length - 1)).symm.trans + hg3IdxRev + have hcv : c ≠ v := by + intro hcv + subst c + have hvi : P.length = R.length - L.length := by + apply hRpath.getVert_injOn hPLe (Nat.sub_le _ _) + exact hvIdx.trans hcIdx.symm + have hg13 : g1 ≠ g3 := by + intro hg + subst g3 + have hgi : P.length - 1 = R.length - (L.length - 1) := by + apply hRpath.getVert_injOn ((Nat.sub_le _ _).trans hPLe) + (Nat.sub_le _ _) + exact hg1Idx.trans hg3Idx.symm + have hPtwo : 2 ≤ P.length := hP.2.1 + have hLtwo : 2 ≤ L.length := hExit.2.1 + omega + exact (hproper hg13 ⟨v, hg1d, hg3c⟩ hg1col) hg3col + have hdis : ∀ z, z ∈ P.support → z ∉ L.support := by + intro z hzP hzL + obtain ⟨i, hi, hiLe⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hzP + obtain ⟨j, hj, hjLe⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hzL + have hprefixLength : + P.length = (R.takeUntil (Sum.inl v) hvR).length := + congrArg SimpleGraph.Walk.length hPprefix + have hiR : R.getVert i = z := by + have hiTakeLe : i ≤ (R.takeUntil (Sum.inl v) hvR).length := by + rw [← hprefixLength] + exact hiLe + have hiTake : (R.takeUntil (Sum.inl v) hvR).getVert i = z := by + rw [← hPprefix] + exact hi + exact (R.getVert_takeUntil hvR hiTakeLe).symm.trans hiTake + have hjRev : R.reverse.getVert j = z := by + rw [← R.reverse.getVert_takeUntil hcR hjLe] + exact hj + have hjR : R.getVert (R.length - j) = z := + (SimpleGraph.Walk.getVert_reverse R j).symm.trans hjRev + have hij : i = R.length - j := by + apply hRpath.getVert_injOn (hiLe.trans hPLe) (Nat.sub_le _ _) + exact hiR.trans hjR.symm + have hcBefore : R.length - L.length ≤ P.length := by omega + have hcP : Sum.inl c ∈ P.support := by + have hvertex : P.getVert (R.length - L.length) = Sum.inl c := by + have hcTake : R.length - L.length ≤ + (R.takeUntil (Sum.inl v) hvR).length := by + rw [← hprefixLength] + exact hcBefore + rw [hPprefix] + exact (R.getVert_takeUntil hvR hcTake).trans hcIdx + rw [← hvertex] + exact P.getVert_mem_support (R.length - L.length) + exact hcv ((hP.2.2.2.2.2 c hcX).mp hcP) + have hLcomponent : ∀ z, z ∈ L.support → + z ∈ TwoColorComponent G phi a b (Sum.inl u) := by + intro z hz + have hzRev : z ∈ R.reverse.support := + R.reverse.support_takeUntil_subset_support hcR hz + have hzR : z ∈ R.support := by + simpa only [SimpleGraph.Walk.support_reverse, List.mem_reverse] using hzRev + rw [← hRsupport] + exact hzR + obtain ⟨f, hfB, hcf, hfL⟩ := + ClosedColorExitPathBoundaryEdge G T phi a b hclosed s c L hExit + exact ⟨c, L, f, hExit, hdis, hus.symm, hcv, by simpa [X] using hfB, + hcf, hfL, hLcomponent⟩ + +private theorem ElementaryClosedExitPairDistinctComponents_endpoint_missing_781.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → + let H := TwoColorIncidenceGraph G phi a b; + ∀ (v : V), (H.neighborSet (Sum.inl v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ + MissingColors G phi v := by + classical + intro V E _ _ G k phi a b hne H v hleaf + let _ := Fintype.ofFinite V + by_cases ha : a ∈ MissingColors G phi v + · exact Or.inl ha + · right + have hap : a ∈ PresentColors G phi v := by + simpa [MissingColors] using ha + by_contra hb + have hbp : b ∈ PresentColors G phi v := by + simpa [MissingColors] using hb + obtain ⟨ea, hea, hca⟩ := by simpa [PresentColors] using hap + obtain ⟨eb, heb, hcb⟩ := by simpa [PresentColors] using hbp + have hada : H.Adj (Sum.inl v) (Sum.inr ea) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v ea ∧ + (phi ea = some a ∨ phi ea = some b) from + ⟨hea, Or.inl hca⟩) + have hadb : H.Adj (Sum.inl v) (Sum.inr eb) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v eb ∧ + (phi eb = some a ∨ phi eb = some b) from + ⟨heb, Or.inr hcb⟩) + have heab : ea = eb := Sum.inr.inj (hleaf hada hadb) + subst eb + exact hne (Option.some.inj (hca.symm.trans hcb)) + +private theorem ElementaryClosedExitPairDistinctComponents_neighbor_of_two_851.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → + ∀ (a b : Fin k), a ≠ b → + let H := TwoColorIncidenceGraph G phi a b; + ∀ {x y z w : V ⊕ E}, H.Adj x y → H.Adj x z → y ≠ z → H.Adj x w → w = y ∨ w = z := by + classical + intro V E _ _ G k phi hproper a b hne H x y z w hxy hxz hyz hxw + let := Fintype.ofFinite V + let := Fintype.ofFinite E + by_contra hw + push Not at hw + let : Fintype (H.neighborSet x) := Fintype.ofFinite _ + have hthree : 3 ≤ @SimpleGraph.degree _ H x (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let ss : Finset (Sum V E) := {w, y, z} + have hss : ss ⊆ H.neighborFinset x := by + intro q hq + simp only [ss, Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hxw + · simpa [SimpleGraph.mem_neighborFinset] using hxy + · simpa [SimpleGraph.mem_neighborFinset] using hxz + have hc3 : 3 ≤ ss.card := by + simp [ss, hw.1, hw.2, hyz] + exact hc3.trans (Finset.card_le_card hss) + have htwo : @SimpleGraph.degree _ H x (Fintype.ofFinite _) ≤ 2 := by + simpa [H] using + TwoColorIncidenceDegreeAtMostTwo G phi a b hproper x + omega + +lemma ElementaryClosedExitPairDistinctComponents {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G phi) + (helementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (a b : Fin k) (hne : a ≠ b) + (_ : a ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {a}) + (hbpresent : b ∉ TreeMissingColors phi T) + (a1 b1 a2 b2 : V) + (P1 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a1) (Sum.inl b1)) + (P2 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a2) (Sum.inl b2)) + (hP1 : TreeExitPath T phi a b a1 b1 P1) + (hP2 : TreeExitPath T phi a b a2 b2 P2) + (_ : ∀ x, x ∈ P1.support → x ∉ P2.support) + (_ : a1 ≠ a2) (_ : b1 ≠ b2) + (hcomponents : + TwoColorComponent G phi a b (Sum.inl a1) ≠ + TwoColorComponent G phi a b (Sum.inl a2)) : + ∃ (a3 b3 : V) + (P3 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a3) (Sum.inl b3)) + (f3 : E), + TreeExitPath T phi a b a3 b3 P3 ∧ + (∀ x, x ∈ P1.support → x ∉ P3.support) ∧ + (∀ x, x ∈ P2.support → x ∉ P3.support) ∧ + a3 ≠ a1 ∧ a3 ≠ a2 ∧ b3 ≠ b1 ∧ b3 ≠ b2 ∧ + f3 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b ∧ + Incident G b3 f3 ∧ Sum.inr f3 ∈ P3.support := by + classical + let H := TwoColorIncidenceGraph G phi a b + let X := TreeSequenceVertexSet T + have endpoint_missing (v : V) + (hleaf : Set.Subsingleton (H.neighborSet (Sum.inl v))) : + a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v := by + exact @ElementaryClosedExitPairDistinctComponents_endpoint_missing_781 V E inferInstance + inferInstance G k phi a b hne v hleaf + have missing_leaf (v : V) + (hmissing : a ∈ MissingColors G phi v ∨ + b ∈ MissingColors G phi v) : + Set.Subsingleton (H.neighborSet (Sum.inl v)) := by + exact @ElementaryClosedExitPairDistinctComponents_missing_leaf_104 V E inferInstance + inferInstance G k phi hproper a b v hmissing + have walk_support_component : ∀ {u v : Sum V E} + (p : H.Walk u v) {z : Sum V E}, + z ∈ p.support → z ∈ TwoColorComponent G phi a b u := by + intro u v p z hz + obtain ⟨i, hi, hiLe⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hz + change H.connectedComponentMk z = H.connectedComponentMk u + rw [← hi] + exact (SimpleGraph.ConnectedComponent.sound (p.take i).reachable).symm + have fullPathFromLeaf := + @ElementaryClosedExitPairDistinctComponents_fullPathFromLeaf_172 V E inferInstance + inferInstance G k phi hproper a b hne endpoint_missing + have chooseFirst := + @ElementaryClosedExitPairDistinctComponents_chooseFirst_361 V E inferInstance inferInstance + inferInstance inferInstance G k phi a b hne + have firstEntry := + @ElementaryClosedExitPairDistinctComponents_firstEntry_400 V E inferInstance inferInstance + inferInstance inferInstance G k e0 T phi a b hne hclosed chooseFirst + have neighbor_of_two {x y z w : Sum V E} + (hxy : H.Adj x y) (hxz : H.Adj x z) (hyz : y ≠ z) + (hxw : H.Adj x w) : w = y ∨ w = z := by + exact @ElementaryClosedExitPairDistinctComponents_neighbor_of_two_851 V E inferInstance + inferInstance G k phi hproper a b hne x y z w hxy hxz hyz hxw + have pathPrefix := + @ElementaryClosedExitPairDistinctComponents_pathPrefix_533 V E inferInstance inferInstance + inferInstance inferInstance G k phi a b hne walk_support_component neighbor_of_two + have oppositeExit := + @ElementaryClosedExitPairDistinctComponents_oppositeExit_626 V E inferInstance inferInstance + inferInstance inferInstance G k e0 T phi hproper a b hne hclosed missing_leaf firstEntry + pathPrefix + have componentNontrivial : + ∀ {u v : V} (P : H.Walk (Sum.inl u) (Sum.inl v)), 2 ≤ P.length → + ∃ e : E, Sum.inr e ∈ TwoColorComponent G phi a b (Sum.inl u) := by + intro u v P htwo + have hpos : 0 < P.length := by omega + have hadj := P.adj_getVert_succ (i := 0) hpos + rw [P.getVert_zero] at hadj + cases hnext : P.getVert 1 with + | inl q => + rw [hnext] at hadj + simp [H, TwoColorIncidenceGraph] at hadj + | inr e => + refine ⟨e, walk_support_component P ?_⟩ + rw [← hnext] + exact P.getVert_mem_support 1 + have ha1Leaf : Set.Subsingleton (H.neighborSet (Sum.inl a1)) := + missing_leaf a1 hP1.2.2.2.2.1 + have ha2Leaf : Set.Subsingleton (H.neighborSet (Sum.inl a2)) := + missing_leaf a2 hP2.2.2.2.2.1 + obtain ⟨s1, R1, hR1path, hR1support, ha1s1, hs1Missing⟩ := + fullPathFromLeaf a1 (Sum.inl a1) rfl ha1Leaf + (componentNontrivial P1 hP1.2.1) + obtain ⟨s2, R2, hR2path, hR2support, ha2s2, hs2Missing⟩ := + fullPathFromLeaf a2 (Sum.inl a2) rfl ha2Leaf + (componentNontrivial P2 hP2.2.1) + have hcompDisjoint : + Disjoint (TwoColorComponent G phi a b (Sum.inl a1)) + (TwoColorComponent G phi a b (Sum.inl a2)) := + (TwoColorComponentsDisjoint G phi a b + (Sum.inl a1) (Sum.inl a2)).resolve_left hcomponents + have ha1C : Sum.inl a1 ∈ + TwoColorComponent G phi a b (Sum.inl a1) := rfl + have ha2C : Sum.inl a2 ∈ + TwoColorComponent G phi a b (Sum.inl a2) := rfl + have hs1C : Sum.inl s1 ∈ + TwoColorComponent G phi a b (Sum.inl a1) := by + rw [← hR1support] + exact R1.end_mem_support + have hs2C : Sum.inl s2 ∈ + TwoColorComponent G phi a b (Sum.inl a2) := by + rw [← hR2support] + exact R2.end_mem_support + have hP1component : ∀ z, z ∈ P1.support → + z ∈ TwoColorComponent G phi a b (Sum.inl a1) := by + intro z hz + exact walk_support_component P1 hz + have hP2component : ∀ z, z ∈ P2.support → + z ∈ TwoColorComponent G phi a b (Sum.inl a2) := by + intro z hz + exact walk_support_component P2 hz + have separated {u v : V} + (hu : Sum.inl u ∈ TwoColorComponent G phi a b (Sum.inl a1)) + (hv : Sum.inl v ∈ TwoColorComponent G phi a b (Sum.inl a2)) : + u ≠ v := by + intro huv + subst v + exact (Set.disjoint_left.mp hcompDisjoint) hu hv + have no_b_missing {v : V} (hvX : v ∈ X) : + b ∉ MissingColors G phi v := by + intro hvb + apply hbpresent + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, by simpa [X] using hvX, hvb⟩ + have hsOutside : s1 ∉ X ∨ s2 ∉ X := by + by_contra hnot + push Not at hnot + obtain ⟨hs1X, hs2X⟩ := hnot + have hs1a : a ∈ MissingColors G phi s1 := + hs1Missing.resolve_right (no_b_missing hs1X) + have hs2a : a ∈ MissingColors G phi s2 := + hs2Missing.resolve_right (no_b_missing hs2X) + have hsne : s1 ≠ s2 := separated hs1C hs2C + have hmissingDisjoint := helementary + (by simpa [X] using hs1X) (by simpa [X] using hs2X) hsne + exact (Finset.disjoint_left.mp hmissingDisjoint) hs1a hs2a + rcases hsOutside with hs1X | hs2X + · obtain ⟨c, L, f, hExit, hP1L, hs1a1, hcb1, hfB, hcf, hfL, + hLcomponent⟩ := + oppositeExit a1 b1 s1 P1 R1 hP1 hR1path hR1support ha1s1 + hs1Missing hs1X + have hP2L : ∀ z, z ∈ P2.support → z ∉ L.support := by + intro z hz2 hzL + exact (Set.disjoint_left.mp hcompDisjoint) + (hLcomponent z hzL) (hP2component z hz2) + have hs1a2 : s1 ≠ a2 := separated hs1C ha2C + have hcC : Sum.inl c ∈ + TwoColorComponent G phi a b (Sum.inl a1) := + hLcomponent (Sum.inl c) L.end_mem_support + have hb2C : Sum.inl b2 ∈ + TwoColorComponent G phi a b (Sum.inl a2) := + hP2component (Sum.inl b2) P2.end_mem_support + have hcb2 : c ≠ b2 := separated hcC hb2C + exact ⟨s1, c, L, f, hExit, hP1L, hP2L, hs1a1, hs1a2, + hcb1, hcb2, by simpa [X] using hfB, hcf, hfL⟩ + · obtain ⟨c, L, f, hExit, hP2L, hs2a2, hcb2, hfB, hcf, hfL, + hLcomponent⟩ := + oppositeExit a2 b2 s2 P2 R2 hP2 hR2path hR2support ha2s2 + hs2Missing hs2X + have hP1L : ∀ z, z ∈ P1.support → z ∉ L.support := by + intro z hz1 hzL + exact (Set.disjoint_left.mp hcompDisjoint) + (hP1component z hz1) (hLcomponent z hzL) + have hs2a1 : s2 ≠ a1 := (separated ha1C hs2C).symm + have hcC : Sum.inl c ∈ + TwoColorComponent G phi a b (Sum.inl a2) := + hLcomponent (Sum.inl c) L.end_mem_support + have hb1C : Sum.inl b1 ∈ + TwoColorComponent G phi a b (Sum.inl a1) := + hP1component (Sum.inl b1) P1.end_mem_support + have hcb1 : c ≠ b1 := (separated hb1C hcC).symm + exact ⟨s2, c, L, f, hExit, hP1L, hP2L, hs2a1, hs2a2, + hcb1, hcb2, by simpa [X] using hfB, hcf, hfL⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairExtendsTriple.lean b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairExtendsTriple.lean new file mode 100644 index 0000000000..de5d68a5b1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairExtendsTriple.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ElementaryClosedExitPairDistinctComponents +public import LeanPool.GoldbergSeymour.ElementaryClosedExitPairSameComponent + +/-! +# Elementary Closed Exit Pair Extends Triple + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma ElementaryClosedExitPairExtendsTriple {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G phi) + (helementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (a b : Fin k) (hne : a ≠ b) + (hamissing : a ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {a}) + (hbpresent : b ∉ TreeMissingColors phi T) + (a1 b1 a2 b2 : V) + (P1 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a1) (Sum.inl b1)) + (P2 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a2) (Sum.inl b2)) + (hP1 : TreeExitPath T phi a b a1 b1 P1) + (hP2 : TreeExitPath T phi a b a2 b2 P2) + (hdisjoint : ∀ x, x ∈ P1.support → x ∉ P2.support) + (haends : a1 ≠ a2) (hbends : b1 ≠ b2) : + ∃ (a3 b3 : V) + (P3 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a3) (Sum.inl b3)) + (f3 : E), + TreeExitPath T phi a b a3 b3 P3 ∧ + (∀ x, x ∈ P1.support → x ∉ P3.support) ∧ + (∀ x, x ∈ P2.support → x ∉ P3.support) ∧ + a3 ≠ a1 ∧ a3 ≠ a2 ∧ b3 ≠ b1 ∧ b3 ≠ b2 ∧ + f3 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b ∧ + Incident G b3 f3 ∧ Sum.inr f3 ∈ P3.support := by + classical + by_cases hcomponents : + TwoColorComponent G phi a b (Sum.inl a1) = + TwoColorComponent G phi a b (Sum.inl a2) + · exact ElementaryClosedExitPairSameComponent G T phi hproper helementary + a b hne hamissing hclosed hbpresent a1 b1 a2 b2 P1 P2 hP1 hP2 + hdisjoint haends hbends hcomponents + · exact ElementaryClosedExitPairDistinctComponents G T phi hproper + helementary a b hne hamissing hclosed hbpresent a1 b1 a2 b2 P1 P2 + hP1 hP2 hdisjoint haends hbends hcomponents + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean new file mode 100644 index 0000000000..35a86d1697 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean @@ -0,0 +1,696 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.TreeMissingColors + +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint + +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent + +/-! +# Elementary Closed Exit Pair Same Component + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_missing_leaf_103.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : + LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k), IsProperEdgeColoring G + phi → ∀ (a b : Fin k), let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; ∀ + (v : V), a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v → (H.neighborSet (Sum.inl + v)).Subsingleton := by + classical + intro V E _ _ G k phi hproper a b H v hmissing z hz w hw + let _ := Fintype.ofFinite V + cases hzv : z with + | inl u => + rw [hzv] at hz + simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz + | inr e => + cases hwv : w with + | inl u => + rw [hwv] at hw + simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw + | inr f => + rw [hzv] at hz + rw [hwv] at hw + have he : Incident G v e ∧ + (phi e = some a ∨ phi e = some b) := by + simpa [H, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hz + have hf : Incident G v f ∧ + (phi f = some a ∨ phi f = some b) := by + simpa [H, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hw + apply congrArg Sum.inr + by_contra hef + rcases hmissing with ha | hb + · have hna : a ∉ PresentColors G phi v := by + simpa [MissingColors] using ha + have hea : phi e = some b := he.2.resolve_left (by + intro hea + apply hna + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some a from + ⟨e, he.1, hea⟩)) + have hfa : phi f = some b := hf.2.resolve_left (by + intro hfa + apply hna + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some a from + ⟨f, hf.1, hfa⟩)) + exact (hproper hef ⟨v, he.1, hf.1⟩ hea) hfa + · have hnb : b ∉ PresentColors G phi v := by + simpa [MissingColors] using hb + have heb : phi e = some a := he.2.resolve_right (by + intro heb + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some b from + ⟨e, he.1, heb⟩)) + have hfb : phi f = some a := hf.2.resolve_right (by + intro hfb + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some b from + ⟨f, hf.1, hfb⟩)) + exact (hproper hef ⟨v, he.1, hf.1⟩ heb) hfb + +private theorem helper_fullPathFromLeaf_170.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : + LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k), IsProperEdgeColoring G + phi → ∀ (a b : Fin k), let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; (∀ + (v : V), (H.neighborSet (Sum.inl v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ + MissingColors G phi v) → ∀ (v : V) (c : V ⊕ E), Sum.inl v ∈ TwoColorComponent G phi a b c + → (H.neighborSet (Sum.inl v)).Subsingleton → (∃ (e : E), Sum.inr e ∈ TwoColorComponent G + phi a b c) → ∃ (s : V) (p : H.Walk (Sum.inl v) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ + p.support} = TwoColorComponent G phi a b c ∧ v ≠ s ∧ (a ∈ MissingColors G phi s ∨ b ∈ + MissingColors G phi s) := by + classical + intro V E _ _ G k phi hproper a b H endpoint_missing v c hvC hvleaf hnontrivial + let _ := Fintype.ofFinite V + obtain ⟨u, w, p, hp, hps⟩ := + TwoColorComponentSpanningPath G phi a b hproper c + have hvP : Sum.inl v ∈ p.support := by + change Sum.inl v ∈ {y | y ∈ p.support} + rw [hps] + exact hvC + have hvEnd : Sum.inl v = u ∨ Sum.inl v = w := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hvleaf) hvP + obtain ⟨t, q, hq, hqs⟩ : ∃ (t : Sum V E) + (q : H.Walk (Sum.inl v) t), + q.IsPath ∧ {y | y ∈ q.support} = + TwoColorComponent G phi a b c := by + rcases hvEnd with hvu | hvw + · subst u + exact ⟨w, p, hp, hps⟩ + · subst w + refine ⟨u, p.reverse, hp.reverse, ?_⟩ + ext y + change y ∈ p.reverse.support ↔ + y ∈ TwoColorComponent G phi a b c + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] + exact Set.ext_iff.mp hps y + have hqnon : ¬ q.Nil := by + intro hnil + obtain ⟨e, heC⟩ := hnontrivial + have heQ : Sum.inr e ∈ q.support := by + change Sum.inr e ∈ {y | y ∈ q.support} + rw [hqs] + exact heC + rw [SimpleGraph.Walk.nil_iff_support_eq.mp hnil] at heQ + simp at heQ + have hend_neighbor : ∀ y, H.Adj t y → + y = q.getVert (q.length - 1) := by + intro y hty + have hyC : y ∈ TwoColorComponent G phi a b c := by + have htC : t ∈ TwoColorComponent G phi a b c := by + rw [← hqs] + change t ∈ q.support + simpa only [q.getVert_length] using + q.getVert_mem_support q.length + change H.connectedComponentMk y = H.connectedComponentMk c + change H.connectedComponentMk t = H.connectedComponentMk c at htC + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hty).symm.trans htC + have hySupport : y ∈ q.support := by + change y ∈ {z | z ∈ q.support} + rw [hqs] + exact hyC + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hySupport + have hnlt : n < q.length := by + have hnne : n ≠ q.length := by + intro heq + have hyt : y = t := by rw [← hn, heq, q.getVert_length] + exact hty.ne hyt.symm + omega + by_cases hpen : n + 1 = q.length + · rw [← hn] + congr 1 + omega + by_cases hn0 : n = 0 + · have hnext : H.Adj (Sum.inl v) (q.getVert 1) := by + simpa [hn0, q.getVert_zero] using q.adj_getVert_succ hnlt + have htstart : H.Adj (Sum.inl v) t := by + rw [← hn, hn0, q.getVert_zero] at hty + exact hty.symm + have hneNext : q.getVert 1 ≠ t := by + intro heq + have hindices := hq.getVert_injOn + (show 1 ≤ q.length by omega) (show q.length ≤ q.length by rfl) + (heq.trans q.getVert_length.symm) + omega + exact False.elim (hneNext (hvleaf hnext htstart)) + · have hleft : H.Adj y (q.getVert (n - 1)) := by + rw [← hn] + have hadj := q.adj_getVert_succ (i := n - 1) (by omega) + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ n)] using + hadj.symm + have hright : H.Adj y (q.getVert (n + 1)) := by + rw [← hn] + exact q.adj_getVert_succ hnlt + have htneLeft : t ≠ q.getVert (n - 1) := by + intro heq + have hindices := hq.getVert_injOn + (show q.length ≤ q.length by rfl) + (show n - 1 ≤ q.length by omega) + (q.getVert_length.trans heq) + omega + have htneRight : t ≠ q.getVert (n + 1) := by + intro heq + have hindices := hq.getVert_injOn + (show q.length ≤ q.length by rfl) + (show n + 1 ≤ q.length by omega) + (q.getVert_length.trans heq) + omega + have hlrne : q.getVert (n - 1) ≠ q.getVert (n + 1) := by + intro heq + have hindices := hq.getVert_injOn + (show n - 1 ≤ q.length by omega) + (show n + 1 ≤ q.length by omega) heq + omega + let : Fintype (H.neighborSet y) := Fintype.ofFinite _ + have hthree : 3 ≤ @SimpleGraph.degree _ H y + (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let ss : Finset (Sum V E) := + {t, q.getVert (n - 1), q.getVert (n + 1)} + have hss : ss ⊆ H.neighborFinset y := by + intro r hr + simp only [ss, Finset.mem_insert, Finset.mem_singleton] at hr + rcases hr with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hty.symm + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc3 : 3 ≤ ss.card := by + simp [ss, htneLeft, htneRight, hlrne] + exact hc3.trans (Finset.card_le_card hss) + have htwo : @SimpleGraph.degree _ H y + (Fintype.ofFinite _) ≤ 2 := by + simpa [H] using + TwoColorIncidenceDegreeAtMostTwo G phi a b hproper y + omega + have hendLeaf : Set.Subsingleton (H.neighborSet t) := by + intro y hy y' hy' + exact (hend_neighbor y hy).trans (hend_neighbor y' hy').symm + have hqpos : 0 < q.length := + SimpleGraph.Walk.not_nil_iff_lt_length.mp hqnon + have hendVertex : ∃ s : V, t = Sum.inl s := by + cases ht : t with + | inl s => exact ⟨s, rfl⟩ + | inr e => + have hlastAdj : H.Adj (q.getVert (q.length - 1)) t := by + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ q.length), + q.getVert_length] using + q.adj_getVert_succ (i := q.length - 1) (by omega) + have hecolor : phi e = some a ∨ phi e = some b := by + cases hprev : q.getVert (q.length - 1) with + | inl r => + rw [hprev, ht] at hlastAdj + have hdata : Incident G r e ∧ + (phi e = some a ∨ phi e = some b) := by + simpa [H, TwoColorIncidenceGraph] using hlastAdj + exact hdata.2 + | inr f => + rw [hprev, ht] at hlastAdj + have : False := by + simp [H, TwoColorIncidenceGraph] at hlastAdj + exact this.elim + induction hends : G.ends e using Sym2.inductionOn with + | _ r s => + have hrs : r ≠ s := by + intro hrs + subst s + exact G.loopless e r hends + have hrAdj : H.Adj t (Sum.inl r) := by + rw [ht] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G r e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨by simp [Incident, hends], hecolor⟩) + have hsAdj : H.Adj t (Sum.inl s) := by + rw [ht] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G s e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨by simp [Incident, hends], hecolor⟩) + exact False.elim + (hrs (Sum.inl.inj (hendLeaf hrAdj hsAdj))) + obtain ⟨s, hs⟩ := hendVertex + subst t + have hvs : v ≠ s := by + intro hvs + apply hqnon + exact hq.nil_iff_eq.mpr (by simp [hvs]) + exact ⟨s, q, hq, hqs, hvs, endpoint_missing s hendLeaf⟩ + +private theorem helper_chooseFirst_359.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) (a b : Fin k) (a1 b1 + a2 b2 : V) (P1 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a1) (Sum.inl b1)) (P2 : + (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a2) (Sum.inl b2)), (∀ x ∈ P1.support, x ∉ + P2.support) → b1 ≠ b2 → let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; ∀ + {u v : V ⊕ E} (p : H.Walk u v) (S : Finset (V ⊕ E)), {x ∈ S | x ∈ p.support}.Nonempty → ∃ + x ∈ S, ∃ (hx : x ∈ p.support), ∀ t ∈ S, t ∈ (p.takeUntil x hx).support → t = x := by + classical + intro V E _ _ G k phi a b a1 b1 a2 b2 P1 P2 _ _ H u v p S hnonempty + have firstErase : ∃ x ∈ S, ∃ (hx : x ∈ p.support), + {t ∈ S.erase x | t ∈ (p.takeUntil x hx).support} = ∅ := by + simp only [← Finset.subset_empty] + induction hn : p.length + S.card using Nat.strong_induction_on + generalizing S v with + | _ n ih => + simp only [Finset.Nonempty, Finset.mem_filter] at hnonempty + obtain ⟨x, hxS, hxP⟩ := hnonempty + obtain hempty | hmore := Finset.eq_empty_or_nonempty + {t ∈ S.erase x | t ∈ (p.takeUntil x hxP).support} + · exact ⟨x, hxS, hxP, hempty.le⟩ + · have hlt : (p.takeUntil x hxP).length + + (S.erase x).card < n := by + rw [← Finset.card_erase_add_one hxS] at hn + have hle := p.length_takeUntil_le_length hxP + omega + obtain ⟨y, hyS, hyP, hyempty⟩ := + ih _ hlt (p.takeUntil x hxP) (S.erase x) hmore rfl + refine ⟨y, Finset.mem_of_mem_erase hyS, + p.support_takeUntil_subset_support hxP hyP, ?_⟩ + rwa [p.takeUntil_takeUntil, Finset.erase_right_comm, + Finset.filter_erase, Finset.erase_eq_of_notMem] at hyempty + simp only [Finset.mem_filter, Finset.mem_erase, ne_eq, not_and, + and_imp] + rintro hxy - + exact p.notMem_support_takeUntil_support_takeUntil_subset + (Ne.symm hxy) hxP hyP + obtain ⟨x, hxS, hxP, hempty⟩ := firstErase + refine ⟨x, hxS, hxP, ?_⟩ + suffices {t ∈ S | t ∈ (p.takeUntil x hxP).support} ⊆ {x} by + simpa [Finset.subset_iff] using this + rwa [Finset.filter_erase, ← Finset.subset_empty, + ← Finset.subset_insert_iff, LawfulSingleton.insert_empty_eq] at hempty + +private theorem helper_firstEntry_398.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (a b : Fin k) (a1 b1 a2 b2 : V) + (P1 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a1) (Sum.inl b1)) + (P2 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a2) (Sum.inl b2)), + (∀ x ∈ P1.support, x ∉ P2.support) → + b1 ≠ b2 → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; + let X : Finset V := TreeSequenceVertexSet T; + (∀ {u v : V ⊕ E} (p : H.Walk u v) (S : Finset (V ⊕ E)), + {x ∈ S | x ∈ p.support}.Nonempty → + ∃ x ∈ S, ∃ (hx : x ∈ p.support), ∀ t ∈ S, t ∈ (p.takeUntil x hx).support → t = x) → + ∀ (r s : V) (Q : H.Walk (Sum.inl r) (Sum.inl s)), + Q.IsPath → + a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r → + r ∉ X → + (∃ x ∈ X, Sum.inl x ∈ Q.support) → + ∃ (c : V) (_ : c ∈ X) (hcQ : Sum.inl c ∈ Q.support), + let L : H.Walk (Sum.inl r) (Sum.inl c) := Q.takeUntil (Sum.inl c) hcQ; + TreeExitPath T phi a b r c L := by + classical + intro V E _ _ _ _ G k e0 T phi a b a1 b1 a2 b2 P1 P2 _ _ H X chooseFirst r s Q hQ hmissing hrX + hmeet + let _ := Fintype.ofFinite V + let S : Finset (Sum V E) := X.image Sum.inl + obtain ⟨q, hqS, hqQ, hqfirst⟩ := + chooseFirst Q S (by + obtain ⟨x, hxX, hxQ⟩ := hmeet + exact ⟨Sum.inl x, by simp [S, hxX, hxQ]⟩) + obtain ⟨c, hcX, hcq⟩ : ∃ c, c ∈ X ∧ Sum.inl c = q := by + simpa [S] using hqS + subst q + let L := Q.takeUntil (Sum.inl c) hqQ + have hLc : ∀ x ∈ X, (Sum.inl x ∈ L.support ↔ x = c) := by + intro x hxX + constructor + · intro hxL + have heq := hqfirst (Sum.inl x) (by simp [S, hxX]) hxL + exact Sum.inl.inj heq + · rintro rfl + exact L.end_mem_support + have hrc : r ≠ c := by + intro hrc + apply hrX + simpa [hrc] using hcX + have hLpath : L.IsPath := hQ.takeUntil _ + have hLlen : 2 ≤ L.length := by + have hpos : 0 < L.length := by + apply Nat.pos_of_ne_zero + intro hn + have hnil : L.Nil := SimpleGraph.Walk.length_eq_zero_iff.mp hn + exact hrc (Sum.inl.inj hnil.eq) + by_contra hnotTwo + have hlen : L.length = 1 := by omega + have hadj := L.adj_getVert_succ (i := 0) (by omega) + have hend : L.getVert 1 = Sum.inl c := by + have heq := L.getVert_length + rwa [hlen] at heq + rw [L.getVert_zero, hend] at hadj + simp [H, TwoColorIncidenceGraph] at hadj + exact ⟨c, hcX, hqQ, hLpath, hLlen, hrX, hcX, hmissing, hLc⟩ + +private theorem helper_endpoint_missing_454.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; + ∀ (v : V), (H.neighborSet (Sum.inl v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ + MissingColors G phi v := by + classical + intro V E _ _ G k phi a b hne H v hleaf + let _ := Fintype.ofFinite V + by_cases ha : a ∈ MissingColors G phi v + · exact Or.inl ha + · right + have hap : a ∈ PresentColors G phi v := by + simpa [MissingColors] using ha + by_contra hb + have hbp : b ∈ PresentColors G phi v := by + simpa [MissingColors] using hb + obtain ⟨ea, hea, hca⟩ := by simpa [PresentColors] using hap + obtain ⟨eb, heb, hcb⟩ := by simpa [PresentColors] using hbp + have hada : H.Adj (Sum.inl v) (Sum.inr ea) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v ea ∧ + (phi ea = some a ∨ phi ea = some b) from + ⟨hea, Or.inl hca⟩) + have hadb : H.Adj (Sum.inl v) (Sum.inr eb) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v eb ∧ + (phi eb = some a ∨ phi eb = some b) from + ⟨heb, Or.inr hcb⟩) + have heab : ea = eb := Sum.inr.inj (hleaf hada hadb) + subst eb + exact hne (Option.some.inj (hca.symm.trans hcb)) + +private theorem helper_hCnontrivial_540.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (a b : Fin k) (a1 b1 : V) + (P1 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a1) (Sum.inl b1)), + TreeExitPath T phi a b a1 b1 P1 → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; + (∀ {u v : V ⊕ E} (p : H.Walk u v) {z : V ⊕ E}, z ∈ p.support → z ∈ TwoColorComponent G + phi a b u) → + ∃ (e : E), Sum.inr e ∈ TwoColorComponent G phi a b (Sum.inl a1) := by + classical + intro V E _ _ G k e0 T phi a b a1 b1 P1 hP1 H walk_support_component + let _ := Fintype.ofFinite V + have hpos : 0 < P1.length := by + have htwo := hP1.2.1 + omega + have hadj := P1.adj_getVert_succ (i := 0) hpos + rw [P1.getVert_zero] at hadj + cases hnext : P1.getVert 1 with + | inl v => + rw [hnext] at hadj + simp [TwoColorIncidenceGraph] at hadj + | inr e => + refine ⟨e, walk_support_component P1 ?_⟩ + rw [← hnext] + exact P1.getVert_mem_support 1 + +private theorem helper_hcomponents_ne_597.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (a b : Fin k) (a1 b1 a2 b2 : V) + (P1 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a1) (Sum.inl b1)) + (P2 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a2) (Sum.inl b2)), + TreeExitPath T phi a b a1 b1 P1 → + TreeExitPath T phi a b a2 b2 P2 → + (∀ x ∈ P1.support, x ∉ P2.support) → + b1 ≠ b2 → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; + ∀ (R : H.Walk (Sum.inl a1) (Sum.inl a2)), + R.IsPath → + {y : V ⊕ E | y ∈ R.support} = TwoColorComponent G phi a b (Sum.inl a1) → + ∀ x ∈ TreeSequenceVertexSet T, + (H.neighborSet (Sum.inl x)).Subsingleton → + TwoColorComponent G phi a b (Sum.inl a1) ≠ TwoColorComponent G phi a b + (Sum.inl x) := by + classical + intro V E _ _ G k e0 T phi a b a1 b1 a2 b2 P1 P2 hP1 hP2 _ _ H R hRpath hRsupport x hxX hxleaf heq + let _ := Fintype.ofFinite V + have hxR : Sum.inl x ∈ R.support := by + change Sum.inl x ∈ {z | z ∈ R.support} + rw [hRsupport, heq] + rfl + have hxa1 : (Sum.inl x : Sum V E) ≠ Sum.inl a1 := by + intro h + have h' : x = a1 := Sum.inl.inj h + exact hP1.2.2.1 (h' ▸ hxX) + have hxa2 : (Sum.inl x : Sum V E) ≠ Sum.inl a2 := by + intro h + have h' : x = a2 := Sum.inl.inj h + exact hP2.2.2.1 (h' ▸ hxX) + exact (hRpath.isTrail.notMem_support_of_subsingleton_neighborSet + hxa1 hxa2 hxleaf) hxR + +lemma ElementaryClosedExitPairSameComponent {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G phi) + (helementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (a b : Fin k) (hne : a ≠ b) + (hamissing : a ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {a}) + (hbpresent : b ∉ TreeMissingColors phi T) + (a1 b1 a2 b2 : V) + (P1 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a1) (Sum.inl b1)) + (P2 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a2) (Sum.inl b2)) + (hP1 : TreeExitPath T phi a b a1 b1 P1) + (hP2 : TreeExitPath T phi a b a2 b2 P2) + (_ : ∀ x, x ∈ P1.support → x ∉ P2.support) + (haends : a1 ≠ a2) (_ : b1 ≠ b2) + (hcomponents : + TwoColorComponent G phi a b (Sum.inl a1) = + TwoColorComponent G phi a b (Sum.inl a2)) : + ∃ (a3 b3 : V) + (P3 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a3) (Sum.inl b3)) + (f3 : E), + TreeExitPath T phi a b a3 b3 P3 ∧ + (∀ x, x ∈ P1.support → x ∉ P3.support) ∧ + (∀ x, x ∈ P2.support → x ∉ P3.support) ∧ + a3 ≠ a1 ∧ a3 ≠ a2 ∧ b3 ≠ b1 ∧ b3 ≠ b2 ∧ + f3 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b ∧ + Incident G b3 f3 ∧ Sum.inr f3 ∈ P3.support := by + classical + let H := TwoColorIncidenceGraph G phi a b + let X := TreeSequenceVertexSet T + have endpoint_missing := @helper_endpoint_missing_454 V E inferInstance inferInstance G k phi a b + hne + have missing_leaf := @helper_missing_leaf_103 V E inferInstance inferInstance G k phi hproper a b + have walk_support_component : ∀ {u v : Sum V E} + (p : H.Walk u v) {z : Sum V E}, + z ∈ p.support → z ∈ TwoColorComponent G phi a b u := by + intro u v p z hz + obtain ⟨i, hi, hiLe⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hz + change H.connectedComponentMk z = H.connectedComponentMk u + rw [← hi] + exact (SimpleGraph.ConnectedComponent.sound (p.take i).reachable).symm + have fullPathFromLeaf := @helper_fullPathFromLeaf_170 V E inferInstance inferInstance G k phi + hproper a b endpoint_missing + have chooseFirst : ∀ {u v : Sum V E} (p : H.Walk u v) + (S : Finset (Sum V E)), + {x ∈ S | x ∈ p.support}.Nonempty → + ∃ x ∈ S, ∃ (hx : x ∈ p.support), + ∀ t ∈ S, t ∈ (p.takeUntil x hx).support → t = x := by + exact @helper_chooseFirst_359 V E inferInstance inferInstance G k phi a b a1 b1 a2 b2 P1 P2 + (by assumption) (by assumption) + have firstEntry : ∀ (r s : V) (Q : H.Walk (Sum.inl r) (Sum.inl s)), + Q.IsPath → + (a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r) → + r ∉ X → + (∃ x ∈ X, Sum.inl x ∈ Q.support) → + ∃ (c : V) (hcX : c ∈ X) (hcQ : Sum.inl c ∈ Q.support), + let L := Q.takeUntil (Sum.inl c) hcQ + TreeExitPath T phi a b r c L := by + exact @helper_firstEntry_398 V E inferInstance inferInstance inferInstance inferInstance G k + e0 T phi a b a1 b1 a2 b2 P1 P2 (by assumption) (by assumption) chooseFirst + have ha1leaf : Set.Subsingleton (H.neighborSet (Sum.inl a1)) := + missing_leaf a1 hP1.2.2.2.2.1 + have ha2leaf : Set.Subsingleton (H.neighborSet (Sum.inl a2)) := + missing_leaf a2 hP2.2.2.2.2.1 + have ha1C : Sum.inl a1 ∈ TwoColorComponent G phi a b (Sum.inl a1) := + rfl + have ha2C : Sum.inl a2 ∈ TwoColorComponent G phi a b (Sum.inl a1) := by + rw [hcomponents] + rfl + have hCnontrivial := @helper_hCnontrivial_540 V E inferInstance inferInstance G k e0 T phi a b a1 + b1 P1 hP1 walk_support_component + obtain ⟨s, R, hRpath, hRsupport, ha1s, hsMissing⟩ := + fullPathFromLeaf a1 (Sum.inl a1) ha1C ha1leaf hCnontrivial + have hsa2 : s = a2 := by + by_contra hsa2 + have ha2R : Sum.inl a2 ∈ R.support := by + change Sum.inl a2 ∈ {z | z ∈ R.support} + rw [hRsupport] + exact ha2C + have ha2start : (Sum.inl a2 : Sum V E) ≠ Sum.inl a1 := by + exact fun h => haends (Sum.inl.inj h).symm + have ha2end : (Sum.inl a2 : Sum V E) ≠ Sum.inl s := by + exact fun h => hsa2 (Sum.inl.inj h).symm + exact (hRpath.isTrail.notMem_support_of_subsingleton_neighborSet + ha2start ha2end ha2leaf) ha2R + subst s + simp only [TreeMissingColors, Finset.mem_biUnion] at hamissing + obtain ⟨x, hxX, hxa⟩ := hamissing + have hxbnot : b ∉ MissingColors G phi x := by + intro hxb + apply hbpresent + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨x, hxX, hxb⟩ + have hxbpresent : b ∈ PresentColors G phi x := by + simpa [MissingColors] using hxbnot + obtain ⟨g, hxg, hgcolor⟩ := by + simpa [PresentColors] using hxbpresent + have hxleaf : Set.Subsingleton (H.neighborSet (Sum.inl x)) := + missing_leaf x (Or.inl hxa) + have hxC : Sum.inl x ∈ TwoColorComponent G phi a b (Sum.inl x) := rfl + have hCxnontrivial : + ∃ e : E, Sum.inr e ∈ TwoColorComponent G phi a b (Sum.inl x) := by + refine ⟨g, ?_⟩ + change H.connectedComponentMk (Sum.inr g) = + H.connectedComponentMk (Sum.inl x) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G x g ∧ + (phi g = some a ∨ phi g = some b) from + ⟨hxg, Or.inr hgcolor⟩))).symm + obtain ⟨y, Q, hQpath, hQsupport, hxy, hyMissing⟩ := + fullPathFromLeaf x (Sum.inl x) hxC hxleaf hCxnontrivial + have hcomponents_ne : + TwoColorComponent G phi a b (Sum.inl a1) ≠ + TwoColorComponent G phi a b (Sum.inl x) := by + exact @helper_hcomponents_ne_597 V E inferInstance inferInstance G k e0 T phi a b a1 b1 a2 b2 + P1 P2 hP1 hP2 (by assumption) (by assumption) R hRpath hRsupport x hxX hxleaf + have hcompDisjoint : + Disjoint (TwoColorComponent G phi a b (Sum.inl a1)) + (TwoColorComponent G phi a b (Sum.inl x)) := + (TwoColorComponentsDisjoint G phi a b + (Sum.inl a1) (Sum.inl x)).resolve_left hcomponents_ne + have hyX : y ∉ X := by + intro hyX + rcases hyMissing with hya | hyb + · have hdis := helementary hxX hyX hxy + exact (Finset.disjoint_left.mp hdis) hxa hya + · apply hbpresent + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨y, hyX, hyb⟩ + have hmeet : ∃ z ∈ X, Sum.inl z ∈ Q.reverse.support := by + refine ⟨x, hxX, ?_⟩ + simp only [SimpleGraph.Walk.support_reverse, List.mem_reverse] + exact Q.start_mem_support + obtain ⟨b3, hb3X, hb3Q, hP3⟩ := + firstEntry y x Q.reverse hQpath.reverse hyMissing hyX hmeet + let P3 := Q.reverse.takeUntil (Sum.inl b3) hb3Q + have hP3' : TreeExitPath T phi a b y b3 P3 := hP3 + have hP3component : ∀ z ∈ P3.support, + z ∈ TwoColorComponent G phi a b (Sum.inl x) := by + intro z hz + have hzrev : z ∈ Q.reverse.support := + Q.reverse.support_takeUntil_subset_support hb3Q hz + have hzQ : z ∈ Q.support := by + simpa only [SimpleGraph.Walk.support_reverse, List.mem_reverse] using hzrev + rw [← hQsupport] + exact hzQ + have hP1component : ∀ z ∈ P1.support, + z ∈ TwoColorComponent G phi a b (Sum.inl a1) := by + intro z hz + exact walk_support_component P1 hz + have hP2component : ∀ z ∈ P2.support, + z ∈ TwoColorComponent G phi a b (Sum.inl a1) := by + intro z hz + rw [hcomponents] + exact walk_support_component P2 hz + have hP1P3 : ∀ z, z ∈ P1.support → z ∉ P3.support := by + intro z hz1 hz3 + exact (Set.disjoint_left.mp hcompDisjoint) + (hP1component z hz1) (hP3component z hz3) + have hP2P3 : ∀ z, z ∈ P2.support → z ∉ P3.support := by + intro z hz2 hz3 + exact (Set.disjoint_left.mp hcompDisjoint) + (hP2component z hz2) (hP3component z hz3) + have hyComponent : Sum.inl y ∈ + TwoColorComponent G phi a b (Sum.inl x) := by + rw [← hQsupport] + exact Q.end_mem_support + have hb3Component : Sum.inl b3 ∈ + TwoColorComponent G phi a b (Sum.inl x) := + hP3component (Sum.inl b3) P3.end_mem_support + have hb1Component : Sum.inl b1 ∈ + TwoColorComponent G phi a b (Sum.inl a1) := + hP1component (Sum.inl b1) P1.end_mem_support + have hb2Component : Sum.inl b2 ∈ + TwoColorComponent G phi a b (Sum.inl a1) := + hP2component (Sum.inl b2) P2.end_mem_support + have separated {u v : V} + (hu : Sum.inl u ∈ TwoColorComponent G phi a b (Sum.inl a1)) + (hv : Sum.inl v ∈ TwoColorComponent G phi a b (Sum.inl x)) : + v ≠ u := by + intro hvu + subst v + exact (Set.disjoint_left.mp hcompDisjoint) hu hv + have hya1 : y ≠ a1 := separated ha1C hyComponent + have hya2 : y ≠ a2 := separated ha2C hyComponent + have hb3b1 : b3 ≠ b1 := separated hb1Component hb3Component + have hb3b2 : b3 ≠ b2 := separated hb2Component hb3Component + obtain ⟨f3, hf3, hb3f3, hf3P3⟩ := + ClosedColorExitPathBoundaryEdge G T phi a b hclosed y b3 P3 hP3' + exact ⟨y, b3, P3, f3, hP3', hP1P3, hP2P3, hya1, hya2, + hb3b1, hb3b2, hf3, hb3f3, hf3P3⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedMissingColorOdd.lean b/LeanPool/GoldbergSeymour/ElementaryClosedMissingColorOdd.lean new file mode 100644 index 0000000000..75a8925912 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementaryClosedMissingColorOdd.lean @@ -0,0 +1,164 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Algebra.Ring.Parity + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring + +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeMissingColors + +/-! +# Elementary Closed Missing Color Odd + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ElementaryClosedMissingColorOdd {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (alpha : Fin k) + (hproper : IsProperEdgeColoring G phi) + (helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T)) + (hmissing : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) : + Odd (TreeSequenceVertexSet T).card := by + classical + let X := TreeSequenceVertexSet T + obtain ⟨x, hxX, hax⟩ := Finset.mem_biUnion.mp hmissing + have hxX' : x ∈ X := by simpa [X] using hxX + let Y := X.erase x + let edges := (Finset.univ : Finset E).filter (fun e => phi e = some alpha) + have y_present : ∀ v, v ∈ Y → alpha ∈ PresentColors G phi v := by + intro v hv + have hvX : v ∈ X := (Finset.mem_erase.mp hv).2 + have hvne : v ≠ x := (Finset.mem_erase.mp hv).1 + have hdis := helem hxX hvX hvne.symm + have : alpha ∉ MissingColors G phi v := by + intro hm + exact (Finset.disjoint_left.mp hdis) hax hm + simpa [MissingColors] using this + have edge_inc : ∀ v, v ∈ Y → ∃! e, e ∈ edges ∧ Incident G v e := by + intro v hv + obtain ⟨e, he, hve⟩ := by simpa [PresentColors] using y_present v hv + refine ⟨e, ?_, ?_⟩ + · exact ⟨by simpa [edges] using hve, he⟩ + · intro f hf + by_contra hef + exact (hproper (fun h => hef h.symm) ⟨v, he, hf.2⟩ hve) + (Finset.mem_filter.mp hf.1).2 + have no_x : ∀ e, e ∈ edges → Not (Incident G x e) := by + intro e he hxe + have hp : alpha ∈ PresentColors G phi x := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hxe, (Finset.mem_filter.mp he).2⟩ + exact (Finset.mem_sdiff.mp hax).2 hp + have internal_other : ∀ e, e ∈ edges → ∀ v, v ∈ X → Incident G v e → + ∀ z, Incident G z e → z ∈ X := by + intro e he v hvX hve z hze + by_contra hz + obtain ⟨w, hw⟩ := Sym2.mem_iff_exists.mp hze + have hzw : G.ends e = s(z, w) := hw + have hvpair : v = z ∨ v = w := by + have : v ∈ s(z, w) := by rw [← hzw]; exact hve + simpa using this + have hzwX : w ∈ X := by + rcases hvpair with hvz | hvw + · exact False.elim (hz (hvz ▸ hvX)) + · exact hvw ▸ hvX + have hb0 : e ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hzwX, z, hz, hzw.trans Sym2.eq_swap⟩ + have hb : e ∈ BoundaryColorEdges G phi X alpha := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hb0, (Finset.mem_filter.mp he).2⟩ + have hempty : BoundaryColorEdges G phi X alpha = ∅ := by + change BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha = ∅ + exact hclosed alpha (Finset.mem_singleton_self alpha) + exact (by simp [hempty] at hb) + let good := edges.filter (fun e => ∀ v, Incident G v e → v ∈ X) + have good_spec : ∀ e, e ∈ good ↔ + e ∈ edges ∧ ∀ v, Incident G v e → v ∈ X := by + intro e + simp [good] + have endpoint_card : ∀ e : E, (G.ends e).toFinset.card = 2 := by + intro e + apply Sym2.card_toFinset_of_not_isDiag + intro hd + exact G.loopless e ((G.ends e).diagElem hd) (Sym2.diag_diagElem hd).symm + have good_disjoint : ∀ {e}, e ∈ good → ∀ {f}, f ∈ good → + e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + have hce := (good_spec e).mp he |>.1 + have hcf := (good_spec f).mp hf |>.1 + exact (hproper hef ⟨v, Sym2.mem_toFinset.mp hev, Sym2.mem_toFinset.mp hvf⟩ + (Finset.mem_filter.mp hce).2) (Finset.mem_filter.mp hcf).2 + have union_card : (good.biUnion fun e => (G.ends e).toFinset).card = + 2 * good.card := by + have aux : ∀ s : Finset E, s ⊆ good → + (s.biUnion fun e => (G.ends e).toFinset).card = 2 * s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset + (s.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + have hh := good_disjoint (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf)) + exact (Finset.disjoint_left.mp hh) hev hvf + rw [Finset.card_union_of_disjoint hd, endpoint_card] + rw [ih (fun z hz => hs (Finset.mem_insert_of_mem hz))] + rw [Finset.card_insert_of_notMem hes] + omega + exact aux good (by intro e he; exact he) + have union_eq : good.biUnion (fun e => (G.ends e).toFinset) = Y := by + ext v + constructor + · intro hv + obtain ⟨e, he, hev⟩ := Finset.mem_biUnion.mp hv + have hvX := (good_spec e |>.mp he).2 v (Sym2.mem_toFinset.mp hev) + have hvx : v ≠ x := by + intro hvx + exact no_x e (good_spec e |>.mp he).1 (hvx ▸ Sym2.mem_toFinset.mp hev) + exact Finset.mem_erase.mpr ⟨hvx, hvX⟩ + · intro hv + have hvY : v ∈ Y := hv + obtain ⟨e, he, hve⟩ := edge_inc v hvY + have hg : e ∈ good := good_spec e |>.mpr ⟨he.1, + internal_other e he.1 v (Finset.mem_erase.mp hvY).2 he.2⟩ + exact Finset.mem_biUnion.mpr ⟨e, hg, Sym2.mem_toFinset.mpr he.2⟩ + have heven : Even Y.card := by + refine ⟨good.card, ?_⟩ + rw [← union_eq, union_card] + omega + have hcard : X.card = Y.card + 1 := by + have hh := Finset.card_erase_of_mem hxX' + simp [Y] at hh ⊢ + have hpos : 0 < X.card := Finset.card_pos.mpr ⟨x, hxX'⟩ + omega + rw [hcard] + rcases heven with ⟨q, hq⟩ + exact ⟨q, by omega⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableDisjointExitPaths.lean b/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableDisjointExitPaths.lean new file mode 100644 index 0000000000..04640992ab --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableDisjointExitPaths.lean @@ -0,0 +1,1124 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors + +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint + +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent + +/-! +# Elementary Closed Noninterchangeable Disjoint Exit Paths + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_77.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {k : ℕ} (phi : + PartialEdgeColoring E k) (a b : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; + ∀ (c low u v : V ⊕ E) (p : (TwoColorIncidenceGraph G phi a b).Walk u v), p.IsPath → + {x : V ⊕ E | x ∈ p.support} = TwoColorComponent G phi a b c → low ∈ p.support → low = v → + ∃ (v : V ⊕ E) (p : H.Walk low v), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G + phi a b c := by + classical + intro V E G k phi a b H c low u v p hp hps hlowP hlv + subst v + refine ⟨u, p.reverse, hp.reverse, ?_⟩ + ext y + change y ∈ p.reverse.support ↔ + y ∈ TwoColorComponent G phi a b c + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] + exact Set.ext_iff.mp hps y + +private theorem helper_branch_85.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (a b : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; + let X : Finset V := TreeSequenceVertexSet T; + ∀ (c : V ⊕ E), ( + ∃ x ∈ X, Sum.inl x ∈ TwoColorComponent G phi a b c) → + ∀ (low v : V ⊕ E) (p : H.Walk low v), {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi a + b c → p.Nil → ( + ∃ x ∈ X, TwoColorComponent G phi a b c = {Sum.inl x} ∧ a ∈ MissingColors G phi x ∧ b ∈ + MissingColors G phi x) ∨ + ∃ (r : V) (s : V) (p : H.Walk (Sum.inl r) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} + = TwoColorComponent G phi a b c ∧ r ≠ s ∧ (a ∈ MissingColors G phi r ∨ b ∈ MissingColors G + phi r) ∧ (a ∈ MissingColors G phi s ∨ b ∈ MissingColors G phi s) := by + classical + intro V E _ _ G k e0 T phi a b H X c hcX low v p hps hnil + let _ := Fintype.ofFinite V + obtain ⟨x, hxX, hxC⟩ := hcX + have hxP : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {y | y ∈ p.support} + rw [hps] + exact hxC + have hxlow : Sum.inl x = low := by + rw [SimpleGraph.Walk.nil_iff_support_eq.mp hnil] at hxP + simpa using hxP + have hCsingle : TwoColorComponent G phi a b c = {Sum.inl x} := by + rw [← hps] + ext y + rw [Set.mem_ofPred_eq, Set.mem_singleton_iff, + SimpleGraph.Walk.nil_iff_support_eq.mp hnil] + simp [hxlow] + have hmissing : ∀ d : Fin k, + (d = a ∨ d = b) → d ∈ MissingColors G phi x := by + intro d hd + have hnotpresent : d ∉ PresentColors G phi x := by + intro hpresent + obtain ⟨e, heinc, hecolor⟩ := by + simpa [PresentColors] using hpresent + have hepair : phi e = some a ∨ phi e = some b := + hd.elim + (fun h => Or.inl (hecolor.trans (congrArg some h))) + (fun h => Or.inr (hecolor.trans (congrArg some h))) + have hadj : H.Adj (Sum.inl x) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G x e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨heinc, hepair⟩) + have hedgeC : Sum.inr e ∈ TwoColorComponent G phi a b c := by + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk c + change H.connectedComponentMk (Sum.inl x) = + H.connectedComponentMk c at hxC + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm.trans hxC + rw [hCsingle] at hedgeC + simp at hedgeC + simpa [MissingColors] using hnotpresent + left + exact ⟨x, hxX, hCsingle, hmissing a (Or.inl rfl), + hmissing b (Or.inr rfl)⟩ + +private theorem helper_branch_132.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {k : ℕ} (phi : + PartialEdgeColoring E k) (a b : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; + ∀ (v : V ⊕ E) (e : E), ((TwoColorIncidenceGraph G phi a b).neighborSet (Sum.inr + e)).Subsingleton → + ∀ (p : H.Walk (Sum.inr e) v), ¬p.Nil → + ∃ (r : V), Sum.inr e = Sum.inl r := by + classical + intro V E G k phi a b H v e hlow p hnil + have hadj := p.adj_snd hnil + have hecolor : phi e = some a ∨ phi e = some b := by + cases hsnd : p.snd with + | inl q => + rw [hsnd] at hadj + have hdata : Incident G q e ∧ + (phi e = some a ∨ phi e = some b) := by + simpa [H, TwoColorIncidenceGraph] using hadj + exact hdata.2 + | inr f => + rw [hsnd] at hadj + have : False := by + simp [H, TwoColorIncidenceGraph] at hadj + exact this.elim + induction hends : G.ends e using Sym2.inductionOn with + | _ q t => + have hqt : q ≠ t := by + intro hqt + subst t + exact G.loopless e q hends + have hqAdj : H.Adj (Sum.inr e) (Sum.inl q) := by + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G q e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨by simp [Incident, hends], hecolor⟩) + have htAdj : H.Adj (Sum.inr e) (Sum.inl t) := by + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G t e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨by simp [Incident, hends], hecolor⟩) + exact False.elim (hqt (Sum.inl.inj (hlow hqAdj htAdj))) + +private theorem helper_hend_neighbor_166.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → + ∀ (a b : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; + ∀ (c v : V ⊕ E) (r : V), ((TwoColorIncidenceGraph G phi a b).neighborSet (Sum.inl + r)).Subsingleton → + ∀ (p : H.Walk (Sum.inl r) v), p.IsPath → {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi + a b c → ¬p.Nil → + ∀ (y : V ⊕ E), H.Adj v y → y = p.getVert (p.length - (1 : ℕ)) := by + classical + intro V E _ _ G k phi hproper a b H c v r hlow p hp hps hnil y hvy + let := Fintype.ofFinite V + let := Fintype.ofFinite E + have hyC : y ∈ TwoColorComponent G phi a b c := by + have hvC : v ∈ TwoColorComponent G phi a b c := by + rw [← hps] + change v ∈ p.support + simpa only [p.getVert_length] using + p.getVert_mem_support p.length + change H.connectedComponentMk y = H.connectedComponentMk c + change H.connectedComponentMk v = H.connectedComponentMk c at hvC + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hvy).symm.trans hvC + have hySupport : y ∈ p.support := by + change y ∈ {q | q ∈ p.support} + rw [hps] + exact hyC + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hySupport + have hnlt : n < p.length := by + have hnne : n ≠ p.length := by + intro heq + have hyv : y = v := by rw [← hn, heq, p.getVert_length] + exact hvy.ne hyv.symm + omega + by_cases hpen : n + 1 = p.length + · rw [← hn] + congr 1 + omega + by_cases hn0 : n = 0 + · have hnext : H.Adj (Sum.inl r) (p.getVert 1) := by + simpa [hn0, p.getVert_zero] using p.adj_getVert_succ hnlt + have hvstart : H.Adj (Sum.inl r) v := by + rw [← hn, hn0, p.getVert_zero] at hvy + exact hvy.symm + have hneNext : p.getVert 1 ≠ v := by + intro heq + have hindices := hp.getVert_injOn + (show 1 ≤ p.length by omega) (show p.length ≤ p.length by rfl) + (heq.trans p.getVert_length.symm) + omega + exact False.elim (hneNext (hlow hnext hvstart)) + · have hleft : H.Adj y (p.getVert (n - 1)) := by + rw [← hn] + have hadj := p.adj_getVert_succ (i := n - 1) (by omega) + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ n)] using + hadj.symm + have hright : H.Adj y (p.getVert (n + 1)) := by + rw [← hn] + exact p.adj_getVert_succ hnlt + have hvneLeft : v ≠ p.getVert (n - 1) := by + intro heq + have hindices := hp.getVert_injOn + (show p.length ≤ p.length by rfl) + (show n - 1 ≤ p.length by omega) + (p.getVert_length.trans heq) + omega + have hvneRight : v ≠ p.getVert (n + 1) := by + intro heq + have hindices := hp.getVert_injOn + (show p.length ≤ p.length by rfl) + (show n + 1 ≤ p.length by omega) + (p.getVert_length.trans heq) + omega + have hlrne : p.getVert (n - 1) ≠ p.getVert (n + 1) := by + intro heq + have hindices := hp.getVert_injOn + (show n - 1 ≤ p.length by omega) + (show n + 1 ≤ p.length by omega) heq + omega + let : Fintype (H.neighborSet y) := Fintype.ofFinite _ + have hthree : 3 ≤ @SimpleGraph.degree _ H y + (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let ss : Finset (Sum V E) := + {v, p.getVert (n - 1), p.getVert (n + 1)} + have hss : ss ⊆ H.neighborFinset y := by + intro t ht + simp only [ss, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hvy.symm + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc3 : 3 ≤ ss.card := by + simp [ss, hvneLeft, hvneRight, hlrne] + exact hc3.trans (Finset.card_le_card hss) + have htwo : @SimpleGraph.degree _ H y + (Fintype.ofFinite _) ≤ 2 := by + simpa [H] using + TwoColorIncidenceDegreeAtMostTwo G phi a b hproper y + omega + +private theorem helper_hendVertex_263.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {k : ℕ} (phi : + PartialEdgeColoring E k) (a b : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; + ∀ (v : V ⊕ E) (r : V) (p : H.Walk (Sum.inl r) v), (H.neighborSet v).Subsingleton → (0 : ℕ) < + p.length → + ∃ (s : V), v = Sum.inl s := by + classical + intro V E G k phi a b H v r p hendLeaf hp_pos + cases hv : v with + | inl s => exact ⟨s, rfl⟩ + | inr e => + have hlastAdj : H.Adj (p.getVert (p.length - 1)) v := by + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ p.length), + p.getVert_length] using + p.adj_getVert_succ (i := p.length - 1) (by omega) + have hecolor : phi e = some a ∨ phi e = some b := by + cases hprev : p.getVert (p.length - 1) with + | inl q => + rw [hprev, hv] at hlastAdj + have hdata : Incident G q e ∧ + (phi e = some a ∨ phi e = some b) := by + simpa [H, TwoColorIncidenceGraph] using hlastAdj + exact hdata.2 + | inr f => + rw [hprev, hv] at hlastAdj + have : False := by + simp [H, TwoColorIncidenceGraph] at hlastAdj + exact this.elim + induction hends : G.ends e using Sym2.inductionOn with + | _ q t => + have hqt : q ≠ t := by + intro hqt + subst t + exact G.loopless e q hends + have hqAdj : H.Adj v (Sum.inl q) := by + rw [hv] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G q e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨by simp [Incident, hends], hecolor⟩) + have htAdj : H.Adj v (Sum.inl t) := by + rw [hv] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G t e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨by simp [Incident, hends], hecolor⟩) + exact False.elim + (hqt (Sum.inl.inj (hendLeaf hqAdj htAdj))) + +private theorem helper_analyze_95.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (T : TreeSequence G e0) (phi : PartialEdgeColoring E k), IsProperEdgeColoring G + phi → + ∀ (a b : Fin k), ( + ∀ (v : V), ((TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).neighborSet (Sum.inl + v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v) → + ∀ (c : V ⊕ E), TwoColorPathComponent G phi a b c → ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ TwoColorComponent G phi a b c) → ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), TwoColorComponent G phi a b c = {Sum.inl x} ∧ a ∈ + MissingColors G phi x ∧ b ∈ MissingColors G phi x) ∨ + ∃ (r : V) (s : V) (p : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl + r) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi a b c ∧ + r ≠ s ∧ (a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r) ∧ (a ∈ MissingColors G phi + s ∨ b ∈ MissingColors G phi s) := by + classical + intro V E _ _ G k e0 T phi hproper a b + let _ := Fintype.ofFinite V + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b + set X : Finset V := TreeSequenceVertexSet T + intro endpoint_missing c hc hcX + obtain ⟨low, hlowC, hlow⟩ := hc.2 + obtain ⟨u, v, p, hp, hps⟩ := + TwoColorComponentSpanningPath G phi a b hproper c + have hlowP : low ∈ p.support := by + change low ∈ {y | y ∈ p.support} + rw [hps] + exact hlowC + have hlowEnd : low = u ∨ low = v := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hlow) hlowP + obtain ⟨v, p, hp, hps⟩ : ∃ (v : Sum V E) (p : H.Walk low v), + p.IsPath ∧ {y | y ∈ p.support} = + TwoColorComponent G phi a b c := by + rcases hlowEnd with hlu | hlv + · subst u + exact ⟨v, p, hp, hps⟩ + · exact @helper_branch_77 (@V) (@E) (@G) (@k) (@phi) (@a) (@b) (@c) (@low) (@u) (@v) (@p) + (@hp) (@hps) (@hlowP) (@hlv) + by_cases hnil : p.Nil + · exact @helper_branch_85 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) (@phi) + (@a) (@b) (@c) (@hcX) (@low) (@v) (@p) (@hps) (@hnil) + · have hstartVertex : ∃ r : V, low = Sum.inl r := by + cases low with + | inl r => exact ⟨r, rfl⟩ + | inr e => + exact @helper_branch_132 (@V) (@E) (@G) (@k) (@phi) (@a) (@b) (@v) (@e) (@hlow) (@p) + (@hnil) + obtain ⟨r, hr⟩ := hstartVertex + subst low + have hend_neighbor := + @helper_hend_neighbor_166 (@V) (@E) inferInstance inferInstance (@G) (@k) (@phi) (@hproper) + (@a) (@b) (@c) (@v) (@r) (@hlow) (@p) (@hp) (@hps) (@hnil) + have hendLeaf : Set.Subsingleton (H.neighborSet v) := by + intro y hy y' hy' + exact (hend_neighbor y hy).trans (hend_neighbor y' hy').symm + have hp_pos : 0 < p.length := + SimpleGraph.Walk.not_nil_iff_lt_length.mp hnil + have hendVertex := + @helper_hendVertex_263 (@V) (@E) (@G) (@k) (@phi) (@a) (@b) (@v) (@r) (@p) (@hendLeaf) + (@hp_pos) + obtain ⟨s, hs⟩ := hendVertex + subst v + have hrs : r ≠ s := by + intro hrs + apply hnil + exact hp.nil_iff_eq.mpr (by simp [hrs]) + right + exact ⟨r, s, p, hp, hps, hrs, endpoint_missing r hlow, + endpoint_missing s hendLeaf⟩ + +private theorem helper_chooseFirst_365.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) + {k : ℕ} (phi : PartialEdgeColoring E k) (a b : Fin k), + ∀ {u v : V ⊕ E} (p : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk u v) (S : + Finset (V ⊕ E)), {x ∈ S | x ∈ p.support}.Nonempty → + ∃ x ∈ S, + ∃ (hx : x ∈ p.support), + ∀ t ∈ S, t ∈ (p.takeUntil x hx).support → t = x := by + classical + intro V E _ _ G k phi a b + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b + intro u v p S hnonempty + have firstErase : ∃ x ∈ S, ∃ (hx : x ∈ p.support), + {t ∈ S.erase x | t ∈ (p.takeUntil x hx).support} = ∅ := by + simp only [← Finset.subset_empty] + induction hn : p.length + S.card using Nat.strong_induction_on + generalizing S v with + | _ n ih => + simp only [Finset.Nonempty, Finset.mem_filter] at hnonempty + obtain ⟨x, hxS, hxP⟩ := hnonempty + obtain hempty | hmore := Finset.eq_empty_or_nonempty + {t ∈ S.erase x | t ∈ (p.takeUntil x hxP).support} + · exact ⟨x, hxS, hxP, hempty.le⟩ + · have hlt : (p.takeUntil x hxP).length + (S.erase x).card < n := by + rw [← Finset.card_erase_add_one hxS] at hn + have hle := p.length_takeUntil_le_length hxP + omega + obtain ⟨y, hyS, hyP, hyempty⟩ := + ih _ hlt (p.takeUntil x hxP) (S.erase x) hmore rfl + refine ⟨y, Finset.mem_of_mem_erase hyS, + p.support_takeUntil_subset_support hxP hyP, ?_⟩ + rwa [p.takeUntil_takeUntil, Finset.erase_right_comm, + Finset.filter_erase, Finset.erase_eq_of_notMem] at hyempty + simp only [Finset.mem_filter, Finset.mem_erase, ne_eq, not_and, + and_imp] + rintro hxy - + exact p.notMem_support_takeUntil_support_takeUntil_subset + (Ne.symm hxy) hxP hyP + obtain ⟨x, hxS, hxP, hempty⟩ := firstErase + refine ⟨x, hxS, hxP, ?_⟩ + suffices {t ∈ S | t ∈ (p.takeUntil x hxP).support} ⊆ {x} by + simpa [Finset.subset_iff] using this + rwa [Finset.filter_erase, ← Finset.subset_empty, + ← Finset.subset_insert_iff, LawfulSingleton.insert_empty_eq] at hempty + +private theorem helper_firstEntry_403.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) {k : ℕ} {e0 : E} (T : TreeSequence G e0) (phi : + PartialEdgeColoring E k) (a b : Fin k) (_ : TreeColorSetClosed G phi T { a }) (_ : ( + ∀ {u v : V ⊕ E} (p : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk u v) (S : + Finset (V ⊕ E)) (_ : {x ∈ S | x ∈ p.support}.Nonempty), + ∃ x ∈ S, + ∃ (hx : x ∈ p.support), + ∀ t ∈ S, t ∈ (p.takeUntil x hx).support → t = x)) (r s : V) (Q : (TwoColorIncidenceGraph G phi + a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r) (Sum.inl s)) (_ : Q.IsPath) (_ : a ∈ + MissingColors G phi r ∨ b ∈ MissingColors G phi r) (_ : r ∉ (TreeSequenceVertexSet T : + Finset V)) (_ : ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ Q.support)), + ∃ (c : V) (_ : c ∈ (TreeSequenceVertexSet T : Finset V)) (hcQ : Sum.inl c ∈ Q.support), + let L : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r) (Sum.inl c) + := Q.takeUntil (Sum.inl c) hcQ; TreeExitPath T phi a b r c L ∧ + ∃ (g : E), L.getVert (L.length - (1 : ℕ)) = Sum.inr g ∧ Incident G c g ∧ g ∈ BoundaryEdges G + (TreeSequenceVertexSet T : Finset V) ∧ phi g = some b := by + classical + intro V E _ _ _ _ G k e0 T phi a b hclosed + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b + set X : Finset V := TreeSequenceVertexSet T + intro chooseFirst r s Q hQ hmissing hrX hmeet + let S : Finset (Sum V E) := X.image Sum.inl + obtain ⟨q, hqS, hqQ, hqfirst⟩ := + chooseFirst Q S (by + obtain ⟨x, hxX, hxQ⟩ := hmeet + exact ⟨Sum.inl x, by simp [S, hxX, hxQ]⟩) + obtain ⟨c, hcX, hcq⟩ : ∃ c, c ∈ X ∧ Sum.inl c = q := by + simpa [S] using hqS + subst q + let L := Q.takeUntil (Sum.inl c) hqQ + have hLc : ∀ x ∈ X, (Sum.inl x ∈ L.support ↔ x = c) := by + intro x hxX + constructor + · intro hxL + have heq := hqfirst (Sum.inl x) (by simp [S, hxX]) hxL + exact Sum.inl.inj heq + · rintro rfl + exact L.end_mem_support + have hrc : r ≠ c := by + intro hrc + apply hrX + simpa [hrc] using hcX + have hLpath : L.IsPath := hQ.takeUntil _ + have hLlen : 2 ≤ L.length := by + have hpos : 0 < L.length := by + apply Nat.pos_of_ne_zero + intro hn + have hnil : L.Nil := SimpleGraph.Walk.length_eq_zero_iff.mp hn + exact hrc (Sum.inl.inj hnil.eq) + by_contra hnotTwo + have hlen : L.length = 1 := by omega + have hadj := L.adj_getVert_succ (i := 0) (by omega) + have hend : L.getVert 1 = Sum.inl c := by + have heq := L.getVert_length + rwa [hlen] at heq + rw [L.getVert_zero, hend] at hadj + simp [TwoColorIncidenceGraph] at hadj + have hExit : TreeExitPath T phi a b r c L := by + unfold TreeExitPath + exact ⟨hLpath, hLlen, hrX, hcX, hmissing, hLc⟩ + have hlastAdj := L.adj_getVert_succ (i := L.length - 1) (by omega) + have hlastSucc : L.length - 1 + 1 = L.length := by omega + rw [hlastSucc, L.getVert_length] at hlastAdj + cases hlast : L.getVert (L.length - 1) with + | inl v => + rw [hlast] at hlastAdj + simp [TwoColorIncidenceGraph] at hlastAdj + | inr g => + rw [hlast] at hlastAdj + have hgc : Incident G c g ∧ + (phi g = some a ∨ phi g = some b) := by + simpa [H, TwoColorIncidenceGraph] using hlastAdj + have hprevAdj := L.adj_getVert_succ (i := L.length - 2) (by omega) + have hprevSucc : L.length - 2 + 1 = L.length - 1 := by omega + rw [hprevSucc, hlast] at hprevAdj + cases hprev : L.getVert (L.length - 2) with + | inr f => + rw [hprev] at hprevAdj + simp [TwoColorIncidenceGraph] at hprevAdj + | inl x => + rw [hprev] at hprevAdj + have hxg : Incident G x g := by + have hdata : Incident G x g ∧ + (phi g = some a ∨ phi g = some b) := by + simpa [H, TwoColorIncidenceGraph] using hprevAdj + exact hdata.1 + have hxout : x ∉ X := by + intro hxX + have hxc := (hLc x hxX).mp (by + rw [← hprev] + exact L.getVert_mem_support (L.length - 2)) + have heq : L.getVert (L.length - 2) = + L.getVert L.length := by + rw [hprev, L.getVert_length, hxc] + have := hLpath.getVert_injOn (Nat.sub_le _ _) (by simp) heq + omega + have hcx : c ≠ x := by + intro hcx + exact hxout (hcx ▸ hcX) + have hends : G.ends g = s(c, x) := + (Sym2.mem_and_mem_iff hcx).mp ⟨hgc.1, hxg⟩ + have hboundary : g ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨c, hcX, x, hxout, hends⟩ + have hga : phi g ≠ some a := by + intro hga + have hgColor : g ∈ BoundaryColorEdges G phi X a := by + simp [BoundaryColorEdges, hboundary, hga] + have hclosedA : BoundaryColorEdges G phi X a = ∅ := by + dsimp [X] + exact hclosed a (by simp) + rw [hclosedA] at hgColor + simp at hgColor + refine ⟨c, hcX, hqQ, hExit, g, hlast, hgc.1, + hboundary, ?_⟩ + exact hgc.2.resolve_left hga + +private theorem helper_differentExits_540.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) {k : ℕ} {e0 : E} (T : TreeSequence G e0) (phi : + PartialEdgeColoring E k) (a b : Fin k) (z w : V ⊕ E) (_ : Disjoint (TwoColorComponent G + phi a b z) (TwoColorComponent G phi a b w)) (_ : ( + ∀ (r s : V) (Q : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r) + (Sum.inl s)) (_ : Q.IsPath) (_ : a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r) (_ + : r ∉ (TreeSequenceVertexSet T : Finset V)) (_ : ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ Q.support)), + ∃ (c : V) (_ : c ∈ (TreeSequenceVertexSet T : Finset V)) (hcQ : Sum.inl c ∈ Q.support), + let L : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r) (Sum.inl c) + := Q.takeUntil (Sum.inl c) hcQ; TreeExitPath T phi a b r c L ∧ + ∃ (g : E), L.getVert (L.length - (1 : ℕ)) = Sum.inr g ∧ Incident G c g ∧ g ∈ BoundaryEdges G + (TreeSequenceVertexSet T : Finset V) ∧ phi g = some b)) (r1 s1 r2 s2 : V) (p1 : + (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r1) (Sum.inl s1)) + (p2 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r2) (Sum.inl + s2)) (_ : p1.IsPath) (_ : p2.IsPath) (_ : {q : V ⊕ E | q ∈ p1.support} = TwoColorComponent + G phi a b z) (_ : {q : V ⊕ E | q ∈ p2.support} = TwoColorComponent G phi a b w) (_ : a ∈ + MissingColors G phi r1 ∨ b ∈ MissingColors G phi r1) (_ : a ∈ MissingColors G phi r2 ∨ b ∈ + MissingColors G phi r2) (_ : r1 ∉ (TreeSequenceVertexSet T : Finset V)) (_ : r2 ∉ + (TreeSequenceVertexSet T : Finset V)) (_ : ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ p1.support)) (_ : ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ p2.support)), + ∃ (c1 : V) (c2 : V) (L1 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r1) (Sum.inl c1)) (L2 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ + E)).Walk (Sum.inl r2) (Sum.inl c2)), TreeExitPath T phi a b r1 c1 L1 ∧ TreeExitPath T phi + a b r2 c2 L2 ∧ ( + ∀ q ∈ L1.support, q ∉ L2.support) ∧ r1 ≠ r2 ∧ c1 ≠ c2 := by + classical + intro V E _ _ _ _ G k e0 T phi a b + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b + set X : Finset V := TreeSequenceVertexSet T + intro z w hdisj firstEntry r1 s1 r2 s2 p1 p2 hp1 hp2 hps1 hps2 hm1 hm2 hr1X hr2X hmeet1 hmeet2 + obtain ⟨c1, hc1X, hc1P, hExit1, g1, hg1last, hg1c, + hg1B, hg1col⟩ := firstEntry r1 s1 p1 hp1 hm1 hr1X hmeet1 + obtain ⟨c2, hc2X, hc2P, hExit2, g2, hg2last, hg2c, + hg2B, hg2col⟩ := firstEntry r2 s2 p2 hp2 hm2 hr2X hmeet2 + let L1 := p1.takeUntil (Sum.inl c1) hc1P + let L2 := p2.takeUntil (Sum.inl c2) hc2P + have hL1sub : L1.support ⊆ p1.support := + p1.support_takeUntil_subset_support hc1P + have hL2sub : L2.support ⊆ p2.support := + p2.support_takeUntil_subset_support hc2P + have hdis : ∀ q, q ∈ L1.support → q ∉ L2.support := by + intro q hq1 hq2 + apply (Set.disjoint_left.mp hdisj) + · rw [← hps1] + exact hL1sub hq1 + · rw [← hps2] + exact hL2sub hq2 + have hrne : r1 ≠ r2 := by + intro hr + apply hdis (Sum.inl r1) + · exact L1.start_mem_support + · simp [hr] + have hcne : c1 ≠ c2 := by + intro hc + apply hdis (Sum.inl c1) + · exact L1.end_mem_support + · simp [hc] + exact ⟨c1, c2, L1, L2, hExit1, hExit2, hdis, hrne, hcne⟩ + +private theorem helper_sameExits_588.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) {k : ℕ} {e0 : E} (T : TreeSequence G e0) (phi : + PartialEdgeColoring E k) (_ : IsProperEdgeColoring G phi) (a b : Fin k) (_ : ( + ∀ (r s : V) (Q : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r) + (Sum.inl s)) (_ : Q.IsPath) (_ : a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r) (_ + : r ∉ (TreeSequenceVertexSet T : Finset V)) (_ : ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ Q.support)), + ∃ (c : V) (_ : c ∈ (TreeSequenceVertexSet T : Finset V)) (hcQ : Sum.inl c ∈ Q.support), + let L : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r) (Sum.inl c) + := Q.takeUntil (Sum.inl c) hcQ; TreeExitPath T phi a b r c L ∧ + ∃ (g : E), L.getVert (L.length - (1 : ℕ)) = Sum.inr g ∧ Incident G c g ∧ g ∈ BoundaryEdges G + (TreeSequenceVertexSet T : Finset V) ∧ phi g = some b)) (r s : V) (p : + (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r) (Sum.inl s)) (_ + : p.IsPath) (_ : r ≠ s) (_ : a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r) (_ : a + ∈ MissingColors G phi s ∨ b ∈ MissingColors G phi s) (_ : r ∉ (TreeSequenceVertexSet T : + Finset V)) (_ : s ∉ (TreeSequenceVertexSet T : Finset V)) (_ : ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ p.support)), + ∃ (c1 : V) (c2 : V) (L1 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r) (Sum.inl c1)) (L2 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ + E)).Walk (Sum.inl s) (Sum.inl c2)), TreeExitPath T phi a b r c1 L1 ∧ TreeExitPath T phi a + b s c2 L2 ∧ ( + ∀ q ∈ L1.support, q ∉ L2.support) ∧ r ≠ s ∧ c1 ≠ c2 := by + classical + intro V E _ _ _ _ G k e0 T phi hproper a b + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b + set X : Finset V := TreeSequenceVertexSet T + intro firstEntry r s p hp hrs hrm hsm hrX hsX hmeet + have hmeetRev : ∃ x ∈ X, Sum.inl x ∈ p.reverse.support := by + obtain ⟨x, hxX, hxP⟩ := hmeet + refine ⟨x, hxX, ?_⟩ + simpa only [SimpleGraph.Walk.support_reverse, List.mem_reverse] using hxP + obtain ⟨c1, hc1X, hc1P, hExit1, g1, hg1last, hg1c, + hg1B, hg1col⟩ := firstEntry r s p hp hrm hrX hmeet + obtain ⟨c2, hc2X, hc2P, hExit2, g2, hg2last, hg2c, + hg2B, hg2col⟩ := + firstEntry s r p.reverse hp.reverse hsm hsX hmeetRev + let L1 := p.takeUntil (Sum.inl c1) hc1P + let L2 := p.reverse.takeUntil (Sum.inl c2) hc2P + have hL1le : L1.length ≤ p.length := + p.length_takeUntil_le_length hc1P + have hL2le : L2.length ≤ p.length := by + have hle := p.reverse.length_takeUntil_le_length hc2P + simpa using hle + have hc1idx : p.getVert L1.length = Sum.inl c1 := + p.getVert_length_takeUntil hc1P + have hc2idxRev : p.reverse.getVert L2.length = Sum.inl c2 := + p.reverse.getVert_length_takeUntil hc2P + have hc2idx : p.getVert (p.length - L2.length) = Sum.inl c2 := + (SimpleGraph.Walk.getVert_reverse p L2.length).symm.trans hc2idxRev + have hg1idx : p.getVert (L1.length - 1) = Sum.inr g1 := by + have hpred : L1.length - 1 ≤ + (p.takeUntil (Sum.inl c1) hc1P).length := by + dsimp [L1] + omega + rw [← p.getVert_takeUntil hc1P hpred] + exact hg1last + have hg2idxRev : p.reverse.getVert (L2.length - 1) = Sum.inr g2 := by + have hpred : L2.length - 1 ≤ + (p.reverse.takeUntil (Sum.inl c2) hc2P).length := by + dsimp [L2] + omega + rw [← p.reverse.getVert_takeUntil hc2P hpred] + exact hg2last + have hg2idx : p.getVert (p.length - (L2.length - 1)) = Sum.inr g2 := + (SimpleGraph.Walk.getVert_reverse p (L2.length - 1)).symm.trans + hg2idxRev + have hcne : c1 ≠ c2 := by + intro hc + subst c2 + have hci : L1.length = p.length - L2.length := by + apply hp.getVert_injOn hL1le (Nat.sub_le _ _) + exact hc1idx.trans hc2idx.symm + have hgne : g1 ≠ g2 := by + intro hg + subst g2 + have hgi : L1.length - 1 = p.length - (L2.length - 1) := by + apply hp.getVert_injOn ((Nat.sub_le _ _).trans hL1le) + (Nat.sub_le _ _) + exact hg1idx.trans hg2idx.symm + have hL1two : 2 ≤ L1.length := hExit1.2.1 + have hL2two : 2 ≤ L2.length := hExit2.2.1 + omega + exact (hproper hgne ⟨c1, hg1c, hg2c⟩ hg1col) hg2col + have hdis : ∀ q, q ∈ L1.support → q ∉ L2.support := by + intro q hq1 hq2 + obtain ⟨i, hi, hiLe⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hq1 + obtain ⟨j, hj, hjLe⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hq2 + have hiP : p.getVert i = q := by + rw [← p.getVert_takeUntil hc1P hiLe] + exact hi + have hjRev : p.reverse.getVert j = q := by + rw [← p.reverse.getVert_takeUntil hc2P hjLe] + exact hj + have hjP : p.getVert (p.length - j) = q := + (SimpleGraph.Walk.getVert_reverse p j).symm.trans hjRev + have hij : i = p.length - j := by + apply hp.getVert_injOn (hiLe.trans hL1le) (Nat.sub_le _ _) + exact hiP.trans hjP.symm + have hc2Before : p.length - L2.length ≤ L1.length := by omega + have hc2L1 : Sum.inl c2 ∈ L1.support := by + have hvertex : L1.getVert (p.length - L2.length) = Sum.inl c2 := by + exact (p.getVert_takeUntil hc1P hc2Before).trans hc2idx + rw [← hvertex] + exact L1.getVert_mem_support (p.length - L2.length) + exact hcne ((hExit1.2.2.2.2.2 c2 hc2X).mp hc2L1).symm + exact ⟨c1, c2, L1, L2, hExit1, hExit2, hdis, hrs, hcne⟩ + +private theorem helper_branch_711.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (a b : Fin k), + ∀ (z w : V ⊕ E), ( + ∃ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G phi a b w) → ( + ∀ {u v : V}, u ∈ (TreeSequenceVertexSet T : Finset V) → v ∈ (TreeSequenceVertexSet T : Finset + V) → u ≠ v → + ∀ {d : Fin k}, d ∈ MissingColors G phi u → d ∈ MissingColors G phi v → False) → ( + ∀ (r s : V) (p : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r) + (Sum.inl s)), p.IsPath → r ≠ s → a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r → a + ∈ MissingColors G phi s ∨ b ∈ MissingColors G phi s → r ∉ (TreeSequenceVertexSet T : + Finset V) → s ∉ (TreeSequenceVertexSet T : Finset V) → ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ p.support) → + ∃ (c1 : V) (c2 : V) (L1 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r) (Sum.inl c1)) (L2 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ + E)).Walk (Sum.inl s) (Sum.inl c2)), TreeExitPath T phi a b r c1 L1 ∧ TreeExitPath T phi a + b s c2 L2 ∧ ( + ∀ q ∈ L1.support, q ∉ L2.support) ∧ r ≠ s ∧ c1 ≠ c2) → ( + ∀ {u v : V}, Sum.inl u ∈ TwoColorComponent G phi a b z → Sum.inl v ∈ TwoColorComponent G phi a + b w → u ≠ v) → ( + ∀ (r s : V), ( + ∃ (c1 : V) (c2 : V) (L1 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r) (Sum.inl c1)) (L2 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ + E)).Walk (Sum.inl s) (Sum.inl c2)), TreeExitPath T phi a b r c1 L1 ∧ TreeExitPath T phi a + b s c2 L2 ∧ ( + ∀ q ∈ L1.support, q ∉ L2.support) ∧ r ≠ s ∧ c1 ≠ c2) → + ∃ (a1 : V) (b1 : V) (a2 : V) (b2 : V) (P1 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V + ⊕ E)).Walk (Sum.inl a1) (Sum.inl b1)) (P2 : (TwoColorIncidenceGraph G phi a b : + SimpleGraph (V ⊕ E)).Walk (Sum.inl a2) (Sum.inl b2)), TreeExitPath T phi a b a1 b1 P1 ∧ + TreeExitPath T phi a b a2 b2 P2 ∧ ( + ∀ q ∈ P1.support, q ∉ P2.support) ∧ a1 ≠ a2 ∧ b1 ≠ b2) → (( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), TwoColorComponent G phi a b w = {Sum.inl x} ∧ a ∈ + MissingColors G phi x ∧ b ∈ MissingColors G phi x) ∨ + ∃ (r : V) (s : V) (p : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl + r) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi a b w ∧ + r ≠ s ∧ (a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r) ∧ (a ∈ MissingColors G phi + s ∨ b ∈ MissingColors G phi s)) → ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), TwoColorComponent G phi a b z = {Sum.inl x} ∧ a ∈ + MissingColors G phi x ∧ b ∈ MissingColors G phi x) → + ∃ (a1 : V) (b1 : V) (a2 : V) (b2 : V) (P1 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl + a1) (Sum.inl b1)) (P2 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a2) (Sum.inl + b2)), TreeExitPath T phi a b a1 b1 P1 ∧ TreeExitPath T phi a b a2 b2 P2 ∧ ( + ∀ x ∈ P1.support, x ∉ P2.support) ∧ a1 ≠ a2 ∧ b1 ≠ b2 := by + classical + intro V E _ _ G k e0 T phi a b + let _ := Fintype.ofFinite V + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b + set X : Finset V := TreeSequenceVertexSet T + intro z w hwX no_repeat sameExits separated finish hwdata hziso + obtain ⟨x, hxX, hzsingle, hxa, hxb⟩ := hziso + have hxC : Sum.inl x ∈ TwoColorComponent G phi a b z := by + rw [hzsingle] + simp + rcases hwdata with hwiso | hwnon + · obtain ⟨y, hyX, hwsingle, hya, hyb⟩ := hwiso + have hyC : Sum.inl y ∈ TwoColorComponent G phi a b w := by + rw [hwsingle] + simp + exact (no_repeat hxX hyX (separated hxC hyC) hxa hya).elim + · obtain ⟨r, s, p, hp, hps, hrs, hrm, hsm⟩ := hwnon + have hrC : Sum.inl r ∈ TwoColorComponent G phi a b w := by + rw [← hps] + simp + have hsC : Sum.inl s ∈ TwoColorComponent G phi a b w := by + rw [← hps] + change Sum.inl s ∈ p.support + simpa only [p.getVert_length] using p.getVert_mem_support p.length + have hrOut : r ∉ X := by + intro hrX + rcases hrm with hra | hrb + · exact no_repeat hxX hrX (separated hxC hrC) hxa hra + · exact no_repeat hxX hrX (separated hxC hrC) hxb hrb + have hsOut : s ∉ X := by + intro hsX + rcases hsm with hsa | hsb + · exact no_repeat hxX hsX (separated hxC hsC) hxa hsa + · exact no_repeat hxX hsX (separated hxC hsC) hxb hsb + have hmeet : ∃ q ∈ X, Sum.inl q ∈ p.support := by + obtain ⟨q, hqX, hqC⟩ := hwX + refine ⟨q, by simpa [X] using hqX, ?_⟩ + change Sum.inl q ∈ {t | t ∈ p.support} + rw [hps] + exact hqC + exact finish r s (sameExits r s p hp hrs hrm hsm hrOut hsOut hmeet) + +private theorem helper_branch_746.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (a b : Fin k), + ∀ (z w : V ⊕ E), ( + ∃ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G phi a b z) → ( + ∃ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G phi a b w) → ( + ∀ {u v : V}, u ∈ (TreeSequenceVertexSet T : Finset V) → v ∈ (TreeSequenceVertexSet T : Finset + V) → u ≠ v → + ∀ {d : Fin k}, d ∈ MissingColors G phi u → d ∈ MissingColors G phi v → False) → ( + ∀ {u v t : V}, u ∈ (TreeSequenceVertexSet T : Finset V) → v ∈ (TreeSequenceVertexSet T : + Finset V) → t ∈ (TreeSequenceVertexSet T : Finset V) → u ≠ v → u ≠ t → v ≠ t → a ∈ + MissingColors G phi u ∨ b ∈ MissingColors G phi u → a ∈ MissingColors G phi v ∨ b ∈ + MissingColors G phi v → a ∈ MissingColors G phi t ∨ b ∈ MissingColors G phi t → False) → ( + ∀ (r1 s1 r2 s2 : V) (p1 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r1) (Sum.inl s1)) (p2 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ + E)).Walk (Sum.inl r2) (Sum.inl s2)), p1.IsPath → p2.IsPath → {q : V ⊕ E | q ∈ p1.support} + = TwoColorComponent G phi a b z → {q : V ⊕ E | q ∈ p2.support} = TwoColorComponent G phi a + b w → a ∈ MissingColors G phi r1 ∨ b ∈ MissingColors G phi r1 → a ∈ MissingColors G phi r2 + ∨ b ∈ MissingColors G phi r2 → r1 ∉ (TreeSequenceVertexSet T : Finset V) → r2 ∉ + (TreeSequenceVertexSet T : Finset V) → ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ p1.support) → ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ p2.support) → + ∃ (c1 : V) (c2 : V) (L1 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r1) (Sum.inl c1)) (L2 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ + E)).Walk (Sum.inl r2) (Sum.inl c2)), TreeExitPath T phi a b r1 c1 L1 ∧ TreeExitPath T phi + a b r2 c2 L2 ∧ ( + ∀ q ∈ L1.support, q ∉ L2.support) ∧ r1 ≠ r2 ∧ c1 ≠ c2) → ( + ∀ (r s : V) (p : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl r) + (Sum.inl s)), p.IsPath → r ≠ s → a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r → a + ∈ MissingColors G phi s ∨ b ∈ MissingColors G phi s → r ∉ (TreeSequenceVertexSet T : + Finset V) → s ∉ (TreeSequenceVertexSet T : Finset V) → ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ p.support) → + ∃ (c1 : V) (c2 : V) (L1 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r) (Sum.inl c1)) (L2 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ + E)).Walk (Sum.inl s) (Sum.inl c2)), TreeExitPath T phi a b r c1 L1 ∧ TreeExitPath T phi a + b s c2 L2 ∧ ( + ∀ q ∈ L1.support, q ∉ L2.support) ∧ r ≠ s ∧ c1 ≠ c2) → ( + ∀ {u v : V}, Sum.inl u ∈ TwoColorComponent G phi a b z → Sum.inl v ∈ TwoColorComponent G phi a + b w → u ≠ v) → ( + ∀ (r s : V), ( + ∃ (c1 : V) (c2 : V) (L1 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r) (Sum.inl c1)) (L2 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ + E)).Walk (Sum.inl s) (Sum.inl c2)), TreeExitPath T phi a b r c1 L1 ∧ TreeExitPath T phi a + b s c2 L2 ∧ ( + ∀ q ∈ L1.support, q ∉ L2.support) ∧ r ≠ s ∧ c1 ≠ c2) → + ∃ (a1 : V) (b1 : V) (a2 : V) (b2 : V) (P1 : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V + ⊕ E)).Walk (Sum.inl a1) (Sum.inl b1)) (P2 : (TwoColorIncidenceGraph G phi a b : + SimpleGraph (V ⊕ E)).Walk (Sum.inl a2) (Sum.inl b2)), TreeExitPath T phi a b a1 b1 P1 ∧ + TreeExitPath T phi a b a2 b2 P2 ∧ ( + ∀ q ∈ P1.support, q ∉ P2.support) ∧ a1 ≠ a2 ∧ b1 ≠ b2) → (( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), TwoColorComponent G phi a b w = {Sum.inl x} ∧ a ∈ + MissingColors G phi x ∧ b ∈ MissingColors G phi x) ∨ + ∃ (r : V) (s : V) (p : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl + r) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi a b w ∧ + r ≠ s ∧ (a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r) ∧ (a ∈ MissingColors G phi + s ∨ b ∈ MissingColors G phi s)) → ( + ∃ (r : V) (s : V) (p : (TwoColorIncidenceGraph G phi a b : SimpleGraph (V ⊕ E)).Walk (Sum.inl + r) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi a b z ∧ + r ≠ s ∧ (a ∈ MissingColors G phi r ∨ b ∈ MissingColors G phi r) ∧ (a ∈ MissingColors G phi + s ∨ b ∈ MissingColors G phi s)) → + ∃ (a1 : V) (b1 : V) (a2 : V) (b2 : V) (P1 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl + a1) (Sum.inl b1)) (P2 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a2) (Sum.inl + b2)), TreeExitPath T phi a b a1 b1 P1 ∧ TreeExitPath T phi a b a2 b2 P2 ∧ ( + ∀ x ∈ P1.support, x ∉ P2.support) ∧ a1 ≠ a2 ∧ b1 ≠ b2 := by + classical + intro V E _ _ G k e0 T phi a b + let _ := Fintype.ofFinite V + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b + set X : Finset V := TreeSequenceVertexSet T + intro z w hzX hwX no_repeat three_impossible differentExits sameExits separated finish hwdata + hznon + rcases hwdata with hwiso | hwnon + · obtain ⟨y, hyX, hwsingle, hya, hyb⟩ := hwiso + have hyC : Sum.inl y ∈ TwoColorComponent G phi a b w := by + rw [hwsingle] + simp + obtain ⟨r, s, p, hp, hps, hrs, hrm, hsm⟩ := hznon + have hrC : Sum.inl r ∈ TwoColorComponent G phi a b z := by + rw [← hps] + simp + have hsC : Sum.inl s ∈ TwoColorComponent G phi a b z := by + rw [← hps] + change Sum.inl s ∈ p.support + simpa only [p.getVert_length] using p.getVert_mem_support p.length + have hrOut : r ∉ X := by + intro hrX + rcases hrm with hra | hrb + · exact no_repeat hrX hyX (separated hrC hyC) hra hya + · exact no_repeat hrX hyX (separated hrC hyC) hrb hyb + have hsOut : s ∉ X := by + intro hsX + rcases hsm with hsa | hsb + · exact no_repeat hsX hyX (separated hsC hyC) hsa hya + · exact no_repeat hsX hyX (separated hsC hyC) hsb hyb + have hmeet : ∃ q ∈ X, Sum.inl q ∈ p.support := by + obtain ⟨q, hqX, hqC⟩ := hzX + refine ⟨q, by simpa [X] using hqX, ?_⟩ + change Sum.inl q ∈ {t | t ∈ p.support} + rw [hps] + exact hqC + exact finish r s (sameExits r s p hp hrs hrm hsm hrOut hsOut hmeet) + · obtain ⟨rz, sz, pz, hpz, hpsz, hrsz, hrzm, hszm⟩ := hznon + obtain ⟨rw, sw, pw, hpw, hpsw, hrsw, hrwm, hswm⟩ := hwnon + have hrzC : Sum.inl rz ∈ TwoColorComponent G phi a b z := by + rw [← hpsz] + simp + have hszC : Sum.inl sz ∈ TwoColorComponent G phi a b z := by + rw [← hpsz] + change Sum.inl sz ∈ pz.support + simpa only [pz.getVert_length] using pz.getVert_mem_support pz.length + have hrwC : Sum.inl rw ∈ TwoColorComponent G phi a b w := by + rw [← hpsw] + simp + have hswC : Sum.inl sw ∈ TwoColorComponent G phi a b w := by + rw [← hpsw] + change Sum.inl sw ∈ pw.support + simpa only [pw.getVert_length] using pw.getVert_mem_support pw.length + have hmeetz : ∃ q ∈ X, Sum.inl q ∈ pz.support := by + obtain ⟨q, hqX, hqC⟩ := hzX + refine ⟨q, by simpa [X] using hqX, ?_⟩ + change Sum.inl q ∈ {t | t ∈ pz.support} + rw [hpsz] + exact hqC + have hmeetw : ∃ q ∈ X, Sum.inl q ∈ pw.support := by + obtain ⟨q, hqX, hqC⟩ := hwX + refine ⟨q, by simpa [X] using hqX, ?_⟩ + change Sum.inl q ∈ {t | t ∈ pw.support} + rw [hpsw] + exact hqC + have hmeetzRev : ∃ q ∈ X, Sum.inl q ∈ pz.reverse.support := by + obtain ⟨q, hqX, hqP⟩ := hmeetz + refine ⟨q, hqX, ?_⟩ + simpa only [SimpleGraph.Walk.support_reverse, List.mem_reverse] using hqP + have hmeetwRev : ∃ q ∈ X, Sum.inl q ∈ pw.reverse.support := by + obtain ⟨q, hqX, hqP⟩ := hmeetw + refine ⟨q, hqX, ?_⟩ + simpa only [SimpleGraph.Walk.support_reverse, List.mem_reverse] using hqP + have hpszRev : {q | q ∈ pz.reverse.support} = + TwoColorComponent G phi a b z := by + ext q + change q ∈ pz.reverse.support ↔ + q ∈ TwoColorComponent G phi a b z + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] + exact Set.ext_iff.mp hpsz q + have hpswRev : {q | q ∈ pw.reverse.support} = + TwoColorComponent G phi a b w := by + ext q + change q ∈ pw.reverse.support ↔ + q ∈ TwoColorComponent G phi a b w + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] + exact Set.ext_iff.mp hpsw q + by_cases hrzX : rz ∈ X + · by_cases hszX : sz ∈ X + · have hrwOut : rw ∉ X := by + intro hrwX + exact three_impossible hrzX hszX hrwX hrsz + (separated hrzC hrwC) (separated hszC hrwC) + hrzm hszm hrwm + have hswOut : sw ∉ X := by + intro hswX + exact three_impossible hrzX hszX hswX hrsz + (separated hrzC hswC) (separated hszC hswC) + hrzm hszm hswm + exact finish rw sw + (sameExits rw sw pw hpw hrsw hrwm hswm hrwOut hswOut hmeetw) + · by_cases hrwX : rw ∈ X + · by_cases hswX : sw ∈ X + · exact (three_impossible hrzX hrwX hswX + (separated hrzC hrwC) (separated hrzC hswC) hrsw + hrzm hrwm hswm).elim + · exact finish sz sw + (differentExits sz rz sw rw pz.reverse pw.reverse + hpz.reverse hpw.reverse hpszRev hpswRev hszm hswm + hszX hswX hmeetzRev hmeetwRev) + · exact finish sz rw + (differentExits sz rz rw sw pz.reverse pw + hpz.reverse hpw hpszRev hpsw hszm hrwm hszX hrwX + hmeetzRev hmeetw) + · by_cases hrwX : rw ∈ X + · by_cases hswX : sw ∈ X + · have hszOut : sz ∉ X := by + intro hszX + exact three_impossible hrwX hswX hszX hrsw + (Ne.symm (separated hszC hrwC)) + (Ne.symm (separated hszC hswC)) hrwm hswm hszm + exact finish rz sz + (sameExits rz sz pz hpz hrsz hrzm hszm hrzX hszOut hmeetz) + · exact finish rz sw + (differentExits rz sz sw rw pz pw.reverse hpz + hpw.reverse hpsz hpswRev hrzm hswm hrzX hswX hmeetz + hmeetwRev) + · exact finish rz rw + (differentExits rz sz rw sw pz pw hpz hpw hpsz hpsw + hrzm hrwm hrzX hrwX hmeetz hmeetw) + +lemma ElementaryClosedNoninterchangeableDisjointExitPaths {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G phi) + (helementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (a b : Fin k) (hne : a ≠ b) + (hclosed : TreeColorSetClosed G phi T {a}) + (hnot : ¬ TreeInterchangeable G T phi a b) : + ∃ (a1 b1 a2 b2 : V) (P1 : + (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a1) (Sum.inl b1)) (P2 : + (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a2) (Sum.inl b2)), + TreeExitPath T phi a b a1 b1 P1 ∧ + TreeExitPath T phi a b a2 b2 P2 ∧ + (∀ x, x ∈ P1.support → x ∉ P2.support) ∧ a1 ≠ a2 ∧ b1 ≠ b2 := by + classical + let H := TwoColorIncidenceGraph G phi a b + let X := TreeSequenceVertexSet T + unfold TreeInterchangeable at hnot + push Not at hnot + obtain ⟨z, w, hz, hw, hzX, hwX, hzw⟩ := hnot + have hdisj : Disjoint (TwoColorComponent G phi a b z) + (TwoColorComponent G phi a b w) := + (TwoColorComponentsDisjoint G phi a b z w).resolve_left hzw + have endpoint_missing (v : V) + (hleaf : Set.Subsingleton (H.neighborSet (Sum.inl v))) : + a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v := by + by_cases ha : a ∈ MissingColors G phi v + · exact Or.inl ha + · right + have hap : a ∈ PresentColors G phi v := by + simpa [MissingColors] using ha + by_contra hb + have hbp : b ∈ PresentColors G phi v := by + simpa [MissingColors] using hb + obtain ⟨ea, hea, hca⟩ := by simpa [PresentColors] using hap + obtain ⟨eb, heb, hcb⟩ := by simpa [PresentColors] using hbp + have hada : H.Adj (Sum.inl v) (Sum.inr ea) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v ea ∧ + (phi ea = some a ∨ phi ea = some b) from + ⟨hea, Or.inl hca⟩) + have hadb : H.Adj (Sum.inl v) (Sum.inr eb) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v eb ∧ + (phi eb = some a ∨ phi eb = some b) from + ⟨heb, Or.inr hcb⟩) + have heab : ea = eb := Sum.inr.inj (hleaf hada hadb) + subst eb + exact hne (Option.some.inj (hca.symm.trans hcb)) + have analyze := + @helper_analyze_95 V E inferInstance inferInstance G k e0 T + phi hproper a b endpoint_missing + have chooseFirst := + @helper_chooseFirst_365 V E inferInstance inferInstance G k phi a b + have firstEntry := + @helper_firstEntry_403 V E inferInstance inferInstance inferInstance inferInstance G k + e0 T phi a b hclosed chooseFirst + have helementaryX : ColoredVertexSetElementary G phi X := by + dsimp [X] + exact helementary + have no_repeat {u v : V} (huX : u ∈ X) (hvX : v ∈ X) + (huv : u ≠ v) {d : Fin k} + (hu : d ∈ MissingColors G phi u) + (hv : d ∈ MissingColors G phi v) : False := + (Finset.disjoint_left.mp (helementaryX huX hvX huv)) hu hv + have three_impossible : + ∀ {u v t : V}, u ∈ X → v ∈ X → t ∈ X → u ≠ v → u ≠ t → v ≠ t → (a ∈ MissingColors G phi u ∨ b + ∈ MissingColors G phi u) → (a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v) → (a ∈ + MissingColors G phi t ∨ b ∈ MissingColors G phi t) → False := by + intro u v t huX hvX htX huv hut hvt hu hv ht + rcases hu with hua | hub <;> + rcases hv with hva | hvb <;> + rcases ht with hta | htb + · exact no_repeat huX hvX huv hua hva + · exact no_repeat huX hvX huv hua hva + · exact no_repeat huX htX hut hua hta + · exact no_repeat hvX htX hvt hvb htb + · exact no_repeat hvX htX hvt hva hta + · exact no_repeat huX htX hut hub htb + · exact no_repeat huX hvX huv hub hvb + · exact no_repeat huX hvX huv hub hvb + have differentExits := + @helper_differentExits_540 V E inferInstance inferInstance inferInstance inferInstance + G k e0 T phi a b z w hdisj firstEntry + have sameExits := + @helper_sameExits_588 V E inferInstance inferInstance inferInstance inferInstance G k + e0 T phi hproper a b firstEntry + have separated {u v : V} + (hu : Sum.inl u ∈ TwoColorComponent G phi a b z) + (hv : Sum.inl v ∈ TwoColorComponent G phi a b w) : u ≠ v := by + intro huv + subst v + exact (Set.disjoint_left.mp hdisj) hu hv + have finish : + ∀ (r s : V), ( + ∃ (c1 c2 : V) (L1 : H.Walk (Sum.inl r) (Sum.inl c1)) (L2 : H.Walk (Sum.inl s) (Sum.inl c2)), + TreeExitPath T phi a b r c1 L1 ∧ TreeExitPath T phi a b s c2 L2 ∧ ( + ∀ q, q ∈ L1.support → q ∉ L2.support) ∧ r ≠ s ∧ c1 ≠ c2) → + ∃ (a1 b1 a2 b2 : V) (P1 : H.Walk (Sum.inl a1) (Sum.inl b1)) (P2 : H.Walk (Sum.inl a2) (Sum.inl + b2)), TreeExitPath T phi a b a1 b1 P1 ∧ TreeExitPath T phi a b a2 b2 P2 ∧ ( + ∀ q, q ∈ P1.support → q ∉ P2.support) ∧ a1 ≠ a2 ∧ b1 ≠ b2 := by + intro r s h + obtain ⟨c1, c2, L1, L2, hExit1, hExit2, hdis, hrs, hc⟩ := h + exact ⟨r, c1, s, c2, L1, L2, hExit1, hExit2, hdis, hrs, hc⟩ + obtain hzdata := analyze z hz (by simpa [X] using hzX) + obtain hwdata := analyze w hw (by simpa [X] using hwX) + rcases hzdata with hziso | hznon + · exact @helper_branch_711 V E inferInstance inferInstance G k e0 T phi a b z w hwX no_repeat + sameExits separated finish hwdata hziso + · exact @helper_branch_746 V E inferInstance inferInstance G k e0 T phi a b z w + hzX hwX no_repeat three_impossible differentExits sameExits separated finish hwdata hznon +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableExitPair.lean b/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableExitPair.lean new file mode 100644 index 0000000000..307df50928 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableExitPair.lean @@ -0,0 +1,60 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge +public import LeanPool.GoldbergSeymour.ElementaryClosedNoninterchangeableDisjointExitPaths + +/-! +# Elementary Closed Noninterchangeable Exit Pair + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma ElementaryClosedNoninterchangeableExitPair {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G phi) + (helementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (a b : Fin k) (hne : a ≠ b) + (_ : a ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {a}) + (hnot : ¬ TreeInterchangeable G T phi a b) : + ∃ (a1 b1 a2 b2 : V) + (P1 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a1) (Sum.inl b1)) + (P2 : (TwoColorIncidenceGraph G phi a b).Walk + (Sum.inl a2) (Sum.inl b2)) + (f1 f2 : E), + TreeExitPath T phi a b a1 b1 P1 ∧ + TreeExitPath T phi a b a2 b2 P2 ∧ + (∀ x, x ∈ P1.support → x ∉ P2.support) ∧ + a1 ≠ a2 ∧ b1 ≠ b2 ∧ + f1 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b ∧ + f2 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b ∧ + Incident G b1 f1 ∧ Incident G b2 f2 ∧ + Sum.inr f1 ∈ P1.support ∧ Sum.inr f2 ∈ P2.support := by + classical + obtain ⟨a1, b1, a2, b2, P1, P2, hP1, hP2, hdisjoint, ha, hb⟩ := + ElementaryClosedNoninterchangeableDisjointExitPaths G T phi hproper + helementary a b hne hclosed hnot + obtain ⟨f1, hf1, hi1, hs1⟩ := + ClosedColorExitPathBoundaryEdge G T phi a b hclosed a1 b1 P1 hP1 + obtain ⟨f2, hf2, hi2, hs2⟩ := + ClosedColorExitPathBoundaryEdge G T phi a b hclosed a2 b2 P2 hP2 + exact ⟨a1, b1, a2, b2, P1, P2, f1, f2, hP1, hP2, hdisjoint, + ha, hb, hf1, hf2, hi1, hi2, hs1, hs2⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementaryEndpointExclusion.lean b/LeanPool/GoldbergSeymour/ElementaryEndpointExclusion.lean new file mode 100644 index 0000000000..05d3f1d627 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementaryEndpointExclusion.lean @@ -0,0 +1,125 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeMissingColors + +/-! +# P2716_T2_Elementary Endpoint Exclusion + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma P2716_T2_ElementaryEndpointExclusion {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (T U : TreeSequence G e0) + (alpha beta : Fin k) (a₁ b₁ a₂ b₂ a₃ b₃ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₃) (Sum.inl b₃)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hP₃ : TreeExitPath T phi alpha beta a₃ b₃ P₃) + (ha₁₂ : a₁ ≠ a₂) + (hb₁ : b₁ ∈ TreeSequenceVertexSet U) + (hb₂ : b₂ ∈ TreeSequenceVertexSet U) + (hb₃ : b₃ ∈ TreeSequenceVertexSet U) + (helementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet U)) + (hbeta : beta ∈ MissingColors G phi b₃) + (hclosedBeta : TreeColorSetClosed G phi U {beta}) + (hclosedAlpha : alpha ∈ TreeMissingColors phi U → + TreeColorSetClosed G phi U {alpha}) : + a₁ ∉ TreeSequenceVertexSet U ∧ a₂ ∉ TreeSequenceVertexSet U ∧ + a₃ ∉ TreeSequenceVertexSet U := by + classical + let X := TreeSequenceVertexSet U + have missing {a : V} (ha : a ∈ X) (hab : a ≠ b₃) + (halt : alpha ∈ MissingColors G phi a ∨ beta ∈ MissingColors G phi a) : + alpha ∈ MissingColors G phi a := by + rcases halt with h | h + · exact h + · exact (Finset.disjoint_left.mp (helementary ha hb₃ hab) h hbeta).elim + have outsideNe {a b : V} + {P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a) (Sum.inl b)} + (hP : TreeExitPath T phi alpha beta a b P) : a ≠ b₃ := by + intro h + exact hP.2.2.1 (h ▸ hP₃.2.2.2.1) + have contain (halpha : alpha ∈ TreeMissingColors phi U) : + ∀ {a b : V}, + (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a) (Sum.inl b) → + b ∈ X → a ∈ X := by + have haBoundary := hclosedAlpha halpha alpha (Finset.mem_singleton_self alpha) + have hbBoundary := hclosedBeta beta (Finset.mem_singleton_self beta) + let Inside : Sum V E → Prop + | Sum.inl v => v ∈ X + | Sum.inr e => ∀ v, Incident G v e → v ∈ X + have step {z z' : Sum V E} + (hzz' : (TwoColorIncidenceGraph G phi alpha beta).Adj z z') + (hz : Inside z) : Inside z' := by + cases z with + | inl v => + cases z' with + | inl w => exact hzz'.elim + | inr e => + change Incident G v e ∧ (phi e = some alpha ∨ phi e = some beta) at hzz' + intro w hw + by_contra hwX + have hvw : v ≠ w := by rintro rfl; exact hwX hz + have hboundary : e ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hz, w, hwX, (Sym2.mem_and_mem_iff hvw).mp ⟨hzz'.1, hw⟩⟩ + rcases hzz'.2 with hc | hc + · have hm : e ∈ BoundaryColorEdges G phi X alpha := + Finset.mem_filter.mpr ⟨hboundary, hc⟩ + rw [haBoundary] at hm + exact Finset.notMem_empty e hm + · have hm : e ∈ BoundaryColorEdges G phi X beta := + Finset.mem_filter.mpr ⟨hboundary, hc⟩ + rw [hbBoundary] at hm + exact Finset.notMem_empty e hm + | inr e => + cases z' with + | inl v => exact hz v hzz'.1 + | inr f => exact hzz'.elim + intro a b P hb + have hr := P.reverse.reachable + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + have hstay : ∀ z, Relation.ReflTransGen + (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl b) z → Inside z := by + intro z hz + induction hz with + | refl => exact hb + | tail hreach hlast ih => exact step hlast ih + exact hstay _ hr + have impossible (halpha : alpha ∈ TreeMissingColors phi U) : False := by + have ha₁ := contain halpha P₁ hb₁ + have ha₂ := contain halpha P₂ hb₂ + have hm₁ := missing ha₁ (outsideNe hP₁) hP₁.2.2.2.2.1 + have hm₂ := missing ha₂ (outsideNe hP₂) hP₂.2.2.2.2.1 + exact Finset.disjoint_left.mp (helementary ha₁ ha₂ ha₁₂) hm₁ hm₂ + have exclude {a b : V} + {P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a) (Sum.inl b)} + (hP : TreeExitPath T phi alpha beta a b P) : a ∉ X := by + intro ha + have hm := missing ha (outsideNe hP) hP.2.2.2.2.1 + exact impossible (Finset.mem_biUnion.mpr ⟨a, ha, hm⟩) + exact ⟨exclude hP₁, exclude hP₂, exclude hP₃⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementaryPrefixSwap.lean b/LeanPool/GoldbergSeymour/ElementaryPrefixSwap.lean new file mode 100644 index 0000000000..6579d7ae2c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementaryPrefixSwap.lean @@ -0,0 +1,128 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# P2880_T1_Elementary Prefix Swap + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2880_T1_ElementaryPrefixSwap + {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) {k : Nat} {e0 : E} + (mu : PartialEdgeColoring E k) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hproper : IsProperEdgeColoring G mu) + (B X Z : TreeSequence G e0) + (hBX : TreeSequenceInitialSegment B X) + (hXZ : TreeSequenceInitialSegment X Z) + (helementary : ColoredVertexSetElementary G mu (TreeSequenceVertexSet Z)) + (ha : alpha ∈ TreeMissingColors mu B) + (hb : beta ∈ TreeMissingColors mu B) + (z : Sum V E) + (houtside : ∀ v ∈ TreeSequenceVertexSet X, + Sum.inl v ∉ TwoColorComponent G mu alpha beta z) : + let sigma := TwoColorComponentSwap G mu alpha beta z + (∀ v ∈ TreeSequenceVertexSet X, ∀ f : E, Incident G v f → + sigma f = mu f) ∧ + (∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G sigma v = MissingColors G mu v) := by + classical + let _ := Fintype.ofFinite V + let Q := TwoColorComponent G mu alpha beta z + let sigma := TwoColorComponentSwap G mu alpha beta z + have edgeToVertex {v : V} {f : E} (hf : Sum.inr f ∈ Q) + (hvf : Incident G v f) (hc : mu f = some alpha ∨ mu f = some beta) : + Sum.inl v ∈ Q := by + change (TwoColorIncidenceGraph G mu alpha beta).connectedComponentMk + (Sum.inr f) = _ at hf + change (TwoColorIncidenceGraph G mu alpha beta).connectedComponentMk + (Sum.inl v) = _ + have hadj : (TwoColorIncidenceGraph G mu alpha beta).Adj + (Sum.inl v) (Sum.inr f) := ⟨hvf, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hf + have vertexToEdge {v : V} {f : E} (hv : Sum.inl v ∈ Q) + (hvf : Incident G v f) (hc : mu f = some alpha ∨ mu f = some beta) : + Sum.inr f ∈ Q := by + change (TwoColorIncidenceGraph G mu alpha beta).connectedComponentMk + (Sum.inl v) = _ at hv + change (TwoColorIncidenceGraph G mu alpha beta).connectedComponentMk + (Sum.inr f) = _ + have hadj : (TwoColorIncidenceGraph G mu alpha beta).Adj + (Sum.inr f) (Sum.inl v) := ⟨hvf, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv + have behavior := TwoColorComponentSwapMissingBehavior G mu alpha beta hne hproper z + refine ⟨?_, ?_⟩ + · intro v hv f hvf + by_cases hf : Sum.inr f ∈ Q + · by_cases ha : mu f = some alpha + · exact False.elim (houtside v hv (edgeToVertex hf hvf (Or.inl ha))) + · by_cases hb : mu f = some beta + · exact False.elim (houtside v hv (edgeToVertex hf hvf (Or.inr hb))) + · simp [TwoColorComponentSwap, Q, hf, ha, hb] + · simp [TwoColorComponentSwap, Q, hf] + · intro v hvZ + by_cases hvQ : Sum.inl v ∈ Q + · have oldNotMissing (c : Fin k) (hc : c ∈ TreeMissingColors mu B) : + c ∉ MissingColors G mu v := by + obtain ⟨w, hwB, hcw⟩ := Finset.mem_biUnion.mp hc + have hwX := TreeSequenceInitialSegmentVertexSetSubset hBX hwB + have hwZ := TreeSequenceInitialSegmentVertexSetSubset hXZ hwX + have hwv : w ≠ v := by + intro heq + exact houtside w hwX (heq.symm ▸ hvQ) + exact fun hcv => Finset.disjoint_left.mp + (helementary hwZ hvZ hwv) hcw hcv + have hna := oldNotMissing alpha ha + have hnb := oldNotMissing beta hb + have presentOfNotMissing (c : Fin k) (hc : c ∉ MissingColors G mu v) : + ∃ f : E, Incident G v f ∧ mu f = some c := by + have hp : c ∈ PresentColors G mu v := by + by_contra hnp + exact hc (Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, hnp⟩) + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hp + obtain ⟨fa, hvfa, hfa⟩ := presentOfNotMissing alpha hna + obtain ⟨fb, hvfb, hfb⟩ := presentOfNotMissing beta hnb + have hfaQ := vertexToEdge hvQ hvfa (Or.inl hfa) + have hfbQ := vertexToEdge hvQ hvfb (Or.inr hfb) + have hnewB : sigma fa = some beta := by + simp [sigma, TwoColorComponentSwap, Q, hfaQ, hfa] + have hnewA : sigma fb = some alpha := by + simp [sigma, TwoColorComponentSwap, Q, hfbQ, hfb, hne.symm] + have hsna : alpha ∉ MissingColors G sigma v := by + intro h + exact (Finset.mem_sdiff.mp h).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, fb, hvfb, hnewA⟩) + have hsnb : beta ∉ MissingColors G sigma v := by + intro h + exact (Finset.mem_sdiff.mp h).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, fa, hvfa, hnewB⟩) + ext c + by_cases hca : c = alpha + · subst c + exact iff_of_false hsna hna + · by_cases hcb : c = beta + · subst c + exact iff_of_false hsnb hnb + · exact behavior.2.2.2 v c hca hcb + · exact behavior.1 v hvQ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementarySingleBoundaryInterchangeable.lean b/LeanPool/GoldbergSeymour/ElementarySingleBoundaryInterchangeable.lean new file mode 100644 index 0000000000..4810ffa488 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementarySingleBoundaryInterchangeable.lean @@ -0,0 +1,916 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.TreeInterchangeable + +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint + +/-! +# Elementary Single Boundary Interchangeable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_boundary_of_walk_52.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k), + BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha = ∅ → + ∀ {a b : V} (p : (TwoColorIncidenceGraph G phi alpha beta : SimpleGraph (V ⊕ E)).Walk (Sum.inl + a) (Sum.inl b)), a ∈ (TreeSequenceVertexSet T : Finset V) → b ∉ (TreeSequenceVertexSet T : + Finset V) → + ∃ f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T : Finset V) beta, Sum.inr f ∈ + p.support := by + classical + intro V E _ _ G k e0 phi T alpha beta halpha + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta + set X : Finset V := TreeSequenceVertexSet T + intro a b p ha hb + let S : Set (Sum V E) := {y | match y with + | Sum.inl q => q ∈ X + | Sum.inr f => ∀ q, Incident G q f → q ∈ X} + have hSa : Sum.inl a ∈ S := by simpa [S] using ha + have hSb : Sum.inl b ∉ S := by simpa [S] using hb + obtain ⟨d, hd, hds, hdt⟩ := p.exists_boundary_dart S hSa hSb + have hadj := d.adj + have hfirst : ∃ q : V, d.toProd.1 = Sum.inl q ∧ q ∈ X := by + cases h : d.toProd.1 with + | inl q => + rw [h] at hds + exact ⟨q, rfl, by simpa [S] using hds⟩ + | inr f => + exfalso + cases h2 : d.toProd.2 with + | inl r => + rw [h, h2] at hadj + change Incident G r f ∧ + (phi f = some alpha ∨ phi f = some beta) at hadj + rw [h] at hds + have hall : ∀ q, Incident G q f → q ∈ X := by + simpa [S] using hds + have hrnot : r ∉ X := by + intro hr + apply hdt + simpa [S, h2] using hr + exact hrnot (hall r hadj.1) + | inr e => + rw [h, h2] at hadj + exact hadj.elim + obtain ⟨q, hq, hqX⟩ := hfirst + have hsecond : ∃ f : E, d.toProd.2 = Sum.inr f := by + cases h : d.toProd.2 with + | inl r => + rw [hq, h] at hadj + exact hadj.elim + | inr f => exact ⟨f, rfl⟩ + obtain ⟨f, hf⟩ := hsecond + have hfadj : H.Adj (Sum.inl q) (Sum.inr f) := by + rw [hq, hf] at hadj + exact hadj + have hfdata : Incident G q f ∧ + (phi f = some alpha ∨ phi f = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hfadj + have hnotall : ¬ ∀ r, Incident G r f → r ∈ X := by + intro hall + apply hdt + simpa [S, hf, hall] + obtain ⟨r, hrf, hrX⟩ : ∃ r, Incident G r f ∧ r ∉ X := by + push Not at hnotall + exact hnotall + have hqr : q ≠ r := by + intro h + exact hrX (h ▸ hqX) + have hend : G.ends f = s(q, r) := + (Sym2.mem_and_mem_iff hqr).mp ⟨hfdata.1, hrf⟩ + have hfb : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, hqX, r, hrX, hend⟩ + have hfcolor : phi f = some beta := by + rcases hfdata.2 with hfa | hfbeta + · have : f ∈ BoundaryColorEdges G phi X alpha := by + simp [BoundaryColorEdges, hfb, hfa] + rw [halpha] at this + simp at this + · exact hfbeta + refine ⟨f, ?_, ?_⟩ + · simp [BoundaryColorEdges, hfb, hfcolor] + · rw [← hf] + exact p.dart_snd_mem_support_of_mem_darts hd + +private theorem helper_endpoint_missing_142.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k), alpha ≠ beta → + ∀ (v : V), ((TwoColorIncidenceGraph G phi alpha beta : SimpleGraph (V ⊕ E)).neighborSet + (Sum.inl v)).Subsingleton → alpha ∈ MissingColors G phi v ∨ beta ∈ MissingColors G phi v + := by + classical + intro V E _ _ G k phi alpha beta + let _ := Fintype.ofFinite V + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta + intro hne v hleaf + by_cases ha : alpha ∈ MissingColors G phi v + · exact Or.inl ha + · right + have hap : alpha ∈ PresentColors G phi v := by + simpa [MissingColors] using ha + by_contra hb + have hbp : beta ∈ PresentColors G phi v := by + simpa [MissingColors] using hb + obtain ⟨ea, hea, hca⟩ := by simpa [PresentColors] using hap + obtain ⟨eb, heb, hcb⟩ := by simpa [PresentColors] using hbp + have hada : H.Adj (Sum.inl v) (Sum.inr ea) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v ea ∧ + (phi ea = some alpha ∨ phi ea = some beta) from + ⟨hea, Or.inl hca⟩) + have hadb : H.Adj (Sum.inl v) (Sum.inr eb) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v eb ∧ + (phi eb = some alpha ∨ phi eb = some beta) from + ⟨heb, Or.inr hcb⟩) + have heab : ea = eb := Sum.inr.inj (hleaf hada hadb) + subst eb + exact hne (Option.some.inj (hca.symm.trans hcb)) + +private theorem helper_branch_198.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {k : ℕ} (phi : + PartialEdgeColoring E k) (alpha beta : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta; + ∀ (c low a b : V ⊕ E) (p : (TwoColorIncidenceGraph G phi alpha beta).Walk a b), p.IsPath → + {x : V ⊕ E | x ∈ p.support} = TwoColorComponent G phi alpha beta c → low ∈ p.support → low + = b → + ∃ (b : V ⊕ E) (p : H.Walk low b), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G + phi alpha beta c := by + classical + intro V E G k phi alpha beta H c low a b p hp hps hlowP hlb + subst b + refine ⟨a, p.reverse, hp.reverse, ?_⟩ + ext y + change y ∈ p.reverse.support ↔ + y ∈ TwoColorComponent G phi alpha beta c + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] + exact Set.ext_iff.mp hps y + +private theorem helper_branch_206.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta; + let X : Finset V := TreeSequenceVertexSet T; + ∀ (c : V ⊕ E), ( + ∃ x ∈ X, Sum.inl x ∈ TwoColorComponent G phi alpha beta c) → + ∀ (low b : V ⊕ E) (p : H.Walk low b), {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi + alpha beta c → p.Nil → ( + ∃ x ∈ X, TwoColorComponent G phi alpha beta c = {Sum.inl x} ∧ alpha ∈ MissingColors G phi x ∧ + beta ∈ MissingColors G phi x) ∨ + ∃ (r : V) (s : V) (p : H.Walk (Sum.inl r) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} + = TwoColorComponent G phi alpha beta c ∧ r ≠ s ∧ (alpha ∈ MissingColors G phi r ∨ beta ∈ + MissingColors G phi r) ∧ (alpha ∈ MissingColors G phi s ∨ beta ∈ MissingColors G phi s) ∧ + (r ∈ X ∧ s ∈ X ∨ + ∃ f ∈ BoundaryColorEdges G phi X beta, Sum.inr f ∈ TwoColorComponent G phi alpha beta c ∧ (r ∈ + X ∨ s ∈ X)) := by + classical + intro V E _ _ G k e0 phi T alpha beta H X c hcX low b p hps hnil + obtain ⟨x, hxX, hxC⟩ := hcX + have hxP : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {y | y ∈ p.support} + rw [hps] + exact hxC + have hxlow : Sum.inl x = low := by + rw [SimpleGraph.Walk.nil_iff_support_eq.mp hnil] at hxP + simpa using hxP + have hCsingle : TwoColorComponent G phi alpha beta c = + {Sum.inl x} := by + rw [← hps] + ext y + rw [Set.mem_ofPred_eq, Set.mem_singleton_iff, + SimpleGraph.Walk.nil_iff_support_eq.mp hnil] + simp [hxlow] + have hmissing : ∀ d : Fin k, + (d = alpha ∨ d = beta) → d ∈ MissingColors G phi x := by + intro d hd + have hnotpresent : d ∉ PresentColors G phi x := by + intro hpresent + obtain ⟨e, heinc, hecolor⟩ := by + simpa [PresentColors] using hpresent + have hepair : phi e = some alpha ∨ phi e = some beta := + hd.elim + (fun h => Or.inl (hecolor.trans (congrArg some h))) + (fun h => Or.inr (hecolor.trans (congrArg some h))) + have hadj : H.Adj (Sum.inl x) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G x e ∧ + (phi e = some alpha ∨ phi e = some beta) from + ⟨heinc, hepair⟩) + have hedgeC : Sum.inr e ∈ + TwoColorComponent G phi alpha beta c := by + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk c + change H.connectedComponentMk (Sum.inl x) = + H.connectedComponentMk c at hxC + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm.trans hxC + rw [hCsingle] at hedgeC + simp at hedgeC + simpa [MissingColors] using hnotpresent + left + exact ⟨x, hxX, hCsingle, hmissing alpha (Or.inl rfl), + hmissing beta (Or.inr rfl)⟩ + +private theorem helper_branch_255.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {k : ℕ} (phi : + PartialEdgeColoring E k) (alpha beta : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta; + ∀ (b : V ⊕ E) (e : E), ((TwoColorIncidenceGraph G phi alpha beta).neighborSet (Sum.inr + e)).Subsingleton → + ∀ (p : H.Walk (Sum.inr e) b), ¬p.Nil → + ∃ (r : V), Sum.inr e = Sum.inl r := by + classical + intro V E G k phi alpha beta H b e hlow p hnil + have hadj := p.adj_snd hnil + have hecolor : phi e = some alpha ∨ phi e = some beta := by + cases hsnd : p.snd with + | inl u => + rw [hsnd] at hadj + have hdata : Incident G u e ∧ + (phi e = some alpha ∨ phi e = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hadj + exact hdata.2 + | inr f => + rw [hsnd] at hadj + have : False := by + simp [H, TwoColorIncidenceGraph] at hadj + exact this.elim + induction hends : G.ends e using Sym2.inductionOn with + | _ u v => + have huv : u ≠ v := by + intro huv + subst v + exact G.loopless e u hends + have huAdj : H.Adj (Sum.inr e) (Sum.inl u) := by + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G u e ∧ + (phi e = some alpha ∨ phi e = some beta) from + ⟨by simp [Incident, hends], hecolor⟩) + have hvAdj : H.Adj (Sum.inr e) (Sum.inl v) := by + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G v e ∧ + (phi e = some alpha ∨ phi e = some beta) from + ⟨by simp [Incident, hends], hecolor⟩) + exact False.elim (huv (Sum.inl.inj (hlow huAdj hvAdj))) + +private theorem helper_hend_neighbor_289.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (_ : TreeSequence G e0) (alpha beta : Fin k), + IsProperEdgeColoring G phi → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta; + ∀ (_ c b : V ⊕ E) (r : V), ((TwoColorIncidenceGraph G phi alpha beta).neighborSet (Sum.inl + r)).Subsingleton → + ∀ (p : H.Walk (Sum.inl r) b), p.IsPath → {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi + alpha beta c → ¬p.Nil → + ∀ (y : V ⊕ E), H.Adj b y → y = p.getVert (p.length - (1 : ℕ)) := by + classical + intro V E _ _ G k e0 phi T alpha beta hproper H z c b r hlow p hp hps hnil y hby + let := Fintype.ofFinite V + let := Fintype.ofFinite E + have hyC : y ∈ TwoColorComponent G phi alpha beta c := by + have hbC : b ∈ TwoColorComponent G phi alpha beta c := by + rw [← hps] + change b ∈ p.support + simpa only [p.getVert_length] using + p.getVert_mem_support p.length + change H.connectedComponentMk y = H.connectedComponentMk c + change H.connectedComponentMk b = H.connectedComponentMk c at hbC + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hby).symm.trans hbC + have hySupport : y ∈ p.support := by + change y ∈ {z | z ∈ p.support} + rw [hps] + exact hyC + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hySupport + have hnlt : n < p.length := by + have hnne : n ≠ p.length := by + intro heq + have hyb : y = b := by + rw [← hn, heq, p.getVert_length] + exact hby.ne hyb.symm + omega + by_cases hpen : n + 1 = p.length + · rw [← hn] + congr 1 + omega + by_cases hn0 : n = 0 + · have hnext : H.Adj (Sum.inl r) (p.getVert 1) := by + simpa [hn0, p.getVert_zero] using + p.adj_getVert_succ hnlt + have hbstart : H.Adj (Sum.inl r) b := by + rw [← hn, hn0, p.getVert_zero] at hby + exact hby.symm + have hneNext : p.getVert 1 ≠ b := by + intro heq + have hindices := hp.getVert_injOn + (show 1 ≤ p.length by omega) + (show p.length ≤ p.length by rfl) + (heq.trans p.getVert_length.symm) + omega + exact False.elim (hneNext (hlow hnext hbstart)) + · have hnpos : 0 < n := Nat.pos_of_ne_zero hn0 + have hleft : H.Adj y (p.getVert (n - 1)) := by + rw [← hn] + have hadj := p.adj_getVert_succ (i := n - 1) (by omega) + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ n)] using + hadj.symm + have hright : H.Adj y (p.getVert (n + 1)) := by + rw [← hn] + exact p.adj_getVert_succ hnlt + have hbneLeft : b ≠ p.getVert (n - 1) := by + intro heq + have hindices := hp.getVert_injOn + (show p.length ≤ p.length by rfl) + (show n - 1 ≤ p.length by omega) + (p.getVert_length.trans heq) + omega + have hbneRight : b ≠ p.getVert (n + 1) := by + intro heq + have hindices := hp.getVert_injOn + (show p.length ≤ p.length by rfl) + (show n + 1 ≤ p.length by omega) + (p.getVert_length.trans heq) + omega + have hlrne : p.getVert (n - 1) ≠ p.getVert (n + 1) := by + intro heq + have hindices := hp.getVert_injOn + (show n - 1 ≤ p.length by omega) + (show n + 1 ≤ p.length by omega) heq + omega + let : Fintype (H.neighborSet y) := Fintype.ofFinite _ + have hthree : 3 ≤ @SimpleGraph.degree _ H y + (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let ss : Finset (Sum V E) := + {b, p.getVert (n - 1), p.getVert (n + 1)} + have hss : ss ⊆ H.neighborFinset y := by + intro t ht + simp only [ss, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hby.symm + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc3 : 3 ≤ ss.card := by + simp [ss, hbneLeft, hbneRight, hlrne] + exact hc3.trans (Finset.card_le_card hss) + have htwo : @SimpleGraph.degree _ H y + (Fintype.ofFinite _) ≤ 2 := by + simpa [H] using + TwoColorIncidenceDegreeAtMostTwo G phi alpha beta hproper y + omega + +private theorem helper_hendVertex_390.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (_ : TreeSequence G e0) (alpha beta : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta; + ∀ (b : V ⊕ E) (r : V) (p : H.Walk (Sum.inl r) b), (H.neighborSet b).Subsingleton → (0 : ℕ) < + p.length → + ∃ (s : V), b = Sum.inl s := by + classical + intro V E _ _ G k e0 phi T alpha beta H b r p hendLeaf hp_pos + let := Fintype.ofFinite V + let := Fintype.ofFinite E + cases hb : b with + | inl s => exact ⟨s, rfl⟩ + | inr e => + have hlastAdj : H.Adj (p.getVert (p.length - 1)) b := by + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ p.length), + p.getVert_length] using + p.adj_getVert_succ (i := p.length - 1) (by omega) + have hecolor : phi e = some alpha ∨ phi e = some beta := by + cases hprev : p.getVert (p.length - 1) with + | inl u => + rw [hprev, hb] at hlastAdj + have hdata : Incident G u e ∧ + (phi e = some alpha ∨ phi e = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hlastAdj + exact hdata.2 + | inr f => + rw [hprev, hb] at hlastAdj + have : False := by + simp [H, TwoColorIncidenceGraph] at hlastAdj + exact this.elim + induction hends : G.ends e using Sym2.inductionOn with + | _ u v => + have huv : u ≠ v := by + intro huv + subst v + exact G.loopless e u hends + have huAdj : H.Adj b (Sum.inl u) := by + rw [hb] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G u e ∧ + (phi e = some alpha ∨ phi e = some beta) from + ⟨by simp [Incident, hends], hecolor⟩) + have hvAdj : H.Adj b (Sum.inl v) := by + rw [hb] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G v e ∧ + (phi e = some alpha ∨ phi e = some beta) from + ⟨by simp [Incident, hends], hecolor⟩) + exact False.elim + (huv (Sum.inl.inj (hendLeaf huAdj hvAdj))) + +private theorem helper_branch_451.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta; + let X : Finset V := TreeSequenceVertexSet T; ( + ∀ {a b : V} (p : H.Walk (Sum.inl a) (Sum.inl b)), a ∈ X → b ∉ X → + ∃ f ∈ BoundaryColorEdges G phi X beta, Sum.inr f ∈ p.support) → + ∀ (c : V ⊕ E) (r s : V) (p : H.Walk (Sum.inl r) (Sum.inl s)), {y : V ⊕ E | y ∈ p.support} = + TwoColorComponent G phi alpha beta c → r ∈ X → r ∈ X ∧ s ∈ X ∨ + ∃ f ∈ BoundaryColorEdges G phi X beta, Sum.inr f ∈ TwoColorComponent G phi alpha beta c ∧ (r ∈ + X ∨ s ∈ X) := by + classical + intro V E _ _ G k e0 phi T alpha beta H X boundary_of_walk c r s p hps hrX + by_cases hsX : s ∈ X + · exact Or.inl ⟨hrX, hsX⟩ + · right + obtain ⟨f, hfB, hfP⟩ := boundary_of_walk p hrX hsX + have hfC : Sum.inr f ∈ + TwoColorComponent G phi alpha beta c := by + rw [← hps] + exact hfP + exact ⟨f, hfB, hfC, Or.inl hrX⟩ + +private theorem helper_branch_460.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta; + let X : Finset V := TreeSequenceVertexSet T; (BoundaryColorEdges G phi X beta).card ≤ (1 : ℕ) + → ( + ∀ {a b : V} (p : H.Walk (Sum.inl a) (Sum.inl b)), a ∈ X → b ∉ X → + ∃ f ∈ BoundaryColorEdges G phi X beta, Sum.inr f ∈ p.support) → + ∀ (c : V ⊕ E), ( + ∃ x ∈ X, Sum.inl x ∈ TwoColorComponent G phi alpha beta c) → + ∀ (r s : V) (p : H.Walk (Sum.inl r) (Sum.inl s)), p.IsPath → {y : V ⊕ E | y ∈ p.support} = + TwoColorComponent G phi alpha beta c → r ∉ X → r ∈ X ∧ s ∈ X ∨ + ∃ f ∈ BoundaryColorEdges G phi X beta, Sum.inr f ∈ TwoColorComponent G phi alpha beta c ∧ (r ∈ + X ∨ s ∈ X) := by + classical + intro V E _ _ G k e0 phi T alpha beta H X hbeta boundary_of_walk c hcX r s p hp hps hrX + by_cases hsX : s ∈ X + · right + obtain ⟨f, hfB, hfP⟩ := boundary_of_walk p.reverse hsX hrX + have hfP' : Sum.inr f ∈ p.support := by + simpa only [SimpleGraph.Walk.support_reverse, + List.mem_reverse] using hfP + have hfC : Sum.inr f ∈ + TwoColorComponent G phi alpha beta c := by + rw [← hps] + exact hfP' + exact ⟨f, hfB, hfC, Or.inr hsX⟩ + · obtain ⟨x, hxX, hxC⟩ := hcX + have hxP : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {y | y ∈ p.support} + rw [hps] + exact hxC + let pleft := (p.takeUntil (Sum.inl x) hxP).reverse + let pright := p.dropUntil (Sum.inl x) hxP + obtain ⟨f1, hf1B, hf1P⟩ := + boundary_of_walk pleft hxX hrX + obtain ⟨f2, hf2B, hf2P⟩ := + boundary_of_walk pright hxX hsX + have hf1take : Sum.inr f1 ∈ + (p.takeUntil (Sum.inl x) hxP).support := by + simpa only [pleft, SimpleGraph.Walk.support_reverse, + List.mem_reverse] using hf1P + have hf2drop : Sum.inr f2 ∈ + (p.dropUntil (Sum.inl x) hxP).support := by + exact hf2P + have happ : ((p.takeUntil (Sum.inl x) hxP).append + (p.dropUntil (Sum.inl x) hxP)).IsPath := by + rw [p.take_spec hxP] + exact hp + have hfne : f1 ≠ f2 := by + intro heq + exact + (happ.ne_of_mem_support_of_append (by simp) + hf1take hf2drop) (congrArg Sum.inr heq) + have hsubset : ({f1, f2} : Finset E) ⊆ + BoundaryColorEdges G phi X beta := by + intro f hf + simp only [Finset.mem_insert, Finset.mem_singleton] at hf + rcases hf with rfl | rfl + · exact hf1B + · exact hf2B + have htwo : 2 ≤ (BoundaryColorEdges G phi X beta).card := by + have hle := Finset.card_le_card hsubset + have hpair : ({f1, f2} : Finset E).card = 2 := by + simp [hfne] + omega + have hbetaX : (BoundaryColorEdges G phi X beta).card ≤ 1 := by + simpa [X] using hbeta + exact False.elim (by omega) + +private theorem helper_analyze_168.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k), + IsProperEdgeColoring G phi → (BoundaryColorEdges G phi (TreeSequenceVertexSet T) + beta).card ≤ (1 : ℕ) → ( + ∀ {a b : V} (p : (TwoColorIncidenceGraph G phi alpha beta : SimpleGraph (V ⊕ E)).Walk (Sum.inl + a) (Sum.inl b)), a ∈ (TreeSequenceVertexSet T : Finset V) → b ∉ (TreeSequenceVertexSet T : + Finset V) → + ∃ f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T : Finset V) beta, Sum.inr f ∈ + p.support) → + ∀ (_ : V ⊕ E), ( + ∀ (v : V), ((TwoColorIncidenceGraph G phi alpha beta : SimpleGraph (V ⊕ E)).neighborSet + (Sum.inl v)).Subsingleton → alpha ∈ MissingColors G phi v ∨ beta ∈ MissingColors G phi v) + → + ∀ (c : V ⊕ E), TwoColorPathComponent G phi alpha beta c → ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), Sum.inl x ∈ TwoColorComponent G phi alpha beta c) + → ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), TwoColorComponent G phi alpha beta c = {Sum.inl x} + ∧ alpha ∈ MissingColors G phi x ∧ beta ∈ MissingColors G phi x) ∨ + ∃ (r : V) (s : V) (p : (TwoColorIncidenceGraph G phi alpha beta : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi + alpha beta c ∧ r ≠ s ∧ (alpha ∈ MissingColors G phi r ∨ beta ∈ MissingColors G phi r) ∧ + (alpha ∈ MissingColors G phi s ∨ beta ∈ MissingColors G phi s) ∧ (r ∈ + (TreeSequenceVertexSet T : Finset V) ∧ s ∈ (TreeSequenceVertexSet T : Finset V) ∨ + ∃ f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T : Finset V) beta, Sum.inr f ∈ + TwoColorComponent G phi alpha beta c ∧ (r ∈ (TreeSequenceVertexSet T : Finset V) ∨ s ∈ + (TreeSequenceVertexSet T : Finset V))) := by + classical + intro V E _ _ G k e0 phi T alpha beta hproper hbeta + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta + set X : Finset V := TreeSequenceVertexSet T + intro boundary_of_walk z endpoint_missing c hc hcX + obtain ⟨low, hlowC, hlow⟩ := hc.2 + obtain ⟨a, b, p, hp, hps⟩ := + TwoColorComponentSpanningPath G phi alpha beta hproper c + have hlowP : low ∈ p.support := by + change low ∈ {y | y ∈ p.support} + rw [hps] + exact hlowC + have hlowEnd : low = a ∨ low = b := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hlow) hlowP + obtain ⟨b, p, hp, hps⟩ : ∃ (b : Sum V E) (p : H.Walk low b), + p.IsPath ∧ {y | y ∈ p.support} = + TwoColorComponent G phi alpha beta c := by + rcases hlowEnd with hla | hlb + · subst a + exact ⟨b, p, hp, hps⟩ + · exact @helper_branch_198 (@V) (@E) (@G) (@k) (@phi) (@alpha) (@beta) (@c) (@low) (@a) (@b) + (@p) (@hp) (@hps) (@hlowP) (@hlb) + by_cases hnil : p.Nil + · exact @helper_branch_206 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + (@alpha) (@beta) (@c) (@hcX) (@low) (@b) (@p) (@hps) (@hnil) + · have hstartVertex : ∃ r : V, low = Sum.inl r := by + cases low with + | inl r => exact ⟨r, rfl⟩ + | inr e => + exact @helper_branch_255 (@V) (@E) (@G) (@k) (@phi) (@alpha) (@beta) (@b) (@e) (@hlow) + (@p) (@hnil) + obtain ⟨r, hr⟩ := hstartVertex + subst low + have hend_neighbor := + @helper_hend_neighbor_289 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + (@alpha) (@beta) (@hproper) (@z) (@c) (@b) (@r) (@hlow) (@p) (@hp) (@hps) (@hnil) + have hendLeaf : Set.Subsingleton (H.neighborSet b) := by + intro y hy y' hy' + exact (hend_neighbor y hy).trans (hend_neighbor y' hy').symm + have hp_pos : 0 < p.length := + SimpleGraph.Walk.not_nil_iff_lt_length.mp hnil + have hendVertex := + @helper_hendVertex_390 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + (@alpha) (@beta) (@b) (@r) (@p) (@hendLeaf) (@hp_pos) + obtain ⟨s, hs⟩ := hendVertex + subst b + have hrs : r ≠ s := by + intro hrs + apply hnil + exact hp.nil_iff_eq.mpr (by simp [hrs]) + have hrmissing := endpoint_missing r hlow + have hsmissing := endpoint_missing s hendLeaf + have hrC : Sum.inl r ∈ TwoColorComponent G phi alpha beta c := by + rw [← hps] + change Sum.inl r ∈ p.support + simp + have hsC : Sum.inl s ∈ TwoColorComponent G phi alpha beta c := by + rw [← hps] + change Sum.inl s ∈ p.support + simpa only [p.getVert_length] using + p.getVert_mem_support p.length + right + refine ⟨r, s, p, hp, hps, hrs, hrmissing, hsmissing, ?_⟩ + by_cases hrX : r ∈ X + · exact @helper_branch_451 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + (@alpha) (@beta) (@boundary_of_walk) (@c) (@r) (@s) (@p) (@hps) (@hrX) + · exact @helper_branch_460 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + (@alpha) (@beta) (@hbeta) (@boundary_of_walk) (@c) (@hcX) (@r) (@s) (@p) (@hp) (@hps) (@hrX) +private theorem helper_branch_562.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k), + ∀ (z w : V ⊕ E), (( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), TwoColorComponent G phi alpha beta w = {Sum.inl x} + ∧ alpha ∈ MissingColors G phi x ∧ beta ∈ MissingColors G phi x) ∨ + ∃ (r : V) (s : V) (p : (TwoColorIncidenceGraph G phi alpha beta : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi + alpha beta w ∧ r ≠ s ∧ (alpha ∈ MissingColors G phi r ∨ beta ∈ MissingColors G phi r) ∧ + (alpha ∈ MissingColors G phi s ∨ beta ∈ MissingColors G phi s) ∧ (r ∈ + (TreeSequenceVertexSet T : Finset V) ∧ s ∈ (TreeSequenceVertexSet T : Finset V) ∨ + ∃ f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T : Finset V) beta, Sum.inr f ∈ + TwoColorComponent G phi alpha beta w ∧ (r ∈ (TreeSequenceVertexSet T : Finset V) ∨ s ∈ + (TreeSequenceVertexSet T : Finset V)))) → ( + ∀ {u v : V}, u ∈ (TreeSequenceVertexSet T : Finset V) → v ∈ (TreeSequenceVertexSet T : Finset + V) → u ≠ v → + ∀ {d : Fin k}, d ∈ MissingColors G phi u → d ∈ MissingColors G phi v → False) → ( + ∀ {u v : V}, Sum.inl u ∈ TwoColorComponent G phi alpha beta z → Sum.inl v ∈ TwoColorComponent + G phi alpha beta w → u ≠ v) → ( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), TwoColorComponent G phi alpha beta z = {Sum.inl x} + ∧ alpha ∈ MissingColors G phi x ∧ beta ∈ MissingColors G phi x) → False := by + classical + intro V E _ _ G k e0 phi T alpha beta + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta + set X : Finset V := TreeSequenceVertexSet T + intro z w hwdata no_repeat separated hziso + obtain ⟨x, hxX, hzsingle, hxa, hxb⟩ := hziso + have hxC : Sum.inl x ∈ TwoColorComponent G phi alpha beta z := by + rw [hzsingle] + simp + rcases hwdata with hwiso | hwnon + · obtain ⟨y, hyX, hwsingle, hya, hyb⟩ := hwiso + have hyC : Sum.inl y ∈ TwoColorComponent G phi alpha beta w := by + rw [hwsingle] + simp + exact no_repeat hxX hyX (separated hxC hyC) hxa hya + · obtain ⟨r, s, p, hp, hps, hrs, hrm, hsm, hclass⟩ := hwnon + have hrC : Sum.inl r ∈ TwoColorComponent G phi alpha beta w := by + rw [← hps] + simp + have hsC : Sum.inl s ∈ TwoColorComponent G phi alpha beta w := by + rw [← hps] + change Sum.inl s ∈ p.support + simpa only [p.getVert_length] using + p.getVert_mem_support p.length + obtain ⟨v, hvX, hvm, hvC⟩ : ∃ v : V, v ∈ X ∧ + (alpha ∈ MissingColors G phi v ∨ + beta ∈ MissingColors G phi v) ∧ + Sum.inl v ∈ TwoColorComponent G phi alpha beta w := by + rcases hclass with hinside | ⟨f, hfB, hfC, hend⟩ + · exact ⟨r, hinside.1, hrm, hrC⟩ + · rcases hend with hrX | hsX + · exact ⟨r, hrX, hrm, hrC⟩ + · exact ⟨s, hsX, hsm, hsC⟩ + rcases hvm with hva | hvb + · exact no_repeat hxX hvX (separated hxC hvC) hxa hva + · exact no_repeat hxX hvX (separated hxC hvC) hxb hvb + +private theorem helper_branch_593.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k), + (BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta).card ≤ (1 : ℕ) → + ∀ (z w : V ⊕ E), Disjoint (TwoColorComponent G phi alpha beta z) (TwoColorComponent G phi + alpha beta w) → (( + ∃ x ∈ (TreeSequenceVertexSet T : Finset V), TwoColorComponent G phi alpha beta w = {Sum.inl x} + ∧ alpha ∈ MissingColors G phi x ∧ beta ∈ MissingColors G phi x) ∨ + ∃ (r : V) (s : V) (p : (TwoColorIncidenceGraph G phi alpha beta : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi + alpha beta w ∧ r ≠ s ∧ (alpha ∈ MissingColors G phi r ∨ beta ∈ MissingColors G phi r) ∧ + (alpha ∈ MissingColors G phi s ∨ beta ∈ MissingColors G phi s) ∧ (r ∈ + (TreeSequenceVertexSet T : Finset V) ∧ s ∈ (TreeSequenceVertexSet T : Finset V) ∨ + ∃ f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T : Finset V) beta, Sum.inr f ∈ + TwoColorComponent G phi alpha beta w ∧ (r ∈ (TreeSequenceVertexSet T : Finset V) ∨ s ∈ + (TreeSequenceVertexSet T : Finset V)))) → ( + ∀ {u v : V}, u ∈ (TreeSequenceVertexSet T : Finset V) → v ∈ (TreeSequenceVertexSet T : Finset + V) → u ≠ v → + ∀ {d : Fin k}, d ∈ MissingColors G phi u → d ∈ MissingColors G phi v → False) → ( + ∀ {u v : V}, Sum.inl u ∈ TwoColorComponent G phi alpha beta z → Sum.inl v ∈ TwoColorComponent + G phi alpha beta w → u ≠ v) → ( + ∀ {u v t : V}, u ∈ (TreeSequenceVertexSet T : Finset V) → v ∈ (TreeSequenceVertexSet T : + Finset V) → t ∈ (TreeSequenceVertexSet T : Finset V) → u ≠ v → u ≠ t → v ≠ t → alpha ∈ + MissingColors G phi u ∨ beta ∈ MissingColors G phi u → alpha ∈ MissingColors G phi v ∨ + beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi t ∨ beta ∈ MissingColors G phi + t → False) → ( + ∃ (r : V) (s : V) (p : (TwoColorIncidenceGraph G phi alpha beta : SimpleGraph (V ⊕ E)).Walk + (Sum.inl r) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G phi + alpha beta z ∧ r ≠ s ∧ (alpha ∈ MissingColors G phi r ∨ beta ∈ MissingColors G phi r) ∧ + (alpha ∈ MissingColors G phi s ∨ beta ∈ MissingColors G phi s) ∧ (r ∈ + (TreeSequenceVertexSet T : Finset V) ∧ s ∈ (TreeSequenceVertexSet T : Finset V) ∨ + ∃ f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T : Finset V) beta, Sum.inr f ∈ + TwoColorComponent G phi alpha beta z ∧ (r ∈ (TreeSequenceVertexSet T : Finset V) ∨ s ∈ + (TreeSequenceVertexSet T : Finset V)))) → False := by + classical + intro V E _ _ G k e0 phi T alpha beta hbeta + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta + set X : Finset V := TreeSequenceVertexSet T + intro z w hdisj hwdata no_repeat separated three_impossible hznon + rcases hwdata with hwiso | hwnon + · obtain ⟨y, hyX, hwsingle, hya, hyb⟩ := hwiso + have hyC : Sum.inl y ∈ TwoColorComponent G phi alpha beta w := by + rw [hwsingle] + simp + obtain ⟨r, s, p, hp, hps, hrs, hrm, hsm, hclass⟩ := hznon + have hrC : Sum.inl r ∈ TwoColorComponent G phi alpha beta z := by + rw [← hps] + simp + have hsC : Sum.inl s ∈ TwoColorComponent G phi alpha beta z := by + rw [← hps] + change Sum.inl s ∈ p.support + simpa only [p.getVert_length] using + p.getVert_mem_support p.length + obtain ⟨v, hvX, hvm, hvC⟩ : ∃ v : V, v ∈ X ∧ + (alpha ∈ MissingColors G phi v ∨ + beta ∈ MissingColors G phi v) ∧ + Sum.inl v ∈ TwoColorComponent G phi alpha beta z := by + rcases hclass with hinside | ⟨f, hfB, hfC, hend⟩ + · exact ⟨r, hinside.1, hrm, hrC⟩ + · rcases hend with hrX | hsX + · exact ⟨r, hrX, hrm, hrC⟩ + · exact ⟨s, hsX, hsm, hsC⟩ + have hvy : v ≠ y := separated hvC hyC + rcases hvm with hva | hvb + · exact no_repeat hvX hyX hvy hva hya + · exact no_repeat hvX hyX hvy hvb hyb + · obtain ⟨rz, sz, pz, hpz, hpsz, hrsz, hrzm, hszm, hzclass⟩ := hznon + obtain ⟨rw, sw, pw, hpw, hpsw, hrsw, hrwm, hswm, hwclass⟩ := hwnon + have hrzC : Sum.inl rz ∈ TwoColorComponent G phi alpha beta z := by + rw [← hpsz] + simp + have hszC : Sum.inl sz ∈ TwoColorComponent G phi alpha beta z := by + rw [← hpsz] + change Sum.inl sz ∈ pz.support + simpa only [pz.getVert_length] using + pz.getVert_mem_support pz.length + have hrwC : Sum.inl rw ∈ TwoColorComponent G phi alpha beta w := by + rw [← hpsw] + simp + have hswC : Sum.inl sw ∈ TwoColorComponent G phi alpha beta w := by + rw [← hpsw] + change Sum.inl sw ∈ pw.support + simpa only [pw.getVert_length] using + pw.getVert_mem_support pw.length + rcases hzclass with hzinside | ⟨fz, hfzB, hfzC, hzend⟩ + · obtain ⟨t, htX, htm, htC⟩ : ∃ t : V, t ∈ X ∧ + (alpha ∈ MissingColors G phi t ∨ + beta ∈ MissingColors G phi t) ∧ + Sum.inl t ∈ TwoColorComponent G phi alpha beta w := by + rcases hwclass with hwinside | ⟨fw, hfwB, hfwC, hwend⟩ + · exact ⟨rw, hwinside.1, hrwm, hrwC⟩ + · rcases hwend with hrwX | hswX + · exact ⟨rw, hrwX, hrwm, hrwC⟩ + · exact ⟨sw, hswX, hswm, hswC⟩ + exact three_impossible hzinside.1 hzinside.2 htX hrsz + (separated hrzC htC) (separated hszC htC) hrzm hszm htm + · rcases hwclass with hwinside | ⟨fw, hfwB, hfwC, hwend⟩ + · obtain ⟨t, htX, htm, htC⟩ : ∃ t : V, t ∈ X ∧ + (alpha ∈ MissingColors G phi t ∨ + beta ∈ MissingColors G phi t) ∧ + Sum.inl t ∈ TwoColorComponent G phi alpha beta z := by + rcases hzend with hrzX | hszX + · exact ⟨rz, hrzX, hrzm, hrzC⟩ + · exact ⟨sz, hszX, hszm, hszC⟩ + exact three_impossible hwinside.1 hwinside.2 htX hrsw + (Ne.symm (separated htC hrwC)) + (Ne.symm (separated htC hswC)) hrwm hswm htm + · have hfne : fz ≠ fw := by + intro h + subst fw + exact (Set.disjoint_left.mp hdisj) hfzC hfwC + have hsubset : ({fz, fw} : Finset E) ⊆ + BoundaryColorEdges G phi X beta := by + intro f hf + simp only [Finset.mem_insert, Finset.mem_singleton] at hf + rcases hf with rfl | rfl + · exact hfzB + · exact hfwB + have htwo : 2 ≤ (BoundaryColorEdges G phi X beta).card := by + have hle := Finset.card_le_card hsubset + have hpair : ({fz, fw} : Finset E).card = 2 := by + simp [hfne] + omega + have hbetaX : (BoundaryColorEdges G phi X beta).card ≤ 1 := by + simpa [X] using hbeta + omega + +private theorem helper_branch_132.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k), + IsProperEdgeColoring G phi → ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) → + (BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta).card ≤ (1 : ℕ) → ( + ∀ {a b : V} (p : (TwoColorIncidenceGraph G phi alpha beta : SimpleGraph (V ⊕ E)).Walk (Sum.inl + a) (Sum.inl b)), a ∈ (TreeSequenceVertexSet T : Finset V) → b ∉ (TreeSequenceVertexSet T : + Finset V) → + ∃ f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T : Finset V) beta, Sum.inr f ∈ + p.support) → + ∀ (z w : V ⊕ E), TwoColorPathComponent G phi alpha beta z → TwoColorPathComponent G phi alpha + beta w → ( + ∃ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G phi alpha beta z) → ( + ∃ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G phi alpha beta w) → Disjoint + (TwoColorComponent G phi alpha beta z) (TwoColorComponent G phi alpha beta w) → + TwoColorComponent G phi alpha beta z = TwoColorComponent G phi alpha beta w := by + classical + intro V E _ _ G k e0 phi T alpha beta hproper helementary hbeta + set H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha beta + set X : Finset V := TreeSequenceVertexSet T + intro boundary_of_walk z w hz hw hzX hwX hdisj + exfalso + have hne : alpha ≠ beta := hz.1 + have endpoint_missing := @helper_endpoint_missing_142 V E inferInstance inferInstance G k phi + alpha beta hne + have analyze := + @helper_analyze_168 V E inferInstance inferInstance G k e0 + phi T alpha beta hproper hbeta boundary_of_walk z endpoint_missing + obtain hzdata := analyze z hz hzX + obtain hwdata := analyze w hw hwX + have helementaryX : ColoredVertexSetElementary G phi X := by + dsimp [X] + exact helementary + have no_repeat {u v : V} (huX : u ∈ X) (hvX : v ∈ X) + (huv : u ≠ v) {d : Fin k} + (hu : d ∈ MissingColors G phi u) + (hv : d ∈ MissingColors G phi v) : False := + (Finset.disjoint_left.mp (helementaryX huX hvX huv)) hu hv + have separated {u v : V} + (hu : Sum.inl u ∈ TwoColorComponent G phi alpha beta z) + (hv : Sum.inl v ∈ TwoColorComponent G phi alpha beta w) : + u ≠ v := by + intro huv + subst v + exact (Set.disjoint_left.mp hdisj) hu hv + have three_impossible : + ∀ {u v t : V}, u ∈ X → v ∈ X → t ∈ X → u ≠ v → u ≠ t → v ≠ t → (alpha ∈ MissingColors G phi u + ∨ beta ∈ MissingColors G phi u) → (alpha ∈ MissingColors G phi v ∨ beta ∈ MissingColors G + phi v) → (alpha ∈ MissingColors G phi t ∨ beta ∈ MissingColors G phi t) → False := by + intro u v t huX hvX htX huv hut hvt hu hv ht + rcases hu with hua | hub <;> + rcases hv with hva | hvb <;> + rcases ht with hta | htb + · exact no_repeat huX hvX huv hua hva + · exact no_repeat huX hvX huv hua hva + · exact no_repeat huX htX hut hua hta + · exact no_repeat hvX htX hvt hvb htb + · exact no_repeat hvX htX hvt hva hta + · exact no_repeat huX htX hut hub htb + · exact no_repeat huX hvX huv hub hvb + · exact no_repeat huX hvX huv hub hvb + rcases hzdata with hziso | hznon + · exact @helper_branch_562 V E inferInstance inferInstance G k e0 phi T alpha beta z w hwdata + no_repeat separated hziso + · exact @helper_branch_593 V E inferInstance inferInstance G k e0 phi T alpha + beta hbeta z w hdisj hwdata no_repeat separated three_impossible hznon +lemma ElementarySingleBoundaryInterchangeable {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (alpha beta : Fin k) + (hproper : IsProperEdgeColoring G phi) + (helementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (halpha : BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha = {}) + (hbeta : (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) beta).card ≤ 1) : + TreeInterchangeable G T phi alpha beta := by + classical + let H := TwoColorIncidenceGraph G phi alpha beta + let X := TreeSequenceVertexSet T + have boundary_of_walk := + @helper_boundary_of_walk_52 V E inferInstance inferInstance G k e0 phi T alpha beta halpha + unfold TreeInterchangeable + intro z w hz hw hzX hwX + rcases TwoColorComponentsDisjoint G phi alpha beta z w with heq | hdisj + · exact heq + · exact @helper_branch_132 V E inferInstance inferInstance G k e0 + phi T alpha beta hproper helementary hbeta boundary_of_walk z w hz hw hzX hwX hdisj +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementaryTerminalComponent.lean b/LeanPool/GoldbergSeymour/ElementaryTerminalComponent.lean new file mode 100644 index 0000000000..1313fc46c6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementaryTerminalComponent.lean @@ -0,0 +1,172 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# P2905_T2_Elementary Terminal Component + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2905_T2_ElementaryTerminalComponent {V E : Type*} + [Finite V] [Fintype E] {k : ℕ} (G : LooplessMultigraph V E) + (psi : PartialEdgeColoring E k) (a b : Fin k) + (hne : a ≠ b) (hproper : IsProperEdgeColoring G psi) + (B : Finset V) (helem : ColoredVertexSetElementary G psi B) + (u v w : V) (hu : u ∈ B) (hv : v ∈ B) + (hwu : w ≠ u) (hwv : w ≠ v) + (hau : a ∈ MissingColors G psi u) (hbv : b ∈ MissingColors G psi v) + (hw : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) + (hsame : TwoColorComponent G psi a b (Sum.inl u) = + TwoColorComponent G psi a b (Sum.inl v)) : + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) + (TwoColorComponent G psi a b (Sum.inl u)) ∧ + TwoColorPathComponent G psi a b (Sum.inl w) ∧ + (∀ x ∈ B, + MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = + MissingColors G psi x) := by + classical + let _ := Fintype.ofFinite V + let J := TwoColorIncidenceGraph G psi a b + have leaf (x : V) (hx : a ∈ MissingColors G psi x ∨ b ∈ MissingColors G psi x) : + (J.neighborSet (Sum.inl x)).Subsingleton := by + have hd : @SimpleGraph.degree _ J (Sum.inl x) (Fintype.ofFinite _) ≤ 1 := by + rcases hx with hx | hx + · exact MissingColorIncidenceEndpoint G psi a b hne hproper x hx + · have hJ : TwoColorIncidenceGraph G psi b a = J := by + ext z z' + cases z <;> cases z' <;> simp [J, TwoColorIncidenceGraph, or_comm] + rw [← hJ] + exact MissingColorIncidenceEndpoint G psi b a hne.symm hproper x hx + let : Fintype (J.neighborSet (Sum.inl x)) := Fintype.ofFinite _ + have hc : Fintype.card (J.neighborSet (Sum.inl x)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hd + intro z hz z' hz' + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hc ⟨z, hz⟩ ⟨z', hz'⟩) + have hnot : Sum.inl w ∉ TwoColorComponent G psi a b (Sum.inl u) := by + intro hwC + by_cases huv : u = v + · subst v + have isolated : J.neighborSet (Sum.inl u) = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro z hz + cases z with + | inl x => exact hz + | inr e => + rcases hz.2 with hc | hc + · exact (Finset.mem_sdiff.mp hau).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hz.1, hc⟩) + · exact (Finset.mem_sdiff.mp hbv).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hz.1, hc⟩) + have reach : J.Reachable (Sum.inl w) (Sum.inl u) := + SimpleGraph.ConnectedComponent.exact hwC + exact SimpleGraph.not_reachable_of_neighborSet_right_eq_empty + (by intro hh; exact hwu (Sum.inl.inj hh)) isolated reach + · obtain ⟨s, t, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G psi a b hproper (Sum.inl u) + have endpoint (x : V) + (hxC : Sum.inl x ∈ TwoColorComponent G psi a b (Sum.inl u)) + (hx : a ∈ MissingColors G psi x ∨ b ∈ MissingColors G psi x) : + Sum.inl x = s ∨ Sum.inl x = t := by + by_contra hh + push Not at hh + have hxP : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {z | z ∈ p.support} + rw [hsupport] + exact hxC + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hh.1 hh.2 (leaf x hx)) hxP + have huE := endpoint u (by rfl) (Or.inl hau) + have hvE := endpoint v (by rw [hsame]; rfl) (Or.inr hbv) + have hwE := endpoint w hwC hw + rcases huE with huE | huE <;> rcases hvE with hvE | hvE <;> + rcases hwE with hwE | hwE + all_goals first + | exact huv (Sum.inl.inj (huE.trans hvE.symm)) + | exact hwu (Sum.inl.inj (hwE.trans huE.symm)) + | exact hwv (Sum.inl.inj (hwE.trans hvE.symm)) + have hdis : Disjoint (TwoColorComponent G psi a b (Sum.inl w)) + (TwoColorComponent G psi a b (Sum.inl u)) := by + rcases TwoColorComponentsDisjoint G psi a b (Sum.inl w) (Sum.inl u) with hh | hh + · exact (hnot (by rw [← hh]; rfl)).elim + · exact hh + refine ⟨hdis, ⟨hne, Sum.inl w, by rfl, leaf w hw⟩, ?_⟩ + let Q := TwoColorComponent G psi a b (Sum.inl w) + let tau := TwoColorComponentSwap G psi a b (Sum.inl w) + have huQ : Sum.inl u ∉ Q := by + intro hh + exact Set.disjoint_left.mp hdis hh (by rfl) + have hvQ : Sum.inl v ∉ Q := by + intro hh + exact Set.disjoint_left.mp hdis hh (by rw [hsame]; rfl) + obtain ⟨outside, -, -, unaffected⟩ := + TwoColorComponentSwapMissingBehavior G psi a b hne hproper (Sum.inl w) + have edgeIn {x : V} {e : E} (hx : Sum.inl x ∈ Q) + (hi : Incident G x e) (hc : psi e = some a ∨ psi e = some b) : + Sum.inr e ∈ Q := by + change J.connectedComponentMk (Sum.inl x) = J.connectedComponentMk (Sum.inl w) at hx + change J.connectedComponentMk (Sum.inr e) = J.connectedComponentMk (Sum.inl w) + have ha : J.Adj (Sum.inr e) (Sum.inl x) := ⟨hi, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj ha).trans hx + intro x hx + by_cases hxQ : Sum.inl x ∈ Q + · have haNot : a ∉ MissingColors G psi x := by + intro ha + by_cases hxu : x = u + · exact huQ (hxu ▸ hxQ) + · exact Finset.disjoint_left.mp (helem hx hu hxu) ha hau + have hbNot : b ∉ MissingColors G psi x := by + intro hb + by_cases hxv : x = v + · exact hvQ (hxv ▸ hxQ) + · exact Finset.disjoint_left.mp (helem hx hv hxv) hb hbv + have present (c : Fin k) (hc : c ∉ MissingColors G psi x) : + ∃ e, Incident G x e ∧ psi e = some c := by + simpa [MissingColors, PresentColors] using hc + obtain ⟨ea, hia, hca⟩ := present a haNot + obtain ⟨eb, hib, hcb⟩ := present b hbNot + have haNew : a ∉ MissingColors G tau x := by + have heQ := edgeIn hxQ hib (Or.inr hcb) + have hcol : tau eb = some a := by + simp [tau, TwoColorComponentSwap, show Sum.inr eb ∈ + TwoColorComponent G psi a b (Sum.inl w) from heQ, hcb, hne.symm] + exact fun hm => (Finset.mem_sdiff.mp hm).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, eb, hib, hcol⟩) + have hbNew : b ∉ MissingColors G tau x := by + have heQ := edgeIn hxQ hia (Or.inl hca) + have hcol : tau ea = some b := by + simp [tau, TwoColorComponentSwap, show Sum.inr ea ∈ + TwoColorComponent G psi a b (Sum.inl w) from heQ, hca] + exact fun hm => (Finset.mem_sdiff.mp hm).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, ea, hia, hcol⟩) + ext c + by_cases hca : c = a + · subst c + exact iff_of_false haNew haNot + · by_cases hcb : c = b + · subst c + exact iff_of_false hbNew hbNot + · exact unaffected x c hca hcb + · exact outside x hxQ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ElementaryTransfer.lean b/LeanPool/GoldbergSeymour/ElementaryTransfer.lean new file mode 100644 index 0000000000..c622bad2fe --- /dev/null +++ b/LeanPool/GoldbergSeymour/ElementaryTransfer.lean @@ -0,0 +1,39 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DensityLowerBound +public import LeanPool.GoldbergSeymour.DensityMonotone +public import LeanPool.GoldbergSeymour.Elementary + +/-! +# Elementary Transfer + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ElementaryTransfer {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (F : Finset E) + (hχ : ChromaticIndex (RestrictEdges G F) = ChromaticIndex G) + (hElem : Elementary (RestrictEdges G F)) : Elementary G := by + unfold Elementary at hElem ⊢ + have lowerBound : DensityCeil G ≤ ChromaticIndex G := DensityLowerBound G + have upperBound : ChromaticIndex G ≤ DensityCeil G := by + calc + ChromaticIndex G = ChromaticIndex (RestrictEdges G F) := hχ.symm + _ = DensityCeil (RestrictEdges G F) := hElem + _ ≤ DensityCeil G := DensityMonotone G F + exact le_antisymm upperBound lowerBound + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/EligibleIndexBoundConstruction.lean b/LeanPool/GoldbergSeymour/EligibleIndexBoundConstruction.lean new file mode 100644 index 0000000000..11010801a7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/EligibleIndexBoundConstruction.lean @@ -0,0 +1,590 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.EligibleIndexBoundPreparation + +/-! +# Hierarchy Situation Three Eligible Index Bound + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +namespace EligibleIndexBound + +/-- Typed data construction shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperGoodS3640.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (alpha : Fin k) → + let old : HierarchyCounterexample P.replacementBase := + P.counterexample; + let H : + TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase := + old.hierarchy; + let n : + Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree + n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = HierarchyPathNumber C.hierarchy → + (hlenT : (3 : ℕ) ≤ T.length) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ + if e = f then some alpha else mu e; + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G sigma v = + MissingColors G mu v) → + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ + TreeSequenceVertexSet X → + TreeMissingColors sigma U = + TreeMissingColors mu U) → + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ + TreeSequenceVertexSet X → + ∀ (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma U R ↔ + TreeColorSetMinusClosed G mu U R) → + (positiveB : + (1 : ℕ) ≤ + P.corresponding.replacementETT.rounds) → + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))) + B) → + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := + TreeSequence.positive T + omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))).length < + B.length) → + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last + (P.corresponding.replacementETT.rounds + + (1 : ℕ))))) → + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last + P.corresponding.replacementETT.rounds)) → + (baseB : + HierarchyBase + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := aboveB, + strictAbovePenultimate := + strictB, + belowFinal := belowB, + generatingColoring := + generatingB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput + B mu } + mu) → + (HB : + TashkinovHierarchy + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := + positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := belowB, + generatingColoring := + generatingB : + ExtendedTashkinovTree G k + e0 + P.corresponding.replacementInput + B mu } + baseB) → + GoodHierarchy HB → + let EB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput + B mu := + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := + positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := belowB, + generatingColoring := + generatingB : + ExtendedTashkinovTree G k + e0 + P.corresponding.replacementInput + B mu }; + TreeSequenceVertexSet + baseB.core ⊆ + TreeSequenceVertexSet X → + (EB.series.data.kind + (Fin.last + EB.rounds) = + some + TashkinovExtensionKind.PE → + TreeSequenceVertexSet + baseB.closure ⊆ + TreeSequenceVertexSet + X) → + (corr : + CorrespondingExtendedTashkinovTree + G k e0 EB sigma B) → + (bs : + HierarchyBase + corr.replacementETT + sigma) → + baseB.core = bs.core → + ({ + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := + positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + generatingB : + ExtendedTashkinovTree + G k e0 + P.corresponding.replacementInput + B + mu }.series.data.kind + (Fin.last + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := + positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + generatingB : + ExtendedTashkinovTree + G k + e0 + P.corresponding.replacementInput + B + mu }.rounds) = + some + TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind + (Fin.last + corr.replacementETT.rounds) = + some + TashkinovExtensionKind.PE) → + ({ + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := + positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + generatingB : + ExtendedTashkinovTree + G k + e0 + P.corresponding.replacementInput + B + mu }.series.data.kind + (Fin.last + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := + positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := + aboveB, + strictAbovePenultimate := + strictB, + belowFinal := + belowB, + generatingColoring := + generatingB : + ExtendedTashkinovTree + G + k + e0 + P.corresponding.replacementInput + B + mu }.rounds) = + some + TashkinovExtensionKind.PE → + baseB.closure = + bs.closure) → + (baseStageK : + HB.stage + (0 : + Fin + (HB.dividerCount + + (2 : + ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc) → + (terminalStageK : + HB.stage + (Fin.last + (HB.dividerCount + + (1 : + ℕ))) = + B) → + (nestedK : + ∀ + (j : + Fin + (HB.dividerCount + + (1 : + ℕ))), + TreeSequenceInitialSegment + (HB.stage + j.castSucc) + (HB.stage + j.succ)) → + (strictK : + ∀ + (j : + Fin + (HB.dividerCount + + (1 : + ℕ))), + (HB.stage + j.castSucc).length < + (HB.stage + j.succ).length) → + (coreInsideK : + TreeSequenceInitialSegment + bs.core + (HB.stage + (⟨(1 : + ℕ), + by + have := + TreeSequence.positive + T + have := + TreeSequence.positive + B + omega⟩ : + Fin + (HB.dividerCount + + (2 : + ℕ))))) → + (positiveK : + ∀ + (i : + Fin + HB.dividerCount), + (1 : + ℕ) ≤ + (↑(HB.dividerPosition + i) : + ℕ)) → + (increasingK : + ∀ + (i + j : + Fin + HB.dividerCount), + (↑i : + ℕ) < + (↑j : + ℕ) → + (↑(HB.dividerPosition + i) : + ℕ) < + (↑(HB.dividerPosition + j) : + ℕ)) → + (dividerStageK : + ∀ + (i : + Fin + HB.dividerCount), + HB.stage + (⟨(↑i : + ℕ) + + (1 : + ℕ), + by + have := + TreeSequence.positive + T + have := + TreeSequence.positive + B + omega⟩ : + Fin + (HB.dividerCount + + (2 : + ℕ))) = + TreeSequencePrefix + B + (↑(HB.dividerPosition + i) : + ℕ) + (positiveK + i) + (by + have := + TreeSequence.positive + T + have := + TreeSequence.positive + B + omega)) → + let + KF : + TashkinovHierarchy + corr.replacementETT + bs := + by + exact + @helperKF3658 + (@V) + (@E) + inferInstance + inferInstance + inferInstance + inferInstance + (@G) + (@k) + (@e0) + (@input) + (@T) + (@phi) + (@ett) + (@base) + (@C) + (@ctx) + (@P) + (@alpha) + (@hlenT) + (@positiveB) + (@aboveB) + (@strictB) + (@belowB) + (@generatingB) + (@baseB) + (@HB) + (@corr) + (@bs) + (@baseStageK) + (@terminalStageK) + (@nestedK) + (@strictK) + (@coreInsideK) + (@positiveK) + (@increasingK) + (@dividerStageK) + (∀ + (j : + Fin + (HB.dividerCount + + (1 : + ℕ))), + HierarchyStarredStage + KF + j = + HierarchyStarredStage + HB + j) → + (∀ + (j : + Fin + (HB.dividerCount + + (1 : + ℕ))), + TreeSequenceInitialSegment + (HB.stage + j.castSucc) + X) → + corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc = + Tn → + (∀ + (j : + Fin + (HB.dividerCount + + (1 : + ℕ))), + HierarchyStoredColorsAt + KF + j = + HierarchyStoredColorsAt + HB + j) → + (∀ + (j : + Fin + (HB.dividerCount + + (1 : + ℕ))), + HierarchyStageMissingColors + KF + j = + HierarchyStageMissingColors + HB + j) → + (∀ + (j : + Fin + (HB.dividerCount + + (1 : + ℕ))) + (c : + Fin + k), + HierarchySegmentColors + KF + j + c = + HierarchySegmentColors + HB + j + c) → + GoodHierarchy + KF := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f + sigma missingFixed missingTree minusEq positiveB aboveB strictB belowB generatingB baseB HB + goodB EB coreBX closureBX corr bs hcore hpe hclosure baseStageK terminalStageK nestedK + strictK coreInsideK positiveK increasingK dividerStageK KF starredEq stageBX terminalTree + storedEq stageMissingEq segmentEq + exact { + gamma := goodB.gamma + twoColors := by + intro j c hc + exact goodB.twoColors j c (by rw [storedEq j] at hc; exact hc) + avoidance := by + intro j c hc + rw [stageMissingEq j, segmentEq j c] + exact goodB.avoidance j c (by rw [storedEq j] at hc; exact hc) + disjointPairs := by + intro j c d hc hd hne + exact goodB.disjointPairs j c d (by rw [storedEq j] at hc; exact hc) + (by rw [storedEq j] at hd; exact hd) hne + uniqueRefresh := by + apply helper_uniqueRefresh_4523 <;> assumption + parallelBase := by + apply helper_parallelBase_4547 <;> assumption + minusClosed := by + intro i + change TreeColorSetMinusClosed G sigma (HB.stage i.succ.castSucc) + ((HierarchyStoredColorsAt KF i.succ).biUnion (goodB.gamma i.castSucc)) + rw [storedEq i.succ, minusEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBX i.succ))] + exact goodB.minusClosed i } + +end EligibleIndexBound + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean b/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean new file mode 100644 index 0000000000..abb1d99f42 --- /dev/null +++ b/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean @@ -0,0 +1,5116 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChangeCaseThree +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Hierarchy Situation Three Eligible Index Bound + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +namespace EligibleIndexBound + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch1346Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (∀ (psi : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G psi → + ∀ (B : Finset V), + ColoredVertexSetElementary G psi B → + ∀ (u v w : V), + u ∈ B → + v ∈ B → + u ≠ v → + w ≠ u → + w ≠ v → + a ∈ MissingColors G psi u → + b ∈ MissingColors G psi v → + a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = + TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) + (TwoColorComponent G psi a b (Sum.inl u)) ∧ + TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, + MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = + MissingColors G psi x) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = + A) → + TreeSequenceInitialSegment A T → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment B T → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = + B) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → + (∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), + U.vertex j ∈ TreeSequenceVertexSet U) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) + (j : Fin (B.length + (1 : ℕ))), + c ∈ MissingColors G R.coloring (B.vertex j) → + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (X : TreeSequence G e0), + TreeSequenceInitialSegment A X → + A.length < X.length → + TreeSequenceInitialSegment X B → + ∀ (a b eta : Fin k), + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) + eta → + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length → + ∀ (jb : Fin (B.length + (1 : ℕ))), + A.length < (↑jb : ℕ) → + (↑jb : ℕ) ≤ X.length → + b ∈ MissingColors G R.coloring (B.vertex jb) → + a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) ∨ + b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some a) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + ∃ (S : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + S.coloring (T.edge t) = R.coloring (T.edge t)) ∧ + (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ + (b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + a ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length)))) → + (∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount), + eta ∈ + HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) + eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) + eta) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + (1 : ℕ))), + A.length < (↑j : ℕ) → + c ∈ MissingColors G R.coloring (B.vertex j) → + c ∉ TreeMissingColors R.coloring A) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∉ TreeMissingColors R.coloring A, + c ∉ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + c ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ + a ∈ + R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a) → + ∀ (m : ℕ) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + alpha ∈ + MissingColors G P.coloring + ((HierarchyFullTailPrefix C m).vertex + (Fin.last (HierarchyFullTailPrefix C m).length)), + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) → + ∀ (hm : (2 : ℕ) ≤ m) (hmT : A.length + (m + (1 : ℕ)) < T.length), + let X : TreeSequence G e0 := + TreeSequencePrefix T (A.length + (m + (1 : ℕ))) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ A.length + (m + (1 : ℕ))) ↦ by + omega) + (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) ≤ T.length) ↦ + by omega); + TreeSequenceInitialSegment A X → + TreeSequenceInitialSegment X B → + A.length < X.length → + let jm : Fin (B.length + (1 : ℕ)) := + (⟨A.length + m, + id + (Decidable.byContradiction + fun (a : ¬A.length + m < T.length - (1 : ℕ) + (1 : ℕ)) ↦ by omega)⟩ : + Fin (B.length + (1 : ℕ))); + let jnext : Fin (B.length + (1 : ℕ)) := + (⟨A.length + (m + (1 : ℕ)), + id + (Decidable.byContradiction + fun (a : ¬A.length + (m + (1 : ℕ)) < T.length - (1 : ℕ) + (1 : ℕ)) ↦ + by omega)⟩ : + Fin (B.length + (1 : ℕ))); + let tnext : Fin T.length := + (⟨A.length + m, + Decidable.byContradiction fun (a : ¬A.length + m < T.length) ↦ by + omega⟩ : + Fin T.length); + alpha ∈ MissingColors G P.coloring (B.vertex jm) → + ∀ theta ∈ MissingColors G P.coloring (B.vertex jnext), + (∀ + (S : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ MissingColors G S.coloring (B.vertex jnext), + c ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length)) → + m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C + ctx) → + (∀ + (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jnext), + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors + R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + (∀ + (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jm), + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors + R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + (∀ + (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k), + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + a ∈ + R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta → + eta ∈ MissingColors G R.coloring (B.vertex jnext) → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some a) → + alpha ∉ + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → + m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C + ctx + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperAdvance1257Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy → + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C → + (∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → + IsOneEdgeUncolored mu e0 → ∀ (v : V), (MissingColors G mu v).Nonempty) → + (∀ (psi : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G psi → + ∀ (B : Finset V), + ColoredVertexSetElementary G psi B → + ∀ (u v w : V), + u ∈ B → + v ∈ B → + u ≠ v → + w ≠ u → + w ≠ v → + a ∈ MissingColors G psi u → + b ∈ MissingColors G psi v → + a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = + TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) + (TwoColorComponent G psi a b (Sum.inl u)) ∧ + TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, + MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = + MissingColors G psi x) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Z → + TreeSequenceInitialSegment Y Z → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = + A) → + TreeSequenceInitialSegment A T → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment B T → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = + B) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → + (∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), + U.vertex j ∈ TreeSequenceVertexSet U) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + (1 : ℕ))), + c ∈ MissingColors G R.coloring (B.vertex j) → + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (X : TreeSequence G e0), + TreeSequenceInitialSegment A X → + A.length < X.length → + TreeSequenceInitialSegment X B → + ∀ (a b eta : Fin k), + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + a ∈ + R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta → + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length → + ∀ (jb : Fin (B.length + (1 : ℕ))), + A.length < (↑jb : ℕ) → + (↑jb : ℕ) ≤ X.length → + b ∈ MissingColors G R.coloring (B.vertex jb) → + a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) ∨ + b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some a) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors + R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + ∃ (S : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + S.coloring (T.edge t) = R.coloring (T.edge t)) ∧ + (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ + MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ + (b ∈ + MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + a ∈ + MissingColors G S.coloring (T.vertex (Fin.last T.length)))) → + (∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount), + eta ∈ + HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) + eta = + S.counterexample.good.gamma + (Fin.last S.counterexample.hierarchy.dividerCount) eta) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k), + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + a ∈ + R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) → + R.coloring (T.edge t) ≠ some a) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + (1 : ℕ))), + A.length < (↑j : ℕ) → + c ∈ MissingColors G R.coloring (B.vertex j) → + c ∉ TreeMissingColors R.coloring A) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∉ TreeMissingColors R.coloring A, + c ∉ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + c ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (j : ℕ), + (1 : ℕ) ≤ j → + j < T.length - A.length → + ∀ + c ∈ + MissingColors G R.coloring + ((HierarchyFullTailPrefix C j).vertex + (Fin.last (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < A.length + j → + R.coloring (T.edge t) = some c → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + c ∈ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + (∀ (t : Fin T.length), + A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ) → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ + a ∈ + R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a) → + ∀ (m : ℕ), + HierarchyPathNumber C.hierarchy ≤ m → + m < HierarchyFullTailLength C - (1 : ℕ) → + ∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + alpha ∈ + MissingColors G P.coloring + ((HierarchyFullTailPrefix C m).vertex + (Fin.last (HierarchyFullTailPrefix C m).length)), + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) → + m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C + ctx + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch2404Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length) (beta : Fin k), + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HierarchyPathNumber KF ≤ HierarchyPathNumber H → + HB.stage (Fin.last HB.dividerCount).castSucc = + H.stage (Fin.last H.dividerCount).castSucc → + (H.stage (Fin.last H.dividerCount).castSucc).length < B.length → + ¬HierarchyPathNumber KF < HierarchyPathNumber H → + HierarchyCounterexampleLess + (HierarchyPathNumber KF, + B.length - + (HB.stage + (⟨HB.dividerCount, by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ)))).length) + (HierarchyPathNumber H, + T.length - + (H.stage + (⟨H.dividerCount, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))).length) + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperLastOrdinary2387Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (hcountB : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HB.stage j.castSucc = + H.stage + (Fin.cast + (by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega) + j).castSucc ∧ + HierarchyStarredStage HB j = + HierarchyStarredStage H + (Fin.cast + (by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega) + j)) → + HB.stage (Fin.last HB.dividerCount).castSucc = H.stage (Fin.last H.dividerCount).castSucc + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch1318Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + (∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), + U.vertex j ∈ TreeSequenceVertexSet U) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) + (j : Fin (B.length + (1 : ℕ))), + c ∈ MissingColors G R.coloring (B.vertex j) → + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (X : TreeSequence G e0), + TreeSequenceInitialSegment A X → + A.length < X.length → + TreeSequenceInitialSegment X B → + ∀ (a b eta : Fin k), + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta → + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length → + ∀ (jb : Fin (B.length + (1 : ℕ))), + A.length < (↑jb : ℕ) → + (↑jb : ℕ) ≤ X.length → + b ∈ MissingColors G R.coloring (B.vertex jb) → + a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) ∨ + b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some a) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → S.coloring (T.edge t) = R.coloring (T.edge t)) ∧ + (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ + (b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + a ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length)))) → + (∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount), + eta ∈ + HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ + a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a) → + ∀ (m : ℕ) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), + ∀ (hm : (2 : ℕ) ≤ m) (hmT : A.length + (m + (1 : ℕ)) < T.length), + let X : TreeSequence G e0 := + TreeSequencePrefix T (A.length + (m + (1 : ℕ))) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ A.length + (m + (1 : ℕ))) ↦ by omega) + (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment A X → + TreeSequenceInitialSegment X B → + A.length < X.length → + let jm : Fin (B.length + (1 : ℕ)) := + (⟨A.length + m, + id + (Decidable.byContradiction + fun (a : ¬A.length + m < T.length - (1 : ℕ) + (1 : ℕ)) ↦ by omega)⟩ : + Fin (B.length + (1 : ℕ))); + let jnext : Fin (B.length + (1 : ℕ)) := + (⟨A.length + (m + (1 : ℕ)), + id + (Decidable.byContradiction + fun (a : ¬A.length + (m + (1 : ℕ)) < T.length - (1 : ℕ) + (1 : ℕ)) ↦ by + omega)⟩ : + Fin (B.length + (1 : ℕ))); + let tnext : Fin T.length := + (⟨A.length + m, + Decidable.byContradiction fun (a : ¬A.length + m < T.length) ↦ by omega⟩ : + Fin T.length); + alpha ∈ MissingColors G P.coloring (B.vertex jm) → + ∀ theta ∈ MissingColors G P.coloring (B.vertex jnext), + (∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ MissingColors G S.coloring (B.vertex jnext), + c ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length)) → + m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jnext), + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jm), + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k), + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + a ∈ + R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta → + eta ∈ MissingColors G R.coloring (B.vertex jm) → + R.coloring (T.edge tnext) ≠ some a → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some a) → + alpha ∈ + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → + m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch1872Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + (∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), + U.vertex j ∈ TreeSequenceVertexSet U) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) + (j : Fin (B.length + (1 : ℕ))), + c ∈ MissingColors G R.coloring (B.vertex j) → + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (X : TreeSequence G e0), + TreeSequenceInitialSegment A X → + A.length < X.length → + TreeSequenceInitialSegment X B → + ∀ (a b eta : Fin k), + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta → + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length → + ∀ (jb : Fin (B.length + (1 : ℕ))), + A.length < (↑jb : ℕ) → + (↑jb : ℕ) ≤ X.length → + b ∈ MissingColors G R.coloring (B.vertex jb) → + a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) ∨ + b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some a) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → S.coloring (T.edge t) = R.coloring (T.edge t)) ∧ + (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ + (b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + a ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length)))) → + (∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount), + eta ∈ + HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ + a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a) → + ∀ (m : ℕ) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), + ∀ (hm : (2 : ℕ) ≤ m) (hmT : A.length + (m + (1 : ℕ)) < T.length), + let X : TreeSequence G e0 := + TreeSequencePrefix T (A.length + (m + (1 : ℕ))) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ A.length + (m + (1 : ℕ))) ↦ by omega) + (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment A X → + TreeSequenceInitialSegment X B → + A.length < X.length → + let jm : Fin (B.length + (1 : ℕ)) := + (⟨A.length + m, + id + (Decidable.byContradiction + fun (a : ¬A.length + m < T.length - (1 : ℕ) + (1 : ℕ)) ↦ by omega)⟩ : + Fin (B.length + (1 : ℕ))); + let jnext : Fin (B.length + (1 : ℕ)) := + (⟨A.length + (m + (1 : ℕ)), + id + (Decidable.byContradiction + fun (a : ¬A.length + (m + (1 : ℕ)) < T.length - (1 : ℕ) + (1 : ℕ)) ↦ by + omega)⟩ : + Fin (B.length + (1 : ℕ))); + let tnext : Fin T.length := + (⟨A.length + m, + Decidable.byContradiction fun (a : ¬A.length + m < T.length) ↦ by omega⟩ : + Fin T.length); + alpha ∈ MissingColors G P.coloring (B.vertex jm) → + ∀ theta ∈ MissingColors G P.coloring (B.vertex jnext), + (∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ MissingColors G S.coloring (B.vertex jnext), + c ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length)) → + m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jnext), + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jm), + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k), + eta ∈ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + a ∈ + R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta → + eta ∈ MissingColors G R.coloring (B.vertex jnext) → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some a) → + theta ∈ + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → + m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch1894Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (∀ (psi : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G psi → + ∀ (B : Finset V), + ColoredVertexSetElementary G psi B → + ∀ (u v w : V), + u ∈ B → + v ∈ B → + u ≠ v → + w ≠ u → + w ≠ v → + a ∈ MissingColors G psi u → + b ∈ MissingColors G psi v → + a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = + TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) + (TwoColorComponent G psi a b (Sum.inl u)) ∧ + TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, + MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = + MissingColors G psi x) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = + A) → + TreeSequenceInitialSegment A T → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment B T → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = + B) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → + (∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), + U.vertex j ∈ TreeSequenceVertexSet U) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) + (j : Fin (B.length + (1 : ℕ))), + c ∈ MissingColors G R.coloring (B.vertex j) → + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) + (j : Fin (B.length + (1 : ℕ))), + A.length < (↑j : ℕ) → + c ∈ MissingColors G R.coloring (B.vertex j) → c ∉ TreeMissingColors R.coloring A) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∉ TreeMissingColors R.coloring A, + c ∉ + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + c ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + ∀ (m : ℕ) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + alpha ∈ + MissingColors G P.coloring + ((HierarchyFullTailPrefix C m).vertex + (Fin.last (HierarchyFullTailPrefix C m).length)), + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) → + ∀ (hm : (2 : ℕ) ≤ m) (hmT : A.length + (m + (1 : ℕ)) < T.length), + let X : TreeSequence G e0 := + TreeSequencePrefix T (A.length + (m + (1 : ℕ))) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ A.length + (m + (1 : ℕ))) ↦ by + omega) + (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) ≤ T.length) ↦ by + omega); + let jm : Fin (B.length + (1 : ℕ)) := + (⟨A.length + m, + id + (Decidable.byContradiction + fun (a : ¬A.length + m < T.length - (1 : ℕ) + (1 : ℕ)) ↦ by omega)⟩ : + Fin (B.length + (1 : ℕ))); + let jnext : Fin (B.length + (1 : ℕ)) := + (⟨A.length + (m + (1 : ℕ)), + id + (Decidable.byContradiction + fun (a : ¬A.length + (m + (1 : ℕ)) < T.length - (1 : ℕ) + (1 : ℕ)) ↦ by + omega)⟩ : + Fin (B.length + (1 : ℕ))); + alpha ∈ MissingColors G P.coloring (B.vertex jm) → + ∀ theta ∈ MissingColors G P.coloring (B.vertex jnext), + (∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ MissingColors G S.coloring (B.vertex jnext), + c ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length)) → + m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx) → + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jm), + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) + (T.edge t) ∧ + b ∈ + TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + alpha ∉ + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → + theta ∉ + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → + m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + +/-- Typed data construction shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperKF3658.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [inst : Fintype V] → + [inst_1 : Fintype E] → + [inst_2 : DecidableEq V] → + [inst_3 : DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (alpha : Fin k) → + let mu : PartialEdgeColoring E k := P.coloring; + (hlenT : (3 : ℕ) ≤ T.length) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by + omega) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ + if e = f then some alpha else mu e; + (positiveB : + (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) → + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun + (a : + ¬P.corresponding.replacementETT.rounds < + P.corresponding.replacementETT.rounds + + (2 : ℕ)) ↦ + by omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))) + B) → + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + have _ : (1 : ℕ) ≤ T.length := + T.positive; + Decidable.byContradiction + fun + (a : + ¬P.corresponding.replacementETT.rounds < + P.corresponding.replacementETT.rounds + + (2 : ℕ)) ↦ + by omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))).length < + B.length) → + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last + (P.corresponding.replacementETT.rounds + + (1 : ℕ))))) → + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last + P.corresponding.replacementETT.rounds)) → + (baseB : + HierarchyBase + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput B + mu } + mu) → + (HB : + TashkinovHierarchy + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput B + mu } + baseB) → + let EB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput B + mu := + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput B + mu }; + (corr : + CorrespondingExtendedTashkinovTree G k + e0 EB sigma B) → + (bs : + HierarchyBase corr.replacementETT + sigma) → + HB.stage + (0 : + Fin + (HB.dividerCount + + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc → + HB.stage + (Fin.last + (HB.dividerCount + + (1 : ℕ))) = + B → + (∀ + (j : + Fin + (HB.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HB.stage j.castSucc) + (HB.stage j.succ)) → + (∀ + (j : + Fin + (HB.dividerCount + + (1 : ℕ))), + (HB.stage + j.castSucc).length < + (HB.stage + j.succ).length) → + TreeSequenceInitialSegment + bs.core + (HB.stage + (⟨(1 : ℕ), + have _ : + (1 : ℕ) ≤ + T.length := + T.positive; + have _ : + (1 : ℕ) ≤ + B.length := + B.positive; + Decidable.byContradiction + fun + (a : + ¬(1 : ℕ) < + HB.dividerCount + + (2 : + ℕ)) ↦ + by omega⟩ : + Fin + (HB.dividerCount + + (2 : ℕ)))) → + (positiveK : + ∀ + (i : + Fin + HB.dividerCount), + (1 : ℕ) ≤ + (↑(HB.dividerPosition + i) : + ℕ)) → + (∀ + (i j : + Fin + HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition + i) : + ℕ) < + (↑(HB.dividerPosition + j) : + ℕ)) → + (∀ + (i : + Fin + HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + + (1 : ℕ), + have _ : + (1 : ℕ) ≤ + T.length := + T.positive; + have _ : + (1 : ℕ) ≤ + B.length := + B.positive; + Decidable.byContradiction + fun + (a : + ¬(↑i : + ℕ) + + (1 : + ℕ) < + HB.dividerCount + + (2 : + ℕ)) ↦ + by + omega⟩ : + Fin + (HB.dividerCount + + (2 : + ℕ))) = + TreeSequencePrefix + B + (↑(HB.dividerPosition + i) : + ℕ) + (positiveK i) + (have _ : + (1 : ℕ) ≤ + T.length := + T.positive; + have _ : + (1 : ℕ) ≤ + B.length := + B.positive; + Decidable.byContradiction + fun + (a : + ¬(↑(HB.dividerPosition + i) : + ℕ) ≤ + B.length) ↦ + by omega)) → + TashkinovHierarchy + corr.replacementETT + bs := by + classical + intro V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx P alpha mu hlenT B r f + sigma positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK + exact { + dividerCount := + HB.dividerCount, + stage := HB.stage, + baseStage := + baseStageK, + terminalStage := + terminalStageK, + nested := nestedK, + strict := strictK, + dividerPosition := + HB.dividerPosition, + dividerPositive := + positiveK, + dividerIncreasing := + increasingK, + dividerStage := + dividerStageK, + coreInsideFirst := + coreInsideK : + TashkinovHierarchy + corr.replacementETT + bs }; + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperUniqueRefresh4523Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (missingFixed : ∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun + (a : + ¬P.corresponding.replacementETT.rounds < + P.corresponding.replacementETT.rounds + (2 : ℕ)) ↦ + by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun + (a : + ¬P.corresponding.replacementETT.rounds < + P.corresponding.replacementETT.rounds + (2 : ℕ)) ↦ + by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) < HB.dividerCount + (2 : ℕ)) ↦ by omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction fun (a : ¬(↑i : ℕ) + (1 : ℕ) < HB.dividerCount + (2 : ℕ)) ↦ by + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction fun (a : ¬(↑(HB.dividerPosition i) : ℕ) ≤ B.length) ↦ by + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + helperKF3658 G k e0 input T phi ett base C ctx P alpha hlenT positiveB aboveB strictB belowB + generatingB baseB HB corr bs baseStageK terminalStageK nestedK strictK coreInsideK positiveK + increasingK dividerStageK; + ∀ + (starredEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) + (stageBX : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HB.stage j.castSucc) X) + (storedEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) + (i : Fin KF.dividerCount), + ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt KF i.succ ∧ + (goodB.gamma i.succ eta ⊆ + (TreeSequenceVertexSet (KF.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt KF i.succ, + theta ≠ eta → goodB.gamma i.succ theta = goodB.gamma i.castSucc theta + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperParallelBase4547Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hp : HierarchyPathNumber H = HierarchyPathNumber C.hierarchy) (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + ∀ (hTnX : TreeSequenceInitialSegment Tn X), + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ + (missingTree : + ∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) + (minusEq : + ∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + ∀ (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun + (a : + ¬P.corresponding.replacementETT.rounds < + P.corresponding.replacementETT.rounds + (2 : ℕ)) ↦ + by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun + (a : + ¬P.corresponding.replacementETT.rounds < + P.corresponding.replacementETT.rounds + (2 : ℕ)) ↦ + by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) + (closureBX : + EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) + (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) + (hpe : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) < HB.dividerCount + (2 : ℕ)) ↦ by omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction fun (a : ¬(↑i : ℕ) + (1 : ℕ) < HB.dividerCount + (2 : ℕ)) ↦ + by omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction fun (a : ¬(↑(HB.dividerPosition i) : ℕ) ≤ B.length) ↦ by + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + helperKF3658 G k e0 input T phi ett base C ctx P alpha hlenT positiveB aboveB strictB belowB + generatingB baseB HB corr bs baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK; + ∀ + (terminalTree : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn) + (storedEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j), + let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last corr.replacementETT.rounds; + let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; + corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma bs.closure : Finset (Fin k)) \ + (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperSameLast4591Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {a b : ℕ} + (s : Fin (a + (2 : ℕ)) → TreeSequence G e0) (t : Fin (b + (2 : ℕ)) → TreeSequence G e0) + (u v : TreeSequence G e0), + a = b → + s ≍ t → + u = v → + (Fin.cases u (fun (i : Fin a) ↦ s i.castSucc.succ) (Fin.last a) : TreeSequence G e0) = + (Fin.cases v (fun (i : Fin b) ↦ t i.castSucc.succ) (Fin.last b) : TreeSequence G e0) + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation5341Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (hpathLower : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hp : HierarchyPathNumber H = HierarchyPathNumber C.hierarchy) + (hpUpper : HierarchyPathNumber H < T.length - A.length) (htail : (2 : ℕ) ≤ T.length - A.length) + (trans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) + (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); + ∀ (hBlength : B.length = T.length - (1 : ℕ)) (hXlength : X.length = T.length - (2 : ℕ)) + (hBT : TreeSequenceInitialSegment B T) (hXB : TreeSequenceInitialSegment X B) + (hTnX : TreeSequenceInitialSegment Tn X), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + ∀ + (consecutive : + ∀ (t : Fin T.length) (ht : A.length + HierarchyPathNumber H ≤ (↑t : ℕ)), + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) + (hyf : Incident G y f) (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length) (beta : Fin k) + (hbetaF : mu f = some beta) (z : V) (hzB : z ∈ TreeSequenceVertexSet B) + (hbetaz : beta ∈ MissingColors G mu z) (hzy : z ≠ y) (hzX : z ∈ TreeSequenceVertexSet X) + (hab : alpha ≠ beta), + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (fixed : ∀ (e : E) (hef : e ≠ f), sigma e = mu e) + (missingFixed : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet X), + MissingColors G sigma v = MissingColors G mu v) + (fixedB : ∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) + (missingTree : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U) + (minusEq : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) + (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R) + (lastPositive : + ∀ (hq : H.dividerCount ≠ (0 : ℕ)), + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (hcountB : HB.dividerCount = H.dividerCount) + (hstagesB : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HB.stage j.castSucc = H.stage (Fin.cast (by omega) j).castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H (Fin.cast (by omega) j)) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) + (closureBX : + ∀ (hpe : EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) + (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (hmaximum : MaximumProperty corr.replacementETT) + (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) + (hpe : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (starredEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) + (stageBX : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) X) + (starBX : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceVertexSet (HierarchyStarredStage HB j) ⊆ TreeSequenceVertexSet X) + (allStageB : + ∀ (j : Fin (HB.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (HB.stage j) B) + (terminalTree : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn) + (terminalStored : + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors EB.series.data (Fin.last EB.rounds)), + False + +/-- Dependent contract shared by the eligible-index bound proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation5697Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (hpathLower : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hp : HierarchyPathNumber H = HierarchyPathNumber C.hierarchy) + (hpUpper : HierarchyPathNumber H < T.length - A.length) (htail : (2 : ℕ) ≤ T.length - A.length) + (trans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) + (chain : + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) + (coreA : TreeSequenceInitialSegment P.replacementBase.core A) + (hTnA : TreeSequenceInitialSegment Tn A) (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); + ∀ (hBlength : B.length = T.length - (1 : ℕ)) (hXlength : X.length = T.length - (2 : ℕ)) + (hBT : TreeSequenceInitialSegment B T) (hAX : TreeSequenceInitialSegment A X) + (hXB : TreeSequenceInitialSegment X B) (hTnX : TreeSequenceInitialSegment Tn X) + (hAB : TreeSequenceInitialSegment A B), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + let w : V := T.vertex (Fin.last T.length); + ∀ + (consecutive : + ∀ (t : Fin T.length) (ht : A.length + HierarchyPathNumber H ≤ (↑t : ℕ)), + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) + (hends : G.ends f = s(y, w)) (hyf : Incident G y f) (S : TreeSequence G e0) + (hSBlen : S.length ≤ B.length) (beta : Fin k) (hbetaF : mu f = some beta) (z : V) + (hzB : z ∈ TreeSequenceVertexSet B) (hbetaz : beta ∈ MissingColors G mu z) (hzy : z ≠ y) + (hzX : z ∈ TreeSequenceVertexSet X) (hab : alpha ≠ beta), + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (fixed : ∀ (e : E) (hef : e ≠ f), sigma e = mu e) (hsproper : IsProperEdgeColoring G sigma) + (hsone : IsOneEdgeUncolored sigma e0) + (incidentFixed : ∀ (e : E) (he : TreeIncidentEdge X e), sigma e = mu e) + (missingFixed : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet X), + MissingColors G sigma v = MissingColors G mu v) + (fixedB : ∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) + (stable : + StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) + (P.corresponding.replacementETT.series.data.coloring n) sigma) + (hrouteB : + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = ({ edge } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ TashkinovAugmentationSequence sigma seed B) + (missingTree : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U), + False + +theorem helper_coreA_200.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + (∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) + (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + TreeSequenceInitialSegment P.replacementBase.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A trans chain + by_cases hq : H.dividerCount = 0 + · have he : A = P.replacementBase.core := by + simp [A, HierarchyStarredStage, hq, Fin.last] + rw [he] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have he : A = H.stage ⟨H.dividerCount, by omega⟩ := by + unfold A HierarchyStarredStage + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) + · have hv := congrArg Fin.val hz + simp only [Fin.val_last, Fin.val_zero] at hv + contradiction + · rw [hi] + simp only [Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simp only [Fin.val_last, Fin.val_succ] at hv + exact hv.symm + rw [he] + exact trans H.coreInsideFirst (chain H.dividerCount (by omega) ⟨1, by omega⟩ + (by change 1 ≤ H.dividerCount; omega)) + +theorem helper_hsproper_329.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + alpha ∈ MissingColors G mu (B.vertex (Fin.last B.length)) → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + let w : V := T.vertex (Fin.last T.length); + G.ends f = s(y, w) → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), e ≠ f → sigma e = mu e) → + IsProperEdgeColoring G sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha haT mu trans hlenT B halphaB r f y + w hends sigma fixed e g c heg hadj he hg + by_cases hef : e = f + · subst e + have hgf : g ≠ f := heg.symm + have hc : c = alpha := by simpa [sigma] using he.symm + subst c + rw [fixed g hgf] at hg + obtain ⟨v, hvf, hvg⟩ := hadj + have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf + rcases hv with rfl | rfl + · exact (Finset.mem_sdiff.mp halphaB).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) + · exact (Finset.mem_sdiff.mp haT).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) + · by_cases hgf : g = f + · subst g + have hc : c = alpha := by simpa [sigma] using hg.symm + subst c + rw [fixed e hef] at he + obtain ⟨v, hve, hvf⟩ := hadj + have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf + rcases hv with rfl | rfl + · exact (Finset.mem_sdiff.mp halphaB).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) + · exact (Finset.mem_sdiff.mp haT).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) + · exact P.minimumContext.proper heg hadj ((fixed e hef).symm.trans he) + ((fixed g hgf).symm.trans hg) + +theorem helper_hdata_519.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = HierarchyPathNumber C.hierarchy → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) + (P.corresponding.replacementETT.series.data.coloring n) sigma → + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B ∨ + (P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ + TashkinovAugmentationSequence sigma seed B) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)), + MaximumProperty + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } → + ∀ + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (bs : HierarchyBase corr.replacementETT sigma) (K : + TashkinovHierarchy corr.replacementETT bs), SameHierarchyStages HB K := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp trans hlenT B X r + f S hSBlen sigma hsproper hsone incidentFixed missingFixed stable hrouteB positiveB aboveB + strictB belowB generatingB hmaxB baseB HB EB closureBX + by_cases hpe : EB.series.data.kind (Fin.last EB.rounds) = + some TashkinovExtensionKind.PE + · have hb : TashkinovAugmentationSequence sigma Tn B := by + rcases hrouteB with h | h + · exact h.2 + · rcases h.1 with h | h <;> rw [hpe] at h <;> cases h + have hcomb : CombinedStableColoring Tn baseB.closure + (TashkinovStoredColors EB.series.data (Fin.last EB.rounds)) mu sigma := by + refine ⟨?_, ?_⟩ + · have hh := stable + change StableColoring Tn + (TashkinovStoredColors EB.series.data (Fin.last EB.rounds)) + (P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) sigma at hh + rw [← P.corresponding.replacementETT.generatingColoring] at hh + exact hh + · refine ⟨?_, ?_⟩ + · intro edge he _ + obtain ⟨v, hv, hi⟩ := he + exact incidentFixed edge ⟨v, closureBX hpe hv, hi⟩ + · intro v hv + exact missingFixed v (closureBX hpe hv) + exact HierarchySplitter G k e0 P.corresponding.replacementInput B mu sigma EB + hmaxB old.positive P.minimumContext.lowerRung baseB HB hpe + P.minimumContext.proper P.minimumContext.oneEdgeUncolored hsproper hsone hcomb hb + · have hmodB := Td G k e0 P.corresponding.replacementInput B mu EB hmaxB + old.positive P.minimumContext.lowerRung sigma hsproper hsone stable + obtain ⟨corr⟩ := hmodB.2.2 B aboveB strictB hrouteB + have hmaximum := MaximumPropertyTransport G k e0 EB sigma hmodB B corr hmaxB + have terminalTree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ + have hj : j.succ = Fin.last EB.rounds := Fin.ext (by + dsimp [j]; have := EB.roundsPositive; omega) + change rs.data.tree (Fin.last EB.rounds).castSucc = + EB.series.data.tree (Fin.last EB.rounds).castSucc + rw [← hj] + exact hl j + have terminalKind : corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = EB.series.data.kind (Fin.last EB.rounds) := by + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + exact hk _ + let bs : HierarchyBase corr.replacementETT sigma := { + core := baseB.core + closure := baseB.closure + supportPosition := Fin.cast (congrArg (fun U : TreeSequence G e0 => U.length + 1) + terminalTree.symm) baseB.supportPosition + supportPositive := baseB.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only + intro hp + exact (hpe (terminalKind.symm.trans hp)).elim + nonparallel := by + dsimp only + intro _ + exact (baseB.nonparallel hpe).trans terminalTree.symm } + let K : TashkinovHierarchy corr.replacementETT bs := { + dividerCount := HB.dividerCount + stage := HB.stage + baseStage := HB.baseStage.trans terminalTree.symm + terminalStage := HB.terminalStage + nested := HB.nested + strict := HB.strict + dividerPosition := HB.dividerPosition + dividerPositive := HB.dividerPositive + dividerIncreasing := HB.dividerIncreasing + dividerStage := HB.dividerStage + coreInsideFirst := HB.coreInsideFirst } + refine ⟨corr, hmaximum, bs, K, rfl, rfl, heq_of_eq rfl, heq_of_eq rfl, ?_, ?_⟩ + · exact ⟨fun h => (hpe h).elim, fun h => (hpe (terminalKind.symm.trans h)).elim⟩ + · intro _; rfl + +theorem helper_terminalStored_647.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = HierarchyPathNumber C.hierarchy → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma), + baseB.core = bs.core → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) → + ∀ + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HB.stage ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.stage → + HB.dividerPosition ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.dividerPosition → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn → + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f + S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr + hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ + have hj : j.succ = Fin.last EB.rounds := Fin.ext (by + dsimp [j]; have := EB.roundsPositive; omega) + have ht : rs.data.tree (Fin.last EB.rounds).castSucc = Tn := by + change rs.data.tree (Fin.last EB.rounds).castSucc = + EB.series.data.tree (Fin.last EB.rounds).castSucc + rw [← hj]; exact hl j + have hm : TreeMissingColors (rs.data.coloring (Fin.last EB.rounds)) + (rs.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by + rw [← hc, ht] + exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX) + have hmOld : TreeMissingColors (EB.series.data.coloring (Fin.last EB.rounds)) + (EB.series.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by + rw [← EB.generatingColoring] + change TashkinovStoredColors rs.data (Fin.last EB.rounds) = + TashkinovStoredColors EB.series.data (Fin.last EB.rounds) + simp only [TashkinovStoredColors, hstored, hm, hmOld] + +theorem helper_hpS_844.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = HierarchyPathNumber C.hierarchy → + HierarchyPathNumber H < T.length - A.length → + (2 : ℕ) ≤ T.length - A.length → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment B T → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + (∀ (t : Fin T.length), + A.length + HierarchyPathNumber H ≤ (↑t : ℕ) → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) → + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length) (beta : Fin k), + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + Decidable.byContradiction + fun (a : ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ by omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HierarchyStarredStage KF (Fin.last KF.dividerCount) = A → + HierarchyPathNumber KF ≤ HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hpathLower P alpha old H A mu hp hpUpper + htail hlenT B hBT r f consecutive S hSBlen beta hab sigma lastPositive positiveB aboveB + strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK + coreInsideK positiveK increasingK dividerStageK KF lastStar + let candidates := (Finset.Icc 1 (B.length - A.length)).filter fun i => + ∀ t : Fin B.length, A.length + i ≤ t.val → + G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) + have hm : HierarchyPathNumber H ∈ candidates := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨by omega, by + dsimp [B, TreeSequencePrefix] + omega⟩, ?_⟩ + intro t ht + rw [← hBT.2.2 t] + have hc := consecutive (Fin.castLE hBT.1 t) ht + have hv1 : (Fin.castLE hBT.1 t).castSucc = + Fin.castLE (Nat.succ_le_succ hBT.1) t.castSucc := Fin.ext rfl + have hv2 : (Fin.castLE hBT.1 t).succ = + Fin.castLE (Nat.succ_le_succ hBT.1) t.succ := Fin.ext rfl + rw [hv1, hv2, hBT.2.1 t.castSucc, hBT.2.1 t.succ] at hc + exact hc + have hn : candidates.Nonempty := ⟨HierarchyPathNumber H, hm⟩ + unfold HierarchyPathNumber + dsimp only + rw [lastStar] + change (if h : candidates.Nonempty then candidates.min' h else B.length - A.length) ≤ _ + rw [dite_eq_left hn] + exact Finset.min'_le candidates _ hm + +theorem helper_chain_775.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) + (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H trans j + induction j with + | zero => + intro hj i hi + have he : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have he : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) (H.nested ⟨j, by omega⟩) + +theorem helper_consecutive_852.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + HierarchyPathNumber H < T.length - A.length → + (3 : ℕ) ≤ T.length → + ∀ (t : Fin T.length), + A.length + HierarchyPathNumber H ≤ (↑t : ℕ) → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A hpUpper hlenT t ht + let candidates := (Finset.Icc 1 (T.length - A.length)).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + have hp' : HierarchyPathNumber H = + (if h : candidates.Nonempty then candidates.min' h else T.length - A.length) := rfl + have hn : candidates.Nonempty := by + by_contra hn + rw [dite_eq_right hn] at hp' + omega + have hm : candidates.min' hn = HierarchyPathNumber H := by + simpa only [dite_eq_left hn] using hp'.symm + have hc := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + rw [hm] at hc + exact hc t ht + +theorem helper_noInc_930.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + X.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment X T → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + let w : V := T.vertex (Fin.last T.length); + T.vertex r.castSucc = y → + G.ends f = s(y, w) → + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + ∀ (beta : Fin k), + alpha ≠ beta → + ∀ v ∈ TreeSequenceVertexSet X, + ¬Incident G v f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha trans hlenT B X hXlength hXT r f y + w hy hends S hSBlen beta hab v hv + obtain ⟨j, hj⟩ : ∃ j, X.vertex j = v := by simpa [TreeSequenceVertexSet] using hv + intro hi + have hv' : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hi + rcases hv' with he | he + · have hh := T.vertex_injective ((hXT.2.1 j).trans (hj.trans (he.trans hy.symm))) + have hh := congrArg Fin.val hh + have hj := j.isLt + change j.val = T.length - 1 at hh + change j.val < X.length + 1 at hj + omega + · have hh := T.vertex_injective ((hXT.2.1 j).trans (hj.trans he)) + have hh := congrArg Fin.val hh + have hj := j.isLt + change j.val = T.length at hh + change j.val < X.length + 1 at hj + omega + +theorem helper_hrouteB_979.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + B.length = T.length - (1 : ℕ) → + X.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment B T → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + TreeSequenceInitialSegment X B → + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length), + TashkinovAugmentationSequence mu S T → + TreeSequenceInitialSegment + (TreeSequencePrefix T (↑r : ℕ) + (le_trans S.positive + (id + (Eq.mp + (congrArg (LE.le S.length) + (congrArg TreeSequence.length + (TreeSequencePrefix.eq_1 T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ + by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ + by omega)))) + hSBlen))) + (Nat.le_of_lt r.isLt)) + (TreeSequencePrefix T ((↑r : ℕ) + (1 : ℕ)) (by omega) (Nat.succ_le_of_lt r.isLt)) → + ∀ (beta : Fin k), + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + (∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) → + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ TashkinovAugmentationSequence sigma seed B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu trans hlenT B X hBlength + hXlength hBT common hXB hTnX r f S hSBlen hseq hpre beta hab sigma missingFixed fixedB + rcases P2813_T1_TerminalRoute G k e0 P.corresponding.replacementInput T mu + P.corresponding.replacementETT with ⟨hpe, hseq⟩ | + ⟨hkind, edge, seed, hedges, hseed, hincident, hcontrol, hseq⟩ + · have hpre := TashkinovAugmentationSequenceRestrict mu Tn B T hseq + (trans hTnX hXB) hBT + exact Or.inl ⟨hpe, TashkinovAugmentationSequenceColoringTransport mu sigma + Tn X B hpre hXB (by omega) (fun t _ => fixedB t) missingFixed⟩ + · have hseedLen : seed.length = Tn.length + 1 := hseed.1 + have hseedB := common + (TashkinovAugmentationSequenceInitialSegment mu seed T hseq) hBT + (by have := hTnX.1; omega) + have hpre := TashkinovAugmentationSequenceRestrict mu seed B T hseq hseedB hBT + exact Or.inr ⟨hkind, edge, seed, hedges, hseed, + TashkinovAugmentationSequenceColoringTransport mu sigma seed X B hpre hXB + (by omega) (fun t _ => fixedB t) missingFixed⟩ + +theorem helper_terminalTree_1110.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = HierarchyPathNumber C.hierarchy → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma), + baseB.core = bs.core → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) → + ∀ + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HB.stage ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.stage → + HB.dividerPosition ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.dividerPosition → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B r f S + hSBlen sigma positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore + hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK + dividerStageK KF hstage hposition starredEq + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ + have hj : j.succ = Fin.last EB.rounds := Fin.ext (by + dsimp [j]; have := EB.roundsPositive; omega) + change rs.data.tree (Fin.last EB.rounds).castSucc = + EB.series.data.tree (Fin.last EB.rounds).castSucc + rw [← hj] + exact hl j + +theorem helper_firstEq_1174.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + B.length = T.length - (1 : ℕ) → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (_ : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + (∀ (j : Fin (B.length + (1 : ℕ))), + (↑j : ℕ) < B.length → + MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j)) → + (∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (B.length + (1 : ℕ))), + c ∈ MissingColors G psi (B.vertex j) → + (↑(HierarchyFirstMissingPosition psi B c) : ℕ) ≤ (↑j : ℕ)) → + (∀ (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi B c) : ℕ) < B.length → + c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c))) → + ∀ (c : Fin k), + HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B hBlength r f S hSBlen + sigma positiveB aboveB strictB belowB generatingB baseB HB earlyMissing firstLe firstMem c + apply Fin.ext + apply Nat.le_antisymm + · by_contra hn + have hlt : (HierarchyFirstMissingPosition mu B c).val < B.length := by + have := (HierarchyFirstMissingPosition sigma B c).isLt + omega + have hm := firstMem mu c hlt + rw [← earlyMissing _ hlt] at hm + have := firstLe sigma c _ hm + omega + · by_contra hn + have hlt : (HierarchyFirstMissingPosition sigma B c).val < B.length := by + have := (HierarchyFirstMissingPosition mu B c).isLt + omega + have hm := firstMem sigma c hlt + rw [earlyMissing _ hlt] at hm + have := firstLe mu c _ hm + omega + +theorem helper_hpUpper_1652.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → + HierarchyPathNumber H = HierarchyPathNumber C.hierarchy → + HierarchyPathNumber H < T.length - A.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hpathUpper P old H A hAold hp + rw [hp] + have hh := hpathUpper + unfold HierarchyFullTailLength at hh + dsimp only at hh + rw [hAold] at hh + exact hh + +theorem helper_trans_1665.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z := by + classical + intro V E G e0 X Y Z hXY hYZ + refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +theorem helper_hTnCore_1684.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + TreeSequenceInitialSegment Tn P.replacementBase.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P n Tn + by_cases hpe : P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.PE + · exact (P.replacementBase.parallel hpe).2.2.some.leftSegment + · rw [P.replacementBase.nonparallel hpe] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + +theorem helper_common_1702.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U := by + classical + intro V E G e0 trans S U W hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +theorem helper_hfull_1715.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → + (2 : ℕ) ≤ T.length - A.length → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)) = B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A hAold htail hlenT B + have hnum : min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + + (HierarchyFullTailLength C - 1)) T.length = T.length - 1 := by + unfold HierarchyFullTailLength + dsimp only + rw [hAold] + omega + simp only [HierarchyFullTailPrefix, hnum] + rfl + +theorem helper_hsource_1746.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + X.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment Tn X → + ∃ (S : TreeSequence G e0), + S.length ≤ B.length ∧ TashkinovAugmentationSequence mu S T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P n Tn mu hlenT B X hBlength hXlength hTnX + rcases P2813_T1_TerminalRoute G k e0 P.corresponding.replacementInput T mu + P.corresponding.replacementETT with ⟨hpe, hseq⟩ | + ⟨hkind, edge, seed, hedges, hseed, hincident, hcontrol, hseq⟩ + · exact ⟨Tn, by have := hTnX.1; omega, hseq⟩ + · have hseedLen : seed.length = Tn.length + 1 := hseed.1 + exact ⟨seed, by have := hTnX.1; omega, hseq⟩ + +theorem helper_hzy_1763.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + Incident G y f → + ∀ (beta : Fin k), + mu f = some beta → + ∀ z ∈ TreeSequenceVertexSet B, + beta ∈ MissingColors G mu z → + z ≠ y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B r f y hyf beta hbetaF z hzB + hbetaz he + subst z + have hnot : beta ∉ MissingColors G mu y := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + exact fun h => h (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hyf, hbetaF⟩) + exact hnot hbetaz + +theorem helper_hzX_1770.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + X.length = T.length - (2 : ℕ) → + let y : V := B.vertex (Fin.last B.length); + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + ∀ z ∈ TreeSequenceVertexSet B, + z ≠ y → + z ∈ TreeSequenceVertexSet X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P trans hlenT B X hBlength hXlength y S + hSBlen z hzB hzy + obtain ⟨j, hj⟩ : ∃ j, B.vertex j = z := by simpa [TreeSequenceVertexSet] using hzB + have hjlt : j.val < B.length := by + by_contra hh + have he : j = Fin.last B.length := Fin.ext + (by simpa using Nat.le_antisymm (Nat.le_of_lt_succ j.isLt) (Nat.le_of_not_gt hh)) + exact hzy (hj.symm.trans (congrArg B.vertex he)) + let jX : Fin (X.length + 1) := ⟨j.val, by omega⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨jX, hj⟩ + +theorem helper_hfe0_1788.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + ∀ (beta : Fin k), + alpha ≠ beta → + f ≠ e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha trans hlenT B r f S hSBlen beta hab he + have hh := T.edge_injective (he.trans T.first_edge.symm) + have hv := congrArg Fin.val hh + dsimp [r] at hv + omega + +theorem helper_hsone_1794.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), e ≠ f → sigma e = mu e) → + f ≠ e0 → + IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT r f sigma fixed hfe0 + refine ⟨?_, ?_⟩ + · rw [fixed e0 hfe0.symm] + exact P.minimumContext.oneEdgeUncolored.1 + · intro e he + by_cases hef : e = f + · subst e; exact ⟨alpha, by simp [sigma]⟩ + · rw [fixed e hef] + exact P.minimumContext.oneEdgeUncolored.2 e he + +theorem helper_missingFixed_1810.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → + ∀ v ∈ TreeSequenceVertexSet X, + MissingColors G sigma v = MissingColors G mu v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT X r f sigma + incidentFixed v hv + unfold MissingColors PresentColors + congr 1 + ext c + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + constructor <;> rintro ⟨e, hi, hc⟩ + · exact ⟨e, hi, (incidentFixed e ⟨v, hv, hi⟩).symm.trans hc⟩ + · exact ⟨e, hi, (incidentFixed e ⟨v, hv, hi⟩).trans hc⟩ + +theorem helper_fixedB_2088.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), e ≠ f → sigma e = mu e) → + ∀ (t : Fin B.length), + sigma (B.edge t) = mu (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B hBlength hBT r f S + hSBlen sigma fixed t + apply fixed + intro he + have hh := T.edge_injective ((hBT.2.2 t).trans he) + have hh := congrArg Fin.val hh + have ht := t.isLt + change t.val = T.length - 1 at hh + omega + +theorem helper_stable_2096.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) + (P.corresponding.replacementETT.series.data.coloring n) sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT X hTnX r f sigma + incidentFixed missingFixed + rw [← P.corresponding.replacementETT.generatingColoring] + refine ⟨?_, ?_⟩ + · intro e he _ + obtain ⟨v, hv, hi⟩ := he + exact incidentFixed e ⟨v, TreeSequenceInitialSegmentVertexSetSubset hTnX hv, hi⟩ + · intro v hv + exact missingFixed v (TreeSequenceInitialSegmentVertexSetSubset hTnX hv) + +theorem helper_boundaryEq_2121.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + let w : V := T.vertex (Fin.last T.length); + G.ends f = s(y, w) → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → + ∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + ∀ (c : Fin k), + BoundaryColorEdges G sigma (TreeSequenceVertexSet U) c = + BoundaryColorEdges G mu (TreeSequenceVertexSet U) c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f y w hends sigma + incidentFixed U hUX c + apply Finset.filter_congr + intro edge he + obtain ⟨u, hu, v, hv, hends⟩ := by simpa [BoundaryEdges] using he + have hi : TreeIncidentEdge X edge := + ⟨u, hUX hu, by rw [Incident, hends]; exact Sym2.mem_mk_left _ _⟩ + rw [incidentFixed edge hi] + +theorem helper_lastPositive_2137.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length), + H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A hlenT B S hSBlen hq + unfold A HierarchyStarredStage + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) + · exact (hq (by simpa using congrArg Fin.val hz)).elim + · rw [hi] + simp only [Fin.cases_succ] + congr 1 + exact Fin.ext (by simpa using (congrArg Fin.val hi).symm) + +theorem helper_ordinaryA_2146.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + (∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) + (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + TreeSequenceInitialSegment Tn A → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length), + (H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A n Tn chain hTnA hlenT B S hSBlen + lastPositive j + by_cases hq : H.dividerCount = 0 + · have hj : j = 0 := Fin.ext (by have := j.isLt; omega) + subst j + simpa only [Fin.castSucc_zero, H.baseStage] using hTnA + · rw [lastPositive hq] + exact chain H.dividerCount (by omega) j.castSucc + (by change j.val ≤ H.dividerCount; have := j.isLt; omega) + +theorem helper_closureBX_2180.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X → + EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B X positiveB aboveB strictB + belowB generatingB baseB EB coreBX hpe + obtain ⟨union⟩ := (baseB.parallel hpe).2.2 + intro v hv + apply coreBX + rw [union.vertexSet] + exact Finset.mem_union_right _ hv + +theorem helper_stageMissingEq_2235.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) X) → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn → + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma + missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF stageBX + terminalTree j + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma + (corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) = + TreeMissingColors mu Tn + rw [terminalTree] + exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX) + · exact missingTree _ (TreeSequenceInitialSegmentVertexSetSubset (stageBX i.succ)) + +theorem helper_earlyMissing_2244.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + X.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment X B → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length) (beta : Fin k), + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + (H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (_ : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (j : Fin (B.length + (1 : ℕ))), + (↑j : ℕ) < B.length → + MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B X hBlength + hXlength hXB r f S hSBlen beta hab sigma missingFixed lastPositive positiveB aboveB strictB + belowB generatingB baseB HB j hj + let i : Fin (X.length + 1) := ⟨j.val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hXB.1) i = j := Fin.ext rfl + apply missingFixed + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, by rw [← he, hXB.2.1 i]⟩ + +theorem helper_firstLe_2252.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (B.length + (1 : ℕ))), + c ∈ MissingColors G psi (B.vertex j) → + (↑(HierarchyFirstMissingPosition psi B c) : ℕ) ≤ (↑j : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hlenT B psi c j hj + let candidates := Finset.univ.filter fun j : Fin (B.length + 1) => + c ∈ MissingColors G psi (B.vertex j) + have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ + have hn : candidates.Nonempty := ⟨j, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates j hm + +theorem helper_firstMem_2262.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (_ : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi B c) : ℕ) < B.length → + c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B hBlength S hSBlen positiveB + aboveB strictB belowB generatingB baseB HB psi c hlt + let candidates := Finset.univ.filter fun j : Fin (B.length + 1) => + c ∈ MissingColors G psi (B.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hh : (HierarchyFirstMissingPosition psi B c).val = B.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + +theorem helper_segmentEq_2283.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + (∀ (c : Fin k), + HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c) → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (t : Fin (HB.stage j.succ).length), + sigma ((HB.stage j.succ).edge t) = mu ((HB.stage j.succ).edge t)) → + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (c : Fin k), + HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B r f sigma + positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK + nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq firstEq + stageFixed j c + unfold HierarchySegmentColors + dsimp only + rw [starredEq j, firstEq c] + apply Finset.filter_congr + intro d _ + constructor <;> rintro ⟨r, hlo, hhi, hcol⟩ + · exact ⟨r, hlo, hhi, (stageFixed j r).symm.trans hcol⟩ + · exact ⟨r, hlo, hhi, (stageFixed j r).trans hcol⟩ + +theorem helper_branch_2341.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) → + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + bs.closure = baseB.closure → + (4 : ℕ) ≤ + ((TreeMissingColors mu + ({ rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.tree + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds).castSucc) ∩ + TreeMissingColors mu baseB.closure : + Finset (Fin k)) \ + (HierarchyStoredColorsAt HB (0 : Fin (HB.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (HB.dividerCount + (1 : ℕ))))).card → + (4 : ℕ) ≤ + ((TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma bs.closure : + Finset (Fin k)) \ + (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma + missingTree positiveB aboveB strictB belowB generatingB baseB HB goodB EB closureBX corr bs + baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK + KF terminalTree storedEq hpB hcl hcard + change 4 ≤ ((TreeMissingColors sigma + (corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma bs.closure) \ + (HierarchyStoredColorsAt KF 0).biUnion (goodB.gamma 0)).card + rw [terminalTree, hcl, storedEq 0, + missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX), + missingTree baseB.closure (closureBX hpB)] + exact hcard + +theorem helper_hbetaY_2355.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = HierarchyPathNumber C.hierarchy → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + Incident G y f → + ∀ (beta : Fin k), + mu f = some beta → + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), e ≠ f → sigma e = mu e) → + beta ∈ MissingColors G sigma y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H mu hp trans hlenT B r f y hyf + beta hbetaF hab sigma fixed + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + intro hp + obtain ⟨edge, hi, hc⟩ := (Finset.mem_filter.mp hp).2 + by_cases hef : edge = f + · subst edge + have he : alpha = beta := by simpa [sigma] using hc + exact hab he + · have hcOld : mu edge = some beta := (fixed edge hef).symm.trans hc + exact P.minimumContext.proper hef ⟨y, hi, hyf⟩ hcOld hbetaF + +theorem helper_hnotElementary_2365.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + ∀ (beta : Fin k), + ∀ z ∈ TreeSequenceVertexSet B, + beta ∈ MissingColors G mu z → + z ≠ y → + z ∈ TreeSequenceVertexSet X → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + beta ∈ MissingColors G sigma y → + ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f y beta z hzB + hbetaz hzy hzX sigma missingFixed hbetaY he + have hbetazS : beta ∈ MissingColors G sigma z := by rw [missingFixed z hzX]; exact hbetaz + have hyB : y ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last B.length, rfl⟩ + exact Finset.disjoint_left.mp (he hzB hyB hzy) hbetazS hbetaY + +theorem helper_lastStar_2378.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (hcountB : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HB.stage j.castSucc = + H.stage + (Fin.cast + (by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega) + j).castSucc ∧ + HierarchyStarredStage HB j = + HierarchyStarredStage H + (Fin.cast + (by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega) + j)) → + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := TreeSequence.positive T + have := TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + HierarchyStarredStage KF (Fin.last KF.dividerCount) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B r f sigma + positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq + rw [starredEq] + have hh := (hstagesB (Fin.last HB.dividerCount)).2 + have hi : Fin.cast (congrArg (fun q => q + 1) hcountB) + (Fin.last HB.dividerCount) = Fin.last H.dividerCount := + Fin.ext hcountB + simpa only [hi] using hh + +theorem helper_lastOrdinary_2387.{u_1, u_2} : + helperLastOrdinary2387Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H mu hlenT B positiveB aboveB strictB + belowB generatingB baseB HB hcountB hstagesB + have hh := (hstagesB (Fin.last HB.dividerCount)).1 + have hi : Fin.cast (congrArg (fun q => q + 1) hcountB) + (Fin.last HB.dividerCount) = Fin.last H.dividerCount := + Fin.ext hcountB + simpa only [hi] using hh + +theorem helper_uniqueRefresh_4523.{u_1, u_2} : + helperUniqueRefresh4523Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f sigma missingFixed + positiveB aboveB strictB belowB generatingB baseB HB goodB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq + stageBX storedEq i + have hnew : + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun v => MissingColors G mu v) := by + apply Finset.biUnion_congr rfl + intro v hv + exact missingFixed v (TreeSequenceInitialSegmentVertexSetSubset (stageBX i.succ) + (Finset.mem_sdiff.mp hv).1) + change ∃! c : Fin k, + c ∈ HierarchyStoredColorsAt KF i.succ ∧ + goodB.gamma i.succ c ⊆ + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion + fun v => MissingColors G sigma v) ∧ + ∀ d ∈ HierarchyStoredColorsAt KF i.succ, d ≠ c → + goodB.gamma i.succ d = goodB.gamma i.castSucc d + rw [starredEq i.castSucc, hnew] + simp only [storedEq] + exact goodB.uniqueRefresh i + +theorem helper_parallelBase_4547.{u_1, u_2} : + helperParallelBase4547Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f + sigma missingTree minusEq positiveB aboveB strictB belowB generatingB baseB HB goodB EB + coreBX closureBX corr bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK + coreInsideK positiveK increasingK dividerStageK KF terminalTree storedEq + dsimp only + intro hp + have hpB := hpe.mpr hp + have hcl : bs.closure = baseB.closure := (hclosure hpB).symm + obtain ⟨hnot, hcard⟩ := goodB.parallelBase hpB + constructor + · change ¬ TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt KF 0).biUnion (goodB.gamma 0)) + rw [← hcore, storedEq 0, minusEq baseB.core coreBX] + exact hnot + · exact helper_branch_2341 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@goodB) (@closureBX) (@corr) (@bs) (@baseStageK) + (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) + (@dividerStageK) (@terminalTree) (@storedEq) (@hpB) (@hcl) (@hcard) + +end EligibleIndexBound + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/EligibleOddSet.lean b/LeanPool/GoldbergSeymour/EligibleOddSet.lean new file mode 100644 index 0000000000..088ab90de2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/EligibleOddSet.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Algebra.Ring.Parity + +public import LeanPool.GoldbergSeymour.Preamble + +/-! +# Eligible Odd Set + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- An odd vertex set with at least three vertices, eligible for the density bound. -/ +def EligibleOddSet {V : Type*} (U : Finset V) : Prop := + 3 ≤ U.card ∧ Odd U.card + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/EmptyCommonMissingLocation.lean b/LeanPool/GoldbergSeymour/EmptyCommonMissingLocation.lean new file mode 100644 index 0000000000..e0ac02f712 --- /dev/null +++ b/LeanPool/GoldbergSeymour/EmptyCommonMissingLocation.lean @@ -0,0 +1,133 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# P2905_T2_Empty Common Missing Location + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2905_T2_EmptyCommonMissingLocation {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hpathLower : 2 ≤ HierarchyPathNumber C.hierarchy) + (hpathUpper : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (hempty : ¬ (HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx).Nonempty) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) + (hc : c ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1))) + (hterm : c ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) : + c ∈ TreeMissingColors P.coloring + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) := by + classical + have common {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by as_aux_lemma => + clear * - hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + let j := HierarchyPathNumber C.hierarchy + let ell := HierarchyFullTailLength C + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + let B := HierarchyFullTailPrefix C (ell - 1) + let I := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + have hAT : TreeSequenceInitialSegment A T := by + have starNext (i : Fin (C.hierarchy.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy i) + (C.hierarchy.stage i.succ) := + Fin.cases C.hierarchy.coreInsideFirst (fun i => C.hierarchy.nested i.succ) i + simpa only [Fin.succ_last, C.hierarchy.terminalStage] using + starNext (Fin.last C.hierarchy.dividerCount) + have htail : 3 ≤ ell := by change j < ell at hpathUpper; change 2 ≤ j at hpathLower; omega + have hell : ell = T.length - A.length := rfl + have prefixLen (r : ℕ) (hr : r ≤ ell) : + (HierarchyFullTailPrefix C r).length = A.length + r := by as_aux_lemma => + change min (A.length + r) T.length = A.length + r + apply Nat.min_eq_left + omega + have prefixT (r : ℕ) : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C r) T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hBLen : B.length = T.length - 1 := by + have := prefixLen (ell - 1) (by omega) + change B.length = A.length + (ell - 1) at this + omega + have hAB : TreeSequenceInitialSegment A B := common hAT (prefixT _) (by omega) + have vertexMem (U : TreeSequence G e0) (i : Fin (U.length + 1)) : + U.vertex i ∈ TreeSequenceVertexSet U := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, rfl⟩ + have eligible + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (i : ℕ) (hi : 1 ≤ i ∧ i ≤ ell - 1) + (hc : c ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (hterm : c ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) : + I.Nonempty := by as_aux_lemma => + refine ⟨i, ?_⟩ + change i ∈ (Finset.Icc 1 (HierarchyFullTailLength C - 1)).filter _ + exact Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr hi, P, c, hc, hterm⟩ + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + obtain ⟨x, hx⟩ : ∃ x, B.vertex x = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hv + by_cases hsmall : x.val ≤ A.length + · let a : Fin (A.length + 1) := ⟨x.val, by omega⟩ + have ha : Fin.castLE (Nat.succ_le_succ hAB.1) a = x := Fin.ext rfl + have hmA : c ∈ MissingColors G P.coloring (A.vertex a) := by + rw [← hAB.2.1 a, ha, hx] + exact hm + exact Finset.mem_biUnion.mpr ⟨A.vertex a, vertexMem A a, hmA⟩ + · let i := x.val - A.length + have hi : 1 ≤ i ∧ i ≤ ell - 1 := by + have := x.isLt + change B.length = T.length - 1 at hBLen + dsimp [i] + omega + have hp := prefixLen i (by omega) + have hcI : c ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length)) := by + rw [← (prefixT i).2.1] + have hidx : Fin.castLE (Nat.succ_le_succ (prefixT i).1) + (Fin.last (HierarchyFullTailPrefix C i).length) = + Fin.castLE (Nat.succ_le_succ (prefixT (ell - 1)).1) x := by + apply Fin.ext + simp only [Fin.val_castLE, Fin.val_last] + rw [hp] + dsimp [i] + omega + rw [hidx, (prefixT (ell - 1)).2.1, hx] + exact hm + exact (hempty (eligible P c i hi hcI hterm)).elim + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtendedTashkinovColoringSequence.lean b/LeanPool/GoldbergSeymour/ExtendedTashkinovColoringSequence.lean new file mode 100644 index 0000000000..a67ab68681 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtendedTashkinovColoringSequence.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +/-! +# Extended Tashkinov Coloring Sequence + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The coloring sequence stored in an extended Tashkinov tree's certified series. -/ +def ExtendedTashkinovColoringSequence {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) : + Fin (ett.rounds + 1) → PartialEdgeColoring E k := + ett.series.data.coloring + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtendedTashkinovLadderStage.lean b/LeanPool/GoldbergSeymour/ExtendedTashkinovLadderStage.lean new file mode 100644 index 0000000000..205c299e5b --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtendedTashkinovLadderStage.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +/-! +# Extended Tashkinov Ladder Stage + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The successive ladder trees, with the given extended tree as the terminal stage. -/ +def ExtendedTashkinovLadderStage {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (i : Fin (ett.rounds + 1)) : + TreeSequence G e0 := + Fin.lastCases T (fun j : Fin ett.rounds => ett.series.data.tree j.succ.castSucc) i + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtendedTashkinovRungNumber.lean b/LeanPool/GoldbergSeymour/ExtendedTashkinovRungNumber.lean new file mode 100644 index 0000000000..ea8a6d732d --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtendedTashkinovRungNumber.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +/-! +# Extended Tashkinov Rung Number + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The number of extension rounds in an extended Tashkinov tree. -/ +def ExtendedTashkinovRungNumber {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) : ℕ := + ett.rounds + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtendedTashkinovTree.lean b/LeanPool/GoldbergSeymour/ExtendedTashkinovTree.lean new file mode 100644 index 0000000000..f800351a31 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtendedTashkinovTree.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeries + +/-! +# Extended Tashkinov Tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A tree lying strictly above the penultimate tree and below the final tree of a certified +extension series. +-/ +structure ExtendedTashkinovTree {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) where + /-- The positive number of extension rounds. -/ + rounds : ℕ + roundsPositive : 1 ≤ rounds + /-- The extension series witnessing this extended tree. -/ + series : TashkinovSeries G k rounds e0 input + abovePenultimate : TreeSequenceInitialSegment (series.data.tree ⟨rounds, by omega⟩) T + strictAbovePenultimate : (series.data.tree ⟨rounds, by omega⟩).length < T.length + belowFinal : TreeSequenceInitialSegment T (series.data.tree (Fin.last (rounds + 1))) + generatingColoring : generating = series.data.coloring (Fin.last rounds) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtendedTashkinovTreePrefix.lean b/LeanPool/GoldbergSeymour/ExtendedTashkinovTreePrefix.lean new file mode 100644 index 0000000000..65f0b99473 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtendedTashkinovTreePrefix.lean @@ -0,0 +1,121 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesFinalETTExists +public import LeanPool.GoldbergSeymour.TashkinovSeriesPrefix + +/-! +# Extended Tashkinov Tree Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtendedTashkinovTreePrefix {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (m : ℕ) (hmPositive : 1 ≤ m) (hmBefore : m < ett.rounds) + (terminalIndex : Fin (ett.rounds + 2)) + (hterminal : terminalIndex.val = m + 1) + (generatingIndex : Fin (ett.rounds + 1)) + (hgenerating : generatingIndex.val = m) : + ∃ restricted : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree terminalIndex) + (ett.series.data.coloring generatingIndex), + ∃ hr : restricted.rounds = m, + (∀ i : Fin (restricted.rounds + 2), + restricted.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) ∧ + (∀ i : Fin (restricted.rounds + 1), + restricted.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + restricted.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + restricted.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + restricted.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + restricted.series.data.chosenVertex i = + ett.series.data.chosenVertex (Fin.castLE (by omega) i) ∧ + restricted.series.data.outsideVertex i = + ett.series.data.outsideVertex (Fin.castLE (by omega) i) ∧ + restricted.series.data.delta i = + ett.series.data.delta (Fin.castLE (by omega) i) ∧ + restricted.series.data.gamma i = + ett.series.data.gamma (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors restricted.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i) ∧ + HEq (restricted.series.certified i) + (ett.series.certified (Fin.castLE (by omega) i))) := by + classical + obtain ⟨restrictedSeries, hdata, hcert⟩ := + TashkinovSeriesPrefix G k ett.rounds e0 input ett.series m (by omega) + have htreeDisplay : + restrictedSeries.data.tree (Fin.last (m + 1)) = + ett.series.data.tree terminalIndex := by + rw [hdata] + simp only [TashkinovSeriesDataPrefix] + congr 1 + apply Fin.ext + simpa using hterminal.symm + have hcolorDisplay : + restrictedSeries.data.coloring (Fin.last m) = + ett.series.data.coloring generatingIndex := by + rw [hdata] + simp only [TashkinovSeriesDataPrefix] + congr 1 + apply Fin.ext + simpa using hgenerating.symm + have hfinal := TashkinovSeriesFinalETTExists G k m e0 input + restrictedSeries (by omega) + rw [htreeDisplay, hcolorDisplay] at hfinal + obtain ⟨restricted, hr, hseries⟩ := hfinal + cases hr + have hseriesEq : restricted.series = restrictedSeries := + eq_of_heq hseries + cases hseriesEq + refine ⟨restricted, rfl, ?_, ?_⟩ + · intro i + rw [hdata] + rfl + · intro i + have hcolor := congrArg (fun d => d.coloring i) hdata + have hstored := congrArg (fun d => d.stored i) hdata + have hedges := congrArg (fun d => d.connectingEdges i) hdata + have hkind := congrArg (fun d => d.kind i) hdata + have hchosen := congrArg (fun d => d.chosenVertex i) hdata + have houtside := congrArg (fun d => d.outsideVertex i) hdata + have hdelta := congrArg (fun d => d.delta i) hdata + have hgamma := congrArg (fun d => d.gamma i) hdata + simp only [TashkinovSeriesDataPrefix] at hcolor hstored hedges hkind hchosen + have houtside' : restricted.series.data.outsideVertex i = + ett.series.data.outsideVertex (Fin.castLE (by omega) i) := by + simpa only [TashkinovSeriesDataPrefix] using houtside + have hdelta' : restricted.series.data.delta i = + ett.series.data.delta (Fin.castLE (by omega) i) := by + simpa only [TashkinovSeriesDataPrefix] using hdelta + have hgamma' : restricted.series.data.gamma i = + ett.series.data.gamma (Fin.castLE (by omega) i) := by + simpa only [TashkinovSeriesDataPrefix] using hgamma + refine ⟨hcolor, hstored, hedges, hkind, hchosen, houtside', hdelta', + hgamma', ?_, hcert i⟩ + rw [hdata] + exact TashkinovStoredColorsPrefix restricted.rounds (by omega) + ett.series.data i + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBase.lean b/LeanPool/GoldbergSeymour/ExtensionBase.lean new file mode 100644 index 0000000000..621ebaf89e --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBase.lean @@ -0,0 +1,152 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseBranchLemmas + +import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary + +/-! +# Extension Base + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open ExtensionBaseProof + +theorem ExtensionBase {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + ∀ (v : V) (gamma delta : Fin k), + ett.series.data.kind n = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex n = some v → + ett.series.data.gamma n = some gamma → + ett.series.data.delta n = some delta → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring Tn + (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma → + ∀ w, w ∈ TreeSequenceVertexSet Tn → + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) ↔ w = v) := by + classical + dsimp + intro v gamma delta hterminalKind hterminalVertex hterminalGamma + hterminalDelta sigma hsigmaProper hsigmaOne hsigmaStable w hw + constructor + · intro hwComponent + apply of_not_not + intro hwNe + let : DecidableEq V := Classical.decEq V + have hcurrentIII := ExtensionRules G k e0 input T generating ett hMP + hpositive (fun lower hlowerPositive hlowerRounds hlowerMP => + hlower lower hlowerPositive hlowerRounds hlowerMP) + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hqTerminal : q.val + 1 = ett.rounds := by + simp only [q] + omega + have hqSucc : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simpa using hqTerminal + have hqKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE := by + rw [hqSucc] + exact hterminalKind + have hqVertex : ett.series.data.chosenVertex q.succ = some v := by + rw [hqSucc] + exact hterminalVertex + have hqGamma : ett.series.data.gamma q.succ = some gamma := by + rw [hqSucc] + exact hterminalGamma + have hqDelta : ett.series.data.delta q.succ = some delta := by + rw [hqSucc] + exact hterminalDelta + have hvStage : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + exact ett.pe_chosenVertex_mem_previousTree q v hqKind hqVertex + have hqTreeIndex : q.succ.castSucc = + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simpa using hqTerminal + have hvFinal := @helper_hvFinal_2051 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hvStage) (@hqTreeIndex) + have hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ q.val + 1 := + ExtensionRulesPEFirstAppearanceBound G k e0 input T generating ett q v + hqKind hqVertex hvFinal + have hfirstPositive : 0 < ETTFirstAppearanceIndex ett v hvFinal := by + unfold ETTFirstAppearanceIndex + dsimp + omega + let jSlot : Fin ett.rounds := + ⟨ETTFirstAppearanceIndex ett v hvFinal - 1, by omega⟩ + have hjSlot : jSlot.val + 1 = + ETTFirstAppearanceIndex ett v hvFinal := by + simp only [jSlot] + omega + have hjle : jSlot.val ≤ q.val := by omega + have hsigmaTerminal : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma := by + simpa [hqSucc] using hsigmaStable + have hcurrentTerminal := hcurrentIII.1 q v hqKind hqVertex hvFinal + jSlot.castSucc (by simpa using hjSlot.symm) sigma hsigmaProper hsigmaOne + hsigmaTerminal + have hsigmaBefore := hcurrentTerminal.1 + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans := @helper_segmentTrans_2087 (@V) (@E) (@G) (@e0) + have stepSegment := @helper_stepSegment_2099 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + have stageToStage := @helper_stageToStage_226 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentRefl) (@segmentTrans) + (@stepSegment) + have vertexTransfer := @helper_vertexTransfer_2114 (@V) (@E) (@G) (@e0) + have orderRestrict := @helper_orderRestrict_1438 (@V) (@E) (@G) (@e0) + have hLowerElementary := @helper_hLowerElementary_277 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) + (@hpositive) (@hlower) (@v) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + have hLowerPartV := @helper_hLowerPartV_179 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@stepSegment) + (@stageToStage) (@vertexTransfer) (@orderRestrict) + have hsupportOrder := ExtensionBaseSupportOrder ett v hvFinal q hqTerminal + hqKind hqVertex hLowerPartV + have hdeltaExclusion := ExtensionBaseDeltaExclusion ett v hvFinal q + hqTerminal hqKind hqVertex jSlot hjSlot hLowerElementary hLowerPartV + have hpairOverlap := ExtensionBaseStoredPairOverlap G k e0 input T + generating ett v hvFinal q hqTerminal hqKind hqVertex jSlot hjSlot hMP + hpositive hLowerElementary hLowerPartV + (fun lower hlowerPositive hlowerRounds hlowerMP => + hlower lower hlowerPositive hlowerRounds hlowerMP) + exact @helper_caseContinuation_13733 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hsigmaProper) (@hsigmaOne) (@w) (@hw) + (@hwComponent) (@hwNe) (@hqTerminal) (@hqSucc) (@hqKind) (@hqVertex) (@hqGamma) + (@hqDelta) (@hvStage) (@hqTreeIndex) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@hjSlot) (@hjle) (@hsigmaTerminal) (@hsigmaBefore) (@segmentTrans) (@stepSegment) + (@stageToStage) (@vertexTransfer) (@hsupportOrder) (@hdeltaExclusion) (@hpairOverlap) + · exact @helper_branch_4837 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@v) (@gamma) (@delta) (@sigma) (@w) (@hw) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseActiveIndices.lean b/LeanPool/GoldbergSeymour/ExtensionBaseActiveIndices.lean new file mode 100644 index 0000000000..f1e5df7d4c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseActiveIndices.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex + +/-! +# Extension Base Active Indices + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Parallel-extension indices at or after the terminal support's first appearance whose supports +appeared no later. +-/ +noncomputable def ExtensionBaseActiveIndices {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) : Finset (Fin ett.rounds) := by + classical + let j := ETTFirstAppearanceIndex ett terminalSupport hterminalSupport + exact Finset.univ.filter fun s => + j ≤ s.val + 1 ∧ + ett.series.data.kind s.succ = some TashkinovExtensionKind.PE ∧ + ∃ v : V, ∃ hv : v ∈ TreeSequenceVertexSet T, + ett.series.data.chosenVertex s.succ = some v ∧ + ETTFirstAppearanceIndex ett v hv ≤ j + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmA.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmA.lean new file mode 100644 index 0000000000..096bb754c1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmA.lean @@ -0,0 +1,127 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmAInduction +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmATraceExists +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimMissingColors +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimStrongInterchangeable + +public import LeanPool.GoldbergSeymour.ExtensionBaseStoredPairOverlap + +/-! +# Extension Base Algorithm A + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseAlgorithmA {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot q : Fin ett.rounds) (sigmaN : PartialEdgeColoring E k) + (_ : q.val + 1 = ett.rounds) + (_ : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE) + (hqVertex : ett.series.data.chosenVertex q.succ = + some terminalSupport) + (_ : jSlot.val + 1 = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) + (hsigmaProper : IsProperEdgeColoring G sigmaN) + (hsigmaOne : IsOneEdgeUncolored sigmaN e0) + (hterminalBefore : ∀ (t : Fin ett.rounds) (vt : V), + t ∈ ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport → + ett.series.data.chosenVertex t.succ = some vt → + TreeVertexOrder T terminalSupport vt) + (hjInitial : ∀ t : Fin ett.rounds, + t ∈ ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport → + TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree t.succ.castSucc)) + (hslotData : ∀ t : Fin ett.rounds, + t ∈ ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport → + ∃ vt : V, ∃ gammaT deltaT : Fin k, + ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ + ett.series.data.delta t.succ = some deltaT) + (hinitialSI : ∀ (t : Fin ett.rounds) (vt : V) + (gammaT deltaT : Fin k), + t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + t ≠ q → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → + ETTStrongInterchangeable ett t vt sigmaN gammaT deltaT) + (hclassMissing : ∀ (w : V) (t : Fin ett.rounds) (deltaT : Fin k), + ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ⊆ + ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport → + t ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w → + (∀ s : Fin ett.rounds, + s ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w → + s.val ≤ t.val) → + ett.series.data.delta t.succ = some deltaT → + MissingColors G sigmaN w ∩ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport w).biUnion + (fun s => ett.series.data.stored s.succ) = {deltaT}) + (hpairOverlap : ∀ (s t : Fin ett.rounds) (vs vt : V) + (gammaS deltaS gammaT deltaT : Fin k), + s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → + t ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → + s.val < t.val → + ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → + ((({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT}).Nonempty ↔ + vs = vt ∧ + ¬ ∃ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport vs ∧ + s.val < r.val ∧ r.val < t.val ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ + ((({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT}).Nonempty → + ({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT} = + {gammaT} ∧ + ({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT} = + {deltaS})) : + ∃ trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN, + ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace := by + classical + obtain ⟨trace⟩ := ExtensionBaseAlgorithmATraceExists ett terminalSupport + hterminalSupport sigmaN hslotData + have hcolorState := ExtensionBaseAlgorithmAColorState ett terminalSupport + hterminalSupport q sigmaN hqVertex trace hinitialSI hclassMissing + hpairOverlap + refine ⟨trace, ?_⟩ + exact ExtensionBaseAlgorithmAInduction ett terminalSupport hterminalSupport + jSlot q sigmaN hqVertex hsigmaProper hsigmaOne hterminalBefore hjInitial + hinitialSI hpairOverlap trace hcolorState + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAColorState.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAColorState.lean new file mode 100644 index 0000000000..c23e6a8225 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAColorState.lean @@ -0,0 +1,877 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable + +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace + +/-! +# Extension Base Algorithm AColor State + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_stored_pair_128.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (sigmaN : PartialEdgeColoring E k) + (trace : ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), + let _ : DecidableEq V := Classical.decEq V; + let A : Finset (Fin ett.rounds) := + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport; + ∀ (_ : (∀ (a : Fin trace.steps), trace.slot a ∈ A)) (a : Fin trace.steps), + ett.series.data.stored (trace.slot a).succ = + (insert (trace.gamma a) ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace + this A slot_active a + have ha := slot_active a + simp only [A, ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at ha + have hkind := ha.2.1 + have cert := ett.series.certified (trace.slot a).succ + generalize hj : (trace.slot a).succ = j at cert + cases cert with + | initial => simp_all + | SE => simp_all + | RE => simp_all + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = trace.slot a := by + apply Fin.ext + have := congrArg Fin.val hj + simp at this ⊢ + omega + subst i + have hg : gamma = trace.gamma a := by + apply Option.some.inj + exact currentGamma.symm.trans (trace.gammaField a) + have hd : choice.color = trace.delta a := by + apply Option.some.inj + exact currentDelta.symm.trans (trace.deltaField a) + simpa [hg, hd, Finset.pair_comm] using currentStored + +private theorem helper_pair_relation_217.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN) (_ : ( + ∀ (s t : Fin ett.rounds) (vs vt : V) (gammaS deltaS gammaT deltaT : Fin k) (_ : s ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport) (_ : t ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport) (_ : (↑s : ℕ) < (↑t : ℕ)) + (_ : ett.series.data.chosenVertex s.succ = some vs) (_ : ett.series.data.chosenVertex + t.succ = some vt) (_ : ett.series.data.gamma s.succ = some gammaS) (_ : + ett.series.data.delta s.succ = some deltaS) (_ : ett.series.data.gamma t.succ = some + gammaT) (_ : ett.series.data.delta t.succ = some deltaT), (((insert gammaS ({ deltaS } : + Finset (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset + (Fin k)) : Finset (Fin k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport vs, (↑s : ℕ) < (↑r : ℕ) ∧ + (↑r : ℕ) < (↑t : ℕ) ∧ ett.series.data.chosenVertex r.succ = some vs) ∧ (((insert gammaS + ({ deltaS } : Finset (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin + k)) : Finset (Fin k)) : Finset (Fin k)).Nonempty → ((insert gammaS ({ deltaS } : Finset + (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)) = ({ gammaT } : Finset (Fin k)) ∧ ((insert gammaS ({ deltaS } : + Finset (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset + (Fin k)) : Finset (Fin k)) = ({ deltaS } : Finset (Fin k))))), + let L : Finset (Fin ett.rounds) := ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport; + let A : Finset (Fin ett.rounds) := ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport; + let S : V → Finset (Fin ett.rounds) := ExtensionBaseSupportClass ett terminalSupport + hterminalSupport; + ∀ (_ : ( + ∀ (a : Fin trace.steps), trace.slot a ∈ A)) (_ : ( + ∀ (a : Fin trace.steps), S (trace.support a) ⊆ L)) (_ : ( + ∀ {a b : Fin trace.steps} (_ : (↑a : ℕ) < (↑b : ℕ)) {r : Fin ett.rounds} (_ : r ∈ L) (_ : + (↑(trace.slot b) : ℕ) < (↑r : ℕ)) (_ : (↑r : ℕ) < (↑(trace.slot a) : ℕ)), + ∃ (c : Fin trace.steps), (↑a : ℕ) < (↑c : ℕ) ∧ (↑c : ℕ) < (↑b : ℕ) ∧ trace.slot c = r)) (a b : + Fin trace.steps) (_ : (↑a : ℕ) < (↑b : ℕ)), (((insert (trace.gamma b) ({trace.delta b} : + Finset (Fin k)) : Finset (Fin k)) ∩ (insert (trace.gamma a) ({trace.delta a} : Finset (Fin + k)) : Finset (Fin k)) : Finset (Fin k)).Nonempty ↔ trace.support b = trace.support a ∧ ¬ + ∃ (c : Fin trace.steps), (↑a : ℕ) < (↑c : ℕ) ∧ (↑c : ℕ) < (↑b : ℕ) ∧ trace.support c = + trace.support a) ∧ (((insert (trace.gamma b) ({trace.delta b} : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert (trace.gamma a) ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty → ((insert (trace.gamma b) ({trace.delta b} : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert (trace.gamma a) ({trace.delta a} : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)) = ({trace.gamma a} : Finset (Fin k)) ∧ ((insert (trace.gamma b) + ({trace.delta b} : Finset (Fin k)) : Finset (Fin k)) ∩ (insert (trace.gamma a) + ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)) = ({trace.delta b} + : Finset (Fin k))) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace + hpairOverlap L A S slot_active class_subset index_between a b hab + have hslot := trace.strictlyDescending a b hab + have raw := hpairOverlap (trace.slot b) (trace.slot a) + (trace.support b) (trace.support a) (trace.gamma b) (trace.delta b) + (trace.gamma a) (trace.delta a) (slot_active b) (slot_active a) + hslot (trace.chosenVertex b) (trace.chosenVertex a) + (trace.gammaField b) (trace.deltaField b) (trace.gammaField a) + (trace.deltaField a) + refine ⟨?_, raw.2⟩ + rw [raw.1] + constructor + · rintro ⟨hsupport, hnone⟩ + refine ⟨hsupport, ?_⟩ + rintro ⟨c, hac, hcb, hcs⟩ + apply hnone + refine ⟨trace.slot c, ?_, ?_, ?_, ?_⟩ + · simp only [ExtensionBaseSupportClass, Finset.mem_filter] + exact ⟨slot_active c, by simpa [hcs, hsupport] using trace.chosenVertex c⟩ + · exact trace.strictlyDescending c b hcb + · exact trace.strictlyDescending a c hac + · simpa [hcs, hsupport] using trace.chosenVertex c + · rintro ⟨hsupport, hnone⟩ + refine ⟨hsupport, ?_⟩ + rintro ⟨r, hrClass, hrLow, hrHigh, hrChosen⟩ + have hrL := class_subset b hrClass + rcases index_between hab hrL hrLow hrHigh with ⟨c, hac, hcb, hc⟩ + apply hnone + refine ⟨c, hac, hcb, ?_⟩ + apply Option.some.inj + rw [← trace.chosenVertex c, hc] + simpa [hsupport] using hrChosen + +private theorem helper_root_swap_gamma_missing_299.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} + {k : ℕ} (phi : PartialEdgeColoring E k) (gamma delta : Fin k) (w : V), + gamma ≠ delta → + delta ∈ MissingColors G phi w → + gamma ∈ MissingColors G (TwoColorComponentSwap G phi gamma delta (Sum.inl w)) w := by + classical + intro V E _ _ G k phi gamma delta w hne hdelta + let _ := Fintype.ofFinite V + have hdeltaNot : delta ∉ PresentColors G phi w := + (Finset.mem_sdiff.mp hdelta).2 + rw [MissingColors, Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + rintro ⟨e, heIncident, heColor⟩ + by_cases heComp : Sum.inr e ∈ + TwoColorComponent G phi gamma delta (Sum.inl w) + · unfold TwoColorComponentSwap at heColor + rw [ite_eq_left heComp] at heColor + by_cases heGamma : phi e = some gamma + · rw [ite_eq_left heGamma] at heColor + exact hne (Option.some.inj heColor).symm + · by_cases heDelta : phi e = some delta + · apply hdeltaNot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, heIncident, heDelta⟩ + · rw [ite_eq_right heGamma, ite_eq_right heDelta] at heColor + exact heGamma heColor + · have heGamma : phi e = some gamma := by + simpa [TwoColorComponentSwap, heComp] using heColor + apply heComp + let H := TwoColorIncidenceGraph G phi gamma delta + have hadj : H.Adj (Sum.inl w) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro heIncident (Or.inl heGamma) + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk (Sum.inl w) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm + +private theorem helper_initial_state_338.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN) (_ : ( + ∀ (w : V) (t : Fin ett.rounds) (deltaT : Fin k) (_ : ExtensionBaseSupportClass ett + terminalSupport hterminalSupport w ⊆ ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport) (_ : t ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport + w) (_ : ( + ∀ s ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w, (↑s : ℕ) ≤ (↑t : ℕ))) + (_ : ett.series.data.delta t.succ = some deltaT), (MissingColors G sigmaN w ∩ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport w).biUnion fun (s : Fin + ett.rounds) ↦ ett.series.data.stored s.succ : Finset (Fin k)) = ({ deltaT } : Finset (Fin + k)))), + let _ : DecidableEq V := Classical.decEq V; + let L : Finset (Fin ett.rounds) := ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport; + let S : V → Finset (Fin ett.rounds) := ExtensionBaseSupportClass ett terminalSupport + hterminalSupport; + ∀ (_ : ( + ∀ (a : Fin trace.steps), trace.gamma a ≠ trace.delta a)) (_ : ( + ∀ (a : Fin trace.steps), ett.series.data.stored (trace.slot a).succ = (insert (trace.gamma a) + ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)))) (_ : ( + ∀ (a : Fin trace.steps), S (trace.support a) ⊆ L)) (_ : ( + ∀ (a b : Fin trace.steps) (_ : (↑a : ℕ) < (↑b : ℕ)), (((insert (trace.gamma b) + ({trace.delta b} : Finset (Fin k)) : Finset (Fin k)) ∩ (insert (trace.gamma a) + ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)).Nonempty ↔ + trace.support b = trace.support a ∧ ¬ + ∃ (c : Fin trace.steps), (↑a : ℕ) < (↑c : ℕ) ∧ (↑c : ℕ) < (↑b : ℕ) ∧ trace.support c = + trace.support a) ∧ (((insert (trace.gamma b) ({trace.delta b} : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert (trace.gamma a) ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty → ((insert (trace.gamma b) ({trace.delta b} : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert (trace.gamma a) ({trace.delta a} : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)) = ({trace.gamma a} : Finset (Fin k)) ∧ ((insert (trace.gamma b) + ({trace.delta b} : Finset (Fin k)) : Finset (Fin k)) ∩ (insert (trace.gamma a) + ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)) = ({trace.delta b} + : Finset (Fin k))))) (_ : ( + ∀ (a : Fin trace.steps), trace.slot a ∈ S (trace.support a))) (b : Fin trace.steps), + trace.gamma b ∈ PresentColors G sigmaN (trace.support b) ∧ (( + ∀ (c : Fin trace.steps), (↑c : ℕ) < (↑b : ℕ) → trace.support c ≠ trace.support b) → + trace.delta b ∈ MissingColors G sigmaN (trace.support b)) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace + hclassMissing this L S pair_ne stored_pair class_subset pair_relation slot_class b + let C := Finset.univ.filter fun c : Fin trace.steps => + trace.support c = trace.support b + have hbC : b ∈ C := by simp [C] + let m : Fin trace.steps := C.min' ⟨b, hbC⟩ + have hmC : m ∈ C := Finset.min'_mem C ⟨b, hbC⟩ + have hmSupport : trace.support m = trace.support b := + (Finset.mem_filter.mp hmC).2 + have hmle : m.val ≤ b.val := by + simpa using Finset.min'_le C b hbC + have hmhead : ∀ c : Fin trace.steps, c.val < m.val → + trace.support c ≠ trace.support m := by + intro c hcm hcs + have hcC : c ∈ C := by + simp only [C, Finset.mem_filter, Finset.mem_univ, true_and] + exact hcs.trans hmSupport + have hmc : m.val ≤ c.val := by + simpa using Finset.min'_le C c hcC + omega + have hgreatest : + ∀ s : Fin ett.rounds, s ∈ S (trace.support b) → + s.val ≤ (trace.slot m).val := by + intro s hs + have hsL := class_subset b hs + have hsImage : s ∈ Finset.univ.image trace.slot := by + rw [trace.enumerates] + exact hsL + rcases Finset.mem_image.mp hsImage with ⟨c, -, hc⟩ + have hcsupport : trace.support c = trace.support b := by + have hsChosen := (Finset.mem_filter.mp hs).2 + apply Option.some.inj + rw [← trace.chosenVertex c, hc] + exact hsChosen + rcases lt_trichotomy c.val m.val with hcm | hcm | hmc + · exact False.elim (hmhead c hcm (hcsupport.trans hmSupport.symm)) + · have hceq : c = m := Fin.ext hcm + subst c + exact Nat.le_of_eq (congrArg Fin.val hc.symm) + · have hd := trace.strictlyDescending m c hmc + simpa [hc] using Nat.le_of_lt hd + have hmClass : trace.slot m ∈ S (trace.support b) := by + simpa [hmSupport] using slot_class m + have hinter := + hclassMissing (trace.support b) (trace.slot m) (trace.delta m) + (class_subset b) hmClass hgreatest (trace.deltaField m) + have hgammaUnion : trace.gamma b ∈ + (S (trace.support b)).biUnion + (fun s => ett.series.data.stored s.succ) := by + rw [Finset.mem_biUnion] + refine ⟨trace.slot b, slot_class b, ?_⟩ + rw [stored_pair b] + simp + have hdeltaUnion : trace.delta m ∈ + (S (trace.support b)).biUnion + (fun s => ett.series.data.stored s.succ) := by + rw [Finset.mem_biUnion] + refine ⟨trace.slot m, hmClass, ?_⟩ + rw [stored_pair m] + simp + have hgammaNe : trace.gamma b ≠ trace.delta m := by + intro heq + rcases lt_or_eq_of_le hmle with hmb | hmb + · have rel := pair_relation m b hmb + have hnonempty : (({trace.gamma b, trace.delta b} : + Finset (Fin k)) ∩ {trace.gamma m, trace.delta m}).Nonempty := by + refine ⟨trace.gamma b, ?_⟩ + simp [heq] + have hmem : trace.gamma b ∈ ({trace.delta b} : Finset (Fin k)) := by + rw [← (rel.2 hnonempty).2] + simp [heq] + exact pair_ne b (by simpa using hmem) + · have hmb' : m = b := Fin.ext hmb + rw [hmb'] at heq + exact pair_ne b heq + have hgammaPresent : trace.gamma b ∈ PresentColors G sigmaN + (trace.support b) := by + by_contra hnot + have hmissing : trace.gamma b ∈ MissingColors G sigmaN + (trace.support b) := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + exact hnot + have hmem : trace.gamma b ∈ + MissingColors G sigmaN (trace.support b) ∩ + (S (trace.support b)).biUnion + (fun s => ett.series.data.stored s.succ) := + Finset.mem_inter.mpr ⟨hmissing, hgammaUnion⟩ + rw [hinter] at hmem + exact hgammaNe (by simpa using hmem) + refine ⟨hgammaPresent, ?_⟩ + intro hhead + have hmb : m = b := by + apply Fin.ext + apply Nat.le_antisymm hmle + by_contra hnot + have hlt : m.val < b.val := by omega + exact hhead m hlt hmSupport + rw [hmb] at hinter + have hmem : trace.delta b ∈ + MissingColors G sigmaN (trace.support b) ∩ + (S (trace.support b)).biUnion + (fun s => ett.series.data.stored s.succ) := by + rw [hinter] + simp + exact (Finset.mem_inter.mp hmem).1 + +private theorem helper_branch_463.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ (a : Fin trace.steps), trace.gamma a ≠ trace.delta a)) (_ : ( + ∀ (a b : Fin trace.steps) (_ : (↑a : ℕ) < (↑b : ℕ)), (((insert (trace.gamma b) + ({trace.delta b} : Finset (Fin k)) : Finset (Fin k)) ∩ (insert (trace.gamma a) + ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)).Nonempty ↔ + trace.support b = trace.support a ∧ ¬ + ∃ (c : Fin trace.steps), (↑a : ℕ) < (↑c : ℕ) ∧ (↑c : ℕ) < (↑b : ℕ) ∧ trace.support c = + trace.support a) ∧ (((insert (trace.gamma b) ({trace.delta b} : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert (trace.gamma a) ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty → ((insert (trace.gamma b) ({trace.delta b} : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert (trace.gamma a) ({trace.delta a} : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)) = ({trace.gamma a} : Finset (Fin k)) ∧ ((insert (trace.gamma b) + ({trace.delta b} : Finset (Fin k)) : Finset (Fin k)) ∩ (insert (trace.gamma a) + ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)) = ({trace.delta b} + : Finset (Fin k))))) (_ : ( + ∀ (phi : PartialEdgeColoring E k) (alpha beta c : Fin k) (z : V ⊕ E) (v : V) (_ : c ≠ alpha) + (_ : c ≠ beta), (c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v ↔ c ∈ + PresentColors G phi v))) (_ : ( + ∀ (phi : PartialEdgeColoring E k) (alpha beta c : Fin k) (z : V ⊕ E) (v : V) (_ : c ≠ alpha) + (_ : c ≠ beta), (c ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta z) v ↔ c ∈ + MissingColors G phi v))) (_ : ( + ∀ (phi : PartialEdgeColoring E k) (gamma delta : Fin k) (w : V) (_ : gamma ≠ delta) (_ : delta + ∈ MissingColors G phi w), gamma ∈ MissingColors G (TwoColorComponentSwap G phi gamma delta + (Sum.inl w)) w)) (a : Fin trace.steps) (_ : ( + ∀ (b : Fin trace.steps) (_ : (↑a.castSucc : ℕ) ≤ (↑b : ℕ)), trace.gamma b ∈ PresentColors G + (trace.coloring a.castSucc) (trace.support b) ∧ (( + ∀ (c : Fin trace.steps), (↑a.castSucc : ℕ) ≤ (↑c : ℕ) → (↑c : ℕ) < (↑b : ℕ) → trace.support c + ≠ trace.support b) → trace.delta b ∈ MissingColors G (trace.coloring a.castSucc) + (trace.support b)))) (b : Fin trace.steps) (_ : (↑a.succ : ℕ) ≤ (↑b : ℕ)), trace.gamma b ∈ + PresentColors G (trace.coloring a.succ) (trace.support b) ∧ (( + ∀ (c : Fin trace.steps), (↑a.succ : ℕ) ≤ (↑c : ℕ) → (↑c : ℕ) < (↑b : ℕ) → trace.support c ≠ + trace.support b) → trace.delta b ∈ MissingColors G (trace.coloring a.succ) (trace.support + b)) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace + this pair_ne pair_relation swap_present_iff swap_missing_iff root_swap_gamma_missing a ih b + hab + have hab' : a.val < b.val := by + change a.val + 1 ≤ b.val at hab + omega + have old := ih b (by + change a.val ≤ b.val + omega) + have rel := pair_relation a b hab' + have hgammaOutside : trace.gamma b ≠ trace.gamma a ∧ + trace.gamma b ≠ trace.delta a := by + constructor <;> intro heq + · have hnonempty : (({trace.gamma b, trace.delta b} : + Finset (Fin k)) ∩ {trace.gamma a, trace.delta a}).Nonempty := by + refine ⟨trace.gamma b, ?_⟩ + simp [heq] + have hmem : trace.gamma b ∈ + ({trace.delta b} : Finset (Fin k)) := by + rw [← (rel.2 hnonempty).2] + simp [heq] + exact pair_ne b (by simpa using hmem) + · have hnonempty : (({trace.gamma b, trace.delta b} : + Finset (Fin k)) ∩ {trace.gamma a, trace.delta a}).Nonempty := by + refine ⟨trace.gamma b, ?_⟩ + simp [heq] + have hmem : trace.gamma b ∈ + ({trace.delta b} : Finset (Fin k)) := by + rw [← (rel.2 hnonempty).2] + simp [heq] + exact pair_ne b (by simpa using hmem) + have hgammaNext : trace.gamma b ∈ + PresentColors G (trace.coloring a.succ) (trace.support b) := by + rw [trace.transition a] + exact (swap_present_iff (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (trace.gamma b) + (Sum.inl (trace.support a)) (trace.support b) + hgammaOutside.1 hgammaOutside.2).mpr old.1 + refine ⟨hgammaNext, ?_⟩ + intro hhead + by_cases hsupport : trace.support b = trace.support a + · have hnone : ¬ ∃ c : Fin trace.steps, + a.val < c.val ∧ c.val < b.val ∧ + trace.support c = trace.support a := by + rintro ⟨c, hac, hcb, hcs⟩ + exact hhead c (by change a.val + 1 ≤ c.val; omega) hcb + (hcs.trans hsupport.symm) + have hnonempty : (({trace.gamma b, trace.delta b} : + Finset (Fin k)) ∩ {trace.gamma a, trace.delta a}).Nonempty := by + rw [rel.1] + exact ⟨hsupport, hnone⟩ + have hchain : trace.gamma a = trace.delta b := by + have hsingle : ({trace.gamma a} : Finset (Fin k)) = + {trace.delta b} := (rel.2 hnonempty).1.symm.trans + (rel.2 hnonempty).2 + simpa using hsingle + have hcurrent := ih a (le_refl a.val) + have hdeltaA : trace.delta a ∈ + MissingColors G (trace.coloring a.castSucc) (trace.support a) := by + apply hcurrent.2 + intro c hac hca + change a.val ≤ c.val at hac + omega + have hgammaAfter := root_swap_gamma_missing + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (trace.support a) (pair_ne a) hdeltaA + rw [trace.transition a] + simpa [hsupport, hchain] using hgammaAfter + · have hheadOld : + ∀ c : Fin trace.steps, a.val ≤ c.val → c.val < b.val → trace.support c ≠ trace.support b := by + intro c hac hcb hcs + by_cases hca : c = a + · subst c + exact hsupport hcs.symm + · apply hhead c + · change a.val + 1 ≤ c.val + omega + · exact hcb + · exact hcs + have hdeltaOld := old.2 hheadOld + have hinterEmpty : + ({trace.gamma b, trace.delta b} : Finset (Fin k)) ∩ + {trace.gamma a, trace.delta a} = ∅ := by + apply Finset.not_nonempty_iff_eq_empty.mp + rw [rel.1] + simp [hsupport] + have hdeltaOutside : trace.delta b ≠ trace.gamma a ∧ + trace.delta b ≠ trace.delta a := by + constructor <;> intro heq + · have : trace.delta b ∈ + ({trace.gamma b, trace.delta b} : Finset (Fin k)) ∩ + {trace.gamma a, trace.delta a} := by + simp [heq] + rw [hinterEmpty] at this + simp at this + · have : trace.delta b ∈ + ({trace.gamma b, trace.delta b} : Finset (Fin k)) ∩ + {trace.gamma a, trace.delta a} := by + simp [heq] + rw [hinterEmpty] at this + simp at this + rw [trace.transition a] + exact (swap_missing_iff (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (trace.delta b) + (Sum.inl (trace.support a)) (trace.support b) + hdeltaOutside.1 hdeltaOutside.2).mpr hdeltaOld + +private theorem helper_slot_ne_q_673.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (sigmaN : + PartialEdgeColoring E k), ett.series.data.chosenVertex q.succ = some terminalSupport → + ∀ (trace : ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), ( + ∀ (a : Fin trace.steps), trace.support a ≠ terminalSupport) → + ∀ (a : Fin trace.steps), trace.slot a ≠ q := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q sigmaN + hqVertex trace support_ne_terminal a h + apply support_ne_terminal a + apply Option.some.inj + have hcv := trace.chosenVertex a + rw [h] at hcv + exact hcv.symm.trans hqVertex + +private theorem helper_trace_injective_690.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (sigmaN : PartialEdgeColoring E k) + (trace : ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), + Function.Injective trace.slot := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace a b h + apply Fin.ext + by_contra hab + rcases lt_or_gt_of_ne hab with hab | hab + · have hd := trace.strictlyDescending a b hab + rw [h] at hd + exact (Nat.lt_irrefl _ hd) + · have hd := trace.strictlyDescending b a hab + rw [h] at hd + exact (Nat.lt_irrefl _ hd) + +private theorem helper_class_subset_701.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), + let L : Finset (Fin ett.rounds) := ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport; + let _ : Finset (Fin ett.rounds) := ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport; + let S : V → Finset (Fin ett.rounds) := ExtensionBaseSupportClass ett terminalSupport + hterminalSupport; ( + ∀ (a : Fin trace.steps), trace.support a ≠ terminalSupport) → + ∀ (a : Fin trace.steps), S (trace.support a) ⊆ L := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace L A + S support_ne_terminal a s hs + apply Finset.mem_sdiff.mpr + have hsA : s ∈ A := (Finset.mem_filter.mp hs).1 + refine ⟨hsA, ?_⟩ + intro hsTerm + have hsSupport : ett.series.data.chosenVertex s.succ = + some (trace.support a) := (Finset.mem_filter.mp hs).2 + have hsTerminal : ett.series.data.chosenVertex s.succ = + some terminalSupport := (Finset.mem_filter.mp hsTerm).2 + exact support_ne_terminal a (Option.some.inj (hsSupport.symm.trans hsTerminal)) + +private theorem helper_index_between_716.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), + let _ : DecidableEq V := Classical.decEq V; + let L : Finset (Fin ett.rounds) := ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport; + ∀ {a b : Fin trace.steps}, (↑a : ℕ) < (↑b : ℕ) → + ∀ {r : Fin ett.rounds}, r ∈ L → (↑(trace.slot b) : ℕ) < (↑r : ℕ) → (↑r : ℕ) < (↑(trace.slot a) + : ℕ) → + ∃ (c : Fin trace.steps), (↑a : ℕ) < (↑c : ℕ) ∧ (↑c : ℕ) < (↑b : ℕ) ∧ trace.slot c = r := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace + this L a b hab r hrL hlow hhigh + have hrImage : r ∈ Finset.univ.image trace.slot := by + rw [trace.enumerates] + exact hrL + rcases Finset.mem_image.mp hrImage with ⟨c, -, hc⟩ + refine ⟨c, ?_, ?_, hc⟩ + · by_contra hca + have hca' : c.val < a.val ∨ c = a := by + have : c.val ≤ a.val := by omega + exact (lt_or_eq_of_le this).imp_right Fin.ext + rcases hca' with hca' | rfl + · have hd := trace.strictlyDescending c a hca' + rw [hc] at hd + omega + · rw [hc] at hhigh + omega + · by_contra hbc + have hbc' : b.val < c.val ∨ c = b := by + have : b.val ≤ c.val := by omega + exact (lt_or_eq_of_le this).imp_right (fun h => Fin.ext h.symm) + rcases hbc' with hbc' | rfl + · have hd := trace.strictlyDescending b c hbc' + rw [hc] at hd + omega + · rw [hc] at hlow + omega + +private theorem helper_swap_color_iff_763.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {k : ℕ} (phi : + PartialEdgeColoring E k) (alpha beta c : Fin k) (z : V ⊕ E), c ≠ alpha → c ≠ beta → + ∀ (e : E), TwoColorComponentSwap G phi alpha beta z e = some c ↔ phi e = some c := by + classical + intro V E G k phi alpha beta c z hca hcb e + unfold TwoColorComponentSwap + by_cases he : Sum.inr e ∈ TwoColorComponent G phi alpha beta z + · simp only [ite_eq_left he] + by_cases ha : phi e = some alpha + · rw [ite_eq_left ha] + constructor + · intro h + exact False.elim (hcb (Option.some.inj h).symm) + · intro h + exact False.elim (hca (Option.some.inj (ha.symm.trans h)).symm) + · by_cases hb : phi e = some beta + · rw [ite_eq_right ha, ite_eq_left hb] + constructor + · intro h + exact False.elim (hca (Option.some.inj h).symm) + · intro h + exact False.elim (hcb (Option.some.inj (hb.symm.trans h)).symm) + · simp [ha, hb] + · simp [he] + +private theorem helper_state_821.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), ( + ∀ (a : Fin trace.steps), trace.gamma a ≠ trace.delta a) → ( + ∀ (a b : Fin trace.steps), (↑a : ℕ) < (↑b : ℕ) → (((insert (trace.gamma b) ({trace.delta b} : + Finset (Fin k)) : Finset (Fin k)) ∩ (insert (trace.gamma a) ({trace.delta a} : Finset (Fin + k)) : Finset (Fin k)) : Finset (Fin k)).Nonempty ↔ trace.support b = trace.support a ∧ ¬ + ∃ (c : Fin trace.steps), (↑a : ℕ) < (↑c : ℕ) ∧ (↑c : ℕ) < (↑b : ℕ) ∧ trace.support c = + trace.support a) ∧ (((insert (trace.gamma b) ({trace.delta b} : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert (trace.gamma a) ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty → ((insert (trace.gamma b) ({trace.delta b} : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert (trace.gamma a) ({trace.delta a} : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)) = ({trace.gamma a} : Finset (Fin k)) ∧ ((insert (trace.gamma b) + ({trace.delta b} : Finset (Fin k)) : Finset (Fin k)) ∩ (insert (trace.gamma a) + ({trace.delta a} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)) = ({trace.delta b} + : Finset (Fin k)))) → ( + ∀ (phi : PartialEdgeColoring E k) (alpha beta c : Fin k) (z : V ⊕ E) (v : V), c ≠ alpha → c ≠ + beta → (c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v ↔ c ∈ + PresentColors G phi v)) → ( + ∀ (phi : PartialEdgeColoring E k) (alpha beta c : Fin k) (z : V ⊕ E) (v : V), c ≠ alpha → c ≠ + beta → (c ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta z) v ↔ c ∈ + MissingColors G phi v)) → ( + ∀ (phi : PartialEdgeColoring E k) (gamma delta : Fin k) (w : V), gamma ≠ delta → delta ∈ + MissingColors G phi w → gamma ∈ MissingColors G (TwoColorComponentSwap G phi gamma delta + (Sum.inl w)) w) → ( + ∀ (b : Fin trace.steps), trace.gamma b ∈ PresentColors G sigmaN (trace.support b) ∧ (( + ∀ (c : Fin trace.steps), (↑c : ℕ) < (↑b : ℕ) → trace.support c ≠ trace.support b) → + trace.delta b ∈ MissingColors G sigmaN (trace.support b))) → + ∀ (n : Fin (trace.steps + (1 : ℕ))) (b : Fin trace.steps), (↑n : ℕ) ≤ (↑b : ℕ) → trace.gamma b + ∈ PresentColors G (trace.coloring n) (trace.support b) ∧ (( + ∀ (c : Fin trace.steps), (↑n : ℕ) ≤ (↑c : ℕ) → (↑c : ℕ) < (↑b : ℕ) → trace.support c ≠ + trace.support b) → trace.delta b ∈ MissingColors G (trace.coloring n) (trace.support b)) + := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace + pair_ne pair_relation swap_present_iff swap_missing_iff root_swap_gamma_missing + initial_state n + induction n using Fin.induction with + | zero => + intro b hb + have hs := initial_state b + rw [trace.initialColoring] + refine ⟨hs.1, ?_⟩ + intro hhead + apply hs.2 + intro c hcb + exact hhead c (by simp) hcb + | succ a ih => + exact @helper_branch_463 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (by assumption) (@sigmaN) + (@trace) (by assumption) (by assumption) (by assumption) (by assumption) (by + assumption) (@a) (by assumption) + +theorem ExtensionBaseAlgorithmAColorState {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (sigmaN : PartialEdgeColoring E k) + (hqVertex : ett.series.data.chosenVertex q.succ = some terminalSupport) + (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN) + (hinitialSI : ∀ (t : Fin ett.rounds) (vt : V) + (gammaT deltaT : Fin k), + t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + t ≠ q → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → + ETTStrongInterchangeable ett t vt sigmaN gammaT deltaT) + (hclassMissing : ∀ (w : V) (t : Fin ett.rounds) (deltaT : Fin k), + ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ⊆ + ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport → + t ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w → + (∀ s : Fin ett.rounds, + s ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w → + s.val ≤ t.val) → + ett.series.data.delta t.succ = some deltaT → + MissingColors G sigmaN w ∩ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport w).biUnion + (fun s => ett.series.data.stored s.succ) = {deltaT}) + (hpairOverlap : ∀ (s t : Fin ett.rounds) (vs vt : V) + (gammaS deltaS gammaT deltaT : Fin k), + s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → + t ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → + s.val < t.val → + ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → + ((({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT}).Nonempty ↔ + vs = vt ∧ + ¬ ∃ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport vs ∧ + s.val < r.val ∧ r.val < t.val ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ + ((({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT}).Nonempty → + ({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT} = + {gammaT} ∧ + ({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT} = + {deltaS})) : + ∀ a : Fin trace.steps, trace.delta a ∈ MissingColors G (trace.coloring a.castSucc) + (trace.support a) ∧ trace.gamma a ∈ PresentColors G (trace.coloring a.castSucc) + (trace.support a) := by + classical + let : DecidableEq V := Classical.decEq V + let L := ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport + let A := ExtensionBaseActiveIndices ett terminalSupport hterminalSupport + let S := ExtensionBaseSupportClass ett terminalSupport hterminalSupport + have slot_mem (a : Fin trace.steps) : trace.slot a ∈ L := by + change trace.slot a ∈ + ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport + rw [← trace.enumerates] + exact Finset.mem_image.mpr ⟨a, Finset.mem_univ _, rfl⟩ + have slot_active (a : Fin trace.steps) : trace.slot a ∈ A := by + exact (Finset.mem_sdiff.mp (slot_mem a)).1 + have slot_not_terminal_class (a : Fin trace.steps) : + trace.slot a ∉ S terminalSupport := by + exact (Finset.mem_sdiff.mp (slot_mem a)).2 + have support_ne_terminal (a : Fin trace.steps) : + trace.support a ≠ terminalSupport := by + intro h + apply slot_not_terminal_class a + simp only [S, ExtensionBaseSupportClass, Finset.mem_filter] + exact ⟨slot_active a, by simpa [h] using trace.chosenVertex a⟩ + have slot_ne_q := @helper_slot_ne_q_673 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@q) + (@sigmaN) (@hqVertex) (@trace) (@support_ne_terminal) + have pair_ne (a : Fin trace.steps) : trace.gamma a ≠ trace.delta a := by + exact (hinitialSI (trace.slot a) (trace.support a) (trace.gamma a) + (trace.delta a) (slot_active a) (slot_ne_q a) + (trace.chosenVertex a) (trace.gammaField a) (trace.deltaField a)).1 + have stored_pair (a : Fin trace.steps) : + ett.series.data.stored (trace.slot a).succ = + {trace.gamma a, trace.delta a} := by + exact @helper_stored_pair_128 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (by assumption) (@sigmaN) + (@trace) (by assumption) (@a) + have trace_injective := + @helper_trace_injective_690 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@sigmaN) + (@trace) + have class_subset := @helper_class_subset_701 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) + (@sigmaN) (@trace) (@support_ne_terminal) + have support_eq_of_slot_eq {a b : Fin trace.steps} + (h : trace.slot a = trace.slot b) : trace.support a = trace.support b := by + apply Option.some.inj + rw [← trace.chosenVertex a, h, trace.chosenVertex b] + have index_between := @helper_index_between_716 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) + (@hterminalSupport) (@sigmaN) (@trace) + have pair_relation (a b : Fin trace.steps) (hab : a.val < b.val) : + ((({trace.gamma b, trace.delta b} : Finset (Fin k)) ∩ + {trace.gamma a, trace.delta a}).Nonempty ↔ + trace.support b = trace.support a ∧ + ¬ ∃ c : Fin trace.steps, + a.val < c.val ∧ c.val < b.val ∧ + trace.support c = trace.support a) ∧ + ((({trace.gamma b, trace.delta b} : Finset (Fin k)) ∩ + {trace.gamma a, trace.delta a}).Nonempty → + ({trace.gamma b, trace.delta b} : Finset (Fin k)) ∩ + {trace.gamma a, trace.delta a} = {trace.gamma a} ∧ + ({trace.gamma b, trace.delta b} : Finset (Fin k)) ∩ + {trace.gamma a, trace.delta a} = {trace.delta b}) := by + exact @helper_pair_relation_217 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (by assumption) (@sigmaN) + (@trace) (by assumption) (by assumption) (by assumption) (by assumption) (@a) (@b) (by + assumption) + have swap_color_iff := @helper_swap_color_iff_763 (@V) (@E) (@G) (@k) + have swap_present_iff (phi : PartialEdgeColoring E k) + (alpha beta c : Fin k) (z : Sum V E) (v : V) + (hca : c ≠ alpha) (hcb : c ≠ beta) : + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v ↔ + c ∈ PresentColors G phi v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + constructor <;> rintro ⟨e, he, hc⟩ + · exact ⟨e, he, (swap_color_iff phi alpha beta c z hca hcb e).mp hc⟩ + · exact ⟨e, he, (swap_color_iff phi alpha beta c z hca hcb e).mpr hc⟩ + have swap_missing_iff (phi : PartialEdgeColoring E k) + (alpha beta c : Fin k) (z : Sum V E) (v : V) + (hca : c ≠ alpha) (hcb : c ≠ beta) : + c ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta z) v ↔ + c ∈ MissingColors G phi v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + swap_present_iff phi alpha beta c z v hca hcb] + have root_swap_gamma_missing (phi : PartialEdgeColoring E k) + (gamma delta : Fin k) (w : V) (hne : gamma ≠ delta) + (hdelta : delta ∈ MissingColors G phi w) : + gamma ∈ MissingColors G + (TwoColorComponentSwap G phi gamma delta (Sum.inl w)) w := by + exact @helper_root_swap_gamma_missing_299 (@V) (@E) inferInstance inferInstance (@G) (@k) + (@phi) (@gamma) (@delta) (@w) (by assumption) (by assumption) + have slot_class (a : Fin trace.steps) : trace.slot a ∈ S (trace.support a) := by + simp only [S, ExtensionBaseSupportClass, Finset.mem_filter] + exact ⟨slot_active a, trace.chosenVertex a⟩ + have initial_state (b : Fin trace.steps) : + trace.gamma b ∈ PresentColors G sigmaN (trace.support b) ∧ + ((∀ c : Fin trace.steps, c.val < b.val → + trace.support c ≠ trace.support b) → + trace.delta b ∈ MissingColors G sigmaN (trace.support b)) := by + exact @helper_initial_state_338 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (by assumption) (@sigmaN) + (@trace) (by assumption) (by assumption) (by assumption) (by assumption) (by assumption) + (by assumption) (@b) + have state := + @helper_state_821 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@sigmaN) + (@trace) (@pair_ne) (@pair_relation) (@swap_present_iff) (@swap_missing_iff) + (@root_swap_gamma_missing) (@initial_state) + intro a + have hs := state a.castSucc a (le_refl a.val) + refine ⟨?_, hs.1⟩ + apply hs.2 + intro c hac hca + change a.val ≤ c.val at hac + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAInduction.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAInduction.lean new file mode 100644 index 0000000000..87f72ec427 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAInduction.lean @@ -0,0 +1,397 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmAColorState +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmASingleStep + +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationInvariant + +public import LeanPool.GoldbergSeymour.StrongInterchangeabilityKempePreserved + +/-! +# Extension Base Algorithm AInduction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_slot_tree_115.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), ( + ∀ (a : Fin trace.steps), trace.slot a ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport) → + ∀ (a : Fin trace.steps), trace.support a ∈ TreeSequenceVertexSet (ett.series.data.tree + (trace.slot a).succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace + slot_active a + have ha := slot_active a + unfold ExtensionBaseActiveIndices at ha + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at ha + have hkind : ett.series.data.kind (trace.slot a).succ = + some TashkinovExtensionKind.PE := ha.2.1 + have hc := ett.series.certified (trace.slot a).succ + generalize hn : (trace.slot a).succ = n at hc + cases hc with + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hv := choice.vertexDefective.1 + have heqIndex : i = trace.slot a := by + apply Fin.ext + have hh := congrArg Fin.val hn + simp at hh ⊢ + omega + have heq : choice.vertex = trace.support a := by + apply Option.some.inj + have hcv : ett.series.data.chosenVertex (trace.slot a).succ = + some choice.vertex := by simpa [heqIndex] using currentVertex + exact hcv.symm.trans (trace.chosenVertex a) + simpa [heqIndex, heq] using hv + | initial => simp_all + | SE => + simp_all + | RE => + simp_all + +private theorem helper_branch_177.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (sigmaN : + PartialEdgeColoring E k) (_ : ( + ∀ (s t : Fin ett.rounds) (vs vt : V) (gammaS deltaS gammaT deltaT : Fin k) (_ : s ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport) (_ : t ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport) (_ : (↑s : ℕ) < (↑t : ℕ)) + (_ : ett.series.data.chosenVertex s.succ = some vs) (_ : ett.series.data.chosenVertex + t.succ = some vt) (_ : ett.series.data.gamma s.succ = some gammaS) (_ : + ett.series.data.delta s.succ = some deltaS) (_ : ett.series.data.gamma t.succ = some + gammaT) (_ : ett.series.data.delta t.succ = some deltaT), (((insert gammaS ({ deltaS } : + Finset (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset + (Fin k)) : Finset (Fin k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport vs, (↑s : ℕ) < (↑r : ℕ) ∧ + (↑r : ℕ) < (↑t : ℕ) ∧ ett.series.data.chosenVertex r.succ = some vs) ∧ (((insert gammaS + ({ deltaS } : Finset (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin + k)) : Finset (Fin k)) : Finset (Fin k)).Nonempty → ((insert gammaS ({ deltaS } : Finset + (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)) = ({ gammaT } : Finset (Fin k)) ∧ ((insert gammaS ({ deltaS } : + Finset (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset + (Fin k)) : Finset (Fin k)) = ({ deltaS } : Finset (Fin k))))) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN) (_ : ( + ∀ (a : Fin trace.steps), trace.delta a ∈ MissingColors G (trace.coloring a.castSucc) + (trace.support a) ∧ trace.gamma a ∈ PresentColors G (trace.coloring a.castSucc) + (trace.support a))), + let _ : Finset (Fin ett.rounds) := ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport; + ∀ (_ : ( + ∀ (a : Fin trace.steps), trace.slot a ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport)) (_ : ( + ∀ (a : Fin trace.steps), trace.slot a ∉ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport)) (_ : ( + ∀ (a : Fin trace.steps), trace.support a ∈ TreeSequenceVertexSet (ett.series.data.tree + (trace.slot a).succ.castSucc))) (_ : ( + ∀ (a : Fin trace.steps), trace.slot a ≠ q)) (a : Fin trace.steps) (_ : ((IsProperEdgeColoring + G (trace.coloring a.castSucc) ∧ IsOneEdgeUncolored (trace.coloring a.castSucc) e0) ∧ + ∀ (s : Fin ett.rounds) (vs : V) (gammaS deltaS : Fin k), s ∈ ExtensionBaseActiveIndices ett + terminalSupport hterminalSupport → s ≠ q → ( + ∀ (b : Fin trace.steps), (↑b : ℕ) < (↑a.castSucc : ℕ) → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.gamma s.succ = some gammaS + → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett s vs + (trace.coloring a.castSucc) gammaS deltaS)), (IsProperEdgeColoring G (trace.coloring + a.succ) ∧ IsOneEdgeUncolored (trace.coloring a.succ) e0) ∧ + ∀ (s : Fin ett.rounds) (vs : V) (gammaS deltaS : Fin k), s ∈ ExtensionBaseActiveIndices ett + terminalSupport hterminalSupport → s ≠ q → ( + ∀ (b : Fin trace.steps), (↑b : ℕ) < (↑a.succ : ℕ) → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.gamma s.succ = some gammaS + → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett s vs + (trace.coloring a.succ) gammaS deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q sigmaN + hpairOverlap trace hcolorState L slot_active slot_not_class slot_tree slot_ne_q a ih + rcases ih with ⟨hgood, hsurvivor⟩ + have hsi : ETTStrongInterchangeable ett (trace.slot a) + (trace.support a) (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) := by + apply hsurvivor (trace.slot a) (trace.support a) + (trace.gamma a) (trace.delta a) (slot_active a) (slot_ne_q a) + · intro b hb + have hd := trace.strictlyDescending b a hb + intro he + rw [he] at hd + exact (Nat.lt_irrefl _ hd) + · exact trace.chosenVertex a + · exact trace.gammaField a + · exact trace.deltaField a + have hcs := hcolorState a + have hstep := ExtensionBaseAlgorithmASingleStep ett (trace.slot a) + (trace.support a) (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a) hgood.1 hgood.2 hsi (slot_tree a) hcs.1 hcs.2 + have hgoodNext : + IsProperEdgeColoring G (trace.coloring a.succ) ∧ + IsOneEdgeUncolored (trace.coloring a.succ) e0 := by + rw [trace.transition a] + exact hstep.2.2 + refine ⟨hgoodNext, ?_⟩ + intro s vs gammaS deltaS hs hq hnot hvs hgs hds + have hsOld : ETTStrongInterchangeable ett s vs + (trace.coloring a.castSucc) gammaS deltaS := by + apply hsurvivor s vs gammaS deltaS hs hq + · intro b hb + have hb' : b.val < a.val := by simpa using hb + exact hnot b (by change b.val < a.val + 1; omega) + · exact hvs + · exact hgs + · exact hds + have hrelative : vs ≠ trace.support a ∨ s.val < (trace.slot a).val := by + by_cases hvsup : vs ≠ trace.support a + · exact Or.inl hvsup + · right + have hvEq : vs = trace.support a := Classical.not_not.mp hvsup + have hsL : s ∈ L := by + change s ∈ ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport + apply Finset.mem_sdiff.mpr + refine ⟨hs, ?_⟩ + intro hclass + have hclass' : s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport ∧ + ett.series.data.chosenVertex s.succ = some terminalSupport := by + simpa [ExtensionBaseSupportClass] using hclass + have hterm := hclass'.2 + have hvterm : vs = terminalSupport := Option.some.inj (hvs.symm.trans hterm) + have hcur : trace.support a ≠ terminalSupport := by + intro heq + apply slot_not_class a + unfold ExtensionBaseSupportClass + simp only [Finset.mem_filter] + exact ⟨slot_active a, by simpa [heq] using trace.chosenVertex a⟩ + exact hcur (hvEq.symm.trans hvterm) + have himage : s ∈ Finset.univ.image trace.slot := by + rw [trace.enumerates] + exact hsL + rcases Finset.mem_image.mp himage with ⟨c, -, hcs⟩ + have hac : a.val < c.val := by + by_contra hle + have hca : c.val < a.succ.val := by simp; omega + exact hnot c (by simpa using hca) hcs + have hd := trace.strictlyDescending a c hac + simpa [hcs] using hd + have hdisj : vs ≠ trace.support a → + Disjoint ({gammaS, deltaS} : Finset (Fin k)) + {trace.gamma a, trace.delta a} := by + intro hneSupport + refine Finset.disjoint_left.2 ?_ + intro color hleft hright + have hinter : + (({gammaS, deltaS} : Finset (Fin k)) ∩ + {trace.gamma a, trace.delta a}).Nonempty := + ⟨color, Finset.mem_inter.mpr ⟨hleft, hright⟩⟩ + by_cases hst : s.val < (trace.slot a).val + · have hor := hpairOverlap s (trace.slot a) vs (trace.support a) + gammaS deltaS (trace.gamma a) (trace.delta a) hs + (slot_active a) hst hvs (trace.chosenVertex a) hgs hds + (trace.gammaField a) (trace.deltaField a) + have heq := (hor.1.mp hinter).1 + exact hneSupport heq + · have hneq : s ≠ trace.slot a := by + intro heq + have hna : a.val < a.succ.val := by simp + have hslot := hnot a hna + exact hslot heq.symm + have hts : (trace.slot a).val < s.val := by + have hv : s.val ≠ (trace.slot a).val := by + intro he + apply hneq + exact Fin.ext he + omega + have hor := hpairOverlap (trace.slot a) s (trace.support a) vs + (trace.gamma a) (trace.delta a) gammaS deltaS + (slot_active a) hs hts (trace.chosenVertex a) hvs + (trace.gammaField a) (trace.deltaField a) hgs hds + have hinter' : + (({trace.gamma a, trace.delta a} : Finset (Fin k)) ∩ + {gammaS, deltaS}).Nonempty := by + simpa [Finset.inter_comm] using hinter + have heq := (hor.1.mp hinter').1 + exact hneSupport heq.symm + have hp := StrongInterchangeabilityKempePreserved ett s + (trace.slot a) vs (trace.support a) gammaS deltaS + (trace.gamma a) (trace.delta a) (trace.coloring a.castSucc) + (Sum.inl (trace.support a)) hgood.1 hgood.2 hgs hds + (trace.gammaField a) (trace.deltaField a) + hrelative hdisj hstep.1 hsi hsOld + rw [trace.transition a] + exact hp.2.2 + +theorem ExtensionBaseAlgorithmAInduction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot q : Fin ett.rounds) (sigmaN : PartialEdgeColoring E k) + (hqVertex : ett.series.data.chosenVertex q.succ = some terminalSupport) + (hsigmaProper : IsProperEdgeColoring G sigmaN) + (hsigmaOne : IsOneEdgeUncolored sigmaN e0) + (hterminalBefore : ∀ (t : Fin ett.rounds) (vt : V), + t ∈ ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport → + ett.series.data.chosenVertex t.succ = some vt → + TreeVertexOrder T terminalSupport vt) + (hjInitial : ∀ t : Fin ett.rounds, + t ∈ ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport → + TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree t.succ.castSucc)) + (hinitialSI : ∀ (t : Fin ett.rounds) (vt : V) + (gammaT deltaT : Fin k), + t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + t ≠ q → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → + ETTStrongInterchangeable ett t vt sigmaN gammaT deltaT) + (hpairOverlap : ∀ (s t : Fin ett.rounds) (vs vt : V) + (gammaS deltaS gammaT deltaT : Fin k), + s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → + t ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → + s.val < t.val → + ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → + ((({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT}).Nonempty ↔ + vs = vt ∧ + ¬ ∃ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport vs ∧ + s.val < r.val ∧ r.val < t.val ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ + ((({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT}).Nonempty → + ({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT} = + {gammaT} ∧ + ({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT} = + {deltaS})) + (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN) + (hcolorState : ∀ a : Fin trace.steps, + trace.delta a ∈ + MissingColors G (trace.coloring a.castSucc) (trace.support a) ∧ + trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) (trace.support a)) : + ExtensionBaseRestorationInvariant ett terminalSupport hterminalSupport jSlot q sigmaN + trace := by + classical + unfold ExtensionBaseRestorationInvariant + let L := ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport + have slot_mem (a : Fin trace.steps) : trace.slot a ∈ L := by + change trace.slot a ∈ ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport + rw [← trace.enumerates] + exact Finset.mem_image.mpr ⟨a, Finset.mem_univ _, rfl⟩ + have slot_active (a : Fin trace.steps) : + trace.slot a ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport := by + exact (Finset.mem_sdiff.mp (slot_mem a)).1 + have slot_not_class (a : Fin trace.steps) : + trace.slot a ∉ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport := by + have hm : trace.slot a ∈ + ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport := by + exact slot_mem a + exact (Finset.mem_sdiff.mp hm).2 + have slot_tree (a : Fin trace.steps) : + trace.support a ∈ TreeSequenceVertexSet + (ett.series.data.tree (trace.slot a).succ.castSucc) := by + exact @helper_slot_tree_115 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (by assumption) (@sigmaN) + (@trace) (by assumption) (@a) + have slot_ne_q (a : Fin trace.steps) : trace.slot a ≠ q := by + intro heq + apply slot_not_class a + unfold ExtensionBaseSupportClass + simp only [Finset.mem_filter] + constructor + · exact slot_active a + · simp [heq, hqVertex] + have state : + ∀ n : Fin (trace.steps + 1), (IsProperEdgeColoring G (trace.coloring n) ∧ IsOneEdgeUncolored + (trace.coloring n) e0) ∧ ( + ∀ s : Fin ett.rounds, + ∀ vs : V, + ∀ gammaS deltaS : Fin k, s ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + s ≠ q → ( + ∀ b : Fin trace.steps, b.val < n.val → trace.slot b ≠ s) → ett.series.data.chosenVertex s.succ + = some vs → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → ETTStrongInterchangeable ett s vs (trace.coloring n) gammaS deltaS) := by + intro n + induction n using Fin.induction with + | zero => + refine ⟨?_, ?_⟩ + · simpa [trace.initialColoring] using And.intro hsigmaProper hsigmaOne + · intro s vs gammaS deltaS hs hq hnot hvs hgs hds + rw [trace.initialColoring] + exact hinitialSI s vs gammaS deltaS hs hq hvs hgs hds + | succ a ih => + exact @helper_branch_177 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (by assumption) (@q) + (@sigmaN) (by assumption) (@trace) (by assumption) (by assumption) (by assumption) + (by assumption) (by assumption) (@a) (by assumption) + refine ⟨?_, ?_, ?_⟩ + · intro a + exact (state a).1 + · intro a + rcases state a.castSucc with ⟨hgood, hsurvivor⟩ + have hsi := hsurvivor (trace.slot a) (trace.support a) + (trace.gamma a) (trace.delta a) (slot_active a) (slot_ne_q a) + (by + intro b hb hbeq + have hd := trace.strictlyDescending b a hb + rw [hbeq] at hd + exact Nat.lt_irrefl _ hd) (trace.chosenVertex a) (trace.gammaField a) + (trace.deltaField a) + have hs := hcolorState a + have hstep := ExtensionBaseAlgorithmASingleStep ett (trace.slot a) + (trace.support a) (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a) hgood.1 hgood.2 hsi (slot_tree a) hs.1 hs.2 + refine ⟨slot_mem a, hterminalBefore (trace.slot a) (trace.support a) + (slot_mem a) (trace.chosenVertex a), + hjInitial (trace.slot a) (by exact slot_mem a), slot_tree a, hs.1, + hstep.1, hstep.2.1, ?_⟩ + intro s vs gammaS deltaS hsA hq hnot hvs hgs hds + exact (state a.succ).2 s vs gammaS deltaS hsA hq (by + intro b hb + apply hnot b + exact Nat.le_of_lt_succ (by simpa using hb)) hvs hgs hds + · intro s vs gammaS deltaS hs hq hnot hvs hgs hds + exact (state (Fin.last trace.steps)).2 s vs gammaS deltaS hs hq (by + intro a ha + exact hnot a) hvs hgs hds + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmASingleStep.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmASingleStep.lean new file mode 100644 index 0000000000..8f5501465b --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmASingleStep.lean @@ -0,0 +1,154 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable + +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper + +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent + +/-! +# Extension Base Algorithm ASingle Step + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseAlgorithmASingleStep {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (t : Fin ett.rounds) (vt : V) (phi : PartialEdgeColoring E k) + (gammaT deltaT : Fin k) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hSI : ETTStrongInterchangeable ett t vt phi gammaT deltaT) + (_ : vt ∈ TreeSequenceVertexSet + (ett.series.data.tree t.succ.castSucc)) + (hdeltaMissing : deltaT ∈ MissingColors G phi vt) + (hgammaPresent : gammaT ∈ PresentColors G phi vt) : + TwoColorNontrivialPathComponent G phi gammaT deltaT (Sum.inl vt) ∧ + (∀ w : V, + w ∈ TreeSequenceVertexSet + (ett.series.data.tree t.succ.castSucc) → + (Sum.inl w ∈ TwoColorComponent G phi gammaT deltaT (Sum.inl vt) ↔ + w = vt)) ∧ + IsProperEdgeColoring G + (TwoColorComponentSwap G phi gammaT deltaT (Sum.inl vt)) ∧ + IsOneEdgeUncolored + (TwoColorComponentSwap G phi gammaT deltaT (Sum.inl vt)) e0 := by + classical + let H := TwoColorIncidenceGraph G phi gammaT deltaT + let C := TwoColorComponent G phi gammaT deltaT (Sum.inl vt) + have hne : gammaT ≠ deltaT := hSI.1 + have hdeltaNotPresent : deltaT ∉ PresentColors G phi vt := + (Finset.mem_sdiff.mp hdeltaMissing).2 + obtain ⟨eGamma, heGammaIncident, heGammaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + using hgammaPresent + have heGammaAdj : H.Adj (Sum.inl vt) (Sum.inr eGamma) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro heGammaIncident (Or.inl heGammaColor) + have heGammaComponent : Sum.inr eGamma ∈ C := by + change H.connectedComponentMk (Sum.inr eGamma) = + H.connectedComponentMk (Sum.inl vt) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + heGammaAdj).symm + have hvtComponent : Sum.inl vt ∈ C := by + rfl + have hvtSubsingleton : Set.Subsingleton (H.neighborSet (Sum.inl vt)) := by + intro x hx y hy + cases x with + | inl x => + simp [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] at hx + | inr e => + cases y with + | inl y => + simp [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] at hy + | inr f => + have hxData : Incident G vt e ∧ + (phi e = some gammaT ∨ phi e = some deltaT) := by + simpa [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] + using hx + have hyData : Incident G vt f ∧ + (phi f = some gammaT ∨ phi f = some deltaT) := by + simpa [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] + using hy + have heColor : phi e = some gammaT := by + rcases hxData.2 with he | he + · exact he + · exact False.elim (hdeltaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hxData.1, he⟩)) + have hfColor : phi f = some gammaT := by + rcases hyData.2 with hf | hf + · exact hf + · exact False.elim (hdeltaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hyData.1, hf⟩)) + congr 1 + by_contra hef + exact (hproper hef ⟨vt, hxData.1, hyData.1⟩ heColor) hfColor + have hpath : TwoColorPathComponent G phi gammaT deltaT (Sum.inl vt) := by + refine ⟨hne, Sum.inl vt, hvtComponent, ?_⟩ + simpa [H] using hvtSubsingleton + have hnontrivial : TwoColorNontrivialPathComponent G phi gammaT deltaT + (Sum.inl vt) := by + exact ⟨hpath, eGamma, heGammaComponent⟩ + have hproperSwap : IsProperEdgeColoring G + (TwoColorComponentSwap G phi gammaT deltaT (Sum.inl vt)) := by + exact TwoColorComponentSwapProper G phi gammaT deltaT hne hproper + (Sum.inl vt) + have honeSwap : IsOneEdgeUncolored + (TwoColorComponentSwap G phi gammaT deltaT (Sum.inl vt)) e0 := by + unfold IsOneEdgeUncolored at hone ⊢ + constructor + · simp [TwoColorComponentSwap, hone.1] + · intro e he0 + obtain ⟨c, hc⟩ := hone.2 e he0 + by_cases heC : Sum.inr e ∈ C + · by_cases heGamma' : phi e = some gammaT + · exact ⟨deltaT, by + simp [TwoColorComponentSwap, C, heC, heGamma']⟩ + · by_cases heDelta' : phi e = some deltaT + · exact ⟨gammaT, by + simp [TwoColorComponentSwap, C, heC, heDelta']⟩ + · exact ⟨c, by + simpa [TwoColorComponentSwap, C, heC, heGamma', heDelta'] using hc⟩ + · exact ⟨c, by + simpa [TwoColorComponentSwap, C, heC] using hc⟩ + refine ⟨hnontrivial, ?_, hproperSwap, honeSwap⟩ + intro w hwTree + constructor + · intro hwComponent + by_contra hneW + obtain ⟨hcycle, havoid, hrest⟩ := + hSI.2.2.2.choose_spec.2.2.2 w hwTree hneW + have hvtInW : Sum.inl vt ∈ + TwoColorComponent G phi gammaT deltaT (Sum.inl w) := by + change H.connectedComponentMk (Sum.inl vt) = + H.connectedComponentMk (Sum.inl w) + change H.connectedComponentMk (Sum.inl w) = + H.connectedComponentMk (Sum.inl vt) at hwComponent + exact hwComponent.symm + exact havoid hvtInW + · intro hwEq + subst w + exact hvtComponent + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmATraceExists.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmATraceExists.lean new file mode 100644 index 0000000000..1510f4e72e --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmATraceExists.lean @@ -0,0 +1,120 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace + +/-! +# Extension Base Algorithm ATrace Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseAlgorithmATraceExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (sigmaN : PartialEdgeColoring E k) + (hslotData : ∀ t : Fin ett.rounds, + t ∈ ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport → + ∃ vt : V, ∃ gammaT deltaT : Fin k, + ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ + ett.series.data.delta t.succ = some deltaT) : + Nonempty (ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN) := by + classical + let slots := ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport + let ordered : List (Fin ett.rounds) := + List.insertionSort (fun a b : Fin ett.rounds => b.val ≤ a.val) slots.toList + have orderedPerm : List.Perm ordered slots.toList := by + exact List.perm_insertionSort _ _ + have orderedLength : slots.card = ordered.length := by + exact (orderedPerm.length_eq.trans (Finset.length_toList slots)).symm + have orderedPairwise : ordered.Pairwise (fun a b : Fin ett.rounds => b.val ≤ a.val) := by + exact List.pairwise_insertionSort _ _ + have orderedNodup : ordered.Nodup := by + exact orderedPerm.nodup_iff.mpr (Finset.nodup_toList slots) + let slot : Fin slots.card → Fin ett.rounds := fun a => + ordered.get (Fin.cast orderedLength a) + have slotMem : ∀ a : Fin slots.card, slot a ∈ slots := by + intro a + rw [show slot a = ordered.get (Fin.cast orderedLength a) by rfl] + apply (Finset.mem_toList).mp + exact orderedPerm.mem_iff.mp (List.get_mem ordered (Fin.cast orderedLength a)) + have slotAll : Finset.univ.image slot = slots := by + ext t + constructor + · intro ht + obtain ⟨a, _, ha⟩ := Finset.mem_image.mp ht + simpa [← ha] using slotMem a + · intro ht + have hlist : t ∈ ordered := orderedPerm.mem_iff.mpr (Finset.mem_toList.mpr ht) + obtain ⟨a, ha⟩ := (List.mem_iff_get.mp hlist) + let a' : Fin slots.card := Fin.cast orderedLength.symm a + refine Finset.mem_image.mpr ⟨a', Finset.mem_univ _, ?_⟩ + simpa [slot, a', Fin.cast_cast] using ha + have slotDescending : ∀ a b : Fin slots.card, a.val < b.val → + (slot b).val < (slot a).val := by + intro a b hab + have hp := orderedPairwise.rel_get_of_lt + (show (Fin.cast orderedLength a) < (Fin.cast orderedLength b) by exact hab) + have hne : ordered.get (Fin.cast orderedLength a) ≠ ordered.get (Fin.cast orderedLength b) := by + intro he + have hi := orderedNodup.get_inj_iff.mp he + exact (ne_of_lt (show (Fin.cast orderedLength a).val < + (Fin.cast orderedLength b).val by exact hab)) (congrArg Fin.val hi) + have hlt : (ordered.get (Fin.cast orderedLength b)).val < + (ordered.get (Fin.cast orderedLength a)).val := by + exact lt_of_le_of_ne hp (fun h => hne (Fin.ext h.symm)) + exact hlt + let support : Fin slots.card → V := fun a => + Classical.choose (hslotData (slot a) (slotMem a)) + let gamma : Fin slots.card → Fin k := fun a => + Classical.choose (Classical.choose_spec (hslotData (slot a) (slotMem a))) + let delta : Fin slots.card → Fin k := fun a => + Classical.choose (Classical.choose_spec + (Classical.choose_spec (hslotData (slot a) (slotMem a)))) + have chosenData : ∀ a : Fin slots.card, + ett.series.data.chosenVertex (slot a).succ = some (support a) ∧ + ett.series.data.gamma (slot a).succ = some (gamma a) ∧ + ett.series.data.delta (slot a).succ = some (delta a) := by + intro a + exact Classical.choose_spec (hslotData (slot a) (slotMem a)) |>.choose_spec |>.choose_spec + let coloring : Fin (slots.card + 1) → PartialEdgeColoring E k := fun i => + Fin.induction sigmaN (fun j state => + TwoColorComponentSwap G state (gamma j) (delta j) (Sum.inl (support j))) i + refine ⟨{ + steps := slots.card + slot := slot + support := support + gamma := gamma + delta := delta + coloring := coloring + initialColoring := by rfl + enumerates := slotAll + strictlyDescending := slotDescending + chosenVertex := fun a => (chosenData a).1 + gammaField := fun a => (chosenData a).2.1 + deltaField := fun a => (chosenData a).2.2 + transition := ?_ }⟩ + intro a + simp [coloring] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmB.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmB.lean new file mode 100644 index 0000000000..e5520f915d --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmB.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBInduction + +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBInvariant + +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTraceExists + +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors + +/-! +# Extension Base Algorithm B + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseAlgorithmB {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) (jSlot : Fin ett.rounds) + (rho1 : PartialEdgeColoring E k) (u : V) + (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds) + (gamma delta : Fin (p + 1) → Fin k) (b : Fin (p + 1)) + (hproper : IsProperEdgeColoring G rho1) + (hone : IsOneEdgeUncolored rho1 e0) + (hincreasing : ∀ a c, a.val < c.val → + (indices a).val < (indices c).val) + (hsupport : ∀ a, + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : ∀ a, + ett.series.data.kind (indices a).succ = + some TashkinovExtensionKind.PE) + (hgamma : ∀ a, + ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : ∀ a, + ett.series.data.delta (indices a).succ = some (delta a)) + (hchain : ∀ a : Fin p, gamma a.succ = delta a.castSucc) + (hdistinct : Function.Injective (Fin.cons (gamma 0) delta)) + (hselected : gamma b ∈ MissingColors G rho1 u) + (hminimal : ∀ a : Fin (p + 1), a.val < b.val → + gamma a ∉ MissingColors G rho1 u) + (hinitialSI : ∀ a : Fin (p + 1), a.val < b.val → + ETTStrongInterchangeable ett (indices a) terminalSupport rho1 + (gamma a) (delta a)) + (hTjInitial : ∀ a : Fin (p + 1), a.val < b.val → + TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (indices a).succ.castSucc)) + (hterminalNoMissing : + MissingColors G rho1 terminalSupport ∩ + ((ExtensionBaseCaseOneIndices ett p indices b).biUnion + fun t => ett.series.data.stored t.succ) = ∅) + (hstored : ∀ a, + ett.series.data.stored (indices a).succ = {gamma a, delta a}) : + ∃ trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u + p indices b, + ExtensionBaseAlgorithmBInvariant ett terminalSupport jSlot rho1 u + p indices b trace := by + classical + obtain ⟨trace, hsteps, hposition, htraceGamma, htraceDelta⟩ := + ExtensionBaseAlgorithmBTraceExists ett terminalSupport rho1 u p indices + gamma delta b hincreasing hsupport hkind hgamma hdelta + refine ⟨trace, ?_⟩ + obtain ⟨hcoloring, hstate, hfinal⟩ := + ExtensionBaseAlgorithmBInduction ett terminalSupport rho1 u p indices + gamma delta b trace hsteps hposition htraceGamma htraceDelta hproper + hone hchain hdistinct hselected hminimal hinitialSI hterminalNoMissing + hstored + unfold ExtensionBaseAlgorithmBInvariant + refine ⟨hcoloring, ?_, hfinal⟩ + intro a + obtain ⟨hmissing, hpresent, hterminalGamma, hterminalDelta, hsi, + hsurvivors⟩ := hstate a + have hstep := ExtensionBaseAlgorithmBSingleStep ett (trace.slot a) + terminalSupport (trace.coloring a.castSucc) u (trace.gamma a) + (trace.delta a) (hcoloring a.castSucc).1 hsi hmissing hpresent + hterminalGamma hterminalDelta + refine ⟨?_, hmissing, hstep.1, hstep.2.1, hstep.2.2, hsurvivors⟩ + rw [trace.slotIdentity a] + exact hTjInitial (trace.position a) (trace.positionBefore a) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean new file mode 100644 index 0000000000..2a78e05670 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean @@ -0,0 +1,726 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBSingleStep +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace + +public import LeanPool.GoldbergSeymour.StrongInterchangeabilityKempePreserved + +/-! +# Extension Base Algorithm BInduction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_root_swap_exchange_230.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : + LooplessMultigraph V E} {k : ℕ} {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin + k}, alpha ≠ beta → beta ∈ MissingColors G phi v → alpha ∈ PresentColors G phi v → alpha ∈ + MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ∧ beta ∈ + PresentColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v := by + classical + intro V E _ _ G k phi v alpha beta hne hbeta halpha + let _ := Fintype.ofFinite V + have hbetaNotPresent : beta ∉ PresentColors G phi v := by + simpa [MissingColors] using hbeta + obtain ⟨eAlpha, heAlphaIncident, heAlphaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halpha + have heAlphaComponent : Sum.inr eAlpha ∈ + TwoColorComponent G phi alpha beta (Sum.inl v) := by + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr eAlpha) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro heAlphaIncident (Or.inl heAlphaColor) + change H.connectedComponentMk (Sum.inr eAlpha) = + H.connectedComponentMk (Sum.inl v) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm + constructor + · unfold MissingColors + rw [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hp + rcases hp with ⟨e, hev, heColor⟩ + by_cases heK : + Sum.inr e ∈ TwoColorComponent G phi alpha beta (Sum.inl v) + · have heBeta : phi e = some beta := by + unfold TwoColorComponentSwap at heColor + rw [ite_eq_left heK] at heColor + by_cases heAlpha : phi e = some alpha + · rw [ite_eq_left heAlpha] at heColor + exact False.elim (hne (Option.some.inj heColor).symm) + · by_cases heBeta : phi e = some beta + · exact heBeta + · rw [ite_eq_right heAlpha, ite_eq_right heBeta] at heColor + exact False.elim (heAlpha heColor) + apply hbetaNotPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, heBeta⟩ + · have heOldAlpha : phi e = some alpha := by + simpa [TwoColorComponentSwap, heK] using heColor + have heAdj : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inl v) (Sum.inr e) := by + simpa [TwoColorIncidenceGraph] using + And.intro hev (Or.inl heOldAlpha) + apply heK + change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inr e) = + (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl v) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + heAdj).symm + · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨eAlpha, heAlphaIncident, by + simp [TwoColorComponentSwap, heAlphaComponent, heAlphaColor]⟩ + +private theorem helper_swap_preserves_present_295.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : + LooplessMultigraph V E} {k : ℕ}, (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta c + : Fin k} {z : V ⊕ E}, c ∈ PresentColors G phi v → c ≠ alpha → c ≠ beta → c ∈ PresentColors + G (TwoColorComponentSwap G phi alpha beta z) v) → ∀ {phi : PartialEdgeColoring E k} {v : + V} {alpha beta : Fin k} {z : V ⊕ E}, alpha ∈ PresentColors G phi v → beta ∈ PresentColors + G phi v → ∀ c ∈ PresentColors G phi v, c ∈ PresentColors G (TwoColorComponentSwap G phi + alpha beta z) v := by + classical + intro V E _ _ G k swap_present_other phi v alpha beta z halpha hbeta c hc + let _ := Fintype.ofFinite V + by_cases hca : c = alpha + · subst c + by_cases hvK : Sum.inl v ∈ TwoColorComponent G phi alpha beta z + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hbeta + have heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inr heColor) + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z + at hvK + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm.trans hvK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simp [TwoColorComponentSwap, heK, heColor]⟩ + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halpha + have heK : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by + intro heK + apply hvK + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inl heColor) + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z + at heK + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans heK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simpa [TwoColorComponentSwap, heK] using heColor⟩ + · by_cases hcb : c = beta + · subst c + by_cases hvK : Sum.inl v ∈ TwoColorComponent G phi alpha beta z + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halpha + have heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inl heColor) + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z + at hvK + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm.trans hvK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simp [TwoColorComponentSwap, heK, heColor]⟩ + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hbeta + have heK : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by + intro heK + apply hvK + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inr heColor) + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z + at heK + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans heK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simpa [TwoColorComponentSwap, heK] using heColor⟩ + · exact swap_present_other hc hca hcb + +private theorem helper_branch_318.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ + _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), + let L : Finset (Fin ett.rounds) := ExtensionBaseCaseOneIndices ett p indices b; + let U : Finset (Fin k) := L.biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ; + ( + ∀ (a : Fin trace.steps), trace.gamma a ≠ trace.delta a) → ( + ∀ (a c : Fin trace.steps), (↑a : ℕ) < (↑c : ℕ) → trace.gamma c ≠ trace.gamma a ∧ trace.gamma c + ≠ trace.delta a) → ( + ∀ (a c : Fin trace.steps), (↑c : ℕ) = (↑a : ℕ) + (1 : ℕ) → trace.delta c = trace.gamma a) → ( + ∀ (a : Fin trace.steps), trace.slot a ∈ L) → ( + ∀ (a : Fin trace.steps), trace.gamma a ∈ U) → ( + ∀ (a : Fin trace.steps), trace.delta a ∈ U) → ( + ∀ {phi : PartialEdgeColoring E k} {alpha beta : Fin k} {z : V ⊕ E}, IsOneEdgeUncolored phi e0 + → IsOneEdgeUncolored (TwoColorComponentSwap G phi alpha beta z) e0) → ( + ∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta c : Fin k} {z : V ⊕ E}, c ∈ + PresentColors G phi v → c ≠ alpha → c ≠ beta → c ∈ PresentColors G (TwoColorComponentSwap + G phi alpha beta z) v) → ( + ∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k}, alpha ≠ beta → beta ∈ + MissingColors G phi v → alpha ∈ PresentColors G phi v → alpha ∈ MissingColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ∧ beta ∈ PresentColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v) → ( + ∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : V ⊕ E}, alpha ≠ beta → + alpha ∈ PresentColors G phi v → beta ∈ PresentColors G phi v → + ∀ c ∈ PresentColors G phi v, c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v) + → + ∀ (a : Fin trace.steps), ((IsProperEdgeColoring G (trace.coloring a.castSucc) ∧ + IsOneEdgeUncolored (trace.coloring a.castSucc) e0) ∧ ( + ∀ c ∈ U, c ∈ PresentColors G (trace.coloring a.castSucc) terminalSupport) ∧ ( + ∀ (a_1 : Fin trace.steps), (↑a.castSucc : ℕ) ≤ (↑a_1 : ℕ) → trace.gamma a_1 ∈ PresentColors G + (trace.coloring a.castSucc) u) ∧ ( + ∀ (a_1 : Fin trace.steps), (↑a_1 : ℕ) = (↑a.castSucc : ℕ) → trace.delta a_1 ∈ MissingColors G + (trace.coloring a.castSucc) u) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ L → ( + ∀ (a_2 : Fin trace.steps), (↑a_2 : ℕ) < (↑a.castSucc : ℕ) → trace.slot a_2 ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.castSucc) gammaS deltaS) → (IsProperEdgeColoring G + (trace.coloring a.succ) ∧ IsOneEdgeUncolored (trace.coloring a.succ) e0) ∧ ( + ∀ c ∈ U, c ∈ PresentColors G (trace.coloring a.succ) terminalSupport) ∧ ( + ∀ (a_1 : Fin trace.steps), (↑a.succ : ℕ) ≤ (↑a_1 : ℕ) → trace.gamma a_1 ∈ PresentColors G + (trace.coloring a.succ) u) ∧ ( + ∀ (a_1 : Fin trace.steps), (↑a_1 : ℕ) = (↑a.succ : ℕ) → trace.delta a_1 ∈ MissingColors G + (trace.coloring a.succ) u) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ L → ( + ∀ (a_2 : Fin trace.steps), (↑a_2 : ℕ) < (↑a.succ : ℕ) → trace.slot a_2 ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b + trace L U trace_colors_ne future_gamma_ne next_delta_eq_gamma slot_mem gamma_mem_U + delta_mem_U swap_preserves_one swap_present_other root_swap_exchange swap_preserves_present + a ih + rcases ih with ⟨hgood, hterminal, hfuture, hnext, hsurvivor⟩ + have hgammaPresent : trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) u := + hfuture a (by rfl) + have hdeltaMissing : trace.delta a ∈ + MissingColors G (trace.coloring a.castSucc) u := + hnext a rfl + have hcurrentSI : ETTStrongInterchangeable ett (trace.slot a) + terminalSupport (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) := by + apply hsurvivor (trace.slot a) (trace.gamma a) (trace.delta a) + (slot_mem a) + · intro c hc hca + have hdesc := trace.strictlyDescending c a hc + rw [hca] at hdesc + exact (Nat.lt_irrefl _ hdesc) + · exact trace.chosenSupport a + · exact trace.gammaField a + · exact trace.deltaField a + have hterminalGamma : trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) terminalSupport := + hterminal (trace.gamma a) (gamma_mem_U a) + have hterminalDelta : trace.delta a ∈ + PresentColors G (trace.coloring a.castSucc) terminalSupport := + hterminal (trace.delta a) (delta_mem_U a) + have hstep := ExtensionBaseAlgorithmBSingleStep ett (trace.slot a) + terminalSupport (trace.coloring a.castSucc) u (trace.gamma a) + (trace.delta a) hgood.1 hcurrentSI hdeltaMissing hgammaPresent + hterminalGamma hterminalDelta + have hproperNext : IsProperEdgeColoring G (trace.coloring a.succ) := by + rw [trace.transition a] + exact TwoColorComponentSwapProper G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (trace_colors_ne a) hgood.1 + (Sum.inl u) + have honeNext : IsOneEdgeUncolored (trace.coloring a.succ) e0 := by + rw [trace.transition a] + exact swap_preserves_one hgood.2 + have hexchange := root_swap_exchange (trace_colors_ne a) + hdeltaMissing hgammaPresent + rw [← trace.transition a] at hexchange + refine ⟨⟨hproperNext, honeNext⟩, ?_, ?_, ?_, ?_⟩ + · intro c hc + have hp := swap_preserves_present (z := Sum.inl u) + (trace_colors_ne a) + hterminalGamma hterminalDelta c (hterminal c hc) + rw [← trace.transition a] at hp + exact hp + · intro c hac + have hac' : a.val < c.val := by + change a.val + 1 ≤ c.val at hac + omega + have hne := future_gamma_ne a c hac' + have hp := swap_present_other (z := Sum.inl u) + (hfuture c (Nat.le_of_lt hac')) + hne.1 hne.2 + rw [← trace.transition a] at hp + exact hp + · intro c hca + rw [next_delta_eq_gamma a c (by simpa using hca)] + exact hexchange.1 + · intro s gammaS deltaS hs hnot hsupport hgammaS hdeltaS + have hsOld : ETTStrongInterchangeable ett s terminalSupport + (trace.coloring a.castSucc) gammaS deltaS := by + apply hsurvivor s gammaS deltaS hs + · intro c hc + apply hnot c + change c.val < a.val at hc + change c.val < a.val + 1 + omega + · exact hsupport + · exact hgammaS + · exact hdeltaS + have hsImage : s ∈ Finset.univ.image trace.slot := by + rw [trace.enumerates] + exact hs + rcases Finset.mem_image.mp hsImage with ⟨c, -, hc⟩ + have hac : a.val < c.val := by + by_contra hle + have hca : c.val < a.succ.val := by + simp + omega + exact hnot c hca hc + have hslt : s.val < (trace.slot a).val := by + have hdesc := trace.strictlyDescending a c hac + simpa [hc] using hdesc + have hpreserved := StrongInterchangeabilityKempePreserved ett s + (trace.slot a) terminalSupport terminalSupport gammaS deltaS + (trace.gamma a) (trace.delta a) (trace.coloring a.castSucc) + (Sum.inl u) hgood.1 hgood.2 hgammaS hdeltaS + (trace.gammaField a) (trace.deltaField a) (Or.inr hslt) + (by intro hneSupport; exact (hneSupport rfl).elim) hstep.1 + hcurrentSI hsOld + rw [trace.transition a] + exact hpreserved.2.2 + +private theorem helper_invariant_383.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (gamma delta : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), ( + ∀ (a : Fin trace.steps), (↑(trace.position a) : ℕ) + (↑a : ℕ) + (1 : ℕ) = (↑b : ℕ)) → ( + ∀ (a : Fin trace.steps), trace.delta a = delta (trace.position a)) → IsProperEdgeColoring G + rho1 → IsOneEdgeUncolored rho1 e0 → ( + ∀ (a : Fin p), gamma a.succ = delta a.castSucc) → gamma b ∈ MissingColors G rho1 u → + let L : Finset (Fin ett.rounds) := ExtensionBaseCaseOneIndices ett p indices b; + let U : Finset (Fin k) := L.biUnion fun (t : Fin ett.rounds) => ett.series.data.stored t.succ; + ( + ∀ (a : Fin trace.steps), trace.gamma a ≠ trace.delta a) → ( + ∀ (a c : Fin trace.steps), (↑a : ℕ) < (↑c : ℕ) → trace.gamma c ≠ trace.gamma a ∧ trace.gamma c + ≠ trace.delta a) → ( + ∀ (a c : Fin trace.steps), (↑c : ℕ) = (↑a : ℕ) + (1 : ℕ) → trace.delta c = trace.gamma a) → ( + ∀ (a : Fin trace.steps), trace.slot a ∈ L) → ( + ∀ (a : Fin trace.steps), trace.gamma a ∈ U) → ( + ∀ (a : Fin trace.steps), trace.delta a ∈ U) → ( + ∀ c ∈ U, c ∈ PresentColors G rho1 terminalSupport) → ( + ∀ (a : Fin trace.steps), trace.gamma a ∈ PresentColors G rho1 u) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ L → ett.series.data.gamma s.succ = some + gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett s + terminalSupport rho1 gammaS deltaS) → ( + ∀ {phi : PartialEdgeColoring E k} {alpha beta : Fin k} {z : V ⊕ E}, IsOneEdgeUncolored phi e0 + → IsOneEdgeUncolored (TwoColorComponentSwap G phi alpha beta z) e0) → ( + ∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta c : Fin k} {z : V ⊕ E}, c ∈ + PresentColors G phi v → c ≠ alpha → c ≠ beta → c ∈ PresentColors G (TwoColorComponentSwap + G phi alpha beta z) v) → ( + ∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k}, alpha ≠ beta → beta ∈ + MissingColors G phi v → alpha ∈ PresentColors G phi v → alpha ∈ MissingColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ∧ beta ∈ PresentColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v) → ( + ∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : V ⊕ E}, alpha ≠ beta → + alpha ∈ PresentColors G phi v → beta ∈ PresentColors G phi v → + ∀ c ∈ PresentColors G phi v, c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v) + → + ∀ (n : Fin (trace.steps + (1 : ℕ))), (IsProperEdgeColoring G (trace.coloring n) ∧ + IsOneEdgeUncolored (trace.coloring n) e0) ∧ ( + ∀ c ∈ U, c ∈ PresentColors G (trace.coloring n) terminalSupport) ∧ ( + ∀ (a : Fin trace.steps), (↑n : ℕ) ≤ (↑a : ℕ) → trace.gamma a ∈ PresentColors G (trace.coloring + n) u) ∧ ( + ∀ (a : Fin trace.steps), (↑a : ℕ) = (↑n : ℕ) → trace.delta a ∈ MissingColors G (trace.coloring + n) u) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ L → ( + ∀ (a : Fin trace.steps), (↑a : ℕ) < (↑n : ℕ) → trace.slot a ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring n) gammaS deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b + trace hposition htraceDelta hproper hone hchain hselected L U trace_colors_ne + future_gamma_ne next_delta_eq_gamma slot_mem gamma_mem_U delta_mem_U + initial_terminal_present initial_gamma_present initial_survivor swap_preserves_one + swap_present_other root_swap_exchange swap_preserves_present n + induction n using Fin.induction with + | zero => + rw [trace.initialColoring] + refine ⟨⟨hproper, hone⟩, initial_terminal_present, + (fun a _ => initial_gamma_present a), ?_, ?_⟩ + · intro a ha + have hpa := hposition a + have hq : (trace.position a).val < p := by + have hb := b.isLt + omega + let q : Fin p := ⟨(trace.position a).val, hq⟩ + have hpos : trace.position a = q.castSucc := by + apply Fin.ext + rfl + have hbq : b = q.succ := by + apply Fin.ext + change b.val = (trace.position a).val + 1 + have ha0 : a.val = 0 := ha + omega + rw [htraceDelta a, hpos, ← hchain q, ← hbq] + exact hselected + · intro s gammaS deltaS hs _ _ hgs hds + exact initial_survivor s gammaS deltaS hs hgs hds + | succ a ih => + exact @helper_branch_318 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@rho1) (@u) (@p) + (@indices) (@gamma) (@delta) (@b) (@trace) (@trace_colors_ne) (@future_gamma_ne) + (@next_delta_eq_gamma) (@slot_mem) (@gamma_mem_U) (@delta_mem_U) (@swap_preserves_one) + (@swap_present_other) (@root_swap_exchange) (@swap_preserves_present) (@a) (@ih) +private theorem helper_branch_626.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ + _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), + let L : Finset (Fin ett.rounds) := ExtensionBaseCaseOneIndices ett p indices b; + let U : Finset (Fin k) := L.biUnion fun (t : Fin ett.rounds) => ett.series.data.stored t.succ; + ( + ∀ (a : Fin trace.steps), trace.slot a ∈ L) → ( + ∀ (a : Fin trace.steps), trace.gamma a ∈ U) → ( + ∀ (a : Fin trace.steps), trace.delta a ∈ U) → ( + ∀ (n : Fin (trace.steps + (1 : ℕ))), (IsProperEdgeColoring G (trace.coloring n) ∧ + IsOneEdgeUncolored (trace.coloring n) e0) ∧ ( + ∀ c ∈ U, c ∈ PresentColors G (trace.coloring n) terminalSupport) ∧ ( + ∀ (a : Fin trace.steps), (↑n : ℕ) ≤ (↑a : ℕ) → trace.gamma a ∈ PresentColors G (trace.coloring + n) u) ∧ ( + ∀ (a : Fin trace.steps), (↑a : ℕ) = (↑n : ℕ) → trace.delta a ∈ MissingColors G (trace.coloring + n) u) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ L → ( + ∀ (a : Fin trace.steps), (↑a : ℕ) < (↑n : ℕ) → trace.slot a ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring n) gammaS deltaS) → + ∀ (a : Fin trace.steps), trace.delta a ∈ MissingColors G (trace.coloring a.castSucc) u ∧ + trace.gamma a ∈ PresentColors G (trace.coloring a.castSucc) u ∧ trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) terminalSupport ∧ trace.delta a ∈ + PresentColors G (trace.coloring a.castSucc) terminalSupport ∧ ETTStrongInterchangeable ett + (trace.slot a) terminalSupport (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseCaseOneIndices ett p indices + b → ( + ∀ (c : Fin trace.steps), (↑c : ℕ) ≤ (↑a : ℕ) → trace.slot c ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b + trace L U slot_mem gamma_mem_U delta_mem_U invariant a + rcases invariant a.castSucc with + ⟨hgood, hterminal, hfuture, hnext, hsurvivor⟩ + have hmissing := hnext a rfl + have hpresent := hfuture a (by rfl) + have hterminalGamma := hterminal (trace.gamma a) (gamma_mem_U a) + have hterminalDelta := hterminal (trace.delta a) (delta_mem_U a) + have hsi : ETTStrongInterchangeable ett (trace.slot a) terminalSupport + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) := by + apply hsurvivor (trace.slot a) (trace.gamma a) (trace.delta a) + (slot_mem a) + · intro c hc hca + have hdesc := trace.strictlyDescending c a hc + rw [hca] at hdesc + exact (Nat.lt_irrefl _ hdesc) + · exact trace.chosenSupport a + · exact trace.gammaField a + · exact trace.deltaField a + refine ⟨hmissing, hpresent, hterminalGamma, hterminalDelta, hsi, ?_⟩ + intro s gammaS deltaS hs hnot hsupport hgammaS hdeltaS + have hnextInvariant := invariant a.succ + exact hnextInvariant.2.2.2.2 s gammaS deltaS hs (by + intro c hc + apply hnot c + change c.val < a.val + 1 at hc + omega) hsupport hgammaS hdeltaS + +theorem ExtensionBaseAlgorithmBInduction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) (rho1 : PartialEdgeColoring E k) (u : V) + (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds) + (gamma delta : Fin (p + 1) → Fin k) (b : Fin (p + 1)) + (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u + p indices b) + (_ : trace.steps = b.val) + (hposition : ∀ a : Fin trace.steps, + (trace.position a).val + a.val + 1 = b.val) + (htraceGamma : ∀ a : Fin trace.steps, + trace.gamma a = gamma (trace.position a)) + (htraceDelta : ∀ a : Fin trace.steps, + trace.delta a = delta (trace.position a)) + (hproper : IsProperEdgeColoring G rho1) + (hone : IsOneEdgeUncolored rho1 e0) + (hchain : ∀ a : Fin p, gamma a.succ = delta a.castSucc) + (hdistinct : Function.Injective (Fin.cons (gamma 0) delta)) + (hselected : gamma b ∈ MissingColors G rho1 u) + (hminimal : ∀ a : Fin (p + 1), a.val < b.val → + gamma a ∉ MissingColors G rho1 u) + (hinitialSI : ∀ a : Fin (p + 1), a.val < b.val → + ETTStrongInterchangeable ett (indices a) terminalSupport rho1 + (gamma a) (delta a)) + (hterminalNoMissing : + MissingColors G rho1 terminalSupport ∩ + ((ExtensionBaseCaseOneIndices ett p indices b).biUnion + fun t => ett.series.data.stored t.succ) = ∅) + (hstored : ∀ a, + ett.series.data.stored (indices a).succ = {gamma a, delta a}) : + (∀ a : Fin (trace.steps + 1), + IsProperEdgeColoring G (trace.coloring a) ∧ + IsOneEdgeUncolored (trace.coloring a) e0) ∧ + (∀ a : Fin trace.steps, + trace.delta a ∈ MissingColors G (trace.coloring a.castSucc) u ∧ + trace.gamma a ∈ PresentColors G (trace.coloring a.castSucc) u ∧ + trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) terminalSupport ∧ + trace.delta a ∈ + PresentColors G (trace.coloring a.castSucc) terminalSupport ∧ + ETTStrongInterchangeable ett (trace.slot a) terminalSupport + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ ExtensionBaseCaseOneIndices ett p indices b → + (∀ c : Fin trace.steps, c.val ≤ a.val → trace.slot c ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport + (trace.coloring a.succ) gammaS deltaS) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ ExtensionBaseCaseOneIndices ett p indices b → + (∀ a : Fin trace.steps, trace.slot a ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport + (trace.coloring (Fin.last trace.steps)) gammaS deltaS := by + classical + let L := ExtensionBaseCaseOneIndices ett p indices b + let U := L.biUnion fun t => ett.series.data.stored t.succ + let colorChain : Fin (p + 2) → Fin k := Fin.cons (gamma 0) delta + have gamma_eq_chain (r : Fin (p + 1)) : + gamma r = colorChain r.castSucc := by + cases r using Fin.cases with + | zero => simp [colorChain] + | succ q => simpa [colorChain] using hchain q + have delta_eq_chain (r : Fin (p + 1)) : + delta r = colorChain r.succ := by + simp [colorChain] + have trace_colors_ne (a : Fin trace.steps) : + trace.gamma a ≠ trace.delta a := by + rw [htraceGamma a, htraceDelta a, gamma_eq_chain, delta_eq_chain] + intro h + have hi := hdistinct h + have hv := congrArg Fin.val hi + simp at hv + have future_gamma_ne (a c : Fin trace.steps) (hac : a.val < c.val) : + trace.gamma c ≠ trace.gamma a ∧ trace.gamma c ≠ trace.delta a := by + rw [htraceGamma c, htraceGamma a, htraceDelta a, + gamma_eq_chain, gamma_eq_chain, delta_eq_chain] + constructor <;> intro h + · have hi := hdistinct h + have hv := congrArg Fin.val hi + have ha := hposition a + have hc := hposition c + simp at hv + omega + · have hi := hdistinct h + have hv := congrArg Fin.val hi + have ha := hposition a + have hc := hposition c + simp at hv + omega + have next_delta_eq_gamma (a c : Fin trace.steps) + (hca : c.val = a.val + 1) : trace.delta c = trace.gamma a := by + have ha := hposition a + have hc := hposition c + have hq : (trace.position c).val < p := by + have hpos := (trace.position a).isLt + omega + let q : Fin p := ⟨(trace.position c).val, hq⟩ + have hpc : trace.position c = q.castSucc := by + apply Fin.ext + rfl + have hpa : trace.position a = q.succ := by + apply Fin.ext + simp [q] + omega + rw [htraceDelta c, htraceGamma a, hpc, hpa] + exact (hchain q).symm + have slot_mem (a : Fin trace.steps) : trace.slot a ∈ L := by + change trace.slot a ∈ ExtensionBaseCaseOneIndices ett p indices b + rw [← trace.enumerates] + exact Finset.mem_image.mpr ⟨a, Finset.mem_univ _, rfl⟩ + have gamma_mem_U (a : Fin trace.steps) : trace.gamma a ∈ U := by + apply Finset.mem_biUnion.mpr + refine ⟨trace.slot a, slot_mem a, ?_⟩ + rw [trace.slotIdentity a, hstored (trace.position a), + ← htraceGamma a] + simp + have delta_mem_U (a : Fin trace.steps) : trace.delta a ∈ U := by + apply Finset.mem_biUnion.mpr + refine ⟨trace.slot a, slot_mem a, ?_⟩ + rw [trace.slotIdentity a, hstored (trace.position a), + ← htraceDelta a] + simp + have initial_terminal_present (c : Fin k) (hc : c ∈ U) : + c ∈ PresentColors G rho1 terminalSupport := by + have hn : c ∉ MissingColors G rho1 terminalSupport := by + intro hm + have hi : c ∈ MissingColors G rho1 terminalSupport ∩ U := + Finset.mem_inter.mpr ⟨hm, hc⟩ + change c ∈ MissingColors G rho1 terminalSupport ∩ + ((ExtensionBaseCaseOneIndices ett p indices b).biUnion + fun t => ett.series.data.stored t.succ) at hi + rw [hterminalNoMissing] at hi + simp at hi + simpa [MissingColors] using hn + have initial_gamma_present (a : Fin trace.steps) : + trace.gamma a ∈ PresentColors G rho1 u := by + have hn := hminimal (trace.position a) (trace.positionBefore a) + rw [← htraceGamma a] at hn + simpa [MissingColors] using hn + have initial_survivor (s : Fin ett.rounds) (gammaS deltaS : Fin k) + (hs : s ∈ L) + (hgs : ett.series.data.gamma s.succ = some gammaS) + (hds : ett.series.data.delta s.succ = some deltaS) : + ETTStrongInterchangeable ett s terminalSupport rho1 gammaS deltaS := by + change s ∈ ExtensionBaseCaseOneIndices ett p indices b at hs + rw [← trace.enumerates] at hs + rcases Finset.mem_image.mp hs with ⟨a, -, ha⟩ + have hgammaS : gammaS = trace.gamma a := by + apply Option.some.inj + rw [← hgs, ← ha] + exact trace.gammaField a + have hdeltaS : deltaS = trace.delta a := by + apply Option.some.inj + rw [← hds, ← ha] + exact trace.deltaField a + have hsi := hinitialSI (trace.position a) (trace.positionBefore a) + rw [← trace.slotIdentity a, ← htraceGamma a, ← htraceDelta a] at hsi + rw [ha] at hsi + simpa [hgammaS, hdeltaS] using hsi + have swap_preserves_one {phi : PartialEdgeColoring E k} + {alpha beta : Fin k} {z : Sum V E} + (h : IsOneEdgeUncolored phi e0) : + IsOneEdgeUncolored (TwoColorComponentSwap G phi alpha beta z) e0 := by + constructor + · simp [TwoColorComponentSwap, h.1] + · intro e he0 + obtain ⟨c, hc⟩ := h.2 e he0 + by_cases heK : + Sum.inr e ∈ TwoColorComponent G phi alpha beta z + · by_cases heAlpha : phi e = some alpha + · exact ⟨beta, by + simp [TwoColorComponentSwap, heK, heAlpha]⟩ + · by_cases heBeta : phi e = some beta + · exact ⟨alpha, by + simp [TwoColorComponentSwap, heK, heBeta]⟩ + · exact ⟨c, by + simpa [TwoColorComponentSwap, heK, heAlpha, heBeta] using hc⟩ + · exact ⟨c, by + simpa [TwoColorComponentSwap, heK] using hc⟩ + have swap_present_other {phi : PartialEdgeColoring E k} {v : V} + {alpha beta c : Fin k} {z : Sum V E} + (hc : c ∈ PresentColors G phi v) (hca : c ≠ alpha) + (hcb : c ≠ beta) : + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hc ⊢ + rcases hc with ⟨e, hev, hec⟩ + refine ⟨e, hev, ?_⟩ + by_cases heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z + · simp [TwoColorComponentSwap, heK, hec, hca, hcb] + · simpa [TwoColorComponentSwap, heK] using hec + have root_swap_exchange := @helper_root_swap_exchange_230 V E inferInstance inferInstance G k + have swap_preserves_present {phi : PartialEdgeColoring E k} {v : V} + {alpha beta : Fin k} {z : Sum V E} + (hne : alpha ≠ beta) + (halpha : alpha ∈ PresentColors G phi v) + (hbeta : beta ∈ PresentColors G phi v) : + ∀ c : Fin k, c ∈ PresentColors G phi v → + c ∈ PresentColors G + (TwoColorComponentSwap G phi alpha beta z) v := by + exact @helper_swap_preserves_present_295 V E inferInstance inferInstance G k + swap_present_other phi v alpha beta z halpha hbeta + have invariant := @helper_invariant_383 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett terminalSupport rho1 u p indices gamma delta b trace hposition htraceDelta + hproper hone hchain hselected trace_colors_ne future_gamma_ne next_delta_eq_gamma slot_mem + gamma_mem_U delta_mem_U initial_terminal_present initial_gamma_present initial_survivor + swap_preserves_one swap_present_other root_swap_exchange swap_preserves_present + refine ⟨?_, ?_, ?_⟩ + · intro a + exact (invariant a).1 + · exact @helper_branch_626 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport rho1 u p indices gamma delta b trace slot_mem gamma_mem_U + delta_mem_U invariant + · intro s gammaS deltaS hs hnot _ _ _ + change s ∈ L at hs + have hsImage : s ∈ Finset.univ.image trace.slot := by + rw [trace.enumerates] + exact hs + rcases Finset.mem_image.mp hsImage with ⟨a, -, ha⟩ + exact False.elim (hnot a ha) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInvariant.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInvariant.lean new file mode 100644 index 0000000000..429e914c16 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInvariant.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace + +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent + +/-! +# Extension Base Algorithm BInvariant + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- +Properness, missing-color, path-component and preservation conditions along Algorithm B's swaps. -/ +def ExtensionBaseAlgorithmBInvariant {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + 1) → Fin ett.rounds) (b : Fin (p + 1)) + (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b) : Prop := + (∀ a : Fin (trace.steps + 1), + IsProperEdgeColoring G (trace.coloring a) ∧ IsOneEdgeUncolored (trace.coloring a) e0) ∧ + (∀ a : Fin trace.steps, + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ + trace.delta a ∈ MissingColors G (trace.coloring a.castSucc) u ∧ + TwoColorNontrivialPathComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl u) ∧ + (∀ w : V, + w ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc) → + Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl u) → + w = terminalSupport) ∧ + (Sum.inl terminalSupport ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl u) → + ¬Set.Subsingleton + ((TwoColorIncidenceGraph G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a)).neighborSet + (Sum.inl terminalSupport))) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ ExtensionBaseCaseOneIndices ett p indices b → + (∀ c : Fin trace.steps, c.val ≤ a.val → trace.slot c ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport (trace.coloring a.succ) gammaS + deltaS) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ ExtensionBaseCaseOneIndices ett p indices b → + (∀ a : Fin trace.steps, trace.slot a ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport (trace.coloring (Fin.last trace.steps)) + gammaS deltaS + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBSingleStep.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBSingleStep.lean new file mode 100644 index 0000000000..9f657242cb --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBSingleStep.lean @@ -0,0 +1,152 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable + +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath + +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.TwoColorPathComponentNotCycle + +/-! +# Extension Base Algorithm BSingle Step + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseAlgorithmBSingleStep {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (t : Fin ett.rounds) (terminalSupport : V) + (phi : PartialEdgeColoring E k) (u : V) (alpha beta : Fin k) + (hproper : IsProperEdgeColoring G phi) + (hSI : ETTStrongInterchangeable ett t terminalSupport phi alpha beta) + (hbetaMissing : beta ∈ MissingColors G phi u) + (halphaPresent : alpha ∈ PresentColors G phi u) + (hterminalAlphaPresent : alpha ∈ PresentColors G phi terminalSupport) + (hterminalBetaPresent : beta ∈ PresentColors G phi terminalSupport) : + TwoColorNontrivialPathComponent G phi alpha beta (Sum.inl u) ∧ + (∀ w : V, + w ∈ TreeSequenceVertexSet + (ett.series.data.tree t.succ.castSucc) → + Sum.inl w ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → + w = terminalSupport) ∧ + (Sum.inl terminalSupport ∈ + TwoColorComponent G phi alpha beta (Sum.inl u) → + ¬ Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl terminalSupport))) := by + classical + let H := TwoColorIncidenceGraph G phi alpha beta + let C := TwoColorComponent G phi alpha beta (Sum.inl u) + have hne : alpha ≠ beta := hSI.1 + have hbetaNotPresent : beta ∉ PresentColors G phi u := + (Finset.mem_sdiff.mp hbetaMissing).2 + obtain ⟨eAlpha, heAlphaIncident, heAlphaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + using halphaPresent + have heAlphaAdj : H.Adj (Sum.inl u) (Sum.inr eAlpha) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro heAlphaIncident (Or.inl heAlphaColor) + have heAlphaComponent : Sum.inr eAlpha ∈ C := by + change H.connectedComponentMk (Sum.inr eAlpha) = + H.connectedComponentMk (Sum.inl u) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + heAlphaAdj).symm + have huComponent : Sum.inl u ∈ C := by + rfl + have huSubsingleton : Set.Subsingleton (H.neighborSet (Sum.inl u)) := by + intro x hx y hy + cases x with + | inl x => + simp [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] at hx + | inr e => + cases y with + | inl y => + simp [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] at hy + | inr f => + have hxData : Incident G u e ∧ + (phi e = some alpha ∨ phi e = some beta) := by + simpa [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] + using hx + have hyData : Incident G u f ∧ + (phi f = some alpha ∨ phi f = some beta) := by + simpa [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] + using hy + have heColor : phi e = some alpha := by + rcases hxData.2 with he | he + · exact he + · exact False.elim (hbetaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hxData.1, he⟩)) + have hfColor : phi f = some alpha := by + rcases hyData.2 with hf | hf + · exact hf + · exact False.elim (hbetaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hyData.1, hf⟩)) + congr 1 + by_contra hef + exact (hproper hef ⟨u, hxData.1, hyData.1⟩ heColor) hfColor + have hpath : TwoColorPathComponent G phi alpha beta (Sum.inl u) := by + refine ⟨hne, Sum.inl u, huComponent, ?_⟩ + simpa [H] using huSubsingleton + have hnontrivial : TwoColorNontrivialPathComponent G phi alpha beta + (Sum.inl u) := by + exact ⟨hpath, eAlpha, heAlphaComponent⟩ + refine ⟨hnontrivial, ?_, ?_⟩ + · intro w hwTree hwComponent + by_contra hwne + obtain ⟨hcycle, -, -⟩ := hSI.2.2.2.choose_spec.2.2.2 w hwTree hwne + have huInW : Sum.inl u ∈ + TwoColorComponent G phi alpha beta (Sum.inl w) := by + change H.connectedComponentMk (Sum.inl u) = + H.connectedComponentMk (Sum.inl w) + change H.connectedComponentMk (Sum.inl w) = + H.connectedComponentMk (Sum.inl u) at hwComponent + exact hwComponent.symm + have hpathW : TwoColorPathComponent G phi alpha beta (Sum.inl w) := by + refine ⟨hne, Sum.inl u, huInW, ?_⟩ + simpa [H] using huSubsingleton + exact (TwoColorPathComponentNotCycle G phi alpha beta (Sum.inl w) + hpathW) hcycle + · intro hterminalComponent hsub + obtain ⟨eAlphaN, heAlphaNIncident, heAlphaNColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + using hterminalAlphaPresent + obtain ⟨eBetaN, heBetaNIncident, heBetaNColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + using hterminalBetaPresent + have hedgeNe : eAlphaN ≠ eBetaN := by + intro heq + subst eBetaN + exact hne (Option.some.inj (heAlphaNColor.symm.trans heBetaNColor)) + have hAlphaNeighbor : Sum.inr eAlphaN ∈ + H.neighborSet (Sum.inl terminalSupport) := by + simpa [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] using + And.intro heAlphaNIncident (Or.inl heAlphaNColor) + have hBetaNeighbor : Sum.inr eBetaN ∈ + H.neighborSet (Sum.inl terminalSupport) := by + simpa [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] using + And.intro heBetaNIncident (Or.inr heBetaNColor) + have hnodes := hsub hAlphaNeighbor hBetaNeighbor + exact hedgeNe (Sum.inr.inj hnodes) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTrace.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTrace.lean new file mode 100644 index 0000000000..7c9577df65 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTrace.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneIndices +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass + +/-! +# Extension Base Algorithm BTrace + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A descending enumeration of case-one indices and the associated two-color component swaps. -/ +structure ExtensionBaseAlgorithmBTrace {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (rho1 : PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds) + (b : Fin (p + 1)) where + /-- The number of component swaps in the trace. -/ + steps : ℕ + /-- The selected position in the indexed list at each swap. -/ + position : Fin steps → Fin (p + 1) + /-- The extension-series slot processed by each swap. -/ + slot : Fin steps → Fin ett.rounds + /-- The auxiliary color or color family used by this configuration. -/ + gamma : Fin steps → Fin k + /-- The companion color used for the component swap at each stage. -/ + delta : Fin steps → Fin k + /-- The partial coloring or sequence of partial colorings recorded by this certificate. -/ + coloring : Fin (steps + 1) → PartialEdgeColoring E k + initialColoring : coloring 0 = rho1 + positionBefore : ∀ a, (position a).val < b.val + slotIdentity : ∀ a, slot a = indices (position a) + enumerates : Finset.univ.image slot = ExtensionBaseCaseOneIndices ett p indices b + strictlyDescending : ∀ a c, a.val < c.val → (slot c).val < (slot a).val + chosenSupport : ∀ a, ett.series.data.chosenVertex (slot a).succ = some terminalSupport + extensionKind : ∀ a, ett.series.data.kind (slot a).succ = some TashkinovExtensionKind.PE + gammaField : ∀ a, ett.series.data.gamma (slot a).succ = some (gamma a) + deltaField : ∀ a, ett.series.data.delta (slot a).succ = some (delta a) + transition : + ∀ a, + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (gamma a) (delta a) (Sum.inl u) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTraceExists.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTraceExists.lean new file mode 100644 index 0000000000..bd0371558a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTraceExists.lean @@ -0,0 +1,122 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace + +/-! +# Extension Base Algorithm BTrace Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseAlgorithmBTraceExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) (rho1 : PartialEdgeColoring E k) (u : V) + (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds) + (gamma delta : Fin (p + 1) → Fin k) (b : Fin (p + 1)) + (hincreasing : ∀ a c, a.val < c.val → + (indices a).val < (indices c).val) + (hsupport : ∀ a, + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : ∀ a, + ett.series.data.kind (indices a).succ = + some TashkinovExtensionKind.PE) + (hgamma : ∀ a, + ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : ∀ a, + ett.series.data.delta (indices a).succ = some (delta a)) : + ∃ trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u + p indices b, + trace.steps = b.val ∧ + (∀ a : Fin trace.steps, + (trace.position a).val + a.val + 1 = b.val) ∧ + (∀ a : Fin trace.steps, + trace.gamma a = gamma (trace.position a)) ∧ + ∀ a : Fin trace.steps, + trace.delta a = delta (trace.position a) := by + classical + let positionNat : ℕ → Fin (p + 1) := fun a => + ⟨b.val - 1 - a, by + have hb := b.isLt + omega⟩ + let coloringNat : ℕ → PartialEdgeColoring E k := fun n => + Nat.rec rho1 (fun a phi => + TwoColorComponentSwap G phi (gamma (positionNat a)) + (delta (positionNat a)) (Sum.inl u)) n + let trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u + p indices b := { + steps := b.val + position := fun a => positionNat a.val + slot := fun a => indices (positionNat a.val) + gamma := fun a => gamma (positionNat a.val) + delta := fun a => delta (positionNat a.val) + coloring := fun a => coloringNat a.val + initialColoring := by simp [coloringNat] + positionBefore := by + intro a + simp only [positionNat] + omega + slotIdentity := by intro a; rfl + enumerates := by + ext s + simp only [Finset.mem_image, Finset.mem_univ, true_and, + ExtensionBaseCaseOneIndices, Finset.mem_filter] + constructor + · rintro ⟨a, ha⟩ + refine ⟨positionNat a.val, ?_, ha⟩ + simp only [positionNat] + omega + · rintro ⟨q, hq, hqs⟩ + let a : Fin b.val := ⟨b.val - 1 - q.val, by omega⟩ + have hpos : positionNat a.val = q := by + apply Fin.ext + simp only [positionNat, a] + omega + exact ⟨a, by simpa [hpos] using hqs⟩ + strictlyDescending := by + intro a c hac + apply hincreasing + simp only [positionNat] + omega + chosenSupport := by + intro a + exact hsupport (positionNat a.val) + extensionKind := by + intro a + exact hkind (positionNat a.val) + gammaField := by + intro a + exact hgamma (positionNat a.val) + deltaField := by + intro a + exact hdelta (positionNat a.val) + transition := by + intro a + simp only [coloringNat, Fin.val_succ, Fin.val_castSucc] + } + refine ⟨trace, rfl, ?_, ?_, ?_⟩ + · intro a + simp only [trace, positionNat] + omega + · intro a + rfl + · intro a + rfl + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean new file mode 100644 index 0000000000..6d58f9bae3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean @@ -0,0 +1,2091 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmCInvariant +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmCTrace +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StrongInterchangeabilityKempePreserved +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent + +/-! +# Extension Base Algorithm C + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch527Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) (terminalSlot : Fin ett.rounds) + (mu0 : PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (gamma delta : Fin (p + (1 : ℕ)) → Fin k) + (hterminalAtEnd : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) + (hsupport : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.kind (indices a).succ = some TashkinovExtensionKind.PE) + (hgamma : ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) + (hterminalInClass : + terminalSlot ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport : + Finset (Fin ett.rounds))), + let reversePosition : Fin p → Fin (p + (1 : ℕ)) := fun (a : Fin p) ↦ a.rev.castSucc; + let slot : Fin p → Fin ett.rounds := fun (a : Fin p) ↦ indices (reversePosition a); + let traceGamma : Fin p → Fin k := fun (a : Fin p) ↦ gamma (reversePosition a); + let traceDelta : Fin p → Fin k := fun (a : Fin p) ↦ delta (reversePosition a); + let nextColoring : ℕ → PartialEdgeColoring E k → PartialEdgeColoring E k := + fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ + if ha : a < p then + TwoColorComponentSwap G phi (traceGamma (⟨a, ha⟩ : Fin p)) (traceDelta (⟨a, ha⟩ : Fin p)) + (Sum.inl u) + else phi; + let coloringNat : ℕ → PartialEdgeColoring E k := fun (t : ℕ) ↦ + Nat.rec mu0 (fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ nextColoring a phi) t; + let coloring : Fin (p + (1 : ℕ)) → PartialEdgeColoring E k := fun (a : Fin (p + (1 : ℕ))) ↦ + coloringNat (↑a : ℕ); + ∀ + (hslotEnumerates : + Finset.image slot Finset.univ = + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport : + Finset (Fin ett.rounds)).erase + terminalSlot) + (hslotDescending : ∀ (a b : Fin p), (↑a : ℕ) < (↑b : ℕ) → (↑(slot b) : ℕ) < (↑(slot a) : ℕ)) + (htransition : + ∀ (a : Fin p), + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (traceGamma a) (traceDelta a) (Sum.inl u)), + let trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 u := + { + steps := p, slot := slot, gamma := traceGamma, delta := traceDelta, coloring := coloring, + initialColoring := of_eq_true (eq_self mu0), terminalAtEnd := hterminalAtEnd, + terminalInClass := hterminalInClass, enumerates := hslotEnumerates, + strictlyDescending := hslotDescending, + chosenSupport := fun (a : Fin p) ↦ hsupport (reversePosition a), + extensionKind := fun (a : Fin p) ↦ hkind (reversePosition a), + gammaField := fun (a : Fin p) ↦ hgamma (reversePosition a), + deltaField := fun (a : Fin p) ↦ hdelta (reversePosition a), transition := htransition : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 u }; + ∀ (_ : (∀ (a : Fin p), trace.gamma a ≠ trace.delta a)) + (_ : + (∀ (a b : Fin p) (_ : (↑a : ℕ) < (↑b : ℕ)), + trace.gamma b ≠ trace.gamma a ∧ trace.gamma b ≠ trace.delta a)), + let U : Finset (Fin k) := + ((ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport : + Finset (Fin ett.rounds)).erase + terminalSlot : + Finset (Fin ett.rounds)).biUnion + fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ; + ∀ + (_ : + (∀ (a : Fin p), + trace.slot a ∈ + ((ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport : + Finset (Fin ett.rounds)).erase + terminalSlot : + Finset (Fin ett.rounds)))) + (_ : (∀ (a : Fin p), trace.gamma a ∈ U)) (_ : (∀ (a : Fin p), trace.delta a ∈ U)) + (_ : (∀ (a c : Fin p) (_ : (↑c : ℕ) = (↑a : ℕ) + (1 : ℕ)), trace.delta c = trace.gamma a)) + (_ : + (∀ (t : Fin ett.rounds) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (_ : IsProperEdgeColoring G phi) + (_ : ETTStrongInterchangeable ett t terminalSupport phi alpha beta) + (_ : beta ∈ MissingColors G phi u) (_ : alpha ∈ PresentColors G phi u) + (_ : alpha ∈ PresentColors G phi terminalSupport) + (_ : beta ∈ PresentColors G phi terminalSupport), + TwoColorNontrivialPathComponent G phi alpha beta (Sum.inl u) ∧ + (∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc), + Sum.inl w ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → w = terminalSupport) ∧ + (Sum.inl terminalSupport ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → + ¬((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl terminalSupport)).Subsingleton))) + (_ : + (∀ {phi : PartialEdgeColoring E k} {alpha beta : Fin k} {z : V ⊕ E} + (_ : IsOneEdgeUncolored phi e0), + IsOneEdgeUncolored (TwoColorComponentSwap G phi alpha beta z) e0)) + (_ : + (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta c : Fin k} {z : V ⊕ E} + (_ : c ∈ PresentColors G phi v) (_ : c ≠ alpha) (_ : c ≠ beta), + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v)) + (_ : + (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} (_ : alpha ≠ beta) + (_ : beta ∈ MissingColors G phi v) (_ : alpha ∈ PresentColors G phi v), + alpha ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ∧ + beta ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v)) + (_ : + (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : V ⊕ E} + (_ : alpha ≠ beta) (_ : alpha ∈ PresentColors G phi v) (_ : beta ∈ PresentColors G phi v), + ∀ c ∈ PresentColors G phi v, + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v)) + (a : Fin trace.steps) + (_ : + ((IsProperEdgeColoring G (trace.coloring a.castSucc) ∧ + IsOneEdgeUncolored (trace.coloring a.castSucc) e0) ∧ + (∀ c ∈ U, c ∈ PresentColors G (trace.coloring a.castSucc) terminalSupport) ∧ + (∀ (a_1 : Fin trace.steps), + (↑a.castSucc : ℕ) ≤ (↑a_1 : ℕ) → + trace.gamma a_1 ∈ PresentColors G (trace.coloring a.castSucc) u) ∧ + (∀ (a_1 : Fin trace.steps), + (↑a_1 : ℕ) = (↑a.castSucc : ℕ) → + trace.delta a_1 ∈ MissingColors G (trace.coloring a.castSucc) u) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ + ((ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport : + Finset (Fin ett.rounds)).erase + terminalSlot : + Finset (Fin ett.rounds)) → + (∀ (a_2 : Fin trace.steps), (↑a_2 : ℕ) < (↑a.castSucc : ℕ) → trace.slot a_2 ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport (trace.coloring a.castSucc) gammaS + deltaS)), + (IsProperEdgeColoring G (trace.coloring a.succ) ∧ + IsOneEdgeUncolored (trace.coloring a.succ) e0) ∧ + (∀ c ∈ U, c ∈ PresentColors G (trace.coloring a.succ) terminalSupport) ∧ + (∀ (a_1 : Fin trace.steps), + (↑a.succ : ℕ) ≤ (↑a_1 : ℕ) → + trace.gamma a_1 ∈ PresentColors G (trace.coloring a.succ) u) ∧ + (∀ (a_1 : Fin trace.steps), + (↑a_1 : ℕ) = (↑a.succ : ℕ) → + trace.delta a_1 ∈ MissingColors G (trace.coloring a.succ) u) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ + ((ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport : + Finset (Fin ett.rounds)).erase + terminalSlot : + Finset (Fin ett.rounds)) → + (∀ (a_2 : Fin trace.steps), (↑a_2 : ℕ) < (↑a.succ : ℕ) → trace.slot a_2 ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport (trace.coloring a.succ) gammaS deltaS + +private abbrev helperContinuation1280Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot jSlot : Fin ett.rounds) (mu0 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (gamma delta : Fin (p + (1 : ℕ)) → Fin k) + (_ : IsProperEdgeColoring G mu0) (_ : IsOneEdgeUncolored mu0 e0) + (hterminalAtEnd : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) + (hsupport : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.kind (indices a).succ = some TashkinovExtensionKind.PE) + (hgamma : ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) + (_ : (∀ (a : Fin p), gamma a.succ = delta a.castSucc)) + (_ : + (∀ + s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot, + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree s.succ.castSucc))) + (_ : gamma (Fin.last p) ∈ MissingColors G mu0 u) + (_ : (∀ (a : Fin p), gamma a.castSucc ∈ PresentColors G mu0 u)) + (_ : + (∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) + (_ : + s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot) + (_ : ett.series.data.gamma s.succ = some gammaS) + (_ : ett.series.data.delta s.succ = some deltaS), + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS)) + (_ : + (MissingColors G mu0 terminalSupport ∩ + ((ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot).biUnion + fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ) = + ∅), + ∀ + (hterminalInClass : + terminalSlot ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport : + Finset (Fin ett.rounds))), + let reversePosition : Fin p → Fin (p + (1 : ℕ)) := fun (a : Fin p) ↦ a.rev.castSucc; + let slot : Fin p → Fin ett.rounds := fun (a : Fin p) ↦ indices (reversePosition a); + let traceGamma : Fin p → Fin k := fun (a : Fin p) ↦ gamma (reversePosition a); + let traceDelta : Fin p → Fin k := fun (a : Fin p) ↦ delta (reversePosition a); + let nextColoring : ℕ → PartialEdgeColoring E k → PartialEdgeColoring E k := + fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ + if ha : a < p then + TwoColorComponentSwap G phi (traceGamma (⟨a, ha⟩ : Fin p)) (traceDelta (⟨a, ha⟩ : Fin p)) + (Sum.inl u) + else phi; + let coloringNat : ℕ → PartialEdgeColoring E k := fun (t : ℕ) ↦ + Nat.rec mu0 (fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ nextColoring a phi) t; + let coloring : Fin (p + (1 : ℕ)) → PartialEdgeColoring E k := fun (a : Fin (p + (1 : ℕ))) ↦ + coloringNat (↑a : ℕ); + ∀ + (hslotEnumerates : + Finset.image slot Finset.univ = + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport : + Finset (Fin ett.rounds)).erase + terminalSlot) + (hslotDescending : ∀ (a b : Fin p), (↑a : ℕ) < (↑b : ℕ) → (↑(slot b) : ℕ) < (↑(slot a) : ℕ)) + (htransition : + ∀ (a : Fin p), + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (traceGamma a) (traceDelta a) (Sum.inl u)), + let trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 u := + { + steps := p, slot := slot, gamma := traceGamma, delta := traceDelta, coloring := coloring, + initialColoring := of_eq_true (eq_self mu0), terminalAtEnd := hterminalAtEnd, + terminalInClass := hterminalInClass, enumerates := hslotEnumerates, + strictlyDescending := hslotDescending, + chosenSupport := fun (a : Fin p) ↦ hsupport (reversePosition a), + extensionKind := fun (a : Fin p) ↦ hkind (reversePosition a), + gammaField := fun (a : Fin p) ↦ hgamma (reversePosition a), + deltaField := fun (a : Fin p) ↦ hdelta (reversePosition a), transition := htransition : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 u }; + ∀ (_ : (∀ (a : Fin p), trace.gamma a ≠ trace.delta a)) + (_ : + (∀ (a b : Fin p) (_ : (↑a : ℕ) < (↑b : ℕ)), + trace.gamma b ≠ trace.gamma a ∧ trace.gamma b ≠ trace.delta a)), + let U : Finset (Fin k) := + ((ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport : + Finset (Fin ett.rounds)).erase + terminalSlot : + Finset (Fin ett.rounds)).biUnion + fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ; + ∀ (_ : (∀ (a : Fin p), (↑(reversePosition a) : ℕ) + (↑a : ℕ) + (1 : ℕ) = p)) + (_ : (∀ (a : Fin p), trace.gamma a = gamma (reversePosition a))) + (_ : (∀ (a : Fin p), trace.delta a = delta (reversePosition a))) + (_ : + (∀ (a : Fin p), + trace.slot a ∈ + ((ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport : + Finset (Fin ett.rounds)).erase + terminalSlot : + Finset (Fin ett.rounds)))) + (_ : (∀ (a : Fin p), trace.gamma a ∈ U)) (_ : (∀ (a : Fin p), trace.delta a ∈ U)), + ExtensionBaseAlgorithmCInvariant ett terminalSupport hterminalSupport terminalSlot jSlot mu0 + u trace + +private noncomputable abbrev helperTrace1922.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq E] → + {G : LooplessMultigraph V E} → + {k : ℕ} → + {e0 : E} → + {input : PartialEdgeColoring E k} → + {T : TreeSequence G e0} → + {generating : PartialEdgeColoring E k} → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (terminalSupport : V) → + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) → + (terminalSlot : Fin ett.rounds) → + (mu0 : PartialEdgeColoring E k) → + (u : V) → + (p : ℕ) → + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) → + (gamma delta : Fin (p + (1 : ℕ)) → Fin k) → + (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds → + (∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.chosenVertex (indices a).succ = + some terminalSupport) → + (∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.kind (indices a).succ = + some TashkinovExtensionKind.PE) → + (∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.gamma (indices a).succ = + some (gamma a)) → + (∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.delta (indices a).succ = + some (delta a)) → + let supportClass : + Finset (Fin ett.rounds) := + ExtensionBaseSupportClass ett + terminalSupport hterminalSupport + terminalSupport; + terminalSlot ∈ supportClass → + let reversePosition : + Fin p → Fin (p + (1 : ℕ)) := + fun (a : Fin p) ↦ a.rev.castSucc; + let slot : Fin p → Fin ett.rounds := + fun (a : Fin p) ↦ + indices (reversePosition a); + let traceGamma : Fin p → Fin k := + fun (a : Fin p) ↦ + gamma (reversePosition a); + let traceDelta : Fin p → Fin k := + fun (a : Fin p) ↦ + delta (reversePosition a); + let nextColoring : + ℕ → + PartialEdgeColoring E k → + PartialEdgeColoring E k := + fun (a : ℕ) + (phi : PartialEdgeColoring E k) ↦ + if ha : a < p then + TwoColorComponentSwap G phi + (traceGamma (⟨a, ha⟩ : Fin p)) + (traceDelta (⟨a, ha⟩ : Fin p)) + (Sum.inl u) + else phi; + let coloringNat : + ℕ → PartialEdgeColoring E k := + fun (t : ℕ) ↦ + Nat.rec mu0 + (fun (a : ℕ) + (phi : PartialEdgeColoring E k) ↦ + nextColoring a phi) + t; + let coloring : + Fin (p + (1 : ℕ)) → + PartialEdgeColoring E k := + fun (a : Fin (p + (1 : ℕ))) ↦ + coloringNat (↑a : ℕ); + Finset.image slot Finset.univ = + supportClass.erase terminalSlot → + (∀ (a b : Fin p), + (↑a : ℕ) < (↑b : ℕ) → + (↑(slot b) : ℕ) < + (↑(slot a) : ℕ)) → + (∀ (a : Fin p), + coloring a.succ = + TwoColorComponentSwap G + (coloring a.castSucc) + (traceGamma a) (traceDelta a) + (Sum.inl u)) → + ExtensionBaseAlgorithmCTrace ett + terminalSupport hterminalSupport + terminalSlot mu0 u := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot mu0 + u p indices gamma delta hterminalAtEnd hsupport hkind hgamma hdelta supportClass + hterminalInClass reversePosition slot traceGamma traceDelta nextColoring coloringNat + coloring hslotEnumerates hslotDescending htransition + exact { + steps := p + slot := slot + gamma := traceGamma + delta := traceDelta + coloring := coloring + initialColoring := by simp [coloring, coloringNat] + terminalAtEnd := hterminalAtEnd + terminalInClass := hterminalInClass + enumerates := hslotEnumerates + strictlyDescending := hslotDescending + chosenSupport := fun a => hsupport (reversePosition a) + extensionKind := fun a => hkind (reversePosition a) + gammaField := fun a => hgamma (reversePosition a) + deltaField := fun a => hdelta (reversePosition a) + transition := htransition } + +private theorem helper_herased_110.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot : Fin ett.rounds) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (_ : + (∀ (a c : Fin (p + (1 : ℕ))) (_ : (↑a : ℕ) < (↑c : ℕ)), + (↑(indices a) : ℕ) < (↑(indices c) : ℕ))) + (_ : + (∀ (s : Fin ett.rounds), + s ∈ + ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = s)) + (_ : indices (Fin.last p) = terminalSlot), + let supportClass : Finset (Fin ett.rounds) := + ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport; + supportClass.erase terminalSlot = + Finset.image (fun (a : Fin p) ↦ indices a.castSucc) Finset.univ := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot p + indices hincreasing hclass hterminalIndex supportClass + ext s + constructor + · intro hs + have hsClass : s ∈ supportClass := (Finset.mem_erase.mp hs).2 + obtain ⟨a, ha⟩ := (hclass s).mp hsClass + have haLast : a ≠ Fin.last p := by + intro h + apply (Finset.mem_erase.mp hs).1 + rw [← ha, h, hterminalIndex] + have haLt : a.val < p := by + have haLe : a.val ≤ p := Nat.le_of_lt_succ a.isLt + rcases lt_or_eq_of_le haLe with hlt | heq + · exact hlt + · exact False.elim (haLast (Fin.ext heq)) + let b : Fin p := ⟨a.val, haLt⟩ + have hb : b.castSucc = a := Fin.ext rfl + rw [Finset.mem_image] + exact ⟨b, Finset.mem_univ b, by simpa [hb] using ha⟩ + · intro hs + rw [Finset.mem_image] at hs + obtain ⟨a, -, ha⟩ := hs + rw [Finset.mem_erase] + refine ⟨?_, (hclass s).2 ⟨a.castSucc, ha⟩⟩ + intro hsTerminal + have hindexEq : indices a.castSucc = indices (Fin.last p) := by + rw [ha, hsTerminal, hterminalIndex] + have hvalLt : a.castSucc.val < (Fin.last p).val := by + simp + exact (Nat.ne_of_lt (hincreasing a.castSucc (Fin.last p) hvalLt)) + (congrArg Fin.val hindexEq) + +private theorem helper_single_step_295.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport u : V) + (t : Fin ett.rounds) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (_ : IsProperEdgeColoring G phi) + (_ : ETTStrongInterchangeable ett t terminalSupport phi alpha beta) + (_ : beta ∈ MissingColors G phi u) (_ : alpha ∈ PresentColors G phi u) + (_ : alpha ∈ PresentColors G phi terminalSupport) + (_ : beta ∈ PresentColors G phi terminalSupport), + TwoColorNontrivialPathComponent G phi alpha beta (Sum.inl u) ∧ + (∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc), + Sum.inl w ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → + w = terminalSupport) ∧ + (Sum.inl terminalSupport ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → + ¬((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl terminalSupport)).Subsingleton) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport u t phi alpha beta hproperPhi hSI + hbetaMissing halphaPresent hterminalAlphaPresent hterminalBetaPresent + let H := TwoColorIncidenceGraph G phi alpha beta + let C := TwoColorComponent G phi alpha beta (Sum.inl u) + have hne : alpha ≠ beta := hSI.1 + have hbetaNotPresent : beta ∉ PresentColors G phi u := + (Finset.mem_sdiff.mp hbetaMissing).2 + obtain ⟨eAlpha, heAlphaIncident, heAlphaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halphaPresent + have heAlphaAdj : H.Adj (Sum.inl u) (Sum.inr eAlpha) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro heAlphaIncident (Or.inl heAlphaColor) + have heAlphaComponent : Sum.inr eAlpha ∈ C := by + change H.connectedComponentMk (Sum.inr eAlpha) = + H.connectedComponentMk (Sum.inl u) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + heAlphaAdj).symm + have huComponent : Sum.inl u ∈ C := by rfl + have huSubsingleton : Set.Subsingleton (H.neighborSet (Sum.inl u)) := by + intro x hx y hy + cases x with + | inl x => + simp [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] at hx + | inr e => + cases y with + | inl y => + simp [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] at hy + | inr f => + have hxData : Incident G u e ∧ + (phi e = some alpha ∨ phi e = some beta) := by + simpa [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] + using hx + have hyData : Incident G u f ∧ + (phi f = some alpha ∨ phi f = some beta) := by + simpa [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] + using hy + have heColor : phi e = some alpha := by + rcases hxData.2 with he | he + · exact he + · exact False.elim (hbetaNotPresent (by + simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨e, hxData.1, he⟩)) + have hfColor : phi f = some alpha := by + rcases hyData.2 with hf | hf + · exact hf + · exact False.elim (hbetaNotPresent (by + simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨f, hyData.1, hf⟩)) + congr 1 + by_contra hef + exact (hproperPhi hef ⟨u, hxData.1, hyData.1⟩ heColor) hfColor + have hpath : TwoColorPathComponent G phi alpha beta (Sum.inl u) := by + refine ⟨hne, Sum.inl u, huComponent, ?_⟩ + simpa [H] using huSubsingleton + have hnontrivial : TwoColorNontrivialPathComponent G phi alpha beta + (Sum.inl u) := ⟨hpath, eAlpha, heAlphaComponent⟩ + refine ⟨hnontrivial, ?_, ?_⟩ + · intro w hwTree hwComponent + by_contra hwne + obtain ⟨hcycle, -, -⟩ := + hSI.2.2.2.choose_spec.2.2.2 w hwTree hwne + have huInW : Sum.inl u ∈ + TwoColorComponent G phi alpha beta (Sum.inl w) := by + change H.connectedComponentMk (Sum.inl u) = + H.connectedComponentMk (Sum.inl w) + change H.connectedComponentMk (Sum.inl w) = + H.connectedComponentMk (Sum.inl u) at hwComponent + exact hwComponent.symm + have hpathW : TwoColorPathComponent G phi alpha beta (Sum.inl w) := by + refine ⟨hne, Sum.inl u, huInW, ?_⟩ + simpa [H] using huSubsingleton + exact (TwoColorPathComponentNotCycle G phi alpha beta (Sum.inl w) + hpathW) hcycle + · intro _ hsub + obtain ⟨eAlphaN, heAlphaNIncident, heAlphaNColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hterminalAlphaPresent + obtain ⟨eBetaN, heBetaNIncident, heBetaNColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hterminalBetaPresent + have hedgeNe : eAlphaN ≠ eBetaN := by + intro heq + subst eBetaN + exact hne (Option.some.inj (heAlphaNColor.symm.trans heBetaNColor)) + have hAlphaNeighbor : Sum.inr eAlphaN ∈ + H.neighborSet (Sum.inl terminalSupport) := by + simpa [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] using + And.intro heAlphaNIncident (Or.inl heAlphaNColor) + have hBetaNeighbor : Sum.inr eBetaN ∈ + H.neighborSet (Sum.inl terminalSupport) := by + simpa [SimpleGraph.mem_neighborSet, H, TwoColorIncidenceGraph] using + And.intro heBetaNIncident (Or.inr heBetaNColor) + exact hedgeNe (Sum.inr.inj (hsub hAlphaNeighbor hBetaNeighbor)) + +private theorem helper_root_swap_exchange_437.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} + {k : ℕ} {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} + (_ : alpha ≠ beta) (_ : beta ∈ MissingColors G phi v) + (_ : alpha ∈ PresentColors G phi v), + alpha ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ∧ + beta ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v := by + classical + intro V E _ _ G k phi v alpha beta hne hbeta halpha + let _ := Fintype.ofFinite V + have hbetaNotPresent : beta ∉ PresentColors G phi v := by + simpa [MissingColors] using hbeta + obtain ⟨eAlpha, heAlphaIncident, heAlphaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halpha + have heAlphaComponent : Sum.inr eAlpha ∈ + TwoColorComponent G phi alpha beta (Sum.inl v) := by + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr eAlpha) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro heAlphaIncident (Or.inl heAlphaColor) + change H.connectedComponentMk (Sum.inr eAlpha) = + H.connectedComponentMk (Sum.inl v) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm + constructor + · unfold MissingColors + rw [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + rcases hpresent with ⟨e, hev, heColor⟩ + by_cases heK : + Sum.inr e ∈ TwoColorComponent G phi alpha beta (Sum.inl v) + · have heBeta : phi e = some beta := by + unfold TwoColorComponentSwap at heColor + rw [ite_eq_left heK] at heColor + by_cases heAlpha : phi e = some alpha + · rw [ite_eq_left heAlpha] at heColor + exact False.elim (hne (Option.some.inj heColor).symm) + · by_cases heBeta : phi e = some beta + · exact heBeta + · rw [ite_eq_right heAlpha, ite_eq_right heBeta] at heColor + exact False.elim (heAlpha heColor) + apply hbetaNotPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, heBeta⟩ + · have heOldAlpha : phi e = some alpha := by + simpa [TwoColorComponentSwap, heK] using heColor + have heAdj : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inl v) (Sum.inr e) := by + simpa [TwoColorIncidenceGraph] using + And.intro hev (Or.inl heOldAlpha) + apply heK + change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inr e) = + (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl v) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + heAdj).symm + · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨eAlpha, heAlphaIncident, by + simp [TwoColorComponentSwap, heAlphaComponent, heAlphaColor]⟩ + +private theorem helper_swap_preserves_present_502.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} + {k : ℕ} + (_ : + (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta c : Fin k} {z : V ⊕ E} + (_ : c ∈ PresentColors G phi v) (_ : c ≠ alpha) (_ : c ≠ beta), + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v)) + {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : V ⊕ E} + (_ : alpha ∈ PresentColors G phi v) (_ : beta ∈ PresentColors G phi v), + ∀ c ∈ PresentColors G phi v, + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by + classical + intro V E _ _ G k swap_present_other phi v alpha beta z halpha hbeta c hc + let _ := Fintype.ofFinite V + by_cases hca : c = alpha + · subst c + by_cases hvK : Sum.inl v ∈ TwoColorComponent G phi alpha beta z + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hbeta + have heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inr heColor) + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk z + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk z at hvK + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm.trans hvK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simp [TwoColorComponentSwap, heK, heColor]⟩ + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halpha + have heK : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by + intro heK + apply hvK + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inl heColor) + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk z at heK + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk z + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans heK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simpa [TwoColorComponentSwap, heK] using heColor⟩ + · by_cases hcb : c = beta + · subst c + by_cases hvK : Sum.inl v ∈ TwoColorComponent G phi alpha beta z + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halpha + have heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inl heColor) + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk z + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk z at hvK + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm.trans hvK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simp [TwoColorComponentSwap, heK, heColor]⟩ + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hbeta + have heK : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by + intro heK + apply hvK + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inr heColor) + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk z at heK + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk z + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans heK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simpa [TwoColorComponentSwap, heK] using heColor⟩ + · exact swap_present_other hc hca hcb + +private theorem helper_branch_509.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot : Fin ett.rounds) (mu0 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (gamma delta : Fin (p + (1 : ℕ)) → Fin k) (_ : IsProperEdgeColoring G mu0) + (_ : IsOneEdgeUncolored mu0 e0) + (hterminalAtEnd : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) + (hsupport : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.kind (indices a).succ = some TashkinovExtensionKind.PE) + (hgamma : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) + (_ : (∀ (a : Fin p), gamma a.succ = delta a.castSucc)) + (_ : gamma (Fin.last p) ∈ MissingColors G mu0 u), + let supportClass : Finset (Fin ett.rounds) := + ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport; + ∀ (hterminalInClass : terminalSlot ∈ supportClass), + let reversePosition : Fin p → Fin (p + (1 : ℕ)) := fun (a : Fin p) ↦ a.rev.castSucc; + let slot : Fin p → Fin ett.rounds := fun (a : Fin p) ↦ indices (reversePosition a); + let traceGamma : Fin p → Fin k := fun (a : Fin p) ↦ gamma (reversePosition a); + let traceDelta : Fin p → Fin k := fun (a : Fin p) ↦ delta (reversePosition a); + let nextColoring : ℕ → PartialEdgeColoring E k → PartialEdgeColoring E k := + fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ + if ha : a < p then + TwoColorComponentSwap G phi (traceGamma (⟨a, ha⟩ : Fin p)) + (traceDelta (⟨a, ha⟩ : Fin p)) (Sum.inl u) + else phi; + let coloringNat : ℕ → PartialEdgeColoring E k := fun (t : ℕ) ↦ + Nat.rec mu0 (fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ nextColoring a phi) t; + let coloring : Fin (p + (1 : ℕ)) → PartialEdgeColoring E k := + fun (a : Fin (p + (1 : ℕ))) ↦ coloringNat (↑a : ℕ); + ∀ (hslotEnumerates : Finset.image slot Finset.univ = supportClass.erase terminalSlot) + (hslotDescending : + ∀ (a b : Fin p), (↑a : ℕ) < (↑b : ℕ) → (↑(slot b) : ℕ) < (↑(slot a) : ℕ)) + (htransition : + ∀ (a : Fin p), + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (traceGamma a) (traceDelta a) + (Sum.inl u)), + let trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u := + { steps := p, slot := slot, gamma := traceGamma, delta := traceDelta, + coloring := coloring, initialColoring := of_eq_true (eq_self mu0), + terminalAtEnd := hterminalAtEnd, terminalInClass := hterminalInClass, + enumerates := hslotEnumerates, strictlyDescending := hslotDescending, + chosenSupport := fun (a : Fin p) ↦ hsupport (reversePosition a), + extensionKind := fun (a : Fin p) ↦ hkind (reversePosition a), + gammaField := fun (a : Fin p) ↦ hgamma (reversePosition a), + deltaField := fun (a : Fin p) ↦ hdelta (reversePosition a), + transition := htransition : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u }; + let L : Finset (Fin ett.rounds) := supportClass.erase terminalSlot; + let U : Finset (Fin k) := + L.biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ; + ∀ (_ : (∀ (a : Fin p), (↑(reversePosition a) : ℕ) + (↑a : ℕ) + (1 : ℕ) = p)) + (_ : (∀ (a : Fin p), trace.delta a = delta (reversePosition a))) + (_ : (∀ c ∈ U, c ∈ PresentColors G mu0 terminalSupport)) + (_ : (∀ (a : Fin p), trace.gamma a ∈ PresentColors G mu0 u)) + (_ : + (∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ L) + (_ : ett.series.data.gamma s.succ = some gammaS) + (_ : ett.series.data.delta s.succ = some deltaS), + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS)), + (IsProperEdgeColoring G (trace.coloring (0 : Fin (trace.steps + (1 : ℕ)))) ∧ + IsOneEdgeUncolored (trace.coloring (0 : Fin (trace.steps + (1 : ℕ)))) e0) ∧ + (∀ c ∈ U, + c ∈ + PresentColors G (trace.coloring (0 : Fin (trace.steps + (1 : ℕ)))) terminalSupport) ∧ + (∀ (a : Fin trace.steps), + (↑(0 : Fin (trace.steps + (1 : ℕ))) : ℕ) ≤ (↑a : ℕ) → + trace.gamma a ∈ + PresentColors G (trace.coloring (0 : Fin (trace.steps + (1 : ℕ)))) u) ∧ + (∀ (a : Fin trace.steps), + (↑a : ℕ) = (↑(0 : Fin (trace.steps + (1 : ℕ))) : ℕ) → + trace.delta a ∈ + MissingColors G (trace.coloring (0 : Fin (trace.steps + (1 : ℕ)))) u) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ L → + (∀ (a : Fin trace.steps), + (↑a : ℕ) < (↑(0 : Fin (trace.steps + (1 : ℕ))) : ℕ) → trace.slot a ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport + (trace.coloring (0 : Fin (trace.steps + (1 : ℕ)))) gammaS deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot mu0 + u p indices gamma delta hproper hone hterminalAtEnd hsupport hkind hgamma hdelta hchain + hterminalGammaMissing supportClass hterminalInClass reversePosition slot traceGamma + traceDelta nextColoring coloringNat coloring hslotEnumerates hslotDescending htransition + trace L U hposition htraceDelta initial_terminal_present initial_gamma_present + initial_survivor + rw [trace.initialColoring] + refine ⟨⟨hproper, hone⟩, initial_terminal_present, + (fun a _ => initial_gamma_present a), ?_, ?_⟩ + · intro a ha + let q : Fin p := a.rev + have hpos : reversePosition a = q.castSucc := Fin.ext rfl + have hlast : Fin.last p = q.succ := by + apply Fin.ext + have hpa := hposition a + change p = a.rev.val + 1 + change a.rev.val + a.val + 1 = p at hpa + simp at ha + omega + rw [htraceDelta a, hpos, ← hchain q, ← hlast] + exact hterminalGammaMissing + · intro s gammaS deltaS hs _ _ hgs hds + exact initial_survivor s gammaS deltaS hs hgs hds + +private theorem helper_branch_654.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot : Fin ett.rounds) (mu0 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (gamma delta : Fin (p + (1 : ℕ)) → Fin k) + (hterminalAtEnd : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) + (hsupport : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.kind (indices a).succ = some TashkinovExtensionKind.PE) + (hgamma : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)), + let supportClass : Finset (Fin ett.rounds) := + ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport; + ∀ (hterminalInClass : terminalSlot ∈ supportClass), + let reversePosition : Fin p → Fin (p + (1 : ℕ)) := fun (a : Fin p) ↦ a.rev.castSucc; + let slot : Fin p → Fin ett.rounds := fun (a : Fin p) ↦ indices (reversePosition a); + let traceGamma : Fin p → Fin k := fun (a : Fin p) ↦ gamma (reversePosition a); + let traceDelta : Fin p → Fin k := fun (a : Fin p) ↦ delta (reversePosition a); + let nextColoring : ℕ → PartialEdgeColoring E k → PartialEdgeColoring E k := + fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ + if ha : a < p then + TwoColorComponentSwap G phi (traceGamma (⟨a, ha⟩ : Fin p)) + (traceDelta (⟨a, ha⟩ : Fin p)) (Sum.inl u) + else phi; + let coloringNat : ℕ → PartialEdgeColoring E k := fun (t : ℕ) ↦ + Nat.rec mu0 (fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ nextColoring a phi) t; + let coloring : Fin (p + (1 : ℕ)) → PartialEdgeColoring E k := + fun (a : Fin (p + (1 : ℕ))) ↦ coloringNat (↑a : ℕ); + ∀ (hslotEnumerates : Finset.image slot Finset.univ = supportClass.erase terminalSlot) + (hslotDescending : + ∀ (a b : Fin p), (↑a : ℕ) < (↑b : ℕ) → (↑(slot b) : ℕ) < (↑(slot a) : ℕ)) + (htransition : + ∀ (a : Fin p), + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (traceGamma a) (traceDelta a) + (Sum.inl u)), + let trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u := + { steps := p, slot := slot, gamma := traceGamma, delta := traceDelta, + coloring := coloring, initialColoring := of_eq_true (eq_self mu0), + terminalAtEnd := hterminalAtEnd, terminalInClass := hterminalInClass, + enumerates := hslotEnumerates, strictlyDescending := hslotDescending, + chosenSupport := fun (a : Fin p) ↦ hsupport (reversePosition a), + extensionKind := fun (a : Fin p) ↦ hkind (reversePosition a), + gammaField := fun (a : Fin p) ↦ hgamma (reversePosition a), + deltaField := fun (a : Fin p) ↦ hdelta (reversePosition a), + transition := htransition : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u }; + let L : Finset (Fin ett.rounds) := supportClass.erase terminalSlot; + ∀ (a : Fin trace.steps) + (_ : + IsProperEdgeColoring G (trace.coloring a.castSucc) ∧ + IsOneEdgeUncolored (trace.coloring a.castSucc) e0) + (_ : + (∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ L) + (_ : + (∀ (a_2 : Fin trace.steps) (_ : (↑a_2 : ℕ) < (↑a.castSucc : ℕ)), + trace.slot a_2 ≠ s)) + (_ : ett.series.data.chosenVertex s.succ = some terminalSupport) + (_ : ett.series.data.gamma s.succ = some gammaS) + (_ : ett.series.data.delta s.succ = some deltaS), + ETTStrongInterchangeable ett s terminalSupport (trace.coloring a.castSucc) gammaS + deltaS)) + (_ : + ETTStrongInterchangeable ett (trace.slot a) terminalSupport + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)) + (_ : + TwoColorNontrivialPathComponent G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a) (Sum.inl u) ∧ + (∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc), + Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a) (Sum.inl u) → + w = terminalSupport) ∧ + (Sum.inl terminalSupport ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a) (Sum.inl u) → + ¬((TwoColorIncidenceGraph G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a)).neighborSet + (Sum.inl terminalSupport)).Subsingleton)) + (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ L) + (_ : (∀ (a_2 : Fin trace.steps) (_ : (↑a_2 : ℕ) < (↑a.succ : ℕ)), trace.slot a_2 ≠ s)) + (_ : ett.series.data.chosenVertex s.succ = some terminalSupport) + (_ : ett.series.data.gamma s.succ = some gammaS) + (_ : ett.series.data.delta s.succ = some deltaS), + ETTStrongInterchangeable ett s terminalSupport (trace.coloring a.succ) gammaS deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot mu0 + u p indices gamma delta hterminalAtEnd hsupport hkind hgamma hdelta supportClass + hterminalInClass reversePosition slot traceGamma traceDelta nextColoring coloringNat + coloring hslotEnumerates hslotDescending htransition trace L a hgood hsurvivor hcurrentSI + hstep s gammaS deltaS hs hnot hsupportS hgammaS hdeltaS + have hsOld : ETTStrongInterchangeable ett s terminalSupport + (trace.coloring a.castSucc) gammaS deltaS := by + apply hsurvivor s gammaS deltaS hs + · intro c hc + apply hnot c + change c.val < a.val at hc + change c.val < a.val + 1 + omega + · exact hsupportS + · exact hgammaS + · exact hdeltaS + have hsImage : s ∈ Finset.univ.image trace.slot := by + rw [trace.enumerates] + exact hs + rcases Finset.mem_image.mp hsImage with ⟨c, -, hc⟩ + have hac : a.val < c.val := by + by_contra hle + have hca : c.val < a.succ.val := by + simp + omega + exact hnot c hca hc + have hslt : s.val < (trace.slot a).val := by + have hdesc := trace.strictlyDescending a c hac + simpa [hc] using hdesc + have hpreserved := StrongInterchangeabilityKempePreserved ett s + (trace.slot a) terminalSupport terminalSupport gammaS deltaS + (trace.gamma a) (trace.delta a) (trace.coloring a.castSucc) + (Sum.inl u) hgood.1 hgood.2 hgammaS hdeltaS + (trace.gammaField a) (trace.deltaField a) (Or.inr hslt) + (by intro hneSupport; exact (hneSupport rfl).elim) hstep.1 + hcurrentSI hsOld + rw [trace.transition a] + exact hpreserved.2.2 + +private theorem helper_branch_527.{u_1, u_2} : + helperBranch527Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot mu0 + u p indices gamma delta hterminalAtEnd hsupport hkind hgamma hdelta + set supportClass : Finset (Fin ett.rounds) := ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport + intro hterminalInClass reversePosition slot traceGamma traceDelta nextColoring coloringNat + coloring hslotEnumerates hslotDescending htransition trace trace_colors_ne surviving_gamma_ne + set L : Finset (Fin ett.rounds) := supportClass.erase terminalSlot + intro U slot_mem gamma_mem_U delta_mem_U next_delta_eq_gamma single_step swap_preserves_one + swap_present_other root_swap_exchange swap_preserves_present a ih + rcases ih with ⟨hgood, hterminal, hfuture, hnext, hsurvivor⟩ + have hgammaPresent : trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) u := + hfuture a (by rfl) + have hdeltaMissing : trace.delta a ∈ + MissingColors G (trace.coloring a.castSucc) u := + hnext a rfl + have hcurrentSI : ETTStrongInterchangeable ett (trace.slot a) + terminalSupport (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) := by + apply hsurvivor (trace.slot a) (trace.gamma a) (trace.delta a) + (slot_mem a) + · intro c hc hca + have hdesc := trace.strictlyDescending c a hc + rw [hca] at hdesc + exact (Nat.lt_irrefl _ hdesc) + · exact trace.chosenSupport a + · exact trace.gammaField a + · exact trace.deltaField a + have hterminalGamma : trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) terminalSupport := + hterminal (trace.gamma a) (gamma_mem_U a) + have hterminalDelta : trace.delta a ∈ + PresentColors G (trace.coloring a.castSucc) terminalSupport := + hterminal (trace.delta a) (delta_mem_U a) + have hstep := single_step (trace.slot a) + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + hgood.1 hcurrentSI hdeltaMissing hgammaPresent hterminalGamma + hterminalDelta + have hproperNext : + IsProperEdgeColoring G (trace.coloring a.succ) := by + rw [trace.transition a] + exact TwoColorComponentSwapProper G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (trace_colors_ne a) hgood.1 + (Sum.inl u) + have honeNext : IsOneEdgeUncolored (trace.coloring a.succ) e0 := by + rw [trace.transition a] + exact swap_preserves_one hgood.2 + have hexchange := root_swap_exchange (trace_colors_ne a) + hdeltaMissing hgammaPresent + rw [← trace.transition a] at hexchange + refine ⟨⟨hproperNext, honeNext⟩, ?_, ?_, ?_, ?_⟩ + · intro c hc + have hpresent := swap_preserves_present (z := Sum.inl u) + (trace_colors_ne a) hterminalGamma hterminalDelta c + (hterminal c hc) + rw [← trace.transition a] at hpresent + exact hpresent + · intro c hac + have hac' : a.val < c.val := by + change a.val + 1 ≤ c.val at hac + omega + have hne := surviving_gamma_ne a c hac' + have hpresent := swap_present_other (z := Sum.inl u) + (hfuture c (Nat.le_of_lt hac')) hne.1 hne.2 + rw [← trace.transition a] at hpresent + exact hpresent + · intro c hca + rw [next_delta_eq_gamma a c (by simpa using hca)] + exact hexchange.1 + · exact @helper_branch_654 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport hterminalSupport terminalSlot mu0 u p indices gamma + delta hterminalAtEnd hsupport hkind hgamma hdelta hterminalInClass hslotEnumerates + hslotDescending htransition a hgood hsurvivor hcurrentSI hstep +private theorem helper_invariant_596.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot : Fin ett.rounds) (mu0 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (gamma delta : Fin (p + (1 : ℕ)) → Fin k) (_ : IsProperEdgeColoring G mu0) + (_ : IsOneEdgeUncolored mu0 e0) + (hterminalAtEnd : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) + (hsupport : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.kind (indices a).succ = some TashkinovExtensionKind.PE) + (hgamma : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) + (_ : (∀ (a : Fin p), gamma a.succ = delta a.castSucc)) + (_ : gamma (Fin.last p) ∈ MissingColors G mu0 u), + let supportClass : Finset (Fin ett.rounds) := + ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport; + ∀ (hterminalInClass : terminalSlot ∈ supportClass), + let reversePosition : Fin p → Fin (p + (1 : ℕ)) := fun (a : Fin p) ↦ a.rev.castSucc; + let slot : Fin p → Fin ett.rounds := fun (a : Fin p) ↦ indices (reversePosition a); + let traceGamma : Fin p → Fin k := fun (a : Fin p) ↦ gamma (reversePosition a); + let traceDelta : Fin p → Fin k := fun (a : Fin p) ↦ delta (reversePosition a); + let nextColoring : ℕ → PartialEdgeColoring E k → PartialEdgeColoring E k := + fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ + if ha : a < p then + TwoColorComponentSwap G phi (traceGamma (⟨a, ha⟩ : Fin p)) + (traceDelta (⟨a, ha⟩ : Fin p)) (Sum.inl u) + else phi; + let coloringNat : ℕ → PartialEdgeColoring E k := fun (t : ℕ) ↦ + Nat.rec mu0 (fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ nextColoring a phi) t; + let coloring : Fin (p + (1 : ℕ)) → PartialEdgeColoring E k := + fun (a : Fin (p + (1 : ℕ))) ↦ coloringNat (↑a : ℕ); + ∀ (hslotEnumerates : Finset.image slot Finset.univ = supportClass.erase terminalSlot) + (hslotDescending : + ∀ (a b : Fin p), (↑a : ℕ) < (↑b : ℕ) → (↑(slot b) : ℕ) < (↑(slot a) : ℕ)) + (htransition : + ∀ (a : Fin p), + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (traceGamma a) (traceDelta a) + (Sum.inl u)), + let trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u := + { steps := p, slot := slot, gamma := traceGamma, delta := traceDelta, + coloring := coloring, initialColoring := of_eq_true (eq_self mu0), + terminalAtEnd := hterminalAtEnd, terminalInClass := hterminalInClass, + enumerates := hslotEnumerates, strictlyDescending := hslotDescending, + chosenSupport := fun (a : Fin p) ↦ hsupport (reversePosition a), + extensionKind := fun (a : Fin p) ↦ hkind (reversePosition a), + gammaField := fun (a : Fin p) ↦ hgamma (reversePosition a), + deltaField := fun (a : Fin p) ↦ hdelta (reversePosition a), + transition := htransition : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u }; + ∀ (_ : (∀ (a : Fin p), trace.gamma a ≠ trace.delta a)) + (_ : + (∀ (a b : Fin p) (_ : (↑a : ℕ) < (↑b : ℕ)), + trace.gamma b ≠ trace.gamma a ∧ trace.gamma b ≠ trace.delta a)), + let L : Finset (Fin ett.rounds) := supportClass.erase terminalSlot; + let U : Finset (Fin k) := + L.biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ; + ∀ (_ : (∀ (a : Fin p), (↑(reversePosition a) : ℕ) + (↑a : ℕ) + (1 : ℕ) = p)) + (_ : (∀ (a : Fin p), trace.delta a = delta (reversePosition a))) + (_ : (∀ (a : Fin p), trace.slot a ∈ L)) (_ : (∀ (a : Fin p), trace.gamma a ∈ U)) + (_ : (∀ (a : Fin p), trace.delta a ∈ U)) + (_ : (∀ c ∈ U, c ∈ PresentColors G mu0 terminalSupport)) + (_ : (∀ (a : Fin p), trace.gamma a ∈ PresentColors G mu0 u)) + (_ : + (∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ L) + (_ : ett.series.data.gamma s.succ = some gammaS) + (_ : ett.series.data.delta s.succ = some deltaS), + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS)) + (_ : + (∀ (a c : Fin p) (_ : (↑c : ℕ) = (↑a : ℕ) + (1 : ℕ)), + trace.delta c = trace.gamma a)) + (_ : + (∀ (t : Fin ett.rounds) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (_ : IsProperEdgeColoring G phi) + (_ : ETTStrongInterchangeable ett t terminalSupport phi alpha beta) + (_ : beta ∈ MissingColors G phi u) (_ : alpha ∈ PresentColors G phi u) + (_ : alpha ∈ PresentColors G phi terminalSupport) + (_ : beta ∈ PresentColors G phi terminalSupport), + TwoColorNontrivialPathComponent G phi alpha beta (Sum.inl u) ∧ + (∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc), + Sum.inl w ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → + w = terminalSupport) ∧ + (Sum.inl terminalSupport ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → + ¬((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl terminalSupport)).Subsingleton))) + (_ : + (∀ {phi : PartialEdgeColoring E k} {alpha beta : Fin k} {z : V ⊕ E} + (_ : IsOneEdgeUncolored phi e0), + IsOneEdgeUncolored (TwoColorComponentSwap G phi alpha beta z) e0)) + (_ : + (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta c : Fin k} {z : V ⊕ E} + (_ : c ∈ PresentColors G phi v) (_ : c ≠ alpha) (_ : c ≠ beta), + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v)) + (_ : + (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} (_ : alpha ≠ beta) + (_ : beta ∈ MissingColors G phi v) (_ : alpha ∈ PresentColors G phi v), + alpha ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ∧ + beta ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v)) + (_ : + (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : V ⊕ E} + (_ : alpha ≠ beta) (_ : alpha ∈ PresentColors G phi v) + (_ : beta ∈ PresentColors G phi v), + ∀ c ∈ PresentColors G phi v, + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v)) + (n : Fin (trace.steps + (1 : ℕ))), + (IsProperEdgeColoring G (trace.coloring n) ∧ IsOneEdgeUncolored (trace.coloring n) e0) ∧ + (∀ c ∈ U, c ∈ PresentColors G (trace.coloring n) terminalSupport) ∧ + (∀ (a : Fin trace.steps), + (↑n : ℕ) ≤ (↑a : ℕ) → trace.gamma a ∈ PresentColors G (trace.coloring n) u) ∧ + (∀ (a : Fin trace.steps), + (↑a : ℕ) = (↑n : ℕ) → trace.delta a ∈ MissingColors G (trace.coloring n) u) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ L → + (∀ (a : Fin trace.steps), (↑a : ℕ) < (↑n : ℕ) → trace.slot a ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport (trace.coloring n) gammaS deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot mu0 + u p indices gamma delta hproper hone hterminalAtEnd hsupport hkind hgamma hdelta hchain + hterminalGammaMissing supportClass hterminalInClass reversePosition slot traceGamma + traceDelta nextColoring coloringNat coloring hslotEnumerates hslotDescending htransition + trace trace_colors_ne surviving_gamma_ne L U hposition htraceDelta slot_mem gamma_mem_U + delta_mem_U initial_terminal_present initial_gamma_present initial_survivor + next_delta_eq_gamma single_step swap_preserves_one swap_present_other root_swap_exchange + swap_preserves_present n + induction n using Fin.induction with + | zero => + exact @helper_branch_509 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport terminalSlot mu0 u p indices gamma + delta hproper hone hterminalAtEnd hsupport hkind hgamma hdelta hchain + hterminalGammaMissing hterminalInClass hslotEnumerates hslotDescending htransition + hposition htraceDelta initial_terminal_present initial_gamma_present initial_survivor + | succ a ih => + exact @helper_branch_527 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport hterminalSupport terminalSlot mu0 u p indices + gamma delta hterminalAtEnd hsupport hkind hgamma hdelta hterminalInClass + hslotEnumerates hslotDescending htransition trace_colors_ne surviving_gamma_ne slot_mem + gamma_mem_U delta_mem_U next_delta_eq_gamma single_step swap_preserves_one + swap_present_other root_swap_exchange swap_preserves_present a ih +private theorem helper_branch_732.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot jSlot : Fin ett.rounds) (mu0 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (gamma delta : Fin (p + (1 : ℕ)) → Fin k) + (hterminalAtEnd : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) + (hsupport : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.kind (indices a).succ = some TashkinovExtensionKind.PE) + (hgamma : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) + (_ : + (∀ + s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase + terminalSlot, + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree s.succ.castSucc))), + let supportClass : Finset (Fin ett.rounds) := + ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport; + ∀ (hterminalInClass : terminalSlot ∈ supportClass), + let reversePosition : Fin p → Fin (p + (1 : ℕ)) := fun (a : Fin p) ↦ a.rev.castSucc; + let slot : Fin p → Fin ett.rounds := fun (a : Fin p) ↦ indices (reversePosition a); + let traceGamma : Fin p → Fin k := fun (a : Fin p) ↦ gamma (reversePosition a); + let traceDelta : Fin p → Fin k := fun (a : Fin p) ↦ delta (reversePosition a); + let nextColoring : ℕ → PartialEdgeColoring E k → PartialEdgeColoring E k := + fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ + if ha : a < p then + TwoColorComponentSwap G phi (traceGamma (⟨a, ha⟩ : Fin p)) + (traceDelta (⟨a, ha⟩ : Fin p)) (Sum.inl u) + else phi; + let coloringNat : ℕ → PartialEdgeColoring E k := fun (t : ℕ) ↦ + Nat.rec mu0 (fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ nextColoring a phi) t; + let coloring : Fin (p + (1 : ℕ)) → PartialEdgeColoring E k := + fun (a : Fin (p + (1 : ℕ))) ↦ coloringNat (↑a : ℕ); + ∀ (hslotEnumerates : Finset.image slot Finset.univ = supportClass.erase terminalSlot) + (hslotDescending : + ∀ (a b : Fin p), (↑a : ℕ) < (↑b : ℕ) → (↑(slot b) : ℕ) < (↑(slot a) : ℕ)) + (htransition : + ∀ (a : Fin p), + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (traceGamma a) (traceDelta a) + (Sum.inl u)), + let trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u := + { steps := p, slot := slot, gamma := traceGamma, delta := traceDelta, + coloring := coloring, initialColoring := of_eq_true (eq_self mu0), + terminalAtEnd := hterminalAtEnd, terminalInClass := hterminalInClass, + enumerates := hslotEnumerates, strictlyDescending := hslotDescending, + chosenSupport := fun (a : Fin p) ↦ hsupport (reversePosition a), + extensionKind := fun (a : Fin p) ↦ hkind (reversePosition a), + gammaField := fun (a : Fin p) ↦ hgamma (reversePosition a), + deltaField := fun (a : Fin p) ↦ hdelta (reversePosition a), + transition := htransition : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u }; + let L : Finset (Fin ett.rounds) := supportClass.erase terminalSlot; + let U : Finset (Fin k) := + L.biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ; + ∀ (_ : (∀ (a : Fin p), trace.slot a ∈ L)) (_ : (∀ (a : Fin p), trace.gamma a ∈ U)) + (_ : (∀ (a : Fin p), trace.delta a ∈ U)) + (_ : + (∀ (t : Fin ett.rounds) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (_ : IsProperEdgeColoring G phi) + (_ : ETTStrongInterchangeable ett t terminalSupport phi alpha beta) + (_ : beta ∈ MissingColors G phi u) (_ : alpha ∈ PresentColors G phi u) + (_ : alpha ∈ PresentColors G phi terminalSupport) + (_ : beta ∈ PresentColors G phi terminalSupport), + TwoColorNontrivialPathComponent G phi alpha beta (Sum.inl u) ∧ + (∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc), + Sum.inl w ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → + w = terminalSupport) ∧ + (Sum.inl terminalSupport ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → + ¬((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl terminalSupport)).Subsingleton))) + (_ : + (∀ (n : Fin (trace.steps + (1 : ℕ))), + (IsProperEdgeColoring G (trace.coloring n) ∧ + IsOneEdgeUncolored (trace.coloring n) e0) ∧ + (∀ c ∈ U, c ∈ PresentColors G (trace.coloring n) terminalSupport) ∧ + (∀ (a : Fin trace.steps), + (↑n : ℕ) ≤ (↑a : ℕ) → + trace.gamma a ∈ PresentColors G (trace.coloring n) u) ∧ + (∀ (a : Fin trace.steps), + (↑a : ℕ) = (↑n : ℕ) → + trace.delta a ∈ MissingColors G (trace.coloring n) u) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ L → + (∀ (a : Fin trace.steps), (↑a : ℕ) < (↑n : ℕ) → trace.slot a ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport + (trace.coloring n) gammaS deltaS)) + (a : Fin trace.steps), + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ + trace.delta a ∈ MissingColors G (trace.coloring a.castSucc) u ∧ + TwoColorNontrivialPathComponent G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a) (Sum.inl u) ∧ + (∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc), + Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl u) → + w = terminalSupport) ∧ + (Sum.inl terminalSupport ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl u) → + ¬((TwoColorIncidenceGraph G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a)).neighborSet + (Sum.inl terminalSupport)).Subsingleton) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase + terminalSlot → + (∀ (b : Fin trace.steps), (↑b : ℕ) ≤ (↑a : ℕ) → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport (trace.coloring a.succ) gammaS deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot + jSlot mu0 u p indices gamma delta hterminalAtEnd hsupport hkind hgamma hdelta hTjInitial + supportClass hterminalInClass reversePosition slot traceGamma traceDelta nextColoring + coloringNat coloring hslotEnumerates hslotDescending htransition trace L U slot_mem + gamma_mem_U delta_mem_U single_step invariant a + rcases invariant a.castSucc with + ⟨hgood, hterminal, hfuture, hnext, hsurvivor⟩ + have hmissing := hnext a rfl + have hpresent := hfuture a (by rfl) + have hterminalGamma := hterminal (trace.gamma a) (gamma_mem_U a) + have hterminalDelta := hterminal (trace.delta a) (delta_mem_U a) + have hsi : ETTStrongInterchangeable ett (trace.slot a) terminalSupport + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) := by + apply hsurvivor (trace.slot a) (trace.gamma a) (trace.delta a) + (slot_mem a) + · intro c hc hca + have hdesc := trace.strictlyDescending c a hc + rw [hca] at hdesc + exact (Nat.lt_irrefl _ hdesc) + · exact trace.chosenSupport a + · exact trace.gammaField a + · exact trace.deltaField a + have hstep := single_step (trace.slot a) + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + hgood.1 hsi hmissing hpresent hterminalGamma hterminalDelta + refine ⟨?_, hmissing, hstep.1, hstep.2.1, hstep.2.2, ?_⟩ + · exact hTjInitial (trace.slot a) (slot_mem a) + · intro s gammaS deltaS hs hnot hsupportS hgammaS hdeltaS + have hnextInvariant := invariant a.succ + exact hnextInvariant.2.2.2.2 s gammaS deltaS hs (by + intro c hc + apply hnot c + change c.val < a.val + 1 at hc + omega) hsupportS hgammaS hdeltaS + +private theorem helper_surviving_gamma_ne_883.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot : Fin ett.rounds) (mu0 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (gamma delta : Fin (p + (1 : ℕ)) → Fin k) + (hterminalAtEnd : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) + (hsupport : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.kind (indices a).succ = some TashkinovExtensionKind.PE) + (hgamma : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) + (_ : Function.Injective (Fin.cons (gamma (0 : Fin (p + (1 : ℕ)))) delta)), + let supportClass : Finset (Fin ett.rounds) := + ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport; + ∀ (hterminalInClass : terminalSlot ∈ supportClass), + let reversePosition : Fin p → Fin (p + (1 : ℕ)) := fun (a : Fin p) ↦ a.rev.castSucc; + let slot : Fin p → Fin ett.rounds := fun (a : Fin p) ↦ indices (reversePosition a); + let traceGamma : Fin p → Fin k := fun (a : Fin p) ↦ gamma (reversePosition a); + let traceDelta : Fin p → Fin k := fun (a : Fin p) ↦ delta (reversePosition a); + let nextColoring : ℕ → PartialEdgeColoring E k → PartialEdgeColoring E k := + fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ + if ha : a < p then + TwoColorComponentSwap G phi (traceGamma (⟨a, ha⟩ : Fin p)) + (traceDelta (⟨a, ha⟩ : Fin p)) (Sum.inl u) + else phi; + let coloringNat : ℕ → PartialEdgeColoring E k := fun (t : ℕ) ↦ + Nat.rec mu0 (fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ nextColoring a phi) t; + let coloring : Fin (p + (1 : ℕ)) → PartialEdgeColoring E k := + fun (a : Fin (p + (1 : ℕ))) ↦ coloringNat (↑a : ℕ); + ∀ (hslotEnumerates : Finset.image slot Finset.univ = supportClass.erase terminalSlot) + (hslotDescending : + ∀ (a b : Fin p), (↑a : ℕ) < (↑b : ℕ) → (↑(slot b) : ℕ) < (↑(slot a) : ℕ)) + (htransition : + ∀ (a : Fin p), + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (traceGamma a) (traceDelta a) + (Sum.inl u)), + let trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u := + { steps := p, slot := slot, gamma := traceGamma, delta := traceDelta, + coloring := coloring, initialColoring := of_eq_true (eq_self mu0), + terminalAtEnd := hterminalAtEnd, terminalInClass := hterminalInClass, + enumerates := hslotEnumerates, strictlyDescending := hslotDescending, + chosenSupport := fun (a : Fin p) ↦ hsupport (reversePosition a), + extensionKind := fun (a : Fin p) ↦ hkind (reversePosition a), + gammaField := fun (a : Fin p) ↦ hgamma (reversePosition a), + deltaField := fun (a : Fin p) ↦ hdelta (reversePosition a), + transition := htransition : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u }; + let colorChain : Fin (p + (2 : ℕ)) → Fin k := + Fin.cons (gamma (0 : Fin (p + (1 : ℕ)))) delta; + ∀ (_ : (∀ (q : Fin (p + (1 : ℕ))), gamma q = colorChain q.castSucc)) + (_ : (∀ (q : Fin (p + (1 : ℕ))), delta q = colorChain q.succ)) (a b : Fin p) + (_ : (↑a : ℕ) < (↑b : ℕ)), + trace.gamma b ≠ trace.gamma a ∧ + trace.gamma b ≠ trace.delta a := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot mu0 + u p indices gamma delta hterminalAtEnd hsupport hkind hgamma hdelta hdistinct supportClass + hterminalInClass reversePosition slot traceGamma traceDelta nextColoring coloringNat + coloring hslotEnumerates hslotDescending htransition trace colorChain gamma_eq_chain + delta_eq_chain a b hab + change gamma (reversePosition b) ≠ gamma (reversePosition a) ∧ + gamma (reversePosition b) ≠ delta (reversePosition a) + rw [gamma_eq_chain, gamma_eq_chain, delta_eq_chain] + constructor <;> intro h + · have hi := hdistinct h + have hv := congrArg Fin.val hi + change b.rev.val = a.rev.val at hv + have := Fin.rev_lt_rev.mpr hab + omega + · have hi := hdistinct h + have hv := congrArg Fin.val hi + change b.rev.val = a.rev.val + 1 at hv + have := Fin.rev_lt_rev.mpr hab + omega + +private theorem helper_swap_preserves_one_984.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {phi : PartialEdgeColoring E k} {alpha beta : Fin k} {z : V ⊕ E} + (_ : IsOneEdgeUncolored phi e0), + IsOneEdgeUncolored (TwoColorComponentSwap G phi alpha beta z) e0 := by + classical + intro V E G k e0 phi alpha beta z h + constructor + · simp [TwoColorComponentSwap, h.1] + · intro e he0 + obtain ⟨c, hc⟩ := h.2 e he0 + by_cases heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z + · by_cases heAlpha : phi e = some alpha + · exact ⟨beta, by simp [TwoColorComponentSwap, heK, heAlpha]⟩ + · by_cases heBeta : phi e = some beta + · exact ⟨alpha, by + simp [TwoColorComponentSwap, heK, heBeta]⟩ + · exact ⟨c, by + simpa [TwoColorComponentSwap, heK, heAlpha, heBeta] using hc⟩ + · exact ⟨c, by simpa [TwoColorComponentSwap, heK] using hc⟩ + +private theorem helper_continuation_1578.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot jSlot : Fin ett.rounds) (mu0 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (gamma delta : Fin (p + (1 : ℕ)) → Fin k) (_ : IsProperEdgeColoring G mu0) + (_ : IsOneEdgeUncolored mu0 e0) + (hterminalAtEnd : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) + (hsupport : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : + ∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.kind (indices a).succ = some TashkinovExtensionKind.PE) + (hgamma : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) + (_ : (∀ (a : Fin p), gamma a.succ = delta a.castSucc)) + (_ : + (∀ + s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase + terminalSlot, + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree s.succ.castSucc))) + (_ : gamma (Fin.last p) ∈ MissingColors G mu0 u), + let supportClass : Finset (Fin ett.rounds) := + ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport; + ∀ (hterminalInClass : terminalSlot ∈ supportClass), + let reversePosition : Fin p → Fin (p + (1 : ℕ)) := fun (a : Fin p) ↦ a.rev.castSucc; + let slot : Fin p → Fin ett.rounds := fun (a : Fin p) ↦ indices (reversePosition a); + let traceGamma : Fin p → Fin k := fun (a : Fin p) ↦ gamma (reversePosition a); + let traceDelta : Fin p → Fin k := fun (a : Fin p) ↦ delta (reversePosition a); + let nextColoring : ℕ → PartialEdgeColoring E k → PartialEdgeColoring E k := + fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ + if ha : a < p then + TwoColorComponentSwap G phi (traceGamma (⟨a, ha⟩ : Fin p)) + (traceDelta (⟨a, ha⟩ : Fin p)) (Sum.inl u) + else phi; + let coloringNat : ℕ → PartialEdgeColoring E k := fun (t : ℕ) ↦ + Nat.rec mu0 (fun (a : ℕ) (phi : PartialEdgeColoring E k) ↦ nextColoring a phi) t; + let coloring : Fin (p + (1 : ℕ)) → PartialEdgeColoring E k := + fun (a : Fin (p + (1 : ℕ))) ↦ coloringNat (↑a : ℕ); + ∀ (hslotEnumerates : Finset.image slot Finset.univ = supportClass.erase terminalSlot) + (hslotDescending : + ∀ (a b : Fin p), (↑a : ℕ) < (↑b : ℕ) → (↑(slot b) : ℕ) < (↑(slot a) : ℕ)) + (htransition : + ∀ (a : Fin p), + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (traceGamma a) (traceDelta a) + (Sum.inl u)), + let trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u := + { steps := p, slot := slot, gamma := traceGamma, delta := traceDelta, + coloring := coloring, initialColoring := of_eq_true (eq_self mu0), + terminalAtEnd := hterminalAtEnd, terminalInClass := hterminalInClass, + enumerates := hslotEnumerates, strictlyDescending := hslotDescending, + chosenSupport := fun (a : Fin p) ↦ hsupport (reversePosition a), + extensionKind := fun (a : Fin p) ↦ hkind (reversePosition a), + gammaField := fun (a : Fin p) ↦ hgamma (reversePosition a), + deltaField := fun (a : Fin p) ↦ hdelta (reversePosition a), + transition := htransition : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 + u }; + ∀ (_ : (∀ (a : Fin p), trace.gamma a ≠ trace.delta a)) + (_ : + (∀ (a b : Fin p) (_ : (↑a : ℕ) < (↑b : ℕ)), + trace.gamma b ≠ trace.gamma a ∧ trace.gamma b ≠ trace.delta a)), + let L : Finset (Fin ett.rounds) := supportClass.erase terminalSlot; + let U : Finset (Fin k) := + L.biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ; + ∀ (_ : (∀ (a : Fin p), (↑(reversePosition a) : ℕ) + (↑a : ℕ) + (1 : ℕ) = p)) + (_ : (∀ (a : Fin p), trace.delta a = delta (reversePosition a))) + (_ : (∀ (a : Fin p), trace.slot a ∈ L)) (_ : (∀ (a : Fin p), trace.gamma a ∈ U)) + (_ : (∀ (a : Fin p), trace.delta a ∈ U)) + (_ : (∀ c ∈ U, c ∈ PresentColors G mu0 terminalSupport)) + (_ : (∀ (a : Fin p), trace.gamma a ∈ PresentColors G mu0 u)) + (_ : + (∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ L) + (_ : ett.series.data.gamma s.succ = some gammaS) + (_ : ett.series.data.delta s.succ = some deltaS), + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS)) + (_ : + (∀ (a c : Fin p) (_ : (↑c : ℕ) = (↑a : ℕ) + (1 : ℕ)), + trace.delta c = trace.gamma a)) + (_ : + (∀ (t : Fin ett.rounds) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (_ : IsProperEdgeColoring G phi) + (_ : ETTStrongInterchangeable ett t terminalSupport phi alpha beta) + (_ : beta ∈ MissingColors G phi u) (_ : alpha ∈ PresentColors G phi u) + (_ : alpha ∈ PresentColors G phi terminalSupport) + (_ : beta ∈ PresentColors G phi terminalSupport), + TwoColorNontrivialPathComponent G phi alpha beta (Sum.inl u) ∧ + (∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc), + Sum.inl w ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → + w = terminalSupport) ∧ + (Sum.inl terminalSupport ∈ TwoColorComponent G phi alpha beta (Sum.inl u) → + ¬((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl terminalSupport)).Subsingleton))) + (_ : + (∀ {phi : PartialEdgeColoring E k} {alpha beta : Fin k} {z : V ⊕ E} + (_ : IsOneEdgeUncolored phi e0), + IsOneEdgeUncolored (TwoColorComponentSwap G phi alpha beta z) e0)) + (_ : + (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta c : Fin k} {z : V ⊕ E} + (_ : c ∈ PresentColors G phi v) (_ : c ≠ alpha) (_ : c ≠ beta), + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v)) + (_ : + (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} (_ : alpha ≠ beta) + (_ : beta ∈ MissingColors G phi v) (_ : alpha ∈ PresentColors G phi v), + alpha ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ∧ + beta ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v)) + (_ : + (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : V ⊕ E} + (_ : alpha ≠ beta) (_ : alpha ∈ PresentColors G phi v) + (_ : beta ∈ PresentColors G phi v), + ∀ c ∈ PresentColors G phi v, + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v)), + ExtensionBaseAlgorithmCInvariant ett terminalSupport hterminalSupport terminalSlot jSlot + mu0 u trace := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot jSlot + mu0 u p indices gamma delta hproper hone hterminalAtEnd hsupport hkind hgamma hdelta hchain + hTjInitial hterminalGammaMissing supportClass hterminalInClass reversePosition slot traceGamma + traceDelta nextColoring coloringNat coloring hslotEnumerates hslotDescending htransition trace + trace_colors_ne surviving_gamma_ne L U hposition htraceDelta slot_mem gamma_mem_U delta_mem_U + initial_terminal_present initial_gamma_present initial_survivor next_delta_eq_gamma + single_step swap_preserves_one swap_present_other root_swap_exchange swap_preserves_present + have invariant := + @helper_invariant_596 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett terminalSupport hterminalSupport terminalSlot mu0 u p indices + gamma delta hproper hone hterminalAtEnd hsupport hkind hgamma hdelta hchain + hterminalGammaMissing hterminalInClass hslotEnumerates hslotDescending htransition + trace_colors_ne surviving_gamma_ne hposition htraceDelta slot_mem gamma_mem_U delta_mem_U + initial_terminal_present initial_gamma_present initial_survivor next_delta_eq_gamma + single_step swap_preserves_one swap_present_other root_swap_exchange swap_preserves_present + unfold ExtensionBaseAlgorithmCInvariant + refine ⟨?_, ?_, ?_⟩ + · intro a + exact (invariant a).1 + · exact @helper_branch_732 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport terminalSlot jSlot mu0 u p indices gamma + delta hterminalAtEnd hsupport hkind hgamma hdelta hTjInitial hterminalInClass + hslotEnumerates hslotDescending htransition slot_mem gamma_mem_U delta_mem_U single_step + invariant + · intro s gammaS deltaS hs hnot _ _ _ + have hsImage : s ∈ Finset.univ.image trace.slot := by + rw [trace.enumerates] + exact hs + rcases Finset.mem_image.mp hsImage with ⟨a, -, ha⟩ + exact False.elim (hnot a ha) + +private theorem helper_continuation_1280.{u_1, u_2} : + helperContinuation1280Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot + jSlot mu0 u p indices gamma delta hproper hone hterminalAtEnd hsupport hkind hgamma hdelta + hchain hTjInitial hterminalGammaMissing hinitialGammaPresent hinitialSI hterminalNoMissing + set supportClass : Finset (Fin ett.rounds) := ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport + intro hterminalInClass reversePosition slot traceGamma traceDelta nextColoring coloringNat + coloring hslotEnumerates hslotDescending htransition trace trace_colors_ne surviving_gamma_ne + set L : Finset (Fin ett.rounds) := supportClass.erase terminalSlot + intro U hposition htraceGamma htraceDelta slot_mem gamma_mem_U delta_mem_U + have initial_terminal_present (c : Fin k) (hc : c ∈ U) : + c ∈ PresentColors G mu0 terminalSupport := by + have hn : c ∉ MissingColors G mu0 terminalSupport := by + intro hm + have hi : c ∈ MissingColors G mu0 terminalSupport ∩ U := + Finset.mem_inter.mpr ⟨hm, hc⟩ + change c ∈ MissingColors G mu0 terminalSupport ∩ + ((ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase terminalSlot).biUnion + (fun t => ett.series.data.stored t.succ) at hi + rw [hterminalNoMissing] at hi + simp at hi + simpa [MissingColors] using hn + have initial_gamma_present (a : Fin p) : + trace.gamma a ∈ PresentColors G mu0 u := by + rw [htraceGamma] + exact hinitialGammaPresent a.rev + have initial_survivor (s : Fin ett.rounds) (gammaS deltaS : Fin k) + (hs : s ∈ L) + (hgs : ett.series.data.gamma s.succ = some gammaS) + (hds : ett.series.data.delta s.succ = some deltaS) : + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS := by + exact hinitialSI s gammaS deltaS hs hgs hds + have next_delta_eq_gamma (a c : Fin p) + (hca : c.val = a.val + 1) : trace.delta c = trace.gamma a := by + have ha := hposition a + have hc := hposition c + let q : Fin p := c.rev + have hpc : reversePosition c = q.castSucc := Fin.ext rfl + have hpa : reversePosition a = q.succ := by + apply Fin.ext + simp [q] + omega + rw [htraceDelta c, htraceGamma a, hpc, hpa] + exact (hchain q).symm + have single_step := @helper_single_step_295 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport u + have swap_preserves_one := @helper_swap_preserves_one_984 V E G k e0 + have swap_present_other {phi : PartialEdgeColoring E k} {v : V} + {alpha beta c : Fin k} {z : Sum V E} + (hc : c ∈ PresentColors G phi v) (hca : c ≠ alpha) + (hcb : c ≠ beta) : + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hc ⊢ + rcases hc with ⟨e, hev, hec⟩ + refine ⟨e, hev, ?_⟩ + by_cases heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z + · simp [TwoColorComponentSwap, heK, hec, hca, hcb] + · simpa [TwoColorComponentSwap, heK] using hec + have root_swap_exchange := @helper_root_swap_exchange_437 V E inferInstance inferInstance G k + have swap_preserves_present {phi : PartialEdgeColoring E k} {v : V} + {alpha beta : Fin k} {z : Sum V E} + (hne : alpha ≠ beta) + (halpha : alpha ∈ PresentColors G phi v) + (hbeta : beta ∈ PresentColors G phi v) : + ∀ c : Fin k, c ∈ PresentColors G phi v → + c ∈ PresentColors G + (TwoColorComponentSwap G phi alpha beta z) v := by + exact @helper_swap_preserves_present_502 V E inferInstance inferInstance G k + swap_present_other phi v alpha beta z halpha hbeta + exact @helper_continuation_1578 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) + (@hterminalSupport) (@terminalSlot) (@jSlot) (@mu0) (@u) (@p) (@indices) (@gamma) (@delta) + (@hproper) (@hone) (@hterminalAtEnd) (@hsupport) (@hkind) (@hgamma) (@hdelta) (@hchain) + (@hTjInitial) (@hterminalGammaMissing) (@hterminalInClass) (@hslotEnumerates) + (@hslotDescending) (@htransition) (@trace_colors_ne) (@surviving_gamma_ne) (@hposition) + (@htraceDelta) (@slot_mem) (@gamma_mem_U) (@delta_mem_U) (@initial_terminal_present) + (@initial_gamma_present) (@initial_survivor) (@next_delta_eq_gamma) (@single_step) + (@swap_preserves_one) (@swap_present_other) (@root_swap_exchange) (@swap_preserves_present) + +private theorem helper_branch_170.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot jSlot : Fin ett.rounds) (mu0 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (gamma delta : Fin (p + (1 : ℕ)) → Fin k) (_ : IsProperEdgeColoring G mu0) + (_ : IsOneEdgeUncolored mu0 e0) (_ : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) + (_ : + (∀ (a c : Fin (p + (1 : ℕ))) (_ : (↑a : ℕ) < (↑c : ℕ)), + (↑(indices a) : ℕ) < (↑(indices c) : ℕ))) + (_ : + (∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.chosenVertex (indices a).succ = some terminalSupport)) + (_ : + (∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.kind (indices a).succ = some TashkinovExtensionKind.PE)) + (_ : + (∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.gamma (indices a).succ = some (gamma a))) + (_ : + (∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.delta (indices a).succ = some (delta a))) + (_ : + (∀ (a : Fin (p + (1 : ℕ))), + ett.series.data.stored (indices a).succ = {gamma a, delta a})) + (_ : (∀ (a : Fin p), gamma a.succ = delta a.castSucc)) + (_ : Function.Injective (Fin.cons (gamma (0 : Fin (p + (1 : ℕ)))) delta)) + (_ : + (∀ + s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase + terminalSlot, + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree s.succ.castSucc))) + (_ : gamma (Fin.last p) ∈ MissingColors G mu0 u) + (_ : (∀ (a : Fin p), gamma a.castSucc ∈ PresentColors G mu0 u)) + (_ : + (∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) + (_ : + s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase + terminalSlot) + (_ : ett.series.data.gamma s.succ = some gammaS) + (_ : ett.series.data.delta s.succ = some deltaS), + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS)) + (_ : + (MissingColors G mu0 terminalSupport ∩ + ((ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase + terminalSlot).biUnion + fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ) = + ∅), + let supportClass : Finset (Fin ett.rounds) := + ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport; + ∀ (_ : terminalSlot ∈ supportClass) + (_ : + supportClass.erase terminalSlot = + Finset.image (fun (a : Fin p) ↦ indices a.castSucc) Finset.univ) + (_ : ¬p = (0 : ℕ)), + ∃ (trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 u), + ExtensionBaseAlgorithmCInvariant ett terminalSupport hterminalSupport terminalSlot jSlot + mu0 u trace := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot jSlot + mu0 u p indices gamma delta hproper hone hterminalAtEnd hincreasing hsupport hkind hgamma + hdelta hstored hchain hdistinct hTjInitial hterminalGammaMissing hinitialGammaPresent + hinitialSI hterminalNoMissing supportClass hterminalInClass herased hp + have hpPos : 0 < p := Nat.pos_of_ne_zero hp + let reversePosition : Fin p → Fin (p + 1) := fun a => a.rev.castSucc + let slot : Fin p → Fin ett.rounds := fun a => indices (reversePosition a) + let traceGamma : Fin p → Fin k := fun a => gamma (reversePosition a) + let traceDelta : Fin p → Fin k := fun a => delta (reversePosition a) + let nextColoring : ℕ → PartialEdgeColoring E k → PartialEdgeColoring E k := + fun a phi => if ha : a < p then + TwoColorComponentSwap G phi + (traceGamma ⟨a, ha⟩) (traceDelta ⟨a, ha⟩) (Sum.inl u) + else phi + let coloringNat : ℕ → PartialEdgeColoring E k := + Nat.rec mu0 (fun a phi => nextColoring a phi) + let coloring : Fin (p + 1) → PartialEdgeColoring E k := + fun a => coloringNat a.val + have hslotEnumerates : Finset.univ.image slot = supportClass.erase terminalSlot := by + rw [herased] + ext s + simp only [Finset.mem_image, Finset.mem_univ, true_and] + constructor + · rintro ⟨a, rfl⟩ + exact ⟨a.rev, by simp [slot, reversePosition]⟩ + · rintro ⟨a, rfl⟩ + exact ⟨a.rev, by simp [slot, reversePosition]⟩ + have hslotDescending : ∀ a b : Fin p, a.val < b.val → + (slot b).val < (slot a).val := by + intro a b hab + apply hincreasing + change b.rev.val < a.rev.val + exact Fin.rev_lt_rev.mpr hab + have htransition : ∀ a : Fin p, + coloring a.succ = TwoColorComponentSwap G (coloring a.castSucc) + (traceGamma a) (traceDelta a) (Sum.inl u) := by + intro a + simp [coloring, coloringNat, nextColoring, a.isLt] + let trace := @helperTrace1922 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) + (@terminalSlot) (@mu0) (@u) (@p) (@indices) (@gamma) (@delta) (@hterminalAtEnd) (@hsupport) + (@hkind) (@hgamma) (@hdelta) (@hterminalInClass) (@hslotEnumerates) (@hslotDescending) + (@htransition) + let colorChain : Fin (p + 2) → Fin k := Fin.cons (gamma 0) delta + have gamma_eq_chain (q : Fin (p + 1)) : + gamma q = colorChain q.castSucc := by + cases q using Fin.cases with + | zero => simp [colorChain] + | succ a => simpa [colorChain] using hchain a + have delta_eq_chain (q : Fin (p + 1)) : + delta q = colorChain q.succ := by + simp [colorChain] + have trace_colors_ne (a : Fin p) : + trace.gamma a ≠ trace.delta a := by + change gamma (reversePosition a) ≠ delta (reversePosition a) + rw [gamma_eq_chain, delta_eq_chain] + intro h + have hi := hdistinct h + have hv := congrArg Fin.val hi + simp at hv + have surviving_gamma_ne := @helper_surviving_gamma_ne_883 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot mu0 + u p indices gamma delta hterminalAtEnd hsupport hkind hgamma hdelta hdistinct hterminalInClass + hslotEnumerates hslotDescending htransition gamma_eq_chain delta_eq_chain + refine ⟨trace, ?_⟩ + let L := supportClass.erase terminalSlot + let U := L.biUnion fun t => ett.series.data.stored t.succ + have hposition (a : Fin p) : + (reversePosition a).val + a.val + 1 = p := by + simp [reversePosition, Fin.rev] + omega + have htraceGamma (a : Fin p) : + trace.gamma a = gamma (reversePosition a) := rfl + have htraceDelta (a : Fin p) : + trace.delta a = delta (reversePosition a) := rfl + have hslotIdentity (a : Fin p) : + trace.slot a = indices (reversePosition a) := rfl + have slot_mem (a : Fin p) : trace.slot a ∈ L := by + change trace.slot a ∈ supportClass.erase terminalSlot + rw [← trace.enumerates] + exact Finset.mem_image.mpr ⟨a, Finset.mem_univ _, rfl⟩ + have gamma_mem_U (a : Fin p) : trace.gamma a ∈ U := by + apply Finset.mem_biUnion.mpr + refine ⟨trace.slot a, slot_mem a, ?_⟩ + rw [hslotIdentity a, hstored (reversePosition a), + ← htraceGamma a] + simp + have delta_mem_U (a : Fin p) : trace.delta a ∈ U := by + apply Finset.mem_biUnion.mpr + refine ⟨trace.slot a, slot_mem a, ?_⟩ + rw [hslotIdentity a, hstored (reversePosition a), + ← htraceDelta a] + simp + exact @helper_continuation_1280 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating ett terminalSupport hterminalSupport terminalSlot jSlot mu0 u p + indices gamma delta hproper hone hterminalAtEnd hsupport hkind hgamma hdelta hchain + hTjInitial hterminalGammaMissing hinitialGammaPresent hinitialSI hterminalNoMissing + hterminalInClass hslotEnumerates hslotDescending htransition trace_colors_ne + surviving_gamma_ne hposition htraceGamma htraceDelta slot_mem gamma_mem_U delta_mem_U +private noncomputable abbrev helperTrace2072.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq E] → + {G : LooplessMultigraph V E} → + {k : ℕ} → + {e0 : E} → + {input : PartialEdgeColoring E k} → + {T : TreeSequence G e0} → + {generating : PartialEdgeColoring E k} → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (terminalSupport : V) → + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) → + (terminalSlot : Fin ett.rounds) → + (mu0 : PartialEdgeColoring E k) → + (u : V) → + (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds → + let supportClass : Finset (Fin ett.rounds) := + ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport; + terminalSlot ∈ supportClass → + (indices : Fin ((0 : ℕ) + (1 : ℕ)) → Fin ett.rounds) → + (Fin ((0 : ℕ) + (1 : ℕ)) → Fin k) → + (Fin ((0 : ℕ) + (1 : ℕ)) → Fin k) → + supportClass.erase terminalSlot = + Finset.image + (fun (a : Fin (0 : ℕ)) ↦ indices a.castSucc) + Finset.univ → + ExtensionBaseAlgorithmCTrace ett terminalSupport + hterminalSupport terminalSlot mu0 u := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport terminalSlot mu0 + u hterminalAtEnd supportClass hterminalInClass indices gamma delta herased + exact { + steps := 0 + slot := fun a => Fin.elim0 a + gamma := fun a => Fin.elim0 a + delta := fun a => Fin.elim0 a + coloring := fun _ => mu0 + initialColoring := rfl + terminalAtEnd := hterminalAtEnd + terminalInClass := hterminalInClass + enumerates := by simpa [supportClass] using herased.symm + strictlyDescending := fun a => Fin.elim0 a + chosenSupport := fun a => Fin.elim0 a + extensionKind := fun a => Fin.elim0 a + gammaField := fun a => Fin.elim0 a + deltaField := fun a => Fin.elim0 a + transition := fun a => Fin.elim0 a } + +theorem ExtensionBaseAlgorithmC {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot jSlot : Fin ett.rounds) + (mu0 : PartialEdgeColoring E k) (u : V) + (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds) + (gamma delta : Fin (p + 1) → Fin k) + (hproper : IsProperEdgeColoring G mu0) + (hone : IsOneEdgeUncolored mu0 e0) + (hterminalAtEnd : terminalSlot.val + 1 = ett.rounds) + (hincreasing : ∀ a c, a.val < c.val → + (indices a).val < (indices c).val) + (hclass : ∀ s : Fin ett.rounds, + s ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport ↔ + ∃ a : Fin (p + 1), indices a = s) + (hterminalIndex : indices (Fin.last p) = terminalSlot) + (hsupport : ∀ a, + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : ∀ a, + ett.series.data.kind (indices a).succ = + some TashkinovExtensionKind.PE) + (hgamma : ∀ a, + ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : ∀ a, + ett.series.data.delta (indices a).succ = some (delta a)) + (hstored : ∀ a, + ett.series.data.stored (indices a).succ = {gamma a, delta a}) + (hchain : ∀ a : Fin p, gamma a.succ = delta a.castSucc) + (hdistinct : Function.Injective (Fin.cons (gamma 0) delta)) + (hTjInitial : ∀ s : Fin ett.rounds, + s ∈ (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase terminalSlot → + TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree s.succ.castSucc)) + (hterminalGammaMissing : + gamma (Fin.last p) ∈ MissingColors G mu0 u) + (hinitialGammaPresent : ∀ a : Fin p, + gamma a.castSucc ∈ PresentColors G mu0 u) + (hinitialSI : ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS) + (hterminalNoMissing : + MissingColors G mu0 terminalSupport ∩ + ((ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase terminalSlot).biUnion + (fun s => ett.series.data.stored s.succ) = ∅) : + ∃ trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 u, + ExtensionBaseAlgorithmCInvariant ett terminalSupport hterminalSupport terminalSlot jSlot + mu0 u trace := by + classical + let supportClass := + ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport + have hterminalInClass : terminalSlot ∈ supportClass := by + rw [hclass] + exact ⟨Fin.last p, hterminalIndex⟩ + have herased := + @helper_herased_110 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport terminalSlot p indices hincreasing hclass + hterminalIndex + by_cases hp : p = 0 + · subst p + let trace := @helperTrace2072 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) + (@terminalSlot) (@mu0) (@u) (@hterminalAtEnd) (@hterminalInClass) (@indices) (@gamma) + (@delta) (@herased) + refine ⟨trace, ?_⟩ + unfold ExtensionBaseAlgorithmCInvariant + refine ⟨?_, ?_, ?_⟩ + · intro a + exact ⟨hproper, hone⟩ + · intro a + exact Fin.elim0 a + · intro s gammaS deltaS hs _ hsupportS hgammaS hdeltaS + exact hinitialSI s gammaS deltaS hs hgammaS hdeltaS + · exact @helper_branch_170 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport hterminalSupport terminalSlot jSlot mu0 u p indices + gamma delta hproper hone hterminalAtEnd hincreasing hsupport hkind hgamma hdelta hstored + hchain hdistinct hTjInitial hterminalGammaMissing hinitialGammaPresent hinitialSI + hterminalNoMissing hterminalInClass herased hp +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmCInvariant.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmCInvariant.lean new file mode 100644 index 0000000000..f6fc188aad --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmCInvariant.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmCTrace + +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent + +/-! +# Extension Base Algorithm CInvariant + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- +Properness, path-component and preservation conditions along Algorithm C's support-class swaps. -/ +def ExtensionBaseAlgorithmCInvariant {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (terminalSlot jSlot : Fin ett.rounds) (mu0 : PartialEdgeColoring E k) (u : V) + (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot mu0 u) : + Prop := + (∀ a : Fin (trace.steps + 1), + IsProperEdgeColoring G (trace.coloring a) ∧ IsOneEdgeUncolored (trace.coloring a) e0) ∧ + (∀ a : Fin trace.steps, + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ + trace.delta a ∈ MissingColors G (trace.coloring a.castSucc) u ∧ + TwoColorNontrivialPathComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl u) ∧ + (∀ w : V, + w ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc) → + Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl u) → + w = terminalSupport) ∧ + (Sum.inl terminalSupport ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl u) → + ¬Set.Subsingleton + ((TwoColorIncidenceGraph G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a)).neighborSet + (Sum.inl terminalSupport))) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → + (∀ b : Fin trace.steps, b.val ≤ a.val → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport (trace.coloring a.succ) gammaS + deltaS) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → + (∀ a : Fin trace.steps, trace.slot a ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport (trace.coloring (Fin.last trace.steps)) + gammaS deltaS + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmCTrace.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmCTrace.lean new file mode 100644 index 0000000000..792ddb4c22 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmCTrace.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass + +/-! +# Extension Base Algorithm CTrace + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A descending enumeration of the terminal support class excluding the terminal slot, with its +color swaps. +-/ +structure ExtensionBaseAlgorithmCTrace {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) (terminalSlot : Fin ett.rounds) + (mu0 : PartialEdgeColoring E k) (u : V) where + /-- The number of component swaps in the trace. -/ + steps : ℕ + /-- The extension-series slot processed by each swap. -/ + slot : Fin steps → Fin ett.rounds + /-- The auxiliary color or color family used by this configuration. -/ + gamma : Fin steps → Fin k + /-- The companion color used for the component swap at each stage. -/ + delta : Fin steps → Fin k + /-- The partial coloring or sequence of partial colorings recorded by this certificate. -/ + coloring : Fin (steps + 1) → PartialEdgeColoring E k + initialColoring : coloring 0 = mu0 + terminalAtEnd : terminalSlot.val + 1 = ett.rounds + terminalInClass : + terminalSlot ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport + enumerates : + Finset.univ.image slot = + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot + strictlyDescending : ∀ a b, a.val < b.val → (slot b).val < (slot a).val + chosenSupport : ∀ a, ett.series.data.chosenVertex (slot a).succ = some terminalSupport + extensionKind : ∀ a, ett.series.data.kind (slot a).succ = some TashkinovExtensionKind.PE + gammaField : ∀ a, ett.series.data.gamma (slot a).succ = some (gamma a) + deltaField : ∀ a, ett.series.data.delta (slot a).succ = some (delta a) + transition : + ∀ a, + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (gamma a) (delta a) (Sum.inl u) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean new file mode 100644 index 0000000000..63aca64cd8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean @@ -0,0 +1,6495 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmA +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmB +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmC +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneSelection +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoContradiction +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation19 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation20 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation21 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation23 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim44 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim45 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim45Singleton +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim46 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimMissingColors +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimStrongInterchangeable +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimTreeEdgeColors +public import LeanPool.GoldbergSeymour.ExtensionBaseClosure +public import LeanPool.GoldbergSeymour.ExtensionBaseDeltaExclusion +public import LeanPool.GoldbergSeymour.ExtensionBaseStoredPairOverlap +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportOrder +public import LeanPool.GoldbergSeymour.ExtensionRules +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TashTree +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Extension Base Auxiliary Lemmas + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperHclaim45Package4916Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (_ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : IsProperEdgeColoring G rho1) (_ : IsOneEdgeUncolored rho1 e0) (_ : ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : + seed.vertex (Fin.last seed.length) = v) (_ : TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree q.succ.castSucc)), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (_ : TashkinovClosure rho1 seed TjPrime) (_ : + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime)) (_ : + TreeSequenceInitialSegment seed TjPrime) (_ : StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ (TashkinovStoredColors + ett.series.data jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho1) (_ : ( + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, MissingColors G rho1 x ∩ supportColors = ∅)), + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); + ∀ (_ : gamma ∈ supportColors) (_ : delta ∈ supportColors) (_ : gamma ≠ delta) (_ : ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length) (_ : seed.length ≤ (↑a : ℕ)), + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a))) (_ : delta ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) (ett.series.data.tree + jSlot.succ.castSucc)) (_ : v ∈ TreeSequenceVertexSet seed) (fN : E) (_ : delta ∈ + MissingColors G rho1 v), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (_ : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (_ : + componentPath.IsPath) (_ : {z : V ⊕ E | z ∈ componentPath.support} = C) (_ : x ∉ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime) (u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) + (Sum.inl u)) (_ : exitPath.IsPath) (_ : (2 : ℕ) ≤ exitPath.length) (_ : ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support)) (_ : ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u)) (_ : ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support)) (_ + : ¬Incident G u fN) (_ : u ∈ TreeSequenceVertexSet TjPrime) (_ : u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (_ : MaximumDegree G + (1 : ℕ) ≤ k), + ∀ beta ∈ MissingColors G rho1 u, beta ∉ supportColors → TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) seed (ett.series.data.tree jSlot.succ.castSucc) + → + ∀ (z : V) (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z → seed.length ≤ + (↑zPosition : ℕ) → ((seed.length < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) → + ( + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) → ((0 : ℕ) < p0 → + ∃ (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (_ : u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (exitPath : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u)), exitPath.IsPath ∧ (2 : ℕ) ≤ exitPath.length ∧ ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) ∧ ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬Incident G u fN ∧ + ∀ beta ∈ MissingColors G rho1 u, + ∃ (z : V) (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z ∧ seed.length ≤ + (↑zPosition : ℕ) ∧ ((seed.length < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + ( + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) ∧ ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) ∧ + ∃ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 ∧ IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 ∧ ( + ∀ v ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz ∪ { z } ∪ + (TreeVerticesBefore TjPrime u huPrime ∪ { u })).erase u).erase z, MissingColors G rho3 v = + MissingColors G rho1 v) ∧ ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → delta ∈ MissingColors G rho3 z) ∧ (z ∈ TreeVerticesBefore + TjPrime u huPrime → MissingColors G rho3 z = MissingColors G rho1 z) ∧ gammaFirst ∈ + MissingColors G rho3 u) → (p0 = (0 : ℕ) → gammaFirst = gamma) → + ∃ (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (_ : u0 ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (exitPath0 : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u0)), exitPath0.IsPath ∧ (2 : ℕ) ≤ exitPath0.length ∧ ( + ∀ y ∈ exitPath0.support, y ∈ componentPath.support) ∧ ( + ∀ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl y ∈ exitPath0.support ↔ y = u0) ∧ ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u0 g ∧ Sum.inr g ∈ exitPath0.support) ∧ + ¬Incident G u0 fN ∧ + ∃ beta0 ∈ MissingColors G rho1 u0, beta0 ∉ supportColors ∧ + ∃ (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition0 = z0 ∧ seed.length ≤ + (↑zPosition0 : ℕ) ∧ ((seed.length < (↑zPosition0 : ℕ) ∧ beta0 ∈ MissingColors G rho1 z0 ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition0 : ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition0 = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + ( + ∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0, beta0 ∉ + MissingColors G rho1 y) ∧ ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition0 : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta0) ∧ + ∃ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 ∧ IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 ∧ ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ { z0 } ∪ + (TreeVerticesBefore TjPrime u0 huPrime0 ∪ { u0 })).erase u0).erase z0, MissingColors G + rho3 y = MissingColors G rho1 y) ∧ ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) ∧ + (beta0 ∈ MissingColors G rho1 z0 → delta ∈ MissingColors G rho3 z0) ∧ (z0 ∈ + TreeVerticesBefore TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 + z0) ∧ gammaFirst ∈ MissingColors G rho3 u0 + +theorem ExtendedTashkinovTree.pe_chosenVertex_mem_previousTree + {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (q : Fin ett.rounds) (v : V) + (hqKind : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) + (hqVertex : ett.series.data.chosenVertex q.succ = some v) : + v ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) := by + classical + generalize htarget : q.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hqKind) + cases hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hqKind) + cases hbad + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + simpa using (congrArg Fin.val htarget).symm + subst i + have hvChoice : choice.vertex = v := + Option.some.inj + (currentVertex.symm.trans (by simpa [htarget] using hqVertex)) + simpa [hvChoice] using choice.vertexDefective.1 + +private theorem helper_stageToStage_226.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (_ : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (_ : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal) + (_ : (∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A A)) + (_ : + (∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) + (_ : TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) + (_ : + (∀ (i : Fin (ett.rounds + (1 : ℕ))) (_ : (0 : ℕ) < (↑i : ℕ)), + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) + (ett.series.data.tree i.succ))) + (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment + (ett.series.data.tree (⟨a, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree (⟨b, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive segmentRefl segmentTrans stepSegment a b ha hab hb + have chain : ∀ (d : ℕ) (_hd : a + d ≤ b), + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) + (ett.series.data.tree ⟨a + d, by omega⟩) := by + intro d hd + induction d with + | zero => simpa using segmentRefl (ett.series.data.tree ⟨a, by omega⟩) + | succ d ih => + have hprev := ih (by omega) + let idx : Fin (ett.rounds + 1) := ⟨a + d, by omega⟩ + have hone := stepSegment idx (by dsimp [idx]; omega) + have hone' : TreeSequenceInitialSegment + (ett.series.data.tree ⟨a + d, by omega⟩) + (ett.series.data.tree ⟨a + (d + 1), by omega⟩) := by + simpa [idx, Nat.add_assoc] using hone + exact segmentTrans hprev hone' + have hchain := chain (b - a) (by omega) + convert hchain using 1; congr 1; apply Fin.ext; simp; omega + +private theorem helper_hLowerElementary_277.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (_ : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (_ : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal) (r : Fin ett.rounds) + (_ : (↑r : ℕ) < (↑q : ℕ)), + ColoredVertexSetElementary G (ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower v this q hqTerminal hvFinal + hfirstUpper hfirstPositive r hrq + by_cases hrZero : r.val = 0 + · have hbase : ColoredVertexSetElementary G + (ett.series.data.coloring 0) + (TreeSequenceVertexSet + (ett.series.data.tree ⟨1, by omega⟩)) := + (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + have hrColor : r.castSucc = (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + simpa using hrZero + have hrTree : r.succ.castSucc = + (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simpa using hrZero + simpa [hrColor, hrTree] using hbase + · obtain ⟨lower, hround, hlowerMP, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP r.val + (by omega) (by omega) + have hpack := hlower lower (by omega) (by omega) hlowerMP + exact hpack.1 + +private theorem helper_hxP_352.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) (_ : + ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (_ : (0 : ℕ) < + ETTFirstAppearanceIndex ett v hvFinal) (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (r a : Fin ett.rounds) (_ : (↑a : ℕ) < (↑r : ℕ)) (x : V) + (hxFinal : x ∈ TreeSequenceVertexSet T) (_ : ETTFirstAppearanceIndex ett x hxFinal ≤ (↑a : + ℕ) + (1 : ℕ)) (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (⟨(↑r : ℕ) + + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑r : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : lower.rounds = (↑r : ℕ)), + let P : TreeSequence G e0 := ett.series.data.tree r.castSucc.castSucc; x ∈ + TreeSequenceVertexSet P := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive stageToStage vertexTransfer r a har x hxFinal hfirstR lower hround P + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + x ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hnonempty : candidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett (Fin.last ett.rounds) = T by + simp [ExtendedTashkinovLadderStage, Fin.lastCases_last]] + exact hxFinal + let first := candidates.min' hnonempty + have hfirstBound : first.val + 1 ≤ a.val + 1 := by + have hfirstRaw := hfirstR + unfold ETTFirstAppearanceIndex at hfirstRaw + dsimp at hfirstRaw + dsimp [first, candidates] + convert hfirstRaw using 1 + have hfirstMem : first ∈ candidates := + Finset.min'_mem candidates hnonempty + change first ∈ candidates at hfirstMem + let firstBase : Fin ett.rounds := ⟨first.val, by omega⟩ + have hfirstEq : first = firstBase.castSucc := by + apply Fin.ext + rfl + have hxFirst : x ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨first.val + 1, by omega⟩) := by + have hxLadder := (Finset.mem_filter.mp hfirstMem).2 + rw [hfirstEq] at hxLadder + unfold ExtendedTashkinovLadderStage at hxLadder + rw [Fin.lastCases_castSucc] at hxLadder + convert hxLadder using 1; congr 2 + have hseg := stageToStage (first.val + 1) r.val (by omega) + (by omega) (by omega) + have hxStage := vertexTransfer hseg hxFirst + have hPIndex : (⟨r.val, by omega⟩ : Fin (ett.rounds + 2)) = + r.castSucc.castSucc := by + apply Fin.ext + rfl + rw [hPIndex] at hxStage + exact hxStage + +private theorem helper_hyP_393.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) (_ : + ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (_ : (0 : ℕ) < + ETTFirstAppearanceIndex ett v hvFinal) (r a : Fin ett.rounds) (_ : (↑a : ℕ) < (↑r : ℕ)) (x + : V) (_ : x ∈ TreeSequenceVertexSet T) (lower : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (⟨(↑r : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑r : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : lower.rounds = (↑r : ℕ)), + let P : TreeSequence G e0 := ett.series.data.tree r.castSucc.castSucc; + let Tnext : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + ∀ (_ : TreeSequenceInitialSegment P Tnext) (_ : x ∈ TreeSequenceVertexSet P) (y : V) (_ : + TreeVertexOrder (ett.series.data.tree r.succ.castSucc) y x), y ∈ TreeSequenceVertexSet P + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive r a har x hxFinal lower hround P Tnext hPNext hxP y hyx + rcases hPNext with ⟨hlen, hvertices, hedges⟩ + rcases Finset.mem_image.mp hxP with ⟨ix, _, hix⟩ + rcases hyx with ⟨jy, jx, hjy, hjx, hjlt⟩ + have hjxEq : jx = Fin.castLE (Nat.succ_le_succ hlen) ix := by + apply Tnext.vertex_injective + exact hjx.trans ((hvertices ix).trans hix).symm + have hjyBound : jy.val < P.length + 1 := by + have hjxVal := congrArg Fin.val hjxEq + simp only [Fin.val_castLE] at hjxVal + omega + let iy : Fin (P.length + 1) := ⟨jy.val, hjyBound⟩ + apply Finset.mem_image.mpr + refine ⟨iy, Finset.mem_univ _, ?_⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hlen) iy = jy := by + apply Fin.ext + rfl + have hnextIndex : r.castSucc.succ = r.succ.castSucc := by + apply Fin.ext + rfl + have hjy' : Tnext.vertex jy = y := by + simpa [Tnext, hnextIndex] using hjy + exact (hvertices iy).symm.trans (by simpa [hcast] using hjy') + +private theorem helper_boundaryRestrict_424.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (r : Fin ett.rounds) (sigmaR : PartialEdgeColoring E k) (deltaR + : Fin k), + let P : TreeSequence G e0 := ett.series.data.tree r.castSucc.castSucc; + let Tnext : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + ∀ (_ : TreeSequenceInitialSegment P Tnext), + ∀ z ∈ TreeSequenceVertexSet P, + ∀ f ∈ BoundaryColorEdges G sigmaR (TreeSequenceVertexSet Tnext) deltaR, Incident G z f → f ∈ + BoundaryColorEdges G sigmaR (TreeSequenceVertexSet P) deltaR := by + classical + intro V E _ _ _ G k e0 input T generating ett vertexTransfer r sigmaR deltaR P Tnext hPNext z + hzP f hf hzf + have hfBoundary := (Finset.mem_filter.mp hf).1 + have hfColor := (Finset.mem_filter.mp hf).2 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hfBoundary + obtain ⟨zin, hzin, zout, hzout, hends⟩ := hfBoundary + have hzNext := vertexTransfer hPNext hzP + have hzCases : z = zin ∨ z = zout := by + simpa [Incident, hends] using hzf + have hzEq : z = zin := hzCases.resolve_right fun hzEq => + hzout (hzEq ▸ hzNext) + apply Finset.mem_filter.mpr + refine ⟨?_, hfColor⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + refine ⟨z, hzP, zout, ?_, ?_⟩ + · intro hzoutP + exact hzout (vertexTransfer hPNext hzoutP) + · simpa [hzEq] using hends + +private theorem helper_hfxy_453.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (r : Fin ett.rounds) (sigmaR : PartialEdgeColoring E k) (deltaR + : Fin k) (x : V), + let P : TreeSequence G e0 := ett.series.data.tree r.castSucc.castSucc; + let Tnext : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + ∀ (_ : TreeSequenceInitialSegment P Tnext) (_ : x ∈ TreeSequenceVertexSet P), + ∀ y ∈ TreeSequenceVertexSet P, y ≠ x → + ∀ fx ∈ BoundaryColorEdges G sigmaR (TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc)) deltaR, Incident G x fx → + ∀ fy ∈ BoundaryColorEdges G sigmaR (TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc)) deltaR, Incident G y fy → fy ∈ BoundaryColorEdges G sigmaR + (TreeSequenceVertexSet P) deltaR → fx ≠ fy := by + classical + intro V E _ _ _ G k e0 input T generating ett vertexTransfer r sigmaR deltaR x P Tnext hPNext + hxP y hyP hyne fx hfxBoundary hfxIncident fy hfyBoundary hfyIncident hfyP hfeq + subst fy + have hfBoundary := (Finset.mem_filter.mp hfxBoundary).1 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hfBoundary + obtain ⟨zin, hzin, zout, hzout, hends⟩ := hfBoundary + have hxCases : x = zin ∨ x = zout := by + simpa [Incident, hends] using hfxIncident + have hyCases : y = zin ∨ y = zout := by + simpa [Incident, hends] using hfyIncident + have hxNext := vertexTransfer hPNext hxP + have hyNext := vertexTransfer hPNext hyP + have hxEq : x = zin := hxCases.resolve_right fun hxEq => + hzout (hxEq ▸ hxNext) + have hyEq : y = zin := hyCases.resolve_right fun hyEq => + hzout (hyEq ▸ hyNext) + exact hyne (hyEq.trans hxEq.symm) + +private theorem helper_hstableLower_484.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) (_ : + ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (_ : (0 : ℕ) < + ETTFirstAppearanceIndex ett v hvFinal) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (r _ : Fin ett.rounds) (sigmaR : PartialEdgeColoring E k) (_ : + StableColoring (ett.series.data.tree r.succ.castSucc) (TashkinovStoredColors + ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc) sigmaR) (x : V) (_ : x ∈ + TreeSequenceVertexSet T) (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (⟨(↑r : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑r : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), + let nLower : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let P : TreeSequence G e0 := ett.series.data.tree r.castSucc.castSucc; + let Tnext : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + ∀ (_ : TreeSequenceInitialSegment P Tnext) (_ : lower.series.data.tree nLower.castSucc = P) (_ + : lower.series.data.coloring nLower = ett.series.data.coloring r.castSucc) (_ : + TashkinovStoredColors lower.series.data nLower = TashkinovStoredColors ett.series.data + r.castSucc), StableColoring (lower.series.data.tree nLower.castSucc) + (TashkinovStoredColors lower.series.data nLower) (lower.series.data.coloring nLower) + sigmaR := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive vertexTransfer r a sigmaR hstableR x hxFinal lower nLower P Tnext hPNext + htreeLower hcolorLower hstoredLower + rw [htreeLower, hstoredLower, hcolorLower] + constructor + · intro f hfP hcontrolled + apply hstableR.1 f + · rcases hfP with ⟨z, hz, hzf⟩ + exact ⟨z, vertexTransfer hPNext hz, hzf⟩ + · rcases hcontrolled with ⟨c, hc, hfc⟩ + refine ⟨c, ?_, hfc⟩ + rcases Finset.mem_union.mp hc with hc | hc + · apply Finset.mem_union.mpr + left + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨z, hz, hcz⟩ + exact ⟨z, vertexTransfer hPNext hz, hcz⟩ + · exact Finset.mem_union.mpr (Or.inr hc) + · intro z hz + exact hstableR.2 z (vertexTransfer hPNext hz) + +private theorem helper_hfirstLower_539.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (_ : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (_ : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal) (r a : Fin ett.rounds) + (har : (↑a : ℕ) < (↑r : ℕ)) (x : V) (hxFinal : x ∈ TreeSequenceVertexSet T) + (_ : ETTFirstAppearanceIndex ett x hxFinal ≤ (↑a : ℕ) + (1 : ℕ)) + (lower : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (⟨(↑r : ℕ) + (1 : ℕ), by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.coloring (⟨(↑r : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hround : lower.rounds = (↑r : ℕ)) + (_ : + (∀ (i : Fin (lower.rounds + (2 : ℕ))), + lower.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i))), + let aLower : Fin lower.rounds := (⟨(↑a : ℕ), by omega⟩ : Fin lower.rounds); + ∀ + (hxLower : + x ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (⟨(↑r : ℕ) + (1 : ℕ), by omega⟩ : Fin (ett.rounds + (2 : ℕ))))), + ETTFirstAppearanceIndex lower x hxLower ≤ (↑aLower : ℕ) + (1 : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive r a har x hxFinal hfirstR lower hround htrees aLower hxLower + unfold ETTFirstAppearanceIndex + dsimp + let fullCandidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + x ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hfullNonempty : fullCandidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [fullCandidates, Finset.mem_filter, Finset.mem_univ, + true_and] + rw [show ExtendedTashkinovLadderStage ett (Fin.last ett.rounds) = T by + simp [ExtendedTashkinovLadderStage, Fin.lastCases_last]] + exact hxFinal + let mf := fullCandidates.min' hfullNonempty + have hmfBound : mf.val + 1 ≤ a.val + 1 := by + have hfirstRaw := hfirstR + unfold ETTFirstAppearanceIndex at hfirstRaw + dsimp at hfirstRaw + dsimp [mf, fullCandidates] + convert hfirstRaw using 1 + let lowerCandidates : Finset (Fin (lower.rounds + 1)) := + Finset.univ.filter fun i => + x ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage lower i) + have hlowerNonempty : lowerCandidates.Nonempty := by + refine ⟨Fin.last lower.rounds, ?_⟩ + simp only [lowerCandidates, Finset.mem_filter, Finset.mem_univ, + true_and] + rw [show ExtendedTashkinovLadderStage lower + (Fin.last lower.rounds) = + ett.series.data.tree ⟨r.val + 1, by omega⟩ by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hxLower + let mfLower : Fin (lower.rounds + 1) := ⟨mf.val, by omega⟩ + let mfBase : Fin lower.rounds := ⟨mf.val, by omega⟩ + let mfFull : Fin ett.rounds := ⟨mf.val, by omega⟩ + have hmfLower : mfLower = mfBase.castSucc := by + apply Fin.ext + rfl + have hmfFull : mf = mfFull.castSucc := by + apply Fin.ext + rfl + have hstageEq : ExtendedTashkinovLadderStage lower mfLower = + ExtendedTashkinovLadderStage ett mf := by + rw [hmfLower, hmfFull] + unfold ExtendedTashkinovLadderStage + rw [Fin.lastCases_castSucc, Fin.lastCases_castSucc, + htrees mfBase.succ.castSucc] + congr 1 + have hmfMemFull := Finset.min'_mem fullCandidates hfullNonempty + have hmfMemLower : mfLower ∈ lowerCandidates := by + simp only [lowerCandidates, Finset.mem_filter, Finset.mem_univ, + true_and] + rw [hstageEq] + exact (Finset.mem_filter.mp hmfMemFull).2 + have hle := Finset.min'_le lowerCandidates mfLower hmfMemLower + have hleVal := Fin.le_iff_val_le_val.mp hle + have htarget : + (lowerCandidates.min' hlowerNonempty).val + 1 ≤ a.val + 1 := by + dsimp [mfLower] at hleVal + omega + convert htarget using 1 + +private theorem helper_branch_664.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (t : Fin ett.rounds) (vt : V) (gammaT deltaT : Fin k), + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma t.succ = some gammaT + → ett.series.data.delta t.succ = some deltaT → + ∀ (i : Fin ett.rounds), IsProperEdgeColoring G (ett.series.data.coloring i.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring i.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring + i.castSucc) (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate ett.series.data i.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)), + ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data i.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + i.succ.castSucc))) → + ∀ (actualGamma : Fin k), ParallelExtensionColor ett.series.data i.castSucc choice.selected + choice.vertex actualGamma → + ∀ (secondStable : PartialEdgeColoring E k), StableColoring (ett.series.data.tree + i.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data i.castSucc)) + choice.selected secondStable → TreeExit (ett.series.data.tree i.succ.castSucc) + secondStable actualGamma choice.color choice.vertex → ett.series.data.coloring i.succ = + TwoColorComponentSwap G secondStable actualGamma choice.color (Sum.inl choice.vertex) → + IsProperEdgeColoring G (ett.series.data.coloring i.succ) → IsOneEdgeUncolored + (ett.series.data.coloring i.succ) e0 → ett.series.data.stored i.succ = + { choice.color, actualGamma } → ett.series.data.connectingEdges i.succ = { choice.edge } → + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex i.succ = some choice.vertex → ett.series.data.outsideVertex + i.succ = some choice.otherEndpoint → ett.series.data.delta i.succ = some choice.color → + ett.series.data.gamma i.succ = some actualGamma → TashkinovClosure + (ett.series.data.coloring i.succ) (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ) → TreeSequenceInitialSegment (ett.series.data.tree + i.succ.castSucc) (ett.series.data.tree i.succ.succ) → (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length → t.succ = i.succ → + IsOneEdgeUncolored (ett.series.data.coloring i.succ) e0 ∧ deltaT ∈ MissingColors G + (ett.series.data.coloring i.succ) vt := by + classical + intro V E _ _ _ G k e0 input T generating ett t vt gammaT deltaT htVertex htGamma htDelta i + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternativeFails actualGamma gammaRule secondStable secondStableRelation + exitWitness currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension htarget + have hi : i = t := by + apply Fin.ext + simpa using (congrArg Fin.val htarget).symm + subst i + have hvChoice : choice.vertex = vt := + Option.some.inj + (currentVertex.symm.trans (by simpa [htarget] using htVertex)) + have hdeltaChoice : choice.color = deltaT := + Option.some.inj + (currentDelta.symm.trans (by simpa [htarget] using htDelta)) + have hgammaChoice : actualGamma = gammaT := + Option.some.inj + (currentGamma.symm.trans (by simpa [htarget] using htGamma)) + subst vt + subst deltaT + subst gammaT + have hgammaMissing : actualGamma ∈ + MissingColors G secondStable choice.vertex := by + exact (secondStableRelation.2 choice.vertex + choice.vertexDefective.1).symm ▸ gammaRule.1 + have hedge : secondStable choice.edge = some choice.color := by + exact (secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, by simp, choice.edgeColor⟩).trans choice.edgeColor + have hgammaDelta : actualGamma ≠ choice.color := by + intro heq + have hpresent : actualGamma ∈ + PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨choice.edge, choice.edgeIncident, by simpa [heq] using hedge⟩ + exact (Finset.mem_sdiff.mp hgammaMissing).2 hpresent + have componentEdge : + ∀ e : E, Incident G choice.vertex e → secondStable e = some actualGamma ∨ secondStable e = + some choice.color → Sum.inr e ∈ TwoColorComponent G secondStable actualGamma choice.color + (Sum.inl choice.vertex) := by + intro e he hcolor + change (TwoColorIncidenceGraph G secondStable actualGamma + choice.color).connectedComponentMk (Sum.inr e) = _ + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, he, hcolor] + have hgammaNo : ∀ e : E, Incident G choice.vertex e → + secondStable e ≠ some actualGamma := by + intro e he hec + apply (Finset.mem_sdiff.mp hgammaMissing).2 + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, he, hec⟩ + have hdeltaMissing : choice.color ∈ MissingColors G + (TwoColorComponentSwap G secondStable actualGamma choice.color + (Sum.inl choice.vertex)) choice.vertex := by + apply Finset.mem_sdiff.mpr + refine ⟨by simp, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + obtain ⟨e, he, hec⟩ := hpresent + rw [TwoColorComponentSwap] at hec + by_cases hcomp : Sum.inr e ∈ TwoColorComponent G secondStable + actualGamma choice.color (Sum.inl choice.vertex) + · simp [hcomp] at hec + by_cases heg : secondStable e = some actualGamma + · exact (hgammaNo e he heg).elim + · by_cases hed : secondStable e = some choice.color + · simp [hed, hgammaDelta] at hec + exact hgammaDelta hec.symm + · simp [heg, hed] at hec + · simp only [Fin.castSucc_succ, hcomp, ↓reduceIte] at hec + exact hcomp (componentEdge e he (Or.inr hec)) + refine ⟨by simpa [htarget] using currentOneUncolored, ?_⟩ + rw [show ett.series.data.coloring t.succ = + TwoColorComponentSwap G secondStable actualGamma choice.color + (Sum.inl choice.vertex) by simpa [htarget] using currentColoring] + exact hdeltaMissing + +private theorem helper_hPESlotData_805.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (t : Fin ett.rounds), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT + := by + classical + intro V E _ _ _ G k e0 input T generating ett t htKind + generalize htarget : t.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero t htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using htKind) + cases hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using htKind) + cases hbad + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = t := by + apply Fin.ext + simpa using (congrArg Fin.val htarget).symm + subst i + refine ⟨choice.vertex, actualGamma, choice.color, ?_, ?_, ?_⟩ + · simpa [htarget] using currentVertex + · simpa [htarget] using currentGamma + · simpa [htarget] using currentDelta + +private theorem helper_hPEStored_851.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind + t.succ = some TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = + { gammaT, deltaT } := by + classical + intro V E _ _ _ G k e0 input T generating ett t gammaT deltaT htKind htGamma htDelta + generalize htarget : t.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero t htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using htKind) + cases hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using htKind) + cases hbad + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = t := by + apply Fin.ext + simpa using (congrArg Fin.val htarget).symm + subst i + have hgammaEq : actualGamma = gammaT := + Option.some.inj + (currentGamma.symm.trans (by simpa [htarget] using htGamma)) + have hdeltaEq : choice.color = deltaT := + Option.some.inj + (currentDelta.symm.trans (by simpa [htarget] using htDelta)) + rw [show ett.series.data.stored t.succ = {choice.color, actualGamma} by + simpa [htarget] using currentStored, hgammaEq, hdeltaEq] + ext c + simp [or_comm] + +private theorem helper_hdeltaAvoids_958.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc))) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) + → Fin ett.rounds) (_ : ( + ∀ (a b : Fin (p + (1 : ℕ))) (_ : (↑a : ℕ) < (↑b : ℕ)), (↑(indices a) : ℕ) < (↑(indices b) : + ℕ))) (_ : ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r)) (gammaClass deltaClass : Fin (p + (1 : ℕ)) → Fin k) + (_ : ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gammaClass a))) (_ : + ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (deltaClass a))) (_ : + u ∈ TreeSequenceVertexSet T) (a b : Fin (p + (1 : ℕ))) (_ : (↑a : ℕ) ≤ (↑b : ℕ)), + deltaClass b ≠ gammaClass a := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hdeltaExclusion u p indices hincreasing hclass gammaClass deltaClass + hgammaClass hdeltaClass huFinal a b hab + have haClass := (hclass (indices a)).2 ⟨a, rfl⟩ + have hbClass := (hclass (indices b)).2 ⟨b, rfl⟩ + have haData := haClass + have hbData := hbClass + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at haData hbData + have haActive : indices a ∈ ExtensionBaseActiveIndices ett v hvFinal := by + exact haData.1 + have hbActive : indices b ∈ ExtensionBaseActiveIndices ett v hvFinal := by + exact hbData.1 + have habSlots : (indices a).val ≤ (indices b).val := by + by_cases heq : a = b + · subst b + exact le_rfl + · exact Nat.le_of_lt (hincreasing a b (by omega)) + exact (hdeltaExclusion.1 (indices a) (indices b) u u huFinal huFinal + (deltaClass b) (gammaClass a) haActive hbActive habSlots + haData.2 hbData.2 (hdeltaClass b) (hgammaClass a)).2 + +private theorem helper_hterminalBefore_988.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T), (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) < (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → vt = vs ∨ TreeVertexOrder T vt vs) ∧ ( + ∀ (s : Fin ett.rounds) (vs : V) (hvsFinal : vs ∈ TreeSequenceVertexSet T), s ∈ + ExtensionBaseActiveIndices ett v hvFinal → ett.series.data.chosenVertex s.succ = some vs → + ETTFirstAppearanceIndex ett vs hvsFinal = ETTFirstAppearanceIndex ett v hvFinal ∧ (v = vs + ∨ TreeVertexOrder T v vs)) ∧ + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → vs ≠ vt → TreeVertexOrder T vs vt → (↑t : + ℕ) < (↑s : ℕ)) → + ∀ (t : Fin ett.rounds) (vt : V), t ∈ ExtensionBaseRestorationIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → TreeVertexOrder T v vt := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal hsupportOrder t vt htRest htVertex + have htData := htRest + simp only [ExtensionBaseRestorationIndices, Finset.mem_sdiff] at htData + have htActive := htData.1 + have htActiveData := htActive + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at htActiveData + obtain ⟨htFirst, htKind, vt0, hvt0Final, hvt0Vertex, hvt0First⟩ := + htActiveData + have hvt0Eq : vt0 = vt := + Option.some.inj (hvt0Vertex.symm.trans htVertex) + subst vt0 + have horder := (hsupportOrder.2.1 t vt hvt0Final htActive htVertex).2 + exact horder.resolve_left fun hEq => by + apply htData.2 + simp only [ExtensionBaseSupportClass, Finset.mem_filter] + exact ⟨htActive, by simpa [hEq] using htVertex⟩ + +private theorem helper_hclassMissing_1053.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ (u : V) (_ : (ExtensionBaseSupportClass ett v hvFinal u).Nonempty), + ∃ (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (gammaClass : Fin (p + (1 : ℕ)) → Fin + k) (deltaClass : Fin (p + (1 : ℕ)) → Fin k), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) ∧ + ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gammaClass a)) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (deltaClass a)) ∧ ( + ∀ (a : Fin p), gammaClass a.succ = deltaClass a.castSucc) ∧ Function.Injective (Fin.cons + (gammaClass (0 : Fin (p + (1 : ℕ)))) deltaClass) ∧ ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), ( + ∀ r ∈ ExtensionBaseActiveIndices ett v hvFinal, ett.series.data.chosenVertex r.succ ≠ some x) + → MissingColors G sigma x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + let storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p + (1 : ℕ))) ↦ + ett.series.data.stored (indices a).succ; MissingColors G sigma u ∩ storedPairs = + {deltaClass (Fin.last p)} ∧ MissingColors G (ett.series.data.coloring jSlot.castSucc) u = + MissingColors G sigma u \ {deltaClass (Fin.last p)} ∪ + {gammaClass (0 : Fin (p + (1 : ℕ)))})) (u : V) (t : Fin ett.rounds) (deltaT : Fin k) (_ : + ExtensionBaseSupportClass ett v hvFinal u ⊆ ExtensionBaseRestorationIndices ett v hvFinal) + (_ : t ∈ ExtensionBaseSupportClass ett v hvFinal u) (_ : ( + ∀ s ∈ ExtensionBaseSupportClass ett v hvFinal u, (↑s : ℕ) ≤ (↑t : ℕ))) (_ : + ett.series.data.delta t.succ = some deltaT), (MissingColors G sigma u ∩ + (ExtensionBaseSupportClass ett v hvFinal u).biUnion fun (s : Fin ett.rounds) ↦ + ett.series.data.stored s.succ) = { deltaT } := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot hclassPackage u t deltaT hsubset htClass htMaximum htDelta + obtain ⟨p, indices, gammaClass, deltaClass, hincreasing, hclass, + hgammaClass, hdeltaClass, hchain, hinjective, hunsupportedClass, + hmissing⟩ := + hclassPackage u ⟨t, htClass⟩ + dsimp at hmissing + obtain ⟨aT, haT⟩ := (hclass t).1 htClass + have haTLast : aT = Fin.last p := by + by_contra hne + have haLt : aT < Fin.last p := + Fin.lt_last_iff_ne_last.mpr hne + have hindexLt := hincreasing aT (Fin.last p) haLt + have hlastClass := (hclass (indices (Fin.last p))).2 + ⟨Fin.last p, rfl⟩ + have hlastLe := htMaximum (indices (Fin.last p)) hlastClass + rw [haT] at hindexLt + exact (not_lt_of_ge hlastLe) hindexLt + have hindexLast : indices (Fin.last p) = t := by + rw [← haT, haTLast] + have hdeltaEq : deltaClass (Fin.last p) = deltaT := by + apply Option.some.inj + exact (hdeltaClass (Fin.last p)).symm.trans (by + simpa [hindexLast] using htDelta) + have hstoredEq : + Finset.univ.biUnion (fun a : Fin (p + 1) => + ett.series.data.stored (indices a).succ) = + (ExtensionBaseSupportClass ett v hvFinal u).biUnion + (fun s => ett.series.data.stored s.succ) := by + ext c + simp only [Finset.mem_biUnion, Finset.mem_univ, true_and] + constructor + · rintro ⟨a, hc⟩ + exact ⟨indices a, (hclass (indices a)).2 ⟨a, rfl⟩, hc⟩ + · rintro ⟨s, hs, hc⟩ + obtain ⟨a, rfl⟩ := (hclass s).1 hs + exact ⟨a, hc⟩ + rw [← hstoredEq, ← hdeltaEq] + exact hmissing.1 + +private theorem helper_hterminalJ_1166.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal), + v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hjSlot + unfold ETTFirstAppearanceIndex at hjSlot + dsimp at hjSlot + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hlast : Fin.last ett.rounds ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + have hfinal : ExtendedTashkinovLadderStage ett + (Fin.last ett.rounds) = T := by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last + rw [hfinal] + exact hvFinal + have hfirstEq : jSlot.val + 1 = + (candidates.min' ⟨Fin.last ett.rounds, hlast⟩).val + 1 := by + simpa [candidates] using hjSlot + have hminVal : + (candidates.min' ⟨Fin.last ett.rounds, hlast⟩).val = + jSlot.val := by + omega + have hminEq : candidates.min' ⟨Fin.last ett.rounds, hlast⟩ = + jSlot.castSucc := by + apply Fin.ext + simpa using hminVal + have hjMember : jSlot.castSucc ∈ candidates := by + rw [← hminEq] + exact Finset.min'_mem candidates ⟨Fin.last ett.rounds, hlast⟩ + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + at hjMember + simpa [ExtendedTashkinovLadderStage, Fin.lastCases_castSucc] using + hjMember + +private theorem helper_branch_1321.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (_ : ett.series.data.chosenVertex q.succ = + some v) (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett + v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v + hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (terminalPosition : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (_ : (ett.series.data.tree + jSlot.succ.castSucc).vertex terminalPosition = v) (i : Fin ett.rounds) (previousProper : + IsProperEdgeColoring G (ett.series.data.coloring i.castSucc)) (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring i.castSucc) e0) (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc))) (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc))) (noRevisiting : ¬Nonempty + (RevisitingExtensionCertificate ett.series.data i.castSucc)) (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors + ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)) (seriesAlternativeFails + : + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data i.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + i.succ.castSucc))) (chosenGamma : Fin k) (gammaRule : ParallelExtensionColor + ett.series.data i.castSucc choice.selected choice.vertex chosenGamma) (secondStable : + PartialEdgeColoring E k) (secondStableProper : IsProperEdgeColoring G secondStable) + (secondStableOneUncolored : IsOneEdgeUncolored secondStable e0) (secondStableRelation : + StableColoring (ett.series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data i.castSucc)) choice.selected secondStable) + (exitWitness : TreeExit (ett.series.data.tree i.succ.castSucc) secondStable chosenGamma + choice.color choice.vertex) (currentColoring : ett.series.data.coloring i.succ = + TwoColorComponentSwap G secondStable chosenGamma choice.color (Sum.inl choice.vertex)) + (currentProper : IsProperEdgeColoring G (ett.series.data.coloring i.succ)) + (currentOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i.succ) e0) + (currentStored : ett.series.data.stored i.succ = { choice.color, chosenGamma }) + (currentEdges : ett.series.data.connectingEdges i.succ = { choice.edge }) (currentKind : + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE) (currentVertex : + ett.series.data.chosenVertex i.succ = some choice.vertex) (currentOutside : + ett.series.data.outsideVertex i.succ = some choice.otherEndpoint) (currentDelta : + ett.series.data.delta i.succ = some choice.color) (currentGamma : ett.series.data.gamma + i.succ = some chosenGamma) (closedExtension : TashkinovClosure (ett.series.data.coloring + i.succ) (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree i.succ.succ)) + (orderedExtension : TreeSequenceInitialSegment (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ)) (strictExtension : (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length) (_ : q.succ = i.succ) + (_ : ett.series.certified i.succ = TashkinovSeriesStep.PE i previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension), (1 : ℕ) ≤ + (↑terminalPosition : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hqVertex hvFinal + hfirstUpper hfirstPositive jSlot hjSlot stageToStage terminalPosition hterminalAt i + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternativeFails chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension htarget hcert + have hi : i = q := by + apply Fin.ext + simpa using (congrArg Fin.val htarget).symm + subst i + have hvChoice : choice.vertex = v := + Option.some.inj + (currentVertex.symm.trans (by simpa [htarget] using hqVertex)) + obtain ⟨defectiveColor, hdefective, hedgeBoundary⟩ := + choice.edgeDefective + have hdefectiveColor : defectiveColor = choice.color := by + have hedgeColor := (Finset.mem_filter.mp hedgeBoundary).2 + exact Option.some.inj (hedgeColor.symm.trans choice.edgeColor) + let boundary := BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) defectiveColor + have hboundaryCard : 1 < boundary.card := by + dsimp [boundary] + exact Nat.lt_of_lt_of_le Nat.one_lt_two hdefective + rcases Finset.exists_mem_ne hboundaryCard choice.edge with + ⟨f, hfBoundary, hfNe⟩ + have hfBoundaryEdge : f ∈ BoundaryEdges G + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) := + (Finset.mem_filter.mp hfBoundary).1 + have hfColor : choice.selected f = some choice.color := by + have hc := (Finset.mem_filter.mp hfBoundary).2 + simpa [hdefectiveColor] using hc + simp only [BoundaryEdges, Fin.castSucc_succ, Finset.mem_filter, Finset.mem_univ, + true_and] at hfBoundaryEdge + obtain ⟨x, hxStage, xout, hends⟩ := hfBoundaryEdge + rcases hends with ⟨hxout, hends⟩ + have hxf : Incident G x f := by + change x ∈ G.ends f + rw [hends] + simp + have hxDefective : DefectiveVertex G choice.selected + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) x := by + refine ⟨hxStage, f, ⟨defectiveColor, hdefective, hfBoundary⟩, hxf⟩ + have hxOrderOr := choice.maximal choice.selected x + choice.selectedProper choice.selectedOneUncolored + choice.selectedStable hxDefective + have hxNe : x ≠ choice.vertex := by + intro hxv + have hadjacent : AdjacentEdges G choice.edge f := + ⟨choice.vertex, choice.edgeIncident, hxv ▸ hxf⟩ + exact choice.selectedProper hfNe.symm hadjacent choice.edgeColor + hfColor + have hxOrder : TreeVertexOrder + (ett.series.data.tree q.succ.castSucc) x v := by + simpa [hvChoice] using hxOrderOr.resolve_left hxNe + have hTjQ : TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + have hseg := stageToStage (jSlot.val + 1) (q.val + 1) + (by omega) (by omega) (by omega) + convert hseg using 1 <;> congr 1 + let terminalQ : Fin + ((ett.series.data.tree q.succ.castSucc).length + 1) := + Fin.castLE (Nat.succ_le_succ hTjQ.1) terminalPosition + have hterminalQ : + (ett.series.data.tree q.succ.castSucc).vertex terminalQ = v := by + exact (hTjQ.2.1 terminalPosition).trans hterminalAt + rcases hxOrder with ⟨ix, iv, hix, hiv, hlt⟩ + have hivEq : iv = terminalQ := by + apply (ett.series.data.tree q.succ.castSucc).vertex_injective + exact hiv.trans hterminalQ.symm + rw [hivEq] at hlt + change ix.val < terminalPosition.val at hlt + omega + +private theorem helper_transportStep_1463.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data + jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho1) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore T v hvFinal)) + {A B : TreeSequence G e0} (_ : TashkinovAugmentation (ett.series.data.coloring + jSlot.castSucc) A B) (_ : TreeSequenceInitialSegment B seed), TashkinovAugmentation rho1 A + B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot segmentTrans trace rho1 hb1Rho terminalPosition + hterminalPositionPositive hterminalPositionBound seed segmentVertexBefore A B hstep hBseed + rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ + have hAseed : TreeSequenceInitialSegment A seed := + segmentTrans hAB hBseed + have hAlen : A.length < seed.length := + lt_of_lt_of_le (by omega) hBseed.1 + have hcMissingRho : c ∈ TreeMissingColors rho1 A := by + unfold TreeMissingColors at hcMissing ⊢ + obtain ⟨x, hxA, hcx⟩ := Finset.mem_biUnion.mp hcMissing + refine Finset.mem_biUnion.mpr ⟨x, hxA, ?_⟩ + rw [hb1Rho.2 x (segmentVertexBefore hAseed hAlen hxA)] + exact hcx + let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨attach, hattach⟩ := B.attaches added + let oldPosition : Fin (B.length + 1) := + Fin.castLT attach + (Nat.lt_trans attach.isLt (Nat.succ_lt_succ added.isLt)) + have holdValue : oldPosition.val < A.length + 1 := by + dsimp [oldPosition, added] + omega + let oldA : Fin (A.length + 1) := ⟨oldPosition.val, holdValue⟩ + have holdEq : B.vertex oldPosition = A.vertex oldA := by + have hcast : Fin.castLE (Nat.succ_le_succ hAB.1) oldA = + oldPosition := by + apply Fin.ext + rfl + rw [← hcast] + exact hAB.2.1 oldA + have holdA : A.vertex oldA ∈ TreeSequenceVertexSet A := by + simp [TreeSequenceVertexSet] + have holdBefore : B.vertex oldPosition ∈ + TreeVerticesBefore T v hvFinal := by + rw [holdEq] + exact segmentVertexBefore hAseed hAlen holdA + have holdIncident : Incident G (B.vertex oldPosition) (B.edge added) := by + unfold Incident + rw [hattach] + simp [oldPosition] + have haddedFixed : rho1 (B.edge added) = + ett.series.data.coloring jSlot.castSucc (B.edge added) := by + apply hb1Rho.1 (B.edge added) + ⟨B.vertex oldPosition, holdBefore, holdIncident⟩ + refine ⟨c, ?_, hcolor⟩ + apply Finset.mem_union_left + unfold TreeMissingColors at hcMissing + obtain ⟨x, hxA, hcx⟩ := Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨x, segmentVertexBefore hAseed hAlen hxA, hcx⟩ + refine ⟨hlen, hAB, c, ?_, hcMissingRho⟩ + change rho1 (B.edge added) = some c + exact haddedFixed.trans hcolor + +private theorem helper_commonPrefix_1530.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B + C → A.length ≤ B.length → TreeSequenceInitialSegment A B := by + classical + intro V E G e0 A B C hAC hBC hlen + rcases hAC with ⟨hACLen, hACVertices, hACEdges⟩ + rcases hBC with ⟨hBCLen, hBCVertices, hBCEdges⟩ + refine ⟨hlen, ?_, ?_⟩ + · intro i + calc + B.vertex (Fin.castLE (Nat.succ_le_succ hlen) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hBCLen) + (Fin.castLE (Nat.succ_le_succ hlen) i)) := + (hBCVertices _).symm + _ = C.vertex (Fin.castLE (Nat.succ_le_succ hACLen) i) := by + congr 1 + _ = A.vertex i := hACVertices i + · intro i + calc + B.edge (Fin.castLE hlen i) = + C.edge (Fin.castLE hBCLen (Fin.castLE hlen i)) := + (hBCEdges _).symm + _ = C.edge (Fin.castLE hACLen i) := by congr 1 + _ = A.edge i := hACEdges i + +private theorem helper_hvNotPrevious_1574.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : (0 : ℕ) < (↑jSlot : ℕ)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + v ∉ TreeSequenceVertexSet Tprevious := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hjSlot terminalPosition hjPositive Tprevious hvPrevious + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hlast : Fin.last ett.rounds ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett + (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hvFinal + have hfirst := hjSlot + unfold ETTFirstAppearanceIndex at hfirst + dsimp at hfirst + have hminimumValue : + (candidates.min' ⟨Fin.last ett.rounds, hlast⟩).val = + jSlot.val := by + change jSlot.val + 1 = + (candidates.min' ⟨Fin.last ett.rounds, hlast⟩).val + 1 at hfirst + omega + let previousSlot : Fin ett.rounds := + ⟨jSlot.val - 1, by omega⟩ + have hpreviousIndex : previousSlot.succ = jSlot.castSucc := by + apply Fin.ext + simp [previousSlot] + omega + have hpreviousMember : previousSlot.castSucc ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett previousSlot.castSucc = + Tprevious by + unfold ExtendedTashkinovLadderStage + rw [Fin.lastCases_castSucc, hpreviousIndex] + ] + exact hvPrevious + have hminimum := Finset.min'_le candidates previousSlot.castSucc + hpreviousMember + have hminimumVal := Fin.le_iff_val_le_val.mp hminimum + rw [hminimumValue] at hminimumVal + dsimp [previousSlot] at hminimumVal + omega + +private theorem helper_hpreviousStrict_1615.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : TreeSequenceInitialSegment Tprevious (ett.series.data.tree jSlot.succ.castSucc)) (_ : v + ∉ TreeSequenceVertexSet Tprevious), Tprevious.length < seed.length := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalAt hterminalPositionPositive + hterminalPositionBound seed Tprevious hpreviousTj hvNotPrevious + by_contra hnot + have hpositionLe : terminalPosition.val ≤ Tprevious.length := by + simpa [seed, TreeSequencePrefix] using Nat.le_of_not_gt hnot + let previousPosition : Fin (Tprevious.length + 1) := + ⟨terminalPosition.val, by omega⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hpreviousTj.1) + previousPosition = terminalPosition := by + apply Fin.ext + rfl + apply hvNotPrevious + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨previousPosition, ?_⟩ + have hvertex := hpreviousTj.2.1 previousPosition + rw [hcast] at hvertex + exact hvertex.symm.trans hterminalAt + +private theorem helper_branch_1655.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : Tprevious.length < seed.length) (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors ett.series.data + i.castSucc) (ett.series.data.coloring i.castSucc)) (_ : ett.series.data.connectingEdges + i.succ = { choice.edge }) (_ : ett.series.data.kind i.succ = some + TashkinovExtensionKind.SE) (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge + (ett.series.data.tree i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure + (ett.series.data.coloring i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : + jSlot.castSucc = i.succ), ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ + (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict i choice currentEdges + currentKind adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hpreviousEq : + ett.series.data.tree i.succ.castSucc = Tprevious := by + rw [hi] + rw [hpreviousEq] at hlen + rw [hlen] + omega + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + right + refine ⟨Or.inl (by simpa [htarget] using currentKind), + choice.edge, adjoined, ?_, ?_, ?_⟩ + · simpa [htarget] using currentEdges + · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ + have hiCast : i.castSucc.succ = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hlenNew : adjoined.length = Tprevious.length + 1 := by + simpa [Tprevious, hiCast] using hlen + have hsegmentNew : TreeSequenceInitialSegment Tprevious + adjoined := by + simpa [Tprevious, hiCast] using hsegment + refine ⟨hlenNew, hsegmentNew, ?_⟩ + have haddedIndex : + Fin.cast hlenNew.symm (Fin.last Tprevious.length) = + Fin.cast hlen.symm + (Fin.last + (ett.series.data.tree i.succ.castSucc).length) := by + apply Fin.ext + simp [Tprevious, hiCast] + rw [haddedIndex] + exact hedge + · simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) adjoined seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + hadjoinedSeed hseedTj) + +private theorem helper_branch_1709.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : TreeSequenceInitialSegment Tprevious seed) (i : Fin ett.rounds) (_ : + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE) (_ : TashkinovClosure + (ett.series.data.coloring i.succ) (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), ett.series.data.kind + i.succ = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) Tprevious seed ∨ (ett.series.data.kind i.succ = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj Tprevious hpreviousSeed i currentKind closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + left + refine ⟨by simpa [htarget] using currentKind, ?_⟩ + simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) Tprevious seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + hpreviousSeed hseedTj) + +private theorem helper_branch_1730.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : Tprevious.length < seed.length) (i : Fin ett.rounds) (available : + RevisitingExtensionCertificate ett.series.data i.castSucc) (_ : + ett.series.data.connectingEdges i.succ = { available.edge }) (_ : ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) (adjoined : TreeSequence G e0) (_ : + TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) available.edge adjoined) (_ + : TashkinovClosure (ett.series.data.coloring i.succ) adjoined (ett.series.data.tree + i.succ.succ)) (_ : jSlot.castSucc = i.succ), ett.series.data.kind i.succ = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence (ett.series.data.coloring + i.succ) Tprevious seed ∨ (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict i available currentEdges + currentKind adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hpreviousEq : + ett.series.data.tree i.succ.castSucc = Tprevious := by + rw [hi] + rw [hpreviousEq] at hlen + rw [hlen] + omega + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + right + refine ⟨Or.inr (by simpa [htarget] using currentKind), + available.edge, adjoined, ?_, ?_, ?_⟩ + · simpa [htarget] using currentEdges + · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ + have hiCast : i.castSucc.succ = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hlenNew : adjoined.length = Tprevious.length + 1 := by + simpa [Tprevious, hiCast] using hlen + have hsegmentNew : TreeSequenceInitialSegment Tprevious + adjoined := by + simpa [Tprevious, hiCast] using hsegment + refine ⟨hlenNew, hsegmentNew, ?_⟩ + have haddedIndex : + Fin.cast hlenNew.symm (Fin.last Tprevious.length) = + Fin.cast hlen.symm + (Fin.last + (ett.series.data.tree i.succ.castSucc).length) := by + apply Fin.ext + simp [Tprevious, hiCast] + rw [haddedIndex] + exact hedge + · simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) adjoined seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + hadjoinedSeed hseedTj) + +private theorem helper_hstablePrevious_1829.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data + jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho1) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore T v hvFinal)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : Tprevious.length < seed.length) (_ : TreeSequenceInitialSegment Tprevious seed), + StableColoring Tprevious (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho1 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 hb1Rho terminalPosition + hterminalPositionPositive hterminalPositionBound seed segmentVertexBefore Tprevious + hpreviousStrict hpreviousSeed + constructor + · intro f hfIncident hfControlled + obtain ⟨x, hxPrevious, hxf⟩ := hfIncident + apply hb1Rho.1 f + ⟨x, segmentVertexBefore hpreviousSeed hpreviousStrict hxPrevious, + hxf⟩ + obtain ⟨c, hcControlled, hfc⟩ := hfControlled + refine ⟨c, ?_, hfc⟩ + rcases Finset.mem_union.mp hcControlled with hcMissing | hcStored + · apply Finset.mem_union_left + unfold TreeMissingColors at hcMissing + obtain ⟨z, hzPrevious, hcz⟩ := + Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨z, segmentVertexBefore hpreviousSeed hpreviousStrict + hzPrevious, hcz⟩ + · exact Finset.mem_union_right _ hcStored + · intro x hxPrevious + exact hb1Rho.2 x + (segmentVertexBefore hpreviousSeed hpreviousStrict hxPrevious) + +private theorem helper_branch_1907.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : IsProperEdgeColoring G rho1) (_ : IsOneEdgeUncolored rho1 e0) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed), TashkinovAugmentationSequence rho1 S seed)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (_ : ¬(0 : ℕ) < (↑jSlot : ℕ)), + ∃ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime ∧ + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) ∧ + let awayMissing : Finset (Fin k) := ((TreeSequenceVertexSet TjPrime).erase v).biUnion fun (x : + V) ↦ MissingColors G rho1 x; (awayMissing ∩ supportColors).Nonempty ∨ awayMissing ∩ + supportColors = ∅ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 rho1 hrho1Proper hrho1One + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj + transportSeedRoute commonPrefix supportColors hjPositive + have hjZero : jSlot.val = 0 := by omega + have hjIndex : jSlot.castSucc = (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + exact hjZero + cases hcert : ett.series.certified (0 : Fin (ett.rounds + 1)) with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have htreeOne : ett.series.data.tree 1 = + ett.series.data.tree jSlot.succ.castSucc := by + congr 1 + apply Fin.ext + simp [hjZero] + have hinitialTj : TreeSequenceInitialSegment + (ett.series.data.tree 0) + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := TashkinovAugmentationSequenceInitialSegment _ _ _ + initialClosure.1 + rw [htreeOne] at h + exact h + have hinitialSeed : TreeSequenceInitialSegment + (ett.series.data.tree 0) seed := by + apply commonPrefix hinitialTj hseedTj + rw [seedLength] + simpa [seed, TreeSequencePrefix] using hterminalPositionPositive + have hrouteOld : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree 0) seed := by + have hrestricted := TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring 0) (ett.series.data.tree 0) seed + (ett.series.data.tree jSlot.succ.castSucc) + (by simpa [htreeOne] using initialClosure.1) + hinitialSeed hseedTj + simpa [hjIndex] using hrestricted + have hrouteRho : TashkinovAugmentationSequence rho1 + (ett.series.data.tree 0) seed := + transportSeedRoute (ett.series.data.tree 0) hrouteOld + obtain ⟨TjPrime, hclosure⟩ := TashkinovClosureExists rho1 seed + have htripleRho : KTriple G k e0 rho1 := + ⟨triple.1, triple.2.1, triple.2.2.1, hrho1Proper, hrho1One⟩ + have hinitialTree : TashkinovTree G e0 rho1 + (ett.series.data.tree 0) := by + intro a ha + rw [seedLength] at a + omega + have hprimeTree : TashkinovTree G e0 rho1 TjPrime := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 rho1 + (ett.series.data.tree 0) TjPrime hinitialTree + (Relation.ReflTransGen.trans hrouteRho hclosure.1) + have hprimeElementary : ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime) := by + unfold ColoredVertexSetElementary + intro x hx y hy hxy + exact (TashTree G k e0 rho1 TjPrime htripleRho hprimeTree) + hx hy hxy + refine ⟨TjPrime, hclosure, hprimeElementary, ?_⟩ + let awayMissing := + ((TreeSequenceVertexSet TjPrime).erase v).biUnion + fun x => MissingColors G rho1 x + by_cases hnonempty : (awayMissing ∩ supportColors).Nonempty + · exact Or.inl hnonempty + · exact Or.inr (Finset.not_nonempty_iff_eq_empty.mp hnonempty) + +private theorem helper_hTjElementary_2030.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : indices0 (Fin.last p0) = q), + ColoredVertexSetElementary G (ett.series.data.coloring jSlot.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower v this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot hjSlot p0 indices0 terminalPosition hqLast + by_cases hjPositive : 0 < jSlot.val + · obtain ⟨lower, hround, hlowerMP, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP + jSlot.val hjPositive jSlot.isLt + exact (hlower lower (by omega) (by omega) hlowerMP).1 + · have hjZero : jSlot.val = 0 := by omega + have hbase : ColoredVertexSetElementary G + (ett.series.data.coloring 0) + (TreeSequenceVertexSet + (ett.series.data.tree ⟨1, by omega⟩)) := by + unfold ColoredVertexSetElementary + intro x hx y hy hxy + exact (TechnicalTheoremBase G k ett.rounds e0 input + ett.series).1 hx hy hxy + have hcolor : jSlot.castSucc = (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + exact hjZero + have htree : jSlot.succ.castSucc = + (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp [hjZero] + simpa [hcolor, htree] using hbase + +private theorem helper_hprefixAvoids_2180.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (sigma : PartialEdgeColoring E k) (hvFinal : v ∈ + TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : + ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (delta0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (b : Fin + (p0 + (1 : ℕ))) (_ : ((TreeVerticesBefore TjPrime u huPrime).biUnion fun (v : V) ↦ + MissingColors G rho1 v) ∩ ((Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ) \ {delta0 (Fin.last p0)}) = ∅ ∧ (delta0 + (Fin.last p0) ∉ (ExtensionBaseCaseOneIndices ett p0 indices0 b).biUnion fun (t : Fin + ett.rounds) ↦ ett.series.data.stored t.succ) ∧ (MissingColors G rho1 v ∩ + (ExtensionBaseCaseOneIndices ett p0 indices0 b).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) = ∅) (_ : ((ExtensionBaseCaseOneIndices ett p0 indices0 + b).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ) ⊆ supportColors), + (((TreeVerticesBefore TjPrime u huPrime).biUnion fun (x : V) ↦ MissingColors G rho1 x) ∩ + (ExtensionBaseCaseOneIndices ett p0 indices0 b).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) = ∅ := by + classical + intro V E _ _ _ G k e0 input T generating ett v sigma hvFinal trace p0 indices0 delta0 rho1 + supportColors TjPrime u huPrime b hprefixData hprefixSubset + rw [Finset.eq_empty_iff_forall_notMem] + intro c hc + obtain ⟨hcBefore, hcPrefix⟩ := Finset.mem_inter.mp hc + have hcSupport := hprefixSubset hcPrefix + have hcNe : c ≠ delta0 (Fin.last p0) := by + intro hEq + apply hprefixData.2.1 + rw [← hEq] + exact hcPrefix + have hcDifference : c ∈ supportColors \ {delta0 (Fin.last p0)} := + Finset.mem_sdiff.mpr ⟨hcSupport, by simpa using hcNe⟩ + have hcEmpty : c ∈ (∅ : Finset (Fin k)) := by + rw [← hprefixData.1] + exact Finset.mem_inter.mpr ⟨hcBefore, hcDifference⟩ + simp at hcEmpty + +private theorem helper_hUsegmentVertexBefore_2265.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)) (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length) (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ + TreeSequenceVertexSet TjPrime) (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( + ∀ (i : Fin (TjPrime.length + (1 : ℕ))) (_ : (↑i : ℕ) < (↑uPosition : ℕ)), TjPrime.vertex i ∈ + TreeVerticesBefore TjPrime u huPrime)) {A : TreeSequence G e0} (_ : + TreeSequenceInitialSegment A U) (_ : A.length < U.length) {x : V} (_ : x ∈ + TreeSequenceVertexSet A), x ∈ TreeVerticesBefore TjPrime u huPrime := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound TjPrime u huPrime uPosition huPositionPositive huPositionBound U + hUPrime hprimeVertexBefore A hAU hAlen x hxA + obtain ⟨hAULen, hAUVertices, -⟩ := hAU + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hxA + obtain ⟨i, rfl⟩ := hxA + let iU : Fin (U.length + 1) := + Fin.castLE (Nat.succ_le_succ hAULen) i + let iPrime : Fin (TjPrime.length + 1) := + Fin.castLE (Nat.succ_le_succ hUPrime.1) iU + have hiPrime : iPrime.val < uPosition.val := by + change i.val < uPosition.val + have hUlen : U.length = uPosition.val := by + simp [U, TreeSequencePrefix] + omega + rw [← hAUVertices i, ← hUPrime.2.1 iU] + exact hprimeVertexBefore iPrime hiPrime + +private theorem helper_transportUStep_2285.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : + (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length) (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ + TreeSequenceVertexSet TjPrime) (b : Fin (p0 + (1 : ℕ))) (traceB : + ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + ∀ (_ : (( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore + TjPrime u huPrime, MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = + MissingColors G rho1 x) ∧ + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → traceB.coloring (Fin.last traceB.steps) f = rho1 f)) + (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : TjPrime.vertex uPosition = u) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A U) (_ : A.length < U.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore TjPrime u huPrime)) + {A B : TreeSequence G e0} (_ : TashkinovAugmentation rho1 A B) (_ : + TreeSequenceInitialSegment B U), TashkinovAugmentation rho2 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound TjPrime u huPrime b traceB rho2 c2 + uPosition huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore A B + hstep hBU + rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ + have hAU : TreeSequenceInitialSegment A U := segmentTrans hAB hBU + have hAlen : A.length < U.length := + lt_of_lt_of_le (by omega) hBU.1 + have hcMissingRho : c ∈ TreeMissingColors rho2 A := by + unfold TreeMissingColors at hcMissing ⊢ + obtain ⟨x, hxA, hcx⟩ := Finset.mem_biUnion.mp hcMissing + refine Finset.mem_biUnion.mpr ⟨x, hxA, ?_⟩ + rw [c2.1 x (Finset.mem_union_right _ + (hUsegmentVertexBefore hAU hAlen hxA))] + exact hcx + let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + let addedU : Fin U.length := Fin.castLE hBU.1 added + let addedPrime : Fin TjPrime.length := Fin.castLE hUPrime.1 addedU + have haddedPosition : addedPrime.val < uPosition.val := by + change A.length < uPosition.val + have hUlen : U.length = uPosition.val := by + simp [U, TreeSequencePrefix] + omega + have haddedIdentity : TjPrime.edge addedPrime = B.edge added := + (hUPrime.2.2 addedU).trans (hBU.2.2 added) + have haddedFixed : rho2 (B.edge added) = rho1 (B.edge added) := by + apply c2.2 (B.edge added) + exact Or.inr ⟨addedPrime, uPosition, huPosition, + haddedPosition, haddedIdentity⟩ + refine ⟨hlen, hAB, c, ?_, hcMissingRho⟩ + change rho2 (B.edge added) = some c + exact haddedFixed.trans hcolor + +private theorem helper_hvNotPrevious_2347.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (p0 : ℕ) (indices0 : + Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (_ : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length) (TjPrime : + TreeSequence G e0) (_ : indices0 (Fin.last p0) = q) (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), v ∉ TreeSequenceVertexSet Tprevious := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hjSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound TjPrime hqLast uPosition Tprevious hjPositive hvPrevious + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hlast : Fin.last ett.rounds ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett + (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hvFinal + have hfirst := hjSlot + unfold ETTFirstAppearanceIndex at hfirst + dsimp at hfirst + have hminimumValue : + (candidates.min' ⟨Fin.last ett.rounds, hlast⟩).val = + jSlot.val := by + change jSlot.val + 1 = + (candidates.min' ⟨Fin.last ett.rounds, hlast⟩).val + 1 at hfirst + omega + let previousSlot : Fin ett.rounds := + ⟨jSlot.val - 1, by omega⟩ + have hpreviousIndex : previousSlot.succ = jSlot.castSucc := by + apply Fin.ext + simp [previousSlot] + omega + have hpreviousMember : previousSlot.castSucc ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett previousSlot.castSucc = + Tprevious by + unfold ExtendedTashkinovLadderStage + rw [Fin.lastCases_castSucc, hpreviousIndex]] + exact hvPrevious + have hminimum := Finset.min'_le candidates previousSlot.castSucc + hpreviousMember + have hminimumVal := Fin.le_iff_val_le_val.mp hminimum + rw [hminimumValue] at hminimumVal + dsimp [previousSlot] at hminimumVal + omega + +private theorem helper_hpreviousStrict_2394.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : (ett.series.data.tree + jSlot.succ.castSucc).vertex terminalPosition = v) (hterminalPositionPositive : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), v ∉ TreeSequenceVertexSet Tprevious)) (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious (ett.series.data.tree + jSlot.succ.castSucc))) (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalAt hterminalPositionPositive + hterminalPositionBound seed TjPrime uPosition Tprevious hvNotPrevious hpreviousTj hjPositive + by_contra hnot + have hpositionLe : terminalPosition.val ≤ Tprevious.length := by + simpa [seed, TreeSequencePrefix] using Nat.le_of_not_gt hnot + let previousPosition : Fin (Tprevious.length + 1) := + ⟨terminalPosition.val, by omega⟩ + have hcast : Fin.castLE + (Nat.succ_le_succ (hpreviousTj hjPositive).1) + previousPosition = terminalPosition := by + apply Fin.ext + rfl + apply hvNotPrevious hjPositive + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨previousPosition, ?_⟩ + have hvertex := (hpreviousTj hjPositive).2.1 previousPosition + rw [hcast] at hvertex + exact hvertex.symm.trans hterminalAt + +private theorem helper_branch_2422.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (_ : (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))).length = (1 : ℕ)) (_ : + TashkinovClosure (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) + (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (1 : Fin + (ett.rounds + (2 : ℕ))))) (_ : jSlot.castSucc = (0 : Fin (ett.rounds + (1 : ℕ)))), + TashkinovAugmentationSequence (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) + seed (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hseedTj commonPrefix seedLength initialClosure htarget + have htargetZero : jSlot.val = 0 := by + have := congrArg Fin.val htarget + simpa using this + have htreeOne : ett.series.data.tree 1 = + ett.series.data.tree jSlot.succ.castSucc := by + congr 1 + apply Fin.ext + simp [htargetZero] + have hinitialTj : TreeSequenceInitialSegment + (ett.series.data.tree 0) + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := TashkinovAugmentationSequenceInitialSegment _ _ _ + initialClosure.1 + rw [htreeOne] at h + exact h + have hbaseSeed : TreeSequenceInitialSegment + (ett.series.data.tree 0) seed := by + apply commonPrefix hinitialTj hseedTj + rw [seedLength] + exact seed.positive + have hrouteOld : TashkinovAugmentationSequence + (ett.series.data.coloring 0) (ett.series.data.tree 0) + (ett.series.data.tree jSlot.succ.castSucc) := by + rw [← htreeOne] + exact initialClosure.1 + have hroute := TashkinovAugmentationSequenceSuffix + (ett.series.data.coloring 0) (ett.series.data.tree 0) seed + (ett.series.data.tree jSlot.succ.castSucc) hrouteOld hbaseSeed + hseedTj + simpa [htargetZero] using hroute + +private theorem helper_branch_2455.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (i : Fin ett.rounds) (choice + : MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)) + (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed (ett.series.data.tree + jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hjTreeIndex hseedTj commonPrefix TjPrime uPosition Tprevious + hpreviousStrict i choice adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hjPositive : 0 < jSlot.val := by + have := congrArg Fin.val hi + simp at this + omega + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + simpa [hi] using + (TashkinovAugmentationSequenceSuffix + (ett.series.data.coloring jSlot.castSucc) adjoined seed _ hroute + hadjoinedSeed hseedTj) + +private theorem helper_branch_2490.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : TreeSequence G e0) (_ : Fin + (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (i : Fin + ett.rounds) (_ : TashkinovClosure (ett.series.data.coloring i.succ) (ett.series.data.tree + i.succ.castSucc) (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed (ett.series.data.tree + jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hjTreeIndex hseedTj TjPrime uPosition Tprevious hpreviousSeed i + closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hjPositive : 0 < jSlot.val := by + have := congrArg Fin.val hi + simp at this + omega + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + simpa [Tprevious, hi] using h + simpa [hi] using + (TashkinovAugmentationSequenceSuffix + (ett.series.data.coloring jSlot.castSucc) Tprevious seed _ hroute + (hpreviousSeed hjPositive) hseedTj) + +private theorem helper_branch_2512.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (i : Fin ett.rounds) + (available : RevisitingExtensionCertificate ett.series.data i.castSucc) (adjoined : + TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) + available.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring i.succ) adjoined + (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed (ett.series.data.tree + jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hjTreeIndex hseedTj commonPrefix TjPrime uPosition Tprevious + hpreviousStrict i available adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hjPositive : 0 < jSlot.val := by + have := congrArg Fin.val hi + simp at this + omega + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + simpa [hi] using + (TashkinovAugmentationSequenceSuffix + (ett.series.data.coloring jSlot.castSucc) adjoined seed _ hroute + hadjoinedSeed hseedTj) + +private theorem helper_equalPrefixes_2607.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B D : TreeSequence G e0}, TreeSequenceInitialSegment A D → TreeSequenceInitialSegment B + D → A.length = B.length → A = B := by + classical + intro V E G e0 A B D hAD hBD hlen + rcases hAD with ⟨hlenAD, hvertexAD, hedgeAD⟩ + rcases hBD with ⟨hlenBD, hvertexBD, hedgeBD⟩ + cases A with + | mk alen apos avertex aedge avinj aeinf afirst aattach => + cases B with + | mk blen bpos bvertex bedge bvinj beinj bfirst battach => + simp only at hlen + subst blen + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + calc + avertex i = D.vertex + (Fin.castLE (Nat.succ_le_succ hlenAD) i) := + (hvertexAD i).symm + _ = D.vertex + (Fin.castLE (Nat.succ_le_succ hlenBD) i) := by + congr 1 + _ = bvertex i := hvertexBD i + · apply heq_of_eq + funext i + calc + aedge i = D.edge (Fin.castLE hlenAD i) := + (hedgeAD i).symm + _ = D.edge (Fin.castLE hlenBD i) := by congr 1 + _ = bedge i := hedgeBD i + +private theorem helper_hiSeed_2699.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed U), + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (_ : TreeSequence G e0) (_ : TreeSequenceInitialSegment seed Tj0) (_ : ℕ) (i : Fin + Tj0.length) (_ : Tj0.vertex i.succ ∉ TreeSequenceVertexSet U), seed.length ≤ (↑i : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed TjPrime uPosition huPositionPositive huPositionBound U hseedU + Tj0 M hseedTjSegment n i hrightOutside + by_contra hnot + have hi : i.val < seed.length := Nat.lt_of_not_ge hnot + let a : Fin (seed.length + 1) := ⟨i.val + 1, by omega⟩ + have hTjSeedA : Tj0.vertex + (Fin.castLE (Nat.succ_le_succ hseedTjSegment.1) a) = + seed.vertex a := hseedTjSegment.2.1 a + apply hrightOutside + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + refine ⟨Fin.castLE (Nat.succ_le_succ hseedU.1) a, ?_⟩ + have hia : Fin.castLE + (Nat.succ_le_succ hseedTjSegment.1) a = i.succ := by + apply Fin.ext + simp [a] + rw [hia] at hTjSeedA + exact (hseedU.2.1 a).trans hTjSeedA.symm + +private theorem helper_hseedVertexBeforeJ_2905.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) (terminalPosition : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : + seed.vertex (Fin.last seed.length) = v) (i : Fin (seed.length + (1 : ℕ))) (_ : (↑i : ℕ) < + seed.length), seed.vertex i ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot vertexTransfer hterminalJ terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTj hseedTerminal i hi + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + constructor + · exact vertexTransfer hseedTj + (by simp [TreeSequenceVertexSet]) + · let p : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1) := + Fin.castLE (Nat.succ_le_succ hseedTj.1) i + let z : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1) := + Fin.castLE (Nat.succ_le_succ hseedTj.1) + (Fin.last seed.length) + refine ⟨p, z, hseedTj.2.1 i, + (hseedTj.2.1 (Fin.last seed.length)).trans hseedTerminal, ?_⟩ + simpa [p, z] using hi + +private theorem helper_transportSeedStep2_2940.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin + ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : + ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + ∀ (_ : StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) (traceB.coloring (Fin.last traceB.steps))) (_ : Fin (TjPrime.length + (1 : + ℕ))) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ)) {A B : TreeSequence G e0} (_ : TashkinovAugmentation + (ett.series.data.coloring jSlot.castSucc) A B) (_ : TreeSequenceInitialSegment B seed), + TashkinovAugmentation rho2 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot segmentTrans trace hterminalJ p0 indices0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed TjPrime u b traceB + rho2 c1 uPosition segmentVertexBeforeJ A B hstep hBseed + rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ + have hAseed : TreeSequenceInitialSegment A seed := + segmentTrans hAB hBseed + have hAlen : A.length < seed.length := + lt_of_lt_of_le (by omega) hBseed.1 + have hcMissingRho : c ∈ TreeMissingColors rho2 A := by + unfold TreeMissingColors at hcMissing ⊢ + obtain ⟨x, hxA, hcx⟩ := Finset.mem_biUnion.mp hcMissing + refine Finset.mem_biUnion.mpr ⟨x, hxA, ?_⟩ + rw [c1.2 x (segmentVertexBeforeJ hAseed hAlen hxA)] + exact hcx + let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨attach, hattach⟩ := B.attaches added + let oldPosition : Fin (B.length + 1) := + Fin.castLT attach + (Nat.lt_trans attach.isLt (Nat.succ_lt_succ added.isLt)) + have holdValue : oldPosition.val < A.length + 1 := by + dsimp [oldPosition, added] + omega + let oldA : Fin (A.length + 1) := ⟨oldPosition.val, holdValue⟩ + have holdEq : B.vertex oldPosition = A.vertex oldA := by + have hcast : Fin.castLE (Nat.succ_le_succ hAB.1) oldA = + oldPosition := by + apply Fin.ext + rfl + rw [← hcast] + exact hAB.2.1 oldA + have holdA : A.vertex oldA ∈ TreeSequenceVertexSet A := by + simp [TreeSequenceVertexSet] + have holdBefore : B.vertex oldPosition ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ := by + rw [holdEq] + exact segmentVertexBeforeJ hAseed hAlen holdA + have holdIncident : Incident G (B.vertex oldPosition) + (B.edge added) := by + unfold Incident + rw [hattach] + simp [oldPosition] + have haddedFixed : rho2 (B.edge added) = + ett.series.data.coloring jSlot.castSucc (B.edge added) := by + apply c1.1 (B.edge added) + ⟨B.vertex oldPosition, holdBefore, holdIncident⟩ + refine ⟨c, ?_, hcolor⟩ + apply Finset.mem_union_left + unfold TreeMissingColors at hcMissing + obtain ⟨x, hxA, hcx⟩ := Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨x, segmentVertexBeforeJ hAseed hAlen hxA, hcx⟩ + refine ⟨hlen, hAB, c, ?_, hcMissingRho⟩ + change rho2 (B.edge added) = some c + exact haddedFixed.trans hcolor + +private theorem helper_branch_3050.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) + (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (_ : ett.series.data.connectingEdges i.succ = + { choice.edge }) (_ : ett.series.data.kind i.succ = some TashkinovExtensionKind.SE) + (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ + (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict hjPositive i choice currentEdges + currentKind adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + right + refine ⟨Or.inl (by simpa [htarget] using currentKind), + choice.edge, adjoined, ?_, ?_, ?_⟩ + · simpa [htarget] using currentEdges + · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ + have hiCast : i.castSucc.succ = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hlenNew : adjoined.length = Tprevious.length + 1 := by + simpa [Tprevious, hiCast] using hlen + have hsegmentNew : + TreeSequenceInitialSegment Tprevious adjoined := by + simpa [Tprevious, hiCast] using hsegment + refine ⟨hlenNew, hsegmentNew, ?_⟩ + have haddedIndex : + Fin.cast hlenNew.symm (Fin.last Tprevious.length) = + Fin.cast hlen.symm + (Fin.last + (ett.series.data.tree i.succ.castSucc).length) := by + apply Fin.ext + simp [Tprevious, hiCast] + rw [haddedIndex] + exact hedge + · simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) adjoined seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + hadjoinedSeed hseedTj) + +private theorem helper_branch_3107.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (_ : (0 : ℕ) < + (↑jSlot : ℕ)) (i : Fin ett.rounds) (_ : ett.series.data.kind i.succ = some + TashkinovExtensionKind.PE) (_ : TashkinovClosure (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree i.succ.succ)) (_ : + jSlot.castSucc = i.succ), ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ + (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj Tprevious hpreviousSeed hjPositive i currentKind closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + simpa [Tprevious, hi] using h + left + refine ⟨by simpa [htarget] using currentKind, ?_⟩ + simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) Tprevious seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + (hpreviousSeed hjPositive) hseedTj) + +private theorem helper_branch_3129.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) + (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data + i.castSucc) (_ : ett.series.data.connectingEdges i.succ = { available.edge }) (_ : + ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) (adjoined : TreeSequence G + e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) available.edge + adjoined) (_ : TashkinovClosure (ett.series.data.coloring i.succ) adjoined + (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), ett.series.data.kind + i.succ = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) Tprevious seed ∨ (ett.series.data.kind i.succ = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict hjPositive i available + currentEdges currentKind adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + right + refine ⟨Or.inr (by simpa [htarget] using currentKind), + available.edge, adjoined, ?_, ?_, ?_⟩ + · simpa [htarget] using currentEdges + · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ + have hiCast : i.castSucc.succ = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hlenNew : adjoined.length = Tprevious.length + 1 := by + simpa [Tprevious, hiCast] using hlen + have hsegmentNew : + TreeSequenceInitialSegment Tprevious adjoined := by + simpa [Tprevious, hiCast] using hsegment + refine ⟨hlenNew, hsegmentNew, ?_⟩ + have haddedIndex : + Fin.cast hlenNew.symm (Fin.last Tprevious.length) = + Fin.cast hlen.symm + (Fin.last + (ett.series.data.tree i.succ.castSucc).length) := by + apply Fin.ext + simp [Tprevious, hiCast] + rw [haddedIndex] + exact hedge + · simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) adjoined seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + hadjoinedSeed hseedTj) + +private theorem helper_hstablePrevious_3232.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 + indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + ∀ (_ : StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) (traceB.coloring (Fin.last traceB.steps))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ)) (_ : (0 : ℕ) < (↑jSlot : ℕ)), StableColoring Tprevious + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho2 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace hterminalJ p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed u b traceB rho2 c1 Tprevious + hpreviousStrict hpreviousSeed segmentVertexBeforeJ hjPositive + constructor + · intro f hfIncident hfControlled + obtain ⟨x, hxPrevious, hxf⟩ := hfIncident + apply c1.1 f + ⟨x, segmentVertexBeforeJ (hpreviousSeed hjPositive) + (hpreviousStrict hjPositive) hxPrevious, hxf⟩ + obtain ⟨color, hcControlled, hfc⟩ := hfControlled + refine ⟨color, ?_, hfc⟩ + rcases Finset.mem_union.mp hcControlled with hcMissing | hcStored + · apply Finset.mem_union_left + unfold TreeMissingColors at hcMissing + obtain ⟨z, hzPrevious, hcz⟩ := + Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨z, segmentVertexBeforeJ (hpreviousSeed hjPositive) + (hpreviousStrict hjPositive) hzPrevious, hcz⟩ + · exact Finset.mem_union_right _ hcStored + · intro x hxPrevious + exact c1.2 x + (segmentVertexBeforeJ (hpreviousSeed hjPositive) + (hpreviousStrict hjPositive) hxPrevious) + +private theorem helper_hcorrNonempty_3307.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 + indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (C : TreeSequence G e0) (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (⟨(↑jSlot : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑jSlot : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), + let nLower : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + ∀ (_ : lower.series.data.tree nLower.castSucc = Tprevious) (_ : ModColoring lower rho2) (_ : + TreeSequenceInitialSegment Tprevious C) (_ : Tprevious.length < C.length) (_ : + (lower.series.data.kind nLower = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho2 Tprevious C ∨ (lower.series.data.kind nLower = some + TashkinovExtensionKind.SE ∨ lower.series.data.kind nLower = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), lower.series.data.connectingEdges nLower = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence rho2 + adjoinSeed C)), Nonempty (CorrespondingExtendedTashkinovTree G k e0 lower rho2 C) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 indices0 rho1 u b traceB rho2 Tprevious C lower + nLower hLowerTree hmod hPreviousC hPreviousStrictC hLowerEligible + have hmod' := hmod + unfold ModColoring at hmod' + dsimp only at hmod' + apply hmod'.2.2 C + · rw [hLowerTree] + exact hPreviousC + · rw [hLowerTree] + exact hPreviousStrictC + · change + (lower.series.data.kind nLower = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho2 + (lower.series.data.tree nLower.castSucc) C) ∨ + ((lower.series.data.kind nLower = + some TashkinovExtensionKind.SE ∨ + lower.series.data.kind nLower = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + lower.series.data.connectingEdges nLower = {f} ∧ + TreeSequenceAdjoinEdge + (lower.series.data.tree nLower.castSucc) f adjoinSeed ∧ + TashkinovAugmentationSequence rho2 adjoinSeed C) + rw [hLowerTree] + exact hLowerEligible + +private theorem helper_hbound_3342.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (v : + V) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (_ : indices0 (Fin.last p0) = q) (u : V) (b : Fin (p0 + (1 : + ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + ∀ (_ : IsProperEdgeColoring G rho2) (_ : IsOneEdgeUncolored rho2 e0) (_ : Fin (TjPrime.length + + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (C : TreeSequence G e0) (_ : TashkinovAugmentationSequence rho2 seed C) (_ : + ColoredVertexSetClosed G rho2 (TreeSequenceVertexSet C)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) (_ : + (ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho2 Tprevious seed ∨ (ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.SE ∨ ett.series.data.kind jSlot.castSucc = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges jSlot.castSucc = + { f } ∧ TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence rho2 + adjoinSeed seed)) (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (⟨(↑jSlot : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑jSlot : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : lower.rounds = (↑jSlot : ℕ)) (_ : StableColoring + Tprevious (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho2) (corr : CorrespondingExtendedTashkinovTree G k e0 lower rho2 C) (_ : + corr.replacementETT.rounds = (↑jSlot : ℕ)), (TreeSequenceVertexSet C).card ≤ + (TreeSequenceVertexSet Tj0).card := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed TjPrime hqLast u b traceB rho2 + hrho2Proper hrho2One uPosition Tprevious Tj0 C hrouteSeedC hclosedC hjPositive + hseedBuildRho2 lower hround hstablePrevious corr hcorrRounds + have hMP' := hMP + unfold MaximumProperty at hMP' + have hstage := hMP'.2 jSlot.val hjPositive jSlot.isLt + dsimp only at hstage + have hidx : (⟨jSlot.val, by omega⟩ : Fin (ett.rounds + 1)) = + jSlot.castSucc := by + apply Fin.ext + rfl + have hnextIdx : + (⟨jSlot.val + 1, by omega⟩ : Fin (ett.rounds + 2)) = + jSlot.succ.castSucc := by + apply Fin.ext + rfl + rw [hidx, hnextIdx] at hstage + rcases hseedBuildRho2 with hparallel | hserial + · have hclosurePreviousC : TashkinovClosure rho2 Tprevious C := + ⟨Relation.ReflTransGen.trans hparallel.2 hrouteSeedC, + hclosedC⟩ + have hraw := hstage rho2 Tprevious C hrho2Proper hrho2One + hstablePrevious + (Or.inl ⟨hparallel.1, rfl⟩) hclosurePreviousC + simpa [Tprevious, Tj0] using hraw + · rcases hserial with ⟨hkind, f, adjoinSeed, hconnecting, + hadjoin, hroute⟩ + have hclosureAdjoinC : TashkinovClosure rho2 adjoinSeed C := + ⟨Relation.ReflTransGen.trans hroute hrouteSeedC, hclosedC⟩ + have hraw := hstage rho2 adjoinSeed C hrho2Proper hrho2One + hstablePrevious + (Or.inr ⟨hkind, f, hconnecting, by + simpa [Tprevious] using hadjoin⟩) hclosureAdjoinC + simpa [Tj0] using hraw + +private theorem helper_branch_3377.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (v : + V) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (TjPrime : TreeSequence G e0) (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : + ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + ∀ (_ : IsProperEdgeColoring G rho2) (_ : IsOneEdgeUncolored rho2 e0) (_ : Fin (TjPrime.length + + (1 : ℕ))), + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (_ : TreeSequenceInitialSegment seed Tj0) (C : TreeSequence G e0) (_ : + TashkinovAugmentationSequence rho2 seed C) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed), TashkinovAugmentationSequence rho2 S seed)) (_ : + TreeSequenceVertexSet Tj0 ⊂ TreeSequenceVertexSet C) (_ : ¬(0 : ℕ) < (↑jSlot : ℕ)), False + := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed commonPrefix TjPrime u b traceB rho2 + hrho2Proper hrho2One uPosition Tj0 hseedTj0 C hrouteSeedC transportSeedRoute2 hTj0StrictC + hjPositive + have hjZero : jSlot.val = 0 := by omega + have hjIndex : jSlot.castSucc = + (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + exact hjZero + cases hcert : ett.series.certified + (0 : Fin (ett.rounds + 1)) with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have htreeOne : ett.series.data.tree 1 = Tj0 := by + unfold Tj0 + congr 1 + apply Fin.ext + simp [hjZero] + have hinitialTj : TreeSequenceInitialSegment + (ett.series.data.tree 0) Tj0 := by + have h := TashkinovAugmentationSequenceInitialSegment _ _ _ + initialClosure.1 + simpa [htreeOne] using h + have hinitialSeed : TreeSequenceInitialSegment + (ett.series.data.tree 0) seed := by + apply commonPrefix hinitialTj + (by simpa [Tj0] using hseedTj0) + rw [seedLength] + exact seed.positive + have hroutePhiSeed : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree 0) seed := by + have hrestricted := TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring 0) (ett.series.data.tree 0) seed + Tj0 (by simpa [htreeOne] using initialClosure.1) + hinitialSeed (by simpa [Tj0] using hseedTj0) + simpa [hjIndex] using hrestricted + have hrouteRhoTwoBase : TashkinovAugmentationSequence rho2 + (ett.series.data.tree 0) seed := + transportSeedRoute2 (ett.series.data.tree 0) hroutePhiSeed + have hrouteBaseC : TashkinovAugmentationSequence rho2 + (ett.series.data.tree 0) C := + Relation.ReflTransGen.trans hrouteRhoTwoBase hrouteSeedC + have htripleRho : KTriple G k e0 rho2 := + ⟨triple.1, triple.2.1, triple.2.2.1, + hrho2Proper, hrho2One⟩ + have hinitialTree : TashkinovTree G e0 rho2 + (ett.series.data.tree 0) := by + intro a ha + rw [seedLength] at a + omega + have hCTree : TashkinovTree G e0 rho2 C := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 rho2 + (ett.series.data.tree 0) C hinitialTree hrouteBaseC + have hk : ChromaticIndex G - 1 = k := by + have hchromatic := triple.2.1 + omega + have hCOrder : (TreeSequenceVertexSet C).card ≤ + TashkinovOrder G := by + unfold TashkinovOrder + dsimp only + apply Finset.le_max' + apply Finset.mem_insert_of_mem + simp only [Finset.mem_filter, Finset.mem_range] + constructor + · exact Nat.lt_succ_of_le (Finset.card_le_univ _) + · rw [hk] + exact ⟨e0, rho2, C, htripleRho, hCTree, rfl⟩ + have hTjOrder : (TreeSequenceVertexSet Tj0).card = + TashkinovOrder G := by + rw [← htreeOne] + exact hMP.1 + have hbound : (TreeSequenceVertexSet C).card ≤ + (TreeSequenceVertexSet Tj0).card := by + rw [hTjOrder] + exact hCOrder + exact (Nat.not_lt_of_ge hbound) + (Finset.card_lt_card hTj0StrictC) + +private theorem helper_hdeltaEarlier_3576.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (delta : Fin k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (_ : ett.series.data.chosenVertex q.succ = + some v) (_ : ett.series.data.delta q.succ = some delta) (hvFinal : v ∈ + TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc))) (_ : q ∈ ExtensionBaseActiveIndices ett v + hvFinal) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin + (p0 + (1 : ℕ)) → Fin k) (_ : ( + ∀ (a b : Fin (p0 + (1 : ℕ))) (_ : (↑a : ℕ) < (↑b : ℕ)), (↑(indices0 a) : ℕ) < (↑(indices0 b) : + ℕ))) (_ : ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r)) (_ : ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a))) (_ : + Function.Injective (Fin.cons (gamma0 (0 : Fin (p0 + (1 : ℕ)))) delta0)) (_ : indices0 + (Fin.last p0) = q) (_ : delta0 (Fin.last p0) = delta) (s : Fin ett.rounds) (gammaS deltaS + : Fin k) (_ : s ∈ (ExtensionBaseSupportClass ett v hvFinal v).erase q) (_ : + ett.series.data.gamma s.succ = some gammaS) (_ : ett.series.data.delta s.succ = some + deltaS), delta ≠ gammaS ∧ delta ≠ deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v delta q hqTerminal hqVertex hqDelta + hvFinal hfirstUpper hfirstPositive jSlot hdeltaExclusion hqActive p0 indices0 gamma0 delta0 + hincreasing0 hclass0 hdelta0 hinjective0 hqLast hdeltaLast s gammaS deltaS hs hsGamma hsDelta + have hsNeQ := (Finset.mem_erase.mp hs).1 + have hsClass := (Finset.mem_erase.mp hs).2 + obtain ⟨a, ha⟩ := (hclass0 s).1 hsClass + have haNeLast : a ≠ Fin.last p0 := by + intro haLast + apply hsNeQ + rw [← ha, haLast, hqLast] + have hsq : s.val < q.val := by + have haLt : a.val < (Fin.last p0).val := + Fin.lt_last_iff_ne_last.mpr haNeLast + have hlt := hincreasing0 a (Fin.last p0) haLt + simpa [ha, hqLast] using hlt + have hsClassData := hsClass + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at hsClassData + have hsGammaNe : delta ≠ gammaS := + (hdeltaExclusion.1 s q v v hvFinal hvFinal delta gammaS + hsClassData.1 hqActive (Nat.le_of_lt hsq) hsClassData.2 hqVertex + hqDelta hsGamma).2 + have hdeltaAEq : delta0 a = deltaS := by + apply Option.some.inj + exact (hdelta0 a).symm.trans (by simpa [ha] using hsDelta) + have hsDeltaNe : delta ≠ deltaS := by + intro hEq + have hvalues : + (Fin.cons (gamma0 0) delta0 : Fin (p0 + 2) → Fin k) a.succ = + (Fin.cons (gamma0 0) delta0 : Fin (p0 + 2) → Fin k) + (Fin.last p0).succ := by + simp [hdeltaAEq, hdeltaLast, hEq] + have hindices := hinjective0 hvalues + apply haNeLast + apply Fin.ext + have hvals := congrArg Fin.val hindices + simpa using hvals + exact ⟨hsGammaNe, hsDeltaNe⟩ + +private theorem helper_hpreterminalPackage_3617.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma _ : Fin k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : + ℕ)) → Fin k) (_ : ( + ∀ (a b : Fin (p0 + (1 : ℕ))) (_ : (↑a : ℕ) < (↑b : ℕ)), (↑(indices0 a) : ℕ) < (↑(indices0 b) : + ℕ))) (_ : ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r)) (_ : ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a))) (_ : ( + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (_ : indices0 (Fin.last p0) = q) (_ : gamma0 + (Fin.last p0) = gamma) (_ : (0 : ℕ) < p0), + ∃ (preterminalSlot : Fin ett.rounds), (↑preterminalSlot : ℕ) < (↑q : ℕ) ∧ preterminalSlot ∈ + (ExtensionBaseSupportClass ett v hvFinal v).erase q ∧ ett.series.data.delta + preterminalSlot.succ = some gamma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot p0 indices0 gamma0 delta0 hincreasing0 hclass0 hdelta0 + hchain0 terminalPosition hqLast hgammaLast hp0 + let a : Fin p0 := ⟨p0 - 1, by omega⟩ + let a0 : Fin (p0 + 1) := ⟨p0 - 1, by omega⟩ + have haCast : a.castSucc = a0 := by + apply Fin.ext + rfl + have haSucc : a.succ = Fin.last p0 := by + apply Fin.ext + simp [a] + omega + have haLast : a0.val < (Fin.last p0).val := by + simp [a0] + omega + have hslotOrder : (indices0 a0).val < q.val := by + have h := hincreasing0 a0 (Fin.last p0) haLast + simpa [hqLast] using h + have hslotClass : indices0 a0 ∈ + ExtensionBaseSupportClass ett v hvFinal v := + (hclass0 (indices0 a0)).2 ⟨a0, rfl⟩ + have hslotNe : indices0 a0 ≠ q := by + intro heq + rw [heq] at hslotOrder + exact (Nat.lt_irrefl _ hslotOrder) + have hdeltaGamma : ett.series.data.delta (indices0 a0).succ = + some gamma := by + rw [hdelta0 a0] + have hchain := hchain0 a + rw [haCast, haSucc] at hchain + rw [← hchain, hgammaLast] + exact ⟨indices0 a0, hslotOrder, + Finset.mem_erase.mpr ⟨hslotNe, hslotClass⟩, hdeltaGamma⟩ + +private theorem helper_hsupportComponentOrder_3667.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (_ _ : Fin k) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (_ : ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE) (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < + ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 + : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : indices0 + (Fin.last p0) = q) (_ : ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ (ExtensionBaseSupportClass ett v + hvFinal v).erase q) (_ : ett.series.data.gamma s.succ = some gammaS) (_ : + ett.series.data.delta s.succ = some deltaS), ETTStrongInterchangeable ett s v rho1 gammaS + deltaS)) (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ (ExtensionBaseSupportClass + ett v hvFinal v).erase q) (_ : ett.series.data.gamma s.succ = some gammaS) (_ : + ett.series.data.delta s.succ = some deltaS), + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree s.succ.castSucc), x ≠ v → + ∀ (y : V), Sum.inl y ∈ TwoColorComponent G rho1 gammaS deltaS (Sum.inl x) → y ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal hqKind + hvFinal hfirstUpper hfirstPositive jSlot stageToStage vertexTransfer trace p0 indices0 + gamma0 delta0 rho1 terminalPosition hqLast hb4Earlier s gammaS deltaS hs hsGamma hsDelta x + hx hxNe y hy + have hsNeQ := (Finset.mem_erase.mp hs).1 + have hsClass := (Finset.mem_erase.mp hs).2 + obtain ⟨hneColors, hsKind, hsVertex, epsilon, hsEpsilon, + hepsilonKind, hbetween, hcycles⟩ := + hb4Earlier s gammaS deltaS hs hsGamma hsDelta + have hsq : s.val < q.val := by + have hle : s.val ≤ q.val := by omega + exact lt_of_le_of_ne hle (fun heq => hsNeQ (Fin.ext heq)) + have hepsilonQ : epsilon.val ≤ q.val := by + by_contra hnot + have hqRE := hbetween q hsq (by omega) + rw [hqKind] at hqRE + simp at hqRE + have hyEpsilon := (hcycles x hx hxNe).2.2 y hy + have hsegment := stageToStage (epsilon.val + 1) (q.val + 1) + (by omega) (by omega) (by omega) + have hyQ := vertexTransfer hsegment hyEpsilon + convert hyQ using 1; congr 1 + +private theorem helper_hdeltaLocation_3782.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : seed.vertex (Fin.last seed.length) = v) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree q.succ.castSucc)) (fN : E) (_ : BoundaryColorEdges G + (ett.series.data.coloring q.succ) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) gamma = { fN } ∧ ( + ∀ g ∈ BoundaryColorEdges G (ett.series.data.coloring q.succ) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) delta, + ∃ (w : V), TreeVertexOrder (ett.series.data.tree q.succ.castSucc) w v ∧ Incident G w g) ∧ + (ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (ett.series.data.coloring q.succ) (ett.series.data.tree + q.succ.castSucc), alpha ≠ delta → BoundaryColorEdges G (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) alpha = ∅)), + ∀ f ∈ BoundaryColorEdges G (ett.series.data.coloring q.succ) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) delta, + ∃ y ∈ TreeSequenceVertexSet seed, Incident G y f := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot p0 indices0 gamma0 delta0 terminalPosition + hterminalPositionPositive hterminalPositionBound seed hseedTerminal hseedN fN + hboundaryStructure f hf + obtain ⟨y, hyOrder, hyf⟩ := hboundaryStructure.2.1 f hf + rcases hyOrder with ⟨iy, iv, hiy, hiv, hlt⟩ + let terminalN : Fin + ((ett.series.data.tree q.succ.castSucc).length + 1) := + Fin.castLE (Nat.succ_le_succ hseedN.1) (Fin.last seed.length) + have hterminalN : + (ett.series.data.tree q.succ.castSucc).vertex terminalN = v := by + exact (hseedN.2.1 (Fin.last seed.length)).trans hseedTerminal + have hivTerminal : iv = terminalN := by + apply (ett.series.data.tree q.succ.castSucc).vertex_injective + exact hiv.trans hterminalN.symm + have hiyBound : iy.val < seed.length + 1 := by + rw [hivTerminal] at hlt + have hiyStrict : iy.val < seed.length := by + simpa [terminalN] using hlt + omega + let iySeed : Fin (seed.length + 1) := ⟨iy.val, hiyBound⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hseedN.1) iySeed = iy := by + apply Fin.ext + rfl + have hySeed : seed.vertex iySeed = y := by + have hvertex := hseedN.2.1 iySeed + rw [hcast] at hvertex + exact hvertex.symm.trans hiy + refine ⟨y, ?_, hyf⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨iySeed, hySeed⟩ + +private theorem helper_hterminalEdgeValues_3881.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : ( + ∀ (f : E) (_ : rho1 f ≠ sigma f), f ∉ InternalEdges G (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) ∧ + ∃ (c : Fin k) (d : Fin k), sigma f = some c ∧ rho1 f = some d ∧ (c ∈ + (ExtensionBaseRestorationIndices ett v hvFinal).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) ∧ d ∈ (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ)), + let restorationColors : Finset (Fin k) := (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ; + ∀ (_ : gamma ∉ restorationColors ∧ delta ∉ restorationColors) (f : E), sigma f = some gamma ∨ + sigma f = some delta ↔ rho1 f = some gamma ∨ rho1 f = some delta := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace rho1 hb3EdgeEffects restorationColors + hterminalColorsNotRestored f + constructor + · intro hf + by_cases heq : rho1 f = sigma f + · simpa [heq] using hf + · obtain ⟨c, d, hsc, hrd, hcRestored, hdRestored⟩ := + (hb3EdgeEffects f heq).2 + rcases hf with hfgamma | hfdelta + · have hc : c = gamma := Option.some.inj (hsc.symm.trans hfgamma) + exact False.elim (hterminalColorsNotRestored.1 (hc ▸ hcRestored)) + · have hc : c = delta := Option.some.inj (hsc.symm.trans hfdelta) + exact False.elim (hterminalColorsNotRestored.2 (hc ▸ hcRestored)) + · intro hf + by_cases heq : rho1 f = sigma f + · simpa [heq] using hf + · obtain ⟨c, d, hsc, hrd, hcRestored, hdRestored⟩ := + (hb3EdgeEffects f heq).2 + rcases hf with hfgamma | hfdelta + · have hd : d = gamma := Option.some.inj (hrd.symm.trans hfgamma) + exact False.elim (hterminalColorsNotRestored.1 (hd ▸ hdRestored)) + · have hd : d = delta := Option.some.inj (hrd.symm.trans hfdelta) + exact False.elim (hterminalColorsNotRestored.2 (hd ▸ hdRestored)) + +private theorem helper_hendpointNeighbor_4002.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : IsProperEdgeColoring G rho1) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (_ : (H.neighborSet (Sum.inl v)).Subsingleton) (endpoint : V ⊕ E) + (componentPath : H.Walk (Sum.inl v) endpoint) (_ : componentPath.IsPath) + (_ : {z : V ⊕ E | z ∈ componentPath.support} = C) (_ : ¬componentPath.Nil) + (_ : (0 : ℕ) < componentPath.length) (_ : endpoint ∈ C) (z : V ⊕ E) + (_ : H.Adj endpoint z), + z = componentPath.getVert (componentPath.length - (1 : ℕ)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 hrho1Proper + terminalPosition H C hvSub endpoint componentPath hcomponentPath hcomponentSupport + hcomponentNonempty hcomponentPositive hendpointC z hez + have hzC : z ∈ C := by + change H.connectedComponentMk z = H.connectedComponentMk (Sum.inl v) + change H.connectedComponentMk endpoint = + H.connectedComponentMk (Sum.inl v) at hendpointC + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hez).symm.trans hendpointC + have hzSupport : z ∈ componentPath.support := by + change z ∈ {y | y ∈ componentPath.support} + rw [hcomponentSupport] + exact hzC + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hzSupport + have hnlt : n < componentPath.length := by + have hnne : n ≠ componentPath.length := by + intro heq + have hze : z = endpoint := by + rw [← hn, heq, componentPath.getVert_length] + exact hez.ne hze.symm + omega + by_cases hpen : n + 1 = componentPath.length + · rw [← hn] + congr 1 + omega + by_cases hn0 : n = 0 + · have hnext : H.Adj (Sum.inl v) (componentPath.getVert 1) := by + simpa [hn0, componentPath.getVert_zero] using + componentPath.adj_getVert_succ hnlt + have hendStart : H.Adj (Sum.inl v) endpoint := by + rw [← hn, hn0, componentPath.getVert_zero] at hez + exact hez.symm + have hnextNe : componentPath.getVert 1 ≠ endpoint := by + intro heq + have hindices := hcomponentPath.getVert_injOn + (show 1 ≤ componentPath.length by omega) + (show componentPath.length ≤ componentPath.length by rfl) + (heq.trans componentPath.getVert_length.symm) + omega + exact False.elim (hnextNe (hvSub hnext hendStart)) + · have hleft : H.Adj z (componentPath.getVert (n - 1)) := by + rw [← hn] + have hadj := componentPath.adj_getVert_succ (i := n - 1) (by omega) + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ n)] using hadj.symm + have hright : H.Adj z (componentPath.getVert (n + 1)) := by + rw [← hn] + exact componentPath.adj_getVert_succ hnlt + have hendNeLeft : endpoint ≠ componentPath.getVert (n - 1) := by + intro heq + have hindices := hcomponentPath.getVert_injOn + (show componentPath.length ≤ componentPath.length by rfl) + (show n - 1 ≤ componentPath.length by omega) + (componentPath.getVert_length.trans heq) + omega + have hendNeRight : endpoint ≠ componentPath.getVert (n + 1) := by + intro heq + have hindices := hcomponentPath.getVert_injOn + (show componentPath.length ≤ componentPath.length by rfl) + (show n + 1 ≤ componentPath.length by omega) + (componentPath.getVert_length.trans heq) + omega + have hlrNe : componentPath.getVert (n - 1) ≠ + componentPath.getVert (n + 1) := by + intro heq + have hindices := hcomponentPath.getVert_injOn + (show n - 1 ≤ componentPath.length by omega) + (show n + 1 ≤ componentPath.length by omega) heq + omega + let : Fintype (H.neighborSet z) := Fintype.ofFinite _ + have hthree : 3 ≤ @SimpleGraph.degree _ H z (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let neighbors : Finset (Sum V E) := + {endpoint, componentPath.getVert (n - 1), + componentPath.getVert (n + 1)} + have hsubset : neighbors ⊆ H.neighborFinset z := by + intro y hy + simp only [neighbors, Finset.mem_insert, Finset.mem_singleton] at hy + rcases hy with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hez.symm + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hcard : 3 ≤ neighbors.card := by + simp [neighbors, hendNeLeft, hendNeRight, hlrNe] + exact hcard.trans (Finset.card_le_card hsubset) + have htwo : @SimpleGraph.degree _ H z (Fintype.ofFinite _) ≤ 2 := by + change @SimpleGraph.degree _ + (TwoColorIncidenceGraph G rho1 gamma delta) z + (Fintype.ofFinite _) ≤ 2 + exact TwoColorIncidenceDegreeAtMostTwo G rho1 gamma delta + hrho1Proper z + omega + +private theorem helper_hendpointVertex_4095.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (endpoint : V ⊕ E) (componentPath : H.Walk (Sum.inl v) endpoint) + (_ : (0 : ℕ) < componentPath.length) + (_ : + (∀ (z : V ⊕ E) (_ : H.Adj endpoint z), + z = componentPath.getVert (componentPath.length - (1 : ℕ)))), + ∃ (x : V), + endpoint = Sum.inl x := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition H endpoint componentPath hcomponentPositive hendpointNeighbor + cases hendpoint : endpoint with + | inl x => exact ⟨x, rfl⟩ + | inr f => + have hlastAdj : H.Adj + (componentPath.getVert (componentPath.length - 1)) endpoint := by + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ componentPath.length), + componentPath.getVert_length] using + componentPath.adj_getVert_succ + (i := componentPath.length - 1) (by omega) + have hfColor : rho1 f = some gamma ∨ rho1 f = some delta := by + cases hprevious : componentPath.getVert + (componentPath.length - 1) with + | inl y => + rw [hprevious, hendpoint] at hlastAdj + simpa [H, TwoColorIncidenceGraph] using hlastAdj |>.2 + | inr g => + rw [hprevious, hendpoint] at hlastAdj + simp [H, TwoColorIncidenceGraph] at hlastAdj + induction hends : G.ends f using Sym2.inductionOn with + | _ y z => + have hyz : y ≠ z := by + intro hyz + subst z + exact G.loopless f y hends + have hyAdj : H.Adj endpoint (Sum.inl y) := by + rw [hendpoint] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G y f ∧ + (rho1 f = some gamma ∨ rho1 f = some delta) from + ⟨by simp [Incident, hends], hfColor⟩) + have hzAdj : H.Adj endpoint (Sum.inl z) := by + rw [hendpoint] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G z f ∧ + (rho1 f = some gamma ∨ rho1 f = some delta) from + ⟨by simp [Incident, hends], hfColor⟩) + have heq := (hendpointNeighbor _ hyAdj).trans + (hendpointNeighbor _ hzAdj).symm + exact False.elim (hyz (Sum.inl.inj heq)) + +private theorem helper_swapBothPresent_4143.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k) (alpha beta : Fin k), alpha ≠ beta → + ∀ (root : V ⊕ E) (y : V), alpha ∈ PresentColors G phi y → beta ∈ PresentColors G phi y → alpha + ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta root) y ∧ beta ∈ PresentColors G + (TwoColorComponentSwap G phi alpha beta root) y := by + classical + intro V E _ _ G k phi alpha beta hne root y halpha hbeta + let _ := Fintype.ofFinite V + obtain ⟨eAlpha, heAlphaIncident, heAlphaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halpha + obtain ⟨eBeta, heBetaIncident, heBetaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hbeta + let K := TwoColorComponent G phi alpha beta root + have hedgeSameComponent : Sum.inr eAlpha ∈ K ↔ Sum.inr eBeta ∈ K := by + let J := TwoColorIncidenceGraph G phi alpha beta + have hAlphaAdj : J.Adj (Sum.inl y) (Sum.inr eAlpha) := by + simpa [J, TwoColorIncidenceGraph] using + (show Incident G y eAlpha ∧ + (phi eAlpha = some alpha ∨ phi eAlpha = some beta) from + ⟨heAlphaIncident, Or.inl heAlphaColor⟩) + have hBetaAdj : J.Adj (Sum.inl y) (Sum.inr eBeta) := by + simpa [J, TwoColorIncidenceGraph] using + (show Incident G y eBeta ∧ + (phi eBeta = some alpha ∨ phi eBeta = some beta) from + ⟨heBetaIncident, Or.inr heBetaColor⟩) + constructor + · intro hAlpha + change J.connectedComponentMk (Sum.inr eBeta) = + J.connectedComponentMk root + change J.connectedComponentMk (Sum.inr eAlpha) = + J.connectedComponentMk root at hAlpha + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hBetaAdj).symm.trans + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hAlphaAdj).trans hAlpha) + · intro hBeta + change J.connectedComponentMk (Sum.inr eAlpha) = + J.connectedComponentMk root + change J.connectedComponentMk (Sum.inr eBeta) = + J.connectedComponentMk root at hBeta + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hAlphaAdj).symm.trans + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hBetaAdj).trans hBeta) + by_cases hAlphaK : Sum.inr eAlpha ∈ K + · have hBetaK : Sum.inr eBeta ∈ K := hedgeSameComponent.mp hAlphaK + constructor + · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + refine ⟨eBeta, heBetaIncident, ?_⟩ + simp [TwoColorComponentSwap, K, hBetaK, heBetaColor] + · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + refine ⟨eAlpha, heAlphaIncident, ?_⟩ + simp [TwoColorComponentSwap, K, hAlphaK, heAlphaColor] + · have hBetaK : Sum.inr eBeta ∉ K := by + intro h + exact hAlphaK (hedgeSameComponent.mpr h) + constructor + · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨eAlpha, heAlphaIncident, by + simpa [TwoColorComponentSwap, K, hAlphaK] using heAlphaColor⟩ + · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨eBeta, heBetaIncident, by + simpa [TwoColorComponentSwap, K, hBetaK] using heBetaColor⟩ + +private theorem helper_hTnElementary_4214.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : indices0 (Fin.last p0) = q), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)), + ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma this q + hqTerminal hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hqLast H x componentPath + by_cases hqPositive : 0 < q.val + · obtain ⟨lower, hround, hlowerMP, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP + q.val hqPositive q.isLt + exact (hlower lower (by omega) (by omega) hlowerMP).1 + · have hqZero : q.val = 0 := by omega + have hbase : ColoredVertexSetElementary G + (ett.series.data.coloring 0) + (TreeSequenceVertexSet + (ett.series.data.tree ⟨1, by omega⟩)) := + (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + have hcolor : q.castSucc = (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + exact hqZero + have htree : q.succ.castSucc = + (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp [hqZero] + simpa [hcolor, htree] using hbase + +private theorem helper_hgammaMissingPre_4237.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma : Fin k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) + (_ : ett.series.data.chosenVertex q.succ = some v) + (_ : ett.series.data.gamma q.succ = some gamma), + gamma ∈ MissingColors G (ett.series.data.coloring q.castSucc) v := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma q hqKind hqVertex hqGamma + generalize htarget : q.succ = target + cases ett.series.certified target with + | initial => exact (Fin.succ_ne_zero q htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hqKind) + cases hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hqKind) + cases hbad + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + simpa using (congrArg Fin.val htarget).symm + subst i + have hvChoice : choice.vertex = v := + Option.some.inj + (currentVertex.symm.trans (by simpa [htarget] using hqVertex)) + have hgammaChoice : actualGamma = gamma := + Option.some.inj + (currentGamma.symm.trans (by simpa [htarget] using hqGamma)) + have hmissingSelected : actualGamma ∈ MissingColors G + choice.selected choice.vertex := gammaRule.1 + rw [choice.selectedStable.2 choice.vertex + choice.vertexDefective.1] at hmissingSelected + simpa only [hgammaChoice, hvChoice] using hmissingSelected + +private theorem helper_hterminalPresentSigma_4287.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) (_ : + ett.series.data.chosenVertex q.succ = some v) (_ : ett.series.data.gamma q.succ = some + gamma) (_ : ett.series.data.delta q.succ = some delta) (_ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (_ : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring + q.succ) sigma) (_ : gamma ≠ delta) (_ : ( + ∀ (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (_ : alpha ≠ beta) (root : V ⊕ E) (y : + V) (_ : alpha ∈ PresentColors G phi y) (_ : beta ∈ PresentColors G phi y), alpha ∈ + PresentColors G (TwoColorComponentSwap G phi alpha beta root) y ∧ beta ∈ PresentColors G + (TwoColorComponentSwap G phi alpha beta root) y)) (_ : ColoredVertexSetElementary G + (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc))) (_ : gamma ∈ MissingColors G (ett.series.data.coloring q.castSucc) v) + (_ : delta ∉ TreeMissingColors (ett.series.data.coloring q.castSucc) (ett.series.data.tree + q.succ.castSucc)), + ∀ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), y ≠ v → gamma ∈ + PresentColors G sigma y ∧ delta ∈ PresentColors G sigma y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqKind hqVertex + hqGamma hqDelta hvStage hsigmaTerminal hgammaDelta swapBothPresent hTnElementary + hgammaMissingPre hdeltaNotMissingPre y hy hyv + have hgammaNotMissingPre : gamma ∉ MissingColors G + (ett.series.data.coloring q.castSucc) y := by + intro hgammaY + have hdisjoint := hTnElementary hvStage hy hyv.symm + exact (Finset.disjoint_left.mp hdisjoint) hgammaMissingPre hgammaY + have hdeltaNotMissingPreY : delta ∉ MissingColors G + (ett.series.data.coloring q.castSucc) y := by + intro hdeltaY + apply hdeltaNotMissingPre + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨y, hy, hdeltaY⟩ + generalize htarget : q.succ = target + cases ett.series.certified target with + | initial => exact (Fin.succ_ne_zero q htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hqKind) + cases hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hqKind) + cases hbad + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + simpa using (congrArg Fin.val htarget).symm + subst i + have hvChoice : choice.vertex = v := + Option.some.inj + (currentVertex.symm.trans (by simpa [htarget] using hqVertex)) + have hgammaChoice : actualGamma = gamma := + Option.some.inj + (currentGamma.symm.trans (by simpa [htarget] using hqGamma)) + have hdeltaChoice : choice.color = delta := + Option.some.inj + (currentDelta.symm.trans (by simpa [htarget] using hqDelta)) + have hgammaSecondNot : actualGamma ∉ + MissingColors G secondStable y := by + rw [secondStableRelation.2 y hy, choice.selectedStable.2 y hy] + simpa only [hgammaChoice] using hgammaNotMissingPre + have hdeltaSecondNot : choice.color ∉ + MissingColors G secondStable y := by + rw [secondStableRelation.2 y hy, choice.selectedStable.2 y hy] + simpa only [hdeltaChoice] using hdeltaNotMissingPreY + have hgammaSecond : actualGamma ∈ + PresentColors G secondStable y := by + simpa [MissingColors] using hgammaSecondNot + have hdeltaSecond : choice.color ∈ + PresentColors G secondStable y := by + simpa [MissingColors] using hdeltaSecondNot + have hchoiceNe : actualGamma ≠ choice.color := by + simpa only [hgammaChoice, hdeltaChoice] using hgammaDelta + have hcurrentPresent := swapBothPresent secondStable actualGamma + choice.color hchoiceNe (Sum.inl choice.vertex) y hgammaSecond + hdeltaSecond + have hgammaCurrent : actualGamma ∈ PresentColors G + (ett.series.data.coloring q.succ) y := by + rw [currentColoring] + exact hcurrentPresent.1 + have hdeltaCurrent : choice.color ∈ PresentColors G + (ett.series.data.coloring q.succ) y := by + rw [currentColoring] + exact hcurrentPresent.2 + have hgammaSigmaNot : actualGamma ∉ MissingColors G sigma y := by + rw [hsigmaTerminal.2 y hy] + simpa [MissingColors] using hgammaCurrent + have hdeltaSigmaNot : choice.color ∉ MissingColors G sigma y := by + rw [hsigmaTerminal.2 y hy] + simpa [MissingColors] using hdeltaCurrent + exact ⟨by + simpa [hgammaChoice, MissingColors] using hgammaSigmaNot, + by simpa [hdeltaChoice, MissingColors] using hdeltaSigmaNot⟩ + +private theorem helper_hxOutsideN_4382.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal + sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : gamma ≠ delta) (_ : TwoColorIncidenceGraph G sigma gamma delta = TwoColorIncidenceGraph + G rho1 gamma delta), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (_ : ( + ∀ (z : V ⊕ E) (_ : H.Adj (Sum.inl x) z), z = componentPath.getVert (componentPath.length - (1 + : ℕ)))) (_ : x ≠ v) (_ : ( + ∀ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), y ≠ v → gamma ∈ + PresentColors G sigma y ∧ delta ∈ PresentColors G sigma y)), x ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hvFinal trace + rho1 hgammaDelta hterminalGraph H x componentPath hendpointNeighbor hxNe + hterminalPresentSigma hxN + obtain ⟨hxGamma, hxDelta⟩ := hterminalPresentSigma x hxN hxNe + obtain ⟨eGamma, heGammaIncident, heGammaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hxGamma + obtain ⟨eDelta, heDeltaIncident, heDeltaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hxDelta + have hedgeNe : eGamma ≠ eDelta := by + intro heq + subst eDelta + exact hgammaDelta + (Option.some.inj (heGammaColor.symm.trans heDeltaColor)) + have hgammaAdjSigma : + (TwoColorIncidenceGraph G sigma gamma delta).Adj + (Sum.inl x) (Sum.inr eGamma) := by + simpa [TwoColorIncidenceGraph] using + (show Incident G x eGamma ∧ + (sigma eGamma = some gamma ∨ sigma eGamma = some delta) from + ⟨heGammaIncident, Or.inl heGammaColor⟩) + have hdeltaAdjSigma : + (TwoColorIncidenceGraph G sigma gamma delta).Adj + (Sum.inl x) (Sum.inr eDelta) := by + simpa [TwoColorIncidenceGraph] using + (show Incident G x eDelta ∧ + (sigma eDelta = some gamma ∨ sigma eDelta = some delta) from + ⟨heDeltaIncident, Or.inr heDeltaColor⟩) + rw [hterminalGraph] at hgammaAdjSigma hdeltaAdjSigma + have heq := (hendpointNeighbor _ hgammaAdjSigma).trans + (hendpointNeighbor _ hdeltaAdjSigma).symm + exact hedgeNe (Sum.inr.inj heq) + +private theorem helper_hxOutsidePrime_4415.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal + sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (_ : ( + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, MissingColors G rho1 x ∩ supportColors = ∅)) (_ + : gamma ∈ supportColors) (_ : delta ∈ supportColors) (_ : gamma ≠ delta), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (_ : ( + ∀ (z : V ⊕ E) (_ : H.Adj (Sum.inl x) z), z = componentPath.getVert (componentPath.length - (1 + : ℕ)))) (_ : x ≠ v), x ∉ TreeSequenceVertexSet TjPrime := by + classical + intro V E _ _ _ G k e0 input T generating ett v gamma delta sigma this hvFinal trace p0 + indices0 rho1 supportColors TjPrime hcaseTwoPointwise hgammaSupport hdeltaSupport + hgammaDelta H x componentPath hendpointNeighbor hxNe hxPrime + have hxErase : x ∈ (TreeSequenceVertexSet TjPrime).erase v := + Finset.mem_erase.mpr ⟨hxNe, hxPrime⟩ + have hxEmpty := hcaseTwoPointwise x hxErase + have hgammaNotMissing : gamma ∉ MissingColors G rho1 x := by + intro hgammaMissing + have hmember : gamma ∈ MissingColors G rho1 x ∩ supportColors := + Finset.mem_inter.mpr ⟨hgammaMissing, hgammaSupport⟩ + rw [hxEmpty] at hmember + simp at hmember + have hdeltaNotMissing : delta ∉ MissingColors G rho1 x := by + intro hdeltaMissingX + have hmember : delta ∈ MissingColors G rho1 x ∩ supportColors := + Finset.mem_inter.mpr ⟨hdeltaMissingX, hdeltaSupport⟩ + rw [hxEmpty] at hmember + simp at hmember + have hxGamma : gamma ∈ PresentColors G rho1 x := by + simpa [MissingColors] using hgammaNotMissing + have hxDelta : delta ∈ PresentColors G rho1 x := by + simpa [MissingColors] using hdeltaNotMissing + obtain ⟨eGamma, heGammaIncident, heGammaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hxGamma + obtain ⟨eDelta, heDeltaIncident, heDeltaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hxDelta + have hedgeNe : eGamma ≠ eDelta := by + intro heq + subst eDelta + exact hgammaDelta + (Option.some.inj (heGammaColor.symm.trans heDeltaColor)) + have hgammaAdj : H.Adj (Sum.inl x) (Sum.inr eGamma) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G x eGamma ∧ + (rho1 eGamma = some gamma ∨ rho1 eGamma = some delta) from + ⟨heGammaIncident, Or.inl heGammaColor⟩) + have hdeltaAdj : H.Adj (Sum.inl x) (Sum.inr eDelta) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G x eDelta ∧ + (rho1 eDelta = some gamma ∨ rho1 eDelta = some delta) from + ⟨heDeltaIncident, Or.inr heDeltaColor⟩) + have heq := (hendpointNeighbor _ hgammaAdj).trans + (hendpointNeighbor _ hdeltaAdj).symm + exact hedgeNe (Sum.inr.inj heq) + +private theorem helper_hvNotPrevious_4521.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) + (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : indices0 (Fin.last p0) = q), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), + v ∉ TreeSequenceVertexSet Tprevious := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hqLast H x componentPath u exitPath Tprevious hjPositive hvPrevious + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hlast : Fin.last ett.rounds ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett + (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hvFinal + have hfirst := hjSlot + unfold ETTFirstAppearanceIndex at hfirst + dsimp at hfirst + have hminimumValue : + (candidates.min' ⟨Fin.last ett.rounds, hlast⟩).val = + jSlot.val := by + change jSlot.val + 1 = + (candidates.min' ⟨Fin.last ett.rounds, hlast⟩).val + 1 at hfirst + omega + let previousSlot : Fin ett.rounds := + ⟨jSlot.val - 1, by omega⟩ + have hpreviousIndex : previousSlot.succ = jSlot.castSucc := by + apply Fin.ext + simp [previousSlot] + omega + have hpreviousMember : previousSlot.castSucc ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett previousSlot.castSucc = + Tprevious by + unfold ExtendedTashkinovLadderStage + rw [Fin.lastCases_castSucc, hpreviousIndex]] + exact hvPrevious + have hminimum := Finset.min'_le candidates previousSlot.castSucc + hpreviousMember + have hminimumVal := Fin.le_iff_val_le_val.mp hminimum + rw [hminimumValue] at hminimumVal + dsimp [previousSlot] at hminimumVal + omega + +private theorem helper_hpreviousStrict_4568.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), v ∉ TreeSequenceVertexSet Tprevious)) (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious (ett.series.data.tree + jSlot.succ.castSucc))) (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalAt hterminalPositionPositive hterminalPositionBound seed H x + componentPath u exitPath Tprevious hvNotPrevious hpreviousTj hjPositive + by_contra hnot + have hpositionLe : terminalPosition.val ≤ Tprevious.length := by + simpa [seed, TreeSequencePrefix] using Nat.le_of_not_gt hnot + let previousPosition : Fin (Tprevious.length + 1) := + ⟨terminalPosition.val, by omega⟩ + have hcast : Fin.castLE + (Nat.succ_le_succ (hpreviousTj hjPositive).1) + previousPosition = terminalPosition := by + apply Fin.ext + rfl + apply hvNotPrevious hjPositive + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨previousPosition, ?_⟩ + have hvertex := (hpreviousTj hjPositive).2.1 previousPosition + rw [hcast] at hvertex + exact hvertex.symm.trans hterminalAt + +private theorem helper_branch_4596.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (_ : (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))).length = (1 : ℕ)) (_ : + TashkinovClosure (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) + (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (1 : Fin + (ett.rounds + (2 : ℕ))))) (_ : jSlot.castSucc = (0 : Fin (ett.rounds + (1 : ℕ)))), + TashkinovAugmentationSequence (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) + seed (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hseedTj commonPrefix seedLength initialClosure htarget + have htargetZero : jSlot.val = 0 := by + have := congrArg Fin.val htarget + simpa using this + have htreeOne : ett.series.data.tree 1 = + ett.series.data.tree jSlot.succ.castSucc := by + congr 1 + apply Fin.ext + simp [htargetZero] + have hinitialTj : TreeSequenceInitialSegment + (ett.series.data.tree 0) + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := TashkinovAugmentationSequenceInitialSegment _ _ _ + initialClosure.1 + rw [htreeOne] at h + exact h + have hbaseSeed : TreeSequenceInitialSegment + (ett.series.data.tree 0) seed := by + apply commonPrefix hinitialTj hseedTj + rw [seedLength] + exact seed.positive + have hrouteOld : TashkinovAugmentationSequence + (ett.series.data.coloring 0) (ett.series.data.tree 0) + (ett.series.data.tree jSlot.succ.castSucc) := by + rw [← htreeOne] + exact initialClosure.1 + have hroute := TashkinovAugmentationSequenceSuffix + (ett.series.data.coloring 0) (ett.series.data.tree 0) seed + (ett.series.data.tree jSlot.succ.castSucc) hrouteOld hbaseSeed + hseedTj + simpa [htargetZero] using hroute + +private theorem helper_branch_4629.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (i : Fin ett.rounds) (choice + : MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)) + (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed (ett.series.data.tree + jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj + commonPrefix H x componentPath u exitPath Tprevious hpreviousStrict i choice adjoined + adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hjPositive : 0 < jSlot.val := by + have := congrArg Fin.val hi + simp at this + omega + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + simpa [hi] using + (TashkinovAugmentationSequenceSuffix + (ett.series.data.coloring jSlot.castSucc) adjoined seed _ hroute + hadjoinedSeed hseedTj) + +private theorem helper_branch_4664.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (i : Fin + ett.rounds) (_ : TashkinovClosure (ett.series.data.coloring i.succ) (ett.series.data.tree + i.succ.castSucc) (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed (ett.series.data.tree + jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj + H x componentPath u exitPath Tprevious hpreviousSeed i closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hjPositive : 0 < jSlot.val := by + have := congrArg Fin.val hi + simp at this + omega + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + simpa [Tprevious, hi] using h + simpa [hi] using + (TashkinovAugmentationSequenceSuffix + (ett.series.data.coloring jSlot.castSucc) Tprevious seed _ hroute + (hpreviousSeed hjPositive) hseedTj) + +private theorem helper_branch_4686.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (i : Fin ett.rounds) + (available : RevisitingExtensionCertificate ett.series.data i.castSucc) (adjoined : + TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) + available.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring i.succ) adjoined + (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed (ett.series.data.tree + jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj + commonPrefix H x componentPath u exitPath Tprevious hpreviousStrict i available adjoined + adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hjPositive : 0 < jSlot.val := by + have := congrArg Fin.val hi + simp at this + omega + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + simpa [hi] using + (TashkinovAugmentationSequenceSuffix + (ett.series.data.coloring jSlot.castSucc) adjoined seed _ hroute + hadjoinedSeed hseedTj) + +private theorem helper_hpreterminalGammaPresent_4778.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (_ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k) (_ : ( + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc)) (_ : Function.Injective (Fin.cons (gamma0 + (0 : Fin (p0 + (1 : ℕ)))) delta0)), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : + (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (_ : ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = {gamma0 a, delta0 a})) + (_ : ( + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, MissingColors G rho1 x ∩ supportColors = ∅)) (_ + : gamma0 (Fin.last p0) = gamma), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (_ : V ⊕ E) (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : u ∈ + (TreeSequenceVertexSet TjPrime).erase v) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u : V) (beta : Fin k) (_ : u ∈ + TreeSequenceVertexSet TjPrime) (_ : u ∉ TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) (_ : beta ∈ MissingColors G rho1 u) (a : Fin p0), gamma0 a.castSucc ∈ + PresentColors G (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta delta) + gamma beta (Sum.inl u)) u := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvStage hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 hchain0 + hinjective0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound + supportColors TjPrime hstored0 hcaseTwoPointwise hgammaLast H a x componentPath u exitPath + huErase zPosition u' beta' huPrime' huOutside' hbeta' a + let aSlot : Fin (p0 + 1) := a.castSucc + have hgammaASupport : gamma0 aSlot ∈ supportColors := by + simp only [supportColors, Finset.mem_biUnion, Finset.mem_univ, + true_and] + refine ⟨aSlot, ?_⟩ + rw [hstored0] + simp + have huNe : u' ≠ v := by + intro huv + apply huOutside' + simpa [huv] using hvStage + have huErase : u' ∈ (TreeSequenceVertexSet TjPrime).erase v := + Finset.mem_erase.mpr ⟨huNe, huPrime'⟩ + have hgammaANotMissing : + gamma0 aSlot ∉ MissingColors G rho1 u' := by + intro hmissing + have hmember : gamma0 aSlot ∈ + MissingColors G rho1 u' ∩ supportColors := + Finset.mem_inter.mpr ⟨hmissing, hgammaASupport⟩ + rw [hcaseTwoPointwise u' huErase] at hmember + simp at hmember + have hgammaAPresent : gamma0 aSlot ∈ PresentColors G rho1 u' := by + simpa [MissingColors] using hgammaANotMissing + have hgammaANeBeta : gamma0 aSlot ≠ beta' := by + intro heq + have hbetaSupport' : beta' ∉ supportColors := by + intro hbetaSupport' + have hmember : beta' ∈ MissingColors G rho1 u' ∩ supportColors := + Finset.mem_inter.mpr ⟨hbeta', hbetaSupport'⟩ + rw [hcaseTwoPointwise u' huErase] at hmember + simp at hmember + exact hbetaSupport' (heq ▸ hgammaASupport) + have hconsGamma (r : Fin (p0 + 1)) : + (Fin.cons (gamma0 0) delta0 : Fin (p0 + 2) → Fin k) + r.castSucc = gamma0 r := by + refine Fin.cases ?_ (fun s => ?_) r + · simp + · rw [show (Fin.succ s).castSucc = s.castSucc.succ by + apply Fin.ext + rfl] + rw [Fin.cons_succ] + exact (hchain0 s).symm + have hgammaANeGamma : gamma0 aSlot ≠ gamma := by + intro heq + have hvalues : + (Fin.cons (gamma0 0) delta0 : Fin (p0 + 2) → Fin k) + aSlot.castSucc = + (Fin.cons (gamma0 0) delta0 : Fin (p0 + 2) → Fin k) + (Fin.last p0).castSucc := by + rw [hconsGamma, hconsGamma, hgammaLast] + exact heq + have hindices := hinjective0 hvalues + have hvals := congrArg Fin.val hindices + simp [aSlot] at hvals + omega + obtain ⟨f, huf, hcolor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hgammaAPresent + have htreeIncident : TreeIncidentEdge TjPrime f := + ⟨u', huPrime', huf⟩ + have houtsideColor : + OutsideTreeColorSwap TjPrime rho1 beta' delta f = + some (gamma0 aSlot) := by + simp [OutsideTreeColorSwap, htreeIncident, hcolor] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + refine ⟨f, huf, ?_⟩ + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G + (OutsideTreeColorSwap TjPrime rho1 beta' delta) + gamma beta' (Sum.inl u') + · simp [TwoColorComponentSwap, hfComponent, houtsideColor, + hgammaANeGamma, hgammaANeBeta, aSlot] + · simp [TwoColorComponentSwap, hfComponent, houtsideColor, aSlot] + +private theorem helper_hclaim45Package_4916.{u_1, u_2} : + helperHclaim45Package4916Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvStage hvFinal hfirstUpper hfirstPositive jSlot trace hterminalJ p0 indices0 gamma0 rho1 + hrho1Proper hrho1One hb2Missing terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTj hseedTerminal hTjQ supportColors TjPrime hclosure + hprimeElementary hseedPrime hb1Tj hcaseTwoPointwise gammaFirst hgammaSupport hdeltaSupport + hgammaDelta hb2EdgesFromSeed hdeltaPhiJ hterminalSeed fN hdeltaMissing H C a x + componentPath hcomponentPath hcomponentSupport hxOutside u exitPath hexitPath hexitLength + hexitSupport hexitIntersection hexitBoundary huNotFN huPrime huOutside hdegree beta hbeta + hbetaSupport haugmentation z hz zPosition hzPosition hzAfter hzChoice hzBefore hzEdges + hpositiveClaim45 hgammaFirstZero + by_cases hp0 : 0 < p0 + · obtain ⟨u0, huPrime0, huOutside0, exitPath0, hexitPath0, + hexitLength0, hexitSupport0, hexitIntersection0, + hexitBoundary0, huNotFN0, hforBeta0⟩ := + hpositiveClaim45 hp0 + obtain ⟨beta0, hbeta0⟩ := + MissingColorsNonemptyOfMaximumDegree G rho1 hdegree u0 + have huTerminal0 : u0 ≠ v := by + intro huv + apply huOutside0 + simpa [huv] using hvStage + have huErase0 : u0 ∈ (TreeSequenceVertexSet TjPrime).erase v := + Finset.mem_erase.mpr ⟨huTerminal0, huPrime0⟩ + have hbetaSupport0 : beta0 ∉ supportColors := by + intro hbetaIn + have hmember : beta0 ∈ + MissingColors G rho1 u0 ∩ supportColors := + Finset.mem_inter.mpr ⟨hbeta0, hbetaIn⟩ + rw [hcaseTwoPointwise u0 huErase0] at hmember + simp at hmember + obtain ⟨z0, hz0, zPosition0, hzPosition0, hzAfter0, hzChoice0, + hzBefore0, hzEdges0, rho3, hrho3Proper, hrho3One, hd1, + hd2Missing, hd2Edges, hdeltaZ, hd2z, hd3⟩ := + hforBeta0 beta0 hbeta0 + exact ⟨u0, huPrime0, huOutside0, exitPath0, hexitPath0, + hexitLength0, hexitSupport0, hexitIntersection0, + hexitBoundary0, huNotFN0, beta0, hbeta0, hbetaSupport0, + z0, hz0, zPosition0, hzPosition0, hzAfter0, hzChoice0, + hzBefore0, hzEdges0, rho3, hrho3Proper, hrho3One, hd1, + hd2Missing, hd2Edges, hdeltaZ, hd2z, hd3⟩ + · have hp0Zero : p0 = 0 := Nat.eq_zero_of_not_pos hp0 + let rho0 := OutsideTreeColorSwap TjPrime rho1 beta delta + let rho3 := TwoColorComponentSwap G rho0 gamma beta (Sum.inl u) + have hbetaDelta0 : beta ≠ delta := by + intro heq + exact hbetaSupport (heq ▸ hdeltaSupport) + have hbetaGamma0 : beta ≠ gamma := by + intro heq + exact hbetaSupport (heq ▸ hgammaSupport) + have hsingleton := ExtensionBaseClaim45Singleton + (ett.series.data.tree q.succ.castSucc) + (ett.series.data.tree jSlot.succ.castSucc) seed TjPrime + (ett.series.data.coloring jSlot.castSucc) rho1 + (TashkinovStoredColors ett.series.data jSlot.castSucc) + supportColors gammaFirst gamma delta beta v u x z + componentPath exitPath zPosition (hgammaFirstZero hp0Zero) + hrho1Proper hrho1One hTjQ hseedTj hseedPrime hseedTerminal + hterminalJ hterminalSeed hclosure hprimeElementary hgammaDelta + hbetaGamma0 hbetaDelta0 hbeta hdeltaMissing hcomponentPath + (by simpa [C] using hcomponentSupport) hxOutside huPrime huOutside + hexitPath hexitLength hexitSupport hexitIntersection hexitBoundary + hb1Tj hb2Missing.1 haugmentation hb2EdgesFromSeed hdeltaPhiJ + hz hzPosition hzAfter hzChoice hzBefore hzEdges + change IsProperEdgeColoring G rho3 ∧ + IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho3 ∧ + ((∀ y : V, + y ∈ (((TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) z hz ∪ {z}) ∪ + (TreeVerticesBefore TjPrime u huPrime ∪ + {u})).erase u).erase z → + MissingColors G rho3 y = MissingColors G rho1 y) ∧ + (∀ f : E, + ((∃ a : Fin + (ett.series.data.tree jSlot.succ.castSucc).length, + seed.length ≤ a.val ∧ a.val < zPosition.val ∧ + (ett.series.data.tree jSlot.succ.castSucc).edge a = + f) ∨ + (∃ (a : Fin TjPrime.length) + (uPosition : Fin (TjPrime.length + 1)), + TjPrime.vertex uPosition = u ∧ + a.val < uPosition.val ∧ TjPrime.edge a = f)) → + rho3 f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → + delta ∈ MissingColors G rho3 z) ∧ + (z ∈ TreeVerticesBefore TjPrime u huPrime → + MissingColors G rho3 z = MissingColors G rho1 z)) ∧ + gammaFirst ∈ MissingColors G rho3 u at hsingleton + rcases hsingleton with + ⟨hrho3Proper0, hrho3One0, hd10, hE20, hd30⟩ + rcases hE20 with + ⟨hd2Missing0, hd2Edges0, hdeltaZ0, hd2z0⟩ + exact ⟨u, huPrime, huOutside, exitPath, hexitPath, hexitLength, + hexitSupport, hexitIntersection, hexitBoundary, huNotFN, + beta, hbeta, hbetaSupport, z, hz, zPosition, hzPosition, + hzAfter, hzChoice, hzBefore, hzEdges, rho3, hrho3Proper0, + hrho3One0, hd10, hd2Missing0, hd2Edges0, hdeltaZ0, hd2z0, + hd30⟩ + +private theorem helper_hUsegmentVertexBefore_5198.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : + TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet + TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( + ∀ (i : Fin (TjPrime.length + (1 : ℕ))) (_ : (↑i : ℕ) < (↑uPosition : ℕ)), TjPrime.vertex i ∈ + TreeVerticesBefore TjPrime u0 huPrime0)) {A : TreeSequence G e0} (_ : + TreeSequenceInitialSegment A U) (_ : A.length < U.length) {y : V} (_ : y ∈ + TreeSequenceVertexSet A), y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition + huPositionPositive huPositionBound U hUPrime hprimeVertexBefore A hAU hAlen y hyA + obtain ⟨hAULen, hAUVertices, -⟩ := hAU + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hyA + obtain ⟨i, rfl⟩ := hyA + let iU : Fin (U.length + 1) := + Fin.castLE (Nat.succ_le_succ hAULen) i + let iPrime : Fin (TjPrime.length + 1) := + Fin.castLE (Nat.succ_le_succ hUPrime.1) iU + have hiPrime : iPrime.val < uPosition.val := by + change i.val < uPosition.val + have hUlen : U.length = uPosition.val := by + simp [U, TreeSequencePrefix] + omega + rw [← hAUVertices i, ← hUPrime.2.1 iU] + exact hprimeVertexBefore iPrime hiPrime + +private theorem helper_transportUStep_5236.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin + ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : + TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet + TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : + PartialEdgeColoring E k) (_ : ( + ∀ (f : E) (_ : (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 f)) + (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : TjPrime.vertex uPosition = u0) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A U) (_ : A.length < U.length) + {y : V} (_ : y ∈ TreeSequenceVertexSet A), y ∈ TreeVerticesBefore TjPrime u0 huPrime0)) (_ + : ( + ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, MissingColors G rho3 y = MissingColors G rho1 + y)) {A B : TreeSequence G e0} (_ : TashkinovAugmentation rho1 A B) (_ : + TreeSequenceInitialSegment B U), TashkinovAugmentation rho3 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 rho3 hd2Edges uPosition + huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore + hbeforePrimeMissing A B hstep hBU + rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ + have hAU : TreeSequenceInitialSegment A U := segmentTrans hAB hBU + have hAlen : A.length < U.length := + lt_of_lt_of_le (by omega) hBU.1 + have hcMissingRho : c ∈ TreeMissingColors rho3 A := by + unfold TreeMissingColors at hcMissing + obtain ⟨y, hyA, hcy⟩ := Finset.mem_biUnion.mp hcMissing + refine Finset.mem_biUnion.mpr ⟨y, hyA, ?_⟩ + rw [hbeforePrimeMissing y (hUsegmentVertexBefore hAU hAlen hyA)] + exact hcy + let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + let addedU : Fin U.length := Fin.castLE hBU.1 added + let addedPrime : Fin TjPrime.length := Fin.castLE hUPrime.1 addedU + have haddedPosition : addedPrime.val < uPosition.val := by + change A.length < uPosition.val + have hUlen : U.length = uPosition.val := by + simp [U, TreeSequencePrefix] + omega + have haddedIdentity : TjPrime.edge addedPrime = B.edge added := + (hUPrime.2.2 addedU).trans (hBU.2.2 added) + have haddedFixed : rho3 (B.edge added) = rho1 (B.edge added) := by + apply hd2Edges (B.edge added) + exact Or.inr ⟨addedPrime, uPosition, huPosition, + haddedPosition, haddedIdentity⟩ + refine ⟨hlen, hAB, c, haddedFixed.trans hcolor, hcMissingRho⟩ + +private theorem helper_hTjC_5298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : + seed.length = (ett.series.data.tree jSlot.succ.castSucc).length) (C : TreeSequence G e0) + (_ : TreeSequenceInitialSegment seed C), TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc) ⊆ TreeSequenceVertexSet C := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hseedTj hseedFull C hseedC y hy + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hy ⊢ + obtain ⟨i, rfl⟩ := hy + let iSeed : Fin (seed.length + 1) := ⟨i.val, by + rw [hseedFull] + exact i.isLt⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hseedC.1) iSeed, ?_⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hseedTj.1) iSeed = i := by + apply Fin.ext + rfl + exact (hseedC.2.1 iSeed).trans + ((hseedTj.2.1 iSeed).symm.trans + (congrArg + (ett.series.data.tree jSlot.succ.castSucc).vertex hcast)) + +private theorem helper_transportSeedStep_5350.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin + ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore T v hvFinal)) (TjPrime : + TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (_ : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u0)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : PartialEdgeColoring E k) (_ : + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3) (_ : Fin (TjPrime.length + (1 : ℕ))) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {y : V} (_ : y ∈ TreeSequenceVertexSet A), y ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ)) {A B : TreeSequence G e0} (_ : TashkinovAugmentation + (ett.series.data.coloring jSlot.castSucc) A B) (_ : TreeSequenceInitialSegment B seed), + TashkinovAugmentation rho3 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot segmentTrans trace hterminalJ p0 indices0 gamma0 + delta0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj + segmentVertexBefore TjPrime H x componentPath u exitPath zPosition u0 exitPath0 zPosition0 + rho3 hd1 uPosition segmentVertexBefore A B hstep hBseed + rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ + have hAseed : TreeSequenceInitialSegment A seed := + segmentTrans hAB hBseed + have hAlen : A.length < seed.length := + lt_of_lt_of_le (by omega) hBseed.1 + have hcMissingRho : c ∈ TreeMissingColors rho3 A := by + unfold TreeMissingColors at hcMissing + obtain ⟨y, hyA, hcy⟩ := Finset.mem_biUnion.mp hcMissing + refine Finset.mem_biUnion.mpr ⟨y, hyA, ?_⟩ + rw [hd1.2 y (segmentVertexBefore hAseed hAlen hyA)] + exact hcy + let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨attach, hattach⟩ := B.attaches added + let oldPosition : Fin (B.length + 1) := + Fin.castLT attach + (Nat.lt_trans attach.isLt (Nat.succ_lt_succ added.isLt)) + have holdValue : oldPosition.val < A.length + 1 := by + dsimp [oldPosition, added] + omega + let oldA : Fin (A.length + 1) := ⟨oldPosition.val, holdValue⟩ + have holdEq : B.vertex oldPosition = A.vertex oldA := by + have hcast : Fin.castLE (Nat.succ_le_succ hAB.1) oldA = + oldPosition := by + apply Fin.ext + rfl + rw [← hcast] + exact hAB.2.1 oldA + have holdBefore : B.vertex oldPosition ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ := by + rw [holdEq] + exact segmentVertexBefore hAseed hAlen + (by simp [TreeSequenceVertexSet]) + have holdIncident : Incident G (B.vertex oldPosition) + (B.edge added) := by + unfold Incident + rw [hattach] + simp [oldPosition] + have haddedFixed : rho3 (B.edge added) = + ett.series.data.coloring jSlot.castSucc (B.edge added) := by + apply hd1.1 (B.edge added) + ⟨B.vertex oldPosition, holdBefore, holdIncident⟩ + refine ⟨c, ?_, hcolor⟩ + apply Finset.mem_union_left + unfold TreeMissingColors at hcMissing + obtain ⟨y, hyA, hcy⟩ := Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨y, segmentVertexBefore hAseed hAlen hyA, hcy⟩ + exact ⟨hlen, hAB, c, haddedFixed.trans hcolor, hcMissingRho⟩ + +private theorem helper_branch_5420.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore T v hvFinal)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (rho3 : + PartialEdgeColoring E k) (_ : StableColoringBeforeVertex (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho3) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {y : V} (_ : y ∈ TreeSequenceVertexSet A), y ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) (f : E) (_ : + TreeIncidentEdge Tprevious f) (_ : ( + ∃ c ∈ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) Tprevious ∪ + TashkinovStoredColors ett.series.data jSlot.castSucc, ett.series.data.coloring + jSlot.castSucc f = some c)), rho3 f = ett.series.data.coloring jSlot.castSucc f := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hterminalJ terminalPosition hterminalPositionPositive + hterminalPositionBound seed segmentVertexBefore Tprevious hpreviousStrict hpreviousSeed + rho3 hd1 segmentVertexBefore hjPositive f hfIncident hfControlled + obtain ⟨y, hyPrevious, hyf⟩ := hfIncident + apply hd1.1 f + ⟨y, segmentVertexBefore (hpreviousSeed hjPositive) + (hpreviousStrict hjPositive) hyPrevious, hyf⟩ + obtain ⟨c, hcControlled, hfc⟩ := hfControlled + refine ⟨c, ?_, hfc⟩ + rcases Finset.mem_union.mp hcControlled with hcMissing | hcStored + · apply Finset.mem_union_left + unfold TreeMissingColors at hcMissing + obtain ⟨y, hy, hcy⟩ := Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨y, segmentVertexBefore (hpreviousSeed hjPositive) + (hpreviousStrict hjPositive) hy, hcy⟩ + · exact Finset.mem_union_right _ hcStored + +private theorem helper_branch_5475.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed), TashkinovAugmentationSequence rho1 S seed)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (rho3 : PartialEdgeColoring E + k) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed), TashkinovAugmentationSequence rho3 S seed)) (_ : (0 : ℕ) < + (↑jSlot : ℕ)) (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (_ : ett.series.data.connectingEdges i.succ = + { choice.edge }) (_ : ett.series.data.kind i.succ = some TashkinovExtensionKind.SE) + (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho3 Tprevious seed ∨ (ett.series.data.kind i.succ = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence rho3 + adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hjTreeIndex hseedTj transportSeedRoute commonPrefix Tprevious + hpreviousStrict rho3 transportSeedRoute hjPositive i choice currentEdges currentKind + adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hrouteFull : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj := + TashkinovAugmentationSequenceInitialSegment _ _ _ hrouteFull + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + have hroute := TashkinovAugmentationSequenceRestrict _ + adjoined seed _ hrouteFull hadjoinedSeed hseedTj + right + refine ⟨Or.inl (by simpa [htarget] using currentKind), + choice.edge, adjoined, by simpa [htarget] using currentEdges, + ?_, transportSeedRoute adjoined hroute⟩ + rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ + have hiCast : i.castSucc.succ = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hlenNew : adjoined.length = Tprevious.length + 1 := by + simpa [Tprevious, hiCast] using hlen + have hsegmentNew : + TreeSequenceInitialSegment Tprevious adjoined := by + simpa [Tprevious, hiCast] using hsegment + refine ⟨hlenNew, hsegmentNew, ?_⟩ + have haddedIndex : + Fin.cast hlenNew.symm (Fin.last Tprevious.length) = + Fin.cast hlen.symm + (Fin.last + (ett.series.data.tree i.succ.castSucc).length) := by + apply Fin.ext + simp [Tprevious, hiCast] + rw [haddedIndex] + exact hedge + +private theorem helper_branch_5528.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed), TashkinovAugmentationSequence rho1 S seed)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (rho3 : PartialEdgeColoring E + k) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed), TashkinovAugmentationSequence rho3 S seed)) (_ : (0 : ℕ) < + (↑jSlot : ℕ)) (i : Fin ett.rounds) (available : RevisitingExtensionCertificate + ett.series.data i.castSucc) (_ : ett.series.data.connectingEdges i.succ = + { available.edge }) (_ : ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) + (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) available.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho3 Tprevious seed ∨ (ett.series.data.kind i.succ = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence rho3 + adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hjTreeIndex hseedTj transportSeedRoute commonPrefix Tprevious + hpreviousStrict rho3 transportSeedRoute hjPositive i available currentEdges currentKind + adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hrouteFull : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj := + TashkinovAugmentationSequenceInitialSegment _ _ _ hrouteFull + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + have hroute := TashkinovAugmentationSequenceRestrict _ + adjoined seed _ hrouteFull hadjoinedSeed hseedTj + right + refine ⟨Or.inr (by simpa [htarget] using currentKind), + available.edge, adjoined, + by simpa [htarget] using currentEdges, ?_, + transportSeedRoute adjoined hroute⟩ + rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ + have hiCast : i.castSucc.succ = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hlenNew : adjoined.length = Tprevious.length + 1 := by + simpa [Tprevious, hiCast] using hlen + have hsegmentNew : + TreeSequenceInitialSegment Tprevious adjoined := by + simpa [Tprevious, hiCast] using hsegment + refine ⟨hlenNew, hsegmentNew, ?_⟩ + have haddedIndex : + Fin.cast hlenNew.symm (Fin.last Tprevious.length) = + Fin.cast hlen.symm + (Fin.last + (ett.series.data.tree i.succ.castSucc).length) := by + apply Fin.ext + simp [Tprevious, hiCast] + rw [haddedIndex] + exact hedge + +private theorem helper_hbound_5582.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (v : + V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : + TreeSequence G e0) (_ : indices0 (Fin.last p0) = q), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let _ : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : PartialEdgeColoring + E k) (_ : IsProperEdgeColoring G rho3) (_ : IsOneEdgeUncolored rho3 e0) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (C : TreeSequence G e0) (_ : TashkinovClosure rho3 U C) (_ : TashkinovAugmentationSequence + rho3 seed C) (_ : (0 : ℕ) < (↑jSlot : ℕ)) (_ : StableColoring Tprevious + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3) (_ : (ett.series.data.kind jSlot.castSucc = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence rho3 Tprevious seed ∨ + (ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges jSlot.castSucc = + { f } ∧ TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence rho3 + adjoinSeed seed)), (TreeSequenceVertexSet C).card ≤ (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).card := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime + hqLast H C x componentPath u exitPath Tprevious zPosition u0 exitPath0 zPosition0 rho3 + hrho3Proper hrho3One uPosition huPositionPositive huPositionBound U C hclosureUC + hrouteSeedC hjPositive hstablePrevious hseedBuildRho + have hMP' := hMP + unfold MaximumProperty at hMP' + have hstage := hMP'.2 jSlot.val hjPositive jSlot.isLt + dsimp only at hstage + have hidx : (⟨jSlot.val, by omega⟩ : Fin (ett.rounds + 1)) = + jSlot.castSucc := by apply Fin.ext; rfl + have hnextIdx : + (⟨jSlot.val + 1, by omega⟩ : Fin (ett.rounds + 2)) = + jSlot.succ.castSucc := by apply Fin.ext; rfl + rw [hidx, hnextIdx] at hstage + rcases hseedBuildRho with hparallel | hserial + · exact hstage rho3 Tprevious C hrho3Proper hrho3One + hstablePrevious (Or.inl ⟨hparallel.1, rfl⟩) + ⟨Relation.ReflTransGen.trans hparallel.2 hrouteSeedC, + hclosureUC.2⟩ + · rcases hserial with + ⟨hkind, f, adjoinSeed, hconnecting, hadjoin, hroute⟩ + exact hstage rho3 adjoinSeed C hrho3Proper hrho3One + hstablePrevious + (Or.inr ⟨hkind, f, hconnecting, + by simpa [Tprevious] using hadjoin⟩) + ⟨Relation.ReflTransGen.trans hroute hrouteSeedC, + hclosureUC.2⟩ + +private theorem helper_branch_5609.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (v : + V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed), TashkinovAugmentationSequence rho1 S seed)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let _ : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (_ : V ⊕ E) (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : PartialEdgeColoring + E k) (_ : IsProperEdgeColoring G rho3) (_ : IsOneEdgeUncolored rho3 e0) (_ : Fin + (TjPrime.length + (1 : ℕ))) (C : TreeSequence G e0) (_ : TashkinovAugmentationSequence + rho3 seed C) (_ : TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ⊂ + TreeSequenceVertexSet C) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed), TashkinovAugmentationSequence rho3 S seed)) (_ : ¬(0 : ℕ) < + (↑jSlot : ℕ)), False := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj + transportSeedRoute commonPrefix TjPrime H C a x componentPath u exitPath zPosition u0 + exitPath0 zPosition0 rho3 hrho3Proper hrho3One uPosition C hrouteSeedC hTjStrictC + transportSeedRoute hjPositive + have hjZero : jSlot.val = 0 := Nat.eq_zero_of_not_pos hjPositive + have hjIndex : jSlot.castSucc = + (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + exact hjZero + cases hcert : ett.series.certified + (0 : Fin (ett.rounds + 1)) with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have htreeOne : ett.series.data.tree 1 = + ett.series.data.tree jSlot.succ.castSucc := by + congr 1 + apply Fin.ext + simp [hjZero] + have hinitialTj : TreeSequenceInitialSegment + (ett.series.data.tree 0) + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := TashkinovAugmentationSequenceInitialSegment _ _ _ + initialClosure.1 + simpa [htreeOne] using h + have hinitialSeed : TreeSequenceInitialSegment + (ett.series.data.tree 0) seed := by + apply commonPrefix hinitialTj hseedTj + rw [seedLength] + exact seed.positive + have hroutePhiSeed : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree 0) seed := by + have hrestricted := TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring 0) (ett.series.data.tree 0) seed + (ett.series.data.tree jSlot.succ.castSucc) + (by simpa [htreeOne] using initialClosure.1) + hinitialSeed hseedTj + simpa [hjIndex] using hrestricted + have hrouteBaseC : TashkinovAugmentationSequence rho3 + (ett.series.data.tree 0) C := + Relation.ReflTransGen.trans + (transportSeedRoute (ett.series.data.tree 0) hroutePhiSeed) + hrouteSeedC + have htripleRho : KTriple G k e0 rho3 := + ⟨triple.1, triple.2.1, triple.2.2.1, + hrho3Proper, hrho3One⟩ + have hinitialTree : TashkinovTree G e0 rho3 + (ett.series.data.tree 0) := by + intro a ha + rw [seedLength] at a + omega + have hCTree : TashkinovTree G e0 rho3 C := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 rho3 + (ett.series.data.tree 0) C hinitialTree hrouteBaseC + have hk : ChromaticIndex G - 1 = k := by + have hchromatic := triple.2.1 + omega + have hCOrder : (TreeSequenceVertexSet C).card ≤ + TashkinovOrder G := by + unfold TashkinovOrder + dsimp only + apply Finset.le_max' + apply Finset.mem_insert_of_mem + simp only [Finset.mem_filter, Finset.mem_range] + refine ⟨Nat.lt_succ_of_le (Finset.card_le_univ _), ?_⟩ + rw [hk] + exact ⟨e0, rho3, C, htripleRho, hCTree, rfl⟩ + have hTjOrder : + (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).card = + TashkinovOrder G := by + rw [← htreeOne] + exact hMP.1 + have hbound : (TreeSequenceVertexSet C).card ≤ + (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).card := by + rw [hTjOrder] + exact hCOrder + exact (Nat.not_lt_of_ge hbound) + (Finset.card_lt_card hTjStrictC) + +private theorem helper_branch_5782.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) + (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (_ : ett.series.data.connectingEdges i.succ = + { choice.edge }) (_ : ett.series.data.kind i.succ = some TashkinovExtensionKind.SE) + (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ + (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict hjPositive i choice currentEdges + currentKind adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + right + refine ⟨Or.inl (by simpa [htarget] using currentKind), + choice.edge, adjoined, ?_, ?_, ?_⟩ + · simpa [htarget] using currentEdges + · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ + have hiCast : i.castSucc.succ = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hlenNew : adjoined.length = Tprevious.length + 1 := by + simpa [Tprevious, hiCast] using hlen + have hsegmentNew : + TreeSequenceInitialSegment Tprevious adjoined := by + simpa [Tprevious, hiCast] using hsegment + refine ⟨hlenNew, hsegmentNew, ?_⟩ + have haddedIndex : + Fin.cast hlenNew.symm (Fin.last Tprevious.length) = + Fin.cast hlen.symm + (Fin.last + (ett.series.data.tree i.succ.castSucc).length) := by + apply Fin.ext + simp [Tprevious, hiCast] + rw [haddedIndex] + exact hedge + · simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) adjoined seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + hadjoinedSeed hseedTj) + +private theorem helper_branch_5839.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (_ : (0 : ℕ) < + (↑jSlot : ℕ)) (i : Fin ett.rounds) (_ : ett.series.data.kind i.succ = some + TashkinovExtensionKind.PE) (_ : TashkinovClosure (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree i.succ.succ)) (_ : + jSlot.castSucc = i.succ), ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ + (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj Tprevious hpreviousSeed hjPositive i currentKind closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + simpa [Tprevious, hi] using h + left + refine ⟨by simpa [htarget] using currentKind, ?_⟩ + simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) Tprevious seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + (hpreviousSeed hjPositive) hseedTj) + +private theorem helper_branch_5861.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) + (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data + i.castSucc) (_ : ett.series.data.connectingEdges i.succ = { available.edge }) (_ : + ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) (adjoined : TreeSequence G + e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) available.edge + adjoined) (_ : TashkinovClosure (ett.series.data.coloring i.succ) adjoined + (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), ett.series.data.kind + i.succ = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) Tprevious seed ∨ (ett.series.data.kind i.succ = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict hjPositive i available + currentEdges currentKind adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + right + refine ⟨Or.inr (by simpa [htarget] using currentKind), + available.edge, adjoined, ?_, ?_, ?_⟩ + · simpa [htarget] using currentEdges + · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ + have hiCast : i.castSucc.succ = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hlenNew : adjoined.length = Tprevious.length + 1 := by + simpa [Tprevious, hiCast] using hlen + have hsegmentNew : + TreeSequenceInitialSegment Tprevious adjoined := by + simpa [Tprevious, hiCast] using hsegment + refine ⟨hlenNew, hsegmentNew, ?_⟩ + have haddedIndex : + Fin.cast hlenNew.symm (Fin.last Tprevious.length) = + Fin.cast hlen.symm + (Fin.last + (ett.series.data.tree i.succ.castSucc).length) := by + apply Fin.ext + simp [Tprevious, hiCast] + rw [haddedIndex] + exact hedge + · simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) adjoined seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + hadjoinedSeed hseedTj) + +private theorem helper_hUsegmentVertexBefore_6032.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : + TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet + TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( + ∀ (i : Fin (TjPrime.length + (1 : ℕ))) (_ : (↑i : ℕ) < (↑uPosition : ℕ)), TjPrime.vertex i ∈ + TreeVerticesBefore TjPrime u0 huPrime0)) {A : TreeSequence G e0} (_ : + TreeSequenceInitialSegment A U) (_ : A.length < U.length) {y : V} (_ : y ∈ + TreeSequenceVertexSet A), y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition + huPositionPositive huPositionBound U hUPrime hprimeVertexBefore A hAU hAlen y hyA + obtain ⟨hAULen, hAUVertices, -⟩ := hAU + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hyA + obtain ⟨i, rfl⟩ := hyA + let iU : Fin (U.length + 1) := + Fin.castLE (Nat.succ_le_succ hAULen) i + let iPrime : Fin (TjPrime.length + 1) := + Fin.castLE (Nat.succ_le_succ hUPrime.1) iU + have hiPrime : iPrime.val < uPosition.val := by + change i.val < uPosition.val + have hUlen : U.length = uPosition.val := by + simp [U, TreeSequencePrefix] + omega + rw [← hAUVertices i, ← hUPrime.2.1 iU] + exact hprimeVertexBefore iPrime hiPrime + +private theorem helper_transportUStep_6071.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin + ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : + TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet + TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : + PartialEdgeColoring E k) (_ : ( + ∀ (f : E) (_ : (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 f)) + (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : TjPrime.vertex uPosition = u0) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A U) (_ : A.length < U.length) + {y : V} (_ : y ∈ TreeSequenceVertexSet A), y ∈ TreeVerticesBefore TjPrime u0 huPrime0)) (_ + : ( + ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, MissingColors G rho3 y = MissingColors G rho1 + y)) {A B : TreeSequence G e0} (_ : TashkinovAugmentation rho1 A B) (_ : + TreeSequenceInitialSegment B U), TashkinovAugmentation rho3 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 rho3 hd2Edges uPosition + huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore + hbeforePrimeMissing A B hstep hBU + rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ + have hAU : TreeSequenceInitialSegment A U := segmentTrans hAB hBU + have hAlen : A.length < U.length := + lt_of_lt_of_le (by omega) hBU.1 + have hcMissingRho : c ∈ TreeMissingColors rho3 A := by + unfold TreeMissingColors at hcMissing ⊢ + obtain ⟨y, hyA, hcy⟩ := Finset.mem_biUnion.mp hcMissing + refine Finset.mem_biUnion.mpr ⟨y, hyA, ?_⟩ + rw [hbeforePrimeMissing y (hUsegmentVertexBefore hAU hAlen hyA)] + exact hcy + let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + let addedU : Fin U.length := Fin.castLE hBU.1 added + let addedPrime : Fin TjPrime.length := Fin.castLE hUPrime.1 addedU + have haddedPosition : addedPrime.val < uPosition.val := by + change A.length < uPosition.val + have hUlen : U.length = uPosition.val := by + simp [U, TreeSequencePrefix] + omega + have haddedIdentity : TjPrime.edge addedPrime = B.edge added := + (hUPrime.2.2 addedU).trans (hBU.2.2 added) + have haddedFixed : rho3 (B.edge added) = rho1 (B.edge added) := by + apply hd2Edges (B.edge added) + exact Or.inr ⟨addedPrime, uPosition, huPosition, + haddedPosition, haddedIdentity⟩ + exact ⟨hlen, hAB, c, haddedFixed.trans hcolor, hcMissingRho⟩ + +private theorem helper_equalPrefixes_6220.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B D : TreeSequence G e0}, TreeSequenceInitialSegment A D → TreeSequenceInitialSegment B + D → A.length = B.length → A = B := by + classical + intro V E G e0 A B D hAD hBD hlen + rcases hAD with ⟨hlenAD, hvertexAD, hedgeAD⟩ + rcases hBD with ⟨hlenBD, hvertexBD, hedgeBD⟩ + cases A with + | mk alen apos avertex aedge avinj aeinf afirst aattach => + cases B with + | mk blen bpos bvertex bedge bvinj beinj bfirst battach => + simp only at hlen + subst blen + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + calc + avertex i = D.vertex + (Fin.castLE (Nat.succ_le_succ hlenAD) i) := + (hvertexAD i).symm + _ = D.vertex + (Fin.castLE (Nat.succ_le_succ hlenBD) i) := by + congr 1 + _ = bvertex i := hvertexBD i + · apply heq_of_eq + funext i + calc + aedge i = D.edge (Fin.castLE hlenAD i) := + (hedgeAD i).symm + _ = D.edge (Fin.castLE hlenBD i) := by congr 1 + _ = bedge i := hedgeBD i + +private theorem helper_transportSeedStep_6612.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin + ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore T v hvFinal)) (TjPrime : + TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (_ : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u0)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : PartialEdgeColoring E k) (_ : + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3) (_ : Fin (TjPrime.length + (1 : ℕ))) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {y : V} (_ : y ∈ TreeSequenceVertexSet A), y ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ)) {A B : TreeSequence G e0} (_ : TashkinovAugmentation + (ett.series.data.coloring jSlot.castSucc) A B) (_ : TreeSequenceInitialSegment B seed), + TashkinovAugmentation rho3 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot segmentTrans trace hterminalJ p0 indices0 gamma0 + delta0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj + segmentVertexBefore TjPrime H x componentPath u exitPath zPosition u0 exitPath0 zPosition0 + rho3 hd1 uPosition segmentVertexBefore A B hstep hBseed + rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ + have hAseed := segmentTrans hAB hBseed + have hAlen : A.length < seed.length := + lt_of_lt_of_le (by omega) hBseed.1 + have hcMissingRho : c ∈ TreeMissingColors rho3 A := by + unfold TreeMissingColors at hcMissing ⊢ + obtain ⟨y, hyA, hcy⟩ := Finset.mem_biUnion.mp hcMissing + refine Finset.mem_biUnion.mpr ⟨y, hyA, ?_⟩ + rw [hd1.2 y (segmentVertexBefore hAseed hAlen hyA)] + exact hcy + let added : Fin B.length := + Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨attach, hattach⟩ := B.attaches added + let oldPosition : Fin (B.length + 1) := + Fin.castLT attach + (Nat.lt_trans attach.isLt (Nat.succ_lt_succ added.isLt)) + have holdValue : oldPosition.val < A.length + 1 := by + dsimp [oldPosition, added] + omega + let oldA : Fin (A.length + 1) := + ⟨oldPosition.val, holdValue⟩ + have holdEq : B.vertex oldPosition = A.vertex oldA := by + have hcast : Fin.castLE (Nat.succ_le_succ hAB.1) oldA = + oldPosition := by apply Fin.ext; rfl + rw [← hcast] + exact hAB.2.1 oldA + have holdBefore : B.vertex oldPosition ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v + hterminalJ := by + rw [holdEq] + exact segmentVertexBefore hAseed hAlen + (by simp [TreeSequenceVertexSet]) + have holdIncident : Incident G (B.vertex oldPosition) + (B.edge added) := by + unfold Incident + rw [hattach] + simp [oldPosition] + have haddedFixed : rho3 (B.edge added) = + ett.series.data.coloring jSlot.castSucc (B.edge added) := by + apply hd1.1 (B.edge added) + ⟨B.vertex oldPosition, holdBefore, holdIncident⟩ + refine ⟨c, Finset.mem_union_left _ ?_, hcolor⟩ + unfold TreeMissingColors at hcMissing + obtain ⟨y, hyA, hcy⟩ := Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨y, segmentVertexBefore hAseed hAlen hyA, hcy⟩ + exact ⟨hlen, hAB, c, haddedFixed.trans hcolor, hcMissingRho⟩ + +private theorem helper_branch_6698.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (v : + V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 + : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc)) (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let _ : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))), + ∀ u0 ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), + ∀ (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) (zPosition0 + : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : + PartialEdgeColoring E k) (_ : Fin (TjPrime.length + (1 : ℕ))) (hzPositionPositive : (1 : + ℕ) ≤ (↑zPosition0 : ℕ)) (hzPositionBound : (↑zPosition0 : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length), + let Z : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑zPosition0 : ℕ) hzPositionPositive hzPositionBound; TreeSequenceInitialSegment Z + (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (C : TreeSequence G e0), u0 ∈ TreeSequenceVertexSet C → TreeSequenceVertexSet Z ⊆ + TreeSequenceVertexSet C → KTriple G k e0 input → ett.series.data.tree (1 : Fin (ett.rounds + + (2 : ℕ))) = ett.series.data.tree jSlot.succ.castSucc → KTriple G k e0 rho3 → + TashkinovTree G e0 rho3 C → zPosition0 = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length → False := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot vertexTransfer trace p0 indices0 gamma0 delta0 + rho1 terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj hTjQ + TjPrime H C x componentPath u exitPath zPosition u0 huOutside0 exitPath0 zPosition0 rho3 + uPosition hzPositionPositive hzPositionBound Z hZTj C huC hZC triple htreeOne htripleRho + hCTree hzLast + have hZlen : Z.length = + (ett.series.data.tree jSlot.succ.castSucc).length := by + simp [Z, TreeSequencePrefix, hzLast] + have hTjZ : TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) ⊆ + TreeSequenceVertexSet Z := by + intro y hy + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hy ⊢ + obtain ⟨i, rfl⟩ := hy + let iZ : Fin (Z.length + 1) := ⟨i.val, by omega⟩ + refine ⟨iZ, ?_⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hZTj.1) iZ = + i := by apply Fin.ext; rfl + rw [← hcast] + exact hZTj.2.1 iZ + have hTjC : TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) ⊆ + TreeSequenceVertexSet C := fun _ hy => hZC (hTjZ hy) + have hstrict : TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) < + TreeSequenceVertexSet C := + Finset.ssubset_iff_subset_ne.mpr ⟨hTjC, by + intro heq + exact huOutside0 + (vertexTransfer hTjQ (heq.symm.subset huC))⟩ + have hk : ChromaticIndex G - 1 = k := by + have hchromatic := triple.2.1 + omega + have hCOrder : (TreeSequenceVertexSet C).card ≤ + TashkinovOrder G := by + unfold TashkinovOrder + dsimp only + apply Finset.le_max' + apply Finset.mem_insert_of_mem + simp only [Finset.mem_filter, Finset.mem_range] + refine ⟨Nat.lt_succ_of_le (Finset.card_le_univ _), ?_⟩ + rw [hk] + exact ⟨e0, rho3, C, htripleRho, hCTree, rfl⟩ + have hTjOrder : (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).card = + TashkinovOrder G := by + rw [← htreeOne] + exact hMP.1 + have hbound : (TreeSequenceVertexSet C).card ≤ + (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).card := by + rw [hTjOrder] + exact hCOrder + exact (Nat.not_lt_of_ge hbound) + (Finset.card_lt_card hstrict) + +private theorem helper_branch_6749.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : seed.vertex (Fin.last seed.length) = v) (_ : delta ∈ MissingColors G rho1 v), + let _ : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (beta0 : Fin k) (z0 : V) (zPosition0 : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (_ : (ett.series.data.tree + jSlot.succ.castSucc).vertex zPosition0 = z0) (rho3 : PartialEdgeColoring E k) (_ : ( + ∀ (_ : beta0 ∈ MissingColors G rho1 z0), delta ∈ MissingColors G rho3 z0)) (_ : ¬z0 = v) + (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition0 : ℕ)) (hzPositionBound : (↑zPosition0 : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let Z : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑zPosition0 : ℕ) hzPositionPositive hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed Z) (_ : MissingColors G rho3 v = MissingColors G rho1 + v) (C : TreeSequence G e0) (_ : TreeSequenceVertexSet Z ⊆ TreeSequenceVertexSet C) (_ : + ColoredVertexSetElementary G rho3 (TreeSequenceVertexSet C)) (_ : (↑zPosition0 : ℕ) < + (↑(Fin.last (ett.series.data.tree jSlot.succ.castSucc).length) : ℕ) ∧ beta0 ∈ + MissingColors G rho1 z0), False := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed hseedTerminal hdeltaMissing C beta0 + z0 zPosition0 hzPosition0 rho3 hdeltaZ hzv hzPositionPositive hzPositionBound Z hseedZ + hterminalMissingEq C hZC hCElementary hzEarlier + have hterminalC : v ∈ TreeSequenceVertexSet C := by + apply hZC + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + let vZ : Fin (Z.length + 1) := + Fin.castLE (Nat.succ_le_succ hseedZ.1) + (Fin.last seed.length) + refine ⟨vZ, ?_⟩ + exact (hseedZ.2.1 (Fin.last seed.length)).trans + hseedTerminal + have hzZ : z0 ∈ TreeSequenceVertexSet Z := by + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + refine ⟨Fin.last Z.length, ?_⟩ + change (ett.series.data.tree + jSlot.succ.castSucc).vertex + (Fin.castLE (Nat.succ_le_succ hzPositionBound) + (Fin.last zPosition0.val)) = z0 + have hindex : Fin.castLE + (Nat.succ_le_succ hzPositionBound) + (Fin.last zPosition0.val) = zPosition0 := by + apply Fin.ext + rfl + rw [hindex] + exact hzPosition0 + have hzC : z0 ∈ TreeSequenceVertexSet C := hZC hzZ + have hdeltaTerminal : delta ∈ MissingColors G rho3 v := by + rw [hterminalMissingEq] + exact hdeltaMissing + have hdeltaAtZ : delta ∈ MissingColors G rho3 z0 := + hdeltaZ hzEarlier.2 + have hdisjoint := hCElementary hterminalC hzC + (fun hvz => hzv hvz.symm) + exact (Finset.disjoint_left.mp hdisjoint) + hdeltaTerminal hdeltaAtZ + +end GoldbergSeymour diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean b/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean new file mode 100644 index 0000000000..853a906141 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean @@ -0,0 +1,6108 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseBranchPreparation +import all LeanPool.GoldbergSeymour.ExtensionBaseBranchPreparation + +import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary + +public import LeanPool.GoldbergSeymour.ExtensionBaseStepLemmas + +/-! +# Preparatory lemmas for the extension base + +Part of Wesley Pegden’s Trellis formalization of the Goldberg–Seymour theorem, +commit 88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. These lemmas establish the +base cases used by the extension construction. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ExtensionBaseProof + +theorem helper_hseedBeforeU_7025.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0), + TreeSequenceInitialSegment seed TjPrime → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 → + u0 ∉ TreeSequenceVertexSet seed → + seed.length < (↑uPosition : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed TjPrime hseedPrime H + x componentPath u exitPath zPosition u0 exitPath0 zPosition0 uPosition huPosition huNotSeed + exact @helper_hseedBeforeU_3367 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@hseedPrime) (@x) (@componentPath) (@u) + (@exitPath) (@zPosition) (@u0) (@exitPath0) (@zPosition0) (@uPosition) (@huPosition) + (@huNotSeed) + +theorem helper_hvBeforePrime_7074.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + seed.vertex (Fin.last seed.length) = v → + ∀ (TjPrime : TreeSequence G e0), + TreeSequenceInitialSegment seed TjPrime → + v ∈ TreeSequenceVertexSet seed → + ∀ (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 → + seed.length < (↑uPosition : ℕ) → + v ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot vertexTransfer terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTerminal TjPrime hseedPrime hterminalSeed u0 huPrime0 + uPosition huPosition hseedBeforeU + exact @helper_hvBeforePrime_3939 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTerminal) (@TjPrime) + (@hseedPrime) (@hterminalSeed) (@u0) (@huPrime0) (@uPosition) (@huPosition) + (@hseedBeforeU) + +theorem helper_hUsegmentVertexBefore_7104.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + TreeSequenceInitialSegment U TjPrime → + (∀ (i : Fin (TjPrime.length + (1 : ℕ))), + (↑i : ℕ) < (↑uPosition : ℕ) → + TjPrime.vertex i ∈ TreeVerticesBefore TjPrime u0 huPrime0) → + ∀ {A : TreeSequence G e0}, + TreeSequenceInitialSegment A U → + A.length < U.length → + ∀ {y : V}, + y ∈ TreeSequenceVertexSet A → + y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition + huPositionPositive huPositionBound U hUPrime hprimeVertexBefore A hAU hAlen y hyA + exact @helper_hUsegmentVertexBefore_5198 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) + (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@hUPrime) (@hprimeVertexBefore) (@A) (@hAU) (@hAlen) (@y) (@hyA) + +theorem helper_hbeforePrimeNeU_7117.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : Fin (TjPrime.length + (1 : ℕ))) {y : V}, + y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → + y ≠ u0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition y hy + exact @helper_hbeforePrimeNeU_3983 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@huPrime0) (@exitPath0) + (@zPosition0) (@uPosition) (@y) (@hy) + +theorem helper_hbeforePrimeMissing_7126.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (rho3 : PartialEdgeColoring E k), + (∀ + y ∈ + ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ + ({ z0 } : Finset V) ∪ + (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase + z0, + MissingColors G rho3 y = MissingColors G rho1 y) → + (z0 ∈ TreeVerticesBefore TjPrime u0 huPrime0 → + MissingColors G rho3 z0 = MissingColors G rho1 z0) → + (∀ {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0) → + ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, + MissingColors G rho3 y = MissingColors G rho1 y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hd2z + hbeforePrimeNeU y hy + exact @helper_hbeforePrimeMissing_3991 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@TjPrime) (@u0) (@huPrime0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hd2z) + (@hbeforePrimeNeU) (@y) (@hy) + +theorem helper_transportUStep_7134.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (rho3 : PartialEdgeColoring E k), + (∀ (f : E), + ((∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + seed.length ≤ (↑a : ℕ) ∧ + (↑a : ℕ) < (↑zPosition0 : ℕ) ∧ + (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 ∧ + (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → + rho3 f = rho1 f) → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 → + ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + TreeSequenceInitialSegment U TjPrime → + (∀ {A : TreeSequence G e0}, + TreeSequenceInitialSegment A U → + A.length < U.length → + ∀ {y : V}, + y ∈ TreeSequenceVertexSet A → y ∈ TreeVerticesBefore TjPrime u0 huPrime0) → + (∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, + MissingColors G rho3 y = MissingColors G rho1 y) → + ∀ {A B : TreeSequence G e0}, + TashkinovAugmentation rho1 A B → + TreeSequenceInitialSegment B U → + TashkinovAugmentation rho3 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 rho3 hd2Edges uPosition + huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore + hbeforePrimeMissing A B hstep hBU + exact @helper_transportUStep_5236 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@segmentTrans) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@huPrime0) (@exitPath0) + (@zPosition0) (@rho3) (@hd2Edges) (@uPosition) (@huPosition) (@huPositionPositive) + (@huPositionBound) (@hUPrime) (@hUsegmentVertexBefore) (@hbeforePrimeMissing) (@A) + (@B) (@hstep) (@hBU) + +theorem helper_segmentVertexBefore_7192.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + (∀ (i : Fin (seed.length + (1 : ℕ))), + (↑i : ℕ) < seed.length → + seed.vertex i ∈ + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ) → + ∀ {A : TreeSequence G e0}, + TreeSequenceInitialSegment A seed → + A.length < seed.length → + ∀ {y : V}, + y ∈ TreeSequenceVertexSet A → + y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hterminalJ terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedVertexBefore A hAseed hAlen y hyA + exact @helper_segmentVertexBefore_4061 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hterminalJ) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hseedVertexBefore) (@A) (@hAseed) (@hAlen) (@y) (@hyA) + +theorem helper_transportSeedRoute_7209.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (rho3 : PartialEdgeColoring E k), + (∀ {A B : TreeSequence G e0}, + TashkinovAugmentation (ett.series.data.coloring jSlot.castSucc) A B → + TreeSequenceInitialSegment B seed → TashkinovAugmentation rho3 A B) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) S seed → + TashkinovAugmentationSequence rho3 S seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + rho3 transportSeedStep S hroute + exact @helper_transportSeedRoute_4083 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@rho3) (@transportSeedStep) + (@S) (@hroute) + +theorem helper_hzChoiceForContradiction_7230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (beta0 : Fin k) (z0 : V) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + ((seed.length < (↑zPosition0 : ℕ) ∧ + beta0 ∈ MissingColors G rho1 z0 ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + seed.length < (↑r : ℕ) → + (↑r : ℕ) < (↑zPosition0 : ℕ) → + beta0 ∉ + MissingColors G rho1 + ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∨ + zPosition0 = Fin.last (ett.series.data.tree jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + seed.length < (↑r : ℕ) → + beta0 ∉ + MissingColors G rho1 + ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) → + zPosition0 = Fin.last (ett.series.data.tree jSlot.succ.castSucc).length ∨ + (↑zPosition0 : ℕ) < + (↑(Fin.last (ett.series.data.tree jSlot.succ.castSucc).length) : ℕ) ∧ + beta0 ∈ MissingColors G rho1 z0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 terminalPosition hterminalPositionPositive + hterminalPositionBound seed beta0 z0 zPosition0 hzChoice0 + exact @helper_hzChoiceForContradiction_4107 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@beta0) + (@z0) (@zPosition0) (@hzChoice0) + +theorem helper_hUsegmentVertexBefore_7424.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + TreeSequenceInitialSegment U TjPrime → + (∀ (i : Fin (TjPrime.length + (1 : ℕ))), + (↑i : ℕ) < (↑uPosition : ℕ) → + TjPrime.vertex i ∈ TreeVerticesBefore TjPrime u0 huPrime0) → + ∀ {A : TreeSequence G e0}, + TreeSequenceInitialSegment A U → + A.length < U.length → + ∀ {y : V}, + y ∈ TreeSequenceVertexSet A → + y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition + huPositionPositive huPositionBound U hUPrime hprimeVertexBefore A hAU hAlen y hyA + exact @helper_hUsegmentVertexBefore_6032 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) + (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@hUPrime) (@hprimeVertexBefore) (@A) (@hAU) (@hAlen) (@y) (@hyA) + +theorem helper_hbeforePrimeNeU_7437.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : Fin (TjPrime.length + (1 : ℕ))) {y : V}, + y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → + y ≠ u0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition y hy + exact @helper_hbeforePrimeNeU_4309 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) + (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) (@y) (@hy) + +theorem helper_hbeforePrimeMissing_7447.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (rho3 : PartialEdgeColoring E k), + (∀ + y ∈ + ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ + ({ z0 } : Finset V) ∪ + (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase + z0, + MissingColors G rho3 y = MissingColors G rho1 y) → + (z0 ∈ TreeVerticesBefore TjPrime u0 huPrime0 → + MissingColors G rho3 z0 = MissingColors G rho1 z0) → + (∀ {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0) → + ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, + MissingColors G rho3 y = MissingColors G rho1 y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hd2z + hbeforePrimeNeU y hy + exact @helper_hbeforePrimeMissing_4318 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@v) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@TjPrime) (@u0) (@huPrime0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hd2z) + (@hbeforePrimeNeU) (@y) (@hy) + +theorem helper_transportUStep_7455.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (rho3 : PartialEdgeColoring E k), + (∀ (f : E), + ((∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + seed.length ≤ (↑a : ℕ) ∧ + (↑a : ℕ) < (↑zPosition0 : ℕ) ∧ + (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 ∧ + (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → + rho3 f = rho1 f) → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 → + ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + TreeSequenceInitialSegment U TjPrime → + (∀ {A : TreeSequence G e0}, + TreeSequenceInitialSegment A U → + A.length < U.length → + ∀ {y : V}, + y ∈ TreeSequenceVertexSet A → y ∈ TreeVerticesBefore TjPrime u0 huPrime0) → + (∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, + MissingColors G rho3 y = MissingColors G rho1 y) → + ∀ {A B : TreeSequence G e0}, + TashkinovAugmentation rho1 A B → + TreeSequenceInitialSegment B U → + TashkinovAugmentation rho3 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 rho3 hd2Edges uPosition + huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore + hbeforePrimeMissing A B hstep hBU + exact @helper_transportUStep_6071 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@segmentTrans) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) + (@huPrime0) (@exitPath0) (@zPosition0) (@rho3) (@hd2Edges) (@uPosition) + (@huPosition) (@huPositionPositive) (@huPositionBound) (@hUPrime) + (@hUsegmentVertexBefore) (@hbeforePrimeMissing) (@A) (@B) (@hstep) (@hBU) + +theorem helper_hterminalMissingEq_7478.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (rho3 : PartialEdgeColoring E k), + (∀ + y ∈ + ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ + ({ z0 } : Finset V) ∪ + (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase + z0, + MissingColors G rho3 y = MissingColors G rho1 y) → + ¬z0 = v → + v ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 → + v ≠ u0 → + MissingColors G rho3 v = MissingColors G rho1 v := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hzv + hterminalBeforeZ hterminalNeU + exact @helper_hterminalMissingEq_4347 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@v) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@TjPrime) (@u0) (@huPrime0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hzv) + (@hterminalBeforeZ) (@hterminalNeU) + +theorem helper_hbeforeZData_7492.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : Fin (TjPrime.length + (1 : ℕ))) {y : V}, + y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 → + y ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∧ y ≠ z0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 exitPath0 z0 hz0 zPosition0 uPosition y hy + exact @helper_hbeforeZData_4365 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@exitPath0) (@z0) (@hz0) + (@zPosition0) (@uPosition) (@y) (@hy) + +theorem helper_hbeforeZMissing_7504.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + (∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = + MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0) (u0 : V) + (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime), + u0 ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) → + ∀ (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (rho3 : PartialEdgeColoring E k), + (∀ + y ∈ + ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ + ({ z0 } : Finset V) ∪ + (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase + z0, + MissingColors G rho3 y = MissingColors G rho1 y) → + (∀ {y : V}, + y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 → + y ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∧ y ≠ z0) → + ∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0, + y ≠ v → + MissingColors G rho3 y = MissingColors G (ett.series.data.coloring jSlot.castSucc) y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot vertexTransfer trace rho1 hb2Missing hTjQ TjPrime u0 + huPrime0 huOutside0 z0 hz0 rho3 hd2Missing hbeforeZData y hy hyTerminal + exact @helper_hbeforeZMissing_3860 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@v) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@vertexTransfer) (@trace) (@hb2Missing) (@hTjQ) (@TjPrime) (@u0) (@huPrime0) + (@huOutside0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hbeforeZData) (@y) (@hy) + (@hyTerminal) + +theorem helper_prefixPrefix_7534.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : Fin (TjPrime.length + (1 : ℕ))) (A : TreeSequence G e0) (q0 : ℕ) + (hq0 : (1 : ℕ) ≤ q0) (hqA : q0 + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment + (TreeSequencePrefix A q0 hq0 (Nat.le_trans (Nat.le_succ q0) hqA)) + (TreeSequencePrefix A (q0 + (1 : ℕ)) (by omega) hqA) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 exitPath0 zPosition0 uPosition A q0 hq0 hqA + exact @helper_prefixPrefix_4416 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) + (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@exitPath0) + (@zPosition0) (@uPosition) (@A) (@q0) (@hq0) (@hqA) + +theorem helper_hrightOutside_7601.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (_ : V ⊕ E) (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length) + (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition0 : ℕ)) + (hzPositionBound : + (↑zPosition0 : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + let Z : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑zPosition0 : ℕ) + hzPositionPositive hzPositionBound; + ∀ (M : TreeSequence G e0), + TreeSequenceInitialSegment U M → + ∀ (n : ℕ), + U.length ≤ n → + ∀ (hnM : n + (1 : ℕ) ≤ M.length), + let j : Fin M.length := + (⟨n, by + have := GoldbergSeymour.TreeSequence.positive M + omega⟩ : + Fin M.length); + ∀ (i : Fin Z.length), + M.vertex j.succ = Z.vertex i.succ → + Z.vertex i.succ ∉ TreeSequenceVertexSet U := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H a + x componentPath u exitPath zPosition u0 exitPath0 zPosition0 uPosition huPositionPositive + huPositionBound hzPositionPositive hzPositionBound U Z M hleftSegment n hnU hnM j i hvertexMZ + exact @helper_hrightOutside_3985 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) + (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@a) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@exitPath0) + (@zPosition0) (@uPosition) (@huPositionPositive) (@huPositionBound) + (@hzPositionPositive) (@hzPositionBound) (@M) (@hleftSegment) (@n) (@hnU) + (@hnM) (@i) (@hvertexMZ) + +theorem helper_hXY_7786.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (TjPrime : TreeSequence G e0), + (∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + seed.length ≤ (↑a : ℕ) → + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) = + ett.series.data.coloring jSlot.castSucc + ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (rho3 : PartialEdgeColoring E k), + (∀ (f : E), + ((∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + seed.length ≤ (↑a : ℕ) ∧ + (↑a : ℕ) < (↑zPosition0 : ℕ) ∧ + (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 ∧ + (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → + rho3 f = rho1 f) → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length) + (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition0 : ℕ)) + (hzPositionBound : + (↑zPosition0 : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + let Z : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑zPosition0 : ℕ) + hzPositionPositive hzPositionBound; + TreeSequenceInitialSegment Z (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (M : TreeSequence G e0), + (∀ (A : TreeSequence G e0) (q0 : ℕ) (hq0 : (1 : ℕ) ≤ q0) + (hqA : q0 + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment + (TreeSequencePrefix A q0 hq0 (Nat.le_trans (Nat.le_succ q0) hqA)) + (TreeSequencePrefix A (q0 + (1 : ℕ)) (by omega) hqA)) → + ∀ (n : ℕ) (hnU : U.length ≤ n) (hnM hnSuccM : n + (1 : ℕ) ≤ M.length) + (hnM' : n ≤ M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + let Y : TreeSequence G e0 := TreeSequencePrefix M (n + (1 : ℕ)) (by omega) hnSuccM; + let j : Fin M.length := + (⟨n, by + have := GoldbergSeymour.TreeSequence.positive M + omega⟩ : + Fin M.length); + ∀ (i : Fin Z.length), + M.edge j = Z.edge i → + seed.length ≤ (↑i : ℕ) → + ∀ (c : Fin k), + ett.series.data.coloring jSlot.castSucc (Z.edge i) = some c → + c ∈ TreeMissingColors rho3 X → + TashkinovAugmentation rho3 X Y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime + hb2EdgesFromSeed H x componentPath u exitPath zPosition u0 exitPath0 zPosition0 rho3 + hd2Edges uPosition huPositionPositive huPositionBound hzPositionPositive hzPositionBound U + Z hZTj M prefixPrefix n hnU hnM hnSuccM hnM' X Y j i hedgeMZ hiSeed c hcolorZ hmissingX + exact @helper_hXY_6689 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) + (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@hb2EdgesFromSeed) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@exitPath0) + (@zPosition0) (@rho3) (@hd2Edges) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@hzPositionPositive) (@hzPositionBound) (@hZTj) (@M) + (@prefixPrefix) (@n) (@hnU) (@hnM) (@hnSuccM) (@hnM') (@i) (@hedgeMZ) + (@hiSeed) (@c) (@hcolorZ) (@hmissingX) + +theorem helper_caseContinuation_10294.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + (∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) + (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + seed.vertex (Fin.last seed.length) = v → + (∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A C → + TreeSequenceInitialSegment B C → + A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0), + indices0 (Fin.last p0) = q → + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) + (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + u ∉ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) → + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) + (traceB.coloring (Fin.last traceB.steps)) → + IsProperEdgeColoring G rho2 → + IsOneEdgeUncolored rho2 e0 → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + TashkinovAugmentationSequence rho2 seed U → + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ((0 : ℕ) < (↑jSlot : ℕ) → + TreeSequenceInitialSegment Tprevious (ett.series.data.tree jSlot.succ.castSucc)) → + ((0 : ℕ) < (↑jSlot : ℕ) → Tprevious.length < seed.length) → + ((0 : ℕ) < (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious seed) → + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + TreeSequenceInitialSegment seed Tj0 → + ∀ (M : TreeSequence G e0), + OrderedTreeUnion U Tj0 M → + u ∈ TreeSequenceVertexSet U → + TashkinovAugmentationSequence rho2 U M → + False := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower v sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot segmentTrans vertexTransfer trace hterminalJ + p0 indices0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj hseedTerminal commonPrefix TjPrime hqLast u b traceB huOutside rho2 c1 + hrho2Proper hrho2One uPosition huPositionPositive huPositionBound U hrouteRhoTwoU Tprevious + hpreviousTj hpreviousStrict hpreviousSeed Tj0 hseedTj0 M hunion huU hrouteUM + obtain ⟨C, hclosureMC⟩ := TashkinovClosureExists rho2 M + have hrouteUC : TashkinovAugmentationSequence rho2 U C := + Relation.ReflTransGen.trans hrouteUM hclosureMC.1 + have hrouteSeedC : TashkinovAugmentationSequence rho2 seed C := + Relation.ReflTransGen.trans hrouteRhoTwoU hrouteUC + have hclosedC : + ColoredVertexSetClosed G rho2 (TreeSequenceVertexSet C) := + hclosureMC.2 + have hseedVertexBeforeJ (i : Fin (seed.length + 1)) + (hi : i.val < seed.length) : + seed.vertex i ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ := by + exact @helper_hseedVertexBeforeJ_6180 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@hterminalJ) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) + (@hseedTerminal) (@i) (@hi) + have segmentVertexBeforeJ {A : TreeSequence G e0} + (hAseed : TreeSequenceInitialSegment A seed) + (hAlen : A.length < seed.length) {x : V} + (hxA : x ∈ TreeSequenceVertexSet A) : + x ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ := by + exact @helper_segmentVertexBeforeJ_6189 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hterminalJ) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@uPosition) (@hseedVertexBeforeJ) (@A) (@hAseed) (@hAlen) (@x) (@hxA) + have transportSeedStep2 {A B : TreeSequence G e0} + (hstep : TashkinovAugmentation + (ett.series.data.coloring jSlot.castSucc) A B) + (hBseed : TreeSequenceInitialSegment B seed) : + TashkinovAugmentation rho2 A B := by + exact @helper_transportSeedStep2_6201 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) (@trace) + (@hterminalJ) (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@u) (@b) (@traceB) (@c1) (@uPosition) + (@segmentVertexBeforeJ) (@A) (@B) (@hstep) (@hBseed) + have transportSeedRoute2 (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) S seed) : + TashkinovAugmentationSequence rho2 S seed := by + exact @helper_transportSeedRoute2_6212 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@u) (@b) + (@traceB) (@transportSeedStep2) (@S) (@hroute) + have huM : u ∈ TreeSequenceVertexSet M := by + rw [hunion.vertexSet] + exact Finset.mem_union_left _ huU + have hMCsegment : TreeSequenceInitialSegment M C := + TashkinovAugmentationSequenceInitialSegment rho2 M C hclosureMC.1 + have huC : u ∈ TreeSequenceVertexSet C := + vertexTransfer hMCsegment huM + have hTj0C : TreeSequenceVertexSet Tj0 ⊆ + TreeSequenceVertexSet C := by + intro x hx + apply vertexTransfer hMCsegment + rw [hunion.vertexSet] + exact Finset.mem_union_right _ hx + have hTj0StrictC : TreeSequenceVertexSet Tj0 < + TreeSequenceVertexSet C := + Finset.ssubset_iff_subset_ne.mpr ⟨hTj0C, by + intro heq + apply huOutside + have huTj0 : u ∈ TreeSequenceVertexSet Tj0 := heq.symm.subset huC + simpa [Tj0] using huTj0⟩ + by_cases hjPositive : 0 < jSlot.val + · exact @helper_branch_1756 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@hlower) (@v) + (@sigma) _ (by rfl) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) _ (by rfl) + (@hjSlot) (@segmentTrans) (@vertexTransfer) (@trace) (@hterminalJ) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@commonPrefix) (@TjPrime) (@hqLast) (@u) (@b) (@traceB) (@huOutside) (@c1) + (@hrho2Proper) (@hrho2One) (@uPosition) (@hpreviousTj) (@hpreviousStrict) (@hpreviousSeed) + (@C) (@hrouteSeedC) (@hclosedC) (@segmentVertexBeforeJ) (@transportSeedRoute2) (@huC) + (@hTj0StrictC) (@hjPositive) + · exact @helper_branch_6243 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@trace) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@commonPrefix) + (@TjPrime) (@u) (@b) (@traceB) (@hrho2Proper) (@hrho2One) (@uPosition) (@hseedTj0) (@C) + (@hrouteSeedC) (@transportSeedRoute2) (@hTj0StrictC) (@hjPositive) + +theorem helper_caseContinuation_11664.{u_1, u_2} : + helperCaseContinuation11664Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive v gamma delta sigma this q + hqTerminal hvFinal hfirstUpper hfirstPositive jSlot segmentTrans vertexTransfer trace + hterminalJ p0 indices0 gamma0 delta0 rho1 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTj hseedTerminal hTjQ hseedVertexBefore + segmentVertexBefore transportSeedRoute commonPrefix TjPrime hdeltaMissing H C a x + componentPath u exitPath zPosition u0 huOutside0 exitPath0 beta0 z0 zPosition0 hzPosition0 + rho3 hrho3Proper hrho3One hd1 hdeltaZ uPosition terminalInTj hterminalInTj hzv + hzChoiceForContradiction hjZero huPositionPositive huPositionBound hzPositionPositive + hzPositionBound U Z hZTj hseedZ hrouteRhoThreeU hterminalMissingEq M hunion huU hrouteUM + obtain ⟨C, hclosureMC⟩ := TashkinovClosureExists rho3 M + have hrouteUC : TashkinovAugmentationSequence rho3 U C := + Relation.ReflTransGen.trans hrouteUM hclosureMC.1 + have hrouteSeedC : TashkinovAugmentationSequence rho3 seed C := + Relation.ReflTransGen.trans hrouteRhoThreeU hrouteUC + have hMCsegment : TreeSequenceInitialSegment M C := + TashkinovAugmentationSequenceInitialSegment rho3 M C hclosureMC.1 + have huC : u0 ∈ TreeSequenceVertexSet C := by + apply vertexTransfer hMCsegment + rw [hunion.vertexSet] + exact Finset.mem_union_left _ huU + have hZC : TreeSequenceVertexSet Z ⊆ TreeSequenceVertexSet C := by + intro y hyZ + apply vertexTransfer hMCsegment + rw [hunion.vertexSet] + exact Finset.mem_union_right _ hyZ + have hjIndex : jSlot.castSucc = + (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + exact hjZero + cases hcert : ett.series.certified + (0 : Fin (ett.rounds + 1)) with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have htreeOne : ett.series.data.tree 1 = + ett.series.data.tree jSlot.succ.castSucc := by + congr 1 + apply Fin.ext + simp [hjZero] + have hinitialTj : TreeSequenceInitialSegment + (ett.series.data.tree 0) + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := TashkinovAugmentationSequenceInitialSegment _ _ _ + initialClosure.1 + simpa [htreeOne] using h + have hinitialSeed : TreeSequenceInitialSegment + (ett.series.data.tree 0) seed := by + apply commonPrefix hinitialTj hseedTj + rw [seedLength] + exact seed.positive + have hroutePhiSeed : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree 0) seed := by + have hrestricted := TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring 0) (ett.series.data.tree 0) seed + (ett.series.data.tree jSlot.succ.castSucc) + (by simpa [htreeOne] using initialClosure.1) + hinitialSeed hseedTj + simpa [hjIndex] using hrestricted + have hseedVertexBefore (i : Fin (seed.length + 1)) + (hi : i.val < seed.length) : seed.vertex i ∈ + TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v + hterminalJ := by + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + let iTj : Fin + ((ett.series.data.tree + jSlot.succ.castSucc).length + 1) := + Fin.castLE (Nat.succ_le_succ hseedTj.1) i + exact ⟨vertexTransfer hseedTj (by simp [TreeSequenceVertexSet]), + iTj, terminalInTj, hseedTj.2.1 i, hterminalInTj, + by simpa [iTj, terminalInTj] using hi⟩ + have segmentVertexBefore {A : TreeSequence G e0} + (hAseed : TreeSequenceInitialSegment A seed) + (hAlen : A.length < seed.length) {y : V} + (hyA : y ∈ TreeSequenceVertexSet A) : y ∈ + TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v + hterminalJ := by + obtain ⟨hAseedLen, hAseedVertices, -⟩ := hAseed + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hyA + obtain ⟨i, rfl⟩ := hyA + rw [← hAseedVertices i] + apply hseedVertexBefore + change i.val < seed.length + exact lt_of_le_of_lt (Nat.lt_succ_iff.mp i.isLt) hAlen + have transportSeedStep {A B : TreeSequence G e0} + (hstep : TashkinovAugmentation + (ett.series.data.coloring jSlot.castSucc) A B) + (hBseed : TreeSequenceInitialSegment B seed) : + TashkinovAugmentation rho3 A B := by + exact @helper_transportSeedStep_6612 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@segmentTrans) (@trace) (@hterminalJ) (@p0) (@indices0) (@gamma0) (@delta0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) + (by assumption) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) + (@exitPath0) (@zPosition0) (@rho3) (@hd1) (@uPosition) (by assumption) (@A) (@B) + (@hstep) (@hBseed) + have transportSeedRoute (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) S seed) : + TashkinovAugmentationSequence rho3 S seed := by + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using + Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBseed ih => + have hBsegment : TreeSequenceInitialSegment B seed := + TashkinovAugmentationSequenceInitialSegment _ B seed + hBseed + exact Relation.ReflTransGen.head + (transportSeedStep hAB hBsegment) ih + have hrouteBaseC : TashkinovAugmentationSequence rho3 + (ett.series.data.tree 0) C := + Relation.ReflTransGen.trans + (transportSeedRoute (ett.series.data.tree 0) hroutePhiSeed) + hrouteSeedC + have htripleRho : KTriple G k e0 rho3 := + ⟨triple.1, triple.2.1, triple.2.2.1, + hrho3Proper, hrho3One⟩ + have hinitialTree : TashkinovTree G e0 rho3 + (ett.series.data.tree 0) := by + intro a ha + rw [seedLength] at a + omega + have hCTree : TashkinovTree G e0 rho3 C := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 rho3 + (ett.series.data.tree 0) C hinitialTree hrouteBaseC + have hCElementary : ColoredVertexSetElementary G rho3 + (TreeSequenceVertexSet C) := + TashTree G k e0 rho3 C htripleRho hCTree + rcases hzChoiceForContradiction with hzLast | hzEarlier + · exact @helper_branch_6698 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@vertexTransfer) (@trace) (@p0) (@indices0) (@gamma0) + (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@hTjQ) (@TjPrime) (@x) (@componentPath) + (@u) (@exitPath) (@zPosition) (@u0) (@huOutside0) (@exitPath0) (@zPosition0) + (@rho3) (@uPosition) (@hzPositionPositive) (@hzPositionBound) (@hZTj) (@C) + (@huC) (@hZC) (@triple) (@htreeOne) (@htripleRho) (@hCTree) (@hzLast) + · exact @helper_branch_6749 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTerminal) (@hdeltaMissing) (@beta0) (@z0) + (@zPosition0) (@hzPosition0) (@rho3) (@hdeltaZ) (@hzv) (@hzPositionPositive) + (@hzPositionBound) (@hseedZ) (@hterminalMissingEq) (@C) (@hZC) (@hCElementary) + (@hzEarlier) + +theorem helper_branch_13441.{u_1, u_2} : + helperBranch13441Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive v gamma delta sigma this q + hqTerminal hvFinal hfirstUpper hfirstPositive jSlot hjSlot segmentTrans vertexTransfer + trace hterminalJ p0 indices0 gamma0 delta0 rho1 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hjTreeIndex hseedTj hseedTerminal hTjQ hseedVertexBefore + segmentVertexBefore transportSeedRoute commonPrefix TjPrime hclosure hseedPrime hqLast + hterminalSeed H C a x componentPath u exitPath Tprevious hpreviousStrict hpreviousSeed + zPosition u0 huPrime0 huOutside0 exitPath0 beta0 z0 hz0 zPosition0 hzChoice0 rho3 + hrho3Proper hrho3One hd1 hd2Missing hd2Edges hd2z hbeta0Terminal uPosition huPosition + hseedBeforeU terminalInTj hterminalInTj hterminalInTjVal hzTerminalIff hzv + have hzLast : zPosition0 = Fin.last + (ett.series.data.tree jSlot.succ.castSucc).length := by + rcases hzChoice0 with hfirst | hlast + · exact False.elim (hbeta0Terminal (by simpa [hzv] using hfirst.2.1)) + · exact hlast.1 + have hseedFull : seed.length = + (ett.series.data.tree jSlot.succ.castSucc).length := by + have hterminalEq := hzTerminalIff.mp hzv + have hvals := congrArg Fin.val (hterminalEq.symm.trans hzLast) + simpa [hterminalInTjVal] using hvals + have hvBeforePrime : v ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by + exact @helper_hvBeforePrime_7074 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTerminal) (@TjPrime) + (@hseedPrime) (@hterminalSeed) (@u0) (@huPrime0) (@uPosition) (@huPosition) (@hseedBeforeU) + have huPositionPositive : 1 ≤ uPosition.val := + seed.positive.trans (Nat.le_of_lt hseedBeforeU) + have huPositionBound : uPosition.val ≤ TjPrime.length := + Nat.lt_succ_iff.mp uPosition.isLt + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime uPosition.val huPositionPositive + huPositionBound + have hUPrime : TreeSequenceInitialSegment U TjPrime := by + exact @helper_hUPrime_3958 (@V) (@E) (@G) (@e0) (@TjPrime) (@uPosition) + (@huPositionPositive) (@huPositionBound) + have hseedU : TreeSequenceInitialSegment seed U := by + apply commonPrefix hseedPrime hUPrime + exact Nat.le_of_lt hseedBeforeU + have hrouteRhoOneU : TashkinovAugmentationSequence rho1 seed U := + TashkinovAugmentationSequenceRestrict rho1 seed U TjPrime + hclosure.1 hseedU hUPrime + have hprimeVertexBefore (i : Fin (TjPrime.length + 1)) + (hi : i.val < uPosition.val) : + TjPrime.vertex i ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + refine ⟨by simp [TreeSequenceVertexSet], i, uPosition, rfl, + huPosition, hi⟩ + have hUsegmentVertexBefore {A : TreeSequence G e0} + (hAU : TreeSequenceInitialSegment A U) + (hAlen : A.length < U.length) {y : V} + (hyA : y ∈ TreeSequenceVertexSet A) : + y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by + exact @helper_hUsegmentVertexBefore_7104 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) + (@zPosition) (@u0) (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) + (@huPositionPositive) (@huPositionBound) (@hUPrime) (@hprimeVertexBefore) (@A) (@hAU) + (@hAlen) (@y) (@hyA) + have hbeforePrimeNeU {y : V} + (hy : y ∈ TreeVerticesBefore TjPrime u0 huPrime0) : y ≠ u0 := by + exact @helper_hbeforePrimeNeU_7117 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) + (@zPosition) (@u0) (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) (@y) (@hy) + have hbeforePrimeMissing (y : V) + (hy : y ∈ TreeVerticesBefore TjPrime u0 huPrime0) : + MissingColors G rho3 y = MissingColors G rho1 y := by + exact @helper_hbeforePrimeMissing_7126 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@TjPrime) (@u0) + (@huPrime0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hd2z) (@hbeforePrimeNeU) (@y) (@hy) + have transportUStep {A B : TreeSequence G e0} + (hstep : TashkinovAugmentation rho1 A B) + (hBU : TreeSequenceInitialSegment B U) : + TashkinovAugmentation rho3 A B := by + exact @helper_transportUStep_7134 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) + (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@huPrime0) (@exitPath0) + (@zPosition0) (@rho3) (@hd2Edges) (@uPosition) (@huPosition) (@huPositionPositive) + (@huPositionBound) (@hUPrime) (@hUsegmentVertexBefore) (@hbeforePrimeMissing) (@A) (@B) + (@hstep) (@hBU) + have transportURoute (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence rho1 S U) : + TashkinovAugmentationSequence rho3 S U := by + exact @helper_transportURoute_4006 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@sigma) (@hvFinal) + (@trace) (@TjPrime) (@rho3) (@uPosition) (@huPositionPositive) (@huPositionBound) + (@transportUStep) (@S) (@hroute) + have hrouteRhoThreeU : TashkinovAugmentationSequence rho3 seed U := + transportURoute seed hrouteRhoOneU + obtain ⟨C, hclosureUC⟩ := TashkinovClosureExists rho3 U + have hrouteSeedC : TashkinovAugmentationSequence rho3 seed C := + Relation.ReflTransGen.trans hrouteRhoThreeU hclosureUC.1 + have hseedC : TreeSequenceInitialSegment seed C := + TashkinovAugmentationSequenceInitialSegment rho3 seed C hrouteSeedC + have huU : u0 ∈ TreeSequenceVertexSet U := by + exact @helper_huU_4024 (@V) (@E) (@G) (@e0) (@TjPrime) (@u0) (@uPosition) (@huPosition) + (@huPositionPositive) (@huPositionBound) + have hUC : TreeSequenceInitialSegment U C := + TashkinovAugmentationSequenceInitialSegment rho3 U C hclosureUC.1 + have huC : u0 ∈ TreeSequenceVertexSet C := vertexTransfer hUC huU + have hTjC : TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) ⊆ + TreeSequenceVertexSet C := by + exact @helper_hTjC_5298 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@hseedFull) (@C) (@hseedC) + have hTjStrictC : TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) < + TreeSequenceVertexSet C := + Finset.ssubset_iff_subset_ne.mpr ⟨hTjC, by + intro heq + exact huOutside0 (vertexTransfer hTjQ (heq.symm.subset huC))⟩ + have hseedVertexBefore (i : Fin (seed.length + 1)) + (hi : i.val < seed.length) : + seed.vertex i ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ := by + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + let iTj : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1) := + Fin.castLE (Nat.succ_le_succ hseedTj.1) i + refine ⟨vertexTransfer hseedTj (by simp [TreeSequenceVertexSet]), + iTj, terminalInTj, hseedTj.2.1 i, hterminalInTj, ?_⟩ + simpa [iTj, terminalInTj] using hi + have segmentVertexBefore {A : TreeSequence G e0} + (hAseed : TreeSequenceInitialSegment A seed) + (hAlen : A.length < seed.length) {y : V} + (hyA : y ∈ TreeSequenceVertexSet A) : + y ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ := by + exact @helper_segmentVertexBefore_7192 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hterminalJ) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedVertexBefore) (@A) + (@hAseed) (@hAlen) (@y) (@hyA) + have transportSeedStep {A B : TreeSequence G e0} + (hstep : TashkinovAugmentation + (ett.series.data.coloring jSlot.castSucc) A B) + (hBseed : TreeSequenceInitialSegment B seed) : + TashkinovAugmentation rho3 A B := by + exact @helper_transportSeedStep_5350 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) + (@trace) (@hterminalJ) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (by assumption) + (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@exitPath0) + (@zPosition0) (@rho3) (@hd1) (@uPosition) (by assumption) (@A) (@B) (@hstep) (@hBseed) + have transportSeedRoute (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) S seed) : + TashkinovAugmentationSequence rho3 S seed := by + exact @helper_transportSeedRoute_7209 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@rho3) (@transportSeedStep) (@S) + (@hroute) + by_cases hjPositive : 0 < jSlot.val + · exact @helper_branch_2914 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@v) (@gamma) (@delta) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@trace) (@hterminalJ) + (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (by assumption) (by assumption) + (@commonPrefix) (@TjPrime) (@hqLast) (@x) (@componentPath) (@u) (@exitPath) + (@hpreviousStrict) (@hpreviousSeed) (@zPosition) (@u0) (@exitPath0) (@zPosition0) (@rho3) + (@hrho3Proper) (@hrho3One) (@hd1) (@uPosition) (@huPositionPositive) (@huPositionBound) + (@C) (@hclosureUC) (@hrouteSeedC) (@hTjStrictC) (@segmentVertexBefore) + (@transportSeedRoute) (@hjPositive) + · exact @helper_branch_5609 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@v) (@gamma) (@delta) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) + (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (by assumption) (@commonPrefix) (@TjPrime) (@a) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@exitPath0) (@zPosition0) (@rho3) + (@hrho3Proper) (@hrho3One) (@uPosition) (@C) (@hrouteSeedC) (@hTjStrictC) (by assumption) + (@hjPositive) + +private theorem helper_hTpreviousBefore_6081.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ + (_ : + ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B) + (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ + (hseedTj : + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ + (_ : + (0 : ℕ) < (↑jSlot : ℕ) → + TreeSequenceInitialSegment Tprevious (ett.series.data.tree jSlot.succ.castSucc)) + (_ : (0 : ℕ) < (↑jSlot : ℕ) → Tprevious.length < seed.length) + (_ : (0 : ℕ) < (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious seed), + let terminalInTj : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ)) := + Fin.castLE + (by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt terminalPosition + have := hseedTj.1 + have := + GoldbergSeymour.TreeSequence.positive + (TreeSequencePrefix + (ett.series.data.tree + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds).succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive + hterminalPositionBound) + have := + GoldbergSeymour.TreeSequence.positive + (ett.series.data.tree + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds).succ.castSucc) + all_goals omega)) + (Fin.last seed.length); + ∀ (_ : (ett.series.data.tree jSlot.succ.castSucc).vertex terminalInTj = v) + (_ : (0 : ℕ) < (↑jSlot : ℕ)), + TreeSequenceVertexSet Tprevious ⊆ + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot vertexTransfer hterminalJ terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTj Tprevious hpreviousTj hpreviousStrict hpreviousSeed + terminalInTj hterminalInTj hjPositive y hy + obtain ⟨i, rfl⟩ := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] using hy + have hprevSeed := hpreviousSeed hjPositive + let iSeed : Fin (seed.length + 1) := + Fin.castLE (Nat.succ_le_succ hprevSeed.1) i + let iTj : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1) := + Fin.castLE (Nat.succ_le_succ hseedTj.1) iSeed + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + refine ⟨?_, iTj, terminalInTj, ?_, hterminalInTj, ?_⟩ + · exact vertexTransfer (hpreviousTj hjPositive) + (by simp [TreeSequenceVertexSet]) + · exact (hseedTj.2.1 iSeed).trans (hprevSeed.2.1 i) + · change i.val < seed.length + exact lt_of_le_of_lt (Nat.lt_succ_iff.mp i.isLt) + (hpreviousStrict hjPositive) + +private theorem helper_hseedBuild_6103.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hjSlot : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) + (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) + (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (_ : + ∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A C → + TreeSequenceInitialSegment B C → + A.length ≤ B.length → TreeSequenceInitialSegment A B) + (TjPrime : TreeSequence G e0) (hqLast : indices0 (Fin.last p0) = q), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ) → Tprevious.length < seed.length) + (_ : (0 : ℕ) < (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious seed) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : Fin (TjPrime.length + (1 : ℕ))) (_ : (0 : ℕ) < (↑jSlot : ℕ)) + (lower : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (⟨(↑jSlot : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.coloring + (⟨(↑jSlot : ℕ), by + omega⟩ : + Fin (ett.rounds + (1 : ℕ))))) + (_ : lower.rounds = (↑jSlot : ℕ)), + ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) Tprevious + seed ∨ + (ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + ett.series.data.connectingEdges jSlot.castSucc = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) + adjoinSeed seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj + commonPrefix TjPrime hqLast H x componentPath u exitPath Tprevious hpreviousStrict + hpreviousSeed zPosition u0 exitPath0 zPosition0 uPosition hjPositive lower hround + exact @helper_hseedBuild_3505 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@hjSlot) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) + (@commonPrefix) (@TjPrime) (@hqLast) (@x) (@componentPath) (@u) (@exitPath) + (@hpreviousStrict) (@hpreviousSeed) (@zPosition) (@u0) (@exitPath0) (@zPosition0) + (@uPosition) (@hjPositive) (@lower) (@hround) + +private theorem helper_hLowerI_6128.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hjSlot : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (TjPrime : TreeSequence G e0) (hqLast : indices0 (Fin.last p0) = q) (_ _ : V ⊕ E) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (rho3 : PartialEdgeColoring E k) (_ : Fin (TjPrime.length + (1 : ℕ))) + (lower : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (⟨(↑jSlot : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.coloring + (⟨(↑jSlot : ℕ), by + omega⟩ : + Fin (ett.rounds + (1 : ℕ))))) + (_ : lower.rounds = (↑jSlot : ℕ)) (Tstar : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 lower rho3 Tstar), + MaximumProperty corr.replacementETT → + ColoredVertexSetElementary G rho3 (TreeSequenceVertexSet Tstar) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive hlower v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hjSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTj TjPrime hqLast a b zPosition0 rho3 uPosition lower hround + _ corr hcorrMP + have hcorrRounds : corr.replacementETT.rounds = jSlot.val := + corr.rungAgreement.trans hround + have hpackCorr := hlower corr.replacementETT + corr.replacementETT.roundsPositive (by omega) hcorrMP + unfold ColoredVertexSetElementary + intro a ha b hb hab + exact hpackCorr.1 ha hb hab + +private theorem helper_hLowerVI_6142.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ + (lower : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (⟨(↑jSlot : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.coloring + (⟨(↑jSlot : ℕ), by + omega⟩ : + Fin (ett.rounds + (1 : ℕ))))), + let nLower : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + ∀ (_ : lower.series.data.tree nLower.castSucc = Tprevious) + (_ : + lower.series.data.coloring nLower = ett.series.data.coloring jSlot.castSucc) + (_ : + TashkinovStoredColors lower.series.data nLower = + TashkinovStoredColors ett.series.data jSlot.castSucc) + (_ : LowerRoundProperties lower) (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tprevious (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) sigma → + ModColoring lower sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot Tprevious lower nLower hLowerTree hLowerColor hLowerStored hLowerPack + sigma0 hsigma0Proper hsigma0One hsigma0Stable + apply hLowerPack.2.2.2.2.2 sigma0 hsigma0Proper hsigma0One + change StableColoring (lower.series.data.tree nLower.castSucc) + (TashkinovStoredColors lower.series.data nLower) + (lower.series.data.coloring nLower) sigma0 + rw [hLowerTree, hLowerStored, hLowerColor] + exact hsigma0Stable + +private theorem helper_branch_6176.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hjSlot : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (hseedTj : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (TjPrime : TreeSequence G e0) (hseedPrime : TreeSequenceInitialSegment seed TjPrime) + (hqLast : indices0 (Fin.last p0) = q) (u0 : V) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (_ : TjPrime.vertex uPosition = u0) + (_ : seed.length < (↑uPosition : ℕ)), + let terminalInTj : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ)) := + Fin.castLE + (by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt terminalPosition + have := hseedTj.1 + have := hseedPrime.1 + have := + GoldbergSeymour.TreeSequence.positive + (TreeSequencePrefix + (ett.series.data.tree + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds).succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive + hterminalPositionBound) + have := + GoldbergSeymour.TreeSequence.positive + (ett.series.data.tree + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds).succ.castSucc) + all_goals omega)) + (Fin.last seed.length); + ∀ (_ : (↑terminalInTj : ℕ) = seed.length) + (lower : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (⟨(↑jSlot : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.coloring + (⟨(↑jSlot : ℕ), by + omega⟩ : + Fin (ett.rounds + (1 : ℕ))))) + (_ : lower.rounds = (↑jSlot : ℕ)) + (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length) + (_ : (↑a : ℕ) < (↑zPosition0 : ℕ)), + (∃ (a_1 : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + seed.length ≤ (↑a_1 : ℕ) ∧ + (↑a_1 : ℕ) < (↑zPosition0 : ℕ) ∧ + (ett.series.data.tree jSlot.succ.castSucc).edge a_1 = + (ett.series.data.tree jSlot.succ.castSucc).edge a) ∨ + ∃ (a_1 : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 ∧ + (↑a_1 : ℕ) < (↑uPosition : ℕ) ∧ + TjPrime.edge a_1 = (ett.series.data.tree jSlot.succ.castSucc).edge a := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hjSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTj TjPrime hseedPrime hqLast u0 zPosition0 uPosition + huPosition hseedBeforeU terminalInTj hterminalInTjVal lower hround a ha + by_cases haseed : seed.length ≤ a.val + · exact Or.inl ⟨a, haseed, ha, rfl⟩ + · apply Or.inr + let aSeed : Fin seed.length := ⟨a.val, by omega⟩ + let aPrime : Fin TjPrime.length := + Fin.castLE hseedPrime.1 aSeed + refine ⟨aPrime, uPosition, huPosition, ?_, ?_⟩ + · change a.val < uPosition.val + omega + · have haCast : Fin.castLE hseedTj.1 aSeed = a := by + apply Fin.ext + rfl + exact (hseedPrime.2.2 aSeed).trans + ((hseedTj.2.2 aSeed).symm.trans + (congrArg + (ett.series.data.tree + jSlot.succ.castSucc).edge haCast)) + +theorem helper_branch_13578.{u_1, u_2} : + helperBranch13578Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma this q + hqTerminal hvFinal hfirstUpper hfirstPositive jSlot hjSlot vertexTransfer trace hterminalJ + p0 indices0 gamma0 delta0 rho1 hb2Missing hb2TreeEdges terminalPosition + hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj hseedTerminal + hTjQ commonPrefix TjPrime hclosure hprimeElementary hseedPrime hqLast gammaFirst + hterminalInclusion hdeltaMissing H a b x componentPath u exitPath Tprevious hpreviousTj + hpreviousStrict hpreviousSeed haugmentation zPosition u0 huPrime0 huOutside0 exitPath0 + beta0 hbeta0 z0 hz0 zPosition0 hzPosition0 hzAfter0 rho3 hrho3Proper hrho3One hd1 + hd2Missing hd2Edges hdeltaZ hd2z hd3 uPosition huPosition hseedBeforeU terminalInTj + hterminalInTj hterminalInTjVal hterminalBeforeZ hzChoiceForContradiction hjPositive + obtain ⟨lower, hround, hLowerMP, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP + jSlot.val hjPositive jSlot.isLt + let nLower : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hnMap : Fin.castLE (by omega) nLower = jSlot.castSucc := by + apply Fin.ext + simp [nLower, hround] + have hnTreeMap : Fin.castLE (by omega) nLower.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simp [nLower, hround] + have hLowerTree : lower.series.data.tree nLower.castSucc = + Tprevious := by + rw [htrees nLower.castSucc, hnTreeMap] + have hLowerColor : lower.series.data.coloring nLower = + ett.series.data.coloring jSlot.castSucc := by + rw [(hdata nLower).1, hnMap] + have hLowerStored : TashkinovStoredColors lower.series.data nLower = + TashkinovStoredColors ett.series.data jSlot.castSucc := by + rw [(hdata nLower).2.2.2.2.2.2.2.2.1, hnMap] + have hLowerKind : lower.series.data.kind nLower = + ett.series.data.kind jSlot.castSucc := by + rw [(hdata nLower).2.2.2.1, hnMap] + have hLowerConnecting : lower.series.data.connectingEdges nLower = + ett.series.data.connectingEdges jSlot.castSucc := by + rw [(hdata nLower).2.2.1, hnMap] + have hTpreviousBefore : TreeSequenceVertexSet Tprevious ⊆ + TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ := by + exact @helper_hTpreviousBefore_6081 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@hterminalJ) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@hpreviousTj) + (@hpreviousStrict) (@hpreviousSeed) (@hterminalInTj) (@hjPositive) + have hseedBuild : + (ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious seed) ∨ + ((ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + ett.series.data.connectingEdges jSlot.castSucc = {f} ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) + adjoinSeed seed) := by + exact @helper_hseedBuild_6103 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@commonPrefix) (@TjPrime) (@hqLast) + (@x) (@componentPath) (@u) (@exitPath) (@hpreviousStrict) (@hpreviousSeed) (@zPosition) + (@u0) (@exitPath0) (@zPosition0) (@uPosition) (@hjPositive) (@lower) (@hround) + have hLowerPack := + hlower lower (by omega) (by omega) hLowerMP + have hLowerI : ∀ (Tstar : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 lower rho3 + Tstar), + MaximumProperty corr.replacementETT → + ColoredVertexSetElementary G rho3 + (TreeSequenceVertexSet Tstar) := by + exact @helper_hLowerI_6128 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@hlower) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) + (@TjPrime) (@hqLast) (@a) (@b) (@zPosition0) (@rho3) (@uPosition) (@lower) (@hround) + have hLowerVI : ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tprevious + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) sigma → + ModColoring lower sigma := by + exact @helper_hLowerVI_6142 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@lower) (@hLowerTree) (@hLowerColor) + (@hLowerStored) (@hLowerPack) + exact ExtensionBaseCaseTwoContradiction ett lower jSlot hjPositive + Tprevious (ett.series.data.tree jSlot.succ.castSucc) seed TjPrime + (ett.series.data.coloring jSlot.castSucc) rho1 rho3 + (TashkinovStoredColors ett.series.data jSlot.castSucc) + v u0 z0 beta0 gammaFirst delta hterminalJ huPrime0 hz0 + zPosition0 uPosition hzPosition0 huPosition hseedTj hseedPrime + hseedTerminal hzAfter0 hseedBeforeU hterminalBeforeZ + (by + intro huTj + exact huOutside0 (vertexTransfer hTjQ huTj)) + rfl rfl rfl rfl hround hLowerTree hLowerColor hLowerStored + hLowerKind hLowerConnecting hTpreviousBefore hseedBuild haugmentation + hclosure hprimeElementary hMP hLowerMP hLowerI + hLowerVI hb2Missing.1 + (fun a => (hb2TreeEdges a).1.trans (hb2TreeEdges a).2) + hterminalInclusion hdeltaMissing hbeta0 hrho3Proper hrho3One hd1 + hd2Missing + (fun f hf => by + apply hd2Edges f + rcases hf with ⟨a, ha, rfl⟩ | ⟨a, ha, rfl⟩ + · exact @helper_branch_6176 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@p0) (@indices0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) + (@hseedPrime) (@hqLast) (@u0) (@zPosition0) (@uPosition) (@huPosition) (@hseedBeforeU) + (@hterminalInTjVal) (@lower) (@hround) (@a) (@ha) + · exact Or.inr ⟨a, uPosition, huPosition, ha, rfl⟩) + hdeltaZ hd2z hd3 hzChoiceForContradiction + +private theorem helper_hmissingX_6300.{u_1, u_2} : + helperHmissingX6300Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hseedTj TjPrime a u0 z0 hz0 zPosition0 hzPosition0 rho3 uPosition terminalInTj + hterminalInTjVal huPositionPositive huPositionBound hzPositionPositive hzPositionBound U Z + hZTj hseedU hterminalInclusionRho3 hbeforeZMissing M huU heveryNewRightEntry hrightOrder + hseedZSegment n hnU hnM hnM' X j i hvertexMZ hrightOutside hiSeed hiZ ZX hZXZ hZXlen A + hlenA c hmissingZX hleftX + unfold TreeMissingColors at hmissingZX ⊢ + obtain ⟨y, hyZX, hcMissing⟩ := + Finset.mem_biUnion.mp hmissingZX + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hyZX + obtain ⟨a, ha⟩ := hyZX + have hcMissingY : c ∈ MissingColors G + (ett.series.data.coloring jSlot.castSucc) y := by + simpa [ha] using hcMissing + have hyX : y ∈ TreeSequenceVertexSet X := by + by_cases hyU : y ∈ TreeSequenceVertexSet U + · exact hleftX hyU + · have haPos : 1 ≤ a.val := by + by_contra hzero + have haZero : a.val = 0 := by omega + let pZero : Fin (seed.length + 1) := ⟨0, by omega⟩ + have hZp := hseedZSegment.2.1 pZero + have hUp := hseedU.2.1 pZero + apply hyU + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + refine ⟨Fin.castLE (Nat.succ_le_succ hseedU.1) + pZero, ?_⟩ + have haZ : Z.vertex (Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiZ)) a) = y := by + simpa [ZX, TreeSequencePrefix] using ha + have ha0 : Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiZ)) a = + Fin.castLE + (Nat.succ_le_succ hseedZSegment.1) pZero := by + apply Fin.ext + exact haZero + rw [ha0, hZp] at haZ + exact hUp.trans haZ + let r : Fin Z.length := ⟨a.val - 1, by + have haLt : a.val < ZX.length + 1 := a.isLt + simp [ZX] at haLt + omega⟩ + have hrSucc : r.succ = Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiZ)) a := by + apply Fin.ext + exact Nat.sub_add_cancel haPos + have hry : Z.vertex r.succ = y := by + rw [hrSucc] + simpa [ZX, TreeSequencePrefix] using ha + have hrOutside : + Z.vertex r.succ ∉ TreeSequenceVertexSet U := by + simpa [hry] using hyU + have hri : r.val < i.val := by + have haLt : a.val < ZX.length + 1 := a.isLt + simp [ZX, r] at haLt ⊢ + omega + obtain ⟨q0, hqU, hedgeq, hvertexq⟩ := + heveryNewRightEntry r hrOutside + have hqn : q0.val < n := + hrightOrder r i hrOutside hrightOutside hri q0 j + hvertexq hvertexMZ + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + let qX : Fin (X.length + 1) := ⟨q0.val + 1, by + change q0.val + 1 < n + 1 + omega⟩ + refine ⟨qX, ?_⟩ + rw [← hry, ← hvertexq] + change M.vertex _ = M.vertex q0.succ + congr 1 + by_cases hyTerminal : y = v + · have hcTerminalOld : c ∈ MissingColors G + (ett.series.data.coloring jSlot.castSucc) v := by + rw [← hyTerminal] + exact hcMissingY + rcases Finset.mem_union.mp + (hterminalInclusionRho3 hcTerminalOld) with + hcTerminal | hcU + · exact Finset.mem_biUnion.mpr + ⟨v, by simpa [hyTerminal] using hyX, hcTerminal⟩ + · exact Finset.mem_biUnion.mpr ⟨u0, hleftX huU, hcU⟩ + · have hyBefore : y ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 := by + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + let aZ : Fin (Z.length + 1) := + Fin.castLE (Nat.succ_le_succ hZXZ.1) a + let aTj : Fin + ((ett.series.data.tree + jSlot.succ.castSucc).length + 1) := + Fin.castLE (Nat.succ_le_succ hZTj.1) aZ + have haTj : + (ett.series.data.tree + jSlot.succ.castSucc).vertex aTj = y := + (hZTj.2.1 aZ).trans ((hZXZ.2.1 a).trans ha) + refine ⟨?_, aTj, zPosition0, haTj, + hzPosition0, ?_⟩ + · simp only [TreeSequenceVertexSet, + Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨aTj, haTj⟩ + change a.val < zPosition0.val + have haLt := a.isLt + have hiLt := i.isLt + simp [ZX, Z, TreeSequencePrefix] at haLt hiLt + omega + refine Finset.mem_biUnion.mpr ⟨y, hyX, ?_⟩ + rw [hbeforeZMissing y hyBefore hyTerminal] + exact hcMissingY + +theorem helper_branch_15674.{u_1, u_2} : + helperBranch15674Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime + hb2EdgesFromSeed H a b x componentPath u exitPath zPosition u0 exitPath0 z0 hz0 zPosition0 + hzPosition0 rho3 hd2Edges uPosition terminalInTj hterminalInTjVal huPositionPositive + huPositionBound hzPositionPositive hzPositionBound U Z hZTj hseedU hterminalInclusionRho3 + hbeforeZMissing M huU hroutePhiZ hleftSegment hnewEntryFromRight heveryNewRightEntry + hrightOrder prefixSegment prefixPrefix hseedZSegment firstStep n hnU ih hnM + by_cases hnEq : n = M.length + · omega + have hnSuccM : n + 1 ≤ M.length := by omega + have hnM' : n ≤ M.length := + Nat.le_trans (Nat.le_succ n) hnSuccM + have ih' := ih hnM' + let X := TreeSequencePrefix M n + (Nat.le_trans U.positive hnU) hnM' + let Y := TreeSequencePrefix M (n + 1) + (Nat.le_trans U.positive + (Nat.le_trans hnU (Nat.le_succ n))) hnSuccM + let j : Fin M.length := ⟨n, by omega⟩ + obtain ⟨i, hedgeMZ, hvertexMZ⟩ := + hnewEntryFromRight j hnU + have hrightOutside : + Z.vertex i.succ ∉ TreeSequenceVertexSet U := by + exact @helper_hrightOutside_7601 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@a) (@x) (@componentPath) (@u) + (@exitPath) (@zPosition) (@u0) (@exitPath0) (@zPosition0) (@uPosition) + (@huPositionPositive) (@huPositionBound) (@hzPositionPositive) (@hzPositionBound) (@M) + (@hleftSegment) (@n) (@hnU) (@hnM) (@i) (@hvertexMZ) + have hiSeed : seed.length ≤ i.val := by + by_contra hnot + have hi : i.val < seed.length := Nat.lt_of_not_ge hnot + let a : Fin (seed.length + 1) := ⟨i.val + 1, by omega⟩ + have hZSeedA : Z.vertex + (Fin.castLE (Nat.succ_le_succ hseedZSegment.1) a) = + seed.vertex a := hseedZSegment.2.1 a + apply hrightOutside + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + refine ⟨Fin.castLE (Nat.succ_le_succ hseedU.1) a, ?_⟩ + have hia : Fin.castLE + (Nat.succ_le_succ hseedZSegment.1) a = i.succ := + Fin.ext (by simp [a]) + rw [hia] at hZSeedA + exact (hseedU.2.1 a).trans hZSeedA.symm + have hiZ : i.val < Z.length := i.isLt + let ZX := TreeSequencePrefix Z i.val + (Nat.le_trans seed.positive hiSeed) (Nat.le_of_lt hiZ) + have hseedZX : TreeSequenceInitialSegment seed ZX := by + refine ⟨hiSeed, ?_, ?_⟩ + · intro a + change Z.vertex _ = seed.vertex a + calc + Z.vertex _ = Z.vertex (Fin.castLE + (Nat.succ_le_succ hseedZSegment.1) a) := by + congr 1 + _ = seed.vertex a := hseedZSegment.2.1 a + · intro a + change Z.edge _ = seed.edge a + calc + Z.edge _ = Z.edge + (Fin.castLE hseedZSegment.1 a) := by congr 1 + _ = seed.edge a := hseedZSegment.2.2 a + have hZXZ : TreeSequenceInitialSegment ZX Z := + prefixSegment Z i.val + (Nat.le_trans seed.positive hiSeed) (Nat.le_of_lt hiZ) + have hsuffix : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) ZX Z := + TashkinovAugmentationSequenceSuffix _ seed ZX Z + hroutePhiZ hseedZX hZXZ + have hZXlen : ZX.length = i.val := rfl + obtain ⟨A, hZXA, hAZ⟩ := firstStep hsuffix (by omega) + rcases hZXA with + ⟨hlenA, hZXASegment, c, hcolorA, hmissingZX⟩ + have hAZSegment : TreeSequenceInitialSegment A Z := + TashkinovAugmentationSequenceInitialSegment _ A Z hAZ + have hAi : A.length = i.val + 1 := by omega + let ai : Fin A.length := ⟨i.val, by omega⟩ + have hcolorZ : + ett.series.data.coloring jSlot.castSucc (Z.edge i) = + some c := by + have haiLast : ai = + Fin.cast hlenA.symm (Fin.last ZX.length) := by + apply Fin.ext + simp [ai, hZXlen] + have hZai : Z.edge (Fin.castLE hAZSegment.1 ai) = + A.edge ai := hAZSegment.2.2 ai + have hcast : Fin.castLE hAZSegment.1 ai = i := by + apply Fin.ext + simp [ai] + rw [← hcast, hZai, haiLast] + exact hcolorA + have hleftX {y : V} (hyU : y ∈ TreeSequenceVertexSet U) : + y ∈ TreeSequenceVertexSet X := by + exact @helper_hleftX_4557 (@V) (@E) (@G) (@e0) (@TjPrime) (@b) (@uPosition) + (@huPositionPositive) (@huPositionBound) (@M) (@hleftSegment) (@n) (@hnU) + (@hnM') (@y) (@hyU) + have hmissingX : c ∈ TreeMissingColors rho3 X := by + exact @helper_hmissingX_6300 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@a) (@u0) (@z0) (@hz0) (@zPosition0) + (@hzPosition0) (@rho3) (@uPosition) (@hterminalInTjVal) (@huPositionPositive) + (@huPositionBound) (@hzPositionPositive) (@hzPositionBound) (@hZTj) (@hseedU) + (@hterminalInclusionRho3) (@hbeforeZMissing) (@M) (@huU) (@heveryNewRightEntry) + (@hrightOrder) (@hseedZSegment) (@n) (@hnU) (@hnM) (@hnM') (@i) (@hvertexMZ) + (@hrightOutside) (@hiSeed) (@hiZ) (@hZXZ) (@hZXlen) (@A) (@hlenA) (@c) (@hmissingZX) + (@hleftX) + have hXY : TashkinovAugmentation rho3 X Y := by + exact @helper_hXY_7786 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) + (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@hb2EdgesFromSeed) (@x) (@componentPath) + (@u) (@exitPath) (@zPosition) (@u0) (@exitPath0) (@zPosition0) (@rho3) (@hd2Edges) + (@uPosition) (@huPositionPositive) (@huPositionBound) (@hzPositionPositive) + (@hzPositionBound) (@hZTj) (@M) (@prefixPrefix) (@n) (@hnU) (@hnM) (@hnSuccM) (@hnM') + (@i) (@hedgeMZ) (@hiSeed) (@c) (@hcolorZ) (@hmissingX) + change TashkinovAugmentationSequence rho3 U Y + exact Relation.ReflTransGen.tail ih' hXY + +private theorem helper_hrouteUM_6564.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (hseedTj : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (TjPrime : TreeSequence G e0) + (_ : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + seed.length ≤ (↑a : ℕ) → + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) = + ett.series.data.coloring jSlot.castSucc + ((ett.series.data.tree jSlot.succ.castSucc).edge a)), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let _ : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (_ _ : V ⊕ E) (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) seed + (ett.series.data.tree jSlot.succ.castSucc)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u0 : V) + (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition0 = z0) + (rho3 : PartialEdgeColoring E k) + (_ : + ∀ (f : E), + ((∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + seed.length ≤ (↑a : ℕ) ∧ + (↑a : ℕ) < (↑zPosition0 : ℕ) ∧ + (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 ∧ + (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → + rho3 f = rho1 f) + (uPosition : Fin (TjPrime.length + (1 : ℕ))), + let terminalInTj : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ)) := + Fin.castLE + (by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt terminalPosition + have := hseedTj.1 + have := + GoldbergSeymour.TreeSequence.positive + (TreeSequencePrefix + (ett.series.data.tree + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds).succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive + hterminalPositionBound) + have := + GoldbergSeymour.TreeSequence.positive + (ett.series.data.tree + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds).succ.castSucc) + all_goals omega)) + (Fin.last seed.length); + ∀ (_ : (↑terminalInTj : ℕ) = seed.length) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length) + (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition0 : ℕ)) + (hzPositionBound : + (↑zPosition0 : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + let Z : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑zPosition0 : ℕ) + hzPositionPositive hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment Z (ett.series.data.tree jSlot.succ.castSucc)) + (_ : TreeSequenceInitialSegment seed U) + (_ : TreeSequenceInitialSegment seed Z) + (_ : + MissingColors G (ett.series.data.coloring jSlot.castSucc) v ⊆ + MissingColors G rho3 v ∪ MissingColors G rho3 u0) + (_ : + ∀ (y : V) + (_ : y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0) + (_ : y ≠ v), + MissingColors G rho3 y = + MissingColors G (ett.series.data.coloring jSlot.castSucc) y) + (M : TreeSequence G e0) (_ : OrderedTreeUnion U Z M) + (_ : u0 ∈ TreeSequenceVertexSet U), + TashkinovAugmentationSequence rho3 U M := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime + hb2EdgesFromSeed H C a b x componentPath u exitPath haugmentation zPosition u0 exitPath0 z0 + hz0 zPosition0 hzPosition0 rho3 hd2Edges uPosition terminalInTj hterminalInTjVal + huPositionPositive huPositionBound hzPositionPositive hzPositionBound U Z hZTj hseedU + hseedZ hterminalInclusionRho3 hbeforeZMissing M hunion huU + have hroutePhiZ : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) seed Z := + TashkinovAugmentationSequenceRestrict _ seed Z _ haugmentation + hseedZ hZTj + have hleftSegment := hunion.leftSegment + have hnewEntryFromRight := hunion.newEntryFromRight + have heveryNewRightEntry := hunion.everyNewRightEntry + have hrightOrder := hunion.rightOrder + have prefixSegment (A : TreeSequence G e0) (q0 : Nat) + (hq0 : 1 ≤ q0) (hqA : q0 ≤ A.length) : + TreeSequenceInitialSegment + (TreeSequencePrefix A q0 hq0 hqA) A := by + exact @helper_prefixSegment_4407 (@V) (@E) (@G) (@e0) (@A) (@q0) (@hq0) (@hqA) + have prefixPrefix (A : TreeSequence G e0) (q0 : Nat) + (hq0 : 1 ≤ q0) (hqA : q0 + 1 ≤ A.length) : + TreeSequenceInitialSegment + (TreeSequencePrefix A q0 hq0 + (Nat.le_trans (Nat.le_succ q0) hqA)) + (TreeSequencePrefix A (q0 + 1) (by omega) hqA) := by + exact @helper_prefixPrefix_7534 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) + (@zPosition) (@u0) (@exitPath0) (@zPosition0) (@uPosition) (@A) (@q0) (@hq0) (@hqA) + have prefixSelf (A : TreeSequence G e0) : + TreeSequencePrefix A A.length A.positive le_rfl = A := by + exact @helper_prefixSelf_4429 (@V) (@E) (@G) (@e0) (@A) + have equalPrefixes {A B D : TreeSequence G e0} + (hAD : TreeSequenceInitialSegment A D) + (hBD : TreeSequenceInitialSegment B D) + (hlen : A.length = B.length) : A = B := by + exact @helper_equalPrefixes_6220 (@V) (@E) (@G) (@e0) (@A) (@B) (@D) (@hAD) (@hBD) + (@hlen) + have prefixAtLeft : + TreeSequencePrefix M U.length U.positive hleftSegment.1 = U := by + apply equalPrefixes + (prefixSegment M U.length U.positive hleftSegment.1) + hleftSegment + rfl + have hseedZSegment : TreeSequenceInitialSegment seed Z := + TashkinovAugmentationSequenceInitialSegment _ seed Z hroutePhiZ + have firstStep {A B : TreeSequence G e0} + (hAB : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) A B) + (hlt : A.length < B.length) : + ∃ C, TashkinovAugmentation + (ett.series.data.coloring jSlot.castSucc) A C ∧ + TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) C B := by + unfold TashkinovAugmentationSequence at hAB ⊢ + induction hAB using Relation.ReflTransGen.head_induction_on with + | refl => omega + | @head A C hAC hCB ih => exact ⟨C, hAC, hCB⟩ + have replay : ∀ n (hnU : U.length ≤ n) (hnM : n ≤ M.length), + TashkinovAugmentationSequence rho3 U + (TreeSequencePrefix M n + (Nat.le_trans U.positive hnU) hnM) := by + intro n hnU hnM + induction n, hnU using Nat.le_induction with + | base => + simpa [prefixAtLeft] using + (show TashkinovAugmentationSequence rho3 U U from + Relation.ReflTransGen.refl) + | @succ n hnU ih => + exact @helper_branch_15674 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@hb2EdgesFromSeed) (@a) (@b) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@exitPath0) (@z0) (@hz0) + (@zPosition0) (@hzPosition0) (@rho3) (@hd2Edges) (@uPosition) (@hterminalInTjVal) + (@huPositionPositive) (@huPositionBound) (@hzPositionPositive) (@hzPositionBound) + (@hZTj) (@hseedU) (@hterminalInclusionRho3) (@hbeforeZMissing) (@M) (@huU) + (@hroutePhiZ) (@hleftSegment) (@hnewEntryFromRight) (@heveryNewRightEntry) + (@hrightOrder) (@prefixSegment) (@prefixPrefix) (@hseedZSegment) (@firstStep) (@n) + (@hnU) (@ih) (@hnM) + have hfull := replay M.length hleftSegment.1 le_rfl + simpa [prefixSelf] using hfull + +theorem helper_branch_15847.{u_1, u_2} : + helperBranch15847Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive v gamma delta sigma this q + hqTerminal hvFinal hfirstUpper hfirstPositive jSlot segmentTrans vertexTransfer trace + hterminalJ p0 indices0 gamma0 delta0 rho1 hb2Missing terminalPosition + hterminalPositionPositive hterminalPositionBound seed hseedTj hseedTerminal hTjQ + hseedVertexBefore segmentVertexBefore transportSeedRoute commonPrefix TjPrime hclosure + hseedPrime gammaFirst hterminalInclusion hb2EdgesFromSeed hdeltaMissing H C a b x + componentPath u exitPath haugmentation zPosition u0 huPrime0 huOutside0 exitPath0 beta0 z0 + hz0 zPosition0 hzPosition0 hzAfter0 rho3 hrho3Proper hrho3One hd1 hd2Missing hd2Edges + hdeltaZ hd2z hd3 hu0Terminal uPosition huPosition hseedBeforeU terminalInTj hterminalInTj + hterminalInTjVal hzv hterminalBeforeZ hzChoiceForContradiction hjPositive + have hjZero : jSlot.val = 0 := Nat.eq_zero_of_not_pos hjPositive + have huPositionPositive : 1 ≤ uPosition.val := + seed.positive.trans (Nat.le_of_lt hseedBeforeU) + have huPositionBound : uPosition.val ≤ TjPrime.length := + Nat.lt_succ_iff.mp uPosition.isLt + have hzPositionPositive : 1 ≤ zPosition0.val := + seed.positive.trans hzAfter0 + have hzPositionBound : zPosition0.val ≤ + (ett.series.data.tree jSlot.succ.castSucc).length := + Nat.lt_succ_iff.mp zPosition0.isLt + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime uPosition.val huPositionPositive + huPositionBound + let Z : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + zPosition0.val hzPositionPositive hzPositionBound + have hUPrime : TreeSequenceInitialSegment U TjPrime := by + exact @helper_hUPrime_4274 (@V) (@E) (@G) (@e0) (@TjPrime) (@uPosition) + (@huPositionPositive) (@huPositionBound) + have hZTj : TreeSequenceInitialSegment Z + (ett.series.data.tree jSlot.succ.castSucc) := by + exact @helper_hZTj_4280 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@zPosition0) (@hzPositionPositive) + (@hzPositionBound) + have hseedU : TreeSequenceInitialSegment seed U := by + apply commonPrefix hseedPrime hUPrime + exact Nat.le_of_lt hseedBeforeU + have hseedZ : TreeSequenceInitialSegment seed Z := by + apply commonPrefix hseedTj hZTj + exact hzAfter0 + have hrouteRhoOneU : TashkinovAugmentationSequence rho1 seed U := + TashkinovAugmentationSequenceRestrict rho1 seed U TjPrime + hclosure.1 hseedU hUPrime + have hprimeVertexBefore (i : Fin (TjPrime.length + 1)) + (hi : i.val < uPosition.val) : + TjPrime.vertex i ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + exact ⟨by simp [TreeSequenceVertexSet], i, uPosition, + rfl, huPosition, hi⟩ + have hUsegmentVertexBefore {A : TreeSequence G e0} + (hAU : TreeSequenceInitialSegment A U) + (hAlen : A.length < U.length) {y : V} + (hyA : y ∈ TreeSequenceVertexSet A) : + y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by + exact @helper_hUsegmentVertexBefore_7424 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) + (@zPosition) (@u0) (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) + (@huPositionPositive) (@huPositionBound) (@hUPrime) (@hprimeVertexBefore) (@A) (@hAU) + (@hAlen) (@y) (@hyA) + have hbeforePrimeNeU {y : V} + (hy : y ∈ TreeVerticesBefore TjPrime u0 huPrime0) : + y ≠ u0 := by + exact @helper_hbeforePrimeNeU_7437 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) + (@zPosition) (@u0) (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) (@y) (@hy) + have hbeforePrimeMissing (y : V) + (hy : y ∈ TreeVerticesBefore TjPrime u0 huPrime0) : + MissingColors G rho3 y = MissingColors G rho1 y := by + exact @helper_hbeforePrimeMissing_7447 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@TjPrime) (@u0) + (@huPrime0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hd2z) (@hbeforePrimeNeU) (@y) (@hy) + have transportUStep {A B : TreeSequence G e0} + (hstep : TashkinovAugmentation rho1 A B) + (hBU : TreeSequenceInitialSegment B U) : + TashkinovAugmentation rho3 A B := by + exact @helper_transportUStep_7455 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) + (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@huPrime0) (@exitPath0) + (@zPosition0) (@rho3) (@hd2Edges) (@uPosition) (@huPosition) (@huPositionPositive) + (@huPositionBound) (@hUPrime) (@hUsegmentVertexBefore) (@hbeforePrimeMissing) (@A) (@B) + (@hstep) (@hBU) + have transportURoute (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence rho1 S U) : + TashkinovAugmentationSequence rho3 S U := by + exact @helper_transportURoute_4333 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@sigma) + (@hvFinal) (@trace) (@TjPrime) (@rho3) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@transportUStep) (@S) (@hroute) + have hrouteRhoThreeU : TashkinovAugmentationSequence rho3 seed U := + transportURoute seed hrouteRhoOneU + have hterminalNeU : v ≠ u0 := hu0Terminal.symm + have hterminalMissingEq : MissingColors G rho3 v = + MissingColors G rho1 v := by + exact @helper_hterminalMissingEq_7478 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@TjPrime) (@u0) + (@huPrime0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hzv) (@hterminalBeforeZ) (@hterminalNeU) + have hterminalInclusionRho3 : + MissingColors G (ett.series.data.coloring jSlot.castSucc) v ⊆ + MissingColors G rho3 v ∪ MissingColors G rho3 u0 := by + exact @helper_hterminalInclusionRho3_4355 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@v) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@p0) (@gamma0) (@hterminalInclusion) (@u0) (@rho3) (@hd3) (@hterminalMissingEq) + have hbeforeZData {y : V} + (hy : y ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) z0 hz0) : + y ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) ∧ y ≠ z0 := by + exact @helper_hbeforeZData_7492 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) + (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) + (@zPosition) (@u0) (@exitPath0) (@z0) (@hz0) (@zPosition0) (@uPosition) (@y) (@hy) + have hbeforeZMissing (y : V) + (hy : y ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) z0 hz0) + (hyTerminal : y ≠ v) : + MissingColors G rho3 y = + MissingColors G (ett.series.data.coloring jSlot.castSucc) y := by + exact @helper_hbeforeZMissing_7504 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@trace) (@hb2Missing) + (@hTjQ) (@TjPrime) (@u0) (@huPrime0) (@huOutside0) (@z0) (@hz0) (@rho3) (@hd2Missing) + (@hbeforeZData) (@y) (@hy) (@hyTerminal) + obtain ⟨M, ⟨hunion⟩⟩ := OrderedTreeUnionExists U Z + have huU : u0 ∈ TreeSequenceVertexSet U := by + exact @helper_huU_4386 (@V) (@E) (@G) (@e0) (@TjPrime) (@u0) (@uPosition) + (@huPosition) (@huPositionPositive) (@huPositionBound) + have hrouteUM : TashkinovAugmentationSequence rho3 U M := by + exact @helper_hrouteUM_6564 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) + (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@hb2EdgesFromSeed) (@a) (@b) (@x) + (@componentPath) (@u) (@exitPath) (@haugmentation) (@zPosition) (@u0) (@exitPath0) (@z0) + (@hz0) (@zPosition0) (@hzPosition0) (@rho3) (@hd2Edges) (@uPosition) (@hterminalInTjVal) + (@huPositionPositive) (@huPositionBound) (@hzPositionPositive) (@hzPositionBound) (@hZTj) + (@hseedU) (@hseedZ) (@hterminalInclusionRho3) (@hbeforeZMissing) (@M) (@hunion) (@huU) + exact @helper_caseContinuation_11664 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) + (@vertexTransfer) (@trace) (@hterminalJ) (@p0) (@indices0) (@gamma0) (@delta0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) + (@hseedTerminal) (@hTjQ) (@hseedVertexBefore) (@segmentVertexBefore) (@transportSeedRoute) + (@commonPrefix) (@TjPrime) (@hdeltaMissing) (@a) (@x) (@componentPath) (@u) (@exitPath) + (@zPosition) (@u0) (@huOutside0) (@exitPath0) (@beta0) (@z0) (@zPosition0) (@hzPosition0) + (@rho3) (@hrho3Proper) (@hrho3One) (@hd1) (@hdeltaZ) (@uPosition) (@hterminalInTj) (@hzv) + (@hzChoiceForContradiction) (@hjZero) (@huPositionPositive) (@huPositionBound) + (@hzPositionPositive) (@hzPositionBound) (@hZTj) (@hseedZ) (@hrouteRhoThreeU) + (@hterminalMissingEq) (@M) (@hunion) (@huU) (@hrouteUM) + +theorem helper_continuation_12157.{u_1, u_2} : + helperContinuation12157Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma this q + hqTerminal hvStage hvFinal hfirstUpper hfirstPositive jSlot hjSlot segmentTrans + vertexTransfer trace hterminalJ p0 indices0 gamma0 delta0 rho1 hb2Missing hb2TreeEdges + terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj + hseedTerminal hTjQ hseedVertexBefore segmentVertexBefore transportSeedRoute commonPrefix + supportColors TjPrime hclosure hprimeElementary hseedPrime hterminalPrime hqLast gammaFirst + hterminalInclusion hb2EdgesFromSeed hterminalSeed hseedN fN hdeltaMissing H C a b x + componentPath u exitPath Tprevious hpreviousTj hpreviousStrict hpreviousSeed haugmentation + zPosition hclaim45Package + obtain ⟨u0, huPrime0, huOutside0, exitPath0, hexitPath0, + hexitLength0, hexitSupport0, hexitIntersection0, hexitBoundary0, + huNotFN0, beta0, hbeta0, hbetaSupport0, z0, hz0, zPosition0, + hzPosition0, hzAfter0, hzChoice0, hzBefore0, hzEdges0, rho3, + hrho3Proper, hrho3One, hd1, hd2Missing, hd2Edges, hdeltaZ, + hd2z, hd3⟩ := hclaim45Package + have hu0Terminal : u0 ≠ v := by + intro huv + exact huOutside0 (by simpa [huv] using hvStage) + have hbeta0Terminal : beta0 ∉ MissingColors G rho1 v := by + intro hbetaV + have hdisjoint := hprimeElementary huPrime0 hterminalPrime hu0Terminal + exact (Finset.disjoint_left.mp hdisjoint) hbeta0 hbetaV + obtain ⟨uPosition, -, huPosition⟩ := Finset.mem_image.mp huPrime0 + have huNotSeed : u0 ∉ TreeSequenceVertexSet seed := by + intro huSeed0 + exact huOutside0 (vertexTransfer hseedN huSeed0) + have hseedBeforeU : seed.length < uPosition.val := by + exact @helper_hseedBeforeU_7025 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) + (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@hseedPrime) (@x) (@componentPath) (@u) (@exitPath) + (@zPosition) (@u0) (@exitPath0) (@zPosition0) (@uPosition) (@huPosition) (@huNotSeed) + let terminalInTj : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1) := + Fin.castLE (Nat.succ_le_succ hseedTj.1) (Fin.last seed.length) + have hterminalInTj : + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalInTj = v := by + exact (hseedTj.2.1 (Fin.last seed.length)).trans hseedTerminal + have hterminalInTjVal : terminalInTj.val = seed.length := by + rfl + have hzTerminalIff : z0 = v ↔ zPosition0 = terminalInTj := by + constructor + · intro hzv + apply (ett.series.data.tree + jSlot.succ.castSucc).vertex_injective + exact hzPosition0.trans (hzv.trans hterminalInTj.symm) + · intro hpos + exact hzPosition0.symm.trans (hpos ▸ hterminalInTj) + have hzPositionCases : + (z0 = v ∧ zPosition0.val = seed.length) ∨ + (z0 ≠ v ∧ seed.length < zPosition0.val) := by + by_cases hzv : z0 = v + · left + refine ⟨hzv, ?_⟩ + rw [(hzTerminalIff.mp hzv), hterminalInTjVal] + · right + refine ⟨hzv, lt_of_le_of_ne hzAfter0 ?_⟩ + intro heq + apply hzv + apply hzTerminalIff.mpr + apply Fin.ext + simpa [hterminalInTjVal] using heq.symm + by_cases hzv : z0 = v + · exact @helper_branch_13441 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) + (@segmentTrans) (@vertexTransfer) (@trace) (@hterminalJ) (@p0) (@indices0) (@gamma0) + (@delta0) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hjTreeIndex) (@hseedTj) (@hseedTerminal) (@hTjQ) (@hseedVertexBefore) + (@segmentVertexBefore) (@transportSeedRoute) (@commonPrefix) (@TjPrime) (@hclosure) + (@hseedPrime) (@hqLast) (@hterminalSeed) (@a) (@x) (@componentPath) (@u) (@exitPath) + (@hpreviousStrict) (@hpreviousSeed) (@zPosition) (@u0) (@huPrime0) (@huOutside0) + (@exitPath0) (@beta0) (@z0) (@hz0) (@zPosition0) (@hzChoice0) (@rho3) (@hrho3Proper) + (@hrho3One) (@hd1) (@hd2Missing) (@hd2Edges) (@hd2z) (@hbeta0Terminal) (@uPosition) + (@huPosition) (@hseedBeforeU) (@hterminalInTj) (@hterminalInTjVal) (@hzTerminalIff) (@hzv) + · have hseedBeforeZ : seed.length < zPosition0.val := + hzPositionCases.resolve_left (fun h => hzv h.1) |>.2 + have hterminalBeforeZ : v ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 := by + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + refine ⟨hterminalJ, terminalInTj, zPosition0, + hterminalInTj, hzPosition0, ?_⟩ + simpa [hterminalInTjVal] using hseedBeforeZ + have hzChoiceForContradiction : + zPosition0 = Fin.last + (ett.series.data.tree jSlot.succ.castSucc).length ∨ + (zPosition0.val < + (Fin.last + (ett.series.data.tree jSlot.succ.castSucc).length).val ∧ + beta0 ∈ MissingColors G rho1 z0) := by + exact @helper_hzChoiceForContradiction_7230 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@beta0) + (@z0) (@zPosition0) (@hzChoice0) + by_cases hjPositive : 0 < jSlot.val + · exact @helper_branch_13578 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@hjSlot) (@vertexTransfer) (@trace) (@hterminalJ) (@p0) (@indices0) + (@gamma0) (@delta0) (@hb2Missing) (@hb2TreeEdges) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) + (@hseedTerminal) (@hTjQ) (@commonPrefix) (@TjPrime) (@hclosure) (@hprimeElementary) + (@hseedPrime) (@hqLast) (@hterminalInclusion) (@hdeltaMissing) (@a) (@b) (@x) + (@componentPath) (@u) (@exitPath) (@hpreviousTj) (@hpreviousStrict) (@hpreviousSeed) + (@haugmentation) (@zPosition) (@u0) (@huPrime0) (@huOutside0) (@exitPath0) (@beta0) + (@hbeta0) (@z0) (@hz0) (@zPosition0) (@hzPosition0) (@hzAfter0) (@rho3) (@hrho3Proper) + (@hrho3One) (@hd1) (@hd2Missing) (@hd2Edges) (@hdeltaZ) (@hd2z) (@hd3) (@uPosition) + (@huPosition) (@hseedBeforeU) (@hterminalInTj) (@hterminalInTjVal) (@hterminalBeforeZ) + (@hzChoiceForContradiction) (@hjPositive) + · exact @helper_branch_15847 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) + (@vertexTransfer) (@trace) (@hterminalJ) (@p0) (@indices0) (@gamma0) (@delta0) + (@hb2Missing) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hseedTj) (@hseedTerminal) (@hTjQ) (@hseedVertexBefore) (@segmentVertexBefore) + (@transportSeedRoute) (@commonPrefix) (@TjPrime) (@hclosure) (@hseedPrime) + (@hterminalInclusion) (@hb2EdgesFromSeed) (@hdeltaMissing) (@a) (@b) (@x) + (@componentPath) (@u) (@exitPath) (@haugmentation) (@zPosition) (@u0) (@huPrime0) + (@huOutside0) (@exitPath0) (@beta0) (@z0) (@hz0) (@zPosition0) (@hzPosition0) (@hzAfter0) + (@rho3) (@hrho3Proper) (@hrho3One) (@hd1) (@hd2Missing) (@hd2Edges) (@hdeltaZ) (@hd2z) + (@hd3) (@hu0Terminal) (@uPosition) (@huPosition) (@hseedBeforeU) (@hterminalInTj) + (@hterminalInTjVal) (@hzv) (@hterminalBeforeZ) (@hzChoiceForContradiction) (@hjPositive) +private theorem helper_hcaseTwoObservationPackage_7053.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + let supportColors : Finset (Fin k) := + Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (fN : E), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (exitPath : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : exitPath.IsPath) (_ : (2 : ℕ) ≤ exitPath.length) + (_ : ∀ y ∈ exitPath.support, y ∈ componentPath.support) + (_ : + ∀ + w ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime, + Sum.inl w ∈ exitPath.support ↔ w = u) + (_ : + ∃ + g ∈ + BoundaryColorEdges G rho1 + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime) + gamma, + Incident G u g ∧ Sum.inr g ∈ exitPath.support) + (_ : ¬Incident G u fN) (_ : u ∈ TreeSequenceVertexSet TjPrime) + (_ : u ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + (beta : Fin k) (_ : beta ∈ MissingColors G rho1 u) + (_ : beta ∉ supportColors) (z : V) + (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z) + (_ : seed.length ≤ (↑zPosition : ℕ)) + (_ : + (seed.length < (↑zPosition : ℕ) ∧ + beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + seed.length < (↑r : ℕ) → + (↑r : ℕ) < (↑zPosition : ℕ) → + beta ∉ + MissingColors G rho1 + ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∨ + zPosition = Fin.last (ett.series.data.tree jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + seed.length < (↑r : ℕ) → + beta ∉ + MissingColors G rho1 + ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) + (_ : + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, + beta ∉ MissingColors G rho1 w) + (_ : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + seed.length ≤ (↑a : ℕ) → + (↑a : ℕ) < (↑zPosition : ℕ) → + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some beta), + (u ∈ TreeSequenceVertexSet TjPrime ∧ + u ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) ∧ + (exitPath.IsPath ∧ + (2 : ℕ) ≤ exitPath.length ∧ + (∀ y ∈ exitPath.support, y ∈ componentPath.support) ∧ + (∀ + y ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime, + Sum.inl y ∈ exitPath.support ↔ y = u) ∧ + (∃ + g ∈ + BoundaryColorEdges G rho1 + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime) + gamma, + Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬Incident G u fN) ∧ + (beta ∈ MissingColors G rho1 u ∧ beta ∉ supportColors) ∧ + z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∧ + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z ∧ + seed.length ≤ (↑zPosition : ℕ) ∧ + ((seed.length < (↑zPosition : ℕ) ∧ + beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + seed.length < (↑r : ℕ) → + (↑r : ℕ) < (↑zPosition : ℕ) → + beta ∉ + MissingColors G rho1 + ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∨ + zPosition = Fin.last (ett.series.data.tree jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + seed.length < (↑r : ℕ) → + beta ∉ + MissingColors G rho1 + ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + (∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, + beta ∉ MissingColors G rho1 y) ∧ + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + seed.length ≤ (↑a : ℕ) → + (↑a : ℕ) < (↑zPosition : ℕ) → + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some beta := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed supportColors TjPrime fN H x + componentPath u exitPath hexitPath hexitLength hexitSupport hexitIntersection hexitBoundary + huNotFN huPrime huOutside beta hbeta hbetaSupport z hz zPosition hzPosition hzAfter + hzChoice hzBefore hzEdges + exact @helper_hcaseTwoObservationPackage_6796 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@fN) (@x) (@componentPath) (@u) (@exitPath) + (@hexitPath) (@hexitLength) (@hexitSupport) (@hexitIntersection) (@hexitBoundary) + (@huNotFN) (@huPrime) (@huOutside) (@beta) (@hbeta) (@hbetaSupport) (@z) (@hz) + (@zPosition) (@hzPosition) (@hzAfter) (@hzChoice) (@hzBefore) (@hzEdges) + +private theorem helper_hpreterminalGammaPresent_7105.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) + (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k) + (_ : ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) + (_ : + Function.Injective (Fin.cons (gamma0 (0 : Fin (p0 + (1 : ℕ)))) delta0)), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (_ : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let supportColors : Finset (Fin k) := + Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) + (_ : + ∀ (a : Fin (p0 + (1 : ℕ))), + ett.series.data.stored (indices0 a).succ = + (insert (gamma0 a) ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) + (_ : + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, + (MissingColors G rho1 x ∩ supportColors : Finset (Fin k)) = ∅) + (_ : gamma0 (Fin.last p0) = gamma), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (_ : V ⊕ E) (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : u ∈ (TreeSequenceVertexSet TjPrime).erase v) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (u : V) (beta : Fin k), + u ∈ TreeSequenceVertexSet TjPrime → + u ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) → + beta ∈ MissingColors G rho1 u → + ∀ (a : Fin p0), + gamma0 a.castSucc ∈ + PresentColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta delta) gamma beta + (Sum.inl u)) + u := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvStage hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 hchain0 + hinjective0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound + supportColors TjPrime hstored0 hcaseTwoPointwise hgammaLast H a x componentPath u exitPath + huErase zPosition + exact @helper_hpreterminalGammaPresent_6848 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@hchain0) + (@hinjective0) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@TjPrime) (@hstored0) (@hcaseTwoPointwise) (@hgammaLast) (@a) (@x) (@componentPath) (@u) + (@exitPath) (@huErase) (@zPosition) + +private theorem helper_hTjInitialEarlier_7122.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) + (_ : + ∀ (a b : ℕ), + (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨a, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree + (⟨b, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ))))) + (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (_ : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length) + (_ : indices0 (Fin.last p0) = q), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + ∀ s ∈ (ExtensionBaseSupportClass ett v hvFinal v).erase q, + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree s.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot stageToStage trace p0 indices0 gamma0 + delta0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound hqLast H x + componentPath u exitPath zPosition + exact @helper_hTjInitialEarlier_6865 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) + (@stageToStage) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hqLast) (@x) (@componentPath) + (@u) (@exitPath) (@zPosition) + +private theorem helper_hpositiveClaim45_7133.{u_1, u_2} : + helperHpositiveClaim457133Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound hgammaLast gammaFirst H x + componentPath u exitPath zPosition hp0 + exact @helper_hgammaFirstZero_6905 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hgammaLast) (@x) (@componentPath) (@u) (@exitPath) + (@zPosition) (@hp0) + +private theorem helper_hclaim45Package_7169.{u_1, u_2} : + helperHclaim45Package7169Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvStage hvFinal hfirstUpper hfirstPositive jSlot trace hterminalJ p0 indices0 gamma0 rho1 + hrho1Proper hrho1One hb2Missing terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTj hseedTerminal hTjQ supportColors TjPrime hclosure + hprimeElementary hseedPrime hb1Tj hcaseTwoPointwise gammaFirst hgammaSupport hdeltaSupport + hgammaDelta hb2EdgesFromSeed hdeltaPhiJ hterminalSeed fN hdeltaMissing H C a x + componentPath hcomponentPath hcomponentSupport hxOutside u exitPath hexitPath hexitLength + hexitSupport hexitIntersection hexitBoundary huNotFN huPrime huOutside hdegree beta hbeta + hbetaSupport haugmentation z hz zPosition hzPosition hzAfter hzChoice hzBefore hzEdges + hpositiveClaim45 hgammaFirstZero + exact @helper_hclaim45Package_6912 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@hterminalJ) (@p0) (@indices0) (@gamma0) (@hrho1Proper) (@hrho1One) (@hb2Missing) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) + (@hseedTerminal) (@hTjQ) (@TjPrime) (@hclosure) (@hprimeElementary) (@hseedPrime) + (@hb1Tj) (@hcaseTwoPointwise) (@hgammaSupport) (@hdeltaSupport) (@hgammaDelta) + (@hb2EdgesFromSeed) (@hdeltaPhiJ) (@hterminalSeed) (@fN) (@hdeltaMissing) (@a) (@x) + (@componentPath) (@hcomponentPath) (@hcomponentSupport) (@hxOutside) (@u) (@exitPath) + (@hexitPath) (@hexitLength) (@hexitSupport) (@hexitIntersection) (@hexitBoundary) + (@huNotFN) (@huPrime) (@huOutside) (@hdegree) (@beta) (@hbeta) (@hbetaSupport) + (@haugmentation) (@z) (@hz) (@zPosition) (@hzPosition) (@hzAfter) (@hzChoice) (@hzBefore) + (@hzEdges) (@hpositiveClaim45) (@hgammaFirstZero) + +private theorem helper_continuation_8265.{u_1, u_2} : + helperContinuation8265Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma this q + hqTerminal hvStage hvFinal hfirstUpper hfirstPositive jSlot hjSlot segmentTrans + vertexTransfer trace hterminalJ p0 indices0 gamma0 delta0 rho1 hrho1Proper hrho1One + hb2Missing hb2TreeEdges terminalPosition hterminalPositionPositive hterminalPositionBound + seed hjTreeIndex hseedTj hseedTerminal hTjQ hseedVertexBefore segmentVertexBefore + transportSeedRoute commonPrefix supportColors TjPrime hclosure hprimeElementary hseedPrime + hterminalPrime hqLast hb1Tj hcaseTwoPointwise gammaFirst hgammaSupport hdeltaSupport + hgammaDelta hterminalInclusion hb2EdgesFromSeed hdeltaPhiJ hterminalSeed hseedN fN + hdeltaMissing H C a b x componentPath hcomponentPath hcomponentSupport hxOutside u exitPath + hexitPath hexitLength hexitSupport hexitIntersection hexitBoundary huNotFN huPrime + huOutside hdegree beta hbeta hbetaSupport Tprevious hpreviousTj hpreviousStrict + hpreviousSeed haugmentation z hz zPosition hzPosition hzAfter hzChoice hzBefore hzEdges + hpositiveClaim45 hgammaFirstZero + have hclaim45Package : + ∃ (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) + (huOutside0 : u0 ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + (exitPath0 : (TwoColorIncidenceGraph G rho1 gamma delta).Walk + (Sum.inl x) (Sum.inl u0)), + exitPath0.IsPath ∧ 2 ≤ exitPath0.length ∧ + (∀ y : Sum V E, y ∈ exitPath0.support → + y ∈ componentPath.support) ∧ + (∀ y : V, + y ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime → + (Sum.inl y ∈ exitPath0.support ↔ y = u0)) ∧ + (∃ g ∈ BoundaryColorEdges G rho1 + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime) gamma, + Incident G u0 g ∧ Sum.inr g ∈ exitPath0.support) ∧ + ¬ Incident G u0 fN ∧ + ∃ beta0 : Fin k, + beta0 ∈ MissingColors G rho1 u0 ∧ + beta0 ∉ supportColors ∧ + ∃ (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition0 : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1)), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition0 = + z0 ∧ + seed.length ≤ zPosition0.val ∧ + ((seed.length < zPosition0.val ∧ + beta0 ∈ MissingColors G rho1 z0 ∧ + ∀ r : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1), + seed.length < r.val → r.val < zPosition0.val → + beta0 ∉ MissingColors G rho1 + ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∨ + (zPosition0 = Fin.last + (ett.series.data.tree jSlot.succ.castSucc).length ∧ + ∀ r : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1), + seed.length < r.val → + beta0 ∉ MissingColors G rho1 + ((ett.series.data.tree jSlot.succ.castSucc).vertex r))) ∧ + (∀ y ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) z0 hz0, + beta0 ∉ MissingColors G rho1 y) ∧ + (∀ a : Fin + (ett.series.data.tree jSlot.succ.castSucc).length, + seed.length ≤ a.val → a.val < zPosition0.val → + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ + some beta0) ∧ + ∃ rho3 : PartialEdgeColoring E k, + IsProperEdgeColoring G rho3 ∧ + IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho3 ∧ + (∀ y : V, + y ∈ (((TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ + {z0}) ∪ + (TreeVerticesBefore TjPrime u0 huPrime0 ∪ + {u0})).erase u0).erase z0 → + MissingColors G rho3 y = MissingColors G rho1 y) ∧ + (∀ f : E, + ((∃ a : Fin + (ett.series.data.tree jSlot.succ.castSucc).length, + seed.length ≤ a.val ∧ a.val < zPosition0.val ∧ + (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + (∃ (a : Fin TjPrime.length) + (uPosition : Fin (TjPrime.length + 1)), + TjPrime.vertex uPosition = u0 ∧ + a.val < uPosition.val ∧ TjPrime.edge a = f)) → + rho3 f = rho1 f) ∧ + (beta0 ∈ MissingColors G rho1 z0 → + delta ∈ MissingColors G rho3 z0) ∧ + (z0 ∈ TreeVerticesBefore TjPrime u0 huPrime0 → + MissingColors G rho3 z0 = MissingColors G rho1 z0) ∧ + gammaFirst ∈ MissingColors G rho3 u0 := by + exact @helper_hclaim45Package_7169 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@hterminalJ) (@p0) (@indices0) (@gamma0) (@hrho1Proper) (@hrho1One) (@hb2Missing) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) + (@hseedTerminal) (@hTjQ) (@TjPrime) (@hclosure) (@hprimeElementary) (@hseedPrime) + (@hb1Tj) (@hcaseTwoPointwise) (@hgammaSupport) (@hdeltaSupport) (@hgammaDelta) + (@hb2EdgesFromSeed) (@hdeltaPhiJ) (@hterminalSeed) (@fN) (@hdeltaMissing) (@a) (@x) + (@componentPath) (@hcomponentPath) (@hcomponentSupport) (@hxOutside) (@u) (@exitPath) + (@hexitPath) (@hexitLength) (@hexitSupport) (@hexitIntersection) (@hexitBoundary) + (@huNotFN) (@huPrime) (@huOutside) (@hdegree) (@beta) (@hbeta) (@hbetaSupport) + (@haugmentation) (@z) (@hz) (@zPosition) (@hzPosition) (@hzAfter) (@hzChoice) (@hzBefore) + (@hzEdges) (@hpositiveClaim45) (@hgammaFirstZero) + exact @helper_continuation_12157 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@segmentTrans) (@vertexTransfer) (@trace) + (@hterminalJ) (@p0) (@indices0) (@gamma0) (@delta0) (@hb2Missing) (@hb2TreeEdges) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@hseedTerminal) (@hTjQ) (@hseedVertexBefore) (@segmentVertexBefore) + (@transportSeedRoute) (@commonPrefix) (@TjPrime) (@hclosure) (@hprimeElementary) + (@hseedPrime) (@hterminalPrime) (@hqLast) (@hterminalInclusion) (@hb2EdgesFromSeed) + (@hterminalSeed) (@hseedN) (@fN) (@hdeltaMissing) (@a) (@b) (@x) (@componentPath) (@u) + (@exitPath) (@hpreviousTj) (@hpreviousStrict) (@hpreviousSeed) (@haugmentation) + (@zPosition) (@hclaim45Package) + +theorem helper_continuation_11325.{u_1, u_2} : + helperContinuation11325Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma + hsigmaProper hsigmaOne this q hqTerminal hqGamma hqDelta hvStage hvFinal hfirstUpper + hfirstPositive jSlot hjSlot segmentTrans stageToStage vertexTransfer trace hterminalJ p0 + indices0 gamma0 delta0 hincreasing0 hclass0 hgamma0 hdelta0 hchain0 hinjective0 rho1 + hrho1Proper hrho1One hb2Missing hb2TreeEdges hb3EdgeEffects terminalPosition + hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj hseedTerminal + hTjQ hseedVertexBefore segmentVertexBefore transportSeedRoute commonPrefix supportColors + TjPrime hclosure hprimeElementary hseedPrime hterminalPrime hqLast hsupport0 hkind0 + hstored0 hb1Tj hcaseTwoPointwise hsupportSet hterminalClass hgammaLast gammaFirst + hgammaSupport hdeltaSupport hgammaFirstSupport hgammaDelta restorationColors + hterminalColorsNotRestored hsupportColors hdeltaEarlier hpreterminalPackage hb4Earlier + hsupportComponentOrder hterminalInclusion hb2EdgesFromSeed hdeltaPhiJ hterminalSeed hseedN + fN hfNterminal hphiNProper hphiNOne hgammaBoundary hdeltaLocation hdeltaMissing + hterminalIntersection' controlled hgammaControlled hdeltaControlled hsigmaControlled H C a + b x componentPath hcomponentPath hcomponentSupport hxOutside htwoN u exitPath hexitPath + hexitLength hexitSupport hexitIntersection hexitBoundary huNotFN huPrime huOutside hdegree + beta hbeta huErase hbetaSupport Tprevious hpreviousTj hpreviousStrict hpreviousSeed + haugmentation z hz zPosition hzPosition hzAfter hzChoice hzBefore hzEdges + have hcaseTwoObservationPackage : + (u ∈ TreeSequenceVertexSet TjPrime ∧ + u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) ∧ + (exitPath.IsPath ∧ 2 ≤ exitPath.length ∧ + (∀ y : Sum V E, y ∈ exitPath.support → + y ∈ componentPath.support) ∧ + (∀ y : V, + y ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime → + (Sum.inl y ∈ exitPath.support ↔ y = u)) ∧ + (∃ g ∈ BoundaryColorEdges G rho1 + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime) gamma, + Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬ Incident G u fN) ∧ + (beta ∈ MissingColors G rho1 u ∧ beta ∉ supportColors) ∧ + (z ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) ∧ + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z ∧ + seed.length ≤ zPosition.val ∧ + ((seed.length < zPosition.val ∧ + beta ∈ MissingColors G rho1 z ∧ + ∀ r : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1), + seed.length < r.val → r.val < zPosition.val → + beta ∉ MissingColors G rho1 + ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∨ + (zPosition = Fin.last + (ett.series.data.tree jSlot.succ.castSucc).length ∧ + ∀ r : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1), + seed.length < r.val → + beta ∉ MissingColors G rho1 + ((ett.series.data.tree jSlot.succ.castSucc).vertex r))) ∧ + (∀ y ∈ TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) z hz, + beta ∉ MissingColors G rho1 y) ∧ + ∀ a : Fin (ett.series.data.tree jSlot.succ.castSucc).length, + seed.length ≤ a.val → a.val < zPosition.val → + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ + some beta) := by + exact @helper_hcaseTwoObservationPackage_7053 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@fN) (@x) (@componentPath) (@u) (@exitPath) + (@hexitPath) (@hexitLength) (@hexitSupport) (@hexitIntersection) (@hexitBoundary) + (@huNotFN) (@huPrime) (@huOutside) (@beta) (@hbeta) (@hbetaSupport) (@z) (@hz) + (@zPosition) (@hzPosition) (@hzAfter) (@hzChoice) (@hzBefore) (@hzEdges) + have hpreterminalGammaPresent : ∀ (u : V) (beta : Fin k), + u ∈ TreeSequenceVertexSet TjPrime → + u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + beta ∈ MissingColors G rho1 u → + ∀ a : Fin p0, + gamma0 a.castSucc ∈ PresentColors G + (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta delta) + gamma beta (Sum.inl u)) u := by + exact @helper_hpreterminalGammaPresent_7105 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@hchain0) + (@hinjective0) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@TjPrime) (@hstored0) (@hcaseTwoPointwise) (@hgammaLast) (@a) (@x) (@componentPath) (@u) + (@exitPath) (@huErase) (@zPosition) + have hTjInitialEarlier : ∀ s : Fin ett.rounds, + s ∈ (ExtensionBaseSupportClass ett v hvFinal v).erase q → + TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree s.succ.castSucc) := by + exact @helper_hTjInitialEarlier_7122 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) + (@stageToStage) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hqLast) (@x) (@componentPath) + (@u) (@exitPath) (@zPosition) + have hpositiveClaim45 (hp0 : 0 < p0) := + let hpreterminal := hpreterminalPackage hp0 + let preterminalSlot := Classical.choose hpreterminal + ExtensionBaseClaim45 ett q preterminalSlot jSlot hqTerminal + (Classical.choose_spec hpreterminal).1 v hvFinal + (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) seed TjPrime + (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.coloring q.succ) sigma rho1 + (TashkinovStoredColors ett.series.data jSlot.castSucc) + controlled restorationColors supportColors gammaFirst gamma delta + fN x componentPath hphiNProper hphiNOne hsigmaProper hsigmaOne + hrho1Proper hrho1One hTjQ hseedTj hseedPrime hseedTerminal + hterminalJ hterminalSeed hclosure hprimeElementary + hcaseTwoPointwise hterminalIntersection' hgammaSupport + hdeltaSupport hgammaFirstSupport hgammaDelta hsigmaControlled + hgammaControlled hdeltaControlled + (fun f hf => hb3EdgeEffects f hf) + hterminalColorsNotRestored.1 hterminalColorsNotRestored.2 + hgammaBoundary hdeltaLocation hdeltaMissing hcomponentPath + (by simpa [C] using hcomponentSupport) hxOutside htwoN hfNterminal + hb1Tj hb2Missing.1 hterminalInclusion haugmentation + hb2EdgesFromSeed hdeltaPhiJ hsupportSet hterminalClass + (Classical.choose_spec hpreterminal).2.1 + (Classical.choose_spec hpreterminal).2.2 hqGamma hqDelta hb4Earlier + hsupportColors hdeltaEarlier hsupportComponentOrder p0 indices0 + gamma0 delta0 hincreasing0 hclass0 hqLast hsupport0 hkind0 + hgamma0 hdelta0 hstored0 hchain0 hinjective0 rfl + hTjInitialEarlier rfl hpreterminalGammaPresent + have hgammaFirstZero (hp0 : p0 = 0) : gammaFirst = gamma := by + exact @helper_hpositiveClaim45_7133 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hgammaLast) (@x) (@componentPath) (@u) (@exitPath) + (@zPosition) (@hp0) + exact @helper_continuation_8265 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@segmentTrans) (@vertexTransfer) (@trace) + (@hterminalJ) (@p0) (@indices0) (@gamma0) (@delta0) (@hrho1Proper) (@hrho1One) + (@hb2Missing) (@hb2TreeEdges) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@hseedTerminal) (@hTjQ) + (@hseedVertexBefore) (@segmentVertexBefore) (@transportSeedRoute) (@commonPrefix) + (@TjPrime) (@hclosure) (@hprimeElementary) (@hseedPrime) (@hterminalPrime) (@hqLast) + (@hb1Tj) (@hcaseTwoPointwise) (@hgammaSupport) (@hdeltaSupport) (@hgammaDelta) + (@hterminalInclusion) (@hb2EdgesFromSeed) (@hdeltaPhiJ) (@hterminalSeed) (@hseedN) (@fN) + (@hdeltaMissing) (@a) (@b) (@x) (@componentPath) (@hcomponentPath) (@hcomponentSupport) + (@hxOutside) (@u) (@exitPath) (@hexitPath) (@hexitLength) (@hexitSupport) + (@hexitIntersection) (@hexitBoundary) (@huNotFN) (@huPrime) (@huOutside) (@hdegree) (@beta) + (@hbeta) (@hbetaSupport) (@hpreviousTj) (@hpreviousStrict) (@hpreviousSeed) + (@haugmentation) (@z) (@hz) (@zPosition) (@hzPosition) (@hzAfter) (@hzChoice) (@hzBefore) + (@hzEdges) (@hpositiveClaim45) (@hgammaFirstZero) +private theorem helper_continuation_7187.{u_1, u_2} : + helperContinuation7187Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma + hsigmaProper hsigmaOne this q hqTerminal hqGamma hqDelta hvStage hvFinal hfirstUpper + hfirstPositive jSlot hjSlot segmentTrans stageToStage vertexTransfer trace hterminalJ p0 + indices0 gamma0 delta0 hincreasing0 hclass0 hgamma0 hdelta0 hchain0 hinjective0 rho1 + hrho1Proper hrho1One hb2Missing hb2TreeEdges hb3EdgeEffects terminalPosition + hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj hseedTerminal + hTjQ hseedVertexBefore segmentVertexBefore transportSeedRoute commonPrefix supportColors + TjPrime hclosure hprimeElementary hseedPrime hterminalPrime hqLast hsupport0 hkind0 + hstored0 hb1Tj hcaseTwoPointwise hsupportSet hterminalClass hgammaLast gammaFirst + hgammaSupport hdeltaSupport hgammaFirstSupport hgammaDelta restorationColors + hterminalColorsNotRestored hsupportColors hdeltaEarlier hpreterminalPackage hb4Earlier + hsupportComponentOrder hterminalInclusion hb2EdgesFromSeed hdeltaPhiJ hterminalSeed hseedN + fN hfNterminal hphiNProper hphiNOne hgammaBoundary hdeltaLocation hdeltaMissing + hterminalIntersection' controlled hgammaControlled hdeltaControlled hsigmaControlled H C a + b x componentPath hcomponentPath hcomponentSupport hxOutside htwoN u exitPath hexitPath + hexitLength hexitSupport hexitIntersection hexitBoundary huNotFN huPrime huOutside hdegree + beta hbeta huErase hbetaSupport hbetaGammaFirst hbetaTerminal huSeed Tprevious hpreviousTj + hpreviousStrict + have hpreviousSeed (hjPositive : 0 < jSlot.val) : + TreeSequenceInitialSegment Tprevious seed := + commonPrefix (hpreviousTj hjPositive) hseedTj + (Nat.le_of_lt (hpreviousStrict hjPositive)) + have haugmentation : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) seed + (ett.series.data.tree jSlot.succ.castSucc) := by as_aux_lemma => + generalize htarget : jSlot.castSucc = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact @helper_branch_6740 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@commonPrefix) + (@seedLength) (@initialClosure) (@htarget) + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_6748 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@commonPrefix) (@x) + (@componentPath) (@u) (@exitPath) (@hpreviousStrict) (@i) (@choice) (@adjoined) + (@adjoinedExactly) (@closedExtension) (@htarget) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_6761 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@x) (@componentPath) (@u) + (@exitPath) (@hpreviousSeed) (@i) (@closedExtension) (@htarget) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_6775 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@commonPrefix) (@x) + (@componentPath) (@u) (@exitPath) (@hpreviousStrict) (@i) (@available) + (@adjoined) (@adjoinedExactly) (@closedExtension) (@htarget) + obtain ⟨z, hz, zPosition, hzPosition, hzAfter, + hzChoice, hzBefore, hzEdges⟩ := + ExtensionBaseCaseTwoObservation23 + (ett.series.data.tree jSlot.succ.castSucc) seed TjPrime + (ett.series.data.coloring jSlot.castSucc) rho1 v u beta gammaFirst + hseedTj hseedPrime hseedTerminal huPrime huSeed hprimeElementary + hbeta hterminalSeed hb2Missing.1 hbetaTerminal hterminalInclusion + hbetaGammaFirst haugmentation hb2EdgesFromSeed + exact @helper_continuation_11325 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hqTerminal) + (@hqGamma) (@hqDelta) (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) + (@segmentTrans) (@stageToStage) (@vertexTransfer) (@trace) (@hterminalJ) (@p0) (@indices0) + (@gamma0) (@delta0) (@hincreasing0) (@hclass0) (@hgamma0) (@hdelta0) (@hchain0) + (@hinjective0) (@hrho1Proper) (@hrho1One) (@hb2Missing) (@hb2TreeEdges) (@hb3EdgeEffects) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@hseedTerminal) (@hTjQ) (@hseedVertexBefore) (@segmentVertexBefore) + (@transportSeedRoute) (@commonPrefix) (@TjPrime) (@hclosure) (@hprimeElementary) + (@hseedPrime) (@hterminalPrime) (@hqLast) (@hsupport0) (@hkind0) (@hstored0) (@hb1Tj) + (@hcaseTwoPointwise) (@hsupportSet) (@hterminalClass) (@hgammaLast) (@hgammaSupport) + (@hdeltaSupport) (@hgammaFirstSupport) (@hgammaDelta) (@hterminalColorsNotRestored) + (@hsupportColors) (@hdeltaEarlier) (@hpreterminalPackage) (@hb4Earlier) + (@hsupportComponentOrder) (@hterminalInclusion) (@hb2EdgesFromSeed) (@hdeltaPhiJ) + (@hterminalSeed) (@hseedN) (@fN) (@hfNterminal) (@hphiNProper) (@hphiNOne) + (@hgammaBoundary) (@hdeltaLocation) (@hdeltaMissing) (@hterminalIntersection') + (@hgammaControlled) (@hdeltaControlled) (@hsigmaControlled) (@a) (@b) (@x) (@componentPath) + (@hcomponentPath) (@hcomponentSupport) (@hxOutside) (@htwoN) (@u) (@exitPath) (@hexitPath) + (@hexitLength) (@hexitSupport) (@hexitIntersection) (@hexitBoundary) (@huNotFN) (@huPrime) + (@huOutside) (@hdegree) (@beta) (@hbeta) (@huErase) (@hbetaSupport) (@hpreviousTj) + (@hpreviousStrict) (@hpreviousSeed) (@haugmentation) (@z) (@hz) (@zPosition) (@hzPosition) + (@hzAfter) (@hzChoice) (@hzBefore) (@hzEdges) + +theorem helper_continuation_10517.{u_1, u_2} : + helperContinuation10517Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma + hsigmaProper hsigmaOne w hw hwNe this q hqTerminal hqSucc hqKind hqVertex hqGamma hqDelta + hvStage hvFinal hfirstUpper hfirstPositive jSlot hjSlot hsigmaTerminal segmentTrans + stepSegment stageToStage vertexTransfer hdeltaExclusion trace hterminalJ hqActive p0 + indices0 gamma0 delta0 hincreasing0 hclass0 hgamma0 hdelta0 hchain0 hinjective0 rho1 + hrho1Proper hrho1One hb2Missing hb2TreeEdges hb3EdgeEffects terminalPosition hterminalAt + hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj hseedTerminal + hTjQ hseedVertexBefore segmentVertexBefore transportSeedRoute commonPrefix supportColors + TjPrime hclosure hprimeElementary hseedPrime hterminalPrime hqLast hsupport0 hkind0 + hstored0 hb1Tj hcaseTwoPointwise hsupportSet hterminalClass hgammaLast gammaFirst + hgammaSupport hdeltaSupport hgammaFirstSupport hgammaDelta restorationColors + hterminalColorsNotRestored hsupportColors hdeltaEarlier hpreterminalPackage hb4Earlier + hsupportComponentOrder hterminalInclusion hb2EdgesFromSeed hdeltaPhiJ hterminalSeed hseedN + fN hfNterminal hphiNProper hphiNOne hgammaBoundary hdeltaLocation hdeltaMissing + hterminalIntersection' controlled hgammaControlled hdeltaControlled hsigmaControlled + hgammaBoundaryRho hdeltaBoundaryRho hterminalGraph hwComponentRho H C a b x componentPath + hcomponentPath hcomponentSupport hcomponentNonempty hcomponentPositive hendpointC + hendpointNeighbor + have hxNe : x ≠ v := by + exact @helper_hxNe_3545 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@v) (@gamma) (@delta) (@sigma) (@hvFinal) + (@trace) (@x) (@componentPath) (@hcomponentPath) (@hcomponentSupport) + (@hcomponentNonempty) (@hcomponentPositive) (@hendpointC) (@hendpointNeighbor) + have swapBothPresent (phi : PartialEdgeColoring E k) + (alpha beta : Fin k) (hne : alpha ≠ beta) (root : Sum V E) + (y : V) (halpha : alpha ∈ PresentColors G phi y) + (hbeta : beta ∈ PresentColors G phi y) : + alpha ∈ PresentColors G + (TwoColorComponentSwap G phi alpha beta root) y ∧ + beta ∈ PresentColors G + (TwoColorComponentSwap G phi alpha beta root) y := by + exact @helper_swapBothPresent_4143 (@V) (@E) inferInstance inferInstance (@G) (@k) (@phi) + (@alpha) (@beta) (@hne) (@root) (@y) (@halpha) (@hbeta) + have hTnElementary : ColoredVertexSetElementary G + (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) := by + exact @helper_hTnElementary_6609 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hqLast) (@x) (@componentPath) + have hgammaMissingPre : gamma ∈ MissingColors G + (ett.series.data.coloring q.castSucc) v := by + exact @helper_hgammaMissingPre_4237 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@hqKind) (@hqVertex) (@hqGamma) + have hdeltaNotMissingPre : delta ∉ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) := + (hdeltaExclusion.1 q q v v hvFinal hvFinal delta gamma hqActive + hqActive le_rfl hqVertex hqVertex hqDelta hqGamma).1 + have hterminalPresentSigma : ∀ y : V, + y ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + y ≠ v → + gamma ∈ PresentColors G sigma y ∧ + delta ∈ PresentColors G sigma y := by + exact @helper_hterminalPresentSigma_6628 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqKind) (@hqVertex) (@hqGamma) (@hqDelta) (@hvStage) (@hsigmaTerminal) + (@hgammaDelta) (@swapBothPresent) (@hTnElementary) (@hgammaMissingPre) + (@hdeltaNotMissingPre) + have hxOutsideN : x ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + exact @helper_hxOutsideN_4382 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hvFinal) (@trace) (@hgammaDelta) (@hterminalGraph) (@x) (@componentPath) + (@hendpointNeighbor) (@hxNe) (@hterminalPresentSigma) + have hxOutsidePrime : x ∉ TreeSequenceVertexSet TjPrime := by + exact @helper_hxOutsidePrime_6645 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@gamma) (@delta) (@sigma) (@hvFinal) + (@trace) (@p0) (@indices0) (@TjPrime) (@hcaseTwoPointwise) (@hgammaSupport) + (@hdeltaSupport) (@hgammaDelta) (@x) (@componentPath) (@hendpointNeighbor) (@hxNe) + have hxOutside : x ∉ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime := by + intro hx + rcases Finset.mem_union.mp hx with hx | hx + · exact hxOutsideN hx + · exact hxOutsidePrime hx + have hwPath : Sum.inl w ∈ componentPath.support := by + change Sum.inl w ∈ {z | z ∈ componentPath.support} + rw [hcomponentSupport] + exact hwComponentRho + have hwStage : w ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + rw [hqSucc] + exact hw + have htwoN : ∃ y ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc), + y ≠ v ∧ Sum.inl y ∈ componentPath.support := + ⟨w, hwStage, hwNe, hwPath⟩ + obtain ⟨u, exitPath, huDiff, hexitPath, hexitLength, + hexitSupport, hexitIntersection, hexitBoundary, huNotFN⟩ := + ExtensionBaseCaseTwoObservation21 + (ett.series.data.tree q.succ.castSucc) TjPrime rho1 gamma delta + fN v x componentPath hcomponentPath (by simpa [C] using + hcomponentSupport) hvStage hterminalPrime hxOutside htwoN + hgammaBoundaryRho hdeltaBoundaryRho hfNterminal + have huPrime : u ∈ TreeSequenceVertexSet TjPrime := + (Finset.mem_sdiff.mp huDiff).1 + have huOutside : u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := + (Finset.mem_sdiff.mp huDiff).2 + have hdegree : MaximumDegree G + 1 ≤ k := by + have step := ett.series.certified 0 + cases step with + | initial triple => exact triple.2.2.1 + obtain ⟨beta, hbeta⟩ := + MissingColorsNonemptyOfMaximumDegree G rho1 hdegree u + have huTerminal : u ≠ v := by + intro huv + apply huOutside + simpa [huv] using hvStage + have huErase : u ∈ (TreeSequenceVertexSet TjPrime).erase v := + Finset.mem_erase.mpr ⟨huTerminal, huPrime⟩ + have hbetaSupport : beta ∉ supportColors := by + exact @helper_hbetaSupport_3628 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@sigma) (@hvFinal) (@trace) (@p0) + (@indices0) (@TjPrime) (@hcaseTwoPointwise) (@u) (@beta) (@hbeta) (@huErase) + have hbetaGammaFirst : beta ≠ gammaFirst := by + intro hEq + exact hbetaSupport (hEq ▸ hgammaFirstSupport) + have hbetaTerminal : beta ∉ MissingColors G rho1 v := by + intro hbetaV + have hdisjoint := hprimeElementary huPrime hterminalPrime huTerminal + exact (Finset.disjoint_left.mp hdisjoint) hbeta hbetaV + have huSeed : u ∉ TreeSequenceVertexSet seed := by + intro hu + exact huOutside (vertexTransfer hseedN hu) + let Tprevious : TreeSequence G e0 := + ett.series.data.tree jSlot.castSucc.castSucc + have hvNotPrevious (hjPositive : 0 < jSlot.val) : + v ∉ TreeSequenceVertexSet Tprevious := by + exact @helper_hvNotPrevious_6710 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@trace) + (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hqLast) (@x) (@componentPath) + (@u) (@exitPath) (@hjPositive) + have hpreviousTj (hjPositive : 0 < jSlot.val) : + TreeSequenceInitialSegment Tprevious + (ett.series.data.tree jSlot.succ.castSucc) := by + have hstep := stepSegment jSlot.castSucc (by simpa using hjPositive) + rw [hjTreeIndex] at hstep + exact hstep + have hpreviousStrict (hjPositive : 0 < jSlot.val) : + Tprevious.length < seed.length := by + exact @helper_hpreviousStrict_6723 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalAt) + (@hterminalPositionPositive) (@hterminalPositionBound) (@x) (@componentPath) (@u) + (@exitPath) (@hvNotPrevious) (@hpreviousTj) (@hjPositive) + exact @helper_continuation_7187 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hqTerminal) + (@hqGamma) (@hqDelta) (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) + (@segmentTrans) (@stageToStage) (@vertexTransfer) (@trace) (@hterminalJ) (@p0) (@indices0) + (@gamma0) (@delta0) (@hincreasing0) (@hclass0) (@hgamma0) (@hdelta0) (@hchain0) + (@hinjective0) (@hrho1Proper) (@hrho1One) (@hb2Missing) (@hb2TreeEdges) (@hb3EdgeEffects) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@hseedTerminal) (@hTjQ) (@hseedVertexBefore) (@segmentVertexBefore) + (@transportSeedRoute) (@commonPrefix) (@TjPrime) (@hclosure) (@hprimeElementary) + (@hseedPrime) (@hterminalPrime) (@hqLast) (@hsupport0) (@hkind0) (@hstored0) (@hb1Tj) + (@hcaseTwoPointwise) (@hsupportSet) (@hterminalClass) (@hgammaLast) (@hgammaSupport) + (@hdeltaSupport) (@hgammaFirstSupport) (@hgammaDelta) (@hterminalColorsNotRestored) + (@hsupportColors) (@hdeltaEarlier) (@hpreterminalPackage) (@hb4Earlier) + (@hsupportComponentOrder) (@hterminalInclusion) (@hb2EdgesFromSeed) (@hdeltaPhiJ) + (@hterminalSeed) (@hseedN) (@fN) (@hfNterminal) (@hphiNProper) (@hphiNOne) + (@hgammaBoundary) (@hdeltaLocation) (@hdeltaMissing) (@hterminalIntersection') + (@hgammaControlled) (@hdeltaControlled) (@hsigmaControlled) (@a) (@b) (@x) (@componentPath) + (@hcomponentPath) (@hcomponentSupport) (@hxOutside) (@htwoN) (@u) (@exitPath) (@hexitPath) + (@hexitLength) (@hexitSupport) (@hexitIntersection) (@hexitBoundary) (@huNotFN) (@huPrime) + (@huOutside) (@hdegree) (@beta) (@hbeta) (@huErase) (@hbetaSupport) (@hbetaGammaFirst) + (@hbetaTerminal) (@huSeed) (@hpreviousTj) (@hpreviousStrict) +theorem helper_caseContinuation_10866.{u_1, u_2} : + helperCaseContinuation10866Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma + hsigmaProper hsigmaOne w hw hwComponent hwNe this q hqTerminal hqSucc hqKind hqVertex + hqGamma hqDelta hvStage hvFinal hfirstUpper hfirstPositive jSlot hjSlot hsigmaTerminal + segmentTrans stepSegment stageToStage vertexTransfer hdeltaExclusion hPEStored trace + hterminalJ hqActive p0 indices0 gamma0 delta0 hincreasing0 hclass0 hgamma0 hdelta0 hchain0 + hinjective0 rho1 hrho1Proper hrho1One hb2Missing hb2TreeEdges hb3EdgeEffects + terminalPosition hterminalAt hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj hseedTerminal hTjQ hseedVertexBefore segmentVertexBefore + transportSeedRoute commonPrefix supportColors TjPrime hclosure hprimeElementary hseedPrime + hterminalPrime hqLast hsupport0 hkind0 hstored0 hterminalIntersection hb1Tj + hcaseTwoPointwise hsupportSet hterminalClass hgammaLast hdeltaLast gammaFirst hgammaSupport + hdeltaSupport hgammaFirstSupport hgammaDelta restorationColors hterminalColorsNotRestored + hsupportColors hdeltaEarlier hpreterminalPackage hb4Earlier hsupportComponentOrder + hterminalInclusion hb2EdgesFromSeed hdeltaPhiJ hterminalSeed hseedN fN hfNEdges hfNterminal + hphiNProper hphiNOne + have hboundaryStructure := HkuParallelBoundaryStructure G k ett.rounds + e0 input ett.series q fN delta gamma v hqKind hfNEdges hqDelta + hqGamma hqVertex + have hgammaBoundary : BoundaryColorEdges G + (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) gamma = + {fN} := hboundaryStructure.1 + have hdeltaLocation : ∀ f ∈ BoundaryColorEdges G + (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) delta, + ∃ y ∈ TreeSequenceVertexSet seed, Incident G y f := by + exact @helper_hdeltaLocation_6440 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@gamma0) + (@delta0) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hseedTerminal) (@hseedN) (@fN) (@hboundaryStructure) + have hdeltaMissing : delta ∈ MissingColors G rho1 v := by + have hmember : delta ∈ MissingColors G rho1 v ∩ supportColors := by + rw [hterminalIntersection, hdeltaLast] + simp + exact (Finset.mem_inter.mp hmember).1 + have hterminalIntersection' : + MissingColors G rho1 v ∩ supportColors = {delta} := by + simpa [hdeltaLast] using hterminalIntersection + obtain ⟨hprimeMissingColors, hprimeAppendedEdges⟩ := + ExtensionBaseCaseTwoObservation19 rho1 seed TjPrime v supportColors + delta hclosure hterminalPrime hcaseTwoPointwise + hterminalIntersection' + let controlled : Finset (Fin k) := + TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.succ + have hterminalRawStored : ett.series.data.stored q.succ = + {gamma, delta} := + hPEStored q gamma delta hqKind hqGamma hqDelta + have hterminalColorControlled : ∀ c : Fin k, + c ∈ ({gamma, delta} : Finset (Fin k)) → c ∈ controlled := by + exact @helper_hterminalColorControlled_2850 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@gamma) (@delta) (@hterminalRawStored) + have hgammaControlled : gamma ∈ controlled := + hterminalColorControlled gamma (by simp) + have hdeltaControlled : delta ∈ controlled := + hterminalColorControlled delta (by simp) + have hsigmaControlled : StableColoring + (ett.series.data.tree q.succ.castSucc) controlled + (ett.series.data.coloring q.succ) sigma := by + exact @helper_hsigmaControlled_2871 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@hsigmaTerminal) + obtain ⟨hgammaBoundaryRho, hdeltaBoundaryRho⟩ := + ExtensionBaseCaseTwoObservation20 + (ett.series.data.tree q.succ.castSucc) seed TjPrime + (ett.series.data.coloring q.succ) sigma rho1 controlled + restorationColors gamma delta fN v hphiNProper hphiNOne hsigmaProper + hsigmaOne hrho1Proper hrho1One hsigmaControlled hgammaControlled + hdeltaControlled (fun f hf => (hb3EdgeEffects f hf).2) + hterminalColorsNotRestored.1 hterminalColorsNotRestored.2 + hgammaBoundary hdeltaLocation hseedN hseedTerminal hclosure + hterminalSeed hdeltaMissing + have hterminalEdgeValues : ∀ f : E, + (sigma f = some gamma ∨ sigma f = some delta) ↔ + (rho1 f = some gamma ∨ rho1 f = some delta) := by + exact @helper_hterminalEdgeValues_3881 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@hb3EdgeEffects) (@hterminalColorsNotRestored) + have hterminalGraph : + TwoColorIncidenceGraph G sigma gamma delta = + TwoColorIncidenceGraph G rho1 gamma delta := by + apply SimpleGraph.ext + funext a b + cases a <;> cases b <;> + simp [TwoColorIncidenceGraph, hterminalEdgeValues] + have hwComponentRho : Sum.inl w ∈ + TwoColorComponent G rho1 gamma delta (Sum.inl v) := by + unfold TwoColorComponent + rw [← hterminalGraph] + exact hwComponent + let H := TwoColorIncidenceGraph G rho1 gamma delta + let C := TwoColorComponent G rho1 gamma delta (Sum.inl v) + have hfNBoundaryRho : fN ∈ BoundaryColorEdges G rho1 + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + gamma := by + rw [hgammaBoundaryRho] + simp + have hfNColorRho : rho1 fN = some gamma := + (Finset.mem_filter.mp hfNBoundaryRho).2 + have hfNAdj : H.Adj (Sum.inl v) (Sum.inr fN) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v fN ∧ + (rho1 fN = some gamma ∨ rho1 fN = some delta) from + ⟨hfNterminal, Or.inl hfNColorRho⟩) + have hvDegree : @SimpleGraph.degree _ H (Sum.inl v) + (Fintype.ofFinite _) ≤ 1 := by + exact @helper_hvDegree_3468 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@v) (@gamma) (@delta) (@sigma) (@hvFinal) + (@trace) (@hrho1Proper) (@hgammaDelta) (@hdeltaMissing) + have hvSub : Set.Subsingleton (H.neighborSet (Sum.inl v)) := by + exact @helper_hvSub_3480 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@v) (@gamma) (@delta) (@sigma) (@hvFinal) + (@trace) (@hvDegree) + obtain ⟨a, b, spanningPath, hspanningPath, hspanningSupport⟩ := + TwoColorComponentSpanningPath G rho1 gamma delta hrho1Proper + (Sum.inl v) + have hvC : Sum.inl v ∈ C := by + change Sum.inl v ∈ H.connectedComponentMk (Sum.inl v) + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + have hvSpanning : Sum.inl v ∈ spanningPath.support := by + change Sum.inl v ∈ {z | z ∈ spanningPath.support} + rw [hspanningSupport] + exact hvC + have hvEndpoint : (Sum.inl v : Sum V E) = a ∨ Sum.inl v = b := by + by_contra hn + push Not at hn + exact (hspanningPath.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hvSub) hvSpanning + obtain ⟨endpoint, componentPath, hcomponentPath, hcomponentSupport⟩ : + ∃ endpoint, + ∃ componentPath : H.Walk (Sum.inl v) endpoint, + componentPath.IsPath ∧ + {z | z ∈ componentPath.support} = C := by + rcases hvEndpoint with hva | hvb + · subst a + exact ⟨b, spanningPath, hspanningPath, hspanningSupport⟩ + · exact @helper_branch_3512 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@v) (@gamma) (@delta) (@sigma) (@hvFinal) + (@trace) (@a) (@b) (@spanningPath) (@hspanningPath) (@hspanningSupport) (@hvSpanning) + (@hvb) + have hfNComponent : Sum.inr fN ∈ C := by + exact @helper_hfNComponent_3517 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@gamma) (@delta) (@sigma) + (@hvFinal) (@trace) (@fN) (@hfNAdj) + have hcomponentNonempty : ¬ componentPath.Nil := by + exact @helper_hcomponentNonempty_3523 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@gamma) (@delta) (@sigma) + (@hvFinal) (@trace) (@fN) (@endpoint) (@componentPath) (@hcomponentPath) + (@hcomponentSupport) (@hfNComponent) + have hcomponentPositive : 0 < componentPath.length := + SimpleGraph.Walk.not_nil_iff_lt_length.mp hcomponentNonempty + have hendpointC : endpoint ∈ C := by + rw [← hcomponentSupport] + change endpoint ∈ componentPath.support + simpa only [componentPath.getVert_length] using + componentPath.getVert_mem_support componentPath.length + have hendpointNeighbor : ∀ z, H.Adj endpoint z → + z = componentPath.getVert (componentPath.length - 1) := by + exact @helper_hendpointNeighbor_6578 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@hrho1Proper) (@terminalPosition) (@hvSub) (@endpoint) + (@componentPath) (@hcomponentPath) (@hcomponentSupport) (@hcomponentNonempty) + (@hcomponentPositive) (@hendpointC) + have hendpointVertex : ∃ x : V, endpoint = Sum.inl x := by + exact @helper_hendpointVertex_6586 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@endpoint) (@componentPath) + (@hcomponentPositive) (@hendpointNeighbor) + obtain ⟨x, hendpoint⟩ := hendpointVertex + subst endpoint + exact @helper_continuation_10517 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hsigmaProper) (@hsigmaOne) (@w) (@hw) (@hwNe) + (@hqTerminal) (@hqSucc) (@hqKind) (@hqVertex) (@hqGamma) (@hqDelta) (@hvStage) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@hsigmaTerminal) (@segmentTrans) (@stepSegment) + (@stageToStage) (@vertexTransfer) (@hdeltaExclusion) (@trace) (@hterminalJ) (@hqActive) + (@p0) (@indices0) (@gamma0) (@delta0) (@hincreasing0) (@hclass0) (@hgamma0) (@hdelta0) + (@hchain0) (@hinjective0) (@hrho1Proper) (@hrho1One) (@hb2Missing) (@hb2TreeEdges) + (@hb3EdgeEffects) (@terminalPosition) (@hterminalAt) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@hseedTerminal) (@hTjQ) + (@hseedVertexBefore) (@segmentVertexBefore) (@transportSeedRoute) (@commonPrefix) + (@TjPrime) (@hclosure) (@hprimeElementary) (@hseedPrime) (@hterminalPrime) (@hqLast) + (@hsupport0) (@hkind0) (@hstored0) (@hb1Tj) (@hcaseTwoPointwise) (@hsupportSet) + (@hterminalClass) (@hgammaLast) (@hgammaSupport) (@hdeltaSupport) (@hgammaFirstSupport) + (@hgammaDelta) (@hterminalColorsNotRestored) (@hsupportColors) (@hdeltaEarlier) + (@hpreterminalPackage) (@hb4Earlier) (@hsupportComponentOrder) (@hterminalInclusion) + (@hb2EdgesFromSeed) (@hdeltaPhiJ) (@hterminalSeed) (@hseedN) (@fN) (@hfNterminal) + (@hphiNProper) (@hphiNOne) (@hgammaBoundary) (@hdeltaLocation) (@hdeltaMissing) + (@hterminalIntersection') (@hgammaControlled) (@hdeltaControlled) (@hsigmaControlled) + (@hgammaBoundaryRho) (@hdeltaBoundaryRho) (@hterminalGraph) (@hwComponentRho) (@a) (@b) + (@x) (@componentPath) (@hcomponentPath) (@hcomponentSupport) (@hcomponentNonempty) + (@hcomponentPositive) (@hendpointC) (@hendpointNeighbor) +private theorem helper_hmissingX_7828.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ + (_ : + ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B) + (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ + (_ : + (∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = + MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (b : Fin (p0 + (1 : ℕ))) + (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + ∀ + (_ : + (∀ + x ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ + TreeVerticesBefore TjPrime u huPrime, + MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = + MissingColors G rho1 x) ∧ + ∀ (f : E), + ((∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex z = u ∧ (↑a : ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → + traceB.coloring (Fin.last traceB.steps) f = rho1 f) + (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed U) + (_ : + MissingColors G (ett.series.data.coloring jSlot.castSucc) v ⊆ + MissingColors G rho2 v ∪ MissingColors G rho2 u), + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (M : TreeSequence G e0) (_ : u ∈ TreeSequenceVertexSet U) + (_ : + ∀ (i : Fin Tj0.length), + Tj0.vertex i.succ ∉ TreeSequenceVertexSet U → + ∃ (j : Fin M.length), + U.length ≤ (↑j : ℕ) ∧ + M.edge j = Tj0.edge i ∧ M.vertex j.succ = Tj0.vertex i.succ) + (_ : + ∀ (i j : Fin Tj0.length), + Tj0.vertex i.succ ∉ TreeSequenceVertexSet U → + Tj0.vertex j.succ ∉ TreeSequenceVertexSet U → + (↑i : ℕ) < (↑j : ℕ) → + ∀ (p q : Fin M.length), + M.vertex p.succ = Tj0.vertex i.succ → + M.vertex q.succ = Tj0.vertex j.succ → (↑p : ℕ) < (↑q : ℕ)) + (_ : TreeSequenceInitialSegment seed Tj0) (n : ℕ) (hnU : U.length ≤ n) + (hnM : n + (1 : ℕ) ≤ M.length) (hnM' : n ≤ M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + let mIndex : Fin M.length := + (⟨n, by + omega⟩ : + Fin M.length); + ∀ (i : Fin Tj0.length) (_ : M.vertex mIndex.succ = Tj0.vertex i.succ) + (_ : Tj0.vertex i.succ ∉ TreeSequenceVertexSet U) + (hiSeed : seed.length ≤ (↑i : ℕ)) (hiTj : (↑i : ℕ) < Tj0.length), + let RX : TreeSequence G e0 := + TreeSequencePrefix Tj0 (↑i : ℕ) (Nat.le_trans seed.positive hiSeed) + (Nat.le_of_lt hiTj); + ∀ (_ : TreeSequenceInitialSegment RX Tj0) (_ : RX.length = (↑i : ℕ)) + (A : TreeSequence G e0) (_ : A.length = RX.length + (1 : ℕ)) (c : Fin k) + (_ : c ∈ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) RX) + (_ : ∀ {x : V} (_ : x ∈ TreeSequenceVertexSet U), x ∈ TreeSequenceVertexSet X), + c ∈ TreeMissingColors rho2 X := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot vertexTransfer trace p0 indices0 rho1 hb2Missing + terminalPosition hterminalPositionPositive hterminalPositionBound seed TjPrime u huPrime b + traceB rho2 c2 uPosition huPositionPositive huPositionBound U hseedU hterminalInclusion Tj0 + M huU heveryNewRightEntry hrightOrder hseedTjSegment n hnU hnM hnM' X mIndex i hvertexMTj + hrightOutside hiSeed hiTj RX hRXTj hRXlen A hlenA c hmissingRX hleftX + unfold TreeMissingColors at hmissingRX ⊢ + obtain ⟨x, hxRX, hcx⟩ := + Finset.mem_biUnion.mp hmissingRX + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hxRX + obtain ⟨a, ha⟩ := hxRX + have hxTj : x ∈ TreeSequenceVertexSet Tj0 := + vertexTransfer hRXTj + (by + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + exact ⟨a, ha⟩) + have hxX : x ∈ TreeSequenceVertexSet X := by + by_cases hxU : x ∈ TreeSequenceVertexSet U + · exact hleftX hxU + · have haPos : 1 ≤ a.val := by + by_contra hzero + have haZero : a.val = 0 := by omega + let p0 : Fin (seed.length + 1) := ⟨0, by omega⟩ + have hTjp0 := hseedTjSegment.2.1 p0 + have hUp0 := hseedU.2.1 p0 + apply hxU + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + refine ⟨Fin.castLE (Nat.succ_le_succ hseedU.1) p0, ?_⟩ + have haTj : Tj0.vertex + (Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiTj)) a) = + x := by + simpa [RX, TreeSequencePrefix] using ha + have ha0 : Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiTj)) a = + Fin.castLE + (Nat.succ_le_succ hseedTjSegment.1) p0 := by + apply Fin.ext + exact haZero + rw [ha0, hTjp0] at haTj + exact hUp0.trans haTj + let r : Fin Tj0.length := ⟨a.val - 1, by + have haLt : a.val < RX.length + 1 := a.isLt + simp [RX] at haLt + omega⟩ + have hrSucc : r.succ = Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiTj)) a := by + apply Fin.ext + exact Nat.sub_add_cancel haPos + have hrv : Tj0.vertex r.succ = x := by + rw [hrSucc] + simpa [RX, TreeSequencePrefix] using ha + have hrOutside : + Tj0.vertex r.succ ∉ TreeSequenceVertexSet U := by + simpa [hrv] using hxU + have hri : r.val < i.val := by + have haLt : a.val < RX.length + 1 := a.isLt + simp [RX, r] at haLt ⊢ + omega + obtain ⟨qM, hqU, hedgeq, hvertexq⟩ := + heveryNewRightEntry r hrOutside + have hqn : qM.val < n := + hrightOrder r i hrOutside hrightOutside hri qM mIndex + hvertexq hvertexMTj + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + let qX : Fin (X.length + 1) := ⟨qM.val + 1, by + change qM.val + 1 < n + 1 + omega⟩ + refine ⟨qX, ?_⟩ + rw [← hrv, ← hvertexq] + change M.vertex _ = M.vertex qM.succ + congr 1 + by_cases hxTerminal : x = v + · have hcTerminalOld : c ∈ MissingColors G + (ett.series.data.coloring jSlot.castSucc) v := by + rw [← hxTerminal] + exact hcx + rcases Finset.mem_union.mp + (hterminalInclusion hcTerminalOld) with + hcTerminal | hcU + · exact Finset.mem_biUnion.mpr ⟨x, hxX, by + simpa [hxTerminal] using hcTerminal⟩ + · exact Finset.mem_biUnion.mpr ⟨u, hleftX huU, hcU⟩ + · refine Finset.mem_biUnion.mpr ⟨x, hxX, ?_⟩ + have hxTj' : x ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) := by + simpa [Tj0] using hxTj + rw [c2.1 x (Finset.mem_union_left _ hxTj'), + hb2Missing.1 x + (Finset.mem_erase.mpr ⟨hxTerminal, hxTj'⟩)] + exact hcx + +private theorem helper_hrightOutside_8201.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (_ : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length) + (TjPrime : TreeSequence G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (M : TreeSequence G e0) (_ : TreeSequenceInitialSegment U M) (n : ℕ) + (_ : U.length ≤ n) (hnM : n + (1 : ℕ) ≤ M.length), + let mIndex : Fin M.length := + (⟨n, by + omega⟩ : + Fin M.length); + ∀ (i : Fin Tj0.length) (_ : M.vertex mIndex.succ = Tj0.vertex i.succ), + Tj0.vertex i.succ ∉ TreeSequenceVertexSet U := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound TjPrime uPosition huPositionPositive huPositionBound U Tj0 M + hleftSegment n hnU hnM mIndex i hvertexMTj + exact @helper_hrightOutside_6001 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@uPosition) + (@huPositionPositive) (@huPositionBound) (@M) (@hleftSegment) (@n) (@hnU) (@hnM) (@i) + (@hvertexMTj) + +private theorem helper_hiSeed_8209.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed U), + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (_ : TreeSequence G e0) (_ : TreeSequenceInitialSegment seed Tj0) (_ : ℕ) + (i : Fin Tj0.length) (_ : Tj0.vertex i.succ ∉ TreeSequenceVertexSet U), + seed.length ≤ (↑i : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed TjPrime uPosition huPositionPositive huPositionBound U hseedU + Tj0 M hseedTjSegment n i hrightOutside + exact @helper_hiSeed_6009 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@uPosition) + (@huPositionPositive) (@huPositionBound) (@hseedU) (@M) (@hseedTjSegment) (@n) (@i) + (@hrightOutside) + +private theorem helper_hseedRX_8219.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (_ : TreeSequenceInitialSegment seed Tj0) (i : Fin Tj0.length) + (hiSeed : seed.length ≤ (↑i : ℕ)) (hiTj : (↑i : ℕ) < Tj0.length), + let RX : TreeSequence G e0 := + TreeSequencePrefix Tj0 (↑i : ℕ) (Nat.le_trans seed.positive hiSeed) + (Nat.le_of_lt hiTj); + TreeSequenceInitialSegment seed RX := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + Tj0 hseedTjSegment i hiSeed hiTj RX + refine ⟨hiSeed, ?_, ?_⟩ + · intro a + change Tj0.vertex _ = seed.vertex a + calc + Tj0.vertex _ = Tj0.vertex + (Fin.castLE (Nat.succ_le_succ hseedTjSegment.1) + a) := by congr 1 + _ = seed.vertex a := hseedTjSegment.2.1 a + · intro a + change Tj0.edge _ = seed.edge a + calc + Tj0.edge _ = Tj0.edge + (Fin.castLE hseedTjSegment.1 a) := by congr 1 + _ = seed.edge a := hseedTjSegment.2.2 a + +private theorem helper_hcolorTj_8249.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (_ : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (_ : (↑uPosition : ℕ) ≤ TjPrime.length), + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (_ : TreeSequence G e0) (_ : ℕ) (i : Fin Tj0.length) (hiSeed : seed.length ≤ (↑i : ℕ)) + (hiTj : (↑i : ℕ) < Tj0.length), + let RX : TreeSequence G e0 := + TreeSequencePrefix Tj0 (↑i : ℕ) (Nat.le_trans seed.positive hiSeed) + (Nat.le_of_lt hiTj); + ∀ (hRXlen : RX.length = (↑i : ℕ)) (A : TreeSequence G e0) + (hlenA : A.length = RX.length + (1 : ℕ)) (c : Fin k) + (_ : + ett.series.data.coloring jSlot.castSucc + (A.edge + (Fin.cast + (by + omega) + (Fin.last RX.length))) = + some c) + (_ : TreeSequenceInitialSegment A Tj0), + let _ : Fin A.length := + (⟨(↑i : ℕ), by + omega⟩ : + Fin A.length); + ett.series.data.coloring jSlot.castSucc (Tj0.edge i) = some c := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + TjPrime uPosition huPositionPositive huPositionBound Tj0 M n i hiSeed hiTj RX hRXlen A + hlenA c hcolorA hATjSegment ai + have haiLast : ai = + Fin.cast hlenA.symm (Fin.last RX.length) := by + apply Fin.ext + simp [ai, hRXlen] + have hTjai : Tj0.edge + (Fin.castLE hATjSegment.1 ai) = A.edge ai := + hATjSegment.2.2 ai + have hcast : Fin.castLE hATjSegment.1 ai = i := by + apply Fin.ext + simp [ai] + rw [← hcast, hTjai, haiLast] + exact hcolorA + +private theorem helper_hXY_8271.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (_ : + (∀ v_1 ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.castSucc.succ)).erase v, + MissingColors G (trace.coloring (Fin.last trace.steps)) v_1 = + MissingColors G (ett.series.data.coloring jSlot.castSucc) v_1) ∧ + MissingColors G (trace.coloring (Fin.last trace.steps)) v = + MissingColors G sigma v), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ + (_ : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) = + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = + ett.series.data.coloring jSlot.castSucc + ((ett.series.data.tree jSlot.succ.castSucc).edge a)) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (_ : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length) + (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (b : Fin (p0 + (1 : ℕ))) + (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + ∀ + (_ : + (∀ + x ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ + TreeVerticesBefore TjPrime u huPrime, + MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = + MissingColors G rho1 x) ∧ + ∀ (f : E), + ((∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex z = u ∧ (↑a : ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → + traceB.coloring (Fin.last traceB.steps) f = rho1 f) + (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (M : TreeSequence G e0) + (_ : + ∀ (A : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hrA : r + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment + (TreeSequencePrefix A r hr + (by + omega)) + (TreeSequencePrefix A (r + (1 : ℕ)) + (by + omega) + hrA)) + (n : ℕ) (hnU : U.length ≤ n) (hnM hnSuccM : n + (1 : ℕ) ≤ M.length) + (hnM' : n ≤ M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + let Y : TreeSequence G e0 := + TreeSequencePrefix M (n + (1 : ℕ)) + (Nat.le_trans U.positive (Nat.le_trans hnU (Nat.le_succ n))) hnSuccM; + let mIndex : Fin M.length := + (⟨n, by + omega⟩ : + Fin M.length); + ∀ (i : Fin Tj0.length) (_ : M.edge mIndex = Tj0.edge i) (c : Fin k) + (_ : ett.series.data.coloring jSlot.castSucc (Tj0.edge i) = some c) + (_ : c ∈ TreeMissingColors rho2 X), + TashkinovAugmentation rho2 X Y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 indices0 hb2 rho1 hb2TreeEdges terminalPosition + hterminalPositionPositive hterminalPositionBound TjPrime u huPrime b traceB rho2 c2 + uPosition huPositionPositive huPositionBound U Tj0 M prefixPrefix n hnU hnM hnSuccM hnM' X + Y mIndex i hedgeMTj c hcolorTj hmissingX + exact @helper_hXY_6159 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) (@hb2) (@hb2TreeEdges) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@u) (@huPrime) (@b) (@traceB) (@c2) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@M) (@prefixPrefix) (@n) (@hnU) (@hnM) (@hnSuccM) (@hnM') (@i) + (@hedgeMTj) (@c) (@hcolorTj) (@hmissingX) + +theorem helper_branch_15456.{u_1, u_2} : + helperBranch15456Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot vertexTransfer trace p0 indices0 hb2 rho1 hb2Missing + hb2TreeEdges terminalPosition hterminalPositionPositive hterminalPositionBound seed TjPrime + u huPrime b traceB rho2 c2 uPosition huPositionPositive huPositionBound U hseedU + hterminalInclusion Tj0 hroutePhiTj0 M huU hleftSegment hnewEntryFromRight + heveryNewRightEntry hrightOrder prefixSegment prefixPrefix hseedTjSegment firstStep n hnU + ih hnM + by_cases hnEq : n = M.length + · omega + have hnSuccM : n + 1 ≤ M.length := by omega + have hnM' : n ≤ M.length := + Nat.le_trans (Nat.le_succ n) hnSuccM + have ih' := ih hnM' + let X := TreeSequencePrefix M n + (Nat.le_trans U.positive hnU) hnM' + let Y := TreeSequencePrefix M (n + 1) + (Nat.le_trans U.positive + (Nat.le_trans hnU (Nat.le_succ n))) hnSuccM + let mIndex : Fin M.length := ⟨n, by omega⟩ + obtain ⟨i, hedgeMTj, hvertexMTj⟩ := + hnewEntryFromRight mIndex hnU + have hrightOutside : + Tj0.vertex i.succ ∉ TreeSequenceVertexSet U := by + exact @helper_hrightOutside_8201 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@uPosition) + (@huPositionPositive) (@huPositionBound) (@M) (@hleftSegment) (@n) (@hnU) (@hnM) (@i) + (@hvertexMTj) + have hiSeed : seed.length ≤ i.val := by + exact @helper_hiSeed_8209 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@uPosition) + (@huPositionPositive) (@huPositionBound) (@hseedU) (@M) (@hseedTjSegment) (@n) (@i) + (@hrightOutside) + have hiTj : i.val < Tj0.length := i.isLt + let RX := TreeSequencePrefix Tj0 i.val + (Nat.le_trans seed.positive hiSeed) (Nat.le_of_lt hiTj) + have hseedRX : TreeSequenceInitialSegment seed RX := by + exact @helper_hseedRX_8219 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTjSegment) (@i) (@hiSeed) (@hiTj) + have hRXTj : TreeSequenceInitialSegment RX Tj0 := + prefixSegment Tj0 i.val + (Nat.le_trans seed.positive hiSeed) (Nat.le_of_lt hiTj) + have hsuffix : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) RX Tj0 := + TashkinovAugmentationSequenceSuffix _ seed RX Tj0 + hroutePhiTj0 hseedRX hRXTj + have hRXlen : RX.length = i.val := rfl + obtain ⟨A, hRXA, hATj⟩ := firstStep hsuffix (by omega) + rcases hRXA with + ⟨hlenA, hRXASegment, c, hcolorA, hmissingRX⟩ + have hATjSegment : TreeSequenceInitialSegment A Tj0 := + TashkinovAugmentationSequenceInitialSegment _ _ _ hATj + have hAi : A.length = i.val + 1 := by omega + let ai : Fin A.length := ⟨i.val, by omega⟩ + have hcolorTj : + ett.series.data.coloring jSlot.castSucc (Tj0.edge i) = + some c := by + exact @helper_hcolorTj_8249 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@M) (@n) (@i) (@hiSeed) (@hiTj) (@hRXlen) (@A) (@hlenA) (@c) + (@hcolorA) (@hATjSegment) + have hleftX {x : V} (hxU : x ∈ TreeSequenceVertexSet U) : + x ∈ TreeSequenceVertexSet X := by + exact @helper_hleftX_3005 (@V) (@E) (@G) (@e0) (@TjPrime) (@uPosition) + (@huPositionPositive) (@huPositionBound) (@M) (@hleftSegment) (@n) (@hnU) + (@hnM') (@x) (@hxU) + have hmissingX : c ∈ TreeMissingColors rho2 X := by + exact @helper_hmissingX_7828 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@trace) (@p0) (@indices0) + (@hb2Missing) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@TjPrime) (@u) (@huPrime) (@b) (@traceB) (@c2) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@hseedU) (@hterminalInclusion) (@M) (@huU) (@heveryNewRightEntry) + (@hrightOrder) (@hseedTjSegment) (@n) (@hnU) (@hnM) (@hnM') (@i) (@hvertexMTj) + (@hrightOutside) (@hiSeed) (@hiTj) (@hRXTj) (@hRXlen) (@A) (@hlenA) (@c) (@hmissingRX) + (@hleftX) + have hXY : TashkinovAugmentation rho2 X Y := by + exact @helper_hXY_8271 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) (@hb2) (@hb2TreeEdges) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@u) (@huPrime) (@b) (@traceB) (@c2) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@M) (@prefixPrefix) (@n) (@hnU) (@hnM) (@hnSuccM) (@hnM') (@i) + (@hedgeMTj) (@c) (@hcolorTj) (@hmissingX) + change TashkinovAugmentationSequence rho2 U Y + exact Relation.ReflTransGen.tail ih' hXY + +private theorem helper_continuation_7819.{u_1, u_2} : + helperContinuation7819Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma + hsigmaProper hsigmaOne w hw hwComponent hwNe this q hqTerminal hqSucc hqKind hqVertex + hqGamma hqDelta hvStage hvFinal hfirstUpper hfirstPositive jSlot hjSlot hsigmaTerminal + segmentTrans stepSegment stageToStage vertexTransfer hdeltaExclusion hPEStored trace + hterminalJ hqActive p0 indices0 gamma0 delta0 hincreasing0 hclass0 hgamma0 hdelta0 hchain0 + hinjective0 rho1 hrho1Proper hrho1One hb2Missing hb2TreeEdges hb3EdgeEffects + terminalPosition hterminalAt hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj hseedTerminal hTjQ hseedVertexBefore segmentVertexBefore + transportSeedRoute commonPrefix supportColors TjPrime hclosure hprimeElementary hseedPrime + hterminalPrime hqLast hsupport0 hkind0 hstored0 hterminalIntersection hb1Tj + hcaseTwoPointwise hsupportSet hterminalClass hgammaLast hdeltaLast gammaFirst hgammaSupport + hdeltaSupport hgammaFirstSupport hgammaDelta restorationColors hterminalColorsNotRestored + hsupportColors hdeltaEarlier hpreterminalPackage hb4Earlier hsupportComponentOrder + hterminalInclusion hb2EdgesFromSeed hdeltaPhiJ hterminalSeed + have hseedN : TreeSequenceInitialSegment seed + (ett.series.data.tree q.succ.castSucc) := + segmentTrans hseedTj hTjQ + obtain ⟨fN, hfNEdges, hfNterminal, hphiNProper, hphiNOne⟩ : + ∃ fN : E, + ett.series.data.connectingEdges q.succ = {fN} ∧ + Incident G v fN ∧ + IsProperEdgeColoring G (ett.series.data.coloring q.succ) ∧ + IsOneEdgeUncolored (ett.series.data.coloring q.succ) e0 := by + generalize htarget : q.succ = target + cases ett.series.certified target with + | initial => exact (Fin.succ_ne_zero q htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_3361 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqKind) (@i) (@currentKind) (@htarget) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_3370 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqKind) (@i) (@currentKind) (@htarget) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_6417 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqVertex) (@i) + (@previousProper) (@previousOneUncolored) (@previousClosed) + (@previousNotStronglyClosed) (@noRevisiting) (@choice) (@seriesAlternativeFails) + (@actualGamma) (@gammaRule) (@secondStable) (@secondStableRelation) + (@exitWitness) (@currentColoring) (@currentProper) (@currentOneUncolored) + (@currentStored) (@currentEdges) (@currentKind) (@currentVertex) + (@currentOutside) (@currentDelta) (@currentGamma) (@closedExtension) + (@orderedExtension) (@strictExtension) (@htarget) + exact @helper_caseContinuation_10866 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hsigmaProper) (@hsigmaOne) (@w) (@hw) + (@hwComponent) (@hwNe) (@hqTerminal) (@hqSucc) (@hqKind) (@hqVertex) (@hqGamma) (@hqDelta) + (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@hsigmaTerminal) + (@segmentTrans) (@stepSegment) (@stageToStage) (@vertexTransfer) (@hdeltaExclusion) + (@hPEStored) (@trace) (@hterminalJ) (@hqActive) (@p0) (@indices0) (@gamma0) (@delta0) + (@hincreasing0) (@hclass0) (@hgamma0) (@hdelta0) (@hchain0) (@hinjective0) (@hrho1Proper) + (@hrho1One) (@hb2Missing) (@hb2TreeEdges) (@hb3EdgeEffects) (@terminalPosition) + (@hterminalAt) (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@hseedTerminal) (@hTjQ) (@hseedVertexBefore) (@segmentVertexBefore) + (@transportSeedRoute) (@commonPrefix) (@TjPrime) (@hclosure) (@hprimeElementary) + (@hseedPrime) (@hterminalPrime) (@hqLast) (@hsupport0) (@hkind0) (@hstored0) + (@hterminalIntersection) (@hb1Tj) (@hcaseTwoPointwise) (@hsupportSet) (@hterminalClass) + (@hgammaLast) (@hdeltaLast) (@hgammaSupport) (@hdeltaSupport) (@hgammaFirstSupport) + (@hgammaDelta) (@hterminalColorsNotRestored) (@hsupportColors) (@hdeltaEarlier) + (@hpreterminalPackage) (@hb4Earlier) (@hsupportComponentOrder) (@hterminalInclusion) + (@hb2EdgesFromSeed) (@hdeltaPhiJ) (@hterminalSeed) (@hseedN) (@fN) (@hfNEdges) + (@hfNterminal) (@hphiNProper) (@hphiNOne) + +theorem helper_branch_15626.{u_1, u_2} : + helperBranch15626Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma + hsigmaProper hsigmaOne w hw hwComponent hwNe this q hqTerminal hqSucc hqKind hqVertex + hqGamma hqDelta hvStage hvFinal hfirstUpper hfirstPositive jSlot hjSlot hsigmaTerminal + segmentTrans stepSegment stageToStage vertexTransfer hdeltaExclusion hPESlotData hPEStored + hpairOverlapColors trace hterminalJ hqActive hqClass p0 indices0 gamma0 delta0 hincreasing0 + hclass0 hgamma0 hdelta0 hchain0 hinjective0 hmissing0 rho1 hrho1Proper hrho1One hb2Missing + hb2TreeEdges hb3EdgeEffects hb4Interchange terminalPosition hterminalAt + hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj hseedTerminal + hTjQ hseedVertexBefore segmentVertexBefore transportSeedRoute commonPrefix supportColors + TjPrime hclosure hprimeElementary hseedPrime hterminalPrime hqLast hsupport0 hkind0 + hstored0 hterminalIntersection hdeltaAvoidsTj hb1Tj hcaseTwo + have hcaseTwoPointwise : ∀ x : V, + x ∈ (TreeSequenceVertexSet TjPrime).erase v → + MissingColors G rho1 x ∩ supportColors = ∅ := by + intro x hx + apply Finset.eq_empty_of_forall_notMem + intro c hc + have hbig : c ∈ + ((TreeSequenceVertexSet TjPrime).erase v).biUnion + (fun y => MissingColors G rho1 y) ∩ supportColors := by + exact Finset.mem_inter.mpr + ⟨Finset.mem_biUnion.mpr ⟨x, hx, (Finset.mem_inter.mp hc).1⟩, + (Finset.mem_inter.mp hc).2⟩ + rw [hcaseTwo] at hbig + simp at hbig + have hsupportSet : supportColors = + (ExtensionBaseSupportClass ett v hvFinal v).biUnion + (fun s => ett.series.data.stored s.succ) := by + exact @helper_hsupportSet_3222 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@hvFinal) (@p0) (@indices0) + (@hclass0) + have hterminalClass : q ∈ ExtensionBaseSupportClass ett v hvFinal v := + hqClass + have hgammaLast : gamma0 (Fin.last p0) = gamma := by + apply Option.some.inj + exact (hgamma0 (Fin.last p0)).symm.trans (by + rw [hqLast] + exact hqGamma) + have hdeltaLast : delta0 (Fin.last p0) = delta := by + apply Option.some.inj + exact (hdelta0 (Fin.last p0)).symm.trans (by + rw [hqLast] + exact hqDelta) + let gammaFirst : Fin k := gamma0 0 + have hgammaSupport : gamma ∈ supportColors := by + exact @helper_hgammaSupport_3247 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@gamma) (@p0) (@indices0) (@gamma0) + (@delta0) (@hstored0) (@hgammaLast) + have hdeltaSupport : delta ∈ supportColors := by + exact @helper_hdeltaSupport_3253 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@delta) (@p0) (@indices0) (@gamma0) + (@delta0) (@hstored0) (@hdeltaLast) + have hgammaFirstSupport : gammaFirst ∈ supportColors := by + exact @helper_hgammaFirstSupport_3259 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@p0) (@indices0) (@gamma0) + (@delta0) (@hstored0) + have hgammaDelta : gamma ≠ delta := + (ParallelStepRootComponentSetup ett.series q v gamma delta hqKind + hqVertex hqGamma hqDelta).1 + let restorationColors := + (ExtensionBaseRestorationIndices ett v hvFinal).biUnion + (fun s => ett.series.data.stored s.succ) + have hterminalColorsNotRestored : + gamma ∉ restorationColors ∧ delta ∉ restorationColors := by + exact @helper_hterminalColorsNotRestored_6300 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@hqTerminal) (@hqVertex) (@hqGamma) (@hqDelta) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hPESlotData) (@hPEStored) (@hpairOverlapColors) + (@hqActive) (@hqClass) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hqLast) + have hsupportColors : ∀ (s : Fin ett.rounds) + (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett v hvFinal v).erase q → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + gammaS ∈ supportColors ∧ deltaS ∈ supportColors := by + exact @helper_hsupportColors_2684 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hvFinal) + (@hPEStored) (@p0) (@indices0) (@hsupportSet) + have hdeltaEarlier : ∀ (s : Fin ett.rounds) + (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett v hvFinal v).erase q → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + delta ≠ gammaS ∧ delta ≠ deltaS := by + exact @helper_hdeltaEarlier_6317 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@delta) (@hqTerminal) + (@hqVertex) (@hqDelta) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hdeltaExclusion) + (@hqActive) (@p0) (@indices0) (@gamma0) (@delta0) (@hincreasing0) (@hclass0) (@hdelta0) + (@hinjective0) (@hqLast) (@hdeltaLast) + have hpreterminalPackage : 0 < p0 → + ∃ preterminalSlot : Fin ett.rounds, + preterminalSlot.val < q.val ∧ + preterminalSlot ∈ + (ExtensionBaseSupportClass ett v hvFinal v).erase q ∧ + ett.series.data.delta preterminalSlot.succ = some gamma := by + exact @helper_hpreterminalPackage_6328 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@gamma0) + (@delta0) (@hincreasing0) (@hclass0) (@hdelta0) (@hchain0) (@terminalPosition) (@hqLast) + (@hgammaLast) + have hb4Earlier : ∀ (s : Fin ett.rounds) + (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett v hvFinal v).erase q → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s v rho1 gammaS deltaS := by + exact @helper_hb4Earlier_3295 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hvFinal) + (@trace) (@hb4Interchange) + have hsupportComponentOrder : ∀ (s : Fin ett.rounds) + (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett v hvFinal v).erase q → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ∀ x : V, + x ∈ TreeSequenceVertexSet + (ett.series.data.tree s.succ.castSucc) → + x ≠ v → + ∀ y : V, Sum.inl y ∈ + TwoColorComponent G rho1 gammaS deltaS (Sum.inl x) → + y ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + exact @helper_hsupportComponentOrder_6348 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hqKind) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@stageToStage) (@vertexTransfer) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) + (@terminalPosition) (@hqLast) (@hb4Earlier) + have hterminalInclusion : MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ + MissingColors G rho1 v ∪ {gammaFirst} := by + exact @helper_hterminalInclusion_3322 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) + (@gamma0) (@delta0) (@hmissing0) (@hb2Missing) + have hb2EdgesFromSeed : ∀ a : Fin + (ett.series.data.tree jSlot.succ.castSucc).length, + seed.length ≤ a.val → + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) = + ett.series.data.coloring jSlot.castSucc + ((ett.series.data.tree jSlot.succ.castSucc).edge a) := by + intro a ha + exact (hb2TreeEdges a).1.trans (hb2TreeEdges a).2 + have hdeltaPhiJ : delta ∉ TreeMissingColors + (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc) := by + simpa [hdeltaLast] using hdeltaAvoidsTj (Fin.last p0) + have hterminalSeed : v ∈ TreeSequenceVertexSet seed := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.last seed.length, hseedTerminal⟩ + exact @helper_continuation_7819 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hsigmaProper) (@hsigmaOne) (@w) (@hw) + (@hwComponent) (@hwNe) (@hqTerminal) (@hqSucc) (@hqKind) (@hqVertex) (@hqGamma) (@hqDelta) + (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@hsigmaTerminal) + (@segmentTrans) (@stepSegment) (@stageToStage) (@vertexTransfer) (@hdeltaExclusion) + (@hPEStored) (@trace) (@hterminalJ) (@hqActive) (@p0) (@indices0) (@gamma0) (@delta0) + (@hincreasing0) (@hclass0) (@hgamma0) (@hdelta0) (@hchain0) (@hinjective0) (@hrho1Proper) + (@hrho1One) (@hb2Missing) (@hb2TreeEdges) (@hb3EdgeEffects) (@terminalPosition) + (@hterminalAt) (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@hseedTerminal) (@hTjQ) (@hseedVertexBefore) (@segmentVertexBefore) + (@transportSeedRoute) (@commonPrefix) (@TjPrime) (@hclosure) (@hprimeElementary) + (@hseedPrime) (@hterminalPrime) (@hqLast) (@hsupport0) (@hkind0) (@hstored0) + (@hterminalIntersection) (@hb1Tj) (@hcaseTwoPointwise) (@hsupportSet) (@hterminalClass) + (@hgammaLast) (@hdeltaLast) (@hgammaSupport) (@hdeltaSupport) (@hgammaFirstSupport) + (@hgammaDelta) (@hterminalColorsNotRestored) (@hsupportColors) (@hdeltaEarlier) + (@hpreterminalPackage) (@hb4Earlier) (@hsupportComponentOrder) (@hterminalInclusion) + (@hb2EdgesFromSeed) (@hdeltaPhiJ) (@hterminalSeed) +private theorem helper_caseContinuation_8566.{u_1, u_2} : + helperCaseContinuation8566Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot segmentTrans vertexTransfer trace + hterminalJ p0 indices0 hb2 rho1 hb2Missing hb2TreeEdges terminalPosition + hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj hseedTerminal + commonPrefix TjPrime hqLast u huPrime b traceB huOutside rho2 c1 c2 hrho2Proper hrho2One + uPosition huPosition huPositionPositive huPositionBound U hseedU hrouteRhoTwoU + hterminalInclusion Tprevious hpreviousTj hpreviousStrict hpreviousSeed hroutePhiTj + let Tj0 : TreeSequence G e0 := + ett.series.data.tree jSlot.succ.castSucc + have hroutePhiTj0 : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) seed Tj0 := by + simpa [Tj0] using hroutePhiTj + have hseedTj0 : TreeSequenceInitialSegment seed Tj0 := by + simpa [Tj0] using hseedTj + obtain ⟨M, ⟨hunion⟩⟩ := OrderedTreeUnionExists U Tj0 + have huU : u ∈ TreeSequenceVertexSet U := by + exact @helper_huU_2850 (@V) (@E) (@G) (@e0) (@TjPrime) (@u) (@uPosition) (@huPosition) + (@huPositionPositive) (@huPositionBound) + have hrouteUM : TashkinovAugmentationSequence rho2 U M := by + as_aux_lemma => + have hleftSegment := hunion.leftSegment + have hnewEntryFromRight := hunion.newEntryFromRight + have heveryNewRightEntry := hunion.everyNewRightEntry + have hrightOrder := hunion.rightOrder + have prefixSegment (A : TreeSequence G e0) (r : Nat) + (hr : 1 ≤ r) (hrA : r ≤ A.length) : + TreeSequenceInitialSegment + (TreeSequencePrefix A r hr hrA) A := by + exact @helper_prefixSegment_2868 (@V) (@E) (@G) (@e0) (@A) (@r) (@hr) (@hrA) + have prefixPrefix (A : TreeSequence G e0) (r : Nat) + (hr : 1 ≤ r) (hrA : r + 1 ≤ A.length) : + TreeSequenceInitialSegment + (TreeSequencePrefix A r hr + (Nat.le_trans (Nat.le_succ r) hrA)) + (TreeSequencePrefix A (r + 1) (by omega) hrA) := by + exact @helper_prefixPrefix_5937 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@uPosition) (@A) + (@r) (@hr) (@hrA) + have prefixSelf (A : TreeSequence G e0) : + TreeSequencePrefix A A.length A.positive le_rfl = A := by + exact @helper_prefixSelf_2890 (@V) (@E) (@G) (@e0) (@A) + have equalPrefixes {A B D : TreeSequence G e0} + (hAD : TreeSequenceInitialSegment A D) + (hBD : TreeSequenceInitialSegment B D) + (hlen : A.length = B.length) : A = B := by + exact @helper_equalPrefixes_2607 (@V) (@E) (@G) (@e0) (@A) (@B) (@D) (@hAD) (@hBD) (@hlen) + have prefixAtLeft : + TreeSequencePrefix M U.length U.positive hleftSegment.1 = U := by + apply equalPrefixes + (prefixSegment M U.length U.positive hleftSegment.1) + hleftSegment + rfl + have hseedTjSegment : TreeSequenceInitialSegment seed Tj0 := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroutePhiTj0 + have firstStep {A B : TreeSequence G e0} + (hAB : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) A B) + (hlt : A.length < B.length) : + ∃ C, TashkinovAugmentation + (ett.series.data.coloring jSlot.castSucc) A C ∧ + TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) C B := by + unfold TashkinovAugmentationSequence at hAB ⊢ + induction hAB using Relation.ReflTransGen.head_induction_on with + | refl => omega + | @head A C hAC hCB ih => exact ⟨C, hAC, hCB⟩ + have replay : ∀ n (hnU : U.length ≤ n) (hnM : n ≤ M.length), + TashkinovAugmentationSequence rho2 U + (TreeSequencePrefix M n + (Nat.le_trans U.positive hnU) hnM) := by + intro n hnU hnM + induction n, hnU using Nat.le_induction with + | base => + simpa [prefixAtLeft] using + (show TashkinovAugmentationSequence rho2 U U from + Relation.ReflTransGen.refl) + | @succ n hnU ih => + exact @helper_branch_15456 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) + (@trace) (@p0) (@indices0) (@hb2) (@hb2Missing) (@hb2TreeEdges) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@TjPrime) (@u) (@huPrime) (@b) (@traceB) (@c2) (@uPosition) + (@huPositionPositive) (@huPositionBound) (@hseedU) (@hterminalInclusion) + (@hroutePhiTj0) (@M) (@huU) (@hleftSegment) (@hnewEntryFromRight) + (@heveryNewRightEntry) (@hrightOrder) (@prefixSegment) (@prefixPrefix) + (@hseedTjSegment) (@firstStep) (@n) (@hnU) (@ih) (@hnM) + have hfull := replay M.length hleftSegment.1 le_rfl + simpa [prefixSelf] using hfull + exact @helper_caseContinuation_10294 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@hjSlot) (@segmentTrans) (@vertexTransfer) (@trace) (@hterminalJ) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@hseedTerminal) (@commonPrefix) (@TjPrime) (@hqLast) (@u) (@b) (@traceB) + (@huOutside) (@c1) (@hrho2Proper) (@hrho2One) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@hrouteRhoTwoU) (@hpreviousTj) (@hpreviousStrict) (@hpreviousSeed) + (@hseedTj0) (@M) (@hunion) (@huU) (@hrouteUM) + +theorem helper_continuation_14753.{u_1, u_2} : + helperContinuation14753Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma + hsigmaProper hsigmaOne w hw hwComponent hwNe this q hqTerminal hqSucc hqKind hqVertex + hqGamma hqDelta hvStage hvFinal hfirstUpper hfirstPositive jSlot hjSlot hsigmaTerminal + segmentTrans stepSegment stageToStage vertexTransfer hdeltaExclusion hPESlotData hPEStored + hpairOverlapColors trace hterminalJ hqActive hqClass p0 indices0 gamma0 delta0 hincreasing0 + hclass0 hgamma0 hdelta0 hchain0 hinjective0 hmissing0 hb2 rho1 hrho1Proper hrho1One + hb2Missing hb2TreeEdges hb3EdgeEffects hb4Interchange terminalPosition hterminalAt + hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj hseedTerminal + hTjQ hseedVertexBefore segmentVertexBefore transportSeedRoute commonPrefix supportColors + TjPrime hclosure hprimeElementary hcaseSplit hseedPrime hterminalPrime hqLast hsupport0 + hkind0 hstored0 hterminalIntersection hdeltaAvoidsTj hb1Tj hcaseOnePrepared + rcases hcaseSplit with hcaseOne | hcaseTwo + · obtain ⟨u, huPrime, b, traceB, huOutside, hinvariantB, + hclaim44⟩ := hcaseOnePrepared hcaseOne + let rho2 : PartialEdgeColoring E k := + traceB.coloring (Fin.last traceB.steps) + dsimp only at hclaim44 + obtain ⟨c1, c2, c3⟩ := hclaim44 + have hrho2Proper : IsProperEdgeColoring G rho2 := by + simpa [rho2] using (hinvariantB.1 (Fin.last traceB.steps)).1 + have hrho2One : IsOneEdgeUncolored rho2 e0 := by + simpa [rho2] using (hinvariantB.1 (Fin.last traceB.steps)).2 + obtain ⟨uPosition, -, huPosition⟩ := Finset.mem_image.mp huPrime + have huNotSeed : u ∉ TreeSequenceVertexSet seed := by + intro huSeed + exact huOutside (vertexTransfer hseedTj huSeed) + have hseedBeforeU : seed.length < uPosition.val := by + exact @helper_hseedBeforeU_5770 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@hseedPrime) (@u) + (@uPosition) (@huPosition) (@huNotSeed) + have huPositionPositive : 1 ≤ uPosition.val := by + exact seed.positive.trans (Nat.le_of_lt hseedBeforeU) + have huPositionBound : uPosition.val ≤ TjPrime.length := + Nat.lt_succ_iff.mp uPosition.isLt + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime uPosition.val huPositionPositive + huPositionBound + have hUPrime : TreeSequenceInitialSegment U TjPrime := by + exact @helper_hUPrime_2738 (@V) (@E) (@G) (@e0) (@TjPrime) (@uPosition) + (@huPositionPositive) (@huPositionBound) + have hseedU : TreeSequenceInitialSegment seed U := by + apply commonPrefix hseedPrime hUPrime + exact Nat.le_of_lt hseedBeforeU + have hrouteRhoOneU : TashkinovAugmentationSequence rho1 seed U := + TashkinovAugmentationSequenceRestrict rho1 seed U TjPrime + hclosure.1 hseedU hUPrime + have hprimeVertexBefore (i : Fin (TjPrime.length + 1)) + (hi : i.val < uPosition.val) : + TjPrime.vertex i ∈ TreeVerticesBefore TjPrime u huPrime := by + exact @helper_hprimeVertexBefore_2750 (@V) (@E) inferInstance (@G) (@e0) (@TjPrime) (@u) + (@huPrime) (@uPosition) (@huPosition) (@i) (@hi) + have hUsegmentVertexBefore {A : TreeSequence G e0} + (hAU : TreeSequenceInitialSegment A U) + (hAlen : A.length < U.length) {x : V} + (hxA : x ∈ TreeSequenceVertexSet A) : + x ∈ TreeVerticesBefore TjPrime u huPrime := by + exact @helper_hUsegmentVertexBefore_5797 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@u) (@huPrime) (@uPosition) (@huPositionPositive) (@huPositionBound) (@hUPrime) + (@hprimeVertexBefore) (@A) (@hAU) (@hAlen) (@x) (@hxA) + have transportUStep {A B : TreeSequence G e0} + (hstep : TashkinovAugmentation rho1 A B) + (hBU : TreeSequenceInitialSegment B U) : + TashkinovAugmentation rho2 A B := by + exact @helper_transportUStep_5808 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) (@trace) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@u) (@huPrime) (@b) (@traceB) (@c2) (@uPosition) (@huPosition) (@huPositionPositive) + (@huPositionBound) (@hUPrime) (@hUsegmentVertexBefore) (@A) (@B) (@hstep) (@hBU) + have transportURoute (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence rho1 S U) : + TashkinovAugmentationSequence rho2 S U := by + exact @helper_transportURoute_2771 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@sigma) (@hvFinal) (@trace) + (@p0) (@indices0) (@TjPrime) (@u) (@b) (@traceB) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@transportUStep) (@S) (@hroute) + have hrouteRhoTwoU : TashkinovAugmentationSequence rho2 seed U := + transportURoute seed hrouteRhoOneU + have hterminalMissingEq : MissingColors G rho2 v = + MissingColors G rho1 v := by + exact c2.1 v (Finset.mem_union_left _ hterminalJ) + have hterminalInclusion : MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ + MissingColors G rho2 v ∪ MissingColors G rho2 u := by + exact @helper_hterminalInclusion_5831 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) + (@gamma0) (@delta0) (@hmissing0) (@hb2Missing) (@u) (@b) (@traceB) (@c3) + (@hterminalMissingEq) + let Tprevious : TreeSequence G e0 := + ett.series.data.tree jSlot.castSucc.castSucc + have hvNotPrevious (hjPositive : 0 < jSlot.val) : + v ∉ TreeSequenceVertexSet Tprevious := by + exact @helper_hvNotPrevious_5841 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@hqLast) (@uPosition) (@hjPositive) + have hpreviousTj (hjPositive : 0 < jSlot.val) : + TreeSequenceInitialSegment Tprevious + (ett.series.data.tree jSlot.succ.castSucc) := by + have hstep := stepSegment jSlot.castSucc (by simpa using hjPositive) + rw [hjTreeIndex] at hstep + exact hstep + have hpreviousStrict (hjPositive : 0 < jSlot.val) : + Tprevious.length < seed.length := by + exact @helper_hpreviousStrict_5854 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) + (@hterminalAt) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@uPosition) (@hvNotPrevious) (@hpreviousTj) (@hjPositive) + have hpreviousSeed (hjPositive : 0 < jSlot.val) : + TreeSequenceInitialSegment Tprevious seed := + commonPrefix (hpreviousTj hjPositive) hseedTj + (Nat.le_of_lt (hpreviousStrict hjPositive)) + have hroutePhiTj : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) seed + (ett.series.data.tree jSlot.succ.castSucc) := by as_aux_lemma => + generalize htarget : jSlot.castSucc = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact @helper_branch_5870 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) + (@commonPrefix) (@seedLength) (@initialClosure) (@htarget) + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_5878 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hjTreeIndex) (@hseedTj) (@commonPrefix) (@TjPrime) (@uPosition) + (@hpreviousStrict) (@i) (@choice) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@htarget) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_5890 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hjTreeIndex) (@hseedTj) (@TjPrime) (@uPosition) (@hpreviousSeed) (@i) + (@closedExtension) (@htarget) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_5903 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hjTreeIndex) (@hseedTj) (@commonPrefix) (@TjPrime) (@uPosition) + (@hpreviousStrict) (@i) (@available) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@htarget) + exact @helper_caseContinuation_8566 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@hjSlot) (@segmentTrans) (@vertexTransfer) (@trace) (@hterminalJ) (@p0) (@indices0) + (@hb2) (@hb2Missing) (@hb2TreeEdges) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@hseedTerminal) (@commonPrefix) + (@TjPrime) (@hqLast) (@u) (@huPrime) (@b) (@traceB) (@huOutside) (@c1) (@c2) + (@hrho2Proper) (@hrho2One) (@uPosition) (@huPosition) (@huPositionPositive) + (@huPositionBound) (@hseedU) (@hrouteRhoTwoU) (@hterminalInclusion) (@hpreviousTj) + (@hpreviousStrict) (@hpreviousSeed) (@hroutePhiTj) + · exact @helper_branch_15626 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@hlower) (@v) + (@gamma) (@delta) (@sigma) (@hsigmaProper) (@hsigmaOne) (@w) (@hw) (@hwComponent) (@hwNe) + (@hqTerminal) (@hqSucc) (@hqKind) (@hqVertex) (@hqGamma) (@hqDelta) (@hvStage) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@hsigmaTerminal) (@segmentTrans) (@stepSegment) + (@stageToStage) (@vertexTransfer) (@hdeltaExclusion) (@hPESlotData) (@hPEStored) + (@hpairOverlapColors) (@trace) (@hterminalJ) (@hqActive) (@hqClass) (@p0) (@indices0) + (@gamma0) (@delta0) (@hincreasing0) (@hclass0) (@hgamma0) (@hdelta0) (@hchain0) + (@hinjective0) (@hmissing0) (@hrho1Proper) (@hrho1One) (@hb2Missing) (@hb2TreeEdges) + (@hb3EdgeEffects) (@hb4Interchange) (@terminalPosition) (@hterminalAt) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) + (@hseedTerminal) (@hTjQ) (@hseedVertexBefore) (@segmentVertexBefore) (@transportSeedRoute) + (@commonPrefix) (@TjPrime) (@hclosure) (@hprimeElementary) (@hseedPrime) (@hterminalPrime) + (@hqLast) (@hsupport0) (@hkind0) (@hstored0) (@hterminalIntersection) (@hdeltaAvoidsTj) + (@hb1Tj) (@hcaseTwo) +private theorem helper_hcaseOnePrepared_8906.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) + (_ : (↑jSlot : ℕ) ≤ (↑q : ℕ)) + (_ : + ∀ (a b : ℕ), + (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨a, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree + (⟨b, by + omega⟩ : + Fin (ett.rounds + (2 : ℕ))))) + (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) + (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) + (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k) + (_ : + ∀ (a b : Fin (p0 + (1 : ℕ))), + (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + (_ : + ∀ (r : Fin ett.rounds), + r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) + (_ : + ∀ (a : Fin (p0 + (1 : ℕ))), + ett.series.data.gamma (indices0 a).succ = some (gamma0 a)) + (_ : + ∀ (a : Fin (p0 + (1 : ℕ))), + ett.series.data.delta (indices0 a).succ = some (delta0 a)) + (_ : ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) + (_ : + Function.Injective (Fin.cons (gamma0 (0 : Fin (p0 + (1 : ℕ)))) delta0)), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : IsProperEdgeColoring G rho1) (_ : IsOneEdgeUncolored rho1 e0) + (_ : + (∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = + MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v) + (_ : + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ ExtensionBaseSupportClass ett v hvFinal v → + s ≠ q → + ett.series.data.chosenVertex s.succ = some v → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s v rho1 gammaS deltaS) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + let supportColors : Finset (Fin k) := + Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (_ : TashkinovClosure rho1 seed TjPrime) + (_ : ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime)) + (_ : v ∈ TreeSequenceVertexSet TjPrime) + (_ : indices0 (Fin.last p0) = q) + (_ : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.chosenVertex (indices0 a).succ = some v) + (_ : + ∀ (a : Fin (p0 + (1 : ℕ))), + ett.series.data.kind (indices0 a).succ = some TashkinovExtensionKind.PE) + (_ : + ∀ (a : Fin (p0 + (1 : ℕ))), + ett.series.data.stored (indices0 a).succ = + (insert (gamma0 a) ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) + (_ : + (MissingColors G rho1 v ∩ supportColors : Finset (Fin k)) = + ({delta0 (Fin.last p0)} : Finset (Fin k))) + (_ : + gamma0 (0 : Fin (p0 + (1 : ℕ))) ∈ + MissingColors G (ett.series.data.coloring jSlot.castSucc) v) + (_ : + ∀ (a : Fin (p0 + (1 : ℕ))), + delta0 a ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) + (_ : + ColoredVertexSetElementary G (ett.series.data.coloring jSlot.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc))) + (_ : + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho1), + ((((TreeSequenceVertexSet TjPrime).erase v).biUnion fun (x : V) ↦ + MissingColors G rho1 x) ∩ + supportColors : + Finset (Fin k)).Nonempty → + ∃ (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (b : Fin (p0 + (1 : ℕ))) (traceB + : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + u ∉ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∧ + ExtensionBaseAlgorithmBInvariant ett v jSlot rho1 u p0 indices0 b traceB ∧ + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho2 ∧ + ((∀ + x ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ + TreeVerticesBefore TjPrime u huPrime, + MissingColors G rho2 x = MissingColors G rho1 x) ∧ + ∀ (f : E), + ((∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex z = u ∧ (↑a : ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → + rho2 f = rho1 f) ∧ + gamma0 (0 : Fin (p0 + (1 : ℕ))) ∈ MissingColors G rho2 u := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot hjSlot hjle stageToStage trace hterminalJ p0 indices0 + gamma0 delta0 hincreasing0 hclass0 hgamma0 hdelta0 hchain0 hinjective0 rho1 hrho1Proper + hrho1One hb2Missing hb4Interchange terminalPosition hterminalAt hterminalPositionPositive + hterminalPositionBound seed supportColors TjPrime hclosure hprimeElementary hterminalPrime + hqLast hsupport0 hkind0 hstored0 hterminalIntersection hfirstGammaMissing hdeltaAvoidsTj + hTjElementary hb1Tj hcaseOne + obtain ⟨u, huPrime, b, huNe, hselected, hminimal, hfirstChoice, + huOutside, hprefixData⟩ := + ExtensionBaseCaseOneSelection ett v hvFinal jSlot q hjle hqTerminal + hjSlot rho1 seed TjPrime terminalPosition hterminalAt + hterminalPositionPositive rfl hclosure hterminalPrime p0 indices0 + gamma0 delta0 hincreasing0 hclass0 hqLast hgamma0 hdelta0 hstored0 + hchain0 hinjective0 (by simpa [supportColors] using hcaseOne) + hprimeElementary (by simpa [supportColors] using hterminalIntersection) + hTjElementary hb2Missing.1 hfirstGammaMissing hdeltaAvoidsTj + dsimp only at hprefixData + have hinitialB : ∀ a : Fin (p0 + 1), a.val < b.val → + ETTStrongInterchangeable ett (indices0 a) v rho1 + (gamma0 a) (delta0 a) := by + exact @helper_hinitialB_2039 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hvFinal) + (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@hincreasing0) (@hclass0) (@hgamma0) + (@hdelta0) (@hb4Interchange) (@hqLast) (@hsupport0) (@b) + have hTjInitialB : ∀ a : Fin (p0 + 1), a.val < b.val → + TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (indices0 a).succ.castSucc) := by + exact @helper_hTjInitialB_2054 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@stageToStage) (@p0) + (@indices0) (@hclass0) (@terminalPosition) (@hqLast) (@b) + obtain ⟨traceB, hinvariantB⟩ := + ExtensionBaseAlgorithmB ett v jSlot rho1 u p0 indices0 gamma0 delta0 + b hrho1Proper hrho1One hincreasing0 hsupport0 hkind0 hgamma0 + hdelta0 hchain0 hinjective0 hselected hminimal hinitialB + hTjInitialB hprefixData.2.2 hstored0 + have hprefixSubset : + (ExtensionBaseCaseOneIndices ett p0 indices0 b).biUnion + (fun t => ett.series.data.stored t.succ) ⊆ + supportColors := by + exact @helper_hprefixSubset_2691 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@p0) (@indices0) (@b) + have hprefixAvoids : + (TreeVerticesBefore TjPrime u huPrime).biUnion + (fun x => MissingColors G rho1 x) ∩ + ((ExtensionBaseCaseOneIndices ett p0 indices0 b).biUnion + fun t => ett.series.data.stored t.succ) = ∅ := by + exact @helper_hprefixAvoids_2180 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@sigma) (@hvFinal) (@trace) (@p0) + (@indices0) (@delta0) (@TjPrime) (@u) (@huPrime) (@b) (@hprefixData) (@hprefixSubset) + have hclaim44 := ExtensionBaseClaim44 ett v hvFinal jSlot hjSlot rho1 + (TashkinovStoredColors ett.series.data jSlot.castSucc) u TjPrime seed + terminalPosition hterminalAt hterminalPositionPositive rfl huPrime p0 + indices0 gamma0 delta0 b hincreasing0 hclass0 traceB hinvariantB + hb1Tj huOutside hclosure hprefixAvoids hselected hminimal hgamma0 + hdelta0 hchain0 hinjective0 hstored0 + dsimp only at hclaim44 + exact ⟨u, huPrime, b, traceB, huOutside, hinvariantB, hclaim44⟩ + +theorem helper_continuation_14264.{u_1, u_2} : + helperContinuation14264Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma + hsigmaProper hsigmaOne w hw hwComponent hwNe this q hqTerminal hqSucc hqKind hqVertex + hqGamma hqDelta hvStage hvFinal hfirstUpper hfirstPositive jSlot hjSlot hjle hsigmaTerminal + segmentTrans stepSegment stageToStage vertexTransfer hdeltaExclusion hPESlotData hPEStored + hpairOverlapColors trace hterminalJ hqActive hqClass p0 indices0 gamma0 delta0 hincreasing0 + hclass0 hgamma0 hdelta0 hchain0 hinjective0 hmissing0 hb2 rho1 hrho1Proper hrho1One hb1Rho + hb2Missing hb2TreeEdges hb3EdgeEffects hb4Interchange terminalPosition hterminalAt + hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj hseedTerminal + hTjQ hqFinal hseedVertexBefore segmentVertexBefore transportStep + have transportSeedRoute (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) S seed) : + TashkinovAugmentationSequence rho1 S seed := by + exact @helper_transportSeedRoute_2514 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@transportStep) (@S) (@hroute) + have commonPrefix {A B C : TreeSequence G e0} + (hAC : TreeSequenceInitialSegment A C) + (hBC : TreeSequenceInitialSegment B C) + (hlen : A.length ≤ B.length) : + TreeSequenceInitialSegment A B := by + exact @helper_commonPrefix_1530 (@V) (@E) (@G) (@e0) (@A) (@B) (@C) (@hAC) (@hBC) (@hlen) + let supportColors := Finset.univ.biUnion fun a : Fin (p0 + 1) => + ett.series.data.stored (indices0 a).succ + obtain ⟨TjPrime, hclosure, hprimeElementary, hcaseSplit⟩ : + ∃ TjPrime : TreeSequence G e0, + TashkinovClosure rho1 seed TjPrime ∧ + ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime) ∧ + (let awayMissing := + ((TreeSequenceVertexSet TjPrime).erase v).biUnion + fun x => MissingColors G rho1 x + (awayMissing ∩ supportColors).Nonempty ∨ + awayMissing ∩ supportColors = ∅) := by + by_cases hjPositive : 0 < jSlot.val + · exact @helper_branch_5591 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@hlower) (@v) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) + (@stepSegment) (@trace) (@p0) (@indices0) (@hrho1Proper) (@hrho1One) (@hb1Rho) + (@terminalPosition) (@hterminalAt) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hjTreeIndex) (@hseedTj) (@segmentVertexBefore) (@transportSeedRoute) (@commonPrefix) + (@hjPositive) + · exact @helper_branch_1907 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@trace) (@p0) (@indices0) + (@hrho1Proper) (@hrho1One) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (by assumption) (@commonPrefix) (@hjPositive) + have hseedPrime : TreeSequenceInitialSegment seed TjPrime := + TashkinovAugmentationSequenceInitialSegment rho1 seed TjPrime hclosure.1 + have hterminalPrime : v ∈ TreeSequenceVertexSet TjPrime := by + apply vertexTransfer hseedPrime + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.last seed.length, hseedTerminal⟩ + have hqLast : indices0 (Fin.last p0) = q := by + exact @helper_hqLast_2554 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hqClass) (@p0) (@indices0) (@hincreasing0) + (@hclass0) (@terminalPosition) + have hsupport0 : ∀ a : Fin (p0 + 1), + ett.series.data.chosenVertex (indices0 a).succ = some v := by + intro a + have ha := (hclass0 (indices0 a)).2 ⟨a, rfl⟩ + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at ha + exact ha.2 + have hkind0 : ∀ a : Fin (p0 + 1), + ett.series.data.kind (indices0 a).succ = + some TashkinovExtensionKind.PE := by + exact @helper_hkind0_2572 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@v) (@hvFinal) (@p0) (@indices0) (@hclass0) + have hstored0 : ∀ a : Fin (p0 + 1), + ett.series.data.stored (indices0 a).succ = + {gamma0 a, delta0 a} := by + intro a + exact hPEStored (indices0 a) (gamma0 a) (delta0 a) (hkind0 a) + (hgamma0 a) (hdelta0 a) + have hterminalIntersection : MissingColors G rho1 v ∩ supportColors = + {delta0 (Fin.last p0)} := by + dsimp [supportColors] + rw [hb2Missing.2] + exact hmissing0.1 + have hfirstGammaMissing : gamma0 0 ∈ MissingColors G + (ett.series.data.coloring jSlot.castSucc) v := by + rw [hmissing0.2] + simp + have hdeltaAvoidsTj : ∀ a : Fin (p0 + 1), + delta0 a ∉ TreeMissingColors + (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc) := by + exact @helper_hdeltaAvoidsTj_2598 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hdeltaExclusion) (@p0) (@indices0) + (@delta0) (@hclass0) (@hdelta0) (@hsupport0) + have hTjElementary : ColoredVertexSetElementary G + (ett.series.data.coloring jSlot.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) := by + exact @helper_hTjElementary_2030 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) + (@p0) (@indices0) (@terminalPosition) (@hqLast) + have hTjFinal : TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) T := + segmentTrans hTjQ hqFinal + have hbeforeTjFinal : TreeVerticesBefore + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ ⊆ + TreeVerticesBefore T v hvFinal := by + exact @helper_hbeforeTjFinal_2616 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@hterminalJ) (@hTjFinal) + have hb1Tj : StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho1 := by + exact @helper_hb1Tj_1978 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@hterminalJ) (@hb1Rho) + (@hbeforeTjFinal) + have hcaseOnePrepared : + (((TreeSequenceVertexSet TjPrime).erase v).biUnion + (fun x => MissingColors G rho1 x) ∩ supportColors).Nonempty → + ∃ (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (b : Fin (p0 + 1)) + (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u + p0 indices0 b), + u ∉ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) ∧ + ExtensionBaseAlgorithmBInvariant ett v jSlot rho1 u + p0 indices0 b traceB ∧ + (let rho2 := traceB.coloring (Fin.last traceB.steps) + StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho2 ∧ + ((∀ x : V, + x ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) ∪ + TreeVerticesBefore TjPrime u huPrime → + MissingColors G rho2 x = MissingColors G rho1 x) ∧ + ∀ f : E, + ((∃ a : Fin (ett.series.data.tree + jSlot.succ.castSucc).length, + (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) + (z : Fin (TjPrime.length + 1)), + TjPrime.vertex z = u ∧ a.val < z.val ∧ + TjPrime.edge a = f) → + rho2 f = rho1 f) ∧ + gamma0 0 ∈ MissingColors G rho2 u) := by + exact @helper_hcaseOnePrepared_8906 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@hjle) (@stageToStage) (@trace) + (@hterminalJ) (@p0) (@indices0) (@gamma0) (@delta0) (@hincreasing0) (@hclass0) (@hgamma0) + (@hdelta0) (@hchain0) (@hinjective0) (@hrho1Proper) (@hrho1One) (@hb2Missing) + (@hb4Interchange) (@terminalPosition) (@hterminalAt) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@hclosure) (@hprimeElementary) (@hterminalPrime) + (@hqLast) (@hsupport0) (@hkind0) (@hstored0) (@hterminalIntersection) + (@hfirstGammaMissing) (@hdeltaAvoidsTj) (@hTjElementary) (@hb1Tj) + exact @helper_continuation_14753 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hsigmaProper) (@hsigmaOne) (@w) (@hw) + (@hwComponent) (@hwNe) (@hqTerminal) (@hqSucc) (@hqKind) (@hqVertex) (@hqGamma) (@hqDelta) + (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@hsigmaTerminal) + (@segmentTrans) (@stepSegment) (@stageToStage) (@vertexTransfer) (@hdeltaExclusion) + (@hPESlotData) (@hPEStored) (@hpairOverlapColors) (@trace) (@hterminalJ) (@hqActive) + (@hqClass) (@p0) (@indices0) (@gamma0) (@delta0) (@hincreasing0) (@hclass0) (@hgamma0) + (@hdelta0) (@hchain0) (@hinjective0) (@hmissing0) (@hb2) (@hrho1Proper) (@hrho1One) + (@hb2Missing) (@hb2TreeEdges) (@hb3EdgeEffects) (@hb4Interchange) (@terminalPosition) + (@hterminalAt) (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@hseedTerminal) (@hTjQ) (@hseedVertexBefore) (@segmentVertexBefore) + (@transportSeedRoute) (@commonPrefix) (@TjPrime) (@hclosure) (@hprimeElementary) + (@hcaseSplit) (@hseedPrime) (@hterminalPrime) (@hqLast) (@hsupport0) (@hkind0) (@hstored0) + (@hterminalIntersection) (@hdeltaAvoidsTj) (@hb1Tj) (@hcaseOnePrepared) +theorem helper_continuation_13931.{u_1, u_2} : + helperContinuation13931Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma + hsigmaProper hsigmaOne w hw hwComponent hwNe this q hqTerminal hqSucc hqKind hqVertex + hqGamma hqDelta hvStage hqTreeIndex hvFinal hfirstUpper hfirstPositive jSlot hjSlot hjle + hsigmaTerminal hsigmaBefore segmentTrans stepSegment stageToStage vertexTransfer + hdeltaExclusion hPESlotData hPEStored hclassPackage hterminalBefore hjInitial hslotData + hinitialSI hclassMissing hpairOverlapColors + obtain ⟨trace, hinvariant⟩ := ExtensionBaseAlgorithmA ett v hvFinal + jSlot q sigma hqTerminal hqKind hqVertex hjSlot hsigmaProper hsigmaOne + hterminalBefore hjInitial hslotData hinitialSI hclassMissing + hpairOverlapColors + have hterminalJ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) := by + exact @helper_hterminalJ_1166 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hjSlot) + have hqActive : q ∈ ExtensionBaseActiveIndices ett v hvFinal := by + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨hfirstUpper, hqKind, v, hvFinal, hqVertex, le_rfl⟩ + have hqClass : q ∈ ExtensionBaseSupportClass ett v hvFinal v := by + simp [ExtensionBaseSupportClass, hqActive, hqVertex] + obtain ⟨p0, indices0, gamma0, delta0, hincreasing0, hclass0, + hgamma0, hdelta0, hchain0, hinjective0, hunsupported, hmissing0⟩ := + hclassPackage v ⟨q, hqClass⟩ + have hclassPrepared : ∀ x : V, + x ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) → + x ≠ v → + (∃ t : Fin ett.rounds, + t ∈ ExtensionBaseRestorationIndices ett v hvFinal ∧ + ett.series.data.chosenVertex t.succ = some x) → + ∃ p : ℕ, ∃ indices : Fin (p + 1) → Fin ett.rounds, + ∃ gammaClass deltaClass : Fin (p + 1) → Fin k, + (∀ a b, a.val < b.val → + (indices a).val < (indices b).val) ∧ + (∀ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett v hvFinal x ↔ + ∃ a : Fin (p + 1), indices a = r) ∧ + (∀ a, ett.series.data.gamma (indices a).succ = + some (gammaClass a)) ∧ + (∀ a, ett.series.data.delta (indices a).succ = + some (deltaClass a)) ∧ + (∀ a : Fin p, gammaClass a.succ = deltaClass a.castSucc) ∧ + Function.Injective (Fin.cons (gammaClass 0) deltaClass) ∧ + MissingColors G (ett.series.data.coloring jSlot.castSucc) x = + (MissingColors G sigma x \ {deltaClass (Fin.last p)}) ∪ + {gammaClass 0} := by + exact @helper_hclassPrepared_1698 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hclassPackage) + have hclaim43 := ExtensionBaseClaim43 ett v hvFinal jSlot q hjle + hqTerminal hqKind hqVertex hjSlot sigma + (TashkinovStoredColors ett.series.data jSlot.castSucc) hterminalJ + hsigmaProper hsigmaOne hsigmaTerminal hsigmaBefore trace hinvariant + hunsupported hclassPrepared + dsimp at hclaim43 + obtain ⟨hb1, hb2, hb3, hb4, hb5⟩ := hclaim43 + let rho1 : PartialEdgeColoring E k := + trace.coloring (Fin.last trace.steps) + have hrho1Proper : IsProperEdgeColoring G rho1 := by + simpa [rho1] using (hinvariant.1 (Fin.last trace.steps)).1 + have hrho1One : IsOneEdgeUncolored rho1 e0 := by + simpa [rho1] using (hinvariant.1 (Fin.last trace.steps)).2 + have hb1Rho : StableColoringBeforeVertex T v hvFinal + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho1 := by + simpa [rho1] using hb1 + have hb2Missing : + (∀ x : V, + x ∈ (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).erase v → + MissingColors G rho1 x = + MissingColors G + (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v := by + simpa [rho1] using hb2 + have hb2TreeEdges : ∀ a : Fin + (ett.series.data.tree jSlot.succ.castSucc).length, + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) = + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = + ett.series.data.coloring jSlot.castSucc + ((ett.series.data.tree jSlot.succ.castSucc).edge a) := by + simpa [rho1] using hb3 + have hb3EdgeEffects : ∀ f : E, rho1 f ≠ sigma f → + f ∉ InternalEdges G + (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) ∧ + ∃ c d : Fin k, sigma f = some c ∧ rho1 f = some d ∧ + c ∈ (ExtensionBaseRestorationIndices ett v hvFinal).biUnion + (fun t => ett.series.data.stored t.succ) ∧ + d ∈ (ExtensionBaseRestorationIndices ett v hvFinal).biUnion + (fun t => ett.series.data.stored t.succ) := by + simpa [rho1] using hb4 + have hb4Interchange : ∀ (s : Fin ett.rounds) + (gammaS deltaS : Fin k), + s ∈ ExtensionBaseSupportClass ett v hvFinal v → + s ≠ q → + ett.series.data.chosenVertex s.succ = some v → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s v rho1 gammaS deltaS := by + simpa [rho1] using hb5 + classical + obtain ⟨terminalPosition, -, hterminalAt⟩ := + Finset.mem_image.mp hterminalJ + have hterminalPositionPositive : 1 ≤ terminalPosition.val := by + exact @helper_hterminalPositionPositive_1612 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hqKind) (@hqVertex) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@hjSlot) (@stageToStage) (@terminalPosition) (@hterminalAt) + have hterminalPositionBound : terminalPosition.val ≤ + (ett.series.data.tree jSlot.succ.castSucc).length := + Nat.le_of_lt_succ terminalPosition.isLt + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + terminalPosition.val hterminalPositionPositive hterminalPositionBound + have hjTreeIndex : jSlot.castSucc.succ = jSlot.succ.castSucc := by + apply Fin.ext + rfl + have hseedTj : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) := by + exact @helper_hseedTj_2451 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) + have hseedTerminal : seed.vertex (Fin.last seed.length) = v := by + exact @helper_hseedTerminal_2462 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalAt) + (@hterminalPositionPositive) (@hterminalPositionBound) + have hTjQ : TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + have hseg := stageToStage (jSlot.val + 1) (q.val + 1) + (by omega) (by omega) (by omega) + convert hseg using 1 <;> congr 1 + have hqFinal : TreeSequenceInitialSegment + (ett.series.data.tree q.succ.castSucc) T := by + simpa [hqTreeIndex] using ett.abovePenultimate + have hseedFinal : TreeSequenceInitialSegment seed T := + segmentTrans hseedTj (segmentTrans hTjQ hqFinal) + have hseedVertexBefore (i : Fin (seed.length + 1)) + (hi : i.val < seed.length) : + seed.vertex i ∈ TreeVerticesBefore T v hvFinal := by + exact @helper_hseedVertexBefore_5540 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTerminal) (@hseedFinal) + (@i) (@hi) + have segmentVertexBefore {A : TreeSequence G e0} + (hAseed : TreeSequenceInitialSegment A seed) + (hAlen : A.length < seed.length) {x : V} + (hxA : x ∈ TreeSequenceVertexSet A) : + x ∈ TreeVerticesBefore T v hvFinal := by + exact @helper_segmentVertexBefore_5548 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedVertexBefore) (@A) + (@hAseed) (@hAlen) (@x) (@hxA) + have transportStep {A B : TreeSequence G e0} + (hstep : TashkinovAugmentation + (ett.series.data.coloring jSlot.castSucc) A B) + (hBseed : TreeSequenceInitialSegment B seed) : + TashkinovAugmentation rho1 A B := by + exact @helper_transportStep_1463 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) (@trace) (@hb1Rho) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (by assumption) (@A) (@B) (@hstep) (@hBseed) + exact @helper_continuation_14264 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hsigmaProper) (@hsigmaOne) (@w) (@hw) + (@hwComponent) (@hwNe) (@hqTerminal) (@hqSucc) (@hqKind) (@hqVertex) (@hqGamma) (@hqDelta) + (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@hjle) (@hsigmaTerminal) + (@segmentTrans) (@stepSegment) (@stageToStage) (@vertexTransfer) (@hdeltaExclusion) + (@hPESlotData) (@hPEStored) (@hpairOverlapColors) (@trace) (@hterminalJ) (@hqActive) + (@hqClass) (@p0) (@indices0) (@gamma0) (@delta0) (@hincreasing0) (@hclass0) (@hgamma0) + (@hdelta0) (@hchain0) (@hinjective0) (@hmissing0) (@hb2) (@hrho1Proper) (@hrho1One) + (@hb1Rho) (@hb2Missing) (@hb2TreeEdges) (@hb3EdgeEffects) (@hb4Interchange) + (@terminalPosition) (@hterminalAt) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hjTreeIndex) (@hseedTj) (@hseedTerminal) (@hTjQ) (@hqFinal) (@hseedVertexBefore) + (@segmentVertexBefore) (@transportStep) +theorem helper_caseContinuation_13733.{u_1, u_2} : + helperCaseContinuation13733Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma + hsigmaProper hsigmaOne w hw hwComponent hwNe this q hqTerminal hqSucc hqKind hqVertex + hqGamma hqDelta hvStage hqTreeIndex hvFinal hfirstUpper hfirstPositive jSlot hjSlot hjle + hsigmaTerminal hsigmaBefore segmentTrans stepSegment stageToStage vertexTransfer + hsupportOrder hdeltaExclusion hpairOverlap + have htreeEdges := ExtensionBaseClaimTreeEdgeColors G k e0 input + ett.rounds ett.series jSlot q hjle hqTerminal sigma hsigmaProper + hsigmaOne hsigmaTerminal + have hLowerInterchange : ∀ (t : Fin ett.rounds) (vt : V) + (gammaT deltaT : Fin k), + t ∈ ExtensionBaseActiveIndices ett v hvFinal → + t.val < q.val → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → + TreeInterchangeable G (ett.series.data.tree t.succ.succ) + (ett.series.data.coloring t.succ) gammaT deltaT := by + exact @helper_hLowerInterchange_328 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) + have hstrongInterchange := ExtensionBaseClaimStrongInterchangeable ett v + hvFinal q hqTerminal hqKind hqVertex hLowerInterchange sigma hsigmaProper + hsigmaOne hsigmaTerminal + have hPESlotData : ∀ t : Fin ett.rounds, + ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ∃ vt : V, ∃ gammaT deltaT : Fin k, + ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ + ett.series.data.delta t.succ = some deltaT := by + exact @helper_hPESlotData_805 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) + have hPEStored : ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), + ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → + ett.series.data.stored t.succ = {gammaT, deltaT} := by + exact @helper_hPEStored_851 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) + have qStageToFinal : ∀ x : V, + x ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) → + x ∈ TreeSequenceVertexSet T := by + exact @helper_qStageToFinal_2202 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hqTreeIndex) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) + have hclassPackage : ∀ u : V, + (ExtensionBaseSupportClass ett v hvFinal u).Nonempty → + ∃ p : ℕ, ∃ indices : Fin (p + 1) → Fin ett.rounds, + ∃ gammaClass deltaClass : Fin (p + 1) → Fin k, + (∀ a b, a.val < b.val → + (indices a).val < (indices b).val) ∧ + (∀ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett v hvFinal u ↔ + ∃ a : Fin (p + 1), indices a = r) ∧ + (∀ a, ett.series.data.gamma (indices a).succ = + some (gammaClass a)) ∧ + (∀ a, ett.series.data.delta (indices a).succ = + some (deltaClass a)) ∧ + (∀ a : Fin p, gammaClass a.succ = deltaClass a.castSucc) ∧ + Function.Injective (Fin.cons (gammaClass 0) deltaClass) ∧ + (∀ x : V, + x ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) → + (∀ r : Fin ett.rounds, + r ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex r.succ ≠ some x) → + MissingColors G sigma x = + MissingColors G + (ett.series.data.coloring jSlot.castSucc) x) ∧ + (let storedPairs := Finset.univ.biUnion fun a : Fin (p + 1) => + ett.series.data.stored (indices a).succ + MissingColors G sigma u ∩ storedPairs = + {deltaClass (Fin.last p)} ∧ + MissingColors G (ett.series.data.coloring jSlot.castSucc) u = + (MissingColors G sigma u \ {deltaClass (Fin.last p)}) ∪ + {gammaClass 0}) := by + intro u hclassNonempty + obtain ⟨p, indices, huStage, hincreasing, hclass, henumerates⟩ := + ExtensionBaseSupportClassEnumeration ett v hvFinal q hqTerminal u + (fun s x hxFinal hsActive hsChosen => + (hsupportOrder.2.1 s x hxFinal hsActive hsChosen).1) + hclassNonempty + have hslot : ∀ a : Fin (p + 1), ∃ gammaA deltaA : Fin k, + ett.series.data.gamma (indices a).succ = some gammaA ∧ + ett.series.data.delta (indices a).succ = some deltaA := by + exact @helper_hslot_2247 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@hPESlotData) (@u) (@p) + (@indices) (@henumerates) + choose gammaClass deltaClass hgammaClass hdeltaClass using hslot + have huFinal := qStageToFinal u huStage + have hdeltaAvoids : ∀ a b, a.val ≤ b.val → + deltaClass b ≠ gammaClass a := by + exact @helper_hdeltaAvoids_5315 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hdeltaExclusion) (@u) (@p) (@indices) + (@hincreasing) (@hclass) (@gammaClass) (@deltaClass) (@hgammaClass) (@hdeltaClass) + (@huFinal) + obtain ⟨hchain, hinjective⟩ := ExtensionBaseSupportClassColors ett v + hvFinal q hqTerminal u huStage p indices hincreasing hclass henumerates + gammaClass deltaClass hgammaClass hdeltaClass hdeltaAvoids + have hmissing := ExtensionBaseClaimMissingColors ett v hvFinal jSlot q + hjle hqTerminal hqKind hqVertex hjSlot u huStage p indices hincreasing + hclass henumerates (gammaClass 0) (deltaClass (Fin.last p)) + (hgammaClass 0) (hdeltaClass (Fin.last p)) sigma hsigmaProper + hsigmaOne hsigmaTerminal + exact ⟨p, indices, gammaClass, deltaClass, hincreasing, hclass, + hgammaClass, hdeltaClass, hchain, hinjective, hmissing⟩ + have hterminalBefore : ∀ (t : Fin ett.rounds) (vt : V), + t ∈ ExtensionBaseRestorationIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → + TreeVertexOrder T v vt := by + exact @helper_hterminalBefore_988 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@hvFinal) (@hsupportOrder) + have hjInitial : ∀ t : Fin ett.rounds, + t ∈ ExtensionBaseRestorationIndices ett v hvFinal → + TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree t.succ.castSucc) := by + exact @helper_hjInitial_1603 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@stageToStage) + have hslotData : ∀ t : Fin ett.rounds, + t ∈ ExtensionBaseRestorationIndices ett v hvFinal → + ∃ vt : V, ∃ gammaT deltaT : Fin k, + ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ + ett.series.data.delta t.succ = some deltaT := by + exact @helper_hslotData_2282 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@v) (@hvFinal) (@hPESlotData) + have hinitialSI : ∀ (t : Fin ett.rounds) (vt : V) + (gammaT deltaT : Fin k), + t ∈ ExtensionBaseActiveIndices ett v hvFinal → + t ≠ q → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → + ETTStrongInterchangeable ett t vt sigma gammaT deltaT := by + exact @helper_hinitialSI_2295 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hstrongInterchange) + have hclassMissing : ∀ (u : V) (t : Fin ett.rounds) + (deltaT : Fin k), + ExtensionBaseSupportClass ett v hvFinal u ⊆ + ExtensionBaseRestorationIndices ett v hvFinal → + t ∈ ExtensionBaseSupportClass ett v hvFinal u → + (∀ s : Fin ett.rounds, + s ∈ ExtensionBaseSupportClass ett v hvFinal u → s.val ≤ t.val) → + ett.series.data.delta t.succ = some deltaT → + MissingColors G sigma u ∩ + (ExtensionBaseSupportClass ett v hvFinal u).biUnion + (fun s => ett.series.data.stored s.succ) = {deltaT} := by + exact @helper_hclassMissing_1053 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hclassPackage) + have hpairOverlapColors : ∀ (s t : Fin ett.rounds) (vs vt : V) + (gammaS deltaS gammaT deltaT : Fin k), + s ∈ ExtensionBaseActiveIndices ett v hvFinal → + t ∈ ExtensionBaseActiveIndices ett v hvFinal → + s.val < t.val → + ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → + ((({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT}).Nonempty ↔ + vs = vt ∧ ¬ ∃ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett v hvFinal vs ∧ + s.val < r.val ∧ r.val < t.val ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ + ((({gammaS, deltaS} : Finset (Fin k)) ∩ + {gammaT, deltaT}).Nonempty → + ({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT} = + {gammaT} ∧ + ({gammaS, deltaS} : Finset (Fin k)) ∩ {gammaT, deltaT} = + {deltaS}) := by + exact @helper_hpairOverlapColors_581 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@hvFinal) (@hpairOverlap) + (@hPEStored) + exact @helper_continuation_13931 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hsigmaProper) (@hsigmaOne) (@w) (@hw) + (@hwComponent) (@hwNe) (@hqTerminal) (@hqSucc) (@hqKind) (@hqVertex) (@hqGamma) (@hqDelta) + (@hvStage) (@hqTreeIndex) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@hjle) + (@hsigmaTerminal) (@hsigmaBefore) (@segmentTrans) (@stepSegment) (@stageToStage) + (@vertexTransfer) (@hdeltaExclusion) (@hPESlotData) (@hPEStored) (@hclassPackage) + (@hterminalBefore) (@hjInitial) (@hslotData) (@hinitialSI) (@hclassMissing) + (@hpairOverlapColors) + +end GoldbergSeymour.ExtensionBaseProof + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean b/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean new file mode 100644 index 0000000000..99945c7b5f --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean @@ -0,0 +1,4355 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary + +public import LeanPool.GoldbergSeymour.ExtensionBaseStepLemmas + +/-! +# Preparatory lemmas for the extension base + +Part of Wesley Pegden’s Trellis formalization of the Goldberg–Seymour theorem, +commit 88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. These lemmas establish the +base cases used by the extension construction. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ExtensionBaseProof + +private abbrev helperHmissingX6300Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (hseedTj : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (TjPrime : TreeSequence G e0) (a : V ⊕ E) (u0 z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) (zPosition0 : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (hzPosition0 : (ett.series.data.tree + jSlot.succ.castSucc).vertex zPosition0 = z0) (rho3 : PartialEdgeColoring E k) (uPosition : + Fin (TjPrime.length + (1 : ℕ))), + let terminalInTj : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ)) := + Fin.castLE ( + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt terminalPosition + have := hseedTj.1 + have := + GoldbergSeymour.TreeSequence.positive + (TreeSequencePrefix + (ett.series.data.tree + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : + Fin ett.rounds).succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound) + have := + GoldbergSeymour.TreeSequence.positive + (ett.series.data.tree + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : + Fin ett.rounds).succ.castSucc) + all_goals omega) + ) (Fin.last seed.length); + ∀ (hterminalInTjVal : (↑terminalInTj : ℕ) = seed.length) (huPositionPositive : (1 : ℕ) ≤ + (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length) + (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition0 : ℕ)) (hzPositionBound : (↑zPosition0 : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑zPosition0 : ℕ) hzPositionPositive hzPositionBound; + ∀ (hZTj : TreeSequenceInitialSegment Z (ett.series.data.tree jSlot.succ.castSucc)) (hseedU : + TreeSequenceInitialSegment seed U) (hterminalInclusionRho3 : MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho3 v ∪ MissingColors G + rho3 u0) (hbeforeZMissing : + ∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0, y ≠ v → + MissingColors G rho3 y = MissingColors G (ett.series.data.coloring jSlot.castSucc) y) (M : + TreeSequence G e0) (huU : u0 ∈ TreeSequenceVertexSet U) (heveryNewRightEntry : + ∀ (i : Fin Z.length), Z.vertex i.succ ∉ TreeSequenceVertexSet U → + ∃ (j : Fin M.length), U.length ≤ (↑j : ℕ) ∧ M.edge j = Z.edge i ∧ M.vertex j.succ = Z.vertex + i.succ) (hrightOrder : + ∀ (i j : Fin Z.length), Z.vertex i.succ ∉ TreeSequenceVertexSet U → Z.vertex j.succ ∉ + TreeSequenceVertexSet U → (↑i : ℕ) < (↑j : ℕ) → + ∀ (p q : Fin M.length), M.vertex p.succ = Z.vertex i.succ → M.vertex q.succ = Z.vertex j.succ + → (↑p : ℕ) < (↑q : ℕ)) (hseedZSegment : TreeSequenceInitialSegment seed Z) (n : ℕ) (hnU : + U.length ≤ n) (hnM : n + (1 : ℕ) ≤ M.length) (hnM' : n ≤ M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + let j : Fin M.length := (⟨n, + by omega + ⟩ : Fin M.length); + ∀ (i : Fin Z.length) (hvertexMZ : M.vertex j.succ = Z.vertex i.succ) (hrightOutside : Z.vertex + i.succ ∉ TreeSequenceVertexSet U) (hiSeed : seed.length ≤ (↑i : ℕ)) (hiZ : (↑i : ℕ) < + Z.length), + let ZX : TreeSequence G e0 := TreeSequencePrefix Z (↑i : ℕ) (Nat.le_trans seed.positive + hiSeed) (Nat.le_of_lt hiZ); + ∀ (hZXZ : TreeSequenceInitialSegment ZX Z) (hZXlen : ZX.length = (↑i : ℕ)) (A : TreeSequence G + e0) (hlenA : A.length = ZX.length + (1 : ℕ)) (c : Fin k) (hmissingZX : c ∈ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) ZX) (hleftX : + ∀ {y : V} (hyU : y ∈ TreeSequenceVertexSet U), y ∈ TreeSequenceVertexSet X), c ∈ + TreeMissingColors rho3 X + +private abbrev helperHpositiveClaim457133Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length) + (_ : gamma0 (Fin.last p0) = gamma), + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : p0 = (0 : ℕ)), + gammaFirst = gamma + +private abbrev helperHclaim45Package7169Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvStage : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (hrho1Proper : IsProperEdgeColoring G rho1) (hrho1One : IsOneEdgeUncolored rho1 e0) + (hb2Missing : ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (hseedTj : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (hseedTerminal : seed.vertex (Fin.last seed.length) = v) (hTjQ : + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc)), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (hclosure : TashkinovClosure rho1 seed TjPrime) + (hprimeElementary : ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime)) + (hseedPrime : TreeSequenceInitialSegment seed TjPrime) (hb1Tj : StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ (TashkinovStoredColors + ett.series.data jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho1) + (hcaseTwoPointwise : + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅), + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); + ∀ (hgammaSupport : gamma ∈ supportColors) (hdeltaSupport : delta ∈ supportColors) (hgammaDelta + : gamma ≠ delta) (hb2EdgesFromSeed : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) (hdeltaPhiJ : delta ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) (ett.series.data.tree + jSlot.succ.castSucc)) (hterminalSeed : v ∈ TreeSequenceVertexSet seed) (fN : E) + (hdeltaMissing : delta ∈ MissingColors G rho1 v), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (hcomponentPath : + componentPath.IsPath) (hcomponentSupport : {z : V ⊕ E | z ∈ componentPath.support} = C) + (hxOutside : x ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime) (u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u)) (hexitPath : exitPath.IsPath) (hexitLength : (2 : ℕ) + ≤ exitPath.length) (hexitSupport : + ∀ y ∈ exitPath.support, y ∈ componentPath.support) (hexitIntersection : + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) (hexitBoundary : + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) + (huNotFN : ¬Incident G u fN) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (huOutside : u + ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) (hdegree : MaximumDegree G + + (1 : ℕ) ≤ k) (beta : Fin k) (hbeta : beta ∈ MissingColors G rho1 u) (hbetaSupport : beta + ∉ supportColors) (haugmentation : TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) seed (ett.series.data.tree jSlot.succ.castSucc)) (z : V) (hz : z ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (zPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hzPosition : + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z) (hzAfter : seed.length ≤ + (↑zPosition : ℕ)) (hzChoice : (seed.length < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G + rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) + (hzBefore : + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) (hzEdges : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) (hpositiveClaim45 : + ∀ (hp0 : (0 : ℕ) < p0), + ∃ (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (_ : u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (exitPath : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u)), exitPath.IsPath ∧ (2 : ℕ) ≤ exitPath.length ∧ ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) ∧ ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬Incident G u fN ∧ + ∀ beta ∈ MissingColors G rho1 u, + ∃ (z : V) (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z ∧ seed.length ≤ + (↑zPosition : ℕ) ∧ ((seed.length < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + ( + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) ∧ ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) ∧ + ∃ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 ∧ IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 ∧ ( + ∀ v ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz ∪ ({ z } : Finset + V) ∪ (TreeVerticesBefore TjPrime u huPrime ∪ ({ u } : Finset V))).erase u).erase z, + MissingColors G rho3 v = MissingColors G rho1 v) ∧ ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → delta ∈ MissingColors G rho3 z) ∧ (z ∈ TreeVerticesBefore + TjPrime u huPrime → MissingColors G rho3 z = MissingColors G rho1 z) ∧ gammaFirst ∈ + MissingColors G rho3 u) (hgammaFirstZero : + ∀ (hp0 : p0 = (0 : ℕ)), gammaFirst = gamma), + ∃ (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (_ : u0 ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (exitPath0 : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u0)), exitPath0.IsPath ∧ (2 : ℕ) ≤ exitPath0.length ∧ ( + ∀ y ∈ exitPath0.support, y ∈ componentPath.support) ∧ ( + ∀ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl y ∈ exitPath0.support ↔ y = u0) ∧ ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u0 g ∧ Sum.inr g ∈ exitPath0.support) ∧ + ¬Incident G u0 fN ∧ + ∃ beta0 ∈ MissingColors G rho1 u0, beta0 ∉ supportColors ∧ + ∃ (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition0 = z0 ∧ seed.length ≤ + (↑zPosition0 : ℕ) ∧ ((seed.length < (↑zPosition0 : ℕ) ∧ beta0 ∈ MissingColors G rho1 z0 ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition0 : ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition0 = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + ( + ∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0, beta0 ∉ + MissingColors G rho1 y) ∧ ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition0 : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta0) ∧ + ∃ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 ∧ IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 ∧ ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) ∧ ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) ∧ + (beta0 ∈ MissingColors G rho1 z0 → delta ∈ MissingColors G rho3 z0) ∧ (z0 ∈ + TreeVerticesBefore TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 + z0) ∧ gammaFirst ∈ MissingColors G rho3 u0 + +private abbrev helperContinuation8265Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hMP : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvStage : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hjSlot : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (segmentTrans : + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) (vertexTransfer : + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) + (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : + ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → + Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (hrho1Proper : IsProperEdgeColoring G rho1) (hrho1One : IsOneEdgeUncolored rho1 e0) + (hb2Missing : ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v) (hb2TreeEdges : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) (terminalPosition : + Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (hjTreeIndex : jSlot.castSucc.succ = jSlot.succ.castSucc) (hseedTj : + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (hseedTerminal + : seed.vertex (Fin.last seed.length) = v) (hTjQ : TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree q.succ.castSucc)) + (hseedVertexBefore : + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) (segmentVertexBefore : + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) + (transportSeedRoute : + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) (commonPrefix : + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (hclosure : TashkinovClosure rho1 seed TjPrime) + (hprimeElementary : ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime)) + (hseedPrime : TreeSequenceInitialSegment seed TjPrime) (hterminalPrime : v ∈ + TreeSequenceVertexSet TjPrime) (hqLast : indices0 (Fin.last p0) = q) (hb1Tj : + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho1) (hcaseTwoPointwise : + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅), + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); + ∀ (hgammaSupport : gamma ∈ supportColors) (hdeltaSupport : delta ∈ supportColors) (hgammaDelta + : gamma ≠ delta) (hterminalInclusion : MissingColors G (ett.series.data.coloring + jSlot.castSucc) v ⊆ MissingColors G rho1 v ∪ ({ gammaFirst } : Finset (Fin k))) + (hb2EdgesFromSeed : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) (hdeltaPhiJ : delta ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) (ett.series.data.tree + jSlot.succ.castSucc)) (hterminalSeed : v ∈ TreeSequenceVertexSet seed) (hseedN : + TreeSequenceInitialSegment seed (ett.series.data.tree q.succ.castSucc)) (fN : E) + (hdeltaMissing : delta ∈ MissingColors G rho1 v), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a b : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (hcomponentPath : + componentPath.IsPath) (hcomponentSupport : {z : V ⊕ E | z ∈ componentPath.support} = C) + (hxOutside : x ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime) (u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u)) (hexitPath : exitPath.IsPath) (hexitLength : (2 : ℕ) + ≤ exitPath.length) (hexitSupport : + ∀ y ∈ exitPath.support, y ∈ componentPath.support) (hexitIntersection : + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) (hexitBoundary : + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) + (huNotFN : ¬Incident G u fN) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (huOutside : u + ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) (hdegree : MaximumDegree G + + (1 : ℕ) ≤ k) (beta : Fin k) (hbeta : beta ∈ MissingColors G rho1 u) (hbetaSupport : beta + ∉ supportColors), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (hpreviousTj : (0 : ℕ) < (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious + (ett.series.data.tree jSlot.succ.castSucc)) (hpreviousStrict : (0 : ℕ) < (↑jSlot : ℕ) → + Tprevious.length < seed.length) (hpreviousSeed : (0 : ℕ) < (↑jSlot : ℕ) → + TreeSequenceInitialSegment Tprevious seed) (haugmentation : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) seed (ett.series.data.tree jSlot.succ.castSucc)) + (z : V) (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hzPosition : (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z) (hzAfter : + seed.length ≤ (↑zPosition : ℕ)) (hzChoice : (seed.length < (↑zPosition : ℕ) ∧ beta ∈ + MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) + (hzBefore : + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) (hzEdges : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) (hpositiveClaim45 : + ∀ (hp0 : (0 : ℕ) < p0), + ∃ (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (_ : u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (exitPath : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u)), exitPath.IsPath ∧ (2 : ℕ) ≤ exitPath.length ∧ ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) ∧ ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬Incident G u fN ∧ + ∀ beta ∈ MissingColors G rho1 u, + ∃ (z : V) (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z ∧ seed.length ≤ + (↑zPosition : ℕ) ∧ ((seed.length < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + ( + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) ∧ ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) ∧ + ∃ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 ∧ IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 ∧ ( + ∀ v ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz ∪ ({ z } : Finset + V) ∪ (TreeVerticesBefore TjPrime u huPrime ∪ ({ u } : Finset V))).erase u).erase z, + MissingColors G rho3 v = MissingColors G rho1 v) ∧ ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → delta ∈ MissingColors G rho3 z) ∧ (z ∈ TreeVerticesBefore + TjPrime u huPrime → MissingColors G rho3 z = MissingColors G rho1 z) ∧ gammaFirst ∈ + MissingColors G rho3 u) (hgammaFirstZero : + ∀ (hp0 : p0 = (0 : ℕ)), gammaFirst = gamma), False + +private abbrev helperContinuation7187Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hMP : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k) (hsigmaProper : IsProperEdgeColoring G sigma) (hsigmaOne + : IsOneEdgeUncolored sigma e0), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hqGamma : ett.series.data.gamma q.succ = + some gamma) (hqDelta : ett.series.data.delta q.succ = some delta) (hvStage : v ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) (hvFinal : v ∈ + TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hjSlot : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (segmentTrans : + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) (stageToStage : + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (vertexTransfer : + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) + (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : + ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → + Fin k) (hincreasing0 : + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + (hclass0 : + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) (hgamma0 : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.gamma (indices0 a).succ = some (gamma0 a)) + (hdelta0 : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) + (hchain0 : + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) (hinjective0 : Function.Injective (Fin.cons + (gamma0 (0 : Fin (p0 + (1 : ℕ)))) delta0)), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (hrho1Proper : IsProperEdgeColoring G rho1) (hrho1One : IsOneEdgeUncolored rho1 e0) + (hb2Missing : ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v) (hb2TreeEdges : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) (hb3EdgeEffects : + ∀ (f : E), rho1 f ≠ sigma f → f ∉ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) ∧ + ∃ (c : Fin k) (d : Fin k), sigma f = some c ∧ rho1 f = some d ∧ (c ∈ + (ExtensionBaseRestorationIndices ett v hvFinal).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) ∧ d ∈ (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (hjTreeIndex : jSlot.castSucc.succ = jSlot.succ.castSucc) (hseedTj : + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (hseedTerminal + : seed.vertex (Fin.last seed.length) = v) (hTjQ : TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree q.succ.castSucc)) + (hseedVertexBefore : + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) (segmentVertexBefore : + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) + (transportSeedRoute : + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) (commonPrefix : + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (hclosure : TashkinovClosure rho1 seed TjPrime) + (hprimeElementary : ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime)) + (hseedPrime : TreeSequenceInitialSegment seed TjPrime) (hterminalPrime : v ∈ + TreeSequenceVertexSet TjPrime) (hqLast : indices0 (Fin.last p0) = q) (hsupport0 : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.chosenVertex (indices0 a).succ = some v) (hkind0 : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.kind (indices0 a).succ = some + TashkinovExtensionKind.PE) (hstored0 : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) (hb1Tj : StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ (TashkinovStoredColors + ett.series.data jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho1) + (hcaseTwoPointwise : + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅) (hsupportSet : supportColors = (ExtensionBaseSupportClass ett v + hvFinal v).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ) + (hterminalClass : q ∈ ExtensionBaseSupportClass ett v hvFinal v) (hgammaLast : gamma0 + (Fin.last p0) = gamma), + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); + ∀ (hgammaSupport : gamma ∈ supportColors) (hdeltaSupport : delta ∈ supportColors) + (hgammaFirstSupport : gammaFirst ∈ supportColors) (hgammaDelta : gamma ≠ delta), + let restorationColors : Finset (Fin k) := (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ; + ∀ (hterminalColorsNotRestored : gamma ∉ restorationColors ∧ delta ∉ restorationColors) + (hsupportColors : + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → gammaS ∈ supportColors ∧ deltaS ∈ supportColors) (hdeltaEarlier : + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → delta ≠ gammaS ∧ delta ≠ deltaS) (hpreterminalPackage : (0 : ℕ) < p0 → + ∃ (preterminalSlot : Fin ett.rounds), (↑preterminalSlot : ℕ) < (↑q : ℕ) ∧ preterminalSlot ∈ + (ExtensionBaseSupportClass ett v hvFinal v).erase q ∧ ett.series.data.delta + preterminalSlot.succ = some gamma) (hb4Earlier : + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → ETTStrongInterchangeable ett s v rho1 gammaS deltaS) (hsupportComponentOrder + : + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree s.succ.castSucc), x ≠ v → + ∀ (y : V), Sum.inl y ∈ TwoColorComponent G rho1 gammaS deltaS (Sum.inl x) → y ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) (hterminalInclusion : + MissingColors G (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho1 v ∪ + ({ gammaFirst } : Finset (Fin k))) (hb2EdgesFromSeed : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) (hdeltaPhiJ : delta ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) (ett.series.data.tree + jSlot.succ.castSucc)) (hterminalSeed : v ∈ TreeSequenceVertexSet seed) (hseedN : + TreeSequenceInitialSegment seed (ett.series.data.tree q.succ.castSucc)) (fN : E) + (hfNterminal : Incident G v fN) (hphiNProper : IsProperEdgeColoring G + (ett.series.data.coloring q.succ)) (hphiNOne : IsOneEdgeUncolored + (ett.series.data.coloring q.succ) e0) (hgammaBoundary : BoundaryColorEdges G + (ett.series.data.coloring q.succ) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) gamma = ({ fN } : Finset E)) (hdeltaLocation : + ∀ f ∈ BoundaryColorEdges G (ett.series.data.coloring q.succ) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) delta, + ∃ y ∈ TreeSequenceVertexSet seed, Incident G y f) (hdeltaMissing : delta ∈ MissingColors G + rho1 v) (hterminalIntersection' : (MissingColors G rho1 v ∩ supportColors : Finset (Fin + k)) = ({ delta } : Finset (Fin k))), + let controlled : Finset (Fin k) := TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors ett.series.data q.succ; + ∀ (hgammaControlled : gamma ∈ controlled) (hdeltaControlled : delta ∈ controlled) + (hsigmaControlled : StableColoring (ett.series.data.tree q.succ.castSucc) controlled + (ett.series.data.coloring q.succ) sigma), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a b : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (hcomponentPath : + componentPath.IsPath) (hcomponentSupport : {z : V ⊕ E | z ∈ componentPath.support} = C) + (hxOutside : x ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ + TreeSequenceVertexSet TjPrime) (htwoN : + ∃ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), y ≠ v ∧ Sum.inl y ∈ + componentPath.support) (u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u)) (hexitPath : exitPath.IsPath) (hexitLength : (2 : ℕ) + ≤ exitPath.length) (hexitSupport : + ∀ y ∈ exitPath.support, y ∈ componentPath.support) (hexitIntersection : + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) (hexitBoundary : + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) + (huNotFN : ¬Incident G u fN) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (huOutside : u + ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) (hdegree : MaximumDegree G + + (1 : ℕ) ≤ k) (beta : Fin k) (hbeta : beta ∈ MissingColors G rho1 u) (huErase : u ∈ + (TreeSequenceVertexSet TjPrime).erase v) (hbetaSupport : beta ∉ supportColors) + (hbetaGammaFirst : beta ≠ gammaFirst) (hbetaTerminal : beta ∉ MissingColors G rho1 v) + (huSeed : u ∉ TreeSequenceVertexSet seed), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (hpreviousTj : + ∀ (hjPositive : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious + (ett.series.data.tree jSlot.succ.castSucc)) (hpreviousStrict : + ∀ (hjPositive : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length), False + +private abbrev helperContinuation7819Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hMP : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k) (hsigmaProper : IsProperEdgeColoring G sigma) (hsigmaOne + : IsOneEdgeUncolored sigma e0) (w : V) (hw : w ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (hwComponent : Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v)) (hwNe : ¬w = v), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hqSucc : q.succ = Fin.last ett.rounds) + (hqKind : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) (hqVertex : + ett.series.data.chosenVertex q.succ = some v) (hqGamma : ett.series.data.gamma q.succ = + some gamma) (hqDelta : ett.series.data.delta q.succ = some delta) (hvStage : v ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) (hvFinal : v ∈ + TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hjSlot : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (hsigmaTerminal : + StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma) (segmentTrans : + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) (stepSegment : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) (stageToStage : + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (vertexTransfer : + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) (hdeltaExclusion : ( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) (hPEStored : + ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = (insert + gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k))) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) (hqActive : q ∈ ExtensionBaseActiveIndices ett + v hvFinal) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin + (p0 + (1 : ℕ)) → Fin k) (hincreasing0 : + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + (hclass0 : + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) (hgamma0 : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.gamma (indices0 a).succ = some (gamma0 a)) + (hdelta0 : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) + (hchain0 : + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) (hinjective0 : Function.Injective (Fin.cons + (gamma0 (0 : Fin (p0 + (1 : ℕ)))) delta0)), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (hrho1Proper : IsProperEdgeColoring G rho1) (hrho1One : IsOneEdgeUncolored rho1 e0) + (hb2Missing : ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v) (hb2TreeEdges : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) (hb3EdgeEffects : + ∀ (f : E), rho1 f ≠ sigma f → f ∉ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) ∧ + ∃ (c : Fin k) (d : Fin k), sigma f = some c ∧ rho1 f = some d ∧ (c ∈ + (ExtensionBaseRestorationIndices ett v hvFinal).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) ∧ d ∈ (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalAt : (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (hjTreeIndex : jSlot.castSucc.succ = jSlot.succ.castSucc) (hseedTj : + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (hseedTerminal + : seed.vertex (Fin.last seed.length) = v) (hTjQ : TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree q.succ.castSucc)) + (hseedVertexBefore : + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) (segmentVertexBefore : + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) + (transportSeedRoute : + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) (commonPrefix : + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (hclosure : TashkinovClosure rho1 seed TjPrime) + (hprimeElementary : ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime)) + (hseedPrime : TreeSequenceInitialSegment seed TjPrime) (hterminalPrime : v ∈ + TreeSequenceVertexSet TjPrime) (hqLast : indices0 (Fin.last p0) = q) (hsupport0 : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.chosenVertex (indices0 a).succ = some v) (hkind0 : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.kind (indices0 a).succ = some + TashkinovExtensionKind.PE) (hstored0 : + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) (hterminalIntersection : (MissingColors G + rho1 v ∩ supportColors : Finset (Fin k)) = ({delta0 (Fin.last p0)} : Finset (Fin k))) + (hb1Tj : StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v + hterminalJ (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho1) (hcaseTwoPointwise : + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅) (hsupportSet : supportColors = (ExtensionBaseSupportClass ett v + hvFinal v).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ) + (hterminalClass : q ∈ ExtensionBaseSupportClass ett v hvFinal v) (hgammaLast : gamma0 + (Fin.last p0) = gamma) (hdeltaLast : delta0 (Fin.last p0) = delta), + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); + ∀ (hgammaSupport : gamma ∈ supportColors) (hdeltaSupport : delta ∈ supportColors) + (hgammaFirstSupport : gammaFirst ∈ supportColors) (hgammaDelta : gamma ≠ delta), + let restorationColors : Finset (Fin k) := (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ; + ∀ (hterminalColorsNotRestored : gamma ∉ restorationColors ∧ delta ∉ restorationColors) + (hsupportColors : + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → gammaS ∈ supportColors ∧ deltaS ∈ supportColors) (hdeltaEarlier : + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → delta ≠ gammaS ∧ delta ≠ deltaS) (hpreterminalPackage : (0 : ℕ) < p0 → + ∃ (preterminalSlot : Fin ett.rounds), (↑preterminalSlot : ℕ) < (↑q : ℕ) ∧ preterminalSlot ∈ + (ExtensionBaseSupportClass ett v hvFinal v).erase q ∧ ett.series.data.delta + preterminalSlot.succ = some gamma) (hb4Earlier : + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → ETTStrongInterchangeable ett s v rho1 gammaS deltaS) (hsupportComponentOrder + : + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree s.succ.castSucc), x ≠ v → + ∀ (y : V), Sum.inl y ∈ TwoColorComponent G rho1 gammaS deltaS (Sum.inl x) → y ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) (hterminalInclusion : + MissingColors G (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho1 v ∪ + ({ gammaFirst } : Finset (Fin k))) (hb2EdgesFromSeed : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) (hdeltaPhiJ : delta ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) (ett.series.data.tree + jSlot.succ.castSucc)) (hterminalSeed : v ∈ TreeSequenceVertexSet seed), False + +private abbrev helperCaseContinuation8566Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (v : V) (sigma : PartialEdgeColoring E + k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (_ : + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) (_ : + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) + (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : + ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ : ( + ∀ v_1 ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.castSucc.succ)).erase v, + MissingColors G (trace.coloring (Fin.last trace.steps)) v_1 = MissingColors G + (ett.series.data.coloring jSlot.castSucc) v_1) ∧ MissingColors G (trace.coloring (Fin.last + trace.steps)) v = MissingColors G sigma v), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v) (_ : + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) (terminalPosition : + Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : seed.vertex (Fin.last seed.length) = v) + (_ : + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) (TjPrime : TreeSequence G e0) (_ : + indices0 (Fin.last p0) = q) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (b : Fin + (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b) (_ : u + ∉ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + ∀ (_ : StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) (traceB.coloring (Fin.last traceB.steps))) (_ : ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore + TjPrime u huPrime, MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = + MissingColors G rho1 x) ∧ + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → traceB.coloring (Fin.last traceB.steps) f = rho1 f) + (_ : IsProperEdgeColoring G rho2) (_ : IsOneEdgeUncolored rho2 e0) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (_ : TjPrime.vertex uPosition = u) (huPositionPositive : (1 : + ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed U) (_ : TashkinovAugmentationSequence rho2 seed U) (_ : + MissingColors G (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho2 v ∪ + MissingColors G rho2 u), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious (ett.series.data.tree + jSlot.succ.castSucc)) (_ : + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length) (_ : + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed) (_ : + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) seed + (ett.series.data.tree jSlot.succ.castSucc)), False + +theorem helper_branch_3512.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k) + (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v + hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a b : V ⊕ E) (spanningPath : (TwoColorIncidenceGraph G rho1 gamma delta).Walk a b), + spanningPath.IsPath → {x : V ⊕ E | x ∈ spanningPath.support} = TwoColorComponent G rho1 + gamma delta (Sum.inl v) → Sum.inl v ∈ spanningPath.support → Sum.inl v = b → + ∃ (endpoint : V ⊕ E) (componentPath : H.Walk (Sum.inl v) endpoint), componentPath.IsPath ∧ + {z : V ⊕ E | z ∈ componentPath.support} = C := by + classical + intro V E _ _ _ G k e0 input T generating ett v gamma delta sigma hvFinal trace rho1 H C a b + spanningPath hspanningPath hspanningSupport hvSpanning hvb + subst b + refine ⟨a, spanningPath.reverse, hspanningPath.reverse, ?_⟩ + ext z + rw [SimpleGraph.Walk.support_reverse] + simpa using Set.ext_iff.mp hspanningSupport z + +theorem helper_hfNComponent_3517.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k) (hvFinal : v ∈ TreeSequenceVertexSet T) + (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (fN : E), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + H.Adj (Sum.inl v) (Sum.inr fN) → + Sum.inr fN ∈ C := by + classical + intro V E _ _ _ G k e0 input T generating ett v gamma delta sigma hvFinal trace rho1 fN H C hfNAdj + change H.connectedComponentMk (Sum.inr fN) = + H.connectedComponentMk (Sum.inl v) + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hfNAdj).symm + +theorem helper_hcomponentNonempty_3523.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k) + (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v + hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (fN : E), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (endpoint : V ⊕ E) (componentPath : H.Walk (Sum.inl v) endpoint), componentPath.IsPath → + {z : V ⊕ E | z ∈ componentPath.support} = C → Sum.inr fN ∈ C → ¬componentPath.Nil := by + classical + intro V E _ _ _ G k e0 input T generating ett v gamma delta sigma hvFinal trace rho1 fN H C + endpoint componentPath hcomponentPath hcomponentSupport hfNComponent hnil + have hfNSupport : Sum.inr fN ∈ componentPath.support := by + change Sum.inr fN ∈ {z | z ∈ componentPath.support} + rw [hcomponentSupport] + exact hfNComponent + cases hnil + simp at hfNSupport + +theorem helper_hxNe_3545.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k) + (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v + hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)), componentPath.IsPath → + {z : V ⊕ E | z ∈ componentPath.support} = C → ¬componentPath.Nil → (0 : ℕ) < + componentPath.length → Sum.inl x ∈ C → ( + ∀ (z : V ⊕ E), H.Adj (Sum.inl x) z → z = componentPath.getVert (componentPath.length - (1 : + ℕ))) → x ≠ v := by + classical + intro V E _ _ _ G k e0 input T generating ett v gamma delta sigma hvFinal trace rho1 H C x + componentPath hcomponentPath hcomponentSupport hcomponentNonempty hcomponentPositive + hendpointC hendpointNeighbor hxv + subst x + have hnil : componentPath.Nil := + hcomponentPath.nil_iff_eq.mpr rfl + exact hcomponentNonempty hnil + +theorem helper_hbetaSupport_3628.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal + sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0), ( + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅) → + ∀ (u : V), + ∀ beta ∈ MissingColors G rho1 u, u ∈ (TreeSequenceVertexSet TjPrime).erase v → beta ∉ + supportColors := by + classical + intro V E _ _ _ G k e0 input T generating ett v sigma this hvFinal trace p0 indices0 rho1 + supportColors TjPrime hcaseTwoPointwise u beta hbeta huErase hbetaIn + have hmember : beta ∈ MissingColors G rho1 u ∩ supportColors := + Finset.mem_inter.mpr ⟨hbeta, hbetaIn⟩ + rw [hcaseTwoPointwise u huErase] at hmember + simp at hmember + +theorem helper_hcaseTwoObservationPackage_3695.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (fN : E), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)), exitPath.IsPath + → (2 : ℕ) ≤ exitPath.length → ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support) → ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) → ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) → + ¬Incident G u fN → u ∈ TreeSequenceVertexSet TjPrime → u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ beta ∈ MissingColors G rho1 u, beta ∉ supportColors → + ∀ (z : V) (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z → seed.length ≤ + (↑zPosition : ℕ) → ((seed.length < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) → + ( + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) → (u ∈ TreeSequenceVertexSet TjPrime ∧ u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) ∧ (exitPath.IsPath ∧ (2 : ℕ) ≤ exitPath.length ∧ ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support) ∧ ( + ∀ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl y ∈ exitPath.support ↔ y = u) ∧ ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬Incident G u fN) ∧ (beta ∈ MissingColors G rho1 u ∧ beta ∉ supportColors) ∧ z ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∧ (ett.series.data.tree + jSlot.succ.castSucc).vertex zPosition = z ∧ seed.length ≤ (↑zPosition : ℕ) ∧ ((seed.length + < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + ( + ∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 y) ∧ + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed supportColors TjPrime fN H x + componentPath u exitPath hexitPath hexitLength hexitSupport hexitIntersection hexitBoundary + huNotFN huPrime huOutside beta hbeta hbetaSupport z hz zPosition hzPosition hzAfter + hzChoice hzBefore hzEdges + exact ⟨⟨huPrime, huOutside⟩, + ⟨hexitPath, hexitLength, hexitSupport, hexitIntersection, + hexitBoundary, huNotFN⟩, + ⟨hbeta, hbetaSupport⟩, + ⟨hz, hzPosition, hzAfter, hzChoice, hzBefore, hzEdges⟩⟩ + +theorem helper_hgammaFirstZero_3790.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (gamma0 _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (1 : + ℕ) ≤ (↑terminalPosition : ℕ) → (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length → gamma0 (Fin.last p0) = gamma → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))), p0 = (0 : ℕ) → gammaFirst = gamma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound hgammaLast gammaFirst H x + componentPath u exitPath zPosition hp0 + unfold gammaFirst + rw [← hgammaLast] + congr 1 + apply Fin.ext + omega + +theorem helper_hvBeforePrime_3939.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; seed.vertex + (Fin.last seed.length) = v → + ∀ (TjPrime : TreeSequence G e0), TreeSequenceInitialSegment seed TjPrime → v ∈ + TreeSequenceVertexSet seed → + ∀ (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (uPosition : Fin (TjPrime.length + + (1 : ℕ))), TjPrime.vertex uPosition = u0 → seed.length < (↑uPosition : ℕ) → v ∈ + TreeVerticesBefore TjPrime u0 huPrime0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot vertexTransfer terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTerminal TjPrime hseedPrime hterminalSeed u0 huPrime0 + uPosition huPosition hseedBeforeU + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + let vPosition : Fin (TjPrime.length + 1) := + Fin.castLE (Nat.succ_le_succ hseedPrime.1) + (Fin.last seed.length) + refine ⟨vertexTransfer hseedPrime hterminalSeed, + vPosition, uPosition, ?_, huPosition, ?_⟩ + · exact (hseedPrime.2.1 (Fin.last seed.length)).trans + hseedTerminal + · change seed.length < uPosition.val + exact hseedBeforeU + +theorem helper_hUPrime_3958.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (TjPrime : TreeSequence + G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ + (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; TreeSequenceInitialSegment U TjPrime := by + classical + intro V E G e0 TjPrime uPosition huPositionPositive huPositionBound U + refine ⟨huPositionBound, ?_, ?_⟩ + · intro i + simp [U, TreeSequencePrefix] + · intro i + simp [U, TreeSequencePrefix] + +theorem helper_hbeforePrimeNeU_3983.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet + TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : Fin + (TjPrime.length + (1 : ℕ))) {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0 + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition y hy + unfold TreeVerticesBefore at hy + obtain ⟨-, i, j, hiy, hju, hij⟩ := Finset.mem_filter.mp hy + intro hyu + have hijEq : i = j := TjPrime.vertex_injective + (hiy.trans (hyu.trans hju.symm)) + omega + +theorem helper_hbeforePrimeMissing_3991.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (z0 : + V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (rho3 : + PartialEdgeColoring E k), ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → (z0 ∈ TreeVerticesBefore + TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 z0) → ( + ∀ {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0) → + ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, MissingColors G rho3 y = MissingColors G rho1 y + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hd2z + hbeforePrimeNeU y hy + by_cases hyz : y = z0 + · subst y + exact hd2z hy + · apply hd2Missing y + apply Finset.mem_erase.mpr + refine ⟨hyz, Finset.mem_erase.mpr ⟨hbeforePrimeNeU hy, ?_⟩⟩ + exact Finset.mem_union_right _ (Finset.mem_union_left _ hy) + +theorem helper_transportURoute_4006.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (sigma : PartialEdgeColoring E k) (hvFinal : v ∈ + TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (rho3 : PartialEdgeColoring E k) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation rho1 A B → TreeSequenceInitialSegment B U → + TashkinovAugmentation rho3 A B) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence rho1 S U → + TashkinovAugmentationSequence rho3 S U := by + classical + intro V E _ _ _ G k e0 input T generating ett v sigma hvFinal trace rho1 TjPrime rho3 uPosition + huPositionPositive huPositionBound U transportUStep S hroute + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBU ih => + have hBsegment : TreeSequenceInitialSegment B U := + TashkinovAugmentationSequenceInitialSegment rho1 B U hBU + exact Relation.ReflTransGen.head + (transportUStep hAB hBsegment) ih + +theorem helper_huU_4024.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (TjPrime : TreeSequence G e0) (u0 : V) (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 → + ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + u0 ∈ TreeSequenceVertexSet U := by + classical + intro V E G e0 TjPrime u0 uPosition huPosition huPositionPositive huPositionBound U + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨Fin.last U.length, ?_⟩ + change TjPrime.vertex (Fin.castLE (Nat.succ_le_succ huPositionBound) + (Fin.last uPosition.val)) = u0 + have hindex : Fin.castLE (Nat.succ_le_succ huPositionBound) + (Fin.last uPosition.val) = uPosition := by + apply Fin.ext + rfl + rw [hindex] + exact huPosition + +theorem helper_segmentVertexBefore_4061.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ) → + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {y : V}, y ∈ TreeSequenceVertexSet A → y ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hterminalJ terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedVertexBefore A hAseed hAlen y hyA + obtain ⟨hAseedLen, hAseedVertices, -⟩ := hAseed + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hyA + obtain ⟨i, rfl⟩ := hyA + have hi : (Fin.castLE (Nat.succ_le_succ hAseedLen) i).val < + seed.length := by + change i.val < seed.length + exact lt_of_le_of_lt (Nat.lt_succ_iff.mp i.isLt) hAlen + rw [← hAseedVertices i] + exact hseedVertexBefore _ hi + +theorem helper_transportSeedRoute_4083.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (rho3 : PartialEdgeColoring E k), ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation (ett.series.data.coloring jSlot.castSucc) A + B → TreeSequenceInitialSegment B seed → TashkinovAugmentation rho3 A B) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho3 S seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + rho3 transportSeedStep S hroute + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBseed ih => + have hBsegment : TreeSequenceInitialSegment B seed := + TashkinovAugmentationSequenceInitialSegment _ B seed hBseed + exact Relation.ReflTransGen.head + (transportSeedStep hAB hBsegment) ih + +theorem helper_hzChoiceForContradiction_4107.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (beta0 : Fin k) (z0 : V) (zPosition0 : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))), ((seed.length < (↑zPosition0 : ℕ) ∧ beta0 ∈ + MissingColors G rho1 z0 ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition0 : ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition0 = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) → + zPosition0 = Fin.last (ett.series.data.tree jSlot.succ.castSucc).length ∨ (↑zPosition0 : + ℕ) < (↑(Fin.last (ett.series.data.tree jSlot.succ.castSucc).length) : ℕ) ∧ beta0 ∈ + MissingColors G rho1 z0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 terminalPosition hterminalPositionPositive + hterminalPositionBound seed beta0 z0 zPosition0 hzChoice0 + rcases hzChoice0 with hfirst | hlast + · by_cases heq : zPosition0 = Fin.last + (ett.series.data.tree jSlot.succ.castSucc).length + · exact Or.inl heq + · right + refine ⟨?_, hfirst.2.1⟩ + exact lt_of_le_of_ne + (Fin.le_iff_val_le_val.mp (Fin.le_last zPosition0)) + (fun hval => heq (Fin.ext hval)) + · exact Or.inl hlast.1 + +theorem helper_hUPrime_4274.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (TjPrime : TreeSequence + G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ + (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; TreeSequenceInitialSegment U TjPrime := by + classical + intro V E G e0 TjPrime uPosition huPositionPositive huPositionBound U + refine ⟨huPositionBound, ?_, ?_⟩ + · intro i + simp [U, TreeSequencePrefix] + · intro i + simp [U, TreeSequencePrefix] + +theorem helper_hZTj_4280.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition0 : ℕ)) + (hzPositionBound : + (↑zPosition0 : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let Z : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑zPosition0 : ℕ) + hzPositionPositive hzPositionBound; + TreeSequenceInitialSegment Z (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot zPosition0 hzPositionPositive hzPositionBound Z + refine ⟨hzPositionBound, ?_, ?_⟩ + · intro i + simp [Z, TreeSequencePrefix] + · intro i + simp [Z, TreeSequencePrefix] + +theorem helper_hbeforePrimeNeU_4309.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet + TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : Fin + (TjPrime.length + (1 : ℕ))) {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0 + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition y hy + unfold TreeVerticesBefore at hy + obtain ⟨-, i, j, hiy, hju, hij⟩ := Finset.mem_filter.mp hy + intro hyu + have hijEq : i = j := TjPrime.vertex_injective + (hiy.trans (hyu.trans hju.symm)) + omega + +theorem helper_hbeforePrimeMissing_4318.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (z0 : + V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (rho3 : + PartialEdgeColoring E k), ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → (z0 ∈ TreeVerticesBefore + TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 z0) → ( + ∀ {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0) → + ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, MissingColors G rho3 y = MissingColors G rho1 y + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hd2z + hbeforePrimeNeU y hy + by_cases hyz : y = z0 + · subst y + exact hd2z hy + · apply hd2Missing y + apply Finset.mem_erase.mpr + refine ⟨hyz, Finset.mem_erase.mpr ⟨hbeforePrimeNeU hy, ?_⟩⟩ + exact Finset.mem_union_right _ (Finset.mem_union_left _ hy) + +theorem helper_transportURoute_4333.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (sigma : PartialEdgeColoring E k) (hvFinal : v ∈ + TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (rho3 : PartialEdgeColoring E k) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation rho1 A B → TreeSequenceInitialSegment B U → + TashkinovAugmentation rho3 A B) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence rho1 S U → + TashkinovAugmentationSequence rho3 S U := by + classical + intro V E _ _ _ G k e0 input T generating ett v sigma hvFinal trace rho1 TjPrime rho3 uPosition + huPositionPositive huPositionBound U transportUStep S hroute + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBU ih => + have hBsegment : TreeSequenceInitialSegment B U := + TashkinovAugmentationSequenceInitialSegment rho1 B U hBU + exact Relation.ReflTransGen.head + (transportUStep hAB hBsegment) ih + +theorem helper_hterminalMissingEq_4347.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (z0 : + V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (rho3 : + PartialEdgeColoring E k), ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → ¬z0 = v → v ∈ + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 → v ≠ u0 → + MissingColors G rho3 v = MissingColors G rho1 v := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hzv + hterminalBeforeZ hterminalNeU + apply hd2Missing v + apply Finset.mem_erase.mpr + refine ⟨(fun hvz => hzv hvz.symm), + Finset.mem_erase.mpr ⟨hterminalNeU, ?_⟩⟩ + exact Finset.mem_union_left _ + (Finset.mem_union_left _ hterminalBeforeZ) + +theorem helper_hterminalInclusionRho3_4355.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (gamma0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); + MissingColors G (ett.series.data.coloring jSlot.castSucc) v ⊆ + MissingColors G rho1 v ∪ ({ gammaFirst } : Finset (Fin k)) → + ∀ (u0 : V) (rho3 : PartialEdgeColoring E k), + gammaFirst ∈ MissingColors G rho3 u0 → + MissingColors G rho3 v = MissingColors G rho1 v → + MissingColors G (ett.series.data.coloring jSlot.castSucc) v ⊆ + MissingColors G rho3 v ∪ MissingColors G rho3 u0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 gamma0 rho1 gammaFirst hterminalInclusion u0 rho3 + hd3 hterminalMissingEq c hc + rcases Finset.mem_union.mp (hterminalInclusion hc) with + hcTerminal | hcGamma + · exact Finset.mem_union_left _ (hterminalMissingEq.symm ▸ hcTerminal) + · apply Finset.mem_union_right + have hcgamma : c = gammaFirst := Finset.mem_singleton.mp hcGamma + simpa [hcgamma] using hd3 + +theorem helper_hbeforeZData_4365.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (_ : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u0)) (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (_ : Fin (TjPrime.length + (1 : ℕ))) {y : V}, y ∈ + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 → y ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∧ y ≠ z0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 exitPath0 z0 hz0 zPosition0 uPosition y hy + unfold TreeVerticesBefore at hy + obtain ⟨hyTj, i, j, hiy, hjz, hij⟩ := Finset.mem_filter.mp hy + refine ⟨hyTj, ?_⟩ + intro hyz + have hijEq : i = j := + (ett.series.data.tree jSlot.succ.castSucc).vertex_injective + (hiy.trans (hyz.trans hjz.symm)) + omega + +theorem helper_huU_4386.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (TjPrime : TreeSequence G e0) (u0 : V) (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 → + ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + u0 ∈ TreeSequenceVertexSet U := by + classical + intro V E G e0 TjPrime u0 uPosition huPosition huPositionPositive huPositionBound U + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨Fin.last U.length, ?_⟩ + change TjPrime.vertex (Fin.castLE (Nat.succ_le_succ huPositionBound) + (Fin.last uPosition.val)) = u0 + have hindex : Fin.castLE (Nat.succ_le_succ huPositionBound) + (Fin.last uPosition.val) = uPosition := by + apply Fin.ext + rfl + rw [hindex] + exact huPosition + +theorem helper_prefixSegment_4407.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (A : TreeSequence G e0) (q0 : ℕ) (hq0 : (1 : ℕ) ≤ q0) (hqA : q0 ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A q0 hq0 hqA) A := by + classical + intro V E G e0 A q0 hq0 hqA + refine ⟨hqA, ?_, ?_⟩ + · intro i + simp [TreeSequencePrefix] + · intro i + simp [TreeSequencePrefix] + +theorem helper_prefixPrefix_4416.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) + (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : Fin (TjPrime.length + (1 : ℕ))) (A : TreeSequence G e0) (q0 : ℕ) + (hq0 : (1 : ℕ) ≤ q0) (hqA : q0 + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment + (TreeSequencePrefix A q0 hq0 (Nat.le_trans (Nat.le_succ q0) hqA)) + (TreeSequencePrefix A (q0 + (1 : ℕ)) (by omega) hqA) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 exitPath0 zPosition0 uPosition A q0 hq0 hqA + refine ⟨Nat.le_succ q0, ?_, ?_⟩ + · intro i + change A.vertex _ = A.vertex _ + congr 1 + · intro i + change A.edge _ = A.edge _ + congr 1 + +theorem helper_prefixSelf_4429.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (A : TreeSequence G e0), + TreeSequencePrefix A A.length A.positive le_rfl = A := by + classical + intro V E G e0 A + cases A with + | mk len pos vertex edge vinj einj first attach => + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + rfl + · apply heq_of_eq + funext i + rfl + +theorem helper_hleftX_4557.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (TjPrime : TreeSequence + G e0) (_ : V ⊕ E) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : + ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (M : TreeSequence G e0), TreeSequenceInitialSegment U M → + ∀ (n : ℕ) (hnU : U.length ≤ n) (hnM' : n ≤ M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + ∀ {y : V}, y ∈ TreeSequenceVertexSet U → y ∈ TreeSequenceVertexSet X := by + classical + intro V E G e0 TjPrime b uPosition huPositionPositive huPositionBound U M hleftSegment n hnU + hnM' X y hyU + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hyU ⊢ + obtain ⟨b, hb⟩ := hyU + refine ⟨Fin.castLE (Nat.succ_le_succ hnU) b, ?_⟩ + change M.vertex _ = y + calc + M.vertex _ = M.vertex + (Fin.castLE (Nat.succ_le_succ hleftSegment.1) b) := by + congr 1 + _ = U.vertex b := hleftSegment.2.1 b + _ = y := hb + +theorem helper_branch_4837.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc), w = v → + Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) := by + classical + intro V E _ _ _ G k e0 input T generating ett v gamma delta sigma w hw hwv + subst w + change Sum.inl v ∈ + (TwoColorIncidenceGraph G sigma gamma delta).connectedComponentMk + (Sum.inl v) + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + +theorem helper_hXY_5375.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), ( + ∀ v_1 ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.castSucc.succ)).erase v, + MissingColors G (trace.coloring (Fin.last trace.steps)) v_1 = MissingColors G + (ett.series.data.coloring jSlot.castSucc) v_1) ∧ MissingColors G (trace.coloring (Fin.last + trace.steps)) v = MissingColors G sigma v → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : + (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length) (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ + TreeSequenceVertexSet TjPrime) (b : Fin (p0 + (1 : ℕ))) (traceB : + ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); (( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore + TjPrime u huPrime, MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = + MissingColors G rho1 x) ∧ + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → traceB.coloring (Fin.last traceB.steps) f = rho1 f) + → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : + ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (M : TreeSequence G e0), ( + ∀ (A : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hrA : r + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A r hr (Nat.le_trans (Nat.le_succ r) hrA)) + (TreeSequencePrefix A (r + (1 : ℕ)) ( + by omega + ) hrA)) → + ∀ (n : ℕ) (hnU : U.length ≤ n) (hnM hnSuccM : n + (1 : ℕ) ≤ M.length) (hnM' : n ≤ M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + let Y : TreeSequence G e0 := TreeSequencePrefix M (n + (1 : ℕ)) ( + by omega + ) hnSuccM; + let mIndex : Fin M.length := (⟨n, + by + have := GoldbergSeymour.TreeSequence.positive M + omega + ⟩ : Fin M.length); + ∀ (i : Fin Tj0.length), M.edge mIndex = Tj0.edge i → + ∀ (c : Fin k), ett.series.data.coloring jSlot.castSucc (Tj0.edge i) = some c → c ∈ + TreeMissingColors rho2 X → TashkinovAugmentation rho2 X Y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 indices0 hb2 rho1 hb2TreeEdges terminalPosition + hterminalPositionPositive hterminalPositionBound TjPrime u huPrime b traceB rho2 c2 + uPosition huPositionPositive huPositionBound U Tj0 M prefixPrefix n hnU hnM hnSuccM hnM' X + Y mIndex i hedgeMTj c hcolorTj hmissingX + have hlenXY : Y.length = X.length + 1 := by + change n + 1 = n + 1 + rfl + refine ⟨hlenXY, ?_, c, ?_, hmissingX⟩ + · simpa [X, Y] using prefixPrefix M n + (Nat.le_trans U.positive hnU) hnSuccM + · have hfixedTj : rho2 (Tj0.edge i) = + ett.series.data.coloring jSlot.castSucc + (Tj0.edge i) := by + have hc2 : rho2 (Tj0.edge i) = rho1 (Tj0.edge i) := by + apply c2.2 + apply Or.inl + exact ⟨i, by simp [Tj0]⟩ + have hb2 := hb2TreeEdges + (Fin.cast (by simp [Tj0]) i) + simpa [Tj0] using hc2.trans (hb2.1.trans hb2.2) + have hcolorM : rho2 (M.edge mIndex) = some c := by + rw [hedgeMTj] + exact hfixedTj.trans hcolorTj + change rho2 (M.edge _) = some c + convert hcolorM using 1 + apply congrArg rho2 + apply congrArg M.edge + apply Fin.ext + rfl + +theorem helper_hXY_6689.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : + TreeSequence G e0), ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (_ : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u0)) (zPosition0 : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : PartialEdgeColoring E k), ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : + ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ + (↑zPosition0 : ℕ)) (hzPositionBound : (↑zPosition0 : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑zPosition0 : ℕ) hzPositionPositive hzPositionBound; TreeSequenceInitialSegment Z + (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (M : TreeSequence G e0), ( + ∀ (A : TreeSequence G e0) (q0 : ℕ) (hq0 : (1 : ℕ) ≤ q0) (hqA : q0 + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A q0 hq0 (Nat.le_trans (Nat.le_succ q0) + hqA)) (TreeSequencePrefix A (q0 + (1 : ℕ)) ( + by omega + ) hqA)) → + ∀ (n : ℕ) (hnU : U.length ≤ n) (hnM hnSuccM : n + (1 : ℕ) ≤ M.length) (hnM' : n ≤ M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + let Y : TreeSequence G e0 := TreeSequencePrefix M (n + (1 : ℕ)) ( + by omega + ) hnSuccM; + let j : Fin M.length := (⟨n, + by + have := GoldbergSeymour.TreeSequence.positive M + omega + ⟩ : Fin M.length); + ∀ (i : Fin Z.length), M.edge j = Z.edge i → seed.length ≤ (↑i : ℕ) → + ∀ (c : Fin k), ett.series.data.coloring jSlot.castSucc (Z.edge i) = some c → c ∈ + TreeMissingColors rho3 X → TashkinovAugmentation rho3 X Y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime + hb2EdgesFromSeed H x componentPath u exitPath zPosition u0 exitPath0 zPosition0 rho3 + hd2Edges uPosition huPositionPositive huPositionBound hzPositionPositive hzPositionBound U + Z hZTj M prefixPrefix n hnU hnM hnSuccM hnM' X Y j i hedgeMZ hiSeed c hcolorZ hmissingX + have hlenXY : Y.length = X.length + 1 := by rfl + refine ⟨hlenXY, ?_, c, ?_, hmissingX⟩ + · simpa [X, Y] using prefixPrefix M n + (Nat.le_trans U.positive hnU) hnSuccM + · let iTj : Fin + (ett.series.data.tree jSlot.succ.castSucc).length := + Fin.castLE hZTj.1 i + have hiTj : iTj.val < zPosition0.val := by + change i.val < zPosition0.val + have hiLt := i.isLt + simp only [Fin.castSucc_succ, TreeSequencePrefix, Nat.succ_eq_add_one, Z] at hiLt + exact hiLt + have hiSeedTj : seed.length ≤ iTj.val := by + exact hiSeed + have hedgeTj : + (ett.series.data.tree jSlot.succ.castSucc).edge iTj = + Z.edge i := hZTj.2.2 i + have hfixedZ : rho3 (Z.edge i) = + ett.series.data.coloring jSlot.castSucc (Z.edge i) := by + calc + rho3 (Z.edge i) = rho1 (Z.edge i) := + hd2Edges (Z.edge i) + (Or.inl ⟨iTj, hiSeedTj, hiTj, hedgeTj⟩) + _ = ett.series.data.coloring + jSlot.castSucc (Z.edge i) := by + rw [← hedgeTj] + exact hb2EdgesFromSeed iTj hiSeedTj + have hcolorM : rho3 (M.edge j) = some c := by + rw [hedgeMZ] + exact hfixedZ.trans hcolorZ + change rho3 (M.edge _) = some c + convert hcolorM using 1 + apply congrArg rho3 + apply congrArg M.edge + apply Fin.ext + rfl + +theorem helper_hdeltaAvoids_5315.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) → + ∀ (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) → + ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) → + ∀ (gammaClass deltaClass : Fin (p + (1 : ℕ)) → Fin k), ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gammaClass a)) → ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (deltaClass a)) → u ∈ + TreeSequenceVertexSet T → + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) ≤ (↑b : ℕ) → deltaClass b ≠ gammaClass a := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hdeltaExclusion u p indices hincreasing hclass gammaClass deltaClass + hgammaClass hdeltaClass huFinal + exact @helper_hdeltaAvoids_958 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hdeltaExclusion) (@u) (@p) (@indices) + (@hincreasing) (@hclass) (@gammaClass) (@deltaClass) (@hgammaClass) (@hdeltaClass) + (@huFinal) + +theorem helper_hseedVertexBefore_5540.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; seed.vertex + (Fin.last seed.length) = v → TreeSequenceInitialSegment seed T → + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot vertexTransfer terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTerminal hseedFinal i hi + exact @helper_hseedVertexBefore_2479 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTerminal) (@hseedFinal) + (@i) (@hi) + +theorem helper_segmentVertexBefore_5548.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hseedVertexBefore A hAseed hAlen x hxA + exact @helper_segmentVertexBefore_2493 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedVertexBefore) (@A) + (@hAseed) (@hAlen) (@x) (@hxA) + +theorem helper_branch_5591.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → IsOneEdgeUncolored rho1 e0 → StableColoringBeforeVertex T v + hvFinal (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho1 → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v → + ∀ (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; (0 : ℕ) < (↑jSlot : ℕ) → + ∃ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime ∧ + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) ∧ + let awayMissing : Finset (Fin k) := ((TreeSequenceVertexSet TjPrime).erase v).biUnion fun (x : + V) ↦ MissingColors G rho1 x; (awayMissing ∩ supportColors : Finset (Fin k)).Nonempty ∨ + (awayMissing ∩ supportColors : Finset (Fin k)) = ∅ := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower v sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot stepSegment trace p0 indices0 rho1 hrho1Proper + hrho1One hb1Rho terminalPosition hterminalAt hterminalPositionPositive hterminalPositionBound + seed hjTreeIndex hseedTj segmentVertexBefore transportSeedRoute commonPrefix supportColors + hjPositive + exact @helper_branch_880 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@hjSlot) (@stepSegment) (@trace) (@p0) (@indices0) (@hrho1Proper) (@hrho1One) + (@hb1Rho) (@terminalPosition) (@hterminalAt) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@segmentVertexBefore) + (@transportSeedRoute) (@commonPrefix) (@hjPositive) + +theorem helper_hseedBeforeU_5770.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0), TreeSequenceInitialSegment seed TjPrime → + ∀ (u : V) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u → u ∉ + TreeSequenceVertexSet seed → seed.length < (↑uPosition : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed TjPrime hseedPrime u uPosition huPosition huNotSeed + exact @helper_hseedBeforeU_2115 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@hseedPrime) (@u) + (@uPosition) (@huPosition) (@huNotSeed) + +theorem helper_hUsegmentVertexBefore_5797.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (1 : ℕ) ≤ + (↑terminalPosition : ℕ) → (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length → + ∀ (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : + ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; TreeSequenceInitialSegment U TjPrime → ( + ∀ (i : Fin (TjPrime.length + (1 : ℕ))), (↑i : ℕ) < (↑uPosition : ℕ) → TjPrime.vertex i ∈ + TreeVerticesBefore TjPrime u huPrime) → + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A U → A.length < U.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore TjPrime u huPrime := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound TjPrime u huPrime uPosition huPositionPositive huPositionBound U + hUPrime hprimeVertexBefore A hAU hAlen x hxA + exact @helper_hUsegmentVertexBefore_2265 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@u) (@huPrime) (@uPosition) (@huPositionPositive) (@huPositionBound) (@hUPrime) + (@hprimeVertexBefore) (@A) (@hAU) (@hAlen) (@x) (@hxA) + +theorem helper_transportUStep_5808.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (1 : + ℕ) ≤ (↑terminalPosition : ℕ) → (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length → + ∀ (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (b : Fin + (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); (( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore + TjPrime u huPrime, MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = + MissingColors G rho1 x) ∧ + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → traceB.coloring (Fin.last traceB.steps) f = rho1 f) + → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u → + ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; TreeSequenceInitialSegment U TjPrime → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A U → A.length < U.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore TjPrime u huPrime) → + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation rho1 A B → TreeSequenceInitialSegment B U → + TashkinovAugmentation rho2 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound TjPrime u huPrime b traceB rho2 c2 + uPosition huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore A B + hstep hBU + exact @helper_transportUStep_2285 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) (@trace) + (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@u) (@huPrime) (@b) (@traceB) (@c2) + (@uPosition) (@huPosition) (@huPositionPositive) (@huPositionBound) (@hUPrime) + (@hUsegmentVertexBefore) (@A) (@B) (@hstep) (@hBU) + +theorem helper_hterminalInclusion_5831.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), ( + let storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; (MissingColors G sigma v ∩ storedPairs : Finset + (Fin k)) = ({delta0 (Fin.last p0)} : Finset (Fin k)) ∧ MissingColors G + (ett.series.data.coloring jSlot.castSucc) v = MissingColors G sigma v \ + ({delta0 (Fin.last p0)} : Finset (Fin k)) ∪ ({gamma0 (0 : Fin (p0 + (1 : ℕ)))} : Finset + (Fin k))) → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 + indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); gamma0 (0 : Fin + (p0 + (1 : ℕ))) ∈ MissingColors G (traceB.coloring (Fin.last traceB.steps)) u → + MissingColors G rho2 v = MissingColors G rho1 v → MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho2 v ∪ MissingColors G + rho2 u := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 hmissing0 rho1 hb2Missing + u b traceB rho2 c3 hterminalMissingEq + exact @helper_hterminalInclusion_2787 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) + (@gamma0) (@delta0) (@hmissing0) (@hb2Missing) (@u) (@b) (@traceB) (@c3) + (@hterminalMissingEq) + +theorem helper_hvNotPrevious_5841.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (1 : ℕ) ≤ + (↑terminalPosition : ℕ) → (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length → + ∀ (TjPrime : TreeSequence G e0), indices0 (Fin.last p0) = q → + ∀ (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; (0 : ℕ) < + (↑jSlot : ℕ) → v ∉ TreeSequenceVertexSet Tprevious := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hjSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound TjPrime hqLast uPosition Tprevious hjPositive + exact @helper_hvNotPrevious_2347 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@hqLast) (@uPosition) (@hjPositive) + +theorem helper_hpreviousStrict_5854.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (ett.series.data.tree + jSlot.succ.castSucc).vertex terminalPosition = v → + ∀ (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ((0 : ℕ) < + (↑jSlot : ℕ) → v ∉ TreeSequenceVertexSet Tprevious) → ((0 : ℕ) < (↑jSlot : ℕ) → + TreeSequenceInitialSegment Tprevious (ett.series.data.tree jSlot.succ.castSucc)) → (0 : ℕ) + < (↑jSlot : ℕ) → Tprevious.length < seed.length := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalAt hterminalPositionPositive + hterminalPositionBound seed TjPrime uPosition Tprevious hvNotPrevious hpreviousTj hjPositive + exact @helper_hpreviousStrict_2394 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) + (@hterminalAt) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@uPosition) (@hvNotPrevious) (@hpreviousTj) (@hjPositive) + +theorem helper_branch_5870.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → (ett.series.data.tree (0 : Fin + (ett.rounds + (2 : ℕ)))).length = (1 : ℕ) → TashkinovClosure (ett.series.data.coloring (0 + : Fin (ett.rounds + (1 : ℕ)))) (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree (1 : Fin (ett.rounds + (2 : ℕ)))) → jSlot.castSucc = (0 : Fin + (ett.rounds + (1 : ℕ))) → TashkinovAugmentationSequence (ett.series.data.coloring (0 : Fin + (ett.rounds + (1 : ℕ)))) seed (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hseedTj commonPrefix seedLength initialClosure htarget + exact @helper_branch_2422 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) + (@commonPrefix) (@seedLength) (@initialClosure) (@htarget) + +theorem helper_branch_5878.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ((0 : ℕ) < + (↑jSlot : ℕ) → Tprevious.length < seed.length) → + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (adjoined : TreeSequence G e0), + TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) choice.edge adjoined → + TashkinovClosure (ett.series.data.coloring i.succ) adjoined (ett.series.data.tree + i.succ.succ) → jSlot.castSucc = i.succ → TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) seed (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hjTreeIndex hseedTj commonPrefix TjPrime uPosition Tprevious + hpreviousStrict i choice adjoined adjoinedExactly closedExtension htarget + exact @helper_branch_2455 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hjTreeIndex) (@hseedTj) (@commonPrefix) (@TjPrime) (@uPosition) + (@hpreviousStrict) (@i) (@choice) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@htarget) + +theorem helper_branch_5890.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ((0 : ℕ) < + (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious seed) → + ∀ (i : Fin ett.rounds), TashkinovClosure (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree i.succ.succ) → jSlot.castSucc + = i.succ → TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed + (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hjTreeIndex hseedTj TjPrime uPosition Tprevious hpreviousSeed i + closedExtension htarget + exact @helper_branch_2490 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hjTreeIndex) (@hseedTj) (@TjPrime) (@uPosition) (@hpreviousSeed) (@i) + (@closedExtension) (@htarget) + +theorem helper_branch_5903.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ((0 : ℕ) < + (↑jSlot : ℕ) → Tprevious.length < seed.length) → + ∀ (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data i.castSucc) + (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) available.edge adjoined → TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ) → jSlot.castSucc = i.succ → + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed (ett.series.data.tree + jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed hjTreeIndex hseedTj commonPrefix TjPrime uPosition Tprevious + hpreviousStrict i available adjoined adjoinedExactly closedExtension htarget + exact @helper_branch_2512 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@hjTreeIndex) (@hseedTj) (@commonPrefix) (@TjPrime) (@uPosition) + (@hpreviousStrict) (@i) (@available) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@htarget) + +theorem helper_prefixPrefix_5937.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)) (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length) (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : + ℕ))) (A : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hrA : r + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A r hr (Nat.le_trans (Nat.le_succ r) hrA)) + (TreeSequencePrefix A (r + (1 : ℕ)) ( + by omega + ) hrA) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound TjPrime uPosition A r hr hrA + exact @helper_prefixPrefix_2877 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@uPosition) (@A) + (@r) (@hr) (@hrA) + +theorem helper_hrightOutside_6001.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)) (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length) (TjPrime : TreeSequence G e0) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (M : TreeSequence G e0), TreeSequenceInitialSegment U M → + ∀ (n : ℕ), U.length ≤ n → + ∀ (hnM : n + (1 : ℕ) ≤ M.length), + let mIndex : Fin M.length := (⟨n, + by + have := GoldbergSeymour.TreeSequence.positive M + omega + ⟩ : Fin M.length); + ∀ (i : Fin Tj0.length), M.vertex mIndex.succ = Tj0.vertex i.succ → Tj0.vertex i.succ ∉ + TreeSequenceVertexSet U := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound TjPrime uPosition huPositionPositive huPositionBound U Tj0 M + hleftSegment n hnU hnM mIndex i hvertexMTj + exact @helper_hrightOutside_2349 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@v) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) + (@indices0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@M) (@hleftSegment) (@n) (@hnU) (@hnM) (@i) (@hvertexMTj) + +theorem helper_hiSeed_6009.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; TreeSequenceInitialSegment seed U → + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (_ : TreeSequence G e0), TreeSequenceInitialSegment seed Tj0 → + ∀ (_ : ℕ) (i : Fin Tj0.length), Tj0.vertex i.succ ∉ TreeSequenceVertexSet U → seed.length ≤ + (↑i : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed TjPrime uPosition huPositionPositive huPositionBound U hseedU + Tj0 M hseedTjSegment n i hrightOutside + exact @helper_hiSeed_2699 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@TjPrime) (@uPosition) (@huPositionPositive) (@huPositionBound) (@hseedU) + (@M) (@hseedTjSegment) (@n) (@i) (@hrightOutside) + +theorem helper_hXY_6159.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), ( + ∀ v_1 ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.castSucc.succ)).erase v, + MissingColors G (trace.coloring (Fin.last trace.steps)) v_1 = MissingColors G + (ett.series.data.coloring jSlot.castSucc) v_1) ∧ MissingColors G (trace.coloring (Fin.last + trace.steps)) v = MissingColors G sigma v → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : + (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length) (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ + TreeSequenceVertexSet TjPrime) (b : Fin (p0 + (1 : ℕ))) (traceB : + ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); (( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore + TjPrime u huPrime, MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = + MissingColors G rho1 x) ∧ + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → traceB.coloring (Fin.last traceB.steps) f = rho1 f) + → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : + ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (M : TreeSequence G e0), ( + ∀ (A : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hrA : r + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A r hr (Nat.le_trans (Nat.le_succ r) hrA)) + (TreeSequencePrefix A (r + (1 : ℕ)) ( + by omega + ) hrA)) → + ∀ (n : ℕ) (hnU : U.length ≤ n) (hnM hnSuccM : n + (1 : ℕ) ≤ M.length) (hnM' : n ≤ M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + let Y : TreeSequence G e0 := TreeSequencePrefix M (n + (1 : ℕ)) ( + by omega + ) hnSuccM; + let mIndex : Fin M.length := (⟨n, + by + have := GoldbergSeymour.TreeSequence.positive M + omega + ⟩ : Fin M.length); + ∀ (i : Fin Tj0.length), M.edge mIndex = Tj0.edge i → + ∀ (c : Fin k), ett.series.data.coloring jSlot.castSucc (Tj0.edge i) = some c → c ∈ + TreeMissingColors rho2 X → TashkinovAugmentation rho2 X Y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 indices0 hb2 rho1 hb2TreeEdges terminalPosition + hterminalPositionPositive hterminalPositionBound TjPrime u huPrime b traceB rho2 c2 + uPosition huPositionPositive huPositionBound U Tj0 M prefixPrefix n hnU hnM hnSuccM hnM' X + Y mIndex i hedgeMTj c hcolorTj hmissingX + exact @helper_hXY_5375 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@hb2) (@hb2TreeEdges) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@u) + (@huPrime) (@b) (@traceB) (@c2) (@uPosition) (@huPositionPositive) + (@huPositionBound) (@M) (@prefixPrefix) (@n) (@hnU) (@hnM) (@hnSuccM) (@hnM') + (@i) (@hedgeMTj) (@c) (@hcolorTj) (@hmissingX) + +theorem helper_hseedVertexBeforeJ_6180.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → seed.vertex + (Fin.last seed.length) = v → + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot vertexTransfer hterminalJ terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTj hseedTerminal i hi + exact @helper_hseedVertexBeforeJ_2905 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@hterminalJ) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) + (@hseedTerminal) (@i) (@hi) + +theorem helper_segmentVertexBeforeJ_6189.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : ℕ))), ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ) → + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hterminalJ p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed TjPrime uPosition hseedVertexBeforeJ A hAseed hAlen x hxA + exact @helper_segmentVertexBeforeJ_3151 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hterminalJ) (@p0) + (@indices0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@uPosition) (@hseedVertexBeforeJ) (@A) + (@hAseed) (@hAlen) (@x) (@hxA) + +theorem helper_transportSeedStep2_6201.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : + ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) (traceB.coloring (Fin.last traceB.steps)) → + ∀ (_ : Fin (TjPrime.length + (1 : ℕ))), ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ) → + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation (ett.series.data.coloring jSlot.castSucc) A + B → TreeSequenceInitialSegment B seed → TashkinovAugmentation rho2 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot segmentTrans trace hterminalJ p0 indices0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed TjPrime u b traceB + rho2 c1 uPosition segmentVertexBeforeJ A B hstep hBseed + exact @helper_transportSeedStep2_2940 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) (@trace) + (@hterminalJ) (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@u) (@b) (@traceB) (@c1) (@uPosition) + (@segmentVertexBeforeJ) (@A) (@B) (@hstep) (@hBseed) + +theorem helper_transportSeedRoute2_6212.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 + indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation (ett.series.data.coloring jSlot.castSucc) A + B → TreeSequenceInitialSegment B seed → TashkinovAugmentation rho2 A B) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho2 S seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed u b traceB rho2 transportSeedStep2 S + hroute + exact @helper_transportSeedRoute2_3173 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) + (@indices0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@u) (@b) (@traceB) (@transportSeedStep2) (@S) (@hroute) + +theorem helper_branch_6243.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0) (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : + ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + IsProperEdgeColoring G rho2 → IsOneEdgeUncolored rho2 e0 → + ∀ (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + TreeSequenceInitialSegment seed Tj0 → + ∀ (C : TreeSequence G e0), TashkinovAugmentationSequence rho2 seed C → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho2 S seed) → + TreeSequenceVertexSet Tj0 ⊂ TreeSequenceVertexSet C → ¬(0 : ℕ) < (↑jSlot : ℕ) → False := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed commonPrefix TjPrime u b traceB rho2 + hrho2Proper hrho2One uPosition Tj0 hseedTj0 C hrouteSeedC transportSeedRoute2 hTj0StrictC + hjPositive + exact @helper_branch_3377 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@v) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@trace) (@p0) + (@indices0) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) + (@commonPrefix) (@TjPrime) (@u) (@b) (@traceB) (@hrho2Proper) (@hrho2One) (@uPosition) + (@hseedTj0) (@C) (@hrouteSeedC) (@transportSeedRoute2) (@hTj0StrictC) (@hjPositive) + +theorem helper_hterminalColorsNotRestored_6300.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), ett.series.data.chosenVertex q.succ = some v + → ett.series.data.gamma q.succ = some gamma → ett.series.data.delta q.succ = some delta → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); ( + ∀ (t : Fin ett.rounds), ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT) → + ( + ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = (insert + gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k))) → ( + ∀ (s t : Fin ett.rounds) (vs vt : V) (gammaS deltaS gammaT deltaT : Fin k), s ∈ + ExtensionBaseActiveIndices ett v hvFinal → t ∈ ExtensionBaseActiveIndices ett v hvFinal → + (↑s : ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma s.succ = some gammaS + → ett.series.data.delta s.succ = some deltaS → ett.series.data.gamma t.succ = some gammaT + → ett.series.data.delta t.succ = some deltaT → (((insert gammaS ({ deltaS } : Finset (Fin + k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett v hvFinal vs, (↑s : ℕ) < (↑r : ℕ) ∧ (↑r : ℕ) < (↑t : ℕ) ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ (((insert gammaS ({ deltaS } : Finset + (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)).Nonempty → ((insert gammaS ({ deltaS } : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin + k)) = ({ gammaT } : Finset (Fin k)) ∧ ((insert gammaS ({ deltaS } : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset + (Fin k)) = ({ deltaS } : Finset (Fin k)))) → q ∈ ExtensionBaseActiveIndices ett v hvFinal + → q ∈ ExtensionBaseSupportClass ett v hvFinal v → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), indices0 + (Fin.last p0) = q → + let restorationColors : Finset (Fin k) := (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ; gamma ∉ + restorationColors ∧ delta ∉ restorationColors := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta q hqTerminal hqVertex + hqGamma hqDelta hvFinal hfirstUpper hfirstPositive jSlot hPESlotData hPEStored + hpairOverlapColors hqActive hqClass p0 indices0 gamma0 delta0 terminalPosition hqLast + restorationColors + exact @helper_hterminalColorsNotRestored_1977 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@hqTerminal) (@hqVertex) (@hqGamma) (@hqDelta) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hPESlotData) (@hPEStored) (@hpairOverlapColors) + (@hqActive) (@hqClass) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hqLast) + +theorem helper_hdeltaEarlier_6317.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (delta : Fin k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), ett.series.data.chosenVertex q.succ = some v + → ett.series.data.delta q.succ = some delta → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) → q ∈ ExtensionBaseActiveIndices ett v hvFinal + → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : + ℕ)) → Fin k), ( + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + → ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) → + Function.Injective (Fin.cons (gamma0 (0 : Fin (p0 + (1 : ℕ)))) delta0) → indices0 + (Fin.last p0) = q → delta0 (Fin.last p0) = delta → + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → delta ≠ gammaS ∧ delta ≠ deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v delta q hqTerminal hqVertex hqDelta + hvFinal hfirstUpper hfirstPositive jSlot hdeltaExclusion hqActive p0 indices0 gamma0 delta0 + hincreasing0 hclass0 hdelta0 hinjective0 hqLast hdeltaLast + exact @helper_hdeltaEarlier_3576 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@delta) + (@hqTerminal) (@hqVertex) (@hqDelta) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@hdeltaExclusion) (@hqActive) (@p0) (@indices0) (@gamma0) (@delta0) (@hincreasing0) + (@hclass0) (@hdelta0) (@hinjective0) (@hqLast) (@hdeltaLast) + +theorem helper_hpreterminalPackage_6328.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma _ : Fin k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : + ℕ)) → Fin k), ( + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + → ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) → ( + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) → + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), indices0 (Fin.last + p0) = q → gamma0 (Fin.last p0) = gamma → (0 : ℕ) < p0 → + ∃ (preterminalSlot : Fin ett.rounds), (↑preterminalSlot : ℕ) < (↑q : ℕ) ∧ preterminalSlot ∈ + (ExtensionBaseSupportClass ett v hvFinal v).erase q ∧ ett.series.data.delta + preterminalSlot.succ = some gamma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot p0 indices0 gamma0 delta0 hincreasing0 hclass0 hdelta0 + hchain0 terminalPosition hqLast hgammaLast + exact @helper_hpreterminalPackage_3617 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) + (@indices0) (@gamma0) (@delta0) (@hincreasing0) (@hclass0) (@hdelta0) (@hchain0) + (@terminalPosition) (@hqLast) (@hgammaLast) + +theorem helper_hsupportComponentOrder_6348.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (_ _ : Fin k) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), indices0 (Fin.last + p0) = q → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → ETTStrongInterchangeable ett s v rho1 gammaS deltaS) → + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree s.succ.castSucc), x ≠ v → + ∀ (y : V), Sum.inl y ∈ TwoColorComponent G rho1 gammaS deltaS (Sum.inl x) → y ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal hqKind + hvFinal hfirstUpper hfirstPositive jSlot stageToStage vertexTransfer trace p0 indices0 + gamma0 delta0 rho1 terminalPosition hqLast hb4Earlier + exact @helper_hsupportComponentOrder_3667 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hqKind) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@stageToStage) (@vertexTransfer) (@trace) (@p0) (@indices0) + (@gamma0) (@delta0) (@terminalPosition) (@hqLast) (@hb4Earlier) + +theorem helper_branch_6417.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); ett.series.data.chosenVertex q.succ = some v → + ∀ (i : Fin ett.rounds), IsProperEdgeColoring G (ett.series.data.coloring i.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring i.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring + i.castSucc) (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate ett.series.data i.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)), + ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data i.castSucc) : Finset (Fin k)) choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho + (ett.series.data.tree i.succ.castSucc))) → + ∀ (actualGamma : Fin k), ParallelExtensionColor ett.series.data i.castSucc choice.selected + choice.vertex actualGamma → + ∀ (secondStable : PartialEdgeColoring E k), StableColoring (ett.series.data.tree + i.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data i.castSucc) : + Finset (Fin k)) choice.selected secondStable → TreeExit (ett.series.data.tree + i.succ.castSucc) secondStable actualGamma choice.color choice.vertex → + ett.series.data.coloring i.succ = TwoColorComponentSwap G secondStable actualGamma + choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G (ett.series.data.coloring + i.succ) → IsOneEdgeUncolored (ett.series.data.coloring i.succ) e0 → ett.series.data.stored + i.succ = (insert choice.color ({ actualGamma } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.connectingEdges i.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex i.succ = some choice.vertex → ett.series.data.outsideVertex + i.succ = some choice.otherEndpoint → ett.series.data.delta i.succ = some choice.color → + ett.series.data.gamma i.succ = some actualGamma → TashkinovClosure + (ett.series.data.coloring i.succ) (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ) → TreeSequenceInitialSegment (ett.series.data.tree + i.succ.castSucc) (ett.series.data.tree i.succ.succ) → (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length → q.succ = i.succ → + ∃ (fN : E), ett.series.data.connectingEdges i.succ = ({ fN } : Finset E) ∧ Incident G v fN ∧ + IsProperEdgeColoring G (ett.series.data.coloring i.succ) ∧ IsOneEdgeUncolored + (ett.series.data.coloring i.succ) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqVertex i previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails actualGamma gammaRule secondStable secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension htarget + exact @helper_branch_2800 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqVertex) (@i) (@previousProper) (@previousOneUncolored) (@previousClosed) + (@previousNotStronglyClosed) (@noRevisiting) (@choice) + (@seriesAlternativeFails) (@actualGamma) (@gammaRule) (@secondStable) + (@secondStableRelation) (@exitWitness) (@currentColoring) (@currentProper) + (@currentOneUncolored) (@currentStored) (@currentEdges) (@currentKind) + (@currentVertex) (@currentOutside) (@currentDelta) (@currentGamma) + (@closedExtension) (@orderedExtension) (@strictExtension) (@htarget) + +theorem helper_hdeltaLocation_6440.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; seed.vertex + (Fin.last seed.length) = v → TreeSequenceInitialSegment seed (ett.series.data.tree + q.succ.castSucc) → + ∀ (fN : E), BoundaryColorEdges G (ett.series.data.coloring q.succ) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) gamma = ({ fN } : Finset E) ∧ ( + ∀ g ∈ BoundaryColorEdges G (ett.series.data.coloring q.succ) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) delta, + ∃ (w : V), TreeVertexOrder (ett.series.data.tree q.succ.castSucc) w v ∧ Incident G w g) ∧ + (ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (ett.series.data.coloring q.succ) (ett.series.data.tree + q.succ.castSucc), alpha ≠ delta → BoundaryColorEdges G (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) alpha = ∅) → + ∀ f ∈ BoundaryColorEdges G (ett.series.data.coloring q.succ) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) delta, + ∃ y ∈ TreeSequenceVertexSet seed, Incident G y f := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot p0 indices0 gamma0 delta0 terminalPosition + hterminalPositionPositive hterminalPositionBound seed hseedTerminal hseedN fN + hboundaryStructure + exact @helper_hdeltaLocation_3782 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) + (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTerminal) (@hseedN) (@fN) (@hboundaryStructure) + +theorem helper_hendpointNeighbor_6578.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); (H.neighborSet + (Sum.inl v)).Subsingleton → + ∀ (endpoint : V ⊕ E) (componentPath : H.Walk (Sum.inl v) endpoint), componentPath.IsPath → + {z : V ⊕ E | z ∈ componentPath.support} = C → ¬componentPath.Nil → (0 : ℕ) < + componentPath.length → endpoint ∈ C → + ∀ (z : V ⊕ E), H.Adj endpoint z → z = componentPath.getVert (componentPath.length - (1 : ℕ)) + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 hrho1Proper + terminalPosition H C hvSub endpoint componentPath hcomponentPath hcomponentSupport + hcomponentNonempty hcomponentPositive hendpointC + exact @helper_hendpointNeighbor_4002 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@p0) (@indices0) (@gamma0) (@delta0) (@hrho1Proper) (@terminalPosition) (@hvSub) + (@endpoint) (@componentPath) (@hcomponentPath) (@hcomponentSupport) + (@hcomponentNonempty) (@hcomponentPositive) (@hendpointC) + +theorem helper_hendpointVertex_6586.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (endpoint : V ⊕ E) (componentPath : H.Walk (Sum.inl v) endpoint), (0 : ℕ) < + componentPath.length → ( + ∀ (z : V ⊕ E), H.Adj endpoint z → z = componentPath.getVert (componentPath.length - (1 : ℕ))) + → + ∃ (x : V), endpoint = Sum.inl x := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition H endpoint componentPath hcomponentPositive hendpointNeighbor + exact @helper_hendpointVertex_4095 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@endpoint) + (@componentPath) (@hcomponentPositive) (@hendpointNeighbor) + +theorem helper_hTnElementary_6609.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), indices0 (Fin.last + p0) = q → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)), ColoredVertexSetElementary G + (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower v gamma delta sigma this q + hqTerminal hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hqLast H x componentPath + exact @helper_hTnElementary_4214 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hqLast) (@x) (@componentPath) + +theorem helper_hterminalPresentSigma_6628.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → ett.series.data.gamma q.succ = some gamma → + ett.series.data.delta q.succ = some delta → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring + q.succ) sigma → gamma ≠ delta → ( + ∀ (phi : PartialEdgeColoring E k) (alpha beta : Fin k), alpha ≠ beta → + ∀ (root : V ⊕ E) (y : V), alpha ∈ PresentColors G phi y → beta ∈ PresentColors G phi y → alpha + ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta root) y ∧ beta ∈ PresentColors G + (TwoColorComponentSwap G phi alpha beta root) y) → ColoredVertexSetElementary G + (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) → gamma ∈ MissingColors G (ett.series.data.coloring q.castSucc) v → + delta ∉ TreeMissingColors (ett.series.data.coloring q.castSucc) (ett.series.data.tree + q.succ.castSucc) → + ∀ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), y ≠ v → gamma ∈ + PresentColors G sigma y ∧ delta ∈ PresentColors G sigma y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqKind hqVertex + hqGamma hqDelta hvStage hsigmaTerminal hgammaDelta swapBothPresent hTnElementary + hgammaMissingPre hdeltaNotMissingPre + exact @helper_hterminalPresentSigma_4287 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqKind) (@hqVertex) (@hqGamma) (@hqDelta) (@hvStage) + (@hsigmaTerminal) (@hgammaDelta) (@swapBothPresent) (@hTnElementary) + (@hgammaMissingPre) (@hdeltaNotMissingPre) + +theorem helper_hxOutsidePrime_6645.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal + sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0), ( + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅) → gamma ∈ supportColors → delta ∈ supportColors → gamma ≠ delta → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)), ( + ∀ (z : V ⊕ E), H.Adj (Sum.inl x) z → z = componentPath.getVert (componentPath.length - (1 : + ℕ))) → x ≠ v → x ∉ TreeSequenceVertexSet TjPrime := by + classical + intro V E _ _ _ G k e0 input T generating ett v gamma delta sigma this hvFinal trace p0 + indices0 rho1 supportColors TjPrime hcaseTwoPointwise hgammaSupport hdeltaSupport + hgammaDelta H x componentPath hendpointNeighbor hxNe + exact @helper_hxOutsidePrime_4415 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@gamma) (@delta) (@sigma) + (@hvFinal) (@trace) (@p0) (@indices0) (@TjPrime) (@hcaseTwoPointwise) + (@hgammaSupport) (@hdeltaSupport) (@hgammaDelta) (@x) (@componentPath) + (@hendpointNeighbor) (@hxNe) + +theorem helper_hvNotPrevious_6710.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), indices0 (Fin.last + p0) = q → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; (0 : ℕ) < + (↑jSlot : ℕ) → v ∉ TreeSequenceVertexSet Tprevious := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hqLast H x componentPath u exitPath Tprevious hjPositive + exact @helper_hvNotPrevious_4521 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) + (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@trace) + (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hqLast) (@x) + (@componentPath) (@u) (@exitPath) (@hjPositive) + +theorem helper_hpreviousStrict_6723.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v → + ∀ (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ((0 : ℕ) < + (↑jSlot : ℕ) → v ∉ TreeSequenceVertexSet Tprevious) → ((0 : ℕ) < (↑jSlot : ℕ) → + TreeSequenceInitialSegment Tprevious (ett.series.data.tree jSlot.succ.castSucc)) → (0 : ℕ) + < (↑jSlot : ℕ) → Tprevious.length < seed.length := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalAt hterminalPositionPositive hterminalPositionBound seed H x + componentPath u exitPath Tprevious hvNotPrevious hpreviousTj hjPositive + exact @helper_hpreviousStrict_4568 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalAt) + (@hterminalPositionPositive) (@hterminalPositionBound) (@x) (@componentPath) (@u) + (@exitPath) (@hvNotPrevious) (@hpreviousTj) (@hjPositive) + +theorem helper_branch_6740.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → (ett.series.data.tree (0 : Fin + (ett.rounds + (2 : ℕ)))).length = (1 : ℕ) → TashkinovClosure (ett.series.data.coloring (0 + : Fin (ett.rounds + (1 : ℕ)))) (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree (1 : Fin (ett.rounds + (2 : ℕ)))) → jSlot.castSucc = (0 : Fin + (ett.rounds + (1 : ℕ))) → TashkinovAugmentationSequence (ett.series.data.coloring (0 : Fin + (ett.rounds + (1 : ℕ)))) seed (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hseedTj commonPrefix seedLength initialClosure htarget + exact @helper_branch_4596 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) + (@commonPrefix) (@seedLength) (@initialClosure) (@htarget) + +theorem helper_branch_6748.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ((0 : ℕ) < + (↑jSlot : ℕ) → Tprevious.length < seed.length) → + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (adjoined : TreeSequence G e0), + TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) choice.edge adjoined → + TashkinovClosure (ett.series.data.coloring i.succ) adjoined (ett.series.data.tree + i.succ.succ) → jSlot.castSucc = i.succ → TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) seed (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj + commonPrefix H x componentPath u exitPath Tprevious hpreviousStrict i choice adjoined + adjoinedExactly closedExtension htarget + exact @helper_branch_4629 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@commonPrefix) (@x) (@componentPath) (@u) (@exitPath) + (@hpreviousStrict) (@i) (@choice) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@htarget) + +theorem helper_branch_6761.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ((0 : ℕ) < + (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious seed) → + ∀ (i : Fin ett.rounds), TashkinovClosure (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree i.succ.succ) → jSlot.castSucc + = i.succ → TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed + (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj + H x componentPath u exitPath Tprevious hpreviousSeed i closedExtension htarget + exact @helper_branch_4664 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@x) (@componentPath) (@u) (@exitPath) (@hpreviousSeed) (@i) + (@closedExtension) (@htarget) + +theorem helper_branch_6775.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ((0 : ℕ) < + (↑jSlot : ℕ) → Tprevious.length < seed.length) → + ∀ (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data i.castSucc) + (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) available.edge adjoined → TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ) → jSlot.castSucc = i.succ → + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed (ett.series.data.tree + jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj + commonPrefix H x componentPath u exitPath Tprevious hpreviousStrict i available adjoined + adjoinedExactly closedExtension htarget + exact @helper_branch_4686 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) + (@hseedTj) (@commonPrefix) (@x) (@componentPath) (@u) (@exitPath) + (@hpreviousStrict) (@i) (@available) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@htarget) + +theorem helper_hcaseTwoObservationPackage_6796.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0) (fN : E), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)), exitPath.IsPath + → (2 : ℕ) ≤ exitPath.length → ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support) → ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) → ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) → + ¬Incident G u fN → u ∈ TreeSequenceVertexSet TjPrime → u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ beta ∈ MissingColors G rho1 u, beta ∉ supportColors → + ∀ (z : V) (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z → seed.length ≤ + (↑zPosition : ℕ) → ((seed.length < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) → + ( + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) → (u ∈ TreeSequenceVertexSet TjPrime ∧ u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) ∧ (exitPath.IsPath ∧ (2 : ℕ) ≤ exitPath.length ∧ ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support) ∧ ( + ∀ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl y ∈ exitPath.support ↔ y = u) ∧ ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬Incident G u fN) ∧ (beta ∈ MissingColors G rho1 u ∧ beta ∉ supportColors) ∧ z ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∧ (ett.series.data.tree + jSlot.succ.castSucc).vertex zPosition = z ∧ seed.length ≤ (↑zPosition : ℕ) ∧ ((seed.length + < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + ( + ∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 y) ∧ + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed supportColors TjPrime fN H x + componentPath u exitPath hexitPath hexitLength hexitSupport hexitIntersection hexitBoundary + huNotFN huPrime huOutside beta hbeta hbetaSupport z hz zPosition hzPosition hzAfter + hzChoice hzBefore hzEdges + exact @helper_hcaseTwoObservationPackage_3695 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) + (@trace) (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@fN) (@x) (@componentPath) (@u) (@exitPath) + (@hexitPath) (@hexitLength) (@hexitSupport) (@hexitIntersection) (@hexitBoundary) + (@huNotFN) (@huPrime) (@huOutside) (@beta) (@hbeta) (@hbetaSupport) (@z) (@hz) + (@zPosition) (@hzPosition) (@hzAfter) (@hzChoice) (@hzBefore) (@hzEdges) + +theorem helper_hpreterminalGammaPresent_6848.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), ( + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) → Function.Injective (Fin.cons (gamma0 (0 : + Fin (p0 + (1 : ℕ)))) delta0) → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (1 : + ℕ) ≤ (↑terminalPosition : ℕ) → (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0), ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) → ( + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅) → gamma0 (Fin.last p0) = gamma → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (_ : V ⊕ E) (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)), u ∈ + (TreeSequenceVertexSet TjPrime).erase v → + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u : V) (beta : Fin + k), u ∈ TreeSequenceVertexSet TjPrime → u ∉ TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc) → beta ∈ MissingColors G rho1 u → + ∀ (a : Fin p0), gamma0 a.castSucc ∈ PresentColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta delta) gamma beta (Sum.inl u)) u := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvStage hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 hchain0 + hinjective0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound + supportColors TjPrime hstored0 hcaseTwoPointwise hgammaLast H a x componentPath u exitPath + huErase zPosition + exact @helper_hpreterminalGammaPresent_4778 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) + (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@hchain0) + (@hinjective0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@hstored0) (@hcaseTwoPointwise) (@hgammaLast) + (@a) (@x) (@componentPath) (@u) (@exitPath) (@huErase) (@zPosition) + +theorem helper_hTjInitialEarlier_6865.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (1 : + ℕ) ≤ (↑terminalPosition : ℕ) → (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length → indices0 (Fin.last p0) = q → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))), + ∀ s ∈ (ExtensionBaseSupportClass ett v hvFinal v).erase q, TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree s.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot stageToStage trace p0 indices0 gamma0 + delta0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound hqLast H x + componentPath u exitPath zPosition + exact @helper_hTjInitialEarlier_3214 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) + (@stageToStage) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hqLast) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) + +theorem helper_hgammaFirstZero_6905.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (gamma0 _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (1 : + ℕ) ≤ (↑terminalPosition : ℕ) → (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length → gamma0 (Fin.last p0) = gamma → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))), p0 = (0 : ℕ) → gammaFirst = gamma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound hgammaLast gammaFirst H x + componentPath u exitPath zPosition hp0 + exact @helper_hgammaFirstZero_3790 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) + (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hgammaLast) (@x) + (@componentPath) (@u) (@exitPath) (@zPosition) (@hp0) + +theorem helper_hclaim45Package_6912.{u_1, u_2} : + helperHclaim45Package6912Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal + hvStage hvFinal hfirstUpper hfirstPositive jSlot trace hterminalJ p0 indices0 gamma0 rho1 + hrho1Proper hrho1One hb2Missing terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTj hseedTerminal hTjQ supportColors TjPrime hclosure + hprimeElementary hseedPrime hb1Tj hcaseTwoPointwise gammaFirst hgammaSupport hdeltaSupport + hgammaDelta hb2EdgesFromSeed hdeltaPhiJ hterminalSeed fN hdeltaMissing H C a x + componentPath hcomponentPath hcomponentSupport hxOutside u exitPath hexitPath hexitLength + hexitSupport hexitIntersection hexitBoundary huNotFN huPrime huOutside hdegree beta hbeta + hbetaSupport haugmentation z hz zPosition hzPosition hzAfter hzChoice hzBefore hzEdges + hpositiveClaim45 hgammaFirstZero + exact @helper_hclaim45Package_4916 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) + (@delta) (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) (@hfirstUpper) + (@hfirstPositive) (@trace) (@hterminalJ) (@p0) (@indices0) (@gamma0) (@hrho1Proper) + (@hrho1One) (@hb2Missing) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@hseedTerminal) (@hTjQ) (@TjPrime) (@hclosure) + (@hprimeElementary) (@hseedPrime) (@hb1Tj) (@hcaseTwoPointwise) (@hgammaSupport) + (@hdeltaSupport) (@hgammaDelta) (@hb2EdgesFromSeed) (@hdeltaPhiJ) (@hterminalSeed) + (@fN) (@hdeltaMissing) (@a) (@x) (@componentPath) (@hcomponentPath) + (@hcomponentSupport) (@hxOutside) (@u) (@exitPath) (@hexitPath) (@hexitLength) + (@hexitSupport) (@hexitIntersection) (@hexitBoundary) (@huNotFN) (@huPrime) + (@huOutside) (@hdegree) (@beta) (@hbeta) (@hbetaSupport) (@haugmentation) (@z) (@hz) + (@zPosition) (@hzPosition) (@hzAfter) (@hzChoice) (@hzBefore) (@hzEdges) + (@hpositiveClaim45) (@hgammaFirstZero) + +end GoldbergSeymour.ExtensionBaseProof + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseOneIndices.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseOneIndices.lean new file mode 100644 index 0000000000..0e19a76727 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseOneIndices.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +/-! +# Extension Base Case One Indices + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Slots selected from the indexed list strictly before the specified position. -/ +noncomputable def ExtensionBaseCaseOneIndices {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (p : ℕ) + (indices : Fin (p + 1) → Fin ett.rounds) (b : Fin (p + 1)) : Finset (Fin ett.rounds) := + (Finset.univ.filter fun a : Fin (p + 1) => a.val < b.val).image indices + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseOneSelection.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseOneSelection.lean new file mode 100644 index 0000000000..e8abe4c521 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseOneSelection.lean @@ -0,0 +1,561 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneIndices +public import LeanPool.GoldbergSeymour.ExtensionBaseClosure +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass + +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +public import LeanPool.GoldbergSeymour.TreeVerticesBefore + +/-! +# Extension Base Case One Selection + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_261.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot _ : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (TjPrime : TreeSequence G e0) (_ + : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (p : ℕ) (indices : + Fin (p + (1 : ℕ)) → Fin ett.rounds), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p + (1 : ℕ))) ↦ + ett.series.data.stored (indices a).succ; + let candidates : Finset (Fin (TjPrime.length + (1 : ℕ))) := ({i : Fin (TjPrime.length + (1 : + ℕ)) | TjPrime.vertex i ≠ terminalSupport ∧ (MissingColors G rho1 (TjPrime.vertex i) ∩ + supportColors : Finset (Fin k)).Nonempty} : Finset (Fin (TjPrime.length + (1 : ℕ)))); + ∀ (candidates_nonempty : candidates.Nonempty), + let first : Fin (TjPrime.length + (1 : ℕ)) := candidates.min' candidates_nonempty; + let u : V := TjPrime.vertex first; ( + ∀ (i : Fin (TjPrime.length + (1 : ℕ))), (↑i : ℕ) < (↑first : ℕ) → TjPrime.vertex i ≠ + terminalSupport → (MissingColors G rho1 (TjPrime.vertex i) ∩ supportColors : Finset (Fin + k)).Nonempty → False) → + ∀ w ∈ (TreeSequenceVertexSet TjPrime).erase terminalSupport, (MissingColors G rho1 w ∩ + Finset.univ.biUnion fun (a : Fin (p + (1 : ℕ))) ↦ ett.series.data.stored (indices a).succ + : Finset (Fin k)).Nonempty → w = u ∨ TreeVertexOrder TjPrime u w := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q rho1 + TjPrime terminalPosition p indices supportColors candidates candidates_nonempty first u + first_min w hw hws + rcases hws with ⟨c, hc⟩ + rcases Finset.mem_inter.mp hc with ⟨hwm, hws⟩ + by_cases hwu : w = u + · exact Or.inl hwu + · right + simp only [TreeSequenceVertexSet, Finset.mem_erase, Finset.mem_image] at hw + rcases hw.2 with ⟨i, hi, hwi⟩ + have hineq : TjPrime.vertex i ≠ terminalSupport := by + intro heq + apply hw.1 + exact hwi.symm.trans heq + have hsmall : ¬ i.val < first.val := by + intro hlt + apply first_min i hlt hineq + refine ⟨c, ?_⟩ + exact Finset.mem_inter.mpr ⟨hwi.symm ▸ hwm, hws⟩ + have hle : first.val ≤ i.val := Nat.le_of_not_gt hsmall + have hpos : ∃ j : Fin (TjPrime.length + 1), + TjPrime.vertex j = u := by + exact ⟨first, rfl⟩ + rcases hpos with ⟨j, hju⟩ + have hlt : first.val < i.val := by + by_contra he + have heq : i.val = first.val := Nat.le_antisymm + (by omega) hle + apply hwu + have hv : TjPrime.vertex i = TjPrime.vertex first := by + apply congrArg TjPrime.vertex + apply Fin.ext + exact heq + exact hwi.symm.trans (hv.trans rfl) + exact ⟨first, i, rfl, hwi, hlt⟩ + +private theorem helper_branch_294.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot _ : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (TjPrime : TreeSequence G e0) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = terminalSupport → + ∀ (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (gamma delta : Fin (p + (1 : ℕ)) → + Fin k), ( + ∀ (a : Fin p), gamma a.succ = delta a.castSucc) → ColoredVertexSetElementary G + (ett.series.data.coloring jSlot.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) → ( + ∀ v ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase + terminalSupport, MissingColors G rho1 v = MissingColors G (ett.series.data.coloring + jSlot.castSucc) v) → gamma (0 : Fin (p + (1 : ℕ))) ∈ MissingColors G + (ett.series.data.coloring jSlot.castSucc) terminalSupport → ( + ∀ (a : Fin (p + (1 : ℕ))), delta a ∉ TreeMissingColors (ett.series.data.coloring + jSlot.castSucc) (ett.series.data.tree jSlot.succ.castSucc)) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p + (1 : ℕ))) ↦ + ett.series.data.stored (indices a).succ; + let candidates : Finset (Fin (TjPrime.length + (1 : ℕ))) := ({i : Fin (TjPrime.length + (1 : + ℕ)) | TjPrime.vertex i ≠ terminalSupport ∧ (MissingColors G rho1 (TjPrime.vertex i) ∩ + supportColors : Finset (Fin k)).Nonempty} : Finset (Fin (TjPrime.length + (1 : ℕ)))); + ∀ (candidates_nonempty : candidates.Nonempty), + let first : Fin (TjPrime.length + (1 : ℕ)) := candidates.min' candidates_nonempty; + let u : V := TjPrime.vertex first; u ≠ terminalSupport → + ∀ (gamma_exists : + ∃ (a : Fin (p + (1 : ℕ))), gamma a ∈ MissingColors G rho1 u), + let b : Fin (p + (1 : ℕ)) := ({a : Fin (p + (1 : ℕ)) | gamma a ∈ MissingColors G rho1 u} : + Finset (Fin (p + (1 : ℕ)))).min' (Exists.casesOn gamma_exists fun (a : Fin (p + (1 : ℕ))) + (ha : gamma a ∈ MissingColors G rho1 u) ↦ Exists.intro a (Finset.mem_filter.mpr + (⟨Finset.mem_univ a, ha⟩ : a ∈ Finset.univ ∧ gamma a ∈ MissingColors G rho1 u))); gamma b + ∈ MissingColors G rho1 u → u ∉ TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q rho1 + TjPrime terminalPosition hterminalAt p indices gamma delta hchain hTjElementary + hrhoAgreement hfirstGammaMissing hdeltaAvoidsTj supportColors candidates + candidates_nonempty first u hu_ne gamma_exists b hbmem huTj + have terminal_tj : terminalSupport ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) := by + simp only [TreeSequenceVertexSet, Finset.mem_image] + exact ⟨terminalPosition, Finset.mem_univ _, hterminalAt⟩ + have huErase : u ∈ + (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).erase terminalSupport := by + apply Finset.mem_erase.mpr + exact ⟨hu_ne, huTj⟩ + have agreement := hrhoAgreement u huErase + by_cases hbzero : b.val = 0 + · have hb : b = 0 := Fin.ext hbzero + rw [hb] at hbmem + have hdis := hTjElementary huTj terminal_tj hu_ne + have hnot : gamma 0 ∉ MissingColors G + (ett.series.data.coloring jSlot.castSucc) u := by + intro hm + exact (Finset.disjoint_left.1 hdis) hm hfirstGammaMissing + apply hnot + rw [← agreement] + exact hbmem + · have hbpos : 1 ≤ b.val := Nat.one_le_iff_ne_zero.mpr hbzero + obtain ⟨t, ht⟩ : ∃ t : Fin p, b = t.succ := by + have hp : 0 < p := by omega + refine ⟨⟨b.val - 1, ?_⟩, ?_⟩ + · have := b.isLt + omega + · apply Fin.ext + simpa using (Nat.sub_add_cancel hbpos).symm + have hdelta : delta t.castSucc ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc) := hdeltaAvoidsTj t.castSucc + have hnot : delta t.castSucc ∉ MissingColors G + (ett.series.data.coloring jSlot.castSucc) u := by + intro hm + apply hdelta + rw [TreeMissingColors] + apply Finset.mem_biUnion.mpr + exact ⟨u, huTj, hm⟩ + have hgammaeq : gamma b = delta t.castSucc := by + rw [ht] + exact hchain t + apply hnot + rw [← hgammaeq, ← agreement] + exact hbmem + +private theorem helper_branch_370.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot _ : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (TjPrime : TreeSequence G e0) (_ + : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (p : ℕ) (indices : + Fin (p + (1 : ℕ)) → Fin ett.rounds) (gamma delta : Fin (p + (1 : ℕ)) → Fin k), ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.stored (indices a).succ = (insert (gamma a) + ({delta a} : Finset (Fin k)) : Finset (Fin k))) → ( + ∀ (a : Fin p), gamma a.succ = delta a.castSucc) → Function.Injective (Fin.cons (gamma (0 : Fin + (p + (1 : ℕ)))) delta) → (MissingColors G rho1 terminalSupport ∩ Finset.univ.biUnion fun + (a : Fin (p + (1 : ℕ))) ↦ ett.series.data.stored (indices a).succ : Finset (Fin k)) = + ({delta (Fin.last p)} : Finset (Fin k)) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p + (1 : ℕ))) ↦ + ett.series.data.stored (indices a).succ; + let candidates : Finset (Fin (TjPrime.length + (1 : ℕ))) := ({i : Fin (TjPrime.length + (1 : + ℕ)) | TjPrime.vertex i ≠ terminalSupport ∧ (MissingColors G rho1 (TjPrime.vertex i) ∩ + supportColors : Finset (Fin k)).Nonempty} : Finset (Fin (TjPrime.length + (1 : ℕ)))); + ∀ (candidates_nonempty : candidates.Nonempty), + let first : Fin (TjPrime.length + (1 : ℕ)) := candidates.min' candidates_nonempty; + let u : V := TjPrime.vertex first; + ∀ (gamma_exists : + ∃ (a : Fin (p + (1 : ℕ))), gamma a ∈ MissingColors G rho1 u), + let b : Fin (p + (1 : ℕ)) := ({a : Fin (p + (1 : ℕ)) | gamma a ∈ MissingColors G rho1 u} : + Finset (Fin (p + (1 : ℕ)))).min' (Exists.casesOn gamma_exists fun (a : Fin (p + (1 : ℕ))) + (ha : gamma a ∈ MissingColors G rho1 u) ↦ Exists.intro a (Finset.mem_filter.mpr + (⟨Finset.mem_univ a, ha⟩ : a ∈ Finset.univ ∧ gamma a ∈ MissingColors G rho1 u))); (delta + (Fin.last p) ∉ (ExtensionBaseCaseOneIndices ett p indices b).biUnion fun (t : Fin + ett.rounds) ↦ ett.series.data.stored t.succ) ∧ (MissingColors G rho1 terminalSupport ∩ + (ExtensionBaseCaseOneIndices ett p indices b).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ : Finset (Fin k)) = ∅ := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q rho1 + TjPrime terminalPosition p indices gamma delta hstored hchain hdistinct + hterminalIntersection supportColors candidates candidates_nonempty first u gamma_exists b + have delta_not_prefix : delta (Fin.last p) ∉ + (ExtensionBaseCaseOneIndices ett p indices b).biUnion + (fun t => ett.series.data.stored t.succ) := by + intro hd + rw [ExtensionBaseCaseOneIndices] at hd + rcases Finset.mem_biUnion.mp hd with ⟨t, ht, hdt⟩ + rcases Finset.mem_image.mp ht with ⟨a, ha, hat⟩ + have hab : a.val < b.val := (Finset.mem_filter.mp ha).2 + rw [← hat, hstored a] at hdt + simp only [Finset.mem_insert, Finset.mem_singleton] at hdt + rcases hdt with hdt | hdt + · cases a using Fin.cases with + | zero => + have hv : (Fin.last p).succ ≠ (0 : Fin (p + 1 + 1)) := by + intro he + have := congrArg Fin.val he + simp at this + exact hv (hdistinct (by simpa using hdt)) + | succ t => + have hb_le : b.val ≤ p := by omega + have hv : (Fin.last p).succ ≠ (t.castSucc).succ := by + intro he + have hh := congrArg Fin.val he + simp at hh + have ht_lt : t.val < p := by omega + have hab' : t.val + 1 < b.val := by simpa using hab + omega + exact hv (hdistinct (by + simpa only [Fin.cons_succ] using hdt.trans (hchain t))) + · by_cases ha0 : a.val = 0 + · have hne : (Fin.last p).succ ≠ + (0 : Fin (p + 1)).succ := by + intro he + have hv := congrArg Fin.val he + simp at hv + omega + have ha' : a = (0 : Fin (p + 1)) := Fin.ext ha0 + exact hne (hdistinct (by simpa [ha'] using hdt)) + · obtain ⟨t, hta⟩ : ∃ t : Fin p, a = t.succ := by + refine ⟨⟨a.val - 1, ?_⟩, ?_⟩ + · have := a.isLt + omega + · apply Fin.ext + have := a.isLt + have ha' : 1 ≤ a.val := Nat.one_le_iff_ne_zero.mpr ha0 + simpa using (Nat.sub_add_cancel ha').symm + rw [hta] at hdt + have hne : (Fin.last p).succ ≠ + (t.succ.succ : Fin (p + 1 + 1)) := by + intro he + have hv := congrArg Fin.val he + simp at hv + have hb_le : b.val ≤ p := by omega + have ht_lt : t.val < p := by omega + have hab' : t.val + 1 < b.val := by simpa [hta] using hab + omega + exact hne (hdistinct (by simpa [hta] using hdt)) + refine ⟨delta_not_prefix, ?_⟩ + apply Finset.eq_empty_iff_forall_notMem.mpr + intro d hd + rcases Finset.mem_inter.mp hd with ⟨hdm, hdp⟩ + have hds : d ∈ supportColors := by + have : (ExtensionBaseCaseOneIndices ett p indices b).biUnion + (fun t => ett.series.data.stored t.succ) ⊆ supportColors := by + intro c hc + rcases Finset.mem_biUnion.mp hc with ⟨t, ht, hct⟩ + rw [ExtensionBaseCaseOneIndices] at ht + rcases Finset.mem_image.mp ht with ⟨a, ha, hat⟩ + apply Finset.mem_biUnion.mpr + exact ⟨a, Finset.mem_univ _, by simpa [hat] using hct⟩ + exact this hdp + have hi : d ∈ MissingColors G rho1 terminalSupport ∩ supportColors := + Finset.mem_inter.mpr ⟨hdm, hds⟩ + have hsingle := hterminalIntersection ▸ hi + have heq : d = delta (Fin.last p) := by simpa using hsingle + exact delta_not_prefix (heq ▸ hdp) + +theorem ExtensionBaseCaseOneSelection {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot q : Fin ett.rounds) (_ : jSlot.val ≤ q.val) + (_ : q.val + 1 = ett.rounds) + (_ : jSlot.val + 1 = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) + (rho1 : PartialEdgeColoring E k) + (seed TjPrime : TreeSequence G e0) + (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1)) + (hterminalAt : + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = + terminalSupport) + (hterminalPositionPositive : 1 ≤ terminalPosition.val) + (hseed : seed = TreeSequencePrefix + (ett.series.data.tree jSlot.succ.castSucc) terminalPosition.val + hterminalPositionPositive (Nat.le_of_lt_succ terminalPosition.isLt)) + (hclosure : TashkinovClosure rho1 seed TjPrime) + (_ : terminalSupport ∈ TreeSequenceVertexSet TjPrime) + (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds) + (gamma delta : Fin (p + 1) → Fin k) + (_ : ∀ a b, a.val < b.val → + (indices a).val < (indices b).val) + (_ : ∀ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport ↔ + ∃ a : Fin (p + 1), indices a = r) + (_ : indices (Fin.last p) = q) + (_ : ∀ a, + ett.series.data.gamma (indices a).succ = some (gamma a)) + (_ : ∀ a, + ett.series.data.delta (indices a).succ = some (delta a)) + (hstored : ∀ a, + ett.series.data.stored (indices a).succ = {gamma a, delta a}) + (hchain : ∀ a : Fin p, gamma a.succ = delta a.castSucc) + (hdistinct : Function.Injective (Fin.cons (gamma 0) delta)) + (hcase : + (((TreeSequenceVertexSet TjPrime).erase terminalSupport).biUnion + (fun v => MissingColors G rho1 v) ∩ + (Finset.univ.biUnion fun a : Fin (p + 1) => + ett.series.data.stored (indices a).succ)).Nonempty) + (hprimeElementary : ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime)) + (hterminalIntersection : + MissingColors G rho1 terminalSupport ∩ + (Finset.univ.biUnion fun a : Fin (p + 1) => + ett.series.data.stored (indices a).succ) = + {delta (Fin.last p)}) + (hTjElementary : ColoredVertexSetElementary G + (ett.series.data.coloring jSlot.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc))) + (hrhoAgreement : ∀ v : V, + v ∈ (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).erase + terminalSupport → + MissingColors G rho1 v = MissingColors G + (ett.series.data.coloring jSlot.castSucc) v) + (hfirstGammaMissing : gamma 0 ∈ MissingColors G + (ett.series.data.coloring jSlot.castSucc) terminalSupport) + (hdeltaAvoidsTj : ∀ a : Fin (p + 1), + delta a ∉ TreeMissingColors + (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) : + ∃ (u : V) (hu : u ∈ TreeSequenceVertexSet TjPrime) (b : Fin (p + 1)), + u ≠ terminalSupport ∧ + gamma b ∈ MissingColors G rho1 u ∧ + (∀ a : Fin (p + 1), a.val < b.val → gamma a ∉ MissingColors G rho1 u) ∧ + (∀ w : V, + w ∈ (TreeSequenceVertexSet TjPrime).erase terminalSupport → + (MissingColors G rho1 w ∩ + (Finset.univ.biUnion fun a : Fin (p + 1) => + ett.series.data.stored (indices a).succ)).Nonempty → + w = u ∨ TreeVertexOrder TjPrime u w) ∧ + u ∉ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∧ + (let supportColors := + Finset.univ.biUnion fun a : Fin (p + 1) => + ett.series.data.stored (indices a).succ + let prefixColors := + (ExtensionBaseCaseOneIndices ett p indices b).biUnion fun t => + ett.series.data.stored t.succ + ((TreeVerticesBefore TjPrime u hu).biUnion (fun v => MissingColors G rho1 v) ∩ + (supportColors \ {delta (Fin.last p)}) = + ∅) ∧ + delta (Fin.last p) ∉ prefixColors ∧ + MissingColors G rho1 terminalSupport ∩ prefixColors = ∅) := by + classical + have initial_subset {A B : TreeSequence G e0} + (h : TreeSequenceInitialSegment A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + obtain ⟨i, hi, hvi⟩ := hv + obtain ⟨hlen, hvertices, hedges⟩ := h + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, + (hvertices i).trans hvi⟩ + have reach_subset {A B : TreeSequence G e0} + (h : TashkinovAugmentationSequence rho1 A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + unfold TashkinovAugmentationSequence at h + induction h using Relation.ReflTransGen.head_induction_on with + | refl => exact Finset.Subset.rfl + | head hstep htail ih => exact (initial_subset hstep.2.1).trans ih + have seed_prime : TreeSequenceVertexSet seed ⊆ + TreeSequenceVertexSet TjPrime := reach_subset hclosure.1 + have terminal_seed : terminalSupport ∈ TreeSequenceVertexSet seed := by + rw [hseed] + simp only [TreeSequenceVertexSet, Finset.mem_image] + refine ⟨Fin.last terminalPosition.val, Finset.mem_univ _, ?_⟩ + change (ett.series.data.tree jSlot.succ.castSucc).vertex + (Fin.castLE (Nat.succ_le_succ + (Nat.le_of_lt_succ terminalPosition.isLt)) + (Fin.last terminalPosition.val)) = terminalSupport + have heq : Fin.castLE (Nat.succ_le_succ + (Nat.le_of_lt_succ terminalPosition.isLt)) + (Fin.last terminalPosition.val) = terminalPosition := by + apply Fin.ext + simp + rw [heq] + exact hterminalAt + have terminal_prime : terminalSupport ∈ TreeSequenceVertexSet TjPrime := + seed_prime terminal_seed + let supportColors := Finset.univ.biUnion fun a : Fin (p + 1) => + ett.series.data.stored (indices a).succ + let candidates := (Finset.univ : Finset (Fin (TjPrime.length + 1))).filter + (fun i => TjPrime.vertex i ≠ terminalSupport ∧ + (MissingColors G rho1 (TjPrime.vertex i) ∩ supportColors).Nonempty) + have candidates_nonempty : candidates.Nonempty := by + have hcase' : (((TreeSequenceVertexSet TjPrime).erase terminalSupport).biUnion + (fun v => MissingColors G rho1 v) ∩ supportColors).Nonempty := by + simpa [supportColors] using hcase + rcases hcase' with ⟨c, hc⟩ + rcases Finset.mem_inter.mp hc with ⟨hcaway, hcsupport⟩ + rcases Finset.mem_biUnion.mp hcaway with ⟨v, hv, hcv⟩ + simp only [Finset.mem_erase] at hv + rcases hv with ⟨hvt, hvprime⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image] at hvprime + rcases hvprime with ⟨i, hi, hvi⟩ + have hmem : i ∈ candidates := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_, ?_⟩ + · intro heq + apply hvt + rw [← hvi, heq] + · exact ⟨c, Finset.mem_inter.mpr ⟨hvi.symm ▸ hcv, hcsupport⟩⟩ + exact ⟨i, hmem⟩ + let first := candidates.min' candidates_nonempty + have first_mem : first ∈ candidates := + Finset.min'_mem candidates candidates_nonempty + let u := TjPrime.vertex first + have huprime : u ∈ TreeSequenceVertexSet TjPrime := by + simp [TreeSequenceVertexSet, u] + have hu_ne : u ≠ terminalSupport := + (Finset.mem_filter.mp first_mem).2.1 + have hu_support : (MissingColors G rho1 u ∩ supportColors).Nonempty := by + simpa [u] using (Finset.mem_filter.mp first_mem).2.2 + have first_min (i : Fin (TjPrime.length + 1)) + (hi : i.val < first.val) + (hineq : TjPrime.vertex i ≠ terminalSupport) + (hs : (MissingColors G rho1 (TjPrime.vertex i) ∩ supportColors).Nonempty) : + False := by + have hm : i ∈ candidates := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, hineq, hs⟩ + exact (Nat.not_lt_of_ge (Finset.min'_le candidates i hm)) hi + have support_mem : ∀ c ∈ supportColors, + ∃ a : Fin (p + 1), c = gamma a ∨ c = delta a := by + intro c hc + rcases Finset.mem_biUnion.mp hc with ⟨a, ha, hca⟩ + rw [hstored a] at hca + simp only [Finset.mem_insert, Finset.mem_singleton] at hca + exact ⟨a, hca⟩ + have delta_terminal : delta (Fin.last p) ∈ MissingColors G rho1 terminalSupport := by + have hd : delta (Fin.last p) ∈ supportColors := by + apply Finset.mem_biUnion.mpr + exact ⟨Fin.last p, Finset.mem_univ _, by rw [hstored]; simp⟩ + have hi : delta (Fin.last p) ∈ + MissingColors G rho1 terminalSupport ∩ supportColors := by + rw [hterminalIntersection] + simp + exact (Finset.mem_inter.mp hi).1 + have delta_not_u : delta (Fin.last p) ∉ MissingColors G rho1 u := by + intro hd + have hd' : delta (Fin.last p) ∈ MissingColors G rho1 terminalSupport := delta_terminal + have hdis := hprimeElementary huprime terminal_prime hu_ne + exact (Finset.disjoint_left.1 hdis) hd hd' + have gamma_exists : ∃ a : Fin (p + 1), gamma a ∈ MissingColors G rho1 u := by + rcases hu_support with ⟨c, hc⟩ + rcases Finset.mem_inter.mp hc with ⟨hc, hcs⟩ + rcases support_mem c hcs with ⟨a, rfl | rfl⟩ + · exact ⟨a, hc⟩ + · by_cases ha : a = Fin.last p + · exact (delta_not_u (ha ▸ hc)).elim + · obtain ⟨t, ht⟩ : ∃ t : Fin p, a = t.castSucc := by + have hav : a.val < p := by + have := a.isLt + have hlast : a.val ≠ p := by intro h; exact ha (Fin.ext h) + omega + exact ⟨⟨a.val, hav⟩, by apply Fin.ext; rfl⟩ + refine ⟨t.succ, ?_⟩ + rw [hchain t, ← ht] + exact hc + let b := (Finset.univ.filter fun a : Fin (p + 1) => + gamma a ∈ MissingColors G rho1 u).min' + (by rcases gamma_exists with ⟨a, ha⟩; exact ⟨a, Finset.mem_filter.mpr ⟨Finset.mem_univ _, + ha⟩⟩) + have hbmem : gamma b ∈ MissingColors G rho1 u := by + have := Finset.min'_mem (Finset.univ.filter fun a : Fin (p + 1) => + gamma a ∈ MissingColors G rho1 u) (by + rcases gamma_exists with ⟨a, ha⟩ + exact ⟨a, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ha⟩⟩) + exact (Finset.mem_filter.mp this).2 + refine ⟨u, huprime, b, hu_ne, hbmem, ?_, ?_, ?_, ?_⟩ + · intro a ha hga + have hm := Finset.min'_le (Finset.univ.filter fun z : Fin (p + 1) => + gamma z ∈ MissingColors G rho1 u) a + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, hga⟩) + exact (Nat.not_lt_of_ge hm) ha + · exact @helper_branch_261 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) + (@jSlot) (@q) (@rho1) (@TjPrime) (@terminalPosition) (@p) (@indices) (@candidates_nonempty) + (@first_min) + · exact @helper_branch_294 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) + (@jSlot) (@q) (@rho1) (@TjPrime) (@terminalPosition) (@hterminalAt) (@p) (@indices) + (@gamma) (@delta) (@hchain) (@hTjElementary) (@hrhoAgreement) (@hfirstGammaMissing) + (@hdeltaAvoidsTj) (@candidates_nonempty) (@hu_ne) (@gamma_exists) (@hbmem) + · dsimp + constructor + · rw [Finset.eq_empty_iff_forall_notMem] + intro d hd + rcases Finset.mem_inter.mp hd with ⟨hbefore, hcolor⟩ + rcases Finset.mem_biUnion.mp hbefore with ⟨x, hx, hdx⟩ + simp only [TreeVerticesBefore, Finset.mem_filter] at hx + rcases hx with ⟨hxset, hxorder⟩ + rcases hxorder with ⟨i, j, hix, hjx, hij⟩ + have hju : j = first := by + apply TjPrime.vertex_injective + exact hjx.trans rfl + subst j + have hnotterminal : x ≠ terminalSupport := by + intro heq + have hdt : d ∈ MissingColors G rho1 terminalSupport := by + rw [← heq] + exact hdx + have hds : d ∈ supportColors := + (Finset.mem_sdiff.mp hcolor).1 + have hi : d ∈ MissingColors G rho1 terminalSupport ∩ supportColors := + Finset.mem_inter.mpr ⟨hdt, hds⟩ + have hsingle := hterminalIntersection ▸ hi + have : d = delta (Fin.last p) := by simpa using hsingle + exact (Finset.mem_sdiff.mp hcolor).2 (by simp [this]) + have hlt : i.val < first.val := hij + have hcontra : False := first_min i hlt (hix.symm ▸ hnotterminal) (by + refine ⟨d, Finset.mem_inter.mpr ⟨?_, (Finset.mem_sdiff.mp hcolor).1⟩⟩ + exact hix.symm ▸ hdx) + exact hcontra + · exact @helper_branch_370 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) + (@jSlot) (@q) (@rho1) (@TjPrime) (@terminalPosition) (@p) (@indices) (@gamma) (@delta) + (@hstored) (@hchain) (@hdistinct) (@hterminalIntersection) (@candidates_nonempty) + (@gamma_exists) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean new file mode 100644 index 0000000000..1f0d8f1bc1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean @@ -0,0 +1,1686 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim45 + +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport + +public import LeanPool.GoldbergSeymour.OrderedTreeUnionExists + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovClosureExists + +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +/-! +# Extension Base Case Two Contradiction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_transportStep_250.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) {lowerInput : PartialEdgeColoring E k} + {lowerTree : TreeSequence G e0} {lowerGenerating : PartialEdgeColoring E k} (_ : + ExtendedTashkinovTree G k e0 lowerInput lowerTree lowerGenerating) (_ : Fin ett.rounds) + (Tj seed TjPrime : TreeSequence G e0) (phiJ rho3 : PartialEdgeColoring E k) (Dprev : + Finset (Fin k)) (terminalSupport : V) (hterminalTj : terminalSupport ∈ + TreeSequenceVertexSet Tj) (_ : Fin (Tj.length + (1 : ℕ))) (_ : Fin (TjPrime.length + (1 : + ℕ))), StableColoringBeforeVertex Tj terminalSupport hterminalTj Dprev phiJ rho3 → (∀ {A B + C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C → + TreeSequenceInitialSegment A C) → (∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A + seed → A.length < seed.length → ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ + TreeVerticesBefore Tj terminalSupport hterminalTj) → ∀ {A B : TreeSequence G e0}, + TashkinovAugmentation phiJ A B → TreeSequenceInitialSegment B seed → TashkinovAugmentation + rho3 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot + Tj seed TjPrime phiJ rho3 Dprev terminalSupport hterminalTj zPosition uPosition hd1 + segmentTrans hsegmentVertexBefore A B hstep hBseed + rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ + have hAseed : TreeSequenceInitialSegment A seed := segmentTrans hAB hBseed + have hAlen : A.length < seed.length := + lt_of_lt_of_le (by omega) hBseed.1 + have hcMissingRho : c ∈ TreeMissingColors rho3 A := by + unfold TreeMissingColors at hcMissing ⊢ + obtain ⟨w, hwA, hcw⟩ := Finset.mem_biUnion.mp hcMissing + refine Finset.mem_biUnion.mpr ⟨w, hwA, ?_⟩ + rw [hd1.2 w (hsegmentVertexBefore hAseed hAlen hwA)] + exact hcw + let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨q, hq⟩ := B.attaches added + let oldPos : Fin (B.length + 1) := + Fin.castLT q (Nat.lt_trans q.isLt (Nat.succ_lt_succ added.isLt)) + have holdVal : oldPos.val < A.length + 1 := by + have hqBound := q.isLt + dsimp [oldPos, added] at * + omega + let oldA : Fin (A.length + 1) := ⟨oldPos.val, holdVal⟩ + have holdEq : B.vertex oldPos = A.vertex oldA := by + have hcast : Fin.castLE (Nat.succ_le_succ hAB.1) oldA = oldPos := by + apply Fin.ext + rfl + rw [← hcast] + exact hAB.2.1 oldA + have holdA : A.vertex oldA ∈ TreeSequenceVertexSet A := by + simp [TreeSequenceVertexSet] + have holdBefore : B.vertex oldPos ∈ + TreeVerticesBefore Tj terminalSupport hterminalTj := by + rw [holdEq] + exact hsegmentVertexBefore hAseed hAlen holdA + have holdIncident : Incident G (B.vertex oldPos) (B.edge added) := by + unfold Incident + rw [hq] + simp [oldPos] + have haddedFixed : rho3 (B.edge added) = phiJ (B.edge added) := by + apply hd1.1 (B.edge added) ⟨B.vertex oldPos, holdBefore, holdIncident⟩ + refine ⟨c, ?_, ?_⟩ + · apply Finset.mem_union_left + unfold TreeMissingColors at hcMissing + obtain ⟨w, hwA, hcw⟩ := Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨w, hsegmentVertexBefore hAseed hAlen hwA, hcw⟩ + · exact hcolor + refine ⟨hlen, hAB, c, ?_, hcMissingRho⟩ + change rho3 (B.edge added) = some c + exact haddedFixed.trans hcolor + +private theorem helper_equalPrefixes_181.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 + : E} {A B D : TreeSequence G e0}, TreeSequenceInitialSegment A D → + TreeSequenceInitialSegment B D → A.length = B.length → A = B := by + classical + intro V E G e0 A B D hAD hBD hlen + rcases hAD with ⟨hlenAD, hvertexAD, hedgeAD⟩ + rcases hBD with ⟨hlenBD, hvertexBD, hedgeBD⟩ + cases A with + | mk alen apos avertex aedge avinj aeinf afirst aattach => + cases B with + | mk blen bpos bvertex bedge bvinj beinj bfirst battach => + simp only at hlen + subst blen + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + calc + avertex i = D.vertex + (Fin.castLE (Nat.succ_le_succ hlenAD) i) := + (hvertexAD i).symm + _ = D.vertex (Fin.castLE (Nat.succ_le_succ hlenBD) i) := by + congr 1 + _ = bvertex i := hvertexBD i + · apply heq_of_eq + funext i + calc + aedge i = D.edge (Fin.castLE hlenAD i) := (hedgeAD i).symm + _ = D.edge (Fin.castLE hlenBD i) := by congr 1 + _ = bedge i := hedgeBD i + +private theorem helper_hrightOutside_219.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (Tj TjPrime : + TreeSequence G e0) (zPosition : Fin (Tj.length + (1 : ℕ))) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ + (↑zPosition : ℕ)) (hzPositionBound : (↑zPosition : ℕ) ≤ Tj.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (M : TreeSequence G e0) (_ : TreeSequenceInitialSegment U M) (n : ℕ) (_ : U.length ≤ n) (hnM + : n + (1 : ℕ) ≤ M.length), + let j : Fin M.length := (⟨n, Decidable.byContradiction fun (a : ¬n < M.length) ↦ + by omega + ⟩ : Fin M.length); + ∀ (i : Fin Z.length) (_ : M.vertex j.succ = Z.vertex i.succ), Z.vertex i.succ ∉ + TreeSequenceVertexSet U := by + classical + intro V E G e0 Tj TjPrime zPosition uPosition huPositionPositive huPositionBound + hzPositionPositive hzPositionBound U Z M hleftSegment n hnU hnM j i hvertexMZ hmem + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hmem + obtain ⟨a, ha⟩ := hmem + have hmvertex : M.vertex + (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) = + U.vertex a := hleftSegment.2.1 a + have heq : M.vertex j.succ = + M.vertex (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) := + hvertexMZ.trans (ha.symm.trans hmvertex.symm) + have hindex := congrArg Fin.val (M.vertex_injective heq) + simp [j] at hindex + omega + +private theorem helper_hiSeed_234.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (Tj seed TjPrime : + TreeSequence G e0) (zPosition : Fin (Tj.length + (1 : ℕ))) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ + (↑zPosition : ℕ)) (hzPositionBound : (↑zPosition : ℕ) ≤ Tj.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed U) (_ : TreeSequence G e0) (_ : + TreeSequenceInitialSegment seed Z) (_ : ℕ) (i : Fin Z.length) (_ : Z.vertex i.succ ∉ + TreeSequenceVertexSet U), seed.length ≤ (↑i : ℕ) := by + classical + intro V E G e0 Tj seed TjPrime zPosition uPosition huPositionPositive huPositionBound + hzPositionPositive hzPositionBound U Z hseedU M hseedZSegment n i hrightOutside + by_contra hnot + have hi : i.val < seed.length := Nat.lt_of_not_ge hnot + let a : Fin (seed.length + 1) := ⟨i.val + 1, by omega⟩ + have hZSeedA : Z.vertex + (Fin.castLE (Nat.succ_le_succ hseedZSegment.1) a) = + seed.vertex a := hseedZSegment.2.1 a + apply hrightOutside + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + refine ⟨Fin.castLE (Nat.succ_le_succ hseedU.1) a, ?_⟩ + have hia : Fin.castLE (Nat.succ_le_succ hseedZSegment.1) a = + i.succ := Fin.ext (by simp [a]) + rw [hia] at hZSeedA + exact (hseedU.2.1 a).trans hZSeedA.symm + +private theorem helper_hseedZX_252.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (Tj seed : TreeSequence + G e0) (zPosition : Fin (Tj.length + (1 : ℕ))) (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition + : ℕ)) (hzPositionBound : (↑zPosition : ℕ) ≤ Tj.length), + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed Z) (i : Fin Z.length) (hiSeed : seed.length ≤ (↑i : ℕ)) + (hiZ : (↑i : ℕ) < Z.length), + let ZX : TreeSequence G e0 := TreeSequencePrefix Z (↑i : ℕ) (Nat.le_trans seed.positive + hiSeed) (Nat.le_of_lt hiZ); TreeSequenceInitialSegment seed ZX := by + classical + intro V E G e0 Tj seed zPosition hzPositionPositive hzPositionBound Z hseedZSegment i hiSeed + hiZ ZX + refine ⟨hiSeed, ?_, ?_⟩ + · intro a + change Z.vertex _ = seed.vertex a + calc + Z.vertex _ = Z.vertex + (Fin.castLE (Nat.succ_le_succ hseedZSegment.1) a) := by + congr 1 + _ = seed.vertex a := hseedZSegment.2.1 a + · intro a + change Z.edge _ = seed.edge a + calc + Z.edge _ = Z.edge (Fin.castLE hseedZSegment.1 a) := by + congr 1 + _ = seed.edge a := hseedZSegment.2.2 a + +private theorem helper_hmissingX_305.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj seed TjPrime : TreeSequence G e0) (phiJ rho3 : PartialEdgeColoring E k) + (terminalSupport u z : V) (hzTj : z ∈ TreeSequenceVertexSet Tj) (zPosition : Fin + (Tj.length + (1 : ℕ))) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : Tj.vertex + zPosition = z) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : + (↑uPosition : ℕ) ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition : ℕ)) + (hzPositionBound : (↑zPosition : ℕ) ≤ Tj.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment Z Tj) (_ : TreeSequenceInitialSegment seed U) (_ : + MissingColors G phiJ terminalSupport ⊆ MissingColors G rho3 terminalSupport ∪ + MissingColors G rho3 u) (_ : ( + ∀ v ∈ TreeVerticesBefore Tj z hzTj, v ≠ terminalSupport → MissingColors G rho3 v = + MissingColors G phiJ v)) (M : TreeSequence G e0) (_ : u ∈ TreeSequenceVertexSet U) (_ : ( + ∀ (i : Fin Z.length) (_ : Z.vertex i.succ ∉ TreeSequenceVertexSet U), + ∃ (j : Fin M.length), U.length ≤ (↑j : ℕ) ∧ M.edge j = Z.edge i ∧ M.vertex j.succ = Z.vertex + i.succ)) (_ : ( + ∀ (i j : Fin Z.length) (_ : Z.vertex i.succ ∉ TreeSequenceVertexSet U) (_ : Z.vertex j.succ ∉ + TreeSequenceVertexSet U) (_ : (↑i : ℕ) < (↑j : ℕ)) (p q : Fin M.length) (_ : M.vertex + p.succ = Z.vertex i.succ) (_ : M.vertex q.succ = Z.vertex j.succ), (↑p : ℕ) < (↑q : ℕ))) + (_ : TreeSequenceInitialSegment seed Z) (_ n : ℕ) (hnU : U.length ≤ n) (hnM : n + (1 : ℕ) + ≤ M.length) (hnM' : n ≤ M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + let j : Fin M.length := (⟨n, Decidable.byContradiction fun (a : ¬n < M.length) ↦ + by omega + ⟩ : Fin M.length); + ∀ (i : Fin Z.length) (_ : M.vertex j.succ = Z.vertex i.succ) (_ : Z.vertex i.succ ∉ + TreeSequenceVertexSet U) (hiSeed : seed.length ≤ (↑i : ℕ)) (hiZ : (↑i : ℕ) < Z.length), + let ZX : TreeSequence G e0 := TreeSequencePrefix Z (↑i : ℕ) (Nat.le_trans seed.positive + hiSeed) (Nat.le_of_lt hiZ); + ∀ (_ : TreeSequenceInitialSegment ZX Z) (_ : ZX.length = (↑i : ℕ)) (A : TreeSequence G e0) (_ + : A.length = ZX.length + (1 : ℕ)), + ∀ c ∈ TreeMissingColors phiJ ZX, ( + ∀ {v : V}, v ∈ TreeSequenceVertexSet U → v ∈ TreeSequenceVertexSet X) → c ∈ TreeMissingColors + rho3 X := by + classical + intro V E _ _ G k e0 Tj seed TjPrime phiJ rho3 terminalSupport u z hzTj zPosition uPosition + hzPosition huPositionPositive huPositionBound hzPositionPositive hzPositionBound U Z hZTj + hseedU hterminalInclusion hbeforeZMissing M huU heveryNewRightEntry hrightOrder hseedZSegment + n n hnU hnM hnM' X j i hvertexMZ hrightOutside hiSeed hiZ ZX hZXZ hZXlen A hlenA c hmissingZX + hleftX + let _ := Fintype.ofFinite V + unfold TreeMissingColors at hmissingZX ⊢ + obtain ⟨v, hvZX, hcMissing⟩ := + Finset.mem_biUnion.mp hmissingZX + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hvZX + obtain ⟨a, ha⟩ := hvZX + have hcMissingV : c ∈ MissingColors G phiJ v := by + simpa [ha] using hcMissing + have hvX : v ∈ TreeSequenceVertexSet X := by + by_cases hvU : v ∈ TreeSequenceVertexSet U + · exact hleftX hvU + · have haPos : 1 ≤ a.val := by + by_contra hzero + have haZero : a.val = 0 := by omega + let p0 : Fin (seed.length + 1) := ⟨0, by omega⟩ + have hZp0 := hseedZSegment.2.1 p0 + have hUp0 := hseedU.2.1 p0 + apply hvU + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + refine ⟨Fin.castLE (Nat.succ_le_succ hseedU.1) p0, ?_⟩ + have haZ : Z.vertex (Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiZ)) a) = v := by + simpa [ZX, TreeSequencePrefix] using ha + have ha0 : Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiZ)) a = + Fin.castLE (Nat.succ_le_succ hseedZSegment.1) p0 := by + apply Fin.ext + exact haZero + rw [ha0, hZp0] at haZ + exact hUp0.trans haZ + let r : Fin Z.length := ⟨a.val - 1, by + have haLt : a.val < ZX.length + 1 := a.isLt + simp [ZX] at haLt + omega⟩ + have hrSucc : r.succ = Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiZ)) a := by + apply Fin.ext + exact Nat.sub_add_cancel haPos + have hrv : Z.vertex r.succ = v := by + rw [hrSucc] + simpa [ZX, TreeSequencePrefix] using ha + have hrOutside : + Z.vertex r.succ ∉ TreeSequenceVertexSet U := by + simpa [hrv] using hvU + have hri : r.val < i.val := by + have haLt : a.val < ZX.length + 1 := a.isLt + simp [ZX, r] at haLt ⊢ + omega + obtain ⟨q, hqU, hedgeq, hvertexq⟩ := + heveryNewRightEntry r hrOutside + have hqn : q.val < n := + hrightOrder r i hrOutside hrightOutside hri q j + hvertexq hvertexMZ + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + let qX : Fin (X.length + 1) := ⟨q.val + 1, by + change q.val + 1 < n + 1 + omega⟩ + refine ⟨qX, ?_⟩ + rw [← hrv, ← hvertexq] + change M.vertex _ = M.vertex q.succ + congr 1 + by_cases hvTerminal : v = terminalSupport + · have hcTerminalOld : + c ∈ MissingColors G phiJ terminalSupport := by + rw [← hvTerminal] + exact hcMissingV + rcases Finset.mem_union.mp (hterminalInclusion hcTerminalOld) with + hcTerminal | hcU + · have hterminalX : + terminalSupport ∈ TreeSequenceVertexSet X := by + simpa [hvTerminal] using hvX + exact Finset.mem_biUnion.mpr + ⟨terminalSupport, hterminalX, hcTerminal⟩ + · exact Finset.mem_biUnion.mpr ⟨u, hleftX huU, hcU⟩ + · have hvBefore : v ∈ TreeVerticesBefore Tj z hzTj := by + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + let aZ : Fin (Z.length + 1) := + Fin.castLE (Nat.succ_le_succ hZXZ.1) a + let aTj : Fin (Tj.length + 1) := + Fin.castLE (Nat.succ_le_succ hZTj.1) aZ + have haTj : Tj.vertex aTj = v := + (hZTj.2.1 aZ).trans ((hZXZ.2.1 a).trans ha) + constructor + · simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + exact ⟨aTj, haTj⟩ + · unfold TreeVertexOrder + refine ⟨aTj, zPosition, haTj, hzPosition, ?_⟩ + change a.val < zPosition.val + have haLt := a.isLt + have hiLt := i.isLt + simp [ZX, Z, TreeSequencePrefix] at haLt hiLt + omega + refine Finset.mem_biUnion.mpr ⟨v, hvX, ?_⟩ + rw [hbeforeZMissing v hvBefore hvTerminal] + exact hcMissingV + +private theorem helper_hXY_405.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj TjPrime : TreeSequence G e0) (phiJ rho1 rho3 : PartialEdgeColoring E k) + (zPosition : Fin (Tj.length + (1 : ℕ))) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : + ( + ∀ (a : Fin Tj.length), rho1 (Tj.edge a) = phiJ (Tj.edge a))) (_ : ( + ∀ (f : E) (_ : (( + ∃ (a : Fin Tj.length), (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ + ∃ (a : Fin TjPrime.length), (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 + f)) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) + ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition : ℕ)) (hzPositionBound : + (↑zPosition : ℕ) ≤ Tj.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment Z Tj) (M : TreeSequence G e0) (_ : ( + ∀ (A : TreeSequence G e0) (q : ℕ) (hq : (1 : ℕ) ≤ q) (hqA : q + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A q hq (Nat.le_trans (Nat.le_succ q) hqA)) + (TreeSequencePrefix A (q + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ q + (1 + : ℕ)) ↦ + by omega + ) hqA))) (_ n : ℕ) (hnU : U.length ≤ n) (hnM hnSuccM : n + (1 : ℕ) ≤ M.length) (hnM' : n ≤ + M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + let Y : TreeSequence G e0 := TreeSequencePrefix M (n + (1 : ℕ)) (Nat.le_trans U.positive + (Nat.le_trans hnU (Nat.le_succ n))) hnSuccM; + let j : Fin M.length := (⟨n, Decidable.byContradiction fun (a : ¬n < M.length) ↦ + by omega + ⟩ : Fin M.length); + ∀ (i : Fin Z.length) (_ : M.edge j = Z.edge i) (c : Fin k) (_ : phiJ (Z.edge i) = some c) (_ : + c ∈ TreeMissingColors rho3 X), TashkinovAugmentation rho3 X Y := by + classical + intro V E _ _ G k e0 Tj TjPrime phiJ rho1 rho3 zPosition uPosition hb2Edges hd2Edges + huPositionPositive huPositionBound hzPositionPositive hzPositionBound U Z hZTj M prefixPrefix + n n hnU hnM hnSuccM hnM' X Y j i hedgeMZ c hcolorZ hmissingX + let _ := Fintype.ofFinite V + have hlenXY : Y.length = X.length + 1 := by + change n + 1 = n + 1 + rfl + refine ⟨hlenXY, ?_, c, ?_, hmissingX⟩ + · simpa [X, Y] using prefixPrefix M n + (Nat.le_trans U.positive hnU) hnSuccM + · let iTj : Fin Tj.length := Fin.castLE hZTj.1 i + have hiTj : iTj.val < zPosition.val := by + change i.val < zPosition.val + have hiLt := i.isLt + simp only [TreeSequencePrefix, Nat.succ_eq_add_one, Z] at hiLt + exact hiLt + have hedgeTj : Tj.edge iTj = Z.edge i := hZTj.2.2 i + have hfixedZ : rho3 (Z.edge i) = phiJ (Z.edge i) := by + calc + rho3 (Z.edge i) = rho1 (Z.edge i) := + hd2Edges (Z.edge i) (Or.inl ⟨iTj, hiTj, hedgeTj⟩) + _ = phiJ (Z.edge i) := by + rw [← hedgeTj] + exact hb2Edges iTj + have hcolorM : rho3 (M.edge j) = some c := by + rw [hedgeMZ] + exact hfixedZ.trans hcolorZ + change rho3 (M.edge _) = some c + convert hcolorM using 1 + apply congrArg rho3 + apply congrArg M.edge + apply Fin.ext + rfl + +private theorem helper_branch_209.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj seed TjPrime : TreeSequence G e0) (phiJ rho1 rho3 : PartialEdgeColoring E k) + (terminalSupport u z : V) (hzTj : z ∈ TreeSequenceVertexSet Tj) (zPosition : Fin + (Tj.length + (1 : ℕ))) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : Tj.vertex + zPosition = z) (_ : ( + ∀ (a : Fin Tj.length), rho1 (Tj.edge a) = phiJ (Tj.edge a))) (_ : ( + ∀ (f : E) (_ : (( + ∃ (a : Fin Tj.length), (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ + ∃ (a : Fin TjPrime.length), (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 + f)) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) + ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition : ℕ)) (hzPositionBound : + (↑zPosition : ℕ) ≤ Tj.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment Z Tj) (_ : TreeSequenceInitialSegment seed U) (_ : + MissingColors G phiJ terminalSupport ⊆ MissingColors G rho3 terminalSupport ∪ + MissingColors G rho3 u) (_ : ( + ∀ v ∈ TreeVerticesBefore Tj z hzTj, v ≠ terminalSupport → MissingColors G rho3 v = + MissingColors G phiJ v)) (M : TreeSequence G e0) (_ : u ∈ TreeSequenceVertexSet U) (_ : + TashkinovAugmentationSequence phiJ seed Z) (_ : TreeSequenceInitialSegment U M) (_ : ( + ∀ (j : Fin M.length) (_ : U.length ≤ (↑j : ℕ)), + ∃ (i : Fin Z.length), M.edge j = Z.edge i ∧ M.vertex j.succ = Z.vertex i.succ)) (_ : ( + ∀ (i : Fin Z.length) (_ : Z.vertex i.succ ∉ TreeSequenceVertexSet U), + ∃ (j : Fin M.length), U.length ≤ (↑j : ℕ) ∧ M.edge j = Z.edge i ∧ M.vertex j.succ = Z.vertex + i.succ)) (_ : ( + ∀ (i j : Fin Z.length) (_ : Z.vertex i.succ ∉ TreeSequenceVertexSet U) (_ : Z.vertex j.succ ∉ + TreeSequenceVertexSet U) (_ : (↑i : ℕ) < (↑j : ℕ)) (p q : Fin M.length) (_ : M.vertex + p.succ = Z.vertex i.succ) (_ : M.vertex q.succ = Z.vertex j.succ), (↑p : ℕ) < (↑q : ℕ))) + (_ : ( + ∀ (A : TreeSequence G e0) (q : ℕ) (hq : (1 : ℕ) ≤ q) (hqA : q ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A q hq hqA) A)) (_ : ( + ∀ (A : TreeSequence G e0) (q : ℕ) (hq : (1 : ℕ) ≤ q) (hqA : q + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A q hq (Nat.le_trans (Nat.le_succ q) hqA)) + (TreeSequencePrefix A (q + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ q + (1 + : ℕ)) ↦ + by omega + ) hqA))) (_ : TreeSequenceInitialSegment seed Z) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TashkinovAugmentationSequence phiJ A B) (_ : A.length < + B.length), + ∃ (C : TreeSequence G e0), TashkinovAugmentation phiJ A C ∧ TashkinovAugmentationSequence phiJ + C B)) (_ n : ℕ) (hnU : U.length ≤ n) (_ : ( + ∀ (hnM : n ≤ M.length), TashkinovAugmentationSequence rho3 U (TreeSequencePrefix M n + (Nat.le_trans U.positive hnU) hnM))) (hnM : n + (1 : ℕ) ≤ M.length), + TashkinovAugmentationSequence rho3 U (TreeSequencePrefix M (n + (1 : ℕ)) (Nat.le_trans + U.positive (Nat.le_succ_of_le hnU)) hnM) := by + classical + intro V E _ _ G k e0 Tj seed TjPrime phiJ rho1 rho3 terminalSupport u z hzTj zPosition uPosition + hzPosition hb2Edges hd2Edges huPositionPositive huPositionBound hzPositionPositive + hzPositionBound U Z hZTj hseedU hterminalInclusion hbeforeZMissing M huU hroutePhiZ + hleftSegment hnewEntryFromRight heveryNewRightEntry hrightOrder prefixSegment prefixPrefix + hseedZSegment firstStep n n hnU ih hnM + let _ := Fintype.ofFinite V + by_cases hnEq : n = M.length + · omega + have hnSuccM : n + 1 ≤ M.length := by omega + have hnM' : n ≤ M.length := Nat.le_trans (Nat.le_succ n) hnSuccM + have ih' := ih hnM' + let X := TreeSequencePrefix M n + (Nat.le_trans U.positive hnU) hnM' + let Y := TreeSequencePrefix M (n + 1) + (Nat.le_trans U.positive (Nat.le_trans hnU (Nat.le_succ n))) + hnSuccM + let j : Fin M.length := ⟨n, by omega⟩ + obtain ⟨i, hedgeMZ, hvertexMZ⟩ := hnewEntryFromRight j hnU + have hrightOutside := @helper_hrightOutside_219 V E G e0 Tj TjPrime zPosition uPosition + huPositionPositive huPositionBound hzPositionPositive hzPositionBound M hleftSegment n hnU hnM + i hvertexMZ + have hiSeed := @helper_hiSeed_234 V E G e0 Tj seed TjPrime zPosition uPosition huPositionPositive + huPositionBound hzPositionPositive hzPositionBound hseedU M hseedZSegment n i hrightOutside + have hiZ : i.val < Z.length := i.isLt + let ZX := TreeSequencePrefix Z i.val + (Nat.le_trans seed.positive hiSeed) (Nat.le_of_lt hiZ) + have hseedZX := @helper_hseedZX_252 V E G e0 Tj seed zPosition hzPositionPositive hzPositionBound + hseedZSegment i hiSeed hiZ + have hZXZ : TreeSequenceInitialSegment ZX Z := + prefixSegment Z i.val (Nat.le_trans seed.positive hiSeed) + (Nat.le_of_lt hiZ) + have hsuffix : TashkinovAugmentationSequence phiJ ZX Z := + TashkinovAugmentationSequenceSuffix phiJ seed ZX Z + hroutePhiZ hseedZX hZXZ + have hZXlen : ZX.length = i.val := rfl + obtain ⟨A, hZXA, hAZ⟩ := firstStep hsuffix (by omega) + rcases hZXA with ⟨hlenA, hZXASegment, c, hcolorA, hmissingZX⟩ + have hAZSegment : TreeSequenceInitialSegment A Z := + TashkinovAugmentationSequenceInitialSegment phiJ A Z hAZ + have hAi : A.length = i.val + 1 := by omega + let ai : Fin A.length := ⟨i.val, by omega⟩ + have hcolorZ : phiJ (Z.edge i) = some c := by + have haiLast : ai = + Fin.cast hlenA.symm (Fin.last ZX.length) := by + apply Fin.ext + simp [ai, hZXlen] + have hZai : Z.edge (Fin.castLE hAZSegment.1 ai) = A.edge ai := + hAZSegment.2.2 ai + have hcast : Fin.castLE hAZSegment.1 ai = i := by + apply Fin.ext + simp [ai] + rw [← hcast, hZai, haiLast] + exact hcolorA + have hleftX {v : V} (hvU : v ∈ TreeSequenceVertexSet U) : + v ∈ TreeSequenceVertexSet X := by + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hvU ⊢ + obtain ⟨b, hb⟩ := hvU + refine ⟨Fin.castLE (Nat.succ_le_succ hnU) b, ?_⟩ + change M.vertex _ = v + calc + M.vertex _ = M.vertex + (Fin.castLE (Nat.succ_le_succ hleftSegment.1) b) := by + congr 1 + _ = U.vertex b := hleftSegment.2.1 b + _ = v := hb + have hmissingX := @helper_hmissingX_305 V E inferInstance inferInstance G k e0 Tj seed TjPrime + phiJ rho3 terminalSupport u z hzTj zPosition uPosition hzPosition huPositionPositive + huPositionBound hzPositionPositive hzPositionBound hZTj hseedU hterminalInclusion + hbeforeZMissing M huU heveryNewRightEntry hrightOrder hseedZSegment n n hnU hnM hnM' i + hvertexMZ hrightOutside hiSeed hiZ hZXZ hZXlen A hlenA c hmissingZX hleftX + have hXY := @helper_hXY_405 V E inferInstance inferInstance G k e0 Tj TjPrime phiJ rho1 rho3 + zPosition uPosition hb2Edges hd2Edges huPositionPositive huPositionBound hzPositionPositive + hzPositionBound hZTj M prefixPrefix n n hnU hnM hnSuccM hnM' i hedgeMZ c hcolorZ hmissingX + change TashkinovAugmentationSequence rho3 U Y + exact Relation.ReflTransGen.tail ih' hXY + +private theorem helper_replay_227.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj seed TjPrime : TreeSequence G e0) (phiJ rho1 rho3 : PartialEdgeColoring E k) + (terminalSupport u z : V) (hzTj : z ∈ TreeSequenceVertexSet Tj) (zPosition : Fin + (Tj.length + (1 : ℕ))) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : Tj.vertex + zPosition = z) (_ : ( + ∀ (a : Fin Tj.length), rho1 (Tj.edge a) = phiJ (Tj.edge a))) (_ : ( + ∀ (f : E) (_ : (( + ∃ (a : Fin Tj.length), (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ + ∃ (a : Fin TjPrime.length), (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 + f)) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) + ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition : ℕ)) (hzPositionBound : + (↑zPosition : ℕ) ≤ Tj.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment Z Tj) (_ : TreeSequenceInitialSegment seed U) (_ : + MissingColors G phiJ terminalSupport ⊆ MissingColors G rho3 terminalSupport ∪ + MissingColors G rho3 u) (_ : ( + ∀ v ∈ TreeVerticesBefore Tj z hzTj, v ≠ terminalSupport → MissingColors G rho3 v = + MissingColors G phiJ v)) (M : TreeSequence G e0) (_ : u ∈ TreeSequenceVertexSet U) (_ : + TashkinovAugmentationSequence phiJ seed Z) (hleftSegment : TreeSequenceInitialSegment U M) + (_ : ( + ∀ (j : Fin M.length) (_ : U.length ≤ (↑j : ℕ)), + ∃ (i : Fin Z.length), M.edge j = Z.edge i ∧ M.vertex j.succ = Z.vertex i.succ)) (_ : ( + ∀ (i : Fin Z.length) (_ : Z.vertex i.succ ∉ TreeSequenceVertexSet U), + ∃ (j : Fin M.length), U.length ≤ (↑j : ℕ) ∧ M.edge j = Z.edge i ∧ M.vertex j.succ = Z.vertex + i.succ)) (_ : ( + ∀ (i j : Fin Z.length) (_ : Z.vertex i.succ ∉ TreeSequenceVertexSet U) (_ : Z.vertex j.succ ∉ + TreeSequenceVertexSet U) (_ : (↑i : ℕ) < (↑j : ℕ)) (p q : Fin M.length) (_ : M.vertex + p.succ = Z.vertex i.succ) (_ : M.vertex q.succ = Z.vertex j.succ), (↑p : ℕ) < (↑q : ℕ))) + (_ : ( + ∀ (A : TreeSequence G e0) (q : ℕ) (hq : (1 : ℕ) ≤ q) (hqA : q ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A q hq hqA) A)) (_ : ( + ∀ (A : TreeSequence G e0) (q : ℕ) (hq : (1 : ℕ) ≤ q) (hqA : q + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A q hq (Nat.le_trans (Nat.le_succ q) hqA)) + (TreeSequencePrefix A (q + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ q + (1 + : ℕ)) ↦ + by omega + ) hqA))) (_ : TreeSequencePrefix M U.length U.positive hleftSegment.1 = U) (_ : + TreeSequenceInitialSegment seed Z) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TashkinovAugmentationSequence phiJ A B) (_ : A.length < + B.length), + ∃ (C : TreeSequence G e0), TashkinovAugmentation phiJ A C ∧ TashkinovAugmentationSequence phiJ + C B)) (n : ℕ) (hnU : U.length ≤ n) (hnM : n ≤ M.length), TashkinovAugmentationSequence + rho3 U (TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM) := by + classical + intro V E _ _ G k e0 Tj seed TjPrime phiJ rho1 rho3 terminalSupport u z hzTj zPosition uPosition + hzPosition hb2Edges hd2Edges huPositionPositive huPositionBound hzPositionPositive + hzPositionBound U Z hZTj hseedU hterminalInclusion hbeforeZMissing M huU hroutePhiZ + hleftSegment hnewEntryFromRight heveryNewRightEntry hrightOrder prefixSegment prefixPrefix + prefixAtLeft hseedZSegment firstStep n hnU hnM + let _ := Fintype.ofFinite V + induction n, hnU using Nat.le_induction with + | base => + simpa [prefixAtLeft] using + (show TashkinovAugmentationSequence rho3 U U from + Relation.ReflTransGen.refl) + | @succ n hnU ih => + exact @helper_branch_209 V E inferInstance inferInstance G k e0 Tj seed + TjPrime phiJ rho1 rho3 terminalSupport u z hzTj zPosition uPosition hzPosition hb2Edges + hd2Edges huPositionPositive huPositionBound hzPositionPositive hzPositionBound hZTj + hseedU hterminalInclusion hbeforeZMissing M huU hroutePhiZ hleftSegment + hnewEntryFromRight heveryNewRightEntry hrightOrder prefixSegment prefixPrefix + hseedZSegment firstStep n n hnU ih hnM +private theorem helper_hrouteUM_530.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) {lowerInput : PartialEdgeColoring E k} + {lowerTree : TreeSequence G e0} {lowerGenerating : PartialEdgeColoring E k} (_ : + ExtendedTashkinovTree G k e0 lowerInput lowerTree lowerGenerating) (_ : Fin ett.rounds) + (Tj seed TjPrime : TreeSequence G e0) (phiJ rho1 rho3 : PartialEdgeColoring E k) + (terminalSupport u z : V) (hzTj : z ∈ TreeSequenceVertexSet Tj) (zPosition : Fin + (Tj.length + (1 : ℕ))) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : Tj.vertex + zPosition = z) (_ : TashkinovAugmentationSequence phiJ seed Tj) (_ : ( + ∀ (a : Fin Tj.length), rho1 (Tj.edge a) = phiJ (Tj.edge a))) (_ : ( + ∀ (f : E) (_ : (( + ∃ (a : Fin Tj.length), (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ + ∃ (a : Fin TjPrime.length), (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 + f)) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) + ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition : ℕ)) (hzPositionBound : + (↑zPosition : ℕ) ≤ Tj.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment Z Tj) (_ : TreeSequenceInitialSegment seed U) (_ : + TreeSequenceInitialSegment seed Z) (_ : MissingColors G phiJ terminalSupport ⊆ + MissingColors G rho3 terminalSupport ∪ MissingColors G rho3 u) (_ : ( + ∀ v ∈ TreeVerticesBefore Tj z hzTj, v ≠ terminalSupport → MissingColors G rho3 v = + MissingColors G phiJ v)) (M : TreeSequence G e0) (_ : OrderedTreeUnion U Z M) (_ : u ∈ + TreeSequenceVertexSet U), TashkinovAugmentationSequence rho3 U M := by + classical + intro V E _ _ _ _ G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower + jSlot Tj seed TjPrime phiJ rho1 rho3 terminalSupport u z hzTj zPosition uPosition + hzPosition hTjAugmentation hb2Edges hd2Edges huPositionPositive huPositionBound + hzPositionPositive hzPositionBound U Z hZTj hseedU hseedZ hterminalInclusion + hbeforeZMissing M hunion huU + have hroutePhiZ : TashkinovAugmentationSequence phiJ seed Z := + TashkinovAugmentationSequenceRestrict phiJ seed Z Tj + hTjAugmentation hseedZ hZTj + have hleftSegment := hunion.leftSegment + have hnewEntryFromRight := hunion.newEntryFromRight + have heveryNewRightEntry := hunion.everyNewRightEntry + have hrightOrder := hunion.rightOrder + have prefixSegment (A : TreeSequence G e0) (q : Nat) + (hq : 1 ≤ q) (hqA : q ≤ A.length) : + TreeSequenceInitialSegment (TreeSequencePrefix A q hq hqA) A := by + refine ⟨hqA, ?_, ?_⟩ + · intro i + simp [TreeSequencePrefix] + · intro i + simp [TreeSequencePrefix] + have prefixPrefix (A : TreeSequence G e0) (q : Nat) + (hq : 1 ≤ q) (hqA : q + 1 ≤ A.length) : + TreeSequenceInitialSegment + (TreeSequencePrefix A q hq (Nat.le_trans (Nat.le_succ q) hqA)) + (TreeSequencePrefix A (q + 1) (by omega) hqA) := by + refine ⟨Nat.le_succ q, ?_, ?_⟩ + · intro i + change A.vertex _ = A.vertex _ + congr 1 + · intro i + change A.edge _ = A.edge _ + congr 1 + have prefixSelf (A : TreeSequence G e0) : + TreeSequencePrefix A A.length A.positive le_rfl = A := by + cases A with + | mk len pos vertex edge vinj einj first attach => + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + rfl + · apply heq_of_eq + funext i + rfl + have equalPrefixes := @helper_equalPrefixes_181 V E G e0 + have prefixAtLeft : + TreeSequencePrefix M U.length U.positive hleftSegment.1 = U := by + apply equalPrefixes + (prefixSegment M U.length U.positive hleftSegment.1) + hleftSegment + rfl + have hseedZSegment : TreeSequenceInitialSegment seed Z := + TashkinovAugmentationSequenceInitialSegment phiJ seed Z hroutePhiZ + have firstStep {A B : TreeSequence G e0} + (hAB : TashkinovAugmentationSequence phiJ A B) + (hlt : A.length < B.length) : + ∃ C, TashkinovAugmentation phiJ A C ∧ + TashkinovAugmentationSequence phiJ C B := by + unfold TashkinovAugmentationSequence at hAB ⊢ + induction hAB using Relation.ReflTransGen.head_induction_on with + | refl => omega + | @head A C hAC hCB ih => exact ⟨C, hAC, hCB⟩ + have replay := @helper_replay_227 V E inferInstance inferInstance G k e0 Tj seed TjPrime phiJ rho1 + rho3 terminalSupport u z hzTj zPosition uPosition hzPosition hb2Edges hd2Edges + huPositionPositive huPositionBound hzPositionPositive hzPositionBound hZTj hseedU + hterminalInclusion hbeforeZMissing M huU hroutePhiZ hleftSegment hnewEntryFromRight + heveryNewRightEntry hrightOrder prefixSegment prefixPrefix prefixAtLeft hseedZSegment + firstStep + have hfull := replay M.length hleftSegment.1 le_rfl + simpa [prefixSelf] using hfull + +private theorem helper_hbound_937.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) {lowerInput : PartialEdgeColoring E k} + {lowerTree : TreeSequence G e0} {lowerGenerating : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 lowerInput lowerTree lowerGenerating) (jSlot : Fin + ett.rounds), (1 : ℕ) ≤ (↑jSlot : ℕ) → ∀ (Tjm1 Tj seed TjPrime : TreeSequence G e0) (rho3 : + PartialEdgeColoring E k) (_ : Fin (Tj.length + (1 : ℕ))) (_ : Fin (TjPrime.length + (1 : + ℕ))), ett.series.data.tree jSlot.castSucc.castSucc = Tjm1 → ett.series.data.tree + jSlot.succ.castSucc = Tj → lower.rounds = (↑jSlot : ℕ) → MaximumProperty ett → + IsProperEdgeColoring G rho3 → IsOneEdgeUncolored rho3 e0 → (ett.series.data.kind + jSlot.castSucc = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence rho3 Tjm1 + seed ∨ (ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.RE) ∧ ∃ (f : E) + (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges jSlot.castSucc = {f} ∧ + TreeSequenceAdjoinEdge Tjm1 f adjoinSeed ∧ TashkinovAugmentationSequence rho3 adjoinSeed + seed) → ∀ (C : TreeSequence G e0), TashkinovAugmentationSequence rho3 seed C → + ColoredVertexSetClosed G rho3 (TreeSequenceVertexSet C) → StableColoring + (ett.series.data.tree jSlot.castSucc.castSucc) (TashkinovStoredColors ett.series.data + jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho3 → (TreeSequenceVertexSet + C).card ≤ (TreeSequenceVertexSet Tj).card := by + classical + intro V E _ _ _ G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot + hjPositive Tjm1 Tj seed TjPrime rho3 zPosition uPosition hTjm1Stored hTjStored hLowerRounds + hMP hrhoProper hrhoOne hseedBuildRho C hrouteSeedC hclosedC hstableAtSlot + have hMP' := hMP + unfold MaximumProperty at hMP' + have hstage := hMP'.2 jSlot.val hjPositive jSlot.isLt + dsimp only at hstage + have hidx : (⟨jSlot.val, by omega⟩ : Fin (ett.rounds + 1)) = + jSlot.castSucc := by + apply Fin.ext + rfl + have hnextIdx : (⟨jSlot.val + 1, by omega⟩ : Fin (ett.rounds + 2)) = + jSlot.succ.castSucc := by + apply Fin.ext + rfl + rw [hidx, hnextIdx] at hstage + rcases hseedBuildRho with hparallel | hserial + · have hclosureTjm1C : TashkinovClosure rho3 Tjm1 C := + ⟨Relation.ReflTransGen.trans hparallel.2 hrouteSeedC, hclosedC⟩ + have hraw := hstage rho3 Tjm1 C + hrhoProper hrhoOne + hstableAtSlot + (by + left + refine ⟨?_, ?_⟩ + · exact hparallel.1 + · exact hTjm1Stored.symm) + hclosureTjm1C + simpa only [hTjStored] using hraw + · rcases hserial with ⟨hkind, f, adjoinSeed, hconnecting, + hadjoin, hroute⟩ + have hclosureAdjoinC : TashkinovClosure rho3 adjoinSeed C := + ⟨Relation.ReflTransGen.trans hroute hrouteSeedC, hclosedC⟩ + have hraw := hstage rho3 adjoinSeed C + hrhoProper hrhoOne + hstableAtSlot + (by + right + refine ⟨?_, f, ?_, ?_⟩ + · exact hkind + · exact hconnecting + · rw [hTjm1Stored] + exact hadjoin) + hclosureAdjoinC + simpa only [hTjStored] using hraw + +private theorem helper_transportUStep_875.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) {lowerInput : PartialEdgeColoring E k} + {lowerTree : TreeSequence G e0} {lowerGenerating : PartialEdgeColoring E k} (_ : + ExtendedTashkinovTree G k e0 lowerInput lowerTree lowerGenerating) (_ : Fin ett.rounds) + (Tj _ TjPrime : TreeSequence G e0) (rho1 rho3 : PartialEdgeColoring E k) (u : V) (huPrime + : u ∈ TreeSequenceVertexSet TjPrime) (zPosition : Fin (Tj.length + (1 : ℕ))) (uPosition : + Fin (TjPrime.length + (1 : ℕ))) (_ : ( + ∀ (f : E) (_ : (( + ∃ (a : Fin Tj.length), (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ + ∃ (a : Fin TjPrime.length), (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 + f)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (huPositionPositive : (1 + : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A U) (_ : A.length < U.length) + {v : V} (_ : v ∈ TreeSequenceVertexSet A), v ∈ TreeVerticesBefore TjPrime u huPrime)) (_ : + ( + ∀ w ∈ TreeVerticesBefore TjPrime u huPrime, MissingColors G rho3 w = MissingColors G rho1 w)) + {A B : TreeSequence G e0} (_ : TashkinovAugmentation rho1 A B) (_ : + TreeSequenceInitialSegment B U), TashkinovAugmentation rho3 A B := by + classical + intro V E _ _ _ G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot + Tj seed TjPrime rho1 rho3 u huPrime zPosition uPosition hd2Edges segmentTrans + huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore hbeforePrimeMissing A B + hstep hBU + rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ + have hAU : TreeSequenceInitialSegment A U := segmentTrans hAB hBU + have hAlen : A.length < U.length := + lt_of_lt_of_le (by omega) hBU.1 + have hcMissingRho : c ∈ TreeMissingColors rho3 A := by + unfold TreeMissingColors at hcMissing ⊢ + obtain ⟨w, hwA, hcw⟩ := Finset.mem_biUnion.mp hcMissing + refine Finset.mem_biUnion.mpr ⟨w, hwA, ?_⟩ + rw [hbeforePrimeMissing w (hUsegmentVertexBefore hAU hAlen hwA)] + exact hcw + let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + let addedU : Fin U.length := Fin.castLE hBU.1 added + let addedPrime : Fin TjPrime.length := Fin.castLE hUPrime.1 addedU + have haddedPosition : addedPrime.val < uPosition.val := by + change A.length < uPosition.val + have hUlen : U.length = uPosition.val := by simp [U, TreeSequencePrefix] + omega + have haddedIdentity : TjPrime.edge addedPrime = B.edge added := by + exact (hUPrime.2.2 addedU).trans (hBU.2.2 added) + have haddedFixed : rho3 (B.edge added) = rho1 (B.edge added) := by + apply hd2Edges (B.edge added) + exact Or.inr ⟨addedPrime, haddedPosition, haddedIdentity⟩ + refine ⟨hlen, hAB, c, ?_, hcMissingRho⟩ + change rho3 (B.edge added) = some c + exact haddedFixed.trans hcolor + +private theorem helper_branch_1101.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) {lowerInput : PartialEdgeColoring E k} + {lowerTree : TreeSequence G e0} {lowerGenerating : PartialEdgeColoring E k} (_ : + ExtendedTashkinovTree G k e0 lowerInput lowerTree lowerGenerating) (_ : Fin ett.rounds) (_ + Tj _ TjPrime : TreeSequence G e0) (u : V) (zPosition : Fin (Tj.length + (1 : ℕ))) (_ : Fin + (TjPrime.length + (1 : ℕ))) (_ : u ∉ TreeSequenceVertexSet Tj) (hzPositionPositive : (1 : + ℕ) ≤ (↑zPosition : ℕ)) (hzPositionBound : (↑zPosition : ℕ) ≤ Tj.length), + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment Z Tj) (C : TreeSequence G e0) (_ : u ∈ TreeSequenceVertexSet + C) (_ : (TreeSequenceVertexSet C).card ≤ (TreeSequenceVertexSet Tj).card) (_ : + TreeSequenceVertexSet Z ⊆ TreeSequenceVertexSet C) (_ : zPosition = Fin.last Tj.length), + False := by + classical + intro V E _ _ _ G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot + Tjm1 Tj seed TjPrime u zPosition uPosition huOutsideTj hzPositionPositive hzPositionBound Z + hZTj C huC hbound hZC hzLast + have hZlen : Z.length = Tj.length := by + simp [Z, TreeSequencePrefix, hzLast] + have hTjZ : TreeSequenceVertexSet Tj ⊆ TreeSequenceVertexSet Z := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨i, rfl⟩ := hv + let iZ : Fin (Z.length + 1) := ⟨i.val, by omega⟩ + refine ⟨iZ, ?_⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hZTj.1) iZ = i := by + apply Fin.ext + rfl + rw [← hcast] + exact hZTj.2.1 iZ + have hTjC : TreeSequenceVertexSet Tj ⊆ TreeSequenceVertexSet C := + fun _ hv => hZC (hTjZ hv) + have hstrict : TreeSequenceVertexSet Tj < TreeSequenceVertexSet C := + Finset.ssubset_iff_subset_ne.mpr ⟨hTjC, by + intro heq + exact huOutsideTj (heq.symm.subset huC)⟩ + exact (Nat.not_lt_of_ge hbound) (Finset.card_lt_card hstrict) + +private theorem helper_hstableLower_821.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : + LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tjm1 Tj : TreeSequence G e0) (phiJ rho3 : + PartialEdgeColoring E k) (Dprev : Finset (Fin k)) (terminalSupport : V) (hterminalTj : + terminalSupport ∈ TreeSequenceVertexSet Tj), TreeSequenceVertexSet Tjm1 ⊆ + TreeVerticesBefore Tj terminalSupport hterminalTj → StableColoringBeforeVertex Tj + terminalSupport hterminalTj Dprev phiJ rho3 → StableColoring Tjm1 Dprev phiJ rho3 := by + classical + intro V E _ _ G k e0 Tjm1 Tj phiJ rho3 Dprev terminalSupport hterminalTj hTjm1Before hd1 + let _ := Fintype.ofFinite V + unfold StableColoring + constructor + · intro f hfIncident hfControlled + obtain ⟨v, hvTjm1, hvf⟩ := hfIncident + have hvBefore : v ∈ TreeVerticesBefore Tj terminalSupport hterminalTj := + hTjm1Before hvTjm1 + apply hd1.1 f ⟨v, hvBefore, hvf⟩ + obtain ⟨c, hcControlled, hfc⟩ := hfControlled + refine ⟨c, ?_, hfc⟩ + rcases Finset.mem_union.mp hcControlled with hcMissing | hcStored + · apply Finset.mem_union_left + unfold TreeMissingColors at hcMissing + obtain ⟨w, hwTjm1, hcw⟩ := Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨w, hTjm1Before hwTjm1, hcw⟩ + · exact Finset.mem_union_right _ hcStored + · intro v hvTjm1 + exact hd1.2 v (hTjm1Before hvTjm1) + +private theorem helper_segmentTrans_842.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 + : E} {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + rcases hAB with ⟨hlenAB, hvertexAB, hedgeAB⟩ + rcases hBC with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨hlenAB.trans hlenBC, ?_, ?_⟩ + · intro i + calc + C.vertex (Fin.castLE + (Nat.succ_le_succ (hlenAB.trans hlenBC)) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hlenBC) + (Fin.castLE (Nat.succ_le_succ hlenAB) i)) := by congr 1 + _ = B.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) i) := + hvertexBC _ + _ = A.vertex i := hvertexAB i + · intro i + calc + C.edge (Fin.castLE (hlenAB.trans hlenBC) i) = + C.edge (Fin.castLE hlenBC (Fin.castLE hlenAB i)) := by congr 1 + _ = B.edge (Fin.castLE hlenAB i) := hedgeBC _ + _ = A.edge i := hedgeAB i + +private theorem helper_commonPrefix_864.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 + : E} {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → + TreeSequenceInitialSegment B C → A.length ≤ B.length → TreeSequenceInitialSegment A B := by + classical + intro V E G e0 A B C hAC hBC hlen + rcases hAC with ⟨hlenAC, hvertexAC, hedgeAC⟩ + rcases hBC with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨hlen, ?_, ?_⟩ + · intro i + calc + B.vertex (Fin.castLE (Nat.succ_le_succ hlen) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hlenBC) + (Fin.castLE (Nat.succ_le_succ hlen) i)) := + (hvertexBC _).symm + _ = C.vertex (Fin.castLE (Nat.succ_le_succ hlenAC) i) := by + congr 1 + _ = A.vertex i := hvertexAC i + · intro i + calc + B.edge (Fin.castLE hlen i) = + C.edge (Fin.castLE hlenBC (Fin.castLE hlen i)) := + (hedgeBC _).symm + _ = C.edge (Fin.castLE hlenAC i) := by congr 1 + _ = A.edge i := hedgeAC i + +private theorem helper_hseedVertexBefore_888.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] {G : + LooplessMultigraph V E} {e0 : E} (Tj seed : TreeSequence G e0) (terminalSupport : V) + (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet Tj), TreeSequenceInitialSegment + seed Tj → seed.vertex (Fin.last seed.length) = terminalSupport → ∀ (i : Fin (seed.length + + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ TreeVerticesBefore Tj terminalSupport + hterminalTj := by + classical + intro V E _ G e0 Tj seed terminalSupport hterminalTj hseedJ hseedTerminal i hi + let _ := Fintype.ofFinite V + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + constructor + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.castLE (Nat.succ_le_succ hseedJ.1) i, + hseedJ.2.1 i⟩ + · unfold TreeVertexOrder + let p : Fin (Tj.length + 1) := + Fin.castLE (Nat.succ_le_succ hseedJ.1) i + let q : Fin (Tj.length + 1) := + Fin.castLE (Nat.succ_le_succ hseedJ.1) (Fin.last seed.length) + refine ⟨p, q, ?_, ?_, ?_⟩ + · exact hseedJ.2.1 i + · exact (hseedJ.2.1 (Fin.last seed.length)).trans hseedTerminal + · simpa [p, q] using hi + +private theorem helper_hUsegmentVertexBefore_1004.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) {lowerInput : PartialEdgeColoring E k} + {lowerTree : TreeSequence G e0} {lowerGenerating : PartialEdgeColoring E k} (_ : + ExtendedTashkinovTree G k e0 lowerInput lowerTree lowerGenerating) (_ : Fin ett.rounds) + (Tj _ TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (_ : Fin (Tj.length + (1 : ℕ))) (uPosition : Fin (TjPrime.length + (1 : ℕ))) + (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( + ∀ (i : Fin (TjPrime.length + (1 : ℕ))) (_ : (↑i : ℕ) < (↑uPosition : ℕ)), TjPrime.vertex i ∈ + TreeVerticesBefore TjPrime u huPrime)) {A : TreeSequence G e0} (_ : + TreeSequenceInitialSegment A U) (_ : A.length < U.length) {v : V} (_ : v ∈ + TreeSequenceVertexSet A), v ∈ TreeVerticesBefore TjPrime u huPrime := by + classical + intro V E _ _ _ G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot + Tj seed TjPrime u huPrime zPosition uPosition huPositionPositive huPositionBound U hUPrime + hprimeVertexBefore A hAU hAlen v hvA + obtain ⟨hAULen, hAUVertices, -⟩ := hAU + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hvA + obtain ⟨i, rfl⟩ := hvA + let iU : Fin (U.length + 1) := + Fin.castLE (Nat.succ_le_succ hAULen) i + let iPrime : Fin (TjPrime.length + 1) := + Fin.castLE (Nat.succ_le_succ hUPrime.1) iU + have hiPrime : iPrime.val < uPosition.val := by + change i.val < uPosition.val + have hUlen : U.length = uPosition.val := by simp [U, TreeSequencePrefix] + omega + rw [← hAUVertices i, ← hUPrime.2.1 iU] + exact hprimeVertexBefore iPrime hiPrime + +private theorem helper_hbeforeZMissing_1101.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + [DecidableEq V] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tj TjPrime : TreeSequence G + e0) (phiJ rho1 rho3 : PartialEdgeColoring E k) (terminalSupport u z : V) (huPrime : u ∈ + TreeSequenceVertexSet TjPrime) (hzTj : z ∈ TreeSequenceVertexSet Tj), u ∉ + TreeSequenceVertexSet Tj → (∀ v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport, + MissingColors G rho1 v = MissingColors G phiJ v) → (∀ v ∈ ((TreeVerticesBefore Tj z hzTj ∪ + {z} ∪ (TreeVerticesBefore TjPrime u huPrime ∪ {u})).erase u).erase z, MissingColors G rho3 + v = MissingColors G rho1 v) → (∀ {v : V}, v ∈ TreeVerticesBefore Tj z hzTj → v ∈ + TreeSequenceVertexSet Tj ∧ v ≠ z) → ∀ v ∈ TreeVerticesBefore Tj z hzTj, v ≠ + terminalSupport → MissingColors G rho3 v = MissingColors G phiJ v := by + classical + intro V E _ _ _ G k e0 Tj TjPrime phiJ rho1 rho3 terminalSupport u z huPrime hzTj huOutsideTj + hb2Missing hd2Missing hbeforeZData v hv hvTerminal + let _ := Fintype.ofFinite V + have hvData := hbeforeZData hv + have hvU : v ≠ u := by + intro hvu + subst v + exact huOutsideTj hvData.1 + have hRhoThreeOne : + MissingColors G rho3 v = MissingColors G rho1 v := by + apply hd2Missing v + apply Finset.mem_erase.mpr + refine ⟨hvData.2, Finset.mem_erase.mpr ⟨hvU, ?_⟩⟩ + apply Finset.mem_union_left + exact Finset.mem_union_left _ hv + exact hRhoThreeOne.trans + (hb2Missing v (Finset.mem_erase.mpr ⟨hvTerminal, hvData.1⟩)) + +private theorem helper_continuation_1296.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) {lowerInput : PartialEdgeColoring E k} + {lowerTree : TreeSequence G e0} {lowerGenerating : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 lowerInput lowerTree lowerGenerating) (jSlot : Fin + ett.rounds) (_ : (1 : ℕ) ≤ (↑jSlot : ℕ)) (Tjm1 Tj seed TjPrime : TreeSequence G e0) (phiJ + rho1 rho3 : PartialEdgeColoring E k) (Dprev : Finset (Fin k)) (terminalSupport u z : V) + (beta deltaN : Fin k) (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet Tj) (huPrime + : u ∈ TreeSequenceVertexSet TjPrime) (hzTj : z ∈ TreeSequenceVertexSet Tj) (zPosition : + Fin (Tj.length + (1 : ℕ))) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : Tj.vertex + zPosition = z) (_ : TjPrime.vertex uPosition = u) (_ : seed.vertex (Fin.last seed.length) + = terminalSupport) (_ : u ∉ TreeSequenceVertexSet Tj) (_ : ett.series.data.tree + jSlot.castSucc.castSucc = Tjm1) (_ : ett.series.data.coloring jSlot.castSucc = phiJ) (_ : + ett.series.data.tree jSlot.succ.castSucc = Tj) (_ : TashkinovStoredColors ett.series.data + jSlot.castSucc = Dprev) (_ : lower.rounds = (↑jSlot : ℕ)) (_ : lower.series.data.tree + (Fin.last lower.rounds).castSucc = Tjm1) (_ : lower.series.data.kind (Fin.last + lower.rounds) = ett.series.data.kind jSlot.castSucc) (_ : + lower.series.data.connectingEdges (Fin.last lower.rounds) = + ett.series.data.connectingEdges jSlot.castSucc) (_ : TreeSequenceVertexSet Tjm1 ⊆ + TreeVerticesBefore Tj terminalSupport hterminalTj) (_ : TashkinovAugmentationSequence phiJ + seed Tj) (_ : MaximumProperty ett) (_ : MaximumProperty lower) (_ : ( + ∀ (Tstar : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 lower rho3 + Tstar) (_ : MaximumProperty corr.replacementETT), ColoredVertexSetElementary G rho3 + (TreeSequenceVertexSet Tstar))) (_ : ( + ∀ v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport, MissingColors G rho1 v = MissingColors + G phiJ v)) (_ : ( + ∀ (a : Fin Tj.length), rho1 (Tj.edge a) = phiJ (Tj.edge a))) (_ : deltaN ∈ MissingColors G + rho1 terminalSupport) (_ : IsProperEdgeColoring G rho3) (_ : IsOneEdgeUncolored rho3 e0) + (_ : ( + ∀ v ∈ ((TreeVerticesBefore Tj z hzTj ∪ { z } ∪ (TreeVerticesBefore TjPrime u huPrime ∪ + { u })).erase u).erase z, MissingColors G rho3 v = MissingColors G rho1 v)) (_ : ( + ∀ (f : E) (_ : (( + ∃ (a : Fin Tj.length), (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ + ∃ (a : Fin TjPrime.length), (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 + f)) (_ : ( + ∀ (_ : beta ∈ MissingColors G rho1 z), deltaN ∈ MissingColors G rho3 z)) (_ : zPosition = + Fin.last Tj.length ∨ (↑zPosition : ℕ) < (↑(Fin.last Tj.length) : ℕ) ∧ beta ∈ MissingColors + G rho1 z) (_ : StableColoring Tjm1 Dprev phiJ rho3) (_ : ModColoring lower rho3) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : + (ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho3 Tjm1 seed ∨ (ett.series.data.kind jSlot.castSucc = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind jSlot.castSucc = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges jSlot.castSucc = + { f } ∧ TreeSequenceAdjoinEdge Tjm1 f adjoinSeed ∧ TashkinovAugmentationSequence rho3 + adjoinSeed seed)) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : + (↑uPosition : ℕ) ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition : ℕ)) + (hzPositionBound : (↑zPosition : ℕ) ≤ Tj.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment Z Tj) (_ : TreeSequenceInitialSegment seed U) (_ : + TreeSequenceInitialSegment seed Z) (_ : TashkinovAugmentationSequence rho3 seed U) (_ : + terminalSupport ≠ z) (_ : MissingColors G rho3 terminalSupport = MissingColors G rho1 + terminalSupport) (_ : MissingColors G phiJ terminalSupport ⊆ MissingColors G rho3 + terminalSupport ∪ MissingColors G rho3 u) (_ : ( + ∀ {v : V} (_ : v ∈ TreeVerticesBefore Tj z hzTj), v ∈ TreeSequenceVertexSet Tj ∧ v ≠ z)), + False := by + classical + intro V E _ _ _ _ G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower + jSlot hjPositive Tjm1 Tj seed TjPrime phiJ rho1 rho3 Dprev terminalSupport u z beta deltaN + hterminalTj huPrime hzTj zPosition uPosition hzPosition huPosition hseedTerminal + huOutsideTj hTjm1Stored hPhiJStored hTjStored hDprevStored hLowerRounds hLowerTree + hLowerKind hLowerConnecting hTjm1Before hTjAugmentation hMP hLowerMP hLowerI hb2Missing + hb2Edges hdeltaRho1 hrhoProper hrhoOne hd2Missing hd2Edges hd2Delta hzChoice hstableLower + hmod segmentTrans hseedBuildRho huPositionPositive huPositionBound hzPositionPositive + hzPositionBound U Z hZTj hseedU hseedZ hrouteRhoThreeU hterminalNeZ hterminalMissingEq + hterminalInclusion hbeforeZData + have hbeforeZMissing := @helper_hbeforeZMissing_1101 V E inferInstance inferInstance inferInstance + G k e0 Tj TjPrime phiJ rho1 rho3 terminalSupport u z huPrime hzTj huOutsideTj hb2Missing + hd2Missing hbeforeZData + obtain ⟨M, ⟨hunion⟩⟩ := OrderedTreeUnionExists U Z + have huU : u ∈ TreeSequenceVertexSet U := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨Fin.last U.length, ?_⟩ + change TjPrime.vertex (Fin.castLE (Nat.succ_le_succ huPositionBound) + (Fin.last uPosition.val)) = u + have hindex : Fin.castLE (Nat.succ_le_succ huPositionBound) + (Fin.last uPosition.val) = uPosition := by + apply Fin.ext + rfl + rw [hindex] + exact huPosition + have hrouteUM := @helper_hrouteUM_530 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot Tj seed TjPrime + phiJ rho1 rho3 terminalSupport u z hzTj zPosition uPosition hzPosition hTjAugmentation + hb2Edges hd2Edges huPositionPositive huPositionBound hzPositionPositive hzPositionBound hZTj + hseedU hseedZ hterminalInclusion hbeforeZMissing M hunion huU + obtain ⟨C, hclosureMC⟩ := TashkinovClosureExists rho3 M + have hrouteUC : TashkinovAugmentationSequence rho3 U C := + Relation.ReflTransGen.trans hrouteUM hclosureMC.1 + have hrouteSeedC : TashkinovAugmentationSequence rho3 seed C := + Relation.ReflTransGen.trans hrouteRhoThreeU hrouteUC + have hclosedC : + ColoredVertexSetClosed G rho3 (TreeSequenceVertexSet C) := + hclosureMC.2 + have huM : u ∈ TreeSequenceVertexSet M := by + rw [hunion.vertexSet] + exact Finset.mem_union_left _ huU + have hMCsegment : TreeSequenceInitialSegment M C := + TashkinovAugmentationSequenceInitialSegment rho3 M C hclosureMC.1 + have huC : u ∈ TreeSequenceVertexSet C := + TreeSequenceInitialSegmentVertexSetSubset hMCsegment huM + have huNotTjm1 : u ∉ TreeSequenceVertexSet Tjm1 := by + intro huLower + exact huOutsideTj (Finset.mem_filter.mp (hTjm1Before huLower)).1 + have hTjm1C : TreeSequenceInitialSegment Tjm1 C := by + rcases hseedBuildRho with hparallel | hserial + · exact TashkinovAugmentationSequenceInitialSegment rho3 Tjm1 C + (Relation.ReflTransGen.trans hparallel.2 hrouteSeedC) + · rcases hserial with ⟨-, f, adjoinSeed, -, hadjoin, hroute⟩ + exact segmentTrans hadjoin.2.1 + (TashkinovAugmentationSequenceInitialSegment rho3 adjoinSeed C + (Relation.ReflTransGen.trans hroute hrouteSeedC)) + have hTjm1StrictC : Tjm1.length < C.length := by + have hsubset : TreeSequenceVertexSet Tjm1 ⊆ TreeSequenceVertexSet C := + TreeSequenceInitialSegmentVertexSetSubset hTjm1C + have hstrictSet : TreeSequenceVertexSet Tjm1 < TreeSequenceVertexSet C := + Finset.ssubset_iff_subset_ne.mpr ⟨hsubset, by + intro heq + exact huNotTjm1 (heq.symm.subset huC)⟩ + have hcard := Finset.card_lt_card hstrictSet + simpa [TreeSequenceVertexSet, Finset.card_image_of_injective, + Tjm1.vertex_injective, C.vertex_injective] using hcard + have hLowerEligible : + ((lower.series.data.kind (Fin.last lower.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho3 Tjm1 C) ∨ + ((lower.series.data.kind (Fin.last lower.rounds) = + some TashkinovExtensionKind.SE ∨ + lower.series.data.kind (Fin.last lower.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + lower.series.data.connectingEdges (Fin.last lower.rounds) = {f} ∧ + TreeSequenceAdjoinEdge Tjm1 f adjoinSeed ∧ + TashkinovAugmentationSequence rho3 adjoinSeed C)) := by + rcases hseedBuildRho with hparallel | hserial + · exact Or.inl ⟨hLowerKind.trans hparallel.1, + Relation.ReflTransGen.trans hparallel.2 hrouteSeedC⟩ + · rcases hserial with ⟨hkind, f, adjoinSeed, hconnecting, + hadjoin, hroute⟩ + exact Or.inr ⟨Or.imp (hLowerKind.trans) (hLowerKind.trans) hkind, + f, adjoinSeed, hLowerConnecting.trans hconnecting, hadjoin, + Relation.ReflTransGen.trans hroute hrouteSeedC⟩ + have hcorrNonempty : + Nonempty (CorrespondingExtendedTashkinovTree G k e0 lower rho3 C) := by + have hmod' := hmod + unfold ModColoring at hmod' + dsimp only at hmod' + apply hmod'.2.2 C + · rw [hLowerTree] + exact hTjm1C + · rw [hLowerTree] + exact hTjm1StrictC + · simpa [hLowerTree] using hLowerEligible + obtain ⟨corr⟩ := hcorrNonempty + have hreplacementMP : MaximumProperty corr.replacementETT := + MaximumPropertyTransport G k e0 lower rho3 hmod C corr hLowerMP + have hCElementary : + ColoredVertexSetElementary G rho3 (TreeSequenceVertexSet C) := + hLowerI C corr hreplacementMP + have hstableAtSlot : StableColoring + (ett.series.data.tree jSlot.castSucc.castSucc) + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho3 := by + rw [hTjm1Stored, hDprevStored, hPhiJStored] + exact hstableLower + have hbound := @helper_hbound_937 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett lowerInput lowerTree lowerGenerating lower jSlot hjPositive Tjm1 Tj seed + TjPrime rho3 zPosition uPosition hTjm1Stored hTjStored hLowerRounds hMP hrhoProper hrhoOne + hseedBuildRho C hrouteSeedC hclosedC hstableAtSlot + have hseedC : TreeSequenceInitialSegment seed C := + TashkinovAugmentationSequenceInitialSegment rho3 seed C hrouteSeedC + have hterminalSeed : terminalSupport ∈ TreeSequenceVertexSet seed := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.last seed.length, hseedTerminal⟩ + have hterminalC : terminalSupport ∈ TreeSequenceVertexSet C := + TreeSequenceInitialSegmentVertexSetSubset hseedC hterminalSeed + have hZC : TreeSequenceVertexSet Z ⊆ TreeSequenceVertexSet C := by + intro v hvZ + have hvM : v ∈ TreeSequenceVertexSet M := by + rw [hunion.vertexSet] + exact Finset.mem_union_right _ hvZ + exact TreeSequenceInitialSegmentVertexSetSubset hMCsegment hvM + have hzZ : z ∈ TreeSequenceVertexSet Z := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨Fin.last Z.length, ?_⟩ + change Tj.vertex (Fin.castLE (Nat.succ_le_succ hzPositionBound) + (Fin.last zPosition.val)) = z + have hindex : Fin.castLE (Nat.succ_le_succ hzPositionBound) + (Fin.last zPosition.val) = zPosition := by + apply Fin.ext + rfl + rw [hindex] + exact hzPosition + have hzC : z ∈ TreeSequenceVertexSet C := hZC hzZ + rcases hzChoice with hzLast | hzEarlier + · exact @helper_branch_1101 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett lowerInput lowerTree lowerGenerating lower jSlot Tjm1 Tj seed TjPrime u + zPosition uPosition huOutsideTj hzPositionPositive hzPositionBound hZTj C huC hbound hZC + hzLast + · have hdeltaZ : deltaN ∈ MissingColors G rho3 z := + hd2Delta hzEarlier.2 + have hdeltaTerminal : + deltaN ∈ MissingColors G rho3 terminalSupport := by + rw [hterminalMissingEq] + exact hdeltaRho1 + have hdisjoint := hCElementary hterminalC hzC hterminalNeZ + exact (Finset.disjoint_left.mp hdisjoint) hdeltaTerminal hdeltaZ + +private theorem helper_continuation_1295.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) {lowerInput : PartialEdgeColoring E k} + {lowerTree : TreeSequence G e0} {lowerGenerating : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 lowerInput lowerTree lowerGenerating) (jSlot : Fin + ett.rounds) (_ : (1 : ℕ) ≤ (↑jSlot : ℕ)) (Tjm1 Tj seed TjPrime : TreeSequence G e0) (phiJ + rho1 rho3 : PartialEdgeColoring E k) (Dprev : Finset (Fin k)) (terminalSupport u z : V) + (beta gammaFirst deltaN : Fin k) (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet + Tj) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (hzTj : z ∈ TreeSequenceVertexSet Tj) + (zPosition : Fin (Tj.length + (1 : ℕ))) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : + Tj.vertex zPosition = z) (_ : TjPrime.vertex uPosition = u) (_ : seed.vertex (Fin.last + seed.length) = terminalSupport) (_ : terminalSupport ∈ TreeVerticesBefore Tj z hzTj) (_ : + u ∉ TreeSequenceVertexSet Tj) (_ : ett.series.data.tree jSlot.castSucc.castSucc = Tjm1) (_ + : ett.series.data.coloring jSlot.castSucc = phiJ) (_ : ett.series.data.tree + jSlot.succ.castSucc = Tj) (_ : TashkinovStoredColors ett.series.data jSlot.castSucc = + Dprev) (_ : lower.rounds = (↑jSlot : ℕ)) (_ : lower.series.data.tree (Fin.last + lower.rounds).castSucc = Tjm1) (_ : lower.series.data.kind (Fin.last lower.rounds) = + ett.series.data.kind jSlot.castSucc) (_ : lower.series.data.connectingEdges (Fin.last + lower.rounds) = ett.series.data.connectingEdges jSlot.castSucc) (_ : TreeSequenceVertexSet + Tjm1 ⊆ TreeVerticesBefore Tj terminalSupport hterminalTj) (_ : + TashkinovAugmentationSequence phiJ seed Tj) (_ : TashkinovClosure rho1 seed TjPrime) (_ : + MaximumProperty ett) (_ : MaximumProperty lower) (_ : ( + ∀ (Tstar : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 lower rho3 + Tstar) (_ : MaximumProperty corr.replacementETT), ColoredVertexSetElementary G rho3 + (TreeSequenceVertexSet Tstar))) (_ : ( + ∀ v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport, MissingColors G rho1 v = MissingColors + G phiJ v)) (_ : ( + ∀ (a : Fin Tj.length), rho1 (Tj.edge a) = phiJ (Tj.edge a))) (_ : MissingColors G phiJ + terminalSupport ⊆ MissingColors G rho1 terminalSupport ∪ { gammaFirst }) (_ : deltaN ∈ + MissingColors G rho1 terminalSupport) (_ : IsProperEdgeColoring G rho3) (_ : + IsOneEdgeUncolored rho3 e0) (_ : ( + ∀ v ∈ ((TreeVerticesBefore Tj z hzTj ∪ { z } ∪ (TreeVerticesBefore TjPrime u huPrime ∪ + { u })).erase u).erase z, MissingColors G rho3 v = MissingColors G rho1 v)) (_ : ( + ∀ (f : E) (_ : (( + ∃ (a : Fin Tj.length), (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ + ∃ (a : Fin TjPrime.length), (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 + f)) (_ : ( + ∀ (_ : beta ∈ MissingColors G rho1 z), deltaN ∈ MissingColors G rho3 z)) (_ : ( + ∀ (_ : z ∈ TreeVerticesBefore TjPrime u huPrime), MissingColors G rho3 z = MissingColors G + rho1 z)) (_ : gammaFirst ∈ MissingColors G rho3 u) (_ : zPosition = Fin.last Tj.length ∨ + (↑zPosition : ℕ) < (↑(Fin.last Tj.length) : ℕ) ∧ beta ∈ MissingColors G rho1 z) (_ : + StableColoring Tjm1 Dprev phiJ rho3) (_ : ModColoring lower rho3) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : + (ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho3 Tjm1 seed ∨ (ett.series.data.kind jSlot.castSucc = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind jSlot.castSucc = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges jSlot.castSucc = + { f } ∧ TreeSequenceAdjoinEdge Tjm1 f adjoinSeed ∧ TashkinovAugmentationSequence rho3 + adjoinSeed seed)) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : + (↑uPosition : ℕ) ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition : ℕ)) + (hzPositionBound : (↑zPosition : ℕ) ≤ Tj.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive + hzPositionBound; + ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : TreeSequenceInitialSegment Z Tj) (_ : + TreeSequenceInitialSegment seed U) (_ : TreeSequenceInitialSegment seed Z), False := by + classical + intro V E _ _ _ _ G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower + jSlot hjPositive Tjm1 Tj seed TjPrime phiJ rho1 rho3 Dprev terminalSupport u z beta + gammaFirst deltaN hterminalTj huPrime hzTj zPosition uPosition hzPosition huPosition + hseedTerminal hterminalBeforeZ huOutsideTj hTjm1Stored hPhiJStored hTjStored hDprevStored + hLowerRounds hLowerTree hLowerKind hLowerConnecting hTjm1Before hTjAugmentation + hprimeClosure hMP hLowerMP hLowerI hb2Missing hb2Edges huniquezang hdeltaRho1 hrhoProper + hrhoOne hd2Missing hd2Edges hd2Delta hd2Z hd3 hzChoice hstableLower hmod segmentTrans + hseedBuildRho huPositionPositive huPositionBound hzPositionPositive hzPositionBound U Z + hUPrime hZTj hseedU hseedZ + have hrouteRhoOneU : TashkinovAugmentationSequence rho1 seed U := + TashkinovAugmentationSequenceRestrict rho1 seed U TjPrime + hprimeClosure.1 hseedU hUPrime + have hprimeVertexBefore (i : Fin (TjPrime.length + 1)) + (hi : i.val < uPosition.val) : + TjPrime.vertex i ∈ TreeVerticesBefore TjPrime u huPrime := by + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + constructor + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨i, rfl⟩ + · unfold TreeVertexOrder + exact ⟨i, uPosition, rfl, huPosition, hi⟩ + have hUsegmentVertexBefore := @helper_hUsegmentVertexBefore_1004 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot + Tj seed TjPrime u huPrime zPosition uPosition huPositionPositive huPositionBound hUPrime + hprimeVertexBefore + have hbeforePrimeNeU {w : V} + (hw : w ∈ TreeVerticesBefore TjPrime u huPrime) : w ≠ u := by + unfold TreeVerticesBefore at hw + obtain ⟨-, i, j, hiw, hju, hij⟩ := Finset.mem_filter.mp hw + intro hwu + have hijEq : i = j := TjPrime.vertex_injective + (hiw.trans (hwu.trans hju.symm)) + omega + have hbeforePrimeMissing (w : V) + (hw : w ∈ TreeVerticesBefore TjPrime u huPrime) : + MissingColors G rho3 w = MissingColors G rho1 w := by + by_cases hwz : w = z + · subst w + exact hd2Z hw + · apply hd2Missing w + apply Finset.mem_erase.mpr + refine ⟨hwz, Finset.mem_erase.mpr ⟨hbeforePrimeNeU hw, ?_⟩⟩ + apply Finset.mem_union_right + exact Finset.mem_union_left _ hw + have transportUStep := @helper_transportUStep_875 V E inferInstance inferInstance inferInstance G + k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot Tj seed TjPrime + rho1 rho3 u huPrime zPosition uPosition hd2Edges segmentTrans huPositionPositive + huPositionBound hUPrime hUsegmentVertexBefore hbeforePrimeMissing + have transportURoute (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence rho1 S U) : + TashkinovAugmentationSequence rho3 S U := by + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBU ih => + have hBsegment : TreeSequenceInitialSegment B U := + TashkinovAugmentationSequenceInitialSegment rho1 B U hBU + exact Relation.ReflTransGen.head (transportUStep hAB hBsegment) ih + have hrouteRhoThreeU : TashkinovAugmentationSequence rho3 seed U := + transportURoute seed hrouteRhoOneU + have hterminalNeZ : terminalSupport ≠ z := by + unfold TreeVerticesBefore at hterminalBeforeZ + obtain ⟨-, i, j, hit, hjz, hij⟩ := + Finset.mem_filter.mp hterminalBeforeZ + intro htz + have hijEq : i = j := Tj.vertex_injective + (hit.trans (htz.trans hjz.symm)) + omega + have hterminalNeU : terminalSupport ≠ u := by + intro htu + apply huOutsideTj + rw [← htu] + exact hterminalTj + have hterminalMissingEq : + MissingColors G rho3 terminalSupport = + MissingColors G rho1 terminalSupport := by + apply hd2Missing terminalSupport + apply Finset.mem_erase.mpr + refine ⟨hterminalNeZ, Finset.mem_erase.mpr ⟨hterminalNeU, ?_⟩⟩ + apply Finset.mem_union_left + exact Finset.mem_union_left _ hterminalBeforeZ + have hterminalInclusion : MissingColors G phiJ terminalSupport ⊆ + MissingColors G rho3 terminalSupport ∪ MissingColors G rho3 u := by + intro c hc + have hcCases := huniquezang hc + rcases Finset.mem_union.mp hcCases with hcTerminal | hcGamma + · apply Finset.mem_union_left + rw [hterminalMissingEq] + exact hcTerminal + · apply Finset.mem_union_right + have hcgamma : c = gammaFirst := Finset.mem_singleton.mp hcGamma + simpa [hcgamma] using hd3 + have hbeforeZData {v : V} + (hv : v ∈ TreeVerticesBefore Tj z hzTj) : + v ∈ TreeSequenceVertexSet Tj ∧ v ≠ z := by + unfold TreeVerticesBefore at hv + obtain ⟨hvTj, i, j, hiv, hjz, hij⟩ := Finset.mem_filter.mp hv + refine ⟨hvTj, ?_⟩ + intro hvz + have hijEq : i = j := Tj.vertex_injective + (hiv.trans (hvz.trans hjz.symm)) + omega + exact @helper_continuation_1296 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot hjPositive Tjm1 + Tj seed TjPrime phiJ rho1 rho3 Dprev terminalSupport u z beta deltaN hterminalTj huPrime + hzTj zPosition uPosition hzPosition huPosition hseedTerminal huOutsideTj hTjm1Stored + hPhiJStored hTjStored hDprevStored hLowerRounds hLowerTree hLowerKind hLowerConnecting + hTjm1Before hTjAugmentation hMP hLowerMP hLowerI hb2Missing hb2Edges hdeltaRho1 hrhoProper + hrhoOne hd2Missing hd2Edges hd2Delta hzChoice hstableLower hmod segmentTrans hseedBuildRho + huPositionPositive huPositionBound hzPositionPositive hzPositionBound hZTj hseedU hseedZ + hrouteRhoThreeU hterminalNeZ hterminalMissingEq hterminalInclusion hbeforeZData +theorem ExtensionBaseCaseTwoContradiction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + {lowerInput : PartialEdgeColoring E k} + {lowerTree : TreeSequence G e0} + {lowerGenerating : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 lowerInput lowerTree + lowerGenerating) + (jSlot : Fin ett.rounds) (hjPositive : 1 ≤ jSlot.val) + (Tjm1 Tj seed TjPrime : TreeSequence G e0) + (phiJ rho1 rho3 : PartialEdgeColoring E k) + (Dprev : Finset (Fin k)) + (terminalSupport u z : V) (beta gammaFirst deltaN : Fin k) + (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet Tj) + (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (hzTj : z ∈ TreeSequenceVertexSet Tj) + (zPosition : Fin (Tj.length + 1)) + (uPosition : Fin (TjPrime.length + 1)) + (hzPosition : Tj.vertex zPosition = z) + (huPosition : TjPrime.vertex uPosition = u) + (hseedJ : TreeSequenceInitialSegment seed Tj) + (hseedPrime : TreeSequenceInitialSegment seed TjPrime) + (hseedTerminal : seed.vertex (Fin.last seed.length) = terminalSupport) + (hseedAtMostZ : seed.length ≤ zPosition.val) + (hseedBeforeU : seed.length < uPosition.val) + (hterminalBeforeZ : terminalSupport ∈ TreeVerticesBefore Tj z hzTj) + (huOutsideTj : u ∉ TreeSequenceVertexSet Tj) + (hTjm1Stored : + ett.series.data.tree jSlot.castSucc.castSucc = Tjm1) + (hPhiJStored : ett.series.data.coloring jSlot.castSucc = phiJ) + (hTjStored : ett.series.data.tree jSlot.succ.castSucc = Tj) + (hDprevStored : + TashkinovStoredColors ett.series.data jSlot.castSucc = Dprev) + (hLowerRounds : lower.rounds = jSlot.val) + (hLowerTree : lower.series.data.tree + (Fin.last lower.rounds).castSucc = Tjm1) + (_ : lower.series.data.coloring + (Fin.last lower.rounds) = phiJ) + (_ : TashkinovStoredColors lower.series.data + (Fin.last lower.rounds) = Dprev) + (hLowerKind : lower.series.data.kind (Fin.last lower.rounds) = + ett.series.data.kind jSlot.castSucc) + (hLowerConnecting : lower.series.data.connectingEdges + (Fin.last lower.rounds) = + ett.series.data.connectingEdges jSlot.castSucc) + (hTjm1Before : TreeSequenceVertexSet Tjm1 ⊆ + TreeVerticesBefore Tj terminalSupport hterminalTj) + (hseedBuild : + (ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phiJ Tjm1 seed) ∨ + ((ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + ett.series.data.connectingEdges jSlot.castSucc = {f} ∧ + TreeSequenceAdjoinEdge Tjm1 f adjoinSeed ∧ + TashkinovAugmentationSequence phiJ adjoinSeed seed)) + (hTjAugmentation : TashkinovAugmentationSequence phiJ seed Tj) + (hprimeClosure : TashkinovClosure rho1 seed TjPrime) + (_ : ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime)) + (hMP : MaximumProperty ett) + (hLowerMP : MaximumProperty lower) + (hLowerI : ∀ (Tstar : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 lower rho3 Tstar), + MaximumProperty corr.replacementETT → + ColoredVertexSetElementary G rho3 + (TreeSequenceVertexSet Tstar)) + (hLowerVI : ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring Tjm1 Dprev phiJ sigma → ModColoring lower sigma) + (hb2Missing : ∀ v : V, + v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport → + MissingColors G rho1 v = MissingColors G phiJ v) + (hb2Edges : ∀ a : Fin Tj.length, + rho1 (Tj.edge a) = phiJ (Tj.edge a)) + (huniquezang : MissingColors G phiJ terminalSupport ⊆ + MissingColors G rho1 terminalSupport ∪ {gammaFirst}) + (hdeltaRho1 : deltaN ∈ MissingColors G rho1 terminalSupport) + (_ : beta ∈ MissingColors G rho1 u) + (hrhoProper : IsProperEdgeColoring G rho3) + (hrhoOne : IsOneEdgeUncolored rho3 e0) + (hd1 : StableColoringBeforeVertex Tj terminalSupport hterminalTj + Dprev phiJ rho3) + (hd2Missing : ∀ v : V, + v ∈ (((TreeVerticesBefore Tj z hzTj ∪ {z}) ∪ + (TreeVerticesBefore TjPrime u huPrime ∪ {u})).erase u).erase z → + MissingColors G rho3 v = MissingColors G rho1 v) + (hd2Edges : ∀ f : E, + ((∃ a : Fin Tj.length, a.val < zPosition.val ∧ Tj.edge a = f) ∨ + (∃ a : Fin TjPrime.length, + a.val < uPosition.val ∧ TjPrime.edge a = f)) → + rho3 f = rho1 f) + (hd2Delta : beta ∈ MissingColors G rho1 z → + deltaN ∈ MissingColors G rho3 z) + (hd2Z : z ∈ TreeVerticesBefore TjPrime u huPrime → + MissingColors G rho3 z = MissingColors G rho1 z) + (hd3 : gammaFirst ∈ MissingColors G rho3 u) + (hzChoice : zPosition = Fin.last Tj.length ∨ + (zPosition.val < (Fin.last Tj.length).val ∧ + beta ∈ MissingColors G rho1 z)) : False := by + classical + have hstableLower := @helper_hstableLower_821 V E inferInstance inferInstance G k e0 Tjm1 Tj phiJ + rho3 Dprev terminalSupport hterminalTj hTjm1Before hd1 + have hmod : ModColoring lower rho3 := + hLowerVI rho3 hrhoProper hrhoOne hstableLower + have segmentTrans := @helper_segmentTrans_842 V E G e0 + have commonPrefix := @helper_commonPrefix_864 V E G e0 + have hseedVertexBefore := @helper_hseedVertexBefore_888 V E inferInstance G e0 Tj seed + terminalSupport hterminalTj hseedJ hseedTerminal + have hsegmentVertexBefore {A : TreeSequence G e0} + (hAseed : TreeSequenceInitialSegment A seed) + (hAlen : A.length < seed.length) {v : V} + (hvA : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeVerticesBefore Tj terminalSupport hterminalTj := by + obtain ⟨hAseedLen, hAseedVertices, -⟩ := hAseed + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hvA + obtain ⟨i, rfl⟩ := hvA + have hi : (Fin.castLE (Nat.succ_le_succ hAseedLen) i).val < + seed.length := by + change i.val < seed.length + omega + rw [← hAseedVertices i] + exact hseedVertexBefore _ hi + have transportStep := @helper_transportStep_250 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot Tj seed TjPrime + phiJ rho3 Dprev terminalSupport hterminalTj zPosition uPosition hd1 segmentTrans + hsegmentVertexBefore + have transportSeedRoute (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence phiJ S seed) : + TashkinovAugmentationSequence rho3 S seed := by + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBseed ih => + have hBsegment : TreeSequenceInitialSegment B seed := + TashkinovAugmentationSequenceInitialSegment phiJ B seed hBseed + exact Relation.ReflTransGen.head (transportStep hAB hBsegment) ih + have hseedBuildRho : + (ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho3 Tjm1 seed) ∨ + ((ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + ett.series.data.connectingEdges jSlot.castSucc = {f} ∧ + TreeSequenceAdjoinEdge Tjm1 f adjoinSeed ∧ + TashkinovAugmentationSequence rho3 adjoinSeed seed) := by + rcases hseedBuild with hparallel | hserial + · exact Or.inl ⟨hparallel.1, transportSeedRoute Tjm1 hparallel.2⟩ + · rcases hserial with ⟨hkind, f, adjoinSeed, hconnecting, + hadjoin, hroute⟩ + exact Or.inr ⟨hkind, f, adjoinSeed, hconnecting, hadjoin, + transportSeedRoute adjoinSeed hroute⟩ + have huPositionPositive : 1 ≤ uPosition.val := by omega + have huPositionBound : uPosition.val ≤ TjPrime.length := + Nat.lt_succ_iff.mp uPosition.isLt + have hzPositionPositive : 1 ≤ zPosition.val := + seed.positive.trans hseedAtMostZ + have hzPositionBound : zPosition.val ≤ Tj.length := + Nat.lt_succ_iff.mp zPosition.isLt + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime uPosition.val huPositionPositive huPositionBound + let Z : TreeSequence G e0 := + TreeSequencePrefix Tj zPosition.val hzPositionPositive hzPositionBound + have hUPrime : TreeSequenceInitialSegment U TjPrime := by + refine ⟨?_, ?_, ?_⟩ + · change uPosition.val ≤ TjPrime.length + exact huPositionBound + · intro i + simp [U, TreeSequencePrefix] + · intro i + simp [U, TreeSequencePrefix] + have hZTj : TreeSequenceInitialSegment Z Tj := by + refine ⟨?_, ?_, ?_⟩ + · change zPosition.val ≤ Tj.length + exact hzPositionBound + · intro i + simp [Z, TreeSequencePrefix] + · intro i + simp [Z, TreeSequencePrefix] + have hseedU : TreeSequenceInitialSegment seed U := by + apply commonPrefix hseedPrime hUPrime + change seed.length ≤ uPosition.val + omega + have hseedZ : TreeSequenceInitialSegment seed Z := by + apply commonPrefix hseedJ hZTj + change seed.length ≤ zPosition.val + exact hseedAtMostZ + exact @helper_continuation_1295 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot hjPositive Tjm1 + Tj seed TjPrime phiJ rho1 rho3 Dprev terminalSupport u z beta gammaFirst deltaN hterminalTj + huPrime hzTj zPosition uPosition hzPosition huPosition hseedTerminal hterminalBeforeZ + huOutsideTj hTjm1Stored hPhiJStored hTjStored hDprevStored hLowerRounds hLowerTree + hLowerKind hLowerConnecting hTjm1Before hTjAugmentation hprimeClosure hMP hLowerMP hLowerI + hb2Missing hb2Edges huniquezang hdeltaRho1 hrhoProper hrhoOne hd2Missing hd2Edges hd2Delta + hd2Z hd3 hzChoice hstableLower hmod segmentTrans hseedBuildRho huPositionPositive + huPositionBound hzPositionPositive hzPositionBound hUPrime hZTj hseedU hseedZ +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation19.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation19.lean new file mode 100644 index 0000000000..ee1b03da4d --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation19.lean @@ -0,0 +1,163 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovClosure + +/-! +# Extension Base Case Two Observation19 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseCaseTwoObservation19 {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (rho1 : PartialEdgeColoring E k) (seed TjPrime : TreeSequence G e0) + (terminalSupport : V) (supportColors : Finset (Fin k)) + (deltaN : Fin k) + (hclosure : TashkinovClosure rho1 seed TjPrime) + (hterminal : terminalSupport ∈ TreeSequenceVertexSet TjPrime) + (hcaseTwo : ∀ v : V, + v ∈ (TreeSequenceVertexSet TjPrime).erase terminalSupport → + MissingColors G rho1 v ∩ supportColors = ∅) + (hterminalColors : + MissingColors G rho1 terminalSupport ∩ supportColors = {deltaN}) : + TreeMissingColors rho1 TjPrime ∩ supportColors = {deltaN} ∧ + ∀ a : Fin TjPrime.length, seed.length ≤ a.val → + ∀ c : Fin k, c ∈ supportColors \ {deltaN} → + rho1 (TjPrime.edge a) ≠ some c := by + classical + rcases hclosure with ⟨hseq, hclosed⟩ + have initial_subset : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hinit v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + obtain ⟨i, hi, hvi⟩ := hv + obtain ⟨hlen, hvertices, hedges⟩ := hinit + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, ?_⟩ + exact (hvertices i).trans hvi + have missing_subset : ∀ {A B : TreeSequence G e0}, + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B → + TreeMissingColors rho1 A ⊆ TreeMissingColors rho1 B := by + intro A B hab c hc + unfold TreeMissingColors at hc ⊢ + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + apply Finset.mem_biUnion.mpr + exact ⟨v, hab hv, hvc⟩ + have tree_subset : ∀ {A : TreeSequence G e0}, + TashkinovAugmentationSequence rho1 seed A → + TreeSequenceVertexSet seed ⊆ TreeSequenceVertexSet A := by + intro A hA + unfold TashkinovAugmentationSequence at hA + induction hA with + | refl => exact Finset.Subset.rfl + | tail hreach hstep ih => + exact ih.trans (initial_subset hstep.2.1) + have set_result : TreeMissingColors rho1 TjPrime ∩ supportColors = + {deltaN} := by + apply Finset.ext + intro c + constructor + · intro hc + have hcm : c ∈ TreeMissingColors rho1 TjPrime := (Finset.mem_inter.mp hc).1 + have hcs : c ∈ supportColors := (Finset.mem_inter.mp hc).2 + unfold TreeMissingColors at hcm + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hcm + by_cases hvt : v = terminalSupport + · subst v + have hboth : c ∈ MissingColors G rho1 terminalSupport ∩ supportColors := + Finset.mem_inter.mpr ⟨hvm, hcs⟩ + have hd : c ∈ ({deltaN} : Finset (Fin k)) := + hterminalColors ▸ hboth + simpa using hd + · have hver : v ∈ (TreeSequenceVertexSet TjPrime).erase terminalSupport := by + exact Finset.mem_erase.mpr ⟨hvt, hv⟩ + have hempty := hcaseTwo v hver + have hboth : c ∈ MissingColors G rho1 v ∩ supportColors := + Finset.mem_inter.mpr ⟨hvm, hcs⟩ + rw [hempty] at hboth + exact False.elim (by simp at hboth) + · intro hc + have hcd : c = deltaN := by simpa using hc + subst c + have hmiss : deltaN ∈ MissingColors G rho1 terminalSupport := by + have ht : deltaN ∈ MissingColors G rho1 terminalSupport ∩ supportColors := by + rw [hterminalColors] + simp + exact (Finset.mem_inter.mp ht).1 + have htm : deltaN ∈ TreeMissingColors rho1 TjPrime := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨terminalSupport, hterminal, hmiss⟩ + apply Finset.mem_inter.mpr + have ht : deltaN ∈ MissingColors G rho1 terminalSupport ∩ supportColors := by + rw [hterminalColors] + simp + exact ⟨htm, (Finset.mem_inter.mp ht).2⟩ + refine ⟨set_result, ?_⟩ + have edge_colors : + ∀ {A : TreeSequence G e0}, TashkinovAugmentationSequence rho1 seed A → + ∀ a : Fin A.length, seed.length ≤ a.val → + ∀ c : Fin k, rho1 (A.edge a) = some c → c ∈ TreeMissingColors rho1 A := by + intro A hA + unfold TashkinovAugmentationSequence at hA + induction hA with + | refl => + intro a ha c hcolor + omega + | tail hreach hstep ih => + rename_i mid last + obtain ⟨hlen, hinit, d, hcolor, hmissing⟩ := hstep + intro a ha c hedge + by_cases hnew : a.val = mid.length + · have hlast : a = Fin.cast hlen.symm (Fin.last mid.length) := by + apply Fin.ext + simp [Fin.last] + omega + rw [hlast] at hedge + have hdc : c = d := by + simpa [hcolor] using hedge.symm + subst c + apply missing_subset (initial_subset hinit) + exact hmissing + · have hold : a.val < mid.length := by + have hbound : a.val < mid.length + 1 := by + rw [← hlen] + exact a.isLt + omega + let j : Fin mid.length := ⟨a.val, hold⟩ + have hja : Fin.castLE hinit.1 j = a := by + apply Fin.ext + rfl + have hmid : seed.length ≤ j.val := by + exact ha + have hmidcolor : rho1 (mid.edge j) = some c := by + rw [← hinit.2.2 j] + rw [hja] + exact hedge + exact missing_subset (initial_subset hinit) (ih j hmid c hmidcolor) + intro a ha c hc heq + have hcm : c ∈ TreeMissingColors rho1 TjPrime := by + apply edge_colors hseq a ha c + exact heq + have hnot : c ∉ ({deltaN} : Finset (Fin k)) := by + simpa using (Finset.mem_sdiff.mp hc).2 + have hcs : c ∈ supportColors := (Finset.mem_sdiff.mp hc).1 + have hcsingle : c ∈ TreeMissingColors rho1 TjPrime ∩ supportColors := + Finset.mem_inter.mpr ⟨hcm, hcs⟩ + have hcd : c ∈ ({deltaN} : Finset (Fin k)) := + set_result ▸ hcsingle + exact hnot hcd + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation20.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation20.lean new file mode 100644 index 0000000000..11f314744d --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation20.lean @@ -0,0 +1,210 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges + +public import LeanPool.GoldbergSeymour.TashkinovClosure + +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Extension Base Case Two Observation20 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseCaseTwoObservation20 {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (Tn seed TjPrime : TreeSequence G e0) + (phiN sigmaN rho1 : PartialEdgeColoring E k) + (controlled restorationColors : Finset (Fin k)) + (gammaN deltaN : Fin k) (fN : E) (terminalSupport : V) + (hphiProper : IsProperEdgeColoring G phiN) + (hphiOne : IsOneEdgeUncolored phiN e0) + (hsigmaProper : IsProperEdgeColoring G sigmaN) + (hsigmaOne : IsOneEdgeUncolored sigmaN e0) + (_ : IsProperEdgeColoring G rho1) + (_ : IsOneEdgeUncolored rho1 e0) + (hsigmaStable : StableColoring Tn controlled phiN sigmaN) + (hgammaControlled : gammaN ∈ controlled) + (hdeltaControlled : deltaN ∈ controlled) + (hb3 : ∀ f : E, rho1 f ≠ sigmaN f → + ∃ c d : Fin k, sigmaN f = some c ∧ rho1 f = some d ∧ + c ∈ restorationColors ∧ d ∈ restorationColors) + (hgammaRestored : gammaN ∉ restorationColors) + (hdeltaRestored : deltaN ∉ restorationColors) + (hgammaBoundary : + BoundaryColorEdges G phiN (TreeSequenceVertexSet Tn) gammaN = {fN}) + (hdeltaLocation : ∀ f ∈ BoundaryColorEdges G phiN + (TreeSequenceVertexSet Tn) deltaN, + ∃ w ∈ TreeSequenceVertexSet seed, Incident G w f) + (_ : TreeSequenceInitialSegment seed Tn) + (_ : seed.vertex (Fin.last seed.length) = terminalSupport) + (hclosure : TashkinovClosure rho1 seed TjPrime) + (hterminalSeed : terminalSupport ∈ TreeSequenceVertexSet seed) + (hdeltaMissing : deltaN ∈ MissingColors G rho1 terminalSupport) : + BoundaryColorEdges G rho1 (TreeSequenceVertexSet Tn) gammaN = { fN } ∧ + BoundaryColorEdges G rho1 (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) + deltaN = + ∅ := by + classical + exact (by + classical + have hsigmaPhi : StableColoring Tn controlled sigmaN phiN := by + exact (sc2 G e0 Tn controlled).symm + (x := ⟨phiN, hphiProper, hphiOne⟩) + (y := ⟨sigmaN, hsigmaProper, hsigmaOne⟩) (by simpa using hsigmaStable) + have boundary_transport : ∀ (a : Fin k), a ∈ controlled → + BoundaryColorEdges G phiN (TreeSequenceVertexSet Tn) a = + BoundaryColorEdges G sigmaN (TreeSequenceVertexSet Tn) a := by + intro a ha + apply Finset.ext + intro f + constructor + · intro hf + have hb : f ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) := + (Finset.mem_filter.mp hf).1 + have hc : phiN f = some a := (Finset.mem_filter.mp hf).2 + have ht : TreeIncidentEdge Tn f := by + unfold TreeIncidentEdge + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hb + rcases hb with ⟨u, hu, v, hv, he⟩ + have huend : u ∈ G.ends f := he ▸ Sym2.mem_iff.mpr (Or.inl rfl) + exact ⟨u, hu, huend⟩ + have heq := hsigmaStable.1 f ht + have hcontrol : ∃ c ∈ TreeMissingColors phiN Tn ∪ controlled, + phiN f = some c := ⟨a, Finset.mem_union.mpr (Or.inr ha), hc⟩ + have hfix := heq hcontrol + exact Finset.mem_filter.mpr ⟨hb, hfix.symm ▸ hc⟩ + · intro hf + have hb : f ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) := + (Finset.mem_filter.mp hf).1 + have hc : sigmaN f = some a := (Finset.mem_filter.mp hf).2 + have ht : TreeIncidentEdge Tn f := by + unfold TreeIncidentEdge + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hb + rcases hb with ⟨u, hu, v, hv, he⟩ + have huend : u ∈ G.ends f := he ▸ Sym2.mem_iff.mpr (Or.inl rfl) + exact ⟨u, hu, huend⟩ + have heq := hsigmaPhi.1 f ht + have hcontrol : ∃ c ∈ TreeMissingColors sigmaN Tn ∪ controlled, + sigmaN f = some c := ⟨a, Finset.mem_union.mpr (Or.inr ha), hc⟩ + have hfix := heq hcontrol + exact Finset.mem_filter.mpr ⟨hb, hfix ▸ hc⟩ + have rho_transport : ∀ (a : Fin k), a ∉ restorationColors → + BoundaryColorEdges G sigmaN (TreeSequenceVertexSet Tn) a = + BoundaryColorEdges G rho1 (TreeSequenceVertexSet Tn) a := by + intro a ha + apply Finset.ext + intro f + constructor <;> intro hf + · have hc : sigmaN f = some a := (Finset.mem_filter.mp hf).2 + by_cases heq : rho1 f = sigmaN f + · exact Finset.mem_filter.mpr ⟨(Finset.mem_filter.mp hf).1, heq ▸ hc⟩ + · rcases hb3 f heq with ⟨c, d, hsc, hrd, hcr, hdr⟩ + have : a ∈ restorationColors := by + have hca : c = a := Option.some.inj (hsc.symm.trans hc) + simpa [hca] using hcr + exact (ha this).elim + · have hc : rho1 f = some a := (Finset.mem_filter.mp hf).2 + by_cases heq : rho1 f = sigmaN f + · exact Finset.mem_filter.mpr ⟨(Finset.mem_filter.mp hf).1, heq.symm ▸ hc⟩ + · rcases hb3 f heq with ⟨c, d, hsc, hrd, hcr, hdr⟩ + have : a ∈ restorationColors := by + have hda : d = a := Option.some.inj (hrd.symm.trans hc) + simpa [hda] using hdr + exact (ha this).elim + have first : BoundaryColorEdges G rho1 (TreeSequenceVertexSet Tn) gammaN = {fN} := by + rw [← rho_transport gammaN hgammaRestored, ← boundary_transport gammaN hgammaControlled] + exact hgammaBoundary + refine ⟨first, ?_⟩ + have initial_subset {A B : TreeSequence G e0} + (h : TreeSequenceInitialSegment A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + obtain ⟨i, hi, hvi⟩ := hv + obtain ⟨hlen, hvertices, hedges⟩ := h + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, + (hvertices i).trans hvi⟩ + have seed_prime : TreeSequenceVertexSet seed ⊆ + TreeSequenceVertexSet TjPrime := by + rcases hclosure with ⟨hseq, hclosed⟩ + unfold TashkinovAugmentationSequence at hseq + clear * - hseq initial_subset + induction hseq using Relation.ReflTransGen.head_induction_on with + | refl => exact Finset.Subset.rfl + | head hstep htail ih => + exact (initial_subset hstep.2.1).trans ih + rcases hclosure with ⟨hseq, hclosed⟩ + rw [← Finset.not_nonempty_iff_eq_empty] + intro hnonempty + rcases hnonempty with ⟨f, hf⟩ + have hbU : f ∈ BoundaryEdges G + (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) := + (Finset.mem_filter.mp hf).1 + have hcf : rho1 f = some deltaN := (Finset.mem_filter.mp hf).2 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hbU + rcases hbU with ⟨u, hu, v, hv, huv⟩ + have boundary_prime : f ∈ BoundaryEdges G (TreeSequenceVertexSet TjPrime) := by + by_cases huprime : u ∈ TreeSequenceVertexSet TjPrime + · simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, huprime, v, by + intro hvprime + exact hv (Finset.mem_union.mpr (Or.inr hvprime)), huv⟩ + · have hutn : u ∈ TreeSequenceVertexSet Tn := + (Finset.mem_union.mp hu).resolve_right huprime + have hbt : f ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, hutn, v, by + intro hvtn + exact hv (Finset.mem_union.mpr (Or.inl hvtn)), huv⟩ + have hbf : f ∈ BoundaryColorEdges G phiN + (TreeSequenceVertexSet Tn) deltaN := by + have hsig : sigmaN f = some deltaN := by + by_cases hsame : rho1 f = sigmaN f + · exact hsame ▸ hcf + · rcases hb3 f hsame with ⟨c, d, hsc, hrd, hcr, hdr⟩ + have hda : d = deltaN := Option.some.inj (hrd.symm.trans hcf) + exact (hdeltaRestored (by simpa [hda] using hdr)).elim + have hsame : phiN f = sigmaN f := + (hsigmaPhi.1 f (by + unfold TreeIncidentEdge + have huend : u ∈ G.ends f := huv ▸ Sym2.mem_iff.mpr (Or.inl rfl) + exact ⟨u, hutn, huend⟩)) + ⟨deltaN, Finset.mem_union.mpr (Or.inr hdeltaControlled), hsig⟩ + exact Finset.mem_filter.mpr ⟨hbt, hsame ▸ hsig⟩ + obtain ⟨w, hw, hwf⟩ := hdeltaLocation f hbf + have hwprime : w ∈ TreeSequenceVertexSet TjPrime := seed_prime hw + have hwu : w = u := by + change w ∈ G.ends f at hwf + have hmem : w = u ∨ w = v := by + rw [huv] at hwf + exact Sym2.mem_iff.mp hwf + rcases hmem with hmem | hmem + · exact hmem + · have hwunion : w ∈ TreeSequenceVertexSet Tn ∪ + TreeSequenceVertexSet TjPrime := Finset.mem_union.mpr (Or.inr hwprime) + exact False.elim (hv (hmem ▸ hwunion)) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwu ▸ hwprime, v, by + intro hvprime + exact hv (Finset.mem_union.mpr (Or.inr hvprime)), hwu ▸ huv⟩ + have htermPrime : terminalSupport ∈ TreeSequenceVertexSet TjPrime := + seed_prime hterminalSeed + exact (hclosed boundary_prime htermPrime hcf) hdeltaMissing + ) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation21.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation21.lean new file mode 100644 index 0000000000..7f9fc80ef0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation21.lean @@ -0,0 +1,1020 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges + +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent + +/-! +# Extension Base Case Two Observation21 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hu_at_two_153.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} (rho1 : PartialEdgeColoring E k) + (gammaN deltaN : Fin k) (fN : E) (terminalSupport x : V) + (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)) + (_ : p.IsPath), + let _ : BEq (V ⊕ E) := instBEqOfDecidableEq; + ∀ (u : V) (_ : G.ends fN = s(terminalSupport, u)), + ∀ j < p.length, + ∀ (b : V), + p.getVert (j + (1 : ℕ)) = Sum.inl b → + b ∈ G.ends fN → + j = (1 : ℕ) → + p.getVert (2 : ℕ) = Sum.inl u := by + classical + intro V E _ _ G k rho1 gammaN deltaN fN terminalSupport x p hpath this u hfend j hjlt b hb hmb + hjone + have hjtwo : j + 1 = 2 := by omega + have hbu : b = u := by + have hm : b ∈ G.ends fN := hmb + have : b = terminalSupport ∨ b = u := by + rw [hfend] at hm + simpa only [Sym2.mem_iff] using hm + rcases this with h | h + · exfalso + have hi : 2 = 0 := by + apply hpath.getVert_injOn (by omega : 2 ≤ p.length) + (show 0 ≤ p.length from Nat.zero_le _) + have htwo : p.getVert 2 = Sum.inl terminalSupport := by + calc + p.getVert 2 = p.getVert (j + 1) := congrArg p.getVert hjtwo.symm + _ = Sum.inl b := hb + _ = Sum.inl terminalSupport := by rw [h] + exact htwo.trans p.getVert_zero.symm + omega + · exact h + calc + p.getVert 2 = p.getVert (j + 1) := congrArg p.getVert hjtwo.symm + _ = Sum.inl b := hb + _ = Sum.inl u := by rw [hbu] + +private theorem helper_hiwgt_181.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (fN : E) + (terminalSupport x : V) + (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)), + let _ : BEq (V ⊕ E) := instBEqOfDecidableEq; + ∀ u ∉ TreeSequenceVertexSet Tn, + ∀ w ∈ TreeSequenceVertexSet Tn, + w ≠ terminalSupport → + ∀ (j : ℕ), + p.getVert j = Sum.inr fN → + j = (1 : ℕ) → + p.getVert (2 : ℕ) = Sum.inl u → + ∀ (iw : ℕ), + p.getVert iw = Sum.inl w → + iw ≤ p.length → + p.getVert iw = Sum.inl w → + (2 : ℕ) < iw := by + classical + intro V E _ _ G k e0 Tn rho1 gammaN deltaN fN terminalSupport x p this u hu_not_Tn w hw hwu j + hjf hjone hu_at_two iw hiw hiwle hiwval + have hiwnzero : iw ≠ 0 := by + intro hz + have : w = terminalSupport := by + subst iw + exact Sum.inl.inj (hiwval.symm.trans p.getVert_zero) + exact hwu this + have hiwneone : iw ≠ 1 := by + intro hz + have : (Sum.inl w : Sum V E) = Sum.inr fN := by + subst iw + rw [hjone] at hjf + exact hiwval.symm.trans hjf + cases this + have hiwneu : iw ≠ 2 := by + intro hz + have : w = u := by + subst iw + exact Sum.inl.inj (hiwval.symm.trans hu_at_two) + exact hu_not_Tn (this ▸ hw) + omega + +private theorem helper_hw_suffix_217.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} (rho1 : PartialEdgeColoring E k) + (gammaN deltaN : Fin k) (terminalSupport x : V) + (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)) + (u : V), + let uSupport : V ⊕ E := Sum.inl u; + ∀ (huSupport : uSupport ∈ p.support), + let suffix : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk uSupport (Sum.inl x) := + p.dropUntil uSupport huSupport; + ∀ (w : V), + ∀ j < p.length, + j = (1 : ℕ) → + ∀ iw ≤ p.length, + p.getVert iw = Sum.inl w → + (2 : ℕ) < iw → + suffix.support = (p.drop (2 : ℕ)).support → + Sum.inl w ∈ suffix.support := by + classical + intro V E _ _ G k rho1 gammaN deltaN terminalSupport x p u uSupport huSupport suffix w j hjlt + hjone iw hiwle hiwval hiwgt hsuffix + rw [hsuffix] + have hdrop : (p.drop 2).support = p.support.drop 2 := by + simp [Nat.min_eq_left (by omega : 2 ≤ p.length)] + apply List.mem_iff_getElem.mpr + refine ⟨iw - 2, ?_, ?_⟩ + · have hp : iw - 2 < p.length + 1 - 2 := by omega + rw [hdrop] + simp only [List.length_drop, SimpleGraph.Walk.length_support] + omega + · have hvalid : iw - 2 < (p.support.drop 2).length := by + simp [List.length_drop, SimpleGraph.Walk.length_support]; omega + have helem : (p.support.drop 2)[iw - 2]'hvalid = Sum.inl w := by + simp only [List.getElem_drop] + have hsum : 2 + (iw - 2) = iw := by omega + have hiwlt : iw < p.support.length := by + simpa [SimpleGraph.Walk.length_support] using Nat.lt_succ_of_le hiwle + have hh := p.support_getElem_eq_getVert (n := iw) hiwlt + simpa [hsum] using hh.trans hiwval + simpa [hdrop] using helem + +private theorem helper_branch_352.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (fN : E) + (terminalSupport x : V) + (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)) + (_ : p.IsPath) + (_ : (∃ w ∈ TreeSequenceVertexSet Tn, w ≠ terminalSupport ∧ Sum.inl w ∈ p.support)) + (_ : Incident G terminalSupport fN), + let _ : BEq (V ⊕ E) := instBEqOfDecidableEq; + let vertexSet : Finset V := TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime; + ∀ (u : V), + let uSupport : V ⊕ E := Sum.inl u; + ∀ (huSupport : uSupport ∈ p.support), + let suffix : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk uSupport (Sum.inl x) := + p.dropUntil uSupport huSupport; + ∀ + (_ : + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support = + [uSupport]) + (_ : u ≠ terminalSupport) (_ : V) (_ : u ∉ TreeSequenceVertexSet Tn) + (_ : Sum.inr fN ∈ p.support), + ¬Incident G u fN := by + classical + intro V E _ _ G k e0 Tn TjPrime rho1 gammaN deltaN fN terminalSupport x p hpath htwoN + hfNterminal this vertexSet u uSupport huSupport suffix suffix_filter_singleton hu_terminal + v hu_not_Tn hf_support huf + obtain ⟨w, hw, hwu, hwm⟩ := htwoN + have hut : u ≠ terminalSupport := hu_terminal + have hfend : G.ends fN = s(terminalSupport, u) := by + have hend_of_mem : ∀ {z : Sym2 V} {a b : V}, a ∈ z → b ∈ z → a ≠ b → + z = s(a,b) := by + intro z a b ha hb hab + induction z using Sym2.inductionOn with + | _ c d => + simp only [Sym2.mem_iff] at ha hb + rcases ha with rfl | rfl <;> rcases hb with rfl | rfl <;> + simp_all [] + exact hend_of_mem hfNterminal huf hut.symm + obtain ⟨j, hj, hjle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf_support + have hjf : p.getVert j = Sum.inr fN := hj + have hjnotzero : j ≠ 0 := by + intro hz + have : (Sum.inl terminalSupport : Sum V E) = Sum.inr fN := by + simpa [hz] using hjf.symm + cases this + have hjlt : j < p.length := by + by_contra hn + have he : j = p.length := by omega + subst j + have : (Sum.inl x : Sum V E) = Sum.inr fN := by + simpa using hjf.symm + cases this + have hprev := p.adj_getVert_succ (i := j - 1) (by omega) + have hnext := p.adj_getVert_succ (i := j) hjlt + have hprev' : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Adj + (p.getVert (j - 1)) (Sum.inr fN) := by + rw [← hjf] + simpa [Nat.sub_add_cancel (Nat.one_le_iff_ne_zero.mpr hjnotzero)] using hprev + have hprev_vertex : ∃ a : V, p.getVert (j - 1) = Sum.inl a := by + cases hc : p.getVert (j - 1) with + | inl a => + exact ⟨a, rfl⟩ + | inr e => + have ha := hprev' + rw [hc] at ha + exact False.elim (by simp [TwoColorIncidenceGraph] at ha) + have hnext_vertex : ∃ b : V, p.getVert (j + 1) = Sum.inl b := by + have ha := hnext + rw [hjf] at ha + cases hc : p.getVert (j + 1) with + | inl a => + exact ⟨a, rfl⟩ + | inr e => + rw [hc] at ha + exact False.elim (by simp [TwoColorIncidenceGraph] at ha) + obtain ⟨a, ha⟩ := hprev_vertex + obtain ⟨b, hb⟩ := hnext_vertex + have hab : a ≠ b := by + intro he + have hi := hpath.getVert_injOn (by omega : j - 1 ≤ p.length) + (by omega : j + 1 ≤ p.length) + (by rw [ha, hb]; exact congrArg Sum.inl he) + omega + have hma : a ∈ G.ends fN := by + have hh := hprev' + rw [ha] at hh + simpa [Incident, TwoColorIncidenceGraph] using hh.1 + have hmb : b ∈ G.ends fN := by + have hh := hnext + rw [hjf, hb] at hh + simpa [Incident, TwoColorIncidenceGraph] using hh.1 + have edge_identity : ∀ {z : Sym2 V} {c d : V}, c ∈ z → d ∈ z → c ≠ d → + z = s(c,d) := by + intro z c d hc hd hcd + induction z using Sym2.inductionOn with + | _ r t => + simp only [Sym2.mem_iff] at hc hd + rcases hc with rfl | rfl <;> rcases hd with rfl | rfl <;> simp_all + have hfends : G.ends fN = s(a,b) := edge_identity hma hmb hab + have hterm_endpoint : terminalSupport ∈ s(a,b) := by + rw [← hfends] + exact hfNterminal + have hendpoint : a = terminalSupport ∨ b = terminalSupport := by + simp only [Sym2.mem_iff] at hterm_endpoint + rcases hterm_endpoint with h | h + · exact Or.inl h.symm + · exact Or.inr h.symm + have hterm_prev : p.getVert (j - 1) = Sum.inl terminalSupport := by + rcases hendpoint with h | h + · simp [ha, h] + · exfalso + have hi : j + 1 = 0 := by + apply hpath.getVert_injOn + (show j + 1 ≤ p.length from Nat.succ_le_of_lt hjlt) + (show 0 ≤ p.length from Nat.zero_le _) + simp [hb, h] + omega + have hjone : j = 1 := by + have hi : j - 1 = 0 := by + apply hpath.getVert_injOn (by omega : j - 1 ≤ p.length) + (show 0 ≤ p.length from Nat.zero_le _) + exact hterm_prev.trans p.getVert_zero.symm + have hjpos : 0 < j := Nat.pos_of_ne_zero hjnotzero + omega + have hu_at_two := + @helper_hu_at_two_153 V E inferInstance inferInstance G k rho1 gammaN deltaN fN + terminalSupport x p hpath u hfend j hjlt b hb hmb hjone + obtain ⟨iw, hiw, hiwle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp (by + exact hwm) + have hiwval : p.getVert iw = Sum.inl w := hiw + have hiwgt := + @helper_hiwgt_181 V E inferInstance inferInstance G k e0 Tn rho1 gammaN deltaN fN + terminalSupport x p u hu_not_Tn w hw hwu j hjf hjone hu_at_two iw hiw hiwle hiwval + have hidx : p.support.idxOf uSupport = 2 := by + apply hpath.getVert_injOn + (by + have hh := List.idxOf_lt_length_of_mem huSupport + simp only [SimpleGraph.Walk.length_support] at hh + exact Nat.le_of_lt_succ hh) + (by omega : 2 ≤ p.length) + calc + p.getVert (p.support.idxOf uSupport) = uSupport := + p.getVert_support_idxOf huSupport + _ = p.getVert 2 := by simpa [uSupport] using hu_at_two.symm + have hsuffix : suffix.support = (p.drop 2).support := by + change (p.dropUntil uSupport huSupport).support = (p.drop 2).support + rw [SimpleGraph.Walk.dropUntil_eq_drop] + simp [hidx] + have hw_suffix := + @helper_hw_suffix_217 V E inferInstance inferInstance G k rho1 gammaN deltaN + terminalSupport x p u huSupport w j hjlt hjone iw hiwle hiwval hiwgt hsuffix + have hwf : Sum.inl w ∈ suffix.support.filter (fun z : Sum V E => match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) := by + apply List.mem_filter.mpr + exact ⟨hw_suffix, by simp [vertexSet, hw]⟩ + rw [suffix_filter_singleton] at hwf + have : w = u := by simpa [uSupport] using hwf + exact hu_not_Tn (this ▸ hw) + +private theorem helper_suffix_filter_singleton_359.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (terminalSupport x : V) + (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)), + let vertexSet : Finset V := TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime; + ∀ (u : V), + let uSupport : V ⊕ E := Sum.inl u; + ∀ (huSupport : uSupport ∈ p.support) (_ : u ∈ vertexSet) + (_ : + (∀ (l : List (V ⊕ E)) (a : V ⊕ E) (_ : l.Nodup) (_ : l.head? = some a) + (_ : l.getLast? = some a), l = [a])), + let suffix : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk uSupport (Sum.inl x) := + p.dropUntil uSupport huSupport; + ∀ (_ : suffix.IsPath) + (suffix_eligible_nonempty : + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support ≠ + []) + (_ : + (List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support).getLast + suffix_eligible_nonempty = + uSupport), + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support = + [uSupport] := by + classical + intro V E _ _ G k e0 Tn TjPrime rho1 gammaN deltaN terminalSupport x p vertexSet u uSupport + huSupport huVertex singleton_of_head_last suffix suffix_path suffix_eligible_nonempty + suffix_filter_last + refine singleton_of_head_last + (suffix.support.filter (fun z : Sum V E => match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false)) uSupport ?_ ?_ ?_ + · exact (suffix_path.support_nodup).filter _ + · rw [← suffix.cons_tail_support] + rw [List.filter_cons] + simp [uSupport, huVertex] + · change (suffix.support.filter (fun z : Sum V E => match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false)).getLast? = some uSupport + cases hlist : suffix.support.filter (fun z : Sum V E => match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) with + | nil => exact False.elim (suffix_eligible_nonempty hlist) + | cons a t => + have hlast := suffix_filter_last + have hlast' : (a :: t).getLast (by simp) = uSupport := by + simpa [hlist] using hlast + simpa [List.getLast?, hlist] using congrArg some hlast' + +private theorem helper_hu_not_Tn_489.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (fN : E) + (terminalSupport x : V) + (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)) + (_ : terminalSupport ∈ TreeSequenceVertexSet Tn) + (_ : BoundaryColorEdges G rho1 (TreeSequenceVertexSet Tn) gammaN = { fN }) + (_ : Incident G terminalSupport fN), + let vertexSet : Finset V := TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime; + let eligible : List (V ⊕ E) := + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + p.support; + ∀ (eligible_nonempty : eligible ≠ []), + let chosen : V ⊕ E := eligible.getLast eligible_nonempty; + ∀ (u : V) (_ : chosen = Sum.inl u), + let uSupport : V ⊕ E := Sum.inl u; + ∀ (huSupport : uSupport ∈ p.support) (_ : u ∈ vertexSet), + let suffix : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk uSupport (Sum.inl x) := + p.dropUntil uSupport huSupport; + let exitPath : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) uSupport := + suffix.reverse; + ∀ (_ : suffix.IsPath) (_ : exitPath.IsPath) + (_ : exitPath.support = suffix.support.reverse) + (suffix_eligible_nonempty : + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support ≠ + []) + (_ : + (List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support).getLast + suffix_eligible_nonempty = + uSupport) + (_ : + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support = + [uSupport]) + (_ : u ≠ terminalSupport) (_ : (0 : ℕ) < suffix.length) (_ : suffix.length ≠ (1 : ℕ)) + (_ : (2 : ℕ) ≤ suffix.length) (g : E) (_ : suffix.getVert (1 : ℕ) = Sum.inr g) (v : V) + (_ : suffix.getVert (2 : ℕ) = Sum.inl v) (_ : v ∉ vertexSet) (_ : Incident G u g) + (_ : Incident G v g) (_ : u ≠ v) (_ : G.ends g = s(u, v)) + (_ : g ∈ BoundaryEdges G vertexSet) (_ : rho1 g = some gammaN ∨ rho1 g = some deltaN) + (_ : rho1 g = some gammaN) (_ : g ∈ BoundaryColorEdges G rho1 vertexSet gammaN), + u ∉ TreeSequenceVertexSet Tn := by + classical + intro V E _ _ _ _ G k e0 Tn TjPrime rho1 gammaN deltaN fN terminalSupport x p hterminalN + hgammaBoundary hfNterminal vertexSet eligible eligible_nonempty chosen u chosen_eq uSupport + huSupport huVertex suffix exitPath suffix_path exit_path exit_support + suffix_eligible_nonempty suffix_filter_last suffix_filter_singleton hu_terminal + suffix_positive suffix_not_one suffix_length_two g hg v hv hv_outside hgu hgv huv hends + hg_boundary hg_color hg_gamma hg_colored_boundary huT + have hgt : g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet Tn) gammaN := by + unfold BoundaryColorEdges + simp only [Finset.mem_filter] + refine ⟨?_, hg_gamma⟩ + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + have hvTn : v ∉ TreeSequenceVertexSet Tn := by + intro hvT + exact hv_outside (Finset.mem_union.mpr (Or.inl hvT)) + exact ⟨u, huT, v, hvTn, hends⟩ + rw [hgammaBoundary] at hgt + have hgf : g = fN := by simpa using hgt + subst g + have heq : u = terminalSupport := by + have ht : terminalSupport ∈ s(u, v) := by + rw [← hends] + exact hfNterminal + simp only [Sym2.mem_iff] at ht + rcases ht with rfl | rfl + · rfl + · exfalso + apply hv_outside + exact Finset.mem_union.mpr (Or.inl hterminalN) + exact hu_terminal heq + +private theorem helper_branch_530.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (terminalSupport x : V) + (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)), + let vertexSet : Finset V := TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime; + ∀ (u : V), + let uSupport : V ⊕ E := Sum.inl u; + ∀ (huSupport : uSupport ∈ p.support), + let suffix : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk uSupport (Sum.inl x) := + p.dropUntil uSupport huSupport; + let exitPath : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) uSupport := + suffix.reverse; + ∀ (_ : exitPath.support = suffix.support.reverse) + (_ : + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support = + [uSupport]), + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, + Sum.inl w ∈ exitPath.support ↔ w = u := by + classical + intro V E _ _ G k e0 Tn TjPrime rho1 gammaN deltaN terminalSupport x p vertexSet u uSupport + huSupport suffix exitPath exit_support suffix_filter_singleton w hw + constructor + · intro hwm + have hwm' : Sum.inl w ∈ suffix.support := by + rw [exit_support] at hwm + exact List.mem_reverse.mp hwm + have hwf : Sum.inl w ∈ suffix.support.filter (fun z => match z with + | Sum.inl z => decide (z ∈ vertexSet) + | Sum.inr _ => false) := + List.mem_filter.mpr ⟨hwm', by simp [vertexSet, hw]⟩ + rw [suffix_filter_singleton] at hwf + simpa [uSupport] using hwf + · intro hwu + subst w + rw [exit_support] + apply List.mem_reverse.mpr + have huf : Sum.inl u ∈ suffix.support.filter (fun z => match z with + | Sum.inl z => decide (z ∈ vertexSet) + | Sum.inr _ => false) := by + rw [suffix_filter_singleton] + simp [uSupport] + exact (List.mem_filter.mp huf).1 + +private theorem helper_singleton_of_head_last_580.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (l : List (V ⊕ E)) (a : V ⊕ E), + l.Nodup → + l.head? = some a → + l.getLast? = some a → + l = [a] := by + classical + intro V E l + induction l with + | nil => simp + | cons b t ih => + intro a hn hh hl + simp only [List.head?_cons] at hh + have hba : b = a := Option.some.inj hh + subst b + by_cases ht : t = [] + · simp [ht] + · have hlast : t.getLast? = some a := by + cases t with + | nil => contradiction + | cons c r => simpa using hl + obtain ⟨ys, hys⟩ := (List.getLast?_eq_some_iff.mp hlast) + have hmem : a ∈ t := by + rw [hys] + simp + exact False.elim ((List.nodup_cons.mp hn).1 hmem) + +private theorem helper_hu_terminal_629.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (terminalSupport x : V) + (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)) + (_ : (∃ w ∈ TreeSequenceVertexSet Tn, w ≠ terminalSupport ∧ Sum.inl w ∈ p.support)), + let vertexSet : Finset V := TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime; + let eligible : List (V ⊕ E) := + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + p.support; + ∀ (eligible_nonempty : eligible ≠ []), + let chosen : V ⊕ E := eligible.getLast eligible_nonempty; + ∀ (u : V) (_ : chosen = Sum.inl u), + let uSupport : V ⊕ E := Sum.inl u; + ∀ (huSupport : uSupport ∈ p.support) (_ : u ∈ vertexSet), + let suffix : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk uSupport (Sum.inl x) := + p.dropUntil uSupport huSupport; + let exitPath : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) uSupport := + suffix.reverse; + ∀ (_ : suffix.IsPath) (_ : exitPath.IsPath) + (_ : exitPath.support = suffix.support.reverse) + (suffix_eligible_nonempty : + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support ≠ + []) + (_ : + (List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support).getLast + suffix_eligible_nonempty = + uSupport) + (_ : + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support = + [uSupport]), + u ≠ terminalSupport := by + classical + intro V E _ _ G k e0 Tn TjPrime rho1 gammaN deltaN terminalSupport x p htwoN vertexSet eligible + eligible_nonempty chosen u chosen_eq uSupport huSupport huVertex suffix exitPath + suffix_path exit_path exit_support suffix_eligible_nonempty suffix_filter_last + suffix_filter_singleton heq + subst u + have hs : suffix = p := by + simp [suffix, uSupport] + obtain ⟨w, hw, hwu, hwm⟩ := htwoN + have hwm' : Sum.inl w ∈ suffix.support := by rw [hs]; exact hwm + have hwf : Sum.inl w ∈ suffix.support.filter (fun z => match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) := by + apply List.mem_filter.mpr + exact ⟨hwm', by simp [vertexSet, hw]⟩ + rw [suffix_filter_singleton] at hwf + apply hwu + simpa [uSupport] using hwf + +private theorem helper_hv_outside_673.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (terminalSupport x : V) + (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)), + let vertexSet : Finset V := TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime; + ∀ (u : V), + let uSupport : V ⊕ E := Sum.inl u; + ∀ (huSupport : uSupport ∈ p.support), + let suffix : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk uSupport (Sum.inl x) := + p.dropUntil uSupport huSupport; + ∀ (_ : suffix.IsPath) + (_ : + List.filter + (fun (z : V ⊕ E) => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support = + [uSupport]) + (_ : (2 : ℕ) ≤ suffix.length) (v : V) (_ : suffix.getVert (2 : ℕ) = Sum.inl v), + v ∉ vertexSet := by + classical + intro V E _ _ G k e0 Tn TjPrime rho1 gammaN deltaN terminalSupport x p vertexSet u uSupport + huSupport suffix suffix_path suffix_filter_singleton suffix_length_two v hv hvin + have hvm : Sum.inl v ∈ suffix.support := by + apply SimpleGraph.Walk.mem_support_iff_exists_getVert.mpr + exact ⟨2, hv, by omega⟩ + have hvf : Sum.inl v ∈ suffix.support.filter (fun z => match z with + | Sum.inl z => decide (z ∈ vertexSet) + | Sum.inr _ => false) := by + exact List.mem_filter.mpr ⟨hvm, by simp [hvin]⟩ + rw [suffix_filter_singleton] at hvf + have hvu : v = u := by simpa [uSupport] using hvf + have hinj := suffix_path.getVert_injOn (by omega : 0 ≤ suffix.length) + (by omega : 2 ≤ suffix.length) + (show suffix.getVert 0 = suffix.getVert 2 by + rw [suffix.getVert_zero, hv] + exact congrArg Sum.inl hvu.symm) + omega + +private theorem helper_continuation_847.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (fN : E) + (terminalSupport x : V) + (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)) + (_ : p.IsPath) + (_ : + {y : V ⊕ E | y ∈ p.support} = + TwoColorComponent G rho1 gammaN deltaN (Sum.inl terminalSupport)) + (_ : terminalSupport ∈ TreeSequenceVertexSet Tn) + (_ : (∃ w ∈ TreeSequenceVertexSet Tn, w ≠ terminalSupport ∧ Sum.inl w ∈ p.support)) + (_ : + BoundaryColorEdges G rho1 (TreeSequenceVertexSet Tn) gammaN = ({ fN } : Finset E)) + (_ : + BoundaryColorEdges G rho1 (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) + deltaN = + ∅) + (_ : Incident G terminalSupport fN), + let vertexSet : Finset V := TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime; + let eligible : List (V ⊕ E) := + List.filter + (fun (z : V ⊕ E) ↦ + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + p.support; + ∀ (eligible_nonempty : eligible ≠ []), + let chosen : V ⊕ E := eligible.getLast eligible_nonempty; + ∀ (u : V) (_ : chosen = Sum.inl u), + let uSupport : V ⊕ E := Sum.inl u; + ∀ (huSupport : uSupport ∈ p.support) (_ : u ∈ vertexSet), + let suffix : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk uSupport (Sum.inl x) := + p.dropUntil uSupport huSupport; + let exitPath : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) uSupport := + suffix.reverse; + ∀ (_ : suffix.IsPath) (_ : exitPath.IsPath) + (_ : exitPath.support = suffix.support.reverse) + (suffix_eligible_nonempty : + List.filter + (fun (z : V ⊕ E) ↦ + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support ≠ + []) + (_ : + (List.filter + (fun (z : V ⊕ E) ↦ + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support).getLast + suffix_eligible_nonempty = + uSupport) + (_ : + List.filter + (fun (z : V ⊕ E) ↦ + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + suffix.support = + [uSupport]) + (_ : u ≠ terminalSupport) (_ : (0 : ℕ) < suffix.length) (_ : suffix.length ≠ (1 : ℕ)) + (_ : (2 : ℕ) ≤ suffix.length) (g : E) (_ : suffix.getVert (1 : ℕ) = Sum.inr g) (v : V) + (_ : suffix.getVert (2 : ℕ) = Sum.inl v), + ∃ (u : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)), + u ∈ TreeSequenceVertexSet TjPrime \ TreeSequenceVertexSet Tn ∧ + exitPath.IsPath ∧ + (2 : ℕ) ≤ exitPath.length ∧ + (∀ y ∈ exitPath.support, y ∈ p.support) ∧ + (∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, + Sum.inl w ∈ exitPath.support ↔ w = u) ∧ + (∃ + g ∈ + BoundaryColorEdges G rho1 + (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) gammaN, + Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬Incident G u fN := by + classical + intro V E _ _ _ G k e0 Tn TjPrime rho1 gammaN deltaN fN terminalSupport x p hpath hcomponent + hterminalN htwoN hgammaBoundary hdeltaBoundary hfNterminal vertexSet eligible + eligible_nonempty chosen u chosen_eq uSupport huSupport huVertex suffix exitPath + suffix_path exit_path exit_support suffix_eligible_nonempty suffix_filter_last + suffix_filter_singleton hu_terminal suffix_positive suffix_not_one suffix_length_two g hg v hv + have hv_outside := + @helper_hv_outside_673 V E inferInstance inferInstance G k e0 Tn TjPrime rho1 gammaN + deltaN terminalSupport x p u huSupport suffix_path suffix_filter_singleton + suffix_length_two v hv + have hgu : Incident G u g := by + have ha := suffix.adj_getVert_succ (i := 0) (by omega) + rw [suffix.getVert_zero, hg] at ha + simpa [uSupport, TwoColorIncidenceGraph] using ha.1 + have hgv : Incident G v g := by + have ha := suffix.adj_getVert_succ (i := 1) (by omega) + rw [hg, hv] at ha + simpa [TwoColorIncidenceGraph] using ha.1 + have huv : u ≠ v := by + intro huv + have hinj := suffix_path.getVert_injOn (by omega : 0 ≤ suffix.length) + (by omega : 2 ≤ suffix.length) + (show suffix.getVert 0 = suffix.getVert 2 by + rw [suffix.getVert_zero, hv] + exact congrArg Sum.inl huv) + omega + have hends : G.ends g = s(u, v) := by + have ends_eq_of_mem : ∀ {z : Sym2 V} {a b : V}, a ∈ z → b ∈ z → a ≠ b → z = s(a,b) := by + intro z a b ha hb hab + induction z using Sym2.inductionOn with + | _ c d => + simp only [Sym2.mem_iff] at ha hb + rcases ha with rfl | rfl <;> rcases hb with rfl | rfl <;> simp_all [] + exact ends_eq_of_mem hgu hgv huv + have hg_boundary : g ∈ BoundaryEdges G vertexSet := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, huVertex, v, hv_outside, hends⟩ + have hg_color : rho1 g = some gammaN ∨ rho1 g = some deltaN := by + have ha := suffix.adj_getVert_succ (i := 0) (by omega) + rw [suffix.getVert_zero, hg] at ha + simpa [TwoColorIncidenceGraph] using ha.2 + have hg_gamma : rho1 g = some gammaN := by + rcases hg_color with hg' | hg' + · exact hg' + · exfalso + have hmem : g ∈ BoundaryColorEdges G rho1 vertexSet deltaN := by + unfold BoundaryColorEdges + simp only [Finset.mem_filter] + exact ⟨hg_boundary, hg'⟩ + simp [vertexSet, hdeltaBoundary] at hmem + have hg_colored_boundary : g ∈ BoundaryColorEdges G rho1 vertexSet gammaN := by + unfold BoundaryColorEdges + simp only [Finset.mem_filter] + exact ⟨hg_boundary, hg_gamma⟩ + have hu_not_Tn := + @helper_hu_not_Tn_489 V E inferInstance inferInstance inferInstance inferInstance G k + e0 Tn TjPrime rho1 gammaN deltaN fN terminalSupport x p hterminalN hgammaBoundary + hfNterminal eligible_nonempty u chosen_eq huSupport huVertex suffix_path exit_path + exit_support suffix_eligible_nonempty suffix_filter_last suffix_filter_singleton + hu_terminal suffix_positive suffix_not_one suffix_length_two g hg v hv hv_outside hgu hgv + huv hends hg_boundary hg_color hg_gamma hg_colored_boundary + refine ⟨u, exitPath, ?_, exit_path, ?_, ?_, ?_, ?_, ?_⟩ + · simp only [Finset.mem_sdiff] + constructor + · rcases Finset.mem_union.mp huVertex with h | h + · exact False.elim (hu_not_Tn h) + · exact h + · exact hu_not_Tn + · simpa [exitPath] using suffix_length_two + · intro y hy + have hy' : y ∈ suffix.support := by + rw [exit_support] at hy + exact List.mem_reverse.mp hy + have hsuf : suffix.support <:+ p.support := by + simpa [suffix] using p.support_dropUntil_suffix_support huSupport + exact hsuf.subset hy' + · exact @helper_branch_530 V E inferInstance inferInstance G k e0 Tn TjPrime rho1 gammaN deltaN + terminalSupport x p u huSupport exit_support suffix_filter_singleton + · refine ⟨g, ?_, hgu, ?_⟩ + · simpa [vertexSet] using hg_colored_boundary + · rw [exit_support] + apply List.mem_reverse.mpr + apply SimpleGraph.Walk.mem_support_iff_exists_getVert.mpr + exact ⟨1, hg, by omega⟩ + have hf_boundary : fN ∈ BoundaryColorEdges G rho1 + (TreeSequenceVertexSet Tn) gammaN := by + rw [hgammaBoundary] + simp + have hf_color : rho1 fN = some gammaN := by + have hh := hf_boundary + unfold BoundaryColorEdges at hh + exact (Finset.mem_filter.mp hh).2 + have hf_adj : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Adj + (Sum.inl terminalSupport) (Sum.inr fN) := + ⟨hfNterminal, Or.inl hf_color⟩ + have hf_support : Sum.inr fN ∈ p.support := by + change Sum.inr fN ∈ {y : Sum V E | y ∈ p.support} + rw [hcomponent] + apply (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hf_adj).symm + · exact @helper_branch_352 V E inferInstance inferInstance G k e0 Tn TjPrime rho1 gammaN deltaN + fN terminalSupport x p hpath htwoN hfNterminal u huSupport suffix_filter_singleton + hu_terminal v hu_not_Tn hf_support + +theorem ExtensionBaseCaseTwoObservation21 {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (Tn TjPrime : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) + (fN : E) (terminalSupport x : V) + (p : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl terminalSupport) (Sum.inl x)) + (hpath : p.IsPath) + (hcomponent : {y : Sum V E | y ∈ p.support} = + TwoColorComponent G rho1 gammaN deltaN (Sum.inl terminalSupport)) + (hterminalN : terminalSupport ∈ TreeSequenceVertexSet Tn) + (hterminalPrime : terminalSupport ∈ TreeSequenceVertexSet TjPrime) + (hxOutside : x ∉ + TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) + (htwoN : ∃ w ∈ TreeSequenceVertexSet Tn, + w ≠ terminalSupport ∧ Sum.inl w ∈ p.support) + (hgammaBoundary : BoundaryColorEdges G rho1 + (TreeSequenceVertexSet Tn) gammaN = {fN}) + (hdeltaBoundary : BoundaryColorEdges G rho1 + (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) deltaN = ∅) + (hfNterminal : Incident G terminalSupport fN) : + ∃ (u : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)), + u ∈ TreeSequenceVertexSet TjPrime \ TreeSequenceVertexSet Tn ∧ + exitPath.IsPath ∧ + 2 ≤ exitPath.length ∧ + (∀ y : Sum V E, y ∈ exitPath.support → y ∈ p.support) ∧ + (∀ w : V, + w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → + (Sum.inl w ∈ exitPath.support ↔ w = u)) ∧ + (∃ + g ∈ + BoundaryColorEdges G rho1 + (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) gammaN, + Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬Incident G u fN := by + classical + let : BEq (Sum V E) := instBEqOfDecidableEq + let vertexSet := TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime + let eligible : List (Sum V E) := p.support.filter (fun z => + match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + have eligible_nonempty : eligible ≠ [] := by + exact List.ne_nil_of_mem (List.mem_filter.mpr ⟨p.start_mem_support, by + simp [vertexSet, hterminalN, hterminalPrime]⟩) + let chosen : Sum V E := eligible.getLast eligible_nonempty + have chosen_mem : chosen ∈ eligible := List.getLast_mem eligible_nonempty + have chosen_pred := (List.mem_filter.mp chosen_mem).2 + have chosen_support : chosen ∈ p.support := List.mem_of_mem_filter chosen_mem + obtain ⟨u, chosen_eq⟩ : ∃ u : V, chosen = Sum.inl u := by + by_cases h : ∃ v : V, chosen = Sum.inl v + · exact h + · exfalso + obtain ⟨e, he⟩ : ∃ e : E, chosen = Sum.inr e := by + cases hc : chosen with + | inl v => exact False.elim (h ⟨v, hc⟩) + | inr e => exact ⟨e, rfl⟩ + rw [he] at chosen_pred + exact False.elim (by simp at chosen_pred) + let uSupport : Sum V E := Sum.inl u + have huSupport : uSupport ∈ p.support := by simpa [uSupport, chosen_eq] using chosen_support + have huVertex : u ∈ vertexSet := by + rw [chosen_eq] at chosen_pred + simpa [vertexSet] using chosen_pred + have singleton_of_head_last := + @helper_singleton_of_head_last_580 V E + let suffix := p.dropUntil uSupport huSupport + let exitPath := suffix.reverse + have suffix_path : suffix.IsPath := hpath.dropUntil huSupport + have exit_path : exitPath.IsPath := suffix_path.reverse + have exit_support : exitPath.support = suffix.support.reverse := by + simp [exitPath, SimpleGraph.Walk.support_reverse] + have suffix_eligible_nonempty : + (suffix.support.filter (fun z => match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false)) ≠ [] := by + apply List.ne_nil_of_mem (a := uSupport) + exact List.mem_filter.mpr ⟨suffix.start_mem_support, by simp [uSupport, huVertex]⟩ + have suffix_filter_last : + (suffix.support.filter (fun z => match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false)).getLast suffix_eligible_nonempty = uSupport := by + have hsuf : suffix.support <:+ p.support := by + simpa [suffix] using p.support_dropUntil_suffix_support huSupport + have hfiltered := hsuf.filter (fun z => match z with + | Sum.inl v => decide (v ∈ vertexSet) + | Sum.inr _ => false) + have heq := hfiltered.getLast suffix_eligible_nonempty + convert heq using 1; simp [eligible, chosen, chosen_eq, uSupport] + have suffix_filter_singleton := + @helper_suffix_filter_singleton_359 V E inferInstance inferInstance G k e0 Tn TjPrime + rho1 gammaN deltaN terminalSupport x p u huSupport huVertex singleton_of_head_last + suffix_path suffix_eligible_nonempty suffix_filter_last + have hu_terminal := + @helper_hu_terminal_629 V E inferInstance inferInstance G k e0 Tn TjPrime rho1 gammaN + deltaN terminalSupport x p htwoN eligible_nonempty u chosen_eq huSupport huVertex + suffix_path exit_path exit_support suffix_eligible_nonempty suffix_filter_last + suffix_filter_singleton + have suffix_positive : 0 < suffix.length := by + by_contra hz + have hz0 : suffix.length = 0 := by omega + have hux := SimpleGraph.Walk.eq_of_length_eq_zero hz0 + have : x = u := by simpa [uSupport] using hux.symm + apply hxOutside + rw [this] + exact huVertex + have suffix_not_one : suffix.length ≠ 1 := by + intro hone + have ha := suffix.adj_getVert_succ (i := 0) (by omega) + have hzero : suffix.getVert 0 = Sum.inl u := by simp [uSupport] + rw [hzero] at ha + rw [show suffix.getVert 1 = suffix.getVert suffix.length by simp [hone]] at ha + rw [suffix.getVert_length] at ha + simp [TwoColorIncidenceGraph] at ha + have suffix_length_two : 2 ≤ suffix.length := by omega + have first_edge : ∃ g : E, suffix.getVert 1 = Sum.inr g := by + have ha := suffix.adj_getVert_succ (i := 0) (by omega) + cases hcase : suffix.getVert 1 with + | inl v => + exfalso; rw [suffix.getVert_zero, hcase] at ha; simp [uSupport, TwoColorIncidenceGraph] + at ha + | inr g => exact ⟨g, rfl⟩ + obtain ⟨g, hg⟩ := first_edge + have next_vertex : ∃ v : V, suffix.getVert 2 = Sum.inl v := by + have ha := suffix.adj_getVert_succ (i := 1) (by omega) + cases hcase : suffix.getVert 2 with + | inl v => exact ⟨v, rfl⟩ + | inr e => exfalso; rw [hg, hcase] at ha; simp [TwoColorIncidenceGraph] at ha + obtain ⟨v, hv⟩ := next_vertex + exact @helper_continuation_847 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@Tn) (@TjPrime) (@rho1) (@gammaN) (@deltaN) (@fN) (@terminalSupport) (@x) (@p) + (@hpath) (@hcomponent) (@hterminalN) (@htwoN) (@hgammaBoundary) (@hdeltaBoundary) + (@hfNterminal) (@eligible_nonempty) (@u) (@chosen_eq) (@huSupport) (@huVertex) + (@suffix_path) (@exit_path) (@exit_support) (@suffix_eligible_nonempty) + (@suffix_filter_last) (@suffix_filter_singleton) (@hu_terminal) (@suffix_positive) + (@suffix_not_one) (@suffix_length_two) (@g) (@hg) (@v) (@hv) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation23.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation23.lean new file mode 100644 index 0000000000..19ed42ddf3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation23.lean @@ -0,0 +1,398 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Finset.Max + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence + +public import LeanPool.GoldbergSeymour.TreeVerticesBefore + +/-! +# Extension Base Case Two Observation23 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_edge_missing_108.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : + ℕ} {e0 : E} (_ seed : TreeSequence G e0) (phiJ : PartialEdgeColoring E k) {B : + TreeSequence G e0}, TashkinovAugmentationSequence phiJ seed B → ∀ (a : Fin B.length), + seed.length ≤ (↑a : ℕ) → ∃ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑a : ℕ) ∧ ∃ (c : + Fin k), phiJ (B.edge a) = some c ∧ c ∈ MissingColors G phiJ (B.vertex i) := by + classical + intro V E _ _ G k e0 Tj seed phiJ B hreach + let _ := Fintype.ofFinite V + unfold TashkinovAugmentationSequence at hreach + induction hreach with + | refl => + intro a ha + omega + | @tail A B hprior ih hstep => + intro a ha + rcases ih with ⟨hlen, hinit, cnew, hcolor, hmissing⟩ + by_cases hold : a.val < A.length + · let old : Fin A.length := ⟨a.val, hold⟩ + obtain ⟨i, hi, c, hcol, hmiss⟩ := hstep old (by simpa [old] using ha) + refine ⟨Fin.castLE (Nat.succ_le_succ hinit.1) i, ?_, c, ?_, ?_⟩ + · simpa using hi + · have haold : Fin.castLE hinit.1 old = a := by + apply Fin.ext + rfl + rw [← haold, hinit.2.2] + simpa [old] using hcol + · simpa [hinit.2.1] using hmiss + · have hnew : a.val = A.length := by omega + let last : Fin B.length := ⟨a.val, by omega⟩ + have hlast : a = last := by + apply Fin.ext + simp [last] + rw [hlast] + rw [show B.edge last = B.edge (Fin.cast hlen.symm (Fin.last _)) by + congr 1 + apply Fin.ext + simpa [last] using hnew] + rw [hcolor] + rw [TreeMissingColors] at hmissing + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hmissing + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv + obtain ⟨i, hi, hvi⟩ := hv + refine ⟨Fin.castLE (Nat.succ_le_succ hinit.1) i, ?_, cnew, rfl, ?_⟩ + · change i.val ≤ a.val + omega + · rw [hinit.2.1] + rw [hvi] + exact hvm + +private theorem helper_branch_155.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tj seed : TreeSequence G e0) (phiJ rho1 : + PartialEdgeColoring E k) (terminalSupport : V) (beta gammaFirst : Fin k), + TreeSequenceInitialSegment seed Tj → seed.vertex (Fin.last seed.length) = terminalSupport + → ( + ∀ v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport, MissingColors G rho1 v = MissingColors + G phiJ v) → beta ∉ MissingColors G rho1 terminalSupport → MissingColors G phiJ + terminalSupport ⊆ MissingColors G rho1 terminalSupport ∪ {gammaFirst} → beta ≠ gammaFirst + → TashkinovAugmentationSequence phiJ seed Tj → ( + ∀ (a : Fin Tj.length), seed.length ≤ (↑a : ℕ) → rho1 (Tj.edge a) = phiJ (Tj.edge a)) → ( + ∀ v ∈ TreeSequenceVertexSet seed, beta ∉ MissingColors G rho1 v) → + let candidates : Finset (Fin (Tj.length + (1 : ℕ))) := {i : Fin (Tj.length + (1 : ℕ)) | + seed.length < (↑i : ℕ) ∧ beta ∈ MissingColors G rho1 (Tj.vertex i)}; ( + ∀ {B : TreeSequence G e0}, TashkinovAugmentationSequence phiJ seed B → + ∀ (a : Fin B.length), seed.length ≤ (↑a : ℕ) → + ∃ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑a : ℕ) ∧ + ∃ (c : Fin k), phiJ (B.edge a) = some c ∧ c ∈ MissingColors G phiJ (B.vertex i)) → + candidates.Nonempty → + ∃ (z : V) (hz : z ∈ TreeSequenceVertexSet Tj) (zPosition : Fin (Tj.length + (1 : ℕ))), + Tj.vertex zPosition = z ∧ seed.length ≤ (↑zPosition : ℕ) ∧ ((seed.length < (↑zPosition : + ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin (Tj.length + (1 : ℕ))), seed.length < (↑r : ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta + ∉ MissingColors G rho1 (Tj.vertex r)) ∨ zPosition = Fin.last Tj.length ∧ + ∀ (r : Fin (Tj.length + (1 : ℕ))), seed.length < (↑r : ℕ) → beta ∉ MissingColors G rho1 + (Tj.vertex r)) ∧ ( + ∀ w ∈ TreeVerticesBefore Tj z hz, beta ∉ MissingColors G rho1 w) ∧ + ∀ (a : Fin Tj.length), seed.length ≤ (↑a : ℕ) → (↑a : ℕ) < (↑zPosition : ℕ) → rho1 (Tj.edge a) + ≠ some beta := by + classical + intro V E _ _ _ G k e0 Tj seed phiJ rho1 terminalSupport beta gammaFirst hseedJ hseedTerminal + hb2Missing hterminalRho hterminalInclusion hbetaGamma haugmentation hb2Edges beta_seed + candidates edge_missing hcandidates + let _ := Fintype.ofFinite V + let q := candidates.min' hcandidates + let z := Tj.vertex q + have hqmem : q ∈ candidates := Finset.min'_mem candidates hcandidates + have hqafter : seed.length < q.val := (Finset.mem_filter.mp hqmem).2.1 + have hqmiss : beta ∈ MissingColors G rho1 z := (Finset.mem_filter.mp hqmem).2.2 + have before_exclusion : ∀ i : Fin (Tj.length + 1), i.val < q.val → + beta ∉ MissingColors G rho1 (Tj.vertex i) := by + intro i hi hmiss + by_cases hsmall : i.val < seed.length + · obtain ⟨hlen, hvertices, hedges⟩ := hseedJ + let si : Fin (seed.length + 1) := ⟨i.val, by omega⟩ + have heq : Fin.castLE (Nat.succ_le_succ hlen) si = i := by + apply Fin.ext + rfl + have hseedmiss : beta ∈ MissingColors G rho1 (seed.vertex si) := by + rw [← hvertices si, heq] + exact hmiss + exact beta_seed (seed.vertex si) (by + simp [TreeSequenceVertexSet]) hseedmiss + · by_cases heq : i.val = seed.length + · obtain ⟨hlen, hvertices, hedges⟩ := hseedJ + have hlast : (Fin.last seed.length).val = seed.length := rfl + let si : Fin (seed.length + 1) := Fin.last seed.length + have hpos : Fin.castLE (Nat.succ_le_succ hlen) si = i := by + apply Fin.ext + simpa [si] using heq.symm + have hterm : Tj.vertex i = terminalSupport := by + rw [← hpos, hvertices, hseedTerminal] + rw [hterm] at hmiss + exact hterminalRho hmiss + · have hlarge : seed.length < i.val := by omega + have hrmem : i ∈ candidates := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, hlarge, hmiss⟩ + have hmin := Finset.min'_le candidates i hrmem + exact (Nat.not_lt_of_ge hmin) hi + have hzset : z ∈ TreeSequenceVertexSet Tj := by + simp [TreeSequenceVertexSet, z] + refine ⟨z, hzset, q, rfl, le_of_lt hqafter, Or.inl ⟨hqafter, + hqmiss, ?_⟩, ?_, ?_⟩ + · intro r hr hrl hmiss + have hrmem : r ∈ candidates := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, hr, hmiss⟩ + have hmin := Finset.min'_le candidates r hrmem + exact (Nat.not_lt_of_ge hmin) hrl + · intro w hw + unfold TreeVerticesBefore at hw + have horder := (Finset.mem_filter.mp hw).2 + rcases horder with ⟨i, j, hi, hj, hij⟩ + have hjq : j = q := Tj.vertex_injective (hj.trans rfl) + subst j + rw [← hi] + exact before_exclusion i (by simpa using hij) + · intro a ha hlt hbad + obtain ⟨i, hi, c, hcol, hmiss⟩ := edge_missing haugmentation a ha + have hil : i.val < q.val := lt_of_le_of_lt hi hlt + have hrho : beta ∉ MissingColors G rho1 (Tj.vertex i) := + before_exclusion i hil + have hphi : beta ∉ MissingColors G phiJ (Tj.vertex i) := by + by_cases hit : Tj.vertex i = terminalSupport + · intro hb + rw [hit] at hb + have hin := hterminalInclusion hb + rcases Finset.mem_union.mp hin with hin | hin + · exact hterminalRho (hit ▸ hin) + · have : beta = gammaFirst := by simpa using hin + exact hbetaGamma this + · have hiSet : Tj.vertex i ∈ (TreeSequenceVertexSet Tj).erase terminalSupport := + Finset.mem_erase.mpr ⟨hit, by + simp [TreeSequenceVertexSet]⟩ + rw [← hb2Missing _ hiSet] + exact hrho + have hbad' : phiJ (Tj.edge a) = some beta := by + rw [← hb2Edges a ha] + exact hbad + have hcEq : c = beta := Option.some.inj (hcol.symm.trans hbad') + subst c + exact hphi hmiss + +private theorem helper_branch_233.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tj seed : TreeSequence G e0) (phiJ rho1 : + PartialEdgeColoring E k) (terminalSupport : V) (beta gammaFirst : Fin k), + TreeSequenceInitialSegment seed Tj → seed.vertex (Fin.last seed.length) = terminalSupport + → ( + ∀ v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport, MissingColors G rho1 v = MissingColors + G phiJ v) → beta ∉ MissingColors G rho1 terminalSupport → MissingColors G phiJ + terminalSupport ⊆ MissingColors G rho1 terminalSupport ∪ {gammaFirst} → beta ≠ gammaFirst + → TashkinovAugmentationSequence phiJ seed Tj → ( + ∀ (a : Fin Tj.length), seed.length ≤ (↑a : ℕ) → rho1 (Tj.edge a) = phiJ (Tj.edge a)) → ( + ∀ v ∈ TreeSequenceVertexSet seed, beta ∉ MissingColors G rho1 v) → + let candidates : Finset (Fin (Tj.length + (1 : ℕ))) := {i : Fin (Tj.length + (1 : ℕ)) | + seed.length < (↑i : ℕ) ∧ beta ∈ MissingColors G rho1 (Tj.vertex i)}; seed.length ≤ + (↑(Fin.last Tj.length) : ℕ) → ( + ∀ {B : TreeSequence G e0}, TashkinovAugmentationSequence phiJ seed B → + ∀ (a : Fin B.length), seed.length ≤ (↑a : ℕ) → + ∃ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑a : ℕ) ∧ + ∃ (c : Fin k), phiJ (B.edge a) = some c ∧ c ∈ MissingColors G phiJ (B.vertex i)) → + ¬candidates.Nonempty → + ∃ (z : V) (hz : z ∈ TreeSequenceVertexSet Tj) (zPosition : Fin (Tj.length + (1 : ℕ))), + Tj.vertex zPosition = z ∧ seed.length ≤ (↑zPosition : ℕ) ∧ ((seed.length < (↑zPosition : + ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin (Tj.length + (1 : ℕ))), seed.length < (↑r : ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta + ∉ MissingColors G rho1 (Tj.vertex r)) ∨ zPosition = Fin.last Tj.length ∧ + ∀ (r : Fin (Tj.length + (1 : ℕ))), seed.length < (↑r : ℕ) → beta ∉ MissingColors G rho1 + (Tj.vertex r)) ∧ ( + ∀ w ∈ TreeVerticesBefore Tj z hz, beta ∉ MissingColors G rho1 w) ∧ + ∀ (a : Fin Tj.length), seed.length ≤ (↑a : ℕ) → (↑a : ℕ) < (↑zPosition : ℕ) → rho1 (Tj.edge a) + ≠ some beta := by + classical + intro V E _ _ _ G k e0 Tj seed phiJ rho1 terminalSupport beta gammaFirst hseedJ hseedTerminal + hb2Missing hterminalRho hterminalInclusion hbetaGamma haugmentation hb2Edges beta_seed + candidates last_after edge_missing hcandidates + let _ := Fintype.ofFinite V + have hqmiss : ∀ r : Fin (Tj.length + 1), seed.length < r.val → + beta ∉ MissingColors G rho1 (Tj.vertex r) := by + intro r hr hmiss + apply hcandidates + exact ⟨r, Finset.mem_filter.mpr ⟨Finset.mem_univ _, hr, hmiss⟩⟩ + let q : Fin (Tj.length + 1) := Fin.last Tj.length + let z := Tj.vertex q + have hzset : z ∈ TreeSequenceVertexSet Tj := by + simp [TreeSequenceVertexSet, z] + refine ⟨z, hzset, q, rfl, ?_, Or.inr ⟨rfl, hqmiss⟩, ?_, ?_⟩ + · simpa [q] using last_after + · intro w hw + unfold TreeVerticesBefore at hw + have horder := (Finset.mem_filter.mp hw).2 + rcases horder with ⟨i, j, hi, hj, hij⟩ + have hjq : j = q := Tj.vertex_injective (hj.trans rfl) + subst j + rw [← hi] + exact (by + by_cases hsmall : i.val ≤ seed.length + · by_cases heq : i.val = seed.length + · obtain ⟨hlen, hvertices, hedges⟩ := hseedJ + let si : Fin (seed.length + 1) := Fin.last seed.length + have hpos : Fin.castLE (Nat.succ_le_succ hlen) si = i := by + apply Fin.ext + simpa [si] using heq.symm + have hterm : Tj.vertex i = terminalSupport := by + rw [← hpos, hvertices, hseedTerminal] + rw [hterm] + exact hterminalRho + · have hlt : i.val < seed.length := by omega + obtain ⟨hlen, hvertices, hedges⟩ := hseedJ + let si : Fin (seed.length + 1) := ⟨i.val, by omega⟩ + have hpos : Fin.castLE (Nat.succ_le_succ hlen) si = i := by + apply Fin.ext + rfl + have hset : seed.vertex si ∈ TreeSequenceVertexSet seed := by + simp [TreeSequenceVertexSet] + rw [← hpos, hvertices] + exact beta_seed _ hset + · exact hqmiss i (by omega)) + · intro a ha hlt hbad + exact (by + obtain ⟨i, hi, c, hcol, hmiss⟩ := edge_missing haugmentation a ha + have hil : i.val < q.val := lt_of_le_of_lt hi hlt + have hiMiss : beta ∉ MissingColors G rho1 (Tj.vertex i) := by + by_cases hiSeed : i.val ≤ seed.length + · by_cases hiTerm : i.val = seed.length + · obtain ⟨hlen, hvertices, hedges⟩ := hseedJ + let si : Fin (seed.length + 1) := Fin.last seed.length + have hpos : Fin.castLE (Nat.succ_le_succ hlen) si = i := by + apply Fin.ext + simpa [si] using hiTerm.symm + rw [← hpos, hvertices, hseedTerminal] + exact hterminalRho + · obtain ⟨hlen, hvertices, hedges⟩ := hseedJ + let si : Fin (seed.length + 1) := ⟨i.val, by omega⟩ + have hpos : Fin.castLE (Nat.succ_le_succ hlen) si = i := by + apply Fin.ext + rfl + rw [← hpos, hvertices] + exact beta_seed _ (by + simp [TreeSequenceVertexSet]) + · exact hqmiss i (by omega) + have hphi : beta ∉ MissingColors G phiJ (Tj.vertex i) := by + by_cases hit : Tj.vertex i = terminalSupport + · intro hb + rw [hit] at hb + have hin := hterminalInclusion hb + rcases Finset.mem_union.mp hin with hin | hin + · exact hterminalRho (hit ▸ hin) + · exact hbetaGamma (by simpa using hin) + · rw [← hb2Missing _ (Finset.mem_erase.mpr ⟨hit, by + simp [TreeSequenceVertexSet]⟩)] + exact hiMiss + have hbad' : phiJ (Tj.edge a) = some beta := by + rw [← hb2Edges a ha] + exact hbad + have : c = beta := Option.some.inj (hcol.symm.trans hbad') + subst c + exact hphi hmiss) + +theorem ExtensionBaseCaseTwoObservation23 {V E : Type*} + [Finite V] [Fintype E] [DecidableEq V] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (Tj seed TjPrime : TreeSequence G e0) + (phiJ rho1 : PartialEdgeColoring E k) + (terminalSupport u : V) (beta gammaFirst : Fin k) + (hseedJ : TreeSequenceInitialSegment seed Tj) + (hseedPrime : TreeSequenceInitialSegment seed TjPrime) + (hseedTerminal : seed.vertex (Fin.last seed.length) = terminalSupport) + (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (huSeed : u ∉ TreeSequenceVertexSet seed) + (hprimeElementary : ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime)) + (hbetaU : beta ∈ MissingColors G rho1 u) + (_ : terminalSupport ∈ TreeSequenceVertexSet seed) + (hb2Missing : ∀ v : V, + v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport → + MissingColors G rho1 v = MissingColors G phiJ v) + (hterminalRho : beta ∉ MissingColors G rho1 terminalSupport) + (hterminalInclusion : MissingColors G phiJ terminalSupport ⊆ + MissingColors G rho1 terminalSupport ∪ {gammaFirst}) + (hbetaGamma : beta ≠ gammaFirst) + (haugmentation : TashkinovAugmentationSequence phiJ seed Tj) + (hb2Edges : ∀ a : Fin Tj.length, seed.length ≤ a.val → + rho1 (Tj.edge a) = phiJ (Tj.edge a)) : + ∃ (z : V) (hz : z ∈ TreeSequenceVertexSet Tj) + (zPosition : Fin (Tj.length + 1)), + Tj.vertex zPosition = z ∧ seed.length ≤ zPosition.val ∧ + ((seed.length < zPosition.val ∧ + beta ∈ MissingColors G rho1 z ∧ + ∀ r : Fin (Tj.length + 1), + seed.length < r.val → r.val < zPosition.val → + beta ∉ MissingColors G rho1 (Tj.vertex r)) ∨ + (zPosition = Fin.last Tj.length ∧ + ∀ r : Fin (Tj.length + 1), seed.length < r.val → + beta ∉ MissingColors G rho1 (Tj.vertex r))) ∧ + (∀ w ∈ TreeVerticesBefore Tj z hz, + beta ∉ MissingColors G rho1 w) ∧ + ∀ a : Fin Tj.length, seed.length ≤ a.val → + a.val < zPosition.val → rho1 (Tj.edge a) ≠ some beta := by + classical + let _ := Fintype.ofFinite V + have initial_subset {A B : TreeSequence G e0} + (h : TreeSequenceInitialSegment A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + obtain ⟨i, hi, hvi⟩ := hv + obtain ⟨hlen, hvertices, hedges⟩ := h + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, + (hvertices i).trans hvi⟩ + have reach_subset {A B : TreeSequence G e0} + (h : TashkinovAugmentationSequence phiJ A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + unfold TashkinovAugmentationSequence at h + induction h using Relation.ReflTransGen.head_induction_on with + | refl => exact Finset.Subset.rfl + | head hstep htail ih => + exact (initial_subset hstep.2.1).trans ih + have seed_subset_prime : TreeSequenceVertexSet seed ⊆ + TreeSequenceVertexSet TjPrime := initial_subset hseedPrime + have seed_subset_j : TreeSequenceVertexSet seed ⊆ + TreeSequenceVertexSet Tj := reach_subset haugmentation + have beta_seed : ∀ v ∈ TreeSequenceVertexSet seed, + beta ∉ MissingColors G rho1 v := by + intro v hv hvm + have hvp : v ∈ TreeSequenceVertexSet TjPrime := seed_subset_prime hv + have huv : u ≠ v := by + intro huv + apply huSeed + simpa [huv] using hv + have hd := hprimeElementary (u := v) (v := u) hvp huPrime huv.symm + exact (Finset.disjoint_left.1 hd) hvm hbetaU + let candidates := (Finset.univ : Finset (Fin (Tj.length + 1))).filter + (fun i => seed.length < i.val ∧ + beta ∈ MissingColors G rho1 (Tj.vertex i)) + have last_after : seed.length ≤ (Fin.last Tj.length).val := by + have hlen : seed.length ≤ Tj.length := by + exact Nat.le_trans hseedJ.1 (le_refl _) + simp + omega + have edge_missing := @helper_edge_missing_108 V E inferInstance inferInstance G k e0 Tj seed phiJ + by_cases hcandidates : candidates.Nonempty + · exact @helper_branch_155 V E inferInstance inferInstance inferInstance G k e0 Tj seed phiJ + rho1 terminalSupport beta gammaFirst hseedJ hseedTerminal hb2Missing hterminalRho + hterminalInclusion hbetaGamma haugmentation hb2Edges beta_seed edge_missing hcandidates + · exact @helper_branch_233 V E inferInstance inferInstance inferInstance G k e0 Tj seed phiJ + rho1 terminalSupport beta gammaFirst hseedJ hseedTerminal hb2Missing hterminalRho + hterminalInclusion hbetaGamma haugmentation hb2Edges beta_seed last_after edge_missing + hcandidates +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim43.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43.lean new file mode 100644 index 0000000000..45388ce359 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43.lean @@ -0,0 +1,157 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43EdgeEffects +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43MissingColors +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43Stability +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43TreeEdges +public import LeanPool.GoldbergSeymour.ExtensionRules + +/-! +# Extension Base Claim43 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseClaim43 {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot q : Fin ett.rounds) (hjle : jSlot.val ≤ q.val) + (hqTerminal : q.val + 1 = ett.rounds) + (_ : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE) + (_ : ett.series.data.chosenVertex q.succ = + some terminalSupport) + (_ : jSlot.val + 1 = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) + (sigmaN : PartialEdgeColoring E k) (C : Finset (Fin k)) + (hterminalJ : terminalSupport ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) + (hsigmaProper : IsProperEdgeColoring G sigmaN) + (hsigmaOne : IsOneEdgeUncolored sigmaN e0) + (hsigmaStable : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigmaN) + (hsigmaBefore : StableColoringBeforeVertex T terminalSupport + hterminalSupport C (ett.series.data.coloring jSlot.castSucc) sigmaN) + (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN) + (hinvariant : ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace) + (hunsupported : ∀ v : V, + v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) → + (∀ r : Fin ett.rounds, + r ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex r.succ ≠ some v) → + MissingColors G sigmaN v = + MissingColors G (ett.series.data.coloring jSlot.castSucc) v) + (hclassPrepared : ∀ w : V, + w ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) → + w ≠ terminalSupport → + (∃ t : Fin ett.rounds, + t ∈ ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport ∧ + ett.series.data.chosenVertex t.succ = some w) → + ∃ p : ℕ, ∃ indices : Fin (p + 1) → Fin ett.rounds, + ∃ gamma delta : Fin (p + 1) → Fin k, + (∀ a b, a.val < b.val → + (indices a).val < (indices b).val) ∧ + (∀ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w ↔ + ∃ a : Fin (p + 1), indices a = r) ∧ + (∀ a, ett.series.data.gamma (indices a).succ = some (gamma a)) ∧ + (∀ a, ett.series.data.delta (indices a).succ = some (delta a)) ∧ + (∀ a : Fin p, gamma a.succ = delta a.castSucc) ∧ + Function.Injective (Fin.cons (gamma 0) delta) ∧ + MissingColors G (ett.series.data.coloring jSlot.castSucc) w = + (MissingColors G sigmaN w \ {delta (Fin.last p)}) ∪ + {gamma 0}) : + let rho1 := trace.coloring (Fin.last trace.steps) + let restorationColors := + (ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport).biUnion fun t => ett.series.data.stored t.succ + StableColoringBeforeVertex T terminalSupport hterminalSupport C + (ett.series.data.coloring jSlot.castSucc) rho1 ∧ + ((∀ v : V, + v ∈ (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).erase + terminalSupport → + MissingColors G rho1 v = + MissingColors G (ett.series.data.coloring jSlot.castSucc) v) ∧ + MissingColors G rho1 terminalSupport = + MissingColors G sigmaN terminalSupport) ∧ + (∀ a : Fin (ett.series.data.tree jSlot.succ.castSucc).length, + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) = + sigmaN ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigmaN ((ett.series.data.tree jSlot.succ.castSucc).edge a) = + ett.series.data.coloring jSlot.castSucc + ((ett.series.data.tree jSlot.succ.castSucc).edge a)) ∧ + (∀ f : E, rho1 f ≠ sigmaN f → + f ∉ InternalEdges G + (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) ∧ + ∃ c d : Fin k, sigmaN f = some c ∧ rho1 f = some d ∧ + c ∈ restorationColors ∧ d ∈ restorationColors) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport → + s ≠ q → + ett.series.data.chosenVertex s.succ = some terminalSupport → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport rho1 gammaS deltaS := by + dsimp + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · exact ExtensionBaseClaim43Stability ett terminalSupport hterminalSupport + jSlot q sigmaN (ett.series.data.coloring jSlot.castSucc) C hterminalJ trace hinvariant + hsigmaBefore + · exact ExtensionBaseClaim43MissingColors ett terminalSupport hterminalSupport + jSlot q sigmaN (ett.series.data.coloring jSlot.castSucc) hterminalJ trace + hinvariant hunsupported hclassPrepared + · exact ExtensionBaseClaim43TreeEdges ett terminalSupport hterminalSupport + jSlot q hjle hqTerminal sigmaN hsigmaProper hsigmaOne hsigmaStable trace + hinvariant + · exact ExtensionBaseClaim43EdgeEffects ett terminalSupport hterminalSupport + jSlot q sigmaN trace hinvariant + · intro s gammaS deltaS hs hneq hchosen hgamma hdelta + have hactive : s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport := by + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at hs + exact hs.1 + have hnoTrace : ∀ a : Fin trace.steps, trace.slot a ≠ s := by + intro a ha + have hrest : trace.slot a ∈ + ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport := by + rw [← trace.enumerates] + exact Finset.mem_image.mpr ⟨a, Finset.mem_univ _, rfl⟩ + have hdiff : trace.slot a ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport ∧ + trace.slot a ∉ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport := by + simpa [ExtensionBaseRestorationIndices] using hrest + exact hdiff.2 (by simpa [ha]) + exact hinvariant.2.2 s terminalSupport gammaS deltaS hactive hneq hnoTrace + hchosen hgamma hdelta + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim43EdgeEffects.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43EdgeEffects.lean new file mode 100644 index 0000000000..8ac249ae14 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43EdgeEffects.lean @@ -0,0 +1,439 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationInvariant + +public import LeanPool.GoldbergSeymour.InternalEdges + +/-! +# Extension Base Claim43Edge Effects + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ExtensionBaseClaim43EdgeEffects_transitionFact_62.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] {G + : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} {T : + TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k + e0 input T generating) (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds) (sigmaN : PartialEdgeColoring E k) + (trace : ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), + ExtensionBaseRestorationInvariant ett terminalSupport hterminalSupport jSlot q sigmaN + trace → ∀ (f : E), let colors := (ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport).biUnion fun (t : Fin ett.rounds) => ett.series.data.stored t.succ; ∀ (b + : Fin trace.steps), trace.coloring b.succ f ≠ trace.coloring b.castSucc f → ∃ (c : Fin k) + (d : Fin k), trace.coloring b.castSucc f = some c ∧ trace.coloring b.succ f = some d ∧ c ∈ + colors ∧ d ∈ colors := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN + trace hinvariant f colors b hdiff + have hb := hinvariant.2.1 b + have hslot : trace.slot b ∈ ExtensionBaseRestorationIndices ett + terminalSupport hterminalSupport := hb.1 + have hactive : trace.slot b ∈ ExtensionBaseActiveIndices ett + terminalSupport hterminalSupport := by + have hsplit : trace.slot b ∈ ExtensionBaseActiveIndices ett + terminalSupport hterminalSupport \ + ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport := by + simpa [ExtensionBaseRestorationIndices] using hslot + exact (Finset.mem_sdiff.mp hsplit).1 + have hkind : ett.series.data.kind (trace.slot b).succ = + some TashkinovExtensionKind.PE := by + have hh := hactive + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] at hh + exact hh.2.1 + generalize targetEq : (trace.slot b).succ = target + have cert := ett.series.certified target + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have : (trace.slot b).val + 1 = 0 := by simpa using congrArg Fin.val targetEq + omega + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have tv := congrArg Fin.val targetEq + have ciEq : ci = trace.slot b := by + apply Fin.ext + simp at tv ⊢ + omega + subst ci + rw [currentKind] at hkind + simp at hkind + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have tv := congrArg Fin.val targetEq + have ciEq : ci = trace.slot b := by + apply Fin.ext + simp at tv ⊢ + omega + subst ci + rw [currentKind] at hkind + simp at hkind + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have tv := congrArg Fin.val targetEq + have ciEq : ci = trace.slot b := by + apply Fin.ext + simp at tv ⊢ + omega + subst ci + have hstored : ett.series.data.stored (trace.slot b).succ = + {choice.color, gamma} := currentStored + have hgamma : trace.gamma b = gamma := by + apply Option.some.inj + exact (trace.gammaField b).symm.trans currentGamma + have hdelta : trace.delta b = choice.color := by + apply Option.some.inj + exact (trace.deltaField b).symm.trans currentDelta + have hcolorMem : ∀ x : Fin k, x ∈ + ett.series.data.stored (trace.slot b).succ → x ∈ colors := by + intro x hx + apply Finset.mem_biUnion.mpr + exact ⟨trace.slot b, hslot, hx⟩ + have hgammaMem : trace.gamma b ∈ colors := by + apply hcolorMem + rw [hgamma, hstored] + simp + have hdeltaMem : trace.delta b ∈ colors := by + apply hcolorMem + rw [hdelta, hstored] + simp + have hmem : Sum.inr f ∈ TwoColorComponent G + (trace.coloring b.castSucc) (trace.gamma b) (trace.delta b) + (Sum.inl (trace.support b)) := by + by_contra hn + have heq : trace.coloring b.succ f = trace.coloring b.castSucc f := by + rw [trace.transition b] + simp [TwoColorComponentSwap, hn] + exact hdiff heq + have hpre : trace.coloring b.castSucc f = some (trace.gamma b) ∨ + trace.coloring b.castSucc f = some (trace.delta b) := by + by_cases hg : trace.coloring b.castSucc f = some (trace.gamma b) + · exact Or.inl hg + by_cases hd : trace.coloring b.castSucc f = some (trace.delta b) + · exact Or.inr hd + have heq : trace.coloring b.succ f = trace.coloring b.castSucc f := by + rw [trace.transition b] + simp [TwoColorComponentSwap, hmem, hg, hd] + exact (hdiff heq).elim + have hpost : trace.coloring b.succ f = some (trace.delta b) ∨ + trace.coloring b.succ f = some (trace.gamma b) := by + rcases hpre with hg | hd + · left + rw [trace.transition b] + simp [TwoColorComponentSwap, hmem, hg] + · right + rw [trace.transition b] + simp [TwoColorComponentSwap, hmem, hd] + rcases hpre with hg | hd <;> rcases hpost with hp | hp + · exact ⟨trace.gamma b, trace.delta b, hg, hp, hgammaMem, hdeltaMem⟩ + · exact ⟨trace.gamma b, trace.gamma b, hg, hp, hgammaMem, hgammaMem⟩ + · exact ⟨trace.delta b, trace.delta b, hd, hp, hdeltaMem, hdeltaMem⟩ + · exact ⟨trace.delta b, trace.gamma b, hd, hp, hdeltaMem, hgammaMem⟩ + +private theorem helper_continuation_306.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds) (sigmaN : + PartialEdgeColoring E k) (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN), ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace → + ∀ (f : E), + let colors : Finset (Fin k) := (ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport).biUnion fun (t : Fin ett.rounds) => ett.series.data.stored t.succ; ( + ∀ (b : Fin trace.steps), trace.coloring b.succ f ≠ trace.coloring b.castSucc f → + ∃ (c : Fin k) (d : Fin k), trace.coloring b.castSucc f = some c ∧ trace.coloring b.succ f = + some d ∧ c ∈ colors ∧ d ∈ colors) → + let changes : Finset (Fin trace.steps) := + {b : Fin trace.steps | trace.coloring b.succ f ≠ trace.coloring b.castSucc f}; ( + ∀ (b : Fin trace.steps), b ∈ changes ↔ trace.coloring b.succ f ≠ trace.coloring b.castSucc f) + → + ∀ (changesNonempty : changes.Nonempty), + let first : Fin trace.steps := changes.min' changesNonempty; + let last : Fin trace.steps := changes.max' changesNonempty; first ∈ changes → last ∈ changes → + ( + ∀ (b : Fin trace.steps), (↑last : ℕ) < (↑b : ℕ) → b ∉ changes) → trace.coloring first.castSucc + f = sigmaN f → ( + ∀ (n : ℕ) (hn : n ≤ trace.steps), ( + ∀ (b : Fin trace.steps), n ≤ (↑b : ℕ) → b ∉ changes) → trace.coloring (Fin.last trace.steps) f + = trace.coloring (⟨n, Nat.lt_succ_of_le hn⟩ : Fin (trace.steps + (1 : ℕ))) f) → f ∉ + InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree jSlot.castSucc.succ)) ∧ + ∃ (c : Fin k) (d : Fin k), sigmaN f = some c ∧ trace.coloring (Fin.last trace.steps) f = some + d ∧ (c ∈ (ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport).biUnion + fun (t : Fin ett.rounds) => ett.series.data.stored t.succ) ∧ d ∈ + (ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport).biUnion fun (t : + Fin ett.rounds) => ett.series.data.stored t.succ + := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN + trace hinvariant f colors transitionFact changes changesSpec changesNonempty first last + firstMem lastMem afterLast firstValue finalFrom + have firstData := transitionFact first + ((changesSpec first).1 firstMem) + have lastData := transitionFact last + ((changesSpec last).1 lastMem) + have lastValue : trace.coloring last.succ f = + trace.coloring (Fin.last trace.steps) f := by + have htail := finalFrom (last.val + 1) (by omega) + (fun b hb => afterLast b (by omega)) + have hi : (⟨last.val + 1, by omega⟩ : Fin (trace.steps + 1)) = last.succ := by + apply Fin.ext + simp + rw [hi] at htail + exact htail.symm + rcases firstData with ⟨c, c', hc, hc', hcMem, hc'Mem⟩ + rcases lastData with ⟨d', d, hd', hd, hd'Mem, hdMem⟩ + have initialColor : sigmaN f = some c := firstValue ▸ hc + have finalColor : trace.coloring (Fin.last trace.steps) f = some d := by + rw [← lastValue] + exact hd + refine ⟨?_, c, d, initialColor, finalColor, hcMem, hdMem⟩ + intro hf + have internal : ∀ v : V, Incident G v f → + v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) := by + simpa [InternalEdges] using hf + have hb := hinvariant.2.1 first + have segment := hb.2.2.1 + have exactIntersection := hb.2.2.2.2.2.2.1 + clear hb + rcases segment with ⟨hlen, vertexEntries, edgeEntries⟩ + let currentTree := ett.series.data.tree (trace.slot first).succ.castSucc + have vertexTransfer : ∀ v : V, + v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) → + v ∈ TreeSequenceVertexSet currentTree := by + intro v hv + simp only [TreeSequenceVertexSet, Fin.castSucc_succ, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + rcases hv with ⟨i, hi⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, ?_⟩ + exact (vertexEntries i).trans hi + have edgeMem : Sum.inr f ∈ TwoColorComponent G + (trace.coloring first.castSucc) + (trace.gamma first) (trace.delta first) + (Sum.inl (trace.support first)) := by + by_contra hn + have heq : trace.coloring first.succ f = trace.coloring first.castSucc f := by + rw [trace.transition first] + simp [TwoColorComponentSwap, hn] + exact (changesSpec first).1 firstMem heq + have preKinds : trace.coloring first.castSucc f = some (trace.gamma first) ∨ + trace.coloring first.castSucc f = some (trace.delta first) := by + by_cases hg : trace.coloring first.castSucc f = some (trace.gamma first) + · exact Or.inl hg + by_cases hdg : trace.coloring first.castSucc f = some (trace.delta first) + · exact Or.inr hdg + have heq : trace.coloring first.succ f = trace.coloring first.castSucc f := by + rw [trace.transition first] + simp [TwoColorComponentSwap, edgeMem, hg, hdg] + exact ((changesSpec first).1 firstMem heq).elim + have endpointComponent : + ∀ v : V, Incident G v f → Sum.inl v ∈ TwoColorComponent G (trace.coloring first.castSucc) + (trace.gamma first) (trace.delta first) (Sum.inl (trace.support first)) := by + intro v hv + let H := TwoColorIncidenceGraph G (trace.coloring first.castSucc) + (trace.gamma first) (trace.delta first) + have hadj : H.Adj (Sum.inl v) (Sum.inr f) := by + simp [H, TwoColorIncidenceGraph, hv, preKinds] + have hcc : H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inr f) := + SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + have hedge : H.connectedComponentMk (Sum.inr f) = + H.connectedComponentMk (Sum.inl (trace.support first)) := by + change H.connectedComponentMk (Sum.inr f) = + H.connectedComponentMk (Sum.inl (trace.support first)) at edgeMem + exact edgeMem + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inl (trace.support first)) + exact hcc.trans hedge + have contradiction : ∀ z : Sym2 V, z = G.ends f → False := by + intro z hz + induction z using Sym2.inductionOn with + | _ x y => + have hends : G.ends f = s(x, y) := hz.symm + have hxj : x ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) := by + exact internal x (by change x ∈ G.ends f; rw [hends]; exact Sym2.mem_mk_left _ _) + have hyj : y ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) := by + exact internal y (by change y ∈ G.ends f; rw [hends]; exact Sym2.mem_mk_right _ _) + have hxcur := vertexTransfer x hxj + have hycur := vertexTransfer y hyj + have hx : x = trace.support first := + (exactIntersection x hxcur).mp (endpointComponent x (by + change x ∈ G.ends f; rw [hends]; exact Sym2.mem_mk_left _ _)) + have hy : y = trace.support first := + (exactIntersection y hycur).mp (endpointComponent y (by + change y ∈ G.ends f; rw [hends]; exact Sym2.mem_mk_right _ _)) + apply G.loopless f x + simpa [hx, hy] using hends + exact contradiction (G.ends f) rfl + +theorem ExtensionBaseClaim43EdgeEffects {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot q : Fin ett.rounds) (sigmaN : PartialEdgeColoring E k) + (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN) + (hinvariant : ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace) : + let rho1 := trace.coloring (Fin.last trace.steps) + let restorationColors := + (ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport).biUnion fun t => ett.series.data.stored t.succ + ∀ f : E, rho1 f ≠ sigmaN f → + f ∉ InternalEdges G + (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) ∧ + ∃ c d : Fin k, sigmaN f = some c ∧ rho1 f = some d ∧ + c ∈ restorationColors ∧ d ∈ restorationColors := by + classical + dsimp + intro f hchange + let colors := (ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport).biUnion fun t => ett.series.data.stored t.succ + have transitionFact : ∀ b : Fin trace.steps, + trace.coloring b.succ f ≠ trace.coloring b.castSucc f → + ∃ c d : Fin k, trace.coloring b.castSucc f = some c ∧ + trace.coloring b.succ f = some d ∧ c ∈ colors ∧ d ∈ colors := by + exact @ExtensionBaseClaim43EdgeEffects_transitionFact_62 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport + hterminalSupport jSlot q sigmaN trace hinvariant f + let changes : Finset (Fin trace.steps) := Finset.univ.filter fun b => + trace.coloring b.succ f ≠ trace.coloring b.castSucc f + have changesSpec (b : Fin trace.steps) : b ∈ changes ↔ + trace.coloring b.succ f ≠ trace.coloring b.castSucc f := by + simp [changes] + have changesNonempty : changes.Nonempty := by + by_contra hn + have noChange : ∀ b : Fin trace.steps, + trace.coloring b.succ f = trace.coloring b.castSucc f := by + intro b + by_contra hd + exact hn ⟨b, (changesSpec b).2 hd⟩ + have walk : ∀ n (hn : n ≤ trace.steps), + trace.coloring ⟨n, Nat.lt_succ_of_le hn⟩ f = sigmaN f := by + intro n hn + induction n with + | zero => simpa using congrFun trace.initialColoring f + | succ n ih => + let b : Fin trace.steps := ⟨n, Nat.lt_of_succ_le hn⟩ + have he := congrFun (trace.transition b) f + have hp := ih (Nat.le_of_succ_le hn) + have hq : trace.coloring b.succ f = trace.coloring b.castSucc f := noChange b + have hprev : b.castSucc = (⟨n, Nat.lt_succ_of_le (Nat.le_of_succ_le hn)⟩ : + Fin (trace.steps + 1)) := by apply Fin.ext; simp [b] + rw [hprev, hp] at hq + have hi : (⟨n + 1, Nat.lt_succ_of_le hn⟩ : Fin (trace.steps + 1)) = b.succ := by + apply Fin.ext + simp [b] + rw [hi, he] + exact he.symm.trans hq + have hi : (⟨trace.steps, Nat.lt_succ_of_le le_rfl⟩ : Fin (trace.steps + 1)) = + Fin.last trace.steps := by apply Fin.ext; simp + exact hchange (hi ▸ walk trace.steps le_rfl) + let first := changes.min' changesNonempty + let last := changes.max' changesNonempty + have firstMem : first ∈ changes := Finset.min'_mem changes changesNonempty + have lastMem : last ∈ changes := Finset.max'_mem changes changesNonempty + have beforeFirst (b : Fin trace.steps) (hlt : b.val < first.val) : b ∉ changes := by + intro hb + exact (Nat.not_lt_of_ge (Finset.min'_le changes b hb)) hlt + have afterLast (b : Fin trace.steps) (hlt : last.val < b.val) : b ∉ changes := by + intro hb + exact (Nat.not_lt_of_ge (Finset.le_max' changes b hb)) hlt + have firstValue : trace.coloring first.castSucc f = sigmaN f := by + have walk : ∀ n (hn : n ≤ trace.steps), + (∀ b : Fin trace.steps, b.val < n → b ∉ changes) → + trace.coloring ⟨n, Nat.lt_succ_of_le hn⟩ f = sigmaN f := by + intro n hn + induction n with + | zero => intro h; simpa using congrFun trace.initialColoring f + | succ n ih => + intro hbefore + let b : Fin trace.steps := ⟨n, Nat.lt_of_succ_le hn⟩ + have he := congrFun (trace.transition b) f + have hb : b ∉ changes := hbefore b (by simp [b]) + have hsame : trace.coloring b.succ f = trace.coloring b.castSucc f := by + apply Classical.byContradiction + intro hd + exact hb ((changesSpec b).2 hd) + have hp := ih (Nat.le_of_succ_le hn) (fun c hc => hbefore c (by omega)) + have hi : (⟨n + 1, Nat.lt_succ_of_le hn⟩ : Fin (trace.steps + 1)) = b.succ := by + apply Fin.ext + simp [b] + have hprev : b.castSucc = (⟨n, Nat.lt_succ_of_le (Nat.le_of_succ_le hn)⟩ : + Fin (trace.steps + 1)) := by apply Fin.ext; simp [b] + rw [hi] + calc + trace.coloring b.succ f = trace.coloring b.castSucc f := hsame + _ = sigmaN f := by rw [hprev, hp] + have hi : (⟨first.val, Nat.lt_succ_of_le first.isLt.le⟩ : Fin (trace.steps + 1)) = + first.castSucc := by apply Fin.ext; simp + rw [← hi] + exact walk first.val first.isLt.le (fun b hb => beforeFirst b hb) + have finalFrom : ∀ n (hn : n ≤ trace.steps), + (∀ b : Fin trace.steps, n ≤ b.val → b ∉ changes) → + trace.coloring (Fin.last trace.steps) f = + trace.coloring ⟨n, Nat.lt_succ_of_le hn⟩ f := by + intro n hn + induction hrem : trace.steps - n using Nat.strong_induction_on generalizing n with + | h rem ih => + intro hafter + by_cases heq : n = trace.steps + · subst n + rfl + · have hnlt : n < trace.steps := Nat.lt_of_le_of_ne hn heq + let b : Fin trace.steps := ⟨n, hnlt⟩ + have hsame : trace.coloring b.succ f = trace.coloring b.castSucc f := by + apply Classical.byContradiction + intro hd + exact hafter b (by simp [b]) ((changesSpec b).2 hd) + have htail := ih (trace.steps - (n + 1)) (by omega) (n + 1) + (by omega) rfl (fun c hc => hafter c (by omega)) + have he := congrFun (trace.transition b) f + have hprev : b.castSucc = (⟨n, Nat.lt_succ_of_le (Nat.le_of_lt hnlt)⟩ : + Fin (trace.steps + 1)) := by apply Fin.ext; simp [b] + have hnext : (⟨n + 1, by omega⟩ : + Fin (trace.steps + 1)) = b.succ := by apply Fin.ext; simp [b] + rw [hnext] at htail + calc + trace.coloring (Fin.last trace.steps) f = trace.coloring b.succ f := htail + _ = trace.coloring b.castSucc f := hsame + _ = trace.coloring ⟨n, Nat.lt_succ_of_le (Nat.le_of_lt hnlt)⟩ f := by rw [hprev] + exact @helper_continuation_306 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN trace hinvariant + f transitionFact changesSpec changesNonempty firstMem lastMem afterLast firstValue finalFrom +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim43MissingColors.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43MissingColors.lean new file mode 100644 index 0000000000..5f24e9f6cc --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43MissingColors.lean @@ -0,0 +1,1056 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimMissingColors + +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationInvariant + +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors + +/-! +# Extension Base Claim43Missing Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_edgeOutside_99.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds) (sigmaN : + PartialEdgeColoring E k) (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN), ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace → ( + ∀ (A B : TreeSequence G e0), TreeSequenceInitialSegment A B → + ∀ v ∈ TreeSequenceVertexSet A, v ∈ TreeSequenceVertexSet B) → + ∀ (a : Fin trace.steps), + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), v ≠ trace.support a → + ∀ (f : E), Incident G v f → Sum.inr f ∉ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl (trace.support a)) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN + trace hinvariant vertexTransfer a v hv hvSupport f hvf hf + have stepInvariant := hinvariant.2.1 a + rcases stepInvariant.2.2 with + ⟨segment, supportInTree, deltaMissing, pathComponent, + exactIntersection, remaining⟩ + have hvCurrent : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (trace.slot a).succ.castSucc) := + vertexTransfer _ _ segment v hv + have endpoint : Sum.inl v ∈ TwoColorComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl (trace.support a)) := by + let H := TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) + have edgeSupport : Sum.inr f ∈ H.support := by + apply SimpleGraph.mem_support_of_reachable + (G := H) (u := Sum.inr f) (v := Sum.inl (trace.support a)) + · simp + · exact SimpleGraph.ConnectedComponent.eq.mp hf + obtain ⟨x, hx⟩ := H.mem_support.mp edgeSupport + have active : trace.coloring a.castSucc f = some (trace.gamma a) ∨ + trace.coloring a.castSucc f = some (trace.delta a) := by + cases x with + | inl x => exact hx.2 + | inr x => simp [H, TwoColorIncidenceGraph] at hx + have adjacent : H.Adj (Sum.inl v) (Sum.inr f) := by + simp [H, TwoColorIncidenceGraph, hvf, active] + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inl (trace.support a)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + adjacent).trans hf + exact hvSupport ((exactIntersection v hvCurrent).mp endpoint) + +private theorem helper_rootExchange_162.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds) (sigmaN : + PartialEdgeColoring E k) (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN), ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace → + ∀ (a : Fin trace.steps), MissingColors G (trace.coloring a.succ) (trace.support a) = + MissingColors G (trace.coloring a.castSucc) (trace.support a) \ {trace.delta a} ∪ + {trace.gamma a} := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN + trace hinvariant a + have stepInvariant := hinvariant.2.1 a + rcases stepInvariant.2.2 with + ⟨segment, supportInTree, deltaMissing, pathComponent, + exactIntersection, remaining⟩ + let phi := trace.coloring a.castSucc + let gamma := trace.gamma a + let delta := trace.delta a + let v := trace.support a + have deltaNotPresent : delta ∉ PresentColors G phi v := by + simpa [MissingColors] using deltaMissing + have gammaPresent : gamma ∈ PresentColors G phi v := by + obtain ⟨f, hf⟩ := pathComponent.2 + let H := TwoColorIncidenceGraph G phi gamma delta + have rootSupport : Sum.inl v ∈ H.support := by + apply SimpleGraph.mem_support_of_reachable + (G := H) (u := Sum.inl v) (v := Sum.inr f) + · simp + · exact SimpleGraph.ConnectedComponent.eq.mp hf.symm + obtain ⟨x, hx⟩ := H.mem_support.mp rootSupport + cases x with + | inl x => simp [H, TwoColorIncidenceGraph] at hx + | inr e => + have hxe : Incident G v e ∧ + (phi e = some gamma ∨ phi e = some delta) := by + simpa [H, TwoColorIncidenceGraph] using hx + rcases hxe with ⟨hve, hcolor | hcolor⟩ + · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hve, hcolor⟩ + · exact (deltaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hve, hcolor⟩)).elim + have gammaNeDelta : gamma ≠ delta := by + intro h + apply deltaNotPresent + simpa [h] using gammaPresent + have edgeMember : ∀ e : E, Incident G v e → + (phi e = some gamma ∨ phi e = some delta) → + Sum.inr e ∈ TwoColorComponent G phi gamma delta (Sum.inl v) := by + intro e hve hcolor + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, hve, hcolor] + have presentStep : + ∀ c : Fin k, c ∈ PresentColors G (TwoColorComponentSwap G phi gamma delta (Sum.inl v)) v ↔ c = + delta ∨ (c ≠ gamma ∧ c ∈ PresentColors G phi v) := by + intro c + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + constructor + · rintro ⟨e, hve, hec⟩ + by_cases hcomp : Sum.inr e ∈ + TwoColorComponent G phi gamma delta (Sum.inl v) + · by_cases hgamma : phi e = some gamma + · have value := hec + simp [TwoColorComponentSwap, hcomp, hgamma] at value + exact Or.inl value.symm + · by_cases hdelta : phi e = some delta + · exact (deltaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hve, hdelta⟩)).elim + · right + have value := hec + simp only [TwoColorComponentSwap, hcomp, ↓reduceIte, hgamma, hdelta] at value + refine ⟨?_, ⟨e, hve, value⟩⟩ + intro hc + apply hgamma + simpa [hc] using value + · right + have value := hec + simp only [TwoColorComponentSwap, hcomp, ↓reduceIte] at value + refine ⟨?_, ⟨e, hve, value⟩⟩ + intro hc + apply hcomp + apply edgeMember e hve + left + simpa [hc] using value + · rintro (rfl | ⟨hcGamma, ⟨e, hve, hec⟩⟩) + · obtain ⟨e, hve, heGamma⟩ := by + simpa [PresentColors] using gammaPresent + refine ⟨e, hve, ?_⟩ + simp [TwoColorComponentSwap, + edgeMember e hve (Or.inl heGamma), heGamma] + · refine ⟨e, hve, ?_⟩ + by_cases hgamma : phi e = some gamma + · exact False.elim (hcGamma (Option.some.inj (hec.symm.trans hgamma))) + · by_cases hdelta : phi e = some delta + · exact False.elim (deltaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hve, hdelta⟩)) + · simp only [TwoColorComponentSwap, hgamma, ↓reduceIte, hdelta, ite_self] + exact hec + have exchange : MissingColors G + (TwoColorComponentSwap G phi gamma delta (Sum.inl v)) v = + (MissingColors G phi v \ {delta}) ∪ {gamma} := by + apply Finset.ext + intro c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_union, + Finset.mem_singleton, Finset.mem_univ, true_and] + rw [presentStep] + by_cases hcDelta : c = delta <;> + by_cases hcGamma : c = gamma <;> + simp [hcDelta, hcGamma, gammaNeDelta, gammaNeDelta.symm] + rw [trace.transition] + exact exchange + +private theorem helper_hposReverse_329.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ : ( + ∀ (a b : Fin (p + (1 : ℕ))) (_ : (↑a : ℕ) < (↑b : ℕ)), (↑(indices a) : ℕ) < (↑(indices b) : + ℕ))) (hpositionExists : + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (s : Fin trace.steps), trace.slot s = indices a), + let pos : Fin (p + (1 : ℕ)) → Fin trace.steps := fun (a : Fin (p + (1 : ℕ))) => + Classical.choose (hpositionExists a); + ∀ (_ : ( + ∀ (a : Fin (p + (1 : ℕ))), trace.slot (pos a) = indices a)) (a b : Fin (p + (1 : ℕ))) (_ : (↑a + : ℕ) < (↑b : ℕ)), (↑(pos b) : ℕ) < (↑(pos a) : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace p + indices hincreasing hpositionExists pos hposSlot a b hab + have hindices := hincreasing a b hab + by_contra hnot + have hle : (pos a).val ≤ (pos b).val := Nat.le_of_not_gt hnot + rcases lt_or_eq_of_le hle with hlt | heq + · have hdesc := trace.strictlyDescending (pos a) (pos b) hlt + rw [hposSlot, hposSlot] at hdesc + omega + · have hposEq : pos a = pos b := Fin.ext heq + have hindexEq : indices a = indices b := by + rw [← hposSlot a, ← hposSlot b, hposEq] + have hvalEq := congrArg Fin.val hindexEq + omega + +private theorem helper_hsupportPosition_356.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds) (sigmaN : + PartialEdgeColoring E k) (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN) (_ : ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace) (v : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin + ett.rounds) (_ : ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport v ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r)) (hpositionExists : + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (s : Fin trace.steps), trace.slot s = indices a), + let pos : Fin (p + (1 : ℕ)) → Fin trace.steps := fun (a : Fin (p + (1 : ℕ))) => + Classical.choose (hpositionExists a); + ∀ (_ : ( + ∀ (a : Fin (p + (1 : ℕ))), trace.slot (pos a) = indices a)) (_ : ( + ∀ (a : Fin (p + (1 : ℕ))), trace.support (pos a) = v)) (_ : Function.Injective trace.slot) (s + : Fin trace.steps), trace.support s = v ↔ + ∃ (a : Fin (p + (1 : ℕ))), pos a = s := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN + trace hinvariant v p indices hclass hpositionExists pos hposSlot hposSupport hslotInjective s + constructor + · intro hs + have hsRestoration := (hinvariant.2.1 s).1 + have hsActive := (Finset.mem_sdiff.mp hsRestoration).1 + have hsClass : trace.slot s ∈ + ExtensionBaseSupportClass ett terminalSupport hterminalSupport v := by + simp only [ExtensionBaseSupportClass, Finset.mem_filter] + exact ⟨hsActive, by simpa [hs] using trace.chosenVertex s⟩ + obtain ⟨a, ha⟩ := (hclass (trace.slot s)).mp hsClass + refine ⟨a, hslotInjective ?_⟩ + exact (hposSlot a).trans ha + · rintro ⟨a, rfl⟩ + exact hposSupport a + +private theorem helper_rootGammaPresent_371.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot q : Fin ett.rounds) (sigmaN : PartialEdgeColoring E k) + (trace : ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), + ExtensionBaseRestorationInvariant ett terminalSupport hterminalSupport jSlot q sigmaN + trace → + ∀ (_ : V) (p : ℕ) (_ _ : Fin (p + (1 : ℕ)) → Fin k) (s : Fin trace.steps), + trace.gamma s ∈ PresentColors G (trace.coloring s.castSucc) (trace.support s) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN + trace hinvariant v p gamma delta s + have stepInvariant := hinvariant.2.1 s + rcases stepInvariant.2.2 with + ⟨segment, supportInTree, deltaMissing, pathComponent, + exactIntersection, remaining⟩ + have deltaNotPresent : trace.delta s ∉ + PresentColors G (trace.coloring s.castSucc) (trace.support s) := by + simpa [MissingColors] using deltaMissing + obtain ⟨f, hf⟩ := pathComponent.2 + let H := TwoColorIncidenceGraph G (trace.coloring s.castSucc) + (trace.gamma s) (trace.delta s) + have rootSupport : Sum.inl (trace.support s) ∈ H.support := by + apply SimpleGraph.mem_support_of_reachable + (G := H) (u := Sum.inl (trace.support s)) (v := Sum.inr f) + · simp + · exact SimpleGraph.ConnectedComponent.eq.mp hf.symm + obtain ⟨x, hx⟩ := H.mem_support.mp rootSupport + cases x with + | inl x => simp [H, TwoColorIncidenceGraph] at hx + | inr e => + have hxe : Incident G (trace.support s) e ∧ + (trace.coloring s.castSucc e = some (trace.gamma s) ∨ + trace.coloring s.castSucc e = some (trace.delta s)) := by + simpa [H, TwoColorIncidenceGraph] using hx + rcases hxe with ⟨hse, hcolor | hcolor⟩ + · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hse, hcolor⟩ + · exact (deltaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hse, hcolor⟩)).elim + +private theorem helper_offSupportInterval_409.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot : Fin ett.rounds) (sigmaN : + PartialEdgeColoring E k) (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN), ( + ∀ (a : Fin trace.steps), + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), v ≠ trace.support a → + MissingColors G (trace.coloring a.succ) v = MissingColors G (trace.coloring a.castSucc) v) + → + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), + ∀ (n m : ℕ) (hn : n ≤ trace.steps) (hm : m ≤ n), ( + ∀ (s : Fin trace.steps), m ≤ (↑s : ℕ) → (↑s : ℕ) < n → trace.support s ≠ v) → MissingColors G + (trace.coloring (⟨n, Nat.lt_succ_of_le hn⟩ : Fin (trace.steps + (1 : ℕ)))) v = + MissingColors G (trace.coloring (⟨m, Nat.lt_succ_of_le (LE.le.trans hm hn)⟩ : Fin + (trace.steps + (1 : ℕ)))) v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot sigmaN + trace offSupportStep v hv n + induction n with + | zero => + intro m hn hm hOff + have hmZero : m = 0 := by omega + subst m + rfl + | succ n ih => + intro m hn hm hOff + by_cases hmTop : m = n + 1 + · subst m + rfl + · have hmPrev : m ≤ n := by omega + let s : Fin trace.steps := ⟨n, Nat.lt_of_succ_le hn⟩ + have hsOff : trace.support s ≠ v := + hOff s hmPrev (Nat.lt_succ_self n) + have hstep := offSupportStep s v hv (Ne.symm hsOff) + have hprevious := ih m (Nat.le_of_succ_le hn) hmPrev (by + intro t hmt htn + exact hOff t hmt (Nat.lt_succ_of_lt htn)) + have hstep' : + MissingColors G + (trace.coloring + ⟨n + 1, Nat.lt_succ_of_le hn⟩) v = + MissingColors G + (trace.coloring + ⟨n, Nat.lt_succ_of_le (Nat.le_of_succ_le hn)⟩) v := by + simpa [s] using hstep + exact hstep'.trans hprevious + +private theorem helper_intermediateInitiallyPresent_477.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot : Fin ett.rounds) (sigmaN : + PartialEdgeColoring E k) (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN) (_ : ( + ∀ (a : Fin trace.steps), + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), v ≠ trace.support a → + MissingColors G (trace.coloring a.succ) v = MissingColors G (trace.coloring a.castSucc) + v)) (_ : ( + ∀ (a : Fin trace.steps), MissingColors G (trace.coloring a.succ) (trace.support a) = + MissingColors G (trace.coloring a.castSucc) (trace.support a) \ {trace.delta a} ∪ + {trace.gamma a})), + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), + ∀ (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (gamma delta : Fin (p + (1 : ℕ)) → + Fin k), ( + ∀ (a : Fin p), gamma a.succ = delta a.castSucc) → + ∀ (hpositionExists : + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (s : Fin trace.steps), trace.slot s = indices a), + let pos : Fin (p + (1 : ℕ)) → Fin trace.steps := fun (a : Fin (p + (1 : ℕ))) => + Classical.choose (hpositionExists a); ( + ∀ (a : Fin (p + (1 : ℕ))), trace.support (pos a) = v) → ( + ∀ (a : Fin (p + (1 : ℕ))), trace.gamma (pos a) = gamma a) → ( + ∀ (a : Fin (p + (1 : ℕ))), trace.delta (pos a) = delta a) → ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑(pos b) : ℕ) < (↑(pos a) : ℕ) ↔ (↑a : ℕ) < (↑b : ℕ)) → ( + ∀ (s : Fin trace.steps), trace.support s = v ↔ + ∃ (a : Fin (p + (1 : ℕ))), pos a = s) → ( + ∀ (s : Fin trace.steps), trace.gamma s ∉ MissingColors G (trace.coloring s.castSucc) + (trace.support s)) → ( + ∀ (a : Fin p) (b : Fin (p + (1 : ℕ))), (↑a.succ : ℕ) < (↑b : ℕ) → delta a.castSucc ≠ delta b) + → ( + ∀ (a : Fin p) (b : Fin (p + (1 : ℕ))), (↑a.succ : ℕ) < (↑b : ℕ) → delta a.castSucc ≠ gamma b) + → + ∀ (a : Fin p), delta a.castSucc ∉ MissingColors G sigmaN v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot sigmaN + trace offSupportStep rootExchange v hv p indices gamma delta hchain hpositionExists pos + hposSupport hposGamma hposDelta hposOrder hsupportPosition rootGammaNotMissing + deltaNeLaterDelta deltaNeLaterGamma a + let target : Fin (p + 1) := a.succ + let c : Fin k := delta a.castSucc + have membershipPreserved : + ∀ (n : ℕ) (hn : n ≤ (pos target).val), (c ∈ MissingColors G (trace.coloring ⟨n, + by omega + ⟩) v ↔ c ∈ MissingColors G sigmaN v) := by + intro n + induction n with + | zero => + intro hn + simpa [c] using (Finset.ext_iff.mp + (congrArg (fun phi => MissingColors G phi v) + trace.initialColoring) c) + | succ n ih => + intro hn + have hnPrev : n ≤ (pos target).val := by omega + have hprevious := ih hnPrev + let s : Fin trace.steps := ⟨n, by omega⟩ + have hstep : + (c ∈ MissingColors G (trace.coloring s.succ) v ↔ + c ∈ MissingColors G (trace.coloring s.castSucc) v) := by + by_cases hs : trace.support s = v + · obtain ⟨b, hb⟩ := (hsupportPosition s).mp hs + have hpositionLt : (pos b).val < (pos target).val := by + rw [hb] + exact Nat.lt_of_succ_le hn + have htargetB : target.val < b.val := + (hposOrder target b).mp hpositionLt + have hcDelta : c ≠ delta b := by + exact deltaNeLaterDelta a b (by simpa [target] using htargetB) + have hcGamma : c ≠ gamma b := by + exact deltaNeLaterGamma a b (by simpa [target] using htargetB) + rw [← hs, rootExchange s, ← hb, hposDelta, hposGamma] + simp [hcDelta, hcGamma] + · have hoff := offSupportStep s v hv (Ne.symm hs) + rw [hoff] + have hstep' : + (c ∈ MissingColors G + (trace.coloring ⟨n + 1, by omega⟩) v ↔ + c ∈ MissingColors G + (trace.coloring ⟨n, by omega⟩) v) := by + simpa [s] using hstep + exact hstep'.trans hprevious + have hroot : c ∉ MissingColors G + (trace.coloring (pos target).castSucc) v := by + have h := rootGammaNotMissing (pos target) + rw [hposSupport, hposGamma] at h + change gamma a.succ ∉ + MissingColors G (trace.coloring (pos target).castSucc) v at h + rw [hchain a] at h + exact h + intro hc + apply hroot + have hm := (membershipPreserved (pos target).val le_rfl).2 hc + have hcast : + (⟨(pos target).val, by omega⟩ : Fin (trace.steps + 1)) = + (pos target).castSucc := Fin.ext rfl + rw [hcast] at hm + exact hm + +private theorem helper_processed_541.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN) (_ : ( + ∀ (a : Fin trace.steps), MissingColors G (trace.coloring a.succ) (trace.support a) = + MissingColors G (trace.coloring a.castSucc) (trace.support a) \ {trace.delta a} ∪ + {trace.gamma a})) (v : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (gamma + delta : Fin (p + (1 : ℕ)) → Fin k) (_ : ( + ∀ (a : Fin p), gamma a.succ = delta a.castSucc)) (hpositionExists : + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (s : Fin trace.steps), trace.slot s = indices a), + let pos : Fin (p + (1 : ℕ)) → Fin trace.steps := fun (a : Fin (p + (1 : ℕ))) => + Classical.choose (hpositionExists a); + ∀ (_ : ( + ∀ (a : Fin (p + (1 : ℕ))), trace.support (pos a) = v)) (_ : ( + ∀ (a : Fin (p + (1 : ℕ))), trace.gamma (pos a) = gamma a)) (_ : ( + ∀ (a : Fin (p + (1 : ℕ))), trace.delta (pos a) = delta a)) (_ : ( + ∀ (a b : Fin (p + (1 : ℕ))) (_ : (↑a : ℕ) < (↑b : ℕ)), (↑(pos b) : ℕ) < (↑(pos a) : ℕ))) (_ : + ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑(pos b) : ℕ) < (↑(pos a) : ℕ) ↔ (↑a : ℕ) < (↑b : ℕ))) (_ : ( + ∀ (s : Fin trace.steps), trace.support s = v ↔ + ∃ (a : Fin (p + (1 : ℕ))), pos a = s)) (_ : ( + ∀ (n m : ℕ) (hn : n ≤ trace.steps) (hm : m ≤ n) (_ : ( + ∀ (s : Fin trace.steps) (_ : m ≤ (↑s : ℕ)) (_ : (↑s : ℕ) < n), trace.support s ≠ v)), + MissingColors G (trace.coloring (⟨n, Nat.lt_succ_of_le hn⟩ : Fin (trace.steps + (1 : ℕ)))) + v = MissingColors G (trace.coloring (⟨m, Nat.lt_succ_of_le (LE.le.trans hm hn)⟩ : Fin + (trace.steps + (1 : ℕ)))) v)) (_ : ( + ∀ (a : Fin p), delta a.castSucc ∉ MissingColors G sigmaN v)), + let baseMissing : Finset (Fin k) := MissingColors G sigmaN v \ {delta (Fin.last p)}; + ∀ (a : Fin (p + (1 : ℕ))), MissingColors G (trace.coloring (pos a).succ) v = baseMissing ∪ + {gamma a} := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace + rootExchange v p indices gamma delta hchain hpositionExists pos hposSupport hposGamma + hposDelta hposReverse hposOrder hsupportPosition offSupportInterval + intermediateInitiallyPresent baseMissing a + exact Fin.reverseInduction (motive := fun a => + MissingColors G (trace.coloring (pos a).succ) v = + baseMissing ∪ {gamma a}) (by + have hbefore : MissingColors G + (trace.coloring (pos (Fin.last p)).castSucc) v = + MissingColors G sigmaN v := by + have hinterval := offSupportInterval + (pos (Fin.last p)).val 0 (Nat.le_of_lt (pos (Fin.last p)).isLt) + (Nat.zero_le _) (by + intro s hsZero hsBefore hsupport + obtain ⟨b, hb⟩ := (hsupportPosition s).mp hsupport + have hbad : (pos b).val < (pos (Fin.last p)).val := by + simpa [hb] using hsBefore + have := (hposOrder (Fin.last p) b).mp hbad + have hbLt := b.isLt + simp only [Fin.last, Fin.val_mk] at this + omega) + have hcast : + (⟨(pos (Fin.last p)).val, + Nat.lt_succ_of_le (Nat.le_of_lt (pos (Fin.last p)).isLt)⟩ : + Fin (trace.steps + 1)) = + (pos (Fin.last p)).castSucc := Fin.ext rfl + rw [hcast] at hinterval + exact hinterval.trans (congrArg + (fun phi => MissingColors G phi v) trace.initialColoring) + have hexchange := rootExchange (pos (Fin.last p)) + rw [hposSupport, hposGamma, hposDelta, hbefore] at hexchange + simpa [baseMissing] using hexchange) (by + intro a ha + have hbetween : MissingColors G + (trace.coloring (pos a.castSucc).castSucc) v = + MissingColors G (trace.coloring (pos a.succ).succ) v := by + have hposition := hposReverse a.castSucc a.succ (by simp) + have hinterval := offSupportInterval + (pos a.castSucc).val ((pos a.succ).val + 1) + (Nat.le_of_lt (pos a.castSucc).isLt) (by omega) (by + intro s hsAfter hsBefore hsupport + obtain ⟨b, hb⟩ := (hsupportPosition s).mp hsupport + have hlower : (pos a.succ).val < (pos b).val := by + rw [hb] + omega + have hupper : (pos b).val < (pos a.castSucc).val := by + rw [hb] + exact hsBefore + have hbUpper : b.val < a.succ.val := + (hposOrder b a.succ).mp hlower + have hbLower : a.castSucc.val < b.val := + (hposOrder a.castSucc b).mp hupper + change b.val < a.val + 1 at hbUpper + change a.val < b.val at hbLower + omega) + have hnCast : + (⟨(pos a.castSucc).val, + Nat.lt_succ_of_le (Nat.le_of_lt (pos a.castSucc).isLt)⟩ : + Fin (trace.steps + 1)) = + (pos a.castSucc).castSucc := Fin.ext rfl + have hmSucc : + (⟨(pos a.succ).val + 1, by omega⟩ : + Fin (trace.steps + 1)) = (pos a.succ).succ := Fin.ext rfl + rw [hnCast, hmSucc] at hinterval + exact hinterval + have hexchange := rootExchange (pos a.castSucc) + rw [hposSupport, hposGamma, hposDelta, hbetween, ha, hchain a] + at hexchange + have hnotBase : delta a.castSucc ∉ baseMissing := by + exact fun hmem => intermediateInitiallyPresent a + (Finset.mem_sdiff.mp hmem).1 + apply hexchange.trans + ext c + simp only [Finset.mem_union, Finset.mem_sdiff, + Finset.mem_singleton] + by_cases hc : c = delta a.castSucc + · subst c + simp [hnotBase] + · simp [hc]) a + +private theorem helper_hafter_619.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN) (v : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (hpositionExists : + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (s : Fin trace.steps), trace.slot s = indices a), + let pos : Fin (p + (1 : ℕ)) → Fin trace.steps := fun (a : Fin (p + (1 : ℕ))) => + Classical.choose (hpositionExists a); + ∀ (_ : ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑(pos b) : ℕ) < (↑(pos a) : ℕ) ↔ (↑a : ℕ) < (↑b : ℕ))) (_ : ( + ∀ (s : Fin trace.steps), trace.support s = v ↔ + ∃ (a : Fin (p + (1 : ℕ))), pos a = s)) (_ : ( + ∀ (n m : ℕ) (hn : n ≤ trace.steps) (hm : m ≤ n) (_ : ( + ∀ (s : Fin trace.steps) (_ : m ≤ (↑s : ℕ)) (_ : (↑s : ℕ) < n), trace.support s ≠ v)), + MissingColors G (trace.coloring (⟨n, Nat.lt_succ_of_le hn⟩ : Fin (trace.steps + (1 : ℕ)))) + v = MissingColors G (trace.coloring (⟨m, Nat.lt_succ_of_le (LE.le.trans hm hn)⟩ : Fin + (trace.steps + (1 : ℕ)))) v)), MissingColors G (trace.coloring (Fin.last trace.steps)) v = + MissingColors G (trace.coloring (pos (0 : Fin (p + (1 : ℕ)))).succ) v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace v p + indices hpositionExists pos hposOrder hsupportPosition offSupportInterval + have hinterval := offSupportInterval trace.steps ((pos 0).val + 1) + le_rfl (by omega) (by + intro s hsAfter hsFinal hsupport + obtain ⟨b, hb⟩ := (hsupportPosition s).mp hsupport + have hbad : (pos 0).val < (pos b).val := by + rw [hb] + omega + have hbNeg : b.val < 0 := by + simpa using (hposOrder b 0).mp hbad + omega) + have hnLast : + (⟨trace.steps, Nat.lt_succ_of_le le_rfl⟩ : + Fin (trace.steps + 1)) = Fin.last trace.steps := Fin.ext rfl + have hmSucc : + (⟨(pos 0).val + 1, by omega⟩ : Fin (trace.steps + 1)) = + (pos 0).succ := Fin.ext rfl + rw [hnLast, hmSucc] at hinterval + exact hinterval + +private theorem helper_branch_261.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds) (sigmaN phiJ : + PartialEdgeColoring E k) (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN), ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace → ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), w ≠ terminalSupport → + ( + ∃ t ∈ ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport, + ett.series.data.chosenVertex t.succ = some w) → + ∃ (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (gamma : Fin (p + (1 : ℕ)) → Fin k) + (delta : Fin (p + (1 : ℕ)) → Fin k), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) ∧ + ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) ∧ ( + ∀ (a : Fin p), gamma a.succ = delta a.castSucc) ∧ Function.Injective (Fin.cons (gamma (0 : Fin + (p + (1 : ℕ)))) delta) ∧ MissingColors G phiJ w = MissingColors G sigmaN w \ + {delta (Fin.last p)} ∪ {gamma (0 : Fin (p + (1 : ℕ)))}) → ( + ∀ (a : Fin trace.steps), + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), v ≠ trace.support a → + MissingColors G (trace.coloring a.succ) v = MissingColors G (trace.coloring a.castSucc) v) + → ( + ∀ (a : Fin trace.steps), MissingColors G (trace.coloring a.succ) (trace.support a) = + MissingColors G (trace.coloring a.castSucc) (trace.support a) \ {trace.delta a} ∪ + {trace.gamma a}) → + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), v ≠ terminalSupport → + ( + ∃ r ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport, + ett.series.data.chosenVertex r.succ = some v) → MissingColors G (trace.coloring (Fin.last + trace.steps)) v = MissingColors G phiJ v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN phiJ + trace hinvariant hclassPrepared offSupportStep rootExchange v hv hvTerminal hsupported + obtain ⟨r, hrActive, hrVertex⟩ := hsupported + have hrRestoration : r ∈ ExtensionBaseRestorationIndices ett + terminalSupport hterminalSupport := by + unfold ExtensionBaseRestorationIndices + apply Finset.mem_sdiff.mpr + refine ⟨hrActive, ?_⟩ + unfold ExtensionBaseSupportClass + simp only [Finset.mem_filter, hrActive, true_and] + intro hterminalVertex + have : v = terminalSupport := by + apply Option.some.inj + exact hrVertex.symm.trans hterminalVertex + exact hvTerminal this + obtain ⟨p, indices, gamma, delta, hincreasing, hclass, + hgamma, hdelta, hchain, hinjective, hprepared⟩ := + hclassPrepared v hv hvTerminal ⟨r, hrRestoration, hrVertex⟩ + have hindexClass (a : Fin (p + 1)) : + indices a ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport v := + (hclass (indices a)).2 ⟨a, rfl⟩ + have hindexActive (a : Fin (p + 1)) : + indices a ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport := by + have h := hindexClass a + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at h + exact h.1 + have hindexVertex (a : Fin (p + 1)) : + ett.series.data.chosenVertex (indices a).succ = some v := by + have h := hindexClass a + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at h + exact h.2 + have hindexRestoration (a : Fin (p + 1)) : + indices a ∈ ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport := by + unfold ExtensionBaseRestorationIndices + apply Finset.mem_sdiff.mpr + refine ⟨hindexActive a, ?_⟩ + intro haTerminal + have h := haTerminal + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at h + have haVertex := h.2 + apply hvTerminal + exact Option.some.inj ((hindexVertex a).symm.trans haVertex) + have hpositionExists (a : Fin (p + 1)) : + ∃ s : Fin trace.steps, trace.slot s = indices a := by + have hmem : indices a ∈ Finset.univ.image trace.slot := by + rw [trace.enumerates] + exact hindexRestoration a + simpa only [Finset.mem_image, Finset.mem_univ, true_and] using hmem + let pos : Fin (p + 1) → Fin trace.steps := fun a => + Classical.choose (hpositionExists a) + have hposSlot (a : Fin (p + 1)) : trace.slot (pos a) = indices a := + Classical.choose_spec (hpositionExists a) + have hposSupport (a : Fin (p + 1)) : trace.support (pos a) = v := by + apply Option.some.inj + exact (trace.chosenVertex (pos a)).symm.trans (by + rw [hposSlot] + exact hindexVertex a) + have hposGamma (a : Fin (p + 1)) : trace.gamma (pos a) = gamma a := by + apply Option.some.inj + exact (trace.gammaField (pos a)).symm.trans (by + rw [hposSlot] + exact hgamma a) + have hposDelta (a : Fin (p + 1)) : trace.delta (pos a) = delta a := by + apply Option.some.inj + exact (trace.deltaField (pos a)).symm.trans (by + rw [hposSlot] + exact hdelta a) + have hslotInjective : Function.Injective trace.slot := by + intro a b hab + apply Fin.ext + by_contra hval + rcases lt_or_gt_of_ne hval with hlt | hgt + · have hdesc := trace.strictlyDescending a b hlt + rw [hab] at hdesc + exact (Nat.lt_irrefl _ hdesc) + · have hdesc := trace.strictlyDescending b a hgt + rw [hab] at hdesc + exact (Nat.lt_irrefl _ hdesc) + have hposReverse (a b : Fin (p + 1)) (hab : a.val < b.val) : + (pos b).val < (pos a).val := by + exact @helper_hposReverse_329 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport sigmaN trace p indices hincreasing + hpositionExists hposSlot a b hab + have hposOrder (a b : Fin (p + 1)) : + (pos b).val < (pos a).val ↔ a.val < b.val := by + constructor + · intro hba + by_contra hnot + have hle : b.val ≤ a.val := Nat.le_of_not_gt hnot + rcases lt_or_eq_of_le hle with hlt | heq + · have hrev := hposReverse b a hlt + omega + · have hab : a = b := Fin.ext heq.symm + subst b + exact (Nat.lt_irrefl _ hba) + · exact hposReverse a b + have hsupportPosition (s : Fin trace.steps) : + trace.support s = v ↔ ∃ a : Fin (p + 1), pos a = s := by + exact @helper_hsupportPosition_356 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport hterminalSupport jSlot q + sigmaN trace hinvariant v p indices hclass hpositionExists hposSlot hposSupport + hslotInjective s + have rootGammaPresent (s : Fin trace.steps) : + trace.gamma s ∈ PresentColors G (trace.coloring s.castSucc) + (trace.support s) := by + exact @helper_rootGammaPresent_371 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport hterminalSupport jSlot q + sigmaN trace hinvariant v p gamma delta s + have rootGammaNotMissing (s : Fin trace.steps) : + trace.gamma s ∉ MissingColors G (trace.coloring s.castSucc) + (trace.support s) := by + simpa [MissingColors] using rootGammaPresent s + have offSupportInterval := + @helper_offSupportInterval_409 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport hterminalSupport jSlot sigmaN trace offSupportStep + v hv + let colorChain : Fin (p + 2) → Fin k := Fin.cons (gamma 0) delta + have gammaEqChain (a : Fin (p + 1)) : + gamma a = colorChain a.castSucc := by + cases a using Fin.cases with + | zero => simp [colorChain] + | succ a => simpa [colorChain] using hchain a + have deltaEqChain (a : Fin (p + 1)) : + delta a = colorChain a.succ := by + simp [colorChain] + have deltaNeLaterDelta (a : Fin p) (b : Fin (p + 1)) + (hab : a.succ.val < b.val) : delta a.castSucc ≠ delta b := by + intro heq + have hcolor : colorChain a.castSucc.succ = colorChain b.succ := by + rw [← deltaEqChain, ← deltaEqChain] + exact heq + have hi : a.castSucc.succ = b.succ := hinjective hcolor + have hbase : a.castSucc = b := Fin.succ_inj.mp hi + have hv : a.val = b.val := congrArg Fin.val hbase + have hab' : a.val + 1 < b.val := by simpa using hab + omega + have deltaNeLaterGamma (a : Fin p) (b : Fin (p + 1)) + (hab : a.succ.val < b.val) : delta a.castSucc ≠ gamma b := by + intro heq + have hcolor : colorChain a.castSucc.succ = colorChain b.castSucc := by + rw [← deltaEqChain, ← gammaEqChain] + exact heq + have hi : a.castSucc.succ = b.castSucc := hinjective hcolor + have hv : a.val + 1 = b.val := by + simpa using congrArg Fin.val hi + have hab' : a.val + 1 < b.val := by simpa using hab + exact (Nat.ne_of_lt hab') hv + have intermediateInitiallyPresent (a : Fin p) : + delta a.castSucc ∉ MissingColors G sigmaN v := by + exact @helper_intermediateInitiallyPresent_477 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport hterminalSupport jSlot sigmaN + trace offSupportStep rootExchange v hv p indices gamma delta hchain hpositionExists + hposSupport hposGamma hposDelta hposOrder hsupportPosition rootGammaNotMissing + deltaNeLaterDelta deltaNeLaterGamma a + let baseMissing := + MissingColors G sigmaN v \ {delta (Fin.last p)} + have processed (a : Fin (p + 1)) : + MissingColors G (trace.coloring (pos a).succ) v = + baseMissing ∪ {gamma a} := by + exact @helper_processed_541 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport sigmaN trace rootExchange v p indices + gamma delta hchain hpositionExists hposSupport hposGamma hposDelta hposReverse hposOrder + hsupportPosition offSupportInterval intermediateInitiallyPresent a + have hafter := + @helper_hafter_619 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport sigmaN trace v p indices hpositionExists + hposOrder hsupportPosition offSupportInterval + have hfinal := hafter.trans (processed 0) + exact hfinal.trans (by simpa [baseMissing] using hprepared.symm) + +private theorem helper_branch_318.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds) (sigmaN phiJ : + PartialEdgeColoring E k) (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN), ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace → ( + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), ( + ∀ r ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport, + ett.series.data.chosenVertex r.succ ≠ some v) → MissingColors G sigmaN v = MissingColors G + phiJ v) → ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), w ≠ terminalSupport → + ( + ∃ t ∈ ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport, + ett.series.data.chosenVertex t.succ = some w) → + ∃ (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (gamma : Fin (p + (1 : ℕ)) → Fin k) + (delta : Fin (p + (1 : ℕ)) → Fin k), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) ∧ + ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) ∧ ( + ∀ (a : Fin p), gamma a.succ = delta a.castSucc) ∧ Function.Injective (Fin.cons (gamma (0 : Fin + (p + (1 : ℕ)))) delta) ∧ MissingColors G phiJ w = MissingColors G sigmaN w \ + {delta (Fin.last p)} ∪ {gamma (0 : Fin (p + (1 : ℕ)))}) → ( + ∀ (a : Fin trace.steps), + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), v ≠ trace.support a → + MissingColors G (trace.coloring a.succ) v = MissingColors G (trace.coloring a.castSucc) v) + → ( + ∀ (a : Fin trace.steps), MissingColors G (trace.coloring a.succ) (trace.support a) = + MissingColors G (trace.coloring a.castSucc) (trace.support a) \ {trace.delta a} ∪ + {trace.gamma a}) → ( + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), ( + ∀ (a : Fin trace.steps), trace.support a ≠ v) → MissingColors G (trace.coloring (Fin.last + trace.steps)) v = MissingColors G sigmaN v) → + ∀ v ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase + terminalSupport, MissingColors G (trace.coloring (Fin.last trace.steps)) v = MissingColors + G phiJ v := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN + phiJ trace hinvariant hunsupported hclassPrepared offSupportStep rootExchange + preservedWhenOff v hvErase + have hv := (Finset.mem_erase.mp hvErase).2 + have hvTerminal : v ≠ terminalSupport := by + exact (Finset.mem_erase.mp hvErase).1 + by_cases hsupported : ∃ r : Fin ett.rounds, + r ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport ∧ + ett.series.data.chosenVertex r.succ = some v + · exact @helper_branch_261 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport hterminalSupport jSlot q sigmaN phiJ trace + hinvariant hclassPrepared offSupportStep rootExchange v hv hvTerminal hsupported + · have hOff : ∀ a : Fin trace.steps, trace.support a ≠ v := by + intro a hsupport + have hrestoration := (hinvariant.2.1 a).1 + have hactive := (Finset.mem_sdiff.mp hrestoration).1 + apply hsupported + refine ⟨trace.slot a, hactive, ?_⟩ + simpa [hsupport] using trace.chosenVertex a + exact (preservedWhenOff v hv hOff).trans + (hunsupported v hv (by + intro r hrActive hrVertex + exact hsupported ⟨r, hrActive, hrVertex⟩)) + +theorem ExtensionBaseClaim43MissingColors {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot q : Fin ett.rounds) (sigmaN phiJ : PartialEdgeColoring E k) + (hterminalJ : terminalSupport ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) + (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN) + (hinvariant : ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace) + (hunsupported : ∀ v : V, + v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) → + (∀ r : Fin ett.rounds, + r ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex r.succ ≠ some v) → + MissingColors G sigmaN v = MissingColors G phiJ v) + (hclassPrepared : ∀ w : V, + w ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) → + w ≠ terminalSupport → + (∃ t : Fin ett.rounds, + t ∈ ExtensionBaseRestorationIndices ett terminalSupport + hterminalSupport ∧ + ett.series.data.chosenVertex t.succ = some w) → + ∃ p : ℕ, ∃ indices : Fin (p + 1) → Fin ett.rounds, + ∃ gamma delta : Fin (p + 1) → Fin k, + (∀ a b, a.val < b.val → + (indices a).val < (indices b).val) ∧ + (∀ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w ↔ + ∃ a : Fin (p + 1), indices a = r) ∧ + (∀ a, ett.series.data.gamma (indices a).succ = some (gamma a)) ∧ + (∀ a, ett.series.data.delta (indices a).succ = some (delta a)) ∧ + (∀ a : Fin p, gamma a.succ = delta a.castSucc) ∧ + Function.Injective (Fin.cons (gamma 0) delta) ∧ + MissingColors G phiJ w = + (MissingColors G sigmaN w \ {delta (Fin.last p)}) ∪ + {gamma 0}) : + (∀ v : V, + v ∈ (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).erase + terminalSupport → + MissingColors G (trace.coloring (Fin.last trace.steps)) v = + MissingColors G phiJ v) ∧ + MissingColors G (trace.coloring (Fin.last trace.steps)) + terminalSupport = + MissingColors G sigmaN terminalSupport := by + classical + have vertexTransfer : ∀ (A B : TreeSequence G e0), + TreeSequenceInitialSegment A B → ∀ v, + v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B := by + intro A B hAB v hv + rcases hAB with ⟨hlen, hvertex, hedge⟩ + unfold TreeSequenceVertexSet at hv ⊢ + simp only [Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + obtain ⟨i, rfl⟩ := hv + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, hvertex i⟩ + have edgeOutside := + @helper_edgeOutside_99 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN trace + hinvariant vertexTransfer + have offSupportStep : + ∀ (a : Fin trace.steps) (v : V), v ∈ TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc) → v ≠ trace.support a → MissingColors G (trace.coloring a.succ) v = + MissingColors G (trace.coloring a.castSucc) v := by + intro a v hv hvSupport + have fixed : ∀ f : E, Incident G v f → + trace.coloring a.succ f = trace.coloring a.castSucc f := by + intro f hvf + rw [trace.transition] + simp [TwoColorComponentSwap, edgeOutside a v hv hvSupport f hvf] + apply Finset.ext + intro c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and, + not_exists, not_and] + constructor + · intro hc f hvf hcolor + apply hc f hvf + rw [fixed f hvf] + exact hcolor + · intro hc f hvf hcolor + apply hc f hvf + rw [← fixed f hvf] + exact hcolor + have rootExchange := + @helper_rootExchange_162 V E inferInstance inferInstance inferInstance G + k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN trace hinvariant + have preservedWhenOff : + ∀ (v : V), v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ a : Fin trace.steps, trace.support a ≠ v) → MissingColors G (trace.coloring (Fin.last + trace.steps)) v = MissingColors G sigmaN v := by + intro v hv hOff + have inductionClaim : + ∀ n : ℕ, (hn : n ≤ trace.steps) → MissingColors G (trace.coloring ⟨n, Nat.lt_succ_of_le hn⟩) v + = MissingColors G sigmaN v := by + intro n hn + induction n with + | zero => + simpa using (congrArg (fun phi => MissingColors G phi v) + trace.initialColoring) + | succ n ih => + let a : Fin trace.steps := ⟨n, Nat.lt_of_succ_le hn⟩ + have hprevious := ih (Nat.le_of_succ_le hn) + have hstep := offSupportStep a v hv (Ne.symm (hOff a)) + have hcast : a.castSucc = + (⟨n, Nat.lt_succ_of_le (Nat.le_of_succ_le hn)⟩ : + Fin (trace.steps + 1)) := by + apply Fin.ext + rfl + have hsucc : a.succ = + (⟨n + 1, Nat.lt_succ_of_le hn⟩ : + Fin (trace.steps + 1)) := by + apply Fin.ext + rfl + rw [hcast, hsucc] at hstep + exact hstep.trans hprevious + simpa [Fin.last] using inductionClaim trace.steps le_rfl + have terminalOff : ∀ a : Fin trace.steps, + trace.support a ≠ terminalSupport := by + intro a hsupport + have hrestoration := (hinvariant.2.1 a).1 + have hparts := Finset.mem_sdiff.mp hrestoration + apply hparts.2 + unfold ExtensionBaseSupportClass + simp only [Finset.mem_filter] + refine ⟨hparts.1, ?_⟩ + simpa [hsupport] using trace.chosenVertex a + constructor + · exact @helper_branch_318 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport hterminalSupport jSlot q sigmaN phiJ trace + hinvariant hunsupported hclassPrepared offSupportStep rootExchange preservedWhenOff + · exact preservedWhenOff terminalSupport hterminalJ terminalOff + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim43Stability.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43Stability.lean new file mode 100644 index 0000000000..496fc18d45 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43Stability.lean @@ -0,0 +1,353 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationInvariant + +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex + +/-! +# Extension Base Claim43Stability + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_storedToFinal_78.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ + DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (jSlot : Fin ett.rounds), (∀ (A B D : + TreeSequence G e0), TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B D → + TreeSequenceInitialSegment A D) → TreeSequenceInitialSegment (ett.series.data.tree + jSlot.succ.castSucc) (ett.series.data.tree (⟨ett.rounds, Decidable.byContradiction fun (a + : ¬ett.rounds < ett.rounds + (2 : ℕ)) => by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 input T generating ett jSlot segmentTrans + have stepSegment : ∀ i : Fin (ett.rounds + 1), 0 < i.val → + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) + (ett.series.data.tree i.succ) := by + intro i + have ordered : + ∀ h : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i, i ≠ 0 → + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ) + := by + intro h hi + cases h with + | initial => exact (hi rfl).elim + | SE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | RE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + intro hi + apply ordered (ett.series.certified i) + intro hz + subst i + simp at hi + have chain : ∀ n : ℕ, (hn : jSlot.val + 1 + n ≤ ett.rounds) → + TreeSequenceInitialSegment + (ett.series.data.tree ⟨jSlot.val + 1, by omega⟩) + (ett.series.data.tree ⟨jSlot.val + 1 + n, by omega⟩) := by + intro n hn + induction n with + | zero => + simpa using (show TreeSequenceInitialSegment + (ett.series.data.tree ⟨jSlot.val + 1, by omega⟩) + (ett.series.data.tree ⟨jSlot.val + 1, by omega⟩) from + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩) + | succ n ih => + have hn' : jSlot.val + 1 + n ≤ ett.rounds := by omega + have hidx : jSlot.val + n + 1 < ett.rounds + 1 := by omega + have prev := stepSegment + (⟨jSlot.val + n + 1, hidx⟩ : Fin (ett.rounds + 1)) (by simp) + have prev' : TreeSequenceInitialSegment + (ett.series.data.tree ⟨jSlot.val + 1 + n, by omega⟩) + (ett.series.data.tree ⟨jSlot.val + 1 + (n + 1), by omega⟩) := by + simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using prev + exact segmentTrans _ _ _ (ih hn') prev' + have bound : jSlot.val + 1 + (ett.rounds - (jSlot.val + 1)) ≤ ett.rounds := by omega + have startEq : (⟨jSlot.val + 1, by omega⟩ : Fin (ett.rounds + 2)) = + jSlot.succ.castSucc := by ext; simp + rw [← startEq] + have hle : jSlot.val + 1 ≤ ett.rounds := by omega + have ending : + (⟨jSlot.val + 1 + (ett.rounds - (jSlot.val + 1)), by omega⟩ : + Fin (ett.rounds + 2)) = ⟨ett.rounds, by omega⟩ := by + apply Fin.ext + change jSlot.val + 1 + (ett.rounds - (jSlot.val + 1)) = ett.rounds + omega + have result := chain (ett.rounds - (jSlot.val + 1)) bound + rw [ending] at result + exact result + +private theorem helper_beforeInTj_139.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot : Fin ett.rounds), terminalSupport ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) → + let Tj : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + TreeSequenceInitialSegment Tj T → + ∀ w ∈ TreeVerticesBefore T terminalSupport hterminalSupport, w ∈ TreeSequenceVertexSet Tj := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot hterminalJ + Tj storedToT + dsimp [Tj] + intro w hw + unfold TreeVerticesBefore at hw + rcases Finset.mem_filter.mp hw with ⟨hwT, horder⟩ + rcases horder with ⟨iw, iv, wiw, viv, hi⟩ + rcases Finset.mem_image.mp hwT with ⟨iwT, -, iwEq⟩ + have hterminalJ' : terminalSupport ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.castSucc.succ) := by + simpa using hterminalJ + rcases Finset.mem_image.mp hterminalJ' with ⟨qv, -, qEq⟩ + dsimp [Tj] at storedToT + rcases storedToT with ⟨hlen, entries, edges⟩ + let qT : Fin (T.length + 1) := + Fin.castLE (Nat.succ_le_succ hlen) qv + have qTval : T.vertex qT = terminalSupport := by + exact (entries qv).trans qEq + have ivEq : iv = qT := by + apply T.vertex_injective + rw [qTval, viv] + have iwTEq : iwT = iw := by + apply T.vertex_injective + exact iwEq.trans wiw.symm + have orderT : iwT.val < qv.val := by + have hh := hi + rw [← iwTEq, ivEq] at hh + simpa [qT] using hh + have ilen : iwT.val < Tj.length + 1 := by + change iwT.val < (ett.series.data.tree jSlot.castSucc.succ).length + 1 + omega + let iT : Fin (Tj.length + 1) := ⟨iwT.val, ilen⟩ + apply Finset.mem_image.mpr + refine ⟨iT, Finset.mem_univ _, ?_⟩ + have sameIndex : (Fin.castLE (Nat.succ_le_succ hlen) iT) = iw := by + apply Fin.ext + simp [iT, iwTEq] + calc + (ett.series.data.tree jSlot.castSucc.succ).vertex iT = + T.vertex (Fin.castLE (Nat.succ_le_succ hlen) iT) := + (entries iT).symm + _ = T.vertex iw := by rw [sameIndex] + _ = w := wiw + +private theorem helper_edgeOutside_204.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] {G + : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} {T : + TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k + e0 input T generating) (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds) (sigmaN : PartialEdgeColoring E k) + (trace : ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), + ExtensionBaseRestorationInvariant ett terminalSupport hterminalSupport jSlot q sigmaN + trace → (∀ (u v : V), TreeVertexOrder T u v → TreeVertexOrder T v u → False) → (∀ (a : Fin + trace.steps), ∀ w ∈ TreeVerticesBefore T terminalSupport hterminalSupport, w ∈ + TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc)) → ∀ (a : Fin + trace.steps), ∀ w ∈ TreeVerticesBefore T terminalSupport hterminalSupport, ∀ (f : E), + Incident G w f → Sum.inr f ∉ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma + a) (trace.delta a) (Sum.inl (trace.support a)) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN + trace hinvariant noCycle currentVertex a w hw f hwf hf + have stepInvariant := hinvariant.2.1 a + rcases stepInvariant.2.2 with ⟨segment, supportInTree, deltaMissing, + pathComponent, exactIntersection, remaining⟩ + have win := currentVertex a w hw + have wne : w ≠ trace.support a := by + intro heq + apply noCycle w terminalSupport + · have hwo := hw + unfold TreeVerticesBefore at hwo + exact (Finset.mem_filter.mp hwo).2 + · simpa [heq] using stepInvariant.2.1 + have endpoint : Sum.inl w ∈ TwoColorComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl (trace.support a)) := by + let H := TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) + have edgeSupport : Sum.inr f ∈ H.support := by + apply SimpleGraph.mem_support_of_reachable + (G := H) (u := Sum.inr f) (v := Sum.inl (trace.support a)) + · simp + · exact SimpleGraph.ConnectedComponent.eq.mp hf + obtain ⟨x, hx⟩ := H.mem_support.mp edgeSupport + have active : trace.coloring a.castSucc f = some (trace.gamma a) ∨ + trace.coloring a.castSucc f = some (trace.delta a) := by + cases x with + | inl x => exact hx.2 + | inr x => simp [H, TwoColorIncidenceGraph] at hx + have adj : H.Adj (Sum.inl w) (Sum.inr f) := by + simp [H, TwoColorIncidenceGraph, hwf, active] + change H.connectedComponentMk (Sum.inl w) = + H.connectedComponentMk (Sum.inl (trace.support a)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + adj).trans hf + exact wne ((exactIntersection w win).mp endpoint) + +private theorem helper_preserved_244.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] {G : + LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} {T : + TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k + e0 input T generating) (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (sigmaN : PartialEdgeColoring E k) (trace : + ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN), (∀ (a : Fin + trace.steps), ∀ w ∈ TreeVerticesBefore T terminalSupport hterminalSupport, ∀ (f : E), + Incident G w f → Sum.inr f ∉ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma + a) (trace.delta a) (Sum.inl (trace.support a))) → ∀ (n : ℕ) (hn : n ≤ trace.steps) (f : + E), (∃ w ∈ TreeVerticesBefore T terminalSupport hterminalSupport, Incident G w f) → + trace.coloring (⟨n, Nat.lt_succ_of_le hn⟩ : Fin (trace.steps + (1 : ℕ))) f = sigmaN f := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport sigmaN trace + edgeOutside n hn + induction n with + | zero => + intro f hf + simpa using congrFun trace.initialColoring f + | succ n ih => + intro f hf + let a : Fin trace.steps := ⟨n, Nat.lt_of_succ_le hn⟩ + have hfall := hf + have hkeep := hf + obtain ⟨w, hw, hwf⟩ := hkeep + have ho := edgeOutside a w hw f hwf + have tr := congrFun (trace.transition a) f + have unchanged : TwoColorComponentSwap G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl (trace.support a)) f = + trace.coloring a.castSucc f := by + simp [TwoColorComponentSwap, ho] + have prev : trace.coloring a.castSucc f = sigmaN f := by + have he : a.castSucc = + ⟨n, Nat.lt_succ_of_le (Nat.le_of_succ_le hn)⟩ := by + apply Fin.ext + simp [a] + rw [he] + exact ih (Nat.le_of_succ_le hn) f hfall + have next : trace.coloring a.succ f = sigmaN f := by + rw [tr, unchanged, prev] + have he : (⟨n + 1, Nat.lt_succ_of_le hn⟩ : Fin (trace.steps + 1)) = + a.succ := by + apply Fin.ext + simp [a] + rw [he] + exact next + +theorem ExtensionBaseClaim43Stability {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot q : Fin ett.rounds) (sigmaN phiJ : PartialEdgeColoring E k) + (C : Finset (Fin k)) + (hterminalJ : terminalSupport ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) + (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN) + (hinvariant : ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace) + (hsigmaStable : StableColoringBeforeVertex T terminalSupport + hterminalSupport C phiJ sigmaN) : + StableColoringBeforeVertex T terminalSupport hterminalSupport C phiJ + (trace.coloring (Fin.last trace.steps)) := by + classical + let : DecidableEq V := Classical.decEq V + have segmentTrans : ∀ A B D : TreeSequence G e0, + TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B D → + TreeSequenceInitialSegment A D := by + intro A B D hab hbd + rcases hab with ⟨hlab, vab, eab⟩ + rcases hbd with ⟨hlbd, vbd, ebd⟩ + refine ⟨le_trans hlab hlbd, ?_, ?_⟩ + · intro i + calc + D.vertex (Fin.castLE (Nat.succ_le_succ (le_trans hlab hlbd)) i) = + B.vertex (Fin.castLE (Nat.succ_le_succ hlab) i) := by + simpa using vbd (Fin.castLE (Nat.succ_le_succ hlab) i) + _ = A.vertex i := vab i + · intro i + calc + D.edge (Fin.castLE (le_trans hlab hlbd) i) = + B.edge (Fin.castLE hlab i) := by + simpa using ebd (Fin.castLE hlab i) + _ = A.edge i := eab i + have storedToFinal := @helper_storedToFinal_78 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett jSlot segmentTrans + let Tj := ett.series.data.tree jSlot.succ.castSucc + have storedToT : TreeSequenceInitialSegment Tj T := by + exact segmentTrans _ _ _ storedToFinal ett.abovePenultimate + have beforeInTj := @helper_beforeInTj_139 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport hterminalSupport jSlot hterminalJ storedToT + have noCycle : ∀ u v : V, TreeVertexOrder T u v → + TreeVertexOrder T v u → False := by + intro u v huv hvu + rcases huv with ⟨i, j, hi, hj, hij⟩ + rcases hvu with ⟨i', j', hi', hj', hji⟩ + have ei : i = j' := T.vertex_injective (hi.trans hj'.symm) + have ej : j = i' := T.vertex_injective (hj.trans hi'.symm) + omega + have currentVertex : ∀ a : Fin trace.steps, ∀ w : V, + w ∈ TreeVerticesBefore T terminalSupport hterminalSupport → + w ∈ TreeSequenceVertexSet + (ett.series.data.tree (trace.slot a).succ.castSucc) := by + intro a w hw + have stepInvariant := hinvariant.2.1 a + rcases stepInvariant.2.2 with ⟨segment, supportInTree, deltaMissing, + pathComponent, exactIntersection, remaining⟩ + have wj := beforeInTj w hw + rcases segment with ⟨hlen, entries, edges⟩ + apply Finset.mem_image.mpr + rcases Finset.mem_image.mp wj with ⟨i, -, hi⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, ?_⟩ + simpa using (entries i).trans hi + have edgeOutside := @helper_edgeOutside_204 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport hterminalSupport jSlot q sigmaN + trace hinvariant noCycle currentVertex + have preserved := @helper_preserved_244 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett terminalSupport hterminalSupport sigmaN trace edgeOutside + have finalPreserved : ∀ f : E, + (∃ w ∈ TreeVerticesBefore T terminalSupport hterminalSupport, + Incident G w f) → + trace.coloring (Fin.last trace.steps) f = sigmaN f := by + intro f hf + simpa [Fin.last] using preserved trace.steps le_rfl f hf + unfold StableColoringBeforeVertex at hsigmaStable ⊢ + constructor + · intro f hf hcol + have hfall := hf + rcases hf with ⟨w, hw, hwf⟩ + rw [finalPreserved f ⟨w, hw, hwf⟩] + exact hsigmaStable.1 f hfall hcol + · intro w hw + have missingEq : MissingColors G + (trace.coloring (Fin.last trace.steps)) w = MissingColors G sigmaN w := by + apply Finset.ext + intro c + simp only [MissingColors, PresentColors, Finset.mem_sdiff, Finset.mem_univ, + Finset.mem_filter, true_and, + not_exists, not_and] + constructor + · intro hc f hwf hfc + apply hc f hwf + rw [← finalPreserved f ⟨w, hw, hwf⟩] at hfc + exact hfc + · intro hc f hwf hfc + apply hc f hwf + rw [finalPreserved f ⟨w, hw, hwf⟩] at hfc + exact hfc + exact missingEq.trans (hsigmaStable.2 w hw) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim43TreeEdges.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43TreeEdges.lean new file mode 100644 index 0000000000..f82d2d5f86 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43TreeEdges.lean @@ -0,0 +1,167 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimTreeEdgeColors +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationInvariant + +/-! +# Extension Base Claim43Tree Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseClaim43TreeEdges {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot q : Fin ett.rounds) (hjle : jSlot.val ≤ q.val) + (hqTerminal : q.val + 1 = ett.rounds) + (sigmaN : PartialEdgeColoring E k) + (hsigmaProper : IsProperEdgeColoring G sigmaN) + (hsigmaOne : IsOneEdgeUncolored sigmaN e0) + (hsigmaStable : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigmaN) + (trace : ExtensionBaseRestorationTrace ett terminalSupport + hterminalSupport sigmaN) + (hinvariant : ExtensionBaseRestorationInvariant ett terminalSupport + hterminalSupport jSlot q sigmaN trace) : + ∀ a : Fin (ett.series.data.tree jSlot.succ.castSucc).length, trace.coloring (Fin.last + trace.steps) ((ett.series.data.tree jSlot.succ.castSucc).edge a) = sigmaN + ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ sigmaN ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = ett.series.data.coloring jSlot.castSucc + ((ett.series.data.tree jSlot.succ.castSucc).edge a) := by + classical + let : DecidableEq V := Classical.decEq V + intro a + let Tj := ett.series.data.tree jSlot.succ.castSucc + let f := Tj.edge a + have edgeOutside : ∀ b : Fin trace.steps, + Sum.inr f ∉ TwoColorComponent G (trace.coloring b.castSucc) + (trace.gamma b) (trace.delta b) (Sum.inl (trace.support b)) := by + intro b edgeMem + have stepInvariant := hinvariant.2.1 b + rcases stepInvariant.2.2 with + ⟨segment, supportInTree, deltaMissing, pathComponent, + exactIntersection, remaining⟩ + rcases segment with ⟨hlen, vertexEntries, edgeEntries⟩ + let currentTree := ett.series.data.tree (trace.slot b).succ.castSucc + let laterA : Fin currentTree.length := Fin.castLE hlen a + have edgeEntry : currentTree.edge laterA = f := by + exact (edgeEntries a).trans rfl + rcases Tj.attaches a with ⟨i, attachment⟩ + let earlier : Fin (Tj.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ a.isLt)) + let laterVertex : Fin (currentTree.length + 1) := + Fin.castLE (Nat.succ_le_succ hlen) a.succ + let earlierVertex : Fin (currentTree.length + 1) := + Fin.castLE (Nat.succ_le_succ hlen) earlier + have laterVertexEntry : currentTree.vertex laterVertex = Tj.vertex a.succ := + vertexEntries a.succ + have earlierVertexEntry : currentTree.vertex earlierVertex = Tj.vertex earlier := + vertexEntries earlier + have laterInTree : Tj.vertex a.succ ∈ TreeSequenceVertexSet currentTree := by + unfold TreeSequenceVertexSet + apply Finset.mem_image.mpr + exact ⟨laterVertex, Finset.mem_univ _, laterVertexEntry⟩ + have earlierInTree : Tj.vertex earlier ∈ TreeSequenceVertexSet currentTree := by + unfold TreeSequenceVertexSet + apply Finset.mem_image.mpr + exact ⟨earlierVertex, Finset.mem_univ _, earlierVertexEntry⟩ + have laterIncident : Incident G (Tj.vertex a.succ) f := by + change Tj.vertex a.succ ∈ G.ends f + rw [attachment] + exact Sym2.mem_mk_left _ _ + have earlierIncident : Incident G (Tj.vertex earlier) f := by + change Tj.vertex earlier ∈ G.ends f + rw [attachment] + exact Sym2.mem_mk_right _ _ + let H := TwoColorIncidenceGraph G (trace.coloring b.castSucc) + (trace.gamma b) (trace.delta b) + have activeColor : trace.coloring b.castSucc f = some (trace.gamma b) ∨ + trace.coloring b.castSucc f = some (trace.delta b) := by + have edgeSupport : Sum.inr f ∈ H.support := by + apply SimpleGraph.mem_support_of_reachable + (G := H) (u := Sum.inr f) (v := Sum.inl (trace.support b)) + · simp + · exact SimpleGraph.ConnectedComponent.eq.mp edgeMem + obtain ⟨neighbor, adjacency⟩ := H.mem_support.mp edgeSupport + cases neighbor with + | inl v => exact adjacency.2 + | inr e => simp [H, TwoColorIncidenceGraph] at adjacency + have endpointInComponent : ∀ v : V, Incident G v f → + Sum.inl v ∈ TwoColorComponent G (trace.coloring b.castSucc) + (trace.gamma b) (trace.delta b) (Sum.inl (trace.support b)) := by + intro v incident + have adjacent : H.Adj (Sum.inl v) (Sum.inr f) := by + simp [H, TwoColorIncidenceGraph, incident, activeColor] + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inl (trace.support b)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + adjacent).trans edgeMem + have laterEq : Tj.vertex a.succ = trace.support b := + (exactIntersection (Tj.vertex a.succ) laterInTree).mp + (endpointInComponent (Tj.vertex a.succ) laterIncident) + have earlierEq : Tj.vertex earlier = trace.support b := + (exactIntersection (Tj.vertex earlier) earlierInTree).mp + (endpointInComponent (Tj.vertex earlier) earlierIncident) + have earlierEq' : + Tj.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ a.isLt))) = trace.support b := by + simpa [earlier] using earlierEq + apply G.loopless f (trace.support b) + simpa [f, laterEq, earlierEq'] using attachment + have preserved : ∀ n : ℕ, (hn : n ≤ trace.steps) → + trace.coloring ⟨n, Nat.lt_succ_of_le hn⟩ f = sigmaN f := by + intro n hn + induction n with + | zero => + simpa using congrFun trace.initialColoring f + | succ n ih => + let b : Fin trace.steps := ⟨n, Nat.lt_of_succ_le hn⟩ + have transition := congrFun (trace.transition b) f + have unchanged : + TwoColorComponentSwap G (trace.coloring b.castSucc) + (trace.gamma b) (trace.delta b) (Sum.inl (trace.support b)) f = + trace.coloring b.castSucc f := by + simp [TwoColorComponentSwap, edgeOutside b] + have atPrevious : trace.coloring b.castSucc f = sigmaN f := by + have indexEq : b.castSucc = + ⟨n, Nat.lt_succ_of_le (Nat.le_of_succ_le hn)⟩ := by + apply Fin.ext + simp [b] + rw [indexEq] + exact ih (Nat.le_of_succ_le hn) + have atSuccessor : trace.coloring b.succ f = sigmaN f := by + rw [transition, unchanged, atPrevious] + have indexEq : (⟨n + 1, Nat.lt_succ_of_le hn⟩ : Fin (trace.steps + 1)) = + b.succ := by + apply Fin.ext + simp [b] + rw [indexEq] + exact atSuccessor + have firstEquality : trace.coloring (Fin.last trace.steps) f = sigmaN f := by + simpa [Fin.last] using preserved trace.steps le_rfl + have secondEquality : sigmaN f = ett.series.data.coloring jSlot.castSucc f := by + exact (ExtensionBaseClaimTreeEdgeColors G k e0 input ett.rounds ett.series + jSlot q hjle hqTerminal sigmaN hsigmaProper hsigmaOne hsigmaStable).2 a + exact ⟨firstEquality, secondEquality⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean new file mode 100644 index 0000000000..601e866dcb --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean @@ -0,0 +1,1728 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmB +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBInvariant +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneIndices +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeVerticesBefore +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent + +/-! +# Extension Base Claim44 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hmissingFixedInternal_357.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ + _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), ( + ∀ (a : Fin trace.steps), trace.gamma a ≠ trace.delta a) → ( + ∀ (a : Fin trace.steps) {v : V} {f : E}, Sum.inl v ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring + a.castSucc f = some (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → + Sum.inr f ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta + a) (Sum.inl u)) → ( + ∀ (a : Fin trace.steps) (f : E) (c : Fin k), c ≠ trace.gamma a → c ≠ trace.delta a → + (trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c)) → + ∀ (a : Fin trace.steps) (v : V), Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → trace.gamma a ∈ PresentColors G + (trace.coloring a.castSucc) v → trace.delta a ∈ PresentColors G (trace.coloring + a.castSucc) v → MissingColors G (trace.coloring a.succ) v = MissingColors G + (trace.coloring a.castSucc) v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b + trace htraceColorsNe hcomponentEdgeOfVertex hunaffectedValue a v hvComponent hgammaPresent + hdeltaPresent + have hgammaNew : trace.gamma a ∈ + PresentColors G (trace.coloring a.succ) v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hdeltaPresent ⊢ + obtain ⟨f, hvf, hfdelta⟩ := hdeltaPresent + have hfComponent := hcomponentEdgeOfVertex a hvComponent hvf (Or.inr hfdelta) + refine ⟨f, hvf, ?_⟩ + rw [trace.transition] + simp [TwoColorComponentSwap, hfComponent, hfdelta, + (htraceColorsNe a).symm] + have hdeltaNew : trace.delta a ∈ + PresentColors G (trace.coloring a.succ) v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hgammaPresent ⊢ + obtain ⟨f, hvf, hfgamma⟩ := hgammaPresent + have hfComponent := hcomponentEdgeOfVertex a hvComponent hvf (Or.inl hfgamma) + refine ⟨f, hvf, ?_⟩ + rw [trace.transition] + simp [TwoColorComponentSwap, hfComponent, hfgamma] + apply Finset.ext + intro c + by_cases hcg : c = trace.gamma a + · subst c + have hold : trace.gamma a ∉ + MissingColors G (trace.coloring a.castSucc) v := by + simpa [MissingColors] using hgammaPresent + have hnew : trace.gamma a ∉ + MissingColors G (trace.coloring a.succ) v := by + simpa [MissingColors] using hgammaNew + simp [hold, hnew] + · by_cases hcd : c = trace.delta a + · subst c + have hold : trace.delta a ∉ + MissingColors G (trace.coloring a.castSucc) v := by + simpa [MissingColors] using hdeltaPresent + have hnew : trace.delta a ∉ + MissingColors G (trace.coloring a.succ) v := by + simpa [MissingColors] using hdeltaNew + simp [hold, hnew] + · simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, + true_and, PresentColors, Finset.mem_filter] + constructor + · intro hc hold + rcases hold with ⟨f, hvf, hfc⟩ + exact hc ⟨f, hvf, (hunaffectedValue a f c hcg hcd).mpr hfc⟩ + · intro hc hnew + rcases hnew with ⟨f, hvf, hfc⟩ + exact hc ⟨f, hvf, (hunaffectedValue a f c hcg hcd).mp hfc⟩ + +private theorem helper_hswapMakesGammaMissing_415.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (jSlot : Fin + ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), ( + ∀ (a : Fin trace.steps), trace.gamma a ≠ trace.delta a) → ( + ∀ (a : Fin trace.steps), TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ MissingColors G + (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → w = terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseCaseOneIndices ett p indices + b → ( + ∀ (c : Fin trace.steps), (↑c : ℕ) ≤ (↑a : ℕ) → trace.slot c ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → ( + ∀ (a : Fin trace.steps) {v : V} {f : E}, Sum.inl v ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring + a.castSucc f = some (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → + Sum.inr f ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta + a) (Sum.inl u)) → + ∀ (a : Fin trace.steps), trace.gamma a ∈ MissingColors G (trace.coloring a.succ) u := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport jSlot rho1 u p indices gamma + delta b trace htraceColorsNe hstepData hcomponentEdgeOfVertex a + have hdeltaMissing := hstepData a |>.2.1 + have huComponent : Sum.inl u ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) := rfl + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro hgammaNew + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hgammaNew + obtain ⟨f, huf, hfnew⟩ := hgammaNew + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · have hfold : trace.coloring a.castSucc f = some (trace.delta a) := by + by_cases hfg : trace.coloring a.castSucc f = some (trace.gamma a) + · rw [trace.transition] at hfnew + have : trace.delta a = trace.gamma a := by + simpa [TwoColorComponentSwap, hfComponent, hfg] using hfnew + exact False.elim ((htraceColorsNe a) this.symm) + · by_cases hfd : trace.coloring a.castSucc f = some (trace.delta a) + · exact hfd + · rw [trace.transition] at hfnew + have : trace.coloring a.castSucc f = some (trace.gamma a) := by + simp [TwoColorComponentSwap, hfComponent, hfg, hfd] at hfnew + exact False.elim (hfg this) + have hdeltaNotPresent : trace.delta a ∉ + PresentColors G (trace.coloring a.castSucc) u := by + simpa [MissingColors] using hdeltaMissing + exact hdeltaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, huf, hfold⟩) + · have hfold : trace.coloring a.castSucc f = some (trace.gamma a) := by + rw [trace.transition] at hfnew + simpa [TwoColorComponentSwap, hfComponent] using hfnew + exact hfComponent + (hcomponentEdgeOfVertex a huComponent huf (Or.inl hfold)) + +private theorem helper_hpresentOfNonSubsingleton_453.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ + _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), ( + ∀ (a : Fin trace.steps), trace.gamma a ≠ trace.delta a) → ( + ∀ (n : Fin (trace.steps + (1 : ℕ))), IsProperEdgeColoring G (trace.coloring n)) → + ∀ (a : Fin trace.steps) (v : V), ¬((TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl v)).Subsingleton → trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) v ∧ trace.delta a ∈ PresentColors G + (trace.coloring a.castSucc) v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b + trace htraceColorsNe htraceProper a v hnontrivial + have colorPresent (c d : Fin k) (hcd : c ≠ d) + (hc : c = trace.gamma a ∧ d = trace.delta a ∨ + c = trace.delta a ∧ d = trace.gamma a) : + c ∈ PresentColors G (trace.coloring a.castSucc) v := by + by_contra hcMissing + apply hnontrivial + intro x hx y hy + cases x with + | inl w => + simp [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hx + | inr f => + cases y with + | inl w => + simp [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hy + | inr g => + have hxf := hx + have hyg := hy + simp only [TwoColorIncidenceGraph, SimpleGraph.mem_neighborSet] at hxf hyg + rcases hxf with ⟨hvf, hfc⟩ + rcases hyg with ⟨hvg, hgc⟩ + have hnotC (e : E) (hve : Incident G v e) : + trace.coloring a.castSucc e ≠ some c := by + intro hec + apply hcMissing + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hve, hec⟩ + have hfd : trace.coloring a.castSucc f = some d := by + rcases hc with hc | hc + · rcases hc with ⟨rfl, rfl⟩ + exact hfc.resolve_left (hnotC f hvf) + · rcases hc with ⟨rfl, rfl⟩ + exact hfc.resolve_right (hnotC f hvf) + have hgd : trace.coloring a.castSucc g = some d := by + rcases hc with hc | hc + · rcases hc with ⟨rfl, rfl⟩ + exact hgc.resolve_left (hnotC g hvg) + · rcases hc with ⟨rfl, rfl⟩ + exact hgc.resolve_right (hnotC g hvg) + by_cases hfg : f = g + · subst g + rfl + · exact False.elim + ((htraceProper a.castSucc) hfg ⟨v, hvf, hvg⟩ hfd hgd) + refine ⟨?_, ?_⟩ + · exact colorPresent (trace.gamma a) (trace.delta a) + (htraceColorsNe a) (Or.inl ⟨rfl, rfl⟩) + · exact colorPresent (trace.delta a) (trace.gamma a) + (htraceColorsNe a).symm (Or.inr ⟨rfl, rfl⟩) + +private theorem helper_hmissingPreserved_558.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (jSlot : Fin + ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (TjPrime : TreeSequence G e0) + (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin + ett.rounds) (_ _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), ( + ∀ (a : Fin trace.steps), TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ MissingColors G + (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → w = terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseCaseOneIndices ett p indices + b → ( + ∀ (c : Fin trace.steps), (↑c : ℕ) ≤ (↑a : ℕ) → trace.slot c ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → ( + ∀ (a : Fin trace.steps) {v : V}, Sum.inl v ∉ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → MissingColors G (trace.coloring a.succ) v = + MissingColors G (trace.coloring a.castSucc) v) → ( + ∀ (a : Fin trace.steps) (v : V), Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → trace.gamma a ∈ PresentColors G + (trace.coloring a.castSucc) v → trace.delta a ∈ PresentColors G (trace.coloring + a.castSucc) v → MissingColors G (trace.coloring a.succ) v = MissingColors G + (trace.coloring a.castSucc) v) → ( + ∀ (a : Fin trace.steps) (v : V), ¬((TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl v)).Subsingleton → trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) v ∧ trace.delta a ∈ PresentColors G + (trace.coloring a.castSucc) v) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → ( + ∀ (a : Fin trace.steps) {v : V}, v ∈ TreeVerticesBefore TjPrime u huPrime → trace.gamma a ∉ + MissingColors G rho1 v ∧ trace.delta a ∉ MissingColors G rho1 v) → + ∀ (n : Fin (trace.steps + (1 : ℕ))), + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore + TjPrime u huPrime, MissingColors G (trace.coloring n) v = MissingColors G rho1 v := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSupport jSlot rho1 u TjPrime huPrime p + indices gamma delta b trace hstepData hmissingFixedOutside hmissingFixedInternal + hpresentOfNonSubsingleton hvertexInitialSegment hprefixColorsNotMissing n + induction n using Fin.induction with + | zero => + intro v hv + rw [trace.initialColoring] + | succ a ih => + intro v hv + rcases Finset.mem_union.mp hv with hvTj | hvPrefix + · by_cases hvTerminal : v = terminalSupport + · subst v + by_cases hvComponent : Sum.inl terminalSupport ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · have hnontrivial := (hstepData a).2.2.2.2.1 hvComponent + obtain ⟨hgammaPresent, hdeltaPresent⟩ := + hpresentOfNonSubsingleton a terminalSupport hnontrivial + exact (hmissingFixedInternal a terminalSupport hvComponent + hgammaPresent hdeltaPresent).trans + (ih terminalSupport (Finset.mem_union_left _ hvTj)) + · exact (hmissingFixedOutside a hvComponent).trans + (ih terminalSupport (Finset.mem_union_left _ hvTj)) + · have hvOutside : Sum.inl v ∉ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) := by + intro hvComponent + have hvSlot := hvertexInitialSegment (hstepData a).1 hvTj + exact hvTerminal ((hstepData a).2.2.2.1 v hvSlot hvComponent) + exact (hmissingFixedOutside a hvOutside).trans + (ih v (Finset.mem_union_left _ hvTj)) + · by_cases hvComponent : Sum.inl v ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · obtain ⟨hgammaRho1, hdeltaRho1⟩ := + hprefixColorsNotMissing a hvPrefix + have hcurrent := ih v (Finset.mem_union_right _ hvPrefix) + have hgammaCurrent : trace.gamma a ∉ + MissingColors G (trace.coloring a.castSucc) v := by + rw [hcurrent] + exact hgammaRho1 + have hdeltaCurrent : trace.delta a ∉ + MissingColors G (trace.coloring a.castSucc) v := by + rw [hcurrent] + exact hdeltaRho1 + have hgammaPresent : trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) v := by + simpa [MissingColors] using hgammaCurrent + have hdeltaPresent : trace.delta a ∈ + PresentColors G (trace.coloring a.castSucc) v := by + simpa [MissingColors] using hdeltaCurrent + exact (hmissingFixedInternal a v hvComponent hgammaPresent + hdeltaPresent).trans hcurrent + · exact (hmissingFixedOutside a hvComponent).trans + (ih v (Finset.mem_union_right _ hvPrefix)) + +private theorem helper_hstageEdgeFixedStep_665.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (p : ℕ) (indices : Fin (p + + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) + (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), ( + ∀ (a : Fin trace.steps), TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ MissingColors G + (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → w = terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseCaseOneIndices ett p indices + b → ( + ∀ (c : Fin trace.steps), (↑c : ℕ) ≤ (↑a : ℕ) → trace.slot c ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → ( + ∀ (a : Fin trace.steps) {v : V} {f : E}, Sum.inr f ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring + a.castSucc f = some (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → + Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta + a) (Sum.inl u)) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → + ∀ (a : Fin trace.steps) (q : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + trace.coloring a.succ ((ett.series.data.tree jSlot.succ.castSucc).edge q) = trace.coloring + a.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge q) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + terminalPosition p indices gamma delta b trace hstepData hvertexOfComponentEdge + hvertexInitialSegment a q + let S := ett.series.data.tree jSlot.succ.castSucc + change trace.coloring a.succ (S.edge q) = + trace.coloring a.castSucc (S.edge q) + obtain ⟨i, hi⟩ := S.attaches q + let r : Fin (S.length + 1) := Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ q.isLt)) + have hnewIncident : Incident G (S.vertex q.succ) (S.edge q) := by + unfold Incident + rw [hi] + simp + have holdIncident : Incident G (S.vertex r) (S.edge q) := by + unfold Incident + rw [hi] + simp [r] + have hverticesNe : S.vertex q.succ ≠ S.vertex r := by + intro heq + have hindexEq := S.vertex_injective heq + have hvalEq := congrArg (fun x => x.val) hindexEq + simp [r] at hvalEq + omega + have hnewS : S.vertex q.succ ∈ TreeSequenceVertexSet S := by + simp [TreeSequenceVertexSet] + have holdS : S.vertex r ∈ TreeSequenceVertexSet S := by + simp [TreeSequenceVertexSet] + have hnewSlot := hvertexInitialSegment (hstepData a).1 hnewS + have holdSlot := hvertexInitialSegment (hstepData a).1 holdS + rw [trace.transition] + by_cases hfComponent : Sum.inr (S.edge q) ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · by_cases hfg : trace.coloring a.castSucc (S.edge q) = + some (trace.gamma a) + · have hnewComponent := hvertexOfComponentEdge a hfComponent + hnewIncident (Or.inl hfg) + have holdComponent := hvertexOfComponentEdge a hfComponent + holdIncident (Or.inl hfg) + have hnewTerminal := (hstepData a).2.2.2.1 _ hnewSlot hnewComponent + have holdTerminal := (hstepData a).2.2.2.1 _ holdSlot holdComponent + exact False.elim (hverticesNe (hnewTerminal.trans holdTerminal.symm)) + · by_cases hfd : trace.coloring a.castSucc (S.edge q) = + some (trace.delta a) + · have hnewComponent := hvertexOfComponentEdge a hfComponent + hnewIncident (Or.inr hfd) + have holdComponent := hvertexOfComponentEdge a hfComponent + holdIncident (Or.inr hfd) + have hnewTerminal := (hstepData a).2.2.2.1 _ hnewSlot hnewComponent + have holdTerminal := (hstepData a).2.2.2.1 _ holdSlot holdComponent + exact False.elim (hverticesNe (hnewTerminal.trans holdTerminal.symm)) + · simp [TwoColorComponentSwap, hfComponent, hfg, hfd] + · simp [TwoColorComponentSwap, hfComponent] + +private theorem helper_hfinalGammaMissing_734.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (p : ℕ) (indices : Fin (p + + (1 : ℕ)) → Fin ett.rounds) (gamma : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) + (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), gamma b ∈ + MissingColors G rho1 u → trace.steps = (↑b : ℕ) → ( + ∀ (a : Fin trace.steps), (↑(trace.position a) : ℕ) + (↑a : ℕ) + (1 : ℕ) = (↑b : ℕ)) → ( + ∀ (a : Fin trace.steps), trace.gamma a = gamma (trace.position a)) → ( + ∀ (a : Fin trace.steps), trace.gamma a ∈ MissingColors G (trace.coloring a.succ) u) → gamma (0 + : Fin (p + (1 : ℕ))) ∈ MissingColors G (trace.coloring (Fin.last trace.steps)) u := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + terminalPosition p indices gamma b trace hselected hsteps hpositionReverse htraceGamma + hswapMakesGammaMissing + by_cases hzero : trace.steps = 0 + · have hbzero : b.val = 0 := by omega + have hb : b = 0 := Fin.ext hbzero + have hlastZero : (Fin.last trace.steps : Fin (trace.steps + 1)) = 0 := by + apply Fin.ext + simp [hzero] + rw [hlastZero, trace.initialColoring, ← hb] + exact hselected + · have hpositive : 0 < trace.steps := Nat.pos_of_ne_zero hzero + let a : Fin trace.steps := ⟨trace.steps - 1, by omega⟩ + have hpositionZero : trace.position a = 0 := by + apply Fin.ext + change (trace.position a).val = 0 + have hreverse := hpositionReverse a + have haSucc : a.val + 1 = trace.steps := by + simp [a] + omega + have hsum : (trace.position a).val + trace.steps = b.val := by + omega + have hbval : b.val = trace.steps := hsteps.symm + apply Nat.add_right_cancel (m := trace.steps) + simpa using hsum.trans hbval + have hgammaA : trace.gamma a = gamma 0 := by + rw [htraceGamma, hpositionZero] + have hlast : a.succ = (Fin.last trace.steps : Fin (trace.steps + 1)) := by + apply Fin.ext + simp [a] + omega + rw [← hgammaA, ← hlast] + exact hswapMakesGammaMissing a + +private theorem helper_haugmentationEdgeMissing_799.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (seed : TreeSequence G e0) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (p : ℕ) (indices : + Fin (p + (1 : ℕ)) → Fin ett.rounds) (b : Fin (p + (1 : ℕ))) (_ : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b) + {B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 seed B → + ∀ (a : Fin B.length), seed.length ≤ (↑a : ℕ) → + ∃ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑a : ℕ) ∧ + ∃ (c : Fin k), rho1 (B.edge a) = some c ∧ c ∈ MissingColors G rho1 (B.vertex i) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + seed terminalPosition p indices b trace B hreach + unfold TashkinovAugmentationSequence at hreach + induction hreach with + | refl => + intro a ha + omega + | @tail A B hprior ih hstep => + intro a ha + rcases ih with ⟨hlen, hinit, cnew, hcolor, hmissing⟩ + by_cases hold : a.val < A.length + · let old : Fin A.length := ⟨a.val, hold⟩ + obtain ⟨i, hi, c, hcol, hmiss⟩ := + hstep old (by simpa [old] using ha) + refine ⟨Fin.castLE (Nat.succ_le_succ hinit.1) i, ?_, c, ?_, ?_⟩ + · simpa using hi + · have haold : Fin.castLE hinit.1 old = a := by + apply Fin.ext + rfl + rw [← haold, hinit.2.2] + simpa [old] using hcol + · simpa [hinit.2.1] using hmiss + · have hnew : a.val = A.length := by omega + let last : Fin B.length := ⟨a.val, by omega⟩ + have hlast : a = last := by + apply Fin.ext + simp [last] + rw [hlast] + rw [show B.edge last = + B.edge (Fin.cast hlen.symm (Fin.last A.length)) by + congr 1 + apply Fin.ext + simpa [last] using hnew] + rw [hcolor] + rw [TreeMissingColors] at hmissing + obtain ⟨w, hw, hwm⟩ := Finset.mem_biUnion.mp hmissing + simp only [TreeSequenceVertexSet, Finset.mem_image] at hw + obtain ⟨i, -, hwi⟩ := hw + refine ⟨Fin.castLE (Nat.succ_le_succ hinit.1) i, ?_, cnew, + rfl, ?_⟩ + · change i.val ≤ a.val + omega + · rw [hinit.2.1, hwi] + exact hwm + +private theorem helper_branch_851.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (TjPrime seed : + TreeSequence G e0) (terminalPosition : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)), seed = TreeSequencePrefix (ett.series.data.tree + jSlot.succ.castSucc) (↑terminalPosition : ℕ) hterminalPositionPositive (Nat.le_of_lt_succ + terminalPosition.isLt) → + ∀ (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin + ett.rounds) (_ _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), TashkinovClosure + rho1 seed TjPrime → ( + ∀ (a : Fin trace.steps) (f : E) (c : Fin k), c ≠ trace.gamma a → c ≠ trace.delta a → + (trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c)) → ( + ∀ (a : Fin trace.steps) {v : V}, v ∈ TreeVerticesBefore TjPrime u huPrime → trace.gamma a ∉ + MissingColors G rho1 v ∧ trace.delta a ∉ MissingColors G rho1 v) → ( + ∀ (n : Fin (trace.steps + (1 : ℕ))) (q : Fin (ett.series.data.tree + jSlot.succ.castSucc).length), trace.coloring n ((ett.series.data.tree + jSlot.succ.castSucc).edge q) = rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge q)) → + ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 A B → + TreeSequenceInitialSegment A B) → ( + ∀ {B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 seed B → + ∀ (a : Fin B.length), seed.length ≤ (↑a : ℕ) → + ∃ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑a : ℕ) ∧ + ∃ (c : Fin k), rho1 (B.edge a) = some c ∧ c ∈ MissingColors G rho1 (B.vertex i)) → + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → trace.coloring (Fin.last trace.steps) f = rho1 f := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + TjPrime seed terminalPosition hterminalPositionPositive hseed huPrime p indices gamma delta + b trace hclosure hunaffectedValue hprefixColorsNotMissing hstageEdgesPreserved + hsequenceInitialSegment haugmentationEdgeMissing f hf + rcases hf with hfStage | hfPrefix + · obtain ⟨q, hq⟩ := hfStage + rw [← hq] + exact hstageEdgesPreserved (Fin.last trace.steps) q + · obtain ⟨q, z, hzu, hqz, hqf⟩ := hfPrefix + subst f + by_cases hqSeed : q.val < seed.length + · have hsegment := hsequenceInitialSegment hclosure.1 + let qSeed : Fin seed.length := ⟨q.val, hqSeed⟩ + have hqCast : Fin.castLE hsegment.1 qSeed = q := by + apply Fin.ext + rfl + have hinherited : TjPrime.edge q = seed.edge qSeed := by + rw [← hqCast, hsegment.2.2] + have hseedLength : seed.length = terminalPosition.val := by + rw [hseed] + rfl + have hqStageLt : q.val < + (ett.series.data.tree jSlot.succ.castSucc).length := by + have hterminalLe : terminalPosition.val ≤ + (ett.series.data.tree jSlot.succ.castSucc).length := + Nat.le_of_lt_succ terminalPosition.isLt + omega + let qStage : Fin + (ett.series.data.tree jSlot.succ.castSucc).length := + ⟨q.val, hqStageLt⟩ + subst seed + have hedgeEq : TjPrime.edge q = + (ett.series.data.tree jSlot.succ.castSucc).edge qStage := + hinherited.trans (by rfl) + rw [hedgeEq] + exact hstageEdgesPreserved (Fin.last trace.steps) qStage + · have hqAfterSeed : seed.length ≤ q.val := Nat.le_of_not_gt hqSeed + obtain ⟨i, hiq, c, hcolor, hmissing⟩ := + haugmentationEdgeMissing hclosure.1 q hqAfterSeed + have hiBefore : TjPrime.vertex i ∈ + TreeVerticesBefore TjPrime u huPrime := by + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + constructor + · simp [TreeSequenceVertexSet] + · exact ⟨i, z, rfl, hzu, lt_of_le_of_lt hiq hqz⟩ + have hcAvoids (a : Fin trace.steps) : + c ≠ trace.gamma a ∧ c ≠ trace.delta a := by + obtain ⟨hgammaNotMissing, hdeltaNotMissing⟩ := + hprefixColorsNotMissing a hiBefore + constructor + · intro hcg + apply hgammaNotMissing + rw [← hcg] + exact hmissing + · intro hcd + apply hdeltaNotMissing + rw [← hcd] + exact hmissing + have hcolorPreserved : ∀ n : Fin (trace.steps + 1), + trace.coloring n (TjPrime.edge q) = some c := by + intro n + induction n using Fin.induction with + | zero => + rw [trace.initialColoring] + exact hcolor + | succ a ih => + exact (hunaffectedValue a (TjPrime.edge q) c + (hcAvoids a).1 (hcAvoids a).2).mpr ih + exact (hcolorPreserved (Fin.last trace.steps)).trans hcolor.symm + +private theorem helper_hsteps_791.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (p : ℕ) (indices : Fin (p + + (1 : ℕ)) → Fin ett.rounds) (b : Fin (p + (1 : ℕ))) (trace : ExtensionBaseAlgorithmBTrace + ett terminalSupport rho1 u p indices b), Function.Injective indices → Function.Injective + trace.slot → trace.steps = (↑b : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + terminalPosition p indices b trace hindicesInjective hslotInjective + have hleft : (Finset.univ.image trace.slot).card = trace.steps := by + rw [Finset.card_image_of_injective Finset.univ hslotInjective] + simp + have hright : + (ExtensionBaseCaseOneIndices ett p indices b).card = b.val := by + unfold ExtensionBaseCaseOneIndices + rw [Finset.card_image_of_injective _ hindicesInjective] + let s := Finset.univ.filter fun a : Fin (p + 1) => a.val < b.val + change s.card = b.val + calc + s.card = Fintype.card s := (Fintype.card_coe s).symm + _ = Fintype.card (Fin b.val) := Fintype.card_congr { + toFun := fun a => ⟨a.val.val, (Finset.mem_filter.mp a.property).2⟩ + invFun := fun a => + ⟨⟨a.val, by omega⟩, Finset.mem_filter.mpr ⟨by simp, a.isLt⟩⟩ + left_inv := by intro a; apply Subtype.ext; apply Fin.ext; rfl + right_inv := by intro a; apply Fin.ext; rfl + } + _ = b.val := Fintype.card_fin b.val + rw [← hleft, trace.enumerates, hright] + +private theorem helper_hbeforeEdgesPreserved_1075.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (jSlot : Fin + ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalAt : + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = terminalSupport) (p : + ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p + (1 : ℕ)) → Fin k) (b : + Fin (p + (1 : ℕ))) (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p + indices b), ( + ∀ (a : Fin trace.steps), TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ MissingColors G + (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → w = terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseCaseOneIndices ett p indices + b → ( + ∀ (c : Fin trace.steps), (↑c : ℕ) ≤ (↑a : ℕ) → trace.slot c ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → ( + ∀ (a : Fin trace.steps) {v : V}, Sum.inl v ∉ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → + ∀ {f : E}, Incident G v f → trace.coloring a.succ f = trace.coloring a.castSucc f) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → ( + ∀ {A : TreeSequence G e0} {v w : V} (hv : v ∈ TreeSequenceVertexSet A), w ∈ TreeVerticesBefore + A v hv → w ∈ TreeSequenceVertexSet A ∧ w ≠ v) → + ∀ (n : Fin (trace.steps + (1 : ℕ))) (f : E), ( + ∃ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) terminalSupport (Eq.mpr + (id (congrArg (fun (_a : V) ↦ _a ∈ TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) (Eq.symm hterminalAt))) (of_eq_true (Eq.trans (propext + Finset.mem_image) (Eq.trans (congrArg Exists (funext fun (a : Fin ((ett.series.data.tree + jSlot.castSucc.succ).length + (1 : ℕ))) ↦ Eq.trans (congrFun' (congrArg And ((fun x => + eq_true (Finset.mem_univ x)) a)) ((ett.series.data.tree jSlot.castSucc.succ).vertex a = + (ett.series.data.tree jSlot.castSucc.succ).vertex terminalPosition)) (true_and + ((ett.series.data.tree jSlot.castSucc.succ).vertex a = (ett.series.data.tree + jSlot.castSucc.succ).vertex terminalPosition)))) ((fun f a => eq_true + (exists_apply_eq_apply f a)) (ett.series.data.tree jSlot.castSucc.succ).vertex + terminalPosition))))), Incident G w f) → trace.coloring n f = rho1 f := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport jSlot rho1 u terminalPosition + hterminalAt p indices gamma delta b trace hstepData hfixedOutsideComponent + hvertexInitialSegment hbeforeMemberAndNe n + induction n using Fin.induction with + | zero => + intro f hf + rw [trace.initialColoring] + | succ a ih => + intro f hf + obtain ⟨w, hwBefore, hwf⟩ := hf + have hwData := hbeforeMemberAndNe + (v := terminalSupport) + (by + rw [← hterminalAt] + simp [TreeSequenceVertexSet]) hwBefore + have hwOutside : Sum.inl w ∉ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) := by + intro hwComponent + have hwSlot := hvertexInitialSegment (hstepData a).1 hwData.1 + exact hwData.2 ((hstepData a).2.2.2.1 w hwSlot hwComponent) + exact (hfixedOutsideComponent a hwOutside hwf).trans + (ih f ⟨w, hwBefore, hwf⟩) + +private theorem helper_hindicesInjective_829.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds), + (∀ (a c : Fin (p + (1 : ℕ))), + (↑a : ℕ) < (↑c : ℕ) → (↑(indices a) : ℕ) < (↑(indices c) : ℕ)) → + Function.Injective indices := by + classical + intro V E _ _ _ G k e0 input T generating ett p indices hincreasing a c hac + apply Fin.ext + by_contra hne + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hstrict := hincreasing a c hlt + rw [hac] at hstrict + exact (Nat.lt_irrefl _ hstrict) + · have hstrict := hincreasing c a hgt + rw [hac] at hstrict + exact (Nat.lt_irrefl _ hstrict) + +private theorem helper_hslotInjective_840.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (rho1 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (b : Fin (p + (1 : ℕ))) + (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), + Function.Injective trace.slot := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices b trace a c hac + apply Fin.ext + by_contra hne + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hstrict := trace.strictlyDescending a c hlt + rw [hac] at hstrict + exact (Nat.lt_irrefl _ hstrict) + · have hstrict := trace.strictlyDescending c a hgt + rw [hac] at hstrict + exact (Nat.lt_irrefl _ hstrict) + +private theorem helper_hpositionSurjectiveBelow_859.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (b + : Fin (p + (1 : ℕ))) (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p + indices b), Function.Injective indices → + ∀ (q : Fin (p + (1 : ℕ))), (↑q : ℕ) < (↑b : ℕ) → + ∃ (a : Fin trace.steps), trace.position a = q := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices b trace + hindicesInjective q hqb + have hmem : indices q ∈ Finset.univ.image trace.slot := by + rw [trace.enumerates] + unfold ExtensionBaseCaseOneIndices + exact Finset.mem_image.mpr ⟨q, by simpa using hqb, rfl⟩ + obtain ⟨a, -, ha⟩ := Finset.mem_image.mp hmem + refine ⟨a, hindicesInjective ?_⟩ + rw [← trace.slotIdentity a] + exact ha + +private theorem helper_hgammaDeltaNe_915 : + open scoped Classical in + ∀ {k : ℕ} (p : ℕ) (gamma delta : Fin (p + (1 : ℕ)) → Fin k), + (∀ (a : Fin p), gamma a.succ = delta a.castSucc) → + Function.Injective (Fin.cons (gamma (0 : Fin (p + (1 : ℕ)))) delta) → + ∀ (q : Fin (p + (1 : ℕ))), + gamma q ≠ delta q := by + classical + intro k p gamma delta hchain hdistinct q + have hconsGamma : + (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) q.castSucc = + gamma q := by + refine Fin.cases ?_ (fun r => ?_) q + · simp + · rw [show (Fin.succ r).castSucc = r.castSucc.succ by + apply Fin.ext + rfl] + rw [Fin.cons_succ] + exact (hchain r).symm + have hconsDelta : + (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) q.succ = + delta q := by simp + intro heq + have hindexEq : q.castSucc = q.succ := + hdistinct (hconsGamma.trans (heq.trans hconsDelta.symm)) + exact (ne_of_lt Fin.castSucc_lt_succ) hindexEq + +private theorem helper_hvertexOfComponentEdge_941.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ + _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b) (a : Fin trace.steps) + {v : V} {f : E}, Sum.inr f ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma + a) (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring a.castSucc f = some + (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → Sum.inl v ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b + trace a v f hfComponent hvf hfColor + change (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inl u) + at hfComponent + change (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk + (Sum.inl v) = + (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inl u) + have hadj : (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).Adj (Sum.inl v) (Sum.inr f) := by + simpa [TwoColorIncidenceGraph] using And.intro hvf hfColor + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans hfComponent + +private theorem helper_hcomponentEdgeOfVertex_966.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ + _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b) (a : Fin trace.steps) + {v : V} {f : E}, Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma + a) (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring a.castSucc f = some + (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b + trace a v f hvComponent hvf hfColor + change (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk + (Sum.inl v) = + (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inl u) + at hvComponent + change (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inl u) + have hadj : (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).Adj (Sum.inr f) (Sum.inl v) := by + simpa [TwoColorIncidenceGraph] using And.intro hvf hfColor + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans hvComponent + +private theorem helper_hfixedOutsideComponent_991.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ + _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), ( + ∀ (a : Fin trace.steps) {v : V} {f : E}, Sum.inr f ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring + a.castSucc f = some (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → + Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta + a) (Sum.inl u)) → + ∀ (a : Fin trace.steps) {v : V}, Sum.inl v ∉ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → + ∀ {f : E}, Incident G v f → trace.coloring a.succ f = trace.coloring a.castSucc f := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b + trace hvertexOfComponentEdge a v hvOutside f hvf + rw [trace.transition] + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · by_cases hfg : trace.coloring a.castSucc f = some (trace.gamma a) + · exact False.elim (hvOutside + (hvertexOfComponentEdge a hfComponent hvf (Or.inl hfg))) + · by_cases hfd : trace.coloring a.castSucc f = some (trace.delta a) + · exact False.elim (hvOutside + (hvertexOfComponentEdge a hfComponent hvf (Or.inr hfd))) + · simp [TwoColorComponentSwap, hfComponent, hfg, hfd] + · simp [TwoColorComponentSwap, hfComponent] + +private theorem helper_hmissingFixedOutside_1009.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (b + : Fin (p + (1 : ℕ))) (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p + indices b), ( + ∀ (a : Fin trace.steps) {v : V}, Sum.inl v ∉ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → + ∀ {f : E}, Incident G v f → trace.coloring a.succ f = trace.coloring a.castSucc f) → + ∀ (a : Fin trace.steps) {v : V}, Sum.inl v ∉ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → MissingColors G (trace.coloring a.succ) v = + MissingColors G (trace.coloring a.castSucc) v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices b trace + hfixedOutsideComponent a v hvOutside + apply Finset.ext + intro c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + constructor + · intro hc hold + rcases hold with ⟨f, hvf, hfc⟩ + exact hc ⟨f, hvf, (hfixedOutsideComponent a hvOutside hvf).trans hfc⟩ + · intro hc hnew + rcases hnew with ⟨f, hvf, hfc⟩ + exact hc ⟨f, hvf, (hfixedOutsideComponent a hvOutside hvf).symm.trans hfc⟩ + +private theorem helper_hunaffectedValue_1026.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ + _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), ( + ∀ (a : Fin trace.steps), trace.gamma a ≠ trace.delta a) → + ∀ (a : Fin trace.steps) (f : E) (c : Fin k), c ≠ trace.gamma a → c ≠ trace.delta a → + (trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b + trace htraceColorsNe a f c hcg hcd + rw [trace.transition] + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · by_cases hfg : trace.coloring a.castSucc f = some (trace.gamma a) + · simp [TwoColorComponentSwap, hfComponent, hfg, hcg.symm, hcd.symm] + · by_cases hfd : trace.coloring a.castSucc f = some (trace.delta a) + · simp [TwoColorComponentSwap, hfComponent, hfd, + (htraceColorsNe a).symm, hcg.symm, hcd.symm] + · simp [TwoColorComponentSwap, hfComponent, hfg, hfd] + · simp [TwoColorComponentSwap, hfComponent] + +private theorem helper_hvertexInitialSegment_1077.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} + {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B := by + classical + intro V E G e0 A B hAB v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + obtain ⟨i, -, hi⟩ := hv + obtain ⟨hlen, hvertices, -⟩ := hAB + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, ?_⟩ + exact (hvertices i).trans hi + +private theorem helper_hbeforeMemberAndNe_1086.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (p : ℕ) (indices : Fin (p + + (1 : ℕ)) → Fin ett.rounds) (b : Fin (p + (1 : ℕ))) (_ : ExtensionBaseAlgorithmBTrace ett + terminalSupport rho1 u p indices b) {A : TreeSequence G e0} {v w : V} (hv : v ∈ + TreeSequenceVertexSet A), w ∈ TreeVerticesBefore A v hv → w ∈ TreeSequenceVertexSet A ∧ w + ≠ v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + terminalPosition p indices b trace A v w hv hw + unfold TreeVerticesBefore at hw + obtain ⟨hwA, i, j, hiw, hjv, hij⟩ := Finset.mem_filter.mp hw + refine ⟨hwA, ?_⟩ + intro hwv + have hijEq : i = j := A.vertex_injective + (hiw.trans (hwv.trans hjv.symm)) + omega + +private theorem helper_hprefixColorsNotMissing_1097.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (TjPrime : TreeSequence G e0) (huPrime : u ∈ + TreeSequenceVertexSet TjPrime) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (_ _ + : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : ExtensionBaseAlgorithmBTrace + ett terminalSupport rho1 u p indices b), (((TreeVerticesBefore TjPrime u huPrime).biUnion + fun (v : V) ↦ MissingColors G rho1 v) ∩ (ExtensionBaseCaseOneIndices ett p indices + b).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ : Finset (Fin k)) = ∅ + → ( + ∀ (a : Fin trace.steps), ett.series.data.stored (trace.slot a).succ = (insert (trace.gamma a) + ({trace.delta a} : Finset (Fin k)) : Finset (Fin k))) → ( + ∀ (a : Fin trace.steps), trace.slot a ∈ ExtensionBaseCaseOneIndices ett p indices b) → + ∀ (a : Fin trace.steps) {v : V}, v ∈ TreeVerticesBefore TjPrime u huPrime → trace.gamma a ∉ + MissingColors G rho1 v ∧ trace.delta a ∉ MissingColors G rho1 v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u TjPrime huPrime p indices + gamma delta b trace hprefixAvoids htraceStored hslotProcessed a v hv + have exclude (c : Fin k) (hc : c ∈ + ett.series.data.stored (trace.slot a).succ) : + c ∉ MissingColors G rho1 v := by + intro hmissing + have hleft : c ∈ + (TreeVerticesBefore TjPrime u huPrime).biUnion + (fun w => MissingColors G rho1 w) := + Finset.mem_biUnion.mpr ⟨v, hv, hmissing⟩ + have hright : c ∈ + (ExtensionBaseCaseOneIndices ett p indices b).biUnion + (fun t => ett.series.data.stored t.succ) := + Finset.mem_biUnion.mpr ⟨trace.slot a, hslotProcessed a, hc⟩ + have hinter := Finset.mem_inter.mpr ⟨hleft, hright⟩ + rw [hprefixAvoids] at hinter + simp at hinter + rw [htraceStored] at exclude + exact ⟨exclude (trace.gamma a) (by simp), + exclude (trace.delta a) (by simp)⟩ + +private theorem helper_hstageEdgesPreserved_1169.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (b : Fin (p + (1 : ℕ))) + (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), + (∀ (a : Fin trace.steps) (q : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + trace.coloring a.succ ((ett.series.data.tree jSlot.succ.castSucc).edge q) = + trace.coloring a.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge q)) → + ∀ (n : Fin (trace.steps + (1 : ℕ))) + (q : Fin (ett.series.data.tree jSlot.succ.castSucc).length), + trace.coloring n ((ett.series.data.tree jSlot.succ.castSucc).edge q) = + rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge q) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport jSlot rho1 u p indices b trace + hstageEdgeFixedStep n + induction n using Fin.induction with + | zero => + intro q + rw [trace.initialColoring] + | succ a ih => + intro q + exact (hstageEdgeFixedStep a q).trans (ih q) + +private theorem helper_hinitialSegmentTrans_1187.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} + {A B D : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B + D → TreeSequenceInitialSegment A D := by + classical + intro V E G e0 A B D hAB hBD + obtain ⟨hlenAB, hverticesAB, hedgesAB⟩ := hAB + obtain ⟨hlenBD, hverticesBD, hedgesBD⟩ := hBD + refine ⟨hlenAB.trans hlenBD, ?_, ?_⟩ + · intro i + rw [show Fin.castLE (Nat.succ_le_succ (hlenAB.trans hlenBD)) i = + Fin.castLE (Nat.succ_le_succ hlenBD) + (Fin.castLE (Nat.succ_le_succ hlenAB) i) by + apply Fin.ext + rfl] + rw [hverticesBD, hverticesAB] + · intro q + rw [show Fin.castLE (hlenAB.trans hlenBD) q = + Fin.castLE hlenBD (Fin.castLE hlenAB q) by + apply Fin.ext + rfl] + rw [hedgesBD, hedgesAB] + +private theorem helper_hsequenceInitialSegment_1207.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (rho1 : PartialEdgeColoring E k), ( + ∀ {A B D : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B D + → TreeSequenceInitialSegment A D) → + ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 A B → + TreeSequenceInitialSegment A B := by + classical + intro V E _ _ G k e0 rho1 hinitialSegmentTrans A B hreach + let _ := Fintype.ofFinite V + unfold TashkinovAugmentationSequence at hreach + induction hreach using Relation.ReflTransGen.head_induction_on with + | refl => + refine ⟨Nat.le_refl _, ?_, ?_⟩ + · intro i + rfl + · intro q + rfl + | @head A D hstep htail ih => + exact hinitialSegmentTrans hstep.2.1 ih + +private theorem helper_branch_1233.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (TjPrime seed : + TreeSequence G e0) (terminalPosition : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)), seed = TreeSequencePrefix (ett.series.data.tree + jSlot.succ.castSucc) (↑terminalPosition : ℕ) hterminalPositionPositive ( + by omega + ) → + ∀ (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin + ett.rounds) (_ _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), TashkinovClosure + rho1 seed TjPrime → ( + ∀ (a : Fin trace.steps) (f : E) (c : Fin k), c ≠ trace.gamma a → c ≠ trace.delta a → + (trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c)) → ( + ∀ (a : Fin trace.steps) {v : V}, v ∈ TreeVerticesBefore TjPrime u huPrime → trace.gamma a ∉ + MissingColors G rho1 v ∧ trace.delta a ∉ MissingColors G rho1 v) → ( + ∀ (n : Fin (trace.steps + (1 : ℕ))) (q : Fin (ett.series.data.tree + jSlot.succ.castSucc).length), trace.coloring n ((ett.series.data.tree + jSlot.succ.castSucc).edge q) = rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge q)) → + ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 A B → + TreeSequenceInitialSegment A B) → ( + ∀ {B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 seed B → + ∀ (a : Fin B.length), seed.length ≤ (↑a : ℕ) → + ∃ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑a : ℕ) ∧ + ∃ (c : Fin k), rho1 (B.edge a) = some c ∧ c ∈ MissingColors G rho1 (B.vertex i)) → + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → trace.coloring (Fin.last trace.steps) f = rho1 f := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + TjPrime seed terminalPosition hterminalPositionPositive hseed huPrime p indices gamma delta + b trace hclosure hunaffectedValue hprefixColorsNotMissing hstageEdgesPreserved + hsequenceInitialSegment haugmentationEdgeMissing + exact @helper_branch_851 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport jSlot rho1 u TjPrime seed terminalPosition + hterminalPositionPositive hseed huPrime p indices gamma delta b trace hclosure + hunaffectedValue hprefixColorsNotMissing hstageEdgesPreserved hsequenceInitialSegment + haugmentationEdgeMissing + +private theorem helper_branch_1767.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (TjPrime seed : + TreeSequence G e0) (terminalPosition : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)), seed = TreeSequencePrefix (ett.series.data.tree + jSlot.succ.castSucc) (↑terminalPosition : ℕ) hterminalPositionPositive ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) → + ∀ (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin + ett.rounds) (_ _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), TashkinovClosure + rho1 seed TjPrime → ( + ∀ (a : Fin trace.steps) (f : E) (c : Fin k), c ≠ trace.gamma a → c ≠ trace.delta a → + (trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c)) → ( + ∀ (a : Fin trace.steps) {v : V}, v ∈ TreeVerticesBefore TjPrime u huPrime → trace.gamma a ∉ + MissingColors G rho1 v ∧ trace.delta a ∉ MissingColors G rho1 v) → ( + ∀ (n : Fin (trace.steps + (1 : ℕ))) (q : Fin (ett.series.data.tree + jSlot.succ.castSucc).length), trace.coloring n ((ett.series.data.tree + jSlot.succ.castSucc).edge q) = rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge q)) → + ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 A B → + TreeSequenceInitialSegment A B) → ( + ∀ {B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 seed B → + ∀ (a : Fin B.length), seed.length ≤ (↑a : ℕ) → + ∃ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑a : ℕ) ∧ + ∃ (c : Fin k), rho1 (B.edge a) = some c ∧ c ∈ MissingColors G rho1 (B.vertex i)) → + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → trace.coloring (Fin.last trace.steps) f = rho1 f := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + TjPrime seed terminalPosition hterminalPositionPositive hseed huPrime p indices gamma delta + b trace hclosure hunaffectedValue hprefixColorsNotMissing hstageEdgesPreserved + hsequenceInitialSegment haugmentationEdgeMissing + exact @helper_branch_1233 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@jSlot) (@rho1) + (@u) (@TjPrime) (@seed) (@terminalPosition) (@hterminalPositionPositive) (@hseed) + (@huPrime) (@p) (@indices) (@gamma) (@delta) (@b) (@trace) (@hclosure) (@hunaffectedValue) + (@hprefixColorsNotMissing) (@hstageEdgesPreserved) (@hsequenceInitialSegment) + (@haugmentationEdgeMissing) + +private theorem helper_hpositionBelowAnti_1591.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (p : ℕ) (indices : Fin (p + + (1 : ℕ)) → Fin ett.rounds) (gamma : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))), ( + ∀ (a c : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑c : ℕ) → (↑(indices a) : ℕ) < (↑(indices c) : ℕ)) → + ∀ (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), ( + ∀ (a : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → gamma a ∉ MissingColors G rho1 u) → + ∀ (hsteps : trace.steps = (↑b : ℕ)), Function.Injective trace.position → + let positionBelow : Fin (↑b : ℕ) → Fin (↑b : ℕ) := fun (a : Fin (↑b : ℕ)) ↦ + (⟨(↑(trace.position (Fin.cast ( + by + omega + ) a)) : ℕ), trace.positionBefore (Fin.cast ( + by + omega + ) a)⟩ : Fin (↑b : ℕ)); StrictAnti positionBelow := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + terminalPosition p indices gamma b hincreasing trace _ hsteps hpositionInjective + positionBelow a c hac + have hdesc := trace.strictlyDescending + (Fin.cast hsteps.symm a) (Fin.cast hsteps.symm c) (by simpa using hac) + rw [trace.slotIdentity, trace.slotIdentity] at hdesc + by_contra hnot + have hle : (trace.position (Fin.cast hsteps.symm a)).val ≤ + (trace.position (Fin.cast hsteps.symm c)).val := Nat.le_of_not_gt hnot + rcases lt_or_eq_of_le hle with hlt | heq + · have hinc := hincreasing _ _ hlt + omega + · have hposEq : trace.position (Fin.cast hsteps.symm a) = + trace.position (Fin.cast hsteps.symm c) := Fin.ext heq + exact (ne_of_lt hac) (by + have hcastEq := hpositionInjective hposEq + apply Fin.ext + simpa using congrArg (fun x => x.val) hcastEq) + +private theorem helper_hpositionBelowRev_1608.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (rho1 : + PartialEdgeColoring E k) (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (b + : Fin (p + (1 : ℕ))) (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p + indices b) (hsteps : trace.steps = (↑b : ℕ)), + let positionBelow : Fin (↑b : ℕ) → Fin (↑b : ℕ) := fun (a : Fin (↑b : ℕ)) ↦ + (⟨(↑(trace.position (Fin.cast ( + by + omega + ) a)) : ℕ), trace.positionBefore (Fin.cast ( + by + omega + ) a)⟩ : Fin (↑b : ℕ)); StrictAnti positionBelow → + ∀ (a : Fin (↑b : ℕ)), positionBelow a = a.rev := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport rho1 u p indices b trace hsteps + positionBelow hpositionBelowAnti a + have hmono : StrictMono (fun q : Fin b.val => (positionBelow q).rev) := by + intro q r hqr + exact Fin.rev_lt_rev.mpr (hpositionBelowAnti hqr) + have hid := congrFun hmono.eq_id a + exact Fin.rev_eq_iff.mp hid + +private theorem helper_hpositionReverse_1614.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + ∀ terminalSupport ∈ TreeSequenceVertexSet T, + ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (p : ℕ) (indices : Fin (p + + (1 : ℕ)) → Fin ett.rounds) (b : Fin (p + (1 : ℕ))) (trace : ExtensionBaseAlgorithmBTrace + ett terminalSupport rho1 u p indices b) (hsteps : trace.steps = (↑b : ℕ)), + let positionBelow : Fin (↑b : ℕ) → Fin (↑b : ℕ) := fun (a : Fin (↑b : ℕ)) ↦ + (⟨(↑(trace.position (Fin.cast ( + by + omega + ) a)) : ℕ), trace.positionBefore (Fin.cast ( + by + omega + ) a)⟩ : Fin (↑b : ℕ)); ( + ∀ (a : Fin (↑b : ℕ)), positionBelow a = a.rev) → + ∀ (a : Fin trace.steps), (↑(trace.position a) : ℕ) + (↑a : ℕ) + (1 : ℕ) = (↑b : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + terminalPosition p indices b trace hsteps positionBelow hpositionBelowRev a + have hrev := hpositionBelowRev (Fin.cast hsteps a) + have hval := congrArg Fin.val hrev + simp [positionBelow] at hval + omega + +private theorem helper_continuation_1854.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (_ : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot : Fin ett.rounds) (rho1 : + PartialEdgeColoring E k) (C : Finset (Fin k)) (u : V) (TjPrime seed : TreeSequence G e0) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalAt : (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = + terminalSupport) (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (_ : seed + = TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive (Nat.le_of_lt_succ terminalPosition.isLt)) (huPrime : u ∈ + TreeSequenceVertexSet TjPrime) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) + (gamma _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : + ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b) (_ : + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) terminalSupport ( + by + classical + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨terminalPosition, hterminalAt⟩ + ) C (ett.series.data.coloring jSlot.castSucc) rho1) (_ : TashkinovClosure rho1 seed TjPrime) + (_ : (((TreeVerticesBefore TjPrime u huPrime).biUnion fun (v : V) ↦ MissingColors G rho1 + v) ∩ (ExtensionBaseCaseOneIndices ett p indices b).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ : Finset (Fin k)) = ∅) (_ : gamma b ∈ MissingColors G rho1 + u) (_ : trace.steps = (↑b : ℕ)) (_ : + ∀ (a : Fin trace.steps), (↑(trace.position a) : ℕ) + (↑a : ℕ) + (1 : ℕ) = (↑b : ℕ)) (_ : + ∀ (a : Fin trace.steps), trace.gamma a = gamma (trace.position a)) (_ : + ∀ (a : Fin trace.steps), TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ MissingColors G + (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → w = terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseCaseOneIndices ett p indices + b → ( + ∀ (c : Fin trace.steps), (↑c : ℕ) ≤ (↑a : ℕ) → trace.slot c ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) (_ : + ∀ (a : Fin trace.steps) {v : V} {f : E} (_ : Sum.inr f ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u)) (_ : Incident G v f) (_ : + trace.coloring a.castSucc f = some (trace.gamma a) ∨ trace.coloring a.castSucc f = some + (trace.delta a)), Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma + a) (trace.delta a) (Sum.inl u)) (_ : + ∀ (a : Fin trace.steps) {v : V} (_ : Sum.inl v ∉ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u)) {f : E} (_ : Incident G v f), + trace.coloring a.succ f = trace.coloring a.castSucc f) (_ : + ∀ (a : Fin trace.steps) {v : V} (_ : Sum.inl v ∉ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u)), MissingColors G (trace.coloring + a.succ) v = MissingColors G (trace.coloring a.castSucc) v) (_ : + ∀ (a : Fin trace.steps) (f : E) (c : Fin k) (_ : c ≠ trace.gamma a) (_ : c ≠ trace.delta a), + trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c) (_ : + ∀ (a : Fin trace.steps) (v : V) (_ : Sum.inl v ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u)) (_ : trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) v) (_ : trace.delta a ∈ PresentColors G + (trace.coloring a.castSucc) v), MissingColors G (trace.coloring a.succ) v = MissingColors + G (trace.coloring a.castSucc) v) (_ : + ∀ (a : Fin trace.steps), trace.gamma a ∈ MissingColors G (trace.coloring a.succ) u) (_ : + ∀ (a : Fin trace.steps) (v : V) (_ : ¬((TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl v)).Subsingleton), trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) v ∧ trace.delta a ∈ PresentColors G + (trace.coloring a.castSucc) v) (_ : + ∀ (a : Fin trace.steps), ett.series.data.stored (trace.slot a).succ = (insert (trace.gamma a) + ({trace.delta a} : Finset (Fin k)) : Finset (Fin k))) (_ : + ∀ (a : Fin trace.steps), trace.slot a ∈ ExtensionBaseCaseOneIndices ett p indices b) (_ : + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) {v : V} (_ : v ∈ + TreeSequenceVertexSet A), v ∈ TreeSequenceVertexSet B) (_ : + ∀ {A : TreeSequence G e0} {v w : V} (hv : v ∈ TreeSequenceVertexSet A) (_ : w ∈ + TreeVerticesBefore A v hv), w ∈ TreeSequenceVertexSet A ∧ w ≠ v), + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) terminalSupport ( + by + classical + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨terminalPosition, hterminalAt⟩ + ) C (ett.series.data.coloring jSlot.castSucc) (trace.coloring (Fin.last trace.steps)) ∧ (( + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore + TjPrime u huPrime, MissingColors G (trace.coloring (Fin.last trace.steps)) v = + MissingColors G rho1 v) ∧ + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → trace.coloring (Fin.last trace.steps) f = rho1 f) ∧ + gamma (0 : Fin (p + (1 : ℕ))) ∈ MissingColors G (trace.coloring (Fin.last trace.steps)) u + := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 C u + TjPrime seed terminalPosition hterminalAt hterminalPositionPositive hseed huPrime p indices + gamma delta b trace hbaseStable hclosure hprefixAvoids hselected hsteps hpositionReverse + htraceGamma hstepData hvertexOfComponentEdge hfixedOutsideComponent hmissingFixedOutside + hunaffectedValue hmissingFixedInternal hswapMakesGammaMissing hpresentOfNonSubsingleton + htraceStored hslotProcessed hvertexInitialSegment hbeforeMemberAndNe + have hprefixColorsNotMissing := @helper_hprefixColorsNotMissing_1097 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@terminalSupport) (@rho1) (@u) (@TjPrime) (@huPrime) (@p) (@indices) (@gamma) (@delta) (@b) + (@trace) (@hprefixAvoids) (@htraceStored) (@hslotProcessed) + have hmissingPreserved := + @helper_hmissingPreserved_558 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport jSlot rho1 u TjPrime huPrime + p indices gamma delta b trace hstepData hmissingFixedOutside hmissingFixedInternal + hpresentOfNonSubsingleton hvertexInitialSegment hprefixColorsNotMissing + have hbeforeEdgesPreserved := + @helper_hbeforeEdgesPreserved_1075 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport jSlot rho1 u terminalPosition hterminalAt p + indices gamma delta b trace hstepData hfixedOutsideComponent hvertexInitialSegment + hbeforeMemberAndNe + have hstableOutput : StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) terminalSupport + (by + rw [← hterminalAt] + simp [TreeSequenceVertexSet]) + C (ett.series.data.coloring jSlot.castSucc) + (trace.coloring (Fin.last trace.steps)) := by + unfold StableColoringBeforeVertex at hbaseStable ⊢ + constructor + · intro f hfIncident hfControlled + exact (hbeforeEdgesPreserved (Fin.last trace.steps) f hfIncident).trans + (hbaseStable.1 f hfIncident hfControlled) + · intro w hwBefore + have hwTj := (hbeforeMemberAndNe + (v := terminalSupport) + (by + rw [← hterminalAt] + simp [TreeSequenceVertexSet]) hwBefore).1 + exact (hmissingPreserved (Fin.last trace.steps) w + (Finset.mem_union_left _ hwTj)).trans (hbaseStable.2 w hwBefore) + have hstageEdgeFixedStep := @helper_hstageEdgeFixedStep_665 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u + terminalPosition p indices gamma delta b trace hstepData hvertexOfComponentEdge + hvertexInitialSegment + have hstageEdgesPreserved := + @helper_hstageEdgesPreserved_1169 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@jSlot) (@rho1) (@u) + (@p) (@indices) (@b) (@trace) (@hstageEdgeFixedStep) + have hfinalGammaMissing := + @helper_hfinalGammaMissing_734 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport hterminalSupport jSlot rho1 u terminalPosition p + indices gamma b trace hselected hsteps hpositionReverse htraceGamma hswapMakesGammaMissing + have hinitialSegmentTrans := @helper_hinitialSegmentTrans_1187 (@V) (@E) (@G) (@e0) + have hsequenceInitialSegment := @helper_hsequenceInitialSegment_1207 (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@rho1) (@hinitialSegmentTrans) + have haugmentationEdgeMissing := @helper_haugmentationEdgeMissing_799 V E inferInstance + inferInstance inferInstance G k e0 input T generating ett terminalSupport hterminalSupport + jSlot rho1 u seed terminalPosition p indices b trace + refine ⟨hstableOutput, ?_, hfinalGammaMissing⟩ + constructor + · intro v hv + exact hmissingPreserved (Fin.last trace.steps) v hv + · exact @helper_branch_1767 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@jSlot) (@rho1) + (@u) (@TjPrime) (@seed) (@terminalPosition) (@hterminalPositionPositive) (@hseed) + (@huPrime) (@p) (@indices) (@gamma) (@delta) (@b) (@trace) (@hclosure) (@hunaffectedValue) + (@hprefixColorsNotMissing) (@hstageEdgesPreserved) (@hsequenceInitialSegment) + (@haugmentationEdgeMissing) + +theorem ExtensionBaseClaim44 {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot : Fin ett.rounds) + (_ : jSlot.val + 1 = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) + (rho1 : PartialEdgeColoring E k) + (C : Finset (Fin k)) (u : V) + (TjPrime seed : TreeSequence G e0) + (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + 1)) + (hterminalAt : + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = + terminalSupport) + (hterminalPositionPositive : 1 ≤ terminalPosition.val) + (hseed : seed = TreeSequencePrefix + (ett.series.data.tree jSlot.succ.castSucc) terminalPosition.val + hterminalPositionPositive + (Nat.le_of_lt_succ terminalPosition.isLt)) + (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds) + (gamma delta : Fin (p + 1) → Fin k) (b : Fin (p + 1)) + (hincreasing : ∀ a c, a.val < c.val → + (indices a).val < (indices c).val) + (_ : ∀ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport ↔ + ∃ a : Fin (p + 1), indices a = r) + (trace : ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u + p indices b) + (hinvariant : ExtensionBaseAlgorithmBInvariant ett terminalSupport + jSlot rho1 u p indices b trace) + (hbaseStable : StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) terminalSupport + (by + rw [← hterminalAt] + simp [TreeSequenceVertexSet]) + C (ett.series.data.coloring jSlot.castSucc) rho1) + (_ : u ∉ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)) + (hclosure : TashkinovClosure rho1 seed TjPrime) + (hprefixAvoids : + (TreeVerticesBefore TjPrime u huPrime).biUnion + (fun v => MissingColors G rho1 v) ∩ + ((ExtensionBaseCaseOneIndices ett p indices b).biUnion + fun t => ett.series.data.stored t.succ) = ∅) + (hselected : gamma b ∈ MissingColors G rho1 u) + (_ : ∀ a : Fin (p + 1), a.val < b.val → + gamma a ∉ MissingColors G rho1 u) + (hgamma : ∀ a, + ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : ∀ a, + ett.series.data.delta (indices a).succ = some (delta a)) + (hchain : ∀ a : Fin p, gamma a.succ = delta a.castSucc) + (hdistinct : Function.Injective (Fin.cons (gamma 0) delta)) + (hstored : ∀ a, + ett.series.data.stored (indices a).succ = {gamma a, delta a}) : + let rho2 := trace.coloring (Fin.last trace.steps) + StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) terminalSupport + (by + rw [← hterminalAt] + simp [TreeSequenceVertexSet]) + C (ett.series.data.coloring jSlot.castSucc) rho2 ∧ + ((∀ v : V, + v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) ∪ + TreeVerticesBefore TjPrime u huPrime → + MissingColors G rho2 v = MissingColors G rho1 v) ∧ + ∀ f : E, + ((∃ a : Fin (ett.series.data.tree + jSlot.succ.castSucc).length, + (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + 1)), + TjPrime.vertex z = u ∧ a.val < z.val ∧ + TjPrime.edge a = f) → + rho2 f = rho1 f) ∧ + gamma 0 ∈ MissingColors G rho2 u := by + classical + dsimp only + have hindicesInjective := + @helper_hindicesInjective_829 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@p) (@indices) (@hincreasing) + have hslotInjective := + @helper_hslotInjective_840 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@rho1) (@u) (@p) (@indices) + (@b) (@trace) + have hsteps := + @helper_hsteps_791 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport jSlot rho1 u terminalPosition p indices b + trace hindicesInjective hslotInjective + have hpositionInjective : Function.Injective trace.position := by + intro a c hac + apply hslotInjective + rw [trace.slotIdentity, trace.slotIdentity, hac] + have hpositionSurjectiveBelow := + @helper_hpositionSurjectiveBelow_859 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@rho1) (@u) (@p) + (@indices) (@b) (@trace) (@hindicesInjective) + let positionBelow : Fin b.val → Fin b.val := fun a => + ⟨(trace.position (Fin.cast hsteps.symm a)).val, + trace.positionBefore (Fin.cast hsteps.symm a)⟩ + have hpositionBelowAnti : StrictAnti positionBelow := by + exact @helper_hpositionBelowAnti_1591 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) + (@jSlot) (@rho1) (@u) (@terminalPosition) (@p) (@indices) (@gamma) (@b) (@hincreasing) + (@trace) (by assumption) (@hsteps) (@hpositionInjective) + have hpositionBelowRev := @helper_hpositionBelowRev_1608 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@rho1) + (@u) (@p) (@indices) (@b) (@trace) (@hsteps) (@hpositionBelowAnti) + have hpositionReverse := @helper_hpositionReverse_1614 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) + (@hterminalSupport) (@jSlot) (@rho1) (@u) (@terminalPosition) (@p) (@indices) (@b) (@trace) + (@hsteps) (@hpositionBelowRev) + have htraceGamma (a : Fin trace.steps) : + trace.gamma a = gamma (trace.position a) := by + apply Option.some.inj + exact (trace.gammaField a).symm.trans (by + rw [trace.slotIdentity] + exact hgamma (trace.position a)) + have htraceDelta (a : Fin trace.steps) : + trace.delta a = delta (trace.position a) := by + apply Option.some.inj + exact (trace.deltaField a).symm.trans (by + rw [trace.slotIdentity] + exact hdelta (trace.position a)) + have hgammaDeltaNe := @helper_hgammaDeltaNe_915 (@k) (@p) (@gamma) (@delta) (@hchain) (@hdistinct) + have htraceColorsNe (a : Fin trace.steps) : + trace.gamma a ≠ trace.delta a := by + rw [htraceGamma, htraceDelta] + exact hgammaDeltaNe (trace.position a) + have htraceProper (n : Fin (trace.steps + 1)) : + IsProperEdgeColoring G (trace.coloring n) := + (hinvariant.1 n).1 + have hstepData (a : Fin trace.steps) := hinvariant.2.1 a + have hvertexOfComponentEdge := @helper_hvertexOfComponentEdge_941 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@terminalSupport) (@rho1) (@u) (@p) (@indices) (@gamma) (@delta) (@b) (@trace) + have hcomponentEdgeOfVertex := @helper_hcomponentEdgeOfVertex_966 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@terminalSupport) (@rho1) (@u) (@p) (@indices) (@gamma) (@delta) (@b) (@trace) + have hfixedOutsideComponent := @helper_hfixedOutsideComponent_991 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@terminalSupport) (@rho1) (@u) (@p) (@indices) (@gamma) (@delta) (@b) (@trace) + (@hvertexOfComponentEdge) + have hmissingFixedOutside := @helper_hmissingFixedOutside_1009 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@terminalSupport) (@rho1) (@u) (@p) (@indices) (@b) (@trace) (@hfixedOutsideComponent) + have hunaffectedValue := @helper_hunaffectedValue_1026 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@rho1) + (@u) (@p) (@indices) (@gamma) (@delta) (@b) (@trace) (@htraceColorsNe) + have hmissingFixedInternal := @helper_hmissingFixedInternal_357 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b + trace htraceColorsNe hcomponentEdgeOfVertex hunaffectedValue + have hswapMakesGammaMissing := @helper_hswapMakesGammaMissing_415 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport jSlot rho1 u p indices gamma delta + b trace htraceColorsNe hstepData hcomponentEdgeOfVertex + have hpresentOfNonSubsingleton := @helper_hpresentOfNonSubsingleton_453 V E inferInstance + inferInstance inferInstance G k e0 input T generating ett terminalSupport rho1 u p indices + gamma delta b trace htraceColorsNe htraceProper + have htraceStored (a : Fin trace.steps) : + ett.series.data.stored (trace.slot a).succ = + {trace.gamma a, trace.delta a} := by + rw [trace.slotIdentity, hstored, htraceGamma, htraceDelta] + have hslotProcessed (a : Fin trace.steps) : + trace.slot a ∈ ExtensionBaseCaseOneIndices ett p indices b := by + rw [← trace.enumerates] + exact Finset.mem_image.mpr ⟨a, Finset.mem_univ _, rfl⟩ + have hvertexInitialSegment := @helper_hvertexInitialSegment_1077 (@V) (@E) (@G) (@e0) + have hbeforeMemberAndNe := @helper_hbeforeMemberAndNe_1086 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) + (@hterminalSupport) (@jSlot) (@rho1) (@u) (@terminalPosition) (@p) (@indices) (@b) (@trace) + exact @helper_continuation_1854 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) + (@hterminalSupport) (@jSlot) (@rho1) (@C) (@u) (@TjPrime) (@seed) (@terminalPosition) + (@hterminalAt) (@hterminalPositionPositive) (@hseed) (@huPrime) (@p) (@indices) (@gamma) + (@delta) (@b) (@trace) (@hbaseStable) (@hclosure) (@hprefixAvoids) (@hselected) (@hsteps) + (@hpositionReverse) (@htraceGamma) (@hstepData) (@hvertexOfComponentEdge) + (@hfixedOutsideComponent) (@hmissingFixedOutside) (@hunaffectedValue) + (@hmissingFixedInternal) (@hswapMakesGammaMissing) (@hpresentOfNonSubsingleton) + (@htraceStored) (@hslotProcessed) (@hvertexInitialSegment) (@hbeforeMemberAndNe) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim45.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim45.lean new file mode 100644 index 0000000000..2d55853512 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim45.lean @@ -0,0 +1,1873 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmC + +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim46 + +/-! +# Extension Base Claim45 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hmissingFixedInternal_549.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) + (supportLength : ℕ) (_ _ : Fin (supportLength + (1 : ℕ)) → Fin k) (u : V) (beta : Fin k), + ∀ (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u), (∀ (a : + Fin trace.steps), trace.gamma a ≠ trace.delta a) → (∀ (a : Fin trace.steps) {v : V} {f : + E}, Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring a.castSucc f = some + (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u)) → (∀ (a : Fin trace.steps) (f : E) (c : Fin k), c ≠ trace.gamma a → c ≠ trace.delta a + → (trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c)) → ∀ (a : Fin + trace.steps) (v : V), Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → trace.gamma a ∈ PresentColors G + (trace.coloring a.castSucc) v → trace.delta a ∈ PresentColors G (trace.coloring + a.castSucc) v → MissingColors G (trace.coloring a.succ) v = MissingColors G + (trace.coloring a.castSucc) v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN supportLength gamma delta u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro trace htraceColorsNe hcomponentEdgeOfVertex hunaffectedValue a v hvComponent + hgammaPresent hdeltaPresent + have hgammaNew : trace.gamma a ∈ + PresentColors G (trace.coloring a.succ) v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hdeltaPresent ⊢ + obtain ⟨f, hvf, hfdelta⟩ := hdeltaPresent + have hfComponent := hcomponentEdgeOfVertex a hvComponent hvf + (Or.inr hfdelta) + refine ⟨f, hvf, ?_⟩ + rw [trace.transition] + simp [TwoColorComponentSwap, hfComponent, hfdelta, + (htraceColorsNe a).symm] + have hdeltaNew : trace.delta a ∈ + PresentColors G (trace.coloring a.succ) v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hgammaPresent ⊢ + obtain ⟨f, hvf, hfgamma⟩ := hgammaPresent + have hfComponent := hcomponentEdgeOfVertex a hvComponent hvf + (Or.inl hfgamma) + refine ⟨f, hvf, ?_⟩ + rw [trace.transition] + simp [TwoColorComponentSwap, hfComponent, hfgamma] + apply Finset.ext + intro c + by_cases hcg : c = trace.gamma a + · subst c + have hold : trace.gamma a ∉ + MissingColors G (trace.coloring a.castSucc) v := by + simpa [MissingColors] using hgammaPresent + have hnew : trace.gamma a ∉ + MissingColors G (trace.coloring a.succ) v := by + simpa [MissingColors] using hgammaNew + simp [hold, hnew] + · by_cases hcd : c = trace.delta a + · subst c + have hold : trace.delta a ∉ + MissingColors G (trace.coloring a.castSucc) v := by + simpa [MissingColors] using hdeltaPresent + have hnew : trace.delta a ∉ + MissingColors G (trace.coloring a.succ) v := by + simpa [MissingColors] using hdeltaNew + simp [hold, hnew] + · simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, + true_and, PresentColors, Finset.mem_filter] + constructor + · intro hc hold + rcases hold with ⟨f, hvf, hfc⟩ + exact hc ⟨f, hvf, (hunaffectedValue a f c hcg hcd).mpr hfc⟩ + · intro hc hnew + rcases hnew with ⟨f, hvf, hfc⟩ + exact hc ⟨f, hvf, (hunaffectedValue a f c hcg hcd).mp hfc⟩ + +private theorem helper_hmissingPreserved_685.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : + PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSlot jSlot : Fin + ett.rounds) (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (Tj TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) + (gammaN deltaN : Fin k) (supportLength : ℕ) (_ _ : Fin (supportLength + (1 : ℕ)) → Fin k), + ett.series.data.tree jSlot.succ.castSucc = Tj → ∀ (u : V) (beta : Fin k), ∀ (trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u), (∀ (a : + Fin trace.steps), TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ MissingColors G + (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ (∀ w ∈ TreeSequenceVertexSet + (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ TwoColorComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → w = + terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → (∀ (b : Fin trace.steps), (↑b : ℕ) ≤ (↑a : ℕ) → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ + TreeSequenceVertexSet B) → (∀ (a : Fin trace.steps) {v : V}, Sum.inl v ∉ TwoColorComponent + G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → MissingColors + G (trace.coloring a.succ) v = MissingColors G (trace.coloring a.castSucc) v) → (∀ (a : Fin + trace.steps) (v : V), Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → trace.gamma a ∈ PresentColors G + (trace.coloring a.castSucc) v → trace.delta a ∈ PresentColors G (trace.coloring + a.castSucc) v → MissingColors G (trace.coloring a.succ) v = MissingColors G + (trace.coloring a.castSucc) v) → terminalSupport ∈ TreeSequenceVertexSet TjPrime → + terminalSupport ≠ u → (∀ (a : Fin trace.steps) {v : V}, v ∈ TreeSequenceVertexSet TjPrime + → v ≠ u → trace.gamma a ∉ MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap + TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : + PartialEdgeColoring E k) v ∧ trace.delta a ∉ MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta + (Sum.inl u) : PartialEdgeColoring E k) v) → ∀ (n : Fin (trace.steps + (1 : ℕ))), ∀ v ∈ + TreeSequenceVertexSet Tj ∪ (TreeSequenceVertexSet TjPrime).erase u, MissingColors G + (trace.coloring n) v = MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap + TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : + PartialEdgeColoring E k) v := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSlot jSlot terminalSupport + hterminalSupport Tj TjPrime rho1 gammaN deltaN supportLength gamma delta hTjStored u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro trace hstepData hvertexInitialSegment hmissingFixedOutside hmissingFixedInternal + hterminalPrime hterminalNeU hprefixColorsNotMissing n + induction n using Fin.induction with + | zero => + intro v hv + rw [trace.initialColoring] + | succ a ih => + intro v hv + rcases Finset.mem_union.mp hv with hvTj | hvPrime + · by_cases hvTerminal : v = terminalSupport + · subst v + have hprimeErased : terminalSupport ∈ + (TreeSequenceVertexSet TjPrime).erase u := + Finset.mem_erase.mpr ⟨hterminalNeU, hterminalPrime⟩ + have hcurrent := ih terminalSupport + (Finset.mem_union_right _ hprimeErased) + obtain ⟨hgMu, hdMu⟩ := + hprefixColorsNotMissing a hterminalPrime hterminalNeU + have hgCurrent : trace.gamma a ∉ + MissingColors G (trace.coloring a.castSucc) terminalSupport := by + rw [hcurrent] + exact hgMu + have hdCurrent : trace.delta a ∉ + MissingColors G (trace.coloring a.castSucc) terminalSupport := by + rw [hcurrent] + exact hdMu + by_cases hvComponent : Sum.inl terminalSupport ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · have hgPresent : trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) + terminalSupport := by + simpa [MissingColors] using hgCurrent + have hdPresent : trace.delta a ∈ + PresentColors G (trace.coloring a.castSucc) + terminalSupport := by + simpa [MissingColors] using hdCurrent + exact (hmissingFixedInternal a terminalSupport hvComponent + hgPresent hdPresent).trans hcurrent + · exact (hmissingFixedOutside a hvComponent).trans hcurrent + · have hsegment := (hstepData a).1 + rw [hTjStored] at hsegment + have hvSlot := hvertexInitialSegment hsegment hvTj + have hvOutside : Sum.inl v ∉ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) := by + intro hvComponent + exact hvTerminal ((hstepData a).2.2.2.1 v hvSlot hvComponent) + exact (hmissingFixedOutside a hvOutside).trans + (ih v (Finset.mem_union_left _ hvTj)) + · have hvPrimeData := Finset.mem_erase.mp hvPrime + have hcurrent := ih v (Finset.mem_union_right _ hvPrime) + obtain ⟨hgMu, hdMu⟩ := hprefixColorsNotMissing a + hvPrimeData.2 hvPrimeData.1 + have hgCurrent : trace.gamma a ∉ + MissingColors G (trace.coloring a.castSucc) v := by + rw [hcurrent] + exact hgMu + have hdCurrent : trace.delta a ∉ + MissingColors G (trace.coloring a.castSucc) v := by + rw [hcurrent] + exact hdMu + by_cases hvComponent : Sum.inl v ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · have hgPresent : trace.gamma a ∈ + PresentColors G (trace.coloring a.castSucc) v := by + simpa [MissingColors] using hgCurrent + have hdPresent : trace.delta a ∈ + PresentColors G (trace.coloring a.castSucc) v := by + simpa [MissingColors] using hdCurrent + exact (hmissingFixedInternal a v hvComponent hgPresent + hdPresent).trans hcurrent + · exact (hmissingFixedOutside a hvComponent).trans hcurrent + +private theorem helper_hstageEdgeFixedStep_762.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot _ jSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) (Tj _ + TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (_ gammaN deltaN : Fin k) (x + : V) (supportLength : ℕ) (_ : Fin (supportLength + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin + (supportLength + (1 : ℕ)) → Fin k), ett.series.data.tree jSlot.succ.castSucc = Tj → ∀ (u : + V) (_ : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (beta + : Fin k) (_ : Fin (Tj.length + (1 : ℕ))), ∀ (trace : ExtensionBaseAlgorithmCTrace ett + terminalSupport hterminalSupport terminalSlot (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta + (Sum.inl u) : PartialEdgeColoring E k) u), (∀ (a : Fin trace.steps), + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ MissingColors G + (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ (∀ w ∈ TreeSequenceVertexSet + (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ TwoColorComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → w = + terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → (∀ (b : Fin trace.steps), (↑b : ℕ) ≤ (↑a : ℕ) → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ + TreeSequenceVertexSet B) → (∀ (a : Fin trace.steps) {v : V} {f : E}, Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → Incident G v f → trace.coloring a.castSucc f = some (trace.gamma a) ∨ trace.coloring + a.castSucc f = some (trace.delta a) → Sum.inl v ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u)) → ∀ (a : Fin trace.steps) (q : + Fin Tj.length), trace.coloring a.succ (Tj.edge q) = trace.coloring a.castSucc (Tj.edge q) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot preterminalSlot jSlot + terminalSupport hterminalSupport Tj seed TjPrime rho1 gammaFirst gammaN deltaN x + supportLength indices gamma delta hTjStored u exitPath beta zPosition + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro trace hstepData hvertexInitialSegment hvertexOfComponentEdge a q + obtain ⟨i, hi⟩ := Tj.attaches q + let r : Fin (Tj.length + 1) := Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ q.isLt)) + have hnewIncident : Incident G (Tj.vertex q.succ) (Tj.edge q) := by + unfold Incident + rw [hi] + simp + have holdIncident : Incident G (Tj.vertex r) (Tj.edge q) := by + unfold Incident + rw [hi] + simp [r] + have hverticesNe : Tj.vertex q.succ ≠ Tj.vertex r := by + intro heq + have hindexEq := Tj.vertex_injective heq + have hvalEq := congrArg Fin.val hindexEq + simp [r] at hvalEq + omega + have hnewTj : Tj.vertex q.succ ∈ TreeSequenceVertexSet Tj := by + simp [TreeSequenceVertexSet] + have holdTj : Tj.vertex r ∈ TreeSequenceVertexSet Tj := by + simp [TreeSequenceVertexSet] + have hsegment := (hstepData a).1 + rw [hTjStored] at hsegment + have hnewSlot := hvertexInitialSegment hsegment hnewTj + have holdSlot := hvertexInitialSegment hsegment holdTj + rw [trace.transition] + by_cases hfComponent : Sum.inr (Tj.edge q) ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · by_cases hfg : trace.coloring a.castSucc (Tj.edge q) = + some (trace.gamma a) + · have hnewComponent := hvertexOfComponentEdge a hfComponent + hnewIncident (Or.inl hfg) + have holdComponent := hvertexOfComponentEdge a hfComponent + holdIncident (Or.inl hfg) + have hnewTerminal := (hstepData a).2.2.2.1 _ hnewSlot hnewComponent + have holdTerminal := (hstepData a).2.2.2.1 _ holdSlot holdComponent + exact False.elim (hverticesNe (hnewTerminal.trans holdTerminal.symm)) + · by_cases hfd : trace.coloring a.castSucc (Tj.edge q) = + some (trace.delta a) + · have hnewComponent := hvertexOfComponentEdge a hfComponent + hnewIncident (Or.inr hfd) + have holdComponent := hvertexOfComponentEdge a hfComponent + holdIncident (Or.inr hfd) + have hnewTerminal := (hstepData a).2.2.2.1 _ hnewSlot hnewComponent + have holdTerminal := (hstepData a).2.2.2.1 _ holdSlot holdComponent + exact False.elim + (hverticesNe (hnewTerminal.trans holdTerminal.symm)) + · simp [TwoColorComponentSwap, hfComponent, hfg, hfd] + · simp [TwoColorComponentSwap, hfComponent] + +private theorem helper_hprimeEdgesPreserved_837.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) (Tj + seed TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (supportColors : Finset + (Fin k)) (gammaN deltaN : Fin k) (supportLength : ℕ) (_ _ : Fin (supportLength + (1 : ℕ)) + → Fin k) (u : V) (beta : Fin k), (∀ (a : Fin TjPrime.length), seed.length ≤ (↑a : ℕ) → ∀ c + ∈ supportColors \ {deltaN}, (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + (TjPrime.edge a) ≠ some c) → ∀ (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport + hterminalSupport terminalSlot (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + u), (∀ (a : Fin trace.steps), trace.gamma a ∈ supportColors ∧ trace.delta a ∈ + supportColors) → (∀ (a : Fin trace.steps), deltaN ≠ trace.gamma a ∧ deltaN ≠ trace.delta + a) → (∀ (n : Fin (trace.steps + (1 : ℕ))) (q : Fin Tj.length), trace.coloring n (Tj.edge + q) = (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) (Tj.edge q)) → + (∀ (q : Fin TjPrime.length), (↑q : ℕ) < seed.length → ∃ (r : Fin Tj.length), TjPrime.edge + q = Tj.edge r) → ∀ (n : Fin (trace.steps + (1 : ℕ))) (q : Fin TjPrime.length), + trace.coloring n (TjPrime.edge q) = (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime + rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring + E k) (TjPrime.edge q) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport Tj + seed TjPrime rho1 supportColors gammaN deltaN supportLength gamma delta u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro hmuAppendedEdges trace htraceSupportColors htraceDeltaNNe hstageEdgesPreserved + hseedEdgeCommon n + induction n using Fin.induction with + | zero => + intro q + rw [trace.initialColoring] + | succ a ih => + intro q + by_cases hqSeed : q.val < seed.length + · obtain ⟨r, hr⟩ := hseedEdgeCommon q hqSeed + rw [hr] + exact hstageEdgesPreserved a.succ r + · have hqAfter : seed.length ≤ q.val := Nat.le_of_not_gt hqSeed + have hfg : trace.coloring a.castSucc (TjPrime.edge q) ≠ + some (trace.gamma a) := by + rw [ih q] + apply hmuAppendedEdges q hqAfter (trace.gamma a) + exact Finset.mem_sdiff.mpr + ⟨(htraceSupportColors a).1, + by simpa using (htraceDeltaNNe a).1.symm⟩ + have hfd : trace.coloring a.castSucc (TjPrime.edge q) ≠ + some (trace.delta a) := by + rw [ih q] + apply hmuAppendedEdges q hqAfter (trace.delta a) + exact Finset.mem_sdiff.mpr + ⟨(htraceSupportColors a).2, + by simpa using (htraceDeltaNNe a).2.symm⟩ + have hfgMu : mu0 (TjPrime.edge q) ≠ some (trace.gamma a) := by + intro h + exact hfg ((ih q).trans h) + have hfdMu : mu0 (TjPrime.edge q) ≠ some (trace.delta a) := by + intro h + exact hfd ((ih q).trans h) + rw [trace.transition] + by_cases hfComponent : Sum.inr (TjPrime.edge q) ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · simp [TwoColorComponentSwap, hfComponent, hfgMu, hfdMu, ih q] + · simp [TwoColorComponentSwap, hfComponent, ih q] + +private theorem helper_hswapMakesGammaMissing_658.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot jSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) + (supportLength : ℕ) (_ _ : Fin (supportLength + (1 : ℕ)) → Fin k) (u : V) (beta : Fin k), + ∀ (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u), (∀ (a : + Fin trace.steps), TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ MissingColors G + (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ (∀ w ∈ TreeSequenceVertexSet + (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ TwoColorComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → w = + terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → (∀ (b : Fin trace.steps), (↑b : ℕ) ≤ (↑a : ℕ) → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → (∀ (a : Fin trace.steps), + trace.gamma a ≠ trace.delta a) → (∀ (a : Fin trace.steps) {v : V} {f : E}, Sum.inl v ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → Incident G v f → trace.coloring a.castSucc f = some (trace.gamma a) ∨ trace.coloring + a.castSucc f = some (trace.delta a) → Sum.inr f ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u)) → ∀ (a : Fin trace.steps), + trace.gamma a ∈ MissingColors G (trace.coloring a.succ) u := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot jSlot terminalSupport + hterminalSupport TjPrime rho1 gammaN deltaN supportLength gamma delta u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro trace hstepData htraceColorsNe hcomponentEdgeOfVertex a + have hdeltaMissingStep := (hstepData a).2.1 + have huComponent : Sum.inl u ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) := rfl + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro hgammaNew + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hgammaNew + obtain ⟨f, huf, hfnew⟩ := hgammaNew + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · have hfold : trace.coloring a.castSucc f = + some (trace.delta a) := by + by_cases hfg : trace.coloring a.castSucc f = some (trace.gamma a) + · rw [trace.transition] at hfnew + have : trace.delta a = trace.gamma a := by + simpa [TwoColorComponentSwap, hfComponent, hfg] using hfnew + exact False.elim ((htraceColorsNe a) this.symm) + · by_cases hfd : trace.coloring a.castSucc f = + some (trace.delta a) + · exact hfd + · rw [trace.transition] at hfnew + have : trace.coloring a.castSucc f = + some (trace.gamma a) := by + simp [TwoColorComponentSwap, hfComponent, hfg, hfd] at hfnew + exact False.elim (hfg this) + have hdeltaNotPresent : trace.delta a ∉ + PresentColors G (trace.coloring a.castSucc) u := by + simpa [MissingColors] using hdeltaMissingStep + exact hdeltaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, huf, hfold⟩) + · have hfold : trace.coloring a.castSucc f = + some (trace.gamma a) := by + rw [trace.transition] at hfnew + simpa [TwoColorComponentSwap, hfComponent] using hfnew + exact hfComponent + (hcomponentEdgeOfVertex a huComponent huf (Or.inl hfold)) + +private theorem helper_branch_945.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot preterminalSlot jSlot : Fin + ett.rounds), (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds → (↑preterminalSlot : ℕ) < + (↑terminalSlot : ℕ) → ∀ (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (Tj Tn _ TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring + E k) (gammaFirst gammaN deltaN : Fin k) (x : V), preterminalSlot ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → ∀ (supportLength : ℕ) (indices : Fin (supportLength + (1 : ℕ)) → Fin + ett.rounds) (gamma delta : Fin (supportLength + (1 : ℕ)) → Fin k), (∀ (a c : Fin + (supportLength + (1 : ℕ))), (↑a : ℕ) < (↑c : ℕ) → (↑(indices a) : ℕ) < (↑(indices c) : ℕ)) + → (∀ (s : Fin ett.rounds), s ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport ↔ ∃ (a : Fin (supportLength + (1 : ℕ))), indices a = s) → + indices (Fin.last supportLength) = terminalSlot → (∀ (a : Fin (supportLength + (1 : ℕ))), + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) → (∀ (a : Fin + (supportLength + (1 : ℕ))), ett.series.data.kind (indices a).succ = some + TashkinovExtensionKind.PE) → (∀ (a : Fin (supportLength + (1 : ℕ))), ett.series.data.gamma + (indices a).succ = some (gamma a)) → (∀ (a : Fin (supportLength + (1 : ℕ))), + ett.series.data.delta (indices a).succ = some (delta a)) → (∀ (a : Fin (supportLength + (1 + : ℕ))), ett.series.data.stored (indices a).succ = {gamma a, delta a}) → (∀ (a : Fin + supportLength), gamma a.succ = delta a.castSucc) → Function.Injective (Fin.cons (gamma (0 + : Fin (supportLength + (1 : ℕ)))) delta) → gamma (0 : Fin (supportLength + (1 : ℕ))) = + gammaFirst → (∀ (u : V) (beta : Fin k), u ∈ TreeSequenceVertexSet TjPrime → u ∉ + TreeSequenceVertexSet Tn → beta ∈ MissingColors G rho1 u → ∀ (a : Fin supportLength), + gamma a.castSucc ∈ PresentColors G (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime + rho1 beta deltaN) gammaN beta (Sum.inl u)) u) → ∀ (u : V) (_ : (TwoColorIncidenceGraph G + rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (beta : Fin k) (_ : Fin (Tj.length + (1 + : ℕ))), gamma (Fin.last supportLength) = gammaN → ∀ (trace : ExtensionBaseAlgorithmCTrace + ett terminalSupport hterminalSupport terminalSlot (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta + (Sum.inl u) : PartialEdgeColoring E k) u), (∀ (a : Fin trace.steps), + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ MissingColors G + (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ (∀ w ∈ TreeSequenceVertexSet + (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ TwoColorComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → w = + terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → (∀ (b : Fin trace.steps), (↑b : ℕ) ≤ (↑a : ℕ) → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → (∀ (q : Fin (supportLength + (1 + : ℕ))), gamma q ≠ delta q) → (∀ (a : Fin trace.steps), ∃ (q : Fin (supportLength + (1 : + ℕ))), indices q = trace.slot a) → (∀ (a : Fin trace.steps) (q : Fin (supportLength + (1 : + ℕ))), indices q = trace.slot a → trace.gamma a = gamma q) → (∀ (a : Fin trace.steps) (q : + Fin (supportLength + (1 : ℕ))), indices q = trace.slot a → trace.delta a = delta q) → (∀ + (a : Fin trace.steps), trace.gamma a ≠ trace.delta a) → (∀ (a : Fin trace.steps) {v : V} + {f : E}, Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring a.castSucc f = some + (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u)) → gammaFirst ∈ MissingColors G (trace.coloring (Fin.last trace.steps) : + PartialEdgeColoring E k) u := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot preterminalSlot jSlot hterminalAtEnd + hpreterminalOrder terminalSupport hterminalSupport Tj Tn seed TjPrime rho1 gammaFirst + gammaN deltaN x hpreterminalClass supportLength indices gamma delta hincreasing hclass + hterminalIndex hsupport hkind hgamma hdelta hstored hchain hdistinct hfirstGamma + hpreterminalGammaPresent u exitPath beta zPosition + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro hgammaLast trace + set rho3 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps) + intro hstepData hgammaDeltaNe htraceIndex htraceGamma htraceDelta htraceColorsNe + hcomponentEdgeOfVertex + have hswapMakesGammaMissing := @helper_hswapMakesGammaMissing_658 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSlot) + (@jSlot) (@terminalSupport) (@hterminalSupport) (@TjPrime) (@rho1) (@gammaN) (@deltaN) + (@supportLength) (@gamma) (@delta) (@u) (@beta) (@trace) (@hstepData) (@htraceColorsNe) + (@hcomponentEdgeOfVertex) + have hsupportLengthPositive : 0 < supportLength := by + obtain ⟨q, hq⟩ := + (hclass preterminalSlot).mp (Finset.mem_erase.mp hpreterminalClass).2 + have hqNeLast : q ≠ Fin.last supportLength := by + intro h + have hslots : preterminalSlot = terminalSlot := by + rw [← hq, h, hterminalIndex] + omega + by_contra hnot + have hzero : supportLength = 0 := Nat.eq_zero_of_not_pos hnot + subst supportLength + apply hqNeLast + apply Fin.ext + omega + have hstepsPositive : 0 < trace.steps := by + by_contra hnot + have hzero : trace.steps = 0 := Nat.eq_zero_of_not_pos hnot + have hmem := hpreterminalClass + rw [← trace.enumerates] at hmem + obtain ⟨a, -, -⟩ := Finset.mem_image.mp hmem + exact Fin.elim0 (Fin.cast hzero a) + let lastStep : Fin trace.steps := ⟨trace.steps - 1, by omega⟩ + have hzeroInErased : (indices 0) ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase terminalSlot := by + apply Finset.mem_erase.mpr + constructor + · intro hzeroTerminal + have hstrict := hincreasing (0 : Fin (supportLength + 1)) + (Fin.last supportLength) (by simpa using hsupportLengthPositive) + rw [hzeroTerminal, hterminalIndex] at hstrict + exact (Nat.lt_irrefl _ hstrict) + · exact (hclass (indices 0)).mpr ⟨0, rfl⟩ + have hindexZeroLe (q : Fin (supportLength + 1)) : + (indices 0).val ≤ (indices q).val := by + by_cases hq : q = 0 + · subst q + exact Nat.le_refl _ + · have hqPositive : (0 : Fin (supportLength + 1)).val < q.val := by + simp only [Fin.val_zero] + exact Nat.pos_of_ne_zero (by + intro hval + apply hq + apply Fin.ext + simpa using hval) + exact Nat.le_of_lt (hincreasing 0 q hqPositive) + have hlastSlot : trace.slot lastStep = indices 0 := by + have hmem : indices 0 ∈ Finset.univ.image trace.slot := by + rw [trace.enumerates] + exact hzeroInErased + obtain ⟨b, -, hb⟩ := Finset.mem_image.mp hmem + have hble : b.val ≤ lastStep.val := by + simp [lastStep] + omega + rcases lt_or_eq_of_le hble with hlt | heq + · have hdesc := trace.strictlyDescending b lastStep hlt + rw [hb] at hdesc + obtain ⟨q, hq⟩ := htraceIndex lastStep + rw [← hq] at hdesc + exact False.elim ((Nat.not_lt_of_ge (hindexZeroLe q)) hdesc) + · have hbeq : b = lastStep := Fin.ext heq + rwa [← hbeq] + have hlastGamma : trace.gamma lastStep = gamma 0 := + htraceGamma lastStep 0 hlastSlot.symm + have hlastIndex : lastStep.succ = + (Fin.last trace.steps : Fin (trace.steps + 1)) := by + apply Fin.ext + simp [lastStep] + omega + change gammaFirst ∈ + MissingColors G (trace.coloring (Fin.last trace.steps)) u + rw [← hfirstGamma, ← hlastGamma, ← hlastIndex] + exact hswapMakesGammaMissing lastStep + +private theorem helper_hterminalNoMissing_940.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (supportColors : Finset + (Fin k)) (gammaN deltaN : Fin k), (supportColors = (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).biUnion fun (s : Fin ett.rounds) ↦ + ett.series.data.stored s.succ) → (∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → deltaN ≠ gammaS ∧ deltaN ≠ deltaS) → ∀ (supportLength : ℕ) (indices : Fin + (supportLength + (1 : ℕ)) → Fin ett.rounds) (gamma delta : Fin (supportLength + (1 : ℕ)) → + Fin k), (∀ (s : Fin ett.rounds), s ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport ↔ ∃ (a : Fin (supportLength + (1 : ℕ))), indices a = s) → + (∀ (a : Fin (supportLength + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some + (gamma a)) → (∀ (a : Fin (supportLength + (1 : ℕ))), ett.series.data.delta (indices + a).succ = some (delta a)) → (∀ (a : Fin (supportLength + (1 : ℕ))), ett.series.data.stored + (indices a).succ = {gamma a, delta a}) → ∀ (u : V) (beta : Fin k), MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + terminalSupport ∩ supportColors = {deltaN} → (MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta + (Sum.inl u) : PartialEdgeColoring E k) terminalSupport ∩ ((ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot).biUnion fun (s : Fin + ett.rounds) ↦ ett.series.data.stored s.succ) = ∅ := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 supportColors gammaN deltaN hsupportSet hdeltaEarlier supportLength indices + gamma delta hclass hgamma hdelta hstored u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 + beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN + beta (Sum.inl u) + intro hmuTerminalMissing + apply Finset.eq_empty_of_forall_notMem + intro c hc + have hcMissing := (Finset.mem_inter.mp hc).1 + have hcUnion := (Finset.mem_inter.mp hc).2 + have hcSupport : c ∈ supportColors := by + rw [hsupportSet] + obtain ⟨s, hs, hcs⟩ := Finset.mem_biUnion.mp hcUnion + exact Finset.mem_biUnion.mpr ⟨s, (Finset.mem_erase.mp hs).2, hcs⟩ + have hcDelta : c = deltaN := by + have hcTerminal : c ∈ + MissingColors G mu0 terminalSupport ∩ supportColors := + Finset.mem_inter.mpr ⟨hcMissing, hcSupport⟩ + rw [hmuTerminalMissing] at hcTerminal + simpa using hcTerminal + obtain ⟨s, hs, hcs⟩ := Finset.mem_biUnion.mp hcUnion + obtain ⟨a, ha⟩ := (hclass s).mp (Finset.mem_erase.mp hs).2 + have hgs : ett.series.data.gamma s.succ = some (gamma a) := by + rw [← ha] + exact hgamma a + have hds : ett.series.data.delta s.succ = some (delta a) := by + rw [← ha] + exact hdelta a + have hne := hdeltaEarlier s (gamma a) (delta a) hs hgs hds + rw [← ha, hstored a] at hcs + simp only [Finset.mem_insert, Finset.mem_singleton] at hcs + rcases hcs with hca | hca + · exact hne.1 (hcDelta.symm.trans hca) + · exact hne.2 (hcDelta.symm.trans hca) + +private theorem helper_hstableOutput_1191.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) (Tj + TjPrime : TreeSequence G e0) (phiJ rho1 : PartialEdgeColoring E k) (Dprev : Finset (Fin + k)) (gammaN deltaN : Fin k) (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet Tj) (u + : V) (beta : Fin k), StableColoringBeforeVertex Tj terminalSupport hterminalTj Dprev phiJ + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) → ∀ (trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u), (∀ (n : + Fin (trace.steps + (1 : ℕ))) (f : E), (∃ w ∈ TreeVerticesBefore Tj terminalSupport + hterminalTj, Incident G w f) → trace.coloring n f = (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta + (Sum.inl u) : PartialEdgeColoring E k) f) → StableColoringBeforeVertex Tj terminalSupport + hterminalTj Dprev phiJ (trace.coloring (Fin.last trace.steps) : PartialEdgeColoring E k) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport Tj + TjPrime phiJ rho1 Dprev gammaN deltaN hterminalTj u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro hmuStable trace + set rho3 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps) + intro hbeforeEdgesPreserved + unfold StableColoringBeforeVertex at hmuStable ⊢ + constructor + · intro f hfIncident hfControlled + exact (hbeforeEdgesPreserved (Fin.last trace.steps) f hfIncident).trans + (hmuStable.1 f hfIncident hfControlled) + · intro w hw + have hmissingFinal : MissingColors G rho3 w = MissingColors G mu0 w := by + apply Finset.ext + intro c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + constructor + · intro hc hold + obtain ⟨f, hwf, hfc⟩ := hold + apply hc + exact ⟨f, hwf, (hbeforeEdgesPreserved (Fin.last trace.steps) f + ⟨w, hw, hwf⟩).trans hfc⟩ + · intro hc hnew + obtain ⟨f, hwf, hfc⟩ := hnew + apply hc + exact ⟨f, hwf, (hbeforeEdgesPreserved (Fin.last trace.steps) f + ⟨w, hw, hwf⟩).symm.trans hfc⟩ + exact hmissingFinal.trans (hmuStable.2 w hw) + +private theorem helper_hdeltaNMissingPreserved_1280.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (u + : V) (beta : Fin k) (z : V), ∀ (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport + hterminalSupport terminalSlot (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + u), (∀ (a : Fin trace.steps), deltaN ≠ trace.gamma a ∧ deltaN ≠ trace.delta a) → (∀ (a : + Fin trace.steps) (f : E) (c : Fin k), c ≠ trace.gamma a → c ≠ trace.delta a → + (trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c)) → deltaN ∈ + MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) z → deltaN ∈ + MissingColors G (trace.coloring (Fin.last trace.steps) : PartialEdgeColoring E k) z := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN u beta z + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro trace + set rho3 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps) + intro htraceDeltaNNe hunaffectedValue hdeltaMu + have hpreserved : ∀ n : Fin (trace.steps + 1), + deltaN ∈ MissingColors G (trace.coloring n) z := by + intro n + induction n using Fin.induction with + | zero => simpa [trace.initialColoring] using hdeltaMu + | succ a ih => + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + obtain ⟨f, hzf, hfcolor⟩ := hpresent + have hold : trace.coloring a.castSucc f = some deltaN := + (hunaffectedValue a f deltaN (htraceDeltaNNe a).1 + (htraceDeltaNNe a).2).mp hfcolor + have hnotPresent : deltaN ∉ + PresentColors G (trace.coloring a.castSucc) z := by + simpa [MissingColors] using ih + exact hnotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hzf, hold⟩) + exact hpreserved (Fin.last trace.steps) + +private theorem helper_branch_1307.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : + PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) (Tj + TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (u : + V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (beta : Fin k) (z : V) (hz : z ∈ + TreeSequenceVertexSet Tj), (∀ v ∈ ((TreeVerticesBefore Tj z hz ∪ {z} ∪ (TreeVerticesBefore + TjPrime u huPrime ∪ {u})).erase u).erase z, MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta + (Sum.inl u) : PartialEdgeColoring E k) v = MissingColors G rho1 v) → ∀ (trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u), (∀ {A : + TreeSequence G e0} {v w : V} (hv : v ∈ TreeSequenceVertexSet A), w ∈ TreeVerticesBefore A + v hv → w ∈ TreeSequenceVertexSet A ∧ w ≠ v) → (∀ (n : Fin (trace.steps + (1 : ℕ))), ∀ v ∈ + TreeSequenceVertexSet Tj ∪ (TreeSequenceVertexSet TjPrime).erase u, MissingColors G + (trace.coloring n) v = MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap + TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : + PartialEdgeColoring E k) v) → ∀ v ∈ ((TreeVerticesBefore Tj z hz ∪ {z} ∪ + (TreeVerticesBefore TjPrime u huPrime ∪ {u})).erase u).erase z, MissingColors G + (trace.coloring (Fin.last trace.steps) : PartialEdgeColoring E k) v = MissingColors G rho1 + v := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + Tj TjPrime rho1 gammaN deltaN u huPrime beta z hz + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro hmuMissing trace + set rho3 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps) + intro hbeforeMemberAndNe hmissingPreserved v hv + have hvOuter := Finset.mem_erase.mp hv + have hvInner := Finset.mem_erase.mp hvOuter.2 + have hvTrace : v ∈ TreeSequenceVertexSet Tj ∪ + (TreeSequenceVertexSet TjPrime).erase u := by + rcases Finset.mem_union.mp hvInner.2 with hvLeft | hvRight + · apply Finset.mem_union_left + rcases Finset.mem_union.mp hvLeft with hvBefore | hvZ + · exact (hbeforeMemberAndNe hz hvBefore).1 + · have hvz : v = z := Finset.mem_singleton.mp hvZ + subst v + exact hz + · apply Finset.mem_union_right + apply Finset.mem_erase.mpr + refine ⟨hvInner.1, ?_⟩ + rcases Finset.mem_union.mp hvRight with hvBefore | hvU + · exact (hbeforeMemberAndNe huPrime hvBefore).1 + · have hvu : v = u := Finset.mem_singleton.mp hvU + subst v + exact huPrime + exact (hmissingPreserved (Fin.last trace.steps) v hvTrace).trans + (hmuMissing v hv) + +private theorem helper_hgammaDeltaNe_1160 : + open scoped Classical in ∀ {k : ℕ} (supportLength : ℕ) (gamma delta : Fin (supportLength + + (1 : ℕ)) → Fin k), (∀ (a : Fin supportLength), gamma a.succ = delta a.castSucc) → + Function.Injective (Fin.cons (gamma (0 : Fin (supportLength + (1 : ℕ)))) delta) → ∀ (q : + Fin (supportLength + (1 : ℕ))), gamma q ≠ delta q := by + classical + intro k supportLength gamma delta hchain hdistinct q + have hconsGamma : + (Fin.cons (gamma 0) delta : Fin (supportLength + 2) → Fin k) + q.castSucc = gamma q := by + refine Fin.cases ?_ (fun r => ?_) q + · simp + · rw [show (Fin.succ r).castSucc = r.castSucc.succ by + apply Fin.ext + rfl] + rw [Fin.cons_succ] + exact (hchain r).symm + have hconsDelta : + (Fin.cons (gamma 0) delta : Fin (supportLength + 2) → Fin k) + q.succ = delta q := by simp + intro heq + have hindexEq : q.castSucc = q.succ := + hdistinct (hconsGamma.trans (heq.trans hconsDelta.symm)) + exact (ne_of_lt Fin.castSucc_lt_succ) hindexEq + +private theorem helper_hvertexOfComponentEdge_1229.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) + (supportLength : ℕ) (_ _ : Fin (supportLength + (1 : ℕ)) → Fin k) (u : V) (beta : Fin k), + ∀ (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u) (a : Fin + trace.steps) {v : V} {f : E}, Sum.inr f ∈ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring a.castSucc f + = some (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → Sum.inl v ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN supportLength gamma delta u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro trace a v f hfComponent hvf hfColor + change (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inr f) = + (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inl u) + at hfComponent + change (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inl v) = + (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inl u) + have hadj : (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).Adj (Sum.inl v) (Sum.inr f) := by + simpa [TwoColorIncidenceGraph] using And.intro hvf hfColor + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans hfComponent + +private theorem helper_hcomponentEdgeOfVertex_1252.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) + (supportLength : ℕ) (_ _ : Fin (supportLength + (1 : ℕ)) → Fin k) (u : V) (beta : Fin k), + ∀ (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u) (a : Fin + trace.steps) {v : V} {f : E}, Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring a.castSucc f + = some (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN supportLength gamma delta u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro trace a v f hvComponent hvf hfColor + change (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inl v) = + (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inl u) + at hvComponent + change (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inr f) = + (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).connectedComponentMk (Sum.inl u) + have hadj : (TwoColorIncidenceGraph G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a)).Adj (Sum.inr f) (Sum.inl v) := by + simpa [TwoColorIncidenceGraph] using And.intro hvf hfColor + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans hvComponent + +private theorem helper_hfixedOutsideComponent_1275.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) + (supportLength : ℕ) (_ _ : Fin (supportLength + (1 : ℕ)) → Fin k) (u : V) (beta : Fin k), + ∀ (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u), (∀ (a : + Fin trace.steps) {v : V} {f : E}, Sum.inr f ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → Incident G v f → trace.coloring + a.castSucc f = some (trace.gamma a) ∨ trace.coloring a.castSucc f = some (trace.delta a) → + Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta + a) (Sum.inl u)) → ∀ (a : Fin trace.steps) {v : V}, Sum.inl v ∉ TwoColorComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ∀ {f : E}, + Incident G v f → trace.coloring a.succ f = trace.coloring a.castSucc f := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN supportLength gamma delta u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro trace hvertexOfComponentEdge a v hvOutside f hvf + rw [trace.transition] + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · by_cases hfg : trace.coloring a.castSucc f = some (trace.gamma a) + · exact False.elim (hvOutside + (hvertexOfComponentEdge a hfComponent hvf (Or.inl hfg))) + · by_cases hfd : trace.coloring a.castSucc f = some (trace.delta a) + · exact False.elim (hvOutside + (hvertexOfComponentEdge a hfComponent hvf (Or.inr hfd))) + · simp [TwoColorComponentSwap, hfComponent, hfg, hfd] + · simp [TwoColorComponentSwap, hfComponent] + +private theorem helper_hmissingFixedOutside_1293.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (u + : V) (beta : Fin k), ∀ (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport + hterminalSupport terminalSlot (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + u), (∀ (a : Fin trace.steps) {v : V}, Sum.inl v ∉ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ∀ {f : E}, Incident G v f → + trace.coloring a.succ f = trace.coloring a.castSucc f) → ∀ (a : Fin trace.steps) {v : V}, + Sum.inl v ∉ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta + a) (Sum.inl u) → MissingColors G (trace.coloring a.succ) v = MissingColors G + (trace.coloring a.castSucc) v := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro trace hfixedOutsideComponent a v hvOutside + apply Finset.ext + intro c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + constructor + · intro hc hold + rcases hold with ⟨f, hvf, hfc⟩ + exact hc ⟨f, hvf, (hfixedOutsideComponent a hvOutside hvf).trans hfc⟩ + · intro hc hnew + rcases hnew with ⟨f, hvf, hfc⟩ + exact hc ⟨f, hvf, + (hfixedOutsideComponent a hvOutside hvf).symm.trans hfc⟩ + +private theorem helper_hbeforeEdgesPreserved_1337.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot jSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) (Tj + TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) + (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet Tj) (supportLength : ℕ) (_ _ : Fin + (supportLength + (1 : ℕ)) → Fin k), ett.series.data.tree jSlot.succ.castSucc = Tj → ∀ (u : + V) (beta : Fin k), ∀ (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport + hterminalSupport terminalSlot (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + u), (∀ (a : Fin trace.steps), TreeSequenceInitialSegment (ett.series.data.tree + jSlot.succ.castSucc) (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ + MissingColors G (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ (∀ w ∈ + TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → w = terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → (∀ (b : Fin trace.steps), (↑b : ℕ) ≤ (↑a : ℕ) → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ + TreeSequenceVertexSet B) → (∀ {A : TreeSequence G e0} {v w : V} (hv : v ∈ + TreeSequenceVertexSet A), w ∈ TreeVerticesBefore A v hv → w ∈ TreeSequenceVertexSet A ∧ w + ≠ v) → (∀ (a : Fin trace.steps) {v : V}, Sum.inl v ∉ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ∀ {f : E}, Incident G v f → + trace.coloring a.succ f = trace.coloring a.castSucc f) → ∀ (n : Fin (trace.steps + (1 : + ℕ))) (f : E), (∃ w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj, Incident G w f) → + trace.coloring n f = (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta + deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) f := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot jSlot terminalSupport + hterminalSupport Tj TjPrime rho1 gammaN deltaN hterminalTj supportLength gamma delta + hTjStored u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro trace hstepData hvertexInitialSegment hbeforeMemberAndNe hfixedOutsideComponent n + induction n using Fin.induction with + | zero => + intro f hf + simpa using congrFun trace.initialColoring f + | succ a ih => + intro f hf + obtain ⟨w, hw, hwf⟩ := hf + have hwData := hbeforeMemberAndNe hterminalTj hw + have hsegment := (hstepData a).1 + rw [hTjStored] at hsegment + have hwSlot := hvertexInitialSegment hsegment hwData.1 + have hwOutside : Sum.inl w ∉ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) := by + intro hwComponent + exact hwData.2 ((hstepData a).2.2.2.1 w hwSlot hwComponent) + exact (hfixedOutsideComponent a hwOutside hwf).trans + (ih f ⟨w, hw, hwf⟩) + +private theorem helper_hprefixColorsNotMissing_1371.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : + PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (supportColors : Finset + (Fin k)) (gammaN deltaN : Fin k) (supportLength : ℕ) (_ _ : Fin (supportLength + (1 : ℕ)) + → Fin k) (u : V) (beta : Fin k), (((TreeSequenceVertexSet TjPrime).erase u).biUnion fun (v + : V) ↦ MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta + deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) v) ∩ + supportColors = {deltaN} → ∀ (trace : ExtensionBaseAlgorithmCTrace ett terminalSupport + hterminalSupport terminalSlot (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + u), (∀ (a : Fin trace.steps), trace.gamma a ∈ supportColors ∧ trace.delta a ∈ + supportColors) → (∀ (a : Fin trace.steps), deltaN ≠ trace.gamma a ∧ deltaN ≠ trace.delta + a) → ∀ (a : Fin trace.steps) {v : V}, v ∈ TreeSequenceVertexSet TjPrime → v ≠ u → + trace.gamma a ∉ MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime + rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring + E k) v ∧ trace.delta a ∉ MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap + TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : + PartialEdgeColoring E k) v := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 supportColors gammaN deltaN supportLength gamma delta u beta + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + intro hmuPrimeMissing trace htraceSupportColors htraceDeltaNNe a v hvPrime hvU + have exclude (c : Fin k) (hcSupport : c ∈ supportColors) + (hcDelta : deltaN ≠ c) : c ∉ MissingColors G mu0 v := by + intro hcMissing + have hcUnion : c ∈ + ((TreeSequenceVertexSet TjPrime).erase u).biUnion + (fun w => MissingColors G mu0 w) := + Finset.mem_biUnion.mpr + ⟨v, Finset.mem_erase.mpr ⟨hvU, hvPrime⟩, hcMissing⟩ + have hcInter := Finset.mem_inter.mpr ⟨hcUnion, hcSupport⟩ + rw [hmuPrimeMissing] at hcInter + have : c = deltaN := by simpa using hcInter + exact hcDelta this.symm + exact ⟨exclude (trace.gamma a) (htraceSupportColors a).1 + (htraceDeltaNNe a).1, + exclude (trace.delta a) (htraceSupportColors a).2 + (htraceDeltaNNe a).2⟩ + +private theorem helper_continuation_1506.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : + PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSlot preterminalSlot + jSlot : Fin ett.rounds), (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds → (↑preterminalSlot : + ℕ) < (↑terminalSlot : ℕ) → ∀ (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (Tj Tn seed TjPrime : TreeSequence G e0) (phiJ rho1 : + PartialEdgeColoring E k) (Dprev supportColors : Finset (Fin k)) (gammaFirst gammaN deltaN + : Fin k) (x : V), TreeSequenceInitialSegment Tj Tn → TreeSequenceInitialSegment seed Tj → + TreeSequenceInitialSegment seed TjPrime → ∀ (hterminalTj : terminalSupport ∈ + TreeSequenceVertexSet Tj), terminalSupport ∈ TreeSequenceVertexSet seed → preterminalSlot + ∈ (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → ∀ (supportLength : ℕ) (indices : Fin (supportLength + (1 : ℕ)) → Fin + ett.rounds) (gamma delta : Fin (supportLength + (1 : ℕ)) → Fin k), (∀ (a c : Fin + (supportLength + (1 : ℕ))), (↑a : ℕ) < (↑c : ℕ) → (↑(indices a) : ℕ) < (↑(indices c) : ℕ)) + → (∀ (s : Fin ett.rounds), s ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport ↔ ∃ (a : Fin (supportLength + (1 : ℕ))), indices a = s) → + indices (Fin.last supportLength) = terminalSlot → (∀ (a : Fin (supportLength + (1 : ℕ))), + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) → (∀ (a : Fin + (supportLength + (1 : ℕ))), ett.series.data.kind (indices a).succ = some + TashkinovExtensionKind.PE) → (∀ (a : Fin (supportLength + (1 : ℕ))), ett.series.data.gamma + (indices a).succ = some (gamma a)) → (∀ (a : Fin (supportLength + (1 : ℕ))), + ett.series.data.delta (indices a).succ = some (delta a)) → (∀ (a : Fin (supportLength + (1 + : ℕ))), ett.series.data.stored (indices a).succ = {gamma a, delta a}) → (∀ (a : Fin + supportLength), gamma a.succ = delta a.castSucc) → Function.Injective (Fin.cons (gamma (0 + : Fin (supportLength + (1 : ℕ)))) delta) → ett.series.data.tree jSlot.succ.castSucc = Tj → + gamma (0 : Fin (supportLength + (1 : ℕ))) = gammaFirst → (∀ (u : V) (beta : Fin k), u ∈ + TreeSequenceVertexSet TjPrime → u ∉ TreeSequenceVertexSet Tn → beta ∈ MissingColors G rho1 + u → ∀ (a : Fin supportLength), gamma a.castSucc ∈ PresentColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN) gammaN beta (Sum.inl u)) u) → ∀ (u : V) + (huPrime : u ∈ TreeSequenceVertexSet TjPrime), u ∉ TreeSequenceVertexSet Tn → ∀ (_ : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (beta : Fin k) + (z : V) (hz : z ∈ TreeSequenceVertexSet Tj) (zPosition : Fin (Tj.length + (1 : ℕ))), + StableColoringBeforeVertex Tj terminalSupport hterminalTj Dprev phiJ + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) → (∀ v ∈ + ((TreeVerticesBefore Tj z hz ∪ {z} ∪ (TreeVerticesBefore TjPrime u huPrime ∪ {u})).erase + u).erase z, MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + v = MissingColors G rho1 v) → (∀ (f : E), ((∃ (a : Fin Tj.length), seed.length ≤ (↑a : ℕ) + ∧ (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ ∃ (a : Fin TjPrime.length) (uPosition : + Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u ∧ (↑a : ℕ) < (↑uPosition : + ℕ) ∧ TjPrime.edge a = f) → (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + f = rho1 f) → (beta ∈ MissingColors G rho1 z → deltaN ∈ MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) z) → (z ∈ + TreeVerticesBefore TjPrime u huPrime → MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta + (Sum.inl u) : PartialEdgeColoring E k) z = MissingColors G rho1 z) → + (((TreeSequenceVertexSet TjPrime).erase u).biUnion fun (v : V) ↦ MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) v) ∩ + supportColors = {deltaN} → (∀ (a : Fin TjPrime.length), seed.length ≤ (↑a : ℕ) → ∀ c ∈ + supportColors \ {deltaN}, (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta + deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + (TjPrime.edge a) ≠ some c) → gamma (Fin.last supportLength) = gammaN → ∀ (trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u), (∀ (a : + Fin trace.steps), TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ MissingColors G + (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ (∀ w ∈ TreeSequenceVertexSet + (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ TwoColorComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → w = + terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → (∀ (b : Fin trace.steps), (↑b : ℕ) ≤ (↑a : ℕ) → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → (∀ (q : Fin (supportLength + (1 + : ℕ))), gamma q ≠ delta q) → (∀ (a : Fin trace.steps), ∃ (q : Fin (supportLength + (1 : + ℕ))), indices q = trace.slot a) → (∀ (a : Fin trace.steps) (q : Fin (supportLength + (1 : + ℕ))), indices q = trace.slot a → trace.gamma a = gamma q) → (∀ (a : Fin trace.steps) (q : + Fin (supportLength + (1 : ℕ))), indices q = trace.slot a → trace.delta a = delta q) → (∀ + (a : Fin trace.steps), trace.gamma a ≠ trace.delta a) → (∀ (a : Fin trace.steps), + trace.gamma a ∈ supportColors ∧ trace.delta a ∈ supportColors) → (∀ (a : Fin trace.steps), + deltaN ≠ trace.gamma a ∧ deltaN ≠ trace.delta a) → (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ + TreeSequenceVertexSet B) → (∀ {A : TreeSequence G e0} {v w : V} (hv : v ∈ + TreeSequenceVertexSet A), w ∈ TreeVerticesBefore A v hv → w ∈ TreeSequenceVertexSet A ∧ w + ≠ v) → (∀ (a : Fin trace.steps) {v : V} {f : E}, Sum.inr f ∈ TwoColorComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → Incident G v f → + trace.coloring a.castSucc f = some (trace.gamma a) ∨ trace.coloring a.castSucc f = some + (trace.delta a) → Sum.inl v ∈ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma + a) (trace.delta a) (Sum.inl u)) → (∀ (a : Fin trace.steps) {v : V} {f : E}, Sum.inl v ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → Incident G v f → trace.coloring a.castSucc f = some (trace.gamma a) ∨ trace.coloring + a.castSucc f = some (trace.delta a) → Sum.inr f ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u)) → (∀ (a : Fin trace.steps) {v : + V}, Sum.inl v ∉ TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a) (Sum.inl u) → ∀ {f : E}, Incident G v f → trace.coloring a.succ f = + trace.coloring a.castSucc f) → (∀ (a : Fin trace.steps) {v : V}, Sum.inl v ∉ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → MissingColors G (trace.coloring a.succ) v = MissingColors G (trace.coloring + a.castSucc) v) → (∀ (a : Fin trace.steps) (f : E) (c : Fin k), c ≠ trace.gamma a → c ≠ + trace.delta a → (trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c)) + → (∀ (a : Fin trace.steps) (v : V), Sum.inl v ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → trace.gamma a ∈ PresentColors G + (trace.coloring a.castSucc) v → trace.delta a ∈ PresentColors G (trace.coloring + a.castSucc) v → MissingColors G (trace.coloring a.succ) v = MissingColors G + (trace.coloring a.castSucc) v) → StableColoringBeforeVertex Tj terminalSupport hterminalTj + Dprev phiJ (trace.coloring (Fin.last trace.steps) : PartialEdgeColoring E k) ∧ (∀ v ∈ + ((TreeVerticesBefore Tj z hz ∪ {z} ∪ (TreeVerticesBefore TjPrime u huPrime ∪ {u})).erase + u).erase z, MissingColors G (trace.coloring (Fin.last trace.steps) : PartialEdgeColoring E + k) v = MissingColors G rho1 v) ∧ (∀ (f : E), ((∃ (a : Fin Tj.length), seed.length ≤ (↑a : + ℕ) ∧ (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ ∃ (a : Fin TjPrime.length) (uPosition + : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u ∧ (↑a : ℕ) < (↑uPosition : + ℕ) ∧ TjPrime.edge a = f) → (trace.coloring (Fin.last trace.steps) : PartialEdgeColoring E + k) f = rho1 f) ∧ (beta ∈ MissingColors G rho1 z → deltaN ∈ MissingColors G (trace.coloring + (Fin.last trace.steps) : PartialEdgeColoring E k) z) ∧ (z ∈ TreeVerticesBefore TjPrime u + huPrime → MissingColors G (trace.coloring (Fin.last trace.steps) : PartialEdgeColoring E + k) z = MissingColors G rho1 z) ∧ gammaFirst ∈ MissingColors G (trace.coloring (Fin.last + trace.steps) : PartialEdgeColoring E k) u := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSlot preterminalSlot jSlot + hterminalAtEnd hpreterminalOrder terminalSupport hterminalSupport Tj Tn seed TjPrime phiJ + rho1 Dprev supportColors gammaFirst gammaN deltaN x hTjN hseedJ hseedPrime hterminalTj + hterminalSeed hpreterminalClass supportLength indices gamma delta hincreasing hclass + hterminalIndex hsupport hkind hgamma hdelta hstored hchain hdistinct hTjStored hfirstGamma + hpreterminalGammaPresent u huPrime huOutside exitPath beta z hz zPosition + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 + beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN + beta (Sum.inl u) + intro hmuStable hmuMissing hmuEdges hmuBeta hmuZ hmuPrimeMissing hmuAppendedEdges hgammaLast trace + set rho3 : PartialEdgeColoring E k := trace.coloring + (Fin.last + trace.steps) + intro hstepData hgammaDeltaNe htraceIndex htraceGamma htraceDelta htraceColorsNe + htraceSupportColors htraceDeltaNNe hvertexInitialSegment hbeforeMemberAndNe + hvertexOfComponentEdge hcomponentEdgeOfVertex hfixedOutsideComponent hmissingFixedOutside + hunaffectedValue hmissingFixedInternal + have hbeforeEdgesPreserved := @helper_hbeforeEdgesPreserved_1337 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSlot jSlot terminalSupport + hterminalSupport Tj TjPrime rho1 gammaN deltaN hterminalTj supportLength gamma delta hTjStored + u beta trace hstepData hvertexInitialSegment hbeforeMemberAndNe hfixedOutsideComponent + have hstableOutput := @helper_hstableOutput_1191 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett terminalSlot terminalSupport hterminalSupport Tj TjPrime phiJ rho1 + Dprev gammaN deltaN hterminalTj u beta hmuStable trace hbeforeEdgesPreserved + refine ⟨hstableOutput, ?_⟩ + have hterminalN : terminalSupport ∈ TreeSequenceVertexSet Tn := + hvertexInitialSegment hTjN hterminalTj + have hterminalPrime : terminalSupport ∈ TreeSequenceVertexSet TjPrime := + hvertexInitialSegment hseedPrime hterminalSeed + have hterminalNeU : terminalSupport ≠ u := by + intro h + apply huOutside + rwa [← h] + have hprefixColorsNotMissing := @helper_hprefixColorsNotMissing_1371 V E inferInstance + inferInstance inferInstance inferInstance G k e0 input T generating ett terminalSlot + terminalSupport hterminalSupport TjPrime rho1 supportColors gammaN deltaN supportLength gamma + delta u beta hmuPrimeMissing trace htraceSupportColors htraceDeltaNNe + have hmissingPreserved := @helper_hmissingPreserved_685 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T generating ett terminalSlot jSlot terminalSupport + hterminalSupport Tj TjPrime rho1 gammaN deltaN supportLength gamma delta hTjStored u beta + trace hstepData hvertexInitialSegment hmissingFixedOutside hmissingFixedInternal + hterminalPrime hterminalNeU hprefixColorsNotMissing + have hstageEdgeFixedStep := @helper_hstageEdgeFixedStep_762 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSlot preterminalSlot jSlot terminalSupport + hterminalSupport Tj seed TjPrime rho1 gammaFirst gammaN deltaN x supportLength indices gamma + delta hTjStored u exitPath beta zPosition trace hstepData hvertexInitialSegment + hvertexOfComponentEdge + have hstageEdgesPreserved : ∀ n : Fin (trace.steps + 1), + ∀ q : Fin Tj.length, trace.coloring n (Tj.edge q) = mu0 (Tj.edge q) := by + intro n + induction n using Fin.induction with + | zero => + intro q + rw [trace.initialColoring] + | succ a ih => + intro q + exact (hstageEdgeFixedStep a q).trans (ih q) + have hseedEdgeCommon (q : Fin TjPrime.length) (hq : q.val < seed.length) : + ∃ r : Fin Tj.length, TjPrime.edge q = Tj.edge r := by + let s : Fin seed.length := ⟨q.val, hq⟩ + obtain ⟨hseedJLength, -, hseedJEdges⟩ := hseedJ + obtain ⟨hseedPrimeLength, -, hseedPrimeEdges⟩ := hseedPrime + let r : Fin Tj.length := Fin.castLE hseedJLength s + have hqCast : Fin.castLE hseedPrimeLength s = q := by + apply Fin.ext + rfl + refine ⟨r, ?_⟩ + rw [← hqCast, hseedPrimeEdges] + exact (hseedJEdges s).symm + have hprimeEdgesPreserved := @helper_hprimeEdgesPreserved_837 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport Tj + seed TjPrime rho1 supportColors gammaN deltaN supportLength gamma delta u beta + hmuAppendedEdges trace htraceSupportColors htraceDeltaNNe hstageEdgesPreserved hseedEdgeCommon + have hdeltaNMissingPreserved := @helper_hdeltaNMissingPreserved_1280 V E inferInstance + inferInstance inferInstance G k e0 input T generating ett terminalSlot terminalSupport + hterminalSupport TjPrime rho1 gammaN deltaN u beta z trace htraceDeltaNNe hunaffectedValue + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · exact @helper_branch_1307 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSlot terminalSupport hterminalSupport Tj TjPrime rho1 gammaN + deltaN u huPrime beta z hz hmuMissing trace hbeforeMemberAndNe hmissingPreserved + · intro f hf + rcases hf with hfTj | hfPrime + · obtain ⟨a, haSeed, haPosition, rfl⟩ := hfTj + exact (hstageEdgesPreserved (Fin.last trace.steps) a).trans + (hmuEdges (Tj.edge a) (Or.inl ⟨a, haSeed, haPosition, rfl⟩)) + · obtain ⟨a, uPosition, huPosition, haPosition, rfl⟩ := hfPrime + exact (hprimeEdgesPreserved (Fin.last trace.steps) a).trans + (hmuEdges (TjPrime.edge a) + (Or.inr ⟨a, uPosition, huPosition, haPosition, rfl⟩)) + · intro hbetaZ + exact hdeltaNMissingPreserved (hmuBeta hbetaZ) + · intro hzBefore + have hzData := hbeforeMemberAndNe huPrime hzBefore + have hzTrace : z ∈ TreeSequenceVertexSet Tj ∪ + (TreeSequenceVertexSet TjPrime).erase u := + Finset.mem_union_right _ (Finset.mem_erase.mpr ⟨hzData.2, hzData.1⟩) + exact (hmissingPreserved (Fin.last trace.steps) z hzTrace).trans + (hmuZ hzBefore) + · exact @helper_branch_945 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSlot preterminalSlot jSlot hterminalAtEnd hpreterminalOrder + terminalSupport hterminalSupport Tj Tn seed TjPrime rho1 gammaFirst gammaN deltaN x + hpreterminalClass supportLength indices gamma delta hincreasing hclass hterminalIndex + hsupport hkind hgamma hdelta hstored hchain hdistinct hfirstGamma hpreterminalGammaPresent + u exitPath beta zPosition hgammaLast trace hstepData hgammaDeltaNe htraceIndex htraceGamma + htraceDelta htraceColorsNe hcomponentEdgeOfVertex + +private theorem helper_continuation_1438.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : + PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSlot preterminalSlot + jSlot : Fin ett.rounds), (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds → (↑preterminalSlot : + ℕ) < (↑terminalSlot : ℕ) → ∀ (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (Tj Tn seed TjPrime : TreeSequence G e0) (phiJ rho1 : + PartialEdgeColoring E k) (Dprev supportColors : Finset (Fin k)) (gammaFirst gammaN deltaN + : Fin k) (x : V), TreeSequenceInitialSegment Tj Tn → TreeSequenceInitialSegment seed Tj → + TreeSequenceInitialSegment seed TjPrime → ∀ (hterminalTj : terminalSupport ∈ + TreeSequenceVertexSet Tj), terminalSupport ∈ TreeSequenceVertexSet seed → preterminalSlot + ∈ (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → (∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → gammaS ∈ supportColors ∧ deltaS ∈ supportColors) → (∀ (s : Fin ett.rounds) + (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot → ett.series.data.gamma s.succ = some + gammaS → ett.series.data.delta s.succ = some deltaS → deltaN ≠ gammaS ∧ deltaN ≠ deltaS) → + ∀ (supportLength : ℕ) (indices : Fin (supportLength + (1 : ℕ)) → Fin ett.rounds) (gamma + delta : Fin (supportLength + (1 : ℕ)) → Fin k), (∀ (a c : Fin (supportLength + (1 : ℕ))), + (↑a : ℕ) < (↑c : ℕ) → (↑(indices a) : ℕ) < (↑(indices c) : ℕ)) → (∀ (s : Fin ett.rounds), + s ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport ↔ ∃ (a + : Fin (supportLength + (1 : ℕ))), indices a = s) → indices (Fin.last supportLength) = + terminalSlot → (∀ (a : Fin (supportLength + (1 : ℕ))), ett.series.data.chosenVertex + (indices a).succ = some terminalSupport) → (∀ (a : Fin (supportLength + (1 : ℕ))), + ett.series.data.kind (indices a).succ = some TashkinovExtensionKind.PE) → (∀ (a : Fin + (supportLength + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) → (∀ + (a : Fin (supportLength + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta + a)) → (∀ (a : Fin (supportLength + (1 : ℕ))), ett.series.data.stored (indices a).succ = + {gamma a, delta a}) → (∀ (a : Fin supportLength), gamma a.succ = delta a.castSucc) → + Function.Injective (Fin.cons (gamma (0 : Fin (supportLength + (1 : ℕ)))) delta) → + ett.series.data.tree jSlot.succ.castSucc = Tj → gamma (0 : Fin (supportLength + (1 : ℕ))) + = gammaFirst → (∀ (u : V) (beta : Fin k), u ∈ TreeSequenceVertexSet TjPrime → u ∉ + TreeSequenceVertexSet Tn → beta ∈ MissingColors G rho1 u → ∀ (a : Fin supportLength), + gamma a.castSucc ∈ PresentColors G (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime + rho1 beta deltaN) gammaN beta (Sum.inl u)) u) → ∀ (u : V) (huPrime : u ∈ + TreeSequenceVertexSet TjPrime), u ∉ TreeSequenceVertexSet Tn → ∀ (_ : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (beta : Fin k) + (z : V) (hz : z ∈ TreeSequenceVertexSet Tj) (zPosition : Fin (Tj.length + (1 : ℕ))), + StableColoringBeforeVertex Tj terminalSupport hterminalTj Dprev phiJ + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) → (∀ v ∈ + ((TreeVerticesBefore Tj z hz ∪ {z} ∪ (TreeVerticesBefore TjPrime u huPrime ∪ {u})).erase + u).erase z, MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + v = MissingColors G rho1 v) → (∀ (f : E), ((∃ (a : Fin Tj.length), seed.length ≤ (↑a : ℕ) + ∧ (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ ∃ (a : Fin TjPrime.length) (uPosition : + Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u ∧ (↑a : ℕ) < (↑uPosition : + ℕ) ∧ TjPrime.edge a = f) → (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + f = rho1 f) → (beta ∈ MissingColors G rho1 z → deltaN ∈ MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) z) → (z ∈ + TreeVerticesBefore TjPrime u huPrime → MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN : PartialEdgeColoring E k) gammaN beta + (Sum.inl u) : PartialEdgeColoring E k) z = MissingColors G rho1 z) → + (((TreeSequenceVertexSet TjPrime).erase u).biUnion fun (v : V) ↦ MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) v) ∩ + supportColors = {deltaN} → (∀ (a : Fin TjPrime.length), seed.length ≤ (↑a : ℕ) → ∀ c ∈ + supportColors \ {deltaN}, (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta + deltaN : PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) + (TjPrime.edge a) ≠ some c) → gamma (Fin.last supportLength) = gammaN → ∀ (trace : + ExtensionBaseAlgorithmCTrace ett terminalSupport hterminalSupport terminalSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u), + ExtensionBaseAlgorithmCInvariant ett terminalSupport hterminalSupport terminalSlot jSlot + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN : + PartialEdgeColoring E k) gammaN beta (Sum.inl u) : PartialEdgeColoring E k) u trace → (∀ + (a : Fin trace.steps), TreeSequenceInitialSegment (ett.series.data.tree + jSlot.succ.castSucc) (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ trace.delta a ∈ + MissingColors G (trace.coloring a.castSucc) u ∧ TwoColorNontrivialPathComponent G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) ∧ (∀ w ∈ + TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc), Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl + u) → w = terminalSupport) ∧ (Sum.inl terminalSupport ∈ TwoColorComponent G (trace.coloring + a.castSucc) (trace.gamma a) (trace.delta a) (Sum.inl u) → ¬((TwoColorIncidenceGraph G + (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a)).neighborSet (Sum.inl + terminalSupport)).Subsingleton) ∧ ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot → (∀ (b : Fin trace.steps), (↑b : ℕ) ≤ (↑a : ℕ) → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some terminalSupport → ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett + s terminalSupport (trace.coloring a.succ) gammaS deltaS) → (∀ (a : Fin trace.steps), + trace.slot a ∈ (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase terminalSlot) → (∀ (q : Fin (supportLength + (1 : ℕ))), gamma q ≠ + delta q) → (∀ (a : Fin trace.steps), ∃ (q : Fin (supportLength + (1 : ℕ))), indices q = + trace.slot a) → (∀ (a : Fin trace.steps) (q : Fin (supportLength + (1 : ℕ))), indices q = + trace.slot a → trace.gamma a = gamma q) → StableColoringBeforeVertex Tj terminalSupport + hterminalTj Dprev phiJ (trace.coloring (Fin.last trace.steps) : PartialEdgeColoring E k) ∧ + (∀ v ∈ ((TreeVerticesBefore Tj z hz ∪ {z} ∪ (TreeVerticesBefore TjPrime u huPrime ∪ + {u})).erase u).erase z, MissingColors G (trace.coloring (Fin.last trace.steps) : + PartialEdgeColoring E k) v = MissingColors G rho1 v) ∧ (∀ (f : E), ((∃ (a : Fin + Tj.length), seed.length ≤ (↑a : ℕ) ∧ (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ ∃ (a : + Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition + = u ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → (trace.coloring (Fin.last + trace.steps) : PartialEdgeColoring E k) f = rho1 f) ∧ (beta ∈ MissingColors G rho1 z → + deltaN ∈ MissingColors G (trace.coloring (Fin.last trace.steps) : PartialEdgeColoring E k) + z) ∧ (z ∈ TreeVerticesBefore TjPrime u huPrime → MissingColors G (trace.coloring (Fin.last + trace.steps) : PartialEdgeColoring E k) z = MissingColors G rho1 z) ∧ gammaFirst ∈ + MissingColors G (trace.coloring (Fin.last trace.steps) : PartialEdgeColoring E k) u := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSlot preterminalSlot jSlot + hterminalAtEnd hpreterminalOrder terminalSupport hterminalSupport Tj Tn seed TjPrime phiJ + rho1 Dprev supportColors gammaFirst gammaN deltaN x hTjN hseedJ hseedPrime hterminalTj + hterminalSeed hpreterminalClass hsupportColors hdeltaEarlier supportLength indices gamma + delta hincreasing hclass hterminalIndex hsupport hkind hgamma hdelta hstored hchain + hdistinct hTjStored hfirstGamma hpreterminalGammaPresent u huPrime huOutside exitPath beta + z hz zPosition + set rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 + beta deltaN + set mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 + gammaN beta (Sum.inl u) + intro hmuStable hmuMissing hmuEdges hmuBeta hmuZ hmuPrimeMissing hmuAppendedEdges hgammaLast + trace hinvariant + set rho3 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps) + intro hstepData hslotMem hgammaDeltaNe htraceIndex htraceGamma + have htraceDelta (a : Fin trace.steps) (q : Fin (supportLength + 1)) + (hq : indices q = trace.slot a) : trace.delta a = delta q := by + apply Option.some.inj + exact (trace.deltaField a).symm.trans (by + rw [← hq] + exact hdelta q) + have htraceColorsNe (a : Fin trace.steps) : + trace.gamma a ≠ trace.delta a := by + obtain ⟨q, hq⟩ := htraceIndex a + rw [htraceGamma a q hq, htraceDelta a q hq] + exact hgammaDeltaNe q + have htraceSupportColors (a : Fin trace.steps) : + trace.gamma a ∈ supportColors ∧ trace.delta a ∈ supportColors := + hsupportColors (trace.slot a) (trace.gamma a) (trace.delta a) + (hslotMem a) (trace.gammaField a) (trace.deltaField a) + have htraceDeltaNNe (a : Fin trace.steps) : + deltaN ≠ trace.gamma a ∧ deltaN ≠ trace.delta a := + hdeltaEarlier (trace.slot a) (trace.gamma a) (trace.delta a) + (hslotMem a) (trace.gammaField a) (trace.deltaField a) + have htraceProper (n : Fin (trace.steps + 1)) : + IsProperEdgeColoring G (trace.coloring n) := (hinvariant.1 n).1 + have hvertexInitialSegment {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + obtain ⟨i, -, hi⟩ := hv + obtain ⟨hlen, hvertices, -⟩ := hAB + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, + (hvertices i).trans hi⟩ + have hbeforeMemberAndNe {A : TreeSequence G e0} {v w : V} + (hv : v ∈ TreeSequenceVertexSet A) + (hw : w ∈ TreeVerticesBefore A v hv) : + w ∈ TreeSequenceVertexSet A ∧ w ≠ v := by + unfold TreeVerticesBefore at hw + obtain ⟨hwA, i, j, hiw, hjv, hij⟩ := Finset.mem_filter.mp hw + refine ⟨hwA, ?_⟩ + intro hwv + have hijEq : i = j := A.vertex_injective + (hiw.trans (hwv.trans hjv.symm)) + omega + have hvertexOfComponentEdge := @helper_hvertexOfComponentEdge_1229 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN supportLength gamma delta u beta trace + have hcomponentEdgeOfVertex := @helper_hcomponentEdgeOfVertex_1252 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN supportLength gamma delta u beta trace + have hfixedOutsideComponent := @helper_hfixedOutsideComponent_1275 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN supportLength gamma delta u beta trace hvertexOfComponentEdge + have hmissingFixedOutside := @helper_hmissingFixedOutside_1293 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN u beta trace hfixedOutsideComponent + have hunaffectedValue (a : Fin trace.steps) (f : E) (c : Fin k) + (hcg : c ≠ trace.gamma a) (hcd : c ≠ trace.delta a) : + trace.coloring a.succ f = some c ↔ + trace.coloring a.castSucc f = some c := by + rw [trace.transition] + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G (trace.coloring a.castSucc) + (trace.gamma a) (trace.delta a) (Sum.inl u) + · by_cases hfg : trace.coloring a.castSucc f = some (trace.gamma a) + · simp [TwoColorComponentSwap, hfComponent, hfg, hcg.symm, hcd.symm] + · by_cases hfd : trace.coloring a.castSucc f = some (trace.delta a) + · simp [TwoColorComponentSwap, hfComponent, hfd, + (htraceColorsNe a).symm, hcg.symm, hcd.symm] + · simp [TwoColorComponentSwap, hfComponent, hfg, hfd] + · simp [TwoColorComponentSwap, hfComponent] + have hmissingFixedInternal := @helper_hmissingFixedInternal_549 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 gammaN deltaN supportLength gamma delta u beta trace htraceColorsNe + hcomponentEdgeOfVertex hunaffectedValue + exact @helper_continuation_1506 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating ett terminalSlot preterminalSlot jSlot hterminalAtEnd + hpreterminalOrder terminalSupport hterminalSupport Tj Tn seed TjPrime phiJ rho1 Dprev + supportColors gammaFirst gammaN deltaN x hTjN hseedJ hseedPrime hterminalTj hterminalSeed + hpreterminalClass supportLength indices gamma delta hincreasing hclass hterminalIndex + hsupport hkind hgamma hdelta hstored hchain hdistinct hTjStored hfirstGamma + hpreterminalGammaPresent u huPrime huOutside exitPath beta z hz zPosition hmuStable + hmuMissing hmuEdges hmuBeta hmuZ hmuPrimeMissing hmuAppendedEdges hgammaLast trace + hstepData hgammaDeltaNe htraceIndex htraceGamma htraceDelta htraceColorsNe + htraceSupportColors htraceDeltaNNe hvertexInitialSegment hbeforeMemberAndNe + hvertexOfComponentEdge hcomponentEdgeOfVertex hfixedOutsideComponent hmissingFixedOutside + hunaffectedValue hmissingFixedInternal +theorem ExtensionBaseClaim45 {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSlot preterminalSlot jSlot : Fin ett.rounds) + (hterminalAtEnd : terminalSlot.val + 1 = ett.rounds) + (hpreterminalOrder : preterminalSlot.val < terminalSlot.val) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (Tj Tn seed TjPrime : TreeSequence G e0) + (phiJ phiN sigmaN rho1 : PartialEdgeColoring E k) + (Dprev controlled restorationColors supportColors : Finset (Fin k)) + (gammaFirst gammaN deltaN : Fin k) (fN : E) (x : V) + (componentPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl terminalSupport) (Sum.inl x)) + (hphiNProper : IsProperEdgeColoring G phiN) + (hphiNOne : IsOneEdgeUncolored phiN e0) + (hsigmaProper : IsProperEdgeColoring G sigmaN) + (hsigmaOne : IsOneEdgeUncolored sigmaN e0) + (hrhoProper : IsProperEdgeColoring G rho1) + (hrhoOne : IsOneEdgeUncolored rho1 e0) + (hTjN : TreeSequenceInitialSegment Tj Tn) + (hseedJ : TreeSequenceInitialSegment seed Tj) + (hseedPrime : TreeSequenceInitialSegment seed TjPrime) + (hseedTerminal : seed.vertex (Fin.last seed.length) = terminalSupport) + (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet Tj) + (hterminalSeed : terminalSupport ∈ TreeSequenceVertexSet seed) + (hclosure : TashkinovClosure rho1 seed TjPrime) + (hprimeElementary : ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime)) + (hcaseTwo : ∀ v : V, + v ∈ (TreeSequenceVertexSet TjPrime).erase terminalSupport → + MissingColors G rho1 v ∩ supportColors = ∅) + (hterminalColors : + MissingColors G rho1 terminalSupport ∩ supportColors = {deltaN}) + (hgammaSupport : gammaN ∈ supportColors) + (hdeltaSupport : deltaN ∈ supportColors) + (hgammaFirstSupport : gammaFirst ∈ supportColors) + (hgammaDelta : gammaN ≠ deltaN) + (hsigmaStable : StableColoring Tn controlled phiN sigmaN) + (hgammaControlled : gammaN ∈ controlled) + (hdeltaControlled : deltaN ∈ controlled) + (hb3 : ∀ f : E, rho1 f ≠ sigmaN f → + f ∉ InternalEdges G (TreeSequenceVertexSet Tj) ∧ + ∃ c d : Fin k, sigmaN f = some c ∧ rho1 f = some d ∧ + c ∈ restorationColors ∧ d ∈ restorationColors) + (hgammaRestored : gammaN ∉ restorationColors) + (hdeltaRestored : deltaN ∉ restorationColors) + (hgammaBoundary : + BoundaryColorEdges G phiN (TreeSequenceVertexSet Tn) gammaN = {fN}) + (hdeltaLocation : ∀ f ∈ BoundaryColorEdges G phiN + (TreeSequenceVertexSet Tn) deltaN, + ∃ w ∈ TreeSequenceVertexSet seed, Incident G w f) + (hdeltaMissing : deltaN ∈ MissingColors G rho1 terminalSupport) + (hpath : componentPath.IsPath) + (hcomponent : {y : Sum V E | y ∈ componentPath.support} = + TwoColorComponent G rho1 gammaN deltaN + (Sum.inl terminalSupport)) + (hxOutside : x ∉ + TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) + (htwoN : ∃ w ∈ TreeSequenceVertexSet Tn, + w ≠ terminalSupport ∧ Sum.inl w ∈ componentPath.support) + (hfNterminal : Incident G terminalSupport fN) + (hb1 : StableColoringBeforeVertex Tj terminalSupport hterminalTj + Dprev phiJ rho1) + (hb2Missing : ∀ v : V, + v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport → + MissingColors G rho1 v = MissingColors G phiJ v) + (hterminalInclusion : MissingColors G phiJ terminalSupport ⊆ + MissingColors G rho1 terminalSupport ∪ {gammaFirst}) + (haugmentation : TashkinovAugmentationSequence phiJ seed Tj) + (hb2Edges : ∀ a : Fin Tj.length, seed.length ≤ a.val → + rho1 (Tj.edge a) = phiJ (Tj.edge a)) + (hdeltaPhiJ : deltaN ∉ TreeMissingColors phiJ Tj) + (hsupportSet : supportColors = + (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).biUnion + (fun s => ett.series.data.stored s.succ)) + (hterminalClass : terminalSlot ∈ ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport) + (hpreterminalClass : preterminalSlot ∈ + (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot) + (hgammaIdentity : ett.series.data.delta preterminalSlot.succ = + some gammaN) + (hterminalGamma : ett.series.data.gamma terminalSlot.succ = some gammaN) + (hterminalDelta : ett.series.data.delta terminalSlot.succ = some deltaN) + (hb4 : ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport rho1 gammaS deltaS) + (hsupportColors : ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + gammaS ∈ supportColors ∧ deltaS ∈ supportColors) + (hdeltaEarlier : ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + deltaN ≠ gammaS ∧ deltaN ≠ deltaS) + (hsupportOrder : ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ∀ v : V, + v ∈ TreeSequenceVertexSet + (ett.series.data.tree s.succ.castSucc) → + v ≠ terminalSupport → + ∀ w : V, Sum.inl w ∈ + TwoColorComponent G rho1 gammaS deltaS (Sum.inl v) → + w ∈ TreeSequenceVertexSet Tn) + (supportLength : ℕ) + (indices : Fin (supportLength + 1) → Fin ett.rounds) + (gamma delta : Fin (supportLength + 1) → Fin k) + (hincreasing : ∀ a c, a.val < c.val → + (indices a).val < (indices c).val) + (hclass : ∀ s : Fin ett.rounds, + s ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport ↔ + ∃ a : Fin (supportLength + 1), indices a = s) + (hterminalIndex : indices (Fin.last supportLength) = terminalSlot) + (hsupport : ∀ a, + ett.series.data.chosenVertex (indices a).succ = some terminalSupport) + (hkind : ∀ a, + ett.series.data.kind (indices a).succ = + some TashkinovExtensionKind.PE) + (hgamma : ∀ a, + ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : ∀ a, + ett.series.data.delta (indices a).succ = some (delta a)) + (hstored : ∀ a, + ett.series.data.stored (indices a).succ = {gamma a, delta a}) + (hchain : ∀ a : Fin supportLength, + gamma a.succ = delta a.castSucc) + (hdistinct : Function.Injective (Fin.cons (gamma 0) delta)) + (hTjStored : ett.series.data.tree jSlot.succ.castSucc = Tj) + (hTjInitial : ∀ s : Fin ett.rounds, + s ∈ (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase terminalSlot → + TreeSequenceInitialSegment Tj + (ett.series.data.tree s.succ.castSucc)) + (hfirstGamma : gamma 0 = gammaFirst) + (hpreterminalGammaPresent : ∀ (u : V) (beta : Fin k), + u ∈ TreeSequenceVertexSet TjPrime → + u ∉ TreeSequenceVertexSet Tn → + beta ∈ MissingColors G rho1 u → + ∀ a : Fin supportLength, + gamma a.castSucc ∈ PresentColors G + (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN) + gammaN beta (Sum.inl u)) u) : + ∃ (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (_ : u ∉ TreeSequenceVertexSet Tn) + (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl x) (Sum.inl u)), + exitPath.IsPath ∧ 2 ≤ exitPath.length ∧ + (∀ y : Sum V E, y ∈ exitPath.support → y ∈ componentPath.support) ∧ + (∀ w : V, + w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → + (Sum.inl w ∈ exitPath.support ↔ w = u)) ∧ + (∃ g ∈ BoundaryColorEdges G rho1 + (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) gammaN, + Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬ Incident G u fN ∧ + ∀ beta : Fin k, beta ∈ MissingColors G rho1 u → + ∃ (z : V) (hz : z ∈ TreeSequenceVertexSet Tj) + (zPosition : Fin (Tj.length + 1)), + Tj.vertex zPosition = z ∧ seed.length ≤ zPosition.val ∧ + ((seed.length < zPosition.val ∧ + beta ∈ MissingColors G rho1 z ∧ + ∀ r : Fin (Tj.length + 1), + seed.length < r.val → r.val < zPosition.val → + beta ∉ MissingColors G rho1 (Tj.vertex r)) ∨ + (zPosition = Fin.last Tj.length ∧ + ∀ r : Fin (Tj.length + 1), seed.length < r.val → + beta ∉ MissingColors G rho1 (Tj.vertex r))) ∧ + (∀ w ∈ TreeVerticesBefore Tj z hz, + beta ∉ MissingColors G rho1 w) ∧ + (∀ a : Fin Tj.length, seed.length ≤ a.val → + a.val < zPosition.val → rho1 (Tj.edge a) ≠ some beta) ∧ + ∃ rho3 : PartialEdgeColoring E k, + IsProperEdgeColoring G rho3 ∧ + IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex Tj terminalSupport hterminalTj + Dprev phiJ rho3 ∧ + (∀ v : V, + v ∈ (((TreeVerticesBefore Tj z hz ∪ {z}) ∪ + (TreeVerticesBefore TjPrime u huPrime ∪ {u})).erase u).erase z → + MissingColors G rho3 v = MissingColors G rho1 v) ∧ + (∀ f : E, + ((∃ a : Fin Tj.length, + seed.length ≤ a.val ∧ a.val < zPosition.val ∧ + Tj.edge a = f) ∨ + (∃ (a : Fin TjPrime.length) + (uPosition : Fin (TjPrime.length + 1)), + TjPrime.vertex uPosition = u ∧ a.val < uPosition.val ∧ + TjPrime.edge a = f)) → + rho3 f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → + deltaN ∈ MissingColors G rho3 z) ∧ + (z ∈ TreeVerticesBefore TjPrime u huPrime → + MissingColors G rho3 z = MissingColors G rho1 z) ∧ + gammaFirst ∈ MissingColors G rho3 u := by + classical + obtain ⟨u, huPrime, huOutside, exitPath, hExitPath, hExitLength, + hExitSupport, hExitIntersection, hExitBoundary, huNotFN, hbeta⟩ := + ExtensionBaseClaim46 ett terminalSlot preterminalSlot hterminalAtEnd + hpreterminalOrder terminalSupport hterminalSupport Tj Tn seed TjPrime + phiJ phiN sigmaN rho1 Dprev controlled restorationColors supportColors + gammaFirst gammaN deltaN fN x componentPath hphiNProper hphiNOne + hsigmaProper hsigmaOne hrhoProper hrhoOne hTjN hseedJ hseedPrime + hseedTerminal hterminalTj hterminalSeed hclosure hprimeElementary + hcaseTwo hterminalColors hgammaSupport hdeltaSupport hgammaFirstSupport + hgammaDelta hsigmaStable hgammaControlled hdeltaControlled hb3 + hgammaRestored hdeltaRestored hgammaBoundary hdeltaLocation + hdeltaMissing hpath hcomponent hxOutside htwoN hfNterminal hb1 + hb2Missing hterminalInclusion haugmentation hb2Edges hdeltaPhiJ + hsupportSet hterminalClass hpreterminalClass hgammaIdentity + hterminalGamma hterminalDelta hb4 hsupportColors hdeltaEarlier + hsupportOrder + refine ⟨u, huPrime, huOutside, exitPath, hExitPath, hExitLength, + hExitSupport, hExitIntersection, hExitBoundary, huNotFN, ?_⟩ + intro beta hbetaMissing + obtain ⟨z, hz, zPosition, hzPosition, hseedPosition, hpositionCases, + hbetaBefore, hbetaEdges, hmu⟩ := hbeta beta hbetaMissing + let rho0 := OutsideTreeColorSwap TjPrime rho1 beta deltaN + let mu0 := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + change IsProperEdgeColoring G mu0 ∧ IsOneEdgeUncolored mu0 e0 ∧ + StableColoringBeforeVertex Tj terminalSupport hterminalTj + Dprev phiJ mu0 ∧ + ((∀ v : V, + v ∈ (((TreeVerticesBefore Tj z hz ∪ {z}) ∪ + (TreeVerticesBefore TjPrime u huPrime ∪ {u})).erase u).erase z → + MissingColors G mu0 v = MissingColors G rho1 v) ∧ + (∀ f : E, + ((∃ a : Fin Tj.length, + seed.length ≤ a.val ∧ a.val < zPosition.val ∧ + Tj.edge a = f) ∨ + (∃ (a : Fin TjPrime.length) + (uPosition : Fin (TjPrime.length + 1)), + TjPrime.vertex uPosition = u ∧ a.val < uPosition.val ∧ + TjPrime.edge a = f)) → + mu0 f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → + deltaN ∈ MissingColors G mu0 z) ∧ + (z ∈ TreeVerticesBefore TjPrime u huPrime → + MissingColors G mu0 z = MissingColors G rho1 z)) ∧ + (ett.series.data.delta preterminalSlot.succ = some gammaN ∧ + gammaN ∈ MissingColors G mu0 u ∧ + beta ∉ MissingColors G mu0 u) ∧ + (∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS) ∧ + (((TreeSequenceVertexSet TjPrime).erase u).biUnion + (fun v => MissingColors G mu0 v) ∩ supportColors = {deltaN} ∧ + MissingColors G mu0 terminalSupport ∩ supportColors = {deltaN} ∧ + ∀ a : Fin TjPrime.length, seed.length ≤ a.val → + ∀ c : Fin k, c ∈ supportColors \ {deltaN} → + mu0 (TjPrime.edge a) ≠ some c) at hmu + rcases hmu with ⟨hmuProper, hmuOne, hmuStable, + ⟨hmuMissing, hmuEdges, hmuBeta, hmuZ⟩, + ⟨-, hgammaNMissing, -⟩, hmuSI, + ⟨hmuPrimeMissing, hmuTerminalMissing, hmuAppendedEdges⟩⟩ + have hgammaLast : gamma (Fin.last supportLength) = gammaN := by + apply Option.some.inj + exact (hgamma (Fin.last supportLength)).symm.trans (by + rw [hterminalIndex] + exact hterminalGamma) + have hterminalNoMissing := @helper_hterminalNoMissing_940 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + TjPrime rho1 supportColors gammaN deltaN hsupportSet hdeltaEarlier supportLength indices gamma + delta hclass hgamma hdelta hstored u beta hmuTerminalMissing + obtain ⟨trace, hinvariant⟩ := ExtensionBaseAlgorithmC ett terminalSupport + hterminalSupport terminalSlot jSlot mu0 u supportLength indices gamma delta + hmuProper hmuOne hterminalAtEnd hincreasing hclass hterminalIndex hsupport + hkind hgamma hdelta hstored hchain hdistinct (by + intro s hs + rw [hTjStored] + exact hTjInitial s hs) + (by simpa [hgammaLast] using hgammaNMissing) + (hpreterminalGammaPresent u beta huPrime huOutside hbetaMissing) + hmuSI hterminalNoMissing + let rho3 := trace.coloring (Fin.last trace.steps) + refine ⟨z, hz, zPosition, hzPosition, hseedPosition, hpositionCases, + hbetaBefore, hbetaEdges, rho3, (hinvariant.1 _).1, (hinvariant.1 _).2, ?_⟩ + have hstepData (a : Fin trace.steps) := hinvariant.2.1 a + have hslotMem (a : Fin trace.steps) : + trace.slot a ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot := by + rw [← trace.enumerates] + exact Finset.mem_image.mpr ⟨a, Finset.mem_univ _, rfl⟩ + have hgammaDeltaNe := @helper_hgammaDeltaNe_1160 k supportLength gamma delta hchain hdistinct + have htraceIndex (a : Fin trace.steps) : + ∃ q : Fin (supportLength + 1), indices q = trace.slot a := by + exact (hclass (trace.slot a)).mp (Finset.mem_erase.mp (hslotMem a)).2 + have htraceGamma (a : Fin trace.steps) (q : Fin (supportLength + 1)) + (hq : indices q = trace.slot a) : trace.gamma a = gamma q := by + apply Option.some.inj + exact (trace.gammaField a).symm.trans (by + rw [← hq] + exact hgamma q) + exact @helper_continuation_1438 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating ett terminalSlot preterminalSlot jSlot hterminalAtEnd + hpreterminalOrder terminalSupport hterminalSupport Tj Tn seed TjPrime phiJ rho1 Dprev + supportColors gammaFirst gammaN deltaN x hTjN hseedJ hseedPrime hterminalTj hterminalSeed + hpreterminalClass hsupportColors hdeltaEarlier supportLength indices gamma delta + hincreasing hclass hterminalIndex hsupport hkind hgamma hdelta hstored hchain hdistinct + hTjStored hfirstGamma hpreterminalGammaPresent u huPrime huOutside exitPath beta z hz + zPosition hmuStable hmuMissing hmuEdges hmuBeta hmuZ hmuPrimeMissing hmuAppendedEdges + hgammaLast trace hinvariant hstepData hslotMem hgammaDeltaNe htraceIndex htraceGamma +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean new file mode 100644 index 0000000000..cf4373a505 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean @@ -0,0 +1,1210 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.BoundaryColorEdges + +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable + +public import LeanPool.GoldbergSeymour.OutsideSwapPrefixEffects +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex + +public import LeanPool.GoldbergSeymour.TashkinovClosure + +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo + +/-! +# Extension Base Claim45Singleton + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hgammaRho3_224.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN + beta : Fin k) (u : V) (_ : beta ≠ gammaN), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let rho3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + ∀ (_ : gammaN ≠ beta) (_ : beta ∈ MissingColors G rho0 u), gammaN ∈ MissingColors G rho3 u := by + classical + intro V E _ _ G k e0 TjPrime rho1 gammaN deltaN beta u hbetaGamma rho0 rho3 hgammaBeta hbetaRho0 + let _ := Fintype.ofFinite V + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro hgPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hgPresent + obtain ⟨f, huf, hfRho3⟩ := hgPresent + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G rho0 gammaN beta (Sum.inl u) + · by_cases hfGamma : rho0 f = some gammaN + · have : (some beta : Option (Fin k)) = some gammaN := by + simp [rho3, TwoColorComponentSwap, hfComponent, hfGamma, hbetaGamma] at hfRho3 + exact hbetaGamma (Option.some.inj this) + · by_cases hfBeta : rho0 f = some beta + · have hnotPresent : beta ∉ PresentColors G rho0 u := by + simpa [MissingColors] using hbetaRho0 + exact hnotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, huf, hfBeta⟩) + · have : rho0 f = some gammaN := by + simp [rho3, TwoColorComponentSwap, hfComponent, hfGamma, hfBeta] at hfRho3 + exact hfGamma this + · have hfRho0 : rho0 f = some gammaN := by + simpa [rho3, TwoColorComponentSwap, hfComponent] using hfRho3 + have hadj : (TwoColorIncidenceGraph G rho0 gammaN beta).Adj + (Sum.inl u) (Sum.inr f) := ⟨huf, Or.inl hfRho0⟩ + apply hfComponent + change (TwoColorIncidenceGraph G rho0 gammaN beta).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G rho0 gammaN beta).connectedComponentMk + (Sum.inl u) + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).symm + +private theorem helper_path_edge_data_132.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {k : ℕ} (rho1 : + PartialEdgeColoring E k) (gammaN deltaN : Fin k) (u x : V) (_ : (TwoColorIncidenceGraph G + rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)), + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (_ : q.IsPath) {e : E} (_ : Sum.inr e ∈ + q.support), + ∃ (j : ℕ), (0 : ℕ) < j ∧ j < q.length ∧ q.getVert j = Sum.inr e ∧ + ∃ (v : V) (w : V), q.getVert (j - (1 : ℕ)) = Sum.inl v ∧ q.getVert (j + (1 : ℕ)) = Sum.inl w ∧ + v ≠ w ∧ G.ends e = s(v, w) := by + classical + intro V E G k rho1 gammaN deltaN u x exitPath H1 a b q hq e he + obtain ⟨j, hj, hjle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp he + have hjpos : 0 < j := by + by_contra hn + have hjzero : j = 0 := Nat.eq_zero_of_not_pos hn + have : (Sum.inl a : Sum V E) = Sum.inr e := by + simp [hjzero] at hj + exact Sum.inl_ne_inr this + have hjlt : j < q.length := by + by_contra hn + have hjend : j = q.length := by omega + have : (Sum.inl b : Sum V E) = Sum.inr e := by + simp [hjend] at hj + exact Sum.inl_ne_inr this + have hprev := q.adj_getVert_succ (i := j - 1) (by omega) + rw [show j - 1 + 1 = j by omega, hj] at hprev + have hnext := q.adj_getVert_succ (i := j) hjlt + rw [hj] at hnext + obtain ⟨v, hv⟩ : ∃ v : V, q.getVert (j - 1) = Sum.inl v := by + cases hc : q.getVert (j - 1) with + | inl v => exact ⟨v, rfl⟩ + | inr f => + rw [hc] at hprev + exact False.elim (by simp [H1, TwoColorIncidenceGraph] at hprev) + obtain ⟨w, hw⟩ : ∃ w : V, q.getVert (j + 1) = Sum.inl w := by + cases hc : q.getVert (j + 1) with + | inl w => exact ⟨w, rfl⟩ + | inr f => + rw [hc] at hnext + exact False.elim (by simp [H1, TwoColorIncidenceGraph] at hnext) + have hve : Incident G v e := by + rw [hv] at hprev + change Incident G v e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at hprev + exact hprev.1 + have hwe : Incident G w e := by + rw [hw] at hnext + change Incident G w e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at hnext + exact hnext.1 + have hvw : v ≠ w := by + intro hvw + have hindex := hq.getVert_injOn + (show j - 1 ≤ q.length by omega) + (show j + 1 ≤ q.length by omega) + (by rw [hv, hw, hvw]) + omega + have hends : G.ends e = s(v, w) := + (Sym2.mem_and_mem_iff hvw).mp ⟨hve, hwe⟩ + exact ⟨j, hjpos, hjlt, hj, v, w, hv, hw, hvw, hends⟩ + +private theorem helper_exit_edge_color_230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) (rho1 : + PartialEdgeColoring E k) (gammaN deltaN beta : Fin k) (u x : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (_ : gammaN ≠ + deltaN) (_ : beta ≠ deltaN) (_ : exitPath.IsPath) (_ : ( + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, Sum.inl w ∈ exitPath.support ↔ + w = u)), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (_ : ( + ∀ (f : E) (_ : TreeIncidentEdge TjPrime f), rho0 f = rho1 f)) (_ : gammaN ≠ beta) (g : E) (_ : + rho1 g = some gammaN), + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + ∀ (_ : ( + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (_ : q.IsPath) {e : E} (_ : Sum.inr e ∈ + q.support) {w : V} (_ : Incident G w e), Sum.inl w ∈ q.support)) (_ : ( + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (_ : q.IsPath) {e : E} (_ : Sum.inr e ∈ + q.support) (_ : Incident G b e), q.getVert (q.length - (1 : ℕ)) = Sum.inr e)) (_ : + exitPath.getVert (exitPath.length - (1 : ℕ)) = Sum.inr g) (e : E) (_ : Sum.inr e ∈ + exitPath.support) (_ : rho1 e = some gammaN ∨ rho1 e = some deltaN), rho0 e = some gammaN + ∨ rho0 e = some beta := by + classical + intro V E _ _ _ G k e0 Tn TjPrime rho1 gammaN deltaN beta u x exitPath hgammaDelta hbetaDelta + hexitPath hexitIntersection rho0 hrho0Fixed hgammaBeta g hgRho1 H1 path_incident_vertex_mem + path_incident_end_last hgLast e he hcolor + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + rcases hcolor with hgamma | hdelta + · left + by_cases heIncident : TreeIncidentEdge TjPrime e + · rw [hrho0Fixed e heIncident] + exact hgamma + · unfold rho0 OutsideTreeColorSwap + rw [ite_eq_right heIncident] + rw [ite_eq_right (by + intro heb + exact hgammaBeta (Option.some.inj (hgamma.symm.trans heb)))] + rw [ite_eq_right (by + intro hed + exact hgammaDelta (Option.some.inj (hgamma.symm.trans hed)))] + exact hgamma + · have hnotIncident : ¬ TreeIncidentEdge TjPrime e := by + intro heIncident + obtain ⟨w, hwPrime, hwe⟩ := heIncident + have hwExit : Sum.inl w ∈ exitPath.support := + path_incident_vertex_mem exitPath hexitPath he hwe + have hwu : w = u := + (hexitIntersection w + (Finset.mem_union.mpr (Or.inr hwPrime))).mp hwExit + subst w + have heLast := path_incident_end_last exitPath hexitPath he hwe + have heg : e = g := Sum.inr.inj (heLast.symm.trans hgLast) + subst e + exact hgammaDelta (Option.some.inj (hgRho1.symm.trans hdelta)) + right + unfold rho0 OutsideTreeColorSwap + rw [ite_eq_right hnotIncident] + rw [ite_eq_right (by + intro heb + exact hbetaDelta (Option.some.inj (heb.symm.trans hdelta)))] + rw [ite_eq_left hdelta] + +private theorem helper_exit_adj_rho0_268.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN + beta : Fin k) (u x : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl x) (Sum.inl u)), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho0 gammaN beta; + ∀ (_ : ( + ∀ (e : E) (_ : Sum.inr e ∈ exitPath.support) (_ : rho1 e = some gammaN ∨ rho1 e = some + deltaN), rho0 e = some gammaN ∨ rho0 e = some beta)), + ∀ i < exitPath.length, H0.Adj (exitPath.getVert i) (exitPath.getVert (i + (1 : ℕ))) := by + classical + intro V E _ _ G k e0 TjPrime rho1 gammaN deltaN beta u x exitPath rho0 H1 H0 exit_edge_color i hi + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + have hadj := exitPath.adj_getVert_succ (i := i) hi + cases hx : exitPath.getVert i with + | inl v => + cases hy : exitPath.getVert (i + 1) with + | inl w => + rw [hx, hy] at hadj + exact False.elim (by simp [TwoColorIncidenceGraph] at hadj) + | inr e => + rw [hx, hy] at hadj + change Incident G v e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at hadj + change Incident G v e ∧ + (rho0 e = some gammaN ∨ rho0 e = some beta) + exact ⟨hadj.1, exit_edge_color e + (by simpa [hy] using exitPath.getVert_mem_support (i + 1)) hadj.2⟩ + | inr e => + cases hy : exitPath.getVert (i + 1) with + | inl v => + rw [hx, hy] at hadj + change Incident G v e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at hadj + change Incident G v e ∧ + (rho0 e = some gammaN ∨ rho0 e = some beta) + exact ⟨hadj.1, exit_edge_color e + (by simpa [hx] using exitPath.getVert_mem_support i) hadj.2⟩ + | inr f => + rw [hx, hy] at hadj + exact False.elim (by simp [TwoColorIncidenceGraph] at hadj) + +private theorem helper_new_x_adj_old_317.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} (seed TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) + (gammaN deltaN beta : Fin k) (u x : V) (_ : TashkinovClosure rho1 seed TjPrime) + (_ : gammaN ≠ deltaN) (_ : beta ≠ deltaN) (_ : beta ∈ MissingColors G rho1 u) + (_ : u ∈ TreeSequenceVertexSet TjPrime), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (_ : (∀ (f : E) (_ : TreeIncidentEdge TjPrime f), rho0 f = rho1 f)) + (_ : x ∉ TreeSequenceVertexSet TjPrime) (e : E) (_ : Incident G x e) + (_ : rho0 e = some gammaN ∨ rho0 e = some beta), + rho1 e = some gammaN ∨ rho1 e = some deltaN := by + classical + intro V E _ _ G k e0 seed TjPrime rho1 gammaN deltaN beta u x hclosure hgammaDelta hbetaDelta + hbeta huPrime rho0 hrho0Fixed hxPrime e hxe hcolor + by_cases heIncident : TreeIncidentEdge TjPrime e + · have hfixed := hrho0Fixed e heIncident + obtain ⟨w, hwPrime, hwe⟩ := heIncident + have hwx : w ≠ x := by + intro hwx + apply hxPrime + simpa [← hwx] using hwPrime + have hends : G.ends e = s(w, x) := + (Sym2.mem_and_mem_iff hwx).mp ⟨hwe, hxe⟩ + have heBoundary : e ∈ BoundaryEdges G + (TreeSequenceVertexSet TjPrime) := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwPrime, x, hxPrime, hends⟩ + rcases hcolor with hgamma | hbetaColor + · exact Or.inl (hfixed.symm.trans hgamma) + · have hbetaOld : rho1 e = some beta := + hfixed.symm.trans hbetaColor + exact False.elim + ((hclosure.2 heBoundary huPrime hbetaOld) hbeta) + · unfold rho0 OutsideTreeColorSwap at hcolor + rw [ite_eq_right heIncident] at hcolor + by_cases hbetaOld : rho1 e = some beta + · rw [ite_eq_left hbetaOld] at hcolor + rcases hcolor with hdeltaGamma | hdeltaBeta + · exact False.elim + (hgammaDelta (Option.some.inj hdeltaGamma).symm) + · exact False.elim + (hbetaDelta (Option.some.inj hdeltaBeta).symm) + · by_cases hdeltaOld : rho1 e = some deltaN + · exact Or.inr hdeltaOld + · rw [ite_eq_right hbetaOld, ite_eq_right hdeltaOld] at hcolor + rcases hcolor with hgammaOld | hbetaOld' + · exact Or.inl hgammaOld + · exact False.elim (hbetaOld hbetaOld') + +private theorem helper_first_p_last_359.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {k : ℕ} (rho1 : + PartialEdgeColoring E k) (gammaN deltaN : Fin k) (terminalSupport u x : V) (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) (Sum.inl x)) + (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (_ + : p.IsPath) (_ : ( + ∀ y ∈ exitPath.support, y ∈ p.support)), + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + ∀ (_ : ( + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (_ : q.IsPath) {e : E} (_ : Sum.inr e ∈ + q.support) (_ : Incident G b e), q.getVert (q.length - (1 : ℕ)) = Sum.inr e)) (_ : H1.Adj + (Sum.inl x) (exitPath.getVert (1 : ℕ))), p.getVert (p.length - (1 : ℕ)) = exitPath.getVert + (1 : ℕ) := by + classical + intro V E G k rho1 gammaN deltaN terminalSupport u x p exitPath hpath hexitSupport H1 + path_incident_end_last first_old_adj + cases hfirst : exitPath.getVert 1 with + | inl v => + rw [hfirst] at first_old_adj + exact False.elim + (by simp [H1, TwoColorIncidenceGraph] at first_old_adj) + | inr e => + have heExit : Sum.inr e ∈ exitPath.support := by + simpa [hfirst] using exitPath.getVert_mem_support 1 + have heP : Sum.inr e ∈ p.support := hexitSupport _ heExit + have hxe : Incident G x e := by + rw [hfirst] at first_old_adj + change Incident G x e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at first_old_adj + exact first_old_adj.1 + exact path_incident_end_last p hpath heP hxe + +private theorem helper_old_x_neighbor_unique_376.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tj : + TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) + (terminalSupport u x z : V) (p : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl terminalSupport) (Sum.inl x)) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN + deltaN).Walk (Sum.inl x) (Sum.inl u)) (_ : p.IsPath) (_ : {y : V ⊕ E | y ∈ p.support} = + TwoColorComponent G rho1 gammaN deltaN (Sum.inl terminalSupport)) (_ : z ∈ + TreeSequenceVertexSet Tj), + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + ∀ (_ : ( + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (_ : q.IsPath) {e : E} (_ : Sum.inr e ∈ + q.support) (_ : Incident G b e), q.getVert (q.length - (1 : ℕ)) = Sum.inr e)) (_ : + p.getVert (p.length - (1 : ℕ)) = exitPath.getVert (1 : ℕ)) (z : V ⊕ E) (_ : H1.Adj + (Sum.inl x) z), z = exitPath.getVert (1 : ℕ) := by + classical + intro V E G k e0 Tj rho1 gammaN deltaN terminalSupport u x z p exitPath hpath hcomponent hz H1 + path_incident_end_last first_p_last z hxz + cases hz : z with + | inl v => + rw [hz] at hxz + exact False.elim (by simp [H1, TwoColorIncidenceGraph] at hxz) + | inr e => + have hxzE : H1.Adj (Sum.inl x) (Sum.inr e) := by + simpa [hz] using hxz + have hxe : Incident G x e := by + change Incident G x e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at hxzE + exact hxzE.1 + have hxComponent : H1.connectedComponentMk (Sum.inl x) = + H1.connectedComponentMk (Sum.inl terminalSupport) := by + change Sum.inl x ∈ + TwoColorComponent G rho1 gammaN deltaN + (Sum.inl terminalSupport) + rw [← hcomponent] + exact p.end_mem_support + have heComponent : H1.connectedComponentMk (Sum.inr e) = + H1.connectedComponentMk (Sum.inl terminalSupport) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hxzE).symm.trans hxComponent + have heP : Sum.inr e ∈ p.support := by + change Sum.inr e ∈ {q : Sum V E | q ∈ p.support} + rw [hcomponent] + exact heComponent + have heLast := path_incident_end_last p hpath heP hxe + exact heLast.symm.trans first_p_last + +private theorem helper_x_neighbor_unique_407.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN + beta : Fin k) (u x z : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl x) (Sum.inl u)) (_ : z ∈ TreeSequenceVertexSet Tj), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho0 gammaN beta; + ∀ (_ : ( + ∀ (e : E) (_ : Incident G x e) (_ : rho0 e = some gammaN ∨ rho0 e = some beta), rho1 e = some + gammaN ∨ rho1 e = some deltaN)) (_ : ( + ∀ (z : V ⊕ E) (_ : H1.Adj (Sum.inl x) z), z = exitPath.getVert (1 : ℕ))) (z : V ⊕ E) (_ : + H0.Adj (Sum.inl x) z), z = exitPath.getVert (1 : ℕ) := by + classical + intro V E _ _ G k e0 Tj TjPrime rho1 gammaN deltaN beta u x z exitPath hz rho0 H1 H0 new_x_adj_old + old_x_neighbor_unique z hxz + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + apply old_x_neighbor_unique z + cases hz : z with + | inl v => + rw [hz] at hxz + exact False.elim (by simp [H0, TwoColorIncidenceGraph] at hxz) + | inr e => + have hxzE : H0.Adj (Sum.inl x) (Sum.inr e) := by + simpa [hz] using hxz + change Incident G x e ∧ + (rho0 e = some gammaN ∨ rho0 e = some beta) at hxzE + change Incident G x e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) + exact ⟨hxzE.1, new_x_adj_old e hxzE.1 hxzE.2⟩ + +private theorem helper_u_neighbor_unique_423.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN + beta : Fin k) (u x z : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl x) (Sum.inl u)) (_ : z ∈ TreeSequenceVertexSet Tj), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (_ : IsProperEdgeColoring G rho0) (_ : beta ∈ MissingColors G rho0 u) (g : E) (_ : Incident + G u g) (_ : rho0 g = some gammaN), + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho0 gammaN beta; + ∀ (_ : exitPath.getVert (exitPath.length - (1 : ℕ)) = Sum.inr g) (z : V ⊕ E) (_ : H0.Adj + (Sum.inl u) z), z = exitPath.getVert (exitPath.length - (1 : ℕ)) := by + classical + intro V E _ _ G k e0 Tj TjPrime rho1 gammaN deltaN beta u x z exitPath hz rho0 hrho0Proper + hbetaRho0 g hug hgRho0 H0 hgLast z huz + let _ := Fintype.ofFinite V + cases hz : z with + | inl v => + rw [hz] at huz + exact False.elim (by simp [H0, TwoColorIncidenceGraph] at huz) + | inr e => + rw [hz] at huz + change Incident G u e ∧ + (rho0 e = some gammaN ∨ rho0 e = some beta) at huz + have heGamma : rho0 e = some gammaN := by + rcases huz.2 with heGamma | heBeta + · exact heGamma + · have hnotPresent : beta ∉ PresentColors G rho0 u := by + simpa [MissingColors] using hbetaRho0 + exact False.elim (hnotPresent (by + simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨e, huz.1, heBeta⟩)) + have heg : e = g := by + by_contra hne + exact (hrho0Proper hne ⟨u, huz.1, hug⟩ heGamma) hgRho0 + exact (congrArg Sum.inr heg).trans hgLast.symm + +private theorem helper_support_closed_448.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN + beta : Fin k) (u x z : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl x) (Sum.inl u)) (_ : exitPath.IsPath) (_ : (2 : ℕ) ≤ exitPath.length) (_ : z ∈ + TreeSequenceVertexSet Tj), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (_ : IsProperEdgeColoring G rho0), + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho0 gammaN beta; + ∀ (_ : ( + ∀ i < exitPath.length, H0.Adj (exitPath.getVert i) (exitPath.getVert (i + (1 : ℕ))))) (_ : ( + ∀ (z : V ⊕ E) (_ : H0.Adj (Sum.inl x) z), z = exitPath.getVert (1 : ℕ))) (_ : ( + ∀ (z : V ⊕ E) (_ : H0.Adj (Sum.inl u) z), z = exitPath.getVert (exitPath.length - (1 : ℕ)))), + ∀ w ∈ exitPath.support, + ∀ (z : V ⊕ E), H0.Adj w z → z ∈ exitPath.support := by + classical + intro V E _ _ G k e0 Tj TjPrime rho1 gammaN deltaN beta u x z exitPath hexitPath hexitLength hz + rho0 hrho0Proper H0 exit_adj_rho0 x_neighbor_unique u_neighbor_unique w hw z hwz + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hw + by_cases hn0 : n = 0 + · subst n + have hwstart : w = Sum.inl x := by simpa using hn.symm + have hz := x_neighbor_unique z (by simpa [hwstart] using hwz) + simp [hz] + by_cases hnend : n = exitPath.length + · have hwend : w = Sum.inl u := by + rw [← hn, hexitPath.getVert_eq_end_iff hnle] + exact hnend + have hz := u_neighbor_unique z (by simpa [hwend] using hwz) + simp [hz] + have hleft : H0.Adj (exitPath.getVert n) + (exitPath.getVert (n - 1)) := by + rw [← show n - 1 + 1 = n by omega] + exact (exit_adj_rho0 (n - 1) (by omega)).symm + have hright : H0.Adj (exitPath.getVert n) + (exitPath.getVert (n + 1)) := + exit_adj_rho0 n (by omega) + by_contra hznot + have hwz' := hwz + rw [← hn] at hwz' + have hneleft : exitPath.getVert (n - 1) ≠ z := by + intro he + apply hznot + rw [← he] + exact exitPath.getVert_mem_support _ + have hneright : exitPath.getVert (n + 1) ≠ z := by + intro he + apply hznot + rw [← he] + exact exitPath.getVert_mem_support _ + have hnelr : exitPath.getVert (n - 1) ≠ + exitPath.getVert (n + 1) := by + intro he + have hindex := hexitPath.getVert_injOn + (show n - 1 ≤ exitPath.length by omega) + (show n + 1 ≤ exitPath.length by omega) he + omega + let : Fintype (H0.neighborSet (exitPath.getVert n)) := + Fintype.ofFinite _ + have hthree : 3 ≤ H0.degree (exitPath.getVert n) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset (Sum V E) := + {z, exitPath.getVert (n - 1), exitPath.getVert (n + 1)} + have hs : s ⊆ H0.neighborFinset (exitPath.getVert n) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hwz' + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hcard : 3 ≤ s.card := by + simp [s, hnelr, hneleft.symm, + hneright.symm] + exact hcard.trans (Finset.card_le_card hs) + have hupper : H0.degree (exitPath.getVert n) ≤ 2 := by + simpa [H0] using TwoColorIncidenceDegreeAtMostTwo + G rho0 gammaN beta hrho0Proper (exitPath.getVert n) + omega + +private theorem helper_branch_316.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn Tj seed TjPrime : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN beta : Fin k) (terminalSupport u x z : V) + (p : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) (Sum.inl + x)) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl + u)) (_ : TashkinovClosure rho1 seed TjPrime) (_ : gammaN ≠ deltaN) (_ : beta ≠ deltaN) (_ + : beta ∈ MissingColors G rho1 u) (_ : p.IsPath) (_ : {y : V ⊕ E | y ∈ p.support} = + TwoColorComponent G rho1 gammaN deltaN (Sum.inl terminalSupport)) (_ : x ∉ + TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) (_ : u ∈ TreeSequenceVertexSet + TjPrime) (_ : exitPath.IsPath) (_ : (2 : ℕ) ≤ exitPath.length) (_ : ( + ∀ y ∈ exitPath.support, y ∈ p.support)) (_ : z ∈ TreeSequenceVertexSet Tj), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (_ : IsProperEdgeColoring G rho0) (_ : ( + ∀ (f : E) (_ : TreeIncidentEdge TjPrime f), rho0 f = rho1 f)) (_ : beta ∈ MissingColors G rho0 + u) (g : E) (_ : Incident G u g) (_ : rho0 g = some gammaN), + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho0 gammaN beta; + ∀ (_ : ( + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (_ : q.IsPath) {e : E} (_ : Sum.inr e ∈ + q.support) (_ : Incident G b e), q.getVert (q.length - (1 : ℕ)) = Sum.inr e)) (_ : + exitPath.getVert (exitPath.length - (1 : ℕ)) = Sum.inr g) (_ : ( + ∀ i < exitPath.length, H0.Adj (exitPath.getVert i) (exitPath.getVert (i + (1 : ℕ))))), + TwoColorComponent G rho0 gammaN beta (Sum.inl u) ⊆ {y : V ⊕ E | y ∈ exitPath.support} := by + classical + intro V E _ _ _ G k e0 Tn Tj seed TjPrime rho1 gammaN deltaN beta terminalSupport u x z p + exitPath hclosure hgammaDelta hbetaDelta hbeta hpath hcomponent hxOutside huPrime hexitPath + hexitLength hexitSupport hz rho0 hrho0Proper hrho0Fixed hbetaRho0 g hug hgRho0 H1 H0 + path_incident_end_last hgLast exit_adj_rho0 y hy + have hxPrime : x ∉ TreeSequenceVertexSet TjPrime := by + intro hx + exact hxOutside (Finset.mem_union.mpr (Or.inr hx)) + have new_x_adj_old : ∀ e : E, Incident G x e → + (rho0 e = some gammaN ∨ rho0 e = some beta) → + rho1 e = some gammaN ∨ rho1 e = some deltaN := by + exact @helper_new_x_adj_old_317 V E inferInstance inferInstance G k e0 seed TjPrime rho1 + gammaN deltaN beta u x hclosure hgammaDelta hbetaDelta hbeta huPrime hrho0Fixed hxPrime + have first_old_adj : H1.Adj (Sum.inl x) (exitPath.getVert 1) := by + simpa [H1] using exitPath.adj_getVert_succ + (show 0 < exitPath.length by omega) + have first_p_last : + p.getVert (p.length - 1) = exitPath.getVert 1 := by + exact @helper_first_p_last_359 V E G k rho1 gammaN deltaN terminalSupport u x p exitPath + hpath hexitSupport path_incident_end_last first_old_adj + have old_x_neighbor_unique : ∀ z : Sum V E, + H1.Adj (Sum.inl x) z → z = exitPath.getVert 1 := by + exact @helper_old_x_neighbor_unique_376 V E G k e0 Tj rho1 gammaN deltaN terminalSupport u x + z p exitPath hpath hcomponent hz path_incident_end_last first_p_last + have x_neighbor_unique : ∀ z : Sum V E, + H0.Adj (Sum.inl x) z → z = exitPath.getVert 1 := by + exact @helper_x_neighbor_unique_407 V E inferInstance inferInstance G k e0 Tj TjPrime rho1 + gammaN deltaN beta u x z exitPath hz new_x_adj_old old_x_neighbor_unique + have u_neighbor_unique : + ∀ z : Sum V E, H0.Adj (Sum.inl u) z → z = exitPath.getVert (exitPath.length - 1) := by + exact @helper_u_neighbor_unique_423 V E inferInstance inferInstance G k e0 Tj + TjPrime rho1 gammaN deltaN beta u x z exitPath hz hrho0Proper hbetaRho0 g hug hgRho0 hgLast + have support_closed : ∀ w : Sum V E, w ∈ exitPath.support → + ∀ z : Sum V E, H0.Adj w z → z ∈ exitPath.support := by + exact @helper_support_closed_448 V E inferInstance inferInstance + G k e0 Tj TjPrime rho1 gammaN deltaN beta u x z exitPath hexitPath hexitLength hz + hrho0Proper exit_adj_rho0 x_neighbor_unique u_neighbor_unique + have reach : H0.Reachable (Sum.inl u) y := by + change H0.connectedComponentMk y = + H0.connectedComponentMk (Sum.inl u) at hy + exact SimpleGraph.ConnectedComponent.eq.mp hy |>.symm + apply reach.mem_subgraphVerts + (H := (⊤ : H0.Subgraph).induce {w | w ∈ exitPath.support}) + (fun w hw z hadj => by + exact ⟨by simpa using hw, + support_closed w (by simpa using hw) z hadj, hadj⟩) + (by simp) + +private theorem helper_hcomponentExit_260.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn Tj seed TjPrime : TreeSequence G e0) + (rho1 : PartialEdgeColoring E k) (_ gammaN deltaN beta : Fin k) (terminalSupport u x z : + V) (p : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) + (Sum.inl u)) (_ : Fin (Tj.length + (1 : ℕ))) (_ : TashkinovClosure rho1 seed TjPrime) (_ : + gammaN ≠ deltaN) (_ : beta ≠ deltaN) (_ : beta ∈ MissingColors G rho1 u) (_ : p.IsPath) (_ + : {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G rho1 gammaN deltaN (Sum.inl + terminalSupport)) (_ : x ∉ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) (_ : + u ∈ TreeSequenceVertexSet TjPrime) (_ : exitPath.IsPath) (_ : (2 : ℕ) ≤ exitPath.length) + (_ : ( + ∀ y ∈ exitPath.support, y ∈ p.support)) (_ : ( + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, Sum.inl w ∈ exitPath.support ↔ + w = u)) (_ : z ∈ TreeSequenceVertexSet Tj), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (_ : IsProperEdgeColoring G rho0) (_ : ( + ∀ (f : E) (_ : TreeIncidentEdge TjPrime f), rho0 f = rho1 f)) (_ : gammaN ≠ beta) (_ : beta ∈ + MissingColors G rho0 u) (g : E) (_ : Incident G u g) (_ : Sum.inr g ∈ exitPath.support) (_ + : rho1 g = some gammaN) (_ : rho0 g = some gammaN), {y : V ⊕ E | y ∈ exitPath.support} = + TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + classical + intro V E _ _ _ G k e0 Tn Tj seed TjPrime rho1 gammaFirst gammaN deltaN beta terminalSupport u + x z p exitPath zPosition hclosure hgammaDelta hbetaDelta hbeta hpath hcomponent hxOutside + huPrime hexitPath hexitLength hexitSupport hexitIntersection hz rho0 hrho0Proper hrho0Fixed + hgammaBeta hbetaRho0 g hug hgExit hgRho1 hgRho0 + let H1 := TwoColorIncidenceGraph G rho1 gammaN deltaN + let H0 := TwoColorIncidenceGraph G rho0 gammaN beta + have path_edge_data : + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (hq : q.IsPath) {e : E}, Sum.inr e ∈ + q.support → + ∃ j : ℕ, 0 < j ∧ j < q.length ∧ q.getVert j = Sum.inr e ∧ + ∃ v w : V, q.getVert (j - 1) = Sum.inl v ∧ q.getVert (j + 1) = Sum.inl w ∧ v ≠ w ∧ G.ends e = + s(v, w) := by + exact @helper_path_edge_data_132 V E G k rho1 gammaN deltaN u x exitPath + have path_incident_vertex_mem : ∀ {a b : V} + (q : H1.Walk (Sum.inl a) (Sum.inl b)) (hq : q.IsPath) + {e : E}, Sum.inr e ∈ q.support → ∀ {w : V}, Incident G w e → + Sum.inl w ∈ q.support := by + intro a b q hq e he w hwe + obtain ⟨j, hjpos, hjlt, hj, v, t, hv, ht, hvt, hends⟩ := + path_edge_data q hq he + have hwends : w ∈ s(v, t) := by + rw [← hends] + exact hwe + simp only [Sym2.mem_iff] at hwends + apply SimpleGraph.Walk.mem_support_iff_exists_getVert.mpr + rcases hwends with hwv | hwt + · exact ⟨j - 1, by simpa [hwv] using hv, by omega⟩ + · exact ⟨j + 1, by simpa [hwt] using ht, by omega⟩ + have path_incident_end_last : + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (hq : q.IsPath) {e : E}, Sum.inr e ∈ + q.support → Incident G b e → q.getVert (q.length - 1) = Sum.inr e := by + intro a b q hq e he hbe + obtain ⟨j, hjpos, hjlt, hj, v, w, hv, hw, hvw, hends⟩ := + path_edge_data q hq he + have hbends : b ∈ s(v, w) := by + rw [← hends] + exact hbe + simp only [Sym2.mem_iff] at hbends + rcases hbends with hbv | hbw + · have hindex := hq.getVert_injOn + (show j - 1 ≤ q.length by omega) + (show q.length ≤ q.length by rfl) + (by rw [hv, q.getVert_length, hbv]) + omega + · have hindex := hq.getVert_injOn + (show j + 1 ≤ q.length by omega) + (show q.length ≤ q.length by rfl) + (by rw [hw, q.getVert_length, hbw]) + have hjlast : j = q.length - 1 := by omega + simpa [hjlast] using hj + have hgLast : exitPath.getVert (exitPath.length - 1) = Sum.inr g := + path_incident_end_last exitPath hexitPath hgExit hug + have exit_edge_color : ∀ e : E, Sum.inr e ∈ exitPath.support → + (rho1 e = some gammaN ∨ rho1 e = some deltaN) → + rho0 e = some gammaN ∨ rho0 e = some beta := by + exact @helper_exit_edge_color_230 V E inferInstance inferInstance inferInstance G k e0 Tn + TjPrime rho1 gammaN deltaN beta u x exitPath hgammaDelta hbetaDelta hexitPath + hexitIntersection hrho0Fixed hgammaBeta g hgRho1 path_incident_vertex_mem + path_incident_end_last hgLast + have exit_adj_rho0 : ∀ i : ℕ, i < exitPath.length → + H0.Adj (exitPath.getVert i) (exitPath.getVert (i + 1)) := by + exact @helper_exit_adj_rho0_268 V E inferInstance inferInstance G k e0 TjPrime rho1 gammaN + deltaN beta u x exitPath exit_edge_color + apply Set.Subset.antisymm + · intro y hy + obtain ⟨i, hi, hile⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hy + have htoStart : ∀ j : ℕ, j ≤ exitPath.length → + H0.connectedComponentMk (exitPath.getVert j) = + H0.connectedComponentMk (exitPath.getVert 0) := by + intro j hj + induction j with + | zero => rfl + | succ j ih => + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (exit_adj_rho0 j (by omega))).symm.trans (ih (by omega)) + change H0.connectedComponentMk y = H0.connectedComponentMk (Sum.inl u) + simpa only [hi, exitPath.getVert_length] using + (htoStart i hile).trans (htoStart exitPath.length le_rfl).symm + · exact @helper_branch_316 V E inferInstance inferInstance inferInstance G k e0 + Tn Tj seed TjPrime rho1 gammaN deltaN beta terminalSupport u x z p exitPath hclosure + hgammaDelta hbetaDelta hbeta hpath hcomponent hxOutside huPrime hexitPath hexitLength + hexitSupport hz hrho0Proper hrho0Fixed hbetaRho0 g hug hgRho0 path_incident_end_last hgLast + exit_adj_rho0 +private theorem helper_htreeEdgeFixed_771.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj _ TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (_ gammaN + deltaN beta : Fin k) (u x : V) (_ : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl x) (Sum.inl u)) (_ : Fin (Tj.length + (1 : ℕ))), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let rho3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + ∀ (_ : ( + ∀ w ∈ TreeSequenceVertexSet TjPrime, w ≠ u → + ∀ (f : E), Incident G w f → rho3 f = rho1 f)) (a : Fin TjPrime.length), rho3 (TjPrime.edge a) + = rho1 (TjPrime.edge a) := by + classical + intro V E _ _ G k e0 Tj seed TjPrime rho1 gammaFirst gammaN deltaN beta u x exitPath zPosition + rho0 rho3 hmuRho1PrimeFixed a + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨i, hi⟩ := TjPrime.attaches a + let earlier : Fin (TjPrime.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ a.isLt)) + have hlaterSet : TjPrime.vertex a.succ ∈ + TreeSequenceVertexSet TjPrime := by + simp [TreeSequenceVertexSet] + have hearlierSet : TjPrime.vertex earlier ∈ + TreeSequenceVertexSet TjPrime := by + simp [TreeSequenceVertexSet] + have hlaterInc : Incident G (TjPrime.vertex a.succ) + (TjPrime.edge a) := by + change TjPrime.vertex a.succ ∈ G.ends (TjPrime.edge a) + rw [hi] + simp + have hearlierInc : Incident G (TjPrime.vertex earlier) + (TjPrime.edge a) := by + change TjPrime.vertex earlier ∈ G.ends (TjPrime.edge a) + rw [hi] + simp [earlier] + have hverticesNe : TjPrime.vertex a.succ ≠ TjPrime.vertex earlier := by + apply TjPrime.vertex_injective.ne + intro heq + have hval := congrArg Fin.val heq + simp [earlier] at hval + omega + by_cases hlu : TjPrime.vertex a.succ = u + · exact hmuRho1PrimeFixed (TjPrime.vertex earlier) hearlierSet + (by intro heu; exact hverticesNe (hlu.trans heu.symm)) + (TjPrime.edge a) hearlierInc + · exact hmuRho1PrimeFixed (TjPrime.vertex a.succ) hlaterSet hlu + (TjPrime.edge a) hlaterInc + +private theorem helper_component_edge_avoids_763.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) (rho1 : + PartialEdgeColoring E k) (gammaN deltaN beta : Fin k) (u : V), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (_ : ( + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, Sum.inl w ∈ TwoColorComponent + G rho0 gammaN beta (Sum.inl u) ↔ w = u)), + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, w ≠ u → + ∀ (f : E), Incident G w f → Sum.inr f ∉ TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + classical + intro V E _ _ _ G k e0 Tn TjPrime rho1 gammaN deltaN beta u rho0 hcomponentIntersection w hw hwu f + hwf hf + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + let H := TwoColorIncidenceGraph G rho0 gammaN beta + have hfSupport : Sum.inr f ∈ H.support := by + apply SimpleGraph.mem_support_of_reachable + (G := H) (u := Sum.inr f) (v := Sum.inl u) + · simp + · exact SimpleGraph.ConnectedComponent.eq.mp hf + obtain ⟨y, hy⟩ := H.mem_support.mp hfSupport + have hfColor : rho0 f = some gammaN ∨ rho0 f = some beta := by + cases y with + | inl y => exact hy.2 + | inr y => simp [H, TwoColorIncidenceGraph] at hy + have hadj : H.Adj (Sum.inl w) (Sum.inr f) := by + simpa [H, TwoColorIncidenceGraph] using And.intro hwf hfColor + have hwComponent : + Sum.inl w ∈ TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + change H.connectedComponentMk (Sum.inl w) = + H.connectedComponentMk (Sum.inl u) + change H.connectedComponentMk (Sum.inr f) = + H.connectedComponentMk (Sum.inl u) at hf + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hf + exact hwu ((hcomponentIntersection w hw).mp hwComponent) + +private theorem helper_before_seed_817.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] {G : + LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tj seed : TreeSequence G e0) (rho1 : + PartialEdgeColoring E k) (_ gammaN deltaN : Fin k) (terminalSupport u x : V) (_ : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin + (Tj.length + (1 : ℕ))), TreeSequenceInitialSegment seed Tj → seed.vertex (Fin.last + seed.length) = terminalSupport → ∀ (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet + Tj), ∀ w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj, w ∈ TreeSequenceVertexSet + seed := by + classical + intro V E _ G k e0 Tj seed rho1 gammaFirst gammaN deltaN terminalSupport u x exitPath zPosition + hseedJ hseedTerminal hterminalTj w hw + let _ := Fintype.ofFinite V + unfold TreeVerticesBefore at hw + obtain ⟨hwJ, i, j, hiw, hjt, hij⟩ := Finset.mem_filter.mp hw + obtain ⟨hlen, hvertices, hedges⟩ := hseedJ + have hjLast : j = Fin.castLE (Nat.succ_le_succ hlen) + (Fin.last seed.length) := by + apply Tj.vertex_injective + rw [hjt, hvertices, hseedTerminal] + have hiBound : i.val < seed.length + 1 := by + have hjVal : j.val = seed.length := by + simpa using congrArg Fin.val hjLast + rw [hjVal] at hij + omega + let iSeed : Fin (seed.length + 1) := ⟨i.val, hiBound⟩ + have hiCast : Fin.castLE (Nat.succ_le_succ hlen) iSeed = i := by + apply Fin.ext + rfl + simp only [TreeSequenceVertexSet, Finset.mem_image] + refine ⟨iSeed, Finset.mem_univ _, ?_⟩ + rw [← hvertices iSeed, hiCast] + exact hiw + +private theorem helper_rho0_unaffected_871.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) + (deltaN beta : Fin k), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (c : Fin k) (_ : c ≠ beta) (_ : c ≠ deltaN) (f : E), + rho0 f = some c ↔ rho1 f = some c := by + classical + intro V E _ _ G k e0 TjPrime rho1 deltaN beta rho0 c hcb hcd f + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + unfold rho0 OutsideTreeColorSwap + by_cases ht : TreeIncidentEdge TjPrime f + · simp [ht] + · simp only [ite_eq_right ht] + by_cases hfb : rho1 f = some beta + · rw [ite_eq_left hfb] + constructor + · intro h + exact False.elim (hcd (Option.some.inj h).symm) + · intro h + exact False.elim (hcb (Option.some.inj (h.symm.trans hfb))) + · rw [ite_eq_right hfb] + by_cases hfd : rho1 f = some deltaN + · rw [ite_eq_left hfd] + constructor + · intro h + exact False.elim (hcb (Option.some.inj h).symm) + · intro h + exact False.elim (hcd (Option.some.inj (h.symm.trans hfd))) + · rw [ite_eq_right hfd] + +private theorem helper_continuation_1155.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn Tj seed TjPrime : TreeSequence G e0) + (phiJ rho1 : PartialEdgeColoring E k) (Dprev : Finset (Fin k)) (gammaFirst gammaN deltaN + beta : Fin k) (terminalSupport u x z : V) (_ : (TwoColorIncidenceGraph G rho1 gammaN + deltaN).Walk (Sum.inl x) (Sum.inl u)) (zPosition : Fin (Tj.length + (1 : ℕ))) (_ : + gammaFirst = gammaN) (_ : TreeSequenceInitialSegment Tj Tn) (_ : + TreeSequenceInitialSegment seed Tj) (_ : TreeSequenceInitialSegment seed TjPrime) (_ : + seed.vertex (Fin.last seed.length) = terminalSupport) (hterminalTj : terminalSupport ∈ + TreeSequenceVertexSet Tj) (_ : TashkinovClosure rho1 seed TjPrime) (_ : + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime)) (_ : beta ≠ deltaN) (_ + : beta ∈ MissingColors G rho1 u) (_ : deltaN ∈ MissingColors G rho1 terminalSupport) + (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (_ : u ∉ TreeSequenceVertexSet Tn) (_ : + StableColoringBeforeVertex Tj terminalSupport hterminalTj Dprev phiJ rho1) (_ : ( + ∀ v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport, MissingColors G rho1 v = MissingColors + G phiJ v)) (_ : TashkinovAugmentationSequence phiJ seed Tj) (_ : ( + ∀ (a : Fin Tj.length) (_ : seed.length ≤ (↑a : ℕ)), rho1 (Tj.edge a) = phiJ (Tj.edge a))) (_ : + deltaN ∉ TreeMissingColors phiJ Tj) (hz : z ∈ TreeSequenceVertexSet Tj) (_ : Tj.vertex + zPosition = z) (_ : seed.length ≤ (↑zPosition : ℕ)) (_ : ( + ∀ w ∈ TreeVerticesBefore Tj z hz, beta ∉ MissingColors G rho1 w)) (_ : ( + ∀ (a : Fin Tj.length) (_ : seed.length ≤ (↑a : ℕ)) (_ : (↑a : ℕ) < (↑zPosition : ℕ)), rho1 + (Tj.edge a) ≠ some beta)) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (_ : terminalSupport ∈ TreeSequenceVertexSet TjPrime) (_ : u ∉ + TreeSequenceVertexSet seed), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let rho3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + ∀ (_ : ( + ∀ (f : E) (_ : TreeIncidentEdge TjPrime f), rho0 f = rho1 f)) (_ : IsProperEdgeColoring G + rho3) (_ : IsOneEdgeUncolored rho3 e0) (_ : gammaN ∈ MissingColors G rho3 u) (_ : ( + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, Sum.inl w ∈ TwoColorComponent + G rho0 gammaN beta (Sum.inl u) ↔ w = u)), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let rho3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + IsProperEdgeColoring G rho3 ∧ IsOneEdgeUncolored rho3 e0 ∧ StableColoringBeforeVertex Tj + terminalSupport hterminalTj Dprev phiJ rho3 ∧ (( + ∀ v ∈ ((TreeVerticesBefore Tj z hz ∪ ({ z } : Finset V) ∪ (TreeVerticesBefore TjPrime u + huPrime ∪ ({ u } : Finset V))).erase u).erase z, MissingColors G rho3 v = MissingColors G + rho1 v) ∧ ( + ∀ (f : E), (( + ∃ (a : Fin Tj.length), seed.length ≤ (↑a : ℕ) ∧ (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → deltaN ∈ MissingColors G rho3 z) ∧ (z ∈ + TreeVerticesBefore TjPrime u huPrime → MissingColors G rho3 z = MissingColors G rho1 z)) ∧ + gammaFirst ∈ MissingColors G rho3 u := by + classical + intro V E _ _ _ G k e0 Tn Tj seed TjPrime phiJ rho1 Dprev gammaFirst gammaN deltaN beta + terminalSupport u x z exitPath zPosition hgammaFirst hTjN hseedJ hseedPrime hseedTerminal + hterminalTj hclosure hprimeElementary hbetaDelta hbeta hdeltaMissing huPrime huOutside hb1 + hb2Missing haugmentation hb2Edges hdeltaPhiJ hz hzPosition hzAfter hzBefore hzEdges + initial_subset hterminalPrime huSeed rho0 rho3 hrho0Fixed hrho3Proper hrho3One hgammaRho3 + hcomponentIntersection + have component_edge_avoids : + ∀ (w : V), w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → w ≠ u → + ∀ f : E, Incident G w f → Sum.inr f ∉ TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + exact @helper_component_edge_avoids_763 V E inferInstance inferInstance inferInstance G k e0 + Tn TjPrime rho1 gammaN deltaN beta u hcomponentIntersection + have hmuRho0Fixed : ∀ (w : V), + w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → + w ≠ u → ∀ f : E, Incident G w f → rho3 f = rho0 f := by + intro w hw hwu f hwf + have hf := component_edge_avoids w hw hwu f hwf + simp [rho3, TwoColorComponentSwap, hf] + have hmuRho1PrimeFixed : ∀ (w : V), + w ∈ TreeSequenceVertexSet TjPrime → w ≠ u → + ∀ f : E, Incident G w f → rho3 f = rho1 f := by + intro w hw hwu f hwf + rw [hmuRho0Fixed w (Finset.mem_union.mpr (Or.inr hw)) hwu f hwf] + exact hrho0Fixed f ⟨w, hw, hwf⟩ + have missing_eq_of_incident_eq : ∀ (w : V), + (∀ f : E, Incident G w f → rho3 f = rho1 f) → + MissingColors G rho3 w = MissingColors G rho1 w := by + intro w hfixed + apply Finset.ext + intro c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + constructor + · intro hnew hold + obtain ⟨f, hwf, hfc⟩ := hold + exact hnew ⟨f, hwf, (hfixed f hwf).trans hfc⟩ + · intro hold hnew + obtain ⟨f, hwf, hfc⟩ := hnew + exact hold ⟨f, hwf, (hfixed f hwf).symm.trans hfc⟩ + have before_seed : ∀ w : V, + w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj → + w ∈ TreeSequenceVertexSet seed := by + exact @helper_before_seed_817 V E inferInstance G k e0 Tj seed rho1 gammaFirst gammaN deltaN + terminalSupport u x exitPath zPosition hseedJ hseedTerminal hterminalTj + have before_prime : ∀ w : V, + w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj → + w ∈ TreeSequenceVertexSet TjPrime := by + intro w hw + exact initial_subset hseedPrime (before_seed w hw) + have hE1 : StableColoringBeforeVertex Tj terminalSupport hterminalTj + Dprev phiJ rho3 := by + unfold StableColoringBeforeVertex at hb1 ⊢ + have before_ne : ∀ w : V, + w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj → w ≠ u := by + intro w hw hwu + subst w + exact huSeed (before_seed u hw) + constructor + · intro f hf hcolor + obtain ⟨w, hw, hwf⟩ := hf + rw [hmuRho1PrimeFixed w (before_prime w hw) (before_ne w hw) f hwf] + exact hb1.1 f ⟨w, hw, hwf⟩ hcolor + · intro w hw + exact (missing_eq_of_incident_eq w + (hmuRho1PrimeFixed w (before_prime w hw) (before_ne w hw))).trans + (hb1.2 w hw) + have hmissingPrime : ∀ w : V, + w ∈ TreeSequenceVertexSet TjPrime → w ≠ u → + MissingColors G rho3 w = MissingColors G rho1 w := by + intro w hw hwu + exact missing_eq_of_incident_eq w (hmuRho1PrimeFixed w hw hwu) + have htreeEdgeFixed : ∀ a : Fin TjPrime.length, + rho3 (TjPrime.edge a) = rho1 (TjPrime.edge a) := by + exact @helper_htreeEdgeFixed_771 V E inferInstance inferInstance G k e0 Tj seed + TjPrime rho1 gammaFirst gammaN deltaN beta u x exitPath zPosition hmuRho1PrimeFixed + have rho0_unaffected : ∀ (c : Fin k), c ≠ beta → c ≠ deltaN → + ∀ f : E, (rho0 f = some c ↔ rho1 f = some c) := by + exact @helper_rho0_unaffected_871 V E inferInstance inferInstance G k e0 TjPrime rho1 deltaN + beta + have hE2 := P2966_T1_OutsideSwapPrefixEffects Tn Tj seed TjPrime + phiJ rho1 rho0 rho3 deltaN beta terminalSupport u z zPosition + hTjN hterminalPrime hclosure.2 hprimeElementary hbetaDelta hbeta + hdeltaMissing hb2Missing haugmentation hb2Edges hdeltaPhiJ hz + hzPosition hzAfter huPrime huOutside hzBefore hzEdges rfl hrho0Fixed hmuRho0Fixed + hmissingPrime htreeEdgeFixed rho0_unaffected + have hgammaFirstRho3 : gammaFirst ∈ MissingColors G rho3 u := by + rw [hgammaFirst] + exact hgammaRho3 + exact ⟨hrho3Proper, hrho3One, hE1, hE2, hgammaFirstRho3⟩ + +theorem ExtensionBaseClaim45Singleton {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (Tn Tj seed TjPrime : TreeSequence G e0) + (phiJ rho1 : PartialEdgeColoring E k) + (Dprev supportColors : Finset (Fin k)) + (gammaFirst gammaN deltaN beta : Fin k) + (terminalSupport u x z : V) + (p : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl terminalSupport) (Sum.inl x)) + (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl x) (Sum.inl u)) + (zPosition : Fin (Tj.length + 1)) + (hgammaFirst : gammaFirst = gammaN) + (hrhoProper : IsProperEdgeColoring G rho1) + (hrhoOne : IsOneEdgeUncolored rho1 e0) + (hTjN : TreeSequenceInitialSegment Tj Tn) + (hseedJ : TreeSequenceInitialSegment seed Tj) + (hseedPrime : TreeSequenceInitialSegment seed TjPrime) + (hseedTerminal : seed.vertex (Fin.last seed.length) = terminalSupport) + (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet Tj) + (hterminalSeed : terminalSupport ∈ TreeSequenceVertexSet seed) + (hclosure : TashkinovClosure rho1 seed TjPrime) + (hprimeElementary : ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime)) + (hgammaDelta : gammaN ≠ deltaN) + (hbetaGamma : beta ≠ gammaN) + (hbetaDelta : beta ≠ deltaN) + (hbeta : beta ∈ MissingColors G rho1 u) + (hdeltaMissing : deltaN ∈ MissingColors G rho1 terminalSupport) + (hpath : p.IsPath) + (hcomponent : {y : Sum V E | y ∈ p.support} = + TwoColorComponent G rho1 gammaN deltaN (Sum.inl terminalSupport)) + (hxOutside : x ∉ + TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) + (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (huOutside : u ∉ TreeSequenceVertexSet Tn) + (hexitPath : exitPath.IsPath) + (hexitLength : 2 ≤ exitPath.length) + (hexitSupport : ∀ y : Sum V E, y ∈ exitPath.support → y ∈ p.support) + (hexitIntersection : ∀ w : V, + w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → + (Sum.inl w ∈ exitPath.support ↔ w = u)) + (hexitBoundary : ∃ g ∈ BoundaryColorEdges G rho1 + (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) gammaN, + Incident G u g ∧ Sum.inr g ∈ exitPath.support) + (hb1 : StableColoringBeforeVertex Tj terminalSupport hterminalTj + Dprev phiJ rho1) + (hb2Missing : ∀ v : V, + v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport → + MissingColors G rho1 v = MissingColors G phiJ v) + (haugmentation : TashkinovAugmentationSequence phiJ seed Tj) + (hb2Edges : ∀ a : Fin Tj.length, seed.length ≤ a.val → + rho1 (Tj.edge a) = phiJ (Tj.edge a)) + (hdeltaPhiJ : deltaN ∉ TreeMissingColors phiJ Tj) + (hz : z ∈ TreeSequenceVertexSet Tj) + (hzPosition : Tj.vertex zPosition = z) + (hzAfter : seed.length ≤ zPosition.val) + (_ : + (seed.length < zPosition.val ∧ + beta ∈ MissingColors G rho1 z ∧ + ∀ r : Fin (Tj.length + 1), + seed.length < r.val → r.val < zPosition.val → + beta ∉ MissingColors G rho1 (Tj.vertex r)) ∨ + (zPosition = Fin.last Tj.length ∧ + ∀ r : Fin (Tj.length + 1), seed.length < r.val → + beta ∉ MissingColors G rho1 (Tj.vertex r))) + (hzBefore : ∀ w ∈ TreeVerticesBefore Tj z hz, + beta ∉ MissingColors G rho1 w) + (hzEdges : ∀ a : Fin Tj.length, seed.length ≤ a.val → + a.val < zPosition.val → rho1 (Tj.edge a) ≠ some beta) : + let rho0 := OutsideTreeColorSwap TjPrime rho1 beta deltaN + let rho3 := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + IsProperEdgeColoring G rho3 ∧ IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex Tj terminalSupport hterminalTj + Dprev phiJ rho3 ∧ + ((∀ v : V, + v ∈ (((TreeVerticesBefore Tj z hz ∪ {z}) ∪ + (TreeVerticesBefore TjPrime u huPrime ∪ {u})).erase u).erase z → + MissingColors G rho3 v = MissingColors G rho1 v) ∧ + (∀ f : E, + ((∃ a : Fin Tj.length, + seed.length ≤ a.val ∧ a.val < zPosition.val ∧ + Tj.edge a = f) ∨ + (∃ (a : Fin TjPrime.length) + (uPosition : Fin (TjPrime.length + 1)), + TjPrime.vertex uPosition = u ∧ a.val < uPosition.val ∧ + TjPrime.edge a = f)) → + rho3 f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → + deltaN ∈ MissingColors G rho3 z) ∧ + (z ∈ TreeVerticesBefore TjPrime u huPrime → + MissingColors G rho3 z = MissingColors G rho1 z)) ∧ + gammaFirst ∈ MissingColors G rho3 u := by + classical + have initial_subset {A B : TreeSequence G e0} + (h : TreeSequenceInitialSegment A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + obtain ⟨i, hi, hvi⟩ := hv + obtain ⟨hlen, hvertices, hedges⟩ := h + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, + (hvertices i).trans hvi⟩ + have hterminalPrime : terminalSupport ∈ TreeSequenceVertexSet TjPrime := + initial_subset hseedPrime hterminalSeed + have huSeed : u ∉ TreeSequenceVertexSet seed := by + intro hu + exact huOutside (initial_subset hTjN (initial_subset hseedJ hu)) + let rho0 := OutsideTreeColorSwap TjPrime rho1 beta deltaN + let rho3 := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + have hbetaTree : beta ∈ TreeMissingColors rho1 TjPrime := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨u, huPrime, hbeta⟩ + have hdeltaTree : deltaN ∈ TreeMissingColors rho1 TjPrime := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨terminalSupport, hterminalPrime, + hdeltaMissing⟩ + have houtside := OutsideTreeColorSwapStable TjPrime supportColors rho1 + beta deltaN hrhoProper hrhoOne hclosure.2 hbetaTree hdeltaTree + hbetaDelta + change IsProperEdgeColoring G rho0 ∧ IsOneEdgeUncolored rho0 e0 ∧ + StableColoring TjPrime supportColors rho1 rho0 ∧ + ∀ f : E, TreeIncidentEdge TjPrime f → rho0 f = rho1 f at houtside + rcases houtside with ⟨hrho0Proper, hrho0One, hrho0Stable, hrho0Fixed⟩ + have hgammaBeta : gammaN ≠ beta := Ne.symm hbetaGamma + have hrho3Proper : IsProperEdgeColoring G rho3 := + TwoColorComponentSwapProper G rho0 gammaN beta hgammaBeta + hrho0Proper (Sum.inl u) + have hrho3One : IsOneEdgeUncolored rho3 e0 := by + unfold IsOneEdgeUncolored at hrho0One ⊢ + constructor + · simp [rho3, TwoColorComponentSwap, hrho0One.1] + · intro f hfe + obtain ⟨c, hc⟩ := hrho0One.2 f hfe + have hne : rho3 f ≠ none := by + by_cases hK : Sum.inr f ∈ + TwoColorComponent G rho0 gammaN beta (Sum.inl u) + · by_cases hcg : c = gammaN + · simp [rho3, TwoColorComponentSwap, hK, hc, hcg] + · by_cases hcb : c = beta + · simp [rho3, TwoColorComponentSwap, hK, hc, hcb, + hbetaGamma] + · simp [rho3, TwoColorComponentSwap, hK, hc, hcg, hcb] + · simp [rho3, TwoColorComponentSwap, hK, hc] + obtain ⟨d, hd⟩ := Option.ne_none_iff_exists.mp hne + exact ⟨d, hd.symm⟩ + have hbetaRho0 : beta ∈ MissingColors G rho0 u := by + rw [hrho0Stable.2 u huPrime] + exact hbeta + obtain ⟨g, hgBoundary, hug, hgExit⟩ := hexitBoundary + have hgRho1 : rho1 g = some gammaN := + (Finset.mem_filter.mp hgBoundary).2 + have hgRho0 : rho0 g = some gammaN := by + rw [hrho0Fixed g ⟨u, huPrime, hug⟩] + exact hgRho1 + have hgComponent : Sum.inr g ∈ + TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + change (TwoColorIncidenceGraph G rho0 gammaN beta).connectedComponentMk + (Sum.inr g) = + (TwoColorIncidenceGraph G rho0 gammaN beta).connectedComponentMk + (Sum.inl u) + have hadj : (TwoColorIncidenceGraph G rho0 gammaN beta).Adj + (Sum.inl u) (Sum.inr g) := ⟨hug, Or.inl hgRho0⟩ + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).symm + have hgRho3 : rho3 g = some beta := by + simp [rho3, TwoColorComponentSwap, hgComponent, hgRho0] + have hbetaRho3 : beta ∉ MissingColors G rho3 u := by + intro hb + have hbPresent : beta ∉ PresentColors G rho3 u := by + simpa [MissingColors] using hb + apply hbPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨g, hug, hgRho3⟩ + have hgammaRho3 : gammaN ∈ MissingColors G rho3 u := by + exact @helper_hgammaRho3_224 V E inferInstance inferInstance G k e0 TjPrime rho1 gammaN + deltaN beta u hbetaGamma hgammaBeta hbetaRho0 + have hcomponentExit : + {y : Sum V E | y ∈ exitPath.support} = + TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + exact @helper_hcomponentExit_260 V E inferInstance inferInstance inferInstance + G k e0 Tn Tj seed TjPrime rho1 gammaFirst gammaN deltaN beta terminalSupport u x z p + exitPath zPosition hclosure hgammaDelta hbetaDelta hbeta hpath hcomponent hxOutside + huPrime hexitPath hexitLength hexitSupport hexitIntersection hz hrho0Proper hrho0Fixed + hgammaBeta hbetaRho0 g hug hgExit hgRho1 hgRho0 + have hcomponentIntersection : + ∀ w : V, w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → (Sum.inl w ∈ + TwoColorComponent G rho0 gammaN beta (Sum.inl u) ↔ w = u) := by + intro w hw + rw [← hcomponentExit] + exact hexitIntersection w hw + exact @helper_continuation_1155 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@Tn) (@Tj) (@seed) (@TjPrime) (@phiJ) (@rho1) (@Dprev) (@gammaFirst) (@gammaN) + (@deltaN) (@beta) (@terminalSupport) (@u) (@x) (@z) (@exitPath) (@zPosition) (@hgammaFirst) + (@hTjN) (@hseedJ) (@hseedPrime) (@hseedTerminal) (@hterminalTj) (@hclosure) + (@hprimeElementary) (@hbetaDelta) (@hbeta) (@hdeltaMissing) (@huPrime) (@huOutside) (@hb1) + (@hb2Missing) (@haugmentation) (@hb2Edges) (@hdeltaPhiJ) (@hz) (@hzPosition) (@hzAfter) + (@hzBefore) (@hzEdges) (@initial_subset) (@hterminalPrime) (@huSeed) (@hrho0Fixed) + (@hrho3Proper) (@hrho3One) (@hgammaRho3) (@hcomponentIntersection) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean new file mode 100644 index 0000000000..8efbd70722 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean @@ -0,0 +1,1933 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation19 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation20 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation21 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation23 +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.OutsideSwapPrefixEffects +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVerticesBefore +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Extension Base Claim46 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperHE41070Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot : Fin ett.rounds) + (terminalSupport : V) (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) (Tn + TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (supportColors : Finset (Fin + k)) (gammaN deltaN : Fin k) (_ : ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot) (_ : + ett.series.data.gamma s.succ = some gammaS) (_ : ett.series.data.delta s.succ = some + deltaS), ETTStrongInterchangeable ett s terminalSupport rho1 gammaS deltaS)) (_ : ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot) (_ : + ett.series.data.gamma s.succ = some gammaS) (_ : ett.series.data.delta s.succ = some + deltaS), gammaS ∈ supportColors ∧ deltaS ∈ supportColors)) (_ : ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot) (_ : + ett.series.data.gamma s.succ = some gammaS) (_ : ett.series.data.delta s.succ = some + deltaS), deltaN ≠ gammaS ∧ deltaN ≠ deltaS)) (_ : ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot) (_ : + ett.series.data.gamma s.succ = some gammaS) (_ : ett.series.data.delta s.succ = some + deltaS), + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree s.succ.castSucc), v ≠ terminalSupport → + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G rho1 gammaS deltaS (Sum.inl v) → w ∈ + TreeSequenceVertexSet Tn)), + ∀ u ∉ TreeSequenceVertexSet Tn, + ∀ beta ∉ supportColors, + ∀ (_ : V), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); ( + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, w ≠ u → + ∀ (f : E), Incident G w f → Sum.inr f ∉ TwoColorComponent G rho0 gammaN beta (Sum.inl u)) → ( + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, w ≠ u → + ∀ (f : E), Incident G w f → mu0 f = rho0 f) → ( + ∀ (c : Fin k), c ≠ beta → c ≠ deltaN → + ∀ (f : E), rho0 f = some c ↔ rho1 f = some c) → + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS + +private abbrev helperContinuation1644Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot preterminalSlot : Fin + ett.rounds) (_ : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) (_ : (↑preterminalSlot : ℕ) < + (↑terminalSlot : ℕ)) (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (Tj Tn seed TjPrime : TreeSequence G e0) (phiJ rho1 : + PartialEdgeColoring E k) (Dprev supportColors : Finset (Fin k)) (gammaN deltaN : Fin k) (x + : V) (p : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)) (_ : TreeSequenceInitialSegment Tj Tn) (_ : TreeSequenceInitialSegment seed + Tj) (_ : TreeSequenceInitialSegment seed TjPrime) (_ : seed.vertex (Fin.last seed.length) + = terminalSupport) (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet Tj) (_ : + TashkinovClosure rho1 seed TjPrime) (_ : ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime)) (_ : ( + ∀ v ∈ (TreeSequenceVertexSet TjPrime).erase terminalSupport, MissingColors G rho1 v ∩ + supportColors = ∅)) (_ : MissingColors G rho1 terminalSupport ∩ supportColors = + { deltaN }) (_ : deltaN ∈ supportColors) (_ : gammaN ≠ deltaN) (_ : deltaN ∈ MissingColors + G rho1 terminalSupport) (_ : p.IsPath) (_ : {y : V ⊕ E | y ∈ p.support} = + TwoColorComponent G rho1 gammaN deltaN (Sum.inl terminalSupport)) (_ : x ∉ + TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) (_ : StableColoringBeforeVertex + Tj terminalSupport hterminalTj Dprev phiJ rho1) (_ : ( + ∀ v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport, MissingColors G rho1 v = MissingColors + G phiJ v)) (_ : TashkinovAugmentationSequence phiJ seed Tj) (_ : ( + ∀ (a : Fin Tj.length) (_ : seed.length ≤ (↑a : ℕ)), rho1 (Tj.edge a) = phiJ (Tj.edge a))) (_ : + deltaN ∉ TreeMissingColors phiJ Tj) (_ : (supportColors = (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).biUnion fun (s : Fin ett.rounds) ↦ + ett.series.data.stored s.succ)) (_ : terminalSlot ∈ ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport) (_ : preterminalSlot ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot) (_ : ett.series.data.delta preterminalSlot.succ = some gammaN) (_ : + ett.series.data.gamma terminalSlot.succ = some gammaN) (_ : ett.series.data.delta + terminalSlot.succ = some deltaN) (_ : ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot) (_ : + ett.series.data.gamma s.succ = some gammaS) (_ : ett.series.data.delta s.succ = some + deltaS), ETTStrongInterchangeable ett s terminalSupport rho1 gammaS deltaS)) (_ : ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot) (_ : + ett.series.data.gamma s.succ = some gammaS) (_ : ett.series.data.delta s.succ = some + deltaS), gammaS ∈ supportColors ∧ deltaS ∈ supportColors)) (_ : ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot) (_ : + ett.series.data.gamma s.succ = some gammaS) (_ : ett.series.data.delta s.succ = some + deltaS), deltaN ≠ gammaS ∧ deltaN ≠ deltaS)) (_ : ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k) (_ : s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot) (_ : + ett.series.data.gamma s.succ = some gammaS) (_ : ett.series.data.delta s.succ = some + deltaS), + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree s.succ.castSucc), v ≠ terminalSupport → + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G rho1 gammaS deltaS (Sum.inl v) → w ∈ + TreeSequenceVertexSet Tn)) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (_ : terminalSupport ∈ TreeSequenceVertexSet TjPrime) (u : V) + (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (_ + : exitPath.IsPath) (_ : (2 : ℕ) ≤ exitPath.length) (_ : ( + ∀ y ∈ exitPath.support, y ∈ p.support)) (_ : ( + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, Sum.inl w ∈ exitPath.support ↔ + w = u)) (_ : ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) + gammaN, Incident G u g ∧ Sum.inr g ∈ exitPath.support)) (huPrime : u ∈ + TreeSequenceVertexSet TjPrime) (_ : u ∉ TreeSequenceVertexSet Tn), + ∀ beta ∈ MissingColors G rho1 u, u ≠ terminalSupport → u ∈ (TreeSequenceVertexSet + TjPrime).erase terminalSupport → beta ∉ supportColors → beta ≠ deltaN → beta ≠ gammaN → u + ∉ TreeSequenceVertexSet seed → + ∀ (z : V) (hz : z ∈ TreeSequenceVertexSet Tj) (zPosition : Fin (Tj.length + (1 : ℕ))), + Tj.vertex zPosition = z → seed.length ≤ (↑zPosition : ℕ) → ( + ∀ w ∈ TreeVerticesBefore Tj z hz, beta ∉ MissingColors G rho1 w) → ( + ∀ (a : Fin Tj.length), seed.length ≤ (↑a : ℕ) → (↑a : ℕ) < (↑zPosition : ℕ) → rho1 (Tj.edge a) + ≠ some beta) → TreeMissingColors rho1 TjPrime ∩ supportColors = { deltaN } → ( + ∀ (a : Fin TjPrime.length), seed.length ≤ (↑a : ℕ) → + ∀ c ∈ supportColors \ { deltaN }, rho1 (TjPrime.edge a) ≠ some c) → + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + IsProperEdgeColoring G rho0 → IsOneEdgeUncolored rho0 e0 → StableColoring TjPrime + supportColors rho1 rho0 → ( + ∀ (f : E), TreeIncidentEdge TjPrime f → rho0 f = rho1 f) → gammaN ≠ beta → + IsProperEdgeColoring G (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta + deltaN) gammaN beta (Sum.inl u)) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN) gammaN beta (Sum.inl u)) e0 ∧ + StableColoringBeforeVertex Tj terminalSupport hterminalTj Dprev phiJ + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN) gammaN beta + (Sum.inl u)) ∧ (( + ∀ v ∈ ((TreeVerticesBefore Tj z hz ∪ { z } ∪ (TreeVerticesBefore TjPrime u huPrime ∪ + { u })).erase u).erase z, MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap + TjPrime rho1 beta deltaN) gammaN beta (Sum.inl u)) v = MissingColors G rho1 v) ∧ ( + ∀ (f : E), (( + ∃ (a : Fin Tj.length), seed.length ≤ (↑a : ℕ) ∧ (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → TwoColorComponentSwap + G (OutsideTreeColorSwap TjPrime rho1 beta deltaN) gammaN beta (Sum.inl u) f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → deltaN ∈ MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN) gammaN beta (Sum.inl u)) z) ∧ (z ∈ + TreeVerticesBefore TjPrime u huPrime → MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN) gammaN beta (Sum.inl u)) z = MissingColors + G rho1 z)) ∧ (ett.series.data.delta preterminalSlot.succ = some gammaN ∧ gammaN ∈ + MissingColors G (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN) + gammaN beta (Sum.inl u)) u ∧ beta ∉ MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN) gammaN beta (Sum.inl u)) u) ∧ ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN) gammaN beta (Sum.inl u)) gammaS deltaS) ∧ + (((TreeSequenceVertexSet TjPrime).erase u).biUnion fun (v : V) ↦ MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta deltaN) gammaN beta + (Sum.inl u)) v) ∩ supportColors = { deltaN } ∧ MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap TjPrime rho1 beta deltaN) gammaN beta (Sum.inl u)) terminalSupport ∩ + supportColors = { deltaN } ∧ + ∀ (a : Fin TjPrime.length), seed.length ≤ (↑a : ℕ) → + ∀ c ∈ supportColors \ { deltaN }, ¬TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 + beta deltaN) gammaN beta (Sum.inl u) (TjPrime.edge a) = some c + +private theorem helper_hgammaMu0_408.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : + Fin k) (u : V) (beta : Fin k) (_ : beta ≠ gammaN), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + ∀ (_ : gammaN ≠ beta) (_ : beta ∈ MissingColors G rho0 u), gammaN ∈ MissingColors G mu0 u := by + classical + intro V E _ _ G k e0 TjPrime rho1 gammaN deltaN u beta hbetaGamma rho0 mu0 hgammaBeta hbetaRho0 + let _ := Fintype.ofFinite V + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro hgPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hgPresent + obtain ⟨f, huf, hfMu0⟩ := hgPresent + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G rho0 gammaN beta (Sum.inl u) + · by_cases hfGamma : rho0 f = some gammaN + · have : (some beta : Option (Fin k)) = some gammaN := by + simp [mu0, TwoColorComponentSwap, hfComponent, hfGamma, hbetaGamma] at hfMu0 + exact hbetaGamma (Option.some.inj this) + · by_cases hfBeta : rho0 f = some beta + · have hnotPresent : beta ∉ PresentColors G rho0 u := by + simpa [MissingColors] using hbetaRho0 + exact hnotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, huf, hfBeta⟩) + · have : rho0 f = some gammaN := by + simp [mu0, TwoColorComponentSwap, hfComponent, hfGamma, hfBeta] at hfMu0 + exact hfGamma this + · have hfRho0 : rho0 f = some gammaN := by + simpa [mu0, TwoColorComponentSwap, hfComponent] using hfMu0 + have hadj : (TwoColorIncidenceGraph G rho0 gammaN beta).Adj + (Sum.inl u) (Sum.inr f) := ⟨huf, Or.inl hfRho0⟩ + apply hfComponent + change (TwoColorIncidenceGraph G rho0 gammaN beta).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G rho0 gammaN beta).connectedComponentMk + (Sum.inl u) + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).symm + +private theorem helper_path_edge_data_156.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot preterminalSlot : Fin + ett.rounds) (_ : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) (_ : (↑preterminalSlot : ℕ) < + (↑terminalSlot : ℕ)) (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (rho1 : PartialEdgeColoring E k) (supportColors : Finset (Fin k)) + (gammaN deltaN : Fin k) (x : V) (_ : (supportColors = (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).biUnion fun (s : Fin ett.rounds) ↦ + ett.series.data.stored s.succ)) (_ : terminalSlot ∈ ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport) (_ : preterminalSlot ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport terminalSupport).erase + terminalSlot) (_ : ett.series.data.gamma terminalSlot.succ = some gammaN) (_ : + ett.series.data.delta terminalSlot.succ = some deltaN) (u : V) (_ : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)), + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (_ : q.IsPath) {e : E} (_ : Sum.inr e ∈ + q.support), + ∃ (j : ℕ), (0 : ℕ) < j ∧ j < q.length ∧ q.getVert j = Sum.inr e ∧ + ∃ (v : V) (w : V), q.getVert (j - (1 : ℕ)) = Sum.inl v ∧ q.getVert (j + (1 : ℕ)) = Sum.inl w ∧ + v ≠ w ∧ G.ends e = s(v, w) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot preterminalSlot _ _ terminalSupport + hterminalSupport rho1 supportColors gammaN deltaN x _ _ _ _ _ u exitPath H1 a b q hq e he + obtain ⟨j, hj, hjle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp he + have hjpos : 0 < j := by + by_contra hn + have hjzero : j = 0 := Nat.eq_zero_of_not_pos hn + have : (Sum.inl a : Sum V E) = Sum.inr e := by + simp [hjzero] at hj + exact Sum.inl_ne_inr this + have hjlt : j < q.length := by + by_contra hn + have hjend : j = q.length := by omega + have : (Sum.inl b : Sum V E) = Sum.inr e := by + simp [hjend] at hj + exact Sum.inl_ne_inr this + have hprev := q.adj_getVert_succ (i := j - 1) (by omega) + rw [show j - 1 + 1 = j by omega, hj] at hprev + have hnext := q.adj_getVert_succ (i := j) hjlt + rw [hj] at hnext + obtain ⟨v, hv⟩ : ∃ v : V, q.getVert (j - 1) = Sum.inl v := by + cases hc : q.getVert (j - 1) with + | inl v => exact ⟨v, rfl⟩ + | inr f => + rw [hc] at hprev + exact False.elim (by simp [H1, TwoColorIncidenceGraph] at hprev) + obtain ⟨w, hw⟩ : ∃ w : V, q.getVert (j + 1) = Sum.inl w := by + cases hc : q.getVert (j + 1) with + | inl w => exact ⟨w, rfl⟩ + | inr f => + rw [hc] at hnext + exact False.elim (by simp [H1, TwoColorIncidenceGraph] at hnext) + have hve : Incident G v e := by + rw [hv] at hprev + change Incident G v e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at hprev + exact hprev.1 + have hwe : Incident G w e := by + rw [hw] at hnext + change Incident G w e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at hnext + exact hnext.1 + have hvw : v ≠ w := by + intro hvw + have hindex := hq.getVert_injOn + (show j - 1 ≤ q.length by omega) + (show j + 1 ≤ q.length by omega) + (by rw [hv, hw, hvw]) + omega + have hends : G.ends e = s(v, w) := + (Sym2.mem_and_mem_iff hvw).mp ⟨hve, hwe⟩ + exact ⟨j, hjpos, hjlt, hj, v, w, hv, hw, hvw, hends⟩ + +private theorem helper_exit_edge_color_254.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) (rho1 : + PartialEdgeColoring E k) (gammaN deltaN : Fin k) (x : V) (_ : gammaN ≠ deltaN) (u : V) + (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (_ + : exitPath.IsPath) (_ : ( + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, Sum.inl w ∈ exitPath.support ↔ + w = u)) (beta : Fin k) (_ : beta ≠ deltaN), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (_ : ( + ∀ (f : E) (_ : TreeIncidentEdge TjPrime f), rho0 f = rho1 f)) (_ : gammaN ≠ beta) (g : E) (_ : + rho1 g = some gammaN), + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + ∀ (_ : ( + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (_ : q.IsPath) {e : E} (_ : Sum.inr e ∈ + q.support) {w : V} (_ : Incident G w e), Sum.inl w ∈ q.support)) (_ : ( + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (_ : q.IsPath) {e : E} (_ : Sum.inr e ∈ + q.support) (_ : Incident G b e), q.getVert (q.length - (1 : ℕ)) = Sum.inr e)) (_ : + exitPath.getVert (exitPath.length - (1 : ℕ)) = Sum.inr g) (e : E) (_ : Sum.inr e ∈ + exitPath.support) (_ : rho1 e = some gammaN ∨ rho1 e = some deltaN), rho0 e = some gammaN + ∨ rho0 e = some beta := by + classical + intro V E _ _ _ G k e0 Tn TjPrime rho1 gammaN deltaN x hgammaDelta u exitPath hexitPath + hexitIntersection beta hbetaDelta rho0 hrho0Fixed hgammaBeta g hgRho1 H1 + path_incident_vertex_mem path_incident_end_last hgLast e he hcolor + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + rcases hcolor with hgamma | hdelta + · left + by_cases heIncident : TreeIncidentEdge TjPrime e + · rw [hrho0Fixed e heIncident] + exact hgamma + · unfold rho0 OutsideTreeColorSwap + rw [ite_eq_right heIncident] + rw [ite_eq_right (by + intro heb + exact hgammaBeta (Option.some.inj (hgamma.symm.trans heb)))] + rw [ite_eq_right (by + intro hed + exact hgammaDelta (Option.some.inj (hgamma.symm.trans hed)))] + exact hgamma + · have hnotIncident : ¬ TreeIncidentEdge TjPrime e := by + intro heIncident + obtain ⟨w, hwPrime, hwe⟩ := heIncident + have hwExit : Sum.inl w ∈ exitPath.support := + path_incident_vertex_mem exitPath hexitPath he hwe + have hwu : w = u := + (hexitIntersection w + (Finset.mem_union.mpr (Or.inr hwPrime))).mp hwExit + subst w + have heLast := path_incident_end_last exitPath hexitPath he hwe + have heg : e = g := Sum.inr.inj (heLast.symm.trans hgLast) + subst e + exact hgammaDelta (Option.some.inj (hgRho1.symm.trans hdelta)) + right + unfold rho0 OutsideTreeColorSwap + rw [ite_eq_right hnotIncident] + rw [ite_eq_right (by + intro heb + exact hbetaDelta (Option.some.inj (heb.symm.trans hdelta)))] + rw [ite_eq_left hdelta] + +private theorem helper_exit_adj_rho0_292.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : + Fin k) (x u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl + x) (Sum.inl u)) (beta : Fin k), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho0 gammaN beta; + ∀ (_ : ( + ∀ (e : E) (_ : Sum.inr e ∈ exitPath.support) (_ : rho1 e = some gammaN ∨ rho1 e = some + deltaN), rho0 e = some gammaN ∨ rho0 e = some beta)), + ∀ i < exitPath.length, H0.Adj (exitPath.getVert i) (exitPath.getVert (i + (1 : ℕ))) := by + classical + intro V E _ _ G k e0 TjPrime rho1 gammaN deltaN x u exitPath beta rho0 H1 H0 exit_edge_color i hi + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + have hadj := exitPath.adj_getVert_succ (i := i) hi + cases hx : exitPath.getVert i with + | inl v => + cases hy : exitPath.getVert (i + 1) with + | inl w => + rw [hx, hy] at hadj + exact False.elim (by simp [TwoColorIncidenceGraph] at hadj) + | inr e => + rw [hx, hy] at hadj + change Incident G v e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at hadj + change Incident G v e ∧ + (rho0 e = some gammaN ∨ rho0 e = some beta) + exact ⟨hadj.1, exit_edge_color e + (by simpa [hy] using exitPath.getVert_mem_support (i + 1)) hadj.2⟩ + | inr e => + cases hy : exitPath.getVert (i + 1) with + | inl v => + rw [hx, hy] at hadj + change Incident G v e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at hadj + change Incident G v e ∧ + (rho0 e = some gammaN ∨ rho0 e = some beta) + exact ⟨hadj.1, exit_edge_color e + (by simpa [hx] using exitPath.getVert_mem_support i) hadj.2⟩ + | inr f => + rw [hx, hy] at hadj + exact False.elim (by simp [TwoColorIncidenceGraph] at hadj) + +private theorem helper_new_x_adj_old_342.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (seed TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN + deltaN : Fin k) (x : V) (_ : TashkinovClosure rho1 seed TjPrime) (_ : gammaN ≠ deltaN), + ∀ u ∈ TreeSequenceVertexSet TjPrime, + ∀ beta ∈ MissingColors G rho1 u, beta ≠ deltaN → + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; ( + ∀ (f : E), TreeIncidentEdge TjPrime f → rho0 f = rho1 f) → x ∉ TreeSequenceVertexSet TjPrime → + ∀ (e : E), Incident G x e → rho0 e = some gammaN ∨ rho0 e = some beta → rho1 e = some gammaN ∨ + rho1 e = some deltaN := by + classical + intro V E _ _ G k e0 seed TjPrime rho1 gammaN deltaN x hclosure hgammaDelta u huPrime beta + hbeta hbetaDelta rho0 hrho0Fixed hxPrime e hxe hcolor + by_cases heIncident : TreeIncidentEdge TjPrime e + · have hfixed := hrho0Fixed e heIncident + obtain ⟨w, hwPrime, hwe⟩ := heIncident + have hwx : w ≠ x := by + intro hwx + apply hxPrime + simpa [← hwx] using hwPrime + have hends : G.ends e = s(w, x) := + (Sym2.mem_and_mem_iff hwx).mp ⟨hwe, hxe⟩ + have heBoundary : e ∈ BoundaryEdges G + (TreeSequenceVertexSet TjPrime) := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwPrime, x, hxPrime, hends⟩ + rcases hcolor with hgamma | hbetaColor + · exact Or.inl (hfixed.symm.trans hgamma) + · have hbetaOld : rho1 e = some beta := + hfixed.symm.trans hbetaColor + exact False.elim + ((hclosure.2 heBoundary huPrime hbetaOld) hbeta) + · unfold rho0 OutsideTreeColorSwap at hcolor + rw [ite_eq_right heIncident] at hcolor + by_cases hbetaOld : rho1 e = some beta + · rw [ite_eq_left hbetaOld] at hcolor + rcases hcolor with hdeltaGamma | hdeltaBeta + · exact False.elim + (hgammaDelta (Option.some.inj hdeltaGamma).symm) + · exact False.elim + (hbetaDelta (Option.some.inj hdeltaBeta).symm) + · by_cases hdeltaOld : rho1 e = some deltaN + · exact Or.inr hdeltaOld + · rw [ite_eq_right hbetaOld, ite_eq_right hdeltaOld] at hcolor + rcases hcolor with hgammaOld | hbetaOld' + · exact Or.inl hgammaOld + · exact False.elim (hbetaOld hbetaOld') + +private theorem helper_first_p_last_384.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {k : ℕ} (terminalSupport : V) + (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (x : V) (p : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) (Sum.inl x)) + (_ : p.IsPath) (u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl x) (Sum.inl u)) (_ : ( + ∀ y ∈ exitPath.support, y ∈ p.support)), + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + ∀ (_ : ( + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (_ : q.IsPath) {e : E} (_ : Sum.inr e ∈ + q.support) (_ : Incident G b e), q.getVert (q.length - (1 : ℕ)) = Sum.inr e)) (_ : H1.Adj + (Sum.inl x) (exitPath.getVert (1 : ℕ))), p.getVert (p.length - (1 : ℕ)) = exitPath.getVert + (1 : ℕ) := by + classical + intro V E G k terminalSupport rho1 gammaN deltaN x p hpath u exitPath hexitSupport H1 + path_incident_end_last first_old_adj + cases hfirst : exitPath.getVert 1 with + | inl v => + rw [hfirst] at first_old_adj + exact False.elim + (by simp [H1, TwoColorIncidenceGraph] at first_old_adj) + | inr e => + have heExit : Sum.inr e ∈ exitPath.support := by + simpa [hfirst] using exitPath.getVert_mem_support 1 + have heP : Sum.inr e ∈ p.support := hexitSupport _ heExit + have hxe : Incident G x e := by + rw [hfirst] at first_old_adj + change Incident G x e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at first_old_adj + exact first_old_adj.1 + exact path_incident_end_last p hpath heP hxe + +private theorem helper_old_x_neighbor_unique_401.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (terminalSupport + : V) (Tj : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (x + : V) (p : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) + (Sum.inl x)) (_ : p.IsPath) (_ : {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G rho1 + gammaN deltaN (Sum.inl terminalSupport)) (u : V) (exitPath : (TwoColorIncidenceGraph G + rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)), + ∀ z ∈ TreeSequenceVertexSet Tj, + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; ( + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)), q.IsPath → + ∀ {e : E}, Sum.inr e ∈ q.support → Incident G b e → q.getVert (q.length - (1 : ℕ)) = Sum.inr + e) → p.getVert (p.length - (1 : ℕ)) = exitPath.getVert (1 : ℕ) → + ∀ (z : V ⊕ E), H1.Adj (Sum.inl x) z → z = exitPath.getVert (1 : ℕ) := by + classical + intro V E G k e0 terminalSupport Tj rho1 gammaN deltaN x p hpath hcomponent u exitPath z hz H1 + path_incident_end_last first_p_last z hxz + cases hz : z with + | inl v => + rw [hz] at hxz + exact False.elim (by simp [H1, TwoColorIncidenceGraph] at hxz) + | inr e => + have hxzE : H1.Adj (Sum.inl x) (Sum.inr e) := by + simpa [hz] using hxz + have hxe : Incident G x e := by + change Incident G x e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) at hxzE + exact hxzE.1 + have hxComponent : H1.connectedComponentMk (Sum.inl x) = + H1.connectedComponentMk (Sum.inl terminalSupport) := by + change Sum.inl x ∈ + TwoColorComponent G rho1 gammaN deltaN + (Sum.inl terminalSupport) + rw [← hcomponent] + exact p.end_mem_support + have heComponent : H1.connectedComponentMk (Sum.inr e) = + H1.connectedComponentMk (Sum.inl terminalSupport) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hxzE).symm.trans hxComponent + have heP : Sum.inr e ∈ p.support := by + change Sum.inr e ∈ {q : Sum V E | q ∈ p.support} + rw [hcomponent] + exact heComponent + have heLast := path_incident_end_last p hpath heP hxe + exact heLast.symm.trans first_p_last + +private theorem helper_x_neighbor_unique_432.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN + : Fin k) (x u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl + x) (Sum.inl u)) (beta : Fin k), + ∀ z ∈ TreeSequenceVertexSet Tj, + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho0 gammaN beta; ( + ∀ (e : E), Incident G x e → rho0 e = some gammaN ∨ rho0 e = some beta → rho1 e = some gammaN ∨ + rho1 e = some deltaN) → ( + ∀ (z : V ⊕ E), H1.Adj (Sum.inl x) z → z = exitPath.getVert (1 : ℕ)) → + ∀ (z : V ⊕ E), H0.Adj (Sum.inl x) z → z = exitPath.getVert (1 : ℕ) := by + classical + intro V E _ _ G k e0 Tj TjPrime rho1 gammaN deltaN x u exitPath beta z hz rho0 H1 H0 new_x_adj_old + old_x_neighbor_unique z hxz + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + apply old_x_neighbor_unique z + cases hz : z with + | inl v => + rw [hz] at hxz + exact False.elim (by simp [H0, TwoColorIncidenceGraph] at hxz) + | inr e => + have hxzE : H0.Adj (Sum.inl x) (Sum.inr e) := by + simpa [hz] using hxz + change Incident G x e ∧ + (rho0 e = some gammaN ∨ rho0 e = some beta) at hxzE + change Incident G x e ∧ + (rho1 e = some gammaN ∨ rho1 e = some deltaN) + exact ⟨hxzE.1, new_x_adj_old e hxzE.1 hxzE.2⟩ + +private theorem helper_u_neighbor_unique_448.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN + : Fin k) (x u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl + x) (Sum.inl u)) (beta : Fin k), + ∀ z ∈ TreeSequenceVertexSet Tj, + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + IsProperEdgeColoring G rho0 → beta ∈ MissingColors G rho0 u → + ∀ (g : E), Incident G u g → rho0 g = some gammaN → + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho0 gammaN beta; exitPath.getVert + (exitPath.length - (1 : ℕ)) = Sum.inr g → + ∀ (z : V ⊕ E), H0.Adj (Sum.inl u) z → z = exitPath.getVert (exitPath.length - (1 : ℕ)) := by + classical + intro V E _ _ G k e0 Tj TjPrime rho1 gammaN deltaN x u exitPath beta z hz rho0 hrho0Proper + hbetaRho0 g hug hgRho0 H0 hgLast z huz + let _ := Fintype.ofFinite V + cases hz : z with + | inl v => + rw [hz] at huz + exact False.elim (by simp [H0, TwoColorIncidenceGraph] at huz) + | inr e => + rw [hz] at huz + change Incident G u e ∧ + (rho0 e = some gammaN ∨ rho0 e = some beta) at huz + have heGamma : rho0 e = some gammaN := by + rcases huz.2 with heGamma | heBeta + · exact heGamma + · have hnotPresent : beta ∉ PresentColors G rho0 u := by + simpa [MissingColors] using hbetaRho0 + exact False.elim (hnotPresent (by + simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨e, huz.1, heBeta⟩)) + have heg : e = g := by + by_contra hne + exact (hrho0Proper hne ⟨u, huz.1, hug⟩ heGamma) hgRho0 + exact (congrArg Sum.inr heg).trans hgLast.symm + +private theorem helper_support_closed_473.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (Tj TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN + : Fin k) (x u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl + x) (Sum.inl u)) (_ : exitPath.IsPath) (_ : (2 : ℕ) ≤ exitPath.length) (beta : Fin k), + ∀ z ∈ TreeSequenceVertexSet Tj, + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + IsProperEdgeColoring G rho0 → + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho0 gammaN beta; ( + ∀ i < exitPath.length, H0.Adj (exitPath.getVert i) (exitPath.getVert (i + (1 : ℕ)))) → ( + ∀ (z : V ⊕ E), H0.Adj (Sum.inl x) z → z = exitPath.getVert (1 : ℕ)) → ( + ∀ (z : V ⊕ E), H0.Adj (Sum.inl u) z → z = exitPath.getVert (exitPath.length - (1 : ℕ))) → + ∀ w ∈ exitPath.support, + ∀ (z : V ⊕ E), H0.Adj w z → z ∈ exitPath.support := by + classical + intro V E _ _ G k e0 Tj TjPrime rho1 gammaN deltaN x u exitPath hexitPath hexitLength beta z hz + rho0 hrho0Proper H0 exit_adj_rho0 x_neighbor_unique u_neighbor_unique w hw z hwz + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hw + by_cases hn0 : n = 0 + · subst n + have hwstart : w = Sum.inl x := by simpa using hn.symm + have hz := x_neighbor_unique z (by simpa [hwstart] using hwz) + simp [hz] + by_cases hnend : n = exitPath.length + · have hwend : w = Sum.inl u := by + rw [← hn, hexitPath.getVert_eq_end_iff hnle] + exact hnend + have hz := u_neighbor_unique z (by simpa [hwend] using hwz) + simp [hz] + have hleft : H0.Adj (exitPath.getVert n) + (exitPath.getVert (n - 1)) := by + rw [← show n - 1 + 1 = n by omega] + exact (exit_adj_rho0 (n - 1) (by omega)).symm + have hright : H0.Adj (exitPath.getVert n) + (exitPath.getVert (n + 1)) := + exit_adj_rho0 n (by omega) + by_contra hznot + have hwz' := hwz + rw [← hn] at hwz' + have hneleft : exitPath.getVert (n - 1) ≠ z := by + intro he + apply hznot + rw [← he] + exact exitPath.getVert_mem_support _ + have hneright : exitPath.getVert (n + 1) ≠ z := by + intro he + apply hznot + rw [← he] + exact exitPath.getVert_mem_support _ + have hnelr : exitPath.getVert (n - 1) ≠ + exitPath.getVert (n + 1) := by + intro he + have hindex := hexitPath.getVert_injOn + (show n - 1 ≤ exitPath.length by omega) + (show n + 1 ≤ exitPath.length by omega) he + omega + let : Fintype (H0.neighborSet (exitPath.getVert n)) := + Fintype.ofFinite _ + have hthree : 3 ≤ H0.degree (exitPath.getVert n) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset (Sum V E) := + {z, exitPath.getVert (n - 1), exitPath.getVert (n + 1)} + have hs : s ⊆ H0.neighborFinset (exitPath.getVert n) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hwz' + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hcard : 3 ≤ s.card := by + simp [s, hnelr, hneleft.symm, + hneright.symm] + exact hcard.trans (Finset.card_le_card hs) + have hupper : H0.degree (exitPath.getVert n) ≤ 2 := by + simpa [H0] using TwoColorIncidenceDegreeAtMostTwo + G rho0 gammaN beta hrho0Proper (exitPath.getVert n) + omega + +private theorem helper_branch_340.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ _ : Fin ett.rounds) (terminalSupport : + V) (Tj Tn seed TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN + deltaN : Fin k) (x : V) (p : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl + terminalSupport) (Sum.inl x)) (_ : TashkinovClosure rho1 seed TjPrime) (_ : gammaN ≠ + deltaN) (_ : p.IsPath) (_ : {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G rho1 gammaN + deltaN (Sum.inl terminalSupport)) (_ : x ∉ TreeSequenceVertexSet Tn ∪ + TreeSequenceVertexSet TjPrime) (u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN + deltaN).Walk (Sum.inl x) (Sum.inl u)) (_ : exitPath.IsPath) (_ : (2 : ℕ) ≤ + exitPath.length) (_ : ( + ∀ y ∈ exitPath.support, y ∈ p.support)) (_ : u ∈ TreeSequenceVertexSet TjPrime), + ∀ beta ∈ MissingColors G rho1 u, beta ≠ deltaN → + ∀ z ∈ TreeSequenceVertexSet Tj, + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + IsProperEdgeColoring G rho0 → ( + ∀ (f : E), TreeIncidentEdge TjPrime f → rho0 f = rho1 f) → beta ∈ MissingColors G rho0 u → + ∀ (g : E), Incident G u g → rho0 g = some gammaN → + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gammaN deltaN; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho0 gammaN beta; ( + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)), q.IsPath → + ∀ {e : E}, Sum.inr e ∈ q.support → Incident G b e → q.getVert (q.length - (1 : ℕ)) = Sum.inr + e) → exitPath.getVert (exitPath.length - (1 : ℕ)) = Sum.inr g → ( + ∀ i < exitPath.length, H0.Adj (exitPath.getVert i) (exitPath.getVert (i + (1 : ℕ)))) → + TwoColorComponent G rho0 gammaN beta (Sum.inl u) ⊆ {y : V ⊕ E | y ∈ exitPath.support} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSlot preterminalSlot terminalSupport Tj + Tn seed TjPrime rho1 gammaN deltaN x p hclosure hgammaDelta hpath hcomponent hxOutside u + exitPath hexitPath hexitLength hexitSupport huPrime beta hbeta hbetaDelta z hz rho0 + hrho0Proper hrho0Fixed hbetaRho0 g hug hgRho0 H1 H0 path_incident_end_last hgLast + exit_adj_rho0 y hy + have hxPrime : x ∉ TreeSequenceVertexSet TjPrime := by + intro hx + exact hxOutside (Finset.mem_union.mpr (Or.inr hx)) + have new_x_adj_old : ∀ e : E, Incident G x e → + (rho0 e = some gammaN ∨ rho0 e = some beta) → + rho1 e = some gammaN ∨ rho1 e = some deltaN := by + exact @helper_new_x_adj_old_342 V E inferInstance inferInstance G k e0 seed TjPrime rho1 + gammaN deltaN x hclosure hgammaDelta u huPrime beta hbeta hbetaDelta hrho0Fixed hxPrime + have first_old_adj : H1.Adj (Sum.inl x) (exitPath.getVert 1) := by + simpa [H1] using exitPath.adj_getVert_succ + (show 0 < exitPath.length by omega) + have first_p_last : + p.getVert (p.length - 1) = exitPath.getVert 1 := by + exact @helper_first_p_last_384 V E G k terminalSupport rho1 gammaN deltaN x p hpath u + exitPath hexitSupport path_incident_end_last first_old_adj + have old_x_neighbor_unique : ∀ z : Sum V E, + H1.Adj (Sum.inl x) z → z = exitPath.getVert 1 := by + exact @helper_old_x_neighbor_unique_401 V E G k e0 terminalSupport Tj rho1 gammaN deltaN x p + hpath hcomponent u exitPath z hz path_incident_end_last first_p_last + have x_neighbor_unique : ∀ z : Sum V E, + H0.Adj (Sum.inl x) z → z = exitPath.getVert 1 := by + exact @helper_x_neighbor_unique_432 V E inferInstance inferInstance G k e0 Tj TjPrime rho1 + gammaN deltaN x u exitPath beta z hz new_x_adj_old old_x_neighbor_unique + have u_neighbor_unique : + ∀ z : Sum V E, H0.Adj (Sum.inl u) z → z = exitPath.getVert (exitPath.length - 1) := by + exact @helper_u_neighbor_unique_448 V E inferInstance inferInstance G k e0 Tj TjPrime rho1 + gammaN deltaN x u exitPath beta z hz hrho0Proper hbetaRho0 g hug hgRho0 hgLast + have support_closed : ∀ w : Sum V E, w ∈ exitPath.support → + ∀ z : Sum V E, H0.Adj w z → z ∈ exitPath.support := by + exact @helper_support_closed_473 V E inferInstance inferInstance G k e0 Tj TjPrime rho1 + gammaN deltaN x u exitPath hexitPath hexitLength beta z hz hrho0Proper exit_adj_rho0 + x_neighbor_unique u_neighbor_unique + have reach : H0.Reachable (Sum.inl u) y := by + change H0.connectedComponentMk y = + H0.connectedComponentMk (Sum.inl u) at hy + exact SimpleGraph.ConnectedComponent.eq.mp hy |>.symm + apply reach.mem_subgraphVerts + (H := (⊤ : H0.Subgraph).induce {w | w ∈ exitPath.support}) + (fun w hw z hadj => by + exact ⟨by simpa using hw, + support_closed w (by simpa using hw) z hadj, hadj⟩) + (by simp) + +private theorem helper_hcomponentExit_447.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSlot preterminalSlot : Fin + ett.rounds) (_ : (↑terminalSlot : ℕ) + (1 : ℕ) = ett.rounds) (_ : (↑preterminalSlot : ℕ) < + (↑terminalSlot : ℕ)) (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (Tj Tn seed TjPrime : TreeSequence G e0) (rho1 : + PartialEdgeColoring E k) (supportColors : Finset (Fin k)) (gammaN deltaN : Fin k) (x : V) + (p : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl terminalSupport) (Sum.inl + x)) (_ : TashkinovClosure rho1 seed TjPrime) (_ : gammaN ≠ deltaN) (_ : p.IsPath) (_ : + {y : V ⊕ E | y ∈ p.support} = TwoColorComponent G rho1 gammaN deltaN (Sum.inl + terminalSupport)) (_ : x ∉ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) (_ : + (supportColors = (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ)) (_ : + terminalSlot ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport) (_ : preterminalSlot ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot) (_ : ett.series.data.gamma + terminalSlot.succ = some gammaN) (_ : ett.series.data.delta terminalSlot.succ = some + deltaN) (u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) + (Sum.inl u)) (_ : exitPath.IsPath) (_ : (2 : ℕ) ≤ exitPath.length) (_ : ( + ∀ y ∈ exitPath.support, y ∈ p.support)) (_ : ( + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, Sum.inl w ∈ exitPath.support ↔ + w = u)) (_ : u ∈ TreeSequenceVertexSet TjPrime), + ∀ beta ∈ MissingColors G rho1 u, beta ≠ deltaN → + ∀ z ∈ TreeSequenceVertexSet Tj, + ∀ (_ : Fin (Tj.length + (1 : ℕ))), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + IsProperEdgeColoring G rho0 → ( + ∀ (f : E), TreeIncidentEdge TjPrime f → rho0 f = rho1 f) → gammaN ≠ beta → beta ∈ + MissingColors G rho0 u → + ∀ (g : E), Incident G u g → Sum.inr g ∈ exitPath.support → rho1 g = some gammaN → rho0 g = + some gammaN → {y : V ⊕ E | y ∈ exitPath.support} = TwoColorComponent G rho0 gammaN beta + (Sum.inl u) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSlot preterminalSlot _ _ + terminalSupport hterminalSupport Tj Tn seed TjPrime rho1 supportColors gammaN deltaN x p + hclosure hgammaDelta hpath hcomponent hxOutside _ _ _ _ _ u exitPath hexitPath hexitLength + hexitSupport hexitIntersection huPrime beta hbeta hbetaDelta z hz zPosition rho0 + hrho0Proper hrho0Fixed hgammaBeta hbetaRho0 g hug hgExit hgRho1 hgRho0 + let H1 := TwoColorIncidenceGraph G rho1 gammaN deltaN + let H0 := TwoColorIncidenceGraph G rho0 gammaN beta + have path_edge_data : + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (hq : q.IsPath) {e : E}, Sum.inr e ∈ + q.support → + ∃ j : ℕ, 0 < j ∧ j < q.length ∧ q.getVert j = Sum.inr e ∧ + ∃ v w : V, q.getVert (j - 1) = Sum.inl v ∧ q.getVert (j + 1) = Sum.inl w ∧ v ≠ w ∧ G.ends e = + s(v, w) := by + exact @helper_path_edge_data_156 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSlot preterminalSlot (by assumption) (by assumption) + terminalSupport hterminalSupport rho1 supportColors gammaN deltaN x (by assumption) (by + assumption) (by assumption) (by assumption) (by assumption) u exitPath + have path_incident_vertex_mem : ∀ {a b : V} + (q : H1.Walk (Sum.inl a) (Sum.inl b)) (hq : q.IsPath) + {e : E}, Sum.inr e ∈ q.support → ∀ {w : V}, Incident G w e → + Sum.inl w ∈ q.support := by + intro a b q hq e he w hwe + obtain ⟨j, hjpos, hjlt, hj, v, t, hv, ht, hvt, hends⟩ := + path_edge_data q hq he + have hwends : w ∈ s(v, t) := by + rw [← hends] + exact hwe + simp only [Sym2.mem_iff] at hwends + apply SimpleGraph.Walk.mem_support_iff_exists_getVert.mpr + rcases hwends with hwv | hwt + · exact ⟨j - 1, by simpa [hwv] using hv, by omega⟩ + · exact ⟨j + 1, by simpa [hwt] using ht, by omega⟩ + have path_incident_end_last : + ∀ {a b : V} (q : H1.Walk (Sum.inl a) (Sum.inl b)) (hq : q.IsPath) {e : E}, Sum.inr e ∈ + q.support → Incident G b e → q.getVert (q.length - 1) = Sum.inr e := by + intro a b q hq e he hbe + obtain ⟨j, hjpos, hjlt, hj, v, w, hv, hw, hvw, hends⟩ := + path_edge_data q hq he + have hbends : b ∈ s(v, w) := by + rw [← hends] + exact hbe + simp only [Sym2.mem_iff] at hbends + rcases hbends with hbv | hbw + · have hindex := hq.getVert_injOn + (show j - 1 ≤ q.length by omega) + (show q.length ≤ q.length by rfl) + (by rw [hv, q.getVert_length, hbv]) + omega + · have hindex := hq.getVert_injOn + (show j + 1 ≤ q.length by omega) + (show q.length ≤ q.length by rfl) + (by rw [hw, q.getVert_length, hbw]) + have hjlast : j = q.length - 1 := by omega + simpa [hjlast] using hj + have hgLast : exitPath.getVert (exitPath.length - 1) = Sum.inr g := + path_incident_end_last exitPath hexitPath hgExit hug + have exit_edge_color : ∀ e : E, Sum.inr e ∈ exitPath.support → + (rho1 e = some gammaN ∨ rho1 e = some deltaN) → + rho0 e = some gammaN ∨ rho0 e = some beta := by + exact @helper_exit_edge_color_254 V E inferInstance inferInstance inferInstance G k e0 Tn + TjPrime rho1 gammaN deltaN x hgammaDelta u exitPath hexitPath hexitIntersection beta + hbetaDelta hrho0Fixed hgammaBeta g hgRho1 path_incident_vertex_mem path_incident_end_last + hgLast + have exit_adj_rho0 : ∀ i : ℕ, i < exitPath.length → + H0.Adj (exitPath.getVert i) (exitPath.getVert (i + 1)) := by + exact @helper_exit_adj_rho0_292 V E inferInstance inferInstance G k e0 TjPrime rho1 gammaN + deltaN x u exitPath beta exit_edge_color + apply Set.Subset.antisymm + · intro y hy + obtain ⟨i, hi, hile⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hy + have htoStart : ∀ j : ℕ, j ≤ exitPath.length → + H0.connectedComponentMk (exitPath.getVert j) = + H0.connectedComponentMk (exitPath.getVert 0) := by + intro j hj + induction j with + | zero => rfl + | succ j ih => + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (exit_adj_rho0 j (by omega))).symm.trans (ih (by omega)) + change H0.connectedComponentMk y = H0.connectedComponentMk (Sum.inl u) + simpa only [hi, exitPath.getVert_length] using + (htoStart i hile).trans (htoStart exitPath.length le_rfl).symm + · exact @helper_branch_340 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSlot preterminalSlot terminalSupport Tj Tn seed TjPrime rho1 + gammaN deltaN x p hclosure hgammaDelta hpath hcomponent hxOutside u exitPath hexitPath + hexitLength hexitSupport huPrime beta hbeta hbetaDelta z hz hrho0Proper hrho0Fixed + hbetaRho0 g hug hgRho0 path_incident_end_last hgLast exit_adj_rho0 +private theorem helper_htreeEdgeFixed_958.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ _ : Fin ett.rounds) (Tj _ TjPrime : + TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) (x u : V) (_ : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (beta : Fin k) + (_ : Fin (Tj.length + (1 : ℕ))), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + ∀ (_ : ( + ∀ w ∈ TreeSequenceVertexSet TjPrime, w ≠ u → + ∀ (f : E), Incident G w f → mu0 f = rho1 f)) (a : Fin TjPrime.length), mu0 (TjPrime.edge a) = + rho1 (TjPrime.edge a) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot preterminalSlot Tj seed TjPrime rho1 + gammaN deltaN x u exitPath beta zPosition rho0 mu0 hmuRho1PrimeFixed a + obtain ⟨i, hi⟩ := TjPrime.attaches a + let earlier : Fin (TjPrime.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ a.isLt)) + have hlaterSet : TjPrime.vertex a.succ ∈ + TreeSequenceVertexSet TjPrime := by + simp [TreeSequenceVertexSet] + have hearlierSet : TjPrime.vertex earlier ∈ + TreeSequenceVertexSet TjPrime := by + simp [TreeSequenceVertexSet] + have hlaterInc : Incident G (TjPrime.vertex a.succ) + (TjPrime.edge a) := by + change TjPrime.vertex a.succ ∈ G.ends (TjPrime.edge a) + rw [hi] + simp + have hearlierInc : Incident G (TjPrime.vertex earlier) + (TjPrime.edge a) := by + change TjPrime.vertex earlier ∈ G.ends (TjPrime.edge a) + rw [hi] + simp [earlier] + have hverticesNe : TjPrime.vertex a.succ ≠ TjPrime.vertex earlier := by + apply TjPrime.vertex_injective.ne + intro heq + have hval := congrArg Fin.val heq + simp [earlier] at hval + omega + by_cases hlu : TjPrime.vertex a.succ = u + · exact hmuRho1PrimeFixed (TjPrime.vertex earlier) hearlierSet + (by intro heu; exact hverticesNe (hlu.trans heu.symm)) + (TjPrime.edge a) hearlierInc + · exact hmuRho1PrimeFixed (TjPrime.vertex a.succ) hlaterSet hlu + (TjPrime.edge a) hlaterInc + +private theorem helper_hE5_992.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (terminalSupport : V) (seed TjPrime : + TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (supportColors : Finset (Fin k)) + (gammaN deltaN : Fin k) (_ : ( + ∀ v ∈ (TreeSequenceVertexSet TjPrime).erase terminalSupport, MissingColors G rho1 v ∩ + supportColors = ∅)) (_ : MissingColors G rho1 terminalSupport ∩ supportColors = + { deltaN }) (_ : deltaN ∈ supportColors) (_ : terminalSupport ∈ TreeSequenceVertexSet + TjPrime) (u : V) (beta : Fin k) (_ : u ≠ terminalSupport) (_ : u ∈ (TreeSequenceVertexSet + TjPrime).erase terminalSupport) (_ : TreeMissingColors rho1 TjPrime ∩ supportColors = + { deltaN }) (_ : ( + ∀ (a : Fin TjPrime.length) (_ : seed.length ≤ (↑a : ℕ)), + ∀ c ∈ supportColors \ { deltaN }, rho1 (TjPrime.edge a) ≠ some c)), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + ∀ (_ : ( + ∀ w ∈ TreeSequenceVertexSet TjPrime, w ≠ u → MissingColors G mu0 w = MissingColors G rho1 w)) + (_ : ( + ∀ (a : Fin TjPrime.length), mu0 (TjPrime.edge a) = rho1 (TjPrime.edge a))), + (((TreeSequenceVertexSet TjPrime).erase u).biUnion fun (v : V) ↦ MissingColors G mu0 v) ∩ + supportColors = { deltaN } ∧ MissingColors G mu0 terminalSupport ∩ supportColors = + { deltaN } ∧ + ∀ (a : Fin TjPrime.length), seed.length ≤ (↑a : ℕ) → + ∀ c ∈ supportColors \ { deltaN }, mu0 (TjPrime.edge a) ≠ some c := by + classical + intro V E _ _ _ G k e0 terminalSupport seed TjPrime rho1 supportColors gammaN deltaN hcaseTwo + hterminalColors hdeltaSupport hterminalPrime u beta huTerminal huErase hprimeMissing + hprimeEdges rho0 mu0 hmissingPrime htreeEdgeFixed + let _ := Fintype.ofFinite V + constructor + · apply Finset.ext + intro c + constructor + · intro hc + obtain ⟨hcm, hcs⟩ := Finset.mem_inter.mp hc + obtain ⟨v, hvErase, hcMu⟩ := Finset.mem_biUnion.mp hcm + have hv := Finset.mem_of_mem_erase hvErase + have hvu := (Finset.mem_erase.mp hvErase).1 + have hcRho : c ∈ MissingColors G rho1 v := by + rw [← hmissingPrime v hv hvu] + exact hcMu + have hcTree : c ∈ TreeMissingColors rho1 TjPrime := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨v, hv, hcRho⟩ + have hcSingle : c ∈ ({deltaN} : Finset (Fin k)) := by + rw [← hprimeMissing] + exact Finset.mem_inter.mpr ⟨hcTree, hcs⟩ + exact hcSingle + · intro hc + have hcd : c = deltaN := by simpa using hc + subst c + have hdBoth : deltaN ∈ + TreeMissingColors rho1 TjPrime ∩ supportColors := by + rw [hprimeMissing] + simp + have hdTree := (Finset.mem_inter.mp hdBoth).1 + unfold TreeMissingColors at hdTree + obtain ⟨v, hv, hdv⟩ := Finset.mem_biUnion.mp hdTree + have hvu : v ≠ u := by + intro hvu + subst v + have hboth : deltaN ∈ MissingColors G rho1 u ∩ supportColors := + Finset.mem_inter.mpr ⟨hdv, hdeltaSupport⟩ + rw [hcaseTwo u huErase] at hboth + simp at hboth + apply Finset.mem_inter.mpr + refine ⟨Finset.mem_biUnion.mpr ⟨v, + Finset.mem_erase.mpr ⟨hvu, hv⟩, ?_⟩, hdeltaSupport⟩ + rw [hmissingPrime v hv hvu] + exact hdv + · constructor + · rw [hmissingPrime terminalSupport hterminalPrime (Ne.symm huTerminal)] + exact hterminalColors + · intro a ha c hc hbad + apply hprimeEdges a ha c hc + rw [← htreeEdgeFixed a] + exact hbad + +private theorem helper_hE4_1070.{u_1, u_2} : + helperHE41070Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSlot terminalSupport hterminalSupport + Tn TjPrime rho1 supportColors gammaN deltaN hb4 hsupportColors hdeltaEarlier hsupportOrder + u huOutside beta hbetaSupport z rho0 mu0 component_edge_avoids hmuRho0Fixed rho0_unaffected + s gammaS deltaS hs hgammaS hdeltaS + obtain ⟨hgammaSSupport, hdeltaSSupport⟩ := + hsupportColors s gammaS deltaS hs hgammaS hdeltaS + obtain ⟨hdeltaNGammaS, hdeltaNDeltaS⟩ := + hdeltaEarlier s gammaS deltaS hs hgammaS hdeltaS + have hgammaSBeta : gammaS ≠ beta := by + intro h + exact hbetaSupport (h ▸ hgammaSSupport) + have hdeltaSBeta : deltaS ≠ beta := by + intro h + exact hbetaSupport (h ▸ hdeltaSSupport) + have hgammaSDeltaN : gammaS ≠ deltaN := Ne.symm hdeltaNGammaS + have hdeltaSDeltaN : deltaS ≠ deltaN := Ne.symm hdeltaNDeltaS + obtain ⟨hgammaSDeltaS, hkind, hchosen, epsilon, hsepsilon, + hepsilonKind, hbetweenKinds, hstrong⟩ := + hb4 s gammaS deltaS hs hgammaS hdeltaS + refine ⟨hgammaSDeltaS, hkind, hchosen, epsilon, hsepsilon, + hepsilonKind, hbetweenKinds, ?_⟩ + intro v hvTree hvTerminal + obtain ⟨hcycleRho1, hterminalAvoid, hepsilonContain⟩ := + hstrong v hvTree hvTerminal + let H1 := TwoColorIncidenceGraph G rho1 gammaS deltaS + let HM := TwoColorIncidenceGraph G mu0 gammaS deltaS + let C1 := TwoColorComponent G rho1 gammaS deltaS (Sum.inl v) + let CM := TwoColorComponent G mu0 gammaS deltaS (Sum.inl v) + have hverticesTn : ∀ w : V, Sum.inl w ∈ C1 → + w ∈ TreeSequenceVertexSet Tn := by + intro w hw + exact hsupportOrder s gammaS deltaS hs hgammaS hdeltaS + v hvTree hvTerminal w hw + have hedgeAvoidsK : ∀ e : E, Sum.inr e ∈ C1 → + Sum.inr e ∉ TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + intro e heC heK + have heSupport : Sum.inr e ∈ H1.support := by + apply SimpleGraph.mem_support_of_reachable + (G := H1) (u := Sum.inr e) (v := Sum.inl v) + · simp + · exact SimpleGraph.ConnectedComponent.eq.mp heC + obtain ⟨y, hy⟩ := H1.mem_support.mp heSupport + cases y with + | inl w => + have hwC : Sum.inl w ∈ C1 := by + change H1.connectedComponentMk (Sum.inl w) = + H1.connectedComponentMk (Sum.inl v) + change H1.connectedComponentMk (Sum.inr e) = + H1.connectedComponentMk (Sum.inl v) at heC + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hy).symm.trans heC + have hwTn := hverticesTn w hwC + exact component_edge_avoids w + (Finset.mem_union.mpr (Or.inl hwTn)) + (by intro hwu; subst w; exact huOutside hwTn) e hy.1 heK + | inr f => simp [H1, TwoColorIncidenceGraph] at hy + have hadjIff : ∀ {a b : Sum V E}, a ∈ C1 → + (HM.Adj a b ↔ H1.Adj a b) := by + intro a b haC + cases a with + | inl w => + cases b with + | inl z => simp [HM, H1, TwoColorIncidenceGraph] + | inr e => + have hwTn := hverticesTn w haC + simp only [HM, H1, TwoColorIncidenceGraph] + constructor + · rintro ⟨hwe, hec⟩ + have hfixed := hmuRho0Fixed w + (Finset.mem_union.mpr (Or.inl hwTn)) + (by intro hwu; subst w; exact huOutside hwTn) e hwe + rw [hfixed] at hec + rcases hec with hec | hec + · exact ⟨hwe, Or.inl + ((rho0_unaffected gammaS hgammaSBeta hgammaSDeltaN e).mp hec)⟩ + · exact ⟨hwe, Or.inr + ((rho0_unaffected deltaS hdeltaSBeta hdeltaSDeltaN e).mp hec)⟩ + · rintro ⟨hwe, hec⟩ + have hfixed := hmuRho0Fixed w + (Finset.mem_union.mpr (Or.inl hwTn)) + (by intro hwu; subst w; exact huOutside hwTn) e hwe + rw [hfixed] + rcases hec with hec | hec + · exact ⟨hwe, Or.inl + ((rho0_unaffected gammaS hgammaSBeta hgammaSDeltaN e).mpr hec)⟩ + · exact ⟨hwe, Or.inr + ((rho0_unaffected deltaS hdeltaSBeta hdeltaSDeltaN e).mpr hec)⟩ + | inr e => + cases b with + | inl w => + have heK := hedgeAvoidsK e haC + have hfixed : mu0 e = rho0 e := by + simp [mu0, TwoColorComponentSwap, heK] + simp only [HM, H1, TwoColorIncidenceGraph] + constructor + · rintro ⟨hwe, hec⟩ + rw [hfixed] at hec + rcases hec with hec | hec + · exact ⟨hwe, Or.inl + ((rho0_unaffected gammaS hgammaSBeta hgammaSDeltaN e).mp hec)⟩ + · exact ⟨hwe, Or.inr + ((rho0_unaffected deltaS hdeltaSBeta hdeltaSDeltaN e).mp hec)⟩ + · rintro ⟨hwe, hec⟩ + rw [hfixed] + rcases hec with hec | hec + · exact ⟨hwe, Or.inl + ((rho0_unaffected gammaS hgammaSBeta hgammaSDeltaN e).mpr hec)⟩ + · exact ⟨hwe, Or.inr + ((rho0_unaffected deltaS hdeltaSBeta hdeltaSDeltaN e).mpr hec)⟩ + | inr f => simp [HM, H1, TwoColorIncidenceGraph] + have hcomponentEq : CM = C1 := by + ext y + constructor + · intro hy + have hreach : HM.Reachable (Sum.inl v) y := by + apply SimpleGraph.ConnectedComponent.exact + change HM.connectedComponentMk y = HM.connectedComponentMk (Sum.inl v) + at hy + exact hy.symm + rw [SimpleGraph.reachable_iff_reflTransGen] at hreach + clear hy + have hyC1 : y ∈ C1 := by + induction hreach with + | refl => rfl + | tail hreach hlast ih => + have hlast1 : H1.Adj _ _ := (hadjIff ih).mp hlast + change H1.connectedComponentMk _ = + H1.connectedComponentMk (Sum.inl v) + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hlast1).symm.trans ih + exact hyC1 + · intro hy + have hreach : H1.Reachable (Sum.inl v) y := by + apply SimpleGraph.ConnectedComponent.exact + change H1.connectedComponentMk y = H1.connectedComponentMk (Sum.inl v) + at hy + exact hy.symm + rw [SimpleGraph.reachable_iff_reflTransGen] at hreach + clear hy + have hpair : y ∈ C1 ∧ y ∈ CM := by + induction hreach with + | refl => exact ⟨rfl, rfl⟩ + | tail hreach hlast ih => + have hnextC1 := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hlast).symm.trans ih.1 + have hlastM : HM.Adj _ _ := (hadjIff ih.1).mpr hlast + have hnextCM := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hlastM).symm.trans ih.2 + exact ⟨hnextC1, hnextCM⟩ + exact hpair.2 + unfold TwoColorComponentCycle at hcycleRho1 ⊢ + obtain ⟨cycle, hcycleSupport⟩ := hcycleRho1 + have hedgeTransfer : ∀ ed ∈ cycle.walk.edges, ed ∈ HM.edgeSet := by + intro ed hed + induction ed using Sym2.inductionOn with + | _ a b => + have hab1 : H1.Adj a b := cycle.walk.adj_of_mem_edges hed + have haSupport : a ∈ cycle.walk.support := + cycle.walk.fst_mem_support_of_mem_edges hed + have haC : a ∈ C1 := (hcycleSupport a).mp haSupport + exact (hadjIff haC).mpr hab1 + let walkM := cycle.walk.transfer HM hedgeTransfer + let cycleM : TwoColorCycle G mu0 gammaS deltaS := + { base := cycle.base + walk := walkM + isCycle := cycle.isCycle.transfer hedgeTransfer } + refine ⟨⟨cycleM, ?_⟩, ?_, ?_⟩ + · intro y + change y ∈ walkM.support ↔ y ∈ CM + rw [SimpleGraph.Walk.support_transfer, hcomponentEq] + exact hcycleSupport y + · intro hterminalM + apply hterminalAvoid + change Sum.inl terminalSupport ∈ C1 + rw [← hcomponentEq] + exact hterminalM + · intro w hwM + apply hepsilonContain w + change Sum.inl w ∈ C1 + rw [← hcomponentEq] + exact hwM + +private theorem helper_component_edge_avoids_1276.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn TjPrime : TreeSequence G e0) (rho1 : + PartialEdgeColoring E k) (gammaN deltaN : Fin k) (u : V) (beta : Fin k), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (_ : ( + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, Sum.inl w ∈ TwoColorComponent + G rho0 gammaN beta (Sum.inl u) ↔ w = u)), + ∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, w ≠ u → + ∀ (f : E), Incident G w f → Sum.inr f ∉ TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + classical + intro V E _ _ _ G k e0 Tn TjPrime rho1 gammaN deltaN u beta rho0 hcomponentIntersection w hw hwu f + hwf hf + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + let H := TwoColorIncidenceGraph G rho0 gammaN beta + have hfSupport : Sum.inr f ∈ H.support := by + apply SimpleGraph.mem_support_of_reachable + (G := H) (u := Sum.inr f) (v := Sum.inl u) + · simp + · exact SimpleGraph.ConnectedComponent.eq.mp hf + obtain ⟨y, hy⟩ := H.mem_support.mp hfSupport + have hfColor : rho0 f = some gammaN ∨ rho0 f = some beta := by + cases y with + | inl y => exact hy.2 + | inr y => simp [H, TwoColorIncidenceGraph] at hy + have hadj : H.Adj (Sum.inl w) (Sum.inr f) := by + simpa [H, TwoColorIncidenceGraph] using And.intro hwf hfColor + have hwComponent : + Sum.inl w ∈ TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + change H.connectedComponentMk (Sum.inl w) = + H.connectedComponentMk (Sum.inl u) + change H.connectedComponentMk (Sum.inr f) = + H.connectedComponentMk (Sum.inl u) at hf + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hf + exact hwu ((hcomponentIntersection w hw).mp hwComponent) + +private theorem helper_before_seed_1330.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ _ : Fin ett.rounds) (terminalSupport : + V) (Tj seed : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : Fin k) + (x : V), TreeSequenceInitialSegment seed Tj → seed.vertex (Fin.last seed.length) = + terminalSupport → + ∀ (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet Tj) (u : V) (_ : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin + (Tj.length + (1 : ℕ))), + ∀ w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj, w ∈ TreeSequenceVertexSet seed := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSlot preterminalSlot terminalSupport Tj + seed rho1 gammaN deltaN x hseedJ hseedTerminal hterminalTj u exitPath zPosition w hw + unfold TreeVerticesBefore at hw + obtain ⟨hwJ, i, j, hiw, hjt, hij⟩ := Finset.mem_filter.mp hw + obtain ⟨hlen, hvertices, hedges⟩ := hseedJ + have hjLast : j = Fin.castLE (Nat.succ_le_succ hlen) + (Fin.last seed.length) := by + apply Tj.vertex_injective + rw [hjt, hvertices, hseedTerminal] + have hiBound : i.val < seed.length + 1 := by + have hjVal : j.val = seed.length := by + simpa using congrArg Fin.val hjLast + rw [hjVal] at hij + omega + let iSeed : Fin (seed.length + 1) := ⟨i.val, hiBound⟩ + have hiCast : Fin.castLE (Nat.succ_le_succ hlen) iSeed = i := by + apply Fin.ext + rfl + simp only [TreeSequenceVertexSet, Finset.mem_image] + refine ⟨iSeed, Finset.mem_univ _, ?_⟩ + rw [← hvertices iSeed, hiCast] + exact hiw + +private theorem helper_rho0_unaffected_1392.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) + (deltaN beta : Fin k), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (c : Fin k) (_ : c ≠ beta) (_ : c ≠ deltaN) (f : E), + rho0 f = some c ↔ rho1 f = some c := by + classical + intro V E _ _ G k e0 TjPrime rho1 deltaN beta rho0 c hcb hcd f + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + unfold rho0 OutsideTreeColorSwap + by_cases ht : TreeIncidentEdge TjPrime f + · simp [ht] + · simp only [ite_eq_right ht] + by_cases hfb : rho1 f = some beta + · rw [ite_eq_left hfb] + constructor + · intro h + exact False.elim (hcd (Option.some.inj h).symm) + · intro h + exact False.elim (hcb (Option.some.inj (h.symm.trans hfb))) + · rw [ite_eq_right hfb] + by_cases hfd : rho1 f = some deltaN + · rw [ite_eq_left hfd] + constructor + · intro h + exact False.elim (hcb (Option.some.inj h).symm) + · intro h + exact False.elim (hcd (Option.some.inj (h.symm.trans hfd))) + · rw [ite_eq_right hfd] + +private theorem helper_initial_trans_1331.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B + C → TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + obtain ⟨hABlen, hABvertices, hABedges⟩ := hAB + obtain ⟨hBClen, hBCvertices, hBCedges⟩ := hBC + refine ⟨hABlen.trans hBClen, ?_, ?_⟩ + · intro i + calc + C.vertex (Fin.castLE (Nat.succ_le_succ (hABlen.trans hBClen)) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hBClen) + (Fin.castLE (Nat.succ_le_succ hABlen) i)) := by + congr 1 + _ = B.vertex (Fin.castLE (Nat.succ_le_succ hABlen) i) := + hBCvertices _ + _ = A.vertex i := hABvertices i + · intro i + calc + C.edge (Fin.castLE (hABlen.trans hBClen) i) = + C.edge (Fin.castLE hBClen (Fin.castLE hABlen i)) := by + congr 1 + _ = B.edge (Fin.castLE hABlen i) := hBCedges _ + _ = A.edge i := hABedges i + +private theorem helper_hmu0One_1442.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) (gammaN deltaN : + Fin k) (u : V) (beta : Fin k) (_ : beta ≠ gammaN), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + ∀ (_ : IsOneEdgeUncolored rho0 e0), IsOneEdgeUncolored mu0 e0 := by + classical + intro V E _ _ G k e0 TjPrime rho1 gammaN deltaN u beta hbetaGamma rho0 mu0 hrho0One + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + unfold IsOneEdgeUncolored at hrho0One ⊢ + constructor + · simp [mu0, TwoColorComponentSwap, hrho0One.1] + · intro f hfe + obtain ⟨c, hc⟩ := hrho0One.2 f hfe + have hne : mu0 f ≠ none := by + by_cases hK : Sum.inr f ∈ + TwoColorComponent G rho0 gammaN beta (Sum.inl u) + · by_cases hcg : c = gammaN + · simp [mu0, TwoColorComponentSwap, hK, hc, hcg] + · by_cases hcb : c = beta + · simp [mu0, TwoColorComponentSwap, hK, hc, hcb, + hbetaGamma] + · simp [mu0, TwoColorComponentSwap, hK, hc, hcg, hcb] + · simp [mu0, TwoColorComponentSwap, hK, hc] + obtain ⟨d, hd⟩ := Option.ne_none_iff_exists.mp hne + exact ⟨d, hd.symm⟩ + +private theorem helper_missing_eq_of_incident_eq_1524.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) + (gammaN deltaN : Fin k) (u : V) (beta : Fin k), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let mu0 : PartialEdgeColoring E k := + TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + ∀ (w : V) (_ : (∀ (f : E) (_ : Incident G w f), mu0 f = rho1 f)), + MissingColors G mu0 w = MissingColors G rho1 w := by + classical + intro V E _ _ G k e0 TjPrime rho1 gammaN deltaN u beta rho0 mu0 w hfixed + let _ := Fintype.ofFinite V + apply Finset.ext + intro c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + constructor + · intro hnew hold + obtain ⟨f, hwf, hfc⟩ := hold + exact hnew ⟨f, hwf, (hfixed f hwf).trans hfc⟩ + · intro hold hnew + obtain ⟨f, hwf, hfc⟩ := hnew + exact hold ⟨f, hwf, (hfixed f hwf).symm.trans hfc⟩ + +private theorem helper_hE1_1548.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (terminalSupport : V) (Tj seed TjPrime : TreeSequence G e0) (phiJ rho1 : + PartialEdgeColoring E k) (Dprev : Finset (Fin k)) (gammaN deltaN : Fin k) (hterminalTj : + terminalSupport ∈ TreeSequenceVertexSet Tj) (_ : StableColoringBeforeVertex Tj + terminalSupport hterminalTj Dprev phiJ rho1) (u : V) (beta : Fin k) (_ : u ∉ + TreeSequenceVertexSet seed), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + let mu0 : PartialEdgeColoring E k := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u); + ∀ (_ : ( + ∀ w ∈ TreeSequenceVertexSet TjPrime, w ≠ u → + ∀ (f : E), Incident G w f → mu0 f = rho1 f)) (_ : ( + ∀ (w : V) (_ : ( + ∀ (f : E) (_ : Incident G w f), mu0 f = rho1 f)), MissingColors G mu0 w = MissingColors G rho1 + w)) (_ : ( + ∀ w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj, w ∈ TreeSequenceVertexSet seed)) (_ : + ( + ∀ w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj, w ∈ TreeSequenceVertexSet TjPrime)), + StableColoringBeforeVertex Tj terminalSupport hterminalTj Dprev phiJ mu0 := by + classical + intro V E _ _ G k e0 terminalSupport Tj seed TjPrime phiJ rho1 Dprev gammaN deltaN hterminalTj hb1 + u beta huSeed rho0 mu0 hmuRho1PrimeFixed missing_eq_of_incident_eq before_seed before_prime + let _ := Fintype.ofFinite V + unfold StableColoringBeforeVertex at hb1 ⊢ + have before_ne : ∀ w : V, + w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj → w ≠ u := by + intro w hw hwu + subst w + exact huSeed (before_seed u hw) + constructor + · intro f hf hcolor + obtain ⟨w, hw, hwf⟩ := hf + rw [hmuRho1PrimeFixed w (before_prime w hw) (before_ne w hw) f hwf] + exact hb1.1 f ⟨w, hw, hwf⟩ hcolor + · intro w hw + exact (missing_eq_of_incident_eq w + (hmuRho1PrimeFixed w (before_prime w hw) (before_ne w hw))).trans + (hb1.2 w hw) + +private theorem helper_continuation_1644.{u_1, u_2} : + helperContinuation1644Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett terminalSlot preterminalSlot _ _ + terminalSupport hterminalSupport Tj Tn seed TjPrime phiJ rho1 Dprev supportColors gammaN + deltaN x p hTjN hseedJ hseedPrime hseedTerminal hterminalTj hclosure hprimeElementary + hcaseTwo hterminalColors hdeltaSupport hgammaDelta hdeltaMissing hpath hcomponent hxOutside + hb1 hb2Missing haugmentation hb2Edges hdeltaPhiJ _ _ _ hgammaIdentity _ _ hb4 + hsupportColors hdeltaEarlier hsupportOrder initial_subset hterminalPrime u exitPath + hexitPath hexitLength hexitSupport hexitIntersection hexitBoundary huPrime huOutside beta + hbeta huTerminal huErase hbetaSupport hbetaDelta hbetaGamma huSeed z hz zPosition + hzPosition hzAfter hzBefore hzEdges hprimeMissing hprimeEdges rho0 mu0 hrho0Proper hrho0One + hrho0Stable hrho0Fixed hgammaBeta + have hmu0Proper : IsProperEdgeColoring G mu0 := + TwoColorComponentSwapProper G rho0 gammaN beta hgammaBeta + hrho0Proper (Sum.inl u) + have hmu0One : IsOneEdgeUncolored mu0 e0 := by + exact @helper_hmu0One_1442 V E inferInstance inferInstance G k e0 TjPrime rho1 gammaN deltaN + u beta hbetaGamma hrho0One + have hbetaRho0 : beta ∈ MissingColors G rho0 u := by + rw [hrho0Stable.2 u huPrime] + exact hbeta + obtain ⟨g, hgBoundary, hug, hgExit⟩ := hexitBoundary + have hgRho1 : rho1 g = some gammaN := + (Finset.mem_filter.mp hgBoundary).2 + have hgRho0 : rho0 g = some gammaN := by + rw [hrho0Fixed g ⟨u, huPrime, hug⟩] + exact hgRho1 + have hgComponent : Sum.inr g ∈ + TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + change (TwoColorIncidenceGraph G rho0 gammaN beta).connectedComponentMk + (Sum.inr g) = + (TwoColorIncidenceGraph G rho0 gammaN beta).connectedComponentMk + (Sum.inl u) + have hadj : (TwoColorIncidenceGraph G rho0 gammaN beta).Adj + (Sum.inl u) (Sum.inr g) := ⟨hug, Or.inl hgRho0⟩ + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).symm + have hgMu0 : mu0 g = some beta := by + simp [mu0, TwoColorComponentSwap, hgComponent, hgRho0] + have hbetaMu0 : beta ∉ MissingColors G mu0 u := by + intro hb + have hbPresent : beta ∉ PresentColors G mu0 u := by + simpa [MissingColors] using hb + apply hbPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨g, hug, hgMu0⟩ + have hgammaMu0 : gammaN ∈ MissingColors G mu0 u := by + exact @helper_hgammaMu0_408 V E inferInstance inferInstance G k e0 TjPrime rho1 gammaN deltaN + u beta hbetaGamma hgammaBeta hbetaRho0 + have hE3 : + ett.series.data.delta preterminalSlot.succ = some gammaN ∧ + gammaN ∈ MissingColors G mu0 u ∧ + beta ∉ MissingColors G mu0 u := + ⟨hgammaIdentity, hgammaMu0, hbetaMu0⟩ + have hcomponentExit : + {y : Sum V E | y ∈ exitPath.support} = + TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + exact @helper_hcomponentExit_447 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T generating ett terminalSlot preterminalSlot (by assumption) (by + assumption) terminalSupport hterminalSupport Tj Tn seed TjPrime rho1 supportColors gammaN + deltaN x p hclosure hgammaDelta hpath hcomponent hxOutside (by assumption) (by + assumption) (by assumption) (by assumption) (by assumption) u exitPath hexitPath + hexitLength hexitSupport hexitIntersection huPrime beta hbeta hbetaDelta z hz zPosition + hrho0Proper hrho0Fixed hgammaBeta hbetaRho0 g hug hgExit hgRho1 hgRho0 + have hcomponentIntersection : + ∀ w : V, w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → (Sum.inl w ∈ + TwoColorComponent G rho0 gammaN beta (Sum.inl u) ↔ w = u) := by + intro w hw + rw [← hcomponentExit] + exact hexitIntersection w hw + have component_edge_avoids : + ∀ (w : V), w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → w ≠ u → + ∀ f : E, Incident G w f → Sum.inr f ∉ TwoColorComponent G rho0 gammaN beta (Sum.inl u) := by + exact @helper_component_edge_avoids_1276 V E inferInstance inferInstance inferInstance G k e0 + Tn TjPrime rho1 gammaN deltaN u beta hcomponentIntersection + have hmuRho0Fixed : ∀ (w : V), + w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → + w ≠ u → ∀ f : E, Incident G w f → mu0 f = rho0 f := by + intro w hw hwu f hwf + have hf := component_edge_avoids w hw hwu f hwf + simp [mu0, TwoColorComponentSwap, hf] + have hmuRho1PrimeFixed : ∀ (w : V), + w ∈ TreeSequenceVertexSet TjPrime → w ≠ u → + ∀ f : E, Incident G w f → mu0 f = rho1 f := by + intro w hw hwu f hwf + rw [hmuRho0Fixed w (Finset.mem_union.mpr (Or.inr hw)) hwu f hwf] + exact hrho0Fixed f ⟨w, hw, hwf⟩ + have missing_eq_of_incident_eq : ∀ (w : V), + (∀ f : E, Incident G w f → mu0 f = rho1 f) → + MissingColors G mu0 w = MissingColors G rho1 w := by + exact @helper_missing_eq_of_incident_eq_1524 V E inferInstance inferInstance G k e0 TjPrime + rho1 gammaN deltaN u beta + have before_seed : ∀ w : V, + w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj → + w ∈ TreeSequenceVertexSet seed := by + exact @helper_before_seed_1330 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSlot preterminalSlot terminalSupport Tj seed rho1 gammaN deltaN x + hseedJ hseedTerminal hterminalTj u exitPath zPosition + have before_prime : ∀ w : V, + w ∈ TreeVerticesBefore Tj terminalSupport hterminalTj → + w ∈ TreeSequenceVertexSet TjPrime := by + intro w hw + exact initial_subset hseedPrime (before_seed w hw) + have hE1 : StableColoringBeforeVertex Tj terminalSupport hterminalTj + Dprev phiJ mu0 := by + exact @helper_hE1_1548 V E inferInstance inferInstance G k e0 terminalSupport Tj seed TjPrime + phiJ rho1 Dprev gammaN deltaN hterminalTj hb1 u beta huSeed hmuRho1PrimeFixed + missing_eq_of_incident_eq before_seed before_prime + have hmissingPrime : ∀ w : V, + w ∈ TreeSequenceVertexSet TjPrime → w ≠ u → + MissingColors G mu0 w = MissingColors G rho1 w := by + intro w hw hwu + exact missing_eq_of_incident_eq w (hmuRho1PrimeFixed w hw hwu) + have htreeEdgeFixed : ∀ a : Fin TjPrime.length, + mu0 (TjPrime.edge a) = rho1 (TjPrime.edge a) := by + exact @helper_htreeEdgeFixed_958 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSlot preterminalSlot Tj seed TjPrime rho1 gammaN deltaN x u + exitPath beta zPosition hmuRho1PrimeFixed + have hE5 : + ((TreeSequenceVertexSet TjPrime).erase u).biUnion + (fun v => MissingColors G mu0 v) ∩ supportColors = {deltaN} ∧ + MissingColors G mu0 terminalSupport ∩ supportColors = {deltaN} ∧ + ∀ a : Fin TjPrime.length, seed.length ≤ a.val → + ∀ c : Fin k, c ∈ supportColors \ {deltaN} → + mu0 (TjPrime.edge a) ≠ some c := by + exact @helper_hE5_992 V E inferInstance inferInstance inferInstance G k e0 terminalSupport + seed TjPrime rho1 supportColors gammaN deltaN hcaseTwo hterminalColors hdeltaSupport + hterminalPrime u beta huTerminal huErase hprimeMissing hprimeEdges hmissingPrime + htreeEdgeFixed + have rho0_unaffected : ∀ (c : Fin k), c ≠ beta → c ≠ deltaN → + ∀ f : E, (rho0 f = some c ↔ rho1 f = some c) := by + exact @helper_rho0_unaffected_1392 V E inferInstance inferInstance G k e0 TjPrime rho1 deltaN + beta + have hE4 : + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS := by + exact @helper_hE4_1070 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSlot terminalSupport hterminalSupport Tn TjPrime rho1 + supportColors gammaN deltaN hb4 hsupportColors hdeltaEarlier hsupportOrder u huOutside + beta hbetaSupport z component_edge_avoids hmuRho0Fixed rho0_unaffected + have hE2 := P2966_T1_OutsideSwapPrefixEffects Tn Tj seed TjPrime + phiJ rho1 rho0 mu0 deltaN beta terminalSupport u z zPosition + hTjN hterminalPrime hclosure.2 hprimeElementary hbetaDelta hbeta + hdeltaMissing hb2Missing haugmentation hb2Edges hdeltaPhiJ hz + hzPosition hzAfter huPrime huOutside hzBefore hzEdges rfl hrho0Fixed hmuRho0Fixed + hmissingPrime htreeEdgeFixed rho0_unaffected + exact ⟨hmu0Proper, hmu0One, hE1, hE2, hE3, hE4, hE5⟩ + +theorem ExtensionBaseClaim46 {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSlot preterminalSlot : Fin ett.rounds) + (_ : terminalSlot.val + 1 = ett.rounds) + (_ : preterminalSlot.val < terminalSlot.val) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (Tj Tn seed TjPrime : TreeSequence G e0) + (phiJ phiN sigmaN rho1 : PartialEdgeColoring E k) + (Dprev controlled restorationColors supportColors : Finset (Fin k)) + (gammaFirst gammaN deltaN : Fin k) (fN : E) (x : V) + (p : (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk + (Sum.inl terminalSupport) (Sum.inl x)) + (hphiNProper : IsProperEdgeColoring G phiN) + (hphiNOne : IsOneEdgeUncolored phiN e0) + (hsigmaProper : IsProperEdgeColoring G sigmaN) + (hsigmaOne : IsOneEdgeUncolored sigmaN e0) + (hrhoProper : IsProperEdgeColoring G rho1) + (hrhoOne : IsOneEdgeUncolored rho1 e0) + (hTjN : TreeSequenceInitialSegment Tj Tn) + (hseedJ : TreeSequenceInitialSegment seed Tj) + (hseedPrime : TreeSequenceInitialSegment seed TjPrime) + (hseedTerminal : seed.vertex (Fin.last seed.length) = terminalSupport) + (hterminalTj : terminalSupport ∈ TreeSequenceVertexSet Tj) + (hterminalSeed : terminalSupport ∈ TreeSequenceVertexSet seed) + (hclosure : TashkinovClosure rho1 seed TjPrime) + (hprimeElementary : ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime)) + (hcaseTwo : ∀ v : V, + v ∈ (TreeSequenceVertexSet TjPrime).erase terminalSupport → + MissingColors G rho1 v ∩ supportColors = ∅) + (hterminalColors : + MissingColors G rho1 terminalSupport ∩ supportColors = {deltaN}) + (hgammaSupport : gammaN ∈ supportColors) + (hdeltaSupport : deltaN ∈ supportColors) + (hgammaFirstSupport : gammaFirst ∈ supportColors) + (hgammaDelta : gammaN ≠ deltaN) + (hsigmaStable : StableColoring Tn controlled phiN sigmaN) + (hgammaControlled : gammaN ∈ controlled) + (hdeltaControlled : deltaN ∈ controlled) + (hb3 : ∀ f : E, rho1 f ≠ sigmaN f → + f ∉ InternalEdges G (TreeSequenceVertexSet Tj) ∧ + ∃ c d : Fin k, sigmaN f = some c ∧ rho1 f = some d ∧ + c ∈ restorationColors ∧ d ∈ restorationColors) + (hgammaRestored : gammaN ∉ restorationColors) + (hdeltaRestored : deltaN ∉ restorationColors) + (hgammaBoundary : + BoundaryColorEdges G phiN (TreeSequenceVertexSet Tn) gammaN = {fN}) + (hdeltaLocation : ∀ f ∈ BoundaryColorEdges G phiN + (TreeSequenceVertexSet Tn) deltaN, + ∃ w ∈ TreeSequenceVertexSet seed, Incident G w f) + (hdeltaMissing : deltaN ∈ MissingColors G rho1 terminalSupport) + (hpath : p.IsPath) + (hcomponent : {y : Sum V E | y ∈ p.support} = + TwoColorComponent G rho1 gammaN deltaN (Sum.inl terminalSupport)) + (hxOutside : x ∉ + TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) + (htwoN : ∃ w ∈ TreeSequenceVertexSet Tn, + w ≠ terminalSupport ∧ Sum.inl w ∈ p.support) + (hfNterminal : Incident G terminalSupport fN) + (hb1 : StableColoringBeforeVertex Tj terminalSupport hterminalTj + Dprev phiJ rho1) + (hb2Missing : ∀ v : V, + v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport → + MissingColors G rho1 v = MissingColors G phiJ v) + (hterminalInclusion : MissingColors G phiJ terminalSupport ⊆ + MissingColors G rho1 terminalSupport ∪ {gammaFirst}) + (haugmentation : TashkinovAugmentationSequence phiJ seed Tj) + (hb2Edges : ∀ a : Fin Tj.length, seed.length ≤ a.val → + rho1 (Tj.edge a) = phiJ (Tj.edge a)) + (hdeltaPhiJ : deltaN ∉ TreeMissingColors phiJ Tj) + (_ : supportColors = + (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).biUnion + (fun s => ett.series.data.stored s.succ)) + (_ : terminalSlot ∈ ExtensionBaseSupportClass ett + terminalSupport hterminalSupport terminalSupport) + (_ : preterminalSlot ∈ + (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot) + (hgammaIdentity : ett.series.data.delta preterminalSlot.succ = some gammaN) + (_ : ett.series.data.gamma terminalSlot.succ = some gammaN) + (_ : ett.series.data.delta terminalSlot.succ = some deltaN) + (hb4 : ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport rho1 gammaS deltaS) + (hsupportColors : ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + gammaS ∈ supportColors ∧ deltaS ∈ supportColors) + (hdeltaEarlier : ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + deltaN ≠ gammaS ∧ deltaN ≠ deltaS) + (hsupportOrder : ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport terminalSupport).erase terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ∀ v : V, + v ∈ TreeSequenceVertexSet + (ett.series.data.tree s.succ.castSucc) → + v ≠ terminalSupport → + ∀ w : V, Sum.inl w ∈ + TwoColorComponent G rho1 gammaS deltaS (Sum.inl v) → + w ∈ TreeSequenceVertexSet Tn) : + ∃ (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (_ : + u ∉ TreeSequenceVertexSet Tn) (exitPath : + (TwoColorIncidenceGraph G rho1 gammaN deltaN).Walk (Sum.inl x) (Sum.inl u)), + exitPath.IsPath ∧ + 2 ≤ exitPath.length ∧ + (∀ y : Sum V E, y ∈ exitPath.support → y ∈ p.support) ∧ + (∀ w : V, + w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → + (Sum.inl w ∈ exitPath.support ↔ w = u)) ∧ + (∃ + g ∈ + BoundaryColorEdges G rho1 (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime) + gammaN, + Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬Incident G u fN ∧ + ∀ beta : Fin k, + beta ∈ MissingColors G rho1 u → + ∃ (z : V) (hz : z ∈ TreeSequenceVertexSet Tj) (zPosition : Fin (Tj.length + 1)), + Tj.vertex zPosition = z ∧ + seed.length ≤ zPosition.val ∧ + ((seed.length < zPosition.val ∧ + beta ∈ MissingColors G rho1 z ∧ + ∀ r : Fin (Tj.length + 1), + seed.length < r.val → + r.val < zPosition.val → beta ∉ MissingColors G rho1 (Tj.vertex r)) ∨ + (zPosition = Fin.last Tj.length ∧ + ∀ r : Fin (Tj.length + 1), + seed.length < r.val → beta ∉ MissingColors G rho1 (Tj.vertex r))) ∧ + (∀ w ∈ TreeVerticesBefore Tj z hz, beta ∉ MissingColors G rho1 w) ∧ + (∀ a : Fin Tj.length, + seed.length ≤ a.val → a.val < zPosition.val → rho1 (Tj.edge a) ≠ some beta) ∧ + let rho0 := OutsideTreeColorSwap TjPrime rho1 beta deltaN + let mu0 := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + IsProperEdgeColoring G mu0 ∧ + IsOneEdgeUncolored mu0 e0 ∧ + StableColoringBeforeVertex Tj terminalSupport hterminalTj Dprev phiJ mu0 ∧ + ((∀ v : V, + v ∈ + (((TreeVerticesBefore Tj z hz ∪ { z }) ∪ + (TreeVerticesBefore TjPrime u huPrime ∪ { u })).erase + u).erase + z → + MissingColors G mu0 v = MissingColors G rho1 v) ∧ + (∀ f : E, + ((∃ a : Fin Tj.length, + seed.length ≤ a.val ∧ a.val < zPosition.val ∧ Tj.edge a = f) ∨ + (∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + 1)), + TjPrime.vertex uPosition = u ∧ + a.val < uPosition.val ∧ TjPrime.edge a = f)) → + mu0 f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → deltaN ∈ MissingColors G mu0 z) ∧ + (z ∈ TreeVerticesBefore TjPrime u huPrime → + MissingColors G mu0 z = MissingColors G rho1 z)) ∧ + (ett.series.data.delta preterminalSlot.succ = some gammaN ∧ + gammaN ∈ MissingColors G mu0 u ∧ beta ∉ MissingColors G mu0 u) ∧ + (∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), + s ∈ + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport).erase + terminalSlot → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s terminalSupport mu0 gammaS deltaS) ∧ + ((TreeSequenceVertexSet TjPrime).erase u).biUnion (fun v => MissingColors G mu0 v) ∩ + supportColors = + { deltaN } ∧ + MissingColors G mu0 terminalSupport ∩ supportColors = { deltaN } ∧ + ∀ a : Fin TjPrime.length, + seed.length ≤ a.val → + ∀ c : Fin k, + c ∈ supportColors \ { deltaN } → + mu0 (TjPrime.edge a) ≠ some c := by + classical + have initial_subset {A B : TreeSequence G e0} + (h : TreeSequenceInitialSegment A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + obtain ⟨i, hi, hvi⟩ := hv + obtain ⟨hlen, hvertices, hedges⟩ := h + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, + (hvertices i).trans hvi⟩ + have initial_trans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + exact @helper_initial_trans_1331 V E G e0 A B C hAB hBC + have hseedN : TreeSequenceInitialSegment seed Tn := + initial_trans hseedJ hTjN + have hterminalN : terminalSupport ∈ TreeSequenceVertexSet Tn := + initial_subset hTjN hterminalTj + have hterminalPrime : terminalSupport ∈ TreeSequenceVertexSet TjPrime := + initial_subset hseedPrime hterminalSeed + have hboundaryFacts := ExtensionBaseCaseTwoObservation20 + Tn seed TjPrime phiN sigmaN rho1 controlled restorationColors + gammaN deltaN fN terminalSupport hphiNProper hphiNOne + hsigmaProper hsigmaOne hrhoProper hrhoOne hsigmaStable + hgammaControlled hdeltaControlled + (fun f hf => (hb3 f hf).2) hgammaRestored hdeltaRestored + hgammaBoundary hdeltaLocation hseedN hseedTerminal hclosure + hterminalSeed hdeltaMissing + rcases hboundaryFacts with ⟨hgammaRho, hdeltaRho⟩ + obtain ⟨u, exitPath, huDiff, hexitPath, hexitLength, + hexitSupport, hexitIntersection, hexitBoundary, huNotFN⟩ := + ExtensionBaseCaseTwoObservation21 Tn TjPrime rho1 gammaN deltaN + fN terminalSupport x p hpath hcomponent hterminalN hterminalPrime + hxOutside htwoN hgammaRho hdeltaRho hfNterminal + have huPrime : u ∈ TreeSequenceVertexSet TjPrime := + (Finset.mem_sdiff.mp huDiff).1 + have huOutside : u ∉ TreeSequenceVertexSet Tn := + (Finset.mem_sdiff.mp huDiff).2 + refine ⟨u, huPrime, huOutside, exitPath, hexitPath, hexitLength, + hexitSupport, hexitIntersection, hexitBoundary, huNotFN, ?_⟩ + intro beta hbeta + have huTerminal : u ≠ terminalSupport := by + intro hut + apply huOutside + simpa [hut] using hterminalN + have huErase : u ∈ (TreeSequenceVertexSet TjPrime).erase terminalSupport := + Finset.mem_erase.mpr ⟨huTerminal, huPrime⟩ + have hbetaSupport : beta ∉ supportColors := by + intro hbs + have hbinter : beta ∈ MissingColors G rho1 u ∩ supportColors := + Finset.mem_inter.mpr ⟨hbeta, hbs⟩ + have hempty := hcaseTwo u huErase + rw [hempty] at hbinter + simp at hbinter + have hbetaGammaFirst : beta ≠ gammaFirst := by + intro h + exact hbetaSupport (h ▸ hgammaFirstSupport) + have hbetaDelta : beta ≠ deltaN := by + intro h + exact hbetaSupport (h ▸ hdeltaSupport) + have hbetaGamma : beta ≠ gammaN := by + intro h + exact hbetaSupport (h ▸ hgammaSupport) + have hbetaTerminal : beta ∉ MissingColors G rho1 terminalSupport := by + intro hbt + have hd := hprimeElementary huPrime hterminalPrime huTerminal + exact (Finset.disjoint_left.mp hd) hbeta hbt + have huSeed : u ∉ TreeSequenceVertexSet seed := by + intro hus + exact huOutside (initial_subset hseedN hus) + obtain ⟨z, hz, zPosition, hzPosition, hzAfter, + hzChoice, hzBefore, hzEdges⟩ := + ExtensionBaseCaseTwoObservation23 Tj seed TjPrime phiJ rho1 + terminalSupport u beta gammaFirst hseedJ hseedPrime hseedTerminal + huPrime huSeed hprimeElementary hbeta hterminalSeed hb2Missing + hbetaTerminal hterminalInclusion hbetaGammaFirst haugmentation hb2Edges + obtain ⟨hprimeMissing, hprimeEdges⟩ := + ExtensionBaseCaseTwoObservation19 rho1 seed TjPrime terminalSupport + supportColors deltaN hclosure hterminalPrime hcaseTwo hterminalColors + refine ⟨z, hz, zPosition, hzPosition, hzAfter, hzChoice, hzBefore, + hzEdges, ?_⟩ + dsimp + let rho0 := OutsideTreeColorSwap TjPrime rho1 beta deltaN + let mu0 := TwoColorComponentSwap G rho0 gammaN beta (Sum.inl u) + have hbetaTree : beta ∈ TreeMissingColors rho1 TjPrime := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨u, huPrime, hbeta⟩ + have hdeltaTree : deltaN ∈ TreeMissingColors rho1 TjPrime := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨terminalSupport, hterminalPrime, + hdeltaMissing⟩ + have houtside := OutsideTreeColorSwapStable TjPrime supportColors rho1 + beta deltaN hrhoProper hrhoOne hclosure.2 hbetaTree hdeltaTree + hbetaDelta + change IsProperEdgeColoring G rho0 ∧ IsOneEdgeUncolored rho0 e0 ∧ + StableColoring TjPrime supportColors rho1 rho0 ∧ + ∀ f : E, TreeIncidentEdge TjPrime f → rho0 f = rho1 f at houtside + rcases houtside with ⟨hrho0Proper, hrho0One, hrho0Stable, hrho0Fixed⟩ + have hgammaBeta : gammaN ≠ beta := Ne.symm hbetaGamma + exact @helper_continuation_1644 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating ett terminalSlot preterminalSlot (by assumption) (by assumption) + terminalSupport hterminalSupport Tj Tn seed TjPrime phiJ rho1 Dprev supportColors gammaN + deltaN x p hTjN hseedJ hseedPrime hseedTerminal hterminalTj hclosure hprimeElementary + hcaseTwo hterminalColors hdeltaSupport hgammaDelta hdeltaMissing hpath hcomponent hxOutside + hb1 hb2Missing haugmentation hb2Edges hdeltaPhiJ (by assumption) (by assumption) (by + assumption) hgammaIdentity (by assumption) (by assumption) hb4 hsupportColors hdeltaEarlier + hsupportOrder initial_subset hterminalPrime u exitPath hexitPath hexitLength hexitSupport + hexitIntersection hexitBoundary huPrime huOutside beta hbeta huTerminal huErase + hbetaSupport hbetaDelta hbetaGamma huSeed z hz zPosition hzPosition hzAfter hzBefore + hzEdges hprimeMissing hprimeEdges hrho0Proper hrho0One hrho0Stable hrho0Fixed hgammaBeta +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaimMissingColors.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaimMissingColors.lean new file mode 100644 index 0000000000..5e54bb45e3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaimMissingColors.lean @@ -0,0 +1,690 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass + +public import LeanPool.GoldbergSeymour.SupportingPEMissingTransport +public import LeanPool.GoldbergSeymour.SupportingPEStoredIntersection + +/-! +# Extension Base Claim Missing Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_next_segment_98.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (j : Fin (ett.rounds + (1 : ℕ))) (i : Fin + ett.rounds), j = i.succ → TreeSequenceInitialSegment (ett.series.data.tree + i.succ.castSucc) (ett.series.data.tree i.succ.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett j i hj + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero i hj.symm).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have value := congrArg Fin.val hj + simp at value + have ci_eq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have value := congrArg Fin.val hj + simp at value + have ci_eq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have value := congrArg Fin.val hj + simp at value + have ci_eq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + +private theorem helper_hstart_177.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds), (↑jSlot : ℕ) ≤ (↑q + : ℕ) → (↑q : ℕ) + (1 : ℕ) = ett.rounds → (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex + ett terminalSupport hterminalSupport → ∀ (w : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → + Fin ett.rounds), (∀ (a b : Fin ett.rounds), (↑a : ℕ) ≤ (↑b : ℕ) → ∀ v ∈ + TreeSequenceVertexSet (ett.series.data.tree a.succ.castSucc), v ∈ TreeSequenceVertexSet + (ett.series.data.tree b.succ.castSucc)) → (ETTFirstAppearanceIndex ett terminalSupport + hterminalSupport ≤ (↑(indices (0 : Fin (p + (1 : ℕ)))) : ℕ) + (1 : ℕ) ∧ + ett.series.data.kind (indices (0 : Fin (p + (1 : ℕ)))).succ = some + TashkinovExtensionKind.PE ∧ ∃ (v : V), ett.series.data.chosenVertex (indices (0 : Fin (p + + (1 : ℕ)))).succ = some v ∧ ∃ (x : v ∈ TreeSequenceVertexSet T), ETTFirstAppearanceIndex + ett v x ≤ ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) ∧ + ett.series.data.chosenVertex (indices (0 : Fin (p + (1 : ℕ)))).succ = some w → ∀ v0 ∈ + TreeSequenceVertexSet T, ∀ (hvT0 : w ∈ TreeSequenceVertexSet T), ETTFirstAppearanceIndex + ett w hvT0 ≤ (↑jSlot : ℕ) + (1 : ℕ) → w ∈ TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q hjle + hqTerminal hjSlot w p indices stage_vertices hclass0 v0 hchosenV0 hvT0 hbound0 + unfold ETTFirstAppearanceIndex at hbound0 + dsimp at hbound0 + simp only [Nat.add_le_add_iff_right] at hbound0 + let candidates : Finset (Fin (ett.rounds + 1)) := Finset.univ.filter + (fun i => w ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)) + have hc : candidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hvT0 + have hmin := Finset.min'_mem candidates hc + have min_independent : ∀ (s : Finset (Fin (ett.rounds + 1))) + (h1 h2 : s.Nonempty), s.min' h1 = s.min' h2 := by + intro s h1 h2 + apply le_antisymm + · exact Finset.min'_le _ _ (Finset.min'_mem s h2) + · exact Finset.min'_le _ _ (Finset.min'_mem s h1) + have hbound : (Finset.min' candidates hc).val ≤ jSlot.val := by + dsimp [candidates] at hc ⊢ + convert hbound0 using 1 + have hminle : (Finset.min' candidates hc).val ≤ jSlot.val := hbound + have hminval : (Finset.min' candidates hc).val < ett.rounds + 1 := + (Finset.min' candidates hc).isLt + let a : Fin ett.rounds := ⟨(Finset.min' candidates hc).val, by omega⟩ + have ha : w ∈ TreeSequenceVertexSet + (ett.series.data.tree a.succ.castSucc) := by + have hnotlast : (Finset.min' candidates hc) ≠ Fin.last ett.rounds := by + intro he + have : ett.rounds ≤ jSlot.val := by simpa [he] using hminle + omega + have htree : ExtendedTashkinovLadderStage ett (Finset.min' candidates hc) = + ett.series.data.tree a.succ.castSucc := by + have hidx : (Finset.min' candidates hc) = a.castSucc := by + apply Fin.ext + rfl + rw [hidx] + simp [ExtendedTashkinovLadderStage] + rw [← htree] + simpa [candidates] using hmin + exact stage_vertices a jSlot (by simp [a]; omega) w ha + +private theorem helper_hfirst_227.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds), (↑jSlot : ℕ) ≤ (↑q + : ℕ) → (↑q : ℕ) + (1 : ℕ) = ett.rounds → (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex + ett terminalSupport hterminalSupport → ∀ (w : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → + Fin ett.rounds), (∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < + (↑(indices b) : ℕ)) → (∀ (r : Fin ett.rounds), (↑r : ℕ) ≤ (↑q : ℕ) ∧ ett.series.data.kind + r.succ = some TashkinovExtensionKind.PE ∧ ett.series.data.chosenVertex r.succ = some w ↔ ∃ + (a : Fin (p + (1 : ℕ))), indices a = r) → (∀ (v : V) (hvT : v ∈ TreeSequenceVertexSet T), + v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) → + ETTFirstAppearanceIndex ett v hvT ≤ (↑jSlot : ℕ) + (1 : ℕ)) → (ETTFirstAppearanceIndex ett + terminalSupport hterminalSupport ≤ (↑(indices (0 : Fin (p + (1 : ℕ)))) : ℕ) + (1 : ℕ) ∧ + ett.series.data.kind (indices (0 : Fin (p + (1 : ℕ)))).succ = some + TashkinovExtensionKind.PE ∧ ∃ (v : V), ett.series.data.chosenVertex (indices (0 : Fin (p + + (1 : ℕ)))).succ = some v ∧ ∃ (x : v ∈ TreeSequenceVertexSet T), ETTFirstAppearanceIndex + ett v x ≤ ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) ∧ + ett.series.data.chosenVertex (indices (0 : Fin (p + (1 : ℕ)))).succ = some w → + (ETTFirstAppearanceIndex ett terminalSupport hterminalSupport ≤ (↑(indices (0 : Fin (p + + (1 : ℕ)))) : ℕ) + (1 : ℕ) ∧ ett.series.data.kind (indices (0 : Fin (p + (1 : ℕ)))).succ = + some TashkinovExtensionKind.PE ∧ ∃ (v : V), ett.series.data.chosenVertex (indices (0 : Fin + (p + (1 : ℕ)))).succ = some v ∧ ∃ (x : v ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett v x ≤ ETTFirstAppearanceIndex ett terminalSupport + hterminalSupport) → ∀ v0 ∈ TreeSequenceVertexSet T, ∀ (hvT0 : w ∈ TreeSequenceVertexSet + T), ETTFirstAppearanceIndex ett w hvT0 ≤ (↑jSlot : ℕ) + (1 : ℕ) → w ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) → MissingColors G + (ett.series.data.coloring jSlot.castSucc) w = MissingColors G (ett.series.data.coloring + (indices (0 : Fin (p + (1 : ℕ)))).castSucc) w := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q hjle + hqTerminal hjSlot w p indices hincreasing henumerates first_bound hclass0 hactive0' v0 + hchosenV0 hvT0 hbound0 hstart + by_cases heq : jSlot = indices 0 + · subst heq + rfl + · have hlt : jSlot.val < (indices 0).val := by + have hh := hactive0'.1 + omega + let z : Fin ett.rounds := ⟨(indices 0).val - 1, by omega⟩ + have hzle : jSlot.val ≤ z.val := by simp [z]; omega + have hno : ∀ r : Fin ett.rounds, jSlot.val ≤ r.val → r.val ≤ z.val → + ¬ (ett.series.data.kind r.succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex r.succ = some w) := by + intro r hr1 hr2 hpe + obtain ⟨a, ha⟩ := (henumerates r).1 ⟨by omega, hpe.1, hpe.2⟩ + have hia : (indices 0).val ≤ (indices a).val := by + by_cases ha0 : a = 0 + · simp [ha0] + · have haPos : 0 < a.val := by + apply Nat.pos_of_ne_zero + intro haVal + apply ha0 + apply Fin.ext + exact haVal + have : (0 : Fin (p + 1)).val < a.val := by simpa using haPos + exact Nat.le_of_lt (hincreasing 0 a this) + have : (indices 0).val ≤ r.val := by + apply Fin.le_iff_val_le_val.mpr + simpa [ha] using hia + simp [z] at hr2 + omega + have hz := HkuUnsupportedVertexColors G k ett.rounds e0 input ett.series + z jSlot w (by omega) hstart hno + have hzeq : z.succ = (indices 0).castSucc := by + apply Fin.ext + have hzpos : 1 ≤ (indices 0).val := by omega + simp [z, Nat.sub_add_cancel hzpos] + rw [hzeq] at hz + exact hz + +private theorem helper_hlastmem_268.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (_ q : Fin ett.rounds) (w : V) (p : ℕ) (indices + : Fin (p + (1 : ℕ)) → Fin ett.rounds), (ETTFirstAppearanceIndex ett terminalSupport + hterminalSupport ≤ (↑(indices (0 : Fin (p + (1 : ℕ)))) : ℕ) + (1 : ℕ) ∧ + ett.series.data.kind (indices (0 : Fin (p + (1 : ℕ)))).succ = some + TashkinovExtensionKind.PE ∧ ∃ (v : V), ett.series.data.chosenVertex (indices (0 : Fin (p + + (1 : ℕ)))).succ = some v ∧ ∃ (x : v ∈ TreeSequenceVertexSet T), ETTFirstAppearanceIndex + ett v x ≤ ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) ∧ + ett.series.data.chosenVertex (indices (0 : Fin (p + (1 : ℕ)))).succ = some w → ∀ v0 ∈ + TreeSequenceVertexSet T, w ∈ TreeSequenceVertexSet T → (↑(indices (Fin.last p)) : ℕ) ≤ (↑q + : ℕ) ∧ ett.series.data.kind (indices (Fin.last p)).succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex (indices (Fin.last p)).succ = some w → w ∈ + TreeSequenceVertexSet (ett.series.data.tree (indices (Fin.last p)).succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q w p + indices hclass0 v0 hchosenV0 hvT0 hlastinfo + have hcert := ett.series.certified (indices (Fin.last p)).succ + generalize targetEq : (indices (Fin.last p)).succ = target at hcert + cases hcert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + have hv := congrArg Fin.val targetEq + simp at hv + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hci : ci = indices (Fin.last p) := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv ⊢ + omega + subst ci + rw [currentKind] at hlastinfo + simp at hlastinfo + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hci : ci = indices (Fin.last p) := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv ⊢ + omega + subst ci + rw [currentKind] at hlastinfo + simp at hlastinfo + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hci : ci = indices (Fin.last p) := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv ⊢ + omega + subst ci + have hvchoice : choice.vertex = w := by + apply Option.some.inj + exact currentVertex.symm.trans hlastinfo.2.2 + rw [← hvchoice] + exact choice.vertexDefective.1 + +private theorem helper_hlate_321.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds), (↑jSlot : ℕ) ≤ (↑q + : ℕ) → (↑q : ℕ) + (1 : ℕ) = ett.rounds → ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ett.series.data.chosenVertex q.succ = some terminalSupport → ∀ + w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), ∀ (p : ℕ) (indices : Fin + (p + (1 : ℕ)) → Fin ett.rounds), (∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → + (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) → (∀ (r : Fin ett.rounds), (↑r : ℕ) ≤ (↑q : ℕ) ∧ + ett.series.data.kind r.succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex r.succ = some w ↔ ∃ (a : Fin (p + (1 : ℕ))), indices a = r) → + ∀ (deltaLast : Fin k) (sigma : PartialEdgeColoring E k), StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma → (∀ (A B : TreeSequence G e0), + TreeSequenceInitialSegment A B → ∀ v ∈ TreeSequenceVertexSet A, v ∈ TreeSequenceVertexSet + B) → (∀ (j : Fin (ett.rounds + (1 : ℕ))) (i : Fin ett.rounds), j = i.succ → + TreeSequenceInitialSegment (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree + i.succ.succ)) → (∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), v ∈ + TreeSequenceVertexSet T) → (∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc), MissingColors G sigma v = MissingColors G (ett.series.data.coloring + q.succ) v) → (have storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p + + (1 : ℕ))) => ett.series.data.stored (indices a).succ; MissingColors G + (ett.series.data.coloring q.succ) w ∩ storedPairs = {deltaLast} ∧ MissingColors G + (ett.series.data.coloring (indices (Fin.last p)).succ) w ∩ storedPairs = {deltaLast}) → + (ETTFirstAppearanceIndex ett terminalSupport hterminalSupport ≤ (↑(indices (0 : Fin (p + + (1 : ℕ)))) : ℕ) + (1 : ℕ) ∧ ett.series.data.kind (indices (0 : Fin (p + (1 : ℕ)))).succ = + some TashkinovExtensionKind.PE ∧ ∃ (v : V), ett.series.data.chosenVertex (indices (0 : Fin + (p + (1 : ℕ)))).succ = some v ∧ ∃ (x : v ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett v x ≤ ETTFirstAppearanceIndex ett terminalSupport + hterminalSupport) ∧ ett.series.data.chosenVertex (indices (0 : Fin (p + (1 : ℕ)))).succ = + some w → ∀ v0 ∈ TreeSequenceVertexSet T, w ∈ TreeSequenceVertexSet T → (↑(indices + (Fin.last p)) : ℕ) ≤ (↑q : ℕ) ∧ ett.series.data.kind (indices (Fin.last p)).succ = some + TashkinovExtensionKind.PE ∧ ett.series.data.chosenVertex (indices (Fin.last p)).succ = + some w → w ∈ TreeSequenceVertexSet (ett.series.data.tree (indices (Fin.last + p)).succ.castSucc) → MissingColors G (ett.series.data.coloring (indices (Fin.last + p)).succ) w = MissingColors G (ett.series.data.coloring q.succ) w := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q hjle + hqTerminal hqKind hqVertex w hw p indices hincreasing henumerates deltaLast sigma + hsigmaStable vertex_transfer next_segment final_transfer stable_vertex hinter hclass0 v0 + hchosenV0 hvT0 hlastinfo hlastmem + by_cases hfinal : indices (Fin.last p) = q + · subst hfinal + rfl + · have hltq : (indices (Fin.last p)).val < q.val := by omega + let s : Fin ett.rounds := ⟨(indices (Fin.last p)).val + 1, by omega⟩ + have hsle : s.val ≤ q.val := by simp [s]; omega + have hs_mem : w ∈ TreeSequenceVertexSet + (ett.series.data.tree s.succ.castSucc) := by + have hseg := next_segment (indices (Fin.last p)).succ + (indices (Fin.last p)) rfl + have ht := vertex_transfer _ _ hseg w hlastmem + have htree : s.succ.castSucc = + (indices (Fin.last p)).succ.succ := by + apply Fin.ext + simp [s] + rw [htree] + exact ht + have hno : ∀ r : Fin ett.rounds, s.val ≤ r.val → r.val ≤ q.val → + ¬ (ett.series.data.kind r.succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex r.succ = some w) := by + intro r hr1 hr2 hpe + obtain ⟨a, ha⟩ := (henumerates r).1 ⟨by omega, hpe.1, hpe.2⟩ + have hale : a.val ≤ (Fin.last p).val := by + have hpval : (Fin.last p).val = p := by simp + exact Fin.le_iff_val_le_val.mp (Fin.le_last a) + by_cases hae : a = Fin.last p + · have : r.val = (indices (Fin.last p)).val := by + simpa [hae] using congrArg Fin.val ha.symm + have hsval : s.val = (indices (Fin.last p)).val + 1 := by simp [s] + omega + · have hlt : a.val < (Fin.last p).val := by omega + have hi := hincreasing a (Fin.last p) hlt + have hridx : s.val ≤ (indices a).val := by + simpa [ha] using hr1 + have hsval : s.val = (indices (Fin.last p)).val + 1 := by simp [s] + omega + have hs := HkuUnsupportedVertexColors G k ett.rounds e0 input ett.series + q s w hsle hs_mem hno + have hseq : s.castSucc = (indices (Fin.last p)).succ := by + apply Fin.ext + simp [s] + rw [hseq] at hs + exact hs + +private theorem helper_branch_144.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds), (↑jSlot : ℕ) ≤ (↑q + : ℕ) → (↑q : ℕ) + (1 : ℕ) = ett.rounds → ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ett.series.data.chosenVertex q.succ = some terminalSupport → + (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett terminalSupport hterminalSupport → + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), + ∀ (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) → + ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) → ( + ∀ (r : Fin ett.rounds), (↑r : ℕ) ≤ (↑q : ℕ) ∧ ett.series.data.kind r.succ = some + TashkinovExtensionKind.PE ∧ ett.series.data.chosenVertex r.succ = some w ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) → + ∀ (gammaFirst deltaLast : Fin k), ett.series.data.gamma (indices (0 : Fin (p + (1 : ℕ)))).succ + = some gammaFirst → ett.series.data.delta (indices (Fin.last p)).succ = some deltaLast → + ∀ (sigma : PartialEdgeColoring E k), StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → ( + ∀ (A B : TreeSequence G e0), TreeSequenceInitialSegment A B → + ∀ v ∈ TreeSequenceVertexSet A, v ∈ TreeSequenceVertexSet B) → ( + ∀ (j : Fin (ett.rounds + (1 : ℕ))) (i : Fin ett.rounds), j = i.succ → + TreeSequenceInitialSegment (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree + i.succ.succ)) → ( + ∀ (a b : Fin ett.rounds), (↑a : ℕ) ≤ (↑b : ℕ) → + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree a.succ.castSucc), v ∈ TreeSequenceVertexSet + (ett.series.data.tree b.succ.castSucc)) → ( + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), v ∈ TreeSequenceVertexSet + T) → ( + ∀ (v : V) (hvT : v ∈ TreeSequenceVertexSet T), v ∈ TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc) → ETTFirstAppearanceIndex ett v hvT ≤ (↑jSlot : ℕ) + (1 : ℕ)) → ( + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), MissingColors G sigma v = + MissingColors G (ett.series.data.coloring q.succ) v) → ( + have storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p + (1 : ℕ))) => + ett.series.data.stored (indices a).succ; MissingColors G (ett.series.data.coloring q.succ) + w ∩ storedPairs = {deltaLast} ∧ MissingColors G (ett.series.data.coloring (indices + (Fin.last p)).succ) w ∩ storedPairs = {deltaLast}) → MissingColors G + (ett.series.data.coloring jSlot.castSucc) w = MissingColors G sigma w \ {deltaLast} ∪ + {gammaFirst} := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q hjle + hqTerminal hqKind hqVertex hjSlot w hw p indices hincreasing hclass henumerates gammaFirst + deltaLast hgammaFirst hdeltaLast sigma hsigmaStable vertex_transfer next_segment + stage_vertices final_transfer first_bound stable_vertex hinter + have hclass0 := (hclass (indices 0)).2 ⟨0, rfl⟩ + simp only [ExtensionBaseSupportClass, ExtensionBaseActiveIndices, exists_and_left, + Finset.mem_filter, + Finset.mem_univ, true_and] at hclass0 + have hactive0 : indices 0 ∈ ExtensionBaseActiveIndices ett + terminalSupport hterminalSupport := by + unfold ExtensionBaseActiveIndices + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + rcases hclass0.1 with ⟨hlo, hkind, v0, hch, hv0, hfv⟩ + exact ⟨hlo, hkind, v0, hv0, hch, hfv⟩ + have hactive0' := hactive0 + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] at hactive0' + have hchosen0 : ett.series.data.chosenVertex (indices 0).succ = some w := + hclass0.2 + obtain ⟨v0, hv0, hchosenV0, hfirstV0⟩ := hactive0'.2.2 + have hvT0 : w ∈ TreeSequenceVertexSet T := by + have hvEq : v0 = w := by + apply Option.some.inj + exact hv0.symm.trans hchosen0 + simpa [hvEq] using hchosenV0 + have hfirstW : ETTFirstAppearanceIndex ett w hvT0 ≤ + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport := by + have hvEq : v0 = w := by + apply Option.some.inj + exact hv0.symm.trans hchosen0 + simpa [hvEq] using hfirstV0 + have hbound0 : ETTFirstAppearanceIndex ett w + (by + exact hvT0) ≤ jSlot.val + 1 := by + have hb := hactive0'.1 + have heq := hjSlot + have hle : ETTFirstAppearanceIndex ett w + (by + exact hvT0) ≤ (indices 0).val + 1 := by + exact hfirstW.trans (by omega) + omega + have hstart := @helper_hstart_177 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport jSlot q hjle hqTerminal hjSlot w p indices + stage_vertices hclass0 v0 hchosenV0 hvT0 hbound0 + have hfirst := @helper_hfirst_227 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport jSlot q hjle hqTerminal hjSlot w p indices + hincreasing henumerates first_bound hclass0 hactive0' v0 hchosenV0 hvT0 hbound0 hstart + have hlastinfo := (henumerates (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩ + have hlastmem := @helper_hlastmem_268 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport jSlot q w p indices hclass0 v0 hchosenV0 hvT0 + hlastinfo + have hlate := @helper_hlate_321 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport jSlot q hjle hqTerminal hqKind hqVertex w hw p + indices hincreasing henumerates deltaLast sigma hsigmaStable vertex_transfer next_segment + final_transfer stable_vertex hinter hclass0 v0 hchosenV0 hvT0 hlastinfo hlastmem + have htransport := SupportingPEMissingTransport G k ett.rounds p e0 input + ett.series q w hw indices hincreasing henumerates gammaFirst deltaLast + hgammaFirst hdeltaLast + rw [hfirst] + rw [hlate, ← stable_vertex w hw] at htransport + exact htransport.1 + +private theorem helper_branch_230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds), (↑jSlot : ℕ) ≤ (↑q + : ℕ) → (↑q : ℕ) + (1 : ℕ) = ett.rounds → ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ett.series.data.chosenVertex q.succ = some terminalSupport → + (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett terminalSupport hterminalSupport → + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), + ∀ (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) → + ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) → ( + ∀ (r : Fin ett.rounds), (↑r : ℕ) ≤ (↑q : ℕ) ∧ ett.series.data.kind r.succ = some + TashkinovExtensionKind.PE ∧ ett.series.data.chosenVertex r.succ = some w ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) → + ∀ (gammaFirst deltaLast : Fin k), ett.series.data.gamma (indices (0 : Fin (p + (1 : ℕ)))).succ + = some gammaFirst → ett.series.data.delta (indices (Fin.last p)).succ = some deltaLast → + ∀ (sigma : PartialEdgeColoring E k), StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → ( + ∀ (A B : TreeSequence G e0), TreeSequenceInitialSegment A B → + ∀ v ∈ TreeSequenceVertexSet A, v ∈ TreeSequenceVertexSet B) → ( + ∀ (j : Fin (ett.rounds + (1 : ℕ))) (i : Fin ett.rounds), j = i.succ → + TreeSequenceInitialSegment (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree + i.succ.succ)) → ( + ∀ (a b : Fin ett.rounds), (↑a : ℕ) ≤ (↑b : ℕ) → + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree a.succ.castSucc), v ∈ TreeSequenceVertexSet + (ett.series.data.tree b.succ.castSucc)) → ( + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), v ∈ TreeSequenceVertexSet + T) → ( + ∀ (v : V) (hvT : v ∈ TreeSequenceVertexSet T), v ∈ TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc) → ETTFirstAppearanceIndex ett v hvT ≤ (↑jSlot : ℕ) + (1 : ℕ)) → ( + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), MissingColors G sigma v = + MissingColors G (ett.series.data.coloring q.succ) v) → + let storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p + (1 : ℕ))) => + ett.series.data.stored (indices a).succ; MissingColors G sigma w ∩ storedPairs = + {deltaLast} ∧ MissingColors G (ett.series.data.coloring jSlot.castSucc) w = MissingColors + G sigma w \ {deltaLast} ∪ {gammaFirst} := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot q hjle + hqTerminal hqKind hqVertex hjSlot w hw p indices hincreasing hclass henumerates gammaFirst + deltaLast hgammaFirst hdeltaLast sigma hsigmaStable vertex_transfer next_segment + stage_vertices final_transfer first_bound stable_vertex + dsimp + have hinter := SupportingPEStoredIntersection G k ett.rounds p e0 input + ett.series q w hw indices hincreasing henumerates deltaLast hdeltaLast + constructor + · rw [stable_vertex w hw] + exact hinter.1 + · exact @helper_branch_144 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport hterminalSupport jSlot q hjle hqTerminal hqKind + hqVertex hjSlot w hw p indices hincreasing hclass henumerates gammaFirst deltaLast + hgammaFirst hdeltaLast sigma hsigmaStable vertex_transfer next_segment stage_vertices + final_transfer first_bound stable_vertex hinter +theorem ExtensionBaseClaimMissingColors {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (jSlot q : Fin ett.rounds) (hjle : jSlot.val ≤ q.val) + (hqTerminal : q.val + 1 = ett.rounds) + (hqKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE) + (hqVertex : ett.series.data.chosenVertex q.succ = some terminalSupport) + (hjSlot : jSlot.val + 1 = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) + (w : V) + (hw : w ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds) + (hincreasing : ∀ a b, a.val < b.val → + (indices a).val < (indices b).val) + (hclass : ∀ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ↔ + ∃ a : Fin (p + 1), indices a = r) + (henumerates : ∀ r : Fin ett.rounds, + (r.val ≤ q.val ∧ + ett.series.data.kind r.succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex r.succ = some w) ↔ + ∃ a : Fin (p + 1), indices a = r) + (gammaFirst deltaLast : Fin k) + (hgammaFirst : ett.series.data.gamma (indices 0).succ = some gammaFirst) + (hdeltaLast : ett.series.data.delta + (indices (Fin.last p)).succ = some deltaLast) + (sigma : PartialEdgeColoring E k) + (_ : IsProperEdgeColoring G sigma) + (_ : IsOneEdgeUncolored sigma e0) + (hsigmaStable : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma) : + (∀ v : V, + v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) → + (∀ r : Fin ett.rounds, + r ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex r.succ ≠ some v) → + MissingColors G sigma v = + MissingColors G (ett.series.data.coloring jSlot.castSucc) v) ∧ + (let storedPairs := Finset.univ.biUnion fun a : Fin (p + 1) => + ett.series.data.stored (indices a).succ + MissingColors G sigma w ∩ storedPairs = {deltaLast} ∧ + MissingColors G (ett.series.data.coloring jSlot.castSucc) w = + (MissingColors G sigma w \ {deltaLast}) ∪ {gammaFirst}) := by + classical + have vertex_transfer : ∀ (A B : TreeSequence G e0), + TreeSequenceInitialSegment A B → ∀ v, v ∈ TreeSequenceVertexSet A → + v ∈ TreeSequenceVertexSet B := by + intro A B hseg v hv + unfold TreeSequenceVertexSet at hv ⊢ + simp only [Finset.mem_image] at hv ⊢ + obtain ⟨i, hi, rfl⟩ := hv + rcases hseg with ⟨hlen, hvertex, hedge⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, by simpa using hvertex i⟩ + have next_segment := @helper_next_segment_98 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett + have stage_vertices : ∀ a b : Fin ett.rounds, a.val ≤ b.val → ∀ v, + v ∈ TreeSequenceVertexSet (ett.series.data.tree a.succ.castSucc) → + v ∈ TreeSequenceVertexSet (ett.series.data.tree b.succ.castSucc) := by + have stage_aux : ∀ n : ℕ, ∀ a b : Fin ett.rounds, + b.val - a.val = n → a.val ≤ b.val → ∀ v, + v ∈ TreeSequenceVertexSet (ett.series.data.tree a.succ.castSucc) → + v ∈ TreeSequenceVertexSet (ett.series.data.tree b.succ.castSucc) := by + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro a b hgap hab v hv + by_cases heq : a.val = b.val + · have heq' : a = b := Fin.ext heq + simpa [heq'] using hv + · have alt : a.val < b.val := by omega + let c : Fin ett.rounds := ⟨a.val + 1, by omega⟩ + have hcv0 := vertex_transfer _ _ (next_segment a.succ a rfl) v hv + have hcv : v ∈ TreeSequenceVertexSet + (ett.series.data.tree c.succ.castSucc) := by + have hidx : c.succ.castSucc = a.succ.succ := by + apply Fin.ext + simp [c] + rw [hidx] + exact hcv0 + have cval : c.val = a.val + 1 := rfl + have hlt : b.val - c.val < n := by omega + have hcb : c.val ≤ b.val := by omega + have hgap' : b.val - c.val = b.val - c.val := rfl + exact ih (b.val - c.val) hlt c b hgap' hcb v hcv + intro a b hab v hv + exact stage_aux (b.val - a.val) a b rfl hab v hv + have final_transfer : ∀ v, v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + v ∈ TreeSequenceVertexSet T := by + intro v hv + have hidx : q.succ.castSucc = + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp + omega + rw [hidx] at hv + exact vertex_transfer _ _ ett.abovePenultimate v hv + have first_bound : ∀ (v : V) (hvT : v ∈ TreeSequenceVertexSet T) + (hv : v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)), + ETTFirstAppearanceIndex ett v hvT ≤ jSlot.val + 1 := by + intro v hvT hv + unfold ETTFirstAppearanceIndex + dsimp + have hmem : jSlot.castSucc ∈ + Finset.univ.filter (fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)) := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + simpa [ExtendedTashkinovLadderStage, Fin.lastCases_castSucc] using hv + have hle := Finset.min'_le + (Finset.univ.filter (fun i : Fin (ett.rounds + 1) => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i))) + jSlot.castSucc hmem + have hnat := Fin.le_iff_val_le_val.mp hle + rw [Fin.val_castSucc] at hnat + convert Nat.succ_le_succ hnat using 1 + have stable_vertex : + ∀ v, v ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) → MissingColors G sigma + v = MissingColors G (ett.series.data.coloring q.succ) v := by + intro v hv + exact hsigmaStable.2 v hv + refine ⟨?_, ?_⟩ + · intro v hv hno + have unused : ∀ r : Fin ett.rounds, jSlot.val ≤ r.val → r.val ≤ q.val → + ¬ (ett.series.data.kind r.succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex r.succ = some v) := by + intro r hrj hrq hpe + have hactive : r ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport := by + unfold ExtensionBaseActiveIndices + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨?_, hpe.1, ?_⟩ + · omega + · have hvT := final_transfer v (stage_vertices jSlot q hjle v hv) + refine ⟨v, hvT, ?_⟩ + exact ⟨hpe.2, by + simpa [hjSlot] using + (first_bound v (final_transfer v (stage_vertices jSlot q hjle v hv)) hv)⟩ + exact (hno r hactive) hpe.2 + have hu := HkuUnsupportedVertexColors G k ett.rounds e0 input ett.series + q jSlot v hjle hv unused + exact (stable_vertex v (stage_vertices jSlot q hjle v hv)).trans hu.symm + · exact @helper_branch_230 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett terminalSupport hterminalSupport jSlot q hjle hqTerminal hqKind + hqVertex hjSlot w hw p indices hincreasing hclass henumerates gammaFirst deltaLast + hgammaFirst hdeltaLast sigma hsigmaStable vertex_transfer next_segment stage_vertices + final_transfer first_bound stable_vertex +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaimStrongInterchangeable.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaimStrongInterchangeable.lean new file mode 100644 index 0000000000..d6e367ebf3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaimStrongInterchangeable.lean @@ -0,0 +1,218 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable +public import LeanPool.GoldbergSeymour.EarlierPECycleFirstNonrevisitingInternal + +public import LeanPool.GoldbergSeymour.ExtensionBaseActiveIndices + +public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent + +public import LeanPool.GoldbergSeymour.ParallelStepRootComponentSetup +public import LeanPool.GoldbergSeymour.StableSeriesCycleComponentTransport + +/-! +# Extension Base Claim Strong Interchangeable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseClaimStrongInterchangeable {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) + (hqTerminal : q.val + 1 = ett.rounds) + (hqKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE) + (_ : ett.series.data.chosenVertex q.succ = some terminalSupport) + (hLowerInterchange : ∀ (t : Fin ett.rounds) (vt : V) + (gamma delta : Fin k), + t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + t.val < q.val → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma t.succ = some gamma → + ett.series.data.delta t.succ = some delta → + TreeInterchangeable G (ett.series.data.tree t.succ.succ) + (ett.series.data.coloring t.succ) gamma delta) + (sigma : PartialEdgeColoring E k) + (hsigmaProper : IsProperEdgeColoring G sigma) + (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma) : + ∀ (t : Fin ett.rounds) (vt : V) (gamma delta : Fin k), t ∈ ExtensionBaseActiveIndices ett + terminalSupport hterminalSupport → t.val < q.val → ett.series.data.chosenVertex t.succ = + some vt → ett.series.data.gamma t.succ = some gamma → ett.series.data.delta t.succ = some + delta → ETTStrongInterchangeable ett t vt sigma gamma delta := by + classical + intro t vt gamma delta htActive htq htVertex htGamma htDelta + have htKind : ett.series.data.kind t.succ = + some TashkinovExtensionKind.PE := by + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at htActive + exact htActive.2.1 + obtain ⟨hcolors, htProper, htSegment, hsupport, hrootPath, hrootOnly, + hnonisolated⟩ := + ParallelStepRootComponentSetup ett.series t vt gamma delta + htKind htVertex htGamma htDelta + have hcycles : + ∀ v : V, v ∈ TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc) → v ≠ vt → + TwoColorComponentCycle G (ett.series.data.coloring t.succ) gamma delta (Sum.inl v) ∧ + Sum.inl vt ∉ TwoColorComponent G (ett.series.data.coloring t.succ) gamma delta (Sum.inl v) + := by + intro v hv hne + have hsupportNext := + TreeSequenceInitialSegmentVertexSetSubset htSegment hsupport + have hvNext := TreeSequenceInitialSegmentVertexSetSubset htSegment hv + have hdistinct : TwoColorComponent G (ett.series.data.coloring t.succ) + gamma delta (Sum.inl vt) ≠ + TwoColorComponent G (ett.series.data.coloring t.succ) + gamma delta (Sum.inl v) := by + intro heq + apply hne + apply (hrootOnly v hv).mp + rw [heq] + rfl + have hcycle := TwoColorInterchangeableDistinctComponentCycle G + (ett.series.data.tree t.succ.succ) + (ett.series.data.coloring t.succ) gamma delta htProper + (Sum.inl vt) (Sum.inl v) hrootPath + (hLowerInterchange t vt gamma delta htActive htq htVertex htGamma htDelta) + ⟨vt, hsupportNext, by rfl⟩ ⟨v, hvNext, by rfl⟩ hdistinct + refine ⟨hcycle, ?_⟩ + intro hs + apply hne + apply (hrootOnly v hv).mp + change (TwoColorIncidenceGraph G (ett.series.data.coloring t.succ) + gamma delta).connectedComponentMk (Sum.inl vt) = + (TwoColorIncidenceGraph G (ett.series.data.coloring t.succ) + gamma delta).connectedComponentMk (Sum.inl v) at hs + change (TwoColorIncidenceGraph G (ett.series.data.coloring t.succ) + gamma delta).connectedComponentMk (Sum.inl v) = + (TwoColorIncidenceGraph G (ett.series.data.coloring t.succ) + gamma delta).connectedComponentMk (Sum.inl vt) + exact hs.symm + let candidates : Finset (Fin ett.rounds) := Finset.univ.filter fun p => + t.val < p.val ∧ + ett.series.data.kind p.succ ≠ some TashkinovExtensionKind.RE + have qMem : q ∈ candidates := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, htq, ?_⟩ + rw [hqKind] + simp + have candidatesNonempty : candidates.Nonempty := ⟨q, qMem⟩ + let epsilon : Fin ett.rounds := candidates.min' candidatesNonempty + have epsilonMem : epsilon ∈ candidates := + Finset.min'_mem candidates candidatesNonempty + have htEpsilon : t.val < epsilon.val := + (Finset.mem_filter.mp epsilonMem).2.1 + have hepsilonKind : ett.series.data.kind epsilon.succ ≠ + some TashkinovExtensionKind.RE := + (Finset.mem_filter.mp epsilonMem).2.2 + have hepsilonQ : epsilon.val ≤ q.val := + Finset.min'_le candidates q qMem + have hintervening : ∀ r : Fin ett.rounds, t.val < r.val → + r.val < epsilon.val → + ett.series.data.kind r.succ = some TashkinovExtensionKind.RE := by + intro r htr hre + by_contra hrNot + have hrMem : r ∈ candidates := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, htr, hrNot⟩ + have her : epsilon ≤ r := Finset.min'_le candidates r hrMem + omega + have hcontained : + ∀ v : V, v ∈ TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc) → v ≠ vt → + ∀ w : V, Sum.inl w ∈ TwoColorComponent G (ett.series.data.coloring t.succ) gamma delta + (Sum.inl v) → w ∈ TreeSequenceVertexSet (ett.series.data.tree epsilon.succ.castSucc) := by + intro v hv hne w hw + obtain ⟨cycle, hcycleSupport⟩ := (hcycles v hv hne).1 + have htEarlier : t.succ ≠ Fin.last ett.rounds := by + intro heq + have hval := congrArg Fin.val heq + simp only [Fin.val_succ, Fin.val_last] at hval + omega + have hqLast : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_last] + omega + have hcycleMeets : ∃ x ∈ TreeSequenceVertexSet + (ett.series.data.tree t.succ.castSucc), + Sum.inl x ∈ cycle.walk.support := by + refine ⟨v, hv, ?_⟩ + exact (hcycleSupport (Sum.inl v)).2 (by rfl) + obtain ⟨p, htp, hpKind, hpBetween, -, hpInternal⟩ := + EarlierPECycleFirstNonrevisitingInternal G k ett.rounds e0 input + ett.series t htEarlier gamma delta htKind htGamma htDelta cycle + hcycleMeets (by simpa [hqLast] using hqKind) + have hpNotRE : ett.series.data.kind p.succ ≠ + some TashkinovExtensionKind.RE := by + intro hpRE + rcases hpKind with hpSE | hpPE + · rw [hpSE] at hpRE + cases hpRE + · rw [hpPE] at hpRE + cases hpRE + have hpMem : p ∈ candidates := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, htp, hpNotRE⟩ + have hepsilonLeP : epsilon ≤ p := + Finset.min'_le candidates p hpMem + have hpLeEpsilon : p ≤ epsilon := by + by_contra hnot + have hepsLtP : epsilon.val < p.val := by omega + exact hepsilonKind (hpBetween epsilon htEpsilon hepsLtP) + have hpEq : p = epsilon := le_antisymm hpLeEpsilon hepsilonLeP + subst p + obtain ⟨node, hnodeSupport, hnodeAdj⟩ := + SimpleGraph.adj_of_mem_walk_support cycle.walk + cycle.isCycle.not_nil ((hcycleSupport (Sum.inl w)).2 hw) + cases node with + | inl u => + simp [TwoColorIncidenceGraph] at hnodeAdj + | inr f => + have hdata : Incident G w f ∧ + (ett.series.data.coloring t.succ f = some gamma ∨ + ett.series.data.coloring t.succ f = some delta) := by + simpa [TwoColorIncidenceGraph] using hnodeAdj + have hfAll : + ∀ u, Incident G u f → u ∈ TreeSequenceVertexSet (ett.series.data.tree epsilon.succ.castSucc) + := by + simpa only [InternalEdges, Finset.mem_filter, Finset.mem_univ, + true_and] using hpInternal f hnodeSupport + exact hfAll w hdata.1 + refine ⟨hcolors, htKind, htVertex, epsilon, htEpsilon, + hepsilonKind, hintervening, ?_⟩ + intro v hv hne + obtain ⟨hcycle, havoid⟩ := hcycles v hv hne + obtain ⟨hcomponent, hcycleSigma⟩ := + StableSeriesCycleComponentTransport ett.series t epsilon q gamma delta + htEpsilon hepsilonQ htKind htGamma htDelta hintervening hqKind + sigma hsigmaProper hsigmaOne hsigmaStable (Sum.inl v) hcycle + (hcontained v hv hne) + refine ⟨hcycleSigma, ?_, ?_⟩ + · rw [hcomponent] + exact havoid + · intro w hw + apply hcontained v hv hne w + rw [← hcomponent] + exact hw + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaimTreeEdgeColors.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaimTreeEdgeColors.lean new file mode 100644 index 0000000000..eef553b848 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaimTreeEdgeColors.lean @@ -0,0 +1,333 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled + +public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved + +/-! +# Extension Base Claim Tree Edge Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_segment_61.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (rounds : ℕ) + (series : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + (1 : ℕ))) (i : Fin + rounds), j = i.succ → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) + (series.data.tree i.succ.succ) := by + classical + intro V E _ _ _ G k e0 input rounds series j i hji + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero i) hji.symm |>.elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + +private theorem helper_setTransfer_118.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (rounds : ℕ) + (series : TashkinovSeries G k rounds e0 input) (jSlot q : Fin rounds), (↑q : ℕ) + (1 : ℕ) + = rounds → (∀ (j : Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = i.succ → + TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree + i.succ.succ)) → (∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → ∀ {v : V}, + v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → ∀ (n : ℕ), (↑jSlot : ℕ) ≤ n → + n ≤ (↑q : ℕ) → ∀ (r : Fin rounds), (↑r : ℕ) = n → TreeMissingColors (series.data.coloring + jSlot.castSucc) (series.data.tree jSlot.succ.castSucc) ∪ TashkinovStoredColors series.data + jSlot.castSucc ⊆ TreeMissingColors (series.data.coloring r.castSucc) (series.data.tree + r.succ.castSucc) ∪ TashkinovStoredColors series.data r.castSucc := by + classical + intro V E _ _ _ G k e0 input rounds series jSlot q hqTerminal segment vertexTransfer n hjn + induction n, hjn using Nat.le_induction with + | base => + intro hnq r hr + have heq : r = jSlot := by apply Fin.ext; omega + subst r + intro c hc + exact hc + | succ n hn ih => + intro hnq r hr c hc + let prev : Fin rounds := ⟨n, by omega⟩ + have hold := ih (by omega) prev rfl hc + have hseg := segment prev.succ prev rfl + have hverts : ∀ v, v ∈ TreeSequenceVertexSet + (series.data.tree prev.succ.castSucc) → + v ∈ TreeSequenceVertexSet (series.data.tree prev.succ.succ) := by + intro v hv + exact vertexTransfer hseg hv + have hmono := HkuMissingStoredMonotone G k rounds e0 input series prev + have hnew : TreeMissingColors (series.data.coloring prev.castSucc) + (series.data.tree prev.succ.castSucc) ∪ + TashkinovStoredColors series.data prev.castSucc ⊆ + TreeMissingColors (series.data.coloring prev.succ) + (series.data.tree prev.succ.succ) ∪ + TashkinovStoredColors series.data prev.succ := by + intro d hd + rcases Finset.mem_union.mp hd with hd | hd + · have step := hmono.2 (hmono.1 + (Finset.mem_union.mpr (Or.inl hd))) + exact step + · have step := hmono.2 (hmono.1 + (Finset.mem_union.mpr (Or.inr hd))) + exact step + have hnext : r = ⟨n + 1, by omega⟩ := by apply Fin.ext; omega + rw [hnext] + have hcolor : prev.succ = (⟨n + 1, by omega⟩ : Fin rounds).castSucc := by + apply Fin.ext + simp [prev] + have htree : prev.succ.succ = + (⟨n + 1, by omega⟩ : Fin rounds).succ.castSucc := by + apply Fin.ext + simp [prev] + simpa [prev] using hnew hold + +private theorem helper_internalClaim_170.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (rounds : ℕ) + (series : TashkinovSeries G k rounds e0 input) (jSlot q : Fin rounds), (↑jSlot : ℕ) ≤ (↑q + : ℕ) → (↑q : ℕ) + (1 : ℕ) = rounds → ∀ (sigma : PartialEdgeColoring E k), StableColoring + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.succ) + (series.data.coloring q.succ) sigma → let _ : DecidableEq V := Classical.decEq V; (∀ (j : + Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment + (series.data.tree i.succ.castSucc) (series.data.tree i.succ.succ)) → (∀ {A B : + TreeSequence G e0}, TreeSequenceInitialSegment A B → ∀ {f : E}, TreeIncidentEdge A f → + TreeIncidentEdge B f) → TreeMissingColors (series.data.coloring jSlot.castSucc) + (series.data.tree jSlot.succ.castSucc) ∪ TashkinovStoredColors series.data jSlot.castSucc + ⊆ TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.castSucc → ∀ f ∈ InternalEdges G + (TreeSequenceVertexSet (series.data.tree jSlot.succ.castSucc)), ∀ (c : Fin k), + series.data.coloring jSlot.castSucc f = some c → c ∈ TreeMissingColors + (series.data.coloring jSlot.castSucc) (series.data.tree jSlot.succ.castSucc) ∪ + TashkinovStoredColors series.data jSlot.castSucc → sigma f = series.data.coloring + jSlot.castSucc f := by + classical + intro V E _ _ _ G k e0 input rounds series jSlot q hjle hqTerminal sigma hsigmaStable this + segment incidentTransfer finalSets f hf c hfc hc + have hinc : TreeIncidentEdge (series.data.tree jSlot.succ.castSucc) f := by + have hforall := (Finset.mem_filter.mp hf).2 + change ∃ v, v ∈ TreeSequenceVertexSet + (series.data.tree jSlot.succ.castSucc) ∧ v ∈ G.ends f + induction hends : G.ends f using Sym2.inductionOn with + | _ x y => + have hx : Incident G x f := by + change x ∈ G.ends f + rw [hends] + exact Sym2.mem_mk_left x y + refine ⟨x, hforall x hx, ?_⟩ + exact Sym2.mem_mk_left x y + have preserved := SameColorSeriesPreserved G k rounds e0 input series + jSlot q hjle f c hinc hfc hc + have hqcolor := preserved.2 hf + have incidentForward : TreeIncidentEdge + (series.data.tree q.succ.castSucc) f := by + have carry : ∀ (n : ℕ), jSlot.val ≤ n → n ≤ q.val → + ∀ r : Fin rounds, r.val = n → + TreeIncidentEdge (series.data.tree r.succ.castSucc) f := by + intro n hjn + induction n, hjn using Nat.le_induction with + | base => + intro hnq r hr + have heq : r = jSlot := by apply Fin.ext; omega + rw [heq] + exact hinc + | succ n hn ih => + intro hnq r hr + let prev : Fin rounds := ⟨n, by omega⟩ + have hold := ih (by omega) prev rfl + have hnew := incidentTransfer (segment prev.succ prev rfl) hold + have heq : r = ⟨n + 1, by omega⟩ := by apply Fin.ext; omega + rw [heq] + have htree : prev.succ.succ = + (⟨n + 1, by omega⟩ : Fin rounds).succ.castSucc := by + apply Fin.ext + simp [prev] + rw [htree] at hnew + exact hnew + exact carry q.val (by omega) le_rfl q rfl + have hmem := (HkuMissingStoredMonotone G k rounds e0 input series q).1 + (finalSets hc) + have hstable := hsigmaStable.1 f + incidentForward + (by exact ⟨c, hmem, by rw [hqcolor, hfc]⟩) + exact hstable.trans hqcolor + +theorem ExtensionBaseClaimTreeEdgeColors {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (rounds : ℕ) (series : TashkinovSeries G k rounds e0 input) + (jSlot q : Fin rounds) (hjle : jSlot.val ≤ q.val) + (hqTerminal : q.val + 1 = rounds) + (sigma : PartialEdgeColoring E k) + (_ : IsProperEdgeColoring G sigma) + (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : StableColoring + (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.succ) + (series.data.coloring q.succ) sigma) : + (∀ f : E, + f ∈ InternalEdges G + (TreeSequenceVertexSet (series.data.tree jSlot.succ.castSucc)) → + ∀ c : Fin k, + series.data.coloring jSlot.castSucc f = some c → + c ∈ TreeMissingColors (series.data.coloring jSlot.castSucc) + (series.data.tree jSlot.succ.castSucc) ∪ + TashkinovStoredColors series.data jSlot.castSucc → + sigma f = series.data.coloring jSlot.castSucc f) ∧ + ∀ a : Fin (series.data.tree jSlot.succ.castSucc).length, + sigma ((series.data.tree jSlot.succ.castSucc).edge a) = + series.data.coloring jSlot.castSucc + ((series.data.tree jSlot.succ.castSucc).edge a) := by + classical + exact ((by + classical + let : DecidableEq V := Classical.decEq V + have segment := @helper_segment_61 V E inferInstance inferInstance inferInstance G k e0 input + rounds series + have vertexTransfer {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨x, hx⟩ + rcases hab with ⟨hlen, hvertices, hedges⟩ + unfold TreeSequenceVertexSet + apply Finset.mem_image.mpr + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) x, Finset.mem_univ _, ?_⟩ + exact (hvertices x).trans hx + have incidentTransfer {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {f : E} + (hf : TreeIncidentEdge A f) : TreeIncidentEdge B f := by + rcases hf with ⟨v, hv, hve⟩ + exact ⟨v, vertexTransfer hab hv, hve⟩ + have setTransfer := @helper_setTransfer_118 V E inferInstance inferInstance inferInstance G k e0 + input rounds series jSlot q hqTerminal segment vertexTransfer + have finalSets := setTransfer q.val (by omega) le_rfl q rfl + have internalClaim := @helper_internalClaim_170 V E inferInstance inferInstance inferInstance G k + e0 input rounds series jSlot q hjle hqTerminal sigma hsigmaStable segment incidentTransfer + finalSets + refine ⟨internalClaim, ?_⟩ + intro a + have stageOne : IsOneEdgeUncolored + (series.data.coloring jSlot.castSucc) e0 := by + generalize hz : jSlot.castSucc = z + cases series.certified z with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + simpa only [initialColoring] using triple.2.2.2.2 + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedOneUncolored + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact currentOneUncolored + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [currentColoring] + exact previousOneUncolored + by_cases ha : a.val = 0 + · have hea : (series.data.tree jSlot.succ.castSucc).edge a = e0 := by + have hz : a = ⟨0, (series.data.tree jSlot.succ.castSucc).positive⟩ := by + apply Fin.ext + omega + rw [hz] + exact (series.data.tree jSlot.succ.castSucc).first_edge + rw [hea, hsigmaOne.1] + exact stageOne.1.symm + · have used : (series.data.tree jSlot.succ.castSucc).edge a ∈ + InternalEdges G (TreeSequenceVertexSet + (series.data.tree jSlot.succ.castSucc)) := by + have hforall : ∀ v, Incident G v + ((series.data.tree jSlot.succ.castSucc).edge a) → + v ∈ TreeSequenceVertexSet (series.data.tree jSlot.succ.castSucc) := by + intro v hv + have hatt := (series.data.tree jSlot.succ.castSucc).attaches a + rcases hatt with ⟨i, hi⟩ + change v ∈ G.ends ((series.data.tree jSlot.succ.castSucc).edge a) at hv + rw [hi] at hv + simp only [Fin.castSucc_succ, Sym2.mem_iff] at hv + rcases hv with hv | hv + · apply Finset.mem_image.mpr + exact ⟨a.succ, Finset.mem_univ _, by simpa using hv.symm⟩ + · apply Finset.mem_image.mpr + exact ⟨Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ a.isLt)), + Finset.mem_univ _, by simpa using hv.symm⟩ + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, hforall⟩ + have hedge : (series.data.tree jSlot.succ.castSucc).edge a ≠ e0 := by + intro he + have hz := (series.data.tree jSlot.succ.castSucc).edge_injective + (he.trans (series.data.tree jSlot.succ.castSucc).first_edge.symm) + apply ha + simpa using congrArg Fin.val hz + obtain ⟨c, hfc⟩ := stageOne.2 _ hedge + have colorMem := (HkuTreeColorsControlled G k rounds e0 input series jSlot).1 + have hused : ∃ c, series.data.coloring jSlot.castSucc + ((series.data.tree jSlot.succ.castSucc).edge a) = some c ∧ + c ∈ TreeUsedColors (series.data.coloring jSlot.castSucc) + (series.data.tree jSlot.succ.castSucc) := by + unfold TreeUsedColors + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨c, hfc, ?_⟩ + exact ⟨a, by omega, hfc⟩ + rcases hused with ⟨c, hfc, hcused⟩ + exact internalClaim _ used c hfc (colorMem hcused))) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClosure.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClosure.lean new file mode 100644 index 0000000000..f50a8dc4a2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClosure.lean @@ -0,0 +1,162 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport + +public import LeanPool.GoldbergSeymour.TashkinovClosureExists + +/-! +# Extension Base Closure + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseClosure {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 input T generating) + (rho1 : PartialEdgeColoring E k) (seed : TreeSequence G e0) + (terminalSupport : V) (supportColors : Finset (Fin k)) + (hseedSegment : TreeSequenceInitialSegment + (base.series.data.tree (Fin.last base.rounds).castSucc) seed) + (hseedStrict : + (base.series.data.tree (Fin.last base.rounds).castSucc).length < + seed.length) + (hseedEligible : + (base.series.data.kind (Fin.last base.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho1 + (base.series.data.tree (Fin.last base.rounds).castSucc) seed) ∨ + ((base.series.data.kind (Fin.last base.rounds) = + some TashkinovExtensionKind.SE ∨ + base.series.data.kind (Fin.last base.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + base.series.data.connectingEdges (Fin.last base.rounds) = {f} ∧ + TreeSequenceAdjoinEdge + (base.series.data.tree (Fin.last base.rounds).castSucc) + f adjoinSeed ∧ + TashkinovAugmentationSequence rho1 adjoinSeed seed)) + (hmod : ModColoring base rho1) (hMP : MaximumProperty base) + (hLowerElementary : ∀ (Tstar : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 base rho1 Tstar), + MaximumProperty corr.replacementETT → + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet Tstar)) : + ∃ (TjPrime : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 base rho1 TjPrime), + TashkinovClosure rho1 seed TjPrime ∧ + MaximumProperty corr.replacementETT ∧ + ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime) ∧ + (let awayMissing := + ((TreeSequenceVertexSet TjPrime).erase terminalSupport).biUnion + fun v => MissingColors G rho1 v + (awayMissing ∩ supportColors).Nonempty ∨ + awayMissing ∩ supportColors = ∅) := by + classical + let terminalTree : TreeSequence G e0 := + base.series.data.tree (Fin.last base.rounds).castSucc + have segmentTrans : + ∀ (A B C : TreeSequence G e0), TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C := by + intro A B C hab hbc + rcases hab with ⟨ab, hvab, heab⟩ + rcases hbc with ⟨bc, hvbc, hebc⟩ + have abc : A.length ≤ C.length := by omega + refine ⟨abc, ?_, ?_⟩ + · intro i + have hfirst := hvbc (Fin.castLE (Nat.succ_le_succ ab) i) + have hsecond := hvab i + have indexMatch : + Fin.castLE (Nat.succ_le_succ abc) i = + Fin.castLE (Nat.succ_le_succ bc) + (Fin.castLE (Nat.succ_le_succ ab) i) := by + apply Fin.ext + rfl + rw [indexMatch] + exact hfirst.trans hsecond + · intro j + have hfirst := hebc (Fin.castLE ab j) + have hsecond := heab j + have indexMatch : + Fin.castLE abc j = Fin.castLE bc (Fin.castLE ab j) := by + apply Fin.ext + rfl + rw [indexMatch] + exact hfirst.trans hsecond + have sequenceSegment : ∀ (A B : TreeSequence G e0), + TashkinovAugmentationSequence rho1 A B → + TreeSequenceInitialSegment A B := by + intro A B hseq + unfold TashkinovAugmentationSequence at hseq + induction hseq with + | refl => + exact ⟨Nat.le_refl _, by intro i; rfl, by intro j; rfl⟩ + | @tail B C hseq hstep ih => + rcases hstep with ⟨hlen, hsegment, color⟩ + exact segmentTrans A B C ih hsegment + obtain ⟨TjPrime, hclosure⟩ := TashkinovClosureExists rho1 seed + have seedSegment : TreeSequenceInitialSegment seed TjPrime := + sequenceSegment seed TjPrime hclosure.1 + have hprimeSegment : TreeSequenceInitialSegment terminalTree TjPrime := by + apply segmentTrans terminalTree seed TjPrime + · simpa [terminalTree] using hseedSegment + · exact seedSegment + have hprimeStrict : terminalTree.length < TjPrime.length := by + rcases seedSegment with ⟨hbound, hv, he⟩ + have hseedle : seed.length ≤ TjPrime.length := hbound + exact lt_of_lt_of_le (by simpa [terminalTree] using hseedStrict) hseedle + have eligiblePrime : + ((base.series.data.kind (Fin.last base.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho1 terminalTree TjPrime) ∨ + ((base.series.data.kind (Fin.last base.rounds) = + some TashkinovExtensionKind.SE ∨ + base.series.data.kind (Fin.last base.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + base.series.data.connectingEdges (Fin.last base.rounds) = {f} ∧ + TreeSequenceAdjoinEdge terminalTree f adjoinSeed ∧ + TashkinovAugmentationSequence rho1 adjoinSeed TjPrime)) := by + rcases hseedEligible with hpe | hse + · left + exact ⟨hpe.1, Relation.ReflTransGen.trans hpe.2 hclosure.1⟩ + · right + rcases hse with ⟨hkind, f, adjoinSeed, hf, hadjoin, hseq⟩ + exact ⟨hkind, f, adjoinSeed, hf, hadjoin, + Relation.ReflTransGen.trans hseq hclosure.1⟩ + have correspondence : + Nonempty (CorrespondingExtendedTashkinovTree G k e0 base rho1 TjPrime) := by + unfold ModColoring at hmod + exact hmod.2.2 TjPrime (by simpa [terminalTree] using hprimeSegment) + (by simpa [terminalTree] using hprimeStrict) (by simpa [terminalTree] using eligiblePrime) + obtain ⟨corr⟩ := correspondence + have transported : MaximumProperty corr.replacementETT := + MaximumPropertyTransport G k e0 base rho1 hmod TjPrime corr hMP + have elementary : ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime) := hLowerElementary TjPrime corr transported + refine ⟨TjPrime, corr, hclosure, transported, elementary, ?_⟩ + let awayMissing := + ((TreeSequenceVertexSet TjPrime).erase terminalSupport).biUnion + (fun v => MissingColors G rho1 v) + by_cases hnonempty : (awayMissing ∩ supportColors).Nonempty + · exact Or.inl hnonempty + · exact Or.inr (Finset.not_nonempty_iff_eq_empty.mp hnonempty) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseDeltaExclusion.lean b/LeanPool/GoldbergSeymour/ExtensionBaseDeltaExclusion.lean new file mode 100644 index 0000000000..a6fe962704 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseDeltaExclusion.lean @@ -0,0 +1,197 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseLeastActiveDeltaTransport +public import LeanPool.GoldbergSeymour.ExtensionBasePESlotDeltaNotMissing +public import LeanPool.GoldbergSeymour.ExtensionBaseStrictDeltaExclusion + +/-! +# Extension Base Delta Exclusion + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseDeltaExclusion {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (hqTerminal : q.val + 1 = ett.rounds) + (hqKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE) + (hqVertex : ett.series.data.chosenVertex q.succ = some terminalSupport) + (jSlot : Fin ett.rounds) + (hjSlot : jSlot.val + 1 = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) + (hLowerElementary : ∀ r : Fin ett.rounds, r.val < q.val → + ColoredVertexSetElementary G (ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc))) + (hLowerPartV : ∀ (r a : Fin ett.rounds), a.val < r.val → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc) sigma → + ∀ delta : Fin k, + DefectiveColor G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta → + ∀ v : V, + BoundaryColorVertex G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta v → + (∃ w : V, BoundaryColorVertex G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta w ∧ + TreeVertexOrder (ett.series.data.tree r.succ.castSucc) w v) → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T, + ETTFirstAppearanceIndex ett v hvFinal ≤ a.val + 1 → + ∀ va : V, + (ett.series.data.kind a.succ = + some TashkinovExtensionKind.PE ∨ + ett.series.data.kind a.succ = + some TashkinovExtensionKind.SE) → + ett.series.data.chosenVertex a.succ = some va → + v = va ∨ + TreeVertexOrder + (ett.series.data.tree r.succ.castSucc) v va) : + (∀ (s t : Fin ett.rounds) (vs vt : V) + (_ : vs ∈ TreeSequenceVertexSet T) + (_ : vt ∈ TreeSequenceVertexSet T) + (deltaT gammaS : Fin k), + s ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + s.val ≤ t.val → + ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.delta t.succ = some deltaT → + ett.series.data.gamma s.succ = some gammaS → + deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ + deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds) (vt : V) + (_ : vt ∈ TreeSequenceVertexSet T) (deltaT : Fin k), + t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.delta t.succ = some deltaT → + deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc) := by + classical + have pairExclusion : + ∀ (s t : Fin ett.rounds) (vs vt : V) (hvsFinal : vs ∈ TreeSequenceVertexSet T) (hvtFinal : vt + ∈ TreeSequenceVertexSet T) (deltaT : Fin k), s ∈ ExtensionBaseActiveIndices ett + terminalSupport hterminalSupport → t ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → s.val ≤ t.val → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) (ett.series.data.tree + s.succ.castSucc) := by + intro s t vs vt hvsFinal hvtFinal deltaT hsActive htActive hst + hsVertex htVertex htDelta + by_cases heq : s.val = t.val + · have hstEq : s = t := Fin.ext heq + subst t + have hsData := hsActive + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] at hsData + exact ExtensionBasePESlotDeltaNotMissing G k ett.rounds e0 input + ett.series s deltaT hsData.2.1 htDelta + · have hstrict : s.val < t.val := lt_of_le_of_ne hst heq + exact ExtensionBaseStrictDeltaExclusion ett terminalSupport + hterminalSupport q hqTerminal hqKind hqVertex hLowerElementary + hLowerPartV s t vs vt hvsFinal hvtFinal deltaT hsActive htActive + hstrict hsVertex htVertex htDelta + constructor + · intro s t vs vt hvsFinal hvtFinal deltaT gammaS hsActive htActive + hst hsVertex htVertex htDelta hsGamma + have hdelta := pairExclusion s t vs vt hvsFinal hvtFinal deltaT + hsActive htActive hst hsVertex htVertex htDelta + have hsData := hsActive + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] at hsData + have hsKind : ett.series.data.kind s.succ = + some TashkinovExtensionKind.PE := hsData.2.1 + have hgammaMissing : gammaS ∈ + TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) := by + have step := ett.series.certified s.succ + generalize hz : s.succ = z at step + cases step with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val hz + simp at hv + | SE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hrs : r = s := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + rw [currentKind] at hsKind + simp at hsKind + | RE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have hrs : r = s := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + rw [currentKind] at hsKind + simp at hsKind + | PE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hrs : r = s := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + have hgamma : gamma = gammaS := by + rw [currentGamma] at hsGamma + exact Option.some.inj hsGamma + subst gammaS + simp only [TreeMissingColors, Finset.mem_biUnion] + refine ⟨choice.vertex, choice.vertexDefective.1, ?_⟩ + rw [← choice.selectedStable.2 choice.vertex + choice.vertexDefective.1] + exact gammaRule.1 + refine ⟨hdelta, ?_⟩ + intro heq + apply hdelta + simpa [heq] using hgammaMissing + · exact ExtensionBaseLeastActiveDeltaTransport ett terminalSupport + hterminalSupport q hqTerminal hqKind hqVertex jSlot hjSlot + pairExclusion + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseLeastActiveDeltaTransport.lean b/LeanPool/GoldbergSeymour/ExtensionBaseLeastActiveDeltaTransport.lean new file mode 100644 index 0000000000..8cc384ed8d --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseLeastActiveDeltaTransport.lean @@ -0,0 +1,314 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseActiveIndices +public import LeanPool.GoldbergSeymour.ExtensionRulesPEFirstAppearanceBound +public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Extension Base Least Active Delta Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ExtensionBaseLeastActiveDeltaTransport_nextSegment_68.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] {G : + LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} {T : + TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k + e0 input T generating), ∀ terminalSupport ∈ TreeSequenceVertexSet T, ∀ (_ _ : Fin + ett.rounds), let series := ett.series; ∀ (i : Fin ett.rounds), TreeSequenceInitialSegment + (series.data.tree i.succ.castSucc) (series.data.tree i.succ.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q jSlot series i + have step := series.certified i.succ + generalize hz : i.succ = z at step + cases step with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val hz + simp at hv + | SE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hri : r = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + exact orderedExtension + | PE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hri : r = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + exact orderedExtension + | RE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hri : r = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + exact orderedExtension + +private theorem ExtensionBaseLeastActiveDeltaTransport_branch_235.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds), (↑q : ℕ) + 1 = ett.rounds + → + ∀ (jSlot : Fin ett.rounds), (↑jSlot : ℕ) + 1 = ETTFirstAppearanceIndex ett terminalSupport + hterminalSupport → + let series := ett.series; ( + ∀ (a b : Fin ett.rounds), (↑a : ℕ) ≤ (↑b : ℕ) → TreeSequenceInitialSegment (series.data.tree + a.succ.castSucc) (series.data.tree b.succ.castSucc)) → + let active := ExtensionBaseActiveIndices ett terminalSupport hterminalSupport; + ∀ (activeNonempty : active.Nonempty), + let s0 := active.min' activeNonempty; ( + ∀ r ∈ active, (↑s0 : ℕ) ≤ (↑r : ℕ)) → + ∀ vs0 ∈ TreeSequenceVertexSet T, (↑jSlot : ℕ) ≤ (↑s0 : ℕ) → TreeSequenceVertexSet + (series.data.tree jSlot.succ.castSucc) ⊆ TreeSequenceVertexSet T → ( + ∀ (x : V) (hxFinal : x ∈ TreeSequenceVertexSet T), x ∈ TreeSequenceVertexSet (series.data.tree + jSlot.succ.castSucc) → ETTFirstAppearanceIndex ett x hxFinal ≤ (↑jSlot : ℕ) + 1) → + ∀ (_ : Fin ett.rounds), + ∀ deltaT ∉ TreeMissingColors (series.data.coloring s0.castSucc) (series.data.tree + s0.succ.castSucc), ¬(↑jSlot : ℕ) = (↑s0 : ℕ) → deltaT ∉ TreeMissingColors + (ett.series.data.coloring jSlot.castSucc) (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q hqTerminal + jSlot hjSlot series stageSegment active activeNonempty s0 hs0Least vs0 hvs0Final hjleS0 + jFinalSubset firstBound t deltaT hs0Exclusion hjEq + have hjlt : jSlot.val < s0.val := lt_of_le_of_ne hjleS0 hjEq + let before : Fin ett.rounds := ⟨s0.val - 1, by omega⟩ + have hbeforeSucc : before.succ = s0.castSucc := by + apply Fin.ext + simp [before] + omega + have hjBefore : jSlot.val ≤ before.val := by + simp [before] + omega + intro hmissingJ + simp only [TreeMissingColors, Finset.mem_biUnion] at hmissingJ + obtain ⟨x, hxJ, hxMissingJ⟩ := hmissingJ + have hxFinal := jFinalSubset hxJ + have hxFirst := firstBound x hxFinal hxJ + have hunused : + ∀ r : Fin ett.rounds, jSlot.val ≤ r.val → r.val ≤ before.val → ¬ (series.data.kind r.succ = + some TashkinovExtensionKind.PE ∧ series.data.chosenVertex r.succ = some x) := by + intro r hjr hrb hrPE + have hrActive : r ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport := by + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] + refine ⟨?_, hrPE.1, x, hrPE.2, hxFinal, ?_⟩ + · omega + · calc + ETTFirstAppearanceIndex ett x hxFinal ≤ jSlot.val + 1 := hxFirst + _ = ETTFirstAppearanceIndex ett terminalSupport + hterminalSupport := hjSlot + have hs0r := hs0Least r (by simpa [active] using hrActive) + have hrBefore : r.val ≤ s0.val - 1 := by + simpa [before] using hrb + omega + have hxEq := HkuUnsupportedVertexColors G k ett.rounds e0 input series + before jSlot x hjBefore hxJ hunused + apply hs0Exclusion + simp only [TreeMissingColors, Finset.mem_biUnion] + have hxS0 := TreeSequenceInitialSegmentVertexSetSubset + (stageSegment jSlot s0 hjleS0) hxJ + refine ⟨x, hxS0, ?_⟩ + rw [← hbeforeSucc] + rw [← hxEq] + exact hxMissingJ + +theorem ExtensionBaseLeastActiveDeltaTransport {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (hqTerminal : q.val + 1 = ett.rounds) + (hqKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE) + (hqVertex : ett.series.data.chosenVertex q.succ = some terminalSupport) + (jSlot : Fin ett.rounds) + (hjSlot : jSlot.val + 1 = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) + (hpair : ∀ (s t : Fin ett.rounds) (vs vt : V) + (_ : vs ∈ TreeSequenceVertexSet T) + (_ : vt ∈ TreeSequenceVertexSet T) + (deltaT : Fin k), + s ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + s.val ≤ t.val → + ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.delta t.succ = some deltaT → + deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc)) : + ∀ (t : Fin ett.rounds) (vt : V) (_ : vt ∈ TreeSequenceVertexSet T) (deltaT : Fin k), t ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc) := by + classical + let series := ett.series + have nextSegment (i : Fin ett.rounds) : + TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) + (series.data.tree i.succ.succ) := by + exact @ExtensionBaseLeastActiveDeltaTransport_nextSegment_68 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport hterminalSupport q jSlot i + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, by intro i; rfl, by intro i; rfl⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + obtain ⟨hABlen, hABv, hABe⟩ := hAB + obtain ⟨hBClen, hBCv, hBCe⟩ := hBC + refine ⟨hABlen.trans hBClen, ?_, ?_⟩ + · intro i + calc + C.vertex (Fin.castLE (Nat.succ_le_succ (hABlen.trans hBClen)) i) = + B.vertex (Fin.castLE (Nat.succ_le_succ hABlen) i) := by + simpa only [Fin.castLE] using + hBCv (Fin.castLE (Nat.succ_le_succ hABlen) i) + _ = A.vertex i := hABv i + · intro i + calc + C.edge (Fin.castLE (hABlen.trans hBClen) i) = + B.edge (Fin.castLE hABlen i) := by + simpa only [Fin.castLE] using hBCe (Fin.castLE hABlen i) + _ = A.edge i := hABe i + have stageSegment : ∀ (a b : Fin ett.rounds), a.val ≤ b.val → + TreeSequenceInitialSegment (series.data.tree a.succ.castSucc) + (series.data.tree b.succ.castSucc) := by + intro a b hab + have claim : ∀ (n : ℕ), a.val ≤ n → n < ett.rounds → + ∀ r : Fin ett.rounds, r.val = n → + TreeSequenceInitialSegment (series.data.tree a.succ.castSucc) + (series.data.tree r.succ.castSucc) := by + intro n han + induction n, han using Nat.le_induction with + | base => + intro hn r hr + have hra : r = a := by apply Fin.ext; omega + subst r + exact segmentRefl _ + | succ n hn ih => + intro hrounds r hr + let p : Fin ett.rounds := ⟨n, by omega⟩ + have hprev := ih (by omega) p rfl + have hnext := nextSegment p + have htree : p.succ.succ = r.succ.castSucc := by + apply Fin.ext + simp [p, hr] + rw [htree] at hnext + exact segmentTrans hprev hnext + exact claim b.val hab b.isLt b rfl + have qBound : ETTFirstAppearanceIndex ett terminalSupport + hterminalSupport ≤ q.val + 1 := + ExtensionRulesPEFirstAppearanceBound G k e0 input T generating ett q + terminalSupport hqKind hqVertex hterminalSupport + have qActive : q ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport := by + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨qBound, hqKind, terminalSupport, hqVertex, + hterminalSupport, le_rfl⟩ + let active := ExtensionBaseActiveIndices ett terminalSupport hterminalSupport + have activeNonempty : active.Nonempty := ⟨q, qActive⟩ + let s0 : Fin ett.rounds := active.min' activeNonempty + have hs0Active : s0 ∈ active := Finset.min'_mem active activeNonempty + have hs0Least : ∀ r : Fin ett.rounds, r ∈ active → s0.val ≤ r.val := by + intro r hr + exact Fin.le_iff_val_le_val.mp (Finset.min'_le active r hr) + have hs0Data := hs0Active + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and, + active] at hs0Data + obtain ⟨hs0Lower, hs0Kind, vs0, hs0Vertex, hvs0Final, + hvs0First⟩ := hs0Data + have hjleS0 : jSlot.val ≤ s0.val := by omega + have hjleQ : jSlot.val ≤ q.val := by omega + have jFinalSegment : TreeSequenceInitialSegment + (series.data.tree jSlot.succ.castSucc) T := by + have hjq := stageSegment jSlot q hjleQ + have htree : q.succ.castSucc = (⟨ett.rounds, by omega⟩ : + Fin (ett.rounds + 2)) := by + apply Fin.ext + simp only [Fin.castSucc_succ, Fin.val_succ, Fin.val_castSucc] + exact hqTerminal + rw [htree] at hjq + exact segmentTrans hjq ett.abovePenultimate + have jFinalSubset := TreeSequenceInitialSegmentVertexSetSubset jFinalSegment + have firstBound : + ∀ (x : V) (hxFinal : x ∈ TreeSequenceVertexSet T), x ∈ TreeSequenceVertexSet (series.data.tree + jSlot.succ.castSucc) → ETTFirstAppearanceIndex ett x hxFinal ≤ jSlot.val + 1 := by + intro x hxFinal hxJ + unfold ETTFirstAppearanceIndex + dsimp + have hmem : jSlot.castSucc ∈ + Finset.univ.filter (fun i : Fin (ett.rounds + 1) => + x ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett i)) := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + simpa [ExtendedTashkinovLadderStage, Fin.lastCases_castSucc, series] + using hxJ + have hle := Finset.min'_le + (Finset.univ.filter (fun i : Fin (ett.rounds + 1) => + x ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i))) + jSlot.castSucc hmem + have hnat := Fin.le_iff_val_le_val.mp hle + rw [Fin.val_castSucc] at hnat + convert Nat.succ_le_succ hnat using 1 + intro t vt hvtFinal deltaT htActive htVertex htDelta + have hs0leT := hs0Least t (by simpa [active] using htActive) + have hs0Exclusion : deltaT ∉ + TreeMissingColors (series.data.coloring s0.castSucc) + (series.data.tree s0.succ.castSucc) := by + exact hpair s0 t vs0 vt hvs0Final hvtFinal deltaT + (by simpa [active] using hs0Active) htActive hs0leT hs0Vertex + htVertex htDelta + by_cases hjEq : jSlot.val = s0.val + · have hindices : jSlot = s0 := Fin.ext hjEq + simpa [series, hindices] using hs0Exclusion + · exact @ExtensionBaseLeastActiveDeltaTransport_branch_235 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport hterminalSupport + q hqTerminal jSlot hjSlot stageSegment activeNonempty hs0Least vs0 hvs0Final hjleS0 + jFinalSubset firstBound t deltaT hs0Exclusion hjEq +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBasePESlotDeltaNotMissing.lean b/LeanPool/GoldbergSeymour/ExtensionBasePESlotDeltaNotMissing.lean new file mode 100644 index 0000000000..96b76ffe42 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBasePESlotDeltaNotMissing.lean @@ -0,0 +1,120 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeries + +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion + +/-! +# Extension Base PESlot Delta Not Missing + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBasePESlotDeltaNotMissing {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) + (r : Fin rounds) (delta : Fin k) + (hkind : series.data.kind r.succ = some TashkinovExtensionKind.PE) + (hdelta : series.data.delta r.succ = some delta) : + delta ∉ TreeMissingColors (series.data.coloring r.castSucc) + (series.data.tree r.succ.castSucc) := by + classical + have step := series.certified r.succ + generalize hz : r.succ = z at step + cases step with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val hz + simp at hv + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hir : i = r := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst i + rw [currentKind] at hkind + simp at hkind + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hir : i = r := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst i + rw [currentKind] at hkind + simp at hkind + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hir : i = r := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst i + have hcolor : choice.color = delta := by + rw [currentDelta] at hdelta + exact Option.some.inj hdelta + subst delta + intro hmissing + simp only [TreeMissingColors, Finset.mem_biUnion] at hmissing + obtain ⟨v, hv, hvmissing⟩ := hmissing + have hselectedMissing : choice.color ∈ MissingColors G choice.selected v := by + rw [choice.selectedStable.2 v hv] + exact hvmissing + have hedgeIncident : TreeIncidentEdge + (series.data.tree r.succ.castSucc) choice.edge := + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + have hrefColor : series.data.coloring r.castSucc choice.edge = + some choice.color := by + have hcontrolled : choice.color ∈ + TreeMissingColors (series.data.coloring r.castSucc) + (series.data.tree r.succ.castSucc) ∪ + TashkinovStoredColors series.data r.castSucc := + Finset.mem_union_left _ (by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, hvmissing⟩) + have hfixed := (sc1 G e0 (series.data.tree r.succ.castSucc) + (TashkinovStoredColors series.data r.castSucc) + (series.data.coloring r.castSucc) choice.selected + previousProper previousOneUncolored choice.selectedProper + choice.selectedOneUncolored).mp choice.selectedStable choice.edge + hedgeIncident (Or.inr ⟨choice.color, hcontrolled, + choice.edgeColor⟩) + exact hfixed.symm.trans choice.edgeColor + obtain ⟨alpha, hdefective, hedgeColor⟩ := choice.edgeDefective + have hedgeBoundary : choice.edge ∈ BoundaryEdges G + (TreeSequenceVertexSet (series.data.tree r.succ.castSucc)) := by + exact (Finset.mem_filter.mp hedgeColor).1 + exact previousClosed hedgeBoundary hv hrefColor hvmissing + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBasePreparations.lean b/LeanPool/GoldbergSeymour/ExtensionBasePreparations.lean new file mode 100644 index 0000000000..fcc85df47b --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBasePreparations.lean @@ -0,0 +1,1151 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary + +public import LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary + +/-! +# Preparatory lemmas for the extension base + +Part of Wesley Pegden’s Trellis formalization of the Goldberg–Seymour theorem, +commit 88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. These lemmas establish the +base cases used by the extension construction. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ExtensionBaseProof + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch880Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → IsOneEdgeUncolored rho1 e0 → StableColoringBeforeVertex T v + hvFinal (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho1 → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v → + ∀ (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; (0 : ℕ) < (↑jSlot : ℕ) → + ∃ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime ∧ + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) ∧ + let awayMissing : Finset (Fin k) := ((TreeSequenceVertexSet TjPrime).erase v).biUnion fun (x : + V) ↦ MissingColors G rho1 x; (awayMissing ∩ supportColors : Finset (Fin k)).Nonempty ∨ + (awayMissing ∩ supportColors : Finset (Fin k)) = ∅ + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch1756Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (sigma : PartialEdgeColoring E k), + ∀ (computedIndex18 : Fin ett.rounds), computedIndex18 = (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) → + ∀ (hqTerminal : (↑computedIndex18 : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ + TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ + (↑computedIndex18 : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett + v hvFinal), + ∀ (computedIndex23 : Fin ett.rounds), computedIndex23 = (⟨ETTFirstAppearanceIndex ett v + hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) → (↑computedIndex23 : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal + → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree ((computedIndex23).succ).castSucc)) (p0 : ℕ) + (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree ((computedIndex23).succ).castSucc).length + + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + ((computedIndex23).succ).castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree + ((computedIndex23).succ).castSucc) (↑terminalPosition : ℕ) hterminalPositionPositive + hterminalPositionBound; ((computedIndex23).castSucc).succ = + ((computedIndex23).succ).castSucc → TreeSequenceInitialSegment seed (ett.series.data.tree + ((computedIndex23).succ).castSucc) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0), indices0 (Fin.last p0) = computedIndex18 → + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 + indices0 b), u ∉ TreeSequenceVertexSet (ett.series.data.tree + ((computedIndex23).succ).castSucc) → + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + StableColoringBeforeVertex (ett.series.data.tree ((computedIndex23).succ).castSucc) v + hterminalJ (TashkinovStoredColors ett.series.data (computedIndex23).castSucc) + (ett.series.data.coloring (computedIndex23).castSucc) (traceB.coloring (Fin.last + traceB.steps)) → IsProperEdgeColoring G rho2 → IsOneEdgeUncolored rho2 e0 → + ∀ (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree + ((computedIndex23).castSucc).castSucc; ( (0 : ℕ) < (↑computedIndex23 : ℕ) → + TreeSequenceInitialSegment Tprevious (ett.series.data.tree + ((computedIndex23).succ).castSucc)) → ( (0 : ℕ) < (↑computedIndex23 : ℕ) → + Tprevious.length < seed.length) → ( (0 : ℕ) < (↑computedIndex23 : ℕ) → + TreeSequenceInitialSegment Tprevious seed) → + let Tj0 : TreeSequence G e0 := ett.series.data.tree ((computedIndex23).succ).castSucc; + ∀ (C : TreeSequence G e0), TashkinovAugmentationSequence rho2 seed C → ColoredVertexSetClosed + G rho2 (TreeSequenceVertexSet C) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore (ett.series.data.tree + ((computedIndex23).succ).castSucc) v hterminalJ) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + (computedIndex23).castSucc) S seed → TashkinovAugmentationSequence rho2 S seed) → u ∈ + TreeSequenceVertexSet C → TreeSequenceVertexSet Tj0 ⊂ TreeSequenceVertexSet C → (0 : ℕ) < + (↑computedIndex23 : ℕ) → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperHclaim45Package6912Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → IsOneEdgeUncolored rho1 e0 → ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → seed.vertex + (Fin.last seed.length) = v → TreeSequenceInitialSegment (ett.series.data.tree + jSlot.succ.castSucc) (ett.series.data.tree q.succ.castSucc) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime → + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) → + TreeSequenceInitialSegment seed TjPrime → StableColoringBeforeVertex (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho1 → ( + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅) → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); gamma ∈ supportColors → delta ∈ + supportColors → gamma ≠ delta → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → delta ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) (ett.series.data.tree + jSlot.succ.castSucc) → v ∈ TreeSequenceVertexSet seed → + ∀ (fN : E), delta ∈ MissingColors G rho1 v → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)), componentPath.IsPath → + {z : V ⊕ E | z ∈ componentPath.support} = C → x ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet TjPrime → + ∀ (u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl + u)), exitPath.IsPath → (2 : ℕ) ≤ exitPath.length → ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support) → ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) → ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) → + ¬Incident G u fN → u ∈ TreeSequenceVertexSet TjPrime → u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → MaximumDegree G + (1 : ℕ) ≤ k → + ∀ beta ∈ MissingColors G rho1 u, beta ∉ supportColors → TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) seed (ett.series.data.tree jSlot.succ.castSucc) + → + ∀ (z : V) (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z → seed.length ≤ + (↑zPosition : ℕ) → ((seed.length < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) → + ( + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) → ( (0 : ℕ) < p0 → + ∃ (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (_ : u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (exitPath : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u)), exitPath.IsPath ∧ (2 : ℕ) ≤ exitPath.length ∧ ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) ∧ ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ + ¬Incident G u fN ∧ + ∀ beta ∈ MissingColors G rho1 u, + ∃ (z : V) (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z ∧ seed.length ≤ + (↑zPosition : ℕ) ∧ ((seed.length < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + ( + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) ∧ ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) ∧ + ∃ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 ∧ IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 ∧ ( + ∀ v ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz ∪ ({ z } : Finset + V) ∪ (TreeVerticesBefore TjPrime u huPrime ∪ ({ u } : Finset V))).erase u).erase z, + MissingColors G rho3 v = MissingColors G rho1 v) ∧ ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) ∧ ( + beta ∈ MissingColors G rho1 z → delta ∈ MissingColors G rho3 z) ∧ ( z ∈ TreeVerticesBefore + TjPrime u huPrime → MissingColors G rho3 z = MissingColors G rho1 z) ∧ gammaFirst ∈ + MissingColors G rho3 u) → ( p0 = (0 : ℕ) → gammaFirst = gamma) → + ∃ (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (_ : u0 ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (exitPath0 : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u0)), exitPath0.IsPath ∧ (2 : ℕ) ≤ exitPath0.length ∧ ( + ∀ y ∈ exitPath0.support, y ∈ componentPath.support) ∧ ( + ∀ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl y ∈ exitPath0.support ↔ y = u0) ∧ ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u0 g ∧ Sum.inr g ∈ exitPath0.support) ∧ + ¬Incident G u0 fN ∧ + ∃ beta0 ∈ MissingColors G rho1 u0, beta0 ∉ supportColors ∧ + ∃ (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition0 = z0 ∧ seed.length ≤ + (↑zPosition0 : ℕ) ∧ ((seed.length < (↑zPosition0 : ℕ) ∧ beta0 ∈ MissingColors G rho1 z0 ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition0 : ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition0 = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + ( + ∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0, beta0 ∉ + MissingColors G rho1 y) ∧ ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition0 : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta0) ∧ + ∃ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 ∧ IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 ∧ ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) ∧ ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) ∧ ( + beta0 ∈ MissingColors G rho1 z0 → delta ∈ MissingColors G rho3 z0) ∧ ( z0 ∈ + TreeVerticesBefore TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 + z0) ∧ gammaFirst ∈ MissingColors G rho3 u0 + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperCaseContinuation11664Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (hseedTj : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)), + seed.vertex (Fin.last seed.length) = v → TreeSequenceInitialSegment (ett.series.data.tree + jSlot.succ.castSucc) (ett.series.data.tree q.succ.castSucc) → ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0), delta ∈ MissingColors G rho1 v → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) (zPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + ∀ u0 ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), + ∀ (exitPath0 : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (beta0 : Fin k) (z0 : V) (zPosition0 : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))), (ett.series.data.tree jSlot.succ.castSucc).vertex + zPosition0 = z0 → + ∀ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 → IsOneEdgeUncolored rho3 e0 → + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 → ( beta0 ∈ MissingColors G rho1 z0 → delta ∈ MissingColors G rho3 + z0) → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), + let terminalInTj : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ)) := + Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive seed + have := Fin.isLt jSlot + have := Fin.isLt terminalPosition + have := GoldbergSeymour.TreeSequence.positive seed + have := + GoldbergSeymour.TreeSequence.positive + (ett.series.data.tree jSlot.succ.castSucc) + have := hseedTj.1 + omega + ) (Fin.last seed.length); (ett.series.data.tree jSlot.succ.castSucc).vertex terminalInTj = v → + ¬z0 = v → zPosition0 = Fin.last (ett.series.data.tree jSlot.succ.castSucc).length ∨ + (↑zPosition0 : ℕ) < (↑(Fin.last (ett.series.data.tree jSlot.succ.castSucc).length) : ℕ) ∧ + beta0 ∈ MissingColors G rho1 z0 → (↑jSlot : ℕ) = (0 : ℕ) → + ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition0 : ℕ)) (hzPositionBound : + (↑zPosition0 : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑zPosition0 : ℕ) hzPositionPositive hzPositionBound; TreeSequenceInitialSegment Z + (ett.series.data.tree jSlot.succ.castSucc) → TreeSequenceInitialSegment seed Z → + TashkinovAugmentationSequence rho3 seed U → MissingColors G rho3 v = MissingColors G rho1 + v → + ∀ (M : TreeSequence G e0), OrderedTreeUnion U Z M → u0 ∈ TreeSequenceVertexSet U → + TashkinovAugmentationSequence rho3 U M → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperCaseContinuation10866Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v) → ¬w = v → + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), q.succ = Fin.last ett.rounds → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → ett.series.data.gamma q.succ = some gamma → + ett.series.data.delta q.succ = some delta → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) → ( + ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = (insert + gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k))) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)), q ∈ + ExtensionBaseActiveIndices ett v hvFinal → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : + ℕ)) → Fin k), ( + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + → ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.gamma (indices0 a).succ = some (gamma0 a)) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) → ( + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) → Function.Injective (Fin.cons (gamma0 (0 : + Fin (p0 + (1 : ℕ)))) delta0) → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → IsOneEdgeUncolored rho1 e0 → ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → ( + ∀ (f : E), rho1 f ≠ sigma f → f ∉ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) ∧ + ∃ (c : Fin k) (d : Fin k), sigma f = some c ∧ rho1 f = some d ∧ (c ∈ + (ExtensionBaseRestorationIndices ett v hvFinal).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) ∧ d ∈ (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v → + ∀ (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → seed.vertex (Fin.last seed.length) = v → + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) → ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime → + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) → + TreeSequenceInitialSegment seed TjPrime → v ∈ TreeSequenceVertexSet TjPrime → indices0 + (Fin.last p0) = q → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.chosenVertex (indices0 a).succ = some v) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.kind (indices0 a).succ = some + TashkinovExtensionKind.PE) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) → (MissingColors G rho1 v ∩ supportColors + : Finset (Fin k)) = ({delta0 (Fin.last p0)} : Finset (Fin k)) → StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ (TashkinovStoredColors + ett.series.data jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho1 → ( + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅) → (supportColors = (ExtensionBaseSupportClass ett v hvFinal + v).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ) → q ∈ + ExtensionBaseSupportClass ett v hvFinal v → gamma0 (Fin.last p0) = gamma → delta0 + (Fin.last p0) = delta → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); gamma ∈ supportColors → delta ∈ + supportColors → gammaFirst ∈ supportColors → gamma ≠ delta → + let restorationColors : Finset (Fin k) := (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ; gamma ∉ + restorationColors ∧ delta ∉ restorationColors → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → gammaS ∈ supportColors ∧ deltaS ∈ supportColors) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → delta ≠ gammaS ∧ delta ≠ deltaS) → ( (0 : ℕ) < p0 → + ∃ (preterminalSlot : Fin ett.rounds), (↑preterminalSlot : ℕ) < (↑q : ℕ) ∧ preterminalSlot ∈ + (ExtensionBaseSupportClass ett v hvFinal v).erase q ∧ ett.series.data.delta + preterminalSlot.succ = some gamma) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → ETTStrongInterchangeable ett s v rho1 gammaS deltaS) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree s.succ.castSucc), x ≠ v → + ∀ (y : V), Sum.inl y ∈ TwoColorComponent G rho1 gammaS deltaS (Sum.inl x) → y ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho1 v ∪ ({ gammaFirst } : + Finset (Fin k)) → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → delta ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) (ett.series.data.tree + jSlot.succ.castSucc) → v ∈ TreeSequenceVertexSet seed → TreeSequenceInitialSegment seed + (ett.series.data.tree q.succ.castSucc) → + ∀ (fN : E), ett.series.data.connectingEdges q.succ = ({ fN } : Finset E) → Incident G v fN → + IsProperEdgeColoring G (ett.series.data.coloring q.succ) → IsOneEdgeUncolored + (ett.series.data.coloring q.succ) e0 → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation10517Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc), ¬w = v → + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), q.succ = Fin.last ett.rounds → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → ett.series.data.gamma q.succ = some gamma → + ett.series.data.delta q.succ = some delta → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)), q ∈ + ExtensionBaseActiveIndices ett v hvFinal → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : + ℕ)) → Fin k), ( + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + → ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.gamma (indices0 a).succ = some (gamma0 a)) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) → ( + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) → Function.Injective (Fin.cons (gamma0 (0 : + Fin (p0 + (1 : ℕ)))) delta0) → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → IsOneEdgeUncolored rho1 e0 → ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → ( + ∀ (f : E), rho1 f ≠ sigma f → f ∉ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) ∧ + ∃ (c : Fin k) (d : Fin k), sigma f = some c ∧ rho1 f = some d ∧ (c ∈ + (ExtensionBaseRestorationIndices ett v hvFinal).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) ∧ d ∈ (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v → + ∀ (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → seed.vertex (Fin.last seed.length) = v → + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) → ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime → + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) → + TreeSequenceInitialSegment seed TjPrime → v ∈ TreeSequenceVertexSet TjPrime → indices0 + (Fin.last p0) = q → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.chosenVertex (indices0 a).succ = some v) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.kind (indices0 a).succ = some + TashkinovExtensionKind.PE) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) → StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ (TashkinovStoredColors + ett.series.data jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho1 → ( + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅) → (supportColors = (ExtensionBaseSupportClass ett v hvFinal + v).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ) → q ∈ + ExtensionBaseSupportClass ett v hvFinal v → gamma0 (Fin.last p0) = gamma → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); gamma ∈ supportColors → delta ∈ + supportColors → gammaFirst ∈ supportColors → gamma ≠ delta → + let restorationColors : Finset (Fin k) := (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ; gamma ∉ + restorationColors ∧ delta ∉ restorationColors → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → gammaS ∈ supportColors ∧ deltaS ∈ supportColors) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → delta ≠ gammaS ∧ delta ≠ deltaS) → ( (0 : ℕ) < p0 → + ∃ (preterminalSlot : Fin ett.rounds), (↑preterminalSlot : ℕ) < (↑q : ℕ) ∧ preterminalSlot ∈ + (ExtensionBaseSupportClass ett v hvFinal v).erase q ∧ ett.series.data.delta + preterminalSlot.succ = some gamma) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → ETTStrongInterchangeable ett s v rho1 gammaS deltaS) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree s.succ.castSucc), x ≠ v → + ∀ (y : V), Sum.inl y ∈ TwoColorComponent G rho1 gammaS deltaS (Sum.inl x) → y ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho1 v ∪ ({ gammaFirst } : + Finset (Fin k)) → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → delta ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) (ett.series.data.tree + jSlot.succ.castSucc) → v ∈ TreeSequenceVertexSet seed → TreeSequenceInitialSegment seed + (ett.series.data.tree q.succ.castSucc) → + ∀ (fN : E), Incident G v fN → IsProperEdgeColoring G (ett.series.data.coloring q.succ) → + IsOneEdgeUncolored (ett.series.data.coloring q.succ) e0 → BoundaryColorEdges G + (ett.series.data.coloring q.succ) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) gamma = ({ fN } : Finset E) → ( + ∀ f ∈ BoundaryColorEdges G (ett.series.data.coloring q.succ) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) delta, + ∃ y ∈ TreeSequenceVertexSet seed, Incident G y f) → delta ∈ MissingColors G rho1 v → + (MissingColors G rho1 v ∩ supportColors : Finset (Fin k)) = ({ delta } : Finset (Fin k)) → + let controlled : Finset (Fin k) := TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors ett.series.data q.succ; + gamma ∈ controlled → delta ∈ controlled → StableColoring (ett.series.data.tree + q.succ.castSucc) controlled (ett.series.data.coloring q.succ) sigma → BoundaryColorEdges G + rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) gamma = ({ fN } : + Finset E) → BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc) ∪ TreeSequenceVertexSet TjPrime) delta = ∅ → TwoColorIncidenceGraph G + sigma gamma delta = TwoColorIncidenceGraph G rho1 gamma delta → Sum.inl w ∈ + TwoColorComponent G rho1 gamma delta (Sum.inl v) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a b : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)), componentPath.IsPath + → {z : V ⊕ E | z ∈ componentPath.support} = C → ¬componentPath.Nil → (0 : ℕ) < + componentPath.length → Sum.inl x ∈ C → ( + ∀ (z : V ⊕ E), H.Adj (Sum.inl x) z → z = componentPath.getVert (componentPath.length - (1 : + ℕ))) → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation11325Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), ett.series.data.gamma q.succ = some gamma → + ett.series.data.delta q.succ = some delta → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), ( + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + → ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.gamma (indices0 a).succ = some (gamma0 a)) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) → ( + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) → Function.Injective (Fin.cons (gamma0 (0 : + Fin (p0 + (1 : ℕ)))) delta0) → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → IsOneEdgeUncolored rho1 e0 → ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → ( + ∀ (f : E), rho1 f ≠ sigma f → f ∉ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) ∧ + ∃ (c : Fin k) (d : Fin k), sigma f = some c ∧ rho1 f = some d ∧ (c ∈ + (ExtensionBaseRestorationIndices ett v hvFinal).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) ∧ d ∈ (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → seed.vertex (Fin.last seed.length) = v → + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) → ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime → + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) → + TreeSequenceInitialSegment seed TjPrime → v ∈ TreeSequenceVertexSet TjPrime → indices0 + (Fin.last p0) = q → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.chosenVertex (indices0 a).succ = some v) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.kind (indices0 a).succ = some + TashkinovExtensionKind.PE) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) → StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ (TashkinovStoredColors + ett.series.data jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho1 → ( + ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, (MissingColors G rho1 x ∩ supportColors : + Finset (Fin k)) = ∅) → (supportColors = (ExtensionBaseSupportClass ett v hvFinal + v).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ) → q ∈ + ExtensionBaseSupportClass ett v hvFinal v → gamma0 (Fin.last p0) = gamma → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); gamma ∈ supportColors → delta ∈ + supportColors → gammaFirst ∈ supportColors → gamma ≠ delta → + let restorationColors : Finset (Fin k) := (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ; gamma ∉ + restorationColors ∧ delta ∉ restorationColors → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → gammaS ∈ supportColors ∧ deltaS ∈ supportColors) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → delta ≠ gammaS ∧ delta ≠ deltaS) → ( (0 : ℕ) < p0 → + ∃ (preterminalSlot : Fin ett.rounds), (↑preterminalSlot : ℕ) < (↑q : ℕ) ∧ preterminalSlot ∈ + (ExtensionBaseSupportClass ett v hvFinal v).erase q ∧ ett.series.data.delta + preterminalSlot.succ = some gamma) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → ETTStrongInterchangeable ett s v rho1 gammaS deltaS) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree s.succ.castSucc), x ≠ v → + ∀ (y : V), Sum.inl y ∈ TwoColorComponent G rho1 gammaS deltaS (Sum.inl x) → y ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho1 v ∪ ({ gammaFirst } : + Finset (Fin k)) → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → delta ∉ + TreeMissingColors (ett.series.data.coloring jSlot.castSucc) (ett.series.data.tree + jSlot.succ.castSucc) → v ∈ TreeSequenceVertexSet seed → TreeSequenceInitialSegment seed + (ett.series.data.tree q.succ.castSucc) → + ∀ (fN : E), Incident G v fN → IsProperEdgeColoring G (ett.series.data.coloring q.succ) → + IsOneEdgeUncolored (ett.series.data.coloring q.succ) e0 → BoundaryColorEdges G + (ett.series.data.coloring q.succ) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) gamma = ({ fN } : Finset E) → ( + ∀ f ∈ BoundaryColorEdges G (ett.series.data.coloring q.succ) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) delta, + ∃ y ∈ TreeSequenceVertexSet seed, Incident G y f) → delta ∈ MissingColors G rho1 v → + (MissingColors G rho1 v ∩ supportColors : Finset (Fin k)) = ({ delta } : Finset (Fin k)) → + let controlled : Finset (Fin k) := TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors ett.series.data q.succ; + gamma ∈ controlled → delta ∈ controlled → StableColoring (ett.series.data.tree + q.succ.castSucc) controlled (ett.series.data.coloring q.succ) sigma → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a b : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)), componentPath.IsPath + → {z : V ⊕ E | z ∈ componentPath.support} = C → x ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet TjPrime → ( + ∃ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), y ≠ v ∧ Sum.inl y ∈ + componentPath.support) → + ∀ (u : V) (exitPath : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl + u)), exitPath.IsPath → (2 : ℕ) ≤ exitPath.length → ( + ∀ y ∈ exitPath.support, y ∈ componentPath.support) → ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl w ∈ exitPath.support ↔ w = u) → ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u g ∧ Sum.inr g ∈ exitPath.support) → + ¬Incident G u fN → u ∈ TreeSequenceVertexSet TjPrime → u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → MaximumDegree G + (1 : ℕ) ≤ k → + ∀ beta ∈ MissingColors G rho1 u, u ∈ (TreeSequenceVertexSet TjPrime).erase v → beta ∉ + supportColors → + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ( (0 : ℕ) < + (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious (ett.series.data.tree + jSlot.succ.castSucc)) → ( (0 : ℕ) < (↑jSlot : ℕ) → Tprevious.length < seed.length) → ( (0 + : ℕ) < (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious seed) → + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) seed + (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (z : V) (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z → seed.length ≤ + (↑zPosition : ℕ) → ((seed.length < (↑zPosition : ℕ) ∧ beta ∈ MissingColors G rho1 z ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition : ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) → + ( + ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, beta ∉ MissingColors + G rho1 w) → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta) → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperCaseContinuation13733Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v) → ¬w = v → + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), q.succ = Fin.last ett.rounds → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → ett.series.data.gamma q.succ = some gamma → + ett.series.data.delta q.succ = some delta → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → q.succ.castSucc = (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → (↑jSlot + : ℕ) ≤ (↑q : ℕ) → StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data + jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) sigma → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) < (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → vt = vs ∨ TreeVertexOrder T vt vs) ∧ ( + ∀ (s : Fin ett.rounds) (vs : V) (hvsFinal : vs ∈ TreeSequenceVertexSet T), s ∈ + ExtensionBaseActiveIndices ett v hvFinal → ett.series.data.chosenVertex s.succ = some vs → + ETTFirstAppearanceIndex ett vs hvsFinal = ETTFirstAppearanceIndex ett v hvFinal ∧ (v = vs + ∨ TreeVertexOrder T v vs)) ∧ + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → vs ≠ vt → TreeVertexOrder T vs vt → (↑t : + ℕ) < (↑s : ℕ)) → (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) → ( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (gammaS deltaS gammaT deltaT : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) < (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = some + deltaS → ett.series.data.gamma t.succ = some gammaT → ett.series.data.delta t.succ = some + deltaT → ((ett.series.data.stored s.succ ∩ ett.series.data.stored t.succ : Finset (Fin + k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseActiveIndices ett v hvFinal, (↑s : ℕ) < (↑r : ℕ) ∧ (↑r : ℕ) < (↑t : ℕ) ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ ( (ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ : Finset (Fin k)).Nonempty → (ett.series.data.stored s.succ + ∩ ett.series.data.stored t.succ : Finset (Fin k)) = ({ gammaT } : Finset (Fin k)) ∧ + (ett.series.data.stored s.succ ∩ ett.series.data.stored t.succ : Finset (Fin k)) = + ({ deltaS } : Finset (Fin k)))) → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation13931Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v) → ¬w = v → + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), q.succ = Fin.last ett.rounds → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → ett.series.data.gamma q.succ = some gamma → + ett.series.data.delta q.succ = some delta → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → q.succ.castSucc = (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → (↑jSlot + : ℕ) ≤ (↑q : ℕ) → StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data + jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) sigma → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) → ( + ∀ (t : Fin ett.rounds), ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT) → + ( + ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = (insert + gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k))) → ( + ∀ (u : V), (ExtensionBaseSupportClass ett v hvFinal u).Nonempty → + ∃ (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (gammaClass : Fin (p + (1 : ℕ)) → Fin + k) (deltaClass : Fin (p + (1 : ℕ)) → Fin k), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) ∧ + ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gammaClass a)) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (deltaClass a)) ∧ ( + ∀ (a : Fin p), gammaClass a.succ = deltaClass a.castSucc) ∧ Function.Injective (Fin.cons + (gammaClass (0 : Fin (p + (1 : ℕ)))) deltaClass) ∧ ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), ( + ∀ r ∈ ExtensionBaseActiveIndices ett v hvFinal, ett.series.data.chosenVertex r.succ ≠ some x) + → MissingColors G sigma x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + let storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p + (1 : ℕ))) ↦ + ett.series.data.stored (indices a).succ; (MissingColors G sigma u ∩ storedPairs : Finset + (Fin k)) = ({deltaClass (Fin.last p)} : Finset (Fin k)) ∧ MissingColors G + (ett.series.data.coloring jSlot.castSucc) u = MissingColors G sigma u \ + ({deltaClass (Fin.last p)} : Finset (Fin k)) ∪ ({gammaClass (0 : Fin (p + (1 : ℕ)))} : + Finset (Fin k))) → ( + ∀ (t : Fin ett.rounds) (vt : V), t ∈ ExtensionBaseRestorationIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → TreeVertexOrder T v vt) → ( + ∀ t ∈ ExtensionBaseRestorationIndices ett v hvFinal, TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree t.succ.castSucc)) → ( + ∀ t ∈ ExtensionBaseRestorationIndices ett v hvFinal, + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT) → + ( + ∀ (t : Fin ett.rounds) (vt : V) (gammaT deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v + hvFinal → t ≠ q → ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma + t.succ = some gammaT → ett.series.data.delta t.succ = some deltaT → + ETTStrongInterchangeable ett t vt sigma gammaT deltaT) → ( + ∀ (u : V) (t : Fin ett.rounds) (deltaT : Fin k), ExtensionBaseSupportClass ett v hvFinal u ⊆ + ExtensionBaseRestorationIndices ett v hvFinal → t ∈ ExtensionBaseSupportClass ett v + hvFinal u → ( + ∀ s ∈ ExtensionBaseSupportClass ett v hvFinal u, (↑s : ℕ) ≤ (↑t : ℕ)) → ett.series.data.delta + t.succ = some deltaT → (MissingColors G sigma u ∩ (ExtensionBaseSupportClass ett v hvFinal + u).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ : Finset (Fin k)) = + ({ deltaT } : Finset (Fin k))) → ( + ∀ (s t : Fin ett.rounds) (vs vt : V) (gammaS deltaS gammaT deltaT : Fin k), s ∈ + ExtensionBaseActiveIndices ett v hvFinal → t ∈ ExtensionBaseActiveIndices ett v hvFinal → + (↑s : ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma s.succ = some gammaS + → ett.series.data.delta s.succ = some deltaS → ett.series.data.gamma t.succ = some gammaT + → ett.series.data.delta t.succ = some deltaT → (((insert gammaS ({ deltaS } : Finset (Fin + k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett v hvFinal vs, (↑s : ℕ) < (↑r : ℕ) ∧ (↑r : ℕ) < (↑t : ℕ) ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ ( ((insert gammaS ({ deltaS } : Finset + (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)).Nonempty → ((insert gammaS ({ deltaS } : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin + k)) = ({ gammaT } : Finset (Fin k)) ∧ ((insert gammaS ({ deltaS } : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset + (Fin k)) = ({ deltaS } : Finset (Fin k)))) → False + +end GoldbergSeymour.ExtensionBaseProof + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseRestorationIndices.lean b/LeanPool/GoldbergSeymour/ExtensionBaseRestorationIndices.lean new file mode 100644 index 0000000000..ddae59d4f1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseRestorationIndices.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass + +/-! +# Extension Base Restoration Indices + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Active parallel-extension slots outside the terminal support's class. -/ +noncomputable def ExtensionBaseRestorationIndices {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) : Finset (Fin ett.rounds) := by + classical + exact ExtensionBaseActiveIndices ett terminalSupport hterminalSupport \ + ExtensionBaseSupportClass ett terminalSupport hterminalSupport + terminalSupport + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseRestorationInvariant.lean b/LeanPool/GoldbergSeymour/ExtensionBaseRestorationInvariant.lean new file mode 100644 index 0000000000..6a3a624aad --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseRestorationInvariant.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace + +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent + +/-! +# Extension Base Restoration Invariant + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The coloring and component conditions preserved while restoring other support classes. -/ +def ExtensionBaseRestorationInvariant {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) (jSlot q : Fin ett.rounds) + (sigmaN : PartialEdgeColoring E k) + (trace : ExtensionBaseRestorationTrace ett terminalSupport hterminalSupport sigmaN) : Prop := + (∀ a : Fin (trace.steps + 1), + IsProperEdgeColoring G (trace.coloring a) ∧ IsOneEdgeUncolored (trace.coloring a) e0) ∧ + (∀ a : Fin trace.steps, + trace.slot a ∈ ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport ∧ + TreeVertexOrder T terminalSupport (trace.support a) ∧ + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ + trace.support a ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc) ∧ + trace.delta a ∈ MissingColors G (trace.coloring a.castSucc) (trace.support a) ∧ + TwoColorNontrivialPathComponent G (trace.coloring a.castSucc) (trace.gamma a) + (trace.delta a) (Sum.inl (trace.support a)) ∧ + (∀ w : V, + w ∈ TreeSequenceVertexSet (ett.series.data.tree (trace.slot a).succ.castSucc) → + (Sum.inl w ∈ + TwoColorComponent G (trace.coloring a.castSucc) (trace.gamma a) (trace.delta a) + (Sum.inl (trace.support a)) ↔ + w = trace.support a)) ∧ + ∀ (s : Fin ett.rounds) (vs : V) (gammaS deltaS : Fin k), + s ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + s ≠ q → + (∀ b : Fin trace.steps, b.val ≤ a.val → trace.slot b ≠ s) → + ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s vs (trace.coloring a.succ) gammaS deltaS) ∧ + ∀ (s : Fin ett.rounds) (vs : V) (gammaS deltaS : Fin k), + s ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + s ≠ q → + (∀ a : Fin trace.steps, trace.slot a ≠ s) → + ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.gamma s.succ = some gammaS → + ett.series.data.delta s.succ = some deltaS → + ETTStrongInterchangeable ett s vs (trace.coloring (Fin.last trace.steps)) gammaS deltaS + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseRestorationTrace.lean b/LeanPool/GoldbergSeymour/ExtensionBaseRestorationTrace.lean new file mode 100644 index 0000000000..3cd4abfdf4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseRestorationTrace.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationIndices + +/-! +# Extension Base Restoration Trace + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A descending sequence of swaps at active slots outside the terminal support class. -/ +structure ExtensionBaseRestorationTrace {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (sigmaN : PartialEdgeColoring E k) where + /-- The number of component swaps in the trace. -/ + steps : ℕ + /-- The extension-series slot processed by each swap. -/ + slot : Fin steps → Fin ett.rounds + /-- The chosen support vertex for each restoration swap. -/ + support : Fin steps → V + /-- The auxiliary color or color family used by this configuration. -/ + gamma : Fin steps → Fin k + /-- The companion color used for the component swap at each stage. -/ + delta : Fin steps → Fin k + /-- The partial coloring or sequence of partial colorings recorded by this certificate. -/ + coloring : Fin (steps + 1) → PartialEdgeColoring E k + initialColoring : coloring 0 = sigmaN + enumerates : + Finset.univ.image slot = ExtensionBaseRestorationIndices ett terminalSupport hterminalSupport + strictlyDescending : ∀ a b, a.val < b.val → (slot b).val < (slot a).val + chosenVertex : ∀ a, ett.series.data.chosenVertex (slot a).succ = some (support a) + gammaField : ∀ a, ett.series.data.gamma (slot a).succ = some (gamma a) + deltaField : ∀ a, ett.series.data.delta (slot a).succ = some (delta a) + transition : + ∀ a, + coloring a.succ = + TwoColorComponentSwap G (coloring a.castSucc) (gamma a) (delta a) (Sum.inl (support a)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseSameSupportStoredPairOverlap.lean b/LeanPool/GoldbergSeymour/ExtensionBaseSameSupportStoredPairOverlap.lean new file mode 100644 index 0000000000..e16d960610 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseSameSupportStoredPairOverlap.lean @@ -0,0 +1,502 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors + +/-! +# Extension Base Same Support Stored Pair Overlap + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_slotFacts_76.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (q : Fin ett.rounds) (w : V) (p : ℕ) + (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (r : Fin ett.rounds), (↑r : ℕ) ≤ (↑q : ℕ) ∧ ett.series.data.kind r.succ = some + TashkinovExtensionKind.PE ∧ ett.series.data.chosenVertex r.succ = some w ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) → + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (ga : Fin k) (da : Fin k), ett.series.data.gamma (indices a).succ = some ga ∧ + ett.series.data.delta (indices a).succ = some da ∧ ett.series.data.stored (indices a).succ + = (insert da ({ ga } : Finset (Fin k)) : Finset (Fin k)) := by + classical + intro V E _ _ _ G k e0 input T generating ett q w p indices henumerates a + have hr := (henumerates (indices a)).2 ⟨a, rfl⟩ + rcases hr with ⟨hle, hkind, hvertex⟩ + let z := (indices a).succ + generalize hzi : (indices a).succ = z at hkind hvertex ⊢ + have hstep := ett.series.certified z + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + simp [initialKind] at hkind + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + simp [currentKind] at hkind + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + ga gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + exact ⟨ga, choice.color, currentGamma, currentDelta, currentStored⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + simp [currentKind] at hkind + +private theorem helper_hab_135.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → + Fin ett.rounds), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) → + ∀ (s t : Fin ett.rounds), (↑s : ℕ) < (↑t : ℕ) → + ∀ (a : Fin (p + (1 : ℕ))), indices a = s → + ∀ (b : Fin (p + (1 : ℕ))), indices b = t → (↑a : ℕ) < (↑b : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett p indices hincreasing s t hst a ha b hb + have hst' : (indices a).val < (indices b).val := by simpa [ha, hb] using hst + by_contra hn + have hba : b.val ≤ a.val := Nat.le_of_not_gt hn + rcases lt_or_eq_of_le hba with hlt | heq + · exact (not_lt_of_ge (Nat.le_of_lt (hincreasing b a hlt)) hst').elim + · have hab' : b = a := Fin.ext heq + subst b + exact (Nat.lt_irrefl _ hst').elim + +private theorem helper_hgap_144.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (_ : Fin ett.rounds) (w : V) (p : ℕ) (indices : + Fin (p + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) → + ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) → + ∀ (s t : Fin ett.rounds) (a : Fin (p + (1 : ℕ))), indices a = s → + ∀ (b : Fin (p + (1 : ℕ))), indices b = t → (↑a : ℕ) < (↑b : ℕ) → (( + ∃ r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w, (↑s : ℕ) < (↑r : ℕ) ∧ + (↑r : ℕ) < (↑t : ℕ)) ↔ (↑a : ℕ) + (1 : ℕ) < (↑b : ℕ)) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q w p indices + hincreasing hclass s t a ha b hb hab + constructor + · rintro ⟨r, hr, hsr, hrt⟩ + rcases (hclass r).1 hr with ⟨c, hc⟩ + have hsr' : (indices a).val < (indices c).val := by simpa [ha, hc] using hsr + have hrt' : (indices c).val < (indices b).val := by simpa [hc, hb] using hrt + have hac : a.val < c.val := by + by_contra hn + have hle : c.val ≤ a.val := Nat.le_of_not_gt hn + rcases lt_or_eq_of_le hle with hlt | heq + · exact (not_lt_of_ge (Nat.le_of_lt (hincreasing c a hlt)) hsr').elim + · have hac' : c = a := Fin.ext heq + subst c + exact (Nat.lt_irrefl _ hsr').elim + have hcb : c.val < b.val := by + by_contra hn + have hle : b.val ≤ c.val := Nat.le_of_not_gt hn + rcases lt_or_eq_of_le hle with hlt | heq + · exact (not_lt_of_ge (Nat.le_of_lt (hincreasing b c hlt)) hrt').elim + · have hbc' : b = c := Fin.ext heq + subst b + exact (Nat.lt_irrefl _ hrt').elim + omega + · intro hgap + let c : Fin (p + 1) := ⟨a.val + 1, by omega⟩ + have hac : a.val < c.val := by simp [c] + have hcb : c.val < b.val := by simpa [c] using hgap + refine ⟨indices c, (hclass _).2 ⟨c, rfl⟩, ?_, ?_⟩ + · rw [← ha] + exact hincreasing a c hac + · rw [← hb] + exact hincreasing c b hcb + +private theorem helper_fieldsS_241.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → + Fin ett.rounds) (s : Fin ett.rounds) (gammaS deltaS : Fin k), ett.series.data.gamma s.succ + = some gammaS → ett.series.data.delta s.succ = some deltaS → + ∀ (slotFacts : + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (ga : Fin k) (da : Fin k), ett.series.data.gamma (indices a).succ = some ga ∧ + ett.series.data.delta (indices a).succ = some da ∧ ett.series.data.stored (indices a).succ + = (insert da ({ ga } : Finset (Fin k)) : Finset (Fin k))), + let gamma : Fin (p + (1 : ℕ)) → Fin k := fun (a : Fin (p + (1 : ℕ))) ↦ Classical.choose + (slotFacts a); + let delta : Fin (p + (1 : ℕ)) → Fin k := fun (a : Fin (p + (1 : ℕ))) ↦ Classical.choose + (Classical.choose_spec (slotFacts a)); ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) → ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) → + ∀ (a : Fin (p + (1 : ℕ))), indices a = s → gamma a = gammaS ∧ delta a = deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett p indices s gammaS deltaS hsGamma hsDelta + slotFacts gamma delta hgamma hdelta a ha + have hg : ett.series.data.gamma (indices a).succ = + ett.series.data.gamma s.succ := congrArg ett.series.data.gamma (congrArg Fin.succ ha) + have hd : ett.series.data.delta (indices a).succ = + ett.series.data.delta s.succ := congrArg ett.series.data.delta (congrArg Fin.succ ha) + constructor + · exact (Option.some.inj (hsGamma.symm.trans (hg.symm.trans (hgamma a)))).symm + · exact (Option.some.inj (hsDelta.symm.trans (hd.symm.trans (hdelta a)))).symm + +private theorem helper_fieldsT_249.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → + Fin ett.rounds) (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.gamma t.succ + = some gammaT → ett.series.data.delta t.succ = some deltaT → + ∀ (slotFacts : + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (ga : Fin k) (da : Fin k), ett.series.data.gamma (indices a).succ = some ga ∧ + ett.series.data.delta (indices a).succ = some da ∧ ett.series.data.stored (indices a).succ + = (insert da ({ ga } : Finset (Fin k)) : Finset (Fin k))), + let gamma : Fin (p + (1 : ℕ)) → Fin k := fun (a : Fin (p + (1 : ℕ))) ↦ Classical.choose + (slotFacts a); + let delta : Fin (p + (1 : ℕ)) → Fin k := fun (a : Fin (p + (1 : ℕ))) ↦ Classical.choose + (Classical.choose_spec (slotFacts a)); ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) → ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) → + ∀ (b : Fin (p + (1 : ℕ))), indices b = t → gamma b = gammaT ∧ delta b = deltaT := by + classical + intro V E _ _ _ G k e0 input T generating ett p indices t gammaT deltaT htGamma htDelta + slotFacts gamma delta hgamma hdelta b hb + have hg : ett.series.data.gamma (indices b).succ = + ett.series.data.gamma t.succ := congrArg ett.series.data.gamma (congrArg Fin.succ hb) + have hd : ett.series.data.delta (indices b).succ = + ett.series.data.delta t.succ := congrArg ett.series.data.delta (congrArg Fin.succ hb) + constructor + · exact (Option.some.inj (htGamma.symm.trans (hg.symm.trans (hgamma b)))).symm + · exact (Option.some.inj (htDelta.symm.trans (hd.symm.trans (hdelta b)))).symm + +private theorem helper_branch_258.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (_ : Fin ett.rounds) (w : V) (p : ℕ) (indices : + Fin (p + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (a b : Fin (p + (1 : ℕ))) (gammaA deltaB : Fin k), (↑a : ℕ) ≤ (↑b : ℕ) → + ett.series.data.gamma (indices a).succ = some gammaA → ett.series.data.delta (indices + b).succ = some deltaB → deltaB ≠ gammaA) → + ∀ (s t : Fin ett.rounds) (gammaS deltaS gammaT deltaT : Fin k) (slotFacts : + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (ga : Fin k) (da : Fin k), ett.series.data.gamma (indices a).succ = some ga ∧ + ett.series.data.delta (indices a).succ = some da ∧ ett.series.data.stored (indices a).succ + = (insert da ({ga} : Finset (Fin k)) : Finset (Fin k))), + let gamma : Fin (p + (1 : ℕ)) → Fin k := fun (a : Fin (p + (1 : ℕ))) ↦ Classical.choose + (slotFacts a); + let delta : Fin (p + (1 : ℕ)) → Fin k := fun (a : Fin (p + (1 : ℕ))) ↦ Classical.choose + (Classical.choose_spec (slotFacts a)); ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gamma a)) → ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (delta a)) → + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (( + ∃ r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w, (↑s : ℕ) < (↑r : ℕ) ∧ + (↑r : ℕ) < (↑t : ℕ)) ↔ (↑a : ℕ) + (1 : ℕ) < (↑b : ℕ)) → ( + ∀ (c : Fin p), gamma c.succ = delta c.castSucc) → gamma a = gammaS ∧ delta a = deltaS → gamma + b = gammaT ∧ delta b = deltaT → (↑a : ℕ) + (1 : ℕ) = (↑b : ℕ) → (((insert (delta a) + ({gamma a} : Finset (Fin k)) : Finset (Fin k)) ∩ (insert (delta b) ({gamma b} : Finset + (Fin k)) : Finset (Fin k)) : Finset (Fin k)).Nonempty ↔ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w, (↑s : ℕ) < (↑r : ℕ) ∧ + (↑r : ℕ) < (↑t : ℕ)) ∧ (((insert (delta a) ({gamma a} : Finset (Fin k)) : Finset (Fin k)) + ∩ (insert (delta b) ({gamma b} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin + k)).Nonempty → ((insert (delta a) ({gamma a} : Finset (Fin k)) : Finset (Fin k)) ∩ (insert + (delta b) ({gamma b} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)) = ({gammaT} : + Finset (Fin k)) ∧ ((insert (delta a) ({gamma a} : Finset (Fin k)) : Finset (Fin k)) ∩ + (insert (delta b) ({gamma b} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)) = + ({deltaS} : Finset (Fin k))) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q w p indices + hdeltaAvoidsEarlierGamma s t gammaS deltaS gammaT deltaT slotFacts gamma delta hgamma + hdelta a b hab hgap hgammaDelta fieldsS fieldsT hadj + have hb' : b.val = a.val + 1 := hadj.symm + have hadjColor : gamma b = delta a := by + let c : Fin p := ⟨a.val, by omega⟩ + have hc := hgammaDelta c + have hcb : c.succ = b := by + apply Fin.ext + simp [c, hb'] + have hca : c.castSucc = a := by apply Fin.ext; rfl + rw [← hcb, ← hca] + exact hc + have hno : ¬ ∃ r : Fin ett.rounds, r ∈ ExtensionBaseSupportClass ett + terminalSupport hterminalSupport w ∧ s.val < r.val ∧ r.val < t.val := by + intro hr + exact (by omega : ¬ (a.val + 1 < b.val)) (hgap.mp hr) + have hnot : delta b ≠ gamma a := by + intro he + exact hdeltaAvoidsEarlierGamma a b (gamma a) (delta b) hab.le + (hgamma a) (hdelta b) he + constructor + · constructor + · intro _ + exact hno + · intro _ + exact ⟨gamma b, by simp [hadjColor]⟩ + · intro _ + have hgt : gammaT = delta a := fieldsT.1.symm.trans hadjColor + have hds : deltaS = delta a := fieldsS.2.symm + constructor + · rw [hgt] + ext x + simp [hadjColor, hnot] + · rw [hds] + ext x + simp [hadjColor, hnot] + +private theorem helper_branch_292.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (_ : Fin ett.rounds) (w : V) (p : ℕ) (indices : + Fin (p + (1 : ℕ)) → Fin ett.rounds) (s t : Fin ett.rounds) (_ deltaS gammaT _ : Fin k) + (slotFacts : + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (ga : Fin k) (da : Fin k), ett.series.data.gamma (indices a).succ = some ga ∧ + ett.series.data.delta (indices a).succ = some da ∧ ett.series.data.stored (indices a).succ + = (insert da ({ga} : Finset (Fin k)) : Finset (Fin k))), + let gamma : Fin (p + (1 : ℕ)) → Fin k := fun (a : Fin (p + (1 : ℕ))) ↦ Classical.choose + (slotFacts a); + let delta : Fin (p + (1 : ℕ)) → Fin k := fun (a : Fin (p + (1 : ℕ))) ↦ Classical.choose + (Classical.choose_spec (slotFacts a)); + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (( + ∃ r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w, (↑s : ℕ) < (↑r : ℕ) ∧ + (↑r : ℕ) < (↑t : ℕ)) ↔ (↑a : ℕ) + (1 : ℕ) < (↑b : ℕ)) → ((↑a : ℕ) + (1 : ℕ) < (↑b : ℕ) → + Disjoint (insert (delta a) ({gamma a} : Finset (Fin k)) : Finset (Fin k)) (insert (delta + b) ({gamma b} : Finset (Fin k)) : Finset (Fin k))) → ¬(↑a : ℕ) + (1 : ℕ) = (↑b : ℕ) → + (((insert (delta a) ({gamma a} : Finset (Fin k)) : Finset (Fin k)) ∩ (insert (delta b) + ({gamma b} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)).Nonempty ↔ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w, (↑s : ℕ) < (↑r : ℕ) ∧ + (↑r : ℕ) < (↑t : ℕ)) ∧ (((insert (delta a) ({gamma a} : Finset (Fin k)) : Finset (Fin k)) + ∩ (insert (delta b) ({gamma b} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin + k)).Nonempty → ((insert (delta a) ({gamma a} : Finset (Fin k)) : Finset (Fin k)) ∩ (insert + (delta b) ({gamma b} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)) = ({gammaT} : + Finset (Fin k)) ∧ ((insert (delta a) ({gamma a} : Finset (Fin k)) : Finset (Fin k)) ∩ + (insert (delta b) ({gamma b} : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin k)) = + ({deltaS} : Finset (Fin k))) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q w p indices s + t gammaS deltaS gammaT deltaT slotFacts gamma delta a b hab hgap pairDisjoint hadj + have hgap' : a.val + 1 < b.val := by omega + have hd := pairDisjoint hgap' + have hex : ∃ r : Fin ett.rounds, r ∈ ExtensionBaseSupportClass ett + terminalSupport hterminalSupport w ∧ s.val < r.val ∧ r.val < t.val := + hgap.mpr hgap' + have hfalse : ¬ Finset.Nonempty ({delta a, gamma a} ∩ {delta b, gamma b}) := by + intro h + rcases h with ⟨x, hx⟩ + exact (Finset.disjoint_left.mp hd) (Finset.mem_inter.mp hx).1 + (Finset.mem_inter.mp hx).2 + constructor + · constructor + · intro h + exact fun _ => hfalse h + · intro h + exact (h hex).elim + · intro h + exact (hfalse h).elim + +theorem ExtensionBaseSameSupportStoredPairOverlap {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (hqTerminal : q.val + 1 = ett.rounds) + (w : V) + (hw : w ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds) + (hincreasing : ∀ a b, a.val < b.val → + (indices a).val < (indices b).val) + (hclass : ∀ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ↔ + ∃ a : Fin (p + 1), indices a = r) + (henumerates : ∀ r : Fin ett.rounds, + (r.val ≤ q.val ∧ + ett.series.data.kind r.succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex r.succ = some w) ↔ + ∃ a : Fin (p + 1), indices a = r) + (hdeltaAvoidsEarlierGamma : ∀ (a b : Fin (p + 1)) + (gammaA deltaB : Fin k), a.val ≤ b.val → + ett.series.data.gamma (indices a).succ = some gammaA → + ett.series.data.delta (indices b).succ = some deltaB → + deltaB ≠ gammaA) + (s t : Fin ett.rounds) + (hsClass : s ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w) + (htClass : t ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w) + (hst : s.val < t.val) + (gammaS deltaS gammaT deltaT : Fin k) + (hsGamma : ett.series.data.gamma s.succ = some gammaS) + (hsDelta : ett.series.data.delta s.succ = some deltaS) + (htGamma : ett.series.data.gamma t.succ = some gammaT) + (htDelta : ett.series.data.delta t.succ = some deltaT) : + ((ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ).Nonempty ↔ + ¬ ∃ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w ∧ + s.val < r.val ∧ r.val < t.val) ∧ + ((ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ).Nonempty → + ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ = {gammaT} ∧ + ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ = {deltaS}) := by + classical + have slotFacts := + @helper_slotFacts_76 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@q) (@w) (@p) (@indices) (@henumerates) + let gamma : Fin (p + 1) → Fin k := fun a => Classical.choose (slotFacts a) + let delta : Fin (p + 1) → Fin k := fun a => + Classical.choose (Classical.choose_spec (slotFacts a)) + have hgamma : ∀ a, ett.series.data.gamma (indices a).succ = some (gamma a) := by + intro a + exact (Classical.choose_spec (Classical.choose_spec (slotFacts a))).1 + have hdelta : ∀ a, ett.series.data.delta (indices a).succ = some (delta a) := by + intro a + exact (Classical.choose_spec (Classical.choose_spec (slotFacts a))).2.1 + have hstored : ∀ a, ett.series.data.stored (indices a).succ = + {delta a, gamma a} := by + intro a + exact (Classical.choose_spec (Classical.choose_spec (slotFacts a))).2.2 + have colors := ExtensionBaseSupportClassColors ett terminalSupport + hterminalSupport q hqTerminal w hw p indices hincreasing hclass henumerates + gamma delta hgamma hdelta (by + intro x y hxy + exact hdeltaAvoidsEarlierGamma x y (gamma x) (delta y) hxy + (hgamma x) (hdelta y)) + have hsa : ∃ a : Fin (p + 1), indices a = s := (hclass s).1 hsClass + have hta : ∃ a : Fin (p + 1), indices a = t := (hclass t).1 htClass + rcases hsa with ⟨a, ha⟩ + rcases hta with ⟨b, hb⟩ + have hab := + @helper_hab_135 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) + (@T) (@generating) (@ett) (@p) (@indices) (@hincreasing) (@s) (@t) (@hst) (@a) (@ha) (@b) + (@hb) + have hgap := + @helper_hgap_144 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) + (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@q) (@w) (@p) + (@indices) (@hincreasing) (@hclass) (@s) (@t) (@a) (@ha) (@b) (@hb) (@hab) + have pairS : ett.series.data.stored s.succ = {delta a, gamma a} := by + simpa [ha] using hstored a + have pairT : ett.series.data.stored t.succ = {delta b, gamma b} := by + simpa [hb] using hstored b + have hgammaDelta : ∀ c : Fin p, gamma c.succ = delta c.castSucc := + colors.1 + have hinjective := colors.2 + have gammaCode : ∀ c : Fin (p + 1), + gamma c = (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) + (⟨c.val, Nat.lt_succ_of_lt c.isLt⟩ : Fin (p + 2)) := by + intro c + refine Fin.cases ?_ (fun d => ?_) c + · rfl + · have hd := hgammaDelta d + have hi : (⟨d.val + 1, Nat.lt_succ_of_lt (Nat.succ_lt_succ d.isLt)⟩ : Fin (p + 2)) = + d.succ.castSucc := by + apply Fin.ext + rfl + change gamma d.succ = delta d.castSucc + exact hd + have deltaCode : ∀ c : Fin (p + 1), + delta c = (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) + (⟨c.val + 1, Nat.succ_lt_succ c.isLt⟩ : Fin (p + 2)) := by + intro c + rfl + have pairDisjoint : a.val + 1 < b.val → + Disjoint ({delta a, gamma a} : Finset (Fin k)) {delta b, gamma b} := by + intro hgap' + rw [Finset.disjoint_left] + intro x hxa hxb + have hxa' : x = delta a ∨ x = gamma a := by simpa using hxa + have hxb' : x = delta b ∨ x = gamma b := by simpa using hxb + rcases hxa' with hxa' | hxa' <;> rcases hxb' with hxb' | hxb' + · subst x + have he : (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) a.succ = + (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) b.succ := + (deltaCode a).symm.trans (hxb'.trans (deltaCode b)) + have hv := congrArg Fin.val (hinjective he) + simp at hv + omega + · subst x + have he : (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) a.succ = + (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) b.castSucc := + (deltaCode a).symm.trans (hxb'.trans (gammaCode b)) + have hv := congrArg Fin.val (hinjective he) + simp at hv + omega + · subst x + have he : (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) a.castSucc = + (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) b.succ := + (gammaCode a).symm.trans (hxb'.trans (deltaCode b)) + have hv := congrArg Fin.val (hinjective he) + simp at hv + omega + · subst x + have he : (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) a.castSucc = + (Fin.cons (gamma 0) delta : Fin (p + 2) → Fin k) b.castSucc := + (gammaCode a).symm.trans (hxb'.trans (gammaCode b)) + have hv := congrArg Fin.val (hinjective he) + simp at hv + omega + rw [pairS, pairT] + have fieldsS := + @helper_fieldsS_241 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@p) (@indices) (@s) (@gammaS) (@deltaS) (@hsGamma) + (@hsDelta) (@slotFacts) (@hgamma) (@hdelta) (@a) (@ha) + have fieldsT := + @helper_fieldsT_249 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@p) (@indices) (@t) (@gammaT) (@deltaT) (@htGamma) + (@htDelta) (@slotFacts) (@hgamma) (@hdelta) (@b) (@hb) + by_cases hadj : a.val + 1 = b.val + · exact @helper_branch_258 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@q) (@w) (@p) + (@indices) (@hdeltaAvoidsEarlierGamma) (@s) (@t) (@gammaS) (@deltaS) (@gammaT) (@deltaT) + (@slotFacts) (@hgamma) (@hdelta) (@a) (@b) (@hab) (@hgap) (@hgammaDelta) (@fieldsS) + (@fieldsT) (@hadj) + · exact @helper_branch_292 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@q) (@w) (@p) + (@indices) (@s) (@t) (@gammaS) (@deltaS) (@gammaT) (@deltaT) (@slotFacts) (@a) (@b) (@hab) + (@hgap) (@pairDisjoint) (@hadj) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean b/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean new file mode 100644 index 0000000000..5996b3e508 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean @@ -0,0 +1,4243 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ExtensionBasePreparations + +/-! +# Preparatory lemmas for the extension base + +Part of Wesley Pegden’s Trellis formalization of the Goldberg–Seymour theorem, +commit 88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. These lemmas establish the +base cases used by the extension construction. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ExtensionBaseProof + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation14264Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v) → ¬w = v → + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), q.succ = Fin.last ett.rounds → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → ett.series.data.gamma q.succ = some gamma → + ett.series.data.delta q.succ = some delta → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → (↑jSlot + : ℕ) ≤ (↑q : ℕ) → StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) → ( + ∀ (t : Fin ett.rounds), ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT) → + ( + ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = (insert + gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k))) → ( + ∀ (s t : Fin ett.rounds) (vs vt : V) (gammaS deltaS gammaT deltaT : Fin k), s ∈ + ExtensionBaseActiveIndices ett v hvFinal → t ∈ ExtensionBaseActiveIndices ett v hvFinal → + (↑s : ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma s.succ = some gammaS + → ett.series.data.delta s.succ = some deltaS → ett.series.data.gamma t.succ = some gammaT + → ett.series.data.delta t.succ = some deltaT → (((insert gammaS ({ deltaS } : Finset (Fin + k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett v hvFinal vs, (↑s : ℕ) < (↑r : ℕ) ∧ (↑r : ℕ) < (↑t : ℕ) ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ ( ((insert gammaS ({ deltaS } : Finset + (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)).Nonempty → ((insert gammaS ({ deltaS } : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin + k)) = ({ gammaT } : Finset (Fin k)) ∧ ((insert gammaS ({ deltaS } : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset + (Fin k)) = ({ deltaS } : Finset (Fin k)))) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), v ∈ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) → q ∈ ExtensionBaseActiveIndices ett v hvFinal + → q ∈ ExtensionBaseSupportClass ett v hvFinal v → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : + ℕ)) → Fin k), ( + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + → ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.gamma (indices0 a).succ = some (gamma0 a)) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) → ( + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) → Function.Injective (Fin.cons (gamma0 (0 : + Fin (p0 + (1 : ℕ)))) delta0) → ( + let storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; (MissingColors G sigma v ∩ storedPairs : Finset + (Fin k)) = ({delta0 (Fin.last p0)} : Finset (Fin k)) ∧ MissingColors G + (ett.series.data.coloring jSlot.castSucc) v = MissingColors G sigma v \ + ({delta0 (Fin.last p0)} : Finset (Fin k)) ∪ ({gamma0 (0 : Fin (p0 + (1 : ℕ)))} : Finset + (Fin k))) → ( + ∀ v_1 ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.castSucc.succ)).erase v, + MissingColors G (trace.coloring (Fin.last trace.steps)) v_1 = MissingColors G + (ett.series.data.coloring jSlot.castSucc) v_1) ∧ MissingColors G (trace.coloring (Fin.last + trace.steps)) v = MissingColors G sigma v → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → IsOneEdgeUncolored rho1 e0 → StableColoringBeforeVertex T v + hvFinal (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho1 → ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → ( + ∀ (f : E), rho1 f ≠ sigma f → f ∉ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) ∧ + ∃ (c : Fin k) (d : Fin k), sigma f = some c ∧ rho1 f = some d ∧ (c ∈ + (ExtensionBaseRestorationIndices ett v hvFinal).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) ∧ d ∈ (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseSupportClass ett v hvFinal v + → s ≠ q → ett.series.data.chosenVertex s.succ = some v → ett.series.data.gamma s.succ = + some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett s + v rho1 gammaS deltaS) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v → + ∀ (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → seed.vertex (Fin.last seed.length) = v → + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) → TreeSequenceInitialSegment (ett.series.data.tree + q.succ.castSucc) T → ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation (ett.series.data.coloring jSlot.castSucc) A + B → TreeSequenceInitialSegment B seed → TashkinovAugmentation rho1 A B) → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch13441Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → + ∀ (hseedTj : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)), + seed.vertex (Fin.last seed.length) = v → TreeSequenceInitialSegment (ett.series.data.tree + jSlot.succ.castSucc) (ett.series.data.tree q.succ.castSucc) → ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime → + TreeSequenceInitialSegment seed TjPrime → indices0 (Fin.last p0) = q → v ∈ + TreeSequenceVertexSet seed → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ( (0 : ℕ) < + (↑jSlot : ℕ) → Tprevious.length < seed.length) → ( (0 : ℕ) < (↑jSlot : ℕ) → + TreeSequenceInitialSegment Tprevious seed) → + ∀ (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) + (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime), u0 ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (exitPath0 : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (beta0 : Fin k) (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + + (1 : ℕ))), ((seed.length < (↑zPosition0 : ℕ) ∧ beta0 ∈ MissingColors G rho1 z0 ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition0 : ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition0 = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) → + ∀ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 → IsOneEdgeUncolored rho3 e0 → + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 → ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) → ( + z0 ∈ TreeVerticesBefore TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G + rho1 z0) → beta0 ∉ MissingColors G rho1 v → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u0 → seed.length < + (↑uPosition : ℕ) → + let terminalInTj : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hseedTj.1) (Fin.last seed.length); (ett.series.data.tree + jSlot.succ.castSucc).vertex terminalInTj = v → (↑terminalInTj : ℕ) = seed.length → (z0 = v + ↔ zPosition0 = terminalInTj) → z0 = v → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch13578Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → + ∀ (hseedTj : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)), + seed.vertex (Fin.last seed.length) = v → TreeSequenceInitialSegment (ett.series.data.tree + jSlot.succ.castSucc) (ett.series.data.tree q.succ.castSucc) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime → + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) → + TreeSequenceInitialSegment seed TjPrime → indices0 (Fin.last p0) = q → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho1 v ∪ ({ gammaFirst } : + Finset (Fin k)) → delta ∈ MissingColors G rho1 v → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (a b : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ( (0 : ℕ) < + (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious (ett.series.data.tree + jSlot.succ.castSucc)) → ( (0 : ℕ) < (↑jSlot : ℕ) → Tprevious.length < seed.length) → ( (0 + : ℕ) < (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious seed) → + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) seed + (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) + (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime), u0 ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (exitPath0 : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)), + ∀ beta0 ∈ MissingColors G rho1 u0, + ∀ (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition0 = z0 → seed.length ≤ + (↑zPosition0 : ℕ) → + ∀ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 → IsOneEdgeUncolored rho3 e0 → + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 → ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) → ( + beta0 ∈ MissingColors G rho1 z0 → delta ∈ MissingColors G rho3 z0) → ( z0 ∈ + TreeVerticesBefore TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 + z0) → gammaFirst ∈ MissingColors G rho3 u0 → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u0 → seed.length < + (↑uPosition : ℕ) → + let terminalInTj : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hseedTj.1) (Fin.last seed.length); (ett.series.data.tree + jSlot.succ.castSucc).vertex terminalInTj = v → (↑terminalInTj : ℕ) = seed.length → v ∈ + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 → zPosition0 = + Fin.last (ett.series.data.tree jSlot.succ.castSucc).length ∨ (↑zPosition0 : ℕ) < + (↑(Fin.last (ett.series.data.tree jSlot.succ.castSucc).length) : ℕ) ∧ beta0 ∈ + MissingColors G rho1 z0 → (0 : ℕ) < (↑jSlot : ℕ) → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch15456Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), ( + ∀ v_1 ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.castSucc.succ)).erase v, + MissingColors G (trace.coloring (Fin.last trace.steps)) v_1 = MissingColors G + (ett.series.data.coloring jSlot.castSucc) v_1) ∧ MissingColors G (trace.coloring (Fin.last + trace.steps)) v = MissingColors G sigma v → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (b : Fin + (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); (( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore + TjPrime u huPrime, MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = + MissingColors G rho1 x) ∧ + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → traceB.coloring (Fin.last traceB.steps) f = rho1 f) + → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : + ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; TreeSequenceInitialSegment seed U → MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho2 v ∪ MissingColors G + rho2 u → + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) seed Tj0 → + ∀ (M : TreeSequence G e0), u ∈ TreeSequenceVertexSet U → TreeSequenceInitialSegment U M → ( + ∀ (j : Fin M.length), U.length ≤ (↑j : ℕ) → + ∃ (i : Fin Tj0.length), M.edge j = Tj0.edge i ∧ M.vertex j.succ = Tj0.vertex i.succ) → ( + ∀ (i : Fin Tj0.length), Tj0.vertex i.succ ∉ TreeSequenceVertexSet U → + ∃ (j : Fin M.length), U.length ≤ (↑j : ℕ) ∧ M.edge j = Tj0.edge i ∧ M.vertex j.succ = + Tj0.vertex i.succ) → ( + ∀ (i j : Fin Tj0.length), Tj0.vertex i.succ ∉ TreeSequenceVertexSet U → Tj0.vertex j.succ ∉ + TreeSequenceVertexSet U → (↑i : ℕ) < (↑j : ℕ) → + ∀ (p q : Fin M.length), M.vertex p.succ = Tj0.vertex i.succ → M.vertex q.succ = Tj0.vertex + j.succ → (↑p : ℕ) < (↑q : ℕ)) → ( + ∀ (A : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hrA : r ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A r hr hrA) A) → ( + ∀ (A : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hrA : r + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A r hr (Nat.le_trans (Nat.le_succ r) hrA)) + (TreeSequencePrefix A (r + (1 : ℕ)) ( + by omega + ) hrA)) → TreeSequenceInitialSegment seed Tj0 → ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) A B → A.length < B.length → + ∃ (C : TreeSequence G e0), TashkinovAugmentation (ett.series.data.coloring jSlot.castSucc) A C + ∧ TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) C B) → + ∀ (n : ℕ) (hnU : U.length ≤ n), ( + ∀ (hnM : n ≤ M.length), TashkinovAugmentationSequence rho2 U (TreeSequencePrefix M n + (Nat.le_trans U.positive hnU) hnM)) → + ∀ (hnM : n + (1 : ℕ) ≤ M.length), TashkinovAugmentationSequence rho2 U (TreeSequencePrefix M + (n + (1 : ℕ)) (Nat.le_trans U.positive (Nat.le_succ_of_le hnU)) hnM) + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch15626Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v) → ¬w = v → + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), q.succ = Fin.last ett.rounds → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → ett.series.data.gamma q.succ = some gamma → + ett.series.data.delta q.succ = some delta → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) → ( + ∀ (t : Fin ett.rounds), ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT) → + ( + ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = (insert + gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k))) → ( + ∀ (s t : Fin ett.rounds) (vs vt : V) (gammaS deltaS gammaT deltaT : Fin k), s ∈ + ExtensionBaseActiveIndices ett v hvFinal → t ∈ ExtensionBaseActiveIndices ett v hvFinal → + (↑s : ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma s.succ = some gammaS + → ett.series.data.delta s.succ = some deltaS → ett.series.data.gamma t.succ = some gammaT + → ett.series.data.delta t.succ = some deltaT → (((insert gammaS ({ deltaS } : Finset (Fin + k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett v hvFinal vs, (↑s : ℕ) < (↑r : ℕ) ∧ (↑r : ℕ) < (↑t : ℕ) ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ ( ((insert gammaS ({ deltaS } : Finset + (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)).Nonempty → ((insert gammaS ({ deltaS } : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin + k)) = ({ gammaT } : Finset (Fin k)) ∧ ((insert gammaS ({ deltaS } : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset + (Fin k)) = ({ deltaS } : Finset (Fin k)))) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)), q ∈ + ExtensionBaseActiveIndices ett v hvFinal → q ∈ ExtensionBaseSupportClass ett v hvFinal v → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : + ℕ)) → Fin k), ( + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + → ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.gamma (indices0 a).succ = some (gamma0 a)) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) → ( + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) → Function.Injective (Fin.cons (gamma0 (0 : + Fin (p0 + (1 : ℕ)))) delta0) → ( + let storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; (MissingColors G sigma v ∩ storedPairs : Finset + (Fin k)) = ({delta0 (Fin.last p0)} : Finset (Fin k)) ∧ MissingColors G + (ett.series.data.coloring jSlot.castSucc) v = MissingColors G sigma v \ + ({delta0 (Fin.last p0)} : Finset (Fin k)) ∪ ({gamma0 (0 : Fin (p0 + (1 : ℕ)))} : Finset + (Fin k))) → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → IsOneEdgeUncolored rho1 e0 → ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → ( + ∀ (f : E), rho1 f ≠ sigma f → f ∉ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) ∧ + ∃ (c : Fin k) (d : Fin k), sigma f = some c ∧ rho1 f = some d ∧ (c ∈ + (ExtensionBaseRestorationIndices ett v hvFinal).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) ∧ d ∈ (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseSupportClass ett v hvFinal v + → s ≠ q → ett.series.data.chosenVertex s.succ = some v → ett.series.data.gamma s.succ = + some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett s + v rho1 gammaS deltaS) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v → + ∀ (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → seed.vertex (Fin.last seed.length) = v → + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) → ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime → + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) → + TreeSequenceInitialSegment seed TjPrime → v ∈ TreeSequenceVertexSet TjPrime → indices0 + (Fin.last p0) = q → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.chosenVertex (indices0 a).succ = some v) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.kind (indices0 a).succ = some + TashkinovExtensionKind.PE) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) → (MissingColors G rho1 v ∩ supportColors + : Finset (Fin k)) = ({delta0 (Fin.last p0)} : Finset (Fin k)) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), delta0 a ∉ TreeMissingColors (ett.series.data.coloring + jSlot.castSucc) (ett.series.data.tree jSlot.succ.castSucc)) → StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ (TashkinovStoredColors + ett.series.data jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho1 → + ((((TreeSequenceVertexSet TjPrime).erase v).biUnion fun (x : V) ↦ MissingColors G rho1 x) + ∩ supportColors : Finset (Fin k)) = ∅ → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation14753Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v) → ¬w = v → + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), q.succ = Fin.last ett.rounds → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → ett.series.data.gamma q.succ = some gamma → + ett.series.data.delta q.succ = some delta → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) → ( + ∀ (t : Fin ett.rounds), ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT) → + ( + ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = (insert + gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k))) → ( + ∀ (s t : Fin ett.rounds) (vs vt : V) (gammaS deltaS gammaT deltaT : Fin k), s ∈ + ExtensionBaseActiveIndices ett v hvFinal → t ∈ ExtensionBaseActiveIndices ett v hvFinal → + (↑s : ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma s.succ = some gammaS + → ett.series.data.delta s.succ = some deltaS → ett.series.data.gamma t.succ = some gammaT + → ett.series.data.delta t.succ = some deltaT → (((insert gammaS ({ deltaS } : Finset (Fin + k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett v hvFinal vs, (↑s : ℕ) < (↑r : ℕ) ∧ (↑r : ℕ) < (↑t : ℕ) ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ ( ((insert gammaS ({ deltaS } : Finset + (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)).Nonempty → ((insert gammaS ({ deltaS } : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin + k)) = ({ gammaT } : Finset (Fin k)) ∧ ((insert gammaS ({ deltaS } : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset + (Fin k)) = ({ deltaS } : Finset (Fin k)))) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)), q ∈ + ExtensionBaseActiveIndices ett v hvFinal → q ∈ ExtensionBaseSupportClass ett v hvFinal v → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : + ℕ)) → Fin k), ( + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + → ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.gamma (indices0 a).succ = some (gamma0 a)) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) → ( + ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) → Function.Injective (Fin.cons (gamma0 (0 : + Fin (p0 + (1 : ℕ)))) delta0) → ( + let storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; (MissingColors G sigma v ∩ storedPairs : Finset + (Fin k)) = ({delta0 (Fin.last p0)} : Finset (Fin k)) ∧ MissingColors G + (ett.series.data.coloring jSlot.castSucc) v = MissingColors G sigma v \ + ({delta0 (Fin.last p0)} : Finset (Fin k)) ∪ ({gamma0 (0 : Fin (p0 + (1 : ℕ)))} : Finset + (Fin k))) → ( + ∀ v_1 ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.castSucc.succ)).erase v, + MissingColors G (trace.coloring (Fin.last trace.steps)) v_1 = MissingColors G + (ett.series.data.coloring jSlot.castSucc) v_1) ∧ MissingColors G (trace.coloring (Fin.last + trace.steps)) v = MissingColors G sigma v → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → IsOneEdgeUncolored rho1 e0 → ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → ( + ∀ (f : E), rho1 f ≠ sigma f → f ∉ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) ∧ + ∃ (c : Fin k) (d : Fin k), sigma f = some c ∧ rho1 f = some d ∧ (c ∈ + (ExtensionBaseRestorationIndices ett v hvFinal).biUnion fun (t : Fin ett.rounds) ↦ + ett.series.data.stored t.succ) ∧ d ∈ (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (t : Fin ett.rounds) ↦ ett.series.data.stored t.succ) → ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseSupportClass ett v hvFinal v + → s ≠ q → ett.series.data.chosenVertex s.succ = some v → ett.series.data.gamma s.succ = + some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett s + v rho1 gammaS deltaS) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v → + ∀ (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → seed.vertex (Fin.last seed.length) = v → + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) → ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime → + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) → ( + let awayMissing : Finset (Fin k) := ((TreeSequenceVertexSet TjPrime).erase v).biUnion fun (x : + V) ↦ MissingColors G rho1 x; (awayMissing ∩ supportColors : Finset (Fin k)).Nonempty ∨ + (awayMissing ∩ supportColors : Finset (Fin k)) = ∅) → TreeSequenceInitialSegment seed + TjPrime → v ∈ TreeSequenceVertexSet TjPrime → indices0 (Fin.last p0) = q → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.chosenVertex (indices0 a).succ = some v) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.kind (indices0 a).succ = some + TashkinovExtensionKind.PE) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) → (MissingColors G rho1 v ∩ supportColors + : Finset (Fin k)) = ({delta0 (Fin.last p0)} : Finset (Fin k)) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), delta0 a ∉ TreeMissingColors (ett.series.data.coloring + jSlot.castSucc) (ett.series.data.tree jSlot.succ.castSucc)) → StableColoringBeforeVertex + (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ (TashkinovStoredColors + ett.series.data jSlot.castSucc) (ett.series.data.coloring jSlot.castSucc) rho1 → ( + ((((TreeSequenceVertexSet TjPrime).erase v).biUnion fun (x : V) ↦ MissingColors G rho1 x) + ∩ supportColors : Finset (Fin k)).Nonempty → + ∃ (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (b : Fin (p0 + (1 : ℕ))) (traceB : + ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), u ∉ TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc) ∧ ExtensionBaseAlgorithmBInvariant ett v jSlot + rho1 u p0 indices0 b traceB ∧ + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho2 ∧ (( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore + TjPrime u huPrime, MissingColors G rho2 x = MissingColors G rho1 x) ∧ + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree + jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : + ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → rho2 f = rho1 f) ∧ gamma0 (0 : Fin (p0 + (1 : ℕ))) ∈ + MissingColors G rho2 u) → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch15674Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (hseedTj : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) + (TjPrime : TreeSequence G e0), ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (a b : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) (zPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (exitPath0 : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) (z0 : V) (hz0 : + z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (zPosition0 : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (ett.series.data.tree + jSlot.succ.castSucc).vertex zPosition0 = z0 → + ∀ (rho3 : PartialEdgeColoring E k), ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), + let terminalInTj : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hseedTj.1) (Fin.last seed.length); (↑terminalInTj : ℕ) = + seed.length → + ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ (↑zPosition0 : ℕ)) (hzPositionBound : + (↑zPosition0 : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑zPosition0 : ℕ) hzPositionPositive hzPositionBound; TreeSequenceInitialSegment Z + (ett.series.data.tree jSlot.succ.castSucc) → TreeSequenceInitialSegment seed U → + MissingColors G (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho3 v ∪ + MissingColors G rho3 u0 → ( + ∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0, y ≠ v → + MissingColors G rho3 y = MissingColors G (ett.series.data.coloring jSlot.castSucc) y) → + ∀ (M : TreeSequence G e0), u0 ∈ TreeSequenceVertexSet U → TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) seed Z → TreeSequenceInitialSegment U M → ( + ∀ (j : Fin M.length), U.length ≤ (↑j : ℕ) → + ∃ (i : Fin Z.length), M.edge j = Z.edge i ∧ M.vertex j.succ = Z.vertex i.succ) → ( + ∀ (i : Fin Z.length), Z.vertex i.succ ∉ TreeSequenceVertexSet U → + ∃ (j : Fin M.length), U.length ≤ (↑j : ℕ) ∧ M.edge j = Z.edge i ∧ M.vertex j.succ = Z.vertex + i.succ) → ( + ∀ (i j : Fin Z.length), Z.vertex i.succ ∉ TreeSequenceVertexSet U → Z.vertex j.succ ∉ + TreeSequenceVertexSet U → (↑i : ℕ) < (↑j : ℕ) → + ∀ (p q : Fin M.length), M.vertex p.succ = Z.vertex i.succ → M.vertex q.succ = Z.vertex j.succ + → (↑p : ℕ) < (↑q : ℕ)) → ( + ∀ (A : TreeSequence G e0) (q0 : ℕ) (hq0 : (1 : ℕ) ≤ q0) (hqA : q0 ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A q0 hq0 hqA) A) → ( + ∀ (A : TreeSequence G e0) (q0 : ℕ) (hq0 : (1 : ℕ) ≤ q0) (hqA : q0 + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A q0 hq0 (Nat.le_trans (Nat.le_succ q0) + hqA)) (TreeSequencePrefix A (q0 + (1 : ℕ)) ( + by omega + ) hqA)) → TreeSequenceInitialSegment seed Z → ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) A B → A.length < B.length → + ∃ (C : TreeSequence G e0), TashkinovAugmentation (ett.series.data.coloring jSlot.castSucc) A C + ∧ TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) C B) → + ∀ (n : ℕ) (hnU : U.length ≤ n), ( + ∀ (hnM : n ≤ M.length), TashkinovAugmentationSequence rho3 U (TreeSequencePrefix M n + (Nat.le_trans U.positive hnU) hnM)) → + ∀ (hnM : n + (1 : ℕ) ≤ M.length), TashkinovAugmentationSequence rho3 U (TreeSequencePrefix M + (n + (1 : ℕ)) (Nat.le_trans U.positive (Nat.le_succ_of_le hnU)) hnM) + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch15847Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (hseedTj : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)), + seed.vertex (Fin.last seed.length) = v → TreeSequenceInitialSegment (ett.series.data.tree + jSlot.succ.castSucc) (ett.series.data.tree q.succ.castSucc) → ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime → + TreeSequenceInitialSegment seed TjPrime → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho1 v ∪ ({ gammaFirst } : + Finset (Fin k)) → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → delta ∈ + MissingColors G rho1 v → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a b : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)), + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) seed + (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) + (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime), u0 ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (exitPath0 : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (beta0 : Fin k) (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree + jSlot.succ.castSucc)) (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + + (1 : ℕ))), (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition0 = z0 → + seed.length ≤ (↑zPosition0 : ℕ) → + ∀ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 → IsOneEdgeUncolored rho3 e0 → + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 → ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) → ( + beta0 ∈ MissingColors G rho1 z0 → delta ∈ MissingColors G rho3 z0) → ( z0 ∈ + TreeVerticesBefore TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 + z0) → gammaFirst ∈ MissingColors G rho3 u0 → u0 ≠ v → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u0 → seed.length < + (↑uPosition : ℕ) → + let terminalInTj : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hseedTj.1) (Fin.last seed.length); (ett.series.data.tree + jSlot.succ.castSucc).vertex terminalInTj = v → (↑terminalInTj : ℕ) = seed.length → ¬z0 = v + → v ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 → zPosition0 = + Fin.last (ett.series.data.tree jSlot.succ.castSucc).length ∨ (↑zPosition0 : ℕ) < + (↑(Fin.last (ett.series.data.tree jSlot.succ.castSucc).length) : ℕ) ∧ beta0 ∈ + MissingColors G rho1 z0 → ¬(0 : ℕ) < (↑jSlot : ℕ) → False + +/-- Dependent contract shared by the extension base proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation12157Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), rho1 ((ett.series.data.tree + jSlot.succ.castSucc).edge a) = sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ + sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → seed.vertex (Fin.last seed.length) = v → + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) + (ett.series.data.tree q.succ.castSucc) → ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (TjPrime : TreeSequence G e0), TashkinovClosure rho1 seed TjPrime → + ColoredVertexSetElementary G rho1 (TreeSequenceVertexSet TjPrime) → + TreeSequenceInitialSegment seed TjPrime → v ∈ TreeSequenceVertexSet TjPrime → indices0 + (Fin.last p0) = q → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho1 v ∪ ({ gammaFirst } : + Finset (Fin k)) → ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → rho1 + ((ett.series.data.tree jSlot.succ.castSucc).edge a) = ett.series.data.coloring + jSlot.castSucc ((ett.series.data.tree jSlot.succ.castSucc).edge a)) → v ∈ + TreeSequenceVertexSet seed → TreeSequenceInitialSegment seed (ett.series.data.tree + q.succ.castSucc) → + ∀ (fN : E), delta ∈ MissingColors G rho1 v → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G rho1 gamma delta (Sum.inl v); + ∀ (a b : V ⊕ E) (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (exitPath : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ( (0 : ℕ) < + (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious (ett.series.data.tree + jSlot.succ.castSucc)) → ( (0 : ℕ) < (↑jSlot : ℕ) → Tprevious.length < seed.length) → ( (0 + : ℕ) < (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious seed) → + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) seed + (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), ( + ∃ (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (_ : u0 ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) (exitPath0 : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u0)), exitPath0.IsPath ∧ (2 : ℕ) ≤ exitPath0.length ∧ ( + ∀ y ∈ exitPath0.support, y ∈ componentPath.support) ∧ ( + ∀ y ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ TreeSequenceVertexSet + TjPrime, Sum.inl y ∈ exitPath0.support ↔ y = u0) ∧ ( + ∃ g ∈ BoundaryColorEdges G rho1 (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + ∪ TreeSequenceVertexSet TjPrime) gamma, Incident G u0 g ∧ Sum.inr g ∈ exitPath0.support) ∧ + ¬Incident G u0 fN ∧ + ∃ beta0 ∈ MissingColors G rho1 u0, beta0 ∉ supportColors ∧ + ∃ (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) + (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition0 = z0 ∧ seed.length ≤ + (↑zPosition0 : ℕ) ∧ ((seed.length < (↑zPosition0 : ℕ) ∧ beta0 ∈ MissingColors G rho1 z0 ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → (↑r : ℕ) < (↑zPosition0 : ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree + jSlot.succ.castSucc).vertex r)) ∨ zPosition0 = Fin.last (ett.series.data.tree + jSlot.succ.castSucc).length ∧ + ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), seed.length < (↑r : + ℕ) → beta0 ∉ MissingColors G rho1 ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ + ( + ∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0, beta0 ∉ + MissingColors G rho1 y) ∧ ( + ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) → (↑a : + ℕ) < (↑zPosition0 : ℕ) → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some + beta0) ∧ + ∃ (rho3 : PartialEdgeColoring E k), IsProperEdgeColoring G rho3 ∧ IsOneEdgeUncolored rho3 e0 ∧ + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 ∧ ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) ∧ ( + ∀ (f : E), (( + ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : + ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ + ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex + uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → rho3 f = rho1 f) ∧ ( + beta0 ∈ MissingColors G rho1 z0 → delta ∈ MissingColors G rho3 z0) ∧ ( z0 ∈ + TreeVerticesBefore TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 + z0) ∧ gammaFirst ∈ MissingColors G rho3 u0) → False + +theorem helper_hLowerPartV_179.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) (_ : + ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (_ : (0 : ℕ) < + ETTFirstAppearanceIndex ett v hvFinal), ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → + ∀ (x y : V), x ∈ TreeSequenceVertexSet A → y ∈ TreeSequenceVertexSet A → TreeVertexOrder B x y + → TreeVertexOrder A x y) → + ∀ (r a : Fin ett.rounds), (↑a : ℕ) < (↑r : ℕ) → + ∀ (sigmaR : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaR → IsOneEdgeUncolored + sigmaR e0 → StableColoring (ett.series.data.tree r.succ.castSucc) (TashkinovStoredColors + ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc) sigmaR → + ∀ (deltaR : Fin k), DefectiveColor G sigmaR (TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc)) deltaR → + ∀ (x : V), BoundaryColorVertex G sigmaR (TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc)) deltaR x → ( + ∃ (y : V), BoundaryColorVertex G sigmaR (TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc)) deltaR y ∧ TreeVertexOrder (ett.series.data.tree r.succ.castSucc) y x) → + ∀ (hxFinal : x ∈ TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett x hxFinal ≤ (↑a : ℕ) + + (1 : ℕ) → + ∀ (xa : V), ett.series.data.kind a.succ = some TashkinovExtensionKind.PE ∨ + ett.series.data.kind a.succ = some TashkinovExtensionKind.SE → + ett.series.data.chosenVertex a.succ = some xa → x = xa ∨ TreeVertexOrder + (ett.series.data.tree r.succ.castSucc) x xa := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower v q hqTerminal hvFinal + hfirstUpper hfirstPositive stepSegment stageToStage vertexTransfer orderRestrict r a har + sigmaR hproperR honeR hstableR deltaR hdefectiveR x hboundaryR hearlierR hxFinal hfirstR xa + hkindA hvertexA + obtain ⟨lower, hround, hlowerMP, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP r.val + (by omega) (by omega) + let nLower : Fin (lower.rounds + 1) := Fin.last lower.rounds + let aLower : Fin lower.rounds := ⟨a.val, by omega⟩ + have hnMap : Fin.castLE (by omega) nLower = r.castSucc := by + apply Fin.ext + simp [nLower, hround] + have hnTreeMap : Fin.castLE (by omega) nLower.castSucc = + r.castSucc.castSucc := by + apply Fin.ext + simp [nLower, hround] + have haMap : Fin.castLE (by omega) aLower.succ = a.succ := by + apply Fin.ext + rfl + let P : TreeSequence G e0 := ett.series.data.tree r.castSucc.castSucc + let Tnext : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc + have hPNext : TreeSequenceInitialSegment P Tnext := by + have hs := stepSegment r.castSucc (by simpa using (show 0 < r.val by omega)) + simpa [P, Tnext] using hs + have hxP : x ∈ TreeSequenceVertexSet P := by + exact @helper_hxP_352 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@stageToStage) (@vertexTransfer) (@r) (@a) (@har) (@x) + (@hxFinal) (@hfirstR) (@lower) (@hround) + obtain ⟨y, hyBoundary, hyx⟩ := hearlierR + have hyP : y ∈ TreeSequenceVertexSet P := by + exact @helper_hyP_393 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@r) (@a) (@har) (@x) (@hxFinal) (@lower) (@hround) + (@hPNext) (@hxP) (@y) (@hyx) + have hyxP : TreeVertexOrder P y x := + orderRestrict hPNext y x hyP hxP hyx + have hyne : y ≠ x := by + intro hyxEq + subst y + rcases hyxP with ⟨iy, ix, hiy, hix, hlt⟩ + have : iy = ix := P.vertex_injective (hiy.trans hix.symm) + omega + have boundaryRestrict : + ∀ z : V, z ∈ TreeSequenceVertexSet P → + ∀ f : E, f ∈ BoundaryColorEdges G sigmaR (TreeSequenceVertexSet Tnext) deltaR → Incident G z f + → f ∈ BoundaryColorEdges G sigmaR (TreeSequenceVertexSet P) deltaR := by + exact @helper_boundaryRestrict_424 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@vertexTransfer) (@r) (@sigmaR) (@deltaR) + (@hPNext) + obtain ⟨fx, hfxBoundary, hfxIncident⟩ := hboundaryR.2 + obtain ⟨fy, hfyBoundary, hfyIncident⟩ := hyBoundary.2 + have hfxP := boundaryRestrict x hxP fx hfxBoundary hfxIncident + have hfyP := boundaryRestrict y hyP fy hfyBoundary hfyIncident + have hfxy : fx ≠ fy := by + exact @helper_hfxy_453 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@vertexTransfer) (@r) (@sigmaR) (@deltaR) (@x) + (@hPNext) (@hxP) (@y) (@hyP) (@hyne) (@fx) (@hfxBoundary) (@hfxIncident) (@fy) + (@hfyBoundary) (@hfyIncident) (@hfyP) + have hdefectiveP : DefectiveColor G sigmaR + (TreeSequenceVertexSet P) deltaR := by + unfold DefectiveColor + exact Finset.one_lt_card.mpr ⟨fx, hfxP, fy, hfyP, hfxy⟩ + have htreeLower : lower.series.data.tree nLower.castSucc = + P := by + rw [htrees nLower.castSucc, hnTreeMap] + have hcolorLower : lower.series.data.coloring nLower = + ett.series.data.coloring r.castSucc := by + rw [(hdata nLower).1, hnMap] + have hstoredLower : TashkinovStoredColors lower.series.data nLower = + TashkinovStoredColors ett.series.data r.castSucc := by + rw [(hdata nLower).2.2.2.2.2.2.2.2.1, hnMap] + have hstableLower : StableColoring + (lower.series.data.tree nLower.castSucc) + (TashkinovStoredColors lower.series.data nLower) + (lower.series.data.coloring nLower) sigmaR := by + exact @helper_hstableLower_484 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@vertexTransfer) (@r) (@a) (@sigmaR) (@hstableR) (@x) + (@hxFinal) (@lower) (@hPNext) (@htreeLower) (@hcolorLower) (@hstoredLower) + have hdefectiveLower : DefectiveColor G sigmaR + (TreeSequenceVertexSet + (lower.series.data.tree nLower.castSucc)) deltaR := by + simpa [htreeLower] using hdefectiveP + have hboundaryLower : BoundaryColorVertex G sigmaR + (TreeSequenceVertexSet + (lower.series.data.tree nLower.castSucc)) deltaR x := by + rw [htreeLower] + exact ⟨hxP, fx, hfxP, hfxIncident⟩ + have hearlierLower : ∃ y : V, BoundaryColorVertex G sigmaR + (TreeSequenceVertexSet + (lower.series.data.tree nLower.castSucc)) deltaR y ∧ + TreeVertexOrder (lower.series.data.tree nLower.castSucc) y x := by + rw [htreeLower] + exact ⟨y, ⟨hyP, fy, hfyP, hfyIncident⟩, hyxP⟩ + have hxLower : x ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨r.val + 1, by omega⟩) := by + have hx := hboundaryR.1 + convert hx using 1; congr 2 + have hkindLower : lower.series.data.kind aLower.succ = + some TashkinovExtensionKind.PE ∨ + lower.series.data.kind aLower.succ = + some TashkinovExtensionKind.SE := by + rcases hkindA with hkindA | hkindA + · left + rw [(hdata aLower.succ).2.2.2.1, haMap] + exact hkindA + · right + rw [(hdata aLower.succ).2.2.2.1, haMap] + exact hkindA + have hvertexLower : lower.series.data.chosenVertex aLower.succ = + some xa := by + rw [(hdata aLower.succ).2.2.2.2.1, haMap] + exact hvertexA + have hfirstLower : ETTFirstAppearanceIndex lower x hxLower ≤ + aLower.val + 1 := by + exact @helper_hfirstLower_539 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@r) (@a) (@har) (@x) (@hxFinal) (@hfirstR) (@lower) + (@hround) (@htrees) (@hxLower) + have hpack := hlower lower (by omega) (by omega) hlowerMP + have hresult := hpack.2.2.2.2.1 sigmaR hproperR honeR hstableLower + deltaR hdefectiveLower x hboundaryLower hearlierLower hxLower aLower xa + hkindLower hvertexLower hfirstLower + exact hresult + +theorem helper_hLowerInterchange_328.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑q : ℕ) + (1 : ℕ) = ett.rounds → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + + (1 : ℕ) → (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (t : Fin ett.rounds) (vt : V) (gammaT deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v + hvFinal → (↑t : ℕ) < (↑q : ℕ) → ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma t.succ = some gammaT → ett.series.data.delta t.succ = some deltaT → + TreeInterchangeable G (ett.series.data.tree t.succ.succ) (ett.series.data.coloring t.succ) + gammaT deltaT := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower v q hqTerminal hvFinal + hfirstUpper hfirstPositive vertexTransfer t vt gammaT deltaT htActive htq htVertex htGamma + htDelta + have htKind : ett.series.data.kind t.succ = + some TashkinovExtensionKind.PE := by + have htData := htActive + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at htData + exact htData.2.1 + have htCurrent : IsOneEdgeUncolored + (ett.series.data.coloring t.succ) e0 ∧ + deltaT ∈ MissingColors G + (ett.series.data.coloring t.succ) vt := by + generalize htarget : t.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero t htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using htKind) + cases hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using htKind) + cases hbad + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_664 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@t) (@vt) (@gammaT) (@deltaT) + (@htVertex) (@htGamma) (@htDelta) (@i) (@previousProper) (@previousOneUncolored) + (@previousClosed) (@previousNotStronglyClosed) (@noRevisiting) (@choice) + (@seriesAlternativeFails) (@actualGamma) (@gammaRule) (@secondStable) + (@secondStableRelation) (@exitWitness) (@currentColoring) (@currentProper) + (@currentOneUncolored) (@currentStored) (@currentEdges) (@currentKind) + (@currentVertex) (@currentOutside) (@currentDelta) (@currentGamma) + (@closedExtension) (@orderedExtension) (@strictExtension) (@htarget) + obtain ⟨hcolorNe, htProper, htSegment, hvtStage, hrootPath, + hrootOnly, hnonisolated⟩ := + ParallelStepRootComponentSetup ett.series t vt gammaT deltaT + htKind htVertex htGamma htDelta + have hdeltaTree : deltaT ∈ TreeMissingColors + (ett.series.data.coloring t.succ) + (ett.series.data.tree t.succ.succ) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨vt, vertexTransfer htSegment hvtStage, htCurrent.2⟩ + let s := t.val + 1 + obtain ⟨lower, hround, hlowerMP, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP s + (by simp [s]) (by dsimp [s]; omega) + let nLower : Fin (lower.rounds + 1) := Fin.last lower.rounds + let nextLower : Fin (lower.rounds + 2) := Fin.last (lower.rounds + 1) + have hnMap : Fin.castLE (by omega) nLower = t.succ := by + apply Fin.ext + simp [nLower, hround, s] + have hnextMap : Fin.castLE (by omega) nextLower = t.succ.succ := by + apply Fin.ext + simp [nextLower, hround, s] + have htreeLower : lower.series.data.tree nextLower = + ett.series.data.tree t.succ.succ := by + rw [htrees nextLower, hnextMap] + have htreeFinal : lower.series.data.tree + (Fin.last (lower.rounds + 1)) = + ett.series.data.tree t.succ.succ := by + simpa [nextLower] using htreeLower + have hcolorLower : lower.series.data.coloring nLower = + ett.series.data.coloring t.succ := by + rw [(hdata nLower).1, hnMap] + have hstoredLower : TashkinovStoredColors lower.series.data nLower = + TashkinovStoredColors ett.series.data t.succ := by + rw [(hdata nLower).2.2.2.2.2.2.2.2.1, hnMap] + have hstableSelf : StableColoring + (ett.series.data.tree t.succ.succ) + (TashkinovStoredColors ett.series.data t.succ) + (ett.series.data.coloring t.succ) + (ett.series.data.coloring t.succ) := by + exact ⟨(by intros; rfl), (by intros; rfl)⟩ + have hstableLower : StableColoring + (lower.series.data.tree nextLower) + (TashkinovStoredColors lower.series.data nLower) + (lower.series.data.coloring nLower) + (ett.series.data.coloring t.succ) := by + simpa [htreeLower, hstoredLower, hcolorLower] using hstableSelf + have hpack := hlower lower (by omega) (by omega) hlowerMP + have hdeltaLower : deltaT ∈ TreeMissingColors + (ett.series.data.coloring t.succ) + (lower.series.data.tree (Fin.last (lower.rounds + 1))) := by + rw [htreeFinal] + exact hdeltaTree + have hinterchange := hpack.2.1 (ett.series.data.coloring t.succ) + htProper htCurrent.1 hstableLower gammaT deltaT (Or.inr hdeltaLower) + rw [htreeFinal] at hinterchange + exact hinterchange + +theorem helper_hpairOverlapColors_581.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T), ( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (gammaS deltaS gammaT deltaT : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) < (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = some + deltaS → ett.series.data.gamma t.succ = some gammaT → ett.series.data.delta t.succ = some + deltaT → ((ett.series.data.stored s.succ ∩ ett.series.data.stored t.succ : Finset (Fin + k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseActiveIndices ett v hvFinal, (↑s : ℕ) < (↑r : ℕ) ∧ (↑r : ℕ) < (↑t : ℕ) ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ ( (ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ : Finset (Fin k)).Nonempty → (ett.series.data.stored s.succ + ∩ ett.series.data.stored t.succ : Finset (Fin k)) = ({ gammaT } : Finset (Fin k)) ∧ + (ett.series.data.stored s.succ ∩ ett.series.data.stored t.succ : Finset (Fin k)) = + ({ deltaS } : Finset (Fin k)))) → ( + ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = (insert + gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k))) → + ∀ (s t : Fin ett.rounds) (vs vt : V) (gammaS deltaS gammaT deltaT : Fin k), s ∈ + ExtensionBaseActiveIndices ett v hvFinal → t ∈ ExtensionBaseActiveIndices ett v hvFinal → + (↑s : ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma s.succ = some gammaS + → ett.series.data.delta s.succ = some deltaS → ett.series.data.gamma t.succ = some gammaT + → ett.series.data.delta t.succ = some deltaT → (((insert gammaS ({ deltaS } : Finset (Fin + k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett v hvFinal vs, (↑s : ℕ) < (↑r : ℕ) ∧ (↑r : ℕ) < (↑t : ℕ) ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ ( ((insert gammaS ({ deltaS } : Finset + (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)).Nonempty → ((insert gammaS ({ deltaS } : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin + k)) = ({ gammaT } : Finset (Fin k)) ∧ ((insert gammaS ({ deltaS } : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset + (Fin k)) = ({ deltaS } : Finset (Fin k))) := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal hpairOverlap hPEStored s t vs vt gammaS + deltaS gammaT deltaT hs ht hst hsVertex htVertex hsGamma hsDelta htGamma htDelta + have hsData := hs + have htData := ht + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at hsData htData + obtain ⟨hsFirst, hsKind, vs0, hvsFinal, hvsChosen, hvsFirst⟩ := hsData + obtain ⟨htFirst, htKind, vt0, hvtFinal, hvtChosen, hvtFirst⟩ := htData + have hvsEq : vs0 = vs := + Option.some.inj (hvsChosen.symm.trans hsVertex) + have hvtEq : vt0 = vt := + Option.some.inj (hvtChosen.symm.trans htVertex) + subst vs0 + subst vt0 + have hsStored := hPEStored s gammaS deltaS hsKind hsGamma hsDelta + have htStored := hPEStored t gammaT deltaT htKind htGamma htDelta + have hoverlap := + hpairOverlap s t vs vt hvsFinal hvtFinal gammaS deltaS gammaT deltaT + hs ht hst hsVertex htVertex hsGamma hsDelta htGamma htDelta + rw [hsStored, htStored] at hoverlap + refine ⟨?_, hoverlap.2⟩ + constructor + · intro hnonempty + obtain ⟨hvs, hbetween⟩ := hoverlap.1.mp hnonempty + refine ⟨hvs, ?_⟩ + rintro ⟨r, hrClass, hsr, hrt, hrVertex⟩ + have hrData : + r ∈ ExtensionBaseActiveIndices ett v hvFinal ∧ + ett.series.data.chosenVertex r.succ = some vs := by + simpa [ExtensionBaseSupportClass] using hrClass + exact hbetween ⟨r, hrData.1, hsr, hrt, hrVertex⟩ + · rintro ⟨hvs, hbetween⟩ + apply hoverlap.1.mpr + refine ⟨hvs, ?_⟩ + rintro ⟨r, hrActive, hsr, hrt, hrVertex⟩ + apply hbetween + refine ⟨r, ?_, hsr, hrt, hrVertex⟩ + simp [ExtensionBaseSupportClass, hrActive, hrVertex] + +theorem helper_hseedBuild_496.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → (0 : ℕ) < (↑jSlot : ℕ) → + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + Tprevious.length < seed.length → TreeSequenceInitialSegment Tprevious seed → + ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) Tprevious seed ∨ + (ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges jSlot.castSucc = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) adjoinSeed seed + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj commonPrefix hjPositive Tprevious hpreviousStrict hpreviousSeed + generalize htarget : jSlot.castSucc = target + cases ett.series.certified target with + | initial => + have hzero := congrArg Fin.val htarget + simp at hzero + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_1655 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@commonPrefix) + (@hpreviousStrict) (@i) (@choice) (@currentEdges) (@currentKind) (@adjoined) + (@adjoinedExactly) (@closedExtension) (@htarget) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_1709 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@hpreviousSeed) (@i) + (@currentKind) (@closedExtension) (@htarget) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_1730 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@commonPrefix) + (@hpreviousStrict) (@i) (@available) (@currentEdges) (@currentKind) (@adjoined) + (@adjoinedExactly) (@closedExtension) (@htarget) + +theorem helper_branch_880.{u_1, u_2} : + helperBranch880Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v sigma this q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot stepSegment trace p0 indices0 rho1 + hrho1Proper hrho1One hb1Rho terminalPosition hterminalAt hterminalPositionPositive + hterminalPositionBound seed hjTreeIndex hseedTj segmentVertexBefore transportSeedRoute + commonPrefix supportColors hjPositive + let Tprevious : TreeSequence G e0 := + ett.series.data.tree jSlot.castSucc.castSucc + have hpreviousTj : TreeSequenceInitialSegment Tprevious + (ett.series.data.tree jSlot.succ.castSucc) := by + have hstep := stepSegment jSlot.castSucc (by simpa using hjPositive) + rw [hjTreeIndex] at hstep + exact hstep + have hvNotPrevious : v ∉ TreeSequenceVertexSet Tprevious := by + exact @helper_hvNotPrevious_1574 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@terminalPosition) (@hjPositive) + have hpreviousStrict : Tprevious.length < seed.length := by + exact @helper_hpreviousStrict_1615 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalAt) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hpreviousTj) (@hvNotPrevious) + have hpreviousSeed : TreeSequenceInitialSegment Tprevious seed := + commonPrefix hpreviousTj hseedTj (Nat.le_of_lt hpreviousStrict) + have hseedBuild : + (ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious seed) ∨ + ((ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + ett.series.data.connectingEdges jSlot.castSucc = {f} ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) + adjoinSeed seed) := by + exact @helper_hseedBuild_496 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@commonPrefix) (@hjPositive) + (@hpreviousStrict) (@hpreviousSeed) + have hseedBuildRho : + (ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho1 Tprevious seed) ∨ + ((ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + ett.series.data.connectingEdges jSlot.castSucc = {f} ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence rho1 adjoinSeed seed) := by + rcases hseedBuild with hparallel | hserial + · exact Or.inl ⟨hparallel.1, + transportSeedRoute Tprevious hparallel.2⟩ + · rcases hserial with ⟨hkind, f, adjoinSeed, hconnecting, + hadjoin, hroute⟩ + exact Or.inr ⟨hkind, f, adjoinSeed, hconnecting, hadjoin, + transportSeedRoute adjoinSeed hroute⟩ + obtain ⟨lower, hround, hlowerMP, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP + jSlot.val hjPositive jSlot.isLt + let nLower : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hnMap : Fin.castLE (by omega) nLower = jSlot.castSucc := by + apply Fin.ext + simp [nLower, hround] + have hnTreeMap : Fin.castLE (by omega) nLower.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simp [nLower, hround] + have htreeLower : lower.series.data.tree nLower.castSucc = + Tprevious := by + rw [htrees nLower.castSucc, hnTreeMap] + have hcolorLower : lower.series.data.coloring nLower = + ett.series.data.coloring jSlot.castSucc := by + rw [(hdata nLower).1, hnMap] + have hstoredLower : TashkinovStoredColors lower.series.data nLower = + TashkinovStoredColors ett.series.data jSlot.castSucc := by + rw [(hdata nLower).2.2.2.2.2.2.2.2.1, hnMap] + have hkindLower : lower.series.data.kind nLower = + ett.series.data.kind jSlot.castSucc := by + rw [(hdata nLower).2.2.2.1, hnMap] + have hconnectingLower : lower.series.data.connectingEdges nLower = + ett.series.data.connectingEdges jSlot.castSucc := by + rw [(hdata nLower).2.2.1, hnMap] + have hstablePrevious : StableColoring Tprevious + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho1 := by + exact @helper_hstablePrevious_1829 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@hb1Rho) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (by assumption) (@hpreviousStrict) + (@hpreviousSeed) + have hstableLower : StableColoring + (lower.series.data.tree nLower.castSucc) + (TashkinovStoredColors lower.series.data nLower) + (lower.series.data.coloring nLower) rho1 := by + simpa [htreeLower, hstoredLower, hcolorLower] using hstablePrevious + have hlowerPack := hlower lower (by omega) (by omega) hlowerMP + have hmod : ModColoring lower rho1 := + hlowerPack.2.2.2.2.2 rho1 hrho1Proper hrho1One hstableLower + have heligibleLower : + (lower.series.data.kind nLower = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho1 + (lower.series.data.tree nLower.castSucc) seed) ∨ + ((lower.series.data.kind nLower = + some TashkinovExtensionKind.SE ∨ + lower.series.data.kind nLower = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + lower.series.data.connectingEdges nLower = {f} ∧ + TreeSequenceAdjoinEdge + (lower.series.data.tree nLower.castSucc) f adjoinSeed ∧ + TashkinovAugmentationSequence rho1 adjoinSeed seed) := by + rcases hseedBuildRho with hparallel | hserial + · left + simpa [hkindLower, htreeLower] using hparallel + · right + rcases hserial with ⟨hkind, f, adjoinSeed, hconnecting, + hadjoin, hroute⟩ + refine ⟨?_, f, adjoinSeed, ?_, ?_, hroute⟩ + · simpa [hkindLower] using hkind + · simpa [hconnectingLower] using hconnecting + · simpa [htreeLower] using hadjoin + obtain ⟨TjPrime, corr, hclosure, hcorrMP, hprimeElementary, + hcaseSplit⟩ := + ExtensionBaseClosure lower rho1 seed v supportColors + (by + change TreeSequenceInitialSegment + (lower.series.data.tree nLower.castSucc) seed + rw [htreeLower] + exact hpreviousSeed) + (by + change (lower.series.data.tree nLower.castSucc).length < + seed.length + rw [htreeLower] + exact hpreviousStrict) + (by exact heligibleLower) hmod hlowerMP + (fun Tstar corr hcorrMP => by + have hcorrRounds : corr.replacementETT.rounds = jSlot.val := + corr.rungAgreement.trans hround + have hpackCorr := hlower corr.replacementETT + corr.replacementETT.roundsPositive (by omega) hcorrMP + unfold ColoredVertexSetElementary + intro x hx y hy hxy + exact hpackCorr.1 hx hy hxy) + exact ⟨TjPrime, hclosure, hprimeElementary, hcaseSplit⟩ + +theorem helper_continuation_1011.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (v : V) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0), indices0 (Fin.last p0) = q → + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 + indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + IsProperEdgeColoring G rho2 → IsOneEdgeUncolored rho2 e0 → + ∀ (_ : Fin (TjPrime.length + (1 : ℕ))), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (C : TreeSequence G e0), TashkinovAugmentationSequence rho2 seed C → ColoredVertexSetClosed + G rho2 (TreeSequenceVertexSet C) → TreeSequenceVertexSet Tj0 ⊂ TreeSequenceVertexSet C → + (0 : ℕ) < (↑jSlot : ℕ) → (ett.series.data.kind jSlot.castSucc = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence rho2 Tprevious seed ∨ + (ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges jSlot.castSucc = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence rho2 adjoinSeed seed) → + ∀ (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (⟨(↑jSlot : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑jSlot : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), lower.rounds = (↑jSlot : ℕ) → MaximumProperty lower → + let nLower : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; lower.series.data.tree + nLower.castSucc = Tprevious → lower.series.data.kind nLower = ett.series.data.kind + jSlot.castSucc → lower.series.data.connectingEdges nLower = + ett.series.data.connectingEdges jSlot.castSucc → StableColoring Tprevious + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho2 → ModColoring lower rho2 → TreeSequenceInitialSegment Tprevious C → + Tprevious.length < C.length → False := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed TjPrime hqLast u b traceB rho2 + hrho2Proper hrho2One uPosition Tprevious Tj0 C hrouteSeedC hclosedC hTj0StrictC hjPositive + hseedBuildRho2 lower hround hLowerMP nLower hLowerTree hLowerKind hLowerConnecting + hstablePrevious hmod hPreviousC hPreviousStrictC + have hLowerEligible : + (lower.series.data.kind nLower = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho2 Tprevious C) ∨ + ((lower.series.data.kind nLower = + some TashkinovExtensionKind.SE ∨ + lower.series.data.kind nLower = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + lower.series.data.connectingEdges nLower = {f} ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence rho2 adjoinSeed C) := by + rcases hseedBuildRho2 with hparallel | hserial + · exact Or.inl ⟨hLowerKind.trans hparallel.1, + Relation.ReflTransGen.trans hparallel.2 hrouteSeedC⟩ + · rcases hserial with ⟨hkind, f, adjoinSeed, hconnecting, + hadjoin, hroute⟩ + exact Or.inr + ⟨Or.imp (hLowerKind.trans) (hLowerKind.trans) hkind, + f, adjoinSeed, hLowerConnecting.trans hconnecting, hadjoin, + Relation.ReflTransGen.trans hroute hrouteSeedC⟩ + have hcorrNonempty : Nonempty + (CorrespondingExtendedTashkinovTree G k e0 lower rho2 C) := by + exact @helper_hcorrNonempty_3307 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) (@u) (@b) + (@traceB) (@C) (@lower) (@hLowerTree) (@hmod) (@hPreviousC) (@hPreviousStrictC) + (@hLowerEligible) + obtain ⟨corr⟩ := hcorrNonempty + have hreplacementMP : MaximumProperty corr.replacementETT := + MaximumPropertyTransport G k e0 lower rho2 hmod C corr hLowerMP + have hcorrRounds : corr.replacementETT.rounds = jSlot.val := + corr.rungAgreement.trans hround + have hCElementary : + ColoredVertexSetElementary G rho2 (TreeSequenceVertexSet C) := + (hlower corr.replacementETT corr.replacementETT.roundsPositive + (by omega) hreplacementMP).1 + have hbound : (TreeSequenceVertexSet C).card ≤ + (TreeSequenceVertexSet Tj0).card := by + exact @helper_hbound_3342 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@trace) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) + (@hqLast) (@u) (@b) (@traceB) (@hrho2Proper) (@hrho2One) (@uPosition) (@C) (@hrouteSeedC) + (@hclosedC) (@hjPositive) (@hseedBuildRho2) (@lower) (@hround) (@hstablePrevious) (@corr) + (@hcorrRounds) + have hstrictCard := Finset.card_lt_card hTj0StrictC + exact (Nat.not_lt_of_ge hbound) hstrictCard + +theorem helper_branch_1756.{u_1, u_2} : + helperBranch1756Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower v sigma q qSpecification + subst q + set q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) + intro hqTerminal hvFinal hfirstUpper hfirstPositive jSlot jSlotSpecification + subst jSlot + set jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : + Fin ett.rounds) + intro hjSlot segmentTrans vertexTransfer trace hterminalJ p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj commonPrefix + TjPrime hqLast u b traceB huOutside rho2 c1 hrho2Proper hrho2One uPosition Tprevious + hpreviousTj hpreviousStrict hpreviousSeed Tj0 C hrouteSeedC hclosedC segmentVertexBeforeJ + transportSeedRoute2 huC hTj0StrictC hjPositive + have hseedBuildPhi : + (ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious seed) ∨ + ((ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + ett.series.data.connectingEdges jSlot.castSucc = {f} ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) + adjoinSeed seed) := by as_aux_lemma => + generalize htarget : jSlot.castSucc = target + cases ett.series.certified target with + | initial => + have hzero := congrArg Fin.val htarget + simp at hzero + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_3050 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) + (@commonPrefix) (@hpreviousStrict) (@hjPositive) (@i) (@choice) (@currentEdges) + (@currentKind) (@adjoined) (@adjoinedExactly) (@closedExtension) (@htarget) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails chosenGamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact @helper_branch_3107 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) + (@hpreviousSeed) (@hjPositive) (@i) (@currentKind) (@closedExtension) (@htarget) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_3129 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) + (@commonPrefix) (@hpreviousStrict) (@hjPositive) (@i) (@available) + (@currentEdges) (@currentKind) (@adjoined) (@adjoinedExactly) (@closedExtension) + (@htarget) + have hseedBuildRho2 : + (ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho2 Tprevious seed) ∨ + ((ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + ett.series.data.connectingEdges jSlot.castSucc = {f} ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence rho2 adjoinSeed seed) := by + as_aux_lemma => + rcases hseedBuildPhi with hparallel | hserial + · exact Or.inl ⟨hparallel.1, + transportSeedRoute2 Tprevious hparallel.2⟩ + · rcases hserial with ⟨hkind, f, adjoinSeed, hconnecting, + hadjoin, hroute⟩ + exact Or.inr ⟨hkind, f, adjoinSeed, hconnecting, hadjoin, + transportSeedRoute2 adjoinSeed hroute⟩ + obtain ⟨lower, hround, hLowerMP, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP + jSlot.val hjPositive jSlot.isLt + let nLower : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hnMap : Fin.castLE (by omega) nLower = jSlot.castSucc := by + apply Fin.ext + simp [nLower, hround] + have hnTreeMap : Fin.castLE (by omega) nLower.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simp [nLower, hround] + have hLowerTree : lower.series.data.tree nLower.castSucc = + Tprevious := by + rw [htrees nLower.castSucc, hnTreeMap] + have hLowerColor : lower.series.data.coloring nLower = + ett.series.data.coloring jSlot.castSucc := by + rw [(hdata nLower).1, hnMap] + have hLowerStored : TashkinovStoredColors lower.series.data nLower = + TashkinovStoredColors ett.series.data jSlot.castSucc := by + rw [(hdata nLower).2.2.2.2.2.2.2.2.1, hnMap] + have hLowerKind : lower.series.data.kind nLower = + ett.series.data.kind jSlot.castSucc := by + rw [(hdata nLower).2.2.2.1, hnMap] + have hLowerConnecting : lower.series.data.connectingEdges nLower = + ett.series.data.connectingEdges jSlot.castSucc := by + rw [(hdata nLower).2.2.1, hnMap] + have hstablePrevious : StableColoring Tprevious + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho2 := by + exact @helper_hstablePrevious_3232 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@hterminalJ) (@p0) (@indices0) + (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@u) (@b) + (@traceB) (@c1) (@hpreviousStrict) (@hpreviousSeed) (@segmentVertexBeforeJ) (@hjPositive) + have hstableLower : StableColoring + (lower.series.data.tree nLower.castSucc) + (TashkinovStoredColors lower.series.data nLower) + (lower.series.data.coloring nLower) rho2 := by + simpa [hLowerTree, hLowerStored, hLowerColor] using hstablePrevious + have hLowerPack := hlower lower (by omega) (by omega) hLowerMP + have hmod : ModColoring lower rho2 := + hLowerPack.2.2.2.2.2 rho2 hrho2Proper hrho2One hstableLower + have hPreviousC : TreeSequenceInitialSegment Tprevious C := by + rcases hseedBuildRho2 with hparallel | hserial + · exact TashkinovAugmentationSequenceInitialSegment rho2 Tprevious C + (Relation.ReflTransGen.trans hparallel.2 hrouteSeedC) + · rcases hserial with ⟨-, f, adjoinSeed, -, hadjoin, hroute⟩ + exact segmentTrans hadjoin.2.1 + (TashkinovAugmentationSequenceInitialSegment rho2 adjoinSeed C + (Relation.ReflTransGen.trans hroute hrouteSeedC)) + have huNotPrevious : u ∉ TreeSequenceVertexSet Tprevious := by + intro huPrevious + exact huOutside (vertexTransfer (hpreviousTj hjPositive) huPrevious) + have hPreviousStrictC : Tprevious.length < C.length := by + have hsubset : TreeSequenceVertexSet Tprevious ⊆ + TreeSequenceVertexSet C := vertexTransfer hPreviousC + have hstrict : TreeSequenceVertexSet Tprevious < + TreeSequenceVertexSet C := + Finset.ssubset_iff_subset_ne.mpr ⟨hsubset, by + intro heq + exact huNotPrevious (heq.symm.subset huC)⟩ + have hcard := Finset.card_lt_card hstrict + simpa [TreeSequenceVertexSet, Finset.card_image_of_injective, + Tprevious.vertex_injective, C.vertex_injective] using hcard + exact @helper_continuation_1011 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@v) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) + (@trace) (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@TjPrime) (@hqLast) (@u) (@b) (@traceB) (@hrho2Proper) + (@hrho2One) (@uPosition) (@C) (@hrouteSeedC) (@hclosedC) (@hTj0StrictC) (@hjPositive) + (@hseedBuildRho2) (@lower) (@hround) (@hLowerMP) (@hLowerTree) (@hLowerKind) + (@hLowerConnecting) (@hstablePrevious) (@hmod) (@hPreviousC) (@hPreviousStrictC) +theorem helper_hterminalColorsNotRestored_1977.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), ett.series.data.chosenVertex q.succ = some v + → ett.series.data.gamma q.succ = some gamma → ett.series.data.delta q.succ = some delta → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ( + ∀ (t : Fin ett.rounds), ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT) → + ( + ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = (insert + gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k))) → ( + ∀ (s t : Fin ett.rounds) (vs vt : V) (gammaS deltaS gammaT deltaT : Fin k), s ∈ + ExtensionBaseActiveIndices ett v hvFinal → t ∈ ExtensionBaseActiveIndices ett v hvFinal → + (↑s : ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma s.succ = some gammaS + → ett.series.data.delta s.succ = some deltaS → ett.series.data.gamma t.succ = some gammaT + → ett.series.data.delta t.succ = some deltaT → (((insert gammaS ({ deltaS } : Finset (Fin + k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : + Finset (Fin k)).Nonempty ↔ vs = vt ∧ ¬ + ∃ r ∈ ExtensionBaseSupportClass ett v hvFinal vs, (↑s : ℕ) < (↑r : ℕ) ∧ (↑r : ℕ) < (↑t : ℕ) ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ ( ((insert gammaS ({ deltaS } : Finset + (Fin k)) : Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin + k)) : Finset (Fin k)).Nonempty → ((insert gammaS ({ deltaS } : Finset (Fin k)) : Finset + (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset (Fin + k)) = ({ gammaT } : Finset (Fin k)) ∧ ((insert gammaS ({ deltaS } : Finset (Fin k)) : + Finset (Fin k)) ∩ (insert gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k)) : Finset + (Fin k)) = ({ deltaS } : Finset (Fin k)))) → q ∈ ExtensionBaseActiveIndices ett v hvFinal + → q ∈ ExtensionBaseSupportClass ett v hvFinal v → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), indices0 + (Fin.last p0) = q → + let restorationColors : Finset (Fin k) := (ExtensionBaseRestorationIndices ett v + hvFinal).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ; gamma ∉ + restorationColors ∧ delta ∉ restorationColors := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta q hqTerminal hqVertex + hqGamma hqDelta hvFinal hfirstUpper hfirstPositive jSlot hPESlotData hPEStored + hpairOverlapColors hqActive hqClass p0 indices0 gamma0 delta0 terminalPosition hqLast + restorationColors + have hseparate : ∀ c : Fin k, c ∈ ({gamma, delta} : Finset (Fin k)) → + c ∉ restorationColors := by + intro c hcTerminal hcRestored + obtain ⟨s, hsRestored, hcStored⟩ := + Finset.mem_biUnion.mp hcRestored + have hsData := hsRestored + simp only [ExtensionBaseRestorationIndices, Finset.mem_sdiff] at hsData + have hsActiveData := hsData.1 + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at hsActiveData + obtain ⟨hsFirst, hsKind, vs, hvsFinal, hsVertex, hsAppearance⟩ := + hsActiveData + obtain ⟨vs', gammaS, deltaS, hsVertex', hsGamma, hsDelta⟩ := + hPESlotData s hsKind + have hvsEq : vs' = vs := + Option.some.inj (hsVertex'.symm.trans hsVertex) + subst vs' + have hsStored : ett.series.data.stored s.succ = + {gammaS, deltaS} := + hPEStored s gammaS deltaS hsKind hsGamma hsDelta + have hsNeQ : s ≠ q := by + intro hsq + apply hsData.2 + simpa [hsq] using hqClass + have hsq : s.val < q.val := by + have hsle : s.val ≤ q.val := by omega + exact lt_of_le_of_ne hsle (fun heq => hsNeQ (Fin.ext heq)) + have hoverlap := hpairOverlapColors s q vs v gammaS deltaS gamma delta + hsData.1 hqActive hsq hsVertex hqVertex hsGamma hsDelta hqGamma + hqDelta + have hnonempty : + (({gammaS, deltaS} : Finset (Fin k)) ∩ {gamma, delta}).Nonempty := by + refine ⟨c, ?_⟩ + rw [← hsStored] + exact Finset.mem_inter.mpr ⟨hcStored, hcTerminal⟩ + have hsameSupport : vs = v := (hoverlap.1.mp hnonempty).1 + apply hsData.2 + simp only [ExtensionBaseSupportClass, Finset.mem_filter] + refine ⟨hsData.1, ?_⟩ + simpa [hsameSupport] using hsVertex + exact ⟨hseparate gamma (by simp), hseparate delta (by simp)⟩ + +theorem helper_branch_2914.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0), indices0 (Fin.last p0) = q → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ( (0 : ℕ) < + (↑jSlot : ℕ) → Tprevious.length < seed.length) → ( (0 : ℕ) < (↑jSlot : ℕ) → + TreeSequenceInitialSegment Tprevious seed) → + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : PartialEdgeColoring + E k), IsProperEdgeColoring G rho3 → IsOneEdgeUncolored rho3 e0 → + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho3 → + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : + ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (C : TreeSequence G e0), TashkinovClosure rho3 U C → TashkinovAugmentationSequence rho3 seed + C → TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ⊂ + TreeSequenceVertexSet C → ( + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {y : V}, y ∈ TreeSequenceVertexSet A → y ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ) → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho3 S seed) → (0 : ℕ) < (↑jSlot : + ℕ) → False := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot trace hterminalJ p0 indices0 gamma0 delta0 + rho1 terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex + hseedTj _ _ commonPrefix TjPrime hqLast H x componentPath u exitPath Tprevious + hpreviousStrict hpreviousSeed zPosition u0 exitPath0 zPosition0 rho3 hrho3Proper hrho3One + hd1 uPosition huPositionPositive huPositionBound U C hclosureUC hrouteSeedC hTjStrictC + segmentVertexBefore transportSeedRoute hjPositive + have hstablePrevious : StableColoring Tprevious + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho3 := by + constructor + · exact @helper_branch_5420 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@hterminalJ) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (by assumption) (@hpreviousStrict) + (@hpreviousSeed) (@rho3) (@hd1) (by assumption) (@hjPositive) + · intro y hy + exact hd1.2 y (segmentVertexBefore (hpreviousSeed hjPositive) + (hpreviousStrict hjPositive) hy) + have hseedBuildRho : + (ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho3 Tprevious seed) ∨ + ((ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + ett.series.data.connectingEdges jSlot.castSucc = {f} ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence rho3 adjoinSeed seed) := by + generalize htarget : jSlot.castSucc = target + cases ett.series.certified target with + | initial => + have hzero := congrArg Fin.val htarget + simp at hzero + omega + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails chosenGamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious seed := by + have hfull := closedExtension.1 + rw [hi, hjTreeIndex] at hfull + have hbase : TreeSequenceInitialSegment Tprevious seed := + hpreviousSeed hjPositive + exact TashkinovAugmentationSequenceRestrict _ Tprevious seed _ + (by simpa [Tprevious, hi] using hfull) hbase hseedTj + exact Or.inl ⟨by simpa [htarget] using currentKind, + transportSeedRoute Tprevious hroute⟩ + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + exact @helper_branch_5475 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) + (by assumption) (@commonPrefix) (@hpreviousStrict) (@rho3) (by assumption) + (@hjPositive) (@i) (@choice) (@currentEdges) (@currentKind) (@adjoined) + (@adjoinedExactly) (@closedExtension) (@htarget) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + exact @helper_branch_5528 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) + (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@terminalPosition) + (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) + (by assumption) (@commonPrefix) (@hpreviousStrict) (@rho3) (by assumption) + (@hjPositive) (@i) (@available) (@currentEdges) (@currentKind) (@adjoined) + (@adjoinedExactly) (@closedExtension) (@htarget) + have hbound : (TreeSequenceVertexSet C).card ≤ + (TreeSequenceVertexSet + (ett.series.data.tree jSlot.succ.castSucc)).card := by + exact @helper_hbound_5582 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@v) (@gamma) (@delta) (@sigma) + (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@trace) (@p0) + (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@hqLast) (@x) (@componentPath) (@u) + (@exitPath) (@zPosition) (@u0) (@exitPath0) (@zPosition0) (@rho3) (@hrho3Proper) + (@hrho3One) (@uPosition) (@huPositionPositive) (@huPositionBound) (@C) (@hclosureUC) + (@hrouteSeedC) (@hjPositive) (@hstablePrevious) (@hseedBuildRho) + exact (Nat.not_lt_of_ge hbound) (Finset.card_lt_card hTjStrictC) + +theorem helper_hterminalPositionPositive_1612.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds), ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ett.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal + ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v → (1 : ℕ) ≤ + (↑terminalPosition : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hqKind hqVertex hvFinal + hfirstUpper hfirstPositive jSlot hjSlot stageToStage terminalPosition hterminalAt + generalize htarget : q.succ = target + cases hcert : ett.series.certified target with + | initial => exact (Fin.succ_ne_zero q htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hqKind) + cases hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hqKind) + cases hbad + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_1321 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) + (@hqVertex) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@stageToStage) + (@terminalPosition) (@hterminalAt) (@i) (@previousProper) (@previousOneUncolored) + (@previousClosed) (@previousNotStronglyClosed) (@noRevisiting) (@choice) + (@seriesAlternativeFails) (@chosenGamma) (@gammaRule) (@secondStable) + (@secondStableProper) (@secondStableOneUncolored) (@secondStableRelation) + (@exitWitness) (@currentColoring) (@currentProper) (@currentOneUncolored) + (@currentStored) (@currentEdges) (@currentKind) (@currentVertex) (@currentOutside) + (@currentDelta) (@currentGamma) (@closedExtension) (@orderedExtension) + (@strictExtension) (@htarget) (@hcert) + +theorem helper_hseedBuild_3505.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (TjPrime : TreeSequence G e0), indices0 (Fin.last p0) = q → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ( (0 : ℕ) < + (↑jSlot : ℕ) → Tprevious.length < seed.length) → ( (0 : ℕ) < (↑jSlot : ℕ) → + TreeSequenceInitialSegment Tprevious seed) → + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : Fin (TjPrime.length + + (1 : ℕ))), (0 : ℕ) < (↑jSlot : ℕ) → + ∀ (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (⟨(↑jSlot : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑jSlot : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), lower.rounds = (↑jSlot : ℕ) → ett.series.data.kind + jSlot.castSucc = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious seed ∨ (ett.series.data.kind + jSlot.castSucc = some TashkinovExtensionKind.SE ∨ ett.series.data.kind jSlot.castSucc = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges jSlot.castSucc = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ + TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) adjoinSeed seed + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj + commonPrefix TjPrime hqLast H x componentPath u exitPath Tprevious hpreviousStrict + hpreviousSeed zPosition u0 exitPath0 zPosition0 uPosition hjPositive lower hround + generalize htarget : jSlot.castSucc = target + cases ett.series.certified target with + | initial => + have hzero := congrArg Fin.val htarget + simp at hzero + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + exact @helper_branch_5782 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@commonPrefix) + (@hpreviousStrict) (@hjPositive) (@i) (@choice) (@currentEdges) (@currentKind) + (@adjoined) (@adjoinedExactly) (@closedExtension) (@htarget) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails chosenGamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact @helper_branch_5839 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@hpreviousSeed) (@hjPositive) + (@i) (@currentKind) (@closedExtension) (@htarget) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + exact @helper_branch_5861 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) + (@hfirstUpper) (@hfirstPositive) (@terminalPosition) (@hterminalPositionPositive) + (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) (@commonPrefix) + (@hpreviousStrict) (@hjPositive) (@i) (@available) (@currentEdges) (@currentKind) + (@adjoined) (@adjoinedExactly) (@closedExtension) (@htarget) + +theorem helper_orderRestrict_1438.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → + ∀ (x y : V), x ∈ TreeSequenceVertexSet A → y ∈ TreeSequenceVertexSet A → TreeVertexOrder B x y + → TreeVertexOrder A x y := by + classical + intro V E G e0 A B hAB x y hxA hyA hxy + rcases hAB with ⟨hlen, hvertices, hedges⟩ + rcases Finset.mem_image.mp hxA with ⟨ix, _, hix⟩ + rcases Finset.mem_image.mp hyA with ⟨iy, _, hiy⟩ + rcases hxy with ⟨jx, jy, hjx, hjy, hjlt⟩ + have hjxEq : jx = Fin.castLE (Nat.succ_le_succ hlen) ix := by + apply B.vertex_injective + exact hjx.trans ((hvertices ix).trans hix).symm + have hjyEq : jy = Fin.castLE (Nat.succ_le_succ hlen) iy := by + apply B.vertex_injective + exact hjy.trans ((hvertices iy).trans hiy).symm + refine ⟨ix, iy, hix, hiy, ?_⟩ + rw [hjxEq, hjyEq] at hjlt + simpa using hjlt + +theorem helper_hjInitial_1603.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ t ∈ ExtensionBaseRestorationIndices ett v hvFinal, TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree t.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hjSlot stageToStage t htRest + have htData := htRest + simp only [ExtensionBaseRestorationIndices, Finset.mem_sdiff] at htData + have htActiveData := htData.1 + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at htActiveData + have hjt : jSlot.val + 1 ≤ t.val + 1 := by + rw [hjSlot] + exact htActiveData.1 + have hseg := stageToStage (jSlot.val + 1) (t.val + 1) + (by omega) hjt (by omega) + convert hseg using 1 <;> congr 1 + +theorem helper_hclassPrepared_1698.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ( + ∀ (u : V), (ExtensionBaseSupportClass ett v hvFinal u).Nonempty → + ∃ (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (gammaClass : Fin (p + (1 : ℕ)) → Fin + k) (deltaClass : Fin (p + (1 : ℕ)) → Fin k), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) ∧ + ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gammaClass a)) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (deltaClass a)) ∧ ( + ∀ (a : Fin p), gammaClass a.succ = deltaClass a.castSucc) ∧ Function.Injective (Fin.cons + (gammaClass (0 : Fin (p + (1 : ℕ)))) deltaClass) ∧ ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), ( + ∀ r ∈ ExtensionBaseActiveIndices ett v hvFinal, ett.series.data.chosenVertex r.succ ≠ some x) + → MissingColors G sigma x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + let storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p + (1 : ℕ))) ↦ + ett.series.data.stored (indices a).succ; (MissingColors G sigma u ∩ storedPairs : Finset + (Fin k)) = ({deltaClass (Fin.last p)} : Finset (Fin k)) ∧ MissingColors G + (ett.series.data.coloring jSlot.castSucc) u = MissingColors G sigma u \ + ({deltaClass (Fin.last p)} : Finset (Fin k)) ∪ ({gammaClass (0 : Fin (p + (1 : ℕ)))} : + Finset (Fin k))) → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc), x ≠ v → ( + ∃ t ∈ ExtensionBaseRestorationIndices ett v hvFinal, ett.series.data.chosenVertex t.succ = + some x) → + ∃ (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds) (gammaClass : Fin (p + (1 : ℕ)) → Fin + k) (deltaClass : Fin (p + (1 : ℕ)) → Fin k), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) ∧ + ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal x ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.gamma (indices a).succ = some (gammaClass a)) ∧ ( + ∀ (a : Fin (p + (1 : ℕ))), ett.series.data.delta (indices a).succ = some (deltaClass a)) ∧ ( + ∀ (a : Fin p), gammaClass a.succ = deltaClass a.castSucc) ∧ Function.Injective (Fin.cons + (gammaClass (0 : Fin (p + (1 : ℕ)))) deltaClass) ∧ MissingColors G + (ett.series.data.coloring jSlot.castSucc) x = MissingColors G sigma x \ + ({deltaClass (Fin.last p)} : Finset (Fin k)) ∪ ({gammaClass (0 : Fin (p + (1 : ℕ)))} : + Finset (Fin k)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot hclassPackage x hxJ hxNe + rintro ⟨t, htRest, htVertex⟩ + have htData := htRest + simp only [ExtensionBaseRestorationIndices, Finset.mem_sdiff] at htData + have htClass : t ∈ ExtensionBaseSupportClass ett v hvFinal x := by + simp [ExtensionBaseSupportClass, htData.1, htVertex] + obtain ⟨p, indices, gammaClass, deltaClass, hincreasing, hclass, + hgammaClass, hdeltaClass, hchain, hinjective, + hunsupportedClass, hmissing⟩ := hclassPackage x ⟨t, htClass⟩ + dsimp at hmissing + exact ⟨p, indices, gammaClass, deltaClass, hincreasing, hclass, + hgammaClass, hdeltaClass, hchain, hinjective, hmissing.2⟩ + +theorem helper_hb1Tj_1978.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) + (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + StableColoringBeforeVertex T v hvFinal + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho1 → + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ ⊆ + TreeVerticesBefore T v hvFinal → + StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) + (ett.series.data.coloring jSlot.castSucc) rho1 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace hterminalJ rho1 hb1Rho hbeforeTjFinal + constructor + · intro f hfIncident hfControlled + obtain ⟨x, hxBefore, hxf⟩ := hfIncident + apply hb1Rho.1 f ⟨x, hbeforeTjFinal hxBefore, hxf⟩ + obtain ⟨c, hcControlled, hfc⟩ := hfControlled + refine ⟨c, ?_, hfc⟩ + rcases Finset.mem_union.mp hcControlled with hcMissing | hcStored + · apply Finset.mem_union_left + obtain ⟨z, hzBefore, hcz⟩ := Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨z, hbeforeTjFinal hzBefore, hcz⟩ + · exact Finset.mem_union_right _ hcStored + · intro x hxBefore + exact hb1Rho.2 x (hbeforeTjFinal hxBefore) + +theorem helper_hinitialB_2039.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal + sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + + (1 : ℕ)) → Fin k), ( + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + → ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.gamma (indices0 a).succ = some (gamma0 a)) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseSupportClass ett v hvFinal v + → s ≠ q → ett.series.data.chosenVertex s.succ = some v → ett.series.data.gamma s.succ = + some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett s + v rho1 gammaS deltaS) → indices0 (Fin.last p0) = q → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.chosenVertex (indices0 a).succ = some v) → + ∀ (b a : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → ETTStrongInterchangeable ett (indices0 a) + v rho1 (gamma0 a) (delta0 a) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hvFinal trace p0 indices0 + gamma0 delta0 hincreasing0 hclass0 hgamma0 hdelta0 rho1 hb4Interchange hqLast hsupport0 b a + hab + apply hb4Interchange (indices0 a) (gamma0 a) (delta0 a) + · exact (hclass0 (indices0 a)).2 ⟨a, rfl⟩ + · intro heq + have haLast : a.val < (Fin.last p0).val := + lt_of_lt_of_le hab (Fin.le_last b) + have hindexLt := hincreasing0 a (Fin.last p0) haLast + rw [hqLast, heq] at hindexLt + exact (Nat.lt_irrefl _ hindexLt) + · exact hsupport0 a + · exact hgamma0 a + · exact hdelta0 a + +theorem helper_hTjInitialB_2054.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), indices0 (Fin.last + p0) = q → + ∀ (b a : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree (indices0 + a).succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hjSlot stageToStage p0 indices0 hclass0 terminalPosition hqLast b a hab + have haClass := (hclass0 (indices0 a)).2 ⟨a, rfl⟩ + have haData := haClass + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at haData + have haActive := haData.1 + have haActiveData := haActive + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at haActiveData + have hjIndexLe : jSlot.val + 1 ≤ (indices0 a).val + 1 := by + rw [hjSlot] + exact haActiveData.1 + have hseg := stageToStage (jSlot.val + 1) + ((indices0 a).val + 1) (by omega) hjIndexLe (by omega) + convert hseg using 1 <;> congr 1 + +theorem helper_hseedBeforeU_2115.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive + : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0), TreeSequenceInitialSegment seed TjPrime → + ∀ (u : V) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u → u ∉ + TreeSequenceVertexSet seed → seed.length < (↑uPosition : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed TjPrime hseedPrime u uPosition huPosition huNotSeed + by_contra hnot + have huBound : uPosition.val ≤ seed.length := Nat.le_of_not_gt hnot + let i : Fin (seed.length + 1) := ⟨uPosition.val, by omega⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hseedPrime.1) i = + uPosition := by + apply Fin.ext + rfl + apply huNotSeed + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨i, ?_⟩ + exact (hseedPrime.2.1 i).symm.trans (hcast ▸ huPosition) + +theorem helper_hrightOutside_2349.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)) (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length) (TjPrime : TreeSequence G e0) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; + ∀ (M : TreeSequence G e0), TreeSequenceInitialSegment U M → + ∀ (n : ℕ), U.length ≤ n → + ∀ (hnM : n + (1 : ℕ) ≤ M.length), + let mIndex : Fin M.length := (⟨n, + by omega + ⟩ : Fin M.length); + ∀ (i : Fin Tj0.length), M.vertex mIndex.succ = Tj0.vertex i.succ → Tj0.vertex i.succ ∉ + TreeSequenceVertexSet U := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound TjPrime uPosition huPositionPositive huPositionBound U Tj0 M + hleftSegment n hnU hnM mIndex i hvertexMTj hmem + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hmem + obtain ⟨a, ha⟩ := hmem + have hmvertex : M.vertex + (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) = + U.vertex a := hleftSegment.2.1 a + have heq : M.vertex mIndex.succ = + M.vertex + (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) := + hvertexMTj.trans (ha.symm.trans hmvertex.symm) + have hindex := congrArg Fin.val (M.vertex_injective heq) + simp [mIndex] at hindex + omega + +theorem helper_hsupportColors_2684.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T), ( + ∀ (t : Fin ett.rounds) (gammaT deltaT : Fin k), ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE → ett.series.data.gamma t.succ = some gammaT → + ett.series.data.delta t.succ = some deltaT → ett.series.data.stored t.succ = (insert + gammaT ({ deltaT } : Finset (Fin k)) : Finset (Fin k))) → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; (supportColors = (ExtensionBaseSupportClass ett + v hvFinal v).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ) → + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → gammaS ∈ supportColors ∧ deltaS ∈ supportColors := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hvFinal hPEStored p0 indices0 + supportColors hsupportSet s gammaS deltaS hs hsGamma hsDelta + have hsClass := (Finset.mem_erase.mp hs).2 + have hsClassData := hsClass + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at hsClassData + have hsActiveData := hsClassData.1 + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at hsActiveData + have hsStored := hPEStored s gammaS deltaS hsActiveData.2.1 + hsGamma hsDelta + rw [hsupportSet] + constructor <;> apply Finset.mem_biUnion.mpr <;> + refine ⟨s, hsClass, ?_⟩ <;> rw [hsStored] <;> simp + +theorem helper_branch_2800.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ett.series.data.chosenVertex q.succ = some v → + ∀ (i : Fin ett.rounds), IsProperEdgeColoring G (ett.series.data.coloring i.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring i.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring + i.castSucc) (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate ett.series.data i.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)), + ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data i.castSucc) : Finset (Fin k)) choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho + (ett.series.data.tree i.succ.castSucc))) → + ∀ (actualGamma : Fin k), ParallelExtensionColor ett.series.data i.castSucc choice.selected + choice.vertex actualGamma → + ∀ (secondStable : PartialEdgeColoring E k), StableColoring (ett.series.data.tree + i.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data i.castSucc) : + Finset (Fin k)) choice.selected secondStable → TreeExit (ett.series.data.tree + i.succ.castSucc) secondStable actualGamma choice.color choice.vertex → + ett.series.data.coloring i.succ = TwoColorComponentSwap G secondStable actualGamma + choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G (ett.series.data.coloring + i.succ) → IsOneEdgeUncolored (ett.series.data.coloring i.succ) e0 → ett.series.data.stored + i.succ = (insert choice.color ({ actualGamma } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.connectingEdges i.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex i.succ = some choice.vertex → ett.series.data.outsideVertex + i.succ = some choice.otherEndpoint → ett.series.data.delta i.succ = some choice.color → + ett.series.data.gamma i.succ = some actualGamma → TashkinovClosure + (ett.series.data.coloring i.succ) (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ) → TreeSequenceInitialSegment (ett.series.data.tree + i.succ.castSucc) (ett.series.data.tree i.succ.succ) → (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length → q.succ = i.succ → + ∃ (fN : E), ett.series.data.connectingEdges i.succ = ({ fN } : Finset E) ∧ Incident G v fN ∧ + IsProperEdgeColoring G (ett.series.data.coloring i.succ) ∧ IsOneEdgeUncolored + (ett.series.data.coloring i.succ) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqVertex i previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails actualGamma gammaRule secondStable secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension htarget + have hi : i = q := by + apply Fin.ext + simpa using (congrArg Fin.val htarget).symm + subst i + have hvChoice : choice.vertex = v := + Option.some.inj + (currentVertex.symm.trans (by simpa [htarget] using hqVertex)) + refine ⟨choice.edge, ?_, ?_, ?_, ?_⟩ + · simpa [htarget] using currentEdges + · simpa [hvChoice] using choice.edgeIncident + · simpa [htarget] using currentProper + · simpa [htarget] using currentOneUncolored + +theorem helper_hterminalColorControlled_2850.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (gamma delta : Fin k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + let controlled : Finset (Fin k) := TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors ett.series.data q.succ; + ett.series.data.stored q.succ = (insert gamma ({ delta } : Finset (Fin k)) : Finset (Fin + k)) → + ∀ c ∈ (insert gamma ({ delta } : Finset (Fin k)) : Finset (Fin k)), c ∈ controlled := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive gamma delta q controlled + hterminalRawStored c hc + by_cases hcMissing : c ∈ TreeMissingColors + (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) + · exact Finset.mem_union_left _ hcMissing + · apply Finset.mem_union_right + unfold TashkinovStoredColors + have hqSuccNe : q.succ.val ≠ 0 := Nat.succ_ne_zero q.val + rw [ite_eq_right hqSuccNe] + apply Finset.mem_sdiff.mpr + refine ⟨?_, hcMissing⟩ + apply Finset.mem_biUnion.mpr + refine ⟨q.succ, Finset.mem_univ _, ?_⟩ + rw [ite_eq_left le_rfl, hterminalRawStored] + exact hc + +theorem helper_hsigmaControlled_2871.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + let controlled : Finset (Fin k) := TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors ett.series.data q.succ; + StableColoring (ett.series.data.tree q.succ.castSucc) controlled (ett.series.data.coloring + q.succ) sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma q hsigmaTerminal controlled + constructor + · intro f hfIncident hfControl + apply hsigmaTerminal.1 f hfIncident + obtain ⟨c, hc, hfc⟩ := hfControl + refine ⟨c, ?_, hfc⟩ + rcases Finset.mem_union.mp hc with hcMissing | hcControlled + · exact Finset.mem_union_left _ hcMissing + · change c ∈ TreeMissingColors + (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.succ at hcControlled + exact hcControlled + · exact hsigmaTerminal.2 + +theorem helper_hTjInitialEarlier_3214.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (1 : + ℕ) ≤ (↑terminalPosition : ℕ) → (↑terminalPosition : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length → indices0 (Fin.last p0) = q → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))), + ∀ s ∈ (ExtensionBaseSupportClass ett v hvFinal v).erase q, TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree s.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot hjSlot stageToStage trace p0 indices0 gamma0 + delta0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound hqLast H x + componentPath u exitPath zPosition s hs + have hsClass := (Finset.mem_erase.mp hs).2 + have hsData := hsClass + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at hsData + have hsActive := hsData.1 + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at hsActive + have hjIndexLe : jSlot.val + 1 ≤ s.val + 1 := by + rw [hjSlot] + exact hsActive.1 + have hseg := stageToStage (jSlot.val + 1) (s.val + 1) + (by omega) hjIndexLe (by omega) + convert hseg using 1 <;> congr 1 + +theorem helper_hseedBeforeU_3367.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0), TreeSequenceInitialSegment seed TjPrime → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (_ : (TwoColorIncidenceGraph G rho1 gamma + delta).Walk (Sum.inl x) (Sum.inl u0)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 → u0 ∉ TreeSequenceVertexSet seed → seed.length < + (↑uPosition : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed TjPrime hseedPrime H + x componentPath u exitPath zPosition u0 exitPath0 zPosition0 uPosition huPosition huNotSeed + by_contra hnot + have huBound : uPosition.val ≤ seed.length := Nat.le_of_not_gt hnot + let i : Fin (seed.length + 1) := ⟨uPosition.val, by omega⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hseedPrime.1) i = + uPosition := by + apply Fin.ext + rfl + apply huNotSeed + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨i, ?_⟩ + exact (hseedPrime.2.1 i).symm.trans (hcast ▸ huPosition) + +theorem helper_hbeforeZMissing_3860.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → TreeSequenceInitialSegment + (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree q.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime), u0 ∉ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) → + ∀ (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (rho3 + : PartialEdgeColoring E k), ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → ( + ∀ {y : V}, y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 → y ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∧ y ≠ z0) → + ∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0, y ≠ v → + MissingColors G rho3 y = MissingColors G (ett.series.data.coloring jSlot.castSucc) y := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot vertexTransfer trace rho1 hb2Missing hTjQ TjPrime u0 + huPrime0 huOutside0 z0 hz0 rho3 hd2Missing hbeforeZData y hy hyTerminal + have hyData := hbeforeZData hy + have hyU : y ≠ u0 := by + intro hyu + subst y + exact huOutside0 (vertexTransfer hTjQ hyData.1) + have hRhoThreeOne : MissingColors G rho3 y = + MissingColors G rho1 y := by + apply hd2Missing y + apply Finset.mem_erase.mpr + refine ⟨hyData.2, Finset.mem_erase.mpr ⟨hyU, ?_⟩⟩ + exact Finset.mem_union_left _ (Finset.mem_union_left _ hy) + exact hRhoThreeOne.trans + (hb2Missing.1 y (Finset.mem_erase.mpr ⟨hyTerminal, hyData.1⟩)) + +theorem helper_hrightOutside_3985.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : + TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (_ : V ⊕ E) (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin + ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (_ : + (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) (zPosition0 : + Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ + (↑zPosition0 : ℕ)) (hzPositionBound : (↑zPosition0 : ℕ) ≤ (ett.series.data.tree + jSlot.succ.castSucc).length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + let Z : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑zPosition0 : ℕ) hzPositionPositive hzPositionBound; + ∀ (M : TreeSequence G e0), TreeSequenceInitialSegment U M → + ∀ (n : ℕ), U.length ≤ n → + ∀ (hnM : n + (1 : ℕ) ≤ M.length), + let j : Fin M.length := (⟨n, + by omega + ⟩ : Fin M.length); + ∀ (i : Fin Z.length), M.vertex j.succ = Z.vertex i.succ → Z.vertex i.succ ∉ + TreeSequenceVertexSet U := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H a + x componentPath u exitPath zPosition u0 exitPath0 zPosition0 uPosition huPositionPositive + huPositionBound hzPositionPositive hzPositionBound U Z M hleftSegment n hnU hnM j i + hvertexMZ hmem + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hmem + obtain ⟨a, ha⟩ := hmem + have hmvertex : M.vertex + (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) = + U.vertex a := hleftSegment.2.1 a + have heq : M.vertex j.succ = M.vertex + (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) := + hvertexMZ.trans (ha.symm.trans hmvertex.symm) + have hindex := congrArg Fin.val (M.vertex_injective heq) + simp [j] at hindex + omega + +theorem helper_hvFinal_2051.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + v ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) → + q.succ.castSucc = (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ))) → + v ∈ TreeSequenceVertexSet T := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hvStage hqTreeIndex + have hvPenultimate : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨ett.rounds, by omega⟩) := by + simpa [hqTreeIndex] using hvStage + rcases ett.abovePenultimate with ⟨hlen, hvertices, hedges⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hvPenultimate ⊢ + obtain ⟨i, hi⟩ := hvPenultimate + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, ?_⟩ + exact (hvertices i).trans hi + +theorem helper_segmentTrans_2087.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B + C → TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨hab.trans hbc, ?_, ?_⟩ + · intro i + simpa using + (hvbc (Fin.castLE (Nat.succ_le_succ hab) i)).trans (hvab i) + · intro i + simpa using (hebc (Fin.castLE hab i)).trans (heab i) + +theorem helper_stepSegment_2099.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ) + := by + classical + intro V E _ _ _ G k e0 input T generating ett i hi + cases ett.series.certified i with + | initial => simp at hi + | SE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | RE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + +theorem helper_vertexTransfer_2114.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + classical + intro V E G e0 A B hAB x hx + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hx ⊢ + obtain ⟨i, rfl⟩ := hx + rcases hAB with ⟨hlen, hvertices, hedges⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, hvertices i⟩ + +theorem helper_qStageToFinal_2202.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑q : ℕ) + (1 : ℕ) = ett.rounds → q.succ.castSucc = (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + + (1 : ℕ) → (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), x ∈ TreeSequenceVertexSet + T := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hqTreeIndex hvFinal + hfirstUpper hfirstPositive vertexTransfer x hx + have hxPenultimate : x ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨ett.rounds, by omega⟩) := by + simpa [hqTreeIndex] using hx + exact vertexTransfer ett.abovePenultimate hxPenultimate + +theorem helper_hslot_2247.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ( + ∀ (t : Fin ett.rounds), ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT) → + ∀ (u : V) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (r : Fin ett.rounds), (↑r : ℕ) ≤ (↑q : ℕ) ∧ ett.series.data.kind r.succ = some + TashkinovExtensionKind.PE ∧ ett.series.data.chosenVertex r.succ = some u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = r) → + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (gammaA : Fin k) (deltaA : Fin k), ett.series.data.gamma (indices a).succ = some gammaA ∧ + ett.series.data.delta (indices a).succ = some deltaA := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q hPESlotData u p indices henumerates a + have henum := (henumerates (indices a)).2 ⟨a, rfl⟩ + obtain ⟨uA, gammaA, deltaA, huA, hgammaA, hdeltaA⟩ := + hPESlotData (indices a) henum.2.1 + have huEq : uA = u := Option.some.inj (huA.symm.trans henum.2.2) + exact ⟨gammaA, deltaA, hgammaA, hdeltaA⟩ + +theorem helper_hslotData_2282.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T), ( + ∀ (t : Fin ett.rounds), ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT) → + ∀ t ∈ ExtensionBaseRestorationIndices ett v hvFinal, + ∃ (vt : V) (gammaT : Fin k) (deltaT : Fin k), ett.series.data.chosenVertex t.succ = some vt ∧ + ett.series.data.gamma t.succ = some gammaT ∧ ett.series.data.delta t.succ = some deltaT + := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal hPESlotData t htRest + have htData := htRest + simp only [ExtensionBaseRestorationIndices, Finset.mem_sdiff] at htData + have htActiveData := htData.1 + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at htActiveData + exact hPESlotData t htActiveData.2.1 + +theorem helper_hinitialSI_2295.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (↑q : ℕ) + (1 : ℕ) = ett.rounds → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + + (1 : ℕ) → (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal → ( + ∀ (t : Fin ett.rounds) (vt : V) (gamma delta : Fin k), t ∈ ExtensionBaseActiveIndices ett v + hvFinal → (↑t : ℕ) < (↑q : ℕ) → ett.series.data.chosenVertex t.succ = some vt → + ett.series.data.gamma t.succ = some gamma → ett.series.data.delta t.succ = some delta → + ETTStrongInterchangeable ett t vt sigma gamma delta) → + ∀ (t : Fin ett.rounds) (vt : V) (gammaT deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v + hvFinal → t ≠ q → ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma + t.succ = some gammaT → ett.series.data.delta t.succ = some deltaT → + ETTStrongInterchangeable ett t vt sigma gammaT deltaT := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive hstrongInterchange t vt gammaT deltaT htActive htNe htVertex + htGamma htDelta + have htq : t.val < q.val := by + have htBound : t.val ≤ q.val := by omega + exact lt_of_le_of_ne htBound fun h => htNe (Fin.ext h) + exact hstrongInterchange t vt gammaT deltaT htActive htq htVertex + htGamma htDelta + +theorem helper_hseedTj_2451.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := + TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) + hterminalPositionPositive hterminalPositionBound; + jSlot.castSucc.succ = jSlot.succ.castSucc → + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex + refine ⟨?_, ?_, ?_⟩ + · change terminalPosition.val ≤ + (ett.series.data.tree jSlot.castSucc.succ).length + rw [hjTreeIndex] + exact hterminalPositionBound + · intro i + rfl + · intro i + rfl + +theorem helper_hseedTerminal_2462.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), + (ett.series.data.tree jSlot.succ.castSucc).vertex terminalPosition = v → + ∀ (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; seed.vertex + (Fin.last seed.length) = v := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalAt hterminalPositionPositive + hterminalPositionBound seed + have hlast : Fin.castLE (Nat.succ_le_succ hterminalPositionBound) + (Fin.last terminalPosition.val) = terminalPosition := by + apply Fin.ext + simp + simpa [seed, TreeSequencePrefix, hlast] using hterminalAt + +theorem helper_hseedVertexBefore_2479.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; seed.vertex + (Fin.last seed.length) = v → TreeSequenceInitialSegment seed T → + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot vertexTransfer terminalPosition hterminalPositionPositive + hterminalPositionBound seed hseedTerminal hseedFinal i hi + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + constructor + · exact vertexTransfer hseedFinal (by simp [TreeSequenceVertexSet]) + · let p : Fin (T.length + 1) := + Fin.castLE (Nat.succ_le_succ hseedFinal.1) i + let z : Fin (T.length + 1) := + Fin.castLE (Nat.succ_le_succ hseedFinal.1) (Fin.last seed.length) + refine ⟨p, z, hseedFinal.2.1 i, + (hseedFinal.2.1 (Fin.last seed.length)).trans hseedTerminal, ?_⟩ + simpa [p, z] using hi + +theorem helper_segmentVertexBefore_2493.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore T v hvFinal) → + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore T v hvFinal := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hseedVertexBefore A hAseed hAlen x hxA + obtain ⟨hAseedLen, hAseedVertices, -⟩ := hAseed + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hxA + obtain ⟨i, rfl⟩ := hxA + have hi : (Fin.castLE (Nat.succ_le_succ hAseedLen) i).val < + seed.length := by + change i.val < seed.length + omega + rw [← hAseedVertices i] + exact hseedVertexBefore _ hi + +theorem helper_transportSeedRoute_2514.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation (ett.series.data.coloring jSlot.castSucc) A + B → TreeSequenceInitialSegment B seed → TashkinovAugmentation rho1 A B) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho1 S seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 terminalPosition hterminalPositionPositive + hterminalPositionBound seed transportStep S hroute + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBseed ih => + have hBsegment : TreeSequenceInitialSegment B seed := + TashkinovAugmentationSequenceInitialSegment + (ett.series.data.coloring jSlot.castSucc) B seed hBseed + exact Relation.ReflTransGen.head (transportStep hAB hBsegment) ih + +theorem helper_hqLast_2554.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); q ∈ ExtensionBaseSupportClass ett v hvFinal v → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (a b : Fin (p0 + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices0 a) : ℕ) < (↑(indices0 b) : ℕ)) + → ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → + ∀ (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), indices0 (Fin.last + p0) = q := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hqClass p0 indices0 hincreasing0 hclass0 terminalPosition + obtain ⟨a, ha⟩ := (hclass0 q).1 hqClass + have haLast : a = Fin.last p0 := by + by_contra hne + have halt : a < Fin.last p0 := Fin.lt_last_iff_ne_last.mpr hne + have hindexLt := hincreasing0 a (Fin.last p0) halt + rw [ha] at hindexLt + have hqMax : ∀ r : Fin ett.rounds, r.val ≤ q.val := by + intro r + omega + exact (Nat.not_lt_of_ge (hqMax (indices0 (Fin.last p0)))) hindexLt + rw [← haLast, ha] + +theorem helper_hkind0_2572.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (p0 : ℕ) (indices0 + : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.kind (indices0 a).succ = some + TashkinovExtensionKind.PE := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal p0 indices0 hclass0 a + have ha := (hclass0 (indices0 a)).2 ⟨a, rfl⟩ + have haData := ha + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at haData + have hactive := haData.1 + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] at hactive + exact hactive.2.1 + +theorem helper_hdeltaAvoidsTj_2598.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); (( + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → + ∀ (deltaT gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett v hvFinal → t ∈ + ExtensionBaseActiveIndices ett v hvFinal → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) ∧ + ∀ (t : Fin ett.rounds), + ∀ vt ∈ TreeSequenceVertexSet T, + ∀ (deltaT : Fin k), t ∈ ExtensionBaseActiveIndices ett v hvFinal → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.delta t.succ = some deltaT + → deltaT ∉ TreeMissingColors (ett.series.data.coloring jSlot.castSucc) + (ett.series.data.tree jSlot.succ.castSucc)) → + ∀ (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (delta0 : Fin (p0 + (1 : ℕ)) → Fin + k), ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.delta (indices0 a).succ = some (delta0 a)) → ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.chosenVertex (indices0 a).succ = some v) → + ∀ (a : Fin (p0 + (1 : ℕ))), delta0 a ∉ TreeMissingColors (ett.series.data.coloring + jSlot.castSucc) (ett.series.data.tree jSlot.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hdeltaExclusion p0 indices0 delta0 hclass0 hdelta0 hsupport0 a + have haClass := (hclass0 (indices0 a)).2 ⟨a, rfl⟩ + have haData := haClass + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at haData + exact hdeltaExclusion.2 (indices0 a) v hvFinal (delta0 a) + haData.1 (hsupport0 a) (hdelta0 a) + +theorem helper_hbeforeTjFinal_2616.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ( + ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B) → + ∀ (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)), + TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) T → + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ ⊆ + TreeVerticesBefore T v hvFinal := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot vertexTransfer hterminalJ hTjFinal x hx + unfold TreeVerticesBefore at hx ⊢ + simp only [Finset.mem_filter] at hx ⊢ + refine ⟨vertexTransfer hTjFinal hx.1, ?_⟩ + rcases hx.2 with ⟨ix, iv, hix, hiv, hlt⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hTjFinal.1) ix, + Fin.castLE (Nat.succ_le_succ hTjFinal.1) iv, + (hTjFinal.2.1 ix).trans hix, + (hTjFinal.2.1 iv).trans hiv, ?_⟩ + simpa using hlt + +theorem helper_hprefixSubset_2691.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; + ∀ (b : Fin (p0 + (1 : ℕ))), ((ExtensionBaseCaseOneIndices ett p0 indices0 b).biUnion fun (t : + Fin ett.rounds) ↦ ett.series.data.stored t.succ) ⊆ supportColors := by + classical + intro V E _ _ _ G k e0 input T generating ett p0 indices0 supportColors b c hc + obtain ⟨t, ht, hct⟩ := Finset.mem_biUnion.mp hc + unfold ExtensionBaseCaseOneIndices at ht + obtain ⟨a, ha, rfl⟩ := Finset.mem_image.mp ht + exact Finset.mem_biUnion.mpr ⟨a, Finset.mem_univ _, hct⟩ + +theorem helper_hUPrime_2738.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (TjPrime : TreeSequence + G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ + (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; TreeSequenceInitialSegment U TjPrime := by + classical + intro V E G e0 TjPrime uPosition huPositionPositive huPositionBound U + refine ⟨huPositionBound, ?_, ?_⟩ + · intro i + simp [U, TreeSequencePrefix] + · intro i + simp [U, TreeSequencePrefix] + +theorem helper_hprimeVertexBefore_2750.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] (G : LooplessMultigraph V E) (e0 : E) (TjPrime : + TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (uPosition : Fin + (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u → + ∀ (i : Fin (TjPrime.length + (1 : ℕ))), (↑i : ℕ) < (↑uPosition : ℕ) → TjPrime.vertex i ∈ + TreeVerticesBefore TjPrime u huPrime := by + classical + intro V E _ G e0 TjPrime u huPrime uPosition huPosition i hi + let _ := Fintype.ofFinite V + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + constructor + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨i, rfl⟩ + · exact ⟨i, uPosition, rfl, huPosition, hi⟩ + +theorem helper_transportURoute_2771.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (sigma : PartialEdgeColoring E k) (hvFinal : v ∈ + TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : + ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : + ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : + ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation rho1 A B → TreeSequenceInitialSegment B U → + TashkinovAugmentation rho2 A B) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence rho1 S U → + TashkinovAugmentationSequence rho2 S U := by + classical + intro V E _ _ _ G k e0 input T generating ett v sigma hvFinal trace p0 indices0 rho1 TjPrime u + b traceB rho2 uPosition huPositionPositive huPositionBound U transportUStep S hroute + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBU ih => + have hBsegment : TreeSequenceInitialSegment B U := + TashkinovAugmentationSequenceInitialSegment rho1 B U hBU + exact Relation.ReflTransGen.head + (transportUStep hAB hBsegment) ih + +theorem helper_hterminalInclusion_2787.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), ( + let storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; (MissingColors G sigma v ∩ storedPairs : Finset + (Fin k)) = ({delta0 (Fin.last p0)} : Finset (Fin k)) ∧ MissingColors G + (ett.series.data.coloring jSlot.castSucc) v = MissingColors G sigma v \ + ({delta0 (Fin.last p0)} : Finset (Fin k)) ∪ ({gamma0 (0 : Fin (p0 + (1 : ℕ)))} : Finset + (Fin k))) → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 + indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); gamma0 (0 : Fin + (p0 + (1 : ℕ))) ∈ MissingColors G (traceB.coloring (Fin.last traceB.steps)) u → + MissingColors G rho2 v = MissingColors G rho1 v → MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho2 v ∪ MissingColors G + rho2 u := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 hmissing0 rho1 hb2Missing + u b traceB rho2 c3 hterminalMissingEq c hc + rw [hmissing0.2] at hc + rcases Finset.mem_union.mp hc with hcSigma | hcGamma + · apply Finset.mem_union_left + rw [hterminalMissingEq, hb2Missing.2] + exact (Finset.mem_sdiff.mp hcSigma).1 + · apply Finset.mem_union_right + have hcgamma : c = gamma0 0 := Finset.mem_singleton.mp hcGamma + simpa [hcgamma] using c3 + +theorem helper_huU_2850.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (TjPrime : TreeSequence + G e0) (u : V) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u → + ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ + TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; u ∈ TreeSequenceVertexSet U := by + classical + intro V E G e0 TjPrime u uPosition huPosition huPositionPositive huPositionBound U + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨Fin.last U.length, ?_⟩ + change TjPrime.vertex (Fin.castLE (Nat.succ_le_succ huPositionBound) + (Fin.last uPosition.val)) = u + have hindex : Fin.castLE (Nat.succ_le_succ huPositionBound) + (Fin.last uPosition.val) = uPosition := by + apply Fin.ext + rfl + rw [hindex] + exact huPosition + +theorem helper_prefixSegment_2868.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (A : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hrA : r ≤ A.length), + TreeSequenceInitialSegment (TreeSequencePrefix A r hr hrA) A := by + classical + intro V E G e0 A r hr hrA + refine ⟨hrA, ?_, ?_⟩ + · intro i + simp [TreeSequencePrefix] + · intro i + simp [TreeSequencePrefix] + +theorem helper_prefixPrefix_2877.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) + (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := + (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (p0 : ℕ) (_ : + Fin (p0 + (1 : ℕ)) → + Fin ett.rounds) + (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) + (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length) + (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : ℕ))) + (A : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hrA : r + (1 : ℕ) ≤ A.length), + TreeSequenceInitialSegment + (TreeSequencePrefix A r hr (Nat.le_trans (Nat.le_succ r) hrA)) + (TreeSequencePrefix A (r + (1 : ℕ)) (by omega) hrA) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound TjPrime uPosition A r hr hrA + refine ⟨Nat.le_succ r, ?_, ?_⟩ + · intro i + change A.vertex _ = A.vertex _ + congr 1 + · intro i + change A.edge _ = A.edge _ + congr 1 + +theorem helper_prefixSelf_2890.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (A : TreeSequence G e0), + TreeSequencePrefix A A.length A.positive le_rfl = A := by + classical + intro V E G e0 A + cases A with + | mk len pos vertex edge vinj einj first attach => + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + rfl + · apply heq_of_eq + funext i + rfl + +theorem helper_hleftX_3005.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (TjPrime : TreeSequence + G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ + (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (M : TreeSequence G e0), TreeSequenceInitialSegment U M → + ∀ (n : ℕ) (hnU : U.length ≤ n) (hnM' : n ≤ M.length), + let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; + ∀ {x : V}, x ∈ TreeSequenceVertexSet U → x ∈ TreeSequenceVertexSet X := by + classical + intro V E G e0 TjPrime uPosition huPositionPositive huPositionBound U M hleftSegment n hnU hnM' + X x hxU + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hxU ⊢ + obtain ⟨a, ha⟩ := hxU + refine ⟨Fin.castLE (Nat.succ_le_succ hnU) a, ?_⟩ + change M.vertex _ = x + calc + M.vertex _ = M.vertex + (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) := by + congr 1 + _ = U.vertex a := hleftSegment.2.1 a + _ = x := ha + +theorem helper_segmentVertexBeforeJ_3151.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hterminalJ : v ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) + (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ + (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ + (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (TjPrime : TreeSequence G e0) (_ : Fin (TjPrime.length + (1 : ℕ))), ( + ∀ (i : Fin (seed.length + (1 : ℕ))), (↑i : ℕ) < seed.length → seed.vertex i ∈ + TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ) → + ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A seed → A.length < seed.length → + ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot hterminalJ p0 indices0 terminalPosition hterminalPositionPositive + hterminalPositionBound seed TjPrime uPosition hseedVertexBeforeJ A hAseed hAlen x hxA + obtain ⟨hAseedLen, hAseedVertices, -⟩ := hAseed + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hxA + obtain ⟨i, rfl⟩ := hxA + have hi : (Fin.castLE (Nat.succ_le_succ hAseedLen) i).val < + seed.length := by + change i.val < seed.length + omega + rw [← hAseedVertices i] + exact hseedVertexBeforeJ _ hi + +theorem helper_transportSeedRoute2_3173.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 + indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation (ett.series.data.coloring jSlot.castSucc) A + B → TreeSequenceInitialSegment B seed → TashkinovAugmentation rho2 A B) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring + jSlot.castSucc) S seed → TashkinovAugmentationSequence rho2 S seed := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed u b traceB rho2 transportSeedStep2 S + hroute + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBseed ih => + have hBsegment : TreeSequenceInitialSegment B seed := + TashkinovAugmentationSequenceInitialSegment _ B seed hBseed + exact Relation.ReflTransGen.head + (transportSeedStep2 hAB hBsegment) ih + +theorem helper_hsupportSet_3222.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (p0 : ℕ) (indices0 + : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), ( + ∀ (r : Fin ett.rounds), r ∈ ExtensionBaseSupportClass ett v hvFinal v ↔ + ∃ (a : Fin (p0 + (1 : ℕ))), indices0 a = r) → + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; supportColors = (ExtensionBaseSupportClass ett v + hvFinal v).biUnion fun (s : Fin ett.rounds) ↦ ett.series.data.stored s.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal p0 indices0 hclass0 supportColors + ext c + simp only [supportColors, Finset.mem_biUnion, Finset.mem_univ, + true_and] + constructor + · rintro ⟨a, hc⟩ + exact ⟨indices0 a, (hclass0 (indices0 a)).2 ⟨a, rfl⟩, hc⟩ + · rintro ⟨s, hs, hc⟩ + obtain ⟨a, rfl⟩ := (hclass0 s).1 hs + exact ⟨a, hc⟩ + +theorem helper_hgammaSupport_3247.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (gamma : Fin k) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin + ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) → gamma0 (Fin.last p0) = gamma → gamma ∈ + supportColors := by + classical + intro V E _ _ _ G k e0 input T generating ett gamma p0 indices0 gamma0 delta0 supportColors + hstored0 hgammaLast + simp only [supportColors, Finset.mem_biUnion, Finset.mem_univ, + true_and] + refine ⟨Fin.last p0, ?_⟩ + rw [hstored0, hgammaLast] + simp + +theorem helper_hdeltaSupport_3253.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (delta : Fin k) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin + ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) → delta0 (Fin.last p0) = delta → delta ∈ + supportColors := by + classical + intro V E _ _ _ G k e0 input T generating ett delta p0 indices0 gamma0 delta0 supportColors + hstored0 hdeltaLast + simp only [supportColors, Finset.mem_biUnion, Finset.mem_univ, + true_and] + refine ⟨Fin.last p0, ?_⟩ + rw [hstored0, hdeltaLast] + simp + +theorem helper_hgammaFirstSupport_3259.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (gamma0 + delta0 : Fin (p0 + (1 : ℕ)) → Fin k), + let supportColors : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; ( + ∀ (a : Fin (p0 + (1 : ℕ))), ett.series.data.stored (indices0 a).succ = (insert (gamma0 a) + ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); gammaFirst ∈ supportColors := by + classical + intro V E _ _ _ G k e0 input T generating ett p0 indices0 gamma0 delta0 supportColors hstored0 + gammaFirst + simp only [supportColors, Finset.mem_biUnion, Finset.mem_univ, + true_and] + refine ⟨0, ?_⟩ + rw [hstored0] + simp [gammaFirst] + +theorem helper_hb4Earlier_3295.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal + sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ ExtensionBaseSupportClass ett v hvFinal v + → s ≠ q → ett.series.data.chosenVertex s.succ = some v → ett.series.data.gamma s.succ = + some gammaS → ett.series.data.delta s.succ = some deltaS → ETTStrongInterchangeable ett s + v rho1 gammaS deltaS) → + ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett v hvFinal + v).erase q → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = + some deltaS → ETTStrongInterchangeable ett s v rho1 gammaS deltaS := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hvFinal trace rho1 + hb4Interchange s gammaS deltaS hs hsGamma hsDelta + have hsNe := (Finset.mem_erase.mp hs).1 + have hsClass := (Finset.mem_erase.mp hs).2 + have hsClassData := hsClass + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at hsClassData + exact hb4Interchange s gammaS deltaS hsClass hsNe hsClassData.2 + hsGamma hsDelta + +theorem helper_hterminalInclusion_3322.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds) (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k), ( + let storedPairs : Finset (Fin k) := Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ + ett.series.data.stored (indices0 a).succ; (MissingColors G sigma v ∩ storedPairs : Finset + (Fin k)) = ({delta0 (Fin.last p0)} : Finset (Fin k)) ∧ MissingColors G + (ett.series.data.coloring jSlot.castSucc) v = MissingColors G sigma v \ + ({delta0 (Fin.last p0)} : Finset (Fin k)) ∪ ({gamma0 (0 : Fin (p0 + (1 : ℕ)))} : Finset + (Fin k))) → + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ( + ∀ x ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)).erase v, + MissingColors G rho1 x = MissingColors G (ett.series.data.coloring jSlot.castSucc) x) ∧ + MissingColors G rho1 v = MissingColors G sigma v → + let gammaFirst : Fin k := gamma0 (0 : Fin (p0 + (1 : ℕ))); MissingColors G + (ett.series.data.coloring jSlot.castSucc) v ⊆ MissingColors G rho1 v ∪ ({ gammaFirst } : + Finset (Fin k)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 hmissing0 rho1 hb2Missing + gammaFirst c hc + rw [hmissing0.2] at hc + rcases Finset.mem_union.mp hc with hcSigma | hcFirst + · apply Finset.mem_union_left + rw [hb2Missing.2] + exact (Finset.mem_sdiff.mp hcSigma).1 + · apply Finset.mem_union_right + simpa [gammaFirst] using hcFirst + +theorem helper_branch_3361.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∀ (i : Fin ett.rounds), ett.series.data.kind i.succ = some TashkinovExtensionKind.SE → q.succ + = i.succ → + ∃ (fN : E), ett.series.data.connectingEdges i.succ = ({ fN } : Finset E) ∧ Incident G v fN ∧ + IsProperEdgeColoring G (ett.series.data.coloring i.succ) ∧ IsOneEdgeUncolored + (ett.series.data.coloring i.succ) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqKind i currentKind htarget + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hqKind) + cases hbad + +theorem helper_branch_3370.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∀ (i : Fin ett.rounds), ett.series.data.kind i.succ = some TashkinovExtensionKind.RE → q.succ + = i.succ → + ∃ (fN : E), ett.series.data.connectingEdges i.succ = ({ fN } : Finset E) ∧ Incident G v fN ∧ + IsProperEdgeColoring G (ett.series.data.coloring i.succ) ∧ IsOneEdgeUncolored + (ett.series.data.coloring i.succ) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqKind i currentKind htarget + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hqKind) + cases hbad + +theorem helper_hvDegree_3468.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k) + (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v + hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + IsProperEdgeColoring G rho1 → gamma ≠ delta → delta ∈ MissingColors G rho1 v → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; @SimpleGraph.degree + (Sum V E) H (@Sum.inl V E v) (@Fintype.ofFinite (@Set.Elem (Sum V E) + (@SimpleGraph.neighborSet (Sum V E) H (@Sum.inl V E v))) (@Subtype.finite (Sum V E) + (@Finite.instSum V E (@Finite.of_fintype V inst) (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) H (@Sum.inl V E v))))) ≤ (1 : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett v gamma delta sigma hvFinal trace rho1 + hrho1Proper hgammaDelta hdeltaMissing H + have hdegree := MissingColorIncidenceEndpoint G rho1 delta gamma + hgammaDelta.symm hrho1Proper v hdeltaMissing + have hcolorOrder : + TwoColorIncidenceGraph G rho1 delta gamma = H := by + apply SimpleGraph.ext + funext a b + cases a <;> cases b <;> + simp [H, TwoColorIncidenceGraph, or_comm] + rw [hcolorOrder] at hdegree + exact hdegree + +theorem helper_hvSub_3480.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k) + (hvFinal : v ∈ TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v + hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; @SimpleGraph.degree + (Sum V E) H (@Sum.inl V E v) (@Fintype.ofFinite (@Set.Elem (Sum V E) + (@SimpleGraph.neighborSet (Sum V E) H (@Sum.inl V E v))) (@Subtype.finite (Sum V E) + (@Finite.instSum V E (@Finite.of_fintype V inst) (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) H (@Sum.inl V E v))))) ≤ (1 : ℕ) → (H.neighborSet + (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ _ G k e0 input T generating ett v gamma delta sigma hvFinal trace rho1 H hvDegree + let : Fintype (H.neighborSet (Sum.inl v)) := Fintype.ofFinite _ + have hcard : (H.neighborFinset (Sum.inl v)).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hvDegree + intro a ha b hb + exact (Finset.card_le_one.mp hcard) a + (by simpa [SimpleGraph.mem_neighborFinset] using ha) b + (by simpa [SimpleGraph.mem_neighborFinset] using hb) + +end GoldbergSeymour.ExtensionBaseProof + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseStoredPairOverlap.lean b/LeanPool/GoldbergSeymour/ExtensionBaseStoredPairOverlap.lean new file mode 100644 index 0000000000..39f318dc6a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseStoredPairOverlap.lean @@ -0,0 +1,299 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtensionBaseActiveIndices +public import LeanPool.GoldbergSeymour.ExtensionBaseDeltaExclusion +public import LeanPool.GoldbergSeymour.ExtensionBaseSameSupportStoredPairOverlap +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassEnumeration +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportOrder +public import LeanPool.GoldbergSeymour.ExtensionRules +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +public import LeanPool.GoldbergSeymour.LowerRoundProperties + +/-! +# Extension Base Stored Pair Overlap + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ExtensionBaseStoredPairOverlap_sameSupport_239.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (terminalSupport : V) (hterminalSupport : terminalSupport ∈ + TreeSequenceVertexSet T) (q : Fin ett.rounds), (↑q : ℕ) + 1 = ett.rounds → ((∀ (s t : Fin + ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ TreeSequenceVertexSet T → s ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → t ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → (↑s : ℕ) < (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → vt = vs ∨ TreeVertexOrder T vt vs) ∧ (∀ (s : Fin ett.rounds) (vs : V) (hvsFinal : vs + ∈ TreeSequenceVertexSet T), s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → ett.series.data.chosenVertex s.succ = some vs → ETTFirstAppearanceIndex + ett vs hvsFinal = ETTFirstAppearanceIndex ett terminalSupport hterminalSupport ∧ + (terminalSupport = vs ∨ TreeVertexOrder T terminalSupport vs)) ∧ ∀ (s t : Fin ett.rounds) + (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ TreeSequenceVertexSet T → s ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → t ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → vs ≠ vt → TreeVertexOrder T vs vt → (↑t : ℕ) < (↑s : ℕ)) → (∀ (s t : Fin ett.rounds) + (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ TreeSequenceVertexSet T → ∀ (deltaT + gammaS : Fin k), s ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → t ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → (↑s : ℕ) ≤ (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → ett.series.data.gamma s.succ = some + gammaS → deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) ∧ deltaT ≠ gammaS) → ∀ (s t : Fin ett.rounds) (vs + vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ TreeSequenceVertexSet T → ∀ (gammaS deltaS + gammaT deltaT : Fin k), s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + (↑s : ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → ett.series.data.gamma s.succ = some gammaS + → ett.series.data.delta s.succ = some deltaS → ett.series.data.gamma t.succ = some gammaT + → ett.series.data.delta t.succ = some deltaT → vs = vt → ((ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ).Nonempty ↔ ¬∃ r ∈ ExtensionBaseActiveIndices ett + terminalSupport hterminalSupport, (↑s : ℕ) < (↑r : ℕ) ∧ (↑r : ℕ) < (↑t : ℕ) ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ ((ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ).Nonempty → ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ = {gammaT} ∧ ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ = {deltaS}) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q hqTerminal + supportOrder deltaExclusion s t vs vt hvsFinal hvtFinal gammaS deltaS gammaT deltaT + hsActive htActive hst hsVertex htVertex hsGamma hsDelta htGamma htDelta hvst + subst vt + have hsClass : s ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport vs := by + simp [ExtensionBaseSupportClass, hsActive, hsVertex] + have htClass : t ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport vs := by + simp [ExtensionBaseSupportClass, htActive, htVertex] + have hclassNonempty : + (ExtensionBaseSupportClass ett terminalSupport + hterminalSupport vs).Nonempty := ⟨s, hsClass⟩ + have hcommon : + ∀ (r : Fin ett.rounds) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T), r ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex r.succ = some v → ETTFirstAppearanceIndex ett v hvFinal = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport := by + intro r v hvFinal hrActive hrVertex + exact (supportOrder.2.1 r v hvFinal hrActive hrVertex).1 + obtain ⟨p, indices, hwCurrent, hincreasing, hclass, henumerates⟩ := + ExtensionBaseSupportClassEnumeration ett terminalSupport + hterminalSupport q hqTerminal vs hcommon hclassNonempty + have hdeltaIndexed : + ∀ (a b : Fin (p + 1)) (gammaA deltaB : Fin k), a.val ≤ b.val → ett.series.data.gamma (indices + a).succ = some gammaA → ett.series.data.delta (indices b).succ = some deltaB → deltaB ≠ + gammaA := by + intro a b gammaA deltaB hab haGamma hbDelta + have haClass := (hclass (indices a)).2 ⟨a, rfl⟩ + have hbClass := (hclass (indices b)).2 ⟨b, rfl⟩ + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at haClass hbClass + have habIndices : (indices a).val ≤ (indices b).val := by + rcases lt_or_eq_of_le hab with hablt | habeq + · exact (hincreasing a b hablt).le + · have habFin : a = b := Fin.ext habeq + subst b + exact le_rfl + exact (deltaExclusion (indices a) (indices b) vs vs hvsFinal + hvsFinal deltaB gammaA haClass.1 hbClass.1 habIndices + haClass.2 hbClass.2 hbDelta haGamma).2 + have hsame := ExtensionBaseSameSupportStoredPairOverlap ett + terminalSupport hterminalSupport q hqTerminal vs hwCurrent p indices + hincreasing hclass henumerates hdeltaIndexed s t hsClass htClass hst + gammaS deltaS gammaT deltaT hsGamma hsDelta htGamma htDelta + have hbetween : + (∃ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport vs ∧ + s.val < r.val ∧ r.val < t.val) ↔ + ∃ r : Fin ett.rounds, + r ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport ∧ + s.val < r.val ∧ r.val < t.val ∧ + ett.series.data.chosenVertex r.succ = some vs := by + constructor + · rintro ⟨r, hrClass, hsr, hrt⟩ + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at hrClass + exact ⟨r, hrClass.1, hsr, hrt, hrClass.2⟩ + · rintro ⟨r, hrActive, hsr, hrt, hrVertex⟩ + refine ⟨r, ?_, hsr, hrt⟩ + simp [ExtensionBaseSupportClass, hrActive, hrVertex] + constructor + · constructor + · intro hoverlap hbetweenActive + exact (hsame.1.mp hoverlap) (hbetween.mpr hbetweenActive) + · intro hnoClass + apply hsame.1.mpr + intro hbetweenClass + exact hnoClass (hbetween.mp hbetweenClass) + · exact hsame.2 + +theorem ExtensionBaseStoredPairOverlap {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (hqTerminal : q.val + 1 = ett.rounds) + (hqKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE) + (hqVertex : ett.series.data.chosenVertex q.succ = some terminalSupport) + (jSlot : Fin ett.rounds) + (hjSlot : jSlot.val + 1 = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) + (hMP : MaximumProperty ett) + (hpositive : 0 < ett.rounds) + (hLowerElementary : ∀ r : Fin ett.rounds, r.val < q.val → + ColoredVertexSetElementary G (ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc))) + (hLowerPartV : ∀ (r a : Fin ett.rounds), a.val < r.val → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc) sigma → + ∀ delta : Fin k, + DefectiveColor G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta → + ∀ v : V, + BoundaryColorVertex G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta v → + (∃ w : V, BoundaryColorVertex G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta w ∧ + TreeVertexOrder (ett.series.data.tree r.succ.castSucc) w v) → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T, + ETTFirstAppearanceIndex ett v hvFinal ≤ a.val + 1 → + ∀ va : V, + (ett.series.data.kind a.succ = + some TashkinovExtensionKind.PE ∨ + ett.series.data.kind a.succ = + some TashkinovExtensionKind.SE) → + ett.series.data.chosenVertex a.succ = some va → + v = va ∨ + TreeVertexOrder + (ett.series.data.tree r.succ.castSucc) v va) + (hlower : ∀ {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input T' generating'), + 0 < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (open scoped Classical in LowerRoundProperties lower)) : + ∀ (s t : Fin ett.rounds) (vs vt : V) (_ : vs ∈ TreeSequenceVertexSet T) (_ : vt ∈ + TreeSequenceVertexSet T) (gammaS deltaS gammaT deltaT : Fin k), s ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → t ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → s.val < t.val → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.gamma s.succ = some gammaS → ett.series.data.delta s.succ = some + deltaS → ett.series.data.gamma t.succ = some gammaT → ett.series.data.delta t.succ = some + deltaT → ((ett.series.data.stored s.succ ∩ ett.series.data.stored t.succ).Nonempty ↔ vs = + vt ∧ ¬ + ∃ r : Fin ett.rounds, r ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport ∧ + s.val < r.val ∧ r.val < t.val ∧ ett.series.data.chosenVertex r.succ = some vs) ∧ + ((ett.series.data.stored s.succ ∩ ett.series.data.stored t.succ).Nonempty → + ett.series.data.stored s.succ ∩ ett.series.data.stored t.succ = {gammaT} ∧ + ett.series.data.stored s.succ ∩ ett.series.data.stored t.succ = {deltaS}) := by + classical + have supportOrder := ExtensionBaseSupportOrder ett terminalSupport + hterminalSupport q hqTerminal hqKind hqVertex hLowerPartV + have deltaExclusion := (ExtensionBaseDeltaExclusion ett terminalSupport + hterminalSupport q hqTerminal hqKind hqVertex jSlot hjSlot + hLowerElementary hLowerPartV).1 + have differentSupport := (ExtensionRules G k e0 input T generating ett + hMP hpositive hlower).2 + intro s t vs vt hvsFinal hvtFinal gammaS deltaS gammaT deltaT + hsActive htActive hst hsVertex htVertex hsGamma hsDelta htGamma htDelta + have hsKind : ett.series.data.kind s.succ = + some TashkinovExtensionKind.PE := by + have hsData := hsActive + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] at hsData + exact hsData.2.1 + have htKind : ett.series.data.kind t.succ = + some TashkinovExtensionKind.PE := by + have htData := htActive + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] at htData + exact htData.2.1 + have sameSupport : vs = vt → + (((ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ).Nonempty ↔ + ¬ ∃ r : Fin ett.rounds, + r ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport ∧ + s.val < r.val ∧ r.val < t.val ∧ + ett.series.data.chosenVertex r.succ = some vs) ∧ + ((ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ).Nonempty → + ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ = {gammaT} ∧ + ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ = {deltaS})) := by + exact @ExtensionBaseStoredPairOverlap_sameSupport_239 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport + hterminalSupport q hqTerminal supportOrder deltaExclusion s t vs vt hvsFinal hvtFinal + gammaS deltaS gammaT deltaT hsActive htActive hst hsVertex htVertex hsGamma hsDelta + htGamma htDelta + have hoverlapIff : + ((ett.series.data.stored s.succ ∩ + ett.series.data.stored t.succ).Nonempty ↔ + vs = vt ∧ + ¬ ∃ r : Fin ett.rounds, + r ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport ∧ + s.val < r.val ∧ r.val < t.val ∧ + ett.series.data.chosenVertex r.succ = some vs) := by + constructor + · intro hoverlap + by_cases hvst : vs = vt + · exact ⟨hvst, (sameSupport hvst).1.mp hoverlap⟩ + · have hstNe : s ≠ t := by + intro heq + subst t + omega + have hsFirst := + (supportOrder.2.1 s vs hvsFinal hsActive hsVertex).1 + have htFirst := + (supportOrder.2.1 t vt hvtFinal htActive htVertex).1 + have hdisjoint := differentSupport s t vs vt hstNe hvst hsKind + htKind hsVertex htVertex hvsFinal hvtFinal + (hsFirst.trans htFirst.symm) + obtain ⟨c, hc⟩ := hoverlap + have hcPairs := Finset.mem_inter.mp hc + exact (Finset.disjoint_left.mp hdisjoint hcPairs.1 hcPairs.2).elim + · rintro ⟨hvst, hnoBetween⟩ + exact (sameSupport hvst).1.mpr hnoBetween + refine ⟨hoverlapIff, ?_⟩ + intro hoverlap + have hvst := (hoverlapIff.mp hoverlap).1 + exact (sameSupport hvst).2 hoverlap + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseStrictDeltaExclusion.lean b/LeanPool/GoldbergSeymour/ExtensionBaseStrictDeltaExclusion.lean new file mode 100644 index 0000000000..43e188fe84 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseStrictDeltaExclusion.lean @@ -0,0 +1,1254 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportOrder + +public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Extension Base Strict Delta Exclusion + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_nextSegment_124.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ _ _ : Fin ett.rounds), ∀ (i : Fin + ett.rounds), TreeSequenceInitialSegment ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree i.succ.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree i.succ.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett q s t + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro i + have step := series.certified i.succ + generalize hz : i.succ = z at step + cases step with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val hz + simp at hv + | SE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hri : r = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + exact orderedExtension + | PE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hri : r = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + exact orderedExtension + | RE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hri : r = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + exact orderedExtension + +private theorem helper_hsClosed_282.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ s _ : Fin ett.rounds), (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.kind s.succ = some TashkinovExtensionKind.PE + → ColoredVertexSetClosed G ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring s.castSucc) (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree s.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett q s t + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro hsKind + have step := series.certified s.succ + generalize hz : s.succ = z at step + cases step with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val hz + simp at hv + | SE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hrs : r = s := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + rw [currentKind] at hsKind + simp at hsKind + | RE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hrs : r = s := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + rw [currentKind] at hsKind + simp at hsKind + | PE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hrs : r = s := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + unfold ColoredVertexSetClosed + intro f c v hf hv hfc hcm + exact previousClosed hf hv hfc hcm + +private theorem helper_colorCarry_371.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ s t : Fin ett.rounds) (deltaT : Fin + k), (↑s : ℕ) < (↑t : ℕ) → ∀ u ∈ TreeSequenceVertexSet (ett.series.data.tree + s.succ.castSucc), deltaT ∈ MissingColors G (ett.series.data.coloring s.castSucc) u → + deltaT ∈ TreeMissingColors ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring t.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc) ∪ TashkinovStoredColors (ett.series : TashkinovSeries G + k ett.rounds e0 input).data t.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett q s t deltaT hst + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro u huS huMissing + have start : deltaT ∈ + TreeMissingColors (series.data.coloring s.castSucc) + (series.data.tree s.succ.castSucc) ∪ + TashkinovStoredColors series.data s.castSucc := + Finset.mem_union_left _ (by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨u, huS, huMissing⟩) + have claim : + ∀ (n : ℕ), s.val ≤ n → n < ett.rounds → + ∀ r : Fin ett.rounds, r.val = n → deltaT ∈ TreeMissingColors (series.data.coloring r.castSucc) + (series.data.tree r.succ.castSucc) ∪ TashkinovStoredColors series.data r.castSucc := by + intro n hsn + induction n, hsn using Nat.le_induction with + | base => + intro hn r hr + have hrs : r = s := by apply Fin.ext; omega + simpa [hrs] using start + | succ n hn ih => + intro hrounds r hr + let p : Fin ett.rounds := ⟨n, by omega⟩ + have hold := ih (by omega) p rfl + have hfirst := (HkuMissingStoredMonotone G k ett.rounds e0 input + series p).1 hold + have hsecond := (HkuMissingStoredMonotone G k ett.rounds e0 input + series p).2 hfirst + have hcolor : p.succ = r.castSucc := by + apply Fin.ext + simp [p, hr] + have htree : p.succ.succ = r.succ.castSucc := by + apply Fin.ext + simp [p, hr] + simpa [hcolor, htree] using hsecond + exact claim t.val (Nat.le_of_lt hst) t.isLt t rfl + +private theorem helper_edgeAtRho_418.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : + PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (_ s t : Fin ett.rounds) (hst : + (↑s : ℕ) < (↑t : ℕ)), ∀ u ∈ TreeSequenceVertexSet (ett.series.data.tree s.succ.castSucc), + TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + s.succ.castSucc) ⊆ TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc) → ∀ (rho : PartialEdgeColoring E k) (choice : + MaximumDefectiveChoice G e0 ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc) (TashkinovStoredColors (ett.series : TashkinovSeries G k + ett.rounds e0 input).data t.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring t.castSucc)), StableColoring ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree t.succ.castSucc) (insert choice.color + (TashkinovStoredColors (ett.series : TashkinovSeries G k ett.rounds e0 input).data + t.castSucc)) choice.selected rho → choice.color ∈ MissingColors G + (ett.series.data.coloring s.castSucc) u → (∀ x ∈ TreeSequenceVertexSet ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree s.succ.castSucc), x ≠ u → ∃ (f : E), + Incident G x f ∧ (ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring + s.castSucc f = some choice.color ∧ f ∈ InternalEdges G (TreeSequenceVertexSet ((ett.series + : TashkinovSeries G k ett.rounds e0 input).data.tree s.succ.castSucc))) → choice.color ∈ + TreeMissingColors ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring + t.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + t.succ.castSucc) ∪ TashkinovStoredColors (ett.series : TashkinovSeries G k ett.rounds e0 + input).data t.castSucc → let beforeT : Fin ett.rounds := (⟨(↑t : ℕ) - (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑t : ℕ) - (1 : ℕ) < ett.rounds) => by omega⟩ : Fin + ett.rounds); beforeT.succ = t.castSucc → (↑s : ℕ) ≤ (↑beforeT : ℕ) → ∀ x ∈ + TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + s.succ.castSucc), x ≠ u → ∃ (f : E), Incident G x f ∧ f ∈ InternalEdges G + (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + t.succ.castSucc)) ∧ rho f = some choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett q s t hst + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro u huS hsSubset rho choice rhoStable huMissing witnessEdge colorCarry beforeT hbeforeSucc + hsbefore x hxS hxu + obtain ⟨f, hxf, hfOldColor, hfInternalS⟩ := witnessEdge x hxS hxu + have hfTreeS : TreeIncidentEdge + (series.data.tree s.succ.castSucc) f := ⟨x, hxS, hxf⟩ + have hfBefore := (SameColorSeriesPreserved G k ett.rounds e0 input + series s beforeT hsbefore f choice.color hfTreeS hfOldColor + (Finset.mem_union_left _ (by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨u, huS, huMissing⟩))).2 hfInternalS + have hfAtT : series.data.coloring t.castSucc f = + some choice.color := by + rw [hbeforeSucc] at hfBefore + exact hfBefore.trans hfOldColor + have hfInternalT : f ∈ InternalEdges G + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) := by + simp only [InternalEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hfInternalS ⊢ + intro y hyf + exact hsSubset (hfInternalS y hyf) + have hxT := hsSubset hxS + have hfTreeT : TreeIncidentEdge + (series.data.tree t.succ.castSucc) f := ⟨x, hxT, hxf⟩ + have hfSelected : choice.selected f = some choice.color := + (choice.selectedStable.1 f hfTreeT + ⟨choice.color, colorCarry, hfAtT⟩).trans hfAtT + have hfRho : rho f = some choice.color := + (rhoStable.1 f hfTreeT + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), hfSelected⟩).trans hfSelected + exact ⟨f, hxf, hfInternalT, hfRho⟩ + +private theorem helper_noBoundaryOnOld_455.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (s t : Fin ett.rounds), ∀ (u : V) (rho : + PartialEdgeColoring E k), IsProperEdgeColoring G rho → ∀ (choice : MaximumDefectiveChoice + G e0 ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) + (TashkinovStoredColors (ett.series : TashkinovSeries G k ett.rounds e0 input).data + t.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring + t.castSucc)), (∀ x ∈ TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds + e0 input).data.tree s.succ.castSucc), x ≠ u → ∃ (f : E), Incident G x f ∧ f ∈ + InternalEdges G (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc)) ∧ rho f = some choice.color) → ∀ x ∈ + TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + s.succ.castSucc), x ≠ u → ¬BoundaryColorVertex G rho (TreeSequenceVertexSet ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc)) choice.color x := by + classical + intro V E _ _ _ G k e0 input T generating ett s t + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro u rho rhoProper choice edgeAtRho x hxS hxu hxBoundary + obtain ⟨f, hxf, hfInternal, hfColor⟩ := edgeAtRho x hxS hxu + obtain ⟨hxT, g, hgBoundaryColor, hxg⟩ := hxBoundary + have hgBoundary : g ∈ BoundaryEdges G + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) := + (Finset.mem_filter.mp hgBoundaryColor).1 + have hgColor : rho g = some choice.color := + (Finset.mem_filter.mp hgBoundaryColor).2 + have hgf : g ≠ f := by + intro hgf + subst g + have hfAll : + ∀ y, Incident G y f → y ∈ TreeSequenceVertexSet (series.data.tree t.succ.castSucc) := by + simpa only [InternalEdges, Finset.mem_filter, Finset.mem_univ, + true_and] using hfInternal + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hgBoundary + obtain ⟨a, ha, b, hb, hab⟩ := hgBoundary + have hbf : Incident G b f := by simp [Incident, hab] + exact hb (hfAll b hbf) + exact (rhoProper hgf ⟨x, hxg, hxf⟩ hgColor) hfColor + +private theorem helper_boundaryEq_516.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (t : Fin ett.rounds), ∀ (rho : + PartialEdgeColoring E k), IsProperEdgeColoring G rho → IsOneEdgeUncolored rho e0 → ∀ + (choice : MaximumDefectiveChoice G e0 ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc) (TashkinovStoredColors (ett.series : TashkinovSeries G k + ett.rounds e0 input).data t.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring t.castSucc)), StableColoring ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree t.succ.castSucc) (insert choice.color + (TashkinovStoredColors (ett.series : TashkinovSeries G k ett.rounds e0 input).data + t.castSucc)) choice.selected rho → (∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc)) → + TreeIncidentEdge ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + t.succ.castSucc) f) → BoundaryColorEdges G choice.selected (TreeSequenceVertexSet + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc)) + choice.color = BoundaryColorEdges G rho (TreeSequenceVertexSet ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc)) choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett t + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro rho rhoProper rhoOne choice rhoStable boundaryIncident + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + constructor + · rintro ⟨hfBoundary, hfColor⟩ + refine ⟨hfBoundary, ?_⟩ + exact (rhoStable.1 f (boundaryIncident hfBoundary) + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), hfColor⟩).trans hfColor + · rintro ⟨hfBoundary, hfColor⟩ + refine ⟨hfBoundary, ?_⟩ + have hfixed := (sc1 G e0 (series.data.tree t.succ.castSucc) + (insert choice.color + (TashkinovStoredColors series.data t.castSucc)) + choice.selected rho choice.selectedProper + choice.selectedOneUncolored rhoProper rhoOne).mp rhoStable f + (boundaryIncident hfBoundary) + (Or.inr ⟨choice.color, + Finset.mem_union_right _ (Finset.mem_insert_self _ _), + hfColor⟩) + exact hfixed.symm.trans hfColor + +private theorem helper_hvsStage_628.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ s t : Fin ett.rounds) (vs : V), (↑s : + ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.kind s.succ = some TashkinovExtensionKind.PE + → ∀ (gamma : Fin k) (rho : PartialEdgeColoring E k), IsProperEdgeColoring G ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.coloring t.castSucc) → IsOneEdgeUncolored + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring t.castSucc) e0 → + ColoredVertexSetClosed G ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring t.castSucc) (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree t.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring t.castSucc) + (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + t.succ.castSucc)) → ¬Nonempty (RevisitingExtensionCertificate (ett.series : + TashkinovSeries G k ett.rounds e0 input).data t.castSucc) → ∀ (choice : + MaximumDefectiveChoice G e0 ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc) (TashkinovStoredColors (ett.series : TashkinovSeries G k + ett.rounds e0 input).data t.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring t.castSucc)), (∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ StableColoring ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) (insert choice.color + (TashkinovStoredColors (ett.series : TashkinovSeries G k ett.rounds e0 input).data + t.castSucc)) choice.selected rho ∧ ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + t.succ.castSucc))) → (ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring + t.succ = TwoColorComponentSwap G rho gamma choice.color (Sum.inl choice.vertex) → + (ett.series : TashkinovSeries G k ett.rounds e0 input).data.stored t.succ = {choice.color, + gamma} → (ett.series : TashkinovSeries G k ett.rounds e0 input).data.connectingEdges + t.succ = {choice.edge} → (ett.series : TashkinovSeries G k ett.rounds e0 input).data.kind + t.succ = some TashkinovExtensionKind.PE → (ett.series : TashkinovSeries G k ett.rounds e0 + input).data.chosenVertex t.succ = some choice.vertex → (ett.series : TashkinovSeries G k + ett.rounds e0 input).data.outsideVertex t.succ = some choice.otherEndpoint → (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.delta t.succ = some choice.color → + (ett.series : TashkinovSeries G k ett.rounds e0 input).data.gamma t.succ = some gamma → + TashkinovClosure ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring + t.succ) ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.succ) → + TreeSequenceInitialSegment ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.succ) → ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc).length < ((ett.series : TashkinovSeries G k ett.rounds + e0 input).data.tree t.succ.succ).length → vs ∈ TreeSequenceVertexSet ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree s.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett q s t vs hst hsVertex + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro hsKind gamma rho previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails currentColoring + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension + have stepS := series.certified s.succ + generalize hsZ : s.succ = z at stepS + cases stepS with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val hsZ + simp at hv + | SE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choiceS + seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have hrs : r = s := by + apply Fin.ext + have hv := congrArg Fin.val hsZ + simp at hv ⊢ + omega + subst r + rw [currentKind] at hsKind + simp at hsKind + | RE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring + currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension + strictExtension => + have hrs : r = s := by + apply Fin.ext + have hv := congrArg Fin.val hsZ + simp at hv ⊢ + omega + subst r + rw [currentKind] at hsKind + simp at hsKind + | PE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choiceS + seriesAlternativeFails gammaS gammaRuleS secondStableS + secondStableProperS secondStableOneUncoloredS + secondStableRelationS exitWitnessS currentColoringS + currentProperS currentOneUncoloredS currentStoredS + currentEdgesS currentKindS currentVertexS currentOutsideS + currentDeltaS currentGammaS closedExtensionS + orderedExtensionS strictExtensionS => + have hrs : r = s := by + apply Fin.ext + have hv := congrArg Fin.val hsZ + simp at hv ⊢ + omega + subst r + have hvs : choiceS.vertex = vs := by + rw [currentVertexS] at hsVertex + exact Option.some.inj hsVertex + simpa [hvs] using choiceS.vertexDefective.1 + +private theorem helper_continuation_764.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds), (↑q : ℕ) + (1 : ℕ) = + ett.rounds → ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some terminalSupport → (∀ (r a : Fin ett.rounds), + (↑a : ℕ) < (↑r : ℕ) → ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → StableColoring (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc) + sigma → ∀ (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta → ∀ (v : V), BoundaryColorVertex G sigma + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) delta v → (∃ (w : V), + BoundaryColorVertex G sigma (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) + delta w ∧ TreeVertexOrder (ett.series.data.tree r.succ.castSucc) w v) → ∀ (hvFinal : v ∈ + TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett v hvFinal ≤ (↑a : ℕ) + (1 : ℕ) → ∀ + (va : V), ett.series.data.kind a.succ = some TashkinovExtensionKind.PE ∨ + ett.series.data.kind a.succ = some TashkinovExtensionKind.SE → + ett.series.data.chosenVertex a.succ = some va → v = va ∨ TreeVertexOrder + (ett.series.data.tree r.succ.castSucc) v va) → ∀ (s t : Fin ett.rounds), ∀ vs ∈ + TreeSequenceVertexSet T, s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + (↑s : ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.kind s.succ = some TashkinovExtensionKind.PE + → (∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → ∀ {x y : V}, + TreeVertexOrder A x y → TreeVertexOrder B x y) → (∀ {A : TreeSequence G e0} {x y z : V}, + TreeVertexOrder A x y → TreeVertexOrder A y z → TreeVertexOrder A x z) → (∀ {A B : + TreeSequence G e0}, TreeSequenceInitialSegment A B → ∀ {x y : V}, y ∈ + TreeSequenceVertexSet A → TreeVertexOrder B x y → x ∈ TreeSequenceVertexSet A) → ∀ (u : + V), TreeSequenceInitialSegment ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree s.succ.castSucc) T → TreeSequenceInitialSegment ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) T → ∀ (gamma : Fin k) + (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho → IsOneEdgeUncolored rho e0 → + IsProperEdgeColoring G ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring t.castSucc) → IsOneEdgeUncolored ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.coloring t.castSucc) e0 → ColoredVertexSetClosed G ((ett.series + : TashkinovSeries G k ett.rounds e0 input).data.coloring t.castSucc) + (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + t.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.coloring t.castSucc) (TreeSequenceVertexSet ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate (ett.series : TashkinovSeries G k ett.rounds e0 + input).data t.castSucc) → ∀ (choice : MaximumDefectiveChoice G e0 ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) (TashkinovStoredColors + (ett.series : TashkinovSeries G k ett.rounds e0 input).data t.castSucc) ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.coloring t.castSucc)), (∃ (rho : + PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + t.succ.castSucc) (insert choice.color (TashkinovStoredColors (ett.series : TashkinovSeries + G k ett.rounds e0 input).data t.castSucc)) choice.selected rho ∧ ¬Disjoint (MissingColors + G rho choice.otherEndpoint) (TreeMissingColors rho ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree t.succ.castSucc))) → (ett.series : TashkinovSeries G k + ett.rounds e0 input).data.coloring t.succ = TwoColorComponentSwap G rho gamma choice.color + (Sum.inl choice.vertex) → (ett.series : TashkinovSeries G k ett.rounds e0 + input).data.stored t.succ = {choice.color, gamma} → (ett.series : TashkinovSeries G k + ett.rounds e0 input).data.connectingEdges t.succ = {choice.edge} → (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.kind t.succ = some TashkinovExtensionKind.PE + → (ett.series : TashkinovSeries G k ett.rounds e0 input).data.chosenVertex t.succ = some + choice.vertex → (ett.series : TashkinovSeries G k ett.rounds e0 input).data.outsideVertex + t.succ = some choice.otherEndpoint → (ett.series : TashkinovSeries G k ett.rounds e0 + input).data.delta t.succ = some choice.color → (ett.series : TashkinovSeries G k + ett.rounds e0 input).data.gamma t.succ = some gamma → TashkinovClosure ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.coloring t.succ) ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.succ) → + TreeSequenceInitialSegment ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.succ) → ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc).length < ((ett.series : TashkinovSeries G k ett.rounds + e0 input).data.tree t.succ.succ).length → choice.vertex ∈ TreeSequenceVertexSet T → + ett.series.data.chosenVertex t.succ = some choice.vertex → (∀ x ∈ TreeSequenceVertexSet + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree s.succ.castSucc), x ≠ u + → ¬BoundaryColorVertex G rho (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree t.succ.castSucc)) choice.color x) → StableColoring + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) + (TashkinovStoredColors (ett.series : TashkinovSeries G k ett.rounds e0 input).data + t.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring + t.castSucc) rho → BoundaryColorEdges G choice.selected (TreeSequenceVertexSet ((ett.series + : TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc)) choice.color = + BoundaryColorEdges G rho (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree t.succ.castSucc)) choice.color → choice.edge ∈ + BoundaryColorEdges G choice.selected (TreeSequenceVertexSet ((ett.series : TashkinovSeries + G k ett.rounds e0 input).data.tree t.succ.castSucc)) choice.color → DefectiveColor G rho + (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + t.succ.castSucc)) choice.color → False := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q hqTerminal + hqKind hqVertex hLowerPartV s t vs hvsFinal hsActive htActive hst hsVertex + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro hsKind orderTransfer orderTrans initialDownward u hsFinal htFinal gamma rho rhoProper + rhoOne previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hvtFinal htVertex noBoundaryOnOld rhoStableReference + boundaryEq hchoiceBoundary hdefectiveRho + have hchoiceBoundaryRho : choice.edge ∈ BoundaryColorEdges G rho + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) + choice.color := by + rw [← boundaryEq] + exact hchoiceBoundary + obtain ⟨g, hgBoundary, hgne⟩ : ∃ g, + g ∈ BoundaryColorEdges G rho + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) + choice.color ∧ g ≠ choice.edge := by + obtain ⟨a, ha, b, hb, hab⟩ := + Finset.one_lt_card.mp (show 1 < + (BoundaryColorEdges G rho + (TreeSequenceVertexSet + (series.data.tree t.succ.castSucc)) choice.color).card by + exact lt_of_lt_of_le Nat.one_lt_two hdefectiveRho) + by_cases haChoice : a = choice.edge + · exact ⟨b, hb, by + intro hbChoice + exact hab (haChoice.trans hbChoice.symm)⟩ + · exact ⟨a, ha, haChoice⟩ + have hgRaw : g ∈ BoundaryEdges G + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) := + (Finset.mem_filter.mp hgBoundary).1 + have hgColor : rho g = some choice.color := + (Finset.mem_filter.mp hgBoundary).2 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hgRaw + obtain ⟨y, hyT, outside, houtside, hgEnds⟩ := hgRaw + have hyg : Incident G y g := by simp [Incident, hgEnds] + have hyBoundary : BoundaryColorVertex G rho + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) + choice.color y := ⟨hyT, g, hgBoundary, hyg⟩ + have hchoiceRhoColor : rho choice.edge = some choice.color := + (Finset.mem_filter.mp hchoiceBoundaryRho).2 + have hchoiceVertexT : choice.vertex ∈ + TreeSequenceVertexSet (series.data.tree t.succ.castSucc) := + choice.vertexDefective.1 + have hchoiceBoundaryVertex : BoundaryColorVertex G rho + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) + choice.color choice.vertex := + ⟨hchoiceVertexT, choice.edge, hchoiceBoundaryRho, + choice.edgeIncident⟩ + have hyne : y ≠ choice.vertex := by + intro hyEq + subst y + exact (rhoProper hgne + ⟨choice.vertex, hyg, choice.edgeIncident⟩ hgColor) + hchoiceRhoColor + have hyDefective : DefectiveVertex G rho + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) y := + ⟨hyT, g, ⟨choice.color, hdefectiveRho, hgBoundary⟩, hyg⟩ + have hyOrder : TreeVertexOrder + (series.data.tree t.succ.castSucc) y choice.vertex := by + rcases choice.maximal rho y rhoProper rhoOne rhoStableReference + hyDefective with heq | horder + · exact (hyne heq).elim + · exact horder + have hsupport := (ExtensionBaseSupportOrder ett terminalSupport + hterminalSupport q hqTerminal hqKind hqVertex hLowerPartV).1 + s t vs choice.vertex hvsFinal hvtFinal hsActive htActive hst + hsVertex htVertex + have hvsStage := @helper_hvsStage_628 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett q s t vs hst hsVertex hsKind gamma rho previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension + have hchoiceInS : choice.vertex ∈ + TreeSequenceVertexSet (series.data.tree s.succ.castSucc) := by + rcases hsupport with heq | horder + · simpa [heq] using hvsStage + · exact initialDownward hsFinal hvsStage horder + have hyFinalOrder : TreeVertexOrder T y choice.vertex := + orderTransfer htFinal hyOrder + have hyOrderVs : TreeVertexOrder T y vs := by + rcases hsupport with heq | horder + · simpa [heq] using hyFinalOrder + · exact orderTrans hyFinalOrder horder + have hyInS := initialDownward hsFinal hvsStage hyOrderVs + by_cases huChoice : u = choice.vertex + · have hyu : y ≠ u := by simpa [huChoice] using hyne + exact noBoundaryOnOld y hyInS hyu hyBoundary + · exact noBoundaryOnOld choice.vertex hchoiceInS (Ne.symm huChoice) + hchoiceBoundaryVertex + +private theorem helper_continuation_1128.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds), (↑q : ℕ) + (1 : ℕ) = + ett.rounds → ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some terminalSupport → (∀ (r a : Fin ett.rounds), + (↑a : ℕ) < (↑r : ℕ) → ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → StableColoring (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc) + sigma → ∀ (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta → ∀ (v : V), BoundaryColorVertex G sigma + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) delta v → (∃ (w : V), + BoundaryColorVertex G sigma (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) + delta w ∧ TreeVertexOrder (ett.series.data.tree r.succ.castSucc) w v) → ∀ (hvFinal : v ∈ + TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett v hvFinal ≤ (↑a : ℕ) + (1 : ℕ) → ∀ + (va : V), ett.series.data.kind a.succ = some TashkinovExtensionKind.PE ∨ + ett.series.data.kind a.succ = some TashkinovExtensionKind.SE → + ett.series.data.chosenVertex a.succ = some va → v = va ∨ TreeVertexOrder + (ett.series.data.tree r.succ.castSucc) v va) → ∀ (s t : Fin ett.rounds), ∀ vs ∈ + TreeSequenceVertexSet T, s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + (↑s : ℕ) < (↑t : ℕ) → ett.series.data.chosenVertex s.succ = some vs → (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.kind s.succ = some TashkinovExtensionKind.PE + → (∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → ∀ {x y : V}, + TreeVertexOrder A x y → TreeVertexOrder B x y) → (∀ {A : TreeSequence G e0} {x y z : V}, + TreeVertexOrder A x y → TreeVertexOrder A y z → TreeVertexOrder A x z) → (∀ {A B : + TreeSequence G e0}, TreeSequenceInitialSegment A B → ∀ {x y : V}, y ∈ + TreeSequenceVertexSet A → TreeVertexOrder B x y → x ∈ TreeSequenceVertexSet A) → ∀ (u : + V), TreeSequenceInitialSegment ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree s.succ.castSucc) T → TreeSequenceInitialSegment ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) T → ∀ (gamma : Fin k) + (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho → IsOneEdgeUncolored rho e0 → + IsProperEdgeColoring G ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring t.castSucc) → IsOneEdgeUncolored ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.coloring t.castSucc) e0 → ColoredVertexSetClosed G ((ett.series + : TashkinovSeries G k ett.rounds e0 input).data.coloring t.castSucc) + (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + t.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.coloring t.castSucc) (TreeSequenceVertexSet ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate (ett.series : TashkinovSeries G k ett.rounds e0 + input).data t.castSucc) → ∀ (choice : MaximumDefectiveChoice G e0 ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) (TashkinovStoredColors + (ett.series : TashkinovSeries G k ett.rounds e0 input).data t.castSucc) ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.coloring t.castSucc)), (∃ (rho : + PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + t.succ.castSucc) (insert choice.color (TashkinovStoredColors (ett.series : TashkinovSeries + G k ett.rounds e0 input).data t.castSucc) : Finset (Fin k)) choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc))) → (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.coloring t.succ = TwoColorComponentSwap G + rho gamma choice.color (Sum.inl choice.vertex) → (ett.series : TashkinovSeries G k + ett.rounds e0 input).data.stored t.succ = (insert choice.color ({gamma} : Finset (Fin k)) + : Finset (Fin k)) → (ett.series : TashkinovSeries G k ett.rounds e0 + input).data.connectingEdges t.succ = ({choice.edge} : Finset E) → (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.kind t.succ = some TashkinovExtensionKind.PE + → (ett.series : TashkinovSeries G k ett.rounds e0 input).data.chosenVertex t.succ = some + choice.vertex → (ett.series : TashkinovSeries G k ett.rounds e0 input).data.outsideVertex + t.succ = some choice.otherEndpoint → (ett.series : TashkinovSeries G k ett.rounds e0 + input).data.delta t.succ = some choice.color → (ett.series : TashkinovSeries G k + ett.rounds e0 input).data.gamma t.succ = some gamma → TashkinovClosure ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.coloring t.succ) ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.succ) → + TreeSequenceInitialSegment ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.succ) → ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc).length < ((ett.series : TashkinovSeries G k ett.rounds + e0 input).data.tree t.succ.succ).length → choice.vertex ∈ TreeSequenceVertexSet T → + ett.series.data.chosenVertex t.succ = some choice.vertex → (∀ x ∈ TreeSequenceVertexSet + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree s.succ.castSucc), x ≠ u + → ¬BoundaryColorVertex G rho (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree t.succ.castSucc)) choice.color x) → StableColoring + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) + (TashkinovStoredColors (ett.series : TashkinovSeries G k ett.rounds e0 input).data + t.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring + t.castSucc) rho → BoundaryColorEdges G choice.selected (TreeSequenceVertexSet ((ett.series + : TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc)) choice.color = + BoundaryColorEdges G rho (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree t.succ.castSucc)) choice.color → choice.edge ∈ + BoundaryColorEdges G choice.selected (TreeSequenceVertexSet ((ett.series : TashkinovSeries + G k ett.rounds e0 input).data.tree t.succ.castSucc)) choice.color → False := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q hqTerminal + hqKind hqVertex hLowerPartV s t vs hvsFinal hsActive htActive hst hsVertex + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro hsKind orderTransfer orderTrans initialDownward u hsFinal htFinal gamma rho rhoProper + rhoOne previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hvtFinal htVertex noBoundaryOnOld rhoStableReference + boundaryEq hchoiceBoundary + have hdefectiveSelected : DefectiveColor G choice.selected + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) + choice.color := by + obtain ⟨c, hcDefective, hcBoundary⟩ := choice.edgeDefective + have hcColor : choice.selected choice.edge = some c := + (Finset.mem_filter.mp hcBoundary).2 + have hc : c = choice.color := + Option.some.inj (hcColor.symm.trans choice.edgeColor) + simpa [hc] using hcDefective + have hdefectiveRho : DefectiveColor G rho + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) + choice.color := by + unfold DefectiveColor at hdefectiveSelected ⊢ + rw [← boundaryEq] + exact hdefectiveSelected + exact @helper_continuation_764 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett terminalSupport hterminalSupport q hqTerminal hqKind hqVertex + hLowerPartV s t vs hvsFinal hsActive htActive hst hsVertex hsKind orderTransfer orderTrans + initialDownward u hsFinal htFinal gamma rho rhoProper rhoOne previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension strictExtension + hvtFinal htVertex noBoundaryOnOld rhoStableReference boundaryEq hchoiceBoundary hdefectiveRho + +private theorem helper_branch_447.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds), (↑q : ℕ) + (1 : ℕ) = + ett.rounds → ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some terminalSupport → (∀ (r a : Fin ett.rounds), + (↑a : ℕ) < (↑r : ℕ) → ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → StableColoring (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc) + sigma → ∀ (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta → ∀ (v : V), BoundaryColorVertex G sigma + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) delta v → (∃ (w : V), + BoundaryColorVertex G sigma (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) + delta w ∧ TreeVertexOrder (ett.series.data.tree r.succ.castSucc) w v) → ∀ (hvFinal : v ∈ + TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett v hvFinal ≤ (↑a : ℕ) + (1 : ℕ) → ∀ + (va : V), ett.series.data.kind a.succ = some TashkinovExtensionKind.PE ∨ + ett.series.data.kind a.succ = some TashkinovExtensionKind.SE → + ett.series.data.chosenVertex a.succ = some va → v = va ∨ TreeVertexOrder + (ett.series.data.tree r.succ.castSucc) v va) → ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ + TreeSequenceVertexSet T → vt ∈ TreeSequenceVertexSet T → ∀ (deltaT : Fin k), s ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → t ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → (↑s : ℕ) < (↑t : ℕ) → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → ett.series.data.delta t.succ = some deltaT → (ett.series : TashkinovSeries G k + ett.rounds e0 input).data.kind s.succ = some TashkinovExtensionKind.PE → (∀ {A B : + TreeSequence G e0}, TreeSequenceInitialSegment A B → ∀ {x y : V}, TreeVertexOrder A x y → + TreeVertexOrder B x y) → (∀ {A : TreeSequence G e0} {x y z : V}, TreeVertexOrder A x y → + TreeVertexOrder A y z → TreeVertexOrder A x z) → (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ {x y : V}, y ∈ TreeSequenceVertexSet A → + TreeVertexOrder B x y → x ∈ TreeSequenceVertexSet A) → ∀ u ∈ TreeSequenceVertexSet + (ett.series.data.tree s.succ.castSucc), deltaT ∈ MissingColors G (ett.series.data.coloring + s.castSucc) u → (∀ x ∈ TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds + e0 input).data.tree s.succ.castSucc), x ≠ u → ∃ (f : E), Incident G x f ∧ (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.coloring s.castSucc f = some deltaT ∧ f ∈ + InternalEdges G (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree s.succ.castSucc))) → deltaT ∈ TreeMissingColors ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.coloring t.castSucc) ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree t.succ.castSucc) ∪ + TashkinovStoredColors (ett.series : TashkinovSeries G k ett.rounds e0 input).data + t.castSucc → TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree s.succ.castSucc) ⊆ TreeSequenceVertexSet ((ett.series : TashkinovSeries G + k ett.rounds e0 input).data.tree t.succ.castSucc) → TreeSequenceInitialSegment + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree s.succ.castSucc) T → + TreeSequenceInitialSegment ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree t.succ.castSucc) T → ∀ (r : Fin ett.rounds), IsProperEdgeColoring G + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring r.castSucc) → + IsOneEdgeUncolored ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring + r.castSucc) e0 → ColoredVertexSetClosed G ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring r.castSucc) (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree r.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring r.castSucc) + (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + r.succ.castSucc)) → ¬Nonempty (RevisitingExtensionCertificate (ett.series : + TashkinovSeries G k ett.rounds e0 input).data r.castSucc) → ∀ (choice : + MaximumDefectiveChoice G e0 ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree r.succ.castSucc) (TashkinovStoredColors (ett.series : TashkinovSeries G k + ett.rounds e0 input).data r.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring r.castSucc)), (∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ StableColoring ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree r.succ.castSucc) (insert choice.color + (TashkinovStoredColors (ett.series : TashkinovSeries G k ett.rounds e0 input).data + r.castSucc)) choice.selected rho ∧ ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + r.succ.castSucc))) → ∀ (gamma : Fin k), ParallelExtensionColor (ett.series : + TashkinovSeries G k ett.rounds e0 input).data r.castSucc choice.selected choice.vertex + gamma → ∀ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho → IsOneEdgeUncolored + rho e0 → StableColoring ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + r.succ.castSucc) (insert choice.color (TashkinovStoredColors (ett.series : TashkinovSeries + G k ett.rounds e0 input).data r.castSucc)) choice.selected rho → TreeExit ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree r.succ.castSucc) rho gamma choice.color + choice.vertex → (ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring + r.succ = TwoColorComponentSwap G rho gamma choice.color (Sum.inl choice.vertex) → + IsProperEdgeColoring G ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring r.succ) → IsOneEdgeUncolored ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.coloring r.succ) e0 → (ett.series : TashkinovSeries G k + ett.rounds e0 input).data.stored r.succ = {choice.color, gamma} → (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.connectingEdges r.succ = {choice.edge} → + (ett.series : TashkinovSeries G k ett.rounds e0 input).data.kind r.succ = some + TashkinovExtensionKind.PE → (ett.series : TashkinovSeries G k ett.rounds e0 + input).data.chosenVertex r.succ = some choice.vertex → (ett.series : TashkinovSeries G k + ett.rounds e0 input).data.outsideVertex r.succ = some choice.otherEndpoint → (ett.series : + TashkinovSeries G k ett.rounds e0 input).data.delta r.succ = some choice.color → + (ett.series : TashkinovSeries G k ett.rounds e0 input).data.gamma r.succ = some gamma → + TashkinovClosure ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.coloring + r.succ) ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree r.succ.castSucc) + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree r.succ.succ) → + TreeSequenceInitialSegment ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree r.succ.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree r.succ.succ) → ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree r.succ.castSucc).length < ((ett.series : TashkinovSeries G k ett.rounds + e0 input).data.tree r.succ.succ).length → t.succ = r.succ → False := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q hqTerminal + hqKind hqVertex hLowerPartV s t vs vt hvsFinal hvtFinal deltaT hsActive htActive hst + hsVertex htVertex htDelta + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro hsKind orderTransfer orderTrans initialDownward u huS huMissing witnessEdge colorCarry + hsSubset hsFinal htFinal r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule rho + rhoProper rhoOne rhoStable exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension hz + have hrt : r = t := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + have hchoiceVertex : choice.vertex = vt := by + rw [currentVertex] at htVertex + exact Option.some.inj htVertex + have hchoiceColor : choice.color = deltaT := by + rw [currentDelta] at htDelta + exact Option.some.inj htDelta + subst vt + subst deltaT + let beforeT : Fin ett.rounds := ⟨t.val - 1, by omega⟩ + have hbeforeSucc : beforeT.succ = t.castSucc := by + apply Fin.ext + simp [beforeT] + omega + have hsbefore : s.val ≤ beforeT.val := by + simp [beforeT] + omega + have edgeAtRho := @helper_edgeAtRho_418 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett q s t hst u huS hsSubset rho choice rhoStable huMissing witnessEdge + colorCarry hbeforeSucc hsbefore + have noBoundaryOnOld := @helper_noBoundaryOnOld_455 V E inferInstance inferInstance inferInstance + G k e0 input T generating ett s t u rho rhoProper choice edgeAtRho + have rhoStableSmall : StableColoring + (series.data.tree t.succ.castSucc) + (TashkinovStoredColors series.data t.castSucc) + choice.selected rho := by + constructor + · intro f hf hcontrol + obtain ⟨c, hc, hfc⟩ := hcontrol + apply rhoStable.1 f hf + refine ⟨c, ?_, hfc⟩ + rcases Finset.mem_union.mp hc with hcMissing | hcStored + · exact Finset.mem_union_left _ hcMissing + · exact Finset.mem_union_right _ (Finset.mem_insert_of_mem hcStored) + · exact rhoStable.2 + have rhoStableReference : StableColoring + (series.data.tree t.succ.castSucc) + (TashkinovStoredColors series.data t.castSucc) + (series.data.coloring t.castSucc) rho := by + exact (sc2 G e0 (series.data.tree t.succ.castSucc) + (TashkinovStoredColors series.data t.castSucc)).trans + (x := ⟨series.data.coloring t.castSucc, + ⟨previousProper, previousOneUncolored⟩⟩) + (y := ⟨choice.selected, + ⟨choice.selectedProper, choice.selectedOneUncolored⟩⟩) + (z := ⟨rho, ⟨rhoProper, rhoOne⟩⟩) + choice.selectedStable rhoStableSmall + have boundaryIncident : ∀ {f : E}, f ∈ BoundaryEdges G + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) → + TreeIncidentEdge (series.data.tree t.succ.castSucc) f := by + intro f hf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hf + obtain ⟨x, hx, y, hy, hends⟩ := hf + exact ⟨x, hx, by simp [Incident, hends]⟩ + have boundaryEq := @helper_boundaryEq_516 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett t rho rhoProper rhoOne choice rhoStable boundaryIncident + have hchoiceBoundary : choice.edge ∈ BoundaryColorEdges G + choice.selected + (TreeSequenceVertexSet (series.data.tree t.succ.castSucc)) + choice.color := by + obtain ⟨c, hcDefective, hcBoundary⟩ := choice.edgeDefective + have hcColor : choice.selected choice.edge = some c := + (Finset.mem_filter.mp hcBoundary).2 + have hc : c = choice.color := + Option.some.inj (hcColor.symm.trans choice.edgeColor) + simpa [hc] using hcBoundary + exact @helper_continuation_1128 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@q) + (@hqTerminal) (@hqKind) (@hqVertex) (@hLowerPartV) (@s) (@t) (@vs) (@hvsFinal) (@hsActive) + (@htActive) (@hst) (@hsVertex) (@hsKind) (@orderTransfer) (@orderTrans) (@initialDownward) + (@u) (@hsFinal) (@htFinal) (@gamma) (@rho) (@rhoProper) (@rhoOne) (@previousProper) + (@previousOneUncolored) (@previousClosed) (@previousNotStronglyClosed) (@noRevisiting) + (@choice) (@seriesAlternativeFails) (@currentColoring) (@currentStored) (@currentEdges) + (@currentKind) (@currentVertex) (@currentOutside) (@currentDelta) (@currentGamma) + (@closedExtension) (@orderedExtension) (@strictExtension) (@hvtFinal) (@htVertex) + (@noBoundaryOnOld) (@rhoStableReference) (@boundaryEq) (@hchoiceBoundary) +private theorem helper_stageSegment_802.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ _ _ : Fin ett.rounds), (∀ (i : Fin + ett.rounds), TreeSequenceInitialSegment ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree i.succ.castSucc) ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.tree i.succ.succ)) → (∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A + A) → (∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → ∀ (a b : Fin + ett.rounds), (↑a : ℕ) ≤ (↑b : ℕ) → TreeSequenceInitialSegment ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree a.succ.castSucc) ((ett.series : + TashkinovSeries G k ett.rounds e0 input).data.tree b.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett q s t + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro nextSegment segmentRefl segmentTrans a b hab + have claim : ∀ (n : ℕ), a.val ≤ n → n < ett.rounds → + ∀ r : Fin ett.rounds, r.val = n → + TreeSequenceInitialSegment (series.data.tree a.succ.castSucc) + (series.data.tree r.succ.castSucc) := by + intro n han + induction n, han using Nat.le_induction with + | base => + intro hn r hr + have hra : r = a := by apply Fin.ext; omega + subst r + exact segmentRefl _ + | succ n hn ih => + intro hrounds r hr + let p : Fin ett.rounds := ⟨n, by omega⟩ + have hprev := ih (by omega) p rfl + have hnext := nextSegment p + have htree : p.succ.succ = r.succ.castSucc := by + apply Fin.ext + simp [p, hr] + rw [htree] at hnext + exact segmentTrans hprev hnext + exact claim b.val hab b.isLt b rfl + +private theorem helper_witnessEdge_892.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (s : Fin ett.rounds) (deltaT : Fin k), + ColoredVertexSetElementary G ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring s.castSucc) (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree s.succ.castSucc)) → ∀ u ∈ TreeSequenceVertexSet + (ett.series.data.tree s.succ.castSucc), deltaT ∈ MissingColors G (ett.series.data.coloring + s.castSucc) u → ColoredVertexSetClosed G ((ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring s.castSucc) (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k + ett.rounds e0 input).data.tree s.succ.castSucc)) → ∀ x ∈ TreeSequenceVertexSet + ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree s.succ.castSucc), x ≠ u + → ∃ (f : E), Incident G x f ∧ (ett.series : TashkinovSeries G k ett.rounds e0 + input).data.coloring s.castSucc f = some deltaT ∧ f ∈ InternalEdges G + (TreeSequenceVertexSet ((ett.series : TashkinovSeries G k ett.rounds e0 input).data.tree + s.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett s deltaT + set series : TashkinovSeries G k ett.rounds e0 input := ett.series + intro hsElementary u huS huMissing hsClosed x hxS hxu + have hxNotMissing : deltaT ∉ MissingColors G + (series.data.coloring s.castSucc) x := by + intro hxMissing + have hd := hsElementary huS hxS hxu.symm + exact Finset.disjoint_left.mp hd huMissing hxMissing + have hxPresent : deltaT ∈ PresentColors G + (series.data.coloring s.castSucc) x := by + simpa [MissingColors] using hxNotMissing + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hxPresent + obtain ⟨f, hxf, hfColor⟩ := hxPresent + have hfInternal : f ∈ InternalEdges G + (TreeSequenceVertexSet (series.data.tree s.succ.castSucc)) := by + simp only [InternalEdges, Finset.mem_filter, Finset.mem_univ, true_and] + intro y hyf + by_contra hyOut + have hxy : x ≠ y := by + intro hxy + exact hyOut (hxy ▸ hxS) + have hends : G.ends f = s(x, y) := + (Sym2.mem_and_mem_iff hxy).mp ⟨hxf, hyf⟩ + have hfBoundary : f ∈ BoundaryEdges G + (TreeSequenceVertexSet (series.data.tree s.succ.castSucc)) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨x, hxS, y, hyOut, hends⟩ + exact hsClosed hfBoundary huS hfColor huMissing + exact ⟨f, hxf, hfColor, hfInternal⟩ + +theorem ExtensionBaseStrictDeltaExclusion {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (hqTerminal : q.val + 1 = ett.rounds) + (hqKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE) + (hqVertex : ett.series.data.chosenVertex q.succ = some terminalSupport) + (hLowerElementary : ∀ r : Fin ett.rounds, r.val < q.val → + ColoredVertexSetElementary G (ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc))) + (hLowerPartV : ∀ (r a : Fin ett.rounds), a.val < r.val → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc) sigma → + ∀ delta : Fin k, + DefectiveColor G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta → + ∀ v : V, + BoundaryColorVertex G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta v → + (∃ w : V, BoundaryColorVertex G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta w ∧ + TreeVertexOrder (ett.series.data.tree r.succ.castSucc) w v) → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T, + ETTFirstAppearanceIndex ett v hvFinal ≤ a.val + 1 → + ∀ va : V, + (ett.series.data.kind a.succ = + some TashkinovExtensionKind.PE ∨ + ett.series.data.kind a.succ = + some TashkinovExtensionKind.SE) → + ett.series.data.chosenVertex a.succ = some va → + v = va ∨ + TreeVertexOrder + (ett.series.data.tree r.succ.castSucc) v va) + (s t : Fin ett.rounds) (vs vt : V) + (hvsFinal : vs ∈ TreeSequenceVertexSet T) + (hvtFinal : vt ∈ TreeSequenceVertexSet T) + (deltaT : Fin k) + (hsActive : s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport) + (htActive : t ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport) + (hst : s.val < t.val) + (hsVertex : ett.series.data.chosenVertex s.succ = some vs) + (htVertex : ett.series.data.chosenVertex t.succ = some vt) + (htDelta : ett.series.data.delta t.succ = some deltaT) : + deltaT ∉ TreeMissingColors (ett.series.data.coloring s.castSucc) + (ett.series.data.tree s.succ.castSucc) := by + classical + let series := ett.series + have hsKind : series.data.kind s.succ = + some TashkinovExtensionKind.PE := by + have hh := hsActive + simp [ExtensionBaseActiveIndices] at hh + simpa [series] using hh.2.1 + have htKind : series.data.kind t.succ = + some TashkinovExtensionKind.PE := by + have hh := htActive + simp [ExtensionBaseActiveIndices] at hh + simpa [series] using hh.2.1 + have nextSegment := @helper_nextSegment_124 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett q s t + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, by intro i; rfl, by intro i; rfl⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + obtain ⟨hABlen, hABv, hABe⟩ := hAB + obtain ⟨hBClen, hBCv, hBCe⟩ := hBC + refine ⟨hABlen.trans hBClen, ?_, ?_⟩ + · intro i + calc + C.vertex (Fin.castLE (Nat.succ_le_succ (hABlen.trans hBClen)) i) = + B.vertex (Fin.castLE (Nat.succ_le_succ hABlen) i) := by + simpa only [Fin.castLE] using + hBCv (Fin.castLE (Nat.succ_le_succ hABlen) i) + _ = A.vertex i := hABv i + · intro i + calc + C.edge (Fin.castLE (hABlen.trans hBClen) i) = + B.edge (Fin.castLE hABlen i) := by + simpa only [Fin.castLE] using hBCe (Fin.castLE hABlen i) + _ = A.edge i := hABe i + have stageSegment := @helper_stageSegment_802 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett q s t nextSegment segmentRefl segmentTrans + have stageFinal (a : Fin ett.rounds) : + TreeSequenceInitialSegment (series.data.tree a.succ.castSucc) T := by + have haq : a.val ≤ q.val := by + have ha := a.isLt + omega + have haqSeg := stageSegment a q haq + have htree : q.succ.castSucc = (⟨ett.rounds, by omega⟩ : + Fin (ett.rounds + 2)) := by + apply Fin.ext + simp only [Fin.castSucc_succ, Fin.val_succ, Fin.val_castSucc] + exact hqTerminal + rw [htree] at haqSeg + exact segmentTrans haqSeg ett.abovePenultimate + have orderTransfer {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) {x y : V} + (hxy : TreeVertexOrder A x y) : TreeVertexOrder B x y := by + obtain ⟨hlen, hvertices, hedges⟩ := hAB + obtain ⟨i, j, hix, hjy, hij⟩ := hxy + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, + Fin.castLE (Nat.succ_le_succ hlen) j, + (hvertices i).trans hix, (hvertices j).trans hjy, hij⟩ + have orderTrans {A : TreeSequence G e0} {x y z : V} + (hxy : TreeVertexOrder A x y) (hyz : TreeVertexOrder A y z) : + TreeVertexOrder A x z := by + obtain ⟨i, j, hix, hjy, hij⟩ := hxy + obtain ⟨j', l, hjy', hlz, hjl⟩ := hyz + have hj : j = j' := A.vertex_injective (hjy.trans hjy'.symm) + subst j' + exact ⟨i, l, hix, hlz, hij.trans hjl⟩ + have initialDownward {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) {x y : V} + (hy : y ∈ TreeSequenceVertexSet A) + (hxy : TreeVertexOrder B x y) : x ∈ TreeSequenceVertexSet A := by + obtain ⟨hlen, hvertices, hedges⟩ := hAB + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hy ⊢ + obtain ⟨jA, hjA⟩ := hy + obtain ⟨iB, jB, hiBx, hjBy, hij⟩ := hxy + have hjEq : jB = Fin.castLE (Nat.succ_le_succ hlen) jA := by + apply B.vertex_injective + exact hjBy.trans ((hvertices jA).trans hjA).symm + have hiBound : iB.val < A.length + 1 := by + rw [hjEq] at hij + exact lt_of_lt_of_le hij jA.isLt.le + let iA : Fin (A.length + 1) := ⟨iB.val, hiBound⟩ + refine ⟨iA, ?_⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hlen) iA = iB := by + apply Fin.ext + rfl + exact (hvertices iA).symm.trans (hcast ▸ hiBx) + intro hmissing + have hsltq : s.val < q.val := by + have htlt := t.isLt + omega + have hsElementary : ColoredVertexSetElementary G + (series.data.coloring s.castSucc) + (TreeSequenceVertexSet (series.data.tree s.succ.castSucc)) := by + exact hLowerElementary s hsltq + simp only [TreeMissingColors, Finset.mem_biUnion] at hmissing + obtain ⟨u, huS, huMissing⟩ := hmissing + have hsClosed := @helper_hsClosed_282 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett q s t hsKind + have witnessEdge := @helper_witnessEdge_892 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett s deltaT hsElementary u huS huMissing hsClosed + have colorCarry := @helper_colorCarry_371 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett q s t deltaT hst u huS huMissing + have hstSegment := stageSegment s t (Nat.le_of_lt hst) + have hsSubset := TreeSequenceInitialSegmentVertexSetSubset hstSegment + have hsFinal := stageFinal s + have htFinal := stageFinal t + have htStep := series.certified t.succ + generalize hz : t.succ = z at htStep + cases htStep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val hz + simp at hv + | SE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hrt : r = t := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + rw [currentKind] at htKind + simp at htKind + | RE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hrt : r = t := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst r + rw [currentKind] at htKind + simp at htKind + | PE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule rho rhoProper rhoOne rhoStable exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_447 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport q hqTerminal hqKind hqVertex + hLowerPartV s t vs vt hvsFinal hvtFinal deltaT hsActive htActive hst hsVertex + htVertex htDelta hsKind orderTransfer orderTrans initialDownward u huS huMissing + witnessEdge colorCarry hsSubset hsFinal htFinal r previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails gamma gammaRule rho rhoProper rhoOne rhoStable exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hz +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseSupportClass.lean b/LeanPool/GoldbergSeymour/ExtensionBaseSupportClass.lean new file mode 100644 index 0000000000..4e3bb4920f --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseSupportClass.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseActiveIndices + +/-! +# Extension Base Support Class + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Active parallel-extension indices having the specified chosen support vertex. -/ +noncomputable def ExtensionBaseSupportClass {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) (w : V) : + Finset (Fin ett.rounds) := by + classical + exact (ExtensionBaseActiveIndices ett terminalSupport hterminalSupport).filter + fun s => ett.series.data.chosenVertex s.succ = some w + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseSupportClassColors.lean b/LeanPool/GoldbergSeymour/ExtensionBaseSupportClassColors.lean new file mode 100644 index 0000000000..fbae4792aa --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseSupportClassColors.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass +public import LeanPool.GoldbergSeymour.SupportingPEColorChain + +/-! +# Extension Base Support Class Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionBaseSupportClassColors {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (_ : q.val + 1 = ett.rounds) + (w : V) + (hw : w ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds) + (hincreasing : ∀ a b, a.val < b.val → + (indices a).val < (indices b).val) + (_ : ∀ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ↔ + ∃ a : Fin (p + 1), indices a = r) + (henumerates : ∀ r : Fin ett.rounds, + (r.val ≤ q.val ∧ + ett.series.data.kind r.succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex r.succ = some w) ↔ + ∃ a : Fin (p + 1), indices a = r) + (gamma delta : Fin (p + 1) → Fin k) + (hgamma : ∀ a, ett.series.data.gamma (indices a).succ = some (gamma a)) + (hdelta : ∀ a, ett.series.data.delta (indices a).succ = some (delta a)) + (hdeltaAvoidsEarlierGamma : ∀ a b, a.val ≤ b.val → + delta b ≠ gamma a) : + (∀ a : Fin p, gamma a.succ = delta a.castSucc) ∧ + Function.Injective (Fin.cons (gamma 0) delta) := by + classical + constructor + · intro a + have chain := SupportingPEColorChain G k ett.rounds p e0 input ett.series q w hw + indices hincreasing henumerates a + rw [hgamma, hdelta] at chain + exact Option.some.inj chain + · intro a b + revert b + refine Fin.cases ?_ (fun a => ?_) a + · intro b + refine Fin.cases ?_ (fun b => ?_) b + · intro hab + rfl + · intro hab + exfalso + apply hdeltaAvoidsEarlierGamma 0 b (Nat.zero_le _) + simpa only [Fin.cons_zero, Fin.cons_succ] using hab.symm + · intro b + refine Fin.cases ?_ (fun b => ?_) b + · intro hab + exfalso + apply hdeltaAvoidsEarlierGamma 0 a (Nat.zero_le _) + simpa only [Fin.cons_zero, Fin.cons_succ] using hab + · intro hab + rcases lt_trichotomy a b with hlt | heq | hgt + · have ha : a.val < p := by omega + let x : Fin p := ⟨a.val, ha⟩ + have hxa : x.castSucc = a := by + apply Fin.ext + rfl + have hxval : x.val = a.val := rfl + have hxb : x.succ.val ≤ b.val := by + change a.val + 1 ≤ b.val + omega + have he : delta a = delta b := by + simpa only [Fin.cons_succ] using hab + have hx : delta a = gamma x.succ := by + rw [← hxa] + have chain := SupportingPEColorChain G k ett.rounds p e0 input ett.series q w hw + indices hincreasing henumerates x + rw [hgamma, hdelta] at chain + exact (Option.some.inj chain).symm + exfalso + apply hdeltaAvoidsEarlierGamma x.succ b hxb + exact he ▸ hx + · exact congrArg Fin.succ heq + · exfalso + have hb : b.val < p := by omega + let x : Fin p := ⟨b.val, hb⟩ + have hxb : x.castSucc = b := by + apply Fin.ext + rfl + have hxval : x.val = b.val := rfl + have hxa : x.succ.val ≤ a.val := by + change b.val + 1 ≤ a.val + omega + have he : delta b = delta a := by + simpa only [Fin.cons_succ] using hab.symm + have hx : delta b = gamma x.succ := by + rw [← hxb] + have chain := SupportingPEColorChain G k ett.rounds p e0 input ett.series q w hw + indices hincreasing henumerates x + rw [hgamma, hdelta] at chain + exact (Option.some.inj chain).symm + apply hdeltaAvoidsEarlierGamma x.succ a hxa + exact he ▸ hx + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseSupportClassEnumeration.lean b/LeanPool/GoldbergSeymour/ExtensionBaseSupportClassEnumeration.lean new file mode 100644 index 0000000000..289136e2e2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseSupportClassEnumeration.lean @@ -0,0 +1,337 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Extension Base Support Class Enumeration + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ExtensionBaseSupportClassEnumeration_peVertex_63.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] {G : + LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} {T : + TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : Fin ett.rounds) (w : V) (r : Fin ett.rounds), + ett.series.data.kind r.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex r.succ = some w → w ∈ TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett q w r hkind hvertex + generalize targetEq : r.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero r targetEq).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have hi : i = r := by apply Fin.ext; omega + subst i + rw [currentKind] at hkind + simp at hkind + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have hi : i = r := by apply Fin.ext; omega + subst i + rw [currentKind] at hkind + simp at hkind + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have hi : i = r := by apply Fin.ext; omega + subst i + have vertexEq : choice.vertex = w := + Option.some.inj (currentVertex.symm.trans hvertex) + simpa [vertexEq] using choice.vertexDefective.1 + +private theorem ExtensionBaseSupportClassEnumeration_nextSegment_239.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] {G : + LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} {T : + TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k + e0 input T generating), ∀ terminalSupport ∈ TreeSequenceVertexSet T, ∀ (_ : Fin + ett.rounds) (w : V) (_ : Fin ett.rounds), ∀ v0 ∈ TreeSequenceVertexSet T, w ∈ + TreeSequenceVertexSet T → ∀ (r : Fin ett.rounds), TreeSequenceInitialSegment + (ett.series.data.tree r.succ.castSucc) (ett.series.data.tree r.succ.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q w r0 v0 + hv0Final hwFinal r + generalize targetEq : r.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero r targetEq).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have hi : i = r := by apply Fin.ext; omega + simpa [hi] using orderedExtension + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have hi : i = r := by apply Fin.ext; omega + simpa [hi] using orderedExtension + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have hi : i = r := by apply Fin.ext; omega + simpa [hi] using orderedExtension + +theorem ExtensionBaseSupportClassEnumeration {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (hqTerminal : q.val + 1 = ett.rounds) + (w : V) + (hcommon : ∀ (s : Fin ett.rounds) (v : V) + (hvFinal : v ∈ TreeSequenceVertexSet T), + s ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex s.succ = some v → + ETTFirstAppearanceIndex ett v hvFinal = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport) + (hclassNonempty : + (ExtensionBaseSupportClass ett terminalSupport hterminalSupport w).Nonempty) : + ∃ (p : ℕ) (indices : Fin (p + 1) → Fin ett.rounds), + w ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) ∧ + (∀ a b, a.val < b.val → + (indices a).val < (indices b).val) ∧ + (∀ r : Fin ett.rounds, + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w ↔ + ∃ a : Fin (p + 1), indices a = r) ∧ + ∀ r : Fin ett.rounds, + (r.val ≤ q.val ∧ + ett.series.data.kind r.succ = + some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex r.succ = some w) ↔ + ∃ a : Fin (p + 1), indices a = r := by + classical + have peVertex : + ∀ (r : Fin ett.rounds), ett.series.data.kind r.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex r.succ = some w → w ∈ TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc) := by + exact @ExtensionBaseSupportClassEnumeration_peVertex_63 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett q w + have firstBound : + ∀ (r : Fin ett.rounds) (hwFinal : w ∈ TreeSequenceVertexSet T), w ∈ TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc) → ETTFirstAppearanceIndex ett w hwFinal ≤ r.val + 1 + := by + intro r hwFinal hw + unfold ETTFirstAppearanceIndex + dsimp + have hmem : r.castSucc ∈ + Finset.univ.filter (fun i : Fin (ett.rounds + 1) => + w ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett i)) := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + simpa [ExtendedTashkinovLadderStage, Fin.lastCases_castSucc] using hw + have hle := Finset.min'_le + (Finset.univ.filter (fun i : Fin (ett.rounds + 1) => + w ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i))) + r.castSucc hmem + have hnat := Fin.le_iff_val_le_val.mp hle + rw [Fin.val_castSucc] at hnat + convert Nat.succ_le_succ hnat using 1 + obtain ⟨r0, hr0Class⟩ := hclassNonempty + have hr0Filter := hr0Class + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at hr0Filter + have hr0Active := hr0Filter.1 + have hr0Data := hr0Active + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] at hr0Data + obtain ⟨hr0Lower, hr0Kind, v0, hr0VertexV0, hv0Final, hv0First⟩ := + hr0Data + have hv0Eq : v0 = w := + Option.some.inj (hr0VertexV0.symm.trans hr0Filter.2) + have hwFinal : w ∈ TreeSequenceVertexSet T := by + simpa [hv0Eq] using hv0Final + have hfirstEq : ETTFirstAppearanceIndex ett w hwFinal = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport := + hcommon r0 w hwFinal hr0Active hr0Filter.2 + have classIff : + ∀ r : Fin ett.rounds, r ∈ ExtensionBaseSupportClass ett terminalSupport hterminalSupport w ↔ + r.val ≤ q.val ∧ ett.series.data.kind r.succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex r.succ = some w := by + intro r + constructor + · intro hrClass + have hrFilter := hrClass + simp only [ExtensionBaseSupportClass, Finset.mem_filter] at hrFilter + have hrData := hrFilter.1 + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] at hrData + exact ⟨by omega, hrData.2.1, hrFilter.2⟩ + · rintro ⟨hrq, hrKind, hrVertex⟩ + have hwStage := peVertex r hrKind hrVertex + have hwFirst : ETTFirstAppearanceIndex ett w hwFinal ≤ r.val + 1 := + firstBound r hwFinal hwStage + have hrActive : r ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport := by + simp only [ExtensionBaseActiveIndices, Finset.mem_filter, + Finset.mem_univ, true_and] + refine ⟨?_, hrKind, w, hwFinal, hrVertex, ?_⟩ + · rw [← hfirstEq] + exact hwFirst + · exact hfirstEq.le + simp only [ExtensionBaseSupportClass, Finset.mem_filter] + exact ⟨hrActive, hrVertex⟩ + let supportClass := + ExtensionBaseSupportClass ett terminalSupport hterminalSupport w + let p := supportClass.card - 1 + have supportCard : supportClass.card = p + 1 := by + have hpositive : 0 < supportClass.card := + Finset.card_pos.mpr ⟨r0, by simpa [supportClass] using hr0Class⟩ + dsimp [p] + omega + let sorted := supportClass.toList.insertionSort (· ≤ ·) + have sortedLength : sorted.length = p + 1 := by + simp [sorted, List.length_insertionSort, Finset.length_toList, + supportCard] + let indices : Fin (p + 1) → Fin ett.rounds := fun a => + sorted.get (Fin.cast sortedLength.symm a) + have sortedPairwise : sorted.Pairwise (· ≤ ·) := by + exact List.pairwise_insertionSort (· ≤ ·) supportClass.toList + have sortedNodup : sorted.Nodup := by + have hperm := List.perm_insertionSort (· ≤ ·) supportClass.toList + exact hperm.nodup_iff.mpr supportClass.nodup_toList + have indicesIncreasing : ∀ a b, a.val < b.val → + (indices a).val < (indices b).val := by + intro a b hab + let aa : Fin sorted.length := Fin.cast sortedLength.symm a + let bb : Fin sorted.length := Fin.cast sortedLength.symm b + have hab' : aa < bb := by + change a.val < b.val + exact hab + have hle : sorted.get aa ≤ sorted.get bb := + sortedPairwise.rel_get_of_lt hab' + have hne : sorted.get aa ≠ sorted.get bb := by + intro heq + have habEq : aa = bb := sortedNodup.get_inj_iff.mp heq + have : a = b := by + apply Fin.ext + simpa [aa, bb] using congrArg Fin.val habEq + subst b + omega + have hlt : sorted.get aa < sorted.get bb := lt_of_le_of_ne hle hne + simpa [indices, aa, bb] using hlt + have indicesEnumerate : ∀ r : Fin ett.rounds, + r ∈ supportClass ↔ ∃ a : Fin (p + 1), indices a = r := by + intro r + constructor + · intro hr + have hrList : r ∈ supportClass.toList := + Finset.mem_toList.mpr hr + have hrSorted : r ∈ sorted := by + have hperm := + List.perm_insertionSort (· ≤ ·) supportClass.toList + exact hperm.mem_iff.mpr hrList + obtain ⟨a, ha⟩ := List.get_of_mem hrSorted + refine ⟨Fin.cast sortedLength a, ?_⟩ + simpa [indices] using ha + · rintro ⟨a, rfl⟩ + have hiSorted : indices a ∈ sorted := by + exact List.get_mem sorted (Fin.cast sortedLength.symm a) + have hiList : indices a ∈ supportClass.toList := by + have hperm := + List.perm_insertionSort (· ≤ ·) supportClass.toList + exact hperm.mem_iff.mp hiSorted + exact Finset.mem_toList.mp hiList + have nextSegment : + ∀ r : Fin ett.rounds, TreeSequenceInitialSegment (ett.series.data.tree r.succ.castSucc) + (ett.series.data.tree r.succ.succ) := by + exact @ExtensionBaseSupportClassEnumeration_nextSegment_239 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett terminalSupport hterminalSupport q w r0 v0 + hv0Final hwFinal + have seriesVertexLater : + ∀ (a b : Fin ett.rounds), a.val ≤ b.val → + ∀ x, x ∈ TreeSequenceVertexSet (ett.series.data.tree a.succ.castSucc) → x ∈ + TreeSequenceVertexSet (ett.series.data.tree b.succ.castSucc) := by + intro a b hab x hxa + induction distance : b.val - a.val using Nat.strong_induction_on + generalizing a b with + | h n ih => + by_cases equal : a.val = b.val + · have : a = b := Fin.ext equal + simpa [this] using hxa + · have stepLe : a.val + 1 ≤ b.val := by omega + let mid : Fin ett.rounds := ⟨a.val + 1, by omega⟩ + have midVal : mid.val = a.val + 1 := rfl + have hxm : x ∈ TreeSequenceVertexSet + (ett.series.data.tree mid.succ.castSucc) := by + have treeEq : mid.succ.castSucc = a.succ.succ := by + apply Fin.ext + simp [mid] + rw [treeEq] + exact TreeSequenceInitialSegmentVertexSetSubset + (nextSegment a) hxa + have hrest := ih (b.val - mid.val) (by omega) mid b (by omega) hxm + (by simp) + exact hrest + have hr0Terminal := (classIff r0).mp hr0Class + have hwCurrent : w ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := + seriesVertexLater r0 q hr0Terminal.1 w + (peVertex r0 hr0Terminal.2.1 hr0Terminal.2.2) + refine ⟨p, indices, hwCurrent, indicesIncreasing, ?_, ?_⟩ + · intro r + simpa [supportClass] using indicesEnumerate r + · intro r + have hclassRange : + r ∈ ExtensionBaseSupportClass ett terminalSupport + hterminalSupport w ↔ + ∃ a : Fin (p + 1), indices a = r := by + simpa [supportClass] using indicesEnumerate r + exact (classIff r).symm.trans hclassRange + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseSupportOrder.lean b/LeanPool/GoldbergSeymour/ExtensionBaseSupportOrder.lean new file mode 100644 index 0000000000..f236493c89 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionBaseSupportOrder.lean @@ -0,0 +1,645 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorVertex + +public import LeanPool.GoldbergSeymour.ExtensionBaseActiveIndices + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Extension Base Support Order + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_segment_105.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (j : Fin (ett.rounds + (1 : ℕ))) (i : Fin + ett.rounds), j = i.succ → TreeSequenceInitialSegment (ett.series.data.tree + i.succ.castSucc) (ett.series.data.tree i.succ.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett j i hji + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero i) hji.symm |>.elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val hji + have heq : ci = i := by apply Fin.ext; simp at hv ⊢; omega + subst ci + exact orderedExtension + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val hji + have heq : ci = i := by apply Fin.ext; simp at hv ⊢; omega + subst ci + exact orderedExtension + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hv := congrArg Fin.val hji + have heq : ci = i := by apply Fin.ext; simp at hv ⊢; omega + subst ci + exact orderedExtension + +private theorem helper_allSegment_165.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : Fin ett.rounds), ( + ∀ (j : Fin (ett.rounds + (1 : ℕ))) (i : Fin ett.rounds), j = i.succ → + TreeSequenceInitialSegment (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree + i.succ.succ)) → ( + ∀ (A B C : TreeSequence G e0), TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → + ∀ (n : ℕ) (i : Fin (ett.rounds + (2 : ℕ))), (↑i : ℕ) + n = ett.rounds → (2 : ℕ) ≤ (↑i : ℕ) → + TreeSequenceInitialSegment (ett.series.data.tree i) (ett.series.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 input T generating ett q segment segmentTrans n + induction n with + | zero => + intro i hi htwo + have heq : i.val = ett.rounds := by omega + have hiq : i = ⟨ett.rounds, by omega⟩ := by apply Fin.ext; exact heq + rw [hiq] + exact ⟨Nat.le_refl _, by intro z; rfl, by intro z; rfl⟩ + | succ n ih => + intro i hi htwo + have hil : i.val < ett.rounds := by omega + let j : Fin ett.rounds := ⟨i.val - 1, by omega⟩ + let middle : Fin (ett.rounds + 1) := ⟨i.val, by omega⟩ + have hj : middle = j.succ := by + apply Fin.ext + change i.val = (i.val - 1) + 1 + omega + have hs0 := segment middle j hj + have hleft : i = j.succ.castSucc := by + apply Fin.ext + change i.val = (i.val - 1) + 1 + omega + have hright : (⟨i.val + 1, by omega⟩ : Fin (ett.rounds + 2)) = + j.succ.succ := by + apply Fin.ext + change i.val + 1 = (i.val - 1) + 2 + omega + have hs : TreeSequenceInitialSegment (ett.series.data.tree i) + (ett.series.data.tree ⟨i.val + 1, by omega⟩) := by + have hleft' := congrArg (fun z : Fin (ett.rounds + 2) => + ett.series.data.tree z) hleft + have hright' := congrArg (fun z : Fin (ett.rounds + 2) => + ett.series.data.tree z) hright + exact hleft'.symm ▸ hright' ▸ hs0 + let next : Fin (ett.rounds + 2) := ⟨i.val + 1, by omega⟩ + have hn : next.val + n = ett.rounds := by + dsimp [next] + omega + exact segmentTrans _ _ _ hs (ih next hn (by omega)) + +private theorem helper_stageInitial_219.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (q : Fin ett.rounds), (↑q : ℕ) + (1 : ℕ) + = ett.rounds → ( + ∀ (j : Fin (ett.rounds + (1 : ℕ))) (i : Fin ett.rounds), j = i.succ → + TreeSequenceInitialSegment (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree + i.succ.succ)) → ( + ∀ (A B C : TreeSequence G e0), TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (n : ℕ) (i : Fin (ett.rounds + (2 : ℕ))), (↑i : ℕ) + n = ett.rounds → (2 : ℕ) ≤ (↑i : ℕ) → + TreeSequenceInitialSegment (ett.series.data.tree i) (ett.series.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ (i : Fin (ett.rounds + (1 : ℕ))), TreeSequenceInitialSegment (ExtendedTashkinovLadderStage + ett i) T := by + classical + intro V E _ _ _ G k e0 input T generating ett q hqTerminal segment segmentTrans allSegment i + refine Fin.lastCases ?_ (fun j => ?_) i + · rw [show ExtendedTashkinovLadderStage ett (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact ⟨Nat.le_refl _, by intro z; rfl, by intro z; rfl⟩ + · rw [show ExtendedTashkinovLadderStage ett j.castSucc = + ett.series.data.tree j.succ.castSucc by + unfold ExtendedTashkinovLadderStage + simp] + by_cases hj : j.val = 0 + · by_cases hone : ett.rounds = 1 + · have hj' : j = ⟨0, by omega⟩ := by apply Fin.ext; omega + have hi' : j.succ.castSucc = ⟨1, by omega⟩ := by + exact Fin.ext (by simp [hj']) + rw [hi'] + simpa [hone] using ett.abovePenultimate + · have htwo : 2 ≤ ett.rounds := by omega + let zero : Fin ett.rounds := ⟨0, by omega⟩ + let one : Fin (ett.rounds + 1) := ⟨1, by omega⟩ + have hseg := segment one zero (by + apply Fin.ext + simp [one, zero]) + have hnext := allSegment (ett.rounds - 2) + (⟨2, by omega⟩ : Fin (ett.rounds + 2)) + (by simp; omega) (by simp) + have hj' : j = ⟨0, by omega⟩ := by apply Fin.ext; exact hj + have hboth := segmentTrans _ _ _ hseg hnext + have hfinal := segmentTrans _ _ _ hboth ett.abovePenultimate + have hidx : (⟨0, by omega⟩ : Fin ett.rounds).succ.castSucc = + zero.castSucc.succ := by + apply Fin.ext + simp [zero] + rw [hj', hidx] + exact hfinal + · have hsum : j.val + 1 + (ett.rounds - (j.val + 1)) = ett.rounds := + Nat.add_sub_of_le (by omega) + have harg : (⟨j.val + 1, by omega⟩ : Fin (ett.rounds + 2)).val + + (ett.rounds - (j.val + 1)) = ett.rounds := by + dsimp + exact hsum + have hseg := allSegment (ett.rounds - (j.val + 1)) + (⟨j.val + 1, by omega⟩ : Fin (ett.rounds + 2)) harg (by omega) + have hsource : ett.series.data.tree j.succ.castSucc = + ett.series.data.tree ⟨j.val + 1, by omega⟩ := by + congr 1 + rw [hsource] + exact segmentTrans _ _ _ hseg ett.abovePenultimate + +private theorem helper_peInfo_729.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ t : Fin ett.rounds), + ett.series.data.kind t.succ = some TashkinovExtensionKind.PE → + ∃ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree t.succ.castSucc) + (TashkinovStoredColors ett.series.data t.castSucc) (ett.series.data.coloring t.castSucc)), + IsProperEdgeColoring G choice.selected ∧ IsOneEdgeUncolored choice.selected e0 ∧ + StableColoring (ett.series.data.tree t.succ.castSucc) (TashkinovStoredColors + ett.series.data t.castSucc) (ett.series.data.coloring t.castSucc) choice.selected ∧ + ett.series.data.chosenVertex t.succ = some choice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett q t ht + have cert := ett.series.certified t.succ + generalize hindex : t.succ = index at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => simp_all + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have bad : (some TashkinovExtensionKind.SE) = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [hindex] using ht) + cases bad + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have bad : (some TashkinovExtensionKind.RE) = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [hindex] using ht) + cases bad + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val hindex + have heq : ci = t := by apply Fin.ext; simp at hv ⊢; omega + subst ci + exact ⟨choice, choice.selectedProper, choice.selectedOneUncolored, + choice.selectedStable, currentVertex⟩ + +private theorem helper_first_778.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (_ : Fin ett.rounds) (_ : ( + ∀ (r a : Fin ett.rounds) (_ : (↑a : ℕ) < (↑r : ℕ)) (sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (_ : StableColoring + (ett.series.data.tree r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc) sigma) (delta : Fin k) (_ : DefectiveColor G sigma + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) delta) (v : V) (_ : + BoundaryColorVertex G sigma (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) + delta v) (_ : ( + ∃ (w : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc)) delta w ∧ TreeVertexOrder (ett.series.data.tree r.succ.castSucc) w v)) + (hvFinal : v ∈ TreeSequenceVertexSet T) (_ : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑a : + ℕ) + (1 : ℕ)) (va : V) (_ : ett.series.data.kind a.succ = some TashkinovExtensionKind.PE ∨ + ett.series.data.kind a.succ = some TashkinovExtensionKind.SE) (_ : + ett.series.data.chosenVertex a.succ = some va), v = va ∨ TreeVertexOrder + (ett.series.data.tree r.succ.castSucc) v va)), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ (n : ℕ) (i : Fin (ett.rounds + (2 : ℕ))) (_ : (↑i : ℕ) + n = ett.rounds) (_ : (2 : ℕ) ≤ (↑i + : ℕ)), TreeSequenceInitialSegment (ett.series.data.tree i) (ett.series.data.tree + (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u v : V) (_ : + TreeVertexOrder A u v), TreeVertexOrder B u v)) (_ : ( + ∀ (t : Fin ett.rounds) (_ : ett.series.data.kind t.succ = some TashkinovExtensionKind.PE), + ∃ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree t.succ.castSucc) + (TashkinovStoredColors ett.series.data t.castSucc) (ett.series.data.coloring t.castSucc)), + IsProperEdgeColoring G choice.selected ∧ IsOneEdgeUncolored choice.selected e0 ∧ + StableColoring (ett.series.data.tree t.succ.castSucc) (TashkinovStoredColors + ett.series.data t.castSucc) (ett.series.data.coloring t.castSucc) choice.selected ∧ + ett.series.data.chosenVertex t.succ = some choice.vertex)) (s t : Fin ett.rounds) (vs vt : + V) (_ : vs ∈ TreeSequenceVertexSet T) (_ : vt ∈ TreeSequenceVertexSet T) (_ : s ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport) (_ : t ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport) (_ : (↑s : ℕ) < (↑t : ℕ)) + (_ : ett.series.data.chosenVertex s.succ = some vs) (_ : ett.series.data.chosenVertex + t.succ = some vt), vt = vs ∨ TreeVertexOrder T vt vs := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q hLowerPartV + this allSegment orderTransfer peInfo s t vs vt hvs hvt hs ht hst hcsv hctv + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] at hs ht + rcases hs with ⟨hsj, hsk, vsv, hsv, hsi⟩ + rcases ht with ⟨htj, htk, vtv, htv, hti⟩ + rcases hsi with ⟨hsvFinal, hsvIndex⟩ + rcases hti with ⟨hvtFinal, hvtIndex⟩ + have hvsv : vsv = vs := Option.some.inj (hsv.symm.trans hcsv) + have hvtv : vtv = vt := Option.some.inj (htv.symm.trans hctv) + subst vtv + have hkind : ett.series.data.kind t.succ = + some TashkinovExtensionKind.PE := htk + rcases peInfo t hkind with ⟨choice, hproper, hone, hstable, hchosen⟩ + have hdeltaData := choice.edgeDefective + rcases hdeltaData with ⟨delta, hdef, hedge⟩ + have hdelta : delta = choice.color := by + have hc := (Finset.mem_filter.mp hedge).2 + exact Option.some.inj (hc.symm.trans choice.edgeColor) + let boundary := BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc)) delta + have hcard : 1 < boundary.card := by + dsimp [boundary] + exact Nat.lt_of_lt_of_le Nat.one_lt_two hdef + rcases Finset.exists_mem_ne hcard choice.edge with ⟨f, hf, hfe⟩ + have hfbound : f ∈ BoundaryEdges G + (TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc)) := + (Finset.mem_filter.mp hf).1 + have hfcolor : choice.selected f = some choice.color := by + have hc := (Finset.mem_filter.mp hf).2 + simpa [hdelta] using hc + simp only [BoundaryEdges, Fin.castSucc_succ, Finset.mem_filter, + Finset.mem_univ, true_and] at hfbound + rcases hfbound with ⟨x, hx, hxo, hxf⟩ + rcases hxf with ⟨hxo, hxf⟩ + have hxfinc : Incident G x f := by + change x ∈ G.ends f + rw [hxf] + simp + have hxboundary : BoundaryColorVertex G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc)) + delta x := by + exact ⟨hx, f, hf, hxfinc⟩ + have hxdef : DefectiveVertex G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc)) x := by + exact ⟨hx, f, ⟨delta, hdef, hf⟩, hxfinc⟩ + have hxorder : x = choice.vertex ∨ + TreeVertexOrder (ett.series.data.tree t.succ.castSucc) x choice.vertex := + choice.maximal choice.selected x hproper hone hstable hxdef + have hxne : x ≠ choice.vertex := by + intro heq + have hadj : AdjacentEdges G choice.edge f := by + exact ⟨choice.vertex, choice.edgeIncident, heq ▸ hxfinc⟩ + have hbad := hproper hfe.symm hadj choice.edgeColor hfcolor + exact hbad + have hxorder' : TreeVertexOrder + (ett.series.data.tree t.succ.castSucc) x choice.vertex := + hxorder.resolve_left hxne + have hvtboundary : BoundaryColorVertex G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc)) + choice.color choice.vertex := by + have hinc : Incident G choice.vertex choice.edge := choice.edgeIncident + exact ⟨choice.vertexDefective.1, choice.edge, by + simpa [hdelta] using hedge, hinc⟩ + have hdefcolor : DefectiveColor G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc)) choice.color := by + simpa [hdelta] using hdef + have hxboundary' : BoundaryColorVertex G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc)) + choice.color x := by + simpa [hdelta] using hxboundary + have hvtchoice : vt = choice.vertex := + Option.some.inj (hctv.symm.trans hchosen) + have hbound : ETTFirstAppearanceIndex ett choice.vertex + (hvtchoice ▸ hvt) ≤ s.val + 1 := by + have hvtFinal' : vt ∈ TreeSequenceVertexSet T := hvtFinal + have hidx : ETTFirstAppearanceIndex ett vt hvtFinal' ≤ s.val + 1 := + hvtIndex.trans hsj + simpa [hvtchoice] using hidx + have hlow := hLowerPartV t s hst choice.selected hproper hone hstable + choice.color hdefcolor choice.vertex hvtboundary + ⟨x, hxboundary', hxorder'⟩ (hvtchoice ▸ hvt) hbound vs (Or.inl hsk) hcsv + rcases hlow with hlow | hlow + · exact Or.inl (hvtchoice.symm ▸ hlow) + · right + have htr : t.val + 1 ≤ ett.rounds := by omega + have hsum : t.val + 1 + (ett.rounds - (t.val + 1)) = ett.rounds := + Nat.add_sub_of_le htr + have segt := allSegment (ett.rounds - (t.val + 1)) + t.succ.castSucc (by simp) (by simp; omega) + exact orderTransfer ett.abovePenultimate vt vs + (orderTransfer segt vt vs (hvtchoice.symm ▸ hlow)) + +private theorem helper_second_875.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (terminalSupport : V) (hterminalSupport : + terminalSupport ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (_ : (↑q : ℕ) + (1 : ℕ) = + ett.rounds) (_ : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) (_ : + ett.series.data.chosenVertex q.succ = some terminalSupport), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), TreeSequenceInitialSegment (ExtendedTashkinovLadderStage + ett i) T)) (_ : ( + ∀ (t : Fin ett.rounds) (_ : ett.series.data.kind t.succ = some TashkinovExtensionKind.PE), + ∃ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree t.succ.castSucc) + (TashkinovStoredColors ett.series.data t.castSucc) (ett.series.data.coloring t.castSucc)), + IsProperEdgeColoring G choice.selected ∧ IsOneEdgeUncolored choice.selected e0 ∧ + StableColoring (ett.series.data.tree t.succ.castSucc) (TashkinovStoredColors + ett.series.data t.castSucc) (ett.series.data.coloring t.castSucc) choice.selected ∧ + ett.series.data.chosenVertex t.succ = some choice.vertex)) (_ : ( + ∀ (s t : Fin ett.rounds) (vs vt : V) (_ : vs ∈ TreeSequenceVertexSet T) (_ : vt ∈ + TreeSequenceVertexSet T) (_ : s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport) (_ : t ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport) (_ : (↑s : ℕ) < (↑t : ℕ)) (_ : ett.series.data.chosenVertex s.succ = + some vs) (_ : ett.series.data.chosenVertex t.succ = some vt), vt = vs ∨ TreeVertexOrder T + vt vs)) (s : Fin ett.rounds) (vs : V) (hvs : vs ∈ TreeSequenceVertexSet T) (_ : s ∈ + ExtensionBaseActiveIndices ett terminalSupport hterminalSupport) (_ : + ett.series.data.chosenVertex s.succ = some vs), ETTFirstAppearanceIndex ett vs hvs = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport ∧ (terminalSupport = vs ∨ + TreeVertexOrder T terminalSupport vs) := by + classical + intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport q hqTerminal + hqKind hqVertex this stageInitial peInfo first s vs hvs hs hchosen + have hsOriginal := hs + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] at hs + rcases hs with ⟨hsj, hsk, vsv, hsv, hsi⟩ + have hvsv : vsv = vs := Option.some.inj (hsv.symm.trans hchosen) + subst vsv + rcases hsi with ⟨hv, hi⟩ + rcases peInfo q hqKind with ⟨qchoice, _, _, _, qchosen⟩ + have hqchoice : terminalSupport = qchoice.vertex := + Option.some.inj (hqVertex.symm.trans qchosen) + have hqstage : terminalSupport ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) := by + exact hqchoice ▸ qchoice.vertexDefective.1 + have qbound : ETTFirstAppearanceIndex ett terminalSupport hterminalSupport ≤ + q.val + 1 := by + unfold ETTFirstAppearanceIndex + dsimp + have hmem : q.castSucc ∈ + (Finset.univ.filter fun i : Fin (ett.rounds + 1) => + terminalSupport ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett i)) := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + simpa [ExtendedTashkinovLadderStage, hqTerminal] using hqstage + have hmin := Finset.min'_le + (Finset.univ.filter fun i : Fin (ett.rounds + 1) => + terminalSupport ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett i)) + q.castSucc hmem + apply Nat.succ_le_succ + have hminval := Fin.le_iff_val_le_val.mp hmin + change _ ≤ q.val at hminval + exact hminval + have qactive : q ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport := by + simp only [ExtensionBaseActiveIndices, exists_and_left, Finset.mem_filter, Finset.mem_univ, + true_and] + refine ⟨qbound, hqKind, terminalSupport, hqVertex, hterminalSupport, ?_⟩ + exact le_rfl + by_cases hsQ : s = q + · subst s + have hvq : vs = terminalSupport := + Option.some.inj (hchosen.symm.trans hqVertex) + subst vs + exact ⟨le_antisymm (by rfl) (by rfl), Or.inl rfl⟩ + have horder := first s q vs terminalSupport hvs hterminalSupport hsOriginal qactive + (by omega) hchosen hqVertex + have hindex : ETTFirstAppearanceIndex ett terminalSupport hterminalSupport ≤ + ETTFirstAppearanceIndex ett vs hvs := by + unfold ETTFirstAppearanceIndex + dsimp + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + vs ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hlast : Fin.last ett.rounds ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett (Fin.last ett.rounds) = T by + simp [ExtendedTashkinovLadderStage, Fin.lastCases_last]] + exact hvs + have hnon : candidates.Nonempty := ⟨Fin.last ett.rounds, hlast⟩ + have hstage : vs ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett (candidates.min' hnon)) := by + exact (Finset.mem_filter.mp + (Finset.min'_mem candidates hnon)).2 + have hseg := stageInitial (candidates.min' hnon) + have htermstage : terminalSupport ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett (candidates.min' hnon)) := by + rcases horder with heq | horder + · simpa [heq] using hstage + · rcases horder with ⟨a, b, ha, hb, hab⟩ + simp only [TreeSequenceVertexSet] at hstage + rcases Finset.mem_image.mp hstage with ⟨c, hc, hcv⟩ + rcases hseg with ⟨hlen, hvertices, hedges⟩ + have hveq : T.vertex b = T.vertex + (Fin.castLE (Nat.succ_le_succ hlen) c) := + hb.trans (hcv.symm.trans (hvertices c).symm) + have heq : b = Fin.castLE (Nat.succ_le_succ hlen) c := + T.vertex_injective hveq + have hac : a.val < c.val := by simpa [heq] using hab + simp only [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + let aa : Fin ((ExtendedTashkinovLadderStage ett (candidates.min' hnon)).length + 1) := + ⟨a.val, by omega⟩ + have haa : Fin.castLE (Nat.succ_le_succ hlen) aa = a := by + apply Fin.ext + rfl + exact ⟨aa, Finset.mem_univ _, + (ha.symm.trans (haa ▸ hvertices aa)).symm⟩ + let terminalCandidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + terminalSupport ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett i) + have htermMem : candidates.min' hnon ∈ terminalCandidates := by + simp only [terminalCandidates, Finset.mem_filter, Finset.mem_univ, true_and] + exact htermstage + change (terminalCandidates.min' _).val + 1 ≤ + (candidates.min' hnon).val + 1 + apply Nat.succ_le_succ + exact_mod_cast (Finset.min'_le terminalCandidates + (candidates.min' hnon) htermMem) + constructor + · omega + · exact horder + +theorem ExtensionBaseSupportOrder {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (terminalSupport : V) + (hterminalSupport : terminalSupport ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (hqTerminal : q.val + 1 = ett.rounds) + (hqKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE) + (hqVertex : ett.series.data.chosenVertex q.succ = some terminalSupport) + (hLowerPartV : ∀ (r a : Fin ett.rounds), a.val < r.val → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc) sigma → + ∀ delta : Fin k, + DefectiveColor G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta → + ∀ v : V, + BoundaryColorVertex G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta v → + (∃ w : V, BoundaryColorVertex G sigma + (TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc)) delta w ∧ + TreeVertexOrder (ett.series.data.tree r.succ.castSucc) w v) → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T, + ETTFirstAppearanceIndex ett v hvFinal ≤ a.val + 1 → + ∀ va : V, + (ett.series.data.kind a.succ = + some TashkinovExtensionKind.PE ∨ + ett.series.data.kind a.succ = + some TashkinovExtensionKind.SE) → + ett.series.data.chosenVertex a.succ = some va → + v = va ∨ + TreeVertexOrder + (ett.series.data.tree r.succ.castSucc) v va) : + (∀ (s t : Fin ett.rounds) (vs vt : V) (_ : vs ∈ TreeSequenceVertexSet T) + (_ : vt ∈ TreeSequenceVertexSet T), + s ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + s.val < t.val → + ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → + vt = vs ∨ TreeVertexOrder T vt vs) ∧ + (∀ (s : Fin ett.rounds) (vs : V) (hvsFinal : vs ∈ TreeSequenceVertexSet T), + s ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex s.succ = some vs → + ETTFirstAppearanceIndex ett vs hvsFinal = + ETTFirstAppearanceIndex ett terminalSupport hterminalSupport ∧ + (terminalSupport = vs ∨ TreeVertexOrder T terminalSupport vs)) ∧ + ∀ (s t : Fin ett.rounds) (vs vt : V) (_ : vs ∈ TreeSequenceVertexSet T) + (_ : vt ∈ TreeSequenceVertexSet T), + s ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex s.succ = some vs → + ett.series.data.chosenVertex t.succ = some vt → + vs ≠ vt → TreeVertexOrder T vs vt → t.val < s.val := by + classical + let : DecidableEq V := Classical.decEq V + have segment := + @helper_segment_105 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett + have segmentTrans : ∀ (A B C : TreeSequence G e0), + TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C → + TreeSequenceInitialSegment A C := by + intros + apply TreeSequenceInitialSegment.trans <;> assumption + have allSegment := + @helper_allSegment_165 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett q segment segmentTrans + have orderTransfer : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ u v, TreeVertexOrder A u v → + TreeVertexOrder B u v := by + intro A B hab u v huv + rcases hab with ⟨hlen, hvertices, hedges⟩ + rcases huv with ⟨i, j, hi, hj, hij⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, + Fin.castLE (Nat.succ_le_succ hlen) j, ?_, ?_, ?_⟩ + · exact (hvertices i).trans hi + · exact (hvertices j).trans hj + · exact hij + have stageInitial := + @helper_stageInitial_219 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett q hqTerminal segment segmentTrans allSegment + have peInfo := + @helper_peInfo_729 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett q + have first := + @helper_first_778 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport q hLowerPartV allSegment orderTransfer + peInfo + have second := + @helper_second_875 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett terminalSupport hterminalSupport q hqTerminal hqKind hqVertex stageInitial + peInfo first + have third : + ∀ (s t : Fin ett.rounds) (vs vt : V), vs ∈ TreeSequenceVertexSet T → vt ∈ + TreeSequenceVertexSet T → s ∈ ExtensionBaseActiveIndices ett terminalSupport + hterminalSupport → t ∈ ExtensionBaseActiveIndices ett terminalSupport hterminalSupport → + ett.series.data.chosenVertex s.succ = some vs → ett.series.data.chosenVertex t.succ = some + vt → vs ≠ vt → TreeVertexOrder T vs vt → t.val < s.val := by + intro s t vs vt hvs hvt hs ht hcsv hctv hne horder + by_contra hnot + have hstne : s ≠ t := by + intro heq + subst t + exact hne (Option.some.inj (hcsv.symm.trans hctv)) + have hst : s.val < t.val := by omega + have hcontra := first s t vs vt hvs hvt hs ht hst hcsv hctv + rcases hcontra with heq | hback + · exact hne heq.symm + · rcases horder with ⟨i, j, hi, hj, hij⟩ + rcases hback with ⟨a, b, ha, hb, hab⟩ + have hieq : i = b := T.vertex_injective (hi.trans hb.symm) + have jeq : j = a := T.vertex_injective (hj.trans ha.symm) + have hiab : b.val < a.val := by simpa [hieq, jeq] using hij + have hba : a.val < b.val := by simpa [hieq, jeq] using hab + omega + exact ⟨first, second, third⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionRules.lean b/LeanPool/GoldbergSeymour/ExtensionRules.lean new file mode 100644 index 0000000000..eddb350e24 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionRules.lean @@ -0,0 +1,223 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveEdge +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtensionRulesEarlierIndices +public import LeanPool.GoldbergSeymour.ExtensionRulesPEFirstAppearanceBound +public import LeanPool.GoldbergSeymour.ExtensionRulesTerminalEarlierAppearance +public import LeanPool.GoldbergSeymour.ExtensionRulesTerminalLastAppearance +public import LeanPool.GoldbergSeymour.ExtensionRulesTerminalStoredDisjoint +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure +public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors +public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeVerticesBefore +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion + +public import LeanPool.GoldbergSeymour.LowerRoundProperties + +/-! +# Extension Rules + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionRules {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hpositive : 0 < ett.rounds) + (hlower : ∀ {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input T' generating'), + 0 < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (open scoped Classical in LowerRoundProperties lower)) : + (∀ (q : Fin ett.rounds) (v : V), + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T, + ∀ j : Fin (ett.rounds + 1), + ETTFirstAppearanceIndex ett v hvFinal = j.val + 1 → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T v hvFinal + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma ∧ + (0 < j.val → + StableColoring (ett.series.data.tree j.castSucc) + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin ett.rounds) (vq vr : V), + q ≠ r → + vq ≠ vr → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.kind r.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some vq → + ett.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T) (hvr : vr ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett vq hvq = ETTFirstAppearanceIndex ett vr hvr → + Disjoint (ett.series.data.stored q.succ) (ett.series.data.stored r.succ) := by + classical + have hLowerOne : + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), 0 < lower.rounds → lower.rounds < + ett.rounds → MaximumProperty lower → ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T') := by + intro T' generating' lower hp hlt hmax + exact (hlower lower hp hlt hmax).1 + have hLowerTwo : + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), 0 < lower.rounds → lower.rounds < + ett.rounds → MaximumProperty lower → ( + let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tnext : TreeSequence G e0 := lower.series.data.tree (Fin.last (lower.rounds + 1)) + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ alpha beta : Fin k, (alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma + Tnext) → TreeInterchangeable G Tnext sigma alpha beta) := by + intro T' generating' lower hp hlt hmax + exact (hlower lower hp hlt hmax).2.1 + have hLowerThree : + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), 0 < lower.rounds → lower.rounds < + ett.rounds → MaximumProperty lower → (( + ∀ (q : Fin lower.rounds) (v : V), lower.series.data.kind q.succ = some + TashkinovExtensionKind.PE → lower.series.data.chosenVertex q.succ = some v → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T', + ∀ j : Fin (lower.rounds + 1), ETTFirstAppearanceIndex lower v hvFinal = j.val + 1 → + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring (lower.series.data.tree q.succ.castSucc) (TashkinovStoredColors + lower.series.data q.succ) (lower.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma ∧ (0 < j.val → StableColoring (lower.series.data.tree + j.castSucc) (TashkinovStoredColors lower.series.data j) (lower.series.data.coloring j) + sigma)) ∧ + ∀ (q r : Fin lower.rounds) (vq vr : V), q ≠ r → vq ≠ vr → lower.series.data.kind q.succ = some + TashkinovExtensionKind.PE → lower.series.data.kind r.succ = some TashkinovExtensionKind.PE + → lower.series.data.chosenVertex q.succ = some vq → lower.series.data.chosenVertex r.succ + = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex lower vq hvq = ETTFirstAppearanceIndex lower vr hvr → Disjoint + (lower.series.data.stored q.succ) (lower.series.data.stored r.succ)) := by + intro T' generating' lower hp hlt hmax + exact (hlower lower hp hlt hmax).2.2.1 + have hLowerFive : + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), 0 < lower.rounds → lower.rounds < + ett.rounds → MaximumProperty lower → ( + let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → ( + ∃ w, BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn w v) + → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin lower.rounds) (vi : V), + (lower.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ lower.series.data.kind + q.succ = some TashkinovExtensionKind.SE) → lower.series.data.chosenVertex q.succ = some vi + → ETTFirstAppearanceIndex lower v hvFinal ≤ q.val + 1 → v = vi ∨ TreeVertexOrder T' v vi) + := by + intro T' generating' lower hp hlt hmax + exact (hlower lower hp hlt hmax).2.2.2.2.1 + have earlier := ExtensionRulesEarlierIndices G k e0 input T generating ett + hMP hpositive hLowerThree + constructor + · intro q v hkind hvertex hvFinal j hfirst sigma hproper hone hstable + by_cases hq : q.succ = Fin.last ett.rounds + · have hbound := ExtensionRulesPEFirstAppearanceBound G k e0 + input T generating ett q v hkind hvertex hvFinal + have hterminal : q.val + 1 = ett.rounds := by + have := congrArg Fin.val hq + simpa using this + rw [hq] at hkind hvertex hstable + by_cases hj : j.val + 1 = ett.rounds + · exact ExtensionRulesTerminalLastAppearance G k e0 input T generating + ett hMP hpositive v hkind hvertex hvFinal j hfirst hj sigma hproper + hone hstable + · apply ExtensionRulesTerminalEarlierAppearance G k e0 input T generating + ett hMP hpositive hLowerFive v hkind hvertex hvFinal j hfirst + (by omega) sigma hproper hone hstable + · exact earlier.1 q v hq hkind hvertex hvFinal j hfirst sigma hproper + hone hstable + · intro q r vq vr hqr hvqr hkindq hkindr hvertexq hvertexr hvq hvr hfirst + by_cases hq : q.succ = Fin.last ett.rounds + · rw [hq] at hkindq hvertexq ⊢ + exact ExtensionRulesTerminalStoredDisjoint G k e0 input T generating ett + hMP hpositive hLowerOne hLowerTwo r vq vr (by + intro hr + apply hqr + apply Fin.succ_injective + exact hq.trans hr.symm) hvqr hkindq hkindr hvertexq hvertexr hvq hvr + hfirst + · by_cases hr : r.succ = Fin.last ett.rounds + · rw [hr] at hkindr hvertexr ⊢ + exact (ExtensionRulesTerminalStoredDisjoint G k e0 input T generating + ett hMP hpositive hLowerOne hLowerTwo q vr vq hq hvqr.symm hkindr hkindq + hvertexr hvertexq hvr hvq hfirst.symm).symm + · exact earlier.2 q r vq vr hq hr hqr hvqr hkindq hkindr hvertexq + hvertexr hvq hvr hfirst + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesEarlierIndices.lean b/LeanPool/GoldbergSeymour/ExtensionRulesEarlierIndices.lean new file mode 100644 index 0000000000..ce25d69f69 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionRulesEarlierIndices.lean @@ -0,0 +1,797 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction + +public import LeanPool.GoldbergSeymour.ExtensionRulesPEFirstAppearanceBound + +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Extension Rules Earlier Indices + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_stageToStage_147.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), ( + ∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A A) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + Decidable.byContradiction fun (a_1 : ¬a < ett.rounds + (2 : ℕ)) => + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, Decidable.byContradiction fun (a_1 + : ¬b < ett.rounds + (2 : ℕ)) => + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 input T generating ett segmentRefl segmentTrans stepSegment a b ha hab hb + have chain : ∀ (d : ℕ) (_hd : a + d ≤ b), + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) + (ett.series.data.tree ⟨a + d, by omega⟩) := by + intro d hd + induction d with + | zero => simpa using segmentRefl (ett.series.data.tree ⟨a, by omega⟩) + | succ d ih => + have hprev := ih (by omega) + have had : a + d < ett.rounds + 1 := by omega + let idx : Fin (ett.rounds + 1) := ⟨a + d, had⟩ + have hidxPositive : 0 < idx.val := by + dsimp [idx] + omega + have hone := stepSegment idx hidxPositive + have hone' : TreeSequenceInitialSegment + (ett.series.data.tree ⟨a + d, by omega⟩) + (ett.series.data.tree ⟨a + (d + 1), by omega⟩) := by + simpa [idx, Nat.add_assoc] using hone + exact segmentTrans hprev hone' + have hchain := chain (b - a) (by omega) + have hend : + (⟨a + (b - a), by omega⟩ : Fin (ett.rounds + 2)) = + ⟨b, by omega⟩ := by + apply Fin.ext + simp + omega + rw [hend] at hchain + exact hchain + +private theorem helper_supportInFollowingTree_188.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), + let _ : DecidableEq V := Classical.decEq V; + ∀ (q : Fin ett.rounds) (v : V), ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett this q v hkind hvertex + generalize hslot : q.succ = slot + cases ett.series.certified slot with + | initial => exact (Fin.succ_ne_zero q hslot).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [hslot] using hkind) + cases hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [hslot] using hkind) + cases hbad + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + simpa using (congrArg Fin.val hslot).symm + subst i + have hvchoice : choice.vertex = v := + Option.some.inj (currentVertex.symm.trans (by simpa [hslot] using hvertex)) + apply TreeSequenceInitialSegmentVertexSetSubset orderedExtension + simpa [hvchoice] using choice.vertexDefective.1 + +private theorem helper_ladderStageEq_229.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input T' + generating') (s : ℕ) (hs : lower.rounds = s) (hsn : s < ett.rounds), T' = + ett.series.data.tree (⟨s + (1 : ℕ), Decidable.byContradiction fun (a : ¬s + (1 : ℕ) < + ett.rounds + (2 : ℕ)) => by omega⟩ : Fin (ett.rounds + (2 : ℕ))) → (∀ (i : Fin + (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree (Fin.castLE + (Decidable.byContradiction fun (a : ¬lower.rounds + (2 : ℕ) ≤ ett.rounds + (2 : ℕ)) => by + omega) i)) → ∀ (i : Fin (lower.rounds + (1 : ℕ))), ExtendedTashkinovLadderStage lower i = + ExtendedTashkinovLadderStage ett (⟨(↑i : ℕ), Decidable.byContradiction fun (a : ¬(↑i : ℕ) + < ett.rounds + (1 : ℕ)) => by omega⟩ : Fin (ett.rounds + (1 : ℕ))) := by + classical + intro V E _ _ _ G k e0 input T generating ett T' generating' lower s hs hsn hdisplay htree i + refine Fin.lastCases ?_ (fun a => ?_) i + · have hdisplay' : T' = ett.series.data.tree + ⟨lower.rounds + 1, by omega⟩ := by + simpa [hs] using hdisplay + rw [show ExtendedTashkinovLadderStage lower (Fin.last lower.rounds) = T' by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + have hidx : (⟨(Fin.last lower.rounds).val, by omega⟩ : + Fin (ett.rounds + 1)) = + (⟨lower.rounds, by omega⟩ : Fin ett.rounds).castSucc := by + apply Fin.ext + simp + rw [hidx] + rw [show ExtendedTashkinovLadderStage ett + (⟨lower.rounds, by omega⟩ : Fin ett.rounds).castSucc = + ett.series.data.tree + (⟨lower.rounds, by omega⟩ : Fin ett.rounds).succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T + (fun j => ett.series.data.tree j.succ.castSucc) + (⟨lower.rounds, by omega⟩ : Fin ett.rounds)] + exact hdisplay'.trans (congrArg ett.series.data.tree (by + apply Fin.ext + simp)) + · rw [show ExtendedTashkinovLadderStage lower a.castSucc = + lower.series.data.tree a.succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc lower.rounds + (fun _ : Fin (lower.rounds + 1) => TreeSequence G e0) T' + (fun j => lower.series.data.tree j.succ.castSucc) a] + have hidx : (⟨(a.castSucc).val, by omega⟩ : Fin (ett.rounds + 1)) = + (⟨a.val, by omega⟩ : Fin ett.rounds).castSucc := by + apply Fin.ext + rfl + rw [hidx] + rw [show ExtendedTashkinovLadderStage ett + (⟨a.val, by omega⟩ : Fin ett.rounds).castSucc = + ett.series.data.tree + (⟨a.val, by omega⟩ : Fin ett.rounds).succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T + (fun j => ett.series.data.tree j.succ.castSucc) + (⟨a.val, by omega⟩ : Fin ett.rounds)] + exact (htree a.succ.castSucc).trans (congrArg ett.series.data.tree (by + apply Fin.ext + rfl)) + +private theorem helper_firstAppearanceEq_290.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), (0 : ℕ) < ett.rounds → + let _ : DecidableEq V := Classical.decEq V; ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating') (s : ℕ) (hs : lower.rounds = s) (hsn : + s < ett.rounds), T' = ett.series.data.tree (⟨s + (1 : ℕ), Decidable.byContradiction fun (a + : ¬s + (1 : ℕ) < ett.rounds + (2 : ℕ)) => + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (2 : ℕ) ≤ ett.rounds + (2 + : ℕ)) => + by omega + ) i)) → + ∀ (i : Fin (lower.rounds + (1 : ℕ))), ExtendedTashkinovLadderStage lower i = + ExtendedTashkinovLadderStage ett (⟨(↑i : ℕ), Decidable.byContradiction fun (a : ¬(↑i : ℕ) + < ett.rounds + (1 : ℕ)) => + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) → + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating') (s : ℕ) (hs : lower.rounds = s) (hsn : + s < ett.rounds), T' = ett.series.data.tree (⟨s + (1 : ℕ), Decidable.byContradiction fun (a + : ¬s + (1 : ℕ) < ett.rounds + (2 : ℕ)) => + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (2 : ℕ) ≤ ett.rounds + (2 + : ℕ)) => + by omega + ) i)) → + ∀ (v : V) (hvLower : v ∈ TreeSequenceVertexSet T') (hvFinal : v ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett v hvFinal ≤ s → ETTFirstAppearanceIndex lower v hvLower = + ETTFirstAppearanceIndex ett v hvFinal := by + classical + intro V E _ _ _ G k e0 input T generating ett _ this ladderStageEq T' generating' lower s hs + hsn hdisplay htree v hvLower hvFinal hbound + have hladders := ladderStageEq lower s hs hsn hdisplay htree + unfold ETTFirstAppearanceIndex at hbound ⊢ + dsimp at hbound ⊢ + let lowerCandidates : Finset (Fin (lower.rounds + 1)) := + Finset.univ.filter fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage lower i) + let fullCandidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hlowerNonempty : lowerCandidates.Nonempty := by + refine ⟨Fin.last lower.rounds, ?_⟩ + simp only [lowerCandidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage lower (Fin.last lower.rounds) = T' by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hvLower + have hfullNonempty : fullCandidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [fullCandidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hvFinal + let ml := lowerCandidates.min' hlowerNonempty + let mf := fullCandidates.min' hfullNonempty + have hmfBound : mf.val < lower.rounds + 1 := by + have hb : mf.val + 1 ≤ s := by + dsimp [mf] + convert hbound using 1 + omega + let mfLower : Fin (lower.rounds + 1) := ⟨mf.val, hmfBound⟩ + have hmfMem : mfLower ∈ lowerCandidates := by + simp only [lowerCandidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [hladders mfLower] + have hmem := Finset.min'_mem fullCandidates hfullNonempty + simpa [fullCandidates, mfLower] using hmem + have hmlMemFull : (⟨ml.val, by omega⟩ : Fin (ett.rounds + 1)) ∈ + fullCandidates := by + simp only [fullCandidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [← hladders ml] + exact (Finset.mem_filter.mp (Finset.min'_mem lowerCandidates + hlowerNonempty)).2 + have hleOne := Finset.min'_le lowerCandidates mfLower hmfMem + have hleTwo := Finset.min'_le fullCandidates + (⟨ml.val, by omega⟩ : Fin (ett.rounds + 1)) hmlMemFull + have hvals : ml.val = mf.val := by + apply le_antisymm + · exact Fin.le_iff_val_le_val.mp hleOne + · exact Fin.le_iff_val_le_val.mp hleTwo + change (lowerCandidates.min' _).val + 1 = + (fullCandidates.min' _).val + 1 + simpa [ml, mf] using congrArg (fun x : ℕ => x + 1) hvals + +private theorem helper_beforeEqOfSegment_356.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (_ : ExtendedTashkinovTree G k + e0 input T generating), + let _ : DecidableEq V := Classical.decEq V; + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → + ∀ (v : V) (hvA : v ∈ TreeSequenceVertexSet A) (hvB : v ∈ TreeSequenceVertexSet B), + TreeVerticesBefore A v hvA = TreeVerticesBefore B v hvB := by + classical + intro V E _ _ _ G k e0 input T generating ett this A B hAB v hvA hvB + rcases hAB with ⟨hlen, hvertices, hedges⟩ + apply Finset.ext + intro w + constructor + · intro hw + rcases Finset.mem_filter.mp hw with ⟨hwA, iw, iv, hiw, hiv, hlt⟩ + apply Finset.mem_filter.mpr + refine ⟨TreeSequenceInitialSegmentVertexSetSubset + ⟨hlen, hvertices, hedges⟩ hwA, ?_⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) iw, + Fin.castLE (Nat.succ_le_succ hlen) iv, + (hvertices iw).trans hiw, (hvertices iv).trans hiv, hlt⟩ + · intro hw + rcases Finset.mem_filter.mp hw with ⟨hwB, iw, iv, hiw, hiv, hlt⟩ + rcases Finset.mem_image.mp hvA with ⟨av, havU, hav⟩ + let avB := Fin.castLE (Nat.succ_le_succ hlen) av + have hivav : iv = avB := by + apply B.vertex_injective + exact hiv.trans ((hvertices av).trans hav).symm + have hiBound : iw.val < A.length + 1 := by + rw [hivav] at hlt + simp [avB] at hlt + omega + let iwA : Fin (A.length + 1) := ⟨iw.val, hiBound⟩ + have hiwCast : Fin.castLE (Nat.succ_le_succ hlen) iwA = iw := by + apply Fin.ext + rfl + have hwA : w ∈ TreeSequenceVertexSet A := by + apply Finset.mem_image.mpr + refine ⟨iwA, Finset.mem_univ _, ?_⟩ + exact (hvertices iwA).symm.trans (by simpa [hiwCast] using hiw) + apply Finset.mem_filter.mpr + refine ⟨hwA, iwA, av, ?_, hav, ?_⟩ + · exact (hvertices iwA).symm.trans (by simpa [hiwCast] using hiw) + · rw [hivav] at hlt + simpa [iwA, avB] using hlt + +private theorem helper_branch_399.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), (0 : ℕ) < lower.rounds → lower.rounds + < ett.rounds → MaximumProperty lower → ( + ∀ (q : Fin lower.rounds) (v : V), lower.series.data.kind q.succ = some + TashkinovExtensionKind.PE → lower.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (j : Fin (lower.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex lower v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (lower.series.data.tree q.succ.castSucc) (TashkinovStoredColors + lower.series.data q.succ) (lower.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (lower.series.data.tree j.castSucc) (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin lower.rounds) (vq vr : V), q ≠ r → vq ≠ vr → lower.series.data.kind q.succ = some + TashkinovExtensionKind.PE → lower.series.data.kind r.succ = some TashkinovExtensionKind.PE + → lower.series.data.chosenVertex q.succ = some vq → lower.series.data.chosenVertex r.succ + = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex lower vq hvq = ETTFirstAppearanceIndex lower vr hvr → Disjoint + (lower.series.data.stored q.succ) (lower.series.data.stored r.succ)) → + let _ : DecidableEq V := Classical.decEq V; ( + ∀ (a : ℕ), (1 : ℕ) ≤ a → + ∀ (_hround : a ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + Decidable.byContradiction fun (a_1 : ¬a < ett.rounds + (2 : ℕ)) => + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) T) → ( + ∀ (q : Fin ett.rounds) (v : V), ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.succ)) → ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating') (s : ℕ) (hs : lower.rounds = s) (hsn : + s < ett.rounds), T' = ett.series.data.tree (⟨s + (1 : ℕ), Decidable.byContradiction fun (a + : ¬s + (1 : ℕ) < ett.rounds + (2 : ℕ)) => + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (2 : ℕ) ≤ ett.rounds + (2 + : ℕ)) => + by + omega + ) i)) → + ∀ (v : V) (hvLower : v ∈ TreeSequenceVertexSet T') (hvFinal : v ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett v hvFinal ≤ s → ETTFirstAppearanceIndex lower v hvLower = + ETTFirstAppearanceIndex ett v hvFinal) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → + ∀ (v : V) (hvA : v ∈ TreeSequenceVertexSet A) (hvB : v ∈ TreeSequenceVertexSet B), + TreeVerticesBefore A v hvA = TreeVerticesBefore B v hvB) → + ∀ (q : Fin ett.rounds) (v : V), q.succ ≠ Fin.last ett.rounds → ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE → ett.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin (ett.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex ett v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (ett.series.data.tree j.castSucc) (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hLowerThree this stageToT + supportInFollowingTree firstAppearanceEq beforeEqOfSegment q v hqNotLast hkind hvertex + hvFinal j hfirst sigma hproper hone hstable + let s := q.val + 1 + have hsPositive : 1 ≤ s := by simp [s] + have hsBefore : s < ett.rounds := by + have hle : s ≤ ett.rounds := by omega + have hne : s ≠ ett.rounds := by + intro heq + apply hqNotLast + apply Fin.ext + simpa [s] using heq + omega + obtain ⟨lower, hr, hmax, htree, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP s + hsPositive hsBefore + have hsupportFull := supportInFollowingTree q v hkind hvertex + have hvLower : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨s + 1, by omega⟩) := by + have hidx : q.succ.succ = + (⟨s + 1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp [s] + simpa [hidx] using hsupportFull + have hbound := ExtensionRulesPEFirstAppearanceBound G k e0 input T + generating ett q v hkind hvertex hvFinal + have hfirstEq := firstAppearanceEq lower s hr hsBefore rfl htree v + hvLower hvFinal hbound + let qLower : Fin lower.rounds := ⟨q.val, by omega⟩ + let jLower : Fin (lower.rounds + 1) := ⟨j.val, by omega⟩ + have hqSlot : Fin.castLE (by omega) qLower.succ = q.succ := by + apply Fin.ext + rfl + have hjSlot : Fin.castLE (by omega) jLower = j := by + apply Fin.ext + rfl + have hkindLower : lower.series.data.kind qLower.succ = + some TashkinovExtensionKind.PE := by + rw [(hdata qLower.succ).2.2.2.1, hqSlot] + exact hkind + have hvertexLower : lower.series.data.chosenVertex qLower.succ = some v := by + rw [(hdata qLower.succ).2.2.2.2.1, hqSlot] + exact hvertex + have hfirstLower : ETTFirstAppearanceIndex lower v hvLower = + jLower.val + 1 := by + rw [hfirstEq, hfirst] + have hstableLower : StableColoring + (lower.series.data.tree qLower.succ.castSucc) + (TashkinovStoredColors lower.series.data qLower.succ) + (lower.series.data.coloring qLower.succ) sigma := by + have htreeSlot := htree qLower.succ.castSucc + have htreeIndex : Fin.castLE (by omega) qLower.succ.castSucc = + q.succ.castSucc := by + apply Fin.ext + rfl + have hcolor := (hdata qLower.succ).1 + have hstored := (hdata qLower.succ).2.2.2.2.2.2.2.2.1 + rw [htreeSlot, htreeIndex, hcolor, hstored, hqSlot] + exact hstable + have hlower := hLowerThree lower (by omega) (by omega) hmax + have hresult := hlower.1 qLower v hkindLower hvertexLower hvLower + jLower hfirstLower sigma hproper hone hstableLower + have hdisplayToT : TreeSequenceInitialSegment + (ett.series.data.tree ⟨s + 1, by omega⟩) T := + stageToT (s + 1) (by omega) (by omega) + have hbefore := beforeEqOfSegment hdisplayToT v hvLower hvFinal + have hjColor := (hdata jLower).1 + have hjStored := (hdata jLower).2.2.2.2.2.2.2.2.1 + have hbeforeFinal : StableColoringBeforeVertex T v hvFinal + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma := by + rw [← hjSlot, ← hjColor, ← hjStored] + unfold StableColoringBeforeVertex at hresult ⊢ + simpa [hbefore] using hresult.1 + refine ⟨hbeforeFinal, ?_⟩ + intro hjPositive + have hjTree := htree jLower.castSucc + have hjTreeSlot : Fin.castLE (by omega) jLower.castSucc = j.castSucc := by + apply Fin.ext + rfl + have hjResult := hresult.2 (by simpa [jLower] using hjPositive) + rw [hjTree, hjTreeSlot, hjColor, hjStored, hjSlot] at hjResult + exact hjResult + +private theorem helper_branch_480.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), (0 : ℕ) < lower.rounds → lower.rounds + < ett.rounds → MaximumProperty lower → ( + ∀ (q : Fin lower.rounds) (v : V), lower.series.data.kind q.succ = some + TashkinovExtensionKind.PE → lower.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (j : Fin (lower.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex lower v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (lower.series.data.tree q.succ.castSucc) (TashkinovStoredColors + lower.series.data q.succ) (lower.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (lower.series.data.tree j.castSucc) (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin lower.rounds) (vq vr : V), q ≠ r → vq ≠ vr → lower.series.data.kind q.succ = some + TashkinovExtensionKind.PE → lower.series.data.kind r.succ = some TashkinovExtensionKind.PE + → lower.series.data.chosenVertex q.succ = some vq → lower.series.data.chosenVertex r.succ + = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex lower vq hvq = ETTFirstAppearanceIndex lower vr hvr → Disjoint + (lower.series.data.stored q.succ) (lower.series.data.stored r.succ)) → + let _ : DecidableEq V := Classical.decEq V; ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + Decidable.byContradiction fun (a_1 : ¬a < ett.rounds + (2 : ℕ)) => + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, Decidable.byContradiction fun (a_1 + : ¬b < ett.rounds + (2 : ℕ)) => + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → ( + ∀ (q : Fin ett.rounds) (v : V), ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.succ)) → ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating') (s : ℕ) (hs : lower.rounds = s) (hsn : + s < ett.rounds), T' = ett.series.data.tree (⟨s + (1 : ℕ), Decidable.byContradiction fun (a + : ¬s + (1 : ℕ) < ett.rounds + (2 : ℕ)) => + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (2 : ℕ) ≤ ett.rounds + (2 + : ℕ)) => + by + omega + ) i)) → + ∀ (v : V) (hvLower : v ∈ TreeSequenceVertexSet T') (hvFinal : v ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett v hvFinal ≤ s → ETTFirstAppearanceIndex lower v hvLower = + ETTFirstAppearanceIndex ett v hvFinal) → + ∀ (q r : Fin ett.rounds) (vq vr : V), q.succ ≠ Fin.last ett.rounds → r.succ ≠ Fin.last + ett.rounds → q ≠ r → vq ≠ vr → ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ett.series.data.kind r.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some vq → ett.series.data.chosenVertex r.succ = some + vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T) (hvr : vr ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett vq hvq = ETTFirstAppearanceIndex ett vr hvr → Disjoint + (ett.series.data.stored q.succ) (ett.series.data.stored r.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hLowerThree this stageToStage + supportInFollowingTree firstAppearanceEq q r vq vr hqNotLast hrNotLast hqr hvqr hqKind + hrKind hqVertex hrVertex hvq hvr hfirst + let s := max (q.val + 1) (r.val + 1) + have hsPositive : 1 ≤ s := by simp [s] + have hqBefore : q.val + 1 < ett.rounds := by + have hle : q.val + 1 ≤ ett.rounds := by omega + have hne : q.val + 1 ≠ ett.rounds := by + intro heq + apply hqNotLast + apply Fin.ext + simpa using heq + omega + have hrBefore : r.val + 1 < ett.rounds := by + have hle : r.val + 1 ≤ ett.rounds := by omega + have hne : r.val + 1 ≠ ett.rounds := by + intro heq + apply hrNotLast + apply Fin.ext + simpa using heq + omega + have hsBefore : s < ett.rounds := by simp [s]; omega + obtain ⟨lower, hround, hmax, htree, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP s + hsPositive hsBefore + have hvqFull : vq ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨s + 1, by omega⟩) := by + have hv0 := supportInFollowingTree q vq hqKind hqVertex + have hseg : TreeSequenceInitialSegment + (ett.series.data.tree ⟨q.val + 2, by omega⟩) + (ett.series.data.tree ⟨s + 1, by omega⟩) := by + exact stageToStage (q.val + 2) (s + 1) (by omega) (by + simp [s]) (by omega) + apply TreeSequenceInitialSegmentVertexSetSubset hseg + have hidx : q.succ.succ = + (⟨q.val + 2, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + simpa [hidx] using hv0 + have hvrFull : vr ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨s + 1, by omega⟩) := by + have hv0 := supportInFollowingTree r vr hrKind hrVertex + have hseg : TreeSequenceInitialSegment + (ett.series.data.tree ⟨r.val + 2, by omega⟩) + (ett.series.data.tree ⟨s + 1, by omega⟩) := by + exact stageToStage (r.val + 2) (s + 1) (by omega) (by + simp [s]) (by omega) + apply TreeSequenceInitialSegmentVertexSetSubset hseg + have hidx : r.succ.succ = + (⟨r.val + 2, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + simpa [hidx] using hv0 + have hqBound := ExtensionRulesPEFirstAppearanceBound G k e0 input T + generating ett q vq hqKind hqVertex hvq + have hrBound := ExtensionRulesPEFirstAppearanceBound G k e0 input T + generating ett r vr hrKind hrVertex hvr + have hqFirst := firstAppearanceEq lower s hround hsBefore rfl htree vq + hvqFull hvq (hqBound.trans (by simp [s])) + have hrFirst := firstAppearanceEq lower s hround hsBefore rfl htree vr + hvrFull hvr (hrBound.trans (by simp [s])) + let qLower : Fin lower.rounds := ⟨q.val, by omega⟩ + let rLower : Fin lower.rounds := ⟨r.val, by omega⟩ + have hqSlot : Fin.castLE (by omega) qLower.succ = q.succ := by + apply Fin.ext + rfl + have hrSlot : Fin.castLE (by omega) rLower.succ = r.succ := by + apply Fin.ext + rfl + have hqKindLower : lower.series.data.kind qLower.succ = + some TashkinovExtensionKind.PE := by + rw [(hdata qLower.succ).2.2.2.1, hqSlot] + exact hqKind + have hrKindLower : lower.series.data.kind rLower.succ = + some TashkinovExtensionKind.PE := by + rw [(hdata rLower.succ).2.2.2.1, hrSlot] + exact hrKind + have hqVertexLower : lower.series.data.chosenVertex qLower.succ = some vq := by + rw [(hdata qLower.succ).2.2.2.2.1, hqSlot] + exact hqVertex + have hrVertexLower : lower.series.data.chosenVertex rLower.succ = some vr := by + rw [(hdata rLower.succ).2.2.2.2.1, hrSlot] + exact hrVertex + have hqrLower : qLower ≠ rLower := by + intro heq + apply hqr + apply Fin.ext + have hval : qLower.val = rLower.val := congrArg Fin.val heq + simpa [qLower, rLower] using hval + have hfirstLower : ETTFirstAppearanceIndex lower vq hvqFull = + ETTFirstAppearanceIndex lower vr hvrFull := by + rw [hqFirst, hrFirst] + exact hfirst + have hlower := hLowerThree lower (by omega) (by omega) hmax + have hdisjoint := hlower.2 qLower rLower vq vr hqrLower hvqr + hqKindLower hrKindLower hqVertexLower hrVertexLower hvqFull hvrFull + hfirstLower + have hqStored := (hdata qLower.succ).2.1 + have hrStored := (hdata rLower.succ).2.1 + rw [hqStored, hrStored, hqSlot, hrSlot] at hdisjoint + exact hdisjoint + +theorem ExtensionRulesEarlierIndices {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (_ : 0 < ett.rounds) + (hLowerThree : ∀ {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input T' generating'), + 0 < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + ((∀ (q : Fin lower.rounds) (v : V), + lower.series.data.kind q.succ = + some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex q.succ = some v → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T', + ∀ j : Fin (lower.rounds + 1), + ETTFirstAppearanceIndex lower v hvFinal = j.val + 1 → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring + (lower.series.data.tree q.succ.castSucc) + (TashkinovStoredColors lower.series.data q.succ) + (lower.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal + (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma ∧ + (0 < j.val → + StableColoring (lower.series.data.tree j.castSucc) + (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin lower.rounds) (vq vr : V), + q ≠ r → vq ≠ vr → + lower.series.data.kind q.succ = + some TashkinovExtensionKind.PE → + lower.series.data.kind r.succ = + some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex q.succ = some vq → + lower.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') + (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex lower vq hvq = + ETTFirstAppearanceIndex lower vr hvr → + Disjoint (lower.series.data.stored q.succ) + (lower.series.data.stored r.succ))) : + ((∀ (q : Fin ett.rounds) (v : V), + q.succ ≠ Fin.last ett.rounds → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T, + ∀ j : Fin (ett.rounds + 1), + ETTFirstAppearanceIndex ett v hvFinal = j.val + 1 → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T v hvFinal + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma ∧ + (0 < j.val → + StableColoring (ett.series.data.tree j.castSucc) + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin ett.rounds) (vq vr : V), + q.succ ≠ Fin.last ett.rounds → + r.succ ≠ Fin.last ett.rounds → + q ≠ r → vq ≠ vr → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.kind r.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some vq → + ett.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T) + (hvr : vr ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett vq hvq = + ETTFirstAppearanceIndex ett vr hvr → + Disjoint (ett.series.data.stored q.succ) + (ett.series.data.stored r.succ)) := by + classical + let : DecidableEq V := Classical.decEq V + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨hab.trans hbc, ?_, ?_⟩ + · intro i + have hmid := hvbc (Fin.castLE (Nat.succ_le_succ hab) i) + exact (by simpa using hmid.trans (hvab i)) + · intro i + have hmid := hebc (Fin.castLE hab i) + exact (by simpa using hmid.trans (heab i)) + have stepSegment : ∀ i : Fin (ett.rounds + 1), 0 < i.val → + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) + (ett.series.data.tree i.succ) := by + intro i hi + have cert := ett.series.certified i + cases cert with + | initial => exact (by simp at hi) + | SE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | RE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + have stageToStage := @helper_stageToStage_147 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett segmentRefl segmentTrans stepSegment + have stageToT : ∀ (a : ℕ) (_ha : 1 ≤ a) (_hround : a ≤ ett.rounds), + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) T := by + intro a ha hround + have hchain := stageToStage a ett.rounds ha hround le_rfl + exact segmentTrans hchain ett.abovePenultimate + have supportInFollowingTree := @helper_supportInFollowingTree_188 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett + have ladderStageEq := @helper_ladderStageEq_229 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett + have firstAppearanceEq : + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating') (s : ℕ) (hs : lower.rounds = s) (hsn : + s < ett.rounds) (hdisplay : T' = ett.series.data.tree ⟨s + 1, + by omega + ⟩) (htree : + ∀ i : Fin (lower.rounds + 2), lower.series.data.tree i = ett.series.data.tree (Fin.castLE ( + by omega + ) i)) (v : V) (hvLower : v ∈ TreeSequenceVertexSet T') (hvFinal : v ∈ TreeSequenceVertexSet T) + (hbound : ETTFirstAppearanceIndex ett v hvFinal ≤ s), ETTFirstAppearanceIndex lower v + hvLower = ETTFirstAppearanceIndex ett v hvFinal := by + exact @helper_firstAppearanceEq_290 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett (by assumption) ladderStageEq + have beforeEqOfSegment := @helper_beforeEqOfSegment_356 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett + constructor + · exact @helper_branch_399 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hMP hLowerThree stageToT supportInFollowingTree firstAppearanceEq + beforeEqOfSegment + · exact @helper_branch_480 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hMP hLowerThree stageToStage supportInFollowingTree firstAppearanceEq +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesPEFirstAppearanceBound.lean b/LeanPool/GoldbergSeymour/ExtensionRulesPEFirstAppearanceBound.lean new file mode 100644 index 0000000000..85ad340374 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionRulesPEFirstAppearanceBound.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex + +/-! +# Extension Rules PEFirst Appearance Bound + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ExtensionRulesPEFirstAppearanceBound {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (q : Fin ett.rounds) (v : V) + (hkind : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) + (hvertex : ett.series.data.chosenVertex q.succ = some v) + (hvFinal : v ∈ TreeSequenceVertexSet T) : + ETTFirstAppearanceIndex ett v hvFinal ≤ q.val + 1 := by + classical + generalize hindex : q.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q hindex).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [hindex] using hkind) + cases hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [hindex] using hkind) + cases hbad + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + simpa using (congrArg Fin.val hindex).symm + subst i + have hv : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + have hvchoice : choice.vertex = v := + Option.some.inj (currentVertex.symm.trans (by simpa [hindex] using hvertex)) + simpa [hvchoice] using choice.vertexDefective.1 + unfold ETTFirstAppearanceIndex + dsimp + have hmem : q.castSucc ∈ + Finset.univ.filter (fun j : Fin (ett.rounds + 1) => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett j)) := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + simpa [ExtendedTashkinovLadderStage, Fin.lastCases_castSucc] using hv + have hle := Finset.min'_le + (Finset.univ.filter (fun j : Fin (ett.rounds + 1) => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett j))) + q.castSucc hmem + have hnat := Fin.le_iff_val_le_val.mp hle + rw [Fin.val_castSucc] at hnat + convert Nat.succ_le_succ hnat using 1 +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalEarlierAppearance.lean b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalEarlierAppearance.lean new file mode 100644 index 0000000000..b5371b1830 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalEarlierAppearance.lean @@ -0,0 +1,1770 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.DefectiveEdge +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovLadderStage +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TreeVerticesBefore +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Extension Rules Terminal Earlier Appearance + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation1280Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (_ : ett.series.data.chosenVertex (Fin.last ett.rounds) = + some v) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin (ett.rounds + (1 : ℕ))) (_ : + ETTFirstAppearanceIndex ett v hvFinal = (↑j : ℕ) + (1 : ℕ)) (hj : (↑j : ℕ) + (1 : ℕ) < + ett.rounds) (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : + IsOneEdgeUncolored sigma e0) (_ : StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))) (_ : (0 : ℕ) < (↑i : ℕ)), TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ))) (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)), + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : p.castSucc = j), + let A : TreeSequence G e0 := ett.series.data.tree p.succ.castSucc; + ∀ (_ : v ∈ TreeSequenceVertexSet A) (_ : TreeSequenceInitialSegment A T), + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : ( + ∀ w ∈ B, w ∈ TreeSequenceVertexSet A)) (ci : Fin ett.rounds) (_ : IsProperEdgeColoring G + (ett.series.data.coloring ci.castSucc)) (_ : IsOneEdgeUncolored (ett.series.data.coloring + ci.castSucc) e0) (_ : ColoredVertexSetClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : ¬Nonempty + (RevisitingExtensionCertificate ett.series.data ci.castSucc)) (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree ci.succ.castSucc) (TashkinovStoredColors + ett.series.data ci.castSucc) (ett.series.data.coloring ci.castSucc)) (_ : ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc)))) (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (_ : + ett.series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex)) (_ : ett.series.data.stored ci.succ = { choice.color, gamma }) (_ + : ett.series.data.outsideVertex ci.succ = some choice.otherEndpoint) (_ : + ett.series.data.delta ci.succ = some choice.color) (_ : ett.series.data.gamma ci.succ = + some gamma) (_ : TashkinovClosure (ett.series.data.coloring ci.succ) (ett.series.data.tree + ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : TreeSequenceInitialSegment + (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : + (ett.series.data.tree ci.succ.castSucc).length < (ett.series.data.tree + ci.succ.succ).length) (_ : ci.succ = Fin.last ett.rounds) (hciVal : (↑ci : ℕ) + (1 : ℕ) = + ett.rounds), + let r : ℕ := ett.rounds - (1 : ℕ); + ∀ (_ : r < ett.rounds) (hrCi : r = (↑ci : ℕ)) (lower : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = r) (_ : ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (2 : ℕ) ≤ ett.rounds + (2 + : ℕ)) ↦ + by + omega + ) i))) (_ : ( + ∀ (i : Fin (lower.rounds + (1 : ℕ))), lower.series.data.coloring i = ett.series.data.coloring + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + (1 + : ℕ)) ↦ + by omega + ) i) ∧ lower.series.data.stored i = ett.series.data.stored (Fin.castLE + (Decidable.byContradiction fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega + ) i) ∧ lower.series.data.connectingEdges i = ett.series.data.connectingEdges (Fin.castLE + (Decidable.byContradiction fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega + ) i) ∧ lower.series.data.kind i = ett.series.data.kind (Fin.castLE (Decidable.byContradiction + fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega + ) i) ∧ lower.series.data.chosenVertex i = ett.series.data.chosenVertex (Fin.castLE + (Decidable.byContradiction fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega + ) i) ∧ lower.series.data.outsideVertex i = ett.series.data.outsideVertex (Fin.castLE + (Decidable.byContradiction fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega + ) i) ∧ lower.series.data.delta i = ett.series.data.delta (Fin.castLE + (Decidable.byContradiction fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega + ) i) ∧ lower.series.data.gamma i = ett.series.data.gamma (Fin.castLE + (Decidable.byContradiction fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega + ) i) ∧ TashkinovStoredColors lower.series.data i = TashkinovStoredColors ett.series.data + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + (1 + : ℕ)) ↦ + by omega + ) i) ∧ lower.series.certified i ≍ ett.series.certified (Fin.castLE (Decidable.byContradiction + fun (a : ¬lower.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega + ) i))), + let Tn : TreeSequence G e0 := ett.series.data.tree ci.succ.castSucc; + let P : TreeSequence G e0 := ett.series.data.tree ci.castSucc.castSucc; + ∀ (_ : TreeSequenceInitialSegment Tn T) (_ : TreeSequenceInitialSegment P Tn) (_ : + TreeSequenceInitialSegment A P) (hvLower : v ∈ TreeSequenceVertexSet (ett.series.data.tree + (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (_ : ETTFirstAppearanceIndex lower v hvLower = + ETTFirstAppearanceIndex ett v hvFinal) (_ : ETTFirstAppearanceIndex lower v hvLower = (↑j + : ℕ) + (1 : ℕ)) (_ : Fin k) (_ : V) (_ : ( + ∀ (hvFinal : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (q : Fin lower.rounds) (vi : V) (_ : lower.series.data.kind + q.succ = some TashkinovExtensionKind.PE ∨ lower.series.data.kind q.succ = some + TashkinovExtensionKind.SE) (_ : lower.series.data.chosenVertex q.succ = some vi) (_ : + ETTFirstAppearanceIndex lower v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)), v = vi ∨ TreeVertexOrder + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) v vi)) (_ : ( + ∀ {x y : V} (_ : TreeVertexOrder T x y), ¬(y = x ∨ TreeVertexOrder T y x))), + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (ett.series.data.tree j.castSucc) (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma) + +private abbrev helperContinuation1138Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating') (_ : (0 : ℕ) < lower.rounds) (_ : + lower.rounds < ett.rounds) (_ : MaximumProperty lower), + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma) (delta : Fin k) (_ : DefectiveColor G sigma + (TreeSequenceVertexSet Tn) delta) (v : V) (_ : BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tn) delta v) (_ : ( + ∃ (w : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn + w v)) (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin lower.rounds) (vi : V) (_ : + lower.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ lower.series.data.kind + q.succ = some TashkinovExtensionKind.SE) (_ : lower.series.data.chosenVertex q.succ = some + vi) (_ : ETTFirstAppearanceIndex lower v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)), v = vi ∨ + TreeVertexOrder T' v vi)) (v : V) (_ : ett.series.data.chosenVertex (Fin.last ett.rounds) + = some v) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin (ett.rounds + (1 : ℕ))) (_ : + ETTFirstAppearanceIndex ett v hvFinal = (↑j : ℕ) + (1 : ℕ)) (hj : (↑j : ℕ) + (1 : ℕ) < + ett.rounds) (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : + IsOneEdgeUncolored sigma e0) (_ : StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))) (_ : (0 : ℕ) < (↑i : ℕ)), TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ))) (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : u ∈ + TreeSequenceVertexSet A) (_ : w ∈ TreeSequenceVertexSet A) (_ : TreeVertexOrder B u w), + TreeVertexOrder A u w)), + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : p.castSucc = j), + let A : TreeSequence G e0 := ett.series.data.tree p.succ.castSucc; + ∀ (_ : v ∈ TreeSequenceVertexSet A) (_ : TreeSequenceInitialSegment A T), + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : ( + ∀ w ∈ B, w ∈ TreeSequenceVertexSet A)) (ci : Fin ett.rounds) (_ : IsProperEdgeColoring G + (ett.series.data.coloring ci.castSucc)) (_ : IsOneEdgeUncolored (ett.series.data.coloring + ci.castSucc) e0) (_ : ColoredVertexSetClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : ¬Nonempty + (RevisitingExtensionCertificate ett.series.data ci.castSucc)) (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree ci.succ.castSucc) (TashkinovStoredColors + ett.series.data ci.castSucc) (ett.series.data.coloring ci.castSucc)) (_ : ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc)))) (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (_ : + ett.series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex)) (_ : ett.series.data.stored ci.succ = { choice.color, gamma }) (_ + : ett.series.data.outsideVertex ci.succ = some choice.otherEndpoint) (_ : + ett.series.data.delta ci.succ = some choice.color) (_ : ett.series.data.gamma ci.succ = + some gamma) (_ : TashkinovClosure (ett.series.data.coloring ci.succ) (ett.series.data.tree + ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : TreeSequenceInitialSegment + (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : + (ett.series.data.tree ci.succ.castSucc).length < (ett.series.data.tree + ci.succ.succ).length) (_ : ci.succ = Fin.last ett.rounds) (hciVal : (↑ci : ℕ) + (1 : ℕ) = + ett.rounds) (_ : choice.vertex = v), + let r : ℕ := ett.rounds - (1 : ℕ); + ∀ (_ : (1 : ℕ) ≤ r) (_ : r < ett.rounds) (hrCi : r = (↑ci : ℕ)) (lower : ExtendedTashkinovTree + G k e0 input (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = r) (_ : MaximumProperty lower) (_ : ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE ( + by omega + ) i))) (_ : ( + ∀ (i : Fin (lower.rounds + (1 : ℕ))), lower.series.data.coloring i = ett.series.data.coloring + (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.connectingEdges i = ett.series.data.connectingEdges (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.chosenVertex i = ett.series.data.chosenVertex (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.outsideVertex i = ett.series.data.outsideVertex (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.delta i = ett.series.data.delta (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.gamma i = ett.series.data.gamma (Fin.castLE ( + by omega + ) i) ∧ TashkinovStoredColors lower.series.data i = TashkinovStoredColors ett.series.data + (Fin.castLE ( + by omega + ) i) ∧ lower.series.certified i ≍ ett.series.certified (Fin.castLE ( + by omega + ) i))), + let nLower : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree ci.succ.castSucc; + let P : TreeSequence G e0 := ett.series.data.tree ci.castSucc.castSucc; + ∀ (_ : TreeSequenceInitialSegment Tn T) (_ : TreeSequenceInitialSegment P Tn) (_ : + TreeSequenceInitialSegment A P) (_ : v ∈ TreeSequenceVertexSet P) (hvLower : v ∈ + TreeSequenceVertexSet (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (_ : ETTFirstAppearanceIndex lower v hvLower = + ETTFirstAppearanceIndex ett v hvFinal) (_ : ETTFirstAppearanceIndex lower v hvLower = (↑j + : ℕ) + (1 : ℕ)) (_ : lower.series.data.tree nLower.castSucc = P) (_ : StableColoring + (lower.series.data.tree nLower.castSucc) (TashkinovStoredColors lower.series.data nLower) + (lower.series.data.coloring nLower) choice.selected) (delta : Fin k) (_ : DefectiveColor G + choice.selected (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc)) delta) (_ + : delta = choice.color) (_ : (1 : ℕ) < (BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet Tn) delta).card), StableColoringBeforeVertex T v hvFinal + (TashkinovStoredColors ett.series.data j) (ett.series.data.coloring j) sigma ∧ ((0 : ℕ) < + (↑j : ℕ) → StableColoring (ett.series.data.tree j.castSucc) (TashkinovStoredColors + ett.series.data j) (ett.series.data.coloring j) sigma) + +private abbrev helperBranch409Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (_ : (0 : ℕ) < ett.rounds) (_ : ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating') (_ : (0 : ℕ) < lower.rounds) (_ : + lower.rounds < ett.rounds) (_ : MaximumProperty lower), + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma) (delta : Fin k) (_ : DefectiveColor G sigma + (TreeSequenceVertexSet Tn) delta) (v : V) (_ : BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tn) delta v) (_ : ( + ∃ (w : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn + w v)) (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin lower.rounds) (vi : V) (_ : + lower.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ lower.series.data.kind + q.succ = some TashkinovExtensionKind.SE) (_ : lower.series.data.chosenVertex q.succ = some + vi) (_ : ETTFirstAppearanceIndex lower v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)), v = vi ∨ + TreeVertexOrder T' v vi)) (v : V) (_ : ett.series.data.chosenVertex (Fin.last ett.rounds) + = some v) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin (ett.rounds + (1 : ℕ))) (_ : + ETTFirstAppearanceIndex ett v hvFinal = (↑j : ℕ) + (1 : ℕ)) (hj : (↑j : ℕ) + (1 : ℕ) < + ett.rounds) (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : + IsOneEdgeUncolored sigma e0) (_ : StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))) (_ : (0 : ℕ) < (↑i : ℕ)), TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ))) (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : u ∈ + TreeSequenceVertexSet A) (_ : w ∈ TreeSequenceVertexSet A) (_ : TreeVertexOrder B u w), + TreeVertexOrder A u w)) (_ : ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating') (s : ℕ) (hs : lower.rounds = s) (hsn : + s < ett.rounds) (_ : T' = ett.series.data.tree (⟨s + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (_ : ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (2 : ℕ) ≤ ett.rounds + (2 + : ℕ)) ↦ + by + omega + ) i))) (x : V) (hxLower : x ∈ TreeSequenceVertexSet T') (hxFinal : x ∈ TreeSequenceVertexSet + T) (_ : ETTFirstAppearanceIndex ett x hxFinal ≤ s), ETTFirstAppearanceIndex lower x + hxLower = ETTFirstAppearanceIndex ett x hxFinal)), + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : p.castSucc = j), + let A : TreeSequence G e0 := ett.series.data.tree p.succ.castSucc; + ∀ (_ : v ∈ TreeSequenceVertexSet A) (_ : TreeSequenceInitialSegment A T), + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : ( + ∀ w ∈ B, w ∈ TreeSequenceVertexSet A)) (ci : Fin ett.rounds) (_ : IsProperEdgeColoring G + (ett.series.data.coloring ci.castSucc)) (_ : IsOneEdgeUncolored (ett.series.data.coloring + ci.castSucc) e0) (_ : ColoredVertexSetClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : ¬Nonempty + (RevisitingExtensionCertificate ett.series.data ci.castSucc)) (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree ci.succ.castSucc) (TashkinovStoredColors + ett.series.data ci.castSucc) (ett.series.data.coloring ci.castSucc)) (_ : ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc)))) (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (_ : + ett.series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex)) (_ : ett.series.data.stored ci.succ = { choice.color, gamma }) (_ + : ett.series.data.chosenVertex ci.succ = some choice.vertex) (_ : + ett.series.data.outsideVertex ci.succ = some choice.otherEndpoint) (_ : + ett.series.data.delta ci.succ = some choice.color) (_ : ett.series.data.gamma ci.succ = + some gamma) (_ : TashkinovClosure (ett.series.data.coloring ci.succ) (ett.series.data.tree + ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : TreeSequenceInitialSegment + (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : + (ett.series.data.tree ci.succ.castSucc).length < (ett.series.data.tree + ci.succ.succ).length) (_ : Fin.last ett.rounds = ci.succ), StableColoringBeforeVertex T v + hvFinal (TashkinovStoredColors ett.series.data j) (ett.series.data.coloring j) sigma ∧ ((0 + : ℕ) < (↑j : ℕ) → StableColoring (ett.series.data.tree j.castSucc) (TashkinovStoredColors + ett.series.data j) (ett.series.data.coloring j) sigma) + +private theorem helper_ladderStageEq_191.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin (ett.rounds + (1 + : ℕ))) {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating') (s : ℕ) (hs : lower.rounds = s) (hsn : + s < ett.rounds), T' = ett.series.data.tree (⟨s + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) → ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (2 : ℕ) ≤ ett.rounds + (2 + : ℕ)) ↦ + by omega + ) i)) → + ∀ (i : Fin (lower.rounds + (1 : ℕ))), ExtendedTashkinovLadderStage lower i = + ExtendedTashkinovLadderStage ett (⟨(↑i : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))) := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j T' generating' lower s hs hsn + hdisplay htree i + refine Fin.lastCases ?_ (fun a => ?_) i + · have hdisplay' : T' = ett.series.data.tree + ⟨lower.rounds + 1, by omega⟩ := by + simpa [hs] using hdisplay + rw [show ExtendedTashkinovLadderStage lower + (Fin.last lower.rounds) = T' by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + have hidx : (⟨(Fin.last lower.rounds).val, by omega⟩ : + Fin (ett.rounds + 1)) = + (⟨lower.rounds, by omega⟩ : Fin ett.rounds).castSucc := by + apply Fin.ext + simp + rw [hidx] + rw [show ExtendedTashkinovLadderStage ett + (⟨lower.rounds, by omega⟩ : Fin ett.rounds).castSucc = + ett.series.data.tree + (⟨lower.rounds, by omega⟩ : Fin ett.rounds).succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T + (fun j => ett.series.data.tree j.succ.castSucc) + (⟨lower.rounds, by omega⟩ : Fin ett.rounds)] + exact hdisplay'.trans (congrArg ett.series.data.tree (by + apply Fin.ext + simp)) + · rw [show ExtendedTashkinovLadderStage lower a.castSucc = + lower.series.data.tree a.succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc lower.rounds + (fun _ : Fin (lower.rounds + 1) => TreeSequence G e0) T' + (fun j => lower.series.data.tree j.succ.castSucc) a] + have hidx : (⟨(a.castSucc).val, by omega⟩ : Fin (ett.rounds + 1)) = + (⟨a.val, by omega⟩ : Fin ett.rounds).castSucc := by + apply Fin.ext + rfl + rw [hidx] + rw [show ExtendedTashkinovLadderStage ett + (⟨a.val, by omega⟩ : Fin ett.rounds).castSucc = + ett.series.data.tree + (⟨a.val, by omega⟩ : Fin ett.rounds).succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T + (fun j => ett.series.data.tree j.succ.castSucc) + (⟨a.val, by omega⟩ : Fin ett.rounds)] + exact (htree a.succ.castSucc).trans (congrArg ett.series.data.tree (by + apply Fin.ext + rfl)) + +private theorem helper_firstAppearanceEq_252.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin (ett.rounds + (1 + : ℕ))) (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : + IsOneEdgeUncolored sigma e0), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating') (s : ℕ) (hs : lower.rounds = s) (hsn : + s < ett.rounds) (_ : T' = ett.series.data.tree (⟨s + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (_ : ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (2 : ℕ) ≤ ett.rounds + (2 + : ℕ)) ↦ + by omega + ) i))) (i : Fin (lower.rounds + (1 : ℕ))), ExtendedTashkinovLadderStage lower i = + ExtendedTashkinovLadderStage ett (⟨(↑i : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input T' + generating') (s : ℕ) (hs : lower.rounds = s) (hsn : s < ett.rounds) (_ : T' = + ett.series.data.tree (⟨s + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (_ : ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE (Decidable.byContradiction fun (a : ¬lower.rounds + (2 : ℕ) ≤ ett.rounds + (2 + : ℕ)) ↦ + by omega + ) i))) (x : V) (hxLower : x ∈ TreeSequenceVertexSet T') (hxFinal : x ∈ TreeSequenceVertexSet + T) (_ : ETTFirstAppearanceIndex ett x hxFinal ≤ s), ETTFirstAppearanceIndex lower x + hxLower = ETTFirstAppearanceIndex ett x hxFinal := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j sigma _ _ this ladderStageEq T' + generating' lower s hs hsn hdisplay htree x hxLower hxFinal hbound + have hladders := ladderStageEq lower s hs hsn hdisplay htree + unfold ETTFirstAppearanceIndex at hbound ⊢ + dsimp at hbound ⊢ + let lowerCandidates : Finset (Fin (lower.rounds + 1)) := + Finset.univ.filter fun i => + x ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage lower i) + let fullCandidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + x ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hlowerNonempty : lowerCandidates.Nonempty := by + refine ⟨Fin.last lower.rounds, ?_⟩ + simp only [lowerCandidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage lower + (Fin.last lower.rounds) = T' by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hxLower + have hfullNonempty : fullCandidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [fullCandidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett + (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hxFinal + let ml := lowerCandidates.min' hlowerNonempty + let mf := fullCandidates.min' hfullNonempty + have hmfBound : mf.val < lower.rounds + 1 := by + have hb : mf.val + 1 ≤ s := by + dsimp [mf] + convert hbound using 1 + omega + let mfLower : Fin (lower.rounds + 1) := ⟨mf.val, hmfBound⟩ + have hmfMem : mfLower ∈ lowerCandidates := by + simp only [lowerCandidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [hladders mfLower] + have hmem := Finset.min'_mem fullCandidates hfullNonempty + simpa [fullCandidates, mfLower] using hmem + have hmlMemFull : (⟨ml.val, by omega⟩ : Fin (ett.rounds + 1)) ∈ + fullCandidates := by + simp only [fullCandidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [← hladders ml] + exact (Finset.mem_filter.mp + (Finset.min'_mem lowerCandidates hlowerNonempty)).2 + have hleOne := Finset.min'_le lowerCandidates mfLower hmfMem + have hleTwo := Finset.min'_le fullCandidates + (⟨ml.val, by omega⟩ : Fin (ett.rounds + 1)) hmlMemFull + have hvals : ml.val = mf.val := by + apply le_antisymm + · exact Fin.le_iff_val_le_val.mp hleOne + · exact Fin.le_iff_val_le_val.mp hleTwo + change (lowerCandidates.min' _).val + 1 = + (fullCandidates.min' _).val + 1 + simpa [ml, mf] using congrArg (fun z : ℕ => z + 1) hvals + +private theorem helper_retainedOrder_612.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (_ : ETTFirstAppearanceIndex ett v hvFinal = (↑j : ℕ) + (1 : ℕ)) + (hj : (↑j : ℕ) + (1 : ℕ) < ett.rounds) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)), + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : p.castSucc = j) (ci : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 + (ett.series.data.tree ci.succ.castSucc) (TashkinovStoredColors ett.series.data + ci.castSucc) (ett.series.data.coloring ci.castSucc)) (hciVal : (↑ci : ℕ) + (1 : ℕ) = + ett.rounds), + let r : ℕ := ett.rounds - (1 : ℕ); + ∀ (_ : r < ett.rounds) (hrCi : r = (↑ci : ℕ)) (lower : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = r) (_ : ( + ∀ (i : Fin (lower.rounds + (1 : ℕ))), lower.series.data.coloring i = ett.series.data.coloring + (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.connectingEdges i = ett.series.data.connectingEdges (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.chosenVertex i = ett.series.data.chosenVertex (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.outsideVertex i = ett.series.data.outsideVertex (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.delta i = ett.series.data.delta (Fin.castLE ( + by omega + ) i) ∧ lower.series.data.gamma i = ett.series.data.gamma (Fin.castLE ( + by omega + ) i) ∧ TashkinovStoredColors lower.series.data i = TashkinovStoredColors ett.series.data + (Fin.castLE ( + by omega + ) i) ∧ lower.series.certified i ≍ ett.series.certified (Fin.castLE ( + by omega + ) i))), + let Tn : TreeSequence G e0 := ett.series.data.tree ci.succ.castSucc; + ∀ (_ : TreeSequenceInitialSegment Tn T) (hvLower : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (_ : ETTFirstAppearanceIndex lower v hvLower = + ETTFirstAppearanceIndex ett v hvFinal) (_ : ETTFirstAppearanceIndex lower v hvLower = (↑j + : ℕ) + (1 : ℕ)) (_ : Fin k) (_ : ( + ∀ (hvFinal : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (q : Fin lower.rounds) (vi : V) (_ : lower.series.data.kind + q.succ = some TashkinovExtensionKind.PE ∨ lower.series.data.kind q.succ = some + TashkinovExtensionKind.SE) (_ : lower.series.data.chosenVertex q.succ = some vi) (_ : + ETTFirstAppearanceIndex lower v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)), v = vi ∨ TreeVertexOrder + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) v vi)) (t : Fin ett.rounds) (vi : V) (_ : (↑p : ℕ) ≤ (↑t : + ℕ)) (_ : (↑t : ℕ) < (↑ci : ℕ)) (_ : ett.series.data.kind t.succ = some + TashkinovExtensionKind.PE ∨ ett.series.data.kind t.succ = some TashkinovExtensionKind.SE) + (_ : ett.series.data.chosenVertex t.succ = some vi), v = vi ∨ TreeVertexOrder T v vi := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hfirst hj orderTransfer p hpj ci + choice hciVal r hrBefore hrCi lower hr hdata Tn hTnT hvLower hfirstEq hfirstLower delta + hlowerFive t vi hpt htci hkindT hvertexT + let tLower : Fin lower.rounds := ⟨t.val, by omega⟩ + have htCast : Fin.castLE (by omega) tLower.succ = t.succ := by + apply Fin.ext + rfl + rcases hdata tLower.succ with + ⟨_, _, _, htKind, htVertex, _, _, _, _, _⟩ + have hkindLower : + lower.series.data.kind tLower.succ = some TashkinovExtensionKind.PE ∨ + lower.series.data.kind tLower.succ = some TashkinovExtensionKind.SE := by + rw [htKind, htCast] + exact hkindT + have hvertexLower : lower.series.data.chosenVertex tLower.succ = some vi := by + rw [htVertex, htCast] + exact hvertexT + have hresult := hlowerFive hvLower tLower vi hkindLower hvertexLower + (calc + ETTFirstAppearanceIndex lower v hvLower = j.val + 1 := hfirstLower + _ ≤ tLower.val + 1 := by dsimp [tLower, p] at ⊢ hpt; omega) + rcases hresult with rfl | horder + · exact Or.inl rfl + · have hdisplay : ett.series.data.tree ⟨r + 1, by omega⟩ = Tn := by + apply congrArg ett.series.data.tree + apply Fin.ext + change r + 1 = ci.val + 1 + rw [hrCi] + rw [hdisplay] at horder + exact Or.inr (orderTransfer hTnT v vi horder) + +private theorem helper_controlCarryNat_661.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (_ : v ∈ TreeSequenceVertexSet T) (j : Fin (ett.rounds + (1 + : ℕ))) (hj : (↑j : ℕ) + (1 : ℕ) < ett.rounds), + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + let A : TreeSequence G e0 := ett.series.data.tree p.succ.castSucc; + ∀ (ci : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 (ett.series.data.tree + ci.succ.castSucc) (TashkinovStoredColors ett.series.data ci.castSucc) + (ett.series.data.coloring ci.castSucc)) (hciVal : (↑ci : ℕ) + (1 : ℕ) = ett.rounds), + let r : ℕ := ett.rounds - (1 : ℕ); + ∀ (_ : r < ett.rounds) (hrCi : r = (↑ci : ℕ)) (lower : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = r) (_ : ( + ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree + (Fin.castLE ( + by omega + ) i))) (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (_ : Fin k) (n : ℕ) (_ : (↑p : ℕ) ≤ n) (_ : n < ett.rounds) + (t : Fin ett.rounds) (_ : (↑t : ℕ) = n), TreeMissingColors (ett.series.data.coloring + p.castSucc) A ∪ TashkinovStoredColors ett.series.data p.castSucc ⊆ TreeMissingColors + (ett.series.data.coloring t.succ) (ett.series.data.tree t.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data t.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hj p A ci choice hciVal r hrBefore + hrCi lower hr htree hvLower delta n hpn + induction n, hpn using Nat.le_induction with + | base => + intro hn t ht + have htp : t = p := by + apply Fin.ext + simpa using ht + subst t + simpa [A] using + (HkuMissingStoredMonotone G k ett.rounds e0 input ett.series p).1 + | succ n hn ih => + intro hn t ht + let prev : Fin ett.rounds := ⟨n, by omega⟩ + have hprev := ih (by omega) prev rfl + have hexpand := + (HkuMissingStoredMonotone G k ett.rounds e0 input ett.series prev).2 + have hnext := + (HkuMissingStoredMonotone G k ett.rounds e0 input ett.series t).1 + have hcolor : t.castSucc = prev.succ := by + apply Fin.ext + simp [prev, ht] + have htree : t.succ.castSucc = prev.succ.succ := by + apply Fin.ext + simp [prev, ht] + intro c hc + have hcExpanded := hexpand (hprev hc) + rw [hcolor, htree] at hnext + simpa only [htree] using hnext hcExpanded + +private theorem helper_exceptionImpossible_733.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (_ : ETTFirstAppearanceIndex ett v hvFinal = (↑j : ℕ) + (1 : ℕ)) + (hj : (↑j : ℕ) + (1 : ℕ) < ett.rounds), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))))), + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : p.castSucc = j), + let A : TreeSequence G e0 := ett.series.data.tree p.succ.castSucc; + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : ( + ∀ w ∈ B, w ∈ TreeSequenceVertexSet A)) (ci : Fin ett.rounds) (_ : IsProperEdgeColoring G + (ett.series.data.coloring ci.castSucc)) (_ : IsOneEdgeUncolored (ett.series.data.coloring + ci.castSucc) e0) (_ : ColoredVertexSetClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : ¬Nonempty + (RevisitingExtensionCertificate ett.series.data ci.castSucc)) (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree ci.succ.castSucc) (TashkinovStoredColors + ett.series.data ci.castSucc) (ett.series.data.coloring ci.castSucc)) (_ : ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc)))) (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (_ : + ett.series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex)) (_ : ett.series.data.stored ci.succ = { choice.color, gamma }) (_ + : ett.series.data.outsideVertex ci.succ = some choice.otherEndpoint) (_ : + ett.series.data.delta ci.succ = some choice.color) (_ : ett.series.data.gamma ci.succ = + some gamma) (_ : TashkinovClosure (ett.series.data.coloring ci.succ) (ett.series.data.tree + ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : TreeSequenceInitialSegment + (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : + (ett.series.data.tree ci.succ.castSucc).length < (ett.series.data.tree + ci.succ.succ).length) (hciVal : (↑ci : ℕ) + (1 : ℕ) = ett.rounds), + let r : ℕ := ett.rounds - (1 : ℕ); + ∀ (_ : r < ett.rounds) (hrCi : r = (↑ci : ℕ)) (lower : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : lower.rounds = r) (hvLower : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (_ : ETTFirstAppearanceIndex lower v hvLower = + ETTFirstAppearanceIndex ett v hvFinal) (_ : Fin k) (_ : ( + ∀ x ∈ B, + ∀ (t : Fin ett.rounds), (↑p : ℕ) ≤ (↑t : ℕ) → (↑t : ℕ) ≤ (↑ci : ℕ) → ¬(ett.series.data.kind + t.succ = some TashkinovExtensionKind.PE ∧ ett.series.data.chosenVertex t.succ = some x))) + (f : E) (_ : ( + ∃ x ∈ B, Incident G x f)), ¬ + ∃ (t : Fin ett.rounds), (↑p : ℕ) ≤ (↑t : ℕ) ∧ (↑t : ℕ) ≤ (↑ci : ℕ) ∧ ett.series.data.kind + t.succ = some TashkinovExtensionKind.PE ∧ ett.series.data.connectingEdges t.succ = { f } + := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hfirst hj this stageToStage p hpj A B + beforeInA ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma secondStable currentColoring currentStored + currentOutside currentDelta currentGamma closedExtension orderedExtension strictExtension + hciVal r hrBefore hrCi lower hr hvLower hfirstEq delta unsupportedBefore f hf hexception + rcases hf with ⟨x, hx, hxf⟩ + rcases hexception with ⟨t, hpt, htci, htKind, htEdges⟩ + have cert := ett.series.certified t.succ + generalize hslot : t.succ = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero t hslot).elim + | SE ti previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choiceT seriesAlternative + currentColoring currentStored currentEdgesT currentKindT currentVertexT + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKindT.symm.trans (by simpa [hslot] using htKind) + cases hbad + | RE ti previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdgesT currentKindT currentVertexT currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKindT.symm.trans (by simpa [hslot] using htKind) + cases hbad + | PE ti previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choiceT seriesAlternativeFails + gammaT gammaRuleT secondStableT secondStableProperT + secondStableOneUncoloredT secondStableRelationT exitWitnessT + currentColoringT currentProperT currentOneUncoloredT currentStoredT + currentEdgesT currentKindT currentVertexT currentOutsideT currentDeltaT + currentGammaT closedExtensionT orderedExtensionT strictExtensionT => + have hti : ti = t := by + apply Fin.ext + have hv := congrArg Fin.val hslot + simp at hv ⊢ + omega + subst ti + have hedgeEq : choiceT.edge = f := by + apply Finset.singleton_inj.mp + exact currentEdgesT.symm.trans (by simpa [hslot] using htEdges) + have hAStage : TreeSequenceInitialSegment A + (ett.series.data.tree t.succ.castSucc) := by + have hs := stageToStage (j.val + 1) (t.val + 1) + (by omega) (by dsimp [p] at hpt; omega) (by omega) + convert hs using 1 <;> congr 1 + have hxStage : x ∈ TreeSequenceVertexSet + (ett.series.data.tree t.succ.castSucc) := + TreeSequenceInitialSegmentVertexSetSubset hAStage (beforeInA x hx) + have hxEnds : x = choiceT.vertex ∨ x = choiceT.otherEndpoint := by + change x ∈ G.ends f at hxf + rw [← hedgeEq, choiceT.edgeEnds] at hxf + simpa using hxf + have hxSupport : choiceT.vertex = x := by + rcases hxEnds with hxv | hxo + · exact hxv.symm + · exact (choiceT.otherOutside (hxo ▸ hxStage)).elim + apply unsupportedBefore x hx t hpt htci + refine ⟨htKind, ?_⟩ + have hchosenT : ett.series.data.chosenVertex t.succ = + some choiceT.vertex := by + simpa [hslot] using currentVertexT + exact hchosenT.trans (congrArg some hxSupport) + +private theorem helper_branch_847.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (_ : ETTFirstAppearanceIndex ett v hvFinal = (↑j : ℕ) + (1 : ℕ)) + (hj : (↑j : ℕ) + (1 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))) (_ : (0 : ℕ) < (↑i : ℕ)), TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)), + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : p.castSucc = j), + let A : TreeSequence G e0 := ett.series.data.tree p.succ.castSucc; + ∀ (_ : v ∈ TreeSequenceVertexSet A) (_ : TreeSequenceInitialSegment A T), + let _ : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (ci : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 (ett.series.data.tree + ci.succ.castSucc) (TashkinovStoredColors ett.series.data ci.castSucc) + (ett.series.data.coloring ci.castSucc)) (hciVal : (↑ci : ℕ) + (1 : ℕ) = ett.rounds), + let r : ℕ := ett.rounds - (1 : ℕ); + ∀ (_ : r < ett.rounds) (hrCi : r = (↑ci : ℕ)) (lower : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : lower.rounds = r) (hvLower : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (⟨r + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) (_ : ETTFirstAppearanceIndex lower v hvLower = + ETTFirstAppearanceIndex ett v hvFinal) (_ : Fin k) (_ : V) (_ : (↑p : ℕ) ≤ (↑ci : ℕ)) (_ : + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data p.castSucc) + (ett.series.data.coloring p.castSucc) sigma) (_ : (0 : ℕ) < (↑j : ℕ)), StableColoring + (ett.series.data.tree j.castSucc) (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hfirst hj sigma _ _ this stepSegment + orderTransfer p hpj A hvA hAT B ci choice hciVal r hrBefore hrCi lower hr hvLower hfirstEq + delta z hpci beforeStable hjPositive + let Q := ett.series.data.tree p.castSucc.castSucc + have hpPositive : 0 < p.val := by + simpa [p] using hjPositive + have hQA : TreeSequenceInitialSegment Q A := by + have hs := stepSegment p.castSucc (by simpa using hpPositive) + simpa [Q, A] using hs + have hvNotQ : v ∉ TreeSequenceVertexSet Q := by + intro hvQ + let u : Fin ett.rounds := ⟨p.val - 1, by omega⟩ + have hup : u.succ = p.castSucc := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_castSucc] + exact Nat.sub_add_cancel hpPositive + have hvStage : v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett u.castSucc) := by + rw [show ExtendedTashkinovLadderStage ett u.castSucc = + ett.series.data.tree u.succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T + (fun a => ett.series.data.tree a.succ.castSucc) u] + rw [hup] + exact hvQ + have hbound : ETTFirstAppearanceIndex ett v hvFinal ≤ p.val := by + unfold ETTFirstAppearanceIndex + dsimp + have hmem : u.castSucc ∈ + Finset.univ.filter + (fun a : Fin (ett.rounds + 1) => + v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett a)) := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hvStage + have hle := Finset.min'_le + (Finset.univ.filter + (fun a : Fin (ett.rounds + 1) => + v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett a))) u.castSucc hmem + have hnat := Fin.le_iff_val_le_val.mp hle + rw [Fin.val_castSucc] at hnat + calc + _ + 1 ≤ u.val + 1 := Nat.succ_le_succ hnat + _ = p.val := by + simp only [u] + exact Nat.sub_add_cancel hpPositive + have hfirstP : ETTFirstAppearanceIndex ett v hvFinal = p.val + 1 := by + simpa [p] using hfirst + omega + have qInBefore : ∀ x : V, x ∈ TreeSequenceVertexSet Q → x ∈ B := by + intro x hx + have hxA := TreeSequenceInitialSegmentVertexSetSubset hQA hx + have hxT := TreeSequenceInitialSegmentVertexSetSubset hAT hxA + apply Finset.mem_filter.mpr + refine ⟨hxT, ?_⟩ + rcases hQA with ⟨hlen, hvertices, _⟩ + rcases Finset.mem_image.mp hx with ⟨ix, _, hix⟩ + rcases Finset.mem_image.mp hvA with ⟨iv, _, hiv⟩ + have hleniv : Q.length < iv.val := by + by_contra hnot + have hivBound : iv.val < Q.length + 1 := by omega + let ivQ : Fin (Q.length + 1) := ⟨iv.val, hivBound⟩ + apply hvNotQ + apply Finset.mem_image.mpr + refine ⟨ivQ, Finset.mem_univ _, ?_⟩ + calc + Q.vertex ivQ = + A.vertex (Fin.castLE (Nat.succ_le_succ hlen) ivQ) := + (hvertices ivQ).symm + _ = A.vertex iv := by + congr 1 + _ = v := hiv + have horderA : TreeVertexOrder A x v := by + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) ix, iv, + (hvertices ix).trans hix, hiv, ?_⟩ + have hixBound : ix.val ≤ Q.length := by omega + simp only [Fin.val_castLE] + omega + exact orderTransfer hAT x v horderA + have stableQ : StableColoring Q + (TashkinovStoredColors ett.series.data p.castSucc) + (ett.series.data.coloring p.castSucc) sigma := by + constructor + · intro f hf hcolor + rcases hf with ⟨x, hx, hxf⟩ + rcases hcolor with ⟨c, hc, hfc⟩ + apply beforeStable.1 f ⟨x, qInBefore x hx, hxf⟩ + refine ⟨c, ?_, hfc⟩ + rcases Finset.mem_union.mp hc with hc | hc + · apply Finset.mem_union.mpr + left + simp only [TreeMissingColors, Finset.mem_biUnion] at hc + rcases hc with ⟨z, hz, hzc⟩ + simp only [Finset.mem_biUnion] + exact ⟨z, qInBefore z hz, hzc⟩ + · exact Finset.mem_union.mpr (Or.inr hc) + · intro x hx + exact beforeStable.2 x (qInBefore x hx) + simpa [Q, hpj] using stableQ + +private theorem helper_selectedStableP_966.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), + let _ : DecidableEq V := Classical.decEq V; + ∀ (ci : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + ci.succ.castSucc) (TashkinovStoredColors ett.series.data ci.castSucc) + (ett.series.data.coloring ci.castSucc)), + let Tn : TreeSequence G e0 := ett.series.data.tree ci.succ.castSucc; + let P : TreeSequence G e0 := ett.series.data.tree ci.castSucc.castSucc; + ∀ (_ : TreeSequenceInitialSegment P Tn) (_ : TreeMissingColors (ett.series.data.coloring + ci.castSucc) P ⊆ TreeMissingColors (ett.series.data.coloring ci.castSucc) Tn), + StableColoring P (TashkinovStoredColors ett.series.data ci.castSucc) + (ett.series.data.coloring ci.castSucc) choice.selected := by + classical + intro V E _ _ _ G k e0 input T generating ett this ci choice Tn P hPTn oldMissingIntoTn + constructor + · intro f hf hcolor + rcases hcolor with ⟨c, hc, hcf⟩ + apply choice.selectedStable.1 f + · rcases hf with ⟨x, hx, hxf⟩ + exact ⟨x, TreeSequenceInitialSegmentVertexSetSubset hPTn hx, hxf⟩ + · refine ⟨c, ?_, hcf⟩ + rcases Finset.mem_union.mp hc with hc | hc + · exact Finset.mem_union.mpr (Or.inl (oldMissingIntoTn hc)) + · exact Finset.mem_union.mpr (Or.inr hc) + · intro x hx + exact choice.selectedStable.2 x + (TreeSequenceInitialSegmentVertexSetSubset hPTn hx) + +private theorem helper_seriesEdgeEq_1174.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (hj : (↑j : ℕ) + (1 : ℕ) < ett.rounds), + let _ : DecidableEq V := Classical.decEq V; + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + let A : TreeSequence G e0 := ett.series.data.tree p.succ.castSucc; + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : ( + ∀ w ∈ B, w ∈ TreeSequenceVertexSet A)) (ci : Fin ett.rounds) (_ : (↑p : ℕ) ≤ (↑ci : ℕ)) (_ : ( + ∀ c ∈ (B.biUnion fun (x : V) ↦ MissingColors G (ett.series.data.coloring p.castSucc) x) ∪ + TashkinovStoredColors ett.series.data p.castSucc, c ∈ TreeMissingColors + (ett.series.data.coloring p.castSucc) A ∪ TashkinovStoredColors ett.series.data + p.castSucc)) (_ : ( + ∀ (f : E) (_ : ( + ∃ x ∈ B, Incident G x f)), ¬ + ∃ (t : Fin ett.rounds), (↑p : ℕ) ≤ (↑t : ℕ) ∧ (↑t : ℕ) ≤ (↑ci : ℕ) ∧ ett.series.data.kind + t.succ = some TashkinovExtensionKind.PE ∧ ett.series.data.connectingEdges t.succ = { f })) + (f : E) (_ : ( + ∃ x ∈ B, Incident G x f)) (_ : ( + ∃ c ∈ (B.biUnion fun (x : V) ↦ MissingColors G (ett.series.data.coloring p.castSucc) x) ∪ + TashkinovStoredColors ett.series.data p.castSucc, ett.series.data.coloring p.castSucc f = + some c)), ett.series.data.coloring ci.succ f = ett.series.data.coloring p.castSucc f := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hj this p A B beforeInA ci hpci + oldControlInA exceptionImpossible f hf hcolor + rcases hcolor with ⟨c, hc, hfc⟩ + have hfA : TreeIncidentEdge A f := by + rcases hf with ⟨x, hx, hxf⟩ + exact ⟨x, beforeInA x hx, hxf⟩ + have hcA := oldControlInA c hc + have hsame := SameColorSeriesPreserved G k ett.rounds e0 input + ett.series p ci hpci f c (by simpa [A] using hfA) hfc + (by simpa [A] using hcA) + rcases hsame.1 with hkeep | hexception + · exact hkeep + · exact (exceptionImpossible f hf hexception).elim + +private theorem helper_beforeStable_1193.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (hj : (↑j : ℕ) + (1 : ℕ) < ett.rounds) (sigma : + PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + let A : TreeSequence G e0 := ett.series.data.tree p.succ.castSucc; + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : ( + ∀ w ∈ B, w ∈ TreeSequenceVertexSet A)) (ci : Fin ett.rounds), + let Tn : TreeSequence G e0 := ett.series.data.tree ci.succ.castSucc; + ∀ (_ : ( + ∀ (t : Fin ett.rounds) (_ : (↑p : ℕ) ≤ (↑t : ℕ)), TreeMissingColors (ett.series.data.coloring + p.castSucc) A ∪ TashkinovStoredColors ett.series.data p.castSucc ⊆ TreeMissingColors + (ett.series.data.coloring t.succ) (ett.series.data.tree t.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data t.succ)) (_ : (↑p : ℕ) ≤ (↑ci : ℕ)) (_ : + TreeSequenceInitialSegment A Tn) (_ : ( + ∀ c ∈ (B.biUnion fun (x : V) ↦ MissingColors G (ett.series.data.coloring p.castSucc) x) ∪ + TashkinovStoredColors ett.series.data p.castSucc, c ∈ TreeMissingColors + (ett.series.data.coloring p.castSucc) A ∪ TashkinovStoredColors ett.series.data + p.castSucc)) (_ : StableColoring Tn (TashkinovStoredColors ett.series.data ci.succ) + (ett.series.data.coloring ci.succ) sigma) (_ : ( + ∀ x ∈ B, MissingColors G (ett.series.data.coloring p.castSucc) x = MissingColors G + (ett.series.data.coloring ci.succ) x)) (_ : ( + ∀ (f : E) (_ : ( + ∃ x ∈ B, Incident G x f)) (_ : ( + ∃ c ∈ (B.biUnion fun (x : V) ↦ MissingColors G (ett.series.data.coloring p.castSucc) x) ∪ + TashkinovStoredColors ett.series.data p.castSucc, ett.series.data.coloring p.castSucc f = + some c)), ett.series.data.coloring ci.succ f = ett.series.data.coloring p.castSucc f)), + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data p.castSucc) + (ett.series.data.coloring p.castSucc) sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hj sigma this p A B beforeInA ci Tn + controlCarry hpci hATn oldControlInA hstableN beforeMissingSeries seriesEdgeEq + unfold StableColoringBeforeVertex + change (∀ f, (∃ x ∈ B, Incident G x f) → _ → _) ∧ _ + constructor + · intro f hf hcolor + rcases hcolor with ⟨c, hc, hfc⟩ + have hfN : TreeIncidentEdge Tn f := by + rcases hf with ⟨x, hx, hxf⟩ + exact ⟨x, TreeSequenceInitialSegmentVertexSetSubset hATn + (beforeInA x hx), hxf⟩ + have hcA := oldControlInA c hc + have hcN := controlCarry ci hpci hcA + have hcurrent := seriesEdgeEq f hf ⟨c, hc, hfc⟩ + have hsigma : sigma f = ett.series.data.coloring ci.succ f := + hstableN.1 f hfN ⟨c, hcN, hcurrent.trans hfc⟩ + exact hsigma.trans hcurrent + · intro x hx + have hxN := TreeSequenceInitialSegmentVertexSetSubset hATn + (beforeInA x hx) + exact (hstableN.2 x hxN).trans (beforeMissingSeries x hx).symm + +private theorem helper_continuation_1280.{u_1, u_2} : + helperContinuation1280Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvertex hvFinal j hfirst hj sigma _ _ hstable + segmentTrans stepSegment stageToStage orderTransfer p hpj A hvA hAT B beforeInA ci + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternativeFails gamma secondStable currentColoring currentStored + currentOutside currentDelta currentGamma closedExtension orderedExtension strictExtension + hciLast hciVal r hrBefore hrCi lower hr htree hdata Tn P hTnT hPTn hAP hvLower hfirstEq + hfirstLower delta z hlowerFive orderAsymm + have retainedOrder := + @helper_retainedOrder_612 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hfirst hj orderTransfer hpj ci choice hciVal hrBefore hrCi + lower hr hdata hTnT hvLower hfirstEq hfirstLower delta hlowerFive + have unsupportedBefore : ∀ (x : V), x ∈ B → ∀ t : Fin ett.rounds, + p.val ≤ t.val → t.val ≤ ci.val → + ¬ (ett.series.data.kind t.succ = some TashkinovExtensionKind.PE ∧ + ett.series.data.chosenVertex t.succ = some x) := by + intro x hx t hpt htci hsupport + have hxOrder : TreeVertexOrder T x v := (Finset.mem_filter.mp hx).2 + by_cases heq : t = ci + · subst t + have hxv : x = v := Option.some.inj + (hsupport.2.symm.trans (by simpa [hciLast] using hvertex)) + exact orderAsymm hxOrder (Or.inl hxv.symm) + · have hord := retainedOrder t x hpt (by + have hneval : t.val ≠ ci.val := fun h => heq (Fin.ext h) + omega) (Or.inl hsupport.1) hsupport.2 + exact orderAsymm hxOrder hord + have controlCarryNat := + @helper_controlCarryNat_661 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett v hvFinal j hj ci choice hciVal hrBefore hrCi lower hr htree hvLower delta + have controlCarry : + ∀ (t : Fin ett.rounds), p.val ≤ t.val → TreeMissingColors (ett.series.data.coloring + p.castSucc) A ∪ TashkinovStoredColors ett.series.data p.castSucc ⊆ TreeMissingColors + (ett.series.data.coloring t.succ) (ett.series.data.tree t.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data t.succ := by + intro t hpt + exact controlCarryNat t.val hpt t.isLt t rfl + have hpci : p.val ≤ ci.val := by + dsimp [p] + omega + have hATn : TreeSequenceInitialSegment A Tn := segmentTrans hAP hPTn + have oldControlInA : + ∀ c : Fin k, c ∈ (B.biUnion fun x => MissingColors G (ett.series.data.coloring p.castSucc) x) + ∪ TashkinovStoredColors ett.series.data p.castSucc → c ∈ TreeMissingColors + (ett.series.data.coloring p.castSucc) A ∪ TashkinovStoredColors ett.series.data p.castSucc + := by + intro c hc + rcases Finset.mem_union.mp hc with hc | hc + · apply Finset.mem_union.mpr + left + simp only [Finset.mem_biUnion] at hc + rcases hc with ⟨x, hx, hc⟩ + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨x, beforeInA x hx, hc⟩ + · exact Finset.mem_union.mpr (Or.inr hc) + have hstableN : StableColoring Tn + (TashkinovStoredColors ett.series.data ci.succ) + (ett.series.data.coloring ci.succ) sigma := by + simpa [Tn, hciLast] using hstable + have beforeMissingSeries : ∀ x : V, x ∈ B → + MissingColors G (ett.series.data.coloring p.castSucc) x = + MissingColors G (ett.series.data.coloring ci.succ) x := by + intro x hx + exact HkuUnsupportedVertexColors G k ett.rounds e0 input ett.series + ci p x hpci (beforeInA x hx) (unsupportedBefore x hx) + have exceptionImpossible := + @helper_exceptionImpossible_733 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett v hvFinal j hfirst hj stageToStage hpj beforeInA ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails gamma secondStable currentColoring currentStored currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension hciVal + hrBefore hrCi lower hr hvLower hfirstEq delta unsupportedBefore + have seriesEdgeEq := + @helper_seriesEdgeEq_1174 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hj beforeInA ci hpci oldControlInA exceptionImpossible + have beforeStable := + @helper_beforeStable_1193 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hj sigma beforeInA ci controlCarry hpci hATn oldControlInA + hstableN beforeMissingSeries seriesEdgeEq + constructor + · simpa [hpj] using beforeStable + · exact @helper_branch_847 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hfirst hj sigma (by assumption) (by assumption) stepSegment + orderTransfer hpj hvA hAT ci choice hciVal hrBefore hrCi lower hr hvLower hfirstEq delta z + hpci beforeStable + +private theorem helper_continuation_1138.{u_1, u_2} : + helperContinuation1138Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hLowerFive v hvertex hvFinal j hfirst hj sigma _ + _ hstable this segmentTrans stepSegment stageToStage orderTransfer orderRestrict p hpj A + hvA hAT B beforeInA ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma secondStable + currentColoring currentStored currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hciLast hciVal hvchoice r hrPositive hrBefore hrCi lower + hr hmaxLower htree hdata nLower Tn P hTnT hPTn hAP hvP hvLower hfirstEq hfirstLower hnTree' + hstableLower delta hdeltaDefective hdelta hcard + obtain ⟨g, hgDelta, hgne⟩ := + Finset.exists_mem_ne hcard choice.edge + have hgBoundary : g ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) := + (Finset.mem_filter.mp hgDelta).1 + have hgColor : choice.selected g = some choice.color := by + have hc := (Finset.mem_filter.mp hgDelta).2 + simpa [hdelta] using hc + have hgBoundaryData : ∃ w ∈ TreeSequenceVertexSet Tn, + ∃ z ∉ TreeSequenceVertexSet Tn, G.ends g = s(w, z) := by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + using hgBoundary + obtain ⟨w, hwTn, z, hzTn, hgEnds⟩ := hgBoundaryData + have hwg : Incident G w g := by + simp [Incident, hgEnds] + have hwDefective : DefectiveVertex G choice.selected + (TreeSequenceVertexSet Tn) w := by + refine ⟨hwTn, g, ?_, hwg⟩ + exact ⟨delta, by simpa [Tn] using hdeltaDefective, + by simpa [Tn] using hgDelta⟩ + have hwChoice := choice.maximal choice.selected w choice.selectedProper + choice.selectedOneUncolored choice.selectedStable (by simpa [Tn] using hwDefective) + have hwne : w ≠ choice.vertex := by + intro heq + have hadj : AdjacentEdges G choice.edge g := + ⟨choice.vertex, choice.edgeIncident, heq ▸ hwg⟩ + exact choice.selectedProper hgne.symm hadj choice.edgeColor hgColor + have hwOrderN : TreeVertexOrder Tn w choice.vertex := by + simpa [Tn] using hwChoice.resolve_left hwne + have hwOrderT : TreeVertexOrder T w v := by + simpa [hvchoice] using orderTransfer hTnT w choice.vertex hwOrderN + have hwB : w ∈ B := by + apply Finset.mem_filter.mpr + exact ⟨TreeSequenceInitialSegmentVertexSetSubset hTnT hwTn, hwOrderT⟩ + have hwP : w ∈ TreeSequenceVertexSet P := + TreeSequenceInitialSegmentVertexSetSubset hAP (beforeInA w hwB) + have hzP : z ∉ TreeSequenceVertexSet P := by + intro hz + exact hzTn (TreeSequenceInitialSegmentVertexSetSubset hPTn hz) + have hotherP : choice.otherEndpoint ∉ TreeSequenceVertexSet P := by + intro hx + exact choice.otherOutside + (TreeSequenceInitialSegmentVertexSetSubset hPTn hx) + have hedgeP : choice.edge ∈ BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet P) choice.color := by + simp only [BoundaryColorEdges, Finset.mem_filter] + refine ⟨?_, choice.edgeColor⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hvP, choice.otherEndpoint, hotherP, by simpa [hvchoice] using choice.edgeEnds⟩ + have hgP : g ∈ BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet P) choice.color := by + simp only [BoundaryColorEdges, Finset.mem_filter] + refine ⟨?_, hgColor⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwP, z, hzP, hgEnds⟩ + have hdefectiveP : DefectiveColor G choice.selected + (TreeSequenceVertexSet P) choice.color := by + unfold DefectiveColor + have hc : 1 < (BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet P) choice.color).card := + Finset.one_lt_card.mpr ⟨choice.edge, hedgeP, g, hgP, hgne.symm⟩ + omega + have hvBoundaryP : BoundaryColorVertex G choice.selected + (TreeSequenceVertexSet P) choice.color v := by + exact ⟨hvP, choice.edge, hedgeP, by simpa [hvchoice] using choice.edgeIncident⟩ + have hwBoundaryP : BoundaryColorVertex G choice.selected + (TreeSequenceVertexSet P) choice.color w := + ⟨hwP, g, hgP, hwg⟩ + have hdefectiveLower : DefectiveColor G choice.selected + (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) + choice.color := by + rw [hnTree'] + exact hdefectiveP + have hvBoundaryLower : BoundaryColorVertex G choice.selected + (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) + choice.color v := by + rw [hnTree'] + exact hvBoundaryP + have hwBoundaryLower : BoundaryColorVertex G choice.selected + (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) + choice.color w := by + rw [hnTree'] + exact hwBoundaryP + have hwOrderLower : TreeVertexOrder + (lower.series.data.tree nLower.castSucc) w v := by + rw [hnTree'] + apply orderRestrict hPTn w v hwP hvP + simpa [hvchoice] using hwOrderN + have hlowerFive := hLowerFive lower (by omega) (by omega) hmaxLower + choice.selected choice.selectedProper choice.selectedOneUncolored + hstableLower choice.color hdefectiveLower v hvBoundaryLower + ⟨w, hwBoundaryLower, hwOrderLower⟩ + have orderAsymm : ∀ {x y : V}, TreeVertexOrder T x y → + ¬ (y = x ∨ TreeVertexOrder T y x) := by + intro x y hxy hrev + rcases hxy with ⟨ix, iy, hx, hy, hlt⟩ + rcases hrev with hEq | hyx + · have hy' : T.vertex iy = x := hy.trans hEq + have : ix = iy := T.vertex_injective (hx.trans hy'.symm) + omega + · rcases hyx with ⟨jy, jx, hy', hx', hrev⟩ + have hiy : iy = jy := T.vertex_injective (hy.trans hy'.symm) + have hix : ix = jx := T.vertex_injective (hx.trans hx'.symm) + omega + exact @helper_continuation_1280 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvertex hvFinal j hfirst hj sigma (by assumption) (by assumption) hstable + segmentTrans stepSegment stageToStage orderTransfer hpj hvA hAT beforeInA ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails gamma secondStable currentColoring currentStored currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension hciLast hciVal + hrBefore hrCi lower hr htree hdata hTnT hPTn hAP hvLower hfirstEq hfirstLower delta z + hlowerFive orderAsymm +private theorem helper_branch_409.{u_1, u_2} : + helperBranch409Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hLowerFive v hvertex hvFinal j + hfirst hj sigma _ _ hstable this segmentTrans stepSegment stageToStage orderTransfer + orderRestrict firstAppearanceEq p hpj A hvA hAT B beforeInA ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails gamma secondStable currentColoring currentStored currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension strictExtension + htarget + have hciLast : ci.succ = Fin.last ett.rounds := htarget.symm + have hciVal : ci.val + 1 = ett.rounds := by + have h := congrArg Fin.val hciLast + simpa using h + have hvchoice : choice.vertex = v := + Option.some.inj (currentVertex.symm.trans (by simpa [htarget] using hvertex)) + let r := ett.rounds - 1 + have hrPositive : 1 ≤ r := by + dsimp [r] + omega + have hrBefore : r < ett.rounds := by + dsimp [r] + omega + have hrCi : r = ci.val := by + dsimp [r] + omega + obtain ⟨lower, hr, hmaxLower, htree, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP r + hrPositive hrBefore + let nLower : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hnCast : Fin.castLE (by omega) nLower = ci.castSucc := by + apply Fin.ext + simp [nLower, hr, hrCi] + have hnTreeCast : Fin.castLE (by omega) nLower.castSucc = + ci.castSucc.castSucc := by + apply Fin.ext + simp [nLower, hr, hrCi] + let Tn := ett.series.data.tree ci.succ.castSucc + let P := ett.series.data.tree ci.castSucc.castSucc + have htreeIndex : ci.succ.castSucc = + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simpa using hciVal + have hTnT : TreeSequenceInitialSegment Tn T := by + change TreeSequenceInitialSegment + (ett.series.data.tree ci.succ.castSucc) T + rw [htreeIndex] + exact ett.abovePenultimate + have hciPositive : 0 < ci.val := by omega + have hPTn : TreeSequenceInitialSegment P Tn := by + have hs := stepSegment ci.castSucc (by simpa using hciPositive) + simpa [P, Tn] using hs + have hAP : TreeSequenceInitialSegment A P := by + have hs := stageToStage (j.val + 1) ci.val (by omega) (by omega) (by omega) + convert hs using 1 <;> congr 1 + have hvP : v ∈ TreeSequenceVertexSet P := + TreeSequenceInitialSegmentVertexSetSubset hAP hvA + have hvTn : v ∈ TreeSequenceVertexSet Tn := + TreeSequenceInitialSegmentVertexSetSubset hPTn hvP + have hvLower : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨r + 1, by omega⟩) := by + have hidx : (⟨r + 1, by omega⟩ : Fin (ett.rounds + 2)) = + ci.succ.castSucc := by + apply Fin.ext + simp [hrCi] + simpa [hidx, Tn] using hvTn + have hfirstEq := firstAppearanceEq lower r hr hrBefore rfl htree v + hvLower hvFinal (by rw [hfirst]; omega) + have hfirstLower : ETTFirstAppearanceIndex lower v hvLower = j.val + 1 := by + rw [hfirstEq, hfirst] + rcases hdata nLower with + ⟨hnColor, hnRawStored, hnEdges, hnKind, hnVertex, hnOutside, + hnDelta, hnGamma, hnStored, hnCert⟩ + have hnColor' : lower.series.data.coloring nLower = + ett.series.data.coloring ci.castSucc := by + rw [hnColor, hnCast] + have hnStored' : TashkinovStoredColors lower.series.data nLower = + TashkinovStoredColors ett.series.data ci.castSucc := by + rw [hnStored, hnCast] + have hnTree' : lower.series.data.tree nLower.castSucc = P := by + rw [htree nLower.castSucc, hnTreeCast] + have oldMissingIntoTn : TreeMissingColors + (ett.series.data.coloring ci.castSucc) P ⊆ + TreeMissingColors (ett.series.data.coloring ci.castSucc) Tn := by + intro c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨x, hx, hc⟩ + exact ⟨x, TreeSequenceInitialSegmentVertexSetSubset hPTn hx, hc⟩ + have selectedStableP := + @helper_selectedStableP_966 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett ci choice hPTn oldMissingIntoTn + have hstableLower : StableColoring + (lower.series.data.tree nLower.castSucc) + (TashkinovStoredColors lower.series.data nLower) + (lower.series.data.coloring nLower) choice.selected := by + rw [hnTree', hnStored', hnColor'] + exact selectedStableP + rcases choice.edgeDefective with ⟨delta, hdeltaDefective, hedgeDelta⟩ + have hdelta : delta = choice.color := by + have hc := (Finset.mem_filter.mp hedgeDelta).2 + exact Option.some.inj (hc.symm.trans choice.edgeColor) + have hcard : 1 < (BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet Tn) delta).card := by + have hc : 2 ≤ (BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet Tn) delta).card := by + simpa [DefectiveColor, Tn] using hdeltaDefective + omega + exact @helper_continuation_1138 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hLowerFive v hvertex hvFinal j hfirst hj sigma (by assumption) (by + assumption) hstable segmentTrans stepSegment stageToStage orderTransfer orderRestrict hpj + hvA hAT beforeInA ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma secondStable + currentColoring currentStored currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hciLast hciVal hvchoice hrPositive hrBefore hrCi lower hr + hmaxLower htree hdata hTnT hPTn hAP hvP hvLower hfirstEq hfirstLower hnTree' hstableLower + delta hdeltaDefective hdelta hcard +private theorem helper_stageToStage_1031.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin (ett.rounds + (1 + : ℕ))), ( + ∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A A) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j segmentRefl segmentTrans stepSegment + a b ha hab hb + have chain : ∀ (d : ℕ) (_hd : a + d ≤ b), + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) + (ett.series.data.tree ⟨a + d, by omega⟩) := by + intro d hd + induction d with + | zero => simpa using segmentRefl (ett.series.data.tree ⟨a, by omega⟩) + | succ d ih => + have hprev := ih (by omega) + let idx : Fin (ett.rounds + 1) := ⟨a + d, by omega⟩ + have hone := stepSegment idx (by dsimp [idx]; omega) + have hone' : TreeSequenceInitialSegment + (ett.series.data.tree ⟨a + d, by omega⟩) + (ett.series.data.tree ⟨a + (d + 1), by omega⟩) := by + simpa [idx, Nat.add_assoc] using hone + exact segmentTrans hprev hone' + have hchain := chain (b - a) (by omega) + convert hchain using 1; apply congrArg ett.series.data.tree; + apply Fin.ext; simp; omega + +private theorem helper_hvA_1118.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (v : V) + (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin (ett.rounds + (1 : ℕ))) + (_ : ETTFirstAppearanceIndex ett v hvFinal = (↑j : ℕ) + (1 : ℕ)) + (hj : (↑j : ℕ) + (1 : ℕ) < ett.rounds), + let _ : DecidableEq V := Classical.decEq V; + let p : Fin ett.rounds := (⟨(↑j : ℕ), by omega⟩ : Fin ett.rounds); + let A : TreeSequence G e0 := ett.series.data.tree p.succ.castSucc; + v ∈ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hfirst hj this p A + unfold ETTFirstAppearanceIndex at hfirst + dsimp at hfirst + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hfinal : candidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett + (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hvFinal + have hminval : (candidates.min' hfinal).val = j.val := by + dsimp [candidates] at hfirst ⊢ + omega + have hmem := Finset.min'_mem candidates hfinal + have hminEq : candidates.min' hfinal = p.castSucc := by + apply Fin.ext + simpa [p] using hminval + rw [hminEq] at hmem + have hstage : ExtendedTashkinovLadderStage ett p.castSucc = A := by + unfold ExtendedTashkinovLadderStage A + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T + (fun a => ett.series.data.tree a.succ.castSucc) p + simpa only [candidates, Finset.mem_filter, Finset.mem_univ, true_and, + hstage] using hmem + +private theorem helper_beforeInA_1150.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (v : V) + (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin (ett.rounds + (1 : ℕ))) + (hj : (↑j : ℕ) + (1 : ℕ) < ett.rounds), + let p : Fin ett.rounds := (⟨(↑j : ℕ), by omega⟩ : Fin ett.rounds); + let A : TreeSequence G e0 := ett.series.data.tree p.succ.castSucc; + ∀ (_ : v ∈ TreeSequenceVertexSet A) (_ : TreeSequenceInitialSegment A T), + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ w ∈ B, + w ∈ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hj p A hvA hAT B w hw + unfold B TreeVerticesBefore at hw + rcases Finset.mem_filter.mp hw with + ⟨hwT, iw, iv, hiw, hiv, hlt⟩ + rcases Finset.mem_image.mp hwT with ⟨iwT, _, hiwT⟩ + rcases Finset.mem_image.mp hvA with ⟨ivA, _, hivA⟩ + rcases hAT with ⟨hlen, hvertices, _⟩ + let ivT := Fin.castLE (Nat.succ_le_succ hlen) ivA + have hivEq : iv = ivT := by + apply T.vertex_injective + exact hiv.trans ((hvertices ivA).trans hivA).symm + have hiwEq : iwT = iw := by + apply T.vertex_injective + exact hiwT.trans hiw.symm + have hiBound : iwT.val < A.length + 1 := by + rw [hivEq, ← hiwEq] at hlt + simp [ivT] at hlt + omega + let iwA : Fin (A.length + 1) := ⟨iwT.val, hiBound⟩ + apply Finset.mem_image.mpr + refine ⟨iwA, Finset.mem_univ _, ?_⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hlen) iwA = iwT := by + apply Fin.ext + rfl + exact (hvertices iwA).symm.trans (by simpa [hcast] using hiwT) + +theorem ExtensionRulesTerminalEarlierAppearance {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hLowerFive : ∀ {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input T' generating'), + 0 < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (delta : Fin k), + DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → + (∃ w, BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tn) delta w ∧ + TreeVertexOrder Tn w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') + (q : Fin lower.rounds) (vi : V), + (lower.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ + lower.series.data.kind q.succ = + some TashkinovExtensionKind.SE) → + lower.series.data.chosenVertex q.succ = some vi → + ETTFirstAppearanceIndex lower v hvFinal ≤ q.val + 1 → + v = vi ∨ TreeVertexOrder T' v vi)) + (v : V) + (hkind : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (hvertex : ett.series.data.chosenVertex (Fin.last ett.rounds) = some v) + (hvFinal : v ∈ TreeSequenceVertexSet T) + (j : Fin (ett.rounds + 1)) + (hfirst : ETTFirstAppearanceIndex ett v hvFinal = j.val + 1) + (hj : j.val + 1 < ett.rounds) + (sigma : PartialEdgeColoring E k) + (_ : IsProperEdgeColoring G sigma) + (_ : IsOneEdgeUncolored sigma e0) + (hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) : + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma ∧ + (0 < j.val → + StableColoring (ett.series.data.tree j.castSucc) + (TashkinovStoredColors ett.series.data j) (ett.series.data.coloring j) sigma) := by + classical + let : DecidableEq V := Classical.decEq V + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + apply TreeSequenceInitialSegment.trans <;> assumption + have stepSegment : ∀ i : Fin (ett.rounds + 1), 0 < i.val → + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) + (ett.series.data.tree i.succ) := by + intro i hi + have cert := ett.series.certified i + cases cert with + | initial => exact (by simp at hi) + | SE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | RE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + have stageToStage := + @helper_stageToStage_1031 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j segmentRefl segmentTrans stepSegment + have stageToT : ∀ (a : ℕ) (_ha : 1 ≤ a) + (_hround : a ≤ ett.rounds), + TreeSequenceInitialSegment (ett.series.data.tree ⟨a, by omega⟩) T := by + intro a ha hround + exact segmentTrans (stageToStage a ett.rounds ha hround le_rfl) + ett.abovePenultimate + have orderTransfer : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ u w, + TreeVertexOrder A u w → TreeVertexOrder B u w := by + intro A B hAB u w huw + rcases hAB with ⟨hlen, hvertices, _⟩ + rcases huw with ⟨iu, iw, hu, hw, hi⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) iu, + Fin.castLE (Nat.succ_le_succ hlen) iw, + (hvertices iu).trans hu, (hvertices iw).trans hw, hi⟩ + have orderRestrict : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ u w, + u ∈ TreeSequenceVertexSet A → w ∈ TreeSequenceVertexSet A → + TreeVertexOrder B u w → TreeVertexOrder A u w := by + intro A B hAB u w huA hwA huw + rcases hAB with ⟨hlen, hvertices, _⟩ + rcases Finset.mem_image.mp huA with ⟨iu, _, hiu⟩ + rcases Finset.mem_image.mp hwA with ⟨iw, _, hiw⟩ + rcases huw with ⟨ju, jw, hju, hjw, hjlt⟩ + have hjuEq : ju = Fin.castLE (Nat.succ_le_succ hlen) iu := by + apply B.vertex_injective + exact hju.trans ((hvertices iu).trans hiu).symm + have hjwEq : jw = Fin.castLE (Nat.succ_le_succ hlen) iw := by + apply B.vertex_injective + exact hjw.trans ((hvertices iw).trans hiw).symm + exact ⟨iu, iw, hiu, hiw, by rw [hjuEq, hjwEq] at hjlt; simpa using hjlt⟩ + have ladderStageEq := + @helper_ladderStageEq_191 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j + have firstAppearanceEq := + @helper_firstAppearanceEq_252 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett v hvFinal j sigma (by assumption) (by assumption) ladderStageEq + let p : Fin ett.rounds := ⟨j.val, by omega⟩ + have hpj : p.castSucc = j := by + apply Fin.ext + rfl + let A := ett.series.data.tree p.succ.castSucc + have hvA := + @helper_hvA_1118 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hfirst hj + have hAT : TreeSequenceInitialSegment A T := by + simpa [A, p] using stageToT (j.val + 1) (by omega) (by omega) + let B := TreeVerticesBefore T v hvFinal + have beforeInA := + @helper_beforeInA_1150 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hj hvA hAT + generalize htarget : Fin.last ett.rounds = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hz := congrArg Fin.val htarget + simp at hz + omega + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hkind) + cases hbad + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hkind) + cases hbad + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_409 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hMP hpositive hLowerFive v hvertex hvFinal j hfirst hj sigma (by + assumption) (by assumption) hstable segmentTrans stepSegment stageToStage + orderTransfer orderRestrict firstAppearanceEq hpj hvA hAT beforeInA ci + previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma secondStable currentColoring + currentStored currentVertex currentOutside currentDelta currentGamma + closedExtension orderedExtension strictExtension htarget +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalLastAppearance.lean b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalLastAppearance.lean new file mode 100644 index 0000000000..f0bd23bdf8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalLastAppearance.lean @@ -0,0 +1,724 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex + +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone + +public import LeanPool.GoldbergSeymour.MaximumProperty + +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex + +public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Extension Rules Terminal Last Appearance + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_beforeInN_165.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (v : V) + (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin (ett.rounds + (1 : ℕ))) + (hj : (↑j : ℕ) + (1 : ℕ) = ett.rounds), + let q : Fin ett.rounds := (⟨(↑j : ℕ), by omega⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree q.succ.castSucc; + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : v ∈ TreeSequenceVertexSet Tn) (_ : TreeSequenceInitialSegment Tn T), + ∀ w ∈ B, + w ∈ TreeSequenceVertexSet Tn := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hj q Tn B hvN terminalSegment w hw + unfold B TreeVerticesBefore at hw + rcases Finset.mem_filter.mp hw with + ⟨hwT, iw, iv, hiw, hiv, hlt⟩ + rcases Finset.mem_image.mp hwT with ⟨iwT, _, hiwT⟩ + rcases Finset.mem_image.mp hvN with ⟨ivN, _, hivN⟩ + rcases terminalSegment with ⟨hlen', hvertices', hedges'⟩ + let ivT := Fin.castLE (Nat.succ_le_succ hlen') ivN + have hivEq : iv = ivT := by + apply T.vertex_injective + exact hiv.trans ((hvertices' ivN).trans hivN).symm + have hiwEq : iwT = iw := by + apply T.vertex_injective + exact hiwT.trans hiw.symm + have hiBound : iwT.val < Tn.length + 1 := by + rw [hivEq, ← hiwEq] at hlt + simp [ivT] at hlt + omega + let iwN : Fin (Tn.length + 1) := ⟨iwT.val, hiBound⟩ + apply Finset.mem_image.mpr + refine ⟨iwN, Finset.mem_univ _, ?_⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hlen') iwN = iwT := by + apply Fin.ext + rfl + exact (hvertices' iwN).symm.trans (by simpa [hcast] using hiwT) + +private theorem helper_swapFixed_204.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (hj : (↑j : ℕ) + (1 : ℕ) = ett.rounds), + let q : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)), + let Tn : TreeSequence G e0 := ett.series.data.tree q.succ.castSucc; + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : ( + ∀ w ∈ B, w ∈ TreeSequenceVertexSet Tn)) (_ : ( + ∀ w ∈ B, w ≠ choice.vertex)) (_ : ( + ∀ w ∈ TreeSequenceVertexSet Tn, Sum.inl w ∈ TwoColorComponent G secondStable gamma + choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex)) (f : E) (_ : ( + ∃ w ∈ B, Incident G w f)), TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex) f = secondStable f := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hj q gamma secondStable choice Tn B + beforeInN beforeNe componentOnly f hf + rcases hf with ⟨w, hw, hwf⟩ + have hfOutside : Sum.inr f ∉ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + intro hfComponent + let graph := TwoColorIncidenceGraph G secondStable gamma choice.color + have hfSupport : Sum.inr f ∈ graph.support := by + apply SimpleGraph.mem_support_of_reachable + (G := graph) (u := Sum.inr f) (v := Sum.inl choice.vertex) + · simp + · exact SimpleGraph.ConnectedComponent.eq.mp hfComponent + obtain ⟨z, hz⟩ := graph.mem_support.mp hfSupport + have hfColor : secondStable f = some gamma ∨ + secondStable f = some choice.color := by + cases z with + | inl z => exact hz.2 + | inr z => simp [graph, TwoColorIncidenceGraph] at hz + have hwComponent : Sum.inl w ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + change graph.connectedComponentMk (Sum.inl w) = + graph.connectedComponentMk (Sum.inl choice.vertex) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [graph, TwoColorIncidenceGraph, hwf, hfColor])).trans + hfComponent + exact beforeNe w hw + ((componentOnly w (beforeInN w hw)).mp hwComponent) + simp [TwoColorComponentSwap, hfOutside] + +private theorem helper_currentEdgeEq_274.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (hj : (↑j : ℕ) + (1 : ℕ) = ett.rounds) (_ : ( + ∀ {A : TreeSequence G e0} {C : Finset (Fin k)} {phi pi : PartialEdgeColoring E k} (_ : + StableColoring A C phi pi), TreeMissingColors pi A = TreeMissingColors phi A)), + let q : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)) (_ : StableColoring + (ett.series.data.tree q.succ.castSucc) (insert choice.color (TashkinovStoredColors + ett.series.data q.castSucc)) choice.selected secondStable) (_ : ett.series.data.coloring + q.succ = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)), + let Tn : TreeSequence G e0 := ett.series.data.tree q.succ.castSucc; + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : ( + ∀ w ∈ B, w ∈ TreeSequenceVertexSet Tn)) (_ : ( + ∀ (f : E) (_ : ( + ∃ w ∈ B, Incident G w f)), TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex) f = secondStable f)) (_ : ( + ∀ c ∈ (B.biUnion fun (w : V) => MissingColors G (ett.series.data.coloring q.castSucc) w) ∪ + TashkinovStoredColors ett.series.data q.castSucc, c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) Tn ∪ TashkinovStoredColors ett.series.data + q.castSucc)) (f : E) (_ : ( + ∃ w ∈ B, Incident G w f)) (_ : ( + ∃ c ∈ (B.biUnion fun (w : V) => MissingColors G (ett.series.data.coloring q.castSucc) w) ∪ + TashkinovStoredColors ett.series.data q.castSucc, ett.series.data.coloring q.castSucc f = + some c)), ett.series.data.coloring q.succ f = ett.series.data.coloring q.castSucc f := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hj stableTreeMissingEq q gamma + secondStable choice secondStableRelation currentColoring Tn B beforeInN swapFixed + oldControlInN f hf hcolor + rcases hcolor with ⟨c, hc, hcf⟩ + have hfN : TreeIncidentEdge Tn f := by + rcases hf with ⟨w, hw, hwf⟩ + exact ⟨w, beforeInN w hw, hwf⟩ + have hcN := oldControlInN c hc + have hselected : choice.selected f = + ett.series.data.coloring q.castSucc f := + choice.selectedStable.1 f hfN ⟨c, hcN, hcf⟩ + have hcSecond : c ∈ + TreeMissingColors choice.selected Tn ∪ + insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) := by + rcases Finset.mem_union.mp hcN with hcN | hcN + · apply Finset.mem_union.mpr + left + rw [stableTreeMissingEq choice.selectedStable] + exact hcN + · exact Finset.mem_union.mpr + (Or.inr (Finset.mem_insert_of_mem hcN)) + have hsecond : secondStable f = choice.selected f := + secondStableRelation.1 f hfN + ⟨c, hcSecond, hselected.trans hcf⟩ + calc + ett.series.data.coloring q.succ f = + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) f := congrFun currentColoring f + _ = secondStable f := swapFixed f hf + _ = choice.selected f := hsecond + _ = ett.series.data.coloring q.castSucc f := hselected + +private theorem helper_branch_350.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (_ : ETTFirstAppearanceIndex ett v hvFinal = (↑j : ℕ) + (1 : ℕ)) + (hj : (↑j : ℕ) + (1 : ℕ) = ett.rounds) (sigma : PartialEdgeColoring E k), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : ( + ∀ (a : Fin (ett.rounds + (1 : ℕ))) (_ : (0 : ℕ) < (↑a : ℕ)), TreeSequenceInitialSegment + (ett.series.data.tree a.castSucc) (ett.series.data.tree a.succ))) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (u w : V) (_ : + TreeVertexOrder A u w), TreeVertexOrder B u w)), + let q : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : q.castSucc = j), + let Tn : TreeSequence G e0 := ett.series.data.tree q.succ.castSucc; + let _ : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : v ∈ TreeSequenceVertexSet Tn) (_ : TreeSequenceInitialSegment Tn T) (_ : + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma) (_ : (0 : ℕ) < (↑j : ℕ)), StableColoring + (ett.series.data.tree j.castSucc) (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hfirst hj sigma this stepSegment + orderTransfer q hqj Tn B hvN terminalSegment beforeStableQ hjPositive + have hqPositive : 0 < q.val := by + simpa [q] using hjPositive + let Tprev := ett.series.data.tree q.castSucc.castSucc + have prevToN : TreeSequenceInitialSegment Tprev Tn := by + have hs := stepSegment q.castSucc (by simpa using hqPositive) + simpa [Tprev, Tn] using hs + have hvNotPrev : v ∉ TreeSequenceVertexSet Tprev := by + intro hvPrev + let r : Fin ett.rounds := ⟨q.val - 1, by omega⟩ + have hrq : r.succ = q.castSucc := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_castSucc] + exact Nat.sub_add_cancel hqPositive + have hvStage : v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett r.castSucc) := by + rw [show ExtendedTashkinovLadderStage ett r.castSucc = + ett.series.data.tree r.succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T + (fun a => ett.series.data.tree a.succ.castSucc) r] + rw [hrq] + exact hvPrev + have hbound : ETTFirstAppearanceIndex ett v hvFinal ≤ + q.val := by + unfold ETTFirstAppearanceIndex + dsimp + have hmem : r.castSucc ∈ + Finset.univ.filter + (fun a : Fin (ett.rounds + 1) => + v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett a)) := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hvStage + have hle := Finset.min'_le + (Finset.univ.filter + (fun a : Fin (ett.rounds + 1) => + v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett a))) r.castSucc hmem + have hnat := Fin.le_iff_val_le_val.mp hle + rw [Fin.val_castSucc] at hnat + calc + _ + 1 ≤ r.val + 1 := Nat.succ_le_succ hnat + _ = q.val := by + simp only [r] + exact Nat.sub_add_cancel hqPositive + have hfirstQ : ETTFirstAppearanceIndex ett v hvFinal = + q.val + 1 := by + simpa [q] using hfirst + omega + have prevInBefore : ∀ w : V, w ∈ TreeSequenceVertexSet Tprev → + w ∈ B := by + intro w hw + have hwN := TreeSequenceInitialSegmentVertexSetSubset prevToN hw + have hwT := TreeSequenceInitialSegmentVertexSetSubset + terminalSegment hwN + apply Finset.mem_filter.mpr + refine ⟨hwT, ?_⟩ + rcases prevToN with ⟨hlen, hvertices, _⟩ + rcases Finset.mem_image.mp hw with ⟨iw, _, hiw⟩ + rcases Finset.mem_image.mp hvN with ⟨iv, _, hiv⟩ + have hleniv : Tprev.length < iv.val := by + by_contra hnot + have hivBound : iv.val < Tprev.length + 1 := by omega + let ivPrev : Fin (Tprev.length + 1) := ⟨iv.val, hivBound⟩ + apply hvNotPrev + apply Finset.mem_image.mpr + refine ⟨ivPrev, Finset.mem_univ _, ?_⟩ + calc + Tprev.vertex ivPrev = + Tn.vertex (Fin.castLE (Nat.succ_le_succ hlen) ivPrev) := + (hvertices ivPrev).symm + _ = Tn.vertex iv := by + congr 1 + _ = v := hiv + have horderN : TreeVertexOrder Tn w v := by + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) iw, iv, + (hvertices iw).trans hiw, hiv, ?_⟩ + have hiwBound : iw.val ≤ Tprev.length := by omega + simp only [Fin.val_castLE] + omega + exact orderTransfer terminalSegment w v horderN + have stablePrevQ : StableColoring Tprev + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma := by + constructor + · intro f hf hcolor + rcases hf with ⟨w, hw, hwf⟩ + rcases hcolor with ⟨c, hc, hcf⟩ + apply beforeStableQ.1 f ⟨w, prevInBefore w hw, hwf⟩ + refine ⟨c, ?_, hcf⟩ + rcases Finset.mem_union.mp hc with hc | hc + · apply Finset.mem_union.mpr + left + simp only [TreeMissingColors, Finset.mem_biUnion] at hc + rcases hc with ⟨z, hz, hzc⟩ + simp only [Finset.mem_biUnion] + exact ⟨z, prevInBefore z hz, hzc⟩ + · exact Finset.mem_union.mpr (Or.inr hc) + · intro w hw + exact beforeStableQ.2 w (prevInBefore w hw) + simpa [Tprev, hqj] using stablePrevQ + +private theorem helper_swapMissing_482.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (hj : (↑j : ℕ) + (1 : ℕ) = ett.rounds), + let q : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)), + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : ( + ∀ (f : E) (_ : ( + ∃ w ∈ B, Incident G w f)), TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex) f = secondStable f)), + ∀ w ∈ B, MissingColors G (TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex)) w = MissingColors G secondStable w := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hj q gamma secondStable choice B + swapFixed w hw + apply Finset.ext + intro c + simp only [MissingColors, PresentColors, Finset.mem_sdiff, + Finset.mem_univ, true_and, Finset.mem_filter] + constructor + · intro hc + rintro ⟨f, hwf, hfc⟩ + apply hc + exact ⟨f, hwf, by + rw [swapFixed f ⟨w, hw, hwf⟩] + exact hfc⟩ + · intro hc + rintro ⟨f, hwf, hfc⟩ + apply hc + exact ⟨f, hwf, by + rw [← swapFixed f ⟨w, hw, hwf⟩] + exact hfc⟩ + +private theorem helper_currentMissingEq_528.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (hj : (↑j : ℕ) + (1 : ℕ) = ett.rounds), + let q : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)) (_ : StableColoring + (ett.series.data.tree q.succ.castSucc) (insert choice.color (TashkinovStoredColors + ett.series.data q.castSucc)) choice.selected secondStable) (_ : ett.series.data.coloring + q.succ = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)), + let Tn : TreeSequence G e0 := ett.series.data.tree q.succ.castSucc; + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : ( + ∀ w ∈ B, w ∈ TreeSequenceVertexSet Tn)) (_ : ( + ∀ w ∈ B, MissingColors G (TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex)) w = MissingColors G secondStable w)), + ∀ w ∈ B, MissingColors G (ett.series.data.coloring q.succ) w = MissingColors G + (ett.series.data.coloring q.castSucc) w := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hj q gamma secondStable choice + secondStableRelation currentColoring Tn B beforeInN swapMissing w hw + calc + MissingColors G (ett.series.data.coloring q.succ) w = + MissingColors G + (TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex)) w := + congrArg (fun phi => MissingColors G phi w) currentColoring + _ = MissingColors G secondStable w := swapMissing w hw + _ = MissingColors G choice.selected w := + secondStableRelation.2 w (beforeInN w hw) + _ = MissingColors G (ett.series.data.coloring q.castSucc) w := + choice.selectedStable.2 w (beforeInN w hw) + +private theorem helper_beforeStableQ_545.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (hvFinal : v ∈ TreeSequenceVertexSet T) (j : Fin + (ett.rounds + (1 : ℕ))) (hj : (↑j : ℕ) + (1 : ℕ) = ett.rounds) (sigma : + PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨(↑j : ℕ), + by omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree q.succ.castSucc; + let B : Finset V := TreeVerticesBefore T v hvFinal; + ∀ (_ : StableColoring Tn (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma) (_ : ( + ∀ w ∈ B, w ∈ TreeSequenceVertexSet Tn)) (_ : ( + ∀ c ∈ (B.biUnion fun (w : V) => MissingColors G (ett.series.data.coloring q.castSucc) w) ∪ + TashkinovStoredColors ett.series.data q.castSucc, c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) Tn ∪ TashkinovStoredColors ett.series.data + q.castSucc)) (_ : ( + ∀ (f : E) (_ : ( + ∃ w ∈ B, Incident G w f)) (_ : ( + ∃ c ∈ (B.biUnion fun (w : V) => MissingColors G (ett.series.data.coloring q.castSucc) w) ∪ + TashkinovStoredColors ett.series.data q.castSucc, ett.series.data.coloring q.castSucc f = + some c)), ett.series.data.coloring q.succ f = ett.series.data.coloring q.castSucc f)) (_ : + ( + ∀ w ∈ B, MissingColors G (ett.series.data.coloring q.succ) w = MissingColors G + (ett.series.data.coloring q.castSucc) w)) (_ : TreeMissingColors (ett.series.data.coloring + q.castSucc) (ett.series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors ett.series.data + q.castSucc ⊆ TreeMissingColors (ett.series.data.coloring q.succ) (ett.series.data.tree + q.succ.castSucc) ∪ TashkinovStoredColors ett.series.data q.succ), + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hj sigma q Tn B hstableN beforeInN + oldControlInN currentEdgeEq currentMissingEq hmonotone + unfold StableColoringBeforeVertex + change (∀ f, (∃ w ∈ B, Incident G w f) → _ → _) ∧ _ + constructor + · intro f hf hcolor + rcases hcolor with ⟨c, hc, hcf⟩ + have hfN : TreeIncidentEdge Tn f := by + rcases hf with ⟨w, hw, hwf⟩ + exact ⟨w, beforeInN w hw, hwf⟩ + have hcN := oldControlInN c hc + have hcurrent := currentEdgeEq f hf ⟨c, hc, hcf⟩ + have hsigma : sigma f = ett.series.data.coloring q.succ f := + hstableN.1 f hfN + ⟨c, hmonotone hcN, hcurrent.trans hcf⟩ + exact hsigma.trans hcurrent + · intro w hw + exact (hstableN.2 w (beforeInN w hw)).trans + (currentMissingEq w hw) + +private theorem helper_branch_153.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (v : V) (hvFinal : v ∈ + TreeSequenceVertexSet T) (j : Fin (ett.rounds + (1 : ℕ))), ETTFirstAppearanceIndex ett v + hvFinal = (↑j : ℕ) + (1 : ℕ) → ∀ (hj : (↑j : ℕ) + (1 : ℕ) = ett.rounds) (sigma : + PartialEdgeColoring E k), StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → (∀ (a : Fin (ett.rounds + (1 : + ℕ))), (0 : ℕ) < (↑a : ℕ) → TreeSequenceInitialSegment (ett.series.data.tree a.castSucc) + (ett.series.data.tree a.succ)) → (∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment + A B → ∀ (u w : V), TreeVertexOrder A u w → TreeVertexOrder B u w) → (∀ {A : TreeSequence G + e0} {C : Finset (Fin k)} {phi pi : PartialEdgeColoring E k}, StableColoring A C phi pi → + TreeMissingColors pi A = TreeMissingColors phi A) → ((⟨(↑j : ℕ), by omega⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc = j → ((⟨(↑j : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).succ = Fin.last ett.rounds → ett.series.data.chosenVertex ((⟨(↑j : ℕ), by + omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ = some v → ∀ (ci : Fin ett.rounds), + IsProperEdgeColoring G (ett.series.data.coloring ci.castSucc) → IsOneEdgeUncolored + (ett.series.data.coloring ci.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring ci.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring + ci.castSucc) (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate ett.series.data ci.castSucc) → ∀ (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree ci.succ.castSucc) (TashkinovStoredColors + ett.series.data ci.castSucc) (ett.series.data.coloring ci.castSucc)), (∃ (rho : + PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc))) → ∀ (gamma : Fin k), ParallelExtensionColor ett.series.data + ci.castSucc choice.selected choice.vertex gamma → ∀ (secondStable : PartialEdgeColoring E + k), IsProperEdgeColoring G secondStable → StableColoring (ett.series.data.tree + ci.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data + ci.castSucc)) choice.selected secondStable → TreeExit (ett.series.data.tree + ci.succ.castSucc) secondStable gamma choice.color choice.vertex → ett.series.data.coloring + ci.succ = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex) + → IsProperEdgeColoring G (ett.series.data.coloring ci.succ) → IsOneEdgeUncolored + (ett.series.data.coloring ci.succ) e0 → ett.series.data.stored ci.succ = {choice.color, + gamma} → ett.series.data.connectingEdges ci.succ = {choice.edge} → ett.series.data.kind + ci.succ = some TashkinovExtensionKind.PE → ett.series.data.chosenVertex ci.succ = some + choice.vertex → ett.series.data.outsideVertex ci.succ = some choice.otherEndpoint → + ett.series.data.delta ci.succ = some choice.color → ett.series.data.gamma ci.succ = some + gamma → TashkinovClosure (ett.series.data.coloring ci.succ) (ett.series.data.tree + ci.succ.castSucc) (ett.series.data.tree ci.succ.succ) → TreeSequenceInitialSegment + (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ) → + (ett.series.data.tree ci.succ.castSucc).length < (ett.series.data.tree + ci.succ.succ).length → ((⟨(↑j : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ = + ci.succ → StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (ett.series.data.tree j.castSucc) (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma) := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal j hfirst hj sigma hstable + let this : DecidableEq V := + Classical.decEq V + intro stepSegment orderTransfer stableTreeMissingEq + set q : Fin ett.rounds := (⟨(↑j : ℕ), by omega⟩ : Fin ett.rounds) + intro hqj hqn hvertexQ ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule + secondStable secondStableProper secondStableRelation exitWitness currentColoring + currentProper currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension strictExtension + htarget + have hci : ci = q := by + apply Fin.ext + simpa using (congrArg Fin.val htarget).symm + subst ci + have hvchoice : choice.vertex = v := + Option.some.inj + (currentVertex.symm.trans (by simpa [htarget] using hvertexQ)) + let Tn := ett.series.data.tree q.succ.castSucc + let B := TreeVerticesBefore T v hvFinal + have hvN : v ∈ TreeSequenceVertexSet Tn := by + simpa [Tn, hvchoice] using choice.vertexDefective.1 + have hstableN : StableColoring Tn + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma := by + simpa [Tn, hqn] using hstable + have terminalSegment : TreeSequenceInitialSegment Tn T := by + have hindex : q.succ.castSucc = + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simpa using congrArg Fin.val hqn + change TreeSequenceInitialSegment + (ett.series.data.tree q.succ.castSucc) T + rw [hindex] + exact ett.abovePenultimate + have beforeInN := + @helper_beforeInN_165 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hj hvN terminalSegment + have beforeNe : ∀ w : V, w ∈ B → w ≠ choice.vertex := by + intro w hw heq + unfold B TreeVerticesBefore at hw + have horder := (Finset.mem_filter.mp hw).2 + have heqv : w = v := heq.trans hvchoice + rcases horder with ⟨a, b, ha, hb, hab⟩ + have : a = b := T.vertex_injective (ha.trans (heqv ▸ hb).symm) + omega + have hgammaMissing : gamma ∈ MissingColors G secondStable choice.vertex := by + rw [secondStableRelation.2 choice.vertex choice.vertexDefective.1] + exact gammaRule.1 + have componentOnly := TreeExitComponentMeetsTreeOnlyAtExit Tn secondStable + gamma choice.color choice.vertex secondStableProper hgammaMissing exitWitness + have swapFixed := + @helper_swapFixed_204 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hj gamma secondStable choice beforeInN beforeNe componentOnly + have swapMissing := + @helper_swapMissing_482 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hj gamma secondStable choice swapFixed + have oldControlInN : + ∀ c : Fin k, c ∈ (B.biUnion fun w => MissingColors G (ett.series.data.coloring q.castSucc) w) + ∪ TashkinovStoredColors ett.series.data q.castSucc → c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) Tn ∪ TashkinovStoredColors ett.series.data + q.castSucc := by + intro c hc + rcases Finset.mem_union.mp hc with hc | hc + · apply Finset.mem_union.mpr + left + simp only [Finset.mem_biUnion] at hc + rcases hc with ⟨w, hw, hc⟩ + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨w, beforeInN w hw, hc⟩ + · exact Finset.mem_union.mpr (Or.inr hc) + have currentEdgeEq := + @helper_currentEdgeEq_274 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hj stableTreeMissingEq gamma secondStable choice + secondStableRelation currentColoring beforeInN swapFixed oldControlInN + have currentMissingEq := + @helper_currentMissingEq_528 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett v hvFinal j hj gamma secondStable choice secondStableRelation + currentColoring beforeInN swapMissing + have hmonotone := + (HkuMissingStoredMonotone G k ett.rounds e0 input ett.series q).1 + have beforeStableQ := + @helper_beforeStableQ_545 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hj sigma hstableN beforeInN oldControlInN currentEdgeEq + currentMissingEq hmonotone + constructor + · simpa [hqj] using beforeStableQ + · exact @helper_branch_350 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hfirst hj sigma stepSegment orderTransfer hqj hvN + terminalSegment beforeStableQ +theorem ExtensionRulesTerminalLastAppearance {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (_ : MaximumProperty ett) (_ : 0 < ett.rounds) + (v : V) + (hkind : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (hvertex : ett.series.data.chosenVertex (Fin.last ett.rounds) = some v) + (hvFinal : v ∈ TreeSequenceVertexSet T) + (j : Fin (ett.rounds + 1)) + (hfirst : ETTFirstAppearanceIndex ett v hvFinal = j.val + 1) + (hj : j.val + 1 = ett.rounds) + (sigma : PartialEdgeColoring E k) + (_ : IsProperEdgeColoring G sigma) + (_ : IsOneEdgeUncolored sigma e0) + (hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) : + StableColoringBeforeVertex T v hvFinal + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma ∧ + (0 < j.val → + StableColoring (ett.series.data.tree j.castSucc) + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma) := by + classical + let : DecidableEq V := Classical.decEq V + have stepSegment : ∀ a : Fin (ett.rounds + 1), 0 < a.val → + TreeSequenceInitialSegment (ett.series.data.tree a.castSucc) + (ett.series.data.tree a.succ) := by + intro a ha + have certified := ett.series.certified a + cases certified with + | initial => simp at ha + | SE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | RE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + have orderTransfer : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ u w, + TreeVertexOrder A u w → TreeVertexOrder B u w := by + intro A B hAB u w huw + rcases hAB with ⟨hlen, hvertices, _⟩ + rcases huw with ⟨iu, iw, hu, hw, hi⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) iu, + Fin.castLE (Nat.succ_le_succ hlen) iw, + (hvertices iu).trans hu, (hvertices iw).trans hw, hi⟩ + have stableTreeMissingEq : + ∀ {A : TreeSequence G e0} {C : Finset (Fin k)} {phi pi : PartialEdgeColoring E k}, + StableColoring A C phi pi → TreeMissingColors pi A = TreeMissingColors phi A := by + intro A C phi pi h + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨w, hw, hc⟩ + rw [h.2 w hw] at hc + exact ⟨w, hw, hc⟩ + · rintro ⟨w, hw, hc⟩ + rw [← h.2 w hw] at hc + exact ⟨w, hw, hc⟩ + let q : Fin ett.rounds := ⟨j.val, by omega⟩ + have hqj : q.castSucc = j := by + apply Fin.ext + rfl + have hqn : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + have hkindQ : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE := by + rw [hqn] + exact hkind + have hvertexQ : ett.series.data.chosenVertex q.succ = some v := by + rw [hqn] + exact hvertex + generalize htarget : q.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q htarget).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hkindQ) + cases hbad + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := + currentKind.symm.trans (by simpa [htarget] using hkindQ) + cases hbad + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_153 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett v hvFinal j hfirst hj sigma hstable stepSegment orderTransfer + stableTreeMissingEq hqj hqn hvertexQ ci previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension htarget +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean new file mode 100644 index 0000000000..63b538edc3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean @@ -0,0 +1,1878 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.EarlierPECycleFirstNonrevisitingInternal +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ExtensionRulesPEFirstAppearanceBound +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure +public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Extension Rules Terminal Stored Disjoint + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation1661Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → (0 : ℕ) < ett.rounds → ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), (0 : ℕ) < lower.rounds → lower.rounds + < ett.rounds → MaximumProperty lower → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ)))) + (TashkinovStoredColors lower.series.data (Fin.last lower.rounds)) + (lower.series.data.coloring (Fin.last lower.rounds)) sigma → + ∀ (alpha beta : Fin k), alpha ∈ TreeMissingColors sigma (lower.series.data.tree (Fin.last + (lower.rounds + (1 : ℕ)))) ∨ beta ∈ TreeMissingColors sigma (lower.series.data.tree + (Fin.last (lower.rounds + (1 : ℕ)))) → TreeInterchangeable G (lower.series.data.tree + (Fin.last (lower.rounds + (1 : ℕ)))) sigma alpha beta) → + ∀ (r : Fin ett.rounds), r.succ ≠ Fin.last ett.rounds → ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.PE → ett.series.data.kind r.succ = some + TashkinovExtensionKind.PE → ( + ∀ (r p : Fin ett.rounds), (↑r : ℕ) < (↑p : ℕ) → TreeMissingColors (ett.series.data.coloring + r.succ) (ett.series.data.tree r.succ.succ) ∪ TashkinovStoredColors ett.series.data r.succ + ⊆ TreeMissingColors (ett.series.data.coloring p.castSucc) (ett.series.data.tree + p.succ.castSucc) ∪ TashkinovStoredColors ett.series.data p.castSucc) → + ∀ (gammaR : Fin k) (secondStableR : PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice + G e0 (ett.series.data.tree r.succ.castSucc) (TashkinovStoredColors ett.series.data + r.castSucc) (ett.series.data.coloring r.castSucc)), ett.series.data.coloring r.succ = + TwoColorComponentSwap G secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) → + IsProperEdgeColoring G (ett.series.data.coloring r.succ) → IsOneEdgeUncolored + (ett.series.data.coloring r.succ) e0 → ett.series.data.stored r.succ = (insert + choiceR.color ({ gammaR } : Finset (Fin k)) : Finset (Fin k)) → ett.series.data.delta + r.succ = some choiceR.color → ett.series.data.gamma r.succ = some gammaR → + TreeSequenceInitialSegment (ett.series.data.tree r.succ.castSucc) (ett.series.data.tree + r.succ.succ) → r.succ = r.succ → + ∀ (hvr : choiceR.vertex ∈ TreeSequenceVertexSet T), ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (hab : a ≤ b) (hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ (q : Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (gammaN : Fin k), ParallelExtensionColor + ett.series.data q.castSucc choiceN.selected choiceN.vertex gammaN → + ∀ (secondStableN : PartialEdgeColoring E k), StableColoring (ett.series.data.tree + q.succ.castSucc) (insert choiceN.color (TashkinovStoredColors ett.series.data q.castSucc) + : Finset (Fin k)) choiceN.selected secondStableN → ett.series.data.coloring q.succ = + TwoColorComponentSwap G secondStableN gammaN choiceN.color (Sum.inl choiceN.vertex) → + IsProperEdgeColoring G (ett.series.data.coloring q.succ) → ett.series.data.stored q.succ = + (insert choiceN.color ({ gammaN } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choiceN.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some choiceN.vertex → ett.series.data.delta q.succ = + some choiceN.color → ett.series.data.gamma q.succ = some gammaN → + ∀ (hvn : choiceN.vertex ∈ TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett choiceN.vertex + hvn = ETTFirstAppearanceIndex ett choiceR.vertex hvr → q.succ = Fin.last ett.rounds → (↑r + : ℕ) + (1 : ℕ) < ett.rounds → + let _ : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + let _ : TreeSequence G e0 := ett.series.data.tree r.succ.succ; ( + have Th : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; choiceN.vertex ∈ + TreeSequenceVertexSet Th) → gammaR ∈ MissingColors G secondStableR choiceR.vertex → gammaR + ≠ choiceR.color → + ∀ (f : E), Incident G choiceN.vertex f → secondStableR f = some gammaR → + ∀ (g : E), Incident G choiceN.vertex g → secondStableR g = some choiceR.color → + TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) ≠ + TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceN.vertex) → + TwoColorPathComponent G secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) → + TwoColorIncidenceGraph G (ett.series.data.coloring r.succ) gammaR choiceR.color = + TwoColorIncidenceGraph G secondStableR gammaR choiceR.color → Disjoint + (ett.series.data.stored q.succ) (ett.series.data.stored r.succ) + +private theorem helper_segmentTrans_108.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B + C → TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨hab.trans hbc, ?_, ?_⟩ + · intro i + simpa using (hvbc (Fin.castLE (Nat.succ_le_succ hab) i)).trans (hvab i) + · intro i + simpa using (hebc (Fin.castLE hab i)).trans (heab i) + +private theorem helper_stepSegment_119.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ) + := by + classical + intro V E _ _ _ G k e0 input T generating ett i hi + cases ett.series.certified i with + | initial => simp at hi + | SE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | RE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + +private theorem helper_stageToStage_128.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (vn vr : V) (_ : vn ∈ TreeSequenceVertexSet T) (_ : vr ∈ + TreeSequenceVertexSet T), ( + ∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A A) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ)) → + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (hab : a ≤ b) (hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 input T generating ett vn vr hvn hvr segmentRefl segmentTrans + stepSegment a b ha hab hb + have chain (d : ℕ) (hd : a + d ≤ b) : + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) + (ett.series.data.tree ⟨a + d, by omega⟩) := by + induction d with + | zero => simpa using segmentRefl (ett.series.data.tree ⟨a, by omega⟩) + | succ d ih => + have hprev := ih (by omega) + let idx : Fin (ett.rounds + 1) := ⟨a + d, by omega⟩ + have hnext := stepSegment idx (by dsimp [idx]; omega) + have hnext' : TreeSequenceInitialSegment + (ett.series.data.tree ⟨a + d, by omega⟩) + (ett.series.data.tree ⟨a + (d + 1), by omega⟩) := by + simpa [idx, Nat.add_assoc] using hnext + exact segmentTrans hprev hnext' + have hchain := chain (b - a) (by omega) + convert hchain using 1; apply congrArg ett.series.data.tree; + apply Fin.ext; simp; omega + +private theorem helper_controlCarry_158.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (vn vr : V) (hvn : vn ∈ TreeSequenceVertexSet T) (hvr : vr ∈ + TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett vn hvn = ETTFirstAppearanceIndex ett + vr hvr → + ∀ (r p : Fin ett.rounds), (↑r : ℕ) < (↑p : ℕ) → TreeMissingColors (ett.series.data.coloring + r.succ) (ett.series.data.tree r.succ.succ) ∪ TashkinovStoredColors ett.series.data r.succ + ⊆ TreeMissingColors (ett.series.data.coloring p.castSucc) (ett.series.data.tree + p.succ.castSucc) ∪ TashkinovStoredColors ett.series.data p.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett vn vr hvn hvr hfirst r p hrp + have carryNat : + ∀ n : ℕ, r.val + 1 ≤ n → n < ett.rounds → + ∀ q : Fin ett.rounds, q.val = n → TreeMissingColors (ett.series.data.coloring r.succ) + (ett.series.data.tree r.succ.succ) ∪ TashkinovStoredColors ett.series.data r.succ ⊆ + TreeMissingColors (ett.series.data.coloring q.castSucc) (ett.series.data.tree + q.succ.castSucc) ∪ TashkinovStoredColors ett.series.data q.castSucc := by + intro n hn + induction n, hn using Nat.le_induction with + | base => + intro hnround q hq + have hqeq : q.castSucc = r.succ := by + apply Fin.ext + simp only [Fin.val_castSucc, Fin.val_succ] + omega + have htree : q.succ.castSucc = r.succ.succ := by + apply Fin.ext + simp only [Fin.val_castSucc, Fin.val_succ] + omega + simp [hqeq, htree] + | succ n hn ih => + intro hnround q hq + let prev : Fin ett.rounds := ⟨n, by omega⟩ + have hold := ih (by omega) prev rfl + have hfirst := (HkuMissingStoredMonotone G k ett.rounds e0 input + ett.series prev).1 + have hsecond := (HkuMissingStoredMonotone G k ett.rounds e0 input + ett.series prev).2 + intro c hc + have hc1 := hold hc + have hc2 := hfirst hc1 + have hc3 := hsecond hc2 + have hcolor : q.castSucc = prev.succ := by apply Fin.ext; simp [prev]; omega + have htree : q.succ.castSucc = prev.succ.succ := by + apply Fin.ext + simp [prev] + omega + simpa [hcolor, htree] using hc3 + exact carryNat p.val (by omega) p.isLt p rfl + +private theorem helper_hrBefore_273.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (r : Fin ett.rounds), + r.succ ≠ Fin.last ett.rounds → + (↑r : ℕ) + (1 : ℕ) < ett.rounds := by + classical + intro V E _ _ _ G k e0 input T generating ett r hrEarlier + have hle : r.succ.val ≤ (Fin.last ett.rounds).val := + Fin.le_last r.succ + have hne : r.succ.val ≠ (Fin.last ett.rounds).val := by + intro heq + exact hrEarlier (Fin.ext heq) + simpa using lt_of_le_of_ne hle hne + +private theorem helper_hvnTh_282.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds), ett.series.data.kind r.succ = some + TashkinovExtensionKind.PE → + let _ : DecidableEq V := Classical.decEq V; + ∀ (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc)), + r.succ = r.succ → ett.series.data.chosenVertex r.succ = some choiceR.vertex → + ∀ (hvr : choiceR.vertex ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (choiceN : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) (hvn : choiceN.vertex ∈ + TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett choiceN.vertex hvn = + ETTFirstAppearanceIndex ett choiceR.vertex hvr → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (hab : a ≤ b) (hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → (↑r : ℕ) + (1 : ℕ) < ett.rounds → + let Th : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; choiceN.vertex ∈ + TreeSequenceVertexSet Th := by + classical + intro V E _ _ _ G k e0 input T generating ett r hkindr this choiceR hrTarget hvertexr hvr q + choiceN hvn hfirst stageToStage hrBefore Th + have hboundR := ExtensionRulesPEFirstAppearanceBound G k e0 input T + generating ett r choiceR.vertex + (by simpa [hrTarget] using hkindr) + (by simpa [hrTarget] using hvertexr) hvr + have hboundN : ETTFirstAppearanceIndex ett choiceN.vertex hvn ≤ + r.val + 1 := by + rw [hfirst] + exact hboundR + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun a => + choiceN.vertex ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett a) + have hlastStage : ExtendedTashkinovLadderStage ett + (Fin.last ett.rounds) = T := by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last + have hcandidates : candidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [hlastStage] + exact hvn + let m := candidates.min' hcandidates + have hmMem : m ∈ candidates := Finset.min'_mem candidates hcandidates + have hmVal : m.val ≤ r.val := by + unfold ETTFirstAppearanceIndex at hboundN + dsimp at hboundN + change m.val + 1 ≤ r.val + 1 at hboundN + omega + let s : Fin ett.rounds := ⟨m.val, by omega⟩ + have hsm : s.castSucc = m := by apply Fin.ext; rfl + have hvMin : choiceN.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree s.succ.castSucc) := by + have hmStage : choiceN.vertex ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett m) := by + simpa [candidates] using hmMem + rw [← hsm] at hmStage + simpa [ExtendedTashkinovLadderStage, Fin.lastCases_castSucc] using hmStage + have hseg : TreeSequenceInitialSegment + (ett.series.data.tree s.succ.castSucc) Th := by + have hs := stageToStage (s.val + 1) (r.val + 1) + (by omega) (by simpa [s] using hmVal) (by omega) + convert hs using 1 <;> apply congrArg ett.series.data.tree <;> + apply Fin.ext <;> simp [s] + exact TreeSequenceInitialSegmentVertexSetSubset hseg hvMin + +private theorem helper_hchoiceSecondR_335.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (secondStableR : PartialEdgeColoring E k) + (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc)), + StableColoring (ett.series.data.tree r.succ.castSucc) (insert choiceR.color + (TashkinovStoredColors ett.series.data r.castSucc) : Finset (Fin k)) choiceR.selected + secondStableR → + let _ : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; secondStableR choiceR.edge + = some choiceR.color := by + classical + intro V E _ _ _ G k e0 input T generating ett r secondStableR choiceR secondRelationR Th + exact (secondRelationR.1 choiceR.edge + ⟨choiceR.vertex, by simpa [Th] using choiceR.vertexDefective.1, + choiceR.edgeIncident⟩ + ⟨choiceR.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), choiceR.edgeColor⟩).trans + choiceR.edgeColor + +private theorem helper_hgammaNeR_342.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)), gammaR ∈ MissingColors G secondStableR + choiceR.vertex → secondStableR choiceR.edge = some choiceR.color → gammaR ≠ choiceR.color + := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR hgammaMissingR + hchoiceSecondR heq + have hp : gammaR ∈ PresentColors G secondStableR choiceR.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choiceR.edge, choiceR.edgeIncident, by simpa [heq] using hchoiceSecondR⟩ + have hnot : gammaR ∉ PresentColors G secondStableR choiceR.vertex := by + simpa [MissingColors] using hgammaMissingR + exact hnot hp + +private theorem helper_hclosedSelectedR_350.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds), ( + ∀ {A : TreeSequence G e0} {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet A) → + TreeIncidentEdge A f) → IsProperEdgeColoring G (ett.series.data.coloring r.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring r.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring r.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc)) → + ∀ (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc)), + let Th : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; ColoredVertexSetClosed G + choiceR.selected (TreeSequenceVertexSet Th) := by + classical + intro V E _ _ _ G k e0 input T generating ett r boundaryIncident previousProperR previousOneR + previousClosedR choiceR Th f c x hf hx hfc hmiss + have hmissOld : c ∈ MissingColors G + (ett.series.data.coloring r.castSucc) x := by + rw [← choiceR.selectedStable.2 x (by simpa [Th] using hx)] + exact hmiss + have htreeOld : c ∈ TreeMissingColors + (ett.series.data.coloring r.castSucc) Th := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨x, hx, hmissOld⟩ + have heq := (sc1 G e0 Th + (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc) choiceR.selected + previousProperR previousOneR choiceR.selectedProper + choiceR.selectedOneUncolored).mp choiceR.selectedStable f + (boundaryIncident hf) + (Or.inr ⟨c, Finset.mem_union_left _ htreeOld, hfc⟩) + exact previousClosedR (by simpa [Th] using hf) hx (heq.symm.trans hfc) + hmissOld + +private theorem helper_hclosedSecondR_370.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds), ( + ∀ {A : TreeSequence G e0} {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet A) → + TreeIncidentEdge A f) → + ∀ (secondStableR : PartialEdgeColoring E k), IsProperEdgeColoring G secondStableR → + IsOneEdgeUncolored secondStableR e0 → + ∀ (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc)), + StableColoring (ett.series.data.tree r.succ.castSucc) (insert choiceR.color + (TashkinovStoredColors ett.series.data r.castSucc) : Finset (Fin k)) choiceR.selected + secondStableR → + let Th : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; ColoredVertexSetClosed G + choiceR.selected (TreeSequenceVertexSet Th) → ColoredVertexSetClosed G secondStableR + (TreeSequenceVertexSet Th) := by + classical + intro V E _ _ _ G k e0 input T generating ett r boundaryIncident secondStableR secondProperR + secondOneR choiceR secondRelationR Th hclosedSelectedR f c x hf hx hfc hmiss + have hmissSel : c ∈ MissingColors G choiceR.selected x := by + rw [← secondRelationR.2 x hx] + exact hmiss + have htreeSel : c ∈ TreeMissingColors choiceR.selected Th := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨x, hx, hmissSel⟩ + have heq := (sc1 G e0 Th + (insert choiceR.color + (TashkinovStoredColors ett.series.data r.castSucc)) + choiceR.selected secondStableR choiceR.selectedProper + choiceR.selectedOneUncolored secondProperR secondOneR).mp + secondRelationR f (boundaryIncident hf) + (Or.inr ⟨c, Finset.mem_union_left _ htreeSel, hfc⟩) + exact hclosedSelectedR hf hx (heq.symm.trans hfc) hmissSel + +private theorem helper_helemPrevR_387.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → (0 : ℕ) < ett.rounds → ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), (0 : ℕ) < lower.rounds → lower.rounds + < ett.rounds → MaximumProperty lower → ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) → + ∀ (r : Fin ett.rounds), + let _ : DecidableEq V := Classical.decEq V; + ∀ (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc)), + choiceR.vertex ∈ TreeSequenceVertexSet T → + ∀ (q : Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), choiceN.vertex ∈ TreeSequenceVertexSet T → (↑r : + ℕ) + (1 : ℕ) < ett.rounds → + let Th : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; ColoredVertexSetElementary + G (ett.series.data.coloring r.castSucc) (TreeSequenceVertexSet Th) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hLowerOne r this choiceR hvr q + choiceN hvn hrBefore Th + by_cases hrzero : r.val = 0 + · have hr0 : r = ⟨0, by omega⟩ := Fin.ext hrzero + have hbase : ColoredVertexSetElementary G + (ett.series.data.coloring 0) + (TreeSequenceVertexSet + (ett.series.data.tree ⟨1, by omega⟩)) := + (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + simpa [Th, hr0] using hbase + · obtain ⟨lower, hlowerRounds, hlowerMP, htree, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP r.val + (by omega) r.isLt + have helem : ColoredVertexSetElementary G + (ett.series.data.coloring ⟨r.val, by omega⟩) + (TreeSequenceVertexSet + (ett.series.data.tree ⟨r.val + 1, by omega⟩)) := + hLowerOne lower (by omega) (by simp [hlowerRounds]) hlowerMP + have hcolorIndex : (⟨r.val, by omega⟩ : Fin (ett.rounds + 1)) = + r.castSucc := by apply Fin.ext; rfl + have htreeIndex : (⟨r.val + 1, by omega⟩ : + Fin (ett.rounds + 2)) = r.succ.castSucc := by + apply Fin.ext + simp + rw [hcolorIndex, htreeIndex] at helem + simpa [Th] using helem + +private theorem helper_helemSecondR_413.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (secondStableR : PartialEdgeColoring E k) + (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc)), + StableColoring (ett.series.data.tree r.succ.castSucc) (insert choiceR.color + (TashkinovStoredColors ett.series.data r.castSucc) : Finset (Fin k)) choiceR.selected + secondStableR → + let Th : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; ColoredVertexSetElementary + G (ett.series.data.coloring r.castSucc) (TreeSequenceVertexSet Th) → + ColoredVertexSetElementary G secondStableR (TreeSequenceVertexSet Th) := by + classical + intro V E _ _ _ G k e0 input T generating ett r secondStableR choiceR secondRelationR Th + helemPrevR u hu v hv huv + have hd := helemPrevR hu hv huv + simpa only [← choiceR.selectedStable.2 u hu, + ← choiceR.selectedStable.2 v hv, + ← secondRelationR.2 u hu, ← secondRelationR.2 v hv] using hd + +private theorem helper_hcompDistinct_441.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)) (q : Fin ett.rounds) (choiceN : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), choiceN.vertex ≠ + choiceR.vertex → + let Th : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; choiceN.vertex ∈ + TreeSequenceVertexSet Th → ( + ∀ w ∈ TreeSequenceVertexSet Th, Sum.inl w ∈ TwoColorComponent G secondStableR gammaR + choiceR.color (Sum.inl choiceR.vertex) ↔ w = choiceR.vertex) → TwoColorComponent G + secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) ≠ TwoColorComponent G + secondStableR gammaR choiceR.color (Sum.inl choiceN.vertex) := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR q choiceN hvnvr Th + hvnTh hcomponentOnly heq + have hmem : Sum.inl choiceN.vertex ∈ + TwoColorComponent G secondStableR gammaR choiceR.color + (Sum.inl choiceR.vertex) := by + rw [heq] + rfl + exact hvnvr ((hcomponentOnly choiceN.vertex hvnTh).mp hmem) + +private theorem helper_hpathR_452.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k), IsProperEdgeColoring G secondStableR → + ∀ (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc)), + gammaR ∈ MissingColors G secondStableR choiceR.vertex → gammaR ≠ choiceR.color → + TwoColorPathComponent G secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR secondProperR choiceR + hgammaMissingR hgammaNeR + refine ⟨hgammaNeR, Sum.inl choiceR.vertex, rfl, ?_⟩ + intro x hx y hy + cases x with + | inl x => simp [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hx + | inr ex => + cases y with + | inl y => simp [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hy + | inr ey => + simp only [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hx hy + have hex : secondStableR ex = some choiceR.color := + hx.2.resolve_left (by + intro he + have hnot : gammaR ∉ PresentColors G secondStableR + choiceR.vertex := by + simpa [MissingColors] using hgammaMissingR + exact hnot (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨ex, hx.1, he⟩)) + have hey : secondStableR ey = some choiceR.color := + hy.2.resolve_left (by + intro he + have hnot : gammaR ∉ PresentColors G secondStableR + choiceR.vertex := by + simpa [MissingColors] using hgammaMissingR + exact hnot (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨ey, hy.1, he⟩)) + by_cases he : ex = ey + · exact congrArg Sum.inr he + · exact (secondProperR he ⟨choiceR.vertex, hx.1, hy.1⟩ hex hey).elim + +private theorem helper_swapColorsR_484.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)), gammaR ≠ choiceR.color → + ∀ (e : E), TwoColorComponentSwap G secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) + e = some gammaR ∨ TwoColorComponentSwap G secondStableR gammaR choiceR.color (Sum.inl + choiceR.vertex) e = some choiceR.color ↔ secondStableR e = some gammaR ∨ secondStableR e = + some choiceR.color := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR hgammaNeR e + unfold TwoColorComponentSwap + by_cases hc : Sum.inr e ∈ TwoColorComponent G secondStableR gammaR + choiceR.color (Sum.inl choiceR.vertex) + · rw [ite_eq_left hc] + by_cases hg : secondStableR e = some gammaR + · simp [hg, hgammaNeR, hgammaNeR.symm] + · by_cases hd : secondStableR e = some choiceR.color + · simp [hd, hgammaNeR, hgammaNeR.symm] + · simp [hg, hd] + · rw [ite_eq_right hc] + +private theorem helper_graphSwapR_501.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)) (_ : E), ( + ∀ (e : E), TwoColorComponentSwap G secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) + e = some gammaR ∨ TwoColorComponentSwap G secondStableR gammaR choiceR.color (Sum.inl + choiceR.vertex) e = some choiceR.color ↔ secondStableR e = some gammaR ∨ secondStableR e = + some choiceR.color) → TwoColorIncidenceGraph G (TwoColorComponentSwap G secondStableR + gammaR choiceR.color (Sum.inl choiceR.vertex)) gammaR choiceR.color = + TwoColorIncidenceGraph G secondStableR gammaR choiceR.color := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR f swapColorsR + ext x y + cases x with + | inl x => + cases y with + | inl y => simp [TwoColorIncidenceGraph] + | inr e => + simp only [TwoColorIncidenceGraph] + exact and_congr Iff.rfl (swapColorsR e) + | inr e => + cases y with + | inl y => + simp only [TwoColorIncidenceGraph] + exact and_congr Iff.rfl (swapColorsR e) + | inr f => simp [TwoColorIncidenceGraph] + +private theorem helper_hpathCurrentR_530.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)), TwoColorPathComponent G secondStableR gammaR + choiceR.color (Sum.inl choiceR.vertex) → TwoColorIncidenceGraph G + (ett.series.data.coloring r.succ) gammaR choiceR.color = TwoColorIncidenceGraph G + secondStableR gammaR choiceR.color → ( + ∀ (z : V ⊕ E), TwoColorComponent G (ett.series.data.coloring r.succ) gammaR choiceR.color z = + TwoColorComponent G secondStableR gammaR choiceR.color z) → TwoColorPathComponent G + (ett.series.data.coloring r.succ) gammaR choiceR.color (Sum.inl choiceR.vertex) := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR hpathR + graphCurrentR componentCurrentR + rcases hpathR with ⟨hne, x, hx, hsub⟩ + refine ⟨hne, x, ?_, ?_⟩ + · rw [componentCurrentR] + exact hx + · rw [graphCurrentR] + exact hsub + +private theorem helper_hdeltaCurrentR_539.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)), ett.series.data.coloring r.succ = + TwoColorComponentSwap G secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) → + gammaR ∈ MissingColors G secondStableR choiceR.vertex → gammaR ≠ choiceR.color → + choiceR.color ∈ MissingColors G (ett.series.data.coloring r.succ) choiceR.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR currentColoringR + hgammaMissingR hgammaNeR + rw [currentColoringR] + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hp + rcases hp with ⟨e, he, hec⟩ + have heComp : Sum.inr e ∈ TwoColorComponent G secondStableR gammaR + choiceR.color (Sum.inl choiceR.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + by_cases hge : secondStableR e = some gammaR + · exact (by simp [TwoColorIncidenceGraph, he, hge]) + · by_cases hde : secondStableR e = some choiceR.color + · exact (by simp [TwoColorIncidenceGraph, he, hde]) + · simp [TwoColorComponentSwap, hge, hde] at hec + rw [TwoColorComponentSwap] at hec + simp only [ite_eq_left heComp] at hec + by_cases hge : secondStableR e = some gammaR + · have hnot : gammaR ∉ PresentColors G secondStableR + choiceR.vertex := by + simpa [MissingColors] using hgammaMissingR + exact hnot (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, he, hge⟩) + · by_cases hde : secondStableR e = some choiceR.color + · simp [hde, hgammaNeR, hgammaNeR.symm] at hec + · exact hde (by simp [hge, hde] at hec) + +private theorem helper_hinterR_568.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), (0 : ℕ) < lower.rounds → lower.rounds + < ett.rounds → MaximumProperty lower → + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tnext : TreeSequence G e0 := lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ))); + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (alpha beta : Fin k), alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma + Tnext → TreeInterchangeable G Tnext sigma alpha beta) → + ∀ (r : Fin ett.rounds) (gammaR : Fin k) (choiceR : MaximumDefectiveChoice G e0 + (ett.series.data.tree r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)), IsProperEdgeColoring G (ett.series.data.coloring + r.succ) → IsOneEdgeUncolored (ett.series.data.coloring r.succ) e0 → + TreeSequenceInitialSegment (ett.series.data.tree r.succ.castSucc) (ett.series.data.tree + r.succ.succ) → choiceR.vertex ∈ TreeSequenceVertexSet T → + ∀ (q : Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), choiceN.vertex ∈ TreeSequenceVertexSet T → (↑r : + ℕ) + (1 : ℕ) < ett.rounds → + let _ : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + let Thnext : TreeSequence G e0 := ett.series.data.tree r.succ.succ; choiceR.color ∈ + MissingColors G (ett.series.data.coloring r.succ) choiceR.vertex → TreeInterchangeable G + Thnext (ett.series.data.coloring r.succ) gammaR choiceR.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hLowerTwo r gammaR choiceR currentProperR + currentOneR orderedExtensionR hvr q choiceN hvn hrBefore Th Thnext hdeltaCurrentR + obtain ⟨lower, hlowerRounds, hlowerMP, htree, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP + (r.val + 1) (by omega) hrBefore + have hcolorRaw := (hdata (Fin.last lower.rounds)).1 + have htreeLast := htree (Fin.last (lower.rounds + 1)) + have hcolor : lower.series.data.coloring (Fin.last lower.rounds) = + ett.series.data.coloring r.succ := by + calc + _ = ett.series.data.coloring + (Fin.castLE (by omega) (Fin.last lower.rounds)) := hcolorRaw + _ = ett.series.data.coloring r.succ := by + congr 1 + apply Fin.ext + simp [hlowerRounds] + have htreeEq : lower.series.data.tree + (Fin.last (lower.rounds + 1)) = Thnext := by + calc + _ = ett.series.data.tree + (Fin.castLE (by omega) (Fin.last (lower.rounds + 1))) := htreeLast + _ = Thnext := by + congr 1 + apply Fin.ext + simp [hlowerRounds] + have hinter := hLowerTwo lower (by omega) + (by simpa [hlowerRounds]) hlowerMP + dsimp at hinter + have hstableRefl : StableColoring + (lower.series.data.tree (Fin.last (lower.rounds + 1))) + (TashkinovStoredColors lower.series.data (Fin.last lower.rounds)) + (lower.series.data.coloring (Fin.last lower.rounds)) + (lower.series.data.coloring (Fin.last lower.rounds)) := by + unfold StableColoring + exact ⟨(by intros; rfl), (by intros; rfl)⟩ + have hmissingLower : choiceR.color ∈ TreeMissingColors + (lower.series.data.coloring (Fin.last lower.rounds)) + (lower.series.data.tree (Fin.last (lower.rounds + 1))) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + refine ⟨choiceR.vertex, ?_, ?_⟩ + · have hvNext : choiceR.vertex ∈ TreeSequenceVertexSet Thnext := + TreeSequenceInitialSegmentVertexSetSubset orderedExtensionR + (by simpa [Th] using choiceR.vertexDefective.1) + rw [htreeEq] + exact hvNext + · have hm : choiceR.color ∈ MissingColors G + (ett.series.data.coloring r.succ) choiceR.vertex := hdeltaCurrentR + rw [hcolor] + exact hm + have result := hinter + (lower.series.data.coloring (Fin.last lower.rounds)) + (by rw [hcolor]; exact currentProperR) + (by rw [hcolor]; exact currentOneR) + hstableRefl gammaR choiceR.color (Or.inr hmissingLower) + rw [htreeEq, hcolor] at result + exact result + +private theorem helper_hfNotP_644.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)) (q : Fin ett.rounds) (choiceN : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) (f : E), + TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) ≠ + TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceN.vertex) → Sum.inr + f ∈ TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceN.vertex) → + Sum.inr f ∉ TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl + choiceR.vertex) := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR q choiceN f + hcompDistinct hfQ hfP + apply hcompDistinct + apply Set.Subset.antisymm + · intro x hx + change (TwoColorIncidenceGraph G secondStableR gammaR + choiceR.color).connectedComponentMk x = _ at hx ⊢ + exact hx.trans ((show Sum.inr f ∈ TwoColorComponent G secondStableR + gammaR choiceR.color (Sum.inl choiceR.vertex) from hfP).symm.trans hfQ) + · intro x hx + change (TwoColorIncidenceGraph G secondStableR gammaR + choiceR.color).connectedComponentMk x = _ at hx ⊢ + exact hx.trans (hfQ.symm.trans hfP) + +private theorem helper_hgNotP_658.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)) (q : Fin ett.rounds) (choiceN : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) (g : E), + TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) ≠ + TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceN.vertex) → Sum.inr + g ∈ TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceN.vertex) → + Sum.inr g ∉ TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl + choiceR.vertex) := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR q choiceN g + hcompDistinct hgQ hgP + apply hcompDistinct + apply Set.Subset.antisymm + · intro x hx + change (TwoColorIncidenceGraph G secondStableR gammaR + choiceR.color).connectedComponentMk x = _ at hx ⊢ + exact hx.trans (hgP.symm.trans hgQ) + · intro x hx + change (TwoColorIncidenceGraph G secondStableR gammaR + choiceR.color).connectedComponentMk x = _ at hx ⊢ + exact hx.trans (hgQ.symm.trans hgP) + +private theorem helper_hgammaControlR_702.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (choiceR : + MaximumDefectiveChoice G e0 (ett.series.data.tree r.succ.castSucc) (TashkinovStoredColors + ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc)), ett.series.data.stored + r.succ = (insert choiceR.color ({ gammaR } : Finset (Fin k)) : Finset (Fin k)) → + TreeSequenceInitialSegment (ett.series.data.tree r.succ.castSucc) (ett.series.data.tree + r.succ.succ) → + let _ : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + let Thnext : TreeSequence G e0 := ett.series.data.tree r.succ.succ; gammaR ∈ TreeMissingColors + (ett.series.data.coloring r.succ) Thnext ∪ TashkinovStoredColors ett.series.data r.succ + := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR choiceR currentStoredR orderedExtensionR + Th Thnext + by_cases hm : gammaR ∈ TreeMissingColors + (ett.series.data.coloring r.succ) Thnext + · exact Finset.mem_union_left _ hm + · apply Finset.mem_union_right + have hmTh : gammaR ∉ TreeMissingColors + (ett.series.data.coloring r.succ) Th := by + intro hmOld + apply hm + simp only [TreeMissingColors, Finset.mem_biUnion] at hmOld ⊢ + rcases hmOld with ⟨v, hv, hvm⟩ + exact ⟨v, TreeSequenceInitialSegmentVertexSetSubset + orderedExtensionR hv, hvm⟩ + unfold TashkinovStoredColors + have hrsucc : r.succ.val ≠ 0 := by simp + rw [ite_eq_right hrsucc] + simp only [Finset.mem_sdiff] + refine ⟨?_, hmTh⟩ + simp only [Finset.mem_biUnion] + refine ⟨r.succ, Finset.mem_univ _, ?_⟩ + simp [currentStoredR] + +private theorem helper_hchoiceSecondN_769.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (q : Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (secondStableN : PartialEdgeColoring E k), + StableColoring (ett.series.data.tree q.succ.castSucc) (insert choiceN.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) choiceN.selected + secondStableN → secondStableN choiceN.edge = some choiceN.color := by + classical + intro V E _ _ _ G k e0 input T generating ett q choiceN secondStableN secondRelationN + exact (secondRelationN.1 choiceN.edge + ⟨choiceN.vertex, choiceN.vertexDefective.1, choiceN.edgeIncident⟩ + ⟨choiceN.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), choiceN.edgeColor⟩).trans + choiceN.edgeColor + +private theorem helper_hgammaNeN_779.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (q : Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (gammaN : Fin k) (secondStableN : + PartialEdgeColoring E k), secondStableN choiceN.edge = some choiceN.color → gammaN ∈ + MissingColors G secondStableN choiceN.vertex → gammaN ≠ choiceN.color := by + classical + intro V E _ _ _ G k e0 input T generating ett q choiceN gammaN secondStableN hchoiceSecondN + hgammaMissingN heq + have hp : gammaN ∈ PresentColors G secondStableN choiceN.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choiceN.edge, choiceN.edgeIncident, by simpa [heq] using hchoiceSecondN⟩ + have hnot : gammaN ∉ PresentColors G secondStableN choiceN.vertex := by + simpa [MissingColors] using hgammaMissingN + exact hnot hp + +private theorem helper_hchoiceCurrentQ_795.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (q : Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (gammaN : Fin k), BoundaryColorEdges G + (ett.series.data.coloring q.succ) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) gammaN = ({ choiceN.edge } : Finset E) ∧ ( + ∀ g ∈ BoundaryColorEdges G (ett.series.data.coloring q.succ) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choiceN.color, + ∃ (w : V), TreeVertexOrder (ett.series.data.tree q.succ.castSucc) w choiceN.vertex ∧ Incident + G w g) ∧ (ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (ett.series.data.coloring q.succ) (ett.series.data.tree + q.succ.castSucc), alpha ≠ choiceN.color → BoundaryColorEdges G (ett.series.data.coloring + q.succ) (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) alpha = ∅) → + ett.series.data.coloring q.succ choiceN.edge = some gammaN := by + classical + intro V E _ _ _ G k e0 input T generating ett q choiceN gammaN hparallelN + have hm : choiceN.edge ∈ BoundaryColorEdges G + (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + gammaN := by + rw [hparallelN.1] + simp + exact (Finset.mem_filter.mp hm).2 + +private theorem helper_hdeltaMissingN_808.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (q : Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (gammaN : Fin k) (secondStableN : + PartialEdgeColoring E k), ett.series.data.coloring q.succ = TwoColorComponentSwap G + secondStableN gammaN choiceN.color (Sum.inl choiceN.vertex) → q.succ = Fin.last ett.rounds + → gammaN ∈ MissingColors G secondStableN choiceN.vertex → gammaN ≠ choiceN.color → + choiceN.color ∈ MissingColors G (ett.series.data.coloring (Fin.last ett.rounds)) + choiceN.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett q choiceN gammaN secondStableN currentColoringN + hqLast hgammaMissingN hgammaNeN + rw [← hqLast, currentColoringN] + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + rcases hpresent with ⟨e, he, hec⟩ + have heComp : Sum.inr e ∈ TwoColorComponent G secondStableN gammaN + choiceN.color (Sum.inl choiceN.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + by_cases hge : secondStableN e = some gammaN + · exact (by simp [TwoColorIncidenceGraph, he, hge]) + · by_cases hde : secondStableN e = some choiceN.color + · exact (by simp [TwoColorIncidenceGraph, he, hde]) + · simp [TwoColorComponentSwap, hge, hde] at hec + rw [TwoColorComponentSwap] at hec + simp only [ite_eq_left heComp] at hec + by_cases hge : secondStableN e = some gammaN + · have hnot : gammaN ∉ PresentColors G secondStableN + choiceN.vertex := by + simpa [MissingColors] using hgammaMissingN + exact hnot (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, he, hge⟩) + · by_cases hde : secondStableN e = some choiceN.color + · simp [hde, hgammaNeN, hgammaNeN.symm] at hec + · exact hde (by simp [hge, hde] at hec) + +private theorem helper_hfInternalN_837.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (choiceR : MaximumDefectiveChoice G e0 + (ett.series.data.tree r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)) (_ : choiceR.vertex ∈ TreeSequenceVertexSet T) (q : + Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (_ : choiceN.vertex ∈ TreeSequenceVertexSet T), ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (hab : a ≤ b) (hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ (f : E) (p : Fin ett.rounds), f ∈ InternalEdges G (TreeSequenceVertexSet + (ett.series.data.tree p.succ.castSucc)) → f ∈ InternalEdges G (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett r choiceR hvr q choiceN hvn stageToStage f p + hfInternal + have hseg : TreeSequenceInitialSegment + (ett.series.data.tree p.succ.castSucc) + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + have hs := stageToStage (p.val + 1) ett.rounds (by omega) + (by omega) le_rfl + convert hs using 1 <;> apply congrArg ett.series.data.tree <;> + apply Fin.ext <;> simp + simp only [InternalEdges, Finset.mem_filter, Finset.mem_univ, true_and] + intro v hvf + exact TreeSequenceInitialSegmentVertexSetSubset hseg + ((Finset.mem_filter.mp hfInternal).2 v hvf) + +private theorem helper_hgInternalN_851.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (choiceR : MaximumDefectiveChoice G e0 + (ett.series.data.tree r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)) (_ : choiceR.vertex ∈ TreeSequenceVertexSet T) (q : + Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (_ : choiceN.vertex ∈ TreeSequenceVertexSet T), ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (hab : a ≤ b) (hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ (g : E) (p : Fin ett.rounds), g ∈ InternalEdges G (TreeSequenceVertexSet + (ett.series.data.tree p.succ.castSucc)) → g ∈ InternalEdges G (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett r choiceR hvr q choiceN hvn stageToStage g p + hgInternal + have hseg : TreeSequenceInitialSegment + (ett.series.data.tree p.succ.castSucc) + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + have hs := stageToStage (p.val + 1) ett.rounds (by omega) + (by omega) le_rfl + convert hs using 1 <;> apply congrArg ett.series.data.tree <;> + apply Fin.ext <;> simp + simp only [InternalEdges, Finset.mem_filter, Finset.mem_univ, true_and] + intro v hvg + exact TreeSequenceInitialSegmentVertexSetSubset hseg + ((Finset.mem_filter.mp hgInternal).2 v hvg) + +private theorem helper_hfNeChoice_865.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)) (q : Fin ett.rounds) (choiceN : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) (f : E), Incident G + choiceN.vertex f → secondStableR f = some gammaR → + ∀ (cycle : TwoColorCycle G (ett.series.data.coloring r.succ) gammaR choiceR.color), Sum.inr f + ∈ TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceN.vertex) → + Sum.inr f ∉ TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl + choiceR.vertex) → ett.series.data.coloring r.succ f = some gammaR → Sum.inr f ∈ + cycle.walk.support → + ∀ (p : Fin ett.rounds), f ∈ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + p.succ.castSucc)) → TreeIncidentEdge (ett.series.data.tree p.succ.castSucc) f → + ett.series.data.coloring p.castSucc f = some gammaR → ett.series.data.coloring q.succ f = + ett.series.data.coloring p.castSucc f → ett.series.data.coloring (Fin.last ett.rounds) f = + some gammaR → choiceN.edge ∈ BoundaryEdges G (TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) → f ∈ InternalEdges G (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → f ≠ choiceN.edge := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR q choiceN f hfInc + hfColor cycle hfQ hfNotP hfCurrent hfCycle p hfInternal hfIncidentP hfAtP hfFinalRaw + hfFinal hchoiceBoundaryN hfInternalN heq + subst f + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hchoiceBoundaryN + rcases hchoiceBoundaryN with ⟨u, hu, v, hv, huv⟩ + have hvin : Incident G v choiceN.edge := by simp [Incident, huv] + exact hv ((Finset.mem_filter.mp hfInternalN).2 v hvin) + +private theorem helper_hgNeChoice_873.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)) (q : Fin ett.rounds) (choiceN : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) (g : E), Incident G + choiceN.vertex g → secondStableR g = some choiceR.color → + ∀ (cycle : TwoColorCycle G (ett.series.data.coloring r.succ) gammaR choiceR.color), Sum.inr g + ∈ TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceN.vertex) → + Sum.inr g ∉ TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl + choiceR.vertex) → ett.series.data.coloring r.succ g = some choiceR.color → Sum.inr g ∈ + cycle.walk.support → + ∀ (p : Fin ett.rounds), g ∈ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + p.succ.castSucc)) → TreeIncidentEdge (ett.series.data.tree p.succ.castSucc) g → + ett.series.data.coloring p.castSucc g = some choiceR.color → ett.series.data.coloring + q.succ g = ett.series.data.coloring p.castSucc g → ett.series.data.coloring (Fin.last + ett.rounds) g = some choiceR.color → choiceN.edge ∈ BoundaryEdges G (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → g ∈ InternalEdges G + (TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → g ≠ + choiceN.edge := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR q choiceN g hgInc + hgColor cycle hgQ hgNotP hgCurrent hgCycle p hgInternal hgIncidentP hgAtP hgFinalRaw + hgFinal hchoiceBoundaryN hgInternalN heq + subst g + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hchoiceBoundaryN + rcases hchoiceBoundaryN with ⟨u, hu, v, hv, huv⟩ + have hvin : Incident G v choiceN.edge := by simp [Incident, huv] + exact hv ((Finset.mem_filter.mp hgInternalN).2 v hvin) + +private theorem helper_hgammaRGammaN_881.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (gammaR : Fin k) (q : Fin ett.rounds) (choiceN : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) (gammaN : Fin k), + IsProperEdgeColoring G (ett.series.data.coloring q.succ) → q.succ = Fin.last ett.rounds → + ∀ (f : E), Incident G choiceN.vertex f → ett.series.data.coloring (Fin.last ett.rounds) f = + some gammaR → ett.series.data.coloring q.succ choiceN.edge = some gammaN → f ≠ + choiceN.edge → gammaR ≠ gammaN := by + classical + intro V E _ _ _ G k e0 input T generating ett gammaR q choiceN gammaN currentProperN hqLast f + hfInc hfFinal hchoiceCurrentQ hfNeChoice heq + have hfFinalQ : ett.series.data.coloring q.succ f = some gammaR := by + rw [hqLast] + exact hfFinal + exact (currentProperN hfNeChoice + ⟨choiceN.vertex, hfInc, choiceN.edgeIncident⟩ hfFinalQ) + (by simpa [heq] using hchoiceCurrentQ) + +private theorem helper_hdeltaRGammaN_889.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (choiceR : MaximumDefectiveChoice G e0 + (ett.series.data.tree r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)) (q : Fin ett.rounds) (choiceN : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) (gammaN : Fin k), + IsProperEdgeColoring G (ett.series.data.coloring q.succ) → q.succ = Fin.last ett.rounds → + ∀ (g : E), Incident G choiceN.vertex g → ett.series.data.coloring (Fin.last ett.rounds) g = + some choiceR.color → ett.series.data.coloring q.succ choiceN.edge = some gammaN → g ≠ + choiceN.edge → choiceR.color ≠ gammaN := by + classical + intro V E _ _ _ G k e0 input T generating ett r choiceR q choiceN gammaN currentProperN hqLast + g hgInc hgFinal hchoiceCurrentQ hgNeChoice heq + have hgFinalQ : ett.series.data.coloring q.succ g = + some choiceR.color := by + rw [hqLast] + exact hgFinal + exact (currentProperN hgNeChoice + ⟨choiceN.vertex, hgInc, choiceN.edgeIncident⟩ hgFinalQ) + (by simpa [heq] using hchoiceCurrentQ) + +private theorem helper_hgammaRDeltaN_898.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (gammaR : Fin k) (q : Fin ett.rounds) (choiceN : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) (f : E), Incident G + choiceN.vertex f → ett.series.data.coloring (Fin.last ett.rounds) f = some gammaR → + choiceN.color ∈ MissingColors G (ett.series.data.coloring (Fin.last ett.rounds)) + choiceN.vertex → gammaR ≠ choiceN.color := by + classical + intro V E _ _ _ G k e0 input T generating ett gammaR q choiceN f hfInc hfFinal hdeltaMissingN heq + have hp : choiceN.color ∈ PresentColors G + (ett.series.data.coloring (Fin.last ett.rounds)) choiceN.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hfInc, by simpa [heq] using hfFinal⟩ + have hnot : choiceN.color ∉ PresentColors G + (ett.series.data.coloring (Fin.last ett.rounds)) choiceN.vertex := by + simpa [MissingColors] using hdeltaMissingN + exact hnot hp + +private theorem helper_hdeltaRDeltaN_908.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (choiceR : MaximumDefectiveChoice G e0 + (ett.series.data.tree r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)) (q : Fin ett.rounds) (choiceN : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) (g : E), Incident G + choiceN.vertex g → ett.series.data.coloring (Fin.last ett.rounds) g = some choiceR.color → + choiceN.color ∈ MissingColors G (ett.series.data.coloring (Fin.last ett.rounds)) + choiceN.vertex → choiceR.color ≠ choiceN.color := by + classical + intro V E _ _ _ G k e0 input T generating ett r choiceR q choiceN g hgInc hgFinal + hdeltaMissingN heq + have hp : choiceN.color ∈ PresentColors G + (ett.series.data.coloring (Fin.last ett.rounds)) choiceN.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨g, hgInc, by simpa [heq] using hgFinal⟩ + have hnot : choiceN.color ∉ PresentColors G + (ett.series.data.coloring (Fin.last ett.rounds)) choiceN.vertex := by + simpa [MissingColors] using hdeltaMissingN + exact hnot hp + +private theorem helper_continuation_1704.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (r : Fin ett.rounds) (gammaR : Fin k) (secondStableR : + PartialEdgeColoring E k) (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree + r.succ.castSucc) (TashkinovStoredColors ett.series.data r.castSucc) + (ett.series.data.coloring r.castSucc)), ett.series.data.stored r.succ = (insert + choiceR.color ({ gammaR } : Finset (Fin k)) : Finset (Fin k)) → choiceR.vertex ∈ + TreeSequenceVertexSet T → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (hab : a ≤ b) (hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a_2 : ¬a < + ett.rounds + (2 : ℕ)) ↦ + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a_2 : ¬b < + ett.rounds + (2 : ℕ)) ↦ + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ (q : Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (gammaN : Fin k) (secondStableN : + PartialEdgeColoring E k), ett.series.data.coloring q.succ = TwoColorComponentSwap G + secondStableN gammaN choiceN.color (Sum.inl choiceN.vertex) → IsProperEdgeColoring G + (ett.series.data.coloring q.succ) → ett.series.data.stored q.succ = (insert choiceN.color + ({ gammaN } : Finset (Fin k)) : Finset (Fin k)) → ett.series.data.connectingEdges q.succ = + ({ choiceN.edge } : Finset E) → ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ett.series.data.chosenVertex q.succ = some choiceN.vertex → + ett.series.data.delta q.succ = some choiceN.color → ett.series.data.gamma q.succ = some + gammaN → choiceN.vertex ∈ TreeSequenceVertexSet T → q.succ = Fin.last ett.rounds → + ∀ (f : E), Incident G choiceN.vertex f → secondStableR f = some gammaR → + ∀ (g : E), Incident G choiceN.vertex g → secondStableR g = some choiceR.color → + ∀ (cycle : TwoColorCycle G (ett.series.data.coloring r.succ) gammaR choiceR.color), Sum.inr f + ∈ TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl choiceN.vertex) → + Sum.inr g ∈ TwoColorComponent G secondStableR gammaR choiceR.color (Sum.inl + choiceN.vertex) → Sum.inr f ∉ TwoColorComponent G secondStableR gammaR choiceR.color + (Sum.inl choiceR.vertex) → Sum.inr g ∉ TwoColorComponent G secondStableR gammaR + choiceR.color (Sum.inl choiceR.vertex) → ett.series.data.coloring r.succ f = some gammaR → + ett.series.data.coloring r.succ g = some choiceR.color → Sum.inr f ∈ cycle.walk.support → + Sum.inr g ∈ cycle.walk.support → + ∀ (p : Fin ett.rounds), f ∈ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + p.succ.castSucc)) → g ∈ InternalEdges G (TreeSequenceVertexSet (ett.series.data.tree + p.succ.castSucc)) → TreeIncidentEdge (ett.series.data.tree p.succ.castSucc) f → + TreeIncidentEdge (ett.series.data.tree p.succ.castSucc) g → ett.series.data.coloring + p.castSucc f = some gammaR → ett.series.data.coloring p.castSucc g = some choiceR.color → + ett.series.data.coloring q.succ f = ett.series.data.coloring p.castSucc f → + ett.series.data.coloring q.succ g = ett.series.data.coloring p.castSucc g → + ett.series.data.coloring (Fin.last ett.rounds) f = some gammaR → ett.series.data.coloring + (Fin.last ett.rounds) g = some choiceR.color → choiceN.edge ∈ BoundaryEdges G + (TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → gammaN ∈ + MissingColors G secondStableN choiceN.vertex → gammaN ≠ choiceN.color → Disjoint + (ett.series.data.stored q.succ) (ett.series.data.stored r.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett r gammaR secondStableR choiceR currentStoredR hvr + stageToStage q choiceN gammaN secondStableN currentColoringN currentProperN currentStoredN + currentEdgesN currentKindN currentVertexN currentDeltaN currentGammaN hvn hqLast f hfInc + hfColor g hgInc hgColor cycle hfQ hgQ hfNotP hgNotP hfCurrent hgCurrent hfCycle hgCycle p + hfInternal hgInternal hfIncidentP hgIncidentP hfAtP hgAtP hfFinalRaw hgFinalRaw hfFinal + hgFinal hchoiceBoundaryN hgammaMissingN hgammaNeN + have hparallelN := HkuParallelBoundaryStructure G k ett.rounds e0 input + ett.series q choiceN.edge choiceN.color gammaN choiceN.vertex + currentKindN currentEdgesN currentDeltaN currentGammaN currentVertexN + have hchoiceCurrentQ := + @helper_hchoiceCurrentQ_795 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@q) (@choiceN) (@gammaN) (@hparallelN) + have hchoiceCurrentN : ett.series.data.coloring + (Fin.last ett.rounds) choiceN.edge = some gammaN := by + rw [← hqLast] + exact hchoiceCurrentQ + have hdeltaMissingN := + @helper_hdeltaMissingN_808 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@q) (@choiceN) (@gammaN) (@secondStableN) + (@currentColoringN) (@hqLast) (@hgammaMissingN) (@hgammaNeN) + have hfInternalN := + @helper_hfInternalN_837 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@choiceR) (@hvr) (@q) (@choiceN) (@hvn) + (@stageToStage) (@f) (@p) (@hfInternal) + have hgInternalN := + @helper_hgInternalN_851 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@choiceR) (@hvr) (@q) (@choiceN) (@hvn) + (@stageToStage) (@g) (@p) (@hgInternal) + have hfNeChoice := + @helper_hfNeChoice_865 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) (@q) + (@choiceN) (@f) (@hfInc) (@hfColor) (@cycle) (@hfQ) (@hfNotP) (@hfCurrent) (@hfCycle) + (@p) (@hfInternal) (@hfIncidentP) (@hfAtP) (@hfFinalRaw) (@hfFinal) (@hchoiceBoundaryN) + (@hfInternalN) + have hgNeChoice := + @helper_hgNeChoice_873 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) (@q) + (@choiceN) (@g) (@hgInc) (@hgColor) (@cycle) (@hgQ) (@hgNotP) (@hgCurrent) (@hgCycle) + (@p) (@hgInternal) (@hgIncidentP) (@hgAtP) (@hgFinalRaw) (@hgFinal) (@hchoiceBoundaryN) + (@hgInternalN) + have hgammaRGammaN := + @helper_hgammaRGammaN_881 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@gammaR) (@q) (@choiceN) (@gammaN) (@currentProperN) + (@hqLast) (@f) (@hfInc) (@hfFinal) (@hchoiceCurrentQ) (@hfNeChoice) + have hdeltaRGammaN := + @helper_hdeltaRGammaN_889 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@choiceR) (@q) (@choiceN) (@gammaN) + (@currentProperN) (@hqLast) (@g) (@hgInc) (@hgFinal) (@hchoiceCurrentQ) (@hgNeChoice) + have hgammaRDeltaN := + @helper_hgammaRDeltaN_898 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@gammaR) (@q) (@choiceN) (@f) (@hfInc) (@hfFinal) + (@hdeltaMissingN) + have hdeltaRDeltaN := + @helper_hdeltaRDeltaN_908 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@choiceR) (@q) (@choiceN) (@g) (@hgInc) + (@hgFinal) (@hdeltaMissingN) + rw [currentStoredN, currentStoredR] + apply Finset.disjoint_left.mpr + intro c hcN hcR + simp only [Finset.mem_insert, Finset.mem_singleton] at hcN hcR + rcases hcN with hcN | hcN <;> rcases hcR with hcR | hcR + · exact hdeltaRDeltaN (hcR.symm.trans hcN) + · exact hgammaRDeltaN (hcR.symm.trans hcN) + · exact hdeltaRGammaN (hcR.symm.trans hcN) + · exact hgammaRGammaN (hcR.symm.trans hcN) + +private theorem helper_continuation_1661.{u_1, u_2} : + helperContinuation1661Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hLowerTwo r hrEarlier hkindn hkindr + controlCarry gammaR secondStableR choiceR currentColoringR currentProperR currentOneR + currentStoredR currentDeltaR currentGammaR orderedExtensionR hrTarget hvr stageToStage q + choiceN gammaN gammaRuleN secondStableN secondRelationN currentColoringN currentProperN + currentStoredN currentEdgesN currentKindN currentVertexN currentDeltaN currentGammaN hvn + hfirst hqLast hrBefore Th Thnext hvnTh hgammaMissingR hgammaNeR f hfInc hfColor g hgInc + hgColor hcompDistinct hpathR graphCurrentR + have componentCurrentR (z : Sum V E) : + TwoColorComponent G (ett.series.data.coloring r.succ) gammaR + choiceR.color z = + TwoColorComponent G secondStableR gammaR choiceR.color z := by + unfold TwoColorComponent + rw [graphCurrentR] + have hpathCurrentR := + @helper_hpathCurrentR_530 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) (@hpathR) + (@graphCurrentR) (@componentCurrentR) + have hdeltaCurrentR := + @helper_hdeltaCurrentR_539 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) + (@currentColoringR) (@hgammaMissingR) (@hgammaNeR) + have hinterR := + @helper_hinterR_568 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hMP) (@hLowerTwo) (@r) (@gammaR) (@choiceR) + (@currentProperR) (@currentOneR) (@orderedExtensionR) (@hvr) (@q) (@choiceN) (@hvn) + (@hrBefore) (@hdeltaCurrentR) + have hrVertexNext : choiceR.vertex ∈ TreeSequenceVertexSet Thnext := + TreeSequenceInitialSegmentVertexSetSubset orderedExtensionR + (by simpa [Th] using choiceR.vertexDefective.1) + have hnVertexNext : choiceN.vertex ∈ TreeSequenceVertexSet Thnext := + TreeSequenceInitialSegmentVertexSetSubset orderedExtensionR hvnTh + have cycleComp := TwoColorInterchangeableDistinctComponentCycle G Thnext + (ett.series.data.coloring r.succ) gammaR choiceR.color currentProperR + (Sum.inl choiceR.vertex) (Sum.inl choiceN.vertex) hpathCurrentR hinterR + ⟨choiceR.vertex, hrVertexNext, by rw [componentCurrentR]; rfl⟩ + ⟨choiceN.vertex, hnVertexNext, by rw [componentCurrentR]; rfl⟩ + (by simpa only [componentCurrentR] using hcompDistinct) + rcases cycleComp with ⟨cycle, hcycleSupport⟩ + have hfQ : Sum.inr f ∈ TwoColorComponent G secondStableR gammaR + choiceR.color (Sum.inl choiceN.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, hfInc, hfColor] + have hgQ : Sum.inr g ∈ TwoColorComponent G secondStableR gammaR + choiceR.color (Sum.inl choiceN.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, hgInc, hgColor] + have hfNotP := + @helper_hfNotP_644 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) (@q) + (@choiceN) (@f) (@hcompDistinct) (@hfQ) + have hgNotP := + @helper_hgNotP_658 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) (@q) + (@choiceN) (@g) (@hcompDistinct) (@hgQ) + have hfCurrent : ett.series.data.coloring r.succ f = some gammaR := by + rw [currentColoringR] + simpa [TwoColorComponentSwap, hfNotP] using hfColor + have hgCurrent : ett.series.data.coloring r.succ g = some choiceR.color := by + rw [currentColoringR] + simpa [TwoColorComponentSwap, hgNotP] using hgColor + have hfCycle : Sum.inr f ∈ cycle.walk.support := by + rw [hcycleSupport, componentCurrentR] + exact hfQ + have hgCycle : Sum.inr g ∈ cycle.walk.support := by + rw [hcycleSupport, componentCurrentR] + exact hgQ + have hcycleMeets : ∃ v ∈ TreeSequenceVertexSet + (ett.series.data.tree r.succ.castSucc), + Sum.inl v ∈ cycle.walk.support := by + refine ⟨choiceN.vertex, hvnTh, ?_⟩ + rw [hcycleSupport, componentCurrentR] + rfl + obtain ⟨p, hrp, hpKind, hpRevisiting, hpColor, hpInternal⟩ := + EarlierPECycleFirstNonrevisitingInternal G k ett.rounds e0 input + ett.series r hrEarlier gammaR choiceR.color + (by simpa [hrTarget] using hkindr) + (by simpa [hrTarget] using currentGammaR) + (by simpa [hrTarget] using currentDeltaR) + cycle hcycleMeets hkindn + have hdeltaControlR : choiceR.color ∈ + TreeMissingColors (ett.series.data.coloring r.succ) Thnext ∪ + TashkinovStoredColors ett.series.data r.succ := by + apply Finset.mem_union_left + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨choiceR.vertex, hrVertexNext, hdeltaCurrentR⟩ + have hgammaControlR := + @helper_hgammaControlR_702 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@choiceR) (@currentStoredR) + (@orderedExtensionR) + have hdeltaControlP := controlCarry r p hrp hdeltaControlR + have hgammaControlP := controlCarry r p hrp hgammaControlR + have hfInternal := hpInternal f hfCycle + have hgInternal := hpInternal g hgCycle + have hfIncidentP : TreeIncidentEdge + (ett.series.data.tree p.succ.castSucc) f := by + refine ⟨choiceN.vertex, ?_, hfInc⟩ + simpa [InternalEdges] using + (Finset.mem_filter.mp hfInternal).2 choiceN.vertex hfInc + have hgIncidentP : TreeIncidentEdge + (ett.series.data.tree p.succ.castSucc) g := by + refine ⟨choiceN.vertex, ?_, hgInc⟩ + simpa [InternalEdges] using + (Finset.mem_filter.mp hgInternal).2 choiceN.vertex hgInc + have hfAtP : ett.series.data.coloring p.castSucc f = some gammaR := by + rw [hpColor] + exact hfCurrent + have hgAtP : ett.series.data.coloring p.castSucc g = some choiceR.color := by + rw [hpColor] + exact hgCurrent + have hpq : p.val ≤ q.val := by + have hqv := congrArg Fin.val hqLast + simp at hqv + omega + have hfFinalRaw := (SameColorSeriesPreserved G k ett.rounds e0 input + ett.series p q hpq f gammaR hfIncidentP hfAtP + (by simpa [Thnext] using hgammaControlP)).2 hfInternal + have hgFinalRaw := (SameColorSeriesPreserved G k ett.rounds e0 input + ett.series p q hpq g choiceR.color hgIncidentP hgAtP + (by simpa [Thnext] using hdeltaControlP)).2 hgInternal + have hfFinal : ett.series.data.coloring (Fin.last ett.rounds) f = + some gammaR := by + rw [← hqLast] + exact hfFinalRaw.trans hfAtP + have hgFinal : ett.series.data.coloring (Fin.last ett.rounds) g = + some choiceR.color := by + rw [← hqLast] + exact hgFinalRaw.trans hgAtP + have hchoiceBoundaryN : choiceN.edge ∈ BoundaryEdges G + (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + rcases choiceN.edgeDefective with ⟨c, hc, he⟩ + have hb := (Finset.mem_filter.mp he).1 + simpa [hqLast] using hb + have hchoiceSecondN := + @helper_hchoiceSecondN_769 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@q) (@choiceN) (@secondStableN) (@secondRelationN) + have hgammaMissingN : gammaN ∈ MissingColors G secondStableN + choiceN.vertex := by + rw [secondRelationN.2 choiceN.vertex choiceN.vertexDefective.1] + exact gammaRuleN.1 + have hgammaNeN := + @helper_hgammaNeN_779 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@q) (@choiceN) (@gammaN) (@secondStableN) + (@hchoiceSecondN) (@hgammaMissingN) + have hchoiceCompN : Sum.inr choiceN.edge ∈ + TwoColorComponent G secondStableN gammaN choiceN.color + (Sum.inl choiceN.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choiceN.edgeIncident, hchoiceSecondN] + exact @helper_continuation_1704 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) + (@currentStoredR) (@hvr) (@stageToStage) (@q) (@choiceN) (@gammaN) (@secondStableN) + (@currentColoringN) (@currentProperN) (@currentStoredN) (@currentEdgesN) (@currentKindN) + (@currentVertexN) (@currentDeltaN) (@currentGammaN) (@hvn) (@hqLast) (@f) (@hfInc) + (@hfColor) (@g) (@hgInc) (@hgColor) (@cycle) (@hfQ) (@hgQ) (@hfNotP) (@hgNotP) (@hfCurrent) + (@hgCurrent) (@hfCycle) (@hgCycle) (@p) (@hfInternal) (@hgInternal) (@hfIncidentP) + (@hgIncidentP) (@hfAtP) (@hgAtP) (@hfFinalRaw) (@hgFinalRaw) (@hfFinal) (@hgFinal) + (@hchoiceBoundaryN) (@hgammaMissingN) (@hgammaNeN) +private theorem helper_branch_1399.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → (0 : ℕ) < ett.rounds → ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), (0 : ℕ) < lower.rounds → lower.rounds + < ett.rounds → MaximumProperty lower → ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) → ( + ∀ {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : + ExtendedTashkinovTree G k e0 input T' generating'), (0 : ℕ) < lower.rounds → lower.rounds + < ett.rounds → MaximumProperty lower → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ))) : + TreeSequence G e0) (TashkinovStoredColors lower.series.data (Fin.last lower.rounds : Fin + (lower.rounds + (1 : ℕ)))) (lower.series.data.coloring (Fin.last lower.rounds : Fin + (lower.rounds + (1 : ℕ)))) sigma → + ∀ (alpha beta : Fin k), alpha ∈ TreeMissingColors sigma (lower.series.data.tree (Fin.last + (lower.rounds + (1 : ℕ))) : TreeSequence G e0) ∨ beta ∈ TreeMissingColors sigma + (lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ))) : TreeSequence G e0) → + TreeInterchangeable G (lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ))) : + TreeSequence G e0) sigma alpha beta) → + ∀ (r : Fin ett.rounds) (vn : V), r.succ ≠ Fin.last ett.rounds → ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.PE → ett.series.data.kind r.succ = some + TashkinovExtensionKind.PE → ett.series.data.chosenVertex (Fin.last ett.rounds) = some vn → + ∀ (hvn : vn ∈ TreeSequenceVertexSet T), ( + ∀ {A : TreeSequence G e0} {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet A) → + TreeIncidentEdge A f) → ( + ∀ (r p : Fin ett.rounds), (↑r : ℕ) < (↑p : ℕ) → TreeMissingColors (ett.series.data.coloring + r.succ) (ett.series.data.tree r.succ.succ) ∪ TashkinovStoredColors ett.series.data r.succ + ⊆ TreeMissingColors (ett.series.data.coloring p.castSucc) (ett.series.data.tree + p.succ.castSucc) ∪ TashkinovStoredColors ett.series.data p.castSucc) → + ∀ (gammaR : Fin k) (secondStableR : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStableR → IsOneEdgeUncolored secondStableR e0 → IsProperEdgeColoring G + (ett.series.data.coloring r.castSucc) → IsOneEdgeUncolored (ett.series.data.coloring + r.castSucc) e0 → ColoredVertexSetClosed G (ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) → + ∀ (choiceR : MaximumDefectiveChoice G e0 (ett.series.data.tree r.succ.castSucc) + (TashkinovStoredColors ett.series.data r.castSucc) (ett.series.data.coloring r.castSucc)), + ParallelExtensionColor ett.series.data r.castSucc choiceR.selected choiceR.vertex gammaR → + StableColoring (ett.series.data.tree r.succ.castSucc) (insert choiceR.color + (TashkinovStoredColors ett.series.data r.castSucc) : Finset (Fin k)) choiceR.selected + secondStableR → TreeExit (ett.series.data.tree r.succ.castSucc) secondStableR gammaR + choiceR.color choiceR.vertex → ett.series.data.coloring r.succ = TwoColorComponentSwap G + secondStableR gammaR choiceR.color (Sum.inl choiceR.vertex) → IsProperEdgeColoring G + (ett.series.data.coloring r.succ) → IsOneEdgeUncolored (ett.series.data.coloring r.succ) + e0 → ett.series.data.stored r.succ = (insert choiceR.color ({ gammaR } : Finset (Fin k)) : + Finset (Fin k)) → ett.series.data.delta r.succ = some choiceR.color → + ett.series.data.gamma r.succ = some gammaR → TreeSequenceInitialSegment + (ett.series.data.tree r.succ.castSucc) (ett.series.data.tree r.succ.succ) → r.succ = + r.succ → vn ≠ choiceR.vertex → ett.series.data.chosenVertex r.succ = some choiceR.vertex → + ∀ (hvr : choiceR.vertex ∈ TreeSequenceVertexSet T), ETTFirstAppearanceIndex ett vn hvn = + ETTFirstAppearanceIndex ett choiceR.vertex hvr → ( + ∀ (a b : ℕ), (1 : ℕ) ≤ a → + ∀ (hab : a ≤ b) (hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree (⟨a, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))))) → + ∀ (q : Fin ett.rounds) (choiceN : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (gammaN : Fin k), ParallelExtensionColor + ett.series.data q.castSucc choiceN.selected choiceN.vertex gammaN → + ∀ (secondStableN : PartialEdgeColoring E k), StableColoring (ett.series.data.tree + q.succ.castSucc) (insert choiceN.color (TashkinovStoredColors ett.series.data q.castSucc) + : Finset (Fin k)) choiceN.selected secondStableN → ett.series.data.coloring q.succ = + TwoColorComponentSwap G secondStableN gammaN choiceN.color (Sum.inl choiceN.vertex) → + IsProperEdgeColoring G (ett.series.data.coloring q.succ) → ett.series.data.stored q.succ = + (insert choiceN.color ({ gammaN } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choiceN.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some choiceN.vertex → ett.series.data.delta q.succ = + some choiceN.color → ett.series.data.gamma q.succ = some gammaN → Fin.last ett.rounds = + q.succ → Disjoint (ett.series.data.stored q.succ) (ett.series.data.stored r.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hLowerOne hLowerTwo r vn hrEarlier + hkindn hkindr hvertexn hvn boundaryIncident controlCarry gammaR secondStableR secondProperR + secondOneR previousProperR previousOneR previousClosedR choiceR gammaRuleR secondRelationR + exitR currentColoringR currentProperR currentOneR currentStoredR currentDeltaR + currentGammaR orderedExtensionR hrTarget hvnvr hvertexr hvr hfirst stageToStage q choiceN + gammaN gammaRuleN secondStableN secondRelationN currentColoringN currentProperN + currentStoredN currentEdgesN currentKindN currentVertexN currentDeltaN currentGammaN hnTarget + have hvnChoice : choiceN.vertex = vn := + Option.some.inj (currentVertexN.symm.trans + (by simpa [hnTarget] using hvertexn)) + subst vn + have hqLast : q.succ = Fin.last ett.rounds := hnTarget.symm + have hrBefore := + @helper_hrBefore_273 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@hrEarlier) + let Th := ett.series.data.tree r.succ.castSucc + let Thnext := ett.series.data.tree r.succ.succ + have hvnTh := + @helper_hvnTh_282 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@hkindr) (@choiceR) (@hrTarget) (@hvertexr) + (@hvr) (@q) (@choiceN) (@hvn) (@hfirst) (@stageToStage) (@hrBefore) + have hgammaMissingR : gammaR ∈ MissingColors G secondStableR + choiceR.vertex := by + rw [secondRelationR.2 choiceR.vertex choiceR.vertexDefective.1] + exact gammaRuleR.1 + have hchoiceBoundaryR : choiceR.edge ∈ + BoundaryEdges G (TreeSequenceVertexSet Th) := by + rcases choiceR.edgeDefective with ⟨c, hc, he⟩ + simpa [Th, BoundaryColorEdges] using (Finset.mem_filter.mp he).1 + have hchoiceSecondR := + @helper_hchoiceSecondR_335 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@r) (@secondStableR) (@choiceR) (@secondRelationR) + have hgammaNeR := + @helper_hgammaNeR_342 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) + (@hgammaMissingR) (@hchoiceSecondR) + have hclosedSelectedR := + @helper_hclosedSelectedR_350 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@r) (@boundaryIncident) (@previousProperR) + (@previousOneR) (@previousClosedR) (@choiceR) + have hclosedSecondR := + @helper_hclosedSecondR_370 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@r) (@boundaryIncident) (@secondStableR) + (@secondProperR) (@secondOneR) (@choiceR) (@secondRelationR) (@hclosedSelectedR) + have helemPrevR := + @helper_helemPrevR_387 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@hLowerOne) (@r) (@choiceR) + (@hvr) (@q) (@choiceN) (@hvn) (@hrBefore) + have helemSecondR := + @helper_helemSecondR_413 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@secondStableR) (@choiceR) (@secondRelationR) + (@helemPrevR) + have hgammaNotMissingN : gammaR ∉ MissingColors G secondStableR + choiceN.vertex := by + intro hm + have hd := helemSecondR hvnTh + (by simpa [Th] using choiceR.vertexDefective.1) hvnvr + exact (Finset.disjoint_left.mp hd) hm hgammaMissingR + have hdeltaNotMissingN : choiceR.color ∉ MissingColors G secondStableR + choiceN.vertex := + hclosedSecondR hchoiceBoundaryR hvnTh hchoiceSecondR + obtain ⟨f, hfInc, hfColor⟩ : ∃ f : E, Incident G choiceN.vertex f ∧ + secondStableR f = some gammaR := by + have hp : gammaR ∈ PresentColors G secondStableR choiceN.vertex := by + simpa [MissingColors] using hgammaNotMissingN + simpa [PresentColors] using hp + obtain ⟨g, hgInc, hgColor⟩ : ∃ g : E, Incident G choiceN.vertex g ∧ + secondStableR g = some choiceR.color := by + have hp : choiceR.color ∈ PresentColors G secondStableR choiceN.vertex := by + simpa [MissingColors] using hdeltaNotMissingN + simpa [PresentColors] using hp + have hcomponentOnly := TreeExitComponentMeetsTreeOnlyAtExit Th secondStableR + gammaR choiceR.color choiceR.vertex secondProperR hgammaMissingR exitR + have hcompDistinct := + @helper_hcompDistinct_441 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) (@q) + (@choiceN) (@hvnvr) (@hvnTh) (@hcomponentOnly) + have hpathR := + @helper_hpathR_452 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@secondProperR) + (@choiceR) (@hgammaMissingR) (@hgammaNeR) + have swapColorsR := @helper_swapColorsR_484 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) + (@hgammaNeR) + have graphSwapR := + @helper_graphSwapR_501 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@r) (@gammaR) (@secondStableR) (@choiceR) (@f) + (@swapColorsR) + have graphCurrentR : TwoColorIncidenceGraph G + (ett.series.data.coloring r.succ) gammaR choiceR.color = + TwoColorIncidenceGraph G secondStableR gammaR choiceR.color := by + rw [currentColoringR] + exact graphSwapR + exact @helper_continuation_1661 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@hLowerTwo) (@r) (@hrEarlier) + (@hkindn) (@hkindr) (@controlCarry) (@gammaR) (@secondStableR) (@choiceR) + (@currentColoringR) (@currentProperR) (@currentOneR) (@currentStoredR) (@currentDeltaR) + (@currentGammaR) (@orderedExtensionR) (@hrTarget) (@hvr) (@stageToStage) (@q) (@choiceN) + (@gammaN) (@gammaRuleN) (@secondStableN) (@secondRelationN) (@currentColoringN) + (@currentProperN) (@currentStoredN) (@currentEdgesN) (@currentKindN) (@currentVertexN) + (@currentDeltaN) (@currentGammaN) (@hvn) (@hfirst) (@hqLast) (@hrBefore) (@hvnTh) + (@hgammaMissingR) (@hgammaNeR) (@f) (@hfInc) (@hfColor) (@g) (@hgInc) (@hgColor) + (@hcompDistinct) (@hpathR) (@graphCurrentR) +theorem ExtensionRulesTerminalStoredDisjoint {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hLowerOne : ∀ {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input T' generating'), + 0 < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hLowerTwo : ∀ {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input T' generating'), + 0 < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tnext : TreeSequence G e0 := + lower.series.data.tree (Fin.last (lower.rounds + 1)) + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring Tnext + (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma Tnext ∨ + beta ∈ TreeMissingColors sigma Tnext) → + TreeInterchangeable G Tnext sigma alpha beta)) + (r : Fin ett.rounds) (vn vr : V) + (hrEarlier : r.succ ≠ Fin.last ett.rounds) + (hvnvr : vn ≠ vr) + (hkindn : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (hkindr : ett.series.data.kind r.succ = some TashkinovExtensionKind.PE) + (hvertexn : ett.series.data.chosenVertex (Fin.last ett.rounds) = some vn) + (hvertexr : ett.series.data.chosenVertex r.succ = some vr) + (hvn : vn ∈ TreeSequenceVertexSet T) (hvr : vr ∈ TreeSequenceVertexSet T) + (hfirst : ETTFirstAppearanceIndex ett vn hvn = + ETTFirstAppearanceIndex ett vr hvr) : + Disjoint (ett.series.data.stored (Fin.last ett.rounds)) (ett.series.data.stored r.succ) := by + classical + let : DecidableEq V := Classical.decEq V + have segmentRefl (A : TreeSequence G e0) : TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + apply TreeSequenceInitialSegment.trans <;> assumption + have stepSegment := + @helper_stepSegment_119 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) + have stageToStage := @helper_stageToStage_128 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@vn) (@vr) (@hvn) (@hvr) (@segmentRefl) + (@segmentTrans) (@stepSegment) + have boundaryIncident {A : TreeSequence G e0} {f : E} + (hf : f ∈ BoundaryEdges G (TreeSequenceVertexSet A)) : + TreeIncidentEdge A f := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hf + rcases hf with ⟨u, hu, v, hv, huv⟩ + exact ⟨u, hu, by simp [Incident, huv]⟩ + have controlCarry := @helper_controlCarry_158 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@vn) (@vr) (@hvn) (@hvr) (@hfirst) + generalize hrTarget : r.succ = targetR + have certR := ett.series.certified targetR + cases certR with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => exact (Fin.succ_ne_zero r hrTarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad := currentKind.symm.trans (by simpa [hrTarget] using hkindr) + simp at hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad := currentKind.symm.trans (by simpa [hrTarget] using hkindr) + simp at hbad + | PE i previousProperR previousOneR previousClosedR previousNotStrongR + noRevisitingR choiceR seriesAlternativeFailsR gammaR gammaRuleR + secondStableR secondProperR secondOneR secondRelationR exitR + currentColoringR currentProperR currentOneR currentStoredR currentEdgesR + currentKindR currentVertexR currentOutsideR currentDeltaR currentGammaR + closedExtensionR orderedExtensionR strictExtensionR => + have hi : i = r := by + apply Fin.ext + simpa using (congrArg Fin.val hrTarget).symm + subst i + have hvrChoice : choiceR.vertex = vr := + Option.some.inj (currentVertexR.symm.trans (by simpa [hrTarget] using hvertexr)) + subst vr + generalize hnTarget : Fin.last ett.rounds = targetN + have certN := ett.series.certified targetN + cases certN with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val hnTarget + simp at hv + omega + | SE q previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad := currentKind.symm.trans (by simpa [hnTarget] using hkindn) + simp at hbad + | RE q previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hbad := currentKind.symm.trans (by simpa [hnTarget] using hkindn) + simp at hbad + | PE q previousProperN previousOneN previousClosedN previousNotStrongN + noRevisitingN choiceN seriesAlternativeFailsN gammaN gammaRuleN + secondStableN secondProperN secondOneN secondRelationN exitN + currentColoringN currentProperN currentOneN currentStoredN currentEdgesN + currentKindN currentVertexN currentOutsideN currentDeltaN currentGammaN + closedExtensionN orderedExtensionN strictExtensionN => + exact @helper_branch_1399 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) (@hLowerOne) + (@hLowerTwo) (@r) (@vn) (@hrEarlier) (@hkindn) (@hkindr) (@hvertexn) (@hvn) + (@boundaryIncident) (@controlCarry) (@gammaR) (@secondStableR) (@secondProperR) + (@secondOneR) (@previousProperR) (@previousOneR) (@previousClosedR) (@choiceR) + (@gammaRuleR) (@secondRelationR) (@exitR) (@currentColoringR) (@currentProperR) + (@currentOneR) (@currentStoredR) (@currentDeltaR) (@currentGammaR) + (@orderedExtensionR) (@hrTarget) (@hvnvr) (@hvertexr) (@hvr) (@hfirst) + (@stageToStage) (@q) (@choiceN) (@gammaN) (@gammaRuleN) (@secondStableN) + (@secondRelationN) (@currentColoringN) (@currentProperN) (@currentStoredN) + (@currentEdgesN) (@currentKindN) (@currentVertexN) (@currentDeltaN) + (@currentGammaN) (@hnTarget) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/FiniteStrictGrowthReachesTerminal.lean b/LeanPool/GoldbergSeymour/FiniteStrictGrowthReachesTerminal.lean new file mode 100644 index 0000000000..e23c5b51d5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/FiniteStrictGrowthReachesTerminal.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin + +public import Mathlib.Data.Fintype.Basic + +public import LeanPool.GoldbergSeymour.Preamble + +/-! +# Finite Strict Growth Reaches Terminal + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem FiniteStrictGrowthReachesTerminal + {V : Type*} [Finite V] (State Terminal : Finset V → Prop) + (grow : ∀ X, State X → ¬ Terminal X → + ∃ Y, State Y ∧ X < Y) + {X0 : Finset V} (hX0 : State X0) : + ∃ X, State X ∧ Terminal X := by + classical + let := Fintype.ofFinite V + suffices hgo : ∀ X, State X → ∃ Y, State Y ∧ Terminal Y by + exact hgo X0 hX0 + intro X + induction X using + (measure (fun X : Finset V => Fintype.card V - X.card)).wf.induction with + | h X ih => + intro hX + by_cases hterminal : Terminal X + · exact ⟨X, hX, hterminal⟩ + · obtain ⟨Y, hY, hXY⟩ := grow X hX hterminal + apply ih Y + · have hcard : X.card < Y.card := Finset.card_lt_card hXY + have hYcard : Y.card ≤ Fintype.card V := Finset.card_le_univ Y + have hXcard : X.card < Fintype.card V := lt_of_lt_of_le hcard hYcard + exact Nat.sub_lt_sub_left hXcard hcard + · exact hY + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/FirstEntryClipping.lean b/LeanPool/GoldbergSeymour/FirstEntryClipping.lean new file mode 100644 index 0000000000..4669db04a2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/FirstEntryClipping.lean @@ -0,0 +1,161 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeExitPath +public import Mathlib.Combinatorics.SimpleGraph.Walk.Decomp +public import Mathlib.Combinatorics.SimpleGraph.Paths + +/-! +# P2716_T2_First Entry Clipping + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma P2716_T2_FirstEntryClipping {V E : Type*} + [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (U : TreeSequence G e0) + (alpha beta : Fin k) (a b : V) + (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a) (Sum.inl b)) + (hpath : P.IsPath) + (hmissing : alpha ∈ MissingColors G phi a ∨ beta ∈ MissingColors G phi a) + (ha : a ∉ TreeSequenceVertexSet U) (hb : b ∈ TreeSequenceVertexSet U) : + ∃ (v : V) + (Q : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a) (Sum.inl v)), + TreeExitPath U phi alpha beta a v Q ∧ + (∀ x, x ∈ Q.support → x ∈ P.support) ∧ Q.length ≤ P.length ∧ + (∀ f : E, Sum.inr f ∈ P.support → + (∀ w, Incident G w f → w ∈ TreeSequenceVertexSet U) → + Q.length < P.length) := by + classical + let _ := Fintype.ofFinite V + let H := TwoColorIncidenceGraph G phi alpha beta + let X := TreeSequenceVertexSet U + have chooseFirst : ∀ {u v : Sum V E} (p : H.Walk u v) + (S : Finset (Sum V E)), + {x ∈ S | x ∈ p.support}.Nonempty → + ∃ x ∈ S, ∃ (hx : x ∈ p.support), + ∀ t ∈ S, t ∈ (p.takeUntil x hx).support → t = x := by + intro u v p S hnonempty + have firstErase : ∃ x ∈ S, ∃ (hx : x ∈ p.support), + {t ∈ S.erase x | t ∈ (p.takeUntil x hx).support} = ∅ := by + simp only [← Finset.subset_empty] + induction hn : p.length + S.card using Nat.strong_induction_on + generalizing S v with + | _ n ih => + simp only [Finset.Nonempty, Finset.mem_filter] at hnonempty + obtain ⟨x, hxS, hxP⟩ := hnonempty + obtain hempty | hmore := Finset.eq_empty_or_nonempty + {t ∈ S.erase x | t ∈ (p.takeUntil x hxP).support} + · exact ⟨x, hxS, hxP, hempty.le⟩ + · have hlt : (p.takeUntil x hxP).length + (S.erase x).card < n := by + rw [← Finset.card_erase_add_one hxS] at hn + have hle := p.length_takeUntil_le_length hxP + omega + obtain ⟨y, hyS, hyP, hyempty⟩ := + ih _ hlt (p.takeUntil x hxP) (S.erase x) hmore rfl + refine ⟨y, Finset.mem_of_mem_erase hyS, + p.support_takeUntil_subset_support hxP hyP, ?_⟩ + rwa [p.takeUntil_takeUntil, Finset.erase_right_comm, + Finset.filter_erase, Finset.erase_eq_of_notMem] at hyempty + simp only [Finset.mem_filter, Finset.mem_erase, ne_eq, not_and, and_imp] + rintro hxy - + exact p.notMem_support_takeUntil_support_takeUntil_subset + (Ne.symm hxy) hxP hyP + obtain ⟨x, hxS, hxP, hempty⟩ := firstErase + refine ⟨x, hxS, hxP, ?_⟩ + suffices {t ∈ S | t ∈ (p.takeUntil x hxP).support} ⊆ {x} by + simpa [Finset.subset_iff] using this + rwa [Finset.filter_erase, ← Finset.subset_empty, + ← Finset.subset_insert_iff, LawfulSingleton.insert_empty_eq] at hempty + let S : Finset (Sum V E) := X.image Sum.inl + obtain ⟨z, hzS, hzP, hzfirst⟩ := chooseFirst P S + ⟨Sum.inl b, by simp [S, X, hb, P.end_mem_support]⟩ + obtain ⟨v, hvX, hvz⟩ : ∃ v, v ∈ X ∧ Sum.inl v = z := by + simpa [S] using hzS + subst z + let Q := P.takeUntil (Sum.inl v) hzP + have hQonly : ∀ w ∈ X, (Sum.inl w ∈ Q.support ↔ w = v) := by + intro w hw + constructor + · intro hmem + exact Sum.inl.inj (hzfirst (Sum.inl w) (by simp [S, hw]) hmem) + · rintro rfl + exact Q.end_mem_support + have hav : a ≠ v := by rintro rfl; exact ha hvX + have hQlen : 2 ≤ Q.length := by + have hpos : 0 < Q.length := by + apply Nat.pos_of_ne_zero + intro hn + exact hav (Sum.inl.inj (SimpleGraph.Walk.length_eq_zero_iff.mp hn).eq) + by_contra hnot + have hlen : Q.length = 1 := by omega + have hadj := Q.adj_getVert_succ (i := 0) (by omega) + have hend : Q.getVert 1 = Sum.inl v := by + have heq := Q.getVert_length + rwa [hlen] at heq + rw [Q.getVert_zero, hend] at hadj + exact hadj.elim + have hQpath : Q.IsPath := hpath.takeUntil _ + refine ⟨v, Q, ⟨hQpath, hQlen, ha, hvX, hmissing, hQonly⟩, + fun x hx => P.support_takeUntil_subset_support hzP hx, + P.length_takeUntil_le_length hzP, ?_⟩ + intro f hf hall + have hfnot : Sum.inr f ∉ Q.support := by + intro hmem + obtain ⟨j, hj, hjle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hmem + have hjpos : 0 < j := by + by_contra h + have hj0 : j = 0 := by omega + rw [hj0, Q.getVert_zero] at hj + simp at hj + have hjlt : j < Q.length := by + by_contra h + have heq : j = Q.length := by omega + rw [heq, Q.getVert_length] at hj + simp at hj + have hprev := Q.adj_getVert_succ (i := j - 1) (by omega) + have hsucc : j - 1 + 1 = j := by omega + rw [hsucc, hj] at hprev + cases hw : Q.getVert (j - 1) with + | inr e => rw [hw] at hprev; exact hprev.elim + | inl w => + rw [hw] at hprev + have hwX := hall w hprev.1 + have hwQ : Sum.inl w ∈ Q.support := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mpr ⟨j - 1, hw, by omega⟩ + have hwv := (hQonly w hwX).mp hwQ + have heq : Q.getVert (j - 1) = Q.getVert Q.length := by + rw [hw, hwv, Q.getVert_length] + have hi : j - 1 = Q.length := by + apply hQpath.getVert_injOn + · change j - 1 ≤ Q.length + omega + · change Q.length ≤ Q.length + exact le_rfl + · exact heq + omega + have hle := P.length_takeUntil_le_length hzP + apply lt_of_le_of_ne hle + intro heq + obtain ⟨j, hj, hjle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hjQ : j ≤ Q.length := by + rw [show Q.length = P.length from heq] + exact hjle + apply hfnot + apply SimpleGraph.Walk.mem_support_iff_exists_getVert.mpr + refine ⟨j, ?_, hjQ⟩ + exact (P.getVert_takeUntil hzP hjQ).trans hj + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/FixedPairMaximalTashkinovTree.lean b/LeanPool/GoldbergSeymour/FixedPairMaximalTashkinovTree.lean new file mode 100644 index 0000000000..8f5ab92653 --- /dev/null +++ b/LeanPool/GoldbergSeymour/FixedPairMaximalTashkinovTree.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Fixed Pair Maximal Tashkinov Tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A Tashkinov tree maximal by vertex-set inclusion for the fixed uncolored edge and coloring. -/ +def FixedPairMaximalTashkinovTree {V E : Type*} [Fintype E] (G : LooplessMultigraph V E) + {k : ℕ} (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) : Prop := + TashkinovTree G e0 phi T ∧ + ∀ S : TreeSequence G e0, + TashkinovTree G e0 phi S → + TreeSequenceVertexSet T ⊆ TreeSequenceVertexSet S → + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet T + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GeneralHighIndexElementary.lean b/LeanPool/GoldbergSeymour/GeneralHighIndexElementary.lean new file mode 100644 index 0000000000..594d471f17 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GeneralHighIndexElementary.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CriticalCoreExists +public import LeanPool.GoldbergSeymour.ElementaryTransfer + +public import + LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible + +public import LeanPool.GoldbergSeymour.MaximumDegreeRestrict +public import LeanPool.GoldbergSeymour.ThmGS2 + +/-! +# General High Index Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem GeneralHighIndexElementary {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) + (hG : MaximumDegree G + 2 ≤ ChromaticIndex G) : Elementary G := by + classical + obtain ⟨F, hχ, hcrit⟩ := CriticalCoreExists G + apply ElementaryTransfer G F hχ + refine ThmGS2 (RestrictEdges G F) ?_ hcrit + have hdeg := MaximumDegreeRestrict G F + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GlobalMaximumTriple.lean b/LeanPool/GoldbergSeymour/GlobalMaximumTriple.lean new file mode 100644 index 0000000000..e0ed55087e --- /dev/null +++ b/LeanPool/GoldbergSeymour/GlobalMaximumTriple.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovOrder + +/-! +# Global Maximum Triple + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- +A critical coloring triple with a Tashkinov tree attaining the graph's maximum Tashkinov order. -/ +def GlobalMaximumTriple {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) : Prop := + KTriple G k e0 phi ∧ TashkinovTree G e0 phi T ∧ (TreeSequenceVertexSet T).card = TashkinovOrder G + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GlobalMaximumTripleExists.lean b/LeanPool/GoldbergSeymour/GlobalMaximumTripleExists.lean new file mode 100644 index 0000000000..2726c9ee1c --- /dev/null +++ b/LeanPool/GoldbergSeymour/GlobalMaximumTripleExists.lean @@ -0,0 +1,188 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChromaticIndexSpec + +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple + +/-! +# Global Maximum Triple Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem GlobalMaximumTripleExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) + (hcritical : Critical G) (hindex : ChromaticIndex G = k + 1) + (hdegree : MaximumDegree G + 1 ≤ k) : + ∃ (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0), + GlobalMaximumTriple G k e0 phi T := by + classical + have hedge : Nonempty E := by + by_contra hne + have hempty : IsEmpty E := not_nonempty_iff.mp hne + let coloring : PartialEdgeColoring E 0 := fun e => isEmptyElim e + have hhas : HasKEdgeColoring G 0 := by + refine ⟨coloring, ?_, ?_⟩ + · intro e f c hef hadj he hf + exact isEmptyElim e + · intro e + exact isEmptyElim e + have hzero : ChromaticIndex G = 0 := + Nat.eq_zero_of_le_zero ((ChromaticIndexSpec G).2 0 hhas) + have hk : 1 ≤ k := by omega + have : 2 ≤ ChromaticIndex G := by omega + omega + have hd : ChromaticIndex (DeleteEdge G (Classical.choice hedge)) ≤ k := by + have hc := hcritical (Classical.choice hedge) + rw [hindex] at hc + omega + obtain ⟨psi, hpsi, hpsifull⟩ := (ChromaticIndexSpec (DeleteEdge G (Classical.choice hedge))).1 + let phi : PartialEdgeColoring E k := fun e => + if he : e = Classical.choice hedge then none + else (psi ⟨e, by simp [he]⟩).map (fun z => Fin.castLE hd z) + have hproper : IsProperEdgeColoring G phi := by + intro e f c hef hadj he hf + have he0 : e ≠ Classical.choice hedge := by + intro he0 + simp [phi, he0] at he + have hf0 : f ≠ Classical.choice hedge := by + intro hf0 + simp [phi, hf0] at hf + obtain ⟨ce, hce⟩ := hpsifull ⟨e, by simp [he0]⟩ + obtain ⟨cf, hcf⟩ := hpsifull ⟨f, by simp [hf0]⟩ + have hceq : Fin.castLE hd ce = c := by + simpa [phi, he0, hce] using he + have hcfeq : Fin.castLE hd cf = c := by + simpa [phi, hf0, hcf] using hf + have hcfce : cf = ce := by + apply Fin.ext + have heval := congrArg Fin.val hceq + have hfval := congrArg Fin.val hcfeq + simp at heval hfval + omega + have hadj' : AdjacentEdges (DeleteEdge G (Classical.choice hedge)) + ⟨e, by simp [he0]⟩ ⟨f, by simp [hf0]⟩ := by + exact hadj + rw [hcfce] at hcf + exact (hpsi (e := (⟨e, by simp [he0]⟩)) (f := (⟨f, by simp [hf0]⟩)) + (c := ce) (fun h => hef (congrArg Subtype.val h)) hadj' hce) hcf + have hone : IsOneEdgeUncolored phi (Classical.choice hedge) := by + refine ⟨?_, ?_⟩ + · simp [phi] + · intro e he + simp only [he, ↓reduceDIte, Option.map_eq_some_iff, ↓existsAndEq, and_true, phi] + exact hpsifull ⟨e, by simp [he]⟩ + have htriple : KTriple G k (Classical.choice hedge) phi := + ⟨hcritical, hindex, hdegree, hproper, hone⟩ + obtain ⟨x, y, hends⟩ := + (Sym2.exists (f := fun z => G.ends (Classical.choice hedge) = z)).mp + ⟨G.ends (Classical.choice hedge), rfl⟩ + have hxy : x ≠ y := by + intro h + apply G.loopless (Classical.choice hedge) x + rw [hends, h] + let short : TreeSequence G (Classical.choice hedge) := + { length := 1 + positive := by omega + vertex := fun i => if i.val = 0 then x else y + edge := fun _ => Classical.choice hedge + vertex_injective := by + intro a b hab + apply Fin.ext + by_cases ha : a.val = 0 <;> by_cases hb : b.val = 0 + · simp [ha, hb] at hab + omega + · simp only [Nat.reduceAdd, ha, ↓reduceIte, hb] at hab + exact (hxy hab).elim + · simp [ha, hb] at hab + exact (hxy hab.symm).elim + · simp [ha, hb] at hab + omega + edge_injective := by + intro a b hab + exact Subsingleton.elim a b + first_edge := rfl + attaches := by + intro j + have hj : j = ⟨0, by omega⟩ := Fin.ext (by + have hj' := j.isLt + omega) + subst j + refine ⟨⟨0, by omega⟩, ?_⟩ + rw [hends] + exact Sym2.eq_swap } + have hshorttree : TashkinovTree G (Classical.choice hedge) phi short := by + intro j hj + have hj' := j.isLt + change j.val < 1 at hj' + omega + have hshortcard : (TreeSequenceVertexSet short).card = 2 := by + have himage : (Finset.image (fun i : Fin (1 + 1) => + if i.val = 0 then x else y) Finset.univ) = {x, y} := by + ext v + simp [eq_comm] + simp only [TreeSequenceVertexSet, short] + rw [himage] + simp [hxy] + have hparam : ChromaticIndex G - 1 = k := by omega + have hshortmem : 2 ∈ + (Finset.range (Fintype.card V + 1)).filter (fun n => + ∃ (e : E) (p : PartialEdgeColoring E (ChromaticIndex G - 1)) + (R : TreeSequence G e), + KTriple G (ChromaticIndex G - 1) e p ∧ + TashkinovTree G e p R ∧ + (TreeSequenceVertexSet R).card = n) := by + simp only [Finset.mem_filter, Finset.mem_range] + constructor + · have hv : (TreeSequenceVertexSet short).card ≤ Fintype.card V := + Finset.card_le_card (Finset.subset_univ _) + omega + · refine ⟨Classical.choice hedge, ?_, short, ?_, ?_, ?_⟩ + · exact hparam.symm ▸ phi + · exact hparam.symm ▸ htriple + · exact hparam.symm ▸ hshorttree + · exact hshortcard + have hlower : 2 ≤ TashkinovOrder G := by + unfold TashkinovOrder + dsimp + exact Finset.le_max' _ _ (Finset.mem_insert_of_mem hshortmem) + have hmaxmem : TashkinovOrder G ∈ + insert 0 ((Finset.range (Fintype.card V + 1)).filter (fun n => + ∃ (e : E) (p : PartialEdgeColoring E (ChromaticIndex G - 1)) + (R : TreeSequence G e), + KTriple G (ChromaticIndex G - 1) e p ∧ + TashkinovTree G e p R ∧ + (TreeSequenceVertexSet R).card = n)) := by + unfold TashkinovOrder + dsimp + exact Finset.max'_mem _ _ + have horder_mem : TashkinovOrder G ∈ + (Finset.range (Fintype.card V + 1)).filter (fun n => + ∃ (e : E) (p : PartialEdgeColoring E (ChromaticIndex G - 1)) + (R : TreeSequence G e), + KTriple G (ChromaticIndex G - 1) e p ∧ + TashkinovTree G e p R ∧ + (TreeSequenceVertexSet R).card = n) := by + have hnezero : TashkinovOrder G ≠ 0 := by omega + simpa [Finset.mem_insert, hnezero] using hmaxmem + simp only [Finset.mem_filter] at horder_mem + rcases horder_mem with ⟨hbound, e, p, R, hkp, htp, hcard⟩ + refine ⟨e, hparam ▸ p, R, ?_⟩ + cases hparam + exact ⟨hkp, htp, hcard⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchy.lean b/LeanPool/GoldbergSeymour/GoodHierarchy.lean new file mode 100644 index 0000000000..ccc2233d95 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchy.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt + +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed + +/-! +# Good Hierarchy + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A hierarchy with disjoint auxiliary color pairs satisfying avoidance, refresh and closure +conditions. +-/ +structure GoodHierarchy {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} {base : HierarchyBase ett phi} + (H : TashkinovHierarchy ett base) where + /-- The auxiliary color or color family used by this configuration. -/ + gamma : Fin (H.dividerCount + 1) → Fin k → Finset (Fin k) + twoColors : ∀ j eta, eta ∈ HierarchyStoredColorsAt H j → (gamma j eta).card = 2 + avoidance : + ∀ j eta, + eta ∈ HierarchyStoredColorsAt H j → + gamma j eta ⊆ HierarchyStageMissingColors H j \ HierarchySegmentColors H j eta + disjointPairs : + ∀ j eta theta, + eta ∈ HierarchyStoredColorsAt H j → + theta ∈ HierarchyStoredColorsAt H j → eta ≠ theta → Disjoint (gamma j eta) (gamma j theta) + uniqueRefresh : + ∀ i : Fin H.dividerCount, + ∃! eta : Fin k, eta ∈ HierarchyStoredColorsAt H i.succ ∧ gamma i.succ eta ⊆ + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ TreeSequenceVertexSet + (HierarchyStarredStage H i.castSucc)).biUnion fun v => MissingColors G phi v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt H i.succ, theta ≠ eta → gamma i.succ theta = gamma + i.castSucc theta + parallelBase : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + ett.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G phi base.core ((HierarchyStoredColorsAt H 0).biUnion (gamma 0)) ∧ + 4 ≤ + ((TreeMissingColors phi Tn ∩ TreeMissingColors phi base.closure) \ + (HierarchyStoredColorsAt H 0).biUnion (gamma 0)).card + minusClosed : + ∀ i : Fin H.dividerCount, + TreeColorSetMinusClosed G phi (H.stage i.succ.castSucc) + ((HierarchyStoredColorsAt H i.succ).biUnion (gamma i.castSucc)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyCommonOriginalBaseTransport.lean b/LeanPool/GoldbergSeymour/GoodHierarchyCommonOriginalBaseTransport.lean new file mode 100644 index 0000000000..a0652aab80 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyCommonOriginalBaseTransport.lean @@ -0,0 +1,181 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesColoringProperties + +public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport + +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Good Hierarchy Common Original Base Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem GoodHierarchyCommonOriginalBaseTransport {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (J U : TreeSequence G e0) + (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett sigma J) + (baseJ : HierarchyBase corrJ.replacementETT sigma) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett sigma U) : + ∃ baseU : HierarchyBase corrU.replacementETT sigma, + baseU.core = baseJ.core ∧ + baseU.closure = baseJ.closure ∧ + baseU.supportPosition.val = baseJ.supportPosition.val := by + classical + rcases corrJ with ⟨replacementInputJ, replacementSeriesJ, replacementETTJ, + rungAgreementJ, seriesPresentationJ, finalGeneratingColoringJ, + ladderTreesAgreeJ, storedColorsAgreeJ, connectingEdgesAgreeJ, + extensionKindsAgreeJ, replacementProperJ, replacementOneUncoloredJ, + replacementStableJ⟩ + cases replacementETTJ with + | mk roundsJ roundsPositiveJ replacementDataJ aboveJ strictJ belowJ generatingJ => + cases rungAgreementJ + have seriesSameJ : replacementDataJ = replacementSeriesJ := + eq_of_heq seriesPresentationJ + cases seriesSameJ + rcases corrU with ⟨replacementInputU, replacementSeriesU, replacementETTU, + rungAgreementU, seriesPresentationU, finalGeneratingColoringU, + ladderTreesAgreeU, storedColorsAgreeU, connectingEdgesAgreeU, + extensionKindsAgreeU, replacementProperU, replacementOneUncoloredU, + replacementStableU⟩ + cases replacementETTU with + | mk roundsU roundsPositiveU replacementDataU aboveU strictU belowU generatingU => + cases rungAgreementU + have seriesSameU : replacementDataU = replacementSeriesU := + eq_of_heq seriesPresentationU + cases seriesSameU + let corrJU : CorrespondingExtendedTashkinovTree G k e0 + { rounds := ett.rounds + roundsPositive := roundsPositiveJ + series := replacementSeriesJ + abovePenultimate := aboveJ + strictAbovePenultimate := strictJ + belowFinal := belowJ + generatingColoring := generatingJ } + sigma U := { + replacementInput := replacementInputU + replacementSeries := replacementSeriesU + replacementETT := { + rounds := ett.rounds + roundsPositive := roundsPositiveU + series := replacementSeriesU + abovePenultimate := aboveU + strictAbovePenultimate := strictU + belowFinal := belowU + generatingColoring := generatingU } + rungAgreement := rfl + seriesPresentation := by rfl + finalGeneratingColoring := finalGeneratingColoringU + ladderTreesAgree := by + intro i + exact (ladderTreesAgreeU i).trans (ladderTreesAgreeJ i).symm + storedColorsAgree := by + intro i + exact (storedColorsAgreeU i).trans (storedColorsAgreeJ i).symm + connectingEdgesAgree := by + intro i + exact (connectingEdgesAgreeU i).trans (connectingEdgesAgreeJ i).symm + extensionKindsAgree := by + intro i + exact (extensionKindsAgreeU i).trans (extensionKindsAgreeJ i).symm + replacementProper := replacementProperU + replacementOneUncolored := replacementOneUncoloredU + replacementStable := by + intro i + have treeMissingEq : TreeMissingColors + (replacementSeriesJ.data.coloring i.succ) + (replacementSeriesJ.data.tree i.succ.castSucc) = + TreeMissingColors (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) := by + rw [ladderTreesAgreeJ i] + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by + rw [← (replacementStableJ i).2 v hv] + exact hc⟩ + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by + rw [(replacementStableJ i).2 v hv] + exact hc⟩ + have storedEq : + TashkinovStoredColors replacementSeriesJ.data i.succ = + TashkinovStoredColors ett.series.data i.succ := by + have nonzero : (i.succ : Fin (ett.rounds + 1)).val ≠ 0 := by + simp + unfold TashkinovStoredColors + simp only [ite_eq_right nonzero] + ext c + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · rintro ⟨⟨h, hh, hc⟩, hn⟩ + refine ⟨⟨h, hh, ?_⟩, ?_⟩ + · by_cases hle : h.val ≤ i.succ.val + · simp only [ite_eq_left hle] at hc ⊢ + simpa [storedColorsAgreeJ h] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rw [treeMissingEq] at hn + exact hn + · rintro ⟨⟨h, hh, hc⟩, hn⟩ + refine ⟨⟨h, hh, ?_⟩, ?_⟩ + · by_cases hle : h.val ≤ i.succ.val + · simp only [ite_eq_left hle] at hc ⊢ + simpa [storedColorsAgreeJ h] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rw [← treeMissingEq] at hn + exact hn + have originalGood : + IsProperEdgeColoring G (ett.series.data.coloring i.succ) ∧ + IsOneEdgeUncolored (ett.series.data.coloring i.succ) e0 := by + exact ett.series.coloringProperties i.succ + have jGood : + IsProperEdgeColoring G (replacementSeriesJ.data.coloring i.succ) ∧ + IsOneEdgeUncolored (replacementSeriesJ.data.coloring i.succ) e0 := + ⟨replacementProperJ i.succ, replacementOneUncoloredJ i.succ⟩ + have uGood : + IsProperEdgeColoring G (replacementSeriesU.data.coloring i.succ) ∧ + IsOneEdgeUncolored (replacementSeriesU.data.coloring i.succ) e0 := + ⟨replacementProperU i.succ, replacementOneUncoloredU i.succ⟩ + rw [ladderTreesAgreeJ i, storedEq] + exact (sc2 G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ)).trans + (x := ⟨replacementSeriesJ.data.coloring i.succ, jGood⟩) + (y := ⟨ett.series.data.coloring i.succ, originalGood⟩) + (z := ⟨replacementSeriesU.data.coloring i.succ, uGood⟩) + ((sc2 G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ)).symm + (replacementStableJ i)) + (replacementStableU i) } + exact HierarchyBaseCorrespondingTransport G k e0 replacementInputJ J U + sigma + { rounds := ett.rounds + roundsPositive := roundsPositiveJ + series := replacementSeriesJ + abovePenultimate := aboveJ + strictAbovePenultimate := strictJ + belowFinal := belowJ + generatingColoring := generatingJ } + corrJU baseJ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyElementaryLarge.lean b/LeanPool/GoldbergSeymour/GoodHierarchyElementaryLarge.lean new file mode 100644 index 0000000000..64d2efe703 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyElementaryLarge.lean @@ -0,0 +1,1080 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePathNumberBounds +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchySituationOneImpossible +public import LeanPool.GoldbergSeymour.HierarchySituationTwoImpossible +public import LeanPool.GoldbergSeymour.HierarchySituationThreeImpossible +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent + +public import LeanPool.GoldbergSeymour.LowerRoundProperties + +/-! +# Good Hierarchy Elementary Large + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch670Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (q : ℕ), ( + ∀ m < q, + ∀ (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi), MaximumProperty ett → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (_ : GoodHierarchy H), ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (open scoped Classical in LowerRoundProperties lower)) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → (( + ∀ (q : Fin current.rounds) (v : V), current.series.data.kind q.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (j : Fin (current.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex current v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (current.series.data.tree q.succ.castSucc) (TashkinovStoredColors + current.series.data q.succ) (current.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (current.series.data.tree j.castSucc) (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin current.rounds) (vq vr : V), q ≠ r → vq ≠ vr → current.series.data.kind q.succ = + some TashkinovExtensionKind.PE → current.series.data.kind r.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some vq → + current.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex current vq hvq = ETTFirstAppearanceIndex current vr hvr → Disjoint + (current.series.data.stored q.succ) (current.series.data.stored r.succ)) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), current.series.data.kind n = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex n = some v → current.series.data.gamma n = some gamma → + current.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) + ↔ w = v) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → ( + ∃ (w : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn + w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin current.rounds) (vi : V), + current.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ + current.series.data.kind q.succ = some TashkinovExtensionKind.SE → + current.series.data.chosenVertex q.succ = some vi → ETTFirstAppearanceIndex current v + hvFinal ≤ (↑q : ℕ) + (1 : ℕ) → v = vi ∨ TreeVertexOrder T' v vi) ∧ + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → ModColoring current sigma) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → + ∀ (base' : HierarchyBase current generating') (K : TashkinovHierarchy current base') (_ : + GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; (2 : ℕ) * current.rounds + + (11 : ℕ) ≤ (TreeMissingColors generating' Tn).card) → H.dividerCount = m → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T)) → + ∀ (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) (H : + TashkinovHierarchy ett base) (_ : GoodHierarchy H), ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (open scoped Classical in LowerRoundProperties lower)) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → (( + ∀ (q : Fin current.rounds) (v : V), current.series.data.kind q.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (j : Fin (current.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex current v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (current.series.data.tree q.succ.castSucc) (TashkinovStoredColors + current.series.data q.succ) (current.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (current.series.data.tree j.castSucc) (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin current.rounds) (vq vr : V), q ≠ r → vq ≠ vr → current.series.data.kind q.succ = + some TashkinovExtensionKind.PE → current.series.data.kind r.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some vq → + current.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex current vq hvq = ETTFirstAppearanceIndex current vr hvr → Disjoint + (current.series.data.stored q.succ) (current.series.data.stored r.succ)) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), current.series.data.kind n = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex n = some v → current.series.data.gamma n = some gamma → + current.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) + ↔ w = v) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → ( + ∃ (w : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn + w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin current.rounds) (vi : V), + current.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ + current.series.data.kind q.succ = some TashkinovExtensionKind.SE → + current.series.data.chosenVertex q.succ = some vi → ETTFirstAppearanceIndex current v + hvFinal ≤ (↑q : ℕ) + (1 : ℕ) → v = vi ∨ TreeVertexOrder T' v vi) ∧ + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → ModColoring current sigma) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → + ∀ (base' : HierarchyBase current generating') (K : TashkinovHierarchy current base') (_ : + GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; (2 : ℕ) * current.rounds + + (11 : ℕ) ≤ (TreeMissingColors generating' Tn).card) → + let candidate : ℕ → ℕ → Prop := fun (a b : ℕ) => + ∃ (input' : PartialEdgeColoring E k) (T' : TreeSequence G e0) (generating' : + PartialEdgeColoring E k) (other : ExtendedTashkinovTree G k e0 input' T' generating') + (base' : HierarchyBase other generating') (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds ∧ C'.hierarchy.dividerCount = q ∧ HierarchyCounterexampleMeasure + C' = (a, b); ( + ∃ (a : ℕ) (b : ℕ), candidate a b) → + ∀ (firstExists : + ∃ (a : ℕ) (b : ℕ), candidate a b), + let first : ℕ := Nat.find firstExists; ( + ∃ (b : ℕ), candidate first b) → + ∀ (inputMin : PartialEdgeColoring E k) (TMin : TreeSequence G e0) (generatingMin : + PartialEdgeColoring E k) (ettMin : ExtendedTashkinovTree G k e0 inputMin TMin + generatingMin) (baseMin : HierarchyBase ettMin generatingMin) (CMin : + HierarchyCounterexample baseMin), ettMin.rounds = ett.rounds → CMin.hierarchy.dividerCount + = q → + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating'), other.rounds = ettMin.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') (_ : + GoodHierarchy K), K.dividerCount < CMin.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T') + +private abbrev helperCtx623Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (q : ℕ), ( + ∀ m < q, + ∀ (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi), MaximumProperty ett → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (_ : GoodHierarchy H), ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (open scoped Classical in LowerRoundProperties lower)) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → (( + ∀ (q : Fin current.rounds) (v : V), current.series.data.kind q.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (j : Fin (current.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex current v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (current.series.data.tree q.succ.castSucc) (TashkinovStoredColors + current.series.data q.succ) (current.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (current.series.data.tree j.castSucc) (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin current.rounds) (vq vr : V), q ≠ r → vq ≠ vr → current.series.data.kind q.succ = + some TashkinovExtensionKind.PE → current.series.data.kind r.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some vq → + current.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex current vq hvq = ETTFirstAppearanceIndex current vr hvr → Disjoint + (current.series.data.stored q.succ) (current.series.data.stored r.succ)) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), current.series.data.kind n = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex n = some v → current.series.data.gamma n = some gamma → + current.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) + ↔ w = v) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → ( + ∃ (w : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn + w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin current.rounds) (vi : V), + current.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ + current.series.data.kind q.succ = some TashkinovExtensionKind.SE → + current.series.data.chosenVertex q.succ = some vi → ETTFirstAppearanceIndex current v + hvFinal ≤ (↑q : ℕ) + (1 : ℕ) → v = vi ∨ TreeVertexOrder T' v vi) ∧ + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → ModColoring current sigma) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → + ∀ (base' : HierarchyBase current generating') (K : TashkinovHierarchy current base') (_ : + GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; (2 : ℕ) * current.rounds + + (11 : ℕ) ≤ (TreeMissingColors generating' Tn).card) → H.dividerCount = m → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T)) → + ∀ (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) (H : + TashkinovHierarchy ett base) (_ : GoodHierarchy H), ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (open scoped Classical in LowerRoundProperties lower)) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → (( + ∀ (q : Fin current.rounds) (v : V), current.series.data.kind q.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (j : Fin (current.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex current v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (current.series.data.tree q.succ.castSucc) (TashkinovStoredColors + current.series.data q.succ) (current.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (current.series.data.tree j.castSucc) (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin current.rounds) (vq vr : V), q ≠ r → vq ≠ vr → current.series.data.kind q.succ = + some TashkinovExtensionKind.PE → current.series.data.kind r.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some vq → + current.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex current vq hvq = ETTFirstAppearanceIndex current vr hvr → Disjoint + (current.series.data.stored q.succ) (current.series.data.stored r.succ)) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), current.series.data.kind n = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex n = some v → current.series.data.gamma n = some gamma → + current.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) + ↔ w = v) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → ( + ∃ (w : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn + w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin current.rounds) (vi : V), + current.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ + current.series.data.kind q.succ = some TashkinovExtensionKind.SE → + current.series.data.chosenVertex q.succ = some vi → ETTFirstAppearanceIndex current v + hvFinal ≤ (↑q : ℕ) + (1 : ℕ) → v = vi ∨ TreeVertexOrder T' v vi) ∧ + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → ModColoring current sigma) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → + ∀ (base' : HierarchyBase current generating') (K : TashkinovHierarchy current base') (_ : + GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; (2 : ℕ) * current.rounds + + (11 : ℕ) ≤ (TreeMissingColors generating' Tn).card) → IsProperEdgeColoring G phi → + let candidate : ℕ → ℕ → Prop := fun (a b : ℕ) => + ∃ (input' : PartialEdgeColoring E k) (T' : TreeSequence G e0) (generating' : + PartialEdgeColoring E k) (other : ExtendedTashkinovTree G k e0 input' T' generating') + (base' : HierarchyBase other generating') (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds ∧ C'.hierarchy.dividerCount = q ∧ HierarchyCounterexampleMeasure + C' = (a, b); ( + ∃ (a : ℕ) (b : ℕ), candidate a b) → + ∀ (firstExists : + ∃ (a : ℕ) (b : ℕ), candidate a b), + let first : ℕ := Nat.find firstExists; ( + ∃ (b : ℕ), candidate first b) → + ∀ (inputMin : PartialEdgeColoring E k) (TMin : TreeSequence G e0) (generatingMin : + PartialEdgeColoring E k) (ettMin : ExtendedTashkinovTree G k e0 inputMin TMin + generatingMin) (baseMin : HierarchyBase ettMin generatingMin) (CMin : + HierarchyCounterexample baseMin), ettMin.rounds = ett.rounds → CMin.hierarchy.dividerCount + = q → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ettMin.rounds → C'.hierarchy.dividerCount = CMin.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure CMin)) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (_ : ExtendedTashkinovTree G k e0 input' T' + generating'), IsProperEdgeColoring G generating' ∧ IsOneEdgeUncolored generating' e0) → + HierarchyMinimumCounterexampleContext G k e0 inputMin TMin generatingMin ettMin baseMin + CMin + +private abbrev helperBranch281Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (q : ℕ), ( + ∀ m < q, + ∀ (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi), MaximumProperty ett → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (_ : GoodHierarchy H), ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (open scoped Classical in LowerRoundProperties lower)) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → (( + ∀ (q : Fin current.rounds) (v : V), current.series.data.kind q.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (j : Fin (current.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex current v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (current.series.data.tree q.succ.castSucc) (TashkinovStoredColors + current.series.data q.succ) (current.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (current.series.data.tree j.castSucc) (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin current.rounds) (vq vr : V), q ≠ r → vq ≠ vr → current.series.data.kind q.succ = + some TashkinovExtensionKind.PE → current.series.data.kind r.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some vq → + current.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex current vq hvq = ETTFirstAppearanceIndex current vr hvr → Disjoint + (current.series.data.stored q.succ) (current.series.data.stored r.succ)) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), current.series.data.kind n = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex n = some v → current.series.data.gamma n = some gamma → + current.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) + ↔ w = v) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → ( + ∃ (w : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn + w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin current.rounds) (vi : V), + current.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ + current.series.data.kind q.succ = some TashkinovExtensionKind.SE → + current.series.data.chosenVertex q.succ = some vi → ETTFirstAppearanceIndex current v + hvFinal ≤ (↑q : ℕ) + (1 : ℕ) → v = vi ∨ TreeVertexOrder T' v vi) ∧ + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → ModColoring current sigma) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → + ∀ (base' : HierarchyBase current generating') (K : TashkinovHierarchy current base') (_ : + GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; (2 : ℕ) * current.rounds + + (11 : ℕ) ≤ (TreeMissingColors generating' Tn).card) → H.dividerCount = m → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T)) → + ∀ (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi), MaximumProperty ett → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (_ : GoodHierarchy H), ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (open scoped Classical in LowerRoundProperties lower)) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → (( + ∀ (q : Fin current.rounds) (v : V), current.series.data.kind q.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (j : Fin (current.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex current v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (current.series.data.tree q.succ.castSucc) (TashkinovStoredColors + current.series.data q.succ) (current.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (current.series.data.tree j.castSucc) (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin current.rounds) (vq vr : V), q ≠ r → vq ≠ vr → current.series.data.kind q.succ = + some TashkinovExtensionKind.PE → current.series.data.kind r.succ = some + TashkinovExtensionKind.PE → current.series.data.chosenVertex q.succ = some vq → + current.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex current vq hvq = ETTFirstAppearanceIndex current vr hvr → Disjoint + (current.series.data.stored q.succ) (current.series.data.stored r.succ)) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), current.series.data.kind n = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex n = some v → current.series.data.gamma n = some gamma → + current.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) + ↔ w = v) ∧ ( + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → + ∀ (delta : Fin k), DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → ( + ∃ (w : V), BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn + w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin current.rounds) (vi : V), + current.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ + current.series.data.kind q.succ = some TashkinovExtensionKind.SE → + current.series.data.chosenVertex q.succ = some vi → ETTFirstAppearanceIndex current v + hvFinal ≤ (↑q : ℕ) + (1 : ℕ) → v = vi ∨ TreeVertexOrder T' v vi) ∧ + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma → ModColoring current sigma) → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating'), current.rounds = ett.rounds → MaximumProperty current → + ∀ (base' : HierarchyBase current generating') (K : TashkinovHierarchy current base') (_ : + GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; (2 : ℕ) * current.rounds + + (11 : ℕ) ≤ (TreeMissingColors generating' Tn).card) → H.dividerCount = q → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) + +private theorem helper_finalProperties_437.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (_ : ℕ) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base), + IsProperEdgeColoring G phi ∧ IsOneEdgeUncolored phi e0 := by + classical + intro V E _ _ _ _ G k e0 q input T phi ett base H + have hr : 1 ≤ ett.rounds := ett.roundsPositive + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have qlast : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + generalize targetEq : q.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => exact (Fin.succ_ne_zero q targetEq).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + subst i + have hgen : phi = ett.series.data.coloring q.succ := by + calc + phi = ett.series.data.coloring (Fin.last ett.rounds) := ett.generatingColoring + _ = ett.series.data.coloring q.succ := congrArg _ qlast.symm + simpa [hgen, currentColoring] using + And.intro choice.selectedProper choice.selectedOneUncolored + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + subst i + have hgen : phi = ett.series.data.coloring q.succ := by + calc + phi = ett.series.data.coloring (Fin.last ett.rounds) := ett.generatingColoring + _ = ett.series.data.coloring q.succ := congrArg _ qlast.symm + simpa [hgen] using And.intro currentProper currentOneUncolored + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + subst i + have hgen : phi = ett.series.data.coloring q.succ := by + calc + phi = ett.series.data.coloring (Fin.last ett.rounds) := ett.generatingColoring + _ = ett.series.data.coloring q.succ := congrArg _ qlast.symm + simpa [hgen, currentColoring] using + And.intro previousProper previousOneUncolored + +private theorem helper_minMinimal_526.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (q : ℕ) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base), + let candidate : ℕ → ℕ → Prop := fun (a b : ℕ) => + ∃ (input' : PartialEdgeColoring E k) (T' : TreeSequence G e0) (generating' : + PartialEdgeColoring E k) (other : ExtendedTashkinovTree G k e0 input' T' generating') + (base' : HierarchyBase other generating') (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds ∧ C'.hierarchy.dividerCount = q ∧ HierarchyCounterexampleMeasure + C' = (a, b); ( + ∃ (a : ℕ) (b : ℕ), candidate a b) → + ∀ (firstExists : + ∃ (a : ℕ) (b : ℕ), candidate a b), + let first : ℕ := Nat.find firstExists; + ∀ (firstSpec : + ∃ (b : ℕ), candidate first b), + let second : ℕ := Nat.find firstSpec; + ∀ (inputMin : PartialEdgeColoring E k) (TMin : TreeSequence G e0) (generatingMin : + PartialEdgeColoring E k) (ettMin : ExtendedTashkinovTree G k e0 inputMin TMin + generatingMin) (baseMin : HierarchyBase ettMin generatingMin) (CMin : + HierarchyCounterexample baseMin), ettMin.rounds = ett.rounds → CMin.hierarchy.dividerCount + = q → HierarchyCounterexampleMeasure CMin = (first, second) → + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ettMin.rounds → C'.hierarchy.dividerCount = CMin.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure CMin) := by + classical + intro V E _ _ _ _ G k e0 q input T phi ett base H candidate candidateExists firstExists first + firstSpec second inputMin TMin generatingMin ettMin baseMin CMin roundsMin dividerMin + measureMin input' T' generating' other base' C' hround hdiv + unfold HierarchyCounterexampleLess + rw [measureMin] at ⊢ + have hroundQ : other.rounds = ett.rounds := hround.trans roundsMin + have hdivQ : C'.hierarchy.dividerCount = q := hdiv.trans dividerMin + by_cases hfirst : (HierarchyCounterexampleMeasure C').1 < first + · have firstWitness : ∃ b, candidate + (HierarchyCounterexampleMeasure C').1 b := by + exact ⟨(HierarchyCounterexampleMeasure C').2, + ⟨input', T', generating', other, base', C', hroundQ, hdivQ, rfl⟩⟩ + have := Nat.find_min' firstExists firstWitness + omega + · by_cases heq : (HierarchyCounterexampleMeasure C').1 = first + · by_cases hsecond : (HierarchyCounterexampleMeasure C').2 < second + · have := Nat.find_min' firstSpec (show candidate first + (HierarchyCounterexampleMeasure C').2 from by + exact ⟨input', T', generating', other, base', C', hroundQ, hdivQ, + Prod.ext heq rfl⟩) + omega + · omega + · omega + +private theorem helper_certifiedProperties_558.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (q : ℕ) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base), + let candidate : ℕ → ℕ → Prop := fun (a b : ℕ) => + ∃ (input' : PartialEdgeColoring E k) (T' : TreeSequence G e0) (generating' : + PartialEdgeColoring E k) (other : ExtendedTashkinovTree G k e0 input' T' generating') + (base' : HierarchyBase other generating') (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds ∧ C'.hierarchy.dividerCount = q ∧ HierarchyCounterexampleMeasure + C' = (a, b); ( + ∃ (a : ℕ) (b : ℕ), candidate a b) → + ∀ (firstExists : + ∃ (a : ℕ) (b : ℕ), candidate a b), + let first : ℕ := Nat.find firstExists; ( + ∃ (b : ℕ), candidate first b) → + ∀ (inputMin : PartialEdgeColoring E k) (TMin : TreeSequence G e0) (generatingMin : + PartialEdgeColoring E k) (ettMin : ExtendedTashkinovTree G k e0 inputMin TMin + generatingMin) (baseMin : HierarchyBase ettMin generatingMin) (_ : HierarchyCounterexample + baseMin) {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (_ : ExtendedTashkinovTree G k e0 input' T' + generating'), IsProperEdgeColoring G generating' ∧ IsOneEdgeUncolored generating' e0 := by + classical + intro V E _ _ _ _ G k e0 q input T phi ett base H candidate candidateExists firstExists first + firstSpec inputMin TMin generatingMin ettMin baseMin CMin input' T' generating' other + have hr : 1 ≤ other.rounds := other.roundsPositive + let q : Fin other.rounds := ⟨other.rounds - 1, by omega⟩ + have qlast : q.succ = Fin.last other.rounds := by + apply Fin.ext + simp [q] + omega + generalize targetEq : q.succ = target + cases other.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero q targetEq).elim + | SE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + subst i + have hgen : generating' = other.series.data.coloring q.succ := by + calc + generating' = other.series.data.coloring (Fin.last other.rounds) := + other.generatingColoring + _ = other.series.data.coloring q.succ := congrArg _ qlast.symm + simpa [hgen, currentColoring] using + And.intro choice.selectedProper choice.selectedOneUncolored + | PE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + subst i + have hgen : generating' = other.series.data.coloring q.succ := by + calc + generating' = other.series.data.coloring (Fin.last other.rounds) := + other.generatingColoring + _ = other.series.data.coloring q.succ := congrArg _ qlast.symm + simpa [hgen] using And.intro currentProper currentOneUncolored + | RE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed available + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + subst i + have hgen : generating' = other.series.data.coloring q.succ := by + calc + generating' = other.series.data.coloring (Fin.last other.rounds) := + other.generatingColoring + _ = other.series.data.coloring q.succ := congrArg _ qlast.symm + simpa [hgen, currentColoring] using + And.intro previousProper previousOneUncolored + +private theorem helper_branch_670.{u_1, u_2} : + helperBranch670Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 q ih input T phi ett base H hgood hlower hcurrent hlarge candidate + candidateExists firstExists first firstSpec inputMin TMin generatingMin ettMin baseMin CMin + roundsMin dividerMin input' T' generating' other hround hmax base' K good less + have lowerOther := fun {input'' : PartialEdgeColoring E k} + {T'' : TreeSequence G e0} {generating'' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input'' T'' generating'') + (hp : 0 < lower.rounds) (hl : lower.rounds < other.rounds) + (hm : MaximumProperty lower) => + @hlower _ _ _ lower hp (by omega) hm + have currentOther := fun {input'' : PartialEdgeColoring E k} + {T'' : TreeSequence G e0} {generating'' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input'' T'' generating'') + (heq : current.rounds = other.rounds) (hm : MaximumProperty current) => + hcurrent current (by omega) hm + have largeOther := fun {input'' : PartialEdgeColoring E k} + {T'' : TreeSequence G e0} {generating'' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input'' T'' generating'') + (heq : current.rounds = other.rounds) (hm : MaximumProperty current) + (base'' : HierarchyBase current generating'') + (K'' : TashkinovHierarchy current base'') (good'' : GoodHierarchy K'') => + hlarge current (by omega) hm base'' K'' good'' + unfold ColoredVertexSetElementary + intro u hu v hv huv + exact (ih K.dividerCount (by omega) (input := input') (T := T') + (phi := generating') (ett := other) hmax (base := base') (H := K) + good lowerOther currentOther largeOther (by rfl)) hu hv huv + +private theorem helper_ctx_623.{u_1, u_2} : + helperCtx623Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 q ih input T phi ett base H hgood hlower hcurrent hlarge proper + candidate candidateExists firstExists first firstSpec inputMin TMin generatingMin ettMin + baseMin CMin roundsMin dividerMin minMinimal certifiedProperties + refine + { proper := ?_ + oneEdgeUncolored := ?_ + lowerRung := ?_ + fewerDividers := ?_ + lexicographicMinimality := ?_ + largeMissingSet := ?_ } + · exact (certifiedProperties ettMin).1 + · exact (certifiedProperties ettMin).2 + · intro input' T' generating' lower positiveLower lowerLess maximumLower + exact @hlower _ _ _ lower positiveLower (by omega) maximumLower + · exact @helper_branch_670 V E inferInstance inferInstance inferInstance inferInstance G k e0 q + ih input T phi ett base H hgood hlower hcurrent hlarge candidateExists firstExists + firstSpec inputMin TMin generatingMin ettMin baseMin CMin roundsMin dividerMin + · exact minMinimal + · exact hlarge ettMin roundsMin CMin.maximum baseMin CMin.hierarchy CMin.good + +private theorem helper_missing_656.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (q : ℕ) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base), + let candidate : ℕ → ℕ → Prop := fun (a b : ℕ) => + ∃ (input' : PartialEdgeColoring E k) (T' : TreeSequence G e0) (generating' : + PartialEdgeColoring E k) (other : ExtendedTashkinovTree G k e0 input' T' generating') + (base' : HierarchyBase other generating') (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds ∧ C'.hierarchy.dividerCount = q ∧ HierarchyCounterexampleMeasure + C' = (a, b); ( + ∃ (a : ℕ) (b : ℕ), candidate a b) → + ∀ (firstExists : + ∃ (a : ℕ) (b : ℕ), candidate a b), + let first : ℕ := Nat.find firstExists; ( + ∃ (b : ℕ), candidate first b) → + ∀ (inputMin : PartialEdgeColoring E k) (TMin : TreeSequence G e0) (generatingMin : + PartialEdgeColoring E k) (ettMin : ExtendedTashkinovTree G k e0 inputMin TMin + generatingMin) (baseMin : HierarchyBase ettMin generatingMin) (_ : HierarchyCounterexample + baseMin) (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu + e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty := by + classical + intro V E _ _ _ _ G k e0 q input T phi ett base H candidate candidateExists firstExists first + firstSpec inputMin TMin generatingMin ettMin baseMin CMin mu hmu hmuone v + have triple : KTriple G k e0 input := by + have step := ett.series.certified 0 + cases step with + | initial triple => exact triple + have degreeBound : MaximumDegree G + 1 ≤ k := triple.2.2.1 + have presentBound : ∀ w : V, (PresentColors G mu w).card ≤ Degree G w := by + intro w + have chooseEdge (c : {c : Fin k // c ∈ PresentColors G mu w}) : + ∃ e, Incident G w e ∧ mu e = some c.1 := by + simpa [PresentColors] using c.property + let select : {c : Fin k // c ∈ PresentColors G mu w} → + {e : E // Incident G w e} := fun c => + ⟨Classical.choose (chooseEdge c), (Classical.choose_spec (chooseEdge c)).1⟩ + have selectColor : ∀ c, mu (select c).1 = some c.1 := by + intro c + exact (Classical.choose_spec (chooseEdge c)).2 + have injective : Function.Injective select := by + intro a b hab + apply Subtype.ext + apply Option.some.inj + calc + some (a : Fin k) = mu (select a).1 := (selectColor a).symm + _ = mu (select b).1 := by rw [hab] + _ = some (b : Fin k) := selectColor b + let : Fintype {c : Fin k // c ∈ PresentColors G mu w} := Fintype.ofFinite _ + have cardBound := Fintype.card_le_of_injective select injective + change (PresentColors G mu w).card ≤ + (Finset.univ.filter (fun e => Incident G w e)).card + simpa [Fintype.card_subtype] using cardBound + have degreeBoundAt : ∀ w : V, Degree G w ≤ MaximumDegree G := by + intro w + unfold MaximumDegree + exact Finset.le_max' _ _ (Finset.mem_insert.mpr (Or.inr + (Finset.mem_image.mpr ⟨w, by simp⟩))) + by_contra missingEmpty + have empty : MissingColors G mu v = ∅ := + Finset.not_nonempty_iff_eq_empty.mp missingEmpty + have allPresent : PresentColors G mu v = Finset.univ := by + apply Finset.eq_univ_of_forall + intro c + by_contra absent + have memMissing : c ∈ MissingColors G mu v := by + simp [MissingColors, absent] + simp [empty] at memMissing + have paletteBound : k ≤ (PresentColors G mu v).card := by + rw [allPresent, Finset.card_univ] + simp only [Fintype.card_fin] + exact le_rfl + have presentDegree := presentBound v + have degreeAt := degreeBoundAt v + omega + +private theorem helper_branch_281.{u_1, u_2} : + helperBranch281Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 q ih input T phi ett hMP base H hgood hlower hcurrent hlarge hq + by_contra hne + let counter : HierarchyCounterexample base := + { positive := ett.roundsPositive + hierarchy := H + good := hgood + maximum := hMP + notElementary := hne } + have finalProperties := + @helper_finalProperties_437 V E inferInstance inferInstance inferInstance inferInstance + G k e0 q input T phi ett base H + have proper : IsProperEdgeColoring G phi := finalProperties.1 + have oneEdge : IsOneEdgeUncolored phi e0 := finalProperties.2 + let candidate : ℕ → ℕ → Prop := fun a b => + ∃ (input' : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (generating' : PartialEdgeColoring E k) + (other : ExtendedTashkinovTree G k e0 input' T' generating') + (base' : HierarchyBase other generating') + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds ∧ + C'.hierarchy.dividerCount = q ∧ + HierarchyCounterexampleMeasure C' = (a, b) + have candidateExists : ∃ a b, candidate a b := by + refine ⟨(HierarchyCounterexampleMeasure counter).1, + (HierarchyCounterexampleMeasure counter).2, ?_⟩ + exact ⟨input, T, phi, ett, base, counter, rfl, by + simpa [counter] using hq, rfl⟩ + have firstExists : ∃ a, ∃ b, candidate a b := candidateExists + let first : ℕ := Nat.find firstExists + have firstSpec : ∃ b, candidate first b := Nat.find_spec firstExists + let second : ℕ := Nat.find firstSpec + have secondSpec : candidate first second := Nat.find_spec firstSpec + obtain ⟨inputMin, TMin, generatingMin, ettMin, baseMin, CMin, + roundsMin, dividerMin, measureMin⟩ := secondSpec + have minCounter : HierarchyCounterexample baseMin := CMin + have minMinimal := + @helper_minMinimal_526 V E inferInstance inferInstance inferInstance inferInstance G k + e0 q input T phi ett base H candidateExists firstExists firstSpec inputMin TMin + generatingMin ettMin baseMin CMin roundsMin dividerMin measureMin + have certifiedProperties := + @helper_certifiedProperties_558 V E inferInstance inferInstance inferInstance + inferInstance G k e0 q input T phi ett base H candidateExists firstExists firstSpec + inputMin TMin generatingMin ettMin baseMin CMin + have ctx := + @helper_ctx_623 V E inferInstance inferInstance inferInstance inferInstance G k e0 q ih + input T phi ett base H hgood hlower hcurrent hlarge proper candidateExists firstExists + firstSpec inputMin TMin generatingMin ettMin baseMin CMin roundsMin dividerMin minMinimal + certifiedProperties + have missing := + @helper_missing_656 V E inferInstance inferInstance inferInstance inferInstance G k e0 + q input T phi ett base H candidateExists firstExists firstSpec inputMin TMin + generatingMin ettMin baseMin CMin + have lower := HierarchyCounterexampleTailAtLeastTwo G k e0 inputMin TMin generatingMin ettMin + baseMin CMin + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + dsimp at lower + have pathBounds := HierarchyCounterexamplePathNumberBounds G k e0 inputMin TMin generatingMin + ettMin baseMin CMin ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + dsimp at pathBounds + have pathAtLeast : 1 ≤ HierarchyPathNumber CMin.hierarchy := pathBounds.1 + have pathAtMost : HierarchyPathNumber CMin.hierarchy ≤ + HierarchyFullTailLength CMin := pathBounds.2 + by_cases onePath : HierarchyPathNumber CMin.hierarchy = 1 + · exact HierarchySituationOneImpossible G k e0 inputMin TMin generatingMin + ettMin baseMin CMin ctx onePath missing + · by_cases fullPath : HierarchyPathNumber CMin.hierarchy = HierarchyFullTailLength CMin + · exact HierarchySituationTwoImpossible G k e0 inputMin TMin generatingMin + ettMin baseMin CMin ctx fullPath + · have pathLower : 2 ≤ HierarchyPathNumber CMin.hierarchy := by omega + have pathUpper : HierarchyPathNumber CMin.hierarchy < HierarchyFullTailLength CMin := by omega + exact HierarchySituationThreeImpossible G k e0 inputMin TMin generatingMin + ettMin baseMin CMin ctx pathLower pathUpper missing + +theorem GoodHierarchyElementaryLarge {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) + (hgood : GoodHierarchy H) + (hlower : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < lower.rounds -> lower.rounds < ett.rounds -> MaximumProperty lower -> + (open scoped Classical in LowerRoundProperties lower)) + (hcurrent : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = ett.rounds -> MaximumProperty current -> + ((forall (q : Fin current.rounds) (v : V), + current.series.data.kind q.succ = + some TashkinovExtensionKind.PE -> + current.series.data.chosenVertex q.succ = some v -> + forall hvFinal : v ∈ TreeSequenceVertexSet T', + forall j : Fin (current.rounds + 1), + ETTFirstAppearanceIndex current v hvFinal = j.val + 1 -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> + IsOneEdgeUncolored sigma e0 -> + StableColoring + (current.series.data.tree q.succ.castSucc) + (TashkinovStoredColors current.series.data q.succ) + (current.series.data.coloring q.succ) sigma -> + StableColoringBeforeVertex T' v hvFinal + (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma ∧ + (0 < j.val -> + StableColoring (current.series.data.tree j.castSucc) + (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma)) ∧ + forall (q r : Fin current.rounds) (vq vr : V), + q ≠ r -> vq ≠ vr -> + current.series.data.kind q.succ = + some TashkinovExtensionKind.PE -> + current.series.data.kind r.succ = + some TashkinovExtensionKind.PE -> + current.series.data.chosenVertex q.succ = some vq -> + current.series.data.chosenVertex r.succ = some vr -> + forall (hvq : vq ∈ TreeSequenceVertexSet T') + (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex current vq hvq = + ETTFirstAppearanceIndex current vr hvr -> + Disjoint (current.series.data.stored q.succ) + (current.series.data.stored r.succ)) ∧ + (let n : Fin (current.rounds + 1) := Fin.last current.rounds + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc + forall (v : V) (gamma delta : Fin k), + current.series.data.kind n = some TashkinovExtensionKind.PE -> + current.series.data.chosenVertex n = some v -> + current.series.data.gamma n = some gamma -> + current.series.data.delta n = some delta -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> + IsOneEdgeUncolored sigma e0 -> + StableColoring Tn + (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma -> + forall w, w ∈ TreeSequenceVertexSet Tn -> + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) ↔ w = v)) ∧ + (let n : Fin (current.rounds + 1) := Fin.last current.rounds + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tn + (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma -> + forall (delta : Fin k), + DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta -> + forall (v : V), + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) + delta v -> + (exists w, BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tn) delta w ∧ + TreeVertexOrder Tn w v) -> + forall (hvFinal : v ∈ TreeSequenceVertexSet T') + (q : Fin current.rounds) (vi : V), + (current.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ + current.series.data.kind q.succ = + some TashkinovExtensionKind.SE) -> + current.series.data.chosenVertex q.succ = some vi -> + ETTFirstAppearanceIndex current v hvFinal ≤ q.val + 1 -> + v = vi ∨ TreeVertexOrder T' v vi) ∧ + (let n : Fin (current.rounds + 1) := Fin.last current.rounds + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tn + (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma -> + ModColoring current sigma)) + (_ : 11 ≤ TashkinovOrder G) + (hlarge : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = ett.rounds -> MaximumProperty current -> + forall (base' : HierarchyBase current generating') + (K : TashkinovHierarchy current base'), + GoodHierarchy K -> + let n : Fin (current.rounds + 1) := Fin.last current.rounds + let Tn := current.series.data.tree n.castSucc + 2 * current.rounds + 11 ≤ + (TreeMissingColors generating' Tn).card) : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := by + classical + induction hq : H.dividerCount using Nat.strong_induction_on + generalizing input T phi ett base H hgood with + | h q ih => + exact @helper_branch_281 V E inferInstance inferInstance inferInstance inferInstance G k e0 + q ih input T phi ett hMP base H hgood hlower hcurrent hlarge hq +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyInitialPairsNonPE.lean b/LeanPool/GoldbergSeymour/GoodHierarchyInitialPairsNonPE.lean new file mode 100644 index 0000000000..96255642d9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyInitialPairsNonPE.lean @@ -0,0 +1,137 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality + +/-! +# Good Hierarchy Initial Pairs Non PE + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem GoodHierarchyInitialPairsNonPE {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T phi} + {base : HierarchyBase ett phi} (H : TashkinovHierarchy ett base) + (_ : ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) : + ∃ gamma : Fin k → Finset (Fin k), + (∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt H 0 → + (gamma eta).card = 2 ∧ + gamma eta ⊆ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) ∧ + ∀ eta theta : Fin k, + eta ∈ HierarchyStoredColorsAt H 0 → + theta ∈ HierarchyStoredColorsAt H 0 → eta ≠ theta → + Disjoint (gamma eta) (gamma theta) := by + classical + have pairing : ∀ (D M : Finset (Fin k)), 2 * D.card ≤ M.card → + ∃ gamma : Fin k → Finset (Fin k), + (∀ eta, eta ∈ D → (gamma eta).card = 2 ∧ gamma eta ⊆ M) ∧ + ∀ eta theta, eta ∈ D → theta ∈ D → eta ≠ theta → + Disjoint (gamma eta) (gamma theta) := by + intro D + induction D using Finset.induction_on with + | empty => + intro M h + refine ⟨fun _ => ∅, ?_, ?_⟩ + · simp + · simp + | @insert a D ha ih => + intro M h + have hcard : (insert a D).card = D.card + 1 := by simp [ha] + have hbig : 2 ≤ M.card := by + rw [hcard] at h + omega + have hM : M.Nonempty := Finset.card_pos.mp (by omega) + obtain ⟨x, hx⟩ := hM + have hrest : 1 ≤ (M.erase x).card := by + rw [Finset.card_erase_of_mem hx] + omega + obtain ⟨y, hy⟩ := Finset.card_pos.mp hrest + have hxy : x ≠ y := by + intro hxy + have hyx : y ≠ x := (Finset.mem_erase.mp hy).1 + exact hyx hxy.symm + have hrec : 2 * D.card ≤ ((M.erase x).erase y).card := by + rw [Finset.card_erase_of_mem hy, Finset.card_erase_of_mem hx] + omega + obtain ⟨g, hg, hd⟩ := ih ((M.erase x).erase y) hrec + refine ⟨fun z => if z = a then {x, y} else g z, ?_, ?_⟩ + · intro eta heta + by_cases he : eta = a + · subst eta + constructor + · simp [hxy] + · have hpair : {x, y} ⊆ M := by + intro z hz + rcases Finset.mem_insert.mp hz with rfl | hz + · exact hx + · exact (Finset.mem_singleton.mp hz).symm ▸ Finset.mem_of_mem_erase hy + simpa using hpair + · have heta' : eta ∈ D := Finset.mem_insert.mp heta |>.resolve_left he + have hz := hg eta heta' + constructor + · simpa [he] using hz.1 + · simpa [he] using hz.2.trans (by + intro z hz' + exact Finset.mem_of_mem_erase (Finset.mem_of_mem_erase hz')) + · intro eta theta heta htheta hne + by_cases he : eta = a + · subst eta + have ht : theta ∈ D := Finset.mem_insert.mp htheta |>.resolve_left (Ne.symm hne) + have hsub := hg theta ht |>.2 + have htheta_ne : theta ≠ a := Ne.symm hne + have hpair : Disjoint {x, y} (g theta) := by + apply Finset.disjoint_left.2 + intro z hz hzg + have hzg' := hsub (by simpa [htheta_ne] using hzg) + rcases Finset.mem_insert.mp hz with rfl | hz + · exact (Finset.mem_erase.mp (Finset.mem_erase.mp hzg').2).1 rfl + · exact (Finset.mem_erase.mp hzg').1 (Finset.mem_singleton.mp hz) + simpa [htheta_ne] using hpair + · by_cases ht : theta = a + · subst theta + have he' : eta ∈ D := Finset.mem_insert.mp heta |>.resolve_left he + have hsub := hg eta he' |>.2 + have hpair : Disjoint (g eta) {x, y} := by + apply Finset.disjoint_left.2 + intro z hzg hz + have hzg' := hsub (by simpa [he] using hzg) + rcases Finset.mem_insert.mp hz with rfl | hz + · exact (Finset.mem_erase.mp (Finset.mem_erase.mp hzg').2).1 rfl + · exact (Finset.mem_erase.mp hzg').1 (Finset.mem_singleton.mp hz) + simpa [he] using hpair + · have he' : eta ∈ D := Finset.mem_insert.mp heta |>.resolve_left he + have ht' : theta ∈ D := Finset.mem_insert.mp htheta |>.resolve_left ht + simpa [he, ht] using hd eta theta he' ht' hne + have hstored : 2 * (HierarchyStoredColorsAt H 0).card ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card := by + have hc := HierarchyStoredColorsCardinality H 0 + omega + obtain ⟨gamma, hgamma, hdisj⟩ := + pairing (HierarchyStoredColorsAt H 0) + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) hstored + exact ⟨gamma, hgamma, hdisj⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyInitialPairsPE.lean b/LeanPool/GoldbergSeymour/GoodHierarchyInitialPairsPE.lean new file mode 100644 index 0000000000..2a1d027bac --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyInitialPairsPE.lean @@ -0,0 +1,293 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality + +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed + +/-! +# Good Hierarchy Initial Pairs PE + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem GoodHierarchyInitialPairsPE_hreserve_82.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring + E k} + {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} {ett : ExtendedTashkinovTree G k e0 + input T phi} + {base : HierarchyBase ett phi} (H : TashkinovHierarchy ett base), + let M := TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc); + let C := M ∩ TreeMissingColors phi base.closure; + (HierarchyStoredColorsAt H 0).card ≤ ett.rounds → + 2 * ett.rounds + 11 ≤ M.card → + 4 ≤ C.card → ∀ alpha ∉ C, ∀ (d : ℕ), 2 * d ≤ M.card - 11 → ∃ R ⊆ M.erase alpha, R.card + = 2 * d ∧ 4 ≤ (C \ R).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H M C hD hM hC alpha halphaC d hd + have hsubC0 : C ⊆ M := Finset.inter_subset_left + have hsubC : C ⊆ M.erase alpha := by + intro x hx + exact Finset.mem_erase.mpr ⟨by + intro he + exact halphaC (he ▸ hx), hsubC0 hx⟩ + have hA : 2 * d + 10 ≤ (M.erase alpha).card := by + by_cases ham : alpha ∈ M + · rw [Finset.card_erase_of_mem ham] + omega + · simp [ham] + omega + by_cases houtside : 2 * d ≤ (M.erase alpha \ C).card + · obtain ⟨R, hRsub, hRcard⟩ := Finset.exists_subset_card_eq houtside + refine ⟨R, ?_, hRcard, ?_⟩ + · intro x hx + have hxA := (Finset.mem_sdiff.mp (hRsub hx)).1 + exact Finset.mem_erase.mpr ⟨(Finset.mem_erase.mp hxA).1, + (Finset.mem_erase.mp hxA).2⟩ + have hdis : Disjoint C R := Finset.disjoint_left.mpr (by + intro x hxC hxR + exact (Finset.mem_sdiff.mp (hRsub hxR)).2 hxC) + have heq : C \ R = C := by + apply Finset.ext + intro x + constructor + · exact fun hx => (Finset.mem_sdiff.mp hx).1 + · intro hx + exact Finset.mem_sdiff.mpr ⟨hx, by + intro hxr + exact (Finset.mem_sdiff.mp (hRsub hxr)).2 hx⟩ + rw [heq] + exact hC + · have hlt : (M.erase alpha \ C).card < 2 * d := Nat.lt_of_not_ge houtside + have hdiff : (M.erase alpha \ C).card + C.card = (M.erase alpha).card := by + have hu := Finset.union_sdiff_of_subset hsubC + have hc := congrArg Finset.card hu + rw [Finset.card_union_of_disjoint Finset.disjoint_sdiff] at hc + omega + have hq : 2 * d - (M.erase alpha \ C).card ≤ C.card := by omega + obtain ⟨Q, hQsub, hQcard⟩ := Finset.exists_subset_card_eq hq + let R := (M.erase alpha \ C) ∪ Q + have hRsub : R ⊆ M.erase alpha := by + intro x hx + rcases Finset.mem_union.mp hx with hx | hx + · exact Finset.mem_sdiff.mp hx |>.1 + · exact hsubC (hQsub hx) + have hRcard : R.card = 2 * d := by + dsimp [R] + rw [Finset.card_union_of_disjoint (by + apply Finset.disjoint_left.mpr + intro x hxO hxQ + exact (Finset.mem_sdiff.mp hxO).2 (hQsub hxQ))] + omega + have hRQ : C \ R = C \ Q := by + dsimp [R] + apply Finset.ext + intro x + simp only [Finset.mem_sdiff, Finset.mem_union] + constructor + · rintro ⟨hxC, hxnot⟩ + refine ⟨hxC, ?_⟩ + intro hxQ + exact hxnot (Or.inr hxQ) + · rintro ⟨hxC, hxnot⟩ + refine ⟨hxC, ?_⟩ + intro hxR + rcases hxR with hxO | hxQ + · exact hxO.2 hxC + · exact hxnot hxQ + refine ⟨R, hRsub, hRcard, ?_⟩ + rw [hRQ, Finset.card_sdiff_of_subset hQsub] + omega + +private theorem GoodHierarchyInitialPairsPE_pairing_163.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] {G + : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} {T : + TreeSequence G e0} {phi : PartialEdgeColoring E k} {ett : ExtendedTashkinovTree G k e0 + input T phi} {base : HierarchyBase ett phi} (_ : TashkinovHierarchy ett base) (_ D X : + Finset (Fin k)), 2 * D.card ≤ X.card → ∃ (gamma : Fin k → Finset (Fin k)), (∀ eta ∈ D, + (gamma eta).card = 2 ∧ gamma eta ⊆ X) ∧ ∀ (eta theta : Fin k), eta ∈ D → theta ∈ D → eta ≠ + theta → Disjoint (gamma eta) (gamma theta) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H R D + induction D using Finset.induction_on with + | empty => + intro X hx + exact ⟨fun _ => ∅, by simp, by simp⟩ + | @insert a D ha ih => + intro X hx + have htwo : 2 ≤ X.card := by + have hc : (insert a D).card = D.card + 1 := by simp [ha] + rw [hc] at hx + omega + obtain ⟨x, hxX⟩ := Finset.card_pos.mp (by omega : 0 < X.card) + have hrest : 1 ≤ (X.erase x).card := by + rw [Finset.card_erase_of_mem hxX] + omega + obtain ⟨y, hy⟩ := Finset.card_pos.mp hrest + have hxy : x ≠ y := by + intro e + exact (Finset.mem_erase.mp hy).1 e.symm + have hrec : 2 * D.card ≤ ((X.erase x).erase y).card := by + have hxcard : 2 * (D.card + 1) ≤ X.card := by + simpa [ha] using hx + rw [Finset.card_erase_of_mem hy, Finset.card_erase_of_mem hxX] + omega + obtain ⟨g, hg, hgd⟩ := ih ((X.erase x).erase y) hrec + refine ⟨fun z => if z = a then {x, y} else g z, ?_, ?_⟩ + · intro eta heta + by_cases he : eta = a + · subst eta + refine ⟨by simp [hxy], ?_⟩ + simp only [] + intro z hz + rcases Finset.mem_insert.mp hz with rfl | hz + · exact hxX + · have hz' : z = y := Finset.mem_singleton.mp hz + subst z + exact Finset.mem_of_mem_erase hy + · have heD : eta ∈ D := Finset.mem_insert.mp heta |>.resolve_left he + simp only [ite_eq_right he] + exact ⟨(hg eta heD).1, ((hg eta heD).2.trans + (Finset.erase_subset _ _)).trans (Finset.erase_subset _ _)⟩ + · intro eta theta heta htheta hne + by_cases he : eta = a + · subst eta + have ht : theta ∈ D := Finset.mem_insert.mp htheta |>.resolve_left (Ne.symm hne) + have hs := (hg theta ht).2 + simp only [ite_eq_right (Ne.symm hne)] + apply Finset.disjoint_left.mpr + intro z hz hzG + have hz' := hs (by simpa [Ne.symm hne] using hzG) + rcases Finset.mem_insert.mp hz with rfl | hz + · exact (Finset.mem_erase.mp (Finset.mem_erase.mp hz').2).1 rfl + · exact (Finset.mem_erase.mp hz').1 (Finset.mem_singleton.mp hz) + · by_cases ht : theta = a + · subst theta + have heD : eta ∈ D := Finset.mem_insert.mp heta |>.resolve_left he + have hs := (hg eta heD).2 + simp only [ite_eq_right he] + apply Finset.disjoint_left.mpr + intro z hzG hz + have hz' := hs hzG + rcases Finset.mem_insert.mp hz with rfl | hz + · exact (Finset.mem_erase.mp (Finset.mem_erase.mp hz').2).1 rfl + · exact (Finset.mem_erase.mp hz').1 (Finset.mem_singleton.mp hz) + · simpa [he, ht] using hgd eta theta + (Finset.mem_insert.mp heta |>.resolve_left he) + (Finset.mem_insert.mp htheta |>.resolve_left ht) hne + +theorem GoodHierarchyInitialPairsPE {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T phi} + {base : HierarchyBase ett phi} (H : TashkinovHierarchy ett base) + (_ : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (hnotClosed : ∃ alpha : Fin k, + alpha ∈ TreeMissingColors phi base.core ∧ + ¬ TreeColorSetClosed G phi base.core {alpha}) + (hcommonClosed : TreeColorSetClosed G phi base.core + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure)) + (hcommonFour : 4 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure).card) : + ∃ gamma : Fin k → Finset (Fin k), + (∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt H 0 → + (gamma eta).card = 2 ∧ + gamma eta ⊆ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) ∧ + (∀ eta theta : Fin k, + eta ∈ HierarchyStoredColorsAt H 0 → + theta ∈ HierarchyStoredColorsAt H 0 → eta ≠ theta → + Disjoint (gamma eta) (gamma theta)) ∧ + ¬ TreeColorSetMinusClosed G phi base.core + ((HierarchyStoredColorsAt H 0).biUnion gamma) ∧ + 4 ≤ ((TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure) \ + (HierarchyStoredColorsAt H 0).biUnion gamma).card := by + classical + let M := TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + let C := M ∩ TreeMissingColors phi base.closure + have hD : (HierarchyStoredColorsAt H 0).card ≤ ett.rounds := + HierarchyStoredColorsCardinality H 0 + have hM : 2 * ett.rounds + 11 ≤ M.card := by simpa [M] using hlarge + have hC : 4 ≤ C.card := by simpa [C] using hcommonFour + obtain ⟨alpha, halpha, hna⟩ := hnotClosed + have halphaC : alpha ∉ C := by + intro hac + have hh := hcommonClosed alpha (by simpa [C] using hac) + exact hna (by + unfold TreeColorSetClosed + intro beta hbeta + have : beta = alpha := Finset.mem_singleton.mp hbeta + subst beta + exact hh) + have hreserve : ∀ (d : ℕ), 2 * d ≤ M.card - 11 → + ∃ R : Finset (Fin k), R ⊆ M.erase alpha ∧ R.card = 2 * d ∧ + 4 ≤ (C \ R).card := by + exact @GoodHierarchyInitialPairsPE_hreserve_82 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base H hD hM hC alpha halphaC + have hdM : 2 * (HierarchyStoredColorsAt H 0).card ≤ M.card - 11 := by + omega + obtain ⟨R, hRsub, hRcard, hCR⟩ := hreserve + (HierarchyStoredColorsAt H 0).card hdM + have pairing : ∀ (D X : Finset (Fin k)), 2 * D.card ≤ X.card → + ∃ gamma : Fin k → Finset (Fin k), + (∀ eta, eta ∈ D → (gamma eta).card = 2 ∧ gamma eta ⊆ X) ∧ + ∀ eta theta, eta ∈ D → theta ∈ D → eta ≠ theta → + Disjoint (gamma eta) (gamma theta) := by + exact @GoodHierarchyInitialPairsPE_pairing_163 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base H R + obtain ⟨gamma, hg, hgd⟩ := pairing (HierarchyStoredColorsAt H 0) R + (by simp [hRcard]) + refine ⟨gamma, ?_, hgd, ?_, ?_⟩ + · intro eta heta + exact ⟨(hg eta heta).1, (hg eta heta).2.trans + (hRsub.trans (Finset.erase_subset _ _))⟩ + · intro hclosed + apply hna + unfold TreeColorSetClosed + unfold TreeColorSetMinusClosed at hclosed + intro beta hbeta + have hba : beta = alpha := Finset.mem_singleton.mp hbeta + subst beta + exact hclosed alpha (by + apply Finset.mem_sdiff.mpr + refine ⟨halpha, ?_⟩ + intro haU + simp only [Finset.mem_biUnion] at haU + obtain ⟨eta, heta, hame⟩ := haU + have := (hg eta heta).2 hame + exact (Finset.mem_erase.mp (hRsub this)).1 rfl) + · have hU : (HierarchyStoredColorsAt H 0).biUnion gamma ⊆ R := by + intro x hx + obtain ⟨eta, heta, hxe⟩ := Finset.mem_biUnion.mp hx + exact (hg eta heta).2 hxe + have hsub : C \ R ⊆ C \ (HierarchyStoredColorsAt H 0).biUnion gamma := + Finset.sdiff_subset_sdiff_right C hU + exact hCR.trans (Finset.card_le_card hsub) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyNewMissingClosed.lean b/LeanPool/GoldbergSeymour/GoodHierarchyNewMissingClosed.lean new file mode 100644 index 0000000000..718e7fbd50 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyNewMissingClosed.lean @@ -0,0 +1,155 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone + +/-! +# Good Hierarchy New Missing Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem GoodHierarchyNewMissingClosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} + {base : HierarchyBase ett phi} {H : TashkinovHierarchy ett base} + (good : GoodHierarchy H) (i : Fin H.dividerCount) + (helementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (H.stage i.succ.castSucc))) + (alpha : Fin k) + (halpha : alpha ∈ + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun v => MissingColors G phi v)) : + BoundaryColorEdges G phi + (TreeSequenceVertexSet (H.stage i.succ.castSucc)) alpha = ∅ := by + classical + let current := TreeSequenceVertexSet (H.stage i.succ.castSucc) + let starred := TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc) + let reserved := (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma i.castSucc) + obtain ⟨v, hv, hav⟩ := Finset.mem_biUnion.mp halpha + have hvm : alpha ∈ TreeMissingColors phi (H.stage i.succ.castSucc) := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨v, (Finset.mem_sdiff.mp hv).1, hav⟩ + have initialVertices : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hab x hx + unfold TreeSequenceVertexSet at hx ⊢ + simp only [Finset.mem_image] at hx ⊢ + obtain ⟨a, ha, rfl⟩ := hx + obtain ⟨hlen, hvertices, hedges⟩ := hab + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) a, Finset.mem_univ _, ?_⟩ + exact hvertices a + have oldSegment : TreeSequenceInitialSegment + (HierarchyStarredStage H i.castSucc) + (H.stage i.succ.castSucc) := by + by_cases hi : i.val = 0 + · have hi' : i = ⟨0, Fin.pos i⟩ := Fin.ext hi + rw [hi'] + dsimp [starred] + change TreeSequenceInitialSegment base.core (H.stage ⟨1, by omega⟩) + exact H.coreInsideFirst + · have hne : i.castSucc ≠ 0 := by + intro hz + apply hi + exact congrArg Fin.val hz + change TreeSequenceInitialSegment + (Fin.cases base.core (fun j => H.stage j.castSucc.succ) i.castSucc) + (H.stage i.castSucc.succ) + have hindex : (i.castSucc.pred hne).succ = i.castSucc := + Fin.succ_pred i.castSucc hne + have hstar : + Fin.cases base.core (fun j => H.stage j.castSucc.succ) i.castSucc = + H.stage i.castSucc.castSucc := by + rw [← hindex] + rfl + rw [hstar] + exact H.nested i.castSucc + have oldMissing : ∀ {c : Fin k}, + c ∈ HierarchyStageMissingColors H i.castSucc → + ∃ u, u ∈ starred ∧ c ∈ MissingColors G phi u := by + intro c hc + by_cases hi : i.val = 0 + · have hi' : i = ⟨0, Fin.pos i⟩ := Fin.ext hi + dsimp [starred] + rw [hi'] + rw [hi'] at hc + simp only [HierarchyStageMissingColors, Fin.castSucc_succ, Fin.castSucc_mk, Fin.zero_eta, + Fin.cases_zero] at hc + have hseg : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) base.core := by + by_cases hk : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · obtain ⟨_, _, hu⟩ := base.parallel hk + obtain ⟨u⟩ := hu + exact u.leftSegment + · rw [base.nonparallel hk] + exact ⟨le_rfl, (fun j => rfl), (fun j => rfl)⟩ + unfold TreeMissingColors at hc + obtain ⟨u, hu, hcu⟩ := Finset.mem_biUnion.mp hc + refine ⟨u, ?_, hcu⟩ + exact initialVertices hseg hu + · have hne : i.castSucc ≠ 0 := by + intro hz + apply hi + exact congrArg Fin.val hz + have hindex : (i.castSucc.pred hne).succ = i.castSucc := + Fin.succ_pred i.castSucc hne + rw [← hindex] at hc + simp only [HierarchyStageMissingColors, Fin.cases_succ] at hc + unfold TreeMissingColors at hc + obtain ⟨u, hu, hcu⟩ := Finset.mem_biUnion.mp hc + refine ⟨u, ?_, hcu⟩ + have hstar : HierarchyStarredStage H i.castSucc = + H.stage i.castSucc.castSucc := by + unfold HierarchyStarredStage + rw [← hindex] + rfl + dsimp [starred] + rw [hstar] + rw [hindex] at hu + exact hu + have hreserved : alpha ∉ reserved := by + intro hr + obtain ⟨eta, heta, hgamma⟩ := Finset.mem_biUnion.mp hr + have hetaOld : eta ∈ HierarchyStoredColorsAt H i.castSucc := + HierarchyStoredColorsAntitone H i heta + have havoid := good.avoidance i.castSucc eta hetaOld hgamma + have hstageMissing : alpha ∈ HierarchyStageMissingColors H i.castSucc := + (Finset.mem_sdiff.mp havoid).1 + obtain ⟨u, hu, hum⟩ := oldMissing hstageMissing + have hucurrent : u ∈ TreeSequenceVertexSet (H.stage i.succ.castSucc) := + initialVertices oldSegment hu + have huv : u ≠ v := by + intro huv + apply (Finset.mem_sdiff.mp hv).2 + rw [← huv] + exact hu + exact (Finset.disjoint_left.1 + (helementary (u := v) (v := u) (Finset.mem_sdiff.mp hv).1 hucurrent + (Ne.symm huv))) + hav hum + have hminus : alpha ∈ + TreeMissingColors phi (H.stage i.succ.castSucc) \ reserved := by + exact Finset.mem_sdiff.mpr ⟨hvm, hreserved⟩ + exact (good.minusClosed i) alpha hminus + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixConstruction.lean b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixConstruction.lean new file mode 100644 index 0000000000..75761c5146 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixConstruction.lean @@ -0,0 +1,131 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixPreparation + +/-! +# Good Hierarchy Prefix Repackage + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +namespace GoodHierarchyPrefix + +/-- Typed data construction shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev prefixHierarchyData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (r : Fin (H.dividerCount + 1)) (hr : 1 ≤ r.val) : + Σ P : ExtendedTashkinovTree G k e0 input (H.stage r.castSucc) generating, + Σ B : HierarchyBase P phi, TashkinovHierarchy P B := by + classical + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + apply TreeSequenceInitialSegment.trans <;> assumption + have stageSegment := @helper_stageSegment_77 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@r) + (@segmentRefl) (@segmentTrans) + have prefixEqOfSegment {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) : + A = TreeSequencePrefix B A.length A.positive hAB.1 := by + exact helper_prefixEqOfSegment_95 (@G) (@e0) (@hAB) + let Tp := H.stage r.castSucc + have firstToPrefix := helper_firstToPrefix_111 (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) + (@ett) (@base) (@H) (@r) (@stageSegment) + have prefixToTerminal := helper_prefixToTerminal_118 (@G) (@k) (@e0) (@input) (@T) (@generating) + (@phi) (@ett) (@base) (@H) (@r) (@stageSegment) + let ettPrefix : ExtendedTashkinovTree G k e0 input Tp generating := + { rounds := ett.rounds + roundsPositive := ett.roundsPositive + series := ett.series + abovePenultimate := firstToPrefix + strictAbovePenultimate := by + exact helper_strictAbovePenultimate_337 (@G) (@k) (@e0) (@input) (@T) (@generating) + (@phi) (@ett) (@base) (@H) (@r) (@hr) (@stageSegment) + belowFinal := segmentTrans prefixToTerminal ett.belowFinal + generatingColoring := ett.generatingColoring } + let basePrefix : HierarchyBase ettPrefix phi := + { core := base.core + closure := base.closure + supportPosition := base.supportPosition + supportPositive := base.supportPositive + terminalMissingColors := by simpa [ettPrefix] using base.terminalMissingColors + parallel := by simpa [ettPrefix] using base.parallel + nonparallel := by simpa [ettPrefix] using base.nonparallel } + have oldDividerValue (i : Fin H.dividerCount) : + (H.dividerPosition i).val = + (H.stage ⟨i.val + 1, by omega⟩).length := by + have h := congrArg TreeSequence.length (H.dividerStage i) + simpa [TreeSequencePrefix] using h.symm + let dividerPositionPrefix (i : Fin (r.val - 1)) : Fin (Tp.length + 1) := + ⟨(H.stage ⟨i.val + 1, by omega⟩).length, + by + have hs := stageSegment (i.val + 1) + (r.val - (i.val + 1)) (by omega) + have hind : i.val + 1 + (r.val - (i.val + 1)) = r.val := by omega + have hidx : (⟨i.val + 1 + (r.val - (i.val + 1)), by omega⟩ : + Fin (H.dividerCount + 2)) = r.castSucc := Fin.ext hind + rw [hidx] at hs + exact Nat.lt_succ_of_le (by simpa [Tp] using hs.1)⟩ + let HP : TashkinovHierarchy ettPrefix basePrefix := + { dividerCount := r.val - 1 + stage := fun j => H.stage ⟨j.val, by omega⟩ + baseStage := by simpa [ettPrefix] using H.baseStage + terminalStage := by + exact helper_terminalStage_419 (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) + (@base) (@H) (@r) (@hr) + nested := by + intro j + have hn := H.nested ⟨j.val, by omega⟩ + convert hn using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> rfl + strict := by + intro j + have hs := H.strict ⟨j.val, by omega⟩ + convert hs using 1 <;> apply congrArg TreeSequence.length <;> + apply congrArg H.stage <;> apply Fin.ext <;> rfl + dividerPosition := dividerPositionPrefix + dividerPositive := by + intro i + exact (H.stage ⟨i.val + 1, by omega⟩).positive + dividerIncreasing := by + intro i j hij + have oldInc := H.dividerIncreasing + (⟨i.val, by omega⟩ : Fin H.dividerCount) + (⟨j.val, by omega⟩ : Fin H.dividerCount) hij + simpa [dividerPositionPrefix, oldDividerValue] using oldInc + dividerStage := by + intro i + have hs := stageSegment (i.val + 1) + (r.val - (i.val + 1)) (by omega) + have hind : i.val + 1 + (r.val - (i.val + 1)) = r.val := by omega + have hidx : (⟨i.val + 1 + (r.val - (i.val + 1)), by omega⟩ : + Fin (H.dividerCount + 2)) = r.castSucc := Fin.ext hind + rw [hidx] at hs + simpa [dividerPositionPrefix, Tp] using prefixEqOfSegment hs + coreInsideFirst := by simpa [basePrefix] using H.coreInsideFirst } + exact ⟨ettPrefix, basePrefix, HP⟩ + +end GoodHierarchyPrefix + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean new file mode 100644 index 0000000000..145cb77945 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean @@ -0,0 +1,324 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Good Hierarchy Prefix Repackage + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +namespace GoodHierarchyPrefix + +theorem helper_segmentTrans_64.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B + C → TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨le_trans hab hbc, ?_, ?_⟩ + · intro i + have hmid := hvbc (Fin.castLE (Nat.succ_le_succ hab) i) + simpa using hmid.trans (hvab i) + · intro i + have hmid := hebc (Fin.castLE hab i) + simpa using hmid.trans (heab i) + +theorem helper_stageSegment_77.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (_ : Fin (H.dividerCount + (1 : ℕ))), + (∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A A) → + (∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H r segmentRefl segmentTrans a d + induction d with + | zero => + intro hbound + simpa using segmentRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + intro hbound + have hprev := ih (by omega) + have hnext := H.nested ⟨a + d, by omega⟩ + have hnext' : TreeSequenceInitialSegment + (H.stage ⟨a + d, by omega⟩) + (H.stage ⟨a + (d + 1), by omega⟩) := by + simpa [Nat.add_assoc] using hnext + exact segmentTrans hprev hnext' + +theorem helper_prefixEqOfSegment_95.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B : TreeSequence G e0} (hAB : TreeSequenceInitialSegment A B), + A = TreeSequencePrefix B A.length A.positive hAB.1 := by + classical + intro V E G e0 A B hAB + cases A with + | mk la pa va ea via eia fea aa => + cases B with + | mk lb pb vb eb vib eib feb ab => + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa [TreeSequencePrefix] using (hAB.2.1 i).symm + · apply heq_of_eq + funext i + simpa [TreeSequencePrefix] using (hAB.2.2 i).symm + +theorem helper_firstToPrefix_111.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (r : Fin (H.dividerCount + (1 : ℕ))), + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + let Tp : TreeSequence G e0 := H.stage r.castSucc; + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) Tp := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H r stageSegment Tp + change TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tp + rw [← H.baseStage] + have hs := stageSegment 0 r.val (by omega) + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> simp + +theorem helper_prefixToTerminal_118.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (r : Fin (H.dividerCount + (1 : ℕ))), + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + let Tp : TreeSequence G e0 := H.stage r.castSucc; + TreeSequenceInitialSegment Tp T := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H r stageSegment Tp + have hs := stageSegment r.val (H.dividerCount + 1 - r.val) (by omega) + have hind : r.val + (H.dividerCount + 1 - r.val) = + H.dividerCount + 1 := by omega + have hidx : (⟨r.val + (H.dividerCount + 1 - r.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext hind + rw [hidx, H.terminalStage] at hs + convert hs using 1 + apply congrArg H.stage + apply Fin.ext + rfl + +theorem helper_hidx_141.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T generating) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett + base) (r : Fin (H.dividerCount + (1 : ℕ))) (hr : (1 : ℕ) ≤ (↑r : ℕ)), + let Tp : TreeSequence G e0 := H.stage r.castSucc; H.stage (⟨(1 : ℕ) + ((↑r : ℕ) - (1 : ℕ)), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) = Tp := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H r hr Tp + dsimp [Tp] + apply congrArg H.stage + apply Fin.ext + simp + omega + +theorem helper_branch_233.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T generating) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett + base) (_ : Fin (H.dividerCount + (1 : ℕ))) {A B : TreeSequence G e0} (hAB : + TreeSequenceInitialSegment A B) (eta : Fin k) (i : Fin (A.length + (1 : ℕ))), (↑i : ℕ) < + A.length → + let candidatesA : Finset (Fin (A.length + (1 : ℕ))) := + ({x : Fin (A.length + (1 : ℕ)) | eta ∈ MissingColors G phi (A.vertex x)} : Finset (Fin + (A.length + (1 : ℕ)))); + let candidatesB : Finset (Fin (B.length + (1 : ℕ))) := + ({x : Fin (B.length + (1 : ℕ)) | eta ∈ MissingColors G phi (B.vertex x)} : Finset (Fin + (B.length + (1 : ℕ)))); (↑i : ℕ) < (↑(if h : candidatesA.Nonempty then candidatesA.min' h + else Fin.last A.length) : ℕ) → candidatesB.Nonempty → (↑(Fin.castLE (Nat.succ_le_succ + hAB.1) i) : ℕ) < (↑(if h : candidatesB.Nonempty then candidatesB.min' h else Fin.last + B.length) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H r A B hAB eta i hiEnd candidatesA + candidatesB hi hB + rw [dite_eq_left hB] + by_contra hnot + have hle : (candidatesB.min' hB).val ≤ i.val := by simpa using hnot + let ia : Fin (A.length + 1) := + ⟨(candidatesB.min' hB).val, by omega⟩ + have hmemB := Finset.min'_mem candidatesB hB + have hmissingB : eta ∈ MissingColors G phi + (B.vertex (candidatesB.min' hB)) := + (Finset.mem_filter.mp hmemB).2 + have hcast : Fin.castLE (Nat.succ_le_succ hAB.1) ia = + candidatesB.min' hB := Fin.ext rfl + have hmissingA : eta ∈ MissingColors G phi (A.vertex ia) := by + rw [← hAB.2.1 ia, hcast] + exact hmissingB + have hmemA : ia ∈ candidatesA := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hmissingA⟩ + by_cases hA : candidatesA.Nonempty + · rw [dite_eq_left hA] at hi + have hminA := Finset.min'_le candidatesA ia hmemA + change (candidatesA.min' hA).val ≤ ia.val at hminA + dsimp [ia] at hminA + omega + · exact hA ⟨ia, hmemA⟩ + +theorem helper_terminalClosed_412.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (r : Fin (H.dividerCount + (1 : ℕ))) (hr : (1 : ℕ) ≤ (↑r : ℕ)), + let _ : Fin H.dividerCount := (⟨(↑r : ℕ) - (1 : ℕ), by omega⟩ : Fin H.dividerCount); + TreeColorSetMinusClosed G phi (H.stage r.castSucc) + ((HierarchyStoredColorsAt H r).biUnion + (good.gamma (⟨(↑r : ℕ) - (1 : ℕ), by omega⟩ : Fin (H.dividerCount + (1 : ℕ))))) := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H good r hr lastInternal + have hold := good.minusClosed lastInternal + have hs : lastInternal.succ = r := by + apply Fin.ext + dsimp [lastInternal] + omega + rw [hs] at hold + simpa [lastInternal] using hold + +theorem helper_beforeFirstMissing_386.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T generating) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett + base) (_ : Fin (H.dividerCount + (1 : ℕ))) {A B : TreeSequence G e0} (hAB : + TreeSequenceInitialSegment A B) (eta : Fin k) (i : Fin (A.length + (1 : ℕ))) (_ : (↑i : ℕ) + < A.length) (_ : (↑i : ℕ) < (↑(HierarchyFirstMissingPosition phi A eta) : ℕ)), + let iB : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hAB.1) i; (↑iB : ℕ) < + (↑(HierarchyFirstMissingPosition phi B eta) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H r A B hAB eta i hiEnd hi + let candidatesA : Finset (Fin (A.length + 1)) := + Finset.univ.filter fun x => eta ∈ MissingColors G phi (A.vertex x) + let candidatesB : Finset (Fin (B.length + 1)) := + Finset.univ.filter fun x => eta ∈ MissingColors G phi (B.vertex x) + change i.val < (if h : candidatesA.Nonempty then candidatesA.min' h + else Fin.last A.length).val at hi + change (Fin.castLE (Nat.succ_le_succ hAB.1) i).val < + (if h : candidatesB.Nonempty then candidatesB.min' h + else Fin.last B.length).val + by_cases hB : candidatesB.Nonempty + · exact helper_branch_233 (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) + (@H) (@r) (@hAB) (@eta) (@i) (@hiEnd) (@hi) (@hB) + · rw [dite_eq_right hB] + simpa using lt_of_lt_of_le hiEnd hAB.1 + +theorem helper_strictAbovePenultimate_337.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T generating) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett + base) (r : Fin (H.dividerCount + (1 : ℕ))) (_ : (1 : ℕ) ≤ (↑r : ℕ)) (_ : + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))), + let Tp : TreeSequence G e0 := H.stage r.castSucc; (ett.series.data.tree (⟨ett.rounds, + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))).length < Tp.length := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H r hr stageSegment Tp + change (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length < Tp.length + rw [← H.baseStage] + have hfirst := H.strict (0 : Fin (H.dividerCount + 1)) + have hrest := (stageSegment 1 (r.val - 1) (by omega)).1 + have hidx : H.stage ⟨1 + (r.val - 1), by omega⟩ = Tp := by + exact helper_hidx_141 (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) + (@r) (@hr) + rw [hidx] at hrest + apply lt_of_lt_of_le hfirst + exact hrest + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperTerminalStage419Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T generating) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett + base) (r : Fin (H.dividerCount + (1 : ℕ))) (hr : (1 : ℕ) ≤ (↑r : ℕ)), + let Tp : TreeSequence G e0 := H.stage r.castSucc; H.stage (⟨(↑(Fin.last ((↑r : ℕ) - (1 : ℕ) + + (1 : ℕ))) : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) = Tp + +theorem helper_terminalStage_419.{u_1, u_2} : + helperTerminalStage419Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H r hr Tp + dsimp [Tp] + apply congrArg H.stage + apply Fin.ext + simp + omega + +end GoodHierarchyPrefix + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixRepackage.lean b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixRepackage.lean new file mode 100644 index 0000000000..271cf9fed3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixRepackage.lean @@ -0,0 +1,370 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixConstruction + +/-! +# Good Hierarchy Prefix Repackage + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open GoodHierarchyPrefix + +private abbrev helperContinuation626Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T generating) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett + base) (good : GoodHierarchy H) (r : Fin (H.dividerCount + (1 : ℕ))) (hr : (1 : ℕ) ≤ (↑r : + ℕ)), + let prefixData : (P : ExtendedTashkinovTree G k e0 input (H.stage r.castSucc) generating) × (B + : HierarchyBase P phi) × TashkinovHierarchy P B := prefixHierarchyData G k e0 input T + generating phi ett base H r hr; + let ettPrefix : ExtendedTashkinovTree G k e0 input (H.stage r.castSucc) generating := + prefixData.fst; + ∀ (mpPrefix : MaximumProperty ettPrefix), + let basePrefix : HierarchyBase prefixData.fst phi := prefixData.snd.fst; + ∀ (oldDividerValue : + ∀ (i : Fin H.dividerCount), (↑(H.dividerPosition i) : ℕ) = (H.stage (⟨(↑i : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))).length), + let HP : TashkinovHierarchy prefixData.fst prefixData.snd.fst := prefixData.snd.snd; + ∀ (stageEqRaw : + ∀ (j : Fin (HP.dividerCount + (2 : ℕ))), HP.stage j = H.stage (⟨(↑j : ℕ), + have hj : (↑j : ℕ) < HP.dividerCount + (2 : ℕ) := j.isLt; id (fun (hj : (↑j : ℕ) < (↑r : ℕ) - + (1 : ℕ) + (2 : ℕ)) ↦ Decidable.byContradiction fun (a : ¬(↑j : ℕ) < H.dividerCount + (2 : + ℕ)) ↦ + by omega + ) hj⟩ : Fin (H.dividerCount + (2 : ℕ)))) (starredEqRaw : + ∀ (j : Fin (HP.dividerCount + (1 : ℕ))), HierarchyStarredStage HP j = HierarchyStarredStage H + (⟨(↑j : ℕ), + have hj : (↑j : ℕ) < HP.dividerCount + (1 : ℕ) := j.isLt; id (fun (hj : (↑j : ℕ) < (↑r : ℕ) - + (1 : ℕ) + (1 : ℕ)) ↦ Decidable.byContradiction fun (a : ¬(↑j : ℕ) < H.dividerCount + (1 : + ℕ)) ↦ + by omega + ) hj⟩ : Fin (H.dividerCount + (1 : ℕ)))) (storedEqRaw : + ∀ (j : Fin (HP.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt HP j = + HierarchyStoredColorsAt H (⟨(↑j : ℕ), + have hj : (↑j : ℕ) < HP.dividerCount + (1 : ℕ) := j.isLt; id (fun (hj : (↑j : ℕ) < (↑r : ℕ) - + (1 : ℕ) + (1 : ℕ)) ↦ Decidable.byContradiction fun (a : ¬(↑j : ℕ) < H.dividerCount + (1 : + ℕ)) ↦ + by omega + ) hj⟩ : Fin (H.dividerCount + (1 : ℕ)))) (stageMissingEqRaw : + ∀ (j : Fin (HP.dividerCount + (1 : ℕ))), HierarchyStageMissingColors HP j = + HierarchyStageMissingColors H (⟨(↑j : ℕ), + have hj : (↑j : ℕ) < HP.dividerCount + (1 : ℕ) := j.isLt; id (fun (hj : (↑j : ℕ) < (↑r : ℕ) - + (1 : ℕ) + (1 : ℕ)) ↦ Decidable.byContradiction fun (a : ¬(↑j : ℕ) < H.dividerCount + (1 : + ℕ)) ↦ + by omega + ) hj⟩ : Fin (H.dividerCount + (1 : ℕ)))) (segmentSubsetRaw : + ∀ (j : Fin (HP.dividerCount + (1 : ℕ))) (eta : Fin k), HierarchySegmentColors HP j eta ⊆ + HierarchySegmentColors H (⟨(↑j : ℕ), + have hj : (↑j : ℕ) < HP.dividerCount + (1 : ℕ) := j.isLt; id (fun (hj : (↑j : ℕ) < (↑r : ℕ) - + (1 : ℕ) + (1 : ℕ)) ↦ Decidable.byContradiction fun (a : ¬(↑j : ℕ) < H.dividerCount + (1 : + ℕ)) ↦ + by omega + ) hj⟩ : Fin (H.dividerCount + (1 : ℕ))) eta), + ∃ (ettPrefix : ExtendedTashkinovTree G k e0 input (H.stage r.castSucc) generating), + MaximumProperty ettPrefix ∧ ettPrefix.rounds = ett.rounds ∧ ettPrefix.series ≍ ett.series + ∧ + ∃ (basePrefix : HierarchyBase ettPrefix phi), basePrefix.core = base.core ∧ basePrefix.closure + = base.closure ∧ (↑basePrefix.supportPosition : ℕ) = (↑base.supportPosition : ℕ) ∧ + ∃ (HP : TashkinovHierarchy ettPrefix basePrefix) (hcount : HP.dividerCount = (↑r : ℕ) - (1 : + ℕ)), ( + ∀ (j : Fin ((↑r : ℕ) + (1 : ℕ))), HP.stage (Fin.cast ( + by omega + ) j) = H.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (i : Fin ((↑r : ℕ) - (1 : ℕ))), (↑(HP.dividerPosition (Fin.cast ( + by omega + ) i)) : ℕ) = (↑(H.dividerPosition (⟨(↑i : ℕ), + by omega + ⟩ : Fin H.dividerCount)) : ℕ)) ∧ + ∃ (goodPrefix : GoodHierarchy HP), ( + ∀ (j : Fin (↑r : ℕ)), HierarchyStoredColorsAt HP (Fin.cast ( + by omega + ) j) = HierarchyStoredColorsAt H (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))) ∧ + ∀ (eta : Fin k), goodPrefix.gamma (Fin.cast ( + by omega + ) j) eta = good.gamma (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))) eta) ∧ TreeColorSetMinusClosed G phi (H.stage r.castSucc) + ((HierarchyStoredColorsAt H r).biUnion (good.gamma (⟨(↑r : ℕ) - (1 : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))))) + +private theorem helper_continuation_626.{u_1, u_2} : + helperContinuation626Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H good r hr prefixData ettPrefix + mpPrefix basePrefix oldDividerValue HP stageEqRaw starredEqRaw storedEqRaw + stageMissingEqRaw segmentSubsetRaw + let oldGammaIndex (j : Fin (HP.dividerCount + 1)) : + Fin (H.dividerCount + 1) := ⟨j.val, by + have hj := j.isLt + change j.val < r.val - 1 + 1 at hj + omega⟩ + let gammaPrefix : Fin (HP.dividerCount + 1) → Fin k → Finset (Fin k) := + fun j eta => good.gamma (oldGammaIndex j) eta + let goodPrefix : GoodHierarchy HP := + { gamma := gammaPrefix + twoColors := by + intro j eta heta + apply good.twoColors (oldGammaIndex j) eta + rw [← storedEqRaw j] + exact heta + avoidance := by + intro j eta heta c hc + have hetaOld : eta ∈ HierarchyStoredColorsAt H (oldGammaIndex j) := by + rw [← storedEqRaw j] + exact heta + have hold := good.avoidance (oldGammaIndex j) eta hetaOld hc + apply Finset.mem_sdiff.mpr + constructor + · rw [stageMissingEqRaw j] + exact (Finset.mem_sdiff.mp hold).1 + · intro hnew + exact (Finset.mem_sdiff.mp hold).2 (segmentSubsetRaw j eta hnew) + disjointPairs := by + intro j eta theta heta htheta hne + apply good.disjointPairs (oldGammaIndex j) eta theta + · rw [← storedEqRaw j] + exact heta + · rw [← storedEqRaw j] + exact htheta + · exact hne + uniqueRefresh := by + intro i + let io : Fin H.dividerCount := ⟨i.val, by + have hi := i.isLt + change i.val < r.val - 1 at hi + omega⟩ + have hold := good.uniqueRefresh io + rw [storedEqRaw i.succ, stageEqRaw i.succ.castSucc, + starredEqRaw i.castSucc] + simpa [gammaPrefix, oldGammaIndex, io] using hold + parallelBase := by + simpa [ettPrefix, basePrefix, gammaPrefix, oldGammaIndex, HP, + HierarchyStoredColorsAt, HierarchyStarredStage] using + good.parallelBase + minusClosed := by + intro i + let io : Fin H.dividerCount := ⟨i.val, by + have hi := i.isLt + change i.val < r.val - 1 at hi + omega⟩ + have hold := good.minusClosed io + rw [stageEqRaw i.succ.castSucc, storedEqRaw i.succ] + simpa [gammaPrefix, oldGammaIndex, io] using hold } + let lastInternal : Fin H.dividerCount := ⟨r.val - 1, by omega⟩ + have terminalClosed := helper_terminalClosed_412 (@G) (@k) (@e0) (@input) (@T) (@generating) + (@phi) (@ett) (@base) (@H) (@good) (@r) (@hr) + refine ⟨ettPrefix, mpPrefix, rfl, HEq.rfl, basePrefix, rfl, rfl, rfl, + HP, rfl, ?_, ?_, goodPrefix, ?_, terminalClosed⟩ + · intro j + rfl + · intro i + change (H.stage ⟨i.val + 1, by omega⟩).length = + (H.dividerPosition ⟨i.val, by omega⟩).val + exact (oldDividerValue ⟨i.val, by omega⟩).symm + · intro j + constructor + · let jp : Fin (HP.dividerCount + 1) := + Fin.cast (by dsimp [HP, prefixData, prefixHierarchyData]; omega) j + have hs := storedEqRaw jp + convert hs using 1; congr 2 + · intro eta + rfl + +theorem GoodHierarchyPrefixRepackage {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) + (good : GoodHierarchy H) + (r : Fin (H.dividerCount + 1)) (hr : 1 ≤ r.val) : + ∃ ettPrefix : ExtendedTashkinovTree G k e0 input (H.stage r.castSucc) generating, + MaximumProperty ettPrefix ∧ + ettPrefix.rounds = ett.rounds ∧ + HEq ettPrefix.series ett.series ∧ + ∃ basePrefix : HierarchyBase ettPrefix phi, + basePrefix.core = base.core ∧ + basePrefix.closure = base.closure ∧ + basePrefix.supportPosition.val = base.supportPosition.val ∧ + ∃ HP : TashkinovHierarchy ettPrefix basePrefix, + ∃ hcount : HP.dividerCount = r.val - 1, + (∀ j : Fin (r.val + 1), HP.stage (Fin.cast (by omega) j) = H.stage ⟨j.val, by omega⟩) ∧ + (∀ i : Fin (r.val - 1), + (HP.dividerPosition (Fin.cast (by omega) i)).val = + (H.dividerPosition ⟨i.val, by omega⟩).val) ∧ + ∃ goodPrefix : GoodHierarchy HP, + (∀ j : Fin r.val, + HierarchyStoredColorsAt HP (Fin.cast (by omega) j) = + HierarchyStoredColorsAt H ⟨j.val, by omega⟩ ∧ + ∀ eta : Fin k, + goodPrefix.gamma (Fin.cast (by omega) j) eta = good.gamma ⟨j.val, by omega⟩ eta) ∧ + TreeColorSetMinusClosed G phi (H.stage r.castSucc) + ((HierarchyStoredColorsAt H r).biUnion (good.gamma ⟨r.val - 1, by omega⟩)) := by + classical + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + apply TreeSequenceInitialSegment.trans <;> assumption + have stageSegment := @helper_stageSegment_77 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@r) + (@segmentRefl) (@segmentTrans) + have prefixEqOfSegment {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) : + A = TreeSequencePrefix B A.length A.positive hAB.1 := by + exact helper_prefixEqOfSegment_95 (@G) (@e0) (@hAB) + let Tp := H.stage r.castSucc + have firstToPrefix := helper_firstToPrefix_111 (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) + (@ett) (@base) (@H) (@r) (@stageSegment) + have prefixToTerminal := helper_prefixToTerminal_118 (@G) (@k) (@e0) (@input) (@T) (@generating) + (@phi) (@ett) (@base) (@H) (@r) (@stageSegment) + let prefixData := prefixHierarchyData G k e0 input T generating phi ett base H r hr + let ettPrefix := prefixData.1 + have mpPrefix : MaximumProperty ettPrefix := by + simpa [MaximumProperty, ettPrefix] using hMP + let basePrefix := prefixData.2.1 + have oldDividerValue (i : Fin H.dividerCount) : + (H.dividerPosition i).val = + (H.stage ⟨i.val + 1, by omega⟩).length := by + have h := congrArg TreeSequence.length (H.dividerStage i) + simpa [TreeSequencePrefix] using h.symm + let HP := prefixData.2.2 + have beforeFirstMissing {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) (eta : Fin k) + (i : Fin (A.length + 1)) (hiEnd : i.val < A.length) + (hi : i.val < (HierarchyFirstMissingPosition phi A eta).val) : + let iB : Fin (B.length + 1) := + Fin.castLE (Nat.succ_le_succ hAB.1) i + iB.val < (HierarchyFirstMissingPosition phi B eta).val := by + exact helper_beforeFirstMissing_386 (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) + (@base) (@H) (@r) (@hAB) (@eta) (@i) (@hiEnd) (@hi) + have stageEqRaw (j : Fin (HP.dividerCount + 2)) : + HP.stage j = H.stage ⟨j.val, by + have hj := j.isLt + change j.val < r.val - 1 + 2 at hj + omega⟩ := by + rfl + have starredEqRaw (j : Fin (HP.dividerCount + 1)) : + HierarchyStarredStage HP j = + HierarchyStarredStage H ⟨j.val, by + have hj := j.isLt + change j.val < r.val - 1 + 1 at hj + omega⟩ := by + refine Fin.cases ?_ (fun i => ?_) j + · simp [HierarchyStarredStage, prefixData, prefixHierarchyData] + · change HP.stage i.succ.castSucc = + H.stage ⟨i.val + 1, by + have hi := i.isLt + change i.val < r.val - 1 at hi + omega⟩ + exact stageEqRaw i.succ.castSucc + have storedEqRaw (j : Fin (HP.dividerCount + 1)) : + HierarchyStoredColorsAt HP j = + HierarchyStoredColorsAt H ⟨j.val, by + have hj := j.isLt + change j.val < r.val - 1 + 1 at hj + omega⟩ := by + unfold HierarchyStoredColorsAt + dsimp [ettPrefix] + rw [starredEqRaw] + have stageMissingEqRaw (j : Fin (HP.dividerCount + 1)) : + HierarchyStageMissingColors HP j = + HierarchyStageMissingColors H ⟨j.val, by + have hj := j.isLt + change j.val < r.val - 1 + 1 at hj + omega⟩ := by + refine Fin.cases ?_ (fun i => ?_) j + · simp [HierarchyStageMissingColors, prefixData, prefixHierarchyData] + · change TreeMissingColors phi (HP.stage i.succ.castSucc) = + TreeMissingColors phi (H.stage ⟨i.val + 1, by + have hi := i.isLt + change i.val < r.val - 1 at hi + omega⟩) + rw [stageEqRaw i.succ.castSucc] + congr 2 + have segmentSubsetRaw (j : Fin (HP.dividerCount + 1)) (eta : Fin k) : + HierarchySegmentColors HP j eta ⊆ + HierarchySegmentColors H ⟨j.val, by + have hj := j.isLt + change j.val < r.val - 1 + 1 at hj + omega⟩ eta := by + intro c hc + unfold HierarchySegmentColors at hc ⊢ + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hc ⊢ + rcases hc with ⟨x, hafter, hbefore, hcolor⟩ + let jo : Fin (H.dividerCount + 1) := ⟨j.val, by + have hj := j.isLt + change j.val < r.val - 1 + 1 at hj + omega⟩ + have hstage : HP.stage j.succ = H.stage jo.succ := by + rw [stageEqRaw j.succ] + apply congrArg H.stage + apply Fin.ext + rfl + let xo : Fin (H.stage jo.succ).length := + Fin.cast (congrArg TreeSequence.length hstage) x + have hsOld := stageSegment (j.val + 1) + (r.val - (j.val + 1)) (by + have hj := j.isLt + change j.val < r.val - 1 + 1 at hj + omega) + have hind : j.val + 1 + (r.val - (j.val + 1)) = r.val := by + have hj := j.isLt + change j.val < r.val - 1 + 1 at hj + omega + have hidx : (⟨j.val + 1 + (r.val - (j.val + 1)), by omega⟩ : + Fin (H.dividerCount + 2)) = r.castSucc := Fin.ext hind + rw [hidx] at hsOld + have hsNew : TreeSequenceInitialSegment (HP.stage j.succ) Tp := by + rw [hstage] + exact hsOld + have hxStage : x.val < (HP.stage j.succ).length := + lt_of_lt_of_le hbefore (Nat.min_le_right _ _) + have hxFirst : x.val < + (HierarchyFirstMissingPosition phi Tp eta).val := + lt_of_lt_of_le hbefore (Nat.min_le_left _ _) + let ix : Fin (Tp.length + 1) := ⟨x.val, by omega⟩ + have hxOldFirst := beforeFirstMissing prefixToTerminal eta ix + (by dsimp [ix]; omega) (by simpa [ix] using hxFirst) + refine ⟨xo, ?_, ?_, ?_⟩ + · rw [← starredEqRaw j] + simpa [xo] using hafter + · apply lt_min + · simpa [xo, ix] using hxOldFirst + · simp [xo] + · cases hstage + exact hcolor + exact @helper_continuation_626 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) + (@good) (@r) (@hr) (@mpPrefix) (@oldDividerValue) (@stageEqRaw) (@starredEqRaw) + (@storedEqRaw) (@stageMissingEqRaw) (@segmentSubsetRaw) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyReservedDisjoint.lean b/LeanPool/GoldbergSeymour/GoodHierarchyReservedDisjoint.lean new file mode 100644 index 0000000000..33d9b91650 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyReservedDisjoint.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchy + +/-! +# Good Hierarchy Reserved Disjoint + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem GoodHierarchyReservedDisjoint {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} + {base : HierarchyBase ett phi} {H : TashkinovHierarchy ett base} + (good : GoodHierarchy H) (j : Fin (H.dividerCount + 1)) : + (∀ eta ∈ HierarchyStoredColorsAt H j, + good.gamma j eta ⊆ + TreeMissingColors phi (HierarchyStarredStage H j)) ∧ + Disjoint + ((HierarchyStoredColorsAt H j).biUnion (good.gamma j)) + (HierarchyStoredColorsAt H j) := by + classical + have stage_subset : ∀ r : Fin (H.dividerCount + 1), + HierarchyStageMissingColors H r ⊆ + TreeMissingColors phi (HierarchyStarredStage H r) := by + intro r + refine Fin.cases ?_ (fun i => ?_) r + · change TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ⊆ + TreeMissingColors phi base.core + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · obtain ⟨hchosen, hclosure, hu⟩ := base.parallel hp + rcases hu with ⟨u⟩ + have hsub : TreeSequenceVertexSet + (ett.series.data.tree n.castSucc) ⊆ TreeSequenceVertexSet base.core := by + rw [u.vertexSet] + exact Finset.subset_union_left + intro c hc + unfold TreeMissingColors at hc ⊢ + simp only [Finset.mem_biUnion] at hc ⊢ + obtain ⟨v, hv, hcv⟩ := hc + exact ⟨v, hsub hv, hcv⟩ + · have hn := base.nonparallel hp + rw [hn] + · change TreeMissingColors phi (H.stage i.succ.castSucc) ⊆ + TreeMissingColors phi (H.stage i.succ.castSucc) + exact fun c hc => hc + constructor + · intro eta heta c hc + have hav := good.avoidance j eta heta + exact stage_subset j ((Finset.mem_sdiff.mp (hav hc)).1) + · rw [Finset.disjoint_left] + intro c hc hs + simp only [Finset.mem_biUnion] at hc + obtain ⟨eta, heta, hce⟩ := hc + have hav := good.avoidance j eta heta + have hmiss : c ∈ TreeMissingColors phi (HierarchyStarredStage H j) := by + exact stage_subset j ((Finset.mem_sdiff.mp (hav hce)).1) + have hstored := (Finset.mem_sdiff.mp hs).2 + exact hstored hmiss + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedAugmentation.lean b/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedAugmentation.lean new file mode 100644 index 0000000000..ebfc055886 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedAugmentation.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedEndpointReconstruction +public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedMaximalChain + +public import LeanPool.GoldbergSeymour.RestrictedAugmentationCorrespondingEndpoint + +/-! +# Good Hierarchy Restricted Augmentation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem GoodHierarchyRestrictedAugmentation {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hmod : ModColoring ett sigma) (hMP : MaximumProperty ett) + (J : TreeSequence G e0) + (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett sigma J) + (baseJ : HierarchyBase corrJ.replacementETT sigma) + (KJ : TashkinovHierarchy corrJ.replacementETT baseJ) + (goodJ : GoodHierarchy KJ) : + let lastJ : Fin (KJ.dividerCount + 1) := Fin.last KJ.dividerCount + let A : TreeSequence G e0 := HierarchyStarredStage KJ lastJ + let restrictedColors : TreeSequence G e0 → Fin k → Finset (Fin k) := + fun W eta => Finset.univ.filter fun c => + ∃ r : Fin W.length, A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma W eta).val W.length ∧ + sigma (W.edge r) = some c + ∃ (m : ℕ) (chain : Fin (m + 1) → TreeSequence G e0) + (U : TreeSequence G e0), + chain 0 = J ∧ chain (Fin.last m) = U ∧ + (∀ r : Fin m, + TashkinovAugmentation sigma (chain r.castSucc) (chain r.succ) ∧ + ∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) + (restrictedColors (chain r.succ) eta)) ∧ + (∀ r : Fin (m + 1), (chain r).length = J.length + r.val) ∧ + (∀ r s : Fin (m + 1), r.val ≤ s.val → + TreeSequenceInitialSegment (chain r) (chain s)) ∧ + (∀ r : Fin m, + TreeSequenceVertexSet (chain r.castSucc) ⊂ + TreeSequenceVertexSet (chain r.succ)) ∧ + TashkinovAugmentationSequence sigma J U ∧ + (∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) (restrictedColors U eta)) ∧ + (∀ W : TreeSequence G e0, + TashkinovAugmentation sigma U W → + (∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) (restrictedColors W eta)) → + False) ∧ + ∃ corrU : CorrespondingExtendedTashkinovTree G k e0 ett sigma U, + MaximumProperty corrU.replacementETT ∧ + ∃ baseU : HierarchyBase corrU.replacementETT sigma, + baseU.core = baseJ.core ∧ + baseU.closure = baseJ.closure ∧ + baseU.supportPosition.val = baseJ.supportPosition.val ∧ + ∃ KU : TashkinovHierarchy corrU.replacementETT baseU, + ∃ hcount : KU.dividerCount = KJ.dividerCount, + (∀ j : Fin (KU.dividerCount + 1), + let jo : Fin (KJ.dividerCount + 1) := + Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j + KU.stage j.castSucc = KJ.stage jo.castSucc ∧ + HierarchyStarredStage KU j = HierarchyStarredStage KJ jo ∧ + HierarchyStoredColorsAt KU j = + HierarchyStoredColorsAt KJ jo ∧ + HierarchyStageMissingColors KU j = + HierarchyStageMissingColors KJ jo) ∧ + (∀ i : Fin KU.dividerCount, + (KU.dividerPosition i).val = + (KJ.dividerPosition (Fin.cast hcount i)).val) ∧ + ∃ goodU : GoodHierarchy KU, + (∀ j : Fin (KU.dividerCount + 1), + let jo : Fin (KJ.dividerCount + 1) := + Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j + ∀ eta : Fin k, + goodU.gamma j eta = goodJ.gamma jo eta) ∧ + HierarchyTerminalStoredColors KU ⊆ + HierarchyStoredColorsAt KJ lastJ ∧ + TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors KU).biUnion + (goodU.gamma (Fin.last KU.dividerCount))) := by + classical + obtain ⟨m, chain, U, hfirst, hlast, hsteps, hlengths, hsegments, + hvertices, hsequence, havoid, hmaximal⟩ := + GoodHierarchyRestrictedMaximalChain G k e0 corrJ.replacementInput J sigma + baseJ KJ goodJ + obtain ⟨corrU, hMPU⟩ := + RestrictedAugmentationCorrespondingEndpoint G k e0 input T generating sigma + ett hmod hMP J U corrJ hsequence + obtain ⟨baseU, hcore, hclosure, hsupport, KU, hcount, hstages, + hdividers, goodU, hgamma, hstored, hminus⟩ := + GoodHierarchyRestrictedEndpointReconstruction G k e0 input T generating + sigma ett J U corrJ baseJ KJ goodJ corrU hsequence havoid hmaximal + exact ⟨m, chain, U, hfirst, hlast, hsteps, hlengths, hsegments, + hvertices, hsequence, havoid, hmaximal, corrU, hMPU, baseU, hcore, + hclosure, hsupport, KU, hcount, hstages, hdividers, goodU, hgamma, + hstored, hminus⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedEndpointMinusClosed.lean b/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedEndpointMinusClosed.lean new file mode 100644 index 0000000000..6de15ef236 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedEndpointMinusClosed.lean @@ -0,0 +1,185 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryMissingColorAugmentation +public import LeanPool.GoldbergSeymour.GoodHierarchy + +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff + +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors + +/-! +# Good Hierarchy Restricted Endpoint Minus Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem GoodHierarchyRestrictedEndpointMinusClosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + {inputJ inputU : PartialEdgeColoring E k} + (J U : TreeSequence G e0) (sigma : PartialEdgeColoring E k) + {generatingJ generatingU : PartialEdgeColoring E k} + {ettJ : ExtendedTashkinovTree G k e0 inputJ J generatingJ} + {ettU : ExtendedTashkinovTree G k e0 inputU U generatingU} + {baseJ : HierarchyBase ettJ sigma} {baseU : HierarchyBase ettU sigma} + (KJ : TashkinovHierarchy ettJ baseJ) (goodJ : GoodHierarchy KJ) + (KU : TashkinovHierarchy ettU baseU) (goodU : GoodHierarchy KU) + (hgammaLast : ∀ eta : Fin k, + goodU.gamma (Fin.last KU.dividerCount) eta = + goodJ.gamma (Fin.last KJ.dividerCount) eta) + (hterminal : HierarchyTerminalStoredColors KU ⊆ + HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount)) + (hnewMissing : ∀ eta : Fin k, + eta ∈ HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount) → + eta ∉ HierarchyTerminalStoredColors KU → + eta ∈ TreeMissingColors sigma U) : + let lastJ : Fin (KJ.dividerCount + 1) := Fin.last KJ.dividerCount + let A : TreeSequence G e0 := HierarchyStarredStage KJ lastJ + let restrictedColors : TreeSequence G e0 → Fin k → Finset (Fin k) := + fun W eta => Finset.univ.filter fun c => + ∃ r : Fin W.length, A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma W eta).val W.length ∧ + sigma (W.edge r) = some c + (∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) (restrictedColors U eta)) → + (∀ W : TreeSequence G e0, + TashkinovAugmentation sigma U W → + (∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) (restrictedColors W eta)) → + False) → + TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors KU).biUnion + (goodU.gamma (Fin.last KU.dividerCount))) := by + classical + dsimp + intro havoid hmaximal + unfold TreeColorSetMinusClosed TreeColorSetClosed + intro c hc + obtain ⟨hcMissing, hcOutside⟩ := Finset.mem_sdiff.mp hc + by_contra hboundary + have hnonempty : + (BoundaryColorEdges G sigma (TreeSequenceVertexSet U) c).Nonempty := + Finset.nonempty_iff_ne_empty.mpr hboundary + obtain ⟨f, hf⟩ := hnonempty + obtain ⟨W, hAdjoin, hAugment, _⟩ := + BoundaryMissingColorAugmentation G k e0 sigma U c f hf hcMissing + obtain ⟨hLength, hInitial, hLastEdge⟩ := hAdjoin + apply hmaximal W hAugment + intro eta heta + apply Finset.disjoint_left.mpr + intro x hxGamma hxRestricted + rw [Finset.mem_filter] at hxRestricted + obtain ⟨_, r, hrA, hrCutoff, hrColor⟩ := hxRestricted + by_cases hetaTerminal : eta ∈ HierarchyTerminalStoredColors KU + · have hetaLast := hterminal hetaTerminal + have hcGammaU : c ∉ goodU.gamma (Fin.last KU.dividerCount) eta := by + intro hcGamma + apply hcOutside + exact Finset.mem_biUnion.mpr ⟨eta, hetaTerminal, hcGamma⟩ + have hcGammaJ : c ∉ goodJ.gamma (Fin.last KJ.dividerCount) eta := by + rw [← hgammaLast eta] + exact hcGammaU + have hCutoff := HierarchyFirstMissingPositionPrefixCutoff sigma U W + hInitial eta U.length (le_refl U.length) + by_cases hrOld : r.val < U.length + · let rU : Fin U.length := ⟨r.val, hrOld⟩ + have hrCutoffU : + rU.val < min (HierarchyFirstMissingPosition sigma U eta).val U.length := by + rw [hCutoff] + dsimp [rU] + have hFirst := Nat.min_le_left + (HierarchyFirstMissingPosition sigma W eta).val W.length + omega + have hrEdge : W.edge r = U.edge rU := by + have hrCast : Fin.castLE hInitial.1 rU = r := Fin.ext rfl + rw [← hrCast, hInitial.2.2 rU] + have hxRestrictedU : x ∈ Finset.univ.filter (fun d => + ∃ s : Fin U.length, + (HierarchyStarredStage KJ (Fin.last KJ.dividerCount)).length ≤ s.val ∧ + s.val < min (HierarchyFirstMissingPosition sigma U eta).val U.length ∧ + sigma (U.edge s) = some d) := by + rw [Finset.mem_filter] + exact ⟨Finset.mem_univ x, rU, hrA, hrCutoffU, hrEdge ▸ hrColor⟩ + exact (Finset.disjoint_left.mp (havoid eta hetaLast)) hxGamma hxRestrictedU + · have hrLast : r.val = U.length := by + have hrBound : r.val < U.length + 1 := by simpa [hLength] using r.isLt + omega + have hrEq : r = Fin.cast hLength.symm (Fin.last U.length) := by + apply Fin.ext + simp [hrLast] + have hxEq : x = c := by + rw [hrEq, hLastEdge] at hrColor + have hfColor : sigma f = some c := by + have hf' := hf + change f ∈ (BoundaryEdges G (TreeSequenceVertexSet U)).filter + (fun g => sigma g = some c) at hf' + exact (Finset.mem_filter.mp hf').2 + exact Option.some.inj (hrColor.symm.trans hfColor) + exact hcGammaJ (hxEq ▸ hxGamma) + · have hetaMissing := hnewMissing eta heta hetaTerminal + have hFirstWBound : + (HierarchyFirstMissingPosition sigma W eta).val ≤ U.length := by + simp only [TreeMissingColors, Finset.mem_biUnion] at hetaMissing + obtain ⟨v, hvU, hetaV⟩ := hetaMissing + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hvU + obtain ⟨i, hi⟩ := hvU + let iW : Fin (W.length + 1) := + Fin.castLE (Nat.succ_le_succ hInitial.1) i + have hiW : eta ∈ MissingColors G sigma (W.vertex iW) := by + rw [hInitial.2.1 i] + simpa [hi] using hetaV + let candidates : Finset (Fin (W.length + 1)) := + Finset.univ.filter fun j => eta ∈ MissingColors G sigma (W.vertex j) + have hiCand : iW ∈ candidates := by + exact Finset.mem_filter.mpr ⟨Finset.mem_univ iW, hiW⟩ + have hCand : candidates.Nonempty := ⟨iW, hiCand⟩ + have hFirst : HierarchyFirstMissingPosition sigma W eta = + candidates.min' hCand := by + simp [HierarchyFirstMissingPosition, candidates, hCand] + have hle := Finset.min'_le candidates iW hiCand + rw [hFirst] + change (candidates.min' hCand).val ≤ U.length + change (candidates.min' hCand).val ≤ iW.val at hle + have hiBound : iW.val ≤ U.length := by + dsimp [iW] + omega + omega + have hCutoff := HierarchyFirstMissingPositionPrefixCutoff sigma U W + hInitial eta U.length (le_refl U.length) + have hrOld : r.val < U.length := by + omega + let rU : Fin U.length := ⟨r.val, hrOld⟩ + have hrCutoffU : + rU.val < min (HierarchyFirstMissingPosition sigma U eta).val U.length := by + rw [hCutoff] + dsimp [rU] + have hFirst := Nat.min_le_left + (HierarchyFirstMissingPosition sigma W eta).val W.length + omega + have hrEdge : W.edge r = U.edge rU := by + have hrCast : Fin.castLE hInitial.1 rU = r := Fin.ext rfl + rw [← hrCast, hInitial.2.2 rU] + have hxRestrictedU : x ∈ Finset.univ.filter (fun d => + ∃ s : Fin U.length, + (HierarchyStarredStage KJ (Fin.last KJ.dividerCount)).length ≤ s.val ∧ + s.val < min (HierarchyFirstMissingPosition sigma U eta).val U.length ∧ + sigma (U.edge s) = some d) := by + rw [Finset.mem_filter] + exact ⟨Finset.mem_univ x, rU, hrA, hrCutoffU, hrEdge ▸ hrColor⟩ + exact (Finset.disjoint_left.mp (havoid eta heta)) hxGamma hxRestrictedU + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedEndpointReconstruction.lean b/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedEndpointReconstruction.lean new file mode 100644 index 0000000000..bd86424b8c --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedEndpointReconstruction.lean @@ -0,0 +1,128 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport +public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedEndpointMinusClosed +public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerReconstruction +public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerTransport + +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast + +/-! +# Good Hierarchy Restricted Endpoint Reconstruction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem GoodHierarchyRestrictedEndpointReconstruction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (J U : TreeSequence G e0) + (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett sigma J) + (baseJ : HierarchyBase corrJ.replacementETT sigma) + (KJ : TashkinovHierarchy corrJ.replacementETT baseJ) + (goodJ : GoodHierarchy KJ) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett sigma U) + (hJU : TashkinovAugmentationSequence sigma J U) : + let lastJ : Fin (KJ.dividerCount + 1) := Fin.last KJ.dividerCount + let A : TreeSequence G e0 := HierarchyStarredStage KJ lastJ + let restrictedColors : TreeSequence G e0 → Fin k → Finset (Fin k) := + fun W eta => Finset.univ.filter fun c => + ∃ r : Fin W.length, A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma W eta).val W.length ∧ + sigma (W.edge r) = some c + (∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) (restrictedColors U eta)) → + (∀ W : TreeSequence G e0, + TashkinovAugmentation sigma U W → + (∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) (restrictedColors W eta)) → + False) → + ∃ baseU : HierarchyBase corrU.replacementETT sigma, + baseU.core = baseJ.core ∧ + baseU.closure = baseJ.closure ∧ + baseU.supportPosition.val = baseJ.supportPosition.val ∧ + ∃ KU : TashkinovHierarchy corrU.replacementETT baseU, + ∃ hcount : KU.dividerCount = KJ.dividerCount, + (∀ j : Fin (KU.dividerCount + 1), + let jo : Fin (KJ.dividerCount + 1) := + Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j + KU.stage j.castSucc = KJ.stage jo.castSucc ∧ + HierarchyStarredStage KU j = HierarchyStarredStage KJ jo ∧ + HierarchyStoredColorsAt KU j = + HierarchyStoredColorsAt KJ jo ∧ + HierarchyStageMissingColors KU j = + HierarchyStageMissingColors KJ jo) ∧ + (∀ i : Fin KU.dividerCount, + (KU.dividerPosition i).val = + (KJ.dividerPosition (Fin.cast hcount i)).val) ∧ + ∃ goodU : GoodHierarchy KU, + (∀ j : Fin (KU.dividerCount + 1), + let jo : Fin (KJ.dividerCount + 1) := + Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j + ∀ eta : Fin k, + goodU.gamma j eta = goodJ.gamma jo eta) ∧ + HierarchyTerminalStoredColors KU ⊆ + HierarchyStoredColorsAt KJ lastJ ∧ + TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors KU).biUnion + (goodU.gamma (Fin.last KU.dividerCount))) := by + classical + dsimp + intro havoid hmaximal + obtain ⟨baseU, hcore, hclosure, hsupport⟩ := + GoodHierarchyCommonOriginalBaseTransport G k e0 input T generating sigma + ett J U corrJ baseJ corrU + obtain ⟨KU, hcount, hstages, hdividers⟩ := + GoodHierarchySameDividerReconstruction G k e0 input T generating sigma + ett J U corrJ baseJ KJ corrU baseU hcore hJU + obtain ⟨goodU, hgamma⟩ := + GoodHierarchySameDividerTransport G k e0 input T generating sigma ett J U + corrJ baseJ KJ goodJ corrU baseU hcore hclosure KU hcount hstages hJU + havoid + have hlastStored : + HierarchyStoredColorsAt KU (Fin.last KU.dividerCount) = + HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount) := by + have h := (hstages (Fin.last KU.dividerCount)).2.2.1 + simpa using h + have hstored : HierarchyTerminalStoredColors KU ⊆ + HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount) := by + intro eta heta + rw [← hlastStored] + exact (HierarchyTerminalStoredColorsSubsetLast KU).1 heta + have hnewMissing : + ∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount) → eta ∉ + HierarchyTerminalStoredColors KU → eta ∈ TreeMissingColors sigma U := by + intro eta heta hnot + apply (HierarchyTerminalStoredColorsSubsetLast KU).2 eta + · rw [hlastStored] + exact heta + · exact hnot + have hgammaLast : ∀ eta : Fin k, + goodU.gamma (Fin.last KU.dividerCount) eta = + goodJ.gamma (Fin.last KJ.dividerCount) eta := by + intro eta + simpa using hgamma (Fin.last KU.dividerCount) eta + have hminus := + GoodHierarchyRestrictedEndpointMinusClosed G k e0 J U sigma KJ goodJ KU + goodU hgammaLast hstored hnewMissing + havoid hmaximal + exact ⟨baseU, hcore, hclosure, hsupport, KU, hcount, hstages, + hdividers, goodU, hgamma, hstored, hminus⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedMaximalChain.lean b/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedMaximalChain.lean new file mode 100644 index 0000000000..ca0b2b2f39 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyRestrictedMaximalChain.lean @@ -0,0 +1,392 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchy + +/-! +# Good Hierarchy Restricted Maximal Chain + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_extendPath_182.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (J : + TreeSequence G e0) (sigma : PartialEdgeColoring E k) + {generating : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input J generating} (baseJ : HierarchyBase ett sigma) + (KJ : TashkinovHierarchy ett baseJ) (goodJ : GoodHierarchy KJ), + let lastJ : Fin (KJ.dividerCount + (1 : ℕ)) := Fin.last KJ.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage KJ lastJ; + let colors : TreeSequence G e0 → Fin k → Finset (Fin k) := fun (W : TreeSequence G e0) (eta : + Fin k) => {c : Fin k | + ∃ (r : Fin W.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition + sigma W eta) : ℕ) W.length ∧ sigma (W.edge r) = some c}; + let avoids : TreeSequence G e0 → Prop := fun (W : TreeSequence G e0) => + ∀ eta ∈ HierarchyStoredColorsAt KJ lastJ, Disjoint (goodJ.gamma lastJ eta) (colors W eta); ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let Path : (n : ℕ) → (Fin (n + (1 : ℕ)) → TreeSequence G e0) → Prop := fun (n : ℕ) (q : Fin (n + + (1 : ℕ)) → TreeSequence G e0) => q (0 : Fin (n + (1 : ℕ))) = J ∧ ( + ∀ (r : Fin n), TashkinovAugmentation sigma (q r.castSucc) (q r.succ) ∧ avoids (q r.succ)) ∧ ( + ∀ (r : Fin (n + (1 : ℕ))), (q r).length = J.length + (↑r : ℕ)) ∧ + ∀ (r s : Fin (n + (1 : ℕ))), (↑r : ℕ) ≤ (↑s : ℕ) → TreeSequenceInitialSegment (q r) (q s); + ∀ {n : ℕ} {q : Fin (n + (1 : ℕ)) → TreeSequence G e0}, Path n q → + ∀ {W : TreeSequence G e0}, TashkinovAugmentation sigma (q (Fin.last n)) W → avoids W → Path (n + + (1 : ℕ)) fun (i : Fin (n + (1 : ℕ) + (1 : ℕ))) => Fin.lastCases W (fun (i : Fin (n + (1 + : ℕ))) => q i) i := by + classical + intro V E _ _ _ _ G k e0 input J sigma generating ett baseJ KJ goodJ lastJ A colors avoids + segmentTrans Path n q hq W haug haw + rcases haug with ⟨hlen, hseg, hc⟩ + let qnew : Fin (n + 2) → TreeSequence G e0 := + Fin.lastCases W (fun i => q i) + have haug' : TashkinovAugmentation sigma (q (Fin.last n)) W := + ⟨hlen, hseg, hc⟩ + refine ⟨?_, ?_, ?_, ?_⟩ + · rw [show (0 : Fin (n + 2)) = (0 : Fin (n + 1)).castSucc by rfl] + simp only [Fin.lastCases_castSucc] + exact hq.1 + · intro r + refine Fin.lastCases ?_ (fun i => ?_) r + · simpa [qnew, Fin.lastCases_castSucc, Fin.lastCases_last] using ⟨haug', haw⟩ + · simpa only [Fin.lastCases_castSucc, Fin.succ_castSucc] using hq.2.1 i + · intro r + refine Fin.lastCases ?_ (fun i => ?_) r + · simpa [qnew, Fin.lastCases_castSucc, Fin.lastCases_last, Nat.add_assoc, + hq.2.2.1 (Fin.last n)] using hlen + · simpa using hq.2.2.1 i + · intro r s hrs + revert r + refine Fin.lastCases ?_ (fun s0 => ?_) s + · intro r hrs + revert hrs + refine Fin.lastCases ?_ (fun r0 => ?_) r + · intro hrs + exact ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + · intro hrs + have hbound : r0.val ≤ n := Nat.le_of_lt_succ r0.isLt + simpa [qnew, Fin.succ_castSucc, Fin.lastCases_last] using + segmentTrans (hq.2.2.2 r0 (Fin.last n) hbound) hseg + · intro r hrs + revert hrs + refine Fin.lastCases ?_ (fun s1 => ?_) s0 + · intro hrs + revert hrs + refine Fin.lastCases ?_ (fun r0 => ?_) r + · intro hrs + have hle : (Fin.last (n + 1)).val ≤ (Fin.last n).castSucc.val := by + simp at hrs + have hlt : (Fin.last n).castSucc.val < (Fin.last (n + 1)).val := by + simp + exfalso + exact (Nat.not_le_of_gt hlt) hle + · intro hrs + simpa [qnew, Fin.succ_castSucc, Fin.lastCases_last] using + hq.2.2.2 r0 (Fin.last n) (Nat.le_of_lt_succ r0.isLt) + · intro hrs + revert hrs + refine Fin.lastCases ?_ (fun r1 => ?_) r + · intro hrs + have hle : (Fin.last (n + 1)).val ≤ s1.castSucc.castSucc.val := by + simpa using hrs + have hlt : s1.castSucc.castSucc.val < (Fin.last (n + 1)).val := by + have hs : s1.val < n := s1.isLt + have hs' : s1.val < n + 1 := Nat.lt_succ_of_lt hs + simp + exfalso + exact (Nat.not_le_of_gt hlt) hle + · intro hrs + simpa [qnew, Fin.succ_castSucc] using + hq.2.2.2 r1 s1.castSucc (by simpa using hrs) + +private theorem helper_continuation_276.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (J : + TreeSequence G e0) (sigma : PartialEdgeColoring E k) + {generating : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input J generating} (baseJ : HierarchyBase ett sigma) + (KJ : TashkinovHierarchy ett baseJ) (goodJ : GoodHierarchy KJ), + let _ : DecidableEq V := inferInstance; + let lastJ : Fin (KJ.dividerCount + (1 : ℕ)) := Fin.last KJ.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage KJ lastJ; + let colors : TreeSequence G e0 → Fin k → Finset (Fin k) := fun (W : TreeSequence G e0) (eta : + Fin k) ↦ ({c : Fin k | + ∃ (r : Fin W.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition + sigma W eta) : ℕ) W.length ∧ sigma (W.edge r) = some c} : Finset (Fin k)); + let avoids : TreeSequence G e0 → Prop := fun (W : TreeSequence G e0) ↦ + ∀ eta ∈ HierarchyStoredColorsAt KJ lastJ, Disjoint (goodJ.gamma lastJ eta) (colors W eta); + avoids J → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y : TreeSequence G e0}, TashkinovAugmentation sigma X Y → TreeSequenceVertexSet X ⊂ + TreeSequenceVertexSet Y) → + let Path : (n : ℕ) → (Fin (n + (1 : ℕ)) → TreeSequence G e0) → Prop := fun (n : ℕ) (q : Fin (n + + (1 : ℕ)) → TreeSequence G e0) ↦ q (0 : Fin (n + (1 : ℕ))) = J ∧ ( + ∀ (r : Fin n), TashkinovAugmentation sigma (q r.castSucc) (q r.succ) ∧ avoids (q r.succ)) ∧ ( + ∀ (r : Fin (n + (1 : ℕ))), (q r).length = J.length + (↑r : ℕ)) ∧ + ∀ (r s : Fin (n + (1 : ℕ))), (↑r : ℕ) ≤ (↑s : ℕ) → TreeSequenceInitialSegment (q r) (q s); + (Path (0 : ℕ) fun (_ : Fin ((0 : ℕ) + (1 : ℕ))) ↦ J) → ( + ∀ {n : ℕ} {q : Fin (n + (1 : ℕ)) → TreeSequence G e0}, Path n q → n ≤ Fintype.card V) → + ∃ (m : ℕ) (chain : Fin (m + (1 : ℕ)) → TreeSequence G e0) (U : TreeSequence G e0), chain (0 : + Fin (m + (1 : ℕ))) = J ∧ chain (Fin.last m) = U ∧ ( + ∀ (r : Fin m), TashkinovAugmentation sigma (chain r.castSucc) (chain r.succ) ∧ + ∀ eta ∈ HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount), Disjoint (goodJ.gamma (Fin.last + KJ.dividerCount) eta) ({c : Fin k | + ∃ (r_1 : Fin (chain r.succ).length), (HierarchyStarredStage KJ (Fin.last + KJ.dividerCount)).length ≤ (↑r_1 : ℕ) ∧ (↑r_1 : ℕ) < min (↑(HierarchyFirstMissingPosition + sigma (chain r.succ) eta) : ℕ) (chain r.succ).length ∧ sigma ((chain r.succ).edge r_1) = + some c} : Finset (Fin k))) ∧ ( + ∀ (r : Fin (m + (1 : ℕ))), (chain r).length = J.length + (↑r : ℕ)) ∧ ( + ∀ (r s : Fin (m + (1 : ℕ))), (↑r : ℕ) ≤ (↑s : ℕ) → TreeSequenceInitialSegment (chain r) (chain + s)) ∧ ( + ∀ (r : Fin m), TreeSequenceVertexSet (chain r.castSucc) ⊂ TreeSequenceVertexSet (chain + r.succ)) ∧ TashkinovAugmentationSequence sigma J U ∧ ( + ∀ eta ∈ HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount), Disjoint (goodJ.gamma (Fin.last + KJ.dividerCount) eta) ({c : Fin k | + ∃ (r : Fin U.length), (HierarchyStarredStage KJ (Fin.last KJ.dividerCount)).length ≤ (↑r : ℕ) + ∧ (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition sigma U eta) : ℕ) U.length ∧ sigma + (U.edge r) = some c} : Finset (Fin k))) ∧ + ∀ (W : TreeSequence G e0), TashkinovAugmentation sigma U W → ( + ∀ eta ∈ HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount), Disjoint (goodJ.gamma (Fin.last + KJ.dividerCount) eta) ({c : Fin k | + ∃ (r : Fin W.length), (HierarchyStarredStage KJ (Fin.last KJ.dividerCount)).length ≤ (↑r : ℕ) + ∧ (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition sigma W eta) : ℕ) W.length ∧ sigma + (W.edge r) = some c} : Finset (Fin k))) → False := by + classical + intro V E _ _ _ _ G k e0 input J sigma generating ett baseJ KJ goodJ vertexDecidable lastJ A + colors avoids initialAvoid segmentTrans strictOfAug Path zeroPath pathBound + let attainable : Finset ℕ := + (Finset.range (Fintype.card V + 1)).filter + (fun n => ∃ q : Fin (n + 1) → TreeSequence G e0, Path n q) + have attainableNonempty : attainable.Nonempty := by + refine ⟨0, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (Nat.zero_lt_succ _), + ⟨fun _ => J, zeroPath⟩⟩⟩ + let m := attainable.max' attainableNonempty + have hm : m ∈ attainable := Finset.max'_mem attainable attainableNonempty + rcases Finset.mem_filter.mp hm with ⟨hmrange, ⟨chain, hchain⟩⟩ + have extendPath := @helper_extendPath_182 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input J sigma generating ett baseJ KJ goodJ segmentTrans + have terminal : ∀ W : TreeSequence G e0, + TashkinovAugmentation sigma (chain (Fin.last m)) W → avoids W → False := by + intro W hW havoid + have hp := extendPath hchain hW havoid + have hnext : m + 1 ≤ Fintype.card V := pathBound hp + have hmem : m + 1 ∈ attainable := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_range.mpr ?_, ⟨Fin.lastCases W (fun i => chain i), hp⟩⟩ + omega + have hle := Finset.le_max' attainable (m + 1) hmem + omega + let U : TreeSequence G e0 := chain (Fin.last m) + refine ⟨m, chain, U, hchain.1, rfl, ?_, hchain.2.2.1, hchain.2.2.2, ?_, ?_, ?_, ?_⟩ + · intro r + exact hchain.2.1 r + · intro r + exact strictOfAug (hchain.2.1 r).1 + · have pathSequence : ∀ n (q : Fin (n + 1) → TreeSequence G e0), + Path n q → TashkinovAugmentationSequence sigma (q 0) (q (Fin.last n)) := by + intro n + induction n with + | zero => + intro q hq + exact Relation.ReflTransGen.refl + | succ n ih => + intro q hq + let qold : Fin (n + 1) → TreeSequence G e0 := fun i => q i.castSucc + have hold : Path n qold := by + refine ⟨?_, ?_, ?_, ?_⟩ + · simpa [qold] using hq.1 + · intro r + simpa [qold] using hq.2.1 r.castSucc + · intro r + simpa [qold] using hq.2.2.1 r.castSucc + · intro r s hrs + simpa [qold] using hq.2.2.2 r.castSucc s.castSucc (by simpa using hrs) + exact Relation.ReflTransGen.tail (ih qold hold) (hq.2.1 (Fin.last n)).1 + simpa [U, hchain.1] using pathSequence m chain hchain + · intro eta heta + by_cases hz : m = 0 + · have hidx : Fin.last m = (0 : Fin (m + 1)) := by + apply Fin.ext + simp [hz] + have hU : U = J := by + dsimp [U] + rw [hidx] + exact hchain.1 + rw [hU] + exact initialAvoid eta heta + · obtain ⟨n, hn⟩ := Nat.exists_eq_succ_of_ne_zero hz + let r : Fin m := ⟨n, by omega⟩ + have hi : r.succ = Fin.last m := by + apply Fin.ext + simp [r, hn] + have hU : chain r.succ = U := by + dsimp [U] + rw [hi] + rw [← hU] + simpa [avoids, colors, lastJ] using (hchain.2.1 r).2 eta heta + · intro W hW havoid + exact terminal W hW havoid + +theorem GoodHierarchyRestrictedMaximalChain {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (J : TreeSequence G e0) + (sigma : PartialEdgeColoring E k) + {generating : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input J generating} + (baseJ : HierarchyBase ett sigma) + (KJ : TashkinovHierarchy ett baseJ) (goodJ : GoodHierarchy KJ) : + let lastJ : Fin (KJ.dividerCount + 1) := Fin.last KJ.dividerCount + let A : TreeSequence G e0 := HierarchyStarredStage KJ lastJ + let restrictedColors : TreeSequence G e0 → Fin k → Finset (Fin k) := + fun W eta => Finset.univ.filter fun c => + ∃ r : Fin W.length, A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma W eta).val W.length ∧ + sigma (W.edge r) = some c + ∃ (m : ℕ) (chain : Fin (m + 1) → TreeSequence G e0) + (U : TreeSequence G e0), + chain 0 = J ∧ chain (Fin.last m) = U ∧ + (∀ r : Fin m, + TashkinovAugmentation sigma (chain r.castSucc) (chain r.succ) ∧ + ∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) + (restrictedColors (chain r.succ) eta)) ∧ + (∀ r : Fin (m + 1), (chain r).length = J.length + r.val) ∧ + (∀ r s : Fin (m + 1), r.val ≤ s.val → + TreeSequenceInitialSegment (chain r) (chain s)) ∧ + (∀ r : Fin m, + TreeSequenceVertexSet (chain r.castSucc) ⊂ + TreeSequenceVertexSet (chain r.succ)) ∧ + TashkinovAugmentationSequence sigma J U ∧ + (∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) (restrictedColors U eta)) ∧ + (∀ W : TreeSequence G e0, + TashkinovAugmentation sigma U W → + (∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) (restrictedColors W eta)) → + False) := by + let vertexDecidable : DecidableEq V := inferInstance + classical + dsimp + let lastJ : Fin (KJ.dividerCount + 1) := Fin.last KJ.dividerCount + let A : TreeSequence G e0 := HierarchyStarredStage KJ lastJ + let colors : TreeSequence G e0 → Fin k → Finset (Fin k) := + fun W eta => Finset.univ.filter fun c => + ∃ r : Fin W.length, A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma W eta).val W.length ∧ + sigma (W.edge r) = some c + let avoids (W : TreeSequence G e0) : Prop := + ∀ eta : Fin k, eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) (colors W eta) + have initialAvoid : avoids J := by + intro eta heta + have hgood := goodJ.avoidance lastJ eta heta + have hterminal : KJ.stage lastJ.succ = J := by + simpa [lastJ] using KJ.terminalStage + have hlen : J.length = (KJ.stage lastJ.succ).length := + congrArg TreeSequence.length hterminal.symm + change Disjoint (goodJ.gamma lastJ eta) (colors J eta) + have hsub : colors J eta ⊆ HierarchySegmentColors KJ lastJ eta := by + intro c hc + rcases Finset.mem_filter.mp hc with ⟨_, r, hra, hrb, hcol⟩ + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + rw [hterminal] + exact ⟨r, hra, hrb, hcol⟩ + refine Finset.disjoint_left.2 ?_ + intro c hgc hcc + exact (Finset.mem_sdiff.mp (hgood hgc)).2 (hsub hcc) + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + rcases hXY with ⟨hxy, vxy, exy⟩ + rcases hYZ with ⟨hyz, vyz, eyz⟩ + refine ⟨hxy.trans hyz, ?_, ?_⟩ + · intro i + calc + Z.vertex (Fin.castLE (Nat.succ_le_succ (hxy.trans hyz)) i) = + Z.vertex (Fin.castLE (Nat.succ_le_succ hyz) + (Fin.castLE (Nat.succ_le_succ hxy) i)) := by congr 1 + _ = Y.vertex (Fin.castLE (Nat.succ_le_succ hxy) i) := vyz _ + _ = X.vertex i := vxy _ + · intro i + calc + Z.edge (Fin.castLE (hxy.trans hyz) i) = + Z.edge (Fin.castLE hyz (Fin.castLE hxy i)) := by congr 1 + _ = Y.edge (Fin.castLE hxy i) := eyz _ + _ = X.edge i := exy _ + have strictOfAug {X Y : TreeSequence G e0} + (h : TashkinovAugmentation sigma X Y) : + TreeSequenceVertexSet X ⊂ TreeSequenceVertexSet Y := by + rcases h with ⟨hlen, hseg, hc⟩ + rcases hseg with ⟨hle, hv, he⟩ + let : DecidableEq V := Classical.decEq V + rw [TreeSequenceVertexSet, TreeSequenceVertexSet] + constructor + · intro v hvx + rcases Finset.mem_image.mp hvx with ⟨i, _, hi⟩ + apply Finset.mem_image.mpr + refine ⟨Fin.castLE (Nat.succ_le_succ hle) i, Finset.mem_univ _, ?_⟩ + exact (hv i).trans hi + · intro heq + have hlast : Y.vertex (Fin.last Y.length) ∈ + Finset.univ.image Y.vertex := Finset.mem_image.mpr ⟨Fin.last Y.length, + Finset.mem_univ _, rfl⟩ + have hback := heq hlast + rcases Finset.mem_image.mp hback with ⟨i, _, hi⟩ + have hvi : Y.vertex (Fin.last Y.length) = + Y.vertex (Fin.castLE (Nat.succ_le_succ hle) i) := + hi.symm.trans (hv i).symm + have hind := Y.vertex_injective hvi + have hval : Y.length = (Fin.castLE (Nat.succ_le_succ hle) i).val := + congrArg Fin.val hind + have hile : (Fin.castLE (Nat.succ_le_succ hle) i).val ≤ X.length := by + have hi0 : i.val ≤ X.length := by omega + simpa using hi0 + have : (Fin.castLE (Nat.succ_le_succ hle) i).val < Y.length := by + omega + omega + let Path (n : ℕ) (q : Fin (n + 1) → TreeSequence G e0) : Prop := + q 0 = J ∧ + (∀ r : Fin n, + TashkinovAugmentation sigma (q r.castSucc) (q r.succ) ∧ + avoids (q r.succ)) ∧ + (∀ r : Fin (n + 1), (q r).length = J.length + r.val) ∧ + (∀ r s : Fin (n + 1), r.val ≤ s.val → + TreeSequenceInitialSegment (q r) (q s)) + have zeroPath : Path 0 (fun _ => J) := by + refine ⟨rfl, ?_, ?_, ?_⟩ + · intro r + exact Fin.elim0 r + · intro r + simp + · intro r s h + exact ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + have pathBound {n : ℕ} {q : Fin (n + 1) → TreeSequence G e0} + (hq : Path n q) : n ≤ Fintype.card V := by + have hc := Fintype.card_le_of_injective (q (Fin.last n)).vertex + (q (Fin.last n)).vertex_injective + have hl := hq.2.2.1 (Fin.last n) + have hcard : J.length + n + 1 ≤ Fintype.card V := by + simpa [Fintype.card_fin, hl] using hc + omega + exact @helper_continuation_276 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@J) (@sigma) (@generating) (@ett) (@baseJ) (@KJ) + (@goodJ) (@initialAvoid) (@segmentTrans) (@strictOfAug) (@zeroPath) (@pathBound) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean b/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean new file mode 100644 index 0000000000..d9b35ccf29 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean @@ -0,0 +1,1461 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Good Hierarchy Same Divider Reconstruction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation610Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (J U : TreeSequence G e0) + (replacementInputJ : PartialEdgeColoring E k) + (replacementSeriesJ : TashkinovSeries G k ett.rounds e0 replacementInputJ) + (finalGeneratingColoringJ : sigma = replacementSeriesJ.data.coloring (Fin.last ett.rounds)) + (ladderTreesAgreeJ : + ∀ (i : Fin ett.rounds), + replacementSeriesJ.data.tree i.succ.castSucc = ett.series.data.tree i.succ.castSucc) + (storedColorsAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeriesJ.data.stored i = ett.series.data.stored i) + (connectingEdgesAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.connectingEdges i = ett.series.data.connectingEdges i) + (extensionKindsAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeriesJ.data.kind i = ett.series.data.kind i) + (replacementProperJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (replacementSeriesJ.data.coloring i)) + (replacementOneUncoloredJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (replacementSeriesJ.data.coloring i) e0) + (replacementStableJ : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (replacementSeriesJ.data.coloring i.succ)) + (roundsPositiveJ : (1 : ℕ) ≤ ett.rounds) + (aboveJ : + TreeSequenceInitialSegment + (replacementSeriesJ.data.tree (⟨ett.rounds, (by omega)⟩ : Fin (ett.rounds + (2 : ℕ)))) J) + (strictJ : + (replacementSeriesJ.data.tree (⟨ett.rounds, (by omega)⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + J.length) + (belowJ : + TreeSequenceInitialSegment J (replacementSeriesJ.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (generatingJ : sigma = replacementSeriesJ.data.coloring (Fin.last ett.rounds)) + (seriesPresentationJ : + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, series := replacementSeriesJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.series ≍ + replacementSeriesJ) + (baseJ : + HierarchyBase + { replacementInput := replacementInputJ, replacementSeries := replacementSeriesJ, + replacementETT := + { + rounds := ett.rounds, roundsPositive := roundsPositiveJ, series := replacementSeriesJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }, + rungAgreement := + Eq.refl + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, series := replacementSeriesJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.rounds, + seriesPresentation := seriesPresentationJ, + finalGeneratingColoring := finalGeneratingColoringJ, ladderTreesAgree := ladderTreesAgreeJ, + storedColorsAgree := storedColorsAgreeJ, connectingEdgesAgree := connectingEdgesAgreeJ, + extensionKindsAgree := extensionKindsAgreeJ, replacementProper := replacementProperJ, + replacementOneUncolored := replacementOneUncoloredJ, replacementStable := replacementStableJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J }.replacementETT + sigma) + (KJ : + TashkinovHierarchy + { replacementInput := replacementInputJ, replacementSeries := replacementSeriesJ, + replacementETT := + { + rounds := ett.rounds, roundsPositive := roundsPositiveJ, series := replacementSeriesJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }, + rungAgreement := + Eq.refl + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, series := replacementSeriesJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.rounds, + seriesPresentation := seriesPresentationJ, + finalGeneratingColoring := finalGeneratingColoringJ, ladderTreesAgree := ladderTreesAgreeJ, + storedColorsAgree := storedColorsAgreeJ, connectingEdgesAgree := connectingEdgesAgreeJ, + extensionKindsAgree := extensionKindsAgreeJ, replacementProper := replacementProperJ, + replacementOneUncolored := replacementOneUncoloredJ, replacementStable := replacementStableJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J }.replacementETT + baseJ) + (replacementInputU : PartialEdgeColoring E k) + (replacementSeriesU : TashkinovSeries G k ett.rounds e0 replacementInputU) + (finalGeneratingColoringU : sigma = replacementSeriesU.data.coloring (Fin.last ett.rounds)) + (ladderTreesAgreeU : + ∀ (i : Fin ett.rounds), + replacementSeriesU.data.tree i.succ.castSucc = ett.series.data.tree i.succ.castSucc) + (storedColorsAgreeU : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeriesU.data.stored i = ett.series.data.stored i) + (connectingEdgesAgreeU : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesU.data.connectingEdges i = ett.series.data.connectingEdges i) + (extensionKindsAgreeU : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeriesU.data.kind i = ett.series.data.kind i) + (replacementProperU : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (replacementSeriesU.data.coloring i)) + (replacementOneUncoloredU : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (replacementSeriesU.data.coloring i) e0) + (replacementStableU : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (replacementSeriesU.data.coloring i.succ)) + (roundsPositiveU : (1 : ℕ) ≤ ett.1) + (aboveU : + TreeSequenceInitialSegment + (replacementSeriesU.data.tree (⟨ett.1, (by omega)⟩ : Fin (ett.1 + (2 : ℕ)))) U) + (strictU : + (replacementSeriesU.data.tree (⟨ett.1, (by omega)⟩ : Fin (ett.1 + (2 : ℕ)))).length < U.length) + (belowU : + TreeSequenceInitialSegment U (replacementSeriesU.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (generatingU : sigma = replacementSeriesU.data.coloring (Fin.last ett.1)) + (seriesPresentationU : + { rounds := ett.1, roundsPositive := roundsPositiveU, series := replacementSeriesU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : + ExtendedTashkinovTree G k e0 replacementInputU U sigma }.series ≍ + replacementSeriesU) + (baseU : + HierarchyBase + { replacementInput := replacementInputU, replacementSeries := replacementSeriesU, + replacementETT := + { + rounds := ett.1, roundsPositive := roundsPositiveU, series := replacementSeriesU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : + ExtendedTashkinovTree G k e0 replacementInputU U sigma }, + rungAgreement := + Eq.refl + { rounds := ett.1, roundsPositive := roundsPositiveU, series := replacementSeriesU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : + ExtendedTashkinovTree G k e0 replacementInputU U sigma }.rounds, + seriesPresentation := seriesPresentationU, + finalGeneratingColoring := finalGeneratingColoringU, ladderTreesAgree := ladderTreesAgreeU, + storedColorsAgree := storedColorsAgreeU, connectingEdgesAgree := connectingEdgesAgreeU, + extensionKindsAgree := extensionKindsAgreeU, replacementProper := replacementProperU, + replacementOneUncolored := replacementOneUncoloredU, replacementStable := replacementStableU : + CorrespondingExtendedTashkinovTree G k e0 ett sigma U }.replacementETT + sigma) + (hcore : baseU.core = baseJ.core) (segmentJU : TreeSequenceInitialSegment J U) + (segmentTrans : + ∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) + (finalTreeEq : + replacementSeriesU.data.tree (Fin.last ett.rounds).castSucc = + replacementSeriesJ.data.tree (Fin.last ett.rounds).castSucc), + TashkinovStoredColors replacementSeriesU.data (Fin.last ett.rounds) = + TashkinovStoredColors replacementSeriesJ.data (Fin.last ett.rounds) → + let kuStage : Fin (KJ.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (KJ.dividerCount + (2 : ℕ))) => + if (↑j : ℕ) = KJ.dividerCount + (1 : ℕ) then U + else KJ.stage (⟨(↑j : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))); + ∀ + (kuStageOld : ∀ (j : Fin (KJ.dividerCount + (1 : ℕ))), kuStage j.castSucc = KJ.stage j.castSucc) + (kuStageLast : kuStage (Fin.last (KJ.dividerCount + (1 : ℕ))) = U) + (kuStageAt : + ∀ (j : Fin (KJ.dividerCount + (2 : ℕ))) (hj : (↑j : ℕ) ≤ KJ.dividerCount), + kuStage j = KJ.stage (⟨(↑j : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ)))) + (kuNested : + ∀ (j : Fin (KJ.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (kuStage j.castSucc) (kuStage j.succ)) + (kuStrict : + ∀ (j : Fin (KJ.dividerCount + (1 : ℕ))), + (kuStage j.castSucc).length < (kuStage j.succ).length), + let kuDividerPosition : Fin KJ.dividerCount → Fin (U.length + (1 : ℕ)) := + fun (i : Fin KJ.dividerCount) => + (⟨(↑(KJ.dividerPosition i) : ℕ), + lt_of_lt_of_le (KJ.dividerPosition i).isLt (Nat.succ_le_succ segmentJU.1)⟩ : + Fin (U.length + (1 : ℕ))); + let _ : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := roundsPositiveU, series := replacementSeriesU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : ExtendedTashkinovTree G k e0 replacementInputU U sigma } + baseU := + { + dividerCount := KJ.dividerCount, stage := kuStage, + baseStage := + Trans.trans + (Trans.trans (id (kuStageOld (0 : Fin (KJ.dividerCount + (1 : ℕ))))) KJ.baseStage) + (Eq.symm finalTreeEq), + terminalStage := kuStageLast, nested := kuNested, strict := kuStrict, + dividerPosition := kuDividerPosition, + dividerPositive := fun (i : Fin KJ.dividerCount) => KJ.dividerPositive i, + dividerIncreasing := fun (i j : Fin KJ.dividerCount) (hij : (↑i : ℕ) < (↑j : ℕ)) => + KJ.dividerIncreasing i j hij, + dividerStage := fun (i : Fin KJ.dividerCount) => + have hstageIndex : (↑i : ℕ) + (1 : ℕ) ≤ KJ.dividerCount := Nat.succ_le_of_lt i.isLt; + have hstage : + kuStage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))) = + KJ.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))) := + kuStageAt (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))) hstageIndex; + have hposJ : (↑(KJ.dividerPosition i) : ℕ) ≤ J.length := + Nat.le_of_lt_succ (KJ.dividerPosition i).isLt; + have hposU : (↑(KJ.dividerPosition i) : ℕ) ≤ U.length := le_trans hposJ segmentJU.1; + have prefixEq : + TreeSequencePrefix U (↑(KJ.dividerPosition i) : ℕ) (KJ.dividerPositive i) hposU = + TreeSequencePrefix J (↑(KJ.dividerPosition i) : ℕ) (KJ.dividerPositive i) hposJ := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + _a = TreeSequencePrefix J (↑(KJ.dividerPosition i) : ℕ) (KJ.dividerPositive i) hposJ) + (TreeSequencePrefix.eq_1 U (↑(KJ.dividerPosition i) : ℕ) (KJ.dividerPositive i) hposU))) + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + { length := (↑(KJ.dividerPosition i) : ℕ), positive := KJ.dividerPositive i, + vertex := fun (i_1 : Fin ((↑(KJ.dividerPosition i) : ℕ) + (1 : ℕ))) => + U.vertex (Fin.castLE ((by omega)) i_1), + edge := fun (i_1 : Fin (↑(KJ.dividerPosition i) : ℕ)) => + U.edge (Fin.castLE hposU i_1), + vertex_injective := + (by + intro _ _ h + apply Fin.ext + simpa only [Fin.castLE] using congrArg (fun x => x.val) ((U).vertex_injective h)), + edge_injective := + (by + intro _ _ h + apply Fin.ext + simpa only [Fin.castLE] using congrArg (fun x => x.val) ((U).edge_injective h)), + first_edge := (by simpa only [Fin.castLE] using (U).first_edge), + attaches := + (by + intro j; + simpa only [Fin.castLE, Fin.castLT, Fin.succ] using + (U).attaches (Fin.castLE (hposU) j)) : + TreeSequence G e0 } = + _a) + (TreeSequencePrefix.eq_1 J (↑(KJ.dividerPosition i) : ℕ) (KJ.dividerPositive i) hposJ))) + ((fun {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (length : ℕ) + (positive : (1 : ℕ) ≤ length) (vertex vertex_1 : Fin (length + (1 : ℕ)) → V) + (e_vertex : vertex = vertex_1) => + Eq.rec (motive := + fun (vertex_2 : Fin (length + (1 : ℕ)) → V) (e_vertex : vertex = vertex_2) => + ∀ (edge edge_1 : Fin length → E) (e_edge : edge = edge_1) + (vertex_injective : Function.Injective vertex) + (edge_injective : Function.Injective edge) + (first_edge : edge (⟨(0 : ℕ), positive⟩ : Fin length) = e0) + (attaches : + ∀ (j : Fin length), + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + G.ends (edge j) = + s(vertex j.succ, + vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))))), + { length := length, positive := positive, vertex := vertex, edge := edge, + vertex_injective := vertex_injective, edge_injective := edge_injective, + first_edge := first_edge, attaches := attaches : TreeSequence G e0 } = + { + length := length, positive := positive, vertex := vertex_2, edge := edge_1, + vertex_injective := e_vertex ▸ vertex_injective, + edge_injective := e_edge ▸ edge_injective, first_edge := e_edge ▸ first_edge, + attaches := + Eq.ndrec (motive := fun (vertex : Fin (length + (1 : ℕ)) → V) => + ∀ (j : Fin length), + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + G.ends (edge_1 j) = + s(vertex j.succ, + vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))))) + (Eq.ndrec (motive := fun (edge : Fin length → E) => + ∀ (j : Fin length), + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + G.ends (edge j) = + s(vertex j.succ, + vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))))) + attaches e_edge) + e_vertex : + TreeSequence G e0 }) + (fun (edge edge_1 : Fin length → E) (e_edge : edge = edge_1) => + Eq.rec (motive := fun (edge_2 : Fin length → E) (e_edge : edge = edge_2) => + ∀ (vertex_injective : Function.Injective vertex) + (edge_injective : Function.Injective edge) + (first_edge : edge (⟨(0 : ℕ), positive⟩ : Fin length) = e0) + (attaches : + ∀ (j : Fin length), + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + G.ends (edge j) = + s(vertex j.succ, + vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))))), + { length := length, positive := positive, vertex := vertex, edge := edge, + vertex_injective := vertex_injective, edge_injective := edge_injective, + first_edge := first_edge, attaches := attaches : TreeSequence G e0 } = + { + length := length, positive := positive, vertex := vertex, edge := edge_2, + vertex_injective := Eq.refl vertex ▸ vertex_injective, + edge_injective := e_edge ▸ edge_injective, first_edge := e_edge ▸ first_edge, + attaches := + Eq.ndrec (motive := fun (vertex : Fin (length + (1 : ℕ)) → V) => + ∀ (j : Fin length), + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + G.ends (edge_2 j) = + s(vertex j.succ, + vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))))) + (Eq.ndrec (motive := fun (edge : Fin length → E) => + ∀ (j : Fin length), + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + G.ends (edge j) = + s(vertex j.succ, + vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))))) + attaches e_edge) + (Eq.refl vertex) : + TreeSequence G e0 }) + (fun (vertex_injective : Function.Injective vertex) + (edge_injective : Function.Injective edge) + (first_edge : edge (⟨(0 : ℕ), positive⟩ : Fin length) = e0) + (attaches : + ∀ (j : Fin length), + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + G.ends (edge j) = + s(vertex j.succ, + vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))))) => + Eq.refl + { + length := length, positive := positive, vertex := vertex, edge := edge, + vertex_injective := vertex_injective, edge_injective := edge_injective, + first_edge := first_edge, attaches := attaches : TreeSequence G e0 }) + e_edge) + e_vertex) + (↑(KJ.dividerPosition i) : ℕ) (KJ.dividerPositive i) + (fun (i_1 : Fin ((↑(KJ.dividerPosition i) : ℕ) + (1 : ℕ))) => + U.vertex (Fin.castLE ((by omega)) i_1)) + (fun (i_1 : Fin ((↑(KJ.dividerPosition i) : ℕ) + (1 : ℕ))) => + J.vertex (Fin.castLE ((by omega)) i_1)) + (funext fun (x : Fin ((↑(KJ.dividerPosition i) : ℕ) + (1 : ℕ))) => + have hv : + U.vertex + (Fin.castLE (Nat.succ_le_succ segmentJU.1) (Fin.castLE (Nat.succ_le_succ hposJ) x)) = + J.vertex (Fin.castLE (Nat.succ_le_succ hposJ) x) := + segmentJU.2.left (Fin.castLE (Nat.succ_le_succ hposJ) x); + id + (Eq.mp + (congrFun' + (congrArg Eq + (congrArg U.vertex + (Fin.castLE_castLE (Nat.succ_le_succ hposJ) (Nat.succ_le_succ segmentJU.1) x))) + (J.vertex (Fin.castLE (Nat.succ_le_succ hposJ) x))) + hv)) + (fun (i_1 : Fin (↑(KJ.dividerPosition i) : ℕ)) => U.edge (Fin.castLE hposU i_1)) + (fun (i_1 : Fin (↑(KJ.dividerPosition i) : ℕ)) => J.edge (Fin.castLE hposJ i_1)) + (funext fun (x : Fin (↑(KJ.dividerPosition i) : ℕ)) => + have he : + U.edge (Fin.castLE segmentJU.1 (Fin.castLE hposJ x)) = J.edge (Fin.castLE hposJ x) := + segmentJU.2.right (Fin.castLE hposJ x); + id + (Eq.mp + (congrFun' (congrArg Eq (congrArg U.edge (Fin.castLE_castLE hposJ segmentJU.1 x))) + (J.edge (Fin.castLE hposJ x))) + he)) + ((by + intro _ _ h + apply Fin.ext + simpa only [Fin.castLE] using congrArg (fun x => x.val) ((U).vertex_injective h))) + ((by + intro _ _ h + apply Fin.ext + simpa only [Fin.castLE] using congrArg (fun x => x.val) ((U).edge_injective h))) + ((by simpa only [Fin.castLE] using (U).first_edge)) + ((by + intro j; + simpa only [Fin.castLE, Fin.castLT, Fin.succ] using + (U).attaches (Fin.castLE (hposU) j))))); + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + kuStage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))) = _a) + prefixEq)) + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + _a = TreeSequencePrefix J (↑(KJ.dividerPosition i) : ℕ) (KJ.dividerPositive i) hposJ) + hstage)) + (id (KJ.dividerStage i))), + coreInsideFirst := + if hd : KJ.dividerCount = (0 : ℕ) then + have hstage : kuStage (⟨(1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))) = U := + of_eq_true + (Eq.trans + (congrFun' + (congrArg Eq + (Eq.trans + (congrFun' + (funext fun (j : Fin (KJ.dividerCount + (2 : ℕ))) => + ite_congr + (congrArg (Eq (↑j : ℕ)) + (Eq.trans (congrFun' (congrArg HAdd.hAdd hd) (1 : ℕ)) (zero_add (1 : ℕ)))) + (fun (_ : (↑j : ℕ) = (1 : ℕ)) => Eq.refl U) fun (_ : ¬(↑j : ℕ) = (1 : ℕ)) => + Eq.refl (KJ.stage j)) + (1 : Fin (KJ.dividerCount + (2 : ℕ)))) + (ite_eq_left_of_eq_true U (KJ.stage (1 : Fin (KJ.dividerCount + (2 : ℕ)))) + (Eq.trans + (congrFun' + (congrArg Eq + (Eq.trans + (congrArg (HMod.hMod (1 : ℕ)) + (Eq.trans (congrFun' (congrArg HAdd.hAdd hd) (2 : ℕ)) (zero_add (2 : ℕ)))) + (Nat.mod_succ (1 : ℕ)))) + (1 : ℕ)) + (eq_self (1 : ℕ)))))) + U) + (eq_self U)); + Eq.mpr + (id + (congrArg (fun (_a : TreeSequence G e0) => TreeSequenceInitialSegment baseU.core _a) + hstage)) + (have hold : + TreeSequenceInitialSegment baseJ.core + (KJ.stage (⟨(1 : ℕ), (by omega)⟩ : Fin (KJ.dividerCount + (2 : ℕ)))) := + KJ.coreInsideFirst; + have holdStage : KJ.stage (⟨(1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))) = J := + Eq.mpr + (eq_of_heq + ((fun (α : Type (max u_1 u_2)) (a a' : α) (e'_2 : a = a') (a_1 : α) => + Eq.casesOn (motive := fun (a_2 : α) (x : a = a_2) => + a' = a_2 → e'_2 ≍ x → (a = a_1) ≍ (a' = a_1)) e'_2 + (fun (h : a' = a) => + Eq.ndrec (motive := fun (a' : α) => + ∀ (e_2 : a = a'), e_2 ≍ Eq.refl a → (a = a_1) ≍ (a' = a_1)) + (fun (e_2 : a = a) (_ : e_2 ≍ Eq.refl a) => HEq.refl (a = a_1)) (Eq.symm h) e'_2) + (Eq.refl a') (HEq.refl e'_2)) + (TreeSequence G e0) (KJ.stage (⟨(1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ)))) + (KJ.stage (Fin.last (KJ.dividerCount + (1 : ℕ)))) + (congrArg KJ.stage + (Fin.ext + (of_eq_true + (Eq.trans + (congrArg (Eq (1 : ℕ)) + (Eq.trans (congrFun' (congrArg HAdd.hAdd hd) (1 : ℕ)) (zero_add (1 : ℕ)))) + (eq_self (1 : ℕ)))))) + J)) + KJ.terminalStage; + Eq.mpr + (id (congrArg (fun (_a : TreeSequence G e0) => TreeSequenceInitialSegment _a U) hcore)) + (segmentTrans + (Eq.mp + (congrArg (fun (_a : TreeSequence G e0) => TreeSequenceInitialSegment baseJ.core _a) + holdStage) + hold) + segmentJU)) + else + have hstage : + kuStage (⟨(1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))) = + KJ.stage (⟨(1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))) := + kuStageAt (⟨(1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))) + (Nat.one_le_iff_ne_zero.mpr hd); + Eq.mpr + (id + (congrArg (fun (_a : TreeSequence G e0) => TreeSequenceInitialSegment baseU.core _a) + hstage)) + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (KJ.stage (⟨(1 : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))))) + hcore)) + KJ.coreInsideFirst) : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := roundsPositiveU, series := replacementSeriesU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : ExtendedTashkinovTree G k e0 replacementInputU U sigma } + baseU }; + ∃ (KU : + TashkinovHierarchy + { replacementInput := replacementInputU, replacementSeries := replacementSeriesU, + replacementETT := + { + rounds := ett.1, roundsPositive := roundsPositiveU, series := replacementSeriesU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : + ExtendedTashkinovTree G k e0 replacementInputU U sigma }, + rungAgreement := + Eq.refl + { rounds := ett.1, roundsPositive := roundsPositiveU, series := replacementSeriesU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : + ExtendedTashkinovTree G k e0 replacementInputU U sigma }.rounds, + seriesPresentation := seriesPresentationU, + finalGeneratingColoring := finalGeneratingColoringU, ladderTreesAgree := ladderTreesAgreeU, + storedColorsAgree := storedColorsAgreeU, connectingEdgesAgree := connectingEdgesAgreeU, + extensionKindsAgree := extensionKindsAgreeU, replacementProper := replacementProperU, + replacementOneUncolored := replacementOneUncoloredU, + replacementStable := replacementStableU : + CorrespondingExtendedTashkinovTree G k e0 ett sigma U }.replacementETT + baseU) + (hcount : KU.dividerCount = KJ.dividerCount), + (∀ (j : Fin (KU.dividerCount + (1 : ℕ))), + let jo : Fin (KJ.dividerCount + (1 : ℕ)) := + Fin.cast (congrArg (fun (n : ℕ) => n + (1 : ℕ)) hcount) j; + KU.stage j.castSucc = KJ.stage jo.castSucc ∧ + HierarchyStarredStage KU j = HierarchyStarredStage KJ jo ∧ + HierarchyStoredColorsAt KU j = HierarchyStoredColorsAt KJ jo ∧ + HierarchyStageMissingColors KU j = HierarchyStageMissingColors KJ jo) ∧ + ∀ (i : Fin KU.dividerCount), + (↑(KU.dividerPosition i) : ℕ) = (↑(KJ.dividerPosition (Fin.cast hcount i)) : ℕ) + +private abbrev helperBranch126Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (J U : TreeSequence G e0) + (_ : TashkinovAugmentationSequence sigma J U) (replacementInputJ : PartialEdgeColoring E k) + (replacementSeriesJ : TashkinovSeries G k ett.rounds e0 replacementInputJ) + (finalGeneratingColoringJ : sigma = replacementSeriesJ.data.coloring (Fin.last ett.rounds)) + (ladderTreesAgreeJ : + ∀ (i : Fin ett.rounds), + replacementSeriesJ.data.tree i.succ.castSucc = ett.series.data.tree i.succ.castSucc) + (storedColorsAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeriesJ.data.stored i = ett.series.data.stored i) + (connectingEdgesAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.connectingEdges i = ett.series.data.connectingEdges i) + (extensionKindsAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeriesJ.data.kind i = ett.series.data.kind i) + (replacementProperJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (replacementSeriesJ.data.coloring i)) + (replacementOneUncoloredJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (replacementSeriesJ.data.coloring i) e0) + (replacementStableJ : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (replacementSeriesJ.data.coloring i.succ)) + (roundsPositiveJ : (1 : ℕ) ≤ ett.1) + (aboveJ : + TreeSequenceInitialSegment + (replacementSeriesJ.data.tree (⟨ett.1, (by omega)⟩ : Fin (ett.1 + (2 : ℕ)))) J) + (strictJ : + (replacementSeriesJ.data.tree (⟨ett.1, (by omega)⟩ : Fin (ett.1 + (2 : ℕ)))).length < J.length) + (belowJ : + TreeSequenceInitialSegment J (replacementSeriesJ.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (generatingJ : sigma = replacementSeriesJ.data.coloring (Fin.last ett.1)) + (seriesPresentationJ : + { rounds := ett.1, roundsPositive := roundsPositiveJ, series := replacementSeriesJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.series ≍ + replacementSeriesJ) + (baseJ : + HierarchyBase + { replacementInput := replacementInputJ, replacementSeries := replacementSeriesJ, + replacementETT := + { + rounds := ett.1, roundsPositive := roundsPositiveJ, series := replacementSeriesJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }, + rungAgreement := + Eq.refl + { rounds := ett.1, roundsPositive := roundsPositiveJ, series := replacementSeriesJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.rounds, + seriesPresentation := seriesPresentationJ, + finalGeneratingColoring := finalGeneratingColoringJ, ladderTreesAgree := ladderTreesAgreeJ, + storedColorsAgree := storedColorsAgreeJ, connectingEdgesAgree := connectingEdgesAgreeJ, + extensionKindsAgree := extensionKindsAgreeJ, replacementProper := replacementProperJ, + replacementOneUncolored := replacementOneUncoloredJ, replacementStable := replacementStableJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J }.replacementETT + sigma) + (KJ : + TashkinovHierarchy + { replacementInput := replacementInputJ, replacementSeries := replacementSeriesJ, + replacementETT := + { + rounds := ett.1, roundsPositive := roundsPositiveJ, series := replacementSeriesJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }, + rungAgreement := + Eq.refl + { rounds := ett.1, roundsPositive := roundsPositiveJ, series := replacementSeriesJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.rounds, + seriesPresentation := seriesPresentationJ, + finalGeneratingColoring := finalGeneratingColoringJ, ladderTreesAgree := ladderTreesAgreeJ, + storedColorsAgree := storedColorsAgreeJ, connectingEdgesAgree := connectingEdgesAgreeJ, + extensionKindsAgree := extensionKindsAgreeJ, replacementProper := replacementProperJ, + replacementOneUncolored := replacementOneUncoloredJ, replacementStable := replacementStableJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J }.replacementETT + baseJ) + (replacementInputU : PartialEdgeColoring E k) + (replacementSeriesU : TashkinovSeries G k ett.rounds e0 replacementInputU) + (finalGeneratingColoringU : sigma = replacementSeriesU.data.coloring (Fin.last ett.rounds)) + (ladderTreesAgreeU : + ∀ (i : Fin ett.rounds), + replacementSeriesU.data.tree i.succ.castSucc = ett.series.data.tree i.succ.castSucc) + (storedColorsAgreeU : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeriesU.data.stored i = ett.series.data.stored i) + (connectingEdgesAgreeU : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesU.data.connectingEdges i = ett.series.data.connectingEdges i) + (extensionKindsAgreeU : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeriesU.data.kind i = ett.series.data.kind i) + (replacementProperU : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (replacementSeriesU.data.coloring i)) + (replacementOneUncoloredU : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (replacementSeriesU.data.coloring i) e0) + (replacementStableU : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (replacementSeriesU.data.coloring i.succ)) + (roundsU : ℕ) (roundsPositiveU : (1 : ℕ) ≤ roundsU) + (replacementDataU : TashkinovSeries G k roundsU e0 replacementInputU) + (aboveU : + TreeSequenceInitialSegment + (replacementDataU.data.tree (⟨roundsU, (by omega)⟩ : Fin (roundsU + (2 : ℕ)))) U) + (strictU : + (replacementDataU.data.tree (⟨roundsU, (by omega)⟩ : Fin (roundsU + (2 : ℕ)))).length < U.length) + (belowU : + TreeSequenceInitialSegment U (replacementDataU.data.tree (Fin.last (roundsU + (1 : ℕ))))) + (generatingU : sigma = replacementDataU.data.coloring (Fin.last roundsU)) + (rungAgreementU : + { rounds := roundsU, roundsPositive := roundsPositiveU, series := replacementDataU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : + ExtendedTashkinovTree G k e0 replacementInputU U sigma }.rounds = + ett.rounds) + (seriesPresentationU : + { rounds := roundsU, roundsPositive := roundsPositiveU, series := replacementDataU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : + ExtendedTashkinovTree G k e0 replacementInputU U sigma }.series ≍ + replacementSeriesU) + (baseU : + HierarchyBase + { replacementInput := replacementInputU, replacementSeries := replacementSeriesU, + replacementETT := + { + rounds := roundsU, roundsPositive := roundsPositiveU, series := replacementDataU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : + ExtendedTashkinovTree G k e0 replacementInputU U sigma }, + rungAgreement := rungAgreementU, seriesPresentation := seriesPresentationU, + finalGeneratingColoring := finalGeneratingColoringU, ladderTreesAgree := ladderTreesAgreeU, + storedColorsAgree := storedColorsAgreeU, connectingEdgesAgree := connectingEdgesAgreeU, + extensionKindsAgree := extensionKindsAgreeU, replacementProper := replacementProperU, + replacementOneUncolored := replacementOneUncoloredU, replacementStable := replacementStableU : + CorrespondingExtendedTashkinovTree G k e0 ett sigma U }.replacementETT + sigma) + (_ : baseU.core = baseJ.core), + ∃ (KU : + TashkinovHierarchy + { replacementInput := replacementInputU, replacementSeries := replacementSeriesU, + replacementETT := + { + rounds := roundsU, roundsPositive := roundsPositiveU, series := replacementDataU, + abovePenultimate := aboveU, strictAbovePenultimate := strictU, belowFinal := belowU, + generatingColoring := generatingU : + ExtendedTashkinovTree G k e0 replacementInputU U sigma }, + rungAgreement := rungAgreementU, seriesPresentation := seriesPresentationU, + finalGeneratingColoring := finalGeneratingColoringU, ladderTreesAgree := ladderTreesAgreeU, + storedColorsAgree := storedColorsAgreeU, connectingEdgesAgree := connectingEdgesAgreeU, + extensionKindsAgree := extensionKindsAgreeU, replacementProper := replacementProperU, + replacementOneUncolored := replacementOneUncoloredU, replacementStable := replacementStableU : + CorrespondingExtendedTashkinovTree G k e0 ett sigma U }.replacementETT + baseU) + (hcount : KU.dividerCount = KJ.dividerCount), + (∀ (j : Fin (KU.dividerCount + (1 : ℕ))), + let jo : Fin (KJ.dividerCount + (1 : ℕ)) := + Fin.cast (congrArg (fun (n : ℕ) => n + (1 : ℕ)) hcount) j; + KU.stage j.castSucc = KJ.stage jo.castSucc ∧ + HierarchyStarredStage KU j = HierarchyStarredStage KJ jo ∧ + HierarchyStoredColorsAt KU j = HierarchyStoredColorsAt KJ jo ∧ + HierarchyStageMissingColors KU j = HierarchyStageMissingColors KJ jo) ∧ + ∀ (i : Fin KU.dividerCount), + (↑(KU.dividerPosition i) : ℕ) = (↑(KJ.dividerPosition (Fin.cast hcount i)) : ℕ) + +private theorem helper_terminalStoredEq_231.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (replacementInputJ : PartialEdgeColoring E k) + (replacementSeriesJ : TashkinovSeries G k ett.rounds e0 replacementInputJ) + (replacementInputU : PartialEdgeColoring E k) + (replacementSeriesU : TashkinovSeries G k ett.rounds e0 replacementInputU), + (∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesU.data.stored i = replacementSeriesJ.data.stored i) → + TreeMissingColors (replacementSeriesU.data.coloring (Fin.last ett.rounds)) + (replacementSeriesU.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors (replacementSeriesJ.data.coloring (Fin.last ett.rounds)) + (replacementSeriesJ.data.tree (Fin.last ett.rounds).castSucc) → + TashkinovStoredColors replacementSeriesU.data (Fin.last ett.rounds) = + TashkinovStoredColors replacementSeriesJ.data (Fin.last ett.rounds) := by + classical + intro V E _ _ _ G k e0 input T generating ett replacementInputJ replacementSeriesJ + replacementInputU replacementSeriesU storedEntryEq finalMissingEq + unfold TashkinovStoredColors + have hnonzero : (Fin.last ett.rounds).val ≠ 0 := by + simpa using Nat.ne_of_gt (Nat.zero_lt_of_lt ett.roundsPositive) + simp only [ite_eq_right hnonzero] + ext c + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · rintro ⟨⟨i, hi, hc⟩, hn⟩ + refine ⟨⟨i, hi, ?_⟩, ?_⟩ + · by_cases hle : i.val ≤ (Fin.last ett.rounds).val + · simp only [ite_eq_left hle] at hc ⊢ + simpa [storedEntryEq i] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rwa [finalMissingEq] at hn + · rintro ⟨⟨i, hi, hc⟩, hn⟩ + refine ⟨⟨i, hi, ?_⟩, ?_⟩ + · by_cases hle : i.val ≤ (Fin.last ett.rounds).val + · simp only [ite_eq_left hle] at hc ⊢ + simpa [storedEntryEq i] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rwa [finalMissingEq] + +private theorem helper_kuNested_276.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (J U : TreeSequence G e0) + (replacementInputJ : PartialEdgeColoring E k) + (replacementSeriesJ : TashkinovSeries G k ett.rounds e0 replacementInputJ) + (finalGeneratingColoringJ : + sigma = replacementSeriesJ.data.coloring (Fin.last ett.rounds)) + (ladderTreesAgreeJ : + ∀ (i : Fin ett.rounds), + replacementSeriesJ.data.tree i.succ.castSucc = + ett.series.data.tree i.succ.castSucc) + (storedColorsAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.stored i = ett.series.data.stored i) + (connectingEdgesAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.connectingEdges i = ett.series.data.connectingEdges i) + (extensionKindsAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.kind i = ett.series.data.kind i) + (replacementProperJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (replacementSeriesJ.data.coloring i)) + (replacementOneUncoloredJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (replacementSeriesJ.data.coloring i) e0) + (replacementStableJ : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (replacementSeriesJ.data.coloring i.succ)) + (roundsPositiveJ : (1 : ℕ) ≤ ett.rounds) + (aboveJ : + TreeSequenceInitialSegment + (replacementSeriesJ.data.tree + (⟨ett.rounds, (by omega)⟩ : Fin (ett.rounds + (2 : ℕ)))) + J) + (strictJ : + (replacementSeriesJ.data.tree + (⟨ett.rounds, (by omega)⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + J.length) + (belowJ : + TreeSequenceInitialSegment J + (replacementSeriesJ.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (generatingJ : sigma = replacementSeriesJ.data.coloring (Fin.last ett.rounds)) + (seriesPresentationJ : + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, + series := replacementSeriesJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.series ≍ + replacementSeriesJ) + (baseJ : + HierarchyBase + { replacementInput := replacementInputJ, replacementSeries := replacementSeriesJ, + replacementETT := + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, + series := replacementSeriesJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }, + rungAgreement := + Eq.refl + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, + series := replacementSeriesJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.rounds, + seriesPresentation := seriesPresentationJ, + finalGeneratingColoring := finalGeneratingColoringJ, + ladderTreesAgree := ladderTreesAgreeJ, + storedColorsAgree := storedColorsAgreeJ, + connectingEdgesAgree := connectingEdgesAgreeJ, + extensionKindsAgree := extensionKindsAgreeJ, + replacementProper := replacementProperJ, + replacementOneUncolored := replacementOneUncoloredJ, + replacementStable := replacementStableJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J }.replacementETT + sigma) + (KJ : + TashkinovHierarchy + { replacementInput := replacementInputJ, replacementSeries := replacementSeriesJ, + replacementETT := + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, + series := replacementSeriesJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }, + rungAgreement := + Eq.refl + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, + series := replacementSeriesJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.rounds, + seriesPresentation := seriesPresentationJ, + finalGeneratingColoring := finalGeneratingColoringJ, + ladderTreesAgree := ladderTreesAgreeJ, + storedColorsAgree := storedColorsAgreeJ, + connectingEdgesAgree := connectingEdgesAgreeJ, + extensionKindsAgree := extensionKindsAgreeJ, + replacementProper := replacementProperJ, + replacementOneUncolored := replacementOneUncoloredJ, + replacementStable := replacementStableJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J }.replacementETT + baseJ) + (replacementInputU : PartialEdgeColoring E k) + (_ : TashkinovSeries G k ett.rounds e0 replacementInputU) + (_ : TreeSequenceInitialSegment J U) + (_ : + (∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) + (_ : TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)), + let kuStage : Fin (KJ.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (KJ.dividerCount + (2 : ℕ))) => + if (↑j : ℕ) = KJ.dividerCount + (1 : ℕ) then U + else KJ.stage (⟨(↑j : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))); + ∀ + (_ : + (∀ (j : Fin (KJ.dividerCount + (1 : ℕ))), kuStage j.castSucc = KJ.stage j.castSucc)) + (_ : kuStage (Fin.last (KJ.dividerCount + (1 : ℕ))) = U) + (_ : + (∀ (j : Fin (KJ.dividerCount + (2 : ℕ))) (hj : (↑j : ℕ) ≤ KJ.dividerCount), + kuStage j = KJ.stage (⟨(↑j : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))))) + (j : Fin (KJ.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (kuStage j.castSucc) (kuStage j.succ) := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett J U replacementInputJ replacementSeriesJ + finalGeneratingColoringJ ladderTreesAgreeJ storedColorsAgreeJ connectingEdgesAgreeJ + extensionKindsAgreeJ replacementProperJ replacementOneUncoloredJ replacementStableJ + roundsPositiveJ aboveJ strictJ belowJ generatingJ seriesPresentationJ baseJ KJ + replacementInputU replacementSeriesU segmentJU segmentTrans kuStage kuStageOld kuStageLast + kuStageAt j + by_cases hj : j.val = KJ.dividerCount + · have hlast : j = Fin.last KJ.dividerCount := Fin.ext (by simpa using hj) + rw [hlast, kuStageOld] + have hsucc : (Fin.last KJ.dividerCount).succ = + Fin.last (KJ.dividerCount + 1) := rfl + rw [hsucc, kuStageLast] + have oldLast := KJ.nested (Fin.last KJ.dividerCount) + rw [hsucc, KJ.terminalStage] at oldLast + exact segmentTrans oldLast segmentJU + · have hjlt : j.val < KJ.dividerCount := by omega + have hcast : j.castSucc.val ≤ KJ.dividerCount := by + simpa using Nat.le_of_lt_succ j.isLt + have hsuccle : j.succ.val ≤ KJ.dividerCount := by + change j.val + 1 ≤ KJ.dividerCount + omega + rw [kuStageAt j.castSucc hcast, kuStageAt j.succ hsuccle] + have hold := KJ.nested ⟨j.val, by omega⟩ + convert hold using 1 + +private theorem helper_kuStrict_298.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (J U : TreeSequence G e0) + (replacementInputJ : PartialEdgeColoring E k) + (replacementSeriesJ : TashkinovSeries G k ett.rounds e0 replacementInputJ) + (finalGeneratingColoringJ : + sigma = replacementSeriesJ.data.coloring (Fin.last ett.rounds)) + (ladderTreesAgreeJ : + ∀ (i : Fin ett.rounds), + replacementSeriesJ.data.tree i.succ.castSucc = + ett.series.data.tree i.succ.castSucc) + (storedColorsAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.stored i = ett.series.data.stored i) + (connectingEdgesAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.connectingEdges i = ett.series.data.connectingEdges i) + (extensionKindsAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.kind i = ett.series.data.kind i) + (replacementProperJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (replacementSeriesJ.data.coloring i)) + (replacementOneUncoloredJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (replacementSeriesJ.data.coloring i) e0) + (replacementStableJ : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (replacementSeriesJ.data.coloring i.succ)) + (roundsPositiveJ : (1 : ℕ) ≤ ett.rounds) + (aboveJ : + TreeSequenceInitialSegment + (replacementSeriesJ.data.tree + (⟨ett.rounds, (by omega)⟩ : Fin (ett.rounds + (2 : ℕ)))) + J) + (strictJ : + (replacementSeriesJ.data.tree + (⟨ett.rounds, (by omega)⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + J.length) + (belowJ : + TreeSequenceInitialSegment J + (replacementSeriesJ.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (generatingJ : sigma = replacementSeriesJ.data.coloring (Fin.last ett.rounds)) + (seriesPresentationJ : + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, + series := replacementSeriesJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.series ≍ + replacementSeriesJ) + (baseJ : + HierarchyBase + { replacementInput := replacementInputJ, replacementSeries := replacementSeriesJ, + replacementETT := + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, + series := replacementSeriesJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }, + rungAgreement := + Eq.refl + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, + series := replacementSeriesJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.rounds, + seriesPresentation := seriesPresentationJ, + finalGeneratingColoring := finalGeneratingColoringJ, + ladderTreesAgree := ladderTreesAgreeJ, + storedColorsAgree := storedColorsAgreeJ, + connectingEdgesAgree := connectingEdgesAgreeJ, + extensionKindsAgree := extensionKindsAgreeJ, + replacementProper := replacementProperJ, + replacementOneUncolored := replacementOneUncoloredJ, + replacementStable := replacementStableJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J }.replacementETT + sigma) + (KJ : + TashkinovHierarchy + { replacementInput := replacementInputJ, replacementSeries := replacementSeriesJ, + replacementETT := + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, + series := replacementSeriesJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }, + rungAgreement := + Eq.refl + { rounds := ett.rounds, roundsPositive := roundsPositiveJ, + series := replacementSeriesJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.rounds, + seriesPresentation := seriesPresentationJ, + finalGeneratingColoring := finalGeneratingColoringJ, + ladderTreesAgree := ladderTreesAgreeJ, + storedColorsAgree := storedColorsAgreeJ, + connectingEdgesAgree := connectingEdgesAgreeJ, + extensionKindsAgree := extensionKindsAgreeJ, + replacementProper := replacementProperJ, + replacementOneUncolored := replacementOneUncoloredJ, + replacementStable := replacementStableJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J }.replacementETT + baseJ) + (replacementInputU : PartialEdgeColoring E k) + (_ : TashkinovSeries G k ett.rounds e0 replacementInputU) + (_ : TreeSequenceInitialSegment J U), + let kuStage : Fin (KJ.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (KJ.dividerCount + (2 : ℕ))) => + if (↑j : ℕ) = KJ.dividerCount + (1 : ℕ) then U + else KJ.stage (⟨(↑j : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))); + ∀ + (_ : + (∀ (j : Fin (KJ.dividerCount + (1 : ℕ))), kuStage j.castSucc = KJ.stage j.castSucc)) + (_ : kuStage (Fin.last (KJ.dividerCount + (1 : ℕ))) = U) + (_ : + (∀ (j : Fin (KJ.dividerCount + (2 : ℕ))) (hj : (↑j : ℕ) ≤ KJ.dividerCount), + kuStage j = KJ.stage (⟨(↑j : ℕ), by omega⟩ : Fin (KJ.dividerCount + (2 : ℕ))))) + (j : Fin (KJ.dividerCount + (1 : ℕ))), + (kuStage j.castSucc).length < (kuStage j.succ).length := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett J U replacementInputJ replacementSeriesJ + finalGeneratingColoringJ ladderTreesAgreeJ storedColorsAgreeJ connectingEdgesAgreeJ + extensionKindsAgreeJ replacementProperJ replacementOneUncoloredJ replacementStableJ + roundsPositiveJ aboveJ strictJ belowJ generatingJ seriesPresentationJ baseJ KJ + replacementInputU replacementSeriesU segmentJU kuStage kuStageOld kuStageLast kuStageAt j + by_cases hj : j.val = KJ.dividerCount + · have hlast : j = Fin.last KJ.dividerCount := Fin.ext (by simpa using hj) + rw [hlast, kuStageOld] + have hsucc : (Fin.last KJ.dividerCount).succ = + Fin.last (KJ.dividerCount + 1) := rfl + rw [hsucc, kuStageLast] + have hold := KJ.strict (Fin.last KJ.dividerCount) + rw [hsucc, KJ.terminalStage] at hold + exact lt_of_lt_of_le hold segmentJU.1 + · have hjlt : j.val < KJ.dividerCount := by omega + have hcast : j.castSucc.val ≤ KJ.dividerCount := by + simpa using Nat.le_of_lt_succ j.isLt + have hsuccle : j.succ.val ≤ KJ.dividerCount := by + change j.val + 1 ≤ KJ.dividerCount + omega + rw [kuStageAt j.castSucc hcast, kuStageAt j.succ hsuccle] + have hold := KJ.strict ⟨j.val, by omega⟩ + convert hold using 1 + +private theorem helper_continuation_610.{u_1, u_2} : + helperContinuation610Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett J U replacementInputJ replacementSeriesJ + finalGeneratingColoringJ ladderTreesAgreeJ storedColorsAgreeJ connectingEdgesAgreeJ + extensionKindsAgreeJ replacementProperJ replacementOneUncoloredJ replacementStableJ + roundsPositiveJ aboveJ strictJ belowJ generatingJ seriesPresentationJ baseJ KJ + replacementInputU replacementSeriesU finalGeneratingColoringU ladderTreesAgreeU + storedColorsAgreeU connectingEdgesAgreeU extensionKindsAgreeU replacementProperU + replacementOneUncoloredU replacementStableU roundsPositiveU aboveU strictU belowU + generatingU seriesPresentationU baseU hcore segmentJU segmentTrans finalTreeEq + terminalStoredEq kuStage kuStageOld kuStageLast kuStageAt kuNested kuStrict + kuDividerPosition KU + have stageEq (j : Fin (KJ.dividerCount + 1)) : + KU.stage j.castSucc = KJ.stage j.castSucc := kuStageOld j + have starredEq (j : Fin (KJ.dividerCount + 1)) : + HierarchyStarredStage KU j = HierarchyStarredStage KJ j := by + refine Fin.cases ?_ (fun i => ?_) j + · simpa [HierarchyStarredStage, KU] using hcore + · change KU.stage i.succ.castSucc = KJ.stage i.succ.castSucc + exact stageEq i.succ + have storedEq (j : Fin (KJ.dividerCount + 1)) : + HierarchyStoredColorsAt KU j = HierarchyStoredColorsAt KJ j := by + unfold HierarchyStoredColorsAt + change TashkinovStoredColors replacementSeriesU.data + (Fin.last ett.rounds) \ + TreeMissingColors sigma (HierarchyStarredStage KU j) = + TashkinovStoredColors replacementSeriesJ.data + (Fin.last ett.rounds) \ + TreeMissingColors sigma (HierarchyStarredStage KJ j) + rw [terminalStoredEq, starredEq] + have missingEq (j : Fin (KJ.dividerCount + 1)) : + HierarchyStageMissingColors KU j = + HierarchyStageMissingColors KJ j := by + unfold HierarchyStageMissingColors + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma + (replacementSeriesU.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors sigma + (replacementSeriesJ.data.tree (Fin.last ett.rounds).castSucc) + rw [finalTreeEq] + · change TreeMissingColors sigma (KU.stage i.succ.castSucc) = + TreeMissingColors sigma (KJ.stage i.succ.castSucc) + exact congrArg (TreeMissingColors sigma) (stageEq i.succ) + refine ⟨KU, rfl, ?_, ?_⟩ + · intro j + exact ⟨stageEq j, starredEq j, storedEq j, missingEq j⟩ + · intro i + rfl + +private theorem helper_branch_126.{u_1, u_2} : + helperBranch126Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett J U hJU replacementInputJ + replacementSeriesJ finalGeneratingColoringJ ladderTreesAgreeJ storedColorsAgreeJ + connectingEdgesAgreeJ extensionKindsAgreeJ replacementProperJ replacementOneUncoloredJ + replacementStableJ roundsPositiveJ aboveJ strictJ belowJ generatingJ seriesPresentationJ + baseJ KJ replacementInputU replacementSeriesU finalGeneratingColoringU ladderTreesAgreeU + storedColorsAgreeU connectingEdgesAgreeU extensionKindsAgreeU replacementProperU + replacementOneUncoloredU replacementStableU roundsU roundsPositiveU replacementDataU aboveU + strictU belowU generatingU rungAgreementU seriesPresentationU baseU hcore + cases rungAgreementU + have seriesSameU : replacementDataU = replacementSeriesU := + eq_of_heq seriesPresentationU + cases seriesSameU + have segmentJU : TreeSequenceInitialSegment J U := + TashkinovAugmentationSequenceInitialSegment sigma J U hJU + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + apply TreeSequenceInitialSegment.trans <;> assumption + let terminalIndex : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt ett.roundsPositive) (by omega)⟩ + have terminalIndexEq : terminalIndex.succ.castSucc = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + simp [terminalIndex, Nat.sub_add_cancel ett.roundsPositive] + have finalTreeEq : replacementSeriesU.data.tree + (Fin.last ett.rounds).castSucc = + replacementSeriesJ.data.tree (Fin.last ett.rounds).castSucc := by + rw [← terminalIndexEq] + exact (ladderTreesAgreeU terminalIndex).trans + (ladderTreesAgreeJ terminalIndex).symm + have storedEntryEq (i : Fin (ett.rounds + 1)) : + replacementSeriesU.data.stored i = replacementSeriesJ.data.stored i := + (storedColorsAgreeU i).trans (storedColorsAgreeJ i).symm + have finalMissingEq : TreeMissingColors + (replacementSeriesU.data.coloring (Fin.last ett.rounds)) + (replacementSeriesU.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors + (replacementSeriesJ.data.coloring (Fin.last ett.rounds)) + (replacementSeriesJ.data.tree (Fin.last ett.rounds).castSucc) := by + rw [← finalGeneratingColoringU, ← finalGeneratingColoringJ, finalTreeEq] + have terminalStoredEq := + @helper_terminalStoredEq_231 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett replacementInputJ replacementSeriesJ replacementInputU + replacementSeriesU storedEntryEq finalMissingEq + let kuStage : Fin (KJ.dividerCount + 2) → TreeSequence G e0 := + fun j => if j.val = KJ.dividerCount + 1 then U + else KJ.stage ⟨j.val, by omega⟩ + have kuStageOld (j : Fin (KJ.dividerCount + 1)) : + kuStage j.castSucc = KJ.stage j.castSucc := by + have hj : j.castSucc.val ≠ KJ.dividerCount + 1 := + Nat.ne_of_lt j.isLt + simp only [kuStage, ite_eq_right hj] + have kuStageLast : + kuStage (Fin.last (KJ.dividerCount + 1)) = U := by + simp [kuStage] + have kuStageAt (j : Fin (KJ.dividerCount + 2)) + (hj : j.val ≤ KJ.dividerCount) : + kuStage j = KJ.stage ⟨j.val, by omega⟩ := by + simp only [kuStage] + split <;> rename_i hs + · omega + · rfl + have kuNested := + @helper_kuNested_276 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett J U replacementInputJ replacementSeriesJ + finalGeneratingColoringJ ladderTreesAgreeJ storedColorsAgreeJ connectingEdgesAgreeJ + extensionKindsAgreeJ replacementProperJ replacementOneUncoloredJ replacementStableJ + roundsPositiveJ aboveJ strictJ belowJ generatingJ seriesPresentationJ baseJ KJ + replacementInputU replacementSeriesU segmentJU segmentTrans kuStageOld kuStageLast kuStageAt + have kuStrict := + @helper_kuStrict_298 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett J U replacementInputJ replacementSeriesJ + finalGeneratingColoringJ ladderTreesAgreeJ storedColorsAgreeJ connectingEdgesAgreeJ + extensionKindsAgreeJ replacementProperJ replacementOneUncoloredJ replacementStableJ + roundsPositiveJ aboveJ strictJ belowJ generatingJ seriesPresentationJ baseJ KJ + replacementInputU replacementSeriesU segmentJU kuStageOld kuStageLast kuStageAt + let kuDividerPosition (i : Fin KJ.dividerCount) : Fin (U.length + 1) := + ⟨(KJ.dividerPosition i).val, + lt_of_lt_of_le (KJ.dividerPosition i).isLt + (Nat.succ_le_succ segmentJU.1)⟩ + let KU : TashkinovHierarchy + { rounds := ett.rounds + roundsPositive := roundsPositiveU + series := replacementSeriesU + abovePenultimate := aboveU + strictAbovePenultimate := strictU + belowFinal := belowU + generatingColoring := generatingU } + baseU := + { dividerCount := KJ.dividerCount + stage := kuStage + baseStage := by + calc + kuStage 0 = KJ.stage 0 := by + simpa using kuStageOld (0 : Fin (KJ.dividerCount + 1)) + _ = replacementSeriesJ.data.tree + (Fin.last ett.rounds).castSucc := KJ.baseStage + _ = replacementSeriesU.data.tree + (Fin.last ett.rounds).castSucc := finalTreeEq.symm + terminalStage := kuStageLast + nested := kuNested + strict := kuStrict + dividerPosition := kuDividerPosition + dividerPositive := by intro i; exact KJ.dividerPositive i + dividerIncreasing := by + intro i j hij + exact KJ.dividerIncreasing i j hij + dividerStage := by + intro i + have hstageIndex : (i.val + 1) ≤ KJ.dividerCount := + Nat.succ_le_of_lt i.isLt + have hstage : kuStage ⟨i.val + 1, by omega⟩ = + KJ.stage ⟨i.val + 1, by omega⟩ := + kuStageAt ⟨i.val + 1, by omega⟩ hstageIndex + have hposJ : (KJ.dividerPosition i).val ≤ J.length := + Nat.le_of_lt_succ (KJ.dividerPosition i).isLt + have hposU : (KJ.dividerPosition i).val ≤ U.length := + le_trans hposJ segmentJU.1 + have prefixEq : TreeSequencePrefix U (KJ.dividerPosition i).val + (KJ.dividerPositive i) hposU = + TreeSequencePrefix J (KJ.dividerPosition i).val + (KJ.dividerPositive i) hposJ := by + rw [TreeSequencePrefix, TreeSequencePrefix] + congr + · funext x + have hv := segmentJU.2.1 + (Fin.castLE (Nat.succ_le_succ hposJ) x) + simpa using hv + · funext x + have he := segmentJU.2.2 (Fin.castLE hposJ x) + simpa using he + rw [prefixEq] + rw [hstage] + simpa [kuDividerPosition] using KJ.dividerStage i + coreInsideFirst := by + by_cases hd : KJ.dividerCount = 0 + · have hstage : kuStage ⟨1, by omega⟩ = U := by + simp [kuStage, hd] + rw [hstage] + have hold := KJ.coreInsideFirst + have holdStage : KJ.stage ⟨1, by omega⟩ = J := by + convert KJ.terminalStage using 1; apply congrArg KJ.stage; + apply Fin.ext; simp [hd] + rw [holdStage] at hold + rw [hcore] + exact segmentTrans hold segmentJU + · have hstage : kuStage ⟨1, by omega⟩ = KJ.stage ⟨1, by omega⟩ := + kuStageAt ⟨1, by omega⟩ (Nat.one_le_iff_ne_zero.mpr hd) + rw [hstage, hcore] + exact KJ.coreInsideFirst } + exact @helper_continuation_610 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating sigma ett J U replacementInputJ replacementSeriesJ + finalGeneratingColoringJ ladderTreesAgreeJ storedColorsAgreeJ connectingEdgesAgreeJ + extensionKindsAgreeJ replacementProperJ replacementOneUncoloredJ replacementStableJ + roundsPositiveJ aboveJ strictJ belowJ generatingJ seriesPresentationJ baseJ KJ + replacementInputU replacementSeriesU finalGeneratingColoringU ladderTreesAgreeU + storedColorsAgreeU connectingEdgesAgreeU extensionKindsAgreeU replacementProperU + replacementOneUncoloredU replacementStableU roundsPositiveU aboveU strictU belowU + generatingU seriesPresentationU baseU hcore segmentJU segmentTrans finalTreeEq + terminalStoredEq kuStageOld kuStageLast kuStageAt kuNested kuStrict +private theorem helper_branch_64.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (J U : TreeSequence G e0) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett sigma U) + (baseU : HierarchyBase corrU.replacementETT sigma) + (_ : TashkinovAugmentationSequence sigma J U) + (replacementInputJ : PartialEdgeColoring E k) + (replacementSeriesJ : TashkinovSeries G k ett.rounds e0 replacementInputJ) + (finalGeneratingColoringJ : + sigma = replacementSeriesJ.data.coloring (Fin.last ett.rounds)) + (ladderTreesAgreeJ : + ∀ (i : Fin ett.rounds), + replacementSeriesJ.data.tree i.succ.castSucc = + ett.series.data.tree i.succ.castSucc) + (storedColorsAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.stored i = ett.series.data.stored i) + (connectingEdgesAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.connectingEdges i = ett.series.data.connectingEdges i) + (extensionKindsAgreeJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeriesJ.data.kind i = ett.series.data.kind i) + (replacementProperJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (replacementSeriesJ.data.coloring i)) + (replacementOneUncoloredJ : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (replacementSeriesJ.data.coloring i) e0) + (replacementStableJ : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (replacementSeriesJ.data.coloring i.succ)) + (roundsJ : ℕ) (roundsPositiveJ : (1 : ℕ) ≤ roundsJ) + (replacementDataJ : TashkinovSeries G k roundsJ e0 replacementInputJ) + (aboveJ : + TreeSequenceInitialSegment + (replacementDataJ.data.tree (⟨roundsJ, (by omega)⟩ : Fin (roundsJ + (2 : ℕ)))) J) + (strictJ : + (replacementDataJ.data.tree + (⟨roundsJ, (by omega)⟩ : Fin (roundsJ + (2 : ℕ)))).length < + J.length) + (belowJ : + TreeSequenceInitialSegment J + (replacementDataJ.data.tree (Fin.last (roundsJ + (1 : ℕ))))) + (generatingJ : sigma = replacementDataJ.data.coloring (Fin.last roundsJ)) + (rungAgreementJ : + { rounds := roundsJ, roundsPositive := roundsPositiveJ, series := replacementDataJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, + belowFinal := belowJ, generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.rounds = + ett.rounds) + (seriesPresentationJ : + { rounds := roundsJ, roundsPositive := roundsPositiveJ, series := replacementDataJ, + abovePenultimate := aboveJ, strictAbovePenultimate := strictJ, + belowFinal := belowJ, generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }.series ≍ + replacementSeriesJ) + (baseJ : + HierarchyBase + { replacementInput := replacementInputJ, replacementSeries := replacementSeriesJ, + replacementETT := + { rounds := roundsJ, roundsPositive := roundsPositiveJ, + series := replacementDataJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }, + rungAgreement := rungAgreementJ, seriesPresentation := seriesPresentationJ, + finalGeneratingColoring := finalGeneratingColoringJ, + ladderTreesAgree := ladderTreesAgreeJ, + storedColorsAgree := storedColorsAgreeJ, + connectingEdgesAgree := connectingEdgesAgreeJ, + extensionKindsAgree := extensionKindsAgreeJ, + replacementProper := replacementProperJ, + replacementOneUncolored := replacementOneUncoloredJ, + replacementStable := replacementStableJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J }.replacementETT + sigma) + (KJ : + TashkinovHierarchy + { replacementInput := replacementInputJ, replacementSeries := replacementSeriesJ, + replacementETT := + { rounds := roundsJ, roundsPositive := roundsPositiveJ, + series := replacementDataJ, abovePenultimate := aboveJ, + strictAbovePenultimate := strictJ, belowFinal := belowJ, + generatingColoring := generatingJ : + ExtendedTashkinovTree G k e0 replacementInputJ J sigma }, + rungAgreement := rungAgreementJ, seriesPresentation := seriesPresentationJ, + finalGeneratingColoring := finalGeneratingColoringJ, + ladderTreesAgree := ladderTreesAgreeJ, + storedColorsAgree := storedColorsAgreeJ, + connectingEdgesAgree := connectingEdgesAgreeJ, + extensionKindsAgree := extensionKindsAgreeJ, + replacementProper := replacementProperJ, + replacementOneUncolored := replacementOneUncoloredJ, + replacementStable := replacementStableJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J }.replacementETT + baseJ) + (_ : baseU.core = baseJ.core), + ∃ (KU : TashkinovHierarchy corrU.replacementETT baseU) (hcount : + KU.dividerCount = KJ.dividerCount), + (∀ (j : Fin (KU.dividerCount + (1 : ℕ))), + let jo : Fin (KJ.dividerCount + (1 : ℕ)) := + Fin.cast (congrArg (fun (n : ℕ) => n + (1 : ℕ)) hcount) j; + KU.stage j.castSucc = KJ.stage jo.castSucc ∧ + HierarchyStarredStage KU j = HierarchyStarredStage KJ jo ∧ + HierarchyStoredColorsAt KU j = HierarchyStoredColorsAt KJ jo ∧ + HierarchyStageMissingColors KU j = HierarchyStageMissingColors KJ jo) ∧ + ∀ (i : Fin KU.dividerCount), + (↑(KU.dividerPosition i) : ℕ) = (↑(KJ.dividerPosition (Fin.cast hcount i)) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett J U corrU baseU hJU replacementInputJ + replacementSeriesJ finalGeneratingColoringJ ladderTreesAgreeJ storedColorsAgreeJ + connectingEdgesAgreeJ extensionKindsAgreeJ replacementProperJ replacementOneUncoloredJ + replacementStableJ roundsJ roundsPositiveJ replacementDataJ aboveJ strictJ belowJ + generatingJ rungAgreementJ seriesPresentationJ baseJ KJ hcore + cases rungAgreementJ + have seriesSameJ : replacementDataJ = replacementSeriesJ := + eq_of_heq seriesPresentationJ + cases seriesSameJ + rcases corrU with ⟨replacementInputU, replacementSeriesU, replacementETTU, + rungAgreementU, seriesPresentationU, finalGeneratingColoringU, + ladderTreesAgreeU, storedColorsAgreeU, connectingEdgesAgreeU, + extensionKindsAgreeU, replacementProperU, replacementOneUncoloredU, + replacementStableU⟩ + cases replacementETTU with + | mk roundsU roundsPositiveU replacementDataU aboveU strictU belowU generatingU => + exact @helper_branch_126 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett J U hJU replacementInputJ replacementSeriesJ + finalGeneratingColoringJ ladderTreesAgreeJ storedColorsAgreeJ connectingEdgesAgreeJ + extensionKindsAgreeJ replacementProperJ replacementOneUncoloredJ replacementStableJ + roundsPositiveJ aboveJ strictJ belowJ generatingJ seriesPresentationJ baseJ KJ + replacementInputU replacementSeriesU finalGeneratingColoringU ladderTreesAgreeU + storedColorsAgreeU connectingEdgesAgreeU extensionKindsAgreeU replacementProperU + replacementOneUncoloredU replacementStableU roundsU roundsPositiveU replacementDataU + aboveU strictU belowU generatingU rungAgreementU seriesPresentationU baseU hcore +theorem GoodHierarchySameDividerReconstruction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (J U : TreeSequence G e0) + (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett sigma J) + (baseJ : HierarchyBase corrJ.replacementETT sigma) + (KJ : TashkinovHierarchy corrJ.replacementETT baseJ) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett sigma U) + (baseU : HierarchyBase corrU.replacementETT sigma) + (hcore : baseU.core = baseJ.core) + (hJU : TashkinovAugmentationSequence sigma J U) : + ∃ KU : TashkinovHierarchy corrU.replacementETT baseU, + ∃ hcount : KU.dividerCount = KJ.dividerCount, + (∀ j : Fin (KU.dividerCount + 1), + let jo : Fin (KJ.dividerCount + 1) := + Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j + KU.stage j.castSucc = KJ.stage jo.castSucc ∧ + HierarchyStarredStage KU j = HierarchyStarredStage KJ jo ∧ + HierarchyStoredColorsAt KU j = HierarchyStoredColorsAt KJ jo ∧ + HierarchyStageMissingColors KU j = HierarchyStageMissingColors KJ jo) ∧ + ∀ i : Fin KU.dividerCount, + (KU.dividerPosition i).val = (KJ.dividerPosition (Fin.cast hcount i)).val := by + classical + rcases corrJ with ⟨replacementInputJ, replacementSeriesJ, replacementETTJ, + rungAgreementJ, seriesPresentationJ, finalGeneratingColoringJ, + ladderTreesAgreeJ, storedColorsAgreeJ, connectingEdgesAgreeJ, + extensionKindsAgreeJ, replacementProperJ, replacementOneUncoloredJ, + replacementStableJ⟩ + cases replacementETTJ with + | mk roundsJ roundsPositiveJ replacementDataJ aboveJ strictJ belowJ generatingJ => + exact @helper_branch_64 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett J U corrU baseU hJU replacementInputJ replacementSeriesJ + finalGeneratingColoringJ ladderTreesAgreeJ storedColorsAgreeJ connectingEdgesAgreeJ + extensionKindsAgreeJ replacementProperJ replacementOneUncoloredJ replacementStableJ + roundsJ roundsPositiveJ replacementDataJ aboveJ strictJ belowJ generatingJ + rungAgreementJ seriesPresentationJ baseJ KJ hcore +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchySameDividerTransport.lean b/LeanPool/GoldbergSeymour/GoodHierarchySameDividerTransport.lean new file mode 100644 index 0000000000..fc58fae917 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchySameDividerTransport.lean @@ -0,0 +1,402 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy + +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Good Hierarchy Same Divider Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_continuation_174.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (J U : TreeSequence G e0) (corrJ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma J) (baseJ : HierarchyBase + corrJ.replacementETT sigma) (KJ : TashkinovHierarchy corrJ.replacementETT baseJ) (goodJ : + GoodHierarchy KJ) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett sigma U) (baseU : + HierarchyBase corrU.replacementETT sigma) (_ : baseU.core = baseJ.core) (_ : baseU.closure + = baseJ.closure) (KU : TashkinovHierarchy corrU.replacementETT baseU) (hcount : + KU.dividerCount = KJ.dividerCount) (_ : ( + ∀ eta ∈ HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount), Disjoint (goodJ.gamma (Fin.last + KJ.dividerCount) eta) ({c : Fin k | + ∃ (r : Fin U.length), (HierarchyStarredStage KJ (Fin.last KJ.dividerCount)).length ≤ (↑r : ℕ) + ∧ (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition sigma U eta) : ℕ) U.length ∧ sigma + (U.edge r) = some c} : Finset (Fin k)))), + ∀ (computedIndex27 : Fin (KU.dividerCount + (1 : ℕ)) → Fin (KJ.dividerCount + (1 : ℕ))), + (computedIndex27 = fun (j : Fin (KU.dividerCount + (1 : ℕ))) ↦ Fin.cast ( + by omega + ) j) → + ∀ (_ : ( + ∀ (j : Fin (KU.dividerCount + (1 : ℕ))), KU.stage j.castSucc = KJ.stage (computedIndex27 + j).castSucc)) (_ : ( + ∀ (j : Fin (KU.dividerCount + (1 : ℕ))), HierarchyStarredStage KU j = HierarchyStarredStage KJ + (computedIndex27 j))) (_ : ( + ∀ (j : Fin (KU.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt KU j = + HierarchyStoredColorsAt KJ (computedIndex27 j))) (_ : ( + ∀ (j : Fin (KU.dividerCount + (1 : ℕ))), HierarchyStageMissingColors KU j = + HierarchyStageMissingColors KJ (computedIndex27 j))) (_ : ( + ∀ (j : Fin KU.dividerCount) (eta : Fin k), HierarchySegmentColors KU j.castSucc eta = + HierarchySegmentColors KJ (computedIndex27 j.castSucc) eta)), + ∃ (goodU : GoodHierarchy KU), + ∀ (j : Fin (KU.dividerCount + (1 : ℕ))) (eta : Fin k), goodU.gamma j eta = goodJ.gamma + (Fin.cast ( + by omega + ) j) eta := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett J U corrJ baseJ KJ goodJ corrU baseU + hcore hclosure KU hcount havoid index indexSpecification + subst index + set index : Fin (KU.dividerCount + (1 : ℕ)) → Fin (KJ.dividerCount + (1 : ℕ)) := fun (j : Fin + (KU.dividerCount + (1 : ℕ))) ↦ Fin.cast (by + omega) j + let gammaU : Fin (KU.dividerCount + (1 : ℕ)) → Fin k → Finset (Fin k) := + fun (j : Fin (KU.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ goodJ.gamma (index j) eta + intro stageEq starredEq storedEq missingEq segmentEqInternal + have terminalSegmentEq (eta : Fin k) : + HierarchySegmentColors KU (Fin.last KU.dividerCount) eta = + Finset.univ.filter (fun c => ∃ r : Fin U.length, + (HierarchyStarredStage KJ (Fin.last KJ.dividerCount)).length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma U eta).val U.length ∧ + sigma (U.edge r) = some c) := by + unfold HierarchySegmentColors + dsimp + rw [KU.terminalStage] + have hlastIndex : index (Fin.last KU.dividerCount) = + Fin.last KJ.dividerCount := by + apply Fin.ext + simp [index] + rw [← hlastIndex] + rw [starredEq (Fin.last KU.dividerCount)] + have terminalData (W : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma W) : + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) := by + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have seriesSame : replacementData = replacementSeries := + eq_of_heq seriesPresentation + cases seriesSame + let q : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt ett.roundsPositive) (by omega)⟩ + have hq : q.succ = Fin.last ett.rounds := by + apply Fin.ext + exact Nat.sub_add_cancel ett.roundsPositive + refine ⟨?_, ?_⟩ + · rw [← hq] + exact (ladderTreesAgree q).trans rfl + · exact extensionKindsAgree (Fin.last ett.rounds) + let goodU : GoodHierarchy KU := + { gamma := gammaU + twoColors := by + intro j eta hmem + apply goodJ.twoColors (index j) eta + rw [← storedEq j] + exact hmem + avoidance := by + intro j eta hmem c hc + have hmemOld : eta ∈ HierarchyStoredColorsAt KJ (index j) := by + rw [← storedEq j] + exact hmem + have hmissing := (Finset.mem_sdiff.mp + (goodJ.avoidance (index j) eta hmemOld hc)).1 + have hnewMissing : c ∈ HierarchyStageMissingColors KU j := by + rw [missingEq j] + exact hmissing + refine Finset.mem_sdiff.mpr ⟨hnewMissing, ?_⟩ + intro hseg + by_cases hj : j.val < KU.dividerCount + · let ji : Fin KU.dividerCount := ⟨j.val, hj⟩ + have heq := segmentEqInternal ji eta + have hindex : index ji.castSucc = index j := by + apply Fin.ext + rfl + have hsegOld : c ∈ HierarchySegmentColors KJ (index j) eta := by + rw [← hindex, ← heq] + simpa [ji] using hseg + exact (Finset.mem_sdiff.mp + (goodJ.avoidance (index j) eta hmemOld hc)).2 hsegOld + · have hjlast : j = Fin.last KU.dividerCount := by + apply Fin.ext + simp only [Fin.val_last] + omega + subst j + have hrestrict : c ∈ Finset.univ.filter (fun c => ∃ r : Fin U.length, + (HierarchyStarredStage KJ (Fin.last KJ.dividerCount)).length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma U eta).val U.length ∧ + sigma (U.edge r) = some c) := by + rw [← terminalSegmentEq eta] + exact hseg + have hlastIndex : index (Fin.last KU.dividerCount) = + Fin.last KJ.dividerCount := by + apply Fin.ext + simp [index] + rw [hlastIndex] at hmemOld + have hcOld : c ∈ goodJ.gamma (Fin.last KJ.dividerCount) eta := by + simpa [gammaU, hlastIndex] using hc + exact (Finset.disjoint_left.mp (havoid eta hmemOld)) hcOld hrestrict + disjointPairs := by + intro j eta theta h₁ h₂ hne + apply goodJ.disjointPairs (index j) eta theta + · rw [← storedEq j]; exact h₁ + · rw [← storedEq j]; exact h₂ + · exact hne + uniqueRefresh := by + intro i + let oldInternal : Fin KJ.dividerCount := ⟨i.val, by + simpa [hcount] using i.isLt⟩ + have hold := goodJ.uniqueRefresh oldInternal + rcases hold with ⟨chosen, hchosen, hunique⟩ + have hnext : oldInternal.succ = index i.succ := by + apply Fin.ext + rfl + have hprev : oldInternal.castSucc = index i.castSucc := by + apply Fin.ext + rfl + refine ⟨chosen, ?_, ?_⟩ + · rcases hchosen with ⟨hchosen, hlocal, hrest⟩ + refine ⟨?_, ?_, ?_⟩ + · rw [storedEq i.succ] + exact hchosen + · rw [stageEq i.succ, starredEq i.castSucc] + simpa [gammaU, oldInternal, hnext, hprev] using hlocal + · intro theta htheta hne + have hthetaOld : theta ∈ HierarchyStoredColorsAt KJ oldInternal.succ := by + rw [hnext] + exact (storedEq i.succ).symm ▸ htheta + have hh := hrest theta hthetaOld hne + simpa [gammaU, oldInternal, hnext, hprev] using hh + · intro eta heta + have hetaOld : eta ∈ HierarchyStoredColorsAt KJ oldInternal.succ := by + rw [hnext] + exact (storedEq i.succ).symm ▸ heta.1 + apply hunique eta + refine ⟨hetaOld, ?_, ?_⟩ + · have hnewlocal := heta.2.1 + rw [stageEq i.succ, starredEq i.castSucc] at hnewlocal + simpa [gammaU, oldInternal, hnext, hprev] using hnewlocal + · intro theta htheta hne + have hthetaNew : theta ∈ HierarchyStoredColorsAt KU i.succ := by + rw [storedEq i.succ] + rw [hnext] at htheta + exact htheta + simpa [gammaU, oldInternal, hnext, hprev] using + heta.2.2 theta hthetaNew hne + parallelBase := by + have dataJ := terminalData J corrJ + have dataU := terminalData U corrU + have hkind : corrU.replacementETT.series.data.kind + (Fin.last corrU.replacementETT.rounds) = + corrJ.replacementETT.series.data.kind + (Fin.last corrJ.replacementETT.rounds) := + dataU.2.trans dataJ.2.symm + have hzero : (HierarchyStoredColorsAt KU 0).biUnion (gammaU 0) = + (HierarchyStoredColorsAt KJ 0).biUnion (goodJ.gamma 0) := by + rw [storedEq 0] + have hi0 : index 0 = (0 : Fin (KJ.dividerCount + 1)) := by + apply Fin.ext + rfl + simp [gammaU, hi0] + dsimp + intro hpe + have hpeJ : corrJ.replacementETT.series.data.kind + (Fin.last corrJ.replacementETT.rounds) = + some TashkinovExtensionKind.PE := by + rw [← hkind] + exact hpe + have hold := goodJ.parallelBase hpeJ + rw [hcore, hclosure, hzero] + rw [dataU.1, ← dataJ.1] + exact hold + minusClosed := by + intro i + let oldInternal : Fin KJ.dividerCount := ⟨i.val, by + simpa [hcount] using i.isLt⟩ + have hold := goodJ.minusClosed oldInternal + have hnext : oldInternal.succ = index i.succ := by + apply Fin.ext + rfl + have hprev : oldInternal.castSucc = index i.castSucc := by + apply Fin.ext + rfl + rw [hnext, hprev] at hold + rw [stageEq i.succ, storedEq i.succ] + simpa [gammaU] using hold } + refine ⟨goodU, ?_⟩ + intro j eta + rfl + +theorem GoodHierarchySameDividerTransport {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (J U : TreeSequence G e0) + (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett sigma J) + (baseJ : HierarchyBase corrJ.replacementETT sigma) + (KJ : TashkinovHierarchy corrJ.replacementETT baseJ) + (goodJ : GoodHierarchy KJ) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett sigma U) + (baseU : HierarchyBase corrU.replacementETT sigma) + (hcore : baseU.core = baseJ.core) + (hclosure : baseU.closure = baseJ.closure) + (KU : TashkinovHierarchy corrU.replacementETT baseU) + (hcount : KU.dividerCount = KJ.dividerCount) + (hstages : ∀ j : Fin (KU.dividerCount + 1), + let jo : Fin (KJ.dividerCount + 1) := + Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j + KU.stage j.castSucc = KJ.stage jo.castSucc ∧ + HierarchyStarredStage KU j = HierarchyStarredStage KJ jo ∧ + HierarchyStoredColorsAt KU j = HierarchyStoredColorsAt KJ jo ∧ + HierarchyStageMissingColors KU j = HierarchyStageMissingColors KJ jo) + (hJU : TashkinovAugmentationSequence sigma J U) : + let lastJ : Fin (KJ.dividerCount + 1) := Fin.last KJ.dividerCount + let A : TreeSequence G e0 := HierarchyStarredStage KJ lastJ + let restrictedColors : TreeSequence G e0 → Fin k → Finset (Fin k) := fun W eta => + Finset.univ.filter fun c => + ∃ r : Fin W.length, + A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma W eta).val W.length ∧ + sigma (W.edge r) = some c + (∀ eta : Fin k, + eta ∈ HierarchyStoredColorsAt KJ lastJ → + Disjoint (goodJ.gamma lastJ eta) (restrictedColors U eta)) → + ∃ goodU : GoodHierarchy KU, + ∀ j : Fin (KU.dividerCount + 1), + let jo : Fin (KJ.dividerCount + 1) := Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j + ∀ eta : Fin k, + goodU.gamma j eta = goodJ.gamma jo eta := by + classical + dsimp + intro havoid + let index (j : Fin (KU.dividerCount + 1)) : Fin (KJ.dividerCount + 1) := + Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j + let gammaU : Fin (KU.dividerCount + 1) → Fin k → Finset (Fin k) := + fun j eta => goodJ.gamma (index j) eta + have stageEq (j : Fin (KU.dividerCount + 1)) : + KU.stage j.castSucc = KJ.stage (index j).castSucc := + (hstages j).1 + have starredEq (j : Fin (KU.dividerCount + 1)) : + HierarchyStarredStage KU j = HierarchyStarredStage KJ (index j) := + (hstages j).2.1 + have storedEq (j : Fin (KU.dividerCount + 1)) : + HierarchyStoredColorsAt KU j = HierarchyStoredColorsAt KJ (index j) := + (hstages j).2.2.1 + have missingEq (j : Fin (KU.dividerCount + 1)) : + HierarchyStageMissingColors KU j = HierarchyStageMissingColors KJ (index j) := + (hstages j).2.2.2 + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + apply TreeSequenceInitialSegment.trans <;> assumption + have stageSegment : ∀ (a d : ℕ) + (hbound : a + d ≤ KJ.dividerCount + 1), + TreeSequenceInitialSegment (KJ.stage ⟨a, by omega⟩) + (KJ.stage ⟨a + d, by omega⟩) := by + intro a d + induction d with + | zero => + intro hbound + simpa using (show TreeSequenceInitialSegment + (KJ.stage ⟨a, by omega⟩) (KJ.stage ⟨a, by omega⟩) from + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩) + | succ d ih => + intro hbound + have hprev := ih (by omega) + have hnext := KJ.nested ⟨a + d, by omega⟩ + have hnext' : TreeSequenceInitialSegment + (KJ.stage ⟨a + d, by omega⟩) + (KJ.stage ⟨a + (d + 1), by omega⟩) := by + simpa [Nat.add_assoc] using hnext + exact segmentTrans hprev hnext' + have prefixJU : TreeSequenceInitialSegment J U := + TashkinovAugmentationSequenceInitialSegment sigma J U hJU + have nextSegment (j : Fin KU.dividerCount) : + TreeSequenceInitialSegment (KJ.stage (index j.succ).castSucc) J := by + have hj : (index j.succ).val ≤ KJ.dividerCount := by + have := (index j.succ).isLt + omega + have hs := stageSegment (index j.succ).val + (KJ.dividerCount + 1 - (index j.succ).val) (by omega) + have hlast : (KJ.stage ⟨(index j.succ).val + + (KJ.dividerCount + 1 - (index j.succ).val), by omega⟩) = J := by + have hi : (⟨(index j.succ).val + + (KJ.dividerCount + 1 - (index j.succ).val), by omega⟩ : + Fin (KJ.dividerCount + 2)) = Fin.last (KJ.dividerCount + 1) := by + apply Fin.ext + have hval : (index j.succ).val ≤ KJ.dividerCount := by omega + simp + rw [hi, KJ.terminalStage] + rw [hlast] at hs + convert hs using 1 + apply congrArg KJ.stage + apply Fin.ext + rfl + have segmentEqInternal (j : Fin KU.dividerCount) (eta : Fin k) : + HierarchySegmentColors KU j.castSucc eta = + HierarchySegmentColors KJ (index j.castSucc) eta := by + have hseg := nextSegment j + have hcut := HierarchyFirstMissingPositionPrefixCutoff sigma J U + prefixJU eta (KJ.stage (index j.succ).castSucc).length + (Nat.le_of_lt_succ (Nat.lt_succ_of_le hseg.1)) + unfold HierarchySegmentColors + dsimp + have hidx : j.castSucc.succ = j.succ.castSucc := by + apply Fin.ext + rfl + have hindex : (index j.castSucc).succ = (index j.succ).castSucc := by + apply Fin.ext + rfl + rw [hidx, stageEq j.succ, hindex, starredEq j.castSucc] + apply Finset.ext + intro c + constructor + · intro hc + rcases Finset.mem_filter.mp hc with ⟨_, r, hlo, hhi, hcol⟩ + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, r, hlo, ?_, hcol⟩ + simpa [hcut] using hhi + · intro hc + rcases Finset.mem_filter.mp hc with ⟨_, r, hlo, hhi, hcol⟩ + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, r, hlo, ?_, hcol⟩ + simpa [hcut] using hhi + exact @helper_continuation_174 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@sigma) (@ett) (@J) (@U) + (@corrJ) (@baseJ) (@KJ) (@goodJ) (@corrU) (@baseU) (@hcore) (@hclosure) (@KU) (@hcount) + (@havoid) _ (by rfl) (@stageEq) (@starredEq) (@storedEq) (@missingEq) (@segmentEqInternal) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyTerminalPrefixRepackage.lean b/LeanPool/GoldbergSeymour/GoodHierarchyTerminalPrefixRepackage.lean new file mode 100644 index 0000000000..a8a41aa820 --- /dev/null +++ b/LeanPool/GoldbergSeymour/GoodHierarchyTerminalPrefixRepackage.lean @@ -0,0 +1,363 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TerminalHierarchyPrefixConstruction + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Good Hierarchy Terminal Prefix Repackage + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open TerminalHierarchyPrefixPreparation + +private theorem helper_continuation_904.{u_1, u_2} : + helperContinuation904Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H good B hAB hBT segmentRefl + segmentTrans stageSegment lastStage lastZero lastPositive lastToB firstToB strictFirst ettB + mpB baseB hbStage hbStageOld hbStageAt hbNested hbStrict HB stageOrdNext starredEq storedEq + beforeFirstMissing missingEq + have segmentSubset (j : Fin (H.dividerCount + 1)) (eta : Fin k) : + HierarchySegmentColors HB j eta ⊆ HierarchySegmentColors H j eta := by + intro c hc + unfold HierarchySegmentColors at hc ⊢ + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hc ⊢ + rcases hc with ⟨x, hafter, hbefore, hcolor⟩ + have hnext : TreeSequenceInitialSegment + (HB.stage j.succ) (H.stage j.succ) := by + by_cases hj : j.val = H.dividerCount + · have hlast : j = Fin.last H.dividerCount := by + apply Fin.ext + simpa using hj + rw [hlast] + have hjs : (Fin.last H.dividerCount).succ = + Fin.last (H.dividerCount + 1) := by rfl + rw [hjs, HB.terminalStage, H.terminalStage] + exact hBT + · have hjlt : j.val < H.dividerCount := by omega + change TreeSequenceInitialSegment (hbStage j.succ) (H.stage j.succ) + rw [hbStageAt j.succ (Nat.succ_le_of_lt hjlt)] + exact segmentRefl _ + have hstageB : TreeSequenceInitialSegment (HB.stage j.succ) B := by + by_cases hj : j.val = H.dividerCount + · have hlast : j = Fin.last H.dividerCount := by + apply Fin.ext + simpa using hj + rw [hlast] + have hjs : (Fin.last H.dividerCount).succ = + Fin.last (H.dividerCount + 1) := by rfl + rw [hjs, HB.terminalStage] + exact segmentRefl _ + · have hjlt : j.val < H.dividerCount := by omega + change TreeSequenceInitialSegment (hbStage j.succ) B + rw [hbStageAt j.succ (Nat.succ_le_of_lt hjlt)] + have hs := stageSegment (j.val + 1) + (H.dividerCount - (j.val + 1)) (by omega) + rw [show (⟨j.val + 1 + (H.dividerCount - (j.val + 1)), by omega⟩ : + Fin (H.dividerCount + 2)) = ⟨H.dividerCount, by omega⟩ by + apply Fin.ext + simpa using Nat.add_sub_of_le (Nat.succ_le_of_lt hjlt)] at hs + have hs' : TreeSequenceInitialSegment + (H.stage ⟨j.val + 1, by omega⟩) + (H.stage ⟨H.dividerCount, by omega⟩) := by + exact hs + have hab : TreeSequenceInitialSegment + (H.stage ⟨H.dividerCount, by omega⟩) B := by + rw [← lastPositive (by omega)] + exact hAB + exact segmentTrans hs' hab + let xold : Fin (H.stage j.succ).length := + Fin.castLE hnext.1 x + let xB : Fin (B.length + 1) := Fin.castLE + (Nat.succ_le_succ hstageB.1) ⟨x.val, by omega⟩ + refine ⟨xold, ?_, ?_, ?_⟩ + · rw [← starredEq j] + simpa [xold] using hafter + · apply lt_min + · have hm := beforeFirstMissing hBT eta xB (by dsimp [xB]; omega) + (by simpa [xB] using (lt_min_iff.mp hbefore).1) + simpa [xold, xB] using hm + · exact lt_of_lt_of_le (lt_min_iff.mp hbefore).2 hnext.1 + · change phi ((H.stage j.succ).edge (Fin.castLE hnext.1 x)) = some c + rw [hnext.2.2 x] + exact hcolor + let goodB : GoodHierarchy HB := by + exact { + gamma := good.gamma + twoColors := by + intro j eta hmem + apply good.twoColors j eta + rw [← storedEq j] + exact hmem + avoidance := by + intro j eta hmem c hc + have ho := good.avoidance j eta (by rw [← storedEq j]; exact hmem) hc + exact Finset.mem_sdiff.mpr ⟨by rw [missingEq j]; exact (Finset.mem_sdiff.mp ho).1, + fun hn => (Finset.mem_sdiff.mp ho).2 (segmentSubset j eta hn)⟩ + disjointPairs := by + intro j eta theta h₁ h₂ hne + apply good.disjointPairs j eta theta + · rw [← storedEq j]; exact h₁ + · rw [← storedEq j]; exact h₂ + · exact hne + uniqueRefresh := by + intro i + rw [stageOrdNext i] + simpa [storedEq, starredEq] using good.uniqueRefresh i + parallelBase := by + simpa [ettB, baseB, HierarchyStoredColorsAt, HierarchyStarredStage] using good.parallelBase + minusClosed := by + intro i + rw [stageOrdNext i] + simpa [storedEq] using good.minusClosed i } + refine ⟨ettB, mpB, rfl, HEq.rfl, baseB, rfl, rfl, rfl, HB, rfl, ?_, ?_, goodB, ?_⟩ + · intro j + exact ⟨by simpa using hbStageOld j, starredEq j⟩ + · intro i + rfl + · intro j + exact ⟨storedEq j, missingEq j, fun eta => ⟨rfl, segmentSubset j eta⟩⟩ + +theorem GoodHierarchyTerminalPrefixRepackage {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) + (good : GoodHierarchy H) + (B : TreeSequence G e0) + (hAB : TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) B) + (hABstrict : + (HierarchyStarredStage H (Fin.last H.dividerCount)).length < B.length) + (hBT : TreeSequenceInitialSegment B T) : + ∃ ettB : ExtendedTashkinovTree G k e0 input B generating, + MaximumProperty ettB ∧ + ettB.rounds = ett.rounds ∧ + HEq ettB.series ett.series ∧ + ∃ baseB : HierarchyBase ettB phi, + baseB.core = base.core ∧ + baseB.closure = base.closure ∧ + baseB.supportPosition.val = base.supportPosition.val ∧ + ∃ HB : TashkinovHierarchy ettB baseB, + ∃ hcount : HB.dividerCount = H.dividerCount, + (∀ j : Fin (HB.dividerCount + 1), + HB.stage j.castSucc = + H.stage + ((Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j : + Fin (H.dividerCount + 1))).castSucc ∧ + HierarchyStarredStage HB j = + HierarchyStarredStage H + (Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j : Fin (H.dividerCount + 1))) ∧ + (∀ i : Fin HB.dividerCount, + (HB.dividerPosition i).val = (H.dividerPosition (Fin.cast hcount i)).val) ∧ + ∃ goodB : GoodHierarchy HB, + ∀ j : Fin (HB.dividerCount + 1), + HierarchyStoredColorsAt HB j = + HierarchyStoredColorsAt H + (Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j : Fin (H.dividerCount + 1)) ∧ + HierarchyStageMissingColors HB j = + HierarchyStageMissingColors H + (Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j : Fin (H.dividerCount + 1)) ∧ + ∀ eta : Fin k, + goodB.gamma j eta = + good.gamma + (Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j : Fin (H.dividerCount + 1)) eta ∧ + HierarchySegmentColors HB j eta ⊆ + HierarchySegmentColors H + (Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j : Fin (H.dividerCount + 1)) eta := by + classical + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + apply TreeSequenceInitialSegment.trans <;> assumption + have stageSegment := + @helper_stageSegment_94 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@B) + (@segmentRefl) (@segmentTrans) + let lastStage : TreeSequence G e0 := + HierarchyStarredStage H (Fin.last H.dividerCount) + have lastZero : H.dividerCount = 0 → + lastStage = base.core := by + intro h + simp [lastStage, HierarchyStarredStage, h, Fin.last] + have lastPositive := + @helper_lastPositive_115 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@B) + have stageLastPositive := + @helper_stageLastPositive_128 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@B) + (@lastPositive) + have stageToLast := + @helper_stageToLast_135 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@B) + (@segmentRefl) (@stageSegment) (@lastZero) (@lastPositive) + have lastToB : TreeSequenceInitialSegment lastStage B := hAB + have firstToB := segmentTrans stageToLast lastToB + have strictFirst : + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < B.length := by + have hlt : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length ≤ + lastStage.length := stageToLast.1 + exact lt_of_le_of_lt hlt (by exact hABstrict) + let ettB : ExtendedTashkinovTree G k e0 input B generating := + { rounds := ett.rounds + roundsPositive := ett.roundsPositive + series := ett.series + abovePenultimate := firstToB + strictAbovePenultimate := strictFirst + belowFinal := segmentTrans hBT ett.belowFinal + generatingColoring := ett.generatingColoring } + have mpB : MaximumProperty ettB := by + simpa [MaximumProperty, ettB] using hMP + let baseB : HierarchyBase ettB phi := + { core := base.core + closure := base.closure + supportPosition := base.supportPosition + supportPositive := base.supportPositive + terminalMissingColors := by simpa [ettB] using base.terminalMissingColors + parallel := by simpa [ettB] using base.parallel + nonparallel := by simpa [ettB] using base.nonparallel } + let hbStage : Fin (H.dividerCount + 2) → TreeSequence G e0 := + fun j => if j.val = H.dividerCount + 1 then B + else H.stage ⟨j.val, by omega⟩ + have hbStageOld (j : Fin (H.dividerCount + 1)) : + hbStage j.castSucc = H.stage j.castSucc := by + by_cases hh : j.castSucc.val = H.dividerCount + 1 + · have hj : j.val = H.dividerCount + 1 := by simpa using hh + omega + · simp only [hbStage, ite_eq_right hh] + have hbStageLast : hbStage (Fin.last (H.dividerCount + 1)) = B := by + have he : (Fin.last (H.dividerCount + 1)).val = H.dividerCount + 1 := by simp + simp only [hbStage, ite_eq_left he] + have hbStageAt (j : Fin (H.dividerCount + 2)) (hj : j.val ≤ H.dividerCount) : + hbStage j = H.stage ⟨j.val, by omega⟩ := by + simp only [hbStage] + split <;> rename_i hs + · omega + · rfl + have hbNested := + @helper_hbNested_194 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@B) (@hAB) + (@segmentTrans) (@stageLastPositive) (@stageToLast) (@hbStageOld) (@hbStageLast) + (@hbStageAt) + have hbStrict := + @helper_hbStrict_225 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@B) (@hABstrict) + (@stageLastPositive) (@stageToLast) (@hbStageOld) (@hbStageLast) (@hbStageAt) + let HB := @helperHB477 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@B) (@hAB) (@hBT) + (@segmentTrans) (@stageSegment) (@lastZero) (@lastPositive) (@lastToB) (@firstToB) + (@strictFirst) (@hbStageAt) (@hbNested) (@hbStrict) + have stageOrd (i : Fin H.dividerCount) : + HB.stage i.castSucc.succ = H.stage i.castSucc.succ := by + change hbStage i.castSucc.succ = H.stage i.castSucc.succ + exact hbStageAt i.castSucc.succ (Nat.succ_le_of_lt i.isLt) + have stageOrdNext (i : Fin H.dividerCount) : + HB.stage i.succ.castSucc = H.stage i.succ.castSucc := by + have hindex : i.succ.castSucc = i.castSucc.succ := by + apply Fin.ext + rfl + rw [hindex] + exact stageOrd i + have stageEq (j : Fin (H.dividerCount + 2)) : + HB.stage j = if j.val = H.dividerCount + 1 then B + else H.stage ⟨j.val, by omega⟩ := rfl + have starredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage HB j = HierarchyStarredStage H j := by + refine Fin.cases ?_ (fun i => ?_) j + · simp [HierarchyStarredStage] + · change HB.stage i.succ.castSucc = H.stage i.succ.castSucc + exact stageOrd i + have storedEq (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt HB j = HierarchyStoredColorsAt H j := by + unfold HierarchyStoredColorsAt + rw [starredEq] + have beforeFirstMissing {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) (eta : Fin k) + (i : Fin (A.length + 1)) (hiEnd : i.val < A.length) + (hi : i.val < (HierarchyFirstMissingPosition phi A eta).val) : + let iB : Fin (B.length + 1) := + Fin.castLE (Nat.succ_le_succ hAB.1) i + iB.val < (HierarchyFirstMissingPosition phi B eta).val := by + let candidatesA : Finset (Fin (A.length + 1)) := + Finset.univ.filter fun x => eta ∈ MissingColors G phi (A.vertex x) + let candidatesB : Finset (Fin (B.length + 1)) := + Finset.univ.filter fun x => eta ∈ MissingColors G phi (B.vertex x) + change i.val < (if h : candidatesA.Nonempty then candidatesA.min' h + else Fin.last A.length).val at hi + change (Fin.castLE (Nat.succ_le_succ hAB.1) i).val < + (if h : candidatesB.Nonempty then candidatesB.min' h + else Fin.last B.length).val + by_cases hB : candidatesB.Nonempty + · rw [dite_eq_left hB] + by_contra hnot + have hle : (candidatesB.min' hB).val ≤ i.val := by simpa using hnot + let ia : Fin (A.length + 1) := ⟨(candidatesB.min' hB).val, by omega⟩ + have hmemB := Finset.min'_mem candidatesB hB + have hmissingB := (Finset.mem_filter.mp hmemB).2 + have hcast : Fin.castLE (Nat.succ_le_succ hAB.1) ia = + candidatesB.min' hB := Fin.ext rfl + have hmissingA : eta ∈ MissingColors G phi (A.vertex ia) := by + rw [← hAB.2.1 ia, hcast] + exact hmissingB + have hmemA : ia ∈ candidatesA := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hmissingA⟩ + by_cases hA : candidatesA.Nonempty + · rw [dite_eq_left hA] at hi + have hminA := Finset.min'_le candidatesA ia hmemA + change (candidatesA.min' hA).val ≤ ia.val at hminA + dsimp [ia] at hminA + omega + · exact hA ⟨ia, hmemA⟩ + · rw [dite_eq_right hB] + simpa using lt_of_lt_of_le hiEnd hAB.1 + have missingEq (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors HB j = HierarchyStageMissingColors H j := by + refine Fin.cases ?_ (fun i => ?_) j + · simp [HierarchyStageMissingColors] + · change TreeMissingColors phi (HB.stage i.succ.castSucc) = + TreeMissingColors phi (H.stage i.succ.castSucc) + rw [stageOrdNext i] + exact @helper_continuation_904 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) + (@good) (@B) (@hAB) (@hBT) (@segmentRefl) (@segmentTrans) (@stageSegment) (@lastZero) + (@lastPositive) (@lastToB) (@firstToB) (@strictFirst) (@mpB) (@hbStageOld) (@hbStageAt) + (@hbNested) (@hbStrict) (@stageOrdNext) (@starredEq) (@storedEq) (@beforeFirstMissing) + (@missingEq) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HasKEdgeColoring.lean b/LeanPool/GoldbergSeymour/HasKEdgeColoring.lean new file mode 100644 index 0000000000..e2d61042f9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HasKEdgeColoring.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IsFullEdgeColoring +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring + +/-! +# Has KEdge Coloring + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A proper full edge coloring using colors in `Fin k`. -/ +def HasKEdgeColoring {V E : Type*} (G : LooplessMultigraph V E) (k : ℕ) : Prop := + ∃ φ : PartialEdgeColoring E k, IsProperEdgeColoring G φ ∧ IsFullEdgeColoring φ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyBase.lean b/LeanPool/GoldbergSeymour/HierarchyBase.lean new file mode 100644 index 0000000000..708329b494 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyBase.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.OrderedTreeUnion + +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +/-! +# Hierarchy Base + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The core, closure and support position used to start a hierarchy for an extended tree. -/ +structure HierarchyBase {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (phi : PartialEdgeColoring E k) where + /-- The initial core tree of the hierarchy. -/ + core : TreeSequence G e0 + /-- The auxiliary closure used for a parallel-extension hierarchy base. -/ + closure : TreeSequence G e0 + /-- The position of the terminal extension support in the penultimate ladder tree. -/ + supportPosition : Fin ((ett.series.data.tree (Fin.last ett.rounds).castSucc).length + 1) + supportPositive : 1 ≤ supportPosition.val + terminalMissingColors : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + TreeMissingColors phi Tn = TreeMissingColors generating Tn + parallel : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + ett.series.data.kind n = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex n = some (Tn.vertex supportPosition) ∧ + TashkinovClosure phi + (TreeSequencePrefix Tn supportPosition.val supportPositive + (Nat.le_of_lt_succ supportPosition.isLt)) + closure ∧ + Nonempty (OrderedTreeUnion Tn closure core) + nonparallel : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + ett.series.data.kind n ≠ some TashkinovExtensionKind.PE → core = Tn + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyBaseCorrespondingTransport.lean b/LeanPool/GoldbergSeymour/HierarchyBaseCorrespondingTransport.lean new file mode 100644 index 0000000000..65f618134c --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyBaseCorrespondingTransport.lean @@ -0,0 +1,351 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyBase + +/-! +# Hierarchy Base Corresponding Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_chosenAgree_113.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ + DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) (T _ : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T phi) (replacementInput : PartialEdgeColoring E k) + (replacementSeries : TashkinovSeries G k ett.rounds e0 replacementInput), (∀ (i : Fin + (ett.rounds + (1 : ℕ))), replacementSeries.data.connectingEdges i = + ett.series.data.connectingEdges i) → let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt ett.roundsPositive) (Decidable.byContradiction fun (a : ¬(0 + : ℕ) < (1 : ℕ)) => by omega)⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + replacementSeries.data.kind (Fin.last ett.rounds) = ett.series.data.kind (Fin.last + ett.rounds) → (∀ (u v x y : V) (e : E), u ∈ TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) → v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) → x ∉ TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) → y ∉ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) → G.ends e = s(u, x) → G.ends e = + s(v, y) → u = v) → ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE → replacementSeries.data.chosenVertex (Fin.last ett.rounds) = + ett.series.data.chosenVertex (Fin.last ett.rounds) := by + classical + intro V E _ _ _ G k e0 input T U phi ett replacementInput replacementSeries + connectingEdgesAgree q hq hkindEq insideUnique hPE + have hkind : replacementSeries.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := hkindEq.trans hPE + have oldStep := ett.series.certified (Fin.last ett.rounds) + have newStep := replacementSeries.certified (Fin.last ett.rounds) + generalize oldIndex : Fin.last ett.rounds = oldTarget at oldStep + generalize newIndex : Fin.last ett.rounds = newTarget at newStep + cases oldStep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + rw [oldIndex] at hPE + rw [initialKind] at hPE + cases hPE + | SE oi previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [oldIndex] at hPE + rw [currentKind] at hPE + cases hPE + | RE oi previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [oldIndex] at hPE + rw [currentKind] at hPE + cases hPE + | PE oi previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting oldChoice seriesAlternativeFails + oldGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness oldColoring + oldProper oldOneUncolored oldStored oldEdges oldKind oldVertex + oldOutside oldDelta oldGamma2 closedExtension orderedExtension + strictExtension => + have hio : oi = q := by + apply Fin.ext + have hv := congrArg Fin.val oldIndex + simp [q] at hv ⊢ + omega + subst oi + cases newStep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + rw [newIndex] at hkind + rw [initialKind] at hkind + cases hkind + | SE ni previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [newIndex] at hkind + rw [currentKind] at hkind + cases hkind + | RE ni previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [newIndex] at hkind + rw [currentKind] at hkind + cases hkind + | PE ni previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting newChoice seriesAlternativeFails + newGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness newColoring + newProper newOneUncolored newStored newEdges newKind newVertex + newOutside newDelta newGamma2 closedExtension orderedExtension + strictExtension => + have hin : ni = q := by + apply Fin.ext + have hv := congrArg Fin.val newIndex + simp [q] at hv ⊢ + omega + subst ni + have hedge : newChoice.edge = oldChoice.edge := by + have he := connectingEdgesAgree (Fin.last ett.rounds) + rw [← hq] at he + rw [newEdges, oldEdges] at he + simpa using he + have hnew : newChoice.vertex ∈ TreeSequenceVertexSet + (replacementSeries.data.tree + (Fin.last ett.rounds).castSucc) := by + simpa [hq] using newChoice.vertexDefective.1 + have hold : oldChoice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + simpa [hq] using oldChoice.vertexDefective.1 + have hnewOutside : newChoice.otherEndpoint ∉ TreeSequenceVertexSet + (replacementSeries.data.tree + (Fin.last ett.rounds).castSucc) := by + simpa [hq] using newChoice.otherOutside + have holdOutside : oldChoice.otherEndpoint ∉ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + simpa [hq] using oldChoice.otherOutside + have hv := insideUnique newChoice.vertex oldChoice.vertex + newChoice.otherEndpoint oldChoice.otherEndpoint newChoice.edge + hnew hold hnewOutside holdOutside newChoice.edgeEnds + (hedge ▸ oldChoice.edgeEnds) + have hvertices := + newVertex.trans ((congrArg some hv).trans oldVertex.symm) + simpa [hq] using hvertices + +private theorem helper_branch_42.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T U : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi) + (base : HierarchyBase ett phi) (replacementInput : PartialEdgeColoring E k) + (replacementSeries : TashkinovSeries G k ett.rounds e0 replacementInput) + (finalGeneratingColoring : phi = replacementSeries.data.coloring (Fin.last ett.rounds)) + (ladderTreesAgree : + ∀ (i : Fin ett.rounds), replacementSeries.data.tree i.succ.castSucc = + ett.series.data.tree i.succ.castSucc) + (storedColorsAgree : ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeries.data.stored i = + ett.series.data.stored i) + (connectingEdgesAgree : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeries.data.connectingEdges i = + ett.series.data.connectingEdges i) + (extensionKindsAgree : ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeries.data.kind i = + ett.series.data.kind i) + (replacementProper : ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G + (replacementSeries.data.coloring i)) + (replacementOneUncolored : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (replacementSeries.data.coloring + i) e0) + (replacementStable : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors + ett.series.data i.succ) + (ett.series.data.coloring i.succ) (replacementSeries.data.coloring i.succ)) + (rounds : ℕ) (roundsPositive : (1 : ℕ) ≤ rounds) (replacementData : TashkinovSeries G k + rounds e0 replacementInput) + (above : + TreeSequenceInitialSegment + (replacementData.data.tree (⟨rounds, (by omega)⟩ : Fin + (rounds + (2 : ℕ)))) U) + (strict : + (replacementData.data.tree (⟨rounds, (by omega)⟩ : Fin (rounds + + (2 : ℕ)))).length < + U.length) + (below : TreeSequenceInitialSegment U (replacementData.data.tree (Fin.last (rounds + (1 : + ℕ))))) + (generating : phi = replacementData.data.coloring (Fin.last rounds)) + (rungAgreement : + { rounds := rounds, roundsPositive := roundsPositive, series := replacementData, + abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := + generating : + ExtendedTashkinovTree G k e0 replacementInput U phi }.rounds = + ett.rounds) + (seriesPresentation : + { rounds := rounds, roundsPositive := roundsPositive, series := replacementData, + abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := + generating : + ExtendedTashkinovTree G k e0 replacementInput U phi }.series ≍ + replacementSeries), + ∃ (replacementBase : + HierarchyBase + { replacementInput := replacementInput, replacementSeries := replacementSeries, + replacementETT := + { rounds := rounds, roundsPositive := roundsPositive, series := replacementData, + abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := + generating : + ExtendedTashkinovTree G k e0 replacementInput U phi }, + rungAgreement := rungAgreement, seriesPresentation := seriesPresentation, + finalGeneratingColoring := finalGeneratingColoring, ladderTreesAgree := + ladderTreesAgree, + storedColorsAgree := storedColorsAgree, connectingEdgesAgree := connectingEdgesAgree, + extensionKindsAgree := extensionKindsAgree, replacementProper := replacementProper, + replacementOneUncolored := replacementOneUncolored, replacementStable := + replacementStable : + CorrespondingExtendedTashkinovTree G k e0 ett phi U }.replacementETT + phi), + replacementBase.core = base.core ∧ + replacementBase.closure = base.closure ∧ (↑replacementBase.supportPosition : ℕ) = + (↑base.supportPosition : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T U phi ett base replacementInput replacementSeries + finalGeneratingColoring ladderTreesAgree storedColorsAgree connectingEdgesAgree + extensionKindsAgree replacementProper replacementOneUncolored replacementStable rounds + roundsPositive replacementData above strict below generating rungAgreement seriesPresentation + cases rungAgreement + have seriesSame : replacementData = replacementSeries := + eq_of_heq seriesPresentation + cases seriesSame + let q : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt ett.roundsPositive) (by omega)⟩ + have hq : q.succ = Fin.last ett.rounds := by + apply Fin.ext + exact Nat.sub_add_cancel ett.roundsPositive + have hfinal : replacementSeries.data.tree + (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rw [← hq] + exact ladderTreesAgree q + have hkindEq : replacementSeries.data.kind (Fin.last ett.rounds) = + ett.series.data.kind (Fin.last ett.rounds) := + extensionKindsAgree (Fin.last ett.rounds) + have insideUnique : ∀ (u v x y : V) (e : E), + u ∈ TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) → + v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) → + x ∉ TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) → + y ∉ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) → + G.ends e = s(u, x) → G.ends e = s(v, y) → u = v := by + intro u v x y e hu hv hx hy he₁ he₂ + rcases (Sym2.eq_iff.mp (he₁.symm.trans he₂)) with h | h + · exact h.1 + · have hv' := hv + rw [← hfinal] at hv' + exact False.elim (hx (h.2 ▸ hv')) + have chosenAgree := @helper_chosenAgree_113 V E inferInstance inferInstance inferInstance G k e0 + input T U phi ett replacementInput replacementSeries connectingEdgesAgree hq hkindEq + insideUnique + have transportVertex : ∀ (A B : TreeSequence G e0), ∀ (h : A = B), + ∀ i : Fin (B.length + 1), + A.vertex (Fin.cast (congrArg + (fun W : TreeSequence G e0 => W.length + 1) h.symm) i) = + B.vertex i := by + intro A B h i + cases h + rfl + let pos : Fin ((replacementSeries.data.tree + (Fin.last ett.rounds).castSucc).length + 1) := + Fin.cast (congrArg (fun W : TreeSequence G e0 => W.length + 1) + hfinal.symm) base.supportPosition + let replacementBase : HierarchyBase + { rounds := ett.rounds + roundsPositive := roundsPositive + series := replacementSeries + abovePenultimate := above + strictAbovePenultimate := strict + belowFinal := below + generatingColoring := generating } phi := + { core := base.core + closure := base.closure + supportPosition := pos + supportPositive := by simpa [pos] using base.supportPositive + terminalMissingColors := by rfl + parallel := by + dsimp + intro hp + have hp' : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := hkindEq.symm.trans hp + have hb := base.parallel hp' + refine ⟨?_, ?_, ?_⟩ + · have hvertex : + (replacementSeries.data.tree + (Fin.last ett.rounds).castSucc).vertex pos = + (ett.series.data.tree + (Fin.last ett.rounds).castSucc).vertex + base.supportPosition := by + exact transportVertex _ _ hfinal base.supportPosition + rw [chosenAgree hp'] + rw [hvertex] + exact hb.1 + · simpa [pos, hfinal] using hb.2.1 + · simpa [hfinal] using hb.2.2 + nonparallel := by + dsimp + intro hp + have hp' : ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE := by + intro h + exact hp (hkindEq.trans h) + exact (base.nonparallel hp').trans hfinal.symm } + exact ⟨replacementBase, rfl, rfl, by simp [replacementBase, pos]⟩ + +lemma HierarchyBaseCorrespondingTransport + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T U : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (base : HierarchyBase ett phi) : + exists replacementBase : HierarchyBase corr.replacementETT phi, + replacementBase.core = base.core /\ + replacementBase.closure = base.closure /\ + replacementBase.supportPosition.val = base.supportPosition.val := by + classical + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + exact @helper_branch_42 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T U phi ett base replacementInput replacementSeries finalGeneratingColoring + ladderTreesAgree storedColorsAgree connectingEdgesAgree extensionKindsAgree + replacementProper replacementOneUncolored replacementStable rounds roundsPositive + replacementData above strict below generating rungAgreement seriesPresentation +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyBaseExists.lean b/LeanPool/GoldbergSeymour/HierarchyBaseExists.lean new file mode 100644 index 0000000000..7a66b6c65d --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyBaseExists.lean @@ -0,0 +1,275 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyBase + +public import LeanPool.GoldbergSeymour.OrderedTreeUnionExists +public import LeanPool.GoldbergSeymour.TashkinovClosureExists + +/-! +# Hierarchy Base Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_59.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : Fin (ett.rounds + (1 : ℕ)) := n; + ∀ (i : Fin ett.rounds), ett.series.data.kind i.succ = some TashkinovExtensionKind.SE → n = + i.succ → Nonempty (HierarchyBase ett generating) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett n j i currentKind hj + let Tn := ett.series.data.tree n.castSucc + have hi : i.succ = n := by simpa [j] using hj.symm + have htree : ett.series.data.tree i.succ.castSucc = Tn := by + simp [Tn, hi] + have hlen : 1 ≤ Tn.length := by + rw [← htree] + exact (ett.series.data.tree i.succ.castSucc).positive + let support : Fin (Tn.length + 1) := ⟨1, by omega⟩ + refine ⟨{ + core := Tn + closure := Tn + supportPosition := support + supportPositive := by dsimp [support]; omega + terminalMissingColors := by simp [ett.generatingColoring] + parallel := by + dsimp [Tn, n] + intro h + have hh : ett.series.data.kind i.succ = some TashkinovExtensionKind.PE := by + simpa [hi] using h + rw [currentKind] at hh + cases hh + nonparallel := by + dsimp [Tn, n] + intro h + rfl }⟩ + +private theorem helper_branch_89.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : Fin (ett.rounds + (1 : ℕ)) := n; + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)), ett.series.data.kind i.succ = some + TashkinovExtensionKind.PE → ett.series.data.chosenVertex i.succ = some choice.vertex → n = + i.succ → Nonempty (HierarchyBase ett generating) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett n j i choice currentKind currentVertex hj + let Tn := ett.series.data.tree n.castSucc + have hi : i.succ = n := by simpa [j] using hj.symm + have htree : ett.series.data.tree i.succ.castSucc = Tn := by + simp [Tn, hi] + rcases choice.edgeDefective with ⟨alpha, alphaDefective, edgeMem⟩ + have cardLarge : 1 < (BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) alpha).card := by + have hc : 2 ≤ (BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) alpha).card := by + simpa [DefectiveColor] using alphaDefective + omega + obtain ⟨otherEdge, otherMem, otherNe⟩ := + Finset.exists_mem_ne cardLarge choice.edge + have boundaryOther : ∃ w ∈ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc), ∃ z ∉ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc), G.ends otherEdge = s(w, z) := by + have hm : (∃ u ∈ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc), ∃ v ∉ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc), G.ends otherEdge = s(u, v)) ∧ + choice.selected otherEdge = some alpha := by + simpa [BoundaryColorEdges, BoundaryEdges] using otherMem + exact hm.1 + obtain ⟨w, wInside, z, zOutside, otherEnds⟩ := boundaryOther + have wDefective : DefectiveVertex G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) w := by + refine ⟨wInside, otherEdge, ?_, ?_⟩ + · exact ⟨alpha, alphaDefective, otherMem⟩ + · unfold Incident + rw [otherEnds] + exact Sym2.mem_iff.mpr (Or.inl rfl) + have orderChoice := choice.maximal choice.selected w choice.selectedProper + choice.selectedOneUncolored choice.selectedStable wDefective + have wne : w ≠ choice.vertex := by + intro equal + subst w + have edgeIncidentOther : Incident G choice.vertex otherEdge := by + unfold Incident + rw [otherEnds] + exact Sym2.mem_iff.mpr (Or.inl rfl) + have adjacent : AdjacentEdges G choice.edge otherEdge := + ⟨choice.vertex, choice.edgeIncident, edgeIncidentOther⟩ + have otherColor : choice.selected otherEdge = some alpha := by + have hm : (∃ u ∈ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc), ∃ v ∉ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc), G.ends otherEdge = s(u, v)) ∧ + choice.selected otherEdge = some alpha := by + simpa [BoundaryColorEdges, BoundaryEdges] using otherMem + exact hm.2 + have edgeAlpha : choice.selected choice.edge = some alpha := by + have hm : (∃ u ∈ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc), ∃ v ∉ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc), G.ends choice.edge = s(u, v)) ∧ + choice.selected choice.edge = some alpha := by + simpa [BoundaryColorEdges, BoundaryEdges] using edgeMem + exact hm.2 + have alphaChoice : alpha = choice.color := by + simpa [choice.edgeColor] using edgeAlpha.symm + rw [alphaChoice] at otherColor + exact (choice.selectedProper otherNe.symm adjacent choice.edgeColor) + otherColor + have orderStrict : TreeVertexOrder + (ett.series.data.tree i.succ.castSucc) w choice.vertex := by + rcases orderChoice with equal | order + · exact (wne equal).elim + · exact order + rcases orderStrict with ⟨r, s, hr, hs, hrs⟩ + have supportPositive : 1 ≤ s.val := by omega + have supportLe : s.val ≤ Tn.length := by + have hl := congrArg TreeSequence.length htree + omega + have hlen : (ett.series.data.tree i.succ.castSucc).length = Tn.length := + congrArg TreeSequence.length htree + let support : Fin (Tn.length + 1) := + Fin.cast (congrArg (fun q => q + 1) hlen) s + have castVertexValue : ∀ (A B : TreeSequence G e0) (h : A = B) + (x : Fin (A.length + 1)), + (cast (congrArg (fun q => Fin (q.length + 1)) h) x).val = x.val := by + intro A B h x + cases h + rfl + have chosenAt : choice.vertex = Tn.vertex support := by + have hv : HEq (Tn.vertex support) + ((ett.series.data.tree i.succ.castSucc).vertex s) := by + congr + · exact htree.symm + · dsimp [support] + apply heq_of_cast_eq (congrArg (fun q => Fin (q.length + 1)) htree.symm) + apply Fin.ext + have hsfin : Fin.cast (congrArg (fun q => q + 1) hlen) s = + ⟨s.val, by omega⟩ := by + apply Fin.ext + rfl + rw [hsfin] + exact castVertexValue _ _ htree.symm _ + exact hs.symm.trans (eq_of_heq hv).symm + obtain ⟨closure, closureCert⟩ := TashkinovClosureExists generating + (TreeSequencePrefix Tn support.val supportPositive (by omega)) + obtain ⟨core, unionCert⟩ := OrderedTreeUnionExists Tn closure + refine ⟨{ + core := core + closure := closure + supportPosition := support + supportPositive := supportPositive + terminalMissingColors := by simp [ett.generatingColoring] + parallel := by + dsimp [Tn, n] + intro h + refine ⟨?_, ?_, unionCert⟩ + · simpa [n, hi, chosenAt] using currentVertex + · exact closureCert + nonparallel := by + dsimp [Tn, n] + intro h + have hh : ett.series.data.kind i.succ = some TashkinovExtensionKind.PE := by + simpa [n, hi] using currentKind + exact (h (by simpa [n, hi] using hh)).elim }⟩ + +private theorem helper_branch_212.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : Fin (ett.rounds + (1 : ℕ)) := n; + ∀ (i : Fin ett.rounds), ett.series.data.kind i.succ = some TashkinovExtensionKind.RE → n = + i.succ → Nonempty (HierarchyBase ett generating) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett n j i currentKind hj + let Tn := ett.series.data.tree n.castSucc + have hi : i.succ = n := by simpa [j] using hj.symm + have htree : ett.series.data.tree i.succ.castSucc = Tn := by + simp [Tn, hi] + have hpos : 1 ≤ Tn.length := by + rw [← htree] + exact (ett.series.data.tree i.succ.castSucc).positive + let support : Fin (Tn.length + 1) := ⟨1, by omega⟩ + refine ⟨{ + core := Tn + closure := Tn + supportPosition := support + supportPositive := by dsimp [support]; omega + terminalMissingColors := by simp [ett.generatingColoring] + parallel := by + dsimp [Tn, n] + intro h + have hh : ett.series.data.kind i.succ = some TashkinovExtensionKind.PE := by + simpa [hi] using h + rw [currentKind] at hh + cases hh + nonparallel := by + dsimp [Tn, n] + intro h + rfl }⟩ + +theorem HierarchyBaseExists + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) : + Nonempty (HierarchyBase ett generating) := by + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + have cert := ett.series.certified n + let j : Fin (ett.rounds + 1) := n + generalize hj : n = j at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + have hn : n = 0 := by simp [hj] + have hne : n ≠ 0 := by + intro h + have hv : ett.rounds = 0 := by + simpa [n] using congrArg Fin.val h + have hp := ett.roundsPositive + omega + exact (hne hn).elim + | SE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + exact @helper_branch_59 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating ett i currentKind hj + | PE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + exact @helper_branch_89 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating ett i choice currentKind currentVertex hj + | RE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + available currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + exact @helper_branch_212 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T generating ett i currentKind hj +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyCaseThreePreparation.lean b/LeanPool/GoldbergSeymour/HierarchyCaseThreePreparation.lean new file mode 100644 index 0000000000..031c16cb01 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyCaseThreePreparation.lean @@ -0,0 +1,1631 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalizedData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCommonTailData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoOutsidePenultimateReconstruction +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.NineN +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.NormalizedDatum +public import Mathlib.Data.Finset.Option +public import LeanPool.GoldbergSeymour.TashkinovAlternatingSegmentAppend +public import LeanPool.GoldbergSeymour.TwoColorComponentNearestSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.MinimumContextTransport +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges + +/-! +# Preparatory lemmas for hierarchy case-three normalization + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev HierarchyCaseThreePreparation.helperContinuation547Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + let tailUsed : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c} : Finset (Fin k)); + ∀ beta ∈ TreeMissingColors phi B, ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → (0 : ℕ) < + H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma ∨ H.dividerCount = (0 : ℕ) ∧ beta ∉ Dn ∧ beta ∉ + Gamma ∨ beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed → + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); + let Q : Set (V ⊕ E) := TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)); beta ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) → ( + ∃ v ∈ TreeSequenceVertexSet Bplus, Sum.inl v ∈ Q) → B.length = T.length - (2 : ℕ) → + Bplus.length = T.length - (1 : ℕ) → TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment Bplus T → TreeSequenceInitialSegment B Bplus → + (↑D.earlierVertexIndex : ℕ) < B.length + (1 : ℕ) → beta ∈ TreeMissingColors phi Bplus → + D.alpha ∈ TreeMissingColors phi Bplus → D.alpha ≠ beta → T.vertex D.terminalVertexIndex ∉ + TreeSequenceVertexSet Bplus → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U W + → S.length ≤ U.length → TreeSequenceInitialSegment S U) → ( + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S U → S.length = U.length → S = U) → ( + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))) → ( H.dividerCount ≠ (0 : ℕ) → A = H.stage q.castSucc) → + TreeSequenceInitialSegment A T → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Nonempty + (HierarchySituationTwoCaseThreeNormalizedData G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext) + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev HierarchyCaseThreePreparation.helperContinuation647Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + let tailUsed : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c} : Finset (Fin k)); + ∀ beta ∈ TreeMissingColors phi B, ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → (0 : ℕ) < + H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma ∨ H.dividerCount = (0 : ℕ) ∧ beta ∉ Dn ∧ beta ∉ + Gamma ∨ beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed → + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); + let Q : Set (V ⊕ E) := TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)); beta ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) → + B.length = T.length - (2 : ℕ) → Bplus.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment B Bplus → (↑D.earlierVertexIndex : ℕ) < B.length + (1 : ℕ) → + beta ∈ TreeMissingColors phi Bplus → D.alpha ∈ TreeMissingColors phi Bplus → D.alpha ≠ + beta → T.vertex D.terminalVertexIndex ∉ TreeSequenceVertexSet Bplus → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) → ( + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S U → S.length = U.length → S = U) → ( + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a_1 : ¬a < + H.dividerCount + (2 : ℕ)) ↦ + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a_1 : ¬a + d < + H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))) → ( H.dividerCount ≠ (0 : ℕ) → A = H.stage q.castSucc) → + TreeSequenceInitialSegment A T → TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment Tn A → D.alpha ∈ TreeMissingColors phi B → + ∀ (m : ℕ), (1 : ℕ) ≤ m → + ∀ (pv : Fin (m + (1 : ℕ)) → V), + let R : TreeSequence G e0 := if pv (0 : Fin (m + (1 : ℕ))) = T.vertex D.penultimateVertexIndex + then Bplus else B; TreeSequenceInitialSegment B R → TreeSequenceInitialSegment R T → + ∀ (Utree : TreeSequence G e0), TreeSequenceInitialSegment R Utree → Utree.length = R.length + + m → R.length < Utree.length → ( + ∀ (r : Fin Utree.length), R.length ≤ (↑r : ℕ) → Utree.vertex r.succ ∉ TreeSequenceVertexSet R + ∧ Sum.inr (Utree.edge r) ∈ TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)) ∧ Sum.inl (Utree.vertex r.succ) ∈ TwoColorComponent G phi D.alpha + beta (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ (phi (Utree.edge r) = some D.alpha ∨ phi + (Utree.edge r) = some beta) ∧ G.ends (Utree.edge r) = if (↑r : ℕ) = R.length then s(pv (0 + : Fin (m + (1 : ℕ))), Utree.vertex r.succ) else s(Utree.vertex r.castSucc, Utree.vertex + r.succ)) → TreeSequenceInitialSegment B Utree → TreeSequenceInitialSegment A Utree → + TreeSequenceInitialSegment Tn Utree → Tn.length < Utree.length → Utree.vertex (Fin.last + Utree.length) = T.vertex D.terminalVertexIndex → ModColoring ett phi → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn Utree ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed Utree) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Nonempty + (HierarchySituationTwoCaseThreeNormalizedData G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext) + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev HierarchyCaseThreePreparation.helperCaseContinuation1264Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + let tailUsed : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c} : Finset (Fin k)); + ∀ beta ∈ TreeMissingColors phi B, ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → (0 : ℕ) < + H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma ∨ H.dividerCount = (0 : ℕ) ∧ beta ∉ Dn ∧ beta ∉ + Gamma ∨ beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed → + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); + let Q : Set (V ⊕ E) := TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)); B.length = T.length - (2 : ℕ) → Bplus.length = T.length - (1 : ℕ) + → TreeSequenceInitialSegment B T → TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment B Bplus → beta ∈ TreeMissingColors phi Bplus → D.alpha ∈ + TreeMissingColors phi Bplus → D.alpha ≠ beta → T.vertex D.terminalVertexIndex ∉ + TreeSequenceVertexSet Bplus → ( H.dividerCount ≠ (0 : ℕ) → A = H.stage q.castSucc) → + TreeSequenceInitialSegment A T → D.alpha ∈ Gamma → D.alpha ∉ tailUsed → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) → (0 : ℕ) < H.dividerCount + ∧ D.alpha ∈ TreeMissingColors phi (H.stage q.castSucc) ∨ H.dividerCount = (0 : ℕ) ∧ + D.alpha ∈ TreeMissingColors phi Tn → (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ + B.length → + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let _ : V := T.vertex D.terminalVertexIndex; D.alpha ∈ MissingColors G phi va → beta ∈ + MissingColors G phi vb → T.vertex (HierarchyFirstMissingPosition phi T D.alpha) ∈ + TreeSequenceVertexSet Bplus → T.vertex (HierarchyFirstMissingPosition phi T beta) ∈ + TreeSequenceVertexSet Bplus → TwoColorComponent G phi D.alpha beta (Sum.inl va) = + TwoColorComponent G phi D.alpha beta (Sum.inl vb) → + let graph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi D.alpha beta; ( + ∀ (v : V), D.alpha ∈ MissingColors G phi v ∨ beta ∈ MissingColors G phi v → (graph.neighborSet + (Sum.inl v)).Subsingleton) → Disjoint Q (TwoColorComponent G phi D.alpha beta (Sum.inl + va)) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Nonempty + (HierarchySituationTwoCaseThreeNormalizedData G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext) + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev HierarchyCaseThreePreparation.helperBranch1551Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + let tailUsed : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c} : Finset (Fin k)); + ∀ beta ∈ TreeMissingColors phi B, ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → (0 : ℕ) < + H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma ∨ H.dividerCount = (0 : ℕ) ∧ beta ∉ Dn ∧ beta ∉ + Gamma ∨ beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed → + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); + let _ : Set (V ⊕ E) := TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)); beta ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) → + B.length = T.length - (2 : ℕ) → Bplus.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment B Bplus → beta ∈ TreeMissingColors phi Bplus → D.alpha ∈ + TreeMissingColors phi Bplus → D.alpha ≠ beta → T.vertex D.terminalVertexIndex ∉ + TreeSequenceVertexSet Bplus → ( H.dividerCount ≠ (0 : ℕ) → A = H.stage q.castSucc) → + TreeSequenceInitialSegment A T → TreeSequenceInitialSegment Tn A → D.alpha ∈ + TreeMissingColors phi B → + ∀ (m : ℕ), (1 : ℕ) ≤ m → ( + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))), c ∈ MissingColors G phi + (S.vertex i) → (↑(HierarchyFirstMissingPosition phi S c) : ℕ) ≤ (↑i : ℕ)) → ( + ∀ (c : Fin k), (↑(HierarchyFirstMissingPosition phi T c) : ℕ) < T.length → c ∈ MissingColors G + phi (T.vertex (HierarchyFirstMissingPosition phi T c))) → D.alpha ∈ Gamma → D.alpha ∉ + tailUsed → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Nonempty + (HierarchySituationTwoCaseThreeNormalizedData G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext) + +/-- The dependent type of the shared hierarchy constructor. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev hierarchyExtensionConstructorType.{u_1, u_2} (V : Type u_1) (E : Type u_2) := + open scoped Classical in + + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base + C ctx → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := + ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (ell - (2 : ℕ)); + B.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment B T → + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + ( + ∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + S.length = U.length → + S = U) → + (m : ℕ) → + ( + Fin (m + (1 : ℕ)) → + V) → + (Utree : TreeSequence G e0) → + TreeSequenceInitialSegment B Utree → + TreeSequenceInitialSegment A Utree → + (corrU : + CorrespondingExtendedTashkinovTree G k + e0 ett phi Utree) → + (baseU : + HierarchyBase corrU.replacementETT + phi) → + baseU.core = base.core → + corrU.replacementETT.series.data.tree + (Fin.last + corrU.replacementETT.rounds).castSucc = + Tn ∧ + corrU.replacementETT.series.data.kind + (Fin.last + corrU.replacementETT.rounds) = + ett.series.data.kind n → + ( + ∀ + (j : + Fin + (H.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (H.stage j.castSucc) A) → + A.length < Utree.length → + let newStage : + Fin + (H.dividerCount + + (2 : ℕ)) → + TreeSequence G e0 := + fun + (j : + Fin + (H.dividerCount + + (2 : ℕ))) ↦ + if + (↑j : ℕ) = + H.dividerCount + + (1 : ℕ) then + Utree + else H.stage j; + ( + ∀ + (j : + Fin + (H.dividerCount + + (1 : ℕ))), + newStage j.castSucc = + H.stage j.castSucc) → + newStage + (Fin.last + (H.dividerCount + + (1 : ℕ))) = + Utree → + ( + ∀ + (j : + Fin + (H.dividerCount + + (2 : ℕ))), + (↑j : ℕ) ≤ + H.dividerCount → + newStage j = + H.stage j) → + ( + ∀ + (i : + Fin + H.dividerCount), + (↑(H.dividerPosition + i) : + ℕ) ≤ + B.length) → + TashkinovHierarchy + corrU.replacementETT + baseU + +/-- Color-choice contract for the case-three hierarchy preparation. + +Shared separately from its proof to avoid repeating dependent hypotheses. +-/ +abbrev hierarchyCaseThreeColorChoiceStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; + let U : Finset (Fin k) := {c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi + (T.edge r) = some c}; + let _ : Finset (Fin k) := (TreeMissingColors phi B \ M0) \ U; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + let tailUsed : Finset (Fin k) := {c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c}; + ∃ beta ∈ TreeMissingColors phi B, ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) ∧ ((0 : ℕ) < + H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma ∨ H.dividerCount = (0 : ℕ) ∧ beta ∉ Dn ∧ beta ∉ + Gamma ∨ beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed) + +theorem HierarchyCaseThreePreparation.helper_hchoice_125.{u_1, u_2} : + hierarchyCaseThreeColorChoiceStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B M0 U X Dn Dnq Gamma + tailUsed + let Tn := ett.series.data.tree n.castSucc + let M0 := (TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet Tn).biUnion fun v => MissingColors G phi v + let U := (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, A.length ≤ r.val ∧ + r.val < A.length + (ell - 2) ∧ phi (T.edge r) = some c + let X := (TreeMissingColors phi B \ M0) \ U + have hell : 2 ≤ ell := D.tailAtLeastTwo + have hT : 2 ≤ T.length := le_trans hell (Nat.sub_le _ _) + let t1 : Fin T.length := ⟨T.length - 2, by omega⟩ + let t2 : Fin T.length := ⟨T.length - 1, by omega⟩ + let L := (phi (T.edge t1)).toFinset ∪ (phi (T.edge t2)).toFinset + have hLcard : L.card ≤ 2 := by + have h1 : (phi (T.edge t1)).toFinset.card ≤ 1 := by + cases phi (T.edge t1) <;> simp + have h2 : (phi (T.edge t2)).toFinset.card ≤ 1 := by + cases phi (T.edge t2) <;> simp + have h := Finset.card_union_le (phi (T.edge t1)).toFinset + (phi (T.edge t2)).toFinset + change L.card ≤ _ at h + omega + have hcut : A.length + (ell - 2) = T.length - 2 := by + dsimp [ell] at hell ⊢ + omega + have hused : tailUsed ⊆ U ∪ L := by + intro c hc + obtain ⟨t, hAt, ht⟩ := (Finset.mem_filter.mp hc).2 + by_cases hsmall : t.val < T.length - 2 + · apply Finset.mem_union_left + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hAt, + hcut ▸ hsmall, ht⟩ + · apply Finset.mem_union_right + have hindices : t = t1 ∨ t = t2 := by + have hv : t.val = T.length - 2 ∨ t.val = T.length - 1 := by omega + rcases hv with hv | hv + · exact Or.inl (Fin.ext hv) + · exact Or.inr (Fin.ext hv) + rcases hindices with rfl | rfl + · exact Finset.mem_union_left _ (by simp [ht]) + · exact Finset.mem_union_right _ (by simp [ht]) + have hunusedTail (c : Fin k) (hU : c ∉ U) (hL : c ∉ L) : + ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some c := by + intro t hAt ht + have hc : c ∈ tailUsed := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, t, hAt, ht⟩ + rcases Finset.mem_union.mp (hused hc) with hc | hc + · exact hU hc + · exact hL hc + have hprefix : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyFullTailPrefix C (ell - 1))) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 input T phi + ett base C ctx.proper ctx.oneEdgeUncolored ctx.lowerRung + ctx.fewerDividers ctx.lexicographicMinimality ctx.largeMissingSet + have hnine := NineN G k e0 input T phi ett C.positive base H C.good + hprefix ctx.largeMissingSet (ell - 2) + (show ell - 2 < ell from by omega) + change 2 * ett.rounds + 11 ≤ X.card ∧ + ((X \ (Gamma ∪ Dnq)).card ≤ 4 → + ∃ eta : Fin 7 → Fin k, Function.Injective eta ∧ + ∀ h : Fin 7, eta h ∈ Dnq ∧ eta h ∈ TreeMissingColors phi B ∧ + Disjoint (C.good.gamma q (eta h) ∪ {eta h}) U) at hnine + by_cases hsmall : (X \ (Gamma ∪ Dnq)).card ≤ 4 + · obtain ⟨eta, hinj, heta⟩ := hnine.2 hsmall + let block := fun h : Fin 7 => C.good.gamma q (eta h) ∪ {eta h} + have hreserved : Disjoint Gamma Dnq := + (GoodHierarchyReservedDisjoint C.good q).2 + have hblocks : ∀ i j : Fin 7, i ≠ j → Disjoint (block i) (block j) := by + intro i j hij + have hne : eta i ≠ eta j := fun he => hij (hinj he) + rw [Finset.disjoint_left] + intro c hc hd + simp only [block, Finset.mem_union, Finset.mem_singleton] at hc hd + rcases hc with hc | hc <;> rcases hd with hd | hd + · exact Finset.disjoint_left.mp + (C.good.disjointPairs q _ _ (heta i).1 (heta j).1 hne) hc hd + · exact Finset.disjoint_left.mp hreserved + (Finset.mem_biUnion.mpr ⟨eta i, (heta i).1, hc⟩) + (hd.symm ▸ (heta j).1) + · exact Finset.disjoint_left.mp hreserved + (Finset.mem_biUnion.mpr ⟨eta j, (heta j).1, hd⟩) + (hc.symm ▸ (heta i).1) + · exact hne (hc.symm.trans hd) + let bad := (Finset.univ : Finset (Fin 7)).filter fun h => + (block h ∩ L).Nonempty + have hbad : bad.card ≤ L.card := by + have chooseColor (h : {h : Fin 7 // h ∈ bad}) : + ∃ c, c ∈ block h.val ∧ c ∈ L := by + obtain ⟨c, hc⟩ := (Finset.mem_filter.mp h.property).2 + exact ⟨c, (Finset.mem_inter.mp hc).1, (Finset.mem_inter.mp hc).2⟩ + let color : {h : Fin 7 // h ∈ bad} → {c : Fin k // c ∈ L} := + fun h => ⟨Classical.choose (chooseColor h), + (Classical.choose_spec (chooseColor h)).2⟩ + have hcolor : Function.Injective color := by + intro i j heq + apply Subtype.ext + by_contra hne + have hc := congrArg Subtype.val heq + change Classical.choose (chooseColor i) = + Classical.choose (chooseColor j) at hc + exact Finset.disjoint_left.mp (hblocks i.val j.val hne) + (Classical.choose_spec (chooseColor i)).1 + (hc.symm ▸ (Classical.choose_spec (chooseColor j)).1) + simpa only [Fintype.card_coe] using + Fintype.card_le_of_injective color hcolor + have hgood : ((Finset.univ : Finset (Fin 7)) \ bad).Nonempty := by + apply Finset.card_pos.mp + have h := Finset.le_card_sdiff bad (Finset.univ : Finset (Fin 7)) + simp only [Finset.card_univ, Fintype.card_fin] at h + omega + obtain ⟨h, hh⟩ := hgood + have hnotBad := (Finset.mem_sdiff.mp hh).2 + have hL : Disjoint (block h) L := by + rw [Finset.disjoint_left] + intro c hc hl + exact hnotBad (Finset.mem_filter.mpr + ⟨Finset.mem_univ _, c, Finset.mem_inter.mpr ⟨hc, hl⟩⟩) + have hfull : Disjoint (block h) tailUsed := by + rw [Finset.disjoint_left] + intro c hc ht + rcases Finset.mem_union.mp (hused ht) with hu | hl + · exact Finset.disjoint_left.mp (heta h).2.2 hc hu + · exact Finset.disjoint_left.mp hL hc hl + refine ⟨eta h, (heta h).2.1, ?_, Or.inr (Or.inr ⟨(heta h).1, ?_⟩)⟩ + · intro t hAt ht + exact Finset.disjoint_left.mp hfull + (Finset.mem_union_right _ (Finset.mem_singleton_self _)) + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hAt, ht⟩) + · exact hfull.mono_left Finset.subset_union_left + · have hnonempty : ((X \ (Gamma ∪ Dnq)) \ L).Nonempty := by + apply Finset.card_pos.mp + have h := Finset.le_card_sdiff L (X \ (Gamma ∪ Dnq)) + omega + obtain ⟨beta, hbeta⟩ := hnonempty + obtain ⟨havailable, hL⟩ := Finset.mem_sdiff.mp hbeta + obtain ⟨hx, hexcluded⟩ := Finset.mem_sdiff.mp havailable + obtain ⟨hx, hU⟩ := Finset.mem_sdiff.mp hx + obtain ⟨hmissing, hM0⟩ := Finset.mem_sdiff.mp hx + have hGamma : beta ∉ Gamma := fun h => + hexcluded (Finset.mem_union_left _ h) + have hDnq : beta ∉ Dnq := fun h => + hexcluded (Finset.mem_union_right _ h) + refine ⟨beta, hmissing, hunusedTail beta hU hL, ?_⟩ + by_cases hzero : H.dividerCount = 0 + · refine Or.inr (Or.inl ⟨hzero, ?_, hGamma⟩) + intro hDn + have hnotMissingTn : beta ∉ TreeMissingColors phi Tn := by + have hn : n.val ≠ 0 := by dsimp [n]; exact Nat.ne_of_gt C.positive + have hd := hDn + dsimp only [Dn, TashkinovStoredColors] at hd + rw [ite_eq_right hn] at hd + have habsent := (Finset.mem_sdiff.mp hd).2 + have hcolor : ett.series.data.coloring n = phi := + ett.generatingColoring.symm + rw [hcolor] at habsent + exact habsent + have hmissingA : beta ∈ TreeMissingColors phi A := by + by_contra habsent + exact hDnq (Finset.mem_sdiff.mpr ⟨hDn, habsent⟩) + have hA : A = base.core := by + have hq : q = 0 := by apply Fin.ext; simp [q, hzero] + simp [A, HierarchyStarredStage, hq] + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hmissingA + by_cases hvn : v ∈ TreeSequenceVertexSet Tn + · exact hnotMissingTn (Finset.mem_biUnion.mpr ⟨v, hvn, hm⟩) + · apply hM0 + exact Finset.mem_biUnion.mpr + ⟨v, Finset.mem_sdiff.mpr ⟨hA ▸ hv, hvn⟩, hm⟩ + · exact Or.inl ⟨Nat.pos_of_ne_zero hzero, hDnq, hGamma⟩ + +theorem HierarchyCaseThreePreparation.helper_branch_304.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + let tailUsed : Finset (Fin k) := {c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c}; + ∀ beta ∈ TreeMissingColors phi B, ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → (0 : ℕ) < + H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma ∨ H.dividerCount = (0 : ℕ) ∧ beta ∉ Dn ∧ beta ∉ + Gamma ∨ beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed → beta ∈ MissingColors G phi + (T.vertex D.terminalVertexIndex) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Nonempty + (HierarchySituationTwoCaseThreeNormalizedData G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n A ell B Dn Dnq Gamma tailUsed beta + hmissing hunused halternative hterminal + have hvalid : ∀ i : Fin (ett.rounds + 1), + IsProperEdgeColoring G (ett.series.data.coloring i) ∧ + IsOneEdgeUncolored (ett.series.data.coloring i) e0 := by + intro i + have hs := ett.series.certified i + cases hs with + | initial triple _ hcolor => + rw [hcolor] + exact triple.2.2.2 + | SE i _ _ _ _ _ choice _ hcolor => + rw [hcolor] + exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ + | PE i _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hp hone => + exact ⟨hp, hone⟩ + | RE i hp hone _ _ _ hcolor => + rw [hcolor] + exact ⟨hp, hone⟩ + let corr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := { + replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := fun i => (hvalid i).1 + replacementOneUncolored := fun i => (hvalid i).2 + replacementStable := by intro i; simp [StableColoring] } + let P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := { + coloring := phi + corresponding := corr + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun j => ⟨rfl, fun eta heta => rfl⟩⟩ + minimumContext := ctx } + obtain ⟨N, hN⟩ := P2752_T2_NormalizedDatum G k e0 input T phi ett base C ctx D + beta hmissing hunused halternative P (fun _ => rfl) + ⟨fun _ _ => rfl, fun _ _ => rfl⟩ hterminal + exact ⟨P, ⟨N⟩⟩ + +/-- Typed data construction shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev HierarchyCaseThreePreparation.helperK553.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2}, + hierarchyExtensionConstructorType V E := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B hlenB hBT segTrans + equalTrees m pv Utree hBU hAU corrU baseU hcoreU terminalData ordinaryToA hAUstrict + newStage stageOld stageLast stageAt divBound + exact { + dividerCount := H.dividerCount + stage := newStage + baseStage := by + rw [show newStage 0 = H.stage 0 by simp [newStage], H.baseStage] + exact terminalData.1.symm + terminalStage := stageLast + nested := by + intro j + rw [stageOld j] + by_cases hj : j.val = H.dividerCount + · have he : j = q := Fin.ext (by simpa [q] using hj) + subst j + rw [show q.succ = Fin.last (H.dividerCount + 1) from Fin.ext rfl, stageLast] + exact segTrans (ordinaryToA q) hAU + · rw [stageAt j.succ (by have := j.isLt; change j.val + 1 ≤ _; omega)] + exact H.nested j + strict := by + intro j + rw [stageOld j] + by_cases hj : j.val = H.dividerCount + · have he : j = q := Fin.ext (by simpa [q] using hj) + subst j + rw [show q.succ = Fin.last (H.dividerCount + 1) from Fin.ext rfl, stageLast] + exact lt_of_le_of_lt (ordinaryToA q).1 hAUstrict + · rw [stageAt j.succ (by have := j.isLt; change j.val + 1 ≤ _; omega)] + exact H.strict j + dividerPosition := fun i => ⟨(H.dividerPosition i).val, by + have hb := divBound i + have hbu := hBU.1 + omega⟩ + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := by + intro i + clear * - H i stageAt divBound hBU hBT equalTrees + rw [stageAt ⟨i.val + 1, by omega⟩ + (by change i.val + 1 ≤ H.dividerCount; have := i.isLt; omega), H.dividerStage i] + have hpref : TreeSequencePrefix Utree (H.dividerPosition i).val (H.dividerPositive i) + (by have := divBound i; have := hBU.1; omega) = + TreeSequencePrefix T (H.dividerPosition i).val (H.dividerPositive i) + (Nat.le_of_lt_succ (H.dividerPosition i).isLt) := by + apply equalTrees + · refine ⟨le_rfl, ?_, ?_⟩ + · intro x + have hu := hBU.2.1 (Fin.castLE (Nat.succ_le_succ (divBound i)) x) + have ht := hBT.2.1 (Fin.castLE (Nat.succ_le_succ (divBound i)) x) + exact ht.trans hu.symm + · intro x + have hu := hBU.2.2 (Fin.castLE (divBound i) x) + have ht := hBT.2.2 (Fin.castLE (divBound i) x) + exact ht.trans hu.symm + · rfl + exact hpref.symm + coreInsideFirst := by + rw [hcoreU] + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hA : A = base.core := by simp [A, HierarchyStarredStage, hq] + rw [show newStage ⟨1, by omega⟩ = Utree by simp [newStage, hz]] + exact hA ▸ hAU + · rw [stageAt ⟨1, by omega⟩ (Nat.one_le_iff_ne_zero.mpr hz)] + exact H.coreInsideFirst } + +theorem HierarchyCaseThreePreparation.helper_pathShort_734.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (beta : Fin k), + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); + ∀ (hlenB : B.length = T.length - (2 : ℕ)), Bplus.length = T.length - (1 : ℕ) → + ∀ (hBT : TreeSequenceInitialSegment B T), TreeSequenceInitialSegment Bplus T → + ∀ (segTrans : + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) (equalTrees : + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S U → S.length = U.length → S = U), + TreeSequenceInitialSegment A T → + ∀ (m : ℕ), (1 : ℕ) ≤ m → + ∀ (pv : Fin (m + (1 : ℕ)) → V), + let R : TreeSequence G e0 := if pv (0 : Fin (m + (1 : ℕ))) = T.vertex D.penultimateVertexIndex + then Bplus else B; TreeSequenceInitialSegment B R → + ∀ (Utree : TreeSequence G e0), TreeSequenceInitialSegment R Utree → Utree.length = R.length + + m → R.length < Utree.length → ( + ∀ (r : Fin Utree.length), R.length ≤ (↑r : ℕ) → Utree.vertex r.succ ∉ TreeSequenceVertexSet R + ∧ Sum.inr (Utree.edge r) ∈ TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)) ∧ Sum.inl (Utree.vertex r.succ) ∈ TwoColorComponent G phi D.alpha + beta (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ (phi (Utree.edge r) = some D.alpha ∨ phi + (Utree.edge r) = some beta) ∧ G.ends (Utree.edge r) = if (↑r : ℕ) = R.length then s(pv (0 + : Fin (m + (1 : ℕ))), Utree.vertex r.succ) else s(Utree.vertex r.castSucc, Utree.vertex + r.succ)) → + ∀ (hBU : TreeSequenceInitialSegment B Utree) (hAU : TreeSequenceInitialSegment A Utree) (corrU + : CorrespondingExtendedTashkinovTree G k e0 ett phi Utree) (baseU : HierarchyBase + corrU.replacementETT phi) (hcoreU : baseU.core = base.core) (terminalData : + corrU.replacementETT.series.data.tree (Fin.last corrU.replacementETT.rounds).castSucc = Tn + ∧ corrU.replacementETT.series.data.kind (Fin.last corrU.replacementETT.rounds) = + ett.series.data.kind n) (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) + (hAUstrict : A.length < Utree.length), + let newStage : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := fun (j : Fin + (H.dividerCount + (2 : ℕ))) ↦ if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then Utree else + H.stage j; + ∀ (stageOld : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), newStage j.castSucc = H.stage j.castSucc) (stageLast : + newStage (Fin.last (H.dividerCount + (1 : ℕ))) = Utree) (stageAt : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), (↑j : ℕ) ≤ H.dividerCount → newStage j = H.stage j) + (divBound : + ∀ (i : Fin H.dividerCount), (↑(H.dividerPosition i) : ℕ) ≤ B.length), + let K : TashkinovHierarchy corrU.replacementETT baseU := + HierarchyCaseThreePreparation.helperK553 G k e0 input T phi ett base C ctx D hlenB hBT + (fun {_ _ _ : TreeSequence G e0} ↦ segTrans) (fun {_ _ : TreeSequence G e0} ↦ equalTrees) + m pv Utree hBU hAU corrU baseU hcoreU terminalData ordinaryToA hAUstrict stageOld + stageLast stageAt divBound; ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), HierarchyStarredStage K j = HierarchyStarredStage H j) + → HierarchyPathNumber K < HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B beta Bplus hlenB + hlenPlus hBT hplusT segTrans equalTrees hAT m hm pv R hBR Utree hRU hUlen hRUstrict hnew + hBU hAU corrU baseU hcoreU terminalData ordinaryToA hAUstrict newStage stageOld stageLast + stageAt divBound K starredEq + have hell : 2 ≤ ell := D.tailAtLeastTwo + have hsum : A.length + ell = T.length := by dsimp [ell]; have := hAT.1; omega + let candidates := (Finset.Icc 1 (Utree.length - A.length)).filter fun i => + ∀ r : Fin Utree.length, A.length + i ≤ r.val → + G.ends (Utree.edge r) = s(Utree.vertex r.castSucc, Utree.vertex r.succ) + have hcand : ell - 1 ∈ candidates := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_Icc.mpr ⟨by omega, ?_⟩, ?_⟩ + · have hbr := hBR.1 + omega + · intro r hr + by_cases hp : pv 0 = T.vertex D.penultimateVertexIndex + · have hR : R = Bplus := ite_eq_left hp + have hRlen : R.length = T.length - 1 := hR ▸ hlenPlus + have hge : R.length ≤ r.val := by omega + rw [(hnew r hge).2.2.2.2] + split + · rename_i he + have hv : Utree.vertex r.castSucc = pv 0 := by + have h := hRU.2.1 (Fin.last R.length) + have hi : Fin.castLE (Nat.succ_le_succ hRU.1) (Fin.last R.length) = r.castSucc := + Fin.ext (by change R.length = r.val; omega) + rw [hi, hR, ← hplusT.2.1 (Fin.last Bplus.length)] at h + have hj : Fin.castLE (Nat.succ_le_succ hplusT.1) (Fin.last Bplus.length) = + D.penultimateVertexIndex := Fin.ext (by + change Bplus.length = D.penultimateVertexIndex.val + have := D.penultimateVertexPosition + omega) + rw [hj] at h + exact h.trans hp.symm + rw [hv] + · rfl + · have hR : R = B := ite_eq_right hp + have hRlen : R.length = T.length - 2 := hR ▸ hlenB + have hge : R.length ≤ r.val := by omega + rw [(hnew r hge).2.2.2.2, ite_eq_right (by omega : r.val ≠ R.length)] + have hnonempty : candidates.Nonempty := ⟨ell - 1, hcand⟩ + have hpath : HierarchyPathNumber K = candidates.min' hnonempty := by + unfold HierarchyPathNumber + dsimp only + rw [starredEq q] + change (if h : candidates.Nonempty then candidates.min' h else _) = _ + rw [dite_eq_left hnonempty] + rw [hpath, D.pathNumberFull] + have hle := Finset.min'_le candidates (ell - 1) hcand + change candidates.min' hnonempty < ell + omega + +private theorem helper_continuation_1119.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + let tailUsed : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c} : Finset (Fin k)); + ∀ (beta : Fin k) (_ : beta ∈ TreeMissingColors phi B) (_ : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) (_ : (0 : ℕ) < + H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma ∨ H.dividerCount = (0 : ℕ) ∧ beta ∉ Dn ∧ beta ∉ + Gamma ∨ beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed), + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); + let _ : Set (V ⊕ E) := TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment Bplus T) (_ : + TreeSequenceInitialSegment B Bplus) (_ : D.alpha ≠ beta) (_ : T.vertex + D.terminalVertexIndex ∉ TreeSequenceVertexSet Bplus) (_ : TreeSequenceInitialSegment A T), + let yp : V := T.vertex D.terminalVertexIndex; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.alpha beta (Sum.inl yp); + ∀ (_ : + have C_1 : Set (V ⊕ E) := TwoColorComponent G phi D.alpha beta (Sum.inl yp); + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.alpha beta (Sum.inl yp); + ( + ∀ (v : V), Sum.inl v ∉ C_1 → MissingColors G phi' v = MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C_1 → D.alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) + ∧ ( + ∀ (v : V), Sum.inl v ∈ C_1 → beta ∈ MissingColors G phi v → D.alpha ∈ MissingColors G phi' v) + ∧ + ∀ (v : V) (c : Fin k), c ≠ D.alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ + MissingColors G phi v)) (_ : + ∀ v ∈ TreeSequenceVertexSet Bplus, MissingColors G sigma v = MissingColors G phi v) (_ : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → sigma (T.edge t) = phi (T.edge t)) (corrT : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T) (_ : MaximumProperty + corrT.replacementETT) (baseT : HierarchyBase corrT.replacementETT sigma) (KT : + TashkinovHierarchy corrT.replacementETT baseT) (goodT : GoodHierarchy KT) (_ : + SameGoodHierarchy C.good goodT) (_ : + ∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)), + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Nonempty + (HierarchySituationTwoCaseThreeNormalizedData G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n A ell B Dn Dnq Gamma tailUsed beta + hmissing hunused halternative Bplus Q hBT hplusT hBBplus hne hterminalOutside hAT yp sigma + behavior missingPenultimate tailFixed corrT maximumT baseT KT goodT sameT fixedA + have fixedT : ∀ t : Fin T.length, sigma (T.edge t) = phi (T.edge t) := by + intro t + by_cases ht : t.val < A.length + · let tA : Fin A.length := ⟨t.val, ht⟩ + have he : Fin.castLE hAT.1 tA = t := Fin.ext rfl + rw [← he, hAT.2.2 tA] + exact fixedA tA + · exact tailFixed t (by omega) + have hterminalNew : beta ∈ MissingColors G sigma yp := + behavior.2.1 yp (show Sum.inl yp ∈ Q from rfl) D.alphaMissingTerminal + have notElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hmissing + have hvPlus := TreeSequenceInitialSegmentVertexSetSubset hBBplus hv + have hmissingNew : beta ∈ MissingColors G sigma v := by + rw [missingPenultimate v hvPlus] + exact hm + have hvT := TreeSequenceInitialSegmentVertexSetSubset hBT hv + have hyT : yp ∈ TreeSequenceVertexSet T := by simp [yp, TreeSequenceVertexSet] + have hne : v ≠ yp := by + intro he + apply hterminalOutside + change yp ∈ TreeSequenceVertexSet Bplus + rw [← he] + exact hvPlus + intro he + exact Finset.disjoint_left.mp (he hvT hyT hne) hmissingNew hterminalNew + let CT : HierarchyCounterexample baseT := { + positive := by rw [corrT.rungAgreement]; exact C.positive + hierarchy := KT + good := goodT + maximum := maximumT + notElementary := notElementary } + obtain ⟨contextT⟩ := P2752_T2_MinimumContextTransport G k e0 input T phi sigma + ett base C ctx corrT baseT CT sameT + let P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := { + coloring := sigma + corresponding := corrT + maximum := maximumT + replacementBase := baseT + counterexample := CT + sameGood := sameT + minimumContext := contextT } + obtain ⟨N, hN⟩ := P2752_T2_NormalizedDatum G k e0 input T phi ett base C ctx D + beta hmissing hunused halternative P fixedT + ⟨(fun t _ => by rw [← hplusT.2.2 t]; exact fixedT _), missingPenultimate⟩ hterminalNew + exact ⟨P, ⟨N⟩⟩ + +theorem HierarchyCaseThreePreparation.helper_caseContinuation_1264.{u_1, u_2} : + HierarchyCaseThreePreparation.helperCaseContinuation1264Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B Dn Dnq Gamma tailUsed + beta hmissing hunused halternative Bplus Q hlenB hlenPlus hBT hplusT hBBplus + hbetaMissingPlus halphaMissingPlus hne hterminalOutside lastPositive hAT haGamma haUsed + hprefixElementary hcase hbFirstB ia ib va vb yp hma hmb hva hvb hsameComponent graph leaf + disjointFirst + let sigma := TwoColorComponentSwap G phi D.alpha beta (Sum.inl yp) + have behavior := TwoColorComponentSwapMissingBehavior G phi D.alpha beta hne ctx.proper + (Sum.inl yp) + have haOutsideQ : Sum.inl va ∉ Q := fun ha => + Set.disjoint_left.mp disjointFirst ha (show Sum.inl va ∈ + TwoColorComponent G phi D.alpha beta (Sum.inl va) from rfl) + have hbOutsideQ : Sum.inl vb ∉ Q := by + intro hb + apply Set.disjoint_left.mp disjointFirst hb + rw [hsameComponent] + rfl + have missingPenultimate : ∀ v, v ∈ TreeSequenceVertexSet Bplus → + MissingColors G sigma v = MissingColors G phi v := by + intro v hv + by_cases hvQ : Sum.inl v ∈ Q + · have hna : D.alpha ∉ MissingColors G phi v := by + intro hm + have he : v = va := by + by_contra hne + exact Finset.disjoint_left.mp (hprefixElementary hv hva hne) hm hma + exact haOutsideQ (he ▸ hvQ) + have hnb : beta ∉ MissingColors G phi v := by + intro hm + have he : v = vb := by + by_contra hne + exact Finset.disjoint_left.mp (hprefixElementary hv hvb hne) hm hmb + exact hbOutsideQ (he ▸ hvQ) + have edgeInQ (f : E) (hf : Incident G v f) + (hc : phi f = some D.alpha ∨ phi f = some beta) : Sum.inr f ∈ Q := by + have hadj : graph.Adj (Sum.inr f) (Sum.inl v) := ⟨hf, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hvQ + have hnewA : D.alpha ∉ MissingColors G sigma v := by + have hpresent : beta ∈ PresentColors G phi v := by simpa [MissingColors] using hnb + obtain ⟨f, hf, hc⟩ := (Finset.mem_filter.mp hpresent).2 + have hfQ := edgeInQ f hf (Or.inr hc) + have hfA : phi f ≠ some D.alpha := fun h => hne (Option.some.inj (h.symm.trans hc)) + have hnew : sigma f = some D.alpha := by + change (if Sum.inr f ∈ Q then + if phi f = some D.alpha then some beta else + if phi f = some beta then some D.alpha else phi f + else phi f) = _ + rw [ite_eq_left hfQ, ite_eq_right hfA, ite_eq_left hc] + intro hm + exact (Finset.mem_sdiff.mp hm).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hf, hnew⟩) + have hnewB : beta ∉ MissingColors G sigma v := by + have hpresent : D.alpha ∈ PresentColors G phi v := by simpa [MissingColors] using hna + obtain ⟨f, hf, hc⟩ := (Finset.mem_filter.mp hpresent).2 + have hfQ := edgeInQ f hf (Or.inl hc) + have hnew : sigma f = some beta := by + change (if Sum.inr f ∈ Q then + if phi f = some D.alpha then some beta else + if phi f = some beta then some D.alpha else phi f + else phi f) = _ + rw [ite_eq_left hfQ, ite_eq_left hc] + intro hm + exact (Finset.mem_sdiff.mp hm).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hf, hnew⟩) + apply Finset.ext + intro c + by_cases hca : c = D.alpha + · subst c + exact ⟨fun h => (hnewA h).elim, fun h => (hna h).elim⟩ + · by_cases hcb : c = beta + · subst c + exact ⟨fun h => (hnewB h).elim, fun h => (hnb h).elim⟩ + · exact behavior.2.2.2 v c hca hcb + · exact behavior.1 v hvQ + have storedFirst : ∀ eta, eta ∈ Dnq → + HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition phi T eta := by + intro eta heta + have hneA : eta ≠ D.alpha := by + intro he + exact Finset.disjoint_left.mp (GoodHierarchyReservedDisjoint C.good q).2 haGamma (he ▸ heta) + by_cases hneB : eta = beta + · subst eta + have hfirstPrefix : HierarchyFirstMissingPosition sigma Bplus beta = + HierarchyFirstMissingPosition phi Bplus beta := by + have hfilters : + ((Finset.univ : Finset (Fin (Bplus.length + 1))).filter fun i => + beta ∈ MissingColors G sigma (Bplus.vertex i)) = + ((Finset.univ : Finset (Fin (Bplus.length + 1))).filter fun i => + beta ∈ MissingColors G phi (Bplus.vertex i)) := by + apply Finset.filter_congr + intro i _ + rw [missingPenultimate (Bplus.vertex i) (by simp [TreeSequenceVertexSet])] + unfold HierarchyFirstMissingPosition + rw [hfilters] + have hcutS := HierarchyFirstMissingPositionPrefixCutoff sigma Bplus T hplusT beta + Bplus.length le_rfl + have hcutP := HierarchyFirstMissingPositionPrefixCutoff phi Bplus T hplusT beta + Bplus.length le_rfl + rw [hfirstPrefix] at hcutS + have hbLt : ib.val < Bplus.length := by + have hlength : B.length < Bplus.length := by + rw [hlenB, hlenPlus] + have hp : 2 ≤ T.length := le_trans D.tailAtLeastTwo (Nat.sub_le _ _) + clear * - hp + omega + exact lt_of_le_of_lt hbFirstB hlength + apply Fin.ext + change (HierarchyFirstMissingPosition sigma T beta).val = ib.val + change min (HierarchyFirstMissingPosition phi Bplus beta).val Bplus.length = + min ib.val Bplus.length at hcutP + clear * - hcutS hcutP hbLt + omega + · have hfilters : + ((Finset.univ : Finset (Fin (T.length + 1))).filter fun i => + eta ∈ MissingColors G sigma (T.vertex i)) = + ((Finset.univ : Finset (Fin (T.length + 1))).filter fun i => + eta ∈ MissingColors G phi (T.vertex i)) := by + apply Finset.filter_congr + intro i _ + exact behavior.2.2.2 _ eta hneA hneB + unfold HierarchyFirstMissingPosition + rw [hfilters] + have tailFixed : ∀ t : Fin T.length, A.length ≤ t.val → + sigma (T.edge t) = phi (T.edge t) := by + intro t ht + have hna : phi (T.edge t) ≠ some D.alpha := fun hc => + haUsed (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, ht, hc⟩) + have hnb := hunused t ht + unfold sigma TwoColorComponentSwap + split <;> simp only [] + have pathQ : TwoColorPathComponent G phi D.alpha beta (Sum.inl yp) := by + exact ⟨hne, Sum.inl yp, show Sum.inl yp ∈ Q from rfl, + leaf yp (Or.inl D.alphaMissingTerminal)⟩ + obtain ⟨weak, modSigma, _, _, corrT, maximumT, baseT, KT, goodT, sameT⟩ := + StableChangeCasesOneTwoFullTail G k e0 input T phi ett base C ctx D.alpha beta hne + ⟨halphaMissingPlus, hbetaMissingPlus⟩ (Sum.inl yp) pathQ sigma rfl + (by rcases hcase with h | h + · exact Or.inl h + · exact Or.inr ⟨h.1, Or.inl h.2⟩) + disjointFirst tailFixed missingPenultimate storedFirst + have fixedA : ∀ t : Fin A.length, sigma (A.edge t) = phi (A.edge t) := by + change HierarchyWeaklyStable H q sigma at weak + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hA : A = base.core := by simp [A, HierarchyStarredStage, hq] + rw [hA] + apply P2813_T1_BaseDisplayedEdges G k e0 input T phi ett base sigma + ctx.oneEdgeUncolored modSigma.2.1 + rw [hq] at weak + exact weak + · let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hq : q = i.succ := Fin.ext (by dsimp [q, i]; omega) + have hinv : TreeColoringInvariant (H.stage q.castSucc) phi sigma := by + rw [hq] at weak ⊢ + exact weak.2 + rw [lastPositive hz] + intro t + by_cases ht : t.val = 0 + · have he : t = ⟨0, (H.stage q.castSucc).positive⟩ := Fin.ext ht + rw [he, (H.stage q.castSucc).first_edge, modSigma.2.1.1, ctx.oneEdgeUncolored.1] + · exact hinv.1 t (by omega) + exact @helper_continuation_1119 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@beta) + (@hmissing) (@hunused) (@halternative) (@hBT) (@hplusT) (@hBBplus) (@hne) + (@hterminalOutside) (@hAT) (@behavior) (@missingPenultimate) (@tailFixed) (@corrT) + (@maximumT) (@baseT) (@KT) (@goodT) (@sameT) (@fixedA) +theorem HierarchyCaseThreePreparation.helper_branch_1316.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let tailUsed : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c} : Finset (Fin k)); + ∀ (beta : Fin k), + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); B.length = T.length - (2 : ℕ) → Bplus.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → D.alpha ≠ beta → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) → ( + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S U → S.length = U.length → S = U) → ( + H.dividerCount ≠ (0 : ℕ) → A = H.stage q.castSucc) → + ∀ (m : ℕ) (_ : Fin (m + (1 : ℕ)) → V) (Utree : TreeSequence G e0), TreeSequenceInitialSegment + B Utree → TreeSequenceInitialSegment A Utree → + ∀ (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi Utree) (baseU : HierarchyBase + corrU.replacementETT phi), baseU.core = base.core → corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc = Tn ∧ + corrU.replacementETT.series.data.kind (Fin.last corrU.replacementETT.rounds) = + ett.series.data.kind n → ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) → + A.length < Utree.length → + let newStage : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := fun (j : Fin + (H.dividerCount + (2 : ℕ))) ↦ if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then Utree else + H.stage j; ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), newStage j.castSucc = H.stage j.castSucc) → newStage + (Fin.last (H.dividerCount + (1 : ℕ))) = Utree → ( + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), (↑j : ℕ) ≤ H.dividerCount → newStage j = H.stage j) → + ( + ∀ (i : Fin H.dividerCount), (↑(H.dividerPosition i) : ℕ) ≤ B.length) → ( ( + ∀ eta ∈ Dnq, D.alpha ∈ C.good.gamma q eta → (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) ≤ + B.length) → False) → D.alpha ∈ tailUsed → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Nonempty + (HierarchySituationTwoCaseThreeNormalizedData G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B Dnq tailUsed beta Bplus + hlenB hlenPlus hBT hne segTrans equalTrees lastPositive m pv Utree hBU hAU corrU baseU + hcoreU terminalData ordinaryToA hAUstrict newStage stageOld stageLast stageAt divBound + shorteningContradiction haUsed + have alphaNotLast : phi (T.edge D.lastEdgeIndex) ≠ some D.alpha := by + intro hc + have hnotPresent : D.alpha ∉ PresentColors G phi (T.vertex D.terminalVertexIndex) := + (Finset.mem_sdiff.mp D.alphaMissingTerminal).2 + apply hnotPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨T.edge D.lastEdgeIndex, ?_, hc⟩ + obtain ⟨i, he⟩ := T.attaches D.lastEdgeIndex + have hi : D.lastEdgeIndex.succ = D.terminalVertexIndex := Fin.ext (by + change D.lastEdgeIndex.val + 1 = D.terminalVertexIndex.val + have := D.lastEdgePosition + have := D.terminalVertexPosition + omega) + change T.vertex D.terminalVertexIndex ∈ G.ends (T.edge D.lastEdgeIndex) + rw [he, hi] + exact Sym2.mem_mk_left _ _ + obtain ⟨t, htA, htcolor⟩ := (Finset.mem_filter.mp haUsed).2 + have htB : t.val ≤ B.length := by + by_contra hn + have htlast : t = D.lastEdgeIndex := Fin.ext (by + have := t.isLt + have := D.lastEdgePosition + rw [hlenB] at hn + omega) + exact alphaNotLast (htlast ▸ htcolor) + apply False.elim + apply shorteningContradiction + intro eta heta hgamma + have hfirst : (HierarchyFirstMissingPosition phi T eta).val ≤ t.val := by + by_contra hn + have hseg : D.alpha ∈ HierarchySegmentColors H q eta := by + unfold HierarchySegmentColors + dsimp only + rw [show q.succ = Fin.last (H.dividerCount + 1) from Fin.ext rfl, H.terminalStage] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, htA, + by have := t.isLt; omega, htcolor⟩ + exact (Finset.mem_sdiff.mp (C.good.avoidance q eta heta hgamma)).2 hseg + exact hfirst.trans htB + +theorem HierarchyCaseThreePreparation.helper_terminalAvoid_1779.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + ∀ (beta : Fin k), + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); + ∀ (hlenB : B.length = T.length - (2 : ℕ)) (hBT : TreeSequenceInitialSegment B T) (segTrans : + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) (equalTrees : + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S U → S.length = U.length → S = U) (m + : ℕ) (pv : Fin (m + (1 : ℕ)) → V), + let R : TreeSequence G e0 := if pv (0 : Fin (m + (1 : ℕ))) = T.vertex D.penultimateVertexIndex + then Bplus else B; TreeSequenceInitialSegment B R → TreeSequenceInitialSegment R T → + ∀ (Utree : TreeSequence G e0), TreeSequenceInitialSegment R Utree → ( + ∀ (r : Fin Utree.length), R.length ≤ (↑r : ℕ) → Utree.vertex r.succ ∉ TreeSequenceVertexSet R + ∧ Sum.inr (Utree.edge r) ∈ TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)) ∧ Sum.inl (Utree.vertex r.succ) ∈ TwoColorComponent G phi D.alpha + beta (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ (phi (Utree.edge r) = some D.alpha ∨ phi + (Utree.edge r) = some beta) ∧ G.ends (Utree.edge r) = if (↑r : ℕ) = R.length then s(pv (0 + : Fin (m + (1 : ℕ))), Utree.vertex r.succ) else s(Utree.vertex r.castSucc, Utree.vertex + r.succ)) → + ∀ (hBU : TreeSequenceInitialSegment B Utree) (hAU : TreeSequenceInitialSegment A Utree) (corrU + : CorrespondingExtendedTashkinovTree G k e0 ett phi Utree) (baseU : HierarchyBase + corrU.replacementETT phi) (hcoreU : baseU.core = base.core) (terminalData : + corrU.replacementETT.series.data.tree (Fin.last corrU.replacementETT.rounds).castSucc = Tn + ∧ corrU.replacementETT.series.data.kind (Fin.last corrU.replacementETT.rounds) = + ett.series.data.kind n) (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) + (hAUstrict : A.length < Utree.length), + let newStage : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := fun (j : Fin + (H.dividerCount + (2 : ℕ))) ↦ if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then Utree else + H.stage j; + ∀ (stageOld : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), newStage j.castSucc = H.stage j.castSucc) (stageLast : + newStage (Fin.last (H.dividerCount + (1 : ℕ))) = Utree) (stageAt : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), (↑j : ℕ) ≤ H.dividerCount → newStage j = H.stage j) + (divBound : + ∀ (i : Fin H.dividerCount), (↑(H.dividerPosition i) : ℕ) ≤ B.length), + let K : TashkinovHierarchy corrU.replacementETT baseU := + HierarchyCaseThreePreparation.helperK553 G k e0 input T phi ett base C ctx D hlenB hBT + (fun {_ _ _ : TreeSequence G e0} ↦ segTrans) (fun {_ _ : TreeSequence G e0} ↦ equalTrees) + m pv Utree hBU hAU corrU baseU hcoreU terminalData ordinaryToA hAUstrict stageOld + stageLast stageAt divBound; ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), HierarchyStarredStage K j = HierarchyStarredStage H j) + → beta ∉ Gamma → ( + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))), c ∈ MissingColors G phi + (S.vertex i) → (↑(HierarchyFirstMissingPosition phi S c) : ℕ) ≤ (↑i : ℕ)) → ( + ∀ (c : Fin k), (↑(HierarchyFirstMissingPosition phi T c) : ℕ) < T.length → c ∈ MissingColors G + phi (T.vertex (HierarchyFirstMissingPosition phi T c))) → ( + ∀ eta ∈ Dnq, D.alpha ∈ C.good.gamma q eta → (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) ≤ + B.length) → + ∀ eta ∈ Dnq, Disjoint (C.good.gamma q eta) (HierarchySegmentColors K q eta) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B Dnq Gamma beta Bplus + hlenB hBT segTrans equalTrees m pv R hBR hRT Utree hRU hnew hBU hAU corrU baseU hcoreU + terminalData ordinaryToA hAUstrict newStage stageOld stageLast stageAt divBound K starredEq + betaOutsideGamma firstBound firstWitness control eta heta + apply Finset.disjoint_left.mpr + intro c hc hu + unfold HierarchySegmentColors at hu + dsimp only at hu + rw [show q.succ = Fin.last (K.dividerCount + 1) from Fin.ext rfl, + K.terminalStage, starredEq q] at hu + obtain ⟨_, r, hrA, hrfirst, hrcolor⟩ := Finset.mem_filter.mp hu + change A.length ≤ r.val at hrA + by_cases hr : r.val < R.length + · let rR : Fin R.length := ⟨r.val, hr⟩ + let rT : Fin T.length := Fin.castLE hRT.1 rR + have hedge : phi (T.edge rT) = some c := by + rw [hRT.2.2 rR, ← hRU.2.2 rR] + simpa only [show Fin.castLE hRU.1 rR = r from Fin.ext rfl] using hrcolor + have hcutU := HierarchyFirstMissingPositionPrefixCutoff phi R Utree hRU eta R.length le_rfl + have hcutT := HierarchyFirstMissingPositionPrefixCutoff phi R T hRT eta R.length le_rfl + have hsmall : r.val < min (HierarchyFirstMissingPosition phi T eta).val R.length := by + rw [← hcutT, hcutU] + omega + have hseg : c ∈ HierarchySegmentColors H q eta := by + unfold HierarchySegmentColors + dsimp only + rw [show q.succ = Fin.last (H.dividerCount + 1) from Fin.ext rfl, H.terminalStage] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, rT, hrA, + by have := rT.isLt; change r.val < min _ _; omega, hedge⟩ + exact (Finset.mem_sdiff.mp (C.good.avoidance q eta heta hc)).2 hseg + · rcases (hnew r (by omega)).2.2.2.1 with ha | hb + · have hca : c = D.alpha := Option.some.inj (hrcolor.symm.trans ha) + subst c + have hearly := control eta heta hc + have hBlt : B.length < T.length := by rw [hlenB]; have := T.positive; omega + have hm := firstWitness eta (lt_of_le_of_lt hearly hBlt) + let iB : Fin (B.length + 1) := + ⟨(HierarchyFirstMissingPosition phi T eta).val, by omega⟩ + have hmissingB : eta ∈ MissingColors G phi (B.vertex iB) := by + rw [← hBT.2.1 iB] + have hi : Fin.castLE (Nat.succ_le_succ hBT.1) iB = + HierarchyFirstMissingPosition phi T eta := Fin.ext rfl + rw [hi] + exact hm + have hmissingU : eta ∈ MissingColors G phi + (Utree.vertex (Fin.castLE (Nat.succ_le_succ hBU.1) iB)) := by + rw [hBU.2.1 iB] + exact hmissingB + have hfirstU := firstBound Utree eta _ hmissingU + change (HierarchyFirstMissingPosition phi Utree eta).val ≤ + (HierarchyFirstMissingPosition phi T eta).val at hfirstU + have hBRlen := hBR.1 + omega + · have hcb : c = beta := Option.some.inj (hrcolor.symm.trans hb) + subst c + exact betaOutsideGamma (Finset.mem_biUnion.mpr ⟨eta, heta, hc⟩) + +theorem HierarchyCaseThreePreparation.helper_branch_1551.{u_1, u_2} : + HierarchyCaseThreePreparation.helperBranch1551Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B Dn Dnq Gamma tailUsed + beta hmissing hunused halternative Bplus Q hbetaPresent hlenB hlenPlus hBT hplusT hBBplus + hbetaMissingPlus halphaMissingPlus hne hterminalOutside lastPositive hAT hTnA + halphaMissingB m hm firstBound firstWitness haGamma haUsed + clear * - G k e0 input T phi ett base C ctx D H q n Tn A ell B Bplus Q + Dnq Gamma tailUsed beta hmissing hunused halternative hne hbetaPresent + hlenB hlenPlus hBT hplusT hBBplus halphaMissingB halphaMissingPlus + hbetaMissingPlus hterminalOutside hAT hTnA lastPositive firstBound firstWitness haGamma haUsed + have hprefixElementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have prefixFirst (S : TreeSequence G e0) (hST : TreeSequenceInitialSegment S T) + (c : Fin k) (hc : c ∈ TreeMissingColors phi S) : + (HierarchyFirstMissingPosition phi T c).val ≤ S.length := by + clear * - S hST c hc firstBound phi T + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + have hmissing : c ∈ MissingColors G phi + (T.vertex (Fin.castLE (Nat.succ_le_succ hST.1) i)) := by + rw [hST.2.1 i, hi] + exact hm + have hbound := firstBound T c _ hmissing + change (HierarchyFirstMissingPosition phi T c).val ≤ i.val at hbound + exact hbound.trans (Nat.le_of_lt_succ i.isLt) + have haStage : D.alpha ∈ HierarchyStageMissingColors H q := by + obtain ⟨eta, heta, hga⟩ := Finset.mem_biUnion.mp haGamma + exact (Finset.mem_sdiff.mp (C.good.avoidance q eta heta hga)).1 + have hcase : + (0 < H.dividerCount ∧ D.alpha ∈ TreeMissingColors phi (H.stage q.castSucc)) ∨ + (H.dividerCount = 0 ∧ D.alpha ∈ TreeMissingColors phi Tn) := by + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + exact Or.inr ⟨hz, by simpa only [hq, HierarchyStageMissingColors, Fin.cases_zero] using + haStage⟩ + · let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hq : q = i.succ := Fin.ext (by dsimp [q, i]; omega) + refine Or.inl ⟨Nat.pos_of_ne_zero hz, ?_⟩ + simpa only [hq, HierarchyStageMissingColors, Fin.cases_succ] using haStage + have haMissingA : D.alpha ∈ TreeMissingColors phi A := by + rcases hcase with h | h + · rw [lastPositive (Nat.ne_of_gt h.1)] + exact h.2 + · obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp h.2 + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hTnA hv, hm⟩ + have haFirstA := prefixFirst A hAT D.alpha haMissingA + have haFirstB := prefixFirst B hBT D.alpha halphaMissingB + have hbFirstB := prefixFirst B hBT beta hmissing + let ia := HierarchyFirstMissingPosition phi T D.alpha + let ib := HierarchyFirstMissingPosition phi T beta + let va := T.vertex ia + let vb := T.vertex ib + let yp := T.vertex D.terminalVertexIndex + have hBlt : B.length < T.length := by rw [hlenB]; have := T.positive; omega + have hma : D.alpha ∈ MissingColors G phi va := + firstWitness _ (lt_of_le_of_lt haFirstB hBlt) + have hmb : beta ∈ MissingColors G phi vb := + firstWitness _ (lt_of_le_of_lt hbFirstB hBlt) + have firstInB (c : Fin k) (hc : (HierarchyFirstMissingPosition phi T c).val ≤ B.length) : + T.vertex (HierarchyFirstMissingPosition phi T c) ∈ TreeSequenceVertexSet Bplus := by + let i : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition phi T c).val, by omega⟩ + have hv : T.vertex (HierarchyFirstMissingPosition phi T c) = B.vertex i := by + exact hBT.2.1 i + apply TreeSequenceInitialSegmentVertexSetSubset hBBplus + rw [hv] + simp [TreeSequenceVertexSet] + have hva := firstInB D.alpha haFirstB + have hvb := firstInB beta hbFirstB + have hsame := ChangeLemma G k e0 input T phi ett base C ctx.proper ctx.oneEdgeUncolored + ctx.lowerRung ctx.fewerDividers ctx.lexicographicMinimality hprefixElementary + ctx.largeMissingSet + D.alpha beta hne ⟨halphaMissingPlus, hbetaMissingPlus⟩ (by + dsimp only + intro hn + change D.alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A at hn + have hbAbsent : beta ∉ TreeMissingColors phi A := hn.resolve_left (by + intro hna; exact hna haMissingA) + have hbAfter : A.length < ib.val := by + by_contra hno + have hle : ib.val ≤ A.length := by omega + let i : Fin (A.length + 1) := ⟨ib.val, by omega⟩ + apply hbAbsent + refine Finset.mem_biUnion.mpr ⟨A.vertex i, by simp [TreeSequenceVertexSet], ?_⟩ + rw [← hAT.2.1 i] + have hi : Fin.castLE (Nat.succ_le_succ hAT.1) i = ib := Fin.ext rfl + rw [hi] + exact hmb + refine ⟨⟨ia, ib, rfl, rfl, lt_of_le_of_lt haFirstA hbAfter⟩, ?_⟩ + intro hcolor + obtain ⟨t, htA, _, htc⟩ := (Finset.mem_filter.mp hcolor).2 + exact haUsed (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, htA, htc⟩)) + have hsameComponent : TwoColorComponent G phi D.alpha beta (Sum.inl va) = + TwoColorComponent G phi D.alpha beta (Sum.inl vb) := by + rcases hcase with h | h + · exact hsame.1 ⟨h.1, Or.inl h.2⟩ + · exact hsame.2.1 ⟨h.1, Or.inl h.2⟩ + let graph := TwoColorIncidenceGraph G phi D.alpha beta + have absent (v : V) (c : Fin k) (hc : c ∈ MissingColors G phi v) + (f : E) (hf : Incident G v f) : phi f ≠ some c := by + intro hfc + exact (Finset.mem_sdiff.mp hc).2 (Finset.mem_filter.mpr + ⟨Finset.mem_univ _, f, hf, hfc⟩) + have leaf (v : V) (hm : D.alpha ∈ MissingColors G phi v ∨ beta ∈ MissingColors G phi v) : + (graph.neighborSet (Sum.inl v)).Subsingleton := by + clear * - G phi D beta graph hm v ctx absent + intro x hx y hy + cases x with + | inl x => exact (show False by simp [graph, TwoColorIncidenceGraph] at hx).elim + | inr f => + cases y with + | inl y => exact (show False by simp [graph, TwoColorIncidenceGraph] at hy).elim + | inr g => + have hxf : Incident G v f ∧ (phi f = some D.alpha ∨ phi f = some beta) := hx + have hyg : Incident G v g ∧ (phi g = some D.alpha ∨ phi g = some beta) := hy + by_cases hfg : f = g + · exact congrArg Sum.inr hfg + · exfalso + rcases hm with hm | hm + · have hf := hxf.2.resolve_left (absent v D.alpha hm f hxf.1) + have hg := hyg.2.resolve_left (absent v D.alpha hm g hyg.1) + exact ctx.proper hfg ⟨v, hxf.1, hyg.1⟩ hf hg + · have hf := hxf.2.resolve_right (absent v beta hm f hxf.1) + have hg := hyg.2.resolve_right (absent v beta hm g hyg.1) + exact ctx.proper hfg ⟨v, hxf.1, hyg.1⟩ hf hg + have disjointFirst : Disjoint Q (TwoColorComponent G phi D.alpha beta (Sum.inl va)) := by + rcases TwoColorComponentsDisjoint G phi D.alpha beta (Sum.inl yp) (Sum.inl va) with he | hd + · exfalso + have haQ : Sum.inl va ∈ Q := by + change Sum.inl va ∈ TwoColorComponent G phi D.alpha beta (Sum.inl yp) + rw [he] + rfl + have hbQ : Sum.inl vb ∈ Q := by + change Sum.inl vb ∈ TwoColorComponent G phi D.alpha beta (Sum.inl yp) + rw [he, hsameComponent] + rfl + have hyQ : Sum.inl yp ∈ Q := rfl + have hay : va ≠ yp := by + intro heq + apply hterminalOutside + change yp ∈ TreeSequenceVertexSet Bplus + rw [← heq] + exact hva + have hby : vb ≠ yp := by + intro heq + apply hterminalOutside + change yp ∈ TreeSequenceVertexSet Bplus + rw [← heq] + exact hvb + have hab : va ≠ vb := by + intro heq + have hmbA : beta ∈ MissingColors G phi va := heq ▸ hmb + have hempty : graph.neighborSet (Sum.inl va) = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro x hx + cases x with + | inl x => simp [graph, TwoColorIncidenceGraph] at hx + | inr f => + have hf : Incident G va f ∧ (phi f = some D.alpha ∨ phi f = some beta) := hx + exact hf.2.elim (absent va D.alpha hma f hf.1) (absent va beta hmbA f hf.1) + have hreach : graph.Reachable (Sum.inl va) (Sum.inl yp) := + SimpleGraph.ConnectedComponent.eq.mp haQ + exact SimpleGraph.not_reachable_of_neighborSet_left_eq_empty + (by intro h; exact hay (Sum.inl.inj h)) hempty hreach + obtain ⟨u, v, p, hp, hsupp⟩ := + TwoColorComponentSpanningPath G phi D.alpha beta ctx.proper (Sum.inl yp) + have endpoints (x : Sum V E) (hx : x ∈ Q) (hleaf : (graph.neighborSet x).Subsingleton) : + x = u ∨ x = v := by + have hxP : x ∈ p.support := by + change x ∈ {x | x ∈ p.support} + rw [hsupp] + exact hx + by_cases hxu : x = u + · exact Or.inl hxu + · by_cases hxv : x = v + · exact Or.inr hxv + · exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet hxu hxv hleaf hxP).elim + have hea := endpoints _ haQ (leaf va (Or.inl hma)) + have heb := endpoints _ hbQ (leaf vb (Or.inr hmb)) + have hey := endpoints _ hyQ (leaf yp (Or.inl D.alphaMissingTerminal)) + have hab' : (Sum.inl va : Sum V E) ≠ Sum.inl vb := fun h => hab (Sum.inl.inj h) + have hay' : (Sum.inl va : Sum V E) ≠ Sum.inl yp := fun h => hay (Sum.inl.inj h) + have hby' : (Sum.inl vb : Sum V E) ≠ Sum.inl yp := fun h => hby (Sum.inl.inj h) + rcases hea with hea | hea <;> rcases heb with heb | heb <;> rcases hey with hey | hey + all_goals first + | exact hab' (hea.trans heb.symm) + | exact hay' (hea.trans hey.symm) + | exact hby' (heb.trans hey.symm) + · exact hd + exact @HierarchyCaseThreePreparation.helper_caseContinuation_1264 (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@base) (@C) (@ctx) (@D) (@beta) (@hmissing) (@hunused) (@halternative) (@hlenB) + (@hlenPlus) (@hBT) (@hplusT) (@hBBplus) (@hbetaMissingPlus) (@halphaMissingPlus) (@hne) + (@hterminalOutside) (@lastPositive) (@hAT) (@haGamma) (@haUsed) (@hprefixElementary) + (@hcase) (@hbFirstB) (@hma) (@hmb) (@hva) (@hvb) (@hsameComponent) (@leaf) (@disjointFirst) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNine.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNine.lean new file mode 100644 index 0000000000..49957f5b75 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNine.lean @@ -0,0 +1,1596 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyClaimNineFirstUseAfterSeed +public import LeanPool.GoldbergSeymour.HierarchyClaimNineFirstUseSeed +public import LeanPool.GoldbergSeymour.HierarchyClaimNinePENormalization +public import LeanPool.GoldbergSeymour.HierarchyClaimNineUnusedTailColor +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTerminalCommonMissing +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.HierarchyMeasures + +/-! +# Hierarchy Claim Nine + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch600Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + let corr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { + replacementInput := input, replacementSeries := ett.series, replacementETT := ett, + rungAgreement := rfl, seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (i : Fin ett.rounds) => Eq.refl (ett.series.data.tree i.succ.castSucc), + storedColorsAgree := fun (i : Fin (ett.rounds + (1 : ℕ))) => + Eq.refl (ett.series.data.stored i), + connectingEdgesAgree := fun (i : Fin (ett.rounds + (1 : ℕ))) => + Eq.refl (ett.series.data.connectingEdges i), + extensionKindsAgree := fun (i : Fin (ett.rounds + (1 : ℕ))) => + Eq.refl (ett.series.data.kind i), + replacementProper := fun (i : Fin (ett.rounds + (1 : ℕ))) => + have hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i := + ett.series.certified i; + TashkinovSeriesStep.casesOn (motive := + fun (a : Fin (ett.rounds + (1 : ℕ))) + (t : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data a) => + i = a → hs ≍ t → IsProperEdgeColoring G (ett.series.data.coloring i)) hs + (fun (triple : KTriple G k e0 input) + (seedLength : (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))).length = (1 : ℕ)) + (hi : ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ))) = input) + (initialStored : ett.series.data.stored (0 : Fin (ett.rounds + (1 : ℕ))) = ∅) + (initialEdges : ett.series.data.connectingEdges (0 : Fin (ett.rounds + (1 : ℕ))) = ∅) + (initialKind : ett.series.data.kind (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialVertex : ett.series.data.chosenVertex (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialOutside : ett.series.data.outsideVertex (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialDelta : ett.series.data.delta (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialGamma : ett.series.data.gamma (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialClosure : + TashkinovClosure (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) + (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree (1 : Fin (ett.rounds + (2 : ℕ))))) + (h : i = (0 : Fin (ett.rounds + (1 : ℕ)))) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.initial triple seedLength hi initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure → + IsProperEdgeColoring G (ett.series.data.coloring i)) + (fun + (hs : + TashkinovSeriesStep G k ett.rounds e0 input ett.series.data + (0 : Fin (ett.rounds + (1 : ℕ)))) + (_ : + hs ≍ + TashkinovSeriesStep.initial triple seedLength hi initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure) => + Eq.mpr (id (congrArg (IsProperEdgeColoring G) hi)) triple.right.right.right.left) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data i_1.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i_1.succ.castSucc) + (TashkinovStoredColors ett.series.data i_1.castSucc) + (ett.series.data.coloring i_1.castSucc)) + (seriesAlternative : + ∀ (pi : PartialEdgeColoring E k), + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (ett.series.data.tree i_1.succ.castSucc))) + (hcolor : ett.series.data.coloring i_1.succ = choice.selected) + (currentStored : ett.series.data.stored i_1.succ = { choice.color }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { choice.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.SE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some choice.vertex) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some choice.otherEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some choice.color) + (currentGamma : ett.series.data.gamma i_1.succ = none) (adjoined : TreeSequence G e0) + (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree i_1.succ.castSucc) choice.edge adjoined) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) adjoined + (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.SE i_1 previousProper previousOneUncolored + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed + noRevisiting choice seriesAlternative hcolor currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension → + IsProperEdgeColoring G (ett.series.data.coloring i)) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.SE i_1 previousProper previousOneUncolored + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed + noRevisiting choice seriesAlternative hcolor currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension) => + Eq.mpr + (id (congrArg (fun (_a : PartialEdgeColoring E k) => IsProperEdgeColoring G _a) hcolor)) + choice.selectedProper) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data i_1.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i_1.succ.castSucc) + (TashkinovStoredColors ett.series.data i_1.castSucc) + (ett.series.data.coloring i_1.castSucc)) + (seriesAlternativeFails : + ∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (ett.series.data.tree i_1.succ.castSucc))) + (gamma : Fin k) + (gammaRule : + ParallelExtensionColor ett.series.data i_1.castSucc choice.selected choice.vertex gamma) + (secondStable : PartialEdgeColoring E k) + (secondStableProper : IsProperEdgeColoring G secondStable) + (secondStableOneUncolored : IsOneEdgeUncolored secondStable e0) + (secondStableRelation : + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected secondStable) + (exitWitness : + TreeExit (ett.series.data.tree i_1.succ.castSucc) secondStable gamma choice.color + choice.vertex) + (currentColoring : + ett.series.data.coloring i_1.succ = + TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) + (hproper : IsProperEdgeColoring G (ett.series.data.coloring i_1.succ)) + (currentOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.succ) e0) + (currentStored : ett.series.data.stored i_1.succ = { choice.color, gamma }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { choice.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.PE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some choice.vertex) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some choice.otherEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some choice.color) + (currentGamma : ett.series.data.gamma i_1.succ = some gamma) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) + (ett.series.data.tree i_1.succ.castSucc) (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.PE i_1 previousProper previousOneUncolored + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring hproper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension → + IsProperEdgeColoring G (ett.series.data.coloring i)) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.PE i_1 previousProper previousOneUncolored + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring hproper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension) => + hproper) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (hprev : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (available : RevisitingExtensionCertificate ett.series.data i_1.castSucc) + (hcolor : ett.series.data.coloring i_1.succ = ett.series.data.coloring i_1.castSucc) + (currentStored : ett.series.data.stored i_1.succ = { available.delta, available.gamma }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { available.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.RE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some available.insideEndpoint) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some available.outsideEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some available.delta) + (currentGamma : ett.series.data.gamma i_1.succ = some available.gamma) + (adjoined : TreeSequence G e0) + (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree i_1.succ.castSucc) available.edge adjoined) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) adjoined + (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.RE i_1 hprev previousOneUncolored + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed available + hcolor currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension → + IsProperEdgeColoring G (ett.series.data.coloring i)) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.RE i_1 hprev previousOneUncolored + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed + available hcolor currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension) => + Eq.mpr + (id (congrArg (fun (_a : PartialEdgeColoring E k) => IsProperEdgeColoring G _a) hcolor)) + hprev) + (Eq.symm h) hs) + (Eq.refl i) (HEq.refl hs), + replacementOneUncolored := fun (i : Fin (ett.rounds + (1 : ℕ))) => + have hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i := + ett.series.certified i; + TashkinovSeriesStep.casesOn (motive := + fun (a : Fin (ett.rounds + (1 : ℕ))) + (t : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data a) => + i = a → hs ≍ t → IsOneEdgeUncolored (ett.series.data.coloring i) e0) hs + (fun (triple : KTriple G k e0 input) + (seedLength : (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))).length = (1 : ℕ)) + (hi : ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ))) = input) + (initialStored : ett.series.data.stored (0 : Fin (ett.rounds + (1 : ℕ))) = ∅) + (initialEdges : ett.series.data.connectingEdges (0 : Fin (ett.rounds + (1 : ℕ))) = ∅) + (initialKind : ett.series.data.kind (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialVertex : ett.series.data.chosenVertex (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialOutside : ett.series.data.outsideVertex (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialDelta : ett.series.data.delta (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialGamma : ett.series.data.gamma (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialClosure : + TashkinovClosure (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) + (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree (1 : Fin (ett.rounds + (2 : ℕ))))) + (h : i = (0 : Fin (ett.rounds + (1 : ℕ)))) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.initial triple seedLength hi initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure → + IsOneEdgeUncolored (ett.series.data.coloring i) e0) + (fun + (hs : + TashkinovSeriesStep G k ett.rounds e0 input ett.series.data + (0 : Fin (ett.rounds + (1 : ℕ)))) + (_ : + hs ≍ + TashkinovSeriesStep.initial triple seedLength hi initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure) => + Eq.mpr (id (congrFun' (congrArg IsOneEdgeUncolored hi) e0)) + triple.right.right.right.right) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data i_1.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i_1.succ.castSucc) + (TashkinovStoredColors ett.series.data i_1.castSucc) + (ett.series.data.coloring i_1.castSucc)) + (seriesAlternative : + ∀ (pi : PartialEdgeColoring E k), + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (ett.series.data.tree i_1.succ.castSucc))) + (hcolor : ett.series.data.coloring i_1.succ = choice.selected) + (currentStored : ett.series.data.stored i_1.succ = { choice.color }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { choice.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.SE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some choice.vertex) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some choice.otherEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some choice.color) + (currentGamma : ett.series.data.gamma i_1.succ = none) (adjoined : TreeSequence G e0) + (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree i_1.succ.castSucc) choice.edge adjoined) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) adjoined + (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.SE i_1 previousProper previousOneUncolored + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed + noRevisiting choice seriesAlternative hcolor currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension → + IsOneEdgeUncolored (ett.series.data.coloring i) e0) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.SE i_1 previousProper previousOneUncolored + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed + noRevisiting choice seriesAlternative hcolor currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension) => + Eq.mpr + (id (congrArg (fun (_a : PartialEdgeColoring E k) => IsOneEdgeUncolored _a e0) hcolor)) + choice.selectedOneUncolored) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data i_1.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i_1.succ.castSucc) + (TashkinovStoredColors ett.series.data i_1.castSucc) + (ett.series.data.coloring i_1.castSucc)) + (seriesAlternativeFails : + ∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (ett.series.data.tree i_1.succ.castSucc))) + (gamma : Fin k) + (gammaRule : + ParallelExtensionColor ett.series.data i_1.castSucc choice.selected choice.vertex gamma) + (secondStable : PartialEdgeColoring E k) + (secondStableProper : IsProperEdgeColoring G secondStable) + (secondStableOneUncolored : IsOneEdgeUncolored secondStable e0) + (secondStableRelation : + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected secondStable) + (exitWitness : + TreeExit (ett.series.data.tree i_1.succ.castSucc) secondStable gamma choice.color + choice.vertex) + (currentColoring : + ett.series.data.coloring i_1.succ = + TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) + (currentProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.succ)) + (hcurrent : IsOneEdgeUncolored (ett.series.data.coloring i_1.succ) e0) + (currentStored : ett.series.data.stored i_1.succ = { choice.color, gamma }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { choice.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.PE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some choice.vertex) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some choice.otherEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some choice.color) + (currentGamma : ett.series.data.gamma i_1.succ = some gamma) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) + (ett.series.data.tree i_1.succ.castSucc) (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.PE i_1 previousProper previousOneUncolored + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper hcurrent currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension → + IsOneEdgeUncolored (ett.series.data.coloring i) e0) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.PE i_1 previousProper previousOneUncolored + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper hcurrent currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension) => + hcurrent) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (hone : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (available : RevisitingExtensionCertificate ett.series.data i_1.castSucc) + (hcolor : ett.series.data.coloring i_1.succ = ett.series.data.coloring i_1.castSucc) + (currentStored : ett.series.data.stored i_1.succ = { available.delta, available.gamma }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { available.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.RE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some available.insideEndpoint) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some available.outsideEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some available.delta) + (currentGamma : ett.series.data.gamma i_1.succ = some available.gamma) + (adjoined : TreeSequence G e0) + (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree i_1.succ.castSucc) available.edge adjoined) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) adjoined + (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.RE i_1 previousProper hone + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed available + hcolor currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension → + IsOneEdgeUncolored (ett.series.data.coloring i) e0) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.RE i_1 previousProper hone + (fun {_ : E} {_ : Fin k} {_ : V} => previousClosed) previousNotStronglyClosed + available hcolor currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension) => + Eq.mpr + (id (congrArg (fun (_a : PartialEdgeColoring E k) => IsOneEdgeUncolored _a e0) hcolor)) + hone) + (Eq.symm h) hs) + (Eq.refl i) (HEq.refl hs), + replacementStable := fun (i : Fin ett.rounds) => + (⟨fun (f : E) (_ : TreeIncidentEdge (ett.series.data.tree i.succ.castSucc) f) + (_ : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data i.succ, + ett.series.data.coloring i.succ f = some c) => + Eq.refl (ett.series.data.coloring i.succ f), + fun (v : V) (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) => + Eq.refl (MissingColors G (ett.series.data.coloring i.succ) v)⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree i.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data i.succ, + ett.series.data.coloring i.succ f = some c) → + ett.series.data.coloring i.succ f = ett.series.data.coloring i.succ f) ∧ + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc), + MissingColors G (ett.series.data.coloring i.succ) v = + MissingColors G (ett.series.data.coloring i.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + let _ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { + coloring := phi, corresponding := corr, maximum := C.maximum, replacementBase := base, + counterexample := C, + sameGood := + (⟨(⟨rfl, + (⟨rfl, + (⟨HEq.rfl, + (⟨HEq.rfl, + (⟨Iff.rfl, + fun + (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) => + rfl⟩ : + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + base.core = base.core ∧ + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure)), + Exists.intro rfl fun (x : Fin (C.hierarchy.dividerCount + (1 : ℕ))) => + (⟨rfl, fun (x_1 : Fin k) (_ : x_1 ∈ HierarchyStoredColorsAt C.hierarchy x) => rfl⟩ : + HierarchyStoredColorsAt C.hierarchy x = + HierarchyStoredColorsAt C.hierarchy + (Fin.cast + ((by + first + | omega)) + x) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy x, + C.good.gamma x eta = + C.good.gamma + (Fin.cast + ((by + first + | omega)) + x) + eta)⟩ : + SameHierarchyStages C.hierarchy C.hierarchy ∧ + ∃ (hcount : C.hierarchy.dividerCount = C.hierarchy.dividerCount), + ∀ (j : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + have j₂ : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.cast + ((by + first + | omega)) + j; + HierarchyStoredColorsAt C.hierarchy j = HierarchyStoredColorsAt C.hierarchy j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy j, C.good.gamma j eta = C.good.gamma j₂ eta), + minimumContext := ctx : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx }; + let H0 : TashkinovHierarchy ett base := C.hierarchy; + let q0 : Fin (H0.dividerCount + (1 : ℕ)) := Fin.last H0.dividerCount; + let A0 : TreeSequence G e0 := HierarchyStarredStage H0 q0; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (2 : ℕ) ≤ ell → + A0.length + ell = T.length → + B.length = A0.length + (ell - (1 : ℕ)) → + TreeSequenceInitialSegment B T → + ∀ alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)), + ∀ (v : V), + alpha ∈ MissingColors G phi v → + ∀ (r : Fin (B.length + (1 : ℕ))), + B.vertex r = v → + ¬(↑r : ℕ) ≤ A0.length → ∃ a ∈ TreeSequenceVertexSet A0, alpha ∈ MissingColors G phi a + +private abbrev helperHaA166Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + let corr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { + replacementInput := input, replacementSeries := ett.series, replacementETT := ett, + rungAgreement := rfl, seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (i : Fin ett.rounds) => Eq.refl (ett.series.data.tree i.succ.castSucc), + storedColorsAgree := fun (i : Fin (ett.rounds + (1 : ℕ))) => + Eq.refl (ett.series.data.stored i), + connectingEdgesAgree := fun (i : Fin (ett.rounds + (1 : ℕ))) => + Eq.refl (ett.series.data.connectingEdges i), + extensionKindsAgree := fun (i : Fin (ett.rounds + (1 : ℕ))) => + Eq.refl (ett.series.data.kind i), + replacementProper := fun (i : Fin (ett.rounds + (1 : ℕ))) => + have hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i := + ett.series.certified i; + TashkinovSeriesStep.casesOn (motive := + fun (a : Fin (ett.rounds + (1 : ℕ))) + (t : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data a) => + i = a → hs ≍ t → IsProperEdgeColoring G (ett.series.data.coloring i)) hs + (fun (triple : KTriple G k e0 input) + (seedLength : (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))).length = (1 : ℕ)) + (hi : ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ))) = input) + (initialStored : ett.series.data.stored (0 : Fin (ett.rounds + (1 : ℕ))) = ∅) + (initialEdges : ett.series.data.connectingEdges (0 : Fin (ett.rounds + (1 : ℕ))) = ∅) + (initialKind : ett.series.data.kind (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialVertex : ett.series.data.chosenVertex (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialOutside : ett.series.data.outsideVertex (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialDelta : ett.series.data.delta (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialGamma : ett.series.data.gamma (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialClosure : + TashkinovClosure (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) + (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree (1 : Fin (ett.rounds + (2 : ℕ))))) + (h : i = (0 : Fin (ett.rounds + (1 : ℕ)))) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.initial triple seedLength hi initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure → + IsProperEdgeColoring G (ett.series.data.coloring i)) + (fun + (hs : + TashkinovSeriesStep G k ett.rounds e0 input ett.series.data + (0 : Fin (ett.rounds + (1 : ℕ)))) + (_ : + hs ≍ + TashkinovSeriesStep.initial triple seedLength hi initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure) => + Eq.mpr (id (congrArg (IsProperEdgeColoring G) hi)) triple.right.right.right.left) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data i_1.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i_1.succ.castSucc) + (TashkinovStoredColors ett.series.data i_1.castSucc) + (ett.series.data.coloring i_1.castSucc)) + (seriesAlternative : + ∀ (pi : PartialEdgeColoring E k), + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (ett.series.data.tree i_1.succ.castSucc))) + (hcolor : ett.series.data.coloring i_1.succ = choice.selected) + (currentStored : ett.series.data.stored i_1.succ = { choice.color }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { choice.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.SE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some choice.vertex) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some choice.otherEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some choice.color) + (currentGamma : ett.series.data.gamma i_1.succ = none) (adjoined : TreeSequence G e0) + (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree i_1.succ.castSucc) choice.edge adjoined) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) adjoined + (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.SE i_1 previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative hcolor currentStored + currentEdges currentKind currentVertex currentOutside currentDelta currentGamma + adjoined adjoinedExactly closedExtension orderedExtension strictExtension → + IsProperEdgeColoring G (ett.series.data.coloring i)) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.SE i_1 previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative hcolor currentStored + currentEdges currentKind currentVertex currentOutside currentDelta currentGamma + adjoined adjoinedExactly closedExtension orderedExtension strictExtension) => + Eq.mpr + (id (congrArg (fun (_a : PartialEdgeColoring E k) => IsProperEdgeColoring G _a) hcolor)) + choice.selectedProper) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data i_1.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i_1.succ.castSucc) + (TashkinovStoredColors ett.series.data i_1.castSucc) + (ett.series.data.coloring i_1.castSucc)) + (seriesAlternativeFails : + ∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (ett.series.data.tree i_1.succ.castSucc))) + (gamma : Fin k) + (gammaRule : + ParallelExtensionColor ett.series.data i_1.castSucc choice.selected choice.vertex gamma) + (secondStable : PartialEdgeColoring E k) + (secondStableProper : IsProperEdgeColoring G secondStable) + (secondStableOneUncolored : IsOneEdgeUncolored secondStable e0) + (secondStableRelation : + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected secondStable) + (exitWitness : + TreeExit (ett.series.data.tree i_1.succ.castSucc) secondStable gamma choice.color + choice.vertex) + (currentColoring : + ett.series.data.coloring i_1.succ = + TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) + (hproper : IsProperEdgeColoring G (ett.series.data.coloring i_1.succ)) + (currentOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.succ) e0) + (currentStored : ett.series.data.stored i_1.succ = { choice.color, gamma }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { choice.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.PE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some choice.vertex) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some choice.otherEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some choice.color) + (currentGamma : ett.series.data.gamma i_1.succ = some gamma) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) + (ett.series.data.tree i_1.succ.castSucc) (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.PE i_1 previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule + secondStable secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring hproper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension → + IsProperEdgeColoring G (ett.series.data.coloring i)) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.PE i_1 previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule + secondStable secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring hproper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension) => + hproper) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (hprev : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (available : RevisitingExtensionCertificate ett.series.data i_1.castSucc) + (hcolor : ett.series.data.coloring i_1.succ = ett.series.data.coloring i_1.castSucc) + (currentStored : ett.series.data.stored i_1.succ = { available.delta, available.gamma }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { available.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.RE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some available.insideEndpoint) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some available.outsideEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some available.delta) + (currentGamma : ett.series.data.gamma i_1.succ = some available.gamma) + (adjoined : TreeSequence G e0) + (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree i_1.succ.castSucc) available.edge adjoined) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) adjoined + (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.RE i_1 hprev previousOneUncolored previousClosed + previousNotStronglyClosed available hcolor currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension → + IsProperEdgeColoring G (ett.series.data.coloring i)) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.RE i_1 hprev previousOneUncolored previousClosed + previousNotStronglyClosed available hcolor currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension) => + Eq.mpr + (id (congrArg (fun (_a : PartialEdgeColoring E k) => IsProperEdgeColoring G _a) hcolor)) + hprev) + (Eq.symm h) hs) + (Eq.refl i) (HEq.refl hs), + replacementOneUncolored := fun (i : Fin (ett.rounds + (1 : ℕ))) => + have hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i := + ett.series.certified i; + TashkinovSeriesStep.casesOn (motive := + fun (a : Fin (ett.rounds + (1 : ℕ))) + (t : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data a) => + i = a → hs ≍ t → IsOneEdgeUncolored (ett.series.data.coloring i) e0) hs + (fun (triple : KTriple G k e0 input) + (seedLength : (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))).length = (1 : ℕ)) + (hi : ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ))) = input) + (initialStored : ett.series.data.stored (0 : Fin (ett.rounds + (1 : ℕ))) = ∅) + (initialEdges : ett.series.data.connectingEdges (0 : Fin (ett.rounds + (1 : ℕ))) = ∅) + (initialKind : ett.series.data.kind (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialVertex : ett.series.data.chosenVertex (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialOutside : ett.series.data.outsideVertex (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialDelta : ett.series.data.delta (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialGamma : ett.series.data.gamma (0 : Fin (ett.rounds + (1 : ℕ))) = none) + (initialClosure : + TashkinovClosure (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) + (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree (1 : Fin (ett.rounds + (2 : ℕ))))) + (h : i = (0 : Fin (ett.rounds + (1 : ℕ)))) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.initial triple seedLength hi initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure → + IsOneEdgeUncolored (ett.series.data.coloring i) e0) + (fun + (hs : + TashkinovSeriesStep G k ett.rounds e0 input ett.series.data + (0 : Fin (ett.rounds + (1 : ℕ)))) + (_ : + hs ≍ + TashkinovSeriesStep.initial triple seedLength hi initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure) => + Eq.mpr (id (congrFun' (congrArg IsOneEdgeUncolored hi) e0)) + triple.right.right.right.right) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data i_1.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i_1.succ.castSucc) + (TashkinovStoredColors ett.series.data i_1.castSucc) + (ett.series.data.coloring i_1.castSucc)) + (seriesAlternative : + ∀ (pi : PartialEdgeColoring E k), + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (ett.series.data.tree i_1.succ.castSucc))) + (hcolor : ett.series.data.coloring i_1.succ = choice.selected) + (currentStored : ett.series.data.stored i_1.succ = { choice.color }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { choice.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.SE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some choice.vertex) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some choice.otherEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some choice.color) + (currentGamma : ett.series.data.gamma i_1.succ = none) (adjoined : TreeSequence G e0) + (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree i_1.succ.castSucc) choice.edge adjoined) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) adjoined + (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.SE i_1 previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative hcolor currentStored + currentEdges currentKind currentVertex currentOutside currentDelta currentGamma + adjoined adjoinedExactly closedExtension orderedExtension strictExtension → + IsOneEdgeUncolored (ett.series.data.coloring i) e0) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.SE i_1 previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative hcolor currentStored + currentEdges currentKind currentVertex currentOutside currentDelta currentGamma + adjoined adjoinedExactly closedExtension orderedExtension strictExtension) => + Eq.mpr + (id (congrArg (fun (_a : PartialEdgeColoring E k) => IsOneEdgeUncolored _a e0) hcolor)) + choice.selectedOneUncolored) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data i_1.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i_1.succ.castSucc) + (TashkinovStoredColors ett.series.data i_1.castSucc) + (ett.series.data.coloring i_1.castSucc)) + (seriesAlternativeFails : + ∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (ett.series.data.tree i_1.succ.castSucc))) + (gamma : Fin k) + (gammaRule : + ParallelExtensionColor ett.series.data i_1.castSucc choice.selected choice.vertex gamma) + (secondStable : PartialEdgeColoring E k) + (secondStableProper : IsProperEdgeColoring G secondStable) + (secondStableOneUncolored : IsOneEdgeUncolored secondStable e0) + (secondStableRelation : + StableColoring (ett.series.data.tree i_1.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i_1.castSucc)) + choice.selected secondStable) + (exitWitness : + TreeExit (ett.series.data.tree i_1.succ.castSucc) secondStable gamma choice.color + choice.vertex) + (currentColoring : + ett.series.data.coloring i_1.succ = + TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) + (currentProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.succ)) + (hcurrent : IsOneEdgeUncolored (ett.series.data.coloring i_1.succ) e0) + (currentStored : ett.series.data.stored i_1.succ = { choice.color, gamma }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { choice.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.PE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some choice.vertex) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some choice.otherEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some choice.color) + (currentGamma : ett.series.data.gamma i_1.succ = some gamma) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) + (ett.series.data.tree i_1.succ.castSucc) (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.PE i_1 previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule + secondStable secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring currentProper hcurrent currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension → + IsOneEdgeUncolored (ett.series.data.coloring i) e0) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.PE i_1 previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule + secondStable secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring currentProper hcurrent currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension) => + hcurrent) + (Eq.symm h) hs) + (fun (i_1 : Fin ett.rounds) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring i_1.castSucc)) + (hone : IsOneEdgeUncolored (ett.series.data.coloring i_1.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i_1.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i_1.succ.castSucc))) + (available : RevisitingExtensionCertificate ett.series.data i_1.castSucc) + (hcolor : ett.series.data.coloring i_1.succ = ett.series.data.coloring i_1.castSucc) + (currentStored : ett.series.data.stored i_1.succ = { available.delta, available.gamma }) + (currentEdges : ett.series.data.connectingEdges i_1.succ = { available.edge }) + (currentKind : ett.series.data.kind i_1.succ = some TashkinovExtensionKind.RE) + (currentVertex : ett.series.data.chosenVertex i_1.succ = some available.insideEndpoint) + (currentOutside : ett.series.data.outsideVertex i_1.succ = some available.outsideEndpoint) + (currentDelta : ett.series.data.delta i_1.succ = some available.delta) + (currentGamma : ett.series.data.gamma i_1.succ = some available.gamma) + (adjoined : TreeSequence G e0) + (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree i_1.succ.castSucc) available.edge adjoined) + (closedExtension : + TashkinovClosure (ett.series.data.coloring i_1.succ) adjoined + (ett.series.data.tree i_1.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (ett.series.data.tree i_1.succ.castSucc) + (ett.series.data.tree i_1.succ.succ)) + (strictExtension : + (ett.series.data.tree i_1.succ.castSucc).length < + (ett.series.data.tree i_1.succ.succ).length) + (h : i = i_1.succ) => + Eq.ndrec (motive := fun (i : Fin (ett.rounds + (1 : ℕ))) => + ∀ (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i), + hs ≍ + TashkinovSeriesStep.RE i_1 previousProper hone previousClosed previousNotStronglyClosed + available hcolor currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension → + IsOneEdgeUncolored (ett.series.data.coloring i) e0) + (fun (hs : TashkinovSeriesStep G k ett.rounds e0 input ett.series.data i_1.succ) + (_ : + hs ≍ + TashkinovSeriesStep.RE i_1 previousProper hone previousClosed previousNotStronglyClosed + available hcolor currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension) => + Eq.mpr + (id (congrArg (fun (_a : PartialEdgeColoring E k) => IsOneEdgeUncolored _a e0) hcolor)) + hone) + (Eq.symm h) hs) + (Eq.refl i) (HEq.refl hs), + replacementStable := fun (i : Fin ett.rounds) => + (⟨fun (f : E) (_ : TreeIncidentEdge (ett.series.data.tree i.succ.castSucc) f) + (_ : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data i.succ, + ett.series.data.coloring i.succ f = some c) => + Eq.refl (ett.series.data.coloring i.succ f), + fun (v : V) (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) => + Eq.refl (MissingColors G (ett.series.data.coloring i.succ) v)⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree i.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data i.succ, + ett.series.data.coloring i.succ f = some c) → + ett.series.data.coloring i.succ f = ett.series.data.coloring i.succ f) ∧ + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc), + MissingColors G (ett.series.data.coloring i.succ) v = + MissingColors G (ett.series.data.coloring i.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + let _ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { + coloring := phi, corresponding := corr, maximum := C.maximum, replacementBase := base, + counterexample := C, + sameGood := + (⟨(⟨rfl, + (⟨rfl, + (⟨HEq.rfl, + (⟨HEq.rfl, + (⟨Iff.rfl, + fun + (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) => + rfl⟩ : + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + base.core = base.core ∧ + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure)), + Exists.intro rfl fun (x : Fin (C.hierarchy.dividerCount + (1 : ℕ))) => + (⟨rfl, fun (x_1 : Fin k) (_ : x_1 ∈ HierarchyStoredColorsAt C.hierarchy x) => rfl⟩ : + HierarchyStoredColorsAt C.hierarchy x = + HierarchyStoredColorsAt C.hierarchy + (Fin.cast + ((by + first + | omega)) + x) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy x, + C.good.gamma x eta = + C.good.gamma + (Fin.cast + ((by + first + | omega)) + x) + eta)⟩ : + SameHierarchyStages C.hierarchy C.hierarchy ∧ + ∃ (hcount : C.hierarchy.dividerCount = C.hierarchy.dividerCount), + ∀ (j : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + have j₂ : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.cast + ((by + first + | omega)) + j; + HierarchyStoredColorsAt C.hierarchy j = HierarchyStoredColorsAt C.hierarchy j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy j, C.good.gamma j eta = C.good.gamma j₂ eta), + minimumContext := ctx : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx }; + let H0 : TashkinovHierarchy ett base := C.hierarchy; + let q0 : Fin (H0.dividerCount + (1 : ℕ)) := Fin.last H0.dividerCount; + let A0 : TreeSequence G e0 := HierarchyStarredStage H0 q0; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (2 : ℕ) ≤ ell → + TreeSequenceInitialSegment A0 T → + A0.length + ell = T.length → + B.length = A0.length + (ell - (1 : ℕ)) → + TreeSequenceInitialSegment B T → + ∀ alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)), + alpha ∈ TreeMissingColors phi B → alpha ∈ TreeMissingColors phi A0 + +private theorem helper_branch_600.{u_1, u_2} : + helperBranch600Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx noCommon corr P0 H0 q0 A0 ell B htwo hsum + hBlen hBT alpha haLast v hav r hr hrA + let i := r.val - A0.length + have hri : r.val = A0.length + i := by dsimp [i]; omega + have hii : i ∈ Finset.Icc 1 (HierarchyFullTailLength C - 1) := by + have := r.isLt + change i ∈ Finset.Icc 1 (ell - 1) + simp only [Finset.mem_Icc] + omega + let X := HierarchyFullTailPrefix C i + have hXlen : X.length = r.val := by + change min (A0.length + i) T.length = r.val + have := r.isLt + omega + have hXT : TreeSequenceInitialSegment X T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hidx : Fin.castLE (Nat.succ_le_succ hXT.1) (Fin.last X.length) = + Fin.castLE (Nat.succ_le_succ hBT.1) r := Fin.ext hXlen + have hxv : X.vertex (Fin.last X.length) = v := by + rw [← hXT.2.1 _, hidx, hBT.2.1 r, hr] + have hd := noCommon P0 i hii + change Disjoint (MissingColors G phi (X.vertex (Fin.last X.length))) + (MissingColors G phi (T.vertex (Fin.last T.length))) at hd + rw [hxv] at hd + exact False.elim (Finset.disjoint_left.mp hd hav haLast) + +private theorem helper_haA_166.{u_1, u_2} : + helperHaA166Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx noCommon corr P0 H0 q0 A0 ell B htwo hAT + hsum hBlen hBT alpha haLast haB + simp only [TreeMissingColors, Finset.mem_biUnion] at haB ⊢ + obtain ⟨v, hv, hav⟩ := haB + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hv + obtain ⟨r, hr⟩ := hv + by_cases hrA : r.val ≤ A0.length + · let a : Fin (A0.length + 1) := ⟨r.val, by omega⟩ + have hidx : Fin.castLE (Nat.succ_le_succ hAT.1) a = + Fin.castLE (Nat.succ_le_succ hBT.1) r := Fin.ext rfl + have havert : A0.vertex a = v := by + rw [← hAT.2.1 a, hidx, hBT.2.1 r, hr] + refine ⟨v, ?_, hav⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + exact ⟨a, havert⟩ + · exact @helper_branch_600 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx noCommon htwo hsum hBlen hBT alpha haLast v hav r hr hrA +private theorem helper_finish_205.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + HierarchyPathNumber C.hierarchy = (1 : ℕ) → + (∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → + IsOneEdgeUncolored mu e0 → ∀ (v : V), (MissingColors G mu v).Nonempty) → + let eligible : Finset ℕ := + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + let H0 : TashkinovHierarchy ett base := C.hierarchy; + let q0 : Fin (H0.dividerCount + (1 : ℕ)) := Fin.last H0.dividerCount; + let A0 : TreeSequence G e0 := HierarchyStarredStage H0 q0; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + A0.length + ell = T.length → + B.length = A0.length + (ell - (1 : ℕ)) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k), + c ∈ + TreeMissingColors P.coloring + (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)) ∧ + c ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) → + (0 : ℕ) < P.counterexample.hierarchy.dividerCount ∧ + c ∈ + TreeMissingColors P.coloring + (P.counterexample.hierarchy.stage + (⟨P.counterexample.hierarchy.dividerCount, by omega⟩ : + Fin (P.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ + c ∈ + TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc) → + eligible.Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing eligible noCommon + H0 q0 A0 ell B hsum hBlen P c hstart hnormalized + let H := P.counterexample.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + have hmeasures := P2752_T2_HierarchyMeasures C.hierarchy H P.sameGood.1 + have hstar : A0 = A := hmeasures.1 + have hsit : HierarchyPathNumber H = 1 := hmeasures.2.1.symm.trans hsituation + have hsumP : A.length + ell = T.length := by rw [← hstar]; exact hsum + let uses : Finset (Fin T.length) := + Finset.univ.filter fun t => A.length ≤ t.val ∧ P.coloring (T.edge t) = some c + by_cases huse : uses.Nonempty + · let ej := uses.min' huse + have heMem : ej ∈ uses := Finset.min'_mem uses huse + have he := (Finset.mem_filter.mp heMem).2 + have hfirst : ∀ t : Fin T.length, A.length ≤ t.val → t.val < ej.val → + P.coloring (T.edge t) ≠ some c := by + intro t ht hlt hcolor + have htMem : t ∈ uses := Finset.mem_filter.mpr ⟨Finset.mem_univ _, ht, hcolor⟩ + have hle : ej ≤ t := Finset.min'_le uses t htMem + have hval : ej.val ≤ t.val := hle + omega + let j := ej.val - A.length + 1 + have hjLower : 1 ≤ j := by dsimp [j]; omega + have hjUpper : j ≤ HierarchyFullTailLength C := by + have := ej.isLt + change j ≤ ell + dsimp [j] + omega + have hej : ej.val = A.length + (j - 1) := by dsimp [j]; omega + by_cases hjTwo : 2 ≤ j + · exact ⟨j - 1, HierarchyClaimNineFirstUseAfterSeed + G k e0 input T phi ett base C ctx hvertexMissing P hsit c + hstart hnormalized (noCommon P) j hjTwo hjUpper ej hej ⟨he.2, hfirst⟩⟩ + · have hjOne : j = 1 := by omega + have heSeed : ej.val = A.length := by rw [hjOne] at hej; simpa using hej + exact HierarchyClaimNineFirstUseSeed G k e0 input T phi ett base C ctx + hvertexMissing P hsit c hstart hnormalized (noCommon P) ej heSeed he.2 + · have hunused : ∀ t : Fin T.length, A.length ≤ t.val → + P.coloring (T.edge t) ≠ some c := by + intro t ht hcolor + exact huse ⟨t, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ht, hcolor⟩⟩ + exact ⟨ell - 1, HierarchyClaimNineUnusedTailColor + G k e0 input T phi ett base C ctx hvertexMissing P hsit c + hstart hnormalized (noCommon P) hunused⟩ + +theorem HierarchyClaimNine {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hsituation : HierarchyPathNumber C.hierarchy = 1) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty := by + classical + let eligible := HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx + by_contra hnone + have noCommon (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (i : ℕ) (hi : i ∈ Finset.Icc 1 (HierarchyFullTailLength C - 1)) : + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length))) := by + apply Finset.disjoint_left.mpr + intro c hc hcLast + apply hnone + refine ⟨i, ?_⟩ + exact Finset.mem_filter.mpr ⟨hi, P, c, hc, hcLast⟩ + let corr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := by + refine ⟨input, ett.series, ett, rfl, HEq.rfl, ett.generatingColoring, + ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + · intro i + rfl + · intro i + rfl + · intro i + have hs := ett.series.certified i + cases hs with + | initial triple _ hi _ _ _ _ _ _ _ _ => + simpa [hi] using triple.2.2.2.1 + | SE i _ _ _ _ _ choice _ hcolor _ _ _ _ _ _ _ _ _ _ _ => + rw [hcolor] + exact choice.selectedProper + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hproper _ _ _ _ _ _ _ _ _ _ _ => + exact hproper + | RE i hprev _ _ _ _ hcolor _ _ _ _ _ _ _ _ _ _ _ _ => + rw [hcolor] + exact hprev + · intro i + have hs := ett.series.certified i + cases hs with + | initial triple _ hi _ _ _ _ _ _ _ _ => + simpa [hi] using triple.2.2.2.2 + | SE i _ _ _ _ _ choice _ hcolor _ _ _ _ _ _ _ _ _ _ _ => + rw [hcolor] + exact choice.selectedOneUncolored + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hcurrent _ _ _ _ _ _ _ _ _ _ => + exact hcurrent + | RE i _ hone _ _ _ hcolor _ _ _ _ _ _ _ _ _ _ _ _ => + rw [hcolor] + exact hone + · intro i + constructor + · intro f hf h + rfl + · intro v hv + rfl + let P0 : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx := by + refine ⟨phi, corr, C.maximum, base, C, ?_, ?_⟩ + · refine ⟨?_, ?_⟩ + · exact ⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩ + · exact ⟨rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + · exact ctx + let H0 := C.hierarchy + let q0 : Fin (H0.dividerCount + 1) := Fin.last H0.dividerCount + let A0 := HierarchyStarredStage H0 q0 + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (ell - 1) + have htwo : 2 ≤ ell := + HierarchyCounterexampleTailAtLeastTwo G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have hAT : TreeSequenceInitialSegment A0 T := by + have hs : TreeSequenceInitialSegment + (HierarchyStarredStage H0 q0) (H0.stage q0.succ) := by + refine Fin.cases ?_ (fun i => ?_) q0 + · exact H0.coreInsideFirst + · exact H0.nested i.succ + have hlast : q0.succ = Fin.last (H0.dividerCount + 1) := Fin.ext rfl + simpa only [hlast, H0.terminalStage] using hs + have hsum : A0.length + ell = T.length := Nat.add_sub_of_le hAT.1 + have hBlen : B.length = A0.length + (ell - 1) := by + change min (A0.length + (ell - 1)) T.length = A0.length + (ell - 1) + omega + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + obtain ⟨alpha, haB, haLast⟩ := + HierarchyCounterexampleTerminalCommonMissing G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + change alpha ∈ TreeMissingColors phi B at haB + have haA : alpha ∈ TreeMissingColors phi A0 := by + exact @helper_haA_166 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx noCommon htwo hAT hsum hBlen hBT alpha haLast haB + have finish (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) (c : Fin k) + (hstart : c ∈ TreeMissingColors P.coloring + (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)) ∧ + c ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) + (hnormalized : + (0 < P.counterexample.hierarchy.dividerCount ∧ + c ∈ TreeMissingColors P.coloring + (P.counterexample.hierarchy.stage + ⟨P.counterexample.hierarchy.dividerCount, by omega⟩)) ∨ + (P.counterexample.hierarchy.dividerCount = 0 ∧ + c ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc))) : + eligible.Nonempty := by + exact @helper_finish_205 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hsituation hvertexMissing noCommon hsum hBlen P c hstart + hnormalized + have hstart : alpha ∈ TreeMissingColors P0.coloring + (HierarchyStarredStage P0.counterexample.hierarchy + (Fin.last P0.counterexample.hierarchy.dividerCount)) ∧ + alpha ∈ MissingColors G P0.coloring (T.vertex (Fin.last T.length)) := + ⟨haA, haLast⟩ + by_cases hpos : 0 < H0.dividerCount + · have lastStage (d : ℕ) (s : Fin (d + 2) → TreeSequence G e0) + (core : TreeSequence G e0) (hd : 0 < d) : + Fin.cases core (fun i : Fin d => s i.succ.castSucc) (Fin.last d) = + s ⟨d, by omega⟩ := by + cases d with + | zero => omega + | succ n => + have hi : Fin.last (n + 1) = (Fin.last n).succ := Fin.ext rfl + rw [hi] + rfl + have hAeq : A0 = H0.stage ⟨H0.dividerCount, by omega⟩ := + lastStage _ _ _ hpos + apply hnone + apply finish P0 alpha hstart + exact Or.inl ⟨hpos, hAeq ▸ haA⟩ + · have hzero : H0.dividerCount = 0 := Nat.eq_zero_of_not_pos hpos + have hAcore : A0 = base.core := by + have hi : q0 = 0 := Fin.ext (by simp [q0, hzero]) + dsimp only [A0] + rw [hi] + rfl + by_cases haTn : alpha ∈ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + · exact hnone (finish P0 alpha hstart (Or.inr ⟨hzero, haTn⟩)) + · have hpe : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := by + by_contra hnotPE + have hcore := base.nonparallel hnotPE + exact haTn (by simpa only [hAcore, hcore] using haA) + rcases HierarchyClaimNinePENormalization + G k e0 input T phi ett base C ctx hvertexMissing P0 alpha + hzero hpe hstart haTn (noCommon P0) with hdone | ⟨P, c, hTn, hA, hLast, _⟩ + · exact hnone hdone + · have hcount : P.counterexample.hierarchy.dividerCount = 0 := + P.sameGood.1.2.1.symm.trans hzero + exact hnone (finish P c ⟨hA, hLast⟩ (Or.inr ⟨hcount, hTn⟩)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean new file mode 100644 index 0000000000..35c648b36c --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean @@ -0,0 +1,1753 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyClaimNineUnusedTailColor +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyClaimNinePENormalization +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.BaseControl +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment + +/-! +# Hierarchy Claim Nine First Use After Seed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable abbrev helperCs723.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (alpha : Fin k) → + (j : ℕ) → + let mu : PartialEdgeColoring E k := P.coloring; + let em : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := + P.counterexample; + let H : + TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase := + Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let X : TreeSequence G e0 := + HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + (hsum : A.length + ell = T.length) → + (hXT : TreeSequenceInitialSegment X T) → + let ip : Fin (T.length + (1 : ℕ)) := + (⟨X.length, by + have this : X.length ≤ T.length := hXT.1; + omega⟩ : + Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; + x ∈ TreeSequenceVertexSet B → + (beta : Fin k) → + beta ∈ MissingColors G mu x → + x ≠ y → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G mu alpha beta + (Sum.inl y); + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = + MissingColors G mu v) → + beta ∈ MissingColors G sigma y → + (corr : + CorrespondingExtendedTashkinovTree G + k e0 em sigma T) → + MaximumProperty corr.replacementETT → + (bs : + HierarchyBase + corr.replacementETT sigma) → + (K : + TashkinovHierarchy + corr.replacementETT bs) → + GoodHierarchy K → + x ∈ TreeSequenceVertexSet T → + y ∈ + TreeSequenceVertexSet + T → + HierarchyCounterexample + bs := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j mu em Cm H q A ell B X y hsum hXT ip + x hxB beta hbeta hxy sigma hmissingB hbetaNewY corr hmax bs K good hxT hyT + exact { + positive := by rw [corr.rungAgreement]; exact Cm.positive + hierarchy := K + good := good + maximum := hmax + notElementary := by + intro he + have hbnew : beta ∈ MissingColors G sigma x := by rw [hmissingB x hxB]; exact hbeta + exact Finset.disjoint_left.mp (he hxT hyT hxy) hbnew hbetaNewY } + +private abbrev helperContinuation1607Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ), (2 : ℕ) ≤ j → j ≤ HierarchyFullTailLength C → + ∀ (ej : Fin T.length), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); (↑ej : ℕ) = A.length + (j - (1 : ℕ))) → + (P.coloring (T.edge ej) = some alpha ∧ + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑ej : ℕ) → P.coloring (T.edge t) ≠ + some alpha) → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); ( + ∀ (i : ℕ), HierarchyFullTailPrefix C i = HierarchyFullTailPrefix Cm i) → j ≤ ell → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → TreeSequenceInitialSegment A T + → A.length + ell = T.length → B.length = T.length - (1 : ℕ) → X.length = A.length + (j - + (1 : ℕ)) → A.length < X.length → X.length ≤ B.length → TreeSequenceInitialSegment B T → + ∀ (hXT : TreeSequenceInitialSegment X T), ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U W + → S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment A X → + TreeSequenceInitialSegment X B → TreeSequenceInitialSegment A B → + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + have this : X.length ≤ T.length := hXT.1; Decidable.byContradiction fun (a : ¬X.length < + T.length + (1 : ℕ)) ↦ + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; X.vertex (Fin.last X.length) = x → x ∈ TreeSequenceVertexSet X → x ∈ + TreeSequenceVertexSet B → j - (1 : ℕ) ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 + : ℕ)) → + ∀ beta ∈ MissingColors G mu x, alpha ∈ TreeMissingColors mu A → alpha ≠ beta → ( + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G rho (T.vertex i) → c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ HierarchyFirstMissingPosition rho T c ≤ i) → + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T beta; + let a : V := T.vertex ia; alpha ∈ MissingColors G mu a → (↑ia : ℕ) ≤ A.length → ib = ip → a ∈ + TreeSequenceVertexSet A → a ∈ TreeSequenceVertexSet B → alpha ∈ TreeMissingColors mu B ∧ + beta ∈ TreeMissingColors mu B → (↑ej : ℕ) = X.length → x ≠ y → Disjoint (TwoColorComponent + G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length)))) (TwoColorComponent G + P.coloring alpha beta (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T + alpha)))) → TwoColorPathComponent G mu alpha beta (Sum.inl y) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); (0 : + ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors mu (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + mu (em.series.data.tree (Fin.last em.rounds).castSucc) ∨ alpha ∈ TreeMissingColors mu A ∧ + alpha ∉ TashkinovStoredColors em.series.data (Fin.last em.rounds) ∧ beta ∉ + TashkinovStoredColors em.series.data (Fin.last em.rounds)) → (if em.series.data.kind + (Fin.last em.rounds) = some TashkinovExtensionKind.PE then CombinedStableColoring + (em.series.data.tree (Fin.last em.rounds).castSucc) bm.closure (TashkinovStoredColors + em.series.data (Fin.last em.rounds)) mu sigma else StableColoring (em.series.data.tree + (Fin.last em.rounds).castSucc) (TashkinovStoredColors em.series.data (Fin.last em.rounds)) + mu sigma) → IsOneEdgeUncolored sigma e0 → HierarchyWeaklyStable H q sigma → ( + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G (TwoColorComponentSwap G mu + alpha beta (Sum.inl y)) v ↔ c ∈ MissingColors G mu v)) → ( + ∀ v ∈ TreeSequenceVertexSet (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength + P.counterexample - (1 : ℕ))), MissingColors G (TwoColorComponentSwap G P.coloring alpha + beta (Sum.inl (T.vertex (Fin.last T.length)))) v = MissingColors G P.coloring v) → beta ∈ + MissingColors G sigma y → ( + ∀ (t : Fin T.length), (HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).length ≤ (↑t : ℕ) → (↑t : ℕ) < + (HierarchyFullTailPrefix P.counterexample (j - (1 : ℕ))).length → TwoColorComponentSwap G + P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length))) (T.edge t) = P.coloring + (T.edge t)) → j - (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett + base C ctx + +private theorem helper_hAT_246.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P Cm H q A + have hs : TreeSequenceInitialSegment (HierarchyStarredStage H q) (H.stage q.succ) := by + refine Fin.cases ?_ (fun i => ?_) q + · exact H.coreInsideFirst + · exact H.nested i.succ + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa only [hlast, H.terminalStage] using hs + +private theorem helper_commonPrefix_268.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U + W → S.length ≤ U.length → TreeSequenceInitialSegment S U := by + classical + intro V E G e0 S U W hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +private theorem helper_hyNotB_289.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (ej : Fin + T.length), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); (↑ej : ℕ) = A.length + (j - (1 : ℕ))) → + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); A.length + ell = T.length → B.length = T.length - + (1 : ℕ) → X.length = A.length + (j - (1 : ℕ)) → X.length ≤ B.length → + TreeSequenceInitialSegment B T → y ∉ TreeSequenceVertexSet B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P j ej hej Cm H q A ell B X y hsum hBlen + hXlen hXleB hBT hy + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hy + obtain ⟨i, hi⟩ := hy + have he := T.vertex_injective ((hBT.2.1 i).trans hi) + have hv := congrArg Fin.val he + have := i.isLt + simp only [Fin.val_castLE, Fin.val_last] at hv + omega + +private theorem helper_firstSpec_312.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (_ : ℕ) (rho : PartialEdgeColoring E k) + (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G rho (T.vertex i) → + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + HierarchyFirstMissingPosition rho T c ≤ i := by + classical + intro V E _ _ G k e0 T j rho c i hi + let _ := Fintype.ofFinite V + let s : Finset (Fin (T.length + 1)) := + Finset.univ.filter fun j => c ∈ MissingColors G rho (T.vertex j) + have his : i ∈ s := by simp [s, hi] + have hs : s.Nonempty := ⟨i, his⟩ + have hp : HierarchyFirstMissingPosition rho T c = s.min' hs := by + simp only [HierarchyFirstMissingPosition, s, dite_eq_left hs] + rw [hp] + exact ⟨(Finset.mem_filter.mp (Finset.min'_mem s hs)).2, Finset.min'_le s i his⟩ + +private theorem helper_hib_340.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : Fin k) (j : ℕ) (_ + : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → + ∀ (_ : A.length + ell = T.length), B.length = T.length - (1 : ℕ) → X.length ≤ B.length → + TreeSequenceInitialSegment B T → + ∀ (hXT : TreeSequenceInitialSegment X T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + by have this : X.length ≤ T.length := hXT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; x ∈ TreeSequenceVertexSet B → + ∀ beta ∈ MissingColors G mu x, ( + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G rho (T.vertex i) → c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ HierarchyFirstMissingPosition rho T c ≤ i) → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T beta; ib = ip := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej mu Cm H q A ell B X helem hsum + hBlen hXleB hBT hXT ip x hxB beta hbeta firstSpec ib + have hs := firstSpec mu beta ip hbeta + have hbound : ib.val ≤ B.length := le_trans hs.2 hXleB + let i : Fin (B.length + 1) := ⟨ib.val, by omega⟩ + have hi : Fin.castLE (Nat.succ_le_succ hBT.1) i = ib := Fin.ext rfl + have hbB : T.vertex ib ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, (hBT.2.1 i).symm.trans (congrArg T.vertex hi)⟩ + have hv : T.vertex ib = x := by + by_contra hn + exact Finset.disjoint_left.mp (helem hbB hxB hn) hs.1 hbeta + exact T.vertex_injective hv + +private theorem helper_hordered_369.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ) (ej : Fin T.length), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); (↑ej : ℕ) = A.length + (j - (1 : ℕ))) → + (P.coloring (T.edge ej) = some alpha ∧ + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑ej : ℕ) → P.coloring (T.edge t) ≠ + some alpha) → + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + ∀ (_ : A.length + ell = T.length), X.length = A.length + (j - (1 : ℕ)) → A.length < X.length → + ∀ (hXT : TreeSequenceInitialSegment X T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + by have this : X.length ≤ T.length := hXT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (beta : Fin k), + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T beta; + let a : V := T.vertex ia; (↑ia : ℕ) ≤ A.length → ib = ip → (↑ej : ℕ) = X.length → alpha ∉ + TreeMissingColors mu A ∨ beta ∉ TreeMissingColors mu A → TreeVertexOrder T a (T.vertex ib) + ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ mu (T.edge t) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej hej hfirst mu Cm H q A ell X + hsum hXlen hAXstrict hXT ip beta ia ib a hia hib hejX _ + refine ⟨⟨ia, ib, rfl, rfl, ?_⟩, ?_⟩ + · rw [hib] + change ia.val < X.length + omega + · simp only [Finset.mem_filter, Finset.mem_univ, true_and] + rintro ⟨t, ht, hlt, he⟩ + have hltX : t.val < X.length := by simpa only [hib] using hlt + exact hfirst.2 t ht (by omega) he + +private theorem helper_hsame_386.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), ( + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; (0 : ℕ) < H.dividerCount ∧ alpha ∈ + TreeMissingColors P.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ alpha ∈ TreeMissingColors + P.coloring (P.corresponding.replacementETT.series.data.tree n.castSucc)) → + ∀ (j : ℕ) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + ∀ (_ : A.length + ell = T.length) (hXT : TreeSequenceInitialSegment X T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + by have this : X.length ≤ T.length := hXT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; + ∀ (beta : Fin k), + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T beta; + let a : V := T.vertex ia; ib = ip → ( + let H : TashkinovHierarchy em bm := Cm.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors em.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition mu T alpha); + have vb : V := T.vertex (HierarchyFirstMissingPosition mu T beta); + have sameComponent : Prop := TwoColorComponent G mu alpha beta (Sum.inl va) = + TwoColorComponent G mu alpha beta (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (alpha ∈ + TreeMissingColors mu Tnq ∨ Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors mu + Tn ∨ Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (alpha ∈ TreeMissingColors mu A ∧ TreeColorSetClosed G mu A ({ alpha } : + Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A mu alpha beta)) → + TwoColorComponent G mu alpha beta (Sum.inl a) = TwoColorComponent G mu alpha beta (Sum.inl + x) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha hnormalized j ej mu em bm Cm H q A + ell X hsum hXT ip x beta ia ib a hib changeResult + have hc : TwoColorComponent G mu alpha beta (Sum.inl a) = + TwoColorComponent G mu alpha beta (Sum.inl (T.vertex ib)) := by + rcases hnormalized with hp | hz + · exact changeResult.1 ⟨hp.1, Or.inl hp.2⟩ + · exact changeResult.2.1 ⟨hz.1, Or.inl hz.2⟩ + simpa only [hib] using hc + +private theorem helper_leaf_399.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); j ≤ ell → + ∀ (_ : A.length + ell = T.length) (hXT : TreeSequenceInitialSegment X T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + by have this : X.length ≤ T.length := hXT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; X.vertex (Fin.last X.length) = x → + ∀ (beta : Fin k), alpha ≠ beta → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu alpha beta; + ∀ (v : V), alpha ∈ MissingColors G mu v ∨ beta ∈ MissingColors G mu v → (J.neighborSet + (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej mu Cm cm H q A ell X hj hsum + hXT ip x hx beta hne J v hv + have hd : @SimpleGraph.degree _ J (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hv with hv | hv + · exact MissingColorIncidenceEndpoint G mu alpha beta hne cm.proper v hv + · have hj : J = TwoColorIncidenceGraph G mu beta alpha := by + ext x z + cases x <;> cases z <;> simp [J, TwoColorIncidenceGraph, or_comm] + rw [hj] + exact MissingColorIncidenceEndpoint G mu beta alpha hne.symm cm.proper v hv + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx z hz + exact Finset.card_le_one_iff.mp hd + (by simpa only [SimpleGraph.mem_neighborFinset, SimpleGraph.mem_neighborSet] using hx) + (by simpa only [SimpleGraph.mem_neighborFinset, SimpleGraph.mem_neighborSet] using hz) + +private theorem helper_hdisjoint_416.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ (_ : A.length + ell = T.length) (hXT : TreeSequenceInitialSegment X T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + by have this : X.length ≤ T.length := hXT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; + ∀ beta ∈ MissingColors G mu x, alpha ∈ MissingColors G mu y → + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let a : V := T.vertex ia; alpha ∈ MissingColors G mu a → a ≠ x → TwoColorComponent G mu alpha + beta (Sum.inl a) = TwoColorComponent G mu alpha beta (Sum.inl x) → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu alpha beta; + let Q : Set (V ⊕ E) := TwoColorComponent G mu alpha beta (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G mu alpha beta (Sum.inl v)) → ( + ∀ (v : V), alpha ∈ MissingColors G mu v ∨ beta ∈ MissingColors G mu v → (J.neighborSet + (Sum.inl v)).Subsingleton) → a ≠ y → x ≠ y → Disjoint Q (TwoColorComponent G mu alpha beta + (Sum.inl a)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej mu Cm cm H q A ell X y hsum + hXT ip x beta hbeta haY ia a ha hab hsame J Q self leaf hay hxy + rcases TwoColorComponentsDisjoint G mu alpha beta (Sum.inl y) (Sum.inl a) with heq | hd + · obtain ⟨u, v, path, hp, hs⟩ := + TwoColorComponentSpanningPath G mu alpha beta cm.proper (Sum.inl y) + have endpoint (w : V) (hw : Sum.inl w ∈ Q) + (hl : Set.Subsingleton (J.neighborSet (Sum.inl w))) : + Sum.inl w = u ∨ Sum.inl w = v := by + have hm : Sum.inl w ∈ path.support := by + change Sum.inl w ∈ {x | x ∈ path.support} + rw [hs] + exact hw + by_contra hn + push Not at hn + exact hp.isTrail.notMem_support_of_subsingleton_neighborSet hn.1 hn.2 hl hm + change Q = TwoColorComponent G mu alpha beta (Sum.inl a) at heq + have haQ : Sum.inl a ∈ Q := by rw [heq]; exact self a + have hbQ : Sum.inl x ∈ Q := by rw [heq, hsame]; exact self x + have hae := endpoint a haQ (leaf a (Or.inl ha)) + have hbe := endpoint x hbQ (leaf x (Or.inr hbeta)) + have hye := endpoint y (self y) (leaf y (Or.inl haY)) + have hnab : (Sum.inl a : Sum V E) ≠ Sum.inl x := fun h => hab (Sum.inl.inj h) + have hnay : (Sum.inl a : Sum V E) ≠ Sum.inl y := fun h => hay (Sum.inl.inj h) + have hnby : (Sum.inl x : Sum V E) ≠ Sum.inl y := fun h => hxy (Sum.inl.inj h) + rcases hae with hae | hae <;> rcases hbe with hbe | hbe <;> + rcases hye with hye | hye <;> simp_all + · exact hd + +private theorem helper_edgeOfVertex_465.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let y : V := T.vertex (Fin.last T.length); + ∀ (beta : Fin k), + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu alpha beta; + let Q : Set (V ⊕ E) := TwoColorComponent G mu alpha beta (Sum.inl y); + ∀ {v : V} {f : E}, Sum.inl v ∈ Q → Incident G v f → mu f = some alpha ∨ mu f = some beta → + Sum.inr f ∈ Q := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu y beta J Q v f hv hf hc + change J.connectedComponentMk (Sum.inl v) = J.connectedComponentMk (Sum.inl y) at hv + change J.connectedComponentMk (Sum.inr f) = J.connectedComponentMk (Sum.inl y) + have hadj : J.Adj (Sum.inr f) (Sum.inl v) := by + simpa only [J, TwoColorIncidenceGraph] using And.intro hf hc + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv + +private theorem helper_hmissingB_473.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); ColoredVertexSetElementary G mu + (TreeSequenceVertexSet B) → + ∀ (_ : A.length + ell = T.length) (hXT : TreeSequenceInitialSegment X T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + by have this : X.length ≤ T.length := hXT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; x ∈ TreeSequenceVertexSet B → + ∀ beta ∈ MissingColors G mu x, alpha ≠ beta → + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let a : V := T.vertex ia; alpha ∈ MissingColors G mu a → a ∈ TreeSequenceVertexSet B → + TwoColorComponent G mu alpha beta (Sum.inl a) = TwoColorComponent G mu alpha beta (Sum.inl + x) → + let Q : Set (V ⊕ E) := TwoColorComponent G mu alpha beta (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G mu alpha beta (Sum.inl v)) → Disjoint Q + (TwoColorComponent G mu alpha beta (Sum.inl a)) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G mu alpha beta (Sum.inl y) → MissingColors G + (TwoColorComponentSwap G mu alpha beta (Sum.inl y)) v = MissingColors G mu v) → ( + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G (TwoColorComponentSwap G mu + alpha beta (Sum.inl y)) v ↔ c ∈ MissingColors G mu v)) → ( + ∀ {v : V} {f : E}, Sum.inl v ∈ Q → Incident G v f → mu f = some alpha ∨ mu f = some beta → + Sum.inr f ∈ Q) → + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej mu Cm H q A ell B X y helem + hsum hXT ip x hxB beta hbeta hne ia a ha haB hsame Q self hdisjoint sigma missingOutside + missingOther edgeOfVertex v hv + by_cases hvQ : Sum.inl v ∈ Q + · have hva : v ≠ a := by + intro he + subst v + exact Set.disjoint_left.mp hdisjoint hvQ (self a) + have hvb : v ≠ x := by + intro he + subst v + apply Set.disjoint_left.mp hdisjoint hvQ + rw [hsame] + exact self x + have hna : alpha ∉ MissingColors G mu v := fun hm => + Finset.disjoint_left.mp (helem hv haB hva) hm ha + have hnb : beta ∉ MissingColors G mu v := fun hm => + Finset.disjoint_left.mp (helem hv hxB hvb) hm hbeta + obtain ⟨fa, hfa, hfca⟩ : ∃ f, Incident G v f ∧ mu f = some alpha := by + simpa [MissingColors, PresentColors] using hna + obtain ⟨fb, hfb, hfcb⟩ : ∃ f, Incident G v f ∧ mu f = some beta := by + simpa [MissingColors, PresentColors] using hnb + have hfaQ := edgeOfVertex hvQ hfa (Or.inl hfca) + have hfbQ := edgeOfVertex hvQ hfb (Or.inr hfcb) + simp only [Q] at hfaQ hfbQ + have hnewa : sigma fb = some alpha := by + simp [sigma, TwoColorComponentSwap, hfbQ, hfcb, hne.symm] + have hnewb : sigma fa = some beta := by + simp [sigma, TwoColorComponentSwap, hfaQ, hfca] + have hnsa : alpha ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, not_not] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fb, hfb, hnewa⟩ + have hnsb : beta ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, not_not] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fa, hfa, hnewb⟩ + ext c + by_cases hca : c = alpha + · subst c; simp only [hna, hnsa] + by_cases hcb : c = beta + · subst c; simp only [hnb, hnsb] + exact missingOther v c hca hcb + · exact missingOutside v hvQ + +private theorem helper_seedIncident_520.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (f : E), TashkinovSeriesStep G k em.rounds e0 P.corresponding.replacementInput + em.series.data (Fin.last em.rounds) → em.series.data.kind (Fin.last em.rounds) = some + TashkinovExtensionKind.SE ∨ em.series.data.kind (Fin.last em.rounds) = some + TashkinovExtensionKind.RE → em.series.data.connectingEdges (Fin.last em.rounds) = ({ f } : + Finset E) → TreeIncidentEdge (em.series.data.tree (Fin.last em.rounds).castSucc) f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P em f hstep hkind hedges + generalize hn : Fin.last em.rounds = r at hstep hkind hedges ⊢ + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + rw [initialKind] at hkind + simp at hkind + | SE r previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have he : choice.edge = f := Finset.singleton_injective (currentEdges.symm.trans hedges) + rw [← he] + exact ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + | PE r previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + rw [currentKind] at hkind + simp at hkind + | RE r previousProper previousOneUncolored previousClosed previousNotStronglyClosed + available currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have he : available.edge = f := Finset.singleton_injective (currentEdges.symm.trans hedges) + rw [← he] + refine ⟨available.insideEndpoint, available.insideInCurrent, ?_⟩ + simp only [Incident, available.edgeEnds, Sym2.mem_iff, true_or] + +private theorem helper_hfixedPrefix_556.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ) (ej : Fin T.length), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); (↑ej : ℕ) = A.length + (j - (1 : ℕ))) → + (P.coloring (T.edge ej) = some alpha ∧ + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑ej : ℕ) → P.coloring (T.edge t) ≠ + some alpha) → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); ColoredVertexSetElementary G mu + (TreeSequenceVertexSet B) → + ∀ (_ : A.length + ell = T.length), X.length = A.length + (j - (1 : ℕ)) → A.length < X.length → + ∀ (hXT : TreeSequenceInitialSegment X T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + by have this : X.length ≤ T.length := hXT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; X.vertex (Fin.last X.length) = x → + ∀ beta ∈ MissingColors G mu x, (↑ej : ℕ) = X.length → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); (if + em.series.data.kind (Fin.last em.rounds) = some TashkinovExtensionKind.PE then + CombinedStableColoring (em.series.data.tree (Fin.last em.rounds).castSucc) bm.closure + (TashkinovStoredColors em.series.data (Fin.last em.rounds)) mu sigma else StableColoring + (em.series.data.tree (Fin.last em.rounds).castSucc) (TashkinovStoredColors em.series.data + (Fin.last em.rounds)) mu sigma) → ( + ∀ (f : E), TashkinovSeriesStep G k em.rounds e0 P.corresponding.replacementInput + em.series.data (Fin.last em.rounds) → em.series.data.kind (Fin.last em.rounds) = some + TashkinovExtensionKind.SE ∨ em.series.data.kind (Fin.last em.rounds) = some + TashkinovExtensionKind.RE → em.series.data.connectingEdges (Fin.last em.rounds) = ({ f } : + Finset E) → TreeIncidentEdge (em.series.data.tree (Fin.last em.rounds).castSucc) f) → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → sigma (T.edge t) = mu + (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej hej hfirst mu em bm Cm H q A + ell B X y helem hsum hXlen hAXstrict hXT ip x hx beta hbeta hejX sigma hbaseStable + seedIncident t ht hlt + have hna : mu (T.edge t) ≠ some alpha := hfirst.2 t ht (by omega) + by_cases hb : mu (T.edge t) = some beta + · let tX : Fin X.length := ⟨t.val, hlt⟩ + have hcast : Fin.castLE hXT.1 tX = t := Fin.ext rfl + have heX : mu (X.edge tX) = some beta := by + rw [← hXT.2.2 tX, hcast] + exact hb + obtain ⟨hzero, hcore, hpos, f, hstep, hkind, hedges, hedge, hcolor, hstored⟩ := + HierarchyTailMissingColorExclusion G k e0 P.corresponding.replacementInput T mu em bm H + helem (j - 1) (by omega) (by change j - 1 < ell; omega) + beta (hx.symm ▸ hbeta) tX ht (by change t.val < A.length + (j - 1); omega) heX + have hnotPE : em.series.data.kind (Fin.last em.rounds) ≠ + some TashkinovExtensionKind.PE := by + rcases hkind with hs | hr + · rw [hs]; simp + · rw [hr]; simp + have hstable : StableColoring (em.series.data.tree (Fin.last em.rounds).castSucc) + (TashkinovStoredColors em.series.data (Fin.last em.rounds)) mu sigma := by + simpa only [ite_eq_right hnotPE] using hbaseStable + have hf := hstable.1 f (seedIncident f hstep hkind hedges) + ⟨beta, Finset.mem_union_right _ hstored, hcolor⟩ + have he : T.edge t = f := by rw [← hcast, hXT.2.2 tX]; exact hedge + simpa only [he] using hf + · simp [sigma, TwoColorComponentSwap, hna, hb] + +private theorem helper_hstoredFirst_583.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); ColoredVertexSetElementary G mu + (TreeSequenceVertexSet B) → + ∀ (_ : A.length + ell = T.length), B.length = T.length - (1 : ℕ) → X.length ≤ B.length → + TreeSequenceInitialSegment B T → + ∀ (hXT : TreeSequenceInitialSegment X T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + by have this : X.length ≤ T.length := hXT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; x ∈ TreeSequenceVertexSet B → + ∀ beta ∈ MissingColors G mu x, alpha ∈ TreeMissingColors mu A → ( + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G rho (T.vertex i) → c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ HierarchyFirstMissingPosition rho T c ≤ i) → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T beta; ib = ip → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); ( + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G (TwoColorComponentSwap G mu + alpha beta (Sum.inl y)) v ↔ c ∈ MissingColors G mu v)) → ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v) → + ∀ eta ∈ HierarchyStoredColorsAt H q, HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition mu T eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej mu Cm H q A ell B X y helem + hsum hBlen hXleB hBT hXT ip x hxB beta hbeta haA firstSpec ib hib sigma missingOther + hmissingB eta heta + have hnotA : eta ∉ TreeMissingColors mu A := (Finset.mem_sdiff.mp heta).2 + have hna : eta ≠ alpha := by intro he; exact hnotA (he.symm ▸ haA) + by_cases heb : eta = beta + · subst eta + have hbnew : beta ∈ MissingColors G sigma x := by rw [hmissingB x hxB]; exact hbeta + have hs := firstSpec sigma beta ip hbnew + let is := HierarchyFirstMissingPosition sigma T beta + have hbound : is.val ≤ B.length := le_trans hs.2 hXleB + let i : Fin (B.length + 1) := ⟨is.val, by omega⟩ + have hi : Fin.castLE (Nat.succ_le_succ hBT.1) i = is := Fin.ext rfl + have hvB : T.vertex is ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, (hBT.2.1 i).symm.trans (congrArg T.vertex hi)⟩ + have hbOld : beta ∈ MissingColors G mu (T.vertex is) := by + rw [← hmissingB _ hvB] + exact hs.1 + have hv : T.vertex is = x := by + by_contra hn + exact Finset.disjoint_left.mp (helem hvB hxB hn) hbOld hbeta + exact (T.vertex_injective hv).trans hib.symm + · have heq : (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G sigma (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G mu (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact missingOther _ eta hna heb + simp only [HierarchyFirstMissingPosition, heq] + +private theorem helper_segTrans_616.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U + W → TreeSequenceInitialSegment S W := by + classical + intro V E G e0 S U W hSU hUW + refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + +private theorem helper_lastPositive_633.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : Fin k) + (j : ℕ) (_ : Fin T.length), + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + ∀ (_ : A.length + ell = T.length) (_ : TreeSequenceInitialSegment X T) (_ : Fin k), + H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej Cm H q A ell X hsum hXT beta hz + obtain hzero | ⟨r, hr⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hr, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hr + simpa [q] using hv.symm + +private theorem helper_coreToA_644.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : Fin k) (j : ℕ) (_ + : Fin T.length), + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + ∀ (_ : A.length + ell = T.length) (_ : TreeSequenceInitialSegment X T) (_ : Fin k), ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) → ( + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))) → (H.dividerCount = (0 : ℕ) → A = bm.core) → + (H.dividerCount ≠ (0 : ℕ) → A = H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → TreeSequenceInitialSegment bm.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej bm Cm H q A ell X hsum hXT + beta segTrans stageSegment lastZero lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz]; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + +private theorem helper_hbetaNotA_656.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : Fin k) (j : ℕ) (_ + : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → TreeSequenceInitialSegment A T + → + ∀ (_ : A.length + ell = T.length), A.length < X.length → + ∀ (hXT : TreeSequenceInitialSegment X T), TreeSequenceInitialSegment A B → + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + by have this : X.length ≤ T.length := hXT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; x ∈ TreeSequenceVertexSet B → + ∀ beta ∈ MissingColors G mu x, beta ∉ TreeMissingColors mu A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej mu Cm H q A ell B X helem hAT + hsum hAXstrict hXT hAB ip x hxB beta hbeta hbA + obtain ⟨v, hvA, hbv⟩ := Finset.mem_biUnion.mp hbA + have hvB := TreeSequenceInitialSegmentVertexSetSubset hAB hvA + have hvx : v ≠ x := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hvA + obtain ⟨i, hi⟩ := hvA + intro he + have hinj := T.vertex_injective ((hAT.2.1 i).trans (hi.trans he)) + have hval := congrArg Fin.val hinj + have := i.isLt + change i.val = X.length at hval + omega + exact Finset.disjoint_left.mp (helem hvB hxB hvx) hbv hbeta + +private theorem helper_stageMissingSub_670.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; TreeSequenceInitialSegment Tn A + → HierarchyStageMissingColors H q ⊆ TreeMissingColors mu A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu em Cm H q A n Tn hTnA + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + simp only [HierarchyStageMissingColors, hq, Fin.cases_zero] + intro c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hTnA hv, hcv⟩ + · obtain hzero | ⟨r, hr⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + exact (hz hv).elim + · simp only [HierarchyStageMissingColors, hr, Fin.cases_succ, + A, HierarchyStarredStage] + exact Finset.Subset.refl _ + +private theorem helper_hgammaCutoff_684.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ) (ej : Fin T.length), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); (↑ej : ℕ) = A.length + (j - (1 : ℕ))) → + (P.coloring (T.edge ej) = some alpha ∧ + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑ej : ℕ) → P.coloring (T.edge t) ≠ + some alpha) → + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); A.length + ell = + T.length → X.length = A.length + (j - (1 : ℕ)) → A.length < X.length → + TreeSequenceInitialSegment X T → + ∀ (beta : Fin k), (↑ej : ℕ) = X.length → beta ∉ TreeMissingColors mu A → + HierarchyStageMissingColors H q ⊆ TreeMissingColors mu A → + ∀ eta ∈ HierarchyStoredColorsAt H q, alpha ∈ Cm.good.gamma q eta ∨ beta ∈ Cm.good.gamma q eta + → (↑(HierarchyFirstMissingPosition mu T eta) : ℕ) ≤ X.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej hej hfirst mu Cm H q A ell X + hsum hXlen hAXstrict hXT beta hejX hbetaNotA stageMissingSub eta heta hgamma + have havoid := Cm.good.avoidance q eta heta + rcases hgamma with haGamma | hbGamma + · by_contra hnot + have hp : X.length < (HierarchyFirstMissingPosition mu T eta).val := by omega + have hlast : H.stage q.succ = T := by + have hq : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + rw [hq, H.terminalStage] + have hsegment : alpha ∈ HierarchySegmentColors H q eta := by + change alpha ∈ (Finset.univ.filter fun c => + ∃ r : Fin (H.stage q.succ).length, A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition mu T eta).val (H.stage q.succ).length ∧ + mu ((H.stage q.succ).edge r) = some c) + rw [hlast] + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨ej, ?_, ?_, hfirst.1⟩ + · omega + · have := ej.isLt + omega + exact (Finset.mem_sdiff.mp (havoid haGamma)).2 hsegment + · exact (hbetaNotA (stageMissingSub (Finset.mem_sdiff.mp (havoid hbGamma)).1)).elim + +private theorem helper_hfixedA_709.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); A.length + ell = T.length → + TreeSequenceInitialSegment X T → + ∀ (beta : Fin k), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); (if + em.series.data.kind (Fin.last em.rounds) = some TashkinovExtensionKind.PE then + CombinedStableColoring (em.series.data.tree (Fin.last em.rounds).castSucc) bm.closure + (TashkinovStoredColors em.series.data (Fin.last em.rounds)) mu sigma else StableColoring + (em.series.data.tree (Fin.last em.rounds).castSucc) (TashkinovStoredColors em.series.data + (Fin.last em.rounds)) mu sigma) → IsOneEdgeUncolored sigma e0 → HierarchyWeaklyStable H q + sigma → + ∀ (t : Fin A.length), sigma (A.edge t) = mu (A.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej mu em bm Cm cm H q A ell X y + hsum hXT beta sigma hbaseStable hsone hweak + obtain hzero | ⟨r, hr⟩ := Fin.eq_zero_or_eq_succ q + · have hAcore : A = bm.core := by + change HierarchyStarredStage H q = bm.core + rw [hzero] + rfl + rw [hAcore] + exact P2813_T1_BaseDisplayedEdges G k e0 P.corresponding.replacementInput T mu em bm + sigma cm.oneEdgeUncolored hsone hbaseStable + · have hinvariant : TreeColoringInvariant A mu sigma := by + have hw := hweak + simp only [HierarchyWeaklyStable, hr, Fin.cases_succ] at hw + simpa only [A, hr, HierarchyStarredStage, Fin.cases_succ] using hw.2 + intro t + by_cases ht : t.val = 0 + · have he : A.edge t = e0 := by + rw [show t = ⟨0, A.positive⟩ from Fin.ext ht] + exact A.first_edge + rw [he] + exact hsone.1.trans cm.oneEdgeUncolored.1.symm + · exact hinvariant.1 t (by omega) + +private theorem helper_hfixedX_730.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); A.length + ell = T.length → + TreeSequenceInitialSegment X T → TreeSequenceInitialSegment A X → + ∀ (beta : Fin k), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → sigma (T.edge t) = mu + (T.edge t)) → ( + ∀ (t : Fin A.length), sigma (A.edge t) = mu (A.edge t)) → + ∀ (t : Fin X.length), sigma (X.edge t) = mu (X.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej mu Cm H q A ell X y hsum hXT + hAX beta sigma hfixedPrefix hfixedA t + by_cases ht : t.val < A.length + · let tA : Fin A.length := ⟨t.val, ht⟩ + have hcast : Fin.castLE hAX.1 tA = t := Fin.ext rfl + rw [← hcast, hAX.2.2 tA] + exact hfixedA tA + · have hf := hfixedPrefix (Fin.castLE hXT.1 t) (by simp only [Fin.val_castLE]; omega) + (by simpa only [Fin.val_castLE] using t.isLt) + simpa only [hXT.2.2 t] using hf + +private theorem helper_transportRoute_741.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); TreeSequenceInitialSegment X B → + ∀ (beta : Fin k), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v) → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) → ( + ∀ (t : Fin X.length), sigma (X.edge t) = mu (X.edge t)) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence mu S X → + TashkinovAugmentationSequence sigma S X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j mu Cm ell B X y hXB beta sigma + hmissingB segTrans hfixedX S hroute + unfold TashkinovAugmentationSequence at hroute ⊢ + refine Relation.ReflTransGen.head_induction_on hroute ?_ ?_ + · exact Relation.ReflTransGen.refl + · intro U W hstep htail ih + obtain ⟨hlen, hUW, c, hcolor, hc⟩ := hstep + have hWX := TashkinovAugmentationSequenceInitialSegment mu W X htail + have hUX := segTrans hUW hWX + have hcNew : c ∈ TreeMissingColors sigma U := by + obtain ⟨v, hvU, hcv⟩ := Finset.mem_biUnion.mp hc + have hvB := TreeSequenceInitialSegmentVertexSetSubset hXB + (TreeSequenceInitialSegmentVertexSetSubset hUX hvU) + exact Finset.mem_biUnion.mpr ⟨v, hvU, (hmissingB v hvB).symm ▸ hcv⟩ + let tW : Fin W.length := Fin.cast hlen.symm (Fin.last U.length) + have hf := hfixedX (Fin.castLE hWX.1 tW) + rw [hWX.2.2 tW] at hf + exact Relation.ReflTransGen.head ⟨hlen, hUW, c, hf.trans hcolor, hcNew⟩ ih + +private theorem helper_routes_759.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (j : + ℕ) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); A.length + ell = T.length → A.length < X.length → + TreeSequenceInitialSegment X T → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U W + → S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment A X → + ∀ (beta : Fin k), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) → TreeSequenceInitialSegment Tn A → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence mu S X → + TashkinovAugmentationSequence sigma S X) → (em.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence sigma Tn X ∨ + (em.series.data.kind n = some TashkinovExtensionKind.SE ∨ em.series.data.kind n = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), em.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X) ∧ + TashkinovAugmentationSequence mu X T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j ej mu em Cm H q A ell X y hsum + hAXstrict hXT commonPrefix hAX beta sigma n Tn segTrans hTnA transportRoute + have old := P2813_T1_TerminalRoute G k e0 P.corresponding.replacementInput T mu em + rcases old with ⟨hkind, hroute⟩ | ⟨hkind, f, seed, hedges, hadjoin, hincident, hcolor, hroute⟩ + · have hTnX := segTrans hTnA hAX + have hrouteX := TashkinovAugmentationSequenceRestrict mu Tn X T hroute hTnX hXT + exact ⟨Or.inl ⟨hkind, transportRoute Tn hrouteX⟩, + TashkinovAugmentationSequenceSuffix mu Tn X T hroute hTnX hXT⟩ + · have hseedT := TashkinovAugmentationSequenceInitialSegment mu seed T hroute + have hseedX : TreeSequenceInitialSegment seed X := commonPrefix hseedT hXT (by + have hl := hadjoin.1 + have htn := hTnA.1 + change seed.length = Tn.length + 1 at hl + omega) + have hrouteX := TashkinovAugmentationSequenceRestrict mu seed X T hroute hseedX hXT + exact ⟨Or.inr ⟨hkind, f, seed, hedges, hadjoin, transportRoute seed hrouteX⟩, + TashkinovAugmentationSequenceSuffix mu seed X T hroute hseedX hXT⟩ + +private theorem helper_continuation_1607.{u_1, u_2} : + helperContinuation1607Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha j hjLower hjUpper ej hej hfirst mu + em bm Cm cm H q A ell B X y hprefix hj helem hAT hsum hBlen hXlen hAXstrict hXleB hBT hXT + commonPrefix hAX hXB hAB ip x hx hxX hxB hinterval beta hbeta haA hne firstSpec ia ib a ha + hia hib haInA haB hmissing hejX hxy hdisjoint hpath sigma hcase hbaseStable hsone hweak + missingOther hmissingB hbetaNewY hfixedPrefix + have hstoredFirst := + @helper_hstoredFirst_583 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@helem) (@hsum) (@hBlen) (@hXleB) (@hBT) (@hXT) (@hxB) (@beta) (@hbeta) (@haA) + (@firstSpec) (@hib) (@missingOther) (@hmissingB) + let n := Fin.last em.rounds + let Tn := em.series.data.tree n.castSucc + have segTrans := @helper_segTrans_616 (@V) (@E) (@G) (@e0) + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + induction d with + | zero => exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + have lastZero (hz : H.dividerCount = 0) : A = bm.core := by + simp [A, q, HierarchyStarredStage, hz, Fin.last, bm] + have lastPositive := @helper_lastPositive_633 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@j) (@ej) (@hsum) (@hXT) (@beta) + have coreToA := + @helper_coreToA_644 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@hsum) (@hXT) (@beta) (@segTrans) (@stageSegment) (@lastZero) (@lastPositive) + have TnToCore : TreeSequenceInitialSegment Tn bm.core := by + by_cases hp : em.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (bm.parallel hp).2.2).leftSegment + · rw [bm.nonparallel hp]; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have hTnA := segTrans TnToCore coreToA + have hbetaNotA := + @helper_hbetaNotA_656 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@helem) (@hAT) (@hsum) (@hAXstrict) (@hXT) (@hAB) (@hxB) (@beta) (@hbeta) + have stageMissingSub := + @helper_stageMissingSub_670 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hTnA) + have hgammaCutoff := + @helper_hgammaCutoff_684 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@hej) (@hfirst) (@hsum) (@hXlen) (@hAXstrict) (@hXT) (@beta) (@hejX) (@hbetaNotA) + (@stageMissingSub) + have hfixedA := + @helper_hfixedA_709 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@hsum) (@hXT) (@beta) (@hbaseStable) (@hsone) (@hweak) + have hfixedX := + @helper_hfixedX_730 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@hsum) (@hXT) (@hAX) (@beta) (@hfixedPrefix) (@hfixedA) + -- Transport only the prefix route; the suffix is retained in the old coloring. + have transportRoute := @helper_transportRoute_741 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@j) (@hXB) (@beta) (@hmissingB) (@segTrans) (@hfixedX) + have routes := + @helper_routes_759 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@hsum) (@hAXstrict) (@hXT) (@commonPrefix) (@hAX) (@beta) (@segTrans) (@hTnA) + (@transportRoute) + have hsplitMissing : alpha ∈ TreeMissingColors sigma X ∧ beta ∈ TreeMissingColors sigma X := by + constructor + · exact Finset.mem_biUnion.mpr + ⟨a, TreeSequenceInitialSegmentVertexSetSubset hAX haInA, (hmissingB a haB).symm ▸ ha⟩ + · exact Finset.mem_biUnion.mpr ⟨x, hxX, (hmissingB x hxB).symm ▸ hbeta⟩ + obtain ⟨_, _, corr, hmax, bs, K, good, same⟩ := + StableChangeCasesOneTwoSplitTail G k e0 P.corresponding.replacementInput T mu em bm Cm cm + alpha beta hne hmissing (Sum.inl y) hpath sigma rfl hcase hdisjoint X hAX hAXstrict hXB + hfixedPrefix routes.1 routes.2 hsplitMissing hmissingB hstoredFirst hgammaCutoff + have hxT : x ∈ TreeSequenceVertexSet T := TreeSequenceInitialSegmentVertexSetSubset hXT hxX + have hyT : y ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last T.length, rfl⟩ + let Cs := @helperCs723 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@hsum) + (@hXT) (@hxB) (@beta) (@hbeta) (@hxy) (@hmissingB) (@hbetaNewY) (@corr) (@hmax) (@bs) (@K) + (@good) (@hxT) (@hyT) + obtain ⟨Pnew, hPnew⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi ett base C ctx + P sigma corr bs Cs same + apply Finset.mem_filter.mpr + refine ⟨hinterval, Pnew, beta, ?_, ?_⟩ + · rw [hPnew, hprefix, hx, hmissingB x hxB] + exact hbeta + · rw [hPnew] + exact hbetaNewY + +private theorem helper_continuation_1420.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), ( + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; (0 : ℕ) < H.dividerCount ∧ alpha ∈ + TreeMissingColors P.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ alpha ∈ TreeMissingColors + P.coloring (P.corresponding.replacementETT.series.data.tree n.castSucc)) → + ∀ (j : ℕ), (2 : ℕ) ≤ j → j ≤ HierarchyFullTailLength C → + ∀ (ej : Fin T.length), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); (↑ej : ℕ) = A.length + (j - (1 : ℕ))) → + (P.coloring (T.edge ej) = some alpha ∧ + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑ej : ℕ) → P.coloring (T.edge t) ≠ + some alpha) → + let mu : PartialEdgeColoring E k := P.coloring; + let _ : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let _ : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix Cm (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); ( + ∀ (i : ℕ), HierarchyFullTailPrefix C i = HierarchyFullTailPrefix Cm i) → j ≤ ell → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → TreeSequenceInitialSegment A T + → + ∀ (_ : A.length + ell = T.length), B.length = T.length - (1 : ℕ) → X.length = A.length + (j - + (1 : ℕ)) → A.length < X.length → X.length ≤ B.length → TreeSequenceInitialSegment B T → + ∀ (hXT : TreeSequenceInitialSegment X T), ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U W + → S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment A X → + TreeSequenceInitialSegment X B → TreeSequenceInitialSegment A B → + let ip : Fin (T.length + (1 : ℕ)) := (⟨X.length, + by have this : X.length ≤ T.length := hXT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let x : V := T.vertex ip; X.vertex (Fin.last X.length) = x → x ∈ TreeSequenceVertexSet X → x ∈ + TreeSequenceVertexSet B → y ∉ TreeSequenceVertexSet B → j - (1 : ℕ) ∈ Finset.Icc (1 : ℕ) + (HierarchyFullTailLength C - (1 : ℕ)) → + ∀ beta ∈ MissingColors G mu x, alpha ∈ TreeMissingColors mu A → alpha ∈ MissingColors G mu y → + alpha ≠ beta → ( + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G rho (T.vertex i) → c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ HierarchyFirstMissingPosition rho T c ≤ i) → + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T beta; + let a : V := T.vertex ia; alpha ∈ MissingColors G mu a → (↑ia : ℕ) ≤ A.length → ib = ip → j - + (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha hnormalized j hjLower hjUpper ej + hej hfirst mu em bm Cm cm H q A ell B X y hprefix hj helem hAT hsum hBlen hXlen hAXstrict + hXleB hBT hXT commonPrefix hAX hXB hAB ip x hx hxX hxB hyNotB hinterval beta hbeta haA haY + hne firstSpec ia ib a ha hia hib + have haInA : a ∈ TreeSequenceVertexSet A := by + let i : Fin (A.length + 1) := ⟨ia.val, by omega⟩ + have hi : Fin.castLE (Nat.succ_le_succ hAT.1) i = ia := Fin.ext rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, (hAT.2.1 i).symm.trans (congrArg T.vertex hi)⟩ + have haB : a ∈ TreeSequenceVertexSet B := + TreeSequenceInitialSegmentVertexSetSubset hAB haInA + have hab : a ≠ x := by + intro h + have hv := congrArg Fin.val (T.vertex_injective h) + change ia.val = X.length at hv + omega + have hmissing : alpha ∈ TreeMissingColors mu B ∧ beta ∈ TreeMissingColors mu B := by + constructor + · exact Finset.mem_biUnion.mpr ⟨a, haB, ha⟩ + · exact Finset.mem_biUnion.mpr ⟨x, hxB, hbeta⟩ + have hejX : ej.val = X.length := hej.trans hXlen.symm + have hordered := + @helper_hordered_369 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@hej) (@hfirst) (@hsum) (@hXlen) (@hAXstrict) (@hXT) (@beta) (@hia) (@hib) (@hejX) + have changeResult := ChangeLemma G k e0 P.corresponding.replacementInput T mu em bm Cm + cm.proper cm.oneEdgeUncolored cm.lowerRung cm.fewerDividers cm.lexicographicMinimality + helem cm.largeMissingSet alpha beta hne hmissing hordered + have hsame := + @helper_hsame_386 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hnormalized) (@j) + (@ej) (@hsum) (@hXT) (@beta) (@hib) (@changeResult) + let J := TwoColorIncidenceGraph G mu alpha beta + let Q := TwoColorComponent G mu alpha beta (Sum.inl y) + have self (v : V) : Sum.inl v ∈ TwoColorComponent G mu alpha beta (Sum.inl v) := by + change J.connectedComponentMk (Sum.inl v) = J.connectedComponentMk (Sum.inl v) + rfl + have leaf := @helper_leaf_399 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) (@hj) + (@hsum) (@hXT) (@hx) (@beta) (@hne) + have hay : a ≠ y := fun he => hyNotB (he ▸ haB) + have hxy : x ≠ y := fun he => hyNotB (he ▸ hxB) + have hdisjoint := + @helper_hdisjoint_416 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@hsum) (@hXT) (@beta) (@hbeta) (@haY) (@ha) (@hab) (@hsame) (@self) (@leaf) (@hay) (@hxy) + have hpath : TwoColorPathComponent G mu alpha beta (Sum.inl y) := + ⟨hne, Sum.inl y, self y, leaf y (Or.inl haY)⟩ + let sigma := TwoColorComponentSwap G mu alpha beta (Sum.inl y) + have hcase : + (0 < H.dividerCount ∧ alpha ∈ TreeMissingColors mu + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors mu (em.series.data.tree (Fin.last em.rounds).castSucc) ∨ + (alpha ∈ TreeMissingColors mu A ∧ + alpha ∉ TashkinovStoredColors em.series.data (Fin.last em.rounds) ∧ + beta ∉ TashkinovStoredColors em.series.data (Fin.last em.rounds)))) := by + rcases hnormalized with hp | hz + · exact Or.inl hp + · exact Or.inr ⟨hz.1, Or.inl hz.2⟩ + obtain ⟨hbaseStable, hmissingA, hsproper, hsone, houtside⟩ := + P2813_T1_BaseControl G k e0 P.corresponding.replacementInput T mu em bm Cm cm + helem alpha beta hne hmissing (Sum.inl y) hpath sigma rfl hcase hdisjoint + have changed := StableChangeCasesOneTwo G k e0 P.corresponding.replacementInput T mu em bm Cm + cm.proper cm.oneEdgeUncolored cm.lowerRung cm.fewerDividers cm.lexicographicMinimality + helem cm.largeMissingSet alpha beta hne hmissing (Sum.inl y) hpath sigma rfl hcase hdisjoint + have hweak : HierarchyWeaklyStable H q sigma := changed.1 + obtain ⟨missingOutside, missingAlphaToBeta, missingBetaToAlpha, missingOther⟩ := + TwoColorComponentSwapMissingBehavior G mu alpha beta hne cm.proper (Sum.inl y) + have edgeOfVertex := @helper_edgeOfVertex_465 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) + have hmissingB := + @helper_hmissingB_473 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@helem) (@hsum) (@hXT) (@hxB) (@beta) (@hbeta) (@hne) (@ha) (@haB) (@hsame) (@self) + (@hdisjoint) (@missingOutside) (@missingOther) (@edgeOfVertex) + have hbetaNewY : beta ∈ MissingColors G sigma y := + missingAlphaToBeta y (self y) haY + -- Recover the exact stored seed, the only possible beta edge before the split. + have seedIncident := @helper_seedIncident_520 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have hfixedPrefix := + @helper_hfixedPrefix_556 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) + (@hej) (@hfirst) (@helem) (@hsum) (@hXlen) (@hAXstrict) (@hXT) (@hx) (@beta) (@hbeta) + (@hejX) (@hbaseStable) (@seedIncident) + exact @helper_continuation_1607 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@j) (@hjLower) (@hjUpper) (@ej) (@hej) (@hfirst) (@hprefix) (@hj) (@helem) (@hAT) (@hsum) + (@hBlen) (@hXlen) (@hAXstrict) (@hXleB) (@hBT) (@hXT) (@commonPrefix) (@hAX) (@hXB) (@hAB) + (@hx) (@hxX) (@hxB) (@hinterval) (@beta) (@hbeta) (@haA) (@hne) (@firstSpec) (@ha) (@hia) + (@hib) (@haInA) (@haB) (@hmissing) (@hejX) (@hxy) (@hdisjoint) (@hpath) (@hcase) + (@hbaseStable) (@hsone) (@hweak) (@missingOther) (@hmissingB) (@hbetaNewY) (@hfixedPrefix) +theorem HierarchyClaimNineFirstUseAfterSeed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (_ : HierarchyPathNumber P.counterexample.hierarchy = 1) + (alpha : Fin k) + (hstart : + let H := P.counterexample.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + alpha ∈ TreeMissingColors P.coloring A ∧ + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length))) + (hnormalized : + let H := P.counterexample.hierarchy + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + (0 < H.dividerCount ∧ + alpha ∈ TreeMissingColors P.coloring + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ + alpha ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree n.castSucc))) + (hnoCommon : ∀ i ∈ Finset.Icc 1 (HierarchyFullTailLength C - 1), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) + (j : ℕ) (hjLower : 2 ≤ j) (hjUpper : j ≤ HierarchyFullTailLength C) + (ej : Fin T.length) + (hej : + let A := HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) + ej.val = A.length + (j - 1)) + (hfirst : P.coloring (T.edge ej) = some alpha ∧ + let A := HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) + ∀ t : Fin T.length, A.length ≤ t.val → t.val < ej.val → + P.coloring (T.edge t) ≠ some alpha) : + j - 1 ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + classical + let mu := P.coloring + let em := P.corresponding.replacementETT + let bm := P.replacementBase + let Cm := P.counterexample + let cm := P.minimumContext + let H := Cm.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength Cm + let B := HierarchyFullTailPrefix Cm (ell - 1) + let X := HierarchyFullTailPrefix Cm (j - 1) + let y := T.vertex (Fin.last T.length) + have hstar := (P2752_T2_HierarchyMeasures C.hierarchy H P.sameGood.1).1 + have hell : HierarchyFullTailLength C = ell := by + simp only [HierarchyFullTailLength, hstar] + rfl + have hprefix (i : ℕ) : HierarchyFullTailPrefix C i = + HierarchyFullTailPrefix Cm i := by + simp only [HierarchyFullTailPrefix, hstar] + rfl + have hj : j ≤ ell := by simpa only [hell] using hjUpper + have htwo : 2 ≤ ell := by omega + have helem : ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) := + HierarchyCounterexamplePenultimateElementary G k e0 + P.corresponding.replacementInput T mu em bm Cm cm.proper cm.oneEdgeUncolored + cm.lowerRung cm.fewerDividers cm.lexicographicMinimality cm.largeMissingSet + have hAT := + @helper_hAT_246 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have hsum : A.length + ell = T.length := Nat.add_sub_of_le hAT.1 + have hBlen : B.length = T.length - 1 := by + dsimp [B, HierarchyFullTailPrefix] + change min (A.length + (ell - 1)) T.length = T.length - 1 + omega + have hXlen : X.length = A.length + (j - 1) := by + dsimp [X, HierarchyFullTailPrefix] + change min (A.length + (j - 1)) T.length = A.length + (j - 1) + omega + have hAXstrict : A.length < X.length := by omega + have hXleB : X.length ≤ B.length := by omega + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hXT : TreeSequenceInitialSegment X T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have commonPrefix := @helper_commonPrefix_268 (@V) (@E) (@G) (@e0) + have hAX : TreeSequenceInitialSegment A X := commonPrefix hAT hXT (by omega) + have hXB : TreeSequenceInitialSegment X B := commonPrefix hXT hBT hXleB + have hAB : TreeSequenceInitialSegment A B := commonPrefix hAT hBT (by omega) + let ip : Fin (T.length + 1) := ⟨X.length, by have := hXT.1; omega⟩ + let x := T.vertex ip + have hx : X.vertex (Fin.last X.length) = x := (hXT.2.1 _).symm + have hxX : x ∈ TreeSequenceVertexSet X := by + rw [← hx] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last X.length, rfl⟩ + have hxB : x ∈ TreeSequenceVertexSet B := + TreeSequenceInitialSegmentVertexSetSubset hXB hxX + have hyNotB := + @helper_hyNotB_289 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@ej) (@hej) (@hsum) + (@hBlen) (@hXlen) (@hXleB) (@hBT) + have hinterval : j - 1 ∈ Finset.Icc 1 (HierarchyFullTailLength C - 1) := by + rw [hell] + simp only [Finset.mem_Icc] + omega + obtain ⟨beta, hbeta⟩ := hvertexMissing mu cm.proper cm.oneEdgeUncolored x + have hbNotY : beta ∉ MissingColors G mu y := by + have hd := hnoCommon (j - 1) hinterval + rw [hprefix, hx] at hd + exact Finset.disjoint_left.mp hd hbeta + have haA : alpha ∈ TreeMissingColors mu A := hstart.1 + have haY : alpha ∈ MissingColors G mu y := hstart.2 + have hne : alpha ≠ beta := by + intro he + exact hbNotY (he ▸ haY) + have firstSpec := @helper_firstSpec_312 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@j) + obtain ⟨va, hvaA, hava⟩ := Finset.mem_biUnion.mp haA + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hvaA + obtain ⟨iaA, hiaA⟩ := hvaA + let iaT := Fin.castLE (Nat.succ_le_succ hAT.1) iaA + have haia : alpha ∈ MissingColors G mu (T.vertex iaT) := by + rw [hAT.2.1 iaA, hiaA] + exact hava + let ia := HierarchyFirstMissingPosition mu T alpha + let ib := HierarchyFirstMissingPosition mu T beta + let a := T.vertex ia + have ha : alpha ∈ MissingColors G mu a := (firstSpec mu alpha iaT haia).1 + have hia : ia.val ≤ A.length := by + have hm := (firstSpec mu alpha iaT haia).2 + change ia.val ≤ iaA.val at hm + have := iaA.isLt + omega + have hib := + @helper_hib_340 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@j) (@ej) (@helem) + (@hsum) (@hBlen) (@hXleB) (@hBT) (@hXT) (@hxB) (@beta) (@hbeta) (@firstSpec) + exact @helper_continuation_1420 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@hnormalized) (@j) (@hjLower) (@hjUpper) (@ej) (@hej) (@hfirst) (@hprefix) (@hj) (@helem) + (@hAT) (@hsum) (@hBlen) (@hXlen) (@hAXstrict) (@hXleB) (@hBT) (@hXT) (@commonPrefix) (@hAX) + (@hXB) (@hAB) (@hx) (@hxX) (@hxB) (@hyNotB) (@hinterval) (@beta) (@hbeta) (@haA) (@haY) + (@hne) (@firstSpec) (@ha) (@hia) (@hib) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean new file mode 100644 index 0000000000..e394f139f3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean @@ -0,0 +1,3828 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.HierarchyClaimNineFirstUseAfterSeed +public import LeanPool.GoldbergSeymour.HierarchyClaimNineUnusedTailColor +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyClaimNinePENormalization +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Hierarchy Claim Nine First Use Seed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable abbrev helperCs1237.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (alpha : Fin k) → + let mu : PartialEdgeColoring E k := P.coloring; + let em : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := + P.counterexample; + let H : + TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase := + Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let y : V := T.vertex (Fin.last T.length); + TreeSequenceInitialSegment A T → + (gamma : Fin k) → + y ∉ TreeSequenceVertexSet A → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G mu gamma alpha + (Sum.inl y); + gamma ∈ MissingColors G sigma y → + (corr : + CorrespondingExtendedTashkinovTree G k e0 em + sigma T) → + MaximumProperty corr.replacementETT → + (bs : + HierarchyBase corr.replacementETT sigma) → + (K : + TashkinovHierarchy corr.replacementETT + bs) → + GoodHierarchy K → + gamma ∈ TreeMissingColors sigma A → + y ∈ TreeSequenceVertexSet T → + HierarchyCounterexample bs := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu em Cm H q A y hAT gamma hyNotA + sigma hgammaNewY corr hmax bs K good hgammaSigmaA hvTerminal + exact { + positive := by rw [corr.rungAgreement]; exact Cm.positive + hierarchy := K + good := good + maximum := hmax + notElementary := by + intro he + obtain ⟨v, hvA, hmv⟩ := Finset.mem_biUnion.mp hgammaSigmaA + have hvT := TreeSequenceInitialSegmentVertexSetSubset hAT hvA + have hneq : v ≠ y := by + intro h + exact hyNotA (h ▸ hvA) + exact Finset.disjoint_left.mp (he hvT hvTerminal hneq) hmv hgammaNewY } + +private abbrev helperContinuation2476Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyPathNumber P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) (e1 : Fin T.length), (↑e1 : ℕ) = (HierarchyStarredStage + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount)).length → + P.coloring (T.edge e1) = some alpha → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); HierarchyFullTailLength C = ell → + ∀ (htwo : (2 : ℕ) ≤ ell) (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 + : ℕ)), + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + ∀ (gamma : Fin k), gamma ≠ alpha → + ∀ (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; + have this_3 : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬min + (A.length + (T.length - A.length - (1 : ℕ))) T.length ≤ T.length) ↦ + by omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length) (hAshort : A.length + (1 : ℕ) < T.length), ((0 : ℕ) < H.dividerCount → A = + H.stage (⟨H.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (0 : ℕ) < H.dividerCount ∧ gamma ∈ TreeMissingColors mu + (H.stage (⟨H.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + mu Tn ∨ gamma ∈ TreeMissingColors mu A ∧ gamma ∉ TashkinovStoredColors em.series.data n ∧ + alpha ∉ TashkinovStoredColors em.series.data n) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); + gamma ∈ MissingColors G sigma y → sigma (T.edge e1) = mu (T.edge e1) → + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + have this_2 : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (1 : ℕ)) ↦ + by omega + ) ( + have this : A.length + (1 : ℕ) < T.length := hAshort; + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬A.length + + (1 : ℕ) ≤ T.length) ↦ + by omega + ); X.length = A.length + (1 : ℕ) → ModColoring em sigma → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 em sigma T) (bs : HierarchyBase + corr.replacementETT sigma) (K : TashkinovHierarchy corr.replacementETT bs) (good : + GoodHierarchy K), SameGoodHierarchy Cm.good good → gamma ∈ TreeMissingColors sigma A → + ∀ (Pnew : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Pnew.coloring = + sigma → ( + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), Disjoint (MissingColors G + Pnew.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C + i).length))) (MissingColors G Pnew.coloring y)) → HierarchyStarredStage H (Fin.last + H.dividerCount) = HierarchyStarredStage K (Fin.last K.dividerCount) ∧ HierarchyPathNumber + H = HierarchyPathNumber K ∧ H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) = K.stage (⟨K.dividerCount, + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (K.dividerCount + (2 : ℕ))) → HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = HierarchyStarredStage Pnew.counterexample.hierarchy (Fin.last + Pnew.counterexample.hierarchy.dividerCount) ∧ HierarchyPathNumber C.hierarchy = + HierarchyPathNumber Pnew.counterexample.hierarchy ∧ C.hierarchy.stage + (⟨C.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (C.hierarchy.dividerCount + (2 : ℕ))) = Pnew.counterexample.hierarchy.stage + (⟨Pnew.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (Pnew.counterexample.hierarchy.dividerCount + (2 : ℕ))) → HierarchyStarredStage + C.hierarchy (Fin.last C.hierarchy.dividerCount) = HierarchyStarredStage H (Fin.last + H.dividerCount) ∧ HierarchyPathNumber C.hierarchy = HierarchyPathNumber H ∧ + C.hierarchy.stage (⟨C.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (C.hierarchy.dividerCount + (2 : ℕ))) = H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) → HierarchyPathNumber Pnew.counterexample.hierarchy = (1 : + ℕ) → HierarchyStarredStage H q = HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount) → (HierarchyStarredStage K (Fin.last + K.dividerCount)).length = A.length → gamma ∈ TreeMissingColors sigma + (HierarchyStarredStage K (Fin.last K.dividerCount)) → gamma ∈ TreeMissingColors sigma Tn → + ( + ∀ (coloring : PartialEdgeColoring E k) (c : CorrespondingExtendedTashkinovTree G k e0 ett + coloring T), c.replacementETT.series.data.tree (Fin.last c.replacementETT.rounds).castSucc + = ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty + +private abbrev helperContinuation2461Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyPathNumber P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) (e1 : Fin T.length), (↑e1 : ℕ) = (HierarchyStarredStage + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount)).length → + P.coloring (T.edge e1) = some alpha → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let cm : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); HierarchyFullTailLength C = ell → + ∀ (htwo : (2 : ℕ) ≤ ell), TreeSequenceInitialSegment A T → + ∀ (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 : ℕ)), + TreeSequenceInitialSegment A B → + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + ∀ gamma ∈ TreeMissingColors mu A, gamma ≠ alpha → gamma ∈ TreeMissingColors mu Tn → gamma ∈ + TreeMissingColors mu B → alpha ∈ TreeMissingColors mu B → gamma ≠ alpha → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T gamma; + let vg : V := T.vertex ig; + ∀ (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; + have this_3 : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length), + let Q : Set (V ⊕ E) := TwoColorComponent G mu gamma alpha (Sum.inl y); + ∀ (hAshort : A.length + (1 : ℕ) < T.length), y ∉ TreeSequenceVertexSet A → Disjoint Q + (TwoColorComponent G mu gamma alpha (Sum.inl vg)) → TwoColorPathComponent G mu gamma alpha + (Sum.inl y) → ((0 : ℕ) < H.dividerCount → A = H.stage (⟨H.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (0 : ℕ) < H.dividerCount ∧ gamma ∈ TreeMissingColors mu + (H.stage (⟨H.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + mu Tn ∨ gamma ∈ TreeMissingColors mu A ∧ gamma ∉ TashkinovStoredColors em.series.data n ∧ + alpha ∉ TashkinovStoredColors em.series.data n) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v) → gamma ∈ + MissingColors G sigma y → sigma (T.edge e1) = mu (T.edge e1) → + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) ( + have this : A.length + (1 : ℕ) < T.length := hAshort; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); X.length = A.length + (1 : ℕ) → TreeSequenceInitialSegment A X → A.length < X.length → + TreeSequenceInitialSegment X B → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → sigma (T.edge t) = mu + (T.edge t)) → ( + ∀ eta ∈ HierarchyStoredColorsAt H q, HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition mu T eta) → ( + ∀ eta ∈ HierarchyStoredColorsAt H q, gamma ∈ Cm.good.gamma q eta ∨ alpha ∈ Cm.good.gamma q eta + → (↑(HierarchyFirstMissingPosition mu T eta) : ℕ) ≤ X.length) → TreeSequenceInitialSegment + Tn A → (em.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X ∨ (em.series.data.kind n = some + TashkinovExtensionKind.SE ∨ em.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), em.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X) ∧ + TashkinovAugmentationSequence mu X T → gamma ∈ TreeMissingColors sigma X ∧ alpha ∈ + TreeMissingColors sigma X → (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett + base C ctx).Nonempty + +private abbrev helperContinuation2492Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyPathNumber P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), ( + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), Disjoint (MissingColors G + P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C + i).length))) (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + ∀ (e1 : Fin T.length), (↑e1 : ℕ) = (HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).length → P.coloring (T.edge e1) = some alpha → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let cm : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); HierarchyFullTailLength C = ell → + ∀ (htwo : (2 : ℕ) ≤ ell), TreeSequenceInitialSegment A T → + ∀ (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 : ℕ)), + TreeSequenceInitialSegment A B → alpha ∈ TreeMissingColors mu A → + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); (H.dividerCount = (0 : ℕ) → A = + bm.core) → + ∀ gamma ∈ TreeMissingColors mu A, gamma ∉ R → gamma ≠ alpha → gamma ∈ TreeMissingColors mu Tn + → gamma ∈ TreeMissingColors mu B → alpha ∈ TreeMissingColors mu B → gamma ≠ alpha → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T gamma; + let vg : V := T.vertex ig; + ∀ (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬min + (A.length + (T.length - A.length - (1 : ℕ))) T.length ≤ T.length) ↦ + by omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length), + let Q : Set (V ⊕ E) := TwoColorComponent G mu gamma alpha (Sum.inl y); + ∀ (hAshort : A.length + (1 : ℕ) < T.length), y ∉ TreeSequenceVertexSet A → Disjoint Q + (TwoColorComponent G mu gamma alpha (Sum.inl vg)) → TwoColorPathComponent G mu gamma alpha + (Sum.inl y) → ((0 : ℕ) < H.dividerCount → A = H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (0 : ℕ) < H.dividerCount ∧ gamma ∈ TreeMissingColors mu + (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + mu Tn ∨ gamma ∈ TreeMissingColors mu A ∧ gamma ∉ TashkinovStoredColors em.series.data n ∧ + alpha ∉ TashkinovStoredColors em.series.data n) → ( + ∀ w ∈ TreeSequenceVertexSet A, Sum.inl w ∉ Q) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); ( + ∀ (v : V) (c : Fin k), c ≠ gamma → c ≠ alpha → (c ∈ MissingColors G (TwoColorComponentSwap G + mu gamma alpha (Sum.inl y)) v ↔ c ∈ MissingColors G mu v)) → ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v) → gamma ∈ + MissingColors G sigma y → sigma (T.edge e1) = mu (T.edge e1) → + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (1 : ℕ)) ↦ + by omega + ) ( + have this : A.length + (1 : ℕ) < T.length := hAshort; Decidable.byContradiction fun (a : + ¬A.length + (1 : ℕ) ≤ T.length) ↦ + by omega + ); X.length = A.length + (1 : ℕ) → TreeSequenceInitialSegment X T → ( + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S T → TreeSequenceInitialSegment U T → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment A X → + A.length < X.length → TreeSequenceInitialSegment X B → + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty + +private abbrev helperContinuation2398Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyPathNumber P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), (0 : ℕ) < P.counterexample.hierarchy.dividerCount ∧ alpha ∈ + TreeMissingColors P.coloring (P.counterexample.hierarchy.stage + (⟨P.counterexample.hierarchy.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (P.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ alpha ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc) → ( + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), Disjoint (MissingColors G + P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C + i).length))) (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + ∀ (e1 : Fin T.length), (↑e1 : ℕ) = (HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).length → P.coloring (T.edge e1) = some alpha → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let cm : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); HierarchyFullTailLength C = ell → (2 : ℕ) ≤ ell → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → TreeSequenceInitialSegment A T + → + ∀ (hsum : A.length + ell = T.length), B.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B → alpha ∈ + TreeMissingColors mu A → alpha ∈ MissingColors G mu y → + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); (H.dividerCount = (0 : ℕ) → A = + bm.core) → + ∀ gamma ∈ TreeMissingColors mu A, gamma ∉ R → gamma ≠ alpha → gamma ∈ TreeMissingColors mu Tn + → gamma ∈ TreeMissingColors mu B → alpha ∈ TreeMissingColors mu B → gamma ≠ alpha → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T gamma; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let vg : V := T.vertex ig; gamma ∈ MissingColors G mu vg → vg ∈ TreeSequenceVertexSet A → + alpha ∈ MissingColors G mu (T.vertex ia) → T.vertex ia ∈ TreeSequenceVertexSet A → + ∀ (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ) → Ty.length = B.length → ( + let H : TashkinovHierarchy em bm := Cm.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors em.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition mu T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition mu T alpha); + have sameComponent : Prop := TwoColorComponent G mu gamma alpha (Sum.inl va) = + TwoColorComponent G mu gamma alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors mu Tnq ∨ Disjoint (insert gamma ({ alpha } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors mu + Tn ∨ Disjoint (insert gamma ({ alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (gamma ∈ TreeMissingColors mu A ∧ TreeColorSetClosed G mu A ({ gamma } : + Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A mu gamma alpha)) → + TwoColorComponent G mu gamma alpha (Sum.inl vg) = TwoColorComponent G mu gamma alpha + (Sum.inl (T.vertex ia)) → TreeInterchangeable G A mu gamma alpha → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu gamma alpha; + let Q : Set (V ⊕ E) := TwoColorComponent G mu gamma alpha (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G mu gamma alpha (Sum.inl v)) → + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty + +private theorem helper_hAT_245.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation Cm H q A + have hs : TreeSequenceInitialSegment (HierarchyStarredStage H q) (H.stage q.succ) := by + refine Fin.cases ?_ (fun i => ?_) q + · exact H.coreInsideFirst + · exact H.nested i.succ + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa only [hlast, H.terminalStage] using hs + +private theorem helper_hAB_259.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (_ : Fin T.length), + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); (2 : ℕ) ≤ ell → + TreeSequenceInitialSegment A T → A.length + ell = T.length → B.length = T.length - (1 : ℕ) + → TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation e1 Cm H q A ell B htwo hAT + hsum hBlen hBT + have hlen : A.length ≤ B.length := by omega + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hBT.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hAT.2.1 i) + · intro i + exact (hBT.2.2 (Fin.castLE hlen i)).symm.trans (hAT.2.2 i) + +private theorem helper_hRcard_279.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); D.card ≤ em.rounds → R.card ≤ (2 : ℕ) * + em.rounds := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation em Cm H q D R hDcard + calc + R.card ≤ ∑ eta ∈ D, (Cm.good.gamma q eta).card := Finset.card_biUnion_le + _ = 2 * D.card := by + rw [Finset.sum_congr rfl (fun eta heta => Cm.good.twoColors q eta heta)] + change (∑ eta ∈ HierarchyStoredColorsAt H q, (2 : ℕ)) = + 2 * (HierarchyStoredColorsAt H q).card + simp [Nat.mul_comm] + _ ≤ 2 * em.rounds := Nat.mul_le_mul_left 2 hDcard + +private theorem helper_hSne_377.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); R.card ≤ (2 : ℕ) * em.rounds → + let S : Finset (Fin k) := TreeMissingColors mu Tn \ (R ∪ ({ alpha } : Finset (Fin k))); (2 : + ℕ) * em.rounds + (11 : ℕ) ≤ (TreeMissingColors mu Tn).card → S.Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu em Cm H q n Tn D R hRcard S hlarge + apply Finset.card_pos.mp + rw [Finset.card_sdiff] + have hi : ((TreeMissingColors mu Tn) ∩ (R ∪ {alpha})).card ≤ + (R ∪ {alpha}).card := Finset.card_le_card Finset.inter_subset_right + have hi' : ((R ∪ {alpha}) ∩ (TreeMissingColors mu Tn)).card ≤ + (R ∪ {alpha}).card := by + simpa [Finset.inter_comm] using hi + have hru : (R ∪ {alpha}).card ≤ 2 * em.rounds + 1 := by + calc + (R ∪ {alpha}).card ≤ R.card + ({alpha} : Finset (Fin k)).card := + Finset.card_union_le R {alpha} + _ ≤ 2 * em.rounds + 1 := by simp; omega + omega + +private theorem helper_closedSingleton_400.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (gamma : Fin k) (U : TreeSequence G e0), ColoredVertexSetClosed G mu (TreeSequenceVertexSet + U) → gamma ∈ TreeMissingColors mu U → TreeColorSetClosed G mu U ({ gamma } : Finset (Fin + k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu gamma U hc hm c hcs + have hcg : c = gamma := Finset.mem_singleton.mp hcs + subst c + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨hb, hcol⟩ := Finset.mem_filter.mp hf + exact hc hb hv hcol hvm + +private theorem helper_stableClosed_412.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (U : TreeSequence G e0) (S : Finset (Fin k)) (psi pi : PartialEdgeColoring E k), + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → StableColoring U S psi pi → ColoredVertexSetClosed G psi + (TreeSequenceVertexSet U) → ColoredVertexSetClosed G pi (TreeSequenceVertexSet U) := by + classical + intro V E _ _ G k e0 U S psi pi hpsi hpsiOne hpi hpiOne hs hc + have hr : StableColoring U S pi psi := + (sc2 G e0 U S).symm + (x := ⟨psi, hpsi, hpsiOne⟩) (y := ⟨pi, hpi, hpiOne⟩) hs + intro f c v hb hv hcol hvm + have hf : TreeIncidentEdge U f := by + have hb' : ∃ u ∈ TreeSequenceVertexSet U, ∃ w ∉ TreeSequenceVertexSet U, + G.ends f = Sym2.mk u w := by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] using hb + obtain ⟨u, hu, w, hw, he⟩ := hb' + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [he] + simp + have hm : c ∈ TreeMissingColors pi U := Finset.mem_biUnion.mpr ⟨v, hv, hvm⟩ + have hsame := hr.1 f hf ⟨c, Finset.mem_union_left _ hm, hcol⟩ + have hvm' : c ∈ MissingColors G psi v := by rw [hr.2 v hv]; exact hvm + exact hc hb hv (hsame.trans hcol) hvm' + +private theorem helper_hAeq_523.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : (0 : ℕ) < H.dividerCount), + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P Cm H q A hz + obtain hzero | ⟨r, hr⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp [q] at hv + omega + · simp only [A, HierarchyStarredStage, hr, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hr + simpa [q] using hv.symm + +private theorem helper_segTrans_533.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U + W → TreeSequenceInitialSegment S W := by + classical + intro V E G e0 S U W hSU hUW + refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ + · intro j + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) j)).trans (hSU.2.1 j) + · intro j + exact (hUW.2.2 (Fin.castLE hSU.1 j)).trans (hSU.2.2 j) + +private theorem helper_TnToCore_553.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + TreeSequenceInitialSegment Tn bm.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P em bm n Tn + by_cases hpe : em.series.data.kind n = some TashkinovExtensionKind.PE + · obtain ⟨u⟩ := (bm.parallel hpe).2.2 + exact u.leftSegment + · rw [bm.nonparallel hpe] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + +private theorem helper_hRsub_564.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); + ∀ (hz : (0 : ℕ) < H.dividerCount), + let i : Fin H.dividerCount := (⟨H.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin H.dividerCount); q = i.succ → + let Dprev : Finset (Fin k) := HierarchyStoredColorsAt H i.succ; + let Rprev : Finset (Fin k) := Dprev.biUnion (Cm.good.gamma i.castSucc); + ∀ (eta : Fin k), ( + ∀ theta ∈ HierarchyStoredColorsAt Cm.hierarchy i.succ, theta ≠ eta → Cm.good.gamma i.succ + theta = Cm.good.gamma i.castSucc theta) → R ⊆ Rprev ∪ Cm.good.gamma i.succ eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P Cm H q D R hz i hq Dprev Rprev eta hcopy + c hc + obtain ⟨theta, htheta, hc⟩ := Finset.mem_biUnion.mp hc + have hcNow : c ∈ Cm.good.gamma i.succ theta := by simpa only [hq] using hc + by_cases hthetaEta : theta = eta + · subst theta + exact Finset.mem_union_right _ (by simpa only [hq] using hcNow) + · have hthetaCurrent : theta ∈ Dprev := by + simpa [Dprev, D, hq] using htheta + have hthetaPrev : theta ∈ HierarchyStoredColorsAt H i.castSucc := + HierarchyStoredColorsAntitone H i hthetaCurrent + have hcopyTheta := hcopy theta hthetaCurrent hthetaEta + apply Finset.mem_union_left + exact Finset.mem_biUnion.mpr ⟨theta, hthetaCurrent, by rw [← hcopyTheta]; exact hcNow⟩ + +private theorem helper_hRprevCard_578.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let _ : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ (hz : (0 : ℕ) < H.dividerCount), + let i : Fin H.dividerCount := (⟨H.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin H.dividerCount); q = i.succ → + let Dprev : Finset (Fin k) := HierarchyStoredColorsAt H i.succ; + let Rprev : Finset (Fin k) := Dprev.biUnion (Cm.good.gamma i.castSucc); Rprev.card ≤ (2 : ℕ) * + em.rounds := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P em Cm H q D hz i hq Dprev Rprev + calc + Rprev.card ≤ ∑ theta ∈ Dprev, (Cm.good.gamma i.castSucc theta).card := + Finset.card_biUnion_le + _ = 2 * Dprev.card := by + rw [Finset.sum_congr rfl (fun theta htheta => + Cm.good.twoColors i.castSucc theta (HierarchyStoredColorsAntitone H i + (by simpa [Dprev, D, hq] using htheta)))] + change (∑ theta ∈ HierarchyStoredColorsAt H i.succ, (2 : ℕ)) = + 2 * (HierarchyStoredColorsAt H i.succ).card + simp [Nat.mul_comm] + _ ≤ 2 * em.rounds := by + exact Nat.mul_le_mul_left 2 (by + exact HierarchyStoredColorsCardinality H i.succ) + +private theorem helper_hforbiddenCard_595.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); + ∀ (hz : (0 : ℕ) < H.dividerCount), + let i : Fin H.dividerCount := (⟨H.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin H.dividerCount); + let Dprev : Finset (Fin k) := HierarchyStoredColorsAt H i.succ; + let Rprev : Finset (Fin k) := Dprev.biUnion (Cm.good.gamma i.castSucc); + ∀ (eta : Fin k), R ⊆ Rprev ∪ Cm.good.gamma i.succ eta → Rprev.card ≤ (2 : ℕ) * em.rounds → + (Cm.good.gamma i.succ eta).card ≤ (2 : ℕ) → (Rprev ∪ R ∪ ({ alpha } : Finset (Fin + k))).card ≤ (2 : ℕ) * em.rounds + (3 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha em Cm H q D R hz i Dprev Rprev eta + hRsub hRprevCard hpairCard + have hsub : Rprev ∪ R ∪ {alpha} ⊆ Rprev ∪ Cm.good.gamma i.succ eta ∪ {alpha} := by + intro c hc + simp only [Finset.mem_union] at hc ⊢ + rcases hc with h | h + · rcases h with h | h + · exact Or.inl (Or.inl h) + · have hp := Finset.mem_union.mp (hRsub h) + rcases hp with hp | hp + · exact Or.inl (Or.inl hp) + · exact Or.inl (Or.inr hp) + · exact Or.inr h + calc + (Rprev ∪ R ∪ {alpha}).card ≤ + (Rprev ∪ Cm.good.gamma i.succ eta ∪ {alpha}).card := + Finset.card_le_card hsub + _ ≤ (Rprev ∪ Cm.good.gamma i.succ eta).card + 1 := by + calc + _ ≤ (Rprev ∪ Cm.good.gamma i.succ eta).card + ({alpha} : Finset (Fin k)).card := + Finset.card_union_le _ _ + _ = _ := by simp + _ ≤ Rprev.card + (Cm.good.gamma i.succ eta).card + 1 := by + have := Finset.card_union_le Rprev (Cm.good.gamma i.succ eta) + omega + _ ≤ 2 * em.rounds + 3 := by omega + +private theorem helper_hSne_623.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); + ∀ (hz : (0 : ℕ) < H.dividerCount), + let i : Fin H.dividerCount := (⟨H.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin H.dividerCount); + let Dprev : Finset (Fin k) := HierarchyStoredColorsAt H i.succ; + let Rprev : Finset (Fin k) := Dprev.biUnion (Cm.good.gamma i.castSucc); + ∀ (_ : Fin k), (Rprev ∪ R ∪ ({ alpha } : Finset (Fin k))).card ≤ (2 : ℕ) * em.rounds + (3 : ℕ) + → (2 : ℕ) * em.rounds + (11 : ℕ) ≤ (TreeMissingColors mu Tn).card → + let S : Finset (Fin k) := TreeMissingColors mu Tn \ (Rprev ∪ R ∪ ({ alpha } : Finset (Fin + k))); S.Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu em Cm H q n Tn D R hz i Dprev + Rprev eta hforbiddenCard hlarge S + apply Finset.card_pos.mp + rw [Finset.card_sdiff] + have hi : ((Rprev ∪ R ∪ {alpha}) ∩ TreeMissingColors mu Tn).card ≤ + (Rprev ∪ R ∪ {alpha}).card := Finset.card_le_card Finset.inter_subset_left + omega + +private theorem helper_hminus_645.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (hz : (0 : ℕ) < H.dividerCount), + let i : Fin H.dividerCount := (⟨H.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin H.dividerCount); q = i.succ → A = H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) → + let Dprev : Finset (Fin k) := HierarchyStoredColorsAt H i.succ; + let Rprev : Finset (Fin k) := Dprev.biUnion (Cm.good.gamma i.castSucc); + ∀ (_ : Fin k), TreeColorSetMinusClosed G mu A Rprev := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu Cm H q A hz i hq hAeq Dprev + Rprev eta + have hstage : i.succ.castSucc = + (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := by + apply Fin.ext + simp [i] + omega + rw [hAeq] + simpa [Rprev, Dprev, q, hq, hstage] using Cm.good.minusClosed i + +private theorem helper_firstSpec_687.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G rho (T.vertex i) → c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ HierarchyFirstMissingPosition rho T c ≤ i := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation rho c i hi + let s : Finset (Fin (T.length + 1)) := + Finset.univ.filter fun j => c ∈ MissingColors G rho (T.vertex j) + have his : i ∈ s := by simp [s, hi] + have hs : s.Nonempty := ⟨i, his⟩ + have hp : HierarchyFirstMissingPosition rho T c = s.min' hs := by + simp only [HierarchyFirstMissingPosition, s, dite_eq_left hs] + rw [hp] + exact ⟨(Finset.mem_filter.mp (Finset.min'_mem s hs)).2, + Finset.min'_le s i his⟩ + +private theorem helper_hAlphaAtFirst_721.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; TreeSequenceInitialSegment A T → alpha + ∈ TreeMissingColors mu A → ( + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G rho (T.vertex i) → c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ HierarchyFirstMissingPosition rho T c ≤ i) → + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; alpha ∈ + MissingColors G mu (T.vertex ia) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha mu Cm H q A hAT haA + firstSpec ia + obtain ⟨w, hw, hmw⟩ := Finset.mem_biUnion.mp haA + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hw + obtain ⟨i, hi⟩ := hw + let iT := Fin.castLE (Nat.succ_le_succ hAT.1) i + have hwi : alpha ∈ MissingColors G mu (T.vertex iT) := by + rw [hAT.2.1 i, hi] + exact hmw + exact (firstSpec mu alpha iT hwi).1 + +private theorem helper_hiaBound_730.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; TreeSequenceInitialSegment A T → alpha + ∈ TreeMissingColors mu A → + ∀ (_ : Fin k), ( + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G rho (T.vertex i) → c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ HierarchyFirstMissingPosition rho T c ≤ i) → + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; (↑ia : ℕ) ≤ + A.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 mu Cm H q A hAT haA + gamma firstSpec ia + obtain ⟨w, hw, hmw⟩ := Finset.mem_biUnion.mp haA + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hw + obtain ⟨i, hi⟩ := hw + let iT := Fin.castLE (Nat.succ_le_succ hAT.1) i + have hwi : alpha ∈ MissingColors G mu (T.vertex iT) := by + rw [hAT.2.1 i, hi] + exact hmw + have hs := firstSpec mu alpha iT hwi + have hv := hs.2 + change ia.val ≤ i.val at hv + have := i.isLt + omega + +private theorem helper_equalTrees_758.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S U → S.length = U.length → S = U := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation S U hSU hlen + clear * - hSU hlen + cases S with + | mk ls ps vs es vis eis fs aas => + cases U with + | mk lu pu vu eu viu eiu fu aau => + simp only at hlen + subst lu + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.1 i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.2 i).symm + +private theorem helper_hBToTy_789.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (_ : Fin k) (_ : Fin T.length), + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + ∀ (hsum : A.length + ell = T.length), TreeSequenceInitialSegment B T → + ∀ (_ : Fin k) (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); TreeSequenceInitialSegment Ty T → Ty.length = B.length → TreeSequenceInitialSegment B Ty + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 Cm H q A ell B hsum + hBT gamma htaildiff Ty hTyT hTyLen + refine ⟨hTyLen.symm.le, ?_, ?_⟩ + · intro i + let j : Fin (Ty.length + 1) := Fin.cast (congrArg Nat.succ hTyLen.symm) i + calc + B.vertex i = T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) i) := hBT.2.1 i + _ = T.vertex (Fin.castLE (Nat.succ_le_succ hTyT.1) j) := by + congr 1 + _ = Ty.vertex j := (hTyT.2.1 j).symm + · intro i + let j : Fin Ty.length := Fin.cast hTyLen.symm i + calc + B.edge i = T.edge (Fin.castLE hBT.1 i) := hBT.2.2 i + _ = T.edge (Fin.castLE hTyT.1 j) := by + congr 1 + _ = Ty.edge j := (hTyT.2.2 j).symm + +private theorem helper_leaf_822.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), ( + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), Disjoint (MissingColors G + P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C + i).length))) (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + let mu : PartialEdgeColoring E k := P.coloring; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + ∀ (gamma : Fin k), gamma ≠ alpha → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu gamma alpha; + ∀ (v : V), gamma ∈ MissingColors G mu v ∨ alpha ∈ MissingColors G mu v → (J.neighborSet + (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha _ mu cm gamma hne J v hv + have hd : @SimpleGraph.degree _ J (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hv with hv | hv + · exact MissingColorIncidenceEndpoint G mu gamma alpha hne cm.proper v hv + · have hj : J = TwoColorIncidenceGraph G mu alpha gamma := by + ext x z + cases x <;> cases z <;> simp [J, TwoColorIncidenceGraph, or_comm] + rw [hj] + exact MissingColorIncidenceEndpoint G mu alpha gamma hne.symm cm.proper v hv + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx z hz + exact Finset.card_le_one_iff.mp hd + (by simpa only [SimpleGraph.mem_neighborFinset, SimpleGraph.mem_neighborSet] using hx) + (by simpa only [SimpleGraph.mem_neighborFinset, SimpleGraph.mem_neighborSet] using hz) + +private theorem helper_hyNotA_838.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (_ : Fin k) (_ : Fin T.length), + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); (2 : ℕ) ≤ ell → TreeSequenceInitialSegment A T → + ∀ (hsum : A.length + ell = T.length), B.length = T.length - (1 : ℕ) → + ∀ (_ : Fin k) (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ) → Ty.length = B.length → y + ∉ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 Cm H q A ell B y htwo + hAT hsum hBlen gamma htaildiff Ty hidx hTyLen hy + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hy + obtain ⟨i, hi⟩ := hy + have heq : T.vertex (Fin.castLE (Nat.succ_le_succ hAT.1) i) = + T.vertex (Fin.last T.length) := by + rw [hAT.2.1 i] + exact hi + have hidx := congrArg Fin.val (T.vertex_injective heq) + have hiLt := i.isLt + simp at hidx + omega + +private theorem helper_branch_859.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), ( + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), Disjoint (MissingColors G + P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C + i).length))) (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + let mu : PartialEdgeColoring E k := P.coloring; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let y : V := T.vertex (Fin.last T.length); alpha ∈ MissingColors G mu y → + ∀ (gamma : Fin k), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T gamma; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let vg : V := T.vertex ig; gamma ∈ MissingColors G mu vg → alpha ∈ MissingColors G mu + (T.vertex ia) → TwoColorComponent G mu gamma alpha (Sum.inl vg) = TwoColorComponent G mu + gamma alpha (Sum.inl (T.vertex ia)) → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu gamma alpha; + let Q : Set (V ⊕ E) := TwoColorComponent G mu gamma alpha (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G mu gamma alpha (Sum.inl v)) → ( + ∀ (v : V), gamma ∈ MissingColors G mu v ∨ alpha ∈ MissingColors G mu v → (J.neighborSet + (Sum.inl v)).Subsingleton) → vg ≠ y → T.vertex ia ≠ y → TwoColorComponent G mu gamma alpha + (Sum.inl y) = TwoColorComponent G mu gamma alpha (Sum.inl vg) → Disjoint Q + (TwoColorComponent G mu gamma alpha (Sum.inl vg)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha _ mu cm y haY gamma ig + ia vg hgamvg hAlphaAtFirst hsame J Q self leaf hvgNeY hiaNeY heq + obtain ⟨u, v, path, hp, hs⟩ := + TwoColorComponentSpanningPath G mu gamma alpha cm.proper (Sum.inl y) + have endpoint (w : V) (hw : Sum.inl w ∈ Q) + (hl : Set.Subsingleton (J.neighborSet (Sum.inl w))) : + Sum.inl w = u ∨ Sum.inl w = v := by + have hm : Sum.inl w ∈ path.support := by + change Sum.inl w ∈ {x | x ∈ path.support} + rw [hs] + exact hw + by_contra hn + push Not at hn + exact hp.isTrail.notMem_support_of_subsingleton_neighborSet hn.1 hn.2 hl hm + change Q = TwoColorComponent G mu gamma alpha (Sum.inl vg) at heq + have hvgQ : Sum.inl vg ∈ Q := by rw [heq]; exact self vg + have hyQ : Sum.inl y ∈ Q := self y + have hevg := endpoint vg hvgQ (leaf vg (Or.inl hgamvg)) + have hey := endpoint y hyQ (leaf y (Or.inr haY)) + by_cases hsameRoot : vg = T.vertex ia + · have hboth : gamma ∈ MissingColors G mu vg ∧ alpha ∈ MissingColors G mu vg := by + constructor + · exact hgamvg + · simpa [hsameRoot] using hAlphaAtFirst + have hnoAdj : ∀ w, ¬ J.Adj (Sum.inl vg) w := by + intro w hadj + simp only [J, TwoColorIncidenceGraph] at hadj + rcases w with w | f + · simp [] at hadj + · rcases hadj with ⟨hinc, hcol⟩ + rcases hcol with hc | hc + · exact (Finset.mem_sdiff.mp hboth.1).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, ⟨f, hinc, hc⟩⟩) + · exact (Finset.mem_sdiff.mp hboth.2).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, ⟨f, hinc, hc⟩⟩) + have hmem : Sum.inl vg ∈ J.connectedComponentMk (Sum.inl y) := by + change Sum.inl vg ∈ Q + rw [heq] + exact SimpleGraph.ConnectedComponent.connectedComponentMk_mem + have hreach : J.Reachable (Sum.inl vg) (Sum.inl y) := + SimpleGraph.ConnectedComponent.eq.mp hmem + have hempty : J.neighborSet (Sum.inl vg) = ∅ := + Set.eq_empty_iff_forall_notMem.mpr (fun w hw => + hnoAdj w (by simpa only [SimpleGraph.mem_neighborSet] using hw)) + have hvgY : (Sum.inl vg : Sum V E) ≠ Sum.inl y := by + intro h + exact hvgNeY (Sum.inl.inj h) + exact False.elim + ((SimpleGraph.not_reachable_of_neighborSet_left_eq_empty (G := J) hvgY hempty) hreach) + · have hiaQ : Sum.inl (T.vertex ia) ∈ Q := by + rw [heq, hsame] + exact self (T.vertex ia) + have heia := endpoint (T.vertex ia) hiaQ + (leaf (T.vertex ia) (Or.inr hAlphaAtFirst)) + have hneqGA : vg ≠ T.vertex ia := hsameRoot + have hneqGY : vg ≠ y := hvgNeY + have hneqAY : T.vertex ia ≠ y := hiaNeY + rcases hevg with hgu | hgv + · rcases heia with hau | hav + · rcases hey with hyu | hyv + · exact False.elim (hneqGA (Sum.inl.inj (hgu.trans hau.symm))) + · exact False.elim (hneqGA (Sum.inl.inj (hgu.trans hau.symm))) + · rcases hey with hyu | hyv + · exact False.elim (hneqGY (Sum.inl.inj (hgu.trans hyu.symm))) + · exact False.elim (hneqAY (Sum.inl.inj (hav.trans hyv.symm))) + · rcases heia with hau | hav + · rcases hey with hyu | hyv + · exact False.elim (hneqAY (Sum.inl.inj (hau.trans hyu.symm))) + · exact False.elim (hneqGY (Sum.inl.inj (hgv.trans hyv.symm))) + · rcases hey with hyu | hyv + · exact False.elim (hneqGA (Sum.inl.inj (hgv.trans hav.symm))) + · exact False.elim (hneqGA (Sum.inl.inj (hgv.trans hav.symm))) + +private theorem helper_hAstage_932.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyPathNumber P.counterexample.hierarchy = (1 : ℕ) → + ∀ (_ : Fin k) (_ : Fin T.length), + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + ∀ (_ : A.length + ell = T.length) (_ : Fin k) (_ : T.length - A.length = ell), + (0 : ℕ) < H.dividerCount → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 Cm H q A ell hsum + gamma htaildiff hp + obtain hzero | ⟨r, hr⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp [q] at hv + omega + · simp only [A, HierarchyStarredStage, hr, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hr + simpa [q] using hv.symm + +private theorem helper_hQoutsideA_956.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let y : V := T.vertex (Fin.last T.length); + ∀ (gamma : Fin k), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T gamma; + let vg : V := T.vertex ig; vg ∈ TreeSequenceVertexSet A → TreeInterchangeable G A mu gamma + alpha → + let Q : Set (V ⊕ E) := TwoColorComponent G mu gamma alpha (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G mu gamma alpha (Sum.inl v)) → Disjoint Q + (TwoColorComponent G mu gamma alpha (Sum.inl vg)) → TwoColorPathComponent G mu gamma alpha + (Sum.inl y) → TwoColorPathComponent G mu gamma alpha (Sum.inl vg) → + ∀ w ∈ TreeSequenceVertexSet A, Sum.inl w ∉ Q := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha mu Cm H q A y gamma ig + vg hvgInA hinterchangeable Q self hdisjoint hpath hvgPath w hw hwQ + have hsameComp := hinterchangeable (Sum.inl y) (Sum.inl vg) hpath hvgPath + ⟨w, hw, hwQ⟩ ⟨vg, hvgInA, self vg⟩ + have hvgQ : Sum.inl vg ∈ Q := by + change Sum.inl vg ∈ TwoColorComponent G mu gamma alpha (Sum.inl y) + rw [hsameComp] + exact self vg + exact Set.disjoint_left.mp hdisjoint hvgQ (self vg) + +private theorem helper_branch_975.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); ColoredVertexSetElementary G mu + (TreeSequenceVertexSet B) → TreeSequenceInitialSegment A B → + ∀ (gamma : Fin k), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T gamma; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let vg : V := T.vertex ig; gamma ∈ MissingColors G mu vg → vg ∈ TreeSequenceVertexSet A → + alpha ∈ MissingColors G mu (T.vertex ia) → T.vertex ia ∈ TreeSequenceVertexSet A → + TwoColorComponent G mu gamma alpha (Sum.inl vg) = TwoColorComponent G mu gamma alpha + (Sum.inl (T.vertex ia)) → + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu gamma alpha; + let Q : Set (V ⊕ E) := TwoColorComponent G mu gamma alpha (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G mu gamma alpha (Sum.inl v)) → Disjoint Q + (TwoColorComponent G mu gamma alpha (Sum.inl vg)) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); ( + ∀ (v : V) (c : Fin k), c ≠ gamma → c ≠ alpha → (c ∈ MissingColors G (TwoColorComponentSwap G + mu gamma alpha (Sum.inl y)) v ↔ c ∈ MissingColors G mu v)) → + ∀ w ∈ TreeSequenceVertexSet B, Sum.inl w ∈ Q → MissingColors G sigma w = MissingColors G mu w + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu Cm H q A ell B y helem hAB gamma + ig ia vg hgamvg hvgInA hAlphaAtFirst hiaInA hsame J Q self hdisjoint sigma missingOther w + hw hwQ + have hwGamma : w ≠ vg := by + intro h + subst w + exact Set.disjoint_left.mp hdisjoint hwQ (self vg) + have hwAlpha : w ≠ T.vertex ia := by + intro h + subst w + exact Set.disjoint_left.mp hdisjoint hwQ (by rw [hsame]; exact self (T.vertex ia)) + have hng : gamma ∉ MissingColors G mu w := fun hm => + Finset.disjoint_left.mp (helem hw (TreeSequenceInitialSegmentVertexSetSubset hAB hvgInA) + hwGamma) hm hgamvg + have hna : alpha ∉ MissingColors G mu w := fun hm => + Finset.disjoint_left.mp (helem hw (TreeSequenceInitialSegmentVertexSetSubset hAB hiaInA) + hwAlpha) hm hAlphaAtFirst + obtain ⟨fg, hfg, hfgc⟩ : ∃ f, Incident G w f ∧ mu f = some gamma := by + simpa [MissingColors, PresentColors] using hng + obtain ⟨fa, hfa, hfac⟩ : ∃ f, Incident G w f ∧ mu f = some alpha := by + simpa [MissingColors, PresentColors] using hna + have edgeOfVertex {v : V} {f : E} + (hv : Sum.inl v ∈ Q) (hf : Incident G v f) + (hc : mu f = some gamma ∨ mu f = some alpha) : Sum.inr f ∈ Q := by + change J.connectedComponentMk (Sum.inl v) = J.connectedComponentMk (Sum.inl y) at hv + change J.connectedComponentMk (Sum.inr f) = J.connectedComponentMk (Sum.inl y) + have hadj : J.Adj (Sum.inr f) (Sum.inl v) := by + simpa only [J, TwoColorIncidenceGraph] using And.intro hf hc + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv + have hfgQ := edgeOfVertex hwQ hfg (Or.inl hfgc) + have hfaQ := edgeOfVertex hwQ hfa (Or.inr hfac) + have hnewAlpha : sigma fg = some alpha := by + simp [sigma, TwoColorComponentSwap, Q, hfgQ, hfgc] + have hnewGamma : sigma fa = some gamma := by + simp [sigma, TwoColorComponentSwap, Q, hfaQ, hfac] + have hnsGamma : gamma ∉ MissingColors G sigma w := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, not_not] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fa, hfa, hnewGamma⟩ + have hnsAlpha : alpha ∉ MissingColors G sigma w := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, not_not] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fg, hfg, hnewAlpha⟩ + ext c + by_cases hcg : c = gamma + · rw [hcg] + simp only [hng, hnsGamma] + by_cases hca : c = alpha + · rw [hca] + simp only [hna, hnsAlpha] + exact missingOther w c hcg hca + +private theorem helper_he1Incident_1026.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (_ : Fin k) (e1 : Fin T.length), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); (↑e1 : ℕ) = A.length) → + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → + ∀ (hsum : A.length + ell = T.length), B.length = T.length - (1 : ℕ) → + ∀ (_ : Fin k) (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ) → Ty.length = B.length → + TreeIncidentEdge A (T.edge e1) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 he1 Cm H q A ell B + hAT hsum hBlen gamma htaildiff Ty hidx hTyLen + obtain ⟨i, hi⟩ := T.attaches e1 + have hiBound : i.val ≤ A.length := by + have hiLt := i.isLt + have heval : e1.val = A.length := by exact he1 + omega + let iA : Fin (A.length + 1) := ⟨i.val, by omega⟩ + have hindex : Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ e1.isLt)) = + Fin.castLE (Nat.succ_le_succ hAT.1) iA := by + apply Fin.ext + rfl + refine ⟨A.vertex iA, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · change A.vertex iA ∈ G.ends (T.edge e1) + rw [← hAT.2.1 iA, hindex.symm, hi] + simp + +private theorem helper_he1notQ_1042.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) (e1 : Fin T.length), P.coloring (T.edge e1) = some alpha → + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let y : V := T.vertex (Fin.last T.length); + ∀ (gamma : Fin k), + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu gamma alpha; + let Q : Set (V ⊕ E) := TwoColorComponent G mu gamma alpha (Sum.inl y); ( + ∀ w ∈ TreeSequenceVertexSet A, Sum.inl w ∉ Q) → TreeIncidentEdge A (T.edge e1) → Sum.inr + (T.edge e1) ∉ Q := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 hfirst mu Cm H q A y + gamma J Q hQoutsideA he1Incident hQe + obtain ⟨w, hwA, hwInc⟩ := he1Incident + have hadj : J.Adj (Sum.inl w) (Sum.inr (T.edge e1)) := by + change Incident G w (T.edge e1) ∧ + (mu (T.edge e1) = some gamma ∨ mu (T.edge e1) = some alpha) + exact ⟨hwInc, Or.inr hfirst⟩ + have hwQ : Sum.inl w ∈ Q := by + change J.connectedComponentMk (Sum.inl w) = J.connectedComponentMk (Sum.inl y) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hQe + exact hQoutsideA w hwA hwQ + +private theorem helper_hXT_1058.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyPathNumber P.counterexample.hierarchy = (1 : ℕ) → + ∀ (_ : Fin k) (_ : Fin T.length), + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + ∀ (htwo : (2 : ℕ) ≤ ell) (hsum : A.length + ell = T.length) + (hBlen : B.length = T.length - (1 : ℕ)) (_ : Fin k) + (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega) + (by omega); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) + (hTyLen : Ty.length = B.length) (hAshort : A.length + (1 : ℕ) < T.length), + let X : TreeSequence G e0 := + TreeSequencePrefix T (A.length + (1 : ℕ)) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ A.length + (1 : ℕ)) ↦ by omega) + (have _ : A.length + (1 : ℕ) < T.length := hAshort; + Decidable.byContradiction fun (a : ¬A.length + (1 : ℕ) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment X T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 Cm H q A ell B htwo + hsum hBlen gamma htaildiff Ty hidx hTyLen hAshort X + refine ⟨hAshort.le, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + +private theorem helper_prefixOverlap_1064.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S T → TreeSequenceInitialSegment U T → + S.length ≤ U.length → TreeSequenceInitialSegment S U := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation S U hST hUT hle + refine ⟨hle, ?_, ?_⟩ + · intro i + let j : Fin (U.length + 1) := Fin.castLE (Nat.succ_le_succ hle) i + calc + U.vertex j = T.vertex (Fin.castLE (Nat.succ_le_succ hUT.1) j) := + (hUT.2.1 j).symm + _ = T.vertex (Fin.castLE (Nat.succ_le_succ hST.1) i) := by + congr 1 + _ = S.vertex i := hST.2.1 i + · intro i + let j : Fin U.length := Fin.castLE hle i + calc + U.edge j = T.edge (Fin.castLE hUT.1 j) := (hUT.2.2 j).symm + _ = T.edge (Fin.castLE hST.1 i) := by congr 1 + _ = S.edge i := hST.2.2 i + +private theorem helper_hXB_1088.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + ∀ (htwo : (2 : ℕ) ≤ ell) (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 + : ℕ)), TreeSequenceInitialSegment B T → + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + ∀ (gamma : Fin k) (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length), ( + let H : TashkinovHierarchy em bm := Cm.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors em.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition mu T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition mu T alpha); + have sameComponent : Prop := TwoColorComponent G mu gamma alpha (Sum.inl va) = + TwoColorComponent G mu gamma alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors mu Tnq ∨ Disjoint (insert gamma ({ alpha } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors mu + Tn ∨ Disjoint (insert gamma ({ alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (gamma ∈ TreeMissingColors mu A ∧ TreeColorSetClosed G mu A ({ gamma } : + Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A mu gamma alpha)) → + ∀ (hAshort : A.length + (1 : ℕ) < T.length), ((0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (0 : ℕ) < H.dividerCount ∧ gamma ∈ TreeMissingColors mu + (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + mu Tn ∨ gamma ∈ TreeMissingColors mu A ∧ gamma ∉ TashkinovStoredColors em.series.data n ∧ + alpha ∉ TashkinovStoredColors em.series.data n) → + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (1 : ℕ)) ↦ + by omega + ) ( + have _ : A.length + (1 : ℕ) < T.length := hAshort; Decidable.byContradiction fun (a : + ¬A.length + (1 : ℕ) ≤ T.length) ↦ + by omega + ); X.length = A.length + (1 : ℕ) → TreeSequenceInitialSegment X T → ( + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S T → TreeSequenceInitialSegment U T → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment X B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 mu em bm Cm H q A ell + B htwo hsum hBlen hBT n Tn gamma htaildiff Ty hidx hTyLen hchange hAshort hAstage hcase X + hXlen hXT prefixOverlap + have hlen : X.length ≤ B.length := by + rw [hBlen] + rw [hXlen] + omega + exact prefixOverlap hXT hBT hlen + +private theorem helper_hfixedPrefix_1094.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) (e1 : Fin T.length), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); (↑e1 : ℕ) = A.length) → + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ (htwo : (2 : ℕ) ≤ ell) (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 + : ℕ)) (gamma : Fin k) (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length) (hAshort : A.length + (1 : ℕ) < T.length), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); + sigma (T.edge e1) = mu (T.edge e1) → + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (1 : ℕ)) ↦ + by omega + ) ( + have _ : A.length + (1 : ℕ) < T.length := hAshort; Decidable.byContradiction fun (a : + ¬A.length + (1 : ℕ) ≤ T.length) ↦ + by omega + ); X.length = A.length + (1 : ℕ) → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → sigma (T.edge t) = mu + (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 he1 mu Cm H q A ell B + y htwo hsum hBlen gamma htaildiff Ty hidx hTyLen hAshort sigma hfixedSeed X hXlen t ht hlt + have htval : t.val = A.length := by + rw [hXlen] at hlt + omega + have hteq : t = e1 := Fin.ext (by rw [htval, he1]) + rw [hteq] + exact hfixedSeed + +private theorem helper_hstoredFirst_1103.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let y : V := T.vertex (Fin.last T.length); alpha ∈ TreeMissingColors mu A → + ∀ gamma ∈ TreeMissingColors mu A, + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); ( + ∀ (v : V) (c : Fin k), c ≠ gamma → c ≠ alpha → (c ∈ MissingColors G (TwoColorComponentSwap G + mu gamma alpha (Sum.inl y)) v ↔ c ∈ MissingColors G mu v)) → + ∀ eta ∈ HierarchyStoredColorsAt H q, HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition mu T eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha mu Cm H q A y haA gamma + hgammaA sigma missingOther eta heta + have hnotA : eta ∉ TreeMissingColors mu A := (Finset.mem_sdiff.mp heta).2 + have hηGamma : eta ≠ gamma := by + intro he + exact hnotA (he ▸ hgammaA) + have hηAlpha : eta ≠ alpha := by + intro he + exact hnotA (he ▸ haA) + have heq : (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G sigma (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G mu (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact missingOther _ eta hηGamma hηAlpha + simp only [HierarchyFirstMissingPosition, heq] + +private theorem helper_hgammaCutoff_1122.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) (e1 : Fin T.length), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); (↑e1 : ℕ) = A.length) → P.coloring (T.edge e1) = + some alpha → + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + ∀ (htwo : (2 : ℕ) ≤ ell) (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 + : ℕ)), + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); + ∀ gamma ∉ R, + ∀ (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length) (hAshort : A.length + (1 : ℕ) < T.length), + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (1 : ℕ)) ↦ + by omega + ) ( + have _ : A.length + (1 : ℕ) < T.length := hAshort; Decidable.byContradiction fun (a : + ¬A.length + (1 : ℕ) ≤ T.length) ↦ + by omega + ); X.length = A.length + (1 : ℕ) → + ∀ eta ∈ HierarchyStoredColorsAt H q, gamma ∈ Cm.good.gamma q eta ∨ alpha ∈ Cm.good.gamma q eta + → (↑(HierarchyFirstMissingPosition mu T eta) : ℕ) ≤ X.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 he1 hfirst mu Cm H q + A ell B htwo hsum hBlen D R gamma hgammaR htaildiff Ty hidx hTyLen hAshort X hXlen + clear * - X mu T H q A Cm gamma alpha R hgammaR hfirst e1 he1 hXlen + intro eta heta hp + have havoid := Cm.good.avoidance q eta heta + rcases hp with hg | ha + · exact False.elim (hgammaR (Finset.mem_biUnion.mpr ⟨eta, heta, hg⟩)) + · by_contra hnot + have hpast : X.length < (HierarchyFirstMissingPosition mu T eta).val := by omega + have he1A : e1.val = A.length := by simpa [A, H, q] using he1 + have hterminal : H.stage q.succ = T := by + have hq : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + rw [hq, H.terminalStage] + have hsegment : alpha ∈ HierarchySegmentColors H q eta := by + change alpha ∈ Finset.univ.filter fun c => ∃ r : Fin (H.stage q.succ).length, + A.length ≤ r.val ∧ r.val < + min (HierarchyFirstMissingPosition mu T eta).val (H.stage q.succ).length ∧ + mu ((H.stage q.succ).edge r) = some c + rw [hterminal] + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨e1, ?_, ?_, hfirst⟩ + · omega + · apply Nat.lt_min.mpr + constructor + · rw [hXlen] at hpast + omega + · exact e1.isLt + exact (Finset.mem_sdiff.mp (havoid ha)).2 hsegment + +private theorem helper_branch_1162.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let y : V := T.vertex (Fin.last T.length); + ∀ (gamma : Fin k), + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu gamma alpha; + let Q : Set (V ⊕ E) := TwoColorComponent G mu gamma alpha (Sum.inl y); ( + ∀ w ∈ TreeSequenceVertexSet A, Sum.inl w ∉ Q) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); + ∀ (t : Fin A.length), A.vertex t.succ ∈ TreeSequenceVertexSet A → Incident G (A.vertex t.succ) + (A.edge t) → Sum.inr (A.edge t) ∈ Q → sigma (A.edge t) = mu (A.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha mu Cm H q A y gamma J Q + hQoutsideA sigma t htVertex htIncident hQe + have hcolor : mu (A.edge t) = some gamma ∨ mu (A.edge t) = some alpha := by + have hsupp : Sum.inr (A.edge t) ∈ J.support := by + apply SimpleGraph.mem_support_of_reachable (G := J) + (u := Sum.inr (A.edge t)) (v := Sum.inl y) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp hQe + obtain ⟨z, hz⟩ := J.mem_support.mp hsupp + cases z with + | inl z => exact hz.2 + | inr f => simp [J, TwoColorIncidenceGraph] at hz + have hadj : J.Adj (Sum.inl (A.vertex t.succ)) (Sum.inr (A.edge t)) := by + change Incident G (A.vertex t.succ) (A.edge t) ∧ + (mu (A.edge t) = some gamma ∨ mu (A.edge t) = some alpha) + exact ⟨htIncident, hcolor⟩ + have hvQ : Sum.inl (A.vertex t.succ) ∈ Q := by + change J.connectedComponentMk (Sum.inl (A.vertex t.succ)) = + J.connectedComponentMk (Sum.inl y) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hQe + exact (hQoutsideA _ htVertex hvQ).elim + +private theorem helper_hfixedX_1181.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) (e1 : Fin T.length), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); (↑e1 : ℕ) = A.length) → + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ (htwo : (2 : ℕ) ≤ ell), TreeSequenceInitialSegment A T → + ∀ (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 : ℕ)) (gamma : Fin k) + (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length) (hAshort : A.length + (1 : ℕ) < T.length), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); + sigma (T.edge e1) = mu (T.edge e1) → + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (1 : ℕ)) ↦ + by omega + ) ( + have _ : A.length + (1 : ℕ) < T.length := hAshort; Decidable.byContradiction fun (a : + ¬A.length + (1 : ℕ) ≤ T.length) ↦ + by omega + ); X.length = A.length + (1 : ℕ) → TreeSequenceInitialSegment X T → ( + ∀ (t : Fin A.length), sigma (A.edge t) = mu (A.edge t)) → + ∀ (t : Fin X.length), sigma (X.edge t) = mu (X.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 he1 mu Cm H q A ell B + y htwo hAT hsum hBlen gamma htaildiff Ty hidx hTyLen hAshort sigma hfixedSeed X hXlen hXT + hfixedA t + have htbound : t.val < A.length + 1 := by simpa only [hXlen] using t.isLt + have htval : t.val ≤ A.length := by omega + by_cases htSeed : t.val = A.length + · have hteq : Fin.castLE hXT.1 t = e1 := by + apply Fin.ext + have hv := he1 + change e1.val = A.length at hv + simp only [Fin.val_castLE] + rw [hv] + exact htSeed + rw [← hXT.2.2 t, hteq] + exact hfixedSeed + · have htA : t.val < A.length := by omega + let tA : Fin A.length := ⟨t.val, htA⟩ + have he : Fin.castLE hXT.1 t = Fin.castLE hAT.1 tA := by + apply Fin.ext + rfl + rw [← hXT.2.2 t, he, hAT.2.2 tA] + exact hfixedA tA + +private theorem helper_segTrans_1202.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation S U W hSU hUW + refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ + · intro j + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) j)).trans (hSU.2.1 j) + · intro j + exact (hUW.2.2 (Fin.castLE hSU.1 j)).trans (hSU.2.2 j) + +private theorem helper_coreToA_1217.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyPathNumber P.counterexample.hierarchy = (1 : ℕ) → + ∀ (_ : Fin k) (_ : Fin T.length), + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + ∀ (_ : (2 : ℕ) ≤ ell) (hsum : A.length + ell = T.length) + (_ : B.length = T.length - (1 : ℕ)), + (H.dividerCount = (0 : ℕ) → A = bm.core) → + ∀ (_ : Fin k) (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega) + (by omega); + ∀ (_ : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) + (_ : Ty.length = B.length) (_ : A.length + (1 : ℕ) < T.length), + ((0 : ℕ) < H.dividerCount → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + TreeSequenceInitialSegment bm.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 bm Cm H q A ell B + htwo hsum hBlen hAcore gamma htaildiff Ty hidx hTyLen hAshort hAstage segTrans stageSegment + by_cases hz : H.dividerCount = 0 + · rw [hAcore hz] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · rw [hAstage (Nat.pos_of_ne_zero hz)] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + +private theorem helper_branch_1237.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) , + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ (htwo : (2 : ℕ) ≤ ell) (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 + : ℕ)) (gamma : Fin k) (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length) (hAshort : A.length + (1 : ℕ) < T.length), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v) → + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (1 : ℕ)) ↦ + by omega + ) ( + have _ : A.length + (1 : ℕ) < T.length := hAshort; Decidable.byContradiction fun (a : + ¬A.length + (1 : ℕ) ≤ T.length) ↦ + by omega + ); TreeSequenceInitialSegment X B → ( + ∀ (t : Fin X.length), sigma (X.edge t) = mu (X.edge t)) → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) → + ∀ {a c : TreeSequence G e0}, TashkinovAugmentation mu a c → Relation.ReflTransGen + (TashkinovAugmentation mu) c X → Relation.ReflTransGen (TashkinovAugmentation sigma) c X → + Relation.ReflTransGen (TashkinovAugmentation sigma) a X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha mu Cm H q A ell B y htwo + hsum hBlen gamma htaildiff Ty hidx hTyLen hAshort sigma hmissingBEquality X hXB hfixedX + segTrans U W hstep htail ih + obtain ⟨hlen, hUW, c, hcolor, hc⟩ := hstep + have hWX := TashkinovAugmentationSequenceInitialSegment mu W X htail + have hUX := segTrans hUW hWX + have hcNew : c ∈ TreeMissingColors sigma U := by + obtain ⟨v, hvU, hcv⟩ := Finset.mem_biUnion.mp hc + have hvB := TreeSequenceInitialSegmentVertexSetSubset hXB + (TreeSequenceInitialSegmentVertexSetSubset hUX hvU) + exact Finset.mem_biUnion.mpr ⟨v, hvU, (hmissingBEquality v hvB).symm ▸ hcv⟩ + let tW : Fin W.length := Fin.cast hlen.symm (Fin.last U.length) + have hf := hfixedX (Fin.castLE hWX.1 tW) + rw [hWX.2.2 tW] at hf + exact Relation.ReflTransGen.head ⟨hlen, hUW, c, hf.trans hcolor, hcNew⟩ ih + +private theorem helper_branch_1267.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ (htwo : (2 : ℕ) ≤ ell) (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 + : ℕ)), + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + ∀ (gamma : Fin k) (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length) (hAshort : A.length + (1 : ℕ) < T.length), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (1 : ℕ)) ↦ + by omega + ) ( + have _ : A.length + (1 : ℕ) < T.length := hAshort; Decidable.byContradiction fun (a : + ¬A.length + (1 : ℕ) ≤ T.length) ↦ + by omega + ); X.length = A.length + (1 : ℕ) → TreeSequenceInitialSegment X T → ( + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S T → TreeSequenceInitialSegment U T → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment Tn A → + ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence mu S X → + TashkinovAugmentationSequence sigma S X) → em.series.data.kind (Fin.last em.rounds) = some + TashkinovExtensionKind.SE ∨ em.series.data.kind (Fin.last em.rounds) = some + TashkinovExtensionKind.RE → + ∀ (f : E) (seed : TreeSequence G e0), em.series.data.connectingEdges (Fin.last em.rounds) = + ({ f } : Finset E) → TreeSequenceAdjoinEdge (em.series.data.tree (Fin.last + em.rounds).castSucc) f seed → TashkinovAugmentationSequence mu seed T → + (em.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + sigma Tn X ∨ (em.series.data.kind n = some TashkinovExtensionKind.SE ∨ em.series.data.kind + n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), em.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X) ∧ + TashkinovAugmentationSequence mu X T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 mu em Cm H q A ell B + y htwo hsum hBlen n Tn gamma htaildiff Ty hidx hTyLen hAshort sigma X hXlen hXT + prefixOverlap hTnA transportRoute hkind f seed hedges hadjoin hroute + have hseedT := TashkinovAugmentationSequenceInitialSegment mu seed T hroute + have hseedX : TreeSequenceInitialSegment seed X := + prefixOverlap hseedT hXT (by + have hseedLen := hadjoin.1 + change seed.length = Tn.length + 1 at hseedLen + have := hTnA.1 + simp only [X, TreeSequencePrefix] + omega) + have hrouteX := TashkinovAugmentationSequenceRestrict mu seed X T hroute hseedX hXT + exact ⟨Or.inr ⟨hkind, f, seed, hedges, hadjoin, transportRoute seed hrouteX⟩, + TashkinovAugmentationSequenceSuffix mu seed X T hroute hseedX hXT⟩ + +private theorem helper_hsplitMissing_1278.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k) (_ : Fin T.length), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ (htwo : (2 : ℕ) ≤ ell) (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 + : ℕ)), TreeSequenceInitialSegment A B → alpha ∈ TreeMissingColors mu A → + ∀ gamma ∈ TreeMissingColors mu A, + ∀ (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length) (hAshort : A.length + (1 : ℕ) < T.length), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v) → + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (1 : ℕ)) ↦ + by omega + ) ( + have _ : A.length + (1 : ℕ) < T.length := hAshort; Decidable.byContradiction fun (a : + ¬A.length + (1 : ℕ) ≤ T.length) ↦ + by omega + ); TreeSequenceInitialSegment A X → gamma ∈ TreeMissingColors sigma X ∧ alpha ∈ + TreeMissingColors sigma X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha e1 mu Cm H q A ell B y + htwo hsum hBlen hAB haA gamma hgammaA htaildiff Ty hidx hTyLen hAshort sigma + hmissingBEquality X hAX + constructor + · obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp hgammaA + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hAX hv, + (hmissingBEquality v (TreeSequenceInitialSegmentVertexSetSubset hAB hv)).symm ▸ hmv⟩ + · obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp haA + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hAX hv, + (hmissingBEquality v (TreeSequenceInitialSegmentVertexSetSubset hAB hv)).symm ▸ hmv⟩ + +private theorem helper_branch_1321.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + let y : V := T.vertex (Fin.last T.length); + ∀ (Pnew : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (¬ + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), Disjoint (MissingColors G + Pnew.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C + i).length))) (MissingColors G Pnew.coloring y)) → (HierarchyEligibleCommonMissingIndices G + k e0 input T phi ett base C ctx).Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation y Pnew hnoCommonPnew + simp only [not_forall] at hnoCommonPnew + obtain ⟨i, hi, hd⟩ := hnoCommonPnew + obtain ⟨beta, hb, hby⟩ := Finset.not_disjoint_iff.mp hd + refine ⟨i, ?_⟩ + change i ∈ (Finset.Icc 1 (HierarchyFullTailLength C - 1)).filter _ + exact Finset.mem_filter.mpr ⟨hi, Pnew, beta, hb, hby⟩ + +private theorem helper_hgammaNewTerminal_1425.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let y : V := T.vertex (Fin.last T.length); + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + ∀ (gamma : Fin k), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); + ∀ (Pnew : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Pnew.coloring = + sigma → gamma ∈ TreeMissingColors sigma Tn → + Pnew.corresponding.replacementETT.series.data.tree (Fin.last + Pnew.corresponding.replacementETT.rounds).castSucc = Tn → ( + ∀ (c₁ c₂ : PartialEdgeColoring E k), c₁ = c₂ → + ∀ (U : TreeSequence G e0), TreeMissingColors c₁ U = TreeMissingColors c₂ U) → gamma ∈ + TreeMissingColors Pnew.coloring (Pnew.corresponding.replacementETT.series.data.tree + (Fin.last Pnew.corresponding.replacementETT.rounds).castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha mu em y n Tn gamma sigma + Pnew hPnew hgammaSigmaTn hterminalPnewTn treeMissingColorEq + have h : gamma ∈ TreeMissingColors sigma + (Pnew.corresponding.replacementETT.series.data.tree + (Fin.last Pnew.corresponding.replacementETT.rounds).castSucc) := by + rw [hterminalPnewTn] + exact hgammaSigmaTn + rw [treeMissingColorEq Pnew.coloring sigma hPnew _] + exact h + +private theorem helper_hstartPnew_1464.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let y : V := T.vertex (Fin.last T.length); + ∀ (gamma : Fin k), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); + gamma ∈ MissingColors G sigma y → gamma ∈ TreeMissingColors sigma A → + ∀ (Pnew : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Pnew.coloring = + sigma → HierarchyStarredStage H q = HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount) → ( + ∀ (c₁ c₂ : PartialEdgeColoring E k), c₁ = c₂ → + ∀ (U : TreeSequence G e0), TreeMissingColors c₁ U = TreeMissingColors c₂ U) → ( + ∀ (c₁ c₂ : PartialEdgeColoring E k), c₁ = c₂ → + ∀ (v : V), MissingColors G c₁ v = MissingColors G c₂ v) → gamma ∈ TreeMissingColors + Pnew.coloring (HierarchyStarredStage Pnew.counterexample.hierarchy (Fin.last + Pnew.counterexample.hierarchy.dividerCount)) ∧ gamma ∈ MissingColors G Pnew.coloring + (T.vertex (Fin.last T.length)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha mu Cm H q A y gamma + sigma hgammaNewY hgammaSigmaA Pnew hPnew hstarPnew treeMissingColorEq missingColorEq + constructor + · have h : gamma ∈ TreeMissingColors sigma + (HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount)) := by + rw [← hstarPnew] + exact hgammaSigmaA + rw [treeMissingColorEq Pnew.coloring sigma hPnew _] + exact h + · rw [missingColorEq Pnew.coloring sigma hPnew _] + exact hgammaNewY + +private theorem helper_continuation_2499.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k) (e1 + : Fin T.length), (↑e1 : ℕ) = (HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).length → P.coloring (T.edge e1) = some alpha → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); HierarchyFullTailLength C = ell → + ∀ (htwo : (2 : ℕ) ≤ ell) (hsum : A.length + ell = T.length) (hBlen : B.length = T.length - (1 + : ℕ)) (gamma : Fin k), gamma ≠ alpha → + ∀ (htaildiff : T.length - A.length = ell), + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); + ∀ (hidx : A.length + (T.length - A.length - (1 : ℕ)) = T.length - (1 : ℕ)) (hTyLen : Ty.length + = B.length) (hAshort : A.length + (1 : ℕ) < T.length), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma alpha (Sum.inl y); + sigma (T.edge e1) = mu (T.edge e1) → + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) ( + have _ : A.length + (1 : ℕ) < T.length := hAshort; + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ A.length := A.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); X.length = A.length + (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 em sigma T) (bs : HierarchyBase + corr.replacementETT sigma) (K : TashkinovHierarchy corr.replacementETT bs) (Pnew : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Pnew.coloring = sigma + → ( + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), Disjoint (MissingColors G + Pnew.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C + i).length))) (MissingColors G Pnew.coloring y)) → HierarchyPathNumber + Pnew.counterexample.hierarchy = (1 : ℕ) → (HierarchyStarredStage K (Fin.last + K.dividerCount)).length = A.length → (HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount)).length = A.length → gamma ∈ + TreeMissingColors Pnew.coloring (HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount)) ∧ gamma ∈ MissingColors G + Pnew.coloring (T.vertex (Fin.last T.length)) → (0 : ℕ) < + Pnew.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors Pnew.coloring + (Pnew.counterexample.hierarchy.stage (⟨Pnew.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (Pnew.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + Pnew.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors + Pnew.coloring (Pnew.corresponding.replacementETT.series.data.tree (Fin.last + Pnew.corresponding.replacementETT.rounds).castSucc) → + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hvertexMissing P alpha e1 he1 hfirst mu em + Cm H q A ell B y hell htwo hsum hBlen gamma hgammaNe htaildiff Ty hidx hTyLen hAshort sigma + hfixedSeed X hXlen corr bs K Pnew hPnew hnoCommonPnew hnewSituationPnew hKstarLen + hPnewStarLen hstartPnew hnormalizedPnew + by_cases hunused : ∀ t : Fin T.length, A.length ≤ t.val → + sigma (T.edge t) ≠ some gamma + · have hunusedNew : + ∀ t : Fin T.length, + (HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount)).length ≤ t.val → + Pnew.coloring (T.edge t) ≠ some gamma := by + intro t ht hc + have htA : A.length ≤ t.val := by rw [← hPnewStarLen]; exact ht + have hc' : sigma (T.edge t) = some gamma := by rw [← hPnew]; exact hc + exact hunused t htA hc' + exact ⟨HierarchyFullTailLength C - 1, + HierarchyClaimNineUnusedTailColor G k e0 input T phi ett base C ctx + hvertexMissing Pnew hnewSituationPnew gamma hstartPnew + hnormalizedPnew hnoCommonPnew hunusedNew⟩ + · let S : Finset (Fin T.length) := + Finset.univ.filter fun t => A.length ≤ t.val ∧ sigma (T.edge t) = some gamma + have hS : S.Nonempty := by + apply Finset.nonempty_iff_ne_empty.mpr + intro hempty + apply hunused + intro t ht + by_contra hc + have htmem : t ∈ S := by simp [S, ht, hc] + rw [hempty] at htmem + simp at htmem + let ej : Fin T.length := S.min' hS + have hejMem : ej ∈ S := Finset.min'_mem S hS + have hejData := (Finset.mem_filter.mp hejMem).2 + have hejColor : sigma (T.edge ej) = some gamma := hejData.2 + have hseedIndex : e1.val = A.length := by exact he1 + have hseedNotGamma : sigma (T.edge e1) ≠ some gamma := by + have hcolor : mu (T.edge e1) = some alpha := by simpa [mu] using hfirst + rw [hfixedSeed, hcolor] + exact fun h => hgammaNe (Option.some.inj h).symm + have hAej : A.length < ej.val := by + have hmin : ej.val ≤ e1.val ∨ e1.val ≤ ej.val := le_total ej.val e1.val + by_contra hn + have heq : ej.val = A.length := by omega + have hteq : ej = e1 := Fin.ext (by rw [heq, hseedIndex]) + exact hseedNotGamma (hteq ▸ hejColor) + let j : ℕ := ej.val - A.length + 1 + have hjLower : 2 ≤ j := by dsimp [j]; omega + have hjUpper : j ≤ HierarchyFullTailLength C := by + rw [hell] + have hejl := ej.isLt + dsimp [j] + omega + have hej : ej.val = A.length + (j - 1) := by + dsimp only [j] + clear * - hAej + omega + have hfirstNew : Pnew.coloring (T.edge ej) = some gamma ∧ + ∀ t : Fin T.length, A.length ≤ t.val → t.val < ej.val → + Pnew.coloring (T.edge t) ≠ some gamma := by + constructor + · rw [hPnew] + exact hejColor + · intro t ht hlt hc + have hc' : sigma (T.edge t) = some gamma := by rw [← hPnew]; exact hc + have hmem : t ∈ S := by simp [S, ht, hc'] + have hmin : ej.val ≤ t.val := Finset.min'_le S t hmem + omega + have hejNew : ej.val = + (HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount)).length + (j - 1) := by + rw [hPnewStarLen] + exact hej + have hfirstNewK : + Pnew.coloring (T.edge ej) = some gamma ∧ + ∀ t : Fin T.length, + (HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount)).length ≤ t.val → + t.val < ej.val → Pnew.coloring (T.edge t) ≠ some gamma := by + refine ⟨hfirstNew.1, ?_⟩ + intro t ht hlt hc + apply hfirstNew.2 t + · rw [hPnewStarLen] at ht + exact ht + · exact hlt + · exact hc + have hjEligible := HierarchyClaimNineFirstUseAfterSeed G k e0 input T phi ett base C ctx + hvertexMissing Pnew hnewSituationPnew gamma hstartPnew + hnormalizedPnew hnoCommonPnew j hjLower hjUpper ej hejNew hfirstNewK + exact ⟨j - 1, hjEligible⟩ + +private theorem helper_continuation_2476.{u_1, u_2} : + helperContinuation2476Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hvertexMissing P hsituation alpha e1 he1 + hfirst mu em bm Cm H q A ell B y hell htwo hsum hBlen n Tn gamma hgammaNe htaildiff Ty hidx + hTyLen hAshort hAstage hcase sigma hgammaNewY hfixedSeed X hXlen _ corr bs K good same + hgammaSigmaA Pnew hPnew hnoCommonPnew hmeasureNew hmeasurePnew hmeasureOld + hnewSituationPnew hstarPnew hKstarLen hgammaNewA hgammaSigmaTn terminalTreeOf + have hterminalOriginal := terminalTreeOf Pnew.coloring Pnew.corresponding + have hterminalEm := terminalTreeOf P.coloring P.corresponding + have hterminalPnewTn : Pnew.corresponding.replacementETT.series.data.tree + (Fin.last Pnew.corresponding.replacementETT.rounds).castSucc = Tn := by + exact hterminalOriginal.trans (hterminalEm.symm.trans (by rfl)) + have treeMissingColorEq (c₁ c₂ : PartialEdgeColoring E k) + (hc : c₁ = c₂) (U : TreeSequence G e0) : + TreeMissingColors c₁ U = TreeMissingColors c₂ U := by + cases hc + rfl + have missingColorEq (c₁ c₂ : PartialEdgeColoring E k) + (hc : c₁ = c₂) (v : V) : + MissingColors G c₁ v = MissingColors G c₂ v := by + cases hc + rfl + have hPnewStarLen : + (HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount)).length = A.length := by + change (HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount)).length = + (HierarchyStarredStage H q).length + rw [hstarPnew] + have hgammaNewTerminal : gamma ∈ TreeMissingColors Pnew.coloring + (Pnew.corresponding.replacementETT.series.data.tree + (Fin.last Pnew.corresponding.replacementETT.rounds).castSucc) := by + exact @helper_hgammaNewTerminal_1425 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@alpha) (@gamma) (@Pnew) (@hPnew) (@hgammaSigmaTn) (@hterminalPnewTn) + (@treeMissingColorEq) + have hnormalizedNew : + (0 < K.dividerCount ∧ gamma ∈ TreeMissingColors Pnew.coloring + (K.stage ⟨K.dividerCount, by omega⟩)) ∨ + (K.dividerCount = 0 ∧ + gamma ∈ TreeMissingColors Pnew.coloring + (Pnew.corresponding.replacementETT.series.data.tree + (Fin.last Pnew.corresponding.replacementETT.rounds).castSucc)) := by + rcases hcase with hp | hz + · left + have hcount : H.dividerCount = K.dividerCount := same.1.2.1 + refine ⟨?_, ?_⟩ + · simpa [hcount] using hp.1 + · have hgammaKstage : gamma ∈ TreeMissingColors sigma + (K.stage ⟨K.dividerCount, by omega⟩) := by + rw [← hmeasureNew.2.2, ← hAstage hp.1] + exact hgammaSigmaA + rw [treeMissingColorEq Pnew.coloring sigma hPnew _] + exact hgammaKstage + · right + have hcount : H.dividerCount = K.dividerCount := same.1.2.1 + refine ⟨?_, ?_⟩ + · simpa [hcount] using hz.1 + · exact hgammaNewTerminal + have hstartNew : + gamma ∈ TreeMissingColors Pnew.coloring + (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ + gamma ∈ MissingColors G Pnew.coloring y := by + rw [hPnew] + exact ⟨hgammaNewA, hgammaNewY⟩ + have hstartPnew : + gamma ∈ TreeMissingColors Pnew.coloring + (HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount)) ∧ + gamma ∈ MissingColors G Pnew.coloring + (T.vertex (Fin.last T.length)) := by + exact @helper_hstartPnew_1464 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@alpha) (@gamma) (@hgammaNewY) (@hgammaSigmaA) (@Pnew) (@hPnew) + (@hstarPnew) (@treeMissingColorEq) (@missingColorEq) + have hcountKP : K.dividerCount = + Pnew.counterexample.hierarchy.dividerCount := by + calc + K.dividerCount = H.dividerCount := same.1.2.1.symm + _ = C.hierarchy.dividerCount := P.sameGood.1.2.1.symm + _ = Pnew.counterexample.hierarchy.dividerCount := Pnew.sameGood.1.2.1 + have hstageKP : K.stage ⟨K.dividerCount, by omega⟩ = + Pnew.counterexample.hierarchy.stage + ⟨Pnew.counterexample.hierarchy.dividerCount, by omega⟩ := by + calc + K.stage ⟨K.dividerCount, by omega⟩ = H.stage ⟨H.dividerCount, by omega⟩ := + hmeasureNew.2.2.symm + _ = C.hierarchy.stage ⟨C.hierarchy.dividerCount, by omega⟩ := + hmeasureOld.2.2.symm + _ = Pnew.counterexample.hierarchy.stage + ⟨Pnew.counterexample.hierarchy.dividerCount, by omega⟩ := + hmeasurePnew.2.2 + have hnormalizedPnew : + (0 < Pnew.counterexample.hierarchy.dividerCount ∧ + gamma ∈ TreeMissingColors Pnew.coloring + (Pnew.counterexample.hierarchy.stage + ⟨Pnew.counterexample.hierarchy.dividerCount, by omega⟩)) ∨ + (Pnew.counterexample.hierarchy.dividerCount = 0 ∧ + gamma ∈ TreeMissingColors Pnew.coloring + (Pnew.corresponding.replacementETT.series.data.tree + (Fin.last Pnew.corresponding.replacementETT.rounds).castSucc)) := by as_aux_lemma => + rcases hnormalizedNew with hp | hz + · left + refine ⟨?_, ?_⟩ + · rw [← hcountKP] + exact hp.1 + · rw [← hstageKP] + exact hp.2 + · right + refine ⟨?_, hgammaNewTerminal⟩ + rw [← hcountKP] + exact hz.1 + exact @helper_continuation_2499 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hvertexMissing) (@P) (@alpha) (@e1) (@he1) (@hfirst) (@hell) (@htwo) (@hsum) (@hBlen) + (@gamma) (@hgammaNe) (@htaildiff) (@hidx) (@hTyLen) (@hAshort) (@hfixedSeed) (@hXlen) + (@corr) (@bs) (@K) (@Pnew) (@hPnew) (@hnoCommonPnew) (@hnewSituationPnew) (@hKstarLen) + (@hPnewStarLen) (@hstartPnew) (@hnormalizedPnew) +private theorem helper_continuation_2461.{u_1, u_2} : + helperContinuation2461Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hvertexMissing P hsituation alpha e1 he1 + hfirst mu em bm Cm cm H q A ell B y hell htwo hAT hsum hBlen hAB n Tn gamma hgammaA + hgammaNe hgammaTn hmissingGammaB hmissingAlphaB hne ig vg htaildiff Ty hidx hTyLen Q + hAshort hyNotA hdisjoint hpath hAstage hcase sigma hmissingBEquality hgammaNewY hfixedSeed + X hXlen hAX hAXstrict hXB hfixedPrefix hstoredFirst hgammaCutoff hTnA routes hsplitMissing + obtain ⟨_, _, corr, hmax, bs, K, good, same⟩ := + StableChangeCasesOneTwoSplitTail G k e0 P.corresponding.replacementInput T mu em bm Cm cm + gamma alpha hne + (by + change gamma ∈ TreeMissingColors mu + (HierarchyFullTailPrefix Cm (HierarchyFullTailLength Cm - 1)) ∧ + alpha ∈ TreeMissingColors mu + (HierarchyFullTailPrefix Cm (HierarchyFullTailLength Cm - 1)) + exact ⟨hmissingGammaB, hmissingAlphaB⟩) + (Sum.inl y) hpath sigma rfl hcase + hdisjoint X hAX hAXstrict hXB hfixedPrefix routes.1 routes.2 hsplitMissing + hmissingBEquality hstoredFirst hgammaCutoff + have hgammaSigmaA : gamma ∈ TreeMissingColors sigma A := by + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp hgammaA + exact Finset.mem_biUnion.mpr + ⟨v, hv, (hmissingBEquality v (TreeSequenceInitialSegmentVertexSetSubset hAB hv)).symm ▸ hmv⟩ + have hvTerminal : y ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last T.length, rfl⟩ + let Cs : HierarchyCounterexample bs := by + exact @helperCs1237 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hAT) (@gamma) + (@hyNotA) (@hgammaNewY) (@corr) (@hmax) (@bs) (@K) (@good) (@hgammaSigmaA) (@hvTerminal) + obtain ⟨Pnew, hPnew⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi ett base C ctx + P sigma corr bs Cs same + by_cases hnoCommonPnew : + ∀ i ∈ Finset.Icc 1 (HierarchyFullTailLength C - 1), + Disjoint + (MissingColors G Pnew.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G Pnew.coloring y) + swap + · exact @helper_branch_1321 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) (@Pnew) + (@hnoCommonPnew) + have hmeasureNew := P2752_T2_HierarchyMeasures H K same.1 + have hmeasurePnew := P2752_T2_HierarchyMeasures C.hierarchy + Pnew.counterexample.hierarchy Pnew.sameGood.1 + have hmeasureOld := P2752_T2_HierarchyMeasures C.hierarchy H P.sameGood.1 + have hnewSituation : HierarchyPathNumber K = 1 := by + calc + HierarchyPathNumber K = HierarchyPathNumber H := hmeasureNew.2.1.symm + _ = 1 := hsituation + have hnewSituationPnew : + HierarchyPathNumber Pnew.counterexample.hierarchy = 1 := by + calc + HierarchyPathNumber Pnew.counterexample.hierarchy = + HierarchyPathNumber C.hierarchy := hmeasurePnew.2.1.symm + _ = HierarchyPathNumber H := hmeasureOld.2.1 + _ = 1 := hsituation + have hstarNew : HierarchyStarredStage H q = + HierarchyStarredStage K (Fin.last K.dividerCount) := hmeasureNew.1 + have hstarPnew : HierarchyStarredStage H q = + HierarchyStarredStage Pnew.counterexample.hierarchy + (Fin.last Pnew.counterexample.hierarchy.dividerCount) := + hmeasureOld.1.symm.trans hmeasurePnew.1 + have hKstarLen : (HierarchyStarredStage K (Fin.last K.dividerCount)).length = + A.length := by + change (HierarchyStarredStage K (Fin.last K.dividerCount)).length = + (HierarchyStarredStage H q).length + rw [← hstarNew] + have hgammaNewA : gamma ∈ TreeMissingColors sigma + (HierarchyStarredStage K (Fin.last K.dividerCount)) := by + rw [← hstarNew] + exact hgammaSigmaA + have hgammaSigmaTn : gamma ∈ TreeMissingColors sigma Tn := by + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp hgammaTn + have hvA := TreeSequenceInitialSegmentVertexSetSubset hTnA hv + have hvB := TreeSequenceInitialSegmentVertexSetSubset hAB hvA + exact Finset.mem_biUnion.mpr ⟨v, hv, (hmissingBEquality v hvB).symm ▸ hmv⟩ + have hterminalTree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive series above strict below generating => + cases rungAgreement + have hseries : series = replacementSeries := eq_of_heq seriesPresentation + cases hseries + let i : Fin em.rounds := ⟨em.rounds - 1, by have hp := em.roundsPositive; omega⟩ + have hi : i.succ = Fin.last em.rounds := by + apply Fin.ext + change em.rounds - 1 + 1 = em.rounds + exact Nat.sub_add_cancel em.roundsPositive + simpa [Tn, n, hi] using ladderTreesAgree i + have terminalTreeOf (coloring : PartialEdgeColoring E k) + (c : CorrespondingExtendedTashkinovTree G k e0 ett coloring T) : + c.replacementETT.series.data.tree + (Fin.last c.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by as_aux_lemma => + rcases c with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive series above strict below generating => + cases rungAgreement + have hseries : series = replacementSeries := eq_of_heq seriesPresentation + cases hseries + let i : Fin ett.rounds := ⟨ett.rounds - 1, by + have hp := ett.roundsPositive + omega⟩ + have hi : i.succ = Fin.last ett.rounds := by + apply Fin.ext + change ett.rounds - 1 + 1 = ett.rounds + exact Nat.sub_add_cancel ett.roundsPositive + simpa [hi] using ladderTreesAgree i + exact @helper_continuation_2476 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hvertexMissing) (@P) (@hsituation) (@alpha) (@e1) (@he1) (@hfirst) (@hell) (@htwo) + (@hsum) (@hBlen) (@gamma) (@hgammaNe) (@htaildiff) (@hidx) (@hTyLen) (@hAshort) (@hAstage) + (@hcase) (@hgammaNewY) (@hfixedSeed) (@hXlen) (by assumption) (@corr) (@bs) (@K) (@good) + (@same) (@hgammaSigmaA) (@Pnew) (@hPnew) (@hnoCommonPnew) (@hmeasureNew) (@hmeasurePnew) + (@hmeasureOld) (@hnewSituationPnew) (@hstarPnew) (@hKstarLen) (@hgammaNewA) + (@hgammaSigmaTn) (@terminalTreeOf) +private theorem helper_continuation_2492.{u_1, u_2} : + helperContinuation2492Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hvertexMissing P hsituation alpha _ e1 he1 + hfirst mu em bm Cm cm H q A ell B y hell htwo hAT hsum hBlen hAB haA n Tn D R hAcore gamma + hgammaA hgammaR hgammaNe hgammaTn hmissingGammaB hmissingAlphaB hne ig vg htaildiff Ty hidx + hTyLen Q hAshort hyNotA hdisjoint hpath hAstage hcase hQoutsideA sigma missingOther + hmissingBEquality hgammaNewY hfixedSeed X hXlen hXT prefixOverlap hAX hAXstrict hXB + have hfixedPrefix : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + sigma (T.edge t) = mu (T.edge t) := by + exact @helper_hfixedPrefix_1094 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@alpha) (@e1) (@he1) (@htwo) (@hsum) (@hBlen) (@gamma) (@htaildiff) + (@hidx) (@hTyLen) (@hAshort) (@hfixedSeed) (@hXlen) + have hstoredFirst : ∀ eta ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition mu T eta := by + exact @helper_hstoredFirst_1103 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@alpha) (@haA) (@gamma) (@hgammaA) (@missingOther) + have hgammaCutoff : ∀ eta ∈ HierarchyStoredColorsAt H q, + (gamma ∈ Cm.good.gamma q eta ∨ alpha ∈ Cm.good.gamma q eta) → + (HierarchyFirstMissingPosition mu T eta).val ≤ X.length := by + exact @helper_hgammaCutoff_1122 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@alpha) (@e1) (@he1) (@hfirst) (@htwo) (@hsum) (@hBlen) (@gamma) + (@hgammaR) (@htaildiff) (@hidx) (@hTyLen) (@hAshort) (@hXlen) + have hfixedA : ∀ t : Fin A.length, sigma (A.edge t) = mu (A.edge t) := by as_aux_lemma => + intro t + obtain ⟨i, hi⟩ := A.attaches t + have htVertex : A.vertex t.succ ∈ TreeSequenceVertexSet A := by + simp [TreeSequenceVertexSet] + have htIncident : Incident G (A.vertex t.succ) (A.edge t) := by + change A.vertex t.succ ∈ G.ends (A.edge t) + rw [hi] + simp + by_cases hQe : Sum.inr (A.edge t) ∈ Q + · exact @helper_branch_1162 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (@gamma) (@hQoutsideA) (@t) (@htVertex) (@htIncident) (@hQe) + · simp [sigma, TwoColorComponentSwap, Q, hQe] + have hfixedX : ∀ t : Fin X.length, sigma (X.edge t) = mu (X.edge t) := by + exact @helper_hfixedX_1181 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (@e1) (@he1) (@htwo) (@hAT) (@hsum) (@hBlen) (@gamma) (@htaildiff) (@hidx) + (@hTyLen) (@hAshort) (@hfixedSeed) (@hXlen) (@hXT) (@hfixedA) + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : TreeSequenceInitialSegment S W := by + exact @helper_segTrans_1202 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) (@S) + (@U) (@W) (@hSU) (@hUW) + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + induction d with + | zero => exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + have coreToA : TreeSequenceInitialSegment bm.core A := by + exact @helper_coreToA_1217 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (@e1) (@htwo) (@hsum) (@hBlen) (@hAcore) (@gamma) (@htaildiff) (@hidx) (@hTyLen) + (@hAshort) (@hAstage) (@segTrans) (@stageSegment) + have TnToCore : TreeSequenceInitialSegment Tn bm.core := by + by_cases hp : em.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (bm.parallel hp).2.2).leftSegment + · rw [bm.nonparallel hp] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have hTnA : TreeSequenceInitialSegment Tn A := segTrans TnToCore coreToA + have transportRoute (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence mu S X) : + TashkinovAugmentationSequence sigma S X := by as_aux_lemma => + unfold TashkinovAugmentationSequence at hroute ⊢ + refine Relation.ReflTransGen.head_induction_on hroute ?_ ?_ + · exact Relation.ReflTransGen.refl + · exact @helper_branch_1237 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (@htwo) (@hsum) (@hBlen) (@gamma) (@htaildiff) (@hidx) (@hTyLen) + (@hAshort) (@hmissingBEquality) (@hXB) (@hfixedX) (@segTrans) + have routes : + ((em.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X) ∨ + ((em.series.data.kind n = some TashkinovExtensionKind.SE ∨ + em.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + em.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed X)) ∧ + TashkinovAugmentationSequence mu X T := by as_aux_lemma => + have old := P2813_T1_TerminalRoute G k e0 P.corresponding.replacementInput T mu em + rcases old with ⟨hkind, hroute⟩ | + ⟨hkind, f, seed, hedges, hadjoin, hincident, hcolor, hroute⟩ + · have hTnX := segTrans hTnA hAX + have hrouteX := TashkinovAugmentationSequenceRestrict mu Tn X T hroute hTnX hXT + exact ⟨Or.inl ⟨hkind, transportRoute Tn hrouteX⟩, + TashkinovAugmentationSequenceSuffix mu Tn X T hroute hTnX hXT⟩ + · exact @helper_branch_1267 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (@e1) (@htwo) (@hsum) (@hBlen) (@gamma) (@htaildiff) (@hidx) (@hTyLen) + (@hAshort) (@hXlen) (@hXT) (@prefixOverlap) (@hTnA) (@transportRoute) (@hkind) (@f) + (@seed) (@hedges) (@hadjoin) (@hroute) + have hsplitMissing : gamma ∈ TreeMissingColors sigma X ∧ alpha ∈ TreeMissingColors sigma X := by + exact @helper_hsplitMissing_1278 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@alpha) (@e1) (@htwo) (@hsum) (@hBlen) (@hAB) (@haA) (@gamma) (@hgammaA) + (@htaildiff) (@hidx) (@hTyLen) (@hAshort) (@hmissingBEquality) (@hAX) + exact @helper_continuation_2461 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hvertexMissing) (@P) (@hsituation) (@alpha) (@e1) (@he1) (@hfirst) (@hell) (@htwo) (@hAT) + (@hsum) (@hBlen) (@hAB) (@gamma) (@hgammaA) (@hgammaNe) (@hgammaTn) (@hmissingGammaB) + (@hmissingAlphaB) (@hne) (@htaildiff) (@hidx) (@hTyLen) (@hAshort) (@hyNotA) (@hdisjoint) + (@hpath) (@hAstage) (@hcase) (@hmissingBEquality) (@hgammaNewY) (@hfixedSeed) (@hXlen) + (@hAX) (@hAXstrict) (@hXB) (@hfixedPrefix) (@hstoredFirst) (@hgammaCutoff) (@hTnA) + (@routes) (@hsplitMissing) +private theorem helper_continuation_2398.{u_1, u_2} : + helperContinuation2398Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hvertexMissing P hsituation alpha + hnormalized _ e1 he1 hfirst mu em bm Cm cm H q A ell B y hell htwo helem hAT hsum hBlen hBT + hAB haA haY n Tn D R hAcore gamma hgammaA hgammaR hgammaNe hgammaTn hmissingGammaB + hmissingAlphaB hne ig ia vg hgamvg hvgInA hAlphaAtFirst hiaInA htaildiff Ty hidx hTyLen + hchange hsame hinterchangeable J Q self + have leaf (v : V) (hv : gamma ∈ MissingColors G mu v ∨ alpha ∈ MissingColors G mu v) : + Set.Subsingleton (J.neighborSet (Sum.inl v)) := by + exact @helper_leaf_822 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) (@alpha) (by + assumption) (@gamma) (@hne) (@v) (@hv) + have hAshort : A.length + 1 < T.length := by omega + have hyNotA : y ∉ TreeSequenceVertexSet A := by + exact @helper_hyNotA_838 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (@e1) (@htwo) (@hAT) (@hsum) (@hBlen) (@gamma) (@htaildiff) (@hidx) (@hTyLen) + have hvgNeY : vg ≠ y := by + intro h + exact hyNotA (h ▸ hvgInA) + have hiaNeY : T.vertex ia ≠ y := by + intro h + exact hyNotA (h ▸ hiaInA) + have hdisjoint : Disjoint Q + (TwoColorComponent G mu gamma alpha (Sum.inl vg)) := by as_aux_lemma => + rcases TwoColorComponentsDisjoint G mu gamma alpha (Sum.inl y) (Sum.inl vg) with heq | hd + · exact @helper_branch_859 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (by + assumption) (@haY) (@gamma) (@hgamvg) (@hAlphaAtFirst) (@hsame) (@self) (@leaf) (@hvgNeY) + (@hiaNeY) (@heq) + · exact hd + have hpath : TwoColorPathComponent G mu gamma alpha (Sum.inl y) := + ⟨hne, Sum.inl y, self y, leaf y (Or.inr haY)⟩ + have hAstage (hp : 0 < H.dividerCount) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact @helper_hAstage_932 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (@e1) (@hsum) (@gamma) (@htaildiff) (@hp) + have hcase : + (0 < H.dividerCount ∧ gamma ∈ TreeMissingColors mu + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ + (gamma ∈ TreeMissingColors mu Tn ∨ + (gamma ∈ TreeMissingColors mu A ∧ + gamma ∉ TashkinovStoredColors em.series.data n ∧ + alpha ∉ TashkinovStoredColors em.series.data n))) := by + rcases hnormalized with hp | hz + · exact Or.inl ⟨hp.1, by rw [← hAstage hp.1]; exact hgammaA⟩ + · exact Or.inr ⟨hz.1, Or.inl hgammaTn⟩ + have hvgPath : TwoColorPathComponent G mu gamma alpha (Sum.inl vg) := + ⟨hne, Sum.inl vg, self vg, leaf vg (Or.inl hgamvg)⟩ + have hQoutsideA : ∀ w, w ∈ TreeSequenceVertexSet A → + Sum.inl w ∉ Q := by + exact @helper_hQoutsideA_956 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@alpha) (@gamma) (@hvgInA) (@hinterchangeable) (@self) (@hdisjoint) + (@hpath) (@hvgPath) + let sigma := TwoColorComponentSwap G mu gamma alpha (Sum.inl y) + obtain ⟨missingOutside, missingGammaToAlpha, missingAlphaToGamma, missingOther⟩ := + TwoColorComponentSwapMissingBehavior G mu gamma alpha hne cm.proper (Sum.inl y) + have hmissingBEquality : ∀ v, v ∈ TreeSequenceVertexSet B → + MissingColors G sigma v = MissingColors G mu v := by as_aux_lemma => + clear * - J helem hAB hvgInA hiaInA hdisjoint hsame self hgamvg hAlphaAtFirst missingOther + missingOutside hne + intro w hw + by_cases hwQ : Sum.inl w ∈ Q + · exact @helper_branch_975 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@helem) + (@hAB) (@gamma) (@hgamvg) (@hvgInA) (@hAlphaAtFirst) (@hiaInA) (@hsame) (@self) + (@hdisjoint) (@missingOther) (@w) (@hw) (@hwQ) + · exact missingOutside w hwQ + have hgammaNewY : gamma ∈ MissingColors G sigma y := + missingAlphaToGamma y (self y) haY + have he1Incident : TreeIncidentEdge A (T.edge e1) := by + exact @helper_he1Incident_1026 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@alpha) (@e1) (@he1) (@hAT) (@hsum) (@hBlen) (@gamma) (@htaildiff) (@hidx) + (@hTyLen) + have he1notQ : Sum.inr (T.edge e1) ∉ Q := by + exact @helper_he1notQ_1042 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (@e1) (@hfirst) (@gamma) (@hQoutsideA) (@he1Incident) + have hfixedSeed : sigma (T.edge e1) = mu (T.edge e1) := by + simp [sigma, TwoColorComponentSwap, Q, he1notQ] + let X := TreeSequencePrefix T (A.length + 1) + (by have := A.positive; omega) (by have := hAshort; omega) + have hXlen : X.length = A.length + 1 := rfl + have hXT : TreeSequenceInitialSegment X T := by + exact @helper_hXT_1058 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) (@alpha) + (@e1) (@htwo) (@hsum) (@hBlen) (@gamma) (@htaildiff) (@hidx) (@hTyLen) (@hAshort) + have prefixOverlap {S U : TreeSequence G e0} + (hST : TreeSequenceInitialSegment S T) + (hUT : TreeSequenceInitialSegment U T) (hle : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + exact @helper_prefixOverlap_1064 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@S) (@U) (@hST) (@hUT) (@hle) + have hleAX : A.length ≤ X.length := by + rw [hXlen] + omega + have hAX : TreeSequenceInitialSegment A X := prefixOverlap hAT hXT hleAX + have hAXstrict : A.length < X.length := by rw [hXlen]; omega + have hXB : TreeSequenceInitialSegment X B := by + exact @helper_hXB_1088 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) (@alpha) + (@e1) (@htwo) (@hsum) (@hBlen) (@hBT) (@gamma) (@htaildiff) (@hidx) (@hTyLen) (@hchange) + (@hAshort) (@hAstage) (@hcase) (@hXlen) (@hXT) (@prefixOverlap) + exact @helper_continuation_2492 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hvertexMissing) (@P) (@hsituation) (@alpha) (by assumption) (@e1) (@he1) (@hfirst) + (@hell) (@htwo) (@hAT) (@hsum) (@hBlen) (@hAB) (@haA) (@hAcore) (@gamma) (@hgammaA) + (@hgammaR) (@hgammaNe) (@hgammaTn) (@hmissingGammaB) (@hmissingAlphaB) (@hne) (@htaildiff) + (@hidx) (@hTyLen) (@hAshort) (@hyNotA) (@hdisjoint) (@hpath) (@hAstage) (@hcase) + (@hQoutsideA) (@missingOther) (@hmissingBEquality) (@hgammaNewY) (@hfixedSeed) (@hXlen) + (@hXT) (@prefixOverlap) (@hAX) (@hAXstrict) (@hXB) +private theorem helper_continuation_2395.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyPathNumber P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), (0 : ℕ) < P.counterexample.hierarchy.dividerCount ∧ alpha ∈ + TreeMissingColors P.coloring (P.counterexample.hierarchy.stage + (⟨P.counterexample.hierarchy.dividerCount, + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬P.counterexample.hierarchy.dividerCount < P.counterexample.hierarchy.dividerCount + (2 : + ℕ)) ↦ + by omega + ⟩ : Fin (P.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ alpha ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc) → ( + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), Disjoint (MissingColors G + P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C + i).length))) (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + ∀ (e1 : Fin T.length), (↑e1 : ℕ) = (HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).length → P.coloring (T.edge e1) = some alpha → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); HierarchyFullTailLength C = ell → (2 : ℕ) ≤ ell → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → TreeSequenceInitialSegment A T + → A.length + ell = T.length → B.length = T.length - (1 : ℕ) → TreeSequenceInitialSegment B + T → TreeSequenceInitialSegment A B → alpha ∈ TreeMissingColors mu A → alpha ∈ + MissingColors G mu y → alpha ∈ TreeMissingColors mu B → + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); (H.dividerCount = (0 : ℕ) → A = + bm.core) → ( + ∃ gamma ∈ TreeMissingColors mu A, gamma ∉ R ∧ gamma ≠ alpha ∧ gamma ∈ TreeMissingColors mu Tn + ∧ TreeColorSetClosed G mu A ({ gamma } : Finset (Fin k)) ∧ (H.dividerCount = (0 : ℕ) ∨ + gamma ∉ (HierarchyStoredColorsAt H q).biUnion (Cm.good.gamma (⟨H.dividerCount - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (1 : ℕ)))))) → (HierarchyEligibleCommonMissingIndices G k e0 input T + phi ett base C ctx).Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hvertexMissing P hsituation alpha + hnormalized _ e1 he1 hfirst mu em bm Cm cm H q A ell B y hell htwo helem hAT hsum hBlen hBT + hAB haA haY hmissingB n Tn D R hAcore hgammaData + obtain ⟨gamma, hgammaA, hgammaR, hgammaNe, hgammaTn, hgammaClosed, + hgammaPrev⟩ := hgammaData + have hmissingGammaB : gamma ∈ TreeMissingColors mu B := by + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp hgammaA + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hAB hv, hmv⟩ + have hmissingAlphaB : alpha ∈ TreeMissingColors mu B := hmissingB + have hne : gamma ≠ alpha := hgammaNe + have firstSpec (rho : PartialEdgeColoring E k) (c : Fin k) + (i : Fin (T.length + 1)) (hi : c ∈ MissingColors G rho (T.vertex i)) : + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + HierarchyFirstMissingPosition rho T c ≤ i := by + exact @helper_firstSpec_687 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) (@rho) + (@c) (@i) (@hi) + obtain ⟨vgWitness, hvgA, hvg⟩ := Finset.mem_biUnion.mp hgammaA + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hvgA + obtain ⟨igA, higA⟩ := hvgA + let igT := Fin.castLE (Nat.succ_le_succ hAT.1) igA + have hgamig : gamma ∈ MissingColors G mu (T.vertex igT) := by + rw [hAT.2.1 igA, higA] + exact hvg + let ig := HierarchyFirstMissingPosition mu T gamma + let ia := HierarchyFirstMissingPosition mu T alpha + let vg := T.vertex ig + have hgamvg : gamma ∈ MissingColors G mu vg := (firstSpec mu gamma igT hgamig).1 + have higBound : ig.val ≤ A.length := by + have hm := (firstSpec mu gamma igT hgamig).2 + change ig.val ≤ igA.val at hm + have := igA.isLt + omega + have hvgInA : vg ∈ TreeSequenceVertexSet A := by + let i : Fin (A.length + 1) := ⟨ig.val, by omega⟩ + have hi : Fin.castLE (Nat.succ_le_succ hAT.1) i = ig := Fin.ext rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, (hAT.2.1 i).symm.trans (congrArg T.vertex hi)⟩ + have hAlphaAtFirst : alpha ∈ MissingColors G mu (T.vertex ia) := by + exact @helper_hAlphaAtFirst_721 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@alpha) (@hAT) (@haA) (@firstSpec) + have hiaBound : ia.val ≤ A.length := by + exact @helper_hiaBound_730 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (@e1) (@hAT) (@haA) (@gamma) (@firstSpec) + have hiaInA : T.vertex ia ∈ TreeSequenceVertexSet A := by + let iA : Fin (A.length + 1) := ⟨ia.val, by omega⟩ + have hiA : Fin.castLE (Nat.succ_le_succ hAT.1) iA = ia := Fin.ext rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨iA, (hAT.2.1 iA).symm.trans (congrArg T.vertex hiA)⟩ + have horderedUnused : + (gamma ∉ TreeMissingColors mu A ∨ alpha ∉ TreeMissingColors mu A) → + TreeVertexOrder T vg (T.vertex ia) ∧ + gamma ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ia.val ∧ mu (T.edge t) = some c) := by + intro h + rcases h with h | h + · exact (h hgammaA).elim + · exact (h haA).elim + have htaildiff : T.length - A.length = ell := by omega + have equalTrees {S U : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) (hlen : S.length = U.length) : S = U := by + exact @helper_equalTrees_758 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hsituation) (@S) (@U) (@hSU) (@hlen) + let Ty := TreeSequencePrefix T (min (A.length + (T.length - A.length - 1)) T.length) + (by have := A.positive; have := T.positive; omega) (Nat.min_le_right _ _) + have hTyT : TreeSequenceInitialSegment Ty T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hsumA : A.length + (T.length - A.length) = T.length := + Nat.add_sub_of_le hAT.1 + have hidx : A.length + (T.length - A.length - 1) = T.length - 1 := by + calc + A.length + (T.length - A.length - 1) = + (A.length + (T.length - A.length)) - 1 := by omega + _ = T.length - 1 := by rw [hsumA] + have hTyLen : Ty.length = B.length := by + change min (A.length + (T.length - A.length - 1)) T.length = B.length + rw [hidx, Nat.min_eq_left (by omega), hBlen] + have hBToTy : TreeSequenceInitialSegment B Ty := by + exact @helper_hBToTy_789 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + (@alpha) (@e1) (@hsum) (@hBT) (@gamma) (@htaildiff) (@hTyT) (@hTyLen) + have hBTy : B = Ty := equalTrees hBToTy hTyLen.symm + have hchange := ChangeLemma G k e0 P.corresponding.replacementInput T mu em bm Cm + cm.proper cm.oneEdgeUncolored cm.lowerRung cm.fewerDividers + cm.lexicographicMinimality helem cm.largeMissingSet gamma alpha hne + (by + change gamma ∈ TreeMissingColors mu Ty ∧ alpha ∈ TreeMissingColors mu Ty + rw [← hBTy] + exact ⟨hmissingGammaB, hmissingAlphaB⟩) horderedUnused + have hchangeClosed := hchange.2.2 ⟨hgammaA, hgammaClosed⟩ + have hsame : TwoColorComponent G mu gamma alpha (Sum.inl vg) = + TwoColorComponent G mu gamma alpha (Sum.inl (T.vertex ia)) := hchangeClosed.1 + have hinterchangeable : TreeInterchangeable G A mu gamma alpha := hchangeClosed.2 + let J := TwoColorIncidenceGraph G mu gamma alpha + let Q := TwoColorComponent G mu gamma alpha (Sum.inl y) + have self (v : V) : Sum.inl v ∈ TwoColorComponent G mu gamma alpha (Sum.inl v) := by + change J.connectedComponentMk (Sum.inl v) = J.connectedComponentMk (Sum.inl v) + rfl + exact @helper_continuation_2398 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hvertexMissing) (@P) (@hsituation) (@alpha) (@hnormalized) (by assumption) (@e1) (@he1) + (@hfirst) (@hell) (@htwo) (@helem) (@hAT) (@hsum) (@hBlen) (@hBT) (@hAB) (@haA) (@haY) + (@hAcore) (@gamma) (@hgammaA) (@hgammaR) (@hgammaNe) (@hgammaTn) (@hmissingGammaB) + (@hmissingAlphaB) (@hne) (@hgamvg) (@hvgInA) (@hAlphaAtFirst) (@hiaInA) (@htaildiff) + (@hidx) (@hTyLen) (@hchange) (@hsame) (@hinterchangeable) (@self) +private theorem helper_continuation_2508.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyPathNumber P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), (0 : ℕ) < P.counterexample.hierarchy.dividerCount ∧ alpha ∈ + TreeMissingColors P.coloring (P.counterexample.hierarchy.stage + (⟨P.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (P.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ alpha ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc) → ( + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), Disjoint (MissingColors G + P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C + i).length))) (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + ∀ (e1 : Fin T.length), (↑e1 : ℕ) = (HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).length → P.coloring (T.edge e1) = some alpha → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); HierarchyFullTailLength C = ell → (2 : ℕ) ≤ ell → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → TreeSequenceInitialSegment A T + → A.length + ell = T.length → B.length = T.length - (1 : ℕ) → TreeSequenceInitialSegment B + T → TreeSequenceInitialSegment A B → alpha ∈ TreeMissingColors mu A → alpha ∈ + MissingColors G mu y → alpha ∈ TreeMissingColors mu B → + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); (H.dividerCount = (0 : ℕ) → A = + bm.core) → (H.dividerCount = (0 : ℕ) → + ∃ gamma ∈ TreeMissingColors mu A, gamma ∉ R ∧ gamma ≠ alpha ∧ gamma ∈ TreeMissingColors mu Tn + ∧ TreeColorSetClosed G mu A ({ gamma } : Finset (Fin k))) → + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hvertexMissing P hsituation alpha + hnormalized _ e1 he1 hfirst mu em bm Cm cm H q A ell B y hell htwo helem hAT hsum hBlen hBT + hAB haA haY hmissingB n Tn D R hAcore hgammaZero + have hgammaPositive (hz : 0 < H.dividerCount) : ∃ gamma : Fin k, + gamma ∈ TreeMissingColors mu A ∧ gamma ∉ R ∧ gamma ≠ alpha ∧ + gamma ∈ TreeMissingColors mu Tn ∧ + TreeColorSetClosed G mu A {gamma} ∧ + gamma ∉ ((HierarchyStoredColorsAt H q).biUnion + (Cm.good.gamma (⟨H.dividerCount - 1, by omega⟩ : Fin (H.dividerCount + 1)))) := by + as_aux_lemma => + clear * - P mu em bm Cm cm H q A Tn R D alpha hz + let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hq : q = i.succ := by + apply Fin.ext + simp [i, q] + omega + have hAeq : A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact @helper_hAeq_523 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hz) + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : TreeSequenceInitialSegment S W := by + exact @helper_segTrans_533 (@V) (@E) (@G) (@e0) (@S) (@U) (@W) (@hSU) (@hUW) + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + induction d with + | zero => exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + have coreToA : TreeSequenceInitialSegment bm.core A := by + rw [hAeq] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + have TnToCore : TreeSequenceInitialSegment Tn bm.core := by + exact @helper_TnToCore_553 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have hTnA := segTrans TnToCore coreToA + let Dprev := HierarchyStoredColorsAt H i.succ + let Rprev := Dprev.biUnion (Cm.good.gamma i.castSucc) + obtain ⟨eta, hη, _⟩ := Cm.good.uniqueRefresh i + rcases hη with ⟨heta, hpair, hcopy⟩ + have hRsub : R ⊆ Rprev ∪ Cm.good.gamma i.succ eta := by + exact @helper_hRsub_564 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hz) (@hq) (@eta) + (@hcopy) + have hRprevCard : Rprev.card ≤ 2 * em.rounds := by + exact @helper_hRprevCard_578 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hz) (@hq) + have hpairCard : (Cm.good.gamma i.succ eta).card ≤ 2 := by + have hp := Cm.good.twoColors i.succ eta (by simpa [D, hq] using heta) + exact le_of_eq hp + have hforbiddenCard : (Rprev ∪ R ∪ {alpha}).card ≤ 2 * em.rounds + 3 := by + exact @helper_hforbiddenCard_595 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hz) (@eta) (@hRsub) (@hRprevCard) (@hpairCard) + have hlarge : 2 * em.rounds + 11 ≤ (TreeMissingColors mu Tn).card := by + simpa [Tn, n] using cm.largeMissingSet + let S := TreeMissingColors mu Tn \ (Rprev ∪ R ∪ {alpha}) + have hSne : S.Nonempty := by + exact @helper_hSne_623 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hz) + (@eta) (@hforbiddenCard) (@hlarge) + obtain ⟨gamma, hg⟩ := hSne + have hgparts := Finset.mem_sdiff.mp hg + have hgnot := hgparts.2 + have hgA : gamma ∈ TreeMissingColors mu A := by + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp hgparts.1 + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hTnA hv, hmv⟩ + have hgR : gamma ∉ R := by + intro h + exact hgnot (Finset.mem_union_left _ (Finset.mem_union_right _ h)) + have hgAlpha : gamma ≠ alpha := by + intro h + exact hgnot (Finset.mem_union_right _ (by simp [h])) + have hgPrev : gamma ∉ Rprev := by + intro h + exact hgnot (Finset.mem_union_left _ (Finset.mem_union_left _ h)) + have hminus : TreeColorSetMinusClosed G mu A Rprev := by + exact @helper_hminus_645 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hz) + (@hq) (@hAeq) (@eta) + have hminusClosed : + TreeColorSetClosed G mu A (TreeMissingColors mu A \ Rprev) := hminus + have hgClosed : TreeColorSetClosed G mu A {gamma} := by + intro c hc + have hcgamma : c = gamma := Finset.mem_singleton.mp hc + subst c + exact hminusClosed gamma (Finset.mem_sdiff.mpr ⟨hgA, hgPrev⟩) + have hgPrev' : gamma ∉ ((HierarchyStoredColorsAt H q).biUnion + (Cm.good.gamma (⟨H.dividerCount - 1, by omega⟩ : Fin (H.dividerCount + 1))) : Finset (Fin + k)) := by + change gamma ∉ ((HierarchyStoredColorsAt H i.succ).biUnion + (Cm.good.gamma i.castSucc)) at hgPrev + simpa [q, hq, i] using hgPrev + exact ⟨gamma, hgA, hgR, hgAlpha, hgparts.1, hgClosed, hgPrev'⟩ + have hgammaData : ∃ gamma : Fin k, + gamma ∈ TreeMissingColors mu A ∧ gamma ∉ R ∧ gamma ≠ alpha ∧ + gamma ∈ TreeMissingColors mu Tn ∧ TreeColorSetClosed G mu A {gamma} ∧ + (H.dividerCount = 0 ∨ gamma ∉ ((HierarchyStoredColorsAt H q).biUnion + (Cm.good.gamma (⟨H.dividerCount - 1, by omega⟩ : Fin (H.dividerCount + 1))))) := by + as_aux_lemma => + by_cases hz : H.dividerCount = 0 + · obtain ⟨gamma, hA, hR, hne, hTn, hclosed⟩ := hgammaZero hz + exact ⟨gamma, hA, hR, hne, hTn, hclosed, Or.inl hz⟩ + · have hp : 0 < H.dividerCount := Nat.pos_of_ne_zero hz + obtain ⟨gamma, hA, hR, hne, hTn, hclosed, hprev⟩ := hgammaPositive hp + exact ⟨gamma, hA, hR, hne, hTn, hclosed, Or.inr hprev⟩ + exact @helper_continuation_2395 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hvertexMissing) (@P) (@hsituation) (@alpha) (@hnormalized) (by assumption) (@e1) (@he1) + (@hfirst) (@hell) (@htwo) (@helem) (@hAT) (@hsum) (@hBlen) (@hBT) (@hAB) (@haA) (@haY) + (@hmissingB) (@hAcore) (@hgammaData) +private theorem helper_branch_4026.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); A = bm.core → q = (0 : Fin + (H.dividerCount + (1 : ℕ))) → ( + let p : Fin em.rounds := (⟨em.rounds - (1 : ℕ), + have this : (1 : ℕ) ≤ em.rounds := em.roundsPositive; Decidable.byContradiction fun (a : + ¬em.rounds - (1 : ℕ) < em.rounds) ↦ + by + omega + ⟩ : Fin em.rounds); ColoredVertexSetElementary G (em.series.data.coloring p.castSucc) + (TreeSequenceVertexSet Tn)) → em.series.data.kind n = some TashkinovExtensionKind.PE → + ∃ gamma ∈ TreeMissingColors mu A, gamma ∉ R ∧ gamma ≠ alpha ∧ gamma ∈ TreeMissingColors mu Tn + ∧ TreeColorSetClosed G mu A ({ gamma } : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu em bm Cm H q A n Tn D R hAcore + hq0 lowerElementary hpe + let S := (TreeMissingColors mu Tn ∩ TreeMissingColors mu bm.closure) \ R + have hScard : 4 ≤ S.card := by + simpa [S, R, D, n, Tn, H, q, hq0, mu, bm] using + (Cm.good.parallelBase hpe).2 + have hSsub : S ⊆ {alpha} → S.card ≤ 1 := by + intro hs + exact (Finset.card_le_card hs).trans (by simp) + have hremove : (S \ {alpha}).Nonempty := by + apply Finset.card_pos.mp + by_contra h + have he : S \ {alpha} = ∅ := Finset.card_eq_zero.mp (by omega) + apply (by omega : ¬ S.card ≤ 1) + apply hSsub + intro c hc + by_contra hca + have hc' : c ∈ S \ {alpha} := Finset.mem_sdiff.mpr ⟨hc, by simpa using hca⟩ + rw [he] at hc' + simp at hc' + obtain ⟨gamma, hg⟩ := hremove + have hgS : gamma ∈ S := (Finset.mem_sdiff.mp hg).1 + have hgAlpha : gamma ≠ alpha := by + intro he + exact (Finset.mem_sdiff.mp hg).2 (by simp [he]) + have hgparts := Finset.mem_sdiff.mp hgS + have hgint := Finset.mem_inter.mp hgparts.1 + have hgA : gamma ∈ TreeMissingColors mu A := by + obtain ⟨u⟩ := (bm.parallel hpe).2.2 + have hTnA : TreeSequenceInitialSegment Tn A := by + rw [hAcore] + exact u.leftSegment + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp hgint.1 + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hTnA hv, hmv⟩ + have hclosedCore := ParallelCommonMissingClosed G k e0 + P.corresponding.replacementInput T mu mu em (by + have := em.roundsPositive + omega) bm em.generatingColoring hpe lowerElementary + have hgClosed : TreeColorSetClosed G mu A {gamma} := by + rw [hAcore] + intro c hc + have hcgamma : c = gamma := Finset.mem_singleton.mp hc + subst c + exact hclosedCore gamma hgparts.1 + exact ⟨gamma, hgA, hgparts.2, hgAlpha, hgint.1, hgClosed⟩ + +private theorem helper_branch_4070.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + let Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let R : Finset (Fin k) := D.biUnion (Cm.good.gamma q); R.card ≤ (2 : ℕ) * em.rounds → A = + bm.core → ¬em.series.data.kind n = some TashkinovExtensionKind.PE → + ∃ gamma ∈ TreeMissingColors mu A, gamma ∉ R ∧ gamma ≠ alpha ∧ gamma ∈ TreeMissingColors mu Tn + ∧ TreeColorSetClosed G mu A ({ gamma } : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu em bm Cm cm H q A n Tn D R + hRcard hAcore hpe + have hAeq : A = Tn := by + rw [hAcore] + exact bm.nonparallel hpe + let S := TreeMissingColors mu Tn \ (R ∪ {alpha}) + have hlarge : 2 * em.rounds + 11 ≤ (TreeMissingColors mu Tn).card := by + simpa [Tn, n] using cm.largeMissingSet + have hSne : S.Nonempty := by + exact @helper_hSne_377 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@hRcard) (@hlarge) + obtain ⟨gamma, hg⟩ := hSne + have hgTn := (Finset.mem_sdiff.mp hg).1 + have hgnot := (Finset.mem_sdiff.mp hg).2 + have hgR : gamma ∉ R := by + intro hc + exact hgnot (Finset.mem_union_left _ hc) + have hgAlpha : gamma ≠ alpha := by + intro he + exact hgnot (Finset.mem_union_right _ (by simp [he])) + have closedSingleton (U : TreeSequence G e0) + (hc : ColoredVertexSetClosed G mu (TreeSequenceVertexSet U)) + (hm : gamma ∈ TreeMissingColors mu U) : + TreeColorSetClosed G mu U {gamma} := by + exact @helper_closedSingleton_400 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@gamma) (@U) (@hc) (@hm) + have stableClosed (U : TreeSequence G e0) (S : Finset (Fin k)) + (psi pi : PartialEdgeColoring E k) + (hpsi : IsProperEdgeColoring G psi) (hpsiOne : IsOneEdgeUncolored psi e0) + (hpi : IsProperEdgeColoring G pi) (hpiOne : IsOneEdgeUncolored pi e0) + (hs : StableColoring U S psi pi) + (hc : ColoredVertexSetClosed G psi (TreeSequenceVertexSet U)) : + ColoredVertexSetClosed G pi (TreeSequenceVertexSet U) := by + exact @helper_stableClosed_412 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@U) + (@S) (@psi) (@pi) (@hpsi) (@hpsiOne) (@hpi) (@hpiOne) (@hs) (@hc) + let p : Fin em.rounds := ⟨em.rounds - 1, by have := em.roundsPositive; omega⟩ + have hp : p.succ = n := by + apply Fin.ext + change p.val + 1 = em.rounds + dsimp [p] + exact Nat.sub_add_cancel em.roundsPositive + have hphi : mu = em.series.data.coloring p.succ := by + rw [hp] + exact em.generatingColoring + have hTn : Tn = em.series.data.tree p.succ.castSucc := by rw [hp] + have hclosedTn : TreeColorSetClosed G mu Tn {gamma} := by + generalize heq : p.succ = target + cases em.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero p heq).elim + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + delta gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hci : ci = p := Fin.ext (by + have hv := congrArg Fin.val heq + simp at hv ⊢ + omega) + subst ci + have hfinalPE : em.series.data.kind n = some TashkinovExtensionKind.PE := by + rw [← hp, currentKind] + exact (hpe hfinalPE).elim + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have hci : ci = p := Fin.ext (by + have hv := congrArg Fin.val heq + simp at hv ⊢ + omega) + subst ci + have hclosedPrev : ColoredVertexSetClosed G mu + (TreeSequenceVertexSet (em.series.data.tree p.succ.castSucc)) := by + rw [hphi, currentColoring] + exact previousClosed + rw [hTn] + exact closedSingleton _ hclosedPrev (by simpa [hphi, currentColoring, hTn] using hgTn) + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative currentColoring + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hci : ci = p := Fin.ext (by + have hv := congrArg Fin.val heq + simp at hv ⊢ + omega) + subst ci + have hstableClosed : ColoredVertexSetClosed G choice.selected + (TreeSequenceVertexSet (em.series.data.tree p.succ.castSucc)) := + stableClosed (em.series.data.tree p.succ.castSucc) + (TashkinovStoredColors em.series.data p.castSucc) + (em.series.data.coloring p.castSucc) choice.selected + previousProper previousOneUncolored choice.selectedProper + choice.selectedOneUncolored choice.selectedStable previousClosed + have hclosedNow : ColoredVertexSetClosed G mu + (TreeSequenceVertexSet (em.series.data.tree p.succ.castSucc)) := by + rw [hphi, currentColoring] + exact hstableClosed + rw [hTn] + exact closedSingleton _ hclosedNow (by simpa [hphi, currentColoring, hTn] using hgTn) + have hclosed : TreeColorSetClosed G mu A {gamma} := by + rw [hAeq] + exact hclosedTn + have hgA : gamma ∈ TreeMissingColors mu A := by rw [hAeq]; exact hgTn + exact ⟨gamma, hgA, hgR, hgAlpha, hgTn, hclosed⟩ + +theorem HierarchyClaimNineFirstUseSeed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (hsituation : HierarchyPathNumber P.counterexample.hierarchy = 1) + (alpha : Fin k) + (hstart : + alpha ∈ + TreeMissingColors P.coloring + (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last (P.counterexample.hierarchy).dividerCount)) ∧ + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) + (hnormalized : + (0 < (P.counterexample.hierarchy).dividerCount ∧ + alpha ∈ + TreeMissingColors P.coloring + ((P.counterexample.hierarchy).stage + ⟨(P.counterexample.hierarchy).dividerCount, by omega⟩)) ∨ + ((P.counterexample.hierarchy).dividerCount = 0 ∧ + alpha ∈ + TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree + ((Fin.last P.corresponding.replacementETT.rounds : + Fin (P.corresponding.replacementETT.rounds + 1))).castSucc))) + (_ : ∀ i ∈ Finset.Icc 1 (HierarchyFullTailLength C - 1), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) + (e1 : Fin T.length) + (he1 : + e1.val = + (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).length) + (hfirst : P.coloring (T.edge e1) = some alpha) : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty := by + classical + let mu := P.coloring + let em := P.corresponding.replacementETT + let bm := P.replacementBase + let Cm := P.counterexample + let cm := P.minimumContext + let H := Cm.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength Cm + let B := HierarchyFullTailPrefix Cm (ell - 1) + let y := T.vertex (Fin.last T.length) + have hstar := (P2752_T2_HierarchyMeasures C.hierarchy H P.sameGood.1).1 + have hell : HierarchyFullTailLength C = ell := by + simp only [HierarchyFullTailLength, hstar] + rfl + have hprefix (i : ℕ) : HierarchyFullTailPrefix C i = + HierarchyFullTailPrefix Cm i := by + simp only [HierarchyFullTailPrefix, hstar] + rfl + have htwo : 2 ≤ ell := + HierarchyCounterexampleTailAtLeastTwo G k e0 + P.corresponding.replacementInput T mu em bm Cm cm.proper cm.oneEdgeUncolored + cm.lowerRung cm.fewerDividers cm.lexicographicMinimality cm.largeMissingSet + have helem : ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) := + HierarchyCounterexamplePenultimateElementary G k e0 + P.corresponding.replacementInput T mu em bm Cm cm.proper cm.oneEdgeUncolored + cm.lowerRung cm.fewerDividers cm.lexicographicMinimality cm.largeMissingSet + have hAT : TreeSequenceInitialSegment A T := by + exact @helper_hAT_245 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) + have hsum : A.length + ell = T.length := Nat.add_sub_of_le hAT.1 + have hBlen : B.length = T.length - 1 := by + dsimp [B, HierarchyFullTailPrefix] + change min (A.length + (ell - 1)) T.length = T.length - 1 + omega + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hAB : TreeSequenceInitialSegment A B := by + exact @helper_hAB_259 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) (@e1) + (@htwo) (@hAT) (@hsum) (@hBlen) (@hBT) + have haA : alpha ∈ TreeMissingColors mu A := hstart.1 + have haY : alpha ∈ MissingColors G mu y := hstart.2 + have hmissingB : alpha ∈ TreeMissingColors mu B := by + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp haA + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hAB hv, hmv⟩ + let n : Fin (em.rounds + 1) := Fin.last em.rounds + let Tn := em.series.data.tree n.castSucc + let D := HierarchyStoredColorsAt H q + let R := D.biUnion (Cm.good.gamma q) + have hDcard : D.card ≤ em.rounds := by + change (HierarchyStoredColorsAt H q).card ≤ em.rounds + exact HierarchyStoredColorsCardinality H q + have hRcard : R.card ≤ 2 * em.rounds := by + exact @helper_hRcard_279 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) (@hDcard) + have hAcore (hz : H.dividerCount = 0) : A = bm.core := by + have hq : q = 0 := Fin.ext (by simp [q, hz]) + simp [A, H, q, bm, HierarchyStarredStage, hq] + have hgammaZero (hz : H.dividerCount = 0) : ∃ gamma : Fin k, + gamma ∈ TreeMissingColors mu A ∧ gamma ∉ R ∧ gamma ≠ alpha ∧ + gamma ∈ TreeMissingColors mu Tn ∧ TreeColorSetClosed G mu A {gamma} := by as_aux_lemma => + clear * - P mu em bm Cm cm H q A Tn R hRcard hAcore hz alpha + have hAcore : A = bm.core := by simpa [bm] using hAcore hz + have hq0 : q = 0 := Fin.ext (by simp [q, hz]) + have lowerElementary : + let p : Fin em.rounds := ⟨em.rounds - 1, by have := em.roundsPositive; omega⟩ + ColoredVertexSetElementary G (em.series.data.coloring p.castSucc) + (TreeSequenceVertexSet Tn) := by + dsimp only + dsimp only [Tn] + by_cases hr : em.rounds = 1 + · have hp : (⟨em.rounds - 1, by have := em.roundsPositive; omega⟩ : Fin em.rounds).castSucc + = 0 := by + apply Fin.ext + simp [hr] + have htree : n.castSucc = (⟨1, by omega⟩ : Fin (em.rounds + 2)) := by + apply Fin.ext + simp [n, hr] + rw [hp, htree] + exact (TechnicalTheoremBase G k em.rounds e0 + P.corresponding.replacementInput em.series).1 + · have hmore : 1 < em.rounds := by + have := em.roundsPositive + omega + obtain ⟨pred, hround, hmax, _, _⟩ := CertifiedETTPredecessor G k e0 + P.corresponding.replacementInput T mu em (Cm.maximum) hmore + have htree : n.castSucc = (⟨em.rounds, by omega⟩ : Fin (em.rounds + 2)) := by + apply Fin.ext + rfl + rw [htree] + have hpredPositive : 0 < pred.rounds := by rw [hround]; omega + have hpredLower : pred.rounds < em.rounds := by rw [hround]; omega + exact (cm.lowerRung pred hpredPositive hpredLower hmax).1 + by_cases hpe : em.series.data.kind n = some TashkinovExtensionKind.PE + · exact @helper_branch_4026 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hAcore) + (@hq0) (@lowerElementary) (@hpe) + · exact @helper_branch_4070 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hRcard) + (@hAcore) (@hpe) + exact @helper_continuation_2508 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hvertexMissing) (@P) (@hsituation) (@alpha) (@hnormalized) (by assumption) (@e1) (@he1) + (@hfirst) (@hell) (@htwo) (@helem) (@hAT) (@hsum) (@hBlen) (@hBT) (@hAB) (@haA) (@haY) + (@hmissingB) (@hAcore) (@hgammaZero) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNinePENormalization.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNinePENormalization.lean new file mode 100644 index 0000000000..a06a1d9849 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNinePENormalization.lean @@ -0,0 +1,2482 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.BaseControl +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans +public import Mathlib.Algebra.BigOperators.Group.Finset.Basic + +public import LeanPool.GoldbergSeymour.HierarchyNormalizationLemmas + +/-! +# Hierarchy Claim Nine PENormalization + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open HierarchyNormalizationLemmas + +private abbrev helperSameC1124Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + P.counterexample.hierarchy.dividerCount = (0 : ℕ) → + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let b : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let y : V := T.vertex (Fin.last T.length); + ∀ (hp : F.series.data.kind n = some TashkinovExtensionKind.PE) (hA : A = b.core) + (haA : alpha ∈ TreeMissingColors mu A), + let D : Finset (Fin k) := HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ))); + let R : Finset (Fin k) := + D.biUnion (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))); + ∀ (beta : Fin k) (hbR : beta ∉ R) (haRnot : alpha ∉ R) (hbA : beta ∈ TreeMissingColors mu A), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu beta alpha (Sum.inl y); + ∀ (hmTn : TreeMissingColors sigma Tn = TreeMissingColors mu Tn) + (hmR : TreeMissingColors sigma b.closure = TreeMissingColors mu b.closure) + (corr : CorrespondingExtendedTashkinovTree G k e0 F sigma T) + (bs : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT bs), + SameHierarchyStages H K → + ∀ + (corrData : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + F.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors F.series.data n) + (hkzero : K.dividerCount = (0 : ℕ)) (coreEq : bs.core = A) + (closureEq : bs.closure = b.closure) + (starK : ∀ (j : Fin (K.dividerCount + (1 : ℕ))), HierarchyStarredStage K j = bs.core) + (termK : ∀ (j : Fin (K.dividerCount + (1 : ℕ))), K.stage j.succ = T) + (termH : H.stage (Fin.succ (0 : Fin (H.dividerCount + (1 : ℕ)))) = T) + (storedEq : ∀ (j : Fin (K.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt K j = D) + (stageMissingEq : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = TreeMissingColors mu Tn) + (unaffectedValue : + ∀ (f : E) (c : Fin k), c ≠ beta → c ≠ alpha → (sigma f = some c ↔ mu f = some c)) + (firstEq : + ∀ (eta : Fin k), + eta ≠ beta → + eta ≠ alpha → + HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition mu T eta) + (notClosed : ¬TreeColorSetMinusClosed G sigma A R), + let gs : GoodHierarchy K := + { + gamma := fun (_ : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta, + twoColors := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) ↦ + X.good.twoColors (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ eta ∈ _a) (storedEq j)) heta), + avoidance := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) ⦃c : Fin k⦄ + (hcg : c ∈ X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta) ↦ + have hetaD : eta ∈ D := + Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ eta ∈ _a) (storedEq j)) heta; + have hold : + c ∈ + HierarchyStageMissingColors X.hierarchy + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) \ + HierarchySegmentColors X.hierarchy (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) + eta := + X.good.avoidance (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta hetaD hcg; + Finset.mem_sdiff.mpr + (⟨Eq.mpr (id (congrArg (fun (_a : Finset (Fin k)) ↦ c ∈ _a) (stageMissingEq j))) + (Finset.mem_sdiff.mp hold).left, + helper_branch_909 G k e0 input T phi ett base C ctx P alpha hp hA haA beta hbR haRnot + hbA corr bs K coreEq starK termK termH unaffectedValue firstEq j eta heta hcg hetaD + hold⟩ : + c ∈ HierarchyStageMissingColors K j ∧ c ∉ HierarchySegmentColors K j eta), + disjointPairs := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta theta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) + (htheta : theta ∈ HierarchyStoredColorsAt K j) (hne' : eta ≠ theta) ↦ + X.good.disjointPairs (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta theta + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ eta ∈ _a) (storedEq j)) heta) + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ theta ∈ _a) (storedEq j)) htheta) hne', + uniqueRefresh := fun (i : Fin K.dividerCount) ↦ + have this : (↑i : ℕ) < K.dividerCount := i.isLt; + Decidable.byContradiction + fun + (_ : + ¬∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta ⊆ + (TreeSequenceVertexSet (K.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, + theta ≠ eta → + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) theta = + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) theta) ↦ + by omega, + parallelBase := + id + fun + (_ : + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ↦ + (⟨id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + ¬TreeColorSetMinusClosed G sigma _a + ((HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))))) + coreEq)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + ¬TreeColorSetMinusClosed G sigma A + (_a.biUnion (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))))) + (storedEq (0 : Fin (K.dividerCount + (1 : ℕ)))))) + notClosed)), + id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma _a ∩ TreeMissingColors sigma bs.closure) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + corrData.left)) + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma _a) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + closureEq)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma b.closure) \ + _a.biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + (storedEq (0 : Fin (K.dividerCount + (1 : ℕ)))))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((_a ∩ TreeMissingColors sigma b.closure) \ + D.biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + hmTn)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors mu Tn ∩ _a) \ + D.biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + hmR)) + (X.good.parallelBase hp).right)))))⟩ : + ¬TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + fun (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma bs.closure) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + fun (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta).card), + minusClosed := fun (i : Fin K.dividerCount) ↦ + have this : (↑i : ℕ) < K.dividerCount := i.isLt; + Decidable.byContradiction + fun + (_ : + ¬TreeColorSetMinusClosed G sigma (K.stage i.succ.castSucc) + ((HierarchyStoredColorsAt K i.succ).biUnion fun (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta)) ↦ + by omega : + GoodHierarchy K }; + SameGoodHierarchy X.good gs → SameGoodHierarchy C.good gs + +private abbrev helperMeasureEq1164Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let b : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let y : V := T.vertex (Fin.last T.length); + ∀ (hp : F.series.data.kind n = some TashkinovExtensionKind.PE) (hA : A = b.core) + (haA : alpha ∈ TreeMissingColors mu A), + let D : Finset (Fin k) := HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ))); + let R : Finset (Fin k) := + D.biUnion (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))); + ∀ (beta : Fin k) (hbR : beta ∉ R) (haRnot : alpha ∉ R) (hbA : beta ∈ TreeMissingColors mu A), + let vb : V := T.vertex (HierarchyFirstMissingPosition mu T beta); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu beta alpha (Sum.inl y); + ∀ (hmTn : TreeMissingColors sigma Tn = TreeMissingColors mu Tn) + (hmR : TreeMissingColors sigma b.closure = TreeMissingColors mu b.closure) + (hbetay : beta ∈ MissingColors G sigma y) + (corr : CorrespondingExtendedTashkinovTree G k e0 F sigma T) + (hmaximum : MaximumProperty corr.replacementETT) + (bs : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT bs), + SameHierarchyStages H K → + ∀ + (corrData : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + F.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors F.series.data n) + (hkzero : K.dividerCount = (0 : ℕ)) (coreEq : bs.core = A) + (closureEq : bs.closure = b.closure) + (starK : ∀ (j : Fin (K.dividerCount + (1 : ℕ))), HierarchyStarredStage K j = bs.core) + (termK : ∀ (j : Fin (K.dividerCount + (1 : ℕ))), K.stage j.succ = T) + (termH : H.stage (Fin.succ (0 : Fin (H.dividerCount + (1 : ℕ)))) = T) + (storedEq : ∀ (j : Fin (K.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt K j = D) + (stageMissingEq : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = TreeMissingColors mu Tn) + (unaffectedValue : + ∀ (f : E) (c : Fin k), c ≠ beta → c ≠ alpha → (sigma f = some c ↔ mu f = some c)) + (firstEq : + ∀ (eta : Fin k), + eta ≠ beta → + eta ≠ alpha → + HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition mu T eta) + (notClosed : ¬TreeColorSetMinusClosed G sigma A R), + let gs : GoodHierarchy K := + { + gamma := fun (_ : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta, + twoColors := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) ↦ + X.good.twoColors (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ eta ∈ _a) (storedEq j)) heta), + avoidance := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) ⦃c : Fin k⦄ + (hcg : c ∈ X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta) ↦ + have hetaD : eta ∈ D := + Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ eta ∈ _a) (storedEq j)) heta; + have hold : + c ∈ + HierarchyStageMissingColors X.hierarchy + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) \ + HierarchySegmentColors X.hierarchy (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) + eta := + X.good.avoidance (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta hetaD hcg; + Finset.mem_sdiff.mpr + (⟨Eq.mpr (id (congrArg (fun (_a : Finset (Fin k)) ↦ c ∈ _a) (stageMissingEq j))) + (Finset.mem_sdiff.mp hold).left, + helper_branch_909 G k e0 input T phi ett base C ctx P alpha hp hA haA beta hbR haRnot + hbA corr bs K coreEq starK termK termH unaffectedValue firstEq j eta heta hcg hetaD + hold⟩ : + c ∈ HierarchyStageMissingColors K j ∧ c ∉ HierarchySegmentColors K j eta), + disjointPairs := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta theta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) + (htheta : theta ∈ HierarchyStoredColorsAt K j) (hne' : eta ≠ theta) ↦ + X.good.disjointPairs (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta theta + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ eta ∈ _a) (storedEq j)) heta) + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ theta ∈ _a) (storedEq j)) htheta) hne', + uniqueRefresh := fun (i : Fin K.dividerCount) ↦ + have this : (↑i : ℕ) < K.dividerCount := i.isLt; + Decidable.byContradiction + fun + (_ : + ¬∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta ⊆ + (TreeSequenceVertexSet (K.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, + theta ≠ eta → + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) theta = + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) theta) ↦ + by omega, + parallelBase := + id + fun + (_ : + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ↦ + (⟨id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + ¬TreeColorSetMinusClosed G sigma _a + ((HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))))) + coreEq)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + ¬TreeColorSetMinusClosed G sigma A + (_a.biUnion (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))))) + (storedEq (0 : Fin (K.dividerCount + (1 : ℕ)))))) + notClosed)), + id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma _a ∩ TreeMissingColors sigma bs.closure) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + corrData.left)) + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma _a) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + closureEq)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma b.closure) \ + _a.biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + (storedEq (0 : Fin (K.dividerCount + (1 : ℕ)))))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((_a ∩ TreeMissingColors sigma b.closure) \ + D.biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + hmTn)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors mu Tn ∩ _a) \ + D.biUnion + (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + hmR)) + (X.good.parallelBase hp).right)))))⟩ : + ¬TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + fun (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma bs.closure) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + fun (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta).card), + minusClosed := fun (i : Fin K.dividerCount) ↦ + have this : (↑i : ℕ) < K.dividerCount := i.isLt; + Decidable.byContradiction + fun + (_ : + ¬TreeColorSetMinusClosed G sigma (K.stage i.succ.castSucc) + ((HierarchyStoredColorsAt K i.succ).biUnion fun (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta)) ↦ + by omega : + GoodHierarchy K }; + ∀ (hvbT : vb ∈ TreeSequenceVertexSet T) (hyT : y ∈ TreeSequenceVertexSet T) (hvby : vb ≠ y) + (hbetavb : beta ∈ MissingColors G sigma vb), + let Y : HierarchyCounterexample bs := + { + positive := + Eq.mpr (id (congrArg (fun (_a : ℕ) ↦ (0 : ℕ) < _a) corr.rungAgreement)) X.positive, + hierarchy := K, good := gs, maximum := hmaximum, + notElementary := + fun (hel : ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T)) ↦ + Finset.disjoint_left.mp (hel hvbT hyT hvby) hbetavb hbetay : + HierarchyCounterexample bs }; + (∀ {r s : ℕ} (h : r = s) (f : Fin r → TreeSequence G e0) (g : Fin s → TreeSequence G e0), + f ≍ g → ∀ (i : Fin r), g (Fin.cast h i) = f i) → + HierarchyCounterexampleMeasure Y = HierarchyCounterexampleMeasure X + +private abbrev helperContinuation1585Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + (∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let b : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : + HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ + (by omega)) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + let y : V := T.vertex (Fin.last T.length); + H.dividerCount = (0 : ℕ) → + ∀ (hp : F.series.data.kind n = some TashkinovExtensionKind.PE) (hA : A = b.core), + TreeSequenceInitialSegment A T → + B.length = T.length - (1 : ℕ) → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → + y ∉ TreeSequenceVertexSet B → + ∀ (haA : alpha ∈ TreeMissingColors mu A), + alpha ∈ MissingColors G mu y → + let D : Finset (Fin k) := + HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ))); + let R : Finset (Fin k) := + D.biUnion (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))); + ∀ (beta : Fin k) (hbR : beta ∉ R), + beta ≠ alpha → + ∀ (haRnot : alpha ∉ R) (hbA : beta ∈ TreeMissingColors mu A), + let vb : V := T.vertex (HierarchyFirstMissingPosition mu T beta); + T.vertex (HierarchyFirstMissingPosition mu T beta) ∈ TreeSequenceVertexSet Tn ∧ + beta ∈ MissingColors G mu (T.vertex (HierarchyFirstMissingPosition mu T beta)) → + vb ∈ TreeSequenceVertexSet A → + vb ∈ TreeSequenceVertexSet B → + TreeInterchangeable G A mu beta alpha → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (have C : Set (V ⊕ E) := TwoColorComponent G mu beta alpha (Sum.inl y); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G mu v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G mu v → alpha ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + alpha ∈ MissingColors G mu v → beta ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ beta → + c ≠ alpha → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G mu v)) → + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = MissingColors G mu v) → + ∀ (hmTn : TreeMissingColors sigma Tn = TreeMissingColors mu Tn) + (hmR : TreeMissingColors sigma b.closure = TreeMissingColors mu b.closure), + beta ∈ TreeMissingColors sigma A → + beta ∈ TreeMissingColors sigma Tn → + beta ∈ MissingColors G sigma y → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 F sigma T), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT bs), + SameHierarchyStages H K → + ∀ + (corrData : + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + F.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors F.series.data n) + (hkzero : K.dividerCount = (0 : ℕ)) (coreEq : bs.core = A) + (closureEq : bs.closure = b.closure) + (starK : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = bs.core) + (termK : ∀ (j : Fin (K.dividerCount + (1 : ℕ))), K.stage j.succ = T) + (termH : + H.stage (Fin.succ (0 : Fin (H.dividerCount + (1 : ℕ)))) = T) + (storedEq : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = D) + (stageMissingEq : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = TreeMissingColors mu Tn) + (unaffectedValue : + ∀ (f : E) (c : Fin k), + c ≠ beta → c ≠ alpha → (sigma f = some c ↔ mu f = some c)) + (firstEq : + ∀ (eta : Fin k), + eta ≠ beta → + eta ≠ alpha → + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition mu T eta) + (notClosed : ¬TreeColorSetMinusClosed G sigma A R), + let gs : GoodHierarchy K := + { + gamma := fun (_ : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta, + twoColors := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) ↦ + X.good.twoColors (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) + eta + (Eq.mp + (congrArg (fun (_a : Finset (Fin k)) ↦ eta ∈ _a) (storedEq j)) + heta), + avoidance := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) ⦃c : Fin k⦄ + (hcg : + c ∈ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) + eta) ↦ + have hetaD : eta ∈ D := + Eq.mp + (congrArg (fun (_a : Finset (Fin k)) ↦ eta ∈ _a) (storedEq j)) + heta; + have hold : + c ∈ + HierarchyStageMissingColors X.hierarchy + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) \ + HierarchySegmentColors X.hierarchy + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta := + X.good.avoidance (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) + eta hetaD hcg; + Finset.mem_sdiff.mpr + (⟨Eq.mpr + (id + (congrArg (fun (_a : Finset (Fin k)) ↦ c ∈ _a) + (stageMissingEq j))) + (Finset.mem_sdiff.mp hold).left, + helper_branch_909 G k e0 input T phi ett base C ctx P alpha hp + hA haA beta hbR haRnot hbA corr bs K coreEq starK termK termH + unaffectedValue firstEq j eta heta hcg hetaD hold⟩ : + c ∈ HierarchyStageMissingColors K j ∧ + c ∉ HierarchySegmentColors K j eta), + disjointPairs := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta theta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) + (htheta : theta ∈ HierarchyStoredColorsAt K j) + (hne' : eta ≠ theta) ↦ + X.good.disjointPairs + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta theta + (Eq.mp + (congrArg (fun (_a : Finset (Fin k)) ↦ eta ∈ _a) (storedEq j)) + heta) + (Eq.mp + (congrArg (fun (_a : Finset (Fin k)) ↦ theta ∈ _a) + (storedEq j)) + htheta) + hne', + uniqueRefresh := fun (i : Fin K.dividerCount) ↦ + have this : (↑i : ℕ) < K.dividerCount := i.isLt; + Decidable.byContradiction + fun + (_ : + ¬∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + (X.good.gamma + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta ⊆ + (TreeSequenceVertexSet (K.stage i.succ.castSucc) \ + TreeSequenceVertexSet + (HierarchyStarredStage K i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, + theta ≠ eta → + X.good.gamma + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) theta = + X.good.gamma + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) + theta) ↦ + (by have := (i).isLt; omega), + parallelBase := + id + fun + (_ : + corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ↦ + (⟨id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + ¬TreeColorSetMinusClosed G sigma _a + ((HierarchyStoredColorsAt K + (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (X.good.gamma + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))))) + coreEq)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + ¬TreeColorSetMinusClosed G sigma A + (_a.biUnion + (X.good.gamma + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))))) + (storedEq (0 : Fin (K.dividerCount + (1 : ℕ)))))) + notClosed)), + id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma _a ∩ + TreeMissingColors sigma bs.closure) \ + (HierarchyStoredColorsAt K + (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (X.good.gamma + (0 : + Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + corrData.left)) + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ + TreeMissingColors sigma _a) \ + (HierarchyStoredColorsAt K + (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (X.good.gamma + (0 : + Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + closureEq)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ + TreeMissingColors sigma b.closure) \ + _a.biUnion + (X.good.gamma + (0 : + Fin (X.hierarchy.dividerCount + (1 : ℕ))))).card) + (storedEq (0 : Fin (K.dividerCount + (1 : ℕ)))))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((_a ∩ TreeMissingColors sigma b.closure) \ + D.biUnion + (X.good.gamma + (0 : + Fin + (X.hierarchy.dividerCount + (1 : ℕ))))).card) + hmTn)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors mu Tn ∩ _a) \ + D.biUnion + (X.good.gamma + (0 : + Fin + (X.hierarchy.dividerCount + (1 : ℕ))))).card) + hmR)) + (X.good.parallelBase hp).right)))))⟩ : + ¬TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt K + (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + fun (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) + eta) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma bs.closure) \ + (HierarchyStoredColorsAt K + (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + fun (eta : Fin k) ↦ + X.good.gamma + (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) + eta).card), + minusClosed := fun (i : Fin K.dividerCount) ↦ + have this : (↑i : ℕ) < K.dividerCount := i.isLt; + Decidable.byContradiction + fun + (_ : + ¬TreeColorSetMinusClosed G sigma (K.stage i.succ.castSucc) + ((HierarchyStoredColorsAt K i.succ).biUnion + fun (eta : Fin k) ↦ + X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) + eta)) ↦ + (by have := (i).isLt; omega) : + GoodHierarchy K }; + SameGoodHierarchy C.good gs → + vb ∈ TreeSequenceVertexSet T → + y ∈ TreeSequenceVertexSet T → + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett + base C ctx).Nonempty ∨ + ∃ (P' : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx) + (beta : Fin k), + let ett' : + ExtendedTashkinovTree G k e0 P'.corresponding.replacementInput + T P'.coloring := + P'.corresponding.replacementETT; + let n' : Fin (ett'.rounds + (1 : ℕ)) := Fin.last ett'.rounds; + let Tn' : TreeSequence G e0 := + ett'.series.data.tree n'.castSucc; + let H' : + TashkinovHierarchy P'.corresponding.replacementETT + P'.replacementBase := + P'.counterexample.hierarchy; + let A' : TreeSequence G e0 := + HierarchyStarredStage H' (Fin.last H'.dividerCount); + beta ∈ TreeMissingColors P'.coloring Tn' ∧ + beta ∈ TreeMissingColors P'.coloring A' ∧ + beta ∈ + MissingColors G P'.coloring + (T.vertex (Fin.last T.length)) ∧ + ∀ + i ∈ + Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G P'.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P'.coloring + (T.vertex (Fin.last T.length))) + +private abbrev helperContinuation1545Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + P.counterexample.hierarchy.dividerCount = (0 : ℕ) → + (∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let b : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : + HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ + (by omega)) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + let y : V := T.vertex (Fin.last T.length); + H.dividerCount = (0 : ℕ) → + F.series.data.kind n = some TashkinovExtensionKind.PE → + A = b.core → + TreeSequenceInitialSegment A T → + B.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → + y ∉ TreeSequenceVertexSet B → + alpha ∈ TreeMissingColors mu A → + alpha ∈ MissingColors G mu y → + let D : Finset (Fin k) := + HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ))); + let R : Finset (Fin k) := + D.biUnion (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))); + ∀ beta ∉ R, + beta ≠ alpha → + alpha ∉ R → + beta ∈ TreeMissingColors mu A → + let vb : V := T.vertex (HierarchyFirstMissingPosition mu T beta); + T.vertex (HierarchyFirstMissingPosition mu T beta) ∈ TreeSequenceVertexSet Tn ∧ + beta ∈ + MissingColors G mu (T.vertex (HierarchyFirstMissingPosition mu T beta)) → + vb ∈ TreeSequenceVertexSet A → + vb ∈ TreeSequenceVertexSet B → + TreeInterchangeable G A mu beta alpha → + let _ : Set (V ⊕ E) := TwoColorComponent G mu beta alpha (Sum.inl y); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (have C : Set (V ⊕ E) := TwoColorComponent G mu beta alpha (Sum.inl y); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + (∀ (v : V), + Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G mu v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G mu v → alpha ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + alpha ∈ MissingColors G mu v → beta ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ beta → + c ≠ alpha → + (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G mu v)) → + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = MissingColors G mu v) → + TreeMissingColors sigma A = TreeMissingColors mu A → + TreeMissingColors sigma Tn = TreeMissingColors mu Tn → + TreeMissingColors sigma b.closure = TreeMissingColors mu b.closure → + beta ∈ TreeMissingColors sigma A → + alpha ∈ TreeMissingColors sigma A → + beta ∈ TreeMissingColors sigma Tn → + beta ∈ MissingColors G sigma y → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 F sigma T), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT bs), + SameHierarchyStages H K → + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + F.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors F.series.data n → + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett + base C ctx).Nonempty ∨ + ∃ (P' : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) + (beta : Fin k), + let ett' : + ExtendedTashkinovTree G k e0 + P'.corresponding.replacementInput T P'.coloring := + P'.corresponding.replacementETT; + let n' : Fin (ett'.rounds + (1 : ℕ)) := + Fin.last ett'.rounds; + let Tn' : TreeSequence G e0 := + ett'.series.data.tree n'.castSucc; + let H' : + TashkinovHierarchy P'.corresponding.replacementETT + P'.replacementBase := + P'.counterexample.hierarchy; + let A' : TreeSequence G e0 := + HierarchyStarredStage H' (Fin.last H'.dividerCount); + beta ∈ TreeMissingColors P'.coloring Tn' ∧ + beta ∈ TreeMissingColors P'.coloring A' ∧ + beta ∈ + MissingColors G P'.coloring + (T.vertex (Fin.last T.length)) ∧ + ∀ + i ∈ + Finset.Icc (1 : ℕ) + (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G P'.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P'.coloring + (T.vertex (Fin.last T.length))) + +private abbrev helperContinuation1486Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → + IsOneEdgeUncolored mu e0 → ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + P.counterexample.hierarchy.dividerCount = (0 : ℕ) → + (let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + alpha ∈ TreeMissingColors P.coloring A ∧ + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) → + (let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + alpha ∉ TreeMissingColors P.coloring Tn) → + (∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let b : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : + HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + let y : V := T.vertex (Fin.last T.length); + H.dividerCount = (0 : ℕ) → + F.series.data.kind n = some TashkinovExtensionKind.PE → + A = b.core → + TreeSequenceInitialSegment A T → + B.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A B → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → + y ∉ TreeSequenceVertexSet B → + OrderedTreeUnion + (P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc) + b.closure b.core → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment Tn T → + alpha ∈ TreeMissingColors mu A → + alpha ∈ MissingColors G mu y → + alpha ∉ TreeMissingColors mu Tn → + alpha ∈ TreeMissingColors mu b.closure → + let D : Finset (Fin k) := + HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ))); + let R : Finset (Fin k) := + D.biUnion (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))); + ∀ beta ∈ TreeMissingColors mu Tn, + beta ∉ R → + beta ≠ alpha → + alpha ∉ R → + (∀ {U W : TreeSequence G e0}, + TreeSequenceInitialSegment U W → + ∀ {c : Fin k}, + c ∈ TreeMissingColors mu U → c ∈ TreeMissingColors mu W) → + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C + ctx).Nonempty ∨ + ∃ (P' : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (beta : Fin k), + let ett' : + ExtendedTashkinovTree G k e0 P'.corresponding.replacementInput T + P'.coloring := + P'.corresponding.replacementETT; + let n' : Fin (ett'.rounds + (1 : ℕ)) := Fin.last ett'.rounds; + let Tn' : TreeSequence G e0 := ett'.series.data.tree n'.castSucc; + let H' : + TashkinovHierarchy P'.corresponding.replacementETT + P'.replacementBase := + P'.counterexample.hierarchy; + let A' : TreeSequence G e0 := + HierarchyStarredStage H' (Fin.last H'.dividerCount); + beta ∈ TreeMissingColors P'.coloring Tn' ∧ + beta ∈ TreeMissingColors P'.coloring A' ∧ + beta ∈ + MissingColors G P'.coloring (T.vertex (Fin.last T.length)) ∧ + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G P'.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P'.coloring (T.vertex (Fin.last T.length))) + +private theorem helper_missingB_384.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + (let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + alpha ∈ TreeMissingColors P.coloring A ∧ + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) → + (let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + alpha ∉ TreeMissingColors P.coloring Tn) → + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let b : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + let y : V := T.vertex (Fin.last T.length); + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → + alpha ∈ TreeMissingColors mu A → + alpha ∈ MissingColors G mu y → + alpha ∉ TreeMissingColors mu Tn → + alpha ∈ TreeMissingColors mu b.closure → + let D : Finset (Fin k) := + HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ))); + let R : Finset (Fin k) := + D.biUnion (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))); + ∀ beta ∈ TreeMissingColors mu Tn, + beta ∉ R → + beta ≠ alpha → + alpha ∉ R → + beta ∈ TreeMissingColors mu A → + let va : V := T.vertex (HierarchyFirstMissingPosition mu T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition mu T beta); + T.vertex (HierarchyFirstMissingPosition mu T alpha) ∈ TreeSequenceVertexSet A ∧ + alpha ∈ MissingColors G mu (T.vertex (HierarchyFirstMissingPosition mu T alpha)) → + T.vertex (HierarchyFirstMissingPosition mu T beta) ∈ TreeSequenceVertexSet Tn ∧ + beta ∈ MissingColors G mu (T.vertex (HierarchyFirstMissingPosition mu T beta)) → + va ∈ TreeSequenceVertexSet B → + vb ∈ TreeSequenceVertexSet A → + vb ∈ TreeSequenceVertexSet B → + va ≠ vb → + TreeInterchangeable G A mu beta alpha → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu beta alpha; + (∀ (z : V ⊕ E), z ∈ TwoColorComponent G mu beta alpha z) → + (∀ (v : V), + beta ∈ MissingColors G mu v ∨ alpha ∈ MissingColors G mu v → + (J.neighborSet (Sum.inl v)).Subsingleton) → + (∀ (v : V), + beta ∈ MissingColors G mu v ∨ alpha ∈ MissingColors G mu v → + TwoColorPathComponent G mu beta alpha (Sum.inl v)) → + TwoColorComponent G mu beta alpha (Sum.inl va) = + TwoColorComponent G mu beta alpha (Sum.inl vb) → + let Q : Set (V ⊕ E) := TwoColorComponent G mu beta alpha (Sum.inl y); + TwoColorPathComponent G mu beta alpha (Sum.inl y) → + (∀ {s t : V ⊕ E} (p : J.Walk s t), + p.IsPath → ∀ v ∈ p.support, (J.neighborSet v).Subsingleton → v = s ∨ v = t) → + Disjoint Q (TwoColorComponent G mu beta alpha (Sum.inl vb)) → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + (have H : TashkinovHierarchy F b := X.hierarchy; + have n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + have Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors F.series.data n; + have A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + (if F.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn b.closure Dn mu sigma + else StableColoring Tn Dn mu sigma) ∧ + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G mu v) ∧ + IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c : Fin k), + c = beta ∨ c = alpha → + c ∈ TreeMissingColors mu (HierarchyStarredStage H r) → + TreeColorSetClosed G mu (HierarchyStarredStage H r) { c } → + OutsideKempeRecoloring (HierarchyStarredStage H r) mu sigma beta + alpha) → + CombinedStableColoring Tn b.closure (TashkinovStoredColors F.series.data n) mu sigma → + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (have C : Set (V ⊕ E) := TwoColorComponent G mu beta alpha (Sum.inl y); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G mu v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → beta ∈ MissingColors G mu v → alpha ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + alpha ∈ MissingColors G mu v → beta ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ beta → + c ≠ alpha → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G mu v)) → + (∀ {v : V} {f : E}, + Sum.inl v ∈ Q → + Incident G v f → mu f = some beta ∨ mu f = some alpha → Sum.inr f ∈ Q) → + ∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = MissingColors G mu v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha hstart hnotTerminalLadder mu F b X + H n Tn A ell B y helem haA hay haTn haR D R beta hbTn hbR hne haRnot hbA va vb hva hvb hvaB + hvbA hvbB hvab hi J selfMem endpoint pathMissing habComp Q hpath hend hdisjoint sigma + control hcombined hsproper hsone behavior edgeOfVertex v hv + by_cases hout : Sum.inl v ∉ Q + · exact behavior.1 v hout + · have hin : Sum.inl v ∈ Q := not_not.mp hout + have hna : alpha ∉ MissingColors G mu v := by + intro hm + have heq : v = va := by + by_contra hn + exact Finset.disjoint_left.mp (helem hv hvaB hn) hm hva.2 + apply Set.disjoint_left.mp hdisjoint hin + rw [heq, ← habComp] + exact selfMem _ + have hnb : beta ∉ MissingColors G mu v := by + intro hm + have heq : v = vb := by + by_contra hn + exact Finset.disjoint_left.mp (helem hv hvbB hn) hm hvb.2 + exact Set.disjoint_left.mp hdisjoint hin (heq ▸ selfMem (Sum.inl v)) + have newPresent (c d : Fin k) (hcd : c = beta ∧ d = alpha ∨ c = alpha ∧ d = beta) + (hd : d ∉ MissingColors G mu v) : c ∉ MissingColors G sigma v := by + have hpresent : d ∈ PresentColors G mu v := by simpa [MissingColors] using hd + obtain ⟨f, hf, hcol⟩ : ∃ f, Incident G v f ∧ mu f = some d := by + simpa [PresentColors] using hpresent + have hfe : Sum.inr f ∈ Q := by + apply edgeOfVertex hin hf + rcases hcd with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inr hcol + · exact Or.inl hcol + have hnew : sigma f = some c := by + rcases hcd with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · simp [sigma, TwoColorComponentSwap, hfe, hcol, hne.symm, Q] + · simp [sigma, TwoColorComponentSwap, hfe, hcol, Q] + have hpnew : c ∈ PresentColors G sigma v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hf, hnew⟩ + simpa [MissingColors] using hpnew + ext c + by_cases hcb : c = beta + · subst c + simp only [hnb, newPresent beta alpha (Or.inl ⟨rfl, rfl⟩) hna] + · by_cases hca : c = alpha + · subst c + simp only [hna, newPresent alpha beta (Or.inr ⟨rfl, rfl⟩) hnb] + · exact behavior.2.2.2 v c hcb hca + +private theorem helper_notClosed_594.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let b : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let y : V := T.vertex (Fin.last T.length); + F.series.data.kind n = some TashkinovExtensionKind.PE → + A = b.core → + let D : Finset (Fin k) := + HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ))); + let R : Finset (Fin k) := + D.biUnion (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ)))); + ∀ beta ∉ R, + alpha ∉ R → + let _ : Set (V ⊕ E) := TwoColorComponent G mu beta alpha (Sum.inl y); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + TreeMissingColors sigma A = TreeMissingColors mu A → + beta ∈ TreeMissingColors sigma A → + alpha ∈ TreeMissingColors sigma A → + (∀ (f : E) (c : Fin k), c ≠ beta → c ≠ alpha → (sigma f = some c ↔ mu f = some c)) → + ¬TreeColorSetMinusClosed G sigma A R := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu F b X H n A y hp hA D R beta hbR + haRnot Q sigma hmA hbetaA halphaA unaffectedValue + have hnot := (X.good.parallelBase hp).1 + change ¬ TreeColorSetClosed G mu b.core (TreeMissingColors mu b.core \ R) at hnot + rw [← hA] at hnot + unfold TreeColorSetClosed at hnot + push Not at hnot + obtain ⟨c, hc, hn⟩ := hnot + obtain ⟨f, hf⟩ := hn + have hfdata : f ∈ BoundaryEdges G (TreeSequenceVertexSet A) ∧ mu f = some c := by + simpa [BoundaryColorEdges] using hf + obtain ⟨d, hd, hfd⟩ : ∃ d, d ∈ TreeMissingColors sigma A \ R ∧ sigma f = some d := by + by_cases hcb : c = beta + · subst c + by_cases hcomp : Sum.inr f ∈ Q + · exact ⟨alpha, Finset.mem_sdiff.mpr ⟨halphaA, haRnot⟩, by + simp [sigma, TwoColorComponentSwap, Q, hcomp, hfdata.2]⟩ + · exact ⟨beta, Finset.mem_sdiff.mpr ⟨hbetaA, hbR⟩, by + simp [sigma, TwoColorComponentSwap, Q, hcomp, hfdata.2]⟩ + · by_cases hca : c = alpha + · subst c + by_cases hcomp : Sum.inr f ∈ Q + · exact ⟨beta, Finset.mem_sdiff.mpr ⟨hbetaA, hbR⟩, by + simp [sigma, TwoColorComponentSwap, Q, hcomp, hfdata.2]⟩ + · exact ⟨alpha, Finset.mem_sdiff.mpr ⟨halphaA, haRnot⟩, by + simp [sigma, TwoColorComponentSwap, Q, hcomp, hfdata.2]⟩ + · exact ⟨c, by rwa [hmA], (unaffectedValue f c hcb hca).2 hfdata.2⟩ + intro hclosed + have hfnew : f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet A) d := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hfdata.1, hfd⟩ + rw [hclosed d hd] at hfnew + exact Finset.notMem_empty f hfnew + +private theorem helper_noCommonSigma_783.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + (∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) → + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + let y : V := T.vertex (Fin.last T.length); + TreeSequenceInitialSegment A T → + B.length = T.length - (1 : ℕ) → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → + alpha ∈ MissingColors G mu y → + ∀ (beta : Fin k), + beta ≠ alpha → + let vb : V := T.vertex (HierarchyFirstMissingPosition mu T beta); + T.vertex (HierarchyFirstMissingPosition mu T beta) ∈ TreeSequenceVertexSet Tn ∧ + beta ∈ MissingColors G mu (T.vertex (HierarchyFirstMissingPosition mu T beta)) → + vb ∈ TreeSequenceVertexSet A → + vb ∈ TreeSequenceVertexSet B → + TreeInterchangeable G A mu beta alpha → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + (have C : Set (V ⊕ E) := TwoColorComponent G mu beta alpha (Sum.inl y); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G mu v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → beta ∈ MissingColors G mu v → alpha ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + alpha ∈ MissingColors G mu v → beta ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ beta → + c ≠ alpha → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G mu v)) → + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 F sigma T) + (bs : HierarchyBase corr.replacementETT sigma) + (_ : TashkinovHierarchy corr.replacementETT bs), + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → + HierarchyFullTailLength C = ell → + ∀ i ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)), + Disjoint + (MissingColors G sigma + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G sigma y) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha hnoCommon mu F X H n Tn A ell B y + hAT hBlen helem hay beta hne vb hvb hvbA hvbB hi sigma behavior missingB corr bs K hCstar + htailC i hi + have hi' := Finset.mem_Icc.mp hi + rw [htailC] at hi' + let U := HierarchyFullTailPrefix C i + let v := U.vertex (Fin.last U.length) + have hUlen : U.length = A.length + i := by + change min ((HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i) T.length = _ + rw [hCstar] + dsimp [ell] at hi' + omega + have hUT : TreeSequenceInitialSegment U T := ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hvB : v ∈ TreeSequenceVertexSet B := by + let j : Fin (B.length + 1) := ⟨U.length, by rw [hBlen, hUlen]; dsimp [ell] at hi'; omega⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨j, ?_⟩ + change T.vertex _ = T.vertex _ + apply congrArg T.vertex + apply Fin.ext + rfl + have hvne : v ≠ vb := by + intro hv + obtain ⟨j, hj⟩ : ∃ j, A.vertex j = vb := by simpa [TreeSequenceVertexSet] using hvbA + have heq : T.vertex (Fin.castLE (Nat.succ_le_succ hUT.1) (Fin.last U.length)) = + T.vertex (Fin.castLE (Nat.succ_le_succ hAT.1) j) := + (hUT.2.1 _).trans (hv.trans ((hAT.2.1 j).trans hj).symm) + have hval := congrArg Fin.val (T.vertex_injective heq) + simp only [Fin.val_castLE, Fin.val_last] at hval + have := j.isLt + omega + apply Finset.disjoint_left.mpr + intro c hcv hcy + have holdv : c ∈ MissingColors G mu v := by rw [← missingB v hvB]; exact hcv + by_cases hcb : c = beta + · subst c + exact Finset.disjoint_left.mp (helem hvB hvbB hvne) holdv hvb.2 + · by_cases hca : c = alpha + · subst c + exact Finset.disjoint_left.mp (hnoCommon i hi) holdv hay + · exact Finset.disjoint_left.mp (hnoCommon i hi) holdv + ((behavior.2.2.2 y c hcb hca).1 hcy) + +private theorem helper_firstIn_595.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (U : TreeSequence G e0), + TreeSequenceInitialSegment U T → + ∀ c ∈ TreeMissingColors mu U, + T.vertex (HierarchyFirstMissingPosition mu T c) ∈ TreeSequenceVertexSet U ∧ + c ∈ MissingColors G mu (T.vertex (HierarchyFirstMissingPosition mu T c)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu U hUT c hc + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + obtain ⟨i, hi⟩ : ∃ i, U.vertex i = v := by + simpa [TreeSequenceVertexSet] using hv + let iT := Fin.castLE (Nat.succ_le_succ hUT.1) i + let S := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G mu (T.vertex j) + have hiS : iT ∈ S := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, by simpa only [iT, hUT.2.1 i, hi] using hvc⟩ + have hS : S.Nonempty := ⟨iT, hiS⟩ + have hpos : HierarchyFirstMissingPosition mu T c = S.min' hS := by + simp only [HierarchyFirstMissingPosition, S, dite_eq_left hS] + have hbound : (HierarchyFirstMissingPosition mu T c).val ≤ U.length := by + have hh := Finset.min'_le S iT hiS + rw [← hpos] at hh + have := i.isLt + change (HierarchyFirstMissingPosition mu T c).val ≤ i.val at hh + omega + let j : Fin (U.length + 1) := ⟨(HierarchyFirstMissingPosition mu T c).val, by omega⟩ + have hj : Fin.castLE (Nat.succ_le_succ hUT.1) j = + HierarchyFirstMissingPosition mu T c := Fin.ext rfl + refine ⟨?_, ?_⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, (hUT.2.1 j).symm.trans (congrArg T.vertex hj)⟩ + rw [hpos] + exact (Finset.mem_filter.mp (Finset.min'_mem S hS)).2 + +private theorem helper_oldRoute_743.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + F.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceInitialSegment Tn T → + ∀ (beta : Fin k), + TreeInterchangeable G A mu beta alpha → + TashkinovAugmentationSequence mu Tn T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu F X H n Tn A hp hTnT beta hi + have step := F.series.certified n + generalize hi : n = i at step + cases step with + | initial => + have hv := congrArg Fin.val hi + simp [n] at hv + have := F.roundsPositive + omega + | SE j _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hk : F.series.data.kind n = some TashkinovExtensionKind.SE := by simpa [hi] using kind + rw [hp] at hk + cases hk + | RE j _ _ _ _ available coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hk : F.series.data.kind n = some TashkinovExtensionKind.RE := by simpa [hi] using kind + rw [hp] at hk + cases hk + | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (F.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + apply TashkinovAugmentationSequenceRestrict mu Tn T _ _ hTnT F.belowFinal + simpa [Tn, hj, hlast, ← F.generatingColoring, n] using closure.1 + +private theorem helper_newCore_790.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + let y : V := T.vertex (Fin.last T.length); + TreeSequenceInitialSegment A B → + ∀ (beta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v) → + TashkinovAugmentationSequence mu Tn A → + (∀ (j : Fin A.length), sigma (A.edge j) = mu (A.edge j)) → + TashkinovAugmentationSequence sigma Tn A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu F X H n Tn A ell B y hAB beta + sigma missingB oldCore fixedA + have transport : ∀ (U W : TreeSequence G e0), TashkinovAugmentationSequence mu U W → + TreeSequenceInitialSegment W A → TashkinovAugmentationSequence sigma U W := by + intro U W hseq + unfold TashkinovAugmentationSequence at hseq ⊢ + induction hseq with + | refl => intro _; exact Relation.ReflTransGen.refl + | @tail Z W hUZ hZW ih => + intro hWA + rcases hZW with ⟨hlen, hZW, c, hedge, hc⟩ + have hZA : TreeSequenceInitialSegment Z A := + ⟨hZW.1.trans hWA.1, + fun i => (hWA.2.1 (Fin.castLE (Nat.succ_le_succ hZW.1) i)).trans (hZW.2.1 i), + fun i => (hWA.2.2 (Fin.castLE hZW.1 i)).trans (hZW.2.2 i)⟩ + refine Relation.ReflTransGen.tail (ih hZA) ⟨hlen, hZW, c, ?_, ?_⟩ + · let i := Fin.cast hlen.symm (Fin.last Z.length) + have he := hWA.2.2 i + have hf := fixedA (Fin.castLE hWA.1 i) + rw [he] at hf + exact hf.trans hedge + · obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, hv, by + rw [missingB v (TreeSequenceInitialSegmentVertexSetSubset hAB + (TreeSequenceInitialSegmentVertexSetSubset hZA hv))] + exact hvc⟩ + exact transport Tn A oldCore ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + +private theorem helper_corrData_823.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let _ : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let y : V := T.vertex (Fin.last T.length); + ∀ (beta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + TreeMissingColors sigma Tn = TreeMissingColors mu Tn → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 F sigma T), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT bs), + SameHierarchyStages H K → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + F.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors F.series.data n := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu F b X H n Tn y beta sigma hmTn + corr hmaximum bs K hsame + rcases corr with ⟨ri, rs, re, hr, hs, hgen, ht, hd, he, hk, hproper, hone, hstable⟩ + cases re with + | mk rounds positive data above strict below generating => + cases hr + have hs' : data = rs := eq_of_heq hs + cases hs' + let a : Fin F.rounds := ⟨F.rounds - 1, by have := F.roundsPositive; omega⟩ + have ha : a.succ = Fin.last F.rounds := Fin.ext (by have := F.roundsPositive; simp [a]; omega) + have htree : rs.data.tree (Fin.last F.rounds).castSucc = Tn := by + change rs.data.tree (Fin.last F.rounds).castSucc = F.series.data.tree (Fin.last + F.rounds).castSucc + rw [← ha] + exact ht a + have hmnew : TreeMissingColors (rs.data.coloring (Fin.last F.rounds)) + (rs.data.tree (Fin.last F.rounds).castSucc) = TreeMissingColors mu Tn := by + rw [← hgen, htree, hmTn] + have hmold : TreeMissingColors (F.series.data.coloring (Fin.last F.rounds)) + (F.series.data.tree (Fin.last F.rounds).castSucc) = TreeMissingColors mu Tn := by + rw [← F.generatingColoring] + refine ⟨htree, hk _, ?_⟩ + change TashkinovStoredColors rs.data (Fin.last F.rounds) = TashkinovStoredColors + F.series.data (Fin.last F.rounds) + simp only [TashkinovStoredColors, hd, hmnew, hmold] + +private theorem helper_endpoint_894.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → + IsOneEdgeUncolored mu e0 → ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let _ : + HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let _ : V := T.vertex (Fin.last T.length); + ∀ (beta : Fin k), + beta ≠ alpha → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu beta alpha; + ∀ (v : V), + beta ∈ MissingColors G mu v ∨ alpha ∈ MissingColors G mu v → + (J.neighborSet (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx _ P alpha mu mctx y beta hne J v hm + have hdeg : @SimpleGraph.degree _ J (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with hm | hm + · exact MissingColorIncidenceEndpoint G mu beta alpha hne mctx.proper v hm + · have hg : TwoColorIncidenceGraph G mu alpha beta = J := by + ext x y + cases x <;> cases y <;> simp [J, TwoColorIncidenceGraph, or_comm] + rw [← hg] + exact MissingColorIncidenceEndpoint G mu alpha beta hne.symm mctx.proper v hm + let : Fintype (J.neighborSet (Sum.inl v)) := Fintype.ofFinite _ + have hc : Fintype.card (J.neighborSet (Sum.inl v)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hdeg + intro x hx w hw + exact congrArg Subtype.val (Fintype.card_le_one_iff.mp hc ⟨x, hx⟩ ⟨w, hw⟩) + +private theorem helper_hend_920.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + X.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (beta : Fin k), + TreeInterchangeable G A mu beta alpha → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu beta alpha; + ∀ {s t : V ⊕ E} (p : J.Walk s t), + p.IsPath → + ∀ v ∈ p.support, + (J.neighborSet v).Subsingleton → + v = s ∨ v = t := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu X H A beta hi J s t p hpp v hv + hvdeg + obtain ⟨i, hvi, hi⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hv + by_cases h0 : i = 0 + · left + simpa only [h0, p.getVert_zero] using hvi.symm + by_cases hl : i = p.length + · right + simpa only [hl, p.getVert_length] using hvi.symm + have hlft : J.Adj v (p.getVert (i - 1)) := by + rw [← hvi, ← show i - 1 + 1 = i by omega] + exact (p.adj_getVert_succ (by omega : i - 1 < p.length)).symm + have hrgt : J.Adj v (p.getVert (i + 1)) := by + rw [← hvi] + exact p.adj_getVert_succ (by omega : i < p.length) + have heq := hvdeg hlft hrgt + have heqi := hpp.getVert_injOn (by omega : i - 1 ≤ p.length) + (by omega : i + 1 ≤ p.length) heq + omega + +private theorem helper_hdisjoint_940.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → + IsOneEdgeUncolored mu e0 → ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : + HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + let y : V := T.vertex (Fin.last T.length); + y ∉ TreeSequenceVertexSet B → + alpha ∈ MissingColors G mu y → + ∀ (beta : Fin k), + let va : V := T.vertex (HierarchyFirstMissingPosition mu T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition mu T beta); + T.vertex (HierarchyFirstMissingPosition mu T alpha) ∈ TreeSequenceVertexSet A ∧ + alpha ∈ MissingColors G mu (T.vertex (HierarchyFirstMissingPosition mu T alpha)) → + T.vertex (HierarchyFirstMissingPosition mu T beta) ∈ TreeSequenceVertexSet Tn ∧ + beta ∈ MissingColors G mu (T.vertex (HierarchyFirstMissingPosition mu T beta)) → + va ∈ TreeSequenceVertexSet B → + vb ∈ TreeSequenceVertexSet B → + va ≠ vb → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu beta alpha; + (∀ (z : V ⊕ E), z ∈ TwoColorComponent G mu beta alpha z) → + (∀ (v : V), + beta ∈ MissingColors G mu v ∨ alpha ∈ MissingColors G mu v → + (J.neighborSet (Sum.inl v)).Subsingleton) → + TwoColorComponent G mu beta alpha (Sum.inl va) = + TwoColorComponent G mu beta alpha (Sum.inl vb) → + let Q : Set (V ⊕ E) := TwoColorComponent G mu beta alpha (Sum.inl y); + (∀ {s t : V ⊕ E} (p : J.Walk s t), + p.IsPath → ∀ v ∈ p.support, (J.neighborSet v).Subsingleton → v = s ∨ v = t) → + Disjoint Q (TwoColorComponent G mu beta alpha (Sum.inl vb)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx _ P alpha mu F X mctx H n Tn A ell B y hyB + hay beta va vb hva hvb hvaB hvbB hvab J selfMem endpoint habComp Q hend + rcases TwoColorComponentsDisjoint G mu beta alpha (Sum.inl y) (Sum.inl vb) with heq | hd + · obtain ⟨s, t, p, hpp, hsupp⟩ := TwoColorComponentSpanningPath G mu beta alpha mctx.proper + (Sum.inl y) + have hayQ : Sum.inl va ∈ Q := by dsimp only [Q]; rw [heq, ← habComp]; exact selfMem _ + have hbyQ : Sum.inl vb ∈ Q := by dsimp only [Q]; rw [heq]; exact selfMem _ + have hs : ∀ x, x ∈ p.support ↔ x ∈ Q := fun x => Set.ext_iff.mp hsupp x + have haend := hend p hpp (Sum.inl va) ((hs _).2 hayQ) (endpoint va (Or.inr hva.2)) + have hbend := hend p hpp (Sum.inl vb) ((hs _).2 hbyQ) (endpoint vb (Or.inl hvb.2)) + have hyend := hend p hpp (Sum.inl y) ((hs _).2 (selfMem _)) (endpoint y (Or.inr hay)) + have hya : y ≠ va := by intro hh; exact hyB (hh ▸ hvaB) + have hyb : y ≠ vb := by intro hh; exact hyB (hh ▸ hvbB) + rcases haend with ha | ha <;> rcases hbend with hb | hb <;> rcases hyend with hy | hy + all_goals first + | exact (hvab (Sum.inl.inj (ha.trans hb.symm))).elim + | exact (hya (Sum.inl.inj (hy.trans ha.symm))).elim + | exact (hyb (Sum.inl.inj (hy.trans hb.symm))).elim + · exact hd + +private theorem helper_fixedA_997.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let b : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let Tn : TreeSequence G e0 := F.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let y : V := T.vertex (Fin.last T.length); + A = b.core → + OrderedTreeUnion + (P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc) + b.closure b.core → + TreeSequenceInitialSegment Tn A → + ∀ (beta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G mu beta alpha (Sum.inl y); + (let Tn : TreeSequence G e0 := F.series.data.tree (Fin.last F.rounds).castSucc; + have seed : TreeSequence G e0 := + TreeSequencePrefix Tn (↑b.supportPosition : ℕ) b.supportPositive + (Nat.le_of_lt_succ b.supportPosition.isLt); + (∀ (j : Fin Tn.length), sigma (Tn.edge j) = mu (Tn.edge j)) ∧ + (∀ (j : Fin b.closure.length), sigma (b.closure.edge j) = mu (b.closure.edge j)) ∧ + TashkinovClosure sigma seed b.closure) → + ∀ (j : Fin A.length), + sigma (A.edge j) = mu (A.edge j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu F b X H n Tn A y hA u hTnA beta + sigma displayed j + by_cases hj : j.val < Tn.length + · let i : Fin Tn.length := ⟨j.val, hj⟩ + have he : A.edge j = Tn.edge i := by + have he := hTnA.2.2 i + simpa [i] using he + rw [he] + exact displayed.1 i + · obtain ⟨i, he, hv⟩ := u.newEntryFromRight (Fin.cast (congrArg TreeSequence.length hA) j) (by + simpa using Nat.le_of_not_gt hj) + have edgeTransport (U W : TreeSequence G e0) (h : U = W) (j : Fin U.length) : + W.edge (Fin.cast (congrArg TreeSequence.length h) j) = U.edge j := by + cases h + rfl + have he' : A.edge j = b.closure.edge i := (edgeTransport A b.core hA j).symm.trans he + rw [he'] + exact displayed.2.1 i + +private theorem helper_sameC_1124.{u_1, u_2} : + helperSameC1124Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha hzero mu F b X H n Tn A y hp hA haA + D R beta hbR haRnot hbA sigma hmTn hmR corr bs K hsame corrData hkzero coreEq closureEq + starK termK termH storedEq stageMissingEq unaffectedValue firstEq notClosed gs sameHX + have hs0 := P.sameGood.1 + have hs1 := sameHX.1 + refine ⟨?_, ?_⟩ + · refine ⟨hs0.1.trans hs1.1, hs0.2.1.trans hs1.2.1, + hs0.2.2.1.trans hs1.2.2.1, hs0.2.2.2.1.trans hs1.2.2.2.1, + hs0.2.2.2.2.1.trans hs1.2.2.2.2.1, ?_⟩ + intro hpeC + exact (hs0.2.2.2.2.2 hpeC).trans (hs1.2.2.2.2.2 (hs0.2.2.2.2.1.mp hpeC)) + · obtain ⟨hcount, hg⟩ := P.sameGood.2 + refine ⟨hcount.trans hsame.2.1, ?_⟩ + intro j + have hj : Fin.cast (congrArg (fun q => q + 1) hcount) j = 0 := + Fin.ext (by have := (Fin.cast (congrArg (fun q => q + 1) hcount) j).isLt; omega) + have ho := hg j + dsimp only at ho ⊢ + rw [hj] at ho + refine ⟨ho.1.trans (storedEq _).symm, ?_⟩ + intro eta heta + exact ho.2 eta heta + +private theorem helper_measureEq_1164.{u_1, u_2} : + helperMeasureEq1164Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu F b X H n Tn A y hp hA haA D R + beta hbR haRnot hbA vb sigma hmTn hmR hbetay corr hmaximum bs K hsame corrData hkzero + coreEq closureEq starK termK termH storedEq stageMissingEq unaffectedValue firstEq + notClosed gs hvbT hyT hvby hbetavb Y evalHEq + have hstage : K.stage ⟨K.dividerCount, by omega⟩ = H.stage ⟨H.dividerCount, by omega⟩ := by + have he := evalHEq (congrArg (fun q => q + 2) hsame.2.1) H.stage K.stage hsame.2.2.1 + ⟨H.dividerCount, by omega⟩ + convert he using 1 + apply congrArg K.stage + apply Fin.ext + simp only [Fin.val_cast] + exact hsame.2.1.symm + change (HierarchyPathNumber K, T.length - (K.stage ⟨K.dividerCount, by omega⟩).length) = + (HierarchyPathNumber H, T.length - (H.stage ⟨H.dividerCount, by omega⟩).length) + rw [hstage] + congr 1 + unfold HierarchyPathNumber + rw [starK, coreEq] + +private theorem helper_continuation_1585.{u_1, u_2} : + helperContinuation1585Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha hnoCommon mu F b X mctx H n Tn A + ell B y hz hp hA hAT hBlen helem hyB haA hay D R beta hbR hne haRnot hbA vb hvb hvbA hvbB + hi sigma hsproper hsone behavior missingB hmTn hmR hbetaA hbetaTn hbetay corr hmaximum bs K + hsame corrData hkzero coreEq closureEq starK termK termH storedEq stageMissingEq + unaffectedValue firstEq notClosed gs sameC hvbT hyT + have hvby : vb ≠ y := by intro h; exact hyB (h ▸ hvbB) + have hbetavb : beta ∈ MissingColors G sigma vb := by rw [missingB vb hvbB]; exact hvb.2 + let Y : HierarchyCounterexample bs := by + exact { + positive := by rw [corr.rungAgreement]; exact X.positive + hierarchy := K + good := gs + maximum := hmaximum + notElementary := by + intro hel + exact Finset.disjoint_left.mp (hel hvbT hyT hvby) hbetavb hbetay } + have evalHEq {r s : ℕ} (h : r = s) + (f : Fin r → TreeSequence G e0) (g : Fin s → TreeSequence G e0) + (hh : HEq f g) (i : Fin r) : g (Fin.cast h i) = f i := by + cases h + cases hh + rfl + have measureEq := + @helper_measureEq_1164 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha hp hA haA beta hbR haRnot hbA hmTn hmR hbetay corr + hmaximum bs K hsame corrData hkzero coreEq closureEq starK termK termH storedEq + stageMissingEq unaffectedValue firstEq notClosed hvbT hyT hvby hbetavb evalHEq + let ctxY : HierarchyMinimumCounterexampleContext G k e0 corr.replacementInput + T sigma corr.replacementETT bs Y := by + exact { + proper := hsproper + oneEdgeUncolored := hsone + lowerRung := by + intro inp W gen lower hpos hlt hmp + rw [corr.rungAgreement] at hlt + exact mctx.lowerRung lower hpos hlt hmp + fewerDividers := by + intro inp W gen other hround hmp bs' K' good' hdiv + apply mctx.fewerDividers other (hround.trans corr.rungAgreement) hmp bs' K' good' + exact hdiv.trans_eq hsame.2.1.symm + lexicographicMinimality := by + intro inp W gen other bs' Y' hround hcount + rw [measureEq] + exact mctx.lexicographicMinimality Y' (hround.trans corr.rungAgreement) + (hcount.trans hsame.2.1.symm) + largeMissingSet := by + dsimp only + rw [corrData.1, hmTn, corr.rungAgreement] + exact mctx.largeMissingSet } + have hCzero : C.hierarchy.dividerCount = 0 := P.sameGood.1.2.1.trans hz + have hCstar : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A := by + have hi : Fin.last C.hierarchy.dividerCount = 0 := Fin.ext (by simp [hCzero]) + rw [hi] + change base.core = A + exact P.sameGood.1.1.trans hA.symm + have htailC : HierarchyFullTailLength C = ell := by + change T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length = ell + rw [hCstar] + have noCommonSigma := + @helper_noCommonSigma_783 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C ctx P alpha hnoCommon hAT hBlen helem hay beta hne hvb hvbA + hvbB hi behavior missingB corr bs K hCstar htailC + let Package (inp : PartialEdgeColoring E k) + (L : ExtendedTashkinovTree G k e0 inp T sigma) : Prop := + MaximumProperty L ∧ ∃ bb : HierarchyBase L sigma, + ∃ Z : HierarchyCounterexample bb, + SameGoodHierarchy C.good Z.good ∧ + Nonempty (HierarchyMinimumCounterexampleContext G k e0 inp T sigma L bb Z) ∧ + beta ∈ TreeMissingColors sigma (L.series.data.tree (Fin.last L.rounds).castSucc) ∧ + beta ∈ TreeMissingColors sigma (HierarchyStarredStage Z.hierarchy (Fin.last + Z.hierarchy.dividerCount)) + have package : Package corr.replacementInput corr.replacementETT := by + refine ⟨hmaximum, bs, Y, sameC, ⟨ctxY⟩, ?_, ?_⟩ + · rw [corrData.1] + exact hbetaTn + · change beta ∈ TreeMissingColors sigma (HierarchyStarredStage K (Fin.last K.dividerCount)) + rw [starK, coreEq] + exact hbetaA + -- Compose provenance before presenting the new counterexample relative to the original ETT. + obtain ⟨composite, hi, hs, he⟩ := CorrespondingExtendedTashkinovTreeTrans G k e0 input + T phi mu sigma ett P.corresponding corr + have package' : Package composite.replacementInput composite.replacementETT := by + have transport {i j : PartialEdgeColoring E k} + (L : ExtendedTashkinovTree G k e0 i T sigma) + (M : ExtendedTashkinovTree G k e0 j T sigma) + (h : i = j) (hh : HEq L M) : Package i L = Package j M := by + cases h + have hLM : L = M := eq_of_heq hh + cases hLM + rfl + rw [transport _ _ hi he] + exact package + obtain ⟨mp', b', Z, same', ⟨ctx'⟩, hb', hbcore'⟩ := package' + let P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := by + exact { + coloring := sigma + corresponding := composite + maximum := mp' + replacementBase := b' + counterexample := Z + sameGood := same' + minimumContext := ctx' } + exact Or.inr ⟨P', beta, hb', hbcore', hbetay, noCommonSigma⟩ + +private theorem helper_continuation_1545.{u_1, u_2} : + helperContinuation1545Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha hzero hnoCommon mu F b X mctx H n + Tn A ell B y hz hp hA hAT hBlen hBT helem hyB haA hay D R beta hbR hne haRnot hbA vb hvb + hvbA hvbB hi Q sigma hsproper hsone behavior missingB hmA hmTn hmR hbetaA halphaA hbetaTn + hbetay corr hmaximum bs K hsame corrData + have hkzero : K.dividerCount = 0 := hsame.2.1.symm.trans hz + have coreEq : bs.core = A := hsame.1.symm.trans hA.symm + have closureEq : bs.closure = b.closure := (hsame.2.2.2.2.2 hp).symm + have starK (j : Fin (K.dividerCount + 1)) : HierarchyStarredStage K j = bs.core := by + have hj : j = 0 := Fin.ext (by have := j.isLt; omega) + rw [hj] + rfl + have termK (j : Fin (K.dividerCount + 1)) : K.stage j.succ = T := by + have hj : j.succ = Fin.last (K.dividerCount + 1) := Fin.ext (by have := j.isLt; simp; omega) + rw [hj, K.terminalStage] + have termH : H.stage (0 : Fin (H.dividerCount + 1)).succ = T := by + have hj : (0 : Fin (H.dividerCount + 1)).succ = Fin.last (H.dividerCount + 1) := Fin.ext (by + simp [hz]) + rw [hj, H.terminalStage] + have storedEq (j : Fin (K.dividerCount + 1)) : HierarchyStoredColorsAt K j = D := by + change TashkinovStoredColors corr.replacementETT.series.data (Fin.last + corr.replacementETT.rounds) \ + TreeMissingColors sigma (HierarchyStarredStage K j) = D + rw [corrData.2.2, starK j, coreEq, hmA] + change _ = TashkinovStoredColors F.series.data n \ TreeMissingColors mu b.core + rw [hA] + have stageMissingEq (j : Fin (K.dividerCount + 1)) : + HierarchyStageMissingColors K j = TreeMissingColors mu Tn := by + have hj : j = 0 := Fin.ext (by have := j.isLt; omega) + rw [hj] + change TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) = _ + rw [corrData.1, hmTn] + have unaffectedValue (f : E) (c : Fin k) (hcb : c ≠ beta) (hca : c ≠ alpha) : + sigma f = some c ↔ mu f = some c := by + by_cases hcomp : Sum.inr f ∈ Q + · by_cases hb : mu f = some beta + · simp [sigma, TwoColorComponentSwap, Q, hcomp, hb, hcb.symm, hca.symm] + · by_cases ha : mu f = some alpha + · simp [sigma, TwoColorComponentSwap, Q, hcomp, ha, hne.symm, hcb.symm, hca.symm] + · simp [sigma, TwoColorComponentSwap, Q, hcomp, hb, ha] + · simp [sigma, TwoColorComponentSwap, Q, hcomp] + have firstEq (eta : Fin k) (heb : eta ≠ beta) (hea : eta ≠ alpha) : + HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition mu T eta := by + have hcandidates : (Finset.univ.filter fun j : Fin (T.length + 1) => + eta ∈ MissingColors G sigma (T.vertex j)) = + (Finset.univ.filter fun j : Fin (T.length + 1) => eta ∈ MissingColors G mu (T.vertex j)) + := by + ext j + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact behavior.2.2.2 _ eta heb hea + simp only [HierarchyFirstMissingPosition, hcandidates] + -- A boundary witness survives even when its value is one of the swapped colors. + have notClosed := + @helper_notClosed_594 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha hp hA beta hbR haRnot hmA hbetaA halphaA + unaffectedValue + let gs : GoodHierarchy K := by + exact { + gamma := fun _ eta => X.good.gamma 0 eta + twoColors := by + intro j eta heta + exact X.good.twoColors 0 eta (by rwa [storedEq] at heta) + avoidance := by + intro j eta heta c hcg + have hetaD : eta ∈ D := by rwa [storedEq] at heta + have hold := X.good.avoidance 0 eta hetaD hcg + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · rw [stageMissingEq] + exact (Finset.mem_sdiff.mp hold).1 + · exact @helper_branch_909 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha hp hA haA beta hbR haRnot hbA corr bs K coreEq + starK termK termH unaffectedValue firstEq j eta heta c hcg hetaD hold + disjointPairs := by + intro j eta theta heta htheta hne' + exact X.good.disjointPairs 0 eta theta (by rwa [storedEq] at heta) + (by rwa [storedEq] at htheta) hne' + uniqueRefresh := by + intro i + have := i.isLt + omega + parallelBase := by + dsimp only + intro hpe' + constructor + · change ¬ TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt K 0).biUnion (X.good.gamma 0)) + rw [coreEq, storedEq] + exact notClosed + · change 4 ≤ ((TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ TreeMissingColors sigma bs.closure) \ + (HierarchyStoredColorsAt K 0).biUnion (X.good.gamma 0)).card + rw [corrData.1, closureEq, storedEq, hmTn, hmR] + exact (X.good.parallelBase hp).2 + minusClosed := by + intro i + have := i.isLt + omega } + have sameHX : SameGoodHierarchy X.good gs := by + refine ⟨hsame, hsame.2.1, ?_⟩ + intro j + have hj : j = 0 := Fin.ext (by + simp only [Fin.val_zero] + have hlt : j.val < H.dividerCount + 1 := j.isLt + simp only [hz] at hlt + omega) + subst j + exact ⟨(storedEq _).symm, fun _ _ => rfl⟩ + have sameC := + @helper_sameC_1124 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha hzero hp hA haA beta hbR haRnot hbA hmTn hmR corr bs K + hsame corrData hkzero coreEq closureEq starK termK termH storedEq stageMissingEq + unaffectedValue firstEq notClosed sameHX + have hvbT : vb ∈ TreeSequenceVertexSet T := TreeSequenceInitialSegmentVertexSetSubset hBT hvbB + have hyT : y ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last T.length, rfl⟩ + exact @helper_continuation_1585 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha hnoCommon hz hp hA hAT hBlen helem hyB haA hay beta + hbR hne haRnot hbA hvb hvbA hvbB hi hsproper hsone behavior missingB hmTn hmR hbetaA + hbetaTn hbetay corr hmaximum bs K hsame corrData hkzero coreEq closureEq starK termK termH + storedEq stageMissingEq unaffectedValue firstEq notClosed sameC hvbT hyT +private theorem helper_continuation_1486.{u_1, u_2} : + helperContinuation1486Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx _ P alpha hzero hstart hnotTerminalLadder + hnoCommon mu F b X mctx H n Tn A ell B y hz hp hA hAT hBlen hBT hAB helem hyB u hTnA hTnT + haA hay haTn haR D R beta hbTn hbR hne haRnot missingMono + have hbA := missingMono hTnA hbTn + have firstIn := @helper_firstIn_595 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C ctx P + let va := T.vertex (HierarchyFirstMissingPosition mu T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition mu T beta) + have hva := firstIn A hAT alpha haA + have hvb := firstIn Tn hTnT beta hbTn + have hvaB : va ∈ TreeSequenceVertexSet B := TreeSequenceInitialSegmentVertexSetSubset hAB hva.1 + have hvbA : vb ∈ TreeSequenceVertexSet A := TreeSequenceInitialSegmentVertexSetSubset hTnA hvb.1 + have hvbB : vb ∈ TreeSequenceVertexSet B := TreeSequenceInitialSegmentVertexSetSubset hAB hvbA + -- Coincident witnesses would make alpha missing on Tn, contrary to the hypothesis. + have hvab : va ≠ vb := by + intro h + exact haTn (Finset.mem_biUnion.mpr ⟨vb, hvb.1, h ▸ hva.2⟩) + have stableRefl (U : TreeSequence G e0) (D : Finset (Fin k)) : + StableColoring U D mu mu := ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ + have hi : TreeInterchangeable G A mu beta alpha := by + rw [hA] + exact (interchange G k e0 P.corresponding.replacementInput T mu mu F + X.maximum X.positive mctx.lowerRung hp b mctx.proper mctx.oneEdgeUncolored + ⟨stableRefl _ _, stableRefl _ _⟩ beta alpha).2.2.2 hbTn haR + let J := TwoColorIncidenceGraph G mu beta alpha + have selfMem (z : Sum V E) : z ∈ TwoColorComponent G mu beta alpha z := by + change J.connectedComponentMk z = J.connectedComponentMk z + rfl + have endpoint (v : V) (hm : beta ∈ MissingColors G mu v ∨ alpha ∈ MissingColors G mu v) : + Set.Subsingleton (J.neighborSet (Sum.inl v)) := by + exact @helper_endpoint_894 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx (by assumption) P alpha beta hne v hm + have pathMissing (v : V) (hm : beta ∈ MissingColors G mu v ∨ alpha ∈ MissingColors G mu v) : + TwoColorPathComponent G mu beta alpha (Sum.inl v) := + ⟨hne, Sum.inl v, selfMem _, endpoint v hm⟩ + have habComp : TwoColorComponent G mu beta alpha (Sum.inl va) = + TwoColorComponent G mu beta alpha (Sum.inl vb) := + hi _ _ (pathMissing va (Or.inr hva.2)) (pathMissing vb (Or.inl hvb.2)) + ⟨va, hva.1, selfMem _⟩ ⟨vb, hvbA, selfMem _⟩ + let Q := TwoColorComponent G mu beta alpha (Sum.inl y) + have hpath : TwoColorPathComponent G mu beta alpha (Sum.inl y) := + pathMissing y (Or.inr hay) + have hend := @helper_hend_920 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha beta hi + have hdisjoint := + @helper_hdisjoint_940 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx (by assumption) P alpha hyB hay beta hva hvb hvaB hvbB hvab + selfMem endpoint habComp hend + let sigma := TwoColorComponentSwap G mu beta alpha (Sum.inl y) + have control := P2813_T1_BaseControl G k e0 P.corresponding.replacementInput + T mu F b X mctx helem beta alpha hne + ⟨missingMono hAB hbA, missingMono hAB haA⟩ (Sum.inl y) hpath sigma rfl + (Or.inr ⟨hz, Or.inl hbTn⟩) hdisjoint + have hcombined : CombinedStableColoring Tn b.closure + (TashkinovStoredColors F.series.data n) mu sigma := by + have hp' : F.series.data.kind (Fin.last F.rounds) = some TashkinovExtensionKind.PE := hp + simpa only [hp', ite_eq_left, n, Tn] using control.1 + have hsproper : IsProperEdgeColoring G sigma := control.2.2.1 + have hsone : IsOneEdgeUncolored sigma e0 := control.2.2.2.1 + have behavior := TwoColorComponentSwapMissingBehavior G mu beta alpha hne mctx.proper (Sum.inl y) + have edgeOfVertex {v : V} {f : E} (hv : Sum.inl v ∈ Q) + (hinc : Incident G v f) (hc : mu f = some beta ∨ mu f = some alpha) : + Sum.inr f ∈ Q := by + have hadj : J.Adj (Sum.inr f) (Sum.inl v) := ⟨hinc, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv + have missingB := @helper_missingB_384 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C ctx P alpha hstart hnotTerminalLadder helem haA hay haTn haR + beta hbTn hbR hne haRnot hbA hva hvb hvaB hvbA hvbB hvab hi selfMem endpoint pathMissing + habComp hpath hend hdisjoint control hcombined hsproper hsone behavior edgeOfVertex + have treeMissingEq (U : TreeSequence G e0) (hm : ∀ v ∈ TreeSequenceVertexSet U, + MissingColors G sigma v = MissingColors G mu v) : + TreeMissingColors sigma U = TreeMissingColors mu U := + Finset.biUnion_congr rfl hm + have hmA : TreeMissingColors sigma A = TreeMissingColors mu A := + treeMissingEq A (fun v hv => missingB v (TreeSequenceInitialSegmentVertexSetSubset hAB hv)) + have hmTn : TreeMissingColors sigma Tn = TreeMissingColors mu Tn := treeMissingEq Tn hcombined.1.2 + have hmR : TreeMissingColors sigma b.closure = TreeMissingColors mu b.closure := treeMissingEq + _ hcombined.2.2 + have hbetaA : beta ∈ TreeMissingColors sigma A := hmA ▸ hbA + have halphaA : alpha ∈ TreeMissingColors sigma A := hmA ▸ haA + have hbetaTn : beta ∈ TreeMissingColors sigma Tn := hmTn ▸ hbTn + have hbetay : beta ∈ MissingColors G sigma y := behavior.2.2.1 y (selfMem _) hay + -- Extract the actual PE route; only its core part needs fixed displayed values. + have oldRoute := + @helper_oldRoute_743 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha hp hTnT beta hi + have oldCore := TashkinovAugmentationSequenceRestrict mu Tn A T oldRoute hTnA hAT + have oldSuffix := TashkinovAugmentationSequenceSuffix mu Tn A T oldRoute hTnA hAT + have displayed := CombinedStableClosurePreserved G k e0 P.corresponding.replacementInput + T mu mu sigma F X.positive b F.generatingColoring hp mctx.proper mctx.oneEdgeUncolored + hsproper hsone hcombined + have fixedA := @helper_fixedA_997 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha hA u hTnA beta displayed + have newCore := + @helper_newCore_790 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha hAB beta missingB oldCore fixedA + have newSuffix : TashkinovAugmentationSequence sigma A T := + TashkinovAugmentationSequenceComponentSwap G k e0 mu beta alpha hne (Sum.inl y) + A T oldSuffix hbetaA halphaA + have newRoute : TashkinovAugmentationSequence sigma Tn T := newCore.trans newSuffix + obtain ⟨corr, hmaximum, bs, K, hsame⟩ := HierarchySplitter G k e0 + P.corresponding.replacementInput T mu sigma F X.maximum X.positive mctx.lowerRung + b H hp mctx.proper mctx.oneEdgeUncolored hsproper hsone hcombined newRoute + have corrData := + @helper_corrData_823 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha beta hmTn corr hmaximum bs K hsame + exact @helper_continuation_1545 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha hzero hnoCommon hz hp hA hAT hBlen hBT helem hyB haA + hay beta hbR hne haRnot hbA hvb hvbA hvbB hi hsproper hsone behavior missingB hmA hmTn hmR + hbetaA halphaA hbetaTn hbetay corr hmaximum bs K hsame corrData +theorem HierarchyClaimNinePENormalization {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (_ : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha : Fin k) + (hzero : P.counterexample.hierarchy.dividerCount = 0) + (hpe : P.corresponding.replacementETT.series.data.kind + (Fin.last P.corresponding.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hstart : + let H := P.counterexample.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + alpha ∈ TreeMissingColors P.coloring A ∧ + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length))) + (hnotTerminalLadder : + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + alpha ∉ TreeMissingColors P.coloring Tn) + (hnoCommon : ∀ i ∈ Finset.Icc 1 (HierarchyFullTailLength C - 1), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty ∨ + ∃ P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + ∃ beta : Fin k, + let ett' := P'.corresponding.replacementETT + let n' : Fin (ett'.rounds + 1) := Fin.last ett'.rounds + let Tn' := ett'.series.data.tree n'.castSucc + let H' := P'.counterexample.hierarchy + let A' := HierarchyStarredStage H' (Fin.last H'.dividerCount) + beta ∈ TreeMissingColors P'.coloring Tn' ∧ + beta ∈ TreeMissingColors P'.coloring A' ∧ + beta ∈ MissingColors G P'.coloring (T.vertex (Fin.last T.length)) ∧ + ∀ i ∈ Finset.Icc 1 (HierarchyFullTailLength C - 1), + Disjoint + (MissingColors G P'.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P'.coloring (T.vertex (Fin.last T.length))) := by + classical + let mu := P.coloring + let F := P.corresponding.replacementETT + let b := P.replacementBase + let X := P.counterexample + let mctx := P.minimumContext + let H := X.hierarchy + let n : Fin (F.rounds + 1) := Fin.last F.rounds + let Tn := F.series.data.tree n.castSucc + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let B := TreeSequencePrefix T (min (A.length + (ell - 1)) T.length) + (by have := A.positive; have := T.positive; omega) (Nat.min_le_right _ _) + let y := T.vertex (Fin.last T.length) + have hz : H.dividerCount = 0 := hzero + have hp : F.series.data.kind n = some TashkinovExtensionKind.PE := hpe + have hA : A = b.core := by + have hi : Fin.last H.dividerCount = 0 := Fin.ext (by simp [hz]) + dsimp only [A] + rw [hi] + rfl + have hAT : TreeSequenceInitialSegment A T := by + have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp [hz]) + simpa only [hA, hi, H.terminalStage] using H.coreInsideFirst + have htwo : 2 ≤ ell := + HierarchyCounterexampleTailAtLeastTwo G k e0 P.corresponding.replacementInput + T mu F b X mctx.proper mctx.oneEdgeUncolored mctx.lowerRung + mctx.fewerDividers mctx.lexicographicMinimality mctx.largeMissingSet + have hBlen : B.length = T.length - 1 := by + change min (A.length + (ell - 1)) T.length = T.length - 1 + dsimp only [ell] at htwo ⊢ + have := hAT.1 + omega + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hAB : TreeSequenceInitialSegment A B := by + have hlen : A.length ≤ B.length := by rw [hBlen]; dsimp [ell] at htwo; omega + exact ⟨hlen, fun i => hAT.2.1 i, fun i => hAT.2.2 i⟩ + have helem : ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) := + HierarchyCounterexamplePenultimateElementary G k e0 + P.corresponding.replacementInput T mu F b X mctx.proper + mctx.oneEdgeUncolored mctx.lowerRung mctx.fewerDividers + mctx.lexicographicMinimality mctx.largeMissingSet + have hyB : y ∉ TreeSequenceVertexSet B := by + intro hy + obtain ⟨i, hi⟩ : ∃ i, B.vertex i = y := by + simpa [TreeSequenceVertexSet] using hy + have hv := T.vertex_injective ((hBT.2.1 i).trans hi) + have hval := congrArg Fin.val hv + have := i.isLt + simp only [Fin.val_castLE, Fin.val_last] at hval + omega + obtain ⟨u⟩ := (b.parallel hp).2.2 + have hTnA : TreeSequenceInitialSegment Tn A := by simpa only [hA] using u.leftSegment + have hTnT : TreeSequenceInitialSegment Tn T := by + refine ⟨hTnA.1.trans hAT.1, ?_, ?_⟩ + · intro i + exact (hAT.2.1 (Fin.castLE (Nat.succ_le_succ hTnA.1) i)).trans (hTnA.2.1 i) + · intro i + exact (hAT.2.2 (Fin.castLE hTnA.1 i)).trans (hTnA.2.2 i) + have haA : alpha ∈ TreeMissingColors mu A := hstart.1 + have hay : alpha ∈ MissingColors G mu y := hstart.2 + have haTn : alpha ∉ TreeMissingColors mu Tn := hnotTerminalLadder + have haR : alpha ∈ TreeMissingColors mu b.closure := by + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp haA + rw [hA, u.vertexSet] at hv + rcases Finset.mem_union.mp hv with hv | hv + · exact (haTn (Finset.mem_biUnion.mpr ⟨v, hv, hc⟩)).elim + · exact Finset.mem_biUnion.mpr ⟨v, hv, hc⟩ + -- The sole Gamma union is smaller than the terminal missing-color set. + let D := HierarchyStoredColorsAt H 0 + let R := D.biUnion (X.good.gamma 0) + have hRcard : R.card ≤ 2 * F.rounds := by + calc + R.card ≤ ∑ c ∈ D, (X.good.gamma 0 c).card := Finset.card_biUnion_le + _ = 2 * D.card := by + rw [Finset.sum_congr rfl (fun c hc => X.good.twoColors 0 c hc)] + simp [D, H, Nat.mul_comm] + _ ≤ 2 * F.rounds := Nat.mul_le_mul_left 2 (HierarchyStoredColorsCardinality H 0) + obtain ⟨beta, hbTn, hbR⟩ : ∃ beta, beta ∈ TreeMissingColors mu Tn ∧ beta ∉ R := by + by_contra hnone + have hsub : TreeMissingColors mu Tn ⊆ R := by + intro c hc + by_contra hn + exact hnone ⟨c, hc, hn⟩ + have hc := Finset.card_le_card hsub + have hl : 2 * F.rounds + 11 ≤ (TreeMissingColors mu Tn).card := mctx.largeMissingSet + omega + have hne : beta ≠ alpha := by intro heq; subst beta; exact haTn hbTn + have haRnot : alpha ∉ R := by + intro hc + obtain ⟨eta, heta, hc⟩ := Finset.mem_biUnion.mp hc + have hm := (Finset.mem_sdiff.mp (X.good.avoidance 0 eta heta hc)).1 + exact haTn hm + have missingMono {U W : TreeSequence G e0} + (hUW : TreeSequenceInitialSegment U W) {c : Fin k} + (hc : c ∈ TreeMissingColors mu U) : c ∈ TreeMissingColors mu W := by + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hUW hv, hvc⟩ + exact @helper_continuation_1486 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx (by assumption) P alpha hzero hstart hnotTerminalLadder + hnoCommon hz hp hA hAT hBlen hBT hAB helem hyB u hTnA hTnT haA hay haTn haR beta hbTn hbR + hne haRnot missingMono +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNineUnusedTailColor.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNineUnusedTailColor.lean new file mode 100644 index 0000000000..bef1156db6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNineUnusedTailColor.lean @@ -0,0 +1,999 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans +public import LeanPool.GoldbergSeymour.HierarchyClaimNinePENormalization +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.BaseControl +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# Hierarchy Claim Nine Unused Tail Color + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hmissingB_355.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); ColoredVertexSetElementary G mu + (TreeSequenceVertexSet B) → + ∀ (hBlen : B.length = T.length - (1 : ℕ)) (hBT : TreeSequenceInitialSegment B T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨B.length, + by have this : B.length ≤ T.length := hBT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let yp : V := T.vertex ip; yp ∈ TreeSequenceVertexSet B → + ∀ beta ∈ MissingColors G mu yp, alpha ≠ beta → + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let a : V := T.vertex ia; alpha ∈ MissingColors G mu a → a ∈ TreeSequenceVertexSet B → + TwoColorComponent G mu alpha beta (Sum.inl a) = TwoColorComponent G mu alpha beta (Sum.inl + yp) → + let Q : Set (V ⊕ E) := TwoColorComponent G mu alpha beta (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G mu alpha beta (Sum.inl v)) → Disjoint Q + (TwoColorComponent G mu alpha beta (Sum.inl a)) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G mu alpha beta (Sum.inl y) → MissingColors G + (TwoColorComponentSwap G mu alpha beta (Sum.inl y)) v = MissingColors G mu v) → ( + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G (TwoColorComponentSwap G mu + alpha beta (Sum.inl y)) v ↔ c ∈ MissingColors G mu v)) → ( + ∀ {v : V} {f : E}, Sum.inl v ∈ Q → Incident G v f → mu f = some alpha ∨ mu f = some beta → + Sum.inr f ∈ Q) → + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu Cm ell B y helem hBlen hBT ip yp + hypB beta hbeta hne ia a ha haB hsame Q self hdisjoint sigma missingOutside missingOther + edgeOfVertex v hv + by_cases hvQ : Sum.inl v ∈ Q + · have hva : v ≠ a := by + intro he + subst v + exact Set.disjoint_left.mp hdisjoint hvQ (self a) + have hvb : v ≠ yp := by + intro he + subst v + apply Set.disjoint_left.mp hdisjoint hvQ + rw [hsame] + exact self yp + have hna : alpha ∉ MissingColors G mu v := fun hm => + Finset.disjoint_left.mp (helem hv haB hva) hm ha + have hnb : beta ∉ MissingColors G mu v := fun hm => + Finset.disjoint_left.mp (helem hv hypB hvb) hm hbeta + obtain ⟨fa, hfa, hfca⟩ : ∃ f, Incident G v f ∧ mu f = some alpha := by + simpa [MissingColors, PresentColors] using hna + obtain ⟨fb, hfb, hfcb⟩ : ∃ f, Incident G v f ∧ mu f = some beta := by + simpa [MissingColors, PresentColors] using hnb + have hfaQ := edgeOfVertex hvQ hfa (Or.inl hfca) + have hfbQ := edgeOfVertex hvQ hfb (Or.inr hfcb) + simp only [Q] at hfaQ hfbQ + have hnewa : sigma fb = some alpha := by + simp [sigma, TwoColorComponentSwap, hfbQ, hfcb, hne.symm] + have hnewb : sigma fa = some beta := by + simp [sigma, TwoColorComponentSwap, hfaQ, hfca] + have hnsa : alpha ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, not_not] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fb, hfb, hnewa⟩ + have hnsb : beta ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, not_not] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fa, hfa, hnewb⟩ + ext c + by_cases hca : c = alpha + · subst c; simp only [hna, hnsa] + by_cases hcb : c = beta + · subst c; simp only [hnb, hnsb] + exact missingOther v c hca hcb + · exact missingOutside v hvQ + +private theorem helper_htail_457.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some alpha) → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); (2 : ℕ) ≤ ell → ColoredVertexSetElementary G mu + (TreeSequenceVertexSet B) → A.length + ell = T.length → + ∀ (hBlen : B.length = T.length - (1 : ℕ)) (hBT : TreeSequenceInitialSegment B T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨B.length, + by have this : B.length ≤ T.length := hBT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let yp : V := T.vertex ip; B.vertex (Fin.last B.length) = yp → + ∀ beta ∈ MissingColors G mu yp, alpha ≠ beta → ( + let H : TashkinovHierarchy em bm := Cm.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors em.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition mu T alpha); + have vb : V := T.vertex (HierarchyFirstMissingPosition mu T beta); + have sameComponent : Prop := TwoColorComponent G mu alpha beta (Sum.inl va) = + TwoColorComponent G mu alpha beta (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (alpha ∈ + TreeMissingColors mu Tnq ∨ Disjoint { alpha, beta } Dnq) → sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors mu Tn ∨ Disjoint { alpha, beta } + Dn) → sameComponent) ∧ (alpha ∈ TreeMissingColors mu A ∧ TreeColorSetClosed G mu A + { alpha } → sameComponent ∧ TreeInterchangeable G A mu alpha beta)) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); (0 : + ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors mu (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + mu (em.series.data.tree (Fin.last em.rounds).castSucc) ∨ alpha ∈ TreeMissingColors mu A ∧ + alpha ∉ TashkinovStoredColors em.series.data (Fin.last em.rounds) ∧ beta ∉ + TashkinovStoredColors em.series.data (Fin.last em.rounds)) → (if em.series.data.kind + (Fin.last em.rounds) = some TashkinovExtensionKind.PE then CombinedStableColoring + (em.series.data.tree (Fin.last em.rounds).castSucc) bm.closure (TashkinovStoredColors + em.series.data (Fin.last em.rounds)) mu sigma else StableColoring (em.series.data.tree + (Fin.last em.rounds).castSucc) (TashkinovStoredColors em.series.data (Fin.last em.rounds)) + mu sigma) → ( + ∀ (f : E), TashkinovSeriesStep G k em.rounds e0 P.corresponding.replacementInput + em.series.data (Fin.last em.rounds) → em.series.data.kind (Fin.last em.rounds) = some + TashkinovExtensionKind.SE ∨ em.series.data.kind (Fin.last em.rounds) = some + TashkinovExtensionKind.RE → em.series.data.connectingEdges (Fin.last em.rounds) = { f } → + TreeIncidentEdge (em.series.data.tree (Fin.last em.rounds).castSucc) f) → ( + ∀ (t : Fin T.length), (↑t : ℕ) = B.length → Incident G yp (T.edge t)) → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → sigma (T.edge t) = mu (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha hunused mu em bm Cm H q A ell B y + htwo helem hsum hBlen hBT ip yp hyp beta hbeta hne changeResult sigma hcase hbaseStable + seedIncident hlastEnds t ht + have hna : mu (T.edge t) ≠ some alpha := hunused t ht + by_cases hb : mu (T.edge t) = some beta + · by_cases htB : t.val < B.length + · let tB : Fin B.length := ⟨t.val, htB⟩ + have hcast : Fin.castLE hBT.1 tB = t := Fin.ext rfl + have heB : mu (B.edge tB) = some beta := by + rw [← hBT.2.2 tB, hcast] + exact hb + obtain ⟨hzero, hcore, hpos, f, hstep, hkind, hedges, hedge, hcolor, hstored⟩ := + HierarchyTailMissingColorExclusion G k e0 P.corresponding.replacementInput T mu em bm H + helem (ell - 1) (by omega) (by change ell - 1 < ell; omega) + beta (hyp.symm ▸ hbeta) tB ht + (by change t.val < A.length + (ell - 1); omega) heB + have hnotPE : em.series.data.kind (Fin.last em.rounds) ≠ + some TashkinovExtensionKind.PE := by + rcases hkind with hs | hr + · rw [hs]; simp + · rw [hr]; simp + have hstable : StableColoring (em.series.data.tree (Fin.last em.rounds).castSucc) + (TashkinovStoredColors em.series.data (Fin.last em.rounds)) mu sigma := by + simpa only [ite_eq_right hnotPE] using hbaseStable + have hf := hstable.1 f (seedIncident f hstep hkind hedges) + ⟨beta, Finset.mem_union_right _ hstored, hcolor⟩ + have he : T.edge t = f := by rw [← hcast, hBT.2.2 tB]; exact hedge + simpa only [he] using hf + · have hlast : t.val = B.length := by have := t.isLt; omega + have hinc := hlastEnds t hlast + have hnot : beta ∉ PresentColors G mu yp := by simpa [MissingColors] using hbeta + exact (hnot (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨T.edge t, hinc, hb⟩)).elim + · simp [sigma, TwoColorComponentSwap, hna, hb] + +private theorem helper_hdisjoint_511.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ (hBlen : B.length = T.length - (1 : ℕ)) (hBT : TreeSequenceInitialSegment B T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨B.length, + by have this : B.length ≤ T.length := hBT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let yp : V := T.vertex ip; + ∀ beta ∈ MissingColors G mu yp, alpha ∈ MissingColors G mu y → + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let a : V := T.vertex ia; alpha ∈ MissingColors G mu a → a ≠ yp → TwoColorComponent G mu alpha + beta (Sum.inl a) = TwoColorComponent G mu alpha beta (Sum.inl yp) → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu alpha beta; + let Q : Set (V ⊕ E) := TwoColorComponent G mu alpha beta (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G mu alpha beta (Sum.inl v)) → ( + ∀ (v : V), alpha ∈ MissingColors G mu v ∨ beta ∈ MissingColors G mu v → (J.neighborSet + (Sum.inl v)).Subsingleton) → a ≠ y → yp ≠ y → Disjoint Q (TwoColorComponent G mu alpha + beta (Sum.inl a)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu Cm cm ell B y hBlen hBT ip yp + beta hbeta haY ia a ha hab hsame J Q self leaf hay hypy + rcases TwoColorComponentsDisjoint G mu alpha beta (Sum.inl y) (Sum.inl a) with heq | hd + · obtain ⟨u, v, path, hp, hs⟩ := + TwoColorComponentSpanningPath G mu alpha beta cm.proper (Sum.inl y) + have endpoint (w : V) (hw : Sum.inl w ∈ Q) + (hl : Set.Subsingleton (J.neighborSet (Sum.inl w))) : + Sum.inl w = u ∨ Sum.inl w = v := by + have hm : Sum.inl w ∈ path.support := by + change Sum.inl w ∈ {x | x ∈ path.support} + rw [hs] + exact hw + by_contra hn + push Not at hn + exact hp.isTrail.notMem_support_of_subsingleton_neighborSet hn.1 hn.2 hl hm + change Q = TwoColorComponent G mu alpha beta (Sum.inl a) at heq + have haQ : Sum.inl a ∈ Q := by rw [heq]; exact self a + have hbQ : Sum.inl yp ∈ Q := by rw [heq, hsame]; exact self yp + have hae := endpoint a haQ (leaf a (Or.inl ha)) + have hbe := endpoint yp hbQ (leaf yp (Or.inr hbeta)) + have hye := endpoint y (self y) (leaf y (Or.inl haY)) + have hnab : (Sum.inl a : Sum V E) ≠ Sum.inl yp := fun h => hab (Sum.inl.inj h) + have hnay : (Sum.inl a : Sum V E) ≠ Sum.inl y := fun h => hay (Sum.inl.inj h) + have hnby : (Sum.inl yp : Sum V E) ≠ Sum.inl y := fun h => hypy (Sum.inl.inj h) + rcases hae with hae | hae <;> rcases hbe with hbe | hbe <;> + rcases hye with hye | hye <;> simp_all + · exact hd + +private theorem helper_seedIncident_571.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (f : E), TashkinovSeriesStep G k em.rounds e0 P.corresponding.replacementInput + em.series.data (Fin.last em.rounds) → em.series.data.kind (Fin.last em.rounds) = some + TashkinovExtensionKind.SE ∨ em.series.data.kind (Fin.last em.rounds) = some + TashkinovExtensionKind.RE → em.series.data.connectingEdges (Fin.last em.rounds) = { f } → + TreeIncidentEdge (em.series.data.tree (Fin.last em.rounds).castSucc) f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P em f hstep hkind hedges + generalize hn : Fin.last em.rounds = j at hstep hkind hedges ⊢ + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + rw [initialKind] at hkind + simp at hkind + | SE r previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have he : choice.edge = f := Finset.singleton_injective (currentEdges.symm.trans hedges) + rw [← he] + exact ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + | PE r previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + rw [currentKind] at hkind + simp at hkind + | RE r previousProper previousOneUncolored previousClosed previousNotStronglyClosed + available currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have he : available.edge = f := Finset.singleton_injective (currentEdges.symm.trans hedges) + rw [← he] + refine ⟨available.insideEndpoint, available.insideInCurrent, ?_⟩ + simp only [Incident, available.edgeEnds, Sym2.mem_iff, true_or] + +private theorem helper_hstoredFirst_629.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); ColoredVertexSetElementary G mu + (TreeSequenceVertexSet B) → + ∀ (hBlen : B.length = T.length - (1 : ℕ)) (hBT : TreeSequenceInitialSegment B T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨B.length, + by have this : B.length ≤ T.length := hBT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let yp : V := T.vertex ip; yp ∈ TreeSequenceVertexSet B → + ∀ beta ∈ MissingColors G mu yp, alpha ∈ TreeMissingColors mu A → ( + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G rho (T.vertex i) → c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ HierarchyFirstMissingPosition rho T c ≤ i) → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T beta; ib = ip → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); ( + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G (TwoColorComponentSwap G mu + alpha beta (Sum.inl y)) v ↔ c ∈ MissingColors G mu v)) → ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v) → + ∀ eta ∈ HierarchyStoredColorsAt H q, HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition mu T eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu Cm H q A ell B y helem hBlen hBT + ip yp hypB beta hbeta haA firstSpec ib hib sigma missingOther hmissingB eta heta + have hnotA : eta ∉ TreeMissingColors mu A := (Finset.mem_sdiff.mp heta).2 + have hna : eta ≠ alpha := by intro he; exact hnotA (he.symm ▸ haA) + by_cases heb : eta = beta + · subst eta + have hbnew : beta ∈ MissingColors G sigma yp := by rw [hmissingB yp hypB]; exact hbeta + have hs := firstSpec sigma beta ip hbnew + let is := HierarchyFirstMissingPosition sigma T beta + have hbound : is.val ≤ B.length := hs.2 + let j : Fin (B.length + 1) := ⟨is.val, by omega⟩ + have hj : Fin.castLE (Nat.succ_le_succ hBT.1) j = is := Fin.ext rfl + have hvB : T.vertex is ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, (hBT.2.1 j).symm.trans (congrArg T.vertex hj)⟩ + have hbOld : beta ∈ MissingColors G mu (T.vertex is) := by + rw [← hmissingB _ hvB] + exact hs.1 + have hv : T.vertex is = yp := by + by_contra hn + exact Finset.disjoint_left.mp (helem hvB hypB hn) hbOld hbeta + exact (T.vertex_injective hv).trans hib.symm + · have heq : (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G sigma (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G mu (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact missingOther _ eta hna heb + simp only [HierarchyFirstMissingPosition, heq] + +private theorem helper_leaf_681.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + ∀ (beta : Fin k), alpha ≠ beta → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G mu alpha beta; + ∀ (v : V), alpha ∈ MissingColors G mu v ∨ beta ∈ MissingColors G mu v → (J.neighborSet + (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu cm beta hne J v hv + have hd : @SimpleGraph.degree _ J (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hv with hv | hv + · exact MissingColorIncidenceEndpoint G mu alpha beta hne cm.proper v hv + · have hj : J = TwoColorIncidenceGraph G mu beta alpha := by + ext x z + cases x <;> cases z <;> simp [J, TwoColorIncidenceGraph, or_comm] + rw [hj] + exact MissingColorIncidenceEndpoint G mu beta alpha hne.symm cm.proper v hv + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx z hz + exact Finset.card_le_one_iff.mp hd + (by simpa only [SimpleGraph.mem_neighborFinset, SimpleGraph.mem_neighborSet] using hx) + (by simpa only [SimpleGraph.mem_neighborFinset, SimpleGraph.mem_neighborSet] using hz) + +private theorem helper_hlastEnds_743.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); (2 : ℕ) ≤ ell → + A.length + ell = T.length → + ∀ (hBlen : B.length = T.length - (1 : ℕ)) (hBT : TreeSequenceInitialSegment B T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨B.length, + by have this : B.length ≤ T.length := hBT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let yp : V := T.vertex ip; + ∀ (beta : Fin k), alpha ≠ beta → ( + let H : TashkinovHierarchy em bm := Cm.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors em.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition mu T alpha); + have vb : V := T.vertex (HierarchyFirstMissingPosition mu T beta); + have sameComponent : Prop := TwoColorComponent G mu alpha beta (Sum.inl va) = + TwoColorComponent G mu alpha beta (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (alpha ∈ + TreeMissingColors mu Tnq ∨ Disjoint { alpha, beta } Dnq) → sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors mu Tn ∨ Disjoint { alpha, beta } + Dn) → sameComponent) ∧ (alpha ∈ TreeMissingColors mu A ∧ TreeColorSetClosed G mu A + { alpha } → sameComponent ∧ TreeInterchangeable G A mu alpha beta)) → (0 : ℕ) < + H.dividerCount ∧ alpha ∈ TreeMissingColors mu (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + mu (em.series.data.tree (Fin.last em.rounds).castSucc) ∨ alpha ∈ TreeMissingColors mu A ∧ + alpha ∉ TashkinovStoredColors em.series.data (Fin.last em.rounds) ∧ beta ∉ + TashkinovStoredColors em.series.data (Fin.last em.rounds)) → + ∀ (t : Fin T.length), (↑t : ℕ) = B.length → Incident G yp (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha mu em bm Cm H q A ell B + htwo hsum hBlen hBT ip yp beta hne changeResult hcase + let candidates := (Finset.Icc 1 ell).filter fun i => + ∀ r : Fin T.length, A.length + i ≤ r.val → + G.ends (T.edge r) = Sym2.mk (T.vertex r.castSucc) (T.vertex r.succ) + have hpathNumber : (if hc : candidates.Nonempty then candidates.min' hc else ell) = 1 := + hsituation + have hc : candidates.Nonempty := by + by_contra hc + rw [dite_eq_right hc] at hpathNumber + omega + have hmin : candidates.min' hc = 1 := by simpa only [dite_eq_left hc] using hpathNumber + have hmem : 1 ∈ candidates := hmin ▸ Finset.min'_mem candidates hc + have hconsecutive := (Finset.mem_filter.mp hmem).2 + intro t ht + have hends := hconsecutive t (by omega) + have hi : t.castSucc = ip := Fin.ext ht + unfold Incident + rw [hends, hi] + exact Sym2.mem_mk_left _ _ + +private theorem helper_continuation_770.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some alpha) → + let mu : PartialEdgeColoring E k := P.coloring; + let em : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let bm : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); HierarchyFullTailLength C = ell → ( + ∀ (i : ℕ), HierarchyFullTailPrefix C i = HierarchyFullTailPrefix Cm i) → (2 : ℕ) ≤ ell → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → A.length + ell = T.length → + ∀ (hBlen : B.length = T.length - (1 : ℕ)) (hBT : TreeSequenceInitialSegment B T), + let ip : Fin (T.length + (1 : ℕ)) := (⟨B.length, + by have this : B.length ≤ T.length := hBT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let yp : V := T.vertex ip; B.vertex (Fin.last B.length) = yp → yp ∈ TreeSequenceVertexSet B → + ell - (1 : ℕ) ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength C - (1 : ℕ)) → + ∀ beta ∈ MissingColors G mu yp, alpha ∈ TreeMissingColors mu A → alpha ∈ MissingColors G mu y + → alpha ≠ beta → ( + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G rho (T.vertex i) → c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ HierarchyFirstMissingPosition rho T c ≤ i) → + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T beta; + let a : V := T.vertex ia; ib = ip → alpha ∈ TreeMissingColors mu B ∧ beta ∈ TreeMissingColors + mu B → ( + let H : TashkinovHierarchy em bm := Cm.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (em.rounds + (1 : ℕ)) := Fin.last em.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := em.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors em.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition mu T alpha); + have vb : V := T.vertex (HierarchyFirstMissingPosition mu T beta); + have sameComponent : Prop := TwoColorComponent G mu alpha beta (Sum.inl va) = + TwoColorComponent G mu alpha beta (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (alpha ∈ + TreeMissingColors mu Tnq ∨ Disjoint { alpha, beta } Dnq) → sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors mu Tn ∨ Disjoint { alpha, beta } + Dn) → sameComponent) ∧ (alpha ∈ TreeMissingColors mu A ∧ TreeColorSetClosed G mu A + { alpha } → sameComponent ∧ TreeInterchangeable G A mu alpha beta)) → + let Q : Set (V ⊕ E) := TwoColorComponent G mu alpha beta (Sum.inl y); ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G mu alpha beta (Sum.inl v)) → yp ≠ y → Disjoint Q + (TwoColorComponent G mu alpha beta (Sum.inl a)) → TwoColorPathComponent G mu alpha beta + (Sum.inl y) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu alpha beta (Sum.inl y); (0 : + ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors mu (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + mu (em.series.data.tree (Fin.last em.rounds).castSucc) ∨ alpha ∈ TreeMissingColors mu A ∧ + alpha ∉ TashkinovStoredColors em.series.data (Fin.last em.rounds) ∧ beta ∉ + TashkinovStoredColors em.series.data (Fin.last em.rounds)) → (if em.series.data.kind + (Fin.last em.rounds) = some TashkinovExtensionKind.PE then CombinedStableColoring + (em.series.data.tree (Fin.last em.rounds).castSucc) bm.closure (TashkinovStoredColors + em.series.data (Fin.last em.rounds)) mu sigma else StableColoring (em.series.data.tree + (Fin.last em.rounds).castSucc) (TashkinovStoredColors em.series.data (Fin.last em.rounds)) + mu sigma) → ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G mu alpha beta (Sum.inl y) → alpha ∈ MissingColors G + mu v → beta ∈ MissingColors G (TwoColorComponentSwap G mu alpha beta (Sum.inl y)) v) → ( + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G (TwoColorComponentSwap G mu + alpha beta (Sum.inl y)) v ↔ c ∈ MissingColors G mu v)) → ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G mu v) → + HierarchyFullTailLength C - (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T + phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha hunused mu em bm Cm cm H + q A ell B y hell hprefix htwo helem hsum hBlen hBT ip yp hyp hypB hinterval beta hbeta haA + haY hne firstSpec ia ib a hib hmissing changeResult Q self hypy hdisjoint hpath sigma hcase + hbaseStable missingAlphaToBeta missingOther hmissingB + have hbetaNewY : beta ∈ MissingColors G sigma y := + missingAlphaToBeta y (self y) haY + -- Recover incidence of the individual stored seed from its certified step. + have seedIncident := @helper_seedIncident_571 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C ctx P + have hlastEnds := + @helper_hlastEnds_743 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P hsituation alpha htwo hsum hBlen hBT beta hne + changeResult hcase + have htail := + @helper_htail_457 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha hunused htwo helem hsum hBlen hBT hyp beta hbeta hne + changeResult hcase hbaseStable seedIncident hlastEnds + -- Stored colors other than beta are unaffected; beta's first vertex remains yp. + have hstoredFirst := + @helper_hstoredFirst_629 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C ctx P alpha helem hBlen hBT hypB beta hbeta haA firstSpec hib + missingOther hmissingB + -- Reconstruct only after the exact tail and first-position agreements hold. + obtain ⟨_, _, _, _, corr, hmax, bs, K, good, same⟩ := + StableChangeCasesOneTwoFullTail G k e0 P.corresponding.replacementInput T mu em bm Cm cm + alpha beta hne hmissing (Sum.inl y) hpath sigma rfl hcase hdisjoint htail hmissingB + hstoredFirst + have hypT : yp ∈ TreeSequenceVertexSet T := TreeSequenceInitialSegmentVertexSetSubset hBT hypB + have hyT : y ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last T.length, rfl⟩ + let Cs : HierarchyCounterexample bs := { + positive := by rw [corr.rungAgreement]; exact Cm.positive + hierarchy := K + good := good + maximum := hmax + notElementary := by + intro he + have hbnew : beta ∈ MissingColors G sigma yp := by rw [hmissingB yp hypB]; exact hbeta + exact Finset.disjoint_left.mp (he hypT hyT hypy) hbnew hbetaNewY } + -- This registered composition also transports all six minimum-context fields. + obtain ⟨Pnew, hPnew⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi ett base C ctx + P sigma corr bs Cs same + apply Finset.mem_filter.mpr + refine ⟨?_, Pnew, beta, ?_, ?_⟩ + · simpa only [hell] using hinterval + · rw [hPnew, hell, hprefix, hyp, hmissingB yp hypB] + exact hbeta + · rw [hPnew] + exact hbetaNewY + +private theorem helper_continuation_739.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber + P.counterexample.hierarchy = (1 : ℕ) → + ∀ (alpha : Fin k), ( + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let _ : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; (0 : + ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors P.coloring Tnq ∨ H.dividerCount = (0 : ℕ) + ∧ alpha ∈ TreeMissingColors P.coloring Tn) → ( + let A : TreeSequence G e0 := HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some alpha) → + let mu : PartialEdgeColoring E k := P.coloring; + let _ : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let _ : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let Cm : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample := + P.minimumContext; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := Cm.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength Cm; + let B : TreeSequence G e0 := HierarchyFullTailPrefix Cm (ell - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); HierarchyFullTailLength C = ell → ( + ∀ (i : ℕ), HierarchyFullTailPrefix C i = HierarchyFullTailPrefix Cm i) → (2 : ℕ) ≤ ell → + ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) → + ∀ (hAT : TreeSequenceInitialSegment A T), A.length + ell = T.length → + ∀ (hBlen : B.length = T.length - (1 : ℕ)) (hBT : TreeSequenceInitialSegment B T), + TreeSequenceInitialSegment A B → + let ip : Fin (T.length + (1 : ℕ)) := (⟨B.length, + by have this : B.length ≤ T.length := hBT.1; omega + ⟩ : Fin (T.length + (1 : ℕ))); + let yp : V := T.vertex ip; B.vertex (Fin.last B.length) = yp → yp ∈ TreeSequenceVertexSet B → + y ∉ TreeSequenceVertexSet B → ell - (1 : ℕ) ∈ Finset.Icc (1 : ℕ) (HierarchyFullTailLength + C - (1 : ℕ)) → + ∀ beta ∈ MissingColors G mu yp, alpha ∈ TreeMissingColors mu A → alpha ∈ MissingColors G mu y + → alpha ≠ beta → ( + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G rho (T.vertex i) → c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ HierarchyFirstMissingPosition rho T c ≤ i) → + ∀ (iaA : Fin (A.length + (1 : ℕ))), + let iaT : Fin T.length.succ := Fin.castLE (Nat.succ_le_succ hAT.1) iaA; alpha ∈ MissingColors + G mu (T.vertex iaT) → + let _ : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T alpha; + let _ : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition mu T beta; + HierarchyFullTailLength C - (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T + phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation alpha hnormalized hunused mu + em bm Cm cm H q A ell B y hell hprefix htwo helem hAT hsum hBlen hBT hAB ip yp hyp hypB + hyNotB hinterval beta hbeta haA haY hne firstSpec iaA iaT haia ia ib + let a := T.vertex ia + have ha : alpha ∈ MissingColors G mu a := (firstSpec mu alpha iaT haia).1 + have hia : ia.val ≤ A.length := by + have hm := (firstSpec mu alpha iaT haia).2 + change ia.val ≤ iaA.val at hm + have := iaA.isLt + omega + have hib : ib = ip := by + have hs := firstSpec mu beta ip hbeta + have hbound : ib.val ≤ B.length := hs.2 + let j : Fin (B.length + 1) := ⟨ib.val, by omega⟩ + have hj : Fin.castLE (Nat.succ_le_succ hBT.1) j = ib := Fin.ext rfl + have hbB : T.vertex ib ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, (hBT.2.1 j).symm.trans (congrArg T.vertex hj)⟩ + have hv : T.vertex ib = yp := by + by_contra hn + exact Finset.disjoint_left.mp (helem hbB hypB hn) hs.1 hbeta + exact T.vertex_injective hv + have haB : a ∈ TreeSequenceVertexSet B := by + let j : Fin (A.length + 1) := ⟨ia.val, by omega⟩ + have hj : Fin.castLE (Nat.succ_le_succ hAT.1) j = ia := Fin.ext rfl + apply TreeSequenceInitialSegmentVertexSetSubset hAB + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, (hAT.2.1 j).symm.trans (congrArg T.vertex hj)⟩ + have hab : a ≠ yp := by + intro h + have hv := congrArg Fin.val (T.vertex_injective h) + change ia.val = B.length at hv + omega + have hmissing : alpha ∈ TreeMissingColors mu B ∧ beta ∈ TreeMissingColors mu B := by + constructor + · exact Finset.mem_biUnion.mpr ⟨a, haB, ha⟩ + · exact Finset.mem_biUnion.mpr ⟨yp, hypB, hbeta⟩ + have hordered : + (alpha ∉ TreeMissingColors mu A ∨ beta ∉ TreeMissingColors mu A) → + TreeVertexOrder T a (T.vertex ib) ∧ + alpha ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < ib.val ∧ mu (T.edge t) = some c) := by + intro _ + refine ⟨⟨ia, ib, rfl, rfl, ?_⟩, ?_⟩ + · rw [hib] + change ia.val < B.length + omega + · simp only [Finset.mem_filter, Finset.mem_univ, true_and] + rintro ⟨t, ht, _, he⟩ + exact hunused t ht he + have changeResult := ChangeLemma G k e0 P.corresponding.replacementInput T mu em bm Cm + cm.proper cm.oneEdgeUncolored cm.lowerRung cm.fewerDividers cm.lexicographicMinimality + helem cm.largeMissingSet alpha beta hne hmissing hordered + have hsame : TwoColorComponent G mu alpha beta (Sum.inl a) = + TwoColorComponent G mu alpha beta (Sum.inl yp) := by + have hc : TwoColorComponent G mu alpha beta (Sum.inl a) = + TwoColorComponent G mu alpha beta (Sum.inl (T.vertex ib)) := by + rcases hnormalized with hp | hz + · exact changeResult.1 ⟨hp.1, Or.inl hp.2⟩ + · exact changeResult.2.1 ⟨hz.1, Or.inl hz.2⟩ + simpa only [hib] using hc + let J := TwoColorIncidenceGraph G mu alpha beta + let Q := TwoColorComponent G mu alpha beta (Sum.inl y) + have self (v : V) : Sum.inl v ∈ TwoColorComponent G mu alpha beta (Sum.inl v) := by + change J.connectedComponentMk (Sum.inl v) = J.connectedComponentMk (Sum.inl v) + rfl + have leaf := @helper_leaf_681 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha beta hne + have hay : a ≠ y := fun he => hyNotB (he ▸ haB) + have hypy : yp ≠ y := fun he => hyNotB (he ▸ hypB) + -- Three distinct missing-color endpoints cannot share one spanning path. + have hdisjoint := + @helper_hdisjoint_511 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha hBlen hBT beta hbeta haY ha hab hsame self leaf hay + hypy + have hpath : TwoColorPathComponent G mu alpha beta (Sum.inl y) := + ⟨hne, Sum.inl y, self y, leaf y (Or.inl haY)⟩ + let sigma := TwoColorComponentSwap G mu alpha beta (Sum.inl y) + have hcase : + (0 < H.dividerCount ∧ alpha ∈ TreeMissingColors mu + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors mu (em.series.data.tree (Fin.last em.rounds).castSucc) ∨ + (alpha ∈ TreeMissingColors mu A ∧ + alpha ∉ TashkinovStoredColors em.series.data (Fin.last em.rounds) ∧ + beta ∉ TashkinovStoredColors em.series.data (Fin.last em.rounds)))) := by + rcases hnormalized with hp | hz + · exact Or.inl hp + · exact Or.inr ⟨hz.1, Or.inl hz.2⟩ + obtain ⟨hbaseStable, hmissingA, hsproper, hsone, houtside⟩ := + P2813_T1_BaseControl G k e0 P.corresponding.replacementInput T mu em bm Cm cm + helem alpha beta hne hmissing (Sum.inl y) hpath sigma rfl hcase hdisjoint + obtain ⟨missingOutside, missingAlphaToBeta, missingBetaToAlpha, missingOther⟩ := + TwoColorComponentSwapMissingBehavior G mu alpha beta hne cm.proper (Sum.inl y) + have edgeOfVertex {v : V} {f : E} (hv : Sum.inl v ∈ Q) + (hf : Incident G v f) (hc : mu f = some alpha ∨ mu f = some beta) : + Sum.inr f ∈ Q := by + change J.connectedComponentMk (Sum.inl v) = J.connectedComponentMk (Sum.inl y) at hv + change J.connectedComponentMk (Sum.inr f) = J.connectedComponentMk (Sum.inl y) + have hadj : J.Adj (Sum.inr f) (Sum.inl v) := by + simpa only [J, TwoColorIncidenceGraph] using And.intro hf hc + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv + -- Internal component vertices in B retain both affected colors as present. + have hmissingB := + @helper_hmissingB_355 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha helem hBlen hBT hypB beta hbeta hne ha haB hsame + self hdisjoint missingOutside missingOther edgeOfVertex + exact @helper_continuation_770 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P hsituation alpha hunused hell hprefix htwo helem hsum hBlen + hBT hyp hypB hinterval beta hbeta haA haY hne firstSpec hib hmissing changeResult self hypy + hdisjoint hpath hcase hbaseStable missingAlphaToBeta missingOther hmissingB +theorem HierarchyClaimNineUnusedTailColor {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (hsituation : HierarchyPathNumber P.counterexample.hierarchy = 1) + (alpha : Fin k) + (hstart : + let H := P.counterexample.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + alpha ∈ TreeMissingColors P.coloring A ∧ + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length))) + (hnormalized : + let H := P.counterexample.hierarchy + let _ : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + (0 < H.dividerCount ∧ alpha ∈ TreeMissingColors P.coloring Tnq) ∨ + (H.dividerCount = 0 ∧ alpha ∈ TreeMissingColors P.coloring Tn)) + (hnoCommon : ∀ i ∈ Finset.Icc 1 (HierarchyFullTailLength C - 1), + Disjoint + (MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (MissingColors G P.coloring (T.vertex (Fin.last T.length)))) + (hunused : + let A := HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) + ∀ t : Fin T.length, A.length ≤ t.val → + P.coloring (T.edge t) ≠ some alpha) : + HierarchyFullTailLength C - 1 ∈ + HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx := by + classical + let mu := P.coloring + let em := P.corresponding.replacementETT + let bm := P.replacementBase + let Cm := P.counterexample + let cm := P.minimumContext + let H := Cm.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength Cm + let B := HierarchyFullTailPrefix Cm (ell - 1) + let y := T.vertex (Fin.last T.length) + have hstar := (P2752_T2_HierarchyMeasures C.hierarchy H P.sameGood.1).1 + have hell : HierarchyFullTailLength C = ell := by + simp only [HierarchyFullTailLength, hstar] + rfl + have hprefix (i : ℕ) : HierarchyFullTailPrefix C i = + HierarchyFullTailPrefix Cm i := by + simp only [HierarchyFullTailPrefix, hstar] + rfl + have htwo : 2 ≤ ell := + HierarchyCounterexampleTailAtLeastTwo G k e0 + P.corresponding.replacementInput T mu em bm Cm cm.proper cm.oneEdgeUncolored + cm.lowerRung cm.fewerDividers cm.lexicographicMinimality cm.largeMissingSet + have helem : ColoredVertexSetElementary G mu (TreeSequenceVertexSet B) := + HierarchyCounterexamplePenultimateElementary G k e0 + P.corresponding.replacementInput T mu em bm Cm cm.proper cm.oneEdgeUncolored + cm.lowerRung cm.fewerDividers cm.lexicographicMinimality cm.largeMissingSet + have hAT : TreeSequenceInitialSegment A T := by + have hs : TreeSequenceInitialSegment (HierarchyStarredStage H q) (H.stage q.succ) := by + refine Fin.cases ?_ (fun i => ?_) q + · exact H.coreInsideFirst + · exact H.nested i.succ + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa only [hlast, H.terminalStage] using hs + have hsum : A.length + ell = T.length := Nat.add_sub_of_le hAT.1 + have hBlen : B.length = T.length - 1 := by + dsimp [B, HierarchyFullTailPrefix] + change min (A.length + (ell - 1)) T.length = T.length - 1 + omega + have hBT : TreeSequenceInitialSegment B T := by + refine ⟨Nat.min_le_right _ _, ?_, ?_⟩ <;> intro i <;> rfl + have hAB : TreeSequenceInitialSegment A B := by + have hlen : A.length ≤ B.length := by omega + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hBT.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hAT.2.1 i) + · intro i + exact (hBT.2.2 (Fin.castLE hlen i)).symm.trans (hAT.2.2 i) + let ip : Fin (T.length + 1) := ⟨B.length, by have := hBT.1; omega⟩ + let yp := T.vertex ip + have hyp : B.vertex (Fin.last B.length) = yp := (hBT.2.1 _).symm + have hypB : yp ∈ TreeSequenceVertexSet B := by + rw [← hyp] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last B.length, rfl⟩ + have hyNotB : y ∉ TreeSequenceVertexSet B := by + intro hy + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hy + obtain ⟨i, hi⟩ := hy + have he := T.vertex_injective ((hBT.2.1 i).trans hi) + have hv := congrArg Fin.val he + have := i.isLt + simp only [Fin.val_castLE, Fin.val_last] at hv + omega + have hinterval : ell - 1 ∈ Finset.Icc 1 (HierarchyFullTailLength C - 1) := by + rw [hell] + simp only [Finset.mem_Icc] + omega + obtain ⟨beta, hbeta⟩ := hvertexMissing mu cm.proper cm.oneEdgeUncolored yp + have hbNotY : beta ∉ MissingColors G mu y := by + have hd := hnoCommon (ell - 1) hinterval + rw [hprefix, hyp] at hd + exact Finset.disjoint_left.mp hd hbeta + have haA : alpha ∈ TreeMissingColors mu A := hstart.1 + have haY : alpha ∈ MissingColors G mu y := hstart.2 + have hne : alpha ≠ beta := by + intro he + exact hbNotY (he ▸ haY) + have firstSpec (rho : PartialEdgeColoring E k) (c : Fin k) + (i : Fin (T.length + 1)) (hi : c ∈ MissingColors G rho (T.vertex i)) : + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + HierarchyFirstMissingPosition rho T c ≤ i := by + let s : Finset (Fin (T.length + 1)) := + Finset.univ.filter fun j => c ∈ MissingColors G rho (T.vertex j) + have his : i ∈ s := by simp [s, hi] + have hs : s.Nonempty := ⟨i, his⟩ + have hp : HierarchyFirstMissingPosition rho T c = s.min' hs := by + simp only [HierarchyFirstMissingPosition, s, dite_eq_left hs] + rw [hp] + exact ⟨(Finset.mem_filter.mp (Finset.min'_mem s hs)).2, Finset.min'_le s i his⟩ + obtain ⟨va, hvaA, hava⟩ := Finset.mem_biUnion.mp haA + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hvaA + obtain ⟨iaA, hiaA⟩ := hvaA + let iaT := Fin.castLE (Nat.succ_le_succ hAT.1) iaA + have haia : alpha ∈ MissingColors G mu (T.vertex iaT) := by + rw [hAT.2.1 iaA, hiaA] + exact hava + let ia := HierarchyFirstMissingPosition mu T alpha + let ib := HierarchyFirstMissingPosition mu T beta + exact @helper_continuation_739 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P hsituation alpha hnormalized hunused hell hprefix htwo + helem hAT hsum hBlen hBT hAB hyp hypB hyNotB hinterval beta hbeta haA haY hne firstSpec iaA + haia +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexample.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexample.lean new file mode 100644 index 0000000000..fab1983d6a --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexample.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.MaximumProperty + +/-! +# Hierarchy Counterexample + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A good maximum-property hierarchy whose underlying colored tree is not elementary. -/ +structure HierarchyCounterexample {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} + (base : HierarchyBase ett generating) where + positive : 0 < ett.rounds + /-- The hierarchy carried by this presentation. -/ + hierarchy : TashkinovHierarchy ett base + /-- The auxiliary color pairs and their good-hierarchy certificates. -/ + good : GoodHierarchy hierarchy + maximum : MaximumProperty ett + notElementary : ¬ColoredVertexSetElementary G generating (TreeSequenceVertexSet T) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexampleLess.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexampleLess.lean new file mode 100644 index 0000000000..43adabf188 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexampleLess.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure + +/-! +# Hierarchy Counterexample Less + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Lexicographic strict order on the path-number and remaining-tail-length measures. -/ +def HierarchyCounterexampleLess (a b : ℕ × ℕ) : Prop := + a.1 < b.1 ∨ (a.1 = b.1 ∧ a.2 < b.2) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexampleMeasure.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexampleMeasure.lean new file mode 100644 index 0000000000..e3a0d63d64 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexampleMeasure.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyPathNumber + +/-! +# Hierarchy Counterexample Measure + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The path number and length beyond the last ordinary hierarchy stage. -/ +noncomputable def HierarchyCounterexampleMeasure {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} {base : HierarchyBase ett generating} + (C : HierarchyCounterexample base) : ℕ × ℕ := + (HierarchyPathNumber C.hierarchy, + T.length - (C.hierarchy.stage ⟨C.hierarchy.dividerCount, by omega⟩).length) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionPositiveDividerImpossible.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionPositiveDividerImpossible.lean new file mode 100644 index 0000000000..fd3da051e0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionPositiveDividerImpossible.lean @@ -0,0 +1,3750 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ChangeLemmaBothInside +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChange +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +public import LeanPool.GoldbergSeymour.OneAdditionPreparatoryLemmas + +/-! +# Hierarchy Counterexample One Addition Positive Divider Impossible + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open OneAdditionPreparatoryLemmas + +private abbrev helperBranch654Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (hpositive : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let i : Fin H.dividerCount := + (⟨H.dividerCount - (1 : ℕ), + id + (fun (hpositive : (0 : ℕ) < H.dividerCount) ↦ + Decidable.byContradiction fun (a : ¬H.dividerCount - (1 : ℕ) < H.dividerCount) ↦ by omega) + hpositive⟩ : + Fin H.dividerCount); + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : TreeSequenceInitialSegment A T), + let y : V := T.vertex (Fin.last T.length); + ∀ alpha ∈ TreeMissingColors phi A, + alpha ∈ MissingColors G phi y → + ∀ (gamma eta theta : Fin k), + theta ∈ C.good.gamma i.succ eta → + (theta ∈ + (TreeSequenceVertexSet (C.hierarchy.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage C.hierarchy i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) → + ∀ (x : V), + theta ∈ MissingColors G phi x → + theta ∈ TreeMissingColors phi A → + TreeColorSetClosed G phi A { theta } → + theta ≠ gamma → + (∀ (beta : Fin k), theta ≠ beta → TreeInterchangeable G A phi theta beta) → + theta ≠ alpha → + (∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G phi theta alpha (Sum.inl y)) → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + OutsideKempeRecoloring A phi sigma theta alpha → + (IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + StableColoring Tn (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma → + ModColoring ett sigma → + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ + TashkinovAugmentationSequence sigma seed T) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT → + ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) → + OutsideKempeRecoloring (H.stage q.castSucc) phi sigma theta alpha → + ∀ (positivePrefix : (1 : ℕ) ≤ ett.rounds) + (abovePrefix : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (H.stage q.castSucc)) + (strictPrefix : + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + (H.stage q.castSucc).length) + (belowPrefix : + TreeSequenceInitialSegment (H.stage q.castSucc) + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (generatingPrefix : + phi = ett.series.data.coloring (Fin.last ett.rounds)) + (basePrefix : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + phi) + (HP : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + basePrefix) + (goodPrefix : GoodHierarchy HP), + (have n : + Fin + ({ rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi }.rounds + + (1 : ℕ)) := + Fin.last + { rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi }.rounds; + have Dn : Finset (Fin k) := + TashkinovStoredColors + { rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi }.series.data + n; + IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring (H.stage q.castSucc) Dn phi sigma ∧ + TreeColoringInvariant (H.stage q.castSucc) phi sigma ∧ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + sigma (H.stage q.castSucc)), + MaximumProperty corr.replacementETT ∧ + ∃ (baseSigma : HierarchyBase corr.replacementETT sigma) (K : + TashkinovHierarchy corr.replacementETT baseSigma) (goodSigma : + GoodHierarchy K), + SameGoodHierarchy goodPrefix goodSigma ∧ + (TreeColorSetMinusClosed G phi (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount))) → + TreeColorSetMinusClosed G sigma (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount))))) → + ∀ + (corrPrefix : + CorrespondingExtendedTashkinovTree G k e0 + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + sigma (H.stage q.castSucc)), + MaximumProperty corrPrefix.replacementETT → + ∀ (basePrefixSigma : HierarchyBase corrPrefix.replacementETT sigma) + (KP : TashkinovHierarchy corrPrefix.replacementETT basePrefixSigma) + (goodPrefixSigma : GoodHierarchy KP), + SameGoodHierarchy goodPrefix goodPrefixSigma → + (TreeColorSetMinusClosed G phi (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount))) → + TreeColorSetMinusClosed G sigma (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount)))) → + ∀ (baseT : HierarchyBase corrT.replacementETT sigma), + baseT.core = basePrefixSigma.core → + baseT.closure = basePrefixSigma.closure → + (↑baseT.supportPosition : ℕ) = + (↑basePrefixSigma.supportPosition : ℕ) → + ∀ (hcoreT : baseT.core = base.core) + (hterminalTree : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { + dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm hterminalTree), + terminalStage := H.terminalStage, nested := H.nested, + strict := H.strict, dividerPosition := H.dividerPosition, + dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, + dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment _a + (H.stage + (⟨(1 : ℕ), by omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (B : TreeSequence G e0), + TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma B = TreeMissingColors phi B) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + corrT.replacementETT.series.data.kind + (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + TashkinovStoredColors ett.series.data n → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = + HierarchyStageMissingColors H j) → + (∀ (psi : PartialEdgeColoring E k), + ∀ c ∈ TreeMissingColors psi A, + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) ≤ + A.length) → + ∀ (c : Fin k), + (have C : Set (V ⊕ E) := + TwoColorComponent G phi theta alpha (Sum.inl y); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + (∀ (v : V), + Sum.inl v ∉ C → + MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + theta ∈ MissingColors G phi v → + alpha ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + alpha ∈ MissingColors G phi v → + theta ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ theta → + c ≠ alpha → + (c ∈ MissingColors G phi' v ↔ + c ∈ MissingColors G phi v)) → + c = theta ∨ c = alpha → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition phi T c + +private abbrev helperFirstMissingEq961Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : IsProperEdgeColoring G phi) + (hpositive : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let i : Fin H.dividerCount := + (⟨H.dividerCount - (1 : ℕ), + id + (fun (hpositive : (0 : ℕ) < H.dividerCount) ↦ + Decidable.byContradiction fun (a : ¬H.dividerCount - (1 : ℕ) < H.dividerCount) ↦ by omega) + hpositive⟩ : + Fin H.dividerCount); + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : TreeSequenceInitialSegment A T), + let y : V := T.vertex (Fin.last T.length); + ∀ alpha ∈ TreeMissingColors phi A, + alpha ∈ MissingColors G phi y → + ∀ (gamma eta theta : Fin k), + theta ∈ C.good.gamma i.succ eta → + (theta ∈ + (TreeSequenceVertexSet (C.hierarchy.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage C.hierarchy i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) → + ∀ (x : V), + theta ∈ MissingColors G phi x → + theta ∈ TreeMissingColors phi A → + TreeColorSetClosed G phi A { theta } → + theta ≠ gamma → + (∀ (beta : Fin k), theta ≠ beta → TreeInterchangeable G A phi theta beta) → + theta ≠ alpha → + (∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G phi theta alpha (Sum.inl y)) → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + OutsideKempeRecoloring A phi sigma theta alpha → + (IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + StableColoring Tn (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma → + ModColoring ett sigma → + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ + TashkinovAugmentationSequence sigma seed T) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT → + ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) → + OutsideKempeRecoloring (H.stage q.castSucc) phi sigma theta alpha → + ∀ (positivePrefix : (1 : ℕ) ≤ ett.rounds) + (abovePrefix : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (H.stage q.castSucc)) + (strictPrefix : + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + (H.stage q.castSucc).length) + (belowPrefix : + TreeSequenceInitialSegment (H.stage q.castSucc) + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (generatingPrefix : + phi = ett.series.data.coloring (Fin.last ett.rounds)) + (basePrefix : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + phi) + (HP : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + basePrefix) + (goodPrefix : GoodHierarchy HP), + (have n : + Fin + ({ rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi }.rounds + + (1 : ℕ)) := + Fin.last + { rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi }.rounds; + have Dn : Finset (Fin k) := + TashkinovStoredColors + { rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi }.series.data + n; + IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring (H.stage q.castSucc) Dn phi sigma ∧ + TreeColoringInvariant (H.stage q.castSucc) phi sigma ∧ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + sigma (H.stage q.castSucc)), + MaximumProperty corr.replacementETT ∧ + ∃ (baseSigma : HierarchyBase corr.replacementETT sigma) (K : + TashkinovHierarchy corr.replacementETT baseSigma) (goodSigma : + GoodHierarchy K), + SameGoodHierarchy goodPrefix goodSigma ∧ + (TreeColorSetMinusClosed G phi (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount))) → + TreeColorSetMinusClosed G sigma (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount))))) → + ∀ + (corrPrefix : + CorrespondingExtendedTashkinovTree G k e0 + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + sigma (H.stage q.castSucc)), + MaximumProperty corrPrefix.replacementETT → + ∀ (basePrefixSigma : HierarchyBase corrPrefix.replacementETT sigma) + (KP : TashkinovHierarchy corrPrefix.replacementETT basePrefixSigma) + (goodPrefixSigma : GoodHierarchy KP), + SameGoodHierarchy goodPrefix goodPrefixSigma → + (TreeColorSetMinusClosed G phi (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount))) → + TreeColorSetMinusClosed G sigma (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount)))) → + let _ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma + (H.stage q.castSucc) := + { + replacementInput := corrPrefix.replacementInput, + replacementSeries := corrPrefix.replacementSeries, + replacementETT := corrPrefix.replacementETT, + rungAgreement := corrPrefix.rungAgreement, + seriesPresentation := corrPrefix.seriesPresentation, + finalGeneratingColoring := corrPrefix.finalGeneratingColoring, + ladderTreesAgree := corrPrefix.ladderTreesAgree, + storedColorsAgree := corrPrefix.storedColorsAgree, + connectingEdgesAgree := corrPrefix.connectingEdgesAgree, + extensionKindsAgree := corrPrefix.extensionKindsAgree, + replacementProper := corrPrefix.replacementProper, + replacementOneUncolored := corrPrefix.replacementOneUncolored, + replacementStable := corrPrefix.replacementStable : + CorrespondingExtendedTashkinovTree G k e0 ett sigma + (H.stage q.castSucc) }; + ∀ (baseT : HierarchyBase corrT.replacementETT sigma), + baseT.core = basePrefixSigma.core → + baseT.closure = basePrefixSigma.closure → + (↑baseT.supportPosition : ℕ) = + (↑basePrefixSigma.supportPosition : ℕ) → + ∀ (hcoreT : baseT.core = base.core) + (hterminalTree : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { + dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm hterminalTree), + terminalStage := H.terminalStage, nested := H.nested, + strict := H.strict, dividerPosition := H.dividerPosition, + dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, + dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment _a + (H.stage + (⟨(1 : ℕ), by omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (B : TreeSequence G e0), + TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma B = TreeMissingColors phi B) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + corrT.replacementETT.series.data.kind + (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + TashkinovStoredColors ett.series.data n → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = + HierarchyStageMissingColors H j) → + (∀ (psi : PartialEdgeColoring E k), + ∀ c ∈ TreeMissingColors psi A, + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) ≤ + A.length) → + ∀ (c : Fin k), + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition phi T c + +private abbrev helperContinuation2653Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : IsProperEdgeColoring G phi) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating') (_ : other.rounds = ett.rounds) + (_ : MaximumProperty other) (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base') (_ : GoodHierarchy K) + (_ : K.dividerCount < C.hierarchy.dividerCount), + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T'))) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base') + (_ : other.rounds = ett.rounds) (_ : C'.hierarchy.dividerCount = C.hierarchy.dividerCount), + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C))) + (_ : + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card)) + (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (hlen : T.length = A.length + (1 : ℕ)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) + (_ : TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), + TreeSequenceInitialSegment X Y)) + (_ : + (∀ {X Y : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : X.length = Y.length), + X = Y)) + (_ : TreeSequenceInitialSegment A T) (hTnA : TreeSequenceInitialSegment Tn A) + (_ : + (∀ (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmT : m ≤ T.length), + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T)) + (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A)), + let r : Fin T.length := (⟨A.length, by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := T.vertex (Fin.last T.length); + ∀ (_ : y ∉ TreeSequenceVertexSet A), + ∀ alpha ∈ MissingColors G phi y, + ∀ gamma ∈ TreeMissingColors phi A, + phi f = some gamma → + (∃ u ∈ TreeSequenceVertexSet A, G.ends f = s(u, y)) → + ∀ (_ theta : Fin k), + theta ∈ TreeMissingColors phi A → + TreeColorSetClosed G phi A { theta } → + theta ≠ gamma → + (∀ (psi : PartialEdgeColoring E k), + IsProperEdgeColoring G psi → + ∀ (c d : Fin k), + c ≠ d → + c ∈ TreeMissingColors psi A → + d ∈ TreeMissingColors psi A → + ∀ w ∉ TreeSequenceVertexSet A, + c ∈ MissingColors G psi w ∨ d ∈ MissingColors G psi w → + TreeInterchangeable G A psi c d → + ∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G psi c d (Sum.inl w)) → + theta ≠ alpha → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + ∀ + (hstableA : + IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f), + (∀ c ∈ TreeMissingColors phi A, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + T.vertex (HierarchyFirstMissingPosition phi T c) ∈ TreeSequenceVertexSet A) → + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT → + ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) → + ∀ (positivePrefix : (1 : ℕ) ≤ ett.rounds) + (abovePrefix : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (H.stage q.castSucc)) + (strictPrefix : + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + (H.stage q.castSucc).length) + (belowPrefix : + TreeSequenceInitialSegment (H.stage q.castSucc) + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (generatingPrefix : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (corrPrefix : + CorrespondingExtendedTashkinovTree G k e0 + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + sigma (H.stage q.castSucc)) + (_ : HierarchyBase corrPrefix.replacementETT sigma) + (baseT : HierarchyBase corrT.replacementETT sigma) + (hcoreT : baseT.core = base.core) + (hterminalTree : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { + dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm hterminalTree), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment _a + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + ∀ + (missingTree : + ∀ (B : TreeSequence G e0), + TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma B = TreeMissingColors phi B) + (stageInsideA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) + (coreInsideA : TreeSequenceVertexSet base.core ⊆ TreeSequenceVertexSet A) + (starredEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) + (terminalColors : + corrT.replacementETT.series.data.kind + (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + TashkinovStoredColors ett.series.data n) + (storedEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) + (stageMissingEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j), + (∀ (c : Fin k), + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition phi T c) → + ∀ + (segmentEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))) (c : Fin k), + HierarchySegmentColors K j c = HierarchySegmentColors H j c), + (∀ (B : TreeSequence G e0), + TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet A → + ∀ (c : Fin k), + BoundaryColorEdges G sigma (TreeSequenceVertexSet B) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet B) c) → + ∀ + (minusEq : + ∀ (B : TreeSequence G e0), + TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet A → + ∀ (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma B R ↔ + TreeColorSetMinusClosed G phi B R) + (closureEq : + corrT.replacementETT.series.data.kind + (Fin.last corrT.replacementETT.rounds) = + some TashkinovExtensionKind.PE → + baseT.closure = base.closure), + let _ : GoodHierarchy K := + { + gamma := C.good.gamma, + twoColors := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (c : Fin k) + (hc : c ∈ HierarchyStoredColorsAt K j) ↦ + C.good.twoColors j c + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ c ∈ _a) (storedEq j)) + hc), + avoidance := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (c : Fin k) + (hc : c ∈ HierarchyStoredColorsAt K j) ↦ + Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + C.good.gamma j c ⊆ _a \ HierarchySegmentColors K j c) + (stageMissingEq j))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + C.good.gamma j c ⊆ HierarchyStageMissingColors H j \ _a) + (segmentEq j c))) + (C.good.avoidance j c + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ c ∈ _a) (storedEq j)) + hc))), + disjointPairs := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (c d : Fin k) + (hc : c ∈ HierarchyStoredColorsAt K j) + (hd : d ∈ HierarchyStoredColorsAt K j) (hne : c ≠ d) ↦ + C.good.disjointPairs j c d + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ c ∈ _a) (storedEq j)) + hc) + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) ↦ d ∈ _a) (storedEq j)) + hd) + hne, + uniqueRefresh := fun (a : Fin K.dividerCount) ↦ + have hnew : + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet + (HierarchyStarredStage H a.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet + (HierarchyStarredStage H a.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := + helper_hnew_2064 G k e0 input T phi ett base C alpha theta hstableA + corrT baseT hcoreT hterminalTree stageInsideA a; + id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + ∃! c : Fin k, + c ∈ HierarchyStoredColorsAt K a.succ ∧ + (C.good.gamma a.succ c ⊆ + (TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet _a).biUnion + fun (v : V) ↦ MissingColors G sigma v) ∧ + ∀ d ∈ HierarchyStoredColorsAt K a.succ, + d ≠ c → C.good.gamma a.succ d = C.good.gamma a.castSucc d) + (starredEq a.castSucc))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + ∃! c : Fin k, + c ∈ HierarchyStoredColorsAt K a.succ ∧ + C.good.gamma a.succ c ⊆ _a ∧ + ∀ d ∈ HierarchyStoredColorsAt K a.succ, + d ≠ c → C.good.gamma a.succ d = C.good.gamma a.castSucc d) + hnew)) + (Eq.mpr + (id + (congrArg ExistsUnique + (funext fun (c : Fin k) ↦ + congr + (congrArg And + (congrFun' + (congrArg Membership.mem + ((fun (j : Fin (H.dividerCount + (1 : ℕ))) ↦ storedEq j) + a.succ)) + c)) + (congrArg + (And + (C.good.gamma a.succ c ⊆ + (TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet + (HierarchyStarredStage H a.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v)) + (forall_congr fun (d : Fin k) ↦ + implies_congr + (congrFun' + (congrArg Membership.mem + ((fun (j : Fin (H.dividerCount + (1 : ℕ))) ↦ storedEq j) + a.succ)) + d) + (Eq.refl + (d ≠ c → + C.good.gamma a.succ d = C.good.gamma a.castSucc d))))))) + (C.good.uniqueRefresh a)))), + parallelBase := + id + fun + (hpe : + corrT.replacementETT.series.data.kind + (Fin.last corrT.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ↦ + have hpeOld : + ett.series.data.kind n = some TashkinovExtensionKind.PE := + Eq.mpr + (id + (congrArg + (fun (_a : Option TashkinovExtensionKind) ↦ + _a = some TashkinovExtensionKind.PE) + (Eq.symm terminalColors.left))) + hpe; + have hcl : + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A := + And.casesOn (base.parallel hpeOld) + fun + (_ : + ett.series.data.chosenVertex (Fin.last ett.rounds) = + some + ((ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex + base.supportPosition)) + (right : + TashkinovClosure phi + (TreeSequencePrefix + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) + base.closure ∧ + Nonempty + (OrderedTreeUnion + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure base.core)) ↦ + And.casesOn right + fun + (_ : + TashkinovClosure phi + (TreeSequencePrefix + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) + base.closure) + (right : + Nonempty + (OrderedTreeUnion + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure base.core)) ↦ + Nonempty.casesOn right + fun + (ordered : + OrderedTreeUnion + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure base.core) + ⦃v : V⦄ (hv : v ∈ TreeSequenceVertexSet base.closure) ↦ + coreInsideA + (Eq.mpr + (id + (congrArg (fun (_a : Finset V) ↦ v ∈ _a) ordered.vertexSet)) + (Finset.mem_union_right + (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + hv)); + And.casesOn (C.good.parallelBase hpeOld) + fun + (hnot : + ¬TreeColorSetMinusClosed G phi base.core + ((HierarchyStoredColorsAt C.hierarchy + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) + (hcard : + (4 : ℕ) ≤ + ((TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure) \ + (HierarchyStoredColorsAt C.hierarchy + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) ↦ + (⟨id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + ¬TreeColorSetMinusClosed G sigma _a + ((HierarchyStoredColorsAt K + (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) + hcoreT)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + ¬TreeColorSetMinusClosed G sigma base.core + (_a.biUnion + (C.good.gamma + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) + (storedEq (0 : Fin (H.dividerCount + (1 : ℕ)))))) + (Eq.mpr + (id + (congrArg (fun (_a : Prop) ↦ ¬_a) + (propext + (minusEq base.core coreInsideA + ((HierarchyStoredColorsAt H + (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))))))) + hnot))), + id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma _a ∩ + TreeMissingColors sigma baseT.closure) \ + (HierarchyStoredColorsAt K + (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) + hterminalTree)) + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ + TreeMissingColors sigma _a) \ + (HierarchyStoredColorsAt K + (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) + (closureEq hpe))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ + TreeMissingColors sigma base.closure) \ + _a.biUnion + (C.good.gamma + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) + (storedEq (0 : Fin (H.dividerCount + (1 : ℕ)))))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((_a ∩ TreeMissingColors sigma base.closure) \ + (HierarchyStoredColorsAt H + (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma + (0 : + Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) + (missingTree Tn + (TreeSequenceInitialSegmentVertexSetSubset hTnA)))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + (4 : ℕ) ≤ + ((TreeMissingColors phi Tn ∩ _a) \ + (HierarchyStoredColorsAt H + (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma + (0 : + Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) + (missingTree base.closure hcl))) + hcard)))))⟩ : + ¬TreeColorSetMinusClosed G sigma baseT.core + ((HierarchyStoredColorsAt K + (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (K.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseT.closure) \ + (HierarchyStoredColorsAt K + (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (K.dividerCount + (1 : ℕ))))).card), + minusClosed := fun (a : Fin K.dividerCount) ↦ + id + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + TreeColorSetMinusClosed G sigma (H.stage a.succ.castSucc) + (_a.biUnion (C.good.gamma a.castSucc))) + (storedEq a.succ))) + (Eq.mpr + (id + (congrArg (fun (_a : Prop) ↦ _a) + (propext + (minusEq (H.stage a.succ.castSucc) + (TreeSequenceInitialSegmentVertexSetSubset + (stageInsideA a.succ)) + ((HierarchyStoredColorsAt H a.succ).biUnion + (C.good.gamma a.castSucc)))))) + (C.good.minusClosed a))) : + GoodHierarchy K }; + False + +private abbrev helperContinuation2177Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : IsProperEdgeColoring G phi) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating') (_ : other.rounds = ett.rounds) + (_ : MaximumProperty other) (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base') (_ : GoodHierarchy K) + (_ : K.dividerCount < C.hierarchy.dividerCount), + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T'))) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base') + (_ : other.rounds = ett.rounds) (_ : C'.hierarchy.dividerCount = C.hierarchy.dividerCount), + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C))) + (_ : + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card)) + (hpositive : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let i : Fin H.dividerCount := + (⟨H.dividerCount - (1 : ℕ), + id + (fun (hpositive : (0 : ℕ) < H.dividerCount) ↦ + Decidable.byContradiction fun (a : ¬H.dividerCount - (1 : ℕ) < H.dividerCount) ↦ by omega) + hpositive⟩ : + Fin H.dividerCount); + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (hlen : T.length = A.length + (1 : ℕ)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) + (_ : TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), + TreeSequenceInitialSegment X Y)) + (_ : + (∀ {X Y : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : X.length = Y.length), + X = Y)) + (_ : TreeSequenceInitialSegment A T) + (_ : + (∀ (a b : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑a : ℕ) ≤ (↑b : ℕ)), + TreeSequenceInitialSegment (H.stage a) (H.stage b))) + (_ : TreeSequenceInitialSegment Tn A) + (_ : + (∀ (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmT : m ≤ T.length), + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T)) + (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A)), + let r : Fin T.length := (⟨A.length, by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := T.vertex (Fin.last T.length); + ∀ (_ : y ∉ TreeSequenceVertexSet A), + ∀ alpha ∈ TreeMissingColors phi A, + alpha ∈ MissingColors G phi y → + ∀ gamma ∈ TreeMissingColors phi A, + phi f = some gamma → + (∃ u ∈ TreeSequenceVertexSet A, G.ends f = s(u, y)) → + ∀ (eta : Fin k), + (C.good.gamma i.succ eta).card = (2 : ℕ) → + ∀ theta ∈ C.good.gamma i.succ eta, + (theta ∈ + (TreeSequenceVertexSet (C.hierarchy.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage C.hierarchy i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) → + ∀ (x : V), + theta ∈ MissingColors G phi x → + theta ∈ TreeMissingColors phi A → + TreeColorSetClosed G phi A { theta } → + theta ≠ gamma → + (∀ (psi : PartialEdgeColoring E k), + IsProperEdgeColoring G psi → + ∀ (c d : Fin k), + c ≠ d → + c ∈ TreeMissingColors psi A → + d ∈ TreeMissingColors psi A → + ∀ w ∉ TreeSequenceVertexSet A, + c ∈ MissingColors G psi w ∨ d ∈ MissingColors G psi w → + TreeInterchangeable G A psi c d → + ∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G psi c d (Sum.inl w)) → + (∀ (beta : Fin k), theta ≠ beta → TreeInterchangeable G A phi theta beta) → + theta ≠ alpha → + (∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G phi theta alpha (Sum.inl y)) → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + OutsideKempeRecoloring A phi sigma theta alpha → + (IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + (∀ c ∈ TreeMissingColors phi A, + c ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + T.vertex (HierarchyFirstMissingPosition phi T c) ∈ + TreeSequenceVertexSet A) → + StableColoring Tn (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma → + ModColoring ett sigma → + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ + TashkinovAugmentationSequence sigma seed T) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT → + ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) → + OutsideKempeRecoloring (H.stage q.castSucc) phi sigma theta alpha → + ∀ (positivePrefix : (1 : ℕ) ≤ ett.rounds) + (abovePrefix : + TreeSequenceInitialSegment + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (H.stage q.castSucc)) + (strictPrefix : + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : + Fin (ett.rounds + (2 : ℕ)))).length < + (H.stage q.castSucc).length) + (belowPrefix : + TreeSequenceInitialSegment (H.stage q.castSucc) + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (generatingPrefix : + phi = ett.series.data.coloring (Fin.last ett.rounds)) + (basePrefix : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + phi), + basePrefix.closure = base.closure → + ∀ + (HP : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi } + basePrefix) + (goodPrefix : GoodHierarchy HP), + (have n : + Fin + ({ rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi }.rounds + + (1 : ℕ)) := + Fin.last + { rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi }.rounds; + have Dn : Finset (Fin k) := + TashkinovStoredColors + { rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi }.series.data + n; + IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring (H.stage q.castSucc) Dn phi sigma ∧ + TreeColoringInvariant (H.stage q.castSucc) phi sigma ∧ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 + { + rounds := ett.rounds, + roundsPositive := positivePrefix, series := ett.series, + abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi } + sigma (H.stage q.castSucc)), + MaximumProperty corr.replacementETT ∧ + ∃ (baseSigma : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT baseSigma) + (goodSigma : GoodHierarchy K), + SameGoodHierarchy goodPrefix goodSigma ∧ + (TreeColorSetMinusClosed G phi (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount))) → + TreeColorSetMinusClosed G sigma (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount))))) → + ∀ + (corrPrefix : + CorrespondingExtendedTashkinovTree G k e0 + { + rounds := ett.rounds, roundsPositive := positivePrefix, + series := ett.series, abovePenultimate := abovePrefix, + strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, + generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) + phi } + sigma (H.stage q.castSucc)), + MaximumProperty corrPrefix.replacementETT → + ∀ + (basePrefixSigma : + HierarchyBase corrPrefix.replacementETT sigma) + (KP : + TashkinovHierarchy corrPrefix.replacementETT + basePrefixSigma) + (goodPrefixSigma : GoodHierarchy KP), + SameGoodHierarchy goodPrefix goodPrefixSigma → + (TreeColorSetMinusClosed G phi (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount))) → + TreeColorSetMinusClosed G sigma (H.stage q.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount)))) → + let _ : + CorrespondingExtendedTashkinovTree G k e0 ett sigma + (H.stage q.castSucc) := + { + replacementInput := corrPrefix.replacementInput, + replacementSeries := corrPrefix.replacementSeries, + replacementETT := corrPrefix.replacementETT, + rungAgreement := corrPrefix.rungAgreement, + seriesPresentation := corrPrefix.seriesPresentation, + finalGeneratingColoring := + corrPrefix.finalGeneratingColoring, + ladderTreesAgree := corrPrefix.ladderTreesAgree, + storedColorsAgree := corrPrefix.storedColorsAgree, + connectingEdgesAgree := + corrPrefix.connectingEdgesAgree, + extensionKindsAgree := corrPrefix.extensionKindsAgree, + replacementProper := corrPrefix.replacementProper, + replacementOneUncolored := + corrPrefix.replacementOneUncolored, + replacementStable := corrPrefix.replacementStable : + CorrespondingExtendedTashkinovTree G k e0 ett sigma + (H.stage q.castSucc) }; + ∀ (baseT : HierarchyBase corrT.replacementETT sigma), + baseT.core = basePrefixSigma.core → + baseT.closure = basePrefixSigma.closure → + (↑baseT.supportPosition : ℕ) = + (↑basePrefixSigma.supportPosition : ℕ) → + ∀ (hcoreT : baseT.core = base.core) + (hterminalTree : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn), + let K : + TashkinovHierarchy corrT.replacementETT baseT := + { + dividerCount := H.dividerCount, stage := H.stage, + baseStage := + Eq.trans H.baseStage (Eq.symm hterminalTree), + terminalStage := H.terminalStage, + nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, + dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, + dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment _a + (H.stage + (⟨(1 : ℕ), by omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (B : TreeSequence G e0), + TreeSequenceVertexSet B ⊆ + TreeSequenceVertexSet A → + TreeMissingColors sigma B = + TreeMissingColors phi B) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) + A) → + TreeSequenceVertexSet base.core ⊆ + TreeSequenceVertexSet A → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = + HierarchyStarredStage H j) → + corrT.replacementETT.series.data.kind + (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors + corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + TashkinovStoredColors ett.series.data n → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt H j) → + False + +private abbrev helperContinuation2110Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : IsProperEdgeColoring G phi) + (_ : IsOneEdgeUncolored phi e0) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating') (_ : other.rounds = ett.rounds) + (_ : MaximumProperty other) (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base') (_ : GoodHierarchy K) + (_ : K.dividerCount < C.hierarchy.dividerCount), + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T'))) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base') + (_ : other.rounds = ett.rounds) (_ : C'.hierarchy.dividerCount = C.hierarchy.dividerCount), + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C))) + (_ : + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card)) + (hpositive : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let i : Fin H.dividerCount := + (⟨H.dividerCount - (1 : ℕ), + id + (fun (hpositive : (0 : ℕ) < H.dividerCount) ↦ + Decidable.byContradiction fun (a : ¬H.dividerCount - (1 : ℕ) < H.dividerCount) ↦ by omega) + hpositive⟩ : + Fin H.dividerCount); + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : (0 : ℕ) < H.dividerCount) (_ : A = H.stage q.castSucc) + (hlen : T.length = A.length + (1 : ℕ)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) + (_ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) + (_ : TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), + TreeSequenceInitialSegment X Y)) + (_ : + (∀ {X Y : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : X.length = Y.length), + X = Y)) + (_ : TreeSequenceInitialSegment A T) + (_ : + (∀ (a b : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑a : ℕ) ≤ (↑b : ℕ)), + TreeSequenceInitialSegment (H.stage a) (H.stage b))) + (_ : TreeSequenceInitialSegment Tn A) + (_ : + (∀ (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmT : m ≤ T.length), + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T)) + (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A)), + let r : Fin T.length := (⟨A.length, by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := T.vertex (Fin.last T.length); + ∀ (_ : y ∉ TreeSequenceVertexSet A), + ∀ alpha ∈ TreeMissingColors phi A, + alpha ∈ MissingColors G phi y → + ∀ gamma ∈ TreeMissingColors phi A, + phi f = some gamma → + (∃ u ∈ TreeSequenceVertexSet A, G.ends f = s(u, y)) → + ∀ (eta : Fin k), + (C.good.gamma i.succ eta).card = (2 : ℕ) → + ∀ theta ∈ C.good.gamma i.succ eta, + (theta ∈ + (TreeSequenceVertexSet (C.hierarchy.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage C.hierarchy i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) → + ∀ (x : V), + theta ∈ MissingColors G phi x → + theta ∈ TreeMissingColors phi A → + TreeColorSetClosed G phi A { theta } → + theta ≠ gamma → + (∀ (psi : PartialEdgeColoring E k), + IsProperEdgeColoring G psi → + ∀ (c d : Fin k), + c ≠ d → + c ∈ TreeMissingColors psi A → + d ∈ TreeMissingColors psi A → + ∀ w ∉ TreeSequenceVertexSet A, + c ∈ MissingColors G psi w ∨ d ∈ MissingColors G psi w → + TreeInterchangeable G A psi c d → + ∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G psi c d (Sum.inl w)) → + (∀ (beta : Fin k), theta ≠ beta → TreeInterchangeable G A phi theta beta) → + theta ≠ alpha → + (∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G phi theta alpha (Sum.inl y)) → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + OutsideKempeRecoloring A phi sigma theta alpha → + (IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + (∀ c ∈ TreeMissingColors phi A, + c ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + T.vertex (HierarchyFirstMissingPosition phi T c) ∈ + TreeSequenceVertexSet A) → + StableColoring Tn (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma → + ModColoring ett sigma → + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ + TashkinovAugmentationSequence sigma seed T) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT → + ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) → + False + +private theorem helper_outsideMissingComponent_540.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ + (_ : + (∀ (psi : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G psi) (c d : Fin k) + (_ : c ≠ d) (v : V) (_ : c ∈ MissingColors G psi v ∨ d ∈ MissingColors G psi v), + ((TwoColorIncidenceGraph G psi c d).neighborSet (Sum.inl v)).Subsingleton)) + (_ : + (∀ (psi : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G psi) (c d : Fin k) + (_ : c ≠ d) (v : V) (_ : c ∈ MissingColors G psi v ∨ d ∈ MissingColors G psi v), + TwoColorPathComponent G psi c d (Sum.inl v))) + (psi : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G psi) (c d : Fin k) + (_ : c ≠ d) (_ : c ∈ TreeMissingColors psi A) (_ : d ∈ TreeMissingColors psi A), + ∀ w ∉ TreeSequenceVertexSet A, + c ∈ MissingColors G psi w ∨ d ∈ MissingColors G psi w → + TreeInterchangeable G A psi c d → + ∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G psi c d (Sum.inl w) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A missingLeaf pathMissing psi hpsi c d hcd + hcA hdA w hwOutside hcw hinter + obtain ⟨u, huA, hcu⟩ := Finset.mem_biUnion.mp hcA + obtain ⟨v, hvA, hdv⟩ := Finset.mem_biUnion.mp hdA + intro z hzA hzC + have huvC := hinter (Sum.inl u) (Sum.inl v) + (pathMissing psi hpsi c d hcd u (Or.inl hcu)) + (pathMissing psi hpsi c d hcd v (Or.inr hdv)) + ⟨u, huA, rfl⟩ ⟨v, hvA, rfl⟩ + have huwC := hinter (Sum.inl u) (Sum.inl w) + (pathMissing psi hpsi c d hcd u (Or.inl hcu)) + (pathMissing psi hpsi c d hcd w hcw) ⟨u, huA, rfl⟩ ⟨z, hzA, hzC⟩ + have hvC : Sum.inl v ∈ TwoColorComponent G psi c d (Sum.inl u) := by + rw [huvC] + rfl + have hwC : Sum.inl w ∈ TwoColorComponent G psi c d (Sum.inl u) := by + rw [huwC] + rfl + have huw : Sum.inl u ≠ (Sum.inl w : Sum V E) := by + intro he + exact hwOutside (Sum.inl.inj he ▸ huA) + have hvw : Sum.inl v ≠ (Sum.inl w : Sum V E) := by + intro he + exact hwOutside (Sum.inl.inj he ▸ hvA) + by_cases huv : u = v + · subst v + have hnone : (TwoColorIncidenceGraph G psi c d).neighborSet (Sum.inl u) = ∅ := by + ext z + simp only [Set.mem_empty_iff_false, iff_false] + intro hz + cases z with + | inl z => exact hz + | inr edge => + change Incident G u edge ∧ (psi edge = some c ∨ psi edge = some d) at hz + obtain ⟨hinc, hcolor⟩ := hz + have hcnot : c ∉ PresentColors G psi u := by + simpa [MissingColors] using hcu + have hdnot : d ∉ PresentColors G psi u := by + simpa [MissingColors] using hdv + rcases hcolor with hcolor | hcolor + · apply hcnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨edge, hinc, hcolor⟩ + · apply hdnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨edge, hinc, hcolor⟩ + have hreach : (TwoColorIncidenceGraph G psi c d).Reachable + (Sum.inl u) (Sum.inl w) := + SimpleGraph.ConnectedComponent.reachable_of_mem_supp _ rfl hwC + exact SimpleGraph.not_reachable_of_neighborSet_left_eq_empty huw hnone hreach + · obtain ⟨a, b, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G psi c d hpsi (Sum.inl u) + have endpoint (t : V) + (htC : Sum.inl t ∈ TwoColorComponent G psi c d (Sum.inl u)) + (htMissing : c ∈ MissingColors G psi t ∨ d ∈ MissingColors G psi t) : + Sum.inl t = a ∨ Sum.inl t = b := by + by_contra hnot + push Not at hnot + have htSupport : Sum.inl t ∈ p.support := by + change Sum.inl t ∈ {z | z ∈ p.support} + rw [hsupport] + exact htC + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hnot.1 hnot.2 (missingLeaf psi hpsi c d hcd t htMissing)) htSupport + have huEnd := endpoint u rfl (Or.inl hcu) + have hvEnd := endpoint v hvC (Or.inr hdv) + have hwEnd := endpoint w hwC hcw + have huv' : Sum.inl u ≠ (Sum.inl v : Sum V E) := fun he => huv (Sum.inl.inj he) + rcases huEnd with huEnd | huEnd <;> + rcases hvEnd with hvEnd | hvEnd <;> + rcases hwEnd with hwEnd | hwEnd + all_goals first + | exact huv' (huEnd.trans hvEnd.symm) + | exact huw (huEnd.trans hwEnd.symm) + | exact hvw (hvEnd.trans hwEnd.symm) + +private theorem helper_terminalColors_890.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : TreeSequenceInitialSegment Tn A), + let y : V := T.vertex (Fin.last T.length); + ∀ (alpha _ theta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (_ : MaximumProperty corrT.replacementETT) (positivePrefix : (1 : ℕ) ≤ ett.rounds) + (abovePrefix : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (H.stage q.castSucc)) + (strictPrefix : + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + (H.stage q.castSucc).length) + (belowPrefix : + TreeSequenceInitialSegment (H.stage q.castSucc) + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (generatingPrefix : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (basePrefix : + HierarchyBase + { rounds := ett.rounds, roundsPositive := positivePrefix, series := ett.series, + abovePenultimate := abovePrefix, strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := positivePrefix, series := ett.series, + abovePenultimate := abovePrefix, strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + basePrefix) + (corrPrefix : + CorrespondingExtendedTashkinovTree G k e0 + { rounds := ett.rounds, roundsPositive := positivePrefix, series := ett.series, + abovePenultimate := abovePrefix, strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + sigma (H.stage q.castSucc)) + (basePrefixSigma : HierarchyBase corrPrefix.replacementETT sigma), + let _ : CorrespondingExtendedTashkinovTree G k e0 ett sigma (H.stage q.castSucc) := + { replacementInput := corrPrefix.replacementInput, + replacementSeries := corrPrefix.replacementSeries, + replacementETT := corrPrefix.replacementETT, + rungAgreement := corrPrefix.rungAgreement, + seriesPresentation := corrPrefix.seriesPresentation, + finalGeneratingColoring := corrPrefix.finalGeneratingColoring, + ladderTreesAgree := corrPrefix.ladderTreesAgree, + storedColorsAgree := corrPrefix.storedColorsAgree, + connectingEdgesAgree := corrPrefix.connectingEdgesAgree, + extensionKindsAgree := corrPrefix.extensionKindsAgree, + replacementProper := corrPrefix.replacementProper, + replacementOneUncolored := corrPrefix.replacementOneUncolored, + replacementStable := corrPrefix.replacementStable : + CorrespondingExtendedTashkinovTree G k e0 ett sigma (H.stage q.castSucc) }; + ∀ (baseT : HierarchyBase corrT.replacementETT sigma) + (_ : baseT.core = basePrefixSigma.core) (_ : baseT.closure = basePrefixSigma.closure) + (_ : (↑baseT.supportPosition : ℕ) = (↑basePrefixSigma.supportPosition : ℕ)) + (hcoreT : baseT.core = base.core) + (hterminalTree : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm hterminalTree), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment _a + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + ∀ + (_ : + (∀ (B : TreeSequence G e0) (_ : TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet A), + TreeMissingColors sigma B = TreeMissingColors phi B)) + (_ : + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j)), + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + TashkinovStoredColors ett.series.data n := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H q A n Tn hTnA y alpha eta theta + sigma corrT hmaximumT positivePrefix abovePrefix strictPrefix belowPrefix generatingPrefix + basePrefix HP corrPrefix basePrefixSigma corrA baseT hcoreTA hclosureTA hsupportTA hcoreT + hterminalTree K missingTree starredEq + rcases corrT with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have hs : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases hs + let a : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have ha : a.succ = Fin.last ett.rounds := by + apply Fin.ext + change ett.rounds - 1 + 1 = ett.rounds + have := ett.roundsPositive + omega + have ht : replacementSeries.data.tree (Fin.last ett.rounds).castSucc = Tn := by + change replacementSeries.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc + rw [← ha] + exact ladderTreesAgree a + have hm : TreeMissingColors (replacementSeries.data.coloring (Fin.last ett.rounds)) + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi Tn := by + rw [← finalGeneratingColoring, ht] + exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnA) + have hmOld : TreeMissingColors (ett.series.data.coloring (Fin.last ett.rounds)) + (ett.series.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi Tn := by + rw [← ett.generatingColoring] + refine ⟨extensionKindsAgree (Fin.last ett.rounds), ?_⟩ + change TashkinovStoredColors replacementSeries.data (Fin.last ett.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) + simp only [TashkinovStoredColors, storedColorsAgree, hm, hmOld] + +private theorem helper_hfirstA_654.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let y : V := T.vertex (Fin.last T.length); + ∀ (alpha theta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + ∀ + (_ : + (IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f)) + (c : Fin k), + HierarchyFirstMissingPosition sigma A c = HierarchyFirstMissingPosition phi A c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n y alpha theta sigma hstableA c + have hsets : + (Finset.univ.filter fun j : Fin (A.length + 1) => + c ∈ MissingColors G sigma (A.vertex j)) = + (Finset.univ.filter fun j : Fin (A.length + 1) => + c ∈ MissingColors G phi (A.vertex j)) := by + ext j + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + have hv : A.vertex j ∈ TreeSequenceVertexSet A := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + rw [hstableA.2.2.2.1.2 _ hv] + unfold HierarchyFirstMissingPosition + rw [hsets] + +private theorem helper_branch_654.{u_1, u_2} : + helperBranch654Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H q i A n Tn hAT y alpha halphaA + halphay gamma eta theta hthetaPair hthetaNew x hthetax hthetaA hthetaClosed hthetaGamma + stepInterchange hthetaAlpha hcomponentOutside sigma hrecolorA hstableA hstableLadder hmod + hfixedEdges hsigmaRoute corrT hmaximumT hnotElementarySigma hrecolorPrefix positivePrefix + abovePrefix strictPrefix belowPrefix generatingPrefix basePrefix HP goodPrefix + hprefixTransport corrPrefix hmaximumPrefixSigma basePrefixSigma KP goodPrefixSigma + hsamePrefixSigma hminusPrefixSigma baseT hcoreTA hclosureTA hsupportTA hcoreT hterminalTree + K missingTree starredEq terminalColors storedEq stageMissingEq firstBound c hswap hc + have hcA : c ∈ TreeMissingColors phi A := by + rcases hc with rfl | rfl + · exact hthetaA + · exact halphaA + have hcsA : c ∈ TreeMissingColors sigma A := by + rw [missingTree A (fun _ h => h)] + exact hcA + have hfirstA : HierarchyFirstMissingPosition sigma A c = + HierarchyFirstMissingPosition phi A c := by + exact @helper_hfirstA_654 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C alpha theta hstableA c + have hcutPhi := HierarchyFirstMissingPositionPrefixCutoff phi A T hAT c A.length le_rfl + have hcutSigma := HierarchyFirstMissingPositionPrefixCutoff sigma A T hAT c A.length le_rfl + rw [hfirstA] at hcutSigma + have hp := firstBound phi c hcA + have hs := firstBound sigma c hcsA + apply Fin.ext + omega + +private theorem helper_branch_1000.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k), + let y : V := T.vertex (Fin.last T.length); + ∀ (alpha theta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + ∀ (c : Fin k) + (_ : + (have C : Set (V ⊕ E) := TwoColorComponent G phi theta alpha (Sum.inl y); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + theta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + alpha ∈ MissingColors G phi v → theta ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ theta → + c ≠ alpha → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v))) + (_ : ¬(c = theta ∨ c = alpha)), + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition phi T c := by + classical + intro V E _ _ G k e0 T phi y alpha theta sigma c hswap hc + let _ := Fintype.ofFinite V + have hct : c ≠ theta := fun h => hc (Or.inl h) + have hca : c ≠ alpha := fun h => hc (Or.inr h) + have hsets : + (Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G sigma (T.vertex j)) = + (Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex j)) := by + ext j + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hswap.2.2.2 _ c hct hca + unfold HierarchyFirstMissingPosition + rw [hsets] + +private theorem helper_firstMissingEq_961.{u_1, u_2} : + helperFirstMissingEq961Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hpositive H q i A n Tn hAT y alpha + halphaA halphay gamma eta theta hthetaPair hthetaNew x hthetax hthetaA hthetaClosed + hthetaGamma stepInterchange hthetaAlpha hcomponentOutside sigma hrecolorA hstableA + hstableLadder hmod hfixedEdges hsigmaRoute corrT hmaximumT hnotElementarySigma + hrecolorPrefix positivePrefix abovePrefix strictPrefix belowPrefix generatingPrefix + basePrefix HP goodPrefix hprefixTransport corrPrefix hmaximumPrefixSigma basePrefixSigma KP + goodPrefixSigma hsamePrefixSigma hminusPrefixSigma corrA baseT hcoreTA hclosureTA + hsupportTA hcoreT hterminalTree K missingTree starredEq terminalColors storedEq + stageMissingEq firstBound c + have hswap := TwoColorComponentSwapMissingBehavior G phi theta alpha + hthetaAlpha hproper (Sum.inl y) + by_cases hc : c = theta ∨ c = alpha + · exact @helper_branch_654 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C hpositive hAT alpha halphaA halphay gamma eta theta hthetaPair + hthetaNew x hthetax hthetaA hthetaClosed hthetaGamma stepInterchange hthetaAlpha + hcomponentOutside hrecolorA hstableA hstableLadder hmod hfixedEdges hsigmaRoute corrT + hmaximumT hnotElementarySigma hrecolorPrefix positivePrefix abovePrefix strictPrefix + belowPrefix generatingPrefix basePrefix HP goodPrefix hprefixTransport corrPrefix + hmaximumPrefixSigma basePrefixSigma KP goodPrefixSigma hsamePrefixSigma hminusPrefixSigma + baseT hcoreTA hclosureTA hsupportTA hcoreT hterminalTree missingTree starredEq + terminalColors storedEq stageMissingEq firstBound c hswap hc + · exact @helper_branch_1000 V E inferInstance inferInstance G k e0 T phi alpha theta c hswap hc +private theorem helper_stagesNested_818.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) + (_ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) + (a b : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑a : ℕ) ≤ (↑b : ℕ)), + TreeSequenceInitialSegment (H.stage a) (H.stage b) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H segmentTrans + have chain : ∀ r : ℕ, ∀ a : Fin (H.dividerCount + 2), + ∀ hr : a.val + r < H.dividerCount + 2, + TreeSequenceInitialSegment (H.stage a) (H.stage ⟨a.val + r, hr⟩) := by + intro r + induction r with + | zero => + intro a hr + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ r ih => + intro a hr + have hprev := ih a (by omega) + have hstep := H.nested ⟨a.val + r, by omega⟩ + exact segmentTrans hprev hstep + intro a b hab + have h := chain (b.val - a.val) a (by omega) + have he : (⟨a.val + (b.val - a.val), by omega⟩ : + Fin (H.dividerCount + 2)) = b := by + apply Fin.ext + change a.val + (b.val - a.val) = b.val + omega + rw [he] at h + exact h + +private theorem helper_hvertices_896.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : T.length = A.length + (1 : ℕ)) (_ : TreeSequenceInitialSegment A T), + let y : V := T.vertex (Fin.last T.length); + TreeSequenceVertexSet T = insert y (TreeSequenceVertexSet A) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H q A hlen hAT y + ext v + constructor + · intro hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨j, rfl⟩ := hv + by_cases hj : j.val ≤ A.length + · apply Finset.mem_insert_of_mem + let ja : Fin (A.length + 1) := ⟨j.val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hAT.1) ja = j := Fin.ext rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨ja, by rw [← hAT.2.1 ja, he]⟩ + · have he : j = Fin.last T.length := by + apply Fin.ext + simp only [Fin.val_last] + omega + rw [he] + exact Finset.mem_insert_self _ _ + · intro hv + rcases Finset.mem_insert.mp hv with rfl | hv + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last T.length, rfl⟩ + · exact TreeSequenceInitialSegmentVertexSetSubset hAT hv + +private theorem helper_terminalRoute_936.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (j : Fin (ett.rounds + (1 : ℕ))), + (0 : ℕ) < (↑j : ℕ) → + ett.series.data.kind j = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring j) + (ett.series.data.tree j.castSucc) (ett.series.data.tree j.succ) ∨ + (ett.series.data.kind j = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind j = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges j = { edge } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree j.castSucc) edge seed ∧ + TashkinovAugmentationSequence (ett.series.data.coloring j) seed + (ett.series.data.tree j.succ) := by + classical + intro V E _ _ _ G k e0 input T phi ett j hj + have cert := ett.series.certified j + cases cert with + | initial => simp at hj + | SE a previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact Or.inr ⟨Or.inl currentKind, choice.edge, adjoined, + currentEdges, adjoinedExactly, closedExtension.1⟩ + | PE a previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact Or.inl ⟨currentKind, closedExtension.1⟩ + | RE a previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact Or.inr ⟨Or.inr currentKind, available.edge, adjoined, + currentEdges, adjoinedExactly, closedExtension.1⟩ + +private theorem helper_firstMissingAfter_1042.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : T.length = A.length + (1 : ℕ)) (_ : TreeSequenceInitialSegment A T), + ∀ eta ∉ TreeMissingColors phi A, + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) = T.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H q A hlen hAT eta heta + unfold HierarchyFirstMissingPosition + dsimp only + split + · rename_i hc + let candidates : Finset (Fin (T.length + 1)) := + Finset.univ.filter fun j => eta ∈ MissingColors G phi (T.vertex j) + let p := candidates.min' hc + have hp := (Finset.mem_filter.mp (Finset.min'_mem candidates hc)).2 + have hpgt : A.length < p.val := by + by_contra hle + let pa : Fin (A.length + 1) := ⟨p.val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hAT.1) pa = p := Fin.ext rfl + apply heta + refine Finset.mem_biUnion.mpr ⟨A.vertex pa, + ?_, ?_⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨pa, rfl⟩ + · rw [← hAT.2.1 pa, he] + exact hp + have hplt := p.isLt + change p.val = T.length + omega + · rfl + +private theorem helper_hthetaAlpha_1167.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : IsProperEdgeColoring G phi) (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (hlen : T.length = A.length + (1 : ℕ)), + let r : Fin T.length := (⟨A.length, by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := T.vertex (Fin.last T.length); + ∀ (_ : y ∉ TreeSequenceVertexSet A), + ∀ alpha ∈ MissingColors G phi y, + ∀ gamma ∈ TreeMissingColors phi A, + phi f = some gamma → + (∃ u ∈ TreeSequenceVertexSet A, G.ends f = s(u, y)) → + ∀ theta ∈ TreeMissingColors phi A, + theta ≠ gamma → + (∀ (psi : PartialEdgeColoring E k), + IsProperEdgeColoring G psi → + ∀ (c d : Fin k), + c ≠ d → + c ∈ TreeMissingColors psi A → + d ∈ TreeMissingColors psi A → + ∀ w ∉ TreeSequenceVertexSet A, + c ∈ MissingColors G psi w ∨ d ∈ MissingColors G psi w → + TreeInterchangeable G A psi c d → + ∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G psi c d (Sum.inl w)) → + (∀ (beta : Fin k), theta ≠ beta → TreeInterchangeable G A phi theta beta) → + theta ≠ alpha := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hpositive H q A hlen r f y hyOutside + alpha halphay gamma hgammaA hgammaf hfEnds theta hthetaA hthetaGamma + outsideMissingComponent stepInterchange he + have hthetay : theta ∈ MissingColors G phi y := by rw [he]; exact halphay + have hout := outsideMissingComponent phi hproper theta gamma hthetaGamma hthetaA hgammaA + y hyOutside (Or.inl hthetay) (stepInterchange gamma hthetaGamma) + obtain ⟨u, huA, hends⟩ := hfEnds + have hyf : (TwoColorIncidenceGraph G phi theta gamma).Adj (Sum.inl y) (Sum.inr f) := by + refine ⟨?_, Or.inr hgammaf⟩ + change y ∈ G.ends f + rw [hends] + exact Sym2.mem_mk_right _ _ + have hfu : (TwoColorIncidenceGraph G phi theta gamma).Adj (Sum.inr f) (Sum.inl u) := by + refine ⟨?_, Or.inr hgammaf⟩ + change u ∈ G.ends f + rw [hends] + exact Sym2.mem_mk_left _ _ + apply hout u huA + change (TwoColorIncidenceGraph G phi theta gamma).connectedComponentMk (Sum.inl u) = + (TwoColorIncidenceGraph G phi theta gamma).connectedComponentMk (Sum.inl y) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hfu).symm.trans + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hyf).symm + +private theorem helper_missingFirstInA_1204.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : TreeSequenceInitialSegment A T), + ∀ c ∈ TreeMissingColors phi A, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + T.vertex (HierarchyFirstMissingPosition phi T c) ∈ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hAT c hc + obtain ⟨v, hvA, hcv⟩ := Finset.mem_biUnion.mp hc + obtain ⟨j, hj⟩ : ∃ j, A.vertex j = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hvA + let jt := Fin.castLE (Nat.succ_le_succ hAT.1) j + let candidates := Finset.univ.filter fun p : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex p) + have hjmem : jt ∈ candidates := by + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩ + rw [hAT.2.1 j, hj] + exact hcv + have hnonempty : candidates.Nonempty := ⟨jt, hjmem⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hnonempty] + refine ⟨(Finset.mem_filter.mp (Finset.min'_mem candidates hnonempty)).2, ?_⟩ + have hp := Finset.min'_le candidates jt hjmem + have hpBound : (candidates.min' hnonempty).val < A.length + 1 := + lt_of_le_of_lt hp j.isLt + let pa : Fin (A.length + 1) := ⟨(candidates.min' hnonempty).val, hpBound⟩ + have he : Fin.castLE (Nat.succ_le_succ hAT.1) pa = candidates.min' hnonempty := + Fin.ext rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨pa, by rw [← he, hAT.2.1 pa]⟩ + +private theorem helper_hfixedEdges_1244.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ (hlen : T.length = A.length + (1 : ℕ)) (_ : TreeSequenceInitialSegment A T), + let r : Fin T.length := (⟨A.length, by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := T.vertex (Fin.last T.length); + ∀ (alpha : Fin k) (_ : (∃ u ∈ TreeSequenceVertexSet A, G.ends f = s(u, y))) + (_ theta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + ∀ + (_ : + (IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f)) + (t : Fin T.length), + sigma (T.edge t) = phi (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H q A n hlen hAT r f y alpha hfEnds + eta theta sigma hstableA t + apply hstableA.2.2.2.2 + by_cases ht : t.val < A.length + · let ta : Fin A.length := ⟨t.val, ht⟩ + have he : Fin.castLE hAT.1 ta = t := Fin.ext rfl + obtain ⟨j, hj⟩ := A.attaches ta + refine ⟨A.vertex ta.succ, ?_, ?_⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨ta.succ, rfl⟩ + · change A.vertex ta.succ ∈ G.ends (T.edge t) + rw [← he, hAT.2.2 ta, hj] + exact Sym2.mem_mk_left _ _ + · have he : t = r := by + apply Fin.ext + have := t.isLt + dsimp [r] + omega + rw [he] + obtain ⟨u, huA, hends⟩ := hfEnds + refine ⟨u, huA, ?_⟩ + change u ∈ G.ends f + rw [hends] + exact Sym2.mem_mk_left _ _ + +private theorem helper_hterminalTree_1357.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let y : V := T.vertex (Fin.last T.length); + ∀ (alpha _ theta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (_ : MaximumProperty corrT.replacementETT) (positivePrefix : (1 : ℕ) ≤ ett.rounds) + (abovePrefix : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (H.stage q.castSucc)) + (strictPrefix : + (ett.series.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + (H.stage q.castSucc).length) + (belowPrefix : + TreeSequenceInitialSegment (H.stage q.castSucc) + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (generatingPrefix : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (basePrefix : + HierarchyBase + { rounds := ett.rounds, roundsPositive := positivePrefix, series := ett.series, + abovePenultimate := abovePrefix, strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + phi) + (_ : + TashkinovHierarchy + { rounds := ett.rounds, roundsPositive := positivePrefix, series := ett.series, + abovePenultimate := abovePrefix, strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + basePrefix) + (corrPrefix : + CorrespondingExtendedTashkinovTree G k e0 + { rounds := ett.rounds, roundsPositive := positivePrefix, series := ett.series, + abovePenultimate := abovePrefix, strictAbovePenultimate := strictPrefix, + belowFinal := belowPrefix, generatingColoring := generatingPrefix : + ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi } + sigma (H.stage q.castSucc)) + (basePrefixSigma : HierarchyBase corrPrefix.replacementETT sigma), + let _ : CorrespondingExtendedTashkinovTree G k e0 ett sigma (H.stage q.castSucc) := + { replacementInput := corrPrefix.replacementInput, + replacementSeries := corrPrefix.replacementSeries, + replacementETT := corrPrefix.replacementETT, + rungAgreement := corrPrefix.rungAgreement, + seriesPresentation := corrPrefix.seriesPresentation, + finalGeneratingColoring := corrPrefix.finalGeneratingColoring, + ladderTreesAgree := corrPrefix.ladderTreesAgree, + storedColorsAgree := corrPrefix.storedColorsAgree, + connectingEdgesAgree := corrPrefix.connectingEdgesAgree, + extensionKindsAgree := corrPrefix.extensionKindsAgree, + replacementProper := corrPrefix.replacementProper, + replacementOneUncolored := corrPrefix.replacementOneUncolored, + replacementStable := corrPrefix.replacementStable : + CorrespondingExtendedTashkinovTree G k e0 ett sigma (H.stage q.castSucc) }; + ∀ (baseT : HierarchyBase corrT.replacementETT sigma) + (_ : baseT.core = basePrefixSigma.core) (_ : baseT.closure = basePrefixSigma.closure) + (_ : (↑baseT.supportPosition : ℕ) = (↑basePrefixSigma.supportPosition : ℕ)) + (_ : baseT.core = base.core), + corrT.replacementETT.series.data.tree (Fin.last corrT.replacementETT.rounds).castSucc = + Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H q n Tn y alpha eta theta sigma + corrT hmaximumT positivePrefix abovePrefix strictPrefix belowPrefix generatingPrefix + basePrefix HP corrPrefix basePrefixSigma corrA baseT hcoreTA hclosureTA hsupportTA hcoreT + rcases corrT with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have hs : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases hs + let lastRung : Fin ett.rounds := ⟨ett.rounds - 1, by + have := ett.roundsPositive + omega⟩ + have he : lastRung.succ = Fin.last ett.rounds := by + apply Fin.ext + change ett.rounds - 1 + 1 = ett.rounds + have := ett.roundsPositive + omega + change replacementSeries.data.tree (Fin.last ett.rounds).castSucc = Tn + change replacementSeries.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc + rw [← he] + exact ladderTreesAgree lastRung + +private theorem helper_equalTrees_1506.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + X.length = Y.length → + X = Y := by + classical + intro V E G e0 X Y hXY hlenXY + rcases hXY with ⟨hle, hv, he⟩ + cases X with + | mk lx px vx ex vix eix fx ax => + cases Y with + | mk ly py vy ey viy eiy fy ay => + simp only at hlenXY + subst ly + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext j + simpa only [Fin.castLE] using (hv j).symm + · apply heq_of_eq + funext j + simpa only [Fin.castLE] using (he j).symm + +private theorem helper_hcommon_1589.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A)), + let y : V := T.vertex (Fin.last T.length); + ∀ (_ : TreeSequenceVertexSet T = insert y (TreeSequenceVertexSet A)), + ∃ alpha ∈ TreeMissingColors phi A, + alpha ∈ MissingColors G phi y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hAElem y hvertices + have hnot := C.notElementary + unfold ColoredVertexSetElementary at hnot + push Not at hnot + obtain ⟨u, hu, v, hv, huv, hdisjoint⟩ := hnot + obtain ⟨alpha, hau, hav⟩ := Finset.not_disjoint_iff.mp hdisjoint + rw [hvertices] at hu hv + rcases Finset.mem_insert.mp hu with rfl | hu + · have hvA : v ∈ TreeSequenceVertexSet A := + (Finset.mem_insert.mp hv).resolve_left (Ne.symm huv) + exact ⟨alpha, Finset.mem_biUnion.mpr ⟨v, hvA, hav⟩, hau⟩ + · rcases Finset.mem_insert.mp hv with rfl | hv + · exact ⟨alpha, Finset.mem_biUnion.mpr ⟨u, hu, hau⟩, hav⟩ + · exact False.elim (Finset.disjoint_left.mp (hAElem hu hv huv) hau hav) + +private theorem helper_hAtoT_1620.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Tnext : TreeSequence G e0 := ett.series.data.tree n.succ; + ∀ + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) + (_ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) + (_ : TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), + TreeSequenceInitialSegment X Y)) + (_ : TreeSequenceInitialSegment A T) (_ : TreeSequenceInitialSegment Tn A) + (_ : Tn.length < A.length) (_ : TreeSequenceInitialSegment T Tnext) + (_ : TreeSequenceInitialSegment A Tnext) + (_ : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi (ett.series.data.tree n.castSucc) + (ett.series.data.tree n.succ) ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree n.castSucc) edge seed ∧ + TashkinovAugmentationSequence phi seed (ett.series.data.tree n.succ))), + TashkinovAugmentationSequence phi A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H q A n Tn Tnext segmentTrans + commonPrefix hAT hTnA hTnStrictA hTTnext hATnext hroute + rcases hroute with ⟨hkind, hseq⟩ | ⟨hkind, edge, seed, hedges, hseed, hseq⟩ + · have hTnT := segmentTrans hTnA hAT + have htoT := TashkinovAugmentationSequenceRestrict phi Tn T Tnext + hseq hTnT hTTnext + exact TashkinovAugmentationSequenceSuffix phi Tn A T htoT hTnA hAT + · have hseedFinal := TashkinovAugmentationSequenceInitialSegment phi seed Tnext hseq + have hseedA : TreeSequenceInitialSegment seed A := + commonPrefix hseedFinal hATnext (by + have hseedLen : seed.length = Tn.length + 1 := hseed.1 + omega) + have hseedT := segmentTrans hseedA hAT + have htoT := TashkinovAugmentationSequenceRestrict phi seed T Tnext + hseq hseedT hTTnext + exact TashkinovAugmentationSequenceSuffix phi seed A T htoT hseedA hAT + +private theorem helper_hfEnds_1651.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (hlen : T.length = A.length + (1 : ℕ)) (_ : TreeSequenceInitialSegment A T), + let r : Fin T.length := (⟨A.length, by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := T.vertex (Fin.last T.length); + ∃ u ∈ TreeSequenceVertexSet A, + G.ends f = s(u, y) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H q A hlen hAT r f y + obtain ⟨a, ha⟩ := T.attaches r + let aa : Fin (A.length + 1) := ⟨a.val, by have := a.isLt; dsimp [r] at this; omega⟩ + have hv : T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt))) = A.vertex aa := by + have he : Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt)) = + Fin.castLE (Nat.succ_le_succ hAT.1) aa := Fin.ext rfl + rw [he] + exact hAT.2.1 aa + have hr : r.succ = Fin.last T.length := by + apply Fin.ext + change A.length + 1 = T.length + exact hlen.symm + have he : G.ends f = Sym2.mk y (A.vertex aa) := by + simpa only [f, hr, hv] using ha + have haa : A.vertex aa ∈ TreeSequenceVertexSet A := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨aa, rfl⟩ + exact ⟨A.vertex aa, haa, he.trans Sym2.eq_swap⟩ + +private theorem helper_hgammaTerminalExcluded_1690.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (hlen : T.length = A.length + (1 : ℕ)), + let r : Fin T.length := (⟨A.length, by omega⟩ : Fin T.length); + let f : E := T.edge r; + ∀ (gamma : Fin k) (_ : phi f = some gamma) + (_ : + (∀ eta ∉ TreeMissingColors phi A, + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) = T.length)), + ∀ eta ∈ HierarchyStoredColorsAt H q, + gamma ∉ C.good.gamma q eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H q A hlen r f gamma hgammaf + firstMissingAfter eta heta hgamma + have hetaMissing : eta ∉ TreeMissingColors phi A := + (Finset.mem_sdiff.mp heta).2 + have hcutoff := firstMissingAfter eta hetaMissing + have hseg : gamma ∈ HierarchySegmentColors H q eta := by + unfold HierarchySegmentColors + dsimp only + have ht : H.stage q.succ = T := H.terminalStage + rw [ht] + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, r, le_rfl, ?_, hgammaf⟩ + rw [hcutoff] + dsimp [r] + omega + exact (Finset.mem_sdiff.mp (C.good.avoidance q eta heta hgamma)).2 hseg + +private theorem helper_missingLeaf_1742.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (hpositive : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let i : Fin H.dividerCount := + (⟨H.dividerCount - (1 : ℕ), + id + (fun (hpositive : (0 : ℕ) < H.dividerCount) ↦ + Decidable.byContradiction + fun (a : ¬H.dividerCount - (1 : ℕ) < H.dividerCount) ↦ by omega) + hpositive⟩ : + Fin H.dividerCount); + ∀ (eta : Fin k) (_ : (C.good.gamma i.succ eta).card = (2 : ℕ)) + (_ : + (∀ (psi : PartialEdgeColoring E k) (c d : Fin k), + TwoColorIncidenceGraph G psi c d = TwoColorIncidenceGraph G psi d c)) + (psi : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G psi) (c d : Fin k) + (_ : c ≠ d) (v : V) (_ : c ∈ MissingColors G psi v ∨ d ∈ MissingColors G psi v), + ((TwoColorIncidenceGraph G psi c d).neighborSet (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H i eta hcard graphSwap psi hpsi c d + hcd v hc + let : Fintype ((TwoColorIncidenceGraph G psi c d).neighborSet (Sum.inl v)) := + Fintype.ofFinite _ + have hdegree : @SimpleGraph.degree _ (TwoColorIncidenceGraph G psi c d) + (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hc with hc | hc + · exact MissingColorIncidenceEndpoint G psi c d hcd hpsi v hc + · rw [graphSwap psi c d] + exact MissingColorIncidenceEndpoint G psi d c hcd.symm hpsi v hc + have hcard : Fintype.card + ((TwoColorIncidenceGraph G psi c d).neighborSet (Sum.inl v)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hdegree + intro z hz w hw + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hcard ⟨z, hz⟩ ⟨w, hw⟩) + +private theorem helper_hsigmaRoute_1829.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Tnext : TreeSequence G e0 := ett.series.data.tree n.succ; + ∀ (_ : T.length = A.length + (1 : ℕ)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) + (_ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) + (_ : TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), + TreeSequenceInitialSegment X Y)) + (_ : TreeSequenceInitialSegment A T) (_ : TreeSequenceInitialSegment Tn A) + (_ : Tn.length < A.length) (_ : TreeSequenceInitialSegment T Tnext) + (_ : TreeSequenceInitialSegment A Tnext), + let y : V := T.vertex (Fin.last T.length); + ∀ (alpha : Fin k) + (_ : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi (ett.series.data.tree n.castSucc) + (ett.series.data.tree n.succ) ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree n.castSucc) edge seed ∧ + TashkinovAugmentationSequence phi seed (ett.series.data.tree n.succ))) + (_ theta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + ∀ + (_ : + (IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f)) + (_ : (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t))), + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ TashkinovAugmentationSequence sigma seed T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpositive H q A n Tn Tnext hlen segmentTrans + commonPrefix hAT hTnA hTnStrictA hTTnext hATnext y alpha hroute eta theta sigma hstableA + hfixedEdges + rcases hroute with ⟨hkind, hseq⟩ | ⟨hkind, edge, seed, hedges, hseed, hseq⟩ + · have hTnT := segmentTrans hTnA hAT + have htoT := TashkinovAugmentationSequenceRestrict phi Tn T Tnext + hseq hTnT hTTnext + exact Or.inl ⟨hkind, TashkinovAugmentationSequenceColoringTransport + phi sigma Tn A T htoT hAT hlen (fun t _ => hfixedEdges t) + hstableA.2.2.2.1.2⟩ + · have hseedFinal := TashkinovAugmentationSequenceInitialSegment phi seed Tnext hseq + have hseedA : TreeSequenceInitialSegment seed A := + commonPrefix hseedFinal hATnext (by + have hseedLen : seed.length = Tn.length + 1 := hseed.1 + omega) + have htoT := TashkinovAugmentationSequenceRestrict phi seed T Tnext + hseq (segmentTrans hseedA hAT) hTTnext + exact Or.inr ⟨hkind, edge, seed, hedges, hseed, + TashkinovAugmentationSequenceColoringTransport phi sigma seed A T + htoT hAT hlen (fun t _ => hfixedEdges t) hstableA.2.2.2.1.2⟩ + +private theorem helper_hnotElementarySigma_1858.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : IsProperEdgeColoring G phi), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ (_ : TreeSequenceInitialSegment A T), + let y : V := T.vertex (Fin.last T.length); + ∀ (_ : y ∉ TreeSequenceVertexSet A), + ∀ alpha ∈ MissingColors G phi y, + ∀ (theta : Fin k) (x : V), + theta ∈ MissingColors G phi x → + x ∈ TreeSequenceVertexSet A → + theta ≠ alpha → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + (IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) → + ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper H q A n hAT y hyOutside alpha halphay + theta x hthetax hxA hthetaAlpha sigma hstableA + have hswap := TwoColorComponentSwapMissingBehavior G phi theta alpha + hthetaAlpha hproper (Sum.inl y) + have hthetay : theta ∈ MissingColors G sigma y := hswap.2.2.1 y rfl halphay + have hthetaxSigma : theta ∈ MissingColors G sigma x := by + rw [hstableA.2.2.2.1.2 x hxA] + exact hthetax + have hxT := TreeSequenceInitialSegmentVertexSetSubset hAT hxA + have hyT : y ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last T.length, rfl⟩ + have hxy : x ≠ y := fun he => hyOutside (he ▸ hxA) + intro helem + exact Finset.disjoint_left.mp (helem hxT hyT hxy) hthetaxSigma hthetay + +private theorem helper_firstBound_1983.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : TreeSequenceInitialSegment A T) (psi : PartialEdgeColoring E k), + ∀ c ∈ TreeMissingColors psi A, + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) ≤ A.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hAT psi c hc + obtain ⟨v, hvA, hcv⟩ := Finset.mem_biUnion.mp hc + obtain ⟨j, hj⟩ : ∃ j, A.vertex j = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hvA + let jt := Fin.castLE (Nat.succ_le_succ hAT.1) j + let candidates := Finset.univ.filter fun p : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex p) + have hjmem : jt ∈ candidates := by + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩ + rw [hAT.2.1 j, hj] + exact hcv + have hn : candidates.Nonempty := ⟨jt, hjmem⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact le_trans (Finset.min'_le candidates jt hjmem) (Nat.le_of_lt_succ j.isLt) + +private theorem helper_boundaryEq_2016.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let y : V := T.vertex (Fin.last T.length); + ∀ (alpha theta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + ∀ + (_ : + (IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f)) + (B : TreeSequence G e0) (_ : TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet A) + (c : Fin k), + BoundaryColorEdges G sigma (TreeSequenceVertexSet B) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet B) c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n y alpha theta sigma hstableA B hBA c + ext edge + simp only [BoundaryColorEdges, Finset.mem_filter] + have hfixed : edge ∈ BoundaryEdges G (TreeSequenceVertexSet B) → sigma edge = phi edge := by + intro he + obtain ⟨u, hu, v, hv, hends⟩ := by simpa [BoundaryEdges] using he + apply hstableA.2.2.2.2 + refine ⟨u, hBA hu, ?_⟩ + change u ∈ G.ends edge + rw [hends] + exact Sym2.mem_mk_left _ _ + constructor <;> rintro ⟨he, hc⟩ + · exact ⟨he, by rw [← hfixed he]; exact hc⟩ + · exact ⟨he, by rw [hfixed he]; exact hc⟩ + +private theorem helper_continuation_2653.{u_1, u_2} : + helperContinuation2653Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hlower hfewer hminimal hlarge hpositive + H q A n Tn hlen commonPrefix equalTrees hAT hTnA prefixSegment hAElem r f y hyOutside alpha + halphay gamma hgammaA hgammaf hfEnds eta theta hthetaA hthetaClosed hthetaGamma + outsideMissingComponent hthetaAlpha sigma hstableA missingFirstInA hfixedEdges corrT + hmaximumT hnotElementarySigma positivePrefix abovePrefix strictPrefix belowPrefix + generatingPrefix corrPrefix basePrefixSigma baseT hcoreT hterminalTree K missingTree + stageInsideA coreInsideA starredEq terminalColors storedEq stageMissingEq firstMissingEq + segmentEq boundaryEq minusEq closureEq goodT + let Cs : HierarchyCounterexample baseT := by + exact { + positive := by rw [corrT.rungAgreement]; exact C.positive + hierarchy := K + good := goodT + maximum := hmaximumT + notElementary := hnotElementarySigma } + have hstarK : HierarchyStarredStage K (Fin.last K.dividerCount) = A := starredEq q + have pathNumberEq : HierarchyPathNumber K = HierarchyPathNumber H := by + unfold HierarchyPathNumber + dsimp only + rw [starredEq q] + have measureEq : HierarchyCounterexampleMeasure Cs = HierarchyCounterexampleMeasure C := by + change (HierarchyPathNumber K, + T.length - (K.stage ⟨K.dividerCount, by omega⟩).length) = + (HierarchyPathNumber H, + T.length - (H.stage ⟨H.dividerCount, by omega⟩).length) + rw [pathNumberEq] + have hAElemSigma : ColoredVertexSetElementary G sigma (TreeSequenceVertexSet A) := by + intro u hu v hv huv + rw [hstableA.2.2.2.1.2 u hu, hstableA.2.2.2.1.2 v hv] + exact hAElem hu hv huv + have hprefixK : + TreeSequencePrefix T + (min ((HierarchyStarredStage K (Fin.last K.dividerCount)).length + + (T.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length - 1)) + T.length) + (by + have := (HierarchyStarredStage K (Fin.last K.dividerCount)).positive + have := T.positive + omega) + (Nat.min_le_right _ _) = A := by + have hlengthStar := congrArg TreeSequence.length hstarK + apply equalTrees + · apply commonPrefix (prefixSegment _ _ _) hAT + change min ((HierarchyStarredStage K (Fin.last K.dividerCount)).length + + (T.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length - 1)) + T.length ≤ A.length + omega + · change min ((HierarchyStarredStage K (Fin.last K.dividerCount)).length + + (T.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length - 1)) + T.length = A.length + omega + have hprefixSigma : + let A' := HierarchyStarredStage K (Fin.last K.dividerCount) + let ell' := T.length - A'.length + let U := TreeSequencePrefix T + (min (A'.length + (ell' - 1)) T.length) + (by have := A'.positive; have := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet U) := by + dsimp only + rw [hprefixK] + exact hAElemSigma + have hlargeSigma : 2 * corrT.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc)).card := by + rw [hterminalTree, missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnA), + corrT.rungAgreement] + exact hlarge + have hthetaSigmaA : theta ∈ TreeMissingColors sigma A := by + rw [missingTree A (fun _ h => h)] + exact hthetaA + have hgammaSigmaA : gamma ∈ TreeMissingColors sigma A := by + rw [missingTree A (fun _ h => h)] + exact hgammaA + have hthetaClosedSigma : TreeColorSetClosed G sigma A {theta} := by + intro c hc + rw [boundaryEq A (fun _ h => h) c] + exact hthetaClosed c hc + have hresult := ChangeLemmaBothInside G k e0 corrT.replacementInput T sigma + corrT.replacementETT baseT Cs hstableA.1 hstableA.2.1 + (fun lower hp hl hm => + hlower lower hp (lt_of_lt_of_eq hl corrT.rungAgreement) hm) + (fun other hr hm b J g hj => + hfewer other (hr.trans corrT.rungAgreement) hm b J g hj) + (fun C' hr hq => by + rw [measureEq] + exact hminimal C' (hr.trans corrT.rungAgreement) hq) + hprefixSigma hlargeSigma theta gamma hthetaGamma + (by + dsimp only + change theta ∈ TreeMissingColors sigma + (TreeSequencePrefix T + (min ((HierarchyStarredStage K (Fin.last K.dividerCount)).length + + (T.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length - 1)) + T.length) _ _) ∧ + gamma ∈ TreeMissingColors sigma + (TreeSequencePrefix T + (min ((HierarchyStarredStage K (Fin.last K.dividerCount)).length + + (T.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length - 1)) + T.length) _ _) + rw [hprefixK] + exact ⟨hthetaSigmaA, hgammaSigmaA⟩) + (by + dsimp only + change (theta ∉ TreeMissingColors sigma + (HierarchyStarredStage K (Fin.last K.dividerCount)) ∨ + gamma ∉ TreeMissingColors sigma + (HierarchyStarredStage K (Fin.last K.dividerCount))) → _ + rw [hstarK] + intro hbad + exact False.elim (hbad.elim (fun h => h hthetaSigmaA) (fun h => h hgammaSigmaA))) + (by + change T.vertex (HierarchyFirstMissingPosition sigma T theta) ∈ + TreeSequenceVertexSet (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ + T.vertex (HierarchyFirstMissingPosition sigma T gamma) ∈ + TreeSequenceVertexSet (HierarchyStarredStage K (Fin.last K.dividerCount)) + rw [hstarK, firstMissingEq theta, firstMissingEq gamma] + exact ⟨(missingFirstInA theta hthetaA).2, (missingFirstInA gamma hgammaA).2⟩) + have hinterSigma : TreeInterchangeable G A sigma theta gamma := by + have hh := hresult.2.2 + change (theta ∈ TreeMissingColors sigma (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ + TreeColorSetClosed G sigma (HierarchyStarredStage K (Fin.last K.dividerCount)) {theta}) → _ + at hh + rw [hstarK] at hh + exact (hh ⟨hthetaSigmaA, hthetaClosedSigma⟩).2 + have hswap := TwoColorComponentSwapMissingBehavior G phi theta alpha + hthetaAlpha hproper (Sum.inl y) + have hthetaySigma : theta ∈ MissingColors G sigma y := hswap.2.2.1 y rfl halphay + have hout := outsideMissingComponent sigma hstableA.1 theta gamma hthetaGamma + hthetaSigmaA hgammaSigmaA y hyOutside (Or.inl hthetaySigma) hinterSigma + have hgammafSigma : sigma f = some gamma := (hfixedEdges r).trans hgammaf + obtain ⟨u, huA, hends⟩ := hfEnds + have hyf : (TwoColorIncidenceGraph G sigma theta gamma).Adj (Sum.inl y) (Sum.inr f) := by + refine ⟨?_, Or.inr hgammafSigma⟩ + change y ∈ G.ends f + rw [hends] + exact Sym2.mem_mk_right _ _ + have hfu : (TwoColorIncidenceGraph G sigma theta gamma).Adj (Sum.inr f) (Sum.inl u) := by + refine ⟨?_, Or.inr hgammafSigma⟩ + change u ∈ G.ends f + rw [hends] + exact Sym2.mem_mk_left _ _ + apply hout u huA + change (TwoColorIncidenceGraph G sigma theta gamma).connectedComponentMk (Sum.inl u) = + (TwoColorIncidenceGraph G sigma theta gamma).connectedComponentMk (Sum.inl y) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hfu).symm.trans + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hyf).symm + +private theorem helper_continuation_2177.{u_1, u_2} : + helperContinuation2177Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hlower hfewer hminimal hlarge hpositive + H q i A n Tn hlen commonPrefix equalTrees hAT stagesNested hTnA prefixSegment hAElem r f y + hyOutside alpha halphaA halphay gamma hgammaA hgammaf hfEnds eta hcard theta hthetaPair + hthetaNew x hthetax hthetaA hthetaClosed hthetaGamma outsideMissingComponent + stepInterchange hthetaAlpha hcomponentOutside sigma hrecolorA hstableA missingFirstInA + hstableLadder hmod hfixedEdges hsigmaRoute corrT hmaximumT hnotElementarySigma + hrecolorPrefix positivePrefix abovePrefix strictPrefix belowPrefix generatingPrefix + basePrefix hclosurePrefix HP goodPrefix hprefixTransport corrPrefix hmaximumPrefixSigma + basePrefixSigma KP goodPrefixSigma hsamePrefixSigma hminusPrefixSigma corrA baseT hcoreTA + hclosureTA hsupportTA hcoreT hterminalTree K missingTree stageInsideA coreInsideA starredEq + terminalColors storedEq + have stageMissingEq (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j := by + refine Fin.cases ?_ (fun a => ?_) j + · change TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + rw [hterminalTree] + exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnA) + · exact missingTree _ (TreeSequenceInitialSegmentVertexSetSubset (stageInsideA a.succ)) + have firstBound (psi : PartialEdgeColoring E k) (c : Fin k) + (hc : c ∈ TreeMissingColors psi A) : + (HierarchyFirstMissingPosition psi T c).val ≤ A.length := by + exact @helper_firstBound_1983 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C hAT psi c hc + have firstMissingEq (c : Fin k) : + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition phi T c := by + exact @helper_firstMissingEq_961 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C hproper hpositive hAT alpha halphaA halphay gamma eta theta + hthetaPair hthetaNew x hthetax hthetaA hthetaClosed hthetaGamma stepInterchange + hthetaAlpha hcomponentOutside hrecolorA hstableA hstableLadder hmod hfixedEdges + hsigmaRoute corrT hmaximumT hnotElementarySigma hrecolorPrefix positivePrefix abovePrefix + strictPrefix belowPrefix generatingPrefix basePrefix HP goodPrefix hprefixTransport + corrPrefix hmaximumPrefixSigma basePrefixSigma KP goodPrefixSigma hsamePrefixSigma + hminusPrefixSigma baseT hcoreTA hclosureTA hsupportTA hcoreT hterminalTree missingTree + starredEq terminalColors storedEq stageMissingEq firstBound c + have stageFixed (j : Fin (H.dividerCount + 1)) (t : Fin (H.stage j.succ).length) : + sigma ((H.stage j.succ).edge t) = phi ((H.stage j.succ).edge t) := by + have hs := stagesNested j.succ (Fin.last (H.dividerCount + 1)) (Fin.le_last _) + rw [H.terminalStage] at hs + have he := hs.2.2 t + rw [← he] + exact hfixedEdges _ + have segmentEq (j : Fin (H.dividerCount + 1)) (c : Fin k) : + HierarchySegmentColors K j c = HierarchySegmentColors H j c := by + unfold HierarchySegmentColors + dsimp only + rw [starredEq j, firstMissingEq c] + simp only [K, stageFixed] + have boundaryEq (B : TreeSequence G e0) + (hBA : TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet A) (c : Fin k) : + BoundaryColorEdges G sigma (TreeSequenceVertexSet B) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet B) c := by + exact @helper_boundaryEq_2016 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C alpha theta hstableA B hBA c + have minusEq (B : TreeSequence G e0) + (hBA : TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet A) (R : Finset (Fin k)) : + TreeColorSetMinusClosed G sigma B R ↔ TreeColorSetMinusClosed G phi B R := by + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [missingTree B hBA] + simp only [boundaryEq B hBA] + have closureEq (hpe : corrT.replacementETT.series.data.kind + (Fin.last corrT.replacementETT.rounds) = some TashkinovExtensionKind.PE) : + baseT.closure = base.closure := by + have hpeOld : ett.series.data.kind n = some TashkinovExtensionKind.PE := by + rw [← terminalColors.1] + exact hpe + exact hclosureTA.trans + ((hsamePrefixSigma.1.2.2.2.2.2 hpeOld).symm.trans hclosurePrefix) + let goodT : GoodHierarchy K := by + exact { + gamma := C.good.gamma + twoColors := by + intro j c hc + exact C.good.twoColors j c (by rw [storedEq j] at hc; exact hc) + avoidance := by + intro j c hc + rw [stageMissingEq j, segmentEq j c] + exact C.good.avoidance j c (by rw [storedEq j] at hc; exact hc) + disjointPairs := by + intro j c d hc hd hne + exact C.good.disjointPairs j c d + (by rw [storedEq j] at hc; exact hc) + (by rw [storedEq j] at hd; exact hd) hne + uniqueRefresh := by + intro a + have hnew : + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H a.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H a.castSucc)).biUnion + fun v => MissingColors G phi v) := by + exact @helper_hnew_2064 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C alpha theta hstableA corrT baseT hcoreT hterminalTree + stageInsideA a + change ∃! c : Fin k, + c ∈ HierarchyStoredColorsAt K a.succ ∧ + C.good.gamma a.succ c ⊆ + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K a.castSucc)).biUnion + fun v => MissingColors G sigma v) ∧ + ∀ d ∈ HierarchyStoredColorsAt K a.succ, d ≠ c → + C.good.gamma a.succ d = C.good.gamma a.castSucc d + rw [starredEq a.castSucc, hnew] + simp only [storedEq] + exact C.good.uniqueRefresh a + parallelBase := by + dsimp only + intro hpe + have hpeOld : ett.series.data.kind n = some TashkinovExtensionKind.PE := by + rw [← terminalColors.1] + exact hpe + have hcl : TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A := by + obtain ⟨_, _, ⟨ordered⟩⟩ := base.parallel hpeOld + intro v hv + apply coreInsideA + rw [ordered.vertexSet] + exact Finset.mem_union_right _ hv + obtain ⟨hnot, hcard⟩ := C.good.parallelBase hpeOld + constructor + · change ¬ TreeColorSetMinusClosed G sigma baseT.core + ((HierarchyStoredColorsAt K 0).biUnion (C.good.gamma 0)) + rw [hcoreT, storedEq 0, minusEq base.core coreInsideA] + exact hnot + · change 4 ≤ ((TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseT.closure) \ + (HierarchyStoredColorsAt K 0).biUnion (C.good.gamma 0)).card + rw [hterminalTree, closureEq hpe, storedEq 0, + missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnA), + missingTree base.closure hcl] + exact hcard + minusClosed := by + intro a + change TreeColorSetMinusClosed G sigma (H.stage a.succ.castSucc) + ((HierarchyStoredColorsAt K a.succ).biUnion (C.good.gamma a.castSucc)) + rw [storedEq a.succ, minusEq _ + (TreeSequenceInitialSegmentVertexSetSubset (stageInsideA a.succ))] + exact C.good.minusClosed a } + exact @helper_continuation_2653 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C hproper hlower hfewer hminimal hlarge hpositive hlen commonPrefix + equalTrees hAT hTnA prefixSegment hAElem hyOutside alpha halphay gamma hgammaA hgammaf + hfEnds eta theta hthetaA hthetaClosed hthetaGamma outsideMissingComponent hthetaAlpha + hstableA missingFirstInA hfixedEdges corrT hmaximumT hnotElementarySigma positivePrefix + abovePrefix strictPrefix belowPrefix generatingPrefix corrPrefix basePrefixSigma baseT + hcoreT hterminalTree missingTree stageInsideA coreInsideA starredEq terminalColors storedEq + stageMissingEq firstMissingEq segmentEq boundaryEq minusEq closureEq +private theorem helper_continuation_2110.{u_1, u_2} : + helperContinuation2110Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge + hpositive H q i A n Tn hqpos hA hlen segmentTrans commonPrefix equalTrees hAT stagesNested + hTnA prefixSegment hAElem r f y hyOutside alpha halphaA halphay gamma hgammaA hgammaf + hfEnds eta hcard theta hthetaPair hthetaNew x hthetax hthetaA hthetaClosed hthetaGamma + outsideMissingComponent stepInterchange hthetaAlpha hcomponentOutside sigma hrecolorA + hstableA missingFirstInA hstableLadder hmod hfixedEdges hsigmaRoute corrT hmaximumT + hnotElementarySigma + obtain ⟨ettPrefix, hmaximumPrefix, hrungPrefix, hseriesPrefix, + basePrefix, hcorePrefix, hclosurePrefix, hsupportPrefix, + HP, hcountPrefix, hstagesPrefix, hdividersPrefix, + goodPrefix, hcolorsPrefix, hminusPrefix⟩ := + GoodHierarchyPrefixRepackage G k e0 input T phi phi ett C.maximum + base H C.good q (by change 1 ≤ H.dividerCount; omega) + have hrecolorPrefix : OutsideKempeRecoloring (H.stage q.castSucc) + phi sigma theta alpha := by + rw [← hA] + exact hrecolorA + have hprefixTransport := HierarchyLEMStable G k e0 input (H.stage q.castSucc) + phi sigma ettPrefix hmaximumPrefix (by rw [hrungPrefix]; exact C.positive) + (fun lower hp hl hm => hlower lower hp (lt_of_lt_of_eq hl hrungPrefix) hm) + basePrefix HP goodPrefix hproper hone theta alpha hrecolorPrefix + obtain ⟨corrPrefix, hmaximumPrefixSigma, basePrefixSigma, KP, + goodPrefixSigma, hsamePrefixSigma, hminusPrefixSigma⟩ := + hprefixTransport.2.2.2.2 + -- Both certificates below are tied to the original certified series. + -- No equality between independently chosen replacement certificates is used. + rcases ettPrefix with ⟨roundsPrefix, positivePrefix, seriesPrefix, + abovePrefix, strictPrefix, belowPrefix, generatingPrefix⟩ + dsimp only at hrungPrefix hseriesPrefix + cases hrungPrefix + have hseriesEq : seriesPrefix = ett.series := eq_of_heq hseriesPrefix + cases hseriesEq + let corrA : CorrespondingExtendedTashkinovTree G k e0 ett sigma + (H.stage q.castSucc) := by + exact { + replacementInput := corrPrefix.replacementInput + replacementSeries := corrPrefix.replacementSeries + replacementETT := corrPrefix.replacementETT + rungAgreement := corrPrefix.rungAgreement + seriesPresentation := corrPrefix.seriesPresentation + finalGeneratingColoring := corrPrefix.finalGeneratingColoring + ladderTreesAgree := corrPrefix.ladderTreesAgree + storedColorsAgree := corrPrefix.storedColorsAgree + connectingEdgesAgree := corrPrefix.connectingEdgesAgree + extensionKindsAgree := corrPrefix.extensionKindsAgree + replacementProper := corrPrefix.replacementProper + replacementOneUncolored := corrPrefix.replacementOneUncolored + replacementStable := corrPrefix.replacementStable } + obtain ⟨baseT, hcoreTA, hclosureTA, hsupportTA⟩ := + GoodHierarchyCommonOriginalBaseTransport G k e0 input T phi sigma ett + (H.stage q.castSucc) T corrA basePrefixSigma corrT + have hcoreT : baseT.core = base.core := + hcoreTA.trans (hsamePrefixSigma.1.1.symm.trans hcorePrefix) + have hterminalTree : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = Tn := by + exact @helper_hterminalTree_1357 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C hpositive alpha eta theta corrT hmaximumT positivePrefix + abovePrefix strictPrefix belowPrefix generatingPrefix basePrefix HP corrPrefix + basePrefixSigma baseT hcoreTA hclosureTA hsupportTA hcoreT + let K : TashkinovHierarchy corrT.replacementETT baseT := by + exact { + dividerCount := H.dividerCount + stage := H.stage + baseStage := H.baseStage.trans hterminalTree.symm + terminalStage := H.terminalStage + nested := H.nested + strict := H.strict + dividerPosition := H.dividerPosition + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := H.dividerStage + coreInsideFirst := by rw [hcoreT]; exact H.coreInsideFirst } + have missingTree (B : TreeSequence G e0) + (hBA : TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet A) : + TreeMissingColors sigma B = TreeMissingColors phi B := by + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor <;> rintro ⟨v, hv, hc⟩ + · exact ⟨v, hv, by rw [← hstableA.2.2.2.1.2 v (hBA hv)]; exact hc⟩ + · exact ⟨v, hv, by rw [hstableA.2.2.2.1.2 v (hBA hv)]; exact hc⟩ + have stageInsideA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + rw [hA] + exact stagesNested j.castSucc q.castSucc (Fin.le_last j) + have coreInsideA : TreeSequenceVertexSet base.core ⊆ TreeSequenceVertexSet A := + TreeSequenceInitialSegmentVertexSetSubset + (segmentTrans H.coreInsideFirst + (by + rw [hA] + exact stagesNested ⟨1, by omega⟩ q.castSucc (by change 1 ≤ H.dividerCount; omega))) + have starredInsideA (j : Fin (H.dividerCount + 1)) : + TreeSequenceVertexSet (HierarchyStarredStage H j) ⊆ TreeSequenceVertexSet A := by + refine Fin.cases ?_ (fun a => ?_) j + · exact coreInsideA + · exact TreeSequenceInitialSegmentVertexSetSubset (stageInsideA a.succ) + have starredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage H j := by + refine Fin.cases ?_ (fun a => ?_) j + · exact hcoreT + · rfl + have terminalColors : + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + TashkinovStoredColors ett.series.data n := by + exact @helper_terminalColors_890 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C hpositive hTnA alpha eta theta corrT hmaximumT + positivePrefix abovePrefix strictPrefix belowPrefix generatingPrefix basePrefix HP + corrPrefix basePrefixSigma baseT hcoreTA hclosureTA hsupportTA hcoreT hterminalTree + missingTree starredEq + have storedEq (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j := by + unfold HierarchyStoredColorsAt + dsimp only + rw [terminalColors.2, starredEq j, missingTree _ (starredInsideA j)] + exact @helper_continuation_2177 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C hproper hlower hfewer hminimal hlarge hpositive hlen commonPrefix + equalTrees hAT stagesNested hTnA prefixSegment hAElem hyOutside alpha halphaA halphay gamma + hgammaA hgammaf hfEnds eta hcard theta hthetaPair hthetaNew x hthetax hthetaA hthetaClosed + hthetaGamma outsideMissingComponent stepInterchange hthetaAlpha hcomponentOutside hrecolorA + hstableA missingFirstInA hstableLadder hmod hfixedEdges hsigmaRoute corrT hmaximumT + hnotElementarySigma hrecolorPrefix positivePrefix abovePrefix strictPrefix belowPrefix + generatingPrefix basePrefix hclosurePrefix HP goodPrefix hprefixTransport corrPrefix + hmaximumPrefixSigma basePrefixSigma KP goodPrefixSigma hsamePrefixSigma hminusPrefixSigma + baseT hcoreTA hclosureTA hsupportTA hcoreT hterminalTree missingTree stageInsideA + coreInsideA starredEq terminalColors storedEq +private theorem helper_continuation_2074.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating') + (_ : other.rounds = ett.rounds) (_ : MaximumProperty other) + (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K) (_ : K.dividerCount < C.hierarchy.dividerCount), + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T'))) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base') + (_ : other.rounds = ett.rounds) + (_ : C'.hierarchy.dividerCount = C.hierarchy.dividerCount), + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C))) + (_ : + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card)) + (hpositive : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let i : Fin H.dividerCount := + (⟨H.dividerCount - (1 : ℕ), + id + (fun (hpositive : (0 : ℕ) < H.dividerCount) ↦ + Decidable.byContradiction + fun (a : ¬H.dividerCount - (1 : ℕ) < H.dividerCount) ↦ by omega) + hpositive⟩ : + Fin H.dividerCount); + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Tnext : TreeSequence G e0 := ett.series.data.tree n.succ; + ∀ (_ : (0 : ℕ) < H.dividerCount) (_ : i.succ = q) (_ : A = H.stage q.castSucc) + (hlen : T.length = A.length + (1 : ℕ)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) + (_ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) + (_ : TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), + TreeSequenceInitialSegment X Y)) + (_ : + (∀ {X Y : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) + (_ : X.length = Y.length), X = Y)) + (_ : TreeSequenceInitialSegment A T) + (_ : + (∀ (a b : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑a : ℕ) ≤ (↑b : ℕ)), + TreeSequenceInitialSegment (H.stage a) (H.stage b))) + (_ : TreeSequenceInitialSegment Tn A) (_ : Tn.length < A.length) + (_ : TreeSequenceInitialSegment T Tnext) (_ : TreeSequenceInitialSegment A Tnext) + (_ : + (∀ (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmT : m ≤ T.length), + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T)) + (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A)), + let r : Fin T.length := (⟨A.length, by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := T.vertex (Fin.last T.length); + ∀ (_ : y ∉ TreeSequenceVertexSet A), + ∀ alpha ∈ TreeMissingColors phi A, + alpha ∈ MissingColors G phi y → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi (ett.series.data.tree n.castSucc) + (ett.series.data.tree n.succ) ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree n.castSucc) edge seed ∧ + TashkinovAugmentationSequence phi seed (ett.series.data.tree n.succ)) → + ∀ gamma ∈ TreeMissingColors phi A, + phi f = some gamma → + (∃ u ∈ TreeSequenceVertexSet A, G.ends f = s(u, y)) → + (∀ eta ∈ HierarchyStoredColorsAt H q, gamma ∉ C.good.gamma q eta) → + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy i.succ, + (C.good.gamma i.succ eta).card = (2 : ℕ) → + ∀ theta ∈ C.good.gamma i.succ eta, + (theta ∈ + (TreeSequenceVertexSet (C.hierarchy.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage C.hierarchy i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) → + ∀ (x : V), + theta ∈ MissingColors G phi x → + x ∈ TreeSequenceVertexSet A → + theta ∈ TreeMissingColors phi A → + TreeColorSetClosed G phi A { theta } → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge + hpositive H q i A n Tn Tnext hqpos hiq hA hlen segmentTrans commonPrefix equalTrees hAT + stagesNested hTnA hTnStrictA hTTnext hATnext prefixSegment hAElem r f y hyOutside alpha + halphaA halphay hroute gamma hgammaA hgammaf hfEnds hgammaTerminalExcluded eta heta hcard + theta hthetaPair hthetaNew x hthetax hxA hthetaA hthetaClosed + have hthetaGamma : theta ≠ gamma := by + intro he + have hp : theta ∈ C.good.gamma q eta := by + simpa only [hiq] using hthetaPair + have heStored : eta ∈ HierarchyStoredColorsAt H q := by + simpa only [hiq] using heta + exact hgammaTerminalExcluded eta heStored (he ▸ hp) + have graphSwap (psi : PartialEdgeColoring E k) (c d : Fin k) : + TwoColorIncidenceGraph G psi c d = TwoColorIncidenceGraph G psi d c := by + ext z w + cases z <;> cases w <;> simp [TwoColorIncidenceGraph, or_comm] + have missingLeaf (psi : PartialEdgeColoring E k) (hpsi : IsProperEdgeColoring G psi) + (c d : Fin k) (hcd : c ≠ d) (v : V) + (hc : c ∈ MissingColors G psi v ∨ d ∈ MissingColors G psi v) : + Set.Subsingleton ((TwoColorIncidenceGraph G psi c d).neighborSet (Sum.inl v)) := by + exact @helper_missingLeaf_1742 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C hpositive eta hcard graphSwap psi hpsi c d hcd v hc + have pathMissing (psi : PartialEdgeColoring E k) (hpsi : IsProperEdgeColoring G psi) + (c d : Fin k) (hcd : c ≠ d) (v : V) + (hc : c ∈ MissingColors G psi v ∨ d ∈ MissingColors G psi v) : + TwoColorPathComponent G psi c d (Sum.inl v) := + ⟨hcd, Sum.inl v, rfl, missingLeaf psi hpsi c d hcd v hc⟩ + -- A missing-color component outside A cannot acquire a third endpoint. + -- The coincident-witness case is an isolated component and is handled separately. + have outsideMissingComponent (psi : PartialEdgeColoring E k) + (hpsi : IsProperEdgeColoring G psi) (c d : Fin k) (hcd : c ≠ d) + (hcA : c ∈ TreeMissingColors psi A) (hdA : d ∈ TreeMissingColors psi A) + (w : V) (hwOutside : w ∉ TreeSequenceVertexSet A) + (hcw : c ∈ MissingColors G psi w ∨ d ∈ MissingColors G psi w) + (hinter : TreeInterchangeable G A psi c d) : + ∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G psi c d (Sum.inl w) := by + exact @helper_outsideMissingComponent_540 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C missingLeaf pathMissing psi hpsi c d hcd hcA + hdA w hwOutside hcw hinter + have stepInterchange (beta : Fin k) (hne : theta ≠ beta) : + TreeInterchangeable G A phi theta beta := by + have hstage : H.stage i.succ.castSucc = A := by rw [hiq, ← hA] + have hm : theta ∈ TreeMissingColors phi (H.stage i.succ.castSucc) := by + rw [hstage] + exact hthetaA + have hc : TreeColorSetClosed G phi (H.stage i.succ.castSucc) {theta} := by + rw [hstage] + exact hthetaClosed + have hi := step1 G k e0 input T phi ett C.maximum C.positive hproper hone + hlower base H C.good hfewer hlarge i theta beta hm hne hc + rw [hstage] at hi + exact hi + have hthetaAlpha : theta ≠ alpha := by + exact @helper_hthetaAlpha_1167 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C hproper hpositive hlen hyOutside alpha halphay gamma hgammaA + hgammaf hfEnds theta hthetaA hthetaGamma outsideMissingComponent stepInterchange + have hcomponentOutside : ∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G phi theta alpha (Sum.inl y) := + outsideMissingComponent phi hproper theta alpha hthetaAlpha hthetaA halphaA y hyOutside + (Or.inr halphay) (stepInterchange alpha hthetaAlpha) + let sigma := TwoColorComponentSwap G phi theta alpha (Sum.inl y) + have hrecolorA : OutsideKempeRecoloring A phi sigma theta alpha := by + refine ⟨hthetaAlpha, {Sum.inl y}, ?_, ?_⟩ + · intro z hz v hv hvA + have he : z = Sum.inl y := Finset.mem_singleton.mp hz + subst z + exact hcomponentOutside v hvA hv + · intro edge + simp only [sigma, TwoColorComponentSwap, Finset.mem_singleton, exists_eq_left] + have hstableA := OutsideKempeRecoloringStable G e0 A + (TashkinovStoredColors ett.series.data n) phi sigma theta alpha + hproper hone hrecolorA + have missingFirstInA (c : Fin k) (hc : c ∈ TreeMissingColors phi A) : + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + T.vertex (HierarchyFirstMissingPosition phi T c) ∈ TreeSequenceVertexSet A := by + exact @helper_missingFirstInA_1204 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C hAT c hc + have hstableLadder : StableColoring Tn + (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma := by + have hsub := TreeSequenceInitialSegmentVertexSetSubset hTnA + constructor + · intro edge he _ + rw [← ett.generatingColoring] + apply hstableA.2.2.2.2 edge + obtain ⟨v, hv, hinc⟩ := he + exact ⟨v, hsub hv, hinc⟩ + · intro v hv + rw [← ett.generatingColoring] + exact hstableA.2.2.1.2 v (hsub hv) + have hmod : ModColoring ett sigma := Td G k e0 input T phi ett C.maximum + C.positive hlower sigma hstableA.1 hstableA.2.1 hstableLadder + have hfixedEdges : ∀ t : Fin T.length, sigma (T.edge t) = phi (T.edge t) := by + exact @helper_hfixedEdges_1244 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C hpositive hlen hAT alpha hfEnds eta theta hstableA + have hsigmaRoute : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {edge} ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ + TashkinovAugmentationSequence sigma seed T) := by + exact @helper_hsigmaRoute_1829 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C hpositive hlen segmentTrans commonPrefix hAT hTnA hTnStrictA + hTTnext hATnext alpha hroute eta theta hstableA hfixedEdges + obtain ⟨corrT⟩ := hmod.2.2 T ett.abovePenultimate ett.strictAbovePenultimate hsigmaRoute + have hmaximumT : MaximumProperty corrT.replacementETT := + MaximumPropertyTransport G k e0 ett sigma hmod T corrT C.maximum + have hnotElementarySigma : ¬ ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet T) := by + exact @helper_hnotElementarySigma_1858 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C hproper hAT hyOutside alpha halphay theta x + hthetax hxA hthetaAlpha hstableA + exact @helper_continuation_2110 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge hpositive hqpos hA + hlen segmentTrans commonPrefix equalTrees hAT stagesNested hTnA prefixSegment hAElem + hyOutside alpha halphaA halphay gamma hgammaA hgammaf hfEnds eta hcard theta hthetaPair + hthetaNew x hthetax hthetaA hthetaClosed hthetaGamma outsideMissingComponent + stepInterchange hthetaAlpha hcomponentOutside hrecolorA hstableA missingFirstInA + hstableLadder hmod hfixedEdges hsigmaRoute corrT hmaximumT hnotElementarySigma +private theorem helper_continuation_2056.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating') + (_ : other.rounds = ett.rounds) (_ : MaximumProperty other) + (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K) (_ : K.dividerCount < C.hierarchy.dividerCount), + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T'))) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base') + (_ : other.rounds = ett.rounds) + (_ : C'.hierarchy.dividerCount = C.hierarchy.dividerCount), + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C))) + (_ : + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card)) + (hpositive : (0 : ℕ) < C.hierarchy.dividerCount), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let i : Fin H.dividerCount := + (⟨H.dividerCount - (1 : ℕ), + id + (fun (hpositive : (0 : ℕ) < H.dividerCount) ↦ + Decidable.byContradiction + fun (a : ¬H.dividerCount - (1 : ℕ) < H.dividerCount) ↦ by omega) + hpositive⟩ : + Fin H.dividerCount); + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Tnext : TreeSequence G e0 := ett.series.data.tree n.succ; + ∀ (_ : (0 : ℕ) < H.dividerCount) (_ : i.succ = q) (_ : A = H.stage q.castSucc) + (hlen : T.length = A.length + (1 : ℕ)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) + (_ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) + (_ : + (∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) + (_ : TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), + TreeSequenceInitialSegment X Y)) + (_ : + (∀ {X Y : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) + (_ : X.length = Y.length), X = Y)) + (_ : TreeSequenceInitialSegment A T) + (_ : + (∀ (a b : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑a : ℕ) ≤ (↑b : ℕ)), + TreeSequenceInitialSegment (H.stage a) (H.stage b))) + (_ : TreeSequenceInitialSegment Tn A) (_ : Tn.length < A.length) + (_ : TreeSequenceInitialSegment T Tnext) (_ : TreeSequenceInitialSegment A Tnext) + (_ : + (∀ (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmT : m ≤ T.length), + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T)) + (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A)), + let _ : Fin T.length := (⟨A.length, by omega⟩ : Fin T.length); + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge + hpositive H q i A n Tn Tnext hqpos hiq hA hlen segmentTrans commonPrefix equalTrees hAT + stagesNested hTnA hTnStrictA hTTnext hATnext prefixSegment hAElem r + let f : E := T.edge r + let y : V := T.vertex (Fin.last T.length) + have hyOutside : y ∉ TreeSequenceVertexSet A := by + intro hy + obtain ⟨j, hj⟩ : ∃ j, A.vertex j = y := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hy + have he := hAT.2.1 j + have hjy : T.vertex (Fin.castLE (Nat.succ_le_succ hAT.1) j) = + T.vertex (Fin.last T.length) := he.trans hj + have hidx := congrArg Fin.val (T.vertex_injective hjy) + have hjlt := j.isLt + simp only [Fin.val_castLE, Fin.val_last] at hidx + omega + have hvertices : TreeSequenceVertexSet T = insert y (TreeSequenceVertexSet A) := by + exact @helper_hvertices_896 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C hpositive hlen hAT + have hcommon : ∃ alpha : Fin k, + alpha ∈ TreeMissingColors phi A ∧ alpha ∈ MissingColors G phi y := by + exact @helper_hcommon_1589 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C hAElem hvertices + obtain ⟨alpha, halphaA, halphay⟩ := hcommon + -- Retain the actual PE route or the exact SE/RE connecting seed. + have terminalRoute : ∀ j : Fin (ett.rounds + 1), 0 < j.val → + (ett.series.data.kind j = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring j) + (ett.series.data.tree j.castSucc) (ett.series.data.tree j.succ)) ∨ + ((ett.series.data.kind j = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind j = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges j = {edge} ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree j.castSucc) edge seed ∧ + TashkinovAugmentationSequence (ett.series.data.coloring j) + seed (ett.series.data.tree j.succ)) := by + exact @helper_terminalRoute_936 V E inferInstance inferInstance inferInstance G k e0 input T + phi ett + have hroute := terminalRoute n (by dsimp [n]; have := ett.roundsPositive; omega) + rw [← ett.generatingColoring] at hroute + have hAtoT : TashkinovAugmentationSequence phi A T := by + exact @helper_hAtoT_1620 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C hpositive segmentTrans commonPrefix hAT hTnA hTnStrictA hTTnext + hATnext hroute + have hfinalAugmentation : TashkinovAugmentation phi A T := by + have hpos := (TashkinovAugmentationSequencePosition phi A T hAtoT r + (by rfl)).1 + have hpreA : TreeSequencePrefix T r.val A.positive (Nat.le_of_lt r.isLt) = A := by + apply equalTrees + · exact commonPrefix (prefixSegment _ _ _) hAT (le_refl _) + · rfl + have hpreT : TreeSequencePrefix T (r.val + 1) (by have := A.positive; omega) + (Nat.succ_le_of_lt r.isLt) = T := by + exact equalTrees (prefixSegment _ _ _) hlen.symm + rw [hpreA, hpreT] at hpos + exact hpos + obtain ⟨hauglen, haugseg, gamma, hgammaEdge, hgammaA⟩ := hfinalAugmentation + have hgammaf : phi f = some gamma := by + have he : Fin.cast hauglen.symm (Fin.last A.length) = r := Fin.ext rfl + simpa only [he] using hgammaEdge + have hfEnds : ∃ u ∈ TreeSequenceVertexSet A, G.ends f = Sym2.mk u y := by + exact @helper_hfEnds_1651 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C hpositive hlen hAT + have hfBoundary : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet A) gamma := by + obtain ⟨u, hu, he⟩ := hfEnds + simp only [BoundaryColorEdges, Finset.mem_filter, BoundaryEdges, Finset.mem_univ, + true_and] + exact ⟨⟨u, hu, y, hyOutside, he⟩, hgammaf⟩ + have hgammaReserved : gamma ∈ + (HierarchyStoredColorsAt H q).biUnion (C.good.gamma i.castSucc) := by + by_contra hnot + have hstage : H.stage i.succ.castSucc = A := by rw [hiq, ← hA] + have hminus := C.good.minusClosed i + change TreeColorSetMinusClosed G phi (H.stage i.succ.castSucc) + ((HierarchyStoredColorsAt H i.succ).biUnion (C.good.gamma i.castSucc)) at hminus + rw [hstage, hiq] at hminus + have hc := hminus gamma (Finset.mem_sdiff.mpr ⟨hgammaA, hnot⟩) + rw [hc] at hfBoundary + simp at hfBoundary + have firstMissingAfter (eta : Fin k) (heta : eta ∉ TreeMissingColors phi A) : + (HierarchyFirstMissingPosition phi T eta).val = T.length := by + exact @helper_firstMissingAfter_1042 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C hpositive hlen hAT eta heta + have hgammaTerminalExcluded : ∀ eta ∈ HierarchyStoredColorsAt H q, + gamma ∉ C.good.gamma q eta := by + exact @helper_hgammaTerminalExcluded_1690 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C hpositive hlen gamma hgammaf firstMissingAfter + obtain ⟨eta, ⟨heta, hrefresh, hother⟩, hunique⟩ := C.good.uniqueRefresh i + have hcard := C.good.twoColors i.succ eta heta + obtain ⟨theta, hthetaPair⟩ : (C.good.gamma i.succ eta).Nonempty := + Finset.card_pos.mp (by omega) + have hthetaNew := hrefresh hthetaPair + obtain ⟨x, hxNew, hthetax⟩ := Finset.mem_biUnion.mp hthetaNew + have hxA : x ∈ TreeSequenceVertexSet A := by + have hx := (Finset.mem_sdiff.mp hxNew).1 + change x ∈ TreeSequenceVertexSet (H.stage i.succ.castSucc) at hx + rw [hiq, ← hA] at hx + exact hx + have hthetaA : theta ∈ TreeMissingColors phi A := + Finset.mem_biUnion.mpr ⟨x, hxA, hthetax⟩ + have hthetaClosed : TreeColorSetClosed G phi A {theta} := by + have hstage : H.stage i.succ.castSucc = A := by rw [hiq, ← hA] + have helem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (H.stage i.succ.castSucc)) := by + rw [hstage] + exact hAElem + have hc := GoodHierarchyNewMissingClosed C.good i helem theta hthetaNew + rw [hstage] at hc + intro c hc' + have he : c = theta := Finset.mem_singleton.mp hc' + simpa only [he] using hc + exact @helper_continuation_2074 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge hpositive hqpos hiq hA + hlen segmentTrans commonPrefix equalTrees hAT stagesNested hTnA hTnStrictA hTTnext hATnext + prefixSegment hAElem hyOutside alpha halphaA halphay hroute gamma hgammaA hgammaf hfEnds + hgammaTerminalExcluded eta heta hcard theta hthetaPair hthetaNew x hthetax hxA hthetaA + hthetaClosed +theorem HierarchyCounterexampleOneAdditionPositiveDividerImpossible + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (honeAddition : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + T.length - A.length = 1) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hpositive : 0 < C.hierarchy.dividerCount) : + False := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by + change 0 < H.dividerCount at hpositive + omega⟩ + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Tnext := ett.series.data.tree n.succ + have hqpos : 0 < H.dividerCount := hpositive + have hiq : i.succ = q := by + apply Fin.ext + dsimp [i, q] + omega + have hA : A = H.stage q.castSucc := by + dsimp [A] + rw [← hiq] + rfl + have hlen : T.length = A.length + 1 := by + have hs := H.strict q + have ht : H.stage q.succ = T := H.terminalStage + rw [ht, ← hA] at hs + change T.length - A.length = 1 at honeAddition + omega + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + apply TreeSequenceInitialSegment.trans <;> assumption + have commonPrefix {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) + (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + refine ⟨hXY, ?_, ?_⟩ + · intro j + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) j)).symm.trans + (hXZ.2.1 j) + · intro j + exact (hYZ.2.2 (Fin.castLE hXY j)).symm.trans (hXZ.2.2 j) + have equalTrees {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hlenXY : X.length = Y.length) : X = Y := by + exact @helper_equalTrees_1506 V E G e0 X Y hXY hlenXY + have hAT : TreeSequenceInitialSegment A T := by + rw [hA] + have ht : H.stage q.succ = T := H.terminalStage + have h := H.nested q + rw [ht] at h + exact h + have stagesNested : ∀ a b : Fin (H.dividerCount + 2), + a.val ≤ b.val → TreeSequenceInitialSegment (H.stage a) (H.stage b) := by + exact @helper_stagesNested_818 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C hpositive segmentTrans + have hTnA : TreeSequenceInitialSegment Tn A := by + rw [hA] + have h := stagesNested 0 q.castSucc (by simp) + simpa only [H.baseStage] using h + have hTnStrictA : Tn.length < A.length := by + have hfirst := H.strict 0 + have hz : (0 : Fin (H.dividerCount + 1)).castSucc = + (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp) + have ho : (0 : Fin (H.dividerCount + 1)).succ = + (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) := Fin.ext (by simp) + rw [hz, ho, H.baseStage] at hfirst + have hfirstA := stagesNested ⟨1, by omega⟩ q.castSucc (by + change 1 ≤ H.dividerCount + omega) + rw [hA] + exact lt_of_lt_of_le hfirst hfirstA.1 + have hTnext : Tnext = ett.series.data.tree (Fin.last (ett.rounds + 1)) := rfl + have hTTnext : TreeSequenceInitialSegment T Tnext := ett.belowFinal + have hATnext := segmentTrans hAT hTTnext + have prefixSegment (m : ℕ) (hm : 1 ≤ m) (hmT : m ≤ T.length) : + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T := by + exact ⟨hmT, fun _ => rfl, fun _ => rfl⟩ + have hprefixEq : + TreeSequencePrefix T + (min (A.length + (T.length - A.length - 1)) T.length) + (by have := A.positive; have := T.positive; omega) + (Nat.min_le_right _ _) = A := by + apply equalTrees + · apply commonPrefix + (prefixSegment _ _ _) hAT + change min (A.length + (T.length - A.length - 1)) T.length ≤ A.length + omega + · change min (A.length + (T.length - A.length - 1)) T.length = A.length + omega + have hAElem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by + change ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (TreeSequencePrefix T + (min (A.length + (T.length - A.length - 1)) T.length) _ _)) at hprefixElementary + rw [hprefixEq] at hprefixElementary + exact hprefixElementary + let r : Fin T.length := ⟨A.length, by omega⟩ + exact @helper_continuation_2056 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge hpositive hqpos hiq hA + hlen segmentTrans commonPrefix equalTrees hAT stagesNested hTnA hTnStrictA hTTnext hATnext + prefixSegment hAElem +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionZeroDividerImpossible.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionZeroDividerImpossible.lean new file mode 100644 index 0000000000..ed7b0e8d8c --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionZeroDividerImpossible.lean @@ -0,0 +1,1717 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ClosedSetTwoColorComponentAvoidance +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.InterchangePECommonMissingClosed +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.StableChange +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Hierarchy Counterexample One Addition Zero Divider Impossible + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hstar_138.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; HierarchyStarredStage H (Fin.last H.dividerCount) = A + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero H A + have hz : Fin.last H.dividerCount = (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + exact hzero + rw [hz] + rfl + +private theorem helper_hfirst_144.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) = T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero H + have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp only [Fin.val_last] + change 1 = C.hierarchy.dividerCount + 1 + omega + rw [hi] + exact H.terminalStage + +private theorem helper_hlen_155.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); T.length - + A.length = (1 : ℕ)) → C.hierarchy.dividerCount = (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; HierarchyStarredStage H (Fin.last H.dividerCount) = A + → TreeSequenceInitialSegment A T → T.length = A.length + (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C honeAddition hzero H A hstar hAT + change T.length - (HierarchyStarredStage H (Fin.last H.dividerCount)).length = 1 + at honeAddition + rw [hstar] at honeAddition + have := hAT.1 + omega + +private theorem helper_prefixMem_161.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let A : TreeSequence G e0 := base.core; + let y : V := T.vertex (Fin.last T.length); TreeSequenceInitialSegment A T → T.length = + A.length + (1 : ℕ) → + ∀ {v : V}, v ∈ TreeSequenceVertexSet T → v ≠ y → v ∈ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero A y hAT hlen v hv hne + obtain ⟨i, -, hi⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + have hival : i.val < T.length := by + by_contra hn + have hiLast : i = Fin.last T.length := by + apply Fin.ext + simp only [Fin.val_last] + omega + exact hne (hi.symm.trans (congrArg T.vertex hiLast)) + let j : Fin (A.length + 1) := ⟨i.val, by omega⟩ + have hji : Fin.castLE (Nat.succ_le_succ hAT.1) j = i := by + apply Fin.ext + rfl + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨j, Finset.mem_univ _, ?_⟩ + exact (hAT.2.1 j).symm.trans (by simpa only [hji] using hi) + +private theorem helper_hyNot_179.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let A : TreeSequence G e0 := base.core; + let y : V := T.vertex (Fin.last T.length); TreeSequenceInitialSegment A T → T.length = + A.length + (1 : ℕ) → y ∉ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero A y hAT hlen hy + obtain ⟨i, -, hi⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hy + have hidx := T.vertex_injective ((hAT.2.1 i).trans hi) + have hv := congrArg Fin.val hidx + simp only [Fin.val_castLE, Fin.val_last] at hv + have := i.isLt + omega + +private theorem helper_hAElementary_187.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) → C.hierarchy.dividerCount = + (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; HierarchyStarredStage H (Fin.last H.dividerCount) = A + → TreeSequenceInitialSegment A T → T.length = A.length + (1 : ℕ) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hprefixElementary hzero H A hstar hAT hlen + let p := min (A.length + ((T.length - A.length) - 1)) T.length + have hp : p = A.length := by dsimp [p]; omega + let P := TreeSequencePrefix T p + (by have := A.positive; dsimp [p]; omega) (Nat.min_le_right _ _) + have hP : ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) := by + have hp := @hprefixElementary + dsimp only at hp + simp only [show HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A + from hstar] at hp + exact @hp + have hvertices : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet P := by + intro v hv + obtain ⟨i, -, hi⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + let j : Fin (p + 1) := ⟨i.val, by rw [hp]; exact i.isLt⟩ + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨j, Finset.mem_univ _, ?_⟩ + change T.vertex (Fin.castLE _ j) = v + have hji : Fin.castLE (Nat.succ_le_succ (Nat.min_le_right _ _)) j = + Fin.castLE (Nat.succ_le_succ hAT.1) i := by + apply Fin.ext + rfl + rw [hji] + exact (hAT.2.1 i).trans hi + intro u hu v hv huv + exact hP (hvertices hu) (hvertices hv) huv + +private theorem helper_branch_227.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let A : TreeSequence G e0 := base.core; + let y : V := T.vertex (Fin.last T.length); T.length = A.length + (1 : ℕ) → ( + ∀ {v : V}, v ∈ TreeSequenceVertexSet T → v ≠ y → v ∈ TreeSequenceVertexSet A) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) → ( + ∀ alpha ∈ TreeMissingColors phi A, alpha ∉ MissingColors G phi y) → + ∀ {u : V}, u ∈ TreeSequenceVertexSet T → + ∀ {v : V}, v ∈ TreeSequenceVertexSet T → u ≠ v → ¬u = y → Disjoint (MissingColors G phi u) + (MissingColors G phi v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero A y hlen prefixMem hAElementary hn u hu v + hv huv huy + have huA := prefixMem hu huy + by_cases hvy : v = y + · apply Finset.disjoint_left.mpr + intro alpha hau hav + exact hn alpha (Finset.mem_biUnion.mpr ⟨u, huA, hau⟩) (hvy ▸ hav) + · exact hAElementary huA (prefixMem hv hvy) huv + +private theorem helper_outsideEndpoint_233.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let A : TreeSequence G e0 := base.core; + let y : V := T.vertex (Fin.last T.length); + ∀ (hlen : T.length = A.length + (1 : ℕ)), y ∉ TreeSequenceVertexSet A → + ∀ (f : E) (u v : V), u ∈ TreeSequenceVertexSet A → G.ends f = s(u, v) → T.edge (⟨A.length, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ⟩ : Fin T.length) = f → y = v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero A y hlen hyNot f u v hu hends hf + obtain ⟨i, hi⟩ := T.attaches ⟨A.length, by omega⟩ + have hyIncident : Incident G y f := by + unfold Incident + rw [← hf, hi] + have hlast : (⟨A.length, by omega⟩ : Fin T.length).succ = + Fin.last T.length := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_last] + omega + simp only [hlast, y, Sym2.mem_iff, true_or] + have hyCases : y = u ∨ y = v := by + simpa only [Incident, hends, Sym2.mem_iff] using hyIncident + exact hyCases.resolve_left (by intro hyu; exact hyNot (by simpa only [hyu] using hu)) + +private theorem helper_commonPrefix_250.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero X Y Z hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro j + have hx := hXZ.2.1 j + have hy := hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) j) + exact hy.symm.trans (by simpa only [Fin.castLE] using hx) + · intro j + have hx := hXZ.2.2 j + have hy := hYZ.2.2 (Fin.castLE hXY j) + exact hy.symm.trans (by simpa only [Fin.castLE] using hx) + +private theorem helper_equalTrees_263.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → X.length = Y.length → X = Y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero X Y hXY hl + cases X with + | mk lx px vx ex vix eix fx ax => + cases Y with + | mk ly py vy ey viy eiy fy ay => + simp only at hl + subst ly + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext j + simpa only [Fin.castLE] using (hXY.2.1 j).symm + · apply heq_of_eq + funext j + simpa only [Fin.castLE] using (hXY.2.2 j).symm + +private theorem helper_leaf_279.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), IsProperEdgeColoring G psi → + ∀ (u : V), a ∈ MissingColors G psi u ∨ b ∈ MissingColors G psi u → ((TwoColorIncidenceGraph G + psi a b).neighborSet (Sum.inl u)).Subsingleton := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero psi a b hp u hm + by_cases hab : a = b + · subst b + have ha : a ∈ MissingColors G psi u := hm.elim id id + have hn : a ∉ PresentColors G psi u := by simpa [MissingColors] using ha + intro z hz w hw + exfalso + cases z with + | inl z => simp [TwoColorIncidenceGraph] at hz + | inr f => + have hf : Incident G u f ∧ psi f = some a := by + simpa [TwoColorIncidenceGraph] using hz + exact hn (by simpa [PresentColors] using + (show ∃ e, Incident G u e ∧ psi e = some a from ⟨f, hf⟩)) + · let : Fintype ((TwoColorIncidenceGraph G psi a b).neighborSet (Sum.inl u)) := + Fintype.ofFinite _ + have hd : (TwoColorIncidenceGraph G psi a b).degree (Sum.inl u) ≤ 1 := by + rcases hm with hm | hm + · exact MissingColorIncidenceEndpoint G psi a b hab hp u hm + · have hd := MissingColorIncidenceEndpoint G psi b a (Ne.symm hab) hp u hm + have hgraph : TwoColorIncidenceGraph G psi b a = TwoColorIncidenceGraph G psi a b := by + ext z w + cases z <;> cases w <;> simp [TwoColorIncidenceGraph, or_comm] + rw [hgraph] at hd + exact hd + rw [← SimpleGraph.card_neighborSet_eq_degree] at hd + have hsub := Fintype.card_le_one_iff.mp hd + intro z hz w hw + exact congrArg Subtype.val (hsub ⟨z, hz⟩ ⟨w, hw⟩) + +private theorem helper_cycleEndpoint_314.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (cycle : TwoColorCycle G psi a b) (f : E) (u v + : V), G.ends f = s(u, v) → Sum.inr f ∈ cycle.walk.support → Sum.inl v ∈ cycle.walk.support + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero psi a b cycle f u v hends hf + let p := cycle.walk.rotate (Sum.inr f) hf + have hp : p.IsCycle := cycle.isCycle.rotate hf + have adjacent (z : Sum V E) + (hz : (TwoColorIncidenceGraph G psi a b).Adj (Sum.inr f) z) : + z = Sum.inl u ∨ z = Sum.inl v := by + cases z with + | inr e => exact hz.elim + | inl w => + have hw : w = u ∨ w = v := by + simpa only [Incident, hends, Sym2.mem_iff] using hz.1 + exact hw.elim (fun h => Or.inl (congrArg Sum.inl h)) + (fun h => Or.inr (congrArg Sum.inl h)) + have hs := adjacent p.snd (p.adj_snd hp.not_nil) + have ht := adjacent p.penultimate (p.adj_penultimate hp.not_nil).symm + by_contra hv + have hsMem : p.snd ∈ cycle.walk.support := by + apply (cycle.walk.mem_support_rotate_iff (Sum.inr f) hf).mp + exact List.mem_of_mem_tail (p.snd_mem_tail_support hp.not_nil) + have htMem : p.penultimate ∈ cycle.walk.support := by + apply (cycle.walk.mem_support_rotate_iff (Sum.inr f) hf).mp + exact List.mem_of_mem_dropLast (p.penultimate_mem_dropLast_support hp.not_nil) + have hs' : p.snd = Sum.inl u := hs.resolve_right (by intro h; exact hv (h ▸ hsMem)) + have ht' : p.penultimate = Sum.inl u := ht.resolve_right (by intro h; exact hv (h ▸ htMem)) + exact hp.snd_ne_penultimate (hs'.trans ht'.symm) + +private theorem helper_cycleMissing_343.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), IsProperEdgeColoring G psi → + ∀ (u : V), a ∈ MissingColors G psi u ∨ b ∈ MissingColors G psi u → ((TwoColorIncidenceGraph G + psi a b).neighborSet (Sum.inl u)).Subsingleton) → + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), IsProperEdgeColoring G psi → + ∀ (cycle : TwoColorCycle G psi a b) (v : V), Sum.inl v ∈ cycle.walk.support → a ∈ + MissingColors G psi v ∨ b ∈ MissingColors G psi v → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero leaf psi a b hp cycle v hv hm + let p := cycle.walk.rotate (Sum.inl v) hv + have hcy : p.IsCycle := cycle.isCycle.rotate hv + exact hcy.snd_ne_penultimate + (leaf psi a b hp v hm (p.adj_snd hcy.not_nil) + (p.adj_penultimate hcy.not_nil).symm) + +private theorem helper_outsideCommon_352.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), ( + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; (2 : ℕ) * ett.rounds + (11 : ℕ) + ≤ (TreeMissingColors phi Tn).card) → C.hierarchy.dividerCount = (0 : ℕ) → + let A : TreeSequence G e0 := base.core; + let y : V := T.vertex (Fin.last T.length); y ∉ TreeSequenceVertexSet A → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), IsProperEdgeColoring G psi → + ∀ (u : V), a ∈ MissingColors G psi u ∨ b ∈ MissingColors G psi u → ((TwoColorIncidenceGraph G + psi a b).neighborSet (Sum.inl u)).Subsingleton) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (u : V), Sum.inl u ∈ TwoColorComponent G psi a + b (Sum.inl u)) → + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → + TreeInterchangeable G A psi a b → a ∈ TreeMissingColors psi A → b ∈ TreeMissingColors psi + A → a ∈ MissingColors G psi y ∨ b ∈ MissingColors G psi y → + ∀ v ∈ TreeSequenceVertexSet A, Sum.inl v ∉ TwoColorComponent G psi a b (Sum.inl y) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C _ hzero A y hyNot leaf selfMem psi a b hab hp + hi ha hb hym + let I := TwoColorIncidenceGraph G psi a b + obtain ⟨u, hu, hum⟩ := Finset.mem_biUnion.mp ha + obtain ⟨w, hw, hwm⟩ := Finset.mem_biUnion.mp hb + have huPath : TwoColorPathComponent G psi a b (Sum.inl u) := + ⟨hab, Sum.inl u, selfMem psi a b u, leaf psi a b hp u (Or.inl hum)⟩ + have hwPath : TwoColorPathComponent G psi a b (Sum.inl w) := + ⟨hab, Sum.inl w, selfMem psi a b w, leaf psi a b hp w (Or.inr hwm)⟩ + have hyPath : TwoColorPathComponent G psi a b (Sum.inl y) := + ⟨hab, Sum.inl y, selfMem psi a b y, leaf psi a b hp y hym⟩ + have huw := hi _ _ huPath hwPath + ⟨u, hu, selfMem psi a b u⟩ ⟨w, hw, selfMem psi a b w⟩ + intro v hv hvC + have hyu := hi _ _ hyPath huPath ⟨v, hv, hvC⟩ ⟨u, hu, selfMem psi a b u⟩ + have hyC : Sum.inl y ∈ TwoColorComponent G psi a b (Sum.inl u) := by + rw [← hyu] + exact selfMem psi a b y + by_cases heq : u = w + · have hbU : b ∈ MissingColors G psi u := by simpa only [heq] using hwm + have hempty : I.neighborSet (Sum.inl u) = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro z hz + cases z with + | inl z => simp [I, TwoColorIncidenceGraph] at hz + | inr e => + have he : Incident G u e ∧ (psi e = some a ∨ psi e = some b) := hz + have hna : a ∉ PresentColors G psi u := by simpa [MissingColors] using hum + have hnb : b ∉ PresentColors G psi u := by simpa [MissingColors] using hbU + rcases he.2 with hec | hec + · exact hna (by simpa [PresentColors] using + (show ∃ e, Incident G u e ∧ psi e = some a from ⟨e, he.1, hec⟩)) + · exact hnb (by simpa [PresentColors] using + (show ∃ e, Incident G u e ∧ psi e = some b from ⟨e, he.1, hec⟩)) + have hreach : I.Reachable (Sum.inl y) (Sum.inl u) := + SimpleGraph.ConnectedComponent.exact hyC + exact SimpleGraph.not_reachable_of_neighborSet_right_eq_empty + (by intro he; exact hyNot (by simpa only [Sum.inl.inj he] using hu)) hempty hreach + · obtain ⟨s, t, p, hpPath, hsupp⟩ := + TwoColorComponentSpanningPath G psi a b hp (Sum.inl u) + have endpoint (r : V) + (hr : Sum.inl r ∈ TwoColorComponent G psi a b (Sum.inl u)) + (hm : a ∈ MissingColors G psi r ∨ b ∈ MissingColors G psi r) : + Sum.inl r = s ∨ Sum.inl r = t := by + have hrp : Sum.inl r ∈ p.support := by + change Sum.inl r ∈ {x | x ∈ p.support} + rw [hsupp] + exact hr + by_contra hn + push Not at hn + exact (hpPath.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 (leaf psi a b hp r hm)) hrp + have huend := endpoint u (selfMem psi a b u) (Or.inl hum) + have hwend := endpoint w (by rw [huw]; exact selfMem psi a b w) (Or.inr hwm) + have hyend := endpoint y hyC hym + have hyu : y ≠ u := by rintro rfl; exact hyNot hu + have hyw : y ≠ w := by rintro rfl; exact hyNot hw + rcases huend with hus | hut <;> rcases hwend with hws | hwt <;> + rcases hyend with hys | hyt + all_goals first + | exact heq (Sum.inl.inj (hus.trans hws.symm)) + | exact heq (Sum.inl.inj (hut.trans hwt.symm)) + | exact hyu (Sum.inl.inj (hys.trans hus.symm)) + | exact hyu (Sum.inl.inj (hyt.trans hut.symm)) + | exact hyw (Sum.inl.inj (hys.trans hws.symm)) + | exact hyw (Sum.inl.inj (hyt.trans hwt.symm)) + +private theorem helper_hfixed_432.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let A : TreeSequence G e0 := base.core; + let y : V := T.vertex (Fin.last T.length); + ∀ (a b : Fin k), ( + ∀ v ∈ TreeSequenceVertexSet A, Sum.inl v ∉ TwoColorComponent G phi a b (Sum.inl y)) → + ∀ (f : E), TreeIncidentEdge A f → TwoColorComponentSwap G phi a b (Sum.inl y) f = phi f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero A y a b havoid f hf + obtain ⟨v, hv, hvf⟩ := hf + by_cases he : Sum.inr f ∈ TwoColorComponent G phi a b (Sum.inl y) + · by_cases hc : phi f = some a ∨ phi f = some b + · have hadj : (TwoColorIncidenceGraph G phi a b).Adj (Sum.inl v) (Sum.inr f) := + ⟨hvf, hc⟩ + have hc' := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + have hvC : Sum.inl v ∈ TwoColorComponent G phi a b (Sum.inl y) := + hc'.trans he + exact (havoid v hv hvC).elim + · simp only [not_or] at hc + simp [TwoColorComponentSwap, he, hc.1, hc.2] + · simp [TwoColorComponentSwap, he] + +private theorem helper_branch_448.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsOneEdgeUncolored phi e0 → C.hierarchy.dividerCount = (0 : ℕ) → + let y : V := T.vertex (Fin.last T.length); + ∀ (a b : Fin k), a ≠ b → IsOneEdgeUncolored (TwoColorComponentSwap G phi a b (Sum.inl y)) e0 + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hone hzero y a b hab + have hnone (f : E) : TwoColorComponentSwap G phi a b (Sum.inl y) f = none ↔ phi f = none := by + by_cases hc : Sum.inr f ∈ TwoColorComponent G phi a b (Sum.inl y) + · by_cases ha : phi f = some a + · simp [TwoColorComponentSwap, hc, ha] + · by_cases hb : phi f = some b + · simp [TwoColorComponentSwap, hc, hb, Ne.symm hab] + · simp [TwoColorComponentSwap, hc, ha, hb] + · simp [TwoColorComponentSwap, hc] + constructor + · exact (hnone e0).mpr hone.1 + · intro f hfe + obtain ⟨c, hc⟩ := hone.2 f hfe + cases hs : TwoColorComponentSwap G phi a b (Sum.inl y) f with + | none => + exfalso + have hn : phi f ≠ none := by rw [hc]; simp + exact hn ((hnone f).mp hs) + | some d => exact ⟨d, rfl⟩ + +private theorem helper_hTnFinal_763.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (i : Fin ett.rounds), TashkinovClosure (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree i.succ.succ) → + (ett.series.data.tree i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length + → n = i.succ → TashkinovAugmentationSequence phi Tn (ett.series.data.tree (Fin.last + (ett.rounds + (1 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero n Tn i closedExtension strictExtension hslot + have hphi : phi = ett.series.data.coloring i.succ := by + simpa only [n, hslot] using ett.generatingColoring + have hfinal : i.succ.succ = Fin.last (ett.rounds + 1) := by + apply Fin.ext + have hh := congrArg Fin.val hslot + simp only [n, Fin.val_last, Fin.val_succ] at hh ⊢ + omega + simpa only [Tn, hslot, hfinal, ← hphi] using closedExtension.1 + +private theorem helper_hstep_780.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let A : TreeSequence G e0 := base.core; T.length = A.length + (1 : ℕ) → ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → X.length = Y.length → X = Y) → + ∀ (i : Fin ett.rounds), (ett.series.data.tree i.succ.castSucc).length < (ett.series.data.tree + i.succ.succ).length → TashkinovAugmentationSequence phi A T → TashkinovAugmentation phi A + T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero A hlen equalTrees i strictExtension hrouteA + have oneStep (X : TreeSequence G e0) (hXT : TashkinovAugmentationSequence phi X T) : + T.length = X.length + 1 → TashkinovAugmentation phi X T := by + unfold TashkinovAugmentationSequence at hXT + induction hXT using Relation.ReflTransGen.head_induction_on with + | refl => intro h; omega + | @head X B hXB hBT ih => + intro h + have hBTseg := TashkinovAugmentationSequenceInitialSegment phi B T hBT + have hBlen : B.length = T.length := by + have := hXB.1 + have := hBTseg.1 + omega + have hB := equalTrees hBTseg hBlen + subst B + exact hXB + exact oneStep A hrouteA hlen + +private theorem helper_hfy_804.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let A : TreeSequence G e0 := base.core; + let y : V := T.vertex (Fin.last T.length); + ∀ (hlen : T.length = A.length + (1 : ℕ)) (i : Fin ett.rounds), (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length → T.length = A.length + + (1 : ℕ) → + let f : E := T.edge (⟨A.length, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ⟩ : Fin T.length); Incident G y f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero A y hlen i strictExtension hstepLen f + obtain ⟨j, hj⟩ := T.attaches ⟨A.length, by omega⟩ + change y ∈ G.ends f + rw [hj] + have hi : (⟨A.length, by omega⟩ : Fin T.length).succ = Fin.last T.length := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_last] + omega + simp [hi, y] + +private theorem helper_stableOn_862.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let A : TreeSequence G e0 := base.core; + let y : V := T.vertex (Fin.last T.length); + ∀ (alpha : Fin k) (i : Fin ett.rounds), (ett.series.data.tree i.succ.castSucc).length < + (ett.series.data.tree i.succ.succ).length → T.length = A.length + (1 : ℕ) → + ∀ (theta : Fin k), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha (Sum.inl y); ( + ∀ (f : E), TreeIncidentEdge A f → TwoColorComponentSwap G phi theta alpha (Sum.inl y) f = phi + f) → ( + ∀ v ∈ TreeSequenceVertexSet A, MissingColors G (TwoColorComponentSwap G phi theta alpha + (Sum.inl y)) v = MissingColors G phi v) → + ∀ (X : TreeSequence G e0) (D : Finset (Fin k)), TreeSequenceVertexSet X ⊆ + TreeSequenceVertexSet A → StableColoring X D phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero A y alpha i strictExtension hstepLen + theta sigma hfixed hmissing X D hX + constructor + · intro e he hc + obtain ⟨v, hv, hve⟩ := he + exact hfixed e ⟨v, hX hv, hve⟩ + · intro v hv + exact hmissing v (hX hv) + +private theorem helper_huA_896.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let A : TreeSequence G e0 := base.core; + let y : V := T.vertex (Fin.last T.length); + ∀ (hlen : T.length = A.length + (1 : ℕ)), ( + ∀ {v : V}, v ∈ TreeSequenceVertexSet T → v ≠ y → v ∈ TreeSequenceVertexSet A) → + ∀ (i : Fin ett.rounds), (ett.series.data.tree i.succ.castSucc).length < (ett.series.data.tree + i.succ.succ).length → T.length = A.length + (1 : ℕ) → + ∀ (j : Fin ((↑(⟨A.length, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ⟩ : Fin T.length) : ℕ) + (1 : ℕ))), + let u : V := T.vertex (j.castLT ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + )); u ∈ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero A y hlen prefixMem i strictExtension + hstepLen j u + apply prefixMem + · exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨_, Finset.mem_univ _, rfl⟩ + · intro huy + have hidx := congrArg Fin.val (T.vertex_injective huy) + have hjLt := j.isLt + simp only [Fin.val_castLT, Fin.val_last] at hidx + omega + +private theorem helper_branch_931.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → C.hierarchy.dividerCount = (0 : + ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let y : V := T.vertex (Fin.last T.length); H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) = T → + ∀ (hlen : T.length = A.length + (1 : ℕ)), + ∀ alpha ∈ TreeMissingColors phi A, alpha ∈ MissingColors G phi y → ( + ∀ (f : E) (u v : V), u ∈ TreeSequenceVertexSet A → v ∉ TreeSequenceVertexSet A → G.ends f = + s(u, v) → T.edge (⟨A.length, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ⟩ : Fin T.length) = f → y = v) → + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)), ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data i.castSucc) : Finset (Fin k)) choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) (TreeMissingColors pi + (ett.series.data.tree i.succ.castSucc))) → ett.series.data.coloring i.succ = + choice.selected → ett.series.data.connectingEdges i.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind i.succ = some TashkinovExtensionKind.SE → (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length → n = i.succ → False + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hzero H A n Tn y hfirst hlen alpha + hAlphaA hAlphaY outsideEndpoint i choice seriesAlternative currentColoring currentEdges + currentKind strictExtension hslot + have hkind : ett.series.data.kind n = some TashkinovExtensionKind.SE := by + rw [hslot] + exact currentKind + have hcore : A = Tn := base.nonparallel (by rw [hkind]; decide) + have hphi : phi = choice.selected := ett.generatingColoring.trans + (by change ett.series.data.coloring n = choice.selected + rw [hslot]; exact currentColoring) + have hedges : ett.series.data.connectingEdges n = {choice.edge} := by + rw [hslot] + exact currentEdges + obtain ⟨r, hr, hedge⟩ := HierarchyNonparallelFirstEdge H choice.edge + (Or.inl hkind) hedges + have hedgeT : T.edge ⟨A.length, by omega⟩ = choice.edge := by + have hcore' : A = ett.series.data.tree (Fin.last ett.rounds).castSucc := hcore + have hr' : r.val = A.length := by simpa only [← hcore'] using hr + have hentry : ∃ s : Fin T.length, s.val = A.length ∧ T.edge s = choice.edge := by + have hh : ∃ s : Fin (H.stage ⟨1, by omega⟩).length, s.val = A.length ∧ + (H.stage ⟨1, by omega⟩).edge s = choice.edge := ⟨r, hr', hedge⟩ + rw [hfirst] at hh + exact hh + obtain ⟨s, hs, he⟩ := hentry + have hs' : s = ⟨A.length, by omega⟩ := Fin.ext hs + simpa only [hs'] using he + have htree : A = ett.series.data.tree i.succ.castSucc := by + simpa only [Tn, hslot] using hcore + have hy : y = choice.otherEndpoint := outsideEndpoint choice.edge + choice.vertex choice.otherEndpoint + (by rw [htree]; exact choice.vertexDefective.1) + (by rw [htree]; exact choice.otherOutside) choice.edgeEnds hedgeT + have hstable : StableColoring (ett.series.data.tree i.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i.castSucc)) + choice.selected phi := by + exact ⟨fun f _ _ => congrArg (fun psi => psi f) hphi, + fun v _ => congrArg (fun psi => MissingColors G psi v) hphi⟩ + have hdisjoint := seriesAlternative phi hproper hone hstable + exact Finset.disjoint_left.mp hdisjoint + (by simpa only [hy] using hAlphaY) (by simpa only [htree] using hAlphaA) + +private theorem helper_hedgeT_992.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) = T → + ∀ (hlen : T.length = A.length + (1 : ℕ)) (i : Fin ett.rounds) (available : + RevisitingExtensionCertificate ett.series.data i.castSucc), (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length → A = Tn → + ∀ (r : Fin (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))).length), (↑r : ℕ) = (ett.series.data.tree (Fin.last + ett.rounds).castSucc).length → (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))).edge r = available.edge → T.edge (⟨A.length, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ⟩ : Fin T.length) = available.edge := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero H A n Tn hfirst hlen i available + strictExtension hcore r hr hedge + have hcore' : A = ett.series.data.tree (Fin.last ett.rounds).castSucc := hcore + have hr' : r.val = A.length := by simpa only [← hcore'] using hr + obtain ⟨s, hs, he⟩ : ∃ s : Fin T.length, + s.val = A.length ∧ T.edge s = available.edge := by + have hh : ∃ s : Fin (H.stage ⟨1, by omega⟩).length, s.val = A.length ∧ + (H.stage ⟨1, by omega⟩).edge s = available.edge := ⟨r, hr', hedge⟩ + rw [hfirst] at hh + exact hh + simpa only [show s = ⟨A.length, by omega⟩ from Fin.ext hs] using he + +private theorem helper_hstart_1006.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (u : V), Sum.inl u ∈ TwoColorComponent G psi a + b (Sum.inl u)) → + ∀ (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data + i.castSucc), (ett.series.data.tree i.succ.castSucc).length < (ett.series.data.tree + i.succ.succ).length → + ∀ (r : Fin (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))).length), (↑r : ℕ) = (ett.series.data.tree (Fin.last + ett.rounds).castSucc).length → available.delta ∈ TreeMissingColors + (ett.series.data.coloring available.earlier) (ett.series.data.tree available.earlier.succ) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero H selfMem i available strictExtension r hr + have hkind := available.earlierPE + have hd := available.earlierDelta + have certH := ett.series.certified available.earlier + generalize hh : available.earlier = h at certH + cases certH with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + rw [hh, initialKind] at hkind + simp at hkind + | SE j pp po pc pn nr choice alt cc cs ce ck cv co cd cg ad ae cl oe st => + rw [hh, ck] at hkind + simp at hkind + | RE j pp po pc pn av cc cs ce ck cv co cd cg ad ae cl oe st => + rw [hh, ck] at hkind + simp at hkind + | PE j pp po pc pn nr choice alt gamma gr second sp so sr ew + cc cp cu cs ce ck cv co cd cg cl oe st => + have hdelta : choice.color = available.delta := by + rw [hh, cd] at hd + exact Option.some.inj hd + have hgammaMissing : gamma ∈ MissingColors G second choice.vertex := by + rw [sr.2 choice.vertex choice.vertexDefective.1] + exact gr.1 + have hchoiceColor : second choice.edge = some choice.color := + (sr.1 choice.edge ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union_right _ (Finset.mem_insert_self _ _), + choice.edgeColor⟩).trans choice.edgeColor + have hne : gamma ≠ choice.color := by + intro heq + have hn : gamma ∉ PresentColors G second choice.vertex := by + simpa [MissingColors] using hgammaMissing + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, by simpa only [heq] using hchoiceColor⟩ + have hm := (TwoColorComponentSwapMissingBehavior G second gamma choice.color hne sp + (Sum.inl choice.vertex)).2.1 choice.vertex (selfMem second gamma choice.color choice.vertex) + hgammaMissing + rw [cc] + apply Finset.mem_biUnion.mpr + refine ⟨choice.vertex, TreeSequenceInitialSegmentVertexSetSubset oe + choice.vertexDefective.1, ?_⟩ + simpa only [hdelta] using hm + +private theorem helper_transport_1051.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data + i.castSucc), (ett.series.data.tree i.succ.castSucc).length < (ett.series.data.tree + i.succ.succ).length → + ∀ (r : Fin (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))).length), (↑r : ℕ) = (ett.series.data.tree (Fin.last + ett.rounds).castSucc).length → available.delta ∈ TreeMissingColors + (ett.series.data.coloring available.earlier) (ett.series.data.tree available.earlier.succ) + → + ∀ (m : ℕ), (↑available.earlier : ℕ) ≤ m → m ≤ (↑i : ℕ) → + ∀ (j : Fin (ett.rounds + (1 : ℕ))), (↑j : ℕ) = m → available.delta ∈ TreeMissingColors + (ett.series.data.coloring j) (ett.series.data.tree j.succ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero H i available strictExtension r hr hstart + m hm + induction m, hm using Nat.le_induction with + | base => + intro hmi j hj + have heq : j = available.earlier := Fin.ext hj + simpa only [heq] using hstart + | succ m hm ih => + intro hmi j hj + let p : Fin (ett.rounds + 1) := ⟨m, by have := i.isLt; omega⟩ + have hprev := ih (by omega) p rfl + have hjkind := available.interveningRevisiting j (by omega) (by omega) (by + change j.val ≤ i.val + omega) + have certJ := ett.series.certified j + generalize hjSlot : j = js at certJ + cases certJ with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + rw [hjSlot, initialKind] at hjkind + simp at hjkind + | SE q pp po pc pn nr choice alt cc cs ce ck cv co cd cg ad ae cl oe st => + rw [hjSlot, ck] at hjkind + simp at hjkind + | PE q pp po pc pn nr choice alt gamma gr second sp so sr ew + cc cp cu cs ce ck cv co cd cg cl oe st => + rw [hjSlot, ck] at hjkind + simp at hjkind + | RE q pp po pc pn av cc cs ce ck cv co cd cg ad ae cl oe st => + have hqp : q.castSucc = p := by + apply Fin.ext + have hh := congrArg Fin.val hjSlot + simp only [Fin.val_succ] at hh + dsimp [p] + omega + have hqpTree : p.succ = q.succ.castSucc := by + apply Fin.ext + have := congrArg Fin.val hqp + simp only [Fin.val_succ, Fin.val_castSucc] at this ⊢ + omega + rw [cc] + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hprev + apply Finset.mem_biUnion.mpr + refine ⟨v, TreeSequenceInitialSegmentVertexSetSubset oe + (by simpa only [hqpTree] using hv), ?_⟩ + simpa only [hqp] using hvm + +private theorem helper_hcycleY_1104.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let y : V := T.vertex (Fin.last T.length); + ∀ (hlen : T.length = A.length + (1 : ℕ)), ( + ∀ (f : E) (u v : V), u ∈ TreeSequenceVertexSet A → v ∉ TreeSequenceVertexSet A → G.ends f = + s(u, v) → T.edge (⟨A.length, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ⟩ : Fin T.length) = f → y = v) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (cycle : TwoColorCycle G psi a b) (f : E) (u v + : V), G.ends f = s(u, v) → Sum.inr f ∈ cycle.walk.support → Sum.inl v ∈ + cycle.walk.support) → + ∀ (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data + i.castSucc), (ett.series.data.tree i.succ.castSucc).length < (ett.series.data.tree + i.succ.succ).length → + ∀ (r : Fin (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))).length), (↑r : ℕ) = (ett.series.data.tree (Fin.last + ett.rounds).castSucc).length → y = available.outsideEndpoint → Sum.inl y ∈ + available.cycle.walk.support := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero H A y hlen outsideEndpoint cycleEndpoint + i available strictExtension r hr hy + have hy' := cycleEndpoint (ett.series.data.coloring i.castSucc) + available.gamma available.delta available.cycle available.edge + available.insideEndpoint available.outsideEndpoint available.edgeEnds + available.edgeOnCycle + simpa only [hy] using hy' + +private theorem helper_hclosed_1114.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + ∀ (i : Fin ett.rounds), ColoredVertexSetClosed G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) → (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length → phi = + ett.series.data.coloring i.castSucc → A = ett.series.data.tree i.succ.castSucc → + ∀ (r : Fin (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))).length), (↑r : ℕ) = (ett.series.data.tree (Fin.last + ett.rounds).castSucc).length → ColoredVertexSetClosed G phi (TreeSequenceVertexSet A) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero H A i previousClosed strictExtension hphi + htree r hr f c v hf hv hfc hm + have hf' : f ∈ BoundaryEdges G + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) := by + simpa only [htree] using hf + have hv' : v ∈ TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc) := by + simpa only [htree] using hv + exact previousClosed hf' hv' (by simpa only [hphi] using hfc) + (by simpa only [hphi] using hm) + +private theorem helper_branch_1178.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + C.hierarchy.dividerCount = (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let y : V := T.vertex (Fin.last T.length); + ∀ (hlen : T.length = A.length + (1 : ℕ)) (alpha : Fin k), ( + ∀ (f : E) (u v : V), u ∈ TreeSequenceVertexSet A → v ∉ TreeSequenceVertexSet A → G.ends f = + s(u, v) → T.edge (⟨A.length, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ⟩ : Fin T.length) = f → y = v) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (cycle : TwoColorCycle G psi a b) (f : E) (u v + : V), G.ends f = s(u, v) → Sum.inr f ∈ cycle.walk.support → Sum.inl v ∈ + cycle.walk.support) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), IsProperEdgeColoring G psi → + ∀ (cycle : TwoColorCycle G psi a b) (v : V), Sum.inl v ∈ cycle.walk.support → a ∈ + MissingColors G psi v ∨ b ∈ MissingColors G psi v → False) → + ∀ (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data + i.castSucc), (ett.series.data.tree i.succ.castSucc).length < (ett.series.data.tree + i.succ.succ).length → + ∀ (r : Fin (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))).length), (↑r : ℕ) = (ett.series.data.tree (Fin.last + ett.rounds).castSucc).length → y = available.outsideEndpoint → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi available.delta alpha + (Sum.inl y); available.delta ∈ MissingColors G sigma y → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + corr.replacementSeries.data.connectingEdges n = ({ available.edge } : Finset E) → + available.delta ∈ corr.replacementSeries.data.stored n → + ∀ (q : Fin ett.rounds), IsProperEdgeColoring G (corr.replacementSeries.data.coloring + q.castSucc) → + ∀ (av : RevisitingExtensionCertificate corr.replacementSeries.data q.castSucc), + corr.replacementSeries.data.coloring q.succ = corr.replacementSeries.data.coloring + q.castSucc → corr.replacementSeries.data.stored q.succ = (insert av.delta ({ av.gamma } : + Finset (Fin k)) : Finset (Fin k)) → corr.replacementSeries.data.connectingEdges q.succ = + ({ av.edge } : Finset E) → (corr.replacementSeries.data.tree q.succ.castSucc).length < + (corr.replacementSeries.data.tree q.succ.succ).length → n = q.succ → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hzero H A n y hlen alpha outsideEndpoint + cycleEndpoint cycleMissing i available strictExtension r hr hy sigma hDeltaY corr hRepEdges + hRepDelta q pp av cc cs ce st hRepSlot + have hf : av.edge = available.edge := by + have hh : av.edge ∈ corr.replacementSeries.data.connectingEdges n := by + rw [hRepSlot, ce] + simp + rw [hRepEdges] at hh + exact Finset.mem_singleton.mp hh + have hcolor : sigma = corr.replacementSeries.data.coloring q.castSucc := + corr.finalGeneratingColoring.trans (by + change corr.replacementSeries.data.coloring n = + corr.replacementSeries.data.coloring q.castSucc + rw [hRepSlot]; exact cc) + have hcyEdge : Sum.inr available.edge ∈ av.cycle.walk.support := by + simpa only [hf] using av.edgeOnCycle + have hcyY : Sum.inl y ∈ av.cycle.walk.support := by + have hh := cycleEndpoint (corr.replacementSeries.data.coloring q.castSucc) + av.gamma av.delta av.cycle available.edge + available.insideEndpoint available.outsideEndpoint available.edgeEnds hcyEdge + simpa only [hy] using hh + rw [hRepSlot, cs] at hRepDelta + have hpair : available.delta = av.delta ∨ available.delta = av.gamma := by + simpa only [Finset.mem_insert, Finset.mem_singleton] using hRepDelta + apply cycleMissing (corr.replacementSeries.data.coloring q.castSucc) + av.gamma av.delta pp av.cycle y hcyY + rcases hpair with hd | hg + · exact Or.inr (by simpa only [← hd, hcolor] using hDeltaY) + · exact Or.inl (by simpa only [← hg, hcolor] using hDeltaY) + +private theorem helper_branch_1205.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → LowerRoundInductionHypothesis G k + e0 ett.rounds → C.hierarchy.dividerCount = (0 : ℕ) → + let _ : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let y : V := T.vertex (Fin.last T.length); TreeSequenceInitialSegment A T → T.length = + A.length + (1 : ℕ) → ( + ∀ {v : V}, v ∈ TreeSequenceVertexSet T → v ≠ y → v ∈ TreeSequenceVertexSet A) → + ∀ alpha ∈ TreeMissingColors phi A, alpha ∈ MissingColors G phi y → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → X.length = Y.length → X = Y) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (u : V), Sum.inl u ∈ TwoColorComponent G psi a + b (Sum.inl u)) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → + TreeInterchangeable G A psi a b → a ∈ TreeMissingColors psi A → b ∈ TreeMissingColors psi + A → a ∈ MissingColors G psi y ∨ b ∈ MissingColors G psi y → + ∀ v ∈ TreeSequenceVertexSet A, Sum.inl v ∉ TwoColorComponent G psi a b (Sum.inl y)) → ( + ∀ (a b : Fin k), a ≠ b → ( + ∀ v ∈ TreeSequenceVertexSet A, Sum.inl v ∉ TwoColorComponent G phi a b (Sum.inl y)) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi a b (Sum.inl y); + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ ( + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) ∧ + ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (i : Fin ett.rounds) (_ : Fin k), ett.series.data.kind i.succ = some + TashkinovExtensionKind.PE → TashkinovClosure (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree i.succ.succ) → + (ett.series.data.tree i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length + → n = i.succ → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hzero H A n Tn y hAT hlen + prefixMem alpha hAlphaA hAlphaY commonPrefix equalTrees selfMem outsideCommon outsideSwap i + gamma currentKind closedExtension strictExtension hslot + have hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE := by + rw [hslot] + exact currentKind + obtain ⟨union⟩ := (base.parallel hPE).2.2 + have hTnA : TreeSequenceInitialSegment Tn A := union.leftSegment + have hTnFinal : TashkinovAugmentationSequence phi Tn + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + exact @helper_hTnFinal_763 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@i) (@closedExtension) + (@strictExtension) (@hslot) + have hTnT : TreeSequenceInitialSegment Tn T := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hTnFinal) + ett.belowFinal (le_trans hTnA.1 hAT.1) + have hrouteT : TashkinovAugmentationSequence phi Tn T := + TashkinovAugmentationSequenceRestrict phi _ _ _ hTnFinal hTnT ett.belowFinal + have hrouteA : TashkinovAugmentationSequence phi A T := + TashkinovAugmentationSequenceSuffix phi _ _ _ hrouteT hTnA hAT + have hstep : TashkinovAugmentation phi A T := by + exact @helper_hstep_780 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@hlen) (@equalTrees) + (@i) (@strictExtension) (@hrouteA) + obtain ⟨hstepLen, hstepSegment, beta, hBetaEdge, hBetaA⟩ := hstep + let f := T.edge ⟨A.length, by omega⟩ + have hBetaF : phi f = some beta := by + convert hBetaEdge using 2 + apply congrArg T.edge + apply Fin.ext + rfl + have hfy : Incident G y f := by + exact @helper_hfy_804 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@hlen) (@i) + (@strictExtension) (@hstepLen) + have hAlphaBeta : alpha ≠ beta := by + intro heq + have hn : alpha ∉ PresentColors G phi y := by simpa [MissingColors] using hAlphaY + exact hn (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hfy, by simpa only [heq] using hBetaF⟩) + let M := ((TreeMissingColors phi Tn ∩ TreeMissingColors phi base.closure) \ + (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0)) + have hMcard : 4 ≤ M.card := (C.good.parallelBase hPE).2 + obtain ⟨theta, htM, htAvoid⟩ : ∃ theta ∈ M, theta ∉ ({alpha, beta} : Finset (Fin k)) := by + apply Finset.exists_mem_notMem_of_card_lt_card + have habcard : ({alpha, beta} : Finset (Fin k)).card ≤ 2 := by + calc + ({alpha, beta} : Finset (Fin k)).card ≤ ({beta} : Finset (Fin k)).card + 1 := + Finset.card_insert_le _ _ + _ = 2 := by simp + omega + have hThetaAlpha : theta ≠ alpha := by intro he; exact htAvoid (by simp [he]) + have hThetaBeta : theta ≠ beta := by intro he; exact htAvoid (by simp [he]) + have hThetaTn : theta ∈ TreeMissingColors phi Tn := + (Finset.mem_inter.mp (Finset.mem_sdiff.mp htM).1).1 + have hThetaR : theta ∈ TreeMissingColors phi base.closure := + (Finset.mem_inter.mp (Finset.mem_sdiff.mp htM).1).2 + have hThetaA : theta ∈ TreeMissingColors phi A := by + obtain ⟨u, hu, hum⟩ := Finset.mem_biUnion.mp hThetaTn + exact Finset.mem_biUnion.mpr + ⟨u, TreeSequenceInitialSegmentVertexSetSubset hTnA hu, hum⟩ + have hstablePhi : CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data n) phi phi := + ⟨⟨fun _ _ _ => rfl, fun _ _ => rfl⟩, + ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩⟩ + have hThetaClosed := InterchangePECommonMissingClosed G k e0 input T phi phi + ett C.maximum C.positive hlower hPE base hproper hone hstablePhi theta hThetaTn hThetaR + have hInter := (interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hPE base hproper hone hstablePhi theta alpha).2.2.1 hThetaA hThetaClosed + have havoid := outsideCommon phi theta alpha hThetaAlpha hproper + hInter hThetaA hAlphaA (Or.inr hAlphaY) + let sigma := TwoColorComponentSwap G phi theta alpha (Sum.inl y) + obtain ⟨hsigmaProper, hsigmaOne, hfixed, hmissing⟩ := + outsideSwap theta alpha hThetaAlpha havoid + have hThetaY : theta ∈ MissingColors G sigma y := + (TwoColorComponentSwapMissingBehavior G phi theta alpha hThetaAlpha + hproper (Sum.inl y)).2.2.1 y (selfMem phi theta alpha y) hAlphaY + have hmissingA : TreeMissingColors sigma A = TreeMissingColors phi A := by + unfold TreeMissingColors + apply Finset.biUnion_congr rfl + intro v hv + exact hmissing v hv + have hRsub : TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A := by + rw [union.vertexSet] + exact Finset.subset_union_right + have stableOn (X : TreeSequence G e0) (D : Finset (Fin k)) + (hX : TreeSequenceVertexSet X ⊆ TreeSequenceVertexSet A) : + StableColoring X D phi sigma := by + exact @helper_stableOn_862 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@alpha) (@i) + (@strictExtension) (@hstepLen) (@theta) (@hfixed) (@hmissing) (@X) (@D) (@hX) + have hsigmaStable : CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data n) phi sigma := + ⟨stableOn Tn _ (TreeSequenceInitialSegmentVertexSetSubset hTnA), + stableOn base.closure ∅ hRsub⟩ + have hThetaTnSigma : theta ∈ TreeMissingColors sigma Tn := by + obtain ⟨u, hu, hum⟩ := Finset.mem_biUnion.mp hThetaTn + exact Finset.mem_biUnion.mpr ⟨u, hu, by + rw [hsigmaStable.1.2 u hu]; exact hum⟩ + have hThetaRSigma : theta ∈ TreeMissingColors sigma base.closure := by + obtain ⟨u, hu, hum⟩ := Finset.mem_biUnion.mp hThetaR + exact Finset.mem_biUnion.mpr ⟨u, hu, by + rw [hsigmaStable.2.2 u hu]; exact hum⟩ + have hThetaClosedSigma := InterchangePECommonMissingClosed G k e0 input T phi sigma + ett C.maximum C.positive hlower hPE base hsigmaProper hsigmaOne hsigmaStable + theta hThetaTnSigma hThetaRSigma + have hThetaASigma : theta ∈ TreeMissingColors sigma A := by rwa [hmissingA] + have hBetaASigma : beta ∈ TreeMissingColors sigma A := by rwa [hmissingA] + have hInterSigma := (interchange G k e0 input T phi sigma ett C.maximum C.positive + hlower hPE base hsigmaProper hsigmaOne hsigmaStable theta beta).2.2.1 + hThetaASigma hThetaClosedSigma + have havoidSigma := outsideCommon sigma theta beta hThetaBeta hsigmaProper + hInterSigma hThetaASigma hBetaASigma (Or.inl hThetaY) + obtain ⟨j, hj⟩ := T.attaches ⟨A.length, by omega⟩ + let u := T.vertex (Fin.castLT j (Nat.lt_trans j.isLt + (Nat.succ_lt_succ (show A.length < T.length by omega)))) + have huA : u ∈ TreeSequenceVertexSet A := by + exact @helper_huA_896 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@hlen) (@prefixMem) (@i) + (@strictExtension) (@hstepLen) (@j) + have huf : Incident G u f := by + change u ∈ G.ends f + rw [hj] + exact Sym2.mem_mk_right _ _ + have hSigmaF : sigma f = some beta := + (hfixed f ⟨u, huA, huf⟩).trans hBetaF + have hyAdj : (TwoColorIncidenceGraph G sigma theta beta).Adj (Sum.inl y) (Sum.inr f) := + ⟨hfy, Or.inr hSigmaF⟩ + have huAdj : (TwoColorIncidenceGraph G sigma theta beta).Adj (Sum.inl u) (Sum.inr f) := + ⟨huf, Or.inr hSigmaF⟩ + have huC : Sum.inl u ∈ TwoColorComponent G sigma theta beta (Sum.inl y) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj huAdj).trans + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hyAdj).symm + exact havoidSigma u huA huC + +private theorem helper_branch_1573.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → LowerRoundInductionHypothesis G k e0 ett.rounds → + C.hierarchy.dividerCount = (0 : ℕ) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := base.core; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let y : V := T.vertex (Fin.last T.length); H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) = T → TreeSequenceInitialSegment A T → + ∀ (hlen : T.length = A.length + (1 : ℕ)), y ∉ TreeSequenceVertexSet A → + ∀ alpha ∈ TreeMissingColors phi A, alpha ∈ MissingColors G phi y → ( + ∀ (f : E) (u v : V), u ∈ TreeSequenceVertexSet A → v ∉ TreeSequenceVertexSet A → G.ends f = + s(u, v) → T.edge (⟨A.length, + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ⟩ : Fin T.length) = f → y = v) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → X.length = Y.length → X = Y) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (u : V), Sum.inl u ∈ TwoColorComponent G psi a + b (Sum.inl u)) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (cycle : TwoColorCycle G psi a b) (f : E) (u v + : V), G.ends f = s(u, v) → Sum.inr f ∈ cycle.walk.support → Sum.inl v ∈ + cycle.walk.support) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), IsProperEdgeColoring G psi → + ∀ (cycle : TwoColorCycle G psi a b) (v : V), Sum.inl v ∈ cycle.walk.support → a ∈ + MissingColors G psi v ∨ b ∈ MissingColors G psi v → False) → ( + ∀ (a b : Fin k), a ≠ b → ( + ∀ v ∈ TreeSequenceVertexSet A, Sum.inl v ∉ TwoColorComponent G phi a b (Sum.inl y)) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi a b (Sum.inl y); + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ ( + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f) ∧ + ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (i : Fin ett.rounds), IsProperEdgeColoring G (ett.series.data.coloring i.castSucc) → + ColoredVertexSetClosed G (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate ett.series.data i.castSucc), + ett.series.data.coloring i.succ = ett.series.data.coloring i.castSucc → + ett.series.data.stored i.succ = (insert available.delta ({ available.gamma } : Finset (Fin + k)) : Finset (Fin k)) → ett.series.data.connectingEdges i.succ = ({ available.edge } : + Finset E) → ett.series.data.kind i.succ = some TashkinovExtensionKind.RE → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) available.edge adjoined → TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ) → (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length → n = i.succ → False + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hlower hzero H A n Tn y hfirst hAT hlen + hyNot alpha hAlphaA hAlphaY outsideEndpoint commonPrefix equalTrees selfMem cycleEndpoint + cycleMissing outsideSwap i previousProper previousClosed available currentColoring + currentStored currentEdges currentKind adjoined adjoinedExactly closedExtension + strictExtension hslot + have hRE : ett.series.data.kind n = some TashkinovExtensionKind.RE := by + rw [hslot] + exact currentKind + have hcore : A = Tn := base.nonparallel (by rw [hRE]; decide) + have hphi : phi = ett.series.data.coloring i.castSucc := + ett.generatingColoring.trans (by + change ett.series.data.coloring n = ett.series.data.coloring i.castSucc + rw [hslot]; exact currentColoring) + have htree : A = ett.series.data.tree i.succ.castSucc := by + simpa only [Tn, hslot] using hcore + have hedges : ett.series.data.connectingEdges n = {available.edge} := by + rw [hslot] + exact currentEdges + obtain ⟨r, hr, hedge⟩ := HierarchyNonparallelFirstEdge H available.edge + (Or.inr hRE) hedges + have hedgeT : T.edge ⟨A.length, by omega⟩ = available.edge := by + exact @helper_hedgeT_992 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@hfirst) (@hlen) (@i) + (@available) (@strictExtension) (@hcore) (@r) (@hr) (@hedge) + have hy : y = available.outsideEndpoint := outsideEndpoint available.edge + available.insideEndpoint available.outsideEndpoint + (by rw [htree]; exact available.insideInCurrent) + (by rw [htree]; exact available.outsideNotCurrent) available.edgeEnds hedgeT + have hstart : available.delta ∈ TreeMissingColors + (ett.series.data.coloring available.earlier) + (ett.series.data.tree available.earlier.succ) := by + exact @helper_hstart_1006 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@selfMem) (@i) + (@available) (@strictExtension) (@r) (@hr) + have transport : ∀ m : ℕ, available.earlier.val ≤ m → m ≤ i.val → + ∀ j : Fin (ett.rounds + 1), j.val = m → + available.delta ∈ TreeMissingColors (ett.series.data.coloring j) + (ett.series.data.tree j.succ) := by + exact @helper_transport_1051 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@i) + (@available) (@strictExtension) (@r) (@hr) (@hstart) + have hDeltaA : available.delta ∈ TreeMissingColors phi A := by + have hm := transport i.val available.earlierAtMost (le_rfl) i.castSucc rfl + have hiTree : i.castSucc.succ = i.succ.castSucc := by apply Fin.ext; rfl + simpa only [hphi, htree, hiTree] using hm + have hcycleY : Sum.inl y ∈ available.cycle.walk.support := by + exact @helper_hcycleY_1104 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@hlen) + (@outsideEndpoint) (@cycleEndpoint) (@i) (@available) (@strictExtension) (@r) (@hr) (@hy) + by_cases hda : available.delta = alpha + · exact cycleMissing (ett.series.data.coloring i.castSucc) + available.gamma available.delta previousProper available.cycle y hcycleY + (Or.inr (by simpa only [hda, hphi] using hAlphaY)) + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet A) := by + exact @helper_hclosed_1114 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@i) (@previousClosed) + (@strictExtension) (@hphi) (@htree) (@r) (@hr) + obtain ⟨u, hu, huDelta⟩ := Finset.mem_biUnion.mp hDeltaA + obtain ⟨v, hv, hvAlpha⟩ := Finset.mem_biUnion.mp hAlphaA + have havoid := (ClosedSetTwoColorComponentAvoidance G phi available.delta alpha + (TreeSequenceVertexSet A) y u v hclosed hyNot hu hv huDelta hvAlpha).1 + let sigma := TwoColorComponentSwap G phi available.delta alpha (Sum.inl y) + obtain ⟨hsigmaProper, hsigmaOne, hfixed, hmissing⟩ := outsideSwap available.delta alpha hda havoid + have hDeltaY : available.delta ∈ MissingColors G sigma y := + (TwoColorComponentSwapMissingBehavior G phi available.delta alpha hda hproper + (Sum.inl y)).2.2.1 y (selfMem phi available.delta alpha y) hAlphaY + have hsigmaStable : StableColoring Tn (TashkinovStoredColors ett.series.data n) + phi sigma := by + rw [← hcore] + exact ⟨fun f hf hc => hfixed f hf, hmissing⟩ + have hmod := Td G k e0 input T phi ett C.maximum C.positive hlower sigma + hsigmaProper hsigmaOne (by simpa only [← ett.generatingColoring] using hsigmaStable) + have hadjoinedFinal := TashkinovAugmentationSequenceInitialSegment + (ett.series.data.coloring i.succ) _ _ closedExtension.1 + have hfinal : i.succ.succ = Fin.last (ett.rounds + 1) := by + apply Fin.ext + have hh := congrArg Fin.val hslot + simp only [n, Fin.val_last, Fin.val_succ] at hh ⊢ + omega + rw [hfinal] at hadjoinedFinal + have hadjoinedLen : adjoined.length = T.length := by + have := adjoinedExactly.1 + rw [← htree] at this + omega + have hadjoinedT : adjoined = T := equalTrees + (commonPrefix hadjoinedFinal ett.belowFinal (by omega)) hadjoinedLen + have hseed : TreeSequenceAdjoinEdge Tn available.edge T := by + simpa only [Tn, hslot, hadjoinedT] using adjoinedExactly + obtain ⟨corr⟩ := hmod.2.2 T (by + change TreeSequenceInitialSegment Tn T + rw [← hcore]; exact hAT) + (by change Tn.length < T.length; rw [← hcore]; omega) + (Or.inr ⟨Or.inr hRE, available.edge, T, hedges, hseed, Relation.ReflTransGen.refl⟩) + have hRepKind := (corr.extensionKindsAgree n).trans hRE + have hRepEdges := (corr.connectingEdgesAgree n).trans hedges + have hRepDelta : available.delta ∈ corr.replacementSeries.data.stored n := by + rw [corr.storedColorsAgree, hslot, currentStored] + simp + have repCert := corr.replacementSeries.certified n + generalize hRepSlot : n = repSlot at repCert + cases repCert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + rw [hRepSlot, initialKind] at hRepKind + simp at hRepKind + | SE q pp po pc pn nr choice alt cc cs ce ck cv co cd cg ad ae cl oe st => + rw [hRepSlot, ck] at hRepKind + simp at hRepKind + | PE q pp po pc pn nr choice alt gamma gr second sp so sr ew + cc cp cu cs ce ck cv co cd cg cl oe st => + rw [hRepSlot, ck] at hRepKind + simp at hRepKind + | RE q pp po pc pn av cc cs ce ck cv co cd cg ad ae cl oe st => + exact @helper_branch_1178 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@hlen) (@alpha) + (@outsideEndpoint) (@cycleEndpoint) (@cycleMissing) (@i) (@available) + (@strictExtension) (@r) (@hr) (@hy) (@hDeltaY) (@corr) (@hRepEdges) (@hRepDelta) (@q) + (@pp) (@av) (@cc) (@cs) (@ce) (@st) (@hRepSlot) + +theorem HierarchyCounterexampleOneAdditionZeroDividerImpossible + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (_ : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (honeAddition : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + T.length - A.length = 1) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hzero : C.hierarchy.dividerCount = 0) : False := by + classical + let H := C.hierarchy + let A := base.core + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let y := T.vertex (Fin.last T.length) + have hstar : HierarchyStarredStage H (Fin.last H.dividerCount) = A := by + exact @helper_hstar_138 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) + have hfirst : H.stage ⟨1, by omega⟩ = T := by + exact @helper_hfirst_144 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) + have hAT : TreeSequenceInitialSegment A T := by + simpa only [hfirst] using H.coreInsideFirst + have hlen : T.length = A.length + 1 := by + exact @helper_hlen_155 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@honeAddition) (@hzero) (@hstar) (@hAT) + have prefixMem : ∀ {v : V}, v ∈ TreeSequenceVertexSet T → + v ≠ y → v ∈ TreeSequenceVertexSet A := by + exact @helper_prefixMem_161 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@hAT) (@hlen) + have hyNot : y ∉ TreeSequenceVertexSet A := by + exact @helper_hyNot_179 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@hAT) (@hlen) + have hAElementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by + exact @helper_hAElementary_187 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@hprefixElementary) (@hzero) (@hstar) (@hAT) (@hlen) + obtain ⟨alpha, hAlphaA, hAlphaY⟩ : ∃ alpha : Fin k, + alpha ∈ TreeMissingColors phi A ∧ alpha ∈ MissingColors G phi y := by + by_contra hnone + have hn : ∀ alpha, alpha ∈ TreeMissingColors phi A → + alpha ∉ MissingColors G phi y := by + intro alpha ha hy + exact hnone ⟨alpha, ha, hy⟩ + apply C.notElementary + intro u hu v hv huv + by_cases huy : u = y + · have hvA := prefixMem hv (by intro hvy; exact huv (huy.trans hvy.symm)) + apply Finset.disjoint_left.mpr + intro alpha hau hav + exact hn alpha (Finset.mem_biUnion.mpr ⟨v, hvA, hav⟩) (huy ▸ hau) + · exact @helper_branch_227 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@hlen) (@prefixMem) + (@hAElementary) (@hn) (@u) (@hu) (@v) (@hv) (@huv) (@huy) + have outsideEndpoint (f : E) (u v : V) + (hu : u ∈ TreeSequenceVertexSet A) (hv : v ∉ TreeSequenceVertexSet A) + (hends : G.ends f = Sym2.mk u v) + (hf : T.edge ⟨A.length, by omega⟩ = f) : y = v := by + exact @helper_outsideEndpoint_233 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@hlen) + (@hyNot) (@f) (@u) (@v) (@hu) (@hends) (@hf) + have commonPrefix {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + exact @helper_commonPrefix_250 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@X) (@Y) + (@Z) (@hXZ) (@hYZ) (@hXY) + have equalTrees {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) (hl : X.length = Y.length) : X = Y := by + exact @helper_equalTrees_263 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@X) (@Y) + (@hXY) (@hl) + have leaf (psi : PartialEdgeColoring E k) (a b : Fin k) + (hp : IsProperEdgeColoring G psi) (u : V) + (hm : a ∈ MissingColors G psi u ∨ b ∈ MissingColors G psi u) : + Set.Subsingleton ((TwoColorIncidenceGraph G psi a b).neighborSet (Sum.inl u)) := by + exact @helper_leaf_279 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@psi) (@a) (@b) (@hp) (@u) + (@hm) + have selfMem (psi : PartialEdgeColoring E k) (a b : Fin k) (u : V) : + Sum.inl u ∈ TwoColorComponent G psi a b (Sum.inl u) := + SimpleGraph.ConnectedComponent.eq.mpr (SimpleGraph.Reachable.refl _) + have cycleEndpoint (psi : PartialEdgeColoring E k) (a b : Fin k) + (cycle : TwoColorCycle G psi a b) (f : E) (u v : V) + (hends : G.ends f = Sym2.mk u v) + (hf : Sum.inr f ∈ cycle.walk.support) : + Sum.inl v ∈ cycle.walk.support := by + exact @helper_cycleEndpoint_314 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@psi) + (@a) (@b) (@cycle) (@f) (@u) (@v) (@hends) (@hf) + have cycleMissing (psi : PartialEdgeColoring E k) (a b : Fin k) + (hp : IsProperEdgeColoring G psi) (cycle : TwoColorCycle G psi a b) + (v : V) (hv : Sum.inl v ∈ cycle.walk.support) + (hm : a ∈ MissingColors G psi v ∨ b ∈ MissingColors G psi v) : False := by + exact @helper_cycleMissing_343 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@leaf) + (@psi) (@a) (@b) (@hp) (@cycle) (@v) (@hv) (@hm) + have outsideCommon (psi : PartialEdgeColoring E k) (a b : Fin k) + (hab : a ≠ b) (hp : IsProperEdgeColoring G psi) + (hi : TreeInterchangeable G A psi a b) + (ha : a ∈ TreeMissingColors psi A) (hb : b ∈ TreeMissingColors psi A) + (hym : a ∈ MissingColors G psi y ∨ b ∈ MissingColors G psi y) : + ∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G psi a b (Sum.inl y) := by + exact @helper_outsideCommon_352 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (by + assumption) (@hzero) (@hyNot) (@leaf) (@selfMem) (@psi) (@a) (@b) (@hab) (@hp) (@hi) + (@ha) (@hb) (@hym) + have outsideSwap (a b : Fin k) (hab : a ≠ b) + (havoid : ∀ v ∈ TreeSequenceVertexSet A, + Sum.inl v ∉ TwoColorComponent G phi a b (Sum.inl y)) : + let sigma := TwoColorComponentSwap G phi a b (Sum.inl y) + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ + (∀ f, TreeIncidentEdge A f → sigma f = phi f) ∧ + (∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) := by + dsimp only + have hfixed (f : E) (hf : TreeIncidentEdge A f) : + TwoColorComponentSwap G phi a b (Sum.inl y) f = phi f := by + exact @helper_hfixed_432 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hzero) (@a) (@b) (@havoid) + (@f) (@hf) + refine ⟨TwoColorComponentSwapProper G phi a b hab hproper (Sum.inl y), ?_, + hfixed, ?_⟩ + · exact @helper_branch_448 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hone) (@hzero) (@a) (@b) (@hab) + · intro v hv + exact (TwoColorComponentSwapMissingBehavior G phi a b hab hproper (Sum.inl y)).1 + v (havoid v hv) + have hnPositive : 0 < n.val := C.positive + have cert := ett.series.certified n + generalize hslot : n = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + have hv := congrArg Fin.val hslot + simp only [Fin.val_zero] at hv + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_931 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hzero) (@hfirst) (@hlen) (@alpha) (@hAlphaA) (@hAlphaY) + (@outsideEndpoint) (@i) (@choice) (@seriesAlternative) (@currentColoring) + (@currentEdges) (@currentKind) (@strictExtension) (@hslot) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension strictExtension => + exact @helper_branch_1573 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hlower) (@hzero) (@hfirst) (@hAT) (@hlen) (@hyNot) (@alpha) (@hAlphaA) (@hAlphaY) + (@outsideEndpoint) (@commonPrefix) (@equalTrees) (@selfMem) (@cycleEndpoint) + (@cycleMissing) (@outsideSwap) (@i) (@previousProper) (@previousClosed) + (@available) (@currentColoring) (@currentStored) (@currentEdges) (@currentKind) + (@adjoined) (@adjoinedExactly) (@closedExtension) (@strictExtension) (@hslot) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_1205 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@hzero) (@hAT) (@hlen) (@prefixMem) (@alpha) (@hAlphaA) + (@hAlphaY) (@commonPrefix) (@equalTrees) (@selfMem) (@outsideCommon) (@outsideSwap) + (@i) (@gamma) (@currentKind) (@closedExtension) (@strictExtension) (@hslot) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexamplePathNumberBounds.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexamplePathNumberBounds.lean new file mode 100644 index 0000000000..662cb4ec82 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexamplePathNumberBounds.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo + +/-! +# Hierarchy Counterexample Path Number Bounds + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchyCounterexamplePathNumberBounds {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let r := HierarchyPathNumber H + 1 ≤ r ∧ r ≤ ell := by + classical + have htail := HierarchyCounterexampleTailAtLeastTwo G k e0 input T phi ett base C + hproper hone hlower hfewer hminimal hlarge + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let candidates := (Finset.Icc 1 ell).filter fun i => + ∀ q : Fin T.length, A.length + i ≤ q.val → + G.ends (T.edge q) = s(T.vertex q.castSucc, T.vertex q.succ) + have htail' : 2 ≤ ell := by + dsimp [ell, A, H] + exact htail + have hAle : A.length ≤ T.length := by omega + have hsum : A.length + ell = T.length := Nat.add_sub_of_le hAle + have hellpos : 1 ≤ ell := by omega + have hellmem : ell ∈ candidates := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_Icc.mpr ⟨hellpos, le_rfl⟩, ?_⟩ + intro q hq + exfalso + omega + have hnonempty : candidates.Nonempty := ⟨ell, hellmem⟩ + have hminmem : candidates.min' hnonempty ∈ candidates := + Finset.min'_mem candidates hnonempty + have hminbounds : 1 ≤ candidates.min' hnonempty ∧ + candidates.min' hnonempty ≤ ell := by + exact (Finset.mem_Icc.mp (Finset.mem_filter.mp hminmem).1) + change (1 ≤ (if h : candidates.Nonempty then candidates.min' h else ell) ∧ + (if h : candidates.Nonempty then candidates.min' h else ell) ≤ ell) + rw [dite_eq_left hnonempty] + exact hminbounds + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexamplePenultimateElementary.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexamplePenultimateElementary.lean new file mode 100644 index 0000000000..357ef3f6e4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexamplePenultimateElementary.lean @@ -0,0 +1,777 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage + +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess + +public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary + +/-! +# Hierarchy Counterexample Penultimate Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_111.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base), + LowerRoundInductionHypothesis G k e0 ett.rounds → + let finalIndex : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; ( + ∀ {rho sigma : PartialEdgeColoring E k} {X : TreeSequence G e0}, ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G rho v) → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet X) → ColoredVertexSetElementary G + sigma (TreeSequenceVertexSet X)) → + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)), ett.series.data.coloring i.succ = choice.selected + → ett.series.data.kind i.succ = some TashkinovExtensionKind.SE → finalIndex = i.succ → + i.succ ≠ (0 : Fin (ett.rounds + (1 : ℕ))) → ColoredVertexSetElementary G phi + (TreeSequenceVertexSet base.core) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hlower finalIndex transportElementary i choice + currentColoring currentKind indexEquation hfinalIndex + have currentKind' : ett.series.data.kind finalIndex = + some TashkinovExtensionKind.SE := by + simpa [indexEquation] using currentKind + have currentColoring' : ett.series.data.coloring finalIndex = + choice.selected := by + simpa [indexEquation] using currentColoring + have htree : base.core = + ett.series.data.tree (Fin.last ett.rounds).castSucc := + base.nonparallel (by + intro hk + rw [currentKind'] at hk + cases hk) + rw [htree] + have hprev : ColoredVertexSetElementary G + (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) := by + have hi : i.succ = Fin.last ett.rounds := by + apply Fin.ext + have hz := congrArg Fin.val indexEquation + simp [finalIndex] at hz ⊢ + omega + intro u hu v hv huv + by_cases honeRound : ett.rounds = 1 + · have htech : ColoredVertexSetElementary G + (ett.series.data.coloring 0) + (TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩)) := + (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + have hi : i = ⟨0, by omega⟩ := by apply Fin.ext; omega + have hu' : u ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨1, by omega⟩) := by simpa [hi, honeRound] using hu + have hv' : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨1, by omega⟩) := by simpa [hi, honeRound] using hv + have hci : i.castSucc = (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + have hz := congrArg Fin.val hi + simp at hz ⊢ + omega + rw [hci] + exact htech hu' hv' huv + · have hres := CertifiedETTRestriction G k e0 input T phi ett C.maximum + (ett.rounds - 1) (by omega) (by omega) + rcases hres with ⟨restricted, restrictedRounds, restrictedMaximum, + restrictedTrees, restrictedData⟩ + have hl : ColoredVertexSetElementary G + (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + have hlow : + ∀ {u}, u ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨ett.rounds - 1 + 1, + by omega + ⟩ : Fin (ett.rounds + 2))) → + ∀ {v}, v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨ett.rounds - 1 + 1, + by omega + ⟩ : Fin (ett.rounds + 2))) → u ≠ v → Disjoint (MissingColors G (ett.series.data.coloring + (⟨ett.rounds - 1, + by omega + ⟩ : Fin (ett.rounds + 1))) u) (MissingColors G (ett.series.data.coloring (⟨ett.rounds - 1, + by omega + ⟩ : Fin (ett.rounds + 1))) v) := by + intro u hu v hv huv + exact (hlower (lower := restricted) (by omega) (by omega) restrictedMaximum).1 hu hv huv + have hc : (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) = i.castSucc := by + apply Fin.ext + have hz := congrArg Fin.val indexEquation + simp [finalIndex] at hz ⊢ + omega + have ht : (⟨ett.rounds - 1 + 1, by omega⟩ : Fin (ett.rounds + 2)) = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + simp + omega + rw [hc, ht] at hlow + intro u hu v hv huv + exact hlow (u := u) hu hv huv + have hu' : u ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by simpa [hi] using hu + have hv' : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by simpa [hi] using hv + exact hl hu' hv' huv + have hmiss : + ∀ v, v ∈ TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc) → MissingColors G + choice.selected v = MissingColors G (ett.series.data.coloring i.castSucc) v := by + intro v hv + exact choice.selectedStable.2 v hv + have hsel : ColoredVertexSetElementary G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) := + transportElementary hmiss hprev + have hi := congrArg Fin.val indexEquation + simp only [Fin.val_last, Fin.val_succ, finalIndex] at hi + have hidx : i.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [] at hi ⊢ + omega + intro u hu v hv huv + have hu' : u ∈ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc) := by simpa [hidx] using hu + have hv' : v ∈ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc) := by simpa [hidx] using hv + rw [ett.generatingColoring, currentColoring'] + exact hsel hu' hv' huv + +private theorem helper_branch_216.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base), + LowerRoundInductionHypothesis G k e0 ett.rounds → + let finalIndex : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ (i : Fin ett.rounds), ett.series.data.coloring i.succ = ett.series.data.coloring i.castSucc + → ett.series.data.kind i.succ = some TashkinovExtensionKind.RE → finalIndex = i.succ → + i.succ ≠ (0 : Fin (ett.rounds + (1 : ℕ))) → ColoredVertexSetElementary G phi + (TreeSequenceVertexSet base.core) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hlower finalIndex i currentColoring currentKind + indexEquation hfinalIndex + have currentKind' : ett.series.data.kind finalIndex = + some TashkinovExtensionKind.RE := by + simpa [indexEquation] using currentKind + have currentColoring' : ett.series.data.coloring finalIndex = + ett.series.data.coloring i.castSucc := by + simpa [indexEquation] using currentColoring + have htree : base.core = + ett.series.data.tree (Fin.last ett.rounds).castSucc := + base.nonparallel (by + intro hk + rw [currentKind'] at hk + cases hk) + rw [htree] + have hprev : ColoredVertexSetElementary G + (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) := by + have hi : i.succ = Fin.last ett.rounds := by + apply Fin.ext + have hz := congrArg Fin.val indexEquation + simp [finalIndex] at hz ⊢ + omega + intro u hu v hv huv + by_cases honeRound : ett.rounds = 1 + · have htech : ColoredVertexSetElementary G + (ett.series.data.coloring 0) + (TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩)) := + (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + have hi : i = ⟨0, by omega⟩ := by apply Fin.ext; omega + have hu' : u ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨1, by omega⟩) := by simpa [hi, honeRound] using hu + have hv' : v ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨1, by omega⟩) := by simpa [hi, honeRound] using hv + have hci : i.castSucc = (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + have hz := congrArg Fin.val hi + simp at hz ⊢ + omega + rw [hci] + exact htech hu' hv' huv + · have hres := CertifiedETTRestriction G k e0 input T phi ett C.maximum + (ett.rounds - 1) (by omega) (by omega) + rcases hres with ⟨restricted, restrictedRounds, restrictedMaximum, + restrictedTrees, restrictedData⟩ + have hl : ColoredVertexSetElementary G + (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + have hlow : + ∀ {u}, u ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨ett.rounds - 1 + 1, + by omega + ⟩ : Fin (ett.rounds + 2))) → + ∀ {v}, v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨ett.rounds - 1 + 1, + by omega + ⟩ : Fin (ett.rounds + 2))) → u ≠ v → Disjoint (MissingColors G (ett.series.data.coloring + (⟨ett.rounds - 1, + by omega + ⟩ : Fin (ett.rounds + 1))) u) (MissingColors G (ett.series.data.coloring (⟨ett.rounds - 1, + by omega + ⟩ : Fin (ett.rounds + 1))) v) := by + intro u hu v hv huv + exact (hlower (lower := restricted) (by omega) (by omega) restrictedMaximum).1 hu hv huv + have hc : (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) = i.castSucc := by + apply Fin.ext + have hz := congrArg Fin.val indexEquation + simp [finalIndex] at hz ⊢ + omega + have ht : (⟨ett.rounds - 1 + 1, by omega⟩ : Fin (ett.rounds + 2)) = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + simp + omega + rw [hc, ht] at hlow + intro u hu v hv huv + exact hlow (u := u) hu hv huv + have hu' : u ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by simpa [hi] using hu + have hv' : v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by simpa [hi] using hv + exact hl hu' hv' huv + intro u hu v hv huv + have hi := congrArg Fin.val indexEquation + simp only [Fin.val_last, Fin.val_succ, finalIndex] at hi + have hidx : i.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [] at hi ⊢ + omega + have hu' : u ∈ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc) := by simpa [hidx] using hu + have hv' : v ∈ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc) := by simpa [hidx] using hv + have hcur : phi = ett.series.data.coloring i.castSucc := by + calc + phi = ett.series.data.coloring (Fin.last ett.rounds) := by + simp [ett.generatingColoring] + _ = ett.series.data.coloring i.castSucc := currentColoring' + rw [hcur] + exact hprev hu' hv' huv + +private theorem helper_qzeroCore_127.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) (C : + HierarchyCounterexample base), IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → let H : TashkinovHierarchy ett base := + C.hierarchy; let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last + H.dividerCount); let finalIndex : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + finalIndex ≠ (0 : Fin (ett.rounds + (1 : ℕ))) → H.dividerCount = (0 : ℕ) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower H A finalIndex hfinalIndex hq + have hA : A = base.core := by + simp [A, H, HierarchyStarredStage, Fin.last, Fin.cases, hq] + rw [hA] + have transportElementary {rho sigma : PartialEdgeColoring E k} + {X : TreeSequence G e0} + (hmiss : ∀ v, v ∈ TreeSequenceVertexSet X → + MissingColors G sigma v = MissingColors G rho v) + (he : ColoredVertexSetElementary G rho (TreeSequenceVertexSet X)) : + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet X) := by + intro u hu v hv huv + rw [hmiss u hu, hmiss v hv] + exact he hu hv huv + have hcert := ett.series.certified finalIndex + generalize indexEquation : finalIndex = index at hcert hfinalIndex + cases hcert with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (hfinalIndex (by simp)).elim + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule + secondStable secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have currentKind' : ett.series.data.kind finalIndex = + some TashkinovExtensionKind.PE := by + simpa [indexEquation] using currentKind + have hkind : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := by simpa [finalIndex] using currentKind' + have hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi phi := by + simp [StableColoring] + have hstable' : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) phi := by + simpa [ett.generatingColoring] using hstable + intro u hu v hv huv + exact (ParallelClosureUnionElementary G k e0 input T phi ett + C.maximum C.positive hlower hkind phi hproper hone hstable base (u := u)) hu hv huv + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative currentColoring + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension strictExtension => + exact @helper_branch_111 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C hlower transportElementary i choice currentColoring + currentKind indexEquation hfinalIndex + | RE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed available + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_216 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C hlower i currentColoring currentKind indexEquation + hfinalIndex +private theorem helper_branch_451.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + (ell - (1 : ℕ))) T.length) => + by omega + ) (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); ((0 : ℕ) < H.dividerCount → A = + H.stage (⟨H.dividerCount, Decidable.byContradiction fun (a : ¬H.dividerCount < + H.dividerCount + (2 : ℕ)) => + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (H.dividerCount = (0 : ℕ) → ColoredVertexSetElementary + G phi (TreeSequenceVertexSet A)) → TreeSequenceInitialSegment A T → ( + ∀ {X Y : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y), X = TreeSequencePrefix Y + X.length X.positive hXY.1) → ( + ∀ (X : TreeSequence G e0), TreeSequencePrefix X X.length X.positive le_rfl = X) → A.length ≤ + T.length → + ∀ {u : V}, ell = (0 : ℕ) → u ∈ TreeSequenceVertexSet Ty → + ∀ {v : V}, v ∈ TreeSequenceVertexSet Ty → u ≠ v → Disjoint (MissingColors G phi u) + (MissingColors G phi v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H A ell Ty hAstage qzeroCore aSegment + prefixEqOfSegment prefixFull hAlen _ hzero + have hlen : A.length = T.length := by dsimp [ell] at hzero; omega + have hTy : Ty = T := by + have hmin : min (A.length + (ell - 1)) T.length = T.length := by + dsimp [ell] at hzero ⊢ + omega + simpa [Ty, hmin] using prefixFull T + rw [hTy] + have hq : H.dividerCount = 0 := by + by_contra hn + have hs := H.strict (Fin.last H.dividerCount) + have hA : A = H.stage (Fin.last H.dividerCount).castSucc := by + calc + A = H.stage ⟨H.dividerCount, by omega⟩ := hAstage (by omega) + _ = H.stage (Fin.last H.dividerCount).castSucc := by + apply congrArg H.stage + apply Fin.ext + simp + have hT : H.stage (Fin.last H.dividerCount).succ = T := by + simpa using H.terminalStage + rw [hT] at hs + rw [← hA] at hs + dsimp [ell] at hzero + omega + have hc : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet A) := qzeroCore hq + have hAT : A = T := by + have hp : A = TreeSequencePrefix T T.length T.positive le_rfl := by + simpa [hlen] using (prefixEqOfSegment aSegment) + exact hp.trans (prefixFull T) + rename_i u + intro hu v hv huv + have setEq : TreeSequenceVertexSet A = TreeSequenceVertexSet T := + congrArg TreeSequenceVertexSet hAT + have huA : u ∈ TreeSequenceVertexSet A := + Eq.mp (congrArg (fun s : Finset V => u ∈ s) setEq.symm) hu + have hvA : v ∈ TreeSequenceVertexSet A := + Eq.mp (congrArg (fun s : Finset V => v ∈ s) setEq.symm) hv + exact hc huA hvA huv + +private theorem helper_branch_515.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + (ell - (1 : ℕ))) T.length) => + by omega + ) (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); TreeSequenceInitialSegment A T → ( + ∀ {X Y : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y), X = TreeSequencePrefix Y + X.length X.positive hXY.1) → A.length ≤ T.length → + ∀ {u : V}, ¬ell = (0 : ℕ) → ¬ell = (1 : ℕ) → u ∈ TreeSequenceVertexSet Ty → + ∀ {v : V}, v ∈ TreeSequenceVertexSet Ty → u ≠ v → Disjoint (MissingColors G phi u) + (MissingColors G phi v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hminimal H A ell Ty aSegment prefixEqOfSegment + hAlen _ hzero honeTail + have htail : 2 ≤ ell := by omega + have hBlen : Ty.length + 1 = T.length := by + change min (A.length + (ell - 1)) T.length + 1 = T.length + dsimp [ell] at htail ⊢ + omega + have hAless : A.length < Ty.length := by + change A.length < min (A.length + (ell - 1)) T.length + dsimp [ell] at htail ⊢ + omega + have prefixSegment {X : TreeSequence G e0} {q : ℕ} + (hq : 1 ≤ q) (hqt : q ≤ X.length) : + TreeSequenceInitialSegment (TreeSequencePrefix X q hq hqt) X := by + refine ⟨hqt, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have hBT : TreeSequenceInitialSegment Ty T := by + exact prefixSegment (by omega) (by exact Nat.min_le_right _ _) + have hAB : TreeSequenceInitialSegment A Ty := by + have hATeq : A = TreeSequencePrefix T A.length A.positive hAlen := + prefixEqOfSegment aSegment + rw [hATeq] + have hqB : A.length ≤ Ty.length := by omega + have hp := prefixSegment (X := Ty) (q := A.length) A.positive hqB + convert hp using 1; rfl + have hABstrict : A.length < Ty.length := hAless + by_cases helementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty) + · exact helementary + · have hnot := helementary + obtain ⟨ettB, hmpB, hroundB, hseriesB, baseB, hcoreB, hclosureB, + hsupportB, HB, hcountB, hstagesB, hpositionsB, goodB, hgoodDataB⟩ := + GoodHierarchyTerminalPrefixRepackage G k e0 input T phi phi ett C.maximum + base H C.good Ty hAB hABstrict hBT + let CB : HierarchyCounterexample baseB := + { positive := by simpa [hroundB] using C.positive + hierarchy := HB + good := goodB + maximum := hmpB + notElementary := hnot } + have hless : HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure CB) + (HierarchyCounterexampleMeasure C) := by + unfold HierarchyCounterexampleLess HierarchyCounterexampleMeasure + dsimp [CB] + have hstar : HierarchyStarredStage HB (Fin.last HB.dividerCount) = A := by + have hs := (hstagesB (Fin.last HB.dividerCount)).2 + simpa [hcountB, A] using hs + have htailB : Ty.length - + (HierarchyStarredStage HB (Fin.last HB.dividerCount)).length = ell - 1 := by + rw [hstar] + dsimp [ell] at hBlen ⊢ + omega + let candidateH := (Finset.Icc 1 ell).filter fun j => + ∀ r : Fin T.length, A.length + j ≤ r.val → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ) + let candidateB := (Finset.Icc 1 (ell - 1)).filter fun j => + ∀ r : Fin Ty.length, + A.length + j ≤ r.val → + G.ends (Ty.edge r) = s(Ty.vertex r.castSucc, Ty.vertex r.succ) + have pathH : HierarchyPathNumber H = + if h : candidateH.Nonempty then candidateH.min' h else ell := by + simp [HierarchyPathNumber, candidateH, A, ell] + have pathB : HierarchyPathNumber HB = + if h : candidateB.Nonempty then candidateB.min' h else ell - 1 := by + have htailDef : Ty.length - A.length = ell - 1 := by + dsimp [ell] at hBlen ⊢ + omega + simp [HierarchyPathNumber, candidateB, hstar, htailDef, ell] + have candidateHFull : ell ∈ candidateH := by + simp only [candidateH, Finset.mem_filter, Finset.mem_Icc] + refine ⟨⟨by omega, by omega⟩, ?_⟩ + intro r hr + have hr' : A.length + ell ≤ T.length := by + dsimp [ell] + omega + omega + have candidateBFull : ell - 1 ∈ candidateB := by + simp only [candidateB, Finset.mem_filter, Finset.mem_Icc] + refine ⟨⟨by omega, by omega⟩, ?_⟩ + intro r hr + have hr' : A.length + (ell - 1) ≤ Ty.length := by + dsimp [Ty] + omega + omega + have transferCandidate {j : ℕ} (hj : j ∈ candidateH) (hjlt : j < ell) : + j ∈ candidateB := by + rcases (Finset.mem_filter.mp hj) with ⟨hjI, hjP⟩ + apply Finset.mem_filter.mpr + refine ⟨?_, ?_⟩ + · exact Finset.mem_Icc.mpr ⟨(Finset.mem_Icc.mp hjI).1, by omega⟩ + · intro r hr + let rT : Fin T.length := ⟨r.val, by omega⟩ + have hp := hjP rT (by omega) + have hev := hBT.2.2 r + have hv0 := hBT.2.1 r.castSucc + have hv1 := hBT.2.1 r.succ + have hri : (Fin.castLE hBT.1 r : Fin T.length) = rT := by + apply Fin.ext + rfl + rw [← hev, ← hv0, ← hv1] + rw [hri] + exact hp + have pathLE : HierarchyPathNumber HB ≤ HierarchyPathNumber H := by + by_cases hNH : candidateH.Nonempty + · rw [pathH, dite_eq_left hNH] + by_cases hEq : candidateH.min' hNH = ell + · rw [pathB, dite_eq_left ⟨ell - 1, candidateBFull⟩] + exact (Finset.min'_le candidateB (ell - 1) candidateBFull).trans (by omega) + · have hmem := Finset.min'_mem candidateH hNH + have hle := Finset.min'_le candidateH _ hmem + have hleFull := Finset.min'_le candidateH ell candidateHFull + have hlt : candidateH.min' hNH < ell := by omega + rw [pathB, dite_eq_left ⟨candidateH.min' hNH, + transferCandidate hmem hlt⟩] + exact Finset.min'_le candidateB _ + (transferCandidate hmem hlt) + · rw [pathH, dite_eq_right hNH] + rw [pathB, dite_eq_left ⟨ell - 1, candidateBFull⟩] + exact le_trans (Finset.min'_le candidateB (ell - 1) candidateBFull) (by omega) + by_cases hlt : HierarchyPathNumber HB < HierarchyPathNumber H + · exact Or.inl hlt + · right + have heq : HierarchyPathNumber HB = HierarchyPathNumber H := by omega + refine ⟨heq, ?_⟩ + have hstage : HB.stage ⟨HB.dividerCount, by omega⟩ = + H.stage ⟨H.dividerCount, by omega⟩ := by + have hs := (hstagesB (Fin.last HB.dividerCount)).1 + have hiH : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + (Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) + (Fin.last HB.dividerCount)).castSucc := by + apply Fin.ext + simp [] + have hiB : (⟨HB.dividerCount, by omega⟩ : Fin (HB.dividerCount + 2)) = + (Fin.last HB.dividerCount).castSucc := by + apply Fin.ext + rfl + rw [hiB, hiH] + exact hs + rw [hstage] + have hsle : (H.stage ⟨H.dividerCount, by omega⟩).length ≤ Ty.length := by + have hn := HB.nested (Fin.last HB.dividerCount) + have ht := HB.terminalStage + have hnext : HB.stage (Fin.last HB.dividerCount).succ = Ty := by + convert ht using 1; apply congrArg HB.stage; + apply Fin.ext; rfl + have hle := hn.1 + rw [hnext] at hle + have hle' : (HB.stage ⟨HB.dividerCount, by omega⟩).length ≤ Ty.length := by + have hi : (⟨HB.dividerCount, by omega⟩ : Fin (HB.dividerCount + 2)) = + (Fin.last HB.dividerCount).castSucc := by + apply Fin.ext + rfl + simpa [hi] using hle + have hlenStage := congrArg TreeSequence.length hstage + rw [hlenStage] at hle' + exact hle' + change Ty.length - (H.stage ⟨H.dividerCount, by omega⟩).length < + T.length - (H.stage ⟨H.dividerCount, by omega⟩).length + rw [← hBlen] + omega + exact False.elim ((hminimal CB hroundB hcountB) hless) + +theorem HierarchyCounterexamplePenultimateElementary {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (_ : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty) := by + classical + dsimp only + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have hAstage : ∀ hq : 0 < H.dividerCount, + A = H.stage ⟨H.dividerCount, by omega⟩ := by + intro hq + have hlast : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp + omega + dsimp [A, HierarchyStarredStage] + rw [hlast] + simp only [Fin.cases] + apply congrArg H.stage + apply Fin.ext + simp + omega + let finalIndex : Fin (ett.rounds + 1) := Fin.last ett.rounds + have hfinalIndex : finalIndex ≠ 0 := by + intro hz + have := congrArg Fin.val hz + simp [finalIndex] at this + have hn := C.positive + omega + have qzeroCore := @helper_qzeroCore_127 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C hproper hone hlower hfinalIndex + have segmentRefl (X : TreeSequence G e0) : TreeSequenceInitialSegment X X := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + rcases hXY with ⟨hxy, vxy, exy⟩ + rcases hYZ with ⟨hyz, vyz, eyz⟩ + refine ⟨le_trans hxy hyz, ?_, ?_⟩ + · intro i + have hm := vyz (Fin.castLE (Nat.succ_le_succ hxy) i) + simpa using hm.trans (vxy i) + · intro i + have hm := eyz (Fin.castLE hxy i) + simpa using hm.trans (exy i) + have stageSegment : ∀ (a d : ℕ), (hbound : a + d ≤ H.dividerCount + 1) → + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + intro a d hbound + induction d with + | zero => simpa using segmentRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + have hp := ih (by omega) + have hn := H.nested ⟨a + d, by omega⟩ + have hn' : TreeSequenceInitialSegment (H.stage ⟨a+d, by omega⟩) + (H.stage ⟨a+(d+1), by omega⟩) := by + simpa [Nat.add_assoc] using hn + exact segmentTrans hp hn' + have aSegment : TreeSequenceInitialSegment A T := by + by_cases hq : H.dividerCount = 0 + · have hc := H.coreInsideFirst + have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [hq] + have ht : H.stage ⟨1, by omega⟩ = T := by + rw [hi] + exact H.terminalStage + have hc' : TreeSequenceInitialSegment base.core T := by + convert hc using 1 + exact ht.symm + simpa [A, H, HierarchyStarredStage, Fin.last, hq] using hc' + · have hs := stageSegment H.dividerCount 1 (by omega) + have hA : A = H.stage ⟨H.dividerCount, by omega⟩ := hAstage (by omega) + have hT : H.stage ⟨H.dividerCount + 1, by omega⟩ = T := by + convert H.terminalStage using 1 + apply congrArg H.stage + apply Fin.ext + rfl + rw [hA] + simpa [hA, hT] using hs + have prefixEqOfSegment {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) : + X = TreeSequencePrefix Y X.length X.positive hXY.1 := by + cases X with + | mk lx px vx ex vix eix fx ax => + cases Y with + | mk ly py vy ey vyiy eiy fy ay => + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa [TreeSequencePrefix] using (hXY.2.1 i).symm + · apply heq_of_eq + funext i + simpa [TreeSequencePrefix] using (hXY.2.2 i).symm + have prefixFull (X : TreeSequence G e0) : + TreeSequencePrefix X X.length X.positive le_rfl = X := by + symm + exact prefixEqOfSegment (segmentRefl X) + have hAlen : A.length ≤ T.length := aSegment.1 + change ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty) + by_cases hzero : ell = 0 + · exact @helper_branch_451 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C hAstage qzeroCore aSegment prefixEqOfSegment prefixFull hAlen (by + assumption) hzero + by_cases honeTail : ell = 1 + · have hTy : Ty = A := by + dsimp [Ty] + have hmin : min (A.length + (ell - 1)) T.length = A.length := by + dsimp [ell] at honeTail ⊢ + omega + have hp := (prefixEqOfSegment aSegment).symm + simpa [hmin] using hp + rw [hTy] + by_cases hq : H.dividerCount = 0 + · exact qzeroCore hq + · have hr : (1 : ℕ) ≤ H.dividerCount := by omega + obtain ⟨ep, hmp, hrounds, hseries, bp, hbc, hcl, hsp, hp, hcount, + hstages, hpositions, goodp, hcolors, hclosed⟩ := + GoodHierarchyPrefixRepackage G k e0 input T phi phi ett C.maximum base H C.good + ⟨H.dividerCount, by omega⟩ hr + have hrval : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 1)).val = + H.dividerCount := rfl + have hdiv : hp.dividerCount < C.hierarchy.dividerCount := by + change hp.dividerCount < H.dividerCount + rw [hcount, hrval] + have hqpos : 0 < H.dividerCount := Nat.pos_of_ne_zero hq + omega + have hA : A = H.stage ⟨H.dividerCount, by omega⟩ := hAstage (by omega) + rw [hA] + exact hfewer ep hrounds hmp bp hp goodp hdiv + · exact @helper_branch_515 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C hminimal aSegment prefixEqOfSegment hAlen (by assumption) hzero + honeTail +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexampleTailAtLeastTwo.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexampleTailAtLeastTwo.lean new file mode 100644 index 0000000000..4063a1da55 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexampleTailAtLeastTwo.lean @@ -0,0 +1,204 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleOneAdditionPositiveDividerImpossible +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleOneAdditionZeroDividerImpossible + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Hierarchy Counterexample Tail At Least Two + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchyCounterexampleTailAtLeastTwo {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + 2 ≤ T.length - A.length := by + have hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + hproper hone hlower hfewer hminimal hlarge + dsimp only + by_contra hnotTwo + have hpositiveTail : + 0 < T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length := by + have lastStage : + ∀ (d : ℕ) (s : Fin (d + 2) → TreeSequence G e0) (core : TreeSequence G e0), 0 < d → Fin.cases + core (fun i : Fin d => s i.castSucc.succ) (Fin.last d) = s (Fin.last d).castSucc := by + intro d s core hd + cases d with + | zero => omega + | succ n => + have hi : Fin.last (n + 1) = (Fin.last n).succ := by + apply Fin.ext + rfl + rw [hi] + rfl + have zeroStage : + ∀ (d : ℕ) (s : Fin (d + 2) → TreeSequence G e0) (core : TreeSequence G e0), d = 0 → Fin.cases + core (fun i : Fin d => s i.castSucc.succ) (Fin.last d) = core := by + intro d s core hd + subst d + rfl + by_cases hq : 0 < C.hierarchy.dividerCount + · have hAeq : HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = + C.hierarchy.stage (Fin.last C.hierarchy.dividerCount).castSucc := by + unfold HierarchyStarredStage + exact lastStage _ _ _ hq + have hstep := C.hierarchy.strict (Fin.last C.hierarchy.dividerCount) + have hlenA := congrArg TreeSequence.length hAeq + have hterm : C.hierarchy.stage (Fin.last C.hierarchy.dividerCount).succ = T := by + rw [show (Fin.last C.hierarchy.dividerCount).succ = + Fin.last (C.hierarchy.dividerCount + 1) by + apply Fin.ext + rfl] + exact C.hierarchy.terminalStage + have hlenT := congrArg TreeSequence.length hterm + omega + · have hzero : C.hierarchy.dividerCount = 0 := Nat.eq_zero_of_not_pos hq + have hAeq : HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = base.core := by + unfold HierarchyStarredStage + exact zeroStage _ _ _ hzero + have hseg : TreeSequenceInitialSegment + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)) T := by + have hc := C.hierarchy.coreInsideFirst + rw [show (⟨1, by omega⟩ : Fin (C.hierarchy.dividerCount + 2)) = + Fin.last (C.hierarchy.dividerCount + 1) by + apply Fin.ext + simp [hzero]] at hc + rw [hAeq] + simpa [C.hierarchy.terminalStage, hzero] using hc + by_contra hnon + have hle : + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ T.length := hseg.1 + have heq : + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length = T.length := by + omega + have equalTrees : ∀ {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → X.length = Y.length → X = Y := by + intro X Y hXY hlen + rcases hXY with ⟨hle, hv, he⟩ + cases X with + | mk lx px vx ex vix eix fx ax => + cases Y with + | mk ly py vy ey viy eiy fy ay => + simp only at hlen + subst ly + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext j + simpa only [Fin.castLE] using (hv j).symm + · apply heq_of_eq + funext j + simpa only [Fin.castLE] using (he j).symm + have htrees : + HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = T := by + exact equalTrees hseg heq + have htailzero : T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length = 0 := + Nat.eq_zero_of_not_pos hnon + have prefixFull : ∀ (X : TreeSequence G e0) (hp : 1 ≤ X.length) + (hq : X.length ≤ X.length), + TreeSequencePrefix X X.length hp hq = X := by + intro X hp hq + apply equalTrees + · refine ⟨le_rfl, ?_, ?_⟩ + · intro i + apply congrArg X.vertex + apply Fin.ext + rfl + · intro i + apply congrArg X.edge + apply Fin.ext + rfl + · rfl + have helem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T) := by + dsimp only at hprefixElementary + intro u hu v hv huv + apply hprefixElementary (u := u) (v := v) + · simpa [htailzero, htrees, prefixFull] using hu + · simpa [htailzero, htrees, prefixFull] using hv + · exact huv + exact C.notElementary helem + have honeAddition : + T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length = 1 := by + omega + rcases Nat.eq_zero_or_pos C.hierarchy.dividerCount with hzero | hpositive + · exact HierarchyCounterexampleOneAdditionZeroDividerImpossible + G k e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge + honeAddition hprefixElementary hzero + · exact HierarchyCounterexampleOneAdditionPositiveDividerImpossible + G k e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge + honeAddition hprefixElementary hpositive + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexampleTerminalCommonMissing.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexampleTerminalCommonMissing.lean new file mode 100644 index 0000000000..c9e2c847b5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexampleTerminalCommonMissing.lean @@ -0,0 +1,163 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo + +/-! +# Hierarchy Counterexample Terminal Common Missing + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchyCounterexampleTerminalCommonMissing {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ∃ alpha : Fin k, + alpha ∈ TreeMissingColors phi Ty ∧ + alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)) := by + classical + dsimp only + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have htail : 2 ≤ ell := by + dsimp [ell] + exact HierarchyCounterexampleTailAtLeastTwo G k e0 input T phi ett base C + hproper hone hlower hfewer hminimal hlarge + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + hproper hone hlower hfewer hminimal hlarge + have hlen : min (A.length + (ell - 1)) T.length = T.length - 1 := by + dsimp [ell] + omega + have hTy : Ty = TreeSequencePrefix T (T.length - 1) + (by have hT := T.positive; omega) (by omega) := by + simp [Ty, hlen] + have hTyLen : Ty.length = T.length - 1 := by + rw [hTy] + rfl + have hlastNot : T.vertex (Fin.last T.length) ∉ TreeSequenceVertexSet Ty := by + intro hlast + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hlast + rcases hlast with ⟨i, hi⟩ + have hv := T.vertex_injective hi + have hvval := congrArg Fin.val hv + simp only [Nat.succ_eq_add_one, Fin.val_last] at hvval + change i.val = T.length at hvval + have hvval' : i.val = T.length := hvval + have hii := i.isLt + omega + by_contra hnone + have hnone' : ∀ alpha, alpha ∈ TreeMissingColors phi Ty → + alpha ∉ MissingColors G phi (T.vertex (Fin.last T.length)) := by + intro alpha ha hb + apply hnone + refine ⟨alpha, ?_, hb⟩ + simpa [Ty, H, A, ell, hlen] using ha + have prefixMem : ∀ {u : V}, u ∈ TreeSequenceVertexSet T → + u ≠ T.vertex (Fin.last T.length) → u ∈ TreeSequenceVertexSet Ty := by + intro u hu hne + rcases (by simpa [TreeSequenceVertexSet] using hu) with ⟨i, hi⟩ + have hival : i.val < T.length := by + by_contra hival + have hii := i.isLt + have hiLast : i = Fin.last T.length := by + apply Fin.ext + simp + omega + apply hne + simpa [hiLast] using hi.symm + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + have hbound : i.val < Ty.length + 1 := by omega + refine ⟨⟨i.val, hbound⟩, ?_⟩ + change T.vertex (Fin.castLE _ ⟨i.val, hbound⟩) = u + have hidx : Fin.castLE (by omega) (⟨i.val, hbound⟩ : Fin (Ty.length + 1)) = i := by + apply Fin.ext + rfl + rw [hidx] + exact hi + have hdisj : ∀ {u v : V}, u ∈ TreeSequenceVertexSet T → + v ∈ TreeSequenceVertexSet T → u ≠ v → + Disjoint (MissingColors G phi u) (MissingColors G phi v) := by + intro u v hu hv huv + by_cases huFinal : u = T.vertex (Fin.last T.length) + · have hvNot : v ≠ T.vertex (Fin.last T.length) := by + intro hvFinal + exact huv (huFinal.trans hvFinal.symm) + have hvTy := prefixMem hv hvNot + apply Finset.disjoint_left.2 + intro alpha hau hav + have hat : alpha ∈ TreeMissingColors phi Ty := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hvTy, hav⟩ + exact hnone' alpha hat (huFinal ▸ hau) + · have huTy := prefixMem hu huFinal + by_cases hvFinal : v = T.vertex (Fin.last T.length) + · apply Finset.disjoint_left.2 + intro alpha hau hav + have hat : alpha ∈ TreeMissingColors phi Ty := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨u, huTy, hau⟩ + exact hnone' alpha hat (hvFinal ▸ hav) + · exact helem huTy (prefixMem hv hvFinal) huv + apply C.notElementary + intro u hu v hv huv + exact hdisj hu hv huv + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyEligibleCommonMissingIndices.lean b/LeanPool/GoldbergSeymour/HierarchyEligibleCommonMissingIndices.lean new file mode 100644 index 0000000000..d128459a0b --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyEligibleCommonMissingIndices.lean @@ -0,0 +1,44 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +/-! +# Hierarchy Eligible Common Missing Indices + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Tail-prefix indices admitting a replacement presentation with a color missing at both terminal +vertices. +-/ +noncomputable def HierarchyEligibleCommonMissingIndices {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) : Finset ℕ := by + classical + exact (Finset.Icc 1 (HierarchyFullTailLength C - 1)).filter fun i => + ∃ P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + ∃ alpha : Fin k, + alpha ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length)) ∧ + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyFirstMissingPosition.lean b/LeanPool/GoldbergSeymour/HierarchyFirstMissingPosition.lean new file mode 100644 index 0000000000..419fca6027 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyFirstMissingPosition.lean @@ -0,0 +1,36 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Finset.Max + +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Hierarchy First Missing Position + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The first vertex position missing a color, defaulting to the final position when none exists. -/ +noncomputable def HierarchyFirstMissingPosition {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (eta : Fin k) : Fin (T.length + 1) := by + classical + let candidates : Finset (Fin (T.length + 1)) := + Finset.univ.filter fun i => eta ∈ MissingColors G phi (T.vertex i) + exact if h : candidates.Nonempty then candidates.min' h else Fin.last T.length + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean b/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean new file mode 100644 index 0000000000..f93a975d09 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment + +/-! +# Hierarchy First Missing Position Prefix Cutoff + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma HierarchyFirstMissingPositionPrefixCutoff {V E : Type*} + [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (A T : TreeSequence G e0) + (hAT : TreeSequenceInitialSegment A T) (eta : Fin k) + (uLength : Nat) (hu : uLength <= A.length) : + min (HierarchyFirstMissingPosition phi A eta).val uLength = + min (HierarchyFirstMissingPosition phi T eta).val uLength := by + classical + let _ := Fintype.ofFinite V + let candidatesA : Finset (Fin (A.length + 1)) := + {i | eta ∈ MissingColors G phi (A.vertex i)} + let candidatesT : Finset (Fin (T.length + 1)) := + {i | eta ∈ MissingColors G phi (T.vertex i)} + unfold HierarchyFirstMissingPosition + dsimp only + change min (if h : candidatesA.Nonempty then candidatesA.min' h + else Fin.last A.length).val uLength = + min (if h : candidatesT.Nonempty then candidatesT.min' h + else Fin.last T.length).val uLength + by_cases hA : candidatesA.Nonempty + · rw [dite_eq_left hA] + let mA := candidatesA.min' hA + let mAT : Fin (T.length + 1) := + Fin.castLE (Nat.succ_le_succ hAT.1) mA + have hmAmem : mA ∈ candidatesA := Finset.min'_mem candidatesA hA + have hmATmem : mAT ∈ candidatesT := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + have hmA : eta ∈ MissingColors G phi (A.vertex mA) := + (Finset.mem_filter.mp hmAmem).2 + rw [hAT.2.1 mA] + exact hmA + have hT : candidatesT.Nonempty := ⟨mAT, hmATmem⟩ + rw [dite_eq_left hT] + have hTle : (candidatesT.min' hT).val <= mA.val := by + have hFin := Finset.min'_le candidatesT mAT hmATmem + change (candidatesT.min' hT).val <= mAT.val at hFin + simpa [mAT] using hFin + let mTA : Fin (A.length + 1) := + ⟨(candidatesT.min' hT).val, by omega⟩ + have hmTmem : candidatesT.min' hT ∈ candidatesT := + Finset.min'_mem candidatesT hT + have hmTAmem : mTA ∈ candidatesA := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + have hmT : eta ∈ MissingColors G phi + (T.vertex (candidatesT.min' hT)) := + (Finset.mem_filter.mp hmTmem).2 + have hcast : Fin.castLE (Nat.succ_le_succ hAT.1) mTA = + candidatesT.min' hT := Fin.ext rfl + rw [← hcast, hAT.2.1 mTA] at hmT + exact hmT + have hAle : mA.val <= (candidatesT.min' hT).val := by + have hFin := Finset.min'_le candidatesA mTA hmTAmem + change (candidatesA.min' hA).val <= mTA.val at hFin + simpa [mTA, mA] using hFin + have heq : mA.val = (candidatesT.min' hT).val := by omega + rw [heq] + · rw [dite_eq_right hA] + by_cases hT : candidatesT.Nonempty + · rw [dite_eq_left hT] + have hbound : A.length <= (candidatesT.min' hT).val := by + by_contra hnot + have hlt : (candidatesT.min' hT).val < A.length := by omega + let mTA : Fin (A.length + 1) := + ⟨(candidatesT.min' hT).val, by omega⟩ + have hmTmem : candidatesT.min' hT ∈ candidatesT := + Finset.min'_mem candidatesT hT + have hmTAmem : mTA ∈ candidatesA := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + have hmT : eta ∈ MissingColors G phi + (T.vertex (candidatesT.min' hT)) := + (Finset.mem_filter.mp hmTmem).2 + have hcast : Fin.castLE (Nat.succ_le_succ hAT.1) mTA = + candidatesT.min' hT := Fin.ext rfl + rw [← hcast, hAT.2.1 mTA] at hmT + exact hmT + exact hA ⟨mTA, hmTAmem⟩ + simp only [Fin.val_last] + omega + · rw [dite_eq_right hT] + simp only [Fin.val_last] + have hlen := hAT.1 + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyFullTailLength.lean b/LeanPool/GoldbergSeymour/HierarchyFullTailLength.lean new file mode 100644 index 0000000000..8d7a709ac6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyFullTailLength.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexample + +/-! +# Hierarchy Full Tail Length + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The number of tree edges after the last starred hierarchy stage. -/ +def HierarchyFullTailLength {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T phi} {base : HierarchyBase ett phi} + (C : HierarchyCounterexample base) : ℕ := + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + T.length - A.length + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyFullTailPrefix.lean b/LeanPool/GoldbergSeymour/HierarchyFullTailPrefix.lean new file mode 100644 index 0000000000..17ef61b414 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyFullTailPrefix.lean @@ -0,0 +1,39 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength + +/-! +# Hierarchy Full Tail Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The prefix extending the last starred stage by at most the requested number of tail edges. -/ +noncomputable def HierarchyFullTailPrefix {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T phi} {base : HierarchyBase ett phi} + (C : HierarchyCounterexample base) (i : ℕ) : TreeSequence G e0 := + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + TreeSequencePrefix T (min (A.length + i) T.length) + (by + have hA := A.positive + have hT := T.positive + omega) + (Nat.min_le_right _ _) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyLEMStable.lean b/LeanPool/GoldbergSeymour/HierarchyLEMStable.lean new file mode 100644 index 0000000000..a1bf5a7a23 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyLEMStable.lean @@ -0,0 +1,1147 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyOutsideKempeStable +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OutsideKempeGoodHierarchy +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Hierarchy LEMStable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hsegOuter_88.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi), + (0 : ℕ) < ett.rounds → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) T := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨le_trans hab hbc, ?_, ?_⟩ + · intro i + have hmid := hvbc (Fin.castLE (Nat.succ_le_succ hab) i) + simpa using hmid.trans (hvab i) + · intro i + have hmid := hebc (Fin.castLE hab i) + simpa using hmid.trans (heab i) + exact ett.abovePenultimate + +private theorem helper_hsub_104.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), (0 : ℕ) < ett.rounds → TreeSequenceInitialSegment (ett.series.data.tree + (Fin.last ett.rounds).castSucc) T → TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc) ⊆ TreeSequenceVertexSet T := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive hsegOuter + rcases hsegOuter with ⟨hlen, hvertex, hedge⟩ + intro v hv + classical + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + rcases hv with ⟨i, rfl⟩ + let j : Fin (T.length + 1) := Fin.castLE (m := T.length + 1) + (Nat.succ_le_succ hlen) i + refine ⟨j, ?_⟩ + exact hvertex i + +private theorem helper_segmentCombine_122.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), (0 : ℕ) < ett.rounds → + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive A B C hAB hBC + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨le_trans hab hbc, ?_, ?_⟩ + · intro i + simpa using (hvbc (Fin.castLE (Nat.succ_le_succ hab) i)).trans (hvab i) + · intro i + simpa using (hebc (Fin.castLE hab i)).trans (heab i) + +private theorem helper_commonSegment_134.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), (0 : ℕ) < ett.rounds → + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → B.length ≤ A.length → TreeSequenceInitialSegment B A := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive A B C hAC hBC hBA + rcases hAC with ⟨hac, hvac, heac⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨hBA, ?_, ?_⟩ + · intro i + calc + A.vertex (Fin.castLE (Nat.succ_le_succ hBA) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hac) + (Fin.castLE (Nat.succ_le_succ hBA) i)) := + (hvac _).symm + _ = C.vertex (Fin.castLE (Nat.succ_le_succ hbc) i) := by congr 1 + _ = B.vertex i := hvbc i + · intro i + calc + A.edge (Fin.castLE hBA i) = + C.edge (Fin.castLE hac (Fin.castLE hBA i)) := (heac _).symm + _ = C.edge (Fin.castLE hbc i) := by congr 1 + _ = B.edge i := hebc i + +private theorem helper_hladder_156.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), (0 : ℕ) < ett.rounds → StableColoring T (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) phi sigma → ( + ∀ (f : E), TreeIncidentEdge T f → sigma f = phi f) → TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ⊆ TreeSequenceVertexSet T → ( + ∀ (f : E), TreeIncidentEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f → + TreeIncidentEdge T f) → StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive hstab hfixed hsub hinc + have hgen : ett.series.data.coloring (Fin.last ett.rounds) = phi := + ett.generatingColoring.symm + constructor + · intro f hf hx + simpa [hgen] using hfixed f (hinc f hf) + · intro v hv + simpa [hgen] using hstab.2 v (hsub hv) + +private theorem helper_restrictSequence_167.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), (0 : ℕ) < ett.rounds → + ∀ (coloring : PartialEdgeColoring E k) (A B C : TreeSequence G e0), + TashkinovAugmentationSequence coloring A C → TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TashkinovAugmentationSequence coloring A B := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive coloring A B C hseq hAB hBC + have equalTrees : ∀ {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → X.length = Y.length → X = Y := by + intro X Y hXY hlen + rcases hXY with ⟨hle, hv, he⟩ + cases X with + | mk lx px vx ex vix eix fx ax => + cases Y with + | mk ly py vy ey viy eiy fy ay => + simp only at hlen + subst ly + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hv i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (he i).symm + have commonExtension : + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → Y.length ≤ X.length → TreeSequenceInitialSegment Y X := by + intro X Y Z hXZ hYZ hYX + rcases hXZ with ⟨hx, hvx, hex⟩ + rcases hYZ with ⟨hy, hvy, hey⟩ + refine ⟨hYX, ?_, ?_⟩ + · intro i + calc + X.vertex (Fin.castLE (Nat.succ_le_succ hYX) i) = + Z.vertex (Fin.castLE (Nat.succ_le_succ hx) + (Fin.castLE (Nat.succ_le_succ hYX) i)) := + (hvx (Fin.castLE (Nat.succ_le_succ hYX) i)).symm + _ = Z.vertex (Fin.castLE (Nat.succ_le_succ hy) i) := by + congr 1 + _ = Y.vertex i := hvy i + · intro i + calc + X.edge (Fin.castLE hYX i) = + Z.edge (Fin.castLE hx (Fin.castLE hYX i)) := + (hex (Fin.castLE hYX i)).symm + _ = Z.edge (Fin.castLE hy i) := by congr 1 + _ = Y.edge i := hey i + unfold TashkinovAugmentationSequence at hseq ⊢ + induction hseq generalizing B with + | refl => + have hlen : B.length = A.length := + Nat.le_antisymm hBC.1 hAB.1 + have heq : B = A := equalTrees hBC hlen + subst B + exact Relation.ReflTransGen.refl + | @tail X C hAX hXC ih => + rcases hXC with ⟨hlen, hinit, hcolor⟩ + by_cases hBA : B.length ≤ X.length + · exact ih B hAB (commonExtension hinit hBC hBA) + · have hBlen : B.length = C.length := by + rcases hBC with ⟨hBCle, _, _⟩ + omega + have heq : B = C := equalTrees hBC hBlen + subst B + exact Relation.ReflTransGen.tail hAX ⟨hlen, hinit, hcolor⟩ + +private theorem helper_transportSequence_234.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), (0 : ℕ) < ett.rounds → StableColoring T (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) phi sigma → ( + ∀ (f : E), TreeIncidentEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f → + TreeIncidentEdge T f) → + ∀ {A : TreeSequence G e0}, TashkinovAugmentationSequence phi A T → + TashkinovAugmentationSequence sigma A T := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive hstab hinc A hseq + have vertexTransfer : ∀ {X Y : TreeSequence G e0}, + TashkinovAugmentation phi X Y → + ∀ v, v ∈ TreeSequenceVertexSet X → v ∈ TreeSequenceVertexSet Y := by + intro X Y hstep v hv + rcases hstep.2.1 with ⟨_, hvertices, _⟩ + unfold TreeSequenceVertexSet at hv ⊢ + simp only [Finset.mem_image] at hv ⊢ + rcases hv with ⟨i, hi, rfl⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hstep.2.1.1) i, ?_, ?_⟩ + · exact Finset.mem_univ _ + · exact hvertices i + have vertexInclusion : ∀ {X Y : TreeSequence G e0}, + TashkinovAugmentationSequence phi X Y → + ∀ v, v ∈ TreeSequenceVertexSet X → v ∈ TreeSequenceVertexSet Y := by + intro X Y hxy + unfold TashkinovAugmentationSequence at hxy + induction hxy using Relation.ReflTransGen.head_induction_on with + | refl => intro v hv; exact hv + | head hstep htail ih => + intro v hv + rcases hstep with ⟨hlen, hsegment, c, hcolor, hmiss⟩ + exact ih v (vertexTransfer ⟨hlen, hsegment, c, hcolor, hmiss⟩ v hv) + have segmentVertices : ∀ {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + ∀ v, v ∈ TreeSequenceVertexSet X → v ∈ TreeSequenceVertexSet Y := by + intro X Y hxy v hv + rcases hxy with ⟨hbound, hvertices, hedges⟩ + unfold TreeSequenceVertexSet at hv ⊢ + simp only [Finset.mem_image] at hv ⊢ + rcases hv with ⟨i, hi, rfl⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hbound) i, Finset.mem_univ _, + hvertices i⟩ + unfold TashkinovAugmentationSequence at hseq ⊢ + induction hseq using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head X Y hstep htail ih => + have htailVertex := vertexInclusion htail + rcases hstep with ⟨hlen, hsegment, c, hcolor, hmiss⟩ + refine Relation.ReflTransGen.head ?_ ih + refine ⟨hlen, hsegment, c, ?_, ?_⟩ + · let hlast : Fin Y.length := Fin.cast hlen.symm (Fin.last X.length) + have hcolor' : phi (Y.edge hlast) = some c := by + dsimp [hlast] + exact hcolor + have hinc : TreeIncidentEdge T (Y.edge hlast) := by + rcases Y.attaches hlast with ⟨i, hi⟩ + refine ⟨Y.vertex hlast.succ, ?_, ?_⟩ + · apply htailVertex + simp [TreeSequenceVertexSet] + · change Y.vertex hlast.succ ∈ G.ends (Y.edge hlast) + rw [hi] + exact Sym2.mem_mk_left _ _ + have heq := hstab.1 _ hinc + ⟨c, Finset.mem_union_left _ (by + unfold TreeMissingColors at hmiss ⊢ + rcases Finset.mem_biUnion.mp hmiss with ⟨v, hv, hvc⟩ + have hvY : v ∈ TreeSequenceVertexSet Y := + segmentVertices hsegment v hv + exact Finset.mem_biUnion.mpr ⟨v, htailVertex v hvY, hvc⟩), hcolor'⟩ + exact heq.trans hcolor' + · unfold TreeMissingColors at hmiss ⊢ + rcases Finset.mem_biUnion.mp hmiss with ⟨v, hv, hvc⟩ + have hvY : v ∈ TreeSequenceVertexSet Y := segmentVertices hsegment v hv + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [hstab.2 v (htailVertex v hvY)] + exact hvc + +private theorem helper_sequenceSegment_304.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), (0 : ℕ) < ett.rounds → + ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence phi A B → + TreeSequenceInitialSegment A B := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive A B hseq + unfold TashkinovAugmentationSequence at hseq + induction hseq using Relation.ReflTransGen.head_induction_on with + | refl => exact ⟨le_rfl, by intro i; rfl, by intro i; rfl⟩ + | @head X Y hstep htail ih => + rcases hstep with ⟨hlen, hsegment, c, hcolor, hmiss⟩ + rcases ih with ⟨hfirst, hvfirst, hefirst⟩ + refine ⟨le_trans hsegment.1 hfirst, ?_, ?_⟩ + · intro i + simpa using (hvfirst (Fin.castLE (m := Y.length + 1) + (Nat.succ_le_succ hsegment.1) i)).trans + (hsegment.2.1 i) + · intro i + simpa using (hefirst (Fin.castLE (m := Y.length) hsegment.1 i)).trans + (hsegment.2.2 i) + +private theorem helper_branch_346.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), (0 : ℕ) < ett.rounds → TreeSequenceInitialSegment (ett.series.data.tree + (Fin.last ett.rounds).castSucc) T → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → B.length ≤ A.length → TreeSequenceInitialSegment B A) → ( + ∀ (coloring : PartialEdgeColoring E k) (A B C : TreeSequence G e0), + TashkinovAugmentationSequence coloring A C → TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TashkinovAugmentationSequence coloring A B) → ( + ∀ {A : TreeSequence G e0}, TashkinovAugmentationSequence phi A T → + TashkinovAugmentationSequence sigma A T) → ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence phi A B → + TreeSequenceInitialSegment A B) → + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)), ett.series.data.connectingEdges i.succ = + ({ choice.edge } : Finset E) → ett.series.data.kind i.succ = some + TashkinovExtensionKind.SE → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) choice.edge adjoined → TashkinovClosure (ett.series.data.coloring i.succ) + adjoined (ett.series.data.tree i.succ.succ) → (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length → Fin.last ett.rounds + = i.succ → ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma (ett.series.data.tree i.succ.castSucc) T ∨ + (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = ({ f } : Finset + E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed T := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive hsegOuter commonSegment restrictSequence + transportSequence sequenceSegment i choice currentEdges currentKind adjoined + adjoinedExactly closedExtension strictExtension hindex + have hindex2 : (Fin.last (ett.rounds + 1) : Fin (ett.rounds + 1 + 1)) = + i.succ.succ := by + apply Fin.ext + have hv := congrArg Fin.val hindex + simp at hv ⊢ + omega + right + refine ⟨Or.inl currentKind, choice.edge, adjoined, currentEdges, + adjoinedExactly, ?_⟩ + have hold : TashkinovAugmentationSequence phi adjoined + (ett.series.data.tree i.succ.succ) := by + simpa [← hindex, ett.generatingColoring] using closedExtension.1 + have hab : TreeSequenceInitialSegment adjoined T := by + have ha := sequenceSegment hold + have hc : TreeSequenceInitialSegment T + (ett.series.data.tree i.succ.succ) := by + have hh := ett.belowFinal + rw [hindex2] at hh + exact hh + rcases adjoinedExactly with ⟨hlen, hinit, hedge⟩ + have hstrict := ett.strictAbovePenultimate + have hstrict' : + (ett.series.data.tree i.succ.castSucc).length < T.length := by + have hi : i.succ.castSucc = (Fin.last ett.rounds).castSucc := by + apply Fin.ext + simp [hindex] + rw [hi] + have hj : (Fin.last ett.rounds).castSucc = + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + rw [hj] + exact hstrict + exact commonSegment hc ha (by + rcases hsegOuter with ⟨hbound, _, _⟩ + omega) + exact transportSequence (restrictSequence phi adjoined T + (ett.series.data.tree i.succ.succ) hold hab (by + have hh := ett.belowFinal + rw [hindex2] at hh + exact hh)) + +private theorem helper_branch_392.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), (0 : ℕ) < ett.rounds → TreeColoringInvariant T phi sigma → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) T → ( + ∀ (coloring : PartialEdgeColoring E k) (A B C : TreeSequence G e0), + TashkinovAugmentationSequence coloring A C → TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TashkinovAugmentationSequence coloring A B) → ( + ∀ {A : TreeSequence G e0}, TashkinovAugmentationSequence phi A T → + TashkinovAugmentationSequence sigma A T) → + ∀ (i : Fin ett.rounds), ett.series.data.kind i.succ = some TashkinovExtensionKind.PE → + TashkinovClosure (ett.series.data.coloring i.succ) (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ) → (ett.series.data.tree i.succ.castSucc).length < + (ett.series.data.tree i.succ.succ).length → Fin.last ett.rounds = i.succ → + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma (ett.series.data.tree i.succ.castSucc) T ∨ + (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = ({ f } : Finset + E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed T := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive _ hsegOuter restrictSequence + transportSequence i currentKind closedExtension strictExtension hindex + have hindex2 : (Fin.last (ett.rounds + 1) : Fin (ett.rounds + 1 + 1)) = + i.succ.succ := by + apply Fin.ext + have hv := congrArg Fin.val hindex + simp only [Fin.val_last, Fin.val_succ] at hv ⊢ + omega + left + refine ⟨currentKind, ?_⟩ + have hold : TashkinovAugmentationSequence phi + (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ) := by + simpa [← hindex, ett.generatingColoring] using closedExtension.1 + have hseg : TreeSequenceInitialSegment + (ett.series.data.tree i.succ.castSucc) T := by + have hh := hsegOuter + rw [hindex] at hh + exact hh + have hfinal : TreeSequenceInitialSegment T + (ett.series.data.tree i.succ.succ) := by + have hh := ett.belowFinal + rw [hindex2] at hh + exact hh + have hpart := restrictSequence phi + (ett.series.data.tree i.succ.castSucc) T + (ett.series.data.tree i.succ.succ) hold hseg hfinal + exact transportSequence (by simpa [hindex] using hpart) + +private theorem helper_branch_424.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), (0 : ℕ) < ett.rounds → TreeSequenceInitialSegment (ett.series.data.tree + (Fin.last ett.rounds).castSucc) T → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B C + → B.length ≤ A.length → TreeSequenceInitialSegment B A) → ( + ∀ (coloring : PartialEdgeColoring E k) (A B C : TreeSequence G e0), + TashkinovAugmentationSequence coloring A C → TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TashkinovAugmentationSequence coloring A B) → ( + ∀ {A : TreeSequence G e0}, TashkinovAugmentationSequence phi A T → + TashkinovAugmentationSequence sigma A T) → ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence phi A B → + TreeSequenceInitialSegment A B) → + ∀ (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data + i.castSucc), ett.series.data.connectingEdges i.succ = ({ available.edge } : Finset E) → + ett.series.data.kind i.succ = some TashkinovExtensionKind.RE → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) available.edge adjoined → TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ) → (ett.series.data.tree + i.succ.castSucc).length < (ett.series.data.tree i.succ.succ).length → Fin.last ett.rounds + = i.succ → ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma (ett.series.data.tree i.succ.castSucc) T ∨ + (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = ({ f } : Finset + E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed T := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive hsegOuter commonSegment restrictSequence + transportSequence sequenceSegment i available currentEdges currentKind adjoined + adjoinedExactly closedExtension strictExtension hindex + have hindex2 : (Fin.last (ett.rounds + 1) : Fin (ett.rounds + 1 + 1)) = + i.succ.succ := by + apply Fin.ext + have hv := congrArg Fin.val hindex + simp only [Fin.val_last, Fin.val_succ] at hv ⊢ + omega + right + refine ⟨Or.inr currentKind, available.edge, adjoined, currentEdges, + adjoinedExactly, ?_⟩ + have hold : TashkinovAugmentationSequence phi adjoined + (ett.series.data.tree i.succ.succ) := by + simpa [← hindex, ett.generatingColoring] using closedExtension.1 + have hab : TreeSequenceInitialSegment adjoined T := by + have ha := sequenceSegment hold + have hc : TreeSequenceInitialSegment T + (ett.series.data.tree i.succ.succ) := by + have hh := ett.belowFinal + rw [hindex2] at hh + exact hh + rcases adjoinedExactly with ⟨hlen, hinit, hedge⟩ + have hstrict := ett.strictAbovePenultimate + have hstrict' : + (ett.series.data.tree i.succ.castSucc).length < T.length := by + have hi : i.succ.castSucc = (Fin.last ett.rounds).castSucc := by + apply Fin.ext + simp [hindex] + rw [hi] + have hj : (Fin.last ett.rounds).castSucc = + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + rw [hj] + exact hstrict + exact commonSegment hc ha (by + rcases hsegOuter with ⟨hbound, _, _⟩ + omega) + exact transportSequence (restrictSequence phi adjoined T + (ett.series.data.tree i.succ.succ) hold hab (by + have hh := ett.belowFinal + rw [hindex2] at hh + exact hh)) + +private theorem helper_hseries_501.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), (0 : ℕ) < ett.rounds → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds e0 + corr.replacementInput := cast (congrArg (fun (n : ℕ) ↦ TashkinovSeries G k n e0 + corr.replacementInput) ( + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + )) corr.replacementSeries; corr.replacementETT.series = replacementSeries := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive corr replacementSeries + exact ((cast_eq_iff_heq + (e := congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) + corr.rungAgreement.symm) + (a := corr.replacementSeries) (a' := corr.replacementETT.series)).2 + corr.seriesPresentation.symm).symm + +private theorem helper_htree_510.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi) (hpositive : (0 : ℕ) < ett.rounds) (corr : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds e0 + corr.replacementInput := cast (congrArg (fun (n : ℕ) ↦ TashkinovSeries G k n e0 + corr.replacementInput) ( + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + )) corr.replacementSeries; ( + ∀ {a b : ℕ} (h : a = b) (s : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (2 + : ℕ))), (cast (congrArg (fun (n : ℕ) ↦ TashkinovSeries G k n e0 corr.replacementInput) h) + s).data.tree i = s.data.tree (Fin.cast ( + by omega + ) i)) → corr.replacementETT.series = replacementSeries → + let terminalIndex : Fin corr.replacementETT.rounds := Fin.cast ( + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + ) (⟨ett.rounds - (1 : ℕ), + by + have _ : (1 : ℕ) ≤ ett.rounds := ett.roundsPositive + omega + ⟩ : Fin ett.rounds); corr.replacementETT.series.data.tree terminalIndex.succ.castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive corr replacementSeries castTree hseries + terminalIndex + rw [hseries] + calc + replacementSeries.data.tree terminalIndex.succ.castSucc = + corr.replacementSeries.data.tree + (Fin.cast (congrArg (fun n => n + 2) corr.rungAgreement) + terminalIndex.succ.castSucc) := + by simpa [replacementSeries] using + (castTree corr.rungAgreement.symm corr.replacementSeries + terminalIndex.succ.castSucc) + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + convert corr.ladderTreesAgree (Fin.cast corr.rungAgreement terminalIndex) using 1 + · congr 1 + · congr 1 + apply Fin.ext + simp [terminalIndex] + omega + +private theorem helper_hstored_528.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), (0 : ℕ) < ett.rounds → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds e0 + corr.replacementInput := cast (congrArg (fun (n : ℕ) ↦ TashkinovSeries G k n e0 + corr.replacementInput) ( + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + )) corr.replacementSeries; ( + ∀ {a b : ℕ} (h : a = b) (s : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (cast (congrArg (fun (n : ℕ) ↦ TashkinovSeries G k n e0 corr.replacementInput) h) + s).data.stored i = s.data.stored (Fin.cast ( + by omega + ) i)) → corr.replacementETT.series = replacementSeries → + ∀ (i : Fin (corr.replacementETT.rounds + (1 : ℕ))), corr.replacementETT.series.data.stored i = + ett.series.data.stored (Fin.cast ( + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive corr replacementSeries castStored hseries i + rw [hseries] + exact (castStored corr.rungAgreement.symm corr.replacementSeries i).trans + (corr.storedColorsAgree (Fin.cast (congrArg (fun n => n + 1) + corr.rungAgreement) i)) + +private theorem helper_hkindEq_536.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), (0 : ℕ) < ett.rounds → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds e0 + corr.replacementInput := cast (congrArg (fun (n : ℕ) ↦ TashkinovSeries G k n e0 + corr.replacementInput) ( + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + )) corr.replacementSeries; ( + ∀ {a b : ℕ} (h : a = b) (s : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (cast (congrArg (fun (n : ℕ) ↦ TashkinovSeries G k n e0 corr.replacementInput) h) + s).data.kind i = s.data.kind (Fin.cast ( + by omega + ) i)) → corr.replacementETT.series = replacementSeries → + ∀ (i : Fin (corr.replacementETT.rounds + (1 : ℕ))), corr.replacementETT.series.data.kind i = + ett.series.data.kind (Fin.cast ( + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive corr replacementSeries castKind hseries i + rw [hseries] + exact (castKind corr.rungAgreement.symm corr.replacementSeries i).trans + (corr.extensionKindsAgree (Fin.cast (congrArg (fun n => n + 1) + corr.rungAgreement) i)) + +private theorem helper_htreeFinal_544.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi) (hpositive : (0 : ℕ) < ett.rounds) (corr : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let terminalIndex : Fin corr.replacementETT.rounds := Fin.cast ( + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + ) (⟨ett.rounds - (1 : ℕ), + by have _ : (1 : ℕ) ≤ ett.rounds := ett.roundsPositive; omega + ⟩ : Fin ett.rounds); corr.replacementETT.series.data.tree terminalIndex.succ.castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc → corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = ett.series.data.tree (Fin.last + ett.rounds).castSucc := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive corr terminalIndex htree + have hi : (Fin.last corr.replacementETT.rounds).castSucc = + terminalIndex.succ.castSucc := by + apply Fin.ext + simp [terminalIndex] + have hr : corr.replacementETT.rounds = ett.rounds := corr.rungAgreement + omega + rw [hi] + exact htree + +private theorem helper_branch_563.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), MaximumProperty ett → (0 : ℕ) < ett.rounds → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : GoodHierarchy H), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), OutsideKempeRecoloring T phi sigma alpha beta → IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → (ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE → CombinedStableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) base.closure (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) phi sigma) → (ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc) T ∨ (ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last + ett.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence sigma seed T) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let _ : TashkinovSeries G k corr.replacementETT.rounds e0 corr.replacementInput := cast + (congrArg (fun (n : ℕ) ↦ TashkinovSeries G k n e0 corr.replacementInput) ( + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + )) corr.replacementSeries; ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE → + ∃ (corrFinal : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) (_ : MaximumProperty + corrFinal.replacementETT) (baseSigma : HierarchyBase corrFinal.replacementETT sigma) (K : + TashkinovHierarchy corrFinal.replacementETT baseSigma) (goodSigma : GoodHierarchy K), + SameGoodHierarchy good goodSigma := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett hMP hpositive hlower base H good hproper hone + alpha beta hrecolor hsigma honeSigma hcomb eligible corr replacementSeries hpe + have hsplit := HierarchySplitter G k e0 input T phi sigma ett hMP + hpositive hlower base H hpe hproper hone hsigma honeSigma + (hcomb hpe) (by + rcases eligible with h | h + · exact h.2 + · rcases h.1 with hs | hr + · exfalso + rw [hpe] at hs + cases hs + · exfalso + rw [hpe] at hr + cases hr) + rcases hsplit with ⟨corr', hmax', baseSigma, K, hsame⟩ + have hg : ∃ goodSigma : GoodHierarchy K, + SameGoodHierarchy good goodSigma := + OutsideKempeGoodHierarchy G k e0 T phi sigma + ett corr'.replacementETT base baseSigma H K hsame good + hproper hone alpha beta hrecolor corr'.rungAgreement.symm + (by + intro i + have hs : corr'.replacementETT.series = + cast (congrArg (fun n => TashkinovSeries G k n e0 + corr'.replacementInput) corr'.rungAgreement.symm) + corr'.replacementSeries := by + exact ((cast_eq_iff_heq + (e := congrArg (fun n => TashkinovSeries G k n e0 + corr'.replacementInput) corr'.rungAgreement.symm) + (a := corr'.replacementSeries) + (a' := corr'.replacementETT.series)).2 + corr'.seriesPresentation.symm).symm + rw [hs] + have hc := corr'.storedColorsAgree i + have castStep {a b : ℕ} (h : a = b) + (s : TashkinovSeries G k a e0 corr'.replacementInput) + (j : Fin (b + 1)) : + (cast (congrArg (fun n => TashkinovSeries G k n e0 + corr'.replacementInput) h) s).data.stored j = + s.data.stored (Fin.cast (congrArg (fun n => n + 1) h.symm) j) := by + cases h + rfl + exact hc.symm.trans + (castStep corr'.rungAgreement.symm corr'.replacementSeries + (Fin.cast (congrArg (fun n => n + 1) corr'.rungAgreement.symm) i)).symm) + rcases hg with ⟨goodSigma, hsg⟩ + exact ⟨corr', hmax', baseSigma, K, goodSigma, hsg⟩ + +private theorem helper_branch_608.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), (0 : ℕ) < ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : GoodHierarchy H), + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), OutsideKempeRecoloring T phi sigma alpha beta → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), MaximumProperty + corr.replacementETT → ( + ∀ (i : Fin (corr.replacementETT.rounds + (1 : ℕ))), corr.replacementETT.series.data.stored i = + ett.series.data.stored (Fin.cast ( + by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → ( + ∀ (i : Fin (corr.replacementETT.rounds + (1 : ℕ))), corr.replacementETT.series.data.kind i = + ett.series.data.kind (Fin.cast ( + by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc → ¬ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.PE → + ∃ (corrFinal : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) (_ : MaximumProperty + corrFinal.replacementETT) (baseSigma : HierarchyBase corrFinal.replacementETT sigma) (K : + TashkinovHierarchy corrFinal.replacementETT baseSigma) (goodSigma : GoodHierarchy K), + SameGoodHierarchy good goodSigma := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett hpositive base H good hproper hone alpha beta + hrecolor corr hmax hstored hkindEq htreeFinal hpe + let baseSigma : HierarchyBase corr.replacementETT sigma := + { core := base.core + closure := base.closure + supportPosition := Fin.cast (congrArg (fun X => X.length + 1) + htreeFinal.symm) base.supportPosition + supportPositive := base.supportPositive + terminalMissingColors := by rfl + parallel := by + dsimp + intro hp + have hnot := hkindEq (Fin.last corr.replacementETT.rounds) + have hk : corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) := by + simpa [corr.rungAgreement] using hnot + exfalso + exact hpe (by simpa [hk] using hp) + nonparallel := by + dsimp + intro hn + have hc := base.nonparallel hpe + simpa [htreeFinal] using hc } + let K : TashkinovHierarchy corr.replacementETT baseSigma := + { dividerCount := H.dividerCount + stage := H.stage + baseStage := by simpa [htreeFinal] using H.baseStage + terminalStage := H.terminalStage + nested := H.nested + strict := H.strict + dividerPosition := H.dividerPosition + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := H.dividerStage + coreInsideFirst := by simpa [baseSigma] using H.coreInsideFirst } + have hsame : SameHierarchyStages H K := by + dsimp [SameHierarchyStages, K, baseSigma] + refine ⟨rfl, rfl, heq_of_eq rfl, heq_of_eq rfl, ?_, ?_⟩ + · constructor <;> intro h + · have hnot := hkindEq (Fin.last corr.replacementETT.rounds) + have hk : corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) := by + simpa [corr.rungAgreement] using hnot + exact hk ▸ h + · have hnot := hkindEq (Fin.last corr.replacementETT.rounds) + have hk : corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) := by + simpa [corr.rungAgreement] using hnot + exact hk.symm ▸ h + · intro hp + exact False.elim (hpe hp) + have hg := OutsideKempeGoodHierarchy G k e0 T phi sigma + ett corr.replacementETT base baseSigma H K hsame good + hproper hone alpha beta hrecolor corr.rungAgreement.symm (by + intro i + exact (hstored (Fin.cast (congrArg (fun n => n + 1) + corr.rungAgreement.symm) i)).symm) + rcases hg with ⟨goodSigma, hsg⟩ + exact ⟨corr, hmax, baseSigma, K, goodSigma, hsg⟩ + +private theorem helper_missingEq_673.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T phi), (0 : ℕ) < ett.rounds → StableColoring T (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) phi sigma → TreeMissingColors phi T = + TreeMissingColors sigma T := by + classical + intro V E _ _ _ G k e0 input T phi sigma ett hpositive hstab + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor <;> rintro ⟨v, hv, hc⟩ + · exact ⟨v, hv, (Finset.ext_iff.mp (hstab.2 v hv) c).mpr hc⟩ + · exact ⟨v, hv, (Finset.ext_iff.mp (hstab.2 v hv) c).mp hc⟩ + +private theorem helper_hi_686.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), (0 : ℕ) < ett.rounds → + ∀ f ∈ BoundaryEdges G (TreeSequenceVertexSet T), TreeIncidentEdge T f := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive f hbase + unfold BoundaryEdges at hbase + simp only [Finset.mem_filter] at hbase + rcases hbase with ⟨_, ⟨u, hu, v, hv, he⟩⟩ + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [he] + exact Sym2.mem_mk_left _ _ + +theorem HierarchyLEMStable {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) + (good : GoodHierarchy H) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (alpha beta : Fin k) + (hrecolor : OutsideKempeRecoloring T phi sigma alpha beta) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Dn := TashkinovStoredColors ett.series.data n + IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring T Dn phi sigma ∧ + TreeColoringInvariant T phi sigma ∧ + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T, + MaximumProperty corr.replacementETT ∧ + ∃ baseSigma : HierarchyBase corr.replacementETT sigma, + ∃ K : TashkinovHierarchy corr.replacementETT baseSigma, + ∃ goodSigma : GoodHierarchy K, + SameGoodHierarchy good goodSigma ∧ + (TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount))) → + TreeColorSetMinusClosed G sigma T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) := by + dsimp + have hstable := HierarchyOutsideKempeStable G k e0 input T phi sigma ett base H + hproper hone alpha beta hrecolor + have hdetail := OutsideKempeRecoloringStable G e0 T + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma alpha beta + hproper hone hrecolor + rcases hstable with ⟨hsigma, honeSigma, hstab, hinv, hcomb⟩ + rcases hdetail with ⟨_, _, _, _, hfixed⟩ + have hsegOuter := + @helper_hsegOuter_88 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@hpositive) + have hsub := + @helper_hsub_104 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@hpositive) (@hsegOuter) + have hinc : ∀ f, TreeIncidentEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f → + TreeIncidentEdge T f := by + intro f hf + rcases hf with ⟨v, hv, hi⟩ + exact ⟨v, hsub hv, hi⟩ + have segmentCombine := + @helper_segmentCombine_122 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) + have commonSegment := + @helper_commonSegment_134 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@hpositive) + have hladder := + @helper_hladder_156 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@hstab) (@hfixed) (@hsub) (@hinc) + have restrictSequence := + @helper_restrictSequence_167 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) + have transportSequence := + @helper_transportSequence_234 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@hstab) (@hinc) + have sequenceSegment := + @helper_sequenceSegment_304 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) + have eligible : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) T) ∨ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ f seed, + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed T) := by + have hstep := ett.series.certified (Fin.last ett.rounds) + generalize hindex : Fin.last ett.rounds = index at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + have hz : (Fin.last ett.rounds : Fin (ett.rounds + 1)) = 0 := hindex + have hr : ett.rounds = 0 := by + have := congrArg Fin.val hz + simpa using this + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_346 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@hsegOuter) + (@commonSegment) (@restrictSequence) (@transportSequence) (@sequenceSegment) (@i) + (@choice) (@currentEdges) (@currentKind) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@strictExtension) (@hindex) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_392 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (by assumption) + (@hsegOuter) (@restrictSequence) (@transportSequence) (@i) (@currentKind) + (@closedExtension) (@strictExtension) (@hindex) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_424 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@hsegOuter) + (@commonSegment) (@restrictSequence) (@transportSequence) (@sequenceSegment) (@i) + (@available) (@currentEdges) (@currentKind) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@strictExtension) (@hindex) + have hmod : ModColoring ett sigma := Td G k e0 input T phi ett hMP + hpositive hlower sigma hsigma honeSigma hladder + have hcand := hmod.2.2 T hsegOuter ett.strictAbovePenultimate eligible + rcases hcand with ⟨corr⟩ + have hmax : MaximumProperty corr.replacementETT := + MaximumPropertyTransport G k e0 ett sigma hmod T corr hMP + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds e0 + corr.replacementInput := + cast (congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) + corr.rungAgreement.symm) corr.replacementSeries + have castStored {a b : ℕ} (h : a = b) + (s : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)) : + (cast (congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) h) + s).data.stored i = s.data.stored (Fin.cast (congrArg (fun n => n + 1) h.symm) i) := by + cases h + rfl + have castKind {a b : ℕ} (h : a = b) + (s : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)) : + (cast (congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) h) + s).data.kind i = s.data.kind (Fin.cast (congrArg (fun n => n + 1) h.symm) i) := by + cases h + rfl + have castTree {a b : ℕ} (h : a = b) + (s : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 2)) : + (cast (congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) h) + s).data.tree i = s.data.tree (Fin.cast (congrArg (fun n => n + 2) h.symm) i) := by + cases h + rfl + have hseries := + @helper_hseries_501 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@corr) + let terminalIndex : Fin corr.replacementETT.rounds := + Fin.cast corr.rungAgreement.symm + ⟨ett.rounds - 1, by have hp := ett.roundsPositive; omega⟩ + have htree := + @helper_htree_510 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@corr) (@castTree) (@hseries) + have hstored := + @helper_hstored_528 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@corr) (@castStored) (@hseries) + have hkindEq := + @helper_hkindEq_536 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@corr) (@castKind) (@hseries) + have htreeFinal := + @helper_htreeFinal_544 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@corr) (@htree) + have hgoodData : ∃ corrFinal : CorrespondingExtendedTashkinovTree G k e0 ett sigma T, + ∃ hmaxFinal : MaximumProperty corrFinal.replacementETT, + ∃ baseSigma : HierarchyBase corrFinal.replacementETT sigma, + ∃ K : TashkinovHierarchy corrFinal.replacementETT baseSigma, + ∃ goodSigma : GoodHierarchy K, + SameGoodHierarchy good goodSigma := by + by_cases hpe : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · exact @helper_branch_563 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@sigma) (@ett) (@hMP) (@hpositive) (@hlower) + (@base) (@H) (@good) (@hproper) (@hone) (@alpha) (@beta) (@hrecolor) (@hsigma) + (@honeSigma) (@hcomb) (@eligible) (@corr) (@hpe) + · exact @helper_branch_608 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@base) (@H) (@good) + (@hproper) (@hone) (@alpha) (@beta) (@hrecolor) (@corr) (@hmax) (@hstored) (@hkindEq) + (@htreeFinal) (@hpe) + rcases hgoodData with ⟨corrFinal, hmaxFinal, baseSigma, K, goodSigma, hsg⟩ + refine ⟨hsigma, honeSigma, hstab, hinv, corrFinal, hmaxFinal, baseSigma, K, + goodSigma, hsg, ?_⟩ + intro hclosed + unfold TreeColorSetMinusClosed at hclosed ⊢ + have missingEq := + @helper_missingEq_673 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@phi) (@sigma) (@ett) (@hpositive) (@hstab) + rw [missingEq] at hclosed + intro alpha ha + have hc := hclosed alpha ha + rw [Finset.eq_empty_iff_forall_notMem] at hc ⊢ + intro f hf + simp only [BoundaryColorEdges, Finset.mem_filter] at hf + have hbase : f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := hf.1 + have hi := + @helper_hi_686 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@hpositive) (@f) (@hbase) + have hphi : phi f = some alpha := by + exact (hfixed f hi).symm ▸ hf.2 + apply hc f + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hbase, hphi⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyMeasures.lean b/LeanPool/GoldbergSeymour/HierarchyMeasures.lean new file mode 100644 index 0000000000..168ad7e3f7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyMeasures.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure + +/-! +# P2752_T2_Hierarchy Measures + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2752_T2_HierarchyMeasures {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input₁ input₂ phi₁ phi₂ : PartialEdgeColoring E k} + {T : TreeSequence G e0} + {ett₁ : ExtendedTashkinovTree G k e0 input₁ T phi₁} + {ett₂ : ExtendedTashkinovTree G k e0 input₂ T phi₂} + {base₁ : HierarchyBase ett₁ phi₁} {base₂ : HierarchyBase ett₂ phi₂} + (H₁ : TashkinovHierarchy ett₁ base₁) + (H₂ : TashkinovHierarchy ett₂ base₂) + (hsame : SameHierarchyStages H₁ H₂) : + HierarchyStarredStage H₁ (Fin.last H₁.dividerCount) = + HierarchyStarredStage H₂ (Fin.last H₂.dividerCount) ∧ + HierarchyPathNumber H₁ = HierarchyPathNumber H₂ ∧ + H₁.stage ⟨H₁.dividerCount, by omega⟩ = + H₂.stage ⟨H₂.dividerCount, by omega⟩ := by + classical + cases H₁ with + | mk q₁ stage₁ baseStage₁ terminalStage₁ nested₁ strict₁ + divider₁ positive₁ increasing₁ dividerStage₁ coreInside₁ => + cases H₂ with + | mk q₂ stage₂ baseStage₂ terminalStage₂ nested₂ strict₂ + divider₂ positive₂ increasing₂ dividerStage₂ coreInside₂ => + rcases hsame with ⟨hcore, hcount, hstage, _, _, _⟩ + dsimp only at hcount hstage + cases hcount + have heq : stage₁ = stage₂ := eq_of_heq hstage + cases heq + have hstar : + HierarchyStarredStage + (TashkinovHierarchy.mk q₁ stage₁ baseStage₁ terminalStage₁ nested₁ strict₁ + divider₁ positive₁ increasing₁ dividerStage₁ coreInside₁) (Fin.last q₁) = + HierarchyStarredStage + (TashkinovHierarchy.mk q₁ stage₁ baseStage₂ terminalStage₂ nested₂ strict₂ + divider₂ positive₂ increasing₂ dividerStage₂ coreInside₂) (Fin.last q₁) := by + simp only [HierarchyStarredStage] + rw [hcore] + refine ⟨hstar, ?_, rfl⟩ + unfold HierarchyPathNumber + rw [hstar] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyMinimumCounterexampleContext.lean b/LeanPool/GoldbergSeymour/HierarchyMinimumCounterexampleContext.lean new file mode 100644 index 0000000000..e46589cbbf --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyMinimumCounterexampleContext.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.BoundaryColorVertex + +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex + +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess + +public import LeanPool.GoldbergSeymour.ModColoring + +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex + +public import LeanPool.GoldbergSeymour.TreeInterchangeable + +public import LeanPool.GoldbergSeymour.LowerRoundProperties + +/-! +# Hierarchy Minimum Counterexample Context + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Induction hypotheses and minimality conditions for a non-elementary good hierarchy. -/ +structure HierarchyMinimumCounterexampleContext {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) where + proper : IsProperEdgeColoring G phi + oneEdgeUncolored : IsOneEdgeUncolored phi e0 + lowerRung : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), 0 < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → (open + scoped Classical in LowerRoundProperties lower) + fewerDividers : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating'), other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → ColoredVertexSetElementary G + generating' (TreeSequenceVertexSet T') + lexicographicMinimality : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C) + largeMissingSet : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyNonparallelFirstEdge.lean b/LeanPool/GoldbergSeymour/HierarchyNonparallelFirstEdge.lean new file mode 100644 index 0000000000..00ae26e7f9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyNonparallelFirstEdge.lean @@ -0,0 +1,218 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovHierarchy + +/-! +# Hierarchy Nonparallel First Edge + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchyNonparallelFirstEdge {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T phi} + {base : HierarchyBase ett phi} (H : TashkinovHierarchy ett base) + (f : E) + (hkind : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) + (hedges : ett.series.data.connectingEdges (Fin.last ett.rounds) = {f}) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + ∃ r : Fin (H.stage ⟨1, by omega⟩).length, + r.val = Tn.length ∧ (H.stage ⟨1, by omega⟩).edge r = f := by + classical + dsimp + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨le_trans hab hbc, ?_, ?_⟩ + · intro i + have hmid := hvbc (Fin.castLE (Nat.succ_le_succ hab) i) + have hfirst := hvab i + simpa using hmid.trans hfirst + · intro i + have hmid := hebc (Fin.castLE hab i) + have hfirst := heab i + simpa using hmid.trans hfirst + have chain : ∀ q : ℕ, (hq : q ≤ H.dividerCount) → + TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) + (H.stage ⟨1 + q, by omega⟩) := by + intro q + induction q with + | zero => + intro hq + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + | succ q ih => + intro hq + have hprev := ih (by omega) + have hnext := H.nested ⟨1 + q, by omega⟩ + have hnext' : TreeSequenceInitialSegment + (H.stage ⟨1 + q, by omega⟩) + (H.stage ⟨1 + (q + 1), by omega⟩) := by + simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using hnext + exact segmentTrans hprev hnext' + have stageToT : TreeSequenceInitialSegment + (H.stage ⟨1, by omega⟩) T := by + have hc := chain H.dividerCount (le_rfl) + have hi : (⟨1 + H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [Nat.add_comm] + rw [hi] at hc + simpa [H.terminalStage] using hc + have stageToFinal : TreeSequenceInitialSegment + (H.stage ⟨1, by omega⟩) + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := + segmentTrans stageToT ett.belowFinal + have reachSegment {A B : TreeSequence G e0} {coloring : PartialEdgeColoring E k} + (hseq : TashkinovAugmentationSequence coloring A B) : + TreeSequenceInitialSegment A B := by + unfold TashkinovAugmentationSequence at hseq + induction hseq using Relation.ReflTransGen.head_induction_on with + | refl => + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + | @head A B hstep htail ih => + rcases hstep with ⟨hlen, hseg, color, hedge, hmissing⟩ + exact segmentTrans hseg ih + let terminalIndex : Fin (ett.rounds + 1) := Fin.last ett.rounds + change ett.series.data.kind terminalIndex = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind terminalIndex = + some TashkinovExtensionKind.RE at hkind + have terminalFact : + ∀ (j : Fin (ett.rounds + 1)), ett.series.data.kind j = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind j = some TashkinovExtensionKind.RE → + ∀ g : E, ett.series.data.connectingEdges j = {g} → + ∃ A : TreeSequence G e0, + ∃ hlen : A.length = (ett.series.data.tree j.castSucc).length + 1, TreeSequenceInitialSegment + (ett.series.data.tree j.castSucc) A ∧ TreeSequenceInitialSegment A (ett.series.data.tree + j.succ) ∧ A.edge (Fin.cast hlen.symm (Fin.last (ett.series.data.tree j.castSucc).length)) + = g := by + intro j hj g hconnect + have cert := ett.series.certified j + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + rcases hj with hj | hj + · rw [initialKind] at hj + simp at hj + · rw [initialKind] at hj + simp at hj + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + refine ⟨adjoined, adjoinedExactly.1, adjoinedExactly.2.1, + reachSegment closedExtension.1, ?_⟩ + have hmem' : choice.edge ∈ + ett.series.data.connectingEdges i.succ := by + rw [currentEdges] + simp + have hmem : choice.edge ∈ ({g} : Finset E) := by + rw [hconnect] at hmem' + exact hmem' + exact adjoinedExactly.2.2.trans (Finset.mem_singleton.mp hmem) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + rcases hj with hj | hj + · rw [currentKind] at hj + simp at hj + · rw [currentKind] at hj + simp at hj + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + refine ⟨adjoined, adjoinedExactly.1, adjoinedExactly.2.1, + reachSegment closedExtension.1, ?_⟩ + have hmem' : available.edge ∈ + ett.series.data.connectingEdges i.succ := by + rw [currentEdges] + simp + have hmem : available.edge ∈ ({g} : Finset E) := by + rw [hconnect] at hmem' + exact hmem' + exact adjoinedExactly.2.2.trans (Finset.mem_singleton.mp hmem) + have terminalEdges : ett.series.data.connectingEdges terminalIndex = {f} := by + simpa [terminalIndex] using hedges + obtain ⟨adjoined, adjoinedLength, adjoinedInitial, adjoinedFinal, adjoinedEdge⟩ := + terminalFact terminalIndex hkind f terminalEdges + have hkindIndex : terminalIndex.succ = Fin.last (ett.rounds + 1) := by + apply Fin.ext + simp [terminalIndex] + have hbaseTree : + ett.series.data.tree terminalIndex.castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rfl + have hfinalEdge : + (ett.series.data.tree (Fin.last (ett.rounds + 1))).edge + (Fin.castLE adjoinedFinal.1 + (Fin.cast adjoinedLength.symm + (Fin.last (ett.series.data.tree terminalIndex.castSucc).length))) = f := by + have hadge := adjoinedFinal.2.2 + (Fin.cast adjoinedLength.symm + (Fin.last (ett.series.data.tree terminalIndex.castSucc).length)) + have htree : ett.series.data.tree terminalIndex.succ = + ett.series.data.tree (Fin.last (ett.rounds + 1)) := by + rw [hkindIndex] + cases htree + exact hadge.trans adjoinedEdge + have hstrict := H.strict 0 + have hbase := H.baseStage + have hstageLen : + (ett.series.data.tree terminalIndex.castSucc).length < + (H.stage ⟨1, by omega⟩).length := by + rw [← hbase] + exact hstrict + let r : Fin (H.stage ⟨1, by omega⟩).length := + ⟨(ett.series.data.tree terminalIndex.castSucc).length, hstageLen⟩ + have htransfer := stageToFinal.2.2 r + have hidx : + Fin.castLE stageToFinal.1 r = + Fin.castLE adjoinedFinal.1 + (Fin.cast adjoinedLength.symm + (Fin.last (ett.series.data.tree terminalIndex.castSucc).length)) := by + apply Fin.ext + rfl + refine ⟨r, rfl, ?_⟩ + change (H.stage ⟨1, by omega⟩).edge r = f + calc + (H.stage ⟨1, by omega⟩).edge r = + (ett.series.data.tree (Fin.last (ett.rounds + 1))).edge + (Fin.castLE stageToFinal.1 r) := htransfer.symm + _ = (ett.series.data.tree (Fin.last (ett.rounds + 1))).edge + (Fin.castLE adjoinedFinal.1 + (Fin.cast adjoinedLength.symm + (Fin.last (ett.series.data.tree terminalIndex.castSucc).length))) := by + rw [hidx] + _ = f := hfinalEdge + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyNormalizationLemmas.lean b/LeanPool/GoldbergSeymour/HierarchyNormalizationLemmas.lean new file mode 100644 index 0000000000..1a21cd47ac --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyNormalizationLemmas.lean @@ -0,0 +1,163 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.BaseControl +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans +public import Mathlib.Algebra.BigOperators.Group.Finset.Basic + +/-! +# Preparatory lemmas for hierarchy normalization + +Extracted from Wesley Pegden’s Trellis formalization of the Goldberg–Seymour +theorem at 88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. These lemmas establish +properties used in the computed hierarchy records of `HierarchyClaimNinePENormalization`. +-/ + +@[expose] public section + +namespace GoldbergSeymour.HierarchyNormalizationLemmas + +theorem helper_branch_909.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + let F : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let b : HierarchyBase P.corresponding.replacementETT P.coloring := P.replacementBase; + let X : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := X.hierarchy; + let n : Fin (F.rounds + (1 : ℕ)) := Fin.last F.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let y : V := T.vertex (Fin.last T.length); F.series.data.kind n = some + TashkinovExtensionKind.PE → A = b.core → alpha ∈ TreeMissingColors mu A → + let D : Finset (Fin k) := HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ))); + let R : Finset (Fin k) := D.biUnion (X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : + ℕ)))); + ∀ beta ∉ R, alpha ∉ R → beta ∈ TreeMissingColors mu A → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G mu beta alpha (Sum.inl y); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 F sigma T) (bs : HierarchyBase + corr.replacementETT sigma) (K : TashkinovHierarchy corr.replacementETT bs), bs.core = A → + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), HierarchyStarredStage K j = bs.core) → ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), K.stage j.succ = T) → H.stage (Fin.succ (0 : Fin + (H.dividerCount + (1 : ℕ)))) = T → ( + ∀ (f : E) (c : Fin k), c ≠ beta → c ≠ alpha → (sigma f = some c ↔ mu f = some c)) → ( + ∀ (eta : Fin k), eta ≠ beta → eta ≠ alpha → HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition mu T eta) → + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt K j, + ∀ ⦃c : Fin k⦄, c ∈ X.good.gamma (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta → eta ∈ D → + c ∈ HierarchyStageMissingColors X.hierarchy (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) + \ HierarchySegmentColors X.hierarchy (0 : Fin (X.hierarchy.dividerCount + (1 : ℕ))) eta → + c ∉ HierarchySegmentColors K j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu F b X H n A y hp hA haA D R beta + hbR haRnot hbA sigma corr bs K coreEq starK termK termH unaffectedValue firstEq j eta heta + c hcg hetaD hold hseg + have hn : eta ∉ TreeMissingColors mu A := by + have hn := (Finset.mem_sdiff.mp hetaD).2 + change eta ∉ TreeMissingColors mu b.core at hn + rwa [← hA] at hn + have heb : eta ≠ beta := by intro h; subst eta; exact hn hbA + have hea : eta ≠ alpha := by intro h; subst eta; exact hn haA + have hcR : c ∈ R := Finset.mem_biUnion.mpr ⟨eta, hetaD, hcg⟩ + have hcb : c ≠ beta := by intro h; subst c; exact hbR hcR + have hca : c ≠ alpha := by intro h; subst c; exact haRnot hcR + have hfirst := firstEq eta heb hea + change c ∈ Finset.univ.filter (fun c => ∃ r : Fin (K.stage j.succ).length, + (HierarchyStarredStage K j).length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma T eta).val (K.stage j.succ).length ∧ + sigma ((K.stage j.succ).edge r) = some c) at hseg + rw [starK j, coreEq, termK j, hfirst] at hseg + obtain ⟨r, hr, hp, hcol⟩ := (Finset.mem_filter.mp hseg).2 + apply (Finset.mem_sdiff.mp hold).2 + change c ∈ Finset.univ.filter (fun c => ∃ r : Fin (H.stage (0 : Fin (H.dividerCount + + 1)).succ).length, + b.core.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition mu T eta).val (H.stage (0 : Fin (H.dividerCount + + 1)).succ).length ∧ + mu ((H.stage (0 : Fin (H.dividerCount + 1)).succ).edge r) = some c) + rw [termH, ← hA] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, r, hr, hp, (unaffectedValue _ c hcb hca).1 hcol⟩ + +end GoldbergSeymour.HierarchyNormalizationLemmas + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyOrderedExitReduction.lean b/LeanPool/GoldbergSeymour/HierarchyOrderedExitReduction.lean new file mode 100644 index 0000000000..ddf3d02360 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyOrderedExitReduction.lean @@ -0,0 +1,979 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import Mathlib.Tactic.ClearExcept + +/-! +# rutcor + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_segmentTrans_101.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y + Z → TreeSequenceInitialSegment X Z := by + classical + intro V E G e0 X Y Z hXY hYZ + rcases hXY with ⟨hxy, vxy, exy⟩ + rcases hYZ with ⟨hyz, vyz, eyz⟩ + refine ⟨le_trans hxy hyz, ?_, ?_⟩ + · intro i + exact (vyz (Fin.castLE (Nat.succ_le_succ hxy) i)).trans (vxy i) + · intro i + exact (eyz (Fin.castLE hxy i)).trans (exy i) + +private theorem helper_stageSegment_112.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage (⟨a, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H segmentTrans a d + induction d with + | zero => intro hb; exact ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + | succ d ih => + intro hb + exact segmentTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + +private theorem helper_starPositive_127.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (j : Fin + (H.dividerCount + (1 : ℕ))), (0 : ℕ) < (↑j : ℕ) → HierarchyStarredStage H j = H.stage + j.castSucc := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H j hj + have hn : j ≠ 0 := by + intro hh + have hval : j.val = 0 := congrArg Fin.val hh + omega + unfold HierarchyStarredStage + rw [← Fin.succ_pred j hn] + rfl + +private theorem helper_starMono_140.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base), ( + ∀ (a b : Fin (H.dividerCount + (2 : ℕ))), (↑a : ℕ) ≤ (↑b : ℕ) → TreeSequenceInitialSegment + (H.stage a) (H.stage b)) → ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), (0 : ℕ) < (↑j : ℕ) → HierarchyStarredStage H j = + H.stage j.castSucc) → ( + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), (0 : ℕ) < (↑j : ℕ) → TreeSequenceInitialSegment + base.core (H.stage j)) → + ∀ (i j : Fin (H.dividerCount + (1 : ℕ))), (↑i : ℕ) ≤ (↑j : ℕ) → TreeSequenceInitialSegment + (HierarchyStarredStage H i) (HierarchyStarredStage H j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H stageMono starPositive coreStage i j hij + by_cases hi : i = 0 + · subst i + by_cases hj : j = 0 + · subst j; exact ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + · have hjp : 0 < j.val := by + by_contra hh + apply hj + apply Fin.ext + change j.val = 0 + omega + rw [starPositive j hjp] + exact coreStage j.castSucc hjp + · have hip : 0 < i.val := by + by_contra hh + apply hi + apply Fin.ext + change i.val = 0 + omega + rw [starPositive i hip, starPositive j (by omega)] + exact stageMono i.castSucc j.castSucc hij + +private theorem helper_hATy_179.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; TreeSequenceInitialSegment A T → + A.length < T.length → + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 + : ℕ))) T.length) ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ + by omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); TreeSequenceInitialSegment A Ty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H q A hAT hAlen Ty + refine ⟨?_, ?_, ?_⟩ + · change A.length ≤ min (A.length + (T.length - A.length - 1)) T.length + omega + · intro i + exact hAT.2.1 i + · intro i + exact hAT.2.2 i + +private theorem helper_coreSegment_197.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi), + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + TreeSequenceInitialSegment Tn base.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base Tn + by_cases hp : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE + · obtain ⟨union⟩ := (base.parallel hp).2.2 + exact union.leftSegment + · rw [base.nonparallel hp] + exact ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + +private theorem helper_descend_206.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (_ : + GoodHierarchy H), + ∀ alpha ∈ TreeMissingColors phi (HierarchyStarredStage H (Fin.last H.dividerCount)), + let _ : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H j))) → + ∀ (d : ℕ) (j : Fin (H.dividerCount + (1 : ℕ))), H.dividerCount ≤ (↑j : ℕ) + d → (0 : ℕ) < (↑j + : ℕ) → ( + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑j : ℕ) ≤ (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ alpha } : Finset (Fin k))) → alpha ∈ TreeMissingColors phi + (HierarchyStarredStage H j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good alpha halpha q elementaryStar d + induction d with + | zero => + intro j hj _ _ + have hjq : j = q := Fin.ext (by simp [q]; omega) + simpa [hjq, q] using halpha + | succ d ih => + intro j hj hjp hn + by_cases hjq : j = q + · simpa [hjq, q] using halpha + · have hjlt : j.val < H.dividerCount := by + have hne : j.val ≠ H.dividerCount := by + intro hh; apply hjq; apply Fin.ext; simpa [q] using hh + omega + let i : Fin H.dividerCount := ⟨j.val, hjlt⟩ + have hic : i.castSucc = j := Fin.ext rfl + have hnext := ih i.succ (by dsimp [i]; omega) (by simp) + (fun s hs => hn s (by dsimp [i] at hs; omega)) + by_contra hold + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hnext + have hvo : v ∉ TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc) := by + intro hvo + exact hold (Finset.mem_biUnion.mpr ⟨v, by simpa [hic] using hvo, hvm⟩) + have hnew : alpha ∈ + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun v => MissingColors G phi v) := + Finset.mem_biUnion.mpr ⟨v, Finset.mem_sdiff.mpr ⟨hv, hvo⟩, hvm⟩ + have hc := GoodHierarchyNewMissingClosed good i (elementaryStar i.succ) alpha hnew + apply hn i.succ (by dsimp [i]; omega) + intro c hc' + have : c = alpha := Finset.mem_singleton.mp hc' + subst c + exact hc + +private theorem helper_reserved_251.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H) (alpha : Fin k) (i : Fin H.dividerCount), alpha ∈ TreeMissingColors phi + (HierarchyStarredStage H i.succ) → ¬TreeColorSetClosed G phi (HierarchyStarredStage H + i.succ) ({ alpha } : Finset (Fin k)) → alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion + (good.gamma i.castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good alpha i hm hn + by_contra hh + apply hn + intro c hc + have : c = alpha := Finset.mem_singleton.mp hc + subst c + exact good.minusClosed i alpha (Finset.mem_sdiff.mpr ⟨hm, hh⟩) + +private theorem helper_cutoff_262.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (B : TreeSequence G e0), + TreeSequenceInitialSegment B T → + ∀ eta ∉ TreeMissingColors phi B, + min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) B.length = B.length := by + classical + intro V E _ _ G k e0 T phi B hBT eta hm + let _ := Fintype.ofFinite V + have heq := HierarchyFirstMissingPositionPrefixCutoff phi B T hBT eta B.length le_rfl + have hempty : ¬ (Finset.univ.filter fun j : Fin (B.length + 1) => + eta ∈ MissingColors G phi (B.vertex j)).Nonempty := by + rintro ⟨j, hj⟩ + apply hm + apply Finset.mem_biUnion.mpr + refine ⟨B.vertex j, ?_, (Finset.mem_filter.mp hj).2⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + rw [HierarchyFirstMissingPosition, dite_eq_right hempty] at heq + simpa using heq.symm + +private theorem helper_segmentAvoid_277.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H) (alpha : Fin k), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ (i j : Fin (H.dividerCount + (1 : ℕ))), (↑i : ℕ) ≤ (↑j : ℕ) → TreeSequenceInitialSegment + (HierarchyStarredStage H i) (HierarchyStarredStage H j)) → TreeSequenceInitialSegment A T + → ( + ∀ (B : TreeSequence G e0), TreeSequenceInitialSegment B T → + ∀ eta ∉ TreeMissingColors phi B, min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) B.length + = B.length) → + ∀ (i : Fin H.dividerCount), alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma + i.castSucc) → + ∀ (t : Fin (HierarchyStarredStage H i.succ).length), (HierarchyStarredStage H + i.castSucc).length ≤ (↑t : ℕ) → phi ((HierarchyStarredStage H i.succ).edge t) ≠ some alpha + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good alpha q A segmentTrans starMono hAT cutoff + i hr + obtain ⟨eta, heta, hgamma⟩ := Finset.mem_biUnion.mp hr + have havoid := (Finset.mem_sdiff.mp + (good.avoidance i.castSucc eta (HierarchyStoredColorsAntitone H i heta) hgamma)).2 + have hnm : eta ∉ TreeMissingColors phi (HierarchyStarredStage H i.succ) := + (Finset.mem_sdiff.mp heta).2 + have hBT := segmentTrans (starMono i.succ q (by simp [q])) hAT + have hc := cutoff (HierarchyStarredStage H i.succ) hBT eta hnm + intro t ht hcolor + apply havoid + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, t, ht, ?_, hcolor⟩ + change min (HierarchyFirstMissingPosition phi T eta).val + (H.stage i.castSucc.succ).length = (H.stage i.castSucc.succ).length at hc + rw [hc] + exact t.isLt + +private theorem helper_intervalAvoid_298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H) (alpha : Fin k), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; ( + ∀ (i j : Fin (H.dividerCount + (1 : ℕ))), (↑i : ℕ) ≤ (↑j : ℕ) → TreeSequenceInitialSegment + (HierarchyStarredStage H i) (HierarchyStarredStage H j)) → ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), (0 : ℕ) < (↑j : ℕ) → ( + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑j : ℕ) ≤ (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ alpha } : Finset (Fin k))) → alpha ∈ TreeMissingColors phi + (HierarchyStarredStage H j)) → ( + ∀ (i : Fin H.dividerCount), alpha ∈ TreeMissingColors phi (HierarchyStarredStage H i.succ) → + ¬TreeColorSetClosed G phi (HierarchyStarredStage H i.succ) ({ alpha } : Finset (Fin k)) → + alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma i.castSucc)) → ( + ∀ (i : Fin H.dividerCount), alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma + i.castSucc) → + ∀ (t : Fin (HierarchyStarredStage H i.succ).length), (HierarchyStarredStage H + i.castSucc).length ≤ (↑t : ℕ) → phi ((HierarchyStarredStage H i.succ).edge t) ≠ some + alpha) → + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ( + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑r : ℕ) < (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ alpha } : Finset (Fin k))) → + ∀ (t : Fin A.length), (HierarchyStarredStage H r).length ≤ (↑t : ℕ) → phi (A.edge t) ≠ some + alpha := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good alpha q A starMono missingStage reserved + segmentAvoid r hn + have inductiveAvoid : ∀ d (s : Fin (H.dividerCount + 1)), s.val = r.val + d → + ∀ t : Fin (HierarchyStarredStage H s).length, + (HierarchyStarredStage H r).length ≤ t.val → + phi ((HierarchyStarredStage H s).edge t) ≠ some alpha := by + intro d + induction d with + | zero => + intro s hs t ht + have : s = r := Fin.ext (by omega) + subst s + have := t.isLt + omega + | succ d ih => + intro s hs t ht + let i : Fin H.dividerCount := ⟨s.val - 1, by omega⟩ + have his : i.succ = s := Fin.ext (by dsimp [i]; omega) + have hprev : i.castSucc.val = r.val + d := by dsimp [i]; omega + by_cases htp : t.val < (HierarchyStarredStage H i.castSucc).length + · let u : Fin (HierarchyStarredStage H i.castSucc).length := ⟨t.val, htp⟩ + have hab := starMono i.castSucc s (by dsimp [i]; omega) + have he : (HierarchyStarredStage H s).edge t = + (HierarchyStarredStage H i.castSucc).edge u := by + have he := hab.2.2 u + have hi : Fin.castLE hab.1 u = t := Fin.ext rfl + simpa [hi] using he + rw [he] + exact ih i.castSucc hprev u ht + · have hn' := hn i.succ (by rw [his]; omega) + have hm := missingStage i.succ (by simp) + (fun z hz => hn z (by rw [his] at hz; omega)) + have ha := segmentAvoid i (reserved i hm hn') + rw [his] at ha + exact ha t (by omega) + exact inductiveAvoid (H.dividerCount - r.val) q (by simp [q]; omega) + +private theorem helper_unions_343.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H) (alpha : Fin k), ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), (0 : ℕ) < (↑j : ℕ) → ( + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑j : ℕ) ≤ (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ alpha } : Finset (Fin k))) → alpha ∈ TreeMissingColors phi + (HierarchyStarredStage H j)) → ( + ∀ (i : Fin H.dividerCount), alpha ∈ TreeMissingColors phi (HierarchyStarredStage H i.succ) → + ¬TreeColorSetClosed G phi (HierarchyStarredStage H i.succ) ({ alpha } : Finset (Fin k)) → + alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma i.castSucc)) → ( + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), ¬TreeColorSetClosed G phi (HierarchyStarredStage H i) + ({ alpha } : Finset (Fin k))) → + ∀ (i : Fin H.dividerCount), alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma + i.castSucc) ∧ alpha ∈ (HierarchyStoredColorsAt H i.castSucc).biUnion (good.gamma + i.castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good alpha missingStage reserved hn i + have hr := reserved i (missingStage i.succ (by simp) (fun s _ => hn s)) (hn i.succ) + refine ⟨hr, ?_⟩ + obtain ⟨eta, heta, hg⟩ := Finset.mem_biUnion.mp hr + exact Finset.mem_biUnion.mpr ⟨eta, HierarchyStoredColorsAntitone H i heta, hg⟩ + +private theorem helper_closedSingleton_356.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (alpha : Fin k) (B : TreeSequence G e0), + ColoredVertexSetClosed G phi (TreeSequenceVertexSet B) → alpha ∈ TreeMissingColors phi B → + TreeColorSetClosed G phi B ({ alpha } : Finset (Fin k)) := by + classical + intro V E _ _ G k e0 phi alpha B hc hm c hcs + have : c = alpha := Finset.mem_singleton.mp hcs + subst c + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hm + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨hb, hcol⟩ := Finset.mem_filter.mp hf + exact hc hb hv hcol hvm + +private theorem helper_stableClosed_368.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (B : TreeSequence G e0) (C : Finset (Fin k)) (psi pi : PartialEdgeColoring E k), + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → StableColoring B C psi pi → ColoredVertexSetClosed G psi + (TreeSequenceVertexSet B) → ColoredVertexSetClosed G pi (TreeSequenceVertexSet B) := by + classical + intro V E _ _ G k e0 B C psi pi hpsi hpsiOne hpi hpiOne hs hc + have hr : StableColoring B C pi psi := + (sc2 G e0 B C).symm + (x := ⟨psi, hpsi, hpsiOne⟩) (y := ⟨pi, hpi, hpiOne⟩) hs + intro f c v hb hv hcol hvm + have hf : TreeIncidentEdge B f := by + have hb' : ∃ u ∈ TreeSequenceVertexSet B, ∃ w ∉ TreeSequenceVertexSet B, + G.ends f = Sym2.mk u w := by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] using hb + obtain ⟨u, hu, w, hw, he⟩ := hb' + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [he] + simp + have hm : c ∈ TreeMissingColors pi B := Finset.mem_biUnion.mpr ⟨v, hv, hvm⟩ + have hsame := hr.1 f hf ⟨c, Finset.mem_union_left _ hm, hcol⟩ + have hvm' : c ∈ MissingColors G psi v := by rw [hr.2 v hv]; exact hvm + exact hc hb hv (hsame.trans hcol) hvm' + +private theorem helper_terminalPE_393.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (alpha : Fin + k), + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; ( + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), ¬TreeColorSetClosed G phi (HierarchyStarredStage H i) + ({ alpha } : Finset (Fin k))) → alpha ∈ TreeMissingColors phi Tn → ( + ∀ (B : TreeSequence G e0), ColoredVertexSetClosed G phi (TreeSequenceVertexSet B) → alpha ∈ + TreeMissingColors phi B → TreeColorSetClosed G phi B ({ alpha } : Finset (Fin k))) → ( + ∀ (B : TreeSequence G e0) (C : Finset (Fin k)) (psi pi : PartialEdgeColoring E k), + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → StableColoring B C psi pi → ColoredVertexSetClosed G psi + (TreeSequenceVertexSet B) → ColoredVertexSetClosed G pi (TreeSequenceVertexSet B)) → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H alpha Tn hn missingTn closedSingleton stableClosed + let p : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have hp : p.succ = Fin.last ett.rounds := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_last] + dsimp [p] + have := ett.roundsPositive + omega + have hphi : phi = ett.series.data.coloring p.succ := by + rw [hp] + exact ett.generatingColoring + have hTn : Tn = ett.series.data.tree p.succ.castSucc := by rw [hp] + generalize heq : p.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero p heq).elim + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hci : ci = p := Fin.ext (by have := congrArg Fin.val heq; simp at this; omega) + subst ci + rw [← hp] + exact currentKind + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have hci : ci = p := Fin.ext (by have := congrArg Fin.val heq; simp at this; omega) + subst ci + have hnot : ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE := by rw [← hp, currentKind]; simp + apply False.elim + apply hn 0 + change TreeColorSetClosed G phi base.core {alpha} + rw [base.nonparallel hnot] + apply closedSingleton Tn + · rw [hphi, currentColoring, hTn] + exact previousClosed + · exact missingTn + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative currentColoring + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension strictExtension => + have hci : ci = p := Fin.ext (by have := congrArg Fin.val heq; simp at this; omega) + subst ci + have hnot : ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE := by rw [← hp, currentKind]; simp + apply False.elim + apply hn 0 + change TreeColorSetClosed G phi base.core {alpha} + rw [base.nonparallel hnot] + apply closedSingleton Tn + · rw [hphi, currentColoring, hTn] + exact stableClosed _ _ _ _ previousProper previousOneUncolored + choice.selectedProper choice.selectedOneUncolored choice.selectedStable previousClosed + · exact missingTn + +private theorem helper_witness_459.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (alpha : Fin k), + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + TreeSequenceInitialSegment Tn T → alpha ∈ TreeMissingColors phi Tn → + let a : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let va : V := T.vertex a; va ∈ TreeSequenceVertexSet Tn ∧ alpha ∈ MissingColors G phi va := by + classical + intro V E _ _ _ G k e0 input T phi ett alpha Tn TnT missingTn a va + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp missingTn + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let iT := Fin.castLE (Nat.succ_le_succ TnT.1) i + have hmi : alpha ∈ MissingColors G phi (T.vertex iT) := by + rw [TnT.2.1 i, hi] + exact hvm + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + alpha ∈ MissingColors G phi (T.vertex j) + have hiC : iT ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hmi⟩ + have hC : candidates.Nonempty := ⟨iT, hiC⟩ + have ha : a = candidates.min' hC := by + dsimp [a, HierarchyFirstMissingPosition] + rw [dite_eq_left hC] + have hma : alpha ∈ MissingColors G phi va := by + have hmA : a ∈ candidates := ha.symm ▸ Finset.min'_mem candidates hC + exact (Finset.mem_filter.mp hmA).2 + have hai : a.val ≤ i.val := by + rw [ha] + exact Finset.min'_le candidates iT hiC + let aN : Fin (Tn.length + 1) := ⟨a.val, by have := i.isLt; omega⟩ + have hcast : Fin.castLE (Nat.succ_le_succ TnT.1) aN = a := Fin.ext rfl + refine ⟨?_, hma⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨aN, ?_⟩ + exact (TnT.2.1 aN).symm.trans (congrArg T.vertex hcast) + +private theorem helper_noMissingClosure_505.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (alpha : Fin + k), + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H j))) → + let a : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let va : V := T.vertex a; va ∈ TreeSequenceVertexSet Tn ∧ alpha ∈ MissingColors G phi va → va + ∉ TreeSequenceVertexSet base.closure → TreeSequenceVertexSet base.closure ⊆ + TreeSequenceVertexSet base.core → va ∈ TreeSequenceVertexSet base.core → alpha ∉ + TreeMissingColors phi base.closure := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H alpha Tn elementaryStar a va witness outside + closureCore vaCore hm + obtain ⟨w, hw, hwm⟩ := Finset.mem_biUnion.mp hm + have hne : va ≠ w := by intro he; exact outside (he.symm ▸ hw) + exact Finset.disjoint_left.mp + (elementaryStar 0 vaCore (closureCore hw) hne) witness.2 hwm + +private theorem helper_branch_575.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (alpha : Fin + k), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + let _ : TreeSequence G e0 := HierarchyStarredStage H q; ( + ∀ (i j : Fin (H.dividerCount + (1 : ℕ))), (↑i : ℕ) ≤ (↑j : ℕ) → TreeSequenceInitialSegment + (HierarchyStarredStage H i) (HierarchyStarredStage H j)) → ( + ∀ (t : Fin base.core.length), Tn.length ≤ (↑t : ℕ) → phi (base.core.edge t) ≠ some alpha) → + ∀ (t : Fin (HierarchyStarredStage H (Fin.last H.dividerCount)).length), (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length ≤ (↑t : ℕ) → phi ((HierarchyStarredStage H + (Fin.last H.dividerCount)).edge t) = some alpha → ¬base.core.length ≤ (↑t : ℕ) → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H alpha q Tn A starMono coreAvoid t ht hc htc + let u : Fin base.core.length := ⟨t.val, by omega⟩ + have hab := starMono 0 q (by simp) + change TreeSequenceInitialSegment base.core A at hab + have he := hab.2.2 u + have hi : Fin.castLE hab.1 u = t := Fin.ext rfl + have he' : A.edge t = base.core.edge u := by simpa [hi] using he + exact coreAvoid u ht (he' ▸ hc) + +private theorem helper_closureEdges_852.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base) (alpha : Fin + k), + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ∀ (_ : + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) (_ : alpha ∉ + TreeMissingColors phi base.closure) (_ : TashkinovClosure phi (TreeSequencePrefix + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt)) base.closure), + let P : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (t : Fin base.closure.length), phi (base.closure.edge t) = some alpha → base.closure.edge t + ∈ TreeSequenceEdgeSet P := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H alpha Tn segmentTrans noMissingClosure hclosure P + have seq : TashkinovAugmentationSequence phi P base.closure := hclosure.1 + have aux : ∀ {B : TreeSequence G e0}, TashkinovAugmentationSequence phi P B → + TreeSequenceInitialSegment B base.closure → + ∀ t : Fin B.length, phi (B.edge t) = some alpha → B.edge t ∈ TreeSequenceEdgeSet P := by + intro B hs + induction hs with + | refl => + intro _ t _ + simp only [TreeSequenceEdgeSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨t, rfl⟩ + | @tail Y Z hPY hstep ih => + intro hZ t hc + obtain ⟨hlen, hYZ, c, hcLast, hcm⟩ := hstep + have hY := segmentTrans hYZ hZ + by_cases ht : t.val < Y.length + · let u : Fin Y.length := ⟨t.val, ht⟩ + have hi : Fin.castLE hYZ.1 u = t := Fin.ext rfl + have he : Z.edge t = Y.edge u := by simpa [hi] using hYZ.2.2 u + have hp := ih hY u (he ▸ hc) + simpa only [he] using hp + · have htLast : t = Fin.cast hlen.symm (Fin.last Y.length) := by + apply Fin.ext + have := t.isLt + simp only [Fin.val_cast, Fin.val_last] + omega + have hca : c = alpha := Option.some.inj + (hcLast.symm.trans (by simpa only [htLast] using hc)) + subst c + apply False.elim + apply noMissingClosure + obtain ⟨w, hw, hwm⟩ := Finset.mem_biUnion.mp hcm + exact Finset.mem_biUnion.mpr + ⟨w, TreeSequenceInitialSegmentVertexSetSubset hY hw, hwm⟩ + exact aux seq ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + +private theorem helper_continuation_896.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H) (_ : (0 : ℕ) < H.dividerCount) (_ : + let i : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.ExtendedTashkinovTree.roundsPositive ett + + all_goals omega) + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet + Tn)) (alpha : Fin k), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + let _ : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) (_ : + ∀ (i j : Fin (H.dividerCount + (1 : ℕ))) (_ : (↑i : ℕ) ≤ (↑j : ℕ)), TreeSequenceInitialSegment + (HierarchyStarredStage H i) (HierarchyStarredStage H j)) (_ : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H j))) (_ : TreeSequenceInitialSegment Tn + base.core) (_ : TreeSequenceInitialSegment Tn T) (_ : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))) (_ : (0 : ℕ) < (↑j : ℕ)) (_ : + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑j : ℕ) ≤ (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ alpha } : Finset (Fin k))), alpha ∈ TreeMissingColors phi + (HierarchyStarredStage H j)) (_ : + ∀ (i : Fin H.dividerCount) (_ : alpha ∈ TreeMissingColors phi (HierarchyStarredStage H + i.succ)) (_ : ¬TreeColorSetClosed G phi (HierarchyStarredStage H i.succ) ({ alpha } : + Finset (Fin k))), alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma + i.castSucc)) (_ : + ∀ (i : Fin H.dividerCount) (_ : alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma + i.castSucc)) (t : Fin (HierarchyStarredStage H i.succ).length), (HierarchyStarredStage H + i.castSucc).length ≤ (↑t : ℕ) → phi ((HierarchyStarredStage H i.succ).edge t) ≠ some + alpha), (( + ∃ (i : Fin (H.dividerCount + (1 : ℕ))), TreeColorSetClosed G phi (HierarchyStarredStage H i) + ({ alpha } : Finset (Fin k))) → + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeColorSetClosed G phi (HierarchyStarredStage H r) + ({ alpha } : Finset (Fin k)) → ( + ∀ (s : Fin (H.dividerCount + (1 : ℕ))), (↑r : ℕ) < (↑s : ℕ) → ¬TreeColorSetClosed G phi + (HierarchyStarredStage H s) ({ alpha } : Finset (Fin k))) → alpha ∉ ({c : Fin k | + ∃ (t : Fin (HierarchyStarredStage H (Fin.last H.dividerCount)).length), (HierarchyStarredStage + H r).length ≤ (↑t : ℕ) ∧ phi ((HierarchyStarredStage H (Fin.last H.dividerCount)).edge t) + = some c} : Finset (Fin k))) ∧ (( + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), ¬TreeColorSetClosed G phi (HierarchyStarredStage H i) + ({ alpha } : Finset (Fin k))) → ( + ∀ (j : Fin H.dividerCount), alpha ∈ (HierarchyStoredColorsAt H j.succ).biUnion (good.gamma + j.castSucc) ∧ alpha ∈ (HierarchyStoredColorsAt H j.castSucc).biUnion (good.gamma + j.castSucc)) ∧ ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE + ∧ T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) \ TreeSequenceVertexSet base.closure + ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin (HierarchyStarredStage H (Fin.last H.dividerCount)).length), (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length ≤ (↑t : ℕ) ∧ phi ((HierarchyStarredStage H + (Fin.last H.dividerCount)).edge t) = some c} : Finset (Fin k))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good hq hpreStepElementary alpha q Tn A + segmentTrans starMono elementaryStar coreSegment TnT missingStage reserved segmentAvoid + have intervalAvoid (r : Fin (H.dividerCount + 1)) + (hn : ∀ s : Fin (H.dividerCount + 1), r.val < s.val → + ¬ TreeColorSetClosed G phi (HierarchyStarredStage H s) {alpha}) : + ∀ t : Fin A.length, (HierarchyStarredStage H r).length ≤ t.val → + phi (A.edge t) ≠ some alpha := by + apply helper_intervalAvoid_298 <;> assumption + constructor + · intro _ r _ hn hmem + obtain ⟨t, ht, hc⟩ := (Finset.mem_filter.mp hmem).2 + exact intervalAvoid r hn t ht hc + · intro hn + have unions : ∀ i : Fin H.dividerCount, + alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma i.castSucc) ∧ + alpha ∈ (HierarchyStoredColorsAt H i.castSucc).biUnion (good.gamma i.castSucc) := by + apply helper_unions_343 <;> assumption + let zero : Fin H.dividerCount := ⟨0, hq⟩ + obtain ⟨eta, heta, hg⟩ := Finset.mem_biUnion.mp (unions zero).2 + have missingTn : alpha ∈ TreeMissingColors phi Tn := by + have hm := (Finset.mem_sdiff.mp (good.avoidance zero.castSucc eta heta hg)).1 + simpa [HierarchyStageMissingColors, zero, Tn] using hm + have closedSingleton (B : TreeSequence G e0) + (hc : ColoredVertexSetClosed G phi (TreeSequenceVertexSet B)) + (hm : alpha ∈ TreeMissingColors phi B) : TreeColorSetClosed G phi B {alpha} := by + apply helper_closedSingleton_356 <;> assumption + have stableClosed := @helper_stableClosed_368 (@V) (@E) inferInstance inferInstance (@G) (@k) + (@e0) + have terminalPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := by + apply helper_terminalPE_393 <;> assumption + -- The least missing position is an actual witness in the ladder tree. + let a := HierarchyFirstMissingPosition phi T alpha + let va := T.vertex a + have witness : va ∈ TreeSequenceVertexSet Tn ∧ alpha ∈ MissingColors G phi va := by + apply helper_witness_459 <;> assumption + have outside : va ∉ TreeSequenceVertexSet base.closure := by + intro hv + have commonClosed := ParallelCommonMissingClosed G k e0 input T phi phi ett + (by have := ett.roundsPositive; omega) base ett.generatingColoring terminalPE + hpreStepElementary + have hmR : alpha ∈ TreeMissingColors phi base.closure := + Finset.mem_biUnion.mpr ⟨va, hv, witness.2⟩ + apply hn 0 + intro c hc + have : c = alpha := Finset.mem_singleton.mp hc + subst c + exact commonClosed alpha (Finset.mem_inter.mpr ⟨missingTn, hmR⟩) + obtain ⟨union⟩ := (base.parallel terminalPE).2.2 + have closureCore : TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet base.core := by + rw [union.vertexSet] + exact Finset.subset_union_right + have vaCore : va ∈ TreeSequenceVertexSet base.core := + TreeSequenceInitialSegmentVertexSetSubset coreSegment witness.1 + have noMissingClosure : alpha ∉ TreeMissingColors phi base.closure := by + apply helper_noMissingClosure_505 <;> assumption + have hclosure := (base.parallel terminalPE).2.1 + let P := TreeSequencePrefix Tn base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt) + have prefixTn : TreeSequenceInitialSegment P Tn := + ⟨Nat.le_of_lt_succ base.supportPosition.isLt, (fun _ => rfl), (fun _ => rfl)⟩ + -- Every added closure edge has a missing-color witness in the closure. + have closureEdges : ∀ t : Fin base.closure.length, + phi (base.closure.edge t) = some alpha → + base.closure.edge t ∈ TreeSequenceEdgeSet P := by + apply helper_closureEdges_852 <;> assumption + have coreAvoid : ∀ t : Fin base.core.length, Tn.length ≤ t.val → + phi (base.core.edge t) ≠ some alpha := by + intro t ht hc + obtain ⟨i, hi, _⟩ := union.newEntryFromRight t ht + have hp := closureEdges i (hi ▸ hc) + simp only [TreeSequenceEdgeSet, Finset.mem_image, Finset.mem_univ, true_and] at hp + obtain ⟨j, hj⟩ := hp + have hjn := prefixTn.2.2 j + have hnc := union.leftSegment.2.2 (Fin.castLE prefixTn.1 j) + have he : base.core.edge (Fin.castLE union.leftSegment.1 (Fin.castLE prefixTn.1 j)) = + base.core.edge t := hnc.trans (hjn.trans (hj.trans hi.symm)) + have hv := congrArg Fin.val (base.core.edge_injective he) + have := j.isLt + have := prefixTn.1 + dsimp only [Fin.castLE] at hv + omega + refine ⟨unions, terminalPE, Finset.mem_sdiff.mpr ⟨witness.1, outside⟩, ?_⟩ + intro hm + obtain ⟨t, ht, hc⟩ := (Finset.mem_filter.mp hm).2 + by_cases htc : base.core.length ≤ t.val + · exact intervalAvoid 0 (fun s _ => hn s) t htc hc + · exact @helper_branch_575 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@alpha) (@starMono) + (@coreAvoid) (@t) (@ht) (@hc) (@htc) + +theorem rutcor {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) + (good : GoodHierarchy H) + (hq : 0 < H.dividerCount) + (hprefixElementary : + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hpreStepElementary : + let i : Fin ett.rounds := ⟨ett.rounds - 1, by + have hp := ett.roundsPositive + omega⟩ + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn)) + (alpha : Fin k) + (halpha : alpha ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) : + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + let Tnq := HierarchyStarredStage H q + ((∃ i : Fin (H.dividerCount + 1), + TreeColorSetClosed G phi (HierarchyStarredStage H i) {alpha}) → + ∀ r : Fin (H.dividerCount + 1), + TreeColorSetClosed G phi (HierarchyStarredStage H r) {alpha} → + (∀ s : Fin (H.dividerCount + 1), r.val < s.val → + ¬ TreeColorSetClosed G phi (HierarchyStarredStage H s) {alpha}) → + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin Tnq.length, + (HierarchyStarredStage H r).length ≤ t.val ∧ + phi (Tnq.edge t) = some c)) ∧ + ((∀ i : Fin (H.dividerCount + 1), + ¬ TreeColorSetClosed G phi (HierarchyStarredStage H i) {alpha}) → + (∀ j : Fin H.dividerCount, + alpha ∈ (HierarchyStoredColorsAt H j.succ).biUnion + (good.gamma j.castSucc) ∧ + alpha ∈ (HierarchyStoredColorsAt H j.castSucc).biUnion + (good.gamma j.castSucc)) ∧ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ + T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ + TreeSequenceVertexSet Tn \ TreeSequenceVertexSet base.closure ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin Tnq.length, + Tn.length ≤ t.val ∧ phi (Tnq.edge t) = some c)) := by + classical + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + let A := HierarchyStarredStage H q + change ((_ → _) ∧ (_ → _)) + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : TreeSequenceInitialSegment X Z := by + apply helper_segmentTrans_101 <;> assumption + have stageSegment : ∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + 1), + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + apply helper_stageSegment_112; assumption + have stageMono (a b : Fin (H.dividerCount + 2)) (hab : a.val ≤ b.val) : + TreeSequenceInitialSegment (H.stage a) (H.stage b) := by + clear * - stageSegment hab + have hh := stageSegment a.val (b.val - a.val) (by omega) + convert hh using 1; congr 1; apply Fin.ext; simp; omega + have starPositive (j : Fin (H.dividerCount + 1)) (hj : 0 < j.val) : + HierarchyStarredStage H j = H.stage j.castSucc := by + apply helper_starPositive_127; assumption + have coreStage (j : Fin (H.dividerCount + 2)) (hj : 0 < j.val) : + TreeSequenceInitialSegment base.core (H.stage j) := + segmentTrans H.coreInsideFirst (stageMono ⟨1, by omega⟩ j (by change 1 ≤ j.val; omega)) + have starMono (i j : Fin (H.dividerCount + 1)) (hij : i.val ≤ j.val) : + TreeSequenceInitialSegment (HierarchyStarredStage H i) + (HierarchyStarredStage H j) := by + apply helper_starMono_140 <;> assumption + have hA : A = H.stage q.castSucc := starPositive q hq + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + have hAT : TreeSequenceInitialSegment A T := by + rw [hA] + have hh := H.nested q + rw [hlast, H.terminalStage] at hh + exact hh + have hAlen : A.length < T.length := by + rw [hA] + have hh := H.strict q + rw [hlast, H.terminalStage] at hh + exact hh + let Ty := TreeSequencePrefix T + (min (A.length + (T.length - A.length - 1)) T.length) + (by have := A.positive; have := T.positive; omega) (Nat.min_le_right _ _) + have hATy : TreeSequenceInitialSegment A Ty := by + apply helper_hATy_179 <;> assumption + have elementaryA : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by + intro u hu v hv huv + exact hprefixElementary (TreeSequenceInitialSegmentVertexSetSubset hATy hu) + (TreeSequenceInitialSegmentVertexSetSubset hATy hv) huv + have elementaryStar (j : Fin (H.dividerCount + 1)) : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet (HierarchyStarredStage H j)) := by + intro u hu v hv huv + have hs := starMono j q (by simp [q]; omega) + exact elementaryA (TreeSequenceInitialSegmentVertexSetSubset hs hu) + (TreeSequenceInitialSegmentVertexSetSubset hs hv) huv + have coreSegment : TreeSequenceInitialSegment Tn base.core := by + apply helper_coreSegment_197 + have TnT : TreeSequenceInitialSegment Tn T := + segmentTrans coreSegment (segmentTrans (starMono 0 q (by simp)) hAT) + -- A newly missing color would close the next stage, so missingness descends. + have descend : ∀ d (j : Fin (H.dividerCount + 1)), + H.dividerCount ≤ j.val + d → 0 < j.val → + (∀ s : Fin (H.dividerCount + 1), j.val ≤ s.val → + ¬ TreeColorSetClosed G phi (HierarchyStarredStage H s) {alpha}) → + alpha ∈ TreeMissingColors phi (HierarchyStarredStage H j) := by + apply helper_descend_206 <;> assumption + have missingStage (j : Fin (H.dividerCount + 1)) (hj : 0 < j.val) + (hn : ∀ s : Fin (H.dividerCount + 1), j.val ≤ s.val → + ¬ TreeColorSetClosed G phi (HierarchyStarredStage H s) {alpha}) : + alpha ∈ TreeMissingColors phi (HierarchyStarredStage H j) := + descend H.dividerCount j (by omega) hj hn + have reserved (i : Fin H.dividerCount) + (hm : alpha ∈ TreeMissingColors phi (HierarchyStarredStage H i.succ)) + (hn : ¬ TreeColorSetClosed G phi (HierarchyStarredStage H i.succ) {alpha}) : + alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma i.castSucc) := by + apply helper_reserved_251 <;> assumption + have cutoff (B : TreeSequence G e0) (hBT : TreeSequenceInitialSegment B T) + (eta : Fin k) (hm : eta ∉ TreeMissingColors phi B) : + min (HierarchyFirstMissingPosition phi T eta).val B.length = B.length := by + apply helper_cutoff_262 <;> assumption + have segmentAvoid (i : Fin H.dividerCount) + (hr : alpha ∈ (HierarchyStoredColorsAt H i.succ).biUnion (good.gamma i.castSucc)) : + ∀ t : Fin (HierarchyStarredStage H i.succ).length, + (HierarchyStarredStage H i.castSucc).length ≤ t.val → + phi ((HierarchyStarredStage H i.succ).edge t) ≠ some alpha := by + apply helper_segmentAvoid_277 <;> assumption + exact @helper_continuation_896 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@good) (@hq) + (@hpreStepElementary) (@alpha) (@segmentTrans) (@starMono) (@elementaryStar) (@coreSegment) + (@TnT) (@missingStage) (@reserved) (@segmentAvoid) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyOutsideKempeStable.lean b/LeanPool/GoldbergSeymour/HierarchyOutsideKempeStable.lean new file mode 100644 index 0000000000..361cd61640 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyOutsideKempeStable.lean @@ -0,0 +1,147 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CombinedStableColoring + +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable + +public import LeanPool.GoldbergSeymour.TashkinovHierarchy + +/-! +# Hierarchy Outside Kempe Stable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchyOutsideKempeStable {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (alpha beta : Fin k) + (hrecolor : OutsideKempeRecoloring T phi sigma alpha beta) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ + StableColoring T Dn phi sigma ∧ TreeColoringInvariant T phi sigma ∧ + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi sigma) := by + classical + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + dsimp [n, Tn, Dn] + have stable := OutsideKempeRecoloringStable G e0 T + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma alpha beta hproper hone hrecolor + refine ⟨stable.1, stable.2.1, stable.2.2.1, stable.2.2.2.1, ?_⟩ + intro hkind + unfold CombinedStableColoring + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨le_trans hab hbc, ?_, ?_⟩ + · intro i + have hmid := hvbc (Fin.castLE (Nat.succ_le_succ hab) i) + simpa using hmid.trans (hvab i) + · intro i + have hmid := hebc (Fin.castLE hab i) + simpa using hmid.trans (heab i) + have chain : ∀ q : ℕ, (hq : q ≤ H.dividerCount) → + TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) + (H.stage ⟨1 + q, by omega⟩) := by + intro q + induction q with + | zero => + intro hq + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + | succ q ih => + intro hq + have hprev := ih (by omega) + have hnext := H.nested ⟨1 + q, by omega⟩ + have hnext' : TreeSequenceInitialSegment + (H.stage ⟨1 + q, by omega⟩) + (H.stage ⟨1 + (q + 1), by omega⟩) := by + simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using hnext + exact segmentTrans hprev hnext' + have stageToT : TreeSequenceInitialSegment + (H.stage ⟨1, by omega⟩) T := by + have hc := chain H.dividerCount le_rfl + have hi : (⟨1 + H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [Nat.add_comm] + rw [hi] at hc + simpa [H.terminalStage] using hc + have coreToT : TreeSequenceInitialSegment base.core T := by + exact segmentTrans H.coreInsideFirst stageToT + rcases base.parallel hkind with ⟨chosen, closed, unionExists⟩ + obtain ⟨unionCert⟩ := unionExists + have unionToT : TreeSequenceInitialSegment base.core T := coreToT + have vertexCore : TreeSequenceVertexSet base.core ⊆ TreeSequenceVertexSet T := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + rcases hv with ⟨i, hiuniv, hi⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ unionToT.1) i, by simp, + (unionToT.2.1 i).trans hi⟩ + have unionVertex : TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∪ + TreeSequenceVertexSet base.closure = TreeSequenceVertexSet base.core := by + exact unionCert.vertexSet.symm + have treeSubset : TreeSequenceVertexSet Tn ⊆ TreeSequenceVertexSet T := by + intro v hv + have hvc : v ∈ TreeSequenceVertexSet base.core := by + rw [← unionVertex] + exact (Finset.mem_union_left _ hv) + exact vertexCore hvc + have closureSubset : TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet T := by + intro v hv + have hvc : v ∈ TreeSequenceVertexSet base.core := by + rw [← unionVertex] + exact (Finset.mem_union_right _ hv) + exact vertexCore hvc + have fixedTree : ∀ f, TreeIncidentEdge Tn f → sigma f = phi f := by + intro f hf + rcases hf with ⟨v, hv, hinc⟩ + apply stable.2.2.2.2 f + exact ⟨v, treeSubset hv, hinc⟩ + have fixedClosure : ∀ f, TreeIncidentEdge base.closure f → sigma f = phi f := by + intro f hf + rcases hf with ⟨v, hv, hinc⟩ + apply stable.2.2.2.2 f + exact ⟨v, closureSubset hv, hinc⟩ + constructor + · unfold StableColoring + constructor + · intro f hf hcol + exact fixedTree f hf + · intro v hv + exact (stable.2.2.1).2 v (treeSubset hv) + · unfold StableColoring + constructor + · intro f hf hcol + exact fixedClosure f hf + · intro v hv + exact (stable.2.2.1).2 v (closureSubset hv) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyPathNumber.lean b/LeanPool/GoldbergSeymour/HierarchyPathNumber.lean new file mode 100644 index 0000000000..003ea7f9e2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyPathNumber.lean @@ -0,0 +1,43 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Order.Interval.Finset.Nat +public import LeanPool.GoldbergSeymour.HierarchyStarredStage + +/-! +# Hierarchy Path Number + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- The first position after the starred stage at which the remaining tail is a path, defaulting to +the tail length. +-/ +noncomputable def HierarchyPathNumber {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} {base : HierarchyBase ett phi} + (H : TashkinovHierarchy ett base) : ℕ := by + classical + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let tailLength := T.length - A.length + let candidates := (Finset.Icc 1 tailLength).filter fun i => + ∀ r : Fin T.length, A.length + i ≤ r.val → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ) + exact if h : candidates.Nonempty then candidates.min' h else tailLength + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyPrefixData.lean b/LeanPool/GoldbergSeymour/HierarchyPrefixData.lean new file mode 100644 index 0000000000..c6ebcc2bab --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyPrefixData.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyLEMStable + +/-! +# P2752_T2_Prefix Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Corresponding hierarchy and stable-coloring data for the penultimate-prefix reduction. -/ +structure HierarchyPrefixData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T phi} {base : HierarchyBase ett phi} + (C : HierarchyCounterexample base) (Bplus : TreeSequence G e0) + (sigma : PartialEdgeColoring E k) where + belowFull : TreeSequenceInitialSegment Bplus T + penultimateLength : T.length = Bplus.length + 1 + ladderBelow : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Bplus + /-- The extended tree restricted to the original prefix. -/ + oldETT : ExtendedTashkinovTree G k e0 input Bplus phi + oldMaximum : MaximumProperty oldETT + oldRung : oldETT.rounds = ett.rounds + oldSeries : HEq oldETT.series ett.series + /-- The hierarchy base for the original prefix. -/ + oldBase : HierarchyBase oldETT phi + oldCore : oldBase.core = base.core + oldClosure : oldBase.closure = base.closure + oldSupport : oldBase.supportPosition.val = base.supportPosition.val + /-- The original prefix hierarchy. -/ + oldHierarchy : TashkinovHierarchy oldETT oldBase + oldCount : oldHierarchy.dividerCount = C.hierarchy.dividerCount + oldStages : + ∀ j : Fin (oldHierarchy.dividerCount + 1), + let jo := Fin.cast (congrArg (fun n : ℕ => n + 1) oldCount) j + oldHierarchy.stage j.castSucc = C.hierarchy.stage jo.castSucc ∧ + HierarchyStarredStage oldHierarchy j = HierarchyStarredStage C.hierarchy jo + oldDividers : + ∀ i : Fin oldHierarchy.dividerCount, + (oldHierarchy.dividerPosition i).val = (C.hierarchy.dividerPosition (Fin.cast oldCount i)).val + /-- The good-hierarchy witnesses for the original prefix. -/ + oldGood : GoodHierarchy oldHierarchy + oldColors : + ∀ j : Fin (oldHierarchy.dividerCount + 1), + let jo := Fin.cast (congrArg (fun n : ℕ => n + 1) oldCount) j + HierarchyStoredColorsAt oldHierarchy j = HierarchyStoredColorsAt C.hierarchy jo ∧ + HierarchyStageMissingColors oldHierarchy j = HierarchyStageMissingColors C.hierarchy jo ∧ + ∀ eta : Fin k, + oldGood.gamma j eta = C.good.gamma jo eta ∧ + HierarchySegmentColors oldHierarchy j eta ⊆ HierarchySegmentColors C.hierarchy jo eta + proper : IsProperEdgeColoring G sigma + oneUncolored : IsOneEdgeUncolored sigma e0 + invariant : TreeColoringInvariant Bplus phi sigma + incidentFixed : ∀ f : E, TreeIncidentEdge Bplus f → sigma f = phi f + /-- The replacement extended tree with its ladder and coloring agreement certificates. -/ + corresponding : CorrespondingExtendedTashkinovTree G k e0 oldETT sigma Bplus + maximum : MaximumProperty corresponding.replacementETT + /-- The hierarchy base after replacement. -/ + newBase : HierarchyBase corresponding.replacementETT sigma + /-- The hierarchy after replacement. -/ + newHierarchy : TashkinovHierarchy corresponding.replacementETT newBase + /-- The good-hierarchy witnesses after replacement. -/ + newGood : GoodHierarchy newHierarchy + sameGood : SameGoodHierarchy oldGood newGood + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyReplacementPresentation.lean b/LeanPool/GoldbergSeymour/HierarchyReplacementPresentation.lean new file mode 100644 index 0000000000..c706c7f321 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyReplacementPresentation.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext + +public import LeanPool.GoldbergSeymour.SameGoodHierarchy + +/-! +# Hierarchy Replacement Presentation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A stable replacement coloring and corresponding minimum-counterexample hierarchy with the same +good-hierarchy data. +-/ +structure HierarchyReplacementPresentation {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) where + /-- The partial coloring or sequence of partial colorings recorded by this certificate. -/ + coloring : PartialEdgeColoring E k + /-- The replacement extended tree with its ladder and coloring agreement certificates. -/ + corresponding : CorrespondingExtendedTashkinovTree G k e0 ett coloring T + maximum : MaximumProperty corresponding.replacementETT + /-- The hierarchy base for the replacement extended tree. -/ + replacementBase : HierarchyBase corresponding.replacementETT coloring + /-- The replacement hierarchy retaining the non-elementarity condition. -/ + counterexample : HierarchyCounterexample replacementBase + sameGood : SameGoodHierarchy C.good counterexample.good + minimumContext : + HierarchyMinimumCounterexampleContext G k e0 corresponding.replacementInput T coloring + corresponding.replacementETT replacementBase counterexample + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyReplacementPresentationTrans.lean b/LeanPool/GoldbergSeymour/HierarchyReplacementPresentationTrans.lean new file mode 100644 index 0000000000..7eefc5522e --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyReplacementPresentationTrans.lean @@ -0,0 +1,567 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +/-! +# Hierarchy Replacement Presentation Trans + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_sameComposed_97.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (tau compositeInput : PartialEdgeColoring E k) (compositeETT : ExtendedTashkinovTree G k e0 + compositeInput T tau) + (secondSeries : TashkinovSeries G k P.corresponding.replacementETT.rounds e0 compositeInput) + (secondFinal : tau = secondSeries.data.coloring (Fin.last + P.corresponding.replacementETT.rounds)) + (secondLadder : + ∀ (i : Fin P.corresponding.replacementETT.rounds), + secondSeries.data.tree i.succ.castSucc = + P.corresponding.replacementETT.series.data.tree i.succ.castSucc) + (secondStored : + ∀ (i : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ))), + secondSeries.data.stored i = P.corresponding.replacementETT.series.data.stored i) + (secondEdges : + ∀ (i : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ))), + secondSeries.data.connectingEdges i = + P.corresponding.replacementETT.series.data.connectingEdges i) + (secondKinds : + ∀ (i : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ))), + secondSeries.data.kind i = P.corresponding.replacementETT.series.data.kind i) + (secondProper : + ∀ (i : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ))), + IsProperEdgeColoring G (secondSeries.data.coloring i)) + (secondOne : + ∀ (i : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ))), IsOneEdgeUncolored + (secondSeries.data.coloring i) e0) + (secondStable : + ∀ (i : Fin P.corresponding.replacementETT.rounds), + StableColoring (P.corresponding.replacementETT.series.data.tree i.succ.castSucc) + (TashkinovStoredColors P.corresponding.replacementETT.series.data i.succ) + (P.corresponding.replacementETT.series.data.coloring i.succ) + (secondSeries.data.coloring i.succ)) + (secondRung : compositeETT.rounds = P.corresponding.replacementETT.rounds) + (secondPresentation : compositeETT.series ≍ secondSeries) + (baseSecond : + HierarchyBase + { replacementInput := compositeInput, replacementSeries := secondSeries, replacementETT + := compositeETT, + rungAgreement := secondRung, seriesPresentation := secondPresentation, + finalGeneratingColoring := secondFinal, + ladderTreesAgree := secondLadder, storedColorsAgree := secondStored, + connectingEdgesAgree := secondEdges, + extensionKindsAgree := secondKinds, replacementProper := secondProper, + replacementOneUncolored := secondOne, + replacementStable := secondStable : + CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT tau T + }.replacementETT + tau) + (CSecond : HierarchyCounterexample baseSecond), + let alignedETT : ExtendedTashkinovTree G k e0 compositeInput T tau := compositeETT; + let baseAligned : HierarchyBase alignedETT tau := baseSecond; + let Cfinal : HierarchyCounterexample baseAligned := CSecond; + SameGoodHierarchy P.counterexample.good Cfinal.good → SameGoodHierarchy C.good Cfinal.good + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P tau compositeInput compositeETT + secondSeries secondFinal secondLadder secondStored secondEdges secondKinds secondProper + secondOne secondStable secondRung secondPresentation baseSecond CSecond alignedETT + baseAligned Cfinal h12 + have firstData := P.sameGood + unfold SameGoodHierarchy at firstData h12 ⊢ + rcases firstData with ⟨firstStages, firstCount, firstStored⟩ + rcases h12 with ⟨secondStages, secondCount, secondStored⟩ + rcases firstStages with ⟨coreFirst, countFirst, stageFirst, + positionFirst, kindFirst, closureFirst⟩ + rcases secondStages with ⟨coreSecond, countSecond, stageSecond, + positionSecond, kindSecond, closureSecond⟩ + refine ⟨?_, ?_⟩ + · refine ⟨coreFirst.trans coreSecond, firstCount.trans secondCount, + HEq.trans stageFirst stageSecond, HEq.trans positionFirst positionSecond, + ?_, ?_⟩ + · constructor + · intro h + exact kindSecond.mp (kindFirst.mp h) + · intro h + exact kindFirst.mpr (kindSecond.mpr h) + · intro h + exact closureFirst h |>.trans (closureSecond (kindFirst.mp h)) + · refine ⟨firstCount.trans secondCount, ?_⟩ + have castChain : ∀ (j : Fin (C.hierarchy.dividerCount + 1)), + Fin.cast (congrArg (fun q => q + 1) secondCount) + (Fin.cast (congrArg (fun q => q + 1) firstCount) j) = + Fin.cast (congrArg (fun q => q + 1) (firstCount.trans secondCount)) j := by + intro j + exact Fin.cast_cast _ _ + intro j + have firstAt := firstStored j + have secondAt := secondStored + (Fin.cast (congrArg (fun q => q + 1) firstCount) j) + rw [← castChain j] + refine ⟨firstAt.1.trans secondAt.1, ?_⟩ + intro eta heta + have hmid : eta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.cast (congrArg (fun q => q + 1) firstCount) j) := by + exact firstAt.1 ▸ heta + have gammaLink := (firstAt.2 eta heta).trans (secondAt.2 eta hmid) + exact gammaLink + +private theorem helper_branch_304.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (tau compositeInput : PartialEdgeColoring E k) (compositeSeries : TashkinovSeries G k + ett.rounds e0 compositeInput) + (compositeETT : ExtendedTashkinovTree G k e0 compositeInput T tau) (compositeRung : + compositeETT.rounds = ett.rounds) + (compositePresentation : compositeETT.series ≍ compositeSeries) + (compositeFinal : tau = compositeSeries.data.coloring (Fin.last ett.rounds)) + (compositeLadder : + ∀ (i : Fin ett.rounds), compositeSeries.data.tree i.succ.castSucc = ett.series.data.tree + i.succ.castSucc) + (compositeStored : ∀ (i : Fin (ett.rounds + (1 : ℕ))), compositeSeries.data.stored i = + ett.series.data.stored i) + (compositeEdges : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), compositeSeries.data.connectingEdges i = + ett.series.data.connectingEdges i) + (compositeKinds : ∀ (i : Fin (ett.rounds + (1 : ℕ))), compositeSeries.data.kind i = + ett.series.data.kind i) + (compositeProper : ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G + (compositeSeries.data.coloring i)) + (compositeOne : ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored + (compositeSeries.data.coloring i) e0) + (compositeStable : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors + ett.series.data i.succ) + (ett.series.data.coloring i.succ) (compositeSeries.data.coloring i.succ)), + compositeETT.rounds = P.corresponding.replacementETT.rounds → + let composite : CorrespondingExtendedTashkinovTree G k e0 ett tau T := + { replacementInput := compositeInput, replacementSeries := compositeSeries, + replacementETT := compositeETT, + rungAgreement := compositeRung, seriesPresentation := compositePresentation, + finalGeneratingColoring := compositeFinal, ladderTreesAgree := compositeLadder, + storedColorsAgree := compositeStored, connectingEdgesAgree := compositeEdges, + extensionKindsAgree := compositeKinds, replacementProper := compositeProper, + replacementOneUncolored := compositeOne, replacementStable := compositeStable : + CorrespondingExtendedTashkinovTree G k e0 ett tau T }; + let n : Fin (composite.replacementETT.rounds + (1 : ℕ)) := Fin.last + composite.replacementETT.rounds; + let Tn : TreeSequence G e0 := composite.replacementETT.series.data.tree n.castSucc; + (2 : ℕ) * composite.replacementETT.rounds + (11 : ℕ) ≤ (TreeMissingColors tau Tn).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P tau compositeInput compositeSeries + compositeETT compositeRung compositePresentation compositeFinal compositeLadder + compositeStored compositeEdges compositeKinds compositeProper compositeOne compositeStable + secondRung composite + dsimp + classical + let terminalIndex : Fin ett.rounds := + ⟨ett.rounds - 1, by have hp := C.positive; omega⟩ + have terminalSucc : terminalIndex.succ = Fin.last ett.rounds := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_last] + have hp := C.positive + have hi : terminalIndex.val = ett.rounds - 1 := rfl + rw [hi] + omega + have terminalTree : + terminalIndex.castSucc.succ = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_last, Fin.val_castSucc] + have hp := C.positive + have hi : terminalIndex.val = ett.rounds - 1 := rfl + rw [hi] + omega + have stableTerminal := composite.replacementStable terminalIndex + dsimp [composite] at stableTerminal + rw [terminalTree] at stableTerminal + rw [terminalSucc] at stableTerminal + have colorEq : + compositeSeries.data.coloring (Fin.last ett.rounds) = tau := + composite.finalGeneratingColoring.symm + have phiEq : + ett.series.data.coloring (Fin.last ett.rounds) = phi := + ett.generatingColoring.symm + have treeEq : + compositeETT.series.data.tree + (Fin.last compositeETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + have presentation : compositeETT.series = + compositeRung.symm ▸ compositeSeries := by + have typeLink : + TashkinovSeries G k ett.rounds e0 compositeInput = + TashkinovSeries G k compositeETT.rounds e0 compositeInput := + congrArg (fun r => TashkinovSeries G k r e0 compositeInput) + compositeRung.symm + have castProof : HEq compositeSeries + (compositeRung.symm ▸ compositeSeries) := by + simp + exact eq_of_heq (HEq.trans composite.seriesPresentation castProof) + have castTree {a b : Nat} (h : a = b) + (s : TashkinovSeries G k a e0 compositeInput) + (i : Fin (b + 2)) : + (cast (congrArg (fun r => TashkinovSeries G k r e0 compositeInput) h) s).data.tree i = + s.data.tree (Fin.cast (congrArg (fun r => r + 2) h.symm) i) := by + cases h + rfl + rw [presentation] + calc + (compositeRung.symm ▸ compositeSeries).data.tree + (Fin.last compositeETT.rounds).castSucc = + compositeSeries.data.tree + (Fin.cast (congrArg (fun r => r + 2) compositeRung) + (Fin.last compositeETT.rounds).castSucc) := by + have transportEq : + compositeRung.symm ▸ compositeSeries = + cast (congrArg + (fun r => TashkinovSeries G k r e0 compositeInput) + compositeRung.symm) compositeSeries := by + symm + apply cast_eq_iff_heq.mpr + simp + rw [transportEq] + simpa using castTree compositeRung.symm compositeSeries + (Fin.last compositeETT.rounds).castSucc + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + simpa [terminalTree, terminalSucc, composite] using + composite.ladderTreesAgree terminalIndex + have missingEq : + TreeMissingColors tau + (compositeETT.series.data.tree + (Fin.last compositeETT.rounds).castSucc) = + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + rw [treeEq] + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + refine ⟨v, hv, ?_⟩ + have hv' := stableTerminal.2 v hv + rw [colorEq, phiEq] at hv' + exact hv'.symm ▸ hc + · rintro ⟨v, hv, hc⟩ + refine ⟨v, hv, ?_⟩ + have hv' := stableTerminal.2 v hv + rw [colorEq, phiEq] at hv' + exact hv' ▸ hc + have bound := ctx.largeMissingSet + dsimp at bound + rw [← missingEq] at bound + simpa [composite, compositeRung] using bound + +private theorem helper_branch_151.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (tau compositeInput : PartialEdgeColoring E k) (compositeSeries : TashkinovSeries G k + ett.rounds e0 compositeInput) + (compositeETT : ExtendedTashkinovTree G k e0 compositeInput T tau) (compositeRung : + compositeETT.rounds = ett.rounds) + (compositePresentation : compositeETT.series ≍ compositeSeries) + (compositeFinal : tau = compositeSeries.data.coloring (Fin.last ett.rounds)) + (compositeLadder : + ∀ (i : Fin ett.rounds), compositeSeries.data.tree i.succ.castSucc = ett.series.data.tree + i.succ.castSucc) + (compositeStored : ∀ (i : Fin (ett.rounds + (1 : ℕ))), compositeSeries.data.stored i = + ett.series.data.stored i) + (compositeEdges : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), compositeSeries.data.connectingEdges i = + ett.series.data.connectingEdges i) + (compositeKinds : ∀ (i : Fin (ett.rounds + (1 : ℕ))), compositeSeries.data.kind i = + ett.series.data.kind i) + (compositeProper : ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G + (compositeSeries.data.coloring i)) + (compositeOne : ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored + (compositeSeries.data.coloring i) e0) + (compositeStable : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors + ett.series.data i.succ) + (ett.series.data.coloring i.succ) (compositeSeries.data.coloring i.succ)) + (secondSeries : TashkinovSeries G k P.corresponding.replacementETT.rounds e0 compositeInput) + (secondFinal : tau = secondSeries.data.coloring (Fin.last + P.corresponding.replacementETT.rounds)) + (secondLadder : + ∀ (i : Fin P.corresponding.replacementETT.rounds), + secondSeries.data.tree i.succ.castSucc = + P.corresponding.replacementETT.series.data.tree i.succ.castSucc) + (secondStored : + ∀ (i : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ))), + secondSeries.data.stored i = P.corresponding.replacementETT.series.data.stored i) + (secondEdges : + ∀ (i : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ))), + secondSeries.data.connectingEdges i = + P.corresponding.replacementETT.series.data.connectingEdges i) + (secondKinds : + ∀ (i : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ))), + secondSeries.data.kind i = P.corresponding.replacementETT.series.data.kind i) + (secondProper : + ∀ (i : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ))), + IsProperEdgeColoring G (secondSeries.data.coloring i)) + (secondOne : + ∀ (i : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ))), IsOneEdgeUncolored + (secondSeries.data.coloring i) e0) + (secondStable : + ∀ (i : Fin P.corresponding.replacementETT.rounds), + StableColoring (P.corresponding.replacementETT.series.data.tree i.succ.castSucc) + (TashkinovStoredColors P.corresponding.replacementETT.series.data i.succ) + (P.corresponding.replacementETT.series.data.coloring i.succ) + (secondSeries.data.coloring i.succ)) + (secondRung : compositeETT.rounds = P.corresponding.replacementETT.rounds) + (secondPresentation : compositeETT.series ≍ secondSeries) + (baseSecond : + HierarchyBase + { replacementInput := compositeInput, replacementSeries := secondSeries, replacementETT + := compositeETT, + rungAgreement := secondRung, seriesPresentation := secondPresentation, + finalGeneratingColoring := secondFinal, + ladderTreesAgree := secondLadder, storedColorsAgree := secondStored, + connectingEdgesAgree := secondEdges, + extensionKindsAgree := secondKinds, replacementProper := secondProper, + replacementOneUncolored := secondOne, + replacementStable := secondStable : + CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT tau T + }.replacementETT + tau) + (CSecond : HierarchyCounterexample baseSecond), + let composite : CorrespondingExtendedTashkinovTree G k e0 ett tau T := + { replacementInput := compositeInput, replacementSeries := compositeSeries, + replacementETT := compositeETT, + rungAgreement := compositeRung, seriesPresentation := compositePresentation, + finalGeneratingColoring := compositeFinal, ladderTreesAgree := compositeLadder, + storedColorsAgree := compositeStored, connectingEdgesAgree := compositeEdges, + extensionKindsAgree := compositeKinds, replacementProper := compositeProper, + replacementOneUncolored := compositeOne, replacementStable := compositeStable : + CorrespondingExtendedTashkinovTree G k e0 ett tau T }; + let alignedETT : ExtendedTashkinovTree G k e0 compositeInput T tau := compositeETT; + let baseAligned : HierarchyBase alignedETT tau := baseSecond; + let Cfinal : HierarchyCounterexample baseAligned := CSecond; + SameGoodHierarchy C.good Cfinal.good → + HierarchyMinimumCounterexampleContext G k e0 composite.replacementInput T tau + composite.replacementETT baseAligned + Cfinal := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P tau compositeInput compositeSeries + compositeETT compositeRung compositePresentation compositeFinal compositeLadder + compositeStored compositeEdges compositeKinds compositeProper compositeOne compositeStable + secondSeries secondFinal secondLadder secondStored secondEdges secondKinds secondProper + secondOne secondStable secondRung secondPresentation baseSecond CSecond composite + alignedETT baseAligned Cfinal sameComposed + refine { + proper := ?_ + oneEdgeUncolored := ?_ + lowerRung := ?_ + fewerDividers := ?_ + lexicographicMinimality := ?_ + largeMissingSet := ?_ } + · rw [composite.finalGeneratingColoring] + exact composite.replacementProper (Fin.last ett.rounds) + · rw [composite.finalGeneratingColoring] + exact composite.replacementOneUncolored (Fin.last ett.rounds) + · intro input' T' generating' lower hpos hlt hmax + apply ctx.lowerRung lower hpos + · simpa [composite.rungAgreement] using hlt + · exact hmax + · intro input' T' generating' other hround otherMax base' K goodK hdiv + have countLink : C.hierarchy.dividerCount = Cfinal.hierarchy.dividerCount := + sameComposed.2.choose + apply ctx.fewerDividers other + (composite.rungAgreement ▸ hround) otherMax base' K goodK + exact countLink.symm ▸ hdiv + · intro input' T' generating' other base' C' hr hc + have countLink : C.hierarchy.dividerCount = Cfinal.hierarchy.dividerCount := + sameComposed.2.choose + have oldMinimal := ctx.lexicographicMinimality C' + (composite.rungAgreement ▸ hr) (hc.trans countLink.symm) + have hmeasure : + HierarchyCounterexampleMeasure C = + HierarchyCounterexampleMeasure Cfinal := by + have stageData := sameComposed.1 + unfold SameHierarchyStages at stageData + rcases stageData with ⟨coreEq, countEq, stagesEq, positionsEq, + kindEq, closureEq⟩ + have starHelper : ∀ (n m : Nat) + (coreLeft coreRight : TreeSequence G e0) + (stageLeft : Fin (n + 2) → TreeSequence G e0) + (stageRight : Fin (m + 2) → TreeSequence G e0), + n = m → coreLeft = coreRight → HEq stageLeft stageRight → + (let leftStar := Fin.cases (motive := fun _ => TreeSequence G e0) coreLeft + (fun i : Fin n => stageLeft i.succ.castSucc) (Fin.last n) + let rightStar := Fin.cases (motive := fun _ => TreeSequence G e0) coreRight + (fun i : Fin m => stageRight i.succ.castSucc) (Fin.last m) + leftStar = rightStar) := by + intro n m coreLeft coreRight stageLeft stageRight hnm hcore hstage + subst m + have hstage' : stageLeft = stageRight := eq_of_heq hstage + simp [hcore, hstage'] + have starredEq : + HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = + HierarchyStarredStage Cfinal.hierarchy + (Fin.last Cfinal.hierarchy.dividerCount) := by + exact starHelper _ _ base.core baseAligned.core + C.hierarchy.stage Cfinal.hierarchy.stage countEq coreEq stagesEq + unfold HierarchyCounterexampleMeasure + have terminalEq := + (Fin.heq_fun_iff (congrArg (fun q => q + 2) countEq)).mp stagesEq + (⟨C.hierarchy.dividerCount, by omega⟩ : + Fin (C.hierarchy.dividerCount + 2)) + simp only [HierarchyPathNumber, starredEq, Prod.mk.injEq, true_and] + have indexEq : + Fin.cast (congrArg (fun q => q + 2) countEq) + (⟨C.hierarchy.dividerCount, by omega⟩ : + Fin (C.hierarchy.dividerCount + 2)) = + (⟨Cfinal.hierarchy.dividerCount, by omega⟩ : + Fin (Cfinal.hierarchy.dividerCount + 2)) := by + apply Fin.ext + exact countEq + have terminalEq' := terminalEq.trans + (congrArg Cfinal.hierarchy.stage indexEq) + exact congrArg (fun q => T.length - q.length) terminalEq' + rw [← hmeasure] + exact oldMinimal + · exact @helper_branch_304 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@tau) + (@compositeInput) (@compositeSeries) (@compositeETT) (@compositeRung) + (@compositePresentation) (@compositeFinal) (@compositeLadder) (@compositeStored) + (@compositeEdges) (@compositeKinds) (@compositeProper) (@compositeOne) (@compositeStable) + (@secondRung) +lemma HierarchyReplacementPresentationTrans + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (tau : PartialEdgeColoring E k) + (second : CorrespondingExtendedTashkinovTree G k e0 + P.corresponding.replacementETT tau T) + (baseSecond : HierarchyBase second.replacementETT tau) + (CSecond : HierarchyCounterexample baseSecond) + (sameGoodSecond : SameGoodHierarchy + P.counterexample.good CSecond.good) : + Exists fun PSecond : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx => + PSecond.coloring = tau := by + obtain ⟨composite, hinput, hseries, hett⟩ := + CorrespondingExtendedTashkinovTreeTrans G k e0 input T phi + P.coloring tau ett P.corresponding second + rcases composite with ⟨compositeInput, compositeSeries, compositeETT, + compositeRung, compositePresentation, compositeFinal, + compositeLadder, compositeStored, compositeEdges, compositeKinds, + compositeProper, compositeOne, compositeStable⟩ + rcases second with ⟨secondInput, secondSeries, secondETT, + secondRung, secondPresentation, secondFinal, + secondLadder, secondStored, secondEdges, secondKinds, + secondProper, secondOne, secondStable⟩ + cases hinput + have ettEq : compositeETT = secondETT := by + exact eq_of_heq hett + revert baseSecond CSecond sameGoodSecond + cases ettEq + intro baseSecond CSecond sameGoodSecond + let second : CorrespondingExtendedTashkinovTree + G k e0 P.corresponding.replacementETT tau T := { + replacementInput := compositeInput + replacementSeries := secondSeries + replacementETT := compositeETT + rungAgreement := secondRung + seriesPresentation := secondPresentation + finalGeneratingColoring := secondFinal + ladderTreesAgree := secondLadder + storedColorsAgree := secondStored + connectingEdgesAgree := secondEdges + extensionKindsAgree := secondKinds + replacementProper := secondProper + replacementOneUncolored := secondOne + replacementStable := secondStable } + let composite : CorrespondingExtendedTashkinovTree G k e0 ett tau T := { + replacementInput := compositeInput + replacementSeries := compositeSeries + replacementETT := compositeETT + rungAgreement := compositeRung + seriesPresentation := compositePresentation + finalGeneratingColoring := compositeFinal + ladderTreesAgree := compositeLadder + storedColorsAgree := compositeStored + connectingEdgesAgree := compositeEdges + extensionKindsAgree := compositeKinds + replacementProper := compositeProper + replacementOneUncolored := compositeOne + replacementStable := compositeStable } + let alignedETT : ExtendedTashkinovTree G k e0 compositeInput T tau := + compositeETT + let baseAligned : HierarchyBase alignedETT tau := baseSecond + let Cfinal : HierarchyCounterexample baseAligned := CSecond + have h12 : SameGoodHierarchy P.counterexample.good Cfinal.good := by + simpa [Cfinal] using sameGoodSecond + have sameComposed := @helper_sameComposed_97 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C ctx P tau compositeInput compositeETT secondSeries + secondFinal secondLadder secondStored secondEdges secondKinds secondProper secondOne + secondStable secondRung secondPresentation baseSecond CSecond h12 + exact ⟨by + refine { + coloring := tau + corresponding := composite + maximum := by + have maxAligned : MaximumProperty alignedETT := by + exact CSecond.maximum + simpa [composite] using maxAligned + replacementBase := by + exact baseAligned + counterexample := by + exact Cfinal + sameGood := ?_ + minimumContext := ?_ } + · exact sameComposed + · exact @helper_branch_151 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P tau compositeInput compositeSeries compositeETT + compositeRung compositePresentation compositeFinal compositeLadder compositeStored + compositeEdges compositeKinds compositeProper compositeOne compositeStable secondSeries + secondFinal secondLadder secondStored secondEdges secondKinds secondProper secondOne + secondStable secondRung secondPresentation baseSecond CSecond sameComposed + , rfl⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySegmentColors.lean b/LeanPool/GoldbergSeymour/HierarchySegmentColors.lean new file mode 100644 index 0000000000..ae2aa2682b --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySegmentColors.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyStarredStage + +/-! +# Hierarchy Segment Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Colors on the stage segment before the first occurrence of a missing specified color. -/ +noncomputable def HierarchySegmentColors {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} {base : HierarchyBase ett phi} + (H : TashkinovHierarchy ett base) (j : Fin (H.dividerCount + 1)) (eta : Fin k) : + Finset (Fin k) := by + classical + let A := HierarchyStarredStage H j + let B := H.stage j.succ + let p := HierarchyFirstMissingPosition phi T eta + exact Finset.univ.filter fun c => + ∃ r : Fin B.length, A.length ≤ r.val ∧ + r.val < min p.val B.length ∧ phi (B.edge r) = some c + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean new file mode 100644 index 0000000000..721304045b --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean @@ -0,0 +1,1042 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Hierarchy Situation One Advance Inside Stored + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_tailException_322.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A)) (_ : TreeSequenceInitialSegment A T) (hlen + : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), + HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : + (1 : ℕ) ≤ j) (_ : j < T.length - A.length), + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = + some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx i trans A starEq hAT hlen B hBT fullEq + fullB elementary vertexMem R j hj hjlt c hc t hlo hhi hcol + clear * - R j hj hjlt c hc t hlo hhi hcol starEq hAT hBT fullEq fullB elementary vertexMem + let U := HierarchyFullTailPrefix R.counterexample j + have hUlen : U.length = A.length + j := by + simp only [U, HierarchyFullTailPrefix, TreeSequencePrefix] + rw [starEq R] + exact min_eq_left (by have := hAT.1; omega) + have hUT : TreeSequenceInitialSegment U T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + let u : Fin U.length := ⟨t.val, by rw [hUlen]; omega⟩ + have hut : Fin.castLE hUT.1 u = t := Fin.ext rfl + have hcU : c ∈ MissingColors G R.coloring (U.vertex (Fin.last U.length)) := by + dsimp only [U] + rw [fullEq R] + exact hc + have hcolU : R.coloring (U.edge u) = some c := by + rw [← hUT.2.2 u, hut]; exact hcol + have hex := HierarchyTailMissingColorExclusion G k e0 R.corresponding.replacementInput T + R.coloring R.corresponding.replacementETT R.replacementBase R.counterexample.hierarchy + (by + change ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1))) + rw [fullB R] + exact elementary R) + j hj (by + rw [starEq R] + exact hjlt) c hcU u + (by + change (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length ≤ t.val + rw [starEq R] + exact hlo) + (by + change t.val < (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + j + rw [starEq R] + exact hhi) hcolU + obtain ⟨hzero, hcore, hval, f, hstep, hkind, hedges, hedge, hcF, hstored⟩ := hex + have hAval : t.val = A.length := by + change u.val = _ at hval + rw [starEq R] at hval + exact hval + have hAn : A = R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc := by + rw [← starEq R] + have hs : HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = R.replacementBase.core := by + simp [HierarchyStarredStage, hzero, Fin.last] + exact hs.trans hcore + obtain ⟨i, hi⟩ := T.attaches t + let a : Fin (A.length + 1) := ⟨i.val, by simpa only [hAval] using i.isLt⟩ + let old : Fin (T.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ t.isLt)) + have ha : Fin.castLE (Nat.succ_le_succ hAT.1) a = old := Fin.ext rfl + refine ⟨⟨T.vertex old, ?_, ?_⟩, hstored⟩ + · rw [← hAn, ← ha, hAT.2.1 a] + exact vertexMem A a + · rw [Incident, hi] + exact Sym2.mem_mk_right _ _ + +private theorem helper_excM_401.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchyPathNumber C.hierarchy = (1 : ℕ)), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (_ : TreeSequenceInitialSegment A T) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by first | omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by first | omega + )); + ∀ (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : (1 : + ℕ) ≤ j) (_ : j < T.length - A.length), + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = + some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds))) (_ : ( + ∀ (t : Fin T.length) (_ : A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ)), G.ends + (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ))) (m : ℕ) (hmLower : (1 : ℕ) ≤ m) (_ + : (1 : ℕ) ≤ m) (hmT : A.length + (m + (1 : ℕ)) < T.length), + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (m + (1 : ℕ))) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (m + (1 : ℕ))) => + by omega + ) (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) ≤ T.length) => + by + omega + ); + let Y : TreeSequence G e0 := TreeSequencePrefix T (A.length + m) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + m) => + by omega + ) (Decidable.byContradiction fun (a : ¬A.length + m ≤ T.length) => + by omega + ); + let jm : Fin (B.length + (1 : ℕ)) := (⟨A.length + m, id (Decidable.byContradiction fun (a : + ¬A.length + m < T.length - (1 : ℕ) + (1 : ℕ)) => + by omega + )⟩ : Fin (B.length + (1 : ℕ))); + let _ : Fin T.length := (⟨A.length + m, + by omega + ⟩ : Fin T.length); + ∀ (_ : HierarchyFullTailPrefix C m = Y) (_ : Y.vertex (Fin.last Y.length) = B.vertex jm) (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jm), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation A hAT hlen B tailException + consecutive m hmLower hm hmT X Y jm tnext hfullY hYvertex R b hb t hlo hhi hcol + by_cases ht : t.val < A.length + m + · exact tailException R m (by omega) (by have := hAT.1; omega) b + (by rw [hfullY, hYvertex]; exact hb) t hlo ht hcol + · have htEq : t = tnext := Fin.ext (by + change t.val < A.length + (m + 1) at hhi + dsimp [tnext] + omega) + subst t + have he := consecutive tnext (by dsimp [tnext]; omega) + have hv : T.vertex tnext.castSucc = B.vertex jm := rfl + have hi : Incident G (B.vertex jm) (T.edge tnext) := by + rw [Incident, he, hv] + exact Sym2.mem_mk_left _ _ + exact ((Finset.mem_sdiff.mp hb).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, T.edge tnext, hi, hcol⟩)).elim + +private theorem helper_advance_428.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchyPathNumber C.hierarchy = (1 : ℕ)) (_ : ( + ∀ (mu : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G mu) (_ : IsOneEdgeUncolored mu + e0) (v : V), (MissingColors G mu v).Nonempty)) (_ : ℕ) (_ : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : Fin k) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : + TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y)) (_ : TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) T) (hlen : (4 : ℕ) ≤ T.length), + ∀ (_ : TreeSequenceInitialSegment (TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by + omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by + omega + ) : TreeSequence G e0) T) (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (((TreeSequencePrefix T (T.length - (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(1 : + ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ) : TreeSequence G e0)).length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring + (((TreeSequencePrefix T (T.length - (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(1 : ℕ) + ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ) : TreeSequence G e0)).vertex j)), (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = + (↑j : ℕ))) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0) (_ : TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) X) (_ : (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) : TreeSequence G e0).length < X.length) (_ : + TreeSequenceInitialSegment X (TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by + omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by + omega + ) : TreeSequence G e0)) (a_bound_0 b eta : Fin k) (_ : eta ∈ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)) (_ : + a_bound_0 ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) + eta) (_ : (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length) (jb : Fin + (((TreeSequencePrefix T (T.length - (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(1 : ℕ) + ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ) : TreeSequence G e0)).length + (1 : ℕ))) (_ : (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length < (↑jb : ℕ)) (_ : (↑jb : ℕ) ≤ + X.length) (_ : b ∈ MissingColors G R.coloring (((TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ) : TreeSequence G e0)).vertex jb)) (_ : a_bound_0 ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length))) (_ : + ( + ∀ (t : Fin T.length) (_ : (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < + X.length), R.coloring (T.edge t) ≠ some a_bound_0)) (_ : ( + ∀ (t : Fin T.length) (_ : (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < + X.length) (_ : R.coloring (T.edge t) = some b), TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds))), + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet (TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ) : TreeSequence G e0), MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ ( + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a_bound_0 ∈ MissingColors G R.coloring (T.vertex (Fin.last + T.length)) → b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ + MissingColors G R.coloring (T.vertex (Fin.last T.length)) → a_bound_0 ∈ MissingColors G + S.coloring (T.vertex (Fin.last T.length))))) (_ : ( + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta)) (_ : + ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a_bound_1 : + Fin k) (_ : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)) (_ : a_bound_1 ∈ R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta) (t : Fin T.length) (_ : + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : TreeSequence G + e0).length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < (↑(HierarchyFirstMissingPosition R.coloring T eta) + : ℕ)), R.coloring (T.edge t) ≠ some a_bound_1)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : (1 : + ℕ) ≤ j) (_ : j < T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length), + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) : TreeSequence G e0).length + j → R.coloring (T.edge + t) = some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds))) (_ : ( + ∀ (t : Fin T.length) (_ : (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length + HierarchyPathNumber C.hierarchy ≤ + (↑t : ℕ)), G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ))) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ a_bound_2 ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) + eta, R.coloring f ≠ some a_bound_2)) (m : ℕ) (_ : (1 : ℕ) ≤ m) (_ : m < + HierarchyFullTailLength C - (1 : ℕ)) (P : HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C m).vertex (Fin.last + (HierarchyFullTailPrefix C m).length)), alpha ∈ MissingColors G P.coloring (T.vertex + (Fin.last T.length)) → alpha ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i P alpha common + set A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + intro hAT hlen + set B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => by omega) + intro hBT vertexMem firstAt stageSwitch gammaTransport gammaUnused tailException consecutive + gammaChoice m hmLower hmUpper P alpha ha haLast hAlphaStored + have hm : 1 ≤ m := hmLower + have hmT : A.length + (m + 1) < T.length := by + change m < (T.length - A.length) - 1 at hmUpper + have := hAT.1 + omega + let X := TreeSequencePrefix T (A.length + (m + 1)) (by have := A.positive; omega) (by omega) + let Y := TreeSequencePrefix T (A.length + m) (by have := A.positive; omega) (by omega) + have hXT : TreeSequenceInitialSegment X T := ⟨by exact le_of_lt hmT, fun _ => rfl, fun _ => rfl⟩ + have hAX : TreeSequenceInitialSegment A X := common hAT hXT (by + dsimp [X, TreeSequencePrefix] + omega) + have hXB : TreeSequenceInitialSegment X B := + common hXT hBT (by dsimp [X, B, TreeSequencePrefix]; omega) + have hAXlt : A.length < X.length := by dsimp [X, TreeSequencePrefix]; omega + let jm : Fin (B.length + 1) := ⟨A.length + m, by dsimp [B, TreeSequencePrefix]; omega⟩ + let jnext : Fin (B.length + 1) := ⟨A.length + (m + 1), by dsimp [B, TreeSequencePrefix]; omega⟩ + let tnext : Fin T.length := ⟨A.length + m, by omega⟩ + have hfullY : HierarchyFullTailPrefix C m = Y := by + have hn : min (A.length + m) T.length = A.length + m := min_eq_left (by omega) + simp only [HierarchyFullTailPrefix] + change TreeSequencePrefix T (min (A.length + m) T.length) _ _ = Y + simp only [hn] + rfl + have hfullX : HierarchyFullTailPrefix C (m + 1) = X := by + have hn : min (A.length + (m + 1)) T.length = A.length + (m + 1) := min_eq_left (by omega) + simp only [HierarchyFullTailPrefix] + change TreeSequencePrefix T (min (A.length + (m + 1)) T.length) _ _ = X + simp only [hn] + rfl + have hYvertex : Y.vertex (Fin.last Y.length) = B.vertex jm := rfl + have hXvertex : X.vertex (Fin.last X.length) = B.vertex jnext := rfl + have haM : alpha ∈ MissingColors G P.coloring (B.vertex jm) := by + rw [hfullY, hYvertex] at ha + exact ha + obtain ⟨theta, htheta⟩ := hvertexMissing P.coloring P.minimumContext.proper + P.minimumContext.oneEdgeUncolored (B.vertex jnext) + have nextMember (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (hc : c ∈ MissingColors G S.coloring (B.vertex jnext)) + (hcLast : c ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) : + m + 1 ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨by omega, by omega⟩, S, c, ?_, hcLast⟩ + rw [hfullX, hXvertex] + exact hc + have excNext (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (b : Fin k) (hb : b ∈ MissingColors G R.coloring (B.vertex jnext)) + (t : Fin T.length) (hlo : A.length ≤ t.val) (hhi : t.val < X.length) + (hcol : R.coloring (T.edge t) = some b) : + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + b ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + apply tailException R (m + 1) (by omega) (by have := hAT.1; omega) b + (by rw [hfullX, hXvertex]; exact hb) t hlo + (by exact hhi) hcol + have excM := @helper_excM_401 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hsituation hAT hlen tailException consecutive m hmLower hm hmT + hfullY hYvertex + have avoidNext (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (ha : a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) + (he : eta ∈ MissingColors G R.coloring (B.vertex jnext)) : + ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) ≠ some a := by + intro t hlo hhi + apply gammaUnused R eta a heta ha t hlo + rw [firstAt R eta jnext he] + exact hhi + have avoidM (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (ha : a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) + (he : eta ∈ MissingColors G R.coloring (B.vertex jm)) + (hgap : R.coloring (T.edge tnext) ≠ some a) : + ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) ≠ some a := by + intro t hlo hhi + by_cases ht : t.val < A.length + m + · apply gammaUnused R eta a heta ha t hlo + rw [firstAt R eta jm he] + exact ht + · have htEq : t = tnext := Fin.ext (by + change t.val < A.length + (m + 1) at hhi + dsimp [tnext] + omega) + simpa only [htEq] using hgap + obtain ⟨gamma, hgamma, hgap⟩ := gammaChoice P alpha hAlphaStored (T.edge tnext) + obtain ⟨P1, hmissing1, hfixed1, _, hterminal1⟩ := stageSwitch P X hAX hAXlt hXB + gamma alpha alpha hAlphaStored hgamma + (by rw [firstAt P alpha jm haM]; dsimp [jm, X, TreeSequencePrefix]; omega) + jm (by dsimp [jm]; omega) (by dsimp [jm, X, TreeSequencePrefix]; omega) + haM (Or.inr haLast) (avoidM P alpha gamma hAlphaStored hgamma haM hgap) + (excM P alpha haM) + have hgLast : gamma ∈ MissingColors G P1.coloring (T.vertex (Fin.last T.length)) := hterminal1 + haLast + have haM1 : alpha ∈ MissingColors G P1.coloring (B.vertex jm) := by + rw [hmissing1 _ (vertexMem B jm)]; exact haM + have htheta1 : theta ∈ MissingColors G P1.coloring (B.vertex jnext) := by + rw [hmissing1 _ (vertexMem B jnext)]; exact htheta + obtain ⟨hAlphaStored1, heqGamma⟩ := gammaTransport P P1 alpha hAlphaStored + have hgamma1 : gamma ∈ P1.counterexample.good.gamma + (Fin.last P1.counterexample.hierarchy.dividerCount) alpha := by + rw [← heqGamma]; exact hgamma + have hgap1 : P1.coloring (T.edge tnext) ≠ some gamma := by + rw [hfixed1 tnext (by dsimp [tnext]; omega) + (by dsimp [tnext, X, TreeSequencePrefix]; omega)] + exact hgap + obtain ⟨P2, hmissing2, _, hterminal2, _⟩ := stageSwitch P1 X hAX hAXlt hXB + gamma theta alpha hAlphaStored1 hgamma1 + (by rw [firstAt P1 alpha jm haM1]; dsimp [jm, X, TreeSequencePrefix]; omega) + jnext (by dsimp [jnext]; omega) (by rfl) + htheta1 (Or.inl hgLast) (avoidM P1 alpha gamma hAlphaStored1 hgamma1 haM1 hgap1) + (excNext P1 theta htheta1) + exact nextMember P2 theta (by rw [hmissing2 _ (vertexMem B jnext)]; exact htheta1) + (hterminal2 hgLast) + +private theorem helper_firstAt_634.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (hlen : (4 : + ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (_ : ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))) (_ : c ∈ + MissingColors G psi (T.vertex j)), HierarchyFirstMissingPosition psi T c ≤ j)) (_ : ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (_ : (↑(HierarchyFirstMissingPosition psi T c) : + ℕ) < T.length), c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T + c)))) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) + (j : Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx i hlen B hBT elementary vertexMem firstLe + firstMem R c j hc + clear * - G T B R c j hc elementary vertexMem firstLe firstMem hBT + have hcT : c ∈ MissingColors G R.coloring + (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) j)) := by + rw [hBT.2.1 j]; exact hc + have hle := firstLe R.coloring c _ hcT + have hlt : (HierarchyFirstMissingPosition R.coloring T c).val < T.length := by + have := j.isLt + change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle + have hblen : B.length = T.length - 1 := rfl + omega + let x : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T c).val, by + change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle + omega⟩ + have hxT : Fin.castLE (Nat.succ_le_succ hBT.1) x = + HierarchyFirstMissingPosition R.coloring T c := Fin.ext rfl + have hcx : c ∈ MissingColors G R.coloring (B.vertex x) := by + rw [← hBT.2.1 x, hxT] + exact firstMem R.coloring c hlt + have he : B.vertex x = B.vertex j := by + by_contra hn + exact Finset.disjoint_left.mp (elementary R (vertexMem B x) (vertexMem B j) hn) hcx hc + exact congrArg Fin.val (B.vertex_injective he) + +private theorem helper_firstMem_669.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + classical + intro V E _ _ G k e0 T psi c hlt + let _ := Fintype.ofFinite V + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + +private theorem helper_consecutive_751.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : ℕ) + (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + ∀ (t : Fin T.length) (_ : A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ)), + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C i hpathUpper A t ht + clear * - G T A C t ht hpathUpper + let candidates := (Finset.Icc 1 (T.length - A.length)).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + have hp : HierarchyPathNumber C.hierarchy = + (if h : candidates.Nonempty then candidates.min' h else T.length - A.length) := rfl + have hn : candidates.Nonempty := by + by_contra hn + rw [dite_eq_right hn] at hp + have hu : HierarchyPathNumber C.hierarchy < T.length - A.length := hpathUpper + omega + have hm : candidates.min' hn = HierarchyPathNumber C.hierarchy := by + simpa only [dite_eq_left hn] using hp.symm + have hh := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + rw [hm] at hh + exact hh t ht + +private theorem helper_trans_785.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyPathNumber C.hierarchy = (1 : ℕ) → + ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hsituation i hiLower hiUpper X Y Z hXY hYZ + clear * - hXY hYZ + refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +private theorem helper_common_795.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyPathNumber C.hierarchy = (1 : ℕ) → + ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hsituation i hiLower hiUpper trans X Y Z hXZ + hYZ hXY + clear * - hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + +private theorem helper_hAT_826.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyPathNumber C.hierarchy = (1 : ℕ) → + ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hsituation i hiLower hiUpper A + have starNext (j : Fin (C.hierarchy.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy j) + (C.hierarchy.stage j.succ) := + Fin.cases C.hierarchy.coreInsideFirst (fun i => C.hierarchy.nested i.succ) j + simpa only [Fin.succ_last, C.hierarchy.terminalStage] using + starNext (Fin.last C.hierarchy.dividerCount) + +private theorem helper_fullB_848.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber + C.hierarchy = (1 : ℕ) → + ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → (3 : ℕ) ≤ T.length - A.length → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation i hiLower hiUpper A starEq htail + hlen B R + have hn : min ((HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + + (HierarchyFullTailLength R.counterexample - 1)) T.length = T.length - 1 := by + unfold HierarchyFullTailLength + dsimp only + rw [starEq R] + omega + simp only [HierarchyFullTailPrefix, hn] + rfl + +private theorem helper_elementary_860.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber + C.hierarchy = (1 : ℕ) → + ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation i hiLower hiUpper hlen B fullB R + have h : ColoredVertexSetElementary G R.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 + R.corresponding.replacementInput T R.coloring R.corresponding.replacementETT + R.replacementBase R.counterexample R.minimumContext.proper + R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + R.minimumContext.largeMissingSet + intro u hu v hv hne + exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne + +private theorem helper_firstLe_877.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyPathNumber C.hierarchy = (1 : ℕ) → + ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hsituation i hiLower hiUpper psi c j hj + clear * - G T psi c j hj + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ + have hn : candidates.Nonempty := ⟨j, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates j hm + +private theorem helper_lastData_900.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber + C.hierarchy = (1 : ℕ) → + ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma + (Fin.last C.hierarchy.dividerCount) eta = R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation i hiLower hiUpper R + clear * - R + obtain ⟨hcount, hdata⟩ := R.sameGood.2 + have hh := hdata (Fin.last C.hierarchy.dividerCount) + have hidx : Fin.cast (congrArg (fun q => q + 1) hcount) + (Fin.last C.hierarchy.dividerCount) = + Fin.last R.counterexample.hierarchy.dividerCount := Fin.ext hcount + simpa only [hidx] using hh + +private theorem helper_gammaTransport_914.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber + C.hierarchy = (1 : ℕ) → + ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma + (Fin.last C.hierarchy.dividerCount) eta = R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta) → + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation i hiLower hiUpper trans lastData + R S eta heta + clear * - R S eta heta lastData + have hOrig : eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) + := by + rw [(lastData R).1]; exact heta + refine ⟨?_, ((lastData R).2 eta hOrig).symm.trans ((lastData S).2 eta hOrig)⟩ + rw [← (lastData S).1] + exact hOrig + +private theorem helper_gammaUnused_930.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber + C.hierarchy = (1 : ℕ) → + ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), + eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition + R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation i hiLower hiUpper A starEq R eta + a heta ha t hlo hhi + clear * - R eta a heta ha t hlo hhi starEq + intro hc + have hnot := (Finset.mem_sdiff.mp (R.counterexample.good.avoidance + (Fin.last R.counterexample.hierarchy.dividerCount) eta heta ha)).2 + apply hnot + unfold HierarchySegmentColors + dsimp only + rw [starEq R, Fin.succ_last, R.counterexample.hierarchy.terminalStage] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, + lt_min hhi t.isLt, hc⟩ + +private theorem helper_gammaChoice_968.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber + C.hierarchy = (1 : ℕ) → + ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation i hiLower hiUpper trans R eta + heta f + clear * - R eta heta f + by_contra hn + push Not at hn + have hc : (R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta).card ≤ 1 := by + apply Finset.card_le_one.mpr + intro a ha b hb + exact Option.some.inj ((hn a ha).symm.trans (hn b hb)) + rw [R.counterexample.good.twoColors _ eta heta] at hc + omega + +theorem HierarchySituationOneAdvanceInsideStored {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hsituation : HierarchyPathNumber C.hierarchy = 1) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) + (i : ℕ) (hiLower : 1 ≤ i) + (hiUpper : i < HierarchyFullTailLength C - 1) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha : Fin k) + (hcommon : + alpha ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length)) ∧ + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length))) + (hinside : + let H := P.counterexample.hierarchy + alpha ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount)) : + i + 1 ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + classical + have hpathUpper : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C := by + rw [hsituation] + omega + classical + open scoped Sym2 in + have trans := @helper_trans_785 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hsituation) (@i) + (@hiLower) (@hiUpper) + have common := @helper_common_795 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hsituation) (@i) + (@hiLower) (@hiUpper) (@trans) + have sameLast : + ∀ {a b : ℕ} (s : Fin (a + 2) → TreeSequence G e0) (t : Fin (b + 2) → TreeSequence G e0) (u v : + TreeSequence G e0), a = b → HEq s t → u = v → Fin.cases (motive := fun _ => TreeSequence G + e0) u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = Fin.cases (motive := fun _ => + TreeSequence G e0) v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by + clear * - + intro a b s t u v hab hst huv + cases hab + have he : s = t := eq_of_heq hst + cases he + cases huv + rfl + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + have starEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = A := + (sameLast _ _ _ _ R.sameGood.1.2.1 R.sameGood.1.2.2.1 R.sameGood.1.1).symm + have hAT := + @helper_hAT_826 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hsituation) (@i) (@hiLower) (@hiUpper) + have htail : 3 ≤ T.length - A.length := by + change i < (T.length - A.length) - 1 at hiUpper + omega + have hlen : 4 ≤ T.length := by have := A.positive; omega + let B := TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + have hBT : TreeSequenceInitialSegment B T := ⟨by dsimp [B, TreeSequencePrefix]; omega, + fun _ => rfl, fun _ => rfl⟩ + have hAB : TreeSequenceInitialSegment A B := + common hAT hBT (by dsimp [B, TreeSequencePrefix]; omega) + have fullEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (j : ℕ) : HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j := by + unfold HierarchyFullTailPrefix + dsimp only + simp only [starEq R] + rfl + have fullB := @helper_fullB_848 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hsituation) + (@i) (@hiLower) (@hiUpper) (@starEq) (@htail) (@hlen) + have elementary := @helper_elementary_860 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hsituation) + (@i) (@hiLower) (@hiUpper) (@hlen) (@fullB) + have vertexMem (U : TreeSequence G e0) (j : Fin (U.length + 1)) : + U.vertex j ∈ TreeSequenceVertexSet U := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + have firstLe := @helper_firstLe_877 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hsituation) (@i) + (@hiLower) (@hiUpper) + have firstMem := @helper_firstMem_669 V E inferInstance inferInstance G k e0 T + have firstAt := @helper_firstAt_634 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C ctx i hlen hBT elementary vertexMem firstLe firstMem + have stageSwitch := P2963_T1_TerminalKempeStageSwitch G k e0 input T phi ett base C ctx + A B (by omega) rfl rfl + have lastData := @helper_lastData_900 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hsituation) + (@i) (@hiLower) (@hiUpper) + have gammaTransport := @helper_gammaTransport_914 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hsituation) (@i) (@hiLower) (@hiUpper) (@trans) (@lastData) + have gammaUnused := @helper_gammaUnused_930 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hsituation) + (@i) (@hiLower) (@hiUpper) (@starEq) + have tailException := @helper_tailException_322 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C ctx i trans starEq hAT hlen hBT fullEq fullB + elementary vertexMem + have consecutive := @helper_consecutive_751 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C i hpathUpper + have gammaChoice := @helper_gammaChoice_968 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hsituation) + (@i) (@hiLower) (@hiUpper) (@trans) + have advance := @helper_advance_428 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C ctx hsituation hvertexMissing i P alpha common hAT hlen hBT + vertexMem firstAt stageSwitch gammaTransport gammaUnused tailException consecutive + gammaChoice + exact advance i hiLower hiUpper P alpha hcommon.1 hcommon.2 hinside + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean new file mode 100644 index 0000000000..4a29a62ebf --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean @@ -0,0 +1,2110 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChangeCaseThree +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Hierarchy Situation One Advance Outside Stored + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch520Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hsituation : + HierarchyPathNumber C.hierarchy = (1 : ℕ)) (_ : HierarchyReplacementPresentation G k e0 + input T phi ett base C ctx) (_ : Fin k), + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + )); + ∀ (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ))) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0) (_ : TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) X) (_ : (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) : TreeSequence G e0).length < X.length) (_ : + TreeSequenceInitialSegment X B) (a b eta : Fin k) (_ : eta ∈ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)) (_ : a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) (_ : + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length) (jb : Fin (B.length + + (1 : ℕ))) (_ : (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length < (↑jb : ℕ)) (_ : (↑jb : ℕ) ≤ X.length) (_ : b ∈ MissingColors G + R.coloring (B.vertex jb)) (_ : a ∈ MissingColors G R.coloring (T.vertex (Fin.last + T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length))) (_ : ( + ∀ (t : Fin T.length) (_ : (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < + X.length), R.coloring (T.edge t) ≠ some a)) (_ : ( + ∀ (t : Fin T.length) (_ : (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < + X.length) (_ : R.coloring (T.edge t) = some b), TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds))), + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length))))) (_ : ( + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta)) (_ : + ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a)) (m : ℕ) (hmLower : HierarchyPathNumber C.hierarchy ≤ m) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), + ∀ (hmT : (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : TreeSequence + G e0).length + (m + (1 : ℕ)) < T.length), + let X : TreeSequence G e0 := TreeSequencePrefix T ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) : TreeSequence G e0).length + (m + (1 : ℕ))) ( + have this : (1 : ℕ) ≤ (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length := (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).positive; Decidable.byContradiction fun (a + : ¬(1 : ℕ) ≤ (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length + (m + (1 : ℕ))) => + by omega + ) (Decidable.byContradiction fun (a : ¬(HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length + (m + (1 : ℕ)) ≤ T.length) => + by omega + ); TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) X → TreeSequenceInitialSegment X B → + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : TreeSequence G + e0).length < X.length → + let jm : Fin (B.length + (1 : ℕ)) := (⟨(HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length + m, id (Decidable.byContradiction + fun (a : ¬(HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length + m < T.length - (1 : ℕ) + (1 : ℕ)) => + by omega + )⟩ : Fin (B.length + (1 : ℕ))); + let jnext : Fin (B.length + (1 : ℕ)) := (⟨(HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length + (m + (1 : ℕ)), id + (Decidable.byContradiction fun (a : ¬(HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length + (m + (1 : ℕ)) < T.length - (1 : ℕ) + + (1 : ℕ)) => + by omega + )⟩ : Fin (B.length + (1 : ℕ))); + let _ : Fin T.length := (⟨(HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length + m, + by omega + ⟩ : Fin T.length); alpha ∈ MissingColors G P.coloring (B.vertex jm) → + ∀ theta ∈ MissingColors G P.coloring (B.vertex jnext), ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ MissingColors G S.coloring (B.vertex jnext), c ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)) → m + (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T + phi ett base C ctx) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jnext), + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jm), + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), + eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → eta ∈ MissingColors G R.coloring (B.vertex + jnext) → + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) → theta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) → m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + +private abbrev helperBranch542Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hsituation : + HierarchyPathNumber C.hierarchy = (1 : ℕ)) (_ : HierarchyReplacementPresentation G k e0 + input T phi ett base C ctx) (_ : Fin k) (_ : ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (_ : a ≠ b) (_ : IsProperEdgeColoring G psi) + (B : Finset V) (_ : ColoredVertexSetElementary G psi B) (u v w : V) (_ : u ∈ B) (_ : v ∈ + B) (_ : u ≠ v) (_ : w ≠ u) (_ : w ≠ v) (_ : a ∈ MissingColors G psi u) (_ : b ∈ + MissingColors G psi v) (_ : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) (_ : + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v)), + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x)) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A)) (_ : TreeSequenceInitialSegment A T) (hlen + : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + )); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ))) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (_ : A.length < (↑j : ℕ)) (_ : c ∈ MissingColors G R.coloring + (B.vertex j)), c ∉ TreeMissingColors R.coloring A)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds))) (m : ℕ) (hmLower : HierarchyPathNumber + C.hierarchy ≤ m) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C m).vertex (Fin.last + (HierarchyFullTailPrefix C m).length)), alpha ∈ MissingColors G P.coloring (T.vertex + (Fin.last T.length)) → alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → + ∀ (hmT : A.length + (m + (1 : ℕ)) < T.length), + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (m + (1 : ℕ))) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (m + (1 : ℕ))) => + by omega + ) (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) ≤ T.length) => + by omega + ); + let jm : Fin (B.length + (1 : ℕ)) := (⟨A.length + m, id (Decidable.byContradiction fun (a : + ¬A.length + m < T.length - (1 : ℕ) + (1 : ℕ)) => + by + omega + )⟩ : Fin (B.length + (1 : ℕ))); + let jnext : Fin (B.length + (1 : ℕ)) := (⟨A.length + (m + (1 : ℕ)), id + (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) < T.length - (1 : ℕ) + (1 : + ℕ)) => + by omega + )⟩ : Fin (B.length + (1 : ℕ))); alpha ∈ MissingColors G P.coloring (B.vertex jm) → + ∀ theta ∈ MissingColors G P.coloring (B.vertex jnext), ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ MissingColors G S.coloring (B.vertex jnext), c ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)) → m + (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T + phi ett base C ctx) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jm), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → theta ∉ HierarchyStoredColorsAt + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → m + (1 : + ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + +private abbrev helperAdvance481Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchyPathNumber C.hierarchy = (1 : ℕ)) (_ : ( + ∀ (mu : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G mu) (_ : IsOneEdgeUncolored mu + e0) (v : V), (MissingColors G mu v).Nonempty)) (_ : ℕ) (_ : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : Fin k) (_ : ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (_ : a ≠ b) (_ : IsProperEdgeColoring G psi) + (B : Finset V) (_ : ColoredVertexSetElementary G psi B) (u v w : V) (_ : u ∈ B) (_ : v ∈ + B) (_ : u ≠ v) (_ : w ≠ u) (_ : w ≠ v) (_ : a ∈ MissingColors G psi u) (_ : b ∈ + MissingColors G psi v) (_ : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) (_ : + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v)), + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x)) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : + TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0))) (_ : TreeSequenceInitialSegment + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : TreeSequence G + e0) T) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ))) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0) (_ : TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) X) (_ : (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) : TreeSequence G e0).length < X.length) (_ : + TreeSequenceInitialSegment X B) (a b eta : Fin k) (_ : eta ∈ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)) (_ : a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) (_ : + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length) (jb : Fin (B.length + + (1 : ℕ))) (_ : (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length < (↑jb : ℕ)) (_ : (↑jb : ℕ) ≤ X.length) (_ : b ∈ MissingColors G + R.coloring (B.vertex jb)) (_ : a ∈ MissingColors G R.coloring (T.vertex (Fin.last + T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length))) (_ : ( + ∀ (t : Fin T.length) (_ : (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < + X.length), R.coloring (T.edge t) ≠ some a)) (_ : ( + ∀ (t : Fin T.length) (_ : (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < + X.length) (_ : R.coloring (T.edge t) = some b), TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds))), + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length))))) (_ : ( + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta)) (_ : + ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k) (_ + : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)) (_ : a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta) (t : Fin T.length) (_ : + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : TreeSequence G + e0).length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < (↑(HierarchyFirstMissingPosition R.coloring T eta) + : ℕ)), R.coloring (T.edge t) ≠ some a)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (_ : (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length < (↑j : ℕ)) (_ : c ∈ MissingColors G + R.coloring (B.vertex j)), c ∉ TreeMissingColors R.coloring (HierarchyStarredStage + C.hierarchy (Fin.last C.hierarchy.dividerCount) : TreeSequence G e0))) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∉ TreeMissingColors R.coloring (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0), c ∉ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds))) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : (1 : + ℕ) ≤ j) (_ : j < T.length - (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length), + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) : TreeSequence G e0).length + j → R.coloring (T.edge + t) = some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds))) (_ : ( + ∀ (t : Fin T.length) (_ : (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length + HierarchyPathNumber C.hierarchy ≤ + (↑t : ℕ)), G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ))) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a)) (m : ℕ) (_ : HierarchyPathNumber C.hierarchy ≤ m) (_ : m < + HierarchyFullTailLength C - (1 : ℕ)) (P : HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C m).vertex (Fin.last + (HierarchyFullTailPrefix C m).length)), alpha ∈ MissingColors G P.coloring (T.vertex + (Fin.last T.length)) → alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + +private theorem helper_tailException_375.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A)) (_ : TreeSequenceInitialSegment A T) (hlen + : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), + HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : + (1 : ℕ) ≤ j) (_ : j < T.length - A.length), + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = + some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx i trans A starEq hAT hlen B hBT fullEq + fullB elementary vertexMem R j hj hjlt c hc t hlo hhi hcol + clear * - R j hj hjlt c hc t hlo hhi hcol starEq hAT hBT fullEq fullB elementary vertexMem + let U := HierarchyFullTailPrefix R.counterexample j + have hUlen : U.length = A.length + j := by + simp only [U, HierarchyFullTailPrefix, TreeSequencePrefix] + rw [starEq R] + exact min_eq_left (by have := hAT.1; omega) + have hUT : TreeSequenceInitialSegment U T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + let u : Fin U.length := ⟨t.val, by rw [hUlen]; omega⟩ + have hut : Fin.castLE hUT.1 u = t := Fin.ext rfl + have hcU : c ∈ MissingColors G R.coloring (U.vertex (Fin.last U.length)) := by + dsimp only [U] + rw [fullEq R] + exact hc + have hcolU : R.coloring (U.edge u) = some c := by + rw [← hUT.2.2 u, hut]; exact hcol + have hex := HierarchyTailMissingColorExclusion G k e0 R.corresponding.replacementInput T + R.coloring R.corresponding.replacementETT R.replacementBase R.counterexample.hierarchy + (by + change ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1))) + rw [fullB R] + exact elementary R) + j hj (by + rw [starEq R] + exact hjlt) c hcU u + (by + change (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length ≤ t.val + rw [starEq R] + exact hlo) + (by + change t.val < (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + j + rw [starEq R] + exact hhi) hcolU + obtain ⟨hzero, hcore, hval, f, hstep, hkind, hedges, hedge, hcF, hstored⟩ := hex + have hAval : t.val = A.length := by + change u.val = _ at hval + rw [starEq R] at hval + exact hval + have hAn : A = R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc := by + rw [← starEq R] + have hs : HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = R.replacementBase.core := by + simp [HierarchyStarredStage, hzero, Fin.last] + exact hs.trans hcore + obtain ⟨i, hi⟩ := T.attaches t + let a : Fin (A.length + 1) := ⟨i.val, by simpa only [hAval] using i.isLt⟩ + let old : Fin (T.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ t.isLt)) + have ha : Fin.castLE (Nat.succ_le_succ hAT.1) a = old := Fin.ext rfl + refine ⟨⟨T.vertex old, ?_, ?_⟩, hstored⟩ + · rw [← hAn, ← ha, hAT.2.1 a] + exact vertexMem A a + · rw [Incident, hi] + exact Sym2.mem_mk_right _ _ + +private theorem helper_branch_520.{u_1, u_2} : + helperBranch520Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation P alpha + set A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + intro hlen B vertexMem firstAt stageSwitch gammaTransport gammaChoice m hmLower P alpha haLast + hmT X hAX hXB hAXlt jm jnext tnext haM theta htheta nextMember excNext excM avoidNext + hThetaStored + obtain ⟨gamma, hgamma, _⟩ := gammaChoice P theta hThetaStored (T.edge tnext) + obtain ⟨P1, hmissing1, _, _, hterminal1⟩ := stageSwitch P X hAX hAXlt hXB + gamma alpha theta hThetaStored hgamma + (by rw [firstAt P theta jnext htheta]; exact le_rfl) + jm (by dsimp [jm]; omega) (by dsimp [jm, X, TreeSequencePrefix]; omega) + haM (Or.inr haLast) (avoidNext P theta gamma hThetaStored hgamma htheta) + (excM P alpha haM) + have hgLast : gamma ∈ MissingColors G P1.coloring (T.vertex (Fin.last T.length)) := hterminal1 + haLast + have htheta1 : theta ∈ MissingColors G P1.coloring (B.vertex jnext) := by + rw [hmissing1 _ (vertexMem B jnext)]; exact htheta + obtain ⟨hThetaStored1, heqGamma⟩ := gammaTransport P P1 theta hThetaStored + have hgamma1 : gamma ∈ P1.counterexample.good.gamma + (Fin.last P1.counterexample.hierarchy.dividerCount) theta := by + rw [← heqGamma]; exact hgamma + obtain ⟨P2, hmissing2, _, hterminal2, _⟩ := stageSwitch P1 X hAX hAXlt hXB + gamma theta theta hThetaStored1 hgamma1 + (by rw [firstAt P1 theta jnext htheta1]; exact le_rfl) + jnext (by dsimp [jnext]; omega) (by rfl) + htheta1 (Or.inl hgLast) (avoidNext P1 theta gamma hThetaStored1 hgamma1 htheta1) + (excNext P1 theta htheta1) + exact nextMember P2 theta (by rw [hmissing2 _ (vertexMem B jnext)]; exact htheta1) + (hterminal2 hgLast) + +private noncomputable abbrev helperCS615.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (alpha theta : Fin k) → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G P.coloring alpha theta + (Sum.inl (T.vertex (Fin.last T.length))); + (corr : + CorrespondingExtendedTashkinovTree G k e0 + P.corresponding.replacementETT sigma T) → + MaximumProperty corr.replacementETT → + (bs : HierarchyBase corr.replacementETT sigma) → + (K : TashkinovHierarchy corr.replacementETT bs) → + GoodHierarchy K → + ¬ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet T) → + HierarchyCounterexample bs := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha theta sigma corr hmaximum bs K + goodK hnot + exact { + positive := by rw [corr.rungAgreement]; exact P.counterexample.positive + hierarchy := K + good := goodK + maximum := hmaximum + notElementary := hnot } + +private theorem helper_continuation_613.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hsituation : + HierarchyPathNumber C.hierarchy = (1 : ℕ)) (_ : HierarchyReplacementPresentation G k e0 + input T phi ett base C ctx) (_ : Fin k) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A)) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by + omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by + omega + )); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (m : ℕ) (hmLower : HierarchyPathNumber C.hierarchy ≤ m) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), alpha ∉ + HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) → + ∀ (hmT : A.length + (m + (1 : ℕ)) < T.length), + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (m + (1 : ℕ))) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (m + (1 : ℕ))) => ( + by + omega + )) (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) ≤ T.length) => ( + by + omega + )); + let jm : Fin (B.length + (1 : ℕ)) := (⟨A.length + m, id (Decidable.byContradiction fun (a : + ¬A.length + m < T.length - (1 : ℕ) + (1 : ℕ)) => ( + by + omega + ))⟩ : Fin (B.length + (1 : ℕ))); + let jnext : Fin (B.length + (1 : ℕ)) := (⟨A.length + (m + (1 : ℕ)), id + (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) < T.length - (1 : ℕ) + (1 : + ℕ)) => ( + by + omega + ))⟩ : Fin (B.length + (1 : ℕ))); + ∀ theta ∈ MissingColors G P.coloring (B.vertex jnext), ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ MissingColors G S.coloring (B.vertex jnext), c ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)) → m + (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T + phi ett base C ctx) → theta ∉ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + alpha) → alpha ≠ theta → (↑(HierarchyFirstMissingPosition P.coloring T alpha) : ℕ) = (↑jm + : ℕ) → (↑(HierarchyFirstMissingPosition P.coloring T theta) : ℕ) = (↑jnext : ℕ) → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) (T.vertex + (HierarchyFirstMissingPosition P.coloring T theta)) → ColoredVertexSetElementary G + P.coloring (TreeSequenceVertexSet (HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)))) → alpha ∈ TreeMissingColors + P.coloring (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength + P.counterexample - (1 : ℕ))) ∧ theta ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 : + ℕ))) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G P.coloring alpha theta + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G P.coloring x) → + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha theta (Sum.inl + (T.vertex (Fin.last T.length))); ( + ∀ v ∈ TreeSequenceVertexSet A, TreeVertexOrder T v (T.vertex (HierarchyFirstMissingPosition + P.coloring T alpha))) → m + (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T + phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation P alpha trans A starEq hlen B + hBT vertexMem m hmLower P alpha haLast hAlphaStored hmT X jm jnext theta htheta nextMember + hThetaStored haUnused hne iaEq ibEq hordered hprefixP hmissingP hmissing sigma hprecedes + have hunusedBetween : alpha ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + (HierarchyFirstMissingPosition P.coloring T alpha).val ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition P.coloring T theta).val ∧ + P.coloring (T.edge t) = some c) := by + intro hh + obtain ⟨_, t, hlo, hhi, hc⟩ := Finset.mem_filter.mp hh + rw [iaEq] at hlo + rw [ibEq] at hhi + exact haUnused t (by dsimp [jm] at hlo; omega) hhi hc + obtain ⟨_, _, _, _, corr, hmaximum, bs, K, goodK, hsameGood⟩ := + StableChangeCaseThree G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext.proper P.minimumContext.oneEdgeUncolored P.minimumContext.lowerRung + P.minimumContext.fewerDividers P.minimumContext.lexicographicMinimality hprefixP + P.minimumContext.largeMissingSet alpha theta hne hmissingP _ sigma rfl + (by rw [starEq P]; exact hprecedes) hordered + ⟨hAlphaStored, hThetaStored⟩ hunusedBetween + have hthetaLast : theta ∈ MissingColors G sigma (T.vertex (Fin.last T.length)) := + (TwoColorComponentSwapMissingBehavior G P.coloring alpha theta hne + P.minimumContext.proper (Sum.inl (T.vertex (Fin.last T.length)))).2.1 _ (by rfl) haLast + have hthetaNext : theta ∈ MissingColors G sigma (B.vertex jnext) := by + rw [hmissing _ (vertexMem B jnext)] + exact htheta + have hnot : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) := by + intro he + exact Finset.disjoint_left.mp (he + (TreeSequenceInitialSegmentVertexSetSubset hBT (vertexMem B jnext)) + (vertexMem T (Fin.last T.length)) (by + intro hh + have hh := T.vertex_injective ((hBT.2.1 jnext).trans hh) + have hh := congrArg Fin.val hh; dsimp [jnext] at hh; omega)) hthetaNext hthetaLast + let CS : HierarchyCounterexample bs := by + exact @helperCS615 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@theta) (@corr) + (@hmaximum) (@bs) (@K) (@goodK) (@hnot) + obtain ⟨S, hS⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi ett base C ctx + P sigma corr bs CS hsameGood + exact nextMember S theta (by rw [hS]; exact hthetaNext) (by rw [hS]; exact hthetaLast) + +private theorem helper_branch_542.{u_1, u_2} : + helperBranch542Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation P alpha componentData trans A + starEq hAT hlen B hBT fullB elementary vertexMem firstAt outsideA notRaw m hmLower P alpha + ha haLast hAlphaStored hmT X jm jnext haM theta htheta nextMember excM hThetaStored + have haOutside := outsideA P alpha jm (by dsimp [jm]; omega) haM + have hthetaOutside := outsideA P theta jnext (by dsimp [jnext]; omega) htheta + have haRaw := notRaw P alpha haOutside hAlphaStored + have hthetaRaw := notRaw P theta hthetaOutside hThetaStored + have haUnused : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + P.coloring (T.edge t) ≠ some alpha := by + intro t hlo hhi hc + exact haRaw (excM P alpha haM t hlo hhi hc).2 + have hne : alpha ≠ theta := by + intro he + have hvertices : B.vertex jm ≠ B.vertex jnext := by + intro hh + have hh := congrArg Fin.val (B.vertex_injective hh) + dsimp [jm, jnext] at hh + omega + exact Finset.disjoint_left.mp (elementary P + (vertexMem B jm) (vertexMem B jnext) hvertices) haM (he ▸ htheta) + have iaEq := firstAt P alpha jm haM + have ibEq := firstAt P theta jnext htheta + have jaEq : Fin.castLE (Nat.succ_le_succ hBT.1) jm = + HierarchyFirstMissingPosition P.coloring T alpha := Fin.ext iaEq.symm + have jbEq : Fin.castLE (Nat.succ_le_succ hBT.1) jnext = + HierarchyFirstMissingPosition P.coloring T theta := Fin.ext ibEq.symm + have hordered : TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) + (T.vertex (HierarchyFirstMissingPosition P.coloring T theta)) := + ⟨_, _, rfl, rfl, by dsimp [jm, jnext] at iaEq ibEq; omega⟩ + have hunused : alpha ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < (HierarchyFirstMissingPosition P.coloring T theta).val ∧ + P.coloring (T.edge t) = some c) := by + intro hh + obtain ⟨_, t, hlo, hhi, hc⟩ := Finset.mem_filter.mp hh + exact haUnused t hlo (by rw [ibEq] at hhi; exact hhi) hc + have haB : alpha ∈ TreeMissingColors P.coloring B := + Finset.mem_biUnion.mpr ⟨B.vertex jm, vertexMem B jm, haM⟩ + have hthetaB : theta ∈ TreeMissingColors P.coloring B := + Finset.mem_biUnion.mpr ⟨B.vertex jnext, vertexMem B jnext, htheta⟩ + have hprefixP : ColoredVertexSetElementary G P.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - 1))) := by + rw [fullB P] + exact elementary P + have hmissingP : alpha ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1)) ∧ + theta ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1)) + := by + rw [fullB P] + exact ⟨haB, hthetaB⟩ + have change := ChangeLemma G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext.proper P.minimumContext.oneEdgeUncolored P.minimumContext.lowerRung + P.minimumContext.fewerDividers P.minimumContext.lexicographicMinimality hprefixP + P.minimumContext.largeMissingSet alpha theta hne hmissingP + (by dsimp only; rw [starEq P]; intro _; exact ⟨hordered, hunused⟩) + have hdisStored : Disjoint ({alpha, theta} : Finset (Fin k)) + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)) := by + apply Finset.disjoint_left.mpr + intro c hc hd + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with rfl | rfl + · exact hAlphaStored hd + · exact hThetaStored hd + have hdisRaw : Disjoint ({alpha, theta} : Finset (Fin k)) + (TashkinovStoredColors P.corresponding.replacementETT.series.data + (Fin.last P.corresponding.replacementETT.rounds)) := by + apply Finset.disjoint_left.mpr + intro c hc hd + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with rfl | rfl + · exact haRaw hd + · exact hthetaRaw hd + have hsame : TwoColorComponent G P.coloring alpha theta (Sum.inl (B.vertex jm)) = + TwoColorComponent G P.coloring alpha theta (Sum.inl (B.vertex jnext)) := by + have hh : TwoColorComponent G P.coloring alpha theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha))) = + TwoColorComponent G P.coloring alpha theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T theta))) := by + by_cases hq : P.counterexample.hierarchy.dividerCount = 0 + · exact change.2.1 ⟨hq, Or.inr hdisRaw⟩ + · exact change.1 ⟨by omega, Or.inr hdisStored⟩ + rw [← jaEq, ← jbEq, hBT.2.1 jm, hBT.2.1 jnext] at hh + exact hh + obtain ⟨hdis, hpath, hmissing⟩ := componentData P.coloring alpha theta hne + P.minimumContext.proper (TreeSequenceVertexSet B) (elementary P) + (B.vertex jm) (B.vertex jnext) (T.vertex (Fin.last T.length)) + (vertexMem B jm) (vertexMem B jnext) + (by intro hh; have hh := congrArg Fin.val (B.vertex_injective hh) + dsimp [jm, jnext] at hh; omega) + (by intro hh; have hh := T.vertex_injective (hh.trans (hBT.2.1 jm).symm) + have hh := congrArg Fin.val hh; dsimp [jm] at hh; omega) + (by intro hh; have hh := T.vertex_injective (hh.trans (hBT.2.1 jnext).symm) + have hh := congrArg Fin.val hh; dsimp [jnext] at hh; omega) + haM htheta (Or.inl haLast) hsame + let sigma := TwoColorComponentSwap G P.coloring alpha theta + (Sum.inl (T.vertex (Fin.last T.length))) + have hprecedes : ∀ v ∈ TreeSequenceVertexSet A, + TreeVertexOrder T v (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) := by + intro v hv + obtain ⟨j, hj⟩ : ∃ j, A.vertex j = v := by simpa [TreeSequenceVertexSet] using hv + refine ⟨Fin.castLE (Nat.succ_le_succ hAT.1) j, _, (hAT.2.1 j).trans hj, rfl, ?_⟩ + change j.val < (HierarchyFirstMissingPosition P.coloring T alpha).val + rw [iaEq] + have := j.isLt + dsimp [jm] + omega + exact helper_continuation_613 G k e0 input T phi ett base C ctx hsituation P alpha trans starEq + hlen hBT vertexMem m hmLower + P alpha haLast hAlphaStored hmT theta htheta nextMember hThetaStored haUnused hne iaEq ibEq + hordered hprefixP hmissingP hmissing hprecedes +private theorem helper_excM_924.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hsituation : + HierarchyPathNumber C.hierarchy = (1 : ℕ)), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (_ : TreeSequenceInitialSegment A T) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by + omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by + omega + )); + ∀ (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : (1 : + ℕ) ≤ j) (_ : j < T.length - A.length), + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = + some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds))) (_ : ( + ∀ (t : Fin T.length) (_ : A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ)), G.ends + (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ))) (m : ℕ) (hmLower : + HierarchyPathNumber C.hierarchy ≤ m) (_ : (1 : ℕ) ≤ m) (hmT : A.length + (m + (1 : ℕ)) < + T.length), + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (m + (1 : ℕ))) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (m + (1 : ℕ))) => + by omega + ) (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) ≤ T.length) => ( + by + omega + )); + let Y : TreeSequence G e0 := TreeSequencePrefix T (A.length + m) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + m) => + by omega + ) (Decidable.byContradiction fun (a : ¬A.length + m ≤ T.length) => + by omega + ); + let jm : Fin (B.length + (1 : ℕ)) := (⟨A.length + m, id (Decidable.byContradiction fun (a : + ¬A.length + m < T.length - (1 : ℕ) + (1 : ℕ)) => + by omega + )⟩ : Fin (B.length + (1 : ℕ))); + let _ : Fin T.length := (⟨A.length + m, + by omega + ⟩ : Fin T.length); + ∀ (_ : HierarchyFullTailPrefix C m = Y) (_ : Y.vertex (Fin.last Y.length) = B.vertex jm) (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jm), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation A hAT hlen B tailException + consecutive m hmLower hm hmT X Y jm tnext hfullY hYvertex R b hb t hlo hhi hcol + by_cases ht : t.val < A.length + m + · exact tailException R m (by omega) (by have := hAT.1; omega) b + (by rw [hfullY, hYvertex]; exact hb) t hlo ht hcol + · have htEq : t = tnext := Fin.ext + (by change t.val < A.length + (m + 1) at hhi; dsimp [tnext]; omega) + subst t + have he := consecutive tnext (by dsimp [tnext]; omega) + have hv : T.vertex tnext.castSucc = B.vertex jm := rfl + have hi : Incident G (B.vertex jm) (T.edge tnext) := by + rw [Incident, he, hv] + exact Sym2.mem_mk_left _ _ + exact ((Finset.mem_sdiff.mp hb).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, T.edge tnext, hi, hcol⟩)).elim + +private theorem helper_advance_481.{u_1, u_2} : + helperAdvance481Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i P alpha + componentData trans common + set A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + intro starEq hAT hlen B hBT fullB elementary vertexMem firstAt stageSwitch gammaTransport + gammaUnused outsideA notRaw tailException consecutive gammaChoice m hmLower hmUpper P alpha + ha haLast hAlphaStored + have hm : 1 ≤ m := by simpa only [hsituation] using hmLower + have hmT : A.length + (m + 1) < T.length := by + change m < (T.length - A.length) - 1 at hmUpper + have := hAT.1 + omega + let X := TreeSequencePrefix T (A.length + (m + 1)) (by have := A.positive; omega) (by omega) + let Y := TreeSequencePrefix T (A.length + m) (by have := A.positive; omega) (by omega) + have hXT : TreeSequenceInitialSegment X T := ⟨by exact le_of_lt hmT, fun _ => rfl, fun _ => rfl⟩ + have hAX : TreeSequenceInitialSegment A X := common hAT hXT + (by dsimp [X, TreeSequencePrefix]; omega) + have hXB : TreeSequenceInitialSegment X B := + common hXT hBT (by dsimp [X, B, TreeSequencePrefix]; omega) + have hAXlt : A.length < X.length := by dsimp [X, TreeSequencePrefix]; omega + let jm : Fin (B.length + 1) := ⟨A.length + m, by dsimp [B, TreeSequencePrefix]; omega⟩ + let jnext : Fin (B.length + 1) := ⟨A.length + (m + 1), by dsimp [B, TreeSequencePrefix]; omega⟩ + let tnext : Fin T.length := ⟨A.length + m, by omega⟩ + have hfullY : HierarchyFullTailPrefix C m = Y := by + have hn : min (A.length + m) T.length = A.length + m := min_eq_left (by omega) + simp only [HierarchyFullTailPrefix] + change TreeSequencePrefix T (min (A.length + m) T.length) _ _ = Y + simp only [hn] + rfl + have hfullX : HierarchyFullTailPrefix C (m + 1) = X := by + have hn : min (A.length + (m + 1)) T.length = A.length + (m + 1) := min_eq_left (by omega) + simp only [HierarchyFullTailPrefix] + change TreeSequencePrefix T (min (A.length + (m + 1)) T.length) _ _ = X + simp only [hn] + rfl + have hYvertex : Y.vertex (Fin.last Y.length) = B.vertex jm := rfl + have hXvertex : X.vertex (Fin.last X.length) = B.vertex jnext := rfl + have haM : alpha ∈ MissingColors G P.coloring (B.vertex jm) := by + rw [hfullY, hYvertex] at ha + exact ha + obtain ⟨theta, htheta⟩ := hvertexMissing P.coloring P.minimumContext.proper + P.minimumContext.oneEdgeUncolored (B.vertex jnext) + have nextMember (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (hc : c ∈ MissingColors G S.coloring (B.vertex jnext)) + (hcLast : c ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) : + m + 1 ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨by omega, by omega⟩, S, c, ?_, hcLast⟩ + rw [hfullX, hXvertex] + exact hc + have excNext (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (b : Fin k) (hb : b ∈ MissingColors G R.coloring (B.vertex jnext)) + (t : Fin T.length) (hlo : A.length ≤ t.val) (hhi : t.val < X.length) + (hcol : R.coloring (T.edge t) = some b) : + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + b ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + apply tailException R (m + 1) (by omega) (by have := hAT.1; omega) b + (by rw [hfullX, hXvertex]; exact hb) t hlo + (by exact hhi) hcol + have excM (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (b : Fin k) (hb : b ∈ MissingColors G R.coloring (B.vertex jm)) + (t : Fin T.length) (hlo : A.length ≤ t.val) (hhi : t.val < X.length) + (hcol : R.coloring (T.edge t) = some b) : + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + b ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + exact helper_excM_924 G k e0 input T phi ett base C ctx hsituation hAT hlen tailException + consecutive m hmLower hm hmT + hfullY hYvertex R b hb t hlo hhi hcol + have avoidNext (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (ha : a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) + (he : eta ∈ MissingColors G R.coloring (B.vertex jnext)) : + ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) ≠ some a := by + intro t hlo hhi + apply gammaUnused R eta a heta ha t hlo + rw [firstAt R eta jnext he] + exact hhi + have avoidM (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (ha : a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) + (he : eta ∈ MissingColors G R.coloring (B.vertex jm)) + (hgap : R.coloring (T.edge tnext) ≠ some a) : + ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) ≠ some a := by + intro t hlo hhi + by_cases ht : t.val < A.length + m + · apply gammaUnused R eta a heta ha t hlo + rw [firstAt R eta jm he] + exact ht + · have htEq : t = tnext := Fin.ext + (by change t.val < A.length + (m + 1) at hhi; dsimp [tnext]; omega) + simpa only [htEq] using hgap + by_cases hThetaStored : theta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) + · exact @helper_branch_520 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hsituation P alpha hlen vertexMem firstAt stageSwitch + gammaTransport gammaChoice m hmLower P alpha haLast hmT hAX hXB hAXlt haM theta htheta + nextMember excNext excM avoidNext hThetaStored + · exact @helper_branch_542 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hsituation P alpha componentData trans starEq hAT hlen hBT fullB + elementary vertexMem firstAt outsideA notRaw m hmLower P alpha ha haLast hAlphaStored hmT + haM theta htheta nextMember excM hThetaStored +private theorem helper_firstAt_864.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (hlen : (4 : + ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (_ : ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))) (_ : c ∈ + MissingColors G psi (T.vertex j)), HierarchyFirstMissingPosition psi T c ≤ j)) (_ : ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (_ : (↑(HierarchyFirstMissingPosition psi T c) : + ℕ) < T.length), c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T + c)))) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) + (j : Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx i hlen B hBT elementary vertexMem firstLe + firstMem R c j hc + clear * - G T B R c j hc elementary vertexMem firstLe firstMem hBT + have hcT : c ∈ MissingColors G R.coloring + (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) j)) := by + rw [hBT.2.1 j]; exact hc + have hle := firstLe R.coloring c _ hcT + have hlt : (HierarchyFirstMissingPosition R.coloring T c).val < T.length := by + have := j.isLt + change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle + have hblen : B.length = T.length - 1 := rfl + omega + let x : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T c).val, by + change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle + omega⟩ + have hxT : Fin.castLE (Nat.succ_le_succ hBT.1) x = + HierarchyFirstMissingPosition R.coloring T c := Fin.ext rfl + have hcx : c ∈ MissingColors G R.coloring (B.vertex x) := by + rw [← hBT.2.1 x, hxT] + exact firstMem R.coloring c hlt + have he : B.vertex x = B.vertex j := by + by_contra hn + exact Finset.disjoint_left.mp (elementary R (vertexMem B x) (vertexMem B j) hn) hcx hc + exact congrArg Fin.val (B.vertex_injective he) + +private theorem helper_firstMem_1185.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + classical + intro V E _ _ G k e0 T psi c hlt + let _ := Fintype.ofFinite V + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + +private theorem helper_outsideA_1255.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (_ : TreeSequenceInitialSegment A T) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment A B) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) + (j : Fin (B.length + (1 : ℕ))) (_ : A.length < (↑j : ℕ)) (_ : c ∈ MissingColors G + R.coloring (B.vertex j)), c ∉ TreeMissingColors R.coloring A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx i trans A hAT hlen B hBT hAB elementary + vertexMem R c j hj hc + clear * - R c j hj hc hAT hBT hAB elementary vertexMem + rintro hm + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + obtain ⟨a, ha⟩ : ∃ a, A.vertex a = v := by simpa [TreeSequenceVertexSet] using hv + have hne : v ≠ B.vertex j := by + intro he + have hh := T.vertex_injective ((hAT.2.1 a).trans + (ha.trans (he.trans (hBT.2.1 j).symm))) + have hh := congrArg Fin.val hh + have := a.isLt + change a.val = j.val at hh + omega + exact Finset.disjoint_left.mp (elementary R + (TreeSequenceInitialSegmentVertexSetSubset hAB hv) (vertexMem B j) hne) hcv hc + +private theorem helper_consecutive_1298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : ℕ) + (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + ∀ (t : Fin T.length) (_ : A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ)), + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C i hpathUpper A t ht + clear * - G T A C t ht hpathUpper + let candidates := (Finset.Icc 1 (T.length - A.length)).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + have hp : HierarchyPathNumber C.hierarchy = + (if h : candidates.Nonempty then candidates.min' h else T.length - A.length) := rfl + have hn : candidates.Nonempty := by + by_contra hn + rw [dite_eq_right hn] at hp + have hu : HierarchyPathNumber C.hierarchy < T.length - A.length := hpathUpper + omega + have hm : candidates.min' hn = HierarchyPathNumber C.hierarchy := by + simpa only [dite_eq_left hn] using hp.symm + have hh := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + rw [hm] at hh + exact hh t ht + +private theorem helper_trans_1517.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (_ : ℕ) + {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y + Z → TreeSequenceInitialSegment X Z := by + classical + intro V E G e0 i X Y Z hXY hYZ + clear * - hXY hYZ + refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +private theorem helper_common_1527.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (_ : ℕ), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by + classical + intro V E G e0 i trans X Y Z hXZ hYZ hXY + clear * - hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + +private theorem helper_hAT_1558.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C i A + have starNext (j : Fin (C.hierarchy.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy j) + (C.hierarchy.stage j.succ) := + Fin.cases C.hierarchy.coreInsideFirst (fun i => C.hierarchy.nested i.succ) j + simpa only [Fin.succ_last, C.hierarchy.terminalStage] using + starNext (Fin.last C.hierarchy.dividerCount) + +private theorem helper_fullB_1581.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → (3 : ℕ) ≤ T.length - A.length → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx i A starEq htail hlen B R + have hn : min ((HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + + (HierarchyFullTailLength R.counterexample - 1)) T.length = T.length - 1 := by + unfold HierarchyFullTailLength + dsimp only + rw [starEq R] + omega + simp only [HierarchyFullTailPrefix, hn] + rfl + +private theorem helper_elementary_1593.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) + (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = + B) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx i hlen B fullB R + have h : ColoredVertexSetElementary G R.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 + R.corresponding.replacementInput T R.coloring R.corresponding.replacementETT + R.replacementBase R.counterexample R.minimumContext.proper + R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + R.minimumContext.largeMissingSet + intro u hu v hv hne + exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne + +private theorem helper_firstLe_1610.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (psi : PartialEdgeColoring E k) (c : Fin k) + (j : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G psi (T.vertex j) → + HierarchyFirstMissingPosition psi T c ≤ j := by + classical + intro V E _ _ G k e0 T psi c j hj + let _ := Fintype.ofFinite V + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ + have hn : candidates.Nonempty := ⟨j, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates j hm + +private theorem helper_lastData_1633.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx R + obtain ⟨hcount, hdata⟩ := R.sameGood.2 + have hh := hdata (Fin.last C.hierarchy.dividerCount) + have hidx : Fin.cast (congrArg (fun q => q + 1) hcount) + (Fin.last C.hierarchy.dividerCount) = + Fin.last R.counterexample.hierarchy.dividerCount := Fin.ext hcount + simpa only [hidx] using hh + +private theorem helper_gammaTransport_1647.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma + (Fin.last C.hierarchy.dividerCount) eta = R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta) → + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans lastData R S eta heta + clear * - R S eta heta lastData + have hOrig : eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) + := by + rw [(lastData R).1]; exact heta + refine ⟨?_, ((lastData R).2 eta hOrig).symm.trans ((lastData S).2 eta hOrig)⟩ + rw [← (lastData S).1] + exact hOrig + +private theorem helper_gammaUnused_1663.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), + eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition + R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R eta a heta ha t hlo hhi hc + have hnot := (Finset.mem_sdiff.mp (R.counterexample.good.avoidance + (Fin.last R.counterexample.hierarchy.dividerCount) eta heta ha)).2 + apply hnot + unfold HierarchySegmentColors + dsimp only + rw [starEq R, Fin.succ_last, R.counterexample.hierarchy.terminalStage] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, + lt_min hhi t.isLt, hc⟩ + +private theorem helper_notRaw_1688.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R c hcA hcD hm + apply hcD + unfold HierarchyStoredColorsAt + dsimp only + rw [starEq R] + exact Finset.mem_sdiff.mpr ⟨hm, hcA⟩ + +private theorem helper_gammaChoice_1720.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans R eta heta f + clear * - R eta heta f + by_contra hn + push Not at hn + have hc : (R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta).card ≤ 1 := by + apply Finset.card_le_one.mpr + intro a ha b hb + exact Option.some.inj ((hn a ha).symm.trans (hn b hb)) + rw [R.counterexample.good.twoColors _ eta heta] at hc + omega + +private theorem helper_advance_1736.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber + C.hierarchy = (1 : ℕ) → ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (_ : ℕ), ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → + ∀ (B : Finset V), ColoredVertexSetElementary G psi B → + ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ + MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → TreeSequenceInitialSegment A T → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); TreeSequenceInitialSegment B T → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0), TreeSequenceInitialSegment A X → A.length < X.length → TreeSequenceInitialSegment X B + → + ∀ (a b eta : Fin k), eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ X.length → + ∀ (jb : Fin (B.length + (1 : ℕ))), A.length < (↑jb : ℕ) → (↑jb : ℕ) ≤ X.length → b ∈ + MissingColors G R.coloring (B.vertex jb) → a ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)))) → ( + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), + eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition + R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))), A.length < (↑j : ℕ) → c ∈ MissingColors G R.coloring (B.vertex + j) → c ∉ TreeMissingColors R.coloring A) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), (1 : ℕ) ≤ + j → j < T.length - A.length → + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = + some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → ( + ∀ (t : Fin T.length), A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ) → G.ends (T.edge + t) = s(T.vertex t.castSucc, T.vertex t.succ)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a) → + ∀ (m : ℕ), HierarchyPathNumber C.hierarchy ≤ m → m < HierarchyFullTailLength C - (1 : ℕ) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C m).vertex (Fin.last + (HierarchyFullTailPrefix C m).length)), alpha ∈ MissingColors G P.coloring (T.vertex + (Fin.last T.length)) → alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i componentData + trans common A starEq hAT hlen B hBT fullB elementary vertexMem firstAt stageSwitch + gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m hmLower + hmUpper P alpha ha haLast hAlphaStored + exact @helper_advance_481 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx hsituation hvertexMissing i P alpha componentData trans + common starEq hAT hlen hBT fullB elementary vertexMem firstAt stageSwitch + gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m + hmLower hmUpper P alpha ha haLast hAlphaStored + +private theorem helper_advance_2294.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber + C.hierarchy = (1 : ℕ) → ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (_ : ℕ), ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → + ∀ (B : Finset V), ColoredVertexSetElementary G psi B → + ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ + MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → ( + have A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); TreeSequenceInitialSegment A T) → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); TreeSequenceInitialSegment B T → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0), TreeSequenceInitialSegment A X → A.length < X.length → TreeSequenceInitialSegment X B + → + ∀ (a b eta : Fin k), eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ X.length → + ∀ (jb : Fin (B.length + (1 : ℕ))), A.length < (↑jb : ℕ) → (↑jb : ℕ) ≤ X.length → b ∈ + MissingColors G R.coloring (B.vertex jb) → a ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)))) → ( + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), + eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition + R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))), A.length < (↑j : ℕ) → c ∈ MissingColors G R.coloring (B.vertex + j) → c ∉ TreeMissingColors R.coloring A) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), (1 : ℕ) ≤ + j → j < T.length - A.length → + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = + some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → ( + ∀ (t : Fin T.length), A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ) → G.ends (T.edge + t) = s(T.vertex t.castSucc, T.vertex t.succ)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a) → + ∀ (m : ℕ), HierarchyPathNumber C.hierarchy ≤ m → m < HierarchyFullTailLength C - (1 : ℕ) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C m).vertex (Fin.last + (HierarchyFullTailPrefix C m).length)), alpha ∈ MissingColors G P.coloring (T.vertex + (Fin.last T.length)) → alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i componentData + trans common A starEq hAT hlen B hBT fullB elementary vertexMem firstAt stageSwitch + gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m hmLower + hmUpper P alpha ha haLast hAlphaStored + exact @helper_advance_1736 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hsituation) (@hvertexMissing) (@i) (@componentData) (@trans) (@common) (@starEq) + (@hAT) (@hlen) (@hBT) (@fullB) (@elementary) (@vertexMem) (@firstAt) (@stageSwitch) + (@gammaTransport) (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) + (@gammaChoice) (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored) + +private theorem helper_sameLast_2427.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {a b : ℕ} (s : Fin (a + + (2 : ℕ)) → TreeSequence G e0) (t : Fin (b + (2 : ℕ)) → TreeSequence G e0) (u v : + TreeSequence G e0), a = b → s ≍ t → u = v → (Fin.cases u (fun (i : Fin a) ↦ s + i.castSucc.succ) (Fin.last a) : TreeSequence G e0) = (Fin.cases v (fun (i : Fin b) ↦ t + i.castSucc.succ) (Fin.last b) : TreeSequence G e0) := by + classical + intro V E G e0 a b s t u v hab hst huv + cases hab + have he : s = t := eq_of_heq hst + cases he + cases huv + rfl + +private theorem helper_advance_2571.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchyPathNumber C.hierarchy = (1 : ℕ)) (_ : + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) (_ : ℕ) (_ : + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (_ : a ≠ b) (_ : IsProperEdgeColoring G psi) + (B : Finset V) (_ : ColoredVertexSetElementary G psi B) (u v w : V) (_ : u ∈ B) (_ : v ∈ + B) (_ : u ≠ v) (_ : w ≠ u) (_ : w ≠ v) (_ : a ∈ MissingColors G psi u) (_ : b ∈ + MissingColors G psi v) (_ : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) (_ : + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v)), + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) (_ : + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) (_ : + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : + TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) (_ : + have A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); TreeSequenceInitialSegment A T) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + omega + ) ( + by + omega + ); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) (_ : + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0) (_ : TreeSequenceInitialSegment A X) (_ : A.length < X.length) (_ : + TreeSequenceInitialSegment X B) (a b eta : Fin k) (_ : eta ∈ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)) (_ : a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) (_ : + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length) (jb : Fin (B.length + + (1 : ℕ))) (_ : A.length < (↑jb : ℕ)) (_ : (↑jb : ℕ) ≤ X.length) (_ : b ∈ MissingColors G + R.coloring (B.vertex jb)) (_ : a ∈ MissingColors G R.coloring (T.vertex (Fin.last + T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length))) (_ : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) (_ : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)), + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)))) (_ : + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta : Fin k) (_ + : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k) (_ + : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)) (_ : a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta) (t : Fin T.length) (_ : A.length ≤ (↑t : ℕ)) + (_ : (↑t : ℕ) < (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ)), R.coloring + (T.edge t) ≠ some a) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (_ : A.length < (↑j : ℕ)) (_ : c ∈ MissingColors G R.coloring + (B.vertex j)), c ∉ TreeMissingColors R.coloring A) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (_ : c + ∉ TreeMissingColors R.coloring A) (_ : c ∉ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)), c ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : (1 : + ℕ) ≤ j) (_ : j < T.length - A.length) (c : Fin k) (_ : c ∈ MissingColors G R.coloring + ((HierarchyFullTailPrefix C j).vertex (Fin.last (HierarchyFullTailPrefix C j).length))) (t + : Fin T.length) (_ : A.length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < A.length + j) (_ : R.coloring + (T.edge t) = some c), TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ + TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) (_ : + ∀ (t : Fin T.length) (_ : A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ)), G.ends + (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta : Fin k) (_ : + eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)) (f : E), + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a) (m : ℕ) (_ : HierarchyPathNumber C.hierarchy ≤ m) (_ : m < + HierarchyFullTailLength C - (1 : ℕ)) (P : HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx) (alpha : Fin k) (_ : alpha ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C m).vertex (Fin.last (HierarchyFullTailPrefix C m).length))) (_ + : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) (_ : alpha ∉ + HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)), m + (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i componentData + trans common A starEq hAT hlen B hBT fullB elementary vertexMem firstAt stageSwitch + gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m hmLower + hmUpper P alpha ha haLast hAlphaStored + exact @helper_advance_2294 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hsituation) (@hvertexMissing) (@i) (@componentData) (@trans) (@common) (@starEq) + (@hAT) (@hlen) (@hBT) (@fullB) (@elementary) (@vertexMem) (@firstAt) (@stageSwitch) + (@gammaTransport) (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) + (@gammaChoice) (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored) + +theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hsituation : HierarchyPathNumber C.hierarchy = 1) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) + (i : ℕ) (hiLower : 1 ≤ i) + (hiUpper : i < HierarchyFullTailLength C - 1) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha : Fin k) + (hcommon : + alpha ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length)) ∧ + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length))) + (houtside : + let H := P.counterexample.hierarchy + alpha ∉ HierarchyStoredColorsAt H (Fin.last H.dividerCount)) : + i + 1 ∈ HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx := by + classical + have hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C := by + rw [hsituation] + omega + have componentData (psi : PartialEdgeColoring E k) (a b : Fin k) + (hne : a ≠ b) (hproper : IsProperEdgeColoring G psi) + (B : Finset V) (helem : ColoredVertexSetElementary G psi B) + (u v w : V) (hu : u ∈ B) (hv : v ∈ B) (huv : u ≠ v) + (hwu : w ≠ u) (hwv : w ≠ v) + (hau : a ∈ MissingColors G psi u) (hbv : b ∈ MissingColors G psi v) + (hw : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) + (hsame : TwoColorComponent G psi a b (Sum.inl u) = + TwoColorComponent G psi a b (Sum.inl v)) : + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) + (TwoColorComponent G psi a b (Sum.inl u)) ∧ + TwoColorPathComponent G psi a b (Sum.inl w) ∧ + (∀ x ∈ B, + MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = + MissingColors G psi x) := by + exact P2905_T2_ElementaryTerminalComponent G psi a b hne hproper + B helem u v w hu hv hwu hwv hau hbv hw hsame + classical + open scoped Sym2 in + have trans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + exact helper_trans_1517 (@G) (@e0) (@i) (@hXY) (@hYZ) + have common {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + exact @helper_common_1527 (@V) (@E) (@G) (@e0) (@i) (@trans) (@X) (@Y) (@Z) (@hXZ) (@hYZ) + (@hXY) + have sameLast : + ∀ {a b : ℕ} (s : Fin (a + 2) → TreeSequence G e0) (t : Fin (b + 2) → TreeSequence G e0) (u v : + TreeSequence G e0), a = b → HEq s t → u = v → Fin.cases (motive := fun _ => TreeSequence G + e0) u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = Fin.cases (motive := fun _ => + TreeSequence G e0) v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by + exact @helper_sameLast_2427 (@V) (@E) (@G) (@e0) + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + have starEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = A := + (sameLast _ _ _ _ R.sameGood.1.2.1 R.sameGood.1.2.2.1 R.sameGood.1.1).symm + have hAT := + helper_hAT_1558 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@i) + have htail : 3 ≤ T.length - A.length := by + have hu := hiUpper + change i < (T.length - A.length) - 1 at hu + omega + have hlen : 4 ≤ T.length := by have := A.positive; omega + let B := TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + have hBT : TreeSequenceInitialSegment B T := ⟨by dsimp [B, TreeSequencePrefix]; omega, + fun _ => rfl, fun _ => rfl⟩ + have hAB : TreeSequenceInitialSegment A B := + common hAT hBT (by dsimp [B, TreeSequencePrefix]; omega) + have fullEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (j : ℕ) : HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j := by + unfold HierarchyFullTailPrefix + dsimp only + simp only [starEq R] + rfl + have fullB (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1) = B := by + exact helper_fullB_1581 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@i) (@starEq) (@htail) + (@hlen) (@R) + have elementary (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by + exact helper_elementary_1593 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@i) (@hlen) (@fullB) (@R) + have vertexMem (U : TreeSequence G e0) (j : Fin (U.length + 1)) : + U.vertex j ∈ TreeSequenceVertexSet U := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) + (j : Fin (T.length + 1)) (hj : c ∈ MissingColors G psi (T.vertex j)) : + HierarchyFirstMissingPosition psi T c ≤ j := by + exact helper_firstLe_1610 (@G) (@k) (@e0) (@T) (@psi) (@c) (@j) (@hj) + have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + exact helper_firstMem_1185 G k e0 T psi c hlt + have firstAt (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + 1)) + (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : + (HierarchyFirstMissingPosition R.coloring T c).val = j.val := by + exact helper_firstAt_864 G k e0 input T phi ett base C ctx i hlen hBT elementary vertexMem + firstLe firstMem R c j hc + have stageSwitch := P2963_T1_TerminalKempeStageSwitch G k e0 input T phi ett base C ctx + A B (by omega) rfl rfl + have lastData (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta := by + exact helper_lastData_1633 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@R) + have gammaTransport + (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) : + eta ∈ HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + exact @helper_gammaTransport_1647 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@trans) + (@lastData) (@R) (@S) (@eta) (@heta) + have gammaUnused (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (ha : a ∈ R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta) + (t : Fin T.length) (hlo : A.length ≤ t.val) + (hhi : t.val < (HierarchyFirstMissingPosition R.coloring T eta).val) : + R.coloring (T.edge t) ≠ some a := by + exact helper_gammaUnused_1663 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@starEq) + (@R) (@eta) (@a) (@heta) (@ha) (@t) (@hlo) (@hhi) + have outsideA (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + 1)) (hj : A.length < j.val) + (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : + c ∉ TreeMissingColors R.coloring A := by + exact helper_outsideA_1255 G k e0 input T phi ett base C ctx i trans hAT hlen hBT hAB + elementary vertexMem R c j hj hc + have notRaw (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (hcA : c ∉ TreeMissingColors R.coloring A) + (hcD : c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) : + c ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + exact helper_notRaw_1688 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@starEq) (@R) (@c) + (@hcA) (@hcD) + have tailException (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (j : ℕ) (hj : 1 ≤ j) (hjlt : j < T.length - A.length) + (c : Fin k) + (hc : c ∈ MissingColors G R.coloring + ((HierarchyFullTailPrefix C j).vertex (Fin.last (HierarchyFullTailPrefix C j).length))) + (t : Fin T.length) (hlo : A.length ≤ t.val) (hhi : t.val < A.length + j) + (hcol : R.coloring (T.edge t) = some c) : + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + c ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + exact helper_tailException_375 G k e0 input T phi ett base C ctx i trans starEq hAT hlen + hBT fullEq fullB elementary + vertexMem R j hj hjlt c hc t hlo hhi hcol + have consecutive (t : Fin T.length) + (ht : A.length + HierarchyPathNumber C.hierarchy ≤ t.val) : + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by + exact helper_consecutive_1298 G k e0 input T phi ett base C i hpathUpper t ht + have gammaChoice (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) (f : E) : + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a := by + exact @helper_gammaChoice_1720 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@trans) + (@R) (@eta) (@heta) (@f) + have advance (m : ℕ) (hmLower : HierarchyPathNumber C.hierarchy ≤ m) + (hmUpper : m < HierarchyFullTailLength C - 1) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k) + (ha : alpha ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C m).vertex (Fin.last (HierarchyFullTailPrefix C m).length))) + (haLast : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) + (hAlphaStored : alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)) : + m + 1 ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + exact @helper_advance_2571 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hsituation) (@hvertexMissing) (@i) (@componentData) (@trans) (@common) (@starEq) + (@hAT) (@hlen) (@hBT) (@fullB) (@elementary) (@vertexMem) (@firstAt) (@stageSwitch) + (@gammaTransport) (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) + (@gammaChoice) (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored) + exact advance i (by simpa only [hsituation] using hiLower) hiUpper + P alpha hcommon.1 hcommon.2 houtside + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneImpossible.lean new file mode 100644 index 0000000000..a8ce838394 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneImpossible.lean @@ -0,0 +1,46 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationOnePenultimateCommonMissing +public import LeanPool.GoldbergSeymour.HierarchySituationOneShorteningContradiction + +/-! +# Hierarchy Situation One Impossible + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchySituationOneImpossible {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hsituation : HierarchyPathNumber C.hierarchy = 1) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) : False := by + have hnonempty := HierarchyClaimNine G k e0 input T phi ett base C ctx + hsituation hvertexMissing + have hlast := HierarchySituationOnePenultimateCommonMissing G k e0 input T phi + ett base C ctx hsituation hvertexMissing hnonempty + exact HierarchySituationOneShorteningContradiction G k e0 input T phi ett base C + ctx hsituation hlast + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOnePenultimateCommonMissing.lean b/LeanPool/GoldbergSeymour/HierarchySituationOnePenultimateCommonMissing.lean new file mode 100644 index 0000000000..fa3f599264 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationOnePenultimateCommonMissing.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyClaimNine + +public import LeanPool.GoldbergSeymour.HierarchySituationOneAdvanceInsideStored +public import LeanPool.GoldbergSeymour.HierarchySituationOneAdvanceOutsideStored + +/-! +# Hierarchy Situation One Penultimate Common Missing + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchySituationOnePenultimateCommonMissing {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hsituation : HierarchyPathNumber C.hierarchy = 1) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) + (hnonempty : (HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx).Nonempty) : + HierarchyFullTailLength C - 1 ∈ + HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx := by + classical + let I := HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx + have hI : I.Nonempty := hnonempty + let i := I.max' hI + have hiI : i ∈ I := Finset.max'_mem I hI + have hiBounds : 1 ≤ i ∧ i ≤ HierarchyFullTailLength C - 1 := by + have hiFiltered : i ∈ + (Finset.Icc 1 (HierarchyFullTailLength C - 1)).filter (fun j => + ∃ P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx, + ∃ alpha : Fin k, + alpha ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C j).vertex + (Fin.last (HierarchyFullTailPrefix C j).length)) ∧ + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length))) := by + simpa [I, HierarchyEligibleCommonMissingIndices] using hiI + exact (Finset.mem_Icc.mp (Finset.mem_filter.mp hiFiltered).1) + have hiData : ∃ P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx, + ∃ alpha : Fin k, + alpha ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length)) ∧ + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length)) := by + have hiFiltered : i ∈ + (Finset.Icc 1 (HierarchyFullTailLength C - 1)).filter (fun j => + ∃ P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx, + ∃ alpha : Fin k, + alpha ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C j).vertex + (Fin.last (HierarchyFullTailPrefix C j).length)) ∧ + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length))) := by + simpa [I, HierarchyEligibleCommonMissingIndices] using hiI + exact (Finset.mem_filter.mp hiFiltered).2 + obtain ⟨P, alpha, hcommon⟩ := hiData + have heq : i = HierarchyFullTailLength C - 1 := by + by_contra hne + have hlt : i < HierarchyFullTailLength C - 1 := + Nat.lt_of_le_of_ne hiBounds.2 hne + have hnext : i + 1 ∈ I := by + by_cases hstored : + alpha ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) + · exact HierarchySituationOneAdvanceInsideStored G k e0 input T phi ett + base C ctx hsituation hvertexMissing i hiBounds.1 hlt P alpha hcommon + hstored + · exact HierarchySituationOneAdvanceOutsideStored G k e0 input T phi ett + base C ctx hsituation hvertexMissing i hiBounds.1 hlt P alpha hcommon + hstored + have hle : i + 1 ≤ i := Finset.le_max' I (i + 1) hnext + exact (Nat.not_succ_le_self i) hle + simpa [I, heq] using hiI + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean new file mode 100644 index 0000000000..77722275a9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean @@ -0,0 +1,6947 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.HierarchySplitter + +/-! +# Hierarchy Situation One Shortening Contradiction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable abbrev helperBs231.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (alpha : Fin k) → + let old : HierarchyCounterexample P.replacementBase := + P.counterexample; + let H : + TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase := + old.hierarchy; + let n : + Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree + n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = (1 : ℕ) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z) → + (hlenT : (3 : ℕ) ≤ T.length) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := + GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := + GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ + if e = f then some alpha else mu e; + (positiveB : + (1 : ℕ) ≤ + P.corresponding.replacementETT.rounds) → + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))) + B) → + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))).length < + B.length) → + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last + (P.corresponding.replacementETT.rounds + + (1 : ℕ))))) → + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last + P.corresponding.replacementETT.rounds)) → + HierarchyBase + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput B + mu } + mu → + let EB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput B + mu := + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput B + mu }; + ¬EB.series.data.kind + (Fin.last EB.rounds) = + some TashkinovExtensionKind.PE → + (corr : + CorrespondingExtendedTashkinovTree + G k e0 EB sigma B) → + corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc = + Tn → + corr.replacementETT.series.data.kind + (Fin.last + corr.replacementETT.rounds) = + EB.series.data.kind + (Fin.last EB.rounds) → + HierarchyBase + corr.replacementETT sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp trans hlenT B r f + sigma positiveB aboveB strictB belowB generatingB baseB EB hpe corr terminalTree terminalKind + exact { + core := baseB.core + closure := baseB.closure + supportPosition := Fin.cast (congrArg (fun U : TreeSequence G e0 => U.length + 1) + terminalTree.symm) baseB.supportPosition + supportPositive := baseB.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only + intro hp + exact (hpe (terminalKind.symm.trans hp)).elim + nonparallel := by + dsimp only + intro _ + exact (baseB.nonparallel hpe).trans terminalTree.symm } + +private noncomputable abbrev helperK358.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (alpha : Fin k) → + let old : HierarchyCounterexample P.replacementBase := + P.counterexample; + let H : + TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase := + old.hierarchy; + let n : + Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree + n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + (hp : HierarchyPathNumber H = (1 : ℕ)) → + (trans : + ∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z) → + (hlenT : (3 : ℕ) ≤ T.length) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := + GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := + GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ + if e = f then some alpha else mu e; + (positiveB : + (1 : ℕ) ≤ + P.corresponding.replacementETT.rounds) → + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))) + B) → + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))).length < + B.length) → + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last + (P.corresponding.replacementETT.rounds + + (1 : ℕ))))) → + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last + P.corresponding.replacementETT.rounds)) → + (baseB : + HierarchyBase + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := + generatingB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput + B mu } + mu) → + TashkinovHierarchy + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := + generatingB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput + B mu } + baseB → + let EB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput B + mu := + { + rounds := + P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := + P.corresponding.replacementETT.series, + abovePenultimate := aboveB, + strictAbovePenultimate := strictB, + belowFinal := belowB, + generatingColoring := + generatingB : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput + B mu }; + (hpe : + ¬EB.series.data.kind + (Fin.last EB.rounds) = + some + TashkinovExtensionKind.PE) → + (corr : + CorrespondingExtendedTashkinovTree + G k e0 EB sigma B) → + (terminalTree : + corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc = + Tn) → + (terminalKind : + corr.replacementETT.series.data.kind + (Fin.last + corr.replacementETT.rounds) = + EB.series.data.kind + (Fin.last EB.rounds)) → + let bs : + HierarchyBase + corr.replacementETT + sigma := + helperBs231 G k e0 input T + phi ett base C ctx P alpha + hp trans hlenT positiveB + aboveB strictB belowB + generatingB baseB hpe corr + terminalTree terminalKind; + TashkinovHierarchy + corr.replacementETT bs := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp trans hlenT B r f + sigma positiveB aboveB strictB belowB generatingB baseB HB EB hpe corr terminalTree + terminalKind bs + exact { + dividerCount := HB.dividerCount + stage := HB.stage + baseStage := HB.baseStage.trans terminalTree.symm + terminalStage := HB.terminalStage + nested := HB.nested + strict := HB.strict + dividerPosition := HB.dividerPosition + dividerPositive := HB.dividerPositive + dividerIncreasing := HB.dividerIncreasing + dividerStage := HB.dividerStage + coreInsideFirst := HB.coreInsideFirst } + +private noncomputable abbrev helperEB1665.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + let mu : PartialEdgeColoring E k := P.coloring; + (hlenT : (3 : ℕ) ≤ T.length) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + (1 : ℕ) ≤ P.corresponding.replacementETT.rounds → + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))) + B → + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))).length < + B.length → + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last + (P.corresponding.replacementETT.rounds + + (1 : ℕ)))) → + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last + P.corresponding.replacementETT.rounds) → + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput B mu := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B positiveB aboveB strictB + belowB generatingB + exact { + rounds := P.corresponding.replacementETT.rounds + roundsPositive := positiveB + series := P.corresponding.replacementETT.series + abovePenultimate := aboveB + strictAbovePenultimate := strictB + belowFinal := belowB + generatingColoring := generatingB } + +private abbrev helperLastStar3754Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (hcountB : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HB.stage j.castSucc = + H.stage + (Fin.cast + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega) + j).castSucc ∧ + HierarchyStarredStage HB j = + HierarchyStarredStage H + (Fin.cast + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega) + j)) → + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + HierarchyStarredStage KF (Fin.last KF.dividerCount) = A + +private abbrev helperHpS3760Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + (2 : ℕ) ≤ T.length - A.length → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + (∀ (t : Fin T.length), + A.length + (1 : ℕ) ≤ (↑t : ℕ) → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) → + ∀ (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length) (beta : Fin k), + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HierarchyStarredStage KF (Fin.last KF.dividerCount) = A → + HierarchyPathNumber KF = (1 : ℕ) + +private abbrev helperUniqueRefresh4832Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + have := aboveB.1 + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + have := aboveB.1 + have := belowB.1 + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + have := Fin.isLt i + have := aboveB.1 + have := belowB.1 + have := coreInsideK.1 + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + have := Fin.isLt i + have := aboveB.1 + have := belowB.1 + have := coreInsideK.1 + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) X) → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) → + ∀ (i : Fin KF.dividerCount), + ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt KF i.succ ∧ + (goodB.gamma i.succ eta ⊆ + (TreeSequenceVertexSet (KF.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt KF i.succ, + theta ≠ eta → goodB.gamma i.succ theta = goodB.gamma i.castSucc theta + +private abbrev helperParallelBase5019Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); + ∀ (hTnX : TreeSequenceInitialSegment Tn X), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ + (missingTree : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U) + (minusEq : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) + (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + generatingB; + ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) + (closureBX : + ∀ (hpe : EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) + (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) + (hpe : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (terminalTree : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn) + (storedEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j), + let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last corr.replacementETT.rounds; + let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; + corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma bs.closure : Finset (Fin k)) \ + (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card + +private abbrev helperTerminalStored5253Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); + ∀ (hTnX : TreeSequenceInitialSegment Tn X), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length), + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ + (missingTree : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (hmaximum : MaximumProperty corr.replacementETT) + (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) + (hpe : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (hstage : + HB.stage ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }.stage) + (hposition : + HB.dividerPosition ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.dividerPosition) + (starredEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) + (terminalTree : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors EB.series.data (Fin.last EB.rounds) + +private abbrev helperParallelBase5330Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); + ∀ (hTnX : TreeSequenceInitialSegment Tn X), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ + (missingTree : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U) + (minusEq : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) + (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + generatingB; + ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) + (closureBX : + ∀ (hpe : EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) + (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) + (hpe : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (terminalTree : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn) + (storedEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j), + let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last corr.replacementETT.rounds; + let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; + corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma bs.closure : Finset (Fin k)) \ + (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card + +private abbrev helperLastStar5360Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (hcountB : HB.dividerCount = H.dividerCount) + (hstagesB : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HB.stage j.castSucc = H.stage (Fin.cast (by omega) j).castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H (Fin.cast (by omega) j)), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (starredEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j), + HierarchyStarredStage KF (Fin.last KF.dividerCount) = A + +private abbrev helperHpS5366Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (htail : (2 : ℕ) ≤ T.length - A.length) (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + ∀ (hBlength : B.length = T.length - (1 : ℕ)) (hBT : TreeSequenceInitialSegment B T), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + ∀ + (consecutive : + ∀ (t : Fin T.length) (ht : A.length + (1 : ℕ) ≤ (↑t : ℕ)), + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) + (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length) (beta : Fin k) (hab : alpha ≠ beta), + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ + (lastPositive : + ∀ (hq : H.dividerCount ≠ (0 : ℕ)), + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ (lastStar : HierarchyStarredStage KF (Fin.last KF.dividerCount) = A), + HierarchyPathNumber KF = (1 : ℕ) + +private abbrev helperContinuation6826Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (htail : (2 : ℕ) ≤ T.length - A.length) + (trans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) + (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); + ∀ (hBlength : B.length = T.length - (1 : ℕ)) (hXlength : X.length = T.length - (2 : ℕ)) + (hBT : TreeSequenceInitialSegment B T) (hXB : TreeSequenceInitialSegment X B) + (hTnX : TreeSequenceInitialSegment Tn X), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + ∀ + (consecutive : + ∀ (t : Fin T.length) (ht : A.length + (1 : ℕ) ≤ (↑t : ℕ)), + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) + (hyf : Incident G y f) (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length) (beta : Fin k) + (hbetaF : mu f = some beta) (z : V) (hzB : z ∈ TreeSequenceVertexSet B) + (hbetaz : beta ∈ MissingColors G mu z) (hzy : z ≠ y) (hzX : z ∈ TreeSequenceVertexSet X) + (hab : alpha ≠ beta), + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (fixed : ∀ (e : E) (hef : e ≠ f), sigma e = mu e) + (missingFixed : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet X), + MissingColors G sigma v = MissingColors G mu v) + (fixedB : ∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) + (missingTree : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U) + (minusEq : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) + (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R) + (lastPositive : + ∀ (hq : H.dividerCount ≠ (0 : ℕ)), + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (hcountB : HB.dividerCount = H.dividerCount) + (hstagesB : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HB.stage j.castSucc = H.stage (Fin.cast (by omega) j).castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H (Fin.cast (by omega) j)) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + generatingB; + ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) + (closureBX : + ∀ (hpe : EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) + (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (hmaximum : MaximumProperty corr.replacementETT) + (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) + (hpe : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (starredEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) + (stageBX : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) X) + (allStageB : + ∀ (j : Fin (HB.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (HB.stage j) B) + (terminalTree : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn) + (storedEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j), + False + +private abbrev helperContinuation7103Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (htail : (2 : ℕ) ≤ T.length - A.length) + (trans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) + (chain : + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) + (coreA : TreeSequenceInitialSegment P.replacementBase.core A) + (hTnA : TreeSequenceInitialSegment Tn A) (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); + ∀ (hBlength : B.length = T.length - (1 : ℕ)) (hXlength : X.length = T.length - (2 : ℕ)) + (hBT : TreeSequenceInitialSegment B T) (hAX : TreeSequenceInitialSegment A X) + (hXB : TreeSequenceInitialSegment X B) (hTnX : TreeSequenceInitialSegment Tn X) + (hAB : TreeSequenceInitialSegment A B), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + let w : V := T.vertex (Fin.last T.length); + ∀ + (consecutive : + ∀ (t : Fin T.length) (ht : A.length + (1 : ℕ) ≤ (↑t : ℕ)), + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) + (hends : G.ends f = s(y, w)) (hyf : Incident G y f) (S : TreeSequence G e0) + (hSBlen : S.length ≤ B.length) (beta : Fin k) (hbetaF : mu f = some beta) (z : V) + (hzB : z ∈ TreeSequenceVertexSet B) (hbetaz : beta ∈ MissingColors G mu z) (hzy : z ≠ y) + (hzX : z ∈ TreeSequenceVertexSet X) (hab : alpha ≠ beta), + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (fixed : ∀ (e : E) (hef : e ≠ f), sigma e = mu e) (hsproper : IsProperEdgeColoring G sigma) + (hsone : IsOneEdgeUncolored sigma e0) + (incidentFixed : ∀ (e : E) (he : TreeIncidentEdge X e), sigma e = mu e) + (missingFixed : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet X), + MissingColors G sigma v = MissingColors G mu v) + (fixedB : ∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) + (stable : + StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) + (P.corresponding.replacementETT.series.data.coloring n) sigma) + (hrouteB : + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = ({ edge } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ TashkinovAugmentationSequence sigma seed B) + (missingTree : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U), + False + +private theorem helper_hdata_485.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = (1 : ℕ) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) + (P.corresponding.replacementETT.series.data.coloring n) sigma → + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B ∨ + (P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ + TashkinovAugmentationSequence sigma seed B) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)), + MaximumProperty + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } → + ∀ + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (bs : HierarchyBase corr.replacementETT sigma) (K : + TashkinovHierarchy corr.replacementETT bs), SameHierarchyStages HB K := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp trans hlenT B X r + f S hSBlen sigma hsproper hsone incidentFixed missingFixed stable hrouteB positiveB aboveB + strictB belowB generatingB hmaxB baseB HB EB closureBX + by_cases hpe : EB.series.data.kind (Fin.last EB.rounds) = + some TashkinovExtensionKind.PE + · have hb : TashkinovAugmentationSequence sigma Tn B := by + rcases hrouteB with h | h + · exact h.2 + · rcases h.1 with h | h <;> rw [hpe] at h <;> cases h + have hcomb : CombinedStableColoring Tn baseB.closure + (TashkinovStoredColors EB.series.data (Fin.last EB.rounds)) mu sigma := by + refine ⟨?_, ?_⟩ + · have hh := stable + change StableColoring Tn + (TashkinovStoredColors EB.series.data (Fin.last EB.rounds)) + (P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) sigma at hh + rw [← P.corresponding.replacementETT.generatingColoring] at hh + exact hh + · refine ⟨?_, ?_⟩ + · intro edge he _ + obtain ⟨v, hv, hi⟩ := he + exact incidentFixed edge ⟨v, closureBX hpe hv, hi⟩ + · intro v hv + exact missingFixed v (closureBX hpe hv) + exact HierarchySplitter G k e0 P.corresponding.replacementInput B mu sigma EB + hmaxB old.positive P.minimumContext.lowerRung baseB HB hpe + P.minimumContext.proper P.minimumContext.oneEdgeUncolored hsproper hsone hcomb hb + · have hmodB := Td G k e0 P.corresponding.replacementInput B mu EB hmaxB + old.positive P.minimumContext.lowerRung sigma hsproper hsone stable + obtain ⟨corr⟩ := hmodB.2.2 B aboveB strictB hrouteB + have hmaximum := MaximumPropertyTransport G k e0 EB sigma hmodB B corr hmaxB + have terminalTree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ + have hj : j.succ = Fin.last EB.rounds := Fin.ext (by + dsimp [j]; have := EB.roundsPositive; omega) + change rs.data.tree (Fin.last EB.rounds).castSucc = + EB.series.data.tree (Fin.last EB.rounds).castSucc + rw [← hj] + exact hl j + have terminalKind : corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = EB.series.data.kind (Fin.last EB.rounds) := by + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + exact hk _ + let bs : HierarchyBase corr.replacementETT sigma := by + exact @helperBs231 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) (@trans) + (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@hpe) + (@corr) (@terminalTree) (@terminalKind) + let K : TashkinovHierarchy corr.replacementETT bs := by + exact @helperK358 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) (@trans) + (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) + (@hpe) (@corr) (@terminalTree) (@terminalKind) + refine ⟨corr, hmaximum, bs, K, rfl, rfl, heq_of_eq rfl, heq_of_eq rfl, ?_, ?_⟩ + · exact ⟨fun h => (hpe h).elim, fun h => (hpe (terminalKind.symm.trans h)).elim⟩ + · intro _; rfl + +private theorem helper_coreA_353.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + (∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) + (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + TreeSequenceInitialSegment P.replacementBase.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A trans chain + by_cases hq : H.dividerCount = 0 + · have he : A = P.replacementBase.core := by + simp [A, HierarchyStarredStage, hq, Fin.last] + rw [he] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have he : A = H.stage ⟨H.dividerCount, by omega⟩ := by + unfold A HierarchyStarredStage + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) + · have hv := congrArg Fin.val hz + simp only [Fin.val_last, Fin.val_zero] at hv + contradiction + · rw [hi] + simp only [Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simp only [Fin.val_last, Fin.val_succ] at hv + exact hv.symm + rw [he] + exact trans H.coreInsideFirst (chain H.dividerCount (by omega) ⟨1, by omega⟩ + (by change 1 ≤ H.dividerCount; omega)) + +private theorem helper_hsproper_482.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + alpha ∈ MissingColors G mu (B.vertex (Fin.last B.length)) → + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + let w : V := T.vertex (Fin.last T.length); + G.ends f = s(y, w) → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), e ≠ f → sigma e = mu e) → + IsProperEdgeColoring G sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha haT mu trans hlenT B halphaB r f y + w hends sigma fixed e g c heg hadj he hg + by_cases hef : e = f + · subst e + have hgf : g ≠ f := heg.symm + have hc : c = alpha := by simpa [sigma] using he.symm + subst c + rw [fixed g hgf] at hg + obtain ⟨v, hvf, hvg⟩ := hadj + have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf + rcases hv with rfl | rfl + · exact (Finset.mem_sdiff.mp halphaB).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) + · exact (Finset.mem_sdiff.mp haT).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) + · by_cases hgf : g = f + · subst g + have hc : c = alpha := by simpa [sigma] using hg.symm + subst c + rw [fixed e hef] at he + obtain ⟨v, hve, hvf⟩ := hadj + have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf + rcases hv with rfl | rfl + · exact (Finset.mem_sdiff.mp halphaB).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) + · exact (Finset.mem_sdiff.mp haT).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) + · exact P.minimumContext.proper heg hadj ((fixed e hef).symm.trans he) + ((fixed g hgf).symm.trans hg) + +private theorem helper_terminalStored_720.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = (1 : ℕ) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma), + baseB.core = bs.core → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) → + ∀ + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HB.stage ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.stage → + HB.dividerPosition ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.dividerPosition → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn → + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f + S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr + hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ + have hj : j.succ = Fin.last EB.rounds := Fin.ext (by + dsimp [j]; have := EB.roundsPositive; omega) + have ht : rs.data.tree (Fin.last EB.rounds).castSucc = Tn := by + change rs.data.tree (Fin.last EB.rounds).castSucc = + EB.series.data.tree (Fin.last EB.rounds).castSucc + rw [← hj]; exact hl j + have hm : TreeMissingColors (rs.data.coloring (Fin.last EB.rounds)) + (rs.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by + rw [← hc, ht] + exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX) + have hmOld : TreeMissingColors (EB.series.data.coloring (Fin.last EB.rounds)) + (EB.series.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by + rw [← EB.generatingColoring] + change TashkinovStoredColors rs.data (Fin.last EB.rounds) = + TashkinovStoredColors EB.series.data (Fin.last EB.rounds) + simp only [TashkinovStoredColors, hstored, hm, hmOld] + +private theorem helper_hpS_917.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + (2 : ℕ) ≤ T.length - A.length → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + B.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + (∀ (t : Fin T.length), + A.length + (1 : ℕ) ≤ (↑t : ℕ) → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) → + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length) (beta : Fin k), + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HierarchyStarredStage KF (Fin.last KF.dividerCount) = A → + HierarchyPathNumber KF = (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu htail hlenT B hBlength + hBT r f consecutive S hSBlen beta hab sigma lastPositive positiveB aboveB strictB belowB + generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK KF lastStar + let candidates := (Finset.Icc 1 (B.length - A.length)).filter fun i => + ∀ t : Fin B.length, A.length + i ≤ t.val → + G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) + have hm : 1 ∈ candidates := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨le_rfl, by omega⟩, ?_⟩ + intro t ht + rw [← hBT.2.2 t] + have hc := consecutive (Fin.castLE hBT.1 t) ht + have hv1 : (Fin.castLE hBT.1 t).castSucc = + Fin.castLE (Nat.succ_le_succ hBT.1) t.castSucc := Fin.ext rfl + have hv2 : (Fin.castLE hBT.1 t).succ = + Fin.castLE (Nat.succ_le_succ hBT.1) t.succ := Fin.ext rfl + rw [hv1, hv2, hBT.2.1 t.castSucc, hBT.2.1 t.succ] at hc + exact hc + have hn : candidates.Nonempty := ⟨1, hm⟩ + have hlo := (Finset.mem_Icc.mp (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).1).1 + have hhi := Finset.min'_le candidates 1 hm + unfold HierarchyPathNumber + dsimp only + rw [lastStar] + change (if h : candidates.Nonempty then candidates.min' h else B.length - A.length) = 1 + rw [dite_eq_left hn] + omega + +private theorem helper_chain_747.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) + (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H trans j + induction j with + | zero => + intro hj i hi + have he : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have he : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) (H.nested ⟨j, by omega⟩) + +private theorem helper_consecutive_824.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + HierarchyPathNumber H = (1 : ℕ) → + (2 : ℕ) ≤ T.length - A.length → + (3 : ℕ) ≤ T.length → + ∀ (t : Fin T.length), + A.length + (1 : ℕ) ≤ (↑t : ℕ) → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A hp htail hlenT t ht + let candidates := (Finset.Icc 1 (T.length - A.length)).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + have hp' := hp + change (if h : candidates.Nonempty then candidates.min' h else T.length - A.length) = 1 at hp' + have hn : candidates.Nonempty := by + by_contra hn + have hp'' : T.length - A.length = 1 := by + simpa only [dite_eq_right hn] using hp' + omega + have hm : candidates.min' hn = 1 := by + simpa only [dite_eq_left hn] using hp' + have hc := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + rw [hm] at hc + exact hc t ht + +private theorem helper_noInc_902.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + X.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment X T → + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + let w : V := T.vertex (Fin.last T.length); + T.vertex r.castSucc = y → + G.ends f = s(y, w) → + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + ∀ (beta : Fin k), + alpha ≠ beta → + ∀ v ∈ TreeSequenceVertexSet X, + ¬Incident G v f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha trans hlenT B X hXlength hXT r f y + w hy hends S hSBlen beta hab v hv + obtain ⟨j, hj⟩ : ∃ j, X.vertex j = v := by simpa [TreeSequenceVertexSet] using hv + intro hi + have hv' : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hi + rcases hv' with he | he + · have hh := T.vertex_injective ((hXT.2.1 j).trans (hj.trans (he.trans hy.symm))) + have hh := congrArg Fin.val hh + have hj := j.isLt + change j.val = T.length - 1 at hh + change j.val < X.length + 1 at hj + omega + · have hh := T.vertex_injective ((hXT.2.1 j).trans (hj.trans he)) + have hh := congrArg Fin.val hh + have hj := j.isLt + change j.val = T.length at hh + change j.val < X.length + 1 at hj + omega + +private theorem helper_hrouteB_951.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + B.length = T.length - (1 : ℕ) → + X.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment B T → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + TreeSequenceInitialSegment X B → + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length), + TashkinovAugmentationSequence mu S T → + TreeSequenceInitialSegment + (TreeSequencePrefix T (↑r : ℕ) + (le_trans S.positive + (id + (Eq.mp + (congrArg (LE.le S.length) + (congrArg TreeSequence.length + (TreeSequencePrefix.eq_1 T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ + by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ + by omega)))) + hSBlen))) + (Nat.le_of_lt r.isLt)) + (TreeSequencePrefix T ((↑r : ℕ) + (1 : ℕ)) + (by omega) + (Nat.succ_le_of_lt r.isLt)) → + ∀ (beta : Fin k), + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + (∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) → + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ TashkinovAugmentationSequence sigma seed B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu trans hlenT B X hBlength + hXlength hBT common hXB hTnX r f S hSBlen hseq hpre beta hab sigma missingFixed fixedB + rcases P2813_T1_TerminalRoute G k e0 P.corresponding.replacementInput T mu + P.corresponding.replacementETT with ⟨hpe, hseq⟩ | + ⟨hkind, edge, seed, hedges, hseed, hincident, hcontrol, hseq⟩ + · have hpre := TashkinovAugmentationSequenceRestrict mu Tn B T hseq + (trans hTnX hXB) hBT + exact Or.inl ⟨hpe, TashkinovAugmentationSequenceColoringTransport mu sigma + Tn X B hpre hXB (by omega) (fun t _ => fixedB t) missingFixed⟩ + · have hseedLen : seed.length = Tn.length + 1 := hseed.1 + have hseedB := common + (TashkinovAugmentationSequenceInitialSegment mu seed T hseq) hBT + (by have := hTnX.1; omega) + have hpre := TashkinovAugmentationSequenceRestrict mu seed B T hseq hseedB hBT + exact Or.inr ⟨hkind, edge, seed, hedges, hseed, + TashkinovAugmentationSequenceColoringTransport mu sigma seed X B hpre hXB + (by omega) (fun t _ => fixedB t) missingFixed⟩ + +private theorem helper_terminalTree_1082.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = (1 : ℕ) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma), + baseB.core = bs.core → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) → + ∀ + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HB.stage ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.stage → + HB.dividerPosition ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.dividerPosition → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B r f S + hSBlen sigma positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore + hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK + dividerStageK KF hstage hposition starredEq + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ + have hj : j.succ = Fin.last EB.rounds := Fin.ext (by + dsimp [j]; have := EB.roundsPositive; omega) + change rs.data.tree (Fin.last EB.rounds).castSucc = + EB.series.data.tree (Fin.last EB.rounds).castSucc + rw [← hj] + exact hl j + +private theorem helper_firstEq_1146.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + B.length = T.length - (1 : ℕ) → + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (_ : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + (∀ (j : Fin (B.length + (1 : ℕ))), + (↑j : ℕ) < B.length → + MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j)) → + (∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (B.length + (1 : ℕ))), + c ∈ MissingColors G psi (B.vertex j) → + (↑(HierarchyFirstMissingPosition psi B c) : ℕ) ≤ (↑j : ℕ)) → + (∀ (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi B c) : ℕ) < B.length → + c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c))) → + ∀ (c : Fin k), + HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B hBlength r f S hSBlen + sigma positiveB aboveB strictB belowB generatingB baseB HB earlyMissing firstLe firstMem c + apply Fin.ext + apply Nat.le_antisymm + · by_contra hn + have hlt : (HierarchyFirstMissingPosition mu B c).val < B.length := by + have := (HierarchyFirstMissingPosition sigma B c).isLt + omega + have hm := firstMem mu c hlt + rw [← earlyMissing _ hlt] at hm + have := firstLe sigma c _ hm + omega + · by_contra hn + have hlt : (HierarchyFirstMissingPosition sigma B c).val < B.length := by + have := (HierarchyFirstMissingPosition mu B c).isLt + omega + have hm := firstMem sigma c hlt + rw [earlyMissing _ hlt] at hm + have := firstLe mu c _ hm + omega + +private theorem helper_trans_1493.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z := by + classical + intro V E G e0 X Y Z hXY hYZ + refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +private theorem helper_hTnCore_1512.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + TreeSequenceInitialSegment Tn P.replacementBase.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P n Tn + by_cases hpe : P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.PE + · exact (P.replacementBase.parallel hpe).2.2.some.leftSegment + · rw [P.replacementBase.nonparallel hpe] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + +private theorem helper_common_1530.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U := by + classical + intro V E G e0 trans S U W hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +private theorem helper_hfull_1543.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → + (2 : ℕ) ≤ T.length - A.length → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)) = B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A hAold htail hlenT B + have hnum : min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + + (HierarchyFullTailLength C - 1)) T.length = T.length - 1 := by + unfold HierarchyFullTailLength + dsimp only + rw [hAold] + omega + simp only [HierarchyFullTailPrefix, hnum] + rfl + +private theorem helper_hsource_1573.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + X.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment Tn X → + ∃ (S : TreeSequence G e0), + S.length ≤ B.length ∧ TashkinovAugmentationSequence mu S T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P n Tn mu hlenT B X hBlength hXlength hTnX + rcases P2813_T1_TerminalRoute G k e0 P.corresponding.replacementInput T mu + P.corresponding.replacementETT with ⟨hpe, hseq⟩ | + ⟨hkind, edge, seed, hedges, hseed, hincident, hcontrol, hseq⟩ + · exact ⟨Tn, by have := hTnX.1; omega, hseq⟩ + · have hseedLen : seed.length = Tn.length + 1 := hseed.1 + exact ⟨seed, by have := hTnX.1; omega, hseq⟩ + +private theorem helper_hzy_1590.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + Incident G y f → + ∀ (beta : Fin k), + mu f = some beta → + ∀ z ∈ TreeSequenceVertexSet B, + beta ∈ MissingColors G mu z → + z ≠ y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B r f y hyf beta hbetaF z hzB + hbetaz he + subst z + have hnot : beta ∉ MissingColors G mu y := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + exact fun h => h (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hyf, hbetaF⟩) + exact hnot hbetaz + +private theorem helper_hzX_1597.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + X.length = T.length - (2 : ℕ) → + let y : V := B.vertex (Fin.last B.length); + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + ∀ z ∈ TreeSequenceVertexSet B, + z ≠ y → + z ∈ TreeSequenceVertexSet X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P trans hlenT B X hBlength hXlength y S + hSBlen z hzB hzy + obtain ⟨j, hj⟩ : ∃ j, B.vertex j = z := by simpa [TreeSequenceVertexSet] using hzB + have hjlt : j.val < B.length := by + by_contra hh + have he : j = Fin.last B.length := Fin.ext + (by simpa using Nat.le_antisymm (Nat.le_of_lt_succ j.isLt) (Nat.le_of_not_gt hh)) + exact hzy (hj.symm.trans (congrArg B.vertex he)) + let jX : Fin (X.length + 1) := ⟨j.val, by omega⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨jX, hj⟩ + +private theorem helper_hfe0_1615.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + ∀ (beta : Fin k), + alpha ≠ beta → + f ≠ e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha trans hlenT B r f S hSBlen beta hab he + have hh := T.edge_injective (he.trans T.first_edge.symm) + have hv := congrArg Fin.val hh + dsimp [r] at hv + omega + +private theorem helper_hsone_1621.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), e ≠ f → sigma e = mu e) → + f ≠ e0 → + IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT r f sigma fixed hfe0 + refine ⟨?_, ?_⟩ + · rw [fixed e0 hfe0.symm] + exact P.minimumContext.oneEdgeUncolored.1 + · intro e he + by_cases hef : e = f + · subst e; exact ⟨alpha, by simp [sigma]⟩ + · rw [fixed e hef] + exact P.minimumContext.oneEdgeUncolored.2 e he + +private theorem helper_missingFixed_1637.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → + ∀ v ∈ TreeSequenceVertexSet X, + MissingColors G sigma v = MissingColors G mu v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT X r f sigma + incidentFixed v hv + unfold MissingColors PresentColors + congr 1 + ext c + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + constructor <;> rintro ⟨e, hi, hc⟩ + · exact ⟨e, hi, (incidentFixed e ⟨v, hv, hi⟩).symm.trans hc⟩ + · exact ⟨e, hi, (incidentFixed e ⟨v, hv, hi⟩).trans hc⟩ + +private theorem helper_fixedB_1646.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), e ≠ f → sigma e = mu e) → + ∀ (t : Fin B.length), + sigma (B.edge t) = mu (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B hBlength hBT r f S + hSBlen sigma fixed t + apply fixed + intro he + have hh := T.edge_injective ((hBT.2.2 t).trans he) + have hh := congrArg Fin.val hh + have ht := t.isLt + change t.val = T.length - 1 at hh + omega + +private theorem helper_stable_1654.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) + (P.corresponding.replacementETT.series.data.coloring n) sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT X hTnX r f sigma + incidentFixed missingFixed + rw [← P.corresponding.replacementETT.generatingColoring] + refine ⟨?_, ?_⟩ + · intro e he _ + obtain ⟨v, hv, hi⟩ := he + exact incidentFixed e ⟨v, TreeSequenceInitialSegmentVertexSetSubset hTnX hv, hi⟩ + · intro v hv + exact missingFixed v (TreeSequenceInitialSegmentVertexSetSubset hTnX hv) + +private theorem helper_boundaryEq_1679.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + let w : V := T.vertex (Fin.last T.length); + G.ends f = s(y, w) → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → + ∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + ∀ (c : Fin k), + BoundaryColorEdges G sigma (TreeSequenceVertexSet U) c = + BoundaryColorEdges G mu (TreeSequenceVertexSet U) c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f y w hends sigma + incidentFixed U hUX c + apply Finset.filter_congr + intro edge he + obtain ⟨u, hu, v, hv, hends⟩ := by simpa [BoundaryEdges] using he + have hi : TreeIncidentEdge X edge := + ⟨u, hUX hu, by rw [Incident, hends]; exact Sym2.mem_mk_left _ _⟩ + rw [incidentFixed edge hi] + +private theorem helper_lastPositive_1695.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length), + H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A hlenT B S hSBlen hq + unfold A HierarchyStarredStage + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) + · exact (hq (by simpa using congrArg Fin.val hz)).elim + · rw [hi] + simp only [Fin.cases_succ] + congr 1 + exact Fin.ext (by simpa using (congrArg Fin.val hi).symm) + +private theorem helper_ordinaryA_1704.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + (∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) + (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + TreeSequenceInitialSegment Tn A → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length), + (H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A n Tn chain hTnA hlenT B S hSBlen + lastPositive j + by_cases hq : H.dividerCount = 0 + · have hj : j = 0 := Fin.ext (by have := j.isLt; omega) + subst j + simpa only [Fin.castSucc_zero, H.baseStage] using hTnA + · rw [lastPositive hq] + exact chain H.dividerCount (by omega) j.castSucc + (by change j.val ≤ H.dividerCount; have := j.isLt; omega) + +private theorem helper_closureBX_1732.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X → + EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B X positiveB aboveB strictB + belowB generatingB baseB EB coreBX hpe + obtain ⟨union⟩ := (baseB.parallel hpe).2.2 + intro v hv + apply coreBX + rw [union.vertexSet] + exact Finset.mem_union_right _ hv + +private theorem helper_stageMissingEq_1787.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) X) → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn → + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma + missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF stageBX + terminalTree j + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma + (corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) = + TreeMissingColors mu Tn + rw [terminalTree] + exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX) + · exact missingTree _ (TreeSequenceInitialSegmentVertexSetSubset (stageBX i.succ)) + +private theorem helper_earlyMissing_1796.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + X.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment X B → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length) (beta : Fin k), + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + (H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (_ : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (j : Fin (B.length + (1 : ℕ))), + (↑j : ℕ) < B.length → + MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B X hBlength + hXlength hXB r f S hSBlen beta hab sigma missingFixed lastPositive positiveB aboveB strictB + belowB generatingB baseB HB j hj + let i : Fin (X.length + 1) := ⟨j.val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hXB.1) i = j := Fin.ext rfl + apply missingFixed + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, by rw [← he, hXB.2.1 i]⟩ + +private theorem helper_firstLe_1804.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (B.length + (1 : ℕ))), + c ∈ MissingColors G psi (B.vertex j) → + (↑(HierarchyFirstMissingPosition psi B c) : ℕ) ≤ (↑j : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hlenT B psi c j hj + let candidates := Finset.univ.filter fun j : Fin (B.length + 1) => + c ∈ MissingColors G psi (B.vertex j) + have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ + have hn : candidates.Nonempty := ⟨j, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates j hm + +private theorem helper_firstMem_1814.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (_ : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi B c) : ℕ) < B.length → + c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B hBlength S hSBlen positiveB + aboveB strictB belowB generatingB baseB HB psi c hlt + let candidates := Finset.univ.filter fun j : Fin (B.length + 1) => + c ∈ MissingColors G psi (B.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hh : (HierarchyFirstMissingPosition psi B c).val = B.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + +private theorem helper_segmentEq_1835.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + (∀ (c : Fin k), + HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c) → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (t : Fin (HB.stage j.succ).length), + sigma ((HB.stage j.succ).edge t) = mu ((HB.stage j.succ).edge t)) → + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (c : Fin k), + HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B r f sigma + positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK + nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq firstEq + stageFixed j c + unfold HierarchySegmentColors + dsimp only + rw [starredEq j, firstEq c] + apply Finset.filter_congr + intro d _ + constructor <;> rintro ⟨r, hlo, hhi, hcol⟩ + · exact ⟨r, hlo, hhi, (stageFixed j r).symm.trans hcol⟩ + · exact ⟨r, hlo, hhi, (stageFixed j r).trans hcol⟩ + +private theorem helper_branch_1894.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) → + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + bs.closure = baseB.closure → + (4 : ℕ) ≤ + ((TreeMissingColors mu + ({ rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.tree + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds).castSucc) ∩ + TreeMissingColors mu baseB.closure : + Finset (Fin k)) \ + (HierarchyStoredColorsAt HB (0 : Fin (HB.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (HB.dividerCount + (1 : ℕ))))).card → + (4 : ℕ) ≤ + ((TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma bs.closure : + Finset (Fin k)) \ + (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma + missingTree positiveB aboveB strictB belowB generatingB baseB HB goodB EB closureBX corr bs + baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK + KF terminalTree storedEq hpB hcl hcard + change 4 ≤ ((TreeMissingColors sigma + (corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma bs.closure) \ + (HierarchyStoredColorsAt KF 0).biUnion (goodB.gamma 0)).card + rw [terminalTree, hcl, storedEq 0, + missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX), + missingTree baseB.closure (closureBX hpB)] + exact hcard + +private theorem helper_hbetaY_1908.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = (1 : ℕ) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + Incident G y f → + ∀ (beta : Fin k), + mu f = some beta → + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), e ≠ f → sigma e = mu e) → + beta ∈ MissingColors G sigma y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H mu hp trans hlenT B r f y hyf + beta hbetaF hab sigma fixed + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + intro hp + obtain ⟨edge, hi, hc⟩ := (Finset.mem_filter.mp hp).2 + by_cases hef : edge = f + · subst edge + have he : alpha = beta := by simpa [sigma] using hc + exact hab he + · have hcOld : mu edge = some beta := (fixed edge hef).symm.trans hc + exact P.minimumContext.proper hef ⟨y, hi, hyf⟩ hcOld hbetaF + +private theorem helper_hnotElementary_1918.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + ∀ (beta : Fin k), + ∀ z ∈ TreeSequenceVertexSet B, + beta ∈ MissingColors G mu z → + z ≠ y → + z ∈ TreeSequenceVertexSet X → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + beta ∈ MissingColors G sigma y → + ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f y beta z hzB + hbetaz hzy hzX sigma missingFixed hbetaY he + have hbetazS : beta ∈ MissingColors G sigma z := by rw [missingFixed z hzX]; exact hbetaz + have hyB : y ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last B.length, rfl⟩ + exact Finset.disjoint_left.mp (he hzB hyB hzy) hbetazS hbetaY + +private theorem helper_lastStar_1932.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (hcountB : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega) + j; + HB.stage j.castSucc = H.stage jo.castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H jo) → + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + HierarchyStarredStage KF (Fin.last KF.dividerCount) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B r f sigma + positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq + rw [starredEq] + have hh := (hstagesB (Fin.last HB.dividerCount)).2 + have hi : Fin.cast (congrArg (fun q => q + 1) hcountB) + (Fin.last HB.dividerCount) = Fin.last H.dividerCount := + Fin.ext hcountB + simpa only [hi] using hh + +private theorem helper_lastOrdinary_1941.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (hcountB : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega) + j; + HB.stage j.castSucc = H.stage jo.castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H jo) → + HB.stage (Fin.last HB.dividerCount).castSucc = + H.stage (Fin.last H.dividerCount).castSucc := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H mu hlenT B positiveB aboveB strictB + belowB generatingB baseB HB hcountB hstagesB + have hh := (hstagesB (Fin.last HB.dividerCount)).1 + have hi : Fin.cast (congrArg (fun q => q + 1) hcountB) + (Fin.last HB.dividerCount) = Fin.last H.dividerCount := + Fin.ext hcountB + simpa only [hi] using hh + +private theorem helper_terminalTree_3611.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = (1 : ℕ) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma), + baseB.core = bs.core → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) → + ∀ + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HB.stage ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.stage → + HB.dividerPosition ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.dividerPosition → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B r f S + hSBlen sigma positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore + hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK + dividerStageK KF hstage hposition starredEq + exact helper_terminalTree_1082 G k e0 input T phi ett base C ctx P alpha hp hlenT S hSBlen + positiveB aboveB strictB + belowB generatingB baseB HB corr hmaximum bs hcore hpe hclosure baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK hstage + hposition starredEq + +private theorem helper_terminalStored_3618.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = (1 : ℕ) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma), + baseB.core = bs.core → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) → + ∀ + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HB.stage ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.stage → + HB.dividerPosition ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.dividerPosition → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn → + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f + S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr + hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree + exact helper_terminalStored_720 G k e0 input T phi ett base C ctx P alpha hp hlenT hTnX S hSBlen + missingTree positiveB aboveB strictB belowB generatingB baseB HB corr hmaximum bs hcore + hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK + increasingK dividerStageK hstage hposition starredEq terminalTree + +private theorem helper_stageMissingEq_3631.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) X) → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn → + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma + missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF stageBX + terminalTree j + exact helper_stageMissingEq_1787 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) + (@belowB) + (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) + (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@stageBX) + (@terminalTree) (@j) + +private theorem helper_earlyMissing_3639.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + B.length = T.length - (1 : ℕ) → + X.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment X B → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length) (beta : Fin k), + alpha ≠ beta → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + (H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (_ : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (j : Fin (B.length + (1 : ℕ))), + (↑j : ℕ) < B.length → + MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B X hBlength + hXlength hXB r f S hSBlen beta hab sigma missingFixed lastPositive positiveB aboveB strictB + belowB generatingB baseB HB j hj + exact helper_earlyMissing_1796 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@hlenT) (@hBlength) (@hXlength) (@hXB) (@S) (@hSBlen) (@beta) (@hab) + (@missingFixed) (@lastPositive) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@j) (@hj) + +private theorem helper_segmentEq_3669.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + (∀ (c : Fin k), + HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c) → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (t : Fin (HB.stage j.succ).length), + sigma ((HB.stage j.succ).edge t) = mu ((HB.stage j.succ).edge t)) → + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (c : Fin k), + HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B r f sigma + positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK + nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq firstEq + stageFixed j c + exact @helper_segmentEq_1835 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@trans) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) + (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) + (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) (@firstEq) + (@stageFixed) (@j) (@c) + +private theorem helper_branch_3726.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) → + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + bs.closure = baseB.closure → + (4 : ℕ) ≤ + ((TreeMissingColors mu + ({ rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.tree + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds).castSucc) ∩ + TreeMissingColors mu baseB.closure : + Finset (Fin k)) \ + (HierarchyStoredColorsAt HB (0 : Fin (HB.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (HB.dividerCount + (1 : ℕ))))).card → + (4 : ℕ) ≤ + ((TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma bs.closure : + Finset (Fin k)) \ + (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma + missingTree positiveB aboveB strictB belowB generatingB baseB HB goodB EB closureBX corr bs + baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK + KF terminalTree storedEq hpB hcl hcard + exact helper_branch_1894 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) + (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@closureBX) (@corr) (@bs) + (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) + (@increasingK) (@dividerStageK) (@terminalTree) (@storedEq) (@hpB) (@hcl) (@hcard) + +private theorem helper_lastStar_3754.{u_1, u_2} : + helperLastStar3754Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B r f sigma + positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq + exact helper_lastStar_1932 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) + (@HB) (@hcountB) (@hstagesB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) + (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) + +private theorem helper_hpS_3760.{u_1, u_2} : + helperHpS3760Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu htail hlenT B hBlength + hBT r f consecutive S hSBlen beta hab sigma lastPositive positiveB aboveB strictB belowB + generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK KF lastStar + exact helper_hpS_917 G k e0 input T phi ett base C ctx P alpha htail hlenT hBlength hBT + consecutive S hSBlen beta + hab lastPositive positiveB aboveB strictB belowB generatingB baseB HB corr bs + baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK + dividerStageK lastStar + +private theorem helper_uniqueRefresh_4832.{u_1, u_2} : + helperUniqueRefresh4832Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f sigma missingFixed + positiveB aboveB strictB belowB generatingB baseB HB goodB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq + stageBX storedEq i + have hnew : + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun v => MissingColors G mu v) := by + apply Finset.biUnion_congr rfl + intro v hv + exact missingFixed v (TreeSequenceInitialSegmentVertexSetSubset (stageBX i.succ) + (Finset.mem_sdiff.mp hv).1) + change ∃! c : Fin k, + c ∈ HierarchyStoredColorsAt KF i.succ ∧ + goodB.gamma i.succ c ⊆ + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion + fun v => MissingColors G sigma v) ∧ + ∀ d ∈ HierarchyStoredColorsAt KF i.succ, d ≠ c → + goodB.gamma i.succ d = goodB.gamma i.castSucc d + rw [starredEq i.castSucc, hnew] + simp only [storedEq] + exact goodB.uniqueRefresh i + +private theorem helper_parallelBase_5019.{u_1, u_2} : + helperParallelBase5019Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f + sigma missingTree minusEq positiveB aboveB strictB belowB generatingB baseB HB goodB EB + coreBX closureBX corr bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK + coreInsideK positiveK increasingK dividerStageK KF terminalTree storedEq + dsimp only + intro hp + have hpB := hpe.mpr hp + have hcl : bs.closure = baseB.closure := (hclosure hpB).symm + obtain ⟨hnot, hcard⟩ := goodB.parallelBase hpB + constructor + · change ¬ TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt KF 0).biUnion (goodB.gamma 0)) + rw [← hcore, storedEq 0, minusEq baseB.core coreBX] + exact hnot + · exact helper_branch_3726 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@goodB) (@closureBX) (@corr) (@bs) (@baseStageK) + (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) + (@dividerStageK) (@terminalTree) (@storedEq) (@hpB) (@hcl) (@hcard) + +private theorem helper_sameLast_4923.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {a b : ℕ} + (s : Fin (a + (2 : ℕ)) → TreeSequence G e0) + (t : Fin (b + (2 : ℕ)) → TreeSequence G e0) (u v : TreeSequence G e0), + a = b → + s ≍ t → + u = v → + (Fin.cases u (fun (i : Fin a) ↦ s i.castSucc.succ) (Fin.last a) : TreeSequence G e0) = + (Fin.cases v (fun (i : Fin b) ↦ t i.castSucc.succ) (Fin.last b) : TreeSequence G e0) := by + classical + intro V E G e0 a b s t u v hab hst huv + cases hab + have he : s = t := eq_of_heq hst + cases he + cases huv + rfl + +private theorem helper_terminalTree_5246.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (_ : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + omega) + (by + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), by + omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length), + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (_ : MaximumProperty corr.replacementETT) + (bs : HierarchyBase corr.replacementETT sigma) (_ : baseB.core = bs.core) + (_ : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (_ : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (_ : + HB.stage ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.stage) + (_ : + HB.dividerPosition ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.dividerPosition) + (_ : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B r f S + hSBlen sigma positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore + hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK + dividerStageK KF hstage hposition starredEq + exact helper_terminalTree_3611 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hp) (@hlenT) (@S) (@hSBlen) (@positiveB) (@aboveB) (@strictB) + (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) (@hcore) (@hpe) + (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) + (@positiveK) (@increasingK) (@dividerStageK) (@hstage) (@hposition) (@starredEq) + +private theorem helper_terminalStored_5253.{u_1, u_2} : + helperTerminalStored5253Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f + S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr + hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree + exact helper_terminalStored_3618 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hp) (@hlenT) (@hTnX) (@S) (@hSBlen) (@missingTree) (@positiveB) + (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) + (@hcore) (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) + (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@hstage) (@hposition) + (@starredEq) (@terminalTree) + +private theorem helper_stageMissingEq_5267.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + omega) + (by + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + omega) + (by + omega); + ∀ (_ : TreeSequenceInitialSegment Tn X), + let r : Fin T.length := + (⟨T.length - (1 : ℕ), by + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ + (_ : + ∀ (U : TreeSequence G e0) (_ : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (_ : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) X) + (_ : + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + Tn) + (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma + missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF stageBX + terminalTree j + exact helper_stageMissingEq_3631 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) + (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) + (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) + (@stageBX) (@terminalTree) (@j) + +private theorem helper_segmentEq_5302.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ + (_ : + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) + (_ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) + (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + omega) + (by + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), by + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (_ : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) + (_ : + ∀ (c : Fin k), + HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c) + (_ : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (t : Fin (HB.stage j.succ).length), + sigma ((HB.stage j.succ).edge t) = mu ((HB.stage j.succ).edge t)) + (j : Fin (HB.dividerCount + (1 : ℕ))) (c : Fin k), + HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B r f sigma + positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK + nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq firstEq + stageFixed j c + exact @helper_segmentEq_3669 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@trans) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) + (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) + (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) (@firstEq) + (@stageFixed) (@j) (@c) + +private theorem helper_uniqueRefresh_5324.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + omega) + (by + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + omega) + (by + omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), by + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ + (_ : + ∀ (v : V) (_ : v ∈ TreeSequenceVertexSet X), + MissingColors G sigma v = MissingColors G mu v) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by + omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + belowB generatingB; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), by + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), by + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (_ : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) + (_ : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) X) + (_ : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) + (i : Fin KF.dividerCount), + ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt KF i.succ ∧ + (goodB.gamma i.succ eta ⊆ + (TreeSequenceVertexSet (KF.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt KF i.succ, + theta ≠ eta → goodB.gamma i.succ theta = goodB.gamma i.castSucc theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f sigma missingFixed + positiveB aboveB strictB belowB generatingB baseB HB goodB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq + stageBX storedEq + exact helper_uniqueRefresh_4832 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) (@ctx) (@P) (@alpha) (@hlenT) (@missingFixed) (@positiveB) (@aboveB) + (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@corr) (@bs) + (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) + (@increasingK) (@dividerStageK) (@starredEq) (@stageBX) (@storedEq) + +private theorem helper_parallelBase_5330.{u_1, u_2} : + helperParallelBase5330Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f + sigma missingTree minusEq positiveB aboveB strictB belowB generatingB baseB HB goodB EB + coreBX closureBX corr bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK + coreInsideK positiveK increasingK dividerStageK KF terminalTree storedEq + exact @helper_parallelBase_5019 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hp) (@hlenT) (@hTnX) (@missingTree) (@minusEq) (@positiveB) (@aboveB) + (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@coreBX) (@closureBX) + (@corr) (@bs) (@hcore) (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) + (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) + (@terminalTree) (@storedEq) + +private theorem helper_lastStar_5360.{u_1, u_2} : + helperLastStar5360Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B r f sigma + positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq + exact helper_lastStar_3754 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) + (@baseB) (@HB) (@hcountB) (@hstagesB) (@corr) (@bs) (@baseStageK) (@terminalStageK) + (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) + (@starredEq) + +private theorem helper_hpS_5366.{u_1, u_2} : + helperHpS5366Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu htail hlenT B hBlength + hBT r f consecutive S hSBlen beta hab sigma lastPositive positiveB aboveB strictB belowB + generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK KF lastStar + exact helper_hpS_3760 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@htail) (@hlenT) (@hBlength) (@hBT) (@consecutive) (@S) (@hSBlen) (@beta) + (@hab) (@lastPositive) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) + (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) + (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@lastStar) + +private theorem helper_continuation_6826.{u_1, u_2} : + helperContinuation6826Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A n Tn mu hp htail trans + hlenT B X hBlength hXlength hBT hXB hTnX r f y consecutive hyf S hSBlen beta hbetaF z hzB + hbetaz hzy hzX hab sigma fixed missingFixed fixedB missingTree minusEq lastPositive + positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB goodB EB coreBX + closureBX corr hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK + coreInsideK positiveK increasingK dividerStageK KF starredEq stageBX allStageB terminalTree + storedEq + have stageMissingEq (j : Fin (HB.dividerCount + 1)) : + HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by + exact @helper_stageMissingEq_5267 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) + (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@stageBX) + (@terminalTree) (@j) + have earlyMissing (j : Fin (B.length + 1)) (hj : j.val < B.length) : + MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j) := by + exact helper_earlyMissing_3639 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hlenT) (@hBlength) (@hXlength) (@hXB) (@S) (@hSBlen) (@beta) + (@hab) (@missingFixed) (@lastPositive) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@j) (@hj) + -- Last-vertex changes preserve the totalized least missing position. + have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) + (j : Fin (B.length + 1)) (hj : c ∈ MissingColors G psi (B.vertex j)) : + (HierarchyFirstMissingPosition psi B c).val ≤ j.val := by + exact helper_firstLe_1804 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@hlenT) (@psi) (@c) (@j) (@hj) + have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition psi B c).val < B.length) : + c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c)) := by + exact helper_firstMem_1814 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) + (@hlenT) (@hBlength) (@S) (@hSBlen) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@psi) (@c) (@hlt) + have firstEq (c : Fin k) : HierarchyFirstMissingPosition sigma B c = + HierarchyFirstMissingPosition mu B c := by + exact helper_firstEq_1146 G k e0 input T phi ett base C ctx P alpha hlenT hBlength S hSBlen + positiveB aboveB strictB + belowB generatingB baseB HB earlyMissing firstLe firstMem c + have stageFixed (j : Fin (HB.dividerCount + 1)) (t : Fin (HB.stage j.succ).length) : + sigma ((HB.stage j.succ).edge t) = mu ((HB.stage j.succ).edge t) := by + rw [← (allStageB j.succ).2.2 t] + exact fixedB _ + have segmentEq (j : Fin (HB.dividerCount + 1)) (c : Fin k) : + HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by + exact @helper_segmentEq_5302 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@trans) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) + (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) + (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) (@firstEq) + (@stageFixed) (@j) (@c) + let goodS : GoodHierarchy KF := by + exact { + gamma := goodB.gamma + twoColors := by + intro j c hc + exact goodB.twoColors j c (by rw [storedEq j] at hc; exact hc) + avoidance := by + intro j c hc + rw [stageMissingEq j, segmentEq j c] + exact goodB.avoidance j c (by rw [storedEq j] at hc; exact hc) + disjointPairs := by + intro j c d hc hd hne + exact goodB.disjointPairs j c d (by rw [storedEq j] at hc; exact hc) + (by rw [storedEq j] at hd; exact hd) hne + uniqueRefresh := by + exact @helper_uniqueRefresh_5324 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hlenT) (@missingFixed) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@goodB) (@corr) (@bs) (@baseStageK) (@terminalStageK) + (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) + (@starredEq) (@stageBX) (@storedEq) + parallelBase := by + exact @helper_parallelBase_5330 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hp) (@hlenT) (@hTnX) (@missingTree) (@minusEq) (@positiveB) (@aboveB) + (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@coreBX) (@closureBX) + (@corr) (@bs) (@hcore) (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) + (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) + (@terminalTree) (@storedEq) + minusClosed := by + intro i + change TreeColorSetMinusClosed G sigma (HB.stage i.succ.castSucc) + ((HierarchyStoredColorsAt KF i.succ).biUnion (goodB.gamma i.castSucc)) + rw [storedEq i.succ, minusEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBX + i.succ))] + exact goodB.minusClosed i } + have hbetaY : beta ∈ MissingColors G sigma y := by + exact @helper_hbetaY_1908 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) + (@trans) (@hlenT) (@hyf) (@beta) (@hbetaF) (@hab) (@fixed) + have hnotElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := by + exact helper_hnotElementary_1918 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hlenT) (@beta) (@z) (@hzB) (@hbetaz) (@hzy) (@hzX) + (@missingFixed) (@hbetaY) + let CS : HierarchyCounterexample bs := by + exact { + positive := by rw [corr.rungAgreement]; exact old.positive + hierarchy := KF + good := goodS + maximum := hmaximum + notElementary := hnotElementary } + have lastStar : HierarchyStarredStage KF (Fin.last KF.dividerCount) = A := by + exact @helper_lastStar_5360 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) + (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@hcountB) + (@hstagesB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) + (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) + have hpS : HierarchyPathNumber KF = 1 := by + exact @helper_hpS_5366 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@htail) + (@hlenT) (@hBlength) (@hBT) (@consecutive) (@S) (@hSBlen) (@beta) (@hab) (@lastPositive) + (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) + (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) + (@increasingK) (@dividerStageK) (@lastStar) + have lastOrdinary : HB.stage (Fin.last HB.dividerCount).castSucc = + H.stage (Fin.last H.dividerCount).castSucc := by + exact helper_lastOrdinary_1941 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) + (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) + (@hcountB) (@hstagesB) + have hlastLength : (H.stage (Fin.last H.dividerCount).castSucc).length < B.length := by + have hh := HB.strict (Fin.last HB.dividerCount) + simpa only [lastOrdinary, Fin.succ_last, HB.terminalStage] using hh + -- The comparison is at the original rung and divider count. + apply P.minimumContext.lexicographicMinimality CS corr.rungAgreement hcountB + change HierarchyCounterexampleLess + (HierarchyPathNumber KF, B.length - (HB.stage ⟨HB.dividerCount, by omega⟩).length) + (HierarchyPathNumber H, T.length - (H.stage ⟨H.dividerCount, by omega⟩).length) + rw [hpS, hp] + right + refine ⟨rfl, ?_⟩ + have hidx : (⟨HB.dividerCount, by omega⟩ : Fin (HB.dividerCount + 2)) = + (Fin.last HB.dividerCount).castSucc := Fin.ext rfl + have hidxH : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + (Fin.last H.dividerCount).castSucc := Fin.ext rfl + rw [hidx, hidxH, lastOrdinary] + dsimp only + omega + +private theorem helper_continuation_7103.{u_1, u_2} : + helperContinuation7103Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A n Tn mu hp htail trans + chain coreA hTnA hlenT B X hBlength hXlength hBT hAX hXB hTnX hAB r f y w consecutive hends + hyf S hSBlen beta hbetaF z hzB hbetaz hzy hzX hab sigma fixed hsproper hsone incidentFixed + missingFixed fixedB stable hrouteB missingTree + have boundaryEq (U : TreeSequence G e0) + (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) (c : Fin k) : + BoundaryColorEdges G sigma (TreeSequenceVertexSet U) c = + BoundaryColorEdges G mu (TreeSequenceVertexSet U) c := by + exact helper_boundaryEq_1679 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hlenT) (@hends) (@incidentFixed) (@U) (@hUX) (@c) + have minusEq (U : TreeSequence G e0) + (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) (R : Finset (Fin k)) : + TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R := by + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [missingTree U hUX] + simp only [boundaryEq U hUX] + have lastPositive (hq : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact helper_lastPositive_1695 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) + (@hlenT) (@S) (@hSBlen) (@hq) + have ordinaryA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + exact helper_ordinaryA_1704 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) + (@chain) (@hTnA) (@hlenT) (@S) (@hSBlen) (@lastPositive) (@j) + have starA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + refine Fin.cases coreA (fun i => ordinaryA i.succ) j + -- Retain the old prefix data; construct the recolored ETT separately. + obtain ⟨eb, hmaxB, hrungB, hseriesB, baseB, hcoreB, hclosureB, hsupportB, + HB, hcountB, hstagesB, hdividersB, goodB, hcolorsB⟩ := + GoodHierarchyTerminalPrefixRepackage G k e0 P.corresponding.replacementInput T + mu mu P.corresponding.replacementETT old.maximum P.replacementBase H old.good + B hAB (by change A.length < B.length; omega) hBT + rcases eb with ⟨roundsB, positiveB, seriesB, aboveB, strictB, belowB, generatingB⟩ + dsimp only at hrungB hseriesB + cases hrungB + have hs : seriesB = P.corresponding.replacementETT.series := eq_of_heq hseriesB + cases hs + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := by + exact @helperEB1665 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hlenT) + (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) + have coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X := by + rw [hcoreB] + exact TreeSequenceInitialSegmentVertexSetSubset (trans coreA hAX) + have closureBX (hpe : EB.series.data.kind (Fin.last EB.rounds) = + some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X := by + exact helper_closureBX_1732 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) + (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@coreBX) + (@hpe) + -- PE preparation rebuilds the base; SE/RE retain the exact seed. + have hdata : ∃ corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B, + MaximumProperty corr.replacementETT ∧ + ∃ bs : HierarchyBase corr.replacementETT sigma, + ∃ K : TashkinovHierarchy corr.replacementETT bs, + SameHierarchyStages HB K := by + exact @helper_hdata_485 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha hp trans hlenT S hSBlen hsproper hsone incidentFixed + missingFixed stable hrouteB positiveB aboveB strictB belowB generatingB hmaxB baseB HB + closureBX + obtain ⟨corr, hmaximum, bs, K, hsame⟩ := hdata + let KF := K + rcases hsame with ⟨hcore, hcount, hstage, hposition, hpe, hclosure⟩ + rcases K with ⟨qK, stageK, baseStageK, terminalStageK, nestedK, strictK, + positionK, positiveK, increasingK, dividerStageK, coreInsideK⟩ + change HB.dividerCount = qK at hcount + cases hcount + have hs : HB.stage = stageK := eq_of_heq hstage + cases hs + have hpos : HB.dividerPosition = positionK := eq_of_heq hposition + cases hpos + have starredEq (j : Fin (HB.dividerCount + 1)) : + HierarchyStarredStage KF j = HierarchyStarredStage HB j := by + refine Fin.cases hcore.symm (fun _ => rfl) j + have stageBX (j : Fin (HB.dividerCount + 1)) : + TreeSequenceInitialSegment (HB.stage j.castSucc) X := by + rw [(hstagesB j).1] + exact trans (ordinaryA _) hAX + have starBX (j : Fin (HB.dividerCount + 1)) : + TreeSequenceVertexSet (HierarchyStarredStage HB j) ⊆ TreeSequenceVertexSet X := by + rw [(hstagesB j).2] + exact TreeSequenceInitialSegmentVertexSetSubset (trans (starA _) hAX) + have allStageB (j : Fin (HB.dividerCount + 2)) : + TreeSequenceInitialSegment (HB.stage j) B := by + exact Fin.reverseInduction (motive := fun j => + TreeSequenceInitialSegment (HB.stage j) B) + (by rw [HB.terminalStage]; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩) + (fun i hi => trans (HB.nested i) hi) j + have terminalTree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + exact @helper_terminalTree_5246 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hp) (@hlenT) (@S) (@hSBlen) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) (@hcore) (@hpe) (@hclosure) + (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) + (@increasingK) (@dividerStageK) (@hstage) (@hposition) (@starredEq) + have terminalStored : TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = TashkinovStoredColors EB.series.data + (Fin.last EB.rounds) := by + exact @helper_terminalStored_5253 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hp) (@hlenT) (@hTnX) (@S) (@hSBlen) (@missingTree) (@positiveB) (@aboveB) + (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) (@hcore) + (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) + (@positiveK) (@increasingK) (@dividerStageK) (@hstage) (@hposition) (@starredEq) + (@terminalTree) + have storedEq (j : Fin (HB.dividerCount + 1)) : + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j := by + unfold HierarchyStoredColorsAt + dsimp only + rw [terminalStored, starredEq j, missingTree _ (starBX j)] + exact @helper_continuation_6826 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@hp) (@htail) (@trans) (@hlenT) (@hBlength) (@hXlength) (@hBT) (@hXB) (@hTnX) + (@consecutive) (@hyf) (@S) (@hSBlen) (@beta) (@hbetaF) (@z) (@hzB) (@hbetaz) (@hzy) (@hzX) + (@hab) (@fixed) (@missingFixed) (@fixedB) (@missingTree) (@minusEq) (@lastPositive) + (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@hcountB) + (@hstagesB) (@goodB) (@coreBX) (@closureBX) (@corr) (@hmaximum) (@bs) (@hcore) (@hpe) + (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) + (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) (@stageBX) (@allStageB) + (@terminalTree) (@storedEq) + +theorem HierarchySituationOneShorteningContradiction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hsituation : HierarchyPathNumber C.hierarchy = 1) + (hlast : HierarchyFullTailLength C - 1 ∈ + HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx) : False := by + classical + open scoped Sym2 in + obtain ⟨P, alpha, haB, haT⟩ := (Finset.mem_filter.mp hlast).2 + let old := P.counterexample + let H := old.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let n := Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let mu := P.coloring + have sameLast : ∀ {a b : ℕ} + (s : Fin (a + 2) → TreeSequence G e0) + (t : Fin (b + 2) → TreeSequence G e0) + (u v : TreeSequence G e0), + a = b → HEq s t → u = v → + Fin.cases (motive := fun _ => TreeSequence G e0) + u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = + Fin.cases (motive := fun _ => TreeSequence G e0) + v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by + exact @helper_sameLast_4923 (@V) (@E) (@G) (@e0) + have hAold : HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A := + sameLast _ _ _ _ P.sameGood.1.2.1 P.sameGood.1.2.2.1 P.sameGood.1.1 + have hp : HierarchyPathNumber H = 1 := by + unfold HierarchyPathNumber at hsituation ⊢ + dsimp only at hsituation ⊢ + rw [hAold] at hsituation + exact hsituation + have htail : 2 ≤ T.length - A.length := + HierarchyCounterexampleTailAtLeastTwo G k e0 P.corresponding.replacementInput + T mu P.corresponding.replacementETT P.replacementBase old + P.minimumContext.proper P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality P.minimumContext.largeMissingSet + have trans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + exact helper_trans_1493 (@G) (@e0) (@hXY) (@hYZ) + have chain : ∀ (j : ℕ) (hj : j < H.dividerCount + 2) + (i : Fin (H.dividerCount + 2)), i.val ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage ⟨j, hj⟩) := by + exact @helper_chain_747 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P trans + have starNext (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) (H.stage j.succ) := by + refine Fin.cases H.coreInsideFirst (fun i => H.nested i.succ) j + have hAT : TreeSequenceInitialSegment A T := by + have hh := starNext (Fin.last H.dividerCount) + simpa only [Fin.succ_last, H.terminalStage] using hh + have hTnCore : TreeSequenceInitialSegment Tn P.replacementBase.core := by + exact helper_hTnCore_1512 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have coreA : TreeSequenceInitialSegment P.replacementBase.core A := by + exact @helper_coreA_353 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P trans chain + have hTnA := trans hTnCore coreA + have hlenT : 3 ≤ T.length := by have := A.positive; omega + let B := TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + let X := TreeSequencePrefix T (T.length - 2) (by omega) (by omega) + have hBlength : B.length = T.length - 1 := rfl + have hXlength : X.length = T.length - 2 := rfl + have hBT : TreeSequenceInitialSegment B T := ⟨by omega, + fun _ => rfl, fun _ => rfl⟩ + have hXT : TreeSequenceInitialSegment X T := ⟨by omega, + fun _ => rfl, fun _ => rfl⟩ + have common {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + exact @helper_common_1530 (@V) (@E) (@G) (@e0) (@trans) (@S) (@U) (@W) (@hSW) (@hUW) (@hlen) + have hAX : TreeSequenceInitialSegment A X := common hAT hXT (by omega) + have hXB : TreeSequenceInitialSegment X B := common hXT hBT (by omega) + have hTnX := trans hTnA hAX + have hAB := trans hAX hXB + have hfull : HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) = B := by + exact helper_hfull_1543 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@hAold) (@htail) + (@hlenT) + have halphaB : alpha ∈ MissingColors G mu (B.vertex (Fin.last B.length)) := by + rw [hfull] at haB + exact haB + let r : Fin T.length := ⟨T.length - 1, by omega⟩ + let f := T.edge r + let y := B.vertex (Fin.last B.length) + let w := T.vertex (Fin.last T.length) + have hy : T.vertex r.castSucc = y := by rfl + have hw : T.vertex r.succ = w := by + apply congrArg T.vertex + apply Fin.ext + dsimp [r] + omega + have consecutive (t : Fin T.length) (ht : A.length + 1 ≤ t.val) : + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by + exact helper_consecutive_824 G k e0 input T phi ett base C ctx P hp htail hlenT t ht + have hends : G.ends f = s(y, w) := + (consecutive r (by dsimp [r]; omega)).trans (by rw [hy, hw]) + have hyf : Incident G y f := by rw [Incident, hends]; exact Sym2.mem_mk_left _ _ + have hwf : Incident G w f := by rw [Incident, hends]; exact Sym2.mem_mk_right _ _ + have hsource : ∃ S : TreeSequence G e0, + S.length ≤ B.length ∧ TashkinovAugmentationSequence mu S T := by + exact helper_hsource_1573 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hlenT) (@hBlength) (@hXlength) (@hTnX) + obtain ⟨S, hSBlen, hseq⟩ := hsource + obtain ⟨hlen, hpre, beta, hbetaColor, hbetaMissing⟩ := + (TashkinovAugmentationSequencePosition mu S T hseq r + (by simpa only [B, TreeSequencePrefix, r] using hSBlen)).1 + have hbetaF : mu f = some beta := by + convert hbetaColor using 1 + congr 2 + have hbetaB : beta ∈ TreeMissingColors mu B := hbetaMissing + obtain ⟨z, hzB, hbetaz⟩ := Finset.mem_biUnion.mp hbetaB + have hzy : z ≠ y := by + exact helper_hzy_1590 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hlenT) (@hyf) + (@beta) (@hbetaF) (@z) (@hzB) (@hbetaz) + have hzX : z ∈ TreeSequenceVertexSet X := by + exact @helper_hzX_1597 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@trans) (@hlenT) + (@hBlength) (@hXlength) (@S) (@hSBlen) (@z) (@hzB) (@hzy) + have hab : alpha ≠ beta := by + intro he + have halphaPresent : alpha ∈ PresentColors G mu y := by + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hyf, by rw [he]; exact hbetaF⟩ + exact (Finset.mem_sdiff.mp halphaB).2 halphaPresent + let sigma : PartialEdgeColoring E k := fun e => if e = f then some alpha else mu e + have fixed (e : E) (hef : e ≠ f) : sigma e = mu e := by simp [sigma, hef] + have hsproper : IsProperEdgeColoring G sigma := by + exact @helper_hsproper_482 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha haT trans hlenT halphaB hends fixed + have hfe0 : f ≠ e0 := by + exact @helper_hfe0_1615 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@trans) + (@hlenT) (@S) (@hSBlen) (@beta) (@hab) + have hsone : IsOneEdgeUncolored sigma e0 := by + exact helper_hsone_1621 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@hlenT) + (@fixed) (@hfe0) + have noInc (v : V) (hv : v ∈ TreeSequenceVertexSet X) : ¬ Incident G v f := by + exact @helper_noInc_902 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha trans hlenT hXlength hXT hy hends S hSBlen beta hab + v hv + have incidentFixed (e : E) (he : TreeIncidentEdge X e) : sigma e = mu e := by + apply fixed + intro hef + obtain ⟨v, hv, hi⟩ := he + exact noInc v hv (hef ▸ hi) + have missingFixed (v : V) (hv : v ∈ TreeSequenceVertexSet X) : + MissingColors G sigma v = MissingColors G mu v := by + exact @helper_missingFixed_1637 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@trans) (@hlenT) (@incidentFixed) (@v) (@hv) + have fixedB (t : Fin B.length) : sigma (B.edge t) = mu (B.edge t) := by + exact @helper_fixedB_1646 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@trans) + (@hlenT) (@hBlength) (@hBT) (@S) (@hSBlen) (@fixed) (@t) + have stable : StableColoring Tn + (TashkinovStoredColors P.corresponding.replacementETT.series.data n) + (P.corresponding.replacementETT.series.data.coloring n) sigma := by + exact helper_stable_1654 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@hlenT) + (@hTnX) (@incidentFixed) (@missingFixed) + have hrouteB : + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B) ∨ + ((P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = {edge} ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ + TashkinovAugmentationSequence sigma seed B) := by + exact @helper_hrouteB_951 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha trans hlenT hBlength hXlength hBT common hXB hTnX + S hSBlen hseq hpre beta hab missingFixed fixedB + have missingTree (U : TreeSequence G e0) + (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) : + TreeMissingColors sigma U = TreeMissingColors mu U := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => missingFixed v (hUX hv)) + exact @helper_continuation_7103 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hp) (@htail) (@trans) (@chain) (@coreA) (@hTnA) (@hlenT) (@hBlength) + (@hXlength) (@hBT) (@hAX) (@hXB) (@hTnX) (@hAB) (@consecutive) (@hends) (@hyf) (@S) + (@hSBlen) (@beta) (@hbetaF) (@z) (@hzB) (@hbetaz) (@hzy) (@hzX) (@hab) (@fixed) + (@hsproper) (@hsone) (@incidentFixed) (@missingFixed) (@fixedB) (@stable) (@hrouteB) + (@missingTree) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean new file mode 100644 index 0000000000..875cd93d76 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean @@ -0,0 +1,1081 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.EmptyCommonMissingLocation +public import LeanPool.GoldbergSeymour.BaseExtraReplacement +public import LeanPool.GoldbergSeymour.AbsentOwnerReplacement +public import LeanPool.GoldbergSeymour.LateOwnerReplacement +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTerminalCommonMissing +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySituationThreeClaimJMinusOneNonempty +public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.NineN +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoStarredTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable + +/-! +# Hierarchy Situation Three Claim JMinus One Empty + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch291Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy → + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C → + (∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → + IsOneEdgeUncolored mu e0 → ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ + (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { + replacementInput := input, replacementSeries := ett.series, replacementETT := ett, + rungAgreement := rfl, seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (_ : Fin ett.rounds) => rfl, + storedColorsAgree := fun (_ : Fin (ett.rounds + (1 : ℕ))) => rfl, + connectingEdgesAgree := fun (_ : Fin (ett.rounds + (1 : ℕ))) => rfl, + extensionKindsAgree := fun (_ : Fin (ett.rounds + (1 : ℕ))) => rfl, + replacementProper := seriesProper, replacementOneUncolored := seriesOne, + replacementStable := fun (x : Fin ett.rounds) => + (⟨fun (x_1 : E) (_ : TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) x_1) + (_ : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ x_1 = some c) => + rfl, + fun (x_1 : V) (_ : x_1 ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc)) => + rfl⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ f = some c) → + ett.series.data.coloring x.succ f = ett.series.data.coloring x.succ f) ∧ + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc), + MissingColors G (ett.series.data.coloring x.succ) v = + MissingColors G (ett.series.data.coloring x.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + let _ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { + coloring := phi, corresponding := selfCorr, maximum := C.maximum, replacementBase := base, + counterexample := C, + sameGood := + (⟨(⟨rfl, + (⟨rfl, + (⟨HEq.rfl, + (⟨HEq.rfl, + (⟨Iff.rfl, + fun + (_ : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) => + rfl⟩ : + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + base.core = base.core ∧ + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure)), + Exists.intro rfl fun (x : Fin (C.hierarchy.dividerCount + (1 : ℕ))) => + (⟨rfl, fun (x_1 : Fin k) (_ : x_1 ∈ HierarchyStoredColorsAt C.hierarchy x) => rfl⟩ : + HierarchyStoredColorsAt C.hierarchy x = + HierarchyStoredColorsAt C.hierarchy + (Fin.cast + ((by + first + | omega)) + x) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy x, + C.good.gamma x eta = + C.good.gamma + (Fin.cast + ((by + first + | omega)) + x) + eta)⟩ : + SameHierarchyStages C.hierarchy C.hierarchy ∧ + ∃ (hcount : C.hierarchy.dividerCount = C.hierarchy.dividerCount), + ∀ (j : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + have j₂ : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.cast + ((by + first + | omega)) + j; + HierarchyStoredColorsAt C.hierarchy j = HierarchyStoredColorsAt C.hierarchy j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy j, + C.good.gamma j eta = C.good.gamma j₂ eta), + minimumContext := ctx : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx }; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let ell : ℕ := HierarchyFullTailLength C; + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + TreeSequenceInitialSegment A T → + (3 : ℕ) ≤ ell → + ell = T.length - A.length → + (∀ r ≤ ell, (HierarchyFullTailPrefix C r).length = A.length + r) → + (∀ (r : ℕ), TreeSequenceInitialSegment (HierarchyFullTailPrefix C r) T) → + B.length = T.length - (1 : ℕ) → + Y.length = A.length + (j - (2 : ℕ)) → + (∀ (U : TreeSequence G e0) (i : Fin (U.length + (1 : ℕ))), + U.vertex i ∈ TreeSequenceVertexSet U) → + (∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j) → + (∀ (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c))) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (i : ℕ), + (1 : ℕ) ≤ i ∧ i ≤ ell - (1 : ℕ) → + c ∈ + MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length)) → + c ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) → I.Nonempty) → + ∀ alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)), + alpha ∈ TreeMissingColors phi A → + alpha ∈ TreeMissingColors phi Y → + let q : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.last C.hierarchy.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt C.hierarchy q; + ∀ eta ∈ D, + alpha ∈ C.good.gamma q eta → + eta ∈ TreeMissingColors phi B → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let H : + TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := + (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun (v : V) => MissingColors G P.coloring v; + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ + alpha ∈ TreeMissingColors P.coloring B ∧ + (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, + alpha ∈ P.counterexample.good.gamma q eta ∧ + (↑(HierarchyFirstMissingPosition P.coloring T eta) : ℕ) ≤ B.length) + +private abbrev helperBranch326Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy → + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C → + (∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → + IsOneEdgeUncolored mu e0 → ∀ (v : V), (MissingColors G mu v).Nonempty) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Z → + TreeSequenceInitialSegment Y Z → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + ∀ + (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { + replacementInput := input, replacementSeries := ett.series, replacementETT := ett, + rungAgreement := rfl, seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (_ : Fin ett.rounds) => rfl, + storedColorsAgree := fun (_ : Fin (ett.rounds + (1 : ℕ))) => rfl, + connectingEdgesAgree := fun (_ : Fin (ett.rounds + (1 : ℕ))) => rfl, + extensionKindsAgree := fun (_ : Fin (ett.rounds + (1 : ℕ))) => rfl, + replacementProper := seriesProper, replacementOneUncolored := seriesOne, + replacementStable := fun (x : Fin ett.rounds) => + (⟨fun (x_1 : E) (_ : TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) x_1) + (_ : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ x_1 = some c) => + rfl, + fun (x_1 : V) + (_ : x_1 ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc)) => + rfl⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ f = some c) → + ett.series.data.coloring x.succ f = ett.series.data.coloring x.succ f) ∧ + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc), + MissingColors G (ett.series.data.coloring x.succ) v = + MissingColors G (ett.series.data.coloring x.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + let _ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { + coloring := phi, corresponding := selfCorr, maximum := C.maximum, replacementBase := base, + counterexample := C, + sameGood := + (⟨(⟨rfl, + (⟨rfl, + (⟨HEq.rfl, + (⟨HEq.rfl, + (⟨Iff.rfl, + fun + (_ : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) => + rfl⟩ : + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + base.core = base.core ∧ + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure)), + Exists.intro rfl fun (x : Fin (C.hierarchy.dividerCount + (1 : ℕ))) => + (⟨rfl, fun (x_1 : Fin k) (_ : x_1 ∈ HierarchyStoredColorsAt C.hierarchy x) => rfl⟩ : + HierarchyStoredColorsAt C.hierarchy x = + HierarchyStoredColorsAt C.hierarchy + (Fin.cast + ((by + first + | omega)) + x) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy x, + C.good.gamma x eta = + C.good.gamma + (Fin.cast + ((by + first + | omega)) + x) + eta)⟩ : + SameHierarchyStages C.hierarchy C.hierarchy ∧ + ∃ (hcount : C.hierarchy.dividerCount = C.hierarchy.dividerCount), + ∀ (j : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + have j₂ : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.cast + ((by + first + | omega)) + j; + HierarchyStoredColorsAt C.hierarchy j = HierarchyStoredColorsAt C.hierarchy j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy j, + C.good.gamma j eta = C.good.gamma j₂ eta), + minimumContext := ctx : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx }; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let ell : ℕ := HierarchyFullTailLength C; + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + TreeSequenceInitialSegment A T → + (3 : ℕ) ≤ ell → + ell = T.length - A.length → + (∀ r ≤ ell, (HierarchyFullTailPrefix C r).length = A.length + r) → + (∀ (r : ℕ), TreeSequenceInitialSegment (HierarchyFullTailPrefix C r) T) → + B.length = T.length - (1 : ℕ) → + Y.length = A.length + (j - (2 : ℕ)) → + TreeSequenceInitialSegment A Y → + (∀ {X Z : TreeSequence G e0} (psi : PartialEdgeColoring E k), + TreeSequenceInitialSegment X Z → + TreeMissingColors psi X ⊆ TreeMissingColors psi Z) → + (∀ (U : TreeSequence G e0) (i : Fin (U.length + (1 : ℕ))), + U.vertex i ∈ TreeSequenceVertexSet U) → + (∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G psi (T.vertex j) → + HierarchyFirstMissingPosition psi T c ≤ j) → + (∀ (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c))) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (i : ℕ), + (1 : ℕ) ≤ i ∧ i ≤ ell - (1 : ℕ) → + c ∈ + MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length)) → + c ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) → I.Nonempty) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ + c ∈ + TreeMissingColors P.coloring + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ))), + c ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) → + c ∈ + TreeMissingColors P.coloring + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount))) → + ∀ alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)), + alpha ∈ TreeMissingColors phi A → + alpha ∈ TreeMissingColors phi Y → + let q : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.last C.hierarchy.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt C.hierarchy q; + let Gamma : Finset (Fin k) := D.biUnion (C.good.gamma q); + alpha ∈ Gamma → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let H : + TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := + (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun (v : V) => MissingColors G P.coloring v; + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ + alpha ∈ TreeMissingColors P.coloring B ∧ + (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, + alpha ∈ P.counterexample.good.gamma q eta ∧ + (↑(HierarchyFirstMissingPosition P.coloring T eta) : ℕ) ≤ B.length) + +private abbrev helperContinuation671Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy → + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C → + (∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → + IsOneEdgeUncolored mu e0 → ∀ (v : V), (MissingColors G mu v).Nonempty) → + ¬(HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Z → + TreeSequenceInitialSegment Y Z → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + ∀ + (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { + replacementInput := input, replacementSeries := ett.series, replacementETT := ett, + rungAgreement := rfl, seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (_ : Fin ett.rounds) => rfl, + storedColorsAgree := fun (_ : Fin (ett.rounds + (1 : ℕ))) => rfl, + connectingEdgesAgree := fun (_ : Fin (ett.rounds + (1 : ℕ))) => rfl, + extensionKindsAgree := fun (_ : Fin (ett.rounds + (1 : ℕ))) => rfl, + replacementProper := seriesProper, replacementOneUncolored := seriesOne, + replacementStable := fun (x : Fin ett.rounds) => + (⟨fun (x_1 : E) (_ : TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) x_1) + (_ : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ x_1 = some c) => + rfl, + fun (x_1 : V) + (_ : x_1 ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc)) => + rfl⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ f = some c) → + ett.series.data.coloring x.succ f = ett.series.data.coloring x.succ f) ∧ + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc), + MissingColors G (ett.series.data.coloring x.succ) v = + MissingColors G (ett.series.data.coloring x.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + let _ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { + coloring := phi, corresponding := selfCorr, maximum := C.maximum, + replacementBase := base, counterexample := C, + sameGood := + (⟨(⟨rfl, + (⟨rfl, + (⟨HEq.rfl, + (⟨HEq.rfl, + (⟨Iff.rfl, + fun + (_ : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) => + rfl⟩ : + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + base.core = base.core ∧ + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure)), + Exists.intro rfl fun (x : Fin (C.hierarchy.dividerCount + (1 : ℕ))) => + (⟨rfl, fun (x_1 : Fin k) (_ : x_1 ∈ HierarchyStoredColorsAt C.hierarchy x) => rfl⟩ : + HierarchyStoredColorsAt C.hierarchy x = + HierarchyStoredColorsAt C.hierarchy + (Fin.cast + ((by + first + | omega)) + x) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy x, + C.good.gamma x eta = + C.good.gamma + (Fin.cast + ((by + first + | omega)) + x) + eta)⟩ : + SameHierarchyStages C.hierarchy C.hierarchy ∧ + ∃ (hcount : C.hierarchy.dividerCount = C.hierarchy.dividerCount), + ∀ (j : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + have j₂ : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.cast + ((by + first + | omega)) + j; + HierarchyStoredColorsAt C.hierarchy j = HierarchyStoredColorsAt C.hierarchy j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy j, + C.good.gamma j eta = C.good.gamma j₂ eta), + minimumContext := ctx : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx }; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let ell : ℕ := HierarchyFullTailLength C; + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let _ : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + TreeSequenceInitialSegment A T → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := + (TreeSequenceVertexSet P.replacementBase.core \ TreeSequenceVertexSet Tn).biUnion + fun (v : V) => MissingColors G P.coloring v; + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ + alpha ∈ TreeMissingColors P.coloring B ∧ + (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, + alpha ∈ P.counterexample.good.gamma q eta ∧ + (↑(HierarchyFirstMissingPosition P.coloring T eta) : ℕ) ≤ B.length) + +private theorem helper_branch_291.{u_1, u_2} : + helperBranch291Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hpathLower hpathUpper hvertexMissing + seriesProper seriesOne selfCorr P0 j ell A B Y I hAT htail hell prefixLen prefixT hBLen + hYLen vertexMem firstLe firstMem eligible alpha haTerminal haA haY q D eta heta haGamma howner + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp howner + obtain ⟨x, hx⟩ : ∃ x, B.vertex x = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hv + have hmT : eta ∈ MissingColors G phi + (T.vertex (Fin.castLE (Nat.succ_le_succ (prefixT (ell - 1)).1) x)) := by + rw [(prefixT (ell - 1)).2.1, hx]; exact hm + have hfLe := firstLe phi eta _ hmT + have hfLt : (HierarchyFirstMissingPosition phi T eta).val < T.length := by + change (HierarchyFirstMissingPosition phi T eta).val ≤ x.val at hfLe + have := x.isLt + omega + have hmFirst := firstMem phi eta hfLt + have hnotA : eta ∉ TreeMissingColors phi A := (Finset.mem_sdiff.mp heta).2 + have hfPos : A.length < (HierarchyFirstMissingPosition phi T eta).val := by + by_contra hh + have hle : (HierarchyFirstMissingPosition phi T eta).val ≤ A.length := by omega + let a : Fin (A.length + 1) := ⟨(HierarchyFirstMissingPosition phi T eta).val, by omega⟩ + have hidx : Fin.castLE (Nat.succ_le_succ hAT.1) a = + HierarchyFirstMissingPosition phi T eta := Fin.ext rfl + apply hnotA + refine Finset.mem_biUnion.mpr ⟨A.vertex a, vertexMem A a, ?_⟩ + rw [← hAT.2.1 a, hidx] + exact hmFirst + by_cases hsmall : (HierarchyFirstMissingPosition phi T eta).val ≤ Y.length + · exact ⟨P0, alpha, haTerminal, haY, Or.inr ⟨eta, heta, haGamma, hsmall⟩⟩ + let t := (HierarchyFirstMissingPosition phi T eta).val - A.length + have htpos : 1 ≤ t := by dsimp [t]; omega + have htupper : t < ell := by dsimp [t]; omega + have htlate : j - 1 ≤ t := by dsimp [t]; omega + have hfirst : (HierarchyFirstMissingPosition phi T eta).val = A.length + t := by + dsimp [t]; omega + have hmTail : eta ∈ MissingColors G phi + ((HierarchyFullTailPrefix C t).vertex + (Fin.last (HierarchyFullTailPrefix C t).length)) := by + rw [← (prefixT t).2.1] + have hp := prefixLen t (by omega) + have hidx : Fin.castLE (Nat.succ_le_succ (prefixT t).1) + (Fin.last (HierarchyFullTailPrefix C t).length) = + HierarchyFirstMissingPosition phi T eta := by + apply Fin.ext + simp only [Fin.val_castLE, Fin.val_last] + omega + rw [hidx] + exact hmFirst + obtain ⟨P, hterm, htailMissing⟩ := P2905_T2_LateOwnerReplacement + G k e0 input T phi ett base C ctx hpathLower hpathUpper + alpha haTerminal haA eta heta haGamma t htpos htupper htlate hfirst hmTail + exact HierarchySituationThreeClaimJMinusOneNonempty G k e0 input T phi + ett base C ctx hpathLower hpathUpper hvertexMissing + (eligible P eta t ⟨htpos, by omega⟩ htailMissing hterm) + +private theorem helper_branch_326.{u_1, u_2} : + helperBranch326Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hpathLower hpathUpper hvertexMissing common + seriesProper seriesOne selfCorr P0 j ell A B Y I hAT htail hell prefixLen prefixT hBLen + hYLen hAY missingMono vertexMem firstLe firstMem eligible emptyReduction alpha haTerminal + haA haY q D Gamma hgamma + obtain ⟨eta, heta, haGamma⟩ := Finset.mem_biUnion.mp hgamma + by_cases howner : eta ∈ TreeMissingColors phi B + · exact @helper_branch_291 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hpathLower hpathUpper hvertexMissing seriesProper seriesOne hAT + htail hell prefixLen prefixT hBLen hYLen vertexMem firstLe firstMem eligible alpha + haTerminal haA haY eta heta haGamma howner + · obtain ⟨P, beta, hterm, hbX, hbad⟩ := P2905_T2_AbsentOwnerReplacement + G k e0 input T phi ett base C ctx hpathLower hpathUpper + alpha haTerminal haA eta heta haGamma howner + have hXB : TreeSequenceInitialSegment + (HierarchyFullTailPrefix C (ell - 2)) B := + common (prefixT _) (prefixT _) (by + rw [prefixLen _ (by omega), hBLen]; omega) + have hbA := emptyReduction P beta (missingMono P.coloring hXB hbX) hterm + exact ⟨P, beta, hterm, missingMono P.coloring hAY hbA, Or.inl hbad⟩ + +private theorem helper_continuation_671.{u_1, u_2} : + helperContinuation671Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hpathLower hpathUpper hvertexMissing hempty + common seriesProper seriesOne selfCorr P0 j ell A B Y I hAT + have htail : 3 ≤ ell := by change j < ell at hpathUpper; change 2 ≤ j at hpathLower; omega + have hell : ell = T.length - A.length := rfl + have prefixLen (r : ℕ) (hr : r ≤ ell) : + (HierarchyFullTailPrefix C r).length = A.length + r := by as_aux_lemma => + change min (A.length + r) T.length = A.length + r + apply Nat.min_eq_left + omega + have prefixT (r : ℕ) : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C r) T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hBLen : B.length = T.length - 1 := by + have := prefixLen (ell - 1) (by omega) + change B.length = A.length + (ell - 1) at this + omega + have hYLen : Y.length = A.length + (j - 2) := prefixLen _ (by + change j < ell at hpathUpper; omega) + have hAB : TreeSequenceInitialSegment A B := common hAT (prefixT _) (by omega) + have hAY : TreeSequenceInitialSegment A Y := common hAT (prefixT _) (by omega) + have hYB : TreeSequenceInitialSegment Y B := common (prefixT _) (prefixT _) (by + change j < ell at hpathUpper; omega) + have missingMono {X Z : TreeSequence G e0} + (psi : PartialEdgeColoring E k) (hXZ : TreeSequenceInitialSegment X Z) : + TreeMissingColors psi X ⊆ TreeMissingColors psi Z := by as_aux_lemma => + intro c hc + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXZ hv, hm⟩ + have vertexMem (U : TreeSequence G e0) (i : Fin (U.length + 1)) : + U.vertex i ∈ TreeSequenceVertexSet U := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, rfl⟩ + have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) + (j : Fin (T.length + 1)) (hj : c ∈ MissingColors G psi (T.vertex j)) : + HierarchyFirstMissingPosition psi T c ≤ j := by as_aux_lemma => + clear * - G T psi c j hj + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ + have hn : candidates.Nonempty := ⟨j, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates j hm + have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + as_aux_lemma => + clear * - G T psi c hlt + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + have eligible + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (i : ℕ) (hi : 1 ≤ i ∧ i ≤ ell - 1) + (hc : c ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex + (Fin.last (HierarchyFullTailPrefix C i).length))) + (hterm : c ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) : + I.Nonempty := by as_aux_lemma => + refine ⟨i, ?_⟩ + change i ∈ (Finset.Icc 1 (HierarchyFullTailLength C - 1)).filter _ + exact Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr hi, P, c, hc, hterm⟩ + have emptyReduction := P2905_T2_EmptyCommonMissingLocation + G k e0 input T phi ett base C ctx hpathLower hpathUpper hempty + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + obtain ⟨alpha, haPen, haTerminal⟩ := + HierarchyCounterexampleTerminalCommonMissing G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have haA : alpha ∈ TreeMissingColors phi A := emptyReduction P0 alpha haPen haTerminal + have haY : alpha ∈ TreeMissingColors phi Y := missingMono phi hAY haA + let q := Fin.last C.hierarchy.dividerCount + let D := HierarchyStoredColorsAt C.hierarchy q + let Gamma := D.biUnion (C.good.gamma q) + let Extra := ((TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion + fun v => MissingColors G phi v) + by_cases hfree : alpha ∉ Gamma ∪ Extra + · exact ⟨P0, alpha, haTerminal, haY, Or.inl hfree⟩ + by_cases hgamma : alpha ∈ Gamma + · exact @helper_branch_326 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hpathLower hpathUpper hvertexMissing common seriesProper + seriesOne hAT htail hell prefixLen prefixT hBLen hYLen hAY missingMono vertexMem firstLe + firstMem eligible emptyReduction alpha haTerminal haA haY hgamma + · have hextra : alpha ∈ Extra := by + have hmem : alpha ∈ Gamma ∪ Extra := by simpa only [not_not] using hfree + exact (Finset.mem_union.mp hmem).resolve_left hgamma + obtain ⟨P, beta, hterm, hbA, hbad⟩ := P2905_T2_BaseExtraReplacement + G k e0 input T phi ett base C ctx hpathLower hpathUpper + alpha haTerminal haA hextra hgamma + exact ⟨P, beta, hterm, missingMono P.coloring hAY hbA, Or.inl hbad⟩ + +private noncomputable abbrev helperSelfCorr880.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j)) → + (∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (ett.series.data.coloring j) e0) → + CorrespondingExtendedTashkinovTree G k e0 ett phi T := by + classical + intro V E _ _ _ G k e0 input T phi ett seriesProper seriesOne + exact { + replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := seriesProper + replacementOneUncolored := seriesOne + replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } + +private noncomputable abbrev helperP0917.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j)) → + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (ett.series.data.coloring j) e0) → + let _ : + CorrespondingExtendedTashkinovTree G k e0 ett phi T := + helperSelfCorr880 G k e0 input T phi ett seriesProper + seriesOne; + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx seriesProper seriesOne selfCorr + exact { + coloring := phi + corresponding := selfCorr + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + minimumContext := ctx } + +theorem HierarchySituationThreeClaimJMinusOneEmpty {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hpathLower : 2 ≤ HierarchyPathNumber C.hierarchy) + (hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) + (hempty : ¬ (HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx).Nonempty) : + ∃ P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + ∃ alpha : Fin k, + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let B := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ + alpha ∈ TreeMissingColors P.coloring B ∧ + (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta : Fin k, + eta ∈ D ∧ + alpha ∈ P.counterexample.good.gamma q eta ∧ + (HierarchyFirstMissingPosition P.coloring T eta).val ≤ B.length) := by + classical + have common {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by as_aux_lemma => + clear * - hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + have seriesProper : ∀ j : Fin (ett.rounds + 1), + IsProperEdgeColoring G (ett.series.data.coloring j) := by as_aux_lemma => + intro j + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.1 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedProper + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => exact currentProper + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact previousProper + have seriesOne : ∀ j : Fin (ett.rounds + 1), + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by as_aux_lemma => + intro j + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.2 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedOneUncolored + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => exact currentOneUncolored + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact previousOneUncolored + let selfCorr := @helperSelfCorr880 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@seriesProper) (@seriesOne) + let P0 := @helperP0917 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@seriesProper) (@seriesOne) + let j := HierarchyPathNumber C.hierarchy + let ell := HierarchyFullTailLength C + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + let B := HierarchyFullTailPrefix C (ell - 1) + let Y := HierarchyFullTailPrefix C (j - 2) + let I := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + have hAT : TreeSequenceInitialSegment A T := by + have starNext (i : Fin (C.hierarchy.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy i) + (C.hierarchy.stage i.succ) := + Fin.cases C.hierarchy.coreInsideFirst (fun i => C.hierarchy.nested i.succ) i + simpa only [Fin.succ_last, C.hierarchy.terminalStage] using + starNext (Fin.last C.hierarchy.dividerCount) + exact @helper_continuation_671 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx hpathLower hpathUpper hvertexMissing hempty common + seriesProper seriesOne hAT +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean new file mode 100644 index 0000000000..7ca5d7ff93 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean @@ -0,0 +1,4782 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.NineN +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChangeCaseThree +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Hierarchy Situation Three Claim JMinus One Nonempty + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable abbrev helperCS778.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (R : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (a b : Fin k) → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length))); + (corr : + CorrespondingExtendedTashkinovTree G k e0 + R.corresponding.replacementETT sigma T) → + MaximumProperty corr.replacementETT → + (bs : HierarchyBase corr.replacementETT sigma) → + (K : TashkinovHierarchy corr.replacementETT bs) → + GoodHierarchy K → + ¬ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet T) → + HierarchyCounterexample bs := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx R a b sigma corr hmaximum bs K goodK + hnotElementary + exact { + positive := by rw [corr.rungAgreement]; exact R.counterexample.positive + hierarchy := K + good := goodK + maximum := hmaximum + notElementary := hnotElementary } + +private noncomputable abbrev helperCS1504.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (alpha beta : Fin k) → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G P.coloring beta alpha + (Sum.inl (T.vertex (Fin.last T.length))); + (corr : + CorrespondingExtendedTashkinovTree G k e0 + P.corresponding.replacementETT sigma T) → + MaximumProperty corr.replacementETT → + (bs : HierarchyBase corr.replacementETT sigma) → + (K : TashkinovHierarchy corr.replacementETT bs) → + GoodHierarchy K → + ¬ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet T) → + HierarchyCounterexample bs := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma corr hmaximum bs K goodK + hnot + exact { + positive := by rw [corr.rungAgreement]; exact P.counterexample.positive + hierarchy := K + good := goodK + maximum := hmaximum + notElementary := hnot } + +private abbrev helperBranch1365Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); TreeSequenceInitialSegment B T → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0), TreeSequenceInitialSegment A X → A.length < X.length → TreeSequenceInitialSegment X B + → + ∀ (a b : Fin k), a ≠ b → a ∈ HierarchyStageMissingColors R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → + ∀ (jb : Fin (B.length + (1 : ℕ))), (↑jb : ℕ) ≤ X.length → b ∈ MissingColors G R.coloring + (B.vertex jb) → a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) ∨ b ∈ + MissingColors G R.coloring (T.vertex (Fin.last T.length)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → ( + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∨ b ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ X.length) → + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)))) → ( + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), + eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition + R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a) → + let Extra : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + R.coloring v; + let Gamma : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount)); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Gamma R ⊆ + TreeMissingColors R.coloring A) → + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); Y.length = A.length + (j + - (2 : ℕ)) → + ∀ (hYB : TreeSequenceInitialSegment Y B), + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last + (HierarchyFullTailPrefix C i).length)), alpha ∈ MissingColors G P.coloring (T.vertex + (Fin.last T.length)) → + ∀ (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by + omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); alpha ∈ MissingColors G P.coloring (B.vertex ja) → + alpha ∉ TreeMissingColors P.coloring A → alpha ∉ Gamma P ∪ Extra P → i = j - (1 : ℕ) → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); X.length = A.length + (j + - (1 : ℕ)) → TreeSequenceInitialSegment X B → TreeSequenceInitialSegment A X → A.length < + X.length → X.length = Y.length + (1 : ℕ) → (↑ja : ℕ) = X.length → + let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (beta : Fin k) (yb : Fin (Y.length + (1 : ℕ))), + let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; beta ∈ + MissingColors G P.coloring (B.vertex jb) → (↑jb : ℕ) ≤ Y.length → + (↑(HierarchyFirstMissingPosition P.coloring T alpha) : ℕ) = X.length → alpha ≠ beta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + beta) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) = some + alpha → TreeIncidentEdge (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ alpha ∈ + TashkinovStoredColors P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → + beta ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → beta ∈ + TreeMissingColors R.coloring Y ∧ (beta ∉ Gamma R ∪ Extra R ∨ + ∃ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length)) → alpha ∈ D → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; alpha ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ alpha ∈ TreeMissingColors + P.coloring B ∧ (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∧ (↑(HierarchyFirstMissingPosition + P.coloring T eta) : ℕ) ≤ B.length) + +private abbrev helperBranch1435Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); TreeSequenceInitialSegment B T → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0), TreeSequenceInitialSegment A X → A.length < X.length → TreeSequenceInitialSegment X B + → + ∀ (a b : Fin k), a ≠ b → a ∈ HierarchyStageMissingColors R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → + ∀ (jb : Fin (B.length + (1 : ℕ))), (↑jb : ℕ) ≤ X.length → b ∈ MissingColors G R.coloring + (B.vertex jb) → a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) ∨ b ∈ + MissingColors G R.coloring (T.vertex (Fin.last T.length)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → ( + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∨ b ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ X.length) → + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)))) → + let Extra : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + R.coloring v; + let Gamma : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount)); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Gamma R ⊆ + TreeMissingColors R.coloring A) → + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); Y.length = A.length + (j + - (2 : ℕ)) → TreeSequenceInitialSegment Y B → + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), + ∀ (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); alpha ∈ MissingColors G P.coloring (B.vertex ja) → + alpha ∉ TreeMissingColors P.coloring A → i = j - (1 : ℕ) → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); X.length = A.length + (j + - (1 : ℕ)) → TreeSequenceInitialSegment X B → TreeSequenceInitialSegment A X → A.length < + X.length → X.length = Y.length + (1 : ℕ) → (↑ja : ℕ) = X.length → + ∀ (beta : Fin k) (_ : Fin (Y.length + (1 : ℕ))), alpha ≠ beta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + beta) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) = some + alpha → TreeIncidentEdge (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ alpha ∈ + TashkinovStoredColors P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → + beta ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → beta ∈ + TreeMissingColors R.coloring Y ∧ (beta ∉ Gamma R ∪ Extra R ∨ + ∃ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length)) → beta ∈ HierarchyStageMissingColors P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; alpha ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ alpha ∈ TreeMissingColors + P.coloring B ∧ (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∧ (↑(HierarchyFirstMissingPosition + P.coloring T eta) : ℕ) ≤ B.length) + +private abbrev helperContinuation3823Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hvertexMissing : + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (hj : HierarchyPathNumber C.hierarchy = j) (hpathLower : (2 : ℕ) ≤ j) (hpathUpper : j < + HierarchyFullTailLength C) (finiteChoice : + ∀ (M F D U W N : Finset (Fin k)) (g : Fin k → Finset (Fin k)) (hstep : W ⊆ U ∪ N) (hncard : + N.card ≤ (1 : ℕ)) (hgM : + ∀ eta ∈ D, g eta ⊆ M) (hgcard : + ∀ eta ∈ D, (g eta).card = (2 : ℕ)) (hgdis : + ∀ eta ∈ D, + ∀ theta ∈ D, eta ≠ theta → Disjoint (g eta) (g theta)) (hgd : Disjoint (D.biUnion g) D) (hnine + : (((M \ F) \ U) \ (D.biUnion g ∪ D)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ M ∧ Disjoint (g (eta h) ∪ ({eta h} : Finset (Fin k))) + U), + ∃ beta ∈ M, beta ∉ D ∧ beta ∉ W ∧ (beta ∉ D.biUnion g ∪ F ∨ + ∃ eta ∈ D, beta ∈ g eta ∧ eta ∈ M)) (componentData : + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hproper : IsProperEdgeColoring + G psi) (B : Finset V) (helem : ColoredVertexSetElementary G psi B) (u v w : V) (hu : u ∈ + B) (hv : v ∈ B) (hwu : w ≠ u) (hwv : w ≠ v) (hau : a ∈ MissingColors G psi u) (hbv : b ∈ + MissingColors G psi v) (hw : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) (hsame + : TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v)), + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) (trans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) (hYZ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) (common : + ∀ {X Y Z : TreeSequence G e0} (hXZ : TreeSequenceInitialSegment X Z) (hYZ : + TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (starEq : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) (hAT : TreeSequenceInitialSegment A T) + (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by omega + ) ( + by omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T) (hAB : TreeSequenceInitialSegment A B) (fullEq : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), + HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j) (fullB : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) (elementary : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) (vertexMem : + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) (firstLe : + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))) (hj : c ∈ + MissingColors G psi (T.vertex j)), HierarchyFirstMissingPosition psi T c ≤ j) (firstAt : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (hc : c ∈ MissingColors G R.coloring (B.vertex j)), + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) (firstFixed : + ∀ (psi tau : PartialEdgeColoring E k) (hmissing : + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) (c : Fin k), + HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c) + (stageSwitch : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0) (hAX : TreeSequenceInitialSegment A X) (hAXlt : A.length < X.length) (hXB : + TreeSequenceInitialSegment X B) (a b : Fin k) (hne : a ≠ b) (haStage : a ∈ + HierarchyStageMissingColors R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)) (jb : Fin (B.length + (1 : ℕ))) (hjbX : (↑jb : + ℕ) ≤ X.length) (hb : b ∈ MissingColors G R.coloring (B.vertex jb)) (hw : a ∈ MissingColors + G R.coloring (T.vertex (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length))) (haUnused : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) (hbException : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) (gammaCut : + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∨ b ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ X.length), + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)))), + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; alpha ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ alpha ∈ TreeMissingColors + P.coloring B ∧ (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∧ (↑(HierarchyFirstMissingPosition + P.coloring T eta) : ℕ) ≤ B.length) + +private abbrev helperContinuation3982Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (hpathLower : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C) (finiteChoice : + ∀ (M F D U W N : Finset (Fin k)) (g : Fin k → Finset (Fin k)) (hstep : W ⊆ U ∪ N) (hncard : + N.card ≤ (1 : ℕ)) (hgM : + ∀ eta ∈ D, g eta ⊆ M) (hgcard : + ∀ eta ∈ D, (g eta).card = (2 : ℕ)) (hgdis : + ∀ eta ∈ D, + ∀ theta ∈ D, eta ≠ theta → Disjoint (g eta) (g theta)) (hgd : Disjoint (D.biUnion g) D) (hnine + : (((M \ F) \ U) \ (D.biUnion g ∪ D)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ M ∧ Disjoint (g (eta h) ∪ ({eta h} : Finset (Fin k))) + U), + ∃ beta ∈ M, beta ∉ D ∧ beta ∉ W ∧ (beta ∉ D.biUnion g ∪ F ∨ + ∃ eta ∈ D, beta ∈ g eta ∧ eta ∈ M)) (componentData : + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hproper : IsProperEdgeColoring + G psi) (B : Finset V) (helem : ColoredVertexSetElementary G psi B) (u v w : V) (hu : u ∈ + B) (hv : v ∈ B) (hwu : w ≠ u) (hwv : w ≠ v) (hau : a ∈ MissingColors G psi u) (hbv : b ∈ + MissingColors G psi v) (hw : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) (hsame + : TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v)), + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) (trans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) (hYZ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (starEq : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) (hAT : TreeSequenceInitialSegment A T) + (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by omega + ) ( + by omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T) (hAB : TreeSequenceInitialSegment A B) (fullB : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) (elementary : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) (vertexMem : + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) (firstLe : + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))) (hj : c ∈ + MissingColors G psi (T.vertex j)), HierarchyFirstMissingPosition psi T c ≤ j) (firstAt : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (hc : c ∈ MissingColors G R.coloring (B.vertex j)), + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) (firstFixed : + ∀ (psi tau : PartialEdgeColoring E k) (hmissing : + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) (c : Fin k), + HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c) + (stageSwitch : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0) (hAX : TreeSequenceInitialSegment A X) (hAXlt : A.length < X.length) (hXB : + TreeSequenceInitialSegment X B) (a b : Fin k) (hne : a ≠ b) (haStage : a ∈ + HierarchyStageMissingColors R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)) (jb : Fin (B.length + (1 : ℕ))) (hjbX : (↑jb : + ℕ) ≤ X.length) (hb : b ∈ MissingColors G R.coloring (B.vertex jb)) (hw : a ∈ MissingColors + G R.coloring (T.vertex (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length))) (haUnused : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) (hbException : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) (gammaCut : + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∨ b ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ X.length), + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)))) (gammaTransport : + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) + (gammaUnused : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)) (ha : a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta) (t : Fin T.length) (hlo : A.length ≤ (↑t : + ℕ)) (hhi : (↑t : ℕ) < (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ)), R.coloring + (T.edge t) ≠ some a) (notRaw : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (hcA : + c ∉ TreeMissingColors R.coloring A) (hcD : c ∉ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)), c ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) (tailException : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (hj : (1 : + ℕ) ≤ j) (hjlt : j < T.length - A.length) (c : Fin k) (hc : c ∈ MissingColors G R.coloring + ((HierarchyFullTailPrefix C j).vertex (Fin.last (HierarchyFullTailPrefix C j).length))) (t + : Fin T.length) (hlo : A.length ≤ (↑t : ℕ)) (hhi : (↑t : ℕ) < A.length + j) (hcol : + R.coloring (T.edge t) = some c), TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)), + let Extra : (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) → Finset + (Fin k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + R.coloring v; + let Gamma : (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) → Finset + (Fin k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount)); + ∀ (gammaSub : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Gamma R ⊆ + TreeMissingColors R.coloring A) (extraFixed : + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (hm : + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v), + Extra S = Extra R) (gammaFixed : + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Gamma R = Gamma + S), + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (hYlen : Y.length = A.length + (j - (2 : ℕ))) (hYT : TreeSequenceInitialSegment Y T) (hYB : + TreeSequenceInitialSegment Y B) (hAY : TreeSequenceInitialSegment A Y), + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiLower : (1 : ℕ) ≤ i) (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input + T phi ett base C ctx) (alpha : Fin k) (haPrefix : alpha ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C i).length))) + (haTerminal : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) (hSlen : + (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); + ∀ (ha : alpha ∈ MissingColors G P.coloring (B.vertex ja)) (haOutside : alpha ∉ + TreeMissingColors P.coloring A) (haGood : alpha ∉ Gamma P ∪ Extra P) (hiEq : i = j - (1 : + ℕ)), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (hXlen : X.length = A.length + (j - (1 : ℕ))) (hXB : TreeSequenceInitialSegment X B) (hAX : + TreeSequenceInitialSegment A X) (hAXlt : A.length < X.length) (hYXlen : X.length = + Y.length + (1 : ℕ)) (hjaX : (↑ja : ℕ) = X.length), + let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + let used : (r : ℕ) → Finset (Fin k) := fun (r : ℕ) ↦ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + r ∧ P.coloring (T.edge t) = + some c} : Finset (Fin k)); + let tnew : Fin T.length := (⟨Y.length, + have this : X.length ≤ B.length := hXB.1; + have this : B.length ≤ T.length := hBT.1; Decidable.byContradiction fun (a : ¬Y.length < + T.length) ↦ + by omega + ⟩ : Fin T.length); + let fresh : Finset (Fin k) := ({c : Fin k | P.coloring (T.edge tnew) = some c} : Finset (Fin + k)); + ∀ (freshCard : fresh.card ≤ (1 : ℕ)) (usedStep : used (j - (1 : ℕ)) ⊆ used (j - (2 : ℕ)) ∪ + fresh) (nineY : (2 : ℕ) * P.corresponding.replacementETT.rounds + (11 : ℕ) ≤ + ((TreeMissingColors P.coloring Y \ Extra P) \ used (j - (2 : ℕ))).card ∧ + ((((TreeMissingColors P.coloring Y \ Extra P) \ used (j - (2 : ℕ))) \ (Gamma P ∪ D)).card + ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ TreeMissingColors P.coloring Y ∧ Disjoint + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) (eta h) ∪ + ({eta h} : Finset (Fin k))) (used (j - (2 : ℕ))))), + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; alpha ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ alpha ∈ TreeMissingColors + P.coloring B ∧ (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∧ (↑(HierarchyFirstMissingPosition + P.coloring T eta) : ℕ) ≤ B.length) + +private abbrev helperContinuation3797Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hvertexMissing : + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (hj : HierarchyPathNumber C.hierarchy = j) (hpathLower : (2 : ℕ) ≤ j) (hpathUpper : j < + HierarchyFullTailLength C) (finiteChoice : + ∀ (M F D U W N : Finset (Fin k)) (g : Fin k → Finset (Fin k)) (hstep : W ⊆ U ∪ N) (hncard : + N.card ≤ (1 : ℕ)) (hgM : + ∀ eta ∈ D, g eta ⊆ M) (hgcard : + ∀ eta ∈ D, (g eta).card = (2 : ℕ)) (hgdis : + ∀ eta ∈ D, + ∀ theta ∈ D, eta ≠ theta → Disjoint (g eta) (g theta)) (hgd : Disjoint (D.biUnion g) D) (hnine + : (((M \ F) \ U) \ (D.biUnion g ∪ D)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ M ∧ Disjoint (g (eta h) ∪ ({eta h} : Finset (Fin k))) + U), + ∃ beta ∈ M, beta ∉ D ∧ beta ∉ W ∧ (beta ∉ D.biUnion g ∪ F ∨ + ∃ eta ∈ D, beta ∈ g eta ∧ eta ∈ M)) (componentData : + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hproper : IsProperEdgeColoring + G psi) (B : Finset V) (helem : ColoredVertexSetElementary G psi B) (u v w : V) (hu : u ∈ + B) (hv : v ∈ B) (hwu : w ≠ u) (hwv : w ≠ v) (hau : a ∈ MissingColors G psi u) (hbv : b ∈ + MissingColors G psi v) (hw : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) (hsame + : TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v)), + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) (trans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) (hYZ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) (common : + ∀ {X Y Z : TreeSequence G e0} (hXZ : TreeSequenceInitialSegment X Z) (hYZ : + TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (starEq : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) (hAT : TreeSequenceInitialSegment A T) + (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by omega + ) ( + by omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T) (hAB : TreeSequenceInitialSegment A B) (fullEq : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), + HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j) (fullB : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) (elementary : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) (vertexMem : + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) (firstLe : + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))) (hj : c ∈ + MissingColors G psi (T.vertex j)), HierarchyFirstMissingPosition psi T c ≤ j) (firstAt : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (hc : c ∈ MissingColors G R.coloring (B.vertex j)), + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) (firstFixed : + ∀ (psi tau : PartialEdgeColoring E k) (hmissing : + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) (c : Fin k), + HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c) + (stageSwitch : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0) (hAX : TreeSequenceInitialSegment A X) (hAXlt : A.length < X.length) (hXB : + TreeSequenceInitialSegment X B) (a b : Fin k) (hne : a ≠ b) (haStage : a ∈ + HierarchyStageMissingColors R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)) (jb : Fin (B.length + (1 : ℕ))) (hjbX : (↑jb : + ℕ) ≤ X.length) (hb : b ∈ MissingColors G R.coloring (B.vertex jb)) (hw : a ∈ MissingColors + G R.coloring (T.vertex (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length))) (haUnused : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) (hbException : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) (gammaCut : + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∨ b ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ X.length), + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)))) (gammaTransport : + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) + (gammaUnused : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)) (ha : a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta) (t : Fin T.length) (hlo : A.length ≤ (↑t : + ℕ)) (hhi : (↑t : ℕ) < (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ)), R.coloring + (T.edge t) ≠ some a) (outsideA : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (hj : A.length < (↑j : ℕ)) (hc : c ∈ MissingColors G R.coloring + (B.vertex j)), c ∉ TreeMissingColors R.coloring A) (notRaw : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (hcA : + c ∉ TreeMissingColors R.coloring A) (hcD : c ∉ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)), c ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) (tailException : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (hj : (1 : + ℕ) ≤ j) (hjlt : j < T.length - A.length) (c : Fin k) (hc : c ∈ MissingColors G R.coloring + ((HierarchyFullTailPrefix C j).vertex (Fin.last (HierarchyFullTailPrefix C j).length))) (t + : Fin T.length) (hlo : A.length ≤ (↑t : ℕ)) (hhi : (↑t : ℕ) < A.length + j) (hcol : + R.coloring (T.edge t) = some c), TreeIncidentEdge + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) (coreA : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + TreeSequenceInitialSegment R.replacementBase.core A), + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; alpha ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ alpha ∈ TreeMissingColors + P.coloring B ∧ (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∧ (↑(HierarchyFirstMissingPosition + P.coloring T eta) : ℕ) ≤ B.length) + +private abbrev helperHunusedBetween1548Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T), + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); Y.length = A.length + (j + - (2 : ℕ)) → + ∀ (hYB : TreeSequenceInitialSegment Y B), + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k) (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); i = j - (1 : ℕ) → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); X.length = A.length + (j + - (1 : ℕ)) → TreeSequenceInitialSegment X B → X.length = Y.length + (1 : ℕ) → (↑ja : ℕ) = + X.length → + ∀ (beta : Fin k) (yb : Fin (Y.length + (1 : ℕ))), + let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; + (↑(HierarchyFirstMissingPosition P.coloring T alpha) : ℕ) = X.length → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + beta) → A.length < (↑jb : ℕ) → (↑(HierarchyFirstMissingPosition P.coloring T beta) : ℕ) = + (↑jb : ℕ) → Fin.castLE (Nat.succ_le_succ hBT.1) jb = HierarchyFirstMissingPosition + P.coloring T beta → Fin.castLE (Nat.succ_le_succ hBT.1) ja = HierarchyFirstMissingPosition + P.coloring T alpha → beta ∉ ({c : Fin k | + ∃ (t : Fin T.length), (↑(HierarchyFirstMissingPosition P.coloring T beta) : ℕ) ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition P.coloring T alpha) : ℕ) ∧ P.coloring (T.edge + t) = some c} : Finset (Fin k)) + +private abbrev helperContinuation4396Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (hpathLower : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C) (componentData + : + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hproper : IsProperEdgeColoring + G psi) (B : Finset V) (helem : ColoredVertexSetElementary G psi B) (u v w : V) (hu : u ∈ + B) (hv : v ∈ B) (hwu : w ≠ u) (hwv : w ≠ v) (hau : a ∈ MissingColors G psi u) (hbv : b ∈ + MissingColors G psi v) (hw : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) (hsame + : TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v)), + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) (trans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) (hYZ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (starEq : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) (hAT : TreeSequenceInitialSegment A T) + (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by omega + ) ( + by omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T) (fullB : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) (elementary : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) (vertexMem : + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U), + let Extra : (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) → Finset + (Fin k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + R.coloring v; + let Gamma : (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) → Finset + (Fin k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (hYlen : Y.length = A.length + (j - (2 : ℕ))) (hYB : TreeSequenceInitialSegment Y B), + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k) (haPrefix : alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C + i).vertex (Fin.last (HierarchyFullTailPrefix C i).length))) (haTerminal : alpha ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length))) (hSlen : + (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := hAT.1 + have := hBT.1 + have := hYB.1 + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + have := + GoldbergSeymour.TreeSequence.positive + (TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega)) + have := GoldbergSeymour.TreeSequence.positive T + dsimp only [GoldbergSeymour.HierarchyFullTailLength, + GoldbergSeymour.HierarchyFullTailPrefix, GoldbergSeymour.TreeSequencePrefix] at * + dsimp only [B, GoldbergSeymour.TreeSequencePrefix] at * + all_goals omega) + ⟩ : Fin (B.length + (1 : ℕ))); + ∀ (ha : alpha ∈ MissingColors G P.coloring (B.vertex ja)) (haOutside : alpha ∉ + TreeMissingColors P.coloring A) (haGood : alpha ∉ Gamma P ∪ Extra P) (hiEq : i = j - (1 : + ℕ)), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (hXlen : X.length = A.length + (j - (1 : ℕ))) (hXB : TreeSequenceInitialSegment X B) (hYXlen + : X.length = Y.length + (1 : ℕ)) (hjaX : (↑ja : ℕ) = X.length), + let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + let used : (r : ℕ) → Finset (Fin k) := fun (r : ℕ) ↦ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + r ∧ P.coloring (T.edge t) = + some c} : Finset (Fin k)); + ∀ (beta : Fin k) (hbY : beta ∈ TreeMissingColors P.coloring Y) (hbD : beta ∉ D) (hbUsed : beta + ∉ used (j - (1 : ℕ))) (hbChoice : beta ∉ Gamma P ∪ Extra P ∨ + ∃ eta ∈ D, beta ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring + T eta) : ℕ) ≤ Y.length) (vbeta : V) (hbeta : beta ∈ MissingColors G P.coloring vbeta) (yb + : Fin (Y.length + (1 : ℕ))), + let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; + ∀ (hb : beta ∈ MissingColors G P.coloring (B.vertex jb)) (haFirst : + (↑(HierarchyFirstMissingPosition P.coloring T alpha) : ℕ) = X.length) (habNe : alpha ≠ + beta) (hbUnused : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + beta) (haException : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) = some + alpha → TreeIncidentEdge (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ alpha ∈ + TashkinovStoredColors P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds)) (cutBeta : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (hm : + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length) (finish : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (hm : + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) + (hterm : beta ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length))), beta ∈ + TreeMissingColors R.coloring Y ∧ (beta ∉ Gamma R ∪ Extra R ∨ + ∃ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length)) (hAlphaStored : alpha ∉ D) (hbStage : beta ∉ + HierarchyStageMissingColors P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)) (hbOutsideChoice : beta ∉ Gamma P ∪ Extra P) + (hbOutside : beta ∉ TreeMissingColors P.coloring A) (hjbA : A.length < (↑jb : ℕ)) (haRaw : + alpha ∉ TashkinovStoredColors P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds)) (hbRaw : beta ∉ TashkinovStoredColors + P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds)) (ibEq : (↑(HierarchyFirstMissingPosition + P.coloring T beta) : ℕ) = (↑jb : ℕ)) (iaEq : (↑(HierarchyFirstMissingPosition P.coloring T + alpha) : ℕ) = (↑ja : ℕ)) (jbEq : Fin.castLE (Nat.succ_le_succ hBT.1) jb = + HierarchyFirstMissingPosition P.coloring T beta) (jaEq : Fin.castLE (Nat.succ_le_succ + hBT.1) ja = HierarchyFirstMissingPosition P.coloring T alpha) (hordered : TreeVertexOrder + T (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)) (T.vertex + (HierarchyFirstMissingPosition P.coloring T alpha))) (hunused : beta ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition + P.coloring T alpha) : ℕ) ∧ P.coloring (T.edge t) = some c} : Finset (Fin k))), + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + have B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + have D : Finset (Fin k) := HierarchyStoredColorsAt H q; + have Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + have baseExtraMissing : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; alpha ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ alpha ∈ TreeMissingColors + P.coloring B ∧ (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∧ (↑(HierarchyFirstMissingPosition + P.coloring T eta) : ℕ) ≤ B.length) + +private abbrev helperCaseContinuation5383Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (j : ℕ) (trans : + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) (common : + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (starEq : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by omega + ) ( + by omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T) (hAB : TreeSequenceInitialSegment A B) (fullB : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) (vertexMem : + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) (firstFixed : + ∀ (psi tau : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) → + ∀ (c : Fin k), HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c) + (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence + G e0) (hAX : TreeSequenceInitialSegment A X) (hAXlt : A.length < X.length) (hXB : + TreeSequenceInitialSegment X B) (a b : Fin k) (hne : a ≠ b) (jb : Fin (B.length + (1 : + ℕ))) (hjbX : (↑jb : ℕ) ≤ X.length) (hb : b ∈ MissingColors G R.coloring (B.vertex jb)) (hw + : a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) ∨ b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length))) (haUnused : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) (hbException : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) (gammaCut : + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∨ b ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ X.length), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data n; + ∀ (hTnA : TreeSequenceInitialSegment Tn A) (stageCase : (0 : ℕ) < H.dividerCount ∧ a ∈ + TreeMissingColors R.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors + R.coloring Tn) (hbB : b ∈ TreeMissingColors R.coloring B) (haB : a ∈ TreeMissingColors + R.coloring B) (iaLe : (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length) + (ibEq : (↑(HierarchyFirstMissingPosition R.coloring T b) : ℕ) = (↑jb : ℕ)), + let ja : Fin (B.length + (1 : ℕ)) := (⟨(↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ), + have this : A.length ≤ B.length := hAB.1; Decidable.byContradiction fun (a_1 : + ¬(↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) < B.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (B.length + (1 : ℕ))); + ∀ (jaEq : Fin.castLE (Nat.succ_le_succ hBT.1) ja = HierarchyFirstMissingPosition R.coloring T + a) (jbEq : Fin.castLE (Nat.succ_le_succ hBT.1) jb = HierarchyFirstMissingPosition + R.coloring T b) (haFirstB : a ∈ MissingColors G R.coloring (B.vertex ja)) (hprefixR : + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet (HierarchyFullTailPrefix + R.counterexample (HierarchyFullTailLength R.counterexample - (1 : ℕ))))) (hmissingR : a ∈ + TreeMissingColors R.coloring (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ b ∈ TreeMissingColors R.coloring + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) (change : + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors + R.coloring Tn ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + ({ a } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) (hdis + : Disjoint (TwoColorComponent G R.coloring a b (Sum.inl (T.vertex (Fin.last T.length)))) + (TwoColorComponent G R.coloring a b (Sum.inl (B.vertex ja)))) (hpath : + TwoColorPathComponent G R.coloring a b (Sum.inl (T.vertex (Fin.last T.length)))) (hmissing + : + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G R.coloring x), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (hsone : IsOneEdgeUncolored sigma e0), + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = + R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length))) + +private abbrev helperContinuation3692Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) (_ : (HierarchyEligibleCommonMissingIndices G k e0 + input T phi ett base C ctx).Nonempty) (j : ℕ) (_ : HierarchyPathNumber C.hierarchy = j) (_ + : (2 : ℕ) ≤ j) (_ : j < HierarchyFullTailLength C) (_ : + ∀ (M F D U W N : Finset (Fin k)) (g : Fin k → Finset (Fin k)) (_ : W ⊆ U ∪ N) (_ : N.card ≤ (1 + : ℕ)) (_ : + ∀ eta ∈ D, g eta ⊆ M) (_ : + ∀ eta ∈ D, (g eta).card = (2 : ℕ)) (_ : + ∀ eta ∈ D, + ∀ theta ∈ D, eta ≠ theta → Disjoint (g eta) (g theta)) (_ : Disjoint (D.biUnion g) D) (_ : + (((M \ F) \ U) \ (D.biUnion g ∪ D)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ M ∧ Disjoint (g (eta h) ∪ ({eta h} : Finset (Fin k))) + U), + ∃ beta ∈ M, beta ∉ D ∧ beta ∉ W ∧ (beta ∉ D.biUnion g ∪ F ∨ + ∃ eta ∈ D, beta ∈ g eta ∧ eta ∈ M)) (_ : + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (_ : a ≠ b) (_ : IsProperEdgeColoring G psi) + (B : Finset V) (_ : ColoredVertexSetElementary G psi B) (u v w : V) (_ : u ∈ B) (_ : v ∈ + B) (_ : w ≠ u) (_ : w ≠ v) (_ : a ∈ MissingColors G psi u) (_ : b ∈ MissingColors G psi v) + (_ : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) (_ : TwoColorComponent G psi a + b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v)), Disjoint (TwoColorComponent G + psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl u)) ∧ TwoColorPathComponent G + psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) (_ : + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) (_ : + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : + TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) (_ : TreeSequenceInitialSegment A T) (_ : (3 + : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by omega + ) ( + by omega + ); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment A B) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), + HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) (_ : + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) (_ : + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))) (_ : c ∈ + MissingColors G psi (T.vertex j)), HierarchyFirstMissingPosition psi T c ≤ j) (_ : + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (_ : (↑(HierarchyFirstMissingPosition psi T c) : + ℕ) < T.length), c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T + c))) (_ : + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) (_ : + ∀ (psi tau : PartialEdgeColoring E k) (_ : + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) (c : Fin k), + HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c), + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; alpha ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ alpha ∈ TreeMissingColors + P.coloring B ∧ (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∧ (↑(HierarchyFirstMissingPosition + P.coloring T eta) : ℕ) ≤ B.length) + +private theorem helper_branch_237 : + open scoped Classical in + ∀ (k : ℕ) (M F D U W N : Finset (Fin k)) (g : Fin k → Finset (Fin k)), W ⊆ U ∪ N → N.card ≤ (1 + : ℕ) → + let free : Finset (Fin k) := ((M \ F) \ U) \ (D.biUnion g ∪ D); (5 : ℕ) ≤ free.card → + ∃ beta ∈ M, beta ∉ D ∧ beta ∉ W ∧ (beta ∉ D.biUnion g ∪ F ∨ + ∃ eta ∈ D, beta ∈ g eta ∧ eta ∈ M) := by + classical + intro k M F D U W N g hstep hncard free hlarge + have hnon : (free \ N).Nonempty := by + apply Finset.card_pos.mp + have hc := Finset.card_le_card_sdiff_add_card (s := free) (t := N) + omega + obtain ⟨beta, hbeta⟩ := hnon + obtain ⟨hbFree, hbFresh⟩ := Finset.mem_sdiff.mp hbeta + obtain ⟨hbAvail, hbGD⟩ := Finset.mem_sdiff.mp hbFree + obtain ⟨hbME, hbUsed⟩ := Finset.mem_sdiff.mp hbAvail + obtain ⟨hbMissing, hbExtra⟩ := Finset.mem_sdiff.mp hbME + refine ⟨beta, hbMissing, ?_, ?_, Or.inl ?_⟩ + · exact fun hc => hbGD (Finset.mem_union_right _ hc) + · intro hc + rcases Finset.mem_union.mp (hstep hc) with hc | hc + · exact hbUsed hc + · exact hbFresh hc + · intro hc + rcases Finset.mem_union.mp hc with hc | hc + · exact hbGD (Finset.mem_union_left _ hc) + · exact hbExtra hc + +private theorem helper_branch_256 : + open scoped Classical in + ∀ (k : ℕ) (M F D U W N : Finset (Fin k)) (g : Fin k → Finset (Fin k)), W ⊆ U ∪ N → N.card ≤ (1 + : ℕ) → ( + ∀ eta ∈ D, g eta ⊆ M) → ( + ∀ eta ∈ D, (g eta).card = (2 : ℕ)) → ( + ∀ eta ∈ D, + ∀ theta ∈ D, eta ≠ theta → Disjoint (g eta) (g theta)) → Disjoint (D.biUnion g) D → ((((M \ F) + \ U) \ (D.biUnion g ∪ D)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ M ∧ Disjoint (g (eta h) ∪ ({eta h} : Finset (Fin k))) + U) → + let free : Finset (Fin k) := ((M \ F) \ U) \ (D.biUnion g ∪ D); ¬(5 : ℕ) ≤ free.card → + ∃ beta ∈ M, beta ∉ D ∧ beta ∉ W ∧ (beta ∉ D.biUnion g ∪ F ∨ + ∃ eta ∈ D, beta ∈ g eta ∧ eta ∈ M) := by + classical + intro k M F D U W N g hstep hncard hgM hgcard hgdis hgd hnine free hlarge + obtain ⟨eta, hinj, heta⟩ := hnine (by change free.card ≤ 4; omega) + let pair := fun h : Fin 7 => g (eta h) ∪ {eta h} + have hdis : Disjoint (pair 0) (pair 1) := by + apply Finset.disjoint_left.mpr + intro c hc hd + have hneq : eta 0 ≠ eta 1 := fun hh => (by decide : (0 : Fin 7) ≠ 1) (hinj hh) + simp only [pair, Finset.mem_union, Finset.mem_singleton] at hc hd + rcases hc with hc | hc <;> rcases hd with hd | hd + · exact Finset.disjoint_left.mp (hgdis _ (heta 0).1 _ (heta 1).1 hneq) hc hd + · exact Finset.disjoint_left.mp hgd + (Finset.mem_biUnion.mpr ⟨eta 0, (heta 0).1, hc⟩) (hd.symm ▸ (heta 1).1) + · exact Finset.disjoint_left.mp hgd + (Finset.mem_biUnion.mpr ⟨eta 1, (heta 1).1, hd⟩) (hc.symm ▸ (heta 0).1) + · exact hneq (hc.symm.trans hd) + have hm : ∃ m : Fin 7, Disjoint (pair m) N := by + by_cases h0 : Disjoint (pair 0) N + · exact ⟨0, h0⟩ + · obtain ⟨c, hc, hcN⟩ := Finset.not_disjoint_iff.mp h0 + refine ⟨1, Finset.disjoint_left.mpr ?_⟩ + intro d hd hdN + have he : c = d := Finset.card_le_one.mp hncard c hcN d hdN + exact Finset.disjoint_left.mp hdis hc (he.symm ▸ hd) + obtain ⟨m, hm⟩ := hm + have hpairUsed : Disjoint (pair m) W := by + apply Finset.disjoint_left.mpr + intro c hc hu + rcases Finset.mem_union.mp (hstep hu) with hu | hu + · exact Finset.disjoint_left.mp (heta m).2.2 hc hu + · exact Finset.disjoint_left.mp hm hc hu + have hnon : (g (eta m)).Nonempty := by + apply Finset.card_pos.mp + rw [hgcard _ (heta m).1] + decide + obtain ⟨beta, hbGamma⟩ := hnon + refine ⟨beta, hgM _ (heta m).1 hbGamma, ?_, ?_, + Or.inr ⟨eta m, (heta m).1, hbGamma, (heta m).2.1⟩⟩ + · intro hc + exact Finset.disjoint_left.mp hgd (Finset.mem_biUnion.mpr ⟨eta m, (heta m).1, hbGamma⟩) hc + · intro hc + exact Finset.disjoint_left.mp hpairUsed (Finset.mem_union_left _ hbGamma) hc + +private theorem helper_hAT_338.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C j A + have starNext (j : Fin (C.hierarchy.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy j) + (C.hierarchy.stage j.succ) := + Fin.cases C.hierarchy.coreInsideFirst (fun i => C.hierarchy.nested i.succ) j + simpa only [Fin.succ_last, C.hierarchy.terminalStage] using + starNext (Fin.last C.hierarchy.dividerCount) + +private theorem helper_fullB_360.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → (3 : ℕ) ≤ T.length - A.length → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j A starEq htail hlen B R + have hn : min ((HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + + (HierarchyFullTailLength R.counterexample - 1)) T.length = T.length - 1 := by + unfold HierarchyFullTailLength + dsimp only + rw [starEq R] + omega + simp only [HierarchyFullTailPrefix, hn] + rfl + +private theorem helper_elementary_372.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) + (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = + B) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j hlen B fullB R + have h : ColoredVertexSetElementary G R.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 + R.corresponding.replacementInput T R.coloring R.corresponding.replacementETT + R.replacementBase R.counterexample R.minimumContext.proper + R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + R.minimumContext.largeMissingSet + intro u hu v hv hne + exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne + +private theorem helper_branch_410.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → + let candidates : Finset (Fin (T.length + (1 : ℕ))) := + ({j : Fin (T.length + (1 : ℕ)) | c ∈ MissingColors G psi (T.vertex j)} : + Finset (Fin (T.length + (1 : ℕ)))); + ¬candidates.Nonempty → + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + classical + intro V E _ _ G k e0 T psi c hlt candidates hn + let _ := Fintype.ofFinite V + have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + +private theorem helper_branch_454.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0), ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j) → ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k), (↑(HierarchyFirstMissingPosition psi T c) : ℕ) + < T.length → c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c))) → + ∀ (psi tau : PartialEdgeColoring E k) (c : Fin k), ( + ∀ (j : Fin (T.length + (1 : ℕ))), (↑j : ℕ) < T.length → MissingColors G tau (T.vertex j) = + MissingColors G psi (T.vertex j)) → (↑(HierarchyFirstMissingPosition tau T c) : ℕ) ≤ + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) := by + classical + intro V E _ _ G k e0 T firstLe firstMem psi tau c early + let _ := Fintype.ofFinite V + by_contra hn + have hlt : (HierarchyFirstMissingPosition psi T c).val < T.length := by + have := (HierarchyFirstMissingPosition tau T c).isLt + omega + have hm := firstMem psi c hlt + rw [← early _ hlt] at hm + have := firstLe tau c _ hm + omega + +private theorem helper_branch_462.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0), ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j) → ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k), (↑(HierarchyFirstMissingPosition psi T c) : ℕ) + < T.length → c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c))) → + ∀ (psi tau : PartialEdgeColoring E k) (c : Fin k), ( + ∀ (j : Fin (T.length + (1 : ℕ))), (↑j : ℕ) < T.length → MissingColors G tau (T.vertex j) = + MissingColors G psi (T.vertex j)) → (↑(HierarchyFirstMissingPosition psi T c) : ℕ) ≤ + (↑(HierarchyFirstMissingPosition tau T c) : ℕ) := by + classical + intro V E _ _ G k e0 T firstLe firstMem psi tau c early + let _ := Fintype.ofFinite V + by_contra hn + have hlt : (HierarchyFirstMissingPosition tau T c).val < T.length := by + have := (HierarchyFirstMissingPosition psi T c).isLt + omega + have hm := firstMem tau c hlt + rw [early _ hlt] at hm + have := firstLe psi c _ hm + omega + +private theorem helper_chain_511.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : TreeSequence G + e0) (_ : Fin (B.length + (1 : ℕ))), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ + j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans hlen B R X jb H j + induction j with + | zero => + intro hj i hi + have he : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have he : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) (H.nested ⟨j, by omega⟩) + +private theorem helper_lastPositive_528.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (hlen : (4 : + ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : TreeSequence G + e0) (_ : Fin (B.length + (1 : ℕ))), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; H.dividerCount ≠ (0 : ℕ) → + HierarchyStarredStage H q = H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j hlen B R X jb H q hq + unfold HierarchyStarredStage + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · exact (hq (by simpa [q] using congrArg Fin.val hz)).elim + · rw [hi] + simp only [Fin.cases_succ] + congr 1 + exact Fin.ext (by simpa [q] using (congrArg Fin.val hi).symm) + +private theorem helper_hTnCore_537.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + TreeSequenceInitialSegment Tn R.replacementBase.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx R n Tn + by_cases hpe : R.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.PE + · exact (R.replacementBase.parallel hpe).2.2.some.leftSegment + · rw [R.replacementBase.nonparallel hpe] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + +private theorem helper_coreA_543.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : TreeSequence G + e0) (_ : Fin (B.length + (1 : ℕ))), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; ( + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ + j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ))))) → (H.dividerCount ≠ (0 : ℕ) → HierarchyStarredStage H q = H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → TreeSequenceInitialSegment R.replacementBase.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans A starEq hlen B R X jb H q chain + lastPositive + rw [← starEq R] + by_cases hq : H.dividerCount = 0 + · have he : HierarchyStarredStage H q = R.replacementBase.core := by + simp [HierarchyStarredStage, q, hq, Fin.last] + rw [he] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · rw [lastPositive hq] + exact trans H.coreInsideFirst (chain H.dividerCount (by omega) ⟨1, by omega⟩ + (by change 1 ≤ H.dividerCount; omega)) + +private theorem helper_stageCase_554.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (hlen : (4 : + ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : TreeSequence G + e0), + ∀ a ∈ HierarchyStageMissingColors R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), + ∀ (_ : Fin (B.length + (1 : ℕ))), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let _ : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; (0 : + ℕ) < H.dividerCount ∧ a ∈ TreeMissingColors R.coloring (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors + R.coloring Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j hlen B R X a haStage jb H q n Tn + have hm : a ∈ HierarchyStageMissingColors H q := haStage + by_cases hq : H.dividerCount = 0 + · right + refine ⟨hq, ?_⟩ + simpa [HierarchyStageMissingColors, q, hq, Fin.last, Tn, n] using hm + · left + refine ⟨by omega, ?_⟩ + unfold HierarchyStageMissingColors at hm + dsimp only at hm + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · exact (hq (by simpa [q] using congrArg Fin.val hz)).elim + · rw [hi] at hm + simp only [Fin.cases_succ] at hm + have he : i.succ.castSucc = (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := + Fin.ext (by simpa [q] using (congrArg Fin.val hi).symm) + simpa only [he] using hm + +private theorem helper_haA_574.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : TreeSequence G + e0) (a : Fin k) (_ : Fin (B.length + (1 : ℕ))), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + (H.dividerCount ≠ (0 : ℕ) → HierarchyStarredStage H q = H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → TreeSequenceInitialSegment Tn A → (0 : ℕ) < + H.dividerCount ∧ a ∈ TreeMissingColors R.coloring (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors + R.coloring Tn → a ∈ TreeMissingColors R.coloring A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j A starEq hlen B R X a jb H q n Tn + lastPositive hTnA stageCase + rcases stageCase with ⟨hq, hm⟩ | ⟨hq, hm⟩ + · rw [← starEq R, lastPositive (by omega)] + exact hm + · obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp hm + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset hTnA hv, hc⟩ + +private theorem helper_iaLe_586.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); TreeSequenceInitialSegment A T → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : TreeSequence G + e0) (a : Fin k) (_ : Fin (B.length + (1 : ℕ))), a ∈ TreeMissingColors R.coloring A → + (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j A hAT hlen B firstLe R X a jb haA + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp haA + obtain ⟨j, hj⟩ : ∃ j, A.vertex j = v := by simpa [TreeSequenceVertexSet] using hv + have hcT : a ∈ MissingColors G R.coloring + (T.vertex (Fin.castLE (Nat.succ_le_succ hAT.1) j)) := by + rw [hAT.2.1 j, hj]; exact hc + have hh := firstLe R.coloring a _ hcT + change (HierarchyFirstMissingPosition R.coloring T a).val ≤ j.val at hh + have := j.isLt + omega + +private theorem helper_hjb_641.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T), TreeSequenceInitialSegment A B → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : TreeSequence G + e0) (a b : Fin k) (jb : Fin (B.length + (1 : ℕ))), b ∈ MissingColors G R.coloring + (B.vertex jb) → (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition R.coloring T b) : ℕ) = (↑jb : ℕ) → Fin.castLE + (Nat.succ_le_succ hBT.1) jb = HierarchyFirstMissingPosition R.coloring T b → b ∉ + TreeMissingColors R.coloring A → A.length < (↑jb : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j A hlen B hBT hAB vertexMem R X a b jb hb + iaLe ibEq jbEq hbOut + by_contra hh + have hjle : jb.val ≤ A.length := by omega + let x : Fin (A.length + 1) := ⟨jb.val, by omega⟩ + have hx : Fin.castLE (Nat.succ_le_succ hAB.1) x = jb := Fin.ext rfl + apply hbOut + exact Finset.mem_biUnion.mpr ⟨A.vertex x, vertexMem A x, by + rw [← hAB.2.1 x, hx]; exact hb⟩ + +private theorem helper_hsame_650.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T) (hAB : TreeSequenceInitialSegment A B) (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : TreeSequence G + e0) (a b : Fin k) (jb : Fin (B.length + (1 : ℕ))), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; (0 : + ℕ) < H.dividerCount ∧ a ∈ TreeMissingColors R.coloring (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors + R.coloring Tn → + ∀ (iaLe : (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length), + let ja : Fin (B.length + (1 : ℕ)) := (⟨(↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ), + by + have this : A.length ≤ B.length := hAB.1; omega + ⟩ : Fin (B.length + (1 : ℕ))); Fin.castLE (Nat.succ_le_succ hBT.1) ja = + HierarchyFirstMissingPosition R.coloring T a → Fin.castLE (Nat.succ_le_succ hBT.1) jb = + HierarchyFirstMissingPosition R.coloring T b → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors + R.coloring Tn ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + ({ a } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → + TwoColorComponent G R.coloring a b (Sum.inl (B.vertex ja)) = TwoColorComponent G + R.coloring a b (Sum.inl (B.vertex jb)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j A hlen B hBT hAB R X a b jb H n Tn + stageCase iaLe ja jaEq jbEq change + have hh : TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (HierarchyFirstMissingPosition R.coloring T a))) = + TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (HierarchyFirstMissingPosition R.coloring T b))) := by + rcases stageCase with ⟨hq, hm⟩ | ⟨hq, hm⟩ + · exact change.1 ⟨hq, Or.inl hm⟩ + · exact change.2.1 ⟨hq, Or.inl hm⟩ + rw [← jaEq, ← jbEq, hBT.2.1 ja, hBT.2.1 jb] at hh + exact hh + +private theorem helper_hsone_681.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ b → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx R a b hne sigma + refine ⟨?_, ?_⟩ + · simp [sigma, TwoColorComponentSwap, R.minimumContext.oneEdgeUncolored.1] + · intro e he + obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 e he + by_cases hm : Sum.inr e ∈ TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length))) + · by_cases hca : c = a + · subst c; exact ⟨b, by simp [sigma, TwoColorComponentSwap, hm, hc]⟩ + · by_cases hcb : c = b + · subst c; exact ⟨a, by simp [sigma, TwoColorComponentSwap, hm, hc, hne.symm]⟩ + · exact ⟨c, by simp [sigma, TwoColorComponentSwap, hm, hc, hca, hcb]⟩ + · exact ⟨c, by simp [sigma, TwoColorComponentSwap, hm, hc]⟩ + +private theorem helper_baseStable_716.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data n; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); HierarchyWeaklyStable H q sigma → if + R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn R.replacementBase.closure Dn R.coloring sigma else + StableColoring Tn Dn R.coloring sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j R a b H q n Tn Dn sigma hweak + have extract (j : Fin (H.dividerCount + 1)) : HierarchyWeaklyStable H j sigma → + (if R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn R.replacementBase.closure Dn R.coloring sigma + else StableColoring Tn Dn R.coloring sigma) := + Fin.cases (fun h => h) (fun _ h => h.1) j + exact extract q hweak + +private theorem helper_fixedA_730.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : TreeSequence G + e0) (a b : Fin k) (_ : Fin (B.length + (1 : ℕ))), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data n; + (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors + R.coloring Tn ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + ({ a } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); IsOneEdgeUncolored sigma e0 → HierarchyWeaklyStable H q + sigma → (if R.corresponding.replacementETT.series.data.kind n = some + TashkinovExtensionKind.PE then CombinedStableColoring Tn R.replacementBase.closure Dn + R.coloring sigma else StableColoring Tn Dn R.coloring sigma) → + ∀ (t : Fin A.length), sigma (A.edge t) = R.coloring (A.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j A starEq hlen B hBT hAB R X a b jb H q n + Tn Dn iaLe change sigma hsone hweak baseStable + have fixed (j : Fin (H.dividerCount + 1)) : HierarchyWeaklyStable H j sigma → + ∀ t : Fin (HierarchyStarredStage H j).length, + sigma ((HierarchyStarredStage H j).edge t) = R.coloring ((HierarchyStarredStage H j).edge + t) := by + refine Fin.cases ?_ (fun i => ?_) j + · intro _ + exact P2813_T1_BaseDisplayedEdges G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase sigma + R.minimumContext.oneEdgeUncolored hsone baseStable + · intro hh t + change sigma ((H.stage i.succ.castSucc).edge t) = + R.coloring ((H.stage i.succ.castSucc).edge t) + by_cases ht : t.val = 0 + · have he : (H.stage i.succ.castSucc).edge t = e0 := by + rw [show t = ⟨0, (H.stage i.succ.castSucc).positive⟩ from Fin.ext ht] + exact (H.stage i.succ.castSucc).first_edge + rw [he, hsone.1, R.minimumContext.oneEdgeUncolored.1] + · exact hh.2.1 t (by omega) + rw [← starEq R] + exact fixed q hweak + +private theorem helper_fixedPrefix_750.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0) (a b : Fin k), ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data n; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); StableColoring Tn Dn R.coloring sigma → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → sigma (T.edge t) = + R.coloring (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A R X a b haUnused hbException n Tn Dn + sigma stable t hlo hhi + by_cases hbcol : R.coloring (T.edge t) = some b + · obtain ⟨hi, hc⟩ := hbException t hlo hhi hbcol + exact stable.1 _ hi ⟨b, Finset.mem_union_right _ hc, hbcol⟩ + · have haNo := haUnused t hlo hhi + simp [sigma, TwoColorComponentSwap, haNo, hbcol] + +private theorem helper_prefixFixed_762.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0), TreeSequenceInitialSegment A X → + ∀ (a b : Fin k) (_ : Fin (B.length + (1 : ℕ))), (↑(HierarchyFirstMissingPosition R.coloring T + a) : ℕ) ≤ A.length → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors + R.coloring Tn ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + ({ a } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); ( + ∀ (t : Fin A.length), sigma (A.edge t) = R.coloring (A.edge t)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → sigma (T.edge t) = + R.coloring (T.edge t)) → TreeSequenceInitialSegment X T → + ∀ (t : Fin X.length), sigma (X.edge t) = R.coloring (X.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j A hlen B hBT hAB R X hAX a b jb iaLe + change sigma fixedA fixedPrefix hXT t + by_cases hlow : t.val < A.length + · let j : Fin A.length := ⟨t.val, hlow⟩ + have he : Fin.castLE hAX.1 j = t := Fin.ext rfl + rw [← he, hAX.2.2 j] + exact fixedA j + · rw [← hXT.2.2 t] + exact fixedPrefix (Fin.castLE hXT.1 t) (by change A.length ≤ t.val; omega) t.isLt + +private theorem helper_routes_771.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment A B) (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0), TreeSequenceInitialSegment A X → + ∀ (hAXlt : A.length < X.length), TreeSequenceInitialSegment X B → + ∀ (a b : Fin k) (_ : Fin (B.length + (1 : ℕ))), + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + TreeSequenceInitialSegment Tn A → + ∀ (_ : (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length), ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors + R.coloring Tn ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + ({ a } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G R.coloring x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); TreeSequenceInitialSegment X T → + let XM : TreeSequence G e0 := TreeSequencePrefix X (X.length - (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a_1 : ¬(1 : ℕ) ≤ + X.length - (1 : ℕ)) ↦ + by omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ); TreeSequenceInitialSegment XM X → ( + ∀ (t : Fin X.length), Tn.length ≤ (↑t : ℕ) → sigma (X.edge t) = R.coloring (X.edge t)) → + (R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X ∨ + (R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + R.corresponding.replacementETT.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X) ∧ + TashkinovAugmentationSequence R.coloring X T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans common A hlen B hBT hAB R X hAX + hAXlt hXB a b jb n Tn hTnA iaLe change hmissing sigma hXT XM hXMX prefixFixed + rcases P2813_T1_TerminalRoute G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT with ⟨hp, hseq⟩ | + ⟨hp, f, seed, hedges, hseed, hincident, hcontrol, hseq⟩ + · have hsourceX := trans hTnA hAX + have hpre := TashkinovAugmentationSequenceRestrict R.coloring Tn X T hseq hsourceX hXT + refine ⟨Or.inl ⟨hp, ?_⟩, + TashkinovAugmentationSequenceSuffix R.coloring Tn X T hseq hsourceX hXT⟩ + exact TashkinovAugmentationSequenceColoringTransport R.coloring sigma Tn XM X + hpre hXMX (by dsimp [XM, TreeSequencePrefix]; have := X.positive; omega) prefixFixed + (fun v hv => hmissing v (TreeSequenceInitialSegmentVertexSetSubset + (trans hXMX hXB) hv)) + · have hseedX := common + (TashkinovAugmentationSequenceInitialSegment R.coloring seed T hseq) hXT + (by have hl := hseed.1; have := hTnA.1; change seed.length = Tn.length + 1 at hl; omega) + have hpre := TashkinovAugmentationSequenceRestrict R.coloring seed X T hseq hseedX hXT + refine ⟨Or.inr ⟨hp, f, seed, hedges, hseed, ?_⟩, + TashkinovAugmentationSequenceSuffix R.coloring seed X T hseq hseedX hXT⟩ + exact TashkinovAugmentationSequenceColoringTransport R.coloring sigma seed XM X + hpre hXMX (by dsimp [XM, TreeSequencePrefix]; have := X.positive; omega) + (fun t ht => prefixFixed t + (by have hl := hseed.1; change seed.length = Tn.length + 1 at hl; omega)) + (fun v hv => hmissing v (TreeSequenceInitialSegmentVertexSetSubset + (trans hXMX hXB) hv)) + +private theorem helper_hsplit_801.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T) (hAB : TreeSequenceInitialSegment A B), ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G + e0), A.length < X.length → TreeSequenceInitialSegment X B → + ∀ (a b : Fin k) (jb : Fin (B.length + (1 : ℕ))), (↑jb : ℕ) ≤ X.length → b ∈ MissingColors G + R.coloring (B.vertex jb) → + ∀ (iaLe : (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length), + let ja : Fin (B.length + (1 : ℕ)) := (⟨(↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ), + by + have this : A.length ≤ B.length := hAB.1; omega + ⟩ : Fin (B.length + (1 : ℕ))); Fin.castLE (Nat.succ_le_succ hBT.1) ja = + HierarchyFirstMissingPosition R.coloring T a → a ∈ MissingColors G R.coloring (B.vertex + ja) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G R.coloring x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); a ∈ TreeMissingColors sigma X ∧ b ∈ TreeMissingColors + sigma X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j A hlen B hBT hAB vertexMem R X hAXlt hXB + a b jb hjbX hb iaLe ja jaEq haFirstB hmissing sigma + have subset (j : Fin (B.length + 1)) (hj : j.val ≤ X.length) : + B.vertex j ∈ TreeSequenceVertexSet X := by + let x : Fin (X.length + 1) := ⟨j.val, by omega⟩ + have hx : Fin.castLE (Nat.succ_le_succ hXB.1) x = j := Fin.ext rfl + rw [← hx, hXB.2.1 x] + exact vertexMem X x + refine ⟨Finset.mem_biUnion.mpr ⟨B.vertex ja, subset ja (by dsimp [ja]; omega), ?_⟩, + Finset.mem_biUnion.mpr ⟨B.vertex jb, subset jb hjbX, ?_⟩⟩ + · rw [hmissing _ (vertexMem B ja)]; exact haFirstB + · rw [hmissing _ (vertexMem B jb)]; exact hb + +private theorem helper_hnotElementary_829.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T) (hAB : TreeSequenceInitialSegment A B), ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : TreeSequence G + e0) (a b : Fin k) (jb : Fin (B.length + (1 : ℕ))), b ∈ MissingColors G R.coloring + (B.vertex jb) → a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) ∨ b ∈ + MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + ∀ (iaLe : (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length), + (↑(HierarchyFirstMissingPosition R.coloring T b) : ℕ) = (↑jb : ℕ) → + let ja : Fin (B.length + (1 : ℕ)) := (⟨(↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ), + by + have this : A.length ≤ B.length := hAB.1; omega + ⟩ : Fin (B.length + (1 : ℕ))); Fin.castLE (Nat.succ_le_succ hBT.1) jb = + HierarchyFirstMissingPosition R.coloring T b → a ∈ MissingColors G R.coloring (B.vertex + ja) → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors + R.coloring Tn ∨ Disjoint (insert a ({ b } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + ({ a } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G R.coloring x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); (a ∈ MissingColors G R.coloring (T.vertex (Fin.last + T.length)) → b ∈ MissingColors G sigma (T.vertex (Fin.last T.length))) → (b ∈ + MissingColors G R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G sigma + (T.vertex (Fin.last T.length))) → ¬ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet T) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans A hlen B hBT hAB vertexMem R X a b + jb hb hw iaLe ibEq ja jbEq haFirstB change hmissing sigma hterminalA hterminalB he + rcases hw with hw | hw + · have hbNew : b ∈ MissingColors G sigma (B.vertex jb) := by + rw [hmissing _ (vertexMem B jb)]; exact hb + exact Finset.disjoint_left.mp (he + (TreeSequenceInitialSegmentVertexSetSubset hBT (vertexMem B jb)) + (vertexMem T (Fin.last T.length)) (by + intro hh + have hh := T.vertex_injective ((hBT.2.1 jb).trans hh) + have hh := congrArg Fin.val hh + change jb.val = T.length at hh + have := jb.isLt + have hblen : B.length = T.length - 1 := rfl + omega)) + hbNew (hterminalA hw) + · have haNew : a ∈ MissingColors G sigma (B.vertex ja) := by + rw [hmissing _ (vertexMem B ja)]; exact haFirstB + exact Finset.disjoint_left.mp (he + (TreeSequenceInitialSegmentVertexSetSubset hBT (vertexMem B ja)) + (vertexMem T (Fin.last T.length)) (by + intro hh + have hh := T.vertex_injective ((hBT.2.1 ja).trans hh) + have hh := congrArg Fin.val hh + change ja.val = T.length at hh + have hja : ja.val ≤ A.length := iaLe + have hab := hAB.1 + have hblen : B.length = T.length - 1 := rfl + omega)) + haNew (hterminalB hw) + +private theorem helper_hAn_999.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + R.counterexample.hierarchy.dividerCount = (0 : ℕ) → R.replacementBase.core = + R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc → A = + R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R hzero hcore + rw [← starEq R] + have hs : HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = R.replacementBase.core := by + simp [HierarchyStarredStage, hzero, Fin.last] + exact hs.trans hcore + +private theorem helper_chain_1020.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ + j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans R H j + induction j with + | zero => + intro hj i hi + have he : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have he : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) (H.nested ⟨j, by omega⟩) + +private theorem helper_branch_1043.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; ( + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ + j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ))))) → ¬H.dividerCount = (0 : ℕ) → TreeSequenceInitialSegment R.replacementBase.core + (HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans R H chain hq + have he : HierarchyStarredStage H (Fin.last H.dividerCount) = + H.stage ⟨H.dividerCount, by omega⟩ := by + unfold HierarchyStarredStage + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) + · exact (hq (by simpa using congrArg Fin.val hz)).elim + · rw [hi] + simp only [Fin.cases_succ] + congr 1 + exact Fin.ext (by simpa using (congrArg Fin.val hi).symm) + rw [he] + exact trans H.coreInsideFirst (chain H.dividerCount (by omega) ⟨1, by omega⟩ + (by change 1 ≤ H.dividerCount; omega)) + +private theorem helper_ha_1142.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); TreeSequenceInitialSegment B T → ( + ∀ (r : ℕ), TreeSequenceInitialSegment (HierarchyFullTailPrefix C r) T) → + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last + (HierarchyFullTailPrefix C i).length)), + ∀ (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by + omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); alpha ∈ MissingColors G P.coloring (B.vertex ja) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper A htail + hlen B hBT prefixT I i hiUpper P alpha haPrefix hSlen ja + have he : (HierarchyFullTailPrefix C i).vertex (Fin.last (HierarchyFullTailPrefix C i).length) = + B.vertex ja := by + rw [← (prefixT i).2.1, ← hBT.2.1 ja] + apply congrArg T.vertex + apply Fin.ext + exact hSlen + rw [← he] + exact haPrefix + +private theorem helper_branch_1158.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + let Extra : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + R.coloring v; + let Gamma : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); Y.length = A.length + (j + - (2 : ℕ)) → TreeSequenceInitialSegment Y B → + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), + ∀ (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by + omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); alpha ∈ MissingColors G P.coloring (B.vertex ja) → + alpha ∉ Gamma P ∪ Extra P → i ≤ j - (2 : ℕ) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; alpha ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ alpha ∈ TreeMissingColors + P.coloring B ∧ (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∧ (↑(HierarchyFirstMissingPosition + P.coloring T eta) : ℕ) ≤ B.length) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper A htail + hlen B vertexMem Extra Gamma Y hYlen hYB I i hiUpper P alpha haTerminal hSlen ja ha haGood + hsmall + refine ⟨P, alpha, haTerminal, ?_, Or.inl haGood⟩ + let x : Fin (Y.length + 1) := ⟨ja.val, by dsimp [ja]; omega⟩ + have hx : Fin.castLE (Nat.succ_le_succ hYB.1) x = ja := Fin.ext rfl + exact Finset.mem_biUnion.mpr ⟨Y.vertex x, vertexMem Y x, by + rw [← hYB.2.1 x, hx]; exact ha⟩ + +private theorem helper_choice_1225.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (hpathLower : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), ( + ∀ (M F D U W N : Finset (Fin k)) (g : Fin k → Finset (Fin k)), W ⊆ U ∪ N → N.card ≤ (1 : ℕ) → + ( + ∀ eta ∈ D, g eta ⊆ M) → ( + ∀ eta ∈ D, (g eta).card = (2 : ℕ)) → ( + ∀ eta ∈ D, + ∀ theta ∈ D, eta ≠ theta → Disjoint (g eta) (g theta)) → Disjoint (D.biUnion g) D → ((((M \ F) + \ U) \ (D.biUnion g ∪ D)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ M ∧ Disjoint (g (eta h) ∪ ({eta h} : Finset (Fin k))) + U) → + ∃ beta ∈ M, beta ∉ D ∧ beta ∉ W ∧ (beta ∉ D.biUnion g ∪ F ∨ + ∃ eta ∈ D, beta ∈ g eta ∧ eta ∈ M)) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T), ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j) → + let Extra : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + R.coloring v; + let Gamma : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount)); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Gamma R ⊆ + TreeMissingColors R.coloring A) → + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (hYlen : Y.length = A.length + (j - (2 : ℕ))), TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment A Y → + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by + omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); + ∀ (hiEq : i = j - (1 : ℕ)), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (hXlen : X.length = A.length + (j - (1 : ℕ))) (hXB : TreeSequenceInitialSegment X B) (hYXlen + : X.length = Y.length + (1 : ℕ)) (hjaX : (↑ja : ℕ) = X.length), + let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + let used : ℕ → Finset (Fin k) := fun (r : ℕ) ↦ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + r ∧ P.coloring (T.edge t) = + some c} : Finset (Fin k)); + let tnew : Fin T.length := (⟨Y.length, + by + have _ : X.length ≤ B.length := hXB.1 + have this : B.length ≤ T.length := hBT.1 + omega + ⟩ : Fin T.length); + let fresh : Finset (Fin k) := ({c : Fin k | P.coloring (T.edge tnew) = some c} : Finset (Fin + k)); fresh.card ≤ (1 : ℕ) → used (j - (1 : ℕ)) ⊆ used (j - (2 : ℕ)) ∪ fresh → (2 : ℕ) * + P.corresponding.replacementETT.rounds + (11 : ℕ) ≤ ((TreeMissingColors P.coloring Y \ + Extra P) \ used (j - (2 : ℕ))).card ∧ ((((TreeMissingColors P.coloring Y \ Extra P) \ used + (j - (2 : ℕ))) \ (Gamma P ∪ D)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ TreeMissingColors P.coloring Y ∧ Disjoint + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) (eta h) ∪ + ({eta h} : Finset (Fin k))) (used (j - (2 : ℕ)))) → + ∃ beta ∈ TreeMissingColors P.coloring Y, beta ∉ D ∧ beta ∉ used (j - (1 : ℕ)) ∧ (beta ∉ Gamma + P ∪ Extra P ∨ + ∃ eta ∈ D, beta ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring + T eta) : ℕ) ≤ Y.length) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper + finiteChoice trans A htail hlen B hBT firstLe Extra Gamma gammaSub Y hYlen hYT hAY I i + hiUpper P hSlen ja hiEq X hXlen hXB hYXlen hjaX D used tnew fresh freshCard usedStep nineY + clear * - P Y D used fresh usedStep freshCard finiteChoice Extra Gamma gammaSub hAY hYT firstLe + nineY + obtain ⟨beta, hbM, hbD, hbW, hc⟩ := finiteChoice + (TreeMissingColors P.coloring Y) (Extra P) D (used (j - 2)) (used (j - 1)) fresh + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount)) + usedStep freshCard (fun eta heta c hc => by + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp (gammaSub P (Finset.mem_biUnion.mpr ⟨eta, + heta, hc⟩)) + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hAY hv, hcv⟩) + (P.counterexample.good.twoColors _) (fun eta heta theta htheta => + P.counterexample.good.disjointPairs _ eta theta heta htheta) + (GoodHierarchyReservedDisjoint P.counterexample.good _).2 nineY.2 + refine ⟨beta, hbM, hbD, hbW, ?_⟩ + rcases hc with hc | ⟨eta, heta, hbGamma, heM⟩ + · exact Or.inl hc + · right + refine ⟨eta, heta, hbGamma, ?_⟩ + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp heM + obtain ⟨z, hz⟩ : ∃ z, Y.vertex z = v := by simpa [TreeSequenceVertexSet] using hv + have hfirst := firstLe P.coloring eta (Fin.castLE (Nat.succ_le_succ hYT.1) z) + (by rw [hYT.2.1 z, hz]; exact hcv) + have := z.isLt + change (HierarchyFirstMissingPosition P.coloring T eta).val ≤ z.val at hfirst + exact hfirst.trans (Nat.le_of_lt_succ z.isLt) + +private theorem helper_habNe_1264.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (hYB : TreeSequenceInitialSegment Y B), + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k) (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by + omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); alpha ∈ MissingColors G P.coloring (B.vertex ja) → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); X.length = Y.length + (1 + : ℕ) → (↑ja : ℕ) = X.length → + ∀ (beta : Fin k) (yb : Fin (Y.length + (1 : ℕ))), + let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; beta ∈ + MissingColors G P.coloring (B.vertex jb) → (↑jb : ℕ) ≤ Y.length → alpha ≠ beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper A htail + hlen B elementary vertexMem Y hYB I i hiUpper P alpha hSlen ja ha X hYXlen hjaX beta yb jb + hb hjbY he + have hneq : B.vertex ja ≠ B.vertex jb := by + intro hh + have hh := congrArg Fin.val (B.vertex_injective hh) + clear * - hh hjaX hjbY hYXlen + omega + exact Finset.disjoint_left.mp (elementary P (vertexMem B ja) (vertexMem B jb) hneq) ha (he.symm + ▸ hb) + +private theorem helper_branch_1298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (j : ℕ) (hlen : (4 : + ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); ( + ∀ (psi tau : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) → + ∀ (c : Fin k), HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c) + → + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (beta : Fin k) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → + ∀ eta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), beta ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta → + ∀ owner ∈ D, beta ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) owner → (↑(HierarchyFirstMissingPosition + P.coloring T owner) : ℕ) ≤ Y.length → (↑(HierarchyFirstMissingPosition R.coloring T eta) : + ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j hlen B firstFixed Y P D beta R hm eta heP + hcP owner howner hbOwner hcut + have he : eta = owner := by + by_contra hn + exact Finset.disjoint_left.mp (P.counterexample.good.disjointPairs _ eta owner heP howner hn) + hcP hbOwner + rw [firstFixed P.coloring R.coloring hm eta, he] + exact hcut + +private theorem helper_branch_1318.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (j : ℕ) (hlen : (4 : + ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); ( + ∀ (psi tau : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) → + ∀ (c : Fin k), HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c) + → ( + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) → + let Extra : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + R.coloring v; + let Gamma : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount)); ( + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) → + Extra S = Extra R) → ( + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Gamma R = Gamma + S) → + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (beta : Fin k), (beta ∉ Gamma P ∪ Extra P ∨ + ∃ eta ∈ D, beta ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring + T eta) : ℕ) ≤ Y.length) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → + beta ∉ Gamma R ∪ Extra R ∨ + ∃ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j hlen B firstFixed gammaTransport Extra + Gamma extraFixed gammaFixed Y P D beta hbChoice R hm + rcases hbChoice with hout | ⟨eta, heta, hbGamma, hcut⟩ + · left + have he : Gamma R ∪ Extra R = Gamma P ∪ Extra P := + congrArg₂ (fun s t : Finset (Fin k) => s ∪ t) + (gammaFixed P R).symm (extraFixed P R hm) + exact he.symm ▸ hout + · obtain ⟨hetaR, hgR⟩ := gammaTransport P R eta heta + right + exact ⟨eta, hetaR, hgR ▸ hbGamma, by rw [firstFixed P.coloring R.coloring hm eta]; exact hcut⟩ + +private theorem helper_branch_1335.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + let Extra : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + R.coloring v; + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ TreeMissingColors R.coloring A, c ∉ Extra R → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let _ : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; H.dividerCount = (0 : ℕ) → + c ∈ HierarchyStageMissingColors R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq Extra R c hcA hcExtra H q hq + have hAcore : A = R.replacementBase.core := by + rw [← starEq R] + simp [HierarchyStarredStage, hq, Fin.last, H] + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hcA + rw [hAcore] at hv + have hvTn : v ∈ TreeSequenceVertexSet (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) := by + by_contra hh + exact hcExtra (Finset.mem_biUnion.mpr ⟨v, Finset.mem_sdiff.mpr ⟨hv, hh⟩, hcv⟩) + have hm : c ∈ TreeMissingColors R.coloring (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) := + Finset.mem_biUnion.mpr ⟨v, hvTn, hcv⟩ + simpa [HierarchyStageMissingColors, H, q, hq, Fin.last] using hm + +private theorem helper_branch_1348.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ TreeMissingColors R.coloring A, + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let _ : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; ¬H.dividerCount = (0 : ℕ) → + c ∈ HierarchyStageMissingColors R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R c hcA H q hq + have posEq : HierarchyStageMissingColors H q = TreeMissingColors R.coloring A := by + rw [← starEq R] + unfold HierarchyStageMissingColors HierarchyStarredStage + dsimp only + change Fin.cases (TreeMissingColors R.coloring + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc)) + (fun i : Fin H.dividerCount => TreeMissingColors R.coloring (H.stage i.succ.castSucc)) q = + TreeMissingColors R.coloring (Fin.cases R.replacementBase.core + (fun i : Fin H.dividerCount => H.stage i.succ.castSucc) q) + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · exact (hq (by simpa [q] using congrArg Fin.val hz)).elim + · rw [hi] + rfl + rw [posEq] + exact hcA + +private theorem helper_branch_1365.{u_1, u_2} : + helperBranch1365Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper trans A + htail hlen B hBT vertexMem firstAt stageSwitch gammaTransport gammaUnused Extra Gamma + gammaSub Y hYlen hYB I i hiUpper P alpha haPrefix haTerminal hSlen ja ha haOutside haGood + hiEq X hXlen hXB hAX hAXlt hYXlen hjaX D beta yb jb hb hjbY haFirst habNe hbUnused + haException cutBeta finish hAlphaStored + have hgNon : (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + alpha).Nonempty := by + apply Finset.card_pos.mp + rw [P.counterexample.good.twoColors _ _ hAlphaStored] + decide + obtain ⟨gamma, hg⟩ := hgNon + have hgStage : gamma ∈ HierarchyStageMissingColors P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) := + (Finset.mem_sdiff.mp (P.counterexample.good.avoidance _ _ hAlphaStored hg)).1 + have hgA : gamma ∈ TreeMissingColors P.coloring A := gammaSub P + (Finset.mem_biUnion.mpr ⟨alpha, hAlphaStored, hg⟩) + have hgAlpha : gamma ≠ alpha := by rintro rfl; exact haOutside hgA + have hgBeta : gamma ≠ beta := by + intro he + have hcut := cutBeta P (fun _ _ => rfl) alpha hAlphaStored (he ▸ hg) + clear * - hcut haFirst hYXlen + omega + have hgUnused : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + P.coloring (T.edge t) ≠ some gamma := by + intro t hlo hhi + exact gammaUnused P alpha gamma hAlphaStored hg t hlo (by rw [haFirst]; exact hhi) + have cutGamma : ∀ eta ∈ D, + gamma ∈ P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta → + (HierarchyFirstMissingPosition P.coloring T eta).val ≤ X.length := by + intro eta heta hc + have he : eta = alpha := by + by_contra hn + exact Finset.disjoint_left.mp (P.counterexample.good.disjointPairs _ eta alpha heta + hAlphaStored hn) hc hg + rw [he, haFirst] + obtain ⟨P1, hm1, hf1, _, ht1⟩ := stageSwitch P X hAX hAXlt hXB gamma alpha hgAlpha hgStage + ja (by omega) ha (Or.inr haTerminal) hgUnused haException (by + intro eta heta hc + rcases hc with hc | hc + · exact cutGamma eta heta hc + · exact (haOutside (gammaSub P (Finset.mem_biUnion.mpr ⟨eta, heta, hc⟩))).elim) + have hgTerm : gamma ∈ MissingColors G P1.coloring (T.vertex (Fin.last T.length)) := ht1 haTerminal + obtain ⟨hAlphaStored1, hgammaEq⟩ := gammaTransport P P1 alpha hAlphaStored + have hg1 : gamma ∈ P1.counterexample.good.gamma (Fin.last + P1.counterexample.hierarchy.dividerCount) alpha := + hgammaEq ▸ hg + have hgStage1 : gamma ∈ HierarchyStageMissingColors P1.counterexample.hierarchy + (Fin.last P1.counterexample.hierarchy.dividerCount) := + (Finset.mem_sdiff.mp (P1.counterexample.good.avoidance _ _ hAlphaStored1 hg1)).1 + have hb1 : beta ∈ MissingColors G P1.coloring (B.vertex jb) := by + rw [hm1 _ (vertexMem B jb)] + exact hb + have ha1 : alpha ∈ MissingColors G P1.coloring (B.vertex ja) := by + rw [hm1 _ (vertexMem B ja)] + exact ha + have haFirst1 : (HierarchyFirstMissingPosition P1.coloring T alpha).val = X.length := by + rw [firstAt P1 alpha ja ha1, hjaX] + have hgUnused1 : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + P1.coloring (T.edge t) ≠ some gamma := by + intro t hlo hhi + exact gammaUnused P1 alpha gamma hAlphaStored1 hg1 t hlo (by rw [haFirst1]; exact hhi) + have hbUnused1 : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + P1.coloring (T.edge t) ≠ some beta := by + intro t hlo hhi + rw [hf1 t hlo hhi] + exact hbUnused t hlo hhi + obtain ⟨P2, hm2, _, ht2, _⟩ := stageSwitch P1 X hAX hAXlt hXB gamma beta hgBeta hgStage1 + jb (by omega) hb1 (Or.inl hgTerm) hgUnused1 (by + intro t hlo hhi hc + exact (hbUnused1 t hlo hhi hc).elim) (by + intro eta heta hc + rcases hc with hc | hc + · have he : eta = alpha := by + by_contra hn + exact Finset.disjoint_left.mp (P1.counterexample.good.disjointPairs _ eta alpha heta + hAlphaStored1 hn) hc hg1 + rw [he, haFirst1] + · exact (cutBeta P1 hm1 eta heta hc).trans (by omega)) + have hm : ∀ v ∈ TreeSequenceVertexSet B, MissingColors G P2.coloring v = MissingColors G + P.coloring v := + fun v hv => (hm2 v hv).trans (hm1 v hv) + exact ⟨P2, beta, ht2 hgTerm, finish P2 hm (ht2 hgTerm)⟩ + +private theorem helper_branch_1435.{u_1, u_2} : + helperBranch1435Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper trans A + htail hlen B hBT stageSwitch Extra Gamma gammaSub Y hYlen hYB I i hiUpper P alpha + haTerminal hSlen ja ha haOutside hiEq X hXlen hXB hAX hAXlt hYXlen hjaX beta yb habNe + hbUnused haException cutBeta finish hbStage + obtain ⟨S, hm, _, _, ht⟩ := stageSwitch P X hAX hAXlt hXB beta alpha habNe.symm hbStage + ja (by omega) ha (Or.inr haTerminal) hbUnused haException (by + intro eta heta hc + rcases hc with hc | hc + · exact (cutBeta P (fun _ _ => rfl) eta heta hc).trans (by omega) + · exact (haOutside (gammaSub P (Finset.mem_biUnion.mpr ⟨eta, heta, hc⟩))).elim) + exact ⟨S, beta, ht haTerminal, finish S hm (ht haTerminal)⟩ + +private theorem helper_hjbA_1449.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); Y.length = A.length + (j + - (2 : ℕ)) → + ∀ (hYB : TreeSequenceInitialSegment Y B), + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k) (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by + omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); i = j - (1 : ℕ) → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); X.length = A.length + (j + - (1 : ℕ)) → TreeSequenceInitialSegment X B → X.length = Y.length + (1 : ℕ) → (↑ja : ℕ) = + X.length → + ∀ (beta : Fin k) (yb : Fin (Y.length + (1 : ℕ))), + let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; beta ∈ + MissingColors G P.coloring (B.vertex jb) → (↑(HierarchyFirstMissingPosition P.coloring T + alpha) : ℕ) = X.length → beta ∉ TreeMissingColors P.coloring A → A.length < (↑jb : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper A htail + hlen B hBT hAB vertexMem Y hYlen hYB I i hiUpper P alpha hSlen ja hiEq X hXlen hXB hYXlen + hjaX beta yb jb hb haFirst hbOutside + by_contra hh + have hjle : jb.val ≤ A.length := by omega + let x : Fin (A.length + 1) := ⟨jb.val, by omega⟩ + have hx : Fin.castLE (Nat.succ_le_succ hAB.1) x = jb := Fin.ext rfl + apply hbOutside + exact Finset.mem_biUnion.mpr ⟨A.vertex x, vertexMem A x, by + rw [← hAB.2.1 x, hx]; exact hb⟩ + +private theorem helper_hdisD_1496.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T), + let Extra : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + R.coloring v; + let Gamma : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (hYB : TreeSequenceInitialSegment Y B), + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last + (HierarchyFullTailPrefix C i).length)), alpha ∈ MissingColors G P.coloring (T.vertex + (Fin.last T.length)) → + ∀ (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by + omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); alpha ∈ MissingColors G P.coloring (B.vertex ja) → + alpha ∉ TreeMissingColors P.coloring A → alpha ∉ Gamma P ∪ Extra P → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + let used : ℕ → Finset (Fin k) := fun (r : ℕ) ↦ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + r ∧ P.coloring (T.edge t) = + some c} : Finset (Fin k)); + ∀ beta ∈ TreeMissingColors P.coloring Y, beta ∉ D → beta ∉ used (j - (1 : ℕ)) → (beta ∉ Gamma + P ∪ Extra P ∨ + ∃ eta ∈ D, beta ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring + T eta) : ℕ) ≤ Y.length) → + ∀ (vbeta : V), beta ∈ MissingColors G P.coloring vbeta → + ∀ (yb : Fin (Y.length + (1 : ℕ))), + let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; beta ∈ + MissingColors G P.coloring (B.vertex jb) → (↑(HierarchyFirstMissingPosition P.coloring T + alpha) : ℕ) = X.length → alpha ≠ beta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + beta) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) = some + alpha → TreeIncidentEdge (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ alpha ∈ + TashkinovStoredColors P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → + beta ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → beta ∈ + TreeMissingColors R.coloring Y ∧ (beta ∉ Gamma R ∪ Extra R ∨ + ∃ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length)) → alpha ∉ D → beta ∉ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → beta ∉ + Gamma P ∪ Extra P → beta ∉ TreeMissingColors P.coloring A → alpha ∉ TashkinovStoredColors + P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds) → beta ∉ TashkinovStoredColors + P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds) → (↑(HierarchyFirstMissingPosition P.coloring T + beta) : ℕ) = (↑jb : ℕ) → (↑(HierarchyFirstMissingPosition P.coloring T alpha) : ℕ) = (↑ja + : ℕ) → Fin.castLE (Nat.succ_le_succ hBT.1) jb = HierarchyFirstMissingPosition P.coloring T + beta → Fin.castLE (Nat.succ_le_succ hBT.1) ja = HierarchyFirstMissingPosition P.coloring T + alpha → TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)) + (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) → beta ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition + P.coloring T alpha) : ℕ) ∧ P.coloring (T.edge t) = some c} : Finset (Fin k)) → beta ∈ + TreeMissingColors P.coloring (HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ))) ∧ alpha ∈ TreeMissingColors + P.coloring (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength + P.counterexample - (1 : ℕ))) → ( + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); + have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = + TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta + ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ + TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ + TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ + TreeInterchangeable G A P.coloring beta alpha)) → Disjoint (insert beta ({ alpha } : + Finset (Fin k)) : Finset (Fin k)) D := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper A htail + hlen B hBT Extra Gamma Y hYB I i hiUpper P alpha haPrefix haTerminal hSlen ja ha haOutside + haGood X D used beta hbY hbD hbUsed hbChoice vbeta hbeta yb jb hb haFirst habNe hbUnused + haException cutBeta finish hAlphaStored hbStage hbOutsideChoice hbOutside haRaw hbRaw ibEq + iaEq jbEq jaEq hordered hunused hmissingP change + apply Finset.disjoint_left.mpr + intro c hc hd + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with rfl | rfl + · exact hbD hd + · exact hAlphaStored hd + +private theorem helper_hdisRaw_1503.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T), + let Extra : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + R.coloring v; + let Gamma : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin + k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ + (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (hYB : TreeSequenceInitialSegment Y B), + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last + (HierarchyFullTailPrefix C i).length)), alpha ∈ MissingColors G P.coloring (T.vertex + (Fin.last T.length)) → + ∀ (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by + omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); alpha ∈ MissingColors G P.coloring (B.vertex ja) → + alpha ∉ TreeMissingColors P.coloring A → alpha ∉ Gamma P ∪ Extra P → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + let used : ℕ → Finset (Fin k) := fun (r : ℕ) ↦ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + r ∧ P.coloring (T.edge t) = + some c} : Finset (Fin k)); + ∀ beta ∈ TreeMissingColors P.coloring Y, beta ∉ D → beta ∉ used (j - (1 : ℕ)) → (beta ∉ Gamma + P ∪ Extra P ∨ + ∃ eta ∈ D, beta ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring + T eta) : ℕ) ≤ Y.length) → + ∀ (vbeta : V), beta ∈ MissingColors G P.coloring vbeta → + ∀ (yb : Fin (Y.length + (1 : ℕ))), + let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; beta ∈ + MissingColors G P.coloring (B.vertex jb) → (↑(HierarchyFirstMissingPosition P.coloring T + alpha) : ℕ) = X.length → alpha ≠ beta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + beta) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) = some + alpha → TreeIncidentEdge (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ alpha ∈ + TashkinovStoredColors P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds)) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → + beta ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → beta ∈ + TreeMissingColors R.coloring Y ∧ (beta ∉ Gamma R ∪ Extra R ∨ + ∃ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition R.coloring + T eta) : ℕ) ≤ Y.length)) → alpha ∉ D → beta ∉ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → beta ∉ + Gamma P ∪ Extra P → beta ∉ TreeMissingColors P.coloring A → alpha ∉ TashkinovStoredColors + P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds) → beta ∉ TashkinovStoredColors + P.corresponding.replacementETT.series.data (Fin.last + P.corresponding.replacementETT.rounds) → (↑(HierarchyFirstMissingPosition P.coloring T + beta) : ℕ) = (↑jb : ℕ) → (↑(HierarchyFirstMissingPosition P.coloring T alpha) : ℕ) = (↑ja + : ℕ) → Fin.castLE (Nat.succ_le_succ hBT.1) jb = HierarchyFirstMissingPosition P.coloring T + beta → Fin.castLE (Nat.succ_le_succ hBT.1) ja = HierarchyFirstMissingPosition P.coloring T + alpha → TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)) + (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) → beta ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition + P.coloring T alpha) : ℕ) ∧ P.coloring (T.edge t) = some c} : Finset (Fin k)) → beta ∈ + TreeMissingColors P.coloring (HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ))) ∧ alpha ∈ TreeMissingColors + P.coloring (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength + P.counterexample - (1 : ℕ))) → ( + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); + have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = + TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta + ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ + TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ + TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ + TreeInterchangeable G A P.coloring beta alpha)) → Disjoint (insert beta ({ alpha } : + Finset (Fin k)) : Finset (Fin k)) D → Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) (TashkinovStoredColors P.corresponding.replacementETT.series.data + (Fin.last P.corresponding.replacementETT.rounds)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper A htail + hlen B hBT Extra Gamma Y hYB I i hiUpper P alpha haPrefix haTerminal hSlen ja ha haOutside + haGood X D used beta hbY hbD hbUsed hbChoice vbeta hbeta yb jb hb haFirst habNe hbUnused + haException cutBeta finish hAlphaStored hbStage hbOutsideChoice hbOutside haRaw hbRaw ibEq + iaEq jbEq jaEq hordered hunused hmissingP change hdisD + apply Finset.disjoint_left.mpr + intro c hc hd + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with rfl | rfl + · exact hbRaw hd + · exact haRaw hd + +private theorem helper_hsame_1512.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : + (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : + ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (hBT : TreeSequenceInitialSegment B T), + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); Y.length = A.length + (j + - (2 : ℕ)) → + ∀ (hYB : TreeSequenceInitialSegment Y B), + let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; + let i : ℕ := I.max' hnonempty; + ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k) (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), + let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, + have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) + ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ + by + omega + ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); i = j - (1 : ℕ) → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); X.length = A.length + (j + - (1 : ℕ)) → TreeSequenceInitialSegment X B → X.length = Y.length + (1 : ℕ) → (↑ja : ℕ) = + X.length → + let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount); + ∀ (beta : Fin k) (yb : Fin (Y.length + (1 : ℕ))), + let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; Fin.castLE + (Nat.succ_le_succ hBT.1) jb = HierarchyFirstMissingPosition P.coloring T beta → Fin.castLE + (Nat.succ_le_succ hBT.1) ja = HierarchyFirstMissingPosition P.coloring T alpha → ( + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); + have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = + TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta + ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ + TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ + TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ + TreeInterchangeable G A P.coloring beta alpha)) → Disjoint (insert beta ({ alpha } : + Finset (Fin k)) : Finset (Fin k)) D → Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) (TashkinovStoredColors P.corresponding.replacementETT.series.data + (Fin.last P.corresponding.replacementETT.rounds)) → TwoColorComponent G P.coloring beta + alpha (Sum.inl (B.vertex jb)) = TwoColorComponent G P.coloring beta alpha (Sum.inl + (B.vertex ja)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper A htail + hlen B hBT Y hYlen hYB I i hiUpper P alpha hSlen ja hiEq X hXlen hXB hYXlen hjaX D beta yb + jb jbEq jaEq change hdisD hdisRaw + have hh : TwoColorComponent G P.coloring beta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T beta))) = + TwoColorComponent G P.coloring beta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha))) := by + by_cases hq : P.counterexample.hierarchy.dividerCount = 0 + · exact change.2.1 ⟨hq, Or.inr hdisRaw⟩ + · exact change.1 ⟨by omega, Or.inr hdisD⟩ + rw [← jbEq, ← jaEq, hBT.2.1 jb, hBT.2.1 ja] at hh + exact hh + +private theorem helper_terminalNe_1523.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); TreeSequenceInitialSegment B T → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin + k), ( + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); + have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = + TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta + ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ + TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ + TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ + TreeInterchangeable G A P.coloring beta alpha)) → + ∀ (z : Fin (B.length + (1 : ℕ))), T.vertex (Fin.last T.length) ≠ B.vertex z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans hlen B hBT P alpha beta change z hh + have hh := T.vertex_injective (hh.trans (hBT.2.1 z).symm) + have hv := congrArg Fin.val hh + have hz := z.isLt + have hblen : B.length = T.length - 1 := rfl + change T.length = z.val at hv + clear * - hv hz hblen hlen + omega + +private theorem helper_hprecedes_1539.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (j : ℕ), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); TreeSequenceInitialSegment A T → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (hYB : TreeSequenceInitialSegment Y B) (P : HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx) (alpha beta : Fin k) (yb : Fin (Y.length + (1 : ℕ))), + let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; A.length < (↑jb : + ℕ) → (↑(HierarchyFirstMissingPosition P.coloring T beta) : ℕ) = (↑jb : ℕ) → ( + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); + have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = + TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta + ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ + TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : + Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ + TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ + TreeInterchangeable G A P.coloring beta alpha)) → + ∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u (T.vertex (HierarchyFirstMissingPosition + P.coloring T beta)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans A hAT hlen B Y hYB P alpha beta yb + jb hjbA ibEq change u hu + obtain ⟨z, hz⟩ : ∃ z, A.vertex z = u := by simpa [TreeSequenceVertexSet] using hu + refine ⟨Fin.castLE (Nat.succ_le_succ hAT.1) z, _, (hAT.2.1 z).trans hz, rfl, ?_⟩ + have hzlt := z.isLt + change z.val < (HierarchyFirstMissingPosition P.coloring T beta).val + clear * - hzlt hjbA ibEq + omega + +private theorem helper_hunusedBetween_1548.{u_1, u_2} : + helperHunusedBetween1548Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper A htail + hlen B hBT Y hYlen hYB I i hiUpper P alpha hSlen ja hiEq X hXlen hXB hYXlen hjaX beta yb jb + haFirst hbUnused hjbA ibEq jbEq jaEq hh + obtain ⟨_, t, hlo, hhi, hc⟩ := Finset.mem_filter.mp hh + rw [ibEq] at hlo + rw [haFirst] at hhi + exact hbUnused t (by omega) hhi hc + +private theorem helper_continuation_4396.{u_1, u_2} : + helperContinuation4396Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper + componentData trans A starEq hAT htail hlen B hBT fullB elementary vertexMem Extra Gamma Y + hYlen hYB I i hiUpper P alpha haPrefix haTerminal hSlen ja ha haOutside haGood hiEq X hXlen + hXB hYXlen hjaX D used beta hbY hbD hbUsed hbChoice vbeta hbeta yb jb hb haFirst habNe + hbUnused haException cutBeta finish hAlphaStored hbStage hbOutsideChoice hbOutside hjbA + haRaw hbRaw ibEq iaEq jbEq jaEq hordered hunused + have hmissingP : beta ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1)) ∧ + alpha ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1)) + := by + rw [fullB P] + exact ⟨Finset.mem_biUnion.mpr ⟨B.vertex jb, vertexMem B jb, hb⟩, + Finset.mem_biUnion.mpr ⟨B.vertex ja, vertexMem B ja, ha⟩⟩ + have hprefixP : ColoredVertexSetElementary G P.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - 1))) := by + rw [fullB P] + exact elementary P + have change := ChangeLemma G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext.proper P.minimumContext.oneEdgeUncolored P.minimumContext.lowerRung + P.minimumContext.fewerDividers P.minimumContext.lexicographicMinimality hprefixP + P.minimumContext.largeMissingSet beta alpha habNe.symm hmissingP + (by dsimp only; rw [starEq P]; intro _; exact ⟨hordered, hunused⟩) + have hdisD : Disjoint ({beta, alpha} : Finset (Fin k)) D := by + exact helper_hdisD_1496 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hnonempty) (@j) (@hpathLower) (@hpathUpper) (@htail) (@hlen) (@hBT) (@hYB) (@hiUpper) + (@P) (@alpha) (@haPrefix) (@haTerminal) (@hSlen) (@ha) (@haOutside) (@haGood) (@beta) + (@hbY) (@hbD) (@hbUsed) (@hbChoice) (@vbeta) (@hbeta) (@yb) (@hb) (@haFirst) (@habNe) + (@hbUnused) (@haException) (@cutBeta) (@finish) (@hAlphaStored) (@hbStage) + (@hbOutsideChoice) (@hbOutside) (@haRaw) (@hbRaw) (@ibEq) (@iaEq) (@jbEq) (@jaEq) + (@hordered) (@hunused) (@hmissingP) (@change) + have hdisRaw : Disjoint ({beta, alpha} : Finset (Fin k)) + (TashkinovStoredColors P.corresponding.replacementETT.series.data + (Fin.last P.corresponding.replacementETT.rounds)) := by + exact helper_hdisRaw_1503 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hnonempty) (@j) (@hpathLower) (@hpathUpper) (@htail) (@hlen) (@hBT) (@hYB) (@hiUpper) + (@P) (@alpha) (@haPrefix) (@haTerminal) (@hSlen) (@ha) (@haOutside) (@haGood) (@beta) + (@hbY) (@hbD) (@hbUsed) (@hbChoice) (@vbeta) (@hbeta) (@yb) (@hb) (@haFirst) (@habNe) + (@hbUnused) (@haException) (@cutBeta) (@finish) (@hAlphaStored) (@hbStage) + (@hbOutsideChoice) (@hbOutside) (@haRaw) (@hbRaw) (@ibEq) (@iaEq) (@jbEq) (@jaEq) + (@hordered) (@hunused) (@hmissingP) (@change) (@hdisD) + have hsame : TwoColorComponent G P.coloring beta alpha (Sum.inl (B.vertex jb)) = + TwoColorComponent G P.coloring beta alpha (Sum.inl (B.vertex ja)) := by + exact helper_hsame_1512 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hnonempty) (@j) (@hpathLower) (@hpathUpper) (@htail) (@hlen) (@hBT) (@hYlen) (@hYB) + (@hiUpper) (@P) (@alpha) (@hSlen) (@hiEq) (@hXlen) (@hXB) (@hYXlen) (@hjaX) (@beta) (@yb) + (@jbEq) (@jaEq) (@change) (@hdisD) (@hdisRaw) + have terminalNe (z : Fin (B.length + 1)) : T.vertex (Fin.last T.length) ≠ B.vertex z := by + apply helper_terminalNe_1523 <;> assumption + obtain ⟨_, _, hmissing⟩ := componentData P.coloring beta alpha habNe.symm + P.minimumContext.proper (TreeSequenceVertexSet B) (elementary P) + (B.vertex jb) (B.vertex ja) (T.vertex (Fin.last T.length)) + (vertexMem B jb) (vertexMem B ja) (terminalNe jb) (terminalNe ja) + hb ha (Or.inr haTerminal) hsame + let sigma := TwoColorComponentSwap G P.coloring beta alpha + (Sum.inl (T.vertex (Fin.last T.length))) + have hprecedes : ∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u + (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)) := by + apply helper_hprecedes_1539 <;> assumption + have hunusedBetween : beta ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + (HierarchyFirstMissingPosition P.coloring T beta).val ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition P.coloring T alpha).val ∧ + P.coloring (T.edge t) = some c) := by + exact helper_hunusedBetween_1548 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@hnonempty) (@j) (@hpathLower) (@hpathUpper) (@htail) (@hlen) (@hBT) (@hYlen) + (@hYB) (@hiUpper) (@P) (@alpha) (@hSlen) (@hiEq) (@hXlen) (@hXB) (@hYXlen) (@hjaX) + (@beta) (@yb) (@haFirst) (@hbUnused) (@hjbA) (@ibEq) (@jbEq) (@jaEq) + obtain ⟨_, _, _, _, corr, hmaximum, bs, K, goodK, hsameGood⟩ := + StableChangeCaseThree G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext.proper P.minimumContext.oneEdgeUncolored P.minimumContext.lowerRung + P.minimumContext.fewerDividers P.minimumContext.lexicographicMinimality hprefixP + P.minimumContext.largeMissingSet beta alpha habNe.symm hmissingP _ sigma rfl + (by rw [starEq P]; exact hprecedes) hordered ⟨hbD, hAlphaStored⟩ hunusedBetween + have hbetaTerminal : beta ∈ MissingColors G sigma (T.vertex (Fin.last T.length)) := + (TwoColorComponentSwapMissingBehavior G P.coloring beta alpha habNe.symm + P.minimumContext.proper (Sum.inl (T.vertex (Fin.last T.length)))).2.2.1 _ (by rfl) haTerminal + have hbNew : beta ∈ MissingColors G sigma (B.vertex jb) := by + rw [hmissing _ (vertexMem B jb)] + exact hb + have hnot : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) := by + intro he + exact Finset.disjoint_left.mp (he + (TreeSequenceInitialSegmentVertexSetSubset hBT (vertexMem B jb)) + (vertexMem T (Fin.last T.length)) (terminalNe jb).symm) hbNew hbetaTerminal + let CS : HierarchyCounterexample bs := by + exact @helperCS1504 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@corr) + (@hmaximum) (@bs) (@K) (@goodK) (@hnot) + obtain ⟨S, hS⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi ett base C ctx + P sigma corr bs CS hsameGood + have hm : ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G + P.coloring v := by + rw [hS] + exact hmissing + have ht : beta ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length)) := by + rw [hS] + exact hbetaTerminal + exact ⟨S, beta, ht, finish S hm ht⟩ + +private theorem helper_continuation_3982.{u_1, u_2} : + helperContinuation3982Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper + finiteChoice componentData trans A starEq hAT htail hlen B hBT hAB fullB elementary + vertexMem firstLe firstAt firstFixed stageSwitch gammaTransport gammaUnused notRaw + tailException Extra Gamma gammaSub extraFixed gammaFixed Y hYlen hYT hYB hAY I i hiLower + hiUpper P alpha haPrefix haTerminal hSlen ja ha haOutside haGood hiEq X hXlen hXB hAX hAXlt + hYXlen hjaX D used tnew fresh freshCard usedStep nineY + have choice : ∃ beta : Fin k, + beta ∈ TreeMissingColors P.coloring Y ∧ beta ∉ D ∧ beta ∉ used (j - 1) ∧ + (beta ∉ Gamma P ∪ Extra P ∨ + ∃ eta, eta ∈ D ∧ beta ∈ P.counterexample.good.gamma + (Fin.last P.counterexample.hierarchy.dividerCount) eta ∧ + (HierarchyFirstMissingPosition P.coloring T eta).val ≤ Y.length) := by + apply helper_choice_1225 <;> assumption + obtain ⟨beta, hbY, hbD, hbUsed, hbChoice⟩ := choice + obtain ⟨vbeta, hvbeta, hbeta⟩ := Finset.mem_biUnion.mp hbY + obtain ⟨yb, hyb⟩ : ∃ yb, Y.vertex yb = vbeta := by + simpa [TreeSequenceVertexSet] using hvbeta + let jb : Fin (B.length + 1) := Fin.castLE (Nat.succ_le_succ hYB.1) yb + have hb : beta ∈ MissingColors G P.coloring (B.vertex jb) := by + rw [hYB.2.1 yb, hyb] + exact hbeta + have hjbY : jb.val ≤ Y.length := by have := yb.isLt; dsimp [jb]; omega + have haFirst : (HierarchyFirstMissingPosition P.coloring T alpha).val = X.length := by + rw [firstAt P alpha ja ha, hjaX] + have habNe : alpha ≠ beta := by + exact helper_habNe_1264 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hnonempty) (@j) (@hpathLower) (@hpathUpper) (@htail) (@hlen) (@elementary) (@vertexMem) + (@hYB) (@hiUpper) (@P) (@alpha) (@hSlen) (@ha) (@hYXlen) (@hjaX) (@beta) (@yb) (@hb) (@hjbY) + have hbUnused : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + P.coloring (T.edge t) ≠ some beta := by + intro t hlo hhi hc + exact hbUsed (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, by omega, hc⟩) + have haException : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + P.coloring (T.edge t) = some alpha → + TreeIncidentEdge (P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + alpha ∈ TashkinovStoredColors P.corresponding.replacementETT.series.data + (Fin.last P.corresponding.replacementETT.rounds) := by + intro t hlo hhi hc + exact tailException P i hiLower (by change j < T.length - A.length at hpathUpper; omega) + alpha haPrefix t hlo (by omega) hc + have cutBeta (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hm : ∀ v ∈ TreeSequenceVertexSet B, + MissingColors G R.coloring v = MissingColors G P.coloring v) : + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount), + beta ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta → + (HierarchyFirstMissingPosition R.coloring T eta).val ≤ Y.length := by as_aux_lemma => + clear * - R P beta hm hbChoice Gamma D Y gammaTransport firstFixed + intro eta heta hbe + obtain ⟨heP, hgP⟩ := gammaTransport R P eta heta + have hcP : beta ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta := hgP ▸ hbe + rcases hbChoice with hout | ⟨owner, howner, hbOwner, hcut⟩ + · exact (hout (Finset.mem_union_left _ (Finset.mem_biUnion.mpr ⟨eta, heP, hcP⟩))).elim + · exact helper_branch_1298 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@j) (@hlen) (@firstFixed) (@P) (@beta) (@R) (@hm) (@eta) (@heP) (@hcP) (@owner) + (@howner) (@hbOwner) (@hcut) + have finish (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hm : ∀ v ∈ TreeSequenceVertexSet B, + MissingColors G R.coloring v = MissingColors G P.coloring v) + (hterm : beta ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length))) : + beta ∈ TreeMissingColors R.coloring Y ∧ + (beta ∉ Gamma R ∪ Extra R ∨ + ∃ eta, eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) ∧ + beta ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) + eta ∧ + (HierarchyFirstMissingPosition R.coloring T eta).val ≤ Y.length) := by as_aux_lemma => + clear * - R P beta hm hbY hbChoice Y B hYB Gamma Extra gammaFixed extraFixed gammaTransport + firstFixed + constructor + · obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp hbY + exact Finset.mem_biUnion.mpr ⟨v, hv, by + rw [hm v (TreeSequenceInitialSegmentVertexSetSubset hYB hv)]; exact hc⟩ + · exact helper_branch_1318 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@j) (@hlen) (@firstFixed) (@gammaTransport) (@extraFixed) (@gammaFixed) (@P) (@beta) + (@hbChoice) (@R) (@hm) + have stageInside (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (hcA : c ∈ TreeMissingColors R.coloring A) (hcExtra : c ∉ Extra R) : + c ∈ HierarchyStageMissingColors R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) := by as_aux_lemma => + clear * - R A c hcA hcExtra Extra starEq + let H := R.counterexample.hierarchy + let q := Fin.last H.dividerCount + by_cases hq : H.dividerCount = 0 + · exact helper_branch_1335 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@starEq) (@R) (@c) (@hcA) (@hcExtra) (@hq) + · exact helper_branch_1348 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@starEq) (@R) (@c) (@hcA) (@hq) + by_cases hAlphaStored : alpha ∈ D + · exact @helper_branch_1365 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hnonempty) (@j) + (@hpathLower) (@hpathUpper) (@trans) (@htail) (@hlen) (@hBT) (@vertexMem) (@firstAt) + (@stageSwitch) (@gammaTransport) (@gammaUnused) (@gammaSub) (@hYlen) (@hYB) (@hiUpper) (@P) + (@alpha) (@haPrefix) (@haTerminal) (@hSlen) (@ha) (@haOutside) (@haGood) (@hiEq) (@hXlen) + (@hXB) (@hAX) (@hAXlt) (@hYXlen) (@hjaX) (@beta) (@yb) (@hb) (@hjbY) (@haFirst) (@habNe) + (@hbUnused) (@haException) (@cutBeta) (@finish) (@hAlphaStored) + by_cases hbStage : beta ∈ HierarchyStageMissingColors P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) + · exact @helper_branch_1435 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hnonempty) (@j) + (@hpathLower) (@hpathUpper) (@trans) (@htail) (@hlen) (@hBT) (@stageSwitch) (@gammaSub) + (@hYlen) (@hYB) (@hiUpper) (@P) (@alpha) (@haTerminal) (@hSlen) (@ha) (@haOutside) (@hiEq) + (@hXlen) (@hXB) (@hAX) (@hAXlt) (@hYXlen) (@hjaX) (@beta) (@yb) (@habNe) (@hbUnused) + (@haException) (@cutBeta) (@finish) (@hbStage) + have hbOutsideChoice : beta ∉ Gamma P ∪ Extra P := by + rcases hbChoice with h | ⟨eta, heta, hbe, _⟩ + · exact h + · exact (hbStage (Finset.mem_sdiff.mp (P.counterexample.good.avoidance _ _ heta hbe)).1).elim + have hbOutside : beta ∉ TreeMissingColors P.coloring A := by + intro hc + exact hbStage (stageInside P beta hc (fun he => hbOutsideChoice (Finset.mem_union_right _ he))) + have hjbA : A.length < jb.val := by + exact helper_hjbA_1449 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hnonempty) (@j) (@hpathLower) (@hpathUpper) (@htail) (@hlen) (@hBT) (@hAB) (@vertexMem) + (@hYlen) (@hYB) (@hiUpper) (@P) (@alpha) (@hSlen) (@hiEq) (@hXlen) (@hXB) (@hYXlen) + (@hjaX) (@beta) (@yb) (@hb) (@haFirst) (@hbOutside) + have haRaw := notRaw P alpha haOutside hAlphaStored + have hbRaw := notRaw P beta hbOutside hbD + have ibEq := firstAt P beta jb hb + have iaEq := firstAt P alpha ja ha + have jbEq : Fin.castLE (Nat.succ_le_succ hBT.1) jb = + HierarchyFirstMissingPosition P.coloring T beta := Fin.ext ibEq.symm + have jaEq : Fin.castLE (Nat.succ_le_succ hBT.1) ja = + HierarchyFirstMissingPosition P.coloring T alpha := Fin.ext iaEq.symm + have hordered : TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)) + (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) := by + refine ⟨_, _, rfl, rfl, ?_⟩ + clear * - ibEq iaEq hjaX hjbY hYXlen + omega + have hunused : beta ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < (HierarchyFirstMissingPosition P.coloring T alpha).val ∧ + P.coloring (T.edge t) = some c) := by + intro hh + obtain ⟨_, t, hlo, hhi, hc⟩ := Finset.mem_filter.mp hh + rw [haFirst] at hhi + exact hbUnused t hlo hhi hc + exact @helper_continuation_4396 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hnonempty) + (@j) (@hpathLower) (@hpathUpper) (@componentData) (@trans) (@starEq) (@hAT) (@htail) + (@hlen) (@hBT) (@fullB) (@elementary) (@vertexMem) (@hYlen) (@hYB) (@hiUpper) (@P) (@alpha) + (@haPrefix) (@haTerminal) (@hSlen) (@ha) (@haOutside) (@haGood) (@hiEq) (@hXlen) (@hXB) + (@hYXlen) (@hjaX) (@beta) (@hbY) (@hbD) (@hbUsed) (@hbChoice) (@vbeta) (@hbeta) (@yb) (@hb) + (@haFirst) (@habNe) (@hbUnused) (@haException) (@cutBeta) (@finish) (@hAlphaStored) + (@hbStage) (@hbOutsideChoice) (@hbOutside) (@hjbA) (@haRaw) (@hbRaw) (@ibEq) (@iaEq) + (@jbEq) (@jaEq) (@hordered) (@hunused) +private theorem helper_continuation_3797.{u_1, u_2} : + helperContinuation3797Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hvertexMissing hnonempty j hj hpathLower + hpathUpper finiteChoice componentData trans common A starEq hAT htail hlen B hBT hAB fullEq + fullB elementary vertexMem firstLe firstAt firstFixed stageSwitch gammaTransport + gammaUnused outsideA notRaw tailException coreA + let Extra := fun R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx => + ((TreeSequenceVertexSet R.replacementBase.core \ + TreeSequenceVertexSet (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc)).biUnion + fun v => MissingColors G R.coloring v) + let Gamma := fun R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx => + (HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).biUnion + (R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount)) + have gammaSub (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + Gamma R ⊆ TreeMissingColors R.coloring A := by as_aux_lemma => + intro c hc + obtain ⟨eta, heta, hce⟩ := Finset.mem_biUnion.mp hc + have hm := (GoodHierarchyReservedDisjoint R.counterexample.good + (Fin.last R.counterexample.hierarchy.dividerCount)).1 eta heta hce + rw [starEq R] at hm + exact hm + have extraSub (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + Extra R ⊆ TreeMissingColors R.coloring A := by as_aux_lemma => + intro c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset (coreA R) (Finset.mem_sdiff.mp hv).1, hcv⟩ + have tnEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by as_aux_lemma => + have hs := (Fin.heq_fun_iff + (congrArg (fun q => q + 2) R.sameGood.1.2.1)).mp R.sameGood.1.2.2.1 0 + have hs' : C.hierarchy.stage 0 = R.counterexample.hierarchy.stage 0 := hs + rw [C.hierarchy.baseStage, R.counterexample.hierarchy.baseStage] at hs' + exact hs'.symm + have extraFixed (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hm : ∀ v ∈ TreeSequenceVertexSet B, + MissingColors G S.coloring v = MissingColors G R.coloring v) : Extra S = Extra R := by + as_aux_lemma => + unfold Extra + rw [tnEq R, tnEq S, ← R.sameGood.1.1, ← S.sameGood.1.1] + apply Finset.biUnion_congr rfl + intro v hv + apply hm + have hvR : v ∈ TreeSequenceVertexSet R.replacementBase.core := by + rw [← R.sameGood.1.1] + exact (Finset.mem_sdiff.mp hv).1 + exact TreeSequenceInitialSegmentVertexSetSubset (trans (coreA R) hAB) hvR + have gammaFixed (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + Gamma R = Gamma S := by as_aux_lemma => + ext c + simp only [Gamma, Finset.mem_biUnion] + constructor + · rintro ⟨eta, heta, hc⟩ + obtain ⟨hs, he⟩ := gammaTransport R S eta heta + exact ⟨eta, hs, he ▸ hc⟩ + · rintro ⟨eta, heta, hc⟩ + obtain ⟨hs, he⟩ := gammaTransport S R eta heta + exact ⟨eta, hs, he ▸ hc⟩ + have prefixLen (r : ℕ) (hr : r ≤ T.length - A.length) : + (HierarchyFullTailPrefix C r).length = A.length + r := by as_aux_lemma => + change min (A.length + r) T.length = A.length + r + have := hAT.1 + omega + have prefixT (r : ℕ) : TreeSequenceInitialSegment (HierarchyFullTailPrefix C r) T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + let Y := HierarchyFullTailPrefix C (j - 2) + have hYlen : Y.length = A.length + (j - 2) := prefixLen _ (by + change j < T.length - A.length at hpathUpper + omega) + have hYT : TreeSequenceInitialSegment Y T := prefixT _ + have hYB : TreeSequenceInitialSegment Y B := common hYT hBT (by + have hb : B.length = T.length - 1 := rfl + change j < T.length - A.length at hpathUpper + omega) + have hAY : TreeSequenceInitialSegment A Y := common hAT hYT (by omega) + let I := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + let i := I.max' hnonempty + have hi : i ∈ I := Finset.max'_mem I hnonempty + have hiLower : 1 ≤ i := (Finset.mem_Icc.mp (Finset.mem_filter.mp hi).1).1 + have hiUpper : i < j := by + rw [← hj] + exact HierarchySituationThreeEligibleIndexBound G k e0 input T phi ett base C ctx + (by rw [hj]; exact hpathLower) (by rw [hj]; exact hpathUpper) hvertexMissing i hi + obtain ⟨P, alpha, haPrefix, haTerminal⟩ := (Finset.mem_filter.mp hi).2 + have hSlen : (HierarchyFullTailPrefix C i).length = A.length + i := + prefixLen _ (by change j < T.length - A.length at hpathUpper; omega) + let ja : Fin (B.length + 1) := ⟨A.length + i, by + have hb : B.length = T.length - 1 := rfl + change j < T.length - A.length at hpathUpper + omega⟩ + have ha : alpha ∈ MissingColors G P.coloring (B.vertex ja) := by + exact helper_ha_1142 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hnonempty) (@j) (@hpathLower) (@hpathUpper) (@htail) (@hlen) (@hBT) (@prefixT) + (@hiUpper) (@P) (@alpha) (@haPrefix) (@hSlen) + have haOutside := outsideA P alpha ja (by dsimp [ja]; omega) ha + have haGood : alpha ∉ Gamma P ∪ Extra P := by + intro hc + rcases Finset.mem_union.mp hc with hc | hc + · exact haOutside (gammaSub P hc) + · exact haOutside (extraSub P hc) + by_cases hsmall : i ≤ j - 2 + · exact helper_branch_1158 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hnonempty) (@j) (@hpathLower) (@hpathUpper) (@htail) (@hlen) (@vertexMem) (@hYlen) (@hYB) + (@hiUpper) (@P) (@alpha) (@haTerminal) (@hSlen) (@ha) (@haGood) (@hsmall) + have hiEq : i = j - 1 := by omega + let X := HierarchyFullTailPrefix C (j - 1) + have hXlen : X.length = A.length + (j - 1) := prefixLen _ (by + change j < T.length - A.length at hpathUpper; omega) + have hXT : TreeSequenceInitialSegment X T := prefixT _ + have hXB : TreeSequenceInitialSegment X B := common hXT hBT (by + have hb : B.length = T.length - 1 := rfl + change j < T.length - A.length at hpathUpper; omega) + have hAX : TreeSequenceInitialSegment A X := common hAT hXT (by omega) + have hAXlt : A.length < X.length := by change 2 ≤ j at hpathLower; omega + have hYX : TreeSequenceInitialSegment Y X := common hYT hXT (by omega) + have hYXlen : X.length = Y.length + 1 := by change 2 ≤ j at hpathLower; omega + have hjaX : ja.val = X.length := by dsimp [ja]; omega + let D := HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) + let used := fun r : ℕ => (Finset.univ : Finset (Fin k)).filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ t.val < A.length + r ∧ + P.coloring (T.edge t) = some c + let tnew : Fin T.length := ⟨Y.length, by have := hXB.1; have := hBT.1; omega⟩ + let fresh := (Finset.univ : Finset (Fin k)).filter fun c => P.coloring (T.edge tnew) = some c + have freshCard : fresh.card ≤ 1 := by as_aux_lemma => + apply Finset.card_le_one.mpr + intro c hc d hd + exact Option.some.inj ((Finset.mem_filter.mp hc).2.symm.trans (Finset.mem_filter.mp hd).2) + have usedStep : used (j - 1) ⊆ used (j - 2) ∪ fresh := by as_aux_lemma => + intro c hc + obtain ⟨_, t, hlo, hhi, hcol⟩ := Finset.mem_filter.mp hc + by_cases h : t.val < A.length + (j - 2) + · exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, h, hcol⟩) + · have ht : t = tnew := Fin.ext (by dsimp [tnew]; omega) + exact Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, ht ▸ hcol⟩) + have nine := NineN G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.counterexample.positive P.replacementBase + P.counterexample.hierarchy P.counterexample.good + (by + change ColoredVertexSetElementary G P.coloring (TreeSequenceVertexSet + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1))) + rw [fullB P] + exact elementary P) + P.minimumContext.largeMissingSet + have nineY : + 2 * P.corresponding.replacementETT.rounds + 11 ≤ + ((TreeMissingColors P.coloring Y \ Extra P) \ used (j - 2)).card ∧ + ((((TreeMissingColors P.coloring Y \ Extra P) \ used (j - 2)) \ (Gamma P ∪ D)).card ≤ 4 → + ∃ eta : Fin 7 → Fin k, Function.Injective eta ∧ + ∀ h : Fin 7, eta h ∈ D ∧ eta h ∈ TreeMissingColors P.coloring Y ∧ + Disjoint (P.counterexample.good.gamma + (Fin.last P.counterexample.hierarchy.dividerCount) (eta h) ∪ {eta h}) (used (j - + 2))) := by + have hn := nine (j - 2) (by + rw [starEq P] + change j < T.length - A.length at hpathUpper + omega) + dsimp only at hn + have hy : TreeSequencePrefix T + (min ((HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).length + (j - 2)) T.length) + (by have := (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).positive; have := T.positive; omega) + (Nat.min_le_right _ _) = Y := fullEq P (j - 2) + rw [hy] at hn + simp only [starEq P] at hn + exact hn + exact @helper_continuation_3982 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hnonempty) + (@j) (@hpathLower) (@hpathUpper) (@finiteChoice) (@componentData) (@trans) (@starEq) (@hAT) + (@htail) (@hlen) (@hBT) (@hAB) (@fullB) (@elementary) (@vertexMem) (@firstLe) (@firstAt) + (@firstFixed) (@stageSwitch) (@gammaTransport) (@gammaUnused) (@notRaw) (@tailException) + (@gammaSub) (@extraFixed) (@gammaFixed) (@hYlen) (@hYT) (@hYB) (@hAY) (@hiLower) (@hiUpper) + (@P) (@alpha) (@haPrefix) (@haTerminal) (@hSlen) (@ha) (@haOutside) (@haGood) (@hiEq) + (@hXlen) (@hXB) (@hAX) (@hAXlt) (@hYXlen) (@hjaX) (@freshCard) (@usedStep) (@nineY) +private theorem helper_continuation_3823.{u_1, u_2} : + helperContinuation3823Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hvertexMissing hnonempty j hj hpathLower + hpathUpper finiteChoice componentData trans common A starEq hAT htail hlen B hBT hAB fullEq + fullB elementary vertexMem firstLe firstAt firstFixed stageSwitch + have lastData (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta := + by as_aux_lemma => + clear * - R + obtain ⟨hcount, hdata⟩ := R.sameGood.2 + have hh := hdata (Fin.last C.hierarchy.dividerCount) + have hidx : Fin.cast (congrArg (fun q => q + 1) hcount) + (Fin.last C.hierarchy.dividerCount) = + Fin.last R.counterexample.hierarchy.dividerCount := Fin.ext hcount + simpa only [hidx] using hh + have gammaTransport + (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) : + eta ∈ HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + as_aux_lemma => + clear * - R S eta heta lastData + have hOrig : eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) := by + rw [(lastData R).1]; exact heta + refine ⟨?_, ((lastData R).2 eta hOrig).symm.trans ((lastData S).2 eta hOrig)⟩ + rw [← (lastData S).1] + exact hOrig + have gammaUnused (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (ha : a ∈ R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta) + (t : Fin T.length) (hlo : A.length ≤ t.val) + (hhi : t.val < (HierarchyFirstMissingPosition R.coloring T eta).val) : + R.coloring (T.edge t) ≠ some a := by as_aux_lemma => + clear * - R eta a heta ha t hlo hhi starEq + intro hc + have hnot := (Finset.mem_sdiff.mp (R.counterexample.good.avoidance + (Fin.last R.counterexample.hierarchy.dividerCount) eta heta ha)).2 + apply hnot + unfold HierarchySegmentColors + dsimp only + rw [starEq R, Fin.succ_last, R.counterexample.hierarchy.terminalStage] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, + lt_min hhi t.isLt, hc⟩ + have outsideA (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + 1)) (hj : A.length < j.val) + (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : + c ∉ TreeMissingColors R.coloring A := by as_aux_lemma => + clear * - R c j hj hc hAT hBT hAB elementary vertexMem + rintro hm + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + obtain ⟨a, ha⟩ : ∃ a, A.vertex a = v := by simpa [TreeSequenceVertexSet] using hv + have hne : v ≠ B.vertex j := by + intro he + have hh := T.vertex_injective ((hAT.2.1 a).trans + (ha.trans (he.trans (hBT.2.1 j).symm))) + have hh := congrArg Fin.val hh + have := a.isLt + change a.val = j.val at hh + omega + exact Finset.disjoint_left.mp (elementary R + (TreeSequenceInitialSegmentVertexSetSubset hAB hv) (vertexMem B j) hne) hcv hc + have notRaw (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (hcA : c ∉ TreeMissingColors R.coloring A) + (hcD : c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) : + c ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by as_aux_lemma => + clear * - R c hcA hcD starEq + intro hm + apply hcD + unfold HierarchyStoredColorsAt + dsimp only + rw [starEq R] + exact Finset.mem_sdiff.mpr ⟨hm, hcA⟩ + have tailException (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (j : ℕ) (hj : 1 ≤ j) (hjlt : j < T.length - A.length) + (c : Fin k) + (hc : c ∈ MissingColors G R.coloring + ((HierarchyFullTailPrefix C j).vertex (Fin.last (HierarchyFullTailPrefix C j).length))) + (t : Fin T.length) (hlo : A.length ≤ t.val) (hhi : t.val < A.length + j) + (hcol : R.coloring (T.edge t) = some c) : + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + c ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by as_aux_lemma => + clear * - R j hj hjlt c hc t hlo hhi hcol starEq hAT hBT fullEq fullB elementary vertexMem + let U := HierarchyFullTailPrefix R.counterexample j + have hUlen : U.length = A.length + j := by + simp only [U, HierarchyFullTailPrefix, TreeSequencePrefix] + rw [starEq R] + exact min_eq_left (by have := hAT.1; omega) + have hUT : TreeSequenceInitialSegment U T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + let u : Fin U.length := ⟨t.val, by rw [hUlen]; omega⟩ + have hut : Fin.castLE hUT.1 u = t := Fin.ext rfl + have hcU : c ∈ MissingColors G R.coloring (U.vertex (Fin.last U.length)) := by + dsimp only [U] + rw [fullEq R] + exact hc + have hcolU : R.coloring (U.edge u) = some c := by + rw [← hUT.2.2 u, hut]; exact hcol + have hex := HierarchyTailMissingColorExclusion G k e0 R.corresponding.replacementInput T + R.coloring R.corresponding.replacementETT R.replacementBase R.counterexample.hierarchy + (by + change ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1))) + rw [fullB R] + exact elementary R) + j hj (by + rw [starEq R] + exact hjlt) c hcU u + (by + change (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length ≤ t.val + rw [starEq R] + exact hlo) + (by + change t.val < (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + j + rw [starEq R] + exact hhi) hcolU + obtain ⟨hzero, hcore, hval, f, hstep, hkind, hedges, hedge, hcF, hstored⟩ := hex + have hAval : t.val = A.length := by + change u.val = _ at hval + rw [starEq R] at hval + exact hval + have hAn : A = R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc := by + exact helper_hAn_999 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@starEq) (@R) (@hzero) (@hcore) + obtain ⟨i, hi⟩ := T.attaches t + let a : Fin (A.length + 1) := ⟨i.val, by simpa only [hAval] using i.isLt⟩ + let old : Fin (T.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ t.isLt)) + have ha : Fin.castLE (Nat.succ_le_succ hAT.1) a = old := Fin.ext rfl + refine ⟨⟨T.vertex old, ?_, ?_⟩, hstored⟩ + · rw [← hAn, ← ha, hAT.2.1 a] + exact vertexMem A a + · rw [Incident, hi] + exact Sym2.mem_mk_right _ _ + have coreA (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + TreeSequenceInitialSegment R.replacementBase.core A := by as_aux_lemma => + clear * - R A starEq trans + let H := R.counterexample.hierarchy + have chain : ∀ (j : ℕ) (hj : j < H.dividerCount + 2) + (i : Fin (H.dividerCount + 2)), i.val ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage ⟨j, hj⟩) := by + apply helper_chain_1020; assumption + rw [← starEq R] + by_cases hq : H.dividerCount = 0 + · have he : HierarchyStarredStage H (Fin.last H.dividerCount) = R.replacementBase.core := by + simp [HierarchyStarredStage, hq, Fin.last] + rw [he] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · apply helper_branch_1043 <;> assumption + apply helper_continuation_3797 <;> assumption +private theorem helper_caseContinuation_5383.{u_1, u_2} : + helperCaseContinuation5383Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans common A starEq hlen B hBT hAB + fullB vertexMem firstFixed R X hAX hAXlt hXB a b hne jb hjbX hb hw haUnused hbException + gammaCut H q n Tn Dn hTnA stageCase hbB haB iaLe ibEq ja jaEq jbEq haFirstB hprefixR + hmissingR change hdis hpath hmissing sigma hsone + have hcase : + (0 < H.dividerCount ∧ a ∈ TreeMissingColors R.coloring (H.stage ⟨H.dividerCount, by + omega⟩)) ∨ + (H.dividerCount = 0 ∧ (a ∈ TreeMissingColors R.coloring Tn ∨ + (a ∈ TreeMissingColors R.coloring (HierarchyStarredStage H q) ∧ a ∉ Dn ∧ b ∉ Dn))) := by + rcases stageCase with h | ⟨hq, hm⟩ + · exact Or.inl h + · exact Or.inr ⟨hq, Or.inl hm⟩ + have hdisFirst : Disjoint (TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length)))) + (TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (HierarchyFirstMissingPosition R.coloring T a)))) := by + rw [← jaEq, hBT.2.1 ja] + exact hdis + have changed := StableChangeCasesOneTwo G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + hprefixR + R.minimumContext.largeMissingSet a b hne + hmissingR + _ hpath sigma rfl hcase hdisFirst + have hweak : HierarchyWeaklyStable H q sigma := changed.1 + have baseStable : if R.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.PE then + CombinedStableColoring Tn R.replacementBase.closure Dn R.coloring sigma + else StableColoring Tn Dn R.coloring sigma := by + exact helper_baseStable_716 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@j) (@R) (@a) (@b) (@hweak) + have stable : StableColoring Tn Dn R.coloring sigma := by + by_cases hp : R.corresponding.replacementETT.series.data.kind n = some + TashkinovExtensionKind.PE + · exact (ite_eq_left hp ▸ baseStable).1 + · simpa only [hp, ite_false] using baseStable + have fixedA : ∀ t : Fin A.length, sigma (A.edge t) = R.coloring (A.edge t) := by + exact helper_fixedA_730 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@j) (@starEq) (@hlen) (@hBT) (@hAB) (@R) (@X) (@a) (@b) (@jb) (@iaLe) (@change) + (@hsone) (@hweak) (@baseStable) + have fixedPrefix : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + sigma (T.edge t) = R.coloring (T.edge t) := by + exact helper_fixedPrefix_750 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@R) (@X) (@a) (@b) (@haUnused) (@hbException) (@stable) + have hXT := trans hXB hBT + let XM := TreeSequencePrefix X (X.length - 1) (by have := A.positive; omega) (by omega) + have hXMX : TreeSequenceInitialSegment XM X := + ⟨by dsimp [XM, TreeSequencePrefix]; omega, fun _ => rfl, fun _ => rfl⟩ + have prefixFixed (t : Fin X.length) (ht : Tn.length ≤ t.val) : + sigma (X.edge t) = R.coloring (X.edge t) := by + exact helper_prefixFixed_762 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@j) (@hlen) (@hBT) (@hAB) (@R) (@X) (@hAX) (@a) (@b) (@jb) (@iaLe) (@change) + (@fixedA) (@fixedPrefix) (@hXT) (@t) + have routes : + ((R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X) ∨ + ((R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, R.corresponding.replacementETT.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X)) ∧ + TashkinovAugmentationSequence R.coloring X T := by + apply helper_routes_771 <;> assumption + have hsplit : a ∈ TreeMissingColors sigma X ∧ b ∈ TreeMissingColors sigma X := by + exact helper_hsplit_801 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@j) (@hlen) (@hBT) (@hAB) (@vertexMem) (@R) (@X) (@hAXlt) (@hXB) (@a) (@b) (@jb) + (@hjbX) (@hb) (@iaLe) (@jaEq) (@haFirstB) (@hmissing) + obtain ⟨_, _, corr, hmaximum, bs, K, goodK, hsameGood⟩ := + StableChangeCasesOneTwoSplitTail G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase R.counterexample R.minimumContext + a b hne (by rw [fullB R]; exact ⟨haB, hbB⟩) + _ hpath sigma rfl hcase hdisFirst X (by dsimp only; rw [starEq R]; exact hAX) + (by dsimp only; rw [starEq R]; exact hAXlt) (by rw [fullB R]; exact hXB) + (by dsimp only; rw [starEq R]; exact fixedPrefix) routes.1 routes.2 hsplit + (by rw [fullB R]; exact hmissing) + (fun c _ => firstFixed R.coloring sigma hmissing c) gammaCut + have terminal := TwoColorComponentSwapMissingBehavior G R.coloring a b hne + R.minimumContext.proper (Sum.inl (T.vertex (Fin.last T.length))) + have hterminalA : a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G sigma (T.vertex (Fin.last T.length)) := + terminal.2.1 _ (by rfl) + have hterminalB : b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + a ∈ MissingColors G sigma (T.vertex (Fin.last T.length)) := + terminal.2.2.1 _ (by rfl) + have hnotElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) := by + apply helper_hnotElementary_829 <;> assumption + let CS : HierarchyCounterexample bs := by + exact @helperCS778 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@R) (@a) (@b) (@corr) + (@hmaximum) (@bs) (@K) (@goodK) (@hnotElementary) + obtain ⟨S, hS⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi ett base C ctx + R sigma corr bs CS hsameGood + refine ⟨S, ?_, ?_, ?_, ?_⟩ <;> rw [hS] + · exact hmissing + · exact fixedPrefix + · exact hterminalA + · exact hterminalB + +private theorem helper_continuation_3692.{u_1, u_2} : + helperContinuation3692Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hvertexMissing hnonempty j hj hpathLower + hpathUpper finiteChoice componentData trans common A starEq hAT htail hlen B hBT hAB fullEq + fullB elementary vertexMem firstLe firstMem firstAt firstFixed + have stageSwitch (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (X : TreeSequence G e0) (hAX : TreeSequenceInitialSegment A X) + (hAXlt : A.length < X.length) (hXB : TreeSequenceInitialSegment X B) + (a b : Fin k) (hne : a ≠ b) + (haStage : a ∈ HierarchyStageMissingColors R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (jb : Fin (B.length + 1)) + (hjbX : jb.val ≤ X.length) + (hb : b ∈ MissingColors G R.coloring (B.vertex jb)) + (hw : a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) ∨ + b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length))) + (haUnused : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) ≠ some a) + (hbException : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + b ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) + (gammaCut : ∀ eta, eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → + (a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta ∨ + b ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) → + (HierarchyFirstMissingPosition R.coloring T eta).val ≤ X.length) : + ∃ S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + (∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + S.coloring (T.edge t) = R.coloring (T.edge t)) ∧ + (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ + (b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + a ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) := by as_aux_lemma => + clear * - G T A B R X hAX hAXlt hXB a b hne haStage jb hjbX hb hw + haUnused hbException gammaCut trans common starEq hAT hAB hBT elementary vertexMem firstLe + firstMem firstAt firstFixed componentData fullB + let H := R.counterexample.hierarchy + let q := Fin.last H.dividerCount + let n := Fin.last R.corresponding.replacementETT.rounds + let Tn := R.corresponding.replacementETT.series.data.tree n.castSucc + let Dn := TashkinovStoredColors R.corresponding.replacementETT.series.data n + have chain : ∀ (j : ℕ) (hj : j < H.dividerCount + 2) + (i : Fin (H.dividerCount + 2)), i.val ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage ⟨j, hj⟩) := by + apply helper_chain_511 <;> assumption + have lastPositive (hq : H.dividerCount ≠ 0) : + HierarchyStarredStage H q = H.stage ⟨H.dividerCount, by omega⟩ := by + exact helper_lastPositive_528 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@j) (@hlen) (@R) (@X) (@jb) (@hq) + have hTnCore : TreeSequenceInitialSegment Tn R.replacementBase.core := by + exact helper_hTnCore_537 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@R) + have coreA : TreeSequenceInitialSegment R.replacementBase.core A := by + apply helper_coreA_543 <;> assumption + have hTnA := trans hTnCore coreA + have stageCase : + (0 < H.dividerCount ∧ a ∈ TreeMissingColors R.coloring + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ a ∈ TreeMissingColors R.coloring Tn) := by + exact helper_stageCase_554 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@j) (@hlen) (@R) (@X) (@a) (@haStage) (@jb) + have haA : a ∈ TreeMissingColors R.coloring A := by + exact helper_haA_574 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@j) + (@starEq) (@hlen) (@R) (@X) (@a) (@jb) (@lastPositive) (@hTnA) (@stageCase) + have hbB : b ∈ TreeMissingColors R.coloring B := + Finset.mem_biUnion.mpr ⟨B.vertex jb, vertexMem B jb, hb⟩ + have haB : a ∈ TreeMissingColors R.coloring B := by + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp haA + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hAB hv, hc⟩ + have iaLe : (HierarchyFirstMissingPosition R.coloring T a).val ≤ A.length := by + exact helper_iaLe_586 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@j) + (@hAT) (@hlen) (@firstLe) (@R) (@X) (@a) (@jb) (@haA) + have ibEq := firstAt R b jb hb + have haFirst := firstMem R.coloring a (by + have := hAB.1 + have hblen : B.length = T.length - 1 := rfl + omega) + let ja : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T a).val, + by have := hAB.1; omega⟩ + have jaEq : Fin.castLE (Nat.succ_le_succ hBT.1) ja = + HierarchyFirstMissingPosition R.coloring T a := Fin.ext rfl + have jbEq : Fin.castLE (Nat.succ_le_succ hBT.1) jb = + HierarchyFirstMissingPosition R.coloring T b := Fin.ext ibEq.symm + have haFirstB : a ∈ MissingColors G R.coloring (B.vertex ja) := by + rw [← hBT.2.1 ja, jaEq]; exact haFirst + have hunused : a ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < (HierarchyFirstMissingPosition R.coloring T b).val ∧ + R.coloring (T.edge t) = some c) := by + intro hh + obtain ⟨_, t, hlo, hhi, hc⟩ := Finset.mem_filter.mp hh + exact haUnused t hlo (by omega) hc + have hprefixR : ColoredVertexSetElementary G R.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := by + rw [fullB R] + exact elementary R + have hmissingR : a ∈ TreeMissingColors R.coloring + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1)) ∧ + b ∈ TreeMissingColors R.coloring + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1)) + := by + rw [fullB R] + exact ⟨haB, hbB⟩ + have change := ChangeLemma G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + hprefixR + R.minimumContext.largeMissingSet a b hne + hmissingR + (by + dsimp only + rw [starEq R] + intro hout + have hbOut : b ∉ TreeMissingColors R.coloring A := by + rcases hout with h | h + · exact (h haA).elim + · exact h + have hjb : A.length < jb.val := by + exact helper_hjb_641 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@j) (@hlen) (@hBT) (@hAB) (@vertexMem) (@R) (@X) (@a) (@b) (@jb) (@hb) (@iaLe) + (@ibEq) (@jbEq) (@hbOut) + exact ⟨⟨_, _, rfl, rfl, by omega⟩, hunused⟩) + have hsame : TwoColorComponent G R.coloring a b (Sum.inl (B.vertex ja)) = + TwoColorComponent G R.coloring a b (Sum.inl (B.vertex jb)) := by + exact helper_hsame_650 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@j) + (@hlen) (@hBT) (@hAB) (@R) (@X) (@a) (@b) (@jb) (@stageCase) (@iaLe) (@jaEq) (@jbEq) + (@change) + obtain ⟨hdis, hpath, hmissing⟩ := componentData R.coloring a b hne + R.minimumContext.proper (TreeSequenceVertexSet B) (elementary R) + (B.vertex ja) (B.vertex jb) (T.vertex (Fin.last T.length)) + (vertexMem B ja) (vertexMem B jb) + (by intro hh; have hh := T.vertex_injective (hh.trans (hBT.2.1 ja).symm) + have hh := congrArg Fin.val hh + change T.length = ja.val at hh + have := ja.isLt + have hblen : B.length = T.length - 1 := rfl + omega) + (by intro hh; have hh := T.vertex_injective (hh.trans (hBT.2.1 jb).symm) + have hh := congrArg Fin.val hh + change T.length = jb.val at hh + have := jb.isLt + have hblen : B.length = T.length - 1 := rfl + omega) + haFirstB hb hw hsame + let sigma := TwoColorComponentSwap G R.coloring a b (Sum.inl (T.vertex (Fin.last T.length))) + have hsproper : IsProperEdgeColoring G sigma := + TwoColorComponentSwapProper G R.coloring a b hne R.minimumContext.proper _ + have hsone : IsOneEdgeUncolored sigma e0 := by + exact helper_hsone_681 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@R) + (@a) (@b) (@hne) + exact @helper_caseContinuation_5383 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@j) + (@trans) (@common) (@starEq) (@hlen) (@hBT) (@hAB) (@fullB) (@vertexMem) (@firstFixed) + (@R) (@X) (@hAX) (@hAXlt) (@hXB) (@a) (@b) (@hne) (@jb) (@hjbX) (@hb) (@hw) (@haUnused) + (@hbException) (@gammaCut) (@hTnA) (@stageCase) (@hbB) (@haB) (@iaLe) (@ibEq) (@jaEq) + (@jbEq) (@haFirstB) (@hprefixR) (@hmissingR) (@change) (@hdis) (@hpath) (@hmissing) (@hsone) + apply helper_continuation_3823 <;> assumption +theorem HierarchySituationThreeClaimJMinusOneNonempty {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hpathLower : 2 ≤ HierarchyPathNumber C.hierarchy) + (hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) + (hnonempty : (HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx).Nonempty) : + ∃ P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx, + ∃ alpha : Fin k, + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let B := HierarchyFullTailPrefix C + (HierarchyPathNumber C.hierarchy - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length)) ∧ + alpha ∈ TreeMissingColors P.coloring B ∧ + (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta : Fin k, eta ∈ D ∧ + alpha ∈ P.counterexample.good.gamma q eta ∧ + (HierarchyFirstMissingPosition P.coloring T eta).val ≤ + B.length) := by + classical + generalize hj : HierarchyPathNumber C.hierarchy = j at hpathLower hpathUpper ⊢ + have finiteChoice (M F D U W N : Finset (Fin k)) (g : Fin k → Finset (Fin k)) + (hstep : W ⊆ U ∪ N) (hncard : N.card ≤ 1) + (hgM : ∀ eta ∈ D, g eta ⊆ M) + (hgcard : ∀ eta ∈ D, (g eta).card = 2) + (hgdis : ∀ eta ∈ D, ∀ theta ∈ D, eta ≠ theta → Disjoint (g eta) (g theta)) + (hgd : Disjoint (D.biUnion g) D) + (hnine : (((M \ F) \ U) \ (D.biUnion g ∪ D)).card ≤ 4 → + ∃ eta : Fin 7 → Fin k, Function.Injective eta ∧ + ∀ h, eta h ∈ D ∧ eta h ∈ M ∧ Disjoint (g (eta h) ∪ {eta h}) U) : + ∃ beta, beta ∈ M ∧ beta ∉ D ∧ beta ∉ W ∧ + (beta ∉ D.biUnion g ∪ F ∨ + ∃ eta, eta ∈ D ∧ beta ∈ g eta ∧ eta ∈ M) := by as_aux_lemma => + clear * - M F D U W N g hstep hncard hgM hgcard hgdis hgd hnine + let free := ((M \ F) \ U) \ (D.biUnion g ∪ D) + by_cases hlarge : 5 ≤ free.card + · apply helper_branch_237 <;> assumption + · apply helper_branch_256 <;> assumption + have componentData := P2905_T2_ElementaryTerminalComponent (k := k) G + have trans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by as_aux_lemma => + clear * - hXY hYZ + refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + have common {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by as_aux_lemma => + clear * - hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + have sameLast : + ∀ {a b : ℕ} (s : Fin (a + 2) → TreeSequence G e0) (t : Fin (b + 2) → TreeSequence G e0) (u v : + TreeSequence G e0), a = b → HEq s t → u = v → Fin.cases (motive := fun _ => TreeSequence G + e0) u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = Fin.cases (motive := fun _ => + TreeSequence G e0) v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by as_aux_lemma => + clear * - + intro a b s t u v hab hst huv + cases hab + have he : s = t := eq_of_heq hst + cases he + cases huv + rfl + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + have starEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = A := + (sameLast _ _ _ _ R.sameGood.1.2.1 R.sameGood.1.2.2.1 R.sameGood.1.1).symm + have hAT : TreeSequenceInitialSegment A T := by + exact helper_hAT_338 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@j) + have htail : 3 ≤ T.length - A.length := by + change j < T.length - A.length at hpathUpper + omega + have hlen : 4 ≤ T.length := by have := A.positive; omega + let B := TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + have hBT : TreeSequenceInitialSegment B T := ⟨by dsimp [B, TreeSequencePrefix]; omega, + fun _ => rfl, fun _ => rfl⟩ + have hAB : TreeSequenceInitialSegment A B := + common hAT hBT (by dsimp [B, TreeSequencePrefix]; omega) + have fullEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (j : ℕ) : HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j := by + unfold HierarchyFullTailPrefix + dsimp only + simp only [starEq R] + rfl + have fullB (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1) = B := by + exact helper_fullB_360 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@j) + (@starEq) (@htail) (@hlen) (@R) + have elementary (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by + exact helper_elementary_372 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@j) (@hlen) (@fullB) (@R) + have vertexMem (U : TreeSequence G e0) (j : Fin (U.length + 1)) : + U.vertex j ∈ TreeSequenceVertexSet U := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) + (j : Fin (T.length + 1)) (hj : c ∈ MissingColors G psi (T.vertex j)) : + HierarchyFirstMissingPosition psi T c ≤ j := by as_aux_lemma => + clear * - G T psi c j hj + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ + have hn : candidates.Nonempty := ⟨j, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates j hm + have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + as_aux_lemma => + clear * - G T psi c hlt + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · exact helper_branch_410 (@G) (@k) (@e0) (@T) (@psi) (@c) (@hlt) (@hn) + have firstAt (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + 1)) + (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : + (HierarchyFirstMissingPosition R.coloring T c).val = j.val := by as_aux_lemma => + clear * - G T B R c j hc elementary vertexMem firstLe firstMem hBT + have hcT : c ∈ MissingColors G R.coloring + (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) j)) := by + rw [hBT.2.1 j]; exact hc + have hle := firstLe R.coloring c _ hcT + have hlt : (HierarchyFirstMissingPosition R.coloring T c).val < T.length := by + have := j.isLt + change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle + have hblen : B.length = T.length - 1 := rfl + omega + let x : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T c).val, by + change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle + omega⟩ + have hxT : Fin.castLE (Nat.succ_le_succ hBT.1) x = + HierarchyFirstMissingPosition R.coloring T c := Fin.ext rfl + have hcx : c ∈ MissingColors G R.coloring (B.vertex x) := by + rw [← hBT.2.1 x, hxT] + exact firstMem R.coloring c hlt + have he : B.vertex x = B.vertex j := by + by_contra hn + exact Finset.disjoint_left.mp (elementary R (vertexMem B x) (vertexMem B j) hn) hcx hc + exact congrArg Fin.val (B.vertex_injective he) + have firstFixed (psi tau : PartialEdgeColoring E k) + (hmissing : ∀ v ∈ TreeSequenceVertexSet B, + MissingColors G tau v = MissingColors G psi v) (c : Fin k) : + HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c := by + as_aux_lemma => + clear * - G T B psi tau hmissing c firstLe firstMem hBT vertexMem + have early (j : Fin (T.length + 1)) (hj : j.val < T.length) : + MissingColors G tau (T.vertex j) = MissingColors G psi (T.vertex j) := by + let x : Fin (B.length + 1) := ⟨j.val, by dsimp [B, TreeSequencePrefix]; omega⟩ + have hx : Fin.castLE (Nat.succ_le_succ hBT.1) x = j := Fin.ext rfl + rw [← hx, hBT.2.1 x] + exact hmissing _ (vertexMem B x) + apply Fin.ext + apply Nat.le_antisymm + · exact helper_branch_454 (@G) (@k) (@e0) (@T) (@firstLe) (@firstMem) (@psi) (@tau) (@c) + (@early) + · exact helper_branch_462 (@G) (@k) (@e0) (@T) (@firstLe) (@firstMem) (@psi) (@tau) (@c) + (@early) + exact helper_continuation_3692 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hvertexMissing) (@hnonempty) (@j) (@hj) (@hpathLower) (@hpathUpper) (@finiteChoice) + (@componentData) (@trans) (@common) (@starEq) (@hAT) (@htail) (@hlen) (@hBT) (@hAB) + (@fullEq) (@fullB) (@elementary) (@vertexMem) (@firstLe) (@firstMem) (@firstAt) (@firstFixed) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeColorChoice.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeColorChoice.lean new file mode 100644 index 0000000000..085bd70484 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeColorChoice.lean @@ -0,0 +1,465 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.NineN +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +/-! +# Hierarchy Situation Three Color Choice + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hpen_130.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G P.coloring (TreeSequenceVertexSet (HierarchyFullTailPrefix + P.counterexample (HierarchyFullTailLength P.counterexample - (1 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P + exact HierarchyCounterexamplePenultimateElementary + G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext.proper P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality P.minimumContext.largeMissingSet + +private theorem helper_hnine_179.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let i : ℕ := j - (2 : ℕ); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C i; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let M : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; + let U : ℕ → Finset (Fin k) := fun (s : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + s ∧ P.coloring (T.edge r) = + some c} : Finset (Fin k)); ColoredVertexSetElementary G P.coloring (TreeSequenceVertexSet + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 : + ℕ)))) → + let Ty : ℕ → TreeSequence G e0 := fun (s : ℕ) ↦ TreeSequencePrefix T (min (A.length + s) + T.length) ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + s) T.length) ↦ + by + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ); B = Ty i → i < T.length - A.length → + let X : Finset (Fin k) := (TreeMissingColors P.coloring B \ M) \ U i; (X \ (Gamma ∪ D)).card ≤ + (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ TreeMissingColors P.coloring B ∧ Disjoint + (P.counterexample.good.gamma q (eta h) ∪ ({eta h} : Finset (Fin k))) (U i) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A j i B D Gamma n Tn M U hpen Ty hB hi X + dsimp only [X] + rw [hB] + exact (NineN G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.counterexample.positive + P.replacementBase H P.counterexample.good hpen + P.minimumContext.largeMissingSet i hi).2 + +private theorem helper_hRcard_191.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let i : ℕ := j - (2 : ℕ); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C i; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (P.counterexample.good.gamma q); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let M : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; + let U : ℕ → Finset (Fin k) := fun (s : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + s ∧ P.coloring (T.edge r) = + some c} : Finset (Fin k)); j = i + (2 : ℕ) → j < T.length - A.length → + let X : Finset (Fin k) := (TreeMissingColors P.coloring B \ M) \ U i; ((X \ (Gamma ∪ D)).card + ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ TreeMissingColors P.coloring B ∧ Disjoint + (P.counterexample.good.gamma q (eta h) ∪ ({eta h} : Finset (Fin k))) (U i)) → + let R : Finset (Fin k) := U j \ U i; R.card ≤ (2 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A j i B D Gamma n Tn M U hji hj X + hnine R + let r0 : Fin T.length := ⟨A.length + i, by omega⟩ + let r1 : Fin T.length := ⟨A.length + i + 1, by omega⟩ + have hsub : R.image some ⊆ + ({r0, r1} : Finset (Fin T.length)).image + (fun r => P.coloring (T.edge r)) := by + intro oc hoc + obtain ⟨c, hc, rfl⟩ := Finset.mem_image.mp hoc + obtain ⟨hcj, hci⟩ := Finset.mem_sdiff.mp hc + obtain ⟨r, hrA, hrj, hrc⟩ := (Finset.mem_filter.mp hcj).2 + have hri : A.length + i <= r.val := by + by_contra hlt + apply hci + exact Finset.mem_filter.mpr + ⟨Finset.mem_univ _, r, hrA, by omega, hrc⟩ + have hr : r = r0 ∨ r = r1 := by + have hv : r.val = A.length + i ∨ r.val = A.length + i + 1 := by omega + rcases hv with hv | hv + · left; apply Fin.ext; exact hv + · right; apply Fin.ext; exact hv + apply Finset.mem_image.mpr + refine ⟨r, ?_, hrc⟩ + simpa only [Finset.mem_insert, Finset.mem_singleton] using hr + have hcard := Finset.card_le_card hsub + rw [Finset.card_image_of_injective R + (by intro a b hab; exact Option.some.inj hab)] at hcard + have hpair : ({r0, r1} : Finset (Fin T.length)).card <= 2 := by + exact (Finset.card_insert_le _ _).trans (by simp) + exact hcard.trans (Finset.card_image_le.trans hpair) + +private theorem helper_chooseColor_220.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let i : ℕ := j - (2 : ℕ); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C i; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let M_1 : Finset (Fin k) := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G P.coloring v; + let U : ℕ → Finset (Fin k) := fun (s : ℕ) ↦ ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + s ∧ P.coloring (T.edge r) = + some c} : Finset (Fin k)); + let _ : Finset (Fin k) := (TreeMissingColors P.coloring B \ M_1) \ U i; + let _ : Finset (Fin k) := U j \ U i; + ∀ (S M D Gamma : Finset (Fin k)) (gamma : Fin k → Finset (Fin k)) (Ui Uj : Finset (Fin k)), + (Uj \ Ui).card ≤ (2 : ℕ) → Disjoint Gamma D → ( + ∀ eta ∈ D, gamma eta ⊆ Gamma) → ( + ∀ (eta theta : Fin k), eta ∈ D → theta ∈ D → eta ≠ theta → Disjoint (gamma eta) (gamma theta)) + → ((((S \ M) \ Ui) \ (Gamma ∪ D)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ S ∧ Disjoint (gamma (eta h) ∪ ({eta h} : Finset (Fin + k))) Ui) → + ∃ (beta : Fin k), beta ≠ alpha ∧ beta ∈ S ∧ beta ∉ Gamma ∧ beta ∉ Uj ∧ (beta ∉ M ∪ D ∨ beta ∈ + D ∧ Disjoint (gamma beta ∪ ({ beta } : Finset (Fin k))) Uj) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha H q A j i B n Tn _ U X R S M D + Gamma gamma Ui Uj hRcard hGD hgamma hpairs hnine + let R := Uj \ Ui + let X := (S \ M) \ Ui + change R.card <= 2 at hRcard + let F := R ∪ {alpha} + have hFcard : F.card <= 3 := by + have hc := Finset.card_union_le R {alpha} + simp only [Finset.card_singleton] at hc + dsimp [F] + omega + have notUsed {c : Fin k} (hci : c ∉ Ui) (hcR : c ∉ R) : c ∉ Uj := by + intro hcj + exact hcR (Finset.mem_sdiff.mpr ⟨hcj, hci⟩) + by_cases hsmall : (X \ (Gamma ∪ D)).card <= 4 + · obtain ⟨eta, hinj, heta⟩ := hnine hsmall + let Q := fun h : Fin 7 => gamma (eta h) ∪ {eta h} + have hQdisjoint : ∀ a b : Fin 7, a ≠ b → Disjoint (Q a) (Q b) := by + intro a b hab + have hne : eta a ≠ eta b := fun he => hab (hinj he) + have hp := hpairs (eta a) (eta b) + (heta a).1 (heta b).1 hne + rw [Finset.disjoint_left] + intro c hca hcb + rcases Finset.mem_union.mp hca with hca | hca <;> + rcases Finset.mem_union.mp hcb with hcb | hcb + · exact Finset.disjoint_left.mp hp hca hcb + · exact Finset.disjoint_left.mp hGD (hgamma (eta a) (heta a).1 hca) + (by simpa only [Finset.mem_singleton.mp hcb] using (heta b).1) + · exact Finset.disjoint_left.mp hGD (hgamma (eta b) (heta b).1 hcb) + (by simpa only [Finset.mem_singleton.mp hca] using (heta a).1) + · exact hne ((Finset.mem_singleton.mp hca).symm.trans + (Finset.mem_singleton.mp hcb)) + let bad := (Finset.univ : Finset (Fin 7)).filter fun h => + exists c : Fin k, c ∈ Q h ∧ c ∈ F + have badWitness (h : bad) : exists c : Fin k, c ∈ Q h.val ∧ c ∈ F := + (Finset.mem_filter.mp h.property).2 + let f : bad → F := fun h => + ⟨Classical.choose (badWitness h), (Classical.choose_spec (badWitness h)).2⟩ + have hf (h : bad) : (f h).val ∈ Q h.val := + (Classical.choose_spec (badWitness h)).1 + have hfinj : Function.Injective f := by + intro a b hab + apply Subtype.ext + by_contra hne + have hfb := hf b + rw [← congrArg Subtype.val hab] at hfb + exact Finset.disjoint_left.mp (hQdisjoint a.val b.val hne) (hf a) hfb + have hbadcard : bad.card <= 3 := + (Finset.card_le_card_of_injective hfinj).trans hFcard + have hnot : ¬ (Finset.univ : Finset (Fin 7)) ⊆ bad := by + intro hs + have hc := Finset.card_le_card hs + simp only [Finset.card_univ, Fintype.card_fin] at hc + omega + obtain ⟨h, _, hh⟩ := Finset.not_subset.mp hnot + have hQF : Disjoint (Q h) F := by + rw [Finset.disjoint_left] + intro c hc hF + apply hh + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, c, hc, hF⟩ + have hself : eta h ∈ Q h := Finset.mem_union_right _ (Finset.mem_singleton_self _) + have halpha' : eta h ≠ alpha := by + intro he + apply Finset.disjoint_left.mp hQF hself + exact Finset.mem_union_right _ (Finset.mem_singleton.mpr he) + have hQU : Disjoint (Q h) (Uj) := by + rw [Finset.disjoint_left] + intro c hc hcj + have hci : c ∉ Ui := fun hu => Finset.disjoint_left.mp (heta h).2.2 hc hu + have hcR : c ∉ R := fun hr => + Finset.disjoint_left.mp hQF hc (Finset.mem_union_left _ hr) + exact notUsed hci hcR hcj + refine ⟨eta h, halpha', (heta h).2.1, ?_, ?_, Or.inr ⟨(heta h).1, hQU⟩⟩ + · intro hc + exact Finset.disjoint_left.mp hGD hc (heta h).1 + · intro hc + exact Finset.disjoint_left.mp hQU hself hc + · have hnot : ¬ X \ (Gamma ∪ D) ⊆ F := by + intro hs + have hc := Finset.card_le_card hs + omega + obtain ⟨beta, hb, hF⟩ := Finset.not_subset.mp hnot + obtain ⟨hx, hGD⟩ := Finset.mem_sdiff.mp hb + obtain ⟨hBM, hUi⟩ := Finset.mem_sdiff.mp hx + obtain ⟨hBmissing, hM⟩ := Finset.mem_sdiff.mp hBM + have hGamma : beta ∉ Gamma := fun hc => hGD (Finset.mem_union_left _ hc) + have hD : beta ∉ D := fun hc => hGD (Finset.mem_union_right _ hc) + have hR : beta ∉ R := fun hc => hF (Finset.mem_union_left _ hc) + have hne : beta ≠ alpha := by + intro he + exact hF (Finset.mem_union_right _ (Finset.mem_singleton.mpr he)) + refine ⟨beta, hne, hBmissing, hGamma, notUsed hUi hR, Or.inl ?_⟩ + intro hc + rcases Finset.mem_union.mp hc with hc | hc + · exact hM hc + · exact hD hc + +theorem HierarchySituationThreeColorChoice + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha : Fin k) + (hpathLower : 2 <= HierarchyPathNumber C.hierarchy) + (hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (_ : + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let j := HierarchyPathNumber C.hierarchy + let B := HierarchyFullTailPrefix C (j - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length)) /\ + alpha ∈ TreeMissingColors P.coloring B /\ + (alpha ∉ Gamma ∪ baseExtraMissing ∨ + exists eta : Fin k, eta ∈ D /\ + alpha ∈ P.counterexample.good.gamma q eta /\ + (HierarchyFirstMissingPosition P.coloring T eta).val <= + B.length)) : + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let j := HierarchyPathNumber C.hierarchy + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (j - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + let tailUsedThroughJ := + (Finset.univ : Finset (Fin k)).filter fun c => + exists r : Fin T.length, + A.length <= r.val /\ r.val < A.length + j /\ + P.coloring (T.edge r) = some c + exists beta : Fin k, + beta ≠ alpha /\ + beta ∈ TreeMissingColors P.coloring B /\ + beta ∉ Gamma /\ beta ∉ tailUsedThroughJ /\ + (beta ∉ baseExtraMissing ∪ D ∨ + beta ∈ D /\ + Disjoint (P.counterexample.good.gamma q beta ∪ {beta}) + tailUsedThroughJ) := by + classical + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let j := HierarchyPathNumber C.hierarchy + change 2 <= j at hpathLower + let i := j - 2 + let B := HierarchyFullTailPrefix C i + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let M := (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun v => MissingColors G P.coloring v + let U := fun s : Nat => (Finset.univ : Finset (Fin k)).filter fun c => + exists r : Fin T.length, + A.length <= r.val /\ r.val < A.length + s /\ + P.coloring (T.edge r) = some c + change exists beta : Fin k, + beta ≠ alpha /\ beta ∈ TreeMissingColors P.coloring B /\ + beta ∉ Gamma /\ beta ∉ U j /\ + (beta ∉ M ∪ D ∨ beta ∈ D /\ + Disjoint (P.counterexample.good.gamma q beta ∪ {beta}) (U j)) + have hpen := + @helper_hpen_130 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have hsame := P.sameGood + unfold SameGoodHierarchy SameHierarchyStages at hsame + obtain ⟨⟨hcore, hcount, hstage, -⟩, -⟩ := hsame + have transport (m m' : Nat) + (s : Fin (m + 2) → TreeSequence G e0) + (s' : Fin (m' + 2) → TreeSequence G e0) + (b b' : TreeSequence G e0) + (hc : m = m') (hb : b = b') (hs : HEq s s') : + Fin.cases (motive := fun _ => TreeSequence G e0) + b (fun r : Fin m => s r.succ.castSucc) (Fin.last m) = + Fin.cases (motive := fun _ => TreeSequence G e0) + b' (fun r : Fin m' => s' r.succ.castSucc) (Fin.last m') := by + subst m' + have hs' : s = s' := eq_of_heq hs + rw [← hs', ← hb] + have hstar : HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A := by + exact transport _ _ _ _ _ _ hcount hcore hstage + have hell : HierarchyFullTailLength C = T.length - A.length := by + change T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length = T.length - A.length + rw [hstar] + let Ty := fun s : Nat => + TreeSequencePrefix T (min (A.length + s) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have hB : B = Ty i := by + dsimp [B, HierarchyFullTailPrefix, Ty] + simp only [hstar] + have hi : i < T.length - A.length := by + rw [hell] at hpathUpper + dsimp only [i] + omega + have hji : j = i + 2 := by + dsimp only [i] + omega + have hj : j < T.length - A.length := by + change j < HierarchyFullTailLength C at hpathUpper + rwa [hell] at hpathUpper + let X := (TreeMissingColors P.coloring B \ M) \ U i + have hnine := + @helper_hnine_179 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hpen) (@hB) (@hi) + clear hpen transport hcore hcount hstage hstar hB hell hi hpathUpper hpathLower + let R := U j \ U i + have hRcard := + @helper_hRcard_191 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hji) (@hj) (@hnine) + have chooseColor := @helper_chooseColor_220 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + exact chooseColor (TreeMissingColors P.coloring B) M D Gamma + (P.counterexample.good.gamma q) (U i) (U j) hRcard + (GoodHierarchyReservedDisjoint P.counterexample.good q).2 + (by + intro eta heta c hc + exact Finset.mem_biUnion.mpr ⟨eta, heta, hc⟩) + (fun eta theta he ht hne => + P.counterexample.good.disjointPairs q eta theta he ht hne) hnine + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean new file mode 100644 index 0000000000..bee4f2f58b --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean @@ -0,0 +1,4062 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationThreeColorChoice +public import LeanPool.GoldbergSeymour.HierarchySituationThreeClaimJMinusOneEmpty +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentTashkinovSplice +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Hierarchy Situation Three Component Intersection Shortening + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev componentIntersectionFromMissingColorsStatement.{u_1, u_2} : Prop := + open scoped Classical Sym2 in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H := P.counterexample.hierarchy; + let R := P.corresponding.replacementETT; + let mu := P.coloring; + let n := Fin.last R.rounds; + let Tn := R.series.data.tree n.castSucc; + let q := Fin.last H.dividerCount; + let A := HierarchyStarredStage H q; + ∀ (j : ℕ), + ( + let j := j; + let X := HierarchyFullTailPrefix C (j - 1); + ∃ u ∈ TreeSequenceVertexSet X, + Sum.inl u ∈ + TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length)))) → + HierarchyPathNumber C.hierarchy = j → + 2 ≤ j → + j < HierarchyFullTailLength C → + let ell := HierarchyFullTailLength C; + let B := HierarchyFullTailPrefix C (j - 2); + let X := HierarchyFullTailPrefix C (j - 1); + let y := T.vertex (Fin.last T.length); + ( + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S S) → + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U) → + ( + ∀ {a b : ℕ} (s : + Fin (a + 2) → + TreeSequence G e0) (t : + Fin (b + 2) → + TreeSequence G e0) + (u v : TreeSequence G e0), + a = b → + s ≍ t → + u = v → + Fin.cases (motive := fun _ => TreeSequence G e0) u (fun i ↦ s i.succ.castSucc) + (Fin.last a) = + Fin.cases (motive := fun _ => TreeSequence G e0) v (fun i ↦ t i.succ.castSucc) + (Fin.last b)) → + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → + HierarchyPathNumber H = j → + ell = T.length - A.length → + 2 ≤ j → + j < ell → + ( + ∀ (b : ℕ) (hb : b < H.dividerCount + 2) (a : Fin (H.dividerCount + 2)), + ↑a ≤ b → + TreeSequenceInitialSegment (H.stage a) (H.stage ⟨b, hb⟩)) → + ( + ∀ (i : Fin (H.dividerCount + 1)), + TreeSequenceInitialSegment (HierarchyStarredStage H i) (H.stage i.succ)) → + TreeSequenceInitialSegment A T → + ( + H.dividerCount = 0 → + A = P.replacementBase.core) → + ( + H.dividerCount ≠ 0 → + A = H.stage ⟨H.dividerCount, Decidable.byContradiction fun a ↦ (by omega)⟩) → + TreeSequenceInitialSegment P.replacementBase.core A → + TreeSequenceInitialSegment Tn P.replacementBase.core → + TreeSequenceInitialSegment Tn A → + ( + ∀ (r : ℕ), + TreeSequenceInitialSegment (HierarchyFullTailPrefix C r) T) → + (∀ r ≤ ell, (HierarchyFullTailPrefix C r).length = A.length + r) → + B.length = A.length + (j - 2) → + X.length = A.length + (j - 1) → + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - 2)) T → + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - 1)) T → + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B X → + TreeSequenceInitialSegment A X → + TreeSequenceInitialSegment Tn B → + TreeSequenceInitialSegment Tn X → + X.length = B.length + 1 → + X.length < T.length → + y ∉ TreeSequenceVertexSet X → + y ∉ TreeSequenceVertexSet B → + alpha ∈ + MissingColors G P.coloring + (T.vertex (Fin.last T.length)) → + alpha ∈ + TreeMissingColors P.coloring + (HierarchyFullTailPrefix C (j - 2)) → + ((alpha ∉ + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma + (Fin.last + P.counterexample.hierarchy.dividerCount)) ∪ + (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet + (P.corresponding.replacementETT.series.data.tree + (Fin.last + P.corresponding.replacementETT.rounds).castSucc)).biUnion + fun v ↦ MissingColors G P.coloring v) ∨ + ∃ + eta ∈ + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount), + alpha ∈ + P.counterexample.good.gamma + (Fin.last P.counterexample.hierarchy.dividerCount) + eta ∧ + ↑(HierarchyFirstMissingPosition P.coloring T eta) ≤ + (HierarchyFullTailPrefix C (j - 2)).length) → + beta ≠ alpha → + beta ∈ + TreeMissingColors P.coloring + (HierarchyFullTailPrefix C (j - 2)) → + beta ∉ + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma + (Fin.last + P.counterexample.hierarchy.dividerCount)) → + beta ∉ + (Finset.univ.filter fun c => + ∃ r : Fin T.length, + (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).length ≤ + ↑r ∧ + ↑r < + (HierarchyStarredStage + P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).length + + j ∧ + P.coloring (T.edge r) = some c) → + beta ∉ + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet + (P.corresponding.replacementETT.series.data.tree + (Fin.last + P.corresponding.replacementETT.rounds).castSucc)).biUnion + fun v ↦ MissingColors G P.coloring v) ∪ + HierarchyStoredColorsAt + P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount) ∨ + beta ∈ + HierarchyStoredColorsAt + P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount) ∧ + Disjoint + (P.counterexample.good.gamma + (Fin.last + P.counterexample.hierarchy.dividerCount) + beta ∪ + { beta }) + (Finset.univ.filter fun c => + ∃ r : Fin T.length, + (HierarchyStarredStage + P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).length ≤ + ↑r ∧ + ↑r < + (HierarchyStarredStage + P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).length + + j ∧ + P.coloring (T.edge r) = some c) → + alpha ≠ beta → + False + +private abbrev componentIntersectionFromSpliceFactsStatement.{u_1, u_2} : Prop := + open scoped Classical Sym2 in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H := P.counterexample.hierarchy; + let R := P.corresponding.replacementETT; + let mu := P.coloring; + let n := Fin.last R.rounds; + let Tn := R.series.data.tree n.castSucc; + let q := Fin.last H.dividerCount; + let A := HierarchyStarredStage H q; + ∀ (j : ℕ), + ( + let j := j; + let X := HierarchyFullTailPrefix C (j - 1); + ∃ u ∈ TreeSequenceVertexSet X, + Sum.inl u ∈ + TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length)))) → + HierarchyPathNumber C.hierarchy = j → + 2 ≤ j → + j < HierarchyFullTailLength C → + let ell := HierarchyFullTailLength C; + let B := HierarchyFullTailPrefix C (j - 2); + let X := HierarchyFullTailPrefix C (j - 1); + let y := T.vertex (Fin.last T.length); + ( + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S S) → + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U) → + ( + ∀ {a b : ℕ} (s : + Fin (a + 2) → + TreeSequence G e0) (t : + Fin (b + 2) → + TreeSequence G e0) + (u v : TreeSequence G e0), + a = b → + s ≍ t → + u = v → + Fin.cases (motive := fun _ => TreeSequence G e0) u (fun i ↦ s i.succ.castSucc) + (Fin.last a) = + Fin.cases (motive := fun _ => TreeSequence G e0) v (fun i ↦ t i.succ.castSucc) + (Fin.last b)) → + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → + HierarchyPathNumber H = j → + ell = T.length - A.length → + 2 ≤ j → + j < ell → + ( + ∀ (b : ℕ) (hb : b < H.dividerCount + 2) (a : Fin (H.dividerCount + 2)), + ↑a ≤ b → + TreeSequenceInitialSegment (H.stage a) (H.stage ⟨b, hb⟩)) → + ( + ∀ (i : Fin (H.dividerCount + 1)), + TreeSequenceInitialSegment (HierarchyStarredStage H i) (H.stage i.succ)) → + TreeSequenceInitialSegment A T → + ( + H.dividerCount = 0 → + A = P.replacementBase.core) → + ( + H.dividerCount ≠ 0 → + A = H.stage ⟨H.dividerCount, Decidable.byContradiction fun a ↦ (by omega)⟩) → + TreeSequenceInitialSegment P.replacementBase.core A → + TreeSequenceInitialSegment Tn P.replacementBase.core → + TreeSequenceInitialSegment Tn A → + ( + ∀ (r : ℕ), + TreeSequenceInitialSegment (HierarchyFullTailPrefix C r) T) → + (∀ r ≤ ell, (HierarchyFullTailPrefix C r).length = A.length + r) → + B.length = A.length + (j - 2) → + X.length = A.length + (j - 1) → + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - 2)) T → + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - 1)) T → + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B X → + TreeSequenceInitialSegment A X → + TreeSequenceInitialSegment Tn B → + TreeSequenceInitialSegment Tn X → + X.length = B.length + 1 → + X.length < T.length → + y ∉ TreeSequenceVertexSet X → + y ∉ TreeSequenceVertexSet B → + alpha ∈ + MissingColors G P.coloring + (T.vertex (Fin.last T.length)) → + alpha ∈ + TreeMissingColors P.coloring + (HierarchyFullTailPrefix C (j - 2)) → + ((alpha ∉ + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma + (Fin.last + P.counterexample.hierarchy.dividerCount)) ∪ + (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet + (P.corresponding.replacementETT.series.data.tree + (Fin.last + P.corresponding.replacementETT.rounds).castSucc)).biUnion + fun v ↦ MissingColors G P.coloring v) ∨ + ∃ + eta ∈ + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount), + alpha ∈ + P.counterexample.good.gamma + (Fin.last P.counterexample.hierarchy.dividerCount) + eta ∧ + ↑(HierarchyFirstMissingPosition P.coloring T eta) ≤ + (HierarchyFullTailPrefix C (j - 2)).length) → + beta ≠ alpha → + beta ∈ + TreeMissingColors P.coloring + (HierarchyFullTailPrefix C (j - 2)) → + beta ∉ + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma + (Fin.last + P.counterexample.hierarchy.dividerCount)) → + beta ∉ + (Finset.univ.filter fun c => + ∃ r : Fin T.length, + (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).length ≤ + ↑r ∧ + ↑r < + (HierarchyStarredStage + P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).length + + j ∧ + P.coloring (T.edge r) = some c) → + beta ∉ + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet + (P.corresponding.replacementETT.series.data.tree + (Fin.last + P.corresponding.replacementETT.rounds).castSucc)).biUnion + fun v ↦ MissingColors G P.coloring v) ∪ + HierarchyStoredColorsAt + P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount) ∨ + beta ∈ + HierarchyStoredColorsAt + P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount) ∧ + Disjoint + (P.counterexample.good.gamma + (Fin.last + P.counterexample.hierarchy.dividerCount) + beta ∪ + { beta }) + (Finset.univ.filter fun c => + ∃ r : Fin T.length, + (HierarchyStarredStage + P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).length ≤ + ↑r ∧ + ↑r < + (HierarchyStarredStage + P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount)).length + + j ∧ + P.coloring (T.edge r) = some c) → + alpha ≠ beta → + ( + ∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeMissingColors mu S ⊆ + TreeMissingColors mu U) → + alpha ∈ TreeMissingColors mu X → + beta ∈ TreeMissingColors mu X → + ( + ∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + S.length = U.length → + S = U) → + ( + ∀ (W : TreeSequence G e0) (c : Fin k) + (i : Fin (W.length + 1)), + c ∈ MissingColors G mu (W.vertex i) → + ↑(HierarchyFirstMissingPosition mu W c) ≤ + ↑i) → + ( + ∀ (W : TreeSequence G e0) (c : Fin k), + ↑(HierarchyFirstMissingPosition mu W c) < + W.length → + c ∈ + MissingColors G mu + (W.vertex + (HierarchyFirstMissingPosition mu W + c))) → + ( + ∀ {W Z : TreeSequence G e0}, + TreeSequenceInitialSegment W Z → + ∀ c ∈ TreeMissingColors mu W, + ↑(HierarchyFirstMissingPosition mu Z c) ≤ + W.length) → + ( + ∀ (W : TreeSequence G e0) + (D : Finset (Fin k)) + (rho sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G rho → + IsOneEdgeUncolored rho e0 → + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring W D rho sigma → + ColoredVertexSetClosed G rho + (TreeSequenceVertexSet W) → + ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet W)) → + ( + R.series.data.kind n ≠ + some TashkinovExtensionKind.PE → + ColoredVertexSetClosed G mu + (TreeSequenceVertexSet Tn)) → + ModColoring R mu → + ( + H.dividerCount = 0 → + j = 2 → + R.series.data.kind n ≠ + some TashkinovExtensionKind.PE → + ¬∃ u ∈ TreeSequenceVertexSet B, + Sum.inl u ∈ + TwoColorComponent G mu alpha beta + (Sum.inl y)) → + False + +private abbrev helperContinuation2763Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ) (hpathLower : (2 : ℕ) ≤ j), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ + (trans : + ∀ {S U W : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W), + TreeSequenceInitialSegment S W) + (hpOld : HierarchyPathNumber H = j) (hjlow : (2 : ℕ) ≤ j) + (coreA : TreeSequenceInitialSegment P.replacementBase.core A) + (hBLen : B.length = A.length + (j - (2 : ℕ))) (hXLen : X.length = A.length + (j - (1 : ℕ))) + (hBT : TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - (2 : ℕ))) T) + (hBXLen : X.length = B.length + (1 : ℕ)) (hXshort : X.length < T.length) + (hyB : y ∉ TreeSequenceVertexSet B) + (hay : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) + (haB : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ)))) + (haChoice : + (alpha ∉ + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount)) ∪ + (TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet + (P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc)).biUnion + fun (v : V) ↦ MissingColors G P.coloring v) ∨ + ∃ + eta ∈ + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount), + alpha ∈ P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta ∧ + (↑(HierarchyFirstMissingPosition P.coloring T eta) : ℕ) ≤ + (HierarchyFullTailPrefix C (j - (2 : ℕ))).length) + (hba : beta ≠ alpha) + (hbGamma : + beta ∉ + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount))) + (hab : alpha ≠ beta) + (firstMem : + ∀ (W : TreeSequence G e0) (c : Fin k) + (hlt : (↑(HierarchyFirstMissingPosition mu W c) : ℕ) < W.length), + c ∈ MissingColors G mu (W.vertex (HierarchyFirstMissingPosition mu W c))) + (firstBound : + ∀ {W Z : TreeSequence G e0} (hWT : TreeSequenceInitialSegment W Z) (c : Fin k) + (hc : c ∈ TreeMissingColors mu W), + (↑(HierarchyFirstMissingPosition mu Z c) : ℕ) ≤ W.length) + (exceptional : + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + ¬∃ u ∈ TreeSequenceVertexSet B, Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y)) + (S U : TreeSequence G e0) (hBS : TreeSequenceInitialSegment B S) + (hSU : TreeSequenceInitialSegment S U) (hSUstrict : S.length < U.length) + (hUlast : U.vertex (Fin.last U.length) = y) + (hUcolors : + ∀ (r : Fin U.length), + S.length ≤ (↑r : ℕ) → + mu (U.edge r) = some alpha ∨ mu (U.edge r) = some beta) + (hUpath : + ∀ (r : Fin U.length), + X.length ≤ (↑r : ℕ) → + G.ends (U.edge r) = s(U.vertex r.castSucc, U.vertex r.succ)) + (hScorner : + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + S = X) + (hST : TreeSequenceInitialSegment S T) (hAU : TreeSequenceInitialSegment A U) + (hBU : TreeSequenceInitialSegment B U) (hAUstrict : A.length < U.length) + (newInput : PartialEdgeColoring E k) (newSeries : TashkinovSeries G k R.rounds e0 newInput) + (hgen : mu = newSeries.data.coloring (Fin.last R.rounds)) + (htrees : + ∀ (i : Fin R.rounds), + newSeries.data.tree i.succ.castSucc = R.series.data.tree i.succ.castSucc) + (hstored : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) + (hedges : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = R.series.data.connectingEdges i) + (hkinds : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.kind i = R.series.data.kind i) + (hproper : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) + (hone : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) + (hstable : + ∀ (i : Fin R.rounds), + StableColoring (R.series.data.tree i.succ.castSucc) + (TashkinovStoredColors R.series.data i.succ) (R.series.data.coloring i.succ) + (newSeries.data.coloring i.succ)) + (roundsPositive : (1 : ℕ) ≤ R.1) + (above : + TreeSequenceInitialSegment (newSeries.data.tree (⟨R.1, by omega⟩ : Fin (R.1 + (2 : ℕ)))) U) + (strict : (newSeries.data.tree (⟨R.1, by omega⟩ : Fin (R.1 + (2 : ℕ)))).length < U.length) + (below : TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) + (generating : mu = newSeries.data.coloring (Fin.last R.1)) + (hseries : + { + rounds := R.1, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ + newSeries), + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { + rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 newInput U mu }; + ∀ (baseU : HierarchyBase RU mu) (hcore : baseU.core = P.replacementBase.core) + (hclosure : baseU.closure = P.replacementBase.closure) (hMP : MaximumProperty RU) + (hTnEq : newSeries.data.tree n.castSucc = Tn) + (hstoredEq : TashkinovStoredColors newSeries.data n = TashkinovStoredColors R.series.data n) + (stageA : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage i.castSucc) A) + (stageU : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage i.castSucc) U) + (stageB : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage i.castSucc) B) + (hdivB : + ∀ (i : Fin H.dividerCount), + (↑(H.dividerPosition i) : ℕ) ≤ B.length) + (prefixEq : + ∀ (p : ℕ) (hp : (1 : ℕ) ≤ p) (hpB : p ≤ B.length), + TreeSequencePrefix U p hp (LE.le.trans hpB hBU.1) = + TreeSequencePrefix T p hp (LE.le.trans hpB hBT.1)), + let newStage : + Fin (H.dividerCount + (2 : ℕ)) → + TreeSequence G e0 := + fun (i : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑i : ℕ) = H.dividerCount + (1 : ℕ) then U else H.stage i; + ∀ + (newStageOld : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + newStage i.castSucc = H.stage i.castSucc) + (newStageLast : newStage (Fin.last (H.dividerCount + (1 : ℕ))) = U) + (newStageAt : + ∀ (i : Fin (H.dividerCount + (2 : ℕ))) (hi : (↑i : ℕ) ≤ H.dividerCount), + newStage i = H.stage i), + False + +private noncomputable abbrev helperK2280.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [inst : Fintype V] → + [inst_1 : Fintype E] → + [inst_2 : DecidableEq V] → + [inst_3 : DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + let H : + TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase := + P.counterexample.hierarchy; + let R : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (j : ℕ) → + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (j - (2 : ℕ)); + (trans : + ∀ {S U W : TreeSequence G e0} + (_ : TreeSequenceInitialSegment S U) + (_ : TreeSequenceInitialSegment U W), + TreeSequenceInitialSegment S W) → + (coreA : + TreeSequenceInitialSegment P.replacementBase.core + A) → + (hBT : + TreeSequenceInitialSegment + (HierarchyFullTailPrefix C (j - (2 : ℕ))) T) → + (S U : TreeSequence G e0) → + (hAU : TreeSequenceInitialSegment A U) → + (hBU : TreeSequenceInitialSegment B U) → + (newInput : PartialEdgeColoring E k) → + (newSeries : + TashkinovSeries G k R.rounds e0 + newInput) → + (roundsPositive : (1 : ℕ) ≤ R.rounds) → + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨R.rounds, by omega⟩ : + Fin (R.rounds + (2 : ℕ)))) + U) → + (strict : + (newSeries.data.tree + (⟨R.rounds, by omega⟩ : + Fin + (R.rounds + + (2 : ℕ)))).length < + U.length) → + (below : + TreeSequenceInitialSegment U + (newSeries.data.tree + (Fin.last + (R.rounds + (1 : ℕ))))) → + (generating : + mu = + newSeries.data.coloring + (Fin.last R.rounds)) → + let RU : + ExtendedTashkinovTree G k e0 + newInput U mu := + { rounds := R.rounds, + roundsPositive := + roundsPositive, + series := newSeries, + abovePenultimate := above, + strictAbovePenultimate := + strict, + belowFinal := below, + generatingColoring := + generating : + ExtendedTashkinovTree G k e0 + newInput U mu }; + (baseU : HierarchyBase RU mu) → + (hcore : + baseU.core = + P.replacementBase.core) → + (hTnEq : + newSeries.data.tree + n.castSucc = + Tn) → + (hdivB : + ∀ + (i : + Fin + H.dividerCount), + (↑(H.dividerPosition + i) : + ℕ) ≤ + B.length) → + (prefixEq : + ∀ (p : ℕ) + (hp : (1 : ℕ) ≤ p) + (hpB : + p ≤ B.length), + TreeSequencePrefix + U p hp + (LE.le.trans + hpB hBU.1) = + TreeSequencePrefix + T p hp + (LE.le.trans + hpB + hBT.1)) → + let newStage : + Fin + (H.dividerCount + + (2 : ℕ)) → + TreeSequence G + e0 := + fun + (i : + Fin + (H.dividerCount + + (2 : ℕ))) ↦ + if + (↑i : ℕ) = + H.dividerCount + + (1 : ℕ) then + U + else H.stage i; + (newStageLast : + newStage + (Fin.last + (H.dividerCount + + (1 : + ℕ))) = + U) → + (newStageAt : + ∀ + (i : + Fin + (H.dividerCount + + (2 : + ℕ))) + (_ : + (↑i : ℕ) ≤ + H.dividerCount), + newStage i = + H.stage i) → + (newNested : + ∀ + (i : + Fin + (H.dividerCount + + (1 : + ℕ))), + TreeSequenceInitialSegment + (newStage + i.castSucc) + (newStage + i.succ)) → + (newStrict : + ∀ + (i : + Fin + (H.dividerCount + + (1 : + ℕ))), + (newStage + i.castSucc).length < + (newStage + i.succ).length) → + TashkinovHierarchy + RU baseU := by + classical + intro V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx P H R mu n Tn q A j B trans + coreA hBT S U hAU hBU newInput newSeries roundsPositive above strict below generating RU baseU + hcore hTnEq hdivB prefixEq newStage newStageLast newStageAt newNested newStrict + exact { + dividerCount := H.dividerCount + stage := newStage + baseStage := by + rw [show newStage 0 = H.stage 0 by simp [newStage], H.baseStage] + exact hTnEq.symm + terminalStage := newStageLast + nested := newNested + strict := newStrict + dividerPosition := fun i => ⟨(H.dividerPosition i).val, + Nat.lt_succ_of_le ((hdivB i).trans hBU.1)⟩ + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := by + intro i + rw [newStageAt ⟨i.val + 1, by omega⟩ (Nat.succ_le_of_lt i.isLt)] + rw [prefixEq (H.dividerPosition i).val (H.dividerPositive i) (hdivB i)] + exact H.dividerStage i + coreInsideFirst := by + rw [hcore] + by_cases hz : H.dividerCount = 0 + · rw [show newStage ⟨1, by omega⟩ = U by simp [newStage, hz]] + exact trans coreA hAU + · rw [newStageAt ⟨1, by omega⟩ (Nat.one_le_iff_ne_zero.mpr hz)] + exact H.coreInsideFirst }; + +private abbrev helperContinuation2608Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ) (hpathLower : (2 : ℕ) ≤ j), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ + (trans : + ∀ {S U W : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W), + TreeSequenceInitialSegment S W) + (hpOld : HierarchyPathNumber H = j) (hjlow : (2 : ℕ) ≤ j) + (coreA : TreeSequenceInitialSegment P.replacementBase.core A) + (hBLen : B.length = A.length + (j - (2 : ℕ))) (hXLen : X.length = A.length + (j - (1 : ℕ))) + (hBT : TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - (2 : ℕ))) T) + (hyB : y ∉ TreeSequenceVertexSet B) + (hay : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) + (haB : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ)))) + (hba : beta ≠ alpha) (hab : alpha ≠ beta) + (exceptional : + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + ¬∃ u ∈ TreeSequenceVertexSet B, Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y)) + (S U : TreeSequence G e0) (hBS : TreeSequenceInitialSegment B S) + (hSUstrict : S.length < U.length) (hUlast : U.vertex (Fin.last U.length) = y) + (hUpath : + ∀ (r : Fin U.length), + X.length ≤ (↑r : ℕ) → + G.ends (U.edge r) = s(U.vertex r.castSucc, U.vertex r.succ)) + (hScorner : + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + S = X) + (hAU : TreeSequenceInitialSegment A U) (hBU : TreeSequenceInitialSegment B U) + (newInput : PartialEdgeColoring E k) (newSeries : TashkinovSeries G k R.rounds e0 newInput) + (hgen : mu = newSeries.data.coloring (Fin.last R.rounds)) + (htrees : + ∀ (i : Fin R.rounds), + newSeries.data.tree i.succ.castSucc = R.series.data.tree i.succ.castSucc) + (hstored : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) + (hedges : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = R.series.data.connectingEdges i) + (hkinds : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.kind i = R.series.data.kind i) + (hproper : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) + (hone : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) + (hstable : + ∀ (i : Fin R.rounds), + StableColoring (R.series.data.tree i.succ.castSucc) + (TashkinovStoredColors R.series.data i.succ) (R.series.data.coloring i.succ) + (newSeries.data.coloring i.succ)) + (roundsPositive : (1 : ℕ) ≤ R.1) + (above : + TreeSequenceInitialSegment (newSeries.data.tree (⟨R.1, by omega⟩ : Fin (R.1 + (2 : ℕ)))) U) + (strict : (newSeries.data.tree (⟨R.1, by omega⟩ : Fin (R.1 + (2 : ℕ)))).length < U.length) + (below : TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) + (generating : mu = newSeries.data.coloring (Fin.last R.1)) + (hseries : + { + rounds := R.1, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ + newSeries), + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { + rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 newInput U mu }; + ∀ (baseU : HierarchyBase RU mu) (hcore : baseU.core = P.replacementBase.core) + (hclosure : baseU.closure = P.replacementBase.closure) (hMP : MaximumProperty RU) + (hTnEq : newSeries.data.tree n.castSucc = Tn) + (stageB : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage i.castSucc) B) + (hdivB : + ∀ (i : Fin H.dividerCount), + (↑(H.dividerPosition i) : ℕ) ≤ B.length) + (prefixEq : + ∀ (p : ℕ) (hp : (1 : ℕ) ≤ p) (hpB : p ≤ B.length), + TreeSequencePrefix U p hp (LE.le.trans hpB hBU.1) = + TreeSequencePrefix T p hp (LE.le.trans hpB hBT.1)), + let newStage : + Fin (H.dividerCount + (2 : ℕ)) → + TreeSequence G e0 := + fun (i : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑i : ℕ) = H.dividerCount + (1 : ℕ) then U else H.stage i; + ∀ (newStageLast : newStage (Fin.last (H.dividerCount + (1 : ℕ))) = U) + (newStageAt : + ∀ (i : Fin (H.dividerCount + (2 : ℕ))) (hi : (↑i : ℕ) ≤ H.dividerCount), + newStage i = H.stage i) + (newNested : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (newStage i.castSucc) (newStage i.succ)) + (newStrict : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + (newStage i.castSucc).length < (newStage i.succ).length), + let K : TashkinovHierarchy RU baseU := by + exact + @helperK2280 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@trans) (@coreA) (@hBT) + (@S) (@U) (@hAU) (@hBU) (@newInput) (@newSeries) (@roundsPositive) (@above) (@strict) + (@below) (@generating) (@baseU) (@hcore) (@hTnEq) (@hdivB) (@prefixEq) (@newStageLast) + (@newStageAt) (@newNested) (@newStrict) + ∀ (stageEq : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + K.stage i.castSucc = H.stage i.castSucc) + (starredEq : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K i = HierarchyStarredStage H i) + (storedEq : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K i = HierarchyStoredColorsAt H i) + (missingEq : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K i = HierarchyStageMissingColors H i) + (cutoffEq : + ∀ (c : Fin k) (p : ℕ) (hp : p ≤ S.length), + min (↑(HierarchyFirstMissingPosition mu U c) : ℕ) p = + min (↑(HierarchyFirstMissingPosition mu T c) : ℕ) p) + (lastAvoidance : + ∀ (eta : Fin k) (heta : eta ∈ HierarchyStoredColorsAt H q) (c : Fin k) + (hc : c ∈ P.counterexample.good.gamma q eta), + c ∉ HierarchySegmentColors K q eta), + False + +private theorem helper_branch_221.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + ( + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S S) → + ∀ (hb : (0 : ℕ) < H.dividerCount + (2 : ℕ)) (a : Fin (H.dividerCount + (2 : ℕ))), + (↑a : ℕ) ≤ (0 : ℕ) → + TreeSequenceInitialSegment (H.stage a) + (H.stage (⟨(0 : ℕ), hb⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H reflSeg hb a ha + have he : a = 0 := Fin.ext (Nat.eq_zero_of_le_zero ha) + subst a + exact reflSeg _ + +private theorem helper_branch_226.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + ( + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S S) → + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + ∀ (b : ℕ), + ( + ∀ (hb : b < H.dividerCount + (2 : ℕ)) (a : Fin (H.dividerCount + (2 : ℕ))), + (↑a : ℕ) ≤ b → + TreeSequenceInitialSegment (H.stage a) + (H.stage (⟨b, hb⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (hb : b + (1 : ℕ) < H.dividerCount + (2 : ℕ)) (a : Fin (H.dividerCount + (2 : ℕ))), + (↑a : ℕ) ≤ b + (1 : ℕ) → + TreeSequenceInitialSegment (H.stage a) + (H.stage (⟨b + (1 : ℕ), hb⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H reflSeg trans b ih hb a ha + by_cases he : a.val = b + 1 + · have heq : a = ⟨b + 1, hb⟩ := Fin.ext he + subst a + exact reflSeg _ + · exact trans (ih (by omega) a (by omega)) (H.nested ⟨b, by omega⟩) + +private theorem helper_lastPositive_240.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ℕ), + H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A j hz + unfold A HierarchyStarredStage + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [q, Fin.val_last, Fin.val_zero] at hv + contradiction + · rw [hi] + simp only [Fin.cases_succ] + congr 1 + apply Fin.ext + simpa [q] using (congrArg Fin.val hi).symm + +private theorem helper_coreA_252.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ℕ), + ( + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S S) → + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + ( + ∀ (b : ℕ) (hb : b < H.dividerCount + (2 : ℕ)) (a : Fin (H.dividerCount + (2 : ℕ))), + (↑a : ℕ) ≤ b → + TreeSequenceInitialSegment (H.stage a) + (H.stage (⟨b, hb⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ( + H.dividerCount = (0 : ℕ) → + A = P.replacementBase.core) → + ( + H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment P.replacementBase.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A j reflSeg trans chain lastZero + lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact reflSeg _ + · rw [lastPositive hz] + exact trans H.coreInsideFirst (chain H.dividerCount (by omega) + ⟨1, by omega⟩ (by change 1 ≤ H.dividerCount; omega)) + +private theorem helper_branch_317.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {U : TreeSequence G e0} (sl : ℕ) (sp : (1 : ℕ) ≤ sl) (sv : + Fin (sl + (1 : ℕ)) → + V) + (se : + Fin sl → + E) (svi : Function.Injective sv) (sei : Function.Injective se) + (sf : se (⟨(0 : ℕ), sp⟩ : Fin sl) = e0) + (sa : + ∀ (j : Fin sl), + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + G.ends (se j) = s(sv j.succ, sv (i.castLT (by omega)))), + TreeSequenceInitialSegment + { length := sl, positive := sp, vertex := sv, edge := se, vertex_injective := svi, + edge_injective := sei, first_edge := sf, attaches := sa : TreeSequence G e0 } + U → + { length := sl, positive := sp, vertex := sv, edge := se, vertex_injective := svi, + edge_injective := sei, first_edge := sf, attaches := sa : + TreeSequence G e0 }.length = + U.length → + { length := sl, positive := sp, vertex := sv, edge := se, vertex_injective := svi, + edge_injective := sei, first_edge := sf, attaches := sa : TreeSequence G e0 } = + U := by + classical + intro V E G e0 U sl sp sv se svi sei sf sa hSU hlen + cases U with + | mk ul up uv ue uvi uei uf ua => + dsimp only at hlen + subst ul + have hv : uv = sv := funext hSU.2.1 + have he : ue = se := funext hSU.2.2 + subst uv + subst ue + rfl + +private theorem helper_branch_348.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (W : TreeSequence G e0) (c : Fin k), + (↑(HierarchyFirstMissingPosition mu W c) : ℕ) < W.length → + let candidates : Finset (Fin (W.length + (1 : ℕ))) := + ({t : Fin (W.length + (1 : ℕ)) | c ∈ MissingColors G mu (W.vertex t)} : + Finset (Fin (W.length + (1 : ℕ)))); + ¬candidates.Nonempty → + c ∈ MissingColors G mu (W.vertex (HierarchyFirstMissingPosition mu W c)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu W c hlt candidates hn + have hh : (HierarchyFirstMissingPosition mu W c).val = W.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + +private theorem helper_firstBound_353.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + ( + ∀ (W : TreeSequence G e0) (c : Fin k) (i : Fin (W.length + (1 : ℕ))), + c ∈ MissingColors G mu (W.vertex i) → + (↑(HierarchyFirstMissingPosition mu W c) : ℕ) ≤ (↑i : ℕ)) → + ∀ {W Z : TreeSequence G e0}, + TreeSequenceInitialSegment W Z → + ∀ c ∈ TreeMissingColors mu W, + (↑(HierarchyFirstMissingPosition mu Z c) : ℕ) ≤ W.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu trans firstLe W Z hWT c hc + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + obtain ⟨i, hi⟩ : ∃ i, W.vertex i = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hv + have hmT : c ∈ MissingColors G mu + (Z.vertex (Fin.castLE (Nat.succ_le_succ hWT.1) i)) := by + rw [hWT.2.1, hi] + exact hm + exact (firstLe Z c _ hmT).trans (Nat.le_of_lt_succ i.isLt) + +private theorem helper_hinc_377.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) + (e0 : E) (W : TreeSequence G e0) {f : E}, + f ∈ BoundaryEdges G (TreeSequenceVertexSet W) → + TreeIncidentEdge W f := by + classical + intro V E _ _ G e0 W f hf + have hfData : ∃ u ∈ TreeSequenceVertexSet W, + ∃ w ∉ TreeSequenceVertexSet W, G.ends f = s(u, w) := by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] using hf + obtain ⟨u, hu, w, hw, he⟩ := hfData + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [he] + exact Sym2.mem_mk_left _ _ + +private theorem helper_branch_397.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + n = (0 : Fin (R.rounds + (1 : ℕ))) → + ColoredVertexSetClosed G mu (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P R mu n Tn hn + have hv := congrArg Fin.val hn + simp only [n, Fin.val_last, Fin.val_zero] at hv + have := R.roundsPositive + omega + +private theorem helper_branch_402.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ( + ∀ (W : TreeSequence G e0) (D : Finset (Fin k)) (rho sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G rho → + IsOneEdgeUncolored rho e0 → + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring W D rho sigma → + ColoredVertexSetClosed G rho (TreeSequenceVertexSet W) → + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet W)) → + ∀ (i : Fin R.rounds), + IsProperEdgeColoring G (R.series.data.coloring i.castSucc) → + IsOneEdgeUncolored (R.series.data.coloring i.castSucc) e0 → + ColoredVertexSetClosed G (R.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (R.series.data.tree i.succ.castSucc)) → + ∀ + (choice : + MaximumDefectiveChoice G e0 (R.series.data.tree i.succ.castSucc) + (TashkinovStoredColors R.series.data i.castSucc) + (R.series.data.coloring i.castSucc)), + R.series.data.coloring i.succ = choice.selected → + n = i.succ → + ColoredVertexSetClosed G mu (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P R mu n Tn stableClosed i hp ho hc choice + hcol hn + have hin : i.succ = n := hn.symm + have hm : mu = choice.selected := by + have hg : mu = R.series.data.coloring n := R.generatingColoring + rw [← hin, hcol] at hg + exact hg + rw [hm] + have htree : Tn = R.series.data.tree i.succ.castSucc := by rw [hin] + rw [htree] + exact @stableClosed _ _ _ _ hp ho choice.selectedProper + choice.selectedOneUncolored choice.selectedStable @hc + +private theorem helper_branch_419.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ∀ (i : Fin R.rounds), + ColoredVertexSetClosed G (R.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (R.series.data.tree i.succ.castSucc)) → + R.series.data.coloring i.succ = R.series.data.coloring i.castSucc → + n = i.succ → + ColoredVertexSetClosed G mu (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P R mu n Tn i hc hcol hn + have hin : i.succ = n := hn.symm + have hm : mu = R.series.data.coloring i.castSucc := by + have hg : mu = R.series.data.coloring n := R.generatingColoring + rw [← hin, hcol] at hg + exact hg + rw [hm, show Tn = R.series.data.tree i.succ.castSucc by rw [hin]] + exact @hc + +private theorem helper_exceptional_436.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U) → + HierarchyPathNumber H = j → + TreeSequenceInitialSegment A T → + ( + H.dividerCount = (0 : ℕ) → + A = P.replacementBase.core) → + B.length = A.length + (j - (2 : ℕ)) → + X.length = A.length + (j - (1 : ℕ)) → + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - (2 : ℕ))) T → + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - (1 : ℕ))) T → + TreeSequenceInitialSegment A B → + X.length = B.length + (1 : ℕ) → + X.length < T.length → + y ∉ TreeSequenceVertexSet B → + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) → + alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ))) → + beta ≠ alpha → + beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ))) → + alpha ≠ beta → + ( + ∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeMissingColors mu S ⊆ TreeMissingColors mu U) → + ( + ∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + S.length = U.length → + S = U) → + ( + ∀ (W : TreeSequence G e0) (c : Fin k), + (↑(HierarchyFirstMissingPosition mu W c) : ℕ) < W.length → + c ∈ MissingColors G mu (W.vertex (HierarchyFirstMissingPosition mu W c))) → + ( + ∀ {W Z : TreeSequence G e0}, + TreeSequenceInitialSegment W Z → + ∀ c ∈ TreeMissingColors mu W, + (↑(HierarchyFirstMissingPosition mu Z c) : ℕ) ≤ W.length) → + ( + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + ColoredVertexSetClosed G mu (TreeSequenceVertexSet Tn)) → + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + ¬∃ u ∈ TreeSequenceVertexSet B, + Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H R mu n Tn q A j B X y trans + common hpOld hAT lastZero hBLen hXLen hBT hXT hAB hBXLen hXshort hyB hay haB hba hbB hab + missingMono equalSeg firstMem firstBound nonparallelClosed hz hj hk hmeet + have hABeq : A = B := equalSeg hAB (by omega) + have hATneq : A = Tn := (lastZero hz).trans (P.replacementBase.nonparallel hk) + have hBTneq : B = Tn := hABeq.symm.trans hATneq + have haA : alpha ∈ TreeMissingColors mu A := by rw [hABeq]; exact haB + have hbA : beta ∈ TreeMissingColors mu A := by rw [hABeq]; exact hbB + have haclosed : TreeColorSetClosed G mu A {alpha} := by + intro c hc + have he : c = alpha := Finset.mem_singleton.mp hc + subst c + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + simp only [BoundaryColorEdges, Finset.mem_filter] at hf + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp haA + have hclosed : ColoredVertexSetClosed G mu (TreeSequenceVertexSet A) := by + rw [hATneq] + exact nonparallelClosed hk + exact hclosed hf.1 hv hf.2 hm + have helem : ColoredVertexSetElementary G mu (TreeSequenceVertexSet + (HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - 1))) := + HierarchyCounterexamplePenultimateElementary + G k e0 P.corresponding.replacementInput T mu R P.replacementBase + P.counterexample P.minimumContext.proper P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality P.minimumContext.largeMissingSet + have missingPen : + let Z := HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - 1) + alpha ∈ TreeMissingColors mu Z ∧ beta ∈ TreeMissingColors mu Z := by + let Z := HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - 1) + have hZT : TreeSequenceInitialSegment Z T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hZLen : Z.length = T.length - 1 := by + change min (A.length + ((T.length - A.length) - 1)) T.length = T.length - 1 + omega + have hBZ : TreeSequenceInitialSegment B Z := common hBT hZT (by omega) + exact ⟨missingMono hBZ haB, missingMono hBZ hbB⟩ + have change := ChangeLemma G k e0 P.corresponding.replacementInput T mu R + P.replacementBase P.counterexample P.minimumContext.proper + P.minimumContext.oneEdgeUncolored P.minimumContext.lowerRung + P.minimumContext.fewerDividers P.minimumContext.lexicographicMinimality + helem P.minimumContext.largeMissingSet alpha beta hab missingPen + (by + dsimp only + exact fun h => False.elim (h.elim (fun ha => ha haA) (fun hb => hb hbA))) + obtain ⟨hsame, hinter⟩ := change.2.2 ⟨haA, haclosed⟩ + let va := T.vertex (HierarchyFirstMissingPosition mu T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition mu T beta) + have vaB : va ∈ TreeSequenceVertexSet B := by + let ia : Fin (B.length + 1) := + ⟨(HierarchyFirstMissingPosition mu T alpha).val, + Nat.lt_succ_of_le (firstBound hBT alpha haB)⟩ + have hi : Fin.castLE (Nat.succ_le_succ hBT.1) ia = + HierarchyFirstMissingPosition mu T alpha := Fin.ext rfl + rw [show va = B.vertex ia by rw [← hBT.2.1 ia, hi]] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨ia, rfl⟩ + have vbB : vb ∈ TreeSequenceVertexSet B := by + let ib : Fin (B.length + 1) := + ⟨(HierarchyFirstMissingPosition mu T beta).val, + Nat.lt_succ_of_le (firstBound hBT beta hbB)⟩ + have hi : Fin.castLE (Nat.succ_le_succ hBT.1) ib = + HierarchyFirstMissingPosition mu T beta := Fin.ext rfl + rw [show vb = B.vertex ib by rw [← hBT.2.1 ib, hi]] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨ib, rfl⟩ + have hva : alpha ∈ MissingColors G mu va := + firstMem T alpha (lt_of_le_of_lt (firstBound hBT alpha haB) + (lt_of_lt_of_le (by omega : B.length < X.length) hXT.1)) + have hvb : beta ∈ MissingColors G mu vb := + firstMem T beta (lt_of_le_of_lt (firstBound hBT beta hbB) + (lt_of_lt_of_le (by omega : B.length < X.length) hXT.1)) + have elemA : ColoredVertexSetElementary G mu (TreeSequenceVertexSet A) := by + intro v hv w hw hne + have hZT : TreeSequenceInitialSegment + (HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - 1)) T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hAZ : TreeSequenceInitialSegment A + (HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - 1)) := + common hAT hZT (by + change A.length ≤ min (A.length + ((T.length - A.length) - 1)) T.length + omega) + exact helem (TreeSequenceInitialSegmentVertexSetSubset hAZ hv) + (TreeSequenceInitialSegmentVertexSetSubset hAZ hw) hne + have vaA : va ∈ TreeSequenceVertexSet A := by rw [hABeq]; exact vaB + have vbA : vb ∈ TreeSequenceVertexSet A := by rw [hABeq]; exact vbB + obtain ⟨hdis, hyPath, hswap⟩ := P2905_T2_ElementaryTerminalComponent + G mu alpha beta hab P.minimumContext.proper (TreeSequenceVertexSet A) + elemA va vb y vaA vbA (fun he => hyB (he ▸ vaB)) + (fun he => hyB (he ▸ vbB)) hva hvb (Or.inl hay) hsame + have vaPath : TwoColorPathComponent G mu alpha beta (Sum.inl va) := by + let J := TwoColorIncidenceGraph G mu alpha beta + let : Fintype (J.neighborSet (Sum.inl va)) := Fintype.ofFinite _ + have hd := MissingColorIncidenceEndpoint G mu alpha beta hab + P.minimumContext.proper va hva + have hc : Fintype.card (J.neighborSet (Sum.inl va)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hd + refine ⟨hab, Sum.inl va, by rfl, ?_⟩ + intro z hz w hw + exact congrArg Subtype.val (Fintype.card_le_one_iff.mp hc ⟨z, hz⟩ ⟨w, hw⟩) + have hmeetA : ∃ u ∈ TreeSequenceVertexSet A, + Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y) := by + rw [hABeq] + exact hmeet + have heq := hinter (Sum.inl y) (Sum.inl va) hyPath vaPath hmeetA + ⟨va, vaA, by rfl⟩ + exact Set.disjoint_left.mp hdis (heq.symm ▸ (show + Sum.inl va ∈ TwoColorComponent G mu alpha beta (Sum.inl va) by rfl)) (by rfl) + +private theorem helper_branch_567.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ( + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S S) → + B.length = A.length + (j - (2 : ℕ)) → + X.length = A.length + (j - (1 : ℕ)) → + TreeSequenceInitialSegment B X → + X.length = B.length + (1 : ℕ) → + y ∉ TreeSequenceVertexSet B → + alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ))) → + beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ))) → + alpha ≠ beta → + ( + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + ¬∃ u ∈ TreeSequenceVertexSet B, + Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y)) → + (∃ u ∈ TreeSequenceVertexSet B, + Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y)) → + ∃ (S : TreeSequence G e0) (U : TreeSequence G e0), + TreeSequenceInitialSegment B S ∧ + TreeSequenceInitialSegment S X ∧ + TreeSequenceInitialSegment S U ∧ + S.length < U.length ∧ + TashkinovAugmentationSequence mu S U ∧ + U.vertex (Fin.last U.length) = y ∧ + ( + ∀ (r : Fin U.length), + S.length ≤ (↑r : ℕ) → + mu (U.edge r) = some alpha ∨ mu (U.edge r) = some beta) ∧ + ( + ∀ (r : Fin U.length), + X.length ≤ (↑r : ℕ) → + G.ends (U.edge r) = s(U.vertex r.castSucc, U.vertex r.succ)) ∧ + ( + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + S = X) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H R mu n q A j B X y reflSeg + hBLen hXLen hBX hBXLen hyB haB hbB hab exceptional hmeet + obtain ⟨u, U, hu, huQ, hBU, hlen, haug, hlast, hnew⟩ := + TwoColorComponentTashkinovSplice G mu B alpha beta y + P.minimumContext.proper hab haB hbB hyB hmeet + refine ⟨B, U, reflSeg _, hBX, hBU, hlen, haug, hlast, + fun r hr => (hnew r hr).2.2.2.1, ?_, ?_⟩ + · intro r hr + have hn := (hnew r (by omega)).2.2.2.2 + rw [ite_eq_right (by omega)] at hn + exact hn + · intro hz hj hk + exact False.elim (exceptional hz hj hk hmeet) + +private theorem helper_branch_578.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + ∀ (j : ℕ), + ( + let j : ℕ := j; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∃ u ∈ TreeSequenceVertexSet X, + Sum.inl u ∈ + TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length)))) → + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ( + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S S) → + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + TreeSequenceInitialSegment B X → + X.length = B.length + (1 : ℕ) → + y ∉ TreeSequenceVertexSet X → + alpha ≠ beta → + alpha ∈ TreeMissingColors mu X → + beta ∈ TreeMissingColors mu X → + (¬∃ u ∈ TreeSequenceVertexSet B, + Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y)) → + ∃ (S : TreeSequence G e0) (U : TreeSequence G e0), + TreeSequenceInitialSegment B S ∧ + TreeSequenceInitialSegment S X ∧ + TreeSequenceInitialSegment S U ∧ + S.length < U.length ∧ + TashkinovAugmentationSequence mu S U ∧ + U.vertex (Fin.last U.length) = y ∧ + ( + ∀ (r : Fin U.length), + S.length ≤ (↑r : ℕ) → + mu (U.edge r) = some alpha ∨ mu (U.edge r) = some beta) ∧ + ( + ∀ (r : Fin U.length), + X.length ≤ (↑r : ℕ) → + G.ends (U.edge r) = s(U.vertex r.castSucc, U.vertex r.succ)) ∧ + ( + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + S = X) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H R mu n j hintersection B X y + reflSeg trans hBX hBXLen hyX hab haX hbX hmeet + obtain ⟨u, U, hu, huQ, hXU, hlen, haug, hlast, hnew⟩ := + TwoColorComponentTashkinovSplice G mu X alpha beta y + P.minimumContext.proper hab haX hbX hyX hintersection + have huLast : u = X.vertex (Fin.last X.length) := by as_aux_lemma => + clear * - hmeet hBX hBXLen hu huQ + obtain ⟨i, hi⟩ : ∃ i, X.vertex i = u := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hu + by_cases hh : i.val ≤ B.length + · have hb : u ∈ TreeSequenceVertexSet B := by + let ib : Fin (B.length + 1) := ⟨i.val, by omega⟩ + have hc : Fin.castLE (Nat.succ_le_succ hBX.1) ib = i := Fin.ext rfl + rw [← hi, ← hc, hBX.2.1 ib] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨ib, rfl⟩ + exact False.elim (hmeet ⟨u, hb, huQ⟩) + · have he : i = Fin.last X.length := Fin.ext (by + change i.val = X.length + have := i.isLt + omega) + exact hi.symm.trans (congrArg X.vertex he) + refine ⟨X, U, hBX, reflSeg _, hXU, hlen, haug, hlast, + fun r hr => (hnew r hr).2.2.2.1, ?_, fun _ _ _ => rfl⟩ + intro r hr + have hn := (hnew r hr).2.2.2.2 + by_cases he : r.val = X.length + · rw [ite_eq_left he, huLast] at hn + have hv : U.vertex r.castSucc = X.vertex (Fin.last X.length) := by + have hi : Fin.castLE (Nat.succ_le_succ hXU.1) (Fin.last X.length) = + r.castSucc := Fin.ext he.symm + rw [← hi, hXU.2.1] + rw [hv] + exact hn + · rw [ite_eq_right he] at hn + exact hn + +private theorem helper_branch_636.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ), + (2 : ℕ) ≤ j → + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + ( + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U) → + HierarchyPathNumber H = j → + ( + ∀ (b : ℕ) (hb : b < H.dividerCount + (2 : ℕ)) (a : Fin (H.dividerCount + (2 : ℕ))), + (↑a : ℕ) ≤ b → + TreeSequenceInitialSegment (H.stage a) + (H.stage (⟨b, hb⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ( + H.dividerCount = (0 : ℕ) → + A = P.replacementBase.core) → + ( + H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + B.length = A.length + (j - (2 : ℕ)) → + X.length = A.length + (j - (1 : ℕ)) → + X.length = B.length + (1 : ℕ) → + beta ≠ alpha → + alpha ≠ beta → + ( + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + ¬∃ u ∈ TreeSequenceVertexSet B, + Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y)) → + ∀ (S U : TreeSequence G e0), + TreeSequenceInitialSegment B S → + TashkinovAugmentationSequence mu S U → + ( + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + S = X) → + TreeSequenceInitialSegment S T → + TreeSequenceInitialSegment A S → + R.series.data.kind (Fin.last R.rounds) = some TashkinovExtensionKind.SE ∨ + R.series.data.kind (Fin.last R.rounds) = some TashkinovExtensionKind.RE → + ∀ (f : E) (seed : TreeSequence G e0), + R.series.data.connectingEdges (Fin.last R.rounds) = ({ f } : Finset E) → + TreeSequenceAdjoinEdge (R.series.data.tree (Fin.last R.rounds).castSucc) f seed → + TashkinovAugmentationSequence mu seed T → + R.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu Tn U ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + R.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence mu seed U := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H R mu n Tn q A j hpathLower B + X y trans common hpOld chain lastZero lastPositive hBLen hXLen hBXLen hba hab exceptional S + U hBS hSUaug hScorner hST hAS hkind f seed hedges hadjoin haug + have hnonpe : R.series.data.kind n ≠ some TashkinovExtensionKind.PE := by + rcases hkind with h | h <;> rw [h] <;> decide + have hseedT := TashkinovAugmentationSequenceInitialSegment mu seed T haug + have hseedLen : seed.length = Tn.length + 1 := hadjoin.1 + have hseedS : TreeSequenceInitialSegment seed S := by + apply common hseedT hST + by_cases hz : H.dividerCount = 0 + · have hAeq : A = Tn := (lastZero hz).trans (P.replacementBase.nonparallel hnonpe) + have hAlem : A.length = Tn.length := congrArg TreeSequence.length hAeq + by_cases hj : j = 2 + · have hseq := hScorner hz hj hnonpe + rw [hseq] + omega + · have hbs := hBS.1 + omega + · obtain ⟨r, hr, he⟩ := HierarchyNonparallelFirstEdge H f hkind hedges + change r.val = Tn.length at hr + have hfirstA : TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) A := by + rw [lastPositive hz] + exact chain H.dividerCount (by omega) ⟨1, by omega⟩ + (by change 1 ≤ H.dividerCount; omega) + have hf := r.isLt + have hfa := hfirstA.1 + have has := hAS.1 + omega + exact Or.inr ⟨hkind, f, seed, hedges, hadjoin, + (TashkinovAugmentationSequenceRestrict mu seed S T haug hseedS hST).trans hSUaug⟩ + +private theorem helper_branch_699.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ∀ (newInput : PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k R.rounds e0 newInput), + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) → + TreeMissingColors (newSeries.data.coloring n) (newSeries.data.tree n.castSucc) = + TreeMissingColors (R.series.data.coloring n) Tn → + (Finset.univ.biUnion fun (h : Fin (R.rounds + (1 : ℕ))) ↦ + if (↑h : ℕ) ≤ (↑n : ℕ) then newSeries.data.stored h else ∅) \ + TreeMissingColors (newSeries.data.coloring n) (newSeries.data.tree n.castSucc) = + (Finset.univ.biUnion fun (h : Fin (R.rounds + (1 : ℕ))) ↦ + if (↑h : ℕ) ≤ (↑n : ℕ) then R.series.data.stored h else ∅) \ + TreeMissingColors (R.series.data.coloring n) (R.series.data.tree n.castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P R n Tn newInput newSeries hstored hmissing + rw [hmissing] + congr 1 + apply congrArg (Finset.univ.biUnion) + funext i + rw [hstored i] + +private theorem helper_stageA_704.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ℕ), + ( + ∀ (b : ℕ) (hb : b < H.dividerCount + (2 : ℕ)) (a : Fin (H.dividerCount + (2 : ℕ))), + (↑a : ℕ) ≤ b → + TreeSequenceInitialSegment (H.stage a) + (H.stage (⟨b, hb⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ( + H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment Tn A → + ∀ (_ U : TreeSequence G e0) (newInput : PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k R.rounds e0 newInput), + mu = newSeries.data.coloring (Fin.last R.rounds) → + ( + ∀ (i : Fin R.rounds), + newSeries.data.tree i.succ.castSucc = R.series.data.tree i.succ.castSucc) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = R.series.data.connectingEdges i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.kind i = R.series.data.kind i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) → + ( + ∀ (i : Fin R.rounds), + StableColoring (R.series.data.tree i.succ.castSucc) + (TashkinovStoredColors R.series.data i.succ) (R.series.data.coloring i.succ) + (newSeries.data.coloring i.succ)) → + ∀ (roundsPositive : (1 : ℕ) ≤ R.1) + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨R.1, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (R.1 + (2 : ℕ)))) + U) + (strict : + (newSeries.data.tree + (⟨R.1, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (R.1 + (2 : ℕ)))).length < + U.length) + (below : + TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) + (generating : mu = newSeries.data.coloring (Fin.last R.1)), + { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := generating : + ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ + newSeries → + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 newInput U mu }; + ∀ (_ : HierarchyBase RU mu) (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage i.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu n Tn q A j chain lastPositive hTnA + S U newInput newSeries hgen htrees hstored hedges hkinds hproper hone hstable + roundsPositive above strict below generating hseries RU baseU i + by_cases hz : H.dividerCount = 0 + · have hi : i = 0 := Fin.ext (by have := i.isLt; omega) + rw [hi] + simpa only [Fin.castSucc_zero, H.baseStage] using hTnA + · rw [lastPositive hz] + exact chain H.dividerCount (by omega) i.castSucc + (Nat.le_of_lt_succ i.isLt) + +private theorem helper_hdivB_717.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + B.length = A.length + (j - (2 : ℕ)) → + X.length = A.length + (j - (1 : ℕ)) → + X.length = B.length + (1 : ℕ) → + ∀ (_ U : TreeSequence G e0) (newInput : PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k R.rounds e0 newInput), + mu = newSeries.data.coloring (Fin.last R.rounds) → + ( + ∀ (i : Fin R.rounds), + newSeries.data.tree i.succ.castSucc = R.series.data.tree i.succ.castSucc) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = R.series.data.connectingEdges i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.kind i = R.series.data.kind i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) → + ( + ∀ (i : Fin R.rounds), + StableColoring (R.series.data.tree i.succ.castSucc) + (TashkinovStoredColors R.series.data i.succ) (R.series.data.coloring i.succ) + (newSeries.data.coloring i.succ)) → + ∀ (roundsPositive : (1 : ℕ) ≤ R.1) + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨R.1, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (R.1 + (2 : ℕ)))) + U) + (strict : + (newSeries.data.tree + (⟨R.1, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (R.1 + (2 : ℕ)))).length < + U.length) + (below : + TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) + (generating : mu = newSeries.data.coloring (Fin.last R.1)), + { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := generating : + ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ + newSeries → + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 newInput U mu }; + ∀ (_ : HierarchyBase RU mu), + ( + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage i.castSucc) B) → + ∀ (i : Fin H.dividerCount), + (↑(H.dividerPosition i) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu q A j B X hBLen hXLen hBXLen S U + newInput newSeries hgen htrees hstored hedges hkinds hproper hone hstable roundsPositive + above strict below generating hseries RU baseU stageB i + have hl := congrArg TreeSequence.length (H.dividerStage i) + change (H.stage ⟨i.val + 1, by omega⟩).length = (H.dividerPosition i).val at hl + have hs := (stageB i.succ).1 + change (H.stage ⟨i.val + 1, by omega⟩).length ≤ B.length at hs + omega + +private theorem helper_newNested_748.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let _ : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ (_ : ℕ) (_ U : TreeSequence G e0) (newInput : PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k R.rounds e0 newInput), + mu = newSeries.data.coloring (Fin.last R.rounds) → + ( + ∀ (i : Fin R.rounds), + newSeries.data.tree i.succ.castSucc = R.series.data.tree i.succ.castSucc) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = R.series.data.connectingEdges i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.kind i = R.series.data.kind i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) → + ( + ∀ (i : Fin R.rounds), + StableColoring (R.series.data.tree i.succ.castSucc) + (TashkinovStoredColors R.series.data i.succ) (R.series.data.coloring i.succ) + (newSeries.data.coloring i.succ)) → + ∀ (roundsPositive : (1 : ℕ) ≤ R.1) + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨R.1, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (R.1 + (2 : ℕ)))) + U) + (strict : + (newSeries.data.tree + (⟨R.1, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (R.1 + (2 : ℕ)))).length < + U.length) + (below : + TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) + (generating : mu = newSeries.data.coloring (Fin.last R.1)), + { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := generating : + ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ + newSeries → + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 newInput U mu }; + ∀ (_ : HierarchyBase RU mu), + ( + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage i.castSucc) U) → + let newStage : + Fin (H.dividerCount + (2 : ℕ)) → + TreeSequence G e0 := + fun (i : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑i : ℕ) = H.dividerCount + (1 : ℕ) then U else H.stage i; + ( + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + newStage i.castSucc = H.stage i.castSucc) → + newStage (Fin.last (H.dividerCount + (1 : ℕ))) = U → + ( + ∀ (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ H.dividerCount → + newStage i = H.stage i) → + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (newStage i.castSucc) (newStage i.succ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu q j S U newInput newSeries hgen + htrees hstored hedges hkinds hproper hone hstable roundsPositive above strict below + generating hseries RU baseU stageU newStage newStageOld newStageLast newStageAt i + by_cases hi : i.val = H.dividerCount + · have he : i = q := Fin.ext hi + rw [he, newStageOld, show q.succ = Fin.last (H.dividerCount + 1) from rfl, + newStageLast] + exact stageU q + · rw [newStageOld, newStageAt i.succ (by change i.val + 1 ≤ H.dividerCount; omega)] + exact H.nested i + +private theorem helper_newStrict_758.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ℕ) (_ U : TreeSequence G e0), + A.length < U.length → + ∀ (newInput : PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k R.rounds e0 newInput), + mu = newSeries.data.coloring (Fin.last R.rounds) → + ( + ∀ (i : Fin R.rounds), + newSeries.data.tree i.succ.castSucc = R.series.data.tree i.succ.castSucc) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = R.series.data.connectingEdges i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.kind i = R.series.data.kind i) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) → + ( + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) → + ( + ∀ (i : Fin R.rounds), + StableColoring (R.series.data.tree i.succ.castSucc) + (TashkinovStoredColors R.series.data i.succ) (R.series.data.coloring i.succ) + (newSeries.data.coloring i.succ)) → + ∀ (roundsPositive : (1 : ℕ) ≤ R.1) + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨R.1, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (R.1 + (2 : ℕ)))) + U) + (strict : + (newSeries.data.tree + (⟨R.1, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (R.1 + (2 : ℕ)))).length < + U.length) + (below : + TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) + (generating : mu = newSeries.data.coloring (Fin.last R.1)), + { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := generating : + ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ + newSeries → + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 newInput U mu }; + ∀ (_ : HierarchyBase RU mu), + ( + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage i.castSucc) A) → + let newStage : + Fin (H.dividerCount + (2 : ℕ)) → + TreeSequence G e0 := + fun (i : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑i : ℕ) = H.dividerCount + (1 : ℕ) then U else H.stage i; + ( + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + newStage i.castSucc = H.stage i.castSucc) → + newStage (Fin.last (H.dividerCount + (1 : ℕ))) = U → + ( + ∀ (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ H.dividerCount → + newStage i = H.stage i) → + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + (newStage i.castSucc).length < (newStage i.succ).length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu q A j S U hAUstrict newInput + newSeries hgen htrees hstored hedges hkinds hproper hone hstable roundsPositive above + strict below generating hseries RU baseU stageA newStage newStageOld newStageLast newStageAt i + by_cases hi : i.val = H.dividerCount + · have he : i = q := Fin.ext hi + rw [he, newStageOld, show q.succ = Fin.last (H.dividerCount + 1) from rfl, + newStageLast] + exact lt_of_le_of_lt (stageA q).1 hAUstrict + · rw [newStageOld, newStageAt i.succ (by change i.val + 1 ≤ H.dividerCount; omega)] + exact H.strict i + +private theorem helper_branch_850.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let mu : PartialEdgeColoring E k := P.coloring; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let _ : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (S U : TreeSequence G e0), + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment S T → + ( + ∀ (c : Fin k), + ∀ p ≤ S.length, + min (↑(HierarchyFirstMissingPosition mu U c) : ℕ) p = + min (↑(HierarchyFirstMissingPosition mu T c) : ℕ) p) → + ∀ eta ∈ HierarchyStoredColorsAt H q, + ∀ c ∈ P.counterexample.good.gamma q eta, + ∀ (r : Fin U.length), + (HierarchyStarredStage H q).length ≤ (↑r : ℕ) → + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition mu U eta) : ℕ) U.length → + mu (U.edge r) = some c → + (↑r : ℕ) < S.length → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H mu q A S U hSU hST cutoffEq eta heta c + hc r hrA hrp hrc hrS + let rs : Fin S.length := ⟨r.val, hrS⟩ + let rt : Fin T.length := Fin.castLE hST.1 rs + have hrU : Fin.castLE hSU.1 rs = r := Fin.ext rfl + have hcol : mu (T.edge rt) = some c := by + rw [hST.2.2 rs, ← hSU.2.2 rs, hrU] + exact hrc + have hcut := cutoffEq eta S.length le_rfl + have hrnew : r.val < min (HierarchyFirstMissingPosition mu U eta).val S.length := + lt_min (lt_min_iff.mp hrp).1 hrS + rw [hcut] at hrnew + have hold : c ∈ HierarchySegmentColors H q eta := by + change c ∈ Finset.univ.filter (fun c => ∃ t : Fin (H.stage q.succ).length, + A.length ≤ t.val ∧ + t.val < min (HierarchyFirstMissingPosition mu T eta).val + (H.stage q.succ).length ∧ mu ((H.stage q.succ).edge t) = some c) + rw [show H.stage q.succ = T by exact H.terminalStage] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, rt, hrA, + lt_min (lt_min_iff.mp hrnew).1 rt.isLt, hcol⟩ + exact (Finset.mem_sdiff.mp (P.counterexample.good.avoidance q eta heta hc)).2 hold + +private theorem helper_hnotElementary_940.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (j : ℕ), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + y ∉ TreeSequenceVertexSet B → + alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) → + alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ))) → + ∀ (U : TreeSequence G e0), + U.vertex (Fin.last U.length) = y → + TreeSequenceInitialSegment B U → + ¬ColoredVertexSetElementary G mu (TreeSequenceVertexSet U) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu j B y hyB hay haB U hUlast hBU + helem + obtain ⟨v, hv, hmissing⟩ := Finset.mem_biUnion.mp haB + have hvU := TreeSequenceInitialSegmentVertexSetSubset hBU hv + have hyU : y ∈ TreeSequenceVertexSet U := by + rw [← hUlast] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last U.length, rfl⟩ + have hne : v ≠ y := by + intro he + exact hyB (he ▸ hv) + exact Finset.disjoint_left.mp (helem hvU hyU hne) hmissing hay + +private theorem helper_hm_964.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + (2 : ℕ) ≤ j → + B.length = A.length + (j - (2 : ℕ)) → + X.length = A.length + (j - (1 : ℕ)) → + ∀ (S U : TreeSequence G e0), + TreeSequenceInitialSegment B S → + S.length < U.length → + ( + ∀ (r : Fin U.length), + X.length ≤ (↑r : ℕ) → + G.ends (U.edge r) = s(U.vertex r.castSucc, U.vertex r.succ)) → + ∀ (newInput : PartialEdgeColoring E k) (_ : TashkinovSeries G k R.rounds e0 newInput), + let candidates : Finset ℕ := + ({i ∈ Finset.Icc (1 : ℕ) (U.length - A.length) | + ∀ (r : Fin U.length), + A.length + i ≤ (↑r : ℕ) → + G.ends (U.edge r) = s(U.vertex r.castSucc, U.vertex r.succ)} : + Finset ℕ); + j - (1 : ℕ) ∈ candidates := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R q A j B X hjlow hBLen hXLen S U hBS + hSUstrict hUpath newInput newSeries candidates + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_Icc.mpr ⟨by omega, ?_⟩, ?_⟩ + · have hbs := hBS.1 + omega + · intro r hr + exact hUpath r (by omega) + +private theorem helper_sameLast_1457.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {a b : ℕ} + (s : + Fin (a + (2 : ℕ)) → + TreeSequence G e0) + (t : + Fin (b + (2 : ℕ)) → + TreeSequence G e0) (u v : TreeSequence G e0), + a = b → + s ≍ t → + u = v → + (Fin.cases u (fun (i : Fin a) ↦ s i.succ.castSucc) (Fin.last a) : TreeSequence G e0) = + (Fin.cases v (fun (i : Fin b) ↦ t i.succ.castSucc) (Fin.last b) : TreeSequence G e0) := by + classical + intro V E G e0 a b s t u v hab hst huv + cases hab + cases eq_of_heq hst + cases huv + rfl + +private theorem helper_exceptional_1691.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E + k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ + (_ : + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : + TreeSequenceInitialSegment U W), + TreeSequenceInitialSegment S W) + (_ : + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : + TreeSequenceInitialSegment U W) + (_ : S.length ≤ U.length), + TreeSequenceInitialSegment S U) + (_ : HierarchyPathNumber H = j) (_ : TreeSequenceInitialSegment A T) + (_ : + ∀ (_ : H.dividerCount = (0 : ℕ)), + A = P.replacementBase.core) + (_ : B.length = A.length + (j - (2 : ℕ))) (_ : X.length = A.length + (j - (1 : ℕ))) + (_ : TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - (2 : ℕ))) T) + (_ : TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - (1 : ℕ))) T) + (_ : TreeSequenceInitialSegment A B) (_ : X.length = B.length + (1 : ℕ)) (_ : X.length < + T.length) + (_ : y ∉ TreeSequenceVertexSet B) (_ : alpha ∈ MissingColors G P.coloring (T.vertex + (Fin.last T.length))) + (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ)))) (_ : + beta ≠ alpha) + (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ)))) (_ : + alpha ≠ beta) + (_ : + ∀ {S U : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U), + TreeMissingColors mu S ⊆ TreeMissingColors mu U) + (_ : + ∀ {S U : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : S.length = + U.length), + S = U) + (_ : + ∀ (W : TreeSequence G e0) (c : Fin k) (_ : (↑(HierarchyFirstMissingPosition mu W c) : ℕ) + < W.length), + c ∈ MissingColors G mu (W.vertex (HierarchyFirstMissingPosition mu W c))) + (_ : + ∀ {W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment W Z) (c : Fin k) + (_ : c ∈ TreeMissingColors mu W), + (↑(HierarchyFirstMissingPosition mu Z c) : ℕ) ≤ + W.length) + (_ : + ∀ (_ : R.series.data.kind n ≠ some TashkinovExtensionKind.PE), + ColoredVertexSetClosed G mu (TreeSequenceVertexSet Tn)), + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + ¬∃ u ∈ TreeSequenceVertexSet B, Sum.inl u ∈ TwoColorComponent G mu alpha beta + (Sum.inl y) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H R mu n Tn q A j B X y trans + common hpOld hAT lastZero hBLen hXLen hBT hXT hAB hBXLen hXshort hyB hay haB hba hbB hab + missingMono equalSeg firstMem firstBound nonparallelClosed + exact @helper_exceptional_436 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@j) (@trans) (@common) (@hpOld) (@hAT) (@lastZero) (@hBLen) (@hXLen) + (@hBT) (@hXT) (@hAB) (@hBXLen) (@hXshort) (@hyB) (@hay) (@haB) (@hba) (@hbB) (@hab) + (@missingMono) (@equalSeg) (@firstMem) (@firstBound) (@nonparallelClosed) + +private theorem helper_branch_1804.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ) (_ : (2 : ℕ) ≤ j), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let y : V := T.vertex (Fin.last T.length); + ∀ + (_ : + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : + TreeSequenceInitialSegment U W), + TreeSequenceInitialSegment S W) + (_ : + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : + TreeSequenceInitialSegment U W) + (_ : S.length ≤ U.length), + TreeSequenceInitialSegment S U) + (_ : HierarchyPathNumber H = j) + (_ : + ∀ (b : ℕ) (hb : b < H.dividerCount + (2 : ℕ)) (a : Fin (H.dividerCount + (2 : ℕ))), + (↑a : ℕ) ≤ b → + TreeSequenceInitialSegment (H.stage a) (H.stage (⟨b, hb⟩ : Fin + (H.dividerCount + (2 : ℕ))))) + (_ : + ∀ (_ : H.dividerCount = (0 : ℕ)), + A = P.replacementBase.core) + (_ : + ∀ (_ : H.dividerCount ≠ (0 : ℕ)), + A = + H.stage + (⟨H.dividerCount, by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (_ : B.length = A.length + (j - (2 : ℕ))) (_ : X.length = A.length + (j - (1 : ℕ))) + (_ : X.length = B.length + (1 : ℕ)) (_ : beta ≠ alpha) (_ : alpha ≠ beta) + (_ : + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + ¬∃ u ∈ TreeSequenceVertexSet B, Sum.inl u ∈ TwoColorComponent G mu alpha beta + (Sum.inl y)) + (S U : TreeSequence G e0) (_ : TreeSequenceInitialSegment B S) (_ : + TashkinovAugmentationSequence mu S U) + (_ : + H.dividerCount = (0 : ℕ) → + j = (2 : ℕ) → + R.series.data.kind n ≠ some + TashkinovExtensionKind.PE → + S = X) + (_ : TreeSequenceInitialSegment S T) (_ : TreeSequenceInitialSegment A S) + (_ : + R.series.data.kind (Fin.last R.rounds) = some TashkinovExtensionKind.SE ∨ + R.series.data.kind (Fin.last R.rounds) = some TashkinovExtensionKind.RE) + (f : E) (seed : TreeSequence G e0) (_ : R.series.data.connectingEdges (Fin.last R.rounds) + = ({f} : Finset E)) + (_ : TreeSequenceAdjoinEdge (R.series.data.tree (Fin.last R.rounds).castSucc) f seed) + (_ : TashkinovAugmentationSequence mu seed T), + R.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence mu + Tn U ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + R.series.data.connectingEdges n = ({f} : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence mu seed U := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H R mu n Tn q A j hpathLower B X + y trans common hpOld chain lastZero lastPositive hBLen hXLen hBXLen hba hab exceptional S U + hBS hSUaug hScorner hST hAS hkind f seed hedges hadjoin haug + exact @helper_branch_636 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@j) (@hpathLower) (@trans) (@common) (@hpOld) (@chain) (@lastZero) + (@lastPositive) (@hBLen) (@hXLen) (@hBXLen) (@hba) (@hab) (@exceptional) (@S) (@U) + (@hBS) (@hSUaug) (@hScorner) (@hST) (@hAS) (@hkind) (@f) (@seed) (@hedges) (@hadjoin) + (@haug) + +private theorem helper_stageB_1930.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (_ : B.length = A.length + (j - (2 : ℕ))) (_ : X.length = A.length + (j - (1 : ℕ))) + (_ : X.length = B.length + (1 : ℕ)) (_ U : TreeSequence G e0) (newInput : + PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k R.rounds e0 newInput) (_ : mu = newSeries.data.coloring + (Fin.last R.rounds)) + (_ : + ∀ (i : Fin R.rounds), + newSeries.data.tree i.succ.castSucc = R.series.data.tree + i.succ.castSucc) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = + R.series.data.connectingEdges i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.kind i = R.series.data.kind i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) + (_ : + ∀ (i : Fin R.rounds), + StableColoring (R.series.data.tree i.succ.castSucc) (TashkinovStoredColors + R.series.data i.succ) + (R.series.data.coloring i.succ) (newSeries.data.coloring i.succ)) + (roundsPositive : (1 : ℕ) ≤ R.1) + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨R.1, by + omega⟩ : + Fin (R.1 + (2 : ℕ)))) + U) + (strict : + (newSeries.data.tree + (⟨R.1, by + omega⟩ : + Fin (R.1 + (2 : ℕ)))).length < + U.length) + (below : TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) + (generating : mu = newSeries.data.coloring (Fin.last R.1)) + (_ : + { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, abovePenultimate + := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := + generating : + ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ + newSeries), + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := + generating : + ExtendedTashkinovTree G k e0 newInput U mu }; + ∀ (_ : HierarchyBase RU mu) + (_ : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage + i.castSucc) B) + (i : Fin H.dividerCount), + (↑(H.dividerPosition i) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu q A j B X hBLen hXLen hBXLen S U + newInput newSeries hgen htrees hstored hedges hkinds hproper hone hstable roundsPositive above + strict below generating hseries RU baseU stageB i + exact @helper_hdivB_717 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@hBLen) + (@hXLen) (@hBXLen) (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) + (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) + (@below) (@generating) (@hseries) (@baseU) (@stageB) (@i) + +private theorem helper_newNested_2040.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (_ : ℕ) (_ U : TreeSequence G e0) (newInput : PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k R.rounds e0 newInput) (_ : mu = newSeries.data.coloring + (Fin.last R.rounds)) + (_ : + ∀ (i : Fin R.rounds), + newSeries.data.tree i.succ.castSucc = R.series.data.tree + i.succ.castSucc) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = + R.series.data.connectingEdges i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.kind i = R.series.data.kind i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) + (_ : + ∀ (i : Fin R.rounds), + StableColoring (R.series.data.tree i.succ.castSucc) (TashkinovStoredColors R.series.data + i.succ) + (R.series.data.coloring i.succ) (newSeries.data.coloring i.succ)) + (roundsPositive : (1 : ℕ) ≤ R.1) + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨R.1, by + omega⟩ : + Fin (R.1 + (2 : ℕ)))) + U) + (strict : + (newSeries.data.tree + (⟨R.1, by + omega⟩ : + Fin (R.1 + (2 : ℕ)))).length < + U.length) + (below : TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) + (generating : mu = newSeries.data.coloring (Fin.last R.1)) + (_ : + { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, abovePenultimate + := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := + generating : + ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ + newSeries), + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := generating + : + ExtendedTashkinovTree G k e0 newInput U mu }; + ∀ (_ : HierarchyBase RU mu) + (_ : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage + i.castSucc) U), + let newStage : + Fin (H.dividerCount + (2 : ℕ)) → + TreeSequence G e0 := fun (i : Fin + (H.dividerCount + (2 : ℕ))) ↦ + if (↑i : ℕ) = H.dividerCount + (1 : ℕ) then U else H.stage i; + ∀ (_ : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + newStage i.castSucc = H.stage i.castSucc) + (_ : newStage (Fin.last (H.dividerCount + (1 : ℕ))) = U) + (_ : + ∀ (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : ℕ) ≤ H.dividerCount), + newStage i + = H.stage i) + (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (newStage i.castSucc) + (newStage i.succ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu j S U newInput newSeries hgen htrees + hstored hedges hkinds hproper hone hstable roundsPositive above strict below generating + hseries RU baseU stageU newStage newStageOld newStageLast newStageAt + exact @helper_newNested_748 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) + (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) (@hkinds) + (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) (@below) + (@generating) (@hseries) (@baseU) (@stageU) (@newStageOld) (@newStageLast) (@newStageAt) + +private theorem helper_newStrict_2123.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ℕ) (_ U : TreeSequence G e0) (_ : A.length < U.length) (newInput : PartialEdgeColoring + E k) + (newSeries : TashkinovSeries G k R.rounds e0 newInput) (_ : mu = newSeries.data.coloring + (Fin.last R.rounds)) + (_ : + ∀ (i : Fin R.rounds), + newSeries.data.tree i.succ.castSucc = R.series.data.tree + i.succ.castSucc) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = + R.series.data.connectingEdges i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.kind i = R.series.data.kind i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) + (_ : + ∀ (i : Fin R.rounds), + StableColoring (R.series.data.tree i.succ.castSucc) (TashkinovStoredColors R.series.data + i.succ) + (R.series.data.coloring i.succ) (newSeries.data.coloring i.succ)) + (roundsPositive : (1 : ℕ) ≤ R.1) + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨R.1, by + omega⟩ : + Fin (R.1 + (2 : ℕ)))) + U) + (strict : + (newSeries.data.tree + (⟨R.1, by + omega⟩ : + Fin (R.1 + (2 : ℕ)))).length < + U.length) + (below : TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) + (generating : mu = newSeries.data.coloring (Fin.last R.1)) + (_ : + { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, abovePenultimate + := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := + generating : + ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ + newSeries), + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := generating + : + ExtendedTashkinovTree G k e0 newInput U mu }; + ∀ (_ : HierarchyBase RU mu) + (_ : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage + i.castSucc) A), + let newStage : + Fin (H.dividerCount + (2 : ℕ)) → + TreeSequence G e0 := fun (i : Fin + (H.dividerCount + (2 : ℕ))) ↦ + if (↑i : ℕ) = H.dividerCount + (1 : ℕ) then U else H.stage i; + ∀ (_ : + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), + newStage i.castSucc = H.stage i.castSucc) + (_ : newStage (Fin.last (H.dividerCount + (1 : ℕ))) = U) + (_ : + ∀ (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : ℕ) ≤ H.dividerCount), + newStage i + = H.stage i) + (i : Fin (H.dividerCount + (1 : ℕ))), + (newStage i.castSucc).length < (newStage + i.succ).length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu q A j S U hAUstrict newInput + newSeries hgen htrees hstored hedges hkinds hproper hone hstable roundsPositive above strict + below generating hseries RU baseU stageA newStage newStageOld newStageLast newStageAt + exact @helper_newStrict_758 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) + (@S) (@U) (@hAUstrict) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) + (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) (@below) + (@generating) (@hseries) (@baseU) (@stageA) (@newStageOld) (@newStageLast) (@newStageAt) + +private theorem helper_stageA_2164.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ℕ) + (_ : + ∀ (b : ℕ) (hb : b < H.dividerCount + (2 : ℕ)) (a : Fin (H.dividerCount + (2 : ℕ))), + (↑a : ℕ) ≤ b → + TreeSequenceInitialSegment (H.stage a) (H.stage (⟨b, hb⟩ : Fin + (H.dividerCount + (2 : ℕ))))) + (_ : + ∀ (_ : H.dividerCount ≠ (0 : ℕ)), + A = + H.stage + (⟨H.dividerCount, by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (_ : TreeSequenceInitialSegment Tn A) (_ U : TreeSequence G e0) (newInput : + PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k R.rounds e0 newInput) (_ : mu = newSeries.data.coloring + (Fin.last R.rounds)) + (_ : + ∀ (i : Fin R.rounds), + newSeries.data.tree i.succ.castSucc = R.series.data.tree + i.succ.castSucc) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = + R.series.data.connectingEdges i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.kind i = R.series.data.kind i) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) + (_ : + ∀ (i : Fin R.rounds), + StableColoring (R.series.data.tree i.succ.castSucc) (TashkinovStoredColors R.series.data + i.succ) + (R.series.data.coloring i.succ) (newSeries.data.coloring i.succ)) + (roundsPositive : (1 : ℕ) ≤ R.1) + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨R.1, by + omega⟩ : + Fin (R.1 + (2 : ℕ)))) + U) + (strict : + (newSeries.data.tree + (⟨R.1, by + omega⟩ : + Fin (R.1 + (2 : ℕ)))).length < + U.length) + (below : TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) + (generating : mu = newSeries.data.coloring (Fin.last R.1)) + (_ : + { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, abovePenultimate + := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := + generating : + ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ + newSeries), + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, + abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := generating + : + ExtendedTashkinovTree G k e0 newInput U mu }; + ∀ (_ : HierarchyBase RU mu) (i : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage i.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu n Tn q A j chain lastPositive hTnA S + U newInput newSeries hgen htrees hstored hedges hkinds hproper hone hstable roundsPositive + above strict below generating hseries RU baseU i + exact @helper_stageA_704 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@chain) + (@lastPositive) (@hTnA) (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) + (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) + (@below) (@generating) (@hseries) (@baseU) (@i) + +private theorem helper_equalSeg_2078.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {S U : TreeSequence G e0} + (_ : TreeSequenceInitialSegment S U) (_ : S.length = U.length), + S = U := by + classical + intro V E G e0 S U hSU hlen + cases S with + | mk sl sp sv se svi sei sf sa => + exact @helper_branch_317 (@V) (@E) (@G) (@e0) (@U) (@sl) (@sp) (@sv) (@se) (@svi) + (@sei) (@sf) (@sa) (@hSU) (@hlen) + +private theorem helper_trans_1966.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {S U W : TreeSequence G + e0} + (_ : TreeSequenceInitialSegment S U) (_ : TreeSequenceInitialSegment U W), + TreeSequenceInitialSegment S W := by + classical + intro V E G e0 S U W hSU hUW + refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + +private theorem helper_stableClosed_2136.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) + (_ : + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : + TreeSequenceInitialSegment U W), + TreeSequenceInitialSegment S W) + (W : TreeSequence G e0) (D : Finset (Fin k)) (rho sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G rho) + (_ : IsOneEdgeUncolored rho e0) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) + (_ : StableColoring W D rho sigma) (_ : ColoredVertexSetClosed G rho (TreeSequenceVertexSet + W)), + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet W) := by + classical + intro V E _ _ G k e0 trans W D rho sigma hp ho hps hos hst hcl + clear * - W D rho sigma hp ho hps hos hst hcl + intro f c v hf hv hfc hmissing + have hm : c ∈ MissingColors G rho v := by + rw [← hst.2 v hv] + exact hmissing + have hinc : TreeIncidentEdge W f := by + exact @helper_hinc_377 (@V) (@E) inferInstance inferInstance (@G) (@e0) (@W) (@f) (@hf) + have heq := (sc1 G e0 W D rho sigma hp ho hps hos).mp hst f hinc + (Or.inr ⟨c, Finset.mem_union_left _ + (Finset.mem_biUnion.mpr ⟨v, hv, hm⟩), hfc⟩) + exact hcl hf hv (heq.symm.trans hfc) hm + +private theorem helper_common_2010.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (_ : + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : + TreeSequenceInitialSegment U W), + TreeSequenceInitialSegment S W) + {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : + TreeSequenceInitialSegment U W) + (_ : S.length ≤ U.length), + TreeSequenceInitialSegment S U := by + classical + intro V E G e0 trans S U W hSW hUW hlen + clear * - hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +private theorem helper_prefixEq_2316.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E + k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (j : ℕ), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ + (_ : + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : + TreeSequenceInitialSegment U W), + TreeSequenceInitialSegment S W) + (hBT : TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - (2 : ℕ))) T) (U : + TreeSequence G e0) + (hBU : TreeSequenceInitialSegment B U) (p : ℕ) (hp : (1 : ℕ) ≤ p) (hpB : p ≤ B.length), + TreeSequencePrefix U p hp (LE.le.trans hpB hBU.1) = TreeSequencePrefix T p hp (LE.le.trans + hpB hBT.1) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C j B trans hBT U hBU p hp hpB + clear * - hBU hBT p hp hpB + unfold TreeSequencePrefix + congr + · funext i + have hu := hBU.2.1 (Fin.castLE (Nat.succ_le_succ hpB) i) + have ht := hBT.2.1 (Fin.castLE (Nat.succ_le_succ hpB) i) + exact hu.trans ht.symm + · funext i + have hu := hBU.2.2 (Fin.castLE hpB i) + have ht := hBT.2.2 (Fin.castLE hpB i) + exact hu.trans ht.symm + +private theorem helper_firstLe_2171.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E + k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (W : TreeSequence G e0) (c : Fin k) (i : Fin (W.length + (1 : ℕ))) (_ : c ∈ MissingColors G + mu (W.vertex i)), + (↑(HierarchyFirstMissingPosition mu W c) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu W c i hi + let candidates := Finset.univ.filter fun t : Fin (W.length + 1) => + c ∈ MissingColors G mu (W.vertex t) + have hm : i ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ + have hn : candidates.Nonempty := ⟨i, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates i hm + +private theorem helper_ownerBound_2434.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E + k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (j : ℕ), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (_ : TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - (2 : ℕ))) T) + (_ : X.length = B.length + (1 : ℕ)) (_ : X.length < T.length) + (_ : + ∀ (W : TreeSequence G e0) (c : Fin k) (_ : (↑(HierarchyFirstMissingPosition mu W c) : ℕ) + < W.length), + c ∈ MissingColors G mu (W.vertex (HierarchyFirstMissingPosition mu W c))) + (_ : + ∀ {W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment W Z) (c : Fin k) + (_ : c ∈ TreeMissingColors mu W), + (↑(HierarchyFirstMissingPosition mu Z c) : ℕ) ≤ + W.length) + (U : TreeSequence G e0) (_ : TreeSequenceInitialSegment B U) (eta : Fin k) + (_ : (↑(HierarchyFirstMissingPosition mu T eta) : ℕ) ≤ B.length), + (↑(HierarchyFirstMissingPosition mu U eta) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu j B X hBT hBXLen hXshort firstMem + firstBound U hBU eta he + let i : Fin (B.length + 1) := + ⟨(HierarchyFirstMissingPosition mu T eta).val, Nat.lt_succ_of_le he⟩ + have hi : Fin.castLE (Nat.succ_le_succ hBT.1) i = + HierarchyFirstMissingPosition mu T eta := Fin.ext rfl + have hm : eta ∈ MissingColors G mu (B.vertex i) := by + rw [← hBT.2.1 i, hi] + apply firstMem T eta + omega + apply firstBound hBU eta + apply Finset.mem_biUnion.mpr + refine ⟨B.vertex i, ?_, hm⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, rfl⟩ + +private theorem helper_hstoredEq_2380.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E + k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let mu : PartialEdgeColoring E k := P.coloring; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ∀ (newInput : PartialEdgeColoring E k) (newSeries : TashkinovSeries G k R.rounds e0 newInput) + (_ : mu = newSeries.data.coloring (Fin.last R.rounds)) + (_ : + ∀ (i : Fin (R.rounds + (1 : ℕ))), + newSeries.data.stored i = R.series.data.stored i) + (_ : newSeries.data.tree n.castSucc = Tn), + TashkinovStoredColors newSeries.data n = TashkinovStoredColors R.series.data n := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P R mu n Tn newInput newSeries hgen hstored + hTnEq + have hmissing : TreeMissingColors (newSeries.data.coloring n) + (newSeries.data.tree n.castSucc) = + TreeMissingColors (R.series.data.coloring n) Tn := by + rw [← hgen, ← R.generatingColoring, hTnEq] + unfold TashkinovStoredColors + split + · rfl + · exact @helper_branch_699 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@newInput) (@newSeries) (@hstored) (@hmissing) + +private theorem helper_prefixLen_2218.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E + k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + ∀ (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A) + (_ : ell = T.length - A.length) (_ : TreeSequenceInitialSegment A T) (r : ℕ) (_ : r ≤ ell), + (HierarchyFullTailPrefix C r).length = A.length + r := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A ell hAold hell hAT r hr + change min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + r) T.length = _ + rw [hAold] + apply Nat.min_eq_left + have hlen := hAT.1 + omega + +private theorem helper_missingMono_2274.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E + k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ {S U : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U), + TreeMissingColors mu S ⊆ + TreeMissingColors mu U := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu S U hSU c hc + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hSU hv, hm⟩ + +private theorem helper_hTnCore_2254.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E + k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ∀ (_ : + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S S), + TreeSequenceInitialSegment Tn P.replacementBase.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P R n Tn reflSeg + by_cases hpe : R.series.data.kind n = some TashkinovExtensionKind.PE + · exact (P.replacementBase.parallel hpe).2.2.some.leftSegment + · rw [P.replacementBase.nonparallel hpe] + exact reflSeg _ + +private theorem helper_hAold_2232.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E + k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (j : ℕ) (_ : HierarchyPathNumber C.hierarchy = j) + (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A), + HierarchyPathNumber H = j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A j hjdef hAold + rw [← hjdef] + unfold HierarchyPathNumber + dsimp only + rw [hAold] + +private theorem helper_continuation_2608.{u_1, u_2} : + helperContinuation2608Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H R mu n Tn q A j hpathLower B X + y trans hpOld hjlow coreA hBLen hXLen hBT hyB hay haB hba hab exceptional S U hBS hSUstrict + hUlast hUpath hScorner hAU hBU newInput newSeries hgen htrees hstored hedges hkinds hproper + hone hstable roundsPositive above strict below generating hseries RU baseU hcore hclosure hMP + hTnEq stageB hdivB prefixEq newStage newStageLast newStageAt newNested newStrict K stageEq + starredEq storedEq missingEq cutoffEq lastAvoidance + have earlierSegment (i : Fin (H.dividerCount + 1)) (hi : i.val < H.dividerCount) + (eta : Fin k) : HierarchySegmentColors K i eta = HierarchySegmentColors H i eta := by + have hnext : K.stage i.succ = H.stage i.succ := + newStageAt i.succ (by change i.val + 1 ≤ H.dividerCount; omega) + have hnextB : (H.stage i.succ).length ≤ B.length := by + have he : i.succ = (⟨i.val + 1, by omega⟩ : Fin (H.dividerCount + 1)).castSucc := + Fin.ext rfl + rw [he] + exact (stageB _).1 + have hcut := cutoffEq eta (H.stage i.succ).length (hnextB.trans hBS.1) + unfold HierarchySegmentColors + dsimp only + rw [starredEq i, hnext, hcut] + let goodU : GoodHierarchy K := by + exact { + gamma := P.counterexample.good.gamma + twoColors := by + intro i eta heta + exact P.counterexample.good.twoColors i eta (by rw [← storedEq i]; exact heta) + avoidance := by + intro i eta heta c hc + have hstored := (storedEq i) ▸ heta + have hold := P.counterexample.good.avoidance i eta hstored hc + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · rw [missingEq] + exact (Finset.mem_sdiff.mp hold).1 + · by_cases hi : i.val = H.dividerCount + · have he : i = q := Fin.ext hi + subst i + exact lastAvoidance eta hstored c hc + · rw [earlierSegment i (by omega)] + exact (Finset.mem_sdiff.mp hold).2 + disjointPairs := by + intro i eta theta heta htheta hne + exact P.counterexample.good.disjointPairs i eta theta + ((storedEq i) ▸ heta) ((storedEq i) ▸ htheta) hne + uniqueRefresh := by + intro i + rw [stageEq i.succ, starredEq i.castSucc, storedEq i.succ] + exact P.counterexample.good.uniqueRefresh i + parallelBase := by + change newSeries.data.kind n = some TashkinovExtensionKind.PE → _ + rw [hkinds n] + intro hpe + change ¬ TreeColorSetMinusClosed G mu baseU.core + ((HierarchyStoredColorsAt K 0).biUnion (P.counterexample.good.gamma 0)) ∧ _ + rw [hcore, hclosure, storedEq 0, hTnEq] + exact P.counterexample.good.parallelBase hpe + minusClosed := by + intro i + rw [stageEq i.succ, storedEq i.succ] + exact P.counterexample.good.minusClosed i } + have hnotElementary : ¬ ColoredVertexSetElementary G mu (TreeSequenceVertexSet U) := by + exact @helper_hnotElementary_940 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@j) (@hyB) (@hay) (@haB) (@U) (@hUlast) (@hBU) + let CU : HierarchyCounterexample baseU := + { positive := P.counterexample.positive + hierarchy := K + good := goodU + maximum := hMP + notElementary := hnotElementary } + -- The possibly internal first attachment lies before this candidate suffix. + have hpU : HierarchyPathNumber K ≤ j - 1 := by as_aux_lemma => + clear * - K starredEq hUpath hXLen hBLen hSUstrict hBS hjlow + let candidates := (Finset.Icc 1 (U.length - A.length)).filter fun i => + ∀ r : Fin U.length, A.length + i ≤ r.val → + G.ends (U.edge r) = s(U.vertex r.castSucc, U.vertex r.succ) + have hm : j - 1 ∈ candidates := by + exact @helper_hm_964 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@hjlow) + (@hBLen) (@hXLen) (@S) (@U) (@hBS) (@hSUstrict) (@hUpath) (@newInput) (@newSeries) + have hn : candidates.Nonempty := ⟨j - 1, hm⟩ + unfold HierarchyPathNumber + dsimp only + rw [starredEq (Fin.last H.dividerCount)] + change (if h : candidates.Nonempty then candidates.min' h else U.length - A.length) ≤ j - 1 + rw [dite_eq_left hn] + exact Finset.min'_le candidates (j - 1) hm + have hless : HierarchyCounterexampleLess (HierarchyCounterexampleMeasure CU) + (HierarchyCounterexampleMeasure P.counterexample) := by + apply Or.inl + change HierarchyPathNumber K < HierarchyPathNumber H + rw [hpOld] + omega + exact P.minimumContext.lexicographicMinimality CU rfl rfl hless + +private theorem helper_continuation_2763.{u_1, u_2} : + helperContinuation2763Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H R mu n Tn q A j hpathLower B X + y trans hpOld hjlow coreA hBLen hXLen hBT hBXLen hXshort hyB hay haB haChoice hba hbGamma hab + firstMem firstBound exceptional S U hBS hSU hSUstrict hUlast hUcolors hUpath hScorner hST hAU + hBU hAUstrict newInput newSeries hgen htrees hstored hedges hkinds hproper hone hstable + roundsPositive above strict below generating hseries RU baseU hcore hclosure hMP hTnEq + hstoredEq stageA stageU stageB hdivB prefixEq newStage newStageOld newStageLast newStageAt + have newNested : ∀ i : Fin (H.dividerCount + 1), + TreeSequenceInitialSegment (newStage i.castSucc) (newStage i.succ) := by + exact @helper_newNested_2040 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@S) (@U) + (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) (@hkinds) (@hproper) (@hone) + (@hstable) (@roundsPositive) (@above) (@strict) (@below) (@generating) (@hseries) (@baseU) + (@stageU) (@newStageOld) (@newStageLast) (@newStageAt) + have newStrict : ∀ i : Fin (H.dividerCount + 1), + (newStage i.castSucc).length < (newStage i.succ).length := by + exact @helper_newStrict_2123 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@S) (@U) + (@hAUstrict) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) (@hkinds) + (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) (@below) (@generating) + (@hseries) (@baseU) (@stageA) (@newStageOld) (@newStageLast) (@newStageAt) + let K : TashkinovHierarchy RU baseU := by + exact { + dividerCount := H.dividerCount + stage := newStage + baseStage := by + rw [show newStage 0 = H.stage 0 by simp [newStage], H.baseStage] + exact hTnEq.symm + terminalStage := newStageLast + nested := newNested + strict := newStrict + dividerPosition := fun i => ⟨(H.dividerPosition i).val, + Nat.lt_succ_of_le ((hdivB i).trans hBU.1)⟩ + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := by + intro i + rw [newStageAt ⟨i.val + 1, by omega⟩ (Nat.succ_le_of_lt i.isLt)] + rw [prefixEq (H.dividerPosition i).val (H.dividerPositive i) (hdivB i)] + exact H.dividerStage i + coreInsideFirst := by + rw [hcore] + by_cases hz : H.dividerCount = 0 + · rw [show newStage ⟨1, by omega⟩ = U by simp [newStage, hz]] + exact trans coreA hAU + · rw [newStageAt ⟨1, by omega⟩ (Nat.one_le_iff_ne_zero.mpr hz)] + exact H.coreInsideFirst } + have stageEq (i : Fin (H.dividerCount + 1)) : K.stage i.castSucc = H.stage i.castSucc := + newStageOld i + have starredEq (i : Fin (H.dividerCount + 1)) : + HierarchyStarredStage K i = HierarchyStarredStage H i := by + refine Fin.cases ?_ (fun i => ?_) i + · exact hcore + · exact stageEq i.succ + have storedEq (i : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt K i = HierarchyStoredColorsAt H i := by + change TashkinovStoredColors newSeries.data n \ + TreeMissingColors mu (HierarchyStarredStage K i) = _ + rw [hstoredEq, starredEq] + rfl + have missingEq (i : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors K i = HierarchyStageMissingColors H i := by + refine Fin.cases ?_ (fun i => ?_) i + · change TreeMissingColors mu (newSeries.data.tree n.castSucc) = _ + rw [hTnEq] + rfl + · change TreeMissingColors mu (K.stage i.succ.castSucc) = _ + rw [stageEq] + rfl + have cutoffEq (c : Fin k) (p : ℕ) (hp : p ≤ S.length) : + min (HierarchyFirstMissingPosition mu U c).val p = + min (HierarchyFirstMissingPosition mu T c).val p := + (HierarchyFirstMissingPositionPrefixCutoff mu S U hSU c p hp).symm.trans + (HierarchyFirstMissingPositionPrefixCutoff mu S T hST c p hp) + have ownerBound (eta : Fin k) + (he : (HierarchyFirstMissingPosition mu T eta).val ≤ B.length) : + (HierarchyFirstMissingPosition mu U eta).val ≤ B.length := by as_aux_lemma => + exact @helper_ownerBound_2434 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@hBT) (@hBXLen) + (@hXshort) (@firstMem) (@firstBound) (@U) (@hBU) (@eta) (@he) + -- Old edges retain their cutoff; appended colors are excluded from each pair. + have lastAvoidance (eta : Fin k) (heta : eta ∈ HierarchyStoredColorsAt H q) + (c : Fin k) (hc : c ∈ P.counterexample.good.gamma q eta) : + c ∉ HierarchySegmentColors K q eta := by as_aux_lemma => + clear * - heta hc hUcolors hSU hST hBS hBLen hXLen hXshort hBT + haChoice hbGamma ownerBound cutoffEq starredEq K H q A mu T U S B + intro hseg + unfold HierarchySegmentColors at hseg + dsimp only at hseg + rw [show K.stage q.succ = U from K.terminalStage] at hseg + obtain ⟨r, hrA, hrp, hrc⟩ := (Finset.mem_filter.mp hseg).2 + rw [starredEq q] at hrA + by_cases hrS : r.val < S.length + · exact @helper_branch_850 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@S) + (@U) (@hSU) (@hST) (@cutoffEq) (@eta) (@heta) (@c) (@hc) (@r) (@hrA) (@hrp) (@hrc) (@hrS) + · have hcolors := hUcolors r (by omega) + have he : c = alpha ∨ c = beta := by + rcases hcolors with h | h + · exact Or.inl (Option.some.inj (hrc.symm.trans h)) + · exact Or.inr (Option.some.inj (hrc.symm.trans h)) + rcases he with he | he + · subst c + rcases haChoice with hfree | ⟨theta, htheta, hatheta, hpos⟩ + · exact hfree (Finset.mem_union_left _ + (Finset.mem_biUnion.mpr ⟨eta, heta, hc⟩)) + · by_cases het : eta = theta + · subst theta + have hb := ownerBound eta hpos + have hbs := hBS.1 + have hrbefore := (lt_min_iff.mp hrp).1 + omega + · exact Finset.disjoint_left.mp + (P.counterexample.good.disjointPairs q eta theta heta htheta het) hc hatheta + · subst c + exact hbGamma (Finset.mem_biUnion.mpr ⟨eta, heta, hc⟩) + exact @helper_continuation_2608 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@j) + (@hpathLower) (@trans) (@hpOld) (@hjlow) (@coreA) (@hBLen) (@hXLen) (@hBT) (@hyB) (@hay) + (@haB) (@hba) (@hab) (@exceptional) (@S) (@U) (@hBS) (@hSUstrict) (@hUlast) (@hUpath) + (@hScorner) (@hAU) (@hBU) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) + (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) (@below) + (@generating) (@hseries) (@baseU) (@hcore) (@hclosure) (@hMP) (@hTnEq) (@stageB) (@hdivB) + (@prefixEq) (@newStageLast) (@newStageAt) (@newNested) (@newStrict) (@stageEq) (@starredEq) + (@storedEq) (@missingEq) (@cutoffEq) (@lastAvoidance) + +private theorem componentIntersectionFromSpliceFacts.{u_1, u_2} : + componentIntersectionFromSpliceFactsStatement.{u_1, u_2} := by + classical + open scoped Sym2 in + intro «V» «E» «inst» «inst» «inst» «inst» «G» «k» «e0» «input» «T» «phi» «ett» «base» «C» «ctx» + «P» «alpha» «beta» «H» «R» «mu» «n» «Tn» «q» «A» «j» «hintersection» «hjdef» «hpathLower» + «hpathUpper» «ell» «B» «X» «y» «reflSeg» «trans» «common» «sameLast» «hAold» «hpOld» «hell» + «hjlow» «hjhigh» «chain» «starNext» «hAT» «lastZero» «lastPositive» «coreA» «hTnCore» «hTnA» + «prefixT» «prefixLen» «hBLen» «hXLen» «hBT» «hXT» «hAB» «hBX» «hAX» «hTnB» «hTnX» «hBXLen» + «hXshort» «hyX» «hyB» «hay» «haB» «haChoice» «hba» «hbB» «hbGamma» «hbUnused» «hbChoice» + «hab» «missingMono» «haX» «hbX» «equalSeg» «firstLe» «firstMem» «firstBound» «stableClosed» + «nonparallelClosed» «hmod» «exceptional» + have splice : ∃ (S U : TreeSequence G e0), + TreeSequenceInitialSegment B S ∧ TreeSequenceInitialSegment S X ∧ + TreeSequenceInitialSegment S U ∧ S.length < U.length ∧ + TashkinovAugmentationSequence mu S U ∧ + U.vertex (Fin.last U.length) = y ∧ + (∀ r : Fin U.length, S.length ≤ r.val → + mu (U.edge r) = some alpha ∨ mu (U.edge r) = some beta) ∧ + (∀ r : Fin U.length, X.length ≤ r.val → + G.ends (U.edge r) = s(U.vertex r.castSucc, U.vertex r.succ)) ∧ + (H.dividerCount = 0 → j = 2 → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → S = X) := by as_aux_lemma => + by_cases hmeet : ∃ u ∈ TreeSequenceVertexSet B, + Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y) + · exact @helper_branch_567 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@j) (@reflSeg) (@hBLen) (@hXLen) (@hBX) (@hBXLen) (@hyB) (@haB) + (@hbB) (@hab) (@exceptional) (@hmeet) + · exact @helper_branch_578 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@j) (@hintersection) (@reflSeg) (@trans) (@hBX) (@hBXLen) (@hyX) + (@hab) (@haX) (@hbX) (@hmeet) + obtain ⟨S, U, hBS, hSX, hSU, hSUstrict, hSUaug, hUlast, hUcolors, + hUpath, hScorner⟩ := splice + have hST := trans hSX hXT + have hAS := trans hAB hBS + have hAU := trans hAS hSU + have hBU := trans hBS hSU + have hAUstrict : A.length < U.length := lt_of_le_of_lt hAS.1 hSUstrict + have hTnS := trans hTnB hBS + have hTnU := trans hTnS hSU + have hTnUstrict : Tn.length < U.length := lt_of_le_of_lt hTnS.1 hSUstrict + -- Retain the actual last-series route before certifying the new terminal tree. + have hroute : + (R.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu Tn U) ∨ + ((R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + R.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence mu seed U) := by as_aux_lemma => + rcases P2813_T1_TerminalRoute G k e0 P.corresponding.replacementInput T mu R + with ⟨hpe, haug⟩ | ⟨hkind, f, seed, hedges, hadjoin, hinc, hcolor, haug⟩ + · exact Or.inl ⟨hpe, + (TashkinovAugmentationSequenceRestrict mu Tn S T haug hTnS hST).trans hSUaug⟩ + · exact @helper_branch_1804 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@j) + (@hpathLower) (@trans) (@common) (@hpOld) (@chain) (@lastZero) (@lastPositive) (@hBLen) + (@hXLen) (@hBXLen) (@hba) (@hab) (@exceptional) (@S) (@U) (@hBS) (@hSUaug) (@hScorner) + (@hST) (@hAS) (@hkind) (@f) (@seed) (@hedges) (@hadjoin) (@haug) + obtain ⟨corr⟩ := hmod.2.2 U hTnU hTnUstrict hroute + have hMP := MaximumPropertyTransport G k e0 R mu hmod U corr P.maximum + obtain ⟨baseU, hcore, hclosure, hsupport⟩ := HierarchyBaseCorrespondingTransport + G k e0 P.corresponding.replacementInput T U mu R corr P.replacementBase + rcases corr with ⟨newInput, newSeries, newETT, hround, hseries, hgen, + htrees, hstored, hedges, hkinds, hproper, hone, hstable⟩ + rcases newETT with ⟨rounds, roundsPositive, replacementSeries, + above, strict, below, generating⟩ + cases hround + have hseriesEq : replacementSeries = newSeries := eq_of_heq hseries + cases hseriesEq + let RU : ExtendedTashkinovTree G k e0 newInput U mu := + { rounds := R.rounds + roundsPositive := roundsPositive + series := newSeries + abovePenultimate := above + strictAbovePenultimate := strict + belowFinal := below + generatingColoring := generating } + change HierarchyBase RU mu at baseU + change MaximumProperty RU at hMP + have hTnEq : newSeries.data.tree n.castSucc = Tn := by + let z : Fin R.rounds := ⟨R.rounds - 1, by have := R.roundsPositive; omega⟩ + have hz : z.succ = n := Fin.ext (by have := R.roundsPositive; dsimp [z, n]; omega) + rw [← hz] + simpa only [Tn, ← hz] using htrees z + have hstoredEq : TashkinovStoredColors newSeries.data n = + TashkinovStoredColors R.series.data n := by as_aux_lemma => + exact @helper_hstoredEq_2380 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@newInput) + (@newSeries) (@hgen) (@hstored) (@hTnEq) + have stageA (i : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage i.castSucc) A := by + exact @helper_stageA_2164 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@chain) + (@lastPositive) (@hTnA) (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) + (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) + (@below) (@generating) (@hseries) (@baseU) (@i) + have stageU (i : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage i.castSucc) U := trans (stageA i) hAU + have stageB (i : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage i.castSucc) B := trans (stageA i) hAB + have hdivB (i : Fin H.dividerCount) : (H.dividerPosition i).val ≤ B.length := by + exact @helper_stageB_1930 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@hBLen) + (@hXLen) (@hBXLen) (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) + (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) + (@below) (@generating) (@hseries) (@baseU) (@stageB) (@i) + have prefixEq (p : ℕ) (hp : 1 ≤ p) (hpB : p ≤ B.length) : + TreeSequencePrefix U p hp (hpB.trans hBU.1) = + TreeSequencePrefix T p hp (hpB.trans hBT.1) := by as_aux_lemma => + exact @helper_prefixEq_2316 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@j) (@trans) (@hBT) (@U) (@hBU) + (@p) (@hp) (@hpB) + -- Only the terminal hierarchy stage changes. + let newStage : Fin (H.dividerCount + 2) → TreeSequence G e0 := + fun i => if i.val = H.dividerCount + 1 then U else H.stage i + have newStageOld (i : Fin (H.dividerCount + 1)) : + newStage i.castSucc = H.stage i.castSucc := by + simp only [newStage, Fin.val_castSucc, ite_eq_right (Nat.ne_of_lt i.isLt)] + have newStageLast : newStage (Fin.last (H.dividerCount + 1)) = U := by + simp only [newStage, Fin.val_last, ite_true] + have newStageAt (i : Fin (H.dividerCount + 2)) (hi : i.val ≤ H.dividerCount) : + newStage i = H.stage i := by + simp only [newStage, ite_eq_right (by omega : i.val ≠ H.dividerCount + 1)] + exact @helper_continuation_2763 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@j) (@hpathLower) (@trans) (@hpOld) (@hjlow) (@coreA) (@hBLen) (@hXLen) (@hBT) + (@hBXLen) (@hXshort) (@hyB) (@hay) (@haB) (@haChoice) (@hba) (@hbGamma) (@hab) (@firstMem) + (@firstBound) (@exceptional) (@S) (@U) (@hBS) (@hSU) (@hSUstrict) (@hUlast) (@hUcolors) + (@hUpath) (@hScorner) (@hST) (@hAU) (@hBU) (@hAUstrict) (@newInput) (@newSeries) (@hgen) + (@htrees) (@hstored) (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) + (@above) (@strict) (@below) (@generating) (@hseries) (@baseU) (@hcore) (@hclosure) (@hMP) + (@hTnEq) (@hstoredEq) (@stageA) (@stageU) (@stageB) (@hdivB) (@prefixEq) (@newStageOld) + (@newStageLast) (@newStageAt) + +private theorem componentIntersectionFromMissingColors.{u_1, u_2} : + componentIntersectionFromMissingColorsStatement.{u_1, u_2} := by + classical + open scoped Sym2 in + intro «V» «E» «inst» «inst» «inst» «inst» «G» «k» «e0» «input» «T» «phi» «ett» «base» «C» «ctx» + «P» «alpha» «beta» «H» «R» «mu» «n» «Tn» «q» «A» «j» «hintersection» «hjdef» «hpathLower» + «hpathUpper» «ell» «B» «X» «y» «reflSeg» «trans» «common» «sameLast» «hAold» «hpOld» «hell» + «hjlow» «hjhigh» «chain» «starNext» «hAT» «lastZero» «lastPositive» «coreA» «hTnCore» «hTnA» + «prefixT» «prefixLen» «hBLen» «hXLen» «hBT» «hXT» «hAB» «hBX» «hAX» «hTnB» «hTnX» «hBXLen» + «hXshort» «hyX» «hyB» «hay» «haB» «haChoice» «hba» «hbB» «hbGamma» «hbUnused» «hbChoice» + «hab» + have missingMono {S U : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) : + TreeMissingColors mu S ⊆ TreeMissingColors mu U := by + exact @helper_missingMono_2274 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@S) + (@U) (@hSU) + have haX : alpha ∈ TreeMissingColors mu X := missingMono hBX haB + have hbX : beta ∈ TreeMissingColors mu X := missingMono hBX hbB + have equalSeg {S U : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) (hlen : S.length = U.length) : + S = U := by as_aux_lemma => + exact @helper_equalSeg_2078 (@V) (@E) (@G) (@e0) (@S) (@U) (@hSU) (@hlen) + have firstLe (W : TreeSequence G e0) (c : Fin k) + (i : Fin (W.length + 1)) (hi : c ∈ MissingColors G mu (W.vertex i)) : + (HierarchyFirstMissingPosition mu W c).val ≤ i.val := by as_aux_lemma => + exact @helper_firstLe_2171 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@W) (@c) (@i) (@hi) + have firstMem (W : TreeSequence G e0) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition mu W c).val < W.length) : + c ∈ MissingColors G mu (W.vertex (HierarchyFirstMissingPosition mu W c)) := by + as_aux_lemma => + clear * - W c hlt mu + let candidates := Finset.univ.filter fun t : Fin (W.length + 1) => + c ∈ MissingColors G mu (W.vertex t) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · exact @helper_branch_348 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@W) + (@c) (@hlt) (@hn) + have firstBound {W Z : TreeSequence G e0} + (hWT : TreeSequenceInitialSegment W Z) (c : Fin k) + (hc : c ∈ TreeMissingColors mu W) : + (HierarchyFirstMissingPosition mu Z c).val ≤ W.length := by + exact @helper_firstBound_353 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@trans) (@firstLe) (@W) (@Z) (@hWT) (@c) (@hc) + have stableClosed (W : TreeSequence G e0) (D : Finset (Fin k)) + (rho sigma : PartialEdgeColoring E k) + (hp : IsProperEdgeColoring G rho) (ho : IsOneEdgeUncolored rho e0) + (hps : IsProperEdgeColoring G sigma) (hos : IsOneEdgeUncolored sigma e0) + (hst : StableColoring W D rho sigma) + (hcl : ColoredVertexSetClosed G rho (TreeSequenceVertexSet W)) : + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet W) := by as_aux_lemma => + exact @helper_stableClosed_2136 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@trans) + (@W) (@D) (@rho) (@sigma) (@hp) (@ho) (@hps) (@hos) (@hst) (@hcl) + have nonparallelClosed + (hk : R.series.data.kind n ≠ some TashkinovExtensionKind.PE) : + ColoredVertexSetClosed G mu (TreeSequenceVertexSet Tn) := by as_aux_lemma => + clear * - R n Tn mu hk stableClosed + have step := R.series.certified n + generalize hn : n = z at step + cases step with + | initial => + exact @helper_branch_397 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hn) + | SE i hp ho hc hnc hnr choice halt hcol hstored hedges hkind + hvertex houtside hdelta hgamma seed hadjoin hclosure hordered hstrict => + exact @helper_branch_402 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@stableClosed) (@i) (@hp) (@ho) (@hc) (@choice) (@hcol) (@hn) + | PE i hp ho hc hnc hnr choice halt gamma hgamma second hps hos hst + exit hcol hproper hone hstored hedges hkind hvertex houtside hdelta + hgammaEq hclosure hordered hstrict => + exfalso + exact hk (hn.symm ▸ hkind) + | RE i hp ho hc hnc available hcol hstored hedges hkind hvertex + houtside hdelta hgamma seed hadjoin hclosure hordered hstrict => + exact @helper_branch_419 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@i) (@hc) (@hcol) (@hn) + have hmod : ModColoring R mu := by as_aux_lemma => + clear * - P R mu + apply Td G k e0 P.corresponding.replacementInput T mu R P.maximum + P.counterexample.positive P.minimumContext.lowerRung mu + P.minimumContext.proper P.minimumContext.oneEdgeUncolored + rw [← R.generatingColoring] + exact ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ + -- At the nonparallel zero-divider boundary, the prescribed seed must survive. + have exceptional : H.dividerCount = 0 → j = 2 → + R.series.data.kind n ≠ some TashkinovExtensionKind.PE → + ¬ ∃ u ∈ TreeSequenceVertexSet B, + Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y) := by + exact @helper_exceptional_1691 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@j) (@trans) (@common) (@hpOld) (@hAT) (@lastZero) (@hBLen) (@hXLen) + (@hBT) (@hXT) (@hAB) (@hBXLen) (@hXshort) (@hyB) (@hay) (@haB) (@hba) (@hbB) (@hab) + (@missingMono) (@equalSeg) (@firstMem) (@firstBound) (@nonparallelClosed) + -- Choose the shorter base unless the component first meets its new last vertex. + exact @componentIntersectionFromSpliceFacts (@«V») (@«E») inferInstance inferInstance + inferInstance inferInstance (@«G») (@«k») (@«e0») (@«input») (@«T») (@«phi») (@«ett») + (@«base») (@«C») (@«ctx») (@«P») (@«alpha») (@«beta») (@«j») (@«hintersection») (@«hjdef») + (@«hpathLower») (@«hpathUpper») (@«reflSeg») (@«trans») (@«common») (@«sameLast») (@«hAold») + (@«hpOld») (@«hell») (@«hjlow») (@«hjhigh») (@«chain») (@«starNext») (@«hAT») (@«lastZero») + (@«lastPositive») (@«coreA») (@«hTnCore») (@«hTnA») (@«prefixT») (@«prefixLen») (@«hBLen») + (@«hXLen») (@«hBT») (@«hXT») (@«hAB») (@«hBX») (@«hAX») (@«hTnB») (@«hTnX») (@«hBXLen») + (@«hXshort») (@«hyX») (@«hyB») (@«hay») (@«haB») (@«haChoice») (@«hba») (@«hbB») + (@«hbGamma») (@«hbUnused») (@«hbChoice») (@«hab») (@«missingMono») (@«haX») (@«hbX») + (@«equalSeg») (@«firstLe») (@«firstMem») (@«firstBound») (@«stableClosed») + (@«nonparallelClosed») (@«hmod») (@«exceptional») + +theorem HierarchySituationThreeComponentIntersectionShortening + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha beta : Fin k) + (hpathLower : 2 <= HierarchyPathNumber C.hierarchy) + (hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (halpha : + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let j := HierarchyPathNumber C.hierarchy + let B := HierarchyFullTailPrefix C (j - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length)) /\ + alpha ∈ TreeMissingColors P.coloring B /\ + (alpha ∉ Gamma ∪ baseExtraMissing ∨ + exists eta : Fin k, eta ∈ D /\ + alpha ∈ P.counterexample.good.gamma q eta /\ + (HierarchyFirstMissingPosition P.coloring T eta).val <= + B.length)) + (hbeta : + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let j := HierarchyPathNumber C.hierarchy + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (j - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + let tailUsedThroughJ := + (Finset.univ : Finset (Fin k)).filter fun c => + exists r : Fin T.length, + A.length <= r.val /\ r.val < A.length + j /\ + P.coloring (T.edge r) = some c + beta ≠ alpha /\ + beta ∈ TreeMissingColors P.coloring B /\ + beta ∉ Gamma /\ beta ∉ tailUsedThroughJ /\ + (beta ∉ baseExtraMissing ∪ D ∨ + beta ∈ D /\ + Disjoint (P.counterexample.good.gamma q beta ∪ {beta}) + tailUsedThroughJ)) + (hintersection : + let j := HierarchyPathNumber C.hierarchy + let X := HierarchyFullTailPrefix C (j - 1) + ∃ u ∈ TreeSequenceVertexSet X, + Sum.inl u ∈ TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length)))) : + False := by + classical + open scoped Sym2 in + let H := P.counterexample.hierarchy + let R := P.corresponding.replacementETT + let mu := P.coloring + let n := Fin.last R.rounds + let Tn := R.series.data.tree n.castSucc + let q := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + generalize hjdef : HierarchyPathNumber C.hierarchy = j at hpathLower hpathUpper + rw [hjdef] at halpha hbeta hintersection + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (j - 2) + let X := HierarchyFullTailPrefix C (j - 1) + let y := T.vertex (Fin.last T.length) + have reflSeg (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have trans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by as_aux_lemma => + exact @helper_trans_1966 (@V) (@E) (@G) (@e0) (@S) (@U) (@W) (@hSU) (@hUW) + have common {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by as_aux_lemma => + exact @helper_common_2010 (@V) (@E) (@G) (@e0) (@trans) (@S) (@U) (@W) (@hSW) (@hUW) (@hlen) + have sameLast : ∀ {a b : ℕ} + (s : Fin (a + 2) → TreeSequence G e0) + (t : Fin (b + 2) → TreeSequence G e0) + (u v : TreeSequence G e0), a = b → HEq s t → u = v → + Fin.cases (motive := fun _ => TreeSequence G e0) + u (fun i : Fin a => s i.succ.castSucc) (Fin.last a) = + Fin.cases (motive := fun _ => TreeSequence G e0) + v (fun i : Fin b => t i.succ.castSucc) (Fin.last b) := by + exact @helper_sameLast_1457 (@V) (@E) (@G) (@e0) + have hAold : HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A := + sameLast _ _ _ _ P.sameGood.1.2.1 P.sameGood.1.2.2.1 P.sameGood.1.1 + have hpOld : HierarchyPathNumber H = j := by as_aux_lemma => + exact @helper_hAold_2232 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@hjdef) + (@hAold) + have hell : ell = T.length - A.length := by + dsimp [ell, HierarchyFullTailLength] + rw [hAold] + have hjlow : 2 ≤ j := hpathLower + have hjhigh : j < ell := hpathUpper + have chain : ∀ (b : ℕ) (hb : b < H.dividerCount + 2) + (a : Fin (H.dividerCount + 2)), a.val ≤ b → + TreeSequenceInitialSegment (H.stage a) (H.stage ⟨b, hb⟩) := by as_aux_lemma => + clear * - H reflSeg trans + intro b + induction b with + | zero => + exact @helper_branch_221 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@reflSeg) + | succ b ih => + exact @helper_branch_226 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@reflSeg) (@trans) (@b) (@ih) + have starNext (i : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H i) (H.stage i.succ) := + Fin.cases H.coreInsideFirst (fun i => H.nested i.succ) i + have hAT : TreeSequenceInitialSegment A T := by + simpa only [q, Fin.succ_last, H.terminalStage] using starNext q + have lastZero (hz : H.dividerCount = 0) : A = P.replacementBase.core := by + simp [A, q, HierarchyStarredStage, hz, Fin.last] + have lastPositive (hz : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact @helper_lastPositive_240 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) + (@hz) + have coreA : TreeSequenceInitialSegment P.replacementBase.core A := by + exact @helper_coreA_252 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@reflSeg) + (@trans) (@chain) (@lastZero) (@lastPositive) + have hTnCore : TreeSequenceInitialSegment Tn P.replacementBase.core := by + exact @helper_hTnCore_2254 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@reflSeg) + have hTnA := trans hTnCore coreA + have prefixT (r : ℕ) : TreeSequenceInitialSegment (HierarchyFullTailPrefix C r) T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have prefixLen (r : ℕ) (hr : r ≤ ell) : + (HierarchyFullTailPrefix C r).length = A.length + r := by as_aux_lemma => + exact @helper_prefixLen_2218 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hAold) (@hell) + (@hAT) (@r) (@hr) + have hBLen : B.length = A.length + (j - 2) := prefixLen _ (by omega) + have hXLen : X.length = A.length + (j - 1) := prefixLen _ (by omega) + have hBT := prefixT (j - 2) + have hXT := prefixT (j - 1) + have hAB : TreeSequenceInitialSegment A B := common hAT hBT (by omega) + have hBX : TreeSequenceInitialSegment B X := common hBT hXT (by omega) + have hAX := trans hAB hBX + have hTnB := trans hTnA hAB + have hTnX := trans hTnB hBX + have hBXLen : X.length = B.length + 1 := by omega + have hXshort : X.length < T.length := by omega + have hyX : y ∉ TreeSequenceVertexSet X := by as_aux_lemma => + clear * - hXT hXshort + intro hy + obtain ⟨i, hi⟩ : ∃ i, X.vertex i = y := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hy + have hv := T.vertex_injective ((hXT.2.1 i).trans hi) + have hh := congrArg Fin.val hv + change i.val = T.length at hh + have hiBound := i.isLt + change i.val < X.length + 1 at hiBound + omega + have hyB : y ∉ TreeSequenceVertexSet B := + fun hy => hyX (TreeSequenceInitialSegmentVertexSetSubset hBX hy) + rcases halpha with ⟨hay, haB, haChoice⟩ + rcases hbeta with ⟨hba, hbB, hbGamma, hbUnused, hbChoice⟩ + have hab : alpha ≠ beta := Ne.symm hba + exact @componentIntersectionFromMissingColors (@«V») (@«E») inferInstance inferInstance + inferInstance inferInstance (@«G») (@«k») (@«e0») (@«input») (@«T») (@«phi») (@«ett») + (@«base») (@«C») (@«ctx») (@«P») (@«alpha») (@«beta») (@«j») (@«hintersection») (@«hjdef») + (@«hpathLower») (@«hpathUpper») (@«reflSeg») (@«trans») (@«common») (@«sameLast») (@«hAold») + (@«hpOld») (@«hell») (@«hjlow») (@«hjhigh») (@«chain») (@«starNext») (@«hAT») (@«lastZero») + (@«lastPositive») (@«coreA») (@«hTnCore») (@«hTnA») (@«prefixT») (@«prefixLen») (@«hBLen») + (@«hXLen») (@«hBT») (@«hXT») (@«hAB») (@«hBX») (@«hAX») (@«hTnB») (@«hTnX») (@«hBXLen») + (@«hXshort») (@«hyX») (@«hyB») (@«hay») (@«haB») (@«haChoice») (@«hba») (@«hbB») + (@«hbGamma») (@«hbUnused») (@«hbChoice») (@«hab») + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointData.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointData.lean new file mode 100644 index 0000000000..0527db4872 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointData.lean @@ -0,0 +1,125 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix + +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +public import LeanPool.GoldbergSeymour.TreeColoringInvariant + +/-! +# Hierarchy Situation Three Disjoint Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A switched replacement presentation and missing-color witnesses for the disjoint-component case +of situation three. +-/ +structure HierarchySituationThreeDisjointData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha beta : Fin k) where + /-- The replacement presentation after the designated component swap. -/ + switched : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx + switchedColoring : + switched.coloring = + TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length))) + proper : IsProperEdgeColoring G switched.coloring + oneEdgeUncolored : IsOneEdgeUncolored switched.coloring e0 + invariantOnSplit : + let j := HierarchyPathNumber C.hierarchy + let X := HierarchyFullTailPrefix C (j - 1) + TreeColoringInvariant X P.coloring switched.coloring + affectedMissingOnSplit : + let j := HierarchyPathNumber C.hierarchy + let X := HierarchyFullTailPrefix C (j - 1) + alpha ∈ TreeMissingColors switched.coloring X ∧ beta ∈ TreeMissingColors switched.coloring X + transportedSuffix : + let j := HierarchyPathNumber C.hierarchy + let X := HierarchyFullTailPrefix C (j - 1) + TashkinovAugmentationSequence switched.coloring X T + betaMissingTerminal : beta ∈ MissingColors G switched.coloring (T.vertex (Fin.last T.length)) + betaMissingTwoBeforeWitness : + let j := HierarchyPathNumber C.hierarchy + let B := HierarchyFullTailPrefix C (j - 2) + ∃ v ∈ TreeSequenceVertexSet B, beta ∈ MissingColors G switched.coloring v + betaOutsideGamma : + let H := switched.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (switched.counterexample.good.gamma q) + beta ∉ Gamma + conditionNine : + let H := switched.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let j := HierarchyPathNumber C.hierarchy + let B := HierarchyFullTailPrefix C (j - 2) + let n : Fin (switched.corresponding.replacementETT.rounds + 1) := + Fin.last switched.corresponding.replacementETT.rounds + let Tn := switched.corresponding.replacementETT.series.data.tree n.castSucc + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (switched.counterexample.good.gamma q) + let baseExtraMissing := + ((TreeSequenceVertexSet switched.replacementBase.core \ TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G switched.coloring v) + let tailUsedThroughJ := + (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < A.length + j ∧ switched.coloring (T.edge r) = some c + (beta ∉ baseExtraMissing ∧ beta ∉ tailUsedThroughJ ∧ beta ∉ Gamma ∧ beta ∉ D) ∨ + (beta ∈ D ∧ + beta ∈ TreeMissingColors switched.coloring B ∧ + Disjoint (switched.counterexample.good.gamma q beta ∪ { beta }) tailUsedThroughJ) + /-- The auxiliary color with the missing-color conditions recorded below. -/ + theta : Fin k + thetaMissingAtJ : + let j := HierarchyPathNumber C.hierarchy + let Y := HierarchyFullTailPrefix C j + theta ∈ MissingColors G switched.coloring (Y.vertex (Fin.last Y.length)) + thetaOutsideGamma : + let H := switched.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (switched.counterexample.good.gamma q) + theta ∉ Gamma + +namespace HierarchySituationThreeDisjointData + +variable {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T phi} {base : HierarchyBase ett phi} + {C : HierarchyCounterexample base} + {ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C} + {P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx} {alpha beta : Fin k} + +/-- Recover the union-of-missing-colors interface from the explicit vertex witness. -/ +theorem betaMissingTwoBefore + (data : HierarchySituationThreeDisjointData + G k e0 input T phi ett base C ctx P alpha beta) : + let j := HierarchyPathNumber C.hierarchy + let B := HierarchyFullTailPrefix C (j - 2) + beta ∈ TreeMissingColors data.switched.coloring B := by + simpa only [TreeMissingColors, Finset.mem_biUnion] using data.betaMissingTwoBeforeWitness + +end HierarchySituationThreeDisjointData + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointPreparation.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointPreparation.lean new file mode 100644 index 0000000000..4ed6f6a90d --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointPreparation.lean @@ -0,0 +1,366 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.SplitSwapPreparation +public import LeanPool.GoldbergSeymour.KempeOrientation +public import LeanPool.GoldbergSeymour.OutsidePrefixBranch +public import LeanPool.GoldbergSeymour.ConditionNineTransport +public import LeanPool.GoldbergSeymour.ThetaExclusion +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Hierarchy Situation Three Disjoint Preparation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_reconstructed_188.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); P2880_T1_SplitSwapData G k e0 input T phi ett base C ctx + P alpha beta (TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last + T.length)))) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT sigma T), + MaximumProperty corr.replacementETT ∧ + ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT newBase) (good : GoodHierarchy K), SameGoodHierarchy + P.counterexample.good good := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy + let Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds + let A : TreeSequence G e0 := HierarchyStarredStage H q + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc + let Dn : Finset (Fin k) := TashkinovStoredColors m.series.data n + let qualifies : Fin k → Fin k → Prop := fun (a b : Fin k) => + (0 : ℕ) < H.dividerCount ∧ a ∈ TreeMissingColors P.coloring Tnq ∨ + H.dividerCount = (0 : ℕ) ∧ + (a ∈ TreeMissingColors P.coloring Tn ∨ a ∈ TreeMissingColors P.coloring A ∧ a ∉ Dn + ∧ b ∉ Dn) + by_cases hc : qualifies alpha beta ∨ qualifies beta alpha + · let X := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1) + have fixed : ∀ t : Fin T.length, + (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).length ≤ t.val → + t.val < X.length → sigma (T.edge t) = P.coloring (T.edge t) := by + intro t _ ht + exact S.fixedOnSplit t ht + rcases hc with hc | hc + · have changed := StableChangeCasesOneTwoSplitTail G k e0 + P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext alpha beta S.distinct S.oldMissingOnPenultimate + (Sum.inl (T.vertex (Fin.last T.length))) S.path sigma S.swapped hc + S.separatedAlpha X S.splitAboveStar.1 S.splitAboveStar.2 + S.splitInPenultimate fixed S.prefixRoute S.oldSuffix S.missingOnSplit + S.penultimateMissing S.storedFirst S.gammaCutoff + exact changed.2.2 + · obtain ⟨hgraph, hcomponents, hswaps, hpaths⟩ := + P2880_T1_KempeOrientation G P.coloring alpha beta S.distinct + have hsigma : sigma = TwoColorComponentSwap G P.coloring beta alpha + (Sum.inl (T.vertex (Fin.last T.length))) := + S.swapped.trans (hswaps _) + have hpath : TwoColorPathComponent G P.coloring beta alpha + (Sum.inl (T.vertex (Fin.last T.length))) := (hpaths _).mp S.path + have hsep : Disjoint + (TwoColorComponent G P.coloring beta alpha + (Sum.inl (T.vertex (Fin.last T.length)))) + (TwoColorComponent G P.coloring beta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)))) := by + simpa only [← hcomponents] using S.separatedBeta + have hcut : + let H := P.counterexample.hierarchy + let q := Fin.last H.dividerCount + ∀ eta ∈ HierarchyStoredColorsAt H q, + (beta ∈ P.counterexample.good.gamma q eta ∨ + alpha ∈ P.counterexample.good.gamma q eta) → + (HierarchyFirstMissingPosition P.coloring T eta).val ≤ X.length := by + dsimp only + intro eta heta hc + exact S.gammaCutoff eta heta hc.symm + have changed := StableChangeCasesOneTwoSplitTail G k e0 + P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext beta alpha (Ne.symm S.distinct) + S.oldMissingOnPenultimate.symm + (Sum.inl (T.vertex (Fin.last T.length))) hpath sigma hsigma hc + hsep X S.splitAboveStar.1 S.splitAboveStar.2 + S.splitInPenultimate fixed S.prefixRoute S.oldSuffix S.missingOnSplit.symm + S.penultimateMissing S.storedFirst hcut + exact changed.2.2 + · exact P2880_T1_OutsidePrefixBranch G k e0 input T phi ett base C ctx P + alpha beta sigma S hc + +theorem HierarchySituationThreeDisjointPreparation + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha beta : Fin k) + (hpathLower : 2 ≤ HierarchyPathNumber C.hierarchy) + (hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) + (halpha : + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let j := HierarchyPathNumber C.hierarchy + let B := HierarchyFullTailPrefix C (j - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length)) ∧ + alpha ∈ TreeMissingColors P.coloring B ∧ + (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta : Fin k, eta ∈ D ∧ + alpha ∈ P.counterexample.good.gamma q eta ∧ + (HierarchyFirstMissingPosition P.coloring T eta).val ≤ + B.length)) + (hbeta : + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let j := HierarchyPathNumber C.hierarchy + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (j - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + let tailUsedThroughJ := + (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < A.length + j ∧ + P.coloring (T.edge r) = some c + beta ≠ alpha ∧ + beta ∈ TreeMissingColors P.coloring B ∧ + beta ∉ Gamma ∧ beta ∉ tailUsedThroughJ ∧ + (beta ∉ baseExtraMissing ∪ D ∨ + beta ∈ D ∧ + Disjoint (P.counterexample.good.gamma q beta ∪ {beta}) + tailUsedThroughJ)) + (hcomponentDisjoint : + let j := HierarchyPathNumber C.hierarchy + let X := HierarchyFullTailPrefix C (j - 1) + let Q := TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ Q) : + Nonempty (HierarchySituationThreeDisjointData + G k e0 input T phi ett base C ctx P alpha beta) := by + classical + let sigma := TwoColorComponentSwap G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) + obtain ⟨S⟩ := P2880_T1_CommonPreparation G k e0 input T phi ett base C ctx P + alpha beta hpathLower hpathUpper halpha hbeta hcomponentDisjoint + let H := P.counterexample.hierarchy + let q := Fin.last H.dividerCount + let m := P.corresponding.replacementETT + let n := Fin.last m.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := m.series.data.tree n.castSucc + let Dn := TashkinovStoredColors m.series.data n + let qualifies := fun (a b : Fin k) => + (0 < H.dividerCount ∧ a ∈ TreeMissingColors P.coloring Tnq) ∨ + (H.dividerCount = 0 ∧ + (a ∈ TreeMissingColors P.coloring Tn ∨ + (a ∈ TreeMissingColors P.coloring A ∧ a ∉ Dn ∧ b ∉ Dn))) + have reconstructed := + @helper_reconstructed_188 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C ctx P alpha beta S + obtain ⟨corr, hmaximum, newBase, K, good, hsame⟩ := reconstructed + have hnotElementary : ¬ ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet T) := by + as_aux_lemma => + obtain ⟨v, hvB, hmissing⟩ := Finset.mem_biUnion.mp S.missingTwoBefore.2 + have hvX := TreeSequenceInitialSegmentVertexSetSubset S.twoBeforeInSplit hvB + have hvT := TreeSequenceInitialSegmentVertexSetSubset S.splitInFull hvX + have hroot : Sum.inl (T.vertex (Fin.last T.length)) ∈ + TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) := rfl + have hne : v ≠ T.vertex (Fin.last T.length) := by + intro heq + exact S.splitOutside v hvX (heq.symm ▸ hroot) + intro helementary + have hd := helementary hvT + (by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last T.length, rfl⟩) hne + exact Finset.disjoint_left.mp hd hmissing S.missingTerminal + let newC : HierarchyCounterexample newBase := { + positive := by rw [corr.rungAgreement]; exact P.counterexample.positive + hierarchy := K + good := good + maximum := hmaximum + notElementary := hnotElementary } + obtain ⟨R, hR⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx P sigma corr newBase newC hsame + obtain ⟨hbetaOutside, hnine⟩ := P2880_T1_ConditionNineTransport G k e0 + input T phi ett base C ctx P alpha beta sigma S R hR hbeta + obtain ⟨hstar, _, _⟩ := P2752_T2_HierarchyMeasures C.hierarchy + R.counterexample.hierarchy R.sameGood.1 + have htail : HierarchyFullTailLength R.counterexample = HierarchyFullTailLength C := by + unfold HierarchyFullTailLength + dsimp only + rw [← hstar] + have hprefix : ∀ i : Nat, HierarchyFullTailPrefix R.counterexample i = + HierarchyFullTailPrefix C i := by + intro i + unfold HierarchyFullTailPrefix + dsimp only + simp only [← hstar] + let j := HierarchyPathNumber C.hierarchy + let Y := HierarchyFullTailPrefix C j + obtain ⟨theta, htheta⟩ := hvertexMissing R.coloring R.minimumContext.proper + R.minimumContext.oneEdgeUncolored (Y.vertex (Fin.last Y.length)) + have hthetaOutside : + theta ∉ (HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).biUnion + (R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount)) := by + apply P2880_T1_ThetaExclusion G k e0 R.corresponding.replacementInput T + R.coloring R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext j (by dsimp [j]; omega) + (by rw [htail]; exact hpathUpper) + rw [hprefix j] + exact htheta + refine ⟨{ + switched := R + switchedColoring := hR.trans S.swapped + proper := R.minimumContext.proper + oneEdgeUncolored := R.minimumContext.oneEdgeUncolored + invariantOnSplit := ?_ + affectedMissingOnSplit := ?_ + transportedSuffix := ?_ + betaMissingTerminal := ?_ + betaMissingTwoBeforeWitness := ?_ + betaOutsideGamma := hbetaOutside + conditionNine := hnine + theta := theta + thetaMissingAtJ := htheta + thetaOutsideGamma := hthetaOutside }⟩ + · rw [hR] + exact S.invariant + · rw [hR] + exact S.missingOnSplit + · rw [hR] + exact S.newSuffix + · rw [hR] + exact S.missingTerminal + · apply Finset.mem_biUnion.mp + rw [hR] + exact S.missingTwoBefore.2 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean new file mode 100644 index 0000000000..3a5563d31b --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean @@ -0,0 +1,3383 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData +public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# Hierarchy Situation Three Disjoint Theta Stored Impossible + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation2252Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) (j + : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; d.theta ∈ D → beta ∈ TreeMissingColors + sigma B → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → sigma (T.edge t) ≠ some + beta) → d.theta ∈ MissingColors G sigma (Y.vertex (Fin.last Y.length)) → + ∀ gamma ∈ R.counterexample.good.gamma q d.theta, gamma ∈ TreeMissingColors sigma A → gamma ∈ + D.biUnion (R.counterexample.good.gamma q) → gamma ≠ beta → HierarchyStarredStage + C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → TreeSequenceInitialSegment A T → j ≤ + T.length - A.length → A.length + j < T.length → ( + ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + )) → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → + TreeSequenceInitialSegment B T → TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment B X → TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → + TreeSequenceInitialSegment A Y → HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = Z → ColoredVertexSetElementary G + sigma (TreeSequenceVertexSet Z) → ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ W.length) → gamma ∈ MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma + T gamma)) ∧ (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → beta ∈ + MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → + (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → False + +private abbrev helperContinuation2327Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) (j + : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; d.theta ∈ D → beta ∈ TreeMissingColors + sigma B → d.theta ∈ MissingColors G sigma (Y.vertex (Fin.last Y.length)) → + ∀ gamma ∈ R.counterexample.good.gamma q d.theta, gamma ∈ TreeMissingColors sigma A → gamma ≠ + beta → HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → + TreeSequenceInitialSegment A T → j ≤ T.length - A.length → A.length + j < T.length → ( + ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + m) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬min + (A.length + m) T.length ≤ T.length) ↦ + by omega + )) → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → + TreeSequenceInitialSegment B T → TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment B X → TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → + TreeSequenceInitialSegment A Y → HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = Z → ColoredVertexSetElementary G + sigma (TreeSequenceVertexSet Z) → gamma ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)) ∧ (↑(HierarchyFirstMissingPosition sigma T + gamma) : ℕ) ≤ A.length → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → + ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → ( + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) → d.theta ∈ TreeMissingColors sigma Y → d.theta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma + T d.theta) : ℕ) ≤ Y.length → (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = + Y.length → d.theta ∉ D.biUnion (R.counterexample.good.gamma q) → gamma ≠ d.theta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → sigma (T.edge t) ≠ some + gamma) → TreeSequenceInitialSegment A Z → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W) → gamma ∈ TreeMissingColors sigma Z → beta ∈ TreeMissingColors + sigma Z → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) → gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ))) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex + (Fin.last T.length) → (Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (Fin.last T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)))) ∧ TwoColorPathComponent G sigma gamma + beta (Sum.inl (T.vertex (Fin.last T.length))) ∧ + ∀ x ∈ TreeSequenceVertexSet Z, MissingColors G (TwoColorComponentSwap G sigma gamma beta + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G sigma x) → Disjoint + (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (Fin.last T.length)))) + (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (HierarchyFirstMissingPosition + sigma T gamma)))) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; + IsOneEdgeUncolored mu2 e0 → gamma ∈ MissingColors G mu2 (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)) → gamma ∈ MissingColors G mu2 (T.vertex + (Fin.last T.length)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → mu2 (T.edge t) = sigma + (T.edge t)) → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → False + +private abbrev helperContinuation3145Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) (j + : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; d.theta ∈ D → + ∀ gamma ∈ R.counterexample.good.gamma q d.theta, gamma ∈ TreeMissingColors sigma A → gamma ≠ + beta → HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → + TreeSequenceInitialSegment A T → A.length + j < T.length → Y.length = A.length + j → + TreeSequenceInitialSegment Y T → TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment Z T → TreeSequenceInitialSegment A Y → ( + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) → d.theta ∈ TreeMissingColors sigma Y → d.theta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma + T d.theta) : ℕ) ≤ Y.length → d.theta ∉ D.biUnion (R.counterexample.good.gamma q) → gamma ≠ + d.theta → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G + rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = HierarchyFirstMissingPosition rho T c) → ( + ∀ (old new : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W Z → TreeMissingColors new W = + TreeMissingColors old W) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : + PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring + (T.edge t)) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → + let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := + S.corresponding.replacementETT; + let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; + let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n + = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (0 : ℕ) < + S.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors S.coloring + (S.counterexample.hierarchy.stage (⟨S.counterexample.hierarchy.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬S.counterexample.hierarchy.dividerCount < S.counterexample.hierarchy.dividerCount + (2 : + ℕ)) ↦ + by omega + ⟩ : Fin (S.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + S.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors S.coloring + (S.corresponding.replacementETT.series.data.tree (Fin.last + S.corresponding.replacementETT.rounds).castSucc)) → TashkinovAugmentationSequence sigma Y + T → gamma ∈ TreeMissingColors mu2 Y ∧ beta ∈ TreeMissingColors mu2 Y → A.length < Y.length + → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), R1.coloring = mu2 + → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (m : ℕ), + HierarchyFullTailPrefix S.counterexample m = HierarchyFullTailPrefix C m) → + let rho : PartialEdgeColoring E k := R1.coloring; ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G rho v = MissingColors G sigma v) → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet Z) → HierarchyFirstMissingPosition + rho T gamma = HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition + rho T d.theta = HierarchyFirstMissingPosition sigma T d.theta → d.theta ∈ MissingColors G + rho (Y.vertex (Fin.last Y.length)) → gamma ∈ MissingColors G rho (T.vertex (Fin.last + T.length)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) + → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho Z → Disjoint + (TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex (Fin.last T.length)))) + (TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition + sigma T gamma)))) → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; + TwoColorPathComponent G rho gamma d.theta z → IsOneEdgeUncolored mu3 e0 → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu3 v = MissingColors G rho v) → False + +private abbrev helperContinuation2545Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) (j + : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; d.theta ∈ D → beta ∈ TreeMissingColors + sigma B → d.theta ∈ MissingColors G sigma (Y.vertex (Fin.last Y.length)) → + ∀ gamma ∈ R.counterexample.good.gamma q d.theta, gamma ∈ TreeMissingColors sigma A → gamma ≠ + beta → HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → + TreeSequenceInitialSegment A T → A.length + j < T.length → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → + TreeSequenceInitialSegment B T → TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment B X → TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → + TreeSequenceInitialSegment A Y → HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = Z → ColoredVertexSetElementary G + sigma (TreeSequenceVertexSet Z) → gamma ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)) ∧ (↑(HierarchyFirstMissingPosition sigma T + gamma) : ℕ) ≤ A.length → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → + ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → ( + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) → d.theta ∈ TreeMissingColors sigma Y → d.theta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma + T d.theta) : ℕ) ≤ Y.length → (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = + Y.length → d.theta ∉ D.biUnion (R.counterexample.good.gamma q) → gamma ≠ d.theta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → sigma (T.edge t) ≠ some + gamma) → TreeSequenceInitialSegment A Z → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W) → gamma ∈ TreeMissingColors sigma Z → beta ∈ TreeMissingColors + sigma Z → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) → gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ))) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex + (Fin.last T.length) → (Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (Fin.last T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)))) ∧ TwoColorPathComponent G sigma gamma + beta (Sum.inl (T.vertex (Fin.last T.length))) ∧ + ∀ x ∈ TreeSequenceVertexSet Z, MissingColors G (TwoColorComponentSwap G sigma gamma beta + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G sigma x) → Disjoint + (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (Fin.last T.length)))) + (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (HierarchyFirstMissingPosition + sigma T gamma)))) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; + IsOneEdgeUncolored mu2 e0 → gamma ∈ MissingColors G mu2 (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)) → gamma ∈ MissingColors G mu2 (T.vertex + (Fin.last T.length)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → mu2 (T.edge t) = sigma + (T.edge t)) → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G + rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = HierarchyFirstMissingPosition rho T c) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v) → ( + ∀ (old new : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W Z → TreeMissingColors new W = + TreeMissingColors old W) → ( + ∀ eta ∈ D, HierarchyFirstMissingPosition mu2 T eta = HierarchyFirstMissingPosition sigma T + eta) → ( + ∀ eta ∈ D, gamma ∈ R.counterexample.good.gamma q eta ∨ beta ∈ R.counterexample.good.gamma q + eta → (↑(HierarchyFirstMissingPosition sigma T eta) : ℕ) ≤ Y.length) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : + PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring + (T.edge t)) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → + let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := + S.corresponding.replacementETT; + let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; + let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n + = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (0 : ℕ) < + S.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors S.coloring + (S.counterexample.hierarchy.stage (⟨S.counterexample.hierarchy.dividerCount, + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega + ⟩ : Fin (S.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + S.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors S.coloring + (S.corresponding.replacementETT.series.data.tree (Fin.last + S.corresponding.replacementETT.rounds).castSucc)) → False + +private abbrev helperContinuation3542Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (hvertexMissing : + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) (d : HierarchySituationThreeDisjointData G k e0 + input T phi ett base C ctx P alpha beta) (j : ℕ) (hj : HierarchyPathNumber C.hierarchy = + j) (hpathLower : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ (hthetaStored' : d.theta ∈ D) (hbetaB : beta ∈ TreeMissingColors sigma B) (hbetaUnused : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → sigma (T.edge t) ≠ some + beta) (hthetaMissingY : d.theta ∈ MissingColors G sigma (Y.vertex (Fin.last Y.length))) + (gamma : Fin k) (hgammaTheta : gamma ∈ R.counterexample.good.gamma q d.theta) (hgammaA : + gamma ∈ TreeMissingColors sigma A) (hgammaNeBeta : gamma ≠ beta) (sameStar : + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A) (hAtoT : + TreeSequenceInitialSegment A T) (htail : j ≤ T.length - A.length) (hcutJstrict : A.length + + j < T.length) (fullPrefixEq : + ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) ( + by omega + )) (commonPrefix : + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) (hYlen : Y.length = A.length + j) + (hBtoT : TreeSequenceInitialSegment B T) (hYtoT : TreeSequenceInitialSegment Y T) (hBtoX : + TreeSequenceInitialSegment B X) (hXtoY : TreeSequenceInitialSegment X Y) (hYtoZ : + TreeSequenceInitialSegment Y Z) (hZtoT : TreeSequenceInitialSegment Z T) (hAtoY : + TreeSequenceInitialSegment A Y) (penultimatePrefixEq : HierarchyFullTailPrefix + R.counterexample (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = Z) (hElemZ : + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z)) (firstWitness : + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ W.length) (hgammaFirst : gamma ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)) ∧ (↑(HierarchyFirstMissingPosition sigma T + gamma) : ℕ) ≤ A.length) (hbetaFirst : beta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T beta)) ∧ (↑(HierarchyFirstMissingPosition sigma T + beta) : ℕ) ≤ B.length) (hgammaFirstLe : (↑(HierarchyFirstMissingPosition sigma T gamma) : + ℕ) ≤ A.length) (hbetaFirstLe : (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ + B.length) (vertexMemT : + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + (vertexMemSelf : + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) (hthetaY : d.theta ∈ TreeMissingColors sigma Y) (hthetaFirst : d.theta ∈ MissingColors + G sigma (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) ∧ + (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) ≤ Y.length) (hthetaFirstIndex : + (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length) (hthetaOutsideGamma : + d.theta ∉ D.biUnion (R.counterexample.good.gamma q)) (hgammaNeTheta : gamma ≠ d.theta) + (hgammaUnused : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → sigma (T.edge t) ≠ some + gamma) (hAtoZ : TreeSequenceInitialSegment A Z) (hBtoZ : TreeSequenceInitialSegment B Z) + (treeMissingSubset : + ∀ {U W : TreeSequence G e0} (hUW : TreeSequenceInitialSegment U W), TreeMissingColors sigma U + ⊆ TreeMissingColors sigma W) (hgammaMissingZ : gamma ∈ TreeMissingColors sigma Z) + (hbetaMissingZ : beta ∈ TreeMissingColors sigma Z) (hchangeElementary : + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet (HierarchyFullTailPrefix + R.counterexample (HierarchyFullTailLength R.counterexample - (1 : ℕ))))) (hchangeMissing : + gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) (firstChange : + let H : TashkinovHierarchy d.switched.corresponding.replacementETT d.switched.replacementBase + := d.switched.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (d.switched.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + d.switched.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := d.switched.corresponding.replacementETT.series.data.tree + n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors + d.switched.corresponding.replacementETT.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition d.switched.coloring T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition d.switched.coloring T beta); + have sameComponent : Prop := TwoColorComponent G d.switched.coloring gamma beta (Sum.inl va) = + TwoColorComponent G d.switched.coloring gamma beta (Sum.inl vb); ( (0 : ℕ) < + H.dividerCount ∧ (gamma ∈ TreeMissingColors d.switched.coloring Tnq ∨ Disjoint (insert + gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dnq) → sameComponent) ∧ ( + H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors d.switched.coloring Tn ∨ Disjoint + (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → sameComponent) ∧ ( gamma + ∈ TreeMissingColors d.switched.coloring A ∧ TreeColorSetClosed G d.switched.coloring A + ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A d.switched.coloring + gamma beta)), False + +private theorem helper_hthetaFirstIndex_395.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let ell : ℕ := HierarchyFullTailLength C; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); d.theta ∈ + MissingColors G sigma (Y.vertex (Fin.last Y.length)) → TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → d.theta ∈ MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma T + d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) ≤ Y.length → + (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma ell Y Z + hthetaMissingY hYtoT hYtoZ hZtoT hElemZ vertexMemT hthetaFirst + as_aux_lemma => + clear_value Y Z + apply Nat.le_antisymm hthetaFirst.2 + by_contra hne + have hlt : (HierarchyFirstMissingPosition sigma T d.theta).val < Y.length := + Nat.lt_of_not_ge hne + have iZ : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ∈ + TreeSequenceVertexSet Z := vertexMemT Z hZtoT + (HierarchyFirstMissingPosition sigma T d.theta) + (Nat.le_trans (Nat.le_of_lt hlt) hYtoZ.1) + have yZ : Y.vertex (Fin.last Y.length) ∈ TreeSequenceVertexSet Z := + TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (by simp [TreeSequenceVertexSet]) + have hvne : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ + Y.vertex (Fin.last Y.length) := by + intro heq + let jY : Fin (Y.length + 1) := + ⟨(HierarchyFirstMissingPosition sigma T d.theta).val, + Nat.lt_succ_of_le (Nat.le_of_lt hlt)⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hYtoT.1) jY = + HierarchyFirstMissingPosition sigma T d.theta := Fin.ext rfl + have heqY : Y.vertex jY = Y.vertex (Fin.last Y.length) := by + have htree := hYtoT.2.1 jY + have hcastV := congrArg T.vertex hcast + exact htree.symm.trans (hcastV.trans heq) + have hidx := Y.vertex_injective heqY + have hval := congrArg Fin.val hidx + dsimp [jY] at hval + exact (Nat.ne_of_lt hlt) hval + exact Finset.disjoint_left.mp (hElemZ iZ yZ hvne) + hthetaFirst.1 hthetaMissingY + +private theorem helper_routeToY_837.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → + TreeSequenceInitialSegment Y T → TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment A Y → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : + ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : + TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage + K (Fin.last K.dividerCount)).edge t)) → Y.length = X.length + (1 : ℕ) → + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : + PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring + (T.edge t)) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → + let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := + S.corresponding.replacementETT; + let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; + let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n + = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A ell + X Y Z hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn + hw hf hm + as_aux_lemma => + have hj : 2 ≤ j := hpathLower + clear * - G k e0 input T phi ett base C ctx S nu hn hw hf hm + A X Y Z hAtoT hYtoT hXtoY hYtoZ hXYlen hAtoY hYlen hj j sameStarAll + commonPrefix weakEdges + clear_value A X Y Z + let et := S.corresponding.replacementETT + let K := S.counterexample.hierarchy + let Tn := et.series.data.tree (Fin.last et.rounds).castSucc + have hTnT : TreeSequenceInitialSegment Tn T := et.abovePenultimate + have hTnA : Tn.length ≤ A.length := by + by_cases hz : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz + have hs := sameStarAll S + change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs + rw [hi] at hs + change S.replacementBase.core = A at hs + by_cases hp : et.series.data.kind (Fin.last et.rounds) = + some TashkinovExtensionKind.PE + · rw [← hs]; exact (Classical.choice (S.replacementBase.parallel hp).2.2).leftSegment.1 + · rw [← hs, S.replacementBase.nonparallel hp] + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := + Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) + have hs := sameStarAll S + change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs + rw [hi] at hs + have hmono : Monotone (fun i : Fin (K.dividerCount + 2) => (K.stage i).length) := + Fin.monotone_iff_le_succ.mpr (fun i => (K.nested i).1) + rw [← hs] + change Tn.length ≤ (K.stage _).length + rw [show Tn = K.stage 0 from K.baseStage.symm] + exact hmono (Fin.zero_le _) + have hAYstrict : A.length < Y.length := by + clear * - hj hYlen + omega + have fixedA : ∀ t : Fin A.length, nu (A.edge t) = S.coloring (A.edge t) := by + have he := weakEdges S.coloring nu et S.replacementBase K hw + S.minimumContext.oneEdgeUncolored hn + change ∀ t : Fin (HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).length, + nu ((HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) = + S.coloring ((HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) at he + rw [sameStarAll S] at he + exact he + have fixedY : ∀ t : Fin Y.length, nu (Y.edge t) = S.coloring (Y.edge t) := by + intro t + let tT : Fin T.length := Fin.castLE hYtoT.1 t + have he : T.edge tT = Y.edge t := hYtoT.2.2 t + by_cases ht : t.val < A.length + · let tA : Fin A.length := ⟨t.val, ht⟩ + have hcast : Fin.castLE hAtoT.1 tA = tT := Fin.ext rfl + rw [← he, ← hcast, hAtoT.2.2 tA] + exact fixedA tA + · rw [← he] + exact hf tT (Nat.le_of_not_gt ht) t.isLt + have transport (W : TreeSequence G e0) + (hr : TashkinovAugmentationSequence S.coloring W Y) : + TashkinovAugmentationSequence nu W Y := + TashkinovAugmentationSequenceColoringTransport S.coloring nu W X Y hr + hXtoY hXYlen (fun t _ => fixedY t) + (fun v hv => hm v (TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (TreeSequenceInitialSegmentVertexSetSubset hXtoY hv))) + rcases P2813_T1_TerminalRoute G k e0 S.corresponding.replacementInput T + S.coloring et with ⟨hp, hr⟩ | ⟨hk, f, seed, he, ha, _, _, hr⟩ + · have hTY : TreeSequenceInitialSegment Tn Y := + commonPrefix hTnT hYtoT (hTnA.trans hAtoY.1) + exact Or.inl ⟨hp, transport Tn + (TashkinovAugmentationSequenceRestrict S.coloring Tn Y T hr hTY hYtoT)⟩ + · have hseedT : TreeSequenceInitialSegment seed T := + TashkinovAugmentationSequenceInitialSegment S.coloring seed T hr + have hseedY : TreeSequenceInitialSegment seed Y := + commonPrefix hseedT hYtoT (by + have hl := ha.1 + change seed.length = Tn.length + 1 at hl + clear * - hl hTnA hAYstrict + omega) + exact Or.inr ⟨hk, f, seed, he, ha, transport seed + (TashkinovAugmentationSequenceRestrict S.coloring seed Y T hr hseedY hYtoT)⟩ + +private theorem helper_hfixed3_1220.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (gamma : Fin k), HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → + TreeSequenceInitialSegment A T → Y.length = A.length + j → TreeSequenceInitialSegment Y T + → ( + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (m : ℕ), + HierarchyFullTailPrefix S.counterexample m = HierarchyFullTailPrefix C m) → + let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Z) → d.theta ∈ MissingColors G rho (Y.vertex (Fin.last Y.length)) → + ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) + → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; + HierarchyWeaklyStable R1.counterexample.hierarchy (Fin.last + R1.counterexample.hierarchy.dividerCount) mu3 → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → mu3 (T.edge t) = rho (T.edge + t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hpathLower hpathUpper R H + q A ell Y Z gamma sameStar hAtoT hYlen hYtoT vertexMemSelf z sameStarAll samePenultimate R1 + sameFullPrefix rho hElemRho hthetaYRho hgammaUnusedRho mu3 hweak3 + as_aux_lemma => + let K := R1.counterexample.hierarchy + let et := R1.corresponding.replacementETT + let n := Fin.last et.rounds + let Tn := et.series.data.tree n.castSucc + have hpref : HierarchyFullTailPrefix R1.counterexample j = Y := + sameFullPrefix R1 j + have exclusion := HierarchyTailMissingColorExclusion G k e0 + R1.corresponding.replacementInput T rho et R1.replacementBase K + (by + change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - 1))) + rw [samePenultimate R1] + exact hElemRho) + j ((by decide : 1 ≤ 2).trans hpathLower) + (by + change j < T.length - (HierarchyStarredStage R1.counterexample.hierarchy + (Fin.last R1.counterexample.hierarchy.dividerCount)).length + rw [sameStarAll R1] + simpa only [ell, HierarchyFullTailLength, sameStar] using hpathUpper) + d.theta (by + change d.theta ∈ MissingColors G rho + ((HierarchyFullTailPrefix R1.counterexample j).vertex + (Fin.last (HierarchyFullTailPrefix R1.counterexample j).length)) + rw [hpref] + exact hthetaYRho) + intro t hlo hhi + have hga := hgammaUnusedRho t hlo hhi + by_cases htheta : rho (T.edge t) = some d.theta + · let tY : Fin Y.length := ⟨t.val, hhi⟩ + have hcast : Fin.castLE hYtoT.1 tY = t := Fin.ext rfl + have hc : rho (Y.edge tY) = some d.theta := by + rw [← hYtoT.2.2 tY, hcast] + exact htheta + change ∀ t : Fin (HierarchyFullTailPrefix R1.counterexample j).length, + (HierarchyStarredStage K (Fin.last K.dividerCount)).length ≤ t.val → + t.val < (HierarchyStarredStage K (Fin.last K.dividerCount)).length + j → + rho ((HierarchyFullTailPrefix R1.counterexample j).edge t) = some d.theta → + K.dividerCount = 0 ∧ R1.replacementBase.core = Tn ∧ + t.val = (HierarchyStarredStage K (Fin.last K.dividerCount)).length ∧ + ∃ f : E, + TashkinovSeriesStep G k et.rounds e0 R1.corresponding.replacementInput + et.series.data n ∧ + (et.series.data.kind n = some TashkinovExtensionKind.SE ∨ + et.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + et.series.data.connectingEdges n = {f} ∧ + (HierarchyFullTailPrefix R1.counterexample j).edge t = f ∧ + rho f = some d.theta ∧ d.theta ∈ TashkinovStoredColors et.series.data n + at exclusion + rw [hpref, sameStarAll R1] at exclusion + obtain ⟨hz, hcore, hpos, f, hcert, hkind, hedges, hedge, hfc, hraw⟩ := + exclusion tY hlo (hYlen ▸ hhi) hc + have hzero : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := + Fin.ext hz + have hTnA : Tn = A := by + have hs := sameStarAll R1 + change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs + rw [hzero] at hs + change R1.replacementBase.core = A at hs + exact hcore.symm.trans hs + have hincident : TreeIncidentEdge Tn (T.edge t) := by + rw [hTnA] + obtain ⟨i, hi⟩ := T.attaches t + let iA : Fin (A.length + 1) := ⟨i.val, by + have hiLt := i.isLt + change t.val = A.length at hpos + omega⟩ + have hiEq : Fin.castLE (Nat.succ_le_succ hAtoT.1) iA = + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ t.isLt)) := + Fin.ext rfl + refine ⟨A.vertex iA, vertexMemSelf A iA, ?_⟩ + rw [← hAtoT.2.1 iA, hiEq, Incident, hi] + exact Sym2.mem_mk_right _ _ + have hw := hweak3 + change HierarchyWeaklyStable K (Fin.last K.dividerCount) mu3 at hw + rw [hzero] at hw + change (if et.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn R1.replacementBase.closure + (TashkinovStoredColors et.series.data n) rho mu3 + else StableColoring Tn (TashkinovStoredColors et.series.data n) rho mu3) at hw + have hstable : StableColoring Tn (TashkinovStoredColors et.series.data n) + rho mu3 := by + split_ifs at hw with hp + · exact hw.1 + · exact hw + exact hstable.1 _ hincident + ⟨d.theta, Finset.mem_union_right _ hraw, htheta⟩ + · simp only [mu3, TwoColorComponentSwap, hga, htheta, ite_false, ite_self] + +private theorem helper_firstWitness_671.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), + TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ W.length := by + classical + intro V E _ _ G k e0 T rho W hWT c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hcv⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv + rcases hv with ⟨i, rfl⟩ + let candidates := Finset.univ.filter fun a : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex a) + have hi : Fin.castLE (Nat.succ_le_succ hWT.1) i ∈ candidates := by + simp [candidates, hWT.2.1 i, hcv] + have hn : candidates.Nonempty := ⟨_, hi⟩ + have hmin := Finset.min'_le candidates _ hi + have hmiss : c ∈ MissingColors G rho (T.vertex (candidates.min' hn)) := + (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hpos : HierarchyFirstMissingPosition rho T c = candidates.min' hn := by + simp [HierarchyFirstMissingPosition, candidates, hn] + constructor + · simpa [HierarchyFirstMissingPosition, candidates, hn] using hmiss + · rw [hpos] + have hle : (candidates.min' hn).val ≤ i.val := by + change (candidates.min' hn).val ≤ (Fin.castLE (Nat.succ_le_succ hWT.1) i).val at hmin + simpa using hmin + exact le_trans hle (Nat.le_of_lt_succ i.isLt) + +private theorem helper_caseGamma_1171.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; d.theta ∈ D → + ∀ gamma ∈ R.counterexample.good.gamma q d.theta, ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (0 : ℕ) < + S.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors S.coloring + (S.counterexample.hierarchy.stage (⟨S.counterexample.hierarchy.dividerCount, + Nat.lt_add_of_pos_right (of_decide_eq_true (id (Eq.refl true)))⟩ : Fin + (S.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + S.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors S.coloring + (S.corresponding.replacementETT.series.data.tree (Fin.last + S.corresponding.replacementETT.rounds).castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q D hthetaStored' gamma + hgammaTheta sameLast S + as_aux_lemma => + have hs : d.theta ∈ HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) := (sameLast S).1 ▸ hthetaStored' + have hg : gamma ∈ S.counterexample.good.gamma + (Fin.last S.counterexample.hierarchy.dividerCount) d.theta := + (sameLast S).2 d.theta hthetaStored' ▸ hgammaTheta + have hm := (Finset.mem_sdiff.mp (S.counterexample.good.avoidance _ d.theta hs hg)).1 + clear * - S gamma hm + let K := S.counterexample.hierarchy + cases hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) using Fin.cases with + | zero => + have hz : K.dividerCount = 0 := congrArg Fin.val hi + refine Or.inr ⟨hz, ?_⟩ + change gamma ∈ HierarchyStageMissingColors K (Fin.last K.dividerCount) at hm + rw [hi] at hm + exact hm + | succ i => + have hv : K.dividerCount = i.val + 1 := congrArg Fin.val hi + have hc : i.succ.castSucc = + (⟨K.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ : Fin (K.dividerCount + 2)) := + Fin.ext hv.symm + refine Or.inl ⟨Nat.lt_of_lt_of_eq (Nat.succ_pos i.val) hv.symm, ?_⟩ + change gamma ∈ HierarchyStageMissingColors K (Fin.last K.dividerCount) at hm + rw [hi] at hm + change gamma ∈ TreeMissingColors S.coloring (K.stage i.succ.castSucc) at hm + rw [hc] at hm + exact hm + +private theorem helper_changeRho_1319.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (gamma : Fin k), (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length → gamma ≠ + d.theta → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Z) → HierarchyFirstMissingPosition rho T gamma = + HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta + = HierarchyFirstMissingPosition sigma T d.theta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) + → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) < (↑(HierarchyFirstMissingPosition + sigma T d.theta) : ℕ) → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho + Z → + let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := + R1.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R1.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition rho T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition rho T d.theta); + have sameComponent : Prop := TwoColorComponent G rho gamma d.theta (Sum.inl va) = + TwoColorComponent G rho gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors rho Tnq ∨ Disjoint { gamma, d.theta } Dnq) → sameComponent) ∧ ( + H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors rho Tn ∨ Disjoint { gamma, d.theta } + Dn) → sameComponent) ∧ ( gamma ∈ TreeMissingColors rho A ∧ TreeColorSetClosed G rho A + { gamma } → sameComponent ∧ TreeInterchangeable G A rho gamma d.theta) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A ell Y Z + gamma hthetaFirstIndex hgammaNeTheta sameStarAll samePenultimate R1 rho hElemRho + hfirstGammaRho hfirstThetaRho hgammaUnusedRho hgammaBeforeTheta hpairMissingRho + as_aux_lemma => + exact ChangeLemma G k e0 R1.corresponding.replacementInput T rho + R1.corresponding.replacementETT R1.replacementBase R1.counterexample + R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung + R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality + (by change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - 1))) + rw [samePenultimate R1]; exact hElemRho) + R1.minimumContext.largeMissingSet gamma d.theta hgammaNeTheta + (by change gamma ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample + - 1)) ∧ + d.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength + R1.counterexample - 1)) + rw [samePenultimate R1]; exact hpairMissingRho) + (by + dsimp only + rw [sameStarAll R1, hfirstGammaRho, hfirstThetaRho] + intro _ + refine ⟨⟨_, _, rfl, rfl, hgammaBeforeTheta⟩, ?_⟩ + intro hc + obtain ⟨_, t, hlo, hhi, he⟩ := Finset.mem_filter.mp hc + rw [hthetaFirstIndex] at hhi + exact hgammaUnusedRho t hlo hhi he) + +private theorem helper_hbetaUnused_658.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let _ : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → sigma (T.edge t) ≠ some + beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R sigma H q A B D + as_aux_lemma => + have hc := d.conditionNine + rw [hj] at hc + change (beta ∉ _ ∧ beta ∉ _ ∧ beta ∉ _ ∧ beta ∉ D) ∨ + (beta ∈ D ∧ beta ∈ TreeMissingColors sigma B ∧ + Disjoint (R.counterexample.good.gamma q beta ∪ {beta}) + (Finset.univ.filter fun c => ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < A.length + j ∧ + sigma (T.edge t) = some c)) at hc + intro t hlo hhi he + have hm : beta ∈ (Finset.univ.filter fun c => ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < A.length + j ∧ sigma (T.edge t) = some c) := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, hhi, he⟩ + rcases hc with hc | hc + · exact hc.2.1 hm + · exact Finset.disjoint_left.mp hc.2.2 (by simp) hm + +private theorem helper_hthetaMissingY_676.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma + (Y.vertex (Fin.last Y.length)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R sigma Y + have ht := d.thetaMissingAtJ + change d.theta ∈ MissingColors G d.switched.coloring + ((HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy)).vertex + (Fin.last (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy)).length)) at ht + rw [hj] at ht + exact ht + +private theorem helper_sameStar_697.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C j; HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A X Y + as_aux_lemma => + clear * - G e0 base C R H q A + have helper : + ∀ (n m : ℕ) (X Y : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → + TreeSequence G e0), n = m → X = Y → HEq s t → Fin.cases (motive := fun _ => TreeSequence G + e0) X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => + TreeSequence G e0) Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by + intro n m X Y s t hnm hXY hst + subst m + have hs : s = t := eq_of_heq hst + simp [hXY, hs] + simpa [A, q, HierarchyStarredStage] using (helper _ _ base.core R.replacementBase.core + C.hierarchy.stage + H.stage R.sameGood.1.2.1 R.sameGood.1.1 + R.sameGood.1.2.2.1) + +private theorem helper_hcutJstrict_730.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A → TreeSequenceInitialSegment A T → j < ell → A.length + j < + T.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R H q A ell sameStar + hAtoT hjUpper + have hj : j < T.length - A.length := by + simpa only [ell, HierarchyFullTailLength, sameStar] using hjUpper + have hAT := hAtoT.1 + clear * - hj hAT + clear_value A + omega + +private theorem helper_prefixToTree_743.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (T : TreeSequence G e0) (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmT : m ≤ T.length), + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T := by + classical + intro V E G e0 T m hm hmT + as_aux_lemma => + refine ⟨hmT, ?_, ?_⟩ + · intro i + simp [TreeSequencePrefix] + · intro i + simp [TreeSequencePrefix] + +private theorem helper_commonPrefix_752.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) + {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T + → U.length ≤ W.length → TreeSequenceInitialSegment U W := by + classical + intro V E G e0 T U W hUT hWT hUW + as_aux_lemma => + rcases hUT with ⟨hu, huv, hue⟩ + rcases hWT with ⟨hw, hwv, hwe⟩ + refine ⟨hUW, ?_, ?_⟩ + · intro i + calc + W.vertex (Fin.castLE (Nat.succ_le_succ hUW) i) = + T.vertex (Fin.castLE (Nat.succ_le_succ hw) + (Fin.castLE (Nat.succ_le_succ hUW) i)) := (hwv _).symm + _ = T.vertex (Fin.castLE (Nat.succ_le_succ hu) i) := by congr 1 + _ = U.vertex i := huv i + · intro i + calc + W.edge (Fin.castLE hUW i) = T.edge (Fin.castLE hw (Fin.castLE hUW i)) := + (hwe _).symm + _ = T.edge (Fin.castLE hu i) := by congr 1 + _ = U.edge i := hue i + +private theorem helper_hElemZ_837.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = Z → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma ell Z + penultimatePrefixEq + as_aux_lemma => + have hp : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := + HierarchyCounterexamplePenultimateElementary G k e0 + R.corresponding.replacementInput T sigma R.corresponding.replacementETT + R.replacementBase R.counterexample R.minimumContext.proper + R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + R.minimumContext.largeMissingSet + intro u hu v hv huv + apply hp + · rw [penultimatePrefixEq]; exact hu + · rw [penultimatePrefixEq]; exact hv + · exact huv + +private theorem helper_vertexMemT_866.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T W : TreeSequence G + e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W + := by + classical + intro V E G e0 T W hWT i hi + as_aux_lemma => + let jW : Fin (W.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hWT.1) jW = i := Fin.ext rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨jW, ?_⟩ + rw [← hWT.2.1 jW, hcast] + +private theorem helper_hthetaY_887.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma + (Y.vertex (Fin.last Y.length)) → ( + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) → ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) (v : V) (c : Fin k), v ∈ + TreeSequenceVertexSet W → c ∈ MissingColors G rho v → c ∈ TreeMissingColors rho W) → + d.theta ∈ TreeMissingColors sigma Y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma Y hthetaMissingY + vertexMemSelf treeMissingIntro + as_aux_lemma => + clear_value Y + exact treeMissingIntro sigma Y (Y.vertex (Fin.last Y.length)) d.theta + (vertexMemSelf Y (Fin.last Y.length)) hthetaMissingY + +private theorem helper_hgammaUnused_907.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; d.theta ∈ D → + ∀ gamma ∈ R.counterexample.good.gamma q d.theta, (↑(HierarchyFirstMissingPosition sigma T + d.theta) : ℕ) = Y.length → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → sigma (T.edge t) ≠ some + gamma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A Y D + hthetaStored' gamma hgammaTheta hthetaFirstIndex + as_aux_lemma => + have havoid : gamma ∉ HierarchySegmentColors H q d.theta := + (Finset.mem_sdiff.mp + (R.counterexample.good.avoidance q d.theta hthetaStored' hgammaTheta)).2 + have hterminal : H.stage q.succ = T := by + simpa only [q, Fin.succ_last] using H.terminalStage + unfold HierarchySegmentColors at havoid + dsimp only at havoid + rw [hterminal, hthetaFirstIndex] at havoid + intro t hlo hhi hc + exact havoid (Finset.mem_filter.mpr + ⟨Finset.mem_univ _, t, hlo, Nat.lt_min.mpr ⟨hhi, t.isLt⟩, hc⟩) + +private theorem helper_horderedUnusedGammaBeta_921.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + ∀ gamma ∈ TreeMissingColors sigma A, TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment B X → TreeSequenceInitialSegment X Y → beta ∈ MissingColors G + sigma (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → + (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) (v : V) (c : Fin k), v ∈ + TreeSequenceVertexSet W → c ∈ MissingColors G rho v → c ∈ TreeMissingColors rho W) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → sigma (T.edge t) ≠ some + gamma) → gamma ∉ TreeMissingColors sigma A ∨ beta ∉ TreeMissingColors sigma A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) (T.vertex + (HierarchyFirstMissingPosition sigma T beta)) ∧ gamma ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition sigma + T beta) : ℕ) ∧ sigma (T.edge t) = some c} : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A X B Y gamma + hgammaA hAtoT hBtoX hXtoY hbetaFirst hgammaFirstLe hbetaFirstLe vertexMemT treeMissingIntro + hgammaUnused + as_aux_lemma => + intro h + rcases h with h | h + · exact (h hgammaA).elim + · have hafter : A.length < (HierarchyFirstMissingPosition sigma T beta).val := by + by_contra hh + have hb := vertexMemT A hAtoT (HierarchyFirstMissingPosition sigma T beta) + (Nat.le_of_not_gt hh) + exact h (treeMissingIntro sigma A _ beta hb hbetaFirst.1) + refine ⟨⟨_, _, rfl, rfl, hgammaFirstLe.trans_lt hafter⟩, ?_⟩ + intro hc + obtain ⟨_, t, hlo, hhi, he⟩ := Finset.mem_filter.mp hc + exact hgammaUnused t hlo + (hhi.trans_le (hbetaFirstLe.trans (hBtoX.1.trans hXtoY.1))) he + +private theorem helper_treeMissingSubset_949.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma U W hUW + as_aux_lemma => + intro c hc + obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset hUW hv, hmiss⟩ + +private theorem helper_firstChange_985.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (gamma : Fin k), gamma ≠ beta → HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A → ( gamma ∉ TreeMissingColors sigma A ∨ beta ∉ + TreeMissingColors sigma A → TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition + sigma T gamma)) (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ gamma ∉ ({c : + Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition sigma + T beta) : ℕ) ∧ sigma (T.edge t) = some c} : Finset (Fin k))) → ColoredVertexSetElementary + G sigma (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)))) → gamma ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ))) ∧ beta ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition sigma T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition sigma T beta); + have sameComponent : Prop := TwoColorComponent G sigma gamma beta (Sum.inl va) = + TwoColorComponent G sigma gamma beta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors sigma Tnq ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + sigma Tn ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ ( gamma ∈ TreeMissingColors sigma A ∧ TreeColorSetClosed G sigma A + ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A sigma gamma beta) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma + hgammaNeBeta sameStar horderedUnusedGammaBeta hchangeElementary hchangeMissing + as_aux_lemma => + exact ChangeLemma G k e0 R.corresponding.replacementInput T sigma + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored + R.minimumContext.lowerRung R.minimumContext.fewerDividers + R.minimumContext.lexicographicMinimality hchangeElementary + R.minimumContext.largeMissingSet gamma beta hgammaNeBeta hchangeMissing + (by + change (gamma ∉ TreeMissingColors sigma A ∨ beta ∉ TreeMissingColors sigma A) → + TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ + gamma ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition sigma T beta).val ∧ + sigma (T.edge t) = some c) + exact horderedUnusedGammaBeta) + +private theorem helper_hApositive_1008.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; (0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q A hq + as_aux_lemma => + have hlast : q = + (⟨H.dividerCount - 1, Nat.sub_lt hq (by decide)⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + change H.dividerCount = H.dividerCount - 1 + 1 + exact (Nat.sub_add_cancel hq).symm + change HierarchyStarredStage H q = _ + rw [hlast] + change H.stage _ = H.stage _ + congr 1 + apply Fin.ext + change H.dividerCount - 1 + 1 = H.dividerCount + exact Nat.sub_add_cancel hq + +private theorem helper_sameGammaBeta_1024.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ gamma ∈ TreeMissingColors sigma A, ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition sigma T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition sigma T beta); + have sameComponent : Prop := TwoColorComponent G sigma gamma beta (Sum.inl va) = + TwoColorComponent G sigma gamma beta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors sigma Tnq ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + sigma Tn ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ ( gamma ∈ TreeMissingColors sigma A ∧ TreeColorSetClosed G sigma A + ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A sigma gamma beta)) + → gamma ∈ HierarchyStageMissingColors H q → ( (0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma hgammaA + firstChange hgammaStageMissing hApositive + by_cases hzero : H.dividerCount = 0 + · have hgammaRaw : gamma ∈ TreeMissingColors sigma + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) := by + have hq0 : q = 0 := by + apply Fin.ext + simp [q, hzero] + rw [hq0] at hgammaStageMissing + simpa [HierarchyStageMissingColors] using hgammaStageMissing + exact firstChange.2.1 ⟨hzero, Or.inl hgammaRaw⟩ + · have hgammaLast : gamma ∈ TreeMissingColors sigma + (H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩) := by + have hstar : A = H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ := + hApositive (Nat.pos_of_ne_zero hzero) + rw [← hstar] + exact hgammaA + exact firstChange.1 ⟨Nat.pos_of_ne_zero hzero, Or.inl hgammaLast⟩ + +private theorem helper_hgammaTerminalDistinct_1048.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (gamma : Fin k), A.length + j < T.length → (↑(HierarchyFirstMissingPosition sigma T gamma) : + ℕ) ≤ A.length → T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex + (Fin.last T.length) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A gamma + hcutJstrict hgammaFirstLe he + have hv := congrArg Fin.val (T.vertex_injective he) + simp only [Fin.val_last] at hv + have hlt : A.length < T.length := (Nat.le_add_right A.length j).trans_lt hcutJstrict + exact Nat.ne_of_lt (hgammaFirstLe.trans_lt hlt) hv + +private theorem helper_hbetaTerminalDistinct_1056.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; A.length + j < T.length → Y.length = + A.length + j → TreeSequenceInitialSegment B X → TreeSequenceInitialSegment X Y → + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → T.vertex + (HierarchyFirstMissingPosition sigma T beta) ≠ T.vertex (Fin.last T.length) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A X B Y + hcutJstrict hYlen hBtoX hXtoY hbetaFirstLe he + have hv := congrArg Fin.val (T.vertex_injective he) + simp only [Fin.val_last] at hv + have hlt : Y.length < T.length := hYlen.symm ▸ hcutJstrict + exact Nat.ne_of_lt + ((hbetaFirstLe.trans (hBtoX.1.trans hXtoY.1)).trans_lt hlt) hv + +private theorem helper_hmu2One_1080.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ (gamma : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; + IsOneEdgeUncolored mu2 e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma z mu2 + as_aux_lemma => + constructor + · have he0 : sigma e0 = none := R.minimumContext.oneEdgeUncolored.1 + simp [mu2, TwoColorComponentSwap, he0] + · intro e he0 + obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 e he0 + by_cases heK : Sum.inr e ∈ TwoColorComponent G sigma gamma beta z + · by_cases heGamma : sigma e = some gamma + · exact ⟨beta, by simp [mu2, TwoColorComponentSwap, heK, heGamma] + ⟩ + · by_cases heBeta : sigma e = some beta + · exact ⟨gamma, by + simp [mu2, TwoColorComponentSwap, heK, heBeta] + ⟩ + · exact ⟨c, by + simpa [mu2, TwoColorComponentSwap, heK, heGamma, heBeta] using hc⟩ + · exact ⟨c, by simpa [mu2, TwoColorComponentSwap, heK] using hc⟩ + +private theorem helper_hfirstBetaOutside_1105.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ (gamma : Fin k), TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (Fin.last T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)))) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T beta)) ∉ TwoColorComponent G sigma gamma beta z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma sameGammaBeta + componentSelf hterminalDisjoint z hv + have hv' : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∈ + TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) := by + rw [sameGammaBeta] + exact componentSelf sigma gamma beta + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) + exact (Set.disjoint_left.mp hterminalDisjoint) hv hv' + +private theorem helper_hfixedThroughY_1130.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → sigma (T.edge t) ≠ some + beta) → + ∀ (gamma : Fin k), Y.length = A.length + j → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → sigma (T.edge t) ≠ some + gamma) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → mu2 (T.edge t) = sigma + (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A Y + hbetaUnused gamma hYlen hgammaUnused z mu2 + as_aux_lemma => + intro t hlo hhi + have hga := hgammaUnused t hlo (hYlen.symm ▸ hhi) + have hbe := hbetaUnused t hlo hhi + simp only [mu2, TwoColorComponentSwap, hga, hbe, ite_false, ite_self] + +private theorem helper_firstPreserved_1137.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (_ : ℕ), ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ W.length) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ G k e0 T j firstWitness W hWT rho sigma c helem hmiss hc + let _ := Fintype.ofFinite V + as_aux_lemma => + clear * - G T W rho sigma c helem hmiss hc firstWitness hWT + have hr := firstWitness rho W hWT c hc + have hc' : c ∈ TreeMissingColors sigma W := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ + have hs := firstWitness sigma W hWT c hc' + have pref (i : Fin (T.length + 1)) (hi : i.val ≤ W.length) : + T.vertex i ∈ TreeSequenceVertexSet W := by + let j : Fin (W.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hWT.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, (hWT.2.1 j).symm.trans (congrArg T.vertex he)⟩ + by_contra hne + have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ + T.vertex (HierarchyFirstMissingPosition rho T c) := + fun he => hne (T.vertex_injective he) + have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 + exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 + +private theorem helper_firstUnaffected_1162.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin + k), a ≠ b → IsProperEdgeColoring G rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition + (TwoColorComponentSwap G rho a b z) T c = HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ G k e0 T z rho a b c hne hp hca hcb + let _ := Fintype.ofFinite V + have hb := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + have he : (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G (TwoColorComponentSwap G rho a b z) (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hb.2.2.2 _ c hca hcb + unfold HierarchyFirstMissingPosition + rw [he] + +private theorem helper_missingTransport_1179.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (old new : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W Z → TreeMissingColors new W = + TreeMissingColors old W := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ell Z old new hm W hWZ + as_aux_lemma => + clear_value Z + clear * - old new hm W hWZ Z + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => + hm v (TreeSequenceInitialSegmentVertexSetSubset hWZ hv)) + +private theorem helper_hstoredMu2_1190.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ gamma ∈ TreeMissingColors sigma A, gamma ≠ beta → TreeSequenceInitialSegment Z T → + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) → beta ∈ TreeMissingColors + sigma Z → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G + rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = HierarchyFirstMissingPosition rho T c) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v) → + ∀ eta ∈ D, HierarchyFirstMissingPosition mu2 T eta = HierarchyFirstMissingPosition sigma T eta + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A ell Z D gamma + hgammaA hgammaNeBeta hZtoT hElemZ hbetaMissingZ z mu2 firstPreserved firstUnaffected + hmissingMu2 eta heta + have hneGamma : eta ≠ gamma := by + intro he + exact (Finset.mem_sdiff.mp heta).2 (he.symm ▸ hgammaA) + by_cases he : eta = beta + · subst eta + exact firstPreserved Z hZtoT sigma mu2 beta hElemZ hmissingMu2 hbetaMissingZ + · exact firstUnaffected z sigma gamma beta eta hgammaNeBeta + R.minimumContext.proper hneGamma he + +private theorem helper_hgammaCutoff_1202.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; d.theta ∈ D → + ∀ gamma ∈ R.counterexample.good.gamma q d.theta, d.theta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma + T d.theta) : ℕ) ≤ Y.length → + ∀ eta ∈ D, gamma ∈ R.counterexample.good.gamma q eta ∨ beta ∈ R.counterexample.good.gamma q + eta → (↑(HierarchyFirstMissingPosition sigma T eta) : ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q Y D + hthetaStored' gamma hgammaTheta hthetaFirst eta heta hmem + have he : eta = d.theta := by + by_contra hne + rcases hmem with hg | hb + · exact Finset.disjoint_left.mp + (R.counterexample.good.disjointPairs q eta d.theta heta hthetaStored' hne) + hg hgammaTheta + · exact d.betaOutsideGamma (Finset.mem_biUnion.mpr ⟨eta, heta, hb⟩) + subst eta + exact hthetaFirst.2 + +private theorem helper_originalStar_1216.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (S : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyStarredStage + C.hierarchy (Fin.last C.hierarchy.dividerCount) = HierarchyStarredStage + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx S + as_aux_lemma => + have helper : + ∀ (n m : ℕ) (U W : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → + TreeSequence G e0), n = m → U = W → HEq s t → Fin.cases (motive := fun _ => TreeSequence G + e0) U (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => + TreeSequence G e0) W (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by + intro n m U W s t hnm hUW hst + subst m + have he : s = t := eq_of_heq hst + simp only [hUW, he] + exact helper _ _ _ _ _ _ S.sameGood.1.2.1 S.sameGood.1.1 S.sameGood.1.2.2.1 + +private theorem helper_lastData_1247.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx S + as_aux_lemma => + obtain ⟨hc, hd⟩ := S.sameGood.2 + have hi : Fin.cast (congrArg (fun n => n + 1) hc) + (Fin.last C.hierarchy.dividerCount) = + Fin.last S.counterexample.hierarchy.dividerCount := Fin.ext hc + simpa only [hi] using hd (Fin.last C.hierarchy.dividerCount) + +private theorem helper_sameLast_1262.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma + (Fin.last C.hierarchy.dividerCount) eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q D lastData S + refine ⟨(lastData R).1.symm.trans (lastData S).1, ?_⟩ + intro eta heta + have hc : eta ∈ HierarchyStoredColorsAt C.hierarchy + (Fin.last C.hierarchy.dividerCount) := (lastData R).1.symm ▸ heta + exact ((lastData R).2 eta hc).symm.trans ((lastData S).2 eta hc) + +private theorem helper_weakEdges_1273.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : + ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : + TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage + K (Fin.last K.dividerCount)).edge t) := by + classical + intro V E _ _ _ _ G k e0 T input' old new et bs K hw ho hn + as_aux_lemma => + by_cases hz : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz + rw [hi] at hw ⊢ + exact P2813_T1_BaseDisplayedEdges G k e0 input' T old et bs new ho hn hw + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := + Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) + rw [hi] at hw ⊢ + intro t + by_cases ht : 1 ≤ t.val + · exact hw.2.1 t ht + · let W := HierarchyStarredStage K + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ + have he : t = ⟨0, W.positive⟩ := Fin.ext (by change t.val = 0; omega) + rw [he, W.first_edge, hn.1, ho.1] + +private theorem helper_hXYlen_1299.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; TreeSequenceInitialSegment A T → j ≤ + T.length - A.length → ( + ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + )) → Y.length = X.length + (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A X Y + hAtoT htail fullPrefixEq + change (HierarchyFullTailPrefix C j).length = + (HierarchyFullTailPrefix C (j - 1)).length + 1 + rw [fullPrefixEq j, fullPrefixEq (j - 1)] + simp only [TreeSequencePrefix] + have hj : 2 ≤ j := hpathLower + have hl : A.length + j ≤ T.length := by + have hAT := hAtoT.1 + clear * - htail hAT + omega + clear * - hj hl + omega + +private theorem helper_hweak1_1358.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (gamma : Fin k), gamma ≠ beta → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) → gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ))) → Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (Fin.last + T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)))) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; (0 : ℕ) < + H.dividerCount ∧ gamma ∈ TreeMissingColors sigma (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + sigma (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) ∨ gamma ∈ TreeMissingColors sigma A ∧ + gamma ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) ∧ beta ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → TwoColorPathComponent G sigma gamma beta z → + HierarchyWeaklyStable H q mu2 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma + hgammaNeBeta hchangeElementary hchangeMissing hterminalDisjoint z mu2 hcase1 hpath1 + as_aux_lemma => + exact (StableChangeCasesOneTwo G k e0 R.corresponding.replacementInput T sigma + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + hchangeElementary R.minimumContext.largeMissingSet gamma beta hgammaNeBeta + hchangeMissing z hpath1 mu2 rfl hcase1 hterminalDisjoint).1 + +private theorem helper_sameGammaTheta_1456.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ (gamma : Fin k), ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (0 : ℕ) < + S.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors S.coloring + (S.counterexample.hierarchy.stage (⟨S.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (S.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + S.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors S.coloring + (S.corresponding.replacementETT.series.data.tree (Fin.last + S.corresponding.replacementETT.rounds).castSucc)) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; HierarchyFirstMissingPosition rho T gamma = + HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta + = HierarchyFirstMissingPosition sigma T d.theta → ( + let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := + R1.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R1.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R1.coloring T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition R1.coloring T d.theta); + have sameComponent : Prop := TwoColorComponent G R1.coloring gamma d.theta (Sum.inl va) = + TwoColorComponent G R1.coloring gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ + (gamma ∈ TreeMissingColors R1.coloring Tnq ∨ Disjoint (insert gamma ({ d.theta } : Finset + (Fin k)) : Finset (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ + TreeMissingColors R1.coloring Tn ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : + Finset (Fin k)) Dn) → sameComponent) ∧ ( gamma ∈ TreeMissingColors R1.coloring A ∧ + TreeColorSetClosed G R1.coloring A ({ gamma } : Finset (Fin k)) → sameComponent ∧ + TreeInterchangeable G A R1.coloring gamma d.theta)) → TwoColorComponent G rho gamma + d.theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) = + TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition + sigma T d.theta))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma caseGamma R1 + rho hfirstGammaRho hfirstThetaRho changeRho + have he : TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T gamma))) = + TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T d.theta))) := by + rcases caseGamma R1 with ⟨hp, hm⟩ | ⟨hz, hm⟩ + · exact changeRho.1 ⟨hp, Or.inl hm⟩ + · exact changeRho.2.1 ⟨hz, Or.inl hm⟩ + rw [hfirstGammaRho, hfirstThetaRho] at he + exact he + +private theorem helper_hthetaTerminalDistinct_1473.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; A.length + j < T.length → Y.length = + A.length + j → (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length → + T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ T.vertex (Fin.last T.length) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A Y + hcutJstrict hYlen hthetaFirstIndex he + have hv := congrArg Fin.val (T.vertex_injective he) + simp only [Fin.val_last] at hv + rw [hthetaFirstIndex] at hv + have hlt : Y.length < T.length := hYlen.symm ▸ hcutJstrict + exact Nat.ne_of_lt hlt hv + +private theorem helper_swapOne_1493.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (T : TreeSequence G e0), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + ∀ (old : PartialEdgeColoring E k) (a b : Fin k), + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored (TwoColorComponentSwap G old a b z) e0 := by + classical + intro V E G k e0 T z old a b ho + as_aux_lemma => + constructor + · simp only [TwoColorComponentSwap, ho.1, reduceCtorEq, ite_false, ite_self] + · intro e he + obtain ⟨c, hc⟩ := ho.2 e he + by_cases hm : Sum.inr e ∈ TwoColorComponent G old a b z + · by_cases ha : old e = some a + · exact ⟨b, by simp only [TwoColorComponentSwap, hm, ha, ite_true]⟩ + · by_cases hb : old e = some b + · refine ⟨a, ?_⟩ + unfold TwoColorComponentSwap + rw [ite_eq_left hm, ite_eq_right ha, ite_eq_left hb] + · exact ⟨c, by simpa only [TwoColorComponentSwap, hm, ha, hb, ite_true, ite_false] + using hc⟩ + · exact ⟨c, by simpa only [TwoColorComponentSwap, hm, ite_false] using hc⟩ + +private theorem helper_hweak3_1551.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (gamma : Fin k), gamma ≠ d.theta → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Z) → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; + TwoColorPathComponent G rho gamma d.theta z → ( + let K : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := + R1.counterexample.hierarchy; (0 : ℕ) < K.dividerCount ∧ gamma ∈ TreeMissingColors rho + (K.stage (⟨K.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (K.dividerCount + (2 : ℕ)))) ∨ K.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + rho (R1.corresponding.replacementETT.series.data.tree (Fin.last + R1.corresponding.replacementETT.rounds).castSucc) ∨ gamma ∈ TreeMissingColors rho + (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ gamma ∉ TashkinovStoredColors + R1.corresponding.replacementETT.series.data (Fin.last + R1.corresponding.replacementETT.rounds) ∧ d.theta ∉ TashkinovStoredColors + R1.corresponding.replacementETT.series.data (Fin.last + R1.corresponding.replacementETT.rounds))) → Disjoint (TwoColorComponent G rho gamma + d.theta z) (TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition rho T gamma)))) → gamma ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - (1 + : ℕ))) ∧ d.theta ∈ TreeMissingColors rho (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - (1 : ℕ))) → HierarchyWeaklyStable + R1.counterexample.hierarchy (Fin.last R1.counterexample.hierarchy.dividerCount) mu3 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d ell Z gamma hgammaNeTheta z + samePenultimate R1 rho hElemRho mu3 hpath3 hcase3 hdisjoint3First hmissingPairCurrent + as_aux_lemma => + exact (StableChangeCasesOneTwo G k e0 R1.corresponding.replacementInput T rho + R1.corresponding.replacementETT R1.replacementBase R1.counterexample + R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung + R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality + (by + change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - 1))) + rw [samePenultimate R1] + exact hElemRho) R1.minimumContext.largeMissingSet + gamma d.theta hgammaNeTheta hmissingPairCurrent z hpath3 mu3 rfl hcase3 hdisjoint3First).1 + +private theorem helper_hstored3_1568.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ gamma ∈ TreeMissingColors sigma A, TreeSequenceInitialSegment Z T → gamma ≠ d.theta → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G + rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = HierarchyFirstMissingPosition rho T c) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Z) → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors + rho Z → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu3 v = MissingColors G rho v) → + ∀ eta ∈ HierarchyStoredColorsAt R1.counterexample.hierarchy (Fin.last + R1.counterexample.hierarchy.dividerCount), HierarchyFirstMissingPosition mu3 T eta = + HierarchyFirstMissingPosition rho T eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A ell Z D gamma + hgammaA hZtoT hgammaNeTheta z firstPreserved firstUnaffected sameLast R1 rho hElemRho + hpairMissingRho mu3 hmissing3 eta heta + have hetaD : eta ∈ D := (sameLast R1).1.symm ▸ heta + have hneGamma : eta ≠ gamma := by + intro he + exact (Finset.mem_sdiff.mp hetaD).2 (he.symm ▸ hgammaA) + by_cases he : eta = d.theta + · subst eta + exact firstPreserved Z hZtoT rho mu3 d.theta hElemRho hmissing3 hpairMissingRho.2 + · exact firstUnaffected z rho gamma d.theta eta hgammaNeTheta + R1.minimumContext.proper hneGamma he + +private theorem helper_hgammaCutoff3_1581.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; d.theta ∈ D → + ∀ gamma ∈ R.counterexample.good.gamma q d.theta, d.theta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma + T d.theta) : ℕ) ≤ Y.length → d.theta ∉ D.biUnion (R.counterexample.good.gamma q) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; HierarchyFirstMissingPosition rho T d.theta + = HierarchyFirstMissingPosition sigma T d.theta → + ∀ eta ∈ HierarchyStoredColorsAt R1.counterexample.hierarchy (Fin.last + R1.counterexample.hierarchy.dividerCount), gamma ∈ R1.counterexample.good.gamma (Fin.last + R1.counterexample.hierarchy.dividerCount) eta ∨ d.theta ∈ R1.counterexample.good.gamma + (Fin.last R1.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition + rho T eta) : ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q Y D + hthetaStored' gamma hgammaTheta hthetaFirst hthetaOutsideGamma sameLast R1 rho + hfirstThetaRho eta heta hmem + have hetaD : eta ∈ D := (sameLast R1).1.symm ▸ heta + rw [← (sameLast R1).2 eta hetaD] at hmem + have he : eta = d.theta := by + by_contra hne + rcases hmem with hg | ht + · exact Finset.disjoint_left.mp + (R.counterexample.good.disjointPairs q eta d.theta hetaD hthetaStored' hne) + hg hgammaTheta + · exact hthetaOutsideGamma (Finset.mem_biUnion.mpr ⟨eta, hetaD, ht⟩) + subst eta + rw [hfirstThetaRho] + exact hthetaFirst.2 + +private theorem helper_hYTerminalDistinct_1628.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; A.length + j < T.length → Y.length = + A.length + j → TreeSequenceInitialSegment Y T → Y.vertex (Fin.last Y.length) ≠ T.vertex + (Fin.last T.length) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A Y hcutJstrict + hYlen hYtoT he + have hi := T.vertex_injective ((hYtoT.2.1 (Fin.last Y.length)).trans he) + have hv := congrArg Fin.val hi + simp only [Fin.val_castLE, Fin.val_last] at hv + exact Nat.ne_of_lt (hYlen.symm ▸ hcutJstrict) hv + +private theorem helper_hjEligible_1647.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + ∀ (gamma : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; d.theta ∈ + MissingColors G mu3 (T.vertex (Fin.last T.length)) → d.theta ∈ MissingColors G mu3 + (Y.vertex (Fin.last Y.length)) → + ∀ (R2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), R2.coloring = mu3 + → j ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hpathLower hpathUpper Y + gamma z R1 rho mu3 hthetaTerminalMu3 hthetaYMu3 R2 hR2 + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨?_, ?_⟩, R2, d.theta, ?_, ?_⟩ + · exact (by decide : 1 ≤ 2).trans hpathLower + · exact Nat.le_sub_one_of_lt hpathUpper + · rw [hR2] + exact hthetaYMu3 + · rw [hR2] + exact hthetaTerminalMu3 + +private theorem helper_continuation_3145.{u_1, u_2} : + helperContinuation3145Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell Y Z D hthetaStored' gamma hgammaTheta hgammaA + hgammaNeBeta sameStar hAtoT hcutJstrict hYlen hYtoT hYtoZ hZtoT hAtoY vertexMemSelf hthetaY + hthetaFirst hthetaOutsideGamma hgammaNeTheta treeMissingSubset componentSelf z mu2 + firstPreserved firstUnaffected missingTransport sameStarAll samePenultimate sameLast + routeToY caseGamma hsuffixY hsplitMissing2 hAYstrict R1 hR1 sameFullPrefix rho hmissingRho + hElemRho hfirstGammaRho hfirstThetaRho hthetaYRho hgammaTerminalRho hgammaUnusedRho + hpairMissingRho hdisjoint3 mu3 hpath3 hmu3One hmissing3 + have hcase3 : + let K := R1.counterexample.hierarchy + (0 < K.dividerCount ∧ gamma ∈ TreeMissingColors rho + (K.stage ⟨K.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩)) ∨ + (K.dividerCount = 0 ∧ + (gamma ∈ TreeMissingColors rho + (R1.corresponding.replacementETT.series.data.tree + (Fin.last R1.corresponding.replacementETT.rounds).castSucc) ∨ + (gamma ∈ TreeMissingColors rho (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ + gamma ∉ TashkinovStoredColors R1.corresponding.replacementETT.series.data + (Fin.last R1.corresponding.replacementETT.rounds) ∧ + d.theta ∉ TashkinovStoredColors R1.corresponding.replacementETT.series.data + (Fin.last R1.corresponding.replacementETT.rounds)))) := by + rcases caseGamma R1 with h | ⟨hz, hm⟩ + · exact Or.inl h + · exact Or.inr ⟨hz, Or.inl hm⟩ + have hdisjoint3First : Disjoint (TwoColorComponent G rho gamma d.theta z) + (TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T gamma)))) := by + rw [hfirstGammaRho] + exact hdisjoint3 + have hmissingPairCurrent : gamma ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - + 1)) ∧ + d.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - + 1)) := by + rw [samePenultimate R1] + exact hpairMissingRho + have hweak3 : HierarchyWeaklyStable R1.counterexample.hierarchy + (Fin.last R1.counterexample.hierarchy.dividerCount) mu3 := by + exact @helper_hweak3_1551 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@d) (@gamma) (@hgammaNeTheta) (@samePenultimate) (@R1) (@hElemRho) (@hpath3) (@hcase3) + (@hdisjoint3First) (@hmissingPairCurrent) + have hfixed3 : ∀ t : Fin T.length, A.length ≤ t.val → t.val < Y.length → + mu3 (T.edge t) = rho (T.edge t) := by + exact @helper_hfixed3_1220 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha beta d j hpathLower hpathUpper gamma sameStar hAtoT + hYlen hYtoT vertexMemSelf sameStarAll samePenultimate R1 sameFullPrefix hElemRho + hthetaYRho hgammaUnusedRho hweak3 + have hstored3 : ∀ eta ∈ HierarchyStoredColorsAt R1.counterexample.hierarchy + (Fin.last R1.counterexample.hierarchy.dividerCount), + HierarchyFirstMissingPosition mu3 T eta = HierarchyFirstMissingPosition rho T eta := by + exact @helper_hstored3_1568 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@d) (@gamma) (@hgammaA) (@hZtoT) (@hgammaNeTheta) (@firstPreserved) (@firstUnaffected) + (@sameLast) (@R1) (@hElemRho) (@hpairMissingRho) (@hmissing3) + have hgammaCutoff3 : ∀ eta ∈ HierarchyStoredColorsAt R1.counterexample.hierarchy + (Fin.last R1.counterexample.hierarchy.dividerCount), + (gamma ∈ R1.counterexample.good.gamma (Fin.last R1.counterexample.hierarchy.dividerCount) + eta ∨ + d.theta ∈ R1.counterexample.good.gamma (Fin.last + R1.counterexample.hierarchy.dividerCount) eta) → + (HierarchyFirstMissingPosition rho T eta).val ≤ Y.length := by + exact @helper_hgammaCutoff3_1581 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hthetaStored') (@gamma) (@hgammaTheta) (@hthetaFirst) + (@hthetaOutsideGamma) (@sameLast) (@R1) (@hfirstThetaRho) + have hsuffixMu2 : TashkinovAugmentationSequence mu2 Y T := + TashkinovAugmentationSequenceComponentSwap G k e0 sigma gamma beta hgammaNeBeta z + Y T hsuffixY hsplitMissing2.1 hsplitMissing2.2 + have hsuffixRho : TashkinovAugmentationSequence rho Y T := by + change TashkinovAugmentationSequence R1.coloring Y T + rw [hR1] + exact hsuffixMu2 + have hsplitMissing3 : gamma ∈ TreeMissingColors mu3 Y ∧ d.theta ∈ TreeMissingColors mu3 Y := by + rw [missingTransport rho mu3 hmissing3 Y hYtoZ, + missingTransport sigma rho hmissingRho Y hYtoZ] + exact ⟨treeMissingSubset hAtoY hgammaA, hthetaY⟩ + have hroute3 := routeToY R1 mu3 hmu3One hweak3 hfixed3 hmissing3 + obtain ⟨_, _, corr2, hmax2, bs2, K2, good2, same2⟩ := + StableChangeCasesOneTwoSplitTail G k e0 R1.corresponding.replacementInput T rho + R1.corresponding.replacementETT R1.replacementBase R1.counterexample R1.minimumContext + gamma d.theta hgammaNeTheta hmissingPairCurrent z hpath3 mu3 rfl hcase3 hdisjoint3First + Y (by dsimp only; rw [sameStarAll R1]; exact hAtoY) + (by dsimp only; rw [sameStarAll R1]; exact hAYstrict) + (by rw [samePenultimate R1]; exact hYtoZ) + (by dsimp only; rw [sameStarAll R1]; exact hfixed3) hroute3 hsuffixRho + hsplitMissing3 (by rw [samePenultimate R1]; exact hmissing3) + hstored3 hgammaCutoff3 + have hthetaTerminalMu3 : d.theta ∈ MissingColors G mu3 (T.vertex (Fin.last T.length)) := + (TwoColorComponentSwapMissingBehavior G rho gamma d.theta hgammaNeTheta + R1.minimumContext.proper z).2.1 _ (componentSelf rho gamma d.theta _) hgammaTerminalRho + have hthetaYMu3 : d.theta ∈ MissingColors G mu3 (Y.vertex (Fin.last Y.length)) := by + rw [hmissing3 _ (TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (vertexMemSelf Y (Fin.last Y.length)))] + exact hthetaYRho + have hYTerminalDistinct : Y.vertex (Fin.last Y.length) ≠ T.vertex (Fin.last T.length) := by + exact @helper_hYTerminalDistinct_1628 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@hYlen) (@hYtoT) + let C2 : HierarchyCounterexample bs2 := { + positive := Nat.lt_of_lt_of_le (by decide) corr2.replacementETT.roundsPositive + hierarchy := K2 + good := good2 + maximum := hmax2 + notElementary := by + intro he + exact Finset.disjoint_left.mp (he + (TreeSequenceInitialSegmentVertexSetSubset hYtoT (vertexMemSelf Y (Fin.last Y.length))) + (vertexMemSelf T (Fin.last T.length)) hYTerminalDistinct) + hthetaYMu3 hthetaTerminalMu3 } + obtain ⟨R2, hR2⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx R1 mu3 corr2 bs2 C2 same2 + have hjEligible : j ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + := by + exact @helper_hjEligible_1647 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hpathLower) (@hpathUpper) (@gamma) (@R1) + (@hthetaTerminalMu3) (@hthetaYMu3) (@R2) (@hR2) + have hbound := HierarchySituationThreeEligibleIndexBound G k e0 input T phi ett base C ctx + (by rw [hj]; exact hpathLower) (by rw [hj]; exact hpathUpper) hvertexMissing j hjEligible + rw [hj] at hbound + exact Nat.lt_irrefl j hbound + +private theorem helper_continuation_2545.{u_1, u_2} : + helperContinuation2545Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell X B Y Z D hthetaStored' hbetaB hthetaMissingY gamma + hgammaTheta hgammaA hgammaNeBeta sameStar hAtoT hcutJstrict commonPrefix hYlen hBtoT hYtoT + hBtoX hXtoY hYtoZ hZtoT hAtoY penultimatePrefixEq hElemZ hgammaFirst hgammaFirstLe + vertexMemT vertexMemSelf hthetaY hthetaFirst hthetaFirstIndex hthetaOutsideGamma + hgammaNeTheta hgammaUnused hAtoZ treeMissingSubset hgammaMissingZ hbetaMissingZ + hchangeElementary hchangeMissing componentSelf hgammaTerminalDistinct separation1 + hterminalDisjoint z mu2 hmu2One hgammaFirstMu2 hgammaTerminalMu2 hfixedThroughY + firstPreserved firstUnaffected hmissingMu2 missingTransport hstoredMu2 hgammaCutoff + sameStarAll samePenultimate sameLast routeToY caseGamma + have hcase1 : + (0 < H.dividerCount ∧ gamma ∈ TreeMissingColors sigma + (H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩)) ∨ + (H.dividerCount = 0 ∧ + (gamma ∈ TreeMissingColors sigma + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) ∨ + (gamma ∈ TreeMissingColors sigma A ∧ + gamma ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) ∧ + beta ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)))) := by + rcases caseGamma R with h | ⟨hz, hm⟩ + · exact Or.inl h + · exact Or.inr ⟨hz, Or.inl hm⟩ + have hpath1 : TwoColorPathComponent G sigma gamma beta z := separation1.2.1 + have hweak1 : HierarchyWeaklyStable H q mu2 := by + exact @helper_hweak1_1358 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@d) (@gamma) (@hgammaNeBeta) (@hchangeElementary) (@hchangeMissing) (@hterminalDisjoint) + (@hcase1) (@hpath1) + have hsuffixX : TashkinovAugmentationSequence sigma X T := by + simpa only [X, sigma, R, hj] using d.transportedSuffix + have hsuffixY : TashkinovAugmentationSequence sigma Y T := + TashkinovAugmentationSequenceSuffix sigma X Y T hsuffixX hXtoY hYtoT + have hsplitMissing2 : gamma ∈ TreeMissingColors mu2 Y ∧ beta ∈ TreeMissingColors mu2 Y := by + rw [missingTransport sigma mu2 hmissingMu2 Y hYtoZ] + exact ⟨treeMissingSubset hAtoY hgammaA, + treeMissingSubset (commonPrefix hBtoT hYtoT (hBtoX.1.trans hXtoY.1)) hbetaB⟩ + have hAYstrict : A.length < Y.length := by + have hj : 2 ≤ j := hpathLower + clear * - hj hYlen + omega + have hroute2 := routeToY R mu2 hmu2One hweak1 + (fun t hlo hhi => hfixedThroughY t hlo (hYlen ▸ hhi)) hmissingMu2 + obtain ⟨_, _, corr1, hmax1, bs1, K1, good1, same1⟩ := + StableChangeCasesOneTwoSplitTail G k e0 R.corresponding.replacementInput T sigma + R.corresponding.replacementETT R.replacementBase R.counterexample R.minimumContext + gamma beta hgammaNeBeta hchangeMissing z hpath1 mu2 rfl hcase1 hterminalDisjoint + Y hAtoY hAYstrict (by rw [penultimatePrefixEq]; exact hYtoZ) + (fun t hlo hhi => hfixedThroughY t hlo (hYlen ▸ hhi)) hroute2 hsuffixY + hsplitMissing2 (by rw [penultimatePrefixEq]; exact hmissingMu2) + hstoredMu2 hgammaCutoff + let C1 : HierarchyCounterexample bs1 := { + positive := Nat.lt_of_lt_of_le (by decide) corr1.replacementETT.roundsPositive + hierarchy := K1 + good := good1 + maximum := hmax1 + notElementary := by + intro he + exact Finset.disjoint_left.mp (he + (vertexMemSelf T (HierarchyFirstMissingPosition sigma T gamma)) + (vertexMemSelf T (Fin.last T.length)) hgammaTerminalDistinct) + hgammaFirstMu2 hgammaTerminalMu2 } + obtain ⟨R1, hR1⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx R mu2 corr1 bs1 C1 same1 + have sameFullPrefix (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) (m : ℕ) : + HierarchyFullTailPrefix S.counterexample m = HierarchyFullTailPrefix C m := by + simp only [HierarchyFullTailPrefix, sameStarAll S, sameStar] + let rho := R1.coloring + have hmissingRho : ∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G rho v = MissingColors G sigma v := by + rw [show rho = mu2 from hR1] + exact hmissingMu2 + have hElemRho : ColoredVertexSetElementary G rho (TreeSequenceVertexSet Z) := by + intro u hu v hv huv + rw [hmissingRho u hu, hmissingRho v hv] + exact hElemZ hu hv huv + have hthetaMissingZ : d.theta ∈ TreeMissingColors sigma Z := treeMissingSubset hYtoZ hthetaY + have hfirstGammaRho : HierarchyFirstMissingPosition rho T gamma = + HierarchyFirstMissingPosition sigma T gamma := + firstPreserved Z hZtoT sigma rho gamma hElemZ hmissingRho hgammaMissingZ + have hfirstThetaRho : HierarchyFirstMissingPosition rho T d.theta = + HierarchyFirstMissingPosition sigma T d.theta := + firstPreserved Z hZtoT sigma rho d.theta hElemZ hmissingRho hthetaMissingZ + have hfirstBetaRho : HierarchyFirstMissingPosition rho T beta = + HierarchyFirstMissingPosition sigma T beta := + firstPreserved Z hZtoT sigma rho beta hElemZ hmissingRho hbetaMissingZ + have hgammaWitnessRho : gamma ∈ MissingColors G rho + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) := by + rw [hmissingRho _ (vertexMemT Z hZtoT (HierarchyFirstMissingPosition sigma T gamma) + (hgammaFirstLe.trans hAtoZ.1))] + exact hgammaFirst.1 + have hthetaWitnessRho : d.theta ∈ MissingColors G rho + (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) := by + rw [hmissingRho _ (vertexMemT Z hZtoT (HierarchyFirstMissingPosition sigma T d.theta) + (hthetaFirst.2.trans hYtoZ.1))] + exact hthetaFirst.1 + have hthetaYRho : d.theta ∈ MissingColors G rho (Y.vertex (Fin.last Y.length)) := by + rw [hmissingRho _ (TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (vertexMemSelf Y (Fin.last Y.length)))] + exact hthetaMissingY + have hgammaTerminalRho : gamma ∈ MissingColors G rho (T.vertex (Fin.last T.length)) := by + rw [show rho = mu2 from hR1] + exact hgammaTerminalMu2 + have hgammaUnusedRho : ∀ t : Fin T.length, A.length ≤ t.val → t.val < Y.length → + rho (T.edge t) ≠ some gamma := by + intro t hlo hhi hc + rw [show rho = mu2 from hR1, hfixedThroughY t hlo (hYlen ▸ hhi)] at hc + exact hgammaUnused t hlo hhi hc + have hgammaBeforeTheta : (HierarchyFirstMissingPosition sigma T gamma).val < + (HierarchyFirstMissingPosition sigma T d.theta).val := by + rw [hthetaFirstIndex] + exact hgammaFirstLe.trans_lt hAYstrict + have hpairMissingRho : gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho Z := by + have he := missingTransport sigma rho hmissingRho Z ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + rw [he] + exact ⟨hgammaMissingZ, hthetaMissingZ⟩ + have changeRho := by + exact @helper_changeRho_1319 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha beta d j gamma hthetaFirstIndex hgammaNeTheta + sameStarAll samePenultimate R1 hElemRho hfirstGammaRho hfirstThetaRho hgammaUnusedRho + hgammaBeforeTheta hpairMissingRho + have sameGammaTheta : TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) = + TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T d.theta))) := by + exact @helper_sameGammaTheta_1456 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@gamma) (@caseGamma) (@R1) (@hfirstGammaRho) (@hfirstThetaRho) + (@changeRho) + have hgammaThetaDistinct : T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ + T.vertex (HierarchyFirstMissingPosition sigma T d.theta) := by + intro he + exact ne_of_lt hgammaBeforeTheta (congrArg Fin.val (T.vertex_injective he)) + have hthetaTerminalDistinct : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ + T.vertex (Fin.last T.length) := by + exact @helper_hthetaTerminalDistinct_1473 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@hYlen) (@hthetaFirstIndex) + have separation3 := P2905_T2_ElementaryTerminalComponent G rho gamma d.theta + hgammaNeTheta R1.minimumContext.proper (TreeSequenceVertexSet Z) hElemRho + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) + (T.vertex (Fin.last T.length)) + (vertexMemT Z hZtoT _ (hgammaFirstLe.trans hAtoZ.1)) + (vertexMemT Z hZtoT _ (hthetaFirst.2.trans hYtoZ.1)) + hgammaTerminalDistinct.symm hthetaTerminalDistinct.symm + hgammaWitnessRho hthetaWitnessRho (Or.inl hgammaTerminalRho) sameGammaTheta + have hdisjoint3 := separation3.1 + let mu3 := TwoColorComponentSwap G rho gamma d.theta z + have hpath3 : TwoColorPathComponent G rho gamma d.theta z := separation3.2.1 + have swapOne (old : PartialEdgeColoring E k) (a b : Fin k) + (ho : IsOneEdgeUncolored old e0) : + IsOneEdgeUncolored (TwoColorComponentSwap G old a b z) e0 := by + exact @helper_swapOne_1493 (@V) (@E) (@G) (@k) (@e0) (@T) (@old) (@a) (@b) (@ho) + have hmu3One : IsOneEdgeUncolored mu3 e0 := swapOne rho gamma d.theta + R1.minimumContext.oneEdgeUncolored + have hgammaOutside3 : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) ∉ + TwoColorComponent G rho gamma d.theta z := by + intro hm + exact Set.disjoint_left.mp hdisjoint3 hm (componentSelf rho gamma d.theta _) + have hthetaOutside3 : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) ∉ + TwoColorComponent G rho gamma d.theta z := by + intro hm + apply Set.disjoint_left.mp hdisjoint3 hm + rw [sameGammaTheta] + exact componentSelf rho gamma d.theta _ + have hmissing3 : ∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G mu3 v = MissingColors G rho v := separation3.2.2 + exact @helper_continuation_3145 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) (@hthetaStored') + (@gamma) (@hgammaTheta) (@hgammaA) (@hgammaNeBeta) (@sameStar) (@hAtoT) (@hcutJstrict) + (@hYlen) (@hYtoT) (@hYtoZ) (@hZtoT) (@hAtoY) (@vertexMemSelf) (@hthetaY) (@hthetaFirst) + (@hthetaOutsideGamma) (@hgammaNeTheta) (@treeMissingSubset) (@componentSelf) + (@firstPreserved) (@firstUnaffected) (@missingTransport) (@sameStarAll) (@samePenultimate) + (@sameLast) (@routeToY) (@caseGamma) (@hsuffixY) (@hsplitMissing2) (@hAYstrict) (@R1) + (@hR1) (@sameFullPrefix) (@hmissingRho) (@hElemRho) (@hfirstGammaRho) (@hfirstThetaRho) + (@hthetaYRho) (@hgammaTerminalRho) (@hgammaUnusedRho) (@hpairMissingRho) (@hdisjoint3) + (@hpath3) (@hmu3One) (@hmissing3) +private theorem helper_continuation_2327.{u_1, u_2} : + helperContinuation2327Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell X B Y Z D hthetaStored' hbetaB hthetaMissingY gamma + hgammaTheta hgammaA hgammaNeBeta sameStar hAtoT htail hcutJstrict fullPrefixEq commonPrefix + hYlen hBtoT hYtoT hBtoX hXtoY hYtoZ hZtoT hAtoY penultimatePrefixEq hElemZ hgammaFirst + hgammaFirstLe vertexMemT vertexMemSelf hthetaY hthetaFirst hthetaFirstIndex + hthetaOutsideGamma hgammaNeTheta hgammaUnused hAtoZ treeMissingSubset hgammaMissingZ + hbetaMissingZ hchangeElementary hchangeMissing componentSelf hgammaTerminalDistinct + separation1 hterminalDisjoint z mu2 hmu2One hgammaFirstMu2 hgammaTerminalMu2 hfixedThroughY + firstPreserved + have firstUnaffected (z : Sum V E) (rho : PartialEdgeColoring E k) (a b c : Fin k) + (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (hca : c ≠ a) (hcb : c ≠ b) : + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c := by + exact @helper_firstUnaffected_1162 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@z) (@rho) (@a) (@b) (@c) (@hne) (@hp) (@hca) (@hcb) + have hmissingMu2 : ∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G mu2 v = MissingColors G sigma v := separation1.2.2 + have missingTransport (old new : PartialEdgeColoring E k) + (hm : ∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G new v = MissingColors G old v) + (W : TreeSequence G e0) (hWZ : TreeSequenceInitialSegment W Z) : + TreeMissingColors new W = TreeMissingColors old W := by + exact @helper_missingTransport_1179 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@old) (@new) + (@hm) (@W) (@hWZ) + have hstoredMu2 : ∀ eta ∈ D, + HierarchyFirstMissingPosition mu2 T eta = + HierarchyFirstMissingPosition sigma T eta := by + exact @helper_hstoredMu2_1190 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@gamma) (@hgammaA) (@hgammaNeBeta) (@hZtoT) (@hElemZ) + (@hbetaMissingZ) (@firstPreserved) (@firstUnaffected) (@hmissingMu2) + have hgammaCutoff : ∀ eta ∈ D, + (gamma ∈ R.counterexample.good.gamma q eta ∨ + beta ∈ R.counterexample.good.gamma q eta) → + (HierarchyFirstMissingPosition sigma T eta).val ≤ Y.length := by + exact @helper_hgammaCutoff_1202 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hthetaStored') (@gamma) (@hgammaTheta) (@hthetaFirst) + have originalStar (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) := by + exact @helper_originalStar_1216 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@S) + have sameStarAll (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) = A := + (originalStar S).symm.trans sameStar + have samePenultimate (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + HierarchyFullTailPrefix S.counterexample + (HierarchyFullTailLength S.counterexample - 1) = Z := by + simp only [HierarchyFullTailPrefix, HierarchyFullTailLength, sameStarAll S] + simp only [Z, ell, HierarchyFullTailPrefix, HierarchyFullTailLength, sameStar] + have lastData (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + exact @helper_lastData_1247 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@S) + have sameLast (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + D = HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + exact @helper_sameLast_1262 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@d) (@lastData) (@S) + have weakEdges {input' : PartialEdgeColoring E k} + (old new : PartialEdgeColoring E k) + (et : ExtendedTashkinovTree G k e0 input' T old) + (bs : HierarchyBase et old) (K : TashkinovHierarchy et bs) + (hw : HierarchyWeaklyStable K (Fin.last K.dividerCount) new) + (ho : IsOneEdgeUncolored old e0) (hn : IsOneEdgeUncolored new e0) : + ∀ t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length, + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by + exact @helper_weakEdges_1273 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@input') (@old) (@new) (@et) (@bs) (@K) (@hw) (@ho) + (@hn) + have hXYlen : Y.length = X.length + 1 := by + exact @helper_hXYlen_1299 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@d) (@j) (@hj) (@hpathLower) (@hAtoT) (@htail) (@fullPrefixEq) + have routeToY (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) (nu : PartialEdgeColoring E k) + (hn : IsOneEdgeUncolored nu e0) + (hw : HierarchyWeaklyStable S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) nu) + (hf : ∀ t : Fin T.length, A.length ≤ t.val → t.val < Y.length → + nu (T.edge t) = S.coloring (T.edge t)) + (hm : ∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G nu v = MissingColors G S.coloring v) : + let et := S.corresponding.replacementETT + let n := Fin.last et.rounds + let Tn := et.series.data.tree n.castSucc + (et.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence nu Tn Y) ∨ + ((et.series.data.kind n = some TashkinovExtensionKind.SE ∨ + et.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + et.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence nu seed Y) := by + exact @helper_routeToY_837 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx P alpha beta d j hj hpathLower hAtoT commonPrefix hYlen hYtoT + hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn hw hf hm + have caseGamma (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + (0 < S.counterexample.hierarchy.dividerCount ∧ + gamma ∈ TreeMissingColors S.coloring (S.counterexample.hierarchy.stage + ⟨S.counterexample.hierarchy.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩)) ∨ + (S.counterexample.hierarchy.dividerCount = 0 ∧ + gamma ∈ TreeMissingColors S.coloring + (S.corresponding.replacementETT.series.data.tree + (Fin.last S.corresponding.replacementETT.rounds).castSucc)) := by + exact @helper_caseGamma_1171 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha beta d hthetaStored' gamma hgammaTheta sameLast S + exact @helper_continuation_2545 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) (@hthetaStored') + (@hbetaB) (@hthetaMissingY) (@gamma) (@hgammaTheta) (@hgammaA) (@hgammaNeBeta) (@sameStar) + (@hAtoT) (@hcutJstrict) (@commonPrefix) (@hYlen) (@hBtoT) (@hYtoT) (@hBtoX) (@hXtoY) + (@hYtoZ) (@hZtoT) (@hAtoY) (@penultimatePrefixEq) (@hElemZ) (@hgammaFirst) (@hgammaFirstLe) + (@vertexMemT) (@vertexMemSelf) (@hthetaY) (@hthetaFirst) (@hthetaFirstIndex) + (@hthetaOutsideGamma) (@hgammaNeTheta) (@hgammaUnused) (@hAtoZ) (@treeMissingSubset) + (@hgammaMissingZ) (@hbetaMissingZ) (@hchangeElementary) (@hchangeMissing) (@componentSelf) + (@hgammaTerminalDistinct) (@separation1) (@hterminalDisjoint) (@hmu2One) (@hgammaFirstMu2) + (@hgammaTerminalMu2) (@hfixedThroughY) (@firstPreserved) (@firstUnaffected) (@hmissingMu2) + (@missingTransport) (@hstoredMu2) (@hgammaCutoff) (@sameStarAll) (@samePenultimate) + (@sameLast) (@routeToY) (@caseGamma) +private theorem helper_continuation_3542.{u_1, u_2} : + helperContinuation3542Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell X B Y Z D hthetaStored' hbetaB hbetaUnused + hthetaMissingY gamma hgammaTheta hgammaA hgammaNeBeta sameStar hAtoT htail hcutJstrict + fullPrefixEq commonPrefix hYlen hBtoT hYtoT hBtoX hXtoY hYtoZ hZtoT hAtoY + penultimatePrefixEq hElemZ firstWitness hgammaFirst hbetaFirst hgammaFirstLe hbetaFirstLe + vertexMemT vertexMemSelf hthetaY hthetaFirst hthetaFirstIndex hthetaOutsideGamma + hgammaNeTheta hgammaUnused hAtoZ hBtoZ treeMissingSubset hgammaMissingZ hbetaMissingZ + hchangeElementary hchangeMissing firstChange + have hgammaStageMissing : gamma ∈ HierarchyStageMissingColors H q := + (Finset.mem_sdiff.mp + (R.counterexample.good.avoidance q d.theta hthetaStored' hgammaTheta)).1 + have hApositive (hq : 0 < H.dividerCount) : + A = H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ := by + exact @helper_hApositive_1008 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@hq) + have sameGammaBeta : + TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) = + TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) := by + exact @helper_sameGammaBeta_1024 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@gamma) (@hgammaA) (@firstChange) (@hgammaStageMissing) (@hApositive) + have componentSelf (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := by rfl + have hgammaTerminalDistinct : + T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ + T.vertex (Fin.last T.length) := by + exact @helper_hgammaTerminalDistinct_1048 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@gamma) (@hcutJstrict) (@hgammaFirstLe) + have hbetaTerminalDistinct : + T.vertex (HierarchyFirstMissingPosition sigma T beta) ≠ + T.vertex (Fin.last T.length) := by + exact @helper_hbetaTerminalDistinct_1056 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@hYlen) (@hBtoX) (@hXtoY) (@hbetaFirstLe) + have separation1 := P2905_T2_ElementaryTerminalComponent G sigma gamma beta + hgammaNeBeta R.minimumContext.proper (TreeSequenceVertexSet Z) hElemZ + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) + (T.vertex (Fin.last T.length)) + (vertexMemT Z hZtoT _ (hgammaFirstLe.trans hAtoZ.1)) + (vertexMemT Z hZtoT _ (hbetaFirstLe.trans hBtoZ.1)) + hgammaTerminalDistinct.symm hbetaTerminalDistinct.symm + hgammaFirst.1 hbetaFirst.1 (Or.inr d.betaMissingTerminal) sameGammaBeta + have hterminalDisjoint := separation1.1 + let z : Sum V E := Sum.inl (T.vertex (Fin.last T.length)) + let mu2 := TwoColorComponentSwap G sigma gamma beta z + have hmu2Proper : IsProperEdgeColoring G mu2 := by + exact TwoColorComponentSwapProper G sigma gamma beta hgammaNeBeta + R.minimumContext.proper z + have hmu2One : IsOneEdgeUncolored mu2 e0 := by + exact @helper_hmu2One_1080 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@d) (@gamma) + have hfirstGammaOutside : Sum.inl + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) ∉ + TwoColorComponent G sigma gamma beta z := by + intro hv + exact (Set.disjoint_left.mp hterminalDisjoint) hv + (componentSelf sigma gamma beta + (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) + have hfirstBetaOutside : Sum.inl + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∉ + TwoColorComponent G sigma gamma beta z := by + exact @helper_hfirstBetaOutside_1105 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@gamma) (@sameGammaBeta) (@componentSelf) (@hterminalDisjoint) + have hswapBehavior := TwoColorComponentSwapMissingBehavior G sigma gamma beta + hgammaNeBeta R.minimumContext.proper z + have hgammaFirstMu2 : gamma ∈ MissingColors G mu2 + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) := by + rw [(hswapBehavior.1 _ hfirstGammaOutside)] + exact hgammaFirst.1 + have hbetaFirstMu2 : beta ∈ MissingColors G mu2 + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) := by + rw [(hswapBehavior.1 _ hfirstBetaOutside)] + exact hbetaFirst.1 + have hgammaTerminalMu2 : gamma ∈ MissingColors G mu2 + (T.vertex (Fin.last T.length)) := by + exact hswapBehavior.2.2.1 _ (componentSelf sigma gamma beta + (T.vertex (Fin.last T.length))) d.betaMissingTerminal + have hfixedThroughY : ∀ t : Fin T.length, A.length ≤ t.val → + t.val < A.length + j → mu2 (T.edge t) = sigma (T.edge t) := by + exact @helper_hfixedThroughY_1130 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hbetaUnused) (@gamma) (@hYlen) (@hgammaUnused) + have firstPreserved (W : TreeSequence G e0) + (hWT : TreeSequenceInitialSegment W T) (rho sigma : PartialEdgeColoring E k) (c : Fin k) + (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet W)) + (hmiss : ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) + (hc : c ∈ TreeMissingColors rho W) : + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + exact @helper_firstPreserved_1137 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@j) (@firstWitness) (@W) (@hWT) (@rho) (@sigma) (@c) (@helem) (@hmiss) (@hc) + exact @helper_continuation_2327 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) (@hthetaStored') + (@hbetaB) (@hthetaMissingY) (@gamma) (@hgammaTheta) (@hgammaA) (@hgammaNeBeta) (@sameStar) + (@hAtoT) (@htail) (@hcutJstrict) (@fullPrefixEq) (@commonPrefix) (@hYlen) (@hBtoT) (@hYtoT) + (@hBtoX) (@hXtoY) (@hYtoZ) (@hZtoT) (@hAtoY) (@penultimatePrefixEq) (@hElemZ) + (@hgammaFirst) (@hgammaFirstLe) (@vertexMemT) (@vertexMemSelf) (@hthetaY) (@hthetaFirst) + (@hthetaFirstIndex) (@hthetaOutsideGamma) (@hgammaNeTheta) (@hgammaUnused) (@hAtoZ) + (@treeMissingSubset) (@hgammaMissingZ) (@hbetaMissingZ) (@hchangeElementary) + (@hchangeMissing) (@componentSelf) (@hgammaTerminalDistinct) (@separation1) + (@hterminalDisjoint) (@hmu2One) (@hgammaFirstMu2) (@hgammaTerminalMu2) (@hfixedThroughY) + (@firstPreserved) + +private theorem helper_continuation_2252.{u_1, u_2} : + helperContinuation2252Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell X B Y Z D hthetaStored' hbetaB hbetaUnused + hthetaMissingY gamma hgammaTheta hgammaA hgammaInGammaUnion hgammaNeBeta sameStar hAtoT + htail hcutJstrict fullPrefixEq commonPrefix hYlen hBtoT hYtoT hBtoX hXtoY hYtoZ hZtoT hAtoY + penultimatePrefixEq hElemZ firstWitness hgammaFirst hbetaFirst hgammaFirstLe hbetaFirstLe + vertexMemT + have vertexMemSelf (W : TreeSequence G e0) (i : Fin (W.length + 1)) : + W.vertex i ∈ TreeSequenceVertexSet W := by + as_aux_lemma => + clear * - W i + simp [TreeSequenceVertexSet] + have treeMissingIntro (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) + (v : V) (c : Fin k) (hv : v ∈ TreeSequenceVertexSet W) + (hc : c ∈ MissingColors G rho v) : c ∈ TreeMissingColors rho W := by + as_aux_lemma => + clear * - rho W v c hv hc + exact Finset.mem_biUnion.mpr ⟨v, hv, hc⟩ + have hthetaY : d.theta ∈ TreeMissingColors sigma Y := by + exact @helper_hthetaY_887 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@d) (@j) (@hthetaMissingY) (@vertexMemSelf) (@treeMissingIntro) + have hthetaFirst : d.theta ∈ MissingColors G sigma + (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) ∧ + (HierarchyFirstMissingPosition sigma T d.theta).val ≤ Y.length := by + as_aux_lemma => + clear * - G T sigma Y d hYtoT hthetaY firstWitness + clear_value Y + exact firstWitness sigma Y hYtoT d.theta hthetaY + have hthetaFirstIndex : (HierarchyFirstMissingPosition sigma T d.theta).val = Y.length := by + exact @helper_hthetaFirstIndex_395 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C ctx P alpha beta d j hthetaMissingY hYtoT + hYtoZ hZtoT hElemZ vertexMemT hthetaFirst + have hthetaOutsideGamma : d.theta ∉ D.biUnion (R.counterexample.good.gamma q) := by + simpa [R, H, q, D] using d.thetaOutsideGamma + have hgammaNeTheta : gamma ≠ d.theta := by + intro heq + exact hthetaOutsideGamma (heq ▸ hgammaInGammaUnion) + have hgammaUnused : ∀ t : Fin T.length, A.length ≤ t.val → + t.val < Y.length → sigma (T.edge t) ≠ some gamma := by + exact @helper_hgammaUnused_907 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hthetaStored') (@gamma) (@hgammaTheta) (@hthetaFirstIndex) + have horderedUnusedGammaBeta : + (gamma ∉ TreeMissingColors sigma A ∨ beta ∉ TreeMissingColors sigma A) → + TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ + gamma ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition sigma T beta).val ∧ + sigma (T.edge t) = some c) := by + exact @helper_horderedUnusedGammaBeta_921 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@gamma) (@hgammaA) (@hAtoT) (@hBtoX) (@hXtoY) (@hbetaFirst) + (@hgammaFirstLe) (@hbetaFirstLe) (@vertexMemT) (@treeMissingIntro) (@hgammaUnused) + have hAtoZ : TreeSequenceInitialSegment A Z := + commonPrefix hAtoT hZtoT (hAtoY.1.trans hYtoZ.1) + have hBtoZ : TreeSequenceInitialSegment B Z := + commonPrefix hBtoT hZtoT (hBtoX.1.trans (hXtoY.1.trans hYtoZ.1)) + have treeMissingSubset {U W : TreeSequence G e0} + (hUW : TreeSequenceInitialSegment U W) : + TreeMissingColors sigma U ⊆ TreeMissingColors sigma W := by + exact @helper_treeMissingSubset_949 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@U) (@W) (@hUW) + have hgammaMissingZ : gamma ∈ TreeMissingColors sigma Z := + treeMissingSubset hAtoZ hgammaA + have hbetaMissingZ : beta ∈ TreeMissingColors sigma Z := + treeMissingSubset hBtoZ hbetaB + have htailSame : HierarchyFullTailLength R.counterexample = ell := by + change T.length - A.length = + T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + rw [← sameStar] + have hEll : ell = T.length - A.length := by + simp [ell, HierarchyFullTailLength, sameStar] + have hstarR : HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = A := rfl + have hchangeElementary : + ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := by + rw [penultimatePrefixEq] + exact hElemZ + have hchangeMissing : gamma ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1)) ∧ + beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1)) := by + rw [penultimatePrefixEq] + exact ⟨hgammaMissingZ, hbetaMissingZ⟩ + have firstChange := by + exact @helper_firstChange_985 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@gamma) (@hgammaNeBeta) (@sameStar) (@horderedUnusedGammaBeta) + (@hchangeElementary) (@hchangeMissing) + exact @helper_continuation_3542 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) (@hthetaStored') + (@hbetaB) (@hbetaUnused) (@hthetaMissingY) (@gamma) (@hgammaTheta) (@hgammaA) + (@hgammaNeBeta) (@sameStar) (@hAtoT) (@htail) (@hcutJstrict) (@fullPrefixEq) + (@commonPrefix) (@hYlen) (@hBtoT) (@hYtoT) (@hBtoX) (@hXtoY) (@hYtoZ) (@hZtoT) (@hAtoY) + (@penultimatePrefixEq) (@hElemZ) (@firstWitness) (@hgammaFirst) (@hbetaFirst) + (@hgammaFirstLe) (@hbetaFirstLe) (@vertexMemT) (@vertexMemSelf) (@hthetaY) (@hthetaFirst) + (@hthetaFirstIndex) (@hthetaOutsideGamma) (@hgammaNeTheta) (@hgammaUnused) (@hAtoZ) + (@hBtoZ) (@treeMissingSubset) (@hgammaMissingZ) (@hbetaMissingZ) (@hchangeElementary) + (@hchangeMissing) (@firstChange) +theorem HierarchySituationThreeDisjointThetaStoredImpossible + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha beta : Fin k) + (hpathLower : 2 <= HierarchyPathNumber C.hierarchy) + (hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (hvertexMissing : forall (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu -> IsOneEdgeUncolored mu e0 -> + forall v : V, (MissingColors G mu v).Nonempty) + (d : HierarchySituationThreeDisjointData + G k e0 input T phi ett base C ctx P alpha beta) + (hthetaStored : + let H := d.switched.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + d.theta ∈ HierarchyStoredColorsAt H q) : False := by + as_aux_lemma => + classical + generalize hj : HierarchyPathNumber C.hierarchy = j at hpathLower hpathUpper + let R := d.switched + let sigma := R.coloring + let H := R.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength C + let X := HierarchyFullTailPrefix C (j - 1) + let B := HierarchyFullTailPrefix C (j - 2) + let Y := HierarchyFullTailPrefix C j + let Z := HierarchyFullTailPrefix C (ell - 1) + let D := HierarchyStoredColorsAt H q + have hthetaStored' : d.theta ∈ D := hthetaStored + have hbetaB : beta ∈ TreeMissingColors sigma B := by + simpa only [B, sigma, R, hj] using d.betaMissingTwoBefore + have hbetaUnused : ∀ t : Fin T.length, A.length ≤ t.val → + t.val < A.length + j → sigma (T.edge t) ≠ some beta := by + exact @helper_hbetaUnused_658 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hj) + have hthetaMissingY : d.theta ∈ MissingColors G sigma + (Y.vertex (Fin.last Y.length)) := by + exact @helper_hthetaMissingY_676 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hj) + obtain ⟨gamma, gamma₂, hgammaNe₂, hgammaPair⟩ := + Finset.card_eq_two.mp (R.counterexample.good.twoColors q d.theta hthetaStored') + have hgammaTheta : gamma ∈ R.counterexample.good.gamma q d.theta := by + rw [hgammaPair] + simp + have hgammaA : gamma ∈ TreeMissingColors sigma A := + (GoodHierarchyReservedDisjoint R.counterexample.good q).1 d.theta hthetaStored' + hgammaTheta + have hgammaInGammaUnion : gamma ∈ D.biUnion (R.counterexample.good.gamma q) := + Finset.mem_biUnion.mpr ⟨d.theta, hthetaStored', hgammaTheta⟩ + have hgammaNeBeta : gamma ≠ beta := by + intro heq + exact d.betaOutsideGamma (heq ▸ hgammaInGammaUnion) + have sameStar : HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A := by + exact @helper_sameStar_697 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) + have starNext (i : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H i) (H.stage i.succ) := + Fin.cases H.coreInsideFirst (fun t => H.nested t.succ) i + have hAtoT : TreeSequenceInitialSegment A T := by + simpa only [q, Fin.succ_last, H.terminalStage] using starNext q + have htail : j ≤ T.length - A.length := by + have h := hpathUpper + simpa [ell, HierarchyFullTailLength, sameStar] using Nat.le_of_lt h + have hjLower : 2 ≤ j := hpathLower + have hjUpper : j < ell := hpathUpper + have hcutJ : A.length + j ≤ T.length := by + have hAT := hAtoT.1 + clear * - htail hAT + clear_value A + omega + have hcutJstrict : A.length + j < T.length := by + exact @helper_hcutJstrict_730 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hj) (@sameStar) (@hAtoT) (@hjUpper) + have fullPrefixEq (m : ℕ) : HierarchyFullTailPrefix C m = + TreeSequencePrefix T (min (A.length + m) T.length) + (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (Nat.min_le_right _ _) := by + unfold HierarchyFullTailPrefix + simp only [sameStar] + have prefixToTree (m : ℕ) (hm : 1 ≤ m) (hmT : m ≤ T.length) : + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T := by + exact @helper_prefixToTree_743 (@V) (@E) (@G) (@e0) (@T) (@m) (@hm) (@hmT) + have commonPrefix {U W : TreeSequence G e0} + (hUT : TreeSequenceInitialSegment U T) + (hWT : TreeSequenceInitialSegment W T) (hUW : U.length ≤ W.length) : + TreeSequenceInitialSegment U W := by + exact @helper_commonPrefix_752 (@V) (@E) (@G) (@e0) (@T) (@U) (@W) (@hUT) (@hWT) (@hUW) + have hYlen : Y.length = A.length + j := by + change (HierarchyFullTailPrefix C j).length = A.length + j + rw [fullPrefixEq j] + simp only [TreeSequencePrefix, min_eq_left hcutJ] + have hBtoT : TreeSequenceInitialSegment B T := by + change TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - 2)) T + rw [fullPrefixEq] + exact prefixToTree _ (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (min_le_right _ _) + have hXtoT : TreeSequenceInitialSegment X T := by + change TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - 1)) T + rw [fullPrefixEq] + exact prefixToTree _ (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (min_le_right _ _) + have hYtoT : TreeSequenceInitialSegment Y T := by + change TreeSequenceInitialSegment (HierarchyFullTailPrefix C j) T + rw [fullPrefixEq] + exact prefixToTree _ (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (min_le_right _ _) + have hBtoX : TreeSequenceInitialSegment B X := + commonPrefix hBtoT hXtoT (by + change (HierarchyFullTailPrefix C (j - 2)).length ≤ + (HierarchyFullTailPrefix C (j - 1)).length + rw [fullPrefixEq (j - 2), fullPrefixEq (j - 1)] + simp only [TreeSequencePrefix] + exact min_le_min_right _ (Nat.add_le_add_left (Nat.sub_le_sub_left (by decide) j) _)) + have hXtoY : TreeSequenceInitialSegment X Y := + commonPrefix hXtoT hYtoT (by + change (HierarchyFullTailPrefix C (j - 1)).length ≤ + (HierarchyFullTailPrefix C j).length + rw [fullPrefixEq (j - 1), fullPrefixEq j] + simp only [TreeSequencePrefix] + exact min_le_min_right _ (Nat.add_le_add_left (Nat.sub_le j 1) _)) + have hYtoZ : TreeSequenceInitialSegment Y Z := + commonPrefix hYtoT (by + change TreeSequenceInitialSegment (HierarchyFullTailPrefix C (ell - 1)) T + rw [fullPrefixEq] + exact prefixToTree _ (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (min_le_right _ _)) + (by + change (HierarchyFullTailPrefix C j).length ≤ + (HierarchyFullTailPrefix C (ell - 1)).length + rw [fullPrefixEq j, fullPrefixEq (ell - 1)] + simp only [TreeSequencePrefix] + exact min_le_min_right _ (Nat.add_le_add_left (Nat.le_sub_one_of_lt hjUpper) _)) + have hZtoT : TreeSequenceInitialSegment Z T := by + change TreeSequenceInitialSegment (HierarchyFullTailPrefix C (ell - 1)) T + rw [fullPrefixEq] + exact prefixToTree _ (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (min_le_right _ _) + have hAtoY : TreeSequenceInitialSegment A Y := + commonPrefix hAtoT hYtoT (by rw [hYlen]; exact Nat.le_add_right _ _) + have hAtoB : TreeSequenceInitialSegment A B := + commonPrefix hAtoT hBtoT (by + change A.length ≤ (HierarchyFullTailPrefix C (j - 2)).length + rw [fullPrefixEq] + simp only [TreeSequencePrefix] + exact le_min (Nat.le_add_right _ _) hAtoT.1) + have penultimatePrefixEq : HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1) = Z := by + simp only [Z, ell, HierarchyFullTailPrefix, HierarchyFullTailLength, sameStar] + rfl + have hElemZ : ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) := by + exact @helper_hElemZ_837 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@d) (@penultimatePrefixEq) + have firstWitness (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) + (hWT : TreeSequenceInitialSegment W T) (c : Fin k) + (hc : c ∈ TreeMissingColors rho W) : + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (HierarchyFirstMissingPosition rho T c).val ≤ W.length := by + exact @helper_firstWitness_671 V E inferInstance inferInstance G k e0 T rho W hWT c hc + have hgammaFirst := firstWitness sigma A hAtoT gamma hgammaA + have hbetaFirst := firstWitness sigma B hBtoT beta hbetaB + have hgammaFirstLe : (HierarchyFirstMissingPosition sigma T gamma).val ≤ A.length := + hgammaFirst.2 + have hbetaFirstLe : (HierarchyFirstMissingPosition sigma T beta).val ≤ B.length := + hbetaFirst.2 + have vertexMemT (W : TreeSequence G e0) (hWT : TreeSequenceInitialSegment W T) + (i : Fin (T.length + 1)) (hi : i.val ≤ W.length) : + T.vertex i ∈ TreeSequenceVertexSet W := by + exact @helper_vertexMemT_866 (@V) (@E) (@G) (@e0) (@T) (@W) (@hWT) (@i) (@hi) + exact @helper_continuation_2252 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) + (@hthetaStored') (@hbetaB) (@hbetaUnused) (@hthetaMissingY) (@gamma) (@hgammaTheta) + (@hgammaA) (@hgammaInGammaUnion) (@hgammaNeBeta) (@sameStar) (@hAtoT) (@htail) + (@hcutJstrict) (@fullPrefixEq) (@commonPrefix) (@hYlen) (@hBtoT) (@hYtoT) (@hBtoX) + (@hXtoY) (@hYtoZ) (@hZtoT) (@hAtoY) (@penultimatePrefixEq) (@hElemZ) (@firstWitness) + (@hgammaFirst) (@hbetaFirst) (@hgammaFirstLe) (@hbetaFirstLe) (@vertexMemT) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean new file mode 100644 index 0000000000..3a01fadccb --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean @@ -0,0 +1,4098 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData +public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Hierarchy Situation Three Disjoint Theta Unstored Beta Stored Impossible + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperRouteToY1012Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → + TreeSequenceInitialSegment Y T → TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment A Y → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : + ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : + TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage + K (Fin.last K.dividerCount)).edge t)) → Y.length = X.length + (1 : ℕ) → + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : + PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring + (T.edge t)) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → + let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := + S.corresponding.replacementETT; + let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; + let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n + = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y + +private abbrev helperContinuation2578Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) (j + : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; beta ∈ D → beta ∈ TreeMissingColors + sigma B → Disjoint (R.counterexample.good.gamma q beta ∪ ({ beta } : Finset (Fin k))) ({c + : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ sigma (T.edge r) = some + c} : Finset (Fin k)) → d.theta ∈ MissingColors G sigma (Y.vertex (Fin.last Y.length)) → + ∀ gamma ∈ R.counterexample.good.gamma q beta, gamma ∈ TreeMissingColors sigma A → gamma ≠ beta + → d.theta ∉ D → HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A + → TreeSequenceInitialSegment A T → j ≤ T.length - A.length → A.length + j < T.length → ( + ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + have := Fin.isLt alpha + have := Fin.isLt beta + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding R) + have := Fin.isLt q + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + have := Fin.isLt alpha + have := Fin.isLt beta + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding R) + have := Fin.isLt q + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive T + omega + )) → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → + TreeSequenceInitialSegment B T → TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment B X → TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → + TreeSequenceInitialSegment A Y → HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = Z → ColoredVertexSetElementary G + sigma (TreeSequenceVertexSet Z) → ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ W.length) → gamma ∈ MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma + T gamma)) ∧ (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → beta ∈ + MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → + (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → False + +private abbrev helperContinuation2662Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) (j + : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; beta ∈ D → beta ∈ TreeMissingColors + sigma B → Disjoint (R.counterexample.good.gamma q beta ∪ ({ beta } : Finset (Fin k))) ({c + : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ sigma (T.edge r) = some + c} : Finset (Fin k)) → d.theta ∈ MissingColors G sigma (Y.vertex (Fin.last Y.length)) → + ∀ gamma ∈ R.counterexample.good.gamma q beta, gamma ∈ TreeMissingColors sigma A → gamma ≠ beta + → d.theta ∉ D → HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A + → TreeSequenceInitialSegment A T → j ≤ T.length - A.length → A.length + j < T.length → ( + ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ A.length := A.positive; + have this_2 : P.corresponding.replacementETT.rounds = ett.rounds := + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + omega; + have this_3 : (↑alpha : ℕ) < k := alpha.isLt; + have this_4 : (↑beta : ℕ) < k := beta.isLt; + have this_5 : R.corresponding.replacementETT.rounds = ett.rounds := + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + have := Fin.isLt alpha + have := Fin.isLt beta + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding R) + omega; + have this_6 : (↑q : ℕ) < H.dividerCount + (1 : ℕ) := + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + have := Fin.isLt alpha + have := Fin.isLt beta + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding R) + have := Fin.isLt q + omega; + have this_7 : (1 : ℕ) ≤ A.length := A.positive; + have this_8 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + m) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : P.corresponding.replacementETT.rounds = ett.rounds := + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + omega; + have this : (↑alpha : ℕ) < k := alpha.isLt; + have this : (↑beta : ℕ) < k := beta.isLt; + have this : R.corresponding.replacementETT.rounds = ett.rounds := + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + have := Fin.isLt alpha + have := Fin.isLt beta + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding R) + omega; + have this : (↑q : ℕ) < H.dividerCount + (1 : ℕ) := + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + have := Fin.isLt alpha + have := Fin.isLt beta + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding R) + have := Fin.isLt q + omega; + have this : (1 : ℕ) ≤ A.length := A.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬min + (A.length + m) T.length ≤ T.length) ↦ + by omega + )) → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → + TreeSequenceInitialSegment B T → TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment B X → TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → + TreeSequenceInitialSegment A Y → HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = Z → ColoredVertexSetElementary G + sigma (TreeSequenceVertexSet Z) → ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ W.length) → gamma ∈ MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma + T gamma)) ∧ (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → beta ∈ + MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → + (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → ( + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) → d.theta ∈ TreeMissingColors sigma Y → d.theta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma + T d.theta) : ℕ) ≤ Y.length → (↑(HierarchyFirstMissingPosition d.switched.coloring T + d.theta) : ℕ) = (HierarchyFullTailPrefix C j).length → d.theta ∉ D.biUnion + (R.counterexample.good.gamma q) → gamma ≠ d.theta → TreeSequenceInitialSegment A Z → + TreeSequenceInitialSegment B Z → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W) → gamma ∈ TreeMissingColors sigma Z → beta ∈ TreeMissingColors + sigma Z → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) → gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ))) → TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b + (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho + a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u))) → B.length < T.length → + T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex + (HierarchyFirstMissingPosition sigma T beta) → T.vertex (HierarchyFirstMissingPosition + sigma T gamma) ≠ T.vertex (Fin.last T.length) → False + +private abbrev helperContinuation3731Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) (j + : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; beta ∈ D → + ∀ gamma ∈ R.counterexample.good.gamma q beta, gamma ∈ TreeMissingColors sigma A → gamma ≠ beta + → d.theta ∉ D → A.length + j < T.length → Y.length = A.length + j → + TreeSequenceInitialSegment Y T → TreeSequenceInitialSegment B X → + TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment Z T → TreeSequenceInitialSegment A Y → + (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → ( + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) → d.theta ∈ TreeMissingColors sigma Y → d.theta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma + T d.theta) : ℕ) ≤ Y.length → d.theta ∉ D.biUnion (R.counterexample.good.gamma q) → gamma ≠ + d.theta → TreeSequenceInitialSegment A Z → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b + (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho + a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u))) → T.vertex + (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex (Fin.last T.length) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; ( + ∀ (W : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → + IsProperEdgeColoring G rho → ColoredVertexSetElementary G rho (TreeSequenceVertexSet W) → + ∀ (u v : V), u ∈ TreeSequenceVertexSet W → v ∈ TreeSequenceVertexSet W → a ∈ MissingColors G + rho u → b ∈ MissingColors G rho v → Sum.inl u ∉ TwoColorComponent G rho a b z → Sum.inl v + ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet W, MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G + rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = HierarchyFirstMissingPosition rho T c) → ( + ∀ (old new : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W Z → TreeMissingColors new W = + TreeMissingColors old W) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : + PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring + (T.edge t)) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → + let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := + S.corresponding.replacementETT; + let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; + let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n + = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (0 : ℕ) < + S.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors S.coloring + (S.counterexample.hierarchy.stage (⟨S.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding + S) + omega + ⟩ : Fin (S.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + S.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors S.coloring + (S.corresponding.replacementETT.series.data.tree (Fin.last + S.corresponding.replacementETT.rounds).castSucc)) → TashkinovAugmentationSequence sigma Y + T → gamma ∈ TreeMissingColors mu2 Y ∧ beta ∈ TreeMissingColors mu2 Y → A.length < Y.length + → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), R1.coloring = mu2 + → + let rho : PartialEdgeColoring E k := R1.coloring; ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G rho v = MissingColors G sigma v) → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet Z) → HierarchyFirstMissingPosition + rho T gamma = HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition + rho T beta = HierarchyFirstMissingPosition sigma T beta → gamma ∈ MissingColors G rho + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) → d.theta ∈ MissingColors G rho + (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) → d.theta ∈ MissingColors G rho + (Y.vertex (Fin.last Y.length)) → gamma ∈ MissingColors G rho (T.vertex (Fin.last + T.length)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) + → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some + d.theta) → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho Z → + TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition + sigma T gamma))) = TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T d.theta))) → T.vertex + (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex (HierarchyFirstMissingPosition + sigma T d.theta) → T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ T.vertex + (Fin.last T.length) → False + +private abbrev helperContinuation3042Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) (j + : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; beta ∈ D → beta ∈ TreeMissingColors + sigma B → Disjoint (R.counterexample.good.gamma q beta ∪ ({ beta } : Finset (Fin k))) ({c + : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ sigma (T.edge r) = some + c} : Finset (Fin k)) → d.theta ∈ MissingColors G sigma (Y.vertex (Fin.last Y.length)) → + ∀ gamma ∈ R.counterexample.good.gamma q beta, gamma ∈ TreeMissingColors sigma A → gamma ≠ beta + → d.theta ∉ D → HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A + → TreeSequenceInitialSegment A T → A.length + j < T.length → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → + TreeSequenceInitialSegment B T → TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment B X → TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → + TreeSequenceInitialSegment A Y → HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = Z → ColoredVertexSetElementary G + sigma (TreeSequenceVertexSet Z) → ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ W.length) → gamma ∈ MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma + T gamma)) ∧ (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → ( + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) → d.theta ∈ TreeMissingColors sigma Y → d.theta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma + T d.theta) : ℕ) ≤ Y.length → (↑(HierarchyFirstMissingPosition d.switched.coloring T + d.theta) : ℕ) = (HierarchyFullTailPrefix C j).length → d.theta ∉ D.biUnion + (R.counterexample.good.gamma q) → gamma ≠ d.theta → TreeSequenceInitialSegment A Z → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W) → gamma ∈ TreeMissingColors sigma Z → beta ∈ TreeMissingColors + sigma Z → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) → gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ))) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b + (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho + a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u))) → T.vertex + (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex (Fin.last T.length) → Disjoint + (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (Fin.last T.length)))) + (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (HierarchyFirstMissingPosition + sigma T gamma)))) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; + IsOneEdgeUncolored mu2 e0 → gamma ∈ MissingColors G mu2 (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)) → gamma ∈ MissingColors G mu2 (T.vertex + (Fin.last T.length)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → mu2 (T.edge t) = sigma + (T.edge t)) → ( + ∀ (W : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → + IsProperEdgeColoring G rho → ColoredVertexSetElementary G rho (TreeSequenceVertexSet W) → + ∀ (u v : V), u ∈ TreeSequenceVertexSet W → v ∈ TreeSequenceVertexSet W → a ∈ MissingColors G + rho u → b ∈ MissingColors G rho v → Sum.inl u ∉ TwoColorComponent G rho a b z → Sum.inl v + ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet W, MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G + rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = HierarchyFirstMissingPosition rho T c) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v) → ( + ∀ (old new : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W Z → TreeMissingColors new W = + TreeMissingColors old W) → ( + ∀ eta ∈ D, HierarchyFirstMissingPosition mu2 T eta = HierarchyFirstMissingPosition sigma T + eta) → ( + ∀ eta ∈ D, gamma ∈ R.counterexample.good.gamma q eta ∨ beta ∈ R.counterexample.good.gamma q + eta → (↑(HierarchyFirstMissingPosition sigma T eta) : ℕ) ≤ Y.length) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : + PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring + (T.edge t)) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → + let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := + S.corresponding.replacementETT; + let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; + let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n + = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y) → False + +private noncomputable abbrev helperC11319.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (alpha beta : Fin k) → + (d : + HierarchySituationThreeDisjointData G k e0 input T phi + ett base C ctx P alpha beta) → + let R : + HierarchyReplacementPresentation G k e0 input T phi + ett base C ctx := + d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + (gamma : Fin k) → + ( + ∀ (W : TreeSequence G e0) + (i : Fin (W.length + (1 : ℕ))), + W.vertex i ∈ TreeSequenceVertexSet W) → + T.vertex + (HierarchyFirstMissingPosition sigma T + gamma) ≠ + T.vertex (Fin.last T.length) → + let z : V ⊕ E := + Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := + TwoColorComponentSwap G sigma gamma beta z; + gamma ∈ + MissingColors G mu2 + (T.vertex + (HierarchyFirstMissingPosition sigma T + gamma)) → + gamma ∈ + MissingColors G mu2 + (T.vertex (Fin.last T.length)) → + (corr1 : + CorrespondingExtendedTashkinovTree G k e0 + R.corresponding.replacementETT mu2 T) → + MaximumProperty corr1.replacementETT → + (bs1 : + HierarchyBase corr1.replacementETT + mu2) → + (K1 : + TashkinovHierarchy + corr1.replacementETT bs1) → + GoodHierarchy K1 → + HierarchyCounterexample bs1 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma vertexMemSelf + hgammaTerminalDistinct z mu2 hgammaFirstMu2 hgammaTerminalMu2 corr1 hmax1 bs1 K1 good1 + exact { + positive := Nat.lt_of_lt_of_le (by decide) corr1.replacementETT.roundsPositive + hierarchy := K1 + good := good1 + maximum := hmax1 + notElementary := by + intro he + exact Finset.disjoint_left.mp (he + (vertexMemSelf T (HierarchyFirstMissingPosition sigma T gamma)) + (vertexMemSelf T (Fin.last T.length)) hgammaTerminalDistinct) + hgammaFirstMu2 hgammaTerminalMu2 } + +private noncomputable abbrev helperC21693.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + (alpha beta : Fin k) → + (d : + HierarchySituationThreeDisjointData G k e0 input T phi + ett base C ctx P alpha beta) → + (j : ℕ) → + let Y : TreeSequence G e0 := + HierarchyFullTailPrefix C j; + (gamma : Fin k) → + TreeSequenceInitialSegment Y T → + ( + ∀ (W : TreeSequence G e0) + (i : Fin (W.length + (1 : ℕ))), + W.vertex i ∈ TreeSequenceVertexSet W) → + let z : V ⊕ E := + Sum.inl (T.vertex (Fin.last T.length)); + (R1 : + HierarchyReplacementPresentation G k e0 + input T phi ett base C ctx) → + let rho : PartialEdgeColoring E k := + R1.coloring; + let mu3 : PartialEdgeColoring E k := + TwoColorComponentSwap G rho gamma d.theta z; + (corr2 : + CorrespondingExtendedTashkinovTree G k e0 + R1.corresponding.replacementETT mu3 T) → + MaximumProperty corr2.replacementETT → + (bs2 : + HierarchyBase corr2.replacementETT + mu3) → + (K2 : + TashkinovHierarchy + corr2.replacementETT bs2) → + GoodHierarchy K2 → + d.theta ∈ + MissingColors G mu3 + (T.vertex + (Fin.last T.length)) → + d.theta ∈ + MissingColors G mu3 + (Y.vertex + (Fin.last Y.length)) → + Y.vertex (Fin.last Y.length) ≠ + T.vertex + (Fin.last T.length) → + HierarchyCounterexample bs2 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j Y gamma hYtoT + vertexMemSelf z R1 rho mu3 corr2 hmax2 bs2 K2 good2 hthetaTerminalMu3 hthetaYMu3 + hYTerminalDistinct + exact { + positive := Nat.lt_of_lt_of_le (by decide) corr2.replacementETT.roundsPositive + hierarchy := K2 + good := good2 + maximum := hmax2 + notElementary := by + intro he + exact Finset.disjoint_left.mp (he + (TreeSequenceInitialSegmentVertexSetSubset hYtoT (vertexMemSelf Y (Fin.last Y.length))) + (vertexMemSelf T (Fin.last T.length)) hYTerminalDistinct) + hthetaYMu3 hthetaTerminalMu3 } + +private abbrev helperContinuation3727Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (hvertexMissing : + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) (d : HierarchySituationThreeDisjointData G k e0 + input T phi ett base C ctx P alpha beta) (j : ℕ) (hj : HierarchyPathNumber C.hierarchy = + j) (hpathLower : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ (hbetaStored : beta ∈ D) (hbetaTail : Disjoint (R.counterexample.good.gamma q beta ∪ + ({ beta } : Finset (Fin k))) ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ sigma (T.edge r) = some + c} : Finset (Fin k))) (hthetaMissingY : d.theta ∈ MissingColors G sigma (Y.vertex + (Fin.last Y.length))) (gamma : Fin k) (hgammaBeta : gamma ∈ R.counterexample.good.gamma q + beta) (hgammaA : gamma ∈ TreeMissingColors sigma A) (hgammaNeBeta : gamma ≠ beta) + (hthetaUnstored' : d.theta ∉ D) (sameStar : HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A) (hcutJstrict : A.length + j < T.length) (hYlen : Y.length = + A.length + j) (hYtoT : TreeSequenceInitialSegment Y T) (hBtoX : TreeSequenceInitialSegment + B X) (hXtoY : TreeSequenceInitialSegment X Y) (hYtoZ : TreeSequenceInitialSegment Y Z) + (hZtoT : TreeSequenceInitialSegment Z T) (hAtoY : TreeSequenceInitialSegment A Y) (hElemZ + : ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z)) (hgammaFirst : gamma ∈ + MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) ∧ + (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length) (hgammaFirstLe : + (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length) (hbetaFirstLe : + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length) (vertexMemT : + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + (vertexMemSelf : + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) (hthetaY : d.theta ∈ TreeMissingColors sigma Y) (hthetaFirst : d.theta ∈ MissingColors + G sigma (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) ∧ + (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) ≤ Y.length) (hthetaFirstIndex : + (↑(HierarchyFirstMissingPosition d.switched.coloring T d.theta) : ℕ) = + (HierarchyFullTailPrefix C j).length) (hthetaOutsideGamma : d.theta ∉ D.biUnion + (R.counterexample.good.gamma q)) (hgammaNeTheta : gamma ≠ d.theta) (hAtoZ : + TreeSequenceInitialSegment A Z) (treeMissingSubset : + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W) (hgammaMissingZ : gamma ∈ TreeMissingColors sigma Z) + (hbetaMissingZ : beta ∈ TreeMissingColors sigma Z) (hchangeElementary : + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet (HierarchyFullTailPrefix + R.counterexample (HierarchyFullTailLength R.counterexample - (1 : ℕ))))) (componentSelf : + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) (componentLeaf : + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton) (separateComponents : + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b + (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho + a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u))) (hgammaTerminalDistinct : + T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex (Fin.last T.length)), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; + ∀ (hgammaTerminalMu2 : gamma ∈ MissingColors G mu2 (T.vertex (Fin.last T.length))) + (hfixedThroughY : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → mu2 (T.edge t) = sigma + (T.edge t)) (prefixMissing : + ∀ (W : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → + IsProperEdgeColoring G rho → ColoredVertexSetElementary G rho (TreeSequenceVertexSet W) → + ∀ (u v : V), u ∈ TreeSequenceVertexSet W → v ∈ TreeSequenceVertexSet W → a ∈ MissingColors G + rho u → b ∈ MissingColors G rho v → Sum.inl u ∉ TwoColorComponent G rho a b z → Sum.inl v + ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet W, MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) (firstPreserved : + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) (firstUnaffected : + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G + rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = HierarchyFirstMissingPosition rho T c) (hmissingMu2 : + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v) + (missingTransport : + ∀ (old new : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W Z → TreeMissingColors new W = + TreeMissingColors old W) (sameStarAll : + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) (samePenultimate : + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) (sameLast : + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) (routeToY : + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : + PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring + (T.edge t)) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → + have et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := + S.corresponding.replacementETT; + have n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; + have Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n + = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y) (caseGamma : + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (0 : ℕ) < + S.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors S.coloring + (S.counterexample.hierarchy.stage (⟨S.counterexample.hierarchy.dividerCount, + Nat.lt_add_of_pos_right ( + by omega + )⟩ : Fin (S.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + S.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors S.coloring + (S.corresponding.replacementETT.series.data.tree (Fin.last + S.corresponding.replacementETT.rounds).castSucc)) (hsuffixY : + TashkinovAugmentationSequence sigma Y T) (hsplitMissing2 : gamma ∈ TreeMissingColors mu2 Y + ∧ beta ∈ TreeMissingColors mu2 Y) (hAYstrict : A.length < Y.length) (R1 : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (hR1 : R1.coloring = + mu2) (sameFullPrefix : + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (m : ℕ), + HierarchyFullTailPrefix S.counterexample m = HierarchyFullTailPrefix C m) (hthetaNotRaw : + d.theta ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)), False + +private abbrev helperContinuation3933Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (hvertexMissing : + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) (d : HierarchySituationThreeDisjointData G k e0 + input T phi ett base C ctx P alpha beta) (j : ℕ) (hj : HierarchyPathNumber C.hierarchy = + j) (hpathLower : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ (hbetaStored : beta ∈ D) (hbetaB : beta ∈ TreeMissingColors sigma B) (hbetaTail : Disjoint + (R.counterexample.good.gamma q beta ∪ ({ beta } : Finset (Fin k))) ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ sigma (T.edge r) = some + c} : Finset (Fin k))) (hthetaMissingY : d.theta ∈ MissingColors G sigma (Y.vertex + (Fin.last Y.length))) (gamma : Fin k) (hgammaBeta : gamma ∈ R.counterexample.good.gamma q + beta) (hgammaA : gamma ∈ TreeMissingColors sigma A) (hgammaNeBeta : gamma ≠ beta) + (hthetaUnstored' : d.theta ∉ D) (sameStar : HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A) (hAtoT : TreeSequenceInitialSegment A T) (htail : j ≤ + T.length - A.length) (hcutJstrict : A.length + j < T.length) (fullPrefixEq : + ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) ( + by omega + )) (commonPrefix : + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) (hYlen : Y.length = A.length + j) + (hBtoT : TreeSequenceInitialSegment B T) (hYtoT : TreeSequenceInitialSegment Y T) (hBtoX : + TreeSequenceInitialSegment B X) (hXtoY : TreeSequenceInitialSegment X Y) (hYtoZ : + TreeSequenceInitialSegment Y Z) (hZtoT : TreeSequenceInitialSegment Z T) (hAtoY : + TreeSequenceInitialSegment A Y) (penultimatePrefixEq : HierarchyFullTailPrefix + R.counterexample (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = Z) (hElemZ : + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z)) (firstWitness : + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ W.length) (hgammaFirst : gamma ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)) ∧ (↑(HierarchyFirstMissingPosition sigma T + gamma) : ℕ) ≤ A.length) (hgammaFirstLe : (↑(HierarchyFirstMissingPosition sigma T gamma) : + ℕ) ≤ A.length) (hbetaFirstLe : (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ + B.length) (vertexMemT : + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + (vertexMemSelf : + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) (hthetaY : d.theta ∈ TreeMissingColors sigma Y) (hthetaFirst : d.theta ∈ MissingColors + G sigma (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) ∧ + (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) ≤ Y.length) (hthetaFirstIndex : + (↑(HierarchyFirstMissingPosition d.switched.coloring T d.theta) : ℕ) = + (HierarchyFullTailPrefix C j).length) (hthetaOutsideGamma : d.theta ∉ D.biUnion + (R.counterexample.good.gamma q)) (hgammaNeTheta : gamma ≠ d.theta) (hAtoZ : + TreeSequenceInitialSegment A Z) (treeMissingSubset : + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W) (hgammaMissingZ : gamma ∈ TreeMissingColors sigma Z) + (hbetaMissingZ : beta ∈ TreeMissingColors sigma Z) (hchangeElementary : + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet (HierarchyFullTailPrefix + R.counterexample (HierarchyFullTailLength R.counterexample - (1 : ℕ))))) (hchangeMissing : + gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) (componentSelf : + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) (componentLeaf : + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton) (separateComponents : + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b + (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho + a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u))) (hgammaTerminalDistinct : + T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex (Fin.last T.length)) + (hterminalDisjoint : Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (Fin.last T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma))))), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; + ∀ (hmu2One : IsOneEdgeUncolored mu2 e0) (hgammaFirstMu2 : gamma ∈ MissingColors G mu2 + (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) (hgammaTerminalMu2 : gamma ∈ + MissingColors G mu2 (T.vertex (Fin.last T.length))) (hfixedThroughY : + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → mu2 (T.edge t) = sigma + (T.edge t)) (prefixMissing : + ∀ (W : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ + b) (hp : IsProperEdgeColoring G rho) (helem : ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W)) (u v : V) (huB : u ∈ TreeSequenceVertexSet W) (hvB : v ∈ + TreeSequenceVertexSet W) (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hdu : Sum.inl u ∉ TwoColorComponent G rho a b z) (hdv : Sum.inl v ∉ TwoColorComponent G + rho a b z), + ∀ w ∈ TreeSequenceVertexSet W, MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) (firstPreserved : + ∀ (W : TreeSequence G e0) (hWT : TreeSequenceInitialSegment W T) (rho sigma : + PartialEdgeColoring E k) (c : Fin k) (helem : ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W)) (hmiss : + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) (hc : c ∈ + TreeMissingColors rho W), HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) (firstUnaffected : + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k) (hne : a ≠ b) (hp : + IsProperEdgeColoring G rho) (hca : c ≠ a) (hcb : c ≠ b), HierarchyFirstMissingPosition + (TwoColorComponentSwap G rho a b z) T c = HierarchyFirstMissingPosition rho T c) + (hmissingMu2 : + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v) + (missingTransport : + ∀ (old new : PartialEdgeColoring E k) (hm : + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) (W : + TreeSequence G e0) (hWZ : TreeSequenceInitialSegment W Z), TreeMissingColors new W = + TreeMissingColors old W), False + +private theorem helper_hthetaFirstIndex_397.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let ell : ℕ := HierarchyFullTailLength C; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); d.theta ∈ + MissingColors G sigma (Y.vertex (Fin.last Y.length)) → TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → d.theta ∈ MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma T + d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) ≤ Y.length → + (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma ell Y Z + hthetaMissingY hYtoT hYtoZ hZtoT hElemZ vertexMemT hthetaFirst + as_aux_lemma => + clear_value Y Z + apply Nat.le_antisymm hthetaFirst.2 + by_contra hne + have hlt : (HierarchyFirstMissingPosition sigma T d.theta).val < Y.length := + Nat.lt_of_not_ge hne + have iZ : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ∈ + TreeSequenceVertexSet Z := vertexMemT Z hZtoT + (HierarchyFirstMissingPosition sigma T d.theta) + (Nat.le_trans (Nat.le_of_lt hlt) hYtoZ.1) + have yZ : Y.vertex (Fin.last Y.length) ∈ TreeSequenceVertexSet Z := + TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (by simp [TreeSequenceVertexSet]) + have hvne : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ + Y.vertex (Fin.last Y.length) := by + intro heq + let jY : Fin (Y.length + 1) := + ⟨(HierarchyFirstMissingPosition sigma T d.theta).val, + Nat.lt_succ_of_le (Nat.le_of_lt hlt)⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hYtoT.1) jY = + HierarchyFirstMissingPosition sigma T d.theta := Fin.ext rfl + have heqY : Y.vertex jY = Y.vertex (Fin.last Y.length) := by + have htree := hYtoT.2.1 jY + have hcastV := congrArg T.vertex hcast + exact htree.symm.trans (hcastV.trans heq) + have hidx := Y.vertex_injective heqY + have hval := congrArg Fin.val hidx + dsimp [jY] at hval + exact (Nat.ne_of_lt hlt) hval + exact Finset.disjoint_left.mp (hElemZ iZ yZ hvne) + hthetaFirst.1 hthetaMissingY + +private theorem helper_prefixMissing_770.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (_ : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let _ : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + ∀ (W : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → + IsProperEdgeColoring G rho → ColoredVertexSetElementary G rho (TreeSequenceVertexSet W) → + ∀ (u v : V), u ∈ TreeSequenceVertexSet W → v ∈ TreeSequenceVertexSet W → a ∈ MissingColors G + rho u → b ∈ MissingColors G rho v → Sum.inl u ∉ TwoColorComponent G rho a b z → Sum.inl v + ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet W, MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d z W z rho a b hne hp helem u + v huB hvB hu hv hdu hdv + as_aux_lemma => + clear * - G rho a b hne hp helem u v huB hvB hu hv hdu hdv W z + have behavior := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + intro w hwB + by_cases hw : Sum.inl w ∈ TwoColorComponent G rho a b z + · have hwa : a ∉ MissingColors G rho w := by + intro hm + have hwu : w ≠ u := fun he => hdu (he ▸ hw) + exact Finset.disjoint_left.mp (helem hwB huB hwu) hm hu + have hwb : b ∉ MissingColors G rho w := by + intro hm + have hwv : w ≠ v := fun he => hdv (he ▸ hw) + exact Finset.disjoint_left.mp (helem hwB hvB hwv) hm hv + have presentSwapped (c d : Fin k) + (hd : d ∉ MissingColors G rho w) + (hdab : (d = a ∧ c = b) ∨ (d = b ∧ c = a)) : + c ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by + have hpres : d ∈ PresentColors G rho w := by simpa [MissingColors] using hd + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpres + rcases hpres with ⟨e, hwe, he⟩ + have hadj : (TwoColorIncidenceGraph G rho a b).Adj (Sum.inr e) (Sum.inl w) := by + simp only [TwoColorIncidenceGraph] + exact ⟨hwe, hdab.elim (fun h => Or.inl (he.trans (congrArg some h.1))) + (fun h => Or.inr (he.trans (congrArg some h.1)))⟩ + have heC : Sum.inr e ∈ TwoColorComponent G rho a b z := by + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = _ at hw + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inr e) = _ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hw + have heSwap : TwoColorComponentSwap G rho a b z e = some c := by + rcases hdab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · simp [TwoColorComponentSwap, heC, he] + · simp [TwoColorComponentSwap, heC, he] + have hpresent : c ∈ PresentColors G (TwoColorComponentSwap G rho a b z) w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, heSwap⟩ + simpa [MissingColors] using hpresent + have hnewa := presentSwapped a b hwb (Or.inr ⟨rfl, rfl⟩) + have hnewb := presentSwapped b a hwa (Or.inl ⟨rfl, rfl⟩) + apply Finset.ext + intro c + by_cases hca : c = a + · subst c + simp only [hnewa, hwa] + · by_cases hcb : c = b + · subst c + simp only [hnewb, hwb] + · exact behavior.2.2.2 w c hca hcb + · exact behavior.1 w hw + +private theorem helper_routeToY_1012.{u_1, u_2} : + helperRouteToY1012Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A ell + X Y Z hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn + hw hf hm + as_aux_lemma => + have hj : 2 ≤ j := hpathLower + clear * - G k e0 input T phi ett base C ctx S nu hn hw hf hm + A X Y Z hAtoT hYtoT hXtoY hYtoZ hXYlen hAtoY hYlen hj j sameStarAll + commonPrefix weakEdges + clear_value A X Y Z + let et := S.corresponding.replacementETT + let K := S.counterexample.hierarchy + let Tn := et.series.data.tree (Fin.last et.rounds).castSucc + have hTnT : TreeSequenceInitialSegment Tn T := et.abovePenultimate + have hTnA : Tn.length ≤ A.length := by + by_cases hz : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz + have hs := sameStarAll S + change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs + rw [hi] at hs + change S.replacementBase.core = A at hs + by_cases hp : et.series.data.kind (Fin.last et.rounds) = + some TashkinovExtensionKind.PE + · rw [← hs]; exact (Classical.choice (S.replacementBase.parallel hp).2.2).leftSegment.1 + · rw [← hs, S.replacementBase.nonparallel hp] + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := + Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) + have hs := sameStarAll S + change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs + rw [hi] at hs + have hmono : Monotone (fun i : Fin (K.dividerCount + 2) => (K.stage i).length) := + Fin.monotone_iff_le_succ.mpr (fun i => (K.nested i).1) + rw [← hs] + change Tn.length ≤ (K.stage _).length + rw [show Tn = K.stage 0 from K.baseStage.symm] + exact hmono (Fin.zero_le _) + have hAYstrict : A.length < Y.length := by + clear * - hj hYlen + omega + have fixedA : ∀ t : Fin A.length, nu (A.edge t) = S.coloring (A.edge t) := by + have he := weakEdges S.coloring nu et S.replacementBase K hw + S.minimumContext.oneEdgeUncolored hn + change ∀ t : Fin (HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).length, + nu ((HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) = + S.coloring ((HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) at he + rw [sameStarAll S] at he + exact he + have fixedY : ∀ t : Fin Y.length, nu (Y.edge t) = S.coloring (Y.edge t) := by + intro t + let tT : Fin T.length := Fin.castLE hYtoT.1 t + have he : T.edge tT = Y.edge t := hYtoT.2.2 t + by_cases ht : t.val < A.length + · let tA : Fin A.length := ⟨t.val, ht⟩ + have hcast : Fin.castLE hAtoT.1 tA = tT := Fin.ext rfl + rw [← he, ← hcast, hAtoT.2.2 tA] + exact fixedA tA + · rw [← he] + exact hf tT (Nat.le_of_not_gt ht) t.isLt + have transport (W : TreeSequence G e0) + (hr : TashkinovAugmentationSequence S.coloring W Y) : + TashkinovAugmentationSequence nu W Y := + TashkinovAugmentationSequenceColoringTransport S.coloring nu W X Y hr + hXtoY hXYlen (fun t _ => fixedY t) + (fun v hv => hm v (TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (TreeSequenceInitialSegmentVertexSetSubset hXtoY hv))) + rcases P2813_T1_TerminalRoute G k e0 S.corresponding.replacementInput T + S.coloring et with ⟨hp, hr⟩ | ⟨hk, f, seed, he, ha, _, _, hr⟩ + · have hTY : TreeSequenceInitialSegment Tn Y := + commonPrefix hTnT hYtoT (hTnA.trans hAtoY.1) + exact Or.inl ⟨hp, transport Tn + (TashkinovAugmentationSequenceRestrict S.coloring Tn Y T hr hTY hYtoT)⟩ + · have hseedT : TreeSequenceInitialSegment seed T := + TashkinovAugmentationSequenceInitialSegment S.coloring seed T hr + have hseedY : TreeSequenceInitialSegment seed Y := + commonPrefix hseedT hYtoT (by + have hl := ha.1 + change seed.length = Tn.length + 1 at hl + clear * - hl hTnA hAYstrict + omega) + exact Or.inr ⟨hk, f, seed, he, ha, transport seed + (TashkinovAugmentationSequenceRestrict S.coloring seed Y T hr hseedY hYtoT)⟩ + +private theorem helper_hthetaMissingY_553.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma + (Y.vertex (Fin.last Y.length)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R sigma Y + have ht := d.thetaMissingAtJ + change d.theta ∈ MissingColors G d.switched.coloring + ((HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy)).vertex + (Fin.last (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy)).length)) at ht + rw [hj] at ht + exact ht + +private theorem helper_hgammaNeBeta_569.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; beta ∈ D → + ∀ gamma ∈ TreeMissingColors sigma A, gamma ≠ beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A D hbetaStored + gamma hgammaA heq + have hnot : beta ∉ TreeMissingColors sigma A := by + intro hmiss + exact (Finset.mem_sdiff.mp hbetaStored).2 hmiss + exact hnot (heq ▸ hgammaA) + +private theorem helper_sameStar_577.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C j; HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A X Y + as_aux_lemma => + clear * - G e0 base C R H q A + have helper : + ∀ (n m : ℕ) (X Y : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → + TreeSequence G e0), n = m → X = Y → HEq s t → Fin.cases (motive := fun _ => TreeSequence G + e0) X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => + TreeSequence G e0) Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by + intro n m X Y s t hnm hXY hst + subst m + have hs : s = t := eq_of_heq hst + simp [hXY, hs] + simpa [A, q, HierarchyStarredStage] using (helper _ _ base.core R.replacementBase.core + C.hierarchy.stage + H.stage R.sameGood.1.2.1 R.sameGood.1.1 + R.sameGood.1.2.2.1) + +private theorem helper_hcutJstrict_610.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A → TreeSequenceInitialSegment A T → j < ell → A.length + j < + T.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R H q A ell sameStar + hAtoT hjUpper + have hj : j < T.length - A.length := by + simpa only [ell, HierarchyFullTailLength, sameStar] using hjUpper + have hAT := hAtoT.1 + clear * - hj hAT + clear_value A + omega + +private theorem helper_prefixToTree_623.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (T : TreeSequence G e0) (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmT : m ≤ T.length), + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T := by + classical + intro V E G e0 T m hm hmT + as_aux_lemma => + refine ⟨hmT, ?_, ?_⟩ + · intro i + simp [TreeSequencePrefix] + · intro i + simp [TreeSequencePrefix] + +private theorem helper_commonPrefix_632.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) + {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T + → U.length ≤ W.length → TreeSequenceInitialSegment U W := by + classical + intro V E G e0 T U W hUT hWT hUW + as_aux_lemma => + rcases hUT with ⟨hu, huv, hue⟩ + rcases hWT with ⟨hw, hwv, hwe⟩ + refine ⟨hUW, ?_, ?_⟩ + · intro i + calc + W.vertex (Fin.castLE (Nat.succ_le_succ hUW) i) = + T.vertex (Fin.castLE (Nat.succ_le_succ hw) + (Fin.castLE (Nat.succ_le_succ hUW) i)) := (hwv _).symm + _ = T.vertex (Fin.castLE (Nat.succ_le_succ hu) i) := by congr 1 + _ = U.vertex i := huv i + · intro i + calc + W.edge (Fin.castLE hUW i) = T.edge (Fin.castLE hw (Fin.castLE hUW i)) := + (hwe _).symm + _ = T.edge (Fin.castLE hu i) := by congr 1 + _ = U.edge i := hue i + +private theorem helper_hElemZ_717.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = Z → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma ell Z + penultimatePrefixEq + as_aux_lemma => + have hp : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := + HierarchyCounterexamplePenultimateElementary G k e0 + R.corresponding.replacementInput T sigma R.corresponding.replacementETT + R.replacementBase R.counterexample R.minimumContext.proper + R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + R.minimumContext.largeMissingSet + intro u hu v hv huv + apply hp + · rw [penultimatePrefixEq]; exact hu + · rw [penultimatePrefixEq]; exact hv + · exact huv + +private theorem helper_firstWitness_734.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), + TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ W.length := by + classical + intro V E _ _ G k e0 T rho W hWT c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hcv⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv + rcases hv with ⟨i, rfl⟩ + let candidates := Finset.univ.filter fun a : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex a) + have hi : Fin.castLE (Nat.succ_le_succ hWT.1) i ∈ candidates := by + simp [candidates, hWT.2.1 i, hcv] + have hn : candidates.Nonempty := ⟨_, hi⟩ + have hmin := Finset.min'_le candidates _ hi + have hmiss : c ∈ MissingColors G rho (T.vertex (candidates.min' hn)) := + (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hpos : HierarchyFirstMissingPosition rho T c = candidates.min' hn := by + simp [HierarchyFirstMissingPosition, candidates, hn] + constructor + · simpa [HierarchyFirstMissingPosition, candidates, hn] using hmiss + · rw [hpos] + have hle : (candidates.min' hn).val ≤ i.val := by + change (candidates.min' hn).val ≤ (Fin.castLE (Nat.succ_le_succ hWT.1) i).val at hmin + simpa using hmin + exact le_trans hle (Nat.le_of_lt_succ i.isLt) + +private theorem helper_vertexMemT_768.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T W : TreeSequence G + e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W + := by + classical + intro V E G e0 T W hWT i hi + as_aux_lemma => + let jW : Fin (W.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hWT.1) jW = i := Fin.ext rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨jW, ?_⟩ + rw [← hWT.2.1 jW, hcast] + +private theorem helper_hthetaY_789.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma + (Y.vertex (Fin.last Y.length)) → ( + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) → ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) (v : V) (c : Fin k), v ∈ + TreeSequenceVertexSet W → c ∈ MissingColors G rho v → c ∈ TreeMissingColors rho W) → + d.theta ∈ TreeMissingColors sigma Y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma Y hthetaMissingY + vertexMemSelf treeMissingIntro + as_aux_lemma => + clear_value Y + exact treeMissingIntro sigma Y (Y.vertex (Fin.last Y.length)) d.theta + (vertexMemSelf Y (Fin.last Y.length)) hthetaMissingY + +private theorem helper_hbetaAfterA_813.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + TreeSequenceInitialSegment A T → beta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T beta)) ∧ (↑(HierarchyFirstMissingPosition sigma T + beta) : ℕ) ≤ B.length → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) (v : V) (c : Fin k), v ∈ + TreeSequenceVertexSet W → c ∈ MissingColors G rho v → c ∈ TreeMissingColors rho W) → beta + ∉ TreeMissingColors sigma A → A.length < (↑(HierarchyFirstMissingPosition sigma T beta) : + ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A B hAtoT + hbetaFirst vertexMemT treeMissingIntro hbetaNotA + by_contra hnot + have hpos : (HierarchyFirstMissingPosition sigma T beta).val ≤ A.length := + Nat.le_of_not_gt hnot + have hvA := vertexMemT A hAtoT (HierarchyFirstMissingPosition sigma T beta) hpos + exact hbetaNotA (treeMissingIntro sigma A + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) beta hvA hbetaFirst.1) + +private theorem helper_hgammaUnusedBeforeBeta_834.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); Disjoint + (R.counterexample.good.gamma q beta ∪ ({ beta } : Finset (Fin k))) ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ sigma (T.edge r) = some + c} : Finset (Fin k)) → + ∀ gamma ∈ R.counterexample.good.gamma q beta, (↑(HierarchyFirstMissingPosition sigma T beta) : + ℕ) ≤ B.length → B.length ≤ A.length + j → gamma ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition sigma + T beta) : ℕ) ∧ sigma (T.edge t) = some c} : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A B hbetaTail + gamma hgammaBeta hbetaFirstLe hBcutoff hc + obtain ⟨_, t, hlo, hhi, hcolor⟩ := Finset.mem_filter.mp hc + have htailMem : gamma ∈ + (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, A.length ≤ r.val ∧ r.val < A.length + j ∧ + sigma (T.edge r) = some c := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, t, hlo, ?_, hcolor⟩ + exact lt_of_lt_of_le hhi (le_trans hbetaFirstLe hBcutoff) + apply (Finset.disjoint_left.mp hbetaTail) + (Finset.mem_union.mpr (Or.inl hgammaBeta)) + exact htailMem + +private theorem helper_treeMissingSubset_868.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma U W hUW + as_aux_lemma => + intro c hc + obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset hUW hv, hmiss⟩ + +private theorem helper_firstChange_904.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (gamma : Fin k), gamma ≠ beta → HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A → beta ∉ TreeMissingColors sigma A → ( gamma ∉ + TreeMissingColors sigma A ∨ beta ∉ TreeMissingColors sigma A → TreeVertexOrder T (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)) (T.vertex (HierarchyFirstMissingPosition + sigma T beta)) ∧ gamma ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition sigma + T beta) : ℕ) ∧ sigma (T.edge t) = some c} : Finset (Fin k))) → ColoredVertexSetElementary + G sigma (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)))) → gamma ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ))) ∧ beta ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition sigma T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition sigma T beta); + have sameComponent : Prop := TwoColorComponent G sigma gamma beta (Sum.inl va) = + TwoColorComponent G sigma gamma beta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors sigma Tnq ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + sigma Tn ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ ( gamma ∈ TreeMissingColors sigma A ∧ TreeColorSetClosed G sigma A + ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A sigma gamma beta) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma + hgammaNeBeta sameStar hbetaNotA horderedUnusedGammaBeta hchangeElementary hchangeMissing + as_aux_lemma => + exact ChangeLemma G k e0 R.corresponding.replacementInput T sigma + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored + R.minimumContext.lowerRung R.minimumContext.fewerDividers + R.minimumContext.lexicographicMinimality hchangeElementary + R.minimumContext.largeMissingSet gamma beta hgammaNeBeta hchangeMissing + (by + change (gamma ∉ TreeMissingColors sigma A ∨ beta ∉ TreeMissingColors sigma A) → + TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ + gamma ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition sigma T beta).val ∧ + sigma (T.edge t) = some c) + exact horderedUnusedGammaBeta) + +private theorem helper_hApositive_927.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; (0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q A hq + as_aux_lemma => + have hlast : q = + (⟨H.dividerCount - 1, Nat.sub_lt hq (by decide)⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + change H.dividerCount = H.dividerCount - 1 + 1 + exact (Nat.sub_add_cancel hq).symm + change HierarchyStarredStage H q = _ + rw [hlast] + change H.stage _ = H.stage _ + congr 1 + apply Fin.ext + change H.dividerCount - 1 + 1 = H.dividerCount + exact Nat.sub_add_cancel hq + +private theorem helper_sameGammaBeta_943.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ gamma ∈ TreeMissingColors sigma A, ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition sigma T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition sigma T beta); + have sameComponent : Prop := TwoColorComponent G sigma gamma beta (Sum.inl va) = + TwoColorComponent G sigma gamma beta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors sigma Tnq ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + sigma Tn ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ ( gamma ∈ TreeMissingColors sigma A ∧ TreeColorSetClosed G sigma A + ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A sigma gamma beta)) + → gamma ∈ HierarchyStageMissingColors H q → ( (0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma hgammaA + firstChange hgammaStageMissing hApositive + by_cases hzero : H.dividerCount = 0 + · have hgammaRaw : gamma ∈ TreeMissingColors sigma + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) := by + have hq0 : q = 0 := by + apply Fin.ext + simp [q, hzero] + rw [hq0] at hgammaStageMissing + simpa [HierarchyStageMissingColors] using hgammaStageMissing + exact firstChange.2.1 ⟨hzero, Or.inl hgammaRaw⟩ + · have hgammaLast : gamma ∈ TreeMissingColors sigma + (H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩) := by + have hstar : A = H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ := + hApositive (Nat.pos_of_ne_zero hzero) + rw [← hstar] + exact hgammaA + exact firstChange.1 ⟨Nat.pos_of_ne_zero hzero, Or.inl hgammaLast⟩ + +private theorem helper_componentLeaf_969.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ G k rho a b hne hp v hm + let _ := Fintype.ofFinite V + as_aux_lemma => + have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G rho a b) + (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with ha | hb + · exact MissingColorIncidenceEndpoint G rho a b hne hp v ha + · have he : TwoColorIncidenceGraph G rho a b = + TwoColorIncidenceGraph G rho b a := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + rw [he] + exact MissingColorIncidenceEndpoint G rho b a hne.symm hp v hb + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx y hy + exact Finset.card_le_one_iff.mp hd + (by simpa [SimpleGraph.mem_neighborFinset] using hx) + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + +private theorem helper_separateComponents_991.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ), ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton) → + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b + (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho + a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u)) := by + classical + intro V E _ _ G k componentSelf componentLeaf rho a b hne hp u v w huv huw hvw hu hv hw hsame + let _ := Fintype.ofFinite V + as_aux_lemma => + rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd + · exfalso + obtain ⟨s, t, p, hpPath, hsupport⟩ := + TwoColorComponentSpanningPath G rho a b hp (Sum.inl w) + have ends (x : V) (hx : Sum.inl x ∈ TwoColorComponent G rho a b (Sum.inl w)) + (hm : a ∈ MissingColors G rho x ∨ b ∈ MissingColors G rho x) : + Sum.inl x = s ∨ Sum.inl x = t := by + by_contra hnot + push Not at hnot + have hs : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {z | z ∈ p.support} + rw [hsupport] + exact hx + exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet + hnot.1 hnot.2 (componentLeaf rho a b hne hp x hm) hs + have hue := ends u (he ▸ componentSelf rho a b u) (Or.inl hu) + have hve := ends v (by rw [he, hsame]; exact componentSelf rho a b v) (Or.inr hv) + have hwe := ends w (componentSelf rho a b w) hw + rcases hue with hu | hu <;> rcases hve with hv | hv <;> rcases hwe with hw | hw + all_goals first + | exact huv (Sum.inl.inj (hu.trans hv.symm)) + | exact huw (Sum.inl.inj (hu.trans hw.symm)) + | exact hvw (Sum.inl.inj (hv.trans hw.symm)) + · exact hd + +private theorem helper_hBlt_1027.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); A.length + j < T.length + → ( + ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + )) → B.length < T.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A B hcutJstrict + fullPrefixEq + change (HierarchyFullTailPrefix C (j - 2)).length < T.length + rw [fullPrefixEq] + simp only [TreeSequencePrefix] + exact lt_of_le_of_lt (Nat.min_le_left _ _) + (lt_of_le_of_lt (Nat.add_le_add_left (Nat.sub_le j 2) _) hcutJstrict) + +private theorem helper_hgammaTerminalDistinct_1040.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (gamma : Fin k), A.length + j < T.length → (↑(HierarchyFirstMissingPosition sigma T gamma) : + ℕ) ≤ A.length → T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex + (Fin.last T.length) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A gamma + hcutJstrict hgammaFirstLe he + have hi := T.vertex_injective he + have hv := congrArg Fin.val hi + simp only [Fin.val_last] at hv + exact (Nat.ne_of_lt (hgammaFirstLe.trans_lt + (lt_of_le_of_lt (Nat.le_add_right _ _) hcutJstrict))) hv + +private theorem helper_hbetaTerminalDistinct_1049.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → B.length < T.length → + T.vertex (HierarchyFirstMissingPosition sigma T beta) ≠ T.vertex (Fin.last T.length) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma B hbetaFirstLe + hBlt he + have hi := T.vertex_injective he + have hv := congrArg Fin.val hi + simp only [Fin.val_last] at hv + exact (Nat.ne_of_lt (hbetaFirstLe.trans_lt hBlt)) hv + +private theorem helper_hmu2One_1069.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ (gamma : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; + IsOneEdgeUncolored mu2 e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma z mu2 + as_aux_lemma => + constructor + · have he0 : sigma e0 = none := R.minimumContext.oneEdgeUncolored.1 + simp [mu2, TwoColorComponentSwap, he0] + · intro e he0 + obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 e he0 + by_cases heK : Sum.inr e ∈ TwoColorComponent G sigma gamma beta z + · by_cases heGamma : sigma e = some gamma + · exact ⟨beta, by simp [mu2, TwoColorComponentSwap, heK, heGamma] + ⟩ + · by_cases heBeta : sigma e = some beta + · exact ⟨gamma, by + simp [mu2, TwoColorComponentSwap, heK, heBeta] + ⟩ + · exact ⟨c, by + simpa [mu2, TwoColorComponentSwap, heK, heGamma, heBeta] using hc⟩ + · exact ⟨c, by simpa [mu2, TwoColorComponentSwap, heK] using hc⟩ + +private theorem helper_hfirstBetaOutside_1094.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ (gamma : Fin k), TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (Fin.last T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)))) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T beta)) ∉ TwoColorComponent G sigma gamma beta z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma sameGammaBeta + componentSelf hterminalDisjoint z hv + have hv' : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∈ + TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) := by + rw [sameGammaBeta] + exact componentSelf sigma gamma beta + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) + exact (Set.disjoint_left.mp hterminalDisjoint) hv hv' + +private theorem helper_hfixedThroughY_1119.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; Disjoint (R.counterexample.good.gamma + q beta ∪ ({ beta } : Finset (Fin k))) ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ sigma (T.edge r) = some + c} : Finset (Fin k)) → + ∀ gamma ∈ R.counterexample.good.gamma q beta, + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → mu2 (T.edge t) = sigma + (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A hbetaTail + gamma hgammaBeta z mu2 + as_aux_lemma => + intro t hlo hhi + have hgammaUnused : sigma (T.edge t) ≠ some gamma := by + intro hc + have hmem : gamma ∈ (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, A.length ≤ r.val ∧ r.val < A.length + j ∧ + sigma (T.edge r) = some c := by + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, t, hlo, hhi, hc⟩ + exact (Finset.disjoint_left.mp hbetaTail) + (Finset.mem_union.mpr (Or.inl hgammaBeta)) hmem + have hbetaUnused : sigma (T.edge t) ≠ some beta := by + intro hc + have hmem : beta ∈ (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, A.length ≤ r.val ∧ r.val < A.length + j ∧ + sigma (T.edge r) = some c := by + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, t, hlo, hhi, hc⟩ + exact (Finset.disjoint_left.mp hbetaTail) + (Finset.mem_union.mpr (Or.inr (Finset.mem_singleton.mpr rfl))) hmem + by_cases hcomponent : Sum.inr (T.edge t) ∈ TwoColorComponent G sigma gamma beta z + · simp [mu2, TwoColorComponentSwap, hcomponent, hgammaUnused, hbetaUnused] + · simp [mu2, TwoColorComponentSwap, hcomponent] + +private theorem helper_firstPreserved_1154.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (_ : ℕ), ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ W.length) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ G k e0 T j firstWitness W hWT rho sigma c helem hmiss hc + let _ := Fintype.ofFinite V + as_aux_lemma => + clear * - G T W rho sigma c helem hmiss hc firstWitness hWT + have hr := firstWitness rho W hWT c hc + have hc' : c ∈ TreeMissingColors sigma W := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ + have hs := firstWitness sigma W hWT c hc' + have pref (i : Fin (T.length + 1)) (hi : i.val ≤ W.length) : + T.vertex i ∈ TreeSequenceVertexSet W := by + let j : Fin (W.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hWT.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, (hWT.2.1 j).symm.trans (congrArg T.vertex he)⟩ + by_contra hne + have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ + T.vertex (HierarchyFirstMissingPosition rho T c) := + fun he => hne (T.vertex_injective he) + have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 + exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 + +private theorem helper_firstUnaffected_1179.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin + k), a ≠ b → IsProperEdgeColoring G rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition + (TwoColorComponentSwap G rho a b z) T c = HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ G k e0 T z rho a b c hne hp hca hcb + let _ := Fintype.ofFinite V + have hb := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + have he : (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G (TwoColorComponentSwap G rho a b z) (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hb.2.2.2 _ c hca hcb + unfold HierarchyFirstMissingPosition + rw [he] + +private theorem helper_hmissingMu2_1194.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (gamma : Fin k), gamma ≠ beta → TreeSequenceInitialSegment Z T → ColoredVertexSetElementary + G sigma (TreeSequenceVertexSet Z) → gamma ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)) ∧ (↑(HierarchyFirstMissingPosition sigma T + gamma) : ℕ) ≤ A.length → beta ∈ MissingColors G sigma (T.vertex + (HierarchyFirstMissingPosition sigma T beta)) ∧ (↑(HierarchyFirstMissingPosition sigma T + beta) : ℕ) ≤ B.length → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ B.length → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → TreeSequenceInitialSegment A Z → TreeSequenceInitialSegment B Z → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; Sum.inl + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) ∉ TwoColorComponent G sigma gamma + beta z → Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∉ + TwoColorComponent G sigma gamma beta z → ( + ∀ (W : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → + IsProperEdgeColoring G rho → ColoredVertexSetElementary G rho (TreeSequenceVertexSet W) → + ∀ (u v : V), u ∈ TreeSequenceVertexSet W → v ∈ TreeSequenceVertexSet W → a ∈ MissingColors G + rho u → b ∈ MissingColors G rho v → Sum.inl u ∉ TwoColorComponent G rho a b z → Sum.inl v + ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet W, MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A ell B Z + gamma hgammaNeBeta hZtoT hElemZ hgammaFirst hbetaFirst hgammaFirstLe hbetaFirstLe + vertexMemT hAtoZ hBtoZ z mu2 hfirstGammaOutside hfirstBetaOutside prefixMissing + have hgZ : T.vertex (HierarchyFirstMissingPosition sigma T gamma) ∈ TreeSequenceVertexSet Z := + vertexMemT Z hZtoT (HierarchyFirstMissingPosition sigma T gamma) + (hgammaFirstLe.trans hAtoZ.1) + have hbZ : T.vertex (HierarchyFirstMissingPosition sigma T beta) ∈ TreeSequenceVertexSet Z := + vertexMemT Z hZtoT (HierarchyFirstMissingPosition sigma T beta) + (hbetaFirstLe.trans hBtoZ.1) + intro v hv + exact prefixMissing Z z sigma gamma beta hgammaNeBeta R.minimumContext.proper + hElemZ (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) + hgZ hbZ hgammaFirst.1 hbetaFirst.1 hfirstGammaOutside hfirstBetaOutside v hv + +private theorem helper_missingTransport_1207.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (old new : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W Z → TreeMissingColors new W = + TreeMissingColors old W := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ell Z old new hm W hWZ + as_aux_lemma => + clear_value Z + clear * - old new hm W hWZ Z + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => + hm v (TreeSequenceInitialSegmentVertexSetSubset hWZ hv)) + +private theorem helper_hstoredMu2_1218.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ gamma ∈ TreeMissingColors sigma A, gamma ≠ beta → TreeSequenceInitialSegment Z T → + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) → beta ∈ TreeMissingColors + sigma Z → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G + rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = HierarchyFirstMissingPosition rho T c) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v) → + ∀ eta ∈ D, HierarchyFirstMissingPosition mu2 T eta = HierarchyFirstMissingPosition sigma T eta + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A ell Z D gamma + hgammaA hgammaNeBeta hZtoT hElemZ hbetaMissingZ z mu2 firstPreserved firstUnaffected + hmissingMu2 eta heta + have hneGamma : eta ≠ gamma := by + intro he + exact (Finset.mem_sdiff.mp heta).2 (he.symm ▸ hgammaA) + by_cases he : eta = beta + · subst eta + exact firstPreserved Z hZtoT sigma mu2 beta hElemZ hmissingMu2 hbetaMissingZ + · exact firstUnaffected z sigma gamma beta eta hgammaNeBeta + R.minimumContext.proper hneGamma he + +private theorem helper_hgammaCutoff_1230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; beta ∈ D → + ∀ gamma ∈ R.counterexample.good.gamma q beta, TreeSequenceInitialSegment B X → + TreeSequenceInitialSegment X Y → (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ + B.length → + ∀ eta ∈ D, gamma ∈ R.counterexample.good.gamma q eta ∨ beta ∈ R.counterexample.good.gamma q + eta → (↑(HierarchyFirstMissingPosition sigma T eta) : ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q X B Y D + hbetaStored gamma hgammaBeta hBtoX hXtoY hbetaFirstLe eta heta hmem + have he : eta = beta := by + by_contra hne + rcases hmem with hg | hb + · exact Finset.disjoint_left.mp + (R.counterexample.good.disjointPairs q eta beta heta hbetaStored hne) + hg hgammaBeta + · exact d.betaOutsideGamma (Finset.mem_biUnion.mpr ⟨eta, heta, hb⟩) + subst eta + exact hbetaFirstLe.trans (hBtoX.1.trans hXtoY.1) + +private theorem helper_originalStar_1244.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (S : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyStarredStage + C.hierarchy (Fin.last C.hierarchy.dividerCount) = HierarchyStarredStage + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx S + as_aux_lemma => + have helper : + ∀ (n m : ℕ) (U W : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → + TreeSequence G e0), n = m → U = W → HEq s t → Fin.cases (motive := fun _ => TreeSequence G + e0) U (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => + TreeSequence G e0) W (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by + intro n m U W s t hnm hUW hst + subst m + have he : s = t := eq_of_heq hst + simp only [hUW, he] + exact helper _ _ _ _ _ _ S.sameGood.1.2.1 S.sameGood.1.1 S.sameGood.1.2.2.1 + +private theorem helper_lastData_1275.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx S + as_aux_lemma => + obtain ⟨hc, hd⟩ := S.sameGood.2 + have hi : Fin.cast (congrArg (fun n => n + 1) hc) + (Fin.last C.hierarchy.dividerCount) = + Fin.last S.counterexample.hierarchy.dividerCount := Fin.ext hc + simpa only [hi] using hd (Fin.last C.hierarchy.dividerCount) + +private theorem helper_sameLast_1290.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma + (Fin.last C.hierarchy.dividerCount) eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q D lastData S + refine ⟨(lastData R).1.symm.trans (lastData S).1, ?_⟩ + intro eta heta + have hc : eta ∈ HierarchyStoredColorsAt C.hierarchy + (Fin.last C.hierarchy.dividerCount) := (lastData R).1.symm ▸ heta + exact ((lastData R).2 eta hc).symm.trans ((lastData S).2 eta hc) + +private theorem helper_weakEdges_1301.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : + ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : + TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage + K (Fin.last K.dividerCount)).edge t) := by + classical + intro V E _ _ _ _ G k e0 T input' old new et bs K hw ho hn + as_aux_lemma => + by_cases hz : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz + rw [hi] at hw ⊢ + exact P2813_T1_BaseDisplayedEdges G k e0 input' T old et bs new ho hn hw + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := + Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) + rw [hi] at hw ⊢ + intro t + by_cases ht : 1 ≤ t.val + · exact hw.2.1 t ht + · let W := HierarchyStarredStage K + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ + have he : t = ⟨0, W.positive⟩ := Fin.ext (by change t.val = 0; omega) + rw [he, W.first_edge, hn.1, ho.1] + +private theorem helper_hXYlen_1327.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; TreeSequenceInitialSegment A T → j ≤ + T.length - A.length → ( + ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + )) → Y.length = X.length + (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A X Y + hAtoT htail fullPrefixEq + change (HierarchyFullTailPrefix C j).length = + (HierarchyFullTailPrefix C (j - 1)).length + 1 + rw [fullPrefixEq j, fullPrefixEq (j - 1)] + simp only [TreeSequencePrefix] + have hj : 2 ≤ j := hpathLower + have hl : A.length + j ≤ T.length := by + have hAT := hAtoT.1 + clear * - htail hAT + omega + clear * - hj hl + omega + +private theorem helper_caseGamma_1360.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; beta ∈ D → + ∀ gamma ∈ R.counterexample.good.gamma q beta, ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (0 : ℕ) < + S.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors S.coloring + (S.counterexample.hierarchy.stage (⟨S.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (S.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + S.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors S.coloring + (S.corresponding.replacementETT.series.data.tree (Fin.last + S.corresponding.replacementETT.rounds).castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q D hbetaStored gamma + hgammaBeta sameLast S + as_aux_lemma => + have hs : beta ∈ HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) := (sameLast S).1 ▸ hbetaStored + have hg : gamma ∈ S.counterexample.good.gamma + (Fin.last S.counterexample.hierarchy.dividerCount) beta := + (sameLast S).2 beta hbetaStored ▸ hgammaBeta + have hm := (Finset.mem_sdiff.mp (S.counterexample.good.avoidance _ beta hs hg)).1 + clear * - S gamma hm + let K := S.counterexample.hierarchy + cases hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) using Fin.cases with + | zero => + have hz : K.dividerCount = 0 := congrArg Fin.val hi + refine Or.inr ⟨hz, ?_⟩ + change gamma ∈ HierarchyStageMissingColors K (Fin.last K.dividerCount) at hm + rw [hi] at hm + exact hm + | succ i => + have hv : K.dividerCount = i.val + 1 := congrArg Fin.val hi + have hc : i.succ.castSucc = + (⟨K.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ : Fin (K.dividerCount + 2)) := + Fin.ext hv.symm + refine Or.inl ⟨Nat.lt_of_lt_of_eq (Nat.succ_pos i.val) hv.symm, ?_⟩ + change gamma ∈ HierarchyStageMissingColors K (Fin.last K.dividerCount) at hm + rw [hi] at hm + change gamma ∈ TreeMissingColors S.coloring (K.stage i.succ.castSucc) at hm + rw [hc] at hm + exact hm + +private theorem helper_hweak1_1415.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (gamma : Fin k), gamma ≠ beta → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) → gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ))) → Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (Fin.last + T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)))) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; (0 : ℕ) < + H.dividerCount ∧ gamma ∈ TreeMissingColors sigma (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + sigma (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) ∨ gamma ∈ TreeMissingColors sigma A ∧ + gamma ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) ∧ beta ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → TwoColorPathComponent G sigma gamma beta z → + HierarchyWeaklyStable H q mu2 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma + hgammaNeBeta hchangeElementary hchangeMissing hterminalDisjoint z mu2 hcase1 hpath1 + as_aux_lemma => + exact (StableChangeCasesOneTwo G k e0 R.corresponding.replacementInput T sigma + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + hchangeElementary R.minimumContext.largeMissingSet gamma beta hgammaNeBeta + hchangeMissing z hpath1 mu2 rfl hcase1 hterminalDisjoint).1 + +private theorem helper_thetaRawIfUsed_1463.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : ℕ := HierarchyFullTailLength C; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma + (Y.vertex (Fin.last Y.length)) → HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (m : ℕ), + HierarchyFullTailPrefix S.counterexample m = HierarchyFullTailPrefix C m) → + ∀ (t : Fin Y.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → sigma (Y.edge t) = some + d.theta → d.theta ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hpathLower hpathUpper R + sigma H q A ell Y hthetaMissingY sameStar hchangeElementary sameFullPrefix + have hpref : HierarchyFullTailPrefix R.counterexample j = Y := sameFullPrefix R j + rw [← hpref] + intro t hlo hhi hc + obtain ⟨_, _, _, f, _, _, _, _, _, hraw⟩ := + HierarchyTailMissingColorExclusion G k e0 R.corresponding.replacementInput T sigma + R.corresponding.replacementETT R.replacementBase H hchangeElementary j + (le_trans (by decide) hpathLower) + (by change j < T.length - A.length + simpa only [ell, HierarchyFullTailLength, sameStar] using hpathUpper) + d.theta (by + change d.theta ∈ MissingColors G sigma + ((HierarchyFullTailPrefix R.counterexample j).vertex + (Fin.last (HierarchyFullTailPrefix R.counterexample j).length)) + rw [hpref] + exact hthetaMissingY) t hlo hhi hc + exact hraw + +private theorem helper_hthetaUnused_1483.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; Y.length = A.length + j → + TreeSequenceInitialSegment Y T → d.theta ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) → ( + ∀ (t : Fin Y.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → sigma (Y.edge t) = some + d.theta → d.theta ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → sigma (T.edge t) ≠ some + d.theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A Y hYlen + hYtoT hthetaNotRaw thetaRawIfUsed t hlo hhi hc + let tY : Fin Y.length := ⟨t.val, hhi⟩ + have hi : Fin.castLE hYtoT.1 tY = t := Fin.ext rfl + have he : sigma (Y.edge tY) = some d.theta := by + rw [← hYtoT.2.2 tY, hi] + exact hc + exact hthetaNotRaw (thetaRawIfUsed tY hlo (hYlen ▸ hhi) he) + +private theorem helper_changeRho_1547.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (gamma : Fin k), (↑(HierarchyFirstMissingPosition d.switched.coloring T d.theta) : ℕ) = + (HierarchyFullTailPrefix C j).length → gamma ≠ d.theta → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Z) → HierarchyFirstMissingPosition rho T gamma = + HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta + = HierarchyFirstMissingPosition sigma T d.theta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) + → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) < (↑(HierarchyFirstMissingPosition + sigma T d.theta) : ℕ) → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho + Z → + let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := + R1.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R1.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition rho T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition rho T d.theta); + have sameComponent : Prop := TwoColorComponent G rho gamma d.theta (Sum.inl va) = + TwoColorComponent G rho gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors rho Tnq ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + rho Tn ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ ( gamma ∈ TreeMissingColors rho A ∧ TreeColorSetClosed G rho A ({ gamma } + : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A rho gamma d.theta) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A ell Y Z + gamma hthetaFirstIndex hgammaNeTheta sameStarAll samePenultimate R1 rho hElemRho + hfirstGammaRho hfirstThetaRho hgammaUnusedRho hgammaBeforeTheta hpairMissingRho + as_aux_lemma => + exact ChangeLemma G k e0 R1.corresponding.replacementInput T rho + R1.corresponding.replacementETT R1.replacementBase R1.counterexample + R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung + R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality + (by change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - 1))) + rw [samePenultimate R1]; exact hElemRho) + R1.minimumContext.largeMissingSet gamma d.theta hgammaNeTheta + (by change gamma ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample + - 1)) ∧ + d.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength + R1.counterexample - 1)) + rw [samePenultimate R1]; exact hpairMissingRho) + (by + dsimp only + rw [sameStarAll R1, hfirstGammaRho, hfirstThetaRho] + intro _ + refine ⟨⟨_, _, rfl, rfl, hgammaBeforeTheta⟩, ?_⟩ + intro hc + obtain ⟨_, t, hlo, hhi, he⟩ := Finset.mem_filter.mp hc + rw [hthetaFirstIndex] at hhi + exact hgammaUnusedRho t hlo hhi he) + +private theorem helper_sameGammaTheta_1572.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ (gamma : Fin k), ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (0 : ℕ) < + S.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors S.coloring + (S.counterexample.hierarchy.stage (⟨S.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (S.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + S.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors S.coloring + (S.corresponding.replacementETT.series.data.tree (Fin.last + S.corresponding.replacementETT.rounds).castSucc)) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; HierarchyFirstMissingPosition rho T gamma = + HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta + = HierarchyFirstMissingPosition sigma T d.theta → ( + let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := + R1.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R1.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition rho T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition rho T d.theta); + have sameComponent : Prop := TwoColorComponent G rho gamma d.theta (Sum.inl va) = + TwoColorComponent G rho gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors rho Tnq ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + rho Tn ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ ( gamma ∈ TreeMissingColors rho A ∧ TreeColorSetClosed G rho A ({ gamma } + : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A rho gamma d.theta)) → + TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition + sigma T gamma))) = TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T d.theta))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma caseGamma R1 + rho hfirstGammaRho hfirstThetaRho changeRho + have he : TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T gamma))) = + TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T d.theta))) := by + rcases caseGamma R1 with ⟨hp, hm⟩ | ⟨hz, hm⟩ + · exact changeRho.1 ⟨hp, Or.inl hm⟩ + · exact changeRho.2.1 ⟨hz, Or.inl hm⟩ + rw [hfirstGammaRho, hfirstThetaRho] at he + exact he + +private theorem helper_hthetaTerminalDistinct_1589.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; A.length + j < T.length → Y.length = + A.length + j → (↑(HierarchyFirstMissingPosition d.switched.coloring T d.theta) : ℕ) = + (HierarchyFullTailPrefix C j).length → T.vertex (HierarchyFirstMissingPosition sigma T + d.theta) ≠ T.vertex (Fin.last T.length) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A Y + hcutJstrict hYlen hthetaFirstIndex he + have hv := congrArg Fin.val (T.vertex_injective he) + simp only [Fin.val_last] at hv + rw [hthetaFirstIndex] at hv + have hlt : Y.length < T.length := hYlen.symm ▸ hcutJstrict + exact Nat.ne_of_lt hlt hv + +private theorem helper_swapOne_1608.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (T : TreeSequence G e0), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + ∀ (old : PartialEdgeColoring E k) (a b : Fin k), + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored (TwoColorComponentSwap G old a b z) e0 := by + classical + intro V E G k e0 T z old a b ho + as_aux_lemma => + constructor + · simp only [TwoColorComponentSwap, ho.1, reduceCtorEq, ite_false, ite_self] + · intro e he + obtain ⟨c, hc⟩ := ho.2 e he + by_cases hm : Sum.inr e ∈ TwoColorComponent G old a b z + · by_cases ha : old e = some a + · exact ⟨b, by simp only [TwoColorComponentSwap, hm, ha, ite_true]⟩ + · by_cases hb : old e = some b + · refine ⟨a, ?_⟩ + unfold TwoColorComponentSwap + rw [ite_eq_left hm, ite_eq_right ha, ite_eq_left hb] + · exact ⟨c, by simpa only [TwoColorComponentSwap, hm, ha, hb, ite_true, ite_false] + using hc⟩ + · exact ⟨c, by simpa only [TwoColorComponentSwap, hm, ite_false] using hc⟩ + +private theorem helper_hweak3_1679.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (gamma : Fin k), gamma ≠ d.theta → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Z) → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; + TwoColorPathComponent G rho gamma d.theta z → ( + let K : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := + R1.counterexample.hierarchy; (0 : ℕ) < K.dividerCount ∧ gamma ∈ TreeMissingColors rho + (K.stage (⟨K.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (K.dividerCount + (2 : ℕ)))) ∨ K.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + rho (R1.corresponding.replacementETT.series.data.tree (Fin.last + R1.corresponding.replacementETT.rounds).castSucc) ∨ gamma ∈ TreeMissingColors rho + (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ gamma ∉ TashkinovStoredColors + R1.corresponding.replacementETT.series.data (Fin.last + R1.corresponding.replacementETT.rounds) ∧ d.theta ∉ TashkinovStoredColors + R1.corresponding.replacementETT.series.data (Fin.last + R1.corresponding.replacementETT.rounds))) → Disjoint (TwoColorComponent G rho gamma + d.theta z) (TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition rho T gamma)))) → gamma ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - (1 + : ℕ))) ∧ d.theta ∈ TreeMissingColors rho (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - (1 : ℕ))) → HierarchyWeaklyStable + R1.counterexample.hierarchy (Fin.last R1.counterexample.hierarchy.dividerCount) mu3 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d ell Z gamma hgammaNeTheta z + samePenultimate R1 rho hElemRho mu3 hpath3 hcase3 hdisjoint3First hmissingPairCurrent + as_aux_lemma => + exact (StableChangeCasesOneTwo G k e0 R1.corresponding.replacementInput T rho + R1.corresponding.replacementETT R1.replacementBase R1.counterexample + R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung + R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality + (by + change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - 1))) + rw [samePenultimate R1] + exact hElemRho) R1.minimumContext.largeMissingSet + gamma d.theta hgammaNeTheta hmissingPairCurrent z hpath3 mu3 rfl hcase3 hdisjoint3First).1 + +private theorem helper_hstored3_1693.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ gamma ∈ TreeMissingColors sigma A, d.theta ∉ D → gamma ≠ d.theta → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G + rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = HierarchyFirstMissingPosition rho T c) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; + ∀ eta ∈ HierarchyStoredColorsAt R1.counterexample.hierarchy (Fin.last + R1.counterexample.hierarchy.dividerCount), HierarchyFirstMissingPosition mu3 T eta = + HierarchyFirstMissingPosition rho T eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A D gamma + hgammaA hthetaUnstored' hgammaNeTheta z firstUnaffected sameLast R1 rho mu3 eta heta + have hetaD : eta ∈ D := (sameLast R1).1.symm ▸ heta + have hneGamma : eta ≠ gamma := by + intro he + exact (Finset.mem_sdiff.mp hetaD).2 (he.symm ▸ hgammaA) + have hneTheta : eta ≠ d.theta := by + intro he + exact hthetaUnstored' (he ▸ hetaD) + exact firstUnaffected z rho gamma d.theta eta hgammaNeTheta + R1.minimumContext.proper hneGamma hneTheta + +private theorem helper_hgammaCutoff3_1706.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; beta ∈ D → + ∀ gamma ∈ R.counterexample.good.gamma q beta, TreeSequenceInitialSegment B X → + TreeSequenceInitialSegment X Y → (↑(HierarchyFirstMissingPosition sigma T beta) : ℕ) ≤ + B.length → d.theta ∉ D.biUnion (R.counterexample.good.gamma q) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; HierarchyFirstMissingPosition rho T beta = + HierarchyFirstMissingPosition sigma T beta → + ∀ eta ∈ HierarchyStoredColorsAt R1.counterexample.hierarchy (Fin.last + R1.counterexample.hierarchy.dividerCount), gamma ∈ R1.counterexample.good.gamma (Fin.last + R1.counterexample.hierarchy.dividerCount) eta ∨ d.theta ∈ R1.counterexample.good.gamma + (Fin.last R1.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition + rho T eta) : ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q X B Y D + hbetaStored gamma hgammaBeta hBtoX hXtoY hbetaFirstLe hthetaOutsideGamma sameLast R1 rho + hfirstBetaRho eta heta hmem + have hetaD : eta ∈ D := (sameLast R1).1.symm ▸ heta + rw [← (sameLast R1).2 eta hetaD] at hmem + have he : eta = beta := by + by_contra hne + rcases hmem with hg | ht + · exact Finset.disjoint_left.mp + (R.counterexample.good.disjointPairs q eta beta hetaD hbetaStored hne) + hg hgammaBeta + · exact hthetaOutsideGamma (Finset.mem_biUnion.mpr ⟨eta, hetaD, ht⟩) + subst eta + rw [hfirstBetaRho] + exact hbetaFirstLe.trans (hBtoX.1.trans hXtoY.1) + +private theorem helper_hYTerminalDistinct_1753.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; A.length + j < T.length → Y.length = + A.length + j → TreeSequenceInitialSegment Y T → Y.vertex (Fin.last Y.length) ≠ T.vertex + (Fin.last T.length) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A Y hcutJstrict + hYlen hYtoT he + have hi := T.vertex_injective ((hYtoT.2.1 (Fin.last Y.length)).trans he) + have hv := congrArg Fin.val hi + simp only [Fin.val_castLE, Fin.val_last] at hv + exact Nat.ne_of_lt (hYlen.symm ▸ hcutJstrict) hv + +private theorem helper_hjEligible_1763.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + ∀ (gamma : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; d.theta ∈ + MissingColors G mu3 (T.vertex (Fin.last T.length)) → d.theta ∈ MissingColors G mu3 + (Y.vertex (Fin.last Y.length)) → + ∀ (R2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), R2.coloring = mu3 + → j ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hpathLower hpathUpper Y + gamma z R1 rho mu3 hthetaTerminalMu3 hthetaYMu3 R2 hR2 + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨?_, ?_⟩, R2, d.theta, ?_, ?_⟩ + · exact (by decide : 1 ≤ 2).trans hpathLower + · exact Nat.le_sub_one_of_lt hpathUpper + · rw [hR2] + exact hthetaYMu3 + · rw [hR2] + exact hthetaTerminalMu3 + +private theorem helper_continuation_3731.{u_1, u_2} : + helperContinuation3731Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell X B Y Z D hbetaStored gamma hgammaBeta hgammaA + hgammaNeBeta hthetaUnstored' hcutJstrict hYlen hYtoT hBtoX hXtoY hYtoZ hZtoT hAtoY + hgammaFirstLe hbetaFirstLe vertexMemT vertexMemSelf hthetaY hthetaFirst hthetaOutsideGamma + hgammaNeTheta hAtoZ treeMissingSubset componentSelf componentLeaf separateComponents + hgammaTerminalDistinct z mu2 prefixMissing firstUnaffected missingTransport sameStarAll + samePenultimate sameLast routeToY caseGamma hsuffixY hsplitMissing2 hAYstrict R1 hR1 rho + hmissingRho hElemRho hfirstGammaRho hfirstBetaRho hgammaWitnessRho hthetaWitnessRho + hthetaYRho hgammaTerminalRho hgammaUnusedRho hthetaUnusedRho hpairMissingRho sameGammaTheta + hgammaThetaDistinct hthetaTerminalDistinct + have hdisjoint3 := separateComponents rho gamma d.theta hgammaNeTheta R1.minimumContext.proper + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) + (T.vertex (Fin.last T.length)) hgammaThetaDistinct hgammaTerminalDistinct + hthetaTerminalDistinct hgammaWitnessRho hthetaWitnessRho (Or.inl hgammaTerminalRho) + sameGammaTheta + let mu3 := TwoColorComponentSwap G rho gamma d.theta z + have hpath3 : TwoColorPathComponent G rho gamma d.theta z := + ⟨hgammaNeTheta, _, componentSelf rho gamma d.theta _, + componentLeaf rho gamma d.theta hgammaNeTheta R1.minimumContext.proper _ + (Or.inl hgammaTerminalRho)⟩ + have swapOne (old : PartialEdgeColoring E k) (a b : Fin k) + (ho : IsOneEdgeUncolored old e0) : + IsOneEdgeUncolored (TwoColorComponentSwap G old a b z) e0 := by + exact helper_swapOne_1608 (@G) (@k) (@e0) (@T) (@old) (@a) (@b) (@ho) + have hmu3One : IsOneEdgeUncolored mu3 e0 := swapOne rho gamma d.theta + R1.minimumContext.oneEdgeUncolored + have hgammaOutside3 : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) ∉ + TwoColorComponent G rho gamma d.theta z := by + intro hm + exact Set.disjoint_left.mp hdisjoint3 hm (componentSelf rho gamma d.theta _) + have hthetaOutside3 : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) ∉ + TwoColorComponent G rho gamma d.theta z := by + intro hm + apply Set.disjoint_left.mp hdisjoint3 hm + rw [sameGammaTheta] + exact componentSelf rho gamma d.theta _ + have hmissing3 : ∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G mu3 v = MissingColors G rho v := + prefixMissing Z z rho gamma d.theta hgammaNeTheta R1.minimumContext.proper hElemRho + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) + (vertexMemT Z hZtoT (HierarchyFirstMissingPosition sigma T gamma) + (hgammaFirstLe.trans hAtoZ.1)) + (vertexMemT Z hZtoT (HierarchyFirstMissingPosition sigma T d.theta) + (hthetaFirst.2.trans hYtoZ.1)) + hgammaWitnessRho hthetaWitnessRho hgammaOutside3 hthetaOutside3 + have hfixed3 : ∀ t : Fin T.length, A.length ≤ t.val → t.val < Y.length → + mu3 (T.edge t) = rho (T.edge t) := by + intro t hlo hhi + simp only [mu3, TwoColorComponentSwap, hgammaUnusedRho t hlo hhi, + hthetaUnusedRho t hlo hhi, ite_false, ite_self] + have hcase3 : + let K := R1.counterexample.hierarchy + (0 < K.dividerCount ∧ gamma ∈ TreeMissingColors rho + (K.stage ⟨K.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩)) ∨ + (K.dividerCount = 0 ∧ + (gamma ∈ TreeMissingColors rho + (R1.corresponding.replacementETT.series.data.tree + (Fin.last R1.corresponding.replacementETT.rounds).castSucc) ∨ + (gamma ∈ TreeMissingColors rho (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ + gamma ∉ TashkinovStoredColors R1.corresponding.replacementETT.series.data + (Fin.last R1.corresponding.replacementETT.rounds) ∧ + d.theta ∉ TashkinovStoredColors R1.corresponding.replacementETT.series.data + (Fin.last R1.corresponding.replacementETT.rounds)))) := by + rcases caseGamma R1 with h | ⟨hz, hm⟩ + · exact Or.inl h + · exact Or.inr ⟨hz, Or.inl hm⟩ + have hdisjoint3First : Disjoint (TwoColorComponent G rho gamma d.theta z) + (TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T gamma)))) := by + rw [hfirstGammaRho] + exact hdisjoint3 + have hmissingPairCurrent : gamma ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - + 1)) ∧ + d.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - + 1)) := by + rw [samePenultimate R1] + exact hpairMissingRho + have hweak3 : HierarchyWeaklyStable R1.counterexample.hierarchy + (Fin.last R1.counterexample.hierarchy.dividerCount) mu3 := by + exact helper_hweak3_1679 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@gamma) (@hgammaNeTheta) (@samePenultimate) (@R1) (@hElemRho) + (@hpath3) (@hcase3) + (@hdisjoint3First) (@hmissingPairCurrent) + have hstored3 : ∀ eta ∈ HierarchyStoredColorsAt R1.counterexample.hierarchy + (Fin.last R1.counterexample.hierarchy.dividerCount), + HierarchyFirstMissingPosition mu3 T eta = HierarchyFirstMissingPosition rho T eta := by + exact helper_hstored3_1693 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaA) (@hthetaUnstored') (@hgammaNeTheta) + (@firstUnaffected) + (@sameLast) (@R1) + have hgammaCutoff3 : ∀ eta ∈ HierarchyStoredColorsAt R1.counterexample.hierarchy + (Fin.last R1.counterexample.hierarchy.dividerCount), + (gamma ∈ R1.counterexample.good.gamma (Fin.last R1.counterexample.hierarchy.dividerCount) + eta ∨ + d.theta ∈ R1.counterexample.good.gamma (Fin.last + R1.counterexample.hierarchy.dividerCount) eta) → + (HierarchyFirstMissingPosition rho T eta).val ≤ Y.length := by + exact helper_hgammaCutoff3_1706 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hbetaStored) (@gamma) (@hgammaBeta) (@hBtoX) + (@hXtoY) + (@hbetaFirstLe) (@hthetaOutsideGamma) (@sameLast) (@R1) (@hfirstBetaRho) + have hsuffixMu2 : TashkinovAugmentationSequence mu2 Y T := + TashkinovAugmentationSequenceComponentSwap G k e0 sigma gamma beta hgammaNeBeta z + Y T hsuffixY hsplitMissing2.1 hsplitMissing2.2 + have hsuffixRho : TashkinovAugmentationSequence rho Y T := by + change TashkinovAugmentationSequence R1.coloring Y T + rw [hR1] + exact hsuffixMu2 + have hsplitMissing3 : gamma ∈ TreeMissingColors mu3 Y ∧ d.theta ∈ TreeMissingColors mu3 Y := by + rw [missingTransport rho mu3 hmissing3 Y hYtoZ, + missingTransport sigma rho hmissingRho Y hYtoZ] + exact ⟨treeMissingSubset hAtoY hgammaA, hthetaY⟩ + have hroute3 := routeToY R1 mu3 hmu3One hweak3 hfixed3 hmissing3 + obtain ⟨_, _, corr2, hmax2, bs2, K2, good2, same2⟩ := + StableChangeCasesOneTwoSplitTail G k e0 R1.corresponding.replacementInput T rho + R1.corresponding.replacementETT R1.replacementBase R1.counterexample R1.minimumContext + gamma d.theta hgammaNeTheta hmissingPairCurrent z hpath3 mu3 rfl hcase3 hdisjoint3First + Y (by dsimp only; rw [sameStarAll R1]; exact hAtoY) + (by dsimp only; rw [sameStarAll R1]; exact hAYstrict) + (by rw [samePenultimate R1]; exact hYtoZ) + (by dsimp only; rw [sameStarAll R1]; exact hfixed3) hroute3 hsuffixRho + hsplitMissing3 (by rw [samePenultimate R1]; exact hmissing3) + hstored3 hgammaCutoff3 + have hthetaTerminalMu3 : d.theta ∈ MissingColors G mu3 (T.vertex (Fin.last T.length)) := + (TwoColorComponentSwapMissingBehavior G rho gamma d.theta hgammaNeTheta + R1.minimumContext.proper z).2.1 _ (componentSelf rho gamma d.theta _) hgammaTerminalRho + have hthetaYMu3 : d.theta ∈ MissingColors G mu3 (Y.vertex (Fin.last Y.length)) := by + rw [hmissing3 _ (TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (vertexMemSelf Y (Fin.last Y.length)))] + exact hthetaYRho + have hYTerminalDistinct : Y.vertex (Fin.last Y.length) ≠ T.vertex (Fin.last T.length) := by + exact helper_hYTerminalDistinct_1753 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@hYlen) (@hYtoT) + let C2 : HierarchyCounterexample bs2 := by + exact @helperC21693 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) + (@j) (@gamma) (@hYtoT) (@vertexMemSelf) (@R1) (@corr2) (@hmax2) (@bs2) (@K2) (@good2) + (@hthetaTerminalMu3) (@hthetaYMu3) (@hYTerminalDistinct) + obtain ⟨R2, hR2⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx R1 mu3 corr2 bs2 C2 same2 + have hjEligible : j ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + := by + exact helper_hjEligible_1763 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@j) (@hpathLower) (@hpathUpper) (@gamma) (@R1) + (@hthetaTerminalMu3) (@hthetaYMu3) (@R2) (@hR2) + have hbound := HierarchySituationThreeEligibleIndexBound G k e0 input T phi ett base C ctx + (by rw [hj]; exact hpathLower) (by rw [hj]; exact hpathUpper) hvertexMissing j hjEligible + rw [hj] at hbound + exact Nat.lt_irrefl j hbound + +private theorem helper_continuation_3727.{u_1, u_2} : + helperContinuation3727Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell X B Y Z D hbetaStored hbetaTail hthetaMissingY + gamma hgammaBeta hgammaA hgammaNeBeta hthetaUnstored' sameStar hcutJstrict hYlen hYtoT + hBtoX hXtoY hYtoZ hZtoT hAtoY hElemZ hgammaFirst hgammaFirstLe hbetaFirstLe vertexMemT + vertexMemSelf hthetaY hthetaFirst hthetaFirstIndex hthetaOutsideGamma hgammaNeTheta hAtoZ + treeMissingSubset hgammaMissingZ hbetaMissingZ hchangeElementary componentSelf + componentLeaf separateComponents hgammaTerminalDistinct z mu2 hgammaTerminalMu2 + hfixedThroughY prefixMissing firstPreserved firstUnaffected hmissingMu2 missingTransport + sameStarAll samePenultimate sameLast routeToY caseGamma hsuffixY hsplitMissing2 hAYstrict + R1 hR1 sameFullPrefix hthetaNotRaw + have thetaRawIfUsed : ∀ t : Fin Y.length, A.length ≤ t.val → + t.val < A.length + j → sigma (Y.edge t) = some d.theta → + d.theta ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + exact helper_thetaRawIfUsed_1463 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hpathLower) (@hpathUpper) (@hthetaMissingY) + (@sameStar) + (@hchangeElementary) (@sameFullPrefix) + have hthetaUnused : ∀ t : Fin T.length, A.length ≤ t.val → t.val < Y.length → + sigma (T.edge t) ≠ some d.theta := by + exact helper_hthetaUnused_1483 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hYlen) (@hYtoT) (@hthetaNotRaw) (@thetaRawIfUsed) + let rho := R1.coloring + have hmissingRho : ∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G rho v = MissingColors G sigma v := by + rw [show rho = mu2 from hR1] + exact hmissingMu2 + have hElemRho : ColoredVertexSetElementary G rho (TreeSequenceVertexSet Z) := by + intro u hu v hv huv + rw [hmissingRho u hu, hmissingRho v hv] + exact hElemZ hu hv huv + have hthetaMissingZ : d.theta ∈ TreeMissingColors sigma Z := treeMissingSubset hYtoZ hthetaY + have hfirstGammaRho : HierarchyFirstMissingPosition rho T gamma = + HierarchyFirstMissingPosition sigma T gamma := + firstPreserved Z hZtoT sigma rho gamma hElemZ hmissingRho hgammaMissingZ + have hfirstThetaRho : HierarchyFirstMissingPosition rho T d.theta = + HierarchyFirstMissingPosition sigma T d.theta := + firstPreserved Z hZtoT sigma rho d.theta hElemZ hmissingRho hthetaMissingZ + have hfirstBetaRho : HierarchyFirstMissingPosition rho T beta = + HierarchyFirstMissingPosition sigma T beta := + firstPreserved Z hZtoT sigma rho beta hElemZ hmissingRho hbetaMissingZ + have hgammaWitnessRho : gamma ∈ MissingColors G rho + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) := by + rw [hmissingRho _ (vertexMemT Z hZtoT (HierarchyFirstMissingPosition sigma T gamma) + (hgammaFirstLe.trans hAtoZ.1))] + exact hgammaFirst.1 + have hthetaWitnessRho : d.theta ∈ MissingColors G rho + (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) := by + rw [hmissingRho _ (vertexMemT Z hZtoT (HierarchyFirstMissingPosition sigma T d.theta) + (hthetaFirst.2.trans hYtoZ.1))] + exact hthetaFirst.1 + have hthetaYRho : d.theta ∈ MissingColors G rho (Y.vertex (Fin.last Y.length)) := by + rw [hmissingRho _ (TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (vertexMemSelf Y (Fin.last Y.length)))] + exact hthetaMissingY + have hgammaTerminalRho : gamma ∈ MissingColors G rho (T.vertex (Fin.last T.length)) := by + rw [show rho = mu2 from hR1] + exact hgammaTerminalMu2 + have hgammaUnusedRho : ∀ t : Fin T.length, A.length ≤ t.val → t.val < Y.length → + rho (T.edge t) ≠ some gamma := by + intro t hlo hhi hc + rw [show rho = mu2 from hR1, hfixedThroughY t hlo (hYlen ▸ hhi)] at hc + exact Finset.disjoint_left.mp hbetaTail (Finset.mem_union_left _ hgammaBeta) + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, hYlen ▸ hhi, hc⟩) + have hthetaUnusedRho : ∀ t : Fin T.length, A.length ≤ t.val → t.val < Y.length → + rho (T.edge t) ≠ some d.theta := by + intro t hlo hhi + rw [show rho = mu2 from hR1, hfixedThroughY t hlo (hYlen ▸ hhi)] + exact hthetaUnused t hlo hhi + have hgammaBeforeTheta : (HierarchyFirstMissingPosition sigma T gamma).val < + (HierarchyFirstMissingPosition sigma T d.theta).val := by + rw [hthetaFirstIndex] + exact hgammaFirstLe.trans_lt hAYstrict + have hpairMissingRho : gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho Z := by + have he := missingTransport sigma rho hmissingRho Z ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + rw [he] + exact ⟨hgammaMissingZ, hthetaMissingZ⟩ + have changeRho := by + exact helper_changeRho_1547 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@j) (@gamma) (@hthetaFirstIndex) (@hgammaNeTheta) (@sameStarAll) + (@samePenultimate) (@R1) (@hElemRho) (@hfirstGammaRho) (@hfirstThetaRho) + (@hgammaUnusedRho) (@hgammaBeforeTheta) (@hpairMissingRho) + have sameGammaTheta : TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) = + TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T d.theta))) := by + exact helper_sameGammaTheta_1572 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@caseGamma) (@R1) (@hfirstGammaRho) + (@hfirstThetaRho) + (@changeRho) + have hgammaThetaDistinct : T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ + T.vertex (HierarchyFirstMissingPosition sigma T d.theta) := by + intro he + exact ne_of_lt hgammaBeforeTheta (congrArg Fin.val (T.vertex_injective he)) + have hthetaTerminalDistinct : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ + T.vertex (Fin.last T.length) := by + exact helper_hthetaTerminalDistinct_1589 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@hYlen) (@hthetaFirstIndex) + exact @helper_continuation_3731 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) (@hbetaStored) + (@gamma) (@hgammaBeta) (@hgammaA) (@hgammaNeBeta) (@hthetaUnstored') (@hcutJstrict) + (@hYlen) (@hYtoT) (@hBtoX) (@hXtoY) (@hYtoZ) (@hZtoT) (@hAtoY) (@hgammaFirstLe) + (@hbetaFirstLe) (@vertexMemT) (@vertexMemSelf) (@hthetaY) (@hthetaFirst) + (@hthetaOutsideGamma) (@hgammaNeTheta) (@hAtoZ) (@treeMissingSubset) (@componentSelf) + (@componentLeaf) (@separateComponents) (@hgammaTerminalDistinct) (@prefixMissing) + (@firstUnaffected) (@missingTransport) (@sameStarAll) (@samePenultimate) (@sameLast) + (@routeToY) (@caseGamma) (@hsuffixY) (@hsplitMissing2) (@hAYstrict) (@R1) (@hR1) + (@hmissingRho) (@hElemRho) (@hfirstGammaRho) (@hfirstBetaRho) (@hgammaWitnessRho) + (@hthetaWitnessRho) (@hthetaYRho) (@hgammaTerminalRho) (@hgammaUnusedRho) + (@hthetaUnusedRho) (@hpairMissingRho) (@sameGammaTheta) (@hgammaThetaDistinct) + (@hthetaTerminalDistinct) + +private theorem helper_continuation_3042.{u_1, u_2} : + helperContinuation3042Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell X B Y Z D hbetaStored hbetaB hbetaTail + hthetaMissingY gamma hgammaBeta hgammaA hgammaNeBeta hthetaUnstored' sameStar hAtoT + hcutJstrict commonPrefix hYlen hBtoT hYtoT hBtoX hXtoY hYtoZ hZtoT hAtoY + penultimatePrefixEq hElemZ firstWitness hgammaFirst hgammaFirstLe hbetaFirstLe vertexMemT + vertexMemSelf hthetaY hthetaFirst hthetaFirstIndex hthetaOutsideGamma hgammaNeTheta hAtoZ + treeMissingSubset hgammaMissingZ hbetaMissingZ hchangeElementary hchangeMissing + componentSelf componentLeaf separateComponents hgammaTerminalDistinct hterminalDisjoint z + mu2 hmu2One hgammaFirstMu2 hgammaTerminalMu2 hfixedThroughY prefixMissing firstPreserved + firstUnaffected hmissingMu2 missingTransport hstoredMu2 hgammaCutoff sameStarAll + samePenultimate sameLast routeToY + have caseGamma (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + (0 < S.counterexample.hierarchy.dividerCount ∧ + gamma ∈ TreeMissingColors S.coloring (S.counterexample.hierarchy.stage + ⟨S.counterexample.hierarchy.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩)) ∨ + (S.counterexample.hierarchy.dividerCount = 0 ∧ + gamma ∈ TreeMissingColors S.coloring + (S.corresponding.replacementETT.series.data.tree + (Fin.last S.corresponding.replacementETT.rounds).castSucc)) := by + exact helper_caseGamma_1360 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@hbetaStored) (@gamma) (@hgammaBeta) (@sameLast) (@S) + have hcase1 : + (0 < H.dividerCount ∧ gamma ∈ TreeMissingColors sigma + (H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩)) ∨ + (H.dividerCount = 0 ∧ + (gamma ∈ TreeMissingColors sigma + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) ∨ + (gamma ∈ TreeMissingColors sigma A ∧ + gamma ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) ∧ + beta ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)))) := by + rcases caseGamma R with h | ⟨hz, hm⟩ + · exact Or.inl h + · exact Or.inr ⟨hz, Or.inl hm⟩ + have hpath1 : TwoColorPathComponent G sigma gamma beta z := + ⟨hgammaNeBeta, _, componentSelf sigma gamma beta _, + componentLeaf sigma gamma beta hgammaNeBeta R.minimumContext.proper _ + (Or.inr d.betaMissingTerminal)⟩ + have hweak1 : HierarchyWeaklyStable H q mu2 := by + exact helper_hweak1_1415 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@gamma) (@hgammaNeBeta) (@hchangeElementary) (@hchangeMissing) + (@hterminalDisjoint) + (@hcase1) (@hpath1) + have hsuffixX : TashkinovAugmentationSequence sigma X T := by + simpa only [X, sigma, R, hj] using d.transportedSuffix + have hsuffixY : TashkinovAugmentationSequence sigma Y T := + TashkinovAugmentationSequenceSuffix sigma X Y T hsuffixX hXtoY hYtoT + have hsplitMissing2 : gamma ∈ TreeMissingColors mu2 Y ∧ beta ∈ TreeMissingColors mu2 Y := by + rw [missingTransport sigma mu2 hmissingMu2 Y hYtoZ] + exact ⟨treeMissingSubset hAtoY hgammaA, + treeMissingSubset (commonPrefix hBtoT hYtoT (hBtoX.1.trans hXtoY.1)) hbetaB⟩ + have hAYstrict : A.length < Y.length := by + have hj : 2 ≤ j := hpathLower + clear * - hj hYlen + omega + have hroute2 := routeToY R mu2 hmu2One hweak1 + (fun t hlo hhi => hfixedThroughY t hlo (hYlen ▸ hhi)) hmissingMu2 + obtain ⟨_, _, corr1, hmax1, bs1, K1, good1, same1⟩ := + StableChangeCasesOneTwoSplitTail G k e0 R.corresponding.replacementInput T sigma + R.corresponding.replacementETT R.replacementBase R.counterexample R.minimumContext + gamma beta hgammaNeBeta hchangeMissing z hpath1 mu2 rfl hcase1 hterminalDisjoint + Y hAtoY hAYstrict (by rw [penultimatePrefixEq]; exact hYtoZ) + (fun t hlo hhi => hfixedThroughY t hlo (hYlen ▸ hhi)) hroute2 hsuffixY + hsplitMissing2 (by rw [penultimatePrefixEq]; exact hmissingMu2) + hstoredMu2 hgammaCutoff + let C1 : HierarchyCounterexample bs1 := by + exact @helperC11319 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) + (@gamma) (@vertexMemSelf) (@hgammaTerminalDistinct) (@hgammaFirstMu2) + (@hgammaTerminalMu2) (@corr1) (@hmax1) (@bs1) (@K1) (@good1) + obtain ⟨R1, hR1⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx R mu2 corr1 bs1 C1 same1 + have sameFullPrefix (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) (m : ℕ) : + HierarchyFullTailPrefix S.counterexample m = HierarchyFullTailPrefix C m := by + simp only [HierarchyFullTailPrefix, sameStarAll S, sameStar] + have hthetaNotA : d.theta ∉ TreeMissingColors sigma A := by + intro hm + have hle := (firstWitness sigma A hAtoT d.theta hm).2 + rw [hthetaFirstIndex] at hle + exact Nat.not_le_of_gt hAYstrict hle + have hthetaNotRaw : d.theta ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + intro hm + exact hthetaUnstored' (Finset.mem_sdiff.mpr ⟨hm, hthetaNotA⟩) + exact @helper_continuation_3727 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) (@hbetaStored) + (@hbetaTail) (@hthetaMissingY) (@gamma) (@hgammaBeta) (@hgammaA) (@hgammaNeBeta) + (@hthetaUnstored') (@sameStar) (@hcutJstrict) (@hYlen) (@hYtoT) (@hBtoX) (@hXtoY) (@hYtoZ) + (@hZtoT) (@hAtoY) (@hElemZ) (@hgammaFirst) (@hgammaFirstLe) (@hbetaFirstLe) (@vertexMemT) + (@vertexMemSelf) (@hthetaY) (@hthetaFirst) (@hthetaFirstIndex) (@hthetaOutsideGamma) + (@hgammaNeTheta) (@hAtoZ) (@treeMissingSubset) (@hgammaMissingZ) (@hbetaMissingZ) + (@hchangeElementary) (@componentSelf) (@componentLeaf) (@separateComponents) + (@hgammaTerminalDistinct) (@hgammaTerminalMu2) (@hfixedThroughY) (@prefixMissing) + (@firstPreserved) (@firstUnaffected) (@hmissingMu2) (@missingTransport) (@sameStarAll) + (@samePenultimate) (@sameLast) (@routeToY) (@caseGamma) (@hsuffixY) (@hsplitMissing2) + (@hAYstrict) (@R1) (@hR1) (@sameFullPrefix) (@hthetaNotRaw) +private theorem helper_continuation_3933.{u_1, u_2} : + helperContinuation3933Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell X B Y Z D hbetaStored hbetaB hbetaTail + hthetaMissingY gamma hgammaBeta hgammaA hgammaNeBeta hthetaUnstored' sameStar hAtoT htail + hcutJstrict fullPrefixEq commonPrefix hYlen hBtoT hYtoT hBtoX hXtoY hYtoZ hZtoT hAtoY + penultimatePrefixEq hElemZ firstWitness hgammaFirst hgammaFirstLe hbetaFirstLe vertexMemT + vertexMemSelf hthetaY hthetaFirst hthetaFirstIndex hthetaOutsideGamma hgammaNeTheta hAtoZ + treeMissingSubset hgammaMissingZ hbetaMissingZ hchangeElementary hchangeMissing + componentSelf componentLeaf separateComponents hgammaTerminalDistinct hterminalDisjoint z + mu2 hmu2One hgammaFirstMu2 hgammaTerminalMu2 hfixedThroughY prefixMissing firstPreserved + firstUnaffected hmissingMu2 missingTransport + have hstoredMu2 : ∀ eta ∈ D, + HierarchyFirstMissingPosition mu2 T eta = + HierarchyFirstMissingPosition sigma T eta := by + exact helper_hstoredMu2_1218 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaA) (@hgammaNeBeta) (@hZtoT) (@hElemZ) + (@hbetaMissingZ) (@firstPreserved) (@firstUnaffected) (@hmissingMu2) + have hgammaCutoff : ∀ eta ∈ D, + (gamma ∈ R.counterexample.good.gamma q eta ∨ + beta ∈ R.counterexample.good.gamma q eta) → + (HierarchyFirstMissingPosition sigma T eta).val ≤ Y.length := by + exact helper_hgammaCutoff_1230 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hbetaStored) (@gamma) (@hgammaBeta) (@hBtoX) + (@hXtoY) + (@hbetaFirstLe) + have originalStar (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) := by + exact helper_originalStar_1244 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@S) + have sameStarAll (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) = A := + (originalStar S).symm.trans sameStar + have samePenultimate (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + HierarchyFullTailPrefix S.counterexample + (HierarchyFullTailLength S.counterexample - 1) = Z := by + simp only [HierarchyFullTailPrefix, HierarchyFullTailLength, sameStarAll S] + simp only [Z, ell, HierarchyFullTailPrefix, HierarchyFullTailLength, sameStar] + have lastData (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + exact helper_lastData_1275 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@S) + have sameLast (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) : + D = HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + exact helper_sameLast_1290 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@lastData) (@S) + have weakEdges {input' : PartialEdgeColoring E k} + (old new : PartialEdgeColoring E k) + (et : ExtendedTashkinovTree G k e0 input' T old) + (bs : HierarchyBase et old) (K : TashkinovHierarchy et bs) + (hw : HierarchyWeaklyStable K (Fin.last K.dividerCount) new) + (ho : IsOneEdgeUncolored old e0) (hn : IsOneEdgeUncolored new e0) : + ∀ t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length, + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by + exact helper_weakEdges_1301 (@G) (@k) (@e0) (@T) (@old) (@new) (@et) (@bs) (@K) (@hw) (@ho) + (@hn) + have hXYlen : Y.length = X.length + 1 := by + exact helper_hXYlen_1327 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hj) (@hpathLower) (@hAtoT) (@htail) (@fullPrefixEq) + have routeToY (S : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) (nu : PartialEdgeColoring E k) + (hn : IsOneEdgeUncolored nu e0) + (hw : HierarchyWeaklyStable S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) nu) + (hf : ∀ t : Fin T.length, A.length ≤ t.val → t.val < Y.length → + nu (T.edge t) = S.coloring (T.edge t)) + (hm : ∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G nu v = MissingColors G S.coloring v) : + let et := S.corresponding.replacementETT + let n := Fin.last et.rounds + let Tn := et.series.data.tree n.castSucc + (et.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence nu Tn Y) ∨ + ((et.series.data.kind n = some TashkinovExtensionKind.SE ∨ + et.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + et.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence nu seed Y) := by + exact @helper_routeToY_1012 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha beta d j hj hpathLower hAtoT commonPrefix hYlen + hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn hw hf hm + exact @helper_continuation_3042 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) (@hbetaStored) + (@hbetaB) (@hbetaTail) (@hthetaMissingY) (@gamma) (@hgammaBeta) (@hgammaA) (@hgammaNeBeta) + (@hthetaUnstored') (@sameStar) (@hAtoT) (@hcutJstrict) (@commonPrefix) (@hYlen) (@hBtoT) + (@hYtoT) (@hBtoX) (@hXtoY) (@hYtoZ) (@hZtoT) (@hAtoY) (@penultimatePrefixEq) (@hElemZ) + (@firstWitness) (@hgammaFirst) (@hgammaFirstLe) (@hbetaFirstLe) (@vertexMemT) + (@vertexMemSelf) (@hthetaY) (@hthetaFirst) (@hthetaFirstIndex) (@hthetaOutsideGamma) + (@hgammaNeTheta) (@hAtoZ) (@treeMissingSubset) (@hgammaMissingZ) (@hbetaMissingZ) + (@hchangeElementary) (@hchangeMissing) (@componentSelf) (@componentLeaf) + (@separateComponents) (@hgammaTerminalDistinct) (@hterminalDisjoint) (@hmu2One) + (@hgammaFirstMu2) (@hgammaTerminalMu2) (@hfixedThroughY) (@prefixMissing) (@firstPreserved) + (@firstUnaffected) (@hmissingMu2) (@missingTransport) (@hstoredMu2) (@hgammaCutoff) + (@sameStarAll) (@samePenultimate) (@sameLast) (@routeToY) + +private theorem helper_continuation_2662.{u_1, u_2} : + helperContinuation2662Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell X B Y Z D hbetaStored hbetaB hbetaTail + hthetaMissingY gamma hgammaBeta hgammaA hgammaNeBeta hthetaUnstored' sameStar hAtoT htail + hcutJstrict fullPrefixEq commonPrefix hYlen hBtoT hYtoT hBtoX hXtoY hYtoZ hZtoT hAtoY + penultimatePrefixEq hElemZ firstWitness hgammaFirst hbetaFirst hgammaFirstLe hbetaFirstLe + vertexMemT vertexMemSelf hthetaY hthetaFirst hthetaFirstIndex hthetaOutsideGamma + hgammaNeTheta hAtoZ hBtoZ treeMissingSubset hgammaMissingZ hbetaMissingZ hchangeElementary + hchangeMissing sameGammaBeta componentSelf componentLeaf separateComponents hBlt + hindicesDistinct hgammaTerminalDistinct + have hbetaTerminalDistinct : + T.vertex (HierarchyFirstMissingPosition sigma T beta) ≠ + T.vertex (Fin.last T.length) := by + exact helper_hbetaTerminalDistinct_1049 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hbetaFirstLe) (@hBlt) + have hterminalDisjoint := separateComponents sigma gamma beta hgammaNeBeta + R.minimumContext.proper + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) + (T.vertex (Fin.last T.length)) hindicesDistinct hgammaTerminalDistinct + hbetaTerminalDistinct hgammaFirst.1 hbetaFirst.1 (Or.inr d.betaMissingTerminal) + sameGammaBeta + let z : Sum V E := Sum.inl (T.vertex (Fin.last T.length)) + let mu2 := TwoColorComponentSwap G sigma gamma beta z + have hmu2Proper : IsProperEdgeColoring G mu2 := by + exact TwoColorComponentSwapProper G sigma gamma beta hgammaNeBeta + R.minimumContext.proper z + have hmu2One : IsOneEdgeUncolored mu2 e0 := by + exact helper_hmu2One_1069 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@gamma) + have hfirstGammaOutside : Sum.inl + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) ∉ + TwoColorComponent G sigma gamma beta z := by + intro hv + exact (Set.disjoint_left.mp hterminalDisjoint) hv + (componentSelf sigma gamma beta + (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) + have hfirstBetaOutside : Sum.inl + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∉ + TwoColorComponent G sigma gamma beta z := by + exact helper_hfirstBetaOutside_1094 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@sameGammaBeta) (@componentSelf) + (@hterminalDisjoint) + have hswapBehavior := TwoColorComponentSwapMissingBehavior G sigma gamma beta + hgammaNeBeta R.minimumContext.proper z + have hgammaFirstMu2 : gamma ∈ MissingColors G mu2 + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) := by + rw [(hswapBehavior.1 _ hfirstGammaOutside)] + exact hgammaFirst.1 + have hbetaFirstMu2 : beta ∈ MissingColors G mu2 + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) := by + rw [(hswapBehavior.1 _ hfirstBetaOutside)] + exact hbetaFirst.1 + have hgammaTerminalMu2 : gamma ∈ MissingColors G mu2 + (T.vertex (Fin.last T.length)) := by + exact hswapBehavior.2.2.1 _ (componentSelf sigma gamma beta + (T.vertex (Fin.last T.length))) d.betaMissingTerminal + have hfixedThroughY : ∀ t : Fin T.length, A.length ≤ t.val → + t.val < A.length + j → mu2 (T.edge t) = sigma (T.edge t) := by + exact helper_hfixedThroughY_1119 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hbetaTail) (@gamma) (@hgammaBeta) + have prefixMissing (W : TreeSequence G e0) (z : Sum V E) (rho : PartialEdgeColoring E k) (a b : + Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) + (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet W)) + (u v : V) (huB : u ∈ TreeSequenceVertexSet W) (hvB : v ∈ TreeSequenceVertexSet W) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hdu : Sum.inl u ∉ TwoColorComponent G rho a b z) + (hdv : Sum.inl v ∉ TwoColorComponent G rho a b z) : + ∀ w ∈ TreeSequenceVertexSet W, + MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by + exact helper_prefixMissing_770 G k e0 input T phi ett base C ctx P alpha beta d W z rho a b + hne hp helem u v huB hvB hu hv + hdu hdv + have firstPreserved (W : TreeSequence G e0) + (hWT : TreeSequenceInitialSegment W T) (rho sigma : PartialEdgeColoring E k) (c : Fin k) + (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet W)) + (hmiss : ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) + (hc : c ∈ TreeMissingColors rho W) : + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + exact helper_firstPreserved_1154 (@G) (@k) (@e0) (@T) (@j) (@firstWitness) (@W) (@hWT) (@rho) + (@sigma) (@c) (@helem) (@hmiss) (@hc) + have firstUnaffected (z : Sum V E) (rho : PartialEdgeColoring E k) (a b c : Fin k) + (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (hca : c ≠ a) (hcb : c ≠ b) : + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c := by + exact helper_firstUnaffected_1179 (@G) (@k) (@e0) (@T) (@z) (@rho) (@a) (@b) (@c) (@hne) + (@hp) (@hca) (@hcb) + have hmissingMu2 : ∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G mu2 v = MissingColors G sigma v := by + exact helper_hmissingMu2_1194 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@j) (@gamma) (@hgammaNeBeta) (@hZtoT) (@hElemZ) (@hgammaFirst) + (@hbetaFirst) (@hgammaFirstLe) (@hbetaFirstLe) (@vertexMemT) (@hAtoZ) (@hBtoZ) + (@hfirstGammaOutside) (@hfirstBetaOutside) (@prefixMissing) + have missingTransport (old new : PartialEdgeColoring E k) + (hm : ∀ v ∈ TreeSequenceVertexSet Z, + MissingColors G new v = MissingColors G old v) + (W : TreeSequence G e0) (hWZ : TreeSequenceInitialSegment W Z) : + TreeMissingColors new W = TreeMissingColors old W := by + exact helper_missingTransport_1207 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@old) (@new) + (@hm) (@W) (@hWZ) + exact @helper_continuation_3933 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) (@hbetaStored) + (@hbetaB) (@hbetaTail) (@hthetaMissingY) (@gamma) (@hgammaBeta) (@hgammaA) (@hgammaNeBeta) + (@hthetaUnstored') (@sameStar) (@hAtoT) (@htail) (@hcutJstrict) (@fullPrefixEq) + (@commonPrefix) (@hYlen) (@hBtoT) (@hYtoT) (@hBtoX) (@hXtoY) (@hYtoZ) (@hZtoT) (@hAtoY) + (@penultimatePrefixEq) (@hElemZ) (@firstWitness) (@hgammaFirst) (@hgammaFirstLe) + (@hbetaFirstLe) (@vertexMemT) (@vertexMemSelf) (@hthetaY) (@hthetaFirst) + (@hthetaFirstIndex) (@hthetaOutsideGamma) (@hgammaNeTheta) (@hAtoZ) (@treeMissingSubset) + (@hgammaMissingZ) (@hbetaMissingZ) (@hchangeElementary) (@hchangeMissing) (@componentSelf) + (@componentLeaf) (@separateComponents) (@hgammaTerminalDistinct) (@hterminalDisjoint) + (@hmu2One) (@hgammaFirstMu2) (@hgammaTerminalMu2) (@hfixedThroughY) (@prefixMissing) + (@firstPreserved) (@firstUnaffected) (@hmissingMu2) (@missingTransport) +private theorem helper_continuation_2578.{u_1, u_2} : + helperContinuation2578Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hvertexMissing d j hj + hpathLower hpathUpper R sigma H q A ell X B Y Z D hbetaStored hbetaB hbetaTail + hthetaMissingY gamma hgammaBeta hgammaA hgammaNeBeta hthetaUnstored' sameStar hAtoT htail + hcutJstrict fullPrefixEq commonPrefix hYlen hBtoT hYtoT hBtoX hXtoY hYtoZ hZtoT hAtoY + penultimatePrefixEq hElemZ firstWitness hgammaFirst hbetaFirst hgammaFirstLe hbetaFirstLe + vertexMemT + have vertexMemSelf (W : TreeSequence G e0) (i : Fin (W.length + 1)) : + W.vertex i ∈ TreeSequenceVertexSet W := by + as_aux_lemma => + clear * - W i + simp [TreeSequenceVertexSet] + have treeMissingIntro (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) + (v : V) (c : Fin k) (hv : v ∈ TreeSequenceVertexSet W) + (hc : c ∈ MissingColors G rho v) : c ∈ TreeMissingColors rho W := by + as_aux_lemma => + clear * - rho W v c hv hc + exact Finset.mem_biUnion.mpr ⟨v, hv, hc⟩ + have hthetaY : d.theta ∈ TreeMissingColors sigma Y := by + exact helper_hthetaY_789 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hthetaMissingY) (@vertexMemSelf) (@treeMissingIntro) + have hthetaFirst : d.theta ∈ MissingColors G sigma + (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) ∧ + (HierarchyFirstMissingPosition sigma T d.theta).val ≤ Y.length := by + as_aux_lemma => + clear * - G T sigma Y d hYtoT hthetaY firstWitness + clear_value Y + exact firstWitness sigma Y hYtoT d.theta hthetaY + have hthetaFirstIndex := + helper_hthetaFirstIndex_397 G k e0 input T phi ett base C ctx P alpha beta d j hthetaMissingY + hYtoT hYtoZ hZtoT hElemZ + vertexMemT hthetaFirst + have hthetaOutsideGamma : d.theta ∉ D.biUnion (R.counterexample.good.gamma q) := by + simpa [R, H, q, D] using d.thetaOutsideGamma + have hgammaInGammaUnion : gamma ∈ D.biUnion (R.counterexample.good.gamma q) := + Finset.mem_biUnion.mpr ⟨beta, hbetaStored, hgammaBeta⟩ + have hgammaNeTheta : gamma ≠ d.theta := by + intro heq + exact hthetaOutsideGamma (heq ▸ hgammaInGammaUnion) + have hbetaNotA : beta ∉ TreeMissingColors sigma A := + (Finset.mem_sdiff.mp hbetaStored).2 + have hbetaAfterA : A.length < (HierarchyFirstMissingPosition sigma T beta).val := by + exact helper_hbetaAfterA_813 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@j) (@hAtoT) (@hbetaFirst) (@vertexMemT) (@treeMissingIntro) + (@hbetaNotA) + have hgammaBeforeBeta : + (HierarchyFirstMissingPosition sigma T gamma).val < + (HierarchyFirstMissingPosition sigma T beta).val := + lt_of_le_of_lt hgammaFirstLe hbetaAfterA + have horderGammaBeta : TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) := + ⟨HierarchyFirstMissingPosition sigma T gamma, + HierarchyFirstMissingPosition sigma T beta, rfl, rfl, hgammaBeforeBeta⟩ + have hBcutoff : B.length ≤ A.length + j := by + change (HierarchyFullTailPrefix C (j - 2)).length ≤ A.length + j + rw [fullPrefixEq] + simp only [TreeSequencePrefix] + exact le_trans (min_le_left _ _) (Nat.add_le_add_left (Nat.sub_le j 2) _) + have hgammaUnusedBeforeBeta : + gamma ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition sigma T beta).val ∧ + sigma (T.edge t) = some c) := by + exact helper_hgammaUnusedBeforeBeta_834 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hbetaTail) (@gamma) (@hgammaBeta) + (@hbetaFirstLe) (@hBcutoff) + have horderedUnusedGammaBeta : + (gamma ∉ TreeMissingColors sigma A ∨ beta ∉ TreeMissingColors sigma A) → + TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ + gamma ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + A.length ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition sigma T beta).val ∧ + sigma (T.edge t) = some c) := by + intro _ + exact ⟨horderGammaBeta, hgammaUnusedBeforeBeta⟩ + have hAtoZ : TreeSequenceInitialSegment A Z := + commonPrefix hAtoT hZtoT (hAtoY.1.trans hYtoZ.1) + have hBtoZ : TreeSequenceInitialSegment B Z := + commonPrefix hBtoT hZtoT (hBtoX.1.trans (hXtoY.1.trans hYtoZ.1)) + have treeMissingSubset {U W : TreeSequence G e0} + (hUW : TreeSequenceInitialSegment U W) : + TreeMissingColors sigma U ⊆ TreeMissingColors sigma W := by + exact @helper_treeMissingSubset_868 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@U) (@W) (@hUW) + have hgammaMissingZ : gamma ∈ TreeMissingColors sigma Z := + treeMissingSubset hAtoZ hgammaA + have hbetaMissingZ : beta ∈ TreeMissingColors sigma Z := + treeMissingSubset hBtoZ hbetaB + have htailSame : HierarchyFullTailLength R.counterexample = ell := by + change T.length - A.length = + T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + rw [← sameStar] + have hEll : ell = T.length - A.length := by + simp [ell, HierarchyFullTailLength, sameStar] + have hstarR : HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = A := rfl + have hchangeElementary : + ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := by + rw [penultimatePrefixEq] + exact hElemZ + have hchangeMissing : gamma ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1)) ∧ + beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1)) := by + rw [penultimatePrefixEq] + exact ⟨hgammaMissingZ, hbetaMissingZ⟩ + have firstChange := by + exact helper_firstChange_904 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaNeBeta) (@sameStar) (@hbetaNotA) + (@horderedUnusedGammaBeta) (@hchangeElementary) (@hchangeMissing) + have hgammaStageMissing : gamma ∈ HierarchyStageMissingColors H q := + (Finset.mem_sdiff.mp + (R.counterexample.good.avoidance q beta hbetaStored hgammaBeta)).1 + have hApositive (hq : 0 < H.dividerCount) : + A = H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ := by + exact helper_hApositive_927 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@hq) + have sameGammaBeta : + TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) = + TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) := by + exact helper_sameGammaBeta_943 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaA) (@firstChange) + (@hgammaStageMissing) (@hApositive) + have componentSelf (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := by + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl v) = _ + rfl + have componentLeaf (rho : PartialEdgeColoring E k) (a b : Fin k) + (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (v : V) + (hm : a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v) : + Set.Subsingleton + ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)) := by + exact helper_componentLeaf_969 (@G) (@k) (@rho) (@a) (@b) (@hne) (@hp) (@v) (@hm) + have separateComponents (rho : PartialEdgeColoring E k) (a b : Fin k) + (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (u v w : V) + (huv : u ≠ v) (huw : u ≠ w) (hvw : v ≠ w) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hw : a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w) + (hsame : TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v)) : + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + exact helper_separateComponents_991 (@G) (@k) (@componentSelf) (@componentLeaf) (@rho) (@a) + (@b) (@hne) (@hp) + (@u) (@v) (@w) (@huv) (@huw) (@hvw) (@hu) (@hv) (@hw) (@hsame) + have hBlt : B.length < T.length := by + exact helper_hBlt_1027 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@fullPrefixEq) + have hindicesDistinct : + T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ + T.vertex (HierarchyFirstMissingPosition sigma T beta) := by + intro he + have hi := T.vertex_injective he + have hv := congrArg Fin.val hi + exact (ne_of_lt hgammaBeforeBeta) hv + have hgammaTerminalDistinct : + T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ + T.vertex (Fin.last T.length) := by + exact helper_hgammaTerminalDistinct_1040 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@gamma) (@hcutJstrict) (@hgammaFirstLe) + exact @helper_continuation_2662 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) (@hbetaStored) + (@hbetaB) (@hbetaTail) (@hthetaMissingY) (@gamma) (@hgammaBeta) (@hgammaA) (@hgammaNeBeta) + (@hthetaUnstored') (@sameStar) (@hAtoT) (@htail) (@hcutJstrict) (@fullPrefixEq) + (@commonPrefix) (@hYlen) (@hBtoT) (@hYtoT) (@hBtoX) (@hXtoY) (@hYtoZ) (@hZtoT) (@hAtoY) + (@penultimatePrefixEq) (@hElemZ) (@firstWitness) (@hgammaFirst) (@hbetaFirst) + (@hgammaFirstLe) (@hbetaFirstLe) (@vertexMemT) (@vertexMemSelf) (@hthetaY) (@hthetaFirst) + (@hthetaFirstIndex) (@hthetaOutsideGamma) (@hgammaNeTheta) (@hAtoZ) (@hBtoZ) + (@treeMissingSubset) (@hgammaMissingZ) (@hbetaMissingZ) (@hchangeElementary) + (@hchangeMissing) (@sameGammaBeta) (@componentSelf) (@componentLeaf) (@separateComponents) + (@hBlt) (@hindicesDistinct) (@hgammaTerminalDistinct) +theorem HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha beta : Fin k) + (hpathLower : 2 <= HierarchyPathNumber C.hierarchy) + (hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (hvertexMissing : forall (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu -> IsOneEdgeUncolored mu e0 -> + forall v : V, (MissingColors G mu v).Nonempty) + (d : HierarchySituationThreeDisjointData + G k e0 input T phi ett base C ctx P alpha beta) + (hthetaUnstored : + let H := d.switched.counterexample.hierarchy + d.theta ∉ HierarchyStoredColorsAt H (Fin.last H.dividerCount : Fin (H.dividerCount + 1))) + (hconditionStored : + let H := d.switched.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + beta ∈ HierarchyStoredColorsAt H q ∧ + beta ∈ + TreeMissingColors d.switched.coloring + (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 2)) ∧ + Disjoint (d.switched.counterexample.good.gamma q beta ∪ { beta }) + ((Finset.univ : Finset (Fin k)).filter fun c => + exists r : Fin T.length, + (HierarchyStarredStage H q).length ≤ r.val ∧ + r.val < + (HierarchyStarredStage H q).length + HierarchyPathNumber C.hierarchy ∧ + d.switched.coloring (T.edge r) = some c)) : False := by + as_aux_lemma => + classical + generalize hj : HierarchyPathNumber C.hierarchy = j at hpathLower hpathUpper hconditionStored + let R := d.switched + let sigma := R.coloring + let H := R.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength C + let X := HierarchyFullTailPrefix C (j - 1) + let B := HierarchyFullTailPrefix C (j - 2) + let Y := HierarchyFullTailPrefix C j + let Z := HierarchyFullTailPrefix C (ell - 1) + let D := HierarchyStoredColorsAt H q + have hcondition : beta ∈ D ∧ beta ∈ TreeMissingColors sigma B ∧ + Disjoint (R.counterexample.good.gamma q beta ∪ {beta}) + ((Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, A.length ≤ r.val ∧ r.val < A.length + j ∧ + sigma (T.edge r) = some c) := by + simpa [R, sigma, H, q, A, B, D, hj] using hconditionStored + rcases hcondition with ⟨hbetaStored, hbetaB, hbetaTail⟩ + have hthetaMissingY : d.theta ∈ MissingColors G sigma + (Y.vertex (Fin.last Y.length)) := by + exact helper_hthetaMissingY_553 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hj) + obtain ⟨gamma, gamma₂, hgammaNe₂, hgammaPair⟩ := + Finset.card_eq_two.mp (R.counterexample.good.twoColors q beta hbetaStored) + have hgammaBeta : gamma ∈ R.counterexample.good.gamma q beta := by + rw [hgammaPair] + simp + have hgammaA : gamma ∈ TreeMissingColors sigma A := + (GoodHierarchyReservedDisjoint R.counterexample.good q).1 beta hbetaStored + hgammaBeta + have hgammaNeBeta : gamma ≠ beta := by + exact helper_hgammaNeBeta_569 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@hbetaStored) (@gamma) (@hgammaA) + have hthetaUnstored' : d.theta ∉ D := by + simpa [R, H, q, D] using hthetaUnstored + have sameStar : HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A := by + exact helper_sameStar_577 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@j) + have starNext (i : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H i) (H.stage i.succ) := + Fin.cases H.coreInsideFirst (fun t => H.nested t.succ) i + have hAtoT : TreeSequenceInitialSegment A T := by + simpa only [q, Fin.succ_last, H.terminalStage] using starNext q + have htail : j ≤ T.length - A.length := by + have h := hpathUpper + simpa [ell, HierarchyFullTailLength, sameStar] using Nat.le_of_lt h + have hjLower : 2 ≤ j := hpathLower + have hjUpper : j < ell := hpathUpper + have hcutJ : A.length + j ≤ T.length := by + have hAT := hAtoT.1 + clear * - htail hAT + clear_value A + omega + have hcutJstrict : A.length + j < T.length := by + exact helper_hcutJstrict_610 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hj) (@sameStar) (@hAtoT) (@hjUpper) + have fullPrefixEq (m : ℕ) : HierarchyFullTailPrefix C m = + TreeSequencePrefix T (min (A.length + m) T.length) + (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (Nat.min_le_right _ _) := by + unfold HierarchyFullTailPrefix + simp only [sameStar] + have prefixToTree (m : ℕ) (hm : 1 ≤ m) (hmT : m ≤ T.length) : + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T := by + exact helper_prefixToTree_623 (@G) (@e0) (@T) (@m) (@hm) (@hmT) + have commonPrefix {U W : TreeSequence G e0} + (hUT : TreeSequenceInitialSegment U T) + (hWT : TreeSequenceInitialSegment W T) (hUW : U.length ≤ W.length) : + TreeSequenceInitialSegment U W := by + exact helper_commonPrefix_632 (@G) (@e0) (@T) (@hUT) (@hWT) (@hUW) + have hYlen : Y.length = A.length + j := by + change (HierarchyFullTailPrefix C j).length = A.length + j + rw [fullPrefixEq j] + simp only [TreeSequencePrefix, min_eq_left hcutJ] + have hBtoT : TreeSequenceInitialSegment B T := by + change TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - 2)) T + rw [fullPrefixEq] + exact prefixToTree _ (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (min_le_right _ _) + have hXtoT : TreeSequenceInitialSegment X T := by + change TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - 1)) T + rw [fullPrefixEq] + exact prefixToTree _ (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (min_le_right _ _) + have hYtoT : TreeSequenceInitialSegment Y T := by + change TreeSequenceInitialSegment (HierarchyFullTailPrefix C j) T + rw [fullPrefixEq] + exact prefixToTree _ (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (min_le_right _ _) + have hBtoX : TreeSequenceInitialSegment B X := + commonPrefix hBtoT hXtoT (by + change (HierarchyFullTailPrefix C (j - 2)).length ≤ + (HierarchyFullTailPrefix C (j - 1)).length + rw [fullPrefixEq (j - 2), fullPrefixEq (j - 1)] + simp only [TreeSequencePrefix] + exact min_le_min_right _ (Nat.add_le_add_left (Nat.sub_le_sub_left (by decide) j) _)) + have hXtoY : TreeSequenceInitialSegment X Y := + commonPrefix hXtoT hYtoT (by + change (HierarchyFullTailPrefix C (j - 1)).length ≤ + (HierarchyFullTailPrefix C j).length + rw [fullPrefixEq (j - 1), fullPrefixEq j] + simp only [TreeSequencePrefix] + exact min_le_min_right _ (Nat.add_le_add_left (Nat.sub_le j 1) _)) + have hYtoZ : TreeSequenceInitialSegment Y Z := + commonPrefix hYtoT (by + change TreeSequenceInitialSegment (HierarchyFullTailPrefix C (ell - 1)) T + rw [fullPrefixEq] + exact prefixToTree _ (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (min_le_right _ _)) + (by + change (HierarchyFullTailPrefix C j).length ≤ + (HierarchyFullTailPrefix C (ell - 1)).length + rw [fullPrefixEq j, fullPrefixEq (ell - 1)] + simp only [TreeSequencePrefix] + exact min_le_min_right _ (Nat.add_le_add_left (Nat.le_sub_one_of_lt hjUpper) _)) + have hZtoT : TreeSequenceInitialSegment Z T := by + change TreeSequenceInitialSegment (HierarchyFullTailPrefix C (ell - 1)) T + rw [fullPrefixEq] + exact prefixToTree _ (le_min (A.positive.trans (Nat.le_add_right _ _)) T.positive) + (min_le_right _ _) + have hAtoY : TreeSequenceInitialSegment A Y := + commonPrefix hAtoT hYtoT (by rw [hYlen]; exact Nat.le_add_right _ _) + have hAtoB : TreeSequenceInitialSegment A B := + commonPrefix hAtoT hBtoT (by + change A.length ≤ (HierarchyFullTailPrefix C (j - 2)).length + rw [fullPrefixEq] + simp only [TreeSequencePrefix] + exact le_min (Nat.le_add_right _ _) hAtoT.1) + have penultimatePrefixEq : HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1) = Z := by + simp only [Z, ell, HierarchyFullTailPrefix, HierarchyFullTailLength, sameStar] + rfl + have hElemZ : ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) := by + exact helper_hElemZ_717 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@penultimatePrefixEq) + have firstWitness (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) + (hWT : TreeSequenceInitialSegment W T) (c : Fin k) + (hc : c ∈ TreeMissingColors rho W) : + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (HierarchyFirstMissingPosition rho T c).val ≤ W.length := by + exact helper_firstWitness_734 (@G) (@k) (@e0) (@T) (@rho) (@W) (@hWT) (@c) (@hc) + have hgammaFirst := firstWitness sigma A hAtoT gamma hgammaA + have hbetaFirst := firstWitness sigma B hBtoT beta hbetaB + have hgammaFirstLe : (HierarchyFirstMissingPosition sigma T gamma).val ≤ A.length := + hgammaFirst.2 + have hbetaFirstLe : (HierarchyFirstMissingPosition sigma T beta).val ≤ B.length := + hbetaFirst.2 + have vertexMemT (W : TreeSequence G e0) (hWT : TreeSequenceInitialSegment W T) + (i : Fin (T.length + 1)) (hi : i.val ≤ W.length) : + T.vertex i ∈ TreeSequenceVertexSet W := by + exact helper_vertexMemT_768 (@G) (@e0) (@T) (@W) (@hWT) (@i) (@hi) + exact @helper_continuation_2578 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) + (@hbetaStored) (@hbetaB) (@hbetaTail) (@hthetaMissingY) (@gamma) (@hgammaBeta) (@hgammaA) + (@hgammaNeBeta) (@hthetaUnstored') (@sameStar) (@hAtoT) (@htail) (@hcutJstrict) + (@fullPrefixEq) (@commonPrefix) (@hYlen) (@hBtoT) (@hYtoT) (@hBtoX) (@hXtoY) (@hYtoZ) + (@hZtoT) (@hAtoY) (@penultimatePrefixEq) (@hElemZ) (@firstWitness) (@hgammaFirst) + (@hbetaFirst) (@hgammaFirstLe) (@hbetaFirstLe) (@vertexMemT) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible.lean new file mode 100644 index 0000000000..8acbb4846a --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible.lean @@ -0,0 +1,1596 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData +public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChangeCaseThree +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Hierarchy Situation Three Disjoint Theta Unstored Outside Impossible + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation286Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (beta : Fin k), (2 : + ℕ) ≤ HierarchyPathNumber C.hierarchy → HierarchyPathNumber C.hierarchy < + HierarchyFullTailLength C → ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (R.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := (TreeSequenceVertexSet R.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G R.coloring v; + let tailUsedThroughJ : Finset (Fin k) := ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ R.coloring (T.edge r) = + some c} : Finset (Fin k)); beta ∉ baseExtraMissing ∧ beta ∉ tailUsedThroughJ ∧ beta ∉ + Gamma ∧ beta ∉ D) → beta ∈ TreeMissingColors R.coloring (HierarchyFullTailPrefix C + (HierarchyPathNumber C.hierarchy - (2 : ℕ))) → beta ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length)) → ( + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + TashkinovAugmentationSequence R.coloring X T) → + ∀ (theta : Fin k), ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; theta ∉ + HierarchyStoredColorsAt H q) → ( + let j : ℕ := HierarchyPathNumber C.hierarchy; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; theta ∈ MissingColors G R.coloring + (Y.vertex (Fin.last Y.length))) → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (R.counterexample.good.gamma q); theta ∉ Gamma) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → + ∀ (B : Finset V), ColoredVertexSetElementary G psi B → + ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ + MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) → ( + ∀ (psi : PartialEdgeColoring E k) (U : TreeSequence G e0) (i : Fin (U.length + (1 : ℕ))), + ∀ c ∈ MissingColors G psi (U.vertex i), c ∈ MissingColors G psi (U.vertex + (HierarchyFirstMissingPosition psi U c)) ∧ (↑(HierarchyFirstMissingPosition psi U c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let _ : TreeSequence G e0 := HierarchyStarredStage H q; False + +private abbrev helperContinuation344Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (beta : Fin k) + (hpathLower : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy), HierarchyPathNumber C.hierarchy + < HierarchyFullTailLength C → ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (R.counterexample.good.gamma q); + let baseExtraMissing : Finset (Fin k) := (TreeSequenceVertexSet R.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ MissingColors G R.coloring v; + let tailUsedThroughJ : Finset (Fin k) := ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ R.coloring (T.edge r) = + some c} : Finset (Fin k)); beta ∉ baseExtraMissing ∧ beta ∉ tailUsedThroughJ ∧ beta ∉ + Gamma ∧ beta ∉ D) → beta ∈ TreeMissingColors R.coloring (HierarchyFullTailPrefix C + (HierarchyPathNumber C.hierarchy - (2 : ℕ))) → beta ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length)) → ( + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + TashkinovAugmentationSequence R.coloring X T) → + ∀ (theta : Fin k), ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; theta ∉ + HierarchyStoredColorsAt H q) → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (R.counterexample.good.gamma q); theta ∉ Gamma) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → + ∀ (B : Finset V), ColoredVertexSetElementary G psi B → + ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ + MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) → ( + ∀ (psi : PartialEdgeColoring E k) (U : TreeSequence G e0) (i : Fin (U.length + (1 : ℕ))), + ∀ c ∈ MissingColors G psi (U.vertex i), c ∈ MissingColors G psi (U.vertex + (HierarchyFirstMissingPosition psi U c)) ∧ (↑(HierarchyFirstMissingPosition psi U c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let ell : ℕ := HierarchyFullTailLength R.counterexample; + ∀ (Y : TreeSequence G e0), HierarchyFullTailPrefix C j = Y → + let Z : TreeSequence G e0 := HierarchyFullTailPrefix R.counterexample (ell - (1 : ℕ)); + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A → TreeSequenceInitialSegment A T → + HierarchyFullTailLength C = ell → ell = T.length - A.length → j < ell → + ∀ (hstrict : A.length + j < T.length), Z.length = T.length - (1 : ℕ) → + ∀ (hYlen : Y.length = A.length + j), TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment Z T → + ∀ (YR : TreeSequence G e0), TreeSequencePrefix T (min (A.length + j) T.length) ( + have hApos : (1 : ℕ) ≤ A.length := A.positive; + have hTpos : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + j) T.length) ↦ + by omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) = YR → YR.length = A.length + j → TreeSequenceInitialSegment YR T → YR.vertex (Fin.last + YR.length) = Y.vertex (Fin.last Y.length) → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U W + → S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment Y Z → + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet Z) → ( + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), S.vertex i ∈ TreeSequenceVertexSet + S) → theta ∈ MissingColors G R.coloring (Y.vertex (Fin.last Y.length)) → theta ∈ + MissingColors G R.coloring (YR.vertex (Fin.last YR.length)) → theta ∉ TreeMissingColors + R.coloring A → False + +private abbrev helperContinuation460Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (beta : Fin k), (2 : + ℕ) ≤ HierarchyPathNumber C.hierarchy → HierarchyPathNumber C.hierarchy < + HierarchyFullTailLength C → ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), beta ∈ + MissingColors G R.coloring (T.vertex (Fin.last T.length)) → ( + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + TashkinovAugmentationSequence R.coloring X T) → + ∀ (theta : Fin k), ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; theta ∉ + HierarchyStoredColorsAt H q) → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (R.counterexample.good.gamma q); theta ∉ Gamma) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → + ∀ (B : Finset V), ColoredVertexSetElementary G psi B → + ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ + MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) → ( + ∀ (psi : PartialEdgeColoring E k) (U : TreeSequence G e0) (i : Fin (U.length + (1 : ℕ))), + ∀ c ∈ MissingColors G psi (U.vertex i), c ∈ MissingColors G psi (U.vertex + (HierarchyFirstMissingPosition psi U c)) ∧ (↑(HierarchyFirstMissingPosition psi U c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let ell : ℕ := HierarchyFullTailLength R.counterexample; + ∀ (Y : TreeSequence G e0), HierarchyFullTailPrefix C j = Y → + let Z : TreeSequence G e0 := HierarchyFullTailPrefix R.counterexample (ell - (1 : ℕ)); + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let _ : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A → TreeSequenceInitialSegment A T → + HierarchyFullTailLength C = ell → ell = T.length - A.length → A.length + j < T.length → + Z.length = T.length - (1 : ℕ) → Y.length = A.length + j → TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment Z T → + ∀ (YR : TreeSequence G e0), YR.length = A.length + j → TreeSequenceInitialSegment YR T → + YR.vertex (Fin.last YR.length) = Y.vertex (Fin.last Y.length) → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U W + → S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment Y Z → + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet Z) → ( + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), S.vertex i ∈ TreeSequenceVertexSet + S) → theta ∈ MissingColors G R.coloring (Y.vertex (Fin.last Y.length)) → theta ∈ + MissingColors G R.coloring (YR.vertex (Fin.last YR.length)) → theta ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data n → ( + ∀ (r : Fin T.length), A.length ≤ (↑r : ℕ) → (↑r : ℕ) < A.length + j → R.coloring (T.edge r) ≠ + some theta) → beta ∉ D ∧ beta ∉ ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ R.coloring (T.edge r) = + some c} : Finset (Fin k)) ∧ beta ∉ D.biUnion (R.counterexample.good.gamma q) → + (H.dividerCount = (0 : ℕ) → beta ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data n) → ( + ∀ (r : Fin T.length), A.length ≤ (↑r : ℕ) → (↑r : ℕ) < A.length + j → R.coloring (T.edge r) ≠ + some beta) → + ∀ (B : TreeSequence G e0), B.length = A.length + (j - (2 : ℕ)) → TreeSequenceInitialSegment B + T → TreeSequenceInitialSegment B Z → TreeSequenceInitialSegment YR Z → beta ∈ + TreeMissingColors R.coloring B → beta ∈ TreeMissingColors R.coloring Z → theta ∈ + TreeMissingColors R.coloring Z → beta ≠ theta → False + +private abbrev helperContinuation783Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (beta : Fin k), (2 : + ℕ) ≤ HierarchyPathNumber C.hierarchy → HierarchyPathNumber C.hierarchy < + HierarchyFullTailLength C → ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + TashkinovAugmentationSequence R.coloring X T) → + ∀ (theta : Fin k), ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; theta ∉ + HierarchyStoredColorsAt H q) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let ell : ℕ := HierarchyFullTailLength R.counterexample; + ∀ (Y : TreeSequence G e0), HierarchyFullTailPrefix C j = Y → + let Z : TreeSequence G e0 := HierarchyFullTailPrefix R.counterexample (ell - (1 : ℕ)); + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; TreeSequenceInitialSegment A T → + HierarchyFullTailLength C = ell → ell = T.length - A.length → Y.length = A.length + j → + TreeSequenceInitialSegment Y T → + ∀ (YR : TreeSequence G e0), YR.length = A.length + j → + ∀ (hYRT : TreeSequenceInitialSegment YR T), ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U W + → S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment Y Z → + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet Z) → theta ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data n → beta ∉ D ∧ beta ∉ ({c + : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ R.coloring (T.edge r) = + some c} : Finset (Fin k)) ∧ beta ∉ D.biUnion (R.counterexample.good.gamma q) → + (H.dividerCount = (0 : ℕ) → beta ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data n) → ( + ∀ (r : Fin T.length), A.length ≤ (↑r : ℕ) → (↑r : ℕ) < A.length + j → R.coloring (T.edge r) ≠ + some beta) → + ∀ (B : TreeSequence G e0), B.length = A.length + (j - (2 : ℕ)) → beta ∈ TreeMissingColors + R.coloring Z → theta ∈ TreeMissingColors R.coloring Z → beta ≠ theta → + let Xfull : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); Xfull.length = + A.length + (j - (1 : ℕ)) → TreeSequenceInitialSegment Xfull Z → ( + ∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ S.length → T.vertex i ∈ TreeSequenceVertexSet S) + → (↑(HierarchyFirstMissingPosition R.coloring T theta) : ℕ) = YR.length → TreeVertexOrder + T (T.vertex (HierarchyFirstMissingPosition R.coloring T beta)) (T.vertex + (HierarchyFirstMissingPosition R.coloring T theta)) → HierarchyFirstMissingPosition + R.coloring T theta = Fin.castLE (Nat.succ_le_succ hYRT.1) (Fin.last YR.length) → + let vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T beta); + let vj : V := Y.vertex (Fin.last Y.length); + let vl : V := T.vertex (Fin.last T.length); beta ∈ MissingColors G R.coloring vb → Disjoint + (TwoColorComponent G R.coloring beta theta (Sum.inl vl)) (TwoColorComponent G R.coloring + beta theta (Sum.inl vb)) → TwoColorPathComponent G R.coloring beta theta (Sum.inl vl) → ( + ∀ x ∈ TreeSequenceVertexSet Z, MissingColors G (TwoColorComponentSwap G R.coloring beta theta + (Sum.inl vl)) x = MissingColors G R.coloring x) → + let tau : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring beta theta (Sum.inl + vl); IsOneEdgeUncolored tau e0 → theta ∈ MissingColors G tau vl → theta ∈ MissingColors G + tau vj → ¬ColoredVertexSetElementary G tau (TreeSequenceVertexSet T) → + TreeSequenceInitialSegment A Y → A.length < Y.length → TreeSequenceInitialSegment Xfull Y + → Y.length = Xfull.length + (1 : ℕ) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → tau (T.edge t) = R.coloring + (T.edge t)) → beta ∈ TreeMissingColors tau Y ∧ theta ∈ TreeMissingColors tau Y → ( + ∀ eta ∈ D, HierarchyFirstMissingPosition tau T eta = HierarchyFirstMissingPosition R.coloring + T eta) → ( + ∀ eta ∈ D, beta ∈ R.counterexample.good.gamma q eta ∨ theta ∈ R.counterexample.good.gamma q + eta → (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ Y.length) → ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) → (H.dividerCount ≠ (0 : ℕ) → A = H.stage + (⟨H.dividerCount, + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → False + +private abbrev helperContinuation590Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (beta : Fin k), (2 : + ℕ) ≤ HierarchyPathNumber C.hierarchy → HierarchyPathNumber C.hierarchy < + HierarchyFullTailLength C → ( + ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ (v : V), (MissingColors G mu v).Nonempty) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), beta ∈ + MissingColors G R.coloring (T.vertex (Fin.last T.length)) → ( + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + TashkinovAugmentationSequence R.coloring X T) → + ∀ (theta : Fin k), ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; theta ∉ + HierarchyStoredColorsAt H q) → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (R.counterexample.good.gamma q); theta ∉ Gamma) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → + ∀ (B : Finset V), ColoredVertexSetElementary G psi B → + ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ + MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let ell : ℕ := HierarchyFullTailLength R.counterexample; + ∀ (Y : TreeSequence G e0), HierarchyFullTailPrefix C j = Y → + let Z : TreeSequence G e0 := HierarchyFullTailPrefix R.counterexample (ell - (1 : ℕ)); + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let _ : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; TreeSequenceInitialSegment A T → + HierarchyFullTailLength C = ell → ell = T.length - A.length → Z.length = T.length - (1 : + ℕ) → Y.length = A.length + j → TreeSequenceInitialSegment Y T → TreeSequenceInitialSegment + Z T → + ∀ (YR : TreeSequence G e0), YR.length = A.length + j → + ∀ (hYRT : TreeSequenceInitialSegment YR T), ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U W + → S.length ≤ U.length → TreeSequenceInitialSegment S U) → TreeSequenceInitialSegment Y Z → + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet Z) → ( + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), S.vertex i ∈ TreeSequenceVertexSet + S) → theta ∈ MissingColors G R.coloring (Y.vertex (Fin.last Y.length)) → theta ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data n → ( + ∀ (r : Fin T.length), A.length ≤ (↑r : ℕ) → (↑r : ℕ) < A.length + j → R.coloring (T.edge r) ≠ + some theta) → beta ∉ D ∧ beta ∉ ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + j ∧ R.coloring (T.edge r) = + some c} : Finset (Fin k)) ∧ beta ∉ D.biUnion (R.counterexample.good.gamma q) → + (H.dividerCount = (0 : ℕ) → beta ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data n) → ( + ∀ (r : Fin T.length), A.length ≤ (↑r : ℕ) → (↑r : ℕ) < A.length + j → R.coloring (T.edge r) ≠ + some beta) → + ∀ (B : TreeSequence G e0), B.length = A.length + (j - (2 : ℕ)) → TreeSequenceInitialSegment B + T → TreeSequenceInitialSegment B Z → beta ∈ TreeMissingColors R.coloring Z → theta ∈ + TreeMissingColors R.coloring Z → beta ≠ theta → + let Xfull : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); Xfull.length = + A.length + (j - (1 : ℕ)) → TreeSequenceInitialSegment Xfull T → TreeSequenceInitialSegment + Xfull Z → ( + ∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ S.length → T.vertex i ∈ TreeSequenceVertexSet S) + → beta ∈ MissingColors G R.coloring (T.vertex (HierarchyFirstMissingPosition R.coloring T + beta)) ∧ (↑(HierarchyFirstMissingPosition R.coloring T beta) : ℕ) ≤ B.length → + (↑(HierarchyFirstMissingPosition R.coloring T theta) : ℕ) = YR.length → TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition R.coloring T beta)) (T.vertex + (HierarchyFirstMissingPosition R.coloring T theta)) → TwoColorComponent G R.coloring beta + theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition R.coloring T beta))) = + TwoColorComponent G R.coloring beta theta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition R.coloring T theta))) → HierarchyFirstMissingPosition + R.coloring T theta = Fin.castLE (Nat.succ_le_succ hYRT.1) (Fin.last YR.length) → T.vertex + (HierarchyFirstMissingPosition R.coloring T theta) = Y.vertex (Fin.last Y.length) → False + +private theorem helper_continuation_783.{u_1, u_2} : + helperContinuation783Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx beta hpathLower hpathUpper hvertexMissing R + initialSuffix theta hthetaUnstored H q A j ell Y hYdef Z n Tn D hAT hellSame hell hYlen hYT + YR hYRlen hYRT commonPrefix hYZ hZ hthetaRawUnstored houtside hbetaRawUnstored hbetaUnused + B hBlen hbetaZ hthetaZ hne Xfull hXlen hXfullZ prefixVertexMem hthetaIndex hordered + hthetaFirstIndex vb vj vl hbetaAt hdisjoint hpath hmissingPenultimate tau htauOne + hthetaLastTau hthetaJTau hnotElementary hAY hAYstrict hXY hYnext hfixedTail hsplitMissing + hstoredFirst hgammaCutoff segTrans lastPositive + have hrebuilt : ∃ corr : CorrespondingExtendedTashkinovTree + G k e0 R.corresponding.replacementETT tau T, + MaximumProperty corr.replacementETT ∧ + ∃ bs : HierarchyBase corr.replacementETT tau, + ∃ K : TashkinovHierarchy corr.replacementETT bs, + ∃ good : GoodHierarchy K, SameGoodHierarchy R.counterexample.good good := by + by_cases hcase : + (0 < H.dividerCount ∧ beta ∈ TreeMissingColors R.coloring + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ (beta ∈ TreeMissingColors R.coloring Tn ∨ + (beta ∈ TreeMissingColors R.coloring A ∧ + beta ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data n ∧ + theta ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data n))) + · have hweak : HierarchyWeaklyStable H q tau := by + exact (StableChangeCasesOneTwo G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality hZ + R.minimumContext.largeMissingSet beta theta hne ⟨hbetaZ, hthetaZ⟩ + (Sum.inl vl) hpath tau rfl hcase hdisjoint).1 + have baseStable : if R.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.PE then + CombinedStableColoring Tn R.replacementBase.closure + (TashkinovStoredColors R.corresponding.replacementETT.series.data n) R.coloring tau + else StableColoring Tn (TashkinovStoredColors R.corresponding.replacementETT.series.data n) + R.coloring tau := by + have extract (i : Fin (H.dividerCount + 1)) : HierarchyWeaklyStable H i tau → + (if R.corresponding.replacementETT.series.data.kind n = some + TashkinovExtensionKind.PE then + CombinedStableColoring Tn R.replacementBase.closure + (TashkinovStoredColors R.corresponding.replacementETT.series.data n) R.coloring tau + else StableColoring Tn (TashkinovStoredColors + R.corresponding.replacementETT.series.data n) + R.coloring tau) := Fin.cases (fun h => h) (fun _ h => h.1) i + exact extract q hweak + have fixedA : ∀ t : Fin A.length, tau (A.edge t) = R.coloring (A.edge t) := by + have fixed (i : Fin (H.dividerCount + 1)) : HierarchyWeaklyStable H i tau → + ∀ t : Fin (HierarchyStarredStage H i).length, + tau ((HierarchyStarredStage H i).edge t) = R.coloring ((HierarchyStarredStage H + i).edge t) := by + refine Fin.cases ?_ (fun i => ?_) i + · intro _ + exact P2813_T1_BaseDisplayedEdges G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase tau + R.minimumContext.oneEdgeUncolored htauOne baseStable + · intro hh t + change tau ((H.stage i.succ.castSucc).edge t) = R.coloring ((H.stage + i.succ.castSucc).edge t) + by_cases ht : t.val = 0 + · have he : (H.stage i.succ.castSucc).edge t = e0 := by + rw [show t = ⟨0, (H.stage i.succ.castSucc).positive⟩ from Fin.ext ht] + exact (H.stage i.succ.castSucc).first_edge + rw [he, htauOne.1, R.minimumContext.oneEdgeUncolored.1] + · exact hh.2.1 t (by omega) + exact fixed q hweak + have fixedY : ∀ t : Fin Y.length, tau (Y.edge t) = R.coloring (Y.edge t) := by + intro t + by_cases ht : t.val < A.length + · let s : Fin A.length := ⟨t.val, ht⟩ + have he : Fin.castLE hAY.1 s = t := Fin.ext rfl + rw [← he, hAY.2.2 s] + exact fixedA s + · rw [← hYT.2.2 t] + exact hfixedTail (Fin.castLE hYT.1 t) (by change A.length ≤ t.val; omega) t.isLt + have coreToA : TreeSequenceInitialSegment R.replacementBase.core A := by + by_cases hz : H.dividerCount = 0 + · have he : A = R.replacementBase.core := by simp [A, q, HierarchyStarredStage, hz, + Fin.last] + rw [he] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have stageSegment (a m : Nat) (hb : a + m ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) (H.stage ⟨a + m, by omega⟩) := by + induction m with + | zero => exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ m ih => exact segTrans (ih (by omega)) (H.nested ⟨a + m, by omega⟩) + rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + have TnToA : TreeSequenceInitialSegment Tn A := by + have TnToCore : TreeSequenceInitialSegment Tn R.replacementBase.core := by + by_cases hp : R.corresponding.replacementETT.series.data.kind n = some + TashkinovExtensionKind.PE + · exact (Classical.choice (R.replacementBase.parallel hp).2.2).leftSegment + · rw [R.replacementBase.nonparallel hp] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + exact segTrans TnToCore coreToA + have routes : + (R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence tau Tn Y) ∨ + ((R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, R.corresponding.replacementETT.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence tau seed Y) := by + rcases P2813_T1_TerminalRoute G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT with ⟨hp, hseq⟩ | + ⟨hp, f, seed, hedges, hseed, _, _, hseq⟩ + · have hsourceY := segTrans TnToA hAY + have hpre := TashkinovAugmentationSequenceRestrict R.coloring Tn Y T hseq hsourceY hYT + exact Or.inl ⟨hp, TashkinovAugmentationSequenceColoringTransport R.coloring tau + Tn Xfull Y hpre hXY hYnext (fun t _ => fixedY t) + (fun v hv => + hmissingPenultimate v (TreeSequenceInitialSegmentVertexSetSubset hXfullZ hv))⟩ + · have hseedY : TreeSequenceInitialSegment seed Y := + commonPrefix (TashkinovAugmentationSequenceInitialSegment R.coloring seed T hseq) hYT + (by have hl := hseed.1; have := TnToA.1 + change seed.length = Tn.length + 1 at hl; omega) + have hpre := TashkinovAugmentationSequenceRestrict R.coloring seed Y T hseq hseedY hYT + exact Or.inr ⟨hp, f, seed, hedges, hseed, + TashkinovAugmentationSequenceColoringTransport R.coloring tau + seed Xfull Y hpre hXY hYnext (fun t _ => fixedY t) + (fun v hv => + hmissingPenultimate v (TreeSequenceInitialSegmentVertexSetSubset hXfullZ hv))⟩ + have hsuffix : TashkinovAugmentationSequence R.coloring Y T := + TashkinovAugmentationSequenceSuffix R.coloring Xfull Y T initialSuffix hXY hYT + exact (StableChangeCasesOneTwoSplitTail G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase R.counterexample R.minimumContext + beta theta hne ⟨hbetaZ, hthetaZ⟩ (Sum.inl vl) hpath tau rfl hcase hdisjoint + Y hAY hAYstrict hYZ hfixedTail routes hsuffix hsplitMissing + hmissingPenultimate hstoredFirst hgammaCutoff).2.2 + · have hbetaNotA : beta ∉ TreeMissingColors R.coloring A := by + intro hb + apply hcase + by_cases hz : H.dividerCount = 0 + · exact Or.inr ⟨hz, Or.inr ⟨hb, hbetaRawUnstored hz, hthetaRawUnstored⟩⟩ + · exact Or.inl ⟨by omega, by rw [← lastPositive hz]; exact hb⟩ + have hbetaAfterA : A.length < (HierarchyFirstMissingPosition R.coloring T beta).val := by + by_contra hn + have hle : (HierarchyFirstMissingPosition R.coloring T beta).val ≤ A.length := by omega + exact hbetaNotA (Finset.mem_biUnion.mpr ⟨vb, + prefixVertexMem A hAT (HierarchyFirstMissingPosition R.coloring T beta) hle, hbetaAt⟩) + have hprecedes : ∀ v ∈ TreeSequenceVertexSet A, + TreeVertexOrder T v (T.vertex (HierarchyFirstMissingPosition R.coloring T beta)) := by + intro v hv + obtain ⟨i, hi⟩ : ∃ i : Fin (A.length + 1), A.vertex i = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hv + exact ⟨Fin.castLE (Nat.succ_le_succ hAT.1) i, _, (hAT.2.1 i).trans hi, rfl, + by change i.val < (HierarchyFirstMissingPosition R.coloring T beta).val + have := i.isLt; omega⟩ + have hunusedBetween : beta ∉ (Finset.univ.filter fun c : Fin k => + ∃ t : Fin T.length, + (HierarchyFirstMissingPosition R.coloring T beta).val ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition R.coloring T theta).val ∧ + R.coloring (T.edge t) = some c) := by + intro hh + obtain ⟨_, t, hlo, hhi, hc⟩ := Finset.mem_filter.mp hh + exact hbetaUnused t (by omega) (by rw [hthetaIndex, hYRlen] at hhi; exact hhi) hc + obtain ⟨_, _, _, _, corr, hmaximum, bs, K, good, hsameGood⟩ := + StableChangeCaseThree G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality hZ + R.minimumContext.largeMissingSet beta theta hne ⟨hbetaZ, hthetaZ⟩ + (Sum.inl vl) tau rfl hprecedes hordered ⟨houtside.1, hthetaUnstored⟩ hunusedBetween + exact ⟨corr, hmaximum, bs, K, good, hsameGood⟩ + obtain ⟨corr, hmaximum, bs, K, good, hsameGood⟩ := hrebuilt + let Ctau : HierarchyCounterexample bs := { + positive := by rw [corr.rungAgreement]; exact R.counterexample.positive + hierarchy := K + good := good + maximum := hmaximum + notElementary := hnotElementary } + obtain ⟨S, hS⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi ett base C ctx + R tau corr bs Ctau hsameGood + have hjEligible : j ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨by omega, by rw [hellSame]; omega⟩, + S, theta, ?_, ?_⟩ + · rw [hS] + rw [hYdef] + exact hthetaJTau + · rw [hS] + exact hthetaLastTau + have hbound := HierarchySituationThreeEligibleIndexBound G k e0 input T phi ett base C ctx + hpathLower hpathUpper hvertexMissing j hjEligible + exact Nat.lt_irrefl j hbound + +private theorem helper_continuation_590.{u_1, u_2} : + helperContinuation590Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx beta hpathLower hpathUpper hvertexMissing R + initialBetaLast initialSuffix theta hthetaUnstored initialThetaGamma componentData H q A j + ell Y hYdef Z n Tn D hAT hellSame hell hZlen hYlen hYT hZT YR hYRlen hYRT commonPrefix hYZ + hZ vertexMem hthetaY hthetaRawUnstored hthetaUnused houtside hbetaRawUnstored hbetaUnused B + hBlen hBT hBZ hbetaZ hthetaZ hne Xfull hXlen hXfullT hXfullZ prefixVertexMem hbetaFirst + hthetaIndex hordered hsame hthetaFirstIndex hthetaRootY + let vb := T.vertex (HierarchyFirstMissingPosition R.coloring T beta) + let vj := Y.vertex (Fin.last Y.length) + let vl := T.vertex (Fin.last T.length) + have hvbB : vb ∈ TreeSequenceVertexSet B := + prefixVertexMem B hBT (HierarchyFirstMissingPosition R.coloring T beta) + hbetaFirst.2 + have hvbZ : vb ∈ TreeSequenceVertexSet Z := + TreeSequenceInitialSegmentVertexSetSubset hBZ hvbB + have hvjZ : vj ∈ TreeSequenceVertexSet Z := by + exact TreeSequenceInitialSegmentVertexSetSubset hYZ + (vertexMem Y (Fin.last Y.length)) + have hvlNotZ : vl ∉ TreeSequenceVertexSet Z := by + clear * - hZT hZlen + intro hm + have hindex : ∃ i : Fin (Z.length + 1), Z.vertex i = vl := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] using hm + rcases hindex with ⟨i, hi⟩ + have htoT : T.vertex (Fin.castLE (Nat.succ_le_succ hZT.1) i) = vl := + (hZT.2.1 i).trans hi + have hinj := T.vertex_injective htoT + have hval := congrArg Fin.val hinj + change i.val = T.length at hval + have hiBound : i.val ≤ Z.length := Nat.le_of_lt_succ i.isLt + have hpositive := T.positive + omega + have hvbNeVj : vb ≠ vj := by + clear * - hordered hthetaRootY + intro heq + rcases hordered with ⟨i, m, hi, hm, hlt⟩ + have heq' : T.vertex i = T.vertex m := by + rw [hi, hm, hthetaRootY] + exact heq + have hinj := T.vertex_injective heq' + have hval := congrArg Fin.val hinj + omega + have hvbNeVl : vb ≠ vl := by + intro heq + exact hvlNotZ (heq ▸ hvbZ) + have hvjNeVl : vj ≠ vl := by + intro heq + exact hvlNotZ (heq ▸ hvjZ) + have hbetaAt : beta ∈ MissingColors G R.coloring vb := by + simpa [vb] using hbetaFirst.1 + have hthetaAt : theta ∈ MissingColors G R.coloring vj := by + simpa [vj] using hthetaY + have hbetaLast : beta ∈ MissingColors G R.coloring vl := by + simpa [vl] using initialBetaLast + have hsameToJ : TwoColorComponent G R.coloring beta theta (Sum.inl vb) = + TwoColorComponent G R.coloring beta theta (Sum.inl vj) := by + simpa [vb, vj, hthetaRootY] using hsame + obtain ⟨hdisjoint, hpath, hmissingPenultimate⟩ := + componentData R.coloring beta theta hne R.minimumContext.proper + (TreeSequenceVertexSet Z) hZ vb vj vl hvbZ hvjZ hvbNeVj + hvbNeVl.symm hvjNeVl.symm hbetaAt hthetaAt (Or.inl hbetaLast) hsameToJ + let tau := TwoColorComponentSwap G R.coloring beta theta (Sum.inl vl) + have htauProper : IsProperEdgeColoring G tau := by + exact TwoColorComponentSwapProper G R.coloring beta theta hne + R.minimumContext.proper (Sum.inl vl) + have htauOne : IsOneEdgeUncolored tau e0 := by + clear * - R hne + refine ⟨?_, ?_⟩ + · simp [tau, TwoColorComponentSwap, R.minimumContext.oneEdgeUncolored.1] + · intro f hf + obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 f hf + by_cases hm : Sum.inr f ∈ TwoColorComponent G R.coloring beta theta (Sum.inl vl) + · by_cases hcb : c = beta + · subst c + exact ⟨theta, by simp [tau, TwoColorComponentSwap, hm, hc]⟩ + · by_cases hct : c = theta + · subst c + exact ⟨beta, by simp [tau, TwoColorComponentSwap, hm, hc, hne.symm]⟩ + · exact ⟨c, by simp [tau, TwoColorComponentSwap, hm, hc, hcb, hct]⟩ + · exact ⟨c, by simp [tau, TwoColorComponentSwap, hm, hc]⟩ + have hthetaLastTau : theta ∈ MissingColors G tau vl := by + exact (TwoColorComponentSwapMissingBehavior G R.coloring beta theta hne + R.minimumContext.proper (Sum.inl vl)).2.1 vl (by rfl) hbetaLast + have hthetaJTau : theta ∈ MissingColors G tau vj := by + rw [hmissingPenultimate vj hvjZ] + exact hthetaAt + have hnotElementary : ¬ ColoredVertexSetElementary G tau (TreeSequenceVertexSet T) := by + intro he + exact Finset.disjoint_left.mp + (he (TreeSequenceInitialSegmentVertexSetSubset hYT + (vertexMem Y (Fin.last Y.length))) (vertexMem T (Fin.last T.length)) + hvjNeVl) hthetaJTau hthetaLastTau + have hAY : TreeSequenceInitialSegment A Y := + commonPrefix hAT hYT (by rw [hYlen]; omega) + have hAYstrict : A.length < Y.length := by + clear * - hYlen hpathLower + omega + have hXY : TreeSequenceInitialSegment Xfull Y := + commonPrefix hXfullT hYT (by rw [hXlen, hYlen]; omega) + have hYnext : Y.length = Xfull.length + 1 := by + clear * - hYlen hXlen hpathLower + omega + have hBY : TreeSequenceInitialSegment B Y := + commonPrefix hBT hYT (by rw [hBlen, hYlen]; omega) + have hfixedTail : ∀ t : Fin T.length, A.length ≤ t.val → t.val < Y.length → + tau (T.edge t) = R.coloring (T.edge t) := by + clear * - hbetaUnused hthetaUnused hYlen + intro t hlo hhi + rw [hYlen] at hhi + have hb := hbetaUnused t hlo hhi + have ht := hthetaUnused t hlo hhi + simp [tau, TwoColorComponentSwap, hb, ht] + have hsplitMissing : beta ∈ TreeMissingColors tau Y ∧ theta ∈ TreeMissingColors tau Y := by + clear * - hvbB hBY hmissingPenultimate hvbZ hbetaAt vertexMem hthetaJTau + unfold TreeMissingColors + refine ⟨Finset.mem_biUnion.mpr ⟨vb, + TreeSequenceInitialSegmentVertexSetSubset hBY hvbB, ?_⟩, + Finset.mem_biUnion.mpr ⟨vj, vertexMem Y (Fin.last Y.length), hthetaJTau⟩⟩ + rw [hmissingPenultimate vb hvbZ] + exact hbetaAt + have hstoredFirst : ∀ eta, eta ∈ D → + HierarchyFirstMissingPosition tau T eta = HierarchyFirstMissingPosition R.coloring T eta := by + clear * - houtside hthetaUnstored hne + intro eta heta + have heb : eta ≠ beta := fun he => houtside.1 (he ▸ heta) + have het : eta ≠ theta := fun he => hthetaUnstored (he ▸ heta) + have hmissing := (TwoColorComponentSwapMissingBehavior G R.coloring beta theta hne + R.minimumContext.proper (Sum.inl vl)).2.2.2 + have hcandidates : + (Finset.univ.filter fun i : Fin (T.length + 1) => eta ∈ MissingColors G tau (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G R.coloring (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hmissing (T.vertex i) eta heb het + unfold HierarchyFirstMissingPosition + simp only [hcandidates] + have hgammaCutoff : ∀ eta, eta ∈ D → + (beta ∈ R.counterexample.good.gamma q eta ∨ + theta ∈ R.counterexample.good.gamma q eta) → + (HierarchyFirstMissingPosition R.coloring T eta).val ≤ Y.length := by + intro eta heta hc + rcases hc with hc | hc + · exact (houtside.2.2 (Finset.mem_biUnion.mpr ⟨eta, heta, hc⟩)).elim + · exact (initialThetaGamma (Finset.mem_biUnion.mpr ⟨eta, heta, hc⟩)).elim + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + clear * - hSU hUW + exact ⟨hSU.1.trans hUW.1, + fun i => (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i), + fun i => (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i)⟩ + have lastPositive (hz : H.dividerCount ≠ 0) : A = H.stage ⟨H.dividerCount, by omega⟩ := by + clear * - hz + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm + exact @helper_continuation_783 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@beta) + (@hpathLower) (@hpathUpper) (@hvertexMissing) (@R) (@initialSuffix) (@theta) + (@hthetaUnstored) (@Y) (@hYdef) (@hAT) (@hellSame) (@hell) (@hYlen) (@hYT) (@YR) (@hYRlen) + (@hYRT) (@commonPrefix) (@hYZ) (@hZ) (@hthetaRawUnstored) (@houtside) (@hbetaRawUnstored) + (@hbetaUnused) (@B) (@hBlen) (@hbetaZ) (@hthetaZ) (@hne) (@hXlen) (@hXfullZ) + (@prefixVertexMem) (@hthetaIndex) (@hordered) (@hthetaFirstIndex) (@hbetaAt) (@hdisjoint) + (@hpath) (@hmissingPenultimate) (@htauOne) (@hthetaLastTau) (@hthetaJTau) (@hnotElementary) + (@hAY) (@hAYstrict) (@hXY) (@hYnext) (@hfixedTail) (@hsplitMissing) (@hstoredFirst) + (@hgammaCutoff) (@segTrans) (@lastPositive) +private theorem helper_continuation_460.{u_1, u_2} : + helperContinuation460Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx beta hpathLower hpathUpper hvertexMissing R + initialBetaLast initialSuffix theta hthetaUnstored initialThetaGamma componentData + firstMissingVertex H q A j ell Y hYdef Z n Tn D hA hAT hellSame hell hstrict hZlen hYlen + hYT hZT YR hYRlen hYRT hYRlast commonPrefix hYZ hZ vertexMem hthetaY hthetaYR + hthetaRawUnstored hthetaUnused houtside hbetaRawUnstored hbetaUnused B hBlen hBT hBZ hYRZ + hbetaB hbetaZ hthetaZ hne + let Xfull := HierarchyFullTailPrefix C (j - 1) + have hXlen : Xfull.length = A.length + (j - 1) := by + clear * - hA hstrict + have hbound : A.length + (j - 1) ≤ T.length := by omega + simp only [Xfull, HierarchyFullTailPrefix, hA, TreeSequencePrefix, min_eq_left hbound] + have hXfullT : TreeSequenceInitialSegment Xfull T := by + clear * - hXlen hstrict + refine ⟨by rw [hXlen]; omega, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have hXfullZ : TreeSequenceInitialSegment Xfull Z := + commonPrefix hXfullT hZT (by rw [hXlen, hZlen]; omega) + have prefixVertexMem (S : TreeSequence G e0) + (hST : TreeSequenceInitialSegment S T) (i : Fin (T.length + 1)) + (hi : i.val ≤ S.length) : T.vertex i ∈ TreeSequenceVertexSet S := by + clear * - S hST i hi + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + let iS : Fin (S.length + 1) := ⟨i.val, by omega⟩ + refine ⟨iS, ?_⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hST.1) iS = i := Fin.ext rfl + rw [← hcast] + exact (hST.2.1 iS).symm + have hbetaFirst : + beta ∈ MissingColors G R.coloring + (T.vertex (HierarchyFirstMissingPosition R.coloring T beta)) ∧ + (HierarchyFirstMissingPosition R.coloring T beta).val ≤ B.length := by + clear * - firstMissingVertex hBT hbetaB + unfold TreeMissingColors at hbetaB + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hbetaB + obtain ⟨i, hi⟩ : ∃ i : Fin (B.length + 1), B.vertex i = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hv + have hmT : beta ∈ MissingColors G R.coloring + (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) i)) := by + rw [hBT.2.1 i, hi] + exact hm + have hf := firstMissingVertex R.coloring T + (Fin.castLE (Nat.succ_le_succ hBT.1) i) beta hmT + exact ⟨hf.1, hf.2.trans (Nat.le_of_lt_succ i.isLt)⟩ + have hthetaFirst : + theta ∈ MissingColors G R.coloring + (T.vertex (HierarchyFirstMissingPosition R.coloring T theta)) ∧ + (HierarchyFirstMissingPosition R.coloring T theta).val ≤ YR.length := by + clear * - firstMissingVertex hYRT hthetaYR + have hmT : theta ∈ MissingColors G R.coloring + (T.vertex (Fin.castLE (Nat.succ_le_succ hYRT.1) (Fin.last YR.length))) := by + rw [hYRT.2.1 (Fin.last YR.length)] + exact hthetaYR + exact firstMissingVertex R.coloring T + (Fin.castLE (Nat.succ_le_succ hYRT.1) (Fin.last YR.length)) theta hmT + have hthetaIndex : + (HierarchyFirstMissingPosition R.coloring T theta).val = YR.length := by + have hfirstMem : T.vertex (HierarchyFirstMissingPosition R.coloring T theta) ∈ + TreeSequenceVertexSet YR := + prefixVertexMem YR hYRT (HierarchyFirstMissingPosition R.coloring T theta) hthetaFirst.2 + have heq : T.vertex (HierarchyFirstMissingPosition R.coloring T theta) = + YR.vertex (Fin.last YR.length) := by + by_contra hn + exact Finset.disjoint_left.mp + (hZ (TreeSequenceInitialSegmentVertexSetSubset hYRZ hfirstMem) + (TreeSequenceInitialSegmentVertexSetSubset hYRZ + (vertexMem YR (Fin.last YR.length))) hn) hthetaFirst.1 hthetaYR + have hi := T.vertex_injective (heq.trans (hYRT.2.1 (Fin.last YR.length)).symm) + exact congrArg Fin.val hi + have hordered : TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition R.coloring T beta)) + (T.vertex (HierarchyFirstMissingPosition R.coloring T theta)) := by + clear * - hthetaIndex hBlen hbetaFirst hYRlen hpathLower + refine ⟨_, _, rfl, rfl, ?_⟩ + rw [hthetaIndex] + rw [hBlen] at hbetaFirst + have hbetaPos := hbetaFirst.2 + omega + have hunused : beta ∉ (Finset.univ.filter fun c : Fin k => + ∃ r : Fin T.length, + A.length ≤ r.val ∧ + r.val < (HierarchyFirstMissingPosition R.coloring T theta).val ∧ + R.coloring (T.edge r) = some c) := by + clear * - hthetaIndex hYRlen hbetaUnused + intro hc + rcases Finset.mem_filter.mp hc with ⟨_, ⟨r, hrA, hrTheta, hcol⟩⟩ + have hrJ : r.val < A.length + j := by omega + exact hbetaUnused r hrA hrJ hcol + have horderedUnused : + (beta ∉ TreeMissingColors R.coloring A ∨ + theta ∉ TreeMissingColors R.coloring A) → + TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition R.coloring T beta)) + (T.vertex (HierarchyFirstMissingPosition R.coloring T theta)) ∧ + beta ∉ (Finset.univ.filter fun c : Fin k => + ∃ r : Fin T.length, + A.length ≤ r.val ∧ + r.val < (HierarchyFirstMissingPosition R.coloring T theta).val ∧ + R.coloring (T.edge r) = some c) := by + intro _ + exact ⟨hordered, hunused⟩ + have hthetaNotD : theta ∉ D := by + exact hthetaUnstored + have hdisStored : Disjoint ({beta, theta} : Finset (Fin k)) D := by + clear * - houtside hthetaNotD + apply Finset.disjoint_left.mpr + intro c hc hcD + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with hc | hc + · subst c + exact houtside.1 hcD + · subst c + exact hthetaNotD hcD + have hsame : TwoColorComponent G R.coloring beta theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition R.coloring T beta))) = + TwoColorComponent G R.coloring beta theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition R.coloring T theta))) := by + clear * - R hZ hbetaZ hthetaZ hne horderedUnused hbetaRawUnstored hthetaRawUnstored hdisStored + dsimp only [H, q, A, ell, Z, D, n] at hZ hbetaZ hthetaZ horderedUnused + dsimp only [H, q, A, ell, Z, D, n] at hbetaRawUnstored hthetaRawUnstored hdisStored + have hchange := ChangeLemma G k e0 R.corresponding.replacementInput T + R.coloring R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored + R.minimumContext.lowerRung R.minimumContext.fewerDividers + R.minimumContext.lexicographicMinimality hZ R.minimumContext.largeMissingSet + beta theta hne ⟨hbetaZ, hthetaZ⟩ horderedUnused + by_cases hqzero : R.counterexample.hierarchy.dividerCount = 0 + · have hdisRaw : Disjoint ({beta, theta} : Finset (Fin k)) + (TashkinovStoredColors R.corresponding.replacementETT.series.data n) := by + clear * - hqzero hbetaRawUnstored hthetaRawUnstored + apply Finset.disjoint_left.mpr + intro c hc hcRaw + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with hc | hc + · subst c + exact hbetaRawUnstored hqzero hcRaw + · subst c + exact hthetaRawUnstored hcRaw + exact hchange.2.1 ⟨hqzero, Or.inr hdisRaw⟩ + · have hqpos : 0 < R.counterexample.hierarchy.dividerCount := by omega + exact hchange.1 ⟨hqpos, Or.inr hdisStored⟩ + have hthetaFirstIndex : + HierarchyFirstMissingPosition R.coloring T theta = + Fin.castLE (Nat.succ_le_succ hYRT.1) (Fin.last YR.length) := by + apply Fin.ext + simp only [Fin.val_castLE, Fin.val_last] + exact hthetaIndex + have hthetaRoot : + T.vertex (HierarchyFirstMissingPosition R.coloring T theta) = + YR.vertex (Fin.last YR.length) := by + rw [hthetaFirstIndex] + exact hYRT.2.1 _ + have hthetaRootY : + T.vertex (HierarchyFirstMissingPosition R.coloring T theta) = + Y.vertex (Fin.last Y.length) := by + rw [hthetaRoot, hYRlast] + exact @helper_continuation_590 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@beta) + (@hpathLower) (@hpathUpper) (@hvertexMissing) (@R) (@initialBetaLast) (@initialSuffix) + (@theta) (@hthetaUnstored) (@initialThetaGamma) (@componentData) (@Y) (@hYdef) (@hAT) + (@hellSame) (@hell) (@hZlen) (@hYlen) (@hYT) (@hZT) (@YR) (@hYRlen) (@hYRT) (@commonPrefix) + (@hYZ) (@hZ) (@vertexMem) (@hthetaY) (@hthetaRawUnstored) (@hthetaUnused) (@houtside) + (@hbetaRawUnstored) (@hbetaUnused) (@B) (@hBlen) (@hBT) (@hBZ) (@hbetaZ) (@hthetaZ) (@hne) + (@hXlen) (@hXfullT) (@hXfullZ) (@prefixVertexMem) (@hbetaFirst) (@hthetaIndex) (@hordered) + (@hsame) (@hthetaFirstIndex) (@hthetaRootY) +private theorem helper_continuation_344.{u_1, u_2} : + helperContinuation344Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx beta hpathLower hpathUpper hvertexMissing R + hconditionOutside initialBetaBefore initialBetaLast initialSuffix theta hthetaUnstored + initialThetaGamma componentData firstMissingVertex H q A j ell Y hYdef Z n Tn D hA hAT + hellSame hell hjlt hstrict hZlen hYlen hYT hZT YR hYRdef hYRlen hYRT hYRlast commonPrefix + hYZ hZ vertexMem hthetaY hthetaYR hthetaNotA + have hthetaRawUnstored : theta ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data n := by + intro hraw + apply hthetaUnstored + change theta ∈ HierarchyStoredColorsAt H q + change theta ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data n \ + TreeMissingColors R.coloring A + exact Finset.mem_sdiff.mpr ⟨hraw, hthetaNotA⟩ + have hthetaUnused : ∀ r : Fin T.length, A.length ≤ r.val → + r.val < A.length + j → R.coloring (T.edge r) ≠ some theta := by + clear * - hYRdef hYRlen hYRT hZ hjlt hthetaYR hthetaRawUnstored hpathLower + subst YR + let YR : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + j) T.length) + (by have := A.positive; have := T.positive; omega) (Nat.min_le_right _ _) + intro r hrA hrJ hcolor + let t : Fin YR.length := ⟨r.val, by rw [hYRlen]; omega⟩ + change Fin ((fun i : ℕ => TreeSequencePrefix T + (min (A.length + i) T.length) + (by have hApos := A.positive; have hTpos := T.positive; omega) + (Nat.min_le_right _ _)) j).length at t + have hcast : Fin.castLE hYRT.1 t = r := Fin.ext rfl + have hedge : YR.edge t = T.edge r := by + have h := hYRT.2.2 t + rw [hcast] at h + exact h.symm + have hcolorQ : R.coloring (((fun i : ℕ => TreeSequencePrefix T + (min (A.length + i) T.length) + (by have hApos := A.positive; have hTpos := T.positive; omega) + (Nat.min_le_right _ _)) j).edge t) = some theta := by + change R.coloring (YR.edge t) = some theta + rw [hedge] + exact hcolor + have htail := HierarchyTailMissingColorExclusion G k e0 + R.corresponding.replacementInput T R.coloring R.corresponding.replacementETT + R.replacementBase H hZ j (by omega) hjlt theta hthetaYR t + (by change A.length ≤ r.val; exact hrA) + (by change r.val < A.length + j; exact hrJ) + hcolorQ + rcases htail with ⟨_, _, _, f, _, _, _, _, _, hstored⟩ + exact hthetaRawUnstored (by simpa [n] using hstored) + have houtside : beta ∉ D ∧ beta ∉ (Finset.univ.filter fun c : Fin k => + ∃ r : Fin T.length, A.length ≤ r.val ∧ r.val < A.length + j ∧ + R.coloring (T.edge r) = some c) ∧ beta ∉ + D.biUnion (R.counterexample.good.gamma q) := by + rcases hconditionOutside with ⟨_, hu, hg, hd⟩ + exact ⟨hd, hu, hg⟩ + have hbaseExtra : beta ∉ + ((TreeSequenceVertexSet R.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion fun v => MissingColors G R.coloring v) := by + rcases hconditionOutside with ⟨hb, _, _, _⟩ + exact hb + have hbetaRawUnstored : H.dividerCount = 0 → beta ∉ + TashkinovStoredColors R.corresponding.replacementETT.series.data n := by + clear * - houtside hbaseExtra + intro hqzero hraw + have hbetaMissingA : beta ∈ TreeMissingColors R.coloring A := by + by_contra hnot + exact houtside.1 (Finset.mem_sdiff.mpr ⟨hraw, hnot⟩) + have hAcore : A = R.replacementBase.core := by + simp [A, q, HierarchyStarredStage, hqzero, Fin.last] + have hbetaCore : beta ∈ TreeMissingColors R.coloring R.replacementBase.core := by + simpa [hAcore] using hbetaMissingA + have hnotTn : beta ∉ TreeMissingColors R.coloring Tn := by + have hn : n.val ≠ 0 := by + exact Nat.ne_of_gt R.counterexample.positive + have hmem := hraw + unfold TashkinovStoredColors at hmem + rw [ite_eq_right hn] at hmem + simp only [Finset.mem_sdiff] at hmem + have hterminalColor : + R.corresponding.replacementETT.series.data.coloring n = R.coloring := by + simpa [n] using R.corresponding.replacementETT.generatingColoring.symm + rw [hterminalColor] at hmem + exact hmem.2 + by_cases hpe : R.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.PE + · let U : OrderedTreeUnion Tn R.replacementBase.closure + R.replacementBase.core := Classical.choice + (R.replacementBase.parallel hpe).2.2 + rcases Finset.mem_biUnion.mp hbetaCore with ⟨v, hv, hmiss⟩ + have hvUnion : v ∈ TreeSequenceVertexSet Tn ∪ + TreeSequenceVertexSet R.replacementBase.closure := by + simpa [U.vertexSet] using hv + rcases Finset.mem_union.mp hvUnion with hvT | hvClosure + · exact hnotTn (Finset.mem_biUnion.mpr ⟨v, hvT, hmiss⟩) + · by_cases hvT : v ∈ TreeSequenceVertexSet Tn + · exact hnotTn (Finset.mem_biUnion.mpr ⟨v, hvT, hmiss⟩) + · exact hbaseExtra (Finset.mem_biUnion.mpr ⟨v, + Finset.mem_sdiff.mpr ⟨hv, hvT⟩, hmiss⟩) + · have hcoreEq : R.replacementBase.core = Tn := + R.replacementBase.nonparallel hpe + have hmTn : beta ∈ TreeMissingColors R.coloring Tn := by + simpa [hAcore, hcoreEq] using hbetaMissingA + exact hnotTn hmTn + have hbetaUnused : ∀ r : Fin T.length, A.length ≤ r.val → + r.val < A.length + j → R.coloring (T.edge r) ≠ some beta := by + intro r hrA hrJ hcol + apply houtside.2.1 + simp only [Finset.mem_filter] + exact ⟨Finset.mem_univ _, ⟨r, hrA, hrJ, hcol⟩⟩ + change beta ∈ TreeMissingColors R.coloring + (HierarchyFullTailPrefix C (j - 2)) at initialBetaBefore + generalize hBdef : HierarchyFullTailPrefix C (j - 2) = B at initialBetaBefore + have hBlen : B.length = A.length + (j - 2) := by + clear * - hBdef hA hstrict + rw [← hBdef] + have hbound : A.length + (j - 2) ≤ T.length := by omega + simp only [HierarchyFullTailPrefix, hA, TreeSequencePrefix, min_eq_left hbound] + have hBT : TreeSequenceInitialSegment B T := by + clear * - hBdef + rw [← hBdef] + refine ⟨Nat.min_le_right _ _, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have hBZ : TreeSequenceInitialSegment B Z := + commonPrefix hBT hZT (by rw [hBlen, hZlen]; omega) + have hYRZ : TreeSequenceInitialSegment YR Z := + commonPrefix hYRT hZT (by rw [hYRlen, hZlen]; omega) + have hbetaB : beta ∈ TreeMissingColors R.coloring B := by + as_aux_lemma => exact initialBetaBefore + have hbetaZ : beta ∈ TreeMissingColors R.coloring Z := by + clear * - hbetaB hBZ + unfold TreeMissingColors at hbetaB ⊢ + rcases Finset.mem_biUnion.mp hbetaB with ⟨v, hv, hmiss⟩ + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset hBZ hv, hmiss⟩ + have hthetaZ : theta ∈ TreeMissingColors R.coloring Z := by + exact Finset.mem_biUnion.mpr ⟨YR.vertex (Fin.last YR.length), + TreeSequenceInitialSegmentVertexSetSubset hYRZ + (vertexMem YR (Fin.last YR.length)), hthetaYR⟩ + have hne : beta ≠ theta := by + clear * - hZ hbetaB hthetaYR hBZ hYRZ vertexMem hBlen hYRlen hpathLower + intro heq + rw [← heq] at hthetaYR + unfold TreeMissingColors at hbetaB + rcases Finset.mem_biUnion.mp hbetaB with ⟨vB, hvB, hmissB⟩ + have hindex : ∃ iB : Fin (B.length + 1), B.vertex iB = vB := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] using hvB + rcases hindex with ⟨iB, hBvertex⟩ + have hZB : Z.vertex (Fin.castLE (Nat.succ_le_succ hBZ.1) iB) = vB := + (hBZ.2.1 iB).trans hBvertex + have hZY : Z.vertex + (Fin.castLE (Nat.succ_le_succ hYRZ.1) (Fin.last YR.length)) = + YR.vertex (Fin.last YR.length) := hYRZ.2.1 _ + have hneV : vB ≠ YR.vertex (Fin.last YR.length) := by + intro heqV + have hi := Z.vertex_injective (hZB.trans (heqV.trans hZY.symm)) + have hval := congrArg Fin.val hi + simp only [Fin.val_castLE, Fin.val_last] at hval + have hBbound : iB.val ≤ B.length := Nat.le_of_lt_succ iB.isLt + clear * - hval hBbound hBlen hYRlen hpathLower + omega + have hdis := hZ + (TreeSequenceInitialSegmentVertexSetSubset hBZ hvB) + (TreeSequenceInitialSegmentVertexSetSubset hYRZ + (vertexMem YR (Fin.last YR.length))) hneV + exact Finset.disjoint_left.mp hdis hmissB hthetaYR + exact @helper_continuation_460 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@beta) + (@hpathLower) (@hpathUpper) (@hvertexMissing) (@R) (@initialBetaLast) (@initialSuffix) + (@theta) (@hthetaUnstored) (@initialThetaGamma) (@componentData) (@firstMissingVertex) (@Y) + (@hYdef) (@hA) (@hAT) (@hellSame) (@hell) (@hstrict) (@hZlen) (@hYlen) (@hYT) (@hZT) (@YR) + (@hYRlen) (@hYRT) (@hYRlast) (@commonPrefix) (@hYZ) (@hZ) (@vertexMem) (@hthetaY) + (@hthetaYR) (@hthetaRawUnstored) (@hthetaUnused) (@houtside) (@hbetaRawUnstored) + (@hbetaUnused) (@B) (@hBlen) (@hBT) (@hBZ) (@hYRZ) (@hbetaB) (@hbetaZ) (@hthetaZ) (@hne) +private theorem helper_continuation_286.{u_1, u_2} : + helperContinuation286Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx beta hpathLower hpathUpper hvertexMissing R + hconditionOutside initialBetaBefore initialBetaLast initialSuffix theta hthetaUnstored + initialThetaJ initialThetaGamma componentData firstMissingVertex H q A + let j := HierarchyPathNumber C.hierarchy + let ell := HierarchyFullTailLength R.counterexample + change theta ∈ MissingColors G R.coloring + ((HierarchyFullTailPrefix C j).vertex + (Fin.last (HierarchyFullTailPrefix C j).length)) at initialThetaJ + generalize hYdef : HierarchyFullTailPrefix C j = Y at initialThetaJ + let Z := HierarchyFullTailPrefix R.counterexample (ell - 1) + let n : Fin (R.corresponding.replacementETT.rounds + 1) := + Fin.last R.corresponding.replacementETT.rounds + let Tn := R.corresponding.replacementETT.series.data.tree n.castSucc + let D := HierarchyStoredColorsAt H q + have sameLast {a b : ℕ} + (s : Fin (a + 2) → TreeSequence G e0) + (t : Fin (b + 2) → TreeSequence G e0) + (u v : TreeSequence G e0) (hab : a = b) (hst : HEq s t) + (huv : u = v) : + Fin.cases (motive := fun _ => TreeSequence G e0) + u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = + Fin.cases (motive := fun _ => TreeSequence G e0) + v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by + clear * - s t u v hab hst huv + cases hab + have he : s = t := eq_of_heq hst + cases he + cases huv + rfl + have hA : HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A := by + exact sameLast C.hierarchy.stage R.counterexample.hierarchy.stage + base.core R.replacementBase.core R.sameGood.1.2.1 + R.sameGood.1.2.2.1 R.sameGood.1.1 + have hAT : TreeSequenceInitialSegment A T := by + clear * - H + have starNext (i : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H i) (H.stage i.succ) := + Fin.cases H.coreInsideFirst (fun i => H.nested i.succ) i + simpa only [Fin.succ_last, H.terminalStage] using starNext (Fin.last H.dividerCount) + have hellSame : HierarchyFullTailLength C = ell := by + change T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length = T.length - A.length + rw [hA] + have hell : ell = T.length - A.length := by + rfl + have hjlt : j < ell := by rw [← hellSame]; exact hpathUpper + have hAlen : A.length ≤ T.length := hAT.1 + have hjltT : j < T.length - A.length := by + simpa [HierarchyFullTailLength, hA] using hpathUpper + have hstrict : A.length + j < T.length := by + clear * - hAlen hjltT + omega + have hZlen : Z.length = T.length - 1 := by + clear * - hell hjlt hpathLower hAlen + have hmin : min (A.length + (ell - 1)) T.length = T.length - 1 := by + rw [hell] + omega + change min (A.length + (ell - 1)) T.length = T.length - 1 + exact hmin + have hYlen : Y.length = A.length + j := by + rw [← hYdef] + have hbound : A.length + j ≤ T.length := Nat.le_of_lt hstrict + simp only [HierarchyFullTailPrefix, hA, TreeSequencePrefix, min_eq_left hbound] + have hYT : TreeSequenceInitialSegment Y T := by + clear * - hYdef + rw [← hYdef] + refine ⟨Nat.min_le_right _ _, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have hZT : TreeSequenceInitialSegment Z T := by + clear * - hZlen + refine ⟨by rw [hZlen]; omega, ?_, ?_⟩ + · intro i + rfl + · intro i + simp [Z, HierarchyFullTailPrefix, TreeSequencePrefix] + generalize hYRdef : + TreeSequencePrefix T (min (A.length + j) T.length) + (by have hApos := A.positive; have hTpos := T.positive; omega) + (Nat.min_le_right _ _) = YR + have hYRlen : YR.length = A.length + j := by + rw [← hYRdef] + have hbound : A.length + j ≤ T.length := Nat.le_of_lt hstrict + change min (A.length + j) T.length = A.length + j + exact min_eq_left hbound + have hYRT : TreeSequenceInitialSegment YR T := by + rw [← hYRdef] + refine ⟨Nat.min_le_right _ _, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have hYRlast : YR.vertex (Fin.last YR.length) = Y.vertex (Fin.last Y.length) := by + have hidx : Fin.castLE (Nat.succ_le_succ hYRT.1) (Fin.last YR.length) = + Fin.castLE (Nat.succ_le_succ hYT.1) (Fin.last Y.length) := by + apply Fin.ext + simp [hYRlen, hYlen] + calc + YR.vertex (Fin.last YR.length) = + T.vertex (Fin.castLE (Nat.succ_le_succ hYRT.1) (Fin.last YR.length)) := + (hYRT.2.1 _).symm + _ = T.vertex (Fin.castLE (Nat.succ_le_succ hYT.1) (Fin.last Y.length)) := + congrArg T.vertex hidx + _ = Y.vertex (Fin.last Y.length) := hYT.2.1 _ + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) + (hlen : S.length ≤ U.length) : TreeSequenceInitialSegment S U := by + clear * - hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + calc + U.vertex (Fin.castLE (Nat.succ_le_succ hlen) i) = + W.vertex (Fin.castLE (Nat.succ_le_succ hUW.1) + (Fin.castLE (Nat.succ_le_succ hlen) i)) := (hUW.2.1 _).symm + _ = W.vertex (Fin.castLE (Nat.succ_le_succ hSW.1) i) := by congr 1 + _ = S.vertex i := hSW.2.1 i + · intro i + calc + U.edge (Fin.castLE hlen i) = W.edge (Fin.castLE hUW.1 (Fin.castLE hlen i)) := + (hUW.2.2 _).symm + _ = W.edge (Fin.castLE hSW.1 i) := by congr 1 + _ = S.edge i := hSW.2.2 i + have hAZ : TreeSequenceInitialSegment A Z := + commonPrefix hAT hZT (by rw [hZlen]; have := hAT.1; omega) + have hYZ : TreeSequenceInitialSegment Y Z := + commonPrefix hYT hZT (by rw [hYlen, hZlen]; omega) + have hZ : ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet Z) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 + R.corresponding.replacementInput T R.coloring R.corresponding.replacementETT + R.replacementBase R.counterexample R.minimumContext.proper + R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + R.minimumContext.largeMissingSet + have vertexMem (S : TreeSequence G e0) (i : Fin (S.length + 1)) : + S.vertex i ∈ TreeSequenceVertexSet S := by + clear * - S i + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, rfl⟩ + have hthetaY : theta ∈ MissingColors G R.coloring + (Y.vertex (Fin.last Y.length)) := by + exact initialThetaJ + have hthetaYR : theta ∈ MissingColors G R.coloring + (YR.vertex (Fin.last YR.length)) := by + rw [hYRlast] + exact hthetaY + have hthetaNotA : theta ∉ TreeMissingColors R.coloring A := by + clear * - hZ hAZ hYZ hthetaY vertexMem hYlen hpathLower + intro hmA + rcases Finset.mem_biUnion.mp hmA with ⟨vA, hvA, hmva⟩ + have hindex : ∃ iA : Fin (A.length + 1), A.vertex iA = vA := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] using hvA + rcases hindex with ⟨iA, hAvertex⟩ + have hvAMem : vA ∈ TreeSequenceVertexSet Z := + TreeSequenceInitialSegmentVertexSetSubset hAZ hvA + have hvYMem : Y.vertex (Fin.last Y.length) ∈ TreeSequenceVertexSet Z := + TreeSequenceInitialSegmentVertexSetSubset hYZ (vertexMem Y (Fin.last Y.length)) + have hne : vA ≠ Y.vertex (Fin.last Y.length) := by + intro heq + have hZA : Z.vertex (Fin.castLE (Nat.succ_le_succ hAZ.1) iA) = vA := + (hAZ.2.1 iA).trans hAvertex + have hZY : Z.vertex + (Fin.castLE (Nat.succ_le_succ hYZ.1) (Fin.last Y.length)) = + Y.vertex (Fin.last Y.length) := hYZ.2.1 _ + have hi := Z.vertex_injective (hZA.trans (heq.trans hZY.symm)) + have hval := congrArg Fin.val hi + have hlast : (Fin.last Y.length).val = Y.length := rfl + have hia : iA.val ≤ A.length := Nat.le_of_lt_succ iA.isLt + simp only [Fin.val_castLE, hlast] at hval + clear * - hval hia hYlen hpathLower + omega + have hdis := hZ hvAMem hvYMem hne + exact Finset.disjoint_left.mp hdis hmva hthetaY + exact @helper_continuation_344 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@beta) + (@hpathLower) (@hpathUpper) (@hvertexMissing) (@R) (@hconditionOutside) + (@initialBetaBefore) (@initialBetaLast) (@initialSuffix) (@theta) (@hthetaUnstored) + (@initialThetaGamma) (@componentData) (@firstMissingVertex) (@Y) (@hYdef) (@hA) (@hAT) + (@hellSame) (@hell) (@hjlt) (@hstrict) (@hZlen) (@hYlen) (@hYT) (@hZT) (@YR) (@hYRdef) + (@hYRlen) (@hYRT) (@hYRlast) (@commonPrefix) (@hYZ) (@hZ) (@vertexMem) (@hthetaY) + (@hthetaYR) (@hthetaNotA) +theorem HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha beta : Fin k) + (hpathLower : 2 <= HierarchyPathNumber C.hierarchy) + (hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (hvertexMissing : forall (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu -> IsOneEdgeUncolored mu e0 -> + forall v : V, (MissingColors G mu v).Nonempty) + (d : HierarchySituationThreeDisjointData + G k e0 input T phi ett base C ctx P alpha beta) + (hthetaUnstored : + let H := d.switched.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + d.theta ∉ HierarchyStoredColorsAt H q) + (hconditionOutside : + let H := d.switched.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let j := HierarchyPathNumber C.hierarchy + let n : Fin (d.switched.corresponding.replacementETT.rounds + 1) := + Fin.last d.switched.corresponding.replacementETT.rounds + let Tn := d.switched.corresponding.replacementETT.series.data.tree + n.castSucc + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (d.switched.counterexample.good.gamma q) + let baseExtraMissing := + ((TreeSequenceVertexSet d.switched.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G d.switched.coloring v) + let tailUsedThroughJ := + (Finset.univ : Finset (Fin k)).filter fun c => + exists r : Fin T.length, + A.length <= r.val ∧ r.val < A.length + j ∧ + d.switched.coloring (T.edge r) = some c + beta ∉ baseExtraMissing ∧ beta ∉ tailUsedThroughJ ∧ + beta ∉ Gamma ∧ beta ∉ D) : + False := by + classical + have initialBetaBefore : beta ∈ TreeMissingColors d.switched.coloring + (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 2)) := by + with_reducible exact d.betaMissingTwoBefore + have initialThetaJ := d.thetaMissingAtJ + have initialBetaLast := d.betaMissingTerminal + have initialThetaGamma := d.thetaOutsideGamma + have initialSuffix := d.transportedSuffix + generalize hR : d.switched = R at * + generalize hTheta : d.theta = theta at * + clear hR hTheta d + have componentData (psi : PartialEdgeColoring E k) (a b : Fin k) + (hne : a ≠ b) (hproper : IsProperEdgeColoring G psi) + (B : Finset V) (helem : ColoredVertexSetElementary G psi B) + (u v w : V) (hu : u ∈ B) (hv : v ∈ B) (huv : u ≠ v) + (hwu : w ≠ u) (hwv : w ≠ v) + (hau : a ∈ MissingColors G psi u) (hbv : b ∈ MissingColors G psi v) + (hw : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) + (hsame : TwoColorComponent G psi a b (Sum.inl u) = + TwoColorComponent G psi a b (Sum.inl v)) : + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) + (TwoColorComponent G psi a b (Sum.inl u)) ∧ + TwoColorPathComponent G psi a b (Sum.inl w) ∧ + (∀ x ∈ B, + MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = + MissingColors G psi x) := by + clear * - G psi a b hne hproper B helem u v w hu hv huv hwu hwv hau hbv hw hsame + let J := TwoColorIncidenceGraph G psi a b + have leaf (x : V) (hx : a ∈ MissingColors G psi x ∨ b ∈ MissingColors G psi x) : + (J.neighborSet (Sum.inl x)).Subsingleton := by + have hd : @SimpleGraph.degree _ J (Sum.inl x) (Fintype.ofFinite _) ≤ 1 := by + rcases hx with hx | hx + · exact MissingColorIncidenceEndpoint G psi a b hne hproper x hx + · have hJ : TwoColorIncidenceGraph G psi b a = J := by + ext z z' + cases z <;> cases z' <;> simp [J, TwoColorIncidenceGraph, or_comm] + rw [← hJ] + exact MissingColorIncidenceEndpoint G psi b a hne.symm hproper x hx + let : Fintype (J.neighborSet (Sum.inl x)) := Fintype.ofFinite _ + have hc : Fintype.card (J.neighborSet (Sum.inl x)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hd + intro z hz z' hz' + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hc ⟨z, hz⟩ ⟨z', hz'⟩) + have hnot : Sum.inl w ∉ TwoColorComponent G psi a b (Sum.inl u) := by + intro hwC + obtain ⟨s, t, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G psi a b hproper (Sum.inl u) + have endpoint (x : V) + (hxC : Sum.inl x ∈ TwoColorComponent G psi a b (Sum.inl u)) + (hx : a ∈ MissingColors G psi x ∨ b ∈ MissingColors G psi x) : + Sum.inl x = s ∨ Sum.inl x = t := by + by_contra hh + push Not at hh + have hxP : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {z | z ∈ p.support} + rw [hsupport] + exact hxC + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hh.1 hh.2 (leaf x hx)) hxP + have huE := endpoint u (by rfl) (Or.inl hau) + have hvE := endpoint v (by rw [hsame]; rfl) (Or.inr hbv) + have hwE := endpoint w hwC hw + rcases huE with huE | huE <;> rcases hvE with hvE | hvE <;> + rcases hwE with hwE | hwE + all_goals first + | exact huv (Sum.inl.inj (huE.trans hvE.symm)) + | exact hwu (Sum.inl.inj (hwE.trans huE.symm)) + | exact hwv (Sum.inl.inj (hwE.trans hvE.symm)) + have hdis : Disjoint (TwoColorComponent G psi a b (Sum.inl w)) + (TwoColorComponent G psi a b (Sum.inl u)) := by + rcases TwoColorComponentsDisjoint G psi a b (Sum.inl w) (Sum.inl u) with hh | hh + · exact (hnot (by rw [← hh]; rfl)).elim + · exact hh + refine ⟨hdis, ⟨hne, Sum.inl w, by rfl, leaf w hw⟩, ?_⟩ + let Q := TwoColorComponent G psi a b (Sum.inl w) + let tau := TwoColorComponentSwap G psi a b (Sum.inl w) + have huQ : Sum.inl u ∉ Q := by + intro hh + exact Set.disjoint_left.mp hdis hh (by rfl) + have hvQ : Sum.inl v ∉ Q := by + intro hh + exact Set.disjoint_left.mp hdis hh (by rw [hsame]; rfl) + obtain ⟨outside, -, -, unaffected⟩ := + TwoColorComponentSwapMissingBehavior G psi a b hne hproper (Sum.inl w) + have edgeIn {x : V} {e : E} (hx : Sum.inl x ∈ Q) + (hi : Incident G x e) (hc : psi e = some a ∨ psi e = some b) : + Sum.inr e ∈ Q := by + change J.connectedComponentMk (Sum.inl x) = J.connectedComponentMk (Sum.inl w) at hx + change J.connectedComponentMk (Sum.inr e) = J.connectedComponentMk (Sum.inl w) + have ha : J.Adj (Sum.inr e) (Sum.inl x) := ⟨hi, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj ha).trans hx + intro x hx + by_cases hxQ : Sum.inl x ∈ Q + · have haNot : a ∉ MissingColors G psi x := by + intro ha + by_cases hxu : x = u + · exact huQ (hxu ▸ hxQ) + · exact Finset.disjoint_left.mp (helem hx hu hxu) ha hau + have hbNot : b ∉ MissingColors G psi x := by + intro hb + by_cases hxv : x = v + · exact hvQ (hxv ▸ hxQ) + · exact Finset.disjoint_left.mp (helem hx hv hxv) hb hbv + have present (c : Fin k) (hc : c ∉ MissingColors G psi x) : + ∃ e, Incident G x e ∧ psi e = some c := by + simpa [MissingColors, PresentColors] using hc + obtain ⟨ea, hia, hca⟩ := present a haNot + obtain ⟨eb, hib, hcb⟩ := present b hbNot + have haNew : a ∉ MissingColors G tau x := by + have heQ := edgeIn hxQ hib (Or.inr hcb) + have hcol : tau eb = some a := by + simp [tau, TwoColorComponentSwap, show Sum.inr eb ∈ + TwoColorComponent G psi a b (Sum.inl w) from heQ, hcb, hne.symm] + exact fun hm => (Finset.mem_sdiff.mp hm).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, eb, hib, hcol⟩) + have hbNew : b ∉ MissingColors G tau x := by + have heQ := edgeIn hxQ hia (Or.inl hca) + have hcol : tau ea = some b := by + simp [tau, TwoColorComponentSwap, show Sum.inr ea ∈ + TwoColorComponent G psi a b (Sum.inl w) from heQ, hca] + exact fun hm => (Finset.mem_sdiff.mp hm).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, ea, hia, hcol⟩) + ext c + by_cases hca : c = a + · subst c + exact iff_of_false haNew haNot + · by_cases hcb : c = b + · subst c + exact iff_of_false hbNew hbNot + · exact unaffected x c hca hcb + · exact outside x hxQ + have firstMissingVertex (psi : PartialEdgeColoring E k) (U : TreeSequence G e0) + (i : Fin (U.length + 1)) (c : Fin k) + (hc : c ∈ MissingColors G psi (U.vertex i)) : + c ∈ MissingColors G psi (U.vertex (HierarchyFirstMissingPosition psi U c)) ∧ + (HierarchyFirstMissingPosition psi U c).val ≤ i.val := by as_aux_lemma => + clear * - psi U i c hc + let candidates := Finset.univ.filter fun r : Fin (U.length + 1) => + c ∈ MissingColors G psi (U.vertex r) + have hi : i ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hc⟩ + have hn : candidates.Nonempty := ⟨i, hi⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact ⟨(Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2, + Finset.min'_le candidates i hi⟩ + let H := R.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + exact @helper_continuation_286 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@beta) + (@hpathLower) (@hpathUpper) (@hvertexMissing) (@R) (@hconditionOutside) + (@initialBetaBefore) (@initialBetaLast) (@initialSuffix) (@theta) (@hthetaUnstored) + (@initialThetaJ) (@initialThetaGamma) (@componentData) (@firstMissingVertex) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean new file mode 100644 index 0000000000..fa4d493d96 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean @@ -0,0 +1,1685 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.EligibleIndexBoundConstruction + +/-! +# Hierarchy Situation Three Eligible Index Bound + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open EligibleIndexBound + +private theorem helper_branch_2404.{u_1, u_2} : + helperBranch2404Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B hBlength r f S + hSBlen beta hab sigma lastPositive positiveB aboveB strictB belowB generatingB baseB HB EB + corr bs baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK + dividerStageK KF hpS lastOrdinary hlastLength hlt + right + refine ⟨Nat.le_antisymm hpS (by omega), ?_⟩ + have hidx : (⟨HB.dividerCount, by omega⟩ : Fin (HB.dividerCount + 2)) = + (Fin.last HB.dividerCount).castSucc := Fin.ext rfl + have hidxH : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + (Fin.last H.dividerCount).castSucc := Fin.ext rfl + rw [hidx, hidxH, lastOrdinary] + dsimp only + omega + +private theorem helper_sameLast_4591.{u_1, u_2} : + helperSameLast4591Conditions.{u_1, u_2} := by + classical + intro V E G e0 a b s t u v hab hst huv + cases hab + have he : s = t := eq_of_heq hst + cases he + cases huv + rfl + +private theorem helper_continuation_5341.{u_1, u_2} : + helperContinuation5341Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hpathLower P alpha old H A n Tn mu hp + hpUpper htail trans hlenT B X hBlength hXlength hBT hXB hTnX r f y consecutive hyf S hSBlen + beta hbetaF z hzB hbetaz hzy hzX hab sigma fixed missingFixed fixedB missingTree minusEq + lastPositive positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB goodB EB + coreBX closureBX corr hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK + strictK coreInsideK positiveK increasingK dividerStageK KF starredEq stageBX starBX + allStageB terminalTree terminalStored + have storedEq (j : Fin (HB.dividerCount + 1)) : + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j := by + unfold HierarchyStoredColorsAt + dsimp only + rw [terminalStored, starredEq j, missingTree _ (starBX j)] + have stageMissingEq (j : Fin (HB.dividerCount + 1)) : + HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by + exact helper_stageMissingEq_2235 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) + (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) + (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) + (@stageBX) (@terminalTree) (@j) + have earlyMissing (j : Fin (B.length + 1)) (hj : j.val < B.length) : + MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j) := by + exact helper_earlyMissing_2244 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hlenT) (@hBlength) (@hXlength) (@hXB) (@S) (@hSBlen) (@beta) + (@hab) (@missingFixed) (@lastPositive) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@j) (@hj) + -- Last-vertex changes preserve the totalized least missing position. + have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) + (j : Fin (B.length + 1)) (hj : c ∈ MissingColors G psi (B.vertex j)) : + (HierarchyFirstMissingPosition psi B c).val ≤ j.val := by + exact helper_firstLe_2252 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@hlenT) (@psi) (@c) (@j) (@hj) + have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition psi B c).val < B.length) : + c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c)) := by + exact helper_firstMem_2262 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@hlenT) (@hBlength) (@S) (@hSBlen) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@psi) (@c) (@hlt) + have firstEq (c : Fin k) : HierarchyFirstMissingPosition sigma B c = + HierarchyFirstMissingPosition mu B c := by + exact helper_firstEq_1174 G k e0 input T phi ett base C ctx P alpha hlenT hBlength S hSBlen + positiveB aboveB strictB belowB generatingB baseB HB earlyMissing firstLe firstMem c + have stageFixed (j : Fin (HB.dividerCount + 1)) (t : Fin (HB.stage j.succ).length) : + sigma ((HB.stage j.succ).edge t) = mu ((HB.stage j.succ).edge t) := by + rw [← (allStageB j.succ).2.2 t] + exact fixedB _ + have segmentEq (j : Fin (HB.dividerCount + 1)) (c : Fin k) : + HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by + apply helper_segmentEq_2283 <;> assumption + let goodS : GoodHierarchy KF := by + exact @helperGoodS3640 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) + (@hlenT) (@hTnX) (@missingFixed) (@missingTree) (@minusEq) (@positiveB) (@aboveB) + (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@coreBX) (@closureBX) + (@corr) (@bs) (@hcore) (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) + (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) + (@stageBX) (@terminalTree) (@storedEq) (@stageMissingEq) (@segmentEq) + have hbetaY : beta ∈ MissingColors G sigma y := by + apply helper_hbetaY_2355 <;> assumption + have hnotElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := by + exact helper_hnotElementary_2365 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hlenT) (@beta) (@z) (@hzB) (@hbetaz) (@hzy) (@hzX) + (@missingFixed) (@hbetaY) + let CS : HierarchyCounterexample bs := { + positive := by rw [corr.rungAgreement]; exact old.positive + hierarchy := KF + good := goodS + maximum := hmaximum + notElementary := hnotElementary } + have lastStar : HierarchyStarredStage KF (Fin.last KF.dividerCount) = A := by + exact helper_lastStar_2378 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) + (@baseB) (@HB) (@hcountB) (@hstagesB) (@corr) (@bs) (@baseStageK) (@terminalStageK) + (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) + (@starredEq) + have hpS : HierarchyPathNumber KF ≤ HierarchyPathNumber H := by + exact helper_hpS_844 G k e0 input T phi ett base C ctx hpathLower P alpha hp hpUpper htail + hlenT hBT consecutive S hSBlen beta hab lastPositive positiveB aboveB strictB belowB + generatingB baseB HB corr bs baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK lastStar + have lastOrdinary : HB.stage (Fin.last HB.dividerCount).castSucc = + H.stage (Fin.last H.dividerCount).castSucc := by + apply helper_lastOrdinary_2387 <;> assumption + have hlastLength : (H.stage (Fin.last H.dividerCount).castSucc).length < B.length := by + have hh := HB.strict (Fin.last HB.dividerCount) + simpa only [lastOrdinary, Fin.succ_last, HB.terminalStage] using hh + -- The comparison is at the original rung and divider count. + apply P.minimumContext.lexicographicMinimality CS corr.rungAgreement hcountB + change HierarchyCounterexampleLess + (HierarchyPathNumber KF, B.length - (HB.stage ⟨HB.dividerCount, by omega⟩).length) + (HierarchyPathNumber H, T.length - (H.stage ⟨H.dividerCount, by omega⟩).length) + by_cases hlt : HierarchyPathNumber KF < HierarchyPathNumber H + · exact Or.inl hlt + · apply helper_branch_2404 <;> assumption +private theorem helper_continuation_5697.{u_1, u_2} : + helperContinuation5697Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hpathLower P alpha old H A n Tn mu hp + hpUpper htail trans chain coreA hTnA hlenT B X hBlength hXlength hBT hAX hXB hTnX hAB r f y + w consecutive hends hyf S hSBlen beta hbetaF z hzB hbetaz hzy hzX hab sigma fixed hsproper + hsone incidentFixed missingFixed fixedB stable hrouteB missingTree + have boundaryEq (U : TreeSequence G e0) + (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) (c : Fin k) : + BoundaryColorEdges G sigma (TreeSequenceVertexSet U) c = + BoundaryColorEdges G mu (TreeSequenceVertexSet U) c := by + exact helper_boundaryEq_2121 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hlenT) (@hends) (@incidentFixed) (@U) (@hUX) (@c) + have minusEq (U : TreeSequence G e0) + (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) (R : Finset (Fin k)) : + TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R := by + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [missingTree U hUX] + simp only [boundaryEq U hUX] + have lastPositive (hq : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact helper_lastPositive_2137 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@hlenT) (@S) (@hSBlen) (@hq) + have ordinaryA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + exact helper_ordinaryA_2146 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@chain) (@hTnA) (@hlenT) (@S) (@hSBlen) (@lastPositive) (@j) + have starA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + refine Fin.cases coreA (fun i => ordinaryA i.succ) j + -- Retain the old prefix data; construct the recolored ETT separately. + obtain ⟨eb, hmaxB, hrungB, hseriesB, baseB, hcoreB, hclosureB, hsupportB, + HB, hcountB, hstagesB, hdividersB, goodB, hcolorsB⟩ := + GoodHierarchyTerminalPrefixRepackage G k e0 P.corresponding.replacementInput T + mu mu P.corresponding.replacementETT old.maximum P.replacementBase H old.good + B hAB (by change A.length < B.length; omega) hBT + rcases eb with ⟨roundsB, positiveB, seriesB, aboveB, strictB, belowB, generatingB⟩ + dsimp only at hrungB hseriesB + cases hrungB + have hs : seriesB = P.corresponding.replacementETT.series := eq_of_heq hseriesB + cases hs + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := { + rounds := P.corresponding.replacementETT.rounds + roundsPositive := positiveB + series := P.corresponding.replacementETT.series + abovePenultimate := aboveB + strictAbovePenultimate := strictB + belowFinal := belowB + generatingColoring := generatingB } + have coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X := by + rw [hcoreB] + exact TreeSequenceInitialSegmentVertexSetSubset (trans coreA hAX) + have closureBX (hpe : EB.series.data.kind (Fin.last EB.rounds) = + some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X := by + exact helper_closureBX_2180 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) + (@coreBX) (@hpe) + -- PE preparation rebuilds the base; SE/RE retain the exact seed. + have hdata : ∃ corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B, + MaximumProperty corr.replacementETT ∧ + ∃ bs : HierarchyBase corr.replacementETT sigma, + ∃ K : TashkinovHierarchy corr.replacementETT bs, + SameHierarchyStages HB K := by + apply helper_hdata_519 <;> assumption + obtain ⟨corr, hmaximum, bs, K, hsame⟩ := hdata + let KF := K + rcases hsame with ⟨hcore, hcount, hstage, hposition, hpe, hclosure⟩ + rcases K with ⟨qK, stageK, baseStageK, terminalStageK, nestedK, strictK, + positionK, positiveK, increasingK, dividerStageK, coreInsideK⟩ + change HB.dividerCount = qK at hcount + cases hcount + have hs : HB.stage = stageK := eq_of_heq hstage + cases hs + have hpos : HB.dividerPosition = positionK := eq_of_heq hposition + cases hpos + have starredEq (j : Fin (HB.dividerCount + 1)) : + HierarchyStarredStage KF j = HierarchyStarredStage HB j := by + refine Fin.cases hcore.symm (fun _ => rfl) j + have stageBX (j : Fin (HB.dividerCount + 1)) : + TreeSequenceInitialSegment (HB.stage j.castSucc) X := by + rw [(hstagesB j).1] + exact trans (ordinaryA _) hAX + have starBX (j : Fin (HB.dividerCount + 1)) : + TreeSequenceVertexSet (HierarchyStarredStage HB j) ⊆ TreeSequenceVertexSet X := by + rw [(hstagesB j).2] + exact TreeSequenceInitialSegmentVertexSetSubset (trans (starA _) hAX) + have allStageB (j : Fin (HB.dividerCount + 2)) : + TreeSequenceInitialSegment (HB.stage j) B := by + exact Fin.reverseInduction (motive := fun j => + TreeSequenceInitialSegment (HB.stage j) B) + (by rw [HB.terminalStage]; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩) + (fun i hi => trans (HB.nested i) hi) j + have terminalTree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + exact helper_terminalTree_1110 G k e0 input T phi ett base C ctx P alpha hp hlenT S hSBlen + positiveB aboveB strictB belowB generatingB baseB HB corr hmaximum bs hcore hpe + hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK + dividerStageK hstage hposition starredEq + have terminalStored : TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = TashkinovStoredColors EB.series.data + (Fin.last EB.rounds) := by + exact helper_terminalStored_647 G k e0 input T phi ett base C ctx P alpha hp hlenT hTnX S + hSBlen missingTree positiveB aboveB strictB belowB generatingB baseB HB corr hmaximum + bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK + increasingK dividerStageK hstage hposition starredEq terminalTree + exact @helper_continuation_5341 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hpathLower) + (@P) (@alpha) (@hp) (@hpUpper) (@htail) (@trans) (@hlenT) (@hBlength) (@hXlength) (@hBT) + (@hXB) (@hTnX) (@consecutive) (@hyf) (@S) (@hSBlen) (@beta) (@hbetaF) (@z) (@hzB) (@hbetaz) + (@hzy) (@hzX) (@hab) (@fixed) (@missingFixed) (@fixedB) (@missingTree) (@minusEq) + (@lastPositive) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) + (@hcountB) (@hstagesB) (@goodB) (@coreBX) (@closureBX) (@corr) (@hmaximum) (@bs) (@hcore) + (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) + (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) (@stageBX) (@starBX) (@allStageB) + (@terminalTree) (@terminalStored) + +private theorem helper_shortening_124.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), (2 : ℕ) ≤ + HierarchyPathNumber C.hierarchy → HierarchyPathNumber C.hierarchy < + HierarchyFullTailLength C → HierarchyFullTailLength C - (1 : ℕ) ∈ + HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hpathLower hpathUpper hlast + classical + open scoped Sym2 in + obtain ⟨P, alpha, haB, haT⟩ := (Finset.mem_filter.mp hlast).2 + let old := P.counterexample + let H := old.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let n := Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let mu := P.coloring + have sameLast : + ∀ {a b : ℕ} (s : Fin (a + 2) → TreeSequence G e0) (t : Fin (b + 2) → TreeSequence G e0) (u v : + TreeSequence G e0), a = b → HEq s t → u = v → Fin.cases (motive := fun _ => TreeSequence G + e0) u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = Fin.cases (motive := fun _ => + TreeSequence G e0) v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by + apply helper_sameLast_4591 + have hAold : HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A := + sameLast _ _ _ _ P.sameGood.1.2.1 P.sameGood.1.2.2.1 P.sameGood.1.1 + have hp : HierarchyPathNumber H = HierarchyPathNumber C.hierarchy := by + unfold HierarchyPathNumber + dsimp only + rw [hAold] + have hpLower : 2 ≤ HierarchyPathNumber H := by rw [hp]; exact hpathLower + have hpUpper : HierarchyPathNumber H < T.length - A.length := by + exact helper_hpUpper_1652 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hpathUpper) (@P) (@hAold) (@hp) + have htail : 2 ≤ T.length - A.length := + HierarchyCounterexampleTailAtLeastTwo G k e0 P.corresponding.replacementInput + T mu P.corresponding.replacementETT P.replacementBase old + P.minimumContext.proper P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality P.minimumContext.largeMissingSet + have trans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + exact helper_trans_1665 (@G) (@e0) (@hXY) (@hYZ) + have chain : ∀ (j : ℕ) (hj : j < H.dividerCount + 2) + (i : Fin (H.dividerCount + 2)), i.val ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage ⟨j, hj⟩) := by + apply helper_chain_775; assumption + have starNext (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) (H.stage j.succ) := by + refine Fin.cases H.coreInsideFirst (fun i => H.nested i.succ) j + have hAT : TreeSequenceInitialSegment A T := by + have hh := starNext (Fin.last H.dividerCount) + simpa only [Fin.succ_last, H.terminalStage] using hh + have hTnCore : TreeSequenceInitialSegment Tn P.replacementBase.core := by + exact helper_hTnCore_1684 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have coreA : TreeSequenceInitialSegment P.replacementBase.core A := by + apply helper_coreA_200 <;> assumption + have hTnA := trans hTnCore coreA + have hlenT : 3 ≤ T.length := by have := A.positive; omega + let B := TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + let X := TreeSequencePrefix T (T.length - 2) (by omega) (by omega) + have hBlength : B.length = T.length - 1 := rfl + have hXlength : X.length = T.length - 2 := rfl + have hBT : TreeSequenceInitialSegment B T := ⟨by omega, + fun _ => rfl, fun _ => rfl⟩ + have hXT : TreeSequenceInitialSegment X T := ⟨by omega, + fun _ => rfl, fun _ => rfl⟩ + have common {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + apply helper_common_1702 <;> assumption + have hAX : TreeSequenceInitialSegment A X := common hAT hXT (by omega) + have hXB : TreeSequenceInitialSegment X B := common hXT hBT (by omega) + have hTnX := trans hTnA hAX + have hAB := trans hAX hXB + have hfull : HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) = B := by + exact helper_hfull_1715 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@hAold) (@htail) (@hlenT) + have halphaB : alpha ∈ MissingColors G mu (B.vertex (Fin.last B.length)) := by + rw [hfull] at haB + exact haB + let r : Fin T.length := ⟨T.length - 1, by omega⟩ + let f := T.edge r + let y := B.vertex (Fin.last B.length) + let w := T.vertex (Fin.last T.length) + have hy : T.vertex r.castSucc = y := by rfl + have hw : T.vertex r.succ = w := by + apply congrArg T.vertex + apply Fin.ext + dsimp [r] + omega + have consecutive (t : Fin T.length) + (ht : A.length + HierarchyPathNumber H ≤ t.val) : + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by + exact helper_consecutive_852 G k e0 input T phi ett base C ctx P hpUpper hlenT t ht + have hends : G.ends f = s(y, w) := + (consecutive r (by dsimp [r]; omega)).trans (by rw [hy, hw]) + have hyf : Incident G y f := by rw [Incident, hends]; exact Sym2.mem_mk_left _ _ + have hwf : Incident G w f := by rw [Incident, hends]; exact Sym2.mem_mk_right _ _ + have hsource : ∃ S : TreeSequence G e0, + S.length ≤ B.length ∧ TashkinovAugmentationSequence mu S T := by + exact helper_hsource_1746 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@hlenT) (@hBlength) (@hXlength) (@hTnX) + obtain ⟨S, hSBlen, hseq⟩ := hsource + obtain ⟨hlen, hpre, beta, hbetaColor, hbetaMissing⟩ := + (TashkinovAugmentationSequencePosition mu S T hseq r + (by simpa only [B, TreeSequencePrefix, r] using hSBlen)).1 + have hbetaF : mu f = some beta := by + convert hbetaColor using 1 + congr 2 + have hbetaB : beta ∈ TreeMissingColors mu B := hbetaMissing + obtain ⟨z, hzB, hbetaz⟩ := Finset.mem_biUnion.mp hbetaB + have hzy : z ≠ y := by + exact helper_hzy_1763 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hlenT) (@hyf) (@beta) (@hbetaF) (@z) (@hzB) (@hbetaz) + have hzX : z ∈ TreeSequenceVertexSet X := by + apply helper_hzX_1770 <;> assumption + have hab : alpha ≠ beta := by + intro he + have halphaPresent : alpha ∈ PresentColors G mu y := by + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hyf, by rw [he]; exact hbetaF⟩ + exact (Finset.mem_sdiff.mp halphaB).2 halphaPresent + let sigma : PartialEdgeColoring E k := fun e => if e = f then some alpha else mu e + have fixed (e : E) (hef : e ≠ f) : sigma e = mu e := by simp [sigma, hef] + have hsproper : IsProperEdgeColoring G sigma := by + exact @helper_hsproper_329 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx P alpha haT trans hlenT halphaB hends fixed + have hfe0 : f ≠ e0 := by + apply helper_hfe0_1788 <;> assumption + have hsone : IsOneEdgeUncolored sigma e0 := by + exact helper_hsone_1794 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@hlenT) (@fixed) (@hfe0) + have noInc (v : V) (hv : v ∈ TreeSequenceVertexSet X) : ¬ Incident G v f := by + apply helper_noInc_930 <;> assumption + have incidentFixed (e : E) (he : TreeIncidentEdge X e) : sigma e = mu e := by + apply fixed + intro hef + obtain ⟨v, hv, hi⟩ := he + exact noInc v hv (hef ▸ hi) + have missingFixed (v : V) (hv : v ∈ TreeSequenceVertexSet X) : + MissingColors G sigma v = MissingColors G mu v := by + apply helper_missingFixed_1810 <;> assumption + have fixedB (t : Fin B.length) : sigma (B.edge t) = mu (B.edge t) := by + apply helper_fixedB_2088 <;> assumption + have stable : StableColoring Tn + (TashkinovStoredColors P.corresponding.replacementETT.series.data n) + (P.corresponding.replacementETT.series.data.coloring n) sigma := by + exact helper_stable_2096 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@hlenT) (@hTnX) (@incidentFixed) (@missingFixed) + have hrouteB : + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B) ∨ + ((P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = {edge} ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ + TashkinovAugmentationSequence sigma seed B) := by + apply helper_hrouteB_979 <;> assumption + have missingTree (U : TreeSequence G e0) + (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) : + TreeMissingColors sigma U = TreeMissingColors mu U := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => missingFixed v (hUX hv)) + exact @helper_continuation_5697 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@hpathLower) (@P) (@alpha) (@hp) (@hpUpper) (@htail) (@trans) (@chain) (@coreA) (@hTnA) + (@hlenT) (@hBlength) (@hXlength) (@hBT) (@hAX) (@hXB) (@hTnX) (@hAB) (@consecutive) + (@hends) (@hyf) (@S) (@hSBlen) (@beta) (@hbetaF) (@z) (@hzB) (@hbetaz) (@hzy) (@hzX) + (@hab) (@fixed) (@hsproper) (@hsone) (@incidentFixed) (@missingFixed) (@fixedB) (@stable) + (@hrouteB) (@missingTree) +private theorem helper_tailException_1151.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → TreeSequenceInitialSegment A T → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ + by omega + ); TreeSequenceInitialSegment B T → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), + HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), (1 : ℕ) ≤ + j → j < T.length - A.length → + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = + some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans A starEq hAT hlen B hBT fullEq fullB + elementary vertexMem R j hj hjlt c hc t hlo hhi hcol + clear * - R j hj hjlt c hc t hlo hhi hcol starEq hAT hBT fullEq fullB elementary vertexMem + let U := HierarchyFullTailPrefix R.counterexample j + have hUlen : U.length = A.length + j := by + simp only [U, HierarchyFullTailPrefix, TreeSequencePrefix] + rw [starEq R] + exact min_eq_left (by have := hAT.1; omega) + have hUT : TreeSequenceInitialSegment U T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + let u : Fin U.length := ⟨t.val, by rw [hUlen]; omega⟩ + have hut : Fin.castLE hUT.1 u = t := Fin.ext rfl + have hcU : c ∈ MissingColors G R.coloring (U.vertex (Fin.last U.length)) := by + dsimp only [U] + rw [fullEq R] + exact hc + have hcolU : R.coloring (U.edge u) = some c := by + rw [← hUT.2.2 u, hut]; exact hcol + have hex := HierarchyTailMissingColorExclusion G k e0 R.corresponding.replacementInput T + R.coloring R.corresponding.replacementETT R.replacementBase R.counterexample.hierarchy + (by + change ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1))) + rw [fullB R] + exact elementary R) + j hj (by + rw [starEq R] + exact hjlt) c hcU u + (by + change (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length ≤ t.val + rw [starEq R] + exact hlo) + (by + change t.val < (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + j + rw [starEq R] + exact hhi) hcolU + obtain ⟨hzero, hcore, hval, f, hstep, hkind, hedges, hedge, hcF, hstored⟩ := hex + have hAval : t.val = A.length := by + change u.val = _ at hval + rw [starEq R] at hval + exact hval + have hAn : A = R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc := by + rw [← starEq R] + have hs : HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = R.replacementBase.core := by + simp [HierarchyStarredStage, hzero, Fin.last] + exact hs.trans hcore + obtain ⟨i, hi⟩ := T.attaches t + let a : Fin (A.length + 1) := ⟨i.val, by simpa only [hAval] using i.isLt⟩ + let old : Fin (T.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ t.isLt)) + have ha : Fin.castLE (Nat.succ_le_succ hAT.1) a = old := Fin.ext rfl + refine ⟨⟨T.vertex old, ?_, ?_⟩, hstored⟩ + · rw [← hAn, ← ha, hAT.2.1 a] + exact vertexMem A a + · rw [Incident, hi] + exact Sym2.mem_mk_right _ _ + +private theorem helper_branch_1318.{u_1, u_2} : + helperBranch1318Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A hlen B vertexMem firstAt stageSwitch + gammaTransport gammaChoice m P alpha haLast hm hmT X hAX hXB hAXlt jm jnext tnext haM theta + htheta nextMember excNext excM avoidM hAlphaStored + obtain ⟨gamma, hgamma, hgap⟩ := gammaChoice P alpha hAlphaStored (T.edge tnext) + obtain ⟨P1, hmissing1, hfixed1, _, hterminal1⟩ := stageSwitch P X hAX hAXlt hXB + gamma alpha alpha hAlphaStored hgamma + (by rw [firstAt P alpha jm haM]; dsimp [jm, X, TreeSequencePrefix]; omega) + jm (by dsimp [jm]; omega) (by dsimp [jm, X, TreeSequencePrefix]; omega) + haM (Or.inr haLast) (avoidM P alpha gamma hAlphaStored hgamma haM hgap) + (excM P alpha haM) + have hgLast : gamma ∈ MissingColors G P1.coloring (T.vertex (Fin.last T.length)) := hterminal1 + haLast + have haM1 : alpha ∈ MissingColors G P1.coloring (B.vertex jm) := by + rw [hmissing1 _ (vertexMem B jm)]; exact haM + have htheta1 : theta ∈ MissingColors G P1.coloring (B.vertex jnext) := by + rw [hmissing1 _ (vertexMem B jnext)]; exact htheta + obtain ⟨hAlphaStored1, heqGamma⟩ := gammaTransport P P1 alpha hAlphaStored + have hgamma1 : gamma ∈ P1.counterexample.good.gamma + (Fin.last P1.counterexample.hierarchy.dividerCount) alpha := by + rw [← heqGamma]; exact hgamma + have hgap1 : P1.coloring (T.edge tnext) ≠ some gamma := by + rw [hfixed1 tnext (by dsimp [tnext]; omega) + (by dsimp [tnext, X, TreeSequencePrefix]; omega)] + exact hgap + obtain ⟨P2, hmissing2, _, hterminal2, _⟩ := stageSwitch P1 X hAX hAXlt hXB + gamma theta alpha hAlphaStored1 hgamma1 + (by rw [firstAt P1 alpha jm haM1]; dsimp [jm, X, TreeSequencePrefix]; omega) + jnext (by dsimp [jnext]; omega) (by rfl) + htheta1 (Or.inl hgLast) (avoidM P1 alpha gamma hAlphaStored1 hgamma1 haM1 hgap1) + (excNext P1 theta htheta1) + exact nextMember P2 theta (by rw [hmissing2 _ (vertexMem B jnext)]; exact htheta1) + (hterminal2 hgLast) + +private theorem helper_branch_1872.{u_1, u_2} : + helperBranch1872Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A hlen B vertexMem firstAt stageSwitch + gammaTransport gammaChoice m P alpha haLast hm hmT X hAX hXB hAXlt jm jnext tnext haM theta + htheta nextMember excNext excM avoidNext hThetaStored + obtain ⟨gamma, hgamma, _⟩ := gammaChoice P theta hThetaStored (T.edge tnext) + obtain ⟨P1, hmissing1, _, _, hterminal1⟩ := stageSwitch P X hAX hAXlt hXB + gamma alpha theta hThetaStored hgamma + (by rw [firstAt P theta jnext htheta]; exact le_rfl) + jm (by dsimp [jm]; omega) (by dsimp [jm, X, TreeSequencePrefix]; omega) + haM (Or.inr haLast) (avoidNext P theta gamma hThetaStored hgamma htheta) + (excM P alpha haM) + have hgLast : gamma ∈ MissingColors G P1.coloring (T.vertex (Fin.last T.length)) := hterminal1 + haLast + have htheta1 : theta ∈ MissingColors G P1.coloring (B.vertex jnext) := by + rw [hmissing1 _ (vertexMem B jnext)]; exact htheta + obtain ⟨hThetaStored1, heqGamma⟩ := gammaTransport P P1 theta hThetaStored + have hgamma1 : gamma ∈ P1.counterexample.good.gamma + (Fin.last P1.counterexample.hierarchy.dividerCount) theta := by + rw [← heqGamma]; exact hgamma + obtain ⟨P2, hmissing2, _, hterminal2, _⟩ := stageSwitch P1 X hAX hAXlt hXB + gamma theta theta hThetaStored1 hgamma1 + (by rw [firstAt P1 theta jnext htheta1]; exact le_rfl) + jnext (by dsimp [jnext]; omega) (by rfl) + htheta1 (Or.inl hgLast) (avoidNext P1 theta gamma hThetaStored1 hgamma1 htheta1) + (excNext P1 theta htheta1) + exact nextMember P2 theta (by rw [hmissing2 _ (vertexMem B jnext)]; exact htheta1) + (hterminal2 hgLast) + +private theorem helper_continuation_2372.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ + by omega + ); TreeSequenceInitialSegment B T → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + ∀ (m : ℕ) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), + ∀ (hm : (2 : ℕ) ≤ m) (hmT : A.length + (m + (1 : ℕ)) < T.length), + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (m + (1 : ℕ))) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (m + (1 : ℕ))) ↦ + by omega + ) (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) ≤ T.length) ↦ + by + omega + ); + let jm : Fin (B.length + (1 : ℕ)) := (⟨A.length + m, id (Decidable.byContradiction fun (a : + ¬A.length + m < T.length - (1 : ℕ) + (1 : ℕ)) ↦ + by omega + )⟩ : Fin (B.length + (1 : ℕ))); + let jnext : Fin (B.length + (1 : ℕ)) := (⟨A.length + (m + (1 : ℕ)), id + (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) < T.length - (1 : ℕ) + (1 : + ℕ)) ↦ + by + omega + )⟩ : Fin (B.length + (1 : ℕ))); + ∀ theta ∈ MissingColors G P.coloring (B.vertex jnext), ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ MissingColors G S.coloring (B.vertex jnext), c ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length)) → m + (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T + phi ett base C ctx) → alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) → theta ∉ HierarchyStoredColorsAt + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + alpha) → alpha ≠ theta → (↑(HierarchyFirstMissingPosition P.coloring T alpha) : ℕ) = (↑jm + : ℕ) → (↑(HierarchyFirstMissingPosition P.coloring T theta) : ℕ) = (↑jnext : ℕ) → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) (T.vertex + (HierarchyFirstMissingPosition P.coloring T theta)) → ColoredVertexSetElementary G + P.coloring (TreeSequenceVertexSet (HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)))) → alpha ∈ TreeMissingColors + P.coloring (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength + P.counterexample - (1 : ℕ))) ∧ theta ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 : + ℕ))) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G P.coloring alpha theta + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G P.coloring x) → + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha theta (Sum.inl + (T.vertex (Fin.last T.length))); ( + ∀ v ∈ TreeSequenceVertexSet A, TreeVertexOrder T v (T.vertex (HierarchyFirstMissingPosition + P.coloring T alpha))) → m + (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T + phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans A starEq hlen B hBT vertexMem m P + alpha haLast hm hmT X jm jnext theta htheta nextMember hAlphaStored hThetaStored haUnused + hne iaEq ibEq hordered hprefixP hmissingP hmissing sigma hprecedes + have hunusedBetween : alpha ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + (HierarchyFirstMissingPosition P.coloring T alpha).val ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition P.coloring T theta).val ∧ + P.coloring (T.edge t) = some c) := by + intro hh + obtain ⟨_, t, hlo, hhi, hc⟩ := Finset.mem_filter.mp hh + rw [iaEq] at hlo + rw [ibEq] at hhi + exact haUnused t (by dsimp [jm] at hlo; omega) hhi hc + obtain ⟨_, _, _, _, corr, hmaximum, bs, K, goodK, hsameGood⟩ := + StableChangeCaseThree G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext.proper P.minimumContext.oneEdgeUncolored P.minimumContext.lowerRung + P.minimumContext.fewerDividers P.minimumContext.lexicographicMinimality hprefixP + P.minimumContext.largeMissingSet alpha theta hne hmissingP _ sigma rfl + (by rw [starEq P]; exact hprecedes) hordered + ⟨hAlphaStored, hThetaStored⟩ hunusedBetween + have hthetaLast : theta ∈ MissingColors G sigma (T.vertex (Fin.last T.length)) := + (TwoColorComponentSwapMissingBehavior G P.coloring alpha theta hne + P.minimumContext.proper (Sum.inl (T.vertex (Fin.last T.length)))).2.1 _ (by rfl) haLast + have hthetaNext : theta ∈ MissingColors G sigma (B.vertex jnext) := by + rw [hmissing _ (vertexMem B jnext)] + exact htheta + have hnot : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) := by + intro he + exact Finset.disjoint_left.mp (he + (TreeSequenceInitialSegmentVertexSetSubset hBT (vertexMem B jnext)) + (vertexMem T (Fin.last T.length)) (by + intro hh + have hh := T.vertex_injective ((hBT.2.1 jnext).trans hh) + have hh := congrArg Fin.val hh; dsimp [jnext] at hh; omega)) hthetaNext hthetaLast + let CS : HierarchyCounterexample bs := { + positive := by rw [corr.rungAgreement]; exact P.counterexample.positive + hierarchy := K + good := goodK + maximum := hmaximum + notElementary := hnot } + obtain ⟨S, hS⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi ett base C ctx + P sigma corr bs CS hsameGood + exact nextMember S theta (by rw [hS]; exact hthetaNext) (by rw [hS]; exact hthetaLast) + +private theorem helper_branch_1894.{u_1, u_2} : + helperBranch1894Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx componentData trans A starEq hAT hlen B hBT + fullB elementary vertexMem firstAt outsideA notRaw m P alpha ha haLast hm hmT X jm jnext + haM theta htheta nextMember excM hAlphaStored hThetaStored + have haOutside := outsideA P alpha jm (by dsimp [jm]; omega) haM + have hthetaOutside := outsideA P theta jnext (by dsimp [jnext]; omega) htheta + have haRaw := notRaw P alpha haOutside hAlphaStored + have hthetaRaw := notRaw P theta hthetaOutside hThetaStored + have haUnused : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + P.coloring (T.edge t) ≠ some alpha := by + intro t hlo hhi hc + exact haRaw (excM P alpha haM t hlo hhi hc).2 + have hne : alpha ≠ theta := by + intro he + have hvertices : B.vertex jm ≠ B.vertex jnext := by + intro hh + have hh := congrArg Fin.val (B.vertex_injective hh) + dsimp [jm, jnext] at hh + omega + exact Finset.disjoint_left.mp (elementary P + (vertexMem B jm) (vertexMem B jnext) hvertices) haM (he ▸ htheta) + have iaEq := firstAt P alpha jm haM + have ibEq := firstAt P theta jnext htheta + have jaEq : Fin.castLE (Nat.succ_le_succ hBT.1) jm = + HierarchyFirstMissingPosition P.coloring T alpha := Fin.ext iaEq.symm + have jbEq : Fin.castLE (Nat.succ_le_succ hBT.1) jnext = + HierarchyFirstMissingPosition P.coloring T theta := Fin.ext ibEq.symm + have hordered : TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) + (T.vertex (HierarchyFirstMissingPosition P.coloring T theta)) := + ⟨_, _, rfl, rfl, by dsimp [jm, jnext] at iaEq ibEq; omega⟩ + have hunused : alpha ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < (HierarchyFirstMissingPosition P.coloring T theta).val ∧ + P.coloring (T.edge t) = some c) := by + intro hh + obtain ⟨_, t, hlo, hhi, hc⟩ := Finset.mem_filter.mp hh + exact haUnused t hlo (by rw [ibEq] at hhi; exact hhi) hc + have haB : alpha ∈ TreeMissingColors P.coloring B := + Finset.mem_biUnion.mpr ⟨B.vertex jm, vertexMem B jm, haM⟩ + have hthetaB : theta ∈ TreeMissingColors P.coloring B := + Finset.mem_biUnion.mpr ⟨B.vertex jnext, vertexMem B jnext, htheta⟩ + have hprefixP : ColoredVertexSetElementary G P.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - 1))) := by + rw [fullB P] + exact elementary P + have hmissingP : alpha ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1)) ∧ + theta ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1)) + := by + rw [fullB P] + exact ⟨haB, hthetaB⟩ + have change := ChangeLemma G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext.proper P.minimumContext.oneEdgeUncolored P.minimumContext.lowerRung + P.minimumContext.fewerDividers P.minimumContext.lexicographicMinimality hprefixP + P.minimumContext.largeMissingSet alpha theta hne hmissingP + (by dsimp only; rw [starEq P]; intro _; exact ⟨hordered, hunused⟩) + have hdisStored : Disjoint ({alpha, theta} : Finset (Fin k)) + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)) := by + apply Finset.disjoint_left.mpr + intro c hc hd + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with rfl | rfl + · exact hAlphaStored hd + · exact hThetaStored hd + have hdisRaw : Disjoint ({alpha, theta} : Finset (Fin k)) + (TashkinovStoredColors P.corresponding.replacementETT.series.data + (Fin.last P.corresponding.replacementETT.rounds)) := by + apply Finset.disjoint_left.mpr + intro c hc hd + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with rfl | rfl + · exact haRaw hd + · exact hthetaRaw hd + have hsame : TwoColorComponent G P.coloring alpha theta (Sum.inl (B.vertex jm)) = + TwoColorComponent G P.coloring alpha theta (Sum.inl (B.vertex jnext)) := by + have hh : TwoColorComponent G P.coloring alpha theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha))) = + TwoColorComponent G P.coloring alpha theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T theta))) := by + by_cases hq : P.counterexample.hierarchy.dividerCount = 0 + · exact change.2.1 ⟨hq, Or.inr hdisRaw⟩ + · exact change.1 ⟨by omega, Or.inr hdisStored⟩ + rw [← jaEq, ← jbEq, hBT.2.1 jm, hBT.2.1 jnext] at hh + exact hh + obtain ⟨hdis, hpath, hmissing⟩ := componentData P.coloring alpha theta hne + P.minimumContext.proper (TreeSequenceVertexSet B) (elementary P) + (B.vertex jm) (B.vertex jnext) (T.vertex (Fin.last T.length)) + (vertexMem B jm) (vertexMem B jnext) + (by intro hh; have hh := congrArg Fin.val (B.vertex_injective hh) + dsimp [jm, jnext] at hh; omega) + (by intro hh; have hh := T.vertex_injective (hh.trans (hBT.2.1 jm).symm) + have hh := congrArg Fin.val hh; dsimp [jm] at hh; omega) + (by intro hh; have hh := T.vertex_injective (hh.trans (hBT.2.1 jnext).symm) + have hh := congrArg Fin.val hh; dsimp [jnext] at hh; omega) + haM htheta (Or.inl haLast) hsame + let sigma := TwoColorComponentSwap G P.coloring alpha theta + (Sum.inl (T.vertex (Fin.last T.length))) + have hprecedes : ∀ v ∈ TreeSequenceVertexSet A, + TreeVertexOrder T v (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) := by + intro v hv + obtain ⟨j, hj⟩ : ∃ j, A.vertex j = v := by simpa [TreeSequenceVertexSet] using hv + refine ⟨Fin.castLE (Nat.succ_le_succ hAT.1) j, _, (hAT.2.1 j).trans hj, rfl, ?_⟩ + change j.val < (HierarchyFirstMissingPosition P.coloring T alpha).val + rw [iaEq] + have := j.isLt + dsimp [jm] + omega + exact @helper_continuation_2372 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx trans starEq hlen hBT vertexMem m P alpha haLast hm hmT theta + htheta nextMember hAlphaStored hThetaStored haUnused hne iaEq ibEq hordered hprefixP + hmissingP hmissing hprecedes +private theorem helper_branch_1346.{u_1, u_2} : + helperBranch1346Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx componentData trans A starEq hAT hlen B hBT + fullB elementary vertexMem firstAt stageSwitch gammaTransport outsideA notRaw gammaChoice m + P alpha ha haLast hm hmT X hAX hXB hAXlt jm jnext tnext haM theta htheta nextMember excNext + excM avoidNext hAlphaStored + by_cases hThetaStored : theta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) + · exact @helper_branch_1872 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hlen vertexMem firstAt stageSwitch gammaTransport gammaChoice m + P alpha haLast hm hmT hAX hXB hAXlt haM theta htheta nextMember excNext excM avoidNext + hThetaStored + · exact @helper_branch_1894 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx componentData trans starEq hAT hlen hBT fullB elementary + vertexMem firstAt outsideA notRaw m P alpha ha haLast hm hmT haM theta htheta nextMember + excM hAlphaStored hThetaStored +private theorem helper_excM_2308.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); TreeSequenceInitialSegment A T → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ + by omega + ); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), (1 : ℕ) ≤ + j → j < T.length - A.length → + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = + some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → ( + ∀ (t : Fin T.length), A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ) → G.ends (T.edge + t) = s(T.vertex t.castSucc, T.vertex t.succ)) → + ∀ (m : ℕ), HierarchyPathNumber C.hierarchy ≤ m → + ∀ (hm : (2 : ℕ) ≤ m) (hmT : A.length + (m + (1 : ℕ)) < T.length), + let X : TreeSequence G e0 := TreeSequencePrefix T (A.length + (m + (1 : ℕ))) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + (m + (1 : ℕ))) ↦ + by omega + ) (Decidable.byContradiction fun (a : ¬A.length + (m + (1 : ℕ)) ≤ T.length) ↦ + by + omega + ); + let Y : TreeSequence G e0 := TreeSequencePrefix T (A.length + m) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + A.length + m) ↦ + by omega + ) (Decidable.byContradiction fun (a : ¬A.length + m ≤ T.length) ↦ + by omega + ); + let jm : Fin (B.length + (1 : ℕ)) := (⟨A.length + m, id (Decidable.byContradiction fun (a : + ¬A.length + m < T.length - (1 : ℕ) + (1 : ℕ)) ↦ + by omega + )⟩ : Fin (B.length + (1 : ℕ))); + let _ : Fin T.length := (⟨A.length + m, Decidable.byContradiction fun (a : ¬A.length + m < + T.length) ↦ + by omega + ⟩ : Fin T.length); HierarchyFullTailPrefix C m = Y → Y.vertex (Fin.last Y.length) = B.vertex + jm → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ b ∈ MissingColors G R.coloring (B.vertex jm), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A hAT hlen B tailException consecutive m + hmLower hm hmT X Y jm tnext hfullY hYvertex R b hb t hlo hhi hcol + by_cases ht : t.val < A.length + m + · exact tailException R m (by omega) (by have := hAT.1; omega) b + (by rw [hfullY, hYvertex]; exact hb) t hlo ht hcol + · have htEq : t = tnext := Fin.ext + (by change t.val < A.length + (m + 1) at hhi; dsimp [tnext]; omega) + subst t + have he := consecutive tnext (by dsimp [tnext]; omega) + have hv : T.vertex tnext.castSucc = B.vertex jm := rfl + have hi : Incident G (B.vertex jm) (T.edge tnext) := by + rw [Incident, he, hv] + exact Sym2.mem_mk_left _ _ + exact ((Finset.mem_sdiff.mp hb).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, T.edge tnext, hi, hcol⟩)).elim + +private theorem helper_advance_1257.{u_1, u_2} : + helperAdvance1257Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hpathLower hpathUpper hvertexMissing + componentData trans common A starEq hAT hlen B hBT fullB elementary vertexMem firstAt + stageSwitch gammaTransport gammaUnused outsideA notRaw tailException consecutive + gammaChoice m hmLower hmUpper P alpha ha haLast + have hm : 2 ≤ m := le_trans hpathLower hmLower + have hmT : A.length + (m + 1) < T.length := by + change m < (T.length - A.length) - 1 at hmUpper + have := hAT.1 + omega + let X := TreeSequencePrefix T (A.length + (m + 1)) (by have := A.positive; omega) (by omega) + let Y := TreeSequencePrefix T (A.length + m) (by have := A.positive; omega) (by omega) + have hXT : TreeSequenceInitialSegment X T := ⟨by exact le_of_lt hmT, fun _ => rfl, fun _ => rfl⟩ + have hAX : TreeSequenceInitialSegment A X := common hAT hXT + (by dsimp [X, TreeSequencePrefix]; omega) + have hXB : TreeSequenceInitialSegment X B := + common hXT hBT (by dsimp [X, B, TreeSequencePrefix]; omega) + have hAXlt : A.length < X.length := by dsimp [X, TreeSequencePrefix]; omega + let jm : Fin (B.length + 1) := ⟨A.length + m, by dsimp [B, TreeSequencePrefix]; omega⟩ + let jnext : Fin (B.length + 1) := ⟨A.length + (m + 1), by dsimp [B, TreeSequencePrefix]; omega⟩ + let tnext : Fin T.length := ⟨A.length + m, by omega⟩ + have hfullY : HierarchyFullTailPrefix C m = Y := by + have hn : min (A.length + m) T.length = A.length + m := min_eq_left (by omega) + simp only [HierarchyFullTailPrefix] + change TreeSequencePrefix T (min (A.length + m) T.length) _ _ = Y + simp only [hn] + rfl + have hfullX : HierarchyFullTailPrefix C (m + 1) = X := by + have hn : min (A.length + (m + 1)) T.length = A.length + (m + 1) := min_eq_left (by omega) + simp only [HierarchyFullTailPrefix] + change TreeSequencePrefix T (min (A.length + (m + 1)) T.length) _ _ = X + simp only [hn] + rfl + have hYvertex : Y.vertex (Fin.last Y.length) = B.vertex jm := rfl + have hXvertex : X.vertex (Fin.last X.length) = B.vertex jnext := rfl + have haM : alpha ∈ MissingColors G P.coloring (B.vertex jm) := by + rw [hfullY, hYvertex] at ha + exact ha + obtain ⟨theta, htheta⟩ := hvertexMissing P.coloring P.minimumContext.proper + P.minimumContext.oneEdgeUncolored (B.vertex jnext) + have nextMember (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (hc : c ∈ MissingColors G S.coloring (B.vertex jnext)) + (hcLast : c ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) : + m + 1 ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨by omega, by omega⟩, S, c, ?_, hcLast⟩ + rw [hfullX, hXvertex] + exact hc + have excNext (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (b : Fin k) (hb : b ∈ MissingColors G R.coloring (B.vertex jnext)) + (t : Fin T.length) (hlo : A.length ≤ t.val) (hhi : t.val < X.length) + (hcol : R.coloring (T.edge t) = some b) : + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + b ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + apply tailException R (m + 1) (by omega) (by have := hAT.1; omega) b + (by rw [hfullX, hXvertex]; exact hb) t hlo + (by exact hhi) hcol + have excM (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (b : Fin k) (hb : b ∈ MissingColors G R.coloring (B.vertex jm)) + (t : Fin T.length) (hlo : A.length ≤ t.val) (hhi : t.val < X.length) + (hcol : R.coloring (T.edge t) = some b) : + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + b ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + exact helper_excM_2308 G k e0 input T phi ett base C ctx hAT hlen tailException consecutive m + hmLower hm hmT hfullY hYvertex R b hb t hlo hhi hcol + have avoidNext (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (ha : a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) + (he : eta ∈ MissingColors G R.coloring (B.vertex jnext)) : + ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) ≠ some a := by + intro t hlo hhi + apply gammaUnused R eta a heta ha t hlo + rw [firstAt R eta jnext he] + exact hhi + have avoidM (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (ha : a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) + (he : eta ∈ MissingColors G R.coloring (B.vertex jm)) + (hgap : R.coloring (T.edge tnext) ≠ some a) : + ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) ≠ some a := by + intro t hlo hhi + by_cases ht : t.val < A.length + m + · apply gammaUnused R eta a heta ha t hlo + rw [firstAt R eta jm he] + exact ht + · have htEq : t = tnext := Fin.ext + (by change t.val < A.length + (m + 1) at hhi; dsimp [tnext]; omega) + simpa only [htEq] using hgap + by_cases hAlphaStored : alpha ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) + · exact @helper_branch_1318 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hlen vertexMem firstAt stageSwitch gammaTransport gammaChoice m + P alpha haLast hm hmT hAX hXB hAXlt haM theta htheta nextMember excNext excM avoidM + hAlphaStored + · exact @helper_branch_1346 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx componentData trans starEq hAT hlen hBT fullB elementary + vertexMem firstAt stageSwitch gammaTransport outsideA notRaw gammaChoice m P alpha ha + haLast hm hmT hAX hXB hAXlt haM theta htheta nextMember excNext excM avoidNext hAlphaStored +private theorem helper_firstAt_1681.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hlen : (4 : ℕ) ≤ + T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ + by omega + ); TreeSequenceInitialSegment B T → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j) → ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k), (↑(HierarchyFirstMissingPosition psi T c) : ℕ) + < T.length → c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c))) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hlen B hBT elementary vertexMem firstLe + firstMem R c j hc + have hcT : c ∈ MissingColors G R.coloring + (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) j)) := by + rw [hBT.2.1 j]; exact hc + have hle := firstLe R.coloring c _ hcT + have hlt : (HierarchyFirstMissingPosition R.coloring T c).val < T.length := by + have := j.isLt + change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle + have hblen : B.length = T.length - 1 := rfl + omega + let x : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T c).val, by + change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle + omega⟩ + have hxT : Fin.castLE (Nat.succ_le_succ hBT.1) x = + HierarchyFirstMissingPosition R.coloring T c := Fin.ext rfl + have hcx : c ∈ MissingColors G R.coloring (B.vertex x) := by + rw [← hBT.2.1 x, hxT] + exact firstMem R.coloring c hlt + have he : B.vertex x = B.vertex j := by + by_contra hn + exact Finset.disjoint_left.mp (elementary R (vertexMem B x) (vertexMem B j) hn) hcx hc + exact congrArg Fin.val (B.vertex_injective he) + +private theorem helper_firstMem_2558.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + classical + intro V E _ _ G k e0 T psi c hlt + let _ := Fintype.ofFinite V + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + +private theorem helper_outsideA_2628.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); TreeSequenceInitialSegment A T → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ + by omega + ); TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))), A.length < (↑j : ℕ) → c ∈ MissingColors G R.coloring (B.vertex + j) → c ∉ TreeMissingColors R.coloring A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans A hAT hlen B hBT hAB elementary + vertexMem R c j hj hc + clear * - R c j hj hc hAT hBT hAB elementary vertexMem + rintro hm + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + obtain ⟨a, ha⟩ : ∃ a, A.vertex a = v := by simpa [TreeSequenceVertexSet] using hv + have hne : v ≠ B.vertex j := by + intro he + have hh := T.vertex_injective ((hAT.2.1 a).trans + (ha.trans (he.trans (hBT.2.1 j).symm))) + have hh := congrArg Fin.val hh + have := a.isLt + change a.val = j.val at hh + omega + exact Finset.disjoint_left.mp (elementary R + (TreeSequenceInitialSegmentVertexSetSubset hAB hv) (vertexMem B j) hne) hcv hc + +private theorem helper_consecutive_2671.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (t : Fin T.length), A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ) → G.ends (T.edge + t) = s(T.vertex t.castSucc, T.vertex t.succ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpathUpper A t ht + let candidates := (Finset.Icc 1 (T.length - A.length)).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + have hp : HierarchyPathNumber C.hierarchy = + (if h : candidates.Nonempty then candidates.min' h else T.length - A.length) := rfl + have hn : candidates.Nonempty := by + by_contra hn + rw [dite_eq_right hn] at hp + have hu : HierarchyPathNumber C.hierarchy < T.length - A.length := hpathUpper + omega + have hm : candidates.min' hn = HierarchyPathNumber C.hierarchy := by + simpa only [dite_eq_left hn] using hp.symm + have hh := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + rw [hm] at hh + exact hh t ht + +private theorem helper_trans_3344.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y + Z → TreeSequenceInitialSegment X Z := by + classical + intro V E G e0 X Y Z hXY hYZ + refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +private theorem helper_common_3354.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by + classical + intro V E G e0 trans X Y Z hXZ hYZ hXY + clear * - hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + +private theorem helper_hAT_3385.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C A + have starNext (j : Fin (C.hierarchy.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy j) + (C.hierarchy.stage j.succ) := + Fin.cases C.hierarchy.coreInsideFirst (fun i => C.hierarchy.nested i.succ) j + simpa only [Fin.succ_last, C.hierarchy.terminalStage] using + starNext (Fin.last C.hierarchy.dividerCount) + +private theorem helper_fullB_3407.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → (3 : ℕ) ≤ T.length - A.length → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := TreeSequence.positive T + omega + ) ( + by + have := TreeSequence.positive T + omega + ); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq htail hlen B R + have hn : min ((HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + + (HierarchyFullTailLength R.counterexample - 1)) T.length = T.length - 1 := by + unfold HierarchyFullTailLength + dsimp only + rw [starEq R] + omega + simp only [HierarchyFullTailPrefix, hn] + rfl + +private theorem helper_elementary_3419.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := TreeSequence.positive T + omega) + (by + have := TreeSequence.positive T + omega); + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = + B) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hlen B fullB R + have h : ColoredVertexSetElementary G R.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 + R.corresponding.replacementInput T R.coloring R.corresponding.replacementETT + R.replacementBase R.counterexample R.minimumContext.proper + R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + R.minimumContext.largeMissingSet + intro u hu v hv hne + exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne + +private theorem helper_firstLe_3436.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G psi (T.vertex j) → + HierarchyFirstMissingPosition psi T c ≤ j := by + classical + intro V E _ _ G k e0 T psi c j hj + let _ := Fintype.ofFinite V + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ + have hn : candidates.Nonempty := ⟨j, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates j hm + +private theorem helper_lastData_3458.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx R + obtain ⟨hcount, hdata⟩ := R.sameGood.2 + have hh := hdata (Fin.last C.hierarchy.dividerCount) + have hidx : Fin.cast (congrArg (fun q => q + 1) hcount) + (Fin.last C.hierarchy.dividerCount) = + Fin.last R.counterexample.hierarchy.dividerCount := Fin.ext hcount + simpa only [hidx] using hh + +private theorem helper_gammaTransport_3472.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma + (Fin.last C.hierarchy.dividerCount) eta = R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta) → + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans lastData R S eta heta + clear * - R S eta heta lastData + have hOrig : eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) := by + rw [(lastData R).1]; exact heta + refine ⟨?_, ((lastData R).2 eta hOrig).symm.trans ((lastData S).2 eta hOrig)⟩ + rw [← (lastData S).1] + exact hOrig + +private theorem helper_gammaUnused_3487.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), + eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition + R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R eta a heta ha t hlo hhi hc + have hnot := (Finset.mem_sdiff.mp (R.counterexample.good.avoidance + (Fin.last R.counterexample.hierarchy.dividerCount) eta heta ha)).2 + apply hnot + unfold HierarchySegmentColors + dsimp only + rw [starEq R, Fin.succ_last, R.counterexample.hierarchy.terminalStage] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, + lt_min hhi t.isLt, hc⟩ + +private theorem helper_notRaw_3511.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R c hcA hcD hm + apply hcD + unfold HierarchyStoredColorsAt + dsimp only + rw [starEq R] + exact Finset.mem_sdiff.mpr ⟨hm, hcA⟩ + +private theorem helper_gammaChoice_3540.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans R eta heta f + clear * - R eta heta f + by_contra hn + push Not at hn + have hc : (R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta).card ≤ 1 := by + apply Finset.card_le_one.mpr + intro a ha b hb + exact Option.some.inj ((hn a ha).symm.trans (hn b hb)) + rw [R.counterexample.good.twoColors _ eta heta] at hc + omega + +private theorem helper_sameLast_6615.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {a b : ℕ} (s : Fin (a + + (2 : ℕ)) → TreeSequence G e0) (t : Fin (b + (2 : ℕ)) → TreeSequence G e0) (u v : + TreeSequence G e0), a = b → s ≍ t → u = v → (Fin.cases u (fun (i : Fin a) ↦ s + i.castSucc.succ) (Fin.last a) : TreeSequence G e0) = (Fin.cases v (fun (i : Fin b) ↦ t + i.castSucc.succ) (Fin.last b) : TreeSequence G e0) := by + classical + intro V E G e0 a b s t u v hab hst huv + cases hab + have he : s = t := eq_of_heq hst + cases he + cases huv + rfl + +theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hpathLower : 2 ≤ HierarchyPathNumber C.hierarchy) + (hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (hvertexMissing : ∀ (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → + ∀ v : V, (MissingColors G mu v).Nonempty) : + ∀ i ∈ HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx, + i < HierarchyPathNumber C.hierarchy := by + classical + have shortening (hlast : HierarchyFullTailLength C - 1 ∈ + HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx) : False := by + exact helper_shortening_124 G k e0 input T phi ett base C ctx hpathLower hpathUpper hlast + classical + have componentData (psi : PartialEdgeColoring E k) (a b : Fin k) + (hne : a ≠ b) (hproper : IsProperEdgeColoring G psi) + (B : Finset V) (helem : ColoredVertexSetElementary G psi B) + (u v w : V) (hu : u ∈ B) (hv : v ∈ B) (huv : u ≠ v) + (hwu : w ≠ u) (hwv : w ≠ v) + (hau : a ∈ MissingColors G psi u) (hbv : b ∈ MissingColors G psi v) + (hw : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) + (hsame : TwoColorComponent G psi a b (Sum.inl u) = + TwoColorComponent G psi a b (Sum.inl v)) : + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) + (TwoColorComponent G psi a b (Sum.inl u)) ∧ + TwoColorPathComponent G psi a b (Sum.inl w) ∧ + (∀ x ∈ B, + MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = + MissingColors G psi x) := by + exact P2905_T2_ElementaryTerminalComponent G psi a b hne hproper + B helem u v w hu hv hwu hwv hau hbv hw hsame + classical + open scoped Sym2 in + have trans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + exact helper_trans_3344 (@G) (@e0) (@hXY) (@hYZ) + have common {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + apply helper_common_3354 <;> assumption + have sameLast : + ∀ {a b : ℕ} (s : Fin (a + 2) → TreeSequence G e0) (t : Fin (b + 2) → TreeSequence G e0) (u v : + TreeSequence G e0), a = b → HEq s t → u = v → Fin.cases (motive := fun _ => TreeSequence G + e0) u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = Fin.cases (motive := fun _ => + TreeSequence G e0) v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by + apply helper_sameLast_6615 + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + have starEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = A := + (sameLast _ _ _ _ R.sameGood.1.2.1 R.sameGood.1.2.2.1 R.sameGood.1.1).symm + have hAT : TreeSequenceInitialSegment A T := by + exact helper_hAT_3385 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + have htail : 3 ≤ T.length - A.length := by + change HierarchyPathNumber C.hierarchy < T.length - A.length at hpathUpper + omega + have hlen : 4 ≤ T.length := by have := A.positive; omega + let B := TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + have hBT : TreeSequenceInitialSegment B T := ⟨by dsimp [B, TreeSequencePrefix]; omega, + fun _ => rfl, fun _ => rfl⟩ + have hAB : TreeSequenceInitialSegment A B := + common hAT hBT (by dsimp [B, TreeSequencePrefix]; omega) + have fullEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (j : ℕ) : HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j := by + unfold HierarchyFullTailPrefix + dsimp only + simp only [starEq R] + rfl + have fullB (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1) = B := by + exact helper_fullB_3407 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@starEq) (@htail) (@hlen) (@R) + have elementary (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by + exact helper_elementary_3419 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@hlen) (@fullB) (@R) + have vertexMem (U : TreeSequence G e0) (j : Fin (U.length + 1)) : + U.vertex j ∈ TreeSequenceVertexSet U := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) + (j : Fin (T.length + 1)) (hj : c ∈ MissingColors G psi (T.vertex j)) : + HierarchyFirstMissingPosition psi T c ≤ j := by + exact helper_firstLe_3436 (@G) (@k) (@e0) (@T) (@psi) (@c) (@j) (@hj) + have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + exact helper_firstMem_2558 G k e0 T psi c hlt + have firstAt (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + 1)) + (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : + (HierarchyFirstMissingPosition R.coloring T c).val = j.val := by + exact helper_firstAt_1681 G k e0 input T phi ett base C ctx hlen hBT elementary vertexMem + firstLe firstMem R c j hc + have stageSwitch := P2963_T1_TerminalKempeStageSwitch G k e0 input T phi ett base C ctx + A B (by omega) rfl rfl + have lastData (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta := by + exact helper_lastData_3458 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@R) + have gammaTransport + (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) : + eta ∈ HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by + apply helper_gammaTransport_3472 <;> assumption + have gammaUnused (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta a : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (ha : a ∈ R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta) + (t : Fin T.length) (hlo : A.length ≤ t.val) + (hhi : t.val < (HierarchyFirstMissingPosition R.coloring T eta).val) : + R.coloring (T.edge t) ≠ some a := by + exact helper_gammaUnused_3487 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@starEq) (@R) (@eta) (@a) (@heta) (@ha) (@t) (@hlo) (@hhi) + have outsideA (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + 1)) (hj : A.length < j.val) + (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : + c ∉ TreeMissingColors R.coloring A := by + apply helper_outsideA_2628 <;> assumption + have notRaw (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (hcA : c ∉ TreeMissingColors R.coloring A) + (hcD : c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) : + c ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + exact helper_notRaw_3511 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@starEq) (@R) (@c) (@hcA) (@hcD) + have tailException (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (j : ℕ) (hj : 1 ≤ j) (hjlt : j < T.length - A.length) + (c : Fin k) + (hc : c ∈ MissingColors G R.coloring + ((HierarchyFullTailPrefix C j).vertex (Fin.last (HierarchyFullTailPrefix C j).length))) + (t : Fin T.length) (hlo : A.length ≤ t.val) (hhi : t.val < A.length + j) + (hcol : R.coloring (T.edge t) = some c) : + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + c ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) := by + apply helper_tailException_1151 <;> assumption + have consecutive (t : Fin T.length) + (ht : A.length + HierarchyPathNumber C.hierarchy ≤ t.val) : + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by + exact helper_consecutive_2671 G k e0 input T phi ett base C hpathUpper t ht + have gammaChoice (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) (f : E) : + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a := by + apply helper_gammaChoice_3540 <;> assumption + have advance (m : ℕ) (hmLower : HierarchyPathNumber C.hierarchy ≤ m) + (hmUpper : m < HierarchyFullTailLength C - 1) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k) + (ha : alpha ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C m).vertex (Fin.last (HierarchyFullTailPrefix C m).length))) + (haLast : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) : + m + 1 ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by + exact @helper_advance_1257 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx hpathLower hpathUpper hvertexMissing componentData trans + common starEq hAT hlen hBT fullB elementary vertexMem firstAt stageSwitch + gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m + hmLower hmUpper P alpha ha haLast + intro i hi + by_contra hn + let I := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + have hI : I.Nonempty := ⟨i, hi⟩ + let m := I.max' hI + have hmI : m ∈ I := Finset.max'_mem I hI + have him : i ≤ m := Finset.le_max' I i hi + have hmBounds : 1 ≤ m ∧ m ≤ HierarchyFullTailLength C - 1 := + Finset.mem_Icc.mp (Finset.mem_filter.mp hmI).1 + obtain ⟨P, alpha, ha, haLast⟩ := (Finset.mem_filter.mp hmI).2 + by_cases hlast : m = HierarchyFullTailLength C - 1 + · exact shortening (hlast ▸ hmI) + · have hnext := advance m (by omega) (by omega) P alpha ha haLast + have hh : m + 1 ≤ m := Finset.le_max' I (m + 1) hnext + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeImpossible.lean new file mode 100644 index 0000000000..8b2bc3dad5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeImpossible.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationThreeComponentIntersectionShortening +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointPreparation +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaStoredImpossible +public import + LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible + +/-! +# Hierarchy Situation Three Impossible + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchySituationThreeImpossible + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hpathLower : 2 <= HierarchyPathNumber C.hierarchy) + (hpathUpper : + HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (hvertexMissing : forall (mu : PartialEdgeColoring E k), + IsProperEdgeColoring G mu -> IsOneEdgeUncolored mu e0 -> + forall v : V, (MissingColors G mu v).Nonempty) : False := by + classical + let I := HierarchyEligibleCommonMissingIndices + G k e0 input T phi ett base C ctx + have hclaim : + exists P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx, + exists alpha : Fin k, + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let B := HierarchyFullTailPrefix C + (HierarchyPathNumber C.hierarchy - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length)) ∧ + alpha ∈ TreeMissingColors P.coloring B ∧ + (alpha ∉ Gamma ∪ baseExtraMissing ∨ + exists eta : Fin k, eta ∈ D ∧ + alpha ∈ P.counterexample.good.gamma q eta ∧ + (HierarchyFirstMissingPosition P.coloring T eta).val <= + B.length) := by + by_cases hI : I.Nonempty + · exact HierarchySituationThreeClaimJMinusOneNonempty + G k e0 input T phi ett base C ctx hpathLower hpathUpper + hvertexMissing hI + · exact HierarchySituationThreeClaimJMinusOneEmpty + G k e0 input T phi ett base C ctx hpathLower hpathUpper + hvertexMissing hI + obtain ⟨P, alpha, halpha⟩ := hclaim + obtain ⟨beta, hbeta⟩ := HierarchySituationThreeColorChoice + G k e0 input T phi ett base C ctx P alpha hpathLower hpathUpper halpha + let j := HierarchyPathNumber C.hierarchy + let X := HierarchyFullTailPrefix C (j - 1) + let Q := TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) + by_cases hmeet : exists u, u ∈ TreeSequenceVertexSet X ∧ Sum.inl u ∈ Q + · exact HierarchySituationThreeComponentIntersectionShortening + G k e0 input T phi ett base C ctx P alpha beta hpathLower hpathUpper + halpha hbeta hmeet + · have hdisjoint : forall v, v ∈ TreeSequenceVertexSet X -> + Sum.inl v ∉ Q := by + intro v hv hmem + exact hmeet ⟨v, hv, hmem⟩ + obtain ⟨d⟩ := HierarchySituationThreeDisjointPreparation + G k e0 input T phi ett base C ctx P alpha beta hpathLower hpathUpper + hvertexMissing halpha hbeta hdisjoint + let H := d.switched.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + by_cases htheta : d.theta ∈ HierarchyStoredColorsAt H q + · exact HierarchySituationThreeDisjointThetaStoredImpossible + G k e0 input T phi ett base C ctx P alpha beta hpathLower hpathUpper + hvertexMissing d htheta + · rcases d.conditionNine with houtside | hstored + · exact HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible + G k e0 input T phi ett base C ctx P alpha beta hpathLower + hpathUpper hvertexMissing d htheta houtside + · exact HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible + G k e0 input T phi ett base C ctx P alpha beta hpathLower + hpathUpper hvertexMissing d htheta hstored + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneData.lean new file mode 100644 index 0000000000..f07604ba9d --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneData.lean @@ -0,0 +1,46 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData + +/-! +# Hierarchy Situation Two Case One Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A stored color missing at both final vertices and its two distinct auxiliary colors in situation +two, case one. +-/ +structure HierarchySituationTwoCaseOneData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) extends + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx where + /-- The distinguished color constrained by the accompanying missing-color conditions. -/ + alpha : Fin k + /-- The first auxiliary color in the stored color pair. -/ + gammaOne : Fin k + /-- The second auxiliary color in the stored color pair. -/ + gammaTwo : Fin k + alphaMissingPenultimate : alpha ∈ MissingColors G phi (T.vertex penultimateVertexIndex) + alphaMissingTerminal : alpha ∈ MissingColors G phi (T.vertex terminalVertexIndex) + alphaStored : alpha ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) + gammaPair : C.good.gamma (Fin.last C.hierarchy.dividerCount) alpha = { gammaOne, gammaTwo } + gammaDistinct : gammaOne ≠ gammaTwo + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneTwoData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneTwoData.lean new file mode 100644 index 0000000000..45f07252f4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneTwoData.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCommonTailData + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData + +/-! +# Hierarchy Situation Two Case One Two Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Case-one color data with the terminal-edge color also missing at the penultimate vertex. -/ +structure HierarchySituationTwoCaseOneTwoData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) extends + HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx where + /-- The distinguished color constrained by the accompanying missing-color conditions. -/ + alpha : Fin k + /-- The first auxiliary color in the stored color pair. -/ + gammaOne : Fin k + /-- The second auxiliary color in the stored color pair. -/ + gammaTwo : Fin k + alphaMissingPenultimate : alpha ∈ MissingColors G phi (T.vertex penultimateVertexIndex) + alphaMissingTerminal : alpha ∈ MissingColors G phi (T.vertex terminalVertexIndex) + alphaStored : alpha ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) + gammaPair : C.good.gamma (Fin.last C.hierarchy.dividerCount) alpha = { gammaOne, gammaTwo } + gammaDistinct : gammaOne ≠ gammaTwo + thetaMissingPenultimate : theta ∈ MissingColors G phi (T.vertex penultimateVertexIndex) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeData.lean new file mode 100644 index 0000000000..9e524b8e14 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeData.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCommonTailData + +/-! +# Hierarchy Situation Two Case Three Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A color missing at the terminal vertex and at an earlier vertex before the penultimate one. -/ +structure HierarchySituationTwoCaseThreeData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) extends + HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx where + /-- The distinguished color constrained by the accompanying missing-color conditions. -/ + alpha : Fin k + alphaMissingTerminal : alpha ∈ MissingColors G phi (T.vertex terminalVertexIndex) + /-- An earlier vertex position witnessing the missing-color condition. -/ + earlierVertexIndex : Fin (T.length + 1) + earlierVertexBeforePenultimate : earlierVertexIndex.val < penultimateVertexIndex.val + alphaMissingEarlier : alpha ∈ MissingColors G phi (T.vertex earlierVertexIndex) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalization.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalization.lean new file mode 100644 index 0000000000..f3d1db1343 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalization.lean @@ -0,0 +1,1304 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCaseThreePreparation + +/-! +# Hierarchy Situation Two Case Three Normalization + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable def helperGoodShort1489.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett + base C ctx) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := + ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + (beta : Fin k) → + let Bplus : TreeSequence G e0 := + HierarchyFullTailPrefix C + (HierarchyFullTailLength C - (1 : ℕ)); + (hlenB : B.length = T.length - (2 : ℕ)) → + (hBT : TreeSequenceInitialSegment B T) → + D.alpha ≠ beta → + (segTrans : + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + (equalTrees : + ∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + S.length = U.length → S = U) → + (m : ℕ) → + (1 : ℕ) ≤ m → + (pv : Fin (m + (1 : ℕ)) → V) → + let R : TreeSequence G e0 := + if + pv (0 : Fin (m + (1 : ℕ))) = + T.vertex + D.penultimateVertexIndex then + Bplus + else B; + TreeSequenceInitialSegment B R → + TreeSequenceInitialSegment R T → + (Utree : TreeSequence G e0) → + TreeSequenceInitialSegment R Utree → + (∀ (r : Fin Utree.length), + R.length ≤ (↑r : ℕ) → + Utree.vertex r.succ ∉ + TreeSequenceVertexSet + R ∧ + Sum.inr (Utree.edge r) ∈ + TwoColorComponent G + phi D.alpha beta + (Sum.inl + (T.vertex + D.terminalVertexIndex)) ∧ + Sum.inl + (Utree.vertex + r.succ) ∈ + TwoColorComponent G + phi D.alpha beta + (Sum.inl + (T.vertex + D.terminalVertexIndex)) ∧ + (phi (Utree.edge r) = + some D.alpha ∨ + phi + (Utree.edge + r) = + some beta) ∧ + G.ends + (Utree.edge r) = + if + (↑r : ℕ) = + R.length then + s(pv + (0 : + Fin + (m + + (1 : + ℕ))), + Utree.vertex + r.succ) + else + s(Utree.vertex + r.castSucc, + Utree.vertex + r.succ)) → + (hBU : + TreeSequenceInitialSegment B + Utree) → + (hAU : + TreeSequenceInitialSegment + A Utree) → + (corrU : + CorrespondingExtendedTashkinovTree + G k e0 ett phi + Utree) → + (baseU : + HierarchyBase + corrU.replacementETT + phi) → + (hcoreU : + baseU.core = + base.core) → + baseU.closure = + base.closure → + (terminalData : + corrU.replacementETT.series.data.tree + (Fin.last + corrU.replacementETT.rounds).castSucc = + Tn ∧ + corrU.replacementETT.series.data.kind + (Fin.last + corrU.replacementETT.rounds) = + ett.series.data.kind + n) → + (ordinaryToA : + ∀ + (j : + Fin + (H.dividerCount + + (1 : + ℕ))), + TreeSequenceInitialSegment + (H.stage + j.castSucc) + A) → + (hAUstrict : + A.length < + Utree.length) → + let newStage : + Fin + (H.dividerCount + + (2 : + ℕ)) → + TreeSequence + G e0 := + fun + (j : + Fin + (H.dividerCount + + (2 : + ℕ))) ↦ + if + (↑j : + ℕ) = + H.dividerCount + + (1 : + ℕ) then + Utree + else + H.stage j; + (stageOld : + ∀ + (j : + Fin + (H.dividerCount + + (1 : + ℕ))), + newStage + j.castSucc = + H.stage + j.castSucc) → + (stageLast : + newStage + (Fin.last + (H.dividerCount + + (1 : + ℕ))) = + Utree) → + (stageAt : + ∀ + (j : + Fin + (H.dividerCount + + (2 : + ℕ))), + (↑j : + ℕ) ≤ + H.dividerCount → + newStage + j = + H.stage + j) → + (divBound : + ∀ + (i : + Fin + H.dividerCount), + (↑(H.dividerPosition + i) : + ℕ) ≤ + B.length) → + let + K : + TashkinovHierarchy + corrU.replacementETT + baseU := + HierarchyCaseThreePreparation.helperK553 + G + k + e0 + input + T + phi + ett + base + C + ctx + D + hlenB + hBT + segTrans + equalTrees + m + pv + Utree + hBU + hAU + corrU + baseU + hcoreU + terminalData + ordinaryToA + hAUstrict + stageOld + stageLast + stageAt + divBound; + (∀ + (j : + Fin + (H.dividerCount + + (1 : + ℕ))), + K.stage + j.castSucc = + H.stage + j.castSucc) → + (∀ + (j : + Fin + (H.dividerCount + + (1 : + ℕ))), + HierarchyStarredStage + K + j = + HierarchyStarredStage + H + j) → + (∀ + (j : + Fin + (H.dividerCount + + (1 : + ℕ))), + HierarchyStoredColorsAt + K + j = + HierarchyStoredColorsAt + H + j) → + (∀ + (j : + Fin + (H.dividerCount + + (1 : + ℕ))), + HierarchyStageMissingColors + K + j = + HierarchyStageMissingColors + H + j) → + (∀ + (i : + Fin + H.dividerCount) + (eta : + Fin + k), + HierarchySegmentColors + K + i.castSucc + eta = + HierarchySegmentColors + H + i.castSucc + eta) → + beta ∉ + Gamma → + (∀ + (S : + TreeSequence + G + e0) + (c : + Fin + k) + (i : + Fin + (S.length + + (1 : + ℕ))), + c ∈ + MissingColors + G + phi + (S.vertex + i) → + (↑(HierarchyFirstMissingPosition + phi + S + c) : + ℕ) ≤ + (↑i : + ℕ)) → + (∀ + (c : + Fin + k), + (↑(HierarchyFirstMissingPosition + phi + T + c) : + ℕ) < + T.length → + c ∈ + MissingColors + G + phi + (T.vertex + (HierarchyFirstMissingPosition + phi + T + c))) → + (∀ + eta ∈ + Dnq, + D.alpha ∈ + C.good.gamma + q + eta → + (↑(HierarchyFirstMissingPosition + phi + T + eta) : + ℕ) ≤ + B.length) → + GoodHierarchy + K := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B Dnq Gamma beta Bplus + hlenB hBT hne segTrans equalTrees m hm pv R hBR hRT Utree hRU hnew hBU hAU corrU baseU + hcoreU hclosureU terminalData ordinaryToA hAUstrict newStage stageOld stageLast stageAt + divBound K stageEq starredEq storedEq missingEq internalSegmentEq betaOutsideGamma + firstBound firstWitness control + clear * - G phi K C H q A B T Utree R hRU hRT hnew hBR hBT hBU control + storedEq missingEq starredEq stageEq internalSegmentEq terminalData hcoreU hclosureU + firstWitness firstBound betaOutsideGamma Dnq beta D hlenB + have terminalAvoid (eta : Fin k) (heta : eta ∈ Dnq) : + Disjoint (C.good.gamma q eta) (HierarchySegmentColors K q eta) := by + apply HierarchyCaseThreePreparation.helper_terminalAvoid_1779 <;> assumption + exact { + gamma := C.good.gamma + twoColors := by intro j eta heta; exact C.good.twoColors j eta ((storedEq j) ▸ heta) + avoidance := by + intro j eta heta c hc + have hetaOld : eta ∈ HierarchyStoredColorsAt H j := (storedEq j) ▸ heta + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · rw [missingEq j] + exact (Finset.mem_sdiff.mp (C.good.avoidance j eta hetaOld hc)).1 + · intro hseg + by_cases hj : j.val < H.dividerCount + · let i : Fin H.dividerCount := ⟨j.val, hj⟩ + have hij : i.castSucc = j := Fin.ext rfl + rw [← hij, internalSegmentEq i eta, hij] at hseg + exact (Finset.mem_sdiff.mp (C.good.avoidance j eta hetaOld hc)).2 hseg + · have he : j = q := Fin.ext (by + change j.val = H.dividerCount + have hjb : j.val < H.dividerCount + 1 := j.isLt + omega) + subst j + exact Finset.disjoint_left.mp (terminalAvoid eta hetaOld) hc hseg + disjointPairs := by + intro j eta theta heta htheta hne + exact C.good.disjointPairs j eta theta ((storedEq j) ▸ heta) ((storedEq j) ▸ htheta) hne + uniqueRefresh := by + intro i + rw [storedEq i.succ, stageEq i.succ, starredEq i.castSucc] + exact C.good.uniqueRefresh i + parallelBase := by + dsimp only + intro hp + have hpo : ett.series.data.kind n = some TashkinovExtensionKind.PE := + terminalData.2.symm.trans hp + rw [hcoreU, hclosureU, terminalData.1, storedEq 0] + exact C.good.parallelBase hpo + minusClosed := by + intro i + rw [stageEq i.succ, storedEq i.succ] + exact C.good.minusClosed i } + +private theorem helper_continuation_850.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + let tailUsed : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c} : Finset (Fin k)); + ∀ beta ∈ TreeMissingColors phi B, ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → (0 : ℕ) < + H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma ∨ H.dividerCount = (0 : ℕ) ∧ beta ∉ Dn ∧ beta ∉ + Gamma ∨ beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed → + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); + let _ : Set (V ⊕ E) := TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)); beta ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) → + ∀ (hlenB : B.length = T.length - (2 : ℕ)), Bplus.length = T.length - (1 : ℕ) → + ∀ (hBT : TreeSequenceInitialSegment B T), TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment B Bplus → (↑D.earlierVertexIndex : ℕ) < B.length + (1 : ℕ) → + beta ∈ TreeMissingColors phi Bplus → D.alpha ∈ TreeMissingColors phi Bplus → D.alpha ≠ + beta → T.vertex D.terminalVertexIndex ∉ TreeSequenceVertexSet Bplus → + ∀ (segTrans : + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) (equalTrees : + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S U → S.length = U.length → S = U), + (H.dividerCount ≠ (0 : ℕ) → A = H.stage q.castSucc) → TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment Tn A → D.alpha ∈ TreeMissingColors phi B → + ∀ (m : ℕ), (1 : ℕ) ≤ m → + ∀ (pv : Fin (m + (1 : ℕ)) → V), + let R : TreeSequence G e0 := if pv (0 : Fin (m + (1 : ℕ))) = T.vertex D.penultimateVertexIndex + then Bplus else B; TreeSequenceInitialSegment B R → + ∀ (Utree : TreeSequence G e0), TreeSequenceInitialSegment R Utree → Utree.length = R.length + + m → R.length < Utree.length → ( + ∀ (r : Fin Utree.length), R.length ≤ (↑r : ℕ) → Utree.vertex r.succ ∉ TreeSequenceVertexSet R + ∧ Sum.inr (Utree.edge r) ∈ TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)) ∧ Sum.inl (Utree.vertex r.succ) ∈ TwoColorComponent G phi D.alpha + beta (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ (phi (Utree.edge r) = some D.alpha ∨ phi + (Utree.edge r) = some beta) ∧ G.ends (Utree.edge r) = if (↑r : ℕ) = R.length then s(pv (0 + : Fin (m + (1 : ℕ))), Utree.vertex r.succ) else s(Utree.vertex r.castSucc, Utree.vertex + r.succ)) → + ∀ (hBU : TreeSequenceInitialSegment B Utree) (hAU : TreeSequenceInitialSegment A Utree), + Utree.vertex (Fin.last Utree.length) = T.vertex D.terminalVertexIndex → + ∀ (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi Utree), MaximumProperty + corrU.replacementETT → + ∀ (baseU : HierarchyBase corrU.replacementETT phi) (hcoreU : baseU.core = base.core) + (terminalData : corrU.replacementETT.series.data.tree (Fin.last + corrU.replacementETT.rounds).castSucc = Tn ∧ corrU.replacementETT.series.data.kind + (Fin.last corrU.replacementETT.rounds) = ett.series.data.kind n) (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) + (hAUstrict : A.length < Utree.length), + let newStage : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := fun (j : Fin + (H.dividerCount + (2 : ℕ))) ↦ if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then Utree else + H.stage j; + ∀ (stageOld : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), newStage j.castSucc = H.stage j.castSucc) (stageLast : + newStage (Fin.last (H.dividerCount + (1 : ℕ))) = Utree) (stageAt : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), (↑j : ℕ) ≤ H.dividerCount → newStage j = H.stage j) + (divBound : + ∀ (i : Fin H.dividerCount), (↑(H.dividerPosition i) : ℕ) ≤ B.length), + let K : TashkinovHierarchy corrU.replacementETT baseU := + HierarchyCaseThreePreparation.helperK553 G k e0 input T phi ett base C ctx D hlenB hBT + segTrans equalTrees m pv Utree hBU hAU corrU baseU hcoreU terminalData ordinaryToA + hAUstrict stageOld stageLast stageAt divBound; ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), HierarchyStarredStage K j = HierarchyStarredStage H j) + → ( + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))), c ∈ MissingColors G phi + (S.vertex i) → (↑(HierarchyFirstMissingPosition phi S c) : ℕ) ≤ (↑i : ℕ)) → ( + ∀ (c : Fin k), (↑(HierarchyFirstMissingPosition phi T c) : ℕ) < T.length → c ∈ MissingColors G + phi (T.vertex (HierarchyFirstMissingPosition phi T c))) → + ∀ (_ : ( + ∀ eta ∈ Dnq, D.alpha ∈ C.good.gamma q eta → (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) ≤ + B.length) → GoodHierarchy K), + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Nonempty + (HierarchySituationTwoCaseThreeNormalizedData G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B Dn Dnq Gamma tailUsed + beta hmissing hunused halternative Bplus Q hbetaPresent hlenB hlenPlus hBT hplusT hBBplus + hindex hbetaMissingPlus halphaMissingPlus hne hterminalOutside segTrans equalTrees + lastPositive hAT hTnA halphaMissingB m hm pv R hBR Utree hRU hUlen hRUstrict hnew hBU hAU + hUterminal corrU hMPU baseU hcoreU terminalData ordinaryToA hAUstrict newStage stageOld + stageLast stageAt divBound K starredEq firstBound firstWitness goodShort + have pathShort : HierarchyPathNumber K < HierarchyPathNumber H := by + apply HierarchyCaseThreePreparation.helper_pathShort_734 <;> assumption + have shorteningContradiction + (control : ∀ eta, eta ∈ Dnq → D.alpha ∈ C.good.gamma q eta → + (HierarchyFirstMissingPosition phi T eta).val ≤ B.length) : False := by + have hnotElementary : ¬ ColoredVertexSetElementary G phi (TreeSequenceVertexSet Utree) := by + let iB : Fin (B.length + 1) := ⟨D.earlierVertexIndex.val, hindex⟩ + have hvB : B.vertex iB = T.vertex D.earlierVertexIndex := by + rw [← hBT.2.1 iB] + congr 1 + have hvU : T.vertex D.earlierVertexIndex ∈ TreeSequenceVertexSet Utree := + TreeSequenceInitialSegmentVertexSetSubset hBU (hvB ▸ (by simp [TreeSequenceVertexSet])) + have htU : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet Utree := + hUterminal ▸ (by simp [TreeSequenceVertexSet]) + have hdistinct : T.vertex D.earlierVertexIndex ≠ T.vertex D.terminalVertexIndex := by + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + have hterm := D.terminalVertexPosition + have hearly := D.earlierVertexBeforePenultimate + have hpen := D.penultimateVertexPosition + omega + intro he + exact Finset.disjoint_left.mp (he hvU htU hdistinct) + D.alphaMissingEarlier D.alphaMissingTerminal + let Cnew : HierarchyCounterexample baseU := { + positive := by rw [corrU.rungAgreement]; exact C.positive + hierarchy := K + good := goodShort control + maximum := hMPU + notElementary := hnotElementary } + exact ctx.lexicographicMinimality Cnew corrU.rungAgreement rfl (Or.inl pathShort) + by_cases haOutside : D.alpha ∉ Gamma + · exact (shorteningContradiction (by + intro eta heta ha + exact (haOutside (Finset.mem_biUnion.mpr ⟨eta, heta, ha⟩)).elim)).elim + · have haGamma : D.alpha ∈ Gamma := not_not.mp haOutside + by_cases haUsed : D.alpha ∈ tailUsed + · apply HierarchyCaseThreePreparation.helper_branch_1316 <;> assumption + -- An unused reserved color requires a genuinely recolored certificate. + · exact @HierarchyCaseThreePreparation.helper_branch_1551 (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@base) (@C) (@ctx) (@D) (@beta) (@hmissing) (@hunused) (@halternative) (@hbetaPresent) + (@hlenB) (@hlenPlus) (@hBT) (@hplusT) (@hBBplus) (@hbetaMissingPlus) (@halphaMissingPlus) + (@hne) (@hterminalOutside) (@lastPositive) (@hAT) (@hTnA) (@halphaMissingB) (@m) (@hm) + (@firstBound) (@firstWitness) (@haGamma) (@haUsed) +private theorem helper_continuation_647.{u_1, u_2} : + HierarchyCaseThreePreparation.helperContinuation647Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B Dn Dnq Gamma tailUsed + beta hmissing hunused halternative Bplus Q hbetaPresent hlenB hlenPlus hBT hplusT hBBplus + hindex hbetaMissingPlus halphaMissingPlus hne hterminalOutside segTrans equalTrees + stageSegment lastPositive hAT hAB hTnA halphaMissingB m hm pv R hBR hRT Utree hRU hUlen + hRUstrict hnew hBU hAU hTnU hTnUstrict hUterminal hmod heligible + obtain ⟨corrU⟩ := hmod.2.2 Utree hTnU hTnUstrict heligible + have hMPU := MaximumPropertyTransport G k e0 ett phi hmod Utree corrU C.maximum + obtain ⟨baseU, hcoreU, hclosureU, hsupportU⟩ := + HierarchyBaseCorrespondingTransport G k e0 input T Utree phi ett corrU base + have terminalData : + corrU.replacementETT.series.data.tree (Fin.last corrU.replacementETT.rounds).castSucc = Tn ∧ + corrU.replacementETT.series.data.kind (Fin.last corrU.replacementETT.rounds) = + ett.series.data.kind n := by + clear * - corrU ett Tn n + rcases corrU with ⟨ri, rs, re, hr, hs, hg, ht, hstored, he, hk, hp, ho, hstable⟩ + cases re with + | mk rounds positive series above strict below generating => + cases hr + have hseries : series = rs := eq_of_heq hs + cases hseries + let i : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have hi : i.succ = Fin.last ett.rounds := Fin.ext (by + dsimp [i]; have := ett.roundsPositive; omega) + exact ⟨by simpa only [hi] using ht i, hk _⟩ + have ordinaryToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + clear * - H j A hTnA lastPositive stageSegment + by_cases hz : H.dividerCount = 0 + · have hj : j = 0 := Fin.ext (by + have hlt := j.isLt + change j.val = 0 + clear * - hlt hz + omega) + rw [hj] + change TreeSequenceInitialSegment (H.stage 0) A + rw [H.baseStage] + exact hTnA + · rw [lastPositive hz] + have hs := stageSegment j.val (H.dividerCount - j.val) (by have := j.isLt; omega) + convert hs using 1 + · exact congrArg H.stage (Fin.ext rfl) + · apply congrArg H.stage + apply Fin.ext + change H.dividerCount = j.val + (H.dividerCount - j.val) + have := j.isLt + omega + have hAUstrict : A.length < Utree.length := lt_of_le_of_lt (segTrans hAB hBR).1 hRUstrict + let newStage : Fin (H.dividerCount + 2) → TreeSequence G e0 := fun j => + if j.val = H.dividerCount + 1 then Utree else H.stage j + have stageOld (j : Fin (H.dividerCount + 1)) : newStage j.castSucc = H.stage j.castSucc := by + simp only [newStage] + rw [ite_eq_right (by have := j.isLt; change j.val ≠ H.dividerCount + 1; omega)] + have stageLast : newStage (Fin.last (H.dividerCount + 1)) = Utree := by simp [newStage] + have stageAt (j : Fin (H.dividerCount + 2)) (hj : j.val ≤ H.dividerCount) : + newStage j = H.stage j := by + simp only [newStage, ite_eq_right (by omega : j.val ≠ H.dividerCount + 1)] + have divBound (i : Fin H.dividerCount) : (H.dividerPosition i).val ≤ B.length := by + have hl : (H.stage i.succ.castSucc).length = (H.dividerPosition i).val := by + have he := congrArg TreeSequence.length (H.dividerStage i) + exact he + have hs := (segTrans (ordinaryToA i.succ) hAB).1 + omega + let K : TashkinovHierarchy corrU.replacementETT baseU := by + exact @HierarchyCaseThreePreparation.helperK553 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@hlenB) (@hBT) (@segTrans) (@equalTrees) (@m) (@pv) (@Utree) (@hBU) (@hAU) + (@corrU) (@baseU) (@hcoreU) (@terminalData) (@ordinaryToA) (@hAUstrict) (@stageOld) + (@stageLast) (@stageAt) (@divBound) + have stageEq (j : Fin (H.dividerCount + 1)) : K.stage j.castSucc = H.stage j.castSucc := + stageOld j + have starredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage H j := by + refine Fin.cases ?_ (fun i => ?_) j + · exact hcoreU + · exact stageEq i.succ + have storedEq (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j := by + unfold HierarchyStoredColorsAt + dsimp only + rw [P2752_T2_TerminalStoredColors ett corrU, starredEq] + have missingEq (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j := by + refine Fin.cases ?_ (fun i => ?_) j + · exact congrArg (TreeMissingColors phi) terminalData.1 + · exact congrArg (TreeMissingColors phi) (stageEq i.succ) + have internalSegmentEq (i : Fin H.dividerCount) (eta : Fin k) : + HierarchySegmentColors K i.castSucc eta = HierarchySegmentColors H i.castSucc eta := by + let S := H.stage i.succ.castSucc + have hSB := segTrans (ordinaryToA i.succ) hAB + have hcutT := HierarchyFirstMissingPositionPrefixCutoff phi B T hBT eta S.length hSB.1 + have hcutU := HierarchyFirstMissingPositionPrefixCutoff phi B Utree hBU eta S.length hSB.1 + unfold HierarchySegmentColors + have hi : i.castSucc.succ = i.succ.castSucc := Fin.ext rfl + dsimp only + rw [hi, stageEq i.succ, starredEq i.castSucc, ← hcutU, hcutT] + have betaOutsideGamma : beta ∉ Gamma := by + rcases halternative with h | h | h + · exact h.2.2 + · exact h.2.2 + · intro hg + exact Finset.disjoint_left.mp (GoodHierarchyReservedDisjoint C.good q).2 hg h.1 + have firstBound (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + 1)) + (hc : c ∈ MissingColors G phi (S.vertex i)) : + (HierarchyFirstMissingPosition phi S c).val ≤ i.val := by + clear * - S c i hc phi + let W := (Finset.univ : Finset (Fin (S.length + 1))).filter fun j => + c ∈ MissingColors G phi (S.vertex j) + have hi : i ∈ W := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hc⟩ + have hw : W.Nonempty := ⟨i, hi⟩ + change (if h : W.Nonempty then W.min' h else Fin.last S.length).val ≤ i.val + rw [dite_eq_left hw] + exact Finset.min'_le W i hi + have firstWitness (c : Fin k) (hc : (HierarchyFirstMissingPosition phi T c).val < T.length) : + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) := by + clear * - phi T c hc + let W := (Finset.univ : Finset (Fin (T.length + 1))).filter fun j => + c ∈ MissingColors G phi (T.vertex j) + by_cases hw : W.Nonempty + · have he : HierarchyFirstMissingPosition phi T c = W.min' hw := by + simp only [HierarchyFirstMissingPosition, W, dite_eq_left hw] + rw [he] + exact (Finset.mem_filter.mp (Finset.min'_mem W hw)).2 + · have he : HierarchyFirstMissingPosition phi T c = Fin.last T.length := by + simp only [HierarchyFirstMissingPosition, W, dite_eq_right hw] + rw [he] at hc + exact (Nat.lt_irrefl _ hc).elim + have goodShort := @helperGoodShort1489 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@beta) + (@hlenB) (@hBT) (@hne) (@segTrans) (@equalTrees) (@m) (@hm) (@pv) (@hBR) (@hRT) (@Utree) + (@hRU) (@hnew) (@hBU) (@hAU) (@corrU) (@baseU) (@hcoreU) (@hclosureU) (@terminalData) + (@ordinaryToA) (@hAUstrict) (@stageOld) (@stageLast) (@stageAt) (@divBound) (@stageEq) + (@starredEq) (@storedEq) (@missingEq) (@internalSegmentEq) (@betaOutsideGamma) (@firstBound) + (@firstWitness) + exact @helper_continuation_850 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@beta) + (@hmissing) (@hunused) (@halternative) (@hbetaPresent) (@hlenB) (@hlenPlus) (@hBT) + (@hplusT) (@hBBplus) (@hindex) (@hbetaMissingPlus) (@halphaMissingPlus) (@hne) + (@hterminalOutside) (@segTrans) (@equalTrees) (@lastPositive) (@hAT) (@hTnA) + (@halphaMissingB) (@m) (@hm) (@pv) (@hBR) (@Utree) (@hRU) (@hUlen) (@hRUstrict) (@hnew) + (@hBU) (@hAU) (@hUterminal) (@corrU) (@hMPU) (@baseU) (@hcoreU) (@terminalData) + (@ordinaryToA) (@hAUstrict) (@stageOld) (@stageLast) (@stageAt) (@divBound) (@starredEq) + (@firstBound) (@firstWitness) (@goodShort) +private theorem helper_heligible_1741.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); ( + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) → + ∀ (m : ℕ) (pv : Fin (m + (1 : ℕ)) → V), + let R : TreeSequence G e0 := if pv (0 : Fin (m + (1 : ℕ))) = T.vertex D.penultimateVertexIndex + then Bplus else B; TreeSequenceInitialSegment R T → + ∀ (Utree : TreeSequence G e0), TashkinovAugmentationSequence phi R Utree → + TreeSequenceInitialSegment Tn R → ( + ∀ (S : TreeSequence G e0) (colors : Finset (Fin k)) (psi : PartialEdgeColoring E k), + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → ColoredVertexSetClosed G psi + (TreeSequenceVertexSet S) → StableColoring S colors psi phi → ColoredVertexSetClosed G phi + (TreeSequenceVertexSet S)) → ( + ∀ (f : E) (seed : TreeSequence G e0), ColoredVertexSetClosed G phi (TreeSequenceVertexSet Tn) + → TreeSequenceAdjoinEdge Tn f seed → TashkinovClosure phi seed (ett.series.data.tree + (Fin.last (ett.rounds + (1 : ℕ)))) → TashkinovAugmentationSequence phi seed Utree) → + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn Utree ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed Utree := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B Bplus segTrans m pv R + hRT Utree hRUroute hTnR stableClosed seededRoute + have hs := ett.series.certified n + have hcolorN : ett.series.data.coloring n = phi := ett.generatingColoring.symm + have hnNext : n.succ = Fin.last (ett.rounds + 1) := Fin.ext rfl + generalize hn : n = z at hs + cases hs with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + have hv := congrArg Fin.val hn + have hp := C.positive + dsimp [n] at hv + omega + | PE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + have hi : i.succ = n := hn.symm + have hclosure : TashkinovClosure phi Tn + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa only [hi, hcolorN, hnNext] using closedExtension + refine Or.inl ⟨by simpa only [hi] using currentKind, ?_⟩ + exact (TashkinovAugmentationSequenceRestrict phi Tn R _ hclosure.1 hTnR + (segTrans hRT ett.belowFinal)).trans hRUroute + | SE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have hi : i.succ = n := hn.symm + have htree : ett.series.data.tree i.succ.castSucc = Tn := + congrArg (fun j : Fin (ett.rounds + 1) => ett.series.data.tree j.castSucc) hi + have hselected : choice.selected = phi := currentColoring.symm.trans + ((congrArg ett.series.data.coloring hi).trans ett.generatingColoring.symm) + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet Tn) := + stableClosed Tn _ _ previousProper previousOneUncolored + (htree ▸ previousClosed) (by simpa only [htree, hselected] using choice.selectedStable) + have hseed : TreeSequenceAdjoinEdge Tn choice.edge adjoined := htree ▸ adjoinedExactly + have hclosure : TashkinovClosure phi adjoined + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa only [hi, hcolorN, hnNext] using closedExtension + exact Or.inr ⟨Or.inl (by simpa only [hi] using currentKind), choice.edge, adjoined, + by simpa only [hi] using currentEdges, hseed, seededRoute _ _ hclosed hseed hclosure⟩ + | RE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + available currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have hi : i.succ = n := hn.symm + have htree : ett.series.data.tree i.succ.castSucc = Tn := + congrArg (fun j : Fin (ett.rounds + 1) => ett.series.data.tree j.castSucc) hi + have hcolor : ett.series.data.coloring i.castSucc = phi := currentColoring.symm.trans + ((congrArg ett.series.data.coloring hi).trans ett.generatingColoring.symm) + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet Tn) := by + have hc : ColoredVertexSetClosed G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn) := by + rw [← htree] + exact previousClosed + exact @Eq.mp _ _ (congrArg (fun psi => ColoredVertexSetClosed G psi + (TreeSequenceVertexSet Tn)) hcolor) hc + have hseed : TreeSequenceAdjoinEdge Tn available.edge adjoined := htree ▸ adjoinedExactly + have hclosure : TashkinovClosure phi adjoined + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa only [hi, hcolorN, hnNext] using closedExtension + exact Or.inr ⟨Or.inr (by simpa only [hi] using currentKind), available.edge, adjoined, + by simpa only [hi] using currentEdges, hseed, seededRoute _ _ hclosed hseed hclosure⟩ + +private theorem helper_continuation_547.{u_1, u_2} : + HierarchyCaseThreePreparation.helperContinuation547Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B Dn Dnq Gamma tailUsed + beta hmissing hunused halternative Bplus Q hbetaPresent hhit hlenB hlenPlus hBT hplusT + hBBplus hindex hbetaMissingPlus halphaMissingPlus hne hterminalOutside segTrans + commonPrefix equalTrees stageSegment lastPositive hAT + have hAB : TreeSequenceInitialSegment A B := + commonPrefix hAT hBT + (by have hp := D.tailAtLeastTwo; change 2 ≤ T.length - A.length at hp; omega) + have hTnA : TreeSequenceInitialSegment Tn A := by + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hA : A = base.core := by simp [A, HierarchyStarredStage, hq] + rw [hA] + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (base.parallel hp).2.2).leftSegment + · rw [base.nonparallel hp] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · rw [lastPositive hz] + have hs := stageSegment 0 H.dividerCount (by omega) + have hi0 : (⟨0, by omega⟩ : Fin (H.dividerCount + 2)) = 0 := Fin.ext rfl + have hiq : (⟨0 + H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + q.castSucc := Fin.ext (by simp [q]) + rw [hi0, H.baseStage, hiq] at hs + exact hs + have halphaMissingB : D.alpha ∈ TreeMissingColors phi B := by + let i : Fin (B.length + 1) := ⟨D.earlierVertexIndex.val, hindex⟩ + apply Finset.mem_biUnion.mpr + refine ⟨B.vertex i, by simp [TreeSequenceVertexSet], ?_⟩ + have hv : B.vertex i = T.vertex D.earlierVertexIndex := by + rw [← hBT.2.1 i] + congr 1 + rw [hv] + exact D.alphaMissingEarlier + obtain ⟨m, hm, pv, pe, hpv, hpe, hstart, hlast, houtside, + hvcomp, hecomp, hcolors, hends, hfresh⟩ := + TwoColorComponentNearestSegment G phi Bplus D.alpha beta + (T.vertex D.terminalVertexIndex) ctx.proper hne hterminalOutside hhit + let R := if pv 0 = T.vertex D.penultimateVertexIndex then Bplus else B + have hBR : TreeSequenceInitialSegment B R := by + dsimp [R] + split + · exact hBBplus + · exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have hRplus : TreeSequenceInitialSegment R Bplus := by + dsimp [R] + split + · exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact hBBplus + have hRT := segTrans hRplus hplusT + have hstartR : pv 0 ∈ TreeSequenceVertexSet R := by + clear * - R pv D B Bplus T hstart hlenB hlenPlus hplusT hBBplus + dsimp [R] + split + · exact hstart + · rename_i hnot + have hs := hstart + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hs + obtain ⟨i, hi⟩ := hs + have hiB : i.val ≤ B.length := by + by_contra hno + have hiv : i.val = Bplus.length := by omega + have hv : Bplus.vertex i = T.vertex D.penultimateVertexIndex := by + rw [← hplusT.2.1 i] + congr 1 + apply Fin.ext + have hpen := D.penultimateVertexPosition + change i.val = D.penultimateVertexIndex.val + clear * - hpen hiv hlenPlus + omega + exact hnot (hi.symm.trans hv) + let j : Fin (B.length + 1) := ⟨i.val, by omega⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨j, ?_⟩ + rw [← hBBplus.2.1 j] + exact (congrArg Bplus.vertex (Fin.ext rfl)).trans hi + obtain ⟨Utree, hRU, hUlen, hentries, hRUstrict, hRUroute, hUlast, hnew⟩ := + TashkinovAlternatingSegmentAppend G phi R D.alpha beta + (T.vertex D.terminalVertexIndex) m hm pv pe hpv hpe hstartR + (fun i hi => houtside i (TreeSequenceInitialSegmentVertexSetSubset hRplus hi)) + hvcomp hecomp hcolors hends + (fun i j => by rw [← hRplus.2.2 j]; exact hfresh i _) + (by obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp halphaMissingB + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hBR hv, hc⟩) + (by obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp hmissing + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hBR hv, hc⟩) + have hBU := segTrans hBR hRU + have hAU := segTrans hAB hBU + have hTnR := segTrans hTnA (segTrans hAB hBR) + have hTnU := segTrans hTnR hRU + have hTnUstrict : Tn.length < Utree.length := lt_of_le_of_lt hTnR.1 hRUstrict + have hUterminal : Utree.vertex (Fin.last Utree.length) = T.vertex D.terminalVertexIndex := + hUlast.trans hlast + have hmod := Td G k e0 input T phi ett C.maximum C.positive ctx.lowerRung + phi ctx.proper ctx.oneEdgeUncolored (by rw [← ett.generatingColoring]; simp [StableColoring]) + have stableClosed (S : TreeSequence G e0) (colors : Finset (Fin k)) + (psi : PartialEdgeColoring E k) + (hppsi : IsProperEdgeColoring G psi) (hopsi : IsOneEdgeUncolored psi e0) + (hcpsi : ColoredVertexSetClosed G psi (TreeSequenceVertexSet S)) + (hs : StableColoring S colors psi phi) : + ColoredVertexSetClosed G phi (TreeSequenceVertexSet S) := by + clear * - G e0 ctx phi S colors psi hppsi hopsi hcpsi hs + intro f c x hf hx hfc hcm + have hincident : TreeIncidentEdge S f := by + obtain ⟨u, hu, v, hv, huv⟩ := by simpa [BoundaryEdges] using hf + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [huv] + exact Sym2.mem_mk_left _ _ + have hcmPrev : c ∈ MissingColors G psi x := by + rw [← hs.2 x hx] + exact hcm + have hcTree : c ∈ TreeMissingColors psi S := Finset.mem_biUnion.mpr ⟨x, hx, hcmPrev⟩ + have hfixed : phi f = psi f := + (sc1 G e0 S colors psi phi hppsi hopsi ctx.proper ctx.oneEdgeUncolored).mp hs + f hincident (Or.inr ⟨c, Finset.mem_union_left _ hcTree, hfc⟩) + exact hcpsi hf hx (hfixed.symm.trans hfc) hcmPrev + -- The splice must retain the exact terminal SE/RE connecting seed. + have seededRoute (f : E) (seed : TreeSequence G e0) + (hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet Tn)) + (hseed : TreeSequenceAdjoinEdge Tn f seed) + (hclosure : TashkinovClosure phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1)))) : + TashkinovAugmentationSequence phi seed Utree := by + have hstrict : Tn.length < R.length := by + by_contra hno + have hle := hTnR.1 + have heq : R = Tn := (equalTrees hTnR (by omega)).symm + have hvinside : pv 0 ∈ TreeSequenceVertexSet Tn := heq ▸ hstartR + let i : Fin m := ⟨0, by omega⟩ + have hvoutside : pv i.succ ∉ TreeSequenceVertexSet Tn := by + intro hv + exact houtside i (TreeSequenceInitialSegmentVertexSetSubset + (segTrans hTnR hRplus) hv) + have hbdy : pe i ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨pv 0, hvinside, pv i.succ, hvoutside, hends i⟩ + rcases hcolors i with hc | hc + · obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp halphaMissingB + have hvn : v ∈ TreeSequenceVertexSet Tn := + heq ▸ TreeSequenceInitialSegmentVertexSetSubset hBR hv + exact hclosed hbdy hvn hc hm + · obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hmissing + have hvn : v ∈ TreeSequenceVertexSet Tn := + heq ▸ TreeSequenceInitialSegmentVertexSetSubset hBR hv + exact hclosed hbdy hvn hc hm + have hseedFinal := TashkinovAugmentationSequenceInitialSegment phi seed _ hclosure.1 + have hseedR : TreeSequenceInitialSegment seed R := + commonPrefix hseedFinal (segTrans hRT ett.belowFinal) (by obtain ⟨hl, _⟩ := hseed; omega) + exact (TashkinovAugmentationSequenceRestrict phi seed R _ hclosure.1 + hseedR (segTrans hRT ett.belowFinal)).trans hRUroute + have heligible : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn Utree) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, ett.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed Utree) := by + apply helper_heligible_1741 <;> assumption + exact @helper_continuation_647 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@beta) + (@hmissing) (@hunused) (@halternative) (@hbetaPresent) (@hlenB) (@hlenPlus) (@hBT) + (@hplusT) (@hBBplus) (@hindex) (@hbetaMissingPlus) (@halphaMissingPlus) (@hne) + (@hterminalOutside) (@segTrans) (@equalTrees) (@stageSegment) (@lastPositive) (@hAT) (@hAB) + (@hTnA) (@halphaMissingB) (@m) (@hm) (@pv) (@hBR) (@hRT) (@Utree) (@hRU) (@hUlen) + (@hRUstrict) (@hnew) (@hBU) (@hAU) (@hTnU) (@hTnUstrict) (@hUterminal) (@hmod) (@heligible) +private theorem helper_branch_402.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let _ : Finset (Fin k) := {c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi + (T.edge r) = some c}; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + let tailUsed : Finset (Fin k) := {c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c}; + ∀ beta ∈ TreeMissingColors phi B, ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → (0 : ℕ) < + H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma ∨ H.dividerCount = (0 : ℕ) ∧ beta ∉ Dn ∧ beta ∉ + Gamma ∨ beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed → beta ∉ MissingColors G phi + (T.vertex D.terminalVertexIndex) → + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ)); + let Q : Set (V ⊕ E) := TwoColorComponent G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)); beta ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) → ( + ∃ v ∈ TreeSequenceVertexSet Bplus, Sum.inl v ∈ Q) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Nonempty + (HierarchySituationTwoCaseThreeNormalizedData G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B U Dn Dnq Gamma tailUsed + beta hmissing hunused halternative hterminal Bplus Q hbetaPresent hhit + have hlenB : B.length = T.length - 2 := by + have hp : 2 ≤ T.length - A.length := D.tailAtLeastTwo + change min (A.length + (ell - 2)) T.length = T.length - 2 + dsimp [ell] + omega + have hlenPlus : Bplus.length = T.length - 1 := by + have hp : 2 ≤ T.length - A.length := D.tailAtLeastTwo + change min (A.length + (HierarchyFullTailLength C - 1)) T.length = + T.length - 1 + change min (A.length + (ell - 1)) T.length = T.length - 1 + dsimp [ell] + omega + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, (fun _ => rfl), (fun _ => rfl)⟩ + have hplusT : TreeSequenceInitialSegment Bplus T := + ⟨Nat.min_le_right _ _, (fun _ => rfl), (fun _ => rfl)⟩ + have hBBplus : TreeSequenceInitialSegment B Bplus := by + have hle : B.length ≤ Bplus.length := by rw [hlenB, hlenPlus]; omega + refine ⟨hle, ?_, ?_⟩ + · intro i + exact (hplusT.2.1 (Fin.castLE (Nat.succ_le_succ hle) i)).symm.trans + (hBT.2.1 i) + · intro i + exact (hplusT.2.2 (Fin.castLE hle i)).symm.trans (hBT.2.2 i) + have hindex : D.earlierVertexIndex.val < B.length + 1 := by + have hp := D.earlierVertexBeforePenultimate + have hpen := D.penultimateVertexPosition + have hp' : D.earlierVertexIndex.val + 1 < T.length := by + omega + rw [hlenB] + omega + have hindexPlus : D.earlierVertexIndex.val < Bplus.length + 1 := by + rw [hlenPlus] + have hp := D.earlierVertexBeforePenultimate + have hpen := D.penultimateVertexPosition + have hp' : D.earlierVertexIndex.val + 1 < T.length := by + omega + omega + let jPlus : Fin (Bplus.length + 1) := + ⟨D.earlierVertexIndex.val, hindexPlus⟩ + have hvertexPlus : Bplus.vertex jPlus = T.vertex D.earlierVertexIndex := by + have h := hplusT.2.1 jPlus + calc + Bplus.vertex jPlus = T.vertex (Fin.castLE + (Nat.succ_le_succ hplusT.1) jPlus) := h.symm + _ = T.vertex D.earlierVertexIndex := by + apply congrArg T.vertex + apply Fin.ext + rfl + have hbetaMissingPlus : beta ∈ TreeMissingColors phi Bplus := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hmissing + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hBBplus hv, hm⟩ + have halphaMissingPlus : D.alpha ∈ TreeMissingColors phi Bplus := by + apply Finset.mem_biUnion.mpr + refine ⟨T.vertex D.earlierVertexIndex, ?_, D.alphaMissingEarlier⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + exact ⟨jPlus, hvertexPlus.symm⟩ + have hne : D.alpha ≠ beta := by + intro he + exact hterminal (he ▸ D.alphaMissingTerminal) + have hterminalOutside : T.vertex D.terminalVertexIndex ∉ + TreeSequenceVertexSet Bplus := by + intro hv + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let iT : Fin (T.length + 1) := + Fin.castLE (Nat.succ_le_succ hplusT.1) i + have hprefix := hplusT.2.1 i + have heq : iT = D.terminalVertexIndex := by + apply T.vertex_injective + calc + T.vertex iT = Bplus.vertex i := hprefix.symm + _ = T.vertex D.terminalVertexIndex := hi + have hval : i.val = T.length := by + have hx := congrArg Fin.val heq + simpa [iT, D.terminalVertexPosition] using hx + have hlenPlus' : Bplus.length + 1 = T.length := by + rw [hlenPlus] + have hTpos := T.positive + omega + have hi' : i.val < T.length := by + rw [← hlenPlus'] + exact i.isLt + rw [hval] at hi' + exact (Nat.lt_irrefl _ hi') + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) (hUW : TreeSequenceInitialSegment U W) + (hle : S.length ≤ U.length) : TreeSequenceInitialSegment S U := by + refine ⟨hle, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hle) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hle i)).symm.trans (hSW.2.2 i) + have equalTrees {S U : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) (hlen : S.length = U.length) : S = U := by + clear * - hSU hlen + cases S with + | mk ls ps vs es vis eis fs aas => + cases U with + | mk lu pu vu eu viu eiu fu aau => + simp only at hlen + subst lu + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.1 i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.2 i).symm + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) (H.stage ⟨a + d, by omega⟩) := by + clear * - H a d hbound segTrans + induction d with + | zero => exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + have stageToT (j : Fin (H.dividerCount + 2)) : + TreeSequenceInitialSegment (H.stage j) T := by + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have hi : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by change j.val + (H.dividerCount + 1 - j.val) = H.dividerCount + 1; omega) + simpa only [hi, H.terminalStage] using hs + have lastPositive (hp : H.dividerCount ≠ 0) : A = H.stage q.castSucc := by + let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hi : q = i.succ := Fin.ext (by dsimp [q, i]; omega) + change HierarchyStarredStage H q = H.stage q.castSucc + rw [hi] + rfl + have hAT : TreeSequenceInitialSegment A T := by + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hA : A = base.core := by simp [A, HierarchyStarredStage, hq] + exact segTrans (hA ▸ H.coreInsideFirst) (stageToT ⟨1, by omega⟩) + · rw [lastPositive hz] + exact stageToT q.castSucc + exact @helper_continuation_547 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@beta) + (@hmissing) (@hunused) (@halternative) (@hbetaPresent) (@hhit) (@hlenB) (@hlenPlus) (@hBT) + (@hplusT) (@hBBplus) (@hindex) (@hbetaMissingPlus) (@halphaMissingPlus) (@hne) + (@hterminalOutside) (@segTrans) (@commonPrefix) (@equalTrees) (@stageSegment) + (@lastPositive) (@hAT) +private theorem helper_branch_348.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let _ : Finset (Fin k) := {c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi + (T.edge r) = some c}; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := Dnq.biUnion (C.good.gamma q); + let tailUsed : Finset (Fin k) := {c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ phi (T.edge t) = some c}; + ∀ beta ∈ TreeMissingColors phi B, ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → (0 : ℕ) < + H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma ∨ H.dividerCount = (0 : ℕ) ∧ beta ∉ Dn ∧ beta ∉ + Gamma ∨ beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed → beta ∉ MissingColors G phi + (T.vertex D.terminalVertexIndex) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), Nonempty + (HierarchySituationTwoCaseThreeNormalizedData G k e0 P.corresponding.replacementInput T + P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Tn A ell B U Dn Dnq Gamma tailUsed + beta hmissing hunused halternative hterminal + let Bplus := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + let Q := TwoColorComponent G phi D.alpha beta + (Sum.inl (T.vertex D.terminalVertexIndex)) + have hbetaPresent : beta ∉ MissingColors G phi + (T.vertex D.terminalVertexIndex) := hterminal + by_cases hhit : ∃ v ∈ TreeSequenceVertexSet Bplus, + Sum.inl v ∈ Q + · apply helper_branch_402 <;> assumption + · have houtside : ∀ v : V, Sum.inl v ∈ Q → + v ∉ TreeSequenceVertexSet Bplus := by + intro v hv hvB + exact hhit ⟨v, hvB, hv⟩ + obtain ⟨_, _, P, _, N, hN⟩ := + HierarchySituationTwoOutsidePenultimateReconstruction + G k e0 input T phi ett base C ctx D beta hmissing hunused + halternative hbetaPresent houtside + exact ⟨P, ⟨N⟩⟩ + +theorem HierarchySituationTwoCaseThreeNormalization {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeData + G k e0 input T phi ett base C ctx) : + ∃ P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx, + Nonempty (HierarchySituationTwoCaseThreeNormalizedData + G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase + P.counterexample P.minimumContext) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let A := HierarchyStarredStage H q + let ell := T.length - A.length + let B := HierarchyFullTailPrefix C (ell - 2) + let M0 := (TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet Tn).biUnion fun v => MissingColors G phi v + let U := (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, A.length ≤ r.val ∧ + r.val < A.length + (ell - 2) ∧ phi (T.edge r) = some c + let X := (TreeMissingColors phi B \ M0) \ U + let Dn := TashkinovStoredColors ett.series.data n + let Dnq := HierarchyStoredColorsAt H q + let Gamma := Dnq.biUnion (C.good.gamma q) + let tailUsed := (Finset.univ : Finset (Fin k)).filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ phi (T.edge t) = some c + -- Only the two terminal edges add obstructions to the color choice. + have hchoice : ∃ beta : Fin k, + beta ∈ TreeMissingColors phi B ∧ + (∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some beta) ∧ + ((0 < H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma) ∨ + (H.dividerCount = 0 ∧ beta ∉ Dn ∧ beta ∉ Gamma) ∨ + (beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed)) := by + apply HierarchyCaseThreePreparation.helper_hchoice_125 <;> assumption + obtain ⟨beta, hmissing, hunused, halternative⟩ := hchoice + by_cases hterminal : beta ∈ MissingColors G phi + (T.vertex D.terminalVertexIndex) + · apply HierarchyCaseThreePreparation.helper_branch_304 <;> assumption + · apply helper_branch_348 <;> assumption +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalizedData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalizedData.lean new file mode 100644 index 0000000000..c2da9b77cd --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalizedData.lean @@ -0,0 +1,56 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData + +/-! +# Hierarchy Situation Two Case Three Normalized Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The missing-color, unused-tail and normalized-alternative conditions for situation two, case +three. +-/ +structure HierarchySituationTwoCaseThreeNormalizedData {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) extends + HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx where + alphaMissingTwoBefore : + alpha ∈ TreeMissingColors phi (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2)) + alphaUnusedOnFullTail : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + ∀ t : Fin T.length, A.length ≤ t.val → phi (T.edge t) ≠ some alpha + normalizedAlternative : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Dn := TashkinovStoredColors ett.series.data n + let Dnq := HierarchyStoredColorsAt H q + let Gamma := Dnq.biUnion (C.good.gamma q) + let A := HierarchyStarredStage H q + let tailUsed := + (Finset.univ : Finset (Fin k)).filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ phi (T.edge t) = some c + (0 < H.dividerCount ∧ alpha ∉ Dnq ∧ alpha ∉ Gamma) ∨ + (H.dividerCount = 0 ∧ alpha ∉ Dn ∧ alpha ∉ Gamma) ∨ + (alpha ∈ Dnq ∧ Disjoint (C.good.gamma q alpha) tailUsed) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeOneData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeOneData.lean new file mode 100644 index 0000000000..52440c5efa --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeOneData.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalizedData + +/-! +# Hierarchy Situation Two Case Three One Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The case-three condition that the terminal-edge color is present at the penultimate vertex. -/ +structure HierarchySituationTwoCaseThreeOneData {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) extends + HierarchySituationTwoCaseThreeNormalizedData G k e0 input T phi ett base C ctx where + thetaPresentPenultimate : theta ∉ MissingColors G phi (T.vertex penultimateVertexIndex) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeTwoData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeTwoData.lean new file mode 100644 index 0000000000..d3b423a692 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeTwoData.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalizedData + +/-! +# Hierarchy Situation Two Case Three Two Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The case-three condition that the terminal-edge color is missing at the penultimate vertex. -/ +structure HierarchySituationTwoCaseThreeTwoData {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) extends + HierarchySituationTwoCaseThreeNormalizedData G k e0 input T phi ett base C ctx where + thetaMissingPenultimate : theta ∈ MissingColors G phi (T.vertex penultimateVertexIndex) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoData.lean new file mode 100644 index 0000000000..76caaaca73 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoData.lean @@ -0,0 +1,39 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData + +/-! +# Hierarchy Situation Two Case Two Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A color missing at both final vertices and absent from the terminal stored colors. -/ +structure HierarchySituationTwoCaseTwoData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) extends + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx where + /-- The distinguished color constrained by the accompanying missing-color conditions. -/ + alpha : Fin k + alphaMissingPenultimate : alpha ∈ MissingColors G phi (T.vertex penultimateVertexIndex) + alphaMissingTerminal : alpha ∈ MissingColors G phi (T.vertex terminalVertexIndex) + alphaOutsideStored : + alpha ∉ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoExclusions.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoExclusions.lean new file mode 100644 index 0000000000..d834a4f785 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoExclusions.lean @@ -0,0 +1,402 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary + +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData + +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion + +/-! +# Hierarchy Situation Two Case Two Exclusions + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem HierarchySituationTwoCaseTwoExclusions_halphaB_156.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H := C.hierarchy; + let A := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell := HierarchyFullTailLength C; + let B := HierarchyFullTailPrefix C (ell - 2); ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyFullTailPrefix C (ell - 1))) → A.length ≤ T.length → 2 ≤ + ell → ell = T.length - A.length → (HierarchyFullTailPrefix C (ell - 2)).length = T.length + - 2 → (HierarchyFullTailPrefix C (ell - 1)).length = T.length - 1 → + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (ell - 2)) (HierarchyFullTailPrefix + C (ell - 1)) → D.alpha ∉ TreeMissingColors phi B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H A ell B helem hlen htail hEll hBlen + hlast hBseg + dsimp [B] + intro hab + have hab' : D.alpha ∈ + (TreeSequenceVertexSet B).biUnion (fun v => MissingColors G phi v) := by + simpa [TreeMissingColors] using hab + obtain ⟨z, hz, haz⟩ := Finset.mem_biUnion.mp hab' + dsimp [B] at hz + have hz' : ∃ j, j ∈ Finset.univ ∧ + (HierarchyFullTailPrefix C (ell - 2)).vertex j = z := by + simpa only [TreeSequenceVertexSet, Finset.mem_image] using hz + obtain ⟨j, _, hjz⟩ := hz' + have hj : j.val < T.length - 1 := by + have hj0 := j.isLt + have hstep : j.val < T.length - 2 + 1 := by + calc + j.val < (HierarchyFullTailPrefix C (ell - 2)).length + 1 := hj0 + _ = T.length - 2 + 1 := by rw [hBlen] + omega + have hzplus : z ∈ + TreeSequenceVertexSet (HierarchyFullTailPrefix C (ell - 1)) := by + have hvmap := hBseg.2.1 j + simpa only [TreeSequenceVertexSet] using + ((@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨Fin.castLE (Nat.succ_le_succ hBseg.1) j, Finset.mem_univ _, + hvmap.trans hjz⟩) + have hyplus : T.vertex D.penultimateVertexIndex ∈ + TreeSequenceVertexSet (HierarchyFullTailPrefix C (ell - 1)) := by + simpa only [TreeSequenceVertexSet] using + ((@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨Fin.last (HierarchyFullTailPrefix C (ell - 1)).length, + Finset.mem_univ _, by + change T.vertex _ = _ + apply congrArg T.vertex + apply Fin.ext + change (HierarchyFullTailPrefix C (ell - 1)).length = + D.penultimateVertexIndex.val + rw [hlast] + have hp := D.penultimateVertexPosition + omega⟩) + have hne : z ≠ T.vertex D.penultimateVertexIndex := by + intro heq + have hzmap := hBseg.2.1 j + have hyval : (Fin.last (HierarchyFullTailPrefix C (ell - 1)).length).val = + D.penultimateVertexIndex.val := by + rw [hlast] + simp only [Fin.val_last] + have hp := D.penultimateVertexPosition + omega + have heq' : + (HierarchyFullTailPrefix C (ell - 1)).vertex + (Fin.castLE (Nat.succ_le_succ hBseg.1) j) = + (HierarchyFullTailPrefix C (ell - 1)).vertex + (Fin.last (HierarchyFullTailPrefix C (ell - 1)).length) := by + calc + _ = z := Eq.trans hzmap hjz + _ = T.vertex D.penultimateVertexIndex := heq + _ = _ := by + apply congrArg T.vertex + apply Fin.ext + symm + change (Fin.castLE _ (Fin.last (HierarchyFullTailPrefix C (ell - 1)).length)).val = + D.penultimateVertexIndex.val + change (Fin.last (HierarchyFullTailPrefix C (ell - 1)).length).val = + D.penultimateVertexIndex.val + simp only [Fin.val_last] + rw [hlast] + have hp := D.penultimateVertexPosition + omega + have hi := (HierarchyFullTailPrefix C (ell - 1)).vertex_injective heq' + have hv := congrArg Fin.val hi + change j.val = (Fin.last (HierarchyFullTailPrefix C (ell - 1)).length).val at hv + rw [hlast] at hv + simp only [Fin.val_last] at hv + omega + have hd := helem hzplus hyplus hne + exact (Finset.disjoint_left.1 hd) haz D.alphaMissingPenultimate + +private theorem HierarchySituationTwoCaseTwoExclusions_halphaStored_234.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H := C.hierarchy; + let A := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell := HierarchyFullTailLength C; + let B := HierarchyFullTailPrefix C (ell - 2); + let n := Fin.last ett.rounds; TreeSequenceInitialSegment A T → A.length ≤ T.length → 2 ≤ ell → + ell = T.length - A.length → (HierarchyFullTailPrefix C (ell - 2)).length = T.length - 2 → + D.alpha ∉ TreeMissingColors phi B → D.alpha ∉ TashkinovStoredColors ett.series.data n := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H A ell B n hAT hlen htail hEll hBlen + halphaB ha + have haA : D.alpha ∉ TreeMissingColors phi A := by + dsimp [A] at * + intro haA' + have haA'' : D.alpha ∈ + (TreeSequenceVertexSet A).biUnion (fun v => MissingColors G phi v) := by + simpa [TreeMissingColors] using haA' + obtain ⟨v, hv, hav⟩ := Finset.mem_biUnion.mp haA'' + have hvB : v ∈ TreeSequenceVertexSet B := by + dsimp [B] + have hv' : ∃ i, i ∈ Finset.univ ∧ A.vertex i = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image] using hv + obtain ⟨i, _, hiv⟩ := hv' + have hidx := hAT.2.1 i + have hi' : A.length ≤ B.length := by + change A.length ≤ (HierarchyFullTailPrefix C (ell - 2)).length + rw [hBlen] + have hsum : A.length + ell = T.length := by + calc + A.length + ell = A.length + (T.length - A.length) := by rw [hEll] + _ = T.length := Nat.add_sub_of_le hlen + omega + let ib : Fin (B.length + 1) := ⟨i.val, by omega⟩ + have hmem : v ∈ TreeSequenceVertexSet + (HierarchyFullTailPrefix C (ell - 2)) := by + simpa only [TreeSequenceVertexSet] using + ((@Finset.mem_image _ _ (Classical.decEq V)).mpr (⟨ib, Finset.mem_univ _, by + have hmap : + (HierarchyFullTailPrefix C (ell - 2)).vertex ib = A.vertex i := by + change T.vertex _ = A.vertex i + rw [← hidx] + apply congrArg T.vertex + apply Fin.ext + rfl + exact hmap.trans hiv⟩)) + exact hmem + exact halphaB (by + simpa [TreeMissingColors] using + (Finset.mem_biUnion.mpr ⟨v, hvB, hav⟩)) + have hstored : D.alpha ∈ + HierarchyStoredColorsAt H (Fin.last H.dividerCount) := by + unfold HierarchyStoredColorsAt + rw [Finset.mem_sdiff] + exact ⟨ha, haA⟩ + exact D.alphaOutsideStored hstored + +private theorem HierarchySituationTwoCaseTwoExclusions_branch_298.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H := C.hierarchy; + let A := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell := HierarchyFullTailLength C; + let n := Fin.last ett.rounds; ColoredVertexSetElementary G phi (TreeSequenceVertexSet + (HierarchyFullTailPrefix C (ell - 1))) → A.length ≤ T.length → 2 ≤ ell → ell = T.length - + A.length → (HierarchyFullTailPrefix C (ell - 1)).length = T.length - 1 → D.alpha ∉ + TashkinovStoredColors ett.series.data n → + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length ≤ (↑t : ℕ) → ¬(↑t : ℕ) + 1 = T.length → ¬phi (T.edge t) + = some D.alpha := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H A ell n helem hlen htail hEll hlast + halphaStored t ht hlastIndex + have htlt : t.val < T.length - 1 := by omega + let i : Fin (HierarchyFullTailPrefix C (ell - 1)).length := + ⟨t.val, by rw [hlast]; omega⟩ + have hiA : A.length ≤ i.val := by + change A.length ≤ t.val + exact ht + have hi : i.val < A.length + (ell - 1) := by + change t.val < A.length + (ell - 1) + have hsum : A.length + ell = T.length := by omega + omega + have hmi : D.alpha ∈ MissingColors G phi + ((HierarchyFullTailPrefix C (ell - 1)).vertex + (Fin.last (HierarchyFullTailPrefix C (ell - 1)).length)) := by + have hvtx : + (HierarchyFullTailPrefix C (ell - 1)).vertex + (Fin.last (HierarchyFullTailPrefix C (ell - 1)).length) = + T.vertex D.penultimateVertexIndex := by + change T.vertex _ = _ + apply congrArg T.vertex + apply Fin.ext + change (Fin.last (HierarchyFullTailPrefix C (ell - 1)).length).val = + D.penultimateVertexIndex.val + simp only [Fin.val_last] + rw [hlast] + have hp := D.penultimateVertexPosition + omega + rw [hvtx] + exact D.alphaMissingPenultimate + have htail := HierarchyTailMissingColorExclusion G k e0 input T phi ett base H helem + have hone : 1 ≤ ell - 1 := by omega + have hltell : ell - 1 < ell := by omega + have hcon := htail (ell - 1) hone hltell D.alpha hmi i + hiA hi + intro he + have hcase := hcon he + have hex := hcase.2.2.2 + obtain ⟨f, _, _, _, _, _, hstored⟩ := hex + exact halphaStored hstored + +theorem HierarchySituationTwoCaseTwoExclusions {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData + G k e0 input T phi ett base C ctx) : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (ell - 2) + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ TashkinovStoredColors ett.series.data n ∧ + ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some D.alpha := by + dsimp + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (ell - 2) + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + rcases hXY with ⟨hxy, vxy, exy⟩ + rcases hYZ with ⟨hyz, vyz, eyz⟩ + refine ⟨le_trans hxy hyz, ?_, ?_⟩ + · intro i + have hm := vyz (Fin.castLE (Nat.succ_le_succ hxy) i) + simpa using hm.trans (vxy i) + · intro i + have hm := eyz (Fin.castLE hxy i) + simpa using hm.trans (exy i) + have stageSegment : ∀ (a d : ℕ), (hbound : a + d ≤ H.dividerCount + 1) → + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + intro a d hbound + induction d with + | zero => exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + | succ d ih => + apply segmentTrans (ih (by omega)) + have hn := H.nested ⟨a + d, by omega⟩ + simpa [Nat.add_assoc] using hn + have hAstage : ∀ hq : 0 < H.dividerCount, + A = H.stage ⟨H.dividerCount, by omega⟩ := by + intro hq + have hlast : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp + omega + dsimp [A, HierarchyStarredStage] + rw [hlast] + simp only [Fin.cases] + apply congrArg H.stage + apply Fin.ext + simp + omega + have hAT : TreeSequenceInitialSegment A T := by + by_cases hq : H.dividerCount = 0 + · have hc := H.coreInsideFirst + have ht : H.stage ⟨1, by omega⟩ = T := by + have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [hq] + rw [hi] + exact H.terminalStage + have hc' : TreeSequenceInitialSegment base.core T := by + convert hc using 1 + exact ht.symm + simpa [A, H, HierarchyStarredStage, Fin.last, hq] using hc' + · have hs := stageSegment H.dividerCount 1 (by omega) + have ha : A = H.stage ⟨H.dividerCount, by omega⟩ := hAstage (Nat.pos_of_ne_zero hq) + rw [ha] + have ht : H.stage ⟨H.dividerCount + 1, by omega⟩ = T := by + convert H.terminalStage using 1 + apply congrArg H.stage + apply Fin.ext + rfl + simpa [ht] using hs + have helem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyFullTailPrefix C (ell - 1))) := by + change ColoredVertexSetElementary G phi + (TreeSequenceVertexSet + (TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _))) + exact HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + (hproper := ctx.proper) (hone := ctx.oneEdgeUncolored) + (hlower := ctx.lowerRung) (hfewer := ctx.fewerDividers) + (hminimal := ctx.lexicographicMinimality) + ctx.largeMissingSet + have hlen : A.length ≤ T.length := hAT.1 + have htail : 2 ≤ ell := D.tailAtLeastTwo + have hEll : ell = T.length - A.length := by + rfl + have hBlen : (HierarchyFullTailPrefix C (ell - 2)).length = T.length - 2 := by + change min (A.length + (ell - 2)) T.length = T.length - 2 + rw [hEll] + omega + have hlast : (HierarchyFullTailPrefix C (ell - 1)).length = T.length - 1 := by + change min (A.length + (ell - 1)) T.length = T.length - 1 + rw [hEll] + omega + have hBseg : TreeSequenceInitialSegment + (HierarchyFullTailPrefix C (ell - 2)) + (HierarchyFullTailPrefix C (ell - 1)) := by + unfold HierarchyFullTailPrefix + refine ⟨?_, ?_, ?_⟩ + · simp only + change min (A.length + (ell - 2)) T.length ≤ + min (A.length + (ell - 1)) T.length + rw [hEll] + omega + · intro i + rfl + · intro i + rfl + have halphaB : D.alpha ∉ TreeMissingColors phi B := by + exact @HierarchySituationTwoCaseTwoExclusions_halphaB_156 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C ctx D helem hlen htail hEll + hBlen hlast hBseg + have halphaStored : D.alpha ∉ TashkinovStoredColors ett.series.data n := by + exact @HierarchySituationTwoCaseTwoExclusions_halphaStored_234 V E inferInstance + inferInstance inferInstance inferInstance G k e0 input T phi ett base C ctx D hAT hlen + htail hEll hBlen halphaB + refine ⟨halphaB, halphaStored, ?_⟩ + intro t ht + by_cases hlastIndex : t.val + 1 = T.length + · have hi : t = D.lastEdgeIndex := by + apply Fin.ext + have hp := D.lastEdgePosition + omega + intro he + have hedge : T.edge t = T.edge D.lastEdgeIndex := by rw [hi] + have he' : phi (T.edge D.lastEdgeIndex) = some D.alpha := by + rw [← hedge] + exact he + have htheta : phi (T.edge D.lastEdgeIndex) = some D.theta := D.thetaOnLastEdge + have hta : D.theta = D.alpha := Option.some.inj (htheta.symm.trans he') + have hmissTheta : D.theta ∉ MissingColors G phi + (T.vertex D.penultimateVertexIndex) := D.thetaPresentPenultimate + have := hmissTheta + exact this (hta.symm ▸ D.alphaMissingPenultimate) + · exact @HierarchySituationTwoCaseTwoExclusions_branch_298 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C ctx D helem hlen htail hEll hlast + halphaStored t ht hlastIndex +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoTwoData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoTwoData.lean new file mode 100644 index 0000000000..722d075e41 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseTwoTwoData.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCommonTailData + +/-! +# Hierarchy Situation Two Case Two Two Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Case-two color data with the terminal-edge color missing at the penultimate vertex. -/ +structure HierarchySituationTwoCaseTwoTwoData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) extends + HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx where + /-- The distinguished color constrained by the accompanying missing-color conditions. -/ + alpha : Fin k + alphaMissingPenultimate : alpha ∈ MissingColors G phi (T.vertex penultimateVertexIndex) + alphaMissingTerminal : alpha ∈ MissingColors G phi (T.vertex terminalVertexIndex) + alphaOutsideStored : + alpha ∉ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) + thetaMissingPenultimate : theta ∈ MissingColors G phi (T.vertex penultimateVertexIndex) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCommonTailData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCommonTailData.lean new file mode 100644 index 0000000000..0d70ae9d5c --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCommonTailData.lean @@ -0,0 +1,51 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext + +/-! +# Hierarchy Situation Two Common Tail Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The common final-edge positions and coloring data when the hierarchy path number equals its full +tail length. +-/ +structure HierarchySituationTwoCommonTailData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) where + tailAtLeastTwo : 2 ≤ HierarchyFullTailLength C + pathNumberFull : HierarchyPathNumber C.hierarchy = HierarchyFullTailLength C + /-- The index of the final tree edge. -/ + lastEdgeIndex : Fin T.length + /-- The index of the penultimate tree vertex. -/ + penultimateVertexIndex : Fin (T.length + 1) + /-- The index of the final tree vertex. -/ + terminalVertexIndex : Fin (T.length + 1) + lastEdgePosition : lastEdgeIndex.val + 1 = T.length + penultimateVertexPosition : penultimateVertexIndex.val + 1 = T.length + terminalVertexPosition : terminalVertexIndex.val = T.length + lastEdgeNotIncidentPenultimate : + ¬Incident G (T.vertex penultimateVertexIndex) (T.edge lastEdgeIndex) + /-- The auxiliary color with the missing-color conditions recorded below. -/ + theta : Fin k + thetaOnLastEdge : phi (T.edge lastEdgeIndex) = some theta + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoImpossible.lean new file mode 100644 index 0000000000..ff9883fe0a --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoImpossible.lean @@ -0,0 +1,1331 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTerminalCommonMissing +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalization +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalizedData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCommonTailData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneTwo +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeTwo +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoTwo +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeMissingColors + +/-! +# Hierarchy Situation Two Impossible + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch381Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (hsituation : HierarchyPathNumber C.hierarchy = HierarchyFullTailLength C) + (htail : + (2 : ℕ) ≤ + T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) + (hTtwo : (2 : ℕ) ≤ T.length), + let lastEdgeIndex : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let penultimateVertexIndex : Fin (T.length + (1 : ℕ)) := + (⟨T.length - (1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let terminalVertexIndex : Fin (T.length + (1 : ℕ)) := Fin.last T.length; + ∀ (hlastPos : (↑lastEdgeIndex : ℕ) + (1 : ℕ) = T.length) + (hpenPos : (↑penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length) + (htermPos : (↑terminalVertexIndex : ℕ) = T.length) (theta : Fin k) + (htheta : phi (T.edge lastEdgeIndex) = some theta), + let hcommon : HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx := + { + tailAtLeastTwo := htail, pathNumberFull := hsituation, lastEdgeIndex := lastEdgeIndex, + penultimateVertexIndex := penultimateVertexIndex, terminalVertexIndex := terminalVertexIndex, + lastEdgePosition := hlastPos, penultimateVertexPosition := hpenPos, + terminalVertexPosition := htermPos, + lastEdgeNotIncidentPenultimate := + fun (hinc : Incident G (T.vertex penultimateVertexIndex) (T.edge lastEdgeIndex)) => + Exists.casesOn (T.attaches lastEdgeIndex) + fun (i : Fin ((↑lastEdgeIndex : ℕ) + (1 : ℕ))) + (hi : + G.ends (T.edge lastEdgeIndex) = + s(T.vertex lastEdgeIndex.succ, + T.vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ lastEdgeIndex.isLt))))) => + let ii : Fin (T.length + (1 : ℕ)) := + i.castLT (Decidable.byContradiction fun (a : ¬(↑i : ℕ) < T.length + (1 : ℕ)) => by omega); + have hmem : T.vertex penultimateVertexIndex ∈ s(T.vertex lastEdgeIndex.succ, T.vertex ii) := + id + (fun (hinc : T.vertex penultimateVertexIndex ∈ G.ends (T.edge lastEdgeIndex)) => + Eq.mpr (id (propext Sym2.mem_iff)) + (Eq.mp (propext Sym2.mem_iff) + (Eq.mp (congrArg (fun (_a : Sym2 V) => T.vertex penultimateVertexIndex ∈ _a) hi) hinc))) + hinc; + have hcases : + T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ ∨ + T.vertex penultimateVertexIndex = T.vertex ii := + Sym2.mem_iff.mp hmem; + Or.casesOn hcases + (fun (hcase : T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ) => + have hv : T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ := hcase; + have hi' : penultimateVertexIndex = lastEdgeIndex.succ := T.vertex_injective hv; + have hv' : (↑penultimateVertexIndex : ℕ) = (↑lastEdgeIndex.succ : ℕ) := + congrArg Fin.val hi'; + False.elim (Eq.mp (Eq.trans (propext Nat.left_eq_add) (eq_false one_ne_zero)) hv')) + fun (hcase : T.vertex penultimateVertexIndex = T.vertex ii) => + have hv : T.vertex penultimateVertexIndex = T.vertex ii := hcase; + have hi' : penultimateVertexIndex = ii := T.vertex_injective hv; + have hv' : (↑penultimateVertexIndex : ℕ) = (↑ii : ℕ) := congrArg Fin.val hi'; + have hlast : (↑i : ℕ) < T.length := + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < T.length) => by omega; + have hii : ii = penultimateVertexIndex := Eq.symm hi'; + have hends : G.ends (T.edge lastEdgeIndex) = s(T.vertex lastEdgeIndex.succ, T.vertex ii) := + id hi; + have htarget : + G.ends (T.edge lastEdgeIndex) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex) := + Eq.mpr + (id + (congrArg + (fun (_a : Sym2 V) => + _a = s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hends)) + (Eq.mpr + (id + (congrArg + (fun (_a : Fin (T.length + (1 : ℕ))) => + s(T.vertex lastEdgeIndex.succ, T.vertex _a) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hii)) + (have hv : T.vertex lastEdgeIndex.succ = T.vertex terminalVertexIndex := + congrArg T.vertex (Fin.ext (id hpenPos)); + Eq.mpr + (id + (congrArg + (fun (_a : V) => + s(_a, T.vertex penultimateVertexIndex) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hv)) + Sym2.eq_swap)); + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let candidates : Finset ℕ := + {j ∈ Finset.Icc (1 : ℕ) ell | + ∀ (r : Fin T.length), + A.length + j ≤ (↑r : ℕ) → G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}; + have htailA : (2 : ℕ) ≤ T.length - A.length := id htail; + have hAle : A.length ≤ T.length := + Decidable.byContradiction fun (a : ¬A.length ≤ T.length) => by omega; + have hsum : A.length + ell = T.length := Nat.add_sub_of_le hAle; + have hell : ell = T.length - A.length := rfl; + have hmem : ell - (1 : ℕ) ∈ candidates := + Finset.mem_filter.mpr + (⟨Finset.mem_Icc.mpr + (⟨Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ ell - (1 : ℕ)) => by omega, + Decidable.byContradiction fun (a : ¬ell - (1 : ℕ) ≤ ell) => by omega⟩ : + (1 : ℕ) ≤ ell - (1 : ℕ) ∧ ell - (1 : ℕ) ≤ ell), + fun (r : Fin T.length) (hr : A.length + (ell - (1 : ℕ)) ≤ (↑r : ℕ)) => + have hrval : (↑r : ℕ) = T.length - (1 : ℕ) := + Decidable.byContradiction fun (a : ¬(↑r : ℕ) = T.length - (1 : ℕ)) => by omega; + have heq : r = lastEdgeIndex := + Fin.ext + (of_eq_true + (Eq.trans (congrFun' (congrArg Eq hrval) (T.length - (1 : ℕ))) + (eq_self (T.length - (1 : ℕ))))); + Eq.mpr + (id + (congrArg + (fun (_a : Fin T.length) => + G.ends (T.edge _a) = s(T.vertex _a.castSucc, T.vertex _a.succ)) + heq)) + (have hv₁ : T.vertex lastEdgeIndex.castSucc = T.vertex penultimateVertexIndex := + congrArg T.vertex (Fin.ext (of_eq_true (eq_self (T.length - (1 : ℕ))))); + have hv₂ : T.vertex lastEdgeIndex.succ = T.vertex terminalVertexIndex := + congrArg T.vertex (Fin.ext (id hpenPos)); + Eq.mpr + (id + (congrArg + (fun (_a : V) => G.ends (T.edge lastEdgeIndex) = s(_a, T.vertex lastEdgeIndex.succ)) + hv₁)) + (Eq.mpr + (id + (congrArg + (fun (_a : V) => + G.ends (T.edge lastEdgeIndex) = s(T.vertex penultimateVertexIndex, _a)) + hv₂)) + htarget))⟩ : + ell - (1 : ℕ) ∈ Finset.Icc (1 : ℕ) ell ∧ + ∀ (r : Fin T.length), + A.length + (ell - (1 : ℕ)) ≤ (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)); + have hne : candidates.Nonempty := Exists.intro (ell - (1 : ℕ)) hmem; + have hmin : candidates.min' hne ≤ ell - (1 : ℕ) := + Finset.min'_le candidates (ell - (1 : ℕ)) hmem; + have hpath : HierarchyPathNumber C.hierarchy = candidates.min' hne := + of_eq_true + (Eq.trans + (congr + (congrArg Eq + ((fun (x_0 : Decidable candidates.Nonempty) (x_1 : Type) + (x_2 : candidates.Nonempty → x_1) (x_3 : ¬candidates.Nonempty → x_1) => + (fun (x_0 : Decidable candidates.Nonempty) (x_1 : Type) + (x_2 : candidates.Nonempty → x_1) (x_3 : ¬candidates.Nonempty → x_1) => + dite_eq_left hne) + x_0 x_1 x_2 x_3) + Finset.decidableNonempty ℕ + (fun + (h : + {i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.Nonempty) => + {i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.min' + h) + fun + (h : + ¬{i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.Nonempty) => + T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length)) + (Finset.min'.congr_simp candidates + ({i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}) + (Finset.filter_congr fun (x : ℕ) (a : x ∈ Finset.Icc (1 : ℕ) ell) => + Iff.of_eq + (Eq.refl + (∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + x ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)))) + hne)) + (eq_self + ({i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.min' + hne))); + have heq : candidates.min' hne = ell := + Trans.trans (Trans.trans (Eq.symm hpath) hsituation) (Eq.refl (HierarchyFullTailLength C)); + by omega, + theta := theta, thetaOnLastEdge := htheta : + HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx }; + ∀ alpha ∈ MissingColors G phi (T.vertex terminalVertexIndex), + hcommon.penultimateVertexIndex = penultimateVertexIndex → + hcommon.terminalVertexIndex = terminalVertexIndex → + alpha ∈ MissingColors G phi (T.vertex penultimateVertexIndex) → + alpha ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) → False + +private abbrev helperBranch407Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (hsituation : HierarchyPathNumber C.hierarchy = HierarchyFullTailLength C) + (htail : + (2 : ℕ) ≤ + T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) + (hTtwo : (2 : ℕ) ≤ T.length), + let lastEdgeIndex : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let penultimateVertexIndex : Fin (T.length + (1 : ℕ)) := + (⟨T.length - (1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let terminalVertexIndex : Fin (T.length + (1 : ℕ)) := Fin.last T.length; + ∀ (hlastPos : (↑lastEdgeIndex : ℕ) + (1 : ℕ) = T.length) + (hpenPos : (↑penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length) + (htermPos : (↑terminalVertexIndex : ℕ) = T.length) (theta : Fin k) + (htheta : phi (T.edge lastEdgeIndex) = some theta), + let hcommon : HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx := + { + tailAtLeastTwo := htail, pathNumberFull := hsituation, lastEdgeIndex := lastEdgeIndex, + penultimateVertexIndex := penultimateVertexIndex, terminalVertexIndex := terminalVertexIndex, + lastEdgePosition := hlastPos, penultimateVertexPosition := hpenPos, + terminalVertexPosition := htermPos, + lastEdgeNotIncidentPenultimate := + fun (hinc : Incident G (T.vertex penultimateVertexIndex) (T.edge lastEdgeIndex)) => + Exists.casesOn (T.attaches lastEdgeIndex) + fun (i : Fin ((↑lastEdgeIndex : ℕ) + (1 : ℕ))) + (hi : + G.ends (T.edge lastEdgeIndex) = + s(T.vertex lastEdgeIndex.succ, + T.vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ lastEdgeIndex.isLt))))) => + let ii : Fin (T.length + (1 : ℕ)) := + i.castLT (Decidable.byContradiction fun (a : ¬(↑i : ℕ) < T.length + (1 : ℕ)) => by omega); + have hmem : T.vertex penultimateVertexIndex ∈ s(T.vertex lastEdgeIndex.succ, T.vertex ii) := + id + (fun (hinc : T.vertex penultimateVertexIndex ∈ G.ends (T.edge lastEdgeIndex)) => + Eq.mpr (id (propext Sym2.mem_iff)) + (Eq.mp (propext Sym2.mem_iff) + (Eq.mp (congrArg (fun (_a : Sym2 V) => T.vertex penultimateVertexIndex ∈ _a) hi) hinc))) + hinc; + have hcases : + T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ ∨ + T.vertex penultimateVertexIndex = T.vertex ii := + Sym2.mem_iff.mp hmem; + Or.casesOn hcases + (fun (hcase : T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ) => + have hv : T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ := hcase; + have hi' : penultimateVertexIndex = lastEdgeIndex.succ := T.vertex_injective hv; + have hv' : (↑penultimateVertexIndex : ℕ) = (↑lastEdgeIndex.succ : ℕ) := + congrArg Fin.val hi'; + False.elim (Eq.mp (Eq.trans (propext Nat.left_eq_add) (eq_false one_ne_zero)) hv')) + fun (hcase : T.vertex penultimateVertexIndex = T.vertex ii) => + have hv : T.vertex penultimateVertexIndex = T.vertex ii := hcase; + have hi' : penultimateVertexIndex = ii := T.vertex_injective hv; + have hv' : (↑penultimateVertexIndex : ℕ) = (↑ii : ℕ) := congrArg Fin.val hi'; + have hlast : (↑i : ℕ) < T.length := + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < T.length) => by omega; + have hii : ii = penultimateVertexIndex := Eq.symm hi'; + have hends : G.ends (T.edge lastEdgeIndex) = s(T.vertex lastEdgeIndex.succ, T.vertex ii) := + id hi; + have htarget : + G.ends (T.edge lastEdgeIndex) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex) := + Eq.mpr + (id + (congrArg + (fun (_a : Sym2 V) => + _a = s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hends)) + (Eq.mpr + (id + (congrArg + (fun (_a : Fin (T.length + (1 : ℕ))) => + s(T.vertex lastEdgeIndex.succ, T.vertex _a) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hii)) + (have hv : T.vertex lastEdgeIndex.succ = T.vertex terminalVertexIndex := + congrArg T.vertex (Fin.ext (id hpenPos)); + Eq.mpr + (id + (congrArg + (fun (_a : V) => + s(_a, T.vertex penultimateVertexIndex) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hv)) + Sym2.eq_swap)); + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let candidates : Finset ℕ := + {j ∈ Finset.Icc (1 : ℕ) ell | + ∀ (r : Fin T.length), + A.length + j ≤ (↑r : ℕ) → G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}; + have htailA : (2 : ℕ) ≤ T.length - A.length := id htail; + have hAle : A.length ≤ T.length := + Decidable.byContradiction fun (a : ¬A.length ≤ T.length) => by omega; + have hsum : A.length + ell = T.length := Nat.add_sub_of_le hAle; + have hell : ell = T.length - A.length := rfl; + have hmem : ell - (1 : ℕ) ∈ candidates := + Finset.mem_filter.mpr + (⟨Finset.mem_Icc.mpr + (⟨Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ ell - (1 : ℕ)) => by omega, + Decidable.byContradiction fun (a : ¬ell - (1 : ℕ) ≤ ell) => by omega⟩ : + (1 : ℕ) ≤ ell - (1 : ℕ) ∧ ell - (1 : ℕ) ≤ ell), + fun (r : Fin T.length) (hr : A.length + (ell - (1 : ℕ)) ≤ (↑r : ℕ)) => + have hrval : (↑r : ℕ) = T.length - (1 : ℕ) := + Decidable.byContradiction fun (a : ¬(↑r : ℕ) = T.length - (1 : ℕ)) => by omega; + have heq : r = lastEdgeIndex := + Fin.ext + (of_eq_true + (Eq.trans (congrFun' (congrArg Eq hrval) (T.length - (1 : ℕ))) + (eq_self (T.length - (1 : ℕ))))); + Eq.mpr + (id + (congrArg + (fun (_a : Fin T.length) => + G.ends (T.edge _a) = s(T.vertex _a.castSucc, T.vertex _a.succ)) + heq)) + (have hv₁ : T.vertex lastEdgeIndex.castSucc = T.vertex penultimateVertexIndex := + congrArg T.vertex (Fin.ext (of_eq_true (eq_self (T.length - (1 : ℕ))))); + have hv₂ : T.vertex lastEdgeIndex.succ = T.vertex terminalVertexIndex := + congrArg T.vertex (Fin.ext (id hpenPos)); + Eq.mpr + (id + (congrArg + (fun (_a : V) => G.ends (T.edge lastEdgeIndex) = s(_a, T.vertex lastEdgeIndex.succ)) + hv₁)) + (Eq.mpr + (id + (congrArg + (fun (_a : V) => + G.ends (T.edge lastEdgeIndex) = s(T.vertex penultimateVertexIndex, _a)) + hv₂)) + htarget))⟩ : + ell - (1 : ℕ) ∈ Finset.Icc (1 : ℕ) ell ∧ + ∀ (r : Fin T.length), + A.length + (ell - (1 : ℕ)) ≤ (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)); + have hne : candidates.Nonempty := Exists.intro (ell - (1 : ℕ)) hmem; + have hmin : candidates.min' hne ≤ ell - (1 : ℕ) := + Finset.min'_le candidates (ell - (1 : ℕ)) hmem; + have hpath : HierarchyPathNumber C.hierarchy = candidates.min' hne := + of_eq_true + (Eq.trans + (congr + (congrArg Eq + ((fun (x_0 : Decidable candidates.Nonempty) (x_1 : Type) + (x_2 : candidates.Nonempty → x_1) (x_3 : ¬candidates.Nonempty → x_1) => + (fun (x_0 : Decidable candidates.Nonempty) (x_1 : Type) + (x_2 : candidates.Nonempty → x_1) (x_3 : ¬candidates.Nonempty → x_1) => + dite_eq_left hne) + x_0 x_1 x_2 x_3) + Finset.decidableNonempty ℕ + (fun + (h : + {i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.Nonempty) => + {i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.min' + h) + fun + (h : + ¬{i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.Nonempty) => + T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length)) + (Finset.min'.congr_simp candidates + ({i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}) + (Finset.filter_congr fun (x : ℕ) (a : x ∈ Finset.Icc (1 : ℕ) ell) => + Iff.of_eq + (Eq.refl + (∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + x ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)))) + hne)) + (eq_self + ({i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.min' + hne))); + have heq : candidates.min' hne = ell := + Trans.trans (Trans.trans (Eq.symm hpath) hsituation) (Eq.refl (HierarchyFullTailLength C)); + by omega, + theta := theta, thetaOnLastEdge := htheta : + HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx }; + ∀ alpha ∈ MissingColors G phi (T.vertex terminalVertexIndex), + hcommon.penultimateVertexIndex = penultimateVertexIndex → + hcommon.terminalVertexIndex = terminalVertexIndex → + alpha ∈ MissingColors G phi (T.vertex penultimateVertexIndex) → + alpha ∉ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) → False + +private abbrev helperBranch204Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (hsituation : HierarchyPathNumber C.hierarchy = HierarchyFullTailLength C) + (htail : + (2 : ℕ) ≤ + T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) + (hTtwo : (2 : ℕ) ≤ T.length), + let lastEdgeIndex : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let penultimateVertexIndex : Fin (T.length + (1 : ℕ)) := + (⟨T.length - (1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let terminalVertexIndex : Fin (T.length + (1 : ℕ)) := Fin.last T.length; + ∀ (hlastPos : (↑lastEdgeIndex : ℕ) + (1 : ℕ) = T.length) + (hpenPos : (↑penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length) + (htermPos : (↑terminalVertexIndex : ℕ) = T.length) (theta : Fin k) + (htheta : phi (T.edge lastEdgeIndex) = some theta), + let hcommon : HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx := + { + tailAtLeastTwo := htail, pathNumberFull := hsituation, lastEdgeIndex := lastEdgeIndex, + penultimateVertexIndex := penultimateVertexIndex, terminalVertexIndex := terminalVertexIndex, + lastEdgePosition := hlastPos, penultimateVertexPosition := hpenPos, + terminalVertexPosition := htermPos, + lastEdgeNotIncidentPenultimate := + fun (hinc : Incident G (T.vertex penultimateVertexIndex) (T.edge lastEdgeIndex)) => + Exists.casesOn (T.attaches lastEdgeIndex) + fun (i : Fin ((↑lastEdgeIndex : ℕ) + (1 : ℕ))) + (hi : + G.ends (T.edge lastEdgeIndex) = + s(T.vertex lastEdgeIndex.succ, + T.vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ lastEdgeIndex.isLt))))) => + let ii : Fin (T.length + (1 : ℕ)) := + i.castLT (Decidable.byContradiction fun (a : ¬(↑i : ℕ) < T.length + (1 : ℕ)) => by omega); + have hmem : T.vertex penultimateVertexIndex ∈ s(T.vertex lastEdgeIndex.succ, T.vertex ii) := + id + (fun (hinc : T.vertex penultimateVertexIndex ∈ G.ends (T.edge lastEdgeIndex)) => + Eq.mpr (id (propext Sym2.mem_iff)) + (Eq.mp (propext Sym2.mem_iff) + (Eq.mp (congrArg (fun (_a : Sym2 V) => T.vertex penultimateVertexIndex ∈ _a) hi) hinc))) + hinc; + have hcases : + T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ ∨ + T.vertex penultimateVertexIndex = T.vertex ii := + Sym2.mem_iff.mp hmem; + Or.casesOn hcases + (fun (hcase : T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ) => + have hv : T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ := hcase; + have hi' : penultimateVertexIndex = lastEdgeIndex.succ := T.vertex_injective hv; + have hv' : (↑penultimateVertexIndex : ℕ) = (↑lastEdgeIndex.succ : ℕ) := + congrArg Fin.val hi'; + False.elim (Eq.mp (Eq.trans (propext Nat.left_eq_add) (eq_false one_ne_zero)) hv')) + fun (hcase : T.vertex penultimateVertexIndex = T.vertex ii) => + have hv : T.vertex penultimateVertexIndex = T.vertex ii := hcase; + have hi' : penultimateVertexIndex = ii := T.vertex_injective hv; + have hv' : (↑penultimateVertexIndex : ℕ) = (↑ii : ℕ) := congrArg Fin.val hi'; + have hlast : (↑i : ℕ) < T.length := + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < T.length) => by omega; + have hii : ii = penultimateVertexIndex := Eq.symm hi'; + have hends : G.ends (T.edge lastEdgeIndex) = s(T.vertex lastEdgeIndex.succ, T.vertex ii) := + id hi; + have htarget : + G.ends (T.edge lastEdgeIndex) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex) := + Eq.mpr + (id + (congrArg + (fun (_a : Sym2 V) => + _a = s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hends)) + (Eq.mpr + (id + (congrArg + (fun (_a : Fin (T.length + (1 : ℕ))) => + s(T.vertex lastEdgeIndex.succ, T.vertex _a) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hii)) + (have hv : T.vertex lastEdgeIndex.succ = T.vertex terminalVertexIndex := + congrArg T.vertex (Fin.ext (id hpenPos)); + Eq.mpr + (id + (congrArg + (fun (_a : V) => + s(_a, T.vertex penultimateVertexIndex) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hv)) + Sym2.eq_swap)); + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let candidates : Finset ℕ := + {j ∈ Finset.Icc (1 : ℕ) ell | + ∀ (r : Fin T.length), + A.length + j ≤ (↑r : ℕ) → G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}; + have htailA : (2 : ℕ) ≤ T.length - A.length := id htail; + have hAle : A.length ≤ T.length := + Decidable.byContradiction fun (a : ¬A.length ≤ T.length) => by omega; + have hsum : A.length + ell = T.length := Nat.add_sub_of_le hAle; + have hell : ell = T.length - A.length := rfl; + have hmem : ell - (1 : ℕ) ∈ candidates := + Finset.mem_filter.mpr + (⟨Finset.mem_Icc.mpr + (⟨Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ ell - (1 : ℕ)) => by omega, + Decidable.byContradiction fun (a : ¬ell - (1 : ℕ) ≤ ell) => by omega⟩ : + (1 : ℕ) ≤ ell - (1 : ℕ) ∧ ell - (1 : ℕ) ≤ ell), + fun (r : Fin T.length) (hr : A.length + (ell - (1 : ℕ)) ≤ (↑r : ℕ)) => + have hrval : (↑r : ℕ) = T.length - (1 : ℕ) := + Decidable.byContradiction fun (a : ¬(↑r : ℕ) = T.length - (1 : ℕ)) => by omega; + have heq : r = lastEdgeIndex := + Fin.ext + (of_eq_true + (Eq.trans (congrFun' (congrArg Eq hrval) (T.length - (1 : ℕ))) + (eq_self (T.length - (1 : ℕ))))); + Eq.mpr + (id + (congrArg + (fun (_a : Fin T.length) => + G.ends (T.edge _a) = s(T.vertex _a.castSucc, T.vertex _a.succ)) + heq)) + (have hv₁ : T.vertex lastEdgeIndex.castSucc = T.vertex penultimateVertexIndex := + congrArg T.vertex (Fin.ext (of_eq_true (eq_self (T.length - (1 : ℕ))))); + have hv₂ : T.vertex lastEdgeIndex.succ = T.vertex terminalVertexIndex := + congrArg T.vertex (Fin.ext (id hpenPos)); + Eq.mpr + (id + (congrArg + (fun (_a : V) => G.ends (T.edge lastEdgeIndex) = s(_a, T.vertex lastEdgeIndex.succ)) + hv₁)) + (Eq.mpr + (id + (congrArg + (fun (_a : V) => + G.ends (T.edge lastEdgeIndex) = s(T.vertex penultimateVertexIndex, _a)) + hv₂)) + htarget))⟩ : + ell - (1 : ℕ) ∈ Finset.Icc (1 : ℕ) ell ∧ + ∀ (r : Fin T.length), + A.length + (ell - (1 : ℕ)) ≤ (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)); + have hne : candidates.Nonempty := Exists.intro (ell - (1 : ℕ)) hmem; + have hmin : candidates.min' hne ≤ ell - (1 : ℕ) := + Finset.min'_le candidates (ell - (1 : ℕ)) hmem; + have hpath : HierarchyPathNumber C.hierarchy = candidates.min' hne := + of_eq_true + (Eq.trans + (congr + (congrArg Eq + ((fun (x_0 : Decidable candidates.Nonempty) (x_1 : Type) + (x_2 : candidates.Nonempty → x_1) (x_3 : ¬candidates.Nonempty → x_1) => + (fun (x_0 : Decidable candidates.Nonempty) (x_1 : Type) + (x_2 : candidates.Nonempty → x_1) (x_3 : ¬candidates.Nonempty → x_1) => + dite_eq_left hne) + x_0 x_1 x_2 x_3) + Finset.decidableNonempty ℕ + (fun + (h : + {i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.Nonempty) => + {i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.min' + h) + fun + (h : + ¬{i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.Nonempty) => + T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length)) + (Finset.min'.congr_simp candidates + ({i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}) + (Finset.filter_congr fun (x : ℕ) (a : x ∈ Finset.Icc (1 : ℕ) ell) => + Iff.of_eq + (Eq.refl + (∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + x ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)))) + hne)) + (eq_self + ({i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.min' + hne))); + have heq : candidates.min' hne = ell := + Trans.trans (Trans.trans (Eq.symm hpath) hsituation) (Eq.refl (HierarchyFullTailLength C)); + by omega, + theta := theta, thetaOnLastEdge := htheta : + HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx }; + ∀ alpha ∈ MissingColors G phi (T.vertex terminalVertexIndex), + hcommon.penultimateVertexIndex = penultimateVertexIndex → + hcommon.terminalVertexIndex = terminalVertexIndex → + alpha ∈ MissingColors G phi (T.vertex penultimateVertexIndex) → False + +private abbrev helperBranch252Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (hsituation : HierarchyPathNumber C.hierarchy = HierarchyFullTailLength C) + (htail : + (2 : ℕ) ≤ + T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) + (hTtwo : (2 : ℕ) ≤ T.length), + let lastEdgeIndex : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let penultimateVertexIndex : Fin (T.length + (1 : ℕ)) := + (⟨T.length - (1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let terminalVertexIndex : Fin (T.length + (1 : ℕ)) := Fin.last T.length; + ∀ (hlastPos : (↑lastEdgeIndex : ℕ) + (1 : ℕ) = T.length) + (hpenPos : (↑penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length) + (htermPos : (↑terminalVertexIndex : ℕ) = T.length), + lastEdgeIndex ≠ (⟨(0 : ℕ), T.positive⟩ : Fin T.length) → + ∀ (theta : Fin k) (htheta : phi (T.edge lastEdgeIndex) = some theta), + let hcommon : HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx := + { + tailAtLeastTwo := htail, pathNumberFull := hsituation, lastEdgeIndex := lastEdgeIndex, + penultimateVertexIndex := penultimateVertexIndex, terminalVertexIndex := terminalVertexIndex, + lastEdgePosition := hlastPos, penultimateVertexPosition := hpenPos, + terminalVertexPosition := htermPos, + lastEdgeNotIncidentPenultimate := + fun (hinc : Incident G (T.vertex penultimateVertexIndex) (T.edge lastEdgeIndex)) => + Exists.casesOn (T.attaches lastEdgeIndex) + fun (i : Fin ((↑lastEdgeIndex : ℕ) + (1 : ℕ))) + (hi : + G.ends (T.edge lastEdgeIndex) = + s(T.vertex lastEdgeIndex.succ, + T.vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ lastEdgeIndex.isLt))))) => + let ii : Fin (T.length + (1 : ℕ)) := + i.castLT (Decidable.byContradiction fun (a : ¬(↑i : ℕ) < T.length + (1 : ℕ)) => by omega); + have hmem : + T.vertex penultimateVertexIndex ∈ s(T.vertex lastEdgeIndex.succ, T.vertex ii) := + id + (fun (hinc : T.vertex penultimateVertexIndex ∈ G.ends (T.edge lastEdgeIndex)) => + Eq.mpr (id (propext Sym2.mem_iff)) + (Eq.mp (propext Sym2.mem_iff) + (Eq.mp (congrArg (fun (_a : Sym2 V) => T.vertex penultimateVertexIndex ∈ _a) hi) + hinc))) + hinc; + have hcases : + T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ ∨ + T.vertex penultimateVertexIndex = T.vertex ii := + Sym2.mem_iff.mp hmem; + Or.casesOn hcases + (fun (hcase : T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ) => + have hv : T.vertex penultimateVertexIndex = T.vertex lastEdgeIndex.succ := hcase; + have hi' : penultimateVertexIndex = lastEdgeIndex.succ := T.vertex_injective hv; + have hv' : (↑penultimateVertexIndex : ℕ) = (↑lastEdgeIndex.succ : ℕ) := + congrArg Fin.val hi'; + False.elim (Eq.mp (Eq.trans (propext Nat.left_eq_add) (eq_false one_ne_zero)) hv')) + fun (hcase : T.vertex penultimateVertexIndex = T.vertex ii) => + have hv : T.vertex penultimateVertexIndex = T.vertex ii := hcase; + have hi' : penultimateVertexIndex = ii := T.vertex_injective hv; + have hv' : (↑penultimateVertexIndex : ℕ) = (↑ii : ℕ) := congrArg Fin.val hi'; + have hlast : (↑i : ℕ) < T.length := + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < T.length) => by omega; + have hii : ii = penultimateVertexIndex := Eq.symm hi'; + have hends : + G.ends (T.edge lastEdgeIndex) = s(T.vertex lastEdgeIndex.succ, T.vertex ii) := id hi; + have htarget : + G.ends (T.edge lastEdgeIndex) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex) := + Eq.mpr + (id + (congrArg + (fun (_a : Sym2 V) => + _a = s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hends)) + (Eq.mpr + (id + (congrArg + (fun (_a : Fin (T.length + (1 : ℕ))) => + s(T.vertex lastEdgeIndex.succ, T.vertex _a) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hii)) + (have hv : T.vertex lastEdgeIndex.succ = T.vertex terminalVertexIndex := + congrArg T.vertex (Fin.ext (id hpenPos)); + Eq.mpr + (id + (congrArg + (fun (_a : V) => + s(_a, T.vertex penultimateVertexIndex) = + s(T.vertex penultimateVertexIndex, T.vertex terminalVertexIndex)) + hv)) + Sym2.eq_swap)); + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let candidates : Finset ℕ := + {j ∈ Finset.Icc (1 : ℕ) ell | + ∀ (r : Fin T.length), + A.length + j ≤ (↑r : ℕ) → G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}; + have htailA : (2 : ℕ) ≤ T.length - A.length := id htail; + have hAle : A.length ≤ T.length := + Decidable.byContradiction fun (a : ¬A.length ≤ T.length) => by omega; + have hsum : A.length + ell = T.length := Nat.add_sub_of_le hAle; + have hell : ell = T.length - A.length := rfl; + have hmem : ell - (1 : ℕ) ∈ candidates := + Finset.mem_filter.mpr + (⟨Finset.mem_Icc.mpr + (⟨Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ ell - (1 : ℕ)) => by omega, + Decidable.byContradiction fun (a : ¬ell - (1 : ℕ) ≤ ell) => by omega⟩ : + (1 : ℕ) ≤ ell - (1 : ℕ) ∧ ell - (1 : ℕ) ≤ ell), + fun (r : Fin T.length) (hr : A.length + (ell - (1 : ℕ)) ≤ (↑r : ℕ)) => + have hrval : (↑r : ℕ) = T.length - (1 : ℕ) := + Decidable.byContradiction fun (a : ¬(↑r : ℕ) = T.length - (1 : ℕ)) => by omega; + have heq : r = lastEdgeIndex := + Fin.ext + (of_eq_true + (Eq.trans (congrFun' (congrArg Eq hrval) (T.length - (1 : ℕ))) + (eq_self (T.length - (1 : ℕ))))); + Eq.mpr + (id + (congrArg + (fun (_a : Fin T.length) => + G.ends (T.edge _a) = s(T.vertex _a.castSucc, T.vertex _a.succ)) + heq)) + (have hv₁ : T.vertex lastEdgeIndex.castSucc = T.vertex penultimateVertexIndex := + congrArg T.vertex (Fin.ext (of_eq_true (eq_self (T.length - (1 : ℕ))))); + have hv₂ : T.vertex lastEdgeIndex.succ = T.vertex terminalVertexIndex := + congrArg T.vertex (Fin.ext (id hpenPos)); + Eq.mpr + (id + (congrArg + (fun (_a : V) => + G.ends (T.edge lastEdgeIndex) = s(_a, T.vertex lastEdgeIndex.succ)) + hv₁)) + (Eq.mpr + (id + (congrArg + (fun (_a : V) => + G.ends (T.edge lastEdgeIndex) = s(T.vertex penultimateVertexIndex, _a)) + hv₂)) + htarget))⟩ : + ell - (1 : ℕ) ∈ Finset.Icc (1 : ℕ) ell ∧ + ∀ (r : Fin T.length), + A.length + (ell - (1 : ℕ)) ≤ (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)); + have hne : candidates.Nonempty := Exists.intro (ell - (1 : ℕ)) hmem; + have hmin : candidates.min' hne ≤ ell - (1 : ℕ) := + Finset.min'_le candidates (ell - (1 : ℕ)) hmem; + have hpath : HierarchyPathNumber C.hierarchy = candidates.min' hne := + of_eq_true + (Eq.trans + (congr + (congrArg Eq + ((fun (x_0 : Decidable candidates.Nonempty) (x_1 : Type) + (x_2 : candidates.Nonempty → x_1) (x_3 : ¬candidates.Nonempty → x_1) => + (fun (x_0 : Decidable candidates.Nonempty) (x_1 : Type) + (x_2 : candidates.Nonempty → x_1) (x_3 : ¬candidates.Nonempty → x_1) => + dite_eq_left hne) + x_0 x_1 x_2 x_3) + Finset.decidableNonempty ℕ + (fun + (h : + {i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.Nonempty) => + {i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.min' + h) + fun + (h : + ¬{i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.Nonempty) => + T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length)) + (Finset.min'.congr_simp candidates + ({i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}) + (Finset.filter_congr fun (x : ℕ) (a : x ∈ Finset.Icc (1 : ℕ) ell) => + Iff.of_eq + (Eq.refl + (∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + x ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)))) + hne)) + (eq_self + ({i ∈ + Finset.Icc (1 : ℕ) + (T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length) | + ∀ (r : Fin T.length), + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + i ≤ + (↑r : ℕ) → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ)}.min' + hne))); + have heq : candidates.min' hne = ell := + Trans.trans (Trans.trans (Eq.symm hpath) hsituation) + (Eq.refl (HierarchyFullTailLength C)); + by omega, + theta := theta, thetaOnLastEdge := htheta : + HierarchySituationTwoCommonTailData G k e0 input T phi ett base C ctx }; + ∀ + alpha ∈ + TreeMissingColors phi + (TreeSequencePrefix T + (min + ((HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - + (1 : ℕ))) + T.length) + ((by omega)) + (Nat.min_le_right + ((HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - + (1 : ℕ))) + T.length)), + alpha ∈ MissingColors G phi (T.vertex terminalVertexIndex) → + hcommon.penultimateVertexIndex = penultimateVertexIndex → + hcommon.terminalVertexIndex = terminalVertexIndex → + alpha ∉ MissingColors G phi (T.vertex penultimateVertexIndex) → False + +private theorem helper_branch_109.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyPathNumber C.hierarchy = HierarchyFullTailLength C → + (2 : ℕ) ≤ + T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length → + ∀ (hTtwo : (2 : ℕ) ≤ T.length), + let lastEdgeIndex : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let penultimateVertexIndex : Fin (T.length + (1 : ℕ)) := + (⟨T.length - (1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let terminalVertexIndex : Fin (T.length + (1 : ℕ)) := Fin.last T.length; + (↑lastEdgeIndex : ℕ) + (1 : ℕ) = T.length → + (↑penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length → + (↑terminalVertexIndex : ℕ) = T.length → + ¬Incident G (T.vertex penultimateVertexIndex) (T.edge lastEdgeIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hsituation htail hTtwo lastEdgeIndex + penultimateVertexIndex terminalVertexIndex hlastPos hpenPos htermPos hinc + obtain ⟨i, hi⟩ := T.attaches lastEdgeIndex + let ii : Fin (T.length + 1) := i.castLT (by omega) + have hmem : T.vertex penultimateVertexIndex ∈ + s(T.vertex lastEdgeIndex.succ, T.vertex ii) := by + change T.vertex penultimateVertexIndex ∈ G.ends (T.edge lastEdgeIndex) at hinc + rw [hi] at hinc + simpa [ii] using hinc + have hcases := (Sym2.mem_iff.mp hmem) + rcases hcases with hcase | hcase + · have hv : T.vertex penultimateVertexIndex = + T.vertex lastEdgeIndex.succ := hcase + have hi' : penultimateVertexIndex = lastEdgeIndex.succ := + T.vertex_injective hv + have hv' := congrArg Fin.val hi' + simp [penultimateVertexIndex, lastEdgeIndex] at hv' + · have hv : T.vertex penultimateVertexIndex = T.vertex ii := hcase + have hi' : penultimateVertexIndex = ii := T.vertex_injective hv + have hv' := congrArg Fin.val hi' + have hlast : i.val < T.length := by omega + dsimp [ii] at hi' + dsimp [penultimateVertexIndex] at hv' + have hii : ii = penultimateVertexIndex := hi'.symm + have hends : G.ends (T.edge lastEdgeIndex) = + s(T.vertex lastEdgeIndex.succ, T.vertex ii) := by + simpa [ii] using hi + have htarget : G.ends (T.edge lastEdgeIndex) = + s(T.vertex penultimateVertexIndex, + T.vertex terminalVertexIndex) := by + rw [hends, hii] + have hv : T.vertex lastEdgeIndex.succ = + T.vertex terminalVertexIndex := by + apply congrArg T.vertex + apply Fin.ext + simp [lastEdgeIndex, terminalVertexIndex] + omega + rw [hv] + exact Sym2.eq_swap + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let candidates := (Finset.Icc 1 ell).filter fun j => + ∀ r : Fin T.length, A.length + j ≤ r.val → + G.ends (T.edge r) = s(T.vertex r.castSucc, T.vertex r.succ) + have htailA : 2 ≤ T.length - A.length := by + simpa [A, H] using htail + have hAle : A.length ≤ T.length := by omega + have hsum : A.length + ell = T.length := + Nat.add_sub_of_le hAle + have hell : ell = T.length - A.length := rfl + have hmem : ell - 1 ∈ candidates := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_Icc.mpr ⟨by omega, by omega⟩, ?_⟩ + intro r hr + have hrval : r.val = T.length - 1 := by + omega + have heq : r = lastEdgeIndex := by + apply Fin.ext + simp [lastEdgeIndex, hrval] + rw [heq] + have hv₁ : T.vertex lastEdgeIndex.castSucc = + T.vertex penultimateVertexIndex := by + apply congrArg T.vertex + apply Fin.ext + simp [lastEdgeIndex, penultimateVertexIndex] + have hv₂ : T.vertex lastEdgeIndex.succ = + T.vertex terminalVertexIndex := by + apply congrArg T.vertex + apply Fin.ext + simp [lastEdgeIndex, terminalVertexIndex] + omega + rw [hv₁, hv₂] + exact htarget + have hne : candidates.Nonempty := ⟨ell - 1, hmem⟩ + have hmin : candidates.min' hne ≤ ell - 1 := + Finset.min'_le candidates (ell - 1) hmem + have hpath : HierarchyPathNumber C.hierarchy = candidates.min' hne := by + simp [HierarchyPathNumber, H, A, ell, candidates, dite_eq_left hne] + have heq : candidates.min' hne = ell := by + calc + candidates.min' hne = HierarchyPathNumber C.hierarchy := hpath.symm + _ = HierarchyFullTailLength C := hsituation + _ = ell := by rfl + omega + +private theorem helper_branch_381.{u_1, u_2} : + helperBranch381Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation htail hTtwo lastEdgeIndex + penultimateVertexIndex terminalVertexIndex hlastPos hpenPos htermPos theta htheta hcommon + alpha halphaFinal hidxPen hidxTerm hpen hstored + have hcard := C.good.twoColors (Fin.last C.hierarchy.dividerCount) + alpha hstored + obtain ⟨gammaOne, gammaTwo, hdistinct, hpair⟩ := + Finset.card_eq_two.mp hcard + by_cases hmissing : theta ∈ MissingColors G phi + (T.vertex penultimateVertexIndex) + · let D : HierarchySituationTwoCaseOneTwoData + G k e0 input T phi ett base C ctx := + ⟨hcommon, alpha, gammaOne, gammaTwo, + (by simpa [hidxPen] using hpen), + (by simpa [hidxTerm] using halphaFinal), + hstored, by simpa using hpair, hdistinct, hmissing⟩ + exact HierarchySituationTwoSubcaseOneTwo + G k e0 input T phi ett base C ctx D + · let tail : HierarchySituationTwoTailData + G k e0 input T phi ett base C ctx := + ⟨htail, hsituation, lastEdgeIndex, penultimateVertexIndex, + terminalVertexIndex, hlastPos, hpenPos, htermPos, + (by simpa using hcommon.lastEdgeNotIncidentPenultimate), theta, + htheta, (by simpa [hidxPen] using hmissing)⟩ + let D : HierarchySituationTwoCaseOneData + G k e0 input T phi ett base C ctx := + ⟨tail, alpha, gammaOne, gammaTwo, hpen, halphaFinal, + hstored, by simpa using hpair, hdistinct⟩ + exact HierarchySituationTwoSubcaseOneOne + G k e0 input T phi ett base C ctx D + +private theorem helper_branch_407.{u_1, u_2} : + helperBranch407Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation htail hTtwo lastEdgeIndex + penultimateVertexIndex terminalVertexIndex hlastPos hpenPos htermPos theta htheta hcommon + alpha halphaFinal hidxPen hidxTerm hpen hstored + by_cases hmissing : theta ∈ MissingColors G phi + (T.vertex penultimateVertexIndex) + · let D : HierarchySituationTwoCaseTwoTwoData + G k e0 input T phi ett base C ctx := + ⟨hcommon, alpha, (by simpa [hidxPen] using hpen), + (by simpa [hidxTerm] using halphaFinal), hstored, + (by simpa [hidxPen] using hmissing)⟩ + exact HierarchySituationTwoSubcaseTwoTwo + G k e0 input T phi ett base C ctx D + · let tail : HierarchySituationTwoTailData + G k e0 input T phi ett base C ctx := + ⟨htail, hsituation, lastEdgeIndex, penultimateVertexIndex, + terminalVertexIndex, hlastPos, hpenPos, htermPos, + (by simpa using hcommon.lastEdgeNotIncidentPenultimate), theta, + htheta, (by simpa [hidxPen] using hmissing)⟩ + let D : HierarchySituationTwoCaseTwoData + G k e0 input T phi ett base C ctx := + ⟨tail, alpha, hpen, halphaFinal, hstored⟩ + exact HierarchySituationTwoSubcaseTwoOne + G k e0 input T phi ett base C ctx D + +private theorem helper_branch_204.{u_1, u_2} : + helperBranch204Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation htail hTtwo lastEdgeIndex + penultimateVertexIndex terminalVertexIndex hlastPos hpenPos htermPos theta htheta hcommon + alpha halphaFinal hidxPen hidxTerm hpen + by_cases hstored : alpha ∈ HierarchyStoredColorsAt C.hierarchy + (Fin.last C.hierarchy.dividerCount) + · exact @helper_branch_381 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hsituation htail hTtwo hlastPos hpenPos htermPos theta htheta + alpha halphaFinal hidxPen hidxTerm hpen hstored + · exact @helper_branch_407 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hsituation htail hTtwo hlastPos hpenPos htermPos theta htheta + alpha halphaFinal hidxPen hidxTerm hpen hstored +private theorem helper_branch_252.{u_1, u_2} : + helperBranch252Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation htail hTtwo lastEdgeIndex + penultimateVertexIndex terminalVertexIndex hlastPos hpenPos htermPos hlastNeFirst theta + htheta hcommon alpha halphaTree halphaFinal hidxPen hidxTerm hpen + let Bplus := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + have hB : alpha ∈ TreeMissingColors phi Bplus := by + simpa [Bplus, HierarchyFullTailPrefix, HierarchyFullTailLength] using halphaTree + simp only [TreeMissingColors, TreeSequenceVertexSet, Finset.mem_biUnion, Finset.mem_image, + Finset.mem_univ, + true_and, exists_exists_eq_and] at hB + obtain ⟨a, ha⟩ := hB + have hBlen : Bplus.length = T.length - 1 := by + change min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + + (HierarchyFullTailLength C - 1)) T.length = T.length - 1 + have hA := (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).positive + have hEll : HierarchyFullTailLength C = T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length := by rfl + rw [hEll] + omega + let earlierVertexIndex : Fin (T.length + 1) := + ⟨a.val, by have ha' := a.isLt; omega⟩ + have haMissing : alpha ∈ MissingColors G phi + (T.vertex earlierVertexIndex) := by + convert ha using 1 + apply congrArg (fun v => MissingColors G phi v) + apply congrArg T.vertex + apply Fin.ext + rfl + have hbefore : earlierVertexIndex.val < penultimateVertexIndex.val := by + have hlt : earlierVertexIndex.val < T.length := by + dsimp [earlierVertexIndex] + have ha' := a.isLt + omega + have hne : earlierVertexIndex ≠ penultimateVertexIndex := by + intro he + apply hpen + simpa [he] using haMissing + have hle : earlierVertexIndex.val ≤ penultimateVertexIndex.val := by + dsimp [penultimateVertexIndex] + omega + omega + let D : HierarchySituationTwoCaseThreeData + G k e0 input T phi ett base C ctx := + ⟨hcommon, alpha, (by simpa [hidxTerm] using halphaFinal), + earlierVertexIndex, (by simpa using hbefore), haMissing⟩ + obtain ⟨P, hP⟩ := HierarchySituationTwoCaseThreeNormalization + G k e0 input T phi ett base C ctx D + obtain ⟨N⟩ := hP + by_cases hmissing : N.theta ∈ MissingColors G P.coloring + (T.vertex N.penultimateVertexIndex) + · exact HierarchySituationTwoSubcaseThreeTwo + G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext + ⟨N, hmissing⟩ + · exact HierarchySituationTwoSubcaseThreeOne + G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext + ⟨N, hmissing⟩ + +theorem HierarchySituationTwoImpossible {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hsituation : + HierarchyPathNumber C.hierarchy = HierarchyFullTailLength C) : + False := by + classical + have htail : 2 ≤ T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length := by + exact HierarchyCounterexampleTailAtLeastTwo G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have hApos : 1 ≤ (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length := by + exact (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).positive + have hTtwo : 2 ≤ T.length := by omega + let lastEdgeIndex : Fin T.length := ⟨T.length - 1, by omega⟩ + let penultimateVertexIndex : Fin (T.length + 1) := + ⟨T.length - 1, by omega⟩ + let terminalVertexIndex : Fin (T.length + 1) := Fin.last T.length + have hlastPos : lastEdgeIndex.val + 1 = T.length := by + dsimp [lastEdgeIndex] + omega + have hpenPos : penultimateVertexIndex.val + 1 = T.length := by + dsimp [penultimateVertexIndex] + omega + have htermPos : terminalVertexIndex.val = T.length := by + simp [terminalVertexIndex] + have hlastNeFirst : lastEdgeIndex ≠ (⟨0, T.positive⟩ : Fin T.length) := by + intro h + have : lastEdgeIndex.val = 0 := congrArg Fin.val h + simp [lastEdgeIndex] at this + omega + have hedgeNe : T.edge lastEdgeIndex ≠ e0 := by + intro he + apply hlastNeFirst + apply T.edge_injective + simpa [T.first_edge] using he + obtain ⟨theta, htheta⟩ := ctx.oneEdgeUncolored.2 _ hedgeNe + let hcommon : HierarchySituationTwoCommonTailData + G k e0 input T phi ett base C ctx := by + refine ⟨htail, hsituation, lastEdgeIndex, penultimateVertexIndex, + terminalVertexIndex, hlastPos, hpenPos, htermPos, ?_, theta, htheta⟩ + · exact @helper_branch_109 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C hsituation htail hTtwo hlastPos hpenPos htermPos + obtain ⟨alpha, halphaTree, halphaTerm⟩ := + HierarchyCounterexampleTerminalCommonMissing G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have halphaFinal : alpha ∈ MissingColors G phi + (T.vertex terminalVertexIndex) := by + simpa [terminalVertexIndex] using halphaTerm + have hidxPen : hcommon.penultimateVertexIndex = penultimateVertexIndex := by rfl + have hidxTerm : hcommon.terminalVertexIndex = terminalVertexIndex := by rfl + by_cases hpen : alpha ∈ MissingColors G phi + (T.vertex penultimateVertexIndex) + · exact @helper_branch_204 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hsituation htail hTtwo hlastPos hpenPos htermPos theta htheta + alpha halphaFinal hidxPen hidxTerm hpen + · exact @helper_branch_252 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hsituation htail hTtwo hlastPos hpenPos htermPos hlastNeFirst + theta htheta alpha halphaTree halphaFinal hidxPen hidxTerm hpen +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoOutsidePenultimateReconstruction.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoOutsidePenultimateReconstruction.lean new file mode 100644 index 0000000000..d6ba61d489 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoOutsidePenultimateReconstruction.lean @@ -0,0 +1,154 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TerminalPrefixReconstruction +public import LeanPool.GoldbergSeymour.StableColoringFullCertificate +public import LeanPool.GoldbergSeymour.TerminalHierarchyRestore +public import LeanPool.GoldbergSeymour.MinimumContextTransport +public import LeanPool.GoldbergSeymour.NormalizedDatum + +/-! +# Hierarchy Situation Two Outside Penultimate Reconstruction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchySituationTwoOutsidePenultimateReconstruction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeData + G k e0 input T phi ett base C ctx) + (beta : Fin k) + (hbetaMissingTwoBefore : + beta ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2))) + (hbetaUnusedOnFullTail : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some beta) + (hbetaAlternative : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Dn := TashkinovStoredColors ett.series.data n + let Dnq := HierarchyStoredColorsAt H q + let Gamma := Dnq.biUnion (C.good.gamma q) + let A := HierarchyStarredStage H q + let tailUsed := (Finset.univ : Finset (Fin k)).filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ + phi (T.edge t) = some c + (0 < H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma) ∨ + (H.dividerCount = 0 ∧ beta ∉ Dn ∧ beta ∉ Gamma) ∨ + (beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed)) + (hbetaPresentTerminal : + beta ∉ MissingColors G phi (T.vertex D.terminalVertexIndex)) + (houtsidePenultimate : + let Bplus := HierarchyFullTailPrefix C + (HierarchyFullTailLength C - 1) + let yp := T.vertex D.terminalVertexIndex + ∀ v : V, + Sum.inl v ∈ TwoColorComponent G phi D.alpha beta (Sum.inl yp) → + v ∉ TreeSequenceVertexSet Bplus) : + let _ := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + let yp := T.vertex D.terminalVertexIndex + let Q := TwoColorComponent G phi D.alpha beta (Sum.inl yp) + let sigma := TwoColorComponentSwap G phi D.alpha beta (Sum.inl yp) + Sum.inl yp ∈ Q ∧ + (∃ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ Q) ∧ + ∃ P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx, + P.coloring = sigma ∧ + ∃ N : HierarchySituationTwoCaseThreeNormalizedData + G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase + P.counterexample P.minimumContext, + N.alpha = beta := by + classical + dsimp only + let sigma := TwoColorComponentSwap G phi D.alpha beta + (Sum.inl (T.vertex D.terminalVertexIndex)) + let Bplus := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + obtain ⟨hroot, hmeet, hfixed, hstable, hterminal, ⟨F⟩⟩ := + P2752_T2_PrefixReconstruction G k e0 input T phi ett base C ctx D beta + hbetaUnusedOnFullTail hbetaPresentTerminal houtsidePenultimate + obtain ⟨corr, hMP⟩ := P2752_T2_FullCertificate G k e0 input T phi sigma + ett base C ctx Bplus F hfixed hstable + obtain ⟨newBase, K, good, hsame⟩ := + P2752_T2_TerminalHierarchyRestore G k e0 input T phi sigma ett base C ctx D + beta hbetaMissingTwoBefore hbetaPresentTerminal rfl F hfixed corr + let B := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2) + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, (fun _ => rfl), (fun _ => rfl)⟩ + have hlenB : B.length = T.length - 2 := by + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + have hp : 2 ≤ T.length - A.length := D.tailAtLeastTwo + change min (A.length + (T.length - A.length - 2)) T.length = T.length - 2 + omega + have hBplus : TreeSequenceInitialSegment B Bplus := by + have hle : B.length ≤ Bplus.length := by + have hp : T.length = Bplus.length + 1 := F.penultimateLength + omega + refine ⟨hle, ?_, ?_⟩ + · intro i + rw [← F.belowFull.2.1 (Fin.castLE (Nat.succ_le_succ hle) i)] + convert hBT.2.1 i using 1 + congr 1 + · intro i + rw [← F.belowFull.2.2 (Fin.castLE hle i)] + convert hBT.2.2 i using 1 + congr 1 + have hnotElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hbetaMissingTwoBefore + have hvplus := TreeSequenceInitialSegmentVertexSetSubset hBplus hv + have hmissing : beta ∈ MissingColors G sigma v := by + rw [F.invariant.2 v hvplus] + exact hm + have hne : v ≠ T.vertex D.terminalVertexIndex := by + intro heq + exact houtsidePenultimate (T.vertex D.terminalVertexIndex) hroot (heq ▸ hvplus) + intro helementary + have hd := helementary (TreeSequenceInitialSegmentVertexSetSubset hBT hv) + (by simp [TreeSequenceVertexSet]) hne + exact Finset.disjoint_left.mp hd hmissing hterminal + let Cnew : HierarchyCounterexample newBase := { + positive := by rw [corr.rungAgreement]; exact C.positive + hierarchy := K + good := good + maximum := hMP + notElementary := hnotElementary } + obtain ⟨newContext⟩ := P2752_T2_MinimumContextTransport G k e0 input T phi sigma + ett base C ctx corr newBase Cnew hsame + let P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := { + coloring := sigma + corresponding := corr + maximum := hMP + replacementBase := newBase + counterexample := Cnew + sameGood := hsame + minimumContext := newContext } + obtain ⟨N, hN⟩ := P2752_T2_NormalizedDatum G k e0 input T phi ett base C ctx D + beta hbetaMissingTwoBefore hbetaUnusedOnFullTail hbetaAlternative P + hfixed F.invariant hterminal + exact ⟨hroot, hmeet, P, rfl, N, hN⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTrees.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTrees.lean new file mode 100644 index 0000000000..5c84288858 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTrees.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData + +/-! +# Hierarchy Situation Two Reordered Trees + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Certified reordered penultimate and final trees preserving the relevant vertex and edge sets. -/ +structure HierarchySituationTwoReorderedTrees {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx) where + /-- The index of the next-to-last tree edge. -/ + penultimateEdgeIndex : Fin T.length + penultimateEdgePosition : penultimateEdgeIndex.val + 2 = T.length + /-- The reordered penultimate tree. -/ + minus : TreeSequence G e0 + /-- The reordered final tree. -/ + star : TreeSequence G e0 + originalPenultimate : + TreeSequenceAdjoinEdge (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2)) + (T.edge penultimateEdgeIndex) (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) + originalFinal : + TreeSequenceAdjoinEdge (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) + (T.edge D.lastEdgeIndex) T + minusFinal : + TreeSequenceAdjoinEdge (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2)) + (T.edge D.lastEdgeIndex) minus + minusTerminalVertex : minus.vertex (Fin.last minus.length) = T.vertex D.terminalVertexIndex + starFinal : TreeSequenceAdjoinEdge minus (T.edge penultimateEdgeIndex) star + starPenultimateVertex : star.vertex (Fin.last star.length) = T.vertex D.penultimateVertexIndex + minusVertexSet : + TreeSequenceVertexSet minus = TreeSequenceVertexSet T \ {T.vertex D.penultimateVertexIndex} + minusEdgeSet : TreeSequenceEdgeSet minus = TreeSequenceEdgeSet T \ {T.edge penultimateEdgeIndex} + starVertexSet : TreeSequenceVertexSet star = TreeSequenceVertexSet T + starEdgeSet : TreeSequenceEdgeSet star = TreeSequenceEdgeSet T + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified.lean new file mode 100644 index 0000000000..3185356d37 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified.lean @@ -0,0 +1,252 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified.Preparation2 + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeUnique +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix + +/-! +# Hierarchy Situation Two Reordered Trees Certified + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open HierarchySituationTwoReorderedTreesCertifiedPreparation + +theorem HierarchySituationTwoReorderedTreesCertified {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoTailData + G k e0 input T phi ett base C ctx) : + ∃ R : HierarchySituationTwoReorderedTrees + G k e0 input T phi ett base C ctx D, + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let B := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2) + (B = Tn → + ett.series.data.kind n = some TashkinovExtensionKind.PE) ∧ + ((ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn R.minus) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed R.minus)) ∧ + ((ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn R.star) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed R.star)) ∧ + ∃ corrMinus : CorrespondingExtendedTashkinovTree + G k e0 ett phi R.minus, + MaximumProperty corrMinus.replacementETT ∧ + ∃ baseMinus : HierarchyBase corrMinus.replacementETT phi, + baseMinus.core = base.core ∧ + baseMinus.closure = base.closure ∧ + baseMinus.supportPosition.val = base.supportPosition.val ∧ + ∃ HMinus : TashkinovHierarchy + corrMinus.replacementETT baseMinus, + ∃ hMinusCount : + HMinus.dividerCount = C.hierarchy.dividerCount, + (∀ j : Fin (HMinus.dividerCount + 1), + HMinus.stage j.castSucc = + C.hierarchy.stage + (Fin.cast + (congrArg (fun d => d + 1) hMinusCount) j).castSucc) ∧ + (∀ j : Fin HMinus.dividerCount, + (HMinus.dividerPosition j).val = + (C.hierarchy.dividerPosition + (Fin.cast hMinusCount j)).val) ∧ + ∃ corrStar : CorrespondingExtendedTashkinovTree + G k e0 ett phi R.star, + MaximumProperty corrStar.replacementETT ∧ + ∃ baseStar : HierarchyBase + corrStar.replacementETT phi, + baseStar.core = base.core ∧ + baseStar.closure = base.closure ∧ + baseStar.supportPosition.val = + base.supportPosition.val ∧ + ∃ HStar : TashkinovHierarchy + corrStar.replacementETT baseStar, + ∃ hStarCount : + HStar.dividerCount = + C.hierarchy.dividerCount, + (∀ j : Fin (HStar.dividerCount + 1), + HStar.stage j.castSucc = + C.hierarchy.stage + (Fin.cast + (congrArg (fun d => d + 1) + hStarCount) j).castSucc) ∧ + ∀ j : Fin HStar.dividerCount, + (HStar.dividerPosition j).val = + (C.hierarchy.dividerPosition + (Fin.cast hStarCount j)).val := by + classical + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (ell - 2) + let P := HierarchyFullTailPrefix C (ell - 1) + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + -- Exact ordered prefixes will be used for both route restriction and hierarchy copying. + have segmentRefl (X : TreeSequence G e0) : TreeSequenceInitialSegment X X := + ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + rcases hXY with ⟨hxy, vxy, exy⟩ + rcases hYZ with ⟨hyz, vyz, eyz⟩ + refine ⟨le_trans hxy hyz, ?_, ?_⟩ + · intro i + simpa using (vyz (Fin.castLE (Nat.succ_le_succ hxy) i)).trans (vxy i) + · intro i + simpa using (eyz (Fin.castLE hxy i)).trans (exy i) + have commonPrefix {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + refine ⟨hXY, ?_, ?_⟩ + · intro i + have hv := hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i) + exact hv.symm.trans (by simpa using hXZ.2.1 i) + · intro i + have he := hYZ.2.2 (Fin.castLE hXY i) + exact he.symm.trans (by simpa using hXZ.2.2 i) + have equalTrees {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) (hlen : X.length = Y.length) : + X = Y := by + exact helper_equalTrees_631 G e0 hXY hlen + have prefixSegment (X : TreeSequence G e0) (r : ℕ) + (hr : 1 ≤ r) (hx : r ≤ X.length) : + TreeSequenceInitialSegment (TreeSequencePrefix X r hr hx) X := + ⟨hx, (fun _ => rfl), (fun _ => rfl)⟩ + have prefixEq {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) : + X = TreeSequencePrefix Y X.length X.positive hXY.1 := by + apply equalTrees + (commonPrefix hXY (prefixSegment Y X.length X.positive hXY.1) le_rfl) + rfl + have stageSegment : ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1), + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + intro a d + induction d with + | zero => intro hbound; exact segmentRefl _ + | succ d ih => + intro hbound + exact segmentTrans (ih (by omega)) + (by + convert H.nested ⟨a + d, by omega⟩ using 1 <;> + congr 1) + have stageToT (i : Fin (H.dividerCount + 2)) : + TreeSequenceInitialSegment (H.stage i) T := by + have hs := stageSegment i.val (H.dividerCount + 1 - i.val) (by omega) + have hi : (⟨i.val + (H.dividerCount + 1 - i.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp + omega + simpa [hi, H.terminalStage] using hs + have hAstage (hq : 0 < H.dividerCount) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact helper_hAstage_679 G k e0 input T phi ett base C hq + have hAcore (hq : H.dividerCount = 0) : A = base.core := by + simp [A, HierarchyStarredStage, Fin.last, hq] + have hAT : TreeSequenceInitialSegment A T := by + by_cases hq : H.dividerCount = 0 + · rw [hAcore hq] + exact segmentTrans H.coreInsideFirst (stageToT _) + · rw [hAstage (by omega)] + exact stageToT _ + have hcoreA : TreeSequenceInitialSegment base.core A := by + by_cases hq : H.dividerCount = 0 + · rw [hAcore hq]; exact segmentRefl _ + · rw [hAstage (by omega)] + exact segmentTrans H.coreInsideFirst + (by + convert stageSegment 1 (H.dividerCount - 1) (by omega) using 1 + congr 1 + apply Fin.ext + simp + omega) + have hell : ell = T.length - A.length := rfl + have htwo : 2 ≤ ell := D.tailAtLeastTwo + have hAlen : A.length ≤ T.length := hAT.1 + have hBlen : B.length = T.length - 2 := by + change min (A.length + (ell - 2)) T.length = T.length - 2 + omega + have hPlen : P.length = T.length - 1 := by + change min (A.length + (ell - 1)) T.length = T.length - 1 + omega + have hm : 3 ≤ T.length := by have := A.positive; omega + have hBT : TreeSequenceInitialSegment B T := prefixSegment _ _ _ _ + apply helper_continuation_891 <;> assumption +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation1.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation1.lean new file mode 100644 index 0000000000..ce08f38ee1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation1.lean @@ -0,0 +1,1423 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeUnique +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix + +/-! +# HierarchySituationTwoReorderedTreesCertified: supporting constructions, part 1 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.HierarchySituationTwoReorderedTreesCertifiedPreparation + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation891Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ (X : TreeSequence G e0), TreeSequenceInitialSegment X X)) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : + TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y)) (_ : ( + ∀ {X Y : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : X.length = Y.length), X + = Y)) (_ : ( + ∀ (X : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hx : r ≤ X.length), + TreeSequenceInitialSegment (TreeSequencePrefix X r hr hx) X)) (_ : ( + ∀ {X Y : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y), X = TreeSequencePrefix Y + X.length X.positive hXY.1)) (_ : ( + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, Decidable.byContradiction fun (a_1 : ¬a < H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, Decidable.byContradiction fun (a_1 : ¬a + + d < H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))))) (_ : ( + ∀ (i : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage i) T)) (_ : ( + ∀ (_ : (0 : ℕ) < H.dividerCount), A = H.stage (⟨H.dividerCount, Decidable.byContradiction fun + (a : ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))) (_ : TreeSequenceInitialSegment A T) (_ : + TreeSequenceInitialSegment base.core A) (_ : ell = T.length - A.length) (_ : (2 : ℕ) ≤ + ell) (_ : A.length ≤ T.length) (_ : B.length = T.length - (2 : ℕ)) (_ : P.length = + T.length - (1 : ℕ)) (_ : (3 : ℕ) ≤ T.length) (_ : TreeSequenceInitialSegment B T), + ∃ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx D), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + (B = Tn → ett.series.data.kind n = some TashkinovExtensionKind.PE) ∧ (ett.series.data.kind + n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence phi Tn R.minus ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind n = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed R.minus) ∧ + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn R.star ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed R.star) ∧ + ∃ (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus), MaximumProperty + corrMinus.replacementETT ∧ + ∃ (baseMinus : HierarchyBase corrMinus.replacementETT phi), baseMinus.core = base.core ∧ + baseMinus.closure = base.closure ∧ (↑baseMinus.supportPosition : ℕ) = + (↑base.supportPosition : ℕ) ∧ + ∃ (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) (hMinusCount : + HMinus.dividerCount = C.hierarchy.dividerCount), ( + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), HMinus.stage j.castSucc = C.hierarchy.stage + (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hMinusCount) j).castSucc) ∧ ( + ∀ (j : Fin HMinus.dividerCount), (↑(HMinus.dividerPosition j) : ℕ) = + (↑(C.hierarchy.dividerPosition (Fin.cast hMinusCount j)) : ℕ)) ∧ + ∃ (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star), MaximumProperty + corrStar.replacementETT ∧ + ∃ (baseStar : HierarchyBase corrStar.replacementETT phi), baseStar.core = base.core ∧ + baseStar.closure = base.closure ∧ (↑baseStar.supportPosition : ℕ) = (↑base.supportPosition + : ℕ) ∧ + ∃ (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) (hStarCount : + HStar.dividerCount = C.hierarchy.dividerCount), ( + ∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), HStar.stage j.castSucc = C.hierarchy.stage + (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hStarCount) j).castSucc) ∧ + ∀ (j : Fin HStar.dividerCount), (↑(HStar.dividerPosition j) : ℕ) = + (↑(C.hierarchy.dividerPosition (Fin.cast hStarCount j)) : ℕ) + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation941Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : + TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y)) (_ : ( + ∀ {X Y : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : X.length = Y.length), X + = Y)) (_ : ( + ∀ (X : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hx : r ≤ X.length), + TreeSequenceInitialSegment (TreeSequencePrefix X r hr hx) X)) (_ : ( + ∀ {X Y : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y), X = TreeSequencePrefix Y + X.length X.positive hXY.1)) (_ : ( + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, Decidable.byContradiction fun (a_1 : ¬a < H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, Decidable.byContradiction fun (a_1 : ¬a + + d < H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))))) (_ : ( + ∀ (i : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage i) T)) (_ : ( + ∀ (_ : (0 : ℕ) < H.dividerCount), A = H.stage (⟨H.dividerCount, Decidable.byContradiction fun + (a : ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))) (_ : TreeSequenceInitialSegment base.core A) (_ : + B.length = T.length - (2 : ℕ)) (_ : P.length = T.length - (1 : ℕ)) (hm : (3 : ℕ) ≤ + T.length) (_ : TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment P T) (_ : + TreeSequenceInitialSegment B P) (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment Tn B), + let r : Fin T.length := (⟨T.length - (2 : ℕ), Decidable.byContradiction fun (a : ¬T.length - + (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let f : E := T.edge r; + let g : E := T.edge D.lastEdgeIndex; + let y : V := T.vertex D.penultimateVertexIndex; + let z : V := T.vertex D.terminalVertexIndex; + ∀ (_ : (↑r : ℕ) + (2 : ℕ) = T.length) (_ : (↑D.lastEdgeIndex : ℕ) + (1 : ℕ) = T.length) (_ : + (↑D.penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length) (_ : (↑D.terminalVertexIndex : ℕ) = + T.length) (_ : TreeSequenceAdjoinEdge B f P) (_ : TreeSequenceAdjoinEdge P g T) (_ : + P.vertex (Fin.last P.length) = y) (_ : T.vertex (Fin.last T.length) = z) (_ : ( + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), X.vertex i ∈ TreeSequenceVertexSet + X)) (_ : ( + ∀ {X U : TreeSequence G e0} {e : E} (_ : TreeSequenceAdjoinEdge X e U), TreeSequenceVertexSet + U = insert (U.vertex (Fin.last U.length)) (TreeSequenceVertexSet X) ∧ TreeSequenceEdgeSet + U = insert e (TreeSequenceEdgeSet X))) (_ : ( + ∀ {X U : TreeSequence G e0} {e : E} {v w : V} (_ : TreeSequenceAdjoinEdge X e U) (_ : v ∉ + TreeSequenceVertexSet X) (_ : w ∈ TreeSequenceVertexSet X) (_ : G.ends e = s(v, w)), + U.vertex (Fin.last U.length) = v)) (_ : z ∉ TreeSequenceVertexSet B) (_ : y ∉ + TreeSequenceVertexSet B) (_ : y ≠ z) (ig : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (_ : + G.ends (T.edge D.lastEdgeIndex) = s(T.vertex D.lastEdgeIndex.succ, T.vertex (ig.castLT + (Nat.lt_trans ig.isLt (Nat.succ_lt_succ D.lastEdgeIndex.isLt))))) (_ : (↑ig : ℕ) < + B.length + (1 : ℕ)), + ∃ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx D), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + (B = Tn → ett.series.data.kind n = some TashkinovExtensionKind.PE) ∧ (ett.series.data.kind + n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence phi Tn R.minus ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind n = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed R.minus) ∧ + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn R.star ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed R.star) ∧ + ∃ (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus), MaximumProperty + corrMinus.replacementETT ∧ + ∃ (baseMinus : HierarchyBase corrMinus.replacementETT phi), baseMinus.core = base.core ∧ + baseMinus.closure = base.closure ∧ (↑baseMinus.supportPosition : ℕ) = + (↑base.supportPosition : ℕ) ∧ + ∃ (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) (hMinusCount : + HMinus.dividerCount = C.hierarchy.dividerCount), ( + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), HMinus.stage j.castSucc = C.hierarchy.stage + (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hMinusCount) j).castSucc) ∧ ( + ∀ (j : Fin HMinus.dividerCount), (↑(HMinus.dividerPosition j) : ℕ) = + (↑(C.hierarchy.dividerPosition (Fin.cast hMinusCount j)) : ℕ)) ∧ + ∃ (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star), MaximumProperty + corrStar.replacementETT ∧ + ∃ (baseStar : HierarchyBase corrStar.replacementETT phi), baseStar.core = base.core ∧ + baseStar.closure = base.closure ∧ (↑baseStar.supportPosition : ℕ) = (↑base.supportPosition + : ℕ) ∧ + ∃ (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) (hStarCount : + HStar.dividerCount = C.hierarchy.dividerCount), ( + ∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), HStar.stage j.castSucc = C.hierarchy.stage + (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hStarCount) j).castSucc) ∧ + ∀ (j : Fin HStar.dividerCount), (↑(HStar.dividerPosition j) : ℕ) = + (↑(C.hierarchy.dividerPosition (Fin.cast hStarCount j)) : ℕ) + +theorem helper_adjoinSets_322.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), (3 : ℕ) ≤ T.length → + ∀ {X U : TreeSequence G e0} {e : E}, TreeSequenceAdjoinEdge X e U → TreeSequenceVertexSet U = + insert (U.vertex (Fin.last U.length)) (TreeSequenceVertexSet X) ∧ TreeSequenceEdgeSet U = + insert e (TreeSequenceEdgeSet X) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hm X U e ha + rcases ha with ⟨hl, hs, he⟩ + constructor + · ext v + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and, Finset.mem_insert] + constructor + · rintro ⟨i, rfl⟩ + by_cases hi : i.val < X.length + 1 + · right + exact ⟨⟨i.val, hi⟩, (hs.2.1 ⟨i.val, hi⟩).symm⟩ + · left + congr 1 + apply Fin.ext + simp + omega + · rintro (hv | ⟨i, rfl⟩) + · exact ⟨Fin.last U.length, hv.symm⟩ + · exact ⟨Fin.castLE (Nat.succ_le_succ hs.1) i, hs.2.1 i⟩ + · ext e' + simp only [TreeSequenceEdgeSet, Finset.mem_image, Finset.mem_univ, + true_and, Finset.mem_insert] + constructor + · rintro ⟨i, rfl⟩ + by_cases hi : i.val < X.length + · right + exact ⟨⟨i.val, hi⟩, (hs.2.2 ⟨i.val, hi⟩).symm⟩ + · left + have hi' : i = Fin.cast hl.symm (Fin.last X.length) := by + apply Fin.ext + simp + omega + exact hi' ▸ he + · rintro (hv | ⟨i, rfl⟩) + · exact ⟨Fin.cast hl.symm (Fin.last X.length), he.trans hv.symm⟩ + · exact ⟨Fin.castLE hs.1 i, hs.2.2 i⟩ + +theorem helper_stepRoute_542.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), ( + ∀ (X : TreeSequence G e0) (colors : Finset (Fin k)) (old new : PartialEdgeColoring E k), + IsProperEdgeColoring G old → IsOneEdgeUncolored old e0 → IsProperEdgeColoring G new → + IsOneEdgeUncolored new e0 → StableColoring X colors old new → ColoredVertexSetClosed G old + (TreeSequenceVertexSet X) → ColoredVertexSetClosed G new (TreeSequenceVertexSet X)) → + ∀ (j : Fin (ett.rounds + (1 : ℕ))), j ≠ (0 : Fin (ett.rounds + (1 : ℕ))) → + ett.series.data.kind j = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + (ett.series.data.coloring j) (ett.series.data.tree j.castSucc) (ett.series.data.tree + j.succ) ∨ (ett.series.data.kind j = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + j = some TashkinovExtensionKind.RE) ∧ ColoredVertexSetClosed G (ett.series.data.coloring + j) (TreeSequenceVertexSet (ett.series.data.tree j.castSucc)) ∧ + ∃ (e : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges j = { e } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree j.castSucc) e seed ∧ + TashkinovAugmentationSequence (ett.series.data.coloring j) seed (ett.series.data.tree + j.succ) := by + classical + intro V E _ _ _ G k e0 input T phi ett stableClosed j hj + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => exact False.elim (hj rfl) + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + refine Or.inr ⟨Or.inl currentKind, ?_, choice.edge, adjoined, + currentEdges, adjoinedExactly, closedExtension.1⟩ + rw [currentColoring] + exact stableClosed _ _ _ _ previousProper previousOneUncolored + choice.selectedProper choice.selectedOneUncolored + choice.selectedStable previousClosed + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact Or.inl ⟨currentKind, closedExtension.1⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + refine Or.inr ⟨Or.inr currentKind, ?_, available.edge, adjoined, + currentEdges, adjoinedExactly, closedExtension.1⟩ + rw [currentColoring] + exact previousClosed + +theorem helper_routes_692.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : + TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y)) (_ : ( + ∀ {X Y : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : X.length = Y.length), X + = Y)) (_ : B.length = T.length - (2 : ℕ)) (_ : P.length = T.length - (1 : ℕ)) (hm : (3 : + ℕ) ≤ T.length) (_ : TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment P T) + (_ : TreeSequenceInitialSegment B P) (_ : TreeSequenceInitialSegment Tn B), + let r : Fin T.length := (⟨T.length - (2 : ℕ), Decidable.byContradiction fun (a : ¬T.length - + (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let f : E := T.edge r; + let g : E := T.edge D.lastEdgeIndex; + ∀ (_ : (↑r : ℕ) + (2 : ℕ) = T.length) (_ : (↑D.lastEdgeIndex : ℕ) + (1 : ℕ) = T.length) (_ : + (↑D.penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length) (_ : (↑D.terminalVertexIndex : ℕ) = + T.length) (_ : TreeSequenceAdjoinEdge B f P) (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) + (M : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge B g M) (_ : Fin ((↑r : ℕ) + (1 : ℕ))) + (S : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge M f S) (_ : TreeSequenceEdgeSet P = + insert f (TreeSequenceEdgeSet B)), + let Z : TreeSequence G e0 := ett.series.data.tree n.succ; + ∀ (_ : TreeSequenceInitialSegment T Z) (_ : n ≠ (0 : Fin (ett.rounds + (1 : ℕ)))) (_ : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn Z ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + n = some TashkinovExtensionKind.RE) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet + Tn) ∧ + ∃ (e : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = { e } ∧ + TreeSequenceAdjoinEdge Tn e seed ∧ TashkinovAugmentationSequence phi seed Z)) (_ : ( + ∀ (e : E) (seed : TreeSequence G e0) (_ : ett.series.data.kind n = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind n = some TashkinovExtensionKind.RE) (_ : + ett.series.data.connectingEdges n = { e }) (_ : TreeSequenceAdjoinEdge Tn e seed), + TreeSequenceInitialSegment seed T)) (_ : ( + ∀ {X Y : TreeSequence G e0} (_ : TashkinovAugmentationSequence phi X Y) (_ : Y.length = + X.length + (1 : ℕ)), TashkinovAugmentation phi X Y)) (_ : ( + ∀ (_ : B = Tn), ett.series.data.kind n = some TashkinovExtensionKind.PE)) (_ : ( + ∀ {X U : TreeSequence G e0} {e : E} {c : Fin k} (_ : TreeSequenceAdjoinEdge X e U) (_ : phi e + = some c) (_ : c ∈ TreeMissingColors phi X), TashkinovAugmentation phi X U)) (_ : + TashkinovAugmentation phi B M), (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn M ∨ (ett.series.data.kind n = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (e : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = { e } ∧ + TreeSequenceAdjoinEdge Tn e seed ∧ TashkinovAugmentationSequence phi seed M) ∧ + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn S ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + n = some TashkinovExtensionKind.RE) ∧ + ∃ (e : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = { e } ∧ + TreeSequenceAdjoinEdge Tn e seed ∧ TashkinovAugmentationSequence phi seed S) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B P n Tn segmentTrans commonPrefix + equalTrees hBlen hPlen hm hBT hPT hBP hTnB r f g hr hgpos hypos hzpos hOrigP ig M hBM if_ S + hMS hPE Z hTZ hnzero terminalRoute seedToT oneStep hboundaryPE augmentOfAdjoin hBMaug + have extendRoute (source : TreeSequence G e0) + (hsourceB : TreeSequenceInitialSegment source B) + (hseqT : TashkinovAugmentationSequence phi source T) : + TashkinovAugmentationSequence phi source M ∧ + TashkinovAugmentationSequence phi source S := by + have hseqB := TashkinovAugmentationSequenceRestrict phi source B T hseqT hsourceB hBT + have hseqBT := TashkinovAugmentationSequenceSuffix phi source B T hseqT hsourceB hBT + have hseqBP := TashkinovAugmentationSequenceRestrict phi B P T hseqBT hBP hPT + have hBPaug := oneStep hseqBP (by omega) + rcases hBPaug with ⟨hl, hs, c, he, hc⟩ + have hef : P.edge (Fin.cast hl.symm (Fin.last B.length)) = f := hOrigP.choose_spec.2 + have hcM : c ∈ TreeMissingColors phi M := by + obtain ⟨v, hv, hmissing⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hBM.choose_spec.1 hv, hmissing⟩ + have hMSaug := augmentOfAdjoin hMS (hef ▸ he) hcM + have hseqM : TashkinovAugmentationSequence phi source M := + Relation.ReflTransGen.tail hseqB hBMaug + exact ⟨hseqM, Relation.ReflTransGen.tail hseqM hMSaug⟩ + rcases terminalRoute with ⟨hp, hseq⟩ | ⟨hk, hc, e, seed, he, ha, hseq⟩ + · have hseqT := TashkinovAugmentationSequenceRestrict phi Tn T Z hseq + (segmentTrans hTnB hBT) hTZ + obtain ⟨hm, hs⟩ := extendRoute Tn hTnB hseqT + exact ⟨Or.inl ⟨hp, hm⟩, Or.inl ⟨hp, hs⟩⟩ + · have hBN : B ≠ Tn := by + intro hBN + have hPE := hboundaryPE hBN + rcases hk with hk | hk <;> rw [hk] at hPE <;> cases hPE + have hstrict : Tn.length < B.length := by + have hle := hTnB.1 + by_contra hn + exact hBN (equalTrees hTnB (by omega)).symm + have hseedT := seedToT e seed hk he ha + have hseedB := commonPrefix hseedT hBT (by have := ha.1; omega) + have hseqT := TashkinovAugmentationSequenceRestrict phi seed T Z hseq hseedT hTZ + obtain ⟨hm, hs⟩ := extendRoute seed hseedB hseqT + exact ⟨Or.inr ⟨hk, e, seed, he, ha, hm⟩, Or.inr ⟨hk, e, seed, he, ha, hs⟩⟩ + +theorem helper_copyHierarchy_812.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) (_ : ( + ∀ {X Y : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y), X = TreeSequencePrefix Y + X.length X.positive hXY.1)) (_ : TreeSequenceInitialSegment base.core A) (_ : B.length = + T.length - (2 : ℕ)) (hm : (3 : ℕ) ≤ T.length) (_ : TreeSequenceInitialSegment A B), + let r : Fin T.length := (⟨T.length - (2 : ℕ), Decidable.byContradiction fun (a : ¬T.length - + (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + ∀ (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (M : TreeSequence G e0) (_ : Fin ((↑r : ℕ) + (1 + : ℕ))) (S : TreeSequence G e0) (_ : M.length = B.length + (1 : ℕ)) (_ : S.length = + M.length + (1 : ℕ)) (_ : TreeSequenceInitialSegment (H.stage (Fin.last + H.dividerCount).castSucc) B) (_ : ( + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage i.castSucc) B)) (_ + : ( + ∀ (X : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi X), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn)) + (X : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi X) (_ : + TreeSequenceInitialSegment B X) (_ : B.length < X.length), + ∃ (bx : HierarchyBase corr.replacementETT phi), bx.core = base.core ∧ bx.closure = + base.closure ∧ (↑bx.supportPosition : ℕ) = (↑base.supportPosition : ℕ) ∧ + ∃ (K : TashkinovHierarchy corr.replacementETT bx) (hcount : K.dividerCount = H.dividerCount), + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), K.stage j.castSucc = H.stage (Fin.cast (congrArg (fun + (d : ℕ) ↦ d + (1 : ℕ)) hcount) j).castSucc) ∧ + ∀ (j : Fin K.dividerCount), (↑(K.dividerPosition j) : ℕ) = (↑(H.dividerPosition (Fin.cast + hcount j)) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H A ell B n Tn segmentTrans prefixEq + hcoreA hBlen hm hAB r ig M if_ S hMlen hSlen hlastB hstageB terminalTree X corr hBX hstrictBX + -- Transport the base, then retain every stage and divider before the new terminal tree. + obtain ⟨bx, hcore, hclosure, hsupport⟩ := + HierarchyBaseCorrespondingTransport G k e0 input T X phi ett corr base + let stages : Fin (H.dividerCount + 2) → TreeSequence G e0 := + fun i => if hi : i.val < H.dividerCount + 1 then H.stage ⟨i.val, by omega⟩ else X + have stagesOld (i : Fin (H.dividerCount + 1)) : + stages i.castSucc = H.stage i.castSucc := by + simp only [stages, Fin.val_castSucc, dite_eq_left i.isLt] + congr 1 + have stagesLast : stages (Fin.last (H.dividerCount + 1)) = X := by + simp [stages] + have oldStageLength (i : Fin H.dividerCount) : + (H.stage i.succ.castSucc).length = (H.dividerPosition i).val := by + have hd := H.dividerStage i + have hi : (⟨i.val + 1, by omega⟩ : Fin (H.dividerCount + 2)) = i.succ.castSucc := by + apply Fin.ext + rfl + rw [hi] at hd + exact congrArg TreeSequence.length hd + have positionB (i : Fin H.dividerCount) : (H.dividerPosition i).val ≤ B.length := by + rw [← oldStageLength i] + exact (hstageB i.succ).1 + let positions : Fin H.dividerCount → Fin (X.length + 1) := + fun i => ⟨(H.dividerPosition i).val, by have := positionB i; omega⟩ + let K : TashkinovHierarchy corr.replacementETT bx := by + exact { + dividerCount := H.dividerCount + stage := stages + baseStage := by + have h0 := stagesOld (0 : Fin (H.dividerCount + 1)) + have hi : (0 : Fin (H.dividerCount + 1)).castSucc = + (0 : Fin (H.dividerCount + 2)) := by apply Fin.ext; rfl + rw [hi] at h0 + rw [h0, H.baseStage, terminalTree X corr] + terminalStage := stagesLast + nested := by + intro j + by_cases hj : j.val < H.dividerCount + · let i : Fin (H.dividerCount + 1) := ⟨j.val + 1, by omega⟩ + have hi : i.castSucc = j.succ := by apply Fin.ext; rfl + rw [stagesOld j, ← hi, stagesOld i] + exact H.nested j + · have hjlast : j = Fin.last H.dividerCount := by + apply Fin.ext + simp + omega + have hnext : j.succ = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp + omega + rw [stagesOld j, hnext, stagesLast, hjlast] + exact segmentTrans hlastB hBX + strict := by + intro j + by_cases hj : j.val < H.dividerCount + · let i : Fin (H.dividerCount + 1) := ⟨j.val + 1, by omega⟩ + have hi : i.castSucc = j.succ := by apply Fin.ext; rfl + rw [stagesOld j, ← hi, stagesOld i] + exact H.strict j + · have hjlast : j = Fin.last H.dividerCount := by + apply Fin.ext + simp + omega + have hnext : j.succ = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp + omega + rw [stagesOld j, hnext, stagesLast, hjlast] + exact lt_of_le_of_lt hlastB.1 hstrictBX + dividerPosition := positions + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := by + intro i + have hi : (⟨i.val + 1, by omega⟩ : Fin (H.dividerCount + 2)) = i.succ.castSucc := by + apply Fin.ext + rfl + rw [hi, stagesOld i.succ] + have hstageX := segmentTrans (hstageB i.succ) hBX + have hp := prefixEq hstageX + simpa only [oldStageLength i] using hp + coreInsideFirst := by + rw [hcore] + by_cases hq : H.dividerCount = 0 + · have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by apply Fin.ext; simp [hq] + rw [hi, stagesLast] + exact segmentTrans hcoreA (segmentTrans hAB hBX) + · let i : Fin (H.dividerCount + 1) := ⟨1, by omega⟩ + have hi : i.castSucc = (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) := by + apply Fin.ext + rfl + rw [← hi, stagesOld i] + exact H.coreInsideFirst } + refine ⟨bx, hcore, hclosure, hsupport, K, rfl, ?_, ?_⟩ + · intro j + exact stagesOld j + · intro j + rfl + +theorem helper_seedToT_936.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : + TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y)) (_ : ( + ∀ (X : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hx : r ≤ X.length), + TreeSequenceInitialSegment (TreeSequencePrefix X r hr hx) X)) (_ : ( + ∀ (i : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage i) T)) (hm : (3 : + ℕ) ≤ T.length) (_ : TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment Tn B), + let r : Fin T.length := (⟨T.length - (2 : ℕ), Decidable.byContradiction fun (a : ¬T.length - + (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + ∀ (_ : (↑r : ℕ) + (2 : ℕ) = T.length) (_ : (↑D.lastEdgeIndex : ℕ) + (1 : ℕ) = T.length) (_ : + (↑D.penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length) (_ : (↑D.terminalVertexIndex : ℕ) = + T.length) (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (_ : Fin ((↑r : ℕ) + (1 : ℕ))) (e : + E) (seed : TreeSequence G e0) (_ : ett.series.data.kind n = some TashkinovExtensionKind.SE + ∨ ett.series.data.kind n = some TashkinovExtensionKind.RE) (_ : + ett.series.data.connectingEdges n = { e }) (_ : TreeSequenceAdjoinEdge Tn e seed), + TreeSequenceInitialSegment seed T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H ell B n Tn segmentTrans commonPrefix + prefixSegment stageToT hm hBT hTnB r hr hgpos hypos hzpos ig if_ e seed hkind he ha + obtain ⟨ie, hie, hentry⟩ := HierarchyNonparallelFirstEdge H e hkind he + change ie.val = Tn.length at hie + have ht := stageToT (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) + have hentryT : T.edge (Fin.castLE ht.1 ie) = e := + (ht.2.2 ie).trans hentry + have hN : Tn.length < T.length := by + have hlt := ie.isLt + have hle := ht.1 + omega + let Q := TreeSequencePrefix T (Tn.length + 1) (by omega) (by omega) + have hQT : TreeSequenceInitialSegment Q T := prefixSegment _ _ _ _ + have hNQ : TreeSequenceInitialSegment Tn Q := + commonPrefix (segmentTrans hTnB hBT) hQT (by change Tn.length ≤ Tn.length + 1; omega) + have hQ : TreeSequenceAdjoinEdge Tn e Q := by + refine ⟨rfl, hNQ, ?_⟩ + change T.edge _ = e + convert hentryT using 1 + congr 1 + apply Fin.ext + exact hie.symm + have hseed : seed = Q := TreeSequenceAdjoinEdgeUnique Tn e seed Q ha hQ + rw [hseed] + exact hQT + +theorem helper_equalTrees_631.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → X.length = Y.length → X = Y + := by + classical + intro V E G e0 X Y hXY hlen + cases X with + | mk lx px vx ex vix eix fx ax => + cases Y with + | mk ly py vy ey viy eiy fy ay => + simp only at hlen + subst ly + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hXY.2.1 i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hXY.2.2 i).symm + +theorem helper_hAstage_679.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (_ : (0 : ℕ) < H.dividerCount), A = H.stage (⟨H.dividerCount, Decidable.byContradiction fun + (a : ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H A hq + have hi : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp + omega + dsimp [A, HierarchyStarredStage] + rw [hi] + simp only [Fin.cases] + apply congrArg H.stage + apply Fin.ext + simp + omega + +theorem helper_stableClosed_938.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (X : TreeSequence G e0) (colors : Finset (Fin k)) (old new : PartialEdgeColoring + E k), IsProperEdgeColoring G old → IsOneEdgeUncolored old e0 → IsProperEdgeColoring G new + → IsOneEdgeUncolored new e0 → StableColoring X colors old new → ColoredVertexSetClosed G + old (TreeSequenceVertexSet X) → ColoredVertexSetClosed G new (TreeSequenceVertexSet X) := by + classical + intro V E _ _ G k e0 X colors old new ho huo hn hun hstable hclosed e c v he hv hc hmissing + have hmold : c ∈ MissingColors G old v := by + rw [← hstable.2 v hv] + exact hmissing + have hmTree : c ∈ TreeMissingColors old X := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, hmold⟩ + obtain ⟨u, hu, w, hw, hends⟩ := by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] using he + have hinc : TreeIncidentEdge X e := by + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends e + rw [hends] + exact Sym2.mem_iff.mpr (Or.inl rfl) + have heq := (sc1 G e0 X colors old new ho huo hn hun).mp hstable e hinc + (Or.inr ⟨c, Finset.mem_union_left _ hmTree, hc⟩) + exact hclosed he hv (heq.symm.trans hc) hmold + +theorem helper_hfinalAug_1019.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : + TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X + Y)) (_ : B.length = T.length - (2 : ℕ)) (_ : P.length = T.length - (1 : ℕ)) (hm : (3 : ℕ) + ≤ T.length) (_ : TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment P T) (_ : + TreeSequenceInitialSegment B P) (_ : TreeSequenceInitialSegment Tn B), + let r : Fin T.length := (⟨T.length - (2 : ℕ), Decidable.byContradiction fun (a : ¬T.length - + (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + ∀ (_ : (↑r : ℕ) + (2 : ℕ) = T.length) (_ : (↑D.lastEdgeIndex : ℕ) + (1 : ℕ) = T.length) (_ : + (↑D.penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length) (_ : (↑D.terminalVertexIndex : ℕ) = + T.length) (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (_ : Fin ((↑r : ℕ) + (1 : ℕ))), + let Z : TreeSequence G e0 := ett.series.data.tree n.succ; + ∀ (_ : TreeSequenceInitialSegment T Z) (_ : n ≠ (0 : Fin (ett.rounds + (1 : ℕ)))) (_ : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn Z ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + n = some TashkinovExtensionKind.RE) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet + Tn) ∧ + ∃ (e : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = { e } ∧ + TreeSequenceAdjoinEdge Tn e seed ∧ TashkinovAugmentationSequence phi seed Z)) (_ : ( + ∀ (e : E) (seed : TreeSequence G e0) (_ : ett.series.data.kind n = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind n = some TashkinovExtensionKind.RE) (_ : + ett.series.data.connectingEdges n = { e }) (_ : TreeSequenceAdjoinEdge Tn e seed), + TreeSequenceInitialSegment seed T)) (_ : ( + ∀ {X Y : TreeSequence G e0} (_ : TashkinovAugmentationSequence phi X Y) (_ : Y.length = + X.length + (1 : ℕ)), TashkinovAugmentation phi X Y)), TashkinovAugmentation phi P T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B P n Tn segmentTrans commonPrefix + hBlen hPlen hm hBT hPT hBP hTnB r hr hgpos hypos hzpos ig if_ Z hTZ hnzero terminalRoute + seedToT oneStep + rcases terminalRoute with ⟨hp, hseq⟩ | ⟨hk, hc, e, seed, he, ha, hseq⟩ + · have hNT := segmentTrans hTnB hBT + have hseqT := TashkinovAugmentationSequenceRestrict phi Tn T Z hseq hNT hTZ + have hseqP := TashkinovAugmentationSequenceSuffix phi Tn P T hseqT + (segmentTrans hTnB hBP) hPT + exact oneStep hseqP (by omega) + · have hseedT := seedToT e seed hk he ha + have hseqT := TashkinovAugmentationSequenceRestrict phi seed T Z hseq hseedT hTZ + have hseedP : TreeSequenceInitialSegment seed P := + commonPrefix hseedT hPT (by have := ha.1; have := hTnB.1; omega) + have hseqP := TashkinovAugmentationSequenceSuffix phi seed P T hseqT hseedP hPT + exact oneStep hseqP (by omega) + +theorem helper_terminalTree_1121.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (hm : (3 : ℕ) ≤ T.length), + let r : Fin T.length := + (⟨T.length - (2 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + ∀ (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (_ : TreeSequence G e0) + (_ : Fin ((↑r : ℕ) + (1 : ℕ))) (_ X : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi X), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D n Tn hm r ig M if_ S X corr + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have hseries : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases hseries + let i : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have hi : i.succ = n := by + apply Fin.ext + dsimp [i, n] + have := ett.roundsPositive + omega + change replacementSeries.data.tree n.castSucc = ett.series.data.tree n.castSucc + rw [← hi] + exact ladderTreesAgree i + +theorem helper_hgends_1058.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (hm : (3 : ℕ) ≤ T.length), TreeSequenceInitialSegment B T → + let r : Fin T.length := (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + let g : E := T.edge D.lastEdgeIndex; + let z : V := T.vertex D.terminalVertexIndex; (↑r : ℕ) + (2 : ℕ) = T.length → (↑D.lastEdgeIndex + : ℕ) + (1 : ℕ) = T.length → (↑D.penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length → + (↑D.terminalVertexIndex : ℕ) = T.length → + ∀ (ig : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))), G.ends (T.edge D.lastEdgeIndex) = s(T.vertex + D.lastEdgeIndex.succ, T.vertex (ig.castLT ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) → + ∀ (higbound : (↑ig : ℕ) < B.length + (1 : ℕ)), + let igB : Fin (B.length + (1 : ℕ)) := (⟨(↑ig : ℕ), higbound⟩ : Fin (B.length + (1 : ℕ))); + G.ends g = s(z, B.vertex igB) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hm hBT r g z hr hgpos hypos hzpos + ig hig higbound igB + have hnew : D.lastEdgeIndex.succ = D.terminalVertexIndex := by + apply Fin.ext + simp + omega + rw [← hBT.2.1 igB] + convert hig using 1 + · exact congrArg (fun i => + s(T.vertex i, T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) igB))) hnew.symm + +theorem helper_hfends_1083.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (hm : (3 : ℕ) ≤ T.length), TreeSequenceInitialSegment B T → + let r : Fin T.length := (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := T.vertex D.penultimateVertexIndex; (↑r : ℕ) + (2 : ℕ) = T.length → + (↑D.lastEdgeIndex : ℕ) + (1 : ℕ) = T.length → (↑D.penultimateVertexIndex : ℕ) + (1 : ℕ) = + T.length → + ∀ (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (if_ : Fin ((↑r : ℕ) + (1 : ℕ))), G.ends + (T.edge r) = s(T.vertex r.succ, T.vertex (if_.castLT ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) → + ∀ (hifbound : (↑if_ : ℕ) < B.length + (1 : ℕ)), + let ifB : Fin (B.length + (1 : ℕ)) := (⟨(↑if_ : ℕ), hifbound⟩ : Fin (B.length + (1 : ℕ))); + G.ends f = s(y, B.vertex ifB) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hm hBT r f y hr hgpos hypos ig if_ + hif hifbound ifB + have hnew : r.succ = D.penultimateVertexIndex := by + apply Fin.ext + simp + omega + rw [← hBT.2.1 ifB] + convert hif using 1 + · exact congrArg (fun i => + s(T.vertex i, T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) ifB))) hnew.symm + +theorem helper_hfB_1110.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); B.length = T.length - + (2 : ℕ) → + ∀ (hm : (3 : ℕ) ≤ T.length), TreeSequenceInitialSegment B T → + let r : Fin T.length := (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + let f : E := T.edge r; (↑r : ℕ) + (2 : ℕ) = T.length → (↑D.lastEdgeIndex : ℕ) + (1 : ℕ) = + T.length → (↑D.penultimateVertexIndex : ℕ) + (1 : ℕ) = T.length → (↑D.terminalVertexIndex + : ℕ) = T.length → + ∀ (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (_ : Fin ((↑r : ℕ) + (1 : ℕ))), f ∉ + TreeSequenceEdgeSet B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen hm hBT r f hr hgpos hypos + hzpos ig if_ hf + obtain ⟨i, hi⟩ := by simpa [TreeSequenceEdgeSet] using hf + have hidx := congrArg Fin.val (T.edge_injective ((hBT.2.2 i).trans hi)) + simp only [Fin.val_castLE] at hidx + omega + +theorem helper_branch_1137.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let y : V := T.vertex D.penultimateVertexIndex; + let z : V := T.vertex D.terminalVertexIndex; y ∉ TreeSequenceVertexSet B → y ≠ z → + ∀ (v : V), v = z ∨ v ∈ TreeSequenceVertexSet B → (v = z ∨ v = y ∨ v ∈ TreeSequenceVertexSet B) + ∧ ¬v = T.vertex D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B y z hyB hyz v hv + refine ⟨hv.elim Or.inl (fun h => Or.inr (Or.inr h)), ?_⟩ + intro hh + change v = y at hh + rcases hv with hv | hv + · exact hyz (hh.symm.trans hv) + · exact hyB (hh ▸ hv) + +theorem helper_branch_1144.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let y : V := T.vertex D.penultimateVertexIndex; + let z : V := T.vertex D.terminalVertexIndex; + ∀ (v : V), (v = z ∨ v = y ∨ v ∈ TreeSequenceVertexSet B) ∧ ¬v = T.vertex + D.penultimateVertexIndex → v = z ∨ v ∈ TreeSequenceVertexSet B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B y z v + rintro ⟨hv, hn⟩ + rcases hv with hv | hv | hv + · exact Or.inl hv + · exact False.elim (hn hv) + · exact Or.inr hv + +theorem helper_branch_1154.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (hm : (3 : ℕ) ≤ T.length), + let r : Fin T.length := (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + let f : E := T.edge r; + let g : E := T.edge D.lastEdgeIndex; f ∉ TreeSequenceEdgeSet B → f ≠ g → + ∀ (e : E), e = g ∨ e ∈ TreeSequenceEdgeSet B → (e = g ∨ e = f ∨ e ∈ TreeSequenceEdgeSet B) ∧ + ¬e = T.edge r := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hm r f g hfB hfg e he + refine ⟨he.elim Or.inl (fun h => Or.inr (Or.inr h)), ?_⟩ + intro hh + change e = f at hh + rcases he with he | he + · exact hfg (hh.symm.trans he) + · exact hfB (hh ▸ he) + +theorem helper_branch_1161.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (hm : (3 : ℕ) ≤ T.length), + let r : Fin T.length := (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + let f : E := T.edge r; + let g : E := T.edge D.lastEdgeIndex; + ∀ (e : E), (e = g ∨ e = f ∨ e ∈ TreeSequenceEdgeSet B) ∧ ¬e = T.edge r → e = g ∨ e ∈ + TreeSequenceEdgeSet B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hm r f g e + rintro ⟨he, hn⟩ + rcases he with he | he | he + · exact Or.inl he + · exact False.elim (hn he) + · exact Or.inr he + +theorem helper_hnzero_1202.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ (hm : (3 : ℕ) ≤ T.length), + let r : Fin T.length := (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + ∀ (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (_ : Fin ((↑r : ℕ) + (1 : ℕ))), n ≠ (0 : Fin + (ett.rounds + (1 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D n hm r ig if_ hn + have hv := congrArg Fin.val hn + have hp := C.positive + simp [n] at hv + omega + +theorem helper_oneStep_1228.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → X.length = Y.length → X = Y) → + ∀ (hm : (3 : ℕ) ≤ T.length), + let r : Fin T.length := (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + ∀ (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (_ : Fin ((↑r : ℕ) + (1 : ℕ))) + {X Y : TreeSequence G e0}, TashkinovAugmentationSequence phi X Y → Y.length = X.length + + (1 : ℕ) → TashkinovAugmentation phi X Y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D equalTrees hm r ig if_ X Y hseq hlen + unfold TashkinovAugmentationSequence at hseq + induction hseq with + | refl => omega + | @tail W Y hXW hWY ih => + have hp := TashkinovAugmentationSequenceInitialSegment phi X W hXW + have hwlen : X.length = W.length := by have := hWY.1; have := hp.1; omega + have heq := equalTrees hp hwlen + subst W + exact hWY + +theorem helper_hthetaP_1244.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let g : E := T.edge D.lastEdgeIndex; TreeSequenceAdjoinEdge P g T → TashkinovAugmentation phi + P T → D.theta ∈ TreeMissingColors phi P := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell P g hOrigT hfinalAug + rcases hfinalAug with ⟨hl, hs, c, he, hc⟩ + have heg : T.edge (Fin.cast hl.symm (Fin.last P.length)) = g := hOrigT.choose_spec.2 + rw [heg, D.thetaOnLastEdge] at he + have hct : D.theta = c := Option.some.inj he + exact hct.symm ▸ hc + +theorem helper_hthetaB_1250.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let y : V := T.vertex D.penultimateVertexIndex; TreeSequenceVertexSet P = (insert y + (TreeSequenceVertexSet B) : Finset V) → D.theta ∈ TreeMissingColors phi P → D.theta ∈ + TreeMissingColors phi B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B P y hPV hthetaP + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp hthetaP + rw [hPV] at hv + rcases Finset.mem_insert.mp hv with hv | hv + · subst v + exact False.elim (D.thetaPresentPenultimate hc) + · exact Finset.mem_biUnion.mpr ⟨v, hv, hc⟩ + +theorem helper_hboundaryPE_1258.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let g : E := T.edge D.lastEdgeIndex; g ∈ BoundaryEdges G (TreeSequenceVertexSet B) → + let Z : TreeSequence G e0 := ett.series.data.tree n.succ; (ett.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence phi Tn Z ∨ (ett.series.data.kind + n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind n = some + TashkinovExtensionKind.RE) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet Tn) ∧ + ∃ (e : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = ({ e } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn e seed ∧ TashkinovAugmentationSequence phi seed Z) → D.theta ∈ + TreeMissingColors phi B → B = Tn → ett.series.data.kind n = some TashkinovExtensionKind.PE + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B n Tn g hgBoundary Z terminalRoute + hthetaB hBN + rcases terminalRoute with ⟨hp, hseq⟩ | ⟨hk, hc, e, seed, he, ha, hseq⟩ + · exact hp + · obtain ⟨v, hv, hmissing⟩ := Finset.mem_biUnion.mp hthetaB + rw [← hBN] at hc + exact False.elim (hc hgBoundary hv D.thetaOnLastEdge hmissing) + +theorem helper_hlastB_1310.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; ((0 : ℕ) < H.dividerCount → A = + H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (hm : (3 : ℕ) ≤ T.length), TreeSequenceInitialSegment A B → TreeSequenceInitialSegment Tn B + → + let r : Fin T.length := (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + ∀ (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (_ : TreeSequence G e0) (_ : Fin ((↑r : ℕ) + (1 + : ℕ))) (_ : TreeSequence G e0), TreeSequenceInitialSegment (H.stage (Fin.last + H.dividerCount).castSucc) B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H A ell B n Tn hAstage hm hAB hTnB r ig M + if_ S + by_cases hq : H.dividerCount = 0 + · have hi : (Fin.last H.dividerCount).castSucc = + (0 : Fin (H.dividerCount + 2)) := by + apply Fin.ext + simp [hq] + rw [hi, H.baseStage] + exact hTnB + · have hi : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + (Fin.last H.dividerCount).castSucc := by apply Fin.ext; rfl + rw [← hi, ← hAstage (by omega)] + exact hAB + +theorem helper_hstageB_1323.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (hm : (3 : ℕ) ≤ T.length), + let r : Fin T.length := (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + ∀ (_ : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (_ : TreeSequence G e0) (_ : Fin ((↑r : ℕ) + (1 + : ℕ))) (_ : TreeSequence G e0), TreeSequenceInitialSegment (H.stage (Fin.last + H.dividerCount).castSucc) B → + ∀ (i : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage i.castSucc) B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H ell B segmentTrans stageSegment hm r ig + M if_ S hlastB i + have hs := stageSegment i.val (H.dividerCount - i.val) (by omega) + have hfirst : (⟨i.val, by omega⟩ : Fin (H.dividerCount + 2)) = i.castSucc := by + apply Fin.ext + rfl + have hlast : (⟨i.val + (H.dividerCount - i.val), by omega⟩ : + Fin (H.dividerCount + 2)) = (Fin.last H.dividerCount).castSucc := by + apply Fin.ext + simp + omega + rw [hfirst, hlast] at hs + exact segmentTrans hs hlastB + +/-- Typed data construction shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperR1556.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoTailData G k e0 input T phi ett base + C ctx) → + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (hm : (3 : ℕ) ≤ T.length) → + let r : Fin T.length := + (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let f : E := T.edge r; + let g : E := T.edge D.lastEdgeIndex; + let y : V := T.vertex D.penultimateVertexIndex; + let z : V := T.vertex D.terminalVertexIndex; + (↑r : ℕ) + (2 : ℕ) = T.length → + TreeSequenceAdjoinEdge B f P → + TreeSequenceAdjoinEdge P g T → + (∀ {X U : TreeSequence G e0} {e : E}, + TreeSequenceAdjoinEdge X e U → + TreeSequenceVertexSet U = + (insert (U.vertex (Fin.last U.length)) + (TreeSequenceVertexSet X) : + Finset V) ∧ + TreeSequenceEdgeSet U = + (insert e (TreeSequenceEdgeSet X) : + Finset E)) → + y ∉ TreeSequenceVertexSet B → + y ≠ z → + (M : TreeSequence G e0) → + TreeSequenceAdjoinEdge B g M → + M.vertex (Fin.last M.length) = z → + TreeSequenceVertexSet M = + (insert z + (TreeSequenceVertexSet B) : + Finset V) → + TreeSequenceEdgeSet M = + (insert g + (TreeSequenceEdgeSet B) : + Finset E) → + (S : TreeSequence G e0) → + TreeSequenceAdjoinEdge M f S → + S.vertex (Fin.last S.length) = + y → + TreeSequenceVertexSet T = + (insert z + (insert y + (TreeSequenceVertexSet + B) : + Finset V) : + Finset V) → + TreeSequenceEdgeSet T = + (insert g + (insert f + (TreeSequenceEdgeSet + B) : + Finset E) : + Finset E) → + f ∉ + TreeSequenceEdgeSet + B → + f ≠ g → + HierarchySituationTwoReorderedTrees + G k e0 input T phi + ett base C ctx D := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B P hm r f g y z hr hOrigP hOrigT + adjoinSets hyB hyz M hBM hMz hMV hME S hMS hSy hTV hTE hfB hfg + exact { + penultimateEdgeIndex := r + penultimateEdgePosition := hr + minus := M + star := S + originalPenultimate := hOrigP + originalFinal := hOrigT + minusFinal := hBM + minusTerminalVertex := hMz + starFinal := hMS + starPenultimateVertex := hSy + minusVertexSet := by + rw [hMV, hTV] + ext v + simp only [Finset.mem_sdiff, Finset.mem_singleton, Finset.mem_insert] + constructor + · exact helper_branch_1137 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@hyB) (@hyz) (@v) + · exact helper_branch_1144 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@v) + minusEdgeSet := by + rw [hME, hTE] + ext e + simp only [Finset.mem_sdiff, Finset.mem_singleton, Finset.mem_insert] + constructor + · exact helper_branch_1154 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@hm) (@hfB) (@hfg) (@e) + · exact helper_branch_1161 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@hm) (@e) + starVertexSet := by + rw [(adjoinSets hMS).1, hSy, hMV, hTV] + exact Finset.insert_comm _ _ _ + starEdgeSet := by + rw [(adjoinSets hMS).2, hME, hTE] + exact Finset.insert_comm _ _ _ } + +end GoldbergSeymour.HierarchySituationTwoReorderedTreesCertifiedPreparation + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation2.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation2.lean new file mode 100644 index 0000000000..fd1f8345c2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation2.lean @@ -0,0 +1,494 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified.Preparation1 + +/-! +# HierarchySituationTwoReorderedTreesCertified: supporting constructions, part 2 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.HierarchySituationTwoReorderedTreesCertifiedPreparation + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation1782Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (segmentTrans : + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) (prefixEq : + ∀ {X Y : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y), X = TreeSequencePrefix Y + X.length X.positive ( + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive X + have := GoldbergSeymour.TreeSequence.positive Y + have := hXY.1 + have := GoldbergSeymour.TreeSequence.positive X + have := GoldbergSeymour.TreeSequence.positive Y + all_goals omega) + )) (stageSegment : + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))) (hAstage : (0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (hcoreA : TreeSequenceInitialSegment base.core A) (hBlen + : B.length = T.length - (2 : ℕ)) (hm : (3 : ℕ) ≤ T.length) (hAB : + TreeSequenceInitialSegment A B) (hTnB : TreeSequenceInitialSegment Tn B), + let r : Fin T.length := (⟨T.length - (2 : ℕ), + by omega + ⟩ : Fin T.length); + let f : E := T.edge r; + let g : E := T.edge D.lastEdgeIndex; + let y : V := T.vertex D.penultimateVertexIndex; + let z : V := T.vertex D.terminalVertexIndex; + ∀ (hr : (↑r : ℕ) + (2 : ℕ) = T.length) (hOrigP : TreeSequenceAdjoinEdge B f P) (hOrigT : + TreeSequenceAdjoinEdge P g T) (adjoinSets : + ∀ {X U : TreeSequence G e0} {e : E}, TreeSequenceAdjoinEdge X e U → TreeSequenceVertexSet U = + (insert (U.vertex (Fin.last U.length)) (TreeSequenceVertexSet X) : Finset V) ∧ + TreeSequenceEdgeSet U = (insert e (TreeSequenceEdgeSet X) : Finset E)) (hyB : y ∉ + TreeSequenceVertexSet B) (hyz : y ≠ z) (ig : Fin ((↑D.lastEdgeIndex : ℕ) + (1 : ℕ))) (M : + TreeSequence G e0) (hBM : TreeSequenceAdjoinEdge B g M) (hMz : M.vertex (Fin.last + M.length) = z) (hMV : TreeSequenceVertexSet M = (insert z (TreeSequenceVertexSet B) : + Finset V)) (hME : TreeSequenceEdgeSet M = (insert g (TreeSequenceEdgeSet B) : Finset E)) + (if_ : Fin ((↑r : ℕ) + (1 : ℕ))) (S : TreeSequence G e0) (hMS : TreeSequenceAdjoinEdge M f + S) (hSy : S.vertex (Fin.last S.length) = y) (hTV : TreeSequenceVertexSet T = (insert z + (insert y (TreeSequenceVertexSet B) : Finset V) : Finset V)) (hTE : TreeSequenceEdgeSet T + = (insert g (insert f (TreeSequenceEdgeSet B) : Finset E) : Finset E)) (hfB : f ∉ + TreeSequenceEdgeSet B) (hfg : f ≠ g), + let R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx D := helperR1556 + G k e0 input T phi ett base C ctx D hm hr hOrigP hOrigT adjoinSets hyB hyz M hBM hMz hMV + hME S hMS hSy hTV hTE hfB hfg; + ∀ (hboundaryPE : B = Tn → ett.series.data.kind n = some TashkinovExtensionKind.PE) (routes : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn M ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + n = some TashkinovExtensionKind.RE) ∧ + ∃ (e : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = ({ e } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn e seed ∧ TashkinovAugmentationSequence phi seed M) ∧ + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn S ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + n = some TashkinovExtensionKind.RE) ∧ + ∃ (e : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = ({ e } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn e seed ∧ TashkinovAugmentationSequence phi seed S)), + ∃ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx D), + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + (B = Tn → ett.series.data.kind n = some TashkinovExtensionKind.PE) ∧ (ett.series.data.kind + n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence phi Tn R.minus ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind n = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed R.minus) ∧ + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn R.star ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed R.star) ∧ + ∃ (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus), MaximumProperty + corrMinus.replacementETT ∧ + ∃ (baseMinus : HierarchyBase corrMinus.replacementETT phi), baseMinus.core = base.core ∧ + baseMinus.closure = base.closure ∧ (↑baseMinus.supportPosition : ℕ) = + (↑base.supportPosition : ℕ) ∧ + ∃ (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) (hMinusCount : + HMinus.dividerCount = C.hierarchy.dividerCount), ( + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), HMinus.stage j.castSucc = C.hierarchy.stage + (Fin.cast ( + by omega + ) j).castSucc) ∧ ( + ∀ (j : Fin HMinus.dividerCount), (↑(HMinus.dividerPosition j) : ℕ) = + (↑(C.hierarchy.dividerPosition (Fin.cast hMinusCount j)) : ℕ)) ∧ + ∃ (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star), MaximumProperty + corrStar.replacementETT ∧ + ∃ (baseStar : HierarchyBase corrStar.replacementETT phi), baseStar.core = base.core ∧ + baseStar.closure = base.closure ∧ (↑baseStar.supportPosition : ℕ) = (↑base.supportPosition + : ℕ) ∧ + ∃ (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) (hStarCount : + HStar.dividerCount = C.hierarchy.dividerCount), ( + ∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), HStar.stage j.castSucc = C.hierarchy.stage + (Fin.cast ( + by omega + ) j).castSucc) ∧ + ∀ (j : Fin HStar.dividerCount), (↑(HStar.dividerPosition j) : ℕ) = + (↑(C.hierarchy.dividerPosition (Fin.cast hStarCount j)) : ℕ) + +theorem helper_continuation_1782.{u_1, u_2} : + helperContinuation1782Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H A ell B P n Tn segmentTrans prefixEq + stageSegment hAstage hcoreA hBlen hm hAB hTnB r f g y z hr hOrigP hOrigT adjoinSets hyB hyz + ig M hBM hMz hMV hME if_ S hMS hSy hTV hTE hfB hfg R hboundaryPE routes + have hmod : ModColoring ett phi := by + apply Td G k e0 input T phi ett C.maximum C.positive ctx.lowerRung phi + ctx.proper ctx.oneEdgeUncolored + rw [← ett.generatingColoring] + exact ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ + have hNM : TreeSequenceInitialSegment Tn M := + segmentTrans hTnB hBM.choose_spec.1 + have hNS : TreeSequenceInitialSegment Tn S := + segmentTrans hNM hMS.choose_spec.1 + have hMlen : M.length = B.length + 1 := hBM.choose + have hSlen : S.length = M.length + 1 := hMS.choose + obtain ⟨corrM⟩ := hmod.2.2 M hNM + (by change Tn.length < M.length; have := hTnB.1; omega) routes.1 + obtain ⟨corrS⟩ := hmod.2.2 S hNS + (by change Tn.length < S.length; have := hTnB.1; omega) routes.2 + have hMPM := MaximumPropertyTransport G k e0 ett phi hmod M corrM C.maximum + have hMPS := MaximumPropertyTransport G k e0 ett phi hmod S corrS C.maximum + have hlastB : TreeSequenceInitialSegment + (H.stage (Fin.last H.dividerCount).castSucc) B := by + exact helper_hlastB_1310 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hAstage) (@hm) + (@hAB) (@hTnB) (@ig) (@M) (@if_) (@S) + have hstageB (i : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage i.castSucc) B := by + exact @helper_hstageB_1323 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@segmentTrans) + (@stageSegment) (@hm) (@ig) (@M) (@if_) (@S) (@hlastB) (@i) + have terminalTree (X : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi X) : + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + exact helper_terminalTree_1121 G k e0 input T phi ett base C ctx D hm ig M if_ S X corr + have copyHierarchy (X : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi X) + (hBX : TreeSequenceInitialSegment B X) (hstrictBX : B.length < X.length) : + ∃ bx : HierarchyBase corr.replacementETT phi, + bx.core = base.core ∧ bx.closure = base.closure ∧ + bx.supportPosition.val = base.supportPosition.val ∧ + ∃ K : TashkinovHierarchy corr.replacementETT bx, + ∃ hcount : K.dividerCount = H.dividerCount, + (∀ j : Fin (K.dividerCount + 1), + K.stage j.castSucc = H.stage + (Fin.cast (congrArg (fun d => d + 1) hcount) j).castSucc) ∧ + ∀ j : Fin K.dividerCount, + (K.dividerPosition j).val = + (H.dividerPosition (Fin.cast hcount j)).val := by + exact @helper_copyHierarchy_812 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C ctx D segmentTrans prefixEq hcoreA hBlen hm hAB ig M if_ S + hMlen hSlen hlastB hstageB terminalTree X corr hBX hstrictBX + obtain ⟨baseM, hcoreM, hclosureM, hsupportM, HM, hcountM, hstageM, hpositionM⟩ := + copyHierarchy M corrM hBM.choose_spec.1 (by omega) + obtain ⟨baseS, hcoreS, hclosureS, hsupportS, HS, hcountS, hstageS, hpositionS⟩ := + copyHierarchy S corrS (segmentTrans hBM.choose_spec.1 hMS.choose_spec.1) (by omega) + exact ⟨R, hboundaryPE, routes.1, routes.2, corrM, hMPM, + baseM, hcoreM, hclosureM, hsupportM, HM, hcountM, hstageM, hpositionM, + corrS, hMPS, baseS, hcoreS, hclosureS, hsupportS, HS, hcountS, hstageS, hpositionS⟩ + +theorem helper_continuation_941.{u_1, u_2} : + helperContinuation941Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H A ell B P n Tn segmentTrans + commonPrefix equalTrees prefixSegment prefixEq stageSegment stageToT hAstage hcoreA hBlen + hPlen hm hBT hPT hBP hAB hTnB r f g y z hr hgpos hypos hzpos hOrigP hOrigT hPy hTz + vertexMem adjoinSets adjoinVertex hzB hyB hyz ig hig higbound + let igB : Fin (B.length + 1) := ⟨ig.val, higbound⟩ + have hgends : G.ends g = s(z, B.vertex igB) := by + exact helper_hgends_1058 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hm) (@hBT) (@hr) + (@hgpos) (@hypos) (@hzpos) (@ig) (@hig) (@higbound) + have hgBoundary : g ∈ BoundaryEdges G (TreeSequenceVertexSet B) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨B.vertex igB, vertexMem _ _, z, hzB, ?_⟩ + exact hgends.trans (Sym2.eq_iff.mpr (Or.inr ⟨rfl, rfl⟩)) + obtain ⟨M, hBM⟩ := TreeSequenceBoundaryEdgeAppendExists B g hgBoundary + -- The adjoin relation fixes the edge; the endpoint argument fixes its fresh vertex. + have hMz : M.vertex (Fin.last M.length) = z := + adjoinVertex hBM hzB (vertexMem B igB) hgends + have hMV : TreeSequenceVertexSet M = insert z (TreeSequenceVertexSet B) := by + simpa [hMz] using (adjoinSets hBM).1 + have hME : TreeSequenceEdgeSet M = insert g (TreeSequenceEdgeSet B) := + (adjoinSets hBM).2 + have hyM : y ∉ TreeSequenceVertexSet M := by simpa [hMV, hyz] using hyB + obtain ⟨if_, hif⟩ := T.attaches r + have hifbound : if_.val < B.length + 1 := by have := if_.isLt; omega + let ifB : Fin (B.length + 1) := ⟨if_.val, hifbound⟩ + have hfends : G.ends f = s(y, B.vertex ifB) := by + exact helper_hfends_1083 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hm) (@hBT) (@hr) + (@hgpos) (@hypos) (@ig) (@if_) (@hif) (@hifbound) + have hfBoundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet M) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨B.vertex ifB, ?_, y, hyM, ?_⟩ + · rw [hMV]; exact Finset.mem_insert_of_mem (vertexMem _ _) + · exact hfends.trans (Sym2.eq_iff.mpr (Or.inr ⟨rfl, rfl⟩)) + obtain ⟨S, hMS⟩ := TreeSequenceBoundaryEdgeAppendExists M f hfBoundary + have hSy : S.vertex (Fin.last S.length) = y := by + apply adjoinVertex hMS hyM + · rw [hMV]; exact Finset.mem_insert_of_mem (vertexMem B ifB) + · exact hfends + have hPV : TreeSequenceVertexSet P = insert y (TreeSequenceVertexSet B) := by + simpa [hPy] using (adjoinSets hOrigP).1 + have hPE : TreeSequenceEdgeSet P = insert f (TreeSequenceEdgeSet B) := + (adjoinSets hOrigP).2 + have hTV : TreeSequenceVertexSet T = insert z (insert y (TreeSequenceVertexSet B)) := by + simpa [hTz, hPV] using (adjoinSets hOrigT).1 + have hTE : TreeSequenceEdgeSet T = insert g (insert f (TreeSequenceEdgeSet B)) := by + simpa [hPE] using (adjoinSets hOrigT).2 + have hfB : f ∉ TreeSequenceEdgeSet B := by + exact helper_hfB_1110 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hm) (@hBT) + (@hr) (@hgpos) (@hypos) (@hzpos) (@ig) (@if_) + have hfg : f ≠ g := by + intro hh + have hi := congrArg Fin.val (T.edge_injective hh) + omega + let R : HierarchySituationTwoReorderedTrees + G k e0 input T phi ett base C ctx D := by + exact @helperR1556 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hm) (@hr) (@hOrigP) + (@hOrigT) (@adjoinSets) (@hyB) (@hyz) (@M) (@hBM) (@hMz) (@hMV) (@hME) (@S) (@hMS) (@hSy) + (@hTV) (@hTE) (@hfB) (@hfg) + have stableClosed (X : TreeSequence G e0) (colors : Finset (Fin k)) + (old new : PartialEdgeColoring E k) + (ho : IsProperEdgeColoring G old) (huo : IsOneEdgeUncolored old e0) + (hn : IsProperEdgeColoring G new) (hun : IsOneEdgeUncolored new e0) + (hstable : StableColoring X colors old new) + (hclosed : ColoredVertexSetClosed G old (TreeSequenceVertexSet X)) : + ColoredVertexSetClosed G new (TreeSequenceVertexSet X) := by + exact helper_stableClosed_938 G k e0 X colors old new ho huo + hn hun hstable hclosed + have stepRoute (j : Fin (ett.rounds + 1)) (hj : j ≠ 0) : + (ett.series.data.kind j = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring j) + (ett.series.data.tree j.castSucc) (ett.series.data.tree j.succ)) ∨ + ((ett.series.data.kind j = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind j = some TashkinovExtensionKind.RE) ∧ + ColoredVertexSetClosed G (ett.series.data.coloring j) + (TreeSequenceVertexSet (ett.series.data.tree j.castSucc)) ∧ + ∃ (e : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges j = {e} ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree j.castSucc) e seed ∧ + TashkinovAugmentationSequence (ett.series.data.coloring j) + seed (ett.series.data.tree j.succ)) := by + exact helper_stepRoute_542 G k e0 input T phi ett stableClosed j hj + let Z := ett.series.data.tree n.succ + have hTZ : TreeSequenceInitialSegment T Z := by + convert ett.belowFinal using 1 + apply congrArg ett.series.data.tree + apply Fin.ext + rfl + have hnzero : n ≠ 0 := by + exact helper_hnzero_1202 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hm) (@ig) (@if_) + have terminalRoute := stepRoute n hnzero + rw [← ett.generatingColoring] at terminalRoute + change (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn Z) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ColoredVertexSetClosed G phi (TreeSequenceVertexSet Tn) ∧ + ∃ (e : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {e} ∧ + TreeSequenceAdjoinEdge Tn e seed ∧ + TashkinovAugmentationSequence phi seed Z) at terminalRoute + have seedToT (e : E) (seed : TreeSequence G e0) + (hkind : ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) + (he : ett.series.data.connectingEdges n = {e}) + (ha : TreeSequenceAdjoinEdge Tn e seed) : + TreeSequenceInitialSegment seed T := by + exact @helper_seedToT_936 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx D segmentTrans commonPrefix prefixSegment stageToT hm hBT hTnB + hr hgpos hypos hzpos ig if_ e seed hkind he ha + have oneStep {X Y : TreeSequence G e0} + (hseq : TashkinovAugmentationSequence phi X Y) + (hlen : Y.length = X.length + 1) : TashkinovAugmentation phi X Y := by + exact @helper_oneStep_1228 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@equalTrees) (@hm) + (@ig) (@if_) (@X) (@Y) (@hseq) (@hlen) + have hfinalAug : TashkinovAugmentation phi P T := by + exact @helper_hfinalAug_1019 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx D segmentTrans commonPrefix hBlen hPlen hm hBT hPT hBP hTnB + hr hgpos hypos hzpos ig if_ hTZ hnzero terminalRoute seedToT oneStep + have hthetaP : D.theta ∈ TreeMissingColors phi P := by + exact helper_hthetaP_1244 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@hOrigT) (@hfinalAug) + have hthetaB : D.theta ∈ TreeMissingColors phi B := by + exact helper_hthetaB_1250 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@hPV) (@hthetaP) + -- A nonparallel terminal seed cannot begin exactly at B: its old tree is closed. + have hboundaryPE : B = Tn → ett.series.data.kind n = some TashkinovExtensionKind.PE := by + exact helper_hboundaryPE_1258 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@hgBoundary) (@terminalRoute) (@hthetaB) + have augmentOfAdjoin {X U : TreeSequence G e0} {e : E} {c : Fin k} + (ha : TreeSequenceAdjoinEdge X e U) (he : phi e = some c) + (hc : c ∈ TreeMissingColors phi X) : TashkinovAugmentation phi X U := by + rcases ha with ⟨hl, hs, hedge⟩ + exact ⟨hl, hs, c, hedge ▸ he, hc⟩ + have hBMaug : TashkinovAugmentation phi B M := + augmentOfAdjoin hBM D.thetaOnLastEdge hthetaB + have routes : + ((ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn M) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (e : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {e} ∧ + TreeSequenceAdjoinEdge Tn e seed ∧ + TashkinovAugmentationSequence phi seed M)) ∧ + ((ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn S) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (e : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {e} ∧ + TreeSequenceAdjoinEdge Tn e seed ∧ + TashkinovAugmentationSequence phi seed S)) := by + exact @helper_routes_692 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx D segmentTrans commonPrefix equalTrees hBlen hPlen hm hBT hPT + hBP hTnB hr hgpos hypos hzpos hOrigP ig M hBM if_ S hMS hPE hTZ hnzero terminalRoute + seedToT oneStep hboundaryPE augmentOfAdjoin hBMaug + exact @helper_continuation_1782 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@segmentTrans) (@prefixEq) (@stageSegment) (@hAstage) (@hcoreA) (@hBlen) (@hm) (@hAB) + (@hTnB) (@hr) (@hOrigP) (@hOrigT) (@adjoinSets) (@hyB) (@hyz) (@ig) (@M) (@hBM) (@hMz) + (@hMV) (@hME) (@if_) (@S) (@hMS) (@hSy) (@hTV) (@hTE) (@hfB) (@hfg) (@hboundaryPE) (@routes) +theorem helper_continuation_891.{u_1, u_2} : + helperContinuation891Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H A ell B P n Tn segmentRefl segmentTrans + commonPrefix equalTrees prefixSegment prefixEq stageSegment stageToT hAstage hAT hcoreA + hell htwo hAlen hBlen hPlen hm hBT + have hPT : TreeSequenceInitialSegment P T := prefixSegment _ _ _ _ + have hBP : TreeSequenceInitialSegment B P := commonPrefix hBT hPT (by omega) + have hAB : TreeSequenceInitialSegment A B := commonPrefix hAT hBT (by omega) + have hTnB : TreeSequenceInitialSegment Tn B := by + have hncore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · obtain ⟨U⟩ := (base.parallel hp).2.2 + exact U.leftSegment + · rw [base.nonparallel hp]; exact segmentRefl _ + exact segmentTrans hncore (segmentTrans hcoreA hAB) + let r : Fin T.length := ⟨T.length - 2, by omega⟩ + let f := T.edge r + let g := T.edge D.lastEdgeIndex + let y := T.vertex D.penultimateVertexIndex + let z := T.vertex D.terminalVertexIndex + have hr : r.val + 2 = T.length := by dsimp [r]; omega + have hgpos := D.lastEdgePosition + have hypos := D.penultimateVertexPosition + have hzpos := D.terminalVertexPosition + have hOrigP : TreeSequenceAdjoinEdge B f P := by + refine ⟨by omega, hBP, ?_⟩ + change T.edge _ = T.edge r + congr 1 + apply Fin.ext + change B.length = r.val + omega + have hOrigT : TreeSequenceAdjoinEdge P g T := by + refine ⟨by omega, hPT, ?_⟩ + apply congrArg T.edge + apply Fin.ext + simp only [Fin.val_cast, Fin.val_last] + omega + have hPy : P.vertex (Fin.last P.length) = y := by + change T.vertex _ = T.vertex D.penultimateVertexIndex + congr 1 + apply Fin.ext + change P.length = D.penultimateVertexIndex.val + omega + have hTz : T.vertex (Fin.last T.length) = z := by + apply congrArg T.vertex + apply Fin.ext + exact hzpos.symm + have vertexMem (X : TreeSequence G e0) (i : Fin (X.length + 1)) : + X.vertex i ∈ TreeSequenceVertexSet X := by simp [TreeSequenceVertexSet] + have freshLast {X U : TreeSequence G e0} {e : E} + (ha : TreeSequenceAdjoinEdge X e U) : + U.vertex (Fin.last U.length) ∉ TreeSequenceVertexSet X := by + rcases ha with ⟨hl, hs, he⟩ + intro hv + obtain ⟨i, hi⟩ := by simpa [TreeSequenceVertexSet] using hv + have hh := U.vertex_injective ((hs.2.1 i).trans hi) + have hhval := congrArg Fin.val hh + simp only [Fin.val_castLE, Fin.val_last] at hhval + omega + have adjoinSets {X U : TreeSequence G e0} {e : E} + (ha : TreeSequenceAdjoinEdge X e U) : + TreeSequenceVertexSet U = insert (U.vertex (Fin.last U.length)) + (TreeSequenceVertexSet X) ∧ + TreeSequenceEdgeSet U = insert e (TreeSequenceEdgeSet X) := by + exact @helper_adjoinSets_322 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx D hm X U e ha + have adjoinVertex {X U : TreeSequence G e0} {e : E} {v w : V} + (ha : TreeSequenceAdjoinEdge X e U) + (hv : v ∉ TreeSequenceVertexSet X) (hw : w ∈ TreeSequenceVertexSet X) + (hends : G.ends e = s(v, w)) : U.vertex (Fin.last U.length) = v := by + rcases ha with ⟨hl, hs, he⟩ + obtain ⟨i, hi⟩ := U.attaches (Fin.cast hl.symm (Fin.last X.length)) + have hil : i.val < X.length + 1 := by simpa using i.isLt + let ix : Fin (X.length + 1) := ⟨i.val, hil⟩ + have hvold : U.vertex (Fin.castLT i (by omega)) = X.vertex ix := hs.2.1 ix + have hnew : (Fin.cast hl.symm (Fin.last X.length)).succ = + Fin.last U.length := by apply Fin.ext; simp; omega + rw [he, hnew, hvold] at hi + rcases Sym2.eq_iff.mp (hi.symm.trans hends) with hh | hh + · exact hh.1 + · exact False.elim (hv (hh.2 ▸ vertexMem X ix)) + have hzB : z ∉ TreeSequenceVertexSet B := by + intro hz + obtain ⟨i, hi⟩ := by simpa [TreeSequenceVertexSet] using hz + have hidx := T.vertex_injective ((hBT.2.1 i).trans hi) + have hv := congrArg Fin.val hidx + simp only [Fin.val_castLE] at hv + omega + have hyB : y ∉ TreeSequenceVertexSet B := by + rw [← hPy] + exact freshLast hOrigP + have hyz : y ≠ z := by + intro hh + have hi := congrArg Fin.val (T.vertex_injective hh) + omega + obtain ⟨ig, hig⟩ := T.attaches D.lastEdgeIndex + have higbound : ig.val < B.length + 1 := by + have hine : ig.val ≠ D.penultimateVertexIndex.val := by + intro hh + apply D.lastEdgeNotIncidentPenultimate + change T.vertex D.penultimateVertexIndex ∈ G.ends g + rw [hig] + apply Sym2.mem_iff.mpr + right + congr 1 + apply Fin.ext + exact hh.symm + omega + exact @helper_continuation_941 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx D segmentTrans commonPrefix equalTrees prefixSegment prefixEq + stageSegment stageToT hAstage hcoreA hBlen hPlen hm hBT hPT hBP hAB hTnB hr hgpos hypos + hzpos hOrigP hOrigT hPy hTz vertexMem adjoinSets adjoinVertex hzB hyB hyz ig hig higbound + +end GoldbergSeymour.HierarchySituationTwoReorderedTreesCertifiedPreparation + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOne.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOne.lean new file mode 100644 index 0000000000..dd64c0e3af --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOne.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOneStoredException + +/-! +# Hierarchy Situation Two Subcase One One + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchySituationTwoSubcaseOneOne {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData + G k e0 input T phi ett base C ctx) : + False := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let stored := HierarchyStoredColorsAt H q + by_cases htheta : + D.theta ∈ stored.biUnion (C.good.gamma q) + · rw [Finset.mem_biUnion] at htheta + rcases htheta with ⟨eta, hetaStored, hthetaPair⟩ + by_cases hetaMissing : + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) + · exact HierarchySituationTwoSubcaseOneOneStoredException + G k e0 input T phi ett base C ctx D eta + (by simpa [stored, q, H] using hetaStored) + (by simpa [q, H] using hthetaPair) hetaMissing + · exact HierarchySituationTwoSubcaseOneOneNonexceptional + G k e0 input T phi ett base C ctx D + (Or.inr ⟨eta, by simpa [stored, q, H] using hetaStored, + by simpa [q, H] using hthetaPair, hetaMissing⟩) + · exact HierarchySituationTwoSubcaseOneOneNonexceptional + G k e0 input T phi ett base C ctx D + (Or.inl (by simpa [stored, q, H] using htheta)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean new file mode 100644 index 0000000000..b692bbb69a --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean @@ -0,0 +1,4636 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint + +/-! +# Hierarchy Situation Two Subcase One One Nonexceptional + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperGammaStarFirst2196Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (htail : (2 : ℕ) ≤ T.length - A.length) (hBL : B.length + (2 : ℕ) = T.length) + (hPL : P.length + (1 : ℕ) = T.length), + TreeSequenceInitialSegment B T → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < (↑(HierarchyFirstMissingPosition phi X c) : ℕ) → + c ∉ MissingColors G phi (X.vertex i)) → + (∀ (X : TreeSequence G e0) (c : Fin k), + ∀ t ≤ X.length, + (∀ (i : Fin (X.length + (1 : ℕ))), (↑i : ℕ) < t → c ∉ MissingColors G phi (X.vertex i)) → + t ≤ (↑(HierarchyFirstMissingPosition phi X c) : ℕ)) → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (mpStar : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + ∀ (hMS : TreeSequenceInitialSegment R.minus R.star) + (minusLength : R.minus.length = B.length + (1 : ℕ)) + (hBS : TreeSequenceInitialSegment B R.star) (goodStar : GoodHierarchy HStar) + (gammaNe : D.gammaOne ≠ D.alpha), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + let vg : V := T.vertex ig; + D.gammaOne ∈ MissingColors G phi vg → + ∀ (igBound : (↑ig : ℕ) ≤ A.length) + (changeOld : + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) ∧ + (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)), + let CS : HierarchyCounterexample baseStar := by + exact + { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett) + (fun (_a : Nat) ↦ + @LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + _a) + (@CorrespondingExtendedTashkinovTree.rungAgreement V E inst inst_1 inst_3 G k e0 + input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C), + hierarchy := HStar, good := goodStar, maximum := mpStar, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 input + T phi ett base C) : + HierarchyCounterexample baseStar }; + let PS : TreeSequence G e0 := + HierarchyFullTailPrefix CS (HierarchyFullTailLength CS - (1 : ℕ)); + ∀ (hPSL : PS.length = R.minus.length) (thetaNe : D.theta ≠ D.gammaOne), + let jg : Fin (B.length + (1 : ℕ)) := + (⟨(↑ig : ℕ), by omega⟩ : Fin (B.length + (1 : ℕ))); + let isg : Fin (R.star.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hBS.1) jg; + R.star.vertex isg = vg → HierarchyFirstMissingPosition phi R.star D.gammaOne = isg + +private abbrev helperNewOrderedUnused2212Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (htail : (2 : ℕ) ≤ T.length - A.length) (hBL : B.length + (2 : ℕ) = T.length) + (hPL : P.length + (1 : ℕ) = T.length), + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (mpStar : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (hMS : TreeSequenceInitialSegment R.minus R.star) + (minusLength : R.minus.length = B.length + (1 : ℕ)) + (hBS : TreeSequenceInitialSegment B R.star), + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k))) → + (∀ (r : Fin R.star.length), + (∃ (t : Fin T.length), + (↑t : ℕ) = (↑r : ℕ) ∧ (↑r : ℕ) < B.length ∧ R.star.edge r = T.edge t) ∨ + (↑r : ℕ) = B.length ∧ R.star.edge r = T.edge D.lastEdgeIndex ∨ + (↑r : ℕ) = B.length + (1 : ℕ) ∧ R.star.edge r = T.edge R.penultimateEdgeIndex) → + ∀ (goodStar : GoodHierarchy HStar), + D.gammaOne ∈ C.good.gamma q D.alpha → + ∀ (gammaNe : D.gammaOne ≠ D.alpha), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + ∀ (igBound : (↑ig : ℕ) ≤ A.length) + (changeOld : + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)), + HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A → + let CS : HierarchyCounterexample baseStar := by + exact + { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett) + (fun (_a : Nat) ↦ + @LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + _a) + (@CorrespondingExtendedTashkinovTree.rungAgreement V E inst inst_1 inst_3 G k e0 + input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C), + hierarchy := HStar, good := goodStar, maximum := mpStar, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 input + T phi ett base C) : + HierarchyCounterexample baseStar }; + let PS : TreeSequence G e0 := + HierarchyFullTailPrefix CS (HierarchyFullTailLength CS - (1 : ℕ)); + ∀ (hPSL : PS.length = R.minus.length) (thetaNe : D.theta ≠ D.gammaOne), + let ia : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hMS.1) (Fin.last R.minus.length); + HierarchyFirstMissingPosition phi R.star D.alpha = ia → + let jg : Fin (B.length + (1 : ℕ)) := + (⟨(↑ig : ℕ), by omega⟩ : Fin (B.length + (1 : ℕ))); + let isg : Fin (R.star.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hBS.1) jg; + HierarchyFirstMissingPosition phi R.star D.gammaOne = isg → + TreeVertexOrder R.star + (R.star.vertex (HierarchyFirstMissingPosition phi R.star D.gammaOne)) + (R.star.vertex (HierarchyFirstMissingPosition phi R.star D.alpha)) ∧ + D.gammaOne ∉ + ({c : Fin k | + ∃ (r : Fin R.star.length), + (HierarchyStarredStage HStar (Fin.last HStar.dividerCount)).length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (↑(HierarchyFirstMissingPosition phi R.star D.alpha) : ℕ) ∧ + phi (R.star.edge r) = some c} : + Finset (Fin k)) + +private abbrev helperComponentStar2250Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (htail : (2 : ℕ) ≤ T.length - A.length) (hBL : B.length + (2 : ℕ) = T.length) + (hPL : P.length + (1 : ℕ) = T.length) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (mpStar : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (hMS : TreeSequenceInitialSegment R.minus R.star) + (minusLength : R.minus.length = B.length + (1 : ℕ)), + HMinus.dividerCount = H.dividerCount → + HStar.dividerCount = H.dividerCount → + ∀ (hBS : TreeSequenceInitialSegment B R.star) (goodStar : GoodHierarchy HStar) + (gammaNe : D.gammaOne ≠ D.alpha), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + let vg : V := T.vertex ig; + ∀ (igBound : (↑ig : ℕ) ≤ A.length) + (changeOld : + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)), + (∀ {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} + {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} + (K : TashkinovHierarchy et b), + (0 : ℕ) < K.dividerCount → + HierarchyStageMissingColors K (Fin.last K.dividerCount) = + TreeMissingColors phi + (K.stage (⟨K.dividerCount, by omega⟩ : Fin (K.dividerCount + (2 : ℕ))))) → + let CS : HierarchyCounterexample baseStar := by + exact + { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 + input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst inst_1 + inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst inst_1 + inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 + input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst inst_1 + inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 + input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 + input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst inst_1 + inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 + input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett) + (fun (_a : Nat) ↦ + @LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) _a) + (@CorrespondingExtendedTashkinovTree.rungAgreement V E inst inst_1 inst_3 G k e0 + input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst inst_1 + inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 input T phi + ett base C), + hierarchy := HStar, good := goodStar, maximum := mpStar, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst inst_1 + inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst inst_1 + inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst inst_1 + inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C) : + HierarchyCounterexample baseStar }; + let PS : TreeSequence G e0 := + HierarchyFullTailPrefix CS (HierarchyFullTailLength CS - (1 : ℕ)); + ∀ (hPSL : PS.length = R.minus.length) (thetaNe : D.theta ≠ D.gammaOne), + let ia : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hMS.1) (Fin.last R.minus.length); + HierarchyFirstMissingPosition phi R.star D.alpha = ia → + let jg : Fin (B.length + (1 : ℕ)) := (⟨(↑ig : ℕ), by omega⟩ : Fin (B.length + (1 : ℕ))); + let isg : Fin (R.star.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hBS.1) jg; + R.star.vertex isg = vg → + HierarchyFirstMissingPosition phi R.star D.gammaOne = isg → + (let H : TashkinovHierarchy corrStar.replacementETT baseStar := CS.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (corrStar.replacementETT.rounds + (1 : ℕ)) := + Fin.last corrStar.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := corrStar.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := + TashkinovStoredColors corrStar.replacementETT.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := R.star.vertex (HierarchyFirstMissingPosition phi R.star D.gammaOne); + have vb : V := R.star.vertex (HierarchyFirstMissingPosition phi R.star D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) ∧ + (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)) → + D.gammaOne ∈ HierarchyStageMissingColors HStar (Fin.last HStar.dividerCount) → + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg) = + TwoColorComponent G phi D.gammaOne D.alpha + (Sum.inl (T.vertex D.terminalVertexIndex)) + +private abbrev helperHPSL709Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (2 : ℕ) = T.length → + P.length + (1 : ℕ) = T.length → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (mpStar : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + ∀ (goodStar : GoodHierarchy HStar), + D.gammaOne ≠ D.alpha → + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)) → + HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A → + let CS : HierarchyCounterexample baseStar := by + exact + { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k + e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett) + (fun (_a : Nat) ↦ + @LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + _a) + (by + have := CorrespondingExtendedTashkinovTree.rungAgreement corrStar + have := TreeSequence.positive T + omega))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C), + hierarchy := HStar, good := goodStar, maximum := mpStar, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 input + T phi ett base C) : + HierarchyCounterexample baseStar }; + let PS : TreeSequence G e0 := + HierarchyFullTailPrefix CS (HierarchyFullTailLength CS - (1 : ℕ)); + PS.length = R.minus.length + +private abbrev helperEndpoint830Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + D.gammaOne ≠ D.alpha → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + let vg : V := T.vertex ig; + ∀ (u v : V ⊕ E) (path : (TwoColorIncidenceGraph G phi D.gammaOne D.alpha).Walk u v), + path.IsPath → + {x : V ⊕ E | x ∈ path.support} = TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg) → + ∀ (w : V), + Sum.inl w ∈ TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg) → + D.gammaOne ∈ MissingColors G phi w ∨ D.alpha ∈ MissingColors G phi w → + Sum.inl w = u ∨ Sum.inl w = v + +private noncomputable abbrev helperCS2799.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett + base C ctx) → + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi + ett base C ctx D.toHierarchySituationTwoTailData) → + (corrStar : + CorrespondingExtendedTashkinovTree G k e0 ett phi + R.star) → + (mpStar : MaximumProperty corrStar.replacementETT) → + (baseStar : + HierarchyBase corrStar.replacementETT phi) → + (HStar : + TashkinovHierarchy corrStar.replacementETT + baseStar) → + (goodStar : GoodHierarchy HStar) → + HierarchyCounterexample baseStar := by + classical + intro V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D R corrStar mpStar + baseStar HStar goodStar + exact { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 + G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 + G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett) + (fun (_a : Nat) ↦ + @LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) _a) + (@CorrespondingExtendedTashkinovTree.rungAgreement V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C), + hierarchy := HStar, good := goodStar, maximum := mpStar, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C) : + HierarchyCounterexample baseStar }; + +private abbrev helperContinuation3550Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) + (hnonexceptional : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + D.theta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∨ + ∃ eta ∈ HierarchyStoredColorsAt H q, + D.theta ∈ C.good.gamma q eta ∧ eta ∉ MissingColors G phi (T.vertex D.penultimateVertexIndex)), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (htail : (2 : ℕ) ≤ T.length - A.length) (hBL : B.length + (2 : ℕ) = T.length) + (hPL : P.length + (1 : ℕ) = T.length) (hBT : TreeSequenceInitialSegment B T) + (restrictSegment : + ∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Z → + TreeSequenceInitialSegment Y Z → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) + (vertexMem : + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), X.vertex i ∈ TreeSequenceVertexSet X) + (firstLe : + ∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) + (firstBefore : + ∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < (↑(HierarchyFirstMissingPosition phi X c) : ℕ) → + c ∉ MissingColors G phi (X.vertex i)) + (firstLower : + ∀ (X : TreeSequence G e0) (c : Fin k), + ∀ t ≤ X.length, + (∀ (i : Fin (X.length + (1 : ℕ))), (↑i : ℕ) < t → c ∉ MissingColors G phi (X.vertex i)) → + t ≤ (↑(HierarchyFirstMissingPosition phi X c) : ℕ)) + (alphaNotB : D.alpha ∉ TreeMissingColors phi B) + (alphaFirst : HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (mpStar : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (starLength : R.star.length = R.minus.length + (1 : ℕ)) + (hMS : TreeSequenceInitialSegment R.minus R.star) + (minusLength : R.minus.length = B.length + (1 : ℕ)) + (countMinus : HMinus.dividerCount = H.dividerCount) + (countStar : HStar.dividerCount = H.dividerCount) (hBS : TreeSequenceInitialSegment B R.star) + (infoStar : + ∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), + let jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + HierarchyStarredStage HStar j = HierarchyStarredStage H jo ∧ + HierarchyStoredColorsAt HStar j = HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HStar j = HierarchyStageMissingColors H jo) + (oldAvoid : + ∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k))) + (edgesStar : + ∀ (r : Fin R.star.length), + (∃ (t : Fin T.length), (↑t : ℕ) = (↑r : ℕ) ∧ (↑r : ℕ) < B.length ∧ R.star.edge r = T.edge t) ∨ + (↑r : ℕ) = B.length ∧ R.star.edge r = T.edge D.lastEdgeIndex ∨ + (↑r : ℕ) = B.length + (1 : ℕ) ∧ R.star.edge r = T.edge R.penultimateEdgeIndex) + (goodStar : GoodHierarchy HStar) (gammaMem : D.gammaOne ∈ C.good.gamma q D.alpha) + (gammaStage : D.gammaOne ∈ HierarchyStageMissingColors H q) (gammaNe : D.gammaOne ≠ D.alpha), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + let vg : V := T.vertex ig; + ∀ (gammaAt : D.gammaOne ∈ MissingColors G phi vg) (igBound : (↑ig : ℕ) ≤ A.length) + (vgPen : vg ≠ T.vertex D.penultimateVertexIndex) + (vgTerminal : vg ≠ T.vertex D.terminalVertexIndex) + (penTerminal : T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex) + (changeOld : + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)) + (lastMissingPositive : + ∀ {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} + {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} + (K : TashkinovHierarchy et b) (hp : (0 : ℕ) < K.dividerCount), + HierarchyStageMissingColors K (Fin.last K.dividerCount) = + TreeMissingColors phi + (K.stage (⟨K.dividerCount, by omega⟩ : Fin (K.dividerCount + (2 : ℕ))))) + (componentOld : + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex))) + (lastStar : HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A) + (vgMinus : vg ∈ TreeSequenceVertexSet R.minus) + (terminalMinus : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet R.minus), + let CS : HierarchyCounterexample baseStar := + { + positive := by rw [corrStar.rungAgreement]; exact C.positive, hierarchy := HStar, + good := goodStar, maximum := mpStar, + notElementary := + ((Eq.symm + (id + (congrArg (fun (_a : Finset V) ↦ ¬ColoredVertexSetElementary G phi _a) + R.starVertexSet))) ▸ + C.notElementary) : + HierarchyCounterexample baseStar }; + ∀ + (ctxStar : + HierarchyMinimumCounterexampleContext G k e0 corrStar.replacementInput R.star phi + corrStar.replacementETT baseStar CS), + let PS : TreeSequence G e0 := + HierarchyFullTailPrefix CS (HierarchyFullTailLength CS - (1 : ℕ)); + False + +private abbrev helperContinuation3038Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + D.theta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∨ + ∃ eta ∈ HierarchyStoredColorsAt H q, + D.theta ∈ C.good.gamma q eta ∧ + eta ∉ MissingColors G phi (T.vertex D.penultimateVertexIndex)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + TreeSequenceInitialSegment A T → + (2 : ℕ) ≤ T.length - A.length → + B.length + (2 : ℕ) = T.length → + P.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment P T → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Z → + TreeSequenceInitialSegment Y Z → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B P → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) → + (∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) → + (∀ (X : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi X, + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c))) → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < (↑(HierarchyFirstMissingPosition phi X c) : ℕ) → + c ∉ MissingColors G phi (X.vertex i)) → + (∀ (X : TreeSequence G e0) (c : Fin k), + ∀ t ≤ X.length, + (∀ (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < t → c ∉ MissingColors G phi (X.vertex i)) → + t ≤ (↑(HierarchyFirstMissingPosition phi X c) : ℕ)) → + D.alpha ∉ TreeMissingColors phi B → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus), + MaximumProperty corrMinus.replacementETT → + ∀ (baseMinus : HierarchyBase corrMinus.replacementETT phi), + baseMinus.core = base.core → + baseMinus.closure = base.closure → + ∀ (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star), + MaximumProperty corrStar.replacementETT → + ∀ (baseStar : HierarchyBase corrStar.replacementETT phi), + baseStar.core = base.core → + baseStar.closure = base.closure → + ∀ (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + TreeSequenceInitialSegment R.minus R.star → + R.minus.length = B.length + (1 : ℕ) → + TreeSequenceInitialSegment B R.minus → + ∀ (countMinus : HMinus.dividerCount = H.dividerCount) + (countStar : HStar.dividerCount = H.dividerCount), + (∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HMinus.stage j.castSucc = + H.stage + (Fin.cast + (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) countMinus) + j).castSucc) → + (∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), + HStar.stage j.castSucc = + H.stage + (Fin.cast + (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) countStar) + j).castSucc) → + TreeSequenceInitialSegment B R.star → + R.star.length = T.length → + corrStar.replacementETT.series.data.tree + (Fin.last corrStar.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corrStar.replacementETT.series.data.kind + (Fin.last corrStar.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors + corrStar.replacementETT.series.data + (Fin.last corrStar.replacementETT.rounds) = + TashkinovStoredColors ett.series.data + (Fin.last ett.rounds) → + (∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + let jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) countMinus) j; + HierarchyStarredStage HMinus j = + HierarchyStarredStage H jo ∧ + HierarchyStoredColorsAt HMinus j = + HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HMinus j = + HierarchyStageMissingColors H jo) → + (∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), + let jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast + (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) countStar) j; + HierarchyStarredStage HStar j = + HierarchyStarredStage H jo ∧ + HierarchyStoredColorsAt HStar j = + HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HStar j = + HierarchyStageMissingColors H jo) → + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min + (↑(HierarchyFirstMissingPosition phi T + eta) : + ℕ) + T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k))) → + (∀ (r : Fin R.star.length), + (∃ (t : Fin T.length), + (↑t : ℕ) = (↑r : ℕ) ∧ + (↑r : ℕ) < B.length ∧ R.star.edge r = T.edge t) ∨ + (↑r : ℕ) = B.length ∧ + R.star.edge r = T.edge D.lastEdgeIndex ∨ + (↑r : ℕ) = B.length + (1 : ℕ) ∧ + R.star.edge r = T.edge R.penultimateEdgeIndex) → + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin R.minus.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min + (↑(HierarchyFirstMissingPosition phi + R.minus eta) : + ℕ) + R.minus.length ∧ + phi (R.minus.edge r) = some c} : + Finset (Fin k))) → + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin R.star.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min + (↑(HierarchyFirstMissingPosition phi + R.star eta) : + ℕ) + R.star.length ∧ + phi (R.star.edge r) = some c} : + Finset (Fin k))) → + (∀ (U : TreeSequence G e0) + (corr : + CorrespondingExtendedTashkinovTree G k e0 ett + phi U) + (b : HierarchyBase corr.replacementETT phi), + b.core = base.core → + b.closure = base.closure → + ∀ + (K : TashkinovHierarchy corr.replacementETT b) + (hn : K.dividerCount = H.dividerCount), + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = + H.stage + (Fin.cast + (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) + hn) + j).castSucc) → + TreeSequenceInitialSegment B U → + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min + (↑(HierarchyFirstMissingPosition + phi U eta) : + ℕ) + U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k))) → + ∃ (good : GoodHierarchy K), + ∀ (j : Fin (K.dividerCount + (1 : ℕ))) + (eta : Fin k), + good.gamma j eta = + C.good.gamma + (Fin.cast + (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) + hn) + j) + eta) → + False + +private abbrev helperContinuation227Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + D.theta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∨ + ∃ eta ∈ HierarchyStoredColorsAt H q, + D.theta ∈ C.good.gamma q eta ∧ + eta ∉ MissingColors G phi (T.vertex D.penultimateVertexIndex)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + (∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + TreeSequenceInitialSegment A T → + (2 : ℕ) ≤ T.length - A.length → + B.length + (2 : ℕ) = T.length → + P.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment P T → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Z → + TreeSequenceInitialSegment Y Z → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B P → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) → + (∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) → + (∀ (X : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi X, + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c))) → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < (↑(HierarchyFirstMissingPosition phi X c) : ℕ) → + c ∉ MissingColors G phi (X.vertex i)) → + (∀ (X : TreeSequence G e0) (c : Fin k), + ∀ t ≤ X.length, + (∀ (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < t → c ∉ MissingColors G phi (X.vertex i)) → + t ≤ (↑(HierarchyFirstMissingPosition phi X c) : ℕ)) → + D.alpha ∉ TreeMissingColors phi B → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + False + +private theorem helper_terminalData_137.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D R corrMinus baseMinus HMinus corrStar + baseStar HStar U corr + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hf, + ht, hd, he, hk, hp, ho, hstable⟩ + cases newETT with + | mk rounds positive data above strict below generating => + cases hr + have hseries : data = newSeries := eq_of_heq hs + cases hseries + let i : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have hi : i.succ = Fin.last ett.rounds := Fin.ext (by + simp [i]; have := ett.roundsPositive; omega) + have htree : newSeries.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rw [← hi] + exact ht i + refine ⟨htree, hk _, ?_⟩ + unfold TashkinovStoredColors + have hn : (Fin.last ett.rounds).val ≠ 0 := by + have := ett.roundsPositive + simpa using Nat.ne_of_gt (Nat.zero_lt_of_lt ett.roundsPositive) + simp only [ite_eq_right hn] + simp_rw [hd] + rw [← hf, ← ett.generatingColoring, htree] + +private theorem helper_hstar_188.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (b : HierarchyBase corr.replacementETT phi), + b.core = base.core → + ∀ (K : TashkinovHierarchy corr.replacementETT b) (hn : K.dividerCount = H.dividerCount), + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = + H.stage + (Fin.cast + (by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corr + have := TreeSequence.positive T + have := TreeSequence.positive U + omega) + j).castSucc) → + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + let index : Fin (K.dividerCount + (1 : ℕ)) → Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := TreeSequence.positive T + have := TreeSequence.positive U + omega) + j; + index (0 : Fin (K.dividerCount + (1 : ℕ))) = (0 : Fin (H.dividerCount + (1 : ℕ))) → + HierarchyStarredStage K j = HierarchyStarredStage H (index j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H starredAt U corr b hc K hn hs j index hz + obtain hj | ⟨i, rfl⟩ := Fin.eq_zero_or_eq_succ j + · subst j + simpa [hz, HierarchyStarredStage] using hc + · have hi : (index i.succ).val ≠ 0 := by simp [index] + rw [starredAt (index i.succ) hi] + exact hs i.succ + +private theorem helper_branch_199.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + HStar.dividerCount = H.dividerCount → + (∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (b : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT b) (hn : K.dividerCount = H.dividerCount), + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = + H.stage + (Fin.cast + (by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corr + have := TreeSequence.positive T + have := TreeSequence.positive U + omega) + j).castSucc) → + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + let index : Fin (K.dividerCount + (1 : ℕ)) → Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := TreeSequence.positive T + have := TreeSequence.positive U + omega) + j; + index (0 : Fin (K.dividerCount + (1 : ℕ))) = (0 : Fin (H.dividerCount + (1 : ℕ))) → + HierarchyStarredStage K j = HierarchyStarredStage H (index j) → + HierarchyStageMissingColors K j = + HierarchyStageMissingColors H + (Fin.cast + (by + have := CorrespondingExtendedTashkinovTree.rungAgreement corr + have := TreeSequence.positive T + have := TreeSequence.positive U + omega) + j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H R corrMinus baseMinus HMinus corrStar + baseStar HStar countStar terminalData U corr b K hn hs j index hz hstar + obtain hj | ⟨i, rfl⟩ := Fin.eq_zero_or_eq_succ j + · subst j + change TreeMissingColors phi (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) = HierarchyStageMissingColors H (index 0) + rw [hz] + change TreeMissingColors phi (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) = + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) + rw [(terminalData U corr).1] + · let io : Fin H.dividerCount := ⟨i.val, by have := i.isLt; omega⟩ + have hi : index i.succ = io.succ := Fin.ext rfl + simp only [HierarchyStageMissingColors, Fin.cases_succ] + exact congrArg (TreeMissingColors phi) (hs i.succ) + +private theorem helper_firstMissingBelow_215.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (X : TreeSequence G e0) + (c : Fin k), + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) < X.length → + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D R corrMinus baseMinus HMinus corrStar + baseStar HStar X c hlt + let candidates := Finset.univ.filter fun i : Fin (X.length + 1) => + c ∈ MissingColors G phi (X.vertex i) + by_cases hn : candidates.Nonempty + · have he : HierarchyFirstMissingPosition phi X c = candidates.min' hn := by + simp only [HierarchyFirstMissingPosition, candidates, dite_eq_left hn] + rw [he] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have he : HierarchyFirstMissingPosition phi X c = Fin.last X.length := by + simp only [HierarchyFirstMissingPosition, candidates, dite_eq_right hn] + rw [he] at hlt + simp only [Fin.val_last] at hlt + omega + +private theorem helper_oldAvoid_230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A eta c hs hc + have hh := (Finset.mem_sdiff.mp (C.good.avoidance q eta hs hc)).2 + change c ∉ HierarchySegmentColors H q eta at hh + unfold HierarchySegmentColors at hh + dsimp only at hh + have hend : H.stage q.succ = T := by convert H.terminalStage using 1; congr 1 + rw [hend] at hh + exact hh + +private theorem helper_thetaCutoff_242.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + D.theta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∨ + ∃ eta ∈ HierarchyStoredColorsAt H q, + D.theta ∈ C.good.gamma q eta ∧ + eta ∉ MissingColors G phi (T.vertex D.penultimateVertexIndex)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (2 : ℕ) = T.length → + P.length + (1 : ℕ) = T.length → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.minus.length = B.length + (1 : ℕ) → + (∀ (X : TreeSequence G e0) (c : Fin k), + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) < X.length → + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c))) → + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k))) → + ∀ eta ∈ HierarchyStoredColorsAt H q, + D.theta ∈ C.good.gamma q eta → + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hnonexceptional H q A B P htail hBL hPL R + corrMinus baseMinus HMinus corrStar baseStar HStar minusLength firstMissingBelow oldAvoid + eta hs hc + have hpresent : eta ∉ MissingColors G phi (T.vertex D.penultimateVertexIndex) := by + rcases hnonexceptional with hout | ⟨selected, hselected, hpair, hpresent⟩ + · exact False.elim (hout (Finset.mem_biUnion.mpr ⟨eta, hs, hc⟩)) + · by_cases he : eta = selected + · simpa [he] using hpresent + · exact False.elim (Finset.disjoint_left.mp + (C.good.disjointPairs q eta selected hs hselected he) hc hpair) + have hu : (HierarchyFirstMissingPosition phi T eta).val ≤ + D.lastEdgeIndex.val := by + by_contra hlt + apply oldAvoid eta D.theta hs hc + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, D.lastEdgeIndex, + by have := D.lastEdgePosition; omega, + by have := D.lastEdgeIndex.isLt; omega, D.thetaOnLastEdge⟩ + by_contra hlt + have he : HierarchyFirstMissingPosition phi T eta = D.penultimateVertexIndex := by + apply Fin.ext + have := D.penultimateVertexPosition + have := D.lastEdgePosition + omega + have hm := firstMissingBelow T eta (by have := D.lastEdgeIndex.isLt; omega) + rw [he] at hm + exact hpresent hm + +private theorem helper_terminalAvoid_268.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (2 : ℕ) = T.length → + P.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < (↑(HierarchyFirstMissingPosition phi X c) : ℕ) → + c ∉ MissingColors G phi (X.vertex i)) → + (∀ (X : TreeSequence G e0) (c : Fin k), + ∀ t ≤ X.length, + (∀ (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < t → c ∉ MissingColors G phi (X.vertex i)) → + t ≤ (↑(HierarchyFirstMissingPosition phi X c) : ℕ)) → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.minus.length = B.length + (1 : ℕ) → + (∀ (X : TreeSequence G e0) (c : Fin k), + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) < X.length → + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c))) → + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k))) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + D.theta ∈ C.good.gamma q eta → + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) ≤ B.length) → + ∀ (U : TreeSequence G e0), + TreeSequenceInitialSegment B U → + (∀ (r : Fin U.length), + (∃ (t : Fin T.length), + (↑t : ℕ) = (↑r : ℕ) ∧ (↑r : ℕ) < B.length ∧ U.edge r = T.edge t) ∨ + (↑r : ℕ) = B.length ∧ U.edge r = T.edge D.lastEdgeIndex ∨ + (↑r : ℕ) = B.length + (1 : ℕ) ∧ U.edge r = T.edge R.penultimateEdgeIndex) → + ∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL hBT firstLe + firstBefore firstLower R corrMinus baseMinus HMinus corrStar baseStar HStar minusLength + firstMissingBelow oldAvoid thetaCutoff U hBU hedges eta c hs hc hmem + obtain ⟨_, r, hlo, hhi, hcol⟩ := Finset.mem_filter.mp hmem + have hnew : r.val < (HierarchyFirstMissingPosition phi U eta).val := lt_of_lt_of_le hhi + (Nat.min_le_left _ _) + have commonAbsent : ∀ i : Fin (T.length + 1), i.val ≤ B.length → i.val ≤ r.val → + eta ∉ MissingColors G phi (T.vertex i) := by + intro i hi hir + let j : Fin (B.length + 1) := ⟨i.val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hBT.1) j = i := Fin.ext rfl + have hn := firstBefore U eta (Fin.castLE (Nat.succ_le_succ hBU.1) j) (by + change i.val < (HierarchyFirstMissingPosition phi U eta).val + omega) + rw [hBU.2.1 j, ← hBT.2.1 j, he] at hn + exact hn + rcases hedges r with ⟨t, ht, htb, hedge⟩ | ⟨hr, hedge⟩ | ⟨hr, hedge⟩ + · have hcut := firstLower T eta (t.val + 1) (by have := t.isLt; omega) (by + intro i hi + exact commonAbsent i (by omega) (by omega)) + apply oldAvoid eta c hs hc + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, by omega, + by have := t.isLt; omega, by rwa [hedge] at hcol⟩ + · have he : c = D.theta := by rw [hedge, D.thetaOnLastEdge] at hcol; exact (Option.some.inj + hcol).symm + subst c + have hcut := thetaCutoff eta hs hc + let i := HierarchyFirstMissingPosition phi T eta + let j : Fin (B.length + 1) := ⟨i.val, by omega⟩ + have hm := firstMissingBelow T eta (by omega) + have he : Fin.castLE (Nat.succ_le_succ hBT.1) j = i := Fin.ext rfl + have hmu : eta ∈ MissingColors G phi + (U.vertex (Fin.castLE (Nat.succ_le_succ hBU.1) j)) := by + rw [hBU.2.1 j, ← hBT.2.1 j, he] + exact hm + have := firstLe U eta _ hmu + simp only [Fin.val_castLE] at this + omega + · have ht : R.penultimateEdgeIndex.val = B.length := by + have := R.penultimateEdgePosition + omega + have hcut := firstLower T eta (B.length + 1) (by omega) (by + intro i hi + exact commonAbsent i (by omega) (by omega)) + apply oldAvoid eta c hs hc + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, R.penultimateEdgeIndex, + by omega, by have := R.penultimateEdgeIndex.isLt; omega, + by rwa [hedge] at hcol⟩ + +private theorem helper_edgesStar_335.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (2 : ℕ) = T.length → + P.length + (1 : ℕ) = T.length → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) + (starLength : R.star.length = R.minus.length + (1 : ℕ)), + TreeSequenceInitialSegment R.minus R.star → + R.star.edge + (Fin.cast + (by + have := TreeSequence.positive T + omega) + (Fin.last R.minus.length)) = + T.edge R.penultimateEdgeIndex → + R.minus.length = B.length + (1 : ℕ) → + (∀ (r : Fin R.minus.length), + (∃ (t : Fin T.length), + (↑t : ℕ) = (↑r : ℕ) ∧ (↑r : ℕ) < B.length ∧ R.minus.edge r = T.edge t) ∨ + (↑r : ℕ) = B.length ∧ R.minus.edge r = T.edge D.lastEdgeIndex ∨ + (↑r : ℕ) = B.length + (1 : ℕ) ∧ + R.minus.edge r = T.edge R.penultimateEdgeIndex) → + ∀ (r : Fin R.star.length), + (∃ (t : Fin T.length), + (↑t : ℕ) = (↑r : ℕ) ∧ (↑r : ℕ) < B.length ∧ R.star.edge r = T.edge t) ∨ + (↑r : ℕ) = B.length ∧ R.star.edge r = T.edge D.lastEdgeIndex ∨ + (↑r : ℕ) = B.length + (1 : ℕ) ∧ R.star.edge r = T.edge R.penultimateEdgeIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B P hBL hPL R corrMinus baseMinus HMinus + corrStar baseStar HStar starLength hMS starEdge minusLength edgesMinus r + by_cases hr : r.val < R.minus.length + · let i : Fin R.minus.length := ⟨r.val, hr⟩ + have he : Fin.castLE hMS.1 i = r := Fin.ext rfl + rw [← he, hMS.2.2 i] + simpa using edgesMinus i + · have he : r = Fin.cast starLength.symm (Fin.last R.minus.length) := Fin.ext (by simp; omega) + exact Or.inr (Or.inr ⟨by omega, by rw [he]; exact starEdge⟩) + +private theorem helper_nextBound_348.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + (∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a_1 : ¬a < H.dividerCount + (2 : ℕ)) ↦ by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a_1 : ¬a + d < H.dividerCount + (2 : ℕ)) ↦ by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + TreeSequenceInitialSegment A B → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + HStar.dividerCount = H.dividerCount → + ∀ (i : Fin H.dividerCount), + (H.stage i.succ.castSucc).length ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B stageSegment starredAt hAB R + corrMinus baseMinus HMinus corrStar baseStar HStar countStar i + have hp : H.dividerCount ≠ 0 := by have := i.isLt; omega + have ha : A = H.stage q.castSucc := starredAt q (by simpa [q] using hp) + have hh := stageSegment (i.val + 1) (H.dividerCount - (i.val + 1)) (by omega) + have hlo : (⟨i.val + 1, by omega⟩ : Fin (H.dividerCount + 2)) = i.succ.castSucc := Fin.ext rfl + have hhi : (⟨i.val + 1 + (H.dividerCount - (i.val + 1)), by omega⟩ : + Fin (H.dividerCount + 2)) = q.castSucc := Fin.ext (by simp [q]) + rw [hlo, hhi, ← ha] at hh + exact le_trans hh.1 hAB.1 + +private theorem helper_stageMissingA_494.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors phi X ⊆ TreeMissingColors phi Y) → + HierarchyStageMissingColors H q ⊆ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A missingSubset + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hcore : A = base.core := by simp [A, hq, HierarchyStarredStage] + rw [hq] + change TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) ⊆ _ + rw [hcore] + by_cases hpe : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨u⟩⟩ := base.parallel hpe + exact missingSubset u.leftSegment + · rw [base.nonparallel hpe] + · have hp : q.val ≠ 0 := by simpa [q] using hz + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · exact False.elim (hp (congrArg Fin.val hzero)) + · rw [hi] + change TreeMissingColors phi (H.stage i.succ.castSucc) ⊆ _ + rw [show A = H.stage i.succ.castSucc by dsimp only [A]; rw [hi]; rfl] + +private theorem helper_igBound_526.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + D.gammaOne ∈ TreeMissingColors phi A → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + (↑ig : ℕ) ≤ A.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hAT firstLe R corrMinus baseMinus + HMinus corrStar baseStar HStar gammaA ig + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp gammaA + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + have hm : D.gammaOne ∈ MissingColors G phi + (T.vertex (Fin.castLE (Nat.succ_le_succ hAT.1) i)) := by + rw [hAT.2.1 i] + exact hcv + have hh := firstLe T D.gammaOne _ hm + have := i.isLt + simp only [Fin.val_castLE] at hh + omega + +private theorem helper_vgA_537.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + (∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + let vg : V := T.vertex ig; + (↑ig : ℕ) ≤ A.length → + vg ∈ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hAT vertexMem R corrMinus baseMinus + HMinus corrStar baseStar HStar ig vg igBound + let i : Fin (A.length + 1) := ⟨ig.val, by omega⟩ + have hi : Fin.castLE (Nat.succ_le_succ hAT.1) i = ig := Fin.ext rfl + dsimp only [vg] + rw [← hi, hAT.2.1 i] + exact vertexMem A _ + +private theorem helper_penTerminal_553.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (2 : ℕ) = T.length → + P.length + (1 : ℕ) = T.length → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.minus.length = B.length + (1 : ℕ) → + T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B P hBL hPL R corrMinus baseMinus HMinus + corrStar baseStar HStar minusLength he + have hh := congrArg Fin.val (T.vertex_injective he) + have := D.penultimateVertexPosition + have := D.terminalVertexPosition + omega + +private theorem helper_oldOrderedUnused_568.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (2 : ℕ) = T.length → + P.length + (1 : ℕ) = T.length → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.minus.length = B.length + (1 : ℕ) → + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k))) → + D.gammaOne ∈ C.good.gamma q D.alpha → + D.gammaOne ≠ D.alpha → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + (↑ig : ℕ) ≤ A.length → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne)) + (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ + D.gammaOne ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < (↑(HierarchyFirstMissingPosition phi T D.alpha) : ℕ) ∧ + phi (T.edge r) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL alphaFirst R + corrMinus baseMinus HMinus corrStar baseStar HStar minusLength oldAvoid gammaMem gammaNe ig + igBound + refine ⟨⟨ig, D.penultimateVertexIndex, rfl, by rw [alphaFirst], ?_⟩, ?_⟩ + · have := D.penultimateVertexPosition + omega + · intro hm + obtain ⟨_, r, hlo, hhi, hcol⟩ := Finset.mem_filter.mp hm + apply oldAvoid D.alpha D.gammaOne D.alphaStored gammaMem + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, r, hlo, + lt_min hhi r.isLt, hcol⟩ + +private theorem helper_lastMissingPositive_586.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) {U : TreeSequence G e0} + {inp : PartialEdgeColoring E k} {et : ExtendedTashkinovTree G k e0 inp U phi} + {b : HierarchyBase et phi} (K : TashkinovHierarchy et b), + (0 : ℕ) < K.dividerCount → + HierarchyStageMissingColors K (Fin.last K.dividerCount) = + TreeMissingColors phi + (K.stage + (⟨K.dividerCount, by + have := TreeSequence.positive U + omega⟩ : + Fin (K.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D R corrMinus baseMinus HMinus corrStar + baseStar HStar U inp et b K hp + let i : Fin K.dividerCount := ⟨K.dividerCount - 1, by omega⟩ + have hi : Fin.last K.dividerCount = i.succ := Fin.ext (by simp [i]; omega) + rw [hi] + change TreeMissingColors phi (K.stage i.succ.castSucc) = _ + congr 2 + apply Fin.ext + simp [i] + omega + +private theorem helper_componentOld_599.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + HMinus.dividerCount = H.dividerCount → + HStar.dividerCount = H.dividerCount → + D.gammaOne ∈ HierarchyStageMissingColors H q → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + let vg : V := T.vertex ig; + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) ∧ + (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)) → + (∀ {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} + {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} + (K : TashkinovHierarchy et b), + (0 : ℕ) < K.dividerCount → + HierarchyStageMissingColors K (Fin.last K.dividerCount) = + TreeMissingColors phi + (K.stage + (⟨K.dividerCount, + by + have := TreeSequence.positive U + omega⟩ : + Fin (K.dividerCount + (2 : ℕ))))) → + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg) = + TwoColorComponent G phi D.gammaOne D.alpha + (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q alphaFirst R corrMinus baseMinus + HMinus corrStar baseStar HStar countMinus countStar gammaStage ig vg changeOld + lastMissingPositive + have hh := changeOld + dsimp only at hh + rw [alphaFirst] at hh + by_cases hz : H.dividerCount = 0 + · apply hh.2.1 + refine ⟨hz, Or.inl ?_⟩ + have hq : q = 0 := Fin.ext (by simp [q, hz]) + simpa [hq, HierarchyStageMissingColors] using gammaStage + · apply hh.1 + refine ⟨Nat.pos_of_ne_zero hz, Or.inl ?_⟩ + rwa [lastMissingPositive H (by omega)] at gammaStage + +private theorem helper_pathBound_620.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) {U : TreeSequence G e0} + {inp : PartialEdgeColoring E k} {et : ExtendedTashkinovTree G k e0 inp U phi} + {b : HierarchyBase et phi} (K : TashkinovHierarchy et b), + HierarchyPathNumber K ≤ + U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length := by + classical + intro V E _ _ _ _ G k e0 phi U inp et b K + unfold HierarchyPathNumber + dsimp only + split + · exact (Finset.mem_Icc.mp (Finset.mem_filter.mp (Finset.min'_mem _ _)).1).2 + · exact le_rfl + +private theorem helper_gammaNotTerminal_634.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (2 : ℕ) = T.length → + P.length + (1 : ℕ) = T.length → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus), + MaximumProperty corrMinus.replacementETT → + ∀ (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.minus.length = B.length + (1 : ℕ) → + HMinus.dividerCount = H.dividerCount → + ∀ (_ : GoodHierarchy HMinus), + D.gammaOne ≠ D.alpha → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + let vg : V := T.vertex ig; + D.gammaOne ∈ MissingColors G phi vg → + vg ≠ T.vertex D.terminalVertexIndex → + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) ∧ + (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)) → + HierarchyStarredStage HMinus (Fin.last HMinus.dividerCount) = A → + (∀ {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} + {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} + (K : TashkinovHierarchy et b), + HierarchyPathNumber K ≤ + U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length) → + vg ∈ TreeSequenceVertexSet R.minus → + T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet R.minus → + D.gammaOne ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL R corrMinus + mpMinus baseMinus HMinus corrStar baseStar HStar minusLength countMinus goodMinus gammaNe + ig vg gammaAt vgTerminal changeOld lastMinus pathBound vgMinus terminalMinus hm + have hnot : ¬ ColoredVertexSetElementary G phi (TreeSequenceVertexSet R.minus) := by + intro he + exact Finset.disjoint_left.mp (he vgMinus terminalMinus vgTerminal) gammaAt hm + let CM : HierarchyCounterexample baseMinus := + { positive := by rw [corrMinus.rungAgreement]; exact C.positive + hierarchy := HMinus + good := goodMinus + maximum := mpMinus + notElementary := hnot } + have hbound := pathBound HMinus + rw [lastMinus] at hbound + apply ctx.lexicographicMinimality CM corrMinus.rungAgreement countMinus + apply Or.inl + change HierarchyPathNumber HMinus < HierarchyPathNumber H + rw [D.pathNumberFull] + change HierarchyPathNumber HMinus < T.length - A.length + omega + +private theorem helper_pathStar_659.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [inst_2 : DecidableEq V] [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (mpStar : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + HStar.dividerCount = H.dividerCount → + R.star.length = T.length → + ∀ (goodStar : GoodHierarchy HStar), + HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A → + (∀ {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} + {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} + (K : TashkinovHierarchy et b), + HierarchyPathNumber K ≤ + U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length) → + let _ : HierarchyCounterexample baseStar := by + exact { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 + G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 + G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett) + (fun (_a : Nat) ↦ + @LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) _a) + (by + have := + CorrespondingExtendedTashkinovTree.rungAgreement + corrStar + have := TreeSequence.positive T + omega))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C), + hierarchy := HStar, good := goodStar, maximum := mpStar, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C) : + HierarchyCounterexample baseStar }; + HierarchyPathNumber HStar = HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A R corrMinus baseMinus HMinus + corrStar mpStar baseStar HStar countStar hSL goodStar lastStar pathBound CS + have hbound := pathBound HStar + rw [lastStar, hSL] at hbound + have hnot : ¬ HierarchyPathNumber HStar < HierarchyPathNumber H := by + intro hh + apply ctx.lexicographicMinimality CS corrStar.rungAgreement countStar + exact Or.inl hh + have hfull : HierarchyPathNumber H = T.length - A.length := D.pathNumberFull + omega + +private theorem helper_measureStar_668.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [inst_2 : DecidableEq V] [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (mpStar : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (countStar : HStar.dividerCount = H.dividerCount), + (∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), + HStar.stage j.castSucc = + H.stage + (Fin.cast + (by + have := + CorrespondingExtendedTashkinovTree.rungAgreement + corrStar + have := TreeSequence.positive T + omega) + j).castSucc) → + R.star.length = T.length → + ∀ (goodStar : GoodHierarchy HStar), + let CS : HierarchyCounterexample baseStar := by + exact { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 + G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 + G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett) + (fun (_a : Nat) ↦ + @LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) _a) + (by + have := + CorrespondingExtendedTashkinovTree.rungAgreement + corrStar + have := TreeSequence.positive T + omega))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C), + hierarchy := HStar, good := goodStar, maximum := mpStar, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C) : + HierarchyCounterexample baseStar }; + HierarchyPathNumber HStar = HierarchyPathNumber H → + HierarchyCounterexampleMeasure CS = HierarchyCounterexampleMeasure C := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H R corrMinus baseMinus HMinus corrStar + mpStar baseStar HStar countStar stagesStar hSL goodStar CS pathStar + apply Prod.ext + · exact pathStar + · change R.star.length - (HStar.stage ⟨HStar.dividerCount, by omega⟩).length = + T.length - (H.stage ⟨H.dividerCount, by omega⟩).length + have hs := stagesStar (Fin.last HStar.dividerCount) + have hi : (Fin.cast (congrArg (fun d => d + 1) countStar) + (Fin.last HStar.dividerCount)).castSucc = + (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := Fin.ext (by simp []) + rw [hi] at hs + have hj : (Fin.last HStar.dividerCount).castSucc = + (⟨HStar.dividerCount, by omega⟩ : Fin (HStar.dividerCount + 2)) := Fin.ext rfl + rw [hj] at hs + simpa only [hSL] using congrArg (fun U : TreeSequence G e0 => T.length - U.length) hs + +private theorem helper_hPSL_709.{u_1, u_2} : + helperHPSL709Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL R corrMinus + baseMinus HMinus corrStar mpStar baseStar HStar starLength minusLength goodStar gammaNe + changeOld lastStar CS PS + change min ((HierarchyStarredStage HStar (Fin.last HStar.dividerCount)).length + + (R.star.length - (HierarchyStarredStage HStar (Fin.last HStar.dividerCount)).length - 1)) + R.star.length = _ + rw [lastStar] + omega + +private theorem helper_thetaNe_723.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + D.theta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∨ + ∃ eta ∈ HierarchyStoredColorsAt H q, + D.theta ∈ C.good.gamma q eta ∧ + eta ∉ MissingColors G phi (T.vertex D.penultimateVertexIndex)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + D.gammaOne ∈ C.good.gamma q D.alpha → + D.theta ≠ D.gammaOne := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hnonexceptional H q gammaMem he + rcases hnonexceptional with hout | ⟨eta, heta, htheta, hpresent⟩ + · apply hout + exact Finset.mem_biUnion.mpr ⟨D.alpha, D.alphaStored, he.symm ▸ gammaMem⟩ + · have hne : eta ≠ D.alpha := by + intro ha + exact hpresent (ha.symm ▸ D.alphaMissingPenultimate) + exact Finset.disjoint_left.mp + (C.good.disjointPairs q eta D.alpha heta D.alphaStored hne) htheta (he.symm ▸ gammaMem) + +private theorem helper_newPrefixMissing_769.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [inst_2 : DecidableEq V] [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (mpStar : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (goodStar : GoodHierarchy HStar), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + let vg : V := T.vertex ig; + D.gammaOne ∈ MissingColors G phi vg → + vg ∈ TreeSequenceVertexSet R.minus → + T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet R.minus → + let CS : HierarchyCounterexample baseStar := by + exact { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 + G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k + e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G + k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 + G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett) + (fun (_a : Nat) ↦ + @LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) _a) + (by + have := + CorrespondingExtendedTashkinovTree.rungAgreement + corrStar + have := TreeSequence.positive T + omega))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C), + hierarchy := HStar, good := goodStar, maximum := mpStar, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseOneData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C) : + HierarchyCounterexample baseStar }; + let PS : TreeSequence G e0 := + HierarchyFullTailPrefix CS (HierarchyFullTailLength CS - (1 : ℕ)); + TreeSequenceInitialSegment R.minus PS → + D.gammaOne ∈ TreeMissingColors phi PS ∧ D.alpha ∈ TreeMissingColors phi PS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D R corrStar mpStar baseStar HStar goodStar + ig vg gammaAt vgMinus terminalMinus CS PS hMPS + constructor + · exact Finset.mem_biUnion.mpr + ⟨vg, TreeSequenceInitialSegmentVertexSetSubset hMPS vgMinus, gammaAt⟩ + · exact Finset.mem_biUnion.mpr + ⟨_, TreeSequenceInitialSegmentVertexSetSubset hMPS terminalMinus, D.alphaMissingTerminal⟩ + +private theorem helper_endpoint_830.{u_1, u_2} : + helperEndpoint830Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D gammaNe ig vg u v path hpath hsupport w + hw hm + let graph := TwoColorIncidenceGraph G phi D.gammaOne D.alpha + have hdegree : @SimpleGraph.degree _ graph (Sum.inl w) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with hm | hm + · exact MissingColorIncidenceEndpoint G phi D.gammaOne D.alpha gammaNe ctx.proper w hm + · have he : graph = TwoColorIncidenceGraph G phi D.alpha D.gammaOne := by + ext x y + cases x <;> cases y <;> simp [graph, TwoColorIncidenceGraph, or_comm] + rw [he] + exact MissingColorIncidenceEndpoint G phi D.alpha D.gammaOne gammaNe.symm ctx.proper w hm + have hleaf : (graph.neighborSet (Sum.inl w)).Subsingleton := by + let : Fintype (graph.neighborSet (Sum.inl w)) := Fintype.ofFinite _ + intro x hx y hy + have hcard : Fintype.card (graph.neighborSet (Sum.inl w)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hdegree + exact congrArg Subtype.val (Fintype.card_le_one_iff.mp hcard ⟨x, hx⟩ ⟨y, hy⟩) + have hmem : Sum.inl w ∈ path.support := by + change Sum.inl w ∈ {x | x ∈ path.support} + rw [hsupport] + exact hw + by_contra hn + push Not at hn + exact (hpath.isTrail.notMem_support_of_subsingleton_neighborSet hn.1 hn.2 hleaf) hmem + +private theorem helper_alphaStarFirst_2178.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (2 : ℕ) = T.length → + P.length + (1 : ℕ) = T.length → + (∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) → + (∀ (X : TreeSequence G e0) (c : Fin k), + ∀ t ≤ X.length, + (∀ (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < t → c ∉ MissingColors G phi (X.vertex i)) → + t ≤ (↑(HierarchyFirstMissingPosition phi X c) : ℕ)) → + D.alpha ∉ TreeMissingColors phi B → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (mpStar : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + ∀ (hMS : TreeSequenceInitialSegment R.minus R.star), + R.minus.length = B.length + (1 : ℕ) → + TreeSequenceInitialSegment B R.star → + ∀ (goodStar : GoodHierarchy HStar), + let CS : HierarchyCounterexample baseStar := by + exact + @helperCS2799 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@R) + (@corrStar) (@mpStar) (@baseStar) (@HStar) (@goodStar) + let PS : TreeSequence G e0 := + HierarchyFullTailPrefix CS (HierarchyFullTailLength CS - (1 : ℕ)); + PS.length = R.minus.length → + let ia : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hMS.1) (Fin.last R.minus.length); + D.alpha ∈ MissingColors G phi (R.star.vertex ia) → + HierarchyFirstMissingPosition phi R.star D.alpha = ia := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B P hBL hPL vertexMem firstLe firstLower + alphaNotB R corrMinus baseMinus HMinus corrStar mpStar baseStar HStar starLength hMS + minusLength hBS goodStar CS PS hPSL ia alphaStarAt + apply Fin.ext + have hu := firstLe R.star D.alpha ia alphaStarAt + have hl := firstLower R.star D.alpha (B.length + 1) (by omega) (by + intro i hi hm + let j : Fin (B.length + 1) := ⟨i.val, hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hBS.1) j = i := Fin.ext rfl + apply alphaNotB + refine Finset.mem_biUnion.mpr ⟨B.vertex j, vertexMem B j, ?_⟩ + rw [← he, hBS.2.1 j] at hm + exact hm) + have hi : ia.val = R.minus.length := rfl + omega + +private theorem helper_gammaStarFirst_2196.{u_1, u_2} : + helperGammaStarFirst2196Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL hBT firstLe + firstBefore firstLower R corrMinus baseMinus HMinus corrStar mpStar baseStar HStar + starLength hMS minusLength hBS goodStar gammaNe ig vg gammaAt igBound changeOld CS PS hPSL + thetaNe jg isg gammaStarVertex + apply Fin.ext + have hu := firstLe R.star D.gammaOne isg (gammaStarVertex.symm ▸ gammaAt) + have hl := firstLower R.star D.gammaOne ig.val (by omega) (by + intro i hi + let j : Fin (B.length + 1) := ⟨i.val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hBS.1) j = i := Fin.ext rfl + have hn := firstBefore T D.gammaOne (Fin.castLE (Nat.succ_le_succ hBT.1) j) (by + simp only [Fin.val_castLE]; exact hi) + rwa [hBT.2.1 j, ← hBS.2.1 j, he] at hn) + change (HierarchyFirstMissingPosition phi R.star D.gammaOne).val = ig.val + change (HierarchyFirstMissingPosition phi R.star D.gammaOne).val ≤ ig.val at hu + omega + +private theorem helper_newOrderedUnused_2212.{u_1, u_2} : + helperNewOrderedUnused2212Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL alphaFirst R + corrMinus baseMinus HMinus corrStar mpStar baseStar HStar hMS minusLength hBS oldAvoid + edgesStar goodStar gammaMem gammaNe ig igBound changeOld lastStar CS PS hPSL thetaNe ia + alphaStarFirst jg isg gammaStarFirst + rw [gammaStarFirst, alphaStarFirst] + refine ⟨⟨isg, ia, rfl, rfl, ?_⟩, ?_⟩ + · change ig.val < R.minus.length + omega + · intro hm + obtain ⟨_, r, hlo, hhi, hcol⟩ := Finset.mem_filter.mp hm + rw [lastStar] at hlo + have hia : ia.val = R.minus.length := rfl + rcases edgesStar r with ⟨t, ht, htb, hedge⟩ | ⟨hr, hedge⟩ | ⟨hr, hedge⟩ + · apply oldAvoid D.alpha D.gammaOne D.alphaStored gammaMem + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, t, by omega, ?_, ?_⟩ + · rw [alphaFirst] + have := D.penultimateVertexPosition + omega + · rwa [hedge] at hcol + · rw [hedge, D.thetaOnLastEdge] at hcol + exact thetaNe (Option.some.inj hcol) + · omega + +private theorem helper_componentStar_2250.{u_1, u_2} : + helperComponentStar2250Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL R corrMinus + baseMinus HMinus corrStar mpStar baseStar HStar hMS minusLength countMinus countStar hBS + goodStar gammaNe ig vg igBound changeOld lastMissingPositive CS PS hPSL thetaNe ia + alphaStarFirst jg isg gammaStarVertex gammaStarFirst changeStar gammaStarStage + have hh := changeStar + dsimp only at hh + rw [gammaStarFirst, alphaStarFirst, gammaStarVertex, hMS.2.1, R.minusTerminalVertex] at hh + by_cases hz : HStar.dividerCount = 0 + · apply hh.2.1 + refine ⟨hz, Or.inl ?_⟩ + have hq : Fin.last HStar.dividerCount = (0 : Fin (HStar.dividerCount + 1)) := + Fin.ext (by simp [hz]) + simpa [hq, HierarchyStageMissingColors] using gammaStarStage + · apply hh.1 + refine ⟨Nat.pos_of_ne_zero hz, Or.inl ?_⟩ + rwa [lastMissingPositive HStar (by omega)] at gammaStarStage + +private theorem helper_missingSubset_3241.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + {X Y : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y), + TreeMissingColors phi X ⊆ TreeMissingColors phi Y := by + classical + intro V E _ _ G k e0 phi X Y hXY c hc + let _ := Fintype.ofFinite V + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hcv⟩ + +private theorem helper_penInP_3291.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : B.length + (2 : ℕ) = T.length) (_ : P.length + (1 : ℕ) = T.length) + (_ : TreeSequenceInitialSegment P T) + (_ : + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : R.minus.length = B.length + (1 : ℕ)), + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet P := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B P hBL hPL hPT vertexMem R corrMinus + baseMinus HMinus corrStar baseStar HStar minusLength + have he : Fin.castLE (Nat.succ_le_succ hPT.1) (Fin.last P.length) = + D.penultimateVertexIndex := Fin.ext (by simp; have := D.penultimateVertexPosition; omega) + rw [← he, hPT.2.1] + exact vertexMem P _ + +private theorem helper_gammaNotTerminal_3372.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : (2 : ℕ) ≤ T.length - A.length) (_ : B.length + (2 : ℕ) = T.length) + (_ : P.length + (1 : ℕ) = T.length) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (_ : MaximumProperty corrMinus.replacementETT) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : R.minus.length = B.length + (1 : ℕ)) + (_ : HMinus.dividerCount = H.dividerCount) (_ : GoodHierarchy HMinus) + (_ : D.gammaOne ≠ D.alpha), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + let vg : V := T.vertex ig; + ∀ (_ : D.gammaOne ∈ MissingColors G phi vg) + (_ : vg ≠ T.vertex D.terminalVertexIndex) + (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ + Disjoint + (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) ∧ + (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)) + (_ : HierarchyStarredStage HMinus (Fin.last HMinus.dividerCount) = A) + (_ : + ∀ {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} + {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} + (K : TashkinovHierarchy et b), + HierarchyPathNumber K ≤ + U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length) + (_ : vg ∈ TreeSequenceVertexSet R.minus) + (_ : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet R.minus), + D.gammaOne ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL R corrMinus + mpMinus baseMinus HMinus corrStar baseStar HStar minusLength countMinus goodMinus gammaNe + ig vg gammaAt vgTerminal changeOld lastMinus pathBound vgMinus terminalMinus + apply helper_gammaNotTerminal_634 <;> assumption +private theorem helper_gammaNotTerminal_3460.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let P : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : (2 : ℕ) ≤ T.length - A.length) (_ : B.length + (2 : ℕ) = T.length) + (_ : P.length + (1 : ℕ) = T.length) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (_ : MaximumProperty corrMinus.replacementETT) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : R.minus.length = B.length + (1 : ℕ)) + (_ : HMinus.dividerCount = H.dividerCount) (_ : GoodHierarchy HMinus) + (_ : D.gammaOne ≠ D.alpha), + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + let vg : V := T.vertex ig; + ∀ (_ : D.gammaOne ∈ MissingColors G phi vg) + (_ : vg ≠ T.vertex D.terminalVertexIndex) + (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ + Disjoint + (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) ∧ + (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)) + (_ : HierarchyStarredStage HMinus (Fin.last HMinus.dividerCount) = A) + (_ : + ∀ {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} + {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} + (K : TashkinovHierarchy et b), + HierarchyPathNumber K ≤ + U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length) + (_ : vg ∈ TreeSequenceVertexSet R.minus) + (_ : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet R.minus), + D.gammaOne ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL R corrMinus + mpMinus baseMinus HMinus corrStar baseStar HStar minusLength countMinus goodMinus gammaNe + ig vg gammaAt vgTerminal changeOld lastMinus pathBound vgMinus terminalMinus + apply helper_gammaNotTerminal_3372 <;> assumption +private theorem helper_continuation_3550.{u_1, u_2} : + helperContinuation3550Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hnonexceptional H q A B P htail hBL hPL + hBT restrictSegment vertexMem firstLe firstBefore firstLower alphaNotB alphaFirst R + corrMinus baseMinus HMinus corrStar mpStar baseStar HStar starLength hMS minusLength + countMinus countStar hBS infoStar oldAvoid edgesStar goodStar gammaMem gammaStage gammaNe + ig vg gammaAt igBound vgPen vgTerminal penTerminal changeOld lastMissingPositive + componentOld lastStar vgMinus terminalMinus CS ctxStar PS + have elementaryPS : ColoredVertexSetElementary G phi (TreeSequenceVertexSet PS) := + HierarchyCounterexamplePenultimateElementary G k e0 corrStar.replacementInput + R.star phi corrStar.replacementETT baseStar CS ctxStar.proper ctxStar.oneEdgeUncolored + ctxStar.lowerRung ctxStar.fewerDividers ctxStar.lexicographicMinimality + ctxStar.largeMissingSet + have hPSL : PS.length = R.minus.length := by + apply helper_hPSL_709 <;> assumption + have hPSS : TreeSequenceInitialSegment PS R.star := + ⟨Nat.min_le_right _ _, by intro i; rfl, by intro i; rfl⟩ + have hMPS := restrictSegment hMS hPSS (by omega) + have hPSM := restrictSegment hPSS hMS (by omega) + have elementaryMinus : ColoredVertexSetElementary G phi (TreeSequenceVertexSet R.minus) := by + intro u hu v hv hne + exact elementaryPS (TreeSequenceInitialSegmentVertexSetSubset hMPS hu) + (TreeSequenceInitialSegmentVertexSetSubset hMPS hv) hne + have thetaNe : D.theta ≠ D.gammaOne := by + exact helper_thetaNe_723 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnonexceptional) (@gammaMem) + let ia : Fin (R.star.length + 1) := + Fin.castLE (Nat.succ_le_succ hMS.1) (Fin.last R.minus.length) + have alphaStarAt : D.alpha ∈ MissingColors G phi (R.star.vertex ia) := by + rw [hMS.2.1, R.minusTerminalVertex] + exact D.alphaMissingTerminal + have alphaStarFirst : HierarchyFirstMissingPosition phi R.star D.alpha = ia := by + exact helper_alphaStarFirst_2178 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@hBL) (@hPL) (@vertexMem) (@firstLe) (@firstLower) (@alphaNotB) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@mpStar) (@baseStar) (@HStar) + (@starLength) (@hMS) (@minusLength) (@hBS) (@goodStar) (@hPSL) (@alphaStarAt) + let jg : Fin (B.length + 1) := ⟨ig.val, by omega⟩ + let isg : Fin (R.star.length + 1) := Fin.castLE (Nat.succ_le_succ hBS.1) jg + have gammaStarVertex : R.star.vertex isg = vg := by + rw [hBS.2.1 jg, ← hBT.2.1 jg] + rfl + have gammaStarFirst : HierarchyFirstMissingPosition phi R.star D.gammaOne = isg := by + apply helper_gammaStarFirst_2196 <;> assumption + have newPrefixMissing : D.gammaOne ∈ TreeMissingColors phi PS ∧ D.alpha ∈ TreeMissingColors phi + PS := by + exact helper_newPrefixMissing_769 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@R) (@corrStar) (@mpStar) (@baseStar) (@HStar) (@goodStar) (@gammaAt) + (@vgMinus) (@terminalMinus) (@hMPS) + have newOrderedUnused : + TreeVertexOrder R.star + (R.star.vertex (HierarchyFirstMissingPosition phi R.star D.gammaOne)) + (R.star.vertex (HierarchyFirstMissingPosition phi R.star D.alpha)) ∧ + D.gammaOne ∉ Finset.univ.filter (fun c => ∃ r : Fin R.star.length, + (HierarchyStarredStage HStar (Fin.last HStar.dividerCount)).length ≤ r.val ∧ + r.val < (HierarchyFirstMissingPosition phi R.star D.alpha).val ∧ + phi (R.star.edge r) = some c) := by + apply helper_newOrderedUnused_2212 <;> assumption + have changeStar := ChangeLemma G k e0 corrStar.replacementInput R.star phi + corrStar.replacementETT baseStar CS ctxStar.proper ctxStar.oneEdgeUncolored + ctxStar.lowerRung ctxStar.fewerDividers ctxStar.lexicographicMinimality + elementaryPS ctxStar.largeMissingSet D.gammaOne D.alpha gammaNe newPrefixMissing + (by dsimp only; intro _; exact newOrderedUnused) + have gammaStarStage : D.gammaOne ∈ HierarchyStageMissingColors HStar (Fin.last + HStar.dividerCount) := by + have hi : Fin.cast (congrArg (fun d => d + 1) countStar) (Fin.last HStar.dividerCount) = q := + Fin.ext (by simp [q]) + rw [(infoStar _).2.2, hi] + exact gammaStage + have componentStar : TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl (T.vertex D.terminalVertexIndex)) := by + apply helper_componentStar_2250 <;> assumption + obtain ⟨u, v, path, hpath, hsupport⟩ := + TwoColorComponentSpanningPath G phi D.gammaOne D.alpha ctx.proper (Sum.inl vg) + have endpoint (w : V) + (hw : Sum.inl w ∈ TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg)) + (hm : D.gammaOne ∈ MissingColors G phi w ∨ D.alpha ∈ MissingColors G phi w) : + Sum.inl w = u ∨ Sum.inl w = v := by + apply helper_endpoint_830 <;> assumption + have gammaComponent : Sum.inl vg ∈ TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg) := by + change (TwoColorIncidenceGraph G phi D.gammaOne D.alpha).connectedComponentMk (Sum.inl vg) = _ + rfl + have penComponent : Sum.inl (T.vertex D.penultimateVertexIndex) ∈ + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg) := by + rw [componentOld] + change (TwoColorIncidenceGraph G phi D.gammaOne D.alpha).connectedComponentMk _ = _ + rfl + have terminalComponent : Sum.inl (T.vertex D.terminalVertexIndex) ∈ + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg) := by + rw [componentStar] + change (TwoColorIncidenceGraph G phi D.gammaOne D.alpha).connectedComponentMk _ = _ + rfl + have eg := endpoint vg gammaComponent (Or.inl gammaAt) + have ep := endpoint _ penComponent (Or.inr D.alphaMissingPenultimate) + have et := endpoint _ terminalComponent (Or.inr D.alphaMissingTerminal) + have hgp : (Sum.inl vg : Sum V E) ≠ Sum.inl (T.vertex D.penultimateVertexIndex) := + fun hh => vgPen (Sum.inl.inj hh) + have hgt : (Sum.inl vg : Sum V E) ≠ Sum.inl (T.vertex D.terminalVertexIndex) := + fun hh => vgTerminal (Sum.inl.inj hh) + have hpt : (Sum.inl (T.vertex D.penultimateVertexIndex) : Sum V E) ≠ + Sum.inl (T.vertex D.terminalVertexIndex) := fun hh => penTerminal (Sum.inl.inj hh) + rcases eg with eg | eg <;> rcases ep with ep | ep <;> rcases et with et | et + · exact hgp (eg.trans ep.symm) + · exact hgp (eg.trans ep.symm) + · exact hgt (eg.trans et.symm) + · exact hpt (ep.trans et.symm) + · exact hpt (ep.trans et.symm) + · exact hgt (eg.trans et.symm) + · exact hgp (eg.trans ep.symm) + · exact hgp (eg.trans ep.symm) + +private theorem helper_continuation_3038.{u_1, u_2} : + helperContinuation3038Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hnonexceptional H q A B P transSegment + hAT htail hBL hPL hBT hPT restrictSegment hAB hBP hPE vertexMem firstLe firstMissing + firstBefore firstLower alphaNotB alphaFirst R corrMinus mpMinus baseMinus coreMinus + closureMinus HMinus corrStar mpStar baseStar coreStar closureStar HStar starLength hMS + minusLength hBM countMinus countStar stagesMinus stagesStar hBS hSL dataStar infoMinus + infoStar oldAvoid edgesStar avoidMinus avoidStar makeGood + obtain ⟨goodMinus, gammaMinus⟩ := makeGood R.minus corrMinus baseMinus coreMinus + closureMinus HMinus countMinus stagesMinus hBM avoidMinus + obtain ⟨goodStar, gammaStar⟩ := makeGood R.star corrStar baseStar coreStar + closureStar HStar countStar stagesStar hBS avoidStar + have missingSubset {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) : + TreeMissingColors phi X ⊆ TreeMissingColors phi Y := by + apply helper_missingSubset_3241; assumption + have stageMissingA : HierarchyStageMissingColors H q ⊆ TreeMissingColors phi A := by + apply helper_stageMissingA_494; assumption + have gammaMem : D.gammaOne ∈ C.good.gamma q D.alpha := by + rw [D.gammaPair] + simp + have gammaStage : D.gammaOne ∈ HierarchyStageMissingColors H q := + (Finset.mem_sdiff.mp (C.good.avoidance q D.alpha D.alphaStored gammaMem)).1 + have gammaA := stageMissingA gammaStage + have alphaNotA : D.alpha ∉ TreeMissingColors phi A := + (Finset.mem_sdiff.mp D.alphaStored).2 + have gammaNe : D.gammaOne ≠ D.alpha := by + intro he + exact alphaNotA (he ▸ gammaA) + let ig := HierarchyFirstMissingPosition phi T D.gammaOne + let vg := T.vertex ig + have gammaT := missingSubset hAT gammaA + have gammaAt : D.gammaOne ∈ MissingColors G phi vg := firstMissing T D.gammaOne gammaT + have igBound : ig.val ≤ A.length := by + exact helper_igBound_526 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hAT) (@firstLe) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) + (@HStar) (@gammaA) + have vgA : vg ∈ TreeSequenceVertexSet A := by + exact helper_vgA_537 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hAT) (@vertexMem) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) + (@HStar) (@igBound) + have vgPen : vg ≠ T.vertex D.penultimateVertexIndex := by + intro he + have hh := congrArg Fin.val (T.vertex_injective he) + have := D.penultimateVertexPosition + omega + have vgTerminal : vg ≠ T.vertex D.terminalVertexIndex := by + intro he + have hh := congrArg Fin.val (T.vertex_injective he) + have := D.terminalVertexPosition + omega + have penTerminal : T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex := by + exact helper_penTerminal_553 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@hBL) (@hPL) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) + (@HStar) (@minusLength) + have penInP : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet P := by + apply helper_penInP_3291 <;> assumption + have oldPrefixMissing : D.gammaOne ∈ TreeMissingColors phi P ∧ D.alpha ∈ TreeMissingColors phi + P := + ⟨missingSubset (transSegment hAB hBP) gammaA, + Finset.mem_biUnion.mpr ⟨_, penInP, D.alphaMissingPenultimate⟩⟩ + have oldOrderedUnused : + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne)) + (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ + D.gammaOne ∉ Finset.univ.filter (fun c => ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < (HierarchyFirstMissingPosition phi T D.alpha).val ∧ + phi (T.edge r) = some c) := by + exact helper_oldOrderedUnused_568 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@htail) (@hBL) (@hPL) (@alphaFirst) (@R) (@corrMinus) (@baseMinus) (@HMinus) + (@corrStar) (@baseStar) (@HStar) (@minusLength) (@oldAvoid) (@gammaMem) (@gammaNe) + (@igBound) + have changeOld := ChangeLemma G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality hPE ctx.largeMissingSet D.gammaOne D.alpha gammaNe + oldPrefixMissing (by dsimp only; intro _; exact oldOrderedUnused) + have lastMissingPositive {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} + {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} + (K : TashkinovHierarchy et b) (hp : 0 < K.dividerCount) : + HierarchyStageMissingColors K (Fin.last K.dividerCount) = + TreeMissingColors phi (K.stage ⟨K.dividerCount, by omega⟩) := by + exact helper_lastMissingPositive_586 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) + (@K) (@hp) + have componentOld : TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vg) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + apply helper_componentOld_599 <;> assumption + have lastMinus : HierarchyStarredStage HMinus (Fin.last HMinus.dividerCount) = A := by + have hi : Fin.cast (congrArg (fun d => d + 1) countMinus) (Fin.last HMinus.dividerCount) = q := + Fin.ext (by simp [q]) + simpa [hi] using (infoMinus (Fin.last HMinus.dividerCount)).1 + have lastStar : HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A := by + have hi : Fin.cast (congrArg (fun d => d + 1) countStar) (Fin.last HStar.dividerCount) = q := + Fin.ext (by simp [q]) + simpa [hi] using (infoStar (Fin.last HStar.dividerCount)).1 + have pathBound {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} + {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} + (K : TashkinovHierarchy et b) : + HierarchyPathNumber K ≤ U.length - (HierarchyStarredStage K (Fin.last + K.dividerCount)).length := by + exact helper_pathBound_620 (@G) (@k) (@e0) (@phi) (@K) + have vgMinus := TreeSequenceInitialSegmentVertexSetSubset (transSegment hAB hBM) vgA + have terminalMinus : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet R.minus := by + rw [← R.minusTerminalVertex] + exact vertexMem R.minus _ + have gammaNotTerminal : D.gammaOne ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) := by + apply helper_gammaNotTerminal_3460 <;> assumption + let CS : HierarchyCounterexample baseStar := + { positive := by rw [corrStar.rungAgreement]; exact C.positive + hierarchy := HStar + good := goodStar + maximum := mpStar + notElementary := by rw [R.starVertexSet]; exact C.notElementary } + have pathStar : HierarchyPathNumber HStar = HierarchyPathNumber H := by + apply helper_pathStar_659 <;> assumption + have measureStar : HierarchyCounterexampleMeasure CS = HierarchyCounterexampleMeasure C := by + exact helper_measureStar_668 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@mpStar) (@baseStar) (@HStar) + (@countStar) (@stagesStar) (@hSL) (@goodStar) (@pathStar) + let ctxStar : HierarchyMinimumCounterexampleContext G k e0 corrStar.replacementInput + R.star phi corrStar.replacementETT baseStar CS := by + exact { + proper := ctx.proper + oneEdgeUncolored := ctx.oneEdgeUncolored + lowerRung := by + intro inp U generating et hp hl hm + exact ctx.lowerRung et hp (by rwa [corrStar.rungAgreement] at hl) hm + fewerDividers := by + intro inp U generating et hr hm b K hg hn + apply ctx.fewerDividers et (hr.trans corrStar.rungAgreement) hm b K hg + change K.dividerCount < H.dividerCount + simpa [CS, countStar] using hn + lexicographicMinimality := by + intro inp U generating et b other hr hn hh + rw [measureStar] at hh + exact ctx.lexicographicMinimality other (hr.trans corrStar.rungAgreement) + (hn.trans countStar) hh + largeMissingSet := by + dsimp only + rw [dataStar.1, corrStar.rungAgreement] + exact ctx.largeMissingSet } + let PS := HierarchyFullTailPrefix CS (HierarchyFullTailLength CS - 1) + exact @helper_continuation_3550 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnonexceptional) (@htail) (@hBL) (@hPL) (@hBT) (@restrictSegment) (@vertexMem) (@firstLe) + (@firstBefore) (@firstLower) (@alphaNotB) (@alphaFirst) (@R) (@corrMinus) (@baseMinus) + (@HMinus) (@corrStar) (@mpStar) (@baseStar) (@HStar) (@starLength) (@hMS) (@minusLength) + (@countMinus) (@countStar) (@hBS) (@infoStar) (@oldAvoid) (@edgesStar) (@goodStar) + (@gammaMem) (@gammaStage) (@gammaNe) (@gammaAt) (@igBound) (@vgPen) (@vgTerminal) + (@penTerminal) (@changeOld) (@lastMissingPositive) (@componentOld) (@lastStar) (@vgMinus) + (@terminalMinus) (@ctxStar) +private theorem helper_segmentEq_3631.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ (_ : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : ∀ (i : Fin H.dividerCount), (H.stage i.succ.castSucc).length ≤ B.length) + (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (b : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT b) (hn : K.dividerCount = H.dividerCount) + (_ : TreeSequenceInitialSegment B U), + let index : (j : Fin (K.dividerCount + (1 : ℕ))) → Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + omega) + j; + ∀ + (_ : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = H.stage (index j).castSucc) + (_ : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H (index j)) + (i : Fin K.dividerCount) (eta : Fin k), + HierarchySegmentColors K i.castSucc eta = + HierarchySegmentColors H (index i.castSucc) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H B hBT R corrStar baseStar HStar + nextBound U corr b K hn hBU index stageEq starEq i eta + let io : Fin H.dividerCount := ⟨i.val, by have := i.isLt; omega⟩ + have hprev : index i.castSucc = io.castSucc := Fin.ext rfl + have hnext : index i.succ = io.succ := Fin.ext rfl + have hcutOld := HierarchyFirstMissingPositionPrefixCutoff phi B T hBT eta + (H.stage io.succ.castSucc).length (nextBound io) + have hcutNew := HierarchyFirstMissingPositionPrefixCutoff phi B U hBU eta + (H.stage io.succ.castSucc).length (nextBound io) + have hi : i.castSucc.succ = i.succ.castSucc := Fin.ext rfl + have hio : io.castSucc.succ = io.succ.castSucc := Fin.ext rfl + unfold HierarchySegmentColors + dsimp only + rw [hi, stageEq i.succ, starEq i.castSucc, hnext, hprev, hio, + ← hcutOld, ← hcutNew] + +private theorem helper_avoidance_3653.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (b : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT b) (hn : K.dividerCount = H.dividerCount) + (_ : + ∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k))), + let index : (j : Fin (K.dividerCount + (1 : ℕ))) → Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + omega) + j; + let gamma : (j : Fin (K.dividerCount + (1 : ℕ))) → (eta : Fin k) → Finset (Fin k) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ C.good.gamma (index j) eta; + ∀ + (_ : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H (index j)) + (_ : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H (index j)) + (_ : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = HierarchyStageMissingColors H (index j)) + (_ : index (Fin.last K.dividerCount) = q) + (_ : + ∀ (i : Fin K.dividerCount) (eta : Fin k), + HierarchySegmentColors K i.castSucc eta = + HierarchySegmentColors H (index i.castSucc) eta) + (j : Fin (K.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt K j, + gamma j eta ⊆ HierarchyStageMissingColors K j \ HierarchySegmentColors K j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A R corrStar baseStar HStar U corr b + K hn hav index gamma starEq storedEq missingEq indexLast segmentEq j eta heta c hcg + have oldStored := (storedEq j) ▸ heta + have oldAvoidance := Finset.mem_sdiff.mp (C.good.avoidance (index j) eta oldStored hcg) + refine Finset.mem_sdiff.mpr ⟨(missingEq j).symm ▸ oldAvoidance.1, ?_⟩ + by_cases hj : j.val < K.dividerCount + · let i : Fin K.dividerCount := ⟨j.val, hj⟩ + have hi : i.castSucc = j := Fin.ext rfl + rw [← hi, segmentEq i eta] + simpa [hi] using oldAvoidance.2 + · have hjlast : j = Fin.last K.dividerCount := Fin.ext (by simp; have := j.isLt; omega) + subst j + have hh := hav eta c (by simpa [indexLast] using oldStored) + (by simpa [gamma, indexLast] using hcg) + unfold HierarchySegmentColors + dsimp only + have hend : K.stage (Fin.last K.dividerCount).succ = U := by + convert K.terminalStage using 1 + congr 1 + rw [hend, starEq, indexLast] + exact hh + +private theorem helper_uniqueRefresh_3678.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (b : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT b) (hn : K.dividerCount = H.dividerCount), + let index : (j : Fin (K.dividerCount + (1 : ℕ))) → Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + omega) + j; + let gamma : (j : Fin (K.dividerCount + (1 : ℕ))) → (eta : Fin k) → Finset (Fin k) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ C.good.gamma (index j) eta; + ∀ + (_ : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = H.stage (index j).castSucc) + (_ : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H (index j)) + (_ : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H (index j)) + (i : Fin K.dividerCount), + ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + (gamma i.succ eta ⊆ + (TreeSequenceVertexSet (K.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, + theta ≠ eta → gamma i.succ theta = gamma i.castSucc theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H R corrStar baseStar HStar U corr b K hn + index gamma stageEq starEq storedEq i + let io : Fin H.dividerCount := ⟨i.val, by have := i.isLt; omega⟩ + have hnext : io.succ = index i.succ := Fin.ext rfl + have hprev : io.castSucc = index i.castSucc := Fin.ext rfl + obtain ⟨eta, heta, hunique⟩ := C.good.uniqueRefresh io + refine ⟨eta, ?_, ?_⟩ + · refine ⟨?_, ?_, ?_⟩ + · rw [storedEq i.succ, ← hnext] + exact heta.1 + · rw [stageEq i.succ, starEq i.castSucc] + have hh := heta.2.1 + rw [hnext, hprev] at hh + exact hh + · intro theta htheta hne + have hh := heta.2.2 theta (by simpa [storedEq, hnext] using htheta) hne + simpa [gamma, hnext, hprev] using hh + · intro theta htheta + apply hunique theta + refine ⟨?_, ?_, ?_⟩ + · simpa [storedEq, hnext] using htheta.1 + · have hh := htheta.2.1 + rw [stageEq i.succ, starEq i.castSucc] at hh + rw [hnext, hprev] + exact hh + · intro z hz hne + have hh := htheta.2.2 z (by simpa [storedEq, hnext] using hz) hne + simpa [gamma, hnext, hprev] using hh + +private theorem helper_parallelBase_3706.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ + (_ : + ∀ (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (b : HierarchyBase corr.replacementETT phi) (_ : b.core = base.core) + (_ : b.closure = base.closure) (K : TashkinovHierarchy corr.replacementETT b) + (hn : K.dividerCount = H.dividerCount), + let index : (j : Fin (K.dividerCount + (1 : ℕ))) → Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + omega) + j; + let gamma : (j : Fin (K.dividerCount + (1 : ℕ))) → (eta : Fin k) → Finset (Fin k) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ C.good.gamma (index j) eta; + ∀ + (_ : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H (index j)) + (_ : + index (0 : Fin (K.dividerCount + (1 : ℕ))) = (0 : Fin (H.dividerCount + (1 : ℕ)))), + let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := + Fin.last corr.replacementETT.rounds; + let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; + corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G phi b.core + ((HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (gamma (0 : Fin (K.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors phi Tn ∩ TreeMissingColors phi b.closure : Finset (Fin k)) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (gamma (0 : Fin (K.dividerCount + (1 : ℕ))))).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H terminalData U corr b hc hcl K hn index gamma + storedEq indexZero + dsimp only + intro hpe + have hpeOld := (terminalData U corr).2.1 ▸ hpe + have hold := C.good.parallelBase hpeOld + have hz : (HierarchyStoredColorsAt K 0).biUnion (gamma 0) = + (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0) := by + rw [storedEq 0, indexZero] + simp only [gamma, indexZero] + rw [hc, hcl, hz, (terminalData U corr).1] + exact hold + +private theorem helper_makeGood_3502.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + TreeSequenceInitialSegment B T → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + HStar.dividerCount = H.dividerCount → + (∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + (∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (b : HierarchyBase corr.replacementETT phi), + b.core = base.core → + ∀ (K : TashkinovHierarchy corr.replacementETT b) + (hn : K.dividerCount = H.dividerCount), + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = + H.stage (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hn) j).castSucc) → + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + let jo : Fin (H.dividerCount + (1 : ℕ)) := + Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hn) j; + HierarchyStarredStage K j = HierarchyStarredStage H jo ∧ + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors K j = HierarchyStageMissingColors H jo) → + (∀ (i : Fin H.dividerCount), (H.stage i.succ.castSucc).length ≤ B.length) → + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (b : HierarchyBase corr.replacementETT phi), + b.core = base.core → + b.closure = base.closure → + ∀ (K : TashkinovHierarchy corr.replacementETT b) (hn : K.dividerCount = H.dividerCount), + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = + H.stage (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hn) j).castSucc) → + TreeSequenceInitialSegment B U → + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k))) → + ∃ (good : GoodHierarchy K), + ∀ (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k), + good.gamma j eta = + C.good.gamma (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hn) j) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hBT R corrMinus baseMinus HMinus + corrStar baseStar HStar countStar terminalData hierarchyData nextBound U corr b hc hcl K hn + hs hBU hav + let index := fun j : Fin (K.dividerCount + 1) => + Fin.cast (congrArg (fun d => d + 1) hn) j + let gamma := fun j eta => C.good.gamma (index j) eta + have info := hierarchyData U corr b hc K hn hs + have stageEq (j : Fin (K.dividerCount + 1)) : + K.stage j.castSucc = H.stage (index j).castSucc := hs j + have starEq (j : Fin (K.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage H (index j) := (info j).1 + have storedEq (j : Fin (K.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H (index j) := (info j).2.1 + have missingEq (j : Fin (K.dividerCount + 1)) : + HierarchyStageMissingColors K j = HierarchyStageMissingColors H (index j) := (info j).2.2 + have indexZero : index 0 = 0 := Fin.ext rfl + have indexLast : index (Fin.last K.dividerCount) = q := Fin.ext (by simp [index, q]) + have segmentEq (i : Fin K.dividerCount) (eta : Fin k) : + HierarchySegmentColors K i.castSucc eta = + HierarchySegmentColors H (index i.castSucc) eta := by + apply helper_segmentEq_3631 <;> assumption + let good : GoodHierarchy K := by + exact { + gamma := gamma + twoColors := by + intro j eta heta + exact C.good.twoColors (index j) eta ((storedEq j) ▸ heta) + avoidance := by + apply helper_avoidance_3653 <;> assumption + disjointPairs := by + intro j eta theta heta htheta hne + exact C.good.disjointPairs (index j) eta theta + ((storedEq j) ▸ heta) ((storedEq j) ▸ htheta) hne + uniqueRefresh := by + apply helper_uniqueRefresh_3678 <;> assumption + parallelBase := by + apply helper_parallelBase_3706 <;> assumption + minusClosed := by + intro i + let io : Fin H.dividerCount := ⟨i.val, by have := i.isLt; omega⟩ + have hnext : io.succ = index i.succ := Fin.ext rfl + have hprev : io.castSucc = index i.castSucc := Fin.ext rfl + rw [stageEq i.succ, storedEq i.succ] + have hh := C.good.minusClosed io + rw [hnext, hprev] at hh + exact hh } + exact ⟨good, by intro j eta; rfl⟩ + +private theorem helper_continuation_227.{u_1, u_2} : + helperContinuation227Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hnonexceptional H q A B P transSegment + stageSegment starredAt hAT htail hBL hPL hBT hPT restrictSegment hAB hBP hPE vertexMem + firstLe firstMissing firstBefore firstLower alphaNotB alphaFirst + obtain ⟨R, hroute, hminusRoute, hstarRoute, corrMinus, mpMinus, + baseMinus, coreMinus, closureMinus, supportMinus, HMinus, countMinus, + stagesMinus, positionsMinus, corrStar, mpStar, baseStar, coreStar, + closureStar, supportStar, HStar, countStar, stagesStar, positionsStar⟩ := + HierarchySituationTwoReorderedTreesCertified G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData + obtain ⟨minusLength, hBM, minusEdge⟩ := R.minusFinal + obtain ⟨starLength, hMS, starEdge⟩ := R.starFinal + change R.minus.length = B.length + 1 at minusLength + change TreeSequenceInitialSegment B R.minus at hBM + change HMinus.dividerCount = H.dividerCount at countMinus + change HStar.dividerCount = H.dividerCount at countStar + change ∀ j : Fin (HMinus.dividerCount + 1), HMinus.stage j.castSucc = + H.stage (Fin.cast (congrArg (fun d => d + 1) countMinus) j).castSucc at stagesMinus + change ∀ j : Fin (HStar.dividerCount + 1), HStar.stage j.castSucc = + H.stage (Fin.cast (congrArg (fun d => d + 1) countStar) j).castSucc at stagesStar + have hBS := transSegment hBM hMS + have hML : R.minus.length + 1 = T.length := by omega + have hSL : R.star.length = T.length := by omega + have terminalData (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) : + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + exact helper_terminalData_137 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@U) (@corr) + have dataMinus := terminalData R.minus corrMinus + have dataStar := terminalData R.star corrStar + have hierarchyData (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (b : HierarchyBase corr.replacementETT phi) + (hc : b.core = base.core) + (K : TashkinovHierarchy corr.replacementETT b) + (hn : K.dividerCount = H.dividerCount) + (hs : ∀ j : Fin (K.dividerCount + 1), K.stage j.castSucc = + H.stage (Fin.cast (congrArg (fun d => d + 1) hn) j).castSucc) : + ∀ j : Fin (K.dividerCount + 1), + let jo := Fin.cast (congrArg (fun d => d + 1) hn) j + HierarchyStarredStage K j = HierarchyStarredStage H jo ∧ + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors K j = HierarchyStageMissingColors H jo := by + intro j + let index := fun j : Fin (K.dividerCount + 1) => + Fin.cast (congrArg (fun d => d + 1) hn) j + have hz : index 0 = 0 := Fin.ext rfl + have hstar : HierarchyStarredStage K j = HierarchyStarredStage H (index j) := by + exact helper_hstar_188 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@starredAt) (@U) (@corr) (@b) (@hc) (@K) (@hn) (@hs) (@j) (@hz) + refine ⟨hstar, ?_, ?_⟩ + · unfold HierarchyStoredColorsAt + dsimp only + rw [(terminalData U corr).2.2, hstar] + · exact helper_branch_199 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) + (@countStar) (@terminalData) (@U) (@corr) (@b) (@K) (@hn) (@hs) (@j) (@hz) (@hstar) + have infoMinus := hierarchyData R.minus corrMinus baseMinus coreMinus HMinus + countMinus stagesMinus + have infoStar := hierarchyData R.star corrStar baseStar coreStar HStar countStar stagesStar + have firstMissingBelow (X : TreeSequence G e0) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition phi X c).val < X.length) : + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by + exact helper_firstMissingBelow_215 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) + (@X) (@c) (@hlt) + have oldAvoid (eta c : Fin k) (hs : eta ∈ HierarchyStoredColorsAt H q) + (hc : c ∈ C.good.gamma q eta) : + c ∉ Finset.univ.filter (fun c => ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < min (HierarchyFirstMissingPosition phi T eta).val T.length ∧ + phi (T.edge r) = some c) := by + exact helper_oldAvoid_230 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@eta) + (@c) (@hs) (@hc) + have thetaCutoff (eta : Fin k) (hs : eta ∈ HierarchyStoredColorsAt H q) + (hc : D.theta ∈ C.good.gamma q eta) : + (HierarchyFirstMissingPosition phi T eta).val ≤ B.length := by + exact helper_thetaCutoff_242 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@hnonexceptional) (@htail) (@hBL) (@hPL) (@R) (@corrMinus) (@baseMinus) (@HMinus) + (@corrStar) (@baseStar) (@HStar) (@minusLength) (@firstMissingBelow) (@oldAvoid) (@eta) + (@hs) (@hc) + have terminalAvoid (U : TreeSequence G e0) + (hBU : TreeSequenceInitialSegment B U) + (hedges : ∀ r : Fin U.length, + (∃ t : Fin T.length, t.val = r.val ∧ r.val < B.length ∧ U.edge r = T.edge t) ∨ + (r.val = B.length ∧ U.edge r = T.edge D.lastEdgeIndex) ∨ + (r.val = B.length + 1 ∧ U.edge r = T.edge R.penultimateEdgeIndex)) : + ∀ eta c, eta ∈ HierarchyStoredColorsAt H q → c ∈ C.good.gamma q eta → + c ∉ Finset.univ.filter (fun c => ∃ r : Fin U.length, + A.length ≤ r.val ∧ r.val < min (HierarchyFirstMissingPosition phi U eta).val U.length ∧ + phi (U.edge r) = some c) := by + exact helper_terminalAvoid_268 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@htail) (@hBL) (@hPL) (@hBT) (@firstLe) (@firstBefore) (@firstLower) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@minusLength) + (@firstMissingBelow) (@oldAvoid) (@thetaCutoff) (@U) (@hBU) (@hedges) + have edgesMinus (r : Fin R.minus.length) : + (∃ t : Fin T.length, t.val = r.val ∧ r.val < B.length ∧ R.minus.edge r = T.edge t) ∨ + (r.val = B.length ∧ R.minus.edge r = T.edge D.lastEdgeIndex) ∨ + (r.val = B.length + 1 ∧ R.minus.edge r = T.edge R.penultimateEdgeIndex) := by + by_cases hr : r.val < B.length + · let i : Fin B.length := ⟨r.val, hr⟩ + have he : Fin.castLE hBM.1 i = r := Fin.ext rfl + refine Or.inl ⟨Fin.castLE hBT.1 i, rfl, hr, ?_⟩ + rw [← he, hBM.2.2 i, hBT.2.2 i] + · have he : r = Fin.cast minusLength.symm (Fin.last B.length) := Fin.ext (by simp; omega) + exact Or.inr (Or.inl ⟨by omega, by rw [he]; exact minusEdge⟩) + have edgesStar (r : Fin R.star.length) : + (∃ t : Fin T.length, t.val = r.val ∧ r.val < B.length ∧ R.star.edge r = T.edge t) ∨ + (r.val = B.length ∧ R.star.edge r = T.edge D.lastEdgeIndex) ∨ + (r.val = B.length + 1 ∧ R.star.edge r = T.edge R.penultimateEdgeIndex) := by + exact helper_edgesStar_335 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@hBL) (@hPL) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) + (@HStar) (@starLength) (@hMS) (@starEdge) (@minusLength) (@edgesMinus) (@r) + have avoidMinus := terminalAvoid R.minus hBM edgesMinus + have avoidStar := terminalAvoid R.star hBS edgesStar + have nextBound (i : Fin H.dividerCount) : + (H.stage i.succ.castSucc).length ≤ B.length := by + exact helper_nextBound_348 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@stageSegment) (@starredAt) (@hAB) (@R) (@corrMinus) (@baseMinus) (@HMinus) + (@corrStar) (@baseStar) (@HStar) (@countStar) (@i) + have makeGood (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (b : HierarchyBase corr.replacementETT phi) + (hc : b.core = base.core) (hcl : b.closure = base.closure) + (K : TashkinovHierarchy corr.replacementETT b) + (hn : K.dividerCount = H.dividerCount) + (hs : ∀ j : Fin (K.dividerCount + 1), K.stage j.castSucc = + H.stage (Fin.cast (congrArg (fun d => d + 1) hn) j).castSucc) + (hBU : TreeSequenceInitialSegment B U) + (hav : ∀ eta c, eta ∈ HierarchyStoredColorsAt H q → c ∈ C.good.gamma q eta → + c ∉ Finset.univ.filter (fun c => ∃ r : Fin U.length, + A.length ≤ r.val ∧ r.val < min (HierarchyFirstMissingPosition phi U eta).val U.length ∧ + phi (U.edge r) = some c)) : + ∃ good : GoodHierarchy K, ∀ j eta, + good.gamma j eta = C.good.gamma + (Fin.cast (congrArg (fun d => d + 1) hn) j) eta := by + exact helper_makeGood_3502 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) + (@countStar) (@terminalData) (@hierarchyData) (@nextBound) (@U) (@corr) (@b) (@hc) (@hcl) + (@K) (@hn) (@hs) (@hBU) (@hav) + exact @helper_continuation_3038 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnonexceptional) (@transSegment) (@hAT) (@htail) (@hBL) (@hPL) (@hBT) (@hPT) + (@restrictSegment) (@hAB) (@hBP) (@hPE) (@vertexMem) (@firstLe) (@firstMissing) + (@firstBefore) (@firstLower) (@alphaNotB) (@alphaFirst) (@R) (@corrMinus) (@mpMinus) + (@baseMinus) (@coreMinus) (@closureMinus) (@HMinus) (@corrStar) (@mpStar) (@baseStar) + (@coreStar) (@closureStar) (@HStar) (@starLength) (@hMS) (@minusLength) (@hBM) + (@countMinus) (@countStar) (@stagesMinus) (@stagesStar) (@hBS) (@hSL) (@dataStar) + (@infoMinus) (@infoStar) (@oldAvoid) (@edgesStar) (@avoidMinus) (@avoidStar) (@makeGood) +theorem HierarchySituationTwoSubcaseOneOneNonexceptional {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData + G k e0 input T phi ett base C ctx) + (hnonexceptional : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + D.theta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∨ + ∃ eta, eta ∈ HierarchyStoredColorsAt H q ∧ + D.theta ∈ C.good.gamma q eta ∧ + eta ∉ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + False := by + classical + let H := C.hierarchy + let q := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2) + let P := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + have transSegment {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + refine ⟨le_trans hXY.1 hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + have stageSegment : ∀ a d : ℕ, ∀ hb : a + d ≤ H.dividerCount + 1, + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + intro a d + induction d with + | zero => intro hb; exact ⟨le_rfl, by intro i; rfl, by intro i; rfl⟩ + | succ d ih => + intro hb + have hp := ih (by omega) + have hn := H.nested ⟨a + d, by omega⟩ + exact transSegment hp (by simpa [Nat.add_assoc] using hn) + have starredAt (j : Fin (H.dividerCount + 1)) (hj : j.val ≠ 0) : + HierarchyStarredStage H j = H.stage j.castSucc := by + obtain hz | ⟨i, rfl⟩ := Fin.eq_zero_or_eq_succ j + · exact False.elim (hj (congrArg Fin.val hz)) + · rfl + have hAT : TreeSequenceInitialSegment A T := by + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hs : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp [hz]) + simpa [A, hq, HierarchyStarredStage, hs, H.terminalStage] using H.coreInsideFirst + · have ha : A = H.stage q.castSucc := starredAt q (by simpa [q] using hz) + rw [ha] + have hs : H.stage q.succ = T := by + convert H.terminalStage using 1 + congr 1 + simpa only [hs] using H.nested q + have htail : 2 ≤ T.length - A.length := D.tailAtLeastTwo + have hBL : B.length + 2 = T.length := by + change min (A.length + (T.length - A.length - 2)) T.length + 2 = T.length + omega + have hPL : P.length + 1 = T.length := by + change min (A.length + (T.length - A.length - 1)) T.length + 1 = T.length + omega + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, by intro i; rfl, by intro i; rfl⟩ + have hPT : TreeSequenceInitialSegment P T := + ⟨Nat.min_le_right _ _, by intro i; rfl, by intro i; rfl⟩ + have restrictSegment {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + have hAB : TreeSequenceInitialSegment A B := restrictSegment hAT hBT (by omega) + have hBP : TreeSequenceInitialSegment B P := restrictSegment hBT hPT (by omega) + have hPE : ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have vertexMem (X : TreeSequence G e0) (i : Fin (X.length + 1)) : + X.vertex i ∈ TreeSequenceVertexSet X := by + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, Finset.mem_univ _, rfl⟩ + have firstLe (X : TreeSequence G e0) (c : Fin k) + (i : Fin (X.length + 1)) (hi : c ∈ MissingColors G phi (X.vertex i)) : + (HierarchyFirstMissingPosition phi X c).val ≤ i.val := by + unfold HierarchyFirstMissingPosition + dsimp only + have hm : i ∈ Finset.univ.filter + (fun j => c ∈ MissingColors G phi (X.vertex j)) := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ + rw [dite_eq_left ⟨i, hm⟩] + exact Finset.min'_le _ _ hm + have firstMissing (X : TreeSequence G e0) (c : Fin k) + (hc : c ∈ TreeMissingColors phi X) : + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + unfold HierarchyFirstMissingPosition + dsimp only + have hm : i ∈ Finset.univ.filter + (fun j => c ∈ MissingColors G phi (X.vertex j)) := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hcv⟩ + rw [dite_eq_left ⟨i, hm⟩] + exact (Finset.mem_filter.mp (Finset.min'_mem _ ⟨i, hm⟩)).2 + have firstBefore (X : TreeSequence G e0) (c : Fin k) + (i : Fin (X.length + 1)) + (hi : i.val < (HierarchyFirstMissingPosition phi X c).val) : + c ∉ MissingColors G phi (X.vertex i) := by + intro hm + have := firstLe X c i hm + omega + have firstLower (X : TreeSequence G e0) (c : Fin k) (t : ℕ) + (ht : t ≤ X.length) + (hn : ∀ i : Fin (X.length + 1), i.val < t → + c ∉ MissingColors G phi (X.vertex i)) : + t ≤ (HierarchyFirstMissingPosition phi X c).val := by + by_contra hlt + have hp : (HierarchyFirstMissingPosition phi X c).val < t := by omega + have hm : c ∈ TreeMissingColors phi X := by + by_contra hm + have he : HierarchyFirstMissingPosition phi X c = Fin.last X.length := by + unfold HierarchyFirstMissingPosition + dsimp only + rw [dite_eq_right] + rintro ⟨i, hi⟩ + exact hm (Finset.mem_biUnion.mpr + ⟨X.vertex i, vertexMem X i, (Finset.mem_filter.mp hi).2⟩) + have := congrArg Fin.val he + simp only [Fin.val_last] at this + omega + exact hn _ hp (firstMissing X c hm) + have alphaNotB : D.alpha ∉ TreeMissingColors phi B := by + intro hm + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + have hne : B.vertex i ≠ T.vertex D.penultimateVertexIndex := by + intro he + have hh := T.vertex_injective ((hBT.2.1 i).trans he) + have hv := congrArg Fin.val hh + have hi := i.isLt + have hp := D.penultimateVertexPosition + simp only [Fin.val_castLE] at hv + omega + have hp : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet P := by + have he : Fin.castLE (Nat.succ_le_succ hPT.1) (Fin.last P.length) = + D.penultimateVertexIndex := Fin.ext + (by simpa using hPL.trans D.penultimateVertexPosition.symm) + rw [← he, hPT.2.1] + exact vertexMem P _ + exact Finset.disjoint_left.mp + (hPE (TreeSequenceInitialSegmentVertexSetSubset hBP (vertexMem B i)) hp hne) + hcv D.alphaMissingPenultimate + have alphaFirst : HierarchyFirstMissingPosition phi T D.alpha = + D.penultimateVertexIndex := by + apply Fin.ext + have hu := firstLe T D.alpha D.penultimateVertexIndex D.alphaMissingPenultimate + have hl := firstLower T D.alpha (B.length + 1) (by omega) (by + intro i hi hm + let j : Fin (B.length + 1) := ⟨i.val, hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hBT.1) j = i := Fin.ext rfl + apply alphaNotB + refine Finset.mem_biUnion.mpr ⟨B.vertex j, vertexMem B j, ?_⟩ + simpa [← hBT.2.1 j, he] using hm) + have hp := D.penultimateVertexPosition + omega + exact @helper_continuation_227 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnonexceptional) (@transSegment) (@stageSegment) (@starredAt) (@hAT) (@htail) (@hBL) + (@hPL) (@hBT) (@hPT) (@restrictSegment) (@hAB) (@hBP) (@hPE) (@vertexMem) (@firstLe) + (@firstMissing) (@firstBefore) (@firstLower) (@alphaNotB) (@alphaFirst) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean new file mode 100644 index 0000000000..72ca360344 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean @@ -0,0 +1,4381 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.NineN +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOneNonexceptional +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import Mathlib.Data.Finset.Option + +/-! +# Hierarchy Situation Two Subcase One One Stored Exception + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable abbrev helperSelfCorr425.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + ( + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j)) → + ( + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (ett.series.data.coloring j) e0) → + CorrespondingExtendedTashkinovTree G k e0 ett phi T := by + classical + intro V E _ _ _ G k e0 input T phi ett seriesProper seriesOne + exact { + replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := seriesProper + replacementOneUncolored := seriesOne + replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } + +private noncomputable abbrev helperP0462.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j)) → + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (ett.series.data.coloring j) e0) → + let _ : + CorrespondingExtendedTashkinovTree G k e0 ett phi T := + helperSelfCorr425 G k e0 input T phi ett seriesProper + seriesOne; + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx seriesProper seriesOne selfCorr + exact { + coloring := phi + corresponding := selfCorr + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + minimumContext := ctx } + +private noncomputable abbrev helperD41837.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett + base C ctx) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := + HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (2 : ℕ) ≤ ell → + T.vertex D.penultimateVertexIndex ∈ + TreeSequenceVertexSet X → + (beta : Fin k) → + (P3 : + HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx) → + P3.coloring (T.edge D.lastEdgeIndex) = some beta → + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P3.coloring v = + MissingColors G phi v) → + beta ∉ + MissingColors G P3.coloring + (T.vertex D.penultimateVertexIndex) → + (P4 : + HierarchyReplacementPresentation G k e0 + input T phi ett base C ctx) → + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P4.coloring v = + MissingColors G P3.coloring v) → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + P4.coloring (T.edge t) = + P3.coloring (T.edge t)) → + HierarchyStarredStage + P4.counterexample.hierarchy + (Fin.last + P4.counterexample.hierarchy.dividerCount) = + A ∧ + HierarchyFullTailLength + P4.counterexample = + ell ∧ + HierarchyFullTailPrefix + P4.counterexample + (ell - (1 : ℕ)) = + X ∧ + HierarchyPathNumber + P4.counterexample.hierarchy = + HierarchyPathNumber H → + D.alpha ∈ + MissingColors G P4.coloring + (T.vertex + D.terminalVertexIndex) → + A.length ≤ (↑D.lastEdgeIndex : ℕ) → + D.alpha ∈ + HierarchyStoredColorsAt + P4.counterexample.hierarchy + (Fin.last + P4.counterexample.hierarchy.dividerCount) ∧ + P4.counterexample.good.gamma + (Fin.last + P4.counterexample.hierarchy.dividerCount) + D.alpha = + C.good.gamma q D.alpha → + HierarchySituationTwoCaseOneData + G k e0 + P4.corresponding.replacementInput + T P4.coloring + P4.corresponding.replacementETT + P4.replacementBase + P4.counterexample + P4.minimumContext := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell X htail hyp beta P3 lastBeta3 + prefix3' betaPresent3 P4 prefix4 edges4 geometry4 alphaTerminal4 hlastTail hd4 + exact { + tailAtLeastTwo := by rw [geometry4.2.1]; exact htail + pathNumberFull := geometry4.2.2.2.trans (D.pathNumberFull.trans geometry4.2.1.symm) + lastEdgeIndex := D.lastEdgeIndex + penultimateVertexIndex := D.penultimateVertexIndex + terminalVertexIndex := D.terminalVertexIndex + lastEdgePosition := D.lastEdgePosition + penultimateVertexPosition := D.penultimateVertexPosition + terminalVertexPosition := D.terminalVertexPosition + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate + theta := beta + thetaOnLastEdge := (edges4 _ hlastTail).trans lastBeta3 + thetaPresentPenultimate := by rw [prefix4 _ hyp]; exact betaPresent3 + alpha := D.alpha + gammaOne := D.gammaOne + gammaTwo := D.gammaTwo + alphaMissingPenultimate := by + rw [prefix4 _ hyp, prefix3' _ hyp] + exact D.alphaMissingPenultimate + alphaMissingTerminal := alphaTerminal4 + alphaStored := hd4.1 + gammaPair := hd4.2.trans D.gammaPair + gammaDistinct := D.gammaDistinct } + +private abbrev helperContinuation3592Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), D.theta ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → eta ∈ MissingColors G phi (T.vertex + D.penultimateVertexIndex) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b), TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ TreeSequenceInitialSegment + (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last + H.dividerCount))) → ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → + ∀ (col : PartialEdgeColoring E k), TreeMissingColors col X ⊆ TreeMissingColors col Y) → ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → ell = T.length - A.length → (2 : ℕ) ≤ ell → B.length = + T.length - (2 : ℕ) → X.length = T.length - (1 : ℕ) → (↑D.penultimateVertexIndex : ℕ) = + X.length → (↑D.lastEdgeIndex : ℕ) = X.length → X.length + (1 : ℕ) = T.length → X.length = + A.length + (ell - (1 : ℕ)) → (1 : ℕ) ≤ ell - (1 : ℕ) → ell - (1 : ℕ) < ell → + TreeSequenceInitialSegment X T → TreeSequenceInitialSegment A X → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet X) → T.vertex + D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + ∀ gamma ∈ C.good.gamma q D.alpha, gamma ∈ HierarchyStageMissingColors C.hierarchy q ∧ gamma ∉ + HierarchySegmentColors C.hierarchy q D.alpha → gamma ∈ TreeMissingColors phi A → + ∀ gammaVertex ∈ TreeSequenceVertexSet A, gamma ∈ MissingColors G phi gammaVertex → gamma ≠ + D.alpha → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some gamma) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A ∧ HierarchyFullTailLength P.counterexample = + ell ∧ HierarchyFullTailPrefix P.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber + P.counterexample.hierarchy = HierarchyPathNumber H) → + ∀ (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := helperP0462 G k + e0 input T phi ett base C ctx seriesProper seriesOne; ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ a ∈ HierarchyStageMissingColors P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), (0 : ℕ) < + P.counterexample.hierarchy.dividerCount ∧ a ∈ TreeMissingColors P.coloring + (P.counterexample.hierarchy.stage (⟨P.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (P.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc)) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ + b → a ∈ TreeMissingColors P.coloring A → a ∈ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → b ∈ + TreeMissingColors P.coloring X → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + a) → a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) → + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex)); TwoColorPathComponent G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex)) ∧ Disjoint (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex))) (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex + (HierarchyFirstMissingPosition P.coloring T a)))) ∧ ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G mu v = MissingColors G P.coloring v) ∧ ( + ∀ c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), HierarchyFirstMissingPosition mu T c = + HierarchyFirstMissingPosition P.coloring T c) ∧ ¬ColoredVertexSetElementary G mu + (TreeSequenceVertexSet T)) → False + +private abbrev helperContinuation3568Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), D.theta ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → eta ∈ MissingColors G phi (T.vertex + D.penultimateVertexIndex) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b), TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ TreeSequenceInitialSegment + (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last + H.dividerCount))) → ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → ell = T.length - A.length → (2 : ℕ) ≤ ell → B.length = + T.length - (2 : ℕ) → X.length = T.length - (1 : ℕ) → (↑D.penultimateVertexIndex : ℕ) = + X.length → (↑D.lastEdgeIndex : ℕ) = X.length → X.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment X T → TreeSequenceInitialSegment A X → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet X) → T.vertex + D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + ∀ gamma ∈ C.good.gamma q D.alpha, + ∀ gammaVertex ∈ TreeSequenceVertexSet A, gamma ∈ MissingColors G phi gammaVertex → gamma ≠ + D.alpha → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some gamma) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A ∧ HierarchyFullTailLength P.counterexample = + ell ∧ HierarchyFullTailPrefix P.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber + P.counterexample.hierarchy = HierarchyPathNumber H) → + ∀ (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := helperP0462 G k + e0 input T phi ett base C ctx seriesProper seriesOne; ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ a ∈ HierarchyStageMissingColors P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), (0 : ℕ) < + P.counterexample.hierarchy.dividerCount ∧ a ∈ TreeMissingColors P.coloring + (P.counterexample.hierarchy.stage (⟨P.counterexample.hierarchy.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬P.counterexample.hierarchy.dividerCount < P.counterexample.hierarchy.dividerCount + (2 : + ℕ)) ↦ + by omega + ⟩ : Fin (P.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc)) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ + b → a ∈ TreeMissingColors P.coloring A → a ∈ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → b ∈ + TreeMissingColors P.coloring X → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + a) → a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) → + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex)); TwoColorPathComponent G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex)) ∧ Disjoint (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex))) (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex + (HierarchyFirstMissingPosition P.coloring T a)))) ∧ ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G mu v = MissingColors G P.coloring v) ∧ ( + ∀ c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), HierarchyFirstMissingPosition mu T c = + HierarchyFirstMissingPosition P.coloring T c) ∧ ¬ColoredVertexSetElementary G mu + (TreeSequenceVertexSet T)) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (mu : + PartialEdgeColoring E k), ¬ColoredVertexSetElementary G mu (TreeSequenceVertexSet T) → ( + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT mu T), + MaximumProperty corr.replacementETT ∧ + ∃ (b : HierarchyBase corr.replacementETT mu) (K : TashkinovHierarchy corr.replacementETT b) (g + : GoodHierarchy K), SameGoodHierarchy P.counterexample.good g) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P'.coloring = mu) + → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ + b → a ∈ TreeMissingColors P.coloring A → a ∈ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some a) → b ∈ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → a ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G P.coloring (T.vertex + D.terminalVertexIndex) → + ∀ (lastColor : Fin k), P.coloring (T.edge D.lastEdgeIndex) = some lastColor → lastColor ∉ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P'.coloring = + TwoColorComponentSwap G P.coloring a b (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G P'.coloring v = MissingColors G P.coloring v) ∧ + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P'.coloring (T.edge t) = P.coloring (T.edge t)) → + ∀ (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P1.coloring = + TwoColorComponentSwap G P0.coloring gamma D.alpha (Sum.inl (T.vertex + D.terminalVertexIndex)) → ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G P1.coloring v = MissingColors G P0.coloring v) + → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P1.coloring (T.edge t) = P0.coloring (T.edge t)) → + let rho : PartialEdgeColoring E k := P1.coloring; + let J1 : ExtendedTashkinovTree G k e0 P1.corresponding.replacementInput T P1.coloring := + P1.corresponding.replacementETT; + let H1 : TashkinovHierarchy P1.corresponding.replacementETT P1.replacementBase := + P1.counterexample.hierarchy; + let q1 : Fin (H1.dividerCount + (1 : ℕ)) := Fin.last H1.dividerCount; HierarchyStarredStage + P1.counterexample.hierarchy (Fin.last P1.counterexample.hierarchy.dividerCount) = A ∧ + HierarchyFullTailLength P1.counterexample = ell ∧ HierarchyFullTailPrefix + P1.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber P1.counterexample.hierarchy = + HierarchyPathNumber H → + let Gamma : Finset (Fin k) := (HierarchyStoredColorsAt H1 q1).biUnion + (P1.counterexample.good.gamma q1); + ∀ beta ∉ Gamma, + ∀ betaVertex ∈ TreeSequenceVertexSet B, beta ∈ MissingColors G rho betaVertex → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → False + +private abbrev helperContinuation4132Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), D.theta ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → eta ∈ MissingColors G phi (T.vertex + D.penultimateVertexIndex) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b), TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ TreeSequenceInitialSegment + (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last + H.dividerCount))) → ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); ell = T.length - + A.length → (2 : ℕ) ≤ ell → B.length = T.length - (2 : ℕ) → X.length = T.length - (1 : ℕ) → + (↑D.penultimateVertexIndex : ℕ) = X.length → (↑D.lastEdgeIndex : ℕ) = X.length → X.length + + (1 : ℕ) = T.length → TreeSequenceInitialSegment X T → TreeSequenceInitialSegment A X → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet X) → T.vertex + D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + ∀ (gamma : Fin k), ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A ∧ HierarchyFullTailLength P.counterexample = + ell ∧ HierarchyFullTailPrefix P.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber + P.counterexample.hierarchy = HierarchyPathNumber H) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (mu : + PartialEdgeColoring E k), ¬ColoredVertexSetElementary G mu (TreeSequenceVertexSet T) → ( + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT mu T), + MaximumProperty corr.replacementETT ∧ + ∃ (b : HierarchyBase corr.replacementETT mu) (K : TashkinovHierarchy corr.replacementETT b) (g + : GoodHierarchy K), SameGoodHierarchy P.counterexample.good g) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P'.coloring = mu) + → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ + b → a ∈ TreeMissingColors P.coloring A → a ∈ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some a) → b ∈ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → a ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G P.coloring (T.vertex + D.terminalVertexIndex) → + ∀ (lastColor : Fin k), P.coloring (T.edge D.lastEdgeIndex) = some lastColor → lastColor ∉ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P'.coloring = + TwoColorComponentSwap G P.coloring a b (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G P'.coloring v = MissingColors G P.coloring v) ∧ + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P'.coloring (T.edge t) = P.coloring (T.edge t)) → + ∀ (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H1 : TashkinovHierarchy P1.corresponding.replacementETT P1.replacementBase := + P1.counterexample.hierarchy; + let q1 : Fin (H1.dividerCount + (1 : ℕ)) := Fin.last H1.dividerCount; + let Gamma : Finset (Fin k) := (HierarchyStoredColorsAt H1 q1).biUnion + (P1.counterexample.good.gamma q1); + ∀ beta ∉ Gamma, ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ HierarchyStoredColorsAt H q, c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) c = C.good.gamma q c) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion (P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount)) = (HierarchyStoredColorsAt H q).biUnion + (C.good.gamma q)) → Gamma = (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); TreeSequenceInitialSegment B X → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; + let J2 : ExtendedTashkinovTree G k e0 P2.corresponding.replacementInput T P2.coloring := + P2.corresponding.replacementETT; + let H2 : TashkinovHierarchy P2.corresponding.replacementETT P2.replacementBase := + P2.counterexample.hierarchy; + let q2 : Fin (H2.dividerCount + (1 : ℕ)) := Fin.last H2.dividerCount; HierarchyStarredStage + P2.counterexample.hierarchy (Fin.last P2.counterexample.hierarchy.dividerCount) = A ∧ + HierarchyFullTailLength P2.counterexample = ell ∧ HierarchyFullTailPrefix + P2.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber P2.counterexample.hierarchy = + HierarchyPathNumber H → ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G tau v = MissingColors G phi v) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → tau (T.edge t) = phi (T.edge t)) → beta ∈ + TreeMissingColors tau B → beta ∈ MissingColors G tau (T.vertex D.terminalVertexIndex) → + D.theta ∈ TreeMissingColors tau A → D.theta ≠ beta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → tau (T.edge t) ≠ some + D.theta) → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G tau D.theta beta z; + TwoColorPathComponent G P2.coloring D.theta beta (Sum.inl (T.vertex + D.terminalVertexIndex)) → Disjoint (TwoColorComponent G P2.coloring D.theta beta (Sum.inl + (T.vertex D.terminalVertexIndex))) (TwoColorComponent G P2.coloring D.theta beta (Sum.inl + (T.vertex (HierarchyFirstMissingPosition P2.coloring T D.theta)))) → ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G (TwoColorComponentSwap G P2.coloring D.theta + beta (Sum.inl (T.vertex D.terminalVertexIndex))) v = MissingColors G P2.coloring v) → ( + ∀ c ∈ HierarchyStoredColorsAt P2.counterexample.hierarchy (Fin.last + P2.counterexample.hierarchy.dividerCount), HierarchyFirstMissingPosition + (TwoColorComponentSwap G P2.coloring D.theta beta (Sum.inl (T.vertex + D.terminalVertexIndex))) T c = HierarchyFirstMissingPosition P2.coloring T c) → + ¬ColoredVertexSetElementary G (TwoColorComponentSwap G P2.coloring D.theta beta (Sum.inl + (T.vertex D.terminalVertexIndex))) (TreeSequenceVertexSet T) → D.theta ∈ TreeMissingColors + tau X ∧ beta ∈ TreeMissingColors tau X → (0 : ℕ) < + P2.counterexample.hierarchy.dividerCount ∧ D.theta ∈ TreeMissingColors P2.coloring + (P2.counterexample.hierarchy.stage (⟨P2.counterexample.hierarchy.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬P2.counterexample.hierarchy.dividerCount < P2.counterexample.hierarchy.dividerCount + (2 + : ℕ)) ↦ + by omega + ⟩ : Fin (P2.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P2.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ D.theta ∈ TreeMissingColors + P2.coloring (P2.corresponding.replacementETT.series.data.tree (Fin.last + P2.corresponding.replacementETT.rounds).castSucc) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → mu3 (T.edge t) = tau (T.edge + t)) → ( + ∀ (t : Fin T.length), (↑t : ℕ) < X.length → mu3 (T.edge t) = tau (T.edge t)) → False + +private abbrev helperContinuation3839Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), D.theta ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → eta ∈ MissingColors G phi (T.vertex + D.penultimateVertexIndex) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b), TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ TreeSequenceInitialSegment + (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last + H.dividerCount))) → ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → ell = T.length - A.length → (2 : ℕ) ≤ ell → B.length = + T.length - (2 : ℕ) → X.length = T.length - (1 : ℕ) → (↑D.penultimateVertexIndex : ℕ) = + X.length → (↑D.lastEdgeIndex : ℕ) = X.length → X.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment X T → TreeSequenceInitialSegment A X → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet X) → T.vertex + D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + ∀ (gamma : Fin k), ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A ∧ HierarchyFullTailLength P.counterexample = + ell ∧ HierarchyFullTailPrefix P.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber + P.counterexample.hierarchy = HierarchyPathNumber H) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ a ∈ HierarchyStageMissingColors P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), (0 : ℕ) < + P.counterexample.hierarchy.dividerCount ∧ a ∈ TreeMissingColors P.coloring + (P.counterexample.hierarchy.stage (⟨P.counterexample.hierarchy.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (P.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc)) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ + b → a ∈ TreeMissingColors P.coloring A → a ∈ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → b ∈ + TreeMissingColors P.coloring X → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + a) → a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) → + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex)); TwoColorPathComponent G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex)) ∧ Disjoint (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex))) (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex + (HierarchyFirstMissingPosition P.coloring T a)))) ∧ ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G mu v = MissingColors G P.coloring v) ∧ ( + ∀ c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), HierarchyFirstMissingPosition mu T c = + HierarchyFirstMissingPosition P.coloring T c) ∧ ¬ColoredVertexSetElementary G mu + (TreeSequenceVertexSet T)) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (mu : + PartialEdgeColoring E k), ¬ColoredVertexSetElementary G mu (TreeSequenceVertexSet T) → ( + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT mu T), + MaximumProperty corr.replacementETT ∧ + ∃ (b : HierarchyBase corr.replacementETT mu) (K : TashkinovHierarchy corr.replacementETT b) (g + : GoodHierarchy K), SameGoodHierarchy P.counterexample.good g) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P'.coloring = mu) + → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ + b → a ∈ TreeMissingColors P.coloring A → a ∈ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some a) → b ∈ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → a ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G P.coloring (T.vertex + D.terminalVertexIndex) → + ∀ (lastColor : Fin k), P.coloring (T.edge D.lastEdgeIndex) = some lastColor → lastColor ∉ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P'.coloring = + TwoColorComponentSwap G P.coloring a b (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G P'.coloring v = MissingColors G P.coloring v) ∧ + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P'.coloring (T.edge t) = P.coloring (T.edge t)) → + ∀ (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := P1.coloring; + let H1 : TashkinovHierarchy P1.corresponding.replacementETT P1.replacementBase := + P1.counterexample.hierarchy; + let q1 : Fin (H1.dividerCount + (1 : ℕ)) := Fin.last H1.dividerCount; + let Gamma : Finset (Fin k) := (HierarchyStoredColorsAt H1 q1).biUnion + (P1.counterexample.good.gamma q1); + ∀ beta ∉ Gamma, + ∀ betaVertex ∈ TreeSequenceVertexSet B, beta ∈ MissingColors G rho betaVertex → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ HierarchyStoredColorsAt H q, c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) c = C.good.gamma q c) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion (P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount)) = (HierarchyStoredColorsAt H q).biUnion + (C.good.gamma q)) → Gamma = (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma beta z; + TreeSequenceInitialSegment B X → ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G (TwoColorComponentSwap G P1.coloring gamma beta + (Sum.inl (T.vertex D.terminalVertexIndex))) v = MissingColors G P1.coloring v) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → mu2 (T.edge t) = rho (T.edge t)) → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P2.coloring = mu2 + → + let tau : PartialEdgeColoring E k := P2.coloring; + let J2 : ExtendedTashkinovTree G k e0 P2.corresponding.replacementInput T P2.coloring := + P2.corresponding.replacementETT; + let H2 : TashkinovHierarchy P2.corresponding.replacementETT P2.replacementBase := + P2.counterexample.hierarchy; + let q2 : Fin (H2.dividerCount + (1 : ℕ)) := Fin.last H2.dividerCount; HierarchyStarredStage + P2.counterexample.hierarchy (Fin.last P2.counterexample.hierarchy.dividerCount) = A ∧ + HierarchyFullTailLength P2.counterexample = ell ∧ HierarchyFullTailPrefix + P2.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber P2.counterexample.hierarchy = + HierarchyPathNumber H → ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G tau v = MissingColors G phi v) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → tau (T.edge t) = phi (T.edge t)) → beta ∈ + TreeMissingColors tau B → beta ∈ MissingColors G tau (T.vertex D.terminalVertexIndex) → + False + +private abbrev helperPrepareLater5223Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) (eta : Fin k), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b), TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ TreeSequenceInitialSegment + (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last + H.dividerCount))) → ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → + ∀ (col : PartialEdgeColoring E k), TreeMissingColors col X ⊆ TreeMissingColors col Y) → ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → B.length = T.length - (2 : ℕ) → X.length = T.length - (1 + : ℕ) → (↑D.penultimateVertexIndex : ℕ) = X.length → X.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment X T → TreeSequenceInitialSegment A X → T.vertex + D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A ∧ HierarchyFullTailLength P.counterexample = + ell ∧ HierarchyFullTailPrefix P.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber + P.counterexample.hierarchy = HierarchyPathNumber H) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ a ∈ HierarchyStageMissingColors P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), (0 : ℕ) < + P.counterexample.hierarchy.dividerCount ∧ a ∈ TreeMissingColors P.coloring + (P.counterexample.hierarchy.stage (⟨P.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (P.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc)) → ( + ∀ u ∈ TreeSequenceVertexSet X, u ≠ T.vertex D.terminalVertexIndex) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ + b → a ∈ TreeMissingColors P.coloring A → a ∈ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → b ∈ + TreeMissingColors P.coloring X → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + a) → a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) → + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex)); TwoColorPathComponent G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex)) ∧ Disjoint (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex))) (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex + (HierarchyFirstMissingPosition P.coloring T a)))) ∧ ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G mu v = MissingColors G P.coloring v) ∧ ( + ∀ c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), HierarchyFirstMissingPosition mu T c = + HierarchyFirstMissingPosition P.coloring T c) ∧ ¬ColoredVertexSetElementary G mu + (TreeSequenceVertexSet T) + +private abbrev storedExceptionSwapStepStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) (_ : Fin k), ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → + ∀ (col : PartialEdgeColoring E k), TreeMissingColors col X ⊆ TreeMissingColors col Y) → ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → ell = T.length - A.length → B.length = T.length - (2 : ℕ) + → X.length = T.length - (1 : ℕ) → (↑D.penultimateVertexIndex : ℕ) = X.length → + (↑D.lastEdgeIndex : ℕ) = X.length → X.length + (1 : ℕ) = T.length → X.length = A.length + + (ell - (1 : ℕ)) → (1 : ℕ) ≤ ell - (1 : ℕ) → ell - (1 : ℕ) < ell → + TreeSequenceInitialSegment X T → TreeSequenceInitialSegment A X → T.vertex + D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A ∧ HierarchyFullTailLength P.counterexample = + ell ∧ HierarchyFullTailPrefix P.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber + P.counterexample.hierarchy = HierarchyPathNumber H) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ a ∈ HierarchyStageMissingColors P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), (0 : ℕ) < + P.counterexample.hierarchy.dividerCount ∧ a ∈ TreeMissingColors P.coloring + (P.counterexample.hierarchy.stage (⟨P.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (P.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc)) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ + b → a ∈ TreeMissingColors P.coloring A → a ∈ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → b ∈ + TreeMissingColors P.coloring X → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some + a) → a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) → + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex)); TwoColorPathComponent G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex)) ∧ Disjoint (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex + D.terminalVertexIndex))) (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex + (HierarchyFirstMissingPosition P.coloring T a)))) ∧ ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G mu v = MissingColors G P.coloring v) ∧ ( + ∀ c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), HierarchyFirstMissingPosition mu T c = + HierarchyFirstMissingPosition P.coloring T c) ∧ ¬ColoredVertexSetElementary G mu + (TreeSequenceVertexSet T)) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (mu : + PartialEdgeColoring E k), ¬ColoredVertexSetElementary G mu (TreeSequenceVertexSet T) → ( + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT mu T), + MaximumProperty corr.replacementETT ∧ + ∃ (b : HierarchyBase corr.replacementETT mu) (K : TashkinovHierarchy corr.replacementETT b) (g + : GoodHierarchy K), SameGoodHierarchy P.counterexample.good g) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P'.coloring = mu) + → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ + b → a ∈ TreeMissingColors P.coloring A → a ∈ HierarchyStageMissingColors + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some a) → b ∈ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → a ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G P.coloring (T.vertex + D.terminalVertexIndex) → + ∀ (lastColor : Fin k), P.coloring (T.edge D.lastEdgeIndex) = some lastColor → lastColor ∉ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P'.coloring = + TwoColorComponentSwap G P.coloring a b (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G P'.coloring v = MissingColors G P.coloring v) ∧ + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P'.coloring (T.edge t) = P.coloring (T.edge t) + +private theorem helper_segmentTrans_302.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y + Z → TreeSequenceInitialSegment X Z := by + classical + intro V E G e0 X Y Z hXY hYZ + refine ⟨le_trans hXY.1 hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +private theorem helper_commonPrefix_311.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y + Z → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by + classical + intro V E G e0 X Y Z hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + +private theorem helper_hierarchyGeometry_320.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b), TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ TreeSequenceInitialSegment + (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last + H.dividerCount)) := by + classical + intro V E _ _ _ _ G k e0 T segmentTrans inp col J b H + have forward : ∀ (a d : ℕ), (hbound : a + d ≤ H.dividerCount + 1) → + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + intro a d + induction d with + | zero => intro h; exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + | succ d ih => + intro h + exact segmentTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let Tn := J.series.data.tree (Fin.last J.rounds).castSucc + change TreeSequenceInitialSegment A T ∧ TreeSequenceInitialSegment Tn A + have hTnCore : TreeSequenceInitialSegment Tn b.core := by + by_cases hp : J.series.data.kind (Fin.last J.rounds) = + some TashkinovExtensionKind.PE + · exact (b.parallel hp).2.2.some.leftSegment + · rw [b.nonparallel hp] + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + by_cases hq : H.dividerCount = 0 + · have hA : A = b.core := by + simp [A, HierarchyStarredStage, Fin.last, hq] + have hlast : H.stage ⟨1, by omega⟩ = T := by + convert H.terminalStage using 1 + apply congrArg H.stage + apply Fin.ext + simp [hq] + constructor + · rw [hA] + exact Eq.mp (congrArg (fun W : TreeSequence G e0 => + TreeSequenceInitialSegment b.core W) hlast) H.coreInsideFirst + · rw [hA] + exact hTnCore + · have hpos : 0 < H.dividerCount := Nat.pos_of_ne_zero hq + have hindex : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp + omega + have hA : A = H.stage ⟨H.dividerCount, by omega⟩ := by + dsimp [A, HierarchyStarredStage] + rw [hindex] + dsimp + apply congrArg H.stage + apply Fin.ext + simp + omega + have hlast : H.stage ⟨H.dividerCount + 1, by omega⟩ = T := H.terminalStage + have hTnStage : H.stage (0 : Fin (H.dividerCount + 2)) = Tn := H.baseStage + refine ⟨?_, ?_⟩ + · simpa [hA, hlast] using forward H.dividerCount 1 (by omega) + · simpa [hA, hTnStage] using forward 0 H.dividerCount (by omega) + +private theorem helper_firstMissing_387.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (col : PartialEdgeColoring E k) (c : Fin k) + (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G col (T.vertex i) → + c ∈ MissingColors G col (T.vertex (HierarchyFirstMissingPosition col T c)) ∧ + (↑(HierarchyFirstMissingPosition col T c) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ G k e0 T col c i hc + let _ := Fintype.ofFinite V + let S := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G col (T.vertex j) + have hs : S.Nonempty := ⟨i, by simp [S, hc]⟩ + have heq : HierarchyFirstMissingPosition col T c = S.min' hs := by + simp [HierarchyFirstMissingPosition, S, hs] + rw [heq] + exact ⟨(Finset.mem_filter.mp (Finset.min'_mem S hs)).2, + Finset.min'_le S i (by simp [S, hc])⟩ + +private theorem helper_hyp_446.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); X.length = T.length - + (1 : ℕ) → (↑D.penultimateVertexIndex : ℕ) = X.length → T.vertex D.penultimateVertexIndex ∈ + TreeSequenceVertexSet X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell X hXlen hPenVal + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨Fin.last X.length, Finset.mem_univ _, ?_⟩ + change T.vertex _ = T.vertex _ + apply congrArg T.vertex + apply Fin.ext + change X.length = D.penultimateVertexIndex.val + rw [hXlen] + have hp := D.penultimateVertexPosition + omega + +private theorem helper_uniquePenultimate_456.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); X.length = T.length - + (1 : ℕ) → (↑D.penultimateVertexIndex : ℕ) = X.length → (↑D.lastEdgeIndex : ℕ) = X.length → + X.length = A.length + (ell - (1 : ℕ)) → ColoredVertexSetElementary G phi + (TreeSequenceVertexSet X) → T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + ∀ c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex), HierarchyFirstMissingPosition + phi T c = D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D firstMissing H q A ell X hXlen hPenVal + hLastVal hXexact helem hyp c hc + have hm := firstMissing phi c D.penultimateVertexIndex hc + have hv : T.vertex (HierarchyFirstMissingPosition phi T c) ∈ + TreeSequenceVertexSet X := by + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨⟨(HierarchyFirstMissingPosition phi T c).val, by + have hp := D.penultimateVertexPosition + rw [hXlen] + omega⟩, Finset.mem_univ _, ?_⟩ + rfl + by_contra hi + have hn : T.vertex (HierarchyFirstMissingPosition phi T c) ≠ + T.vertex D.penultimateVertexIndex := fun h => hi (T.vertex_injective h) + exact Finset.disjoint_left.mp (helem hv hyp hn) hm.1 hc + +private theorem helper_hgammaTail_497.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) (eta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); X.length = T.length - + (1 : ℕ) → (↑D.penultimateVertexIndex : ℕ) = X.length → (↑D.lastEdgeIndex : ℕ) = X.length → + X.length + (1 : ℕ) = T.length → X.length = A.length + (ell - (1 : ℕ)) → + HierarchyFirstMissingPosition phi T eta = D.penultimateVertexIndex → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + ∀ (gamma : Fin k), D.theta ≠ gamma → gamma ∈ HierarchyStageMissingColors C.hierarchy q ∧ gamma + ∉ HierarchySegmentColors C.hierarchy q D.alpha → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some gamma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta H q A ell X hXlen hPenVal hLastVal + hTlen hXexact hetaFirst alphaFirst gamma hthetaGamma hgammaAvoid t ht hc + by_cases hlast : t = D.lastEdgeIndex + · have htg : D.theta = gamma := + Option.some.inj (D.thetaOnLastEdge.symm.trans (hlast ▸ hc)) + exact hthetaGamma htg + · have hpos : t.val < D.penultimateVertexIndex.val := by + have hp := D.penultimateVertexPosition + have he := D.lastEdgePosition + have htlt := t.isLt + have hneq : t.val ≠ D.lastEdgeIndex.val := fun h => hlast (Fin.ext h) + omega + apply hgammaAvoid.2 + unfold HierarchySegmentColors + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + have hend : H.stage q.succ = T := H.terminalStage + let r : Fin (H.stage q.succ).length := + Fin.cast (congrArg TreeSequence.length hend.symm) t + refine ⟨r, ht, ?_, ?_⟩ + · simp only [alphaFirst] + dsimp [r] + rw [hend] + omega + · have edgeCast (U W : TreeSequence G e0) (h : U = W) + (i : Fin W.length) : + U.edge (Fin.cast (congrArg TreeSequence.length h.symm) i) = W.edge i := by + cases h + rfl + change phi ((H.stage q.succ).edge r) = some gamma + rw [edgeCast _ _ hend t] + exact hc + +private theorem helper_seriesProper_562.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (_ : Fin k) + (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j) := by + classical + intro V E _ _ _ G k e0 input T phi ett gamma j + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.1 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedProper + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => exact currentProper + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact previousProper + +private theorem helper_seriesOne_589.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (_ : Fin k) + (j : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + classical + intro V E _ _ _ G k e0 input T phi ett gamma j + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.2 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedOneUncolored + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => exact currentOneUncolored + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact previousOneUncolored + +private theorem helper_caseFor_622.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) (_ : Fin k) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ a ∈ HierarchyStageMissingColors P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), (0 : ℕ) < + P.counterexample.hierarchy.dividerCount ∧ a ∈ TreeMissingColors P.coloring + (P.counterexample.hierarchy.stage (⟨P.counterexample.hierarchy.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (P.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ + P.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta P a ha + let K := P.counterexample.hierarchy + let r := Fin.last K.dividerCount + change a ∈ HierarchyStageMissingColors K r at ha + by_cases hz : K.dividerCount = 0 + · right + refine ⟨hz, ?_⟩ + have hi : r = 0 := by apply Fin.ext; simp [r, hz] + simpa [HierarchyStageMissingColors, hi] using ha + · left + refine ⟨Nat.pos_of_ne_zero hz, ?_⟩ + have hi : r = (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := by + apply Fin.ext + simp [r] + omega + change a ∈ HierarchyStageMissingColors K r at ha + simp only [HierarchyStageMissingColors, hi, Fin.cases] at ha + convert ha using 1 + apply congrArg (TreeMissingColors P.coloring) + apply congrArg K.stage + apply Fin.ext + change K.dividerCount = K.dividerCount - 1 + 1 + omega + +private theorem helper_prefixNeTerminal_656.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); X.length + (1 : ℕ) = + T.length → + ∀ u ∈ TreeSequenceVertexSet X, u ≠ T.vertex D.terminalVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell X hTlen u hu + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hu + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + have hb := i.isLt + have ht := D.terminalVertexPosition + change i.val = D.terminalVertexIndex.val at hi + have hb' : i.val < T.length := by simpa only [hTlen] using hb + exact (Nat.ne_of_lt hb') (hi.trans ht) + +private theorem helper_hxElem_710.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let _ : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let C' : HierarchyCounterexample P.replacementBase := P.counterexample; + let col : PartialEdgeColoring E k := P.coloring; + HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - (1 : ℕ)) = X → + ColoredVertexSetElementary G col (TreeSequenceVertexSet X) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx ell X P J C' col hXeq + have he : ColoredVertexSetElementary G col + (TreeSequenceVertexSet (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1))) := + HierarchyCounterexamplePenultimateElementary G k e0 + P.corresponding.replacementInput T col J P.replacementBase C' + P.minimumContext.proper P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality P.minimumContext.largeMissingSet + intro u hu v hv huv + have hu' : u ∈ TreeSequenceVertexSet + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1)) := by + rw [hXeq] + exact hu + have hv' : v ∈ TreeSequenceVertexSet + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1)) := by + rw [hXeq] + exact hv + exact he hu' hv' huv + +private theorem helper_horder_761.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → + ∀ (hXT : TreeSequenceInitialSegment X T) (P : HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx) (a b : Fin k), + let col : PartialEdgeColoring E k := P.coloring; + ∀ (ib : Fin (X.length + (1 : ℕ))), b ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T b)) ∧ (↑(HierarchyFirstMissingPosition col T b) : ℕ) + ≤ (↑(Fin.castLE (Nat.succ_le_succ hXT.1) ib) : ℕ) → (↑(HierarchyFirstMissingPosition col T + a) : ℕ) ≤ A.length → b ∉ TreeMissingColors col A → (↑(HierarchyFirstMissingPosition col T + a) : ℕ) < (↑(HierarchyFirstMissingPosition col T b) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A ell X hAT hXT P a b col ib hbFirst + haBound hbNotA + have hbLower : A.length < (HierarchyFirstMissingPosition col T b).val := by + by_contra hn + have hle : (HierarchyFirstMissingPosition col T b).val ≤ A.length := Nat.le_of_not_gt hn + let j : Fin (A.length + 1) := + ⟨(HierarchyFirstMissingPosition col T b).val, Nat.lt_succ_of_le hle⟩ + apply hbNotA + refine Finset.mem_biUnion.mpr ⟨A.vertex j, + (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨j, Finset.mem_univ _, rfl⟩, ?_⟩ + have hi : Fin.castLE (Nat.succ_le_succ hAT.1) j = + HierarchyFirstMissingPosition col T b := Fin.ext rfl + rw [← hAT.2.1 j, hi] + exact hbFirst.1 + exact haBound.trans_lt hbLower + +private theorem helper_branch_803.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ∈ + TreeMissingColors P.coloring A → + let _ : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let C' : HierarchyCounterexample P.replacementBase := P.counterexample; + let col : PartialEdgeColoring E k := P.coloring; HierarchyStarredStage C'.hierarchy (Fin.last + C'.hierarchy.dividerCount) = A → ( b ∉ TreeMissingColors col A → + (↑(HierarchyFirstMissingPosition col T a) : ℕ) < (↑(HierarchyFirstMissingPosition col T b) + : ℕ)) → a ∉ TreeMissingColors col (HierarchyStarredStage C'.hierarchy (Fin.last + C'.hierarchy.dividerCount)) ∨ b ∉ TreeMissingColors col (HierarchyStarredStage + C'.hierarchy (Fin.last C'.hierarchy.dividerCount)) → (↑(HierarchyFirstMissingPosition col + T a) : ℕ) < (↑(HierarchyFirstMissingPosition col T b) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A P a b haA J C' col hstar horder hcond + apply horder + rw [hstar] at hcond + rcases hcond with hn | hn + · exact (hn haA).elim + · exact hn + +private theorem helper_leaf_820.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ b → + let col : PartialEdgeColoring E k := P.coloring; IsProperEdgeColoring G col → + ∀ (w : V), a ∈ MissingColors G col w ∨ b ∈ MissingColors G col w → ((TwoColorIncidenceGraph G + col a b).neighborSet (Sum.inl w)).Subsingleton := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P a b hne col hp w hm + have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G col a b) + (Sum.inl w) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with hm | hm + · exact MissingColorIncidenceEndpoint G col a b hne hp w hm + · have hs : TwoColorIncidenceGraph G col b a = + TwoColorIncidenceGraph G col a b := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + rw [← hs] + exact MissingColorIncidenceEndpoint G col b a hne.symm hp w hm + let : Fintype ((TwoColorIncidenceGraph G col a b).neighborSet (Sum.inl w)) := + Fintype.ofFinite _ + have hc : Fintype.card + ((TwoColorIncidenceGraph G col a b).neighborSet (Sum.inl w)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hd + intro x hx y hy + exact congrArg Subtype.val (Fintype.card_le_one_iff.mp hc ⟨x, hx⟩ ⟨y, hy⟩) + +private theorem helper_hdis_841.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (hAT : TreeSequenceInitialSegment A T) (hXT : TreeSequenceInitialSegment X T), ( + ∀ u ∈ TreeSequenceVertexSet X, u ≠ T.vertex D.terminalVertexIndex) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ∈ + MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) → + let col : PartialEdgeColoring E k := P.coloring; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); IsProperEdgeColoring G col → + ∀ (ib : Fin (X.length + (1 : ℕ))), b ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T b)) ∧ (↑(HierarchyFirstMissingPosition col T b) : ℕ) + ≤ (↑(Fin.castLE (Nat.succ_le_succ hXT.1) ib) : ℕ) → + ∀ (i : Fin (A.length + (1 : ℕ))), a ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T a)) ∧ (↑(HierarchyFirstMissingPosition col T a) : ℕ) + ≤ (↑(Fin.castLE (Nat.succ_le_succ hAT.1) i) : ℕ) → + let va : V := T.vertex (HierarchyFirstMissingPosition col T a); + let vb : V := T.vertex (HierarchyFirstMissingPosition col T b); + let _ : V := T.vertex D.terminalVertexIndex; va ∈ TreeSequenceVertexSet X → vb ∈ + TreeSequenceVertexSet X → TwoColorComponent G col a b (Sum.inl va) = TwoColorComponent G + col a b (Sum.inl vb) → ( + ∀ (w : V ⊕ E), w ∈ TwoColorComponent G col a b w) → ( + ∀ (w : V), a ∈ MissingColors G col w ∨ b ∈ MissingColors G col w → ((TwoColorIncidenceGraph G + col a b).neighborSet (Sum.inl w)).Subsingleton) → Disjoint (TwoColorComponent G col a b z) + (TwoColorComponent G col a b (Sum.inl va)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell X hAT hXT prefixNeTerminal P a + b hterminal col z hp ib hbFirst i haFirst va vb vt hvaX hvbX hsame rootMem leaf + rcases TwoColorComponentsDisjoint G col a b z (Sum.inl va) with heq | hd + · by_cases habVertex : va = vb + · have hbAt : b ∈ MissingColors G col va := habVertex.symm ▸ hbFirst.1 + have emptyNeighbors : + (TwoColorIncidenceGraph G col a b).neighborSet (Sum.inl va) = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro w hw + cases w with + | inl w => simp [TwoColorIncidenceGraph] at hw + | inr e => + obtain ⟨hinc, hca | hcb⟩ := hw + · have hn : a ∉ PresentColors G col va := by + simpa [MissingColors] using haFirst.1 + exact hn + (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hinc, hca⟩) + · have hn : b ∉ PresentColors G col va := by + simpa [MissingColors] using hbAt + exact hn + (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hinc, hcb⟩) + have hat : (Sum.inl va : Sum V E) ≠ Sum.inl vt := by + exact fun h => prefixNeTerminal va hvaX (Sum.inl.inj h) + have hreach : (TwoColorIncidenceGraph G col a b).Reachable + (Sum.inl va) (Sum.inl vt) := by + apply SimpleGraph.ConnectedComponent.exact + change Sum.inl va ∈ TwoColorComponent G col a b z + rw [heq] + exact rootMem _ + exact (SimpleGraph.not_reachable_of_neighborSet_left_eq_empty hat + emptyNeighbors hreach).elim + · obtain ⟨u, w, p, hpPath, hsupp⟩ := + TwoColorComponentSpanningPath G col a b hp z + have endpoint (y : V) + (hy : Sum.inl y ∈ TwoColorComponent G col a b z) + (hm : a ∈ MissingColors G col y ∨ b ∈ MissingColors G col y) : + Sum.inl y = u ∨ Sum.inl y = w := by + have hySupp : Sum.inl y ∈ p.support := by + change Sum.inl y ∈ {x | x ∈ p.support} + rw [hsupp] + exact hy + by_contra hn + push Not at hn + exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 (leaf y hm) hySupp + have haEnd := endpoint va (heq.symm ▸ rootMem (Sum.inl va)) (Or.inl haFirst.1) + have hbEnd := endpoint vb + (heq.symm ▸ hsame.symm ▸ rootMem (Sum.inl vb)) (Or.inr hbFirst.1) + have htEnd := endpoint vt (rootMem z) hterminal + have hab : (Sum.inl va : Sum V E) ≠ Sum.inl vb := by + intro h + exact habVertex (Sum.inl.inj h) + have hat : (Sum.inl va : Sum V E) ≠ Sum.inl vt := by + exact fun h => prefixNeTerminal va hvaX (Sum.inl.inj h) + have hbt : (Sum.inl vb : Sum V E) ≠ Sum.inl vt := by + exact fun h => prefixNeTerminal vb hvbX (Sum.inl.inj h) + rcases haEnd with haEnd | haEnd <;> + rcases hbEnd with hbEnd | hbEnd <;> + rcases htEnd with htEnd | htEnd + · exact (hab (haEnd.trans hbEnd.symm)).elim + · exact (hab (haEnd.trans hbEnd.symm)).elim + · exact (hat (haEnd.trans htEnd.symm)).elim + · exact (hbt (hbEnd.trans htEnd.symm)).elim + · exact (hbt (hbEnd.trans htEnd.symm)).elim + · exact (hat (haEnd.trans htEnd.symm)).elim + · exact (hab (haEnd.trans hbEnd.symm)).elim + · exact (hab (haEnd.trans hbEnd.symm)).elim + · exact hd + +private theorem helper_hprefix_917.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (hAT : TreeSequenceInitialSegment A T) (hXT : TreeSequenceInitialSegment X T) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ b → + let col : PartialEdgeColoring E k := P.coloring; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; + ColoredVertexSetElementary G col (TreeSequenceVertexSet X) → + ∀ (ib : Fin (X.length + (1 : ℕ))), b ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T b)) ∧ (↑(HierarchyFirstMissingPosition col T b) : ℕ) + ≤ (↑(Fin.castLE (Nat.succ_le_succ hXT.1) ib) : ℕ) → + ∀ (i : Fin (A.length + (1 : ℕ))), a ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T a)) ∧ (↑(HierarchyFirstMissingPosition col T a) : ℕ) + ≤ (↑(Fin.castLE (Nat.succ_le_succ hAT.1) i) : ℕ) → + let va : V := T.vertex (HierarchyFirstMissingPosition col T a); + let vb : V := T.vertex (HierarchyFirstMissingPosition col T b); va ∈ TreeSequenceVertexSet X → + vb ∈ TreeSequenceVertexSet X → TwoColorComponent G col a b (Sum.inl va) = + TwoColorComponent G col a b (Sum.inl vb) → ( + ∀ (w : V ⊕ E), w ∈ TwoColorComponent G col a b w) → Disjoint (TwoColorComponent G col a b z) + (TwoColorComponent G col a b (Sum.inl va)) → ( + have C : Set (V ⊕ E) := TwoColorComponent G col a b z; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G col v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → a ∈ MissingColors G col v → b ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → b ∈ MissingColors G col v → a ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ a → c ≠ b → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G col + v)) → ( + ∀ {u : V} {e : E}, Sum.inl u ∈ TwoColorComponent G col a b z → Incident G u e → col e = some a + ∨ col e = some b → Sum.inr e ∈ TwoColorComponent G col a b z) → + ∀ u ∈ TreeSequenceVertexSet X, MissingColors G mu u = MissingColors G col u := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell X hAT hXT P a b hne col z mu + hxElem ib hbFirst i haFirst va vb hvaX hvbX hsame rootMem hdis hbehavior edgeIn u hu + by_cases huQ : Sum.inl u ∈ TwoColorComponent G col a b z + · have haNot : a ∉ MissingColors G col u := by + intro hau + have huv : u = va := by + by_contra hn + exact Finset.disjoint_left.mp (hxElem hu hvaX hn) hau haFirst.1 + exact Set.disjoint_left.mp hdis huQ (huv.symm ▸ rootMem (Sum.inl va)) + have hbNot : b ∉ MissingColors G col u := by + intro hbu + have huv : u = vb := by + by_contra hn + exact Finset.disjoint_left.mp (hxElem hu hvbX hn) hbu hbFirst.1 + exact Set.disjoint_left.mp hdis huQ + (huv.symm ▸ hsame.symm ▸ rootMem (Sum.inl vb)) + obtain ⟨ea, hea, hca⟩ : ∃ e, Incident G u e ∧ col e = some a := by + simpa [MissingColors, PresentColors] using haNot + obtain ⟨eb, heb, hcb⟩ : ∃ e, Incident G u e ∧ col e = some b := by + simpa [MissingColors, PresentColors] using hbNot + have hnewa : mu eb = some a := by + simp [mu, TwoColorComponentSwap, edgeIn huQ heb (Or.inr hcb), hcb, hne.symm] + have hnewb : mu ea = some b := by + simp [mu, TwoColorComponentSwap, edgeIn huQ hea (Or.inl hca), hca] + have haNewNot : a ∉ MissingColors G mu u := by + simpa [MissingColors, PresentColors] using + (show ∃ e, Incident G u e ∧ mu e = some a from ⟨eb, heb, hnewa⟩) + have hbNewNot : b ∉ MissingColors G mu u := by + simpa [MissingColors, PresentColors] using + (show ∃ e, Incident G u e ∧ mu e = some b from ⟨ea, hea, hnewb⟩) + apply Finset.ext + intro c + by_cases hca : c = a + · simp [hca, haNot, haNewNot] + · by_cases hcb : c = b + · simp [hcb, hbNot, hbNewNot] + · exact hbehavior.2.2.2 u c hca hcb + · exact hbehavior.1 u huQ + +private theorem helper_hbNewFirst_959.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (hXT : TreeSequenceInitialSegment X T) (P : HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx) (a b : Fin k), + let col : PartialEdgeColoring E k := P.coloring; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; + ColoredVertexSetElementary G col (TreeSequenceVertexSet X) → + ∀ (ib : Fin (X.length + (1 : ℕ))), b ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T b)) ∧ (↑(HierarchyFirstMissingPosition col T b) : ℕ) + ≤ (↑(Fin.castLE (Nat.succ_le_succ hXT.1) ib) : ℕ) → (↑(HierarchyFirstMissingPosition col T + b) : ℕ) ≤ X.length → + ∀ v ∈ TreeSequenceVertexSet A, + let vb : V := T.vertex (HierarchyFirstMissingPosition col T b); vb ∈ TreeSequenceVertexSet X → + ( + ∀ u ∈ TreeSequenceVertexSet X, MissingColors G mu u = MissingColors G col u) → b ∈ + MissingColors G mu vb → HierarchyFirstMissingPosition mu T b = + HierarchyFirstMissingPosition col T b := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D firstMissing H q A ell X hXT P a b col z + mu hxElem ib hbFirst hbBound v hv vb hvbX hprefix hbNew + have hm := firstMissing mu b (HierarchyFirstMissingPosition col T b) hbNew + have hv : T.vertex (HierarchyFirstMissingPosition mu T b) ∈ TreeSequenceVertexSet X := by + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨⟨(HierarchyFirstMissingPosition mu T b).val, Nat.lt_succ_of_le (hm.2.trans + hbBound)⟩, Finset.mem_univ _, ?_⟩ + rfl + have hmOld : b ∈ MissingColors G col + (T.vertex (HierarchyFirstMissingPosition mu T b)) := by + rw [← hprefix _ hv] + exact hm.1 + by_contra hn + exact Finset.disjoint_left.mp + (hxElem hv hvbX (fun he => hn (T.vertex_injective he))) hmOld hbFirst.1 + +private theorem helper_hstoredFirst_974.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ∈ + TreeMissingColors P.coloring A → + let C' : HierarchyCounterexample P.replacementBase := P.counterexample; + let col : PartialEdgeColoring E k := P.coloring; + let H' : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := C'.hierarchy; + let q' : Fin (H'.dividerCount + (1 : ℕ)) := Fin.last H'.dividerCount; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; HierarchyStarredStage + H' q' = A → + ∀ (_ : Fin (A.length + (1 : ℕ))), ( + have C : Set (V ⊕ E) := TwoColorComponent G col a b z; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G col v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → a ∈ MissingColors G col v → b ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → b ∈ MissingColors G col v → a ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ a → c ≠ b → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G col + v)) → HierarchyFirstMissingPosition mu T b = HierarchyFirstMissingPosition col T b → + ∀ c ∈ HierarchyStoredColorsAt H' q', HierarchyFirstMissingPosition mu T c = + HierarchyFirstMissingPosition col T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A P a b haA C' col H' q' z mu hstar' + i hbehavior hbNewFirst c hc + have hca : c ≠ a := by + intro he + have hnot := (Finset.mem_sdiff.mp hc).2 + apply hnot + change c ∈ TreeMissingColors col (HierarchyStarredStage H' q') + rw [hstar', he] + exact haA + by_cases hcb : c = b + · subst c + exact hbNewFirst + · have hcandidates : + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G mu (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G col (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hbehavior.2.2.2 _ c hca hcb + unfold HierarchyFirstMissingPosition + simp only [hcandidates] + +private theorem helper_hnonElem_997.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (hAT : TreeSequenceInitialSegment A T), TreeSequenceInitialSegment X T → ( + ∀ u ∈ TreeSequenceVertexSet X, u ≠ T.vertex D.terminalVertexIndex) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ∈ + MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ b ∈ MissingColors G + P.coloring (T.vertex D.terminalVertexIndex) → + let col : PartialEdgeColoring E k := P.coloring; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; + ∀ (i : Fin (A.length + (1 : ℕ))), a ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T a)) ∧ (↑(HierarchyFirstMissingPosition col T a) : ℕ) + ≤ (↑(Fin.castLE (Nat.succ_le_succ hAT.1) i) : ℕ) → + let va : V := T.vertex (HierarchyFirstMissingPosition col T a); + let vb : V := T.vertex (HierarchyFirstMissingPosition col T b); + let _ : V := T.vertex D.terminalVertexIndex; va ∈ TreeSequenceVertexSet X → vb ∈ + TreeSequenceVertexSet X → ( + ∀ (w : V ⊕ E), w ∈ TwoColorComponent G col a b w) → Disjoint (TwoColorComponent G col a b z) + (TwoColorComponent G col a b (Sum.inl va)) → ( + have C : Set (V ⊕ E) := TwoColorComponent G col a b z; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G col v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → a ∈ MissingColors G col v → b ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → b ∈ MissingColors G col v → a ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ a → c ≠ b → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G col + v)) → b ∈ MissingColors G mu vb → ¬ColoredVertexSetElementary G mu (TreeSequenceVertexSet + T) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell X hAT hXT prefixNeTerminal P a + b hterminal col z mu i haFirst va vb vt hvaX hvbX rootMem hdis hbehavior hbNew he + have htMem : vt ∈ TreeSequenceVertexSet T := + (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨D.terminalVertexIndex, Finset.mem_univ _, rfl⟩ + rcases hterminal with hta | htb + · have hbTerminal : b ∈ MissingColors G mu vt := hbehavior.2.1 vt (rootMem z) hta + have hpMem := TreeSequenceInitialSegmentVertexSetSubset hXT hvbX + have hnept : vb ≠ vt := prefixNeTerminal vb hvbX + exact Finset.disjoint_left.mp (he hpMem htMem hnept) hbNew hbTerminal + · have haTerminal : a ∈ MissingColors G mu vt := hbehavior.2.2.1 vt (rootMem z) htb + have hvaNot : Sum.inl va ∉ TwoColorComponent G col a b z := by + intro hva + exact Set.disjoint_left.mp hdis hva (rootMem (Sum.inl va)) + have haNew : a ∈ MissingColors G mu va := by + rw [hbehavior.1 va hvaNot] + exact haFirst.1 + have haMem := TreeSequenceInitialSegmentVertexSetSubset hXT hvaX + have hneat : va ≠ vt := prefixNeTerminal va hvaX + exact Finset.disjoint_left.mp (he haMem htMem hneat) haNew haTerminal + +private theorem helper_rebuild_1018.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (mu : + PartialEdgeColoring E k), ¬ColoredVertexSetElementary G mu (TreeSequenceVertexSet T) → ( + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT mu T), + MaximumProperty corr.replacementETT ∧ + ∃ (b : HierarchyBase corr.replacementETT mu) (K : TashkinovHierarchy corr.replacementETT b) (g + : GoodHierarchy K), SameGoodHierarchy P.counterexample.good g) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P'.coloring = mu + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hnon hsupply + obtain ⟨corr, hm, b, K, g, hg⟩ := hsupply + let C' : HierarchyCounterexample b := by + exact { + positive := by rw [corr.rungAgreement]; exact P.counterexample.positive + hierarchy := K + good := g + maximum := hm + notElementary := hnon } + exact HierarchyReplacementPresentationTrans G k e0 input T phi ett base C ctx + P mu corr b C' hg + +private theorem helper_stableTn_1119.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), + let J : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let C' : HierarchyCounterexample P.replacementBase := P.counterexample; + let col : PartialEdgeColoring E k := P.coloring; + let H' : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := C'.hierarchy; + let _ : Fin (H'.dividerCount + (1 : ℕ)) := Fin.last H'.dividerCount; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; ( + let H : TashkinovHierarchy J P.replacementBase := C'.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (J.rounds + (1 : ℕ)) := Fin.last J.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := J.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q mu ∧ + ModColoring J mu ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A mu), + MaximumProperty ettA) ∧ ( (0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A mu) (baseA + : HierarchyBase ettA mu) (K : TashkinovHierarchy ettA baseA) (goodA : GoodHierarchy K), + MaximumProperty ettA ∧ ettA.series.data.kind (Fin.last ettA.rounds) = J.series.data.kind + (Fin.last J.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = P.replacementBase.core ∧ + baseA.closure = P.replacementBase.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = C'.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G mu Tnq (Dnq.biUnion (C'.good.gamma (⟨C'.hierarchy.dividerCount - + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (C'.hierarchy.dividerCount + (1 : ℕ))))))) → + let Tn : TreeSequence G e0 := J.series.data.tree (Fin.last J.rounds).castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors J.series.data (Fin.last J.rounds); + StableColoring Tn Dn col mu := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D P a b J C' col H' q' z mu hstable Tn Dn + let baseStable := if J.series.data.kind (Fin.last J.rounds) = + some TashkinovExtensionKind.PE then + CombinedStableColoring Tn P.replacementBase.closure Dn col mu + else StableColoring Tn Dn col mu + have extract : ∀ j : Fin (H'.dividerCount + 1), + HierarchyWeaklyStable H' j mu → baseStable := by + exact Fin.cases (motive := fun j => HierarchyWeaklyStable H' j mu → baseStable) + (fun h => h) (fun i h => h.1) + have hs := extract q' hstable.1 + by_cases hk : J.series.data.kind (Fin.last J.rounds) = + some TashkinovExtensionKind.PE + · have hs' : CombinedStableColoring Tn P.replacementBase.closure Dn col mu := by + simpa [baseStable, hk] using hs + exact hs'.1 + · simpa [baseStable, hk] using hs + +private theorem helper_lastX_1135.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (↑D.penultimateVertexIndex : ℕ) = X.length → + X.vertex (Fin.last X.length) = T.vertex D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell X hPenVal + change T.vertex _ = T.vertex _ + apply congrArg T.vertex + apply Fin.ext + change X.length = D.penultimateVertexIndex.val + exact hPenVal.symm + +private theorem helper_htailEdges_1141.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → ell = T.length - A.length → (↑D.lastEdgeIndex : ℕ) = + X.length → X.length + (1 : ℕ) = T.length → X.length = A.length + (ell - (1 : ℕ)) → (1 : ℕ) + ≤ ell - (1 : ℕ) → ell - (1 : ℕ) < ell → TreeSequenceInitialSegment X T → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ + b → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some a) → b ∈ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + ∀ (lastColor : Fin k), P.coloring (T.edge D.lastEdgeIndex) = some lastColor → lastColor ∉ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + let J : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let C' : HierarchyCounterexample P.replacementBase := P.counterexample; + let col : PartialEdgeColoring E k := P.coloring; + let H' : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := C'.hierarchy; + let q' : Fin (H'.dividerCount + (1 : ℕ)) := Fin.last H'.dividerCount; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; HierarchyStarredStage + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) = A ∧ + HierarchyFullTailLength P.counterexample = ell ∧ HierarchyFullTailPrefix P.counterexample + (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber P.counterexample.hierarchy = HierarchyPathNumber + H → HierarchyStarredStage H' q' = A → ColoredVertexSetElementary G col + (TreeSequenceVertexSet (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - (1 : + ℕ)))) → + let Tn : TreeSequence G e0 := J.series.data.tree (Fin.last J.rounds).castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors J.series.data (Fin.last J.rounds); + StableColoring Tn Dn col mu → X.vertex (Fin.last X.length) = T.vertex + D.penultimateVertexIndex → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → mu (T.edge t) = col (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell X hAT hell hLastVal hTlen + hXexact hEllone hElllt hXT P a b hne haTail hb lastColor htheta hthetaPresent J C' col H' + q' z mu hg hstar' helemP Tn Dn stableTn lastX t ht + have hna : col (T.edge t) ≠ some a := haTail t ht + by_cases hcb : col (T.edge t) = some b + · by_cases hlast : t = D.lastEdgeIndex + · have htb : lastColor = b := + Option.some.inj (htheta.symm.trans (hlast ▸ hcb)) + exact (hthetaPresent (htb.symm ▸ hb)).elim + · have htX : t.val < X.length := by + have hle : t.val ≤ X.length := Nat.le_of_lt_succ + (by change t.val < X.length + 1; rw [hTlen]; exact t.isLt) + have hne : t.val ≠ X.length := by + intro he + exact hlast (Fin.ext (he.trans hLastVal.symm)) + exact lt_of_le_of_ne hle hne + let r : Fin X.length := ⟨t.val, htX⟩ + have hbLast : b ∈ MissingColors G col (X.vertex (Fin.last X.length)) := by + rw [lastX] + exact hb + let Y := HierarchyFullTailPrefix C' (ell - 1) + have hYX : Y = X := hg.2.2.1 + let rY : Fin Y.length := Fin.cast (congrArg TreeSequence.length hYX.symm) r + have hrY : rY.val = t.val := rfl + have hedgeY : Y.edge rY = T.edge t := by + have edgeCast (U W : TreeSequence G e0) (h : U = W) + (i : Fin W.length) : + U.edge (Fin.cast (congrArg TreeSequence.length h.symm) i) = W.edge i := by + cases h + rfl + exact (edgeCast Y X hYX r).trans (hXT.2.2 r).symm + have hbY : b ∈ MissingColors G col (Y.vertex (Fin.last Y.length)) := by + rw [hYX] + exact hbLast + have hexc := HierarchyTailMissingColorExclusion G k e0 + P.corresponding.replacementInput T col J P.replacementBase H' + helemP + (ell - 1) hEllone + (by + change ell - 1 < T.length - (HierarchyStarredStage H' q').length + rw [hstar', ← hell] + exact hElllt) + b hbY rY + (by + change (HierarchyStarredStage H' q').length ≤ rY.val + rw [hstar', hrY] + exact ht) + (by + change rY.val < (HierarchyStarredStage H' q').length + (ell - 1) + rw [hstar', hrY] + rw [← hXexact] + exact htX) + ((congrArg col hedgeY).trans hcb) + obtain ⟨hqzero, hcore, hrpos, f, hstep, hkind, hsingleton, + hrf, hfb, hstored⟩ := hexc + have hAcore : A = P.replacementBase.core := by + have hi : q' = 0 := by apply Fin.ext; simp [q', hqzero] + have hcore' : HierarchyStarredStage H' q' = P.replacementBase.core := by + rw [hi] + rfl + exact hstar'.symm.trans hcore' + have hATn : A = Tn := hAcore.trans hcore + have htpos : t.val = A.length := by + change rY.val = (HierarchyStarredStage H' q').length at hrpos + simpa only [hrY, hstar'] using hrpos + obtain ⟨j, hj⟩ := T.attaches t + let ia : Fin (A.length + 1) := ⟨j.val, by rw [← htpos]; exact j.isLt⟩ + have hvertex : A.vertex ia = + T.vertex (Fin.castLT j (Nat.lt_trans j.isLt (Nat.succ_lt_succ t.isLt))) := by + rw [← hAT.2.1 ia] + apply congrArg T.vertex + apply Fin.ext + rfl + have hincident : TreeIncidentEdge Tn (T.edge t) := by + rw [← hATn] + refine ⟨A.vertex ia, ?_, ?_⟩ + · exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨ia, Finset.mem_univ _, rfl⟩ + · rw [hvertex] + simp [Incident, hj] + exact stableTn.1 (T.edge t) hincident + ⟨b, Finset.mem_union_right _ hstored, hcb⟩ + · dsimp only [mu] + unfold TwoColorComponentSwap + simp only [ite_eq_right hna, ite_eq_right hcb, ite_self] + +private theorem helper_hsize_1264.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); ell = T.length - + A.length → (2 : ℕ) ≤ ell → + ∀ (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := P1.coloring; + let J1 : ExtendedTashkinovTree G k e0 P1.corresponding.replacementInput T P1.coloring := + P1.corresponding.replacementETT; + let H1 : TashkinovHierarchy P1.corresponding.replacementETT P1.replacementBase := + P1.counterexample.hierarchy; + let _ : Fin (H1.dividerCount + (1 : ℕ)) := Fin.last H1.dividerCount; HierarchyStarredStage + P1.counterexample.hierarchy (Fin.last P1.counterexample.hierarchy.dividerCount) = A ∧ + HierarchyFullTailLength P1.counterexample = ell ∧ HierarchyFullTailPrefix + P1.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber P1.counterexample.hierarchy = + HierarchyPathNumber H → ColoredVertexSetElementary G rho (TreeSequenceVertexSet X) → + let n1 : Fin (J1.rounds + (1 : ℕ)) := Fin.last J1.rounds; + let Tn1 : TreeSequence G e0 := J1.series.data.tree n1.castSucc; + let extra : Finset (Fin k) := (TreeSequenceVertexSet P1.replacementBase.core \ + TreeSequenceVertexSet Tn1).biUnion fun (v : V) ↦ MissingColors G rho v; + let used : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + (ell - (2 : ℕ)) ∧ rho + (T.edge t) = some c} : Finset (Fin k)); + let available : Finset (Fin k) := (TreeMissingColors rho B \ extra) \ used; (2 : ℕ) * + J1.rounds + (11 : ℕ) ≤ available.card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A ell B X hell htail P1 rho J1 H1 q1 + geometry1 elementary1 n1 Tn1 extra used available + have hn := NineN G k e0 P1.corresponding.replacementInput T rho J1 + P1.counterexample.positive P1.replacementBase H1 P1.counterexample.good + (by + change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix P1.counterexample + (HierarchyFullTailLength P1.counterexample - 1))) + rw [geometry1.2.1, geometry1.2.2.1] + exact elementary1) + P1.minimumContext.largeMissingSet (ell - 2) + (by change ell - 2 < T.length - (HierarchyStarredStage H1 q1).length + rw [geometry1.1, ← hell] + clear * - htail + omega) + have hs := hn.1 + change 2 * J1.rounds + 11 ≤ + (((TreeMissingColors rho + (HierarchyFullTailPrefix P1.counterexample (ell - 2)) \ extra) \ + ((Finset.univ : Finset (Fin k)).filter fun c => + ∃ t : Fin T.length, + (HierarchyStarredStage H1 q1).length ≤ t.val ∧ + t.val < (HierarchyStarredStage H1 q1).length + (ell - 2) ∧ + rho (T.edge t) = some c))).card at hs + have star1 : HierarchyStarredStage H1 q1 = A := geometry1.1 + change HierarchyStarredStage P1.counterexample.hierarchy + (Fin.last P1.counterexample.hierarchy.dividerCount) = A at star1 + have prefixB : HierarchyFullTailPrefix P1.counterexample (ell - 2) = B := by + simp only [HierarchyFullTailPrefix, star1] + rfl + rw [prefixB, star1] at hs + exact hs + +private theorem helper_hGammaSize_1295.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : Fin k) (P1 : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let J1 : ExtendedTashkinovTree G k e0 P1.corresponding.replacementInput T P1.coloring := + P1.corresponding.replacementETT; + let H1 : TashkinovHierarchy P1.corresponding.replacementETT P1.replacementBase := + P1.counterexample.hierarchy; + let q1 : Fin (H1.dividerCount + (1 : ℕ)) := Fin.last H1.dividerCount; + let Gamma : Finset (Fin k) := (HierarchyStoredColorsAt H1 q1).biUnion + (P1.counterexample.good.gamma q1); Gamma.card ≤ (2 : ℕ) * J1.rounds := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx gamma P1 J1 H1 q1 Gamma + have hc : Gamma.card ≤ + ∑ c ∈ HierarchyStoredColorsAt H1 q1, (P1.counterexample.good.gamma q1 c).card := + Finset.card_biUnion_le + have he := Finset.sum_const_nat + (s := HierarchyStoredColorsAt H1 q1) (m := 2) + (fun c hc => P1.counterexample.good.twoColors q1 c hc) + have hb := HierarchyStoredColorsCardinality H1 q1 + change (HierarchyStoredColorsAt H1 q1).card ≤ J1.rounds at hb + rw [he] at hc + exact hc.trans (by simpa only [Nat.mul_comm] using Nat.mul_le_mul_left 2 hb) + +private theorem helper_hFinalSize_1306.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (hBlen : B.length = T.length - (2 : ℕ)) (P1 : HierarchyReplacementPresentation G k e0 input + T phi ett base C ctx), + let rho : PartialEdgeColoring E k := P1.coloring; + let beforeLast : Fin T.length := (⟨B.length, @Eq.mpr (@LT.lt Nat instLTNat + (@TreeSequence.length V E G e0 B) (@TreeSequence.length V E G e0 T)) (@LT.lt Nat instLTNat + (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) (@TreeSequence.length V E G e0 T) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) (@TreeSequence.length V E G e0 + T)) (@id (@Eq Prop (@LT.lt Nat instLTNat (@TreeSequence.length V E G e0 B) + (@TreeSequence.length V E G e0 T)) (@LT.lt Nat instLTNat (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) + (instOfNatNat (nat_lit 2)))) (@TreeSequence.length V E G e0 T))) (@congrArg Nat Prop + (@TreeSequence.length V E G e0 B) (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) + (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit + 2)))) (fun (_a : Nat) ↦ @LT.lt Nat instLTNat _a (@TreeSequence.length V E G e0 T)) hBlen)) + ( + have hp : @LE.le Nat instLENat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@TreeSequence.length V E G e0 T) := @TreeSequence.positive V E G e0 T; + @Decidable.byContradiction (@LT.lt Nat instLTNat (@HSub.hSub Nat Nat Nat (@instHSub Nat + instSubNat) (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat + (nat_lit 2)))) (@TreeSequence.length V E G e0 T)) ((@HSub.hSub Nat Nat Nat (@instHSub Nat + instSubNat) (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat + (nat_lit 2)))).decLt (@TreeSequence.length V E G e0 T)) fun (a : Not (@LT.lt Nat instLTNat + (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) (@TreeSequence.length V E G e0 T) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) (@TreeSequence.length V E G e0 + T))) ↦ + by omega + )⟩ : Fin T.length); + let finalColors : Finset (Fin k) := (rho (T.edge beforeLast)).toFinset ∪ (rho (T.edge + D.lastEdgeIndex)).toFinset; finalColors.card ≤ (2 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen P1 rho beforeLast finalColors + have hc := Finset.card_union_le + (rho (T.edge beforeLast)).toFinset (rho (T.edge D.lastEdgeIndex)).toFinset + have ho (o : Option (Fin k)) : o.toFinset.card ≤ 1 := by + cases o <;> simp + have h1 := ho (rho (T.edge beforeLast)) + have h2 := ho (rho (T.edge D.lastEdgeIndex)) + change finalColors.card ≤ + (rho (T.edge beforeLast)).toFinset.card + + (rho (T.edge D.lastEdgeIndex)).toFinset.card at hc + clear * - hc h1 h2 + omega + +private theorem helper_hchoice_1318.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (hBlen : B.length = T.length - (2 : ℕ)) (P1 : HierarchyReplacementPresentation G k e0 input + T phi ett base C ctx), + let rho : PartialEdgeColoring E k := P1.coloring; + let J1 : ExtendedTashkinovTree G k e0 P1.corresponding.replacementInput T P1.coloring := + P1.corresponding.replacementETT; + let H1 : TashkinovHierarchy P1.corresponding.replacementETT P1.replacementBase := + P1.counterexample.hierarchy; + let q1 : Fin (H1.dividerCount + (1 : ℕ)) := Fin.last H1.dividerCount; + let n1 : Fin (J1.rounds + (1 : ℕ)) := Fin.last J1.rounds; + let Tn1 : TreeSequence G e0 := J1.series.data.tree n1.castSucc; + let extra : Finset (Fin k) := (TreeSequenceVertexSet P1.replacementBase.core \ + TreeSequenceVertexSet Tn1).biUnion fun (v : V) ↦ MissingColors G rho v; + let used : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + (ell - (2 : ℕ)) ∧ rho + (T.edge t) = some c} : Finset (Fin k)); + let available : Finset (Fin k) := (TreeMissingColors rho B \ extra) \ used; + let Gamma : Finset (Fin k) := (HierarchyStoredColorsAt H1 q1).biUnion + (P1.counterexample.good.gamma q1); + let beforeLast : Fin T.length := (⟨B.length, @Eq.mpr (@LT.lt Nat instLTNat + (@TreeSequence.length V E G e0 B) (@TreeSequence.length V E G e0 T)) (@LT.lt Nat instLTNat + (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) (@TreeSequence.length V E G e0 T) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) (@TreeSequence.length V E G e0 + T)) (@id (@Eq Prop (@LT.lt Nat instLTNat (@TreeSequence.length V E G e0 B) + (@TreeSequence.length V E G e0 T)) (@LT.lt Nat instLTNat (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) + (instOfNatNat (nat_lit 2)))) (@TreeSequence.length V E G e0 T))) (@congrArg Nat Prop + (@TreeSequence.length V E G e0 B) (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) + (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit + 2)))) (fun (_a : Nat) ↦ @LT.lt Nat instLTNat _a (@TreeSequence.length V E G e0 T)) hBlen)) + ( + have hp : @LE.le Nat instLENat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@TreeSequence.length V E G e0 T) := @TreeSequence.positive V E G e0 T; + @Decidable.byContradiction (@LT.lt Nat instLTNat (@HSub.hSub Nat Nat Nat (@instHSub Nat + instSubNat) (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat + (nat_lit 2)))) (@TreeSequence.length V E G e0 T)) ((@HSub.hSub Nat Nat Nat (@instHSub Nat + instSubNat) (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat + (nat_lit 2)))).decLt (@TreeSequence.length V E G e0 T)) fun (a : Not (@LT.lt Nat instLTNat + (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) (@TreeSequence.length V E G e0 T) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) (@TreeSequence.length V E G e0 + T))) ↦ + by omega + )⟩ : Fin T.length); + let finalColors : Finset (Fin k) := (rho (T.edge beforeLast)).toFinset ∪ (rho (T.edge + D.lastEdgeIndex)).toFinset; (2 : ℕ) * J1.rounds + (11 : ℕ) ≤ available.card → Gamma.card ≤ + (2 : ℕ) * J1.rounds → finalColors.card ≤ (2 : ℕ) → (available \ (Gamma ∪ + finalColors)).Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B hBlen P1 rho J1 H1 q1 n1 Tn1 + extra used available Gamma beforeLast finalColors hsize hGammaSize hFinalSize + apply Finset.card_pos.mp + have hremoved := Finset.card_union_le Gamma finalColors + have hremain := Finset.card_le_card_sdiff_add_card (s := available) + (t := Gamma ∪ finalColors) + omega + +private theorem helper_betaTail_1334.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); ell = T.length - + A.length → (2 : ℕ) ≤ ell → + ∀ (hBlen : B.length = T.length - (2 : ℕ)) (P1 : HierarchyReplacementPresentation G k e0 input + T phi ett base C ctx), + let rho : PartialEdgeColoring E k := P1.coloring; + let J1 : ExtendedTashkinovTree G k e0 P1.corresponding.replacementInput T P1.coloring := + P1.corresponding.replacementETT; + let H1 : TashkinovHierarchy P1.corresponding.replacementETT P1.replacementBase := + P1.counterexample.hierarchy; + let q1 : Fin (H1.dividerCount + (1 : ℕ)) := Fin.last H1.dividerCount; + let n1 : Fin (J1.rounds + (1 : ℕ)) := Fin.last J1.rounds; + let Tn1 : TreeSequence G e0 := J1.series.data.tree n1.castSucc; + let extra : Finset (Fin k) := (TreeSequenceVertexSet P1.replacementBase.core \ + TreeSequenceVertexSet Tn1).biUnion fun (v : V) ↦ MissingColors G rho v; + let used : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + (ell - (2 : ℕ)) ∧ rho + (T.edge t) = some c} : Finset (Fin k)); + let Gamma : Finset (Fin k) := (HierarchyStoredColorsAt H1 q1).biUnion + (P1.counterexample.good.gamma q1); + let beforeLast : Fin T.length := (⟨B.length, @Eq.mpr (@LT.lt Nat instLTNat + (@TreeSequence.length V E G e0 B) (@TreeSequence.length V E G e0 T)) (@LT.lt Nat instLTNat + (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) (@TreeSequence.length V E G e0 T) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) (@TreeSequence.length V E G e0 + T)) (@id (@Eq Prop (@LT.lt Nat instLTNat (@TreeSequence.length V E G e0 B) + (@TreeSequence.length V E G e0 T)) (@LT.lt Nat instLTNat (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) + (instOfNatNat (nat_lit 2)))) (@TreeSequence.length V E G e0 T))) (@congrArg Nat Prop + (@TreeSequence.length V E G e0 B) (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) + (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit + 2)))) (fun (_a : Nat) ↦ @LT.lt Nat instLTNat _a (@TreeSequence.length V E G e0 T)) hBlen)) + ( + have hp : @LE.le Nat instLENat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@TreeSequence.length V E G e0 T) := @TreeSequence.positive V E G e0 T; + @Decidable.byContradiction (@LT.lt Nat instLTNat (@HSub.hSub Nat Nat Nat (@instHSub Nat + instSubNat) (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat + (nat_lit 2)))) (@TreeSequence.length V E G e0 T)) ((@HSub.hSub Nat Nat Nat (@instHSub Nat + instSubNat) (@TreeSequence.length V E G e0 T) (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat + (nat_lit 2)))).decLt (@TreeSequence.length V E G e0 T)) fun (a : Not (@LT.lt Nat instLTNat + (@HSub.hSub Nat Nat Nat (@instHSub Nat instSubNat) (@TreeSequence.length V E G e0 T) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) (@TreeSequence.length V E G e0 + T))) ↦ + by omega + )⟩ : Fin T.length); + let finalColors : Finset (Fin k) := (rho (T.edge beforeLast)).toFinset ∪ (rho (T.edge + D.lastEdgeIndex)).toFinset; + ∀ (beta : Fin k), ((beta ∈ TreeMissingColors rho B ∧ beta ∉ extra) ∧ beta ∉ used) ∧ beta ∉ + Gamma ∧ beta ∉ finalColors → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B hell htail hBlen P1 rho J1 H1 + q1 n1 Tn1 extra used Gamma beforeLast finalColors beta betaParts t ht hc + by_cases hb : t.val < B.length + · apply betaParts.1.2 + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, t, ht, ?_, hc⟩ + have hBexact : B.length = A.length + (ell - 2) := by + rw [hBlen] + clear * - hell htail + omega + simpa only [hBexact] using hb + · apply betaParts.2.2 + by_cases hp : t = beforeLast + · exact Finset.mem_union_left _ + (by simp only [← hp, Option.mem_toFinset]; rw [hc]; exact Option.mem_some_self beta) + · have hl : t = D.lastEdgeIndex := by + apply Fin.ext + have htlt := t.isLt + have hnp : t.val ≠ beforeLast.val := fun h => hp (Fin.ext h) + have hpos := D.lastEdgePosition + change t.val ≠ B.length at hnp + rw [hBlen] at hb hnp + clear * - htlt hnp hb hpos + omega + exact Finset.mem_union_right _ + (by simp only [← hl, Option.mem_toFinset]; rw [hc]; exact Option.mem_some_self beta) + +private theorem helper_gammaTerminal1_1366.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) (gamma : Fin k), gamma + ≠ D.alpha → + ∀ (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := helperP0462 G k + e0 input T phi ett base C ctx seriesProper seriesOne; + ∀ (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P1.coloring = + TwoColorComponentSwap G P0.coloring gamma D.alpha (Sum.inl (T.vertex + D.terminalVertexIndex)) → + let rho : PartialEdgeColoring E k := P1.coloring; gamma ∈ MissingColors G rho (T.vertex + D.terminalVertexIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D gamma hgammaAlpha seriesProper seriesOne + P0 P1 hmu1 rho + rw [show rho = P1.coloring from rfl, hmu1] + apply (TwoColorComponentSwapMissingBehavior G phi gamma D.alpha hgammaAlpha + ctx.proper (Sum.inl (T.vertex D.terminalVertexIndex))).2.2.1 + · change (TwoColorIncidenceGraph G phi gamma D.alpha).connectedComponentMk _ = _ + rfl + · exact D.alphaMissingTerminal + +private theorem helper_slotData_1373.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ HierarchyStoredColorsAt H q, c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) c = C.good.gamma q c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q P c hc + obtain ⟨hn, hs⟩ := P.sameGood.2 + have hi : Fin.cast (congrArg (fun n => n + 1) hn) q = + Fin.last P.counterexample.hierarchy.dividerCount := by + apply Fin.ext + exact hn + have hh := hs q + rw [hi] at hh + exact ⟨hh.1 ▸ hc, (hh.2 c hc).symm⟩ + +private theorem helper_reservedEq_1388.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount)) = + (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q P + obtain ⟨hn, hs⟩ := P.sameGood.2 + have hi : Fin.cast (congrArg (fun n => n + 1) hn) q = + Fin.last P.counterexample.hierarchy.dividerCount := by + apply Fin.ext + exact hn + have hh := hs q + rw [hi] at hh + ext c + constructor + · intro hc + obtain ⟨d, hd, hc⟩ := Finset.mem_biUnion.mp hc + have hd' : d ∈ HierarchyStoredColorsAt H q := hh.1.symm ▸ hd + exact Finset.mem_biUnion.mpr ⟨d, hd', by rw [hh.2 d hd']; exact hc⟩ + · intro hc + obtain ⟨d, hd, hc⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨d, hh.1 ▸ hd, by rw [← hh.2 d hd]; exact hc⟩ + +private theorem helper_pairMissing2_1439.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A X → + ∀ (gamma : Fin k), + ∀ gammaVertex ∈ TreeSequenceVertexSet A, gamma ∈ MissingColors G phi gammaVertex → + ∀ (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := helperP0462 G k + e0 input T phi ett base C ctx seriesProper seriesOne; + ∀ (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G P1.coloring v = MissingColors G P0.coloring v) + → + let rho : PartialEdgeColoring E k := P1.coloring; + ∀ (beta : Fin k), + ∀ betaVertex ∈ TreeSequenceVertexSet B, beta ∈ MissingColors G rho betaVertex → + TreeSequenceInitialSegment B X → gamma ∈ TreeMissingColors rho X ∧ beta ∈ + TreeMissingColors rho X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A ell B X hAX gamma gammaVertex + gammaVertexA gammaAtVertex seriesProper seriesOne P0 P1 hprefix1 rho beta betaVertex + betaVertexB betaAtVertex1 hBX + simp only [TreeMissingColors, Finset.mem_biUnion] + refine ⟨⟨gammaVertex, TreeSequenceInitialSegmentVertexSetSubset hAX gammaVertexA, ?_⟩, + betaVertex, TreeSequenceInitialSegmentVertexSetSubset hBX betaVertexB, betaAtVertex1⟩ + rw [hprefix1 _ (TreeSequenceInitialSegmentVertexSetSubset hAX gammaVertexA)] + exact gammaAtVertex + +private theorem helper_betaB2_1479.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (gamma : Fin k) (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := P1.coloring; + ∀ (beta : Fin k), + ∀ betaVertex ∈ TreeSequenceVertexSet B, beta ∈ MissingColors G rho betaVertex → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma beta z; + TreeSequenceInitialSegment B X → ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G (TwoColorComponentSwap G P1.coloring gamma beta + (Sum.inl (T.vertex D.terminalVertexIndex))) v = MissingColors G P1.coloring v) → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P2.coloring = mu2 + → + let tau : PartialEdgeColoring E k := P2.coloring; beta ∈ TreeMissingColors tau B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B X gamma P1 rho beta betaVertex + betaVertexB betaAtVertex1 z mu2 hBX prefix2 P2 color2 tau + refine (Finset.mem_biUnion (s := TreeSequenceVertexSet B) + (t := fun v => MissingColors G tau v)).mpr ⟨betaVertex, betaVertexB, ?_⟩ + rw [show tau = P2.coloring from rfl, color2, + prefix2 betaVertex (TreeSequenceInitialSegmentVertexSetSubset hBX betaVertexB)] + exact betaAtVertex1 + +private theorem helper_betaTerminal2_1485.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) (gamma : Fin k) (P1 : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := P1.coloring; + ∀ (beta : Fin k), gamma ∈ MissingColors G rho (T.vertex D.terminalVertexIndex) → gamma ≠ beta + → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma beta z; + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P2.coloring = mu2 + → + let tau : PartialEdgeColoring E k := P2.coloring; beta ∈ MissingColors G tau (T.vertex + D.terminalVertexIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D gamma P1 rho beta gammaTerminal1 + gammaBeta z mu2 P2 color2 tau + rw [show tau = P2.coloring from rfl, color2] + apply (TwoColorComponentSwapMissingBehavior G rho gamma beta gammaBeta + P1.minimumContext.proper z).2.1 + · change (TwoColorIncidenceGraph G rho gamma beta).connectedComponentMk _ = _ + rfl + · exact gammaTerminal1 + +private theorem helper_thetaA2_1497.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + D.theta ∈ C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A X → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G tau v = MissingColors G phi v) → + D.theta ∈ TreeMissingColors tau A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hthetaPair H q A ell X hAX + P2 tau prefix2' + have hm := (GoodHierarchyReservedDisjoint C.good q).1 eta hetaStored hthetaPair + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp hm + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [prefix2' v (TreeSequenceInitialSegmentVertexSetSubset hAX hv)] + exact hc + +private theorem helper_thetaStage2_1503.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), D.theta ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ (_ : Fin k), ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ HierarchyStoredColorsAt H q, c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) c = C.good.gamma q c) → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H2 : TashkinovHierarchy P2.corresponding.replacementETT P2.replacementBase := + P2.counterexample.hierarchy; + let q2 : Fin (H2.dividerCount + (1 : ℕ)) := Fin.last H2.dividerCount; D.theta ∈ + HierarchyStageMissingColors H2 q2 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hthetaPair H q gamma + slotData P2 H2 q2 + have hd := slotData P2 eta hetaStored + have hm : D.theta ∈ P2.counterexample.good.gamma q2 eta := by + rw [hd.2] + exact hthetaPair + exact (Finset.mem_sdiff.mp (P2.counterexample.good.avoidance q2 eta hd.1 hm)).1 + +private theorem helper_thetaTail2_1514.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), D.theta ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → eta ∈ MissingColors G phi (T.vertex + D.penultimateVertexIndex) → ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (↑D.penultimateVertexIndex : ℕ) = X.length → TreeSequenceInitialSegment X T → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet X) → T.vertex + D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + ∀ (_ : Fin k), ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ HierarchyStoredColorsAt H q, c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) c = C.good.gamma q c) → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; + let H2 : TashkinovHierarchy P2.corresponding.replacementETT P2.replacementBase := + P2.counterexample.hierarchy; + let _ : Fin (H2.dividerCount + (1 : ℕ)) := Fin.last H2.dividerCount; HierarchyStarredStage + P2.counterexample.hierarchy (Fin.last P2.counterexample.hierarchy.dividerCount) = A ∧ + HierarchyFullTailLength P2.counterexample = ell ∧ HierarchyFullTailPrefix + P2.counterexample (ell - (1 : ℕ)) = X ∧ HierarchyPathNumber P2.counterexample.hierarchy = + HierarchyPathNumber H → ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G tau v = MissingColors G phi v) → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → tau (T.edge t) ≠ some + D.theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hthetaPair hetaMissing + firstMissing H q A ell X hPenVal hXT helem hyp gamma slotData P2 tau H2 q2 geometry2 + prefix2' t ht htx hc + have hd := slotData P2 eta hetaStored + have hm : D.theta ∈ P2.counterexample.good.gamma q2 eta := by rw [hd.2]; exact hthetaPair + have hav := (Finset.mem_sdiff.mp + (P2.counterexample.good.avoidance q2 eta hd.1 hm)).2 + have heta : eta ∈ MissingColors G tau (T.vertex D.penultimateVertexIndex) := by + rw [prefix2' _ hyp] + exact hetaMissing + have hetaFirst2 : HierarchyFirstMissingPosition tau T eta = D.penultimateVertexIndex := by + have he2 : ColoredVertexSetElementary G tau (TreeSequenceVertexSet X) := by + intro u hu v hv hn + rw [prefix2' u hu, prefix2' v hv] + exact helem hu hv hn + have hf := firstMissing tau eta D.penultimateVertexIndex heta + have hv : T.vertex (HierarchyFirstMissingPosition tau T eta) ∈ TreeSequenceVertexSet X := by + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨⟨(HierarchyFirstMissingPosition tau T eta).val, + Nat.lt_succ_of_le (hf.2.trans (le_of_eq hPenVal))⟩, Finset.mem_univ _, ?_⟩ + rfl + by_contra hn + exact Finset.disjoint_left.mp (he2 hv hyp (fun he => hn (T.vertex_injective he))) hf.1 heta + apply hav + unfold HierarchySegmentColors + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + have hend : H2.stage q2.succ = T := H2.terminalStage + let r : Fin (H2.stage q2.succ).length := + Fin.cast (congrArg TreeSequence.length hend.symm) t + refine ⟨r, by rw [geometry2.1]; exact ht, ?_, ?_⟩ + · rw [hetaFirst2] + dsimp [r] + rw [hend] + simpa only [hPenVal, Nat.min_eq_left hXT.1] using htx + · have edgeCast (U W : TreeSequence G e0) (h : U = W) + (i : Fin W.length) : + U.edge (Fin.cast (congrArg TreeSequence.length h.symm) i) = W.edge i := by + cases h + rfl + change tau ((H2.stage q2.succ).edge r) = some D.theta + rw [edgeCast _ _ hend t] + exact hc + +private theorem helper_weakEdges_1561.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0), ( + ∀ (X Y : TreeSequence G e0) (h : X = Y) (i : Fin X.length), X.edge i = Y.edge (Fin.cast + (congrArg TreeSequence.length h) i)) → + ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (ett' : + ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) (K : + TashkinovHierarchy ett' base'), TreeSequenceInitialSegment (HierarchyStarredStage K + (Fin.last K.dividerCount)) T → HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsProperEdgeColoring G old → IsOneEdgeUncolored old e0 → IsProperEdgeColoring G new → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin T.length), (↑t : ℕ) < (HierarchyStarredStage K (Fin.last K.dividerCount)).length → + new (T.edge t) = old (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 T edgeCast input' old new ett' base' K hST hw hp ho hnp hno + as_aux_lemma => + let S := HierarchyStarredStage K (Fin.last K.dividerCount) + intro t ht + let tS : Fin S.length := ⟨t.val, ht⟩ + have hcast : Fin.castLE hST.1 tS = t := Fin.ext rfl + rw [← hcast, hST.2.2 tS] + by_cases hzero : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := by + apply Fin.ext + simp [hzero] + have hS : S = base'.core := by change HierarchyStarredStage K _ = _; rw [hi]; rfl + rw [hi] at hw + change (if ett'.series.data.kind (Fin.last ett'.rounds) = + some TashkinovExtensionKind.PE then _ else _) at hw + by_cases hpe : ett'.series.data.kind (Fin.last ett'.rounds) = some TashkinovExtensionKind.PE + · rw [ite_eq_left hpe] at hw + have hc := CombinedStableClosurePreserved G k e0 input' T old old new ett' + (by have h := ett'.roundsPositive; omega) base' ett'.generatingColoring hpe hp ho hnp + hno hw + obtain ⟨_, _, ⟨hunion⟩⟩ := base'.parallel hpe + let tc : Fin base'.core.length := Fin.cast (congrArg TreeSequence.length hS) tS + have he : S.edge tS = base'.core.edge tc := edgeCast S base'.core hS tS + rw [he] + by_cases hbelow : tc.val < (ett'.series.data.tree (Fin.last ett'.rounds).castSucc).length + · let tn : Fin (ett'.series.data.tree (Fin.last ett'.rounds).castSucc).length := + ⟨tc.val, hbelow⟩ + have heq : Fin.castLE hunion.leftSegment.1 tn = tc := Fin.ext rfl + rw [← heq, hunion.leftSegment.2.2 tn] + exact hc.1 tn + · obtain ⟨j, heq, _⟩ := hunion.newEntryFromRight tc (by omega) + rw [heq] + exact hc.2.1 j + · rw [ite_eq_right hpe] at hw + have hcore := base'.nonparallel hpe + have hS' := hS.trans hcore + let tn : Fin (ett'.series.data.tree (Fin.last ett'.rounds).castSucc).length := + Fin.cast (congrArg TreeSequence.length hS') tS + have he : S.edge tS = (ett'.series.data.tree (Fin.last ett'.rounds).castSucc).edge tn + := by + exact edgeCast S _ hS' tS + rw [he] + let r : Fin ett'.rounds := ⟨ett'.rounds - 1, by have h := ett'.roundsPositive; omega⟩ + have hr : r.succ = Fin.last ett'.rounds := by + have hn := ett'.roundsPositive + apply Fin.ext + simp [r] + omega + have hfix := (HkuTreeColorsControlled G k ett'.rounds e0 input' ett'.series r).2.2 new + hnp hno (by rw [hr, ← ett'.generatingColoring]; exact hw) + rw [hr, ← ett'.generatingColoring] at hfix + exact hfix tn + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := by + apply Fin.ext + simp + omega + have hS : S = K.stage (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ.castSucc + := by + change HierarchyStarredStage K _ = _ + rw [hi] + simp [HierarchyStarredStage] + rw [hi] at hw + simp only [HierarchyWeaklyStable, Fin.castSucc_succ, Fin.succ_mk, Fin.cases_succ', + Fin.castSucc_mk] at hw + have hinv : TreeColoringInvariant S old new := hS.symm ▸ hw.2 + by_cases hpos : 1 ≤ tS.val + · exact hinv.1 tS hpos + · have hi : tS = ⟨0, S.positive⟩ := by + apply Fin.ext + change tS.val = 0 + omega + rw [hi, S.first_edge, hno.1, ho.1] + +private theorem helper_pairMissing3_1654.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A X → + ∀ (gamma : Fin k) (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := P1.coloring; + ∀ (beta : Fin k), + ∀ betaVertex ∈ TreeSequenceVertexSet B, beta ∈ MissingColors G rho betaVertex → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma beta z; + TreeSequenceInitialSegment B X → ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G (TwoColorComponentSwap G P1.coloring gamma beta + (Sum.inl (T.vertex D.terminalVertexIndex))) v = MissingColors G P1.coloring v) → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P2.coloring = mu2 + → + let tau : PartialEdgeColoring E k := P2.coloring; D.theta ∈ TreeMissingColors tau A → D.theta + ∈ TreeMissingColors tau X ∧ beta ∈ TreeMissingColors tau X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B X hAX gamma P1 rho beta + betaVertex betaVertexB betaAtVertex1 z mu2 hBX prefix2 P2 color2 tau thetaA2 + obtain ⟨v, hv, hc⟩ := (Finset.mem_biUnion (s := TreeSequenceVertexSet A) + (t := fun v => MissingColors G tau v)).mp thetaA2 + simp only [TreeMissingColors, Finset.mem_biUnion] + refine ⟨⟨v, TreeSequenceInitialSegmentVertexSetSubset hAX hv, hc⟩, + betaVertex, TreeSequenceInitialSegmentVertexSetSubset hBX betaVertexB, ?_⟩ + rw [show tau = P2.coloring from rfl, color2, + prefix2 betaVertex (TreeSequenceInitialSegmentVertexSetSubset hBX betaVertexB)] + exact betaAtVertex1 + +private theorem helper_fixedCore3_1696.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → + ∀ (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; + let J2 : ExtendedTashkinovTree G k e0 P2.corresponding.replacementInput T P2.coloring := + P2.corresponding.replacementETT; + let _ : TashkinovHierarchy P2.corresponding.replacementETT P2.replacementBase := + P2.counterexample.hierarchy; HierarchyStarredStage P2.counterexample.hierarchy (Fin.last + P2.counterexample.hierarchy.dividerCount) = A ∧ HierarchyFullTailLength P2.counterexample + = ell ∧ HierarchyFullTailPrefix P2.counterexample (ell - (1 : ℕ)) = X ∧ + HierarchyPathNumber P2.counterexample.hierarchy = HierarchyPathNumber H → ( + ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (ett' : + ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) (K : + TashkinovHierarchy ett' base'), TreeSequenceInitialSegment (HierarchyStarredStage K + (Fin.last K.dividerCount)) T → HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsProperEdgeColoring G old → IsOneEdgeUncolored old e0 → IsProperEdgeColoring G new → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin T.length), (↑t : ℕ) < (HierarchyStarredStage K (Fin.last K.dividerCount)).length → + new (T.edge t) = old (T.edge t)) → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G tau D.theta beta z; ( + let H : TashkinovHierarchy J2 P2.replacementBase := P2.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (J2.rounds + (1 : ℕ)) := Fin.last J2.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := J2.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q mu3 ∧ + ModColoring J2 mu3 ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A mu3), + MaximumProperty ettA) ∧ ( (0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A mu3) (baseA + : HierarchyBase ettA mu3) (K : TashkinovHierarchy ettA baseA) (goodA : GoodHierarchy K), + MaximumProperty ettA ∧ ettA.series.data.kind (Fin.last ettA.rounds) = J2.series.data.kind + (Fin.last J2.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = P2.replacementBase.core ∧ + baseA.closure = P2.replacementBase.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = P2.counterexample.good.gamma jH eta) + ∧ TreeColorSetMinusClosed G mu3 Tnq (Dnq.biUnion (P2.counterexample.good.gamma + (⟨P2.counterexample.hierarchy.dividerCount - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (P2.counterexample.hierarchy.dividerCount + (1 : ℕ))))))) → + ∀ (t : Fin T.length), (↑t : ℕ) < A.length → mu3 (T.edge t) = tau (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell X hAT beta z P2 tau J2 H2 + geometry2 weakEdges mu3 stable3 + have hh := weakEdges tau mu3 J2 P2.replacementBase H2 + (by rw [geometry2.1]; exact hAT) stable3.1 + P2.minimumContext.proper P2.minimumContext.oneEdgeUncolored + stable3.2.1.1 stable3.2.1.2.1 + rw [geometry2.1] at hh + exact hh + +private theorem helper_transportRoute_1710.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); ell = T.length - + A.length → (2 : ℕ) ≤ ell → B.length = T.length - (2 : ℕ) → X.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment X T → + ∀ (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); TreeSequenceInitialSegment B X → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G tau D.theta beta z; ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G (TwoColorComponentSwap G P2.coloring D.theta + beta (Sum.inl (T.vertex D.terminalVertexIndex))) v = MissingColors G P2.coloring v) → ( + ∀ (t : Fin T.length), (↑t : ℕ) < X.length → mu3 (T.edge t) = tau (T.edge t)) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence tau S X → + TashkinovAugmentationSequence mu3 S X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B X hell htail hBlen hXlen hXT + beta z hBX P2 tau mu3 prefix3 fixedPrefix3 S hs + apply TashkinovAugmentationSequenceColoringTransport tau mu3 S B X hs hBX + (by rw [hXlen, hBlen]; clear * - hell htail; omega) + · intro t _ + have hh := fixedPrefix3 (Fin.castLE hXT.1 t) (by exact t.isLt) + rw [hXT.2.2 t] at hh + exact hh + · intro v hv + exact prefix3 v (TreeSequenceInitialSegmentVertexSetSubset hBX hv) + +private theorem helper_route3_1721.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b), TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ TreeSequenceInitialSegment + (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last + H.dividerCount))) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); ell = T.length - + A.length → (2 : ℕ) ≤ ell → X.length = T.length - (1 : ℕ) → TreeSequenceInitialSegment X T + → TreeSequenceInitialSegment A X → + ∀ (_ : Fin k) (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := P1.coloring; + let J1 : ExtendedTashkinovTree G k e0 P1.corresponding.replacementInput T P1.coloring := + P1.corresponding.replacementETT; + let n1 : Fin (J1.rounds + (1 : ℕ)) := Fin.last J1.rounds; + let Tn1 : TreeSequence G e0 := J1.series.data.tree n1.castSucc; + let extra : Finset (Fin k) := (TreeSequenceVertexSet P1.replacementBase.core \ + TreeSequenceVertexSet Tn1).biUnion fun (v : V) ↦ MissingColors G rho v; + let used : Finset (Fin k) := ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + (ell - (2 : ℕ)) ∧ rho + (T.edge t) = some c} : Finset (Fin k)); + let _ : Finset (Fin k) := (TreeMissingColors rho B \ extra) \ used; + ∀ (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; + let J2 : ExtendedTashkinovTree G k e0 P2.corresponding.replacementInput T P2.coloring := + P2.corresponding.replacementETT; + let _ : TashkinovHierarchy P2.corresponding.replacementETT P2.replacementBase := + P2.counterexample.hierarchy; HierarchyStarredStage P2.counterexample.hierarchy (Fin.last + P2.counterexample.hierarchy.dividerCount) = A ∧ HierarchyFullTailLength P2.counterexample + = ell ∧ HierarchyFullTailPrefix P2.counterexample (ell - (1 : ℕ)) = X ∧ + HierarchyPathNumber P2.counterexample.hierarchy = HierarchyPathNumber H → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G tau D.theta beta z; ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence tau S X → + TashkinovAugmentationSequence mu3 S X) → J2.series.data.kind (Fin.last J2.rounds) = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence mu3 (J2.series.data.tree + (Fin.last J2.rounds).castSucc) X ∨ (J2.series.data.kind (Fin.last J2.rounds) = some + TashkinovExtensionKind.SE ∨ J2.series.data.kind (Fin.last J2.rounds) = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), J2.series.data.connectingEdges (Fin.last J2.rounds) = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (J2.series.data.tree (Fin.last + J2.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence mu3 seed X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D segmentTrans commonPrefix + hierarchyGeometry H q A ell B X hell htail hXlen hXT hAX gamma P1 rho J1 n1 Tn1 extra used + available beta z P2 tau J2 H2 geometry2 mu3 transportRoute + clear * - J2 H2 tau mu3 X A hXT hAX hXlen hell htail + transportRoute segmentTrans hierarchyGeometry geometry2 commonPrefix + let n := Fin.last J2.rounds + let Tn := J2.series.data.tree n.castSucc + let F := J2.series.data.tree (Fin.last (J2.rounds + 1)) + have hXF : TreeSequenceInitialSegment X F := segmentTrans hXT J2.belowFinal + have hn : n.succ = Fin.last (J2.rounds + 1) := Fin.ext rfl + have hTnA : TreeSequenceInitialSegment Tn A := by + have hh := (hierarchyGeometry H2).2 + rw [geometry2.1] at hh + exact hh + have hTnX : TreeSequenceInitialSegment Tn X := segmentTrans hTnA hAX + have nonparallel + (hkind : J2.series.data.kind n = some TashkinovExtensionKind.SE ∨ + J2.series.data.kind n = some TashkinovExtensionKind.RE) + (f : E) (seed : TreeSequence G e0) + (hedges : J2.series.data.connectingEdges n = {f}) + (hadjoin : TreeSequenceAdjoinEdge Tn f seed) + (hclosure : TashkinovClosure tau seed F) : + ∃ f seed, J2.series.data.connectingEdges (Fin.last J2.rounds) = {f} ∧ + TreeSequenceAdjoinEdge (J2.series.data.tree (Fin.last J2.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence mu3 seed X := by + have hseedF := TashkinovAugmentationSequenceInitialSegment tau seed F hclosure.1 + have hsBound : seed.length ≤ X.length := by + have hlen := hTnA.1 + have hseed := hadjoin.1 + rw [hXlen] + clear * - hlen hseed hell htail + omega + have hseedX := commonPrefix hseedF hXF hsBound + exact ⟨f, seed, hedges, hadjoin, transportRoute seed + (TashkinovAugmentationSequenceRestrict tau seed X F hclosure.1 hseedX hXF)⟩ + have cert := J2.series.certified n + generalize hindex : n = j at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + have hnzero : n = 0 := by simpa using hindex + have hv : J2.rounds = 0 := by + simpa only [n, Fin.val_last, Fin.val_zero] using congrArg Fin.val hnzero + exact (Nat.ne_of_gt J2.roundsPositive hv).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hk : J2.series.data.kind n = some TashkinovExtensionKind.SE := by + rw [hindex] + exact currentKind + refine Or.inr ⟨Or.inl hk, ?_⟩ + apply nonparallel (Or.inl hk) choice.edge adjoined + · rw [hindex]; exact currentEdges + · simpa [Tn, hindex] using adjoinedExactly + · rw [← hindex, hn, ← J2.generatingColoring] at closedExtension + exact closedExtension + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hk : J2.series.data.kind n = some TashkinovExtensionKind.PE := by + rw [hindex] + exact currentKind + refine Or.inl ⟨hk, transportRoute Tn ?_⟩ + rw [← hindex, hn, ← J2.generatingColoring] at closedExtension + exact TashkinovAugmentationSequenceRestrict tau Tn X F closedExtension.1 hTnX hXF + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have hk : J2.series.data.kind n = some TashkinovExtensionKind.RE := by + rw [hindex] + exact currentKind + refine Or.inr ⟨Or.inr hk, ?_⟩ + apply nonparallel (Or.inr hk) available.edge adjoined + · rw [hindex]; exact currentEdges + · simpa [Tn, hindex] using adjoinedExactly + · rw [← hindex, hn, ← J2.generatingColoring] at closedExtension + exact closedExtension + +private theorem helper_lastTheta2_1805.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; ell = T.length - A.length → (2 : ℕ) ≤ ell → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → tau (T.edge t) = phi (T.edge t)) → tau (T.edge + D.lastEdgeIndex) = some D.theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell hell htail P2 tau edges2 + rw [edges2 _ (by + have hp := D.lastEdgePosition + clear * - hp hell htail + omega)] + exact D.thetaOnLastEdge + +private theorem helper_suffix3_1811.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); (↑D.lastEdgeIndex : ℕ) + = X.length → X.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment X T → + ∀ (beta : Fin k) (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; D.theta ∈ TreeMissingColors tau X ∧ beta ∈ + TreeMissingColors tau X → tau (T.edge D.lastEdgeIndex) = some D.theta → + TashkinovAugmentationSequence tau X T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell X hLastVal hTlen hXT beta P2 tau + pairMissing3 lastTheta2 + apply Relation.ReflTransGen.single + refine ⟨hTlen.symm, hXT, D.theta, ?_, pairMissing3.1⟩ + have hi : Fin.cast hTlen (Fin.last X.length) = D.lastEdgeIndex := by + apply Fin.ext + exact hLastVal.symm + rw [hi] + exact lastTheta2 + +private theorem helper_cutoff3_1819.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), D.theta ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → eta ∈ MissingColors G phi (T.vertex + D.penultimateVertexIndex) → ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (↑D.penultimateVertexIndex : ℕ) = X.length → T.vertex D.penultimateVertexIndex ∈ + TreeSequenceVertexSet X → + ∀ (_ : Fin k) (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H1 : TashkinovHierarchy P1.corresponding.replacementETT P1.replacementBase := + P1.counterexample.hierarchy; + let q1 : Fin (H1.dividerCount + (1 : ℕ)) := Fin.last H1.dividerCount; + let Gamma : Finset (Fin k) := (HierarchyStoredColorsAt H1 q1).biUnion + (P1.counterexample.good.gamma q1); + ∀ beta ∉ Gamma, ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∈ HierarchyStoredColorsAt H q, c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) c = C.good.gamma q c) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion (P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount)) = (HierarchyStoredColorsAt H q).biUnion + (C.good.gamma q)) → Gamma = (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; + let H2 : TashkinovHierarchy P2.corresponding.replacementETT P2.replacementBase := + P2.counterexample.hierarchy; + let q2 : Fin (H2.dividerCount + (1 : ℕ)) := Fin.last H2.dividerCount; ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G tau v = MissingColors G phi v) → + ∀ c ∈ HierarchyStoredColorsAt H2 q2, D.theta ∈ P2.counterexample.good.gamma q2 c ∨ beta ∈ + P2.counterexample.good.gamma q2 c → (↑(HierarchyFirstMissingPosition tau T c) : ℕ) ≤ + X.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hthetaPair hetaMissing + firstMissing H q ell X hPenVal hyp gamma P1 H1 q1 Gamma beta betaOutside slotData + reservedEq gammaOriginal P2 tau H2 q2 prefix2' c hc hp + rcases hp with ht | hb + · have he : c = eta := by + by_contra hn + have hs := slotData P2 eta hetaStored + have hm : D.theta ∈ P2.counterexample.good.gamma q2 eta := by rw [hs.2]; exact hthetaPair + exact Finset.disjoint_left.mp + (P2.counterexample.good.disjointPairs q2 c eta hc hs.1 hn) ht hm + subst c + have hm : eta ∈ MissingColors G tau (T.vertex D.penultimateVertexIndex) := by + rw [prefix2' _ hyp] + exact hetaMissing + exact (firstMissing tau eta D.penultimateVertexIndex hm).2.trans (le_of_eq hPenVal) + · apply (betaOutside ?_).elim + rw [gammaOriginal, ← reservedEq P2] + exact (Finset.mem_biUnion (s := HierarchyStoredColorsAt H2 q2) + (t := P2.counterexample.good.gamma q2)).mpr ⟨c, hc, hb⟩ + +private theorem helper_terminalIncident_1864.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D + obtain ⟨i, hi⟩ := T.attaches D.lastEdgeIndex + have hind : D.lastEdgeIndex.succ = D.terminalVertexIndex := by + apply Fin.ext + have he := D.lastEdgePosition + have hv := D.terminalVertexPosition + simp only [Fin.val_succ] + clear * - he hv + omega + rw [← hind] + simp [Incident, hi] + +private theorem helper_thetaTerminal3_1883.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; beta ∈ MissingColors G tau (T.vertex + D.terminalVertexIndex) → D.theta ≠ beta → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G tau D.theta beta z; + ∀ (P3 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P3.coloring = mu3 + → D.theta ∈ MissingColors G P3.coloring (T.vertex D.terminalVertexIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D beta z P2 tau betaTerminal2 thetaBeta mu3 + P3 color3 + rw [color3] + apply (TwoColorComponentSwapMissingBehavior G tau D.theta beta thetaBeta + P2.minimumContext.proper z).2.2.1 + · change (TwoColorIncidenceGraph G tau D.theta beta).connectedComponentMk _ = _ + rfl + · exact betaTerminal2 + +private theorem helper_thetaTail3_1906.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); X.length = T.length - + (1 : ℕ) → (↑D.lastEdgeIndex : ℕ) = X.length → + ∀ (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; D.theta ≠ beta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → tau (T.edge t) ≠ some + D.theta) → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G tau D.theta beta z; ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → mu3 (T.edge t) = tau (T.edge + t)) → + ∀ (P3 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P3.coloring = mu3 + → P3.coloring (T.edge D.lastEdgeIndex) = some beta → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P3.coloring (T.edge t) ≠ some D.theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell X hXlen hLastVal beta z P2 tau + thetaBeta thetaTail2 mu3 fixedTail3 P3 color3 lastBeta3 t ht hc + by_cases hx : t.val < X.length + · rw [color3, fixedTail3 t ht hx] at hc + exact thetaTail2 t ht hx hc + · have hi : t = D.lastEdgeIndex := by + apply Fin.ext + have htlt := t.isLt + clear * - htlt hx hLastVal hXlen + omega + rw [hi, lastBeta3] at hc + exact thetaBeta (Option.some.inj hc).symm + +private theorem helper_betaPresent3_1919.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); ell = T.length - + A.length → (2 : ℕ) ≤ ell → B.length = T.length - (2 : ℕ) → X.length = T.length - (1 : ℕ) → + (↑D.penultimateVertexIndex : ℕ) = X.length → ColoredVertexSetElementary G phi + (TreeSequenceVertexSet X) → T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + ∀ (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); TreeSequenceInitialSegment B X → + ∀ (P2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let tau : PartialEdgeColoring E k := P2.coloring; beta ∈ TreeMissingColors tau B → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G tau D.theta beta z; ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G (TwoColorComponentSwap G P2.coloring D.theta + beta (Sum.inl (T.vertex D.terminalVertexIndex))) v = MissingColors G P2.coloring v) → + ∀ (P3 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P3.coloring = mu3 + → ( + ∀ v ∈ TreeSequenceVertexSet X, MissingColors G P3.coloring v = MissingColors G phi v) → beta ∉ + MissingColors G P3.coloring (T.vertex D.penultimateVertexIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B X hell htail hBlen hXlen + hPenVal helem hyp beta z hBX P2 tau betaB2 mu3 prefix3 P3 color3 prefix3' + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp betaB2 + have hvX := TreeSequenceInitialSegmentVertexSetSubset hBX hv + have hcv : beta ∈ MissingColors G P3.coloring v := by rw [color3, prefix3 v hvX]; exact hc + have hn : v ≠ T.vertex D.penultimateVertexIndex := by + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + change i.val = D.penultimateVertexIndex.val at hi + have hb : B.length + 1 ≤ D.penultimateVertexIndex.val := by + rw [hPenVal, hXlen, hBlen] + clear * - hell htail + omega + exact (Nat.ne_of_lt (i.isLt.trans_le hb)) hi + intro hp + have he3 : ColoredVertexSetElementary G P3.coloring (TreeSequenceVertexSet X) := by + intro u hu w hw hn + rw [prefix3' u hu, prefix3' w hw] + exact helem hu hw hn + exact Finset.disjoint_left.mp (he3 hvX hyp hn) hcv hp + +private theorem helper_alphaTerminal4_1948.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + let _ : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (P3 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D.theta ∈ + MissingColors G P3.coloring (T.vertex D.terminalVertexIndex) → D.theta ≠ D.alpha → + ∀ (P4 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P4.coloring = + TwoColorComponentSwap G P3.coloring D.theta D.alpha (Sum.inl (T.vertex + D.terminalVertexIndex)) → D.alpha ∈ MissingColors G P4.coloring (T.vertex + D.terminalVertexIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D z P3 thetaTerminal3 thetaAlpha P4 color4 + rw [color4] + apply (TwoColorComponentSwapMissingBehavior G P3.coloring D.theta D.alpha thetaAlpha + P3.minimumContext.proper z).2.1 + · change (TwoColorIncidenceGraph G P3.coloring D.theta D.alpha).connectedComponentMk _ = _ + rfl + · exact thetaTerminal3 + +private theorem helper_swapStep_3176.{u_1, u_2} : storedExceptionSwapStepStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta missingMono firstMissing H q A ell B + X hAT hell hBlen hXlen hPenVal hLastVal hTlen hXexact hEllone hElllt hXT hAX hyp + presentationGeometry caseFor prepareLater rebuild P a b hne haA haStage haTail hb hterminal + lastColor htheta hthetaPresent + as_aux_lemma => + clear * - P a b hne haA haStage haTail hb hterminal lastColor htheta hthetaPresent + prepareLater caseFor rebuild presentationGeometry firstMissing missingMono + hAT hXT hAX hXlen hBlen hPenVal hLastVal hTlen hyp hell + ell hEllone hElllt hXexact + let J := P.corresponding.replacementETT + let C' := P.counterexample + let col := P.coloring + let H' := C'.hierarchy + let q' := Fin.last H'.dividerCount + let z : Sum V E := Sum.inl (T.vertex D.terminalVertexIndex) + let mu := TwoColorComponentSwap G col a b z + have hg := presentationGeometry P + have hstar : HierarchyStarredStage C'.hierarchy + (Fin.last C'.hierarchy.dividerCount) = A := hg.1 + have hstar' : HierarchyStarredStage H' q' = A := hstar + have hXeq : HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1) = X := by + rw [hg.2.1] + exact hg.2.2.1 + have hp : IsProperEdgeColoring G col := P.minimumContext.proper + have hbX : b ∈ TreeMissingColors col X := Finset.mem_biUnion.mpr ⟨_, hyp, hb⟩ + obtain ⟨hpath, hdis, hprefix, hstoredFirst, hnonElem⟩ := + prepareLater P a b hne haA haStage hbX (fun t ht _ => haTail t ht) hterminal + have hcase := caseFor P a haStage + have hmissingP : a ∈ TreeMissingColors col + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1)) ∧ + b ∈ TreeMissingColors col + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1)) := by + rw [hXeq] + exact ⟨missingMono hAX col haA, hbX⟩ + have helemP : ColoredVertexSetElementary G col + (TreeSequenceVertexSet (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1))) := + HierarchyCounterexamplePenultimateElementary G k e0 + P.corresponding.replacementInput T col J P.replacementBase C' + P.minimumContext.proper P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality P.minimumContext.largeMissingSet + have hcase' : + (0 < H'.dividerCount ∧ + a ∈ TreeMissingColors col (H'.stage ⟨H'.dividerCount, by omega⟩)) ∨ + (H'.dividerCount = 0 ∧ + (a ∈ TreeMissingColors col (J.series.data.tree (Fin.last J.rounds).castSucc) ∨ + (a ∈ TreeMissingColors col (HierarchyStarredStage H' q') ∧ + a ∉ TashkinovStoredColors J.series.data (Fin.last J.rounds) ∧ + b ∉ TashkinovStoredColors J.series.data (Fin.last J.rounds)))) := by + rcases hcase with h | ⟨hz, hm⟩ + · exact Or.inl h + · exact Or.inr ⟨hz, Or.inl hm⟩ + have hstable := StableChangeCasesOneTwo G k e0 P.corresponding.replacementInput + T col J P.replacementBase C' hp P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality helemP + P.minimumContext.largeMissingSet a b hne hmissingP + z hpath mu rfl hcase' hdis + let Tn := J.series.data.tree (Fin.last J.rounds).castSucc + let Dn := TashkinovStoredColors J.series.data (Fin.last J.rounds) + have stableTn : StableColoring Tn Dn col mu := by + exact @helper_stableTn_1119 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@P) + (@a) (@b) (@hstable) + have lastX : X.vertex (Fin.last X.length) = T.vertex D.penultimateVertexIndex := by + exact @helper_lastX_1135 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hPenVal) + have htailEdges : ∀ t : Fin T.length, A.length ≤ t.val → + mu (T.edge t) = col (T.edge t) := by + exact @helper_htailEdges_1141 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hAT) (@hell) (@hLastVal) (@hTlen) (@hXexact) (@hEllone) (@hElllt) (@hXT) (@P) (@a) + (@b) (@hne) (@haTail) (@hb) (@lastColor) (@htheta) (@hthetaPresent) (@hg) (@hstar') + (@helemP) (@stableTn) (@lastX) + have hfull := StableChangeCasesOneTwoFullTail G k e0 + P.corresponding.replacementInput T col J P.replacementBase C' P.minimumContext + a b hne hmissingP z hpath mu rfl hcase' hdis + (by dsimp only; intro t ht + exact htailEdges t (by simpa only [hstar] using ht)) + (by intro v hv; rw [hXeq] at hv; exact hprefix v hv) hstoredFirst + obtain ⟨Pnew, hcolor⟩ := rebuild P mu hnonElem hfull.2.2.2.2 + refine ⟨Pnew, hcolor, ?_, ?_⟩ + · simpa [hcolor] using hprefix + · simpa [hcolor] using htailEdges + +private theorem helper_continuation_4132.{u_1, u_2} : + helperContinuation4132Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hthetaPair hetaMissing + segmentTrans commonPrefix hierarchyGeometry firstMissing H q A ell B X hell htail hBlen + hXlen hPenVal hLastVal hTlen hXT hAX helem hyp gamma presentationGeometry rebuild swapStep + P1 H1 q1 Gamma beta betaOutside slotData reservedEq gammaOriginal z hBX P2 tau J2 H2 q2 + geometry2 prefix2' edges2 betaB2 betaTerminal2 thetaA2 thetaBeta thetaTail2 mu3 path3 dis3 + prefix3 stored3 non3 pairMissing3 case3 fixedTail3 fixedPrefix3 + have transportRoute (S : TreeSequence G e0) + (hs : TashkinovAugmentationSequence tau S X) : + TashkinovAugmentationSequence mu3 S X := by + exact @helper_transportRoute_1710 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hell) (@htail) (@hBlen) (@hXlen) (@hXT) (@beta) (@hBX) (@P2) (@prefix3) (@fixedPrefix3) + (@S) (@hs) + have route3 : + (J2.series.data.kind (Fin.last J2.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu3 + (J2.series.data.tree (Fin.last J2.rounds).castSucc) X) ∨ + ((J2.series.data.kind (Fin.last J2.rounds) = some TashkinovExtensionKind.SE ∨ + J2.series.data.kind (Fin.last J2.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, J2.series.data.connectingEdges (Fin.last J2.rounds) = {f} ∧ + TreeSequenceAdjoinEdge (J2.series.data.tree (Fin.last J2.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence mu3 seed X) := by + exact @helper_route3_1721 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@segmentTrans) + (@commonPrefix) (@hierarchyGeometry) (@hell) (@htail) (@hXlen) (@hXT) (@hAX) (@gamma) + (@P1) (@beta) (@P2) (@geometry2) (@transportRoute) + have lastTheta2 : tau (T.edge D.lastEdgeIndex) = some D.theta := by + exact @helper_lastTheta2_1805 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hell) (@htail) (@P2) (@edges2) + have suffix3 : TashkinovAugmentationSequence tau X T := by + exact @helper_suffix3_1811 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hLastVal) (@hTlen) + (@hXT) (@beta) (@P2) (@pairMissing3) (@lastTheta2) + have cutoff3 : ∀ c ∈ HierarchyStoredColorsAt H2 q2, + (D.theta ∈ P2.counterexample.good.gamma q2 c ∨ + beta ∈ P2.counterexample.good.gamma q2 c) → + (HierarchyFirstMissingPosition tau T c).val ≤ X.length := by + exact @helper_cutoff3_1819 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) (@hetaStored) + (@hthetaPair) (@hetaMissing) (@firstMissing) (@hPenVal) (@hyp) (@gamma) (@P1) (@beta) + (@betaOutside) (@slotData) (@reservedEq) (@gammaOriginal) (@P2) (@prefix2') + obtain ⟨P3, color3⟩ := rebuild P2 mu3 non3 + (StableChangeCasesOneTwoSplitTail G k e0 P2.corresponding.replacementInput T tau J2 + P2.replacementBase P2.counterexample P2.minimumContext D.theta beta thetaBeta + (by rw [geometry2.2.1, geometry2.2.2.1]; exact pairMissing3) + z path3 mu3 rfl + (by dsimp only; rcases case3 with h | ⟨hz, hm⟩ + · exact Or.inl h + · exact Or.inr ⟨hz, Or.inl hm⟩) + dis3 X + (by dsimp only; rw [geometry2.1]; exact hAX) + (by dsimp only; rw [geometry2.1]; rw [hXlen] + clear * - hell htail; omega) + (by rw [geometry2.2.1, geometry2.2.2.1]; exact + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩) + (by dsimp only; intro t ht hx; rw [geometry2.1] at ht; exact fixedTail3 t ht hx) + route3 suffix3 + (by + constructor + · obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp pairMissing3.1 + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [prefix3 v hv]; exact hc⟩ + · obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp pairMissing3.2 + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [prefix3 v hv]; exact hc⟩) + (by intro v hv; rw [geometry2.2.1, geometry2.2.2.1] at hv; exact prefix3 v hv) + stored3 cutoff3).2.2 + have terminalIncident : Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) := by + exact @helper_terminalIncident_1864 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + have lastComponent3 : Sum.inr (T.edge D.lastEdgeIndex) ∈ + TwoColorComponent G tau D.theta beta z := by + exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G tau D.theta beta).Adj + (Sum.inr (T.edge D.lastEdgeIndex)) z from ⟨terminalIncident, Or.inl lastTheta2⟩) + have lastBeta3 : P3.coloring (T.edge D.lastEdgeIndex) = some beta := by + rw [color3] + simp [mu3, TwoColorComponentSwap, lastComponent3, lastTheta2] + have thetaTerminal3 : D.theta ∈ MissingColors G P3.coloring (T.vertex D.terminalVertexIndex) := by + exact @helper_thetaTerminal3_1883 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@beta) (@P2) (@betaTerminal2) (@thetaBeta) (@P3) (@color3) + have prefix3' : ∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P3.coloring v = MissingColors G phi v := by + intro v hv + rw [color3] + exact (prefix3 v hv).trans (prefix2' v hv) + have thetaA3 : D.theta ∈ TreeMissingColors P3.coloring A := by + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp thetaA2 + exact Finset.mem_biUnion.mpr ⟨v, hv, by + rw [color3, prefix3 v (TreeSequenceInitialSegmentVertexSetSubset hAX hv)] + exact hc⟩ + have thetaStage3 : D.theta ∈ HierarchyStageMissingColors P3.counterexample.hierarchy + (Fin.last P3.counterexample.hierarchy.dividerCount) := by + have hs := slotData P3 eta hetaStored + have hm : D.theta ∈ P3.counterexample.good.gamma + (Fin.last P3.counterexample.hierarchy.dividerCount) eta := by rw [hs.2]; exact hthetaPair + exact (Finset.mem_sdiff.mp (P3.counterexample.good.avoidance _ eta hs.1 hm)).1 + have thetaTail3 : ∀ t : Fin T.length, A.length ≤ t.val → + P3.coloring (T.edge t) ≠ some D.theta := by + exact @helper_thetaTail3_1906 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hXlen) (@hLastVal) (@beta) (@P2) (@thetaBeta) (@thetaTail2) (@fixedTail3) (@P3) + (@color3) (@lastBeta3) + have betaPresent3 : beta ∉ MissingColors G P3.coloring (T.vertex D.penultimateVertexIndex) := by + exact @helper_betaPresent3_1919 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hell) (@htail) (@hBlen) (@hXlen) (@hPenVal) (@helem) (@hyp) (@beta) (@hBX) (@P2) + (@betaB2) (@prefix3) (@P3) (@color3) (@prefix3') + -- Restore the stored Case 1 witness after making the last edge nonreserved. + have thetaAlpha : D.theta ≠ D.alpha := by + intro he + exact D.thetaPresentPenultimate (he.symm ▸ D.alphaMissingPenultimate) + obtain ⟨P4, color4, prefix4, edges4⟩ := swapStep P3 D.theta D.alpha thetaAlpha + thetaA3 thetaStage3 thetaTail3 + (by rw [prefix3' _ hyp]; exact D.alphaMissingPenultimate) + (Or.inl thetaTerminal3) beta lastBeta3 betaPresent3 + have geometry4 := presentationGeometry P4 + have alphaTerminal4 : D.alpha ∈ MissingColors G P4.coloring (T.vertex D.terminalVertexIndex) := by + exact @helper_alphaTerminal4_1948 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@P3) + (@thetaTerminal3) (@thetaAlpha) (@P4) (@color4) + have hlastTail : A.length ≤ D.lastEdgeIndex.val := by + have hp := D.lastEdgePosition + clear * - hp hell htail + omega + have hd4 := slotData P4 D.alpha D.alphaStored + let D4 : HierarchySituationTwoCaseOneData G k e0 P4.corresponding.replacementInput + T P4.coloring P4.corresponding.replacementETT P4.replacementBase P4.counterexample + P4.minimumContext := by + exact @helperD41837 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hyp) (@beta) + (@P3) (@lastBeta3) (@prefix3') (@betaPresent3) (@P4) (@prefix4) (@edges4) (@geometry4) + (@alphaTerminal4) (@hlastTail) (@hd4) + apply HierarchySituationTwoSubcaseOneOneNonexceptional G k e0 P4.corresponding.replacementInput + T P4.coloring P4.corresponding.replacementETT P4.replacementBase P4.counterexample + P4.minimumContext D4 + left + intro hm + apply betaOutside + rw [reservedEq P4] at hm + rw [gammaOriginal] + exact hm + +private theorem helper_continuation_3839.{u_1, u_2} : + helperContinuation3839Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hthetaPair hetaMissing + segmentTrans commonPrefix hierarchyGeometry firstMissing H q A ell B X hAT hell htail hBlen + hXlen hPenVal hLastVal hTlen hXT hAX helem hyp gamma presentationGeometry caseFor + prepareLater rebuild swapStep P1 rho H1 q1 Gamma beta betaOutside betaVertex betaVertexB + betaAtVertex1 betaTail slotData reservedEq gammaOriginal z mu2 hBX prefix2 fixed2 P2 color2 + tau J2 H2 q2 geometry2 prefix2' edges2 betaB2 betaTerminal2 + have betaTail2 : ∀ t : Fin T.length, A.length ≤ t.val → + tau (T.edge t) ≠ some beta := by + intro t ht + rw [show tau = P2.coloring from rfl, color2, fixed2 t ht] + exact betaTail t ht + have thetaA2 : D.theta ∈ TreeMissingColors tau A := by + exact @helper_thetaA2_1497 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) (@hetaStored) + (@hthetaPair) (@hAX) (@P2) (@prefix2') + have thetaStage2 : D.theta ∈ HierarchyStageMissingColors H2 q2 := by + exact @helper_thetaStage2_1503 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@hetaStored) (@hthetaPair) (@gamma) (@slotData) (@P2) + have thetaBeta : D.theta ≠ beta := by + intro he + apply betaOutside + rw [gammaOriginal] + exact Finset.mem_biUnion.mpr ⟨eta, hetaStored, he ▸ hthetaPair⟩ + have thetaTail2 : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + tau (T.edge t) ≠ some D.theta := by + exact @helper_thetaTail2_1514 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@hetaStored) (@hthetaPair) (@hetaMissing) (@firstMissing) (@hPenVal) (@hXT) (@helem) + (@hyp) (@gamma) (@slotData) (@P2) (@geometry2) (@prefix2') + have edgeCast (X Y : TreeSequence G e0) (h : X = Y) (i : Fin X.length) : + X.edge i = Y.edge (Fin.cast (congrArg TreeSequence.length h) i) := by + cases h + rfl + have weakEdges {input' : PartialEdgeColoring E k} + (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) + (base' : HierarchyBase ett' old) (K : TashkinovHierarchy ett' base') + (hST : TreeSequenceInitialSegment (HierarchyStarredStage K (Fin.last K.dividerCount)) T) + (hw : HierarchyWeaklyStable K (Fin.last K.dividerCount) new) + (hp : IsProperEdgeColoring G old) (ho : IsOneEdgeUncolored old e0) + (hnp : IsProperEdgeColoring G new) (hno : IsOneEdgeUncolored new e0) : + ∀ t : Fin T.length, t.val < (HierarchyStarredStage K (Fin.last K.dividerCount)).length → + new (T.edge t) = old (T.edge t) := by + exact @helper_weakEdges_1561 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@edgeCast) (@input') (@old) (@new) (@ett') (@base') + (@K) (@hST) (@hw) (@hp) (@ho) (@hnp) (@hno) + let mu3 := TwoColorComponentSwap G tau D.theta beta z + have betaX2 : beta ∈ TreeMissingColors tau X := + (Finset.mem_biUnion (s := TreeSequenceVertexSet X) + (t := fun v => MissingColors G tau v)).mpr + ⟨betaVertex, TreeSequenceInitialSegmentVertexSetSubset hBX betaVertexB, by + rw [show tau = P2.coloring from rfl, color2, + prefix2 betaVertex (TreeSequenceInitialSegmentVertexSetSubset hBX betaVertexB)] + exact betaAtVertex1⟩ + obtain ⟨path3, dis3, prefix3, stored3, non3⟩ := + prepareLater P2 D.theta beta thetaBeta thetaA2 thetaStage2 betaX2 + thetaTail2 (Or.inr betaTerminal2) + have pairMissing3 : D.theta ∈ TreeMissingColors tau X ∧ beta ∈ TreeMissingColors tau X := by + exact @helper_pairMissing3_1654 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAX) + (@gamma) (@P1) (@beta) (@betaVertex) (@betaVertexB) (@betaAtVertex1) (@hBX) (@prefix2) + (@P2) (@color2) (@thetaA2) + have case3 := caseFor P2 D.theta thetaStage2 + have elementary2 : ColoredVertexSetElementary G tau (TreeSequenceVertexSet X) := by + intro u hu v hv hn + rw [prefix2' u hu, prefix2' v hv] + exact helem hu hv hn + have stable3 := StableChangeCasesOneTwo G k e0 P2.corresponding.replacementInput + T tau J2 P2.replacementBase P2.counterexample P2.minimumContext.proper + P2.minimumContext.oneEdgeUncolored P2.minimumContext.lowerRung + P2.minimumContext.fewerDividers P2.minimumContext.lexicographicMinimality + (by + change ColoredVertexSetElementary G tau (TreeSequenceVertexSet + (HierarchyFullTailPrefix P2.counterexample (HierarchyFullTailLength P2.counterexample - 1))) + rw [geometry2.2.1, geometry2.2.2.1] + exact elementary2) + P2.minimumContext.largeMissingSet D.theta beta thetaBeta + (by + change D.theta ∈ TreeMissingColors tau (HierarchyFullTailPrefix P2.counterexample + (HierarchyFullTailLength P2.counterexample - 1)) ∧ + beta ∈ TreeMissingColors tau (HierarchyFullTailPrefix P2.counterexample + (HierarchyFullTailLength P2.counterexample - 1)) + rw [geometry2.2.1, geometry2.2.2.1] + exact pairMissing3) + z path3 mu3 rfl + (by dsimp only; rcases case3 with h | ⟨hz, hm⟩ + · exact Or.inl h + · exact Or.inr ⟨hz, Or.inl hm⟩) + dis3 + have fixedTail3 : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + mu3 (T.edge t) = tau (T.edge t) := by + intro t ht hx + dsimp only [mu3] + unfold TwoColorComponentSwap + simp only [ite_eq_right (thetaTail2 t ht hx), ite_eq_right (betaTail2 t ht), ite_self] + have fixedCore3 : ∀ t : Fin T.length, t.val < A.length → + mu3 (T.edge t) = tau (T.edge t) := by + exact @helper_fixedCore3_1696 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) + (@beta) (@P2) (@geometry2) (@weakEdges) (@stable3) + have fixedPrefix3 : ∀ t : Fin T.length, t.val < X.length → + mu3 (T.edge t) = tau (T.edge t) := by + intro t ht + by_cases ha : t.val < A.length + · exact fixedCore3 t ha + · exact fixedTail3 t (Nat.le_of_not_gt ha) ht + exact @helper_continuation_4132 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@hetaStored) (@hthetaPair) (@hetaMissing) (@segmentTrans) (@commonPrefix) + (@hierarchyGeometry) (@firstMissing) (@hell) (@htail) (@hBlen) (@hXlen) (@hPenVal) + (@hLastVal) (@hTlen) (@hXT) (@hAX) (@helem) (@hyp) (@gamma) (@presentationGeometry) + (@rebuild) (@swapStep) (@P1) (@beta) (@betaOutside) (@slotData) (@reservedEq) + (@gammaOriginal) (@hBX) (@P2) (@geometry2) (@prefix2') (@edges2) (@betaB2) (@betaTerminal2) + (@thetaA2) (@thetaBeta) (@thetaTail2) (@path3) (@dis3) (@prefix3) (@stored3) (@non3) + (@pairMissing3) (@case3) (@fixedTail3) (@fixedPrefix3) +private theorem helper_continuation_3568.{u_1, u_2} : + helperContinuation3568Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hthetaPair hetaMissing + segmentTrans commonPrefix hierarchyGeometry firstMissing H q A ell B X hAT hell htail hBlen + hXlen hPenVal hLastVal hTlen hXT hAX helem hyp gamma hgamma gammaVertex gammaVertexA + gammaAtVertex hgammaAlpha hgammaTail presentationGeometry seriesProper seriesOne P0 caseFor + prepareLater rebuild swapStep P1 hmu1 hprefix1 hedges1 rho J1 H1 q1 geometry1 Gamma beta + betaOutside betaVertex betaVertexB betaAtVertex1 betaTail + have gammaA1 : gamma ∈ TreeMissingColors rho A := by + refine (Finset.mem_biUnion (s := TreeSequenceVertexSet A) + (t := fun v => MissingColors G rho v)).mpr ⟨gammaVertex, gammaVertexA, ?_⟩ + rw [hprefix1 gammaVertex (TreeSequenceInitialSegmentVertexSetSubset hAX gammaVertexA)] + exact gammaAtVertex + have gammaTerminal1 : gamma ∈ MissingColors G rho (T.vertex D.terminalVertexIndex) := by + exact @helper_gammaTerminal1_1366 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@gamma) (@hgammaAlpha) (@seriesProper) (@seriesOne) (@P1) (@hmu1) + have slotData (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + ∀ c, c ∈ HierarchyStoredColorsAt H q → c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) c = C.good.gamma q c := by + exact @helper_slotData_1373 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have reservedEq + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount)) = + (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := by + exact @helper_reservedEq_1388 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have gammaStage1 : gamma ∈ HierarchyStageMissingColors H1 q1 := by + have hd := slotData P1 D.alpha D.alphaStored + have hm : gamma ∈ P1.counterexample.good.gamma q1 D.alpha := by rw [hd.2]; exact hgamma + exact (Finset.mem_sdiff.mp (P1.counterexample.good.avoidance q1 D.alpha hd.1 hm)).1 + have gammaOriginal : Gamma = + (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := reservedEq P1 + have gammaBeta : gamma ≠ beta := by + intro he + apply betaOutside + exact Finset.mem_biUnion.mpr ⟨D.alpha, (slotData P1 D.alpha D.alphaStored).1, + by rw [(slotData P1 D.alpha D.alphaStored).2, ← he]; exact hgamma⟩ + have gammaTail1 : ∀ t : Fin T.length, A.length ≤ t.val → + rho (T.edge t) ≠ some gamma := by + intro t ht + change P1.coloring (T.edge t) ≠ some gamma + rw [hedges1 t ht] + exact hgammaTail t ht + let z : Sum V E := Sum.inl (T.vertex D.terminalVertexIndex) + let mu2 := TwoColorComponentSwap G rho gamma beta z + have hBX : TreeSequenceInitialSegment B X := + commonPrefix ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + hXT (by rw [hBlen, hXlen]; clear * - T; omega) + have betaX1 : beta ∈ TreeMissingColors rho X := + (Finset.mem_biUnion (s := TreeSequenceVertexSet X) + (t := fun v => MissingColors G rho v)).mpr + ⟨betaVertex, TreeSequenceInitialSegmentVertexSetSubset hBX betaVertexB, betaAtVertex1⟩ + obtain ⟨path2, dis2, prefix2, stored2, non2⟩ := + prepareLater P1 gamma beta gammaBeta gammaA1 gammaStage1 betaX1 + (fun t ht _ => gammaTail1 t ht) (Or.inl gammaTerminal1) + have pairMissing2 : gamma ∈ TreeMissingColors rho X ∧ beta ∈ TreeMissingColors rho X := by + exact @helper_pairMissing2_1439 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hAX) + (@gamma) (@gammaVertex) (@gammaVertexA) (@gammaAtVertex) (@seriesProper) (@seriesOne) + (@P1) (@hprefix1) (@beta) (@betaVertex) (@betaVertexB) (@betaAtVertex1) (@hBX) + have case2 := caseFor P1 gamma gammaStage1 + have fixed2 : ∀ t : Fin T.length, A.length ≤ t.val → + mu2 (T.edge t) = rho (T.edge t) := by + intro t ht + dsimp only [mu2] + unfold TwoColorComponentSwap + simp only [ite_eq_right (gammaTail1 t ht), ite_eq_right (betaTail t ht), ite_self] + obtain ⟨P2, color2⟩ := rebuild P1 mu2 non2 + (StableChangeCasesOneTwoFullTail G k e0 P1.corresponding.replacementInput T rho + J1 P1.replacementBase P1.counterexample P1.minimumContext gamma beta gammaBeta + (by rw [geometry1.2.1, geometry1.2.2.1]; exact pairMissing2) + z path2 mu2 rfl + (by dsimp only; rcases case2 with h | ⟨hz, hm⟩ + · exact Or.inl h + · exact Or.inr ⟨hz, Or.inl hm⟩) + dis2 + (by dsimp only; intro t ht; rw [geometry1.1] at ht; exact fixed2 t ht) + (by intro v hv; rw [geometry1.2.1, geometry1.2.2.1] at hv; exact prefix2 v hv) + stored2).2.2.2.2 + let tau := P2.coloring + let J2 := P2.corresponding.replacementETT + let H2 := P2.counterexample.hierarchy + let q2 := Fin.last H2.dividerCount + have geometry2 := presentationGeometry P2 + have prefix2' : ∀ v ∈ TreeSequenceVertexSet X, + MissingColors G tau v = MissingColors G phi v := by + intro v hv + rw [show tau = P2.coloring from rfl, color2] + exact (prefix2 v hv).trans (hprefix1 v hv) + have edges2 : ∀ t : Fin T.length, A.length ≤ t.val → + tau (T.edge t) = phi (T.edge t) := by + intro t ht + rw [show tau = P2.coloring from rfl, color2] + exact (fixed2 t ht).trans (hedges1 t ht) + have betaB2 : beta ∈ TreeMissingColors tau B := by + exact @helper_betaB2_1479 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@gamma) (@P1) + (@beta) (@betaVertex) (@betaVertexB) (@betaAtVertex1) (@hBX) (@prefix2) (@P2) (@color2) + have betaTerminal2 : beta ∈ MissingColors G tau (T.vertex D.terminalVertexIndex) := by + exact @helper_betaTerminal2_1485 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@gamma) (@P1) (@beta) (@gammaTerminal1) (@gammaBeta) (@P2) (@color2) + exact @helper_continuation_3839 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@hetaStored) (@hthetaPair) (@hetaMissing) (@segmentTrans) (@commonPrefix) + (@hierarchyGeometry) (@firstMissing) (@hAT) (@hell) (@htail) (@hBlen) (@hXlen) (@hPenVal) + (@hLastVal) (@hTlen) (@hXT) (@hAX) (@helem) (@hyp) (@gamma) (@presentationGeometry) + (@caseFor) (@prepareLater) (@rebuild) (@swapStep) (@P1) (@beta) (@betaOutside) + (@betaVertex) (@betaVertexB) (@betaAtVertex1) (@betaTail) (@slotData) (@reservedEq) + (@gammaOriginal) (@hBX) (@prefix2) (@fixed2) (@P2) (@color2) (@geometry2) (@prefix2') + (@edges2) (@betaB2) (@betaTerminal2) +private theorem helper_continuation_3592.{u_1, u_2} : + helperContinuation3592Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hthetaPair hetaMissing + segmentTrans commonPrefix hierarchyGeometry missingMono firstMissing H q A ell B X hAT hell + htail hBlen hXlen hPenVal hLastVal hTlen hXexact hEllone hElllt hXT hAX helem hyp gamma + hgamma hgammaAvoid hgammaA gammaVertex gammaVertexA gammaAtVertex hgammaAlpha hgammaTail + presentationGeometry seriesProper seriesOne P0 caseFor prepareLater + have rebuild + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (mu : PartialEdgeColoring E k) + (hnon : ¬ ColoredVertexSetElementary G mu (TreeSequenceVertexSet T)) + (hsupply : ∃ corr : CorrespondingExtendedTashkinovTree + G k e0 P.corresponding.replacementETT mu T, + MaximumProperty corr.replacementETT ∧ + ∃ b : HierarchyBase corr.replacementETT mu, + ∃ K : TashkinovHierarchy corr.replacementETT b, + ∃ g : GoodHierarchy K, + SameGoodHierarchy P.counterexample.good g) : + ∃ P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + P'.coloring = mu := by + exact @helper_rebuild_1018 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@mu) (@hnon) + (@hsupply) + have swapStep + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (a b : Fin k) (hne : a ≠ b) + (haA : a ∈ TreeMissingColors P.coloring A) + (haStage : a ∈ HierarchyStageMissingColors P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)) + (haTail : ∀ t : Fin T.length, A.length ≤ t.val → + P.coloring (T.edge t) ≠ some a) + (hb : b ∈ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex)) + (hterminal : a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ + b ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex)) + (lastColor : Fin k) + (htheta : P.coloring (T.edge D.lastEdgeIndex) = some lastColor) + (hthetaPresent : lastColor ∉ MissingColors G P.coloring + (T.vertex D.penultimateVertexIndex)) : + ∃ P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + P'.coloring = TwoColorComponentSwap G P.coloring a b + (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P'.coloring v = MissingColors G P.coloring v) ∧ + ∀ t : Fin T.length, A.length ≤ t.val → + P'.coloring (T.edge t) = P.coloring (T.edge t) := by + exact @helper_swapStep_3176 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@missingMono) (@firstMissing) (@hAT) (@hell) (@hBlen) (@hXlen) (@hPenVal) (@hLastVal) + (@hTlen) (@hXexact) (@hEllone) (@hElllt) (@hXT) (@hAX) (@hyp) (@presentationGeometry) + (@caseFor) (@prepareLater) (@rebuild) (@P) (@a) (@b) (@hne) (@haA) (@haStage) (@haTail) + (@hb) (@hterminal) (@lastColor) (@htheta) (@hthetaPresent) + obtain ⟨P1, hmu1, hprefix1, hedges1⟩ := swapStep P0 gamma D.alpha hgammaAlpha + hgammaA hgammaAvoid.1 hgammaTail D.alphaMissingPenultimate + (Or.inr D.alphaMissingTerminal) D.theta D.thetaOnLastEdge D.thetaPresentPenultimate + let rho := P1.coloring + let J1 := P1.corresponding.replacementETT + let H1 := P1.counterexample.hierarchy + let q1 := Fin.last H1.dividerCount + have geometry1 := presentationGeometry P1 + have elementary1 : ColoredVertexSetElementary G rho (TreeSequenceVertexSet X) := by + intro u hu v hv hn + rw [hprefix1 u hu, hprefix1 v hv] + exact helem hu hv hn + let n1 := Fin.last J1.rounds + let Tn1 := J1.series.data.tree n1.castSucc + let extra := (TreeSequenceVertexSet P1.replacementBase.core \ + TreeSequenceVertexSet Tn1).biUnion fun v => MissingColors G rho v + let used := (Finset.univ : Finset (Fin k)).filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ t.val < A.length + (ell - 2) ∧ + rho (T.edge t) = some c + let available := (TreeMissingColors rho B \ extra) \ used + let Gamma := (HierarchyStoredColorsAt H1 q1).biUnion (P1.counterexample.good.gamma q1) + let beforeLast : Fin T.length := ⟨B.length, by + rw [hBlen] + have hp := T.positive + clear * - hp + omega⟩ + let finalColors := (rho (T.edge beforeLast)).toFinset ∪ + (rho (T.edge D.lastEdgeIndex)).toFinset + have hsize : 2 * J1.rounds + 11 ≤ available.card := by + exact @helper_hsize_1264 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hell) (@htail) (@P1) + (@geometry1) (@elementary1) + have hGammaSize : Gamma.card ≤ 2 * J1.rounds := by + exact @helper_hGammaSize_1295 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@gamma) (@P1) + have hFinalSize : finalColors.card ≤ 2 := by + exact @helper_hFinalSize_1306 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@P1) + have hchoice : (available \ (Gamma ∪ finalColors)).Nonempty := by + exact @helper_hchoice_1318 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@P1) + (@hsize) (@hGammaSize) (@hFinalSize) + obtain ⟨beta, hbeta⟩ := hchoice + have betaParts : ((beta ∈ TreeMissingColors rho B ∧ beta ∉ extra) ∧ beta ∉ used) ∧ + (beta ∉ Gamma ∧ beta ∉ finalColors) := by + simpa only [available, Finset.mem_sdiff, Finset.mem_union, not_or] using hbeta + have betaB : beta ∈ TreeMissingColors rho B := betaParts.1.1.1 + have betaOutside : beta ∉ Gamma := betaParts.2.1 + obtain ⟨betaVertex, betaVertexB, betaAtVertex1⟩ := + (Finset.mem_biUnion (s := TreeSequenceVertexSet B) + (t := fun v => MissingColors G rho v)).mp betaB + have betaTail : ∀ t : Fin T.length, A.length ≤ t.val → + rho (T.edge t) ≠ some beta := by + exact @helper_betaTail_1334 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hell) (@htail) + (@hBlen) (@P1) (@beta) (@betaParts) + exact @helper_continuation_3568 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@hetaStored) (@hthetaPair) (@hetaMissing) (@segmentTrans) (@commonPrefix) + (@hierarchyGeometry) (@firstMissing) (@hAT) (@hell) (@htail) (@hBlen) (@hXlen) (@hPenVal) + (@hLastVal) (@hTlen) (@hXT) (@hAX) (@helem) (@hyp) (@gamma) (@hgamma) (@gammaVertex) + (@gammaVertexA) (@gammaAtVertex) (@hgammaAlpha) (@hgammaTail) (@presentationGeometry) + (@seriesProper) (@seriesOne) (@caseFor) (@prepareLater) (@rebuild) (@swapStep) (@P1) + (@hmu1) (@hprefix1) (@hedges1) (@geometry1) (@beta) (@betaOutside) (@betaVertex) + (@betaVertexB) (@betaAtVertex1) (@betaTail) +private theorem helper_prepareLater_5223.{u_1, u_2} : + helperPrepareLater5223Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta commonPrefix hierarchyGeometry + missingMono firstMissing H q A ell B X hAT hBlen hXlen hPenVal hTlen hXT hAX hyp + presentationGeometry caseFor prefixNeTerminal P a b hne haA haStage hbX haTail hterminal + as_aux_lemma => + clear * - P a b hne haA haStage hbX haTail hterminal + presentationGeometry firstMissing missingMono hierarchyGeometry + commonPrefix hAT hXT hAX hXlen hBlen hPenVal hTlen hyp caseFor prefixNeTerminal + let J := P.corresponding.replacementETT + let C' := P.counterexample + let col := P.coloring + let H' := C'.hierarchy + let q' := Fin.last H'.dividerCount + let z : Sum V E := Sum.inl (T.vertex D.terminalVertexIndex) + let mu := TwoColorComponentSwap G col a b z + have hg := presentationGeometry P + have hstar : HierarchyStarredStage C'.hierarchy + (Fin.last C'.hierarchy.dividerCount) = A := hg.1 + have hstar' : HierarchyStarredStage H' q' = A := hstar + have hXeq : HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1) = X := by + rw [hg.2.1] + exact hg.2.2.1 + have hp : IsProperEdgeColoring G col := P.minimumContext.proper + have hxElem : ColoredVertexSetElementary G col (TreeSequenceVertexSet X) := by + exact @helper_hxElem_710 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hXeq) + obtain ⟨vb0, hvbX0, hb0⟩ := Finset.mem_biUnion.mp hbX + obtain ⟨ib, _, hib⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hvbX0 + have hbi : b ∈ MissingColors G col + (T.vertex (Fin.castLE (Nat.succ_le_succ hXT.1) ib)) := by + rw [hXT.2.1 ib, hib] + exact hb0 + have hbFirst := firstMissing col b _ hbi + have hbBound : (HierarchyFirstMissingPosition col T b).val ≤ X.length := + hbFirst.2.trans (Nat.le_of_lt_succ ib.isLt) + obtain ⟨v, hv, hav⟩ := Finset.mem_biUnion.mp haA + obtain ⟨i, _, hiv⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + have hai : a ∈ MissingColors G col + (T.vertex (Fin.castLE (Nat.succ_le_succ hAT.1) i)) := by + rw [hAT.2.1 i, hiv] + exact hav + have haFirst := firstMissing col a _ hai + have haBound : (HierarchyFirstMissingPosition col T a).val ≤ A.length := + le_trans haFirst.2 (Nat.le_of_lt_succ i.isLt) + have haBoundX : (HierarchyFirstMissingPosition col T a).val ≤ X.length := + haBound.trans hAX.1 + let va := T.vertex (HierarchyFirstMissingPosition col T a) + let vb := T.vertex (HierarchyFirstMissingPosition col T b) + let vt := T.vertex D.terminalVertexIndex + have hvaX : va ∈ TreeSequenceVertexSet X := by + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨⟨(HierarchyFirstMissingPosition col T a).val, by + exact Nat.lt_succ_of_le (haBound.trans hAX.1)⟩, Finset.mem_univ _, ?_⟩ + rfl + have hvbX : vb ∈ TreeSequenceVertexSet X := by + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨⟨(HierarchyFirstMissingPosition col T b).val, by + exact Nat.lt_succ_of_le hbBound⟩, Finset.mem_univ _, ?_⟩ + rfl + have horder (hbNotA : b ∉ TreeMissingColors col A) : + (HierarchyFirstMissingPosition col T a).val < + (HierarchyFirstMissingPosition col T b).val := by + exact @helper_horder_761 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hAT) + (@hXT) (@P) (@a) (@b) (@ib) (@hbFirst) (@haBound) (@hbNotA) + have hnorm := caseFor P a haStage + have hmissing : a ∈ TreeMissingColors col X ∧ b ∈ TreeMissingColors col X := + ⟨missingMono hAX col haA, hbX⟩ + have hmissingP : a ∈ TreeMissingColors col + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1)) ∧ + b ∈ TreeMissingColors col + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1)) := by + rw [hXeq] + exact hmissing + have helemP : ColoredVertexSetElementary G col + (TreeSequenceVertexSet (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1))) + := by + rw [hXeq] + exact hxElem + have hchange := ChangeLemma G k e0 P.corresponding.replacementInput T col + J P.replacementBase C' hp P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality + helemP + P.minimumContext.largeMissingSet a b hne + hmissingP + (by + dsimp only + intro hcond + refine ⟨⟨HierarchyFirstMissingPosition col T a, + HierarchyFirstMissingPosition col T b, rfl, rfl, ?_⟩, ?_⟩ + · exact @helper_branch_803 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@a) (@b) (@haA) (@hstar) (@horder) (@hcond) + · intro hc + obtain ⟨t, ht, hhi, hcol⟩ := (Finset.mem_filter.mp hc).2 + exact haTail t (by simpa only [hstar] using ht) + (by clear * - hbBound hhi; omega) hcol) + have hsame : TwoColorComponent G col a b (Sum.inl va) = + TwoColorComponent G col a b (Sum.inl vb) := by + rcases hnorm with ⟨hq, ha⟩ | ⟨hq, ha⟩ + · simpa [va, vb] using hchange.1 ⟨hq, Or.inl ha⟩ + · simpa [va, vb] using hchange.2.1 ⟨hq, Or.inl ha⟩ + have rootMem (w : Sum V E) : w ∈ TwoColorComponent G col a b w := by + change (TwoColorIncidenceGraph G col a b).connectedComponentMk w = _ + rfl + have leaf (w : V) + (hm : a ∈ MissingColors G col w ∨ b ∈ MissingColors G col w) : + ((TwoColorIncidenceGraph G col a b).neighborSet (Sum.inl w)).Subsingleton := by + exact @helper_leaf_820 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@a) (@b) (@hne) + (@hp) (@w) (@hm) + have hdis : Disjoint (TwoColorComponent G col a b z) + (TwoColorComponent G col a b (Sum.inl va)) := by + exact @helper_hdis_841 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) (@hXT) + (@prefixNeTerminal) (@P) (@a) (@b) (@hterminal) (@hp) (@ib) (@hbFirst) (@i) + (@haFirst) (@hvaX) (@hvbX) (@hsame) (@rootMem) (@leaf) + have hpath : TwoColorPathComponent G col a b z := + ⟨hne, z, rootMem z, leaf vt hterminal⟩ + have hbehavior := TwoColorComponentSwapMissingBehavior G col a b hne hp z + have edgeIn {u : V} {e : E} + (hu : Sum.inl u ∈ TwoColorComponent G col a b z) + (he : Incident G u e) (hc : col e = some a ∨ col e = some b) : + Sum.inr e ∈ TwoColorComponent G col a b z := by + have hadj : (TwoColorIncidenceGraph G col a b).Adj (Sum.inr e) (Sum.inl u) := + ⟨he, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hu + have hprefix : ∀ u ∈ TreeSequenceVertexSet X, + MissingColors G mu u = MissingColors G col u := by + exact @helper_hprefix_917 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hAT) (@hXT) (@P) (@a) (@b) (@hne) (@hxElem) (@ib) (@hbFirst) (@i) (@haFirst) + (@hvaX) (@hvbX) (@hsame) (@rootMem) (@hdis) (@hbehavior) (@edgeIn) + have hbNew : b ∈ MissingColors G mu vb := by + rw [hprefix vb hvbX] + exact hbFirst.1 + have hbNewFirst : HierarchyFirstMissingPosition mu T b = + HierarchyFirstMissingPosition col T b := by + exact @helper_hbNewFirst_959 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@firstMissing) (@hXT) (@P) (@a) (@b) (@hxElem) (@ib) (@hbFirst) (@hbBound) (@v) + (@hv) (@hvbX) (@hprefix) (@hbNew) + have hstoredFirst : ∀ c, c ∈ HierarchyStoredColorsAt H' q' → + HierarchyFirstMissingPosition mu T c = HierarchyFirstMissingPosition col T c := by + exact @helper_hstoredFirst_974 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@P) (@a) (@b) (@haA) (@hstar') (@i) (@hbehavior) (@hbNewFirst) + have hnonElem : ¬ ColoredVertexSetElementary G mu (TreeSequenceVertexSet T) := by + exact @helper_hnonElem_997 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hAT) (@hXT) (@prefixNeTerminal) (@P) (@a) (@b) (@hterminal) (@i) (@haFirst) (@hvaX) + (@hvbX) (@rootMem) (@hdis) (@hbehavior) (@hbNew) + exact ⟨hpath, hdis, hprefix, hstoredFirst, hnonElem⟩ + +private theorem helper_continuation_3406.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), D.theta ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → eta ∈ MissingColors G phi (T.vertex + D.penultimateVertexIndex) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b), TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ TreeSequenceInitialSegment + (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last + H.dividerCount))) → ( + ∀ {X Y : TreeSequence G e0}, TreeSequenceInitialSegment X Y → + ∀ (col : PartialEdgeColoring E k), TreeMissingColors col X ⊆ TreeMissingColors col Y) → ( + ∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G col (T.vertex i) → c ∈ MissingColors G col (T.vertex + (HierarchyFirstMissingPosition col T c)) ∧ (↑(HierarchyFirstMissingPosition col T c) : ℕ) + ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → ell = T.length - A.length → (2 : ℕ) ≤ ell → B.length = + T.length - (2 : ℕ) → X.length = T.length - (1 : ℕ) → (↑D.penultimateVertexIndex : ℕ) = + X.length → (↑D.lastEdgeIndex : ℕ) = X.length → X.length + (1 : ℕ) = T.length → X.length = + A.length + (ell - (1 : ℕ)) → (1 : ℕ) ≤ ell - (1 : ℕ) → ell - (1 : ℕ) < ell → + TreeSequenceInitialSegment X T → TreeSequenceInitialSegment A X → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet X) → T.vertex + D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → HierarchyFirstMissingPosition phi T + eta = D.penultimateVertexIndex → HierarchyFirstMissingPosition phi T D.alpha = + D.penultimateVertexIndex → + ∀ gamma ∈ C.good.gamma q D.alpha, D.theta ≠ gamma → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hthetaPair hetaMissing + segmentTrans commonPrefix hierarchyGeometry missingMono firstMissing H q A ell B X hAT hell + htail hBlen hXlen hPenVal hLastVal hTlen hXexact hEllone hElllt hXT hAX helem hyp hetaFirst + alphaFirst gamma hgamma hthetaGamma + have hgammaAvoid := Finset.mem_sdiff.mp + (C.good.avoidance q D.alpha D.alphaStored hgamma) + have hgammaA : gamma ∈ TreeMissingColors phi A := + (GoodHierarchyReservedDisjoint C.good q).1 D.alpha D.alphaStored hgamma + obtain ⟨gammaVertex, gammaVertexA, gammaAtVertex⟩ := + (Finset.mem_biUnion (s := TreeSequenceVertexSet A) + (t := fun v => MissingColors G phi v)).mp hgammaA + have hgammaAlpha : gamma ≠ D.alpha := by + intro he + exact (Finset.mem_sdiff.mp D.alphaStored).2 (he ▸ hgammaA) + have hgammaTail : ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some gamma := by + exact @helper_hgammaTail_497 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@hXlen) (@hPenVal) (@hLastVal) (@hTlen) (@hXexact) (@hetaFirst) (@alphaFirst) (@gamma) + (@hthetaGamma) (@hgammaAvoid) + have starCongr (n m : ℕ) (coreLeft coreRight : TreeSequence G e0) + (stageLeft : Fin (n + 2) → TreeSequence G e0) + (stageRight : Fin (m + 2) → TreeSequence G e0) + (hnm : n = m) (hcore : coreLeft = coreRight) + (hstage : HEq stageLeft stageRight) : + Fin.cases (motive := fun _ => TreeSequence G e0) coreLeft + (fun i : Fin n => stageLeft i.succ.castSucc) (Fin.last n) = + Fin.cases (motive := fun _ => TreeSequence G e0) coreRight + (fun i : Fin m => stageRight i.succ.castSucc) (Fin.last m) := by + subst m + have hs := eq_of_heq hstage + simp [hcore, hs] + have presentationGeometry + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = A ∧ + HierarchyFullTailLength P.counterexample = ell ∧ + HierarchyFullTailPrefix P.counterexample (ell - 1) = X ∧ + HierarchyPathNumber P.counterexample.hierarchy = HierarchyPathNumber H := by + have hs := P.sameGood.1 + have hstar : HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = A := + (starCongr _ _ base.core P.replacementBase.core H.stage + P.counterexample.hierarchy.stage hs.2.1 hs.1 hs.2.2.1).symm + refine ⟨hstar, ?_, ?_, ?_⟩ + · change T.length - _ = ell + rw [hstar] + rfl + · simp only [HierarchyFullTailPrefix, hstar] + rfl + · simp only [HierarchyPathNumber, hstar] + rfl + have seriesProper : ∀ j : Fin (ett.rounds + 1), + IsProperEdgeColoring G (ett.series.data.coloring j) := by + exact @helper_seriesProper_562 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@gamma) + have seriesOne : ∀ j : Fin (ett.rounds + 1), + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + exact @helper_seriesOne_589 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@gamma) + let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := by + exact @helperSelfCorr425 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@seriesProper) (@seriesOne) + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := by + exact @helperP0462 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@seriesProper) (@seriesOne) + have caseFor + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (a : Fin k) + (ha : a ∈ HierarchyStageMissingColors P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)) : + (0 < P.counterexample.hierarchy.dividerCount ∧ + a ∈ TreeMissingColors P.coloring (P.counterexample.hierarchy.stage + ⟨P.counterexample.hierarchy.dividerCount, by omega⟩)) ∨ + (P.counterexample.hierarchy.dividerCount = 0 ∧ + a ∈ TreeMissingColors P.coloring + (P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc)) := by + exact @helper_caseFor_622 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) (@P) (@a) (@ha) + have prefixNeTerminal (u : V) (hu : u ∈ TreeSequenceVertexSet X) : + u ≠ T.vertex D.terminalVertexIndex := by + exact @helper_prefixNeTerminal_656 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hTlen) (@u) (@hu) + have prepareLater + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (a b : Fin k) (hne : a ≠ b) + (haA : a ∈ TreeMissingColors P.coloring A) + (haStage : a ∈ HierarchyStageMissingColors P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)) + (hbX : b ∈ TreeMissingColors P.coloring X) + (haTail : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + P.coloring (T.edge t) ≠ some a) + (hterminal : a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ + b ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex)) : + let mu := TwoColorComponentSwap G P.coloring a b + (Sum.inl (T.vertex D.terminalVertexIndex)) + TwoColorPathComponent G P.coloring a b (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ + Disjoint + (TwoColorComponent G P.coloring a b (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G P.coloring a b + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T a)))) ∧ + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G mu v = MissingColors G P.coloring v) ∧ + (∀ c ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount), + HierarchyFirstMissingPosition mu T c = + HierarchyFirstMissingPosition P.coloring T c) ∧ + ¬ ColoredVertexSetElementary G mu (TreeSequenceVertexSet T) := by + exact @helper_prepareLater_5223 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@commonPrefix) (@hierarchyGeometry) (@missingMono) (@firstMissing) (@hAT) (@hBlen) + (@hXlen) (@hPenVal) (@hTlen) (@hXT) (@hAX) (@hyp) (@presentationGeometry) (@caseFor) + (@prefixNeTerminal) (@P) (@a) (@b) (@hne) (@haA) (@haStage) (@hbX) (@haTail) (@hterminal) + exact @helper_continuation_3592 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@hetaStored) (@hthetaPair) (@hetaMissing) (@segmentTrans) (@commonPrefix) + (@hierarchyGeometry) (@missingMono) (@firstMissing) (@hAT) (@hell) (@htail) (@hBlen) + (@hXlen) (@hPenVal) (@hLastVal) (@hTlen) (@hXexact) (@hEllone) (@hElllt) (@hXT) (@hAX) + (@helem) (@hyp) (@gamma) (@hgamma) (@hgammaAvoid) (@hgammaA) (@gammaVertex) (@gammaVertexA) + (@gammaAtVertex) (@hgammaAlpha) (@hgammaTail) (@presentationGeometry) (@seriesProper) + (@seriesOne) (@caseFor) (@prepareLater) +theorem HierarchySituationTwoSubcaseOneOneStoredException {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneData + G k e0 input T phi ett base C ctx) + (eta : Fin k) + (hetaStored : eta ∈ HierarchyStoredColorsAt C.hierarchy + (Fin.last C.hierarchy.dividerCount)) + (hthetaPair : + D.theta ∈ C.good.gamma (Fin.last C.hierarchy.dividerCount) eta) + (hetaMissing : + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + False := by + classical + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + exact @helper_segmentTrans_302 (@V) (@E) (@G) (@e0) (@X) (@Y) (@Z) (@hXY) (@hYZ) + have commonPrefix {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + exact @helper_commonPrefix_311 (@V) (@E) (@G) (@e0) (@X) (@Y) (@Z) (@hXZ) (@hYZ) (@hXY) + have hierarchyGeometry + {inp col : PartialEdgeColoring E k} + {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b) : + TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ + TreeSequenceInitialSegment + (J.series.data.tree (Fin.last J.rounds).castSucc) + (HierarchyStarredStage H (Fin.last H.dividerCount)) := by + exact @helper_hierarchyGeometry_320 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@segmentTrans) (@inp) (@col) (@J) (@b) (@H) + have missingMono {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) (col : PartialEdgeColoring E k) : + TreeMissingColors col X ⊆ TreeMissingColors col Y := by + intro c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hcv⟩ + have firstMissing (col : PartialEdgeColoring E k) (c : Fin k) + (i : Fin (T.length + 1)) (hc : c ∈ MissingColors G col (T.vertex i)) : + c ∈ MissingColors G col + (T.vertex (HierarchyFirstMissingPosition col T c)) ∧ + (HierarchyFirstMissingPosition col T c).val ≤ i.val := by + exact @helper_firstMissing_387 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@col) (@c) (@i) (@hc) + let H := C.hierarchy + let q := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (ell - 2) + let X := HierarchyFullTailPrefix C (ell - 1) + have hAT : TreeSequenceInitialSegment A T := (hierarchyGeometry H).1 + have hell : ell = T.length - A.length := rfl + have htail : 2 ≤ ell := D.tailAtLeastTwo + have hBlen : B.length = T.length - 2 := by + change min (A.length + (ell - 2)) T.length = T.length - 2 + rw [hell] + omega + have hXlen : X.length = T.length - 1 := by + change min (A.length + (ell - 1)) T.length = T.length - 1 + rw [hell] + omega + have hPenVal : D.penultimateVertexIndex.val = X.length := by + rw [hXlen] + have hp := D.penultimateVertexPosition + omega + have hLastVal : D.lastEdgeIndex.val = X.length := by + rw [hXlen] + have hp := D.lastEdgePosition + omega + have hTlen : X.length + 1 = T.length := by + rw [hXlen] + have hp := T.positive + omega + have hXexact : X.length = A.length + (ell - 1) := by + rw [hXlen] + omega + have hEllone : 1 ≤ ell - 1 := by omega + have hElllt : ell - 1 < ell := by omega + have hXT : TreeSequenceInitialSegment X T := + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + have hAX : TreeSequenceInitialSegment A X := + commonPrefix hAT hXT (by rw [hXlen]; omega) + have hAB : TreeSequenceInitialSegment A B := + commonPrefix hAT + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + (by rw [hBlen]; omega) + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet X) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have hyp : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X := by + exact @helper_hyp_446 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hXlen) (@hPenVal) + have uniquePenultimate (c : Fin k) + (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by + exact @helper_uniquePenultimate_456 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@firstMissing) (@hXlen) (@hPenVal) (@hLastVal) (@hXexact) (@helem) (@hyp) (@c) (@hc) + have hetaFirst := uniquePenultimate eta hetaMissing + have alphaFirst := uniquePenultimate D.alpha D.alphaMissingPenultimate + have hcard : (C.good.gamma q D.alpha).card = 2 := + C.good.twoColors q D.alpha D.alphaStored + obtain ⟨gamma, hgamma, hthetaGamma⟩ : + ∃ gamma, gamma ∈ C.good.gamma q D.alpha ∧ D.theta ≠ gamma := by + by_contra hn + push Not at hn + have hsubset : C.good.gamma q D.alpha ⊆ {D.theta} := by + intro c hc + simp only [Finset.mem_singleton] + exact (hn c hc).symm + have hle := Finset.card_le_card hsubset + simp only [Finset.card_singleton] at hle + omega + exact @helper_continuation_3406 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@hetaStored) (@hthetaPair) (@hetaMissing) (@segmentTrans) (@commonPrefix) + (@hierarchyGeometry) (@missingMono) (@firstMissing) (@hAT) (@hell) (@htail) (@hBlen) + (@hXlen) (@hPenVal) (@hLastVal) (@hTlen) (@hXexact) (@hEllone) (@hElllt) (@hXT) (@hAX) + (@helem) (@hyp) (@hetaFirst) (@alphaFirst) (@gamma) (@hgamma) (@hthetaGamma) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean new file mode 100644 index 0000000000..80b6d6681f --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean @@ -0,0 +1,3188 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Hierarchy Situation Two Subcase One Two + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperHfixedOne2200Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment B T → (H.dividerCount = (0 : ℕ) + → A = base.core) → TreeSequenceInitialSegment A T → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some D.gammaOne) → ( + ∀ (t : Fin ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + i) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length ≤ T.length) ↦ + by omega + )) (HierarchyFullTailLength C - (1 : ℕ))).length), (HierarchyStarredStage H (Fin.last + H.dividerCount)).length ≤ (↑t : ℕ) → (↑t : ℕ) < (HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (HierarchyFullTailLength C - (1 : ℕ)) → phi (((fun (i : ℕ) ↦ + TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length ≤ T.length) ↦ + by omega + )) (HierarchyFullTailLength C - (1 : ℕ))).edge t) = some D.alpha → H.dividerCount = (0 : ℕ) ∧ + base.core = ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ (↑t : ℕ) = + (HierarchyStarredStage H (Fin.last H.dividerCount)).length ∧ + ∃ (f : E), TashkinovSeriesStep G k ett.rounds e0 input ett.series.data (Fin.last ett.rounds) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ ((fun (i : ℕ) + ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length ≤ T.length) ↦ + by omega + )) (HierarchyFullTailLength C - (1 : ℕ))).edge t = f ∧ phi f = some D.alpha ∧ D.alpha ∈ + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.gammaOne D.alpha z; ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q muOne ∧ + ModColoring ett muOne ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A muOne), + MaximumProperty ettA) ∧ ((0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A muOne) + (baseA : HierarchyBase ettA muOne) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), MaximumProperty ettA ∧ ettA.series.data.kind (Fin.last ettA.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = base.core ∧ baseA.closure + = base.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G muOne Tnq (Dnq.biUnion (C.good.gamma (⟨C.hierarchy.dividerCount + - (1 : ℕ), + by omega + ⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ))))))) → ( + ∀ (X : TreeSequence G e0), TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → Incident G + (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → ( + ∀ (rho : PartialEdgeColoring E k) (c : Fin k) (v : V), c ∈ MissingColors G rho v → + ∀ (e : E), Incident G v e → rho e ≠ some c) → ( + ∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) (ett' : + ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) (K : + TashkinovHierarchy ett' base'), HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → StableColoring (ett'.series.data.tree (Fin.last + ett'.rounds).castSucc) (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho + sigma) → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t) + +private abbrev helperHfixedTailTwo2433Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment B T → (H.dividerCount = (0 : ℕ) + → A = base.core) → TreeSequenceInitialSegment A T → ( + ∀ {c : Fin k}, c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ + TreeMissingColors phi A) → ( + ∀ (t : Fin ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + i) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length ≤ T.length) ↦ + by omega + )) (HierarchyFullTailLength C - (1 : ℕ))).length), (HierarchyStarredStage H (Fin.last + H.dividerCount)).length ≤ (↑t : ℕ) → (↑t : ℕ) < (HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (HierarchyFullTailLength C - (1 : ℕ)) → phi (((fun (i : ℕ) ↦ + TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length ≤ T.length) ↦ + by omega + )) (HierarchyFullTailLength C - (1 : ℕ))).edge t) = some D.theta → H.dividerCount = (0 : ℕ) ∧ + base.core = ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ (↑t : ℕ) = + (HierarchyStarredStage H (Fin.last H.dividerCount)).length ∧ + ∃ (f : E), TashkinovSeriesStep G k ett.rounds e0 input ett.series.data (Fin.last ett.rounds) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ ((fun (i : ℕ) + ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length ≤ T.length) ↦ + by omega + )) (HierarchyFullTailLength C - (1 : ℕ))).edge t = f ∧ phi f = some D.theta ∧ D.theta ∈ + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.gammaOne D.alpha z; ( + ∀ (X : TreeSequence G e0), TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → ( + ∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) (ett' : + ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) (K : + TashkinovHierarchy ett' base'), HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → StableColoring (ett'.series.data.tree (Fin.last + ett'.rounds).castSucc) (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho + sigma) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), POne.coloring = + muOne → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring + := POne.corresponding.replacementETT; + let baseOne' : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some D.gammaOne) → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho D.gammaOne D.theta z; ( + let H : TashkinovHierarchy ettOne baseOne' := COne'.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ettOne.rounds + (1 : ℕ)) := Fin.last ettOne.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ettOne.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q muTwo ∧ + ModColoring ettOne muTwo ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A muTwo), + MaximumProperty ettA) ∧ ((0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A muTwo) + (baseA : HierarchyBase ettA muTwo) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), MaximumProperty ettA ∧ ettA.series.data.kind (Fin.last ettA.rounds) = + ettOne.series.data.kind (Fin.last ettOne.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = baseOne'.core ∧ + baseA.closure = baseOne'.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = COne'.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G muTwo Tnq (Dnq.biUnion (COne'.good.gamma + (⟨COne'.hierarchy.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin (COne'.hierarchy.dividerCount + (1 : ℕ))))))) → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < B.length → muTwo (T.edge t) = rho + (T.edge t) + +private abbrev helperContinuation1912Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment + B T → (H.dividerCount = (0 : ℕ) → A = base.core) → TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet + B → ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → ( + ∀ {c : Fin k}, c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ + TreeMissingColors phi A) → D.gammaOne ∈ TreeMissingColors phi A → D.gammaOne ≠ D.theta → + D.gammaOne ≠ D.alpha → ( + ∀ (t : Fin ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + i) T.length) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + ) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + )) (HierarchyFullTailLength C - (1 : ℕ))).length), (HierarchyStarredStage H (Fin.last + H.dividerCount)).length ≤ (↑t : ℕ) → (↑t : ℕ) < (HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (HierarchyFullTailLength C - (1 : ℕ)) → phi (((fun (i : ℕ) ↦ + TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + ) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + )) (HierarchyFullTailLength C - (1 : ℕ))).edge t) = some D.theta → H.dividerCount = (0 : ℕ) ∧ + base.core = ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ (↑t : ℕ) = + (HierarchyStarredStage H (Fin.last H.dividerCount)).length ∧ + ∃ (f : E), TashkinovSeriesStep G k ett.rounds e0 input ett.series.data (Fin.last ett.rounds) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ ((fun (i : ℕ) + ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + ) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + )) (HierarchyFullTailLength C - (1 : ℕ))).edge t = f ∧ phi f = some D.theta ∧ D.theta ∈ + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some D.gammaOne) → ( + ∀ (t : Fin ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + i) T.length) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + ) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + )) (HierarchyFullTailLength C - (1 : ℕ))).length), (HierarchyStarredStage H (Fin.last + H.dividerCount)).length ≤ (↑t : ℕ) → (↑t : ℕ) < (HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (HierarchyFullTailLength C - (1 : ℕ)) → phi (((fun (i : ℕ) ↦ + TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + ) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + )) (HierarchyFullTailLength C - (1 : ℕ))).edge t) = some D.alpha → H.dividerCount = (0 : ℕ) ∧ + base.core = ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ (↑t : ℕ) = + (HierarchyStarredStage H (Fin.last H.dividerCount)).length ∧ + ∃ (f : E), TashkinovSeriesStep G k ett.rounds e0 input ett.series.data (Fin.last ett.rounds) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ ((fun (i : ℕ) + ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + ) ( + by + have := TreeSequence.positive T + have := + TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := TreeSequence.positive T + omega + )) (HierarchyFullTailLength C - (1 : ℕ))).edge t = f ∧ phi f = some D.alpha ∧ D.alpha ∈ + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → ( + ∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ X.length) → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + D.gammaOne ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T + D.gammaOne)) ∧ (↑(HierarchyFirstMissingPosition phi T D.gammaOne) : ℕ) ≤ A.length → + T.vertex ig ∈ TreeSequenceVertexSet B → (0 : ℕ) < H.dividerCount ∧ D.gammaOne ∈ + TreeMissingColors phi (H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ D.gammaOne ∈ + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) → D.gammaOne ∈ + TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → TwoColorComponent G phi + D.gammaOne D.alpha (Sum.inl (T.vertex ig)) = TwoColorComponent G phi D.gammaOne D.alpha + (Sum.inl (T.vertex D.penultimateVertexIndex)) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b + (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho + a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u))) → T.vertex ig ≠ T.vertex + D.penultimateVertexIndex → T.vertex ig ≠ T.vertex D.terminalVertexIndex → False + +private abbrev helperContinuation2860Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment + B T → (H.dividerCount = (0 : ℕ) → A = base.core) → TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet + B → ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → ( + ∀ {c : Fin k}, c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ + TreeMissingColors phi A) → D.gammaOne ∈ TreeMissingColors phi A → D.gammaOne ≠ D.theta → ( + ∀ (t : Fin ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + i) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length ≤ T.length) ↦ + by omega + )) (HierarchyFullTailLength C - (1 : ℕ))).length), (HierarchyStarredStage H (Fin.last + H.dividerCount)).length ≤ (↑t : ℕ) → (↑t : ℕ) < (HierarchyStarredStage H (Fin.last + H.dividerCount)).length + (HierarchyFullTailLength C - (1 : ℕ)) → phi (((fun (i : ℕ) ↦ + TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length ≤ T.length) ↦ + by omega + )) (HierarchyFullTailLength C - (1 : ℕ))).edge t) = some D.theta → H.dividerCount = (0 : ℕ) ∧ + base.core = ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ (↑t : ℕ) = + (HierarchyStarredStage H (Fin.last H.dividerCount)).length ∧ + ∃ (f : E), TashkinovSeriesStep G k ett.rounds e0 input ett.series.data (Fin.last ett.rounds) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ ((fun (i : ℕ) + ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this_2 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by omega + ) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length ≤ T.length) ↦ + by omega + )) (HierarchyFullTailLength C - (1 : ℕ))).edge t = f ∧ phi f = some D.theta ∧ D.theta ∈ + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some D.gammaOne) → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + D.gammaOne ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T + D.gammaOne)) ∧ (↑(HierarchyFirstMissingPosition phi T D.gammaOne) : ℕ) ≤ A.length → + T.vertex ig ∈ TreeSequenceVertexSet B → D.gammaOne ∈ TreeMissingColors phi B ∧ D.alpha ∈ + TreeMissingColors phi B → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b + (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho + a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u))) → T.vertex ig ≠ T.vertex + D.penultimateVertexIndex → T.vertex ig ≠ T.vertex D.terminalVertexIndex → T.vertex + D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.gammaOne D.alpha z; ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), u ∈ TreeSequenceVertexSet B → v ∈ TreeSequenceVertexSet B → a ∈ MissingColors G + rho u → b ∈ MissingColors G rho v → Sum.inl u ∉ TwoColorComponent G rho a b z → Sum.inl v + ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → ( + ∀ (X : TreeSequence G e0), TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → Incident G + (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → ( + ∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) (ett' : + ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) (K : + TashkinovHierarchy ett' base'), HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → StableColoring (ett'.series.data.tree (Fin.last + ett'.rounds).castSucc) (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho + sigma) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → ( + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho B → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G rho → c ≠ a + → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c) → D.gammaOne ∈ MissingColors G muOne (T.vertex + D.terminalVertexIndex) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), POne.coloring = + muOne → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 : + ℕ)) = B) → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring + := POne.corresponding.replacementETT; + let baseOne' : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let ctxOne : HierarchyMinimumCounterexampleContext G k e0 POne.corresponding.replacementInput + T POne.coloring POne.corresponding.replacementETT POne.replacementBase POne.counterexample + := POne.minimumContext; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G rho v = MissingColors G phi v) → False + +private theorem helper_hBT_109.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment B T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C B hBlen + refine ⟨?_, ?_, ?_⟩ + · omega + · intro i + rfl + · intro i + rfl + +private theorem helper_hApositive_116.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; (0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hq + have hi : q = (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp [q] + omega + change HierarchyStarredStage H q = _ + rw [hi] + simp only [HierarchyStarredStage, Fin.cases_succ] + congr 1 + apply Fin.ext + simp + omega + +private theorem helper_hAT_134.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; ((0 : ℕ) < H.dividerCount → A = + H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hApositive hAzero + by_cases hz : H.dividerCount = 0 + · have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by apply Fin.ext; simp [hz] + simpa [hAzero hz, hi, H.terminalStage] using H.coreInsideFirst + · rw [hApositive (Nat.pos_of_ne_zero hz)] + have hi : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + q.castSucc := Fin.ext rfl + have hj : H.stage q.succ = T := by + convert H.terminalStage using 1 + congr 1 + simpa only [hi, hj] using H.nested q + +private theorem helper_hAB_146.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → B.length + (1 : ℕ) = T.length → ((0 : ℕ) < H.dividerCount + → A = H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → TreeSequenceInitialSegment A B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A B htail hBlen hApositive hAzero hAT + refine ⟨by omega, ?_, ?_⟩ + · intro i + exact hAT.2.1 i + · intro i + exact hAT.2.2 i + +private theorem helper_hBterminal_152.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment B T → B.vertex (Fin.last + B.length) = T.vertex D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hBT + rw [← hBT.2.1 (Fin.last B.length)] + congr 1 + apply Fin.ext + have hp := D.penultimateVertexPosition + simp only [Fin.val_castLE, Fin.val_last] + omega + +private theorem helper_firstAt_166.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet + B → ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + ∀ {c : Fin k}, c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hyB hElementary c hc + let candidates := Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex i) + have hy : D.penultimateVertexIndex ∈ candidates := by simp [candidates, hc] + have hn : candidates.Nonempty := ⟨_, hy⟩ + have hmin := Finset.min'_le candidates _ hy + have hm : c ∈ MissingColors G phi (T.vertex (candidates.min' hn)) := + (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hmem : T.vertex (candidates.min' hn) ∈ TreeSequenceVertexSet B := by + let j : Fin (B.length + 1) := ⟨(candidates.min' hn).val, by + have hp := D.penultimateVertexPosition + change (candidates.min' hn).val ≤ D.penultimateVertexIndex.val at hmin + omega⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨j, ?_⟩ + rfl + have heq : candidates.min' hn = D.penultimateVertexIndex := by + by_contra hne + have hvne := fun h => hne (T.vertex_injective h) + exact Finset.disjoint_left.mp (hElementary hmem hyB hvne) hm hc + simpa only [HierarchyFirstMissingPosition, candidates, dite_eq_left hn] using heq + +private theorem helper_hnotA_191.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → ((0 : ℕ) < H.dividerCount → A = H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → TreeSequenceInitialSegment A B → T.vertex + D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → ColoredVertexSetElementary G phi + (TreeSequenceVertexSet B) → HierarchyFirstMissingPosition phi T D.theta = + D.penultimateVertexIndex → + ∀ {c : Fin k}, c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ + TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hApositive hAzero hAT hAB + hyB hElementary hfirstTheta c hc ha + rcases Finset.mem_biUnion.mp ha with ⟨v, hv, hvc⟩ + have hvB := TreeSequenceInitialSegmentVertexSetSubset hAB hv + have hvne : v ≠ T.vertex D.penultimateVertexIndex := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨i, rfl⟩ + intro he + have hi := T.vertex_injective ((hAT.2.1 i).trans he) + have hp := D.penultimateVertexPosition + have hib := i.isLt + have hiv := congrArg Fin.val hi + simp only [Fin.val_castLE] at hiv + omega + exact Finset.disjoint_left.mp (hElementary hvB hyB hvne) hvc hc + +private theorem helper_hgammaUnused_232.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; HierarchyFirstMissingPosition phi T + D.alpha = D.penultimateVertexIndex → HierarchyFirstMissingPosition phi T D.theta = + D.penultimateVertexIndex → D.gammaOne ∈ C.good.gamma q D.alpha → D.gammaOne ≠ D.theta → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some D.gammaOne := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hfirstAlpha hfirstTheta hgammaPair + hgammaTheta t ht he + by_cases hlast : t = D.lastEdgeIndex + · rw [hlast, D.thetaOnLastEdge] at he + exact hgammaTheta (Option.some.inj he).symm + · have hav := (Finset.mem_sdiff.mp + (C.good.avoidance q D.alpha D.alphaStored hgammaPair)).2 + apply hav + unfold HierarchySegmentColors + simp only + have hend : H.stage q.succ = T := by + convert H.terminalStage using 1 + congr 1 + rw [hend, hfirstAlpha] + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, t, ht, ?_, he⟩ + have hp := D.penultimateVertexPosition + have hl := D.lastEdgePosition + have hvne : t.val ≠ D.lastEdgeIndex.val := fun he => hlast (Fin.ext he) + have hb := t.isLt + omega + +private theorem helper_firstWitness_262.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length := by + classical + intro V E _ _ G k e0 T rho X hXT c hc + let _ := Fintype.ofFinite V + rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hvc⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨i, rfl⟩ + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex j) + have hi : Fin.castLE (Nat.succ_le_succ hXT.1) i ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [hXT.2.1 i] + exact hvc + have hn : candidates.Nonempty := ⟨_, hi⟩ + have hm := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hle := Finset.min'_le candidates _ hi + have hib := i.isLt + unfold HierarchyFirstMissingPosition + change (c ∈ MissingColors G rho (T.vertex (if h : candidates.Nonempty then + candidates.min' h else Fin.last T.length))) ∧ _ + rw [dite_eq_left hn] + refine ⟨hm, ?_⟩ + change (candidates.min' hn).val ≤ i.val at hle + omega + +private theorem helper_hcase_297.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; D.gammaOne ∈ + HierarchyStageMissingColors H q → (0 : ℕ) < H.dividerCount ∧ D.gammaOne ∈ + TreeMissingColors phi (H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ D.gammaOne ∈ + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q hgammaStage + by_cases hz : H.dividerCount = 0 + · right + refine ⟨hz, ?_⟩ + have hi : q = 0 := by apply Fin.ext; simp [q, hz] + simp only [hi, HierarchyStageMissingColors, Fin.cases] at hgammaStage + convert hgammaStage using 1; congr 2 + · left + refine ⟨Nat.pos_of_ne_zero hz, ?_⟩ + have hi : q = (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp [q] + omega + have hg := hgammaStage + rw [hi] at hg + simp only [HierarchyStageMissingColors, Fin.castSucc_succ, Fin.succ_mk, Fin.cases_succ', + Fin.castSucc_mk] at hg + convert hg using 1; congr 2; apply Fin.ext; simp; omega + +private theorem helper_leaf_350.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ G k rho a b hne hp v hm + let _ := Fintype.ofFinite V + have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G rho a b) + (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with ha | hb + · exact MissingColorIncidenceEndpoint G rho a b hne hp v ha + · have he : TwoColorIncidenceGraph G rho a b = TwoColorIncidenceGraph G rho b a := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + rw [he] + exact MissingColorIncidenceEndpoint G rho b a hne.symm hp v hb + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx y hy + exact Finset.card_le_one_iff.mp hd + (by simpa [SimpleGraph.mem_neighborFinset] using hx) + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + +private theorem helper_separate_369.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ), ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton) → + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b + (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho + a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u)) := by + classical + intro V E _ _ G k self leaf rho a b hne hp u v w huv huw hvw hu hv hw hsame + let _ := Fintype.ofFinite V + rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd + · exfalso + obtain ⟨s, t, p, hpPath, hsupport⟩ := + TwoColorComponentSpanningPath G rho a b hp (Sum.inl w) + have ends (x : V) (hx : Sum.inl x ∈ TwoColorComponent G rho a b (Sum.inl w)) + (hm : a ∈ MissingColors G rho x ∨ b ∈ MissingColors G rho x) : + Sum.inl x = s ∨ Sum.inl x = t := by + by_contra hnot + push Not at hnot + have hs : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {z | z ∈ p.support} + rw [hsupport] + exact hx + exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet + hnot.1 hnot.2 (leaf rho a b hne hp x hm) hs + have hue := ends u (he ▸ self rho a b u) (Or.inl hu) + have hve := ends v (by rw [he, hsame]; exact self rho a b v) (Or.inr hv) + have hwe := ends w (self rho a b w) hw + rcases hue with hu | hu <;> rcases hve with hv | hv <;> rcases hwe with hw | hw + all_goals first + | exact huv (Sum.inl.inj (hu.trans hv.symm)) + | exact huw (Sum.inl.inj (hu.trans hw.symm)) + | exact hvw (Sum.inl.inj (hv.trans hw.symm)) + · exact hd + +private theorem helper_hgy_403.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; (2 : ℕ) ≤ T.length - A.length → ((0 : + ℕ) < H.dividerCount → A = H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (H.dividerCount = (0 : ℕ) → A = base.core) → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → D.gammaOne ≠ + D.theta → D.gammaOne ≠ D.alpha → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + D.gammaOne ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T + D.gammaOne)) ∧ (↑(HierarchyFirstMissingPosition phi T D.gammaOne) : ℕ) ≤ A.length → (0 : + ℕ) < H.dividerCount ∧ D.gammaOne ∈ TreeMissingColors phi (H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ D.gammaOne ∈ + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) → ( + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ Disjoint (insert D.gammaOne ({ D.alpha } : + Finset (Fin k)) : Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ Disjoint (insert D.gammaOne ({ D.alpha } : Finset + (Fin k)) : Finset (Fin k)) Dn) → sameComponent) ∧ (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → sameComponent ∧ + TreeInterchangeable G A phi D.gammaOne D.alpha)) → T.vertex ig ≠ T.vertex + D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail hApositive hAzero hfirstTheta + hgammaTheta hgammaAlpha ig hfirstGamma hcase hchange he + have hi := congrArg Fin.val (T.vertex_injective he) + have hp := D.penultimateVertexPosition + have hg : ig.val ≤ A.length := hfirstGamma.2 + omega + +private theorem helper_hgt_409.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; (2 : ℕ) ≤ T.length - A.length → ((0 : + ℕ) < H.dividerCount → A = H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (H.dividerCount = (0 : ℕ) → A = base.core) → D.gammaOne + ≠ D.theta → D.gammaOne ≠ D.alpha → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; + D.gammaOne ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T + D.gammaOne)) ∧ (↑(HierarchyFirstMissingPosition phi T D.gammaOne) : ℕ) ≤ A.length → (0 : + ℕ) < H.dividerCount ∧ D.gammaOne ∈ TreeMissingColors phi (H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ D.gammaOne ∈ + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) → ( + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = + TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ + (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ Disjoint (insert D.gammaOne ({ D.alpha } : + Finset (Fin k)) : Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ + (D.gammaOne ∈ TreeMissingColors phi Tn ∨ Disjoint (insert D.gammaOne ({ D.alpha } : Finset + (Fin k)) : Finset (Fin k)) Dn) → sameComponent) ∧ (D.gammaOne ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → sameComponent ∧ + TreeInterchangeable G A phi D.gammaOne D.alpha)) → T.vertex ig ≠ T.vertex + D.terminalVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail hApositive hAzero hgammaTheta + hgammaAlpha ig hfirstGamma hcase hchange he + have hi := congrArg Fin.val (T.vertex_injective he) + have hp := D.terminalVertexPosition + have hg : ig.val ≤ A.length := hfirstGamma.2 + omega + +private theorem helper_hyt_415.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hfirstTheta he + have hi := congrArg Fin.val (T.vertex_injective he) + have hp := D.penultimateVertexPosition + have ht := D.terminalVertexPosition + omega + +private theorem helper_prefixMissing_439.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), u ∈ TreeSequenceVertexSet B → v ∈ TreeSequenceVertexSet B → a ∈ MissingColors G + rho u → b ∈ MissingColors G rho v → Sum.inl u ∉ TwoColorComponent G rho a b z → Sum.inl v + ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B z rho a b hne hp helem u v huB hvB hu + hv hdu hdv + have behavior := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + intro w hwB + by_cases hw : Sum.inl w ∈ TwoColorComponent G rho a b z + · have hwa : a ∉ MissingColors G rho w := by + intro hm + have hwu : w ≠ u := fun he => hdu (he ▸ hw) + exact Finset.disjoint_left.mp (helem hwB huB hwu) hm hu + have hwb : b ∉ MissingColors G rho w := by + intro hm + have hwv : w ≠ v := fun he => hdv (he ▸ hw) + exact Finset.disjoint_left.mp (helem hwB hvB hwv) hm hv + have presentSwapped (c d : Fin k) + (hd : d ∉ MissingColors G rho w) + (hdab : (d = a ∧ c = b) ∨ (d = b ∧ c = a)) : + c ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by + have hpres : d ∈ PresentColors G rho w := by simpa [MissingColors] using hd + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpres + rcases hpres with ⟨e, hwe, he⟩ + have hadj : (TwoColorIncidenceGraph G rho a b).Adj (Sum.inr e) (Sum.inl w) := by + simp only [TwoColorIncidenceGraph] + exact ⟨hwe, hdab.elim (fun h => Or.inl (he.trans (congrArg some h.1))) + (fun h => Or.inr (he.trans (congrArg some h.1)))⟩ + have heC : Sum.inr e ∈ TwoColorComponent G rho a b z := by + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = _ at hw + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inr e) = _ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hw + have heSwap : TwoColorComponentSwap G rho a b z e = some c := by + rcases hdab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · simp [TwoColorComponentSwap, heC, he] + · simp [TwoColorComponentSwap, heC, he] + have hpresent : c ∈ PresentColors G (TwoColorComponentSwap G rho a b z) w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, heSwap⟩ + simpa [MissingColors] using hpresent + have hnewa := presentSwapped a b hwb (Or.inr ⟨rfl, rfl⟩) + have hnewb := presentSwapped b a hwa (Or.inl ⟨rfl, rfl⟩) + apply Finset.ext + intro c + by_cases hca : c = a + · subst c + simp only [hnewa, hwa] + · by_cases hcb : c = b + · subst c + simp only [hnewb, hwb] + · exact behavior.2.2.2 w c hca hcb + · exact behavior.1 w hw + +private theorem helper_predecessorIncident_507.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (e0 : E) (T + X : TreeSequence G e0), TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t) := by + classical + intro V E _ _ G e0 T X hXT t ht + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨i, hi⟩ := T.attaches t + let j : Fin (X.length + 1) := ⟨i.val, by have hib := i.isLt; omega⟩ + refine ⟨X.vertex j, ?_, ?_⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + · have hvertices : X.vertex j = + T.vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ t.isLt))) := by + rw [← hXT.2.1 j] + rfl + rw [hvertices] + change _ ∈ G.ends (T.edge t) + rw [hi] + exact Sym2.mem_mk_right _ _ + +private theorem helper_terminalIncident_524.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D + obtain ⟨i, hi⟩ := T.attaches D.lastEdgeIndex + have hj : D.lastEdgeIndex.succ = D.terminalVertexIndex := by + apply Fin.ext + have hl := D.lastEdgePosition + have ht := D.terminalVertexPosition + simp only [Fin.val_succ] + omega + change _ ∈ G.ends (T.edge D.lastEdgeIndex) + rw [hi, hj] + exact Sym2.mem_mk_left _ _ + +private theorem helper_missingNotColored_535.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (rho : PartialEdgeColoring E k) (c : Fin k) (v : V), c ∈ MissingColors G rho v → + ∀ (e : E), Incident G v e → rho e ≠ some c := by + classical + intro V E _ _ G k rho c v hm e hi he + let _ := Fintype.ofFinite V + have hnot : c ∉ PresentColors G rho v := (Finset.mem_sdiff.mp hm).2 + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hi, he⟩ + +private theorem helper_seedStable_543.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) (ett' : + ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) (K : + TashkinovHierarchy ett' base'), HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → StableColoring (ett'.series.data.tree (Fin.last + ett'.rounds).castSucc) (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho + sigma := by + classical + intro V E _ _ _ _ G k e0 T input' rho sigma ett' base' K hw hq + have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := by + apply Fin.ext + simp [hq] + rw [hi] at hw + change (if ett'.series.data.kind (Fin.last ett'.rounds) = + some TashkinovExtensionKind.PE then _ else _) at hw + split_ifs at hw with hpe + · exact hw.1 + · exact hw + +private theorem helper_firstPreserved_590.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment B T → ( + ∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ X.length) → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho B → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C B hBT firstWitness rho sigma c hmiss hc + have hr := firstWitness rho B hBT c hc + have hc' : c ∈ TreeMissingColors sigma B := by + rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hm⟩ + exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ + have hs := firstWitness sigma B hBT c hc' + let cr := Finset.univ.filter fun i : Fin (T.length + 1) => c ∈ MissingColors G rho (T.vertex i) + let cs := Finset.univ.filter fun i : Fin (T.length + 1) => c ∈ MissingColors G sigma (T.vertex i) + have hrmem : HierarchyFirstMissingPosition rho T c ∈ cr := by simp [cr, hr.1] + have hsmem : HierarchyFirstMissingPosition sigma T c ∈ cs := by simp [cs, hs.1] + have hrn : cr.Nonempty := ⟨_, hrmem⟩ + have hsn : cs.Nonempty := ⟨_, hsmem⟩ + have pref (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : + T.vertex i ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have hrSigma : HierarchyFirstMissingPosition rho T c ∈ cs := by + simp only [cs, Finset.mem_filter, Finset.mem_univ, true_and] + rw [hmiss _ (pref _ hr.2)] + exact hr.1 + have hsRho : HierarchyFirstMissingPosition sigma T c ∈ cr := by + simp only [cr, Finset.mem_filter, Finset.mem_univ, true_and] + rw [← hmiss _ (pref _ hs.2)] + exact hs.1 + apply Fin.ext + have hrs := Finset.min'_le cr _ hsRho + have hsr := Finset.min'_le cs _ hrSigma + have heqr : HierarchyFirstMissingPosition rho T c = cr.min' hrn := by + simp [HierarchyFirstMissingPosition, cr, hrn] + have heqs : HierarchyFirstMissingPosition sigma T c = cs.min' hsn := by + simp [HierarchyFirstMissingPosition, cs, hsn] + rw [← heqr] at hrs + rw [← heqs] at hsr + exact Nat.le_antisymm hsr hrs + +private theorem helper_firstUnaffected_628.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G rho → c ≠ a + → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D z rho a b c hne hp hca hcb + have hb := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + have he : (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G (TwoColorComponentSwap G rho a b z) (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hb.2.2.2 _ c hca hcb + unfold HierarchyFirstMissingPosition + rw [he] + +private theorem helper_hstoredOne_643.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + D.gammaOne ∈ TreeMissingColors phi A → D.gammaOne ≠ D.alpha → D.gammaOne ∈ + TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.gammaOne D.alpha z; ( + ∀ w ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G phi D.gammaOne D.alpha + z) w = MissingColors G phi w) → ( + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho B → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G rho → c ≠ a + → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c) → + ∀ c ∈ HierarchyStoredColorsAt H q, HierarchyFirstMissingPosition muOne T c = + HierarchyFirstMissingPosition phi T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hgammaA hgammaAlpha hmissing z + muOne hmissingOne firstPreserved firstUnaffected c hc + have hcg : c ≠ D.gammaOne := by + intro he + exact (Finset.mem_sdiff.mp hc).2 (he ▸ hgammaA) + by_cases hca : c = D.alpha + · subst c + exact firstPreserved phi muOne D.alpha hmissingOne hmissing.2 + · exact firstUnaffected phi D.gammaOne D.alpha c hgammaAlpha ctx.proper hcg hca + +private theorem helper_seriesFacts_678.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G + (ett.series.data.coloring j) ∧ IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + classical + intro V E _ _ _ G k e0 input T phi ett j + have certificate := ett.series.certified j + cases certificate with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact ⟨currentProper, currentOneUncolored⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact ⟨previousProper, previousOneUncolored⟩ + +private theorem helper_sameStar_734.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A P + have helper : + ∀ (n m : ℕ) (X Y : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → + TreeSequence G e0), n = m → X = Y → HEq s t → Fin.cases (motive := fun _ => TreeSequence G + e0) X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => + TreeSequence G e0) Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by + intro n m X Y s t hnm hXY hst + subst m + have he := eq_of_heq hst + simp [hXY, he] + exact (helper _ _ base.core P.replacementBase.core H.stage + P.counterexample.hierarchy.stage P.sameGood.1.2.1 P.sameGood.1.1 + P.sameGood.1.2.2.1).symm + +private theorem helper_hpairDataOne_800.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let _ : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; D.alpha ∈ + HierarchyStoredColorsAt HOne qOne ∧ POne.counterexample.good.gamma qOne D.alpha = (insert + D.gammaOne ({ D.gammaTwo } : Finset (Fin k)) : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q POne COne' HOne qOne + rcases POne.sameGood.2 with ⟨hcount, hdata⟩ + have hi : Fin.cast (congrArg (fun n => n + 1) hcount) q = qOne := by + apply Fin.ext + simp [q, qOne, H, HOne, COne'] + have hd := hdata q + dsimp only at hd + rw [hi] at hd + refine ⟨hd.1 ▸ D.alphaStored, ?_⟩ + exact (hd.2 D.alpha D.alphaStored).symm.trans D.gammaPair + +private theorem helper_hcaseOne_816.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx) (POne : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring + := POne.corresponding.replacementETT; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; D.gammaOne ∈ + HierarchyStageMissingColors HOne qOne → (0 : ℕ) < HOne.dividerCount ∧ D.gammaOne ∈ + TreeMissingColors rho (HOne.stage (⟨HOne.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (HOne.dividerCount + (2 : ℕ)))) ∨ HOne.dividerCount = (0 : ℕ) ∧ D.gammaOne ∈ + TreeMissingColors rho (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D POne rho ettOne COne' HOne qOne + hgammaStageOne + by_cases hz : HOne.dividerCount = 0 + · right + refine ⟨hz, ?_⟩ + have hi : qOne = 0 := by apply Fin.ext; simp [qOne, hz] + simpa [hi, HierarchyStageMissingColors] using hgammaStageOne + · left + refine ⟨Nat.pos_of_ne_zero hz, ?_⟩ + have hi : qOne = (⟨HOne.dividerCount - 1, by omega⟩ : Fin HOne.dividerCount).succ := by + apply Fin.ext + simp [qOne] + omega + have hg := hgammaStageOne + rw [hi] at hg + simp only [HierarchyStageMissingColors, Fin.castSucc_succ, Fin.succ_mk, Fin.cases_succ', + Fin.castSucc_mk] at hg + convert hg using 1; congr 2; apply Fin.ext; simp; omega + +private theorem helper_weakEdges_959.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0), ( + ∀ (X Y : TreeSequence G e0) (h : X = Y) (i : Fin X.length), X.edge i = Y.edge (Fin.cast + (congrArg TreeSequence.length h) i)) → + ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (ett' : + ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) (K : + TashkinovHierarchy ett' base'), TreeSequenceInitialSegment (HierarchyStarredStage K + (Fin.last K.dividerCount)) T → HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsProperEdgeColoring G old → IsOneEdgeUncolored old e0 → IsProperEdgeColoring G new → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin T.length), (↑t : ℕ) < (HierarchyStarredStage K (Fin.last K.dividerCount)).length → + new (T.edge t) = old (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 T edgeCast input' old new ett' base' K hST hw hp ho hnp hno + let S := HierarchyStarredStage K (Fin.last K.dividerCount) + intro t ht + let tS : Fin S.length := ⟨t.val, ht⟩ + have hcast : Fin.castLE hST.1 tS = t := Fin.ext rfl + rw [← hcast, hST.2.2 tS] + by_cases hzero : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := by + apply Fin.ext + simp [hzero] + have hS : S = base'.core := by change HierarchyStarredStage K _ = _; rw [hi]; rfl + rw [hi] at hw + change (if ett'.series.data.kind (Fin.last ett'.rounds) = + some TashkinovExtensionKind.PE then _ else _) at hw + by_cases hpe : ett'.series.data.kind (Fin.last ett'.rounds) = some TashkinovExtensionKind.PE + · rw [ite_eq_left hpe] at hw + have hc := CombinedStableClosurePreserved G k e0 input' T old old new ett' + (by have h := ett'.roundsPositive; omega) base' ett'.generatingColoring hpe hp ho hnp hno hw + obtain ⟨_, _, ⟨hunion⟩⟩ := base'.parallel hpe + let tc : Fin base'.core.length := Fin.cast (congrArg TreeSequence.length hS) tS + have he : S.edge tS = base'.core.edge tc := edgeCast S base'.core hS tS + rw [he] + by_cases hbelow : tc.val < (ett'.series.data.tree (Fin.last ett'.rounds).castSucc).length + · let tn : Fin (ett'.series.data.tree (Fin.last ett'.rounds).castSucc).length := ⟨tc.val, + hbelow⟩ + have heq : Fin.castLE hunion.leftSegment.1 tn = tc := Fin.ext rfl + rw [← heq, hunion.leftSegment.2.2 tn] + exact hc.1 tn + · obtain ⟨j, heq, _⟩ := hunion.newEntryFromRight tc (by omega) + rw [heq] + exact hc.2.1 j + · rw [ite_eq_right hpe] at hw + have hcore := base'.nonparallel hpe + have hS' := hS.trans hcore + let tn : Fin (ett'.series.data.tree (Fin.last ett'.rounds).castSucc).length := + Fin.cast (congrArg TreeSequence.length hS') tS + have he : S.edge tS = (ett'.series.data.tree (Fin.last ett'.rounds).castSucc).edge tn := by + exact edgeCast S _ hS' tS + rw [he] + let r : Fin ett'.rounds := ⟨ett'.rounds - 1, by have h := ett'.roundsPositive; omega⟩ + have hr : r.succ = Fin.last ett'.rounds := by + have hn := ett'.roundsPositive + apply Fin.ext + simp [r] + omega + have hfix := (HkuTreeColorsControlled G k ett'.rounds e0 input' ett'.series r).2.2 new + hnp hno (by rw [hr, ← ett'.generatingColoring]; exact hw) + rw [hr, ← ett'.generatingColoring] at hfix + exact hfix tn + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := by + apply Fin.ext + simp + omega + have hS : S = K.stage (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ.castSucc := by + change HierarchyStarredStage K _ = _ + rw [hi] + simp [HierarchyStarredStage] + rw [hi] at hw + simp only [HierarchyWeaklyStable, Fin.castSucc_succ, Fin.succ_mk, Fin.cases_succ', + Fin.castSucc_mk] at hw + have hinv : TreeColoringInvariant S old new := hS.symm ▸ hw.2 + by_cases hpos : 1 ≤ tS.val + · exact hinv.1 tS hpos + · have hi : tS = ⟨0, S.positive⟩ := by + apply Fin.ext + change tS.val = 0 + omega + rw [hi, S.first_edge, hno.1, ho.1] + +private theorem helper_hfixedCoreTwo_1036.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; TreeSequenceInitialSegment A T → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A) → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring + := POne.corresponding.replacementETT; + let baseOne' : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 POne.corresponding.replacementInput T + POne.coloring POne.corresponding.replacementETT POne.replacementBase POne.counterexample + := POne.minimumContext; + let _ : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho D.gammaOne D.theta z; ( + let H : TashkinovHierarchy ettOne baseOne' := COne'.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ettOne.rounds + (1 : ℕ)) := Fin.last ettOne.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ettOne.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q muTwo ∧ + ModColoring ettOne muTwo ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A muTwo), + MaximumProperty ettA) ∧ ((0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A muTwo) + (baseA : HierarchyBase ettA muTwo) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), MaximumProperty ettA ∧ ettA.series.data.kind (Fin.last ettA.rounds) = + ettOne.series.data.kind (Fin.last ettOne.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = baseOne'.core ∧ + baseA.closure = baseOne'.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by + have := TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = COne'.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G muTwo Tnq (Dnq.biUnion (COne'.good.gamma + (⟨COne'.hierarchy.dividerCount - (1 : ℕ), + by + have := TreeSequence.positive T + omega + ⟩ : Fin (COne'.hierarchy.dividerCount + (1 : ℕ))))))) → ( + ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (ett' : + ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) (K : + TashkinovHierarchy ett' base'), TreeSequenceInitialSegment (HierarchyStarredStage K + (Fin.last K.dividerCount)) T → HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsProperEdgeColoring G old → IsOneEdgeUncolored old e0 → IsProperEdgeColoring G new → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin T.length), (↑t : ℕ) < (HierarchyStarredStage K (Fin.last K.dividerCount)).length → + new (T.edge t) = old (T.edge t)) → + ∀ (t : Fin T.length), (↑t : ℕ) < A.length → muTwo (T.edge t) = rho (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hAT z POne sameStar rho ettOne + baseOne' COne' ctxOne HOne muTwo hstableTwo weakEdges + have h := weakEdges rho muTwo ettOne baseOne' HOne + (by rw [sameStar POne]; exact hAT) hstableTwo.1 ctxOne.proper ctxOne.oneEdgeUncolored + hstableTwo.2.1.1 hstableTwo.2.1.2.1 + change ∀ t : Fin T.length, t.val < (HierarchyStarredStage POne.counterexample.hierarchy + (Fin.last POne.counterexample.hierarchy.dividerCount)).length → _ at h + rw [sameStar POne] at h + exact h + +private theorem helper_hstoredTwo_1050.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + D.gammaOne ≠ D.theta → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); ( + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho B → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G rho → c ≠ a + → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A) → + let rho : PartialEdgeColoring E k := POne.coloring; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 POne.corresponding.replacementInput T + POne.coloring POne.corresponding.replacementETT POne.replacementBase POne.counterexample + := POne.minimumContext; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; D.gammaOne ∈ + TreeMissingColors rho A → D.gammaOne ∈ TreeMissingColors rho B ∧ D.theta ∈ + TreeMissingColors rho B → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho D.gammaOne D.theta z; ( + ∀ w ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G rho D.gammaOne D.theta + z) w = MissingColors G rho w) → + ∀ c ∈ HierarchyStoredColorsAt HOne qOne, HierarchyFirstMissingPosition muTwo T c = + HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hgammaTheta z firstPreserved + firstUnaffected POne sameStar rho COne' ctxOne HOne qOne hgammaAOne hmissingPairOne muTwo + hmissingTwo c hc + have hcg : c ≠ D.gammaOne := by + intro he + apply (Finset.mem_sdiff.mp hc).2 + rw [sameStar POne] + exact he ▸ hgammaAOne + by_cases hct : c = D.theta + · subst c + exact firstPreserved rho muTwo D.theta hmissingTwo hmissingPairOne.2 + · exact firstUnaffected rho D.gammaOne D.theta c hgammaTheta ctxOne.proper hcg hct + +private theorem helper_commonPrefix_1062.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y F : TreeSequence G e0}, TreeSequenceInitialSegment X F → TreeSequenceInitialSegment Y + F → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by + classical + intro V E G e0 X Y F hXF hYF hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + rw [← hYF.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)] + exact hXF.2.1 i + · intro i + rw [← hYF.2.2 (Fin.castLE hXY i)] + exact hXF.2.2 i + +private theorem helper_segmentTrans_1072.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y F : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y + F → TreeSequenceInitialSegment X F := by + classical + intro V E G e0 X Y F hXY hYF + refine ⟨hXY.1.trans hYF.1, ?_, ?_⟩ + · intro i + exact (hYF.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYF.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +private theorem helper_hcoreLength_1080.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A) → + let baseOne' : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let _ : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; baseOne'.core.length + ≤ A.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A POne sameStar baseOne' COne' HOne qOne + by_cases hz : HOne.dividerCount = 0 + · have hi : qOne = 0 := by apply Fin.ext; simp [qOne, hz] + have he := sameStar POne + change HierarchyStarredStage HOne qOne = A at he + rw [hi] at he + change baseOne'.core = A at he + exact le_of_eq (congrArg TreeSequence.length he) + · have hmono : Monotone (fun i : Fin (HOne.dividerCount + 2) => (HOne.stage i).length) := + Fin.monotone_iff_le_succ.mpr fun i => (HOne.nested i).1 + have hi : qOne = (⟨HOne.dividerCount - 1, by omega⟩ : Fin HOne.dividerCount).succ := by + apply Fin.ext + simp [qOne] + omega + have he := sameStar POne + change HierarchyStarredStage HOne qOne = A at he + rw [hi] at he + simp only [HierarchyStarredStage, Fin.cases_succ] at he + have hle := hmono (show (⟨1, by omega⟩ : Fin (HOne.dividerCount + 2)) ≤ + (⟨HOne.dividerCount - 1, by omega⟩ : Fin HOne.dividerCount).succ.castSucc by + change 1 ≤ HOne.dividerCount - 1 + 1 + omega) + dsimp only at hle + rw [he] at hle + exact HOne.coreInsideFirst.1.trans hle + +private theorem helper_transportRoute_1105.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → TreeSequenceInitialSegment B T → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho D.gammaOne D.theta z; ( + ∀ w ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G rho D.gammaOne D.theta + z) w = MissingColors G rho w) → ( + ∀ (t : Fin T.length), (↑t : ℕ) < B.length → muTwo (T.edge t) = rho (T.edge t)) → ( + ∀ {X Y F : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y F + → TreeSequenceInitialSegment X F) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence rho S B → + TashkinovAugmentationSequence muTwo S B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBT z POne rho muTwo + hmissingTwo hfixedPrefixTwo segmentTrans S hs + unfold TashkinovAugmentationSequence at hs ⊢ + induction hs using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head X Y hstep htail ih => + have hYB := TashkinovAugmentationSequenceInitialSegment rho Y B htail + rcases hstep with ⟨hlen, hXY, c, hedge, hm⟩ + have hXB := segmentTrans hXY hYB + refine Relation.ReflTransGen.head ⟨hlen, hXY, c, ?_, ?_⟩ ih + · let tY : Fin Y.length := Fin.cast hlen.symm (Fin.last X.length) + let tB : Fin B.length := Fin.castLE hYB.1 tY + have hfixed := hfixedPrefixTwo (Fin.castLE hBT.1 tB) (by + simp only [Fin.val_castLE] + exact tB.isLt) + rw [hBT.2.2 tB, hYB.2.2 tY] at hfixed + exact hfixed.trans hedge + · rcases Finset.mem_biUnion.mp hm with ⟨v, hv, hvc⟩ + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [hmissingTwo v (TreeSequenceInitialSegmentVertexSetSubset hXB hv)] + exact hvc + +private theorem helper_hrouteTwo_1126.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment + B T → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring + := POne.corresponding.replacementETT; + let baseOne' : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho D.gammaOne D.theta z; ( + ∀ {X Y F : TreeSequence G e0}, TreeSequenceInitialSegment X F → TreeSequenceInitialSegment Y F + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ {X Y F : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y F + → TreeSequenceInitialSegment X F) → baseOne'.core.length ≤ A.length → ( + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence rho S B → + TashkinovAugmentationSequence muTwo S B) → ettOne.series.data.kind (Fin.last + ettOne.rounds) = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence muTwo + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) B ∨ (ettOne.series.data.kind + (Fin.last ettOne.rounds) = some TashkinovExtensionKind.SE ∨ ettOne.series.data.kind + (Fin.last ettOne.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ettOne.series.data.connectingEdges (Fin.last + ettOne.rounds) = ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (ettOne.series.data.tree + (Fin.last ettOne.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence muTwo seed B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT z POne rho ettOne + baseOne' muTwo commonPrefix segmentTrans hcoreLength transportRoute + let n : Fin (ettOne.rounds + 1) := Fin.last ettOne.rounds + let Tn := ettOne.series.data.tree n.castSucc + let F := ettOne.series.data.tree (Fin.last (ettOne.rounds + 1)) + have hBF : TreeSequenceInitialSegment B F := segmentTrans hBT ettOne.belowFinal + have hn : n.succ = Fin.last (ettOne.rounds + 1) := Fin.ext rfl + have hTnT : TreeSequenceInitialSegment Tn T := ettOne.abovePenultimate + have hTnB : TreeSequenceInitialSegment Tn B := commonPrefix hTnT hBT (by + have hs := ettOne.strictAbovePenultimate + change Tn.length < T.length at hs + omega) + have nonparallel (hkind : ettOne.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ettOne.series.data.kind n = some TashkinovExtensionKind.RE) + (f : E) (seed : TreeSequence G e0) + (hedges : ettOne.series.data.connectingEdges n = {f}) + (hadjoin : TreeSequenceAdjoinEdge Tn f seed) + (hclosure : TashkinovClosure rho seed F) : + ∃ f seed, ettOne.series.data.connectingEdges (Fin.last ettOne.rounds) = {f} ∧ + TreeSequenceAdjoinEdge (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence muTwo seed B := by + have hnotPE : ettOne.series.data.kind n ≠ some TashkinovExtensionKind.PE := by + intro he + rcases hkind with hs | hr + · rw [hs] at he + simp at he + · rw [hr] at he + simp at he + have hc : baseOne'.core = Tn := baseOne'.nonparallel hnotPE + have hseedF := TashkinovAugmentationSequenceInitialSegment rho seed F hclosure.1 + have hsBound : seed.length ≤ B.length := by + have hlen : Tn.length ≤ A.length := hc ▸ hcoreLength + have hab : A.length + 1 ≤ B.length := by + clear * - htail hBlen + omega + exact hadjoin.1.le.trans ((Nat.add_le_add_right hlen 1).trans hab) + have hseedB : TreeSequenceInitialSegment seed B := commonPrefix hseedF hBF hsBound + exact ⟨f, seed, hedges, hadjoin, + transportRoute seed (TashkinovAugmentationSequenceRestrict rho seed B F + hclosure.1 hseedB hBF)⟩ + have cert := ettOne.series.certified n + generalize hindex : n = j at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + have hnzero : n = 0 := by simpa using hindex + have hv := congrArg Fin.val hnzero + have hp := ettOne.roundsPositive + simp [n] at hv + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hk : ettOne.series.data.kind n = some TashkinovExtensionKind.SE := by + rw [hindex] + exact currentKind + refine Or.inr ⟨Or.inl hk, ?_⟩ + apply nonparallel (Or.inl hk) choice.edge adjoined + · rw [hindex]; exact currentEdges + · simpa [Tn, hindex] using adjoinedExactly + · rw [← hindex, hn, ← ettOne.generatingColoring] at closedExtension + exact closedExtension + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hk : ettOne.series.data.kind n = some TashkinovExtensionKind.PE := by + rw [hindex] + exact currentKind + refine Or.inl ⟨hk, transportRoute Tn ?_⟩ + rw [← hindex, hn, ← ettOne.generatingColoring] at closedExtension + exact TashkinovAugmentationSequenceRestrict rho Tn B F closedExtension.1 hTnB hBF + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have hk : ettOne.series.data.kind n = some TashkinovExtensionKind.RE := by + rw [hindex] + exact currentKind + refine Or.inr ⟨Or.inr hk, ?_⟩ + apply nonparallel (Or.inr hk) available.edge adjoined + · rw [hindex]; exact currentEdges + · simpa [Tn, hindex] using adjoinedExactly + · rw [← hindex, hn, ← ettOne.generatingColoring] at closedExtension + exact closedExtension + +private theorem helper_hthetaLastOne_1217.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; (2 : ℕ) ≤ T.length - A.length → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.gammaOne D.alpha z; ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), POne.coloring = + muOne → + let rho : PartialEdgeColoring E k := POne.coloring; rho (T.edge D.lastEdgeIndex) = some + D.theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail z muOne hfixedOne POne hPOne rho + rw [show rho = muOne from hPOne, hfixedOne D.lastEdgeIndex (by + have hl := D.lastEdgePosition + clear * - hl htail + omega)] + exact D.thetaOnLastEdge + +private theorem helper_hsuffix_1223.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment B T → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; D.gammaOne ∈ TreeMissingColors rho B ∧ + D.theta ∈ TreeMissingColors rho B → rho (T.edge D.lastEdgeIndex) = some D.theta → + TashkinovAugmentationSequence rho B T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hBT POne rho hmissingPairOne + hthetaLastOne + apply Relation.ReflTransGen.single + refine ⟨hBlen.symm, hBT, D.theta, ?_, hmissingPairOne.2⟩ + have hi : Fin.cast hBlen (Fin.last B.length) = D.lastEdgeIndex := by + apply Fin.ext + have hl := D.lastEdgePosition + simp only [Fin.val_cast, Fin.val_last] + clear * - hBlen hl + omega + rw [hi] + exact hthetaLastOne + +private theorem helper_hgammaCutoff_1234.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment A B → ( + ∀ {c : Fin k}, c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ + TreeMissingColors phi A) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A) → + let rho : PartialEdgeColoring E k := POne.coloring; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G rho v = MissingColors G phi v) → + HierarchyFirstMissingPosition rho T D.alpha = D.penultimateVertexIndex → D.alpha ∈ + HierarchyStoredColorsAt HOne qOne ∧ POne.counterexample.good.gamma qOne D.alpha = (insert + D.gammaOne ({ D.gammaTwo } : Finset (Fin k)) : Finset (Fin k)) → + ∀ c ∈ HierarchyStoredColorsAt HOne qOne, D.gammaOne ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c → (↑(HierarchyFirstMissingPosition rho T + c) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hBlen hAB hnotA POne sameStar rho + COne' HOne qOne hmissingOne' hfirstAlphaOne hpairDataOne c hc hpair + rcases hpair with hgamma | htheta + · have hca : c = D.alpha := by + by_contra hne + have hdis := POne.counterexample.good.disjointPairs qOne c D.alpha hc hpairDataOne.1 hne + exact Finset.disjoint_left.mp hdis hgamma (by rw [hpairDataOne.2]; simp) + subst c + rw [hfirstAlphaOne] + have hp := D.penultimateVertexPosition + clear * - hBlen hp + omega + · have htA := (GoodHierarchyReservedDisjoint POne.counterexample.good qOne).1 c hc htheta + rw [sameStar POne] at htA + have htB : D.theta ∈ TreeMissingColors phi A := by + rcases Finset.mem_biUnion.mp htA with ⟨v, hv, hm⟩ + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [hmissingOne' _ (TreeSequenceInitialSegmentVertexSetSubset hAB hv)] at hm + exact hm + exact (hnotA D.thetaMissingPenultimate htB).elim + +private theorem helper_hlastComponent_1277.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); Incident G (T.vertex + D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; rho (T.edge D.lastEdgeIndex) = some + D.theta → Sum.inr (T.edge D.lastEdgeIndex) ∈ TwoColorComponent G rho D.gammaOne D.theta z + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D z terminalIncident POne rho hthetaLastOne + have hadj : (TwoColorIncidenceGraph G rho D.gammaOne D.theta).Adj + (Sum.inr (T.edge D.lastEdgeIndex)) z := by + exact ⟨terminalIncident, Or.inr hthetaLastOne⟩ + change (TwoColorIncidenceGraph G rho D.gammaOne D.theta).connectedComponentMk + (Sum.inr (T.edge D.lastEdgeIndex)) = _ + exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + +private noncomputable abbrev helperTailTwo2292.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett + base C ctx) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (2 : ℕ) ≤ T.length - A.length → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + (POne : + HierarchyReplacementPresentation G k e0 input T phi + ett base C ctx) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount) = + A) → + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := + TwoColorComponentSwap G rho D.gammaOne D.theta z; + muTwo (T.edge D.lastEdgeIndex) = some D.gammaOne → + D.gammaOne ∉ + MissingColors G muTwo + (T.vertex D.penultimateVertexIndex) → + (PTwo : + HierarchyReplacementPresentation G k e0 input + T phi ett base C ctx) → + PTwo.coloring = muTwo → + HierarchySituationTwoTailData G k e0 + PTwo.corresponding.replacementInput T + PTwo.coloring + PTwo.corresponding.replacementETT + PTwo.replacementBase PTwo.counterexample + PTwo.minimumContext := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail z POne sameStar rho muTwo + hlastTwo hgammaPenTwo PTwo hPTwo + exact { + tailAtLeastTwo := by + change 2 ≤ T.length - (HierarchyStarredStage PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount)).length + rw [sameStar PTwo] + exact htail + pathNumberFull := by + have hp := D.pathNumberFull + unfold HierarchyPathNumber HierarchyFullTailLength at hp ⊢ + dsimp only at hp ⊢ + rw [sameStar PTwo] + exact hp + lastEdgeIndex := D.lastEdgeIndex + penultimateVertexIndex := D.penultimateVertexIndex + terminalVertexIndex := D.terminalVertexIndex + lastEdgePosition := D.lastEdgePosition + penultimateVertexPosition := D.penultimateVertexPosition + terminalVertexPosition := D.terminalVertexPosition + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate + theta := D.gammaOne + thetaOnLastEdge := hPTwo.symm ▸ hlastTwo + thetaPresentPenultimate := hPTwo.symm ▸ hgammaPenTwo } + +private theorem helper_branch_2476.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (htail : (2 : ℕ) ≤ T.length - A.length), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (sameStar : + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A), + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho D.gammaOne D.theta z; + ∀ (hlastTwo : muTwo (T.edge D.lastEdgeIndex) = some D.gammaOne), D.theta ∈ MissingColors G + muTwo (T.vertex D.terminalVertexIndex) → D.theta ∈ MissingColors G muTwo (T.vertex + D.penultimateVertexIndex) → + ∀ (hgammaPenTwo : D.gammaOne ∉ MissingColors G muTwo (T.vertex D.penultimateVertexIndex)) + (PTwo : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (hPTwo : + PTwo.coloring = muTwo), + let _ : HierarchySituationTwoTailData G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase PTwo.counterexample + PTwo.minimumContext := helperTailTwo2292 G k e0 input T phi ett base C ctx D htail POne + sameStar hlastTwo hgammaPenTwo PTwo hPTwo; D.theta ∈ HierarchyStoredColorsAt + PTwo.counterexample.hierarchy (Fin.last PTwo.counterexample.hierarchy.dividerCount) → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail z POne sameStar rho muTwo + hlastTwo hthetaTermTwo hthetaPenTwo hgammaPenTwo PTwo hPTwo tailTwo hstored + obtain ⟨g1, g2, hne, hpair⟩ := Finset.card_eq_two.mp + (PTwo.counterexample.good.twoColors _ D.theta hstored) + let finalData : HierarchySituationTwoCaseOneData G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := + { toHierarchySituationTwoTailData := tailTwo + alpha := D.theta + gammaOne := g1 + gammaTwo := g2 + alphaMissingPenultimate := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.penultimateVertexIndex) + rw [hPTwo] + exact hthetaPenTwo + alphaMissingTerminal := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.terminalVertexIndex) + rw [hPTwo] + exact hthetaTermTwo + alphaStored := hstored + gammaPair := hpair + gammaDistinct := hne } + exact HierarchySituationTwoSubcaseOneOne G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext finalData + +private theorem helper_branch_2499.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (htail : (2 : ℕ) ≤ T.length - A.length), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (sameStar : + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A), + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho D.gammaOne D.theta z; + ∀ (hlastTwo : muTwo (T.edge D.lastEdgeIndex) = some D.gammaOne), D.theta ∈ MissingColors G + muTwo (T.vertex D.terminalVertexIndex) → D.theta ∈ MissingColors G muTwo (T.vertex + D.penultimateVertexIndex) → + ∀ (hgammaPenTwo : D.gammaOne ∉ MissingColors G muTwo (T.vertex D.penultimateVertexIndex)) + (PTwo : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (hPTwo : + PTwo.coloring = muTwo), + let _ : HierarchySituationTwoTailData G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase PTwo.counterexample + PTwo.minimumContext := helperTailTwo2292 G k e0 input T phi ett base C ctx D htail POne + sameStar hlastTwo hgammaPenTwo PTwo hPTwo; D.theta ∉ HierarchyStoredColorsAt + PTwo.counterexample.hierarchy (Fin.last PTwo.counterexample.hierarchy.dividerCount) → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail z POne sameStar rho muTwo + hlastTwo hthetaTermTwo hthetaPenTwo hgammaPenTwo PTwo hPTwo tailTwo hstored + let finalData : HierarchySituationTwoCaseTwoData G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := + { toHierarchySituationTwoTailData := tailTwo + alpha := D.theta + alphaMissingPenultimate := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.penultimateVertexIndex) + rw [hPTwo] + exact hthetaPenTwo + alphaMissingTerminal := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.terminalVertexIndex) + rw [hPTwo] + exact hthetaTermTwo + alphaOutsideStored := hstored } + exact HierarchySituationTwoSubcaseTwoOne G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext finalData + +private theorem helper_hfixedOne_2200.{u_1, u_2} : + helperHfixedOne2200Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hBlen hBT hAzero hAT hgammaUnused + halphaExclusion z muOne hstableOne predecessorIncident terminalIncident missingNotColored + seedStable t ht + have hng := hgammaUnused t ht + by_cases ha : phi (T.edge t) = some D.alpha + · have hnotlast : t ≠ D.lastEdgeIndex := by + intro he + exact missingNotColored phi D.alpha _ D.alphaMissingTerminal _ terminalIncident (he ▸ ha) + have hbound : t.val < B.length := by + have hlast := D.lastEdgePosition + have hb := t.isLt + have hn : t.val ≠ D.lastEdgeIndex.val := fun he => hnotlast (Fin.ext he) + omega + let tB : Fin B.length := ⟨t.val, hbound⟩ + have hcast : Fin.castLE hBT.1 tB = t := Fin.ext rfl + have heB : phi (B.edge tB) = some D.alpha := by rw [← hBT.2.2 tB, hcast]; exact ha + obtain ⟨hqzero, hcore, hpos, f, hstep, hkind, hedges, heq, hcolor, hstored⟩ := + halphaExclusion tB ht (by + change tB.val < A.length + (T.length - A.length - 1) + have hb := tB.isLt + omega) heB + have hAX : A = ett.series.data.tree (Fin.last ett.rounds).castSucc := + (hAzero hqzero).trans hcore + have hinc : TreeIncidentEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (T.edge t) := by + rw [← hAX] + exact predecessorIncident A hAT t hpos + exact (seedStable phi muOne ett base H hstableOne.1 hqzero).1 _ hinc + ⟨D.alpha, Finset.mem_union_right _ hstored, ha⟩ + · simp [muOne, TwoColorComponentSwap, hng, ha] + +private theorem helper_hfixedTailTwo_2433.{u_1, u_2} : + helperHfixedTailTwo2433Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hBlen hBT hAzero hAT hnotA + hthetaExclusion z muOne predecessorIncident seedStable hfixedOne POne hPOne rho ettOne + baseOne' COne' HOne qOne hgammaUnusedOne muTwo hstableTwo t ht hb + have hng := hgammaUnusedOne t ht + by_cases htheta : rho (T.edge t) = some D.theta + · let tB : Fin B.length := ⟨t.val, hb⟩ + have hcast : Fin.castLE hBT.1 tB = t := Fin.ext rfl + have heOld : phi (T.edge t) = some D.theta := by + rw [show rho = muOne from hPOne, hfixedOne t ht] at htheta + exact htheta + have heB : phi (B.edge tB) = some D.theta := by + rw [← hBT.2.2 tB, hcast] + exact heOld + obtain ⟨hzero, hcore, hpos, f, hstep, hkind, hedges, heq, hcolor, hstored⟩ := + hthetaExclusion tB ht (by + change tB.val < A.length + (T.length - A.length - 1) + have hb := tB.isLt + omega) heB + rcases POne.sameGood.1 with ⟨hcoreSame, hcount, hstages, hpositions, hpe, hclosure⟩ + have hzeroOne : HOne.dividerCount = 0 := hcount.symm.trans hzero + have hnotPE : ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE := by + intro he + rcases hkind with hs | hr + · rw [hs] at he + simp at he + · rw [hr] at he + simp at he + have hnotPEOne : ettOne.series.data.kind (Fin.last ettOne.rounds) ≠ + some TashkinovExtensionKind.PE := fun hp => hnotPE (hpe.mpr hp) + have hAX : A = ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc := + (hAzero hzero).trans (hcoreSame.trans (baseOne'.nonparallel hnotPEOne)) + have hinc : TreeIncidentEdge (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) + (T.edge t) := by + rw [← hAX] + exact predecessorIncident A hAT t hpos + have hthetaStored : D.theta ∈ HierarchyStoredColorsAt H q := + Finset.mem_sdiff.mpr ⟨hstored, hnotA D.thetaMissingPenultimate⟩ + rcases POne.sameGood.2 with ⟨hcount', hdata⟩ + have hi : Fin.cast (congrArg (fun n => n + 1) hcount') q = qOne := by + apply Fin.ext + simp [q, qOne, H, HOne, COne'] + have hd := (hdata q).1 + rw [hi] at hd + have hs : D.theta ∈ HierarchyStoredColorsAt HOne qOne := hd ▸ hthetaStored + have hs' := (Finset.mem_sdiff.mp hs).1 + exact (seedStable rho muTwo ettOne baseOne' HOne hstableTwo.1 hzeroOne).1 _ hinc + ⟨D.theta, Finset.mem_union_right _ hs', htheta⟩ + · simp [muTwo, TwoColorComponentSwap, hng, htheta] + +private abbrev helperContinuation3192Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : + HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment + B T → TreeSequenceInitialSegment A B → T.vertex D.penultimateVertexIndex ∈ + TreeSequenceVertexSet B → ( + ∀ {c : Fin k}, c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ + TreeMissingColors phi A) → D.gammaOne ≠ D.theta → + let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; T.vertex + ig ∈ TreeSequenceVertexSet B → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.gammaOne D.alpha z; + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), POne.coloring = + muOne → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 : + ℕ)) = B) → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring + := POne.corresponding.replacementETT; + let _ : HierarchyBase POne.corresponding.replacementETT POne.coloring := POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let _ : HierarchyMinimumCounterexampleContext G k e0 POne.corresponding.replacementInput T + POne.coloring POne.corresponding.replacementETT POne.replacementBase POne.counterexample + := POne.minimumContext; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G rho v = MissingColors G phi v) → D.theta ∈ + MissingColors G rho (T.vertex D.penultimateVertexIndex) → D.gammaOne ∉ MissingColors G rho + (T.vertex D.penultimateVertexIndex) → D.gammaOne ∈ MissingColors G rho (T.vertex + D.terminalVertexIndex) → D.gammaOne ∈ MissingColors G rho (T.vertex ig) → + HierarchyFirstMissingPosition rho T D.gammaOne = ig → HierarchyFirstMissingPosition rho T + D.alpha = D.penultimateVertexIndex → D.alpha ∈ HierarchyStoredColorsAt HOne qOne ∧ + POne.counterexample.good.gamma qOne D.alpha = (insert D.gammaOne ({ D.gammaTwo } : Finset + (Fin k)) : Finset (Fin k)) → (0 : ℕ) < HOne.dividerCount ∧ D.gammaOne ∈ TreeMissingColors + rho (HOne.stage (⟨HOne.dividerCount, + by omega + ⟩ : Fin (HOne.dividerCount + (2 : ℕ)))) ∨ HOne.dividerCount = (0 : ℕ) ∧ D.gammaOne ∈ + TreeMissingColors rho (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) → + D.gammaOne ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → Disjoint + (TwoColorComponent G rho D.gammaOne D.theta (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G rho D.gammaOne D.theta (Sum.inl (T.vertex ig))) → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho D.gammaOne D.theta z; + TwoColorPathComponent G rho D.gammaOne D.theta z → ( + ∀ w ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G rho D.gammaOne D.theta + z) w = MissingColors G rho w) → ( + ∀ (t : Fin T.length), (↑t : ℕ) < B.length → muTwo (T.edge t) = rho (T.edge t)) → ( + ∀ c ∈ HierarchyStoredColorsAt HOne qOne, HierarchyFirstMissingPosition muTwo T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ {X Y F : TreeSequence G e0}, TreeSequenceInitialSegment X F → TreeSequenceInitialSegment Y F + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → False + +private theorem helper_continuation_3192.{u_1, u_2} : + helperContinuation3192Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAB hyB hnotA + hgammaTheta ig higB self hyt z muOne terminalIncident hfixedOne POne hPOne sameStar + samePrefix rho ettOne baseOne' COne' ctxOne HOne qOne hmissingOne' hthetaPenOne + hgammaPenOne hgammaTermOne hgammaWitnessOne' hfirstGammaOne hfirstAlphaOne hpairDataOne + hcaseOne hmissingPairOne hdisjointTwo muTwo hpathTwo hmissingTwo hfixedPrefixTwo hstoredTwo + commonPrefix + have segmentTrans {X Y F : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) (hYF : TreeSequenceInitialSegment Y F) : + TreeSequenceInitialSegment X F := by + exact @helper_segmentTrans_1072 (@V) (@E) (@G) (@e0) (@X) (@Y) (@F) (@hXY) (@hYF) + have hcoreLength : baseOne'.core.length ≤ A.length := by + exact @helper_hcoreLength_1080 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@POne) (@sameStar) + have transportRoute (S : TreeSequence G e0) (hs : TashkinovAugmentationSequence rho S B) : + TashkinovAugmentationSequence muTwo S B := by + exact @helper_transportRoute_1105 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBT) (@POne) (@hmissingTwo) (@hfixedPrefixTwo) (@segmentTrans) (@S) (@hs) + have hrouteTwo : + (ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence muTwo + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) B) ∨ + ((ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.SE ∨ + ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, ettOne.series.data.connectingEdges (Fin.last ettOne.rounds) = {f} ∧ + TreeSequenceAdjoinEdge (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) f + seed ∧ + TashkinovAugmentationSequence muTwo seed B) := by + exact @helper_hrouteTwo_1126 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@POne) (@commonPrefix) (@segmentTrans) (@hcoreLength) + (@transportRoute) + have hthetaLastOne : rho (T.edge D.lastEdgeIndex) = some D.theta := by + exact @helper_hthetaLastOne_1217 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hfixedOne) (@POne) (@hPOne) + have hsuffix : TashkinovAugmentationSequence rho B T := by + exact @helper_hsuffix_1223 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hBT) + (@POne) (@hmissingPairOne) (@hthetaLastOne) + have hgammaCutoff : ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + (D.gammaOne ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c) → + (HierarchyFirstMissingPosition rho T c).val ≤ B.length := by + exact @helper_hgammaCutoff_1234 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hAB) (@hnotA) (@POne) (@sameStar) (@hmissingOne') (@hfirstAlphaOne) + (@hpairDataOne) + obtain ⟨corrTwo, hmaxTwo, baseTwo, KTwo, goodTwo, hsameGoodTwo⟩ := + (StableChangeCasesOneTwoSplitTail G k e0 POne.corresponding.replacementInput T rho ettOne + baseOne' COne' ctxOne D.gammaOne D.theta hgammaTheta + (by rw [samePrefix POne]; exact hmissingPairOne) + z hpathTwo muTwo rfl + (by dsimp only; rcases hcaseOne with hpos | ⟨hzero, hm⟩ + · exact Or.inl hpos + · exact Or.inr ⟨hzero, Or.inl hm⟩) + (by dsimp only; rw [hfirstGammaOne]; exact hdisjointTwo) + B (by dsimp only; rw [sameStar POne]; exact hAB) + (by dsimp only; rw [sameStar POne]; clear * - htail hBlen; omega) + (by rw [samePrefix POne]; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩) + (by dsimp only; intro t _ ht; exact hfixedPrefixTwo t ht) + hrouteTwo hsuffix + (by + constructor + · exact Finset.mem_biUnion.mpr ⟨_, higB, (hmissingTwo _ higB).symm ▸ hgammaWitnessOne'⟩ + · exact Finset.mem_biUnion.mpr ⟨_, hyB, (hmissingTwo _ hyB).symm ▸ hthetaPenOne⟩) + (by rw [samePrefix POne]; exact hmissingTwo) + hstoredTwo hgammaCutoff).2.2 + have hlastComponent : Sum.inr (T.edge D.lastEdgeIndex) ∈ TwoColorComponent G rho D.gammaOne + D.theta z := by + exact @helper_hlastComponent_1277 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@terminalIncident) (@POne) (@hthetaLastOne) + have hlastTwo : muTwo (T.edge D.lastEdgeIndex) = some D.gammaOne := by + simp [muTwo, TwoColorComponentSwap, hlastComponent, hthetaLastOne, hgammaTheta.symm] + have hthetaTermTwo : D.theta ∈ MissingColors G muTwo (T.vertex D.terminalVertexIndex) := + (TwoColorComponentSwapMissingBehavior G rho D.gammaOne D.theta hgammaTheta ctxOne.proper z).2.1 + _ (self rho D.gammaOne D.theta _) hgammaTermOne + have hthetaPenTwo : D.theta ∈ MissingColors G muTwo (T.vertex D.penultimateVertexIndex) := by + rw [hmissingTwo _ hyB] + exact hthetaPenOne + have hgammaPenTwo : D.gammaOne ∉ MissingColors G muTwo (T.vertex D.penultimateVertexIndex) := by + rw [hmissingTwo _ hyB] + exact hgammaPenOne + let CTwo : HierarchyCounterexample baseTwo := + { positive := by rw [corrTwo.rungAgreement]; exact COne'.positive + hierarchy := KTwo + good := goodTwo + maximum := hmaxTwo + notElementary := by + intro he + have hy : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet T := by simp + [TreeSequenceVertexSet] + have ht : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet T := by simp + [TreeSequenceVertexSet] + exact Finset.disjoint_left.mp (he hy ht hyt) hthetaPenTwo hthetaTermTwo } + obtain ⟨PTwo, hPTwo⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx POne muTwo corrTwo baseTwo CTwo hsameGoodTwo + let tailTwo : HierarchySituationTwoTailData G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := by + exact @helperTailTwo2292 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@POne) + (@sameStar) (@hlastTwo) (@hgammaPenTwo) (@PTwo) (@hPTwo) + by_cases hstored : D.theta ∈ HierarchyStoredColorsAt PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount) + · exact @helper_branch_2476 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@POne) + (@sameStar) (@hlastTwo) (@hthetaTermTwo) (@hthetaPenTwo) (@hgammaPenTwo) (@PTwo) (@hPTwo) + (@hstored) + · exact @helper_branch_2499 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@POne) + (@sameStar) (@hlastTwo) (@hthetaTermTwo) (@hthetaPenTwo) (@hgammaPenTwo) (@PTwo) (@hPTwo) + (@hstored) + +private theorem helper_continuation_2860.{u_1, u_2} : + helperContinuation2860Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB + hyB hElementary hfirstAlpha hfirstTheta hnotA hgammaA hgammaTheta hthetaExclusion + hgammaUnused ig hfirstGamma higB hmissing self leaf separate hgy hgt hyt z muOne + prefixMissing predecessorIncident terminalIncident seedStable hfixedOne firstPreserved + firstUnaffected hgammaTerminalOne POne hPOne sameStar samePrefix rho ettOne baseOne' COne' + ctxOne HOne qOne hmissingOne' + have hElementaryOne : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) := by + intro u hu v hv huv + rw [hmissingOne' u hu, hmissingOne' v hv] + exact hElementary hu hv huv + have hthetaPenOne : D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) := by + rw [hmissingOne' _ hyB] + exact D.thetaMissingPenultimate + have hgammaPenOne : D.gammaOne ∉ MissingColors G rho (T.vertex D.penultimateVertexIndex) := by + rw [hmissingOne' _ hyB] + intro hm + exact Finset.disjoint_left.mp (hElementary higB hyB hgy) hfirstGamma.1 hm + have hgammaTermOne : D.gammaOne ∈ MissingColors G rho (T.vertex D.terminalVertexIndex) := by + rw [show rho = muOne from hPOne] + exact hgammaTerminalOne + have hgammaWitnessOne' : D.gammaOne ∈ MissingColors G rho (T.vertex ig) := by + rw [hmissingOne' _ higB] + exact hfirstGamma.1 + have hgammaAOne : D.gammaOne ∈ TreeMissingColors rho A := by + rcases Finset.mem_biUnion.mp hgammaA with ⟨v, hv, hm⟩ + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [hmissingOne' _ (TreeSequenceInitialSegmentVertexSetSubset hAB hv)] + exact hm + have hfirstGammaOne : HierarchyFirstMissingPosition rho T D.gammaOne = ig := + firstPreserved phi rho D.gammaOne hmissingOne' hmissing.1 + have hfirstThetaOne : HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex := + (firstPreserved phi rho D.theta hmissingOne' + (Finset.mem_biUnion.mpr ⟨_, hyB, D.thetaMissingPenultimate⟩)).trans hfirstTheta + have hfirstAlphaOne : HierarchyFirstMissingPosition rho T D.alpha = D.penultimateVertexIndex := + (firstPreserved phi rho D.alpha hmissingOne' hmissing.2).trans hfirstAlpha + have hgammaUnusedOne : ∀ t : Fin T.length, A.length ≤ t.val → + rho (T.edge t) ≠ some D.gammaOne := by + intro t ht + rw [show rho = muOne from hPOne, hfixedOne t ht] + exact hgammaUnused t ht + have hpairDataOne : D.alpha ∈ HierarchyStoredColorsAt HOne qOne ∧ + POne.counterexample.good.gamma qOne D.alpha = {D.gammaOne, D.gammaTwo} := by + exact @helper_hpairDataOne_800 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@POne) + have hgammaStageOne : D.gammaOne ∈ HierarchyStageMissingColors HOne qOne := by + apply (Finset.mem_sdiff.mp + (POne.counterexample.good.avoidance qOne D.alpha hpairDataOne.1 ?_)).1 + rw [hpairDataOne.2] + simp + have hcaseOne : + (0 < HOne.dividerCount ∧ D.gammaOne ∈ TreeMissingColors rho + (HOne.stage ⟨HOne.dividerCount, by omega⟩)) ∨ + (HOne.dividerCount = 0 ∧ D.gammaOne ∈ TreeMissingColors rho + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc)) := by + exact @helper_hcaseOne_816 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@POne) + (@hgammaStageOne) + have hmissingPairOne : D.gammaOne ∈ TreeMissingColors rho B ∧ + D.theta ∈ TreeMissingColors rho B := by + exact ⟨Finset.mem_biUnion.mpr ⟨_, higB, hgammaWitnessOne'⟩, + Finset.mem_biUnion.mpr ⟨_, hyB, hthetaPenOne⟩⟩ + have hchangeOne := ChangeLemma G k e0 POne.corresponding.replacementInput T rho ettOne + baseOne' COne' ctxOne.proper ctxOne.oneEdgeUncolored ctxOne.lowerRung + ctxOne.fewerDividers ctxOne.lexicographicMinimality + (by change ColoredVertexSetElementary G rho (TreeSequenceVertexSet + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1))) + rw [samePrefix POne]; exact hElementaryOne) + ctxOne.largeMissingSet D.gammaOne D.theta hgammaTheta + (by change D.gammaOne ∈ TreeMissingColors rho (HierarchyFullTailPrefix COne' + (HierarchyFullTailLength COne' - 1)) ∧ D.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) + rw [samePrefix POne]; exact hmissingPairOne) + (by + dsimp only + rw [sameStar POne, hfirstGammaOne, hfirstThetaOne] + intro _ + refine ⟨⟨ig, D.penultimateVertexIndex, rfl, rfl, ?_⟩, ?_⟩ + · have hp := D.penultimateVertexPosition + have hg : ig.val ≤ A.length := hfirstGamma.2 + clear * - hp hg htail + omega + · intro hc + rcases (Finset.mem_filter.mp hc).2 with ⟨t, ht, _, he⟩ + exact hgammaUnusedOne t ht he) + have hsameTwo : TwoColorComponent G rho D.gammaOne D.theta (Sum.inl (T.vertex ig)) = + TwoColorComponent G rho D.gammaOne D.theta + (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + rw [← hfirstGammaOne, ← hfirstThetaOne] + rcases hcaseOne with ⟨hq, hm⟩ | ⟨hq, hm⟩ + · exact hchangeOne.1 ⟨hq, Or.inl hm⟩ + · exact hchangeOne.2.1 ⟨hq, Or.inl hm⟩ + have hdisjointTwo := separate rho D.gammaOne D.theta hgammaTheta ctxOne.proper + (T.vertex ig) (T.vertex D.penultimateVertexIndex) (T.vertex D.terminalVertexIndex) + hgy hgt hyt hgammaWitnessOne' hthetaPenOne (Or.inl hgammaTermOne) hsameTwo + let muTwo := TwoColorComponentSwap G rho D.gammaOne D.theta z + have hpathTwo : TwoColorPathComponent G rho D.gammaOne D.theta z := + ⟨hgammaTheta, _, self rho D.gammaOne D.theta _, + leaf rho D.gammaOne D.theta hgammaTheta ctxOne.proper _ (Or.inl hgammaTermOne)⟩ + have hstableTwo := StableChangeCasesOneTwo G k e0 POne.corresponding.replacementInput T rho + ettOne baseOne' COne' ctxOne.proper ctxOne.oneEdgeUncolored ctxOne.lowerRung + ctxOne.fewerDividers ctxOne.lexicographicMinimality + (by change ColoredVertexSetElementary G rho (TreeSequenceVertexSet + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1))) + rw [samePrefix POne]; exact hElementaryOne) + ctxOne.largeMissingSet D.gammaOne D.theta hgammaTheta + (by change D.gammaOne ∈ TreeMissingColors rho (HierarchyFullTailPrefix COne' + (HierarchyFullTailLength COne' - 1)) ∧ D.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) + rw [samePrefix POne]; exact hmissingPairOne) + z hpathTwo muTwo rfl + (by dsimp only; rcases hcaseOne with hpos | ⟨hzero, hm⟩ + · exact Or.inl hpos + · exact Or.inr ⟨hzero, Or.inl hm⟩) + (by dsimp only; rw [hfirstGammaOne]; exact hdisjointTwo) + have houtsideGammaTwo : Sum.inl (T.vertex ig) ∉ TwoColorComponent G rho D.gammaOne D.theta z := by + intro hm + exact Set.disjoint_left.mp hdisjointTwo hm (self rho D.gammaOne D.theta _) + have houtsideThetaTwo : Sum.inl (T.vertex D.penultimateVertexIndex) ∉ + TwoColorComponent G rho D.gammaOne D.theta z := by + intro hm + apply Set.disjoint_left.mp hdisjointTwo hm + rw [hsameTwo] + exact self rho D.gammaOne D.theta _ + have hmissingTwo := prefixMissing rho D.gammaOne D.theta hgammaTheta ctxOne.proper + hElementaryOne _ _ higB hyB hgammaWitnessOne' hthetaPenOne + houtsideGammaTwo houtsideThetaTwo + have hfixedTailTwo : ∀ t : Fin T.length, A.length ≤ t.val → t.val < B.length → + muTwo (T.edge t) = rho (T.edge t) := by + exact @helper_hfixedTailTwo_2433 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@hAzero) (@hAT) (@hnotA) (@hthetaExclusion) (@predecessorIncident) + (@seedStable) (@hfixedOne) (@POne) (@hPOne) (@hgammaUnusedOne) (@hstableTwo) + have edgeCast (X Y : TreeSequence G e0) (h : X = Y) (i : Fin X.length) : + X.edge i = Y.edge (Fin.cast (congrArg TreeSequence.length h) i) := by + subst Y + rfl + have weakEdges {input' : PartialEdgeColoring E k} + (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) + (base' : HierarchyBase ett' old) (K : TashkinovHierarchy ett' base') + (hST : TreeSequenceInitialSegment (HierarchyStarredStage K (Fin.last K.dividerCount)) T) + (hw : HierarchyWeaklyStable K (Fin.last K.dividerCount) new) + (hp : IsProperEdgeColoring G old) (ho : IsOneEdgeUncolored old e0) + (hnp : IsProperEdgeColoring G new) (hno : IsOneEdgeUncolored new e0) : + ∀ t : Fin T.length, t.val < (HierarchyStarredStage K (Fin.last K.dividerCount)).length → + new (T.edge t) = old (T.edge t) := by + exact @helper_weakEdges_959 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@T) (@edgeCast) (@input') (@old) (@new) (@ett') (@base') (@K) (@hST) + (@hw) (@hp) (@ho) (@hnp) (@hno) + have hfixedCoreTwo : ∀ t : Fin T.length, t.val < A.length → muTwo (T.edge t) = rho (T.edge t) + := by + exact @helper_hfixedCoreTwo_1036 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) + (@POne) (@sameStar) (@hstableTwo) (@weakEdges) + have hfixedPrefixTwo : ∀ t : Fin T.length, t.val < B.length → + muTwo (T.edge t) = rho (T.edge t) := by + intro t ht + by_cases ha : t.val < A.length + · exact hfixedCoreTwo t ha + · exact hfixedTailTwo t (by omega) ht + have hstoredTwo : ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c := by + exact @helper_hstoredTwo_1050 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hgammaTheta) (@firstPreserved) (@firstUnaffected) (@POne) (@sameStar) (@hgammaAOne) + (@hmissingPairOne) (@hmissingTwo) + have commonPrefix {X Y F : TreeSequence G e0} + (hXF : TreeSequenceInitialSegment X F) (hYF : TreeSequenceInitialSegment Y F) + (hXY : X.length ≤ Y.length) : TreeSequenceInitialSegment X Y := by + exact @helper_commonPrefix_1062 (@V) (@E) (@G) (@e0) (@X) (@Y) (@F) (@hXF) (@hYF) (@hXY) + exact @helper_continuation_3192 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hBlen) (@hBT) (@hAB) (@hyB) (@hnotA) (@hgammaTheta) (@higB) (@self) (@hyt) + (@terminalIncident) (@hfixedOne) (@POne) (@hPOne) (@sameStar) (@samePrefix) (@hmissingOne') + (@hthetaPenOne) (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') (@hfirstGammaOne) + (@hfirstAlphaOne) (@hpairDataOne) (@hcaseOne) (@hmissingPairOne) (@hdisjointTwo) + (@hpathTwo) (@hmissingTwo) (@hfixedPrefixTwo) (@hstoredTwo) (@commonPrefix) +private theorem helper_continuation_1912.{u_1, u_2} : + helperContinuation1912Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB + hyB hElementary hfirstAlpha hfirstTheta hnotA hgammaA hgammaTheta hgammaAlpha + hthetaExclusion hgammaUnused halphaExclusion firstWitness ig hfirstGamma higB hcase + hmissing hsame self leaf separate hgy hgt + have hyt : T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex := by + exact @helper_hyt_415 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hfirstTheta) + have hdisjoint := separate phi D.gammaOne D.alpha hgammaAlpha ctx.proper + (T.vertex ig) (T.vertex D.penultimateVertexIndex) (T.vertex D.terminalVertexIndex) + hgy hgt hyt hfirstGamma.1 D.alphaMissingPenultimate (Or.inr D.alphaMissingTerminal) hsame + let z : Sum V E := Sum.inl (T.vertex D.terminalVertexIndex) + let muOne := TwoColorComponentSwap G phi D.gammaOne D.alpha z + have hpath : TwoColorPathComponent G phi D.gammaOne D.alpha z := + ⟨hgammaAlpha, _, self phi D.gammaOne D.alpha _, + leaf phi D.gammaOne D.alpha hgammaAlpha ctx.proper _ (Or.inr D.alphaMissingTerminal)⟩ + have hstableOne := StableChangeCasesOneTwo G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality hElementary ctx.largeMissingSet + D.gammaOne D.alpha hgammaAlpha hmissing z hpath muOne rfl + (by + dsimp only + rcases hcase with hpos | ⟨hzero, hm⟩ + · exact Or.inl hpos + · exact Or.inr ⟨hzero, Or.inl hm⟩) + hdisjoint + have prefixMissing (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) + (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B)) + (u v : V) (huB : u ∈ TreeSequenceVertexSet B) (hvB : v ∈ TreeSequenceVertexSet B) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hdu : Sum.inl u ∉ TwoColorComponent G rho a b z) + (hdv : Sum.inl v ∉ TwoColorComponent G rho a b z) : + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by + exact @helper_prefixMissing_439 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@rho) + (@a) (@b) (@hne) (@hp) (@helem) (@u) (@v) (@huB) (@hvB) (@hu) (@hv) (@hdu) (@hdv) + have houtsideGamma : Sum.inl (T.vertex ig) ∉ TwoColorComponent G phi D.gammaOne D.alpha z := by + intro hm + exact Set.disjoint_left.mp hdisjoint hm (self phi D.gammaOne D.alpha _) + have houtsideAlpha : Sum.inl (T.vertex D.penultimateVertexIndex) ∉ + TwoColorComponent G phi D.gammaOne D.alpha z := by + intro hm + apply Set.disjoint_left.mp hdisjoint hm + rw [hsame] + exact self phi D.gammaOne D.alpha _ + have hmissingOne := prefixMissing phi D.gammaOne D.alpha hgammaAlpha ctx.proper + hElementary _ _ higB hyB hfirstGamma.1 D.alphaMissingPenultimate + houtsideGamma houtsideAlpha + have predecessorIncident (X : TreeSequence G e0) + (hXT : TreeSequenceInitialSegment X T) (t : Fin T.length) + (ht : t.val = X.length) : TreeIncidentEdge X (T.edge t) := by + exact @helper_predecessorIncident_507 (@V) (@E) inferInstance inferInstance (@G) (@e0) (@T) + (@X) (@hXT) (@t) (@ht) + have terminalIncident : Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) := by + exact @helper_terminalIncident_524 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + have missingNotColored (rho : PartialEdgeColoring E k) (c : Fin k) (v : V) + (hm : c ∈ MissingColors G rho v) (e : E) (hi : Incident G v e) : + rho e ≠ some c := by + exact @helper_missingNotColored_535 (@V) (@E) inferInstance inferInstance (@G) (@k) (@rho) + (@c) (@v) (@hm) (@e) (@hi) + have seedStable {input' : PartialEdgeColoring E k} + (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) + (base' : HierarchyBase ett' rho) (K : TashkinovHierarchy ett' base') + (hw : HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma) + (hq : K.dividerCount = 0) : + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma := by + exact @helper_seedStable_543 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@input') (@rho) (@sigma) (@ett') (@base') (@K) (@hw) + (@hq) + have hfixedOne : ∀ t : Fin T.length, A.length ≤ t.val → + muOne (T.edge t) = phi (T.edge t) := by + exact @helper_hfixedOne_2200 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@hAzero) (@hAT) (@hgammaUnused) (@halphaExclusion) (@hstableOne) + (@predecessorIncident) (@terminalIncident) (@missingNotColored) (@seedStable) + have firstPreserved (rho sigma : PartialEdgeColoring E k) (c : Fin k) + (hmiss : ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) + (hc : c ∈ TreeMissingColors rho B) : + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + exact @helper_firstPreserved_590 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBT) + (@firstWitness) (@rho) (@sigma) (@c) (@hmiss) (@hc) + have firstUnaffected (rho : PartialEdgeColoring E k) (a b c : Fin k) + (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (hca : c ≠ a) (hcb : c ≠ b) : + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c := by + exact @helper_firstUnaffected_628 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@rho) + (@a) (@b) (@c) (@hne) (@hp) (@hca) (@hcb) + have hstoredOne : ∀ c ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition muOne T c = HierarchyFirstMissingPosition phi T c := by + exact @helper_hstoredOne_643 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hgammaA) (@hgammaAlpha) (@hmissing) (@hmissingOne) (@firstPreserved) (@firstUnaffected) + obtain ⟨corrOne, hmaxOne, baseOne, KOne, goodOne, hsameOne⟩ := + (StableChangeCasesOneTwoFullTail G k e0 input T phi ett base C ctx + D.gammaOne D.alpha hgammaAlpha hmissing z hpath muOne rfl + (by + dsimp only + rcases hcase with hpos | ⟨hzero, hm⟩ + · exact Or.inl hpos + · exact Or.inr ⟨hzero, Or.inl hm⟩) + hdisjoint hfixedOne hmissingOne hstoredOne).2.2.2.2 + have hgammaTerminalOne : D.gammaOne ∈ MissingColors G muOne (T.vertex D.terminalVertexIndex) := + (TwoColorComponentSwapMissingBehavior G phi D.gammaOne D.alpha hgammaAlpha ctx.proper z).2.2.1 + _ (self phi D.gammaOne D.alpha _) D.alphaMissingTerminal + have hgammaWitnessOne : D.gammaOne ∈ MissingColors G muOne (T.vertex ig) := by + rw [hmissingOne _ higB] + exact hfirstGamma.1 + let COne : HierarchyCounterexample baseOne := + { positive := by rw [corrOne.rungAgreement]; exact C.positive + hierarchy := KOne + good := goodOne + maximum := hmaxOne + notElementary := by + intro he + have hg : T.vertex ig ∈ TreeSequenceVertexSet T := by simp [TreeSequenceVertexSet] + have ht : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet T := by simp + [TreeSequenceVertexSet] + exact Finset.disjoint_left.mp (he hg ht hgt) hgammaWitnessOne hgammaTerminalOne } + have seriesFacts : ∀ j : Fin (ett.rounds + 1), + IsProperEdgeColoring G (ett.series.data.coloring j) ∧ + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + exact @helper_seriesFacts_678 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) + let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := fun j => (seriesFacts j).1 + replacementOneUncolored := fun j => (seriesFacts j).2 + replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } + let PRefl : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { coloring := phi + corresponding := corrRefl + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + minimumContext := ctx } + obtain ⟨POne, hPOne⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx PRefl muOne corrOne baseOne COne hsameOne + have sameStar (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = A := by + exact @helper_sameStar_734 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have samePrefix (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1) = B + := by + simp only [HierarchyFullTailPrefix, HierarchyFullTailLength, sameStar P] + rfl + let rho := POne.coloring + let ettOne := POne.corresponding.replacementETT + let baseOne' := POne.replacementBase + let COne' := POne.counterexample + let ctxOne := POne.minimumContext + let HOne := COne'.hierarchy + let qOne : Fin (HOne.dividerCount + 1) := Fin.last HOne.dividerCount + have hmissingOne' : ∀ v ∈ TreeSequenceVertexSet B, + MissingColors G rho v = MissingColors G phi v := by + rw [show rho = muOne from hPOne] + exact hmissingOne + exact @helper_continuation_2860 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hyB) (@hElementary) (@hfirstAlpha) (@hfirstTheta) + (@hnotA) (@hgammaA) (@hgammaTheta) (@hthetaExclusion) (@hgammaUnused) (@hfirstGamma) + (@higB) (@hmissing) (@self) (@leaf) (@separate) (@hgy) (@hgt) (@hyt) (@prefixMissing) + (@predecessorIncident) (@terminalIncident) (@seedStable) (@hfixedOne) (@firstPreserved) + (@firstUnaffected) (@hgammaTerminalOne) (@POne) (@hPOne) (@sameStar) (@samePrefix) + (@hmissingOne') +theorem HierarchySituationTwoSubcaseOneTwo {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseOneTwoData + G k e0 input T phi ett base C ctx) : + False := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + have htail : 2 ≤ T.length - A.length := D.tailAtLeastTwo + have hBlen : B.length + 1 = T.length := by + simp only [B, HierarchyFullTailPrefix, HierarchyFullTailLength, + TreeSequencePrefix] + change min (A.length + (T.length - A.length - 1)) T.length + 1 = T.length + omega + have hBT : TreeSequenceInitialSegment B T := by + exact @helper_hBT_109 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBlen) + have hApositive (hq : 0 < H.dividerCount) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact @helper_hApositive_116 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hq) + have hAzero (hq : H.dividerCount = 0) : A = base.core := by + have hi : q = 0 := by apply Fin.ext; simp [q, hq] + change HierarchyStarredStage H q = _ + rw [hi] + rfl + have hAT : TreeSequenceInitialSegment A T := by + exact @helper_hAT_134 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hApositive) (@hAzero) + have hAB : TreeSequenceInitialSegment A B := by + exact @helper_hAB_146 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htail) (@hBlen) (@hApositive) + (@hAzero) (@hAT) + have hBterminal : B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex := by + exact @helper_hBterminal_152 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) + have hyB : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last B.length, hBterminal⟩ + have hElementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have firstAt {c : Fin k} + (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by + exact @helper_firstAt_166 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hyB) + (@hElementary) (@c) (@hc) + have hfirstAlpha := firstAt D.alphaMissingPenultimate + have hfirstTheta := firstAt D.thetaMissingPenultimate + have hnotA {c : Fin k} + (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + c ∉ TreeMissingColors phi A := by + exact @helper_hnotA_191 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hApositive) (@hAzero) (@hAT) (@hAB) (@hyB) (@hElementary) (@hfirstTheta) (@c) (@hc) + have hthetaGamma : D.theta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := by + intro hc + rcases Finset.mem_biUnion.mp hc with ⟨eta, heta, hpair⟩ + exact hnotA D.thetaMissingPenultimate + ((GoodHierarchyReservedDisjoint C.good q).1 eta heta hpair) + have hgammaPair : D.gammaOne ∈ C.good.gamma q D.alpha := by + rw [D.gammaPair] + simp + have hgammaA : D.gammaOne ∈ TreeMissingColors phi A := + (GoodHierarchyReservedDisjoint C.good q).1 D.alpha D.alphaStored hgammaPair + have hgammaTheta : D.gammaOne ≠ D.theta := by + intro he + exact hnotA D.thetaMissingPenultimate (he ▸ hgammaA) + have hgammaAlpha : D.gammaOne ≠ D.alpha := by + intro he + exact hnotA D.alphaMissingPenultimate (he ▸ hgammaA) + have hthetaExclusion := HierarchyTailMissingColorExclusion G k e0 input T phi + ett base H hElementary (HierarchyFullTailLength C - 1) + (by change 1 ≤ T.length - A.length - 1; omega) + (by change T.length - A.length - 1 < T.length - A.length; omega) + D.theta (by + change D.theta ∈ MissingColors G phi (B.vertex (Fin.last B.length)) + rw [hBterminal] + exact D.thetaMissingPenultimate) + have hgammaUnused : ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some D.gammaOne := by + exact @helper_hgammaUnused_232 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hfirstAlpha) (@hfirstTheta) (@hgammaPair) (@hgammaTheta) + have halphaExclusion := HierarchyTailMissingColorExclusion G k e0 input T phi + ett base H hElementary (HierarchyFullTailLength C - 1) + (by change 1 ≤ T.length - A.length - 1; omega) + (by change T.length - A.length - 1 < T.length - A.length; omega) + D.alpha (by + change D.alpha ∈ MissingColors G phi (B.vertex (Fin.last B.length)) + rw [hBterminal] + exact D.alphaMissingPenultimate) + have firstWitness (rho : PartialEdgeColoring E k) (X : TreeSequence G e0) + (hXT : TreeSequenceInitialSegment X T) (c : Fin k) + (hc : c ∈ TreeMissingColors rho X) : + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (HierarchyFirstMissingPosition rho T c).val ≤ X.length := by + exact @helper_firstWitness_262 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@rho) (@X) (@hXT) (@c) (@hc) + let ig := HierarchyFirstMissingPosition phi T D.gammaOne + have hfirstGamma := firstWitness phi A hAT D.gammaOne hgammaA + have higB : T.vertex ig ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + have hg : ig.val ≤ A.length := hfirstGamma.2 + refine ⟨⟨ig.val, by omega⟩, ?_⟩ + rfl + have hgammaStage : D.gammaOne ∈ HierarchyStageMissingColors H q := + (Finset.mem_sdiff.mp (C.good.avoidance q D.alpha D.alphaStored hgammaPair)).1 + have hcase : + (0 < H.dividerCount ∧ D.gammaOne ∈ TreeMissingColors phi + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ D.gammaOne ∈ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + exact @helper_hcase_297 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hgammaStage) + have hmissing : D.gammaOne ∈ TreeMissingColors phi B ∧ + D.alpha ∈ TreeMissingColors phi B := by + refine ⟨?_, Finset.mem_biUnion.mpr ⟨_, hyB, D.alphaMissingPenultimate⟩⟩ + rcases Finset.mem_biUnion.mp hgammaA with ⟨v, hv, hm⟩ + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hAB hv, hm⟩ + have hchange := ChangeLemma G k e0 input T phi ett base C ctx.proper + ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers ctx.lexicographicMinimality + hElementary ctx.largeMissingSet D.gammaOne D.alpha hgammaAlpha hmissing + (by + dsimp only + intro _ + rw [hfirstAlpha] + refine ⟨⟨ig, D.penultimateVertexIndex, rfl, rfl, ?_⟩, ?_⟩ + · have hp := D.penultimateVertexPosition + have hg : ig.val ≤ A.length := hfirstGamma.2 + clear * - hp hg htail + omega + · intro hc + rcases (Finset.mem_filter.mp hc).2 with ⟨t, ht, _, he⟩ + exact hgammaUnused t ht he) + have hsame : TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl (T.vertex ig)) = + TwoColorComponent G phi D.gammaOne D.alpha + (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + rw [← hfirstAlpha] + rcases hcase with ⟨hq, hm⟩ | ⟨hq, hm⟩ + · exact hchange.1 ⟨hq, Or.inl hm⟩ + · exact hchange.2.1 ⟨hq, Or.inl hm⟩ + have self (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := by + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl v) = _ + rfl + have leaf (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) (v : V) + (hm : a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v) : + Set.Subsingleton ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)) := by + exact @helper_leaf_350 (@V) (@E) inferInstance inferInstance (@G) (@k) (@rho) (@a) (@b) + (@hne) (@hp) (@v) (@hm) + have separate (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) (u v w : V) + (huv : u ≠ v) (huw : u ≠ w) (hvw : v ≠ w) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hw : a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w) + (hsame : TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v)) : + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + exact @helper_separate_369 (@V) (@E) inferInstance inferInstance + (@G) (@k) (@self) (@leaf) (@rho) (@a) (@b) (@hne) (@hp) (@u) (@v) (@w) (@huv) (@huw) + (@hvw) (@hu) (@hv) (@hw) (@hsame) + have hgy : T.vertex ig ≠ T.vertex D.penultimateVertexIndex := by + exact @helper_hgy_403 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hApositive) + (@hAzero) (@hfirstTheta) (@hgammaTheta) (@hgammaAlpha) (@hfirstGamma) (@hcase) (@hchange) + have hgt : T.vertex ig ≠ T.vertex D.terminalVertexIndex := by + exact @helper_hgt_409 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hApositive) + (@hAzero) (@hgammaTheta) (@hgammaAlpha) (@hfirstGamma) (@hcase) (@hchange) + exact @helper_continuation_1912 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hyB) (@hElementary) (@hfirstAlpha) (@hfirstTheta) + (@hnotA) (@hgammaA) (@hgammaTheta) (@hgammaAlpha) (@hthetaExclusion) (@hgammaUnused) + (@halphaExclusion) (@firstWitness) (@hfirstGamma) (@higB) (@hcase) (@hmissing) (@hsame) + (@self) (@leaf) (@separate) (@hgy) (@hgt) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne.lean new file mode 100644 index 0000000000..dc29467964 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne.lean @@ -0,0 +1,145 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeOne.Preparation2 + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalization +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.MinimumContextTransport +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TerminalStoredColors +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix + +/-! +# Hierarchy Situation Two Subcase Three One + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open HierarchySituationTwoSubcaseThreeOnePreparation + +theorem HierarchySituationTwoSubcaseThreeOne {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData + G k e0 input T phi ett base C ctx) : + False := by + classical + let alpha : Fin k := D.alpha + let theta : Fin k := D.theta + let lastIndex : Fin T.length := D.lastEdgeIndex + let penIndex : Fin (T.length + 1) := D.penultimateVertexIndex + let endIndex : Fin (T.length + 1) := D.terminalVertexIndex + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (ell - 2) + let Bplus := HierarchyFullTailPrefix C (ell - 1) + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + have lastColor : phi (T.edge lastIndex) = some theta := D.thetaOnLastEdge + have alphaTerminal : alpha ∈ MissingColors G phi (T.vertex endIndex) := D.alphaMissingTerminal + have alphaBefore : alpha ∈ TreeMissingColors phi B := D.alphaMissingTwoBefore + have alphaUnused : ∀ t : Fin T.length, A.length ≤ t.val → phi (T.edge t) ≠ some alpha := + D.alphaUnusedOnFullTail + have lastPosition : lastIndex.val + 1 = T.length := D.lastEdgePosition + have penPosition : penIndex.val + 1 = T.length := D.penultimateVertexPosition + have endPosition : endIndex.val = T.length := D.terminalVertexPosition + have thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex) := D.thetaPresentPenultimate + have oldRoute := P2813_T1_TerminalRoute G k e0 input T phi ett + have h_exception := helper_h_exception_6390 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) (@ctx) (@D) (@lastColor) (@alphaTerminal) (@alphaBefore) (@lastPosition) (@penPosition) + (@endPosition) (@thetaPresent) + exact helper_continuation_3712 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@lastColor) (@alphaTerminal) (@alphaBefore) (@alphaUnused) (@lastPosition) (@penPosition) + (@endPosition) (@oldRoute) (@h_exception) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean new file mode 100644 index 0000000000..9c6710b58f --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean @@ -0,0 +1,5033 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalization +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.MinimumContextTransport +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TerminalStoredColors +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix + +/-! +# HierarchySituationTwoSubcaseThreeOne: supporting constructions, part 1 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.HierarchySituationTwoSubcaseThreeOnePreparation + +/-- Typed data construction shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperPOne1741.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoCaseThreeOneData G k e0 input T phi + ett base C ctx) → + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := + D.terminalVertexIndex; + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha z; + (corrOne : + CorrespondingExtendedTashkinovTree G k e0 ett muOne T) → + MaximumProperty corrOne.replacementETT → + (baseOne : HierarchyBase corrOne.replacementETT muOne) → + (COne : HierarchyCounterexample baseOne) → + SameGoodHierarchy C.good COne.good → + HierarchyMinimumCounterexampleContext G k e0 + corrOne.replacementInput T muOne + corrOne.replacementETT baseOne COne → + HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex z muOne corrOne + maxOne baseOne COne sameOne ctxOne + exact { + coloring := muOne + corresponding := corrOne + maximum := maxOne + replacementBase := baseOne + counterexample := COne + sameGood := sameOne + minimumContext := ctxOne } + +/-- Typed data construction shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperFinalData2160.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoCaseThreeOneData G k e0 input T phi + ett base C ctx) → + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := + D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := + D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + (eta : Fin k) → + (2 : ℕ) ≤ ell → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha z; + let muTwo : PartialEdgeColoring E k := + TwoColorComponentSwap G muOne theta eta z; + eta ∈ MissingColors G muTwo (T.vertex endIndex) → + eta ∈ + MissingColors G muTwo (T.vertex penIndex) → + muTwo (T.edge lastIndex) = some alpha → + (PTwo : + HierarchyReplacementPresentation G k e0 + input T phi ett base C ctx) → + PTwo.coloring = muTwo → + alpha ∉ + MissingColors G muTwo + (T.vertex penIndex) → + HierarchyStarredStage + PTwo.counterexample.hierarchy + (Fin.last + PTwo.counterexample.hierarchy.dividerCount) = + A → + HierarchyPathNumber C.hierarchy = + HierarchyPathNumber + PTwo.counterexample.hierarchy → + eta ∈ + HierarchyStoredColorsAt + PTwo.counterexample.hierarchy + (Fin.last + PTwo.counterexample.hierarchy.dividerCount) → + (gammaOne gammaTwo : Fin k) → + gammaOne ≠ gammaTwo → + PTwo.counterexample.good.gamma + (Fin.last + PTwo.counterexample.hierarchy.dividerCount) + eta = + (insert gammaOne + ({ gammaTwo } : + Finset (Fin k)) : + Finset (Fin k)) → + HierarchySituationTwoCaseOneData + G k e0 + PTwo.corresponding.replacementInput + T PTwo.coloring + PTwo.corresponding.replacementETT + PTwo.replacementBase + PTwo.counterexample + PTwo.minimumContext := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex H + q A ell lastPosition penPosition endPosition eta hTailAtLeast z muOne muTwo etaTerminalTwo + etaPenultimateTwo lastTwo PTwo colorTwo alphaPresentTwo starTwo pathTwoEq etaStoredTwo + gammaOne gammaTwo gammaDistinct gammaPair + exact { + tailAtLeastTwo := by + change 2 ≤ T.length - (HierarchyStarredStage PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount)).length + rw [starTwo] + exact hTailAtLeast + pathNumberFull := by + rw [← pathTwoEq] + change HierarchyPathNumber C.hierarchy = T.length - + (HierarchyStarredStage PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount)).length + rw [starTwo] + exact D.pathNumberFull + lastEdgeIndex := lastIndex + penultimateVertexIndex := penIndex + terminalVertexIndex := endIndex + lastEdgePosition := lastPosition + penultimateVertexPosition := penPosition + terminalVertexPosition := endPosition + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate + theta := alpha + thetaOnLastEdge := colorTwo.symm ▸ lastTwo + thetaPresentPenultimate := colorTwo.symm ▸ alphaPresentTwo + alpha := eta + gammaOne := gammaOne + gammaTwo := gammaTwo + alphaMissingPenultimate := colorTwo.symm ▸ etaPenultimateTwo + alphaMissingTerminal := colorTwo.symm ▸ etaTerminalTwo + alphaStored := etaStoredTwo + gammaPair := gammaPair + gammaDistinct := gammaDistinct } + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation3310Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + ∀ (B Bplus : TreeSequence G e0), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + phi (T.edge lastIndex) = some theta → + alpha ∈ MissingColors G phi (T.vertex endIndex) → + alpha ∈ TreeMissingColors phi B → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some alpha) → + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ( + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TreeIncidentEdge Tn f ∧ + (∃ c ∈ TreeMissingColors phi Tn ∪ Dn, phi f = some c) ∧ + TashkinovAugmentationSequence phi seed T) → + ∀ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex penIndex) → + theta ∈ C.good.gamma q eta → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment B Bplus → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A Bplus → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) → + ( + ∀ {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors phi X ⊆ TreeMissingColors phi Y) → + ∀ (vAlpha : V), + ( + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + ( + ∀ (X : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi X, + c ∈ + MissingColors G phi + (X.vertex (HierarchyFirstMissingPosition phi X c))) → + T.vertex penIndex ∈ TreeSequenceVertexSet Bplus → + Bplus = HierarchyFullTailPrefix C (ell - (1 : ℕ)) → + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet + (HierarchyFullTailPrefix C (ell - (1 : ℕ)))) → + alpha ≠ eta → + theta ∈ TreeMissingColors phi A → + eta ∉ TreeMissingColors phi A → + alpha ∈ TreeMissingColors phi Bplus → + theta ∈ TreeMissingColors phi Bplus → + theta ∈ + TreeMissingColors phi + (HierarchyFullTailPrefix C (ell - (1 : ℕ))) ∧ + alpha ∈ + TreeMissingColors phi + (HierarchyFullTailPrefix C (ell - (1 : ℕ))) → + HierarchyFirstMissingPosition phi T eta = penIndex → + (↑(HierarchyFirstMissingPosition phi T theta) : ℕ) ≤ + A.length → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ + B.length → + vAlpha ∈ TreeSequenceVertexSet Bplus → + ( + theta ∉ TreeMissingColors phi A ∨ + alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition phi T theta)) + (T.vertex + (HierarchyFirstMissingPosition phi T alpha)) ∧ + theta ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < + (↑(HierarchyFirstMissingPosition phi T alpha) : + ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k))) → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + phi (T.edge t) ≠ some theta) → + theta ≠ alpha → + ( + H.dividerCount = (0 : ℕ) → + theta ∈ TreeMissingColors phi Tn) → + ( + (0 : ℕ) < H.dividerCount → + theta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + False + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation3399Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + ∀ (B Bplus : TreeSequence G e0), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + phi (T.edge lastIndex) = some theta → + alpha ∈ MissingColors G phi (T.vertex endIndex) → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some alpha) → + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ( + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TreeIncidentEdge Tn f ∧ + (∃ c ∈ TreeMissingColors phi Tn ∪ Dn, phi f = some c) ∧ + TashkinovAugmentationSequence phi seed T) → + ∀ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex penIndex) → + theta ∈ C.good.gamma q eta → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment B Bplus → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A Bplus → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) → + ∀ (vAlpha : V), + ( + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + T.vertex penIndex ∈ TreeSequenceVertexSet Bplus → + Bplus = HierarchyFullTailPrefix C (ell - (1 : ℕ)) → + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyFullTailPrefix C (ell - (1 : ℕ)))) → + alpha ≠ eta → + theta ∈ TreeMissingColors phi A → + eta ∉ TreeMissingColors phi A → + alpha ∈ TreeMissingColors phi Bplus → + theta ∈ TreeMissingColors phi Bplus → + theta ∈ + TreeMissingColors phi + (HierarchyFullTailPrefix C (ell - (1 : ℕ))) ∧ + alpha ∈ + TreeMissingColors phi + (HierarchyFullTailPrefix C (ell - (1 : ℕ))) → + HierarchyFirstMissingPosition phi T eta = penIndex → + (↑(HierarchyFirstMissingPosition phi T theta) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ B.length → + vAlpha ∈ TreeSequenceVertexSet Bplus → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + phi (T.edge t) ≠ some theta) → + theta ≠ alpha → + ( + H.dividerCount = (0 : ℕ) → + theta ∈ TreeMissingColors phi Tn) → + (0 : ℕ) < H.dividerCount ∧ + theta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∨ + H.dividerCount = (0 : ℕ) ∧ + (theta ∈ TreeMissingColors phi Tn ∨ + theta ∈ TreeMissingColors phi A ∧ + theta ∉ TashkinovStoredColors ett.series.data n ∧ + alpha ∉ TashkinovStoredColors ett.series.data n) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ + b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet + (Sum.inl v)).Subsingleton) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ + b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint + (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b + (Sum.inl u))) → + theta ∈ + MissingColors G phi + (T.vertex + (HierarchyFirstMissingPosition phi T theta)) → + alpha ∈ + MissingColors G phi + (T.vertex + (HierarchyFirstMissingPosition phi T alpha)) → + T.vertex + (HierarchyFirstMissingPosition phi T theta) ≠ + T.vertex endIndex → + Disjoint + (TwoColorComponent G phi theta alpha + (Sum.inl (T.vertex endIndex))) + (TwoColorComponent G phi theta alpha + (Sum.inl + (T.vertex + (HierarchyFirstMissingPosition phi T + theta)))) → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + TwoColorPathComponent G phi theta alpha z → + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha z; + (( + ∀ (v : V), + Sum.inl v ∉ + TwoColorComponent G phi theta alpha z → + MissingColors G muOne v = + MissingColors G phi v) ∧ + ( + ∀ (v : V), + Sum.inl v ∈ + TwoColorComponent G phi theta alpha z → + theta ∈ MissingColors G phi v → + alpha ∈ MissingColors G muOne v) ∧ + ( + ∀ (v : V), + Sum.inl v ∈ + TwoColorComponent G phi theta alpha z → + alpha ∈ MissingColors G phi v → + theta ∈ MissingColors G muOne v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ theta → + c ≠ alpha → + (c ∈ MissingColors G muOne v ↔ + c ∈ MissingColors G phi v)) → + ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) + (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Bplus) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet Bplus → + v ∈ TreeSequenceVertexSet Bplus → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ + TwoColorComponent G rho a b z → + Sum.inl v ∉ + TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet Bplus, + MissingColors G + (TwoColorComponentSwap G rho a b + z) + w = + MissingColors G rho w) → + T.vertex + (HierarchyFirstMissingPosition phi T theta) ∈ + TreeSequenceVertexSet Bplus → + T.vertex + (HierarchyFirstMissingPosition phi T + alpha) ∈ + TreeSequenceVertexSet Bplus → + (∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G muOne v = + MissingColors G phi v) → + (∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G muOne v = + MissingColors G phi v) → + False + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation4221Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + ∀ (B Bplus : TreeSequence G e0), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ∀ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex penIndex) → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment B Bplus → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A Bplus → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) → + ∀ (vAlpha : V), + ( + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + T.vertex penIndex ∈ TreeSequenceVertexSet Bplus → + Bplus = HierarchyFullTailPrefix C (ell - (1 : ℕ)) → + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyFullTailPrefix C (ell - (1 : ℕ)))) → + alpha ≠ eta → + alpha ∈ TreeMissingColors phi Bplus → + theta ∈ TreeMissingColors phi Bplus → + HierarchyFirstMissingPosition phi T eta = penIndex → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ B.length → + vAlpha ∈ TreeSequenceVertexSet Bplus → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + phi (T.edge t) ≠ some theta) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet + (Sum.inl v)).Subsingleton) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + alpha ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) → + T.vertex (HierarchyFirstMissingPosition phi T theta) ≠ + T.vertex endIndex → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha z; + ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Bplus) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet Bplus → + v ∈ TreeSequenceVertexSet Bplus → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet Bplus, + MissingColors G (TwoColorComponentSwap G rho a b z) + w = + MissingColors G rho w) → + T.vertex (HierarchyFirstMissingPosition phi T theta) ∈ + TreeSequenceVertexSet Bplus → + T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ + TreeSequenceVertexSet Bplus → + (∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G muOne v = MissingColors G phi v) → + (∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G muOne v = MissingColors G phi v) → + TreeMissingColors muOne Bplus = + TreeMissingColors phi Bplus → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + muOne (T.edge t) = phi (T.edge t)) → + muOne (T.edge lastIndex) = some alpha → + theta ∈ MissingColors G muOne (T.vertex endIndex) → + eta ∈ MissingColors G muOne (T.vertex penIndex) → + ( + H.dividerCount = (0 : ℕ) → + A = base.core) → + TreeSequenceInitialSegment Tn Bplus → + ( + ∀ (aLen : ℕ), + aLen = A.length → + ( + ∀ (t : Fin Bplus.length), + (↑t : ℕ) < aLen ∨ aLen ≤ (↑t : ℕ)) → + ∀ (t : Fin Bplus.length), + muOne (Bplus.edge t) = phi (Bplus.edge t)) → + ( + ∀ (t : Fin Bplus.length), + muOne (Bplus.edge t) = phi (Bplus.edge t)) → + Bplus.length = B.length + (1 : ℕ) → + ( + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S Bplus → + TashkinovAugmentationSequence muOne S Bplus) → + (ett.series.data.kind n = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence muOne Tn Bplus ∨ + (ett.series.data.kind n = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = + ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence muOne seed + Bplus) → + ( + ∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ TreeMissingColors rho Bplus, + c ∈ + MissingColors G rho + (T.vertex + (HierarchyFirstMissingPosition rho T + c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : + ℕ) ≤ + Bplus.length) → + ( + ∀ (rho sigma : PartialEdgeColoring E k) + (c : Fin k), + ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Bplus) → + (∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G sigma v = + MissingColors G rho v) → + c ∈ TreeMissingColors rho Bplus → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + ( + ∀ (rho sigma : PartialEdgeColoring E k) + (c : Fin k), + ( + ∀ (v : V), + c ∈ MissingColors G sigma v ↔ + c ∈ MissingColors G rho v) → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ c ∈ HierarchyStoredColorsAt H q, + alpha ∈ C.good.gamma q c ∨ + theta ∈ C.good.gamma q c → + (↑(HierarchyFirstMissingPosition phi T + c) : + ℕ) ≤ + Bplus.length) → + theta ∈ TreeMissingColors muOne Bplus ∧ + alpha ∈ TreeMissingColors muOne Bplus → + TashkinovAugmentationSequence phi Bplus T → + ∀ + (corrOne : + CorrespondingExtendedTashkinovTree G k + e0 ett muOne T) + (maxOne : + MaximumProperty corrOne.replacementETT) + (baseOne : + HierarchyBase corrOne.replacementETT + muOne) + (COne : HierarchyCounterexample baseOne) + (sameOne : + SameGoodHierarchy C.good COne.good) + (ctxOne : + HierarchyMinimumCounterexampleContext G + k e0 corrOne.replacementInput T muOne + corrOne.replacementETT baseOne COne), + let POne : + HierarchyReplacementPresentation G k e0 + input T phi ett base C ctx := + helperPOne1741 G k e0 input T phi ett + base C ctx D corrOne maxOne baseOne + COne sameOne ctxOne; + let HOne : + TashkinovHierarchy + corrOne.replacementETT baseOne := + COne.hierarchy; + let qOne : + Fin (HOne.dividerCount + (1 : ℕ)) := + Fin.last HOne.dividerCount; + HierarchyStarredStage HOne qOne = A → + H.dividerCount = HOne.dividerCount → + HierarchyFullTailPrefix COne + (HierarchyFullTailLength COne - + (1 : ℕ)) = + Bplus → + ColoredVertexSetElementary G muOne + (TreeSequenceVertexSet Bplus) → + ( + ∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X + Bplus → + TreeMissingColors muOne X = + TreeMissingColors phi X) → + HierarchyFirstMissingPosition muOne + T theta = + HierarchyFirstMissingPosition phi + T theta → + HierarchyFirstMissingPosition muOne + T eta = + penIndex → + theta ∈ + MissingColors G muOne + (T.vertex + (HierarchyFirstMissingPosition + phi T theta)) → + theta ≠ eta → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + muOne (T.edge t) ≠ + some theta) → + theta ∉ + HierarchyStoredColorsAt HOne + qOne → + corrOne.replacementETT.series.data.tree + (Fin.last + corrOne.replacementETT.rounds).castSucc = + Tn → + (0 : ℕ) < HOne.dividerCount ∧ + theta ∈ + TreeMissingColors muOne + (HOne.stage + (⟨HOne.dividerCount, + by + have := + CorrespondingExtendedTashkinovTree.rungAgreement + corrOne + have := + TreeSequence.positive + T + omega⟩ : + Fin + (HOne.dividerCount + + (2 : ℕ)))) ∨ + HOne.dividerCount = + (0 : ℕ) ∧ + (theta ∈ + TreeMissingColors muOne + (corrOne.replacementETT.series.data.tree + (Fin.last + corrOne.replacementETT.rounds).castSucc) ∨ + theta ∈ + TreeMissingColors muOne + (HierarchyStarredStage + HOne qOne) ∧ + theta ∉ + TashkinovStoredColors + corrOne.replacementETT.series.data + (Fin.last + corrOne.replacementETT.rounds) ∧ + eta ∉ + TashkinovStoredColors + corrOne.replacementETT.series.data + (Fin.last + corrOne.replacementETT.rounds)) → + eta ∈ + TreeMissingColors muOne + Bplus → + theta ∈ + TreeMissingColors muOne + Bplus → + TwoColorComponent G muOne + theta eta + (Sum.inl + (T.vertex + (HierarchyFirstMissingPosition + phi T theta))) = + TwoColorComponent G + muOne theta eta + (Sum.inl + (T.vertex penIndex)) → + T.vertex + (HierarchyFirstMissingPosition + phi T theta) ≠ + T.vertex penIndex → + False + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation3757Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + ∀ (B Bplus : TreeSequence G e0), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ∀ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex penIndex) → + theta ∈ C.good.gamma q eta → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment B Bplus → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A Bplus → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) → + ∀ (vAlpha : V), + ( + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + T.vertex penIndex ∈ TreeSequenceVertexSet Bplus → + Bplus = HierarchyFullTailPrefix C (ell - (1 : ℕ)) → + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyFullTailPrefix C (ell - (1 : ℕ)))) → + alpha ≠ eta → + theta ∈ TreeMissingColors phi A → + eta ∉ TreeMissingColors phi A → + alpha ∈ TreeMissingColors phi Bplus → + theta ∈ TreeMissingColors phi Bplus → + HierarchyFirstMissingPosition phi T eta = penIndex → + (↑(HierarchyFirstMissingPosition phi T theta) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ B.length → + vAlpha ∈ TreeSequenceVertexSet Bplus → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + phi (T.edge t) ≠ some theta) → + theta ≠ alpha → + ( + H.dividerCount = (0 : ℕ) → + theta ∈ TreeMissingColors phi Tn) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet + (Sum.inl v)).Subsingleton) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ + b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + theta ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T theta)) → + alpha ∈ + MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) → + T.vertex (HierarchyFirstMissingPosition phi T theta) ≠ + T.vertex endIndex → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha z; + ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) + (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Bplus) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet Bplus → + v ∈ TreeSequenceVertexSet Bplus → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet Bplus, + MissingColors G + (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → + T.vertex (HierarchyFirstMissingPosition phi T theta) ∈ + TreeSequenceVertexSet Bplus → + T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ + TreeSequenceVertexSet Bplus → + (∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G muOne v = MissingColors G phi v) → + (∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G muOne v = MissingColors G phi v) → + TreeMissingColors muOne Bplus = + TreeMissingColors phi Bplus → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + muOne (T.edge t) = phi (T.edge t)) → + muOne (T.edge lastIndex) = some alpha → + theta ∈ + MissingColors G muOne (T.vertex endIndex) → + eta ∈ MissingColors G muOne (T.vertex penIndex) → + ( + ∀ (a d : ℕ) + (hb : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, + by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + ( + H.dividerCount = (0 : ℕ) → + A = base.core) → + TreeSequenceInitialSegment Tn Bplus → + ( + ∀ (aLen : ℕ), + aLen = A.length → + ( + ∀ (t : Fin Bplus.length), + (↑t : ℕ) < aLen ∨ aLen ≤ (↑t : ℕ)) → + ∀ (t : Fin Bplus.length), + muOne (Bplus.edge t) = + phi (Bplus.edge t)) → + ( + ∀ (t : Fin Bplus.length), + muOne (Bplus.edge t) = + phi (Bplus.edge t)) → + Bplus.length = B.length + (1 : ℕ) → + ( + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S + Bplus → + TashkinovAugmentationSequence muOne S + Bplus) → + (ett.series.data.kind n = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence muOne Tn + Bplus ∨ + (ett.series.data.kind n = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = + ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence muOne + seed Bplus) → + ( + ∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ TreeMissingColors rho Bplus, + c ∈ + MissingColors G rho + (T.vertex + (HierarchyFirstMissingPosition + rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho + T c) : + ℕ) ≤ + Bplus.length) → + ( + ∀ + (rho sigma : PartialEdgeColoring E k) + (c : Fin k), + ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Bplus) → + (∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G sigma v = + MissingColors G rho v) → + c ∈ TreeMissingColors rho Bplus → + HierarchyFirstMissingPosition + sigma T c = + HierarchyFirstMissingPosition rho + T c) → + ( + ∀ + (rho sigma : + PartialEdgeColoring E k) + (c : Fin k), + ( + ∀ (v : V), + c ∈ MissingColors G sigma v ↔ + c ∈ MissingColors G rho v) → + HierarchyFirstMissingPosition sigma + T c = + HierarchyFirstMissingPosition rho + T c) → + (∀ c ∈ HierarchyStoredColorsAt H q, + alpha ∈ C.good.gamma q c ∨ + theta ∈ C.good.gamma q c → + (↑(HierarchyFirstMissingPosition + phi T c) : + ℕ) ≤ + Bplus.length) → + theta ∈ + TreeMissingColors muOne Bplus ∧ + alpha ∈ + TreeMissingColors muOne Bplus → + TashkinovAugmentationSequence phi + Bplus T → + ∀ + (corrOne : + CorrespondingExtendedTashkinovTree + G k e0 ett muOne T), + MaximumProperty + corrOne.replacementETT → + ∀ + (baseOne : + HierarchyBase + corrOne.replacementETT muOne) + (KOne : + TashkinovHierarchy + corrOne.replacementETT + baseOne) + (goodOne : GoodHierarchy KOne), + SameGoodHierarchy C.good + goodOne → + False + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation6530Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (_ : alpha ∈ MissingColors G phi (T.vertex endIndex)) (_ : alpha ∈ TreeMissingColors phi B) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { + tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (_ : MaximumProperty corrMinus.replacementETT) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) (_ : baseMinus.core = base.core) + (_ : baseMinus.closure = base.closure) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hcountMinus : HMinus.dividerCount = C.hierarchy.dividerCount) + (_ : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HMinus.stage j.castSucc = + C.hierarchy.stage (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j).castSucc) + (_ : + ∀ (j : Fin HMinus.dividerCount), + (↑(HMinus.dividerPosition j) : ℕ) = + (↑(C.hierarchy.dividerPosition (Fin.cast hcountMinus j)) : ℕ)) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (_ : + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) + (_ : TreeSequenceInitialSegment Y Z), + TreeSequenceInitialSegment X Z) + (_ : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))) (_ : (↑j : ℕ) ≠ (0 : ℕ)), + HierarchyStarredStage H j = H.stage j.castSucc) + (_ : B.length + (2 : ℕ) = T.length) (_ : Bplus.length + (1 : ℕ) = T.length) + (_ : TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment A B) + (_ : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) + R.minus) + (_ : + R.minus.length = + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))).length + (1 : ℕ)) + (_ : R.minus.length = B.length + (1 : ℕ)) (_ : R.minus.length + (1 : ℕ) = T.length) + (_ : + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) + (_ : + ∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))) + (_ : c ∈ MissingColors G phi (X.vertex i)), + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) + (_ : + ∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))) + (_ : (↑i : ℕ) < (↑(HierarchyFirstMissingPosition phi X c) : ℕ)), + c ∉ MissingColors G phi (X.vertex i)) + (_ : + ∀ (X : TreeSequence G e0) (c : Fin k) (t : ℕ) (_ : t ≤ X.length) + (_ : + ∀ (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < t → + c ∉ MissingColors G phi (X.vertex i)), + t ≤ (↑(HierarchyFirstMissingPosition phi X c) : ℕ)) + (_ : + ∀ (eta c : Fin k) (_ : eta ∈ HierarchyStoredColorsAt H q) (_ : c ∈ C.good.gamma q eta), + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k))) + (_ : + ∀ (eta : Fin k) (_ : eta ∈ HierarchyStoredColorsAt H q) (_ : theta ∈ C.good.gamma q eta), + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) ≤ B.length) + (_ : + corrMinus.replacementETT.series.data.tree + (Fin.last corrMinus.replacementETT.rounds).castSucc = + Tn ∧ + corrMinus.replacementETT.series.data.kind (Fin.last corrMinus.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrMinus.replacementETT.series.data + (Fin.last corrMinus.replacementETT.rounds) = + TashkinovStoredColors ett.series.data n) + (_ : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + let jo : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j; + HierarchyStarredStage HMinus j = HierarchyStarredStage H jo ∧ + HierarchyStoredColorsAt HMinus j = HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HMinus j = HierarchyStageMissingColors H jo) + (_ : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HMinus.stage j.castSucc = + H.stage (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j).castSucc), + False + +theorem helper_transSegment_333.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z := by + classical + intro V E G e0 X Y Z hXY hYZ + as_aux_lemma => + refine ⟨le_trans hXY.1 hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +theorem helper_restrictSegment_343.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Z → + TreeSequenceInitialSegment Y Z → + X.length ≤ Y.length → + TreeSequenceInitialSegment X Y := by + classical + intro V E G e0 X Y Z hXZ hYZ hXY + as_aux_lemma => + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + +theorem helper_hAT_359.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → + HierarchyStarredStage H j = H.stage j.castSucc) → + TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A starredAt + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hs : (⟨1, Nat.lt_succ_of_le (Nat.succ_le_succ (Nat.zero_le _))⟩ : Fin + (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp [hz]) + simpa [A, hq, HierarchyStarredStage, hs, H.terminalStage] using H.coreInsideFirst + · have ha : A = H.stage q.castSucc := starredAt q (by simpa [q] using hz) + rw [ha] + have hs : H.stage q.succ = T := by convert H.terminalStage using 1; congr 1 + simpa only [hs] using H.nested q + +theorem helper_firstLe_400.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : TreeSequence G e0) (c : Fin k) + (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ G k e0 phi X c i hi + let _ := Fintype.ofFinite V + as_aux_lemma => + unfold HierarchyFirstMissingPosition + dsimp only + have hm : i ∈ Finset.univ.filter + (fun j => c ∈ MissingColors G phi (X.vertex j)) := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ + rw [dite_eq_left ⟨i, hm⟩] + exact Finset.min'_le _ _ hm + +theorem helper_firstMissing_411.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi X, + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by + classical + intro V E _ _ G k e0 phi X c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + unfold HierarchyFirstMissingPosition + dsimp only + have hm : i ∈ Finset.univ.filter + (fun j => c ∈ MissingColors G phi (X.vertex j)) := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hcv⟩ + rw [dite_eq_left ⟨i, hm⟩] + exact (Finset.mem_filter.mp (Finset.min'_mem _ ⟨i, hm⟩)).2 + +theorem helper_oldAvoid_453.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A eta c hs hc + as_aux_lemma => + have hh := (Finset.mem_sdiff.mp (C.good.avoidance q eta hs hc)).2 + change c ∉ HierarchySegmentColors H q eta at hh + unfold HierarchySegmentColors at hh + dsimp only at hh + have hend : H.stage q.succ = T := by convert H.terminalStage using 1; congr 1 + rw [hend] at hh + exact hh + +theorem helper_thetaCutoff_466.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + phi (T.edge lastIndex) = some theta → + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (∀ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex penIndex) → + theta ∉ C.good.gamma q eta) → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + B.length + (2 : ℕ) = T.length → + ( + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + ( + ∀ (X : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi X, + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c))) → + ( + ∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k))) → + ∀ eta ∈ HierarchyStoredColorsAt H q, + theta ∈ C.good.gamma q eta → + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex H q A ell B + lastColor lastPosition penPosition hnone' htail hell hBL vertexMem firstMissing oldAvoid + eta hs hc + as_aux_lemma => + have hlast : lastIndex.val = B.length + 1 := by + have := lastPosition + omega + have hpen : penIndex.val = B.length + 1 := by + have := penPosition + omega + by_contra hcut + have hgt : B.length < (HierarchyFirstMissingPosition phi T eta).val := by omega + by_cases hafter : B.length + 1 < (HierarchyFirstMissingPosition phi T eta).val + · apply oldAvoid eta theta hs hc + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, lastIndex, + by have := lastPosition; omega, + by have := lastIndex.isLt; omega, lastColor⟩ + · have heq : HierarchyFirstMissingPosition phi T eta = penIndex := by + apply Fin.ext + have hpos := penPosition + omega + have hm := firstMissing T eta (by + by_contra h + have he : HierarchyFirstMissingPosition phi T eta = Fin.last T.length := by + unfold HierarchyFirstMissingPosition + dsimp only + rw [dite_eq_right] + intro hne + obtain ⟨i, hi⟩ := hne + exact h (Finset.mem_biUnion.mpr ⟨T.vertex i, vertexMem T i, + (Finset.mem_filter.mp hi).2⟩) + have hv := congrArg Fin.val he + simp only [Fin.val_last] at hv + omega) + rw [heq] at hm + exact hnone' eta hs hm hc + +theorem helper_hBBplusOuter_953.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D penIndex endIndex ell B Bplus penPosition + endPosition hBLouter hPLouter + refine ⟨by omega, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + +theorem helper_hATouter_959.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hs : (⟨1, Nat.lt_succ_of_le (Nat.succ_le_succ (Nat.zero_le _))⟩ : Fin (H.dividerCount + + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp [hz]) + simpa [A, hq, HierarchyStarredStage, hs, H.terminalStage] using H.coreInsideFirst + · have hq : q ≠ 0 := by + intro he + have hv := congrArg Fin.val he + simp [q] at hv + omega + have ha : A = H.stage q.castSucc := by + dsimp [A] + rw [← Fin.succ_pred q hq] + rfl + rw [ha] + have hs : H.stage q.succ = T := by + convert H.terminalStage using 1 + congr 1 + simpa only [hs] using H.nested q + +theorem helper_hABouter_980.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D penIndex endIndex H q A ell B Bplus + penPosition endPosition hTailAtLeast hellOuter hBLouter hPLouter hATouter + refine ⟨by omega, ?_, ?_⟩ + · intro i + exact hATouter.2.1 i + · intro i + exact hATouter.2.2 i + +theorem helper_hABplusouter_986.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D penIndex endIndex H q A ell B Bplus + penPosition endPosition hTailAtLeast hellOuter hBLouter hPLouter hATouter + refine ⟨by omega, ?_, ?_⟩ + · intro i + exact hATouter.2.1 i + · intro i + exact hATouter.2.2 i + +theorem helper_firstMissingOuter_1008.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi X, + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by + classical + intro V E _ _ G k e0 phi X c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + unfold HierarchyFirstMissingPosition + dsimp only + have hm : i ∈ Finset.univ.filter + (fun j => c ∈ MissingColors G phi (X.vertex j)) := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hcv⟩ + rw [dite_eq_left ⟨i, hm⟩] + exact (Finset.mem_filter.mp (Finset.min'_mem _ ⟨i, hm⟩)).2 + +theorem helper_firstLeOuter_1021.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : TreeSequence G e0) (c : Fin k) + (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ G k e0 phi X c i hi + let _ := Fintype.ofFinite V + as_aux_lemma => + unfold HierarchyFirstMissingPosition + dsimp only + have hm : i ∈ Finset.univ.filter + (fun j => c ∈ MissingColors G phi (X.vertex j)) := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ + rw [dite_eq_left ⟨i, hm⟩] + exact Finset.min'_le _ _ hm + +theorem helper_firstBoundByPrefix_1032.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + ( + ∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) → + ∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors phi X, + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ X.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D firstLeOuter X hXT c hc + as_aux_lemma => + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + let j : Fin (T.length + 1) := Fin.castLE (Nat.succ_le_succ hXT.1) i + have hj : c ∈ MissingColors G phi (T.vertex j) := by + rw [hXT.2.1 i] + exact hvc + have hfirst := firstLeOuter T c j hj + change (HierarchyFirstMissingPosition phi T c).val ≤ j.val at hfirst + dsimp [j] at hfirst + have hi := i.isLt + omega + +theorem helper_hPenultimateInBplus_1048.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + T.vertex penIndex ∈ TreeSequenceVertexSet Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D penIndex endIndex ell B Bplus penPosition + endPosition hBLouter hPLouter hBplusTouter + let i : Fin (Bplus.length + 1) := ⟨Bplus.length, by omega⟩ + have hi : Fin.castLE (Nat.succ_le_succ hBplusTouter.1) i = + penIndex := by + apply Fin.ext + have hp := penPosition + have hpos : penIndex.val = Bplus.length := by + have h1 : penIndex.val + 1 = Bplus.length + 1 := + hp.trans hPLouter.symm + omega + simp only [Fin.val_castLE] + simpa [i] using hpos.symm + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨i, Finset.mem_univ _, by + apply congrArg T.vertex + exact hi⟩ + +theorem helper_hAlphaEtaNe_1071.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (B Bplus : TreeSequence G e0), + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ∀ eta ∈ MissingColors G phi (T.vertex penIndex), + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment B Bplus → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) → + ∀ vAlpha ∈ TreeSequenceVertexSet B, + alpha ∈ MissingColors G phi vAlpha → + T.vertex penIndex ∈ TreeSequenceVertexSet Bplus → + alpha ≠ eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha penIndex endIndex B Bplus + penPosition endPosition eta hetaMissing hBLouter hPLouter hBTouter hBBplusOuter hElemOuter + vAlpha hvAlpha hAlphaAt hPenultimateInBplus he + have hvNe : vAlpha ≠ T.vertex penIndex := by + intro hv + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hvAlpha + have hi : Fin.castLE (Nat.succ_le_succ hBTouter.1) i = + penIndex := by + apply T.vertex_injective + exact (hBTouter.2.1 i).trans hv + have hval := congrArg Fin.val hi + simp only [Fin.val_castLE] at hval + have hiB : i.val ≤ B.length := Nat.lt_succ_iff.mp i.isLt + have hp := penPosition + omega + have hvAlphaBplus := TreeSequenceInitialSegmentVertexSetSubset hBBplusOuter hvAlpha + have hdis := hElemOuter hvAlphaBplus hPenultimateInBplus hvNe + exact Finset.disjoint_left.mp hdis hAlphaAt (he ▸ hetaMissing) + +theorem helper_hetaFirst_1100.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (B Bplus : TreeSequence G e0), + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ∀ eta ∈ MissingColors G phi (T.vertex penIndex), + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) → + ( + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + ( + ∀ (X : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi X, + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c))) → + ( + ∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) → + T.vertex penIndex ∈ TreeSequenceVertexSet Bplus → + HierarchyFirstMissingPosition phi T eta = penIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D penIndex endIndex B Bplus penPosition + endPosition eta hetaMissing hBLouter hPLouter hBplusTouter hElemOuter vertexMemOuter + firstMissingOuter firstLeOuter hPenultimateInBplus + apply Fin.ext + have htreeMiss : eta ∈ TreeMissingColors phi T := + Finset.mem_biUnion.mpr ⟨T.vertex penIndex, + vertexMemOuter T penIndex, hetaMissing⟩ + have hfirstAt := firstMissingOuter T eta htreeMiss + have hle := firstLeOuter T eta penIndex hetaMissing + by_contra hne + have hlt : (HierarchyFirstMissingPosition phi T eta).val < + penIndex.val := by omega + let i : Fin (Bplus.length + 1) := + ⟨(HierarchyFirstMissingPosition phi T eta).val, by + have hp := penPosition + have hpos := hPLouter + omega⟩ + have hi : Fin.castLE (Nat.succ_le_succ hBplusTouter.1) i = + HierarchyFirstMissingPosition phi T eta := by + apply Fin.ext + rfl + have hvFirst : T.vertex (HierarchyFirstMissingPosition phi T eta) ∈ + TreeSequenceVertexSet Bplus := by + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨i, Finset.mem_univ _, by + rw [← hBplusTouter.2.1 i] + apply congrArg T.vertex + exact hi⟩ + have hverticesNe : T.vertex (HierarchyFirstMissingPosition phi T eta) ≠ + T.vertex penIndex := by + intro he + have hv := congrArg Fin.val (T.vertex_injective he) + omega + have hdis := hElemOuter hvFirst hPenultimateInBplus hverticesNe + exact Finset.disjoint_left.mp hdis hfirstAt hetaMissing + +theorem helper_thetaOldAvoid_1134.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ eta ∈ HierarchyStoredColorsAt H q, + theta ∈ C.good.gamma q eta → + theta ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta H q A eta hetaStored hthetaGamma + have hh := (Finset.mem_sdiff.mp + (C.good.avoidance q eta hetaStored hthetaGamma)).2 + change theta ∉ HierarchySegmentColors H q eta at hh + unfold HierarchySegmentColors at hh + dsimp only at hh + have hend : H.stage q.succ = T := by + convert H.terminalStage using 1 + congr 1 + rw [hend] at hh + exact hh + +theorem helper_horderedUnused_1156.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (B Bplus : TreeSequence G e0), + alpha ∈ TreeMissingColors phi B → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + ∀ (eta : Fin k), + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A T → + ( + ∀ {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors phi X ⊆ TreeMissingColors phi Y) → + ( + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + ( + ∀ (X : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi X, + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c))) → + theta ∈ TreeMissingColors phi A → + HierarchyFirstMissingPosition phi T eta = penIndex → + theta ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k)) → + (↑(HierarchyFirstMissingPosition phi T theta) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ B.length → + theta ∉ TreeMissingColors phi A ∨ alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T theta)) + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + theta ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta penIndex H q A B Bplus + alphaBefore penPosition eta hBLouter hPLouter hBTouter hATouter missingMonoOuter + vertexMemOuter firstMissingOuter hthetaInA hetaFirst thetaOldAvoid hthetaFirstBound + hAlphaFirstBound hnot + rcases hnot with hnotTheta | hnotAlpha + · exact False.elim (hnotTheta hthetaInA) + · have hAlphaAfter : A.length < + (HierarchyFirstMissingPosition phi T alpha).val := by + by_contra h + have hle : (HierarchyFirstMissingPosition phi T alpha).val ≤ A.length := + Nat.le_of_not_gt h + have hAlphaMissingT : alpha ∈ TreeMissingColors phi T := + missingMonoOuter hBTouter alphaBefore + have hmiss := firstMissingOuter T alpha hAlphaMissingT + let i : Fin (A.length + 1) := + ⟨(HierarchyFirstMissingPosition phi T alpha).val, by omega⟩ + have hi : Fin.castLE (Nat.succ_le_succ hATouter.1) i = + HierarchyFirstMissingPosition phi T alpha := Fin.ext rfl + have hvA : A.vertex i ∈ TreeSequenceVertexSet A := vertexMemOuter A i + have hsameVertex : A.vertex i = T.vertex + (HierarchyFirstMissingPosition phi T alpha) := by + rw [← hATouter.2.1 i, hi] + have hv : T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ + TreeSequenceVertexSet A := hsameVertex ▸ hvA + exact hnotAlpha (Finset.mem_biUnion.mpr ⟨_, hv, hmiss⟩) + refine ⟨?_, ?_⟩ + · exact ⟨HierarchyFirstMissingPosition phi T theta, + HierarchyFirstMissingPosition phi T alpha, rfl, rfl, + lt_of_le_of_lt hthetaFirstBound hAlphaAfter⟩ + · intro hc + obtain ⟨_, t, htA, htB, he⟩ := Finset.mem_filter.mp hc + apply thetaOldAvoid + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, htA, ?_, he⟩ + rw [hetaFirst] + have hp := penPosition + have hlen := hBLouter + have hfirstAlpha := hAlphaFirstBound + omega + +theorem helper_thetaAvoidsSplit_1203.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (B Bplus : TreeSequence G e0), + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ∀ (eta : Fin k), + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + HierarchyFirstMissingPosition phi T eta = penIndex → + theta ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k)) → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + phi (T.edge t) ≠ some theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta penIndex endIndex H q A B Bplus + penPosition endPosition eta hBLouter hPLouter hetaFirst thetaOldAvoid t ht htb he + apply thetaOldAvoid + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, ht, ?_, he⟩ + rw [hetaFirst] + have hp := penPosition + have hpos := hPLouter + have hbt := t.isLt + omega + +theorem helper_hthetaAlphaNe_1213.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (_ _ : TreeSequence G e0), + phi (T.edge lastIndex) = some theta → + alpha ∈ MissingColors G phi (T.vertex endIndex) → + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ∀ (_ : Fin k), + theta ≠ alpha := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex B + Bplus lastColor alphaTerminal lastPosition penPosition endPosition eta he + have hInc : Incident G (T.vertex endIndex) (T.edge lastIndex) := by + obtain ⟨i, hi⟩ := T.attaches lastIndex + have hj : lastIndex.succ = endIndex := by + apply Fin.ext + have hl := lastPosition + have ht := endPosition + simp only [Fin.val_succ] + omega + change _ ∈ G.ends (T.edge lastIndex) + rw [hi, hj] + exact Sym2.mem_mk_left _ _ + apply (Finset.mem_sdiff.mp alphaTerminal).2 + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, T.edge lastIndex, hInc, + he ▸ lastColor⟩ + +theorem helper_hThetaTnq_1236.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ (_ _ : TreeSequence G e0) (_ : Fin k), + theta ∈ HierarchyStageMissingColors H q → + (0 : ℕ) < H.dividerCount → + theta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta H q B Bplus eta hstageTheta hz + have hq0 : q ≠ 0 := by + intro he + have hv := congrArg Fin.val he + simp [q] at hv + omega + rcases Fin.eq_zero_or_eq_succ q with hqzero | ⟨i, hqi⟩ + · exact False.elim (hq0 hqzero) + · rw [hqi] at hstageTheta + change theta ∈ TreeMissingColors phi (H.stage i.succ.castSucc) at hstageTheta + have hidx : i.succ.castSucc = + (⟨H.dividerCount, Nat.lt_succ_of_lt (Nat.lt_succ_self _)⟩ : Fin (H.dividerCount + 2)) + := by + apply Fin.ext + have hqval := congrArg Fin.val hqi + simp only [q, Fin.val_last, Fin.val_succ, Fin.val_castSucc] at hqval ⊢ + omega + rw [hidx] at hstageTheta + exact hstageTheta + +theorem helper_hChange_1257.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ( + H.dividerCount = (0 : ℕ) → + theta ∈ TreeMissingColors phi Tn) → + ( + (0 : ℕ) < H.dividerCount → + theta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + (0 : ℕ) < H.dividerCount ∧ + theta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∨ + H.dividerCount = (0 : ℕ) ∧ + (theta ∈ TreeMissingColors phi Tn ∨ + theta ∈ TreeMissingColors phi A ∧ + theta ∉ TashkinovStoredColors ett.series.data n ∧ + alpha ∉ TashkinovStoredColors ett.series.data n) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta H q A n Tn hThetaTn hThetaTnq + by_cases hz : H.dividerCount = 0 + · right + exact ⟨hz, Or.inl (hThetaTn hz)⟩ + · left + exact ⟨Nat.pos_of_ne_zero hz, hThetaTnq (Nat.pos_of_ne_zero hz)⟩ + +theorem helper_leafComponent_1287.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ G k rho a b hne hp v hm + let _ := Fintype.ofFinite V + as_aux_lemma => + have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G rho a b) + (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with ha | hb + · exact MissingColorIncidenceEndpoint G rho a b hne hp v ha + · have he : TwoColorIncidenceGraph G rho a b = TwoColorIncidenceGraph G rho b a := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + rw [he] + exact MissingColorIncidenceEndpoint G rho b a hne.symm hp v hb + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx y hy + exact Finset.card_le_one_iff.mp hd + (by simpa [SimpleGraph.mem_neighborFinset] using hx) + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + +theorem helper_separateVertices_1307.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ), + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton) → + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + classical + intro V E _ _ G k selfComponent leafComponent rho a b hne hp u v w huv huw hvw hu hv hw hsame + let _ := Fintype.ofFinite V + as_aux_lemma => + rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd + · exfalso + obtain ⟨s, t, p, hpPath, hsupport⟩ := + TwoColorComponentSpanningPath G rho a b hp (Sum.inl w) + have endpoint (x : V) (hx : Sum.inl x ∈ TwoColorComponent G rho a b (Sum.inl w)) + (hm : a ∈ MissingColors G rho x ∨ b ∈ MissingColors G rho x) : + Sum.inl x = s ∨ Sum.inl x = t := by + by_contra hn + push Not at hn + have hs : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {z | z ∈ p.support} + rw [hsupport] + exact hx + exact hpPath.isTrail.not_mem_support_of_subsingleton_neighborSet + hn.1 hn.2 (leafComponent rho a b hne hp x hm) hs + have hue := endpoint u (he ▸ selfComponent rho a b u) (Or.inl hu) + have hve := endpoint v (by rw [he, hsame]; exact selfComponent rho a b v) (Or.inr hv) + have hwe := endpoint w (selfComponent rho a b w) hw + rcases hue with hue | hue <;> rcases hve with hve | hve <;> + rcases hwe with hwe | hwe + all_goals first + | exact huv (Sum.inl.inj (hue.trans hve.symm)) + | exact huw (Sum.inl.inj (hue.trans hwe.symm)) + | exact hvw (Sum.inl.inj (hve.trans hwe.symm)) + · exact hd + +theorem helper_separateMaybeCoincident_1344.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ), + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + classical + intro V E _ _ G k selfComponent separateVertices rho a b hne hp u v w huw hvw hu hv hw hsame + let _ := Fintype.ofFinite V + as_aux_lemma => + by_cases huv : u = v + · subst v + rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd + · have noColor (c : Fin k) (hc : c ∈ MissingColors G rho u) + (f : E) (hf : Incident G u f) : rho f ≠ some c := by + intro hcol + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hf, hcol⟩) + have hn : (TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl u) = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro x hx + cases x with + | inl x => exact hx + | inr f => + rcases hx with ⟨hi, hc⟩ + exact hc.elim (noColor a hu f hi) (noColor b hv f hi) + have hwIn : Sum.inl w ∈ TwoColorComponent G rho a b (Sum.inl u) := + he ▸ selfComponent rho a b w + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = + (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl u) at hwIn + exact False.elim (SimpleGraph.not_reachable_of_neighborSet_left_eq_empty + (fun h => huw (Sum.inl.inj h)) hn + (SimpleGraph.ConnectedComponent.exact hwIn).symm) + · exact hd + · exact separateVertices rho a b hne hp u v w huv huw hvw hu hv hw hsame + +theorem helper_hthetaTerminalNe_1391.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + (↑endIndex : ℕ) = T.length → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + (↑(HierarchyFirstMissingPosition phi T theta) : ℕ) ≤ A.length → + T.vertex (HierarchyFirstMissingPosition phi T theta) ≠ T.vertex endIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta endIndex H q A ell endPosition + hTailAtLeast hellOuter hthetaFirstBound he + have hv := congrArg Fin.val (T.vertex_injective he) + have ht := endPosition + have hlen := hellOuter + have htail := hTailAtLeast + have hbound := hthetaFirstBound + clear * - hv ht hlen htail hbound + omega + +theorem helper_hAlphaTerminalNe_1401.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (B : TreeSequence G e0), + (↑endIndex : ℕ) = T.length → + B.length + (2 : ℕ) = T.length → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ B.length → + T.vertex (HierarchyFirstMissingPosition phi T alpha) ≠ T.vertex endIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha endIndex B endPosition hBLouter + hAlphaFirstBound he + have hv := congrArg Fin.val (T.vertex_injective he) + have ht := endPosition + have hlen := hBLouter + have hbound := hAlphaFirstBound + clear * - hv ht hlen hbound + omega + +theorem helper_prefixMissing_1434.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (Bplus : TreeSequence G e0) (z : V ⊕ E) + (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet Bplus) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet Bplus → + v ∈ TreeSequenceVertexSet Bplus → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet Bplus, + MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by + classical + intro V E _ _ G k e0 Bplus z rho a b hne hp helem u v huB hvB hu hv hdu hdv + let _ := Fintype.ofFinite V + as_aux_lemma => + have behavior := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + intro w hwB + by_cases hw : Sum.inl w ∈ TwoColorComponent G rho a b z + · have hwa : a ∉ MissingColors G rho w := by + intro hm + have hwu : w ≠ u := fun he => hdu (he ▸ hw) + exact Finset.disjoint_left.mp (helem hwB huB hwu) hm hu + have hwb : b ∉ MissingColors G rho w := by + intro hm + have hwv : w ≠ v := fun he => hdv (he ▸ hw) + exact Finset.disjoint_left.mp (helem hwB hvB hwv) hm hv + have presentSwapped (c d : Fin k) + (hd : d ∉ MissingColors G rho w) + (hdab : (d = a ∧ c = b) ∨ (d = b ∧ c = a)) : + c ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by + have hpres : d ∈ PresentColors G rho w := by simpa [MissingColors] using hd + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpres + rcases hpres with ⟨e, hwe, he⟩ + have hadj : (TwoColorIncidenceGraph G rho a b).Adj (Sum.inr e) (Sum.inl w) := by + simp only [TwoColorIncidenceGraph] + exact ⟨hwe, hdab.elim (fun h => Or.inl (he.trans (congrArg some h.1))) + (fun h => Or.inr (he.trans (congrArg some h.1)))⟩ + have heC : Sum.inr e ∈ TwoColorComponent G rho a b z := by + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = _ at hw + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inr e) = _ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hw + have heSwap : TwoColorComponentSwap G rho a b z e = some c := by + rcases hdab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · simp [TwoColorComponentSwap, heC, he] + · simp [TwoColorComponentSwap, heC, he] + have hpresent : c ∈ PresentColors G (TwoColorComponentSwap G rho a b z) w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, heSwap⟩ + simpa [MissingColors] using hpresent + have hnewa := presentSwapped a b hwb (Or.inr ⟨rfl, rfl⟩) + have hnewb := presentSwapped b a hwa (Or.inl ⟨rfl, rfl⟩) + apply Finset.ext + intro c + by_cases hca : c = a + · subst c + simp only [hnewa, hwa] + · by_cases hcb : c = b + · subst c + simp only [hnewb, hwb] + · exact behavior.2.2.2 w c hca hcb + · exact behavior.1 w hw + +theorem helper_hThetaFirstBplus_1491.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (Bplus : TreeSequence G e0), + TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment A Bplus → + (↑(HierarchyFirstMissingPosition phi T theta) : ℕ) ≤ A.length → + T.vertex (HierarchyFirstMissingPosition phi T theta) ∈ TreeSequenceVertexSet Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta H q A Bplus hBplusTouter + hABplusouter hthetaFirstBound + let i : Fin (T.length + 1) := HierarchyFirstMissingPosition phi T theta + have hi : i.val ≤ Bplus.length := le_trans hthetaFirstBound hABplusouter.1 + let j : Fin (Bplus.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hBplusTouter.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, (hBplusTouter.2.1 j).symm.trans (congrArg T.vertex he)⟩ + +theorem helper_hAlphaFirstBplus_1500.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (B Bplus : TreeSequence G e0), + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ∀ (_ : Fin k), + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ B.length → + T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ TreeSequenceVertexSet Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha penIndex endIndex B Bplus + penPosition endPosition eta hBLouter hPLouter hBplusTouter hAlphaFirstBound + let i : Fin (T.length + 1) := HierarchyFirstMissingPosition phi T alpha + have hi : i.val ≤ Bplus.length := le_trans hAlphaFirstBound + (by omega) + let j : Fin (Bplus.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hBplusTouter.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, (hBplusTouter.2.1 j).symm.trans (congrArg T.vertex he)⟩ + +theorem helper_hvOutsideOne_1516.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + TwoColorComponent G phi theta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T theta))) = + TwoColorComponent G phi theta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T alpha))) → + ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + Disjoint (TwoColorComponent G phi theta alpha (Sum.inl (T.vertex endIndex))) + (TwoColorComponent G phi theta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T theta)))) → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∉ + TwoColorComponent G phi theta alpha z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex hcomponentEq + selfComponent hdisjointComponent z hh + have hhTheta : Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∈ + TwoColorComponent G phi theta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T theta))) := by + rw [hcomponentEq] + exact selfComponent phi theta alpha + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + exact Set.disjoint_left.mp hdisjointComponent hh hhTheta + +theorem helper_hfixedCoreOne_1548.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ _ : TreeSequence G e0), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + HierarchyWeaklyStable H q muOne ∧ + ModColoring ett muOne ∧ + (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA A muOne), MaximumProperty ettA) ∧ + ( + (0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA A muOne) (baseA : + HierarchyBase ettA muOne) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), + MaximumProperty ettA ∧ + ettA.series.data.kind (Fin.last ettA.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), + K.stage j = + H.stage + (⟨(↑j : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∧ + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := + (⟨(↑j : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (1 : ℕ))); + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G muOne Tnq + (Dnq.biUnion + (C.good.gamma + (⟨C.hierarchy.dividerCount - (1 : ℕ), + by + have := TreeSequence.positive T + omega⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ))))))) → + ∀ (t : Fin A.length), + muOne (A.edge t) = phi (A.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex H q A B Bplus n Tn + eta z muOne hstableOne + by_cases hz : H.dividerCount = 0 + · have hq : q = 0 := Fin.ext (by simp [q, hz]) + have hw := hstableOne.1 + have hi : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = 0 := Fin.ext hz + rw [hi] at hw + change (if ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi muOne + else StableColoring Tn + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi muOne) at hw + have hcore := P2813_T1_BaseDisplayedEdges G k e0 input T phi ett base muOne + ctx.oneEdgeUncolored hstableOne.2.1.2.1 hw + have hAzero : A = base.core := by + change HierarchyStarredStage H q = base.core + rw [hq] + rfl + rw [hAzero] + exact hcore + · have hq : q = (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp only [q, Fin.val_last, Fin.val_succ] + omega + have hw := hstableOne.1 + have hi : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := hq + rw [hi] at hw + intro t + have hAstage : A = H.stage + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ.castSucc := by + change HierarchyStarredStage H _ = _ + rw [hq] + rfl + by_cases ht : 1 ≤ t.val + · have hinv := (hAstage ▸ hw.2.1) t ht + exact hinv + · have ht0 : t.val = 0 := by omega + have he : A.edge t = e0 := by + rw [show t = ⟨0, A.positive⟩ from Fin.ext ht0] + exact A.first_edge + rw [he, hstableOne.2.1.2.1.1, ctx.oneEdgeUncolored.1] + +theorem helper_hlastIncident_1596.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (_ _ : TreeSequence G e0), + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ∀ (_ : Fin k), + Incident G (T.vertex endIndex) (T.edge lastIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D lastIndex penIndex endIndex B Bplus + lastPosition penPosition endPosition eta + obtain ⟨i, hi⟩ := T.attaches lastIndex + have hj : lastIndex.succ = endIndex := by + apply Fin.ext + have hl := lastPosition + have ht := endPosition + simp only [Fin.val_succ] + omega + change _ ∈ G.ends (T.edge lastIndex) + rw [hi, hj] + exact Sym2.mem_mk_left _ _ + +theorem helper_hlastEdgeInOne_1608.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + phi (T.edge lastIndex) = some theta → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + Incident G (T.vertex endIndex) (T.edge lastIndex) → + Sum.inr (T.edge lastIndex) ∈ TwoColorComponent G phi theta alpha z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex endIndex lastColor + z hlastIncident + have hadj : (TwoColorIncidenceGraph G phi theta alpha).Adj + (Sum.inr (T.edge lastIndex)) z := by + exact ⟨hlastIncident, Or.inl lastColor⟩ + change (TwoColorIncidenceGraph G phi theta alpha).connectedComponentMk + (Sum.inr (T.edge lastIndex)) = _ + exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + +theorem helper_segTrans_1626.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z := by + classical + intro V E G e0 X Y Z hXY hYZ + refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +theorem helper_stageSegment_1634.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (_ _ : TreeSequence G e0) (_ : Fin k), + ( + ∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z) → + ∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H B Bplus eta segTrans a d hb + as_aux_lemma => + clear * - H a d hb segTrans + induction d with + | zero => exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + +theorem helper_lastPositive_1645.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ _ : TreeSequence G e0) (_ : Fin k), + H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B Bplus eta hz + have hq : q = (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp only [q, Fin.val_last, Fin.val_succ] + omega + change HierarchyStarredStage H q = H.stage ⟨H.dividerCount, Nat.lt_succ_of_lt + (Nat.lt_succ_self _)⟩ + rw [hq] + change H.stage + ((⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ.castSucc) = _ + apply congrArg H.stage + apply Fin.ext + simp only [Fin.val_castSucc, Fin.val_succ] + omega + +theorem helper_coreToA_1660.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ _ : TreeSequence G e0) (_ : Fin k), + ( + ∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z) → + ( + ∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + ( + H.dividerCount = (0 : ℕ) → + A = base.core) → + ( + H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment base.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B Bplus eta segTrans stageSegment + lastZero lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + +theorem helper_hTnBplus_1668.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx) + (_ Bplus : TreeSequence G e0), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : Fin k), + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment Tn Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B Bplus n Tn eta hPLouter hBplusTouter + have hsourceT : TreeSequenceInitialSegment Tn T := ett.abovePenultimate + have hlen : Tn.length ≤ Bplus.length := by + have hs : Tn.length < T.length := by + have hi : n.castSucc = (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext rfl + simpa [Tn, n, hi] using ett.strictAbovePenultimate + have hp := hPLouter + clear * - hs hp + omega + exact ⟨hlen, + fun i => (hBplusTouter.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans + (hsourceT.2.1 i), + fun i => (hBplusTouter.2.2 (Fin.castLE hlen i)).symm.trans (hsourceT.2.2 i)⟩ + +theorem helper_hfixedBplusAux_1682.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (Bplus : TreeSequence G e0), + TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment A Bplus → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ( + ∀ (t : Fin A.length), + muOne (A.edge t) = phi (A.edge t)) → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + muOne (T.edge t) = phi (T.edge t)) → + ∀ (aLen : ℕ), + aLen = A.length → + ( + ∀ (t : Fin Bplus.length), + (↑t : ℕ) < aLen ∨ aLen ≤ (↑t : ℕ)) → + ∀ (t : Fin Bplus.length), + muOne (Bplus.edge t) = phi (Bplus.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex H q A Bplus + hBplusTouter hABplusouter z muOne hfixedCoreOne hfixedSplit aLen haLen hcut + as_aux_lemma => + intro t + have left (ha : t.val < aLen) : + muOne (Bplus.edge t) = phi (Bplus.edge t) := by + let ta0 : Fin aLen := ⟨t.val, ha⟩ + let ta : Fin A.length := Fin.cast haLen ta0 + have he : Fin.castLE hABplusouter.1 ta = t := Fin.ext (by simp [ta, ta0]) + have heEdge : Bplus.edge t = A.edge ta := by + calc + Bplus.edge t = Bplus.edge (Fin.castLE hABplusouter.1 ta) := by rw [he] + _ = A.edge ta := hABplusouter.2.2 ta + rw [heEdge] + exact hfixedCoreOne ta + have right (ha : aLen ≤ t.val) : + muOne (Bplus.edge t) = phi (Bplus.edge t) := by + let tt : Fin T.length := Fin.castLE hBplusTouter.1 t + have he : Bplus.edge t = T.edge tt := (hBplusTouter.2.2 t).symm + rw [he] + apply hfixedSplit tt + · have hh : A.length ≤ t.val := by rw [← haLen]; exact ha + exact hh + · have hval : tt.val = t.val := by simp [tt] + rw [hval] + exact t.isLt + exact (hcut t).elim left right + +theorem helper_hBplusLength_1712.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (T B Bplus : TreeSequence G e0), + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + Bplus.length = B.length + (1 : ℕ) := by + classical + intro V E G e0 T B Bplus hBLouter hPLouter + have hp := hPLouter + have hb := hBLouter + apply Nat.succ.inj + change Bplus.length + 1 = (B.length + 1) + 1 + calc + Bplus.length + 1 = T.length := hp + _ = B.length + 2 := hb.symm + _ = (B.length + 1) + 1 := by rfl + +theorem helper_transportOne_1721.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (B Bplus : TreeSequence G e0), + TreeSequenceInitialSegment B Bplus → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + (∀ v ∈ TreeSequenceVertexSet Bplus, MissingColors G muOne v = MissingColors G phi v) → + ( + ∀ (t : Fin Bplus.length), + muOne (Bplus.edge t) = phi (Bplus.edge t)) → + Bplus.length = B.length + (1 : ℕ) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S Bplus → + TashkinovAugmentationSequence muOne S Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex B Bplus hBBplusOuter + z muOne hmissingOne hfixedBplus hBplusLength S hseq + refine TashkinovAugmentationSequenceColoringTransport phi muOne S B Bplus hseq + hBBplusOuter hBplusLength ?_ ?_ + · intro t _ + exact hfixedBplus t + · intro v hv + exact hmissingOne v (TreeSequenceInitialSegmentVertexSetSubset hBBplusOuter hv) + +theorem helper_hrouteOne_1730.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + ∀ (Bplus : TreeSequence G e0), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ( + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TreeIncidentEdge Tn f ∧ + (∃ c ∈ TreeMissingColors phi Tn ∪ Dn, phi f = some c) ∧ + TashkinovAugmentationSequence phi seed T) → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment A Bplus → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ( + ∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn Bplus → + ( + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S Bplus → + TashkinovAugmentationSequence muOne S Bplus) → + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence muOne Tn Bplus ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence muOne seed Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex H q A ell Bplus n Tn + oldRoute hTailAtLeast hellOuter hPLouter hBplusTouter hABplusouter z muOne segTrans coreToA + hTnBplus transportOne + rcases oldRoute with ⟨hp, hseq⟩ | + ⟨hnp', f, seed, hconnecting, hadjoin, _, _, hseq⟩ + · have hsourceB := hTnBplus + exact Or.inl ⟨hp, transportOne Tn + (TashkinovAugmentationSequenceRestrict phi Tn Bplus T hseq hsourceB hBplusTouter)⟩ + · have hseedT : TreeSequenceInitialSegment seed T := + TashkinovAugmentationSequenceInitialSegment phi seed T hseq + have hnp : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE := by + intro hpe + rcases hnp' with hse | hre + · rw [hpe] at hse + cases hse + · rw [hpe] at hre + cases hre + have hTnA : TreeSequenceInitialSegment Tn A := by + have hcoreTn : base.core = Tn := by + simpa [Tn, n] using base.nonparallel hnp + have hTnCore : TreeSequenceInitialSegment Tn base.core := by + rw [hcoreTn] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + exact segTrans hTnCore coreToA + have hseedLen : seed.length ≤ Bplus.length := by + have hadjLen := hadjoin.1 + change seed.length = Tn.length + 1 at hadjLen + have ha := hTnA.1 + have htail := hTailAtLeast + have hp := hPLouter + have hell := hellOuter + have hAlen := hABplusouter.1 + clear * - hadjLen ha htail hp hell hAlen + omega + have hseedB : TreeSequenceInitialSegment seed Bplus := by + refine ⟨hseedLen, ?_, ?_⟩ + · intro i + exact (hBplusTouter.2.1 (Fin.castLE (Nat.succ_le_succ hseedLen) i)).symm.trans + (hseedT.2.1 i) + · intro i + exact (hBplusTouter.2.2 (Fin.castLE hseedLen i)).symm.trans (hseedT.2.2 i) + exact Or.inr ⟨hnp', f, seed, hconnecting, hadjoin, + transportOne seed + (TashkinovAugmentationSequenceRestrict phi seed Bplus T hseq hseedB hBplusTouter)⟩ + +theorem helper_firstWitness_1779.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T Bplus : TreeSequence G e0), + TreeSequenceInitialSegment Bplus T → + ∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ TreeMissingColors rho Bplus, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ Bplus.length := by + classical + intro V E _ _ G k e0 T Bplus hBplusTouter rho c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, rfl⟩ := hv + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex j) + have hi : Fin.castLE (Nat.succ_le_succ hBplusTouter.1) i ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [hBplusTouter.2.1 i] + exact hvc + have hn : candidates.Nonempty := ⟨_, hi⟩ + have hm := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hle := Finset.min'_le candidates _ hi + unfold HierarchyFirstMissingPosition + change (c ∈ MissingColors G rho (T.vertex (if h : candidates.Nonempty then + candidates.min' h else Fin.last T.length))) ∧ _ + rw [dite_eq_left hn] + refine ⟨hm, ?_⟩ + change (candidates.min' hn).val ≤ i.val at hle + have hib := i.isLt + omega + +theorem helper_firstPreserved_1805.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T Bplus : TreeSequence G e0), + TreeSequenceInitialSegment Bplus T → + ( + ∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ TreeMissingColors rho Bplus, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ Bplus.length) → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet Bplus) → + (∀ v ∈ TreeSequenceVertexSet Bplus, MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho Bplus → + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ G k e0 T Bplus hBplusTouter firstWitness rho sigma c helem hmiss hc + let _ := Fintype.ofFinite V + as_aux_lemma => + have hr := firstWitness rho c hc + have hc' : c ∈ TreeMissingColors sigma Bplus := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ + have hs := firstWitness sigma c hc' + have pref (i : Fin (T.length + 1)) (hi : i.val ≤ Bplus.length) : + T.vertex i ∈ TreeSequenceVertexSet Bplus := by + let j : Fin (Bplus.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hBplusTouter.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, (hBplusTouter.2.1 j).symm.trans (congrArg T.vertex he)⟩ + by_contra hne + have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ + T.vertex (HierarchyFirstMissingPosition rho T c) := + fun he => hne (T.vertex_injective he) + have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 + exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 + +theorem helper_firstFromMembership_1829.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (rho sigma : PartialEdgeColoring E k) + (c : Fin k), + ( + ∀ (v : V), + c ∈ MissingColors G sigma v ↔ c ∈ MissingColors G rho v) → + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ G k e0 T rho sigma c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + have he : (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G sigma (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex i)) := by + apply Finset.filter_congr + intro i _ + exact hc _ + unfold HierarchyFirstMissingPosition + rw [he] + +theorem helper_hstoredFirst_1843.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (Bplus : TreeSequence G e0), + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) → + theta ∈ TreeMissingColors phi A → + alpha ∈ TreeMissingColors phi Bplus → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + (( + ∀ (v : V), + Sum.inl v ∉ TwoColorComponent G phi theta alpha z → + MissingColors G muOne v = MissingColors G phi v) ∧ + ( + ∀ (v : V), + Sum.inl v ∈ TwoColorComponent G phi theta alpha z → + theta ∈ MissingColors G phi v → + alpha ∈ MissingColors G muOne v) ∧ + ( + ∀ (v : V), + Sum.inl v ∈ TwoColorComponent G phi theta alpha z → + alpha ∈ MissingColors G phi v → + theta ∈ MissingColors G muOne v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ theta → + c ≠ alpha → + (c ∈ MissingColors G muOne v ↔ c ∈ MissingColors G phi v)) → + (∀ v ∈ TreeSequenceVertexSet Bplus, MissingColors G muOne v = MissingColors G phi v) → + ( + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet Bplus) → + (∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho Bplus → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + ( + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ( + ∀ (v : V), + c ∈ MissingColors G sigma v ↔ c ∈ MissingColors G rho v) → + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c) → + ∀ c ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition muOne T c = HierarchyFirstMissingPosition phi T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex H q A Bplus + hElemOuter hthetaInA hAlphaMissingBplus z muOne behaviorOne hmissingPointwise + firstPreserved firstFromMembership c hc + have hct : c ≠ theta := by + intro he + have hs : theta ∈ HierarchyStoredColorsAt H q := he ▸ hc + exact (Finset.mem_sdiff.mp hs).2 hthetaInA + by_cases hca : c = alpha + · exact hca.symm ▸ firstPreserved phi muOne alpha hElemOuter hmissingPointwise + hAlphaMissingBplus + · exact firstFromMembership phi muOne c (fun v => behaviorOne.2.2.2 v c hct hca) + +theorem helper_hAlphaNoGamma_1854.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + alpha ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha H q + rcases D.normalizedAlternative with ⟨_, _, hnot⟩ | ⟨_, _, hnot⟩ | ⟨haStored, _⟩ + · exact hnot + · exact hnot + · intro hm + exact Finset.disjoint_left.mp (GoodHierarchyReservedDisjoint C.good q).2 hm haStored + +theorem helper_hgammaCutoff_1866.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ (B Bplus : TreeSequence G e0), + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ∀ (eta : Fin k), + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + HierarchyFirstMissingPosition phi T eta = penIndex → + alpha ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) → + (∀ c ∈ HierarchyStoredColorsAt H q, + theta ∈ C.good.gamma q c → + c = eta) → + ∀ c ∈ HierarchyStoredColorsAt H q, + alpha ∈ C.good.gamma q c ∨ theta ∈ C.good.gamma q c → + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Bplus.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta penIndex endIndex H q B Bplus + penPosition endPosition eta hBLouter hPLouter hetaFirst hAlphaNoGamma hthetaOwner c hc hp + rcases hp with ha | ht + · exact False.elim (hAlphaNoGamma (Finset.mem_biUnion.mpr ⟨c, hc, ha⟩)) + · have he := hthetaOwner c hc ht + rw [he, hetaFirst] + have hp := penPosition + have hb := hPLouter + omega + +theorem helper_hsuffixPhi_1881.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + ∀ (Bplus : TreeSequence G e0), + phi (T.edge lastIndex) = some theta → + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + theta ∈ TreeMissingColors phi Bplus → + TashkinovAugmentationSequence phi Bplus T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex Bplus lastColor + lastPosition hPLouter hBplusTouter hthetaMissingBplus + apply Relation.ReflTransGen.single + refine ⟨hPLouter.symm, hBplusTouter, theta, ?_, hthetaMissingBplus⟩ + have hi : Fin.cast hPLouter (Fin.last Bplus.length) = lastIndex := + Fin.ext (by + have hl := lastPosition + simp only [Fin.val_cast, Fin.val_last] + clear * - hl hPLouter + omega) + rw [hi] + exact lastColor + +theorem helper_prefixOne_1931.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + ∀ (Bplus : TreeSequence G e0), + Bplus = HierarchyFullTailPrefix C (ell - (1 : ℕ)) → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T) + (baseOne : HierarchyBase corrOne.replacementETT muOne) + (COne : HierarchyCounterexample baseOne), + let HOne : TashkinovHierarchy corrOne.replacementETT baseOne := COne.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + HierarchyStarredStage HOne qOne = A → + HierarchyFullTailPrefix COne (HierarchyFullTailLength COne - (1 : ℕ)) = Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex H q A ell Bplus + hBplusDef z muOne corrOne baseOne COne HOne qOne starOne + unfold HierarchyFullTailPrefix HierarchyFullTailLength + change TreeSequencePrefix T + (min ((HierarchyStarredStage HOne qOne).length + + (T.length - (HierarchyStarredStage HOne qOne).length - 1)) T.length) _ _ = Bplus + simp only [starOne] + exact hBplusDef.symm + +theorem helper_thetaUnusedOne_1963.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (Bplus : TreeSequence G e0), + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + phi (T.edge t) ≠ some theta) → + theta ≠ alpha → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + muOne (T.edge t) = phi (T.edge t)) → + muOne (T.edge lastIndex) = some alpha → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + muOne (T.edge t) ≠ some theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex endIndex H q A + Bplus lastPosition hPLouter thetaAvoidsSplit hthetaAlphaNe z muOne hfixedSplit hlastOne t ht + by_cases hb : t.val < Bplus.length + · rw [hfixedSplit t ht hb] + exact thetaAvoidsSplit t ht hb + · have he : t = lastIndex := by + apply Fin.ext + have hl := lastPosition + have hp := hPLouter + have htlt := t.isLt + clear * - hl hp htlt hb + omega + rw [he, hlastOne] + exact fun h => hthetaAlphaNe (Option.some.inj h).symm + +theorem helper_tnOne_1991.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T) + (baseOne : HierarchyBase corrOne.replacementETT muOne) + (COne : HierarchyCounterexample baseOne), + SameGoodHierarchy C.good COne.good → + let HOne : TashkinovHierarchy corrOne.replacementETT baseOne := COne.hierarchy; + H.dividerCount = HOne.dividerCount → + corrOne.replacementETT.series.data.tree + (Fin.last corrOne.replacementETT.rounds).castSucc = + Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex H n Tn z muOne + corrOne baseOne COne sameOne HOne countOne + have hs : H.stage 0 = HOne.stage 0 := by + have hs := + (Fin.heq_fun_iff (congrArg (fun d => d + 2) countOne)).mp sameOne.1.2.2.1 0 + exact hs.trans (congrArg HOne.stage (Fin.ext (by simp))) + exact HOne.baseStage.symm.trans (hs.symm.trans H.baseStage) + +theorem helper_positiveStarOne_2005.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ _ : TreeSequence G e0) (_ : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T) + (baseOne : HierarchyBase corrOne.replacementETT muOne) + (COne : HierarchyCounterexample baseOne), + let HOne : TashkinovHierarchy corrOne.replacementETT baseOne := COne.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + HierarchyStarredStage HOne qOne = A → + H.dividerCount = HOne.dividerCount → + HOne.dividerCount ≠ (0 : ℕ) → + HOne.stage + (⟨HOne.dividerCount, + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corrOne + have := TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ))) = + A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex H q A B Bplus eta z + muOne corrOne baseOne COne HOne qOne starOne countOne hz + have hi : qOne = (⟨HOne.dividerCount - 1, by omega⟩ : Fin HOne.dividerCount).succ := + Fin.ext (by simp only [qOne, Fin.val_last, Fin.val_succ]; omega) + have hs := starOne + rw [hi] at hs + change HOne.stage _ = A at hs + convert hs using 1 + apply congrArg HOne.stage + apply Fin.ext + simp only [Fin.val_succ, Fin.val_castSucc] + omega + +theorem helper_caseTwo_2017.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (Bplus : TreeSequence G e0) (eta : Fin k), + TreeSequenceInitialSegment A Bplus → + theta ∈ TreeMissingColors phi A → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T) + (baseOne : HierarchyBase corrOne.replacementETT muOne) + (COne : HierarchyCounterexample baseOne), + let HOne : TashkinovHierarchy corrOne.replacementETT baseOne := COne.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + ( + ∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X Bplus → + TreeMissingColors muOne X = TreeMissingColors phi X) → + ( + HOne.dividerCount = (0 : ℕ) → + theta ∈ + TreeMissingColors muOne + (corrOne.replacementETT.series.data.tree + (Fin.last corrOne.replacementETT.rounds).castSucc)) → + ( + HOne.dividerCount ≠ (0 : ℕ) → + HOne.stage + (⟨HOne.dividerCount, + by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corrOne + have := TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ))) = + A) → + (0 : ℕ) < HOne.dividerCount ∧ + theta ∈ + TreeMissingColors muOne + (HOne.stage + (⟨HOne.dividerCount, + by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corrOne + have := TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + (theta ∈ + TreeMissingColors muOne + (corrOne.replacementETT.series.data.tree + (Fin.last corrOne.replacementETT.rounds).castSucc) ∨ + theta ∈ TreeMissingColors muOne (HierarchyStarredStage HOne qOne) ∧ + theta ∉ + TashkinovStoredColors corrOne.replacementETT.series.data + (Fin.last corrOne.replacementETT.rounds) ∧ + eta ∉ + TashkinovStoredColors corrOne.replacementETT.series.data + (Fin.last corrOne.replacementETT.rounds)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex H q A Bplus eta + hABplusouter hthetaInA z muOne corrOne baseOne COne HOne qOne missingPrefixOne thetaTnOne + positiveStarOne + by_cases hz : HOne.dividerCount = 0 + · exact Or.inr ⟨hz, Or.inl (thetaTnOne hz)⟩ + · exact Or.inl ⟨Nat.pos_of_ne_zero hz, by + rw [positiveStarOne hz, missingPrefixOne A hABplusouter] + exact hthetaInA⟩ + +theorem helper_orderedTwo_2037.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + ∀ (eta : Fin k), + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + (↑(HierarchyFirstMissingPosition phi T theta) : ℕ) ≤ A.length → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T) + (baseOne : HierarchyBase corrOne.replacementETT muOne) + (COne : HierarchyCounterexample baseOne), + let HOne : TashkinovHierarchy corrOne.replacementETT baseOne := COne.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + HierarchyStarredStage HOne qOne = A → + HierarchyFirstMissingPosition muOne T theta = + HierarchyFirstMissingPosition phi T theta → + HierarchyFirstMissingPosition muOne T eta = penIndex → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + muOne (T.edge t) ≠ some theta) → + theta ∉ TreeMissingColors muOne (HierarchyStarredStage HOne qOne) ∨ + eta ∉ TreeMissingColors muOne (HierarchyStarredStage HOne qOne) → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition muOne T theta)) + (T.vertex (HierarchyFirstMissingPosition muOne T eta)) ∧ + theta ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage HOne qOne).length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition muOne T eta) : ℕ) ∧ + muOne (T.edge t) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta penIndex endIndex H q A ell + penPosition eta hTailAtLeast hellOuter hthetaFirstBound z muOne corrOne baseOne COne HOne + qOne starOne firstThetaOne firstEtaOne thetaUnusedOne _ + rw [firstThetaOne, firstEtaOne, starOne] + refine ⟨⟨_, _, rfl, rfl, ?_⟩, ?_⟩ + · have hb := hthetaFirstBound + have hp := penPosition + have hl := hTailAtLeast + have hell := hellOuter + clear * - hb hp hl hell + omega + · intro hc + obtain ⟨t, ht, _, he⟩ := (Finset.mem_filter.mp hc).2 + exact thetaUnusedOne t ht he + +theorem helper_componentEqTwo_2072.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (Bplus : TreeSequence G e0) (eta : Fin k), + TreeSequenceInitialSegment A Bplus → + theta ∈ TreeMissingColors phi A → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T) + (baseOne : HierarchyBase corrOne.replacementETT muOne) + (COne : HierarchyCounterexample baseOne), + let HOne : TashkinovHierarchy corrOne.replacementETT baseOne := COne.hierarchy; + ( + ∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X Bplus → + TreeMissingColors muOne X = TreeMissingColors phi X) → + HierarchyFirstMissingPosition muOne T theta = + HierarchyFirstMissingPosition phi T theta → + HierarchyFirstMissingPosition muOne T eta = penIndex → + ( + HOne.dividerCount = (0 : ℕ) → + theta ∈ + TreeMissingColors muOne + (corrOne.replacementETT.series.data.tree + (Fin.last corrOne.replacementETT.rounds).castSucc)) → + ( + HOne.dividerCount ≠ (0 : ℕ) → + HOne.stage + (⟨HOne.dividerCount, + by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corrOne + have := TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ))) = + A) → + ( + let H : TashkinovHierarchy corrOne.replacementETT baseOne := COne.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (corrOne.replacementETT.rounds + (1 : ℕ)) := + Fin.last corrOne.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corrOne + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := corrOne.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := + TashkinovStoredColors corrOne.replacementETT.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition muOne T theta); + have vb : V := T.vertex (HierarchyFirstMissingPosition muOne T eta); + have sameComponent : Prop := + TwoColorComponent G muOne theta eta (Sum.inl va) = + TwoColorComponent G muOne theta eta (Sum.inl vb); + ( + (0 : ℕ) < H.dividerCount ∧ + (theta ∈ TreeMissingColors muOne Tnq ∨ + Disjoint (insert theta ({ eta } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + ( + H.dividerCount = (0 : ℕ) ∧ + (theta ∈ TreeMissingColors muOne Tn ∨ + Disjoint (insert theta ({ eta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + ( + theta ∈ TreeMissingColors muOne A ∧ + TreeColorSetClosed G muOne A ({ theta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A muOne theta eta)) → + TwoColorComponent G muOne theta eta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T theta))) = + TwoColorComponent G muOne theta eta (Sum.inl (T.vertex penIndex)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta penIndex endIndex H q A Bplus + eta hABplusouter hthetaInA z muOne corrOne baseOne COne HOne missingPrefixOne firstThetaOne + firstEtaOne thetaTnOne positiveStarOne changeTwo + rw [← firstThetaOne, ← firstEtaOne] + by_cases hz : HOne.dividerCount = 0 + · exact changeTwo.2.1 ⟨hz, Or.inl (thetaTnOne hz)⟩ + · exact changeTwo.1 ⟨Nat.pos_of_ne_zero hz, Or.inl (by + rw [positiveStarOne hz, missingPrefixOne A hABplusouter] + exact hthetaInA)⟩ + +theorem helper_thetaPenultimateNe_2082.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + (↑(HierarchyFirstMissingPosition phi T theta) : ℕ) ≤ A.length → + T.vertex (HierarchyFirstMissingPosition phi T theta) ≠ T.vertex penIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta penIndex H q A ell penPosition + hTailAtLeast hellOuter hthetaFirstBound he + have hv := congrArg Fin.val (T.vertex_injective he) + have hb := hthetaFirstBound + have hp := penPosition + have ht := hTailAtLeast + have hell := hellOuter + clear * - hv hb hp ht hell + omega + +theorem helper_penultimateTerminalNe_2092.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + T.vertex penIndex ≠ T.vertex endIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D penIndex endIndex penPosition endPosition he + have hv := congrArg Fin.val (T.vertex_injective he) + have hp := penPosition + have ht := endPosition + clear * - hv hp ht + omega + +theorem helper_hv_2145.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + ∀ (Bplus : TreeSequence G e0), + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + Bplus.vertex (Fin.last Bplus.length) = T.vertex penIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D penIndex Bplus penPosition hPLouter + hBplusTouter + rw [← hBplusTouter.2.1 (Fin.last Bplus.length)] + apply congrArg T.vertex + apply Fin.ext + have hp := penPosition + have hb := hPLouter + simp only [Fin.val_castLE, Fin.val_last] + clear * - hp hb + omega + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperFixedTailTwo2168Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + ∀ (B Bplus : TreeSequence G e0), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + ∀ (eta : Fin k), + ell = T.length - A.length → + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment Bplus T → + TreeSequenceInitialSegment A T → + ( + ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + alpha ≠ eta → + HierarchyFirstMissingPosition phi T eta = penIndex → + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < Bplus.length → + muOne (T.edge t) = phi (T.edge t)) → + muOne (T.edge lastIndex) = some alpha → + ( + H.dividerCount = (0 : ℕ) → + A = base.core) → + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T) + (baseOne : HierarchyBase corrOne.replacementETT muOne) + (COne : HierarchyCounterexample baseOne), + let HOne : TashkinovHierarchy corrOne.replacementETT baseOne := COne.hierarchy; + H.dividerCount = HOne.dividerCount → + HierarchyFirstMissingPosition muOne T eta = penIndex → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + muOne (T.edge t) ≠ some theta) → + corrOne.replacementETT.series.data.tree + (Fin.last corrOne.replacementETT.rounds).castSucc = + Tn → + let muTwo : PartialEdgeColoring E k := + TwoColorComponentSwap G muOne theta eta z; + ( + let H : TashkinovHierarchy corrOne.replacementETT baseOne := + COne.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (corrOne.replacementETT.rounds + (1 : ℕ)) := + Fin.last corrOne.replacementETT.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := CorrespondingExtendedTashkinovTree.rungAgreement corrOne + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := + corrOne.replacementETT.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + HierarchyWeaklyStable H q muTwo ∧ + ModColoring corrOne.replacementETT muTwo ∧ + (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA A muTwo), MaximumProperty ettA) ∧ + ( + (0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA A muTwo) (baseA : + HierarchyBase ettA muTwo) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), + MaximumProperty ettA ∧ + ettA.series.data.kind (Fin.last ettA.rounds) = + corrOne.replacementETT.series.data.kind + (Fin.last corrOne.replacementETT.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), + baseA.core = baseOne.core ∧ + baseA.closure = baseOne.closure ∧ + ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), + K.stage j = + H.stage + (⟨(↑j : ℕ), + by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corrOne + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∧ + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := + (⟨(↑j : ℕ), + by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corrOne + have := TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (1 : ℕ))); + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = COne.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G muTwo Tnq + (Dnq.biUnion + (COne.good.gamma + (⟨COne.hierarchy.dividerCount - (1 : ℕ), + by + have := + CorrespondingExtendedTashkinovTree.rungAgreement corrOne + have := TreeSequence.positive T + omega⟩ : + Fin (COne.hierarchy.dividerCount + (1 : ℕ))))))) → + ( + ∀ (t : Fin Bplus.length), + A.length ≤ (↑t : ℕ) → + (↑t : ℕ) < A.length + (ell - (1 : ℕ)) → + phi (Bplus.edge t) = some eta → + H.dividerCount = (0 : ℕ) ∧ + base.core = Tn ∧ + (↑t : ℕ) = A.length ∧ + ∃ (f : E), + TashkinovSeriesStep G k ett.rounds e0 input ett.series.data n ∧ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + Bplus.edge t = f ∧ + phi f = some eta ∧ + eta ∈ TashkinovStoredColors ett.series.data n) → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + muTwo (T.edge t) = muOne (T.edge t) + +theorem helper_fixedTailTwo_2168.{u_1, u_2} : + helperFixedTailTwo2168Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex H + q A ell B Bplus n Tn lastPosition penPosition endPosition eta hellOuter hBLouter hPLouter + hBplusTouter hATouter vertexMemOuter hAlphaEtaNe hetaFirst z muOne hfixedSplit hlastOne + lastZero corrOne baseOne COne HOne countOne firstEtaOne thetaUnusedOne tnOne muTwo + stableTwo exclusionEta' t ht + have hnt := thetaUnusedOne t ht + by_cases heta : muOne (T.edge t) = some eta + · have hb : t.val < Bplus.length := by + by_contra hnot + have he : t = lastIndex := by + apply Fin.ext + have hl := lastPosition + have hp := hPLouter + have htlt := t.isLt + clear * - hl hp htlt hnot + omega + rw [he, hlastOne] at heta + exact hAlphaEtaNe (Option.some.inj heta) + let tB : Fin Bplus.length := ⟨t.val, hb⟩ + have hcast : Fin.castLE hBplusTouter.1 tB = t := Fin.ext rfl + have heOld : phi (Bplus.edge tB) = some eta := by + rw [← hBplusTouter.2.2 tB, hcast, ← hfixedSplit t ht hb] + exact heta + obtain ⟨hz, hcore, hpos, f, _, _, _, _, _, hs⟩ := + exclusionEta' tB ht (by + have hv := tB.isLt + have hp := hPLouter + have hell := hellOuter + clear * - hv hp hell + change tB.val < Bplus.length at hv + omega) heOld + have hzOne : HOne.dividerCount = 0 := countOne.symm.trans hz + have htn : corrOne.replacementETT.series.data.tree + (Fin.last corrOne.replacementETT.rounds).castSucc = A := + tnOne.trans ((lastZero hz).trans hcore).symm + have hinc : TreeIncidentEdge + (corrOne.replacementETT.series.data.tree (Fin.last + corrOne.replacementETT.rounds).castSucc) + (T.edge t) := by + rw [htn] + obtain ⟨i, hi⟩ := T.attaches t + let j : Fin (A.length + 1) := + ⟨i.val, by + have := i.isLt + change t.val = A.length at hpos + omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hATouter.1) j = + Fin.castLE (by omega : t.val + 1 ≤ T.length + 1) i := Fin.ext rfl + refine ⟨A.vertex j, vertexMemOuter A j, ?_⟩ + rw [← hATouter.2.1 j, he, Incident, hi] + exact Sym2.mem_mk_right _ _ + have hsOne : eta ∈ TashkinovStoredColors corrOne.replacementETT.series.data + (Fin.last corrOne.replacementETT.rounds) := by + rw [P2752_T2_TerminalStoredColors ett corrOne] + exact hs + have hw := stableTwo.1 + have hi : (Fin.last HOne.dividerCount : Fin (HOne.dividerCount + 1)) = 0 := + Fin.ext hzOne + rw [hi] at hw + change (if corrOne.replacementETT.series.data.kind (Fin.last corrOne.replacementETT.rounds) = + some TashkinovExtensionKind.PE then _ else _) at hw + have stableSeed : StableColoring + (corrOne.replacementETT.series.data.tree (Fin.last + corrOne.replacementETT.rounds).castSucc) + (TashkinovStoredColors corrOne.replacementETT.series.data (Fin.last + corrOne.replacementETT.rounds)) + muOne muTwo := by + split_ifs at hw with hp + · exact hw.1 + · exact hw + exact stableSeed.1 _ hinc ⟨eta, Finset.mem_union_right _ hsOne, heta⟩ + · simp only [muTwo, TwoColorComponentSwap, hnt, heta, ite_false, ite_self] + +theorem helper_storedFirstTwo_2236.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (Bplus : TreeSequence G e0) (eta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex endIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi theta alpha z; + ( + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet Bplus) → + (∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho Bplus → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + ( + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ( + ∀ (v : V), + c ∈ MissingColors G sigma v ↔ c ∈ MissingColors G rho v) → + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c) → + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T) + (baseOne : HierarchyBase corrOne.replacementETT muOne) + (COne : HierarchyCounterexample baseOne), + let HOne : TashkinovHierarchy corrOne.replacementETT baseOne := COne.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + ColoredVertexSetElementary G muOne (TreeSequenceVertexSet Bplus) → + theta ∉ HierarchyStoredColorsAt HOne qOne → + eta ∈ TreeMissingColors muOne Bplus → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G muOne theta eta z; + (∀ v ∈ TreeSequenceVertexSet Bplus, MissingColors G muTwo v = MissingColors G muOne v) → + ( + have C : Set (V ⊕ E) := TwoColorComponent G muOne theta eta z; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G muOne theta eta z; + ( + ∀ (v : V), + Sum.inl v ∉ C → + MissingColors G phi' v = MissingColors G muOne v) ∧ + ( + ∀ (v : V), + Sum.inl v ∈ C → + theta ∈ MissingColors G muOne v → + eta ∈ MissingColors G phi' v) ∧ + ( + ∀ (v : V), + Sum.inl v ∈ C → + eta ∈ MissingColors G muOne v → + theta ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ theta → + c ≠ eta → + (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G muOne v)) → + ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition muOne T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta endIndex Bplus eta z muOne + firstPreserved firstFromMembership corrOne baseOne COne HOne qOne elemOne thetaStoredOne + etaMissingPrefixOne muTwo missingTwo behaviorTwo c hc + have hct : c ≠ theta := fun he => thetaStoredOne (he ▸ hc) + by_cases hce : c = eta + · exact hce.symm ▸ firstPreserved muOne muTwo eta elemOne missingTwo etaMissingPrefixOne + · exact firstFromMembership muOne muTwo c (fun v => behaviorTwo.2.2.2 v c hct hce) + +theorem helper_lastTailBound_2256.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let lastIndex : Fin T.length := D.lastEdgeIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + A.length ≤ (↑lastIndex : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D lastIndex H q A ell lastPosition + hTailAtLeast hellOuter + have ht := hTailAtLeast + have hell := hellOuter + have hl := lastPosition + clear * - ht hell hl + omega + +theorem helper_alphaPresentPenultimate_2279.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + ∀ (B Bplus : TreeSequence G e0), + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + B.length + (2 : ℕ) = T.length → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) → + T.vertex penIndex ∈ TreeSequenceVertexSet Bplus → + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ B.length → + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) → + T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ TreeSequenceVertexSet Bplus → + alpha ∉ MissingColors G phi (T.vertex penIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha penIndex B Bplus penPosition + hBLouter hElemOuter hPenultimateInBplus hAlphaFirstBound hAlphaAtFirst hAlphaFirstBplus hm + have hne : T.vertex (HierarchyFirstMissingPosition phi T alpha) ≠ + T.vertex penIndex := by + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + have hb := hAlphaFirstBound + have hp := penPosition + have hl := hBLouter + clear * - hi hb hp hl + omega + exact Finset.disjoint_left.mp (hElemOuter hAlphaFirstBplus hPenultimateInBplus hne) + hAlphaAtFirst hm + +theorem helper_etaStoredTwo_2301.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ eta ∈ HierarchyStoredColorsAt H q, + ∀ (PTwo : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + eta ∈ + HierarchyStoredColorsAt PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q eta hetaStored PTwo + obtain ⟨hc, hd⟩ := PTwo.sameGood.2 + have hi : Fin.cast (congrArg (fun d => d + 1) hc) q = + Fin.last PTwo.counterexample.hierarchy.dividerCount := Fin.ext hc + have hs := (hd q).1 + rw [hi] at hs + exact hs ▸ hetaStored + +theorem helper_continuation_4221.{u_1, u_2} : + helperContinuation4221Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex H + q A ell B Bplus n Tn lastPosition penPosition endPosition eta hetaStored hetaMissing + hTailAtLeast hellOuter hBLouter hPLouter hBplusTouter hBBplusOuter hATouter hABplusouter + hElemOuter vAlpha vertexMemOuter hPenultimateInBplus hBplusDef canonicalElem hAlphaEtaNe + hAlphaMissingBplus hthetaMissingBplus hetaFirst hAlphaFirstBound hvAlphaBplus + thetaAvoidsSplit selfComponent leafComponent separateVertices hAlphaAtFirst + hthetaTerminalNe z muOne prefixMissing hThetaFirstBplus hAlphaFirstBplus hmissingOne + hmissingPointwise htreeMissingEq hfixedSplit hlastOne hthetaTerminalOne hetaPenultimateOne + lastZero hTnBplus hfixedBplusAux hfixedBplus hBplusLength transportOne hrouteOne + firstWitness firstPreserved firstFromMembership hgammaCutoff hmissingPairOne hsuffixPhi + corrOne maxOne baseOne COne sameOne ctxOne POne HOne qOne starOne countOne prefixOne + elemOne missingPrefixOne firstThetaOne firstEtaOne thetaFirstOne thetaEtaNe thetaUnusedOne + thetaStoredOne tnOne caseTwo etaMissingPrefixOne thetaMissingPrefixOne componentEqTwo + thetaPenultimateNe + have penultimateTerminalNe : T.vertex penIndex ≠ + T.vertex endIndex := by + exact helper_penultimateTerminalNe_2092 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) (@ctx) (@D) + (@penPosition) (@endPosition) + have disjointTwo := separateVertices muOne theta eta thetaEtaNe ctxOne.proper + (T.vertex (HierarchyFirstMissingPosition phi T theta)) + (T.vertex penIndex) (T.vertex endIndex) + thetaPenultimateNe hthetaTerminalNe penultimateTerminalNe + thetaFirstOne hetaPenultimateOne (Or.inl hthetaTerminalOne) componentEqTwo + let muTwo := TwoColorComponentSwap G muOne theta eta z + have pathTwo : TwoColorPathComponent G muOne theta eta z := + ⟨thetaEtaNe, _, selfComponent muOne theta eta _, + leafComponent muOne theta eta thetaEtaNe ctxOne.proper _ (Or.inl hthetaTerminalOne)⟩ + have thetaOutsideTwo : Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T theta)) ∉ + TwoColorComponent G muOne theta eta z := by + intro hm + exact Set.disjoint_left.mp disjointTwo hm (selfComponent muOne theta eta _) + have etaOutsideTwo : Sum.inl (T.vertex penIndex) ∉ + TwoColorComponent G muOne theta eta z := by + intro hm + apply Set.disjoint_left.mp disjointTwo hm + rw [componentEqTwo] + exact selfComponent muOne theta eta _ + have missingTwo : ∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G muTwo v = MissingColors G muOne v := + prefixMissing z muOne theta eta thetaEtaNe ctxOne.proper elemOne + _ _ hThetaFirstBplus hPenultimateInBplus thetaFirstOne hetaPenultimateOne + thetaOutsideTwo etaOutsideTwo + have stableTwo := StableChangeCasesOneTwo G k e0 corrOne.replacementInput T muOne + corrOne.replacementETT baseOne COne ctxOne.proper ctxOne.oneEdgeUncolored + ctxOne.lowerRung ctxOne.fewerDividers ctxOne.lexicographicMinimality + (by + change ColoredVertexSetElementary G muOne (TreeSequenceVertexSet + (HierarchyFullTailPrefix COne (HierarchyFullTailLength COne - 1))) + rw [prefixOne]; exact elemOne) ctxOne.largeMissingSet + theta eta thetaEtaNe (by + change theta ∈ TreeMissingColors muOne + (HierarchyFullTailPrefix COne (HierarchyFullTailLength COne - 1)) ∧ + eta ∈ TreeMissingColors muOne + (HierarchyFullTailPrefix COne (HierarchyFullTailLength COne - 1)) + rw [prefixOne]; exact ⟨thetaMissingPrefixOne, etaMissingPrefixOne⟩) + z pathTwo muTwo rfl caseTwo (by + dsimp only + rw [firstThetaOne] + exact disjointTwo) + have exclusionEta := HierarchyTailMissingColorExclusion G k e0 input T phi ett base H + canonicalElem + (ell - 1) (by clear * - hTailAtLeast; omega) + (by change ell - 1 < ell; clear * - hTailAtLeast; omega) eta (by + have hv : Bplus.vertex (Fin.last Bplus.length) = T.vertex penIndex := by + exact helper_hv_2145 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@Bplus) + (@penPosition) (@hPLouter) (@hBplusTouter) + have hm : eta ∈ MissingColors G phi (Bplus.vertex (Fin.last Bplus.length)) := hv.symm ▸ + hetaMissing + subst Bplus + exact hm) + have exclusionEta' : ∀ t : Fin Bplus.length, A.length ≤ t.val → + t.val < A.length + (ell - 1) → phi (Bplus.edge t) = some eta → + H.dividerCount = 0 ∧ base.core = Tn ∧ t.val = A.length ∧ + ∃ f : E, TashkinovSeriesStep G k ett.rounds e0 input ett.series.data n ∧ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges n = {f} ∧ Bplus.edge t = f ∧ + phi f = some eta ∧ eta ∈ TashkinovStoredColors ett.series.data n := by + subst Bplus + exact exclusionEta + have fixedTailTwo : ∀ t : Fin T.length, A.length ≤ t.val → + muTwo (T.edge t) = muOne (T.edge t) := by + exact helper_fixedTailTwo_2168 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@Bplus) (@lastPosition) (@penPosition) (@endPosition) (@eta) (@hellOuter) (@hBLouter) + (@hPLouter) (@hBplusTouter) (@hATouter) (@vertexMemOuter) (@hAlphaEtaNe) (@hetaFirst) + (@hfixedSplit) (@hlastOne) (@lastZero) (@corrOne) (@baseOne) (@COne) (@countOne) + (@firstEtaOne) (@thetaUnusedOne) (@tnOne) (@stableTwo) (@exclusionEta') + have behaviorTwo := TwoColorComponentSwapMissingBehavior G muOne theta eta thetaEtaNe + ctxOne.proper z + have storedFirstTwo : ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition muOne T c := by + exact helper_storedFirstTwo_2236 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@Bplus) (@eta) (@firstPreserved) (@firstFromMembership) (@corrOne) (@baseOne) (@COne) + (@elemOne) (@thetaStoredOne) (@etaMissingPrefixOne) (@missingTwo) (@behaviorTwo) + obtain ⟨corrTwo, maxTwo, baseTwo, KTwo, goodTwo, sameTwo⟩ := + (StableChangeCasesOneTwoFullTail G k e0 corrOne.replacementInput T muOne + corrOne.replacementETT baseOne COne ctxOne theta eta thetaEtaNe + (by rw [prefixOne]; exact ⟨thetaMissingPrefixOne, etaMissingPrefixOne⟩) + z pathTwo muTwo rfl caseTwo + (by dsimp only; rw [firstThetaOne]; exact disjointTwo) + (by dsimp only; rw [starOne]; exact fixedTailTwo) + (by rw [prefixOne]; exact missingTwo) storedFirstTwo).2.2.2.2 + have etaTerminalTwo : eta ∈ MissingColors G muTwo (T.vertex endIndex) := + behaviorTwo.2.1 _ (selfComponent muOne theta eta _) hthetaTerminalOne + have etaPenultimateTwo : eta ∈ MissingColors G muTwo (T.vertex penIndex) := by + rw [missingTwo _ hPenultimateInBplus] + exact hetaPenultimateOne + have lastTailBound : A.length ≤ lastIndex.val := by + exact helper_lastTailBound_2256 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@lastPosition) (@hTailAtLeast) (@hellOuter) + have lastTwo : muTwo (T.edge lastIndex) = some alpha := + (fixedTailTwo lastIndex lastTailBound).trans hlastOne + obtain ⟨CTwo, sameTwo⟩ : ∃ CTwo : HierarchyCounterexample baseTwo, + SameGoodHierarchy COne.good CTwo.good := by + refine ⟨{ + positive := by rw [corrTwo.rungAgreement]; exact COne.positive + hierarchy := KTwo + good := goodTwo + maximum := maxTwo + notElementary := ?_ }, sameTwo⟩ + intro he + exact Finset.disjoint_left.mp + (he (vertexMemOuter T penIndex) + (vertexMemOuter T endIndex) penultimateTerminalNe) + etaPenultimateTwo etaTerminalTwo + obtain ⟨PTwo, colorTwo⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx POne muTwo corrTwo baseTwo CTwo sameTwo + have alphaPresentPenultimate : alpha ∉ MissingColors G phi (T.vertex penIndex) := by + exact helper_alphaPresentPenultimate_2279 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) (@ctx) (@D) (@B) (@Bplus) (@penPosition) (@hBLouter) (@hElemOuter) + (@hPenultimateInBplus) + (@hAlphaFirstBound) (@hAlphaAtFirst) (@hAlphaFirstBplus) + have alphaPresentTwo : alpha ∉ MissingColors G muTwo (T.vertex penIndex) := by + rw [missingTwo _ hPenultimateInBplus, hmissingPointwise _ hPenultimateInBplus] + exact alphaPresentPenultimate + have starTwo : HierarchyStarredStage PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount) = A := + (P2752_T2_HierarchyMeasures C.hierarchy PTwo.counterexample.hierarchy PTwo.sameGood.1).1.symm + have pathTwoEq : HierarchyPathNumber C.hierarchy = HierarchyPathNumber + PTwo.counterexample.hierarchy := + (P2752_T2_HierarchyMeasures C.hierarchy PTwo.counterexample.hierarchy PTwo.sameGood.1).2.1 + have etaStoredTwo : eta ∈ HierarchyStoredColorsAt PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount) := by + exact helper_etaStoredTwo_2301 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@eta) + (@hetaStored) (@PTwo) + obtain ⟨gammaOne, gammaTwo, gammaDistinct, gammaPair⟩ := + Finset.card_eq_two.mp (PTwo.counterexample.good.twoColors _ eta etaStoredTwo) + let finalData : HierarchySituationTwoCaseOneData G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := by + exact @helperFinalData2160 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@lastPosition) (@penPosition) (@endPosition) (@eta) (@hTailAtLeast) (@etaTerminalTwo) + (@etaPenultimateTwo) (@lastTwo) (@PTwo) (@colorTwo) (@alphaPresentTwo) (@starTwo) + (@pathTwoEq) (@etaStoredTwo) (@gammaOne) (@gammaTwo) (@gammaDistinct) (@gammaPair) + exact HierarchySituationTwoSubcaseOneOne G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext finalData + +theorem helper_continuation_3757.{u_1, u_2} : + helperContinuation3757Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex H + q A ell B Bplus n Tn lastPosition penPosition endPosition eta hetaStored hetaMissing + hthetaGamma hTailAtLeast hellOuter hBLouter hPLouter hBplusTouter hBBplusOuter hATouter + hABplusouter hElemOuter vAlpha vertexMemOuter hPenultimateInBplus hBplusDef canonicalElem + hAlphaEtaNe hthetaInA hetaNotA hAlphaMissingBplus hthetaMissingBplus hetaFirst + hthetaFirstBound hAlphaFirstBound hvAlphaBplus thetaAvoidsSplit hthetaAlphaNe hThetaTn + selfComponent leafComponent separateVertices hthetaAtFirst hAlphaAtFirst hthetaTerminalNe z + muOne prefixMissing hThetaFirstBplus hAlphaFirstBplus hmissingOne hmissingPointwise + htreeMissingEq hfixedSplit hlastOne hthetaTerminalOne hetaPenultimateOne stageSegment + lastZero hTnBplus hfixedBplusAux hfixedBplus hBplusLength transportOne hrouteOne + firstWitness firstPreserved firstFromMembership hgammaCutoff hmissingPairOne hsuffixPhi + corrOne maxOne baseOne KOne goodOne sameOne + obtain ⟨COne, sameOne⟩ : ∃ COne : HierarchyCounterexample baseOne, + SameGoodHierarchy C.good COne.good := by + refine ⟨{ + positive := by rw [corrOne.rungAgreement]; exact C.positive + hierarchy := KOne + good := goodOne + maximum := maxOne + notElementary := ?_ }, sameOne⟩ + intro he + exact Finset.disjoint_left.mp + (he (vertexMemOuter T (HierarchyFirstMissingPosition phi T theta)) + (vertexMemOuter T endIndex) hthetaTerminalNe) + ((hmissingPointwise _ hThetaFirstBplus).symm ▸ hthetaAtFirst) hthetaTerminalOne + obtain ⟨ctxOne⟩ := P2752_T2_MinimumContextTransport G k e0 input T phi muOne + ett base C ctx corrOne baseOne COne sameOne + let POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := by + exact @helperPOne1741 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@corrOne) (@maxOne) + (@baseOne) (@COne) (@sameOne) (@ctxOne) + let HOne := COne.hierarchy + let qOne : Fin (HOne.dividerCount + 1) := Fin.last HOne.dividerCount + have starOne : HierarchyStarredStage HOne qOne = A := + (P2752_T2_HierarchyMeasures C.hierarchy COne.hierarchy sameOne.1).1.symm + have countOne : H.dividerCount = HOne.dividerCount := sameOne.2.choose + have prefixOne : HierarchyFullTailPrefix COne (HierarchyFullTailLength COne - 1) = + Bplus := by + exact helper_prefixOne_1931 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@Bplus) (@hBplusDef) (@corrOne) (@baseOne) (@COne) (@starOne) + have elemOne : ColoredVertexSetElementary G muOne (TreeSequenceVertexSet Bplus) := by + intro u hu v hv hne + rw [hmissingPointwise u hu, hmissingPointwise v hv] + exact hElemOuter hu hv hne + have missingPrefixOne : ∀ X : TreeSequence G e0, + TreeSequenceInitialSegment X Bplus → TreeMissingColors muOne X = TreeMissingColors phi X := by + intro X hX + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => + hmissingPointwise v (TreeSequenceInitialSegmentVertexSetSubset hX hv)) + have firstThetaOne : HierarchyFirstMissingPosition muOne T theta = + HierarchyFirstMissingPosition phi T theta := firstPreserved phi muOne theta hElemOuter + hmissingPointwise hthetaMissingBplus + have firstEtaOne : HierarchyFirstMissingPosition muOne T eta = + penIndex := + (firstPreserved phi muOne eta hElemOuter hmissingPointwise (Finset.mem_biUnion.mpr ⟨_, + hPenultimateInBplus, hetaMissing⟩)).trans hetaFirst + have thetaFirstOne : theta ∈ MissingColors G muOne + (T.vertex (HierarchyFirstMissingPosition phi T theta)) := by + rw [hmissingPointwise _ hThetaFirstBplus] + exact hthetaAtFirst + have thetaEtaNe : theta ≠ eta := by + intro he + exact hetaNotA (he ▸ hthetaInA) + have thetaUnusedOne : ∀ t : Fin T.length, A.length ≤ t.val → + muOne (T.edge t) ≠ some theta := by + exact helper_thetaUnusedOne_1963 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@Bplus) (@lastPosition) (@hPLouter) (@thetaAvoidsSplit) (@hthetaAlphaNe) (@hfixedSplit) + (@hlastOne) + have sameLastOne : HierarchyStoredColorsAt H q = HierarchyStoredColorsAt HOne qOne ∧ + ∀ c ∈ HierarchyStoredColorsAt H q, C.good.gamma q c = COne.good.gamma qOne c := by + obtain ⟨hc, hd⟩ := sameOne.2 + have hi : Fin.cast (congrArg (fun d => d + 1) hc) q = qOne := + Fin.ext hc + simpa only [hi] using hd q + have thetaStoredOne : theta ∉ HierarchyStoredColorsAt HOne qOne := by + rw [← sameLastOne.1] + exact fun hm => (Finset.mem_sdiff.mp hm).2 hthetaInA + have etaStoredOne : eta ∈ HierarchyStoredColorsAt HOne qOne := + sameLastOne.1 ▸ hetaStored + have etaGammaOne : theta ∈ COne.good.gamma qOne eta := + sameLastOne.2 eta hetaStored ▸ hthetaGamma + have tnOne : + corrOne.replacementETT.series.data.tree (Fin.last corrOne.replacementETT.rounds).castSucc = + Tn := by + exact helper_tnOne_1991 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@corrOne) + (@baseOne) (@COne) (@sameOne) (@countOne) + have thetaTnOne (hz : HOne.dividerCount = 0) : + theta ∈ TreeMissingColors muOne + (corrOne.replacementETT.series.data.tree (Fin.last + corrOne.replacementETT.rounds).castSucc) := by + rw [tnOne, missingPrefixOne Tn hTnBplus] + exact hThetaTn (countOne.trans hz) + have positiveStarOne (hz : HOne.dividerCount ≠ 0) : + HOne.stage ⟨HOne.dividerCount, Nat.lt_succ_of_lt (Nat.lt_succ_self _)⟩ = A := by + exact helper_positiveStarOne_2005 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@Bplus) (@eta) (@corrOne) (@baseOne) (@COne) (@starOne) (@countOne) (@hz) + have caseTwo : + (0 < HOne.dividerCount ∧ theta ∈ TreeMissingColors muOne + (HOne.stage ⟨HOne.dividerCount, Nat.lt_succ_of_lt (Nat.lt_succ_self _)⟩)) ∨ + (HOne.dividerCount = 0 ∧ + (theta ∈ TreeMissingColors muOne + (corrOne.replacementETT.series.data.tree (Fin.last + corrOne.replacementETT.rounds).castSucc) ∨ + (theta ∈ TreeMissingColors muOne (HierarchyStarredStage HOne qOne) ∧ + theta ∉ TashkinovStoredColors corrOne.replacementETT.series.data + (Fin.last corrOne.replacementETT.rounds) ∧ + eta ∉ TashkinovStoredColors corrOne.replacementETT.series.data + (Fin.last corrOne.replacementETT.rounds)))) := by + exact helper_caseTwo_2017 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@Bplus) (@eta) + (@hABplusouter) (@hthetaInA) (@corrOne) (@baseOne) (@COne) (@missingPrefixOne) + (@thetaTnOne) (@positiveStarOne) + have etaMissingPrefixOne : eta ∈ TreeMissingColors muOne Bplus := + Finset.mem_biUnion.mpr ⟨_, hPenultimateInBplus, hetaPenultimateOne⟩ + have thetaMissingPrefixOne : theta ∈ TreeMissingColors muOne Bplus := hmissingPairOne.1 + have orderedTwo : + (theta ∉ TreeMissingColors muOne (HierarchyStarredStage HOne qOne) ∨ + eta ∉ TreeMissingColors muOne (HierarchyStarredStage HOne qOne)) → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition muOne T theta)) + (T.vertex (HierarchyFirstMissingPosition muOne T eta)) ∧ + theta ∉ Finset.univ.filter (fun c => + ∃ t : Fin T.length, (HierarchyStarredStage HOne qOne).length ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition muOne T eta).val ∧ + muOne (T.edge t) = some c) := by + exact helper_orderedTwo_2037 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@penPosition) (@eta) (@hTailAtLeast) (@hellOuter) (@hthetaFirstBound) (@corrOne) + (@baseOne) (@COne) (@starOne) (@firstThetaOne) (@firstEtaOne) (@thetaUnusedOne) + have changeTwo := ChangeLemma G k e0 corrOne.replacementInput T muOne + corrOne.replacementETT baseOne COne ctxOne.proper ctxOne.oneEdgeUncolored + ctxOne.lowerRung ctxOne.fewerDividers ctxOne.lexicographicMinimality + (by + change ColoredVertexSetElementary G muOne (TreeSequenceVertexSet + (HierarchyFullTailPrefix COne (HierarchyFullTailLength COne - 1))) + rw [prefixOne]; exact elemOne) ctxOne.largeMissingSet + theta eta thetaEtaNe (by + change theta ∈ TreeMissingColors muOne + (HierarchyFullTailPrefix COne (HierarchyFullTailLength COne - 1)) ∧ + eta ∈ TreeMissingColors muOne + (HierarchyFullTailPrefix COne (HierarchyFullTailLength COne - 1)) + rw [prefixOne] + exact ⟨thetaMissingPrefixOne, etaMissingPrefixOne⟩) orderedTwo + have componentEqTwo : + TwoColorComponent G muOne theta eta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T theta))) = + TwoColorComponent G muOne theta eta (Sum.inl (T.vertex penIndex)) := by + exact helper_componentEqTwo_2072 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@Bplus) (@eta) (@hABplusouter) (@hthetaInA) (@corrOne) (@baseOne) (@COne) + (@missingPrefixOne) (@firstThetaOne) (@firstEtaOne) (@thetaTnOne) (@positiveStarOne) + (@changeTwo) + have thetaPenultimateNe : T.vertex (HierarchyFirstMissingPosition phi T theta) ≠ + T.vertex penIndex := by + exact helper_thetaPenultimateNe_2082 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@penPosition) (@hTailAtLeast) (@hellOuter) (@hthetaFirstBound) + exact @helper_continuation_4221 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@B) + (@Bplus) (@lastPosition) (@penPosition) (@endPosition) (@eta) (@hetaStored) (@hetaMissing) + (@hTailAtLeast) (@hellOuter) (@hBLouter) (@hPLouter) (@hBplusTouter) (@hBBplusOuter) + (@hATouter) (@hABplusouter) (@hElemOuter) (@vAlpha) (@vertexMemOuter) + (@hPenultimateInBplus) (@hBplusDef) (@canonicalElem) (@hAlphaEtaNe) (@hAlphaMissingBplus) + (@hthetaMissingBplus) (@hetaFirst) (@hAlphaFirstBound) (@hvAlphaBplus) (@thetaAvoidsSplit) + (@selfComponent) (@leafComponent) (@separateVertices) (@hAlphaAtFirst) (@hthetaTerminalNe) + (@prefixMissing) (@hThetaFirstBplus) (@hAlphaFirstBplus) (@hmissingOne) + (@hmissingPointwise) (@htreeMissingEq) (@hfixedSplit) (@hlastOne) (@hthetaTerminalOne) + (@hetaPenultimateOne) (@lastZero) (@hTnBplus) (@hfixedBplusAux) (@hfixedBplus) + (@hBplusLength) (@transportOne) (@hrouteOne) (@firstWitness) (@firstPreserved) + (@firstFromMembership) (@hgammaCutoff) (@hmissingPairOne) (@hsuffixPhi) (@corrOne) + (@maxOne) (@baseOne) (@COne) (@sameOne) (@ctxOne) (@starOne) (@countOne) (@prefixOne) + (@elemOne) (@missingPrefixOne) (@firstThetaOne) (@firstEtaOne) (@thetaFirstOne) + (@thetaEtaNe) (@thetaUnusedOne) (@thetaStoredOne) (@tnOne) (@caseTwo) + (@etaMissingPrefixOne) (@thetaMissingPrefixOne) (@componentEqTwo) (@thetaPenultimateNe) +theorem helper_continuation_3399.{u_1, u_2} : + helperContinuation3399Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex H + q A ell B Bplus n Tn lastColor alphaTerminal alphaUnused lastPosition penPosition + endPosition oldRoute eta hetaStored hetaMissing hthetaGamma hTailAtLeast hellOuter hBLouter + hPLouter hBplusTouter hBBplusOuter hATouter hABplusouter hElemOuter vAlpha vertexMemOuter + hPenultimateInBplus hBplusDef canonicalElem hAlphaEtaNe hthetaInA hetaNotA + hAlphaMissingBplus hthetaMissingBplus canonicalMissing hetaFirst hthetaFirstBound + hAlphaFirstBound hvAlphaBplus thetaAvoidsSplit hthetaAlphaNe hThetaTn hChange selfComponent + leafComponent separateVertices hthetaAtFirst hAlphaAtFirst hthetaTerminalNe + hdisjointComponent z hpath muOne behaviorOne prefixMissing hThetaFirstBplus + hAlphaFirstBplus hmissingOne hmissingPointwise + have htreeMissingEq : TreeMissingColors muOne Bplus = TreeMissingColors phi Bplus := by + as_aux_lemma => + unfold TreeMissingColors + exact Finset.biUnion_congr rfl hmissingPointwise + have hstableOne := StableChangeCasesOneTwo G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality canonicalElem ctx.largeMissingSet + theta alpha hthetaAlphaNe canonicalMissing + z hpath muOne rfl hChange hdisjointComponent + have hfixedCoreOne : ∀ t : Fin A.length, + muOne (A.edge t) = phi (A.edge t) := by + exact helper_hfixedCoreOne_1548 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@Bplus) (@eta) (@hstableOne) + have hfixedSplit : ∀ t : Fin T.length, A.length ≤ t.val → + t.val < Bplus.length → muOne (T.edge t) = phi (T.edge t) := by + intro t ht htb + simp [muOne, TwoColorComponentSwap, alphaUnused t ht, + thetaAvoidsSplit t ht htb] + have hlastIncident : Incident G (T.vertex endIndex) + (T.edge lastIndex) := by + exact helper_hlastIncident_1596 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@Bplus) (@lastPosition) (@penPosition) (@endPosition) (@eta) + have hlastEdgeInOne : Sum.inr (T.edge lastIndex) ∈ + TwoColorComponent G phi theta alpha z := by + exact helper_hlastEdgeInOne_1608 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@lastColor) (@hlastIncident) + have hlastOne : muOne (T.edge lastIndex) = some alpha := by + simp [muOne, TwoColorComponentSwap, hlastEdgeInOne, lastColor] + have hthetaTerminalOne : theta ∈ MissingColors G muOne + (T.vertex endIndex) := by + exact behaviorOne.2.2.1 _ (selfComponent phi theta alpha + (T.vertex endIndex)) alphaTerminal + have hetaPenultimateOne : eta ∈ MissingColors G muOne + (T.vertex penIndex) := by + rw [hmissingOne _ hPenultimateInBplus] + exact hetaMissing + have segTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : TreeSequenceInitialSegment X Z := by + exact helper_segTrans_1626 (@G) (@e0) (@hXY) (@hYZ) + have stageSegment (a d : ℕ) (hb : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + exact @helper_stageSegment_1634 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@B) + (@Bplus) (@eta) (@segTrans) (@a) (@d) (@hb) + have lastZero (hz : H.dividerCount = 0) : A = base.core := by + simp [A, q, HierarchyStarredStage, hz, Fin.last] + have lastPositive (hz : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, Nat.lt_succ_of_lt (Nat.lt_succ_self _)⟩ := by + exact helper_lastPositive_1645 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@Bplus) (@eta) (@hz) + have coreToA : TreeSequenceInitialSegment base.core A := by + exact @helper_coreToA_1660 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@B) (@Bplus) (@eta) + (@segTrans) (@stageSegment) (@lastZero) (@lastPositive) + have hTnBplus : TreeSequenceInitialSegment Tn Bplus := by + exact helper_hTnBplus_1668 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@B) (@Bplus) (@eta) + (@hPLouter) (@hBplusTouter) + have hfixedBplusAux (aLen : Nat) (haLen : aLen = A.length) + (hcut : ∀ t : Fin Bplus.length, t.val < aLen ∨ aLen ≤ t.val) : + ∀ t : Fin Bplus.length, muOne (Bplus.edge t) = phi (Bplus.edge t) := by + exact helper_hfixedBplusAux_1682 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@Bplus) (@hBplusTouter) (@hABplusouter) (@hfixedCoreOne) (@hfixedSplit) (@aLen) (@haLen) + (@hcut) + have hfixedBplus := hfixedBplusAux A.length rfl + (fun t => Nat.lt_or_ge t.val A.length) + have hBplusLength : Bplus.length = B.length + 1 := by + exact helper_hBplusLength_1712 (@G) (@e0) (@T) (@B) (@Bplus) (@hBLouter) (@hPLouter) + have transportOne (S : TreeSequence G e0) + (hseq : TashkinovAugmentationSequence phi S Bplus) : + TashkinovAugmentationSequence muOne S Bplus := by + exact helper_transportOne_1721 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@Bplus) (@hBBplusOuter) (@hmissingOne) (@hfixedBplus) (@hBplusLength) (@S) (@hseq) + have hrouteOne : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence muOne Tn Bplus) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, ett.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence muOne seed Bplus) := by + exact @helper_hrouteOne_1730 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@Bplus) (@oldRoute) (@hTailAtLeast) (@hellOuter) (@hPLouter) (@hBplusTouter) + (@hABplusouter) (@segTrans) (@coreToA) (@hTnBplus) (@transportOne) + have firstWitness (rho : PartialEdgeColoring E k) (c : Fin k) + (hc : c ∈ TreeMissingColors rho Bplus) : + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (HierarchyFirstMissingPosition rho T c).val ≤ Bplus.length := by + exact helper_firstWitness_1779 (@G) (@k) (@e0) (@T) (@Bplus) (@hBplusTouter) (@rho) (@c) (@hc) + have firstPreserved (rho sigma : PartialEdgeColoring E k) (c : Fin k) + (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet Bplus)) + (hmiss : ∀ v ∈ TreeSequenceVertexSet Bplus, MissingColors G sigma v = MissingColors G rho v) + (hc : c ∈ TreeMissingColors rho Bplus) : + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + exact helper_firstPreserved_1805 (@G) (@k) (@e0) (@T) (@Bplus) (@hBplusTouter) + (@firstWitness) (@rho) (@sigma) (@c) (@helem) (@hmiss) (@hc) + have firstFromMembership (rho sigma : PartialEdgeColoring E k) (c : Fin k) + (hc : ∀ v, c ∈ MissingColors G sigma v ↔ c ∈ MissingColors G rho v) : + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + exact helper_firstFromMembership_1829 (@G) (@k) (@e0) (@T) (@rho) (@sigma) (@c) (@hc) + have hstoredFirst : ∀ c, c ∈ HierarchyStoredColorsAt H q → + HierarchyFirstMissingPosition muOne T c = HierarchyFirstMissingPosition phi T c := by + exact helper_hstoredFirst_1843 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@Bplus) (@hElemOuter) (@hthetaInA) (@hAlphaMissingBplus) (@behaviorOne) + (@hmissingPointwise) (@firstPreserved) (@firstFromMembership) + have hAlphaNoGamma : alpha ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := by + exact helper_hAlphaNoGamma_1854 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + have hthetaOwner : ∀ c, c ∈ HierarchyStoredColorsAt H q → + theta ∈ C.good.gamma q c → c = eta := by + intro c hc hct + by_contra hne + exact Finset.disjoint_left.mp (C.good.disjointPairs q c eta hc hetaStored hne) + hct hthetaGamma + have hgammaCutoff : ∀ c, c ∈ HierarchyStoredColorsAt H q → + (alpha ∈ C.good.gamma q c ∨ theta ∈ C.good.gamma q c) → + (HierarchyFirstMissingPosition phi T c).val ≤ Bplus.length := by + exact helper_hgammaCutoff_1866 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@Bplus) (@penPosition) (@endPosition) (@eta) (@hBLouter) (@hPLouter) (@hetaFirst) + (@hAlphaNoGamma) (@hthetaOwner) + have hmissingPairOne : + theta ∈ TreeMissingColors muOne Bplus ∧ + alpha ∈ TreeMissingColors muOne Bplus := by + exact htreeMissingEq.symm ▸ ⟨hthetaMissingBplus, hAlphaMissingBplus⟩ + have hsuffixPhi : TashkinovAugmentationSequence phi Bplus T := by + exact helper_hsuffixPhi_1881 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@Bplus) (@lastColor) (@lastPosition) (@hPLouter) (@hBplusTouter) (@hthetaMissingBplus) + obtain ⟨_, _, corrOne, maxOne, baseOne, KOne, goodOne, sameOne⟩ := + StableChangeCasesOneTwoSplitTail G k e0 input T phi ett base C ctx + theta alpha hthetaAlphaNe canonicalMissing + z hpath muOne rfl hChange hdisjointComponent + Bplus hABplusouter (by + change A.length < Bplus.length + have htail := hTailAtLeast + have hp := hPLouter + have hell := hellOuter + clear * - htail hp hell + omega) + (by rw [← hBplusDef]; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩) + hfixedSplit hrouteOne hsuffixPhi hmissingPairOne + (by rw [← hBplusDef]; exact hmissingPointwise) + hstoredFirst (fun c hc hp => hgammaCutoff c hc hp.symm) + exact @helper_continuation_3757 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@B) + (@Bplus) (@lastPosition) (@penPosition) (@endPosition) (@eta) (@hetaStored) (@hetaMissing) + (@hthetaGamma) (@hTailAtLeast) (@hellOuter) (@hBLouter) (@hPLouter) (@hBplusTouter) + (@hBBplusOuter) (@hATouter) (@hABplusouter) (@hElemOuter) (@vAlpha) (@vertexMemOuter) + (@hPenultimateInBplus) (@hBplusDef) (@canonicalElem) (@hAlphaEtaNe) (@hthetaInA) + (@hetaNotA) (@hAlphaMissingBplus) (@hthetaMissingBplus) (@hetaFirst) (@hthetaFirstBound) + (@hAlphaFirstBound) (@hvAlphaBplus) (@thetaAvoidsSplit) (@hthetaAlphaNe) (@hThetaTn) + (@selfComponent) (@leafComponent) (@separateVertices) (@hthetaAtFirst) (@hAlphaAtFirst) + (@hthetaTerminalNe) (@prefixMissing) (@hThetaFirstBplus) (@hAlphaFirstBplus) (@hmissingOne) + (@hmissingPointwise) (@htreeMissingEq) (@hfixedSplit) (@hlastOne) (@hthetaTerminalOne) + (@hetaPenultimateOne) (@stageSegment) (@lastZero) (@hTnBplus) (@hfixedBplusAux) + (@hfixedBplus) (@hBplusLength) (@transportOne) (@hrouteOne) (@firstWitness) + (@firstPreserved) (@firstFromMembership) (@hgammaCutoff) (@hmissingPairOne) (@hsuffixPhi) + (@corrOne) (@maxOne) (@baseOne) (@KOne) (@goodOne) (@sameOne) +theorem helper_continuation_3310.{u_1, u_2} : + helperContinuation3310Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex H + q A ell B Bplus n Tn lastColor alphaTerminal alphaBefore alphaUnused lastPosition + penPosition endPosition oldRoute eta hetaStored hetaMissing hthetaGamma hTailAtLeast + hellOuter hBLouter hPLouter hBTouter hBplusTouter hBBplusOuter hATouter hABplusouter + hElemOuter missingMonoOuter vAlpha vertexMemOuter firstMissingOuter hPenultimateInBplus + hBplusDef canonicalElem hAlphaEtaNe hthetaInA hetaNotA hAlphaMissingBplus + hthetaMissingBplus canonicalMissing hetaFirst hthetaFirstBound hAlphaFirstBound + hvAlphaBplus horderedUnused thetaAvoidsSplit hthetaAlphaNe hThetaTn hThetaTnq + have hChange : + (0 < H.dividerCount ∧ theta ∈ TreeMissingColors phi + (H.stage ⟨H.dividerCount, Nat.lt_succ_of_lt (Nat.lt_succ_self _)⟩)) ∨ + (H.dividerCount = 0 ∧ + (theta ∈ TreeMissingColors phi Tn ∨ + (theta ∈ TreeMissingColors phi A ∧ + theta ∉ TashkinovStoredColors ett.series.data n ∧ + alpha ∉ TashkinovStoredColors ett.series.data n))) := by + exact helper_hChange_1257 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@hThetaTn) + (@hThetaTnq) + have hchange := ChangeLemma G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality canonicalElem ctx.largeMissingSet + theta alpha hthetaAlphaNe canonicalMissing horderedUnused + have hcomponentEq : + TwoColorComponent G phi theta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T theta))) = + TwoColorComponent G phi theta alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T alpha))) := by + by_cases hz : H.dividerCount = 0 + · exact hchange.2.1 ⟨hz, Or.inl (hThetaTn hz)⟩ + · exact hchange.1 ⟨Nat.pos_of_ne_zero hz, + Or.inl (hThetaTnq (Nat.pos_of_ne_zero hz))⟩ + have selfComponent (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := by + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl v) = _ + rfl + have leafComponent (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) (v : V) + (hm : a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v) : + Set.Subsingleton ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)) := by + exact helper_leafComponent_1287 (@G) (@k) (@rho) (@a) (@b) (@hne) (@hp) (@v) (@hm) + have separateVertices (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) (u v w : V) + (huv : u ≠ v) (huw : u ≠ w) (hvw : v ≠ w) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hw : a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w) + (hsame : TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v)) : + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + exact helper_separateVertices_1307 (@G) (@k) (@selfComponent) (@leafComponent) (@rho) (@a) + (@b) (@hne) (@hp) + (@u) (@v) (@w) (@huv) (@huw) (@hvw) (@hu) (@hv) (@hw) (@hsame) + have separateMaybeCoincident (rho : PartialEdgeColoring E k) (a b : Fin k) + (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (u v w : V) + (huw : u ≠ w) (hvw : v ≠ w) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hw : a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w) + (hsame : TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v)) : + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + exact helper_separateMaybeCoincident_1344 (@G) (@k) (@selfComponent) (@separateVertices) + (@rho) (@a) (@b) (@hne) + (@hp) (@u) (@v) (@w) (@huw) (@hvw) (@hu) (@hv) (@hw) (@hsame) + have hAlphaMissingT : alpha ∈ TreeMissingColors phi T := + missingMonoOuter (X := B) (Y := T) hBTouter alphaBefore + have hthetaMissingT : theta ∈ TreeMissingColors phi T := + missingMonoOuter (X := A) (Y := T) hATouter hthetaInA + have hthetaAtFirst : theta ∈ MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T theta)) := + firstMissingOuter T theta hthetaMissingT + have hAlphaAtFirst : alpha ∈ MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) := + firstMissingOuter T alpha hAlphaMissingT + have hthetaTerminalNe : T.vertex (HierarchyFirstMissingPosition phi T theta) ≠ + T.vertex endIndex := by + exact helper_hthetaTerminalNe_1391 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@endPosition) (@hTailAtLeast) (@hellOuter) (@hthetaFirstBound) + have hAlphaTerminalNe : T.vertex (HierarchyFirstMissingPosition phi T alpha) ≠ + T.vertex endIndex := by + exact helper_hAlphaTerminalNe_1401 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@endPosition) (@hBLouter) (@hAlphaFirstBound) + have hdisjointComponent := separateMaybeCoincident phi theta alpha + hthetaAlphaNe ctx.proper + (T.vertex (HierarchyFirstMissingPosition phi T theta)) + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex endIndex) + hthetaTerminalNe hAlphaTerminalNe hthetaAtFirst hAlphaAtFirst + (Or.inr alphaTerminal) hcomponentEq + let z : Sum V E := Sum.inl (T.vertex endIndex) + have hpath : TwoColorPathComponent G phi theta alpha z := + ⟨hthetaAlphaNe, _, selfComponent phi theta alpha _, + leafComponent phi theta alpha hthetaAlphaNe ctx.proper _ + (Or.inr alphaTerminal)⟩ + let muOne := TwoColorComponentSwap G phi theta alpha z + have behaviorOne : + (∀ v : V, Sum.inl v ∉ TwoColorComponent G phi theta alpha z → + MissingColors G muOne v = MissingColors G phi v) ∧ + (∀ v : V, Sum.inl v ∈ TwoColorComponent G phi theta alpha z → + theta ∈ MissingColors G phi v → alpha ∈ MissingColors G muOne v) ∧ + (∀ v : V, Sum.inl v ∈ TwoColorComponent G phi theta alpha z → + alpha ∈ MissingColors G phi v → theta ∈ MissingColors G muOne v) ∧ + (∀ v : V, ∀ c : Fin k, c ≠ theta → c ≠ alpha → + (c ∈ MissingColors G muOne v ↔ c ∈ MissingColors G phi v)) := by + exact TwoColorComponentSwapMissingBehavior G phi theta alpha + hthetaAlphaNe ctx.proper z + have prefixMissing (z : Sum V E) (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) + (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet Bplus)) + (u v : V) (huB : u ∈ TreeSequenceVertexSet Bplus) (hvB : v ∈ TreeSequenceVertexSet Bplus) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hdu : Sum.inl u ∉ TwoColorComponent G rho a b z) + (hdv : Sum.inl v ∉ TwoColorComponent G rho a b z) : + ∀ w ∈ TreeSequenceVertexSet Bplus, + MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by + exact helper_prefixMissing_1434 (@G) (@k) (@e0) (@Bplus) (@z) (@rho) (@a) (@b) (@hne) (@hp) + (@helem) (@u) (@v) (@huB) (@hvB) (@hu) (@hv) + (@hdu) (@hdv) + have hThetaFirstBplus : + T.vertex (HierarchyFirstMissingPosition phi T theta) ∈ + TreeSequenceVertexSet Bplus := by + exact helper_hThetaFirstBplus_1491 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@Bplus) (@hBplusTouter) (@hABplusouter) (@hthetaFirstBound) + have hAlphaFirstBplus : + T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ + TreeSequenceVertexSet Bplus := by + exact helper_hAlphaFirstBplus_1500 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@Bplus) (@penPosition) (@endPosition) (@eta) (@hBLouter) (@hPLouter) (@hBplusTouter) + (@hAlphaFirstBound) + have huOutsideOne : Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T theta)) ∉ + TwoColorComponent G phi theta alpha z := by + intro hh + exact Set.disjoint_left.mp hdisjointComponent hh + (selfComponent phi theta alpha + (T.vertex (HierarchyFirstMissingPosition phi T theta))) + have hvOutsideOne : Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∉ + TwoColorComponent G phi theta alpha z := by + exact helper_hvOutsideOne_1516 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@hcomponentEq) (@selfComponent) (@hdisjointComponent) + have hmissingOne : ∀ v ∈ TreeSequenceVertexSet Bplus, + MissingColors G muOne v = MissingColors G phi v := + prefixMissing z phi theta alpha hthetaAlphaNe ctx.proper hElemOuter + (T.vertex (HierarchyFirstMissingPosition phi T theta)) + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + hThetaFirstBplus hAlphaFirstBplus hthetaAtFirst hAlphaAtFirst + huOutsideOne hvOutsideOne + have hmissingPointwise (v : V) (hv : v ∈ TreeSequenceVertexSet Bplus) : + MissingColors G muOne v = MissingColors G phi v := by + as_aux_lemma => + clear_value muOne + clear * - hmissingOne hv + exact hmissingOne v hv + exact @helper_continuation_3399 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@B) + (@Bplus) (@lastColor) (@alphaTerminal) (@alphaUnused) (@lastPosition) (@penPosition) + (@endPosition) (@oldRoute) (@eta) (@hetaStored) (@hetaMissing) (@hthetaGamma) + (@hTailAtLeast) (@hellOuter) (@hBLouter) (@hPLouter) (@hBplusTouter) (@hBBplusOuter) + (@hATouter) (@hABplusouter) (@hElemOuter) (@vAlpha) (@vertexMemOuter) + (@hPenultimateInBplus) (@hBplusDef) (@canonicalElem) (@hAlphaEtaNe) (@hthetaInA) + (@hetaNotA) (@hAlphaMissingBplus) (@hthetaMissingBplus) (@canonicalMissing) (@hetaFirst) + (@hthetaFirstBound) (@hAlphaFirstBound) (@hvAlphaBplus) (@thetaAvoidsSplit) + (@hthetaAlphaNe) (@hThetaTn) (@hChange) (@selfComponent) (@leafComponent) + (@separateVertices) (@hthetaAtFirst) (@hAlphaAtFirst) (@hthetaTerminalNe) + (@hdisjointComponent) (@hpath) (@behaviorOne) (@prefixMissing) (@hThetaFirstBplus) + (@hAlphaFirstBplus) (@hmissingOne) (@hmissingPointwise) + +end GoldbergSeymour.HierarchySituationTwoSubcaseThreeOnePreparation + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation2.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation2.lean new file mode 100644 index 0000000000..a04b247e3f --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation2.lean @@ -0,0 +1,1607 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeOne.Preparation1 + +/-! +# HierarchySituationTwoSubcaseThreeOne: supporting constructions, part 2 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.HierarchySituationTwoSubcaseThreeOnePreparation + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation3712Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + phi (T.edge lastIndex) = some theta → + alpha ∈ MissingColors G phi (T.vertex endIndex) → + alpha ∈ TreeMissingColors phi B → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some alpha) → + (↑lastIndex : ℕ) + (1 : ℕ) = T.length → + (↑penIndex : ℕ) + (1 : ℕ) = T.length → + (↑endIndex : ℕ) = T.length → + (have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TreeIncidentEdge Tn f ∧ + (∃ c ∈ TreeMissingColors phi Tn ∪ Dn, phi f = some c) ∧ + TashkinovAugmentationSequence phi seed T) → + (∃ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex penIndex) ∧ theta ∈ C.good.gamma q eta) → + False + +theorem helper_continuation_3712.{u_1, u_2} : + helperContinuation3712Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex H + q A ell B Bplus n Tn lastColor alphaTerminal alphaBefore alphaUnused lastPosition + penPosition endPosition oldRoute h_exception + rcases h_exception with ⟨eta, hetaStored, hetaMissing, hthetaGamma⟩ + have hTailAtLeast : 2 ≤ ell := D.tailAtLeastTwo + have hellOuter : ell = T.length - A.length := rfl + have hBLouter : B.length + 2 = T.length := by + simp only [B, HierarchyFullTailPrefix, TreeSequencePrefix] + change min (A.length + (T.length - A.length - 2)) T.length + 2 = T.length + rw [← hellOuter] + omega + have hPLouter : Bplus.length + 1 = T.length := by + simp only [Bplus, HierarchyFullTailPrefix, TreeSequencePrefix] + change min (A.length + (T.length - A.length - 1)) T.length + 1 = T.length + rw [← hellOuter] + omega + have hBTouter : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hBplusTouter : TreeSequenceInitialSegment Bplus T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hBBplusOuter : TreeSequenceInitialSegment B Bplus := by + exact helper_hBBplusOuter_953 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@penPosition) (@endPosition) (@hBLouter) (@hPLouter) + have hATouter : TreeSequenceInitialSegment A T := by + exact helper_hATouter_959 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + have hABouter : TreeSequenceInitialSegment A B := by + exact helper_hABouter_980 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@penPosition) + (@endPosition) (@hTailAtLeast) (@hellOuter) (@hBLouter) (@hPLouter) (@hATouter) + have hABplusouter : TreeSequenceInitialSegment A Bplus := by + exact helper_hABplusouter_986 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@penPosition) (@endPosition) (@hTailAtLeast) (@hellOuter) (@hBLouter) (@hPLouter) + (@hATouter) + have hElemOuter : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have missingMonoOuter {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) : + TreeMissingColors phi X ⊆ TreeMissingColors phi Y := + Finset.biUnion_subset_biUnion_of_subset_left (MissingColors G phi) + (TreeSequenceInitialSegmentVertexSetSubset hXY) + have hAlphaWitness : ∃ v ∈ TreeSequenceVertexSet B, + alpha ∈ MissingColors G phi v := by + exact Finset.mem_biUnion.mp alphaBefore + obtain ⟨vAlpha, hvAlpha, hAlphaAt⟩ := hAlphaWitness + have vertexMemOuter (X : TreeSequence G e0) (i : Fin (X.length + 1)) : + X.vertex i ∈ TreeSequenceVertexSet X := + (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, Finset.mem_univ _, rfl⟩ + have firstMissingOuter (X : TreeSequence G e0) (c : Fin k) + (hc : c ∈ TreeMissingColors phi X) : + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by + exact helper_firstMissingOuter_1008 (@G) (@k) (@e0) (@phi) (@X) (@c) (@hc) + have firstLeOuter (X : TreeSequence G e0) (c : Fin k) + (i : Fin (X.length + 1)) (hi : c ∈ MissingColors G phi (X.vertex i)) : + (HierarchyFirstMissingPosition phi X c).val ≤ i.val := by + exact helper_firstLeOuter_1021 (@G) (@k) (@e0) (@phi) (@X) (@c) (@i) (@hi) + have firstBoundByPrefix (X : TreeSequence G e0) + (hXT : TreeSequenceInitialSegment X T) (c : Fin k) + (hc : c ∈ TreeMissingColors phi X) : + (HierarchyFirstMissingPosition phi T c).val ≤ X.length := by + exact helper_firstBoundByPrefix_1032 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@firstLeOuter) (@X) (@hXT) (@c) (@hc) + have hPenultimateInBplus : + T.vertex penIndex ∈ TreeSequenceVertexSet Bplus := by + exact helper_hPenultimateInBplus_1048 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) (@ctx) (@D) + (@penPosition) (@endPosition) (@hBLouter) (@hPLouter) (@hBplusTouter) + have hBdef : B = HierarchyFullTailPrefix C (ell - 2) := rfl + have hBplusDef : Bplus = HierarchyFullTailPrefix C (ell - 1) := rfl + clear_value B Bplus + have canonicalElem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyFullTailPrefix C (ell - 1))) := + hBplusDef ▸ hElemOuter + have hAlphaEtaNe : alpha ≠ eta := by + exact helper_hAlphaEtaNe_1071 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@B) + (@Bplus) (@penPosition) (@endPosition) (@eta) (@hetaMissing) (@hBLouter) (@hPLouter) + (@hBTouter) (@hBBplusOuter) (@hElemOuter) (@vAlpha) (@hvAlpha) (@hAlphaAt) + (@hPenultimateInBplus) + have hthetaInA : theta ∈ TreeMissingColors phi A := + (GoodHierarchyReservedDisjoint C.good q).1 eta hetaStored hthetaGamma + have hetaNotA : eta ∉ TreeMissingColors phi A := + (Finset.mem_sdiff.mp hetaStored).2 + have hAlphaMissingBplus : alpha ∈ TreeMissingColors phi Bplus := + missingMonoOuter (X := B) (Y := Bplus) hBBplusOuter alphaBefore + have hthetaMissingBplus : theta ∈ TreeMissingColors phi Bplus := + missingMonoOuter (X := A) (Y := Bplus) hABplusouter hthetaInA + have canonicalMissing : + theta ∈ TreeMissingColors phi (HierarchyFullTailPrefix C (ell - 1)) ∧ + alpha ∈ TreeMissingColors phi (HierarchyFullTailPrefix C (ell - 1)) := + hBplusDef ▸ ⟨hthetaMissingBplus, hAlphaMissingBplus⟩ + have hetaFirst : HierarchyFirstMissingPosition phi T eta = + penIndex := by + exact helper_hetaFirst_1100 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@B) + (@Bplus) (@penPosition) (@endPosition) (@eta) (@hetaMissing) (@hBLouter) (@hPLouter) + (@hBplusTouter) (@hElemOuter) (@vertexMemOuter) (@firstMissingOuter) (@firstLeOuter) + (@hPenultimateInBplus) + have thetaOldAvoid : theta ∉ Finset.univ.filter (fun c => + ∃ r : Fin T.length, A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi T eta).val T.length ∧ + phi (T.edge r) = some c) := by + exact helper_thetaOldAvoid_1134 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@eta) + (@hetaStored) (@hthetaGamma) + have hthetaFirstBound : + (HierarchyFirstMissingPosition phi T theta).val ≤ A.length := + firstBoundByPrefix A hATouter theta hthetaInA + have hAlphaFirstBound : + (HierarchyFirstMissingPosition phi T alpha).val ≤ B.length := + firstBoundByPrefix B hBTouter alpha alphaBefore + have hvAlphaBplus : vAlpha ∈ TreeSequenceVertexSet Bplus := + TreeSequenceInitialSegmentVertexSetSubset hBBplusOuter hvAlpha + have horderedUnused : + (theta ∉ TreeMissingColors phi A ∨ alpha ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T theta)) + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + theta ∉ Finset.univ.filter (fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition phi T alpha).val ∧ + phi (T.edge t) = some c) := by + exact @helper_horderedUnused_1156 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@B) + (@Bplus) (@alphaBefore) (@penPosition) (@eta) (@hBLouter) (@hPLouter) (@hBTouter) + (@hATouter) (@missingMonoOuter) (@vertexMemOuter) (@firstMissingOuter) (@hthetaInA) + (@hetaFirst) (@thetaOldAvoid) (@hthetaFirstBound) (@hAlphaFirstBound) + have thetaAvoidsSplit : ∀ t : Fin T.length, A.length ≤ t.val → + t.val < Bplus.length → phi (T.edge t) ≠ some theta := by + exact helper_thetaAvoidsSplit_1203 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@Bplus) (@penPosition) (@endPosition) (@eta) (@hBLouter) (@hPLouter) (@hetaFirst) + (@thetaOldAvoid) + have hthetaAlphaNe : theta ≠ alpha := by + exact helper_hthetaAlphaNe_1213 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) (@B) + (@Bplus) (@lastColor) (@alphaTerminal) (@lastPosition) (@penPosition) (@endPosition) (@eta) + have hstageTheta : theta ∈ HierarchyStageMissingColors H q := + (Finset.mem_sdiff.mp (C.good.avoidance q eta hetaStored hthetaGamma)).1 + have hThetaTn : H.dividerCount = 0 → theta ∈ TreeMissingColors phi Tn := by + intro hz + have hq0 : q = 0 := Fin.ext (by simp [q, hz]) + rw [hq0] at hstageTheta + simpa [HierarchyStageMissingColors, Tn] using hstageTheta + have hThetaTnq (hz : 0 < H.dividerCount) : + theta ∈ TreeMissingColors phi (H.stage ⟨H.dividerCount, Nat.lt_succ_of_lt (Nat.lt_succ_self + _)⟩) := by + exact helper_hThetaTnq_1236 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) (@B) + (@Bplus) (@eta) (@hstageTheta) (@hz) + exact @helper_continuation_3310 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@B) + (@Bplus) (@lastColor) (@alphaTerminal) (@alphaBefore) (@alphaUnused) (@lastPosition) + (@penPosition) (@endPosition) (@oldRoute) (@eta) (@hetaStored) (@hetaMissing) + (@hthetaGamma) (@hTailAtLeast) (@hellOuter) (@hBLouter) (@hPLouter) (@hBTouter) + (@hBplusTouter) (@hBBplusOuter) (@hATouter) (@hABplusouter) (@hElemOuter) + (@missingMonoOuter) (@vAlpha) (@vertexMemOuter) (@firstMissingOuter) (@hPenultimateInBplus) + (@hBplusDef) (@canonicalElem) (@hAlphaEtaNe) (@hthetaInA) (@hetaNotA) (@hAlphaMissingBplus) + (@hthetaMissingBplus) (@canonicalMissing) (@hetaFirst) (@hthetaFirstBound) + (@hAlphaFirstBound) (@hvAlphaBplus) (@horderedUnused) (@thetaAvoidsSplit) (@hthetaAlphaNe) + (@hThetaTn) (@hThetaTnq) +theorem helper_firstLower_5578.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + (∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), + X.vertex i ∈ TreeSequenceVertexSet X) → + (∀ (X : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi X, + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c))) → + ∀ (X : TreeSequence G e0) (c : Fin k), + ∀ t ≤ X.length, + (∀ (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < t → c ∉ MissingColors G phi (X.vertex i)) → + t ≤ (↑(HierarchyFirstMissingPosition phi X c) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex + lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus baseMinus + HMinus corrStar baseStar HStar vertexMem firstMissing X c t ht hn + as_aux_lemma => + by_contra hlt + have hp : (HierarchyFirstMissingPosition phi X c).val < t := by omega + have hm : c ∈ TreeMissingColors phi X := by + by_contra hm + have he : HierarchyFirstMissingPosition phi X c = Fin.last X.length := by + unfold HierarchyFirstMissingPosition + dsimp only + rw [dite_eq_right] + rintro ⟨i, hi⟩ + exact hm (Finset.mem_biUnion.mpr ⟨X.vertex i, vertexMem X i, + (Finset.mem_filter.mp hi).2⟩) + have := congrArg Fin.val he + simp only [Fin.val_last] at this + omega + exact hn _ hp (firstMissing X c hm) + +theorem helper_terminalData_5614.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus), + MaximumProperty corrMinus.replacementETT → + ∀ (baseMinus : HierarchyBase corrMinus.replacementETT phi), + baseMinus.core = base.core → + baseMinus.closure = base.closure → + (↑baseMinus.supportPosition : ℕ) = (↑base.supportPosition : ℕ) → + ∀ (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hcountMinus : HMinus.dividerCount = C.hierarchy.dividerCount), + (∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HMinus.stage j.castSucc = + C.hierarchy.stage + (Fin.cast + (by + omega) + j).castSucc) → + (∀ (j : Fin HMinus.dividerCount), + (↑(HMinus.dividerPosition j) : ℕ) = + (↑(C.hierarchy.dividerPosition (Fin.cast hcountMinus j)) : ℕ)) → + ∀ (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + corrMinus.replacementETT.series.data.tree + (Fin.last corrMinus.replacementETT.rounds).castSucc = + Tn ∧ + corrMinus.replacementETT.series.data.kind (Fin.last corrMinus.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrMinus.replacementETT.series.data + (Fin.last corrMinus.replacementETT.rounds) = + TashkinovStoredColors ett.series.data n := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex n Tn + lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus maxMinus + baseMinus hcoreMinus hclosureMinus hsupportMinus HMinus hcountMinus hstageMinus + hpositionMinus corrStar baseStar HStar + as_aux_lemma => + rcases corrMinus with ⟨newInput, newSeries, newETT, hr, hs, hf, + ht, hd, he, hk, hp, ho, hstable⟩ + cases newETT with + | mk rounds positive data above strict below generating => + cases hr + have hseries : data = newSeries := eq_of_heq hs + cases hseries + let i : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have hi : i.succ = Fin.last ett.rounds := Fin.ext (by + simp [i]; have := ett.roundsPositive; omega) + have htree : newSeries.data.tree (Fin.last ett.rounds).castSucc = Tn := by + simpa [Tn, n, hi] using ht i + refine ⟨htree, hk _, ?_⟩ + have hstored : + TashkinovStoredColors newSeries.data (Fin.last ett.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + unfold TashkinovStoredColors + simp only [Fin.val_last] + simp_rw [hd] + rw [← hf, ← ett.generatingColoring, htree] + simpa [n] using hstored + +theorem helper_hstar_5654.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi), + baseMinus.core = base.core → + ∀ (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hcountMinus : HMinus.dividerCount = C.hierarchy.dividerCount), + (∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HMinus.stage j.castSucc = + C.hierarchy.stage + (Fin.cast + (by + omega) + j).castSucc) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + let index : + Fin (HMinus.dividerCount + (1 : ℕ)) → Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + fun (j : Fin (HMinus.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + omega) + j; + index (0 : Fin (HMinus.dividerCount + (1 : ℕ))) = + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))) → + HierarchyStarredStage HMinus j = HierarchyStarredStage H (index j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex H + lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus baseMinus + hcoreMinus HMinus hcountMinus hstageMinus starredAt j index hz + obtain hj | ⟨i, rfl⟩ := Fin.eq_zero_or_eq_succ j + · subst j + simpa [hz, HierarchyStarredStage] using hcoreMinus + · have hi : (index i.succ).val ≠ 0 := by simp [index] + rw [starredAt (index i.succ) hi] + exact hstageMinus i.succ + +theorem helper_stageSegment_5688.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex H + lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus baseMinus + HMinus corrStar baseStar HStar transSegment + as_aux_lemma => + clear * - H transSegment + intro a d + induction d with + | zero => intro hb; exact ⟨le_rfl, by intro i; rfl, by intro i; rfl⟩ + | succ d ih => + intro hb + have hp := ih (by omega) + have hn := H.nested ⟨a + d, by omega⟩ + exact transSegment hp (by simpa [Nat.add_assoc] using hn) + +theorem helper_nextBound_5702.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + TreeSequenceInitialSegment A B → + (∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (i : Fin H.dividerCount), + (H.stage i.succ.castSucc).length ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex H q A + ell B lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus + baseMinus HMinus corrStar baseStar HStar starredAt hAB stageSegment i + as_aux_lemma => + have hqpos : 0 < H.dividerCount := by have := i.isLt; omega + have hqval : 0 < q.val := by simpa [q] using hqpos + have hA : A = H.stage q.castSucc := starredAt q (by + intro hz + exact (Nat.ne_of_gt hqval) hz) + have hs := stageSegment (i.val + 1) (H.dividerCount - (i.val + 1)) (by + have := i.isLt + omega) + have hlo : (⟨i.val + 1, by omega⟩ : Fin (H.dividerCount + 2)) = i.succ.castSucc := + Fin.ext rfl + have hhi : (⟨i.val + 1 + (H.dividerCount - (i.val + 1)), by omega⟩ : + Fin (H.dividerCount + 2)) = q.castSucc := by + apply Fin.ext + simp [q] + rw [hlo, hhi, ← hA] at hs + exact le_trans hs.1 hAB.1 + +theorem helper_edgesMinus_5721.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) R.minus → + R.minus.length = + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))).length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + ∀ (r : Fin R.minus.length), + (∃ (t : Fin T.length), + (↑t : ℕ) = (↑r : ℕ) ∧ (↑r : ℕ) < B.length ∧ R.minus.edge r = T.edge t) ∨ + (↑r : ℕ) = B.length ∧ R.minus.edge r = T.edge lastIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex ell B + Bplus lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus + baseMinus HMinus corrStar baseStar HStar hBL hPL hBT hBM hMinusLen hBMlen r + as_aux_lemma => + by_cases hr : r.val < B.length + · let i : Fin B.length := ⟨r.val, hr⟩ + have he : Fin.castLE hBM.1 i = r := Fin.ext rfl + have hprefix : TreeSequenceInitialSegment B R.minus := hBM + refine Or.inl ⟨Fin.castLE hBT.1 i, rfl, hr, ?_⟩ + rw [← he, hprefix.2.2 i, hBT.2.2 i] + · have he : r = Fin.cast hBMlen.symm (Fin.last B.length) := by + apply Fin.ext + simp + omega + exact Or.inr ⟨by have := r.isLt; omega, by rw [he]; exact R.minusFinal.2.2⟩ + +theorem helper_firstWitness_5737.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (X : TreeSequence G e0) + (c : Fin k), + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) < X.length → + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex + lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus baseMinus + HMinus corrStar baseStar HStar X c hc + let W := Finset.univ.filter fun i : Fin (X.length + 1) => + c ∈ MissingColors G phi (X.vertex i) + by_cases hw : W.Nonempty + · have he : HierarchyFirstMissingPosition phi X c = W.min' hw := by + simp only [HierarchyFirstMissingPosition, W, dite_eq_left hw] + rw [he] + exact (Finset.mem_filter.mp (Finset.min'_mem W hw)).2 + · have he : HierarchyFirstMissingPosition phi X c = Fin.last X.length := by + simp only [HierarchyFirstMissingPosition, W, dite_eq_right hw] + rw [he] at hc + simp only [Fin.val_last] at hc + omega + +theorem helper_terminalAvoid_5752.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail), + B.length + (2 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) R.minus → + R.minus.length = + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))).length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + R.minus.length + (1 : ℕ) = T.length → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) → + (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < (↑(HierarchyFirstMissingPosition phi X c) : ℕ) → + c ∉ MissingColors G phi (X.vertex i)) → + (∀ (X : TreeSequence G e0) (c : Fin k), + ∀ t ≤ X.length, + (∀ (i : Fin (X.length + (1 : ℕ))), + (↑i : ℕ) < t → c ∉ MissingColors G phi (X.vertex i)) → + t ≤ (↑(HierarchyFirstMissingPosition phi X c) : ℕ)) → + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∉ + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) T.length ∧ + phi (T.edge r) = some c} : + Finset (Fin k))) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + theta ∈ C.good.gamma q eta → + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) ≤ B.length) → + (∀ (r : Fin R.minus.length), + (∃ (t : Fin T.length), + (↑t : ℕ) = (↑r : ℕ) ∧ (↑r : ℕ) < B.length ∧ R.minus.edge r = T.edge t) ∨ + (↑r : ℕ) = B.length ∧ R.minus.edge r = T.edge lastIndex) → + (∀ (X : TreeSequence G e0) (c : Fin k), + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) < X.length → + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c))) → + ∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∈ + ({c : Fin k | + ∃ (r : Fin R.minus.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min (↑(HierarchyFirstMissingPosition phi R.minus eta) : ℕ) + R.minus.length ∧ + phi (R.minus.edge r) = some c} : + Finset (Fin k)) → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex H q A + ell B lastColor lastPosition penPosition endPosition thetaPresent tail R hBL hBT hBM + hMinusLen hBMlen hminusLen firstLe firstBefore firstLower oldAvoid thetaCutoff edgesMinus + firstWitness eta c hs hc hm + as_aux_lemma => + obtain ⟨_, r, hlo, hhi, hcol⟩ := Finset.mem_filter.mp hm + have hbeforeU : r.val < (HierarchyFirstMissingPosition phi R.minus eta).val := + lt_of_lt_of_le hhi (Nat.min_le_left _ _) + have hcommonAbsent : ∀ i : Fin (T.length + 1), i.val ≤ B.length → + i.val ≤ r.val → eta ∉ MissingColors G phi (T.vertex i) := by + intro i hi hir + let j : Fin (B.length + 1) := ⟨i.val, by omega⟩ + have hindex : i.val < (HierarchyFirstMissingPosition phi R.minus eta).val := by + omega + have hj := firstBefore R.minus eta + (Fin.castLE (Nat.succ_le_succ hBM.1) j) hindex + have hvertex : R.minus.vertex (Fin.castLE (Nat.succ_le_succ hBM.1) j) = + T.vertex i := by + calc + _ = B.vertex j := hBM.2.1 j + _ = T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) j) := hBT.2.1 j + _ = T.vertex i := by congr 1 + rw [hvertex] at hj + exact hj + rcases edgesMinus r with ⟨t, htr, htb, hedge⟩ | ⟨hr, hedge⟩ + · have hcut : t.val + 1 ≤ (HierarchyFirstMissingPosition phi T eta).val := + firstLower T eta (t.val + 1) (by have := t.isLt; omega) (by + intro i hi + exact hcommonAbsent i (by omega) (by omega)) + have hmem : c ∈ Finset.univ.filter (fun c => ∃ r : Fin T.length, + A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi T eta).val T.length ∧ + phi (T.edge r) = some c) := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, t, ?_, ?_, ?_⟩ + · have := t.isLt + omega + · have := t.isLt + omega + · rw [← hedge] + exact hcol + exact oldAvoid eta c hs hc hmem + · have hcTheta : c = theta := by + rw [hedge, lastColor] at hcol + exact (Option.some.inj hcol).symm + subst c + have hcut := thetaCutoff eta hs hc + have hposLT : (HierarchyFirstMissingPosition phi T eta).val < T.length := by + omega + have hmissingT := firstWitness T eta hposLT + let j : Fin (B.length + 1) := + ⟨(HierarchyFirstMissingPosition phi T eta).val, by omega⟩ + have hjT : Fin.castLE (Nat.succ_le_succ hBT.1) j = + HierarchyFirstMissingPosition phi T eta := Fin.ext rfl + have hmissingU : eta ∈ MissingColors G phi + (R.minus.vertex (Fin.castLE (Nat.succ_le_succ hBM.1) j)) := by + rw [hBM.2.1 j, ← hBT.2.1 j, hjT] + exact hmissingT + have hfirstU := firstLe R.minus eta _ hmissingU + have hindex := r.isLt + have : (HierarchyFirstMissingPosition phi R.minus eta).val ≤ B.length := by + change (HierarchyFirstMissingPosition phi R.minus eta).val ≤ j.val at hfirstU + have hjval : j.val = (HierarchyFirstMissingPosition phi T eta).val := rfl + omega + omega + +theorem helper_pathBound_5992.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus), + HierarchyPathNumber HMinus ≤ + R.minus.length - (HierarchyStarredStage HMinus (Fin.last HMinus.dividerCount)).length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex + lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus baseMinus HMinus + unfold HierarchyPathNumber + dsimp only + split + · exact (Finset.mem_Icc.mp (Finset.mem_filter.mp (Finset.min'_mem _ _)).1).2 + · exact le_rfl + +theorem helper_hverticesNe_6008.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus), + HMinus.dividerCount = C.hierarchy.dividerCount → + ∀ (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + B.length + (2 : ℕ) = T.length → + Bplus.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + R.minus.length = + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))).length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + ∀ vAlpha ∈ TreeSequenceVertexSet B, + alpha ∈ MissingColors G phi vAlpha → + vAlpha ∈ TreeSequenceVertexSet R.minus → + vAlpha ≠ T.vertex endIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex + ell B Bplus lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus + baseMinus HMinus hcountMinus corrStar baseStar HStar hBL hPL hBT hMinusLen hBMlen vAlpha + hvAlphaB hmissAlpha hvAlphaMinus he + obtain ⟨i, hi, rfl⟩ := + (@Finset.mem_image _ _ (Classical.decEq V)).mp hvAlphaB + have heIndex : Fin.castLE (Nat.succ_le_succ hBT.1) i = + endIndex := by + apply T.vertex_injective + exact (hBT.2.1 i).trans he + have hv := congrArg Fin.val heIndex + simp only [Fin.val_castLE] at hv + have hiB : i.val ≤ B.length := Nat.lt_succ_iff.mp i.isLt + have ht := endPosition + omega + +theorem helper_avoidance_6400.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hcountMinus : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (_ : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HierarchyStarredStage HMinus j = + HierarchyStarredStage H + (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j)) + (_ : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt HMinus j = + HierarchyStoredColorsAt H + (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j)) + (_ : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors HMinus j = + HierarchyStageMissingColors H + (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j)) + (_ : + ∀ (eta c : Fin k) (_ : eta ∈ HierarchyStoredColorsAt H q) + (_ : c ∈ C.good.gamma q eta) + (_ : + c ∈ + ({c : Fin k | + ∃ (r : Fin R.minus.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < + min (↑(HierarchyFirstMissingPosition phi R.minus eta) : ℕ) + R.minus.length ∧ + phi (R.minus.edge r) = some c} : + Finset (Fin k))), + False), + let index : + (j : Fin (HMinus.dividerCount + (1 : ℕ))) → Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (HMinus.dividerCount + (1 : ℕ))) ↦ + Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j; + ∀ (_ : index (Fin.last HMinus.dividerCount) = q) + (_ : + ∀ (i : Fin HMinus.dividerCount) (eta : Fin k), + HierarchySegmentColors HMinus i.castSucc eta = + HierarchySegmentColors H (index i.castSucc) eta) + (j : Fin (HMinus.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt HMinus j, + C.good.gamma (index j) eta ⊆ + HierarchyStageMissingColors HMinus j \ HierarchySegmentColors HMinus j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex H q A + lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus baseMinus + HMinus hcountMinus corrStar baseStar HStar hcountStar starredEq storedEq missingEq + terminalAvoid index indexLast segmentEq j eta hmem c hc + have holdMem : eta ∈ HierarchyStoredColorsAt H (index j) := by + rw [← storedEq j] + exact hmem + have hold := Finset.mem_sdiff.mp (C.good.avoidance (index j) eta holdMem hc) + refine Finset.mem_sdiff.mpr ⟨(missingEq j).symm ▸ hold.1, ?_⟩ + intro hseg + by_cases hj : j.val < HMinus.dividerCount + · let i : Fin HMinus.dividerCount := ⟨j.val, hj⟩ + have hij : i.castSucc = j := Fin.ext rfl + have hOldSeg : c ∈ HierarchySegmentColors H (index j) eta := by + have hnew : c ∈ HierarchySegmentColors HMinus i.castSucc eta := by + simpa [hij] using hseg + have hEq := segmentEq i eta + have hindex : index j = index i.castSucc := by + apply Fin.ext + simp [hij] + have hmem : c ∈ HierarchySegmentColors H (index i.castSucc) eta := by + rw [← hEq] + exact hnew + simpa [hindex] using hmem + exact hold.2 hOldSeg + · have hjlast : j = Fin.last HMinus.dividerCount := by + apply Fin.ext + simp only [Fin.val_last] + omega + subst j + have havo := terminalAvoid eta c + (by simpa [index, indexLast] using holdMem) + (by simpa [index, indexLast] using hc) + (by + unfold HierarchySegmentColors at hseg + dsimp only at hseg + have hend : HMinus.stage (Fin.last HMinus.dividerCount).succ = R.minus := by + convert HMinus.terminalStage using 1 + congr 1 + have hlastIndex : + Fin.cast (congrArg (fun d => d + 1) hcountMinus) + (Fin.last HMinus.dividerCount) = q := by + change index (Fin.last HMinus.dividerCount) = q + exact indexLast + rw [hend, starredEq (Fin.last HMinus.dividerCount)] at hseg + simpa [index, indexLast] using hseg) + exact havo.elim + +theorem helper_uniqueRefresh_6451.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (lastColor : phi (T.edge lastIndex) = some theta) + (lastPosition : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (penPosition : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (endPosition : (↑endIndex : ℕ) = T.length) + (thetaPresent : theta ∉ MissingColors G phi (T.vertex penIndex)), + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo, pathNumberFull := D.pathNumberFull, + lastEdgeIndex := lastIndex, penultimateVertexIndex := penIndex, + terminalVertexIndex := endIndex, lastEdgePosition := lastPosition, + penultimateVertexPosition := penPosition, terminalVertexPosition := endPosition, + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate, theta := theta, + thetaOnLastEdge := lastColor, thetaPresentPenultimate := thetaPresent : + HierarchySituationTwoTailData G k e0 input T phi ett base C ctx }; + ∀ (R : HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx tail) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hcountMinus : HMinus.dividerCount = C.hierarchy.dividerCount) + (_ : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HMinus.stage j.castSucc = + H.stage + (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j).castSucc) + (_ : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HierarchyStarredStage HMinus j = + HierarchyStarredStage H + (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j)) + (_ : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt HMinus j = + HierarchyStoredColorsAt H + (Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j)), + let index : + (j : Fin (HMinus.dividerCount + (1 : ℕ))) → Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (HMinus.dividerCount + (1 : ℕ))) ↦ + Fin.cast (congrArg (fun (d : ℕ) ↦ d + (1 : ℕ)) hcountMinus) j; + ∀ (i : Fin HMinus.dividerCount), + ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt HMinus i.succ ∧ + (C.good.gamma (index i.succ) eta ⊆ + (TreeSequenceVertexSet (HMinus.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HMinus i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt HMinus i.succ, + theta ≠ eta → + C.good.gamma (index i.succ) theta = C.good.gamma (index i.castSucc) theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D theta lastIndex penIndex endIndex H + lastColor lastPosition penPosition endPosition thetaPresent tail R corrMinus baseMinus + HMinus hcountMinus stageEq starredEq storedEq index i + have hcount : HMinus.dividerCount = H.dividerCount := hcountMinus + let io : Fin H.dividerCount := ⟨i.val, by simpa [hcount] using i.isLt⟩ + have hnext : io.succ = index i.succ := Fin.ext rfl + have hprev : io.castSucc = index i.castSucc := Fin.ext rfl + have hnextFin : Fin.cast (congrArg (fun d => d + 1) hcountMinus) i.succ = io.succ := + Fin.ext rfl + have hprevFin : Fin.cast (congrArg (fun d => + d + 1) hcountMinus) i.castSucc = io.castSucc := + Fin.ext rfl + have hnextIdx : index i.succ = io.succ := by simpa [index] using hnextFin + have hprevIdx : index i.castSucc = io.castSucc := by simpa [index] using hprevFin + obtain ⟨chosen, hchosen, hunique⟩ := C.good.uniqueRefresh io + refine ⟨chosen, ?_, ?_⟩ + · rcases hchosen with ⟨hs, hlocal, hstable⟩ + refine ⟨?_, ?_, ?_⟩ + · rw [storedEq i.succ, hnextFin] + exact hs + · rw [stageEq i.succ, starredEq i.castSucc, hnextFin, hprevFin] + exact hlocal + · intro theta htheta hne + have hthetaOld := htheta + rw [storedEq i.succ] at hthetaOld + rw [hnextFin] at hthetaOld + exact hstable theta hthetaOld hne + · intro eta heta + have hetaOld : eta ∈ HierarchyStoredColorsAt H io.succ := by + have hh := heta.1 + rw [storedEq i.succ] at hh + rw [hnextFin] at hh + exact hh + have hlocalOld : C.good.gamma io.succ eta ⊆ + (TreeSequenceVertexSet (H.stage io.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H io.castSucc)).biUnion + fun v => MissingColors G phi v := by + have hh := heta.2.1 + rw [stageEq i.succ, starredEq i.castSucc, hnextFin, hprevFin] at hh + exact hh + have hstableOld : ∀ theta ∈ HierarchyStoredColorsAt H io.succ, + theta ≠ eta → C.good.gamma io.succ theta = C.good.gamma io.castSucc theta := by + intro theta htheta hne + have hthetaNew : theta ∈ HierarchyStoredColorsAt HMinus i.succ := by + have hh : theta ∈ HierarchyStoredColorsAt H (index i.succ) := by + rw [hnextIdx] + exact htheta + rw [storedEq i.succ] + exact hh + have hh := heta.2.2 theta hthetaNew hne + simpa [hnextIdx, hprevIdx] using hh + apply hunique eta ⟨hetaOld, hlocalOld, hstableOld⟩ + +theorem helper_continuation_6530.{u_1, u_2} : + helperContinuation6530Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex H + q A ell B Bplus n Tn lastColor alphaTerminal alphaBefore lastPosition penPosition + endPosition thetaPresent tail R corrMinus maxMinus baseMinus hcoreMinus hclosureMinus + HMinus hcountMinus hstageMinus hpositionMinus corrStar baseStar HStar hcountStar + transSegment starredAt hBL hPL hBT hAB hBM hMinusLen hBMlen hminusLen vertexMem firstLe + firstBefore firstLower oldAvoid thetaCutoff terminalData hierarchyInfo stageEq + have starredEq (j : Fin (HMinus.dividerCount + 1)) : + HierarchyStarredStage HMinus j = HierarchyStarredStage H + (Fin.cast (congrArg (fun d => d + 1) hcountMinus) j) := + (hierarchyInfo j).1 + have storedEq (j : Fin (HMinus.dividerCount + 1)) : + HierarchyStoredColorsAt HMinus j = HierarchyStoredColorsAt H + (Fin.cast (congrArg (fun d => d + 1) hcountMinus) j) := + (hierarchyInfo j).2.1 + have missingEq (j : Fin (HMinus.dividerCount + 1)) : + HierarchyStageMissingColors HMinus j = HierarchyStageMissingColors H + (Fin.cast (congrArg (fun d => d + 1) hcountMinus) j) := + (hierarchyInfo j).2.2 + have stageSegment : ∀ a d : ℕ, + ∀ hb : a + d ≤ H.dividerCount + 1, + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + exact @helper_stageSegment_5688 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@transSegment) + have nextBound (i : Fin H.dividerCount) : + (H.stage i.succ.castSucc).length ≤ B.length := by + exact helper_nextBound_5702 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@starredAt) (@hAB) + (@stageSegment) (@i) + have edgesMinus (r : Fin R.minus.length) : + (∃ t : Fin T.length, t.val = r.val ∧ r.val < B.length ∧ + R.minus.edge r = T.edge t) ∨ + (r.val = B.length ∧ R.minus.edge r = T.edge lastIndex) := by + exact helper_edgesMinus_5721 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@hBL) (@hPL) (@hBT) + (@hBM) (@hMinusLen) (@hBMlen) (@r) + have firstWitness (X : TreeSequence G e0) (c : Fin k) + (hc : (HierarchyFirstMissingPosition phi X c).val < X.length) : + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by + exact helper_firstWitness_5737 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@X) (@c) (@hc) + have terminalAvoid (eta c : Fin k) (hs : eta ∈ HierarchyStoredColorsAt H q) + (hc : c ∈ C.good.gamma q eta) + (hm : c ∈ Finset.univ.filter (fun c => ∃ r : Fin R.minus.length, + A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi R.minus eta).val R.minus.length ∧ + phi (R.minus.edge r) = some c)) : False := by + exact helper_terminalAvoid_5752 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) (@hBL) + (@hBT) (@hBM) (@hMinusLen) (@hBMlen) (@hminusLen) (@firstLe) (@firstBefore) (@firstLower) + (@oldAvoid) (@thetaCutoff) (@edgesMinus) (@firstWitness) (@eta) (@c) (@hs) (@hc) (@hm) + let index (j : Fin (HMinus.dividerCount + 1)) : Fin (H.dividerCount + 1) := + Fin.cast (congrArg (fun d => d + 1) hcountMinus) j + have indexZero : index 0 = 0 := Fin.ext rfl + have indexLast : index (Fin.last HMinus.dividerCount) = q := by + apply Fin.ext + simp [index, q] + have segmentEq (i : Fin HMinus.dividerCount) (eta : Fin k) : + HierarchySegmentColors HMinus i.castSucc eta = + HierarchySegmentColors H (index i.castSucc) eta := by + as_aux_lemma => + let io : Fin H.dividerCount := ⟨i.val, by + have hi := i.isLt + change HMinus.dividerCount = H.dividerCount at hcountMinus + omega⟩ + have hnext : Fin.cast (congrArg (fun d => d + 1) hcountMinus) i.succ = io.succ := + Fin.ext rfl + have hprev : Fin.cast (congrArg (fun d => d + 1) hcountMinus) i.castSucc = io.castSucc := + Fin.ext rfl + have hnextIdx : index i.succ = io.succ := by simpa [index] using hnext + have hprevIdx : index i.castSucc = io.castSucc := by simpa [index] using hprev + have hcutOld := HierarchyFirstMissingPositionPrefixCutoff phi B T hBT eta + (H.stage io.succ.castSucc).length (nextBound io) + have hcutNew := HierarchyFirstMissingPositionPrefixCutoff phi B R.minus hBM eta + (H.stage io.succ.castSucc).length (nextBound io) + have hi : i.castSucc.succ = i.succ.castSucc := Fin.ext rfl + have hio : io.castSucc.succ = io.succ.castSucc := Fin.ext rfl + unfold HierarchySegmentColors + dsimp only + rw [hi, stageEq i.succ, starredEq i.castSucc, hnext, hprev, hprevIdx, hio, + ← hcutNew, hcutOld] + let goodMinus : GoodHierarchy HMinus := by + exact { + gamma := fun j eta => C.good.gamma (index j) eta + twoColors := by + intro j eta hmem + apply C.good.twoColors (index j) eta + rw [← storedEq j] + exact hmem + avoidance := by + exact helper_avoidance_6400 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@hcountMinus) (@corrStar) (@baseStar) (@HStar) + (@hcountStar) (@starredEq) (@storedEq) (@missingEq) (@terminalAvoid) (@indexLast) + (@segmentEq) + disjointPairs := by + intro j eta theta h₁ h₂ hne + apply C.good.disjointPairs (index j) eta theta + · rw [← storedEq j]; exact h₁ + · rw [← storedEq j]; exact h₂ + · exact hne + uniqueRefresh := by + exact helper_uniqueRefresh_6451 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@hcountMinus) (@stageEq) (@starredEq) (@storedEq) + parallelBase := by + dsimp only + intro hpe + have hpeOld : ett.series.data.kind n = some TashkinovExtensionKind.PE := + terminalData.2.1.symm.trans hpe + have hold := C.good.parallelBase hpeOld + rw [hcoreMinus, hclosureMinus, terminalData.1, storedEq 0] + simpa [indexZero] using hold + minusClosed := by + intro i + have hcount : HMinus.dividerCount = H.dividerCount := hcountMinus + let io : Fin H.dividerCount := ⟨i.val, by simpa [hcount] using i.isLt⟩ + have hnext : io.succ = index i.succ := Fin.ext rfl + have hprev : io.castSucc = index i.castSucc := Fin.ext rfl + have hnextFin : Fin.cast (congrArg (fun d => d + 1) hcountMinus) i.succ = io.succ := + Fin.ext rfl + have hprevFin : Fin.cast (congrArg (fun d => + d + 1) hcountMinus) i.castSucc = io.castSucc := + Fin.ext rfl + have hprevIdx : index i.castSucc = io.castSucc := by simpa [index] using hprevFin + have hold := C.good.minusClosed io + rw [stageEq i.succ, storedEq i.succ] + rw [hnextFin, hprevIdx] + exact hold } + have lastMinus : + HierarchyStarredStage HMinus (Fin.last HMinus.dividerCount) = A := by + calc + HierarchyStarredStage HMinus (Fin.last HMinus.dividerCount) = + HierarchyStarredStage H (index (Fin.last HMinus.dividerCount)) := + starredEq _ + _ = A := by simpa [A] using congrArg (HierarchyStarredStage H) indexLast + have pathBound : HierarchyPathNumber HMinus ≤ + R.minus.length - (HierarchyStarredStage HMinus + (Fin.last HMinus.dividerCount)).length := by + exact helper_pathBound_5992 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@baseMinus) (@HMinus) + obtain ⟨vAlpha, hvAlphaB, hmissAlpha⟩ := + Finset.mem_biUnion.mp alphaBefore + have hvAlphaMinus : vAlpha ∈ TreeSequenceVertexSet R.minus := + TreeSequenceInitialSegmentVertexSetSubset hBM hvAlphaB + have hterminalMinus : T.vertex endIndex ∈ + TreeSequenceVertexSet R.minus := by + rw [← R.minusTerminalVertex] + exact vertexMem R.minus (Fin.last R.minus.length) + have hverticesNe : vAlpha ≠ T.vertex endIndex := by + exact helper_hverticesNe_6008 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@hcountMinus) (@corrStar) (@baseStar) (@HStar) + (@hBL) (@hPL) (@hBT) (@hMinusLen) (@hBMlen) (@vAlpha) (@hvAlphaB) (@hmissAlpha) + (@hvAlphaMinus) + have hnotElementary : + ¬ ColoredVertexSetElementary G phi (TreeSequenceVertexSet R.minus) := by + intro helem + have hdis := helem hvAlphaMinus hterminalMinus hverticesNe + exact Finset.disjoint_left.mp hdis hmissAlpha alphaTerminal + let CMinus : HierarchyCounterexample baseMinus := by + exact { + positive := by rw [corrMinus.rungAgreement]; exact C.positive + hierarchy := HMinus + good := goodMinus + maximum := maxMinus + notElementary := hnotElementary } + have hpathLess : HierarchyPathNumber HMinus < HierarchyPathNumber H := by + rw [D.pathNumberFull] + rw [lastMinus] at pathBound + change HierarchyPathNumber HMinus < T.length - A.length + have hlen : R.minus.length + 1 = T.length := by omega + have hAlen : A.length ≤ R.minus.length := le_trans hAB.1 hBM.1 + omega + have hmeasureLess : HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure CMinus) + (HierarchyCounterexampleMeasure C) := Or.inl hpathLess + exact (ctx.lexicographicMinimality CMinus corrMinus.rungAgreement hcountMinus) + hmeasureLess + +theorem helper_h_exception_6390.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeOneData G k e0 input T phi ett base C ctx), + let alpha : Fin k := D.alpha; + let theta : Fin k := D.theta; + let lastIndex : Fin T.length := D.lastEdgeIndex; + let penIndex : Fin (T.length + (1 : ℕ)) := D.penultimateVertexIndex; + let endIndex : Fin (T.length + (1 : ℕ)) := D.terminalVertexIndex; + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let _ : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : phi (T.edge lastIndex) = some theta) + (_ : alpha ∈ MissingColors G phi (T.vertex endIndex)) + (_ : alpha ∈ TreeMissingColors phi B) + (_ : (↑lastIndex : ℕ) + (1 : ℕ) = T.length) + (_ : (↑penIndex : ℕ) + (1 : ℕ) = T.length) + (_ : (↑endIndex : ℕ) = T.length) + (_ : theta ∉ MissingColors G phi (T.vertex penIndex)), + ∃ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex penIndex) ∧ theta ∈ C.good.gamma q eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D alpha theta lastIndex penIndex endIndex H + q A ell B Bplus n Tn lastColor alphaTerminal alphaBefore lastPosition penPosition + endPosition thetaPresent + as_aux_lemma => + let tail : HierarchySituationTwoTailData G k e0 input T phi ett base C ctx := + { tailAtLeastTwo := D.tailAtLeastTwo + pathNumberFull := D.pathNumberFull + lastEdgeIndex := lastIndex + penultimateVertexIndex := penIndex + terminalVertexIndex := endIndex + lastEdgePosition := lastPosition + penultimateVertexPosition := penPosition + terminalVertexPosition := endPosition + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate + theta := theta + thetaOnLastEdge := lastColor + thetaPresentPenultimate := thetaPresent } + obtain ⟨R, hboundaryPE, hrouteMinus, hrouteStar, corrMinus, maxMinus, + baseMinus, hcoreMinus, hclosureMinus, hsupportMinus, HMinus, hcountMinus, + hstageMinus, hpositionMinus, corrStar, maxStar, baseStar, hcoreStar, + hclosureStar, hsupportStar, HStar, hcountStar, hstageStar, hpositionStar⟩ := + HierarchySituationTwoReorderedTreesCertified G k e0 input T phi ett base C ctx tail + by_contra hnone + have hnone' : ∀ eta, eta ∈ HierarchyStoredColorsAt H q → + eta ∈ MissingColors G phi (T.vertex penIndex) → + theta ∉ C.good.gamma q eta := by + intro eta hs hm hgamma + exact hnone ⟨eta, hs, hm, hgamma⟩ + have transSegment {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + exact helper_transSegment_333 (@G) (@e0) (@hXY) (@hYZ) + have restrictSegment {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + exact helper_restrictSegment_343 (@G) (@e0) (@hXZ) (@hYZ) (@hXY) + have starredAt (j : Fin (H.dividerCount + 1)) (hj : j.val ≠ 0) : + HierarchyStarredStage H j = H.stage j.castSucc := by + as_aux_lemma => + obtain hz | ⟨i, rfl⟩ := Fin.eq_zero_or_eq_succ j + · exact False.elim (hj (congrArg Fin.val hz)) + · rfl + have hAT : TreeSequenceInitialSegment A T := by + exact helper_hAT_359 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@starredAt) + have htail : 2 ≤ ell := D.tailAtLeastTwo + have hell : ell = T.length - A.length := rfl + have hBL : B.length + 2 = T.length := by + simp only [B, HierarchyFullTailPrefix, TreeSequencePrefix] + change min (A.length + (T.length - A.length - 2)) T.length + 2 = T.length + omega + have hPL : Bplus.length + 1 = T.length := by + simp only [Bplus, HierarchyFullTailPrefix, TreeSequencePrefix] + change min (A.length + (T.length - A.length - 1)) T.length + 1 = T.length + omega + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, by intro i; rfl, by intro i; rfl⟩ + have hBplusT : TreeSequenceInitialSegment Bplus T := + ⟨Nat.min_le_right _ _, by intro i; rfl, by intro i; rfl⟩ + have hAB : TreeSequenceInitialSegment A B := restrictSegment hAT hBT (by omega) + have hBBplus : TreeSequenceInitialSegment B Bplus := + restrictSegment hBT hBplusT (by omega) + have hBM := R.minusFinal.2.1 + have hMinusLen := R.minusFinal.1 + have hBMlen : R.minus.length = B.length + 1 := by omega + have hBM' : TreeSequenceInitialSegment B R.minus := hBM + have hBS := transSegment hBM' R.starFinal.2.1 + have hminusLen : R.minus.length + 1 = T.length := by omega + have hPE : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have vertexMem (X : TreeSequence G e0) (i : Fin (X.length + 1)) : + X.vertex i ∈ TreeSequenceVertexSet X := by + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, Finset.mem_univ _, rfl⟩ + have firstLe (X : TreeSequence G e0) (c : Fin k) + (i : Fin (X.length + 1)) (hi : c ∈ MissingColors G phi (X.vertex i)) : + (HierarchyFirstMissingPosition phi X c).val ≤ i.val := by + exact helper_firstLe_400 (@G) (@k) (@e0) (@phi) (@X) (@c) (@i) (@hi) + have firstMissing (X : TreeSequence G e0) (c : Fin k) + (hc : c ∈ TreeMissingColors phi X) : + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by + exact helper_firstMissing_411 (@G) (@k) (@e0) (@phi) (@X) (@c) (@hc) + have firstBefore (X : TreeSequence G e0) (c : Fin k) + (i : Fin (X.length + 1)) + (hi : i.val < (HierarchyFirstMissingPosition phi X c).val) : + c ∉ MissingColors G phi (X.vertex i) := by + as_aux_lemma => + intro hm + have := firstLe X c i hm + omega + have firstLower (X : TreeSequence G e0) (c : Fin k) (t : ℕ) + (ht : t ≤ X.length) + (hn : ∀ i : Fin (X.length + 1), i.val < t → + c ∉ MissingColors G phi (X.vertex i)) : + t ≤ (HierarchyFirstMissingPosition phi X c).val := by + exact helper_firstLower_5578 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@vertexMem) + (@firstMissing) (@X) (@c) (@t) (@ht) (@hn) + have oldAvoid (eta c : Fin k) (hs : eta ∈ HierarchyStoredColorsAt H q) + (hc : c ∈ C.good.gamma q eta) : + c ∉ Finset.univ.filter (fun c => ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < min (HierarchyFirstMissingPosition phi T eta).val T.length ∧ + phi (T.edge r) = some c) := by + exact helper_oldAvoid_453 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@eta) (@c) + (@hs) (@hc) + have thetaCutoff (eta : Fin k) (hs : eta ∈ HierarchyStoredColorsAt H q) + (hc : theta ∈ C.good.gamma q eta) : + (HierarchyFirstMissingPosition phi T eta).val ≤ B.length := by + exact helper_thetaCutoff_466 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@hnone') (@htail) (@hell) (@hBL) + (@vertexMem) (@firstMissing) (@oldAvoid) (@eta) (@hs) (@hc) + have terminalData : + corrMinus.replacementETT.series.data.tree + (Fin.last corrMinus.replacementETT.rounds).castSucc = Tn ∧ + corrMinus.replacementETT.series.data.kind + (Fin.last corrMinus.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrMinus.replacementETT.series.data + (Fin.last corrMinus.replacementETT.rounds) = + TashkinovStoredColors ett.series.data n := by + exact helper_terminalData_5614 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@maxMinus) (@baseMinus) (@hcoreMinus) (@hclosureMinus) (@hsupportMinus) + (@HMinus) (@hcountMinus) (@hstageMinus) (@hpositionMinus) (@corrStar) (@baseStar) (@HStar) + have hierarchyInfo : ∀ j : Fin (HMinus.dividerCount + 1), + let jo := Fin.cast (congrArg (fun d => d + 1) hcountMinus) j + HierarchyStarredStage HMinus j = HierarchyStarredStage H jo ∧ + HierarchyStoredColorsAt HMinus j = HierarchyStoredColorsAt H jo ∧ + HierarchyStageMissingColors HMinus j = HierarchyStageMissingColors H jo := by + intro j + let index := fun j : Fin (HMinus.dividerCount + 1) => + Fin.cast (congrArg (fun d => d + 1) hcountMinus) j + have hz : index 0 = 0 := Fin.ext rfl + have hstar : HierarchyStarredStage HMinus j = HierarchyStarredStage H (index j) := by + exact helper_hstar_5654 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@lastColor) (@lastPosition) (@penPosition) (@endPosition) (@thetaPresent) (@R) + (@corrMinus) (@baseMinus) (@hcoreMinus) (@HMinus) (@hcountMinus) (@hstageMinus) + (@starredAt) (@j) (@hz) + refine ⟨hstar, ?_, ?_⟩ + · unfold HierarchyStoredColorsAt + dsimp only + rw [terminalData.2.2, hstar] + · obtain hj | ⟨i, rfl⟩ := Fin.eq_zero_or_eq_succ j + · subst j + simp [HierarchyStageMissingColors, Tn, n, terminalData.1] + · have hcount : HMinus.dividerCount = H.dividerCount := hcountMinus + let io : Fin H.dividerCount := ⟨i.val, by rw [← hcount]; exact i.isLt⟩ + have hi : index i.succ = io.succ := Fin.ext rfl + simp only [HierarchyStageMissingColors, Fin.cases_succ] + exact congrArg (TreeMissingColors phi) (hstageMinus i.succ) + have stageEq (j : Fin (HMinus.dividerCount + 1)) : + HMinus.stage j.castSucc = H.stage + (Fin.cast (congrArg (fun d => d + 1) hcountMinus) j).castSucc := hstageMinus j + exact @helper_continuation_6530 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@lastColor) (@alphaTerminal) (@alphaBefore) (@lastPosition) (@penPosition) + (@endPosition) (@thetaPresent) (@R) (@corrMinus) (@maxMinus) (@baseMinus) (@hcoreMinus) + (@hclosureMinus) (@HMinus) (@hcountMinus) (@hstageMinus) (@hpositionMinus) (@corrStar) + (@baseStar) (@HStar) (@hcountStar) (@transSegment) (@starredAt) (@hBL) (@hPL) (@hBT) + (@hAB) (@hBM) (@hMinusLen) (@hBMlen) (@hminusLen) (@vertexMem) (@firstLe) (@firstBefore) + (@firstLower) (@oldAvoid) (@thetaCutoff) (@terminalData) (@hierarchyInfo) (@stageEq) + +end GoldbergSeymour.HierarchySituationTwoSubcaseThreeOnePreparation + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean new file mode 100644 index 0000000000..8313a40213 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean @@ -0,0 +1,4623 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalizedData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCaseThree +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute + +/-! +# Hierarchy Situation Two Subcase Three Two + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperRecolor1219Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + TreeSequenceInitialSegment B T → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet B → + v ∈ TreeSequenceVertexSet B → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c) → + ∀ + (seriesFacts : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j) ∧ + IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { + replacementInput := input, replacementSeries := ett.series, + replacementETT := ett, rungAgreement := rfl, seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (x : Fin ett.rounds) ↦ rfl, + storedColorsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + connectingEdgesAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + extensionKindsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + replacementProper := fun (j : Fin (ett.rounds + (1 : ℕ))) ↦ + (seriesFacts j).left, + replacementOneUncolored := fun (j : Fin (ett.rounds + (1 : ℕ))) ↦ + (seriesFacts j).right, + replacementStable := fun (x : Fin ett.rounds) ↦ + (⟨fun (x_1 : E) + (_ : TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) x_1) + (_ : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ x_1 = some c) ↦ + rfl, + fun (x_1 : V) + (_ : x_1 ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc)) ↦ + rfl⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ f = some c) → + ett.series.data.coloring x.succ f = ett.series.data.coloring x.succ f) ∧ + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc), + MissingColors G (ett.series.data.coloring x.succ) v = + MissingColors G (ett.series.data.coloring x.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + let _ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { + coloring := phi, corresponding := corrRefl, maximum := C.maximum, + replacementBase := base, counterexample := C, + sameGood := + (⟨(⟨rfl, + (⟨by + have := GoldbergSeymour.TreeSequence.positive T + omega, + (⟨HEq.rfl, + (⟨HEq.rfl, + (⟨Iff.rfl, + fun + (_ : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) ↦ + rfl⟩ : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + base.core = base.core ∧ + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure)), + Exists.intro + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + fun (x : Fin (C.hierarchy.dividerCount + (1 : ℕ))) ↦ + (⟨rfl, + fun (x_1 : Fin k) (_ : x_1 ∈ HierarchyStoredColorsAt C.hierarchy x) ↦ + rfl⟩ : + HierarchyStoredColorsAt C.hierarchy x = + HierarchyStoredColorsAt C.hierarchy + (Fin.cast + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + corrRefl + have := GoldbergSeymour.TreeSequence.positive T + omega) + x) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy x, + C.good.gamma x eta = + C.good.gamma + (Fin.cast + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + corrRefl + have := GoldbergSeymour.TreeSequence.positive T + omega) + x) + eta)⟩ : + SameHierarchyStages C.hierarchy C.hierarchy ∧ + ∃ (_ : C.hierarchy.dividerCount = C.hierarchy.dividerCount), + ∀ (j : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + have j₂ : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.cast + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + corrRefl + have := GoldbergSeymour.TreeSequence.positive T + omega) + j; + HierarchyStoredColorsAt C.hierarchy j = + HierarchyStoredColorsAt C.hierarchy j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy j, + C.good.gamma j eta = C.good.gamma j₂ eta), + minimumContext := ctx : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx }; + ∀ beta ∈ TreeMissingColors phi A, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + beta ≠ D.alpha → + (H.dividerCount = (0 : ℕ) → + beta ∈ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G P.coloring v = MissingColors G phi v) ∧ + beta ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) = phi (T.edge t) + +private abbrev helperBranch1440Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ + (seriesFacts : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j) ∧ + IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { + replacementInput := input, replacementSeries := ett.series, replacementETT := ett, + rungAgreement := rfl, seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (x : Fin ett.rounds) ↦ rfl, + storedColorsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + connectingEdgesAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + extensionKindsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + replacementProper := fun (j : Fin (ett.rounds + (1 : ℕ))) ↦ (seriesFacts j).left, + replacementOneUncolored := fun (j : Fin (ett.rounds + (1 : ℕ))) ↦ (seriesFacts j).right, + replacementStable := fun (x : Fin ett.rounds) ↦ + (⟨fun (x_1 : E) (_ : TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) x_1) + (_ : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ x_1 = some c) ↦ + rfl, + fun (x_1 : V) (_ : x_1 ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc)) ↦ + rfl⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ f = some c) → + ett.series.data.coloring x.succ f = ett.series.data.coloring x.succ f) ∧ + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc), + MissingColors G (ett.series.data.coloring x.succ) v = + MissingColors G (ett.series.data.coloring x.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + let _ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { + coloring := phi, corresponding := corrRefl, maximum := C.maximum, replacementBase := base, + counterexample := C, + sameGood := + (⟨(⟨rfl, + (⟨by + have := GoldbergSeymour.TreeSequence.positive T + omega, + (⟨HEq.rfl, + (⟨HEq.rfl, + (⟨Iff.rfl, + fun + (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) ↦ + rfl⟩ : + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + base.core = base.core ∧ + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure)), + Exists.intro + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + fun (x : Fin (C.hierarchy.dividerCount + (1 : ℕ))) ↦ + (⟨rfl, fun (x_1 : Fin k) (_ : x_1 ∈ HierarchyStoredColorsAt C.hierarchy x) ↦ rfl⟩ : + HierarchyStoredColorsAt C.hierarchy x = + HierarchyStoredColorsAt C.hierarchy + (Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corrRefl + have := GoldbergSeymour.TreeSequence.positive T + omega) + x) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy x, + C.good.gamma x eta = + C.good.gamma + (Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corrRefl + have := GoldbergSeymour.TreeSequence.positive T + omega) + x) + eta)⟩ : + SameHierarchyStages C.hierarchy C.hierarchy ∧ + ∃ (_ : C.hierarchy.dividerCount = C.hierarchy.dividerCount), + ∀ (j : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + have j₂ : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corrRefl + have := GoldbergSeymour.TreeSequence.positive T + omega) + j; + HierarchyStoredColorsAt C.hierarchy j = HierarchyStoredColorsAt C.hierarchy j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy j, + C.good.gamma j eta = C.good.gamma j₂ eta), + minimumContext := ctx : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx }; + (∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G POne.coloring v = MissingColors G phi v) → + beta ∈ MissingColors G POne.coloring (T.vertex D.terminalVertexIndex) → + POne.coloring (T.edge D.lastEdgeIndex) = some D.theta → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → POne.coloring (T.edge t) = phi (T.edge t)) → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → POne.coloring (T.edge t) ≠ some beta) → + (POne.counterexample.hierarchy.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors POne.coloring A → + beta ∈ + TreeMissingColors POne.coloring + (POne.corresponding.replacementETT.series.data.tree + (Fin.last POne.corresponding.replacementETT.rounds).castSucc) ∨ + beta ∉ + TashkinovStoredColors POne.corresponding.replacementETT.series.data + (Fin.last POne.corresponding.replacementETT.rounds) ∧ + D.theta ∉ + TashkinovStoredColors POne.corresponding.replacementETT.series.data + (Fin.last POne.corresponding.replacementETT.rounds)) → + False) → + (∀ (eta beta : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + beta ∈ C.good.gamma q eta → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort → False) → + D.theta ∉ HierarchyStoredColorsAt H q → + False + +private abbrev helperBranch2793Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → + (∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) + (base' : HierarchyBase ett' rho) (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho + sigma) → + (∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) + (base' : HierarchyBase ett' old) (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t)) → + ∀ (beta : Fin k) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → POne.coloring (T.edge t) = phi (T.edge t)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := + HierarchyFirstMissingPosition phi T beta; + T.vertex ib ∈ TreeSequenceVertexSet B → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T + POne.coloring := + POne.corresponding.replacementETT; + let _ : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := + POne.counterexample; + let _ : + HierarchyMinimumCounterexampleContext G k e0 + POne.corresponding.replacementInput T POne.coloring + POne.corresponding.replacementETT POne.replacementBase + POne.counterexample := + POne.minimumContext; + let HOne : + TashkinovHierarchy POne.corresponding.replacementETT + POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := + Fin.last HOne.dividerCount; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + (beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) ∨ + beta ∈ TreeMissingColors rho A ∧ + beta ∉ + TashkinovStoredColors ettOne.series.data + (Fin.last ettOne.rounds) ∧ + D.theta ∉ + TashkinovStoredColors ettOne.series.data + (Fin.last ettOne.rounds))) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + Disjoint + (TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib))) → + let muTwo : PartialEdgeColoring E k := + TwoColorComponentSwap G rho beta D.theta z; + TwoColorPathComponent G rho beta D.theta z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho beta D.theta z) + w = + MissingColors G rho w) → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = + HierarchyFirstMissingPosition rho T c) → + TashkinovAugmentationSequence rho B T → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + beta ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c → + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ + B.length) → + beta ∈ TreeMissingColors phi A → + ∃ (corrTwo : + CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), + MaximumProperty corrTwo.replacementETT ∧ + ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) + (KTwo : + TashkinovHierarchy corrTwo.replacementETT baseTwo) + (goodTwo : GoodHierarchy KTwo), + SameGoodHierarchy COne'.good goodTwo + +private abbrev helperContinuation3031Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet + (Sum.inl v)).Subsingleton) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet B → + v ∈ TreeSequenceVertexSet B → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = + HierarchyFirstMissingPosition rho T c) → + ∀ + (seriesFacts : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j) ∧ + IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { + replacementInput := input, replacementSeries := ett.series, + replacementETT := ett, rungAgreement := rfl, + seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (x : Fin ett.rounds) ↦ rfl, + storedColorsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + connectingEdgesAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + extensionKindsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + replacementProper := fun (j : Fin (ett.rounds + (1 : ℕ))) ↦ + (seriesFacts j).left, + replacementOneUncolored := fun (j : Fin (ett.rounds + (1 : ℕ))) ↦ + (seriesFacts j).right, + replacementStable := fun (x : Fin ett.rounds) ↦ + (⟨fun (x_1 : E) + (x_2 : + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) x_1) + (x_3 : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ x_1 = some c) ↦ + rfl, + fun (x_1 : V) + (x_2 : + x_1 ∈ + TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc)) ↦ + rfl⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ f = some c) → + ett.series.data.coloring x.succ f = + ett.series.data.coloring x.succ f) ∧ + ∀ + v ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc), + MissingColors G (ett.series.data.coloring x.succ) v = + MissingColors G (ett.series.data.coloring x.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + False + +private abbrev helperContinuation3998Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma + (Fin.last P.counterexample.hierarchy.dividerCount) eta) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), + (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → + (∀ {input' : PartialEdgeColoring E k} + (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) + (base' : HierarchyBase ett' rho) (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring + (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho + sigma) → + (∀ {input' : PartialEdgeColoring E k} + (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) + (base' : HierarchyBase ett' old) (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ + (t : + Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t)) → + ∀ beta ∉ HierarchyStoredColorsAt H q, + (beta ∉ TreeMissingColors phi A → + D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + ∀ + (POne : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + POne.coloring (T.edge D.lastEdgeIndex) = some D.theta → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + POne.coloring (T.edge t) = phi (T.edge t)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := + HierarchyFirstMissingPosition phi T beta; + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex D.penultimateVertexIndex ≠ + T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) + (T.vertex D.penultimateVertexIndex) → + (∀ (rho : PartialEdgeColoring E k), + ∀ + c ∈ + MissingColors G rho + (T.vertex (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < + (↑(HierarchyFirstMissingPosition rho T c) : ℕ)) → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 + POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let COne' : HierarchyCounterexample POne.replacementBase := + POne.counterexample; + let ctxOne : + HierarchyMinimumCounterexampleContext G k e0 + POne.corresponding.replacementInput T POne.coloring + POne.corresponding.replacementETT POne.replacementBase + POne.counterexample := + POne.minimumContext; + let HOne : + TashkinovHierarchy POne.corresponding.replacementETT + POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := + Fin.last HOne.dividerCount; + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G rho v = MissingColors G phi v) → + ColoredVertexSetElementary G rho + (TreeSequenceVertexSet B) → + TreeMissingColors rho A = TreeMissingColors phi A → + D.theta ∈ + MissingColors G rho + (T.vertex D.penultimateVertexIndex) → + beta ∉ + MissingColors G rho + (T.vertex D.penultimateVertexIndex) → + beta ∈ + MissingColors G rho + (T.vertex D.terminalVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = + D.penultimateVertexIndex → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, by omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + (beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree + (Fin.last ettOne.rounds).castSucc) ∨ + beta ∈ TreeMissingColors rho A ∧ + beta ∉ + TashkinovStoredColors ettOne.series.data + (Fin.last ettOne.rounds) ∧ + D.theta ∉ + TashkinovStoredColors ettOne.series.data + (Fin.last ettOne.rounds))) → + beta ∈ TreeMissingColors rho B ∧ + D.theta ∈ TreeMissingColors rho B → + Disjoint + (TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex ib))) → + let muTwo : PartialEdgeColoring E k := + TwoColorComponentSwap G rho beta D.theta z; + TwoColorPathComponent G rho beta D.theta z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G + (TwoColorComponentSwap G rho beta D.theta + z) + w = + MissingColors G rho w) → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = + HierarchyFirstMissingPosition rho T c) → + False + +private abbrev helperFinish3305Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet + (Sum.inl v)).Subsingleton) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet B → + v ∈ TreeSequenceVertexSet B → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = + HierarchyFirstMissingPosition rho T c) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma + (Fin.last P.counterexample.hierarchy.dividerCount) eta) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), + (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → + (∀ {input' : PartialEdgeColoring E k} + (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) + (base' : HierarchyBase ett' rho) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring + (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data + (Fin.last ett'.rounds)) + rho sigma) → + (∀ {input' : PartialEdgeColoring E k} + (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) + (base' : HierarchyBase ett' old) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ + (t : + Fin + (HierarchyStarredStage K + (Fin.last K.dividerCount)).length), + new + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge + t) = + old + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge + t)) → + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (beta ∉ TreeMissingColors phi A → + D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + ∀ + (POne : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx), + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G POne.coloring v = + MissingColors G phi v) → + beta ∈ + MissingColors G POne.coloring + (T.vertex D.terminalVertexIndex) → + POne.coloring (T.edge D.lastEdgeIndex) = some D.theta → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + POne.coloring (T.edge t) = phi (T.edge t)) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + POne.coloring (T.edge t) ≠ some beta) → + (POne.counterexample.hierarchy.dividerCount = + (0 : ℕ) → + beta ∈ TreeMissingColors POne.coloring A → + beta ∈ + TreeMissingColors POne.coloring + (POne.corresponding.replacementETT.series.data.tree + (Fin.last + POne.corresponding.replacementETT.rounds).castSucc) ∨ + beta ∉ + TashkinovStoredColors + POne.corresponding.replacementETT.series.data + (Fin.last + POne.corresponding.replacementETT.rounds) ∧ + D.theta ∉ + TashkinovStoredColors + POne.corresponding.replacementETT.series.data + (Fin.last + POne.corresponding.replacementETT.rounds)) → + False + +private theorem helper_hBT_116.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C B hBlen + refine ⟨?_, ?_, ?_⟩ + · omega + · intro i + rfl + · intro i + rfl + +private theorem helper_hApositive_123.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hq + have hi : q = (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp [q] + omega + change HierarchyStarredStage H q = _ + rw [hi] + simp only [HierarchyStarredStage, Fin.cases_succ] + congr 1 + apply Fin.ext + simp + omega + +private theorem helper_hAT_141.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hApositive hAzero + by_cases hz : H.dividerCount = 0 + · have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by apply Fin.ext; simp [hz] + simpa [hAzero hz, hi, H.terminalStage] using H.coreInsideFirst + · rw [hApositive (Nat.pos_of_ne_zero hz)] + have hi : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + q.castSucc := Fin.ext rfl + have hj : H.stage q.succ = T := by + convert H.terminalStage using 1 + congr 1 + simpa only [hi, hj] using H.nested q + +private theorem helper_hAB_153.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A B htail hBlen hApositive hAzero hAT + refine ⟨by omega, ?_, ?_⟩ + · intro i + exact hAT.2.1 i + · intro i + exact hAT.2.2 i + +private theorem helper_hBterminal_159.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hBT + rw [← hBT.2.1 (Fin.last B.length)] + congr 1 + apply Fin.ext + have hp := D.penultimateVertexPosition + simp only [Fin.val_castLE, Fin.val_last] + omega + +private theorem helper_firstAt_173.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + ∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hyB hElementary c hc + let candidates := Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex i) + have hy : D.penultimateVertexIndex ∈ candidates := by simp [candidates, hc] + have hn : candidates.Nonempty := ⟨_, hy⟩ + have hmin := Finset.min'_le candidates _ hy + have hm : c ∈ MissingColors G phi (T.vertex (candidates.min' hn)) := + (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hmem : T.vertex (candidates.min' hn) ∈ TreeSequenceVertexSet B := by + let j : Fin (B.length + 1) := ⟨(candidates.min' hn).val, by + have hp := D.penultimateVertexPosition + change (candidates.min' hn).val ≤ D.penultimateVertexIndex.val at hmin + omega⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨j, ?_⟩ + rfl + have heq : candidates.min' hn = D.penultimateVertexIndex := by + by_contra hne + have hvne := fun h => hne (T.vertex_injective h) + exact Finset.disjoint_left.mp (hElementary hmem hyB hvne) hm hc + simpa only [HierarchyFirstMissingPosition, candidates, dite_eq_left hn] using heq + +private theorem helper_hnotA_197.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + ∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hApositive hAzero hAT hAB + hyB hElementary c hc ha + rcases Finset.mem_biUnion.mp ha with ⟨v, hv, hvc⟩ + have hvB := TreeSequenceInitialSegmentVertexSetSubset hAB hv + have hvne : v ≠ T.vertex D.penultimateVertexIndex := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨i, rfl⟩ + intro he + have hi := T.vertex_injective ((hAT.2.1 i).trans he) + have hp := D.penultimateVertexPosition + have hib := i.isLt + have hiv := congrArg Fin.val hi + simp only [Fin.val_castLE] at hiv + omega + exact Finset.disjoint_left.mp (hElementary hvB hyB hvne) hvc hc + +private theorem helper_hshortB_220.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + TreeSequenceInitialSegment Bshort B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen Bshort hshortLen + refine ⟨by omega, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + +private theorem helper_hterminalIncident_226.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D Bshort hshortLen + obtain ⟨i, hi⟩ := T.attaches D.lastEdgeIndex + have hj : D.lastEdgeIndex.succ = D.terminalVertexIndex := by + apply Fin.ext + have hl := D.lastEdgePosition + have ht := D.terminalVertexPosition + simp only [Fin.val_succ] + omega + change _ ∈ G.ends (T.edge D.lastEdgeIndex) + rw [hi, hj] + exact Sym2.mem_mk_left _ _ + +private theorem helper_firstWitness_238.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (rho : PartialEdgeColoring E k) + (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length := by + classical + intro V E _ _ G k e0 T rho X hXT c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hvc⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨i, rfl⟩ + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex j) + have hi : Fin.castLE (Nat.succ_le_succ hXT.1) i ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [hXT.2.1 i] + exact hvc + have hn : candidates.Nonempty := ⟨_, hi⟩ + have hm := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hle := Finset.min'_le candidates _ hi + have hib := i.isLt + unfold HierarchyFirstMissingPosition + change (c ∈ MissingColors G rho (T.vertex (if h : candidates.Nonempty then + candidates.min' h else Fin.last T.length))) ∧ _ + rw [dite_eq_left hn] + refine ⟨hm, ?_⟩ + change (candidates.min' hn).val ≤ i.val at hle + omega + +private theorem helper_missingSubset_269.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y := by + classical + intro V E _ _ G k e0 rho X Y hXY + let _ := Fintype.ofFinite V + as_aux_lemma => + intro c hc + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hm⟩ + +private theorem helper_leaf_278.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ G k rho a b hne hp v hm + let _ := Fintype.ofFinite V + have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G rho a b) + (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with ha | hb + · exact MissingColorIncidenceEndpoint G rho a b hne hp v ha + · have he : TwoColorIncidenceGraph G rho a b = TwoColorIncidenceGraph G rho b a := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + rw [he] + exact MissingColorIncidenceEndpoint G rho b a hne.symm hp v hb + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx y hy + exact Finset.card_le_one_iff.mp hd + (by simpa [SimpleGraph.mem_neighborFinset] using hx) + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + +private theorem helper_separate_297.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ), + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton) → + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + classical + intro V E _ _ G k self leaf rho a b hne hp u v w huv huw hvw hu hv hw hsame + let _ := Fintype.ofFinite V + rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd + · exfalso + obtain ⟨s, t, p, hpPath, hsupport⟩ := + TwoColorComponentSpanningPath G rho a b hp (Sum.inl w) + have ends (x : V) (hx : Sum.inl x ∈ TwoColorComponent G rho a b (Sum.inl w)) + (hm : a ∈ MissingColors G rho x ∨ b ∈ MissingColors G rho x) : + Sum.inl x = s ∨ Sum.inl x = t := by + by_contra hnot + push Not at hnot + have hs : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {z | z ∈ p.support} + rw [hsupport] + exact hx + exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet + hnot.1 hnot.2 (leaf rho a b hne hp x hm) hs + have hue := ends u (he ▸ self rho a b u) (Or.inl hu) + have hve := ends v (by rw [he, hsame]; exact self rho a b v) (Or.inr hv) + have hwe := ends w (self rho a b w) hw + rcases hue with hu | hu <;> rcases hve with hv | hv <;> rcases hwe with hw | hw + all_goals first + | exact huv (Sum.inl.inj (hu.trans hv.symm)) + | exact huw (Sum.inl.inj (hu.trans hw.symm)) + | exact hvw (Sum.inl.inj (hv.trans hw.symm)) + · exact hd + +private theorem helper_separateAny_332.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ), + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + classical + intro V E _ _ G k self separate rho a b hne hp u v w huw hvw hu hv hw hsame + let _ := Fintype.ofFinite V + by_cases huv : u = v + · subst v + rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd + · have noColor (c : Fin k) (hc : c ∈ MissingColors G rho u) + (f : E) (hf : Incident G u f) : rho f ≠ some c := by + intro hcol + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hf, hcol⟩) + have hn : (TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl u) = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro x hx + cases x with + | inl x => exact hx + | inr f => + rcases hx with ⟨hi, hc⟩ + exact hc.elim (noColor a hu f hi) (noColor b hv f hi) + have hwIn : Sum.inl w ∈ TwoColorComponent G rho a b (Sum.inl u) := + he ▸ self rho a b w + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = + (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl u) at hwIn + exact False.elim (SimpleGraph.not_reachable_of_neighborSet_left_eq_empty + (fun h => huw (Sum.inl.inj h)) hn + (SimpleGraph.ConnectedComponent.exact hwIn).symm) + · exact hd + · exact separate rho a b hne hp u v w huv huw hvw hu hv hw hsame + +private theorem helper_prefixMissing_366.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet B → + v ∈ TreeSequenceVertexSet B → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C B z rho a b hne hp helem u v huB hvB hu hv hdu hdv + as_aux_lemma => + clear_value B + clear * - G rho a b hne hp helem u v huB hvB hu hv hdu hdv B z + have behavior := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + intro w hwB + by_cases hw : Sum.inl w ∈ TwoColorComponent G rho a b z + · have hwa : a ∉ MissingColors G rho w := by + intro hm + have hwu : w ≠ u := fun he => hdu (he ▸ hw) + exact Finset.disjoint_left.mp (helem hwB huB hwu) hm hu + have hwb : b ∉ MissingColors G rho w := by + intro hm + have hwv : w ≠ v := fun he => hdv (he ▸ hw) + exact Finset.disjoint_left.mp (helem hwB hvB hwv) hm hv + have presentSwapped (c d : Fin k) + (hd : d ∉ MissingColors G rho w) + (hdab : (d = a ∧ c = b) ∨ (d = b ∧ c = a)) : + c ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by + have hpres : d ∈ PresentColors G rho w := by simpa [MissingColors] using hd + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpres + rcases hpres with ⟨e, hwe, he⟩ + have hadj : (TwoColorIncidenceGraph G rho a b).Adj (Sum.inr e) (Sum.inl w) := by + simp only [TwoColorIncidenceGraph] + exact ⟨hwe, hdab.elim (fun h => Or.inl (he.trans (congrArg some h.1))) + (fun h => Or.inr (he.trans (congrArg some h.1)))⟩ + have heC : Sum.inr e ∈ TwoColorComponent G rho a b z := by + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = _ at hw + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inr e) = _ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hw + have heSwap : TwoColorComponentSwap G rho a b z e = some c := by + rcases hdab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · simp [TwoColorComponentSwap, heC, he] + · simp [TwoColorComponentSwap, heC, he] + have hpresent : c ∈ PresentColors G (TwoColorComponentSwap G rho a b z) w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, heSwap⟩ + simpa [MissingColors] using hpresent + have hnewa := presentSwapped a b hwb (Or.inr ⟨rfl, rfl⟩) + have hnewb := presentSwapped b a hwa (Or.inl ⟨rfl, rfl⟩) + apply Finset.ext + intro c + by_cases hca : c = a + · subst c + simp only [hnewa, hwa] + · by_cases hcb : c = b + · subst c + simp only [hnewb, hwb] + · exact behavior.2.2.2 w c hca hcb + · exact behavior.1 w hw + +private theorem helper_firstPreserved_424.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment B T → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C B hBT firstWitness rho sigma c helem hmiss hc + as_aux_lemma => + clear_value B + clear * - G T B rho sigma c helem hmiss hc firstWitness hBT + have hr := firstWitness rho B hBT c hc + have hc' : c ∈ TreeMissingColors sigma B := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ + have hs := firstWitness sigma B hBT c hc' + have pref (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : + T.vertex i ∈ TreeSequenceVertexSet B := by + let j : Fin (B.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hBT.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, (hBT.2.1 j).symm.trans (congrArg T.vertex he)⟩ + by_contra hne + have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ + T.vertex (HierarchyFirstMissingPosition rho T c) := + fun he => hne (T.vertex_injective he) + have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 + exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 + +private theorem helper_firstUnaffected_449.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) + (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ G k e0 T z rho a b c hne hp hca hcb + let _ := Fintype.ofFinite V + have hb := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + have he : (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G (TwoColorComponentSwap G rho a b z) (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hb.2.2.2 _ c hca hcb + unfold HierarchyFirstMissingPosition + rw [he] + +private theorem helper_seriesFacts_464.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j) ∧ + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + classical + intro V E _ _ _ G k e0 input T phi ett j + have certificate := ett.series.certified j + cases certificate with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact ⟨currentProper, currentOneUncolored⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact ⟨previousProper, previousOneUncolored⟩ + +private theorem helper_sameStar_518.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A P + have helper : ∀ (n m : ℕ) (X Y : TreeSequence G e0) + (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → TreeSequence G e0), + n = m → X = Y → HEq s t → + Fin.cases (motive := fun _ => TreeSequence G e0) + X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = + Fin.cases (motive := fun _ => TreeSequence G e0) + Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by + intro n m X Y s t hnm hXY hst + subst m + have he := eq_of_heq hst + simp [hXY, he] + exact (helper _ _ base.core P.replacementBase.core H.stage + P.counterexample.hierarchy.stage P.sameGood.1.2.1 P.sameGood.1.1 + P.sameGood.1.2.2.1).symm + +private theorem helper_commonPrefix_557.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → + TreeSequenceInitialSegment X Y := by + classical + intro V E G e0 X Y F hXF hYF hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYF.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXF.2.1 i) + · intro i + exact (hYF.2.2 (Fin.castLE hXY i)).symm.trans (hXF.2.2 i) + +private theorem helper_hcoreLength_566.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + base.core.length ≤ A.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hApositive hAzero + by_cases hz : H.dividerCount = 0 + · exact le_of_eq (congrArg TreeSequence.length (hAzero hz).symm) + · rw [hApositive (Nat.pos_of_ne_zero hz)] + have hm : Monotone (fun i : Fin (H.dividerCount + 2) => (H.stage i).length) := + Fin.monotone_iff_le_succ.mpr fun i => (H.nested i).1 + exact H.coreInsideFirst.1.trans (hm (show + (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) ≤ + ⟨H.dividerCount, by omega⟩ from Nat.pos_of_ne_zero hz)) + +private theorem helper_predecessorIncident_575.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) + (e0 : E) (T X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), + (↑t : ℕ) = X.length → + TreeIncidentEdge X (T.edge t) := by + classical + intro V E _ _ G e0 T X hXT t ht + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨i, hi⟩ := T.attaches t + let j : Fin (X.length + 1) := ⟨i.val, by have := i.isLt; omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hXT.1) j = + Fin.castLE (by omega : t.val + 1 ≤ T.length + 1) i := Fin.ext rfl + refine ⟨X.vertex j, (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, rfl⟩, ?_⟩ + rw [← hXT.2.1 j, he, Incident, hi] + exact Sym2.mem_mk_right _ _ + +private theorem helper_seedStable_587.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma := by + classical + intro V E _ _ _ _ G k e0 T input' rho sigma ett' base' K hw hq + have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hq + rw [hi] at hw + change (if ett'.series.data.kind (Fin.last ett'.rounds) = + some TashkinovExtensionKind.PE then _ else _) at hw + split_ifs at hw with hpe + · exact hw.1 + · exact hw + +private theorem helper_weakEdges_603.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by + classical + intro V E _ _ _ _ G k e0 T input' old new ett' base' K hw ho hno + by_cases hz : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz + rw [hi] at hw ⊢ + exact P2813_T1_BaseDisplayedEdges G k e0 input' T old ett' base' new ho hno hw + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := + Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) + rw [hi] at hw ⊢ + intro t + have hinv := hw.2 + by_cases ht : 1 ≤ t.val + · exact hinv.1 t ht + · let S := HierarchyStarredStage K + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ + have he : t = ⟨0, S.positive⟩ := Fin.ext (by change t.val = 0; omega) + rw [he, S.first_edge, hno.1, ho.1] + +private theorem helper_hbetaTheta_660.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (2 : ℕ) ≤ T.length - A.length → + ∀ (beta : Fin k), + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ≠ D.theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail beta hbetaUnused he + exact hbetaUnused D.lastEdgeIndex (by + have hp := D.lastEdgePosition + clear * - hp htail + omega) (D.thetaOnLastEdge.trans (congrArg some he.symm)) + +private theorem helper_hby_672.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + ∀ (beta : Fin k), + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D Bshort hshortLen beta ib hbFirst he + have hi := congrArg Fin.val (T.vertex_injective he) + have hp := D.penultimateVertexPosition + have hb : ib.val ≤ Bshort.length := hbFirst.2 + clear * - hi hp hb hshortLen + omega + +private theorem helper_hbt_679.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + ∀ (beta : Fin k), + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ≠ T.vertex D.terminalVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D Bshort hshortLen beta ib hbFirst he + have hi := congrArg Fin.val (T.vertex_injective he) + have hp := D.terminalVertexPosition + have hb : ib.val ≤ Bshort.length := hbFirst.2 + clear * - hi hp hb hshortLen + omega + +private theorem helper_hyt_686.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D he + have hi := congrArg Fin.val (T.vertex_injective he) + have hp := D.penultimateVertexPosition + have ht := D.terminalVertexPosition + clear * - hi hp ht + omega + +private theorem helper_firstAfter_699.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + ∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hAT rho c hc hn + by_contra h + have hi : (HierarchyFirstMissingPosition rho T c).val ≤ A.length := Nat.le_of_not_gt h + let i : Fin (A.length + 1) := ⟨(HierarchyFirstMissingPosition rho T c).val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hAT.1) i = + HierarchyFirstMissingPosition rho T c := Fin.ext rfl + apply hn + refine Finset.mem_biUnion.mpr ⟨A.vertex i, (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, + Finset.mem_univ _, rfl⟩, ?_⟩ + rw [← hAT.2.1 i, he] + exact hc + +private theorem helper_hcaseOne_757.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + ∀ (beta : Fin k) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (POne.counterexample.hierarchy.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors POne.coloring A → + beta ∈ + TreeMissingColors POne.coloring + (POne.corresponding.replacementETT.series.data.tree + (Fin.last POne.corresponding.replacementETT.rounds).castSucc) ∨ + beta ∉ + TashkinovStoredColors POne.corresponding.replacementETT.series.data + (Fin.last POne.corresponding.replacementETT.rounds) ∧ + D.theta ∉ + TashkinovStoredColors POne.corresponding.replacementETT.series.data + (Fin.last POne.corresponding.replacementETT.rounds)) → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let _ : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + (beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) ∨ + beta ∈ TreeMissingColors rho A ∧ + beta ∉ TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds) ∧ + D.theta ∉ TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A sameStar beta POne hzero rho ettOne + COne' HOne qOne hmissingA hm + have hcount : H.dividerCount = HOne.dividerCount := POne.sameGood.1.2.1 + by_cases hz : HOne.dividerCount = 0 + · refine Or.inr ⟨hz, ?_⟩ + have hmNew : beta ∈ TreeMissingColors rho A := hmissingA.symm ▸ hm + rcases hzero hz hmNew with hn | hn + · exact Or.inl hn + · exact Or.inr ⟨hmNew, hn⟩ + · refine Or.inl ⟨Nat.pos_of_ne_zero hz, ?_⟩ + have hi : qOne = + (⟨HOne.dividerCount - 1, by omega⟩ : Fin HOne.dividerCount).succ := + Fin.ext (by simp only [qOne, Fin.val_last, Fin.val_succ]; omega) + have hs := sameStar POne + change HierarchyStarredStage HOne qOne = A at hs + rw [hi] at hs + have hind : (⟨HOne.dividerCount - 1, by omega⟩ : Fin HOne.dividerCount).succ.castSucc = + (⟨HOne.dividerCount, by omega⟩ : Fin (HOne.dividerCount + 2)) := + Fin.ext (by simp only [Fin.val_succ, Fin.val_castSucc]; omega) + change HOne.stage _ = A at hs + rw [hind] at hs + rw [hs, hmissingA] + exact hm + +private theorem helper_hsameTwo_814.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + beta ∈ MissingColors G POne.coloring (T.vertex D.terminalVertexIndex) → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → POne.coloring (T.edge t) ≠ some beta) → + (POne.counterexample.hierarchy.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors POne.coloring A → + beta ∈ + TreeMissingColors POne.coloring + (POne.corresponding.replacementETT.series.data.tree + (Fin.last POne.corresponding.replacementETT.rounds).castSucc) ∨ + beta ∉ + TashkinovStoredColors POne.corresponding.replacementETT.series.data + (Fin.last POne.corresponding.replacementETT.rounds) ∧ + D.theta ∉ + TashkinovStoredColors POne.corresponding.replacementETT.series.data + (Fin.last POne.corresponding.replacementETT.rounds)) → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex → + T.vertex ib ≠ T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let baseOne' : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∉ HierarchyStoredColorsAt HOne qOne → + beta ∉ MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ MissingColors G rho (T.vertex D.terminalVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + (beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) ∨ + beta ∈ TreeMissingColors rho A ∧ + beta ∉ TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds) ∧ + D.theta ∉ + TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds))) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + (let H : TashkinovHierarchy ettOne baseOne' := COne'.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ettOne.rounds + (1 : ℕ)) := Fin.last ettOne.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ettOne.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ettOne.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition rho T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition rho T D.theta); + have sameComponent : Prop := + TwoColorComponent G rho beta D.theta (Sum.inl va) = + TwoColorComponent G rho beta D.theta (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors rho Tnq ∨ + Disjoint (insert beta ({ D.theta } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors rho Tn ∨ + Disjoint (insert beta ({ D.theta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors rho A ∧ + TreeColorSetClosed G rho A ({ beta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A rho beta D.theta)) → + TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib)) = + TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast + beta hbetaMissing hbetaUnused hbetaStored houtside hcutoff POne hterm hUnused hzero + hbetaTheta ib hbFirst hibB hby hbt horder rho ettOne baseOne' COne' HOne qOne hmissingA + hbetaStoredOne hgammaPenOne hgammaTermOne hgammaWitnessOne' hfirstGammaOne hfirstThetaOne + hgammaUnusedOne hcaseOne hmissingPairOne hchangeOne + rw [← hfirstGammaOne, ← hfirstThetaOne] + by_cases hm : beta ∈ TreeMissingColors phi A + · rcases hcaseOne hm with ⟨hp, hb⟩ | ⟨hz, hb⟩ + · exact hchangeOne.1 ⟨hp, Or.inl hb⟩ + · apply hchangeOne.2.1 + refine ⟨hz, ?_⟩ + rcases hb with hb | ⟨_, hbn, htn⟩ + · exact Or.inl hb + · right + rw [Finset.disjoint_left] + intro c hc hd + rcases Finset.mem_insert.mp hc with rfl | hc + · exact hbn hd + · exact htn (Finset.mem_singleton.mp hc ▸ hd) + · have hnTheta : D.theta ∉ HierarchyStoredColorsAt HOne qOne := by + rw [← (sameLast POne).1] + exact houtside hm + by_cases hz : HOne.dividerCount = 0 + · apply hchangeOne.2.1 + refine ⟨hz, Or.inr ?_⟩ + rw [Finset.disjoint_left] + intro c hc hd + rcases Finset.mem_insert.mp hc with rfl | hc + · apply hbetaStoredOne + refine Finset.mem_sdiff.mpr ⟨hd, ?_⟩ + rw [sameStar POne, hmissingA] + exact hm + · have he : c = D.theta := Finset.mem_singleton.mp hc + subst c + apply hnTheta + refine Finset.mem_sdiff.mpr ⟨hd, ?_⟩ + rw [sameStar POne, hmissingA] + exact hnotA (c := D.theta) D.thetaMissingPenultimate + · apply hchangeOne.1 + refine ⟨Nat.pos_of_ne_zero hz, Or.inr ?_⟩ + rw [Finset.disjoint_left] + intro c hc hd + rcases Finset.mem_insert.mp hc with rfl | hc + · exact hbetaStoredOne hd + · exact hnTheta (Finset.mem_singleton.mp hc ▸ hd) + +private theorem helper_hstoredTwo_876.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c) → + ∀ (beta : Fin k) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + beta ≠ D.theta → + let rho : PartialEdgeColoring E k := POne.coloring; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let _ : + HierarchyMinimumCounterexampleContext G k e0 POne.corresponding.replacementInput T + POne.coloring POne.corresponding.replacementETT POne.replacementBase + POne.counterexample := + POne.minimumContext; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + beta ∉ HierarchyStoredColorsAt HOne qOne → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho beta D.theta z) w = + MissingColors G rho w) → + ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B firstPreserved firstUnaffected beta + POne z hbetaTheta rho COne' ctxOne HOne qOne hElementaryOne hbetaStoredOne hmissingPairOne + muTwo hmissingTwo c hc + have hcb : c ≠ beta := fun he => hbetaStoredOne (he ▸ hc) + by_cases hct : c = D.theta + · exact hct.symm ▸ + firstPreserved rho muTwo D.theta hElementaryOne hmissingTwo hmissingPairOne.2 + · exact firstUnaffected z rho beta D.theta c hbetaTheta ctxOne.proper hcb hct + +private theorem helper_hsuffix_885.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + ∀ (beta : Fin k) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + rho (T.edge D.lastEdgeIndex) = some D.theta → + TashkinovAugmentationSequence rho B T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hBT beta POne rho hmissingPairOne + hthetaLastOne + apply Relation.ReflTransGen.single + refine ⟨hBlen.symm, hBT, D.theta, ?_, hmissingPairOne.2⟩ + have hi : Fin.cast hBlen (Fin.last B.length) = D.lastEdgeIndex := + Fin.ext (by + have hl := D.lastEdgePosition + simp only [Fin.val_cast, Fin.val_last] + clear * - hBlen hl + omega) + rw [hi] + exact hthetaLastOne + +private theorem helper_hgammaCutoff_901.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + ∀ (beta : Fin k), + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G rho v = MissingColors G phi v) → + (↑(HierarchyFirstMissingPosition rho T D.theta) : ℕ) ≤ B.length → + ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + beta ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c → + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hElementary hnotA Bshort hshortT + hshortB firstWitness missingSubset firstPreserved sameLast beta hcutoff POne rho COne' HOne + qOne hmissingOne' hthetaBound c hc hpair + have hcOld : c ∈ HierarchyStoredColorsAt H q := + Finset.subset_of_eq (sameLast POne).1.symm hc + have hpairOld : beta ∈ C.good.gamma q c ∨ D.theta ∈ C.good.gamma q c := + ((sameLast POne).2 c hcOld).symm ▸ hpair + rcases hpairOld with hb | ht + · rcases hcutoff c hcOld hb with he | hm + · exact he.symm ▸ hthetaBound + · have hmB : c ∈ TreeMissingColors phi B := missingSubset (X := Bshort) (Y := B) phi hshortB hm + exact (le_of_eq (congrArg Fin.val + (firstPreserved phi rho c hElementary hmissingOne' hmB))).trans + ((firstWitness phi Bshort hshortT c hm).2.trans hshortB.1) + · exact False.elim (hnotA (c := D.theta) D.thetaMissingPenultimate + ((GoodHierarchyReservedDisjoint C.good q).1 c hcOld ht)) + +private theorem helper_hfixedPrefix_1000.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment A T → + ∀ (beta : Fin k) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → (↑t : ℕ) < B.length → muTwo (T.edge t) = rho (T.edge t)) → + (∀ (t : Fin A.length), muTwo (A.edge t) = rho (A.edge t)) → + ∀ (t : Fin T.length), + (↑t : ℕ) < B.length → + muTwo (T.edge t) = rho (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT beta POne z rho muTwo + hfixedTailTwo hfixedCore t ht + by_cases ha : t.val < A.length + · let ta : Fin A.length := ⟨t.val, ha⟩ + have he : Fin.castLE hAT.1 ta = t := Fin.ext rfl + rw [← he, hAT.2.2 ta] + exact hfixedCore ta + · exact hfixedTailTwo t (Nat.le_of_not_gt ha) ht + +private theorem helper_transportRoute_1009.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + TreeSequenceInitialSegment B T → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + ∀ (beta : Fin k) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho beta D.theta z) w = + MissingColors G rho w) → + beta ∈ TreeMissingColors phi A → + (∀ (t : Fin T.length), (↑t : ℕ) < B.length → muTwo (T.edge t) = rho (T.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence rho S B → + TashkinovAugmentationSequence muTwo S B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBT commonPrefix beta POne + z rho muTwo hmissingTwo hm hfixedPrefix S hs + clear * - G T B rho muTwo hBT hfixedPrefix hmissingTwo commonPrefix hs + unfold TashkinovAugmentationSequence at hs ⊢ + induction hs using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head X Y hstep htail ih => + have hYB := TashkinovAugmentationSequenceInitialSegment rho Y B htail + obtain ⟨hlen, hXY, c, hedge, hm⟩ := hstep + have hXB : TreeSequenceInitialSegment X B := + ⟨hXY.1.trans hYB.1, + fun i => (hYB.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i), + fun i => (hYB.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i)⟩ + refine Relation.ReflTransGen.head ⟨hlen, hXY, c, ?_, ?_⟩ ih + · let tY : Fin Y.length := Fin.cast hlen.symm (Fin.last X.length) + let tB : Fin B.length := Fin.castLE hYB.1 tY + have hf := hfixedPrefix (Fin.castLE hBT.1 tB) tB.isLt + rw [hBT.2.2 tB, hYB.2.2 tY] at hf + exact hf.trans hedge + · obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hm + exact Finset.mem_biUnion.mpr ⟨v, hv, + (hmissingTwo v (TreeSequenceInitialSegmentVertexSetSubset hXB hv)).symm ▸ hvc⟩ + +private theorem helper_hrouteTwo_1032.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + ∀ (beta : Fin k) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let _ : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence rho S B → TashkinovAugmentationSequence muTwo S B) → + ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence muTwo + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) B ∨ + (ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.SE ∨ + ettOne.series.data.kind (Fin.last ettOne.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ettOne.series.data.connectingEdges (Fin.last ettOne.rounds) = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence muTwo seed B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT commonPrefix + hcoreLength beta POne z rho ettOne baseOne' muTwo transportRoute + rcases P2813_T1_TerminalRoute G k e0 POne.corresponding.replacementInput T rho ettOne with + ⟨hp, hseq⟩ | ⟨hp, f, seed, hedges, hseed, _, _, hseq⟩ + · have hTnB := commonPrefix ettOne.abovePenultimate hBT (by + have hs := ettOne.strictAbovePenultimate + clear * - hs hBlen + omega) + exact Or.inl ⟨hp, transportRoute _ (TashkinovAugmentationSequenceRestrict rho _ B T + hseq hTnB hBT)⟩ + · have hseedT := TashkinovAugmentationSequenceInitialSegment rho seed T hseq + have hTnCore : (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc).length ≤ + baseOne'.core.length := by + have hnp : ettOne.series.data.kind (Fin.last ettOne.rounds) ≠ + some TashkinovExtensionKind.PE := by + intro he + rcases hp with he' | he' <;> rw [he'] at he <;> cases he + rw [baseOne'.nonparallel hnp] + have hcLen : baseOne'.core.length ≤ A.length := by + rw [← POne.sameGood.1.1] + exact hcoreLength + have hsLen : seed.length ≤ B.length := by + have hl := hseed.1 + change seed.length = (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc).length + 1 + at hl + clear * - hl hTnCore hcLen htail hBlen + omega + have hseedB := commonPrefix hseedT hBT hsLen + exact Or.inr ⟨hp, f, seed, hedges, hseed, + transportRoute seed (TashkinovAugmentationSequenceRestrict rho seed B T hseq hseedB hBT)⟩ + +private theorem helper_branch_1087.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment A T → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + ∀ beta ∉ HierarchyStoredColorsAt H q, + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ)) → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let _ : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let _ : + HierarchyMinimumCounterexampleContext G k e0 POne.corresponding.replacementInput T + POne.coloring POne.corresponding.replacementETT POne.replacementBase + POne.counterexample := + POne.minimumContext; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + beta ∉ TreeMissingColors phi A → + ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), + MaximumProperty corrTwo.replacementETT ∧ + ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : + TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), + SameGoodHierarchy COne'.good goodTwo := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT sameStar samePrefix sameLast + beta hbetaStored houtside POne z hbetaTheta ib horder firstAfter rho ettOne baseOne' COne' + ctxOne hElementaryOne hmissingA hgammaWitnessOne' hfirstGammaOne hfirstThetaOne + hgammaUnusedOne hmissingPairOne muTwo hm + have hnotAOne : beta ∉ TreeMissingColors rho A := by rw [hmissingA]; exact hm + have ha := firstAfter rho beta (by rw [hfirstGammaOne]; exact hgammaWitnessOne') hnotAOne + rw [hfirstGammaOne] at ha + exact (StableChangeCaseThree G k e0 POne.corresponding.replacementInput T rho ettOne + baseOne' COne' ctxOne.proper ctxOne.oneEdgeUncolored ctxOne.lowerRung ctxOne.fewerDividers + ctxOne.lexicographicMinimality + (by + change ColoredVertexSetElementary G rho (TreeSequenceVertexSet + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1))) + rw [samePrefix POne] + exact hElementaryOne) + ctxOne.largeMissingSet beta D.theta hbetaTheta + (by + change beta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) ∧ + D.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) + rw [samePrefix POne] + exact hmissingPairOne) + z muTwo rfl + (by + rw [sameStar POne, hfirstGammaOne] + intro u hu + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hu + exact ⟨Fin.castLE (Nat.succ_le_succ hAT.1) i, ib, hAT.2.1 i, rfl, + lt_of_le_of_lt (Nat.le_of_lt_succ i.isLt) ha⟩) + (by rw [hfirstGammaOne, hfirstThetaOne]; exact horder) + (by rw [← (sameLast POne).1]; exact ⟨hbetaStored, houtside hm⟩) + (by + rw [hfirstGammaOne] + intro hc + obtain ⟨t, ht, _, he⟩ := (Finset.mem_filter.mp hc).2 + exact hgammaUnusedOne t (by clear * - ht ha; omega) he)).2.2.2.2 + +private theorem helper_hlastComponent_1122.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → + ∀ (beta : Fin k) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let rho : PartialEdgeColoring E k := POne.coloring; + rho (T.edge D.lastEdgeIndex) = some D.theta → + Sum.inr (T.edge D.lastEdgeIndex) ∈ TwoColorComponent G rho beta D.theta z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hterminalIncident beta POne z rho + hthetaLastOne + have hadj : (TwoColorIncidenceGraph G rho beta D.theta).Adj + (Sum.inr (T.edge D.lastEdgeIndex)) z := by + exact ⟨hterminalIncident, Or.inr hthetaLastOne⟩ + change (TwoColorIncidenceGraph G rho beta D.theta).connectedComponentMk + (Sum.inr (T.edge D.lastEdgeIndex)) = _ + exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + +private theorem helper_recolor_1219.{u_1, u_2} : + helperRecolor1219Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBT hApositive hAT hAB + hElementary Bshort hshortLen hshortT hshortB firstWitness self leaf separateAny + prefixMissing firstPreserved firstUnaffected seriesFacts corrRefl PRefl beta hbetaA + hbetaUnused hbetaStored hbetaAlpha hzeroBeta + as_aux_lemma => + let ib := HierarchyFirstMissingPosition phi T beta + let ia := HierarchyFirstMissingPosition phi T D.alpha + have hb := firstWitness phi A hAT beta hbetaA + have ha := firstWitness phi Bshort hshortT D.alpha D.alphaMissingTwoBefore + have inPrefix (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : + T.vertex i ∈ TreeSequenceVertexSet B := by + let j : Fin (B.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have hj : Fin.castLE (Nat.succ_le_succ hBT.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, (hBT.2.1 j).symm.trans (congrArg T.vertex hj)⟩ + have hibB := inPrefix ib (hb.2.trans hAB.1) + have hiaB := inPrefix ia (ha.2.trans hshortB.1) + have hbt : T.vertex ib ≠ T.vertex D.terminalVertexIndex := by + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + have hv : ib.val ≤ A.length := hb.2 + have ht := D.terminalVertexPosition + clear * - hi hv ht htail + omega + have hat : T.vertex ia ≠ T.vertex D.terminalVertexIndex := by + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + have hv : ia.val ≤ Bshort.length := ha.2 + have ht := D.terminalVertexPosition + clear * - hi hv ht hshortLen + omega + have hmissing : beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B := + ⟨Finset.mem_biUnion.mpr ⟨_, hibB, hb.1⟩, + Finset.mem_biUnion.mpr ⟨_, hiaB, ha.1⟩⟩ + have hchange := ChangeLemma G k e0 input T phi ett base C ctx.proper + ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers ctx.lexicographicMinimality + hElementary ctx.largeMissingSet beta D.alpha hbetaAlpha hmissing + (by + dsimp only + intro hn + have hnAlpha : D.alpha ∉ TreeMissingColors phi A := + hn.resolve_left (not_not.mpr hbetaA) + have hafter : A.length < ia.val := by + by_contra hn + have hi : ia.val ≤ A.length := Nat.le_of_not_gt hn + let i : Fin (A.length + 1) := ⟨ia.val, Nat.lt_succ_of_le hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hAT.1) i = ia := Fin.ext rfl + apply hnAlpha + refine Finset.mem_biUnion.mpr ⟨A.vertex i, + (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, Finset.mem_univ _, rfl⟩, ?_⟩ + rw [← hAT.2.1 i, he] + exact ha.1 + refine ⟨⟨ib, ia, rfl, rfl, lt_of_le_of_lt hb.2 hafter⟩, ?_⟩ + intro hc + obtain ⟨t, ht, _, he⟩ := (Finset.mem_filter.mp hc).2 + exact hbetaUnused t ht he) + have hcase : + (0 < H.dividerCount ∧ beta ∈ TreeMissingColors phi + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ beta ∈ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + by_cases hz : H.dividerCount = 0 + · exact Or.inr ⟨hz, hzeroBeta hz⟩ + · exact Or.inl ⟨Nat.pos_of_ne_zero hz, hApositive (Nat.pos_of_ne_zero hz) ▸ hbetaA⟩ + have hsame : TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ia)) := by + rcases hcase with hp | hz + · exact hchange.1 ⟨hp.1, Or.inl hp.2⟩ + · exact hchange.2.1 ⟨hz.1, Or.inl hz.2⟩ + let z : Sum V E := Sum.inl (T.vertex D.terminalVertexIndex) + let mu := TwoColorComponentSwap G phi beta D.alpha z + have hdisjoint := separateAny phi beta D.alpha hbetaAlpha ctx.proper + (T.vertex ib) (T.vertex ia) (T.vertex D.terminalVertexIndex) + hbt hat hb.1 ha.1 (Or.inr D.alphaMissingTerminal) hsame + have hpath : TwoColorPathComponent G phi beta D.alpha z := + ⟨hbetaAlpha, _, self phi beta D.alpha _, + leaf phi beta D.alpha hbetaAlpha ctx.proper _ (Or.inr D.alphaMissingTerminal)⟩ + have hdu : Sum.inl (T.vertex ib) ∉ TwoColorComponent G phi beta D.alpha z := by + intro hm + exact Set.disjoint_left.mp hdisjoint hm (self phi beta D.alpha _) + have hdv : Sum.inl (T.vertex ia) ∉ TwoColorComponent G phi beta D.alpha z := by + intro hm + apply Set.disjoint_left.mp hdisjoint hm + rw [hsame] + exact self phi beta D.alpha _ + have hmissingNew := prefixMissing z phi beta D.alpha hbetaAlpha ctx.proper + hElementary _ _ hibB hiaB hb.1 ha.1 hdu hdv + have hfixed : ∀ t : Fin T.length, A.length ≤ t.val → + mu (T.edge t) = phi (T.edge t) := by + intro t ht + have hb := hbetaUnused t ht + have ha := D.alphaUnusedOnFullTail t ht + simp only [mu, TwoColorComponentSwap, hb, ha, ite_false, ite_self] + have hstored : ∀ c ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition mu T c = HierarchyFirstMissingPosition phi T c := by + intro c hc + have hcb : c ≠ beta := fun he => hbetaStored (he ▸ hc) + by_cases hca : c = D.alpha + · subst c + exact firstPreserved phi mu D.alpha hElementary hmissingNew hmissing.2 + · exact firstUnaffected z phi beta D.alpha c hbetaAlpha ctx.proper hcb hca + obtain ⟨corr, hmax, baseNew, K, good, hsameGood⟩ := + (StableChangeCasesOneTwoFullTail G k e0 input T phi ett base C ctx + beta D.alpha hbetaAlpha hmissing z hpath mu rfl + (by dsimp only; rcases hcase with hp | ⟨hz, hm⟩ + · exact Or.inl hp + · exact Or.inr ⟨hz, Or.inl hm⟩) + hdisjoint hfixed hmissingNew hstored).2.2.2.2 + have hterm : beta ∈ MissingColors G mu (T.vertex D.terminalVertexIndex) := + (TwoColorComponentSwapMissingBehavior G phi beta D.alpha hbetaAlpha ctx.proper z).2.2.1 + _ (self phi beta D.alpha _) D.alphaMissingTerminal + let CNew : HierarchyCounterexample baseNew := + { positive := by rw [corr.rungAgreement]; exact C.positive + hierarchy := K + good := good + maximum := hmax + notElementary := by + intro he + have hv : T.vertex ib ∈ TreeSequenceVertexSet T := by simp [TreeSequenceVertexSet] + have ht : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet T := by simp + [TreeSequenceVertexSet] + exact Finset.disjoint_left.mp (he hv ht hbt) + ((hmissingNew _ hibB).symm ▸ hb.1) hterm } + obtain ⟨P, hP⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx PRefl mu corr baseNew CNew hsameGood + exact ⟨P, hP.symm ▸ hmissingNew, hP.symm ▸ hterm, hP.symm ▸ hfixed⟩ + +private theorem helper_gammaReduction_1356.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + (∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + ∀ + (POne : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G POne.coloring v = MissingColors G phi v) → + beta ∈ MissingColors G POne.coloring (T.vertex D.terminalVertexIndex) → + POne.coloring (T.edge D.lastEdgeIndex) = some D.theta → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + POne.coloring (T.edge t) = phi (T.edge t)) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → POne.coloring (T.edge t) ≠ some beta) → + (POne.counterexample.hierarchy.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors POne.coloring A → + beta ∈ + TreeMissingColors POne.coloring + (POne.corresponding.replacementETT.series.data.tree + (Fin.last + POne.corresponding.replacementETT.rounds).castSucc) ∨ + beta ∉ + TashkinovStoredColors + POne.corresponding.replacementETT.series.data + (Fin.last + POne.corresponding.replacementETT.rounds) ∧ + D.theta ∉ + TashkinovStoredColors + POne.corresponding.replacementETT.series.data + (Fin.last + POne.corresponding.replacementETT.rounds)) → + False) → + (∀ beta ∈ TreeMissingColors phi A, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + beta ≠ D.alpha → + (H.dividerCount = (0 : ℕ) → + beta ∈ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G P.coloring v = MissingColors G phi v) ∧ + beta ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) = phi (T.edge t)) → + ∀ (eta beta : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + beta ∈ C.good.gamma q eta → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hApositive hAzero + hAT Bshort hshortLen missingSubset sameTn commonPrefix finish recolor eta beta heta hbeta + hUnused hposition + as_aux_lemma => + have hbetaA := (GoodHierarchyReservedDisjoint C.good q).1 eta heta hbeta + have hbetaStored : beta ∉ HierarchyStoredColorsAt H q := by + intro hc + exact Finset.disjoint_left.mp (GoodHierarchyReservedDisjoint C.good q).2 + (Finset.mem_biUnion.mpr ⟨eta, heta, hbeta⟩) hc + have hbetaAlpha : beta ≠ D.alpha := by + intro he + have haGamma : D.alpha ∈ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := + Finset.mem_biUnion.mpr ⟨eta, heta, he ▸ hbeta⟩ + rcases D.normalizedAlternative with hp | hz | hs + · exact hp.2.2 haGamma + · exact hz.2.2 haGamma + · exact hbetaStored (he.symm ▸ hs.1) + have hzeroBeta (hz : H.dividerCount = 0) : + beta ∈ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + have hi : q = 0 := Fin.ext (by simpa only [q, Fin.val_last, Fin.val_zero] using hz) + have hm := (Finset.mem_sdiff.mp (C.good.avoidance q eta heta hbeta)).1 + rw [hi] at hm + exact hm + obtain ⟨P, hprefix, hterm, hfixed⟩ := + recolor beta hbetaA hUnused hbetaStored hbetaAlpha hzeroBeta + have hAS : TreeSequenceInitialSegment A Bshort := + ⟨by omega, hAT.2.1, hAT.2.2⟩ + apply finish beta (missingSubset phi hAS hbetaA) hUnused hbetaStored + (fun hn => False.elim (hn hbetaA)) ?_ P hprefix hterm ?_ hfixed ?_ ?_ + · intro c hc hb + have he : c = eta := by + by_contra hne + exact Finset.disjoint_left.mp (C.good.disjointPairs q c eta hc heta hne) hb hbeta + exact he.symm ▸ hposition + · exact (hfixed D.lastEdgeIndex (by + have hl := D.lastEdgePosition + clear * - hl htail + omega)).trans D.thetaOnLastEdge + · intro t ht + rw [hfixed t ht] + exact hUnused t ht + · intro hz _ + left + rw [sameTn P] + have hm := hzeroBeta (P.sameGood.1.2.1.trans hz) + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hm + have hTnB := commonPrefix ett.abovePenultimate hBT (by + have hs := ett.strictAbovePenultimate + clear * - hs hBlen + omega) + exact Finset.mem_biUnion.mpr ⟨v, hv, + (hprefix v (TreeSequenceInitialSegmentVertexSetSubset hTnB hv)).symm ▸ hvc⟩ + +private theorem helper_branch_1413.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + (∀ (eta beta : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + beta ∈ C.good.gamma q eta → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort → False) → + D.theta ∈ HierarchyStoredColorsAt H q → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hfirstTheta hnotA Bshort hshortLen + gammaReduction hthetaStored + obtain ⟨g1, g2, hne, hpair⟩ := Finset.card_eq_two.mp + (C.good.twoColors q D.theta hthetaStored) + have hg : g1 ∈ C.good.gamma q D.theta := by rw [hpair]; simp + have hgA := (GoodHierarchyReservedDisjoint C.good q).1 D.theta hthetaStored hg + have hgTheta : g1 ≠ D.theta := by + intro he + exact hnotA (c := D.theta) D.thetaMissingPenultimate (he ▸ hgA) + apply gammaReduction D.theta g1 hthetaStored hg ?_ (Or.inl rfl) + intro t ht he + by_cases hl : t = D.lastEdgeIndex + · rw [hl, D.thetaOnLastEdge] at he + exact hgTheta (Option.some.inj he).symm + · have hav := (Finset.mem_sdiff.mp + (C.good.avoidance q D.theta hthetaStored hg)).2 + apply hav + unfold HierarchySegmentColors + dsimp only + have hend : H.stage q.succ = T := by + convert H.terminalStage using 1 + congr 1 + rw [hend, hfirstTheta] + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, ht, ?_, he⟩ + have hp := D.penultimateVertexPosition + have hlast := D.lastEdgePosition + have hvne : t.val ≠ D.lastEdgeIndex.val := fun he => hl (Fin.ext he) + have hv := t.isLt + omega + +private theorem helper_branch_1440.{u_1, u_2} : + helperBranch1440Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort seriesFacts corrRefl + PRefl finish gammaReduction hthetaStored + by_cases halphaStored : D.alpha ∈ HierarchyStoredColorsAt H q + · obtain ⟨g1, g2, hne, hpair⟩ := Finset.card_eq_two.mp + (C.good.twoColors q D.alpha halphaStored) + have hg : g1 ∈ C.good.gamma q D.alpha := by rw [hpair]; simp + apply gammaReduction D.alpha g1 halphaStored hg ?_ (Or.inr D.alphaMissingTwoBefore) + have havoid : Disjoint (C.good.gamma q D.alpha) + (Finset.univ.filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ phi (T.edge t) = some c) := by + rcases D.normalizedAlternative with hp | hz | hs + · exact False.elim (hp.2.1 halphaStored) + · exact False.elim (hz.2.1 (Finset.mem_sdiff.mp halphaStored).1) + · exact hs.2 + intro t ht he + exact Finset.disjoint_left.mp havoid hg + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, ht, he⟩) + · apply finish D.alpha D.alphaMissingTwoBefore D.alphaUnusedOnFullTail halphaStored + (fun _ => hthetaStored) ?_ PRefl (fun _ _ => rfl) D.alphaMissingTerminal + D.thetaOnLastEdge (fun _ _ => rfl) D.alphaUnusedOnFullTail ?_ + · intro eta heta ha + have hGamma : D.alpha ∈ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := + Finset.mem_biUnion.mpr ⟨eta, heta, ha⟩ + rcases D.normalizedAlternative with hp | hz | hs + · exact False.elim (hp.2.2 hGamma) + · exact False.elim (hz.2.2 hGamma) + · exact False.elim (halphaStored hs.1) + · intro hz _ + right + have halphaRaw : D.alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + rcases D.normalizedAlternative with hp | hzero | hs + · have hpos := hp.1 + change 0 < H.dividerCount at hpos + change H.dividerCount = 0 at hz + omega + · exact hzero.2.1 + · exact False.elim (halphaStored hs.1) + have hthetaRaw : D.theta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + intro hc + exact hthetaStored (Finset.mem_sdiff.mpr + ⟨hc, hnotA (c := D.theta) D.thetaMissingPenultimate⟩) + exact ⟨halphaRaw, hthetaRaw⟩ + +private theorem helper_branch_2793.{u_1, u_2} : + helperBranch2793Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB + hBterminal hyB hElementary hnotA sameStar samePrefix sameTn sameLast commonPrefix + hcoreLength predecessorIncident seedStable weakEdges beta POne hfixed z hbetaTheta ib hibB + rho ettOne baseOne' COne' ctxOne HOne qOne hElementaryOne hthetaPenOne hgammaWitnessOne' + hfirstGammaOne hgammaUnusedOne hcaseOne hmissingPairOne hdisjointTwo muTwo hpathTwo + hmissingTwo hstoredTwo hsuffix hgammaCutoff hm + have hstableTwo := StableChangeCasesOneTwo G k e0 POne.corresponding.replacementInput T rho + ettOne baseOne' COne' ctxOne.proper ctxOne.oneEdgeUncolored ctxOne.lowerRung + ctxOne.fewerDividers ctxOne.lexicographicMinimality + (by + change ColoredVertexSetElementary G rho (TreeSequenceVertexSet + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1))) + rw [samePrefix POne] + exact hElementaryOne) + ctxOne.largeMissingSet beta D.theta hbetaTheta + (by + change beta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) ∧ + D.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) + rw [samePrefix POne] + exact hmissingPairOne) + z hpathTwo muTwo rfl + (by dsimp only; rcases hcaseOne hm with hpos | ⟨hz, hb⟩ + · exact Or.inl hpos + · exact Or.inr ⟨hz, by + rcases hb with hb | ⟨hm, hn⟩ + · exact Or.inl hb + · exact Or.inr ⟨by rw [sameStar POne]; exact hm, hn⟩⟩) + (by dsimp only; rw [hfirstGammaOne]; exact hdisjointTwo) + have hthetaExclusion := HierarchyTailMissingColorExclusion G k e0 input T phi + ett base H hElementary (HierarchyFullTailLength C - 1) + (by change 1 ≤ T.length - A.length - 1; clear * - htail; omega) + (by change T.length - A.length - 1 < T.length - A.length; clear * - htail; omega) + D.theta (by + change D.theta ∈ MissingColors G phi (B.vertex (Fin.last B.length)) + rw [hBterminal] + exact D.thetaMissingPenultimate) + have hfixedTailTwo : ∀ t : Fin T.length, A.length ≤ t.val → t.val < B.length → + muTwo (T.edge t) = rho (T.edge t) := by + intro t ht hb + have hng := hgammaUnusedOne t ht + by_cases htheta : rho (T.edge t) = some D.theta + · let tB : Fin B.length := ⟨t.val, hb⟩ + have hcast : Fin.castLE hBT.1 tB = t := Fin.ext rfl + have heOld : phi (T.edge t) = some D.theta := by + exact (hfixed t ht).symm.trans htheta + have heB : phi (B.edge tB) = some D.theta := by + rw [← hBT.2.2 tB, hcast] + exact heOld + obtain ⟨hz, hcore, hpos, f, _, _, _, _, _, hs⟩ := + hthetaExclusion tB ht (by + change tB.val < A.length + (T.length - A.length - 1) + have hv := tB.isLt + clear * - hv htail hBlen + change tB.val < B.length at hv + omega) heB + have hzOne : HOne.dividerCount = 0 := POne.sameGood.1.2.1.symm.trans hz + have htn : ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc = A := + (sameTn POne).trans ((hAzero hz).trans hcore).symm + have hinc : TreeIncidentEdge + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) (T.edge t) := by + rw [htn] + exact predecessorIncident A hAT t hpos + have hsOld : D.theta ∈ HierarchyStoredColorsAt H q := + Finset.mem_sdiff.mpr ⟨hs, hnotA (c := D.theta) D.thetaMissingPenultimate⟩ + have hsOne : D.theta ∈ HierarchyStoredColorsAt HOne qOne := + (sameLast POne).1 ▸ hsOld + exact (seedStable rho muTwo ettOne baseOne' HOne hstableTwo.1 hzOne).1 _ hinc + ⟨D.theta, Finset.mem_union_right _ (Finset.mem_sdiff.mp hsOne).1, htheta⟩ + · simp only [muTwo, TwoColorComponentSwap, hng, htheta, ite_false, ite_self] + have hfixedCore := weakEdges rho muTwo ettOne baseOne' HOne hstableTwo.1 + ctxOne.oneEdgeUncolored hstableTwo.2.1.2.1 + change ∀ t : Fin (HierarchyStarredStage POne.counterexample.hierarchy + (Fin.last POne.counterexample.hierarchy.dividerCount)).length, + muTwo ((HierarchyStarredStage POne.counterexample.hierarchy + (Fin.last POne.counterexample.hierarchy.dividerCount)).edge t) = + rho ((HierarchyStarredStage POne.counterexample.hierarchy + (Fin.last POne.counterexample.hierarchy.dividerCount)).edge t) at hfixedCore + rw [sameStar POne] at hfixedCore + have hfixedPrefix : ∀ t : Fin T.length, t.val < B.length → + muTwo (T.edge t) = rho (T.edge t) := by + exact @helper_hfixedPrefix_1000 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) + (@beta) (@POne) (@hfixedTailTwo) (@hfixedCore) + have transportRoute (S : TreeSequence G e0) + (hs : TashkinovAugmentationSequence rho S B) : + TashkinovAugmentationSequence muTwo S B := by + exact @helper_transportRoute_1009 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBT) (@commonPrefix) (@beta) (@POne) (@hmissingTwo) (@hm) (@hfixedPrefix) (@S) + (@hs) + have hrouteTwo : + (ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence muTwo + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) B) ∨ + ((ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.SE ∨ + ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, ettOne.series.data.connectingEdges (Fin.last ettOne.rounds) = {f} ∧ + TreeSequenceAdjoinEdge (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) f + seed ∧ + TashkinovAugmentationSequence muTwo seed B) := by + exact @helper_hrouteTwo_1032 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@commonPrefix) (@hcoreLength) (@beta) (@POne) (@transportRoute) + exact (StableChangeCasesOneTwoSplitTail G k e0 POne.corresponding.replacementInput T rho + ettOne baseOne' COne' ctxOne beta D.theta hbetaTheta + (by rw [samePrefix POne]; exact hmissingPairOne) + z hpathTwo muTwo rfl + (by dsimp only; rcases hcaseOne hm with hpos | ⟨hz, hb⟩ + · exact Or.inl hpos + · exact Or.inr ⟨hz, by + rcases hb with hb | ⟨hm, hn⟩ + · exact Or.inl hb + · exact Or.inr ⟨by rw [sameStar POne]; exact hm, hn⟩⟩) + (by dsimp only; rw [hfirstGammaOne]; exact hdisjointTwo) + B (by dsimp only; rw [sameStar POne]; exact hAB) + (by dsimp only; rw [sameStar POne]; clear * - htail hBlen; omega) + (by rw [samePrefix POne]; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩) + (by dsimp only; intro t _ ht; exact hfixedPrefix t ht) + hrouteTwo hsuffix + ⟨Finset.mem_biUnion.mpr ⟨_, hibB, (hmissingTwo _ hibB).symm ▸ hgammaWitnessOne'⟩, + Finset.mem_biUnion.mpr ⟨_, hyB, (hmissingTwo _ hyB).symm ▸ hthetaPenOne⟩⟩ + (by rw [samePrefix POne]; exact hmissingTwo) hstoredTwo hgammaCutoff).2.2 + +private theorem helper_continuation_3433.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ by omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet B → + v ∈ TreeSequenceVertexSet B → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j) ∧ + IsOneEdgeUncolored (ett.series.data.coloring j) e0) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + (∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + ∀ + (POne : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G POne.coloring v = MissingColors G phi v) → + beta ∈ MissingColors G POne.coloring (T.vertex D.terminalVertexIndex) → + POne.coloring (T.edge D.lastEdgeIndex) = some D.theta → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + POne.coloring (T.edge t) = phi (T.edge t)) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → POne.coloring (T.edge t) ≠ some beta) → + (POne.counterexample.hierarchy.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors POne.coloring A → + beta ∈ + TreeMissingColors POne.coloring + (POne.corresponding.replacementETT.series.data.tree + (Fin.last + POne.corresponding.replacementETT.rounds).castSucc) ∨ + beta ∉ + TashkinovStoredColors + POne.corresponding.replacementETT.series.data + (Fin.last + POne.corresponding.replacementETT.rounds) ∧ + D.theta ∉ + TashkinovStoredColors + POne.corresponding.replacementETT.series.data + (Fin.last + POne.corresponding.replacementETT.rounds)) → + False) → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hApositive hAzero + hAT hAB hElementary hfirstTheta hnotA Bshort hshortLen hshortT hshortB firstWitness self + missingSubset leaf separateAny prefixMissing firstPreserved firstUnaffected seriesFacts + sameTn commonPrefix finish + have recolor (beta : Fin k) + (hbetaA : beta ∈ TreeMissingColors phi A) + (hbetaUnused : ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some beta) + (hbetaStored : beta ∉ HierarchyStoredColorsAt H q) + (hbetaAlpha : beta ≠ D.alpha) + (hzeroBeta : H.dividerCount = 0 → + beta ∈ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) : + ∃ P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G P.coloring v = MissingColors G phi v) ∧ + beta ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∧ + (∀ t : Fin T.length, A.length ≤ t.val → + P.coloring (T.edge t) = phi (T.edge t)) := by + exact @helper_recolor_1219 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hBT) + (@hApositive) (@hAT) (@hAB) (@hElementary) (@hshortLen) (@hshortT) (@hshortB) + (@firstWitness) (@self) (@leaf) (@separateAny) (@prefixMissing) (@firstPreserved) + (@firstUnaffected) (@seriesFacts) (@beta) (@hbetaA) (@hbetaUnused) (@hbetaStored) + (@hbetaAlpha) (@hzeroBeta) + -- Both stored-color branches use the same two swaps and compose their provenance. + have gammaReduction (eta beta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt H q) + (hbeta : beta ∈ C.good.gamma q eta) + (hUnused : ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some beta) + (hposition : eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) : False := by + exact @helper_gammaReduction_1356 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@hApositive) (@hAzero) (@hAT) (@hshortLen) (@missingSubset) + (@sameTn) (@commonPrefix) (@finish) (@recolor) (@eta) (@beta) (@heta) (@hbeta) (@hUnused) + (@hposition) + by_cases hthetaStored : D.theta ∈ HierarchyStoredColorsAt H q + · exact @helper_branch_1413 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hfirstTheta) + (@hnotA) (@hshortLen) (@gammaReduction) (@hthetaStored) + · exact @helper_branch_1440 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hnotA) + (@seriesFacts) (@finish) (@gammaReduction) (@hthetaStored) + +private theorem helper_hsameTwo_3578.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + beta ∈ MissingColors G POne.coloring (T.vertex D.terminalVertexIndex) → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → POne.coloring (T.edge t) ≠ some beta) → + (POne.counterexample.hierarchy.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors POne.coloring A → + beta ∈ + TreeMissingColors POne.coloring + (POne.corresponding.replacementETT.series.data.tree + (Fin.last POne.corresponding.replacementETT.rounds).castSucc) ∨ + beta ∉ + TashkinovStoredColors POne.corresponding.replacementETT.series.data + (Fin.last POne.corresponding.replacementETT.rounds) ∧ + D.theta ∉ + TashkinovStoredColors POne.corresponding.replacementETT.series.data + (Fin.last POne.corresponding.replacementETT.rounds)) → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex → + T.vertex ib ≠ T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let baseOne' : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∉ HierarchyStoredColorsAt HOne qOne → + beta ∉ MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ MissingColors G rho (T.vertex D.terminalVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + (beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) ∨ + beta ∈ TreeMissingColors rho A ∧ + beta ∉ TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds) ∧ + D.theta ∉ + TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds))) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + (let H : TashkinovHierarchy ettOne baseOne' := COne'.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ettOne.rounds + (1 : ℕ)) := Fin.last ettOne.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ettOne.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ettOne.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition rho T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition rho T D.theta); + have sameComponent : Prop := + TwoColorComponent G rho beta D.theta (Sum.inl va) = + TwoColorComponent G rho beta D.theta (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors rho Tnq ∨ + Disjoint (insert beta ({ D.theta } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors rho Tn ∨ + Disjoint (insert beta ({ D.theta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors rho A ∧ + TreeColorSetClosed G rho A ({ beta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A rho beta D.theta)) → + TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib)) = + TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast + beta hbetaMissing hbetaUnused hbetaStored houtside hcutoff POne hterm hUnused hzero + hbetaTheta ib hbFirst hibB hby hbt horder rho ettOne baseOne' COne' HOne qOne hmissingA + hbetaStoredOne hgammaPenOne hgammaTermOne hgammaWitnessOne' hfirstGammaOne hfirstThetaOne + hgammaUnusedOne hcaseOne hmissingPairOne hchangeOne + exact @helper_hsameTwo_814 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnotA) (@sameStar) (@sameLast) (@beta) (@hbetaMissing) (@hbetaUnused) + (@hbetaStored) (@houtside) (@hcutoff) (@POne) (@hterm) (@hUnused) (@hzero) + (@hbetaTheta) (@hbFirst) (@hibB) (@hby) (@hbt) (@horder) (@hmissingA) + (@hbetaStoredOne) (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') + (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) + (@hchangeOne) + +private theorem helper_branch_3639.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → + (∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma) → + (∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t)) → + ∀ (beta : Fin k) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → POne.coloring (T.edge t) = phi (T.edge t)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + T.vertex ib ∈ TreeSequenceVertexSet B → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + (beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) ∨ + beta ∈ TreeMissingColors rho A ∧ + beta ∉ TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds) ∧ + D.theta ∉ + TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds))) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + Disjoint + (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib))) → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + TwoColorPathComponent G rho beta D.theta z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho beta D.theta z) w = + MissingColors G rho w) → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c) → + TashkinovAugmentationSequence rho B T → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + beta ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c → + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ B.length) → + beta ∈ TreeMissingColors phi A → + ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), + MaximumProperty corrTwo.replacementETT ∧ + ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : + TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), + SameGoodHierarchy COne'.good goodTwo := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB + hBterminal hyB hElementary hnotA sameStar samePrefix sameTn sameLast commonPrefix + hcoreLength predecessorIncident seedStable weakEdges beta POne hfixed z hbetaTheta ib hibB + rho ettOne COne' HOne qOne hElementaryOne hthetaPenOne hgammaWitnessOne' hfirstGammaOne + hgammaUnusedOne hcaseOne hmissingPairOne hdisjointTwo muTwo hpathTwo hmissingTwo hstoredTwo + hsuffix hgammaCutoff hm + exact @helper_branch_2793 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) + (@hnotA) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) + (@hcoreLength) (@predecessorIncident) (@seedStable) (@weakEdges) (@beta) (@POne) + (@hfixed) (@hbetaTheta) (@hibB) (@hElementaryOne) (@hthetaPenOne) + (@hgammaWitnessOne') (@hfirstGammaOne) (@hgammaUnusedOne) (@hcaseOne) + (@hmissingPairOne) (@hdisjointTwo) (@hpathTwo) (@hmissingTwo) (@hstoredTwo) + (@hsuffix) (@hgammaCutoff) (@hm) + +private theorem helper_branch_3648.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment A T → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + ∀ beta ∉ HierarchyStoredColorsAt H q, + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ)) → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + beta ∉ TreeMissingColors phi A → + ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), + MaximumProperty corrTwo.replacementETT ∧ + ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : + TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), + SameGoodHierarchy COne'.good goodTwo := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT sameStar samePrefix sameLast + beta hbetaStored houtside POne z hbetaTheta ib horder firstAfter rho ettOne COne' + hElementaryOne hmissingA hgammaWitnessOne' hfirstGammaOne hfirstThetaOne hgammaUnusedOne + hmissingPairOne muTwo hm + exact @helper_branch_1087 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hAT) (@sameStar) (@samePrefix) (@sameLast) (@beta) (@hbetaStored) (@houtside) + (@POne) (@hbetaTheta) (@horder) (@firstAfter) (@hElementaryOne) (@hmissingA) + (@hgammaWitnessOne') (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) + (@hmissingPairOne) (@hm) + +private theorem helper_continuation_3998.{u_1, u_2} : + helperContinuation3998Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB + hBterminal hyB hElementary hnotA Bshort hshortT hshortB hterminalIncident firstWitness self + missingSubset firstPreserved sameStar samePrefix sameTn sameLast commonPrefix hcoreLength + predecessorIncident seedStable weakEdges beta hbetaStored houtside hcutoff POne hlast + hfixed z hbetaTheta ib hibB hyt horder firstAfter rho ettOne COne' ctxOne HOne qOne + hmissingOne' hElementaryOne hmissingA hthetaPenOne hgammaPenOne hgammaTermOne + hgammaWitnessOne' hfirstGammaOne hfirstThetaOne hgammaUnusedOne hcaseOne hmissingPairOne + hdisjointTwo muTwo hpathTwo hmissingTwo hstoredTwo + have hthetaLastOne : rho (T.edge D.lastEdgeIndex) = some D.theta := hlast + have hsuffix : TashkinovAugmentationSequence rho B T := by + exact @helper_hsuffix_885 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@beta) (@POne) (@hmissingPairOne) (@hthetaLastOne) + have hthetaBound : (HierarchyFirstMissingPosition rho T D.theta).val ≤ B.length := by + rw [hfirstThetaOne] + have hp := D.penultimateVertexPosition + clear * - hp hBlen + omega + have hgammaCutoff : ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + (beta ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c) → + (HierarchyFirstMissingPosition rho T c).val ≤ B.length := by + exact @helper_hgammaCutoff_901 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hElementary) (@hnotA) (@hshortT) (@hshortB) (@firstWitness) (@missingSubset) + (@firstPreserved) (@sameLast) (@beta) (@hcutoff) (@POne) (@hmissingOne') (@hthetaBound) + obtain ⟨corrTwo, hmaxTwo, baseTwo, KTwo, goodTwo, hsameGoodTwo⟩ : ∃ corrTwo : + CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T, + MaximumProperty corrTwo.replacementETT ∧ + ∃ baseTwo : HierarchyBase corrTwo.replacementETT muTwo, + ∃ KTwo : TashkinovHierarchy corrTwo.replacementETT baseTwo, + ∃ goodTwo : GoodHierarchy KTwo, SameGoodHierarchy COne'.good goodTwo := by + by_cases hm : beta ∈ TreeMissingColors phi A + · exact @helper_branch_3639 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hBlen) + (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) (@hnotA) (@sameStar) + (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) (@hcoreLength) (@predecessorIncident) + (@seedStable) (@weakEdges) (@beta) (@POne) (@hfixed) (@hbetaTheta) (@hibB) + (@hElementaryOne) (@hthetaPenOne) (@hgammaWitnessOne') (@hfirstGammaOne) + (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hdisjointTwo) (@hpathTwo) + (@hmissingTwo) (@hstoredTwo) (@hsuffix) (@hgammaCutoff) (@hm) + · exact @helper_branch_3648 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) (@sameStar) + (@samePrefix) (@sameLast) (@beta) (@hbetaStored) (@houtside) (@POne) (@hbetaTheta) + (@horder) (@firstAfter) (@hElementaryOne) (@hmissingA) (@hgammaWitnessOne') + (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) (@hmissingPairOne) (@hm) + have hlastComponent : Sum.inr (T.edge D.lastEdgeIndex) ∈ TwoColorComponent G rho beta + D.theta z := by + exact @helper_hlastComponent_1122 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hterminalIncident) (@beta) (@POne) (@hthetaLastOne) + have hlastTwo : muTwo (T.edge D.lastEdgeIndex) = some beta := by + simp [muTwo, TwoColorComponentSwap, hlastComponent, hthetaLastOne, hbetaTheta.symm] + have hthetaTermTwo : D.theta ∈ MissingColors G muTwo (T.vertex D.terminalVertexIndex) := + (TwoColorComponentSwapMissingBehavior G rho beta D.theta hbetaTheta ctxOne.proper z).2.1 + _ (self rho beta D.theta _) hgammaTermOne + have hthetaPenTwo : D.theta ∈ MissingColors G muTwo (T.vertex D.penultimateVertexIndex) := by + rw [hmissingTwo _ hyB] + exact hthetaPenOne + have hgammaPenTwo : beta ∉ MissingColors G muTwo (T.vertex D.penultimateVertexIndex) := by + rw [hmissingTwo _ hyB] + exact hgammaPenOne + let CTwo : HierarchyCounterexample baseTwo := + { positive := by rw [corrTwo.rungAgreement]; exact COne'.positive + hierarchy := KTwo + good := goodTwo + maximum := hmaxTwo + notElementary := by + intro he + have hy : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet T := by simp + [TreeSequenceVertexSet] + have ht : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet T := by simp + [TreeSequenceVertexSet] + exact Finset.disjoint_left.mp (he hy ht hyt) hthetaPenTwo hthetaTermTwo } + obtain ⟨PTwo, hPTwo⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx POne muTwo corrTwo baseTwo CTwo hsameGoodTwo + let tailTwo : HierarchySituationTwoTailData G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := + { tailAtLeastTwo := by + change 2 ≤ T.length - (HierarchyStarredStage PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount)).length + rw [sameStar PTwo] + exact htail + pathNumberFull := by + have hp := D.pathNumberFull + unfold HierarchyPathNumber HierarchyFullTailLength at hp ⊢ + dsimp only at hp ⊢ + rw [sameStar PTwo] + exact hp + lastEdgeIndex := D.lastEdgeIndex + penultimateVertexIndex := D.penultimateVertexIndex + terminalVertexIndex := D.terminalVertexIndex + lastEdgePosition := D.lastEdgePosition + penultimateVertexPosition := D.penultimateVertexPosition + terminalVertexPosition := D.terminalVertexPosition + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate + theta := beta + thetaOnLastEdge := hPTwo.symm ▸ hlastTwo + thetaPresentPenultimate := hPTwo.symm ▸ hgammaPenTwo } + by_cases hstored : D.theta ∈ HierarchyStoredColorsAt PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount) + · obtain ⟨g1, g2, hne, hpair⟩ := Finset.card_eq_two.mp + (PTwo.counterexample.good.twoColors _ D.theta hstored) + let finalData : HierarchySituationTwoCaseOneData G k e0 + PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := + { toHierarchySituationTwoTailData := tailTwo + alpha := D.theta + gammaOne := g1 + gammaTwo := g2 + alphaMissingPenultimate := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.penultimateVertexIndex) + rw [hPTwo] + exact hthetaPenTwo + alphaMissingTerminal := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.terminalVertexIndex) + rw [hPTwo] + exact hthetaTermTwo + alphaStored := hstored + gammaPair := hpair + gammaDistinct := hne } + exact HierarchySituationTwoSubcaseOneOne G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext finalData + · let finalData : HierarchySituationTwoCaseTwoData G k e0 + PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := + { toHierarchySituationTwoTailData := tailTwo + alpha := D.theta + alphaMissingPenultimate := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.penultimateVertexIndex) + rw [hPTwo] + exact hthetaPenTwo + alphaMissingTerminal := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.terminalVertexIndex) + rw [hPTwo] + exact hthetaTermTwo + alphaOutsideStored := hstored } + exact HierarchySituationTwoSubcaseTwoOne G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext finalData + +private theorem helper_finish_3305.{u_1, u_2} : + helperFinish3305Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB + hBterminal hyB hElementary hfirstTheta hnotA Bshort hshortLen hshortT hshortB + hterminalIncident firstWitness self missingSubset leaf separate prefixMissing + firstPreserved firstUnaffected sameStar samePrefix sameTn sameLast commonPrefix hcoreLength + predecessorIncident seedStable weakEdges beta hbetaMissing hbetaUnused hbetaStored houtside + hcutoff POne hprefix hterm hlast hfixed hUnused hzero + as_aux_lemma => + let z : Sum V E := Sum.inl (T.vertex D.terminalVertexIndex) + have hbetaTheta : beta ≠ D.theta := by + exact @helper_hbetaTheta_660 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@beta) (@hbetaUnused) + let ib := HierarchyFirstMissingPosition phi T beta + have hbFirst := firstWitness phi Bshort hshortT beta hbetaMissing + have hibB : T.vertex ib ∈ TreeSequenceVertexSet B := by + let i : Fin (Bshort.length + 1) := ⟨ib.val, by have := hbFirst.2; omega⟩ + exact TreeSequenceInitialSegmentVertexSetSubset hshortB + ((@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, Finset.mem_univ _, rfl⟩) + have hby : T.vertex ib ≠ T.vertex D.penultimateVertexIndex := by + exact @helper_hby_672 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hshortLen) + (@beta) (@hbFirst) + have hbt : T.vertex ib ≠ T.vertex D.terminalVertexIndex := by + exact @helper_hbt_679 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hshortLen) + (@beta) (@hbFirst) + have hyt : T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex := by + exact @helper_hyt_686 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + have horder : TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) := + ⟨ib, D.penultimateVertexIndex, rfl, rfl, by + have hb : ib.val ≤ Bshort.length := hbFirst.2 + have hp := D.penultimateVertexPosition + clear * - hb hp hshortLen + omega⟩ + have firstAfter (rho : PartialEdgeColoring E k) (c : Fin k) + (hc : c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c))) + (hn : c ∉ TreeMissingColors rho A) : + A.length < (HierarchyFirstMissingPosition rho T c).val := by + exact @helper_firstAfter_699 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) (@rho) + (@c) (@hc) (@hn) + let rho := POne.coloring + let ettOne := POne.corresponding.replacementETT + let baseOne' := POne.replacementBase + let COne' := POne.counterexample + let ctxOne := POne.minimumContext + let HOne := COne'.hierarchy + let qOne : Fin (HOne.dividerCount + 1) := Fin.last HOne.dividerCount + have hmissingOne' : ∀ v ∈ TreeSequenceVertexSet B, + MissingColors G rho v = MissingColors G phi v := by + exact hprefix + have hElementaryOne : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) := by + intro u hu v hv huv + rw [hmissingOne' u hu, hmissingOne' v hv] + exact hElementary hu hv huv + have missingEq (X : TreeSequence G e0) (hXB : TreeSequenceInitialSegment X B) : + TreeMissingColors rho X = TreeMissingColors phi X := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => + hmissingOne' v (TreeSequenceInitialSegmentVertexSetSubset hXB hv)) + have hmissingA := missingEq A hAB + have hbetaStoredOne : beta ∉ HierarchyStoredColorsAt HOne qOne := by + rw [← (sameLast POne).1] + exact hbetaStored + have hthetaPenOne : D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) := by + rw [hmissingOne' _ hyB] + exact D.thetaMissingPenultimate + have hgammaPenOne : beta ∉ MissingColors G rho (T.vertex D.penultimateVertexIndex) := by + rw [hmissingOne' _ hyB] + intro hm + exact Finset.disjoint_left.mp (hElementary hibB hyB hby) hbFirst.1 hm + have hgammaTermOne : beta ∈ MissingColors G rho (T.vertex D.terminalVertexIndex) := by + exact hterm + have hgammaWitnessOne' : beta ∈ MissingColors G rho (T.vertex ib) := by + rw [hmissingOne' _ hibB] + exact hbFirst.1 + have hfirstGammaOne : HierarchyFirstMissingPosition rho T beta = ib := + firstPreserved phi rho beta hElementary hmissingOne' + (Finset.mem_biUnion.mpr ⟨_, hibB, hbFirst.1⟩) + have hfirstThetaOne : HierarchyFirstMissingPosition rho T D.theta = + D.penultimateVertexIndex := + (firstPreserved phi rho D.theta hElementary hmissingOne' + (Finset.mem_biUnion.mpr ⟨_, hyB, D.thetaMissingPenultimate⟩)).trans hfirstTheta + have hgammaUnusedOne : ∀ t : Fin T.length, A.length ≤ t.val → + rho (T.edge t) ≠ some beta := by + exact hUnused + have hcaseOne (hm : beta ∈ TreeMissingColors phi A) : + (0 < HOne.dividerCount ∧ beta ∈ TreeMissingColors rho + (HOne.stage ⟨HOne.dividerCount, by omega⟩)) ∨ + (HOne.dividerCount = 0 ∧ + (beta ∈ TreeMissingColors rho + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) ∨ + (beta ∈ TreeMissingColors rho A ∧ + beta ∉ TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds) ∧ + D.theta ∉ TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds)))) := by + exact @helper_hcaseOne_757 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@sameStar) (@beta) (@POne) (@hzero) (@hmissingA) (@hm) + have hmissingPairOne : beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B := + ⟨Finset.mem_biUnion.mpr ⟨_, hibB, hgammaWitnessOne'⟩, + Finset.mem_biUnion.mpr ⟨_, hyB, hthetaPenOne⟩⟩ + have hchangeOne := ChangeLemma G k e0 POne.corresponding.replacementInput T rho ettOne + baseOne' COne' ctxOne.proper ctxOne.oneEdgeUncolored ctxOne.lowerRung + ctxOne.fewerDividers ctxOne.lexicographicMinimality + (by + change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' + - 1))) + rw [samePrefix POne] + exact hElementaryOne) + ctxOne.largeMissingSet beta D.theta hbetaTheta + (by + change beta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) ∧ + D.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) + rw [samePrefix POne] + exact hmissingPairOne) + (by + dsimp only + rw [sameStar POne, hfirstGammaOne, hfirstThetaOne] + intro _ + refine ⟨horder, ?_⟩ + intro hc + obtain ⟨t, ht, _, he⟩ := (Finset.mem_filter.mp hc).2 + exact hgammaUnusedOne t ht he) + have hsameTwo : TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib)) = + TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + exact @helper_hsameTwo_3578 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnotA) (@sameStar) (@sameLast) (@beta) (@hbetaMissing) (@hbetaUnused) (@hbetaStored) + (@houtside) (@hcutoff) (@POne) (@hterm) (@hUnused) (@hzero) (@hbetaTheta) (@hbFirst) + (@hibB) (@hby) (@hbt) (@horder) (@hmissingA) (@hbetaStoredOne) (@hgammaPenOne) + (@hgammaTermOne) (@hgammaWitnessOne') (@hfirstGammaOne) (@hfirstThetaOne) + (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hchangeOne) + have hdisjointTwo := separate rho beta D.theta hbetaTheta ctxOne.proper + (T.vertex ib) (T.vertex D.penultimateVertexIndex) (T.vertex D.terminalVertexIndex) + hby hbt hyt hgammaWitnessOne' hthetaPenOne (Or.inl hgammaTermOne) hsameTwo + let muTwo := TwoColorComponentSwap G rho beta D.theta z + have hpathTwo : TwoColorPathComponent G rho beta D.theta z := + ⟨hbetaTheta, _, self rho beta D.theta _, + leaf rho beta D.theta hbetaTheta ctxOne.proper _ (Or.inl hgammaTermOne)⟩ + have houtsideBetaTwo : Sum.inl (T.vertex ib) ∉ TwoColorComponent G rho beta D.theta z := by + intro hm + exact Set.disjoint_left.mp hdisjointTwo hm (self rho beta D.theta _) + have houtsideThetaTwo : Sum.inl (T.vertex D.penultimateVertexIndex) ∉ + TwoColorComponent G rho beta D.theta z := by + intro hm + apply Set.disjoint_left.mp hdisjointTwo hm + rw [hsameTwo] + exact self rho beta D.theta _ + have hmissingTwo := prefixMissing z rho beta D.theta hbetaTheta ctxOne.proper + hElementaryOne _ _ hibB hyB hgammaWitnessOne' hthetaPenOne + houtsideBetaTwo houtsideThetaTwo + have hstoredTwo : ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c := by + exact @helper_hstoredTwo_876 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@firstPreserved) (@firstUnaffected) (@beta) (@POne) (@hbetaTheta) (@hElementaryOne) + (@hbetaStoredOne) (@hmissingPairOne) (@hmissingTwo) + exact @helper_continuation_3998 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) + (@hnotA) (@hshortT) (@hshortB) (@hterminalIncident) (@firstWitness) (@self) + (@missingSubset) (@firstPreserved) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) + (@commonPrefix) (@hcoreLength) (@predecessorIncident) (@seedStable) (@weakEdges) (@beta) + (@hbetaStored) (@houtside) (@hcutoff) (@POne) (@hlast) (@hfixed) (@hbetaTheta) (@hibB) + (@hyt) (@horder) (@firstAfter) (@hmissingOne') (@hElementaryOne) (@hmissingA) + (@hthetaPenOne) (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') (@hfirstGammaOne) + (@hfirstThetaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hdisjointTwo) + (@hpathTwo) (@hmissingTwo) (@hstoredTwo) +private theorem helper_continuation_3031.{u_1, u_2} : + helperContinuation3031Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hApositive hAzero + hAT hAB hBterminal hyB hElementary hfirstTheta hnotA Bshort hshortLen hshortT hshortB + hterminalIncident firstWitness self missingSubset leaf separate separateAny prefixMissing + firstPreserved firstUnaffected seriesFacts corrRefl + let PRefl : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { coloring := phi + corresponding := corrRefl + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + minimumContext := ctx } + have sameStar (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = A := by + exact @helper_sameStar_518 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have samePrefix (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1) = B + := by + simp only [HierarchyFullTailPrefix, HierarchyFullTailLength, sameStar P] + rfl + have sameTn (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + have hs := (Fin.heq_fun_iff + (congrArg (fun n => n + 2) P.sameGood.1.2.1)).mp P.sameGood.1.2.2.1 0 + exact P.counterexample.hierarchy.baseStage.symm.trans (hs.symm.trans H.baseStage) + have sameLast (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = P.counterexample.good.gamma + (Fin.last P.counterexample.hierarchy.dividerCount) eta := by + obtain ⟨hc, hd⟩ := P.sameGood.2 + have hi : Fin.cast (congrArg (fun n => n + 1) hc) q = + Fin.last P.counterexample.hierarchy.dividerCount := Fin.ext hc + simpa only [hi] using hd q + have commonPrefix {X Y F : TreeSequence G e0} + (hXF : TreeSequenceInitialSegment X F) (hYF : TreeSequenceInitialSegment Y F) + (hXY : X.length ≤ Y.length) : TreeSequenceInitialSegment X Y := by + exact @helper_commonPrefix_557 (@V) (@E) (@G) (@e0) (@X) (@Y) (@F) (@hXF) (@hYF) (@hXY) + have hcoreLength : base.core.length ≤ A.length := by + exact @helper_hcoreLength_566 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hApositive) (@hAzero) + have predecessorIncident (X : TreeSequence G e0) + (hXT : TreeSequenceInitialSegment X T) (t : Fin T.length) + (ht : t.val = X.length) : TreeIncidentEdge X (T.edge t) := by + exact @helper_predecessorIncident_575 (@V) (@E) inferInstance inferInstance (@G) (@e0) (@T) + (@X) (@hXT) (@t) (@ht) + have seedStable {input' : PartialEdgeColoring E k} + (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) + (base' : HierarchyBase ett' rho) (K : TashkinovHierarchy ett' base') + (hw : HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma) + (hq : K.dividerCount = 0) : + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma := by + exact @helper_seedStable_587 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@input') (@rho) (@sigma) (@ett') (@base') (@K) (@hw) + (@hq) + have weakEdges {input' : PartialEdgeColoring E k} + (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) + (base' : HierarchyBase ett' old) (K : TashkinovHierarchy ett' base') + (hw : HierarchyWeaklyStable K (Fin.last K.dividerCount) new) + (ho : IsOneEdgeUncolored old e0) (hno : IsOneEdgeUncolored new e0) : + ∀ t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length, + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by + exact @helper_weakEdges_603 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@T) (@input') (@old) (@new) (@ett') (@base') (@K) (@hw) (@ho) (@hno) + -- Swap the last-edge color, preserving the certified prefix route and Gamma cutoffs. + have finish (beta : Fin k) + (hbetaMissing : beta ∈ TreeMissingColors phi Bshort) + (hbetaUnused : ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some beta) + (hbetaStored : beta ∉ HierarchyStoredColorsAt H q) + (houtside : beta ∉ TreeMissingColors phi A → + D.theta ∉ HierarchyStoredColorsAt H q) + (hcutoff : ∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hprefix : ∀ v ∈ TreeSequenceVertexSet B, + MissingColors G POne.coloring v = MissingColors G phi v) + (hterm : beta ∈ MissingColors G POne.coloring (T.vertex D.terminalVertexIndex)) + (hlast : POne.coloring (T.edge D.lastEdgeIndex) = some D.theta) + (hfixed : ∀ t : Fin T.length, A.length ≤ t.val → + POne.coloring (T.edge t) = phi (T.edge t)) + (hUnused : ∀ t : Fin T.length, A.length ≤ t.val → + POne.coloring (T.edge t) ≠ some beta) + (hzero : POne.counterexample.hierarchy.dividerCount = 0 → + beta ∈ TreeMissingColors POne.coloring A → + beta ∈ TreeMissingColors POne.coloring + (POne.corresponding.replacementETT.series.data.tree + (Fin.last POne.corresponding.replacementETT.rounds).castSucc) ∨ + (beta ∉ TashkinovStoredColors POne.corresponding.replacementETT.series.data + (Fin.last POne.corresponding.replacementETT.rounds) ∧ + D.theta ∉ TashkinovStoredColors POne.corresponding.replacementETT.series.data + (Fin.last POne.corresponding.replacementETT.rounds))) : False := by + exact @helper_finish_3305 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hBlen) + (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) (@hfirstTheta) + (@hnotA) (@hshortLen) (@hshortT) (@hshortB) (@hterminalIncident) (@firstWitness) (@self) + (@missingSubset) (@leaf) (@separate) (@prefixMissing) (@firstPreserved) + (@firstUnaffected) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) + (@hcoreLength) (@predecessorIncident) (@seedStable) (@weakEdges) (@beta) (@hbetaMissing) + (@hbetaUnused) (@hbetaStored) (@houtside) (@hcutoff) (@POne) (@hprefix) (@hterm) (@hlast) + (@hfixed) (@hUnused) (@hzero) + -- A tail-unused stage color can replace alpha without changing any tail edge. + exact @helper_continuation_3433 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hBlen) (@hBT) (@hApositive) (@hAzero) (@hAT) (@hAB) (@hElementary) (@hfirstTheta) + (@hnotA) (@hshortLen) (@hshortT) (@hshortB) (@firstWitness) (@self) (@missingSubset) + (@leaf) (@separateAny) (@prefixMissing) (@firstPreserved) (@firstUnaffected) (@seriesFacts) + (@sameTn) (@commonPrefix) (@finish) +theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeTwoData + G k e0 input T phi ett base C ctx) : + False := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + have htail : 2 ≤ T.length - A.length := D.tailAtLeastTwo + have hBlen : B.length + 1 = T.length := by + simp only [B, HierarchyFullTailPrefix, HierarchyFullTailLength, + TreeSequencePrefix] + change min (A.length + (T.length - A.length - 1)) T.length + 1 = T.length + omega + have hBT : TreeSequenceInitialSegment B T := by + exact @helper_hBT_116 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBlen) + have hApositive (hq : 0 < H.dividerCount) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact @helper_hApositive_123 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hq) + have hAzero (hq : H.dividerCount = 0) : A = base.core := by + have hi : q = 0 := by apply Fin.ext; simp [q, hq] + change HierarchyStarredStage H q = _ + rw [hi] + rfl + have hAT : TreeSequenceInitialSegment A T := by + exact @helper_hAT_141 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hApositive) (@hAzero) + have hAB : TreeSequenceInitialSegment A B := by + exact @helper_hAB_153 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htail) (@hBlen) (@hApositive) + (@hAzero) (@hAT) + have hBterminal : B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex := by + exact @helper_hBterminal_159 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) + have hyB : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last B.length, hBterminal⟩ + have hElementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have firstAt {c : Fin k} + (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by + exact @helper_firstAt_173 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hyB) + (@hElementary) (@c) (@hc) + have hfirstTheta := firstAt D.thetaMissingPenultimate + have hnotA {c : Fin k} + (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + c ∉ TreeMissingColors phi A := by + exact @helper_hnotA_197 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hApositive) (@hAzero) (@hAT) (@hAB) (@hyB) (@hElementary) (@c) (@hc) + let Bshort := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2) + have hshortLen : Bshort.length + 2 = T.length := by + change min (A.length + (T.length - A.length - 2)) T.length + 2 = T.length + omega + have hshortT : TreeSequenceInitialSegment Bshort T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hshortB : TreeSequenceInitialSegment Bshort B := by + exact @helper_hshortB_220 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hshortLen) + have hterminalIncident : + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) := by + exact @helper_hterminalIncident_226 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hshortLen) + have firstWitness (rho : PartialEdgeColoring E k) (X : TreeSequence G e0) + (hXT : TreeSequenceInitialSegment X T) (c : Fin k) + (hc : c ∈ TreeMissingColors rho X) : + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (HierarchyFirstMissingPosition rho T c).val ≤ X.length := by + exact @helper_firstWitness_238 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@rho) (@X) (@hXT) (@c) (@hc) + have self (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := by + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl v) = _ + rfl + have missingSubset (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) : + TreeMissingColors rho X ⊆ TreeMissingColors rho Y := by + exact @helper_missingSubset_269 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@rho) + (@X) (@Y) (@hXY) + have leaf (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) (v : V) + (hm : a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v) : + Set.Subsingleton ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)) := by + exact @helper_leaf_278 (@V) (@E) inferInstance inferInstance (@G) (@k) (@rho) (@a) (@b) + (@hne) (@hp) (@v) (@hm) + have separate (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) (u v w : V) + (huv : u ≠ v) (huw : u ≠ w) (hvw : v ≠ w) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hw : a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w) + (hsame : TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v)) : + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + exact @helper_separate_297 (@V) (@E) inferInstance inferInstance + (@G) (@k) (@self) (@leaf) (@rho) (@a) (@b) (@hne) (@hp) (@u) (@v) (@w) (@huv) (@huw) + (@hvw) (@hu) (@hv) (@hw) (@hsame) + -- Coincident first witnesses miss both colors, so their component is isolated. + have separateAny (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) (u v w : V) + (huw : u ≠ w) (hvw : v ≠ w) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hw : a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w) + (hsame : TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v)) : + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + exact @helper_separateAny_332 (@V) (@E) inferInstance inferInstance (@G) (@k) + (@self) (@separate) (@rho) (@a) (@b) (@hne) (@hp) (@u) (@v) (@w) (@huw) (@hvw) (@hu) + (@hv) (@hw) (@hsame) + have prefixMissing (z : Sum V E) (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) + (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B)) + (u v : V) (huB : u ∈ TreeSequenceVertexSet B) (hvB : v ∈ TreeSequenceVertexSet B) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hdu : Sum.inl u ∉ TwoColorComponent G rho a b z) + (hdv : Sum.inl v ∉ TwoColorComponent G rho a b z) : + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by + exact @helper_prefixMissing_366 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@z) (@rho) (@a) + (@b) (@hne) (@hp) (@helem) (@u) (@v) (@huB) (@hvB) (@hu) (@hv) (@hdu) (@hdv) + have firstPreserved (rho sigma : PartialEdgeColoring E k) (c : Fin k) + (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B)) + (hmiss : ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) + (hc : c ∈ TreeMissingColors rho B) : + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + exact @helper_firstPreserved_424 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBT) + (@firstWitness) (@rho) (@sigma) (@c) (@helem) (@hmiss) (@hc) + have firstUnaffected (z : Sum V E) (rho : PartialEdgeColoring E k) (a b c : Fin k) + (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (hca : c ≠ a) (hcb : c ≠ b) : + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c := by + exact @helper_firstUnaffected_449 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@z) (@rho) (@a) (@b) (@c) (@hne) (@hp) (@hca) (@hcb) + have seriesFacts : ∀ j : Fin (ett.rounds + 1), + IsProperEdgeColoring G (ett.series.data.coloring j) ∧ + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + exact @helper_seriesFacts_464 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) + let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := fun j => (seriesFacts j).1 + replacementOneUncolored := fun j => (seriesFacts j).2 + replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } + exact @helper_continuation_3031 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hBlen) (@hBT) (@hApositive) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) + (@hfirstTheta) (@hnotA) (@hshortLen) (@hshortT) (@hshortB) (@hterminalIncident) + (@firstWitness) (@self) (@missingSubset) (@leaf) (@separate) (@separateAny) + (@prefixMissing) (@firstPreserved) (@firstUnaffected) (@seriesFacts) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOne.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOne.lean new file mode 100644 index 0000000000..9825ecf3ab --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOne.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOneNonexceptional +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOneStoredException + +/-! +# Hierarchy Situation Two Subcase Two One + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchySituationTwoSubcaseTwoOne {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData + G k e0 input T phi ett base C ctx) : + False := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + by_cases hexceptional : ∃ eta, + eta ∈ HierarchyStoredColorsAt H q ∧ + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) ∧ + D.theta ∈ C.good.gamma q eta + · rcases hexceptional with ⟨eta, hetaStored, hetaMissing, hthetaPair⟩ + exact HierarchySituationTwoSubcaseTwoOneStoredException + G k e0 input T phi ett base C ctx D eta + (by simpa [q, H] using hetaStored) hetaMissing + (by simpa [q, H] using hthetaPair) + · exact HierarchySituationTwoSubcaseTwoOneNonexceptional + G k e0 input T phi ett base C ctx D + (by simpa [q, H] using hexceptional) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean new file mode 100644 index 0000000000..24dcbe3be5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean @@ -0,0 +1,5027 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoExclusions +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.NineN +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovStoredColorsCardinality +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo + +/-! +# Hierarchy Situation Two Subcase Two One Nonexceptional + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperHendsTerminal1091Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) (beta : Fin k), + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.terminalVertexIndex)) → + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + let yt : V := T.vertex D.terminalVertexIndex; + let graph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi beta D.alpha; + ∀ (a b : V ⊕ E), + ( + ∀ (w : V), + Sum.inl w ∈ TwoColorComponent G phi beta D.alpha (Sum.inl vb) → + @SimpleGraph.degree (Sum V E) graph (@Sum.inl V E w) + (@Fintype.ofFinite + (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))) + (@Subtype.finite (Sum V E) + (@Finite.instSum V E (@Finite.of_fintype V inst) (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))))) ≤ + (1 : ℕ) → + Sum.inl w = a ∨ Sum.inl w = b) → + ( + ∀ (w : V), + D.alpha ∈ MissingColors G phi w → + @SimpleGraph.degree (Sum V E) graph (@Sum.inl V E w) + (@Fintype.ofFinite + (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))) + (@Subtype.finite (Sum V E) + (@Finite.instSum V E (@Finite.of_fintype V inst) (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))))) ≤ + (1 : ℕ)) → + Sum.inl yt = a ∨ Sum.inl yt = b + +private noncomputable abbrev helperCStar1926.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoCaseTwoData G k e0 input T phi ett + base C ctx) → + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi + ett base C ctx D.toHierarchySituationTwoTailData) → + (corrStar : + CorrespondingExtendedTashkinovTree G k e0 ett phi + R.star) → + MaximumProperty corrStar.replacementETT → + (baseStar : + HierarchyBase corrStar.replacementETT phi) → + (HStar : + TashkinovHierarchy corrStar.replacementETT + baseStar) → + GoodHierarchy HStar → + HierarchyCounterexample baseStar := by + classical + intro V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D R corrStar hstarMP + baseStar HStar goodStar + exact { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst + inst_1 inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C + ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx + D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C + ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + phi ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx + D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx + D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))) + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + corrStar + have := GoldbergSeymour.TreeSequence.positive T + omega))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C), + hierarchy := HStar, good := goodStar, maximum := hstarMP, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C + ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 + inst_2 inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C) : + HierarchyCounterexample baseStar }; + +private abbrev helperContinuation3768Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (htail : (2 : ℕ) ≤ ell) (hell : ell = T.length - A.length) (hsum : A.length + ell = T.length) + (hBlen : B.length = T.length - (2 : ℕ)) (hBT : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hminusCount : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (hstarMP : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (hstarCount : HStar.dividerCount = C.hierarchy.dividerCount) + (hstarLen : R.star.length = R.minus.length + (1 : ℕ)) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (hminusLen : R.minus.length = B.length + (1 : ℕ)) (hstarLength : R.star.length = T.length) + (beta : Fin k) + (hbetaUnused : + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) + (hcolorsDistinct : beta ≠ D.alpha) + (firstMissingMem : + ∀ (S : TreeSequence G e0) (c : Fin k) (hc : c ∈ TreeMissingColors phi S), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (hbetaT : beta ∈ TreeMissingColors phi T) + (hbetaFirstBound : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (hDnDisjoint : Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) + (hcomponentPenultimate : + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex))) + (hBstar : TreeSequenceInitialSegment B R.star) + (hstarFirstEdge : + ∀ (r : Fin R.star.length) (hr : (↑r : ℕ) = B.length), + R.star.edge r = T.edge D.lastEdgeIndex) + (terminalData : + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree n.castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn) + (goodStar : GoodHierarchy HStar) + (hstarStarred : HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A), + let ibeta : Fin (B.length + (1 : ℕ)) := + (⟨(↑(HierarchyFirstMissingPosition phi T beta) : ℕ), by omega⟩ : Fin (B.length + (1 : ℕ))); + ∀ + (hibeta : + Fin.castLE (Nat.succ_le_succ hBT.1) ibeta = HierarchyFirstMissingPosition phi T beta), + let CStar : HierarchyCounterexample baseStar := + { + positive := by + first + | omega + | ( + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corrStar + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.ExtendedTashkinovTree.roundsPositive ett + have := GoldbergSeymour.HierarchyCounterexample.positive C + have := hBT.1 + have := hminusStar.1 + have := hBstar.1 + have := congrArg GoldbergSeymour.TreeSequence.length hstarStarred + all_goals omega), + hierarchy := HStar, good := goodStar, maximum := hstarMP, + notElementary := + ((Eq.symm + (id + (congrArg (fun (_a : Finset V) ↦ ¬ColoredVertexSetElementary G phi _a) + R.starVertexSet))) ▸ + C.notElementary) : + HierarchyCounterexample baseStar }; + ∀ + (ctxStar : + HierarchyMinimumCounterexampleContext G k e0 corrStar.replacementInput R.star phi + corrStar.replacementETT baseStar CStar) + (hprefixStarElementary : + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet + (HierarchyFullTailPrefix CStar (HierarchyFullTailLength CStar - (1 : ℕ))))), + let iaStar : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length); + ∀ (hiaStar : (↑iaStar : ℕ) = R.minus.length) + (halphaStarVertex : R.star.vertex iaStar = T.vertex D.terminalVertexIndex) + (halphaFirstStar : HierarchyFirstMissingPosition phi R.star D.alpha = iaStar) + (hbetaStarBound : (↑(HierarchyFirstMissingPosition phi R.star beta) : ℕ) ≤ B.length) + (hbetaStarVertex : + R.star.vertex (HierarchyFirstMissingPosition phi R.star beta) = + T.vertex (HierarchyFirstMissingPosition phi T beta)) + (hmissingStar : + beta ∈ + TreeMissingColors phi + (HierarchyFullTailPrefix CStar (HierarchyFullTailLength CStar - (1 : ℕ))) ∧ + D.alpha ∈ + TreeMissingColors phi + (HierarchyFullTailPrefix CStar (HierarchyFullTailLength CStar - (1 : ℕ)))), + False + +private abbrev helperContinuation3898Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (htail : (2 : ℕ) ≤ ell) (hell : ell = T.length - A.length) (hsum : A.length + ell = T.length) + (hBlen : B.length = T.length - (2 : ℕ)) (hBT : TreeSequenceInitialSegment B T) + (halpha : + D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hminusCount : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (hstarMP : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (hstarCount : HStar.dividerCount = C.hierarchy.dividerCount) + (hstarStages : + ∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), + HStar.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) + (hBminus : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) + R.minus) + (hstarLen : R.star.length = R.minus.length + (1 : ℕ)) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (hminusLen : R.minus.length = B.length + (1 : ℕ)) (hstarLength : R.star.length = T.length) + (beta : Fin k) (hbetaMissing : beta ∈ TreeMissingColors phi B) + (hbetaUnused : + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) + (hcolorsDistinct : beta ≠ D.alpha) + (firstMissingLe : + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) + (hc : c ∈ MissingColors G phi (S.vertex i)), + HierarchyFirstMissingPosition phi S c ≤ i) + (firstMissingMem : + ∀ (S : TreeSequence G e0) (c : Fin k) (hc : c ∈ TreeMissingColors phi S), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (vertexMem : + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) + (missingMono : + ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U), + TreeMissingColors phi S ⊆ TreeMissingColors phi U) + (hbetaT : beta ∈ TreeMissingColors phi T) + (hbetaFirstBound : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (hDnDisjoint : Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) + (hcomponentPenultimate : + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex))) + (hBstar : TreeSequenceInitialSegment B R.star) + (hstarFirstEdge : + ∀ (r : Fin R.star.length) (hr : (↑r : ℕ) = B.length), + R.star.edge r = T.edge D.lastEdgeIndex) + (terminalData : + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree n.castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn) + (goodStar : GoodHierarchy HStar) + (hstarLastIndex : + Fin.cast + (by + first + | omega + | ( + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corrStar + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.ExtendedTashkinovTree.roundsPositive ett + have := GoldbergSeymour.HierarchyCounterexample.positive C + have := hBT.1 + have := hBminus.1 + have := hminusStar.1 + have := hBstar.1 + try dsimp only [H] at * + try dsimp only [GoldbergSeymour.HierarchyFullTailLength] at * + try dsimp only [GoldbergSeymour.HierarchyFullTailPrefix] at * + try dsimp only [GoldbergSeymour.TreeSequencePrefix] at * + all_goals omega)) + (Fin.last HStar.dividerCount) = + q) + (hstarStarred : HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A), + let ibeta : Fin (B.length + (1 : ℕ)) := + (⟨(↑(HierarchyFirstMissingPosition phi T beta) : ℕ), by omega⟩ : Fin (B.length + (1 : ℕ))); + ∀ + (hibeta : Fin.castLE (Nat.succ_le_succ hBT.1) ibeta = HierarchyFirstMissingPosition phi T beta) + (hbetaAtB : beta ∈ MissingColors G phi (B.vertex ibeta)), + let CStar : HierarchyCounterexample baseStar := + { + positive := by + first + | omega + | ( + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corrStar + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.ExtendedTashkinovTree.roundsPositive ett + have := GoldbergSeymour.HierarchyCounterexample.positive C + have := hBT.1 + have := hBminus.1 + have := hminusStar.1 + have := hBstar.1 + have := congrArg GoldbergSeymour.TreeSequence.length hstarStarred + try dsimp only [H] at * + try dsimp only [GoldbergSeymour.HierarchyFullTailLength] at * + try dsimp only [GoldbergSeymour.HierarchyFullTailPrefix] at * + try dsimp only [GoldbergSeymour.TreeSequencePrefix] at * + all_goals omega), + hierarchy := HStar, good := goodStar, maximum := hstarMP, + notElementary := + ((Eq.symm + (id + (congrArg (fun (_a : Finset V) ↦ ¬ColoredVertexSetElementary G phi _a) + R.starVertexSet))) ▸ + C.notElementary) : + HierarchyCounterexample baseStar }; + ∀ (hstarPath : HierarchyPathNumber HStar = HierarchyPathNumber H), + False + +private abbrev helperContinuation4102Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (htail : (2 : ℕ) ≤ ell) (hell : ell = T.length - A.length) (hsum : A.length + ell = T.length) + (hBlen : B.length = T.length - (2 : ℕ)) (hBT : TreeSequenceInitialSegment B T) + (halpha : + D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (hminusMP : MaximumProperty corrMinus.replacementETT) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (hminusCore : baseMinus.core = base.core) (hminusClosure : baseMinus.closure = base.closure) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hminusCount : HMinus.dividerCount = C.hierarchy.dividerCount) + (hminusStages : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HMinus.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (hstarMP : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) (hstarCore : baseStar.core = base.core) + (hstarClosure : baseStar.closure = base.closure) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (hstarCount : HStar.dividerCount = C.hierarchy.dividerCount) + (hstarStages : + ∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), + HStar.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) + (hBminus : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) + R.minus) + (hstarLen : R.star.length = R.minus.length + (1 : ℕ)) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (hminusLen : R.minus.length = B.length + (1 : ℕ)) (hstarLength : R.star.length = T.length) + (beta : Fin k) (hbetaMissing : beta ∈ TreeMissingColors phi B) + (hbetaUnused : + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) + (hcolorsDistinct : beta ≠ D.alpha) + (firstMissingLe : + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) + (hc : c ∈ MissingColors G phi (S.vertex i)), + HierarchyFirstMissingPosition phi S c ≤ i) + (firstMissingMem : + ∀ (S : TreeSequence G e0) (c : Fin k) (hc : c ∈ TreeMissingColors phi S), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (vertexMem : + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) + (missingMono : + ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U), + TreeMissingColors phi S ⊆ TreeMissingColors phi U) + (hbetaT : beta ∈ TreeMissingColors phi T) + (hbetaFirstBound : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (hDnDisjoint : Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) + (hcomponentPenultimate : + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex))) + (hminusTerminalAvoidance : + ∀ eta ∈ HierarchyStoredColorsAt H q, + Disjoint (C.good.gamma q eta) + ({c : Fin k | + ∃ (r : Fin R.minus.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi R.minus eta) : ℕ) R.minus.length ∧ + phi (R.minus.edge r) = some c} : + Finset (Fin k))) + (hBstar : TreeSequenceInitialSegment B R.star) + (hstarFirstEdge : + ∀ (r : Fin R.star.length) (hr : (↑r : ℕ) = B.length), + R.star.edge r = T.edge D.lastEdgeIndex) + (hstarTerminalAvoidance : + ∀ eta ∈ HierarchyStoredColorsAt H q, + Disjoint (C.good.gamma q eta) + ({c : Fin k | + ∃ (r : Fin R.star.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi R.star eta) : ℕ) R.star.length ∧ + phi (R.star.edge r) = some c} : + Finset (Fin k))) + (terminalData : + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree n.castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn) + (copyGood : + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corr.replacementETT phi) (hcore : baseU.core = base.core) + (hclosure : baseU.closure = base.closure) (K : TashkinovHierarchy corr.replacementETT baseU) + (hcount : K.dividerCount = H.dividerCount) + (hstages : + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = H.stage (Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j).castSucc) + (hBU : TreeSequenceInitialSegment B U) + (havoid : + ∀ eta ∈ HierarchyStoredColorsAt H q, + Disjoint (C.good.gamma q eta) + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k))), + ∃ (goodU : GoodHierarchy K), + ∀ (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k), + goodU.gamma j eta = C.good.gamma (Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) j) eta), + False + +private abbrev helperContinuation4235Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (htail : (2 : ℕ) ≤ ell) (hell : ell = T.length - A.length) (hsum : A.length + ell = T.length) + (hBlen : B.length = T.length - (2 : ℕ)) (hBT : TreeSequenceInitialSegment B T) + (halpha : + D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (hminusMP : MaximumProperty corrMinus.replacementETT) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (hminusCore : baseMinus.core = base.core) (hminusClosure : baseMinus.closure = base.closure) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hminusCount : HMinus.dividerCount = C.hierarchy.dividerCount) + (hminusStages : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HMinus.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (hstarMP : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) (hstarCore : baseStar.core = base.core) + (hstarClosure : baseStar.closure = base.closure) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (hstarCount : HStar.dividerCount = C.hierarchy.dividerCount) + (hstarStages : + ∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), + HStar.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) + (hBminus : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) + R.minus) + (hstarLen : R.star.length = R.minus.length + (1 : ℕ)) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (hstarEdge : + R.star.edge (Fin.cast (by omega) (Fin.last R.minus.length)) = T.edge R.penultimateEdgeIndex) + (hminusLen : R.minus.length = B.length + (1 : ℕ)) (hstarLength : R.star.length = T.length) + (beta : Fin k) (hbetaMissing : beta ∈ TreeMissingColors phi B) + (hbetaUnused : + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) + (hcolorsDistinct : beta ≠ D.alpha) + (firstMissingLe : + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) + (hc : c ∈ MissingColors G phi (S.vertex i)), + HierarchyFirstMissingPosition phi S c ≤ i) + (firstMissingMem : + ∀ (S : TreeSequence G e0) (c : Fin k) (hc : c ∈ TreeMissingColors phi S), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (vertexMem : + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) + (missingMono : + ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U), + TreeMissingColors phi S ⊆ TreeMissingColors phi U) + (hbetaT : beta ∈ TreeMissingColors phi T) + (hbetaFirstBound : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (hDnDisjoint : Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) + (hcomponentPenultimate : + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex))) + (terminalAvoidance : + ∀ (U : TreeSequence G e0) (hBU : TreeSequenceInitialSegment B U) + (hlen : U.length ≤ B.length + (2 : ℕ)) + (hfirstEdge : + ∀ (r : Fin U.length), + (↑r : ℕ) = B.length → + U.edge r = T.edge D.lastEdgeIndex) + (hsecondEdge : + ∀ (r : Fin U.length), + (↑r : ℕ) = B.length + (1 : ℕ) → + U.edge r = T.edge R.penultimateEdgeIndex), + ∀ eta ∈ HierarchyStoredColorsAt H q, + Disjoint (C.good.gamma q eta) + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k))) + (hminusFirstEdge : + ∀ (r : Fin R.minus.length) (hr : (↑r : ℕ) = B.length), + R.minus.edge r = T.edge D.lastEdgeIndex) + (hminusTerminalAvoidance : + ∀ eta ∈ HierarchyStoredColorsAt H q, + Disjoint (C.good.gamma q eta) + ({c : Fin k | + ∃ (r : Fin R.minus.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi R.minus eta) : ℕ) R.minus.length ∧ + phi (R.minus.edge r) = some c} : + Finset (Fin k))) + (hBstar : TreeSequenceInitialSegment B R.star), + False + +private abbrev transferredGoodHierarchyConstructorType.{u_1, u_2} (V : Type u_1) (E : Type u_2) := + open scoped Classical in + + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoCaseTwoData G k e0 input T phi ett + base C ctx) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := + TashkinovStoredColors ett.series.data n; + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi + ett base C ctx D.toHierarchySituationTwoTailData) → + (corrMinus : + CorrespondingExtendedTashkinovTree G k e0 ett phi + R.minus) → + (baseMinus : + HierarchyBase corrMinus.replacementETT phi) → + TashkinovHierarchy corrMinus.replacementETT + baseMinus → + (corrStar : + CorrespondingExtendedTashkinovTree G k e0 ett + phi R.star) → + (baseStar : + HierarchyBase corrStar.replacementETT phi) → + TashkinovHierarchy corrStar.replacementETT + baseStar → + Fin k → + (U : TreeSequence G e0) → + (corr : + CorrespondingExtendedTashkinovTree G k + e0 ett phi U) → + (baseU : + HierarchyBase corr.replacementETT + phi) → + baseU.core = base.core → + baseU.closure = base.closure → + (K : + TashkinovHierarchy + corr.replacementETT baseU) → + (hcount : + K.dividerCount = + H.dividerCount) → + (∀ + eta ∈ + HierarchyStoredColorsAt + H q, + Disjoint + (C.good.gamma q eta) + ({c : Fin k | + ∃ (r : + Fin U.length), + A.length ≤ + (↑r : ℕ) ∧ + (↑r : ℕ) < + min + (↑(HierarchyFirstMissingPosition + phi + U + eta) : + ℕ) + U.length ∧ + phi + (U.edge + r) = + some c} : + Finset (Fin k))) → + let index : + Fin + (K.dividerCount + + (1 : ℕ)) → + Fin + (H.dividerCount + + (1 : ℕ)) := + fun + (j : + Fin + (K.dividerCount + + (1 : ℕ))) ↦ + Fin.cast + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + corr + have := + GoldbergSeymour.TreeSequence.positive + T + have := + GoldbergSeymour.TreeSequence.positive + U + omega) + j; + let _ : + Fin + (K.dividerCount + + (1 : ℕ)) → + Fin k → + Finset (Fin k) := + fun + (j : + Fin + (K.dividerCount + + (1 : ℕ))) + (eta : Fin k) ↦ + C.good.gamma (index j) + eta; + corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc = + ett.series.data.tree + n.castSucc ∧ + corr.replacementETT.series.data.kind + (Fin.last + corr.replacementETT.rounds) = + ett.series.data.kind + n ∧ + TashkinovStoredColors + corr.replacementETT.series.data + (Fin.last + corr.replacementETT.rounds) = + Dn → + ( + ∀ + (j : + Fin + (K.dividerCount + + (1 : ℕ))), + K.stage j.castSucc = + H.stage + (index + j).castSucc) → + ( + ∀ + (j : + Fin + (K.dividerCount + + (1 : ℕ))), + HierarchyStarredStage + K j = + HierarchyStarredStage + H (index j)) → + ( + ∀ + (j : + Fin + (K.dividerCount + + (1 : ℕ))), + HierarchyStoredColorsAt + K j = + HierarchyStoredColorsAt + H (index j)) → + ( + ∀ + (j : + Fin + (K.dividerCount + + (1 : ℕ))), + HierarchyStageMissingColors + K j = + HierarchyStageMissingColors + H + (index j)) → + ( + ∀ + (i : + Fin + K.dividerCount) + (eta : Fin k), + HierarchySegmentColors + K + i.castSucc + eta = + HierarchySegmentColors + H + (index + i.castSucc) + eta) → + index + (Fin.last + K.dividerCount) = + q → + ( + ∀ + (eta : + Fin k), + HierarchySegmentColors + K + (Fin.last + K.dividerCount) + eta = + ({c : + Fin + k | + ∃ (r + : + Fin + U.length), + A.length ≤ + (↑r : + ℕ) ∧ + (↑r : + ℕ) < + min + (↑(HierarchyFirstMissingPosition + phi + U + eta) : + ℕ) + U.length ∧ + phi + (U.edge + r) = + some + c} : + Finset + (Fin + k))) → + GoodHierarchy + K + +private theorem helper_hfinalCard_138.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + let finalColors : Finset (Fin k) := + ({c : Fin k | phi (T.edge R.penultimateEdgeIndex) = some c} : Finset (Fin k)) ∪ + ({c : Fin k | phi (T.edge D.lastEdgeIndex) = some c} : Finset (Fin k)); + ( + ∀ (f : E), + ({c : Fin k | phi f = some c} : Finset (Fin k)).card ≤ (1 : ℕ)) → + finalColors.card ≤ (2 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D R corrMinus baseMinus HMinus corrStar + baseStar HStar finalColors singleColorCard + have hu := Finset.card_union_le + (Finset.univ.filter fun c => phi (T.edge R.penultimateEdgeIndex) = some c) + (Finset.univ.filter fun c => phi (T.edge D.lastEdgeIndex) = some c) + have hp := singleColorCard (T.edge R.penultimateEdgeIndex) + have hl := singleColorCard (T.edge D.lastEdgeIndex) + dsimp [finalColors] + omega + +private theorem helper_hremaining_149.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + let baseExtraMissing : Finset (Fin k) := + (TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet (ett.series.data.tree n.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v; + let prefixUsed : Finset (Fin k) := + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi (T.edge r) = some c} : + Finset (Fin k)); + let available : Finset (Fin k) := + (TreeMissingColors phi B \ baseExtraMissing) \ prefixUsed; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ available.card → + let finalColors : Finset (Fin k) := + ({c : Fin k | phi (T.edge R.penultimateEdgeIndex) = some c} : Finset (Fin k)) ∪ + ({c : Fin k | phi (T.edge D.lastEdgeIndex) = some c} : Finset (Fin k)); + finalColors.card ≤ (2 : ℕ) → + Dn.card ≤ ett.rounds → + ett.rounds + (9 : ℕ) ≤ ((available \ finalColors) \ Dn).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn R corrMinus baseMinus + HMinus corrStar baseStar HStar baseExtraMissing prefixUsed available havailable finalColors + hfinalCard hDnCard + have hfirst := Finset.card_le_card_sdiff_add_card + (s := available) (t := finalColors) + have hsecond := Finset.card_le_card_sdiff_add_card + (s := available \ finalColors) (t := Dn) + omega + +private theorem helper_hbetaUnused_164.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + A.length + ell = T.length → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + R.star.length = T.length → + let prefixUsed : Finset (Fin k) := + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi (T.edge r) = some c} : + Finset (Fin k)); + let finalColors : Finset (Fin k) := + ({c : Fin k | phi (T.edge R.penultimateEdgeIndex) = some c} : Finset (Fin k)) ∪ + ({c : Fin k | phi (T.edge D.lastEdgeIndex) = some c} : Finset (Fin k)); + ∀ beta ∉ finalColors, + beta ∉ prefixUsed → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell htail hell hsum R corrMinus + baseMinus HMinus corrStar baseStar HStar hstarLen hstarLength prefixUsed finalColors beta + hbetaFinal hbetaPrefixUnused t ht hcolor + by_cases hbefore : t.val < A.length + (ell - 2) + · exact hbetaPrefixUnused (Finset.mem_filter.mpr + ⟨Finset.mem_univ _, t, ht, hbefore, hcolor⟩) + · have hp := R.penultimateEdgePosition + have hl := D.lastEdgePosition + have htlt := t.isLt + have hindices : t = R.penultimateEdgeIndex ∨ t = D.lastEdgeIndex := by + by_cases heq : t.val = R.penultimateEdgeIndex.val + · exact Or.inl (Fin.ext heq) + · right + apply Fin.ext + omega + apply hbetaFinal + rcases hindices with rfl | rfl + · exact Finset.mem_union_left _ + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, hcolor⟩) + · exact Finset.mem_union_right _ + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, hcolor⟩) + +private theorem helper_firstMissingLe_188.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))), + c ∈ MissingColors G phi (S.vertex i) → + HierarchyFirstMissingPosition phi S c ≤ i := by + classical + intro V E _ _ G k e0 phi S c i hc + let _ := Fintype.ofFinite V + let candidates : Finset (Fin (S.length + 1)) := + Finset.univ.filter fun j => c ∈ MissingColors G phi (S.vertex j) + have hi : i ∈ candidates := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hc⟩ + have hn : candidates.Nonempty := ⟨i, hi⟩ + have heq : HierarchyFirstMissingPosition phi S c = candidates.min' hn := by + simp [HierarchyFirstMissingPosition, candidates, hn] + rw [heq] + exact Finset.min'_le _ _ hi + +private theorem helper_firstMissingMem_201.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (S : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi S, + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c)) := by + classical + intro V E _ _ G k e0 phi S c hc + let _ := Fintype.ofFinite V + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hv' : ∃ i, i ∈ Finset.univ ∧ S.vertex i = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image] using hv + obtain ⟨i, _, hvi⟩ := hv' + let candidates : Finset (Fin (S.length + 1)) := + Finset.univ.filter fun j => c ∈ MissingColors G phi (S.vertex j) + have hi : i ∈ candidates := by + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, hvi.symm ▸ hcv⟩ + have hn : candidates.Nonempty := ⟨i, hi⟩ + have heq : HierarchyFirstMissingPosition phi S c = candidates.min' hn := by + simp [HierarchyFirstMissingPosition, candidates, hn] + rw [heq] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + +private theorem helper_missingMono_224.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeMissingColors phi S ⊆ TreeMissingColors phi U := by + classical + intro V E _ _ G k e0 phi S U hSU c hc + let _ := Fintype.ofFinite V + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hv' : ∃ i, i ∈ Finset.univ ∧ S.vertex i = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image] using hv + obtain ⟨i, _, hvi⟩ := hv' + have hvU : v ∈ TreeSequenceVertexSet U := by + simpa only [TreeSequenceVertexSet] using + ((@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨Fin.castLE (Nat.succ_le_succ hSU.1) i, Finset.mem_univ _, + (hSU.2.1 i).trans hvi⟩) + exact Finset.mem_biUnion.mpr + ⟨v, hvU, hcv⟩ + +private theorem helper_hbetaFirstBound_243.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + B.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment B T → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + R.star.length = T.length → + ∀ beta ∈ TreeMissingColors phi B, + ( + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))), + c ∈ MissingColors G phi (S.vertex i) → + HierarchyFirstMissingPosition phi S c ≤ i) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen hBT R corrMinus baseMinus + HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta hbetaMissing firstMissingLe + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hbetaMissing + have hv' : ∃ i, i ∈ Finset.univ ∧ B.vertex i = v := by + simpa only [TreeSequenceVertexSet, Finset.mem_image] using hv + obtain ⟨i, _, hvi⟩ := hv' + have hc : beta ∈ MissingColors G phi + (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) i)) := by + rw [hBT.2.1 i, hvi] + exact hcv + have hle := firstMissingLe T beta _ hc + change (HierarchyFirstMissingPosition phi T beta).val ≤ i.val at hle + have hi := i.isLt + omega + +private theorem helper_halphaFirst_256.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + B.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment B T → + (D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + R.star.length = T.length → + ∀ (_ : Fin k), + ( + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))), + c ∈ MissingColors G phi (S.vertex i) → + HierarchyFirstMissingPosition phi S c ≤ i) → + ( + ∀ (S : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi S, + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) → + ( + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) → + D.alpha ∈ TreeMissingColors phi T → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn hBlen hBT halpha R + corrMinus baseMinus HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta + firstMissingLe firstMissingMem vertexMem halphaT + have hle := firstMissingLe T D.alpha D.penultimateVertexIndex + D.alphaMissingPenultimate + have hm := firstMissingMem T D.alpha halphaT + have hp := D.penultimateVertexPosition + apply Fin.ext + change (HierarchyFirstMissingPosition phi T D.alpha).val ≤ + D.penultimateVertexIndex.val at hle + by_contra hne + have hbound : (HierarchyFirstMissingPosition phi T D.alpha).val ≤ B.length := by + omega + let ib : Fin (B.length + 1) := + ⟨(HierarchyFirstMissingPosition phi T D.alpha).val, by omega⟩ + have heq : Fin.castLE (Nat.succ_le_succ hBT.1) ib = + HierarchyFirstMissingPosition phi T D.alpha := Fin.ext rfl + have hmB : D.alpha ∈ MissingColors G phi (B.vertex ib) := by + rw [← hBT.2.1 ib, heq] + exact hm + exact halpha.1 (Finset.mem_biUnion.mpr ⟨_, vertexMem B ib, hmB⟩) + +private theorem helper_halphaPrefix_278.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + Bplus.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment Bplus T → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + R.minus.length = T.length - (1 : ℕ) → + R.star.length = T.length → + ∀ (_ : Fin k), + ( + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) → + D.alpha ∈ TreeMissingColors phi Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell Bplus hBpluslen hBplusT R corrMinus + baseMinus HMinus corrStar baseStar HStar hstarLen hminusLength hstarLength beta vertexMem + let i : Fin (Bplus.length + 1) := Fin.last Bplus.length + have heq : Fin.castLE (Nat.succ_le_succ hBplusT.1) i = + D.penultimateVertexIndex := by + apply Fin.ext + change Bplus.length = D.penultimateVertexIndex.val + have hp := D.penultimateVertexPosition + omega + apply Finset.mem_biUnion.mpr + refine ⟨_, vertexMem Bplus i, ?_⟩ + rw [← hBplusT.2.1 i, heq] + exact D.alphaMissingPenultimate + +private theorem helper_horderedUnused_290.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + B.length = T.length - (2 : ℕ) → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + R.star.length = T.length → + ∀ (beta : Fin k), + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + beta ∉ TreeMissingColors phi A ∨ D.alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T beta)) + (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ + beta ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T D.alpha) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B hBlen R corrMinus baseMinus + HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta hbetaUnused + hbetaFirstBound halphaFirst _ + refine ⟨?_, ?_⟩ + · refine ⟨_, _, rfl, rfl, ?_⟩ + rw [halphaFirst] + have hp := D.penultimateVertexPosition + change (HierarchyFirstMissingPosition phi T beta).val < + D.penultimateVertexIndex.val + omega + · intro hm + obtain ⟨_, t, ht, _, hcolor⟩ := Finset.mem_filter.mp hm + exact hbetaUnused t ht hcolor + +private theorem helper_hDnDisjoint_310.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData), + let baseExtraMissing : Finset (Fin k) := + (TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet (ett.series.data.tree n.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v; + let prefixUsed : Finset (Fin k) := + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi (T.edge r) = some c} : + Finset (Fin k)); + let available : Finset (Fin k) := + (TreeMissingColors phi B \ baseExtraMissing) \ prefixUsed; + let finalColors : Finset (Fin k) := + ({c : Fin k | phi (T.edge R.penultimateEdgeIndex) = some c} : Finset (Fin k)) ∪ + ({c : Fin k | phi (T.edge D.lastEdgeIndex) = some c} : Finset (Fin k)); + ∀ beta ∈ (available \ finalColors) \ Dn, + beta ∈ available \ finalColors → + beta ∉ Dn → + beta ∈ available → + beta ∉ finalColors → + beta ∈ TreeMissingColors phi B \ baseExtraMissing → + beta ∉ prefixUsed → + beta ∈ TreeMissingColors phi B → + beta ∉ baseExtraMissing → + ( + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) → + beta ≠ D.alpha → + beta ∈ TreeMissingColors phi T → + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length → + beta ∈ TreeMissingColors phi Bplus → + ( + beta ∉ TreeMissingColors phi A ∨ D.alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T beta)) + (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ + beta ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T D.alpha) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k))) → + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B Bplus n Dn halpha R + baseExtraMissing prefixUsed available finalColors beta hbeta hbetaAvailableFinal hbetaDn + hbetaAvailable hbetaFinal hbetaMissingExtra hbetaPrefixUnused hbetaMissing hbetaExtra + hbetaUnused hcolorsDistinct hbetaT hbetaFirstBound hbetaPrefix horderedUnused + rw [Finset.disjoint_left] + intro c hc hd + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with rfl | rfl + · exact hbetaDn hd + · exact halpha.2.1 hd + +private theorem helper_hcomponentPenultimate_325.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (beta : Fin k), + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn → + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + (HierarchyStoredColorsAt H q) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi beta D.alpha (Sum.inl va) = + TwoColorComponent G phi beta D.alpha (Sum.inl vb); + ( + (0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + ( + H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + ( + beta ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q n Dn R corrMinus baseMinus HMinus + corrStar baseStar HStar beta halphaFirst hDnDisjoint hDnqDisjoint hchange + have hc : TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T D.alpha))) := by + by_cases hq : 0 < H.dividerCount + · exact hchange.1 ⟨hq, Or.inr hDnqDisjoint⟩ + · have hqzero : H.dividerCount = 0 := by omega + exact hchange.2.1 ⟨hqzero, Or.inr hDnDisjoint⟩ + simpa [halphaFirst] using hc + +private theorem helper_firstMissingMemBelow_339.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (_ : Fin k) + (S : TreeSequence G e0) (c : Fin k), + (↑(HierarchyFirstMissingPosition phi S c) : ℕ) < S.length → + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D R corrMinus baseMinus HMinus corrStar + baseStar HStar beta S c hlt + let candidates : Finset (Fin (S.length + 1)) := + Finset.univ.filter fun j => c ∈ MissingColors G phi (S.vertex j) + by_cases hn : candidates.Nonempty + · have heq : HierarchyFirstMissingPosition phi S c = candidates.min' hn := by + simp [HierarchyFirstMissingPosition, candidates, hn] + rw [heq] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have heq : HierarchyFirstMissingPosition phi S c = Fin.last S.length := by + simp [HierarchyFirstMissingPosition, candidates, hn] + rw [heq] at hlt + simp only [Fin.val_last] at hlt + omega + +private theorem helper_firstLowerInOld_356.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + B.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment B T → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + R.star.length = T.length → + ∀ (_ : Fin k), + ( + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))), + c ∈ MissingColors G phi (S.vertex i) → + HierarchyFirstMissingPosition phi S c ≤ i) → + ( + ∀ (S : TreeSequence G e0) (c : Fin k), + (↑(HierarchyFirstMissingPosition phi S c) : ℕ) < S.length → + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) → + ∀ (U : TreeSequence G e0), + TreeSequenceInitialSegment B U → + ∀ (eta : Fin k), + ∀ r ≤ B.length, + r < (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) → + r < (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen hBT R corrMinus baseMinus + HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta firstMissingLe + firstMissingMemBelow U hBU eta r hrB hrU + by_contra hnot + have hpB : (HierarchyFirstMissingPosition phi T eta).val ≤ B.length := by omega + have hpT : (HierarchyFirstMissingPosition phi T eta).val < T.length := by omega + have hm := firstMissingMemBelow T eta hpT + let i : Fin (B.length + 1) := + ⟨(HierarchyFirstMissingPosition phi T eta).val, by omega⟩ + have hiT : Fin.castLE (Nat.succ_le_succ hBT.1) i = + HierarchyFirstMissingPosition phi T eta := Fin.ext rfl + have hmU : eta ∈ MissingColors G phi + (U.vertex (Fin.castLE (Nat.succ_le_succ hBU.1) i)) := by + rw [hBU.2.1 i, ← hBT.2.1 i, hiT] + exact hm + have hle := firstMissingLe U eta _ hmU + change (HierarchyFirstMissingPosition phi U eta).val ≤ + (HierarchyFirstMissingPosition phi T eta).val at hle + omega + +private theorem helper_oldSegmentMember_377.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (eta c : Fin k) (r : Fin T.length), + A.length ≤ (↑r : ℕ) → + (↑r : ℕ) < (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) → + phi (T.edge r) = some c → + c ∈ HierarchySegmentColors H q eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A eta c r hlo hhi hcolor + have hq : q.succ = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [q] + unfold HierarchySegmentColors + change c ∈ Finset.univ.filter (fun c => + ∃ r : Fin (H.stage q.succ).length, A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi T eta).val + (H.stage q.succ).length ∧ phi ((H.stage q.succ).edge r) = some c) + rw [hq, H.terminalStage] + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, r, hlo, ?_, hcolor⟩ + exact lt_min hhi r.isLt + +private theorem helper_terminalAvoidance_394.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + ( + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ¬∃ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) ∧ + D.theta ∈ C.good.gamma q eta) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + A.length + ell = T.length → + B.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment B T → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + R.star.length = T.length → + ∀ (_ : Fin k), + ( + ∀ (S : TreeSequence G e0) (c : Fin k), + (↑(HierarchyFirstMissingPosition phi S c) : ℕ) < S.length → + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) → + (∀ (U : TreeSequence G e0), + TreeSequenceInitialSegment B U → + ∀ (eta : Fin k), + ∀ r ≤ B.length, + r < (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) → + r < (↑(HierarchyFirstMissingPosition phi T eta) : ℕ)) → + ( + ∀ (eta c : Fin k) (r : Fin T.length), + A.length ≤ (↑r : ℕ) → + (↑r : ℕ) < (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) → + phi (T.edge r) = some c → + c ∈ HierarchySegmentColors H q eta) → + ∀ (U : TreeSequence G e0), + TreeSequenceInitialSegment B U → + U.length ≤ B.length + (2 : ℕ) → + ( + ∀ (r : Fin U.length), + (↑r : ℕ) = B.length → + U.edge r = T.edge D.lastEdgeIndex) → + ( + ∀ (r : Fin U.length), + (↑r : ℕ) = B.length + (1 : ℕ) → + U.edge r = T.edge R.penultimateEdgeIndex) → + ∀ eta ∈ HierarchyStoredColorsAt H q, + Disjoint (C.good.gamma q eta) + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hnonexceptional H q A ell B htail hell + hsum hBlen hBT R corrMinus baseMinus HMinus corrStar baseStar HStar hstarLen hminusLen + hstarLength beta firstMissingMemBelow firstLowerInOld oldSegmentMember U hBU hlen + hfirstEdge hsecondEdge eta heta + rw [Finset.disjoint_left] + intro c hc hused + obtain ⟨_, r, hlo, hhi, hcolor⟩ := Finset.mem_filter.mp hused + have hrU : r.val < (HierarchyFirstMissingPosition phi U eta).val := + lt_of_lt_of_le hhi (Nat.min_le_left _ _) + have hnotOld : c ∉ HierarchySegmentColors H q eta := + (Finset.mem_sdiff.mp (C.good.avoidance q eta heta hc)).2 + by_cases hrB : r.val < B.length + · let rb : Fin B.length := ⟨r.val, hrB⟩ + let rt : Fin T.length := Fin.castLE hBT.1 rb + have hru : Fin.castLE hBU.1 rb = r := Fin.ext rfl + have hedge : U.edge r = T.edge rt := by + rw [← hru, hBU.2.2 rb, hBT.2.2 rb] + have hcolorOld : phi (T.edge rt) = some c := by + rw [← hedge] + exact hcolor + have hfirst := firstLowerInOld U hBU eta r.val (by omega) hrU + exact hnotOld (oldSegmentMember eta c rt hlo hfirst hcolorOld) + · have hrlt := r.isLt + have hpositions : r.val = B.length ∨ r.val = B.length + 1 := by omega + rcases hpositions with hfirst | hsecond + · have hcolorTheta : c = D.theta := by + rw [hfirstEdge r hfirst] at hcolor + exact Option.some.inj (hcolor.symm.trans D.thetaOnLastEdge) + have hpOld := firstLowerInOld U hBU eta B.length le_rfl (by omega) + have hl := D.lastEdgePosition + have hp := D.penultimateVertexPosition + have hpBound : (HierarchyFirstMissingPosition phi T eta).val ≤ + D.lastEdgeIndex.val := by + by_contra hnot + apply hnotOld + apply oldSegmentMember eta c D.lastEdgeIndex + · omega + · omega + · rw [hcolorTheta] + exact D.thetaOnLastEdge + have hfirstPenultimate : HierarchyFirstMissingPosition phi T eta = + D.penultimateVertexIndex := by + apply Fin.ext + omega + have hm := firstMissingMemBelow T eta (by omega) + rw [hfirstPenultimate] at hm + exact hnonexceptional ⟨eta, heta, hm, hcolorTheta ▸ hc⟩ + · have hpOld := firstLowerInOld U hBU eta B.length le_rfl (by omega) + have hp := R.penultimateEdgePosition + apply hnotOld + apply oldSegmentMember eta c R.penultimateEdgeIndex + · omega + · omega + · rw [← hsecondEdge r hsecond] + exact hcolor + +private theorem helper_hBstar_471.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData), + TreeSequenceInitialSegment + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) R.minus → + TreeSequenceInitialSegment R.minus R.star → + TreeSequenceInitialSegment B R.star := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B R hBminus hminusStar + refine ⟨le_trans hBminus.1 hminusStar.1, ?_, ?_⟩ + · intro i + exact (hminusStar.2.1 + (Fin.castLE (Nat.succ_le_succ hBminus.1) i)).trans (hBminus.2.1 i) + · intro i + exact (hminusStar.2.2 (Fin.castLE hBminus.1 i)).trans (hBminus.2.2 i) + +private theorem helper_hstarSecondEdge_484.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + B.length = T.length - (2 : ℕ) → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) + (hstarLen : R.star.length = R.minus.length + (1 : ℕ)), + R.star.edge + (Fin.cast + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (Fin.last R.minus.length)) = + T.edge R.penultimateEdgeIndex → + R.minus.length = B.length + (1 : ℕ) → + ∀ (_ : Fin k) (r : Fin R.star.length), + (↑r : ℕ) = B.length + (1 : ℕ) → + R.star.edge r = T.edge R.penultimateEdgeIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen R corrMinus baseMinus HMinus + corrStar baseStar HStar hstarLen hstarEdge hminusLen beta r hr + have hi : r = Fin.cast hstarLen.symm (Fin.last R.minus.length) := by + apply Fin.ext + change r.val = R.minus.length + omega + rw [hi] + exact hstarEdge + +private theorem helper_terminalData_494.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (_ : Fin k) + (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree n.castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D n Dn R corrMinus baseMinus HMinus + corrStar baseStar HStar beta U corr + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have seriesSame : replacementData = replacementSeries := + eq_of_heq seriesPresentation + cases seriesSame + let i : Fin ett.rounds := ⟨ett.rounds - 1, by have hp := C.positive; omega⟩ + have hi : i.succ = n := by + apply Fin.ext + simp only [Fin.val_succ] + change ett.rounds - 1 + 1 = ett.rounds + have hp := C.positive + omega + have htree : replacementSeries.data.tree n.castSucc = + ett.series.data.tree n.castSucc := by + rw [← hi] + exact ladderTreesAgree i + refine ⟨htree, extensionKindsAgree n, ?_⟩ + change TashkinovStoredColors replacementSeries.data n = Dn + dsimp [Dn] + unfold TashkinovStoredColors + have hn : n.val ≠ 0 := by simpa [n] using Nat.ne_of_gt C.positive + simp only [ite_eq_right hn] + simp_rw [storedColorsAgree] + rw [← finalGeneratingColoring, htree, ← ett.generatingColoring] + +private theorem helper_hApositive_533.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (_ : Fin k), + (0 : ℕ) < H.dividerCount → + A = H.stage q.castSucc := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A R corrMinus baseMinus HMinus + corrStar baseStar HStar beta hq + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hz + simp [q] at hv + omega + · dsimp [A] + rw [hi] + rfl + +private theorem helper_starredEq_570.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corr.replacementETT phi), + baseU.core = base.core → + ∀ (K : TashkinovHierarchy corr.replacementETT baseU) + (hcount : K.dividerCount = H.dividerCount), + let index : + Fin (K.dividerCount + (1 : ℕ)) → + Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive U + omega) + j; + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = H.stage (index j).castSucc) → + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H (index j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H U corr baseU hcore K hcount index stageEq j + obtain rfl | ⟨i, rfl⟩ := Fin.eq_zero_or_eq_succ j + · have hi : index 0 = 0 := Fin.ext rfl + rw [hi] + exact hcore + · have hi : index i.succ = (Fin.cast hcount i).succ := Fin.ext rfl + rw [hi] + simp only [HierarchyStarredStage, Fin.cases_succ] + have hs := stageEq i.succ + rw [hi] at hs + exact hs + +private theorem helper_missingEq_587.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT baseU) + (hcount : K.dividerCount = H.dividerCount), + let index : + Fin (K.dividerCount + (1 : ℕ)) → + Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive U + omega) + j; + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree n.castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = H.stage (index j).castSucc) → + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = HierarchyStageMissingColors H (index j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H n Dn U corr baseU K hcount index hdata stageEq j + obtain rfl | ⟨i, rfl⟩ := Fin.eq_zero_or_eq_succ j + · have hi : index 0 = 0 := Fin.ext rfl + rw [hi] + simpa only [HierarchyStageMissingColors, Fin.cases_zero] using + congrArg (TreeMissingColors phi) hdata.1 + · have hi : index i.succ = (Fin.cast hcount i).succ := Fin.ext rfl + rw [hi] + simp only [HierarchyStageMissingColors, Fin.cases_succ] + have hs := stageEq i.succ + rw [hi] at hs + exact congrArg (TreeMissingColors phi) hs + +private theorem helper_segmentEqInternal_600.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + A.length + ell = T.length → + B.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment B T → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar), + R.star.length = R.minus.length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + R.star.length = T.length → + ∀ (_ : Fin k), + ( + (0 : ℕ) < H.dividerCount → + A = H.stage q.castSucc) → + (Monotone fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ (H.stage j).length) → + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT baseU) + (hcount : K.dividerCount = H.dividerCount), + TreeSequenceInitialSegment B U → + let index : + Fin (K.dividerCount + (1 : ℕ)) → + Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive U + omega) + j; + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = H.stage (index j).castSucc) → + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H (index j)) → + ∀ (i : Fin K.dividerCount) (eta : Fin k), + HierarchySegmentColors K i.castSucc eta = + HierarchySegmentColors H (index i.castSucc) eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B htail hell hsum hBlen hBT R + corrMinus baseMinus HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta + hApositive stageLengthMono U corr baseU K hcount hBU index stageEq starredEq i eta + let io : Fin H.dividerCount := Fin.cast hcount i + have hnext : (index i.castSucc).succ = (index i.succ).castSucc := Fin.ext rfl + have hinext : i.castSucc.succ = i.succ.castSucc := Fin.ext rfl + have hL : (H.stage (index i.succ).castSucc).length ≤ B.length := by + have hpos : 0 < H.dividerCount := Nat.zero_lt_of_lt io.isLt + have hle : (index i.succ).castSucc ≤ q.castSucc := by + change io.val + 1 ≤ H.dividerCount + omega + have hlen := stageLengthMono hle + change (H.stage (index i.succ).castSucc).length ≤ + (H.stage q.castSucc).length at hlen + rw [← hApositive hpos] at hlen + omega + have hcU := HierarchyFirstMissingPositionPrefixCutoff phi B U hBU eta + (H.stage (index i.succ).castSucc).length hL + have hcT := HierarchyFirstMissingPositionPrefixCutoff phi B T hBT eta + (H.stage (index i.succ).castSucc).length hL + have hcut := hcU.symm.trans hcT + unfold HierarchySegmentColors + dsimp only + rw [hinext, stageEq i.succ, hnext, starredEq i.castSucc, hcut] + +private theorem helper_terminalSegmentEq_627.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT baseU) + (hcount : K.dividerCount = H.dividerCount), + let index : + Fin (K.dividerCount + (1 : ℕ)) → + Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive U + omega) + j; + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H (index j)) → + index (Fin.last K.dividerCount) = q → + ∀ (eta : Fin k), + HierarchySegmentColors K (Fin.last K.dividerCount) eta = + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A U corr baseU K hcount index starredEq + indexLast eta + unfold HierarchySegmentColors + dsimp only + have hi : (Fin.last K.dividerCount).succ = + Fin.last (K.dividerCount + 1) := Fin.ext rfl + rw [hi, K.terminalStage, starredEq, indexLast] + +private theorem helper_branch_659.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (_ : Fin k) + (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT baseU) + (hcount : K.dividerCount = H.dividerCount), + (∀ eta ∈ HierarchyStoredColorsAt H q, + Disjoint (C.good.gamma q eta) + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k))) → + let index : + Fin (K.dividerCount + (1 : ℕ)) → + Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive U + omega) + j; + let gammaU : + Fin (K.dividerCount + (1 : ℕ)) → + Fin k → + Finset (Fin k) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ C.good.gamma (index j) eta; + index (Fin.last K.dividerCount) = q → + ( + ∀ (eta : Fin k), + HierarchySegmentColors K (Fin.last K.dividerCount) eta = + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k))) → + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt K j, + ∀ ⦃c : Fin k⦄, + c ∈ gammaU j eta → + eta ∈ HierarchyStoredColorsAt H (index j) → + c ∈ C.good.gamma (index j) eta → + c ∈ HierarchyStageMissingColors C.hierarchy (index j) ∧ + c ∉ HierarchySegmentColors C.hierarchy (index j) eta → + c ∈ HierarchySegmentColors K j eta → + ¬(↑j : ℕ) < K.dividerCount → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A R corrMinus baseMinus HMinus + corrStar baseStar HStar beta U corr baseU K hcount havoid index gammaU indexLast + terminalSegmentEq j eta heta c hc hetaOld hcOld hold hseg hj + have hi : j = Fin.last K.dividerCount := by apply Fin.ext; simp; omega + subst j + rw [terminalSegmentEq] at hseg + rw [indexLast] at hetaOld hcOld + exact Finset.disjoint_left.mp (havoid eta hetaOld) hcOld hseg + +private theorem helper_branch_677.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT baseU) + (hcount : K.dividerCount = H.dividerCount), + let index : + Fin (K.dividerCount + (1 : ℕ)) → + Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive U + omega) + j; + let gammaU : + Fin (K.dividerCount + (1 : ℕ)) → + Fin k → + Finset (Fin k) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ C.good.gamma (index j) eta; + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = H.stage (index j).castSucc) → + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H (index j)) → + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H (index j)) → + ∀ (i : Fin K.dividerCount), + let io : Fin H.dividerCount := Fin.cast hcount i; + io.succ = index i.succ → + io.castSucc = index i.castSucc → + ∀ (eta : Fin k), + (eta ∈ HierarchyStoredColorsAt C.hierarchy io.succ ∧ + (C.good.gamma io.succ eta ⊆ + (TreeSequenceVertexSet (C.hierarchy.stage io.succ.castSucc) \ + TreeSequenceVertexSet + (HierarchyStarredStage C.hierarchy io.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt C.hierarchy io.succ, + theta ≠ eta → + C.good.gamma io.succ theta = C.good.gamma io.castSucc theta) → + (fun (eta : Fin k) ↦ + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + (gammaU i.succ eta ⊆ + (TreeSequenceVertexSet (K.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, + theta ≠ eta → + gammaU i.succ theta = gammaU i.castSucc theta) + eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H U corr baseU K hcount index gammaU stageEq + starredEq storedEq i io hn hp eta heta + refine ⟨?_, ?_, ?_⟩ + · rw [storedEq, ← hn] + exact heta.1 + · rw [stageEq, starredEq] + simpa [gammaU, ← hn, ← hp] using heta.2.1 + · intro theta htheta hne + rw [storedEq, ← hn] at htheta + simpa [gammaU, ← hn, ← hp] using heta.2.2 theta htheta hne + +private abbrev helperBranch685Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT baseU) (hcount : K.dividerCount = H.dividerCount), + let index : + Fin (K.dividerCount + (1 : ℕ)) → + Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive U + omega) + j; + let gammaU : + Fin (K.dividerCount + (1 : ℕ)) → + Fin k → + Finset (Fin k) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ C.good.gamma (index j) eta; + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = H.stage (index j).castSucc) → + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H (index j)) → + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H (index j)) → + ∀ (i : Fin K.dividerCount), + let io : Fin H.dividerCount := Fin.cast hcount i; + io.succ = index i.succ → + io.castSucc = index i.castSucc → + ∀ (eta : Fin k), + (∀ (y : Fin k), + (fun (eta : Fin k) ↦ + eta ∈ HierarchyStoredColorsAt C.hierarchy io.succ ∧ + (C.good.gamma io.succ eta ⊆ + (TreeSequenceVertexSet (C.hierarchy.stage io.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage C.hierarchy io.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt C.hierarchy io.succ, + theta ≠ eta → + C.good.gamma io.succ theta = C.good.gamma io.castSucc theta) + y → + y = eta) → + ∀ (y : Fin k), + (fun (eta : Fin k) ↦ + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + (gammaU i.succ eta ⊆ + (TreeSequenceVertexSet (K.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, + theta ≠ eta → + gammaU i.succ theta = gammaU i.castSucc theta) + y → + y = eta + +private theorem helper_branch_685.{u_1, u_2} : + helperBranch685Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H U corr baseU K hcount index gammaU stageEq + starredEq storedEq i io hn hp eta hunique theta htheta + apply hunique theta + refine ⟨?_, ?_, ?_⟩ + · rw [storedEq, ← hn] at htheta + exact htheta.1 + · have hlocal := htheta.2.1 + rw [stageEq, starredEq] at hlocal + simpa [gammaU, ← hn, ← hp] using hlocal + · intro z hz hne + have hzNew : z ∈ HierarchyStoredColorsAt K i.succ := by + rwa [storedEq, ← hn] + simpa [gammaU, ← hn, ← hp] using htheta.2.2 z hzNew hne + +private noncomputable abbrev helperGoodU2513.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2}, transferredGoodHierarchyConstructorType V E := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A n Dn R corrMinus baseMinus HMinus + corrStar baseStar HStar beta U corr baseU hcore hclosure K hcount havoid index gammaU hdata + stageEq starredEq storedEq missingEq segmentEqInternal indexLast terminalSegmentEq + exact { + gamma := gammaU + twoColors := by + intro j eta heta + apply C.good.twoColors (index j) eta + rwa [← storedEq j] + avoidance := by + intro j eta heta c hc + have hetaOld : eta ∈ HierarchyStoredColorsAt H (index j) := by + rwa [← storedEq j] + have hcOld : c ∈ C.good.gamma (index j) eta := hc + have hold := Finset.mem_sdiff.mp (C.good.avoidance (index j) eta hetaOld hcOld) + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · rw [missingEq j] + exact hold.1 + intro hseg + by_cases hj : j.val < K.dividerCount + · let i : Fin K.dividerCount := ⟨j.val, hj⟩ + have hi : i.castSucc = j := Fin.ext rfl + rw [← hi, segmentEqInternal i eta] at hseg + exact hold.2 hseg + · exact @helper_branch_659 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@beta) (@U) + (@corr) (@baseU) (@K) (@hcount) (@havoid) (@indexLast) (@terminalSegmentEq) (@j) (@eta) + (@heta) (@c) (@hc) (@hetaOld) (@hcOld) (@hold) (@hseg) (@hj) + disjointPairs := by + intro j eta theta heta htheta hne + apply C.good.disjointPairs (index j) eta theta + · rwa [← storedEq j] + · rwa [← storedEq j] + · exact hne + uniqueRefresh := by + intro i + let io : Fin H.dividerCount := Fin.cast hcount i + have hn : io.succ = index i.succ := Fin.ext rfl + have hp : io.castSucc = index i.castSucc := Fin.ext rfl + obtain ⟨eta, heta, hunique⟩ := C.good.uniqueRefresh io + refine ⟨eta, ?_, ?_⟩ + · apply helper_branch_677 <;> assumption + · apply helper_branch_685 <;> assumption + parallelBase := by + have hzero : (HierarchyStoredColorsAt K 0).biUnion (gammaU 0) = + (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0) := by + have hi : index 0 = 0 := Fin.ext rfl + rw [storedEq, hi] + simp only [gammaU, hi] + dsimp only + intro hpe + have hpeOld : ett.series.data.kind n = some TashkinovExtensionKind.PE := by + rwa [← hdata.2.1] + have hold := C.good.parallelBase hpeOld + rw [hcore, hclosure, hzero, hdata.1] + exact hold + minusClosed := by + intro i + let io : Fin H.dividerCount := Fin.cast hcount i + have hn : io.succ = index i.succ := Fin.ext rfl + have hp : io.castSucc = index i.castSucc := Fin.ext rfl + have hold := C.good.minusClosed io + rw [hn, hp] at hold + rw [stageEq, storedEq] + simpa [gammaU] using hold } + +private theorem helper_starredTransfer_726.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ {inputU : PartialEdgeColoring E k} {U : TreeSequence G e0} + {ettU : ExtendedTashkinovTree G k e0 inputU U phi} {baseU : HierarchyBase ettU phi} + (K : TashkinovHierarchy ettU baseU), + baseU.core = base.core → + ∀ (hc : K.dividerCount = H.dividerCount), + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = + H.stage + (Fin.cast + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive U + omega) + j).castSucc) → + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = + HierarchyStarredStage H + (Fin.cast + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive U + omega) + j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H inputU U ettU baseU K hcore hc hs j + obtain rfl | ⟨i, rfl⟩ := Fin.eq_zero_or_eq_succ j + · have hi : Fin.cast (congrArg (fun d => d + 1) hc) 0 = + (0 : Fin (H.dividerCount + 1)) := Fin.ext rfl + rw [hi] + exact hcore + · have hi : Fin.cast (congrArg (fun d => d + 1) hc) i.succ = + (Fin.cast hc i).succ := Fin.ext rfl + rw [hi] + simp only [HierarchyStarredStage, Fin.cases_succ] + have h := hs i.succ + rw [hi] at h + exact h + +private theorem helper_pathLeFull_765.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) {inputU : PartialEdgeColoring E k} + {U : TreeSequence G e0} {ettU : ExtendedTashkinovTree G k e0 inputU U phi} + {baseU : HierarchyBase ettU phi} (K : TashkinovHierarchy ettU baseU), + HierarchyPathNumber K ≤ + U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length := by + classical + intro V E _ _ _ _ G k e0 phi inputU U ettU baseU K + unfold HierarchyPathNumber + dsimp only + split + · exact (Finset.mem_Icc.mp (Finset.mem_filter.mp (Finset.min'_mem _ _)).1).2 + · exact le_rfl + +private theorem helper_hbetaPresentTerminal_783.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + A.length + ell = T.length → + ∀ (hBlen : B.length = T.length - (2 : ℕ)), + TreeSequenceInitialSegment B T → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus), + MaximumProperty corrMinus.replacementETT → + ∀ (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (_ : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount), + TreeSequenceInitialSegment + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) R.minus → + R.star.length = R.minus.length + (1 : ℕ) → + ∀ (hminusLen : R.minus.length = B.length + (1 : ℕ)), + R.star.length = T.length → + ∀ (beta : Fin k), + ( + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) → + ∀ (hbetaFirstBound : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (_ : GoodHierarchy HMinus), + HierarchyStarredStage HMinus (Fin.last HMinus.dividerCount) = A → + ( + ∀ {inputU : PartialEdgeColoring E k} {U : TreeSequence G e0} + {ettU : ExtendedTashkinovTree G k e0 inputU U phi} {baseU : HierarchyBase ettU phi} + (K : TashkinovHierarchy ettU baseU), + HierarchyPathNumber K ≤ + U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length) → + let ibeta : Fin (B.length + (1 : ℕ)) := + (⟨(↑(HierarchyFirstMissingPosition phi T beta) : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive B + omega⟩ : + Fin (B.length + (1 : ℕ))); + beta ∈ MissingColors G phi (B.vertex ibeta) → + beta ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B htail hell hsum hBlen hBT R + corrMinus hminusMP baseMinus HMinus hminusCount corrStar baseStar HStar hstarCount hBminus + hstarLen hminusLen hstarLength beta vertexMem hbetaFirstBound goodMinus hminusStarred + pathLeFull ibeta hbetaAtB hm + let im : Fin (R.minus.length + 1) := + Fin.castLE (Nat.succ_le_succ hBminus.1) ibeta + have hbetaMinus : beta ∈ MissingColors G phi (R.minus.vertex im) := by + rw [hBminus.2.1 ibeta] + exact hbetaAtB + have hne : R.minus.vertex im ≠ R.minus.vertex (Fin.last R.minus.length) := by + intro heq + have hv := congrArg Fin.val (R.minus.vertex_injective heq) + change ibeta.val = R.minus.length at hv + have hi := ibeta.isLt + omega + have hnot : ¬ ColoredVertexSetElementary G phi + (TreeSequenceVertexSet R.minus) := by + intro helem + have hd := helem (vertexMem R.minus im) + (vertexMem R.minus (Fin.last R.minus.length)) hne + apply Finset.disjoint_left.mp hd hbetaMinus + rw [R.minusTerminalVertex] + exact hm + let CMinus : HierarchyCounterexample baseMinus := { + positive := by simpa [corrMinus.rungAgreement] using C.positive + hierarchy := HMinus + good := goodMinus + maximum := hminusMP + notElementary := hnot } + apply ctx.lexicographicMinimality CMinus corrMinus.rungAgreement hminusCount + apply Or.inl + change HierarchyPathNumber HMinus < HierarchyPathNumber H + rw [D.pathNumberFull] + have hp := pathLeFull HMinus + rw [hminusStarred] at hp + omega + +private theorem helper_hstarPath_824.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [inst_2 : DecidableEq V] [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ell = T.length - A.length → + A.length + ell = T.length → + B.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment B T → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus), + HMinus.dividerCount = C.hierarchy.dividerCount → + ∀ (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (hstarMP : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + HStar.dividerCount = C.hierarchy.dividerCount → + R.star.length = R.minus.length + (1 : ℕ) → + R.minus.length = B.length + (1 : ℕ) → + R.star.length = T.length → + ∀ (beta : Fin k), + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length → + ∀ (goodStar : GoodHierarchy HStar), + HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A → + ( + ∀ {inputU : PartialEdgeColoring E k} {U : TreeSequence G e0} + {ettU : ExtendedTashkinovTree G k e0 inputU U phi} {baseU : HierarchyBase ettU phi} + (K : TashkinovHierarchy ettU baseU), + HierarchyPathNumber K ≤ + U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length) → + let _ : HierarchyCounterexample baseStar := by + exact + { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 + G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx + D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx + D) + R) + corrStar))) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))) + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + corrStar + have := GoldbergSeymour.TreeSequence.positive T + omega))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 input + T phi ett base C), + hierarchy := HStar, good := goodStar, maximum := hstarMP, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx + D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C) : + HierarchyCounterexample baseStar }; + HierarchyPathNumber HStar = HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B hell hsum hBlen hBT R + corrMinus baseMinus HMinus hminusCount corrStar hstarMP baseStar HStar hstarCount hstarLen + hminusLen hstarLength beta hbetaFirstBound goodStar hstarStarred pathLeFull CStar + have hle := pathLeFull HStar + rw [hstarStarred, hstarLength] at hle + have hnot : ¬ HierarchyPathNumber HStar < HierarchyPathNumber H := by + intro hlt + apply ctx.lexicographicMinimality CStar corrStar.rungAgreement hstarCount + exact Or.inl hlt + have hfull := D.pathNumberFull + change HierarchyPathNumber H = ell at hfull + omega + +private theorem helper_hstarMeasure_839.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [inst_2 : DecidableEq V] [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (_ : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (hstarMP : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (_ : R.minus.length = B.length + (1 : ℕ)), + R.star.length = T.length → + ∀ (beta : Fin k) + (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (goodStar : GoodHierarchy HStar), + let CStar : HierarchyCounterexample baseStar := by + exact + { + positive := + @Eq.mpr + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 + G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar))) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett)) + (@id + (@Eq Prop + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx + D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx + D) + R) + corrStar))) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett))) + (@congrArg Nat Prop + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar) + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + phi + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett phi + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V + E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R) + corrStar)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi + ett) + (@LT.lt Nat instLTNat + (@OfNat.ofNat Nat (nat_lit 0) (instOfNatNat (nat_lit 0)))) + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + corrStar + have := GoldbergSeymour.TreeSequence.positive T + omega))) + (@HierarchyCounterexample.positive V E inst inst_1 inst_2 inst_3 G k e0 input + T phi ett base C), + hierarchy := HStar, good := goodStar, maximum := hstarMP, + notElementary := + @Eq.mpr + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T))) + (@id + (@Eq Prop + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData + V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx + D) + R)))) + (Not + (@ColoredVertexSetElementary V E inst_1 G k phi + (@TreeSequenceVertexSet V E G e0 T)))) + (@congrArg (Finset V) Prop + (@TreeSequenceVertexSet V E G e0 + (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 + G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R)) + (@TreeSequenceVertexSet V E G e0 T) + (fun (_a : Finset V) ↦ + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 + inst_3 G k e0 input T phi ett base C ctx + (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) + R))) + (@HierarchyCounterexample.notElementary V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C) : + HierarchyCounterexample baseStar }; + HierarchyPathNumber HStar = HierarchyPathNumber H → + HStar.stage + (⟨HStar.dividerCount, + by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corrStar + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HStar.dividerCount + (2 : ℕ))) = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) → + HierarchyCounterexampleMeasure CStar = HierarchyCounterexampleMeasure C := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H ell B hBlen hBT R corrMinus baseMinus + HMinus hminusCount corrStar hstarMP baseStar HStar hstarCount hminusLen hstarLength beta + hbetaFirstBound goodStar CStar hstarPath hstarLastStage + change (HierarchyPathNumber HStar, + R.star.length - (HStar.stage ⟨HStar.dividerCount, by omega⟩).length) = + (HierarchyPathNumber H, + T.length - (H.stage ⟨H.dividerCount, by omega⟩).length) + rw [hstarPath, hstarLength, hstarLastStage] + +private theorem helper_prefixOfSegment_876.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {S U : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U), + TreeSequencePrefix U S.length S.positive hSU.1 = S + := by + classical + intro V E G e0 S U hSU + cases S with + | mk ls ps vs es vis eis fs ats => + cases U with + | mk lu pu vu eu viu eiu fu atu => + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + exact hSU.2.1 i + · apply heq_of_eq + funext i + exact hSU.2.2 i + +private theorem helper_hstarPrefix_896.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + (2 : ℕ) ≤ ell → + ell = T.length - A.length → + A.length + ell = T.length → + B.length = T.length - (2 : ℕ) → + TreeSequenceInitialSegment B T → + ∀ + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus), + HMinus.dividerCount = C.hierarchy.dividerCount → + ∀ (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (hstarMP : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar), + HStar.dividerCount = C.hierarchy.dividerCount → + R.star.length = R.minus.length + (1 : ℕ) → + TreeSequenceInitialSegment R.minus R.star → + R.minus.length = B.length + (1 : ℕ) → + R.star.length = T.length → + ∀ (beta : Fin k), + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length → + ∀ (goodStar : GoodHierarchy HStar), + HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A → + let CStar : HierarchyCounterexample baseStar := by + exact + @helperCStar1926 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@R) + (@corrStar) (@hstarMP) (@baseStar) (@HStar) (@goodStar) + ( + ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U), + TreeSequencePrefix U S.length S.positive hSU.1 = S) → + ( + ∀ (S : TreeSequence G e0) (i j : ℕ) (hi : (1 : ℕ) ≤ i) (hj : (1 : ℕ) ≤ j) + (hiS : i ≤ S.length) (hjS : j ≤ S.length), + i = j → + TreeSequencePrefix S i hi hiS = TreeSequencePrefix S j hj hjS) → + HierarchyFullTailPrefix CStar (HierarchyFullTailLength CStar - (1 : ℕ)) = R.minus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B htail hell hsum hBlen hBT R + corrMinus baseMinus HMinus hminusCount corrStar hstarMP baseStar HStar hstarCount hstarLen + hminusStar hminusLen hstarLength beta hbetaFirstBound goodStar hstarStarred CStar + prefixOfSegment prefixLengthEq + have hlen : min (A.length + (R.star.length - A.length - 1)) + R.star.length = R.minus.length := by omega + unfold HierarchyFullTailPrefix HierarchyFullTailLength + dsimp only [CStar] + refine (prefixLengthEq R.star _ R.minus.length _ R.minus.positive _ hminusStar.1 + ?_).trans (prefixOfSegment hminusStar) + rw [hstarStarred] + exact hlen + +private theorem helper_endpoint_1052.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (beta : Fin k), + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + let graph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi beta D.alpha; + ∀ (a b : V ⊕ E) (p : (TwoColorIncidenceGraph G phi beta D.alpha).Walk a b), + p.IsPath → + {x : V ⊕ E | x ∈ p.support} = TwoColorComponent G phi beta D.alpha (Sum.inl vb) → + ∀ (w : V), + Sum.inl w ∈ TwoColorComponent G phi beta D.alpha (Sum.inl vb) → + @SimpleGraph.degree (Sum V E) graph (@Sum.inl V E w) + (@Fintype.ofFinite + (@Set.Elem (Sum V E) + (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))) + (@Subtype.finite (Sum V E) + (@Finite.instSum V E (@Finite.of_fintype V inst) + (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))))) ≤ + (1 : ℕ) → + Sum.inl w = a ∨ Sum.inl w = b := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D beta vb graph a b p hp hsupport w hw hd + have hleaf : (graph.neighborSet (Sum.inl w)).Subsingleton := by + let : Fintype (graph.neighborSet (Sum.inl w)) := Fintype.ofFinite _ + have hc : Fintype.card (graph.neighborSet (Sum.inl w)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hd + intro x hx y hy + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hc ⟨x, hx⟩ ⟨y, hy⟩) + have hwpath : Sum.inl w ∈ p.support := by + change Sum.inl w ∈ {x | x ∈ p.support} + rw [hsupport] + exact hw + by_contra hend + push Not at hend + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hend.1 hend.2 hleaf) hwpath + +private theorem helper_hendsBeta_1079.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (beta : Fin k), + beta ≠ D.alpha → + ( + ∀ (S : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi S, + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) → + beta ∈ TreeMissingColors phi T → + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + let graph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi beta D.alpha; + ∀ (a b : V ⊕ E), + ( + ∀ (w : V), + Sum.inl w ∈ TwoColorComponent G phi beta D.alpha (Sum.inl vb) → + @SimpleGraph.degree (Sum V E) graph (@Sum.inl V E w) + (@Fintype.ofFinite + (@Set.Elem (Sum V E) + (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))) + (@Subtype.finite (Sum V E) + (@Finite.instSum V E (@Finite.of_fintype V inst) + (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))))) ≤ + (1 : ℕ) → + Sum.inl w = a ∨ Sum.inl w = b) → + Sum.inl vb = a ∨ Sum.inl vb = b := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D beta hcolorsDistinct firstMissingMem + hbetaT vb graph a b endpoint + apply endpoint vb + · change graph.connectedComponentMk (Sum.inl vb) = graph.connectedComponentMk (Sum.inl vb) + rfl + · exact MissingColorIncidenceEndpoint G phi beta D.alpha hcolorsDistinct ctx.proper vb + (firstMissingMem T beta hbetaT) + +private theorem helper_hendsPenultimate_1085.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (beta : Fin k), + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex)) → + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + let yp : V := T.vertex D.penultimateVertexIndex; + let graph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi beta D.alpha; + ∀ (a b : V ⊕ E), + ( + ∀ (w : V), + Sum.inl w ∈ TwoColorComponent G phi beta D.alpha (Sum.inl vb) → + @SimpleGraph.degree (Sum V E) graph (@Sum.inl V E w) + (@Fintype.ofFinite + (@Set.Elem (Sum V E) + (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))) + (@Subtype.finite (Sum V E) + (@Finite.instSum V E (@Finite.of_fintype V inst) + (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))))) ≤ + (1 : ℕ) → + Sum.inl w = a ∨ Sum.inl w = b) → + ( + ∀ (w : V), + D.alpha ∈ MissingColors G phi w → + @SimpleGraph.degree (Sum V E) graph (@Sum.inl V E w) + (@Fintype.ofFinite + (@Set.Elem (Sum V E) + (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))) + (@Subtype.finite (Sum V E) + (@Finite.instSum V E (@Finite.of_fintype V inst) + (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) graph (@Sum.inl V E w))))) ≤ + (1 : ℕ)) → + Sum.inl yp = a ∨ Sum.inl yp = b := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D beta hcomponentPenultimate vb yp graph a + b endpoint hdegreeAlpha + apply endpoint yp + · rw [hcomponentPenultimate] + change graph.connectedComponentMk (Sum.inl yp) = graph.connectedComponentMk (Sum.inl yp) + rfl + · exact hdegreeAlpha yp D.alphaMissingPenultimate + +private theorem helper_hendsTerminal_1091.{u_1, u_2} : + helperHendsTerminal1091Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D beta hcomponentTerminal vb yt graph a b + endpoint hdegreeAlpha + apply endpoint yt + · rw [hcomponentTerminal] + change graph.connectedComponentMk (Sum.inl yt) = graph.connectedComponentMk (Sum.inl yt) + rfl + · exact hdegreeAlpha yt D.alphaMissingTerminal + +private theorem helper_horderedStar_2907.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (_ : (2 : ℕ) ≤ ell) (_ : ell = T.length - A.length) + (_ : A.length + ell = T.length) (_ : B.length = T.length - (2 : ℕ)) + (_ : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (_ : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (_ : R.star.length = R.minus.length + (1 : ℕ)) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (_ : R.minus.length = B.length + (1 : ℕ)) + (_ : R.star.length = T.length) (beta : Fin k) + (_ : + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) + (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (_ : TreeSequenceInitialSegment B R.star) + (_ : + ∀ (r : Fin R.star.length) (_ : (↑r : ℕ) = B.length), + R.star.edge r = T.edge D.lastEdgeIndex) + (_ : HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A), + let iaStar : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length); + ∀ (_ : (↑iaStar : ℕ) = R.minus.length) + (_ : HierarchyFirstMissingPosition phi R.star D.alpha = iaStar) + (_ : (↑(HierarchyFirstMissingPosition phi R.star beta) : ℕ) ≤ B.length), + beta ∉ + TreeMissingColors phi + (HierarchyStarredStage HStar (Fin.last HStar.dividerCount)) ∨ + D.alpha ∉ + TreeMissingColors phi + (HierarchyStarredStage HStar (Fin.last HStar.dividerCount)) → + TreeVertexOrder R.star (R.star.vertex (HierarchyFirstMissingPosition phi R.star beta)) + (R.star.vertex (HierarchyFirstMissingPosition phi R.star D.alpha)) ∧ + beta ∉ + ({c : Fin k | + ∃ (t : Fin R.star.length), + (HierarchyStarredStage HStar (Fin.last HStar.dividerCount)).length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi R.star D.alpha) : ℕ) ∧ + phi (R.star.edge t) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B htail hell hsum hBlen hBT R + corrMinus baseMinus HMinus hminusCount corrStar baseStar HStar hstarCount hstarLen + hminusStar hminusLen hstarLength beta hbetaUnused hbetaFirstBound hBstar hstarFirstEdge + hstarStarred iaStar hiaStar halphaFirstStar hbetaStarBound _ + refine ⟨?_, ?_⟩ + · refine ⟨_, _, rfl, rfl, ?_⟩ + rw [halphaFirstStar] + omega + · intro hm + obtain ⟨_, t, ht, hhi, hcolor⟩ := Finset.mem_filter.mp hm + rw [hstarStarred] at ht + rw [halphaFirstStar] at hhi + by_cases hbefore : t.val < B.length + · let tb : Fin B.length := ⟨t.val, hbefore⟩ + let toriginal : Fin T.length := Fin.castLE hBT.1 tb + have hi : Fin.castLE hBstar.1 tb = t := Fin.ext rfl + have hedge : R.star.edge t = T.edge toriginal := by + rw [← hi, hBstar.2.2 tb, hBT.2.2 tb] + rw [hedge] at hcolor + exact hbetaUnused toriginal ht hcolor + · have heq : t.val = B.length := by omega + rw [hstarFirstEdge t heq] at hcolor + apply hbetaUnused D.lastEdgeIndex _ hcolor + have hl := D.lastEdgePosition + omega + +private theorem helper_halphaStar_2928.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) + (_ : + D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (_ : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (_ : R.minus.length = B.length + (1 : ℕ)) (beta : Fin k) + (_ : + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) + (_ : c ∈ MissingColors G phi (S.vertex i)), + HierarchyFirstMissingPosition phi S c ≤ i) + (_ : + ∀ (S : TreeSequence G e0) (c : Fin k) (_ : c ∈ TreeMissingColors phi S), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (_ : + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) + (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (_ : TreeSequenceInitialSegment B R.star), + let iaStar : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length); + ∀ (_ : (↑iaStar : ℕ) = R.minus.length) + (_ : R.star.vertex iaStar = T.vertex D.terminalVertexIndex) + (_ : D.alpha ∈ TreeMissingColors phi R.star), + HierarchyFirstMissingPosition phi R.star D.alpha = iaStar := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn hBlen hBT halpha R + corrMinus baseMinus HMinus hminusCount corrStar baseStar HStar hstarCount hminusStar + hminusLen beta firstMissingLe firstMissingMem vertexMem hbetaFirstBound hBstar iaStar + hiaStar halphaStarVertex halphaStar + have hm : D.alpha ∈ MissingColors G phi (R.star.vertex iaStar) := by + rw [halphaStarVertex] + exact D.alphaMissingTerminal + have hle := firstMissingLe R.star D.alpha iaStar hm + have hmFirst := firstMissingMem R.star D.alpha halphaStar + apply Fin.ext + change (HierarchyFirstMissingPosition phi R.star D.alpha).val ≤ iaStar.val at hle + by_contra hne + have hbound : (HierarchyFirstMissingPosition phi R.star D.alpha).val ≤ B.length := by + omega + let i : Fin (B.length + 1) := + ⟨(HierarchyFirstMissingPosition phi R.star D.alpha).val, by omega⟩ + have hi : Fin.castLE (Nat.succ_le_succ hBstar.1) i = + HierarchyFirstMissingPosition phi R.star D.alpha := Fin.ext rfl + have hmB : D.alpha ∈ MissingColors G phi (B.vertex i) := by + rw [← hBstar.2.1 i, hi] + exact hmFirst + exact halpha.1 (Finset.mem_biUnion.mpr ⟨_, vertexMem B i, hmB⟩) + +private theorem helper_hbetaStarVertex_3005.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (hBlen : B.length = T.length - (2 : ℕ)) (hBT : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (_ : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (hminusLen : R.minus.length = B.length + (1 : ℕ)) (beta : Fin k) + (hbetaFirstBound : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (_ : TreeSequenceInitialSegment B R.star), + let ibeta : Fin (B.length + (1 : ℕ)) := + (⟨(↑(HierarchyFirstMissingPosition phi T beta) : ℕ), by + omega⟩ : + Fin (B.length + (1 : ℕ))); + ∀ + (_ : + Fin.castLE (Nat.succ_le_succ hBT.1) ibeta = + HierarchyFirstMissingPosition phi T beta), + let iaStar : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length); + ∀ (_ : (↑iaStar : ℕ) = R.minus.length) + (_ : HierarchyFirstMissingPosition phi R.star D.alpha = iaStar) + (_ : (↑(HierarchyFirstMissingPosition phi R.star beta) : ℕ) ≤ B.length), + R.star.vertex (HierarchyFirstMissingPosition phi R.star beta) = + T.vertex (HierarchyFirstMissingPosition phi T beta) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen hBT R corrMinus baseMinus + HMinus hminusCount corrStar baseStar HStar hstarCount hminusStar hminusLen beta + hbetaFirstBound hBstar ibeta hibeta iaStar hiaStar halphaFirstStar hbetaStarBound + have hcStar := HierarchyFirstMissingPositionPrefixCutoff + phi B R.star hBstar beta B.length le_rfl + have hcOld := HierarchyFirstMissingPositionPrefixCutoff + phi B T hBT beta B.length le_rfl + have heq : (HierarchyFirstMissingPosition phi R.star beta).val = + (HierarchyFirstMissingPosition phi T beta).val := by omega + have hi : Fin.castLE (Nat.succ_le_succ hBstar.1) ibeta = + HierarchyFirstMissingPosition phi R.star beta := Fin.ext heq.symm + rw [← hi, hBstar.2.1 ibeta, ← hBT.2.1 ibeta, hibeta] + +private theorem helper_hbetaStarBound_3053.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (hBlen : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (_ : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (_ : R.star.length = R.minus.length + (1 : ℕ)) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (hminusLen : R.minus.length = B.length + (1 : ℕ)) (beta : Fin k) + (_ : + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) + (_ : c ∈ MissingColors G phi (S.vertex i)), + HierarchyFirstMissingPosition phi S c ≤ i) + (hbetaFirstBound : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (_ : TreeSequenceInitialSegment B R.star), + let ibeta : Fin (B.length + (1 : ℕ)) := + (⟨(↑(HierarchyFirstMissingPosition phi T beta) : ℕ), by + omega⟩ : + Fin (B.length + (1 : ℕ))); + ∀ (_ : beta ∈ MissingColors G phi (B.vertex ibeta)), + let iaStar : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length); + ∀ (_ : (↑iaStar : ℕ) = R.minus.length) + (_ : HierarchyFirstMissingPosition phi R.star D.alpha = iaStar), + (↑(HierarchyFirstMissingPosition phi R.star beta) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen hBT R corrMinus baseMinus + HMinus hminusCount corrStar baseStar HStar hstarCount hstarLen hminusStar hminusLen beta + firstMissingLe hbetaFirstBound hBstar ibeta hbetaAtB iaStar hiaStar halphaFirstStar + have hm : beta ∈ MissingColors G phi + (R.star.vertex (Fin.castLE (Nat.succ_le_succ hBstar.1) ibeta)) := by + rw [hBstar.2.1 ibeta] + exact hbetaAtB + have hle := firstMissingLe R.star beta _ hm + change (HierarchyFirstMissingPosition phi R.star beta).val ≤ ibeta.val at hle + have hi := ibeta.isLt + omega + +private theorem helper_hpt_3177.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (_ : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (_ : R.star.length = R.minus.length + (1 : ℕ)) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (_ : R.minus.length = B.length + (1 : ℕ)) + (_ : R.star.length = T.length) (beta : Fin k) + (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length), + let iaStar : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length); + ∀ (_ : (↑iaStar : ℕ) = R.minus.length) + (_ : HierarchyFirstMissingPosition phi R.star D.alpha = iaStar), + let yp : V := T.vertex D.penultimateVertexIndex; + let yt : V := T.vertex D.terminalVertexIndex; + yp ≠ yt := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen hBT R corrMinus baseMinus + HMinus hminusCount corrStar baseStar HStar hstarCount hstarLen hminusStar hminusLen + hstarLength beta hbetaFirstBound iaStar hiaStar halphaFirstStar yp yt heq + have hv := congrArg Fin.val (T.vertex_injective heq) + have hp := D.penultimateVertexPosition + have ht := D.terminalVertexPosition + omega + +private theorem helper_firstLowerInOld_3203.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : R.star.length = R.minus.length + (1 : ℕ)) + (_ : R.minus.length = B.length + (1 : ℕ)) + (_ : R.star.length = T.length) (_ : Fin k) + (_ : + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) + (_ : c ∈ MissingColors G phi (S.vertex i)), + HierarchyFirstMissingPosition phi S c ≤ i) + (_ : + ∀ (S : TreeSequence G e0) (c : Fin k) + (_ : (↑(HierarchyFirstMissingPosition phi S c) : ℕ) < S.length), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (U : TreeSequence G e0) (_ : TreeSequenceInitialSegment B U) (eta : Fin k) (r : ℕ) + (_ : r ≤ B.length) (_ : r < (↑(HierarchyFirstMissingPosition phi U eta) : ℕ)), + r < (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen hBT R corrMinus baseMinus + HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta firstMissingLe + firstMissingMemBelow U hBU eta r hrB hrU + apply helper_firstLowerInOld_356 <;> assumption +private theorem helper_hpt_3623.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (_ : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (_ : R.star.length = R.minus.length + (1 : ℕ)) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (_ : R.minus.length = B.length + (1 : ℕ)) + (_ : R.star.length = T.length) (beta : Fin k) + (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length), + let iaStar : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length); + ∀ (_ : (↑iaStar : ℕ) = R.minus.length) + (_ : HierarchyFirstMissingPosition phi R.star D.alpha = iaStar), + let yp : V := T.vertex D.penultimateVertexIndex; + let yt : V := T.vertex D.terminalVertexIndex; + yp ≠ yt := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen hBT R corrMinus baseMinus + HMinus hminusCount corrStar baseStar HStar hstarCount hstarLen hminusStar hminusLen + hstarLength beta hbetaFirstBound iaStar hiaStar halphaFirstStar yp yt + apply helper_hpt_3177 <;> assumption +private theorem helper_horderedUnused_3229.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (_ : B.length = T.length - (2 : ℕ)) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : R.star.length = R.minus.length + (1 : ℕ)) + (_ : R.minus.length = B.length + (1 : ℕ)) + (_ : R.star.length = T.length) (beta : Fin k) + (_ : + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) + (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (_ : + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex), + beta ∉ TreeMissingColors phi A ∨ D.alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T beta)) + (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ + beta ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T D.alpha) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B hBlen R corrMinus baseMinus + HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta hbetaUnused + hbetaFirstBound halphaFirst + apply helper_horderedUnused_290 <;> assumption +private theorem helper_halphaFirst_3258.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) + (_ : + D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : R.star.length = R.minus.length + (1 : ℕ)) + (_ : R.minus.length = B.length + (1 : ℕ)) + (_ : R.star.length = T.length) (_ : Fin k) + (_ : + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) + (_ : c ∈ MissingColors G phi (S.vertex i)), + HierarchyFirstMissingPosition phi S c ≤ i) + (_ : + ∀ (S : TreeSequence G e0) (c : Fin k) (_ : c ∈ TreeMissingColors phi S), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (_ : + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) + (_ : D.alpha ∈ TreeMissingColors phi T), + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn hBlen hBT halpha R + corrMinus baseMinus HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta + firstMissingLe firstMissingMem vertexMem halphaT + apply helper_halphaFirst_256 <;> assumption +private theorem helper_hstarPath_3572.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (_ : ell = T.length - A.length) (_ : A.length + ell = T.length) + (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (_ : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (_ : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (_ : R.star.length = R.minus.length + (1 : ℕ)) + (_ : R.minus.length = B.length + (1 : ℕ)) + (_ : R.star.length = T.length) (beta : Fin k) + (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (_ : GoodHierarchy HStar) + (_ : HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A) + (_ : + ∀ {inputU : PartialEdgeColoring E k} {U : TreeSequence G e0} + {ettU : ExtendedTashkinovTree G k e0 inputU U phi} + {baseU : HierarchyBase ettU phi} (K : TashkinovHierarchy ettU baseU), + HierarchyPathNumber K ≤ + U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length), + HierarchyPathNumber HStar = HierarchyPathNumber H := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B hell hsum hBlen hBT R + corrMinus baseMinus HMinus hminusCount corrStar hstarMP baseStar HStar hstarCount hstarLen + hminusLen hstarLength beta hbetaFirstBound goodStar hstarStarred pathLeFull + apply helper_hstarPath_824 <;> assumption +private theorem helper_halphaStar_3689.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) + (_ : + D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (_ : HMinus.dividerCount = C.hierarchy.dividerCount) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : HStar.dividerCount = C.hierarchy.dividerCount) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (_ : R.minus.length = B.length + (1 : ℕ)) (beta : Fin k) + (_ : + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) + (_ : c ∈ MissingColors G phi (S.vertex i)), + HierarchyFirstMissingPosition phi S c ≤ i) + (_ : + ∀ (S : TreeSequence G e0) (c : Fin k) (_ : c ∈ TreeMissingColors phi S), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (_ : + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) + (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (_ : TreeSequenceInitialSegment B R.star), + let iaStar : Fin (R.star.length + (1 : ℕ)) := + Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length); + ∀ (_ : (↑iaStar : ℕ) = R.minus.length) + (_ : R.star.vertex iaStar = T.vertex D.terminalVertexIndex) + (_ : D.alpha ∈ TreeMissingColors phi R.star), + HierarchyFirstMissingPosition phi R.star D.alpha = iaStar := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn hBlen hBT halpha R + corrMinus baseMinus HMinus hminusCount corrStar baseStar HStar hstarCount hminusStar + hminusLen beta firstMissingLe firstMissingMem vertexMem hbetaFirstBound hBstar iaStar + hiaStar halphaStarVertex halphaStar + apply helper_halphaStar_2928 <;> assumption +private theorem helper_hDnDisjoint_3416.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ + (_ : + D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData), + let baseExtraMissing : Finset (Fin k) := + (TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet (ett.series.data.tree n.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v; + let prefixUsed : Finset (Fin k) := + ({c : Fin k | + ∃ (r : Fin T.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi (T.edge r) = some c} : + Finset (Fin k)); + let available : Finset (Fin k) := + (TreeMissingColors phi B \ baseExtraMissing) \ prefixUsed; + let finalColors : Finset (Fin k) := + ({c : Fin k | phi (T.edge R.penultimateEdgeIndex) = some c} : Finset (Fin k)) ∪ + ({c : Fin k | phi (T.edge D.lastEdgeIndex) = some c} : Finset (Fin k)); + ∀ (beta : Fin k) (_ : beta ∈ (available \ finalColors) \ Dn) + (_ : beta ∈ available \ finalColors) (_ : beta ∉ Dn) + (_ : beta ∈ available) (_ : beta ∉ finalColors) + (_ : beta ∈ TreeMissingColors phi B \ baseExtraMissing) + (_ : beta ∉ prefixUsed) + (_ : beta ∈ TreeMissingColors phi B) (_ : beta ∉ baseExtraMissing) + (_ : + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) + (_ : beta ≠ D.alpha) (_ : beta ∈ TreeMissingColors phi T) + (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (_ : beta ∈ TreeMissingColors phi Bplus) + (_ : + beta ∉ TreeMissingColors phi A ∨ D.alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T beta)) + (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ + beta ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T D.alpha) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k))), + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B Bplus n Dn halpha R + baseExtraMissing prefixUsed available finalColors beta hbeta hbetaAvailableFinal hbetaDn + hbetaAvailable hbetaFinal hbetaMissingExtra hbetaPrefixUnused hbetaMissing hbetaExtra + hbetaUnused hcolorsDistinct hbetaT hbetaFirstBound hbetaPrefix horderedUnused + exact @helper_hDnDisjoint_310 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@halpha) (@R) (@beta) (@hbeta) (@hbetaAvailableFinal) (@hbetaDn) (@hbetaAvailable) + (@hbetaFinal) (@hbetaMissingExtra) (@hbetaPrefixUnused) (@hbetaMissing) (@hbetaExtra) + (@hbetaUnused) (@hcolorsDistinct) (@hbetaT) (@hbetaFirstBound) (@hbetaPrefix) + (@horderedUnused) + +private theorem helper_continuation_3768.{u_1, u_2} : + helperContinuation3768Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn htail hell hsum hBlen + hBT R corrMinus baseMinus HMinus hminusCount corrStar hstarMP baseStar HStar hstarCount + hstarLen hminusStar hminusLen hstarLength beta hbetaUnused hcolorsDistinct firstMissingMem + hbetaT hbetaFirstBound hDnDisjoint hcomponentPenultimate hBstar hstarFirstEdge terminalData + goodStar hstarStarred ibeta hibeta CStar ctxStar hprefixStarElementary iaStar hiaStar + halphaStarVertex halphaFirstStar hbetaStarBound hbetaStarVertex hmissingStar + have horderedStar : + (beta ∉ TreeMissingColors phi (HierarchyStarredStage HStar (Fin.last HStar.dividerCount)) ∨ + D.alpha ∉ TreeMissingColors phi (HierarchyStarredStage HStar (Fin.last + HStar.dividerCount))) → + TreeVertexOrder R.star + (R.star.vertex (HierarchyFirstMissingPosition phi R.star beta)) + (R.star.vertex (HierarchyFirstMissingPosition phi R.star D.alpha)) ∧ + beta ∉ (Finset.univ.filter fun c => ∃ t : Fin R.star.length, + (HierarchyStarredStage HStar (Fin.last HStar.dividerCount)).length ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition phi R.star D.alpha).val ∧ + phi (R.star.edge t) = some c) := by + exact @helper_horderedStar_2907 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) + (@hminusCount) (@corrStar) (@baseStar) (@HStar) (@hstarCount) (@hstarLen) (@hminusStar) + (@hminusLen) (@hstarLength) (@beta) (@hbetaUnused) (@hbetaFirstBound) (@hBstar) + (@hstarFirstEdge) (@hstarStarred) (@hiaStar) (@halphaFirstStar) (@hbetaStarBound) + have hstarDnDisjoint : Disjoint ({beta, D.alpha} : Finset (Fin k)) + (TashkinovStoredColors corrStar.replacementETT.series.data + (Fin.last corrStar.replacementETT.rounds)) := by + rw [(terminalData R.star corrStar).2.2] + exact hDnDisjoint + have hstarDnqDisjoint : Disjoint ({beta, D.alpha} : Finset (Fin k)) + (HierarchyStoredColorsAt HStar (Fin.last HStar.dividerCount)) := + hstarDnDisjoint.mono_right Finset.sdiff_subset + have hchangeStar := ChangeLemma G k e0 corrStar.replacementInput R.star phi + corrStar.replacementETT baseStar CStar ctxStar.proper ctxStar.oneEdgeUncolored + ctxStar.lowerRung ctxStar.fewerDividers ctxStar.lexicographicMinimality + hprefixStarElementary ctxStar.largeMissingSet beta D.alpha hcolorsDistinct + hmissingStar horderedStar + have hcomponentTerminal : + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.terminalVertexIndex)) := by + have hc : TwoColorComponent G phi beta D.alpha + (Sum.inl (R.star.vertex (HierarchyFirstMissingPosition phi R.star beta))) = + TwoColorComponent G phi beta D.alpha + (Sum.inl (R.star.vertex (HierarchyFirstMissingPosition phi R.star D.alpha))) := by + by_cases hq : 0 < HStar.dividerCount + · exact hchangeStar.1 ⟨hq, Or.inr hstarDnqDisjoint⟩ + · have hz : HStar.dividerCount = 0 := by omega + exact hchangeStar.2.1 ⟨hz, Or.inr hstarDnDisjoint⟩ + simpa only [hbetaStarVertex, halphaFirstStar, halphaStarVertex] using hc + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let yp := T.vertex D.penultimateVertexIndex + let yt := T.vertex D.terminalVertexIndex + have hbp : vb ≠ yp := by + intro heq + have hv := congrArg Fin.val (T.vertex_injective heq) + have hp := D.penultimateVertexPosition + omega + have hbt : vb ≠ yt := by + intro heq + have hv := congrArg Fin.val (T.vertex_injective heq) + have hp := D.terminalVertexPosition + omega + have hpt : yp ≠ yt := by + exact @helper_hpt_3623 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hBT) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@hminusCount) (@corrStar) (@baseStar) (@HStar) + (@hstarCount) (@hstarLen) (@hminusStar) (@hminusLen) (@hstarLength) (@beta) + (@hbetaFirstBound) (@hiaStar) (@halphaFirstStar) + let graph := TwoColorIncidenceGraph G phi beta D.alpha + obtain ⟨a, b, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G phi beta D.alpha ctx.proper (Sum.inl vb) + have endpoint (w : V) + (hw : Sum.inl w ∈ TwoColorComponent G phi beta D.alpha (Sum.inl vb)) + (hd : @SimpleGraph.degree _ graph (Sum.inl w) (Fintype.ofFinite _) ≤ 1) : + Sum.inl w = a ∨ Sum.inl w = b := by + exact @helper_endpoint_1052 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@beta) (@a) (@b) + (@p) (@hp) (@hsupport) (@w) (@hw) (@hd) + have hgraphSwap : TwoColorIncidenceGraph G phi D.alpha beta = graph := by + ext x y + cases x <;> cases y <;> simp [graph, TwoColorIncidenceGraph, or_comm] + have hdegreeAlpha (w : V) (hm : D.alpha ∈ MissingColors G phi w) : + @SimpleGraph.degree _ graph (Sum.inl w) (Fintype.ofFinite _) ≤ 1 := by + rw [← hgraphSwap] + exact MissingColorIncidenceEndpoint G phi D.alpha beta hcolorsDistinct.symm ctx.proper w hm + have hendsBeta : Sum.inl vb = a ∨ Sum.inl vb = b := by + exact @helper_hendsBeta_1079 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@beta) (@hcolorsDistinct) (@firstMissingMem) (@hbetaT) (@a) (@b) (@endpoint) + have hendsPenultimate : Sum.inl yp = a ∨ Sum.inl yp = b := by + exact @helper_hendsPenultimate_1085 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@beta) (@hcomponentPenultimate) (@a) (@b) (@endpoint) (@hdegreeAlpha) + have hendsTerminal : Sum.inl yt = a ∨ Sum.inl yt = b := by + exact @helper_hendsTerminal_1091 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@beta) (@hcomponentTerminal) (@a) (@b) (@endpoint) (@hdegreeAlpha) + have hbp' : Sum.inl vb ≠ (Sum.inl yp : Sum V E) := fun h => hbp (Sum.inl.inj h) + have hbt' : Sum.inl vb ≠ (Sum.inl yt : Sum V E) := fun h => hbt (Sum.inl.inj h) + have hpt' : Sum.inl yp ≠ (Sum.inl yt : Sum V E) := fun h => hpt (Sum.inl.inj h) + rcases hendsBeta with hba | hbb <;> + rcases hendsPenultimate with hpa | hpb <;> + rcases hendsTerminal with hta | htb + all_goals first + | exact hbp' (hba.trans hpa.symm) + | exact hbp' (hbb.trans hpb.symm) + | exact hbt' (hba.trans hta.symm) + | exact hbt' (hbb.trans htb.symm) + | exact hpt' (hpa.trans hta.symm) + | exact hpt' (hpb.trans htb.symm) + +private theorem helper_continuation_3898.{u_1, u_2} : + helperContinuation3898Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn htail hell hsum hBlen + hBT halpha R corrMinus baseMinus HMinus hminusCount corrStar hstarMP baseStar HStar + hstarCount hstarStages hBminus hstarLen hminusStar hminusLen hstarLength beta hbetaMissing + hbetaUnused hcolorsDistinct firstMissingLe firstMissingMem vertexMem missingMono hbetaT + hbetaFirstBound hDnDisjoint hcomponentPenultimate hBstar hstarFirstEdge terminalData + goodStar hstarLastIndex hstarStarred ibeta hibeta hbetaAtB CStar hstarPath + have hstarLastStage : HStar.stage ⟨HStar.dividerCount, by omega⟩ = + H.stage ⟨H.dividerCount, by omega⟩ := by + have h := hstarStages (Fin.last HStar.dividerCount) + rw [hstarLastIndex] at h + exact h + have hstarMeasure : HierarchyCounterexampleMeasure CStar = + HierarchyCounterexampleMeasure C := by + exact @helper_hstarMeasure_839 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@hminusCount) (@corrStar) + (@hstarMP) (@baseStar) (@HStar) (@hstarCount) (@hminusLen) (@hstarLength) (@beta) + (@hbetaFirstBound) (@goodStar) (@hstarPath) (@hstarLastStage) + let ctxStar : HierarchyMinimumCounterexampleContext G k e0 + corrStar.replacementInput R.star phi corrStar.replacementETT baseStar CStar := by + exact { + proper := ctx.proper + oneEdgeUncolored := ctx.oneEdgeUncolored + lowerRung := by + intro input' T' generating' lower hpos hlt hmax + apply ctx.lowerRung lower hpos + · simpa [corrStar.rungAgreement] using hlt + · exact hmax + fewerDividers := by + intro input' T' generating' other hr hmax base' K goodK hdiv + apply ctx.fewerDividers other (hr.trans corrStar.rungAgreement) hmax base' K goodK + change K.dividerCount < HStar.dividerCount at hdiv + rwa [hstarCount] at hdiv + lexicographicMinimality := by + intro input' T' generating' other base' C' hr hc + rw [hstarMeasure] + exact ctx.lexicographicMinimality C' (hr.trans corrStar.rungAgreement) + (hc.trans hstarCount) + largeMissingSet := by + dsimp only + rw [(terminalData R.star corrStar).1, corrStar.rungAgreement] + exact ctx.largeMissingSet } + have hprefixStarElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyFullTailPrefix CStar + (HierarchyFullTailLength CStar - 1))) := + HierarchyCounterexamplePenultimateElementary + G k e0 corrStar.replacementInput R.star phi corrStar.replacementETT baseStar CStar + ctxStar.proper ctxStar.oneEdgeUncolored ctxStar.lowerRung ctxStar.fewerDividers + ctxStar.lexicographicMinimality ctxStar.largeMissingSet + have prefixOfSegment {S U : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) : + TreeSequencePrefix U S.length S.positive hSU.1 = S := by + exact @helper_prefixOfSegment_876 (@V) (@E) (@G) (@e0) (@S) (@U) (@hSU) + have prefixLengthEq (S : TreeSequence G e0) (i j : ℕ) + (hi : 1 ≤ i) (hj : 1 ≤ j) (hiS : i ≤ S.length) (hjS : j ≤ S.length) + (hij : i = j) : TreeSequencePrefix S i hi hiS = TreeSequencePrefix S j hj hjS := by + cases hij + rfl + have hstarPrefix : HierarchyFullTailPrefix CStar + (HierarchyFullTailLength CStar - 1) = R.minus := by + exact @helper_hstarPrefix_896 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) + (@hminusCount) (@corrStar) (@hstarMP) (@baseStar) (@HStar) (@hstarCount) (@hstarLen) + (@hminusStar) (@hminusLen) (@hstarLength) (@beta) (@hbetaFirstBound) (@goodStar) + (@hstarStarred) (@prefixOfSegment) (@prefixLengthEq) + have hminusElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet R.minus) := by + change ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyFullTailPrefix CStar + (HierarchyFullTailLength CStar - 1))) at hprefixStarElementary + rwa [hstarPrefix] at hprefixStarElementary + let iaStar : Fin (R.star.length + 1) := + Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length) + have hiaStar : iaStar.val = R.minus.length := rfl + have halphaStarVertex : R.star.vertex iaStar = T.vertex D.terminalVertexIndex := + (hminusStar.2.1 (Fin.last R.minus.length)).trans R.minusTerminalVertex + have halphaMinus : D.alpha ∈ TreeMissingColors phi R.minus := + Finset.mem_biUnion.mpr ⟨_, vertexMem R.minus (Fin.last R.minus.length), + R.minusTerminalVertex.symm ▸ D.alphaMissingTerminal⟩ + have halphaStar : D.alpha ∈ TreeMissingColors phi R.star := + missingMono hminusStar halphaMinus + have halphaFirstStar : HierarchyFirstMissingPosition phi R.star D.alpha = iaStar := by + exact @helper_halphaStar_3689 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@halpha) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@hminusCount) + (@corrStar) (@baseStar) (@HStar) (@hstarCount) (@hminusStar) (@hminusLen) (@beta) + (@firstMissingLe) (@firstMissingMem) (@vertexMem) (@hbetaFirstBound) (@hBstar) (@hiaStar) + (@halphaStarVertex) (@halphaStar) + have hbetaStarBound : (HierarchyFirstMissingPosition phi R.star beta).val ≤ B.length := by + exact @helper_hbetaStarBound_3053 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@hminusCount) (@corrStar) + (@baseStar) (@HStar) (@hstarCount) (@hstarLen) (@hminusStar) (@hminusLen) (@beta) + (@firstMissingLe) (@hbetaFirstBound) (@hBstar) (@hbetaAtB) (@hiaStar) (@halphaFirstStar) + have hbetaStarVertex : + R.star.vertex (HierarchyFirstMissingPosition phi R.star beta) = + T.vertex (HierarchyFirstMissingPosition phi T beta) := by + exact @helper_hbetaStarVertex_3005 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@hminusCount) (@corrStar) + (@baseStar) (@HStar) (@hstarCount) (@hminusStar) (@hminusLen) (@beta) (@hbetaFirstBound) + (@hBstar) (@hibeta) (@hiaStar) (@halphaFirstStar) (@hbetaStarBound) + have hbetaMinus : beta ∈ TreeMissingColors phi R.minus := missingMono hBminus hbetaMissing + have hmissingStar : + beta ∈ TreeMissingColors phi (HierarchyFullTailPrefix CStar + (HierarchyFullTailLength CStar - 1)) ∧ + D.alpha ∈ TreeMissingColors phi (HierarchyFullTailPrefix CStar + (HierarchyFullTailLength CStar - 1)) := by + rw [hstarPrefix] + exact ⟨hbetaMinus, halphaMinus⟩ + exact @helper_continuation_3768 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@hminusCount) + (@corrStar) (@hstarMP) (@baseStar) (@HStar) (@hstarCount) (@hstarLen) (@hminusStar) + (@hminusLen) (@hstarLength) (@beta) (@hbetaUnused) (@hcolorsDistinct) (@firstMissingMem) + (@hbetaT) (@hbetaFirstBound) (@hDnDisjoint) (@hcomponentPenultimate) (@hBstar) + (@hstarFirstEdge) (@terminalData) (@goodStar) (@hstarStarred) (@hibeta) (@ctxStar) + (@hprefixStarElementary) (@hiaStar) (@halphaStarVertex) (@halphaFirstStar) + (@hbetaStarBound) (@hbetaStarVertex) (@hmissingStar) + +private theorem helper_continuation_4102.{u_1, u_2} : + helperContinuation4102Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn htail hell hsum hBlen + hBT halpha R corrMinus hminusMP baseMinus hminusCore hminusClosure HMinus hminusCount + hminusStages corrStar hstarMP baseStar hstarCore hstarClosure HStar hstarCount hstarStages + hBminus hstarLen hminusStar hminusLen hstarLength beta hbetaMissing hbetaUnused + hcolorsDistinct firstMissingLe firstMissingMem vertexMem missingMono hbetaT hbetaFirstBound + hDnDisjoint hcomponentPenultimate hminusTerminalAvoidance hBstar hstarFirstEdge + hstarTerminalAvoidance terminalData copyGood + obtain ⟨goodMinus, hgammaMinus⟩ := copyGood R.minus corrMinus baseMinus + hminusCore hminusClosure HMinus hminusCount hminusStages hBminus + hminusTerminalAvoidance + obtain ⟨goodStar, hgammaStar⟩ := copyGood R.star corrStar baseStar + hstarCore hstarClosure HStar hstarCount hstarStages hBstar + hstarTerminalAvoidance + have starredTransfer {inputU : PartialEdgeColoring E k} + {U : TreeSequence G e0} + {ettU : ExtendedTashkinovTree G k e0 inputU U phi} + {baseU : HierarchyBase ettU phi} + (K : TashkinovHierarchy ettU baseU) + (hcore : baseU.core = base.core) (hc : K.dividerCount = H.dividerCount) + (hs : ∀ j : Fin (K.dividerCount + 1), K.stage j.castSucc = + H.stage (Fin.cast (congrArg (fun d => d + 1) hc) j).castSucc) + (j : Fin (K.dividerCount + 1)) : + HierarchyStarredStage K j = + HierarchyStarredStage H (Fin.cast (congrArg (fun d => d + 1) hc) j) := by + exact @helper_starredTransfer_726 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@inputU) (@U) + (@ettU) (@baseU) (@K) (@hcore) (@hc) (@hs) (@j) + have hminusLastIndex : Fin.cast (congrArg (fun d => d + 1) hminusCount) + (Fin.last HMinus.dividerCount) = q := by + apply Fin.ext + simp [q, H] + have hstarLastIndex : Fin.cast (congrArg (fun d => d + 1) hstarCount) + (Fin.last HStar.dividerCount) = q := by + apply Fin.ext + simp [q, H] + have hminusStarred : HierarchyStarredStage HMinus + (Fin.last HMinus.dividerCount) = A := by + simpa only [hminusLastIndex] using starredTransfer HMinus hminusCore + hminusCount hminusStages (Fin.last HMinus.dividerCount) + have hstarStarred : HierarchyStarredStage HStar + (Fin.last HStar.dividerCount) = A := by + simpa only [hstarLastIndex] using starredTransfer HStar hstarCore + hstarCount hstarStages (Fin.last HStar.dividerCount) + have pathLeFull {inputU : PartialEdgeColoring E k} + {U : TreeSequence G e0} + {ettU : ExtendedTashkinovTree G k e0 inputU U phi} + {baseU : HierarchyBase ettU phi} (K : TashkinovHierarchy ettU baseU) : + HierarchyPathNumber K ≤ U.length - + (HierarchyStarredStage K (Fin.last K.dividerCount)).length := by + exact @helper_pathLeFull_765 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@inputU) (@U) (@ettU) (@baseU) (@K) + let ibeta : Fin (B.length + 1) := + ⟨(HierarchyFirstMissingPosition phi T beta).val, by omega⟩ + have hibeta : Fin.castLE (Nat.succ_le_succ hBT.1) ibeta = + HierarchyFirstMissingPosition phi T beta := Fin.ext rfl + have hbetaAtB : beta ∈ MissingColors G phi (B.vertex ibeta) := by + rw [← hBT.2.1 ibeta, hibeta] + exact firstMissingMem T beta hbetaT + have hbetaPresentTerminal : beta ∉ MissingColors G phi + (T.vertex D.terminalVertexIndex) := by + exact @helper_hbetaPresentTerminal_783 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) (@hminusMP) (@baseMinus) + (@HMinus) (@hminusCount) (@corrStar) (@baseStar) (@HStar) (@hstarCount) (@hBminus) + (@hstarLen) (@hminusLen) (@hstarLength) (@beta) (@vertexMem) (@hbetaFirstBound) + (@goodMinus) (@hminusStarred) (@pathLeFull) (@hbetaAtB) + let CStar : HierarchyCounterexample baseStar := { + positive := by simpa [corrStar.rungAgreement] using C.positive + hierarchy := HStar + good := goodStar + maximum := hstarMP + notElementary := by rw [R.starVertexSet]; exact C.notElementary } + have hstarPath : HierarchyPathNumber HStar = HierarchyPathNumber H := by + exact @helper_hstarPath_3572 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@hminusCount) + (@corrStar) (@hstarMP) (@baseStar) (@HStar) (@hstarCount) (@hstarLen) (@hminusLen) + (@hstarLength) (@beta) (@hbetaFirstBound) (@goodStar) (@hstarStarred) (@pathLeFull) + exact @helper_continuation_3898 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hell) (@hsum) (@hBlen) (@hBT) (@halpha) (@R) (@corrMinus) (@baseMinus) (@HMinus) + (@hminusCount) (@corrStar) (@hstarMP) (@baseStar) (@HStar) (@hstarCount) (@hstarStages) + (@hBminus) (@hstarLen) (@hminusStar) (@hminusLen) (@hstarLength) (@beta) (@hbetaMissing) + (@hbetaUnused) (@hcolorsDistinct) (@firstMissingLe) (@firstMissingMem) (@vertexMem) + (@missingMono) (@hbetaT) (@hbetaFirstBound) (@hDnDisjoint) (@hcomponentPenultimate) + (@hBstar) (@hstarFirstEdge) (@terminalData) (@goodStar) (@hstarLastIndex) (@hstarStarred) + (@hibeta) (@hbetaAtB) (@hstarPath) + +private theorem helper_continuation_4235.{u_1, u_2} : + helperContinuation4235Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn htail hell hsum hBlen + hBT halpha R corrMinus hminusMP baseMinus hminusCore hminusClosure HMinus hminusCount + hminusStages corrStar hstarMP baseStar hstarCore hstarClosure HStar hstarCount hstarStages + hBminus hstarLen hminusStar hstarEdge hminusLen hstarLength beta hbetaMissing hbetaUnused + hcolorsDistinct firstMissingLe firstMissingMem vertexMem missingMono hbetaT hbetaFirstBound + hDnDisjoint hcomponentPenultimate terminalAvoidance hminusFirstEdge hminusTerminalAvoidance + hBstar + have hstarFirstEdge (r : Fin R.star.length) (hr : r.val = B.length) : + R.star.edge r = T.edge D.lastEdgeIndex := by + let rm : Fin R.minus.length := ⟨r.val, by omega⟩ + have hi : Fin.castLE hminusStar.1 rm = r := Fin.ext rfl + rw [← hi, hminusStar.2.2 rm] + exact hminusFirstEdge rm hr + have hstarSecondEdge (r : Fin R.star.length) (hr : r.val = B.length + 1) : + R.star.edge r = T.edge R.penultimateEdgeIndex := by + exact @helper_hstarSecondEdge_484 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) + (@hstarLen) (@hstarEdge) (@hminusLen) (@beta) (@r) (@hr) + have hstarTerminalAvoidance := terminalAvoidance R.star hBstar (by omega) + hstarFirstEdge hstarSecondEdge + have terminalData (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) : + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree n.castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = Dn := by + exact @helper_terminalData_494 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@beta) (@U) (@corr) + have hApositive (hq : 0 < H.dividerCount) : A = H.stage q.castSucc := by + exact @helper_hApositive_533 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@beta) (@hq) + have stageLengthMono : Monotone (fun j => (H.stage j).length) := by + apply Fin.monotone_iff_le_succ.mpr + intro j + exact (H.nested j).1 + have copyGood (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corr.replacementETT phi) + (hcore : baseU.core = base.core) (hclosure : baseU.closure = base.closure) + (K : TashkinovHierarchy corr.replacementETT baseU) + (hcount : K.dividerCount = H.dividerCount) + (hstages : ∀ j : Fin (K.dividerCount + 1), + K.stage j.castSucc = + H.stage (Fin.cast (congrArg (fun d => d + 1) hcount) j).castSucc) + (hBU : TreeSequenceInitialSegment B U) + (havoid : ∀ eta ∈ HierarchyStoredColorsAt H q, + Disjoint (C.good.gamma q eta) + (Finset.univ.filter fun c => ∃ r : Fin U.length, + A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi U eta).val U.length ∧ + phi (U.edge r) = some c)) : + ∃ goodU : GoodHierarchy K, + ∀ j eta, goodU.gamma j eta = + C.good.gamma (Fin.cast (congrArg (fun d => d + 1) hcount) j) eta := by + let index (j : Fin (K.dividerCount + 1)) : Fin (H.dividerCount + 1) := + Fin.cast (congrArg (fun d => d + 1) hcount) j + let gammaU := fun j eta => C.good.gamma (index j) eta + have hdata := terminalData U corr + have stageEq (j : Fin (K.dividerCount + 1)) : + K.stage j.castSucc = H.stage (index j).castSucc := hstages j + have starredEq (j : Fin (K.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage H (index j) := by + exact @helper_starredEq_570 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@U) (@corr) + (@baseU) (@hcore) (@K) (@hcount) (@stageEq) (@j) + have storedEq (j : Fin (K.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H (index j) := by + unfold HierarchyStoredColorsAt + dsimp only + rw [hdata.2.2, starredEq j] + have missingEq (j : Fin (K.dividerCount + 1)) : + HierarchyStageMissingColors K j = HierarchyStageMissingColors H (index j) := by + exact @helper_missingEq_587 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@U) (@corr) + (@baseU) (@K) (@hcount) (@hdata) (@stageEq) (@j) + have segmentEqInternal (i : Fin K.dividerCount) (eta : Fin k) : + HierarchySegmentColors K i.castSucc eta = + HierarchySegmentColors H (index i.castSucc) eta := by + exact @helper_segmentEqInternal_600 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) + (@corrStar) (@baseStar) (@HStar) (@hstarLen) (@hminusLen) (@hstarLength) (@beta) + (@hApositive) (@stageLengthMono) (@U) (@corr) (@baseU) (@K) (@hcount) (@hBU) (@stageEq) + (@starredEq) (@i) (@eta) + have indexLast : index (Fin.last K.dividerCount) = q := by + apply Fin.ext + simp [index, q] + have terminalSegmentEq (eta : Fin k) : + HierarchySegmentColors K (Fin.last K.dividerCount) eta = + Finset.univ.filter (fun c => ∃ r : Fin U.length, + A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi U eta).val U.length ∧ + phi (U.edge r) = some c) := by + exact @helper_terminalSegmentEq_627 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@U) (@corr) + (@baseU) (@K) (@hcount) (@starredEq) (@indexLast) (@eta) + let goodU : GoodHierarchy K := by + exact @helperGoodU2513 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@R) (@corrMinus) + (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@beta) (@U) (@corr) (@baseU) + (@hcore) (@hclosure) (@K) (@hcount) (@havoid) (@hdata) (@stageEq) (@starredEq) + (@storedEq) (@missingEq) (@segmentEqInternal) (@indexLast) (@terminalSegmentEq) + exact ⟨goodU, by intro j eta; rfl⟩ + exact @helper_continuation_4102 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hell) (@hsum) (@hBlen) (@hBT) (@halpha) (@R) (@corrMinus) (@hminusMP) (@baseMinus) + (@hminusCore) (@hminusClosure) (@HMinus) (@hminusCount) (@hminusStages) (@corrStar) + (@hstarMP) (@baseStar) (@hstarCore) (@hstarClosure) (@HStar) (@hstarCount) (@hstarStages) + (@hBminus) (@hstarLen) (@hminusStar) (@hminusLen) (@hstarLength) (@beta) (@hbetaMissing) + (@hbetaUnused) (@hcolorsDistinct) (@firstMissingLe) (@firstMissingMem) (@vertexMem) + (@missingMono) (@hbetaT) (@hbetaFirstBound) (@hDnDisjoint) (@hcomponentPenultimate) + (@hminusTerminalAvoidance) (@hBstar) (@hstarFirstEdge) (@hstarTerminalAvoidance) + (@terminalData) (@copyGood) + +private theorem helper_terminalAvoidance_4467.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ¬∃ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) ∧ + D.theta ∈ C.good.gamma q eta), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + ∀ (_ : (2 : ℕ) ≤ ell) (_ : ell = T.length - A.length) + (_ : A.length + ell = T.length) (_ : B.length = T.length - (2 : ℕ)) + (_ : TreeSequenceInitialSegment B T) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (baseStar : HierarchyBase corrStar.replacementETT phi) + (_ : TashkinovHierarchy corrStar.replacementETT baseStar) + (_ : R.star.length = R.minus.length + (1 : ℕ)) + (_ : R.minus.length = B.length + (1 : ℕ)) + (_ : R.star.length = T.length) (_ : Fin k) + (_ : + ∀ (S : TreeSequence G e0) (c : Fin k) + (_ : (↑(HierarchyFirstMissingPosition phi S c) : ℕ) < S.length), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (_ : + ∀ (U : TreeSequence G e0) (_ : TreeSequenceInitialSegment B U) (eta : Fin k) + (r : ℕ) (_ : r ≤ B.length) + (_ : r < (↑(HierarchyFirstMissingPosition phi U eta) : ℕ)), + r < (↑(HierarchyFirstMissingPosition phi T eta) : ℕ)) + (_ : + ∀ (eta c : Fin k) (r : Fin T.length) (_ : A.length ≤ (↑r : ℕ)) + (_ : (↑r : ℕ) < (↑(HierarchyFirstMissingPosition phi T eta) : ℕ)) + (_ : phi (T.edge r) = some c), + c ∈ HierarchySegmentColors H q eta) + (U : TreeSequence G e0) (_ : TreeSequenceInitialSegment B U) + (_ : U.length ≤ B.length + (2 : ℕ)) + (_ : + ∀ (r : Fin U.length), + (↑r : ℕ) = B.length → + U.edge r = T.edge D.lastEdgeIndex) + (_ : + ∀ (r : Fin U.length), + (↑r : ℕ) = B.length + (1 : ℕ) → + U.edge r = T.edge R.penultimateEdgeIndex), + ∀ eta ∈ HierarchyStoredColorsAt H q, + Disjoint (C.good.gamma q eta) + ({c : Fin k | + ∃ (r : Fin U.length), + A.length ≤ (↑r : ℕ) ∧ + (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ + phi (U.edge r) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hnonexceptional H q A ell B htail hell + hsum hBlen hBT R corrMinus baseMinus HMinus corrStar baseStar HStar hstarLen hminusLen + hstarLength beta firstMissingMemBelow firstLowerInOld oldSegmentMember U hBU hlen + hfirstEdge hsecondEdge + exact @helper_terminalAvoidance_394 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnonexceptional) (@htail) (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) + (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@hstarLen) (@hminusLen) + (@hstarLength) (@beta) (@firstMissingMemBelow) (@firstLowerInOld) (@oldSegmentMember) + (@U) (@hBU) (@hlen) (@hfirstEdge) (@hsecondEdge) + +private abbrev helperContinuation4495Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (hnonexceptional : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ¬∃ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) ∧ D.theta ∈ C.good.gamma q eta), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (htail : (2 : ℕ) ≤ ell) (hell : ell = T.length - A.length) (hsum : A.length + ell = T.length) + (hBlen : B.length = T.length - (2 : ℕ)) (hBT : TreeSequenceInitialSegment B T) + (hprefixElementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus)) + (halpha : + D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (hminusMP : MaximumProperty corrMinus.replacementETT) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (hminusCore : baseMinus.core = base.core) (hminusClosure : baseMinus.closure = base.closure) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hminusCount : HMinus.dividerCount = C.hierarchy.dividerCount) + (hminusStages : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HMinus.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (hstarMP : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) (hstarCore : baseStar.core = base.core) + (hstarClosure : baseStar.closure = base.closure) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (hstarCount : HStar.dividerCount = C.hierarchy.dividerCount) + (hstarStages : + ∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), + HStar.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) + (hBminus : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) + R.minus) + (hstarLen : R.star.length = R.minus.length + (1 : ℕ)) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (hstarEdge : + R.star.edge (Fin.cast (by omega) (Fin.last R.minus.length)) = T.edge R.penultimateEdgeIndex) + (hminusLen : R.minus.length = B.length + (1 : ℕ)) + (hminusEdge : + R.minus.edge + (Fin.cast (by change B.length + 1 = R.minus.length; exact hminusLen.symm) + (Fin.last (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))).length)) = + T.edge D.lastEdgeIndex) + (hstarLength : R.star.length = T.length) (beta : Fin k) + (hbetaMissing : beta ∈ TreeMissingColors phi B) + (hbetaUnused : + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) + (hcolorsDistinct : beta ≠ D.alpha) + (firstMissingLe : + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) + (hc : c ∈ MissingColors G phi (S.vertex i)), + HierarchyFirstMissingPosition phi S c ≤ i) + (firstMissingMem : + ∀ (S : TreeSequence G e0) (c : Fin k) (hc : c ∈ TreeMissingColors phi S), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (vertexMem : + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) + (missingMono : + ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U), + TreeMissingColors phi S ⊆ TreeMissingColors phi U) + (hbetaT : beta ∈ TreeMissingColors phi T) + (hbetaFirstBound : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (halphaFirst : HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex) + (hbetaPrefix : beta ∈ TreeMissingColors phi Bplus) + (halphaPrefix : D.alpha ∈ TreeMissingColors phi Bplus) + (horderedUnused : + beta ∉ TreeMissingColors phi A ∨ D.alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T beta)) + (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ + beta ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T D.alpha) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k))) + (hDnDisjoint : Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) + (hDnqDisjoint : + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + (HierarchyStoredColorsAt H q)), + False + +private theorem helper_continuation_4495.{u_1, u_2} : + helperContinuation4495Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hnonexceptional H q A ell B Bplus n Dn + htail hell hsum hBlen hBT hprefixElementary halpha R corrMinus hminusMP baseMinus + hminusCore hminusClosure HMinus hminusCount hminusStages corrStar hstarMP baseStar + hstarCore hstarClosure HStar hstarCount hstarStages hBminus hstarLen hminusStar hstarEdge + hminusLen hminusEdge hstarLength beta hbetaMissing hbetaUnused hcolorsDistinct + firstMissingLe firstMissingMem vertexMem missingMono hbetaT hbetaFirstBound halphaFirst + hbetaPrefix halphaPrefix horderedUnused hDnDisjoint hDnqDisjoint + have hchange := ChangeLemma G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality hprefixElementary ctx.largeMissingSet + beta D.alpha hcolorsDistinct ⟨hbetaPrefix, halphaPrefix⟩ horderedUnused + have hcomponentPenultimate : + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T beta))) = + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + apply helper_hcomponentPenultimate_325 <;> assumption + have firstMissingMemBelow (S : TreeSequence G e0) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition phi S c).val < S.length) : + c ∈ MissingColors G phi + (S.vertex (HierarchyFirstMissingPosition phi S c)) := by + exact @helper_firstMissingMemBelow_339 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@R) + (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@beta) (@S) (@c) + (@hlt) + -- A strict cutoff inside the common prefix also holds in the old display. + have firstLowerInOld (U : TreeSequence G e0) + (hBU : TreeSequenceInitialSegment B U) (eta : Fin k) (r : ℕ) + (hrB : r ≤ B.length) + (hrU : r < (HierarchyFirstMissingPosition phi U eta).val) : + r < (HierarchyFirstMissingPosition phi T eta).val := by + exact @helper_firstLowerInOld_3203 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) + (@hstarLen) (@hminusLen) (@hstarLength) (@beta) (@firstMissingLe) (@firstMissingMemBelow) + (@U) (@hBU) (@eta) (@r) (@hrB) (@hrU) + have oldSegmentMember (eta c : Fin k) (r : Fin T.length) + (hlo : A.length ≤ r.val) + (hhi : r.val < (HierarchyFirstMissingPosition phi T eta).val) + (hcolor : phi (T.edge r) = some c) : + c ∈ HierarchySegmentColors H q eta := by + apply helper_oldSegmentMember_377 <;> assumption + have terminalAvoidance (U : TreeSequence G e0) + (hBU : TreeSequenceInitialSegment B U) + (hlen : U.length ≤ B.length + 2) + (hfirstEdge : ∀ r : Fin U.length, r.val = B.length → + U.edge r = T.edge D.lastEdgeIndex) + (hsecondEdge : ∀ r : Fin U.length, r.val = B.length + 1 → + U.edge r = T.edge R.penultimateEdgeIndex) : + ∀ eta ∈ HierarchyStoredColorsAt H q, + Disjoint (C.good.gamma q eta) + (Finset.univ.filter fun c => ∃ r : Fin U.length, + A.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi U eta).val U.length ∧ + phi (U.edge r) = some c) := by + exact @helper_terminalAvoidance_4467 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnonexceptional) (@htail) (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) + (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@hstarLen) (@hminusLen) + (@hstarLength) (@beta) (@firstMissingMemBelow) (@firstLowerInOld) (@oldSegmentMember) + (@U) (@hBU) (@hlen) (@hfirstEdge) (@hsecondEdge) + have hminusFirstEdge (r : Fin R.minus.length) (hr : r.val = B.length) : + R.minus.edge r = T.edge D.lastEdgeIndex := by + have hi : r = Fin.cast hminusLen.symm (Fin.last B.length) := by + apply Fin.ext + exact hr + rw [hi] + exact hminusEdge + have hminusTerminalAvoidance := terminalAvoidance R.minus hBminus (by omega) + hminusFirstEdge (by + intro r hr + have hi := r.isLt + omega) + have hBstar : TreeSequenceInitialSegment B R.star := by + exact @helper_hBstar_471 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@R) (@hBminus) + (@hminusStar) + exact @helper_continuation_4235 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hell) (@hsum) (@hBlen) (@hBT) (@halpha) (@R) (@corrMinus) (@hminusMP) (@baseMinus) + (@hminusCore) (@hminusClosure) (@HMinus) (@hminusCount) (@hminusStages) (@corrStar) + (@hstarMP) (@baseStar) (@hstarCore) (@hstarClosure) (@HStar) (@hstarCount) (@hstarStages) + (@hBminus) (@hstarLen) (@hminusStar) (@hstarEdge) (@hminusLen) (@hstarLength) (@beta) + (@hbetaMissing) (@hbetaUnused) (@hcolorsDistinct) (@firstMissingLe) (@firstMissingMem) + (@vertexMem) (@missingMono) (@hbetaT) (@hbetaFirstBound) (@hDnDisjoint) + (@hcomponentPenultimate) (@terminalAvoidance) (@hminusFirstEdge) (@hminusTerminalAvoidance) + (@hBstar) + +theorem HierarchySituationTwoSubcaseTwoOneNonexceptional {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData + G k e0 input T phi ett base C ctx) + (hnonexceptional : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + ¬ ∃ eta, eta ∈ HierarchyStoredColorsAt H q ∧ + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) ∧ + D.theta ∈ C.good.gamma q eta) : + False := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (ell - 2) + let Bplus := HierarchyFullTailPrefix C (ell - 1) + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Dn := TashkinovStoredColors ett.series.data n + have htail : 2 ≤ ell := D.tailAtLeastTwo + have hell : ell = T.length - A.length := rfl + have hsum : A.length + ell = T.length := by omega + have hBlen : B.length = T.length - 2 := by + change min (A.length + (ell - 2)) T.length = T.length - 2 + omega + have hBpluslen : Bplus.length = T.length - 1 := by + change min (A.length + (ell - 1)) T.length = T.length - 1 + omega + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + have hBplusT : TreeSequenceInitialSegment Bplus T := + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + have hBBplus : TreeSequenceInitialSegment B Bplus := + ⟨by omega, (by intro i; rfl), (by intro i; rfl)⟩ + have hprefixElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet Bplus) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have halpha := HierarchySituationTwoCaseTwoExclusions + G k e0 input T phi ett base C ctx D + change D.alpha ∉ TreeMissingColors phi B ∧ D.alpha ∉ Dn ∧ + ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some D.alpha at halpha + obtain ⟨R, hroute, hminusRoute, hstarRoute, + corrMinus, hminusMP, baseMinus, hminusCore, hminusClosure, + hminusSupport, HMinus, hminusCount, hminusStages, hminusPositions, + corrStar, hstarMP, baseStar, hstarCore, hstarClosure, + hstarSupport, HStar, hstarCount, hstarStages, hstarPositions⟩ := + HierarchySituationTwoReorderedTreesCertified + G k e0 input T phi ett base C ctx D.toHierarchySituationTwoTailData + obtain ⟨hminusLen, hBminus, hminusEdge⟩ := R.minusFinal + obtain ⟨hstarLen, hminusStar, hstarEdge⟩ := R.starFinal + change R.minus.length = B.length + 1 at hminusLen + have hminusLength : R.minus.length = T.length - 1 := by omega + have hstarLength : R.star.length = T.length := by omega + let baseExtraMissing := + (TreeSequenceVertexSet base.core \ + TreeSequenceVertexSet (ett.series.data.tree n.castSucc)).biUnion + fun v => MissingColors G phi v + let prefixUsed : Finset (Fin k) := Finset.univ.filter fun c => + ∃ r : Fin T.length, A.length ≤ r.val ∧ + r.val < A.length + (ell - 2) ∧ phi (T.edge r) = some c + let available := (TreeMissingColors phi B \ baseExtraMissing) \ prefixUsed + have havailable : 2 * ett.rounds + 11 ≤ available.card := + (NineN G k e0 input T phi ett C.positive base H C.good + hprefixElementary ctx.largeMissingSet (ell - 2) + (by change ell - 2 < ell; omega)).1 + -- Only the two exact final edges are added to the used-color exclusion. + let finalColors : Finset (Fin k) := + (Finset.univ.filter fun c => + phi (T.edge R.penultimateEdgeIndex) = some c) ∪ + (Finset.univ.filter fun c => phi (T.edge D.lastEdgeIndex) = some c) + have singleColorCard (f : E) : + (Finset.univ.filter fun c => phi f = some c).card ≤ 1 := by + apply Finset.card_le_one.mpr + intro a ha b hb + exact Option.some.inj ((Finset.mem_filter.mp ha).2.symm.trans + (Finset.mem_filter.mp hb).2) + have hfinalCard : finalColors.card ≤ 2 := by + apply helper_hfinalCard_138 <;> assumption + have hDnCard : Dn.card ≤ ett.rounds := by + simpa [Dn, n] using TashkinovStoredColorsCardinality + G k ett.rounds e0 input ett.series n + have hremaining : ett.rounds + 9 ≤ + ((available \ finalColors) \ Dn).card := by + apply helper_hremaining_149 <;> assumption + have hnonempty : ((available \ finalColors) \ Dn).Nonempty := by + apply Finset.card_pos.mp + omega + obtain ⟨beta, hbeta⟩ := hnonempty + obtain ⟨hbetaAvailableFinal, hbetaDn⟩ := Finset.mem_sdiff.mp hbeta + obtain ⟨hbetaAvailable, hbetaFinal⟩ := Finset.mem_sdiff.mp hbetaAvailableFinal + obtain ⟨hbetaMissingExtra, hbetaPrefixUnused⟩ := Finset.mem_sdiff.mp hbetaAvailable + obtain ⟨hbetaMissing, hbetaExtra⟩ := Finset.mem_sdiff.mp hbetaMissingExtra + have hbetaUnused : ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some beta := by + exact @helper_hbetaUnused_164 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hell) (@hsum) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) + (@HStar) (@hstarLen) (@hstarLength) (@beta) (@hbetaFinal) (@hbetaPrefixUnused) + have hcolorsDistinct : beta ≠ D.alpha := by + intro heq + exact halpha.1 (heq ▸ hbetaMissing) + have firstMissingLe (S : TreeSequence G e0) (c : Fin k) + (i : Fin (S.length + 1)) + (hc : c ∈ MissingColors G phi (S.vertex i)) : + HierarchyFirstMissingPosition phi S c ≤ i := by + apply helper_firstMissingLe_188; assumption + have firstMissingMem (S : TreeSequence G e0) (c : Fin k) + (hc : c ∈ TreeMissingColors phi S) : + c ∈ MissingColors G phi + (S.vertex (HierarchyFirstMissingPosition phi S c)) := by + apply helper_firstMissingMem_201; assumption + have vertexMem (S : TreeSequence G e0) (i : Fin (S.length + 1)) : + S.vertex i ∈ TreeSequenceVertexSet S := by + simpa only [TreeSequenceVertexSet] using + ((@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨i, Finset.mem_univ _, rfl⟩) + have missingMono {S U : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) : + TreeMissingColors phi S ⊆ TreeMissingColors phi U := by + apply helper_missingMono_224; assumption + have hbetaT : beta ∈ TreeMissingColors phi T := missingMono hBT hbetaMissing + have halphaT : D.alpha ∈ TreeMissingColors phi T := + Finset.mem_biUnion.mpr + ⟨_, vertexMem T D.penultimateVertexIndex, D.alphaMissingPenultimate⟩ + have hbetaFirstBound : (HierarchyFirstMissingPosition phi T beta).val ≤ B.length := by + exact @helper_hbetaFirstBound_243 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) + (@hstarLen) (@hminusLen) (@hstarLength) (@beta) (@hbetaMissing) (@firstMissingLe) + have halphaFirst : HierarchyFirstMissingPosition phi T D.alpha = + D.penultimateVertexIndex := by + exact @helper_halphaFirst_3258 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@halpha) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) + (@baseStar) (@HStar) (@hstarLen) (@hminusLen) (@hstarLength) (@beta) (@firstMissingLe) + (@firstMissingMem) (@vertexMem) (@halphaT) + have hbetaPrefix : beta ∈ TreeMissingColors phi Bplus := + missingMono hBBplus hbetaMissing + have halphaPrefix : D.alpha ∈ TreeMissingColors phi Bplus := by + exact @helper_halphaPrefix_278 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBpluslen) (@hBplusT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) + (@HStar) (@hstarLen) (@hminusLength) (@hstarLength) (@beta) (@vertexMem) + have horderedUnused : + (beta ∉ TreeMissingColors phi A ∨ D.alpha ∉ TreeMissingColors phi A) → + TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition phi T beta)) + (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ + beta ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + A.length ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition phi T D.alpha).val ∧ + phi (T.edge t) = some c) := by + exact @helper_horderedUnused_3229 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) + (@hstarLen) (@hminusLen) (@hstarLength) (@beta) (@hbetaUnused) (@hbetaFirstBound) + (@halphaFirst) + have hDnDisjoint : Disjoint ({beta, D.alpha} : Finset (Fin k)) Dn := by + exact @helper_hDnDisjoint_3416 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@halpha) (@R) (@beta) (@hbeta) (@hbetaAvailableFinal) (@hbetaDn) (@hbetaAvailable) + (@hbetaFinal) (@hbetaMissingExtra) (@hbetaPrefixUnused) (@hbetaMissing) (@hbetaExtra) + (@hbetaUnused) (@hcolorsDistinct) (@hbetaT) (@hbetaFirstBound) (@hbetaPrefix) + (@horderedUnused) + have hDnqDisjoint : Disjoint ({beta, D.alpha} : Finset (Fin k)) + (HierarchyStoredColorsAt H q) := by + apply hDnDisjoint.mono_right + exact Finset.sdiff_subset + exact @helper_continuation_4495 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnonexceptional) (@htail) (@hell) (@hsum) (@hBlen) (@hBT) (@hprefixElementary) (@halpha) + (@R) (@corrMinus) (@hminusMP) (@baseMinus) (@hminusCore) (@hminusClosure) (@HMinus) + (@hminusCount) (@hminusStages) (@corrStar) (@hstarMP) (@baseStar) (@hstarCore) + (@hstarClosure) (@HStar) (@hstarCount) (@hstarStages) (@hBminus) (@hstarLen) (@hminusStar) + (@hstarEdge) (@hminusLen) (@hminusEdge) (@hstarLength) (@beta) (@hbetaMissing) + (@hbetaUnused) (@hcolorsDistinct) (@firstMissingLe) (@firstMissingMem) (@vertexMem) + (@missingMono) (@hbetaT) (@hbetaFirstBound) (@halphaFirst) (@hbetaPrefix) (@halphaPrefix) + (@horderedUnused) (@hDnDisjoint) (@hDnqDisjoint) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean new file mode 100644 index 0000000000..6e21c9dcea --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean @@ -0,0 +1,2031 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoExclusions +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Hierarchy Situation Two Subcase Two One Stored Exception + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperSwapStep439Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) (eta : Fin k), + (∀ {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + ∀ (col : PartialEdgeColoring E k), TreeMissingColors col X ⊆ TreeMissingColors col Y) → + (∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G col (T.vertex i) → + c ∈ MissingColors G col (T.vertex (HierarchyFirstMissingPosition col T c)) ∧ + (↑(HierarchyFirstMissingPosition col T c) : ℕ) ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → + ell = T.length - A.length → + X.length = T.length - (1 : ℕ) → + (↑D.penultimateVertexIndex : ℕ) = X.length → + (↑D.lastEdgeIndex : ℕ) = X.length → + X.length + (1 : ℕ) = T.length → + X.length = A.length + (ell - (1 : ℕ)) → + (1 : ℕ) ≤ ell - (1 : ℕ) → + ell - (1 : ℕ) < ell → + TreeSequenceInitialSegment X T → + TreeSequenceInitialSegment A X → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + HierarchyFirstMissingPosition phi T eta = D.penultimateVertexIndex → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A ∧ + HierarchyFullTailLength P.counterexample = ell ∧ + HierarchyFullTailPrefix P.counterexample (ell - (1 : ℕ)) = X ∧ + HierarchyPathNumber P.counterexample.hierarchy = HierarchyPathNumber H) → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (a b : Fin k), + a ≠ b → + a ∈ TreeMissingColors P.coloring A → + a ∈ + HierarchyStageMissingColors P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some a) → + b ∈ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ + b ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) → + P.coloring (T.edge D.lastEdgeIndex) = some D.theta → + D.theta ∉ + MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + ∃ (P' : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P'.coloring = + TwoColorComponentSwap G P.coloring a b + (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P'.coloring v = MissingColors G P.coloring v) ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → P'.coloring (T.edge t) = P.coloring (T.edge t) + +private abbrev helperContinuation1279Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + (2 : ℕ) ≤ ell → + TreeSequenceInitialSegment A X → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + ∀ (gamma : Fin k), + D.theta ≠ gamma → + gamma ∈ HierarchyStageMissingColors C.hierarchy q ∧ + gamma ∉ HierarchySegmentColors C.hierarchy q eta → + gamma ∈ TreeMissingColors phi A → + gamma ≠ D.alpha → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some gamma) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A ∧ + HierarchyFullTailLength P.counterexample = ell ∧ + HierarchyFullTailPrefix P.counterexample (ell - (1 : ℕ)) = X ∧ + HierarchyPathNumber P.counterexample.hierarchy = HierarchyPathNumber H) → + ∀ + (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { + replacementInput := input, replacementSeries := ett.series, + replacementETT := ett, rungAgreement := rfl, seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (x : Fin ett.rounds) ↦ rfl, + storedColorsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + connectingEdgesAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + extensionKindsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + replacementProper := seriesProper, replacementOneUncolored := seriesOne, + replacementStable := fun (x : Fin ett.rounds) ↦ + (⟨fun (x_1 : E) + (x_2 : TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) x_1) + (x_3 : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ x_1 = some c) ↦ + rfl, + fun (x_1 : V) + (x_2 : x_1 ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc)) ↦ + rfl⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ f = some c) → + ett.series.data.coloring x.succ f = ett.series.data.coloring x.succ f) ∧ + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc), + MissingColors G (ett.series.data.coloring x.succ) v = + MissingColors G (ett.series.data.coloring x.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { + coloring := phi, corresponding := selfCorr, maximum := C.maximum, + replacementBase := base, counterexample := C, + sameGood := + (⟨(⟨rfl, + (⟨by + have := GoldbergSeymour.TreeSequence.positive T + omega, + (⟨HEq.rfl, + (⟨HEq.rfl, + (⟨Iff.rfl, + fun + (x : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) ↦ + rfl⟩ : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + base.core = base.core ∧ + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure)), + Exists.intro + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + fun (x : Fin (C.hierarchy.dividerCount + (1 : ℕ))) ↦ + (⟨rfl, fun (x_1 : Fin k) (x_2 : x_1 ∈ HierarchyStoredColorsAt C.hierarchy x) ↦ + rfl⟩ : + HierarchyStoredColorsAt C.hierarchy x = + HierarchyStoredColorsAt C.hierarchy + (Fin.cast + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + selfCorr + have := GoldbergSeymour.TreeSequence.positive T + omega) + x) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy x, + C.good.gamma x eta = + C.good.gamma + (Fin.cast + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + selfCorr + have := GoldbergSeymour.TreeSequence.positive T + omega) + x) + eta)⟩ : + SameHierarchyStages C.hierarchy C.hierarchy ∧ + ∃ (hcount : C.hierarchy.dividerCount = C.hierarchy.dividerCount), + ∀ (j : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + have j₂ : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.cast + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement selfCorr + have := GoldbergSeymour.TreeSequence.positive T + omega) + j; + HierarchyStoredColorsAt C.hierarchy j = + HierarchyStoredColorsAt C.hierarchy j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy j, + C.good.gamma j eta = C.good.gamma j₂ eta), + minimumContext := ctx : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx }; + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (a b : Fin k), + a ≠ b → + a ∈ TreeMissingColors P.coloring A → + a ∈ + HierarchyStageMissingColors P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some a) → + b ∈ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ + b ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) → + P.coloring (T.edge D.lastEdgeIndex) = some D.theta → + D.theta ∉ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + ∃ (P' : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P'.coloring = + TwoColorComponentSwap G P.coloring a b + (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P'.coloring v = MissingColors G P.coloring v) ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + P'.coloring (T.edge t) = P.coloring (T.edge t)) → + A.length ≤ (↑D.lastEdgeIndex : ℕ) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + eta ∈ + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta = + (insert D.theta ({ gamma } : Finset (Fin k)) : Finset (Fin k))) → + False + +private abbrev helperContinuation834Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) (eta : Fin k), + (∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G col (T.vertex i) → + c ∈ MissingColors G col (T.vertex (HierarchyFirstMissingPosition col T c)) ∧ + (↑(HierarchyFirstMissingPosition col T c) : ℕ) ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (hAT : TreeSequenceInitialSegment A T), + X.length = T.length - (1 : ℕ) → + (↑D.penultimateVertexIndex : ℕ) = X.length → + (↑D.lastEdgeIndex : ℕ) = X.length → + X.length + (1 : ℕ) = T.length → + X.length = A.length + (ell - (1 : ℕ)) → + TreeSequenceInitialSegment X T → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + HierarchyFirstMissingPosition phi T eta = D.penultimateVertexIndex → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (a b : Fin k), + a ≠ b → + a ∈ TreeMissingColors P.coloring A → + b ∈ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ + b ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) → + let J : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let C' : HierarchyCounterexample P.replacementBase := P.counterexample; + let col : PartialEdgeColoring E k := P.coloring; + let H' : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + C'.hierarchy; + let q' : Fin (H'.dividerCount + (1 : ℕ)) := Fin.last H'.dividerCount; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; + HierarchyStarredStage C'.hierarchy (Fin.last C'.hierarchy.dividerCount) = A → + HierarchyStarredStage H' q' = A → + HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - (1 : ℕ)) = X → + ColoredVertexSetElementary G col (TreeSequenceVertexSet X) → + HierarchyFirstMissingPosition col T b = D.penultimateVertexIndex → + ∀ v ∈ TreeSequenceVertexSet A, + ∀ (i : Fin (A.length + (1 : ℕ))), + a ∈ + MissingColors G col (T.vertex (HierarchyFirstMissingPosition col T a)) ∧ + (↑(HierarchyFirstMissingPosition col T a) : ℕ) ≤ + (↑(Fin.castLE (Nat.succ_le_succ hAT.1) i) : ℕ) → + let va : V := T.vertex (HierarchyFirstMissingPosition col T a); + let vb : V := T.vertex D.penultimateVertexIndex; + let vt : V := T.vertex D.terminalVertexIndex; + va ∈ TreeSequenceVertexSet X → + (↑(HierarchyFirstMissingPosition col T a) : ℕ) < + (↑D.penultimateVertexIndex : ℕ) → + a ∈ + TreeMissingColors col + (HierarchyFullTailPrefix C' + (HierarchyFullTailLength C' - (1 : ℕ))) ∧ + b ∈ + TreeMissingColors col + (HierarchyFullTailPrefix C' + (HierarchyFullTailLength C' - (1 : ℕ))) → + (∀ (w : V ⊕ E), w ∈ TwoColorComponent G col a b w) → + Disjoint (TwoColorComponent G col a b z) + (TwoColorComponent G col a b (Sum.inl va)) → + TwoColorPathComponent G col a b z → + (0 : ℕ) < H'.dividerCount ∧ + a ∈ + TreeMissingColors col + (H'.stage + (⟨H'.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H'.dividerCount + (2 : ℕ)))) ∨ + H'.dividerCount = (0 : ℕ) ∧ + (a ∈ + TreeMissingColors col + (J.series.data.tree (Fin.last J.rounds).castSucc) ∨ + a ∈ TreeMissingColors col (HierarchyStarredStage H' q') ∧ + a ∉ TashkinovStoredColors J.series.data (Fin.last J.rounds) ∧ + b ∉ TashkinovStoredColors J.series.data (Fin.last J.rounds)) → + (have C : Set (V ⊕ E) := TwoColorComponent G col a b z; + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G col a b z; + (∀ (v : V), + Sum.inl v ∉ C → + MissingColors G phi' v = MissingColors G col v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + a ∈ MissingColors G col v → b ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + b ∈ MissingColors G col v → a ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ a → + c ≠ b → + (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G col v)) → + (∀ u ∈ TreeSequenceVertexSet X, + MissingColors G mu u = MissingColors G col u) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → mu (T.edge t) = col (T.edge t)) → + ∃ (P' : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + P'.coloring = + TwoColorComponentSwap G P.coloring a b + (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P'.coloring v = + MissingColors G P.coloring v) ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + P'.coloring (T.edge t) = P.coloring (T.edge t) + +private abbrev helperBranch993Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A X → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + ∀ gamma ∈ TreeMissingColors phi A, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some gamma) → + ∀ + (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { + replacementInput := input, replacementSeries := ett.series, replacementETT := ett, + rungAgreement := rfl, seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (x : Fin ett.rounds) ↦ rfl, + storedColorsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + connectingEdgesAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + extensionKindsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + replacementProper := seriesProper, replacementOneUncolored := seriesOne, + replacementStable := fun (x : Fin ett.rounds) ↦ + (⟨fun (x_1 : E) (_ : TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) x_1) + (_ : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ x_1 = some c) ↦ + rfl, + fun (x_1 : V) + (_ : x_1 ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc)) ↦ + rfl⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ f = some c) → + ett.series.data.coloring x.succ f = ett.series.data.coloring x.succ f) ∧ + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree x.succ.castSucc), + MissingColors G (ett.series.data.coloring x.succ) v = + MissingColors G (ett.series.data.coloring x.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { + coloring := phi, corresponding := selfCorr, maximum := C.maximum, + replacementBase := base, counterexample := C, + sameGood := + (⟨(⟨rfl, + (⟨rfl, + (⟨HEq.rfl, + (⟨HEq.rfl, + (⟨Iff.rfl, + fun + (_ : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) ↦ + rfl⟩ : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + base.core = base.core ∧ + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ↔ + selfCorr.replacementETT.series.data.kind + (Fin.last selfCorr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.closure = base.closure)), + Exists.intro rfl fun (x : Fin (C.hierarchy.dividerCount + (1 : ℕ))) ↦ + (⟨rfl, fun (x_1 : Fin k) (_ : x_1 ∈ HierarchyStoredColorsAt C.hierarchy x) ↦ rfl⟩ : + HierarchyStoredColorsAt C.hierarchy x = + HierarchyStoredColorsAt C.hierarchy (Fin.cast (by omega) x) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy x, + C.good.gamma x eta = C.good.gamma (Fin.cast (by omega) x) eta)⟩ : + SameHierarchyStages C.hierarchy C.hierarchy ∧ + ∃ (_ : C.hierarchy.dividerCount = C.hierarchy.dividerCount), + ∀ (j : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + have j₂ : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + HierarchyStoredColorsAt C.hierarchy j = HierarchyStoredColorsAt C.hierarchy j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy j, + C.good.gamma j eta = C.good.gamma j₂ eta), + minimumContext := ctx : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx }; + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), + a ≠ b → + a ∈ TreeMissingColors P.coloring A → + a ∈ + HierarchyStageMissingColors P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some a) → + b ∈ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ + b ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) → + P.coloring (T.edge D.lastEdgeIndex) = some D.theta → + D.theta ∉ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P'.coloring = + TwoColorComponentSwap G P.coloring a b + (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P'.coloring v = MissingColors G P.coloring v) ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → P'.coloring (T.edge t) = P.coloring (T.edge t)) → + A.length ≤ (↑D.lastEdgeIndex : ℕ) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + eta ∈ + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta = + { D.theta, gamma }) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P.coloring v = MissingColors G phi v) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) = phi (T.edge t)) → + eta ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) → False) → + ∀ (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P1.coloring v = MissingColors G P0.coloring v) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → P1.coloring (T.edge t) = P0.coloring (T.edge t)) → + gamma ∈ MissingColors G P1.coloring (T.vertex D.terminalVertexIndex) → False + +private theorem helper_hierarchyGeometry_101.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b), + TreeSequenceInitialSegment (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ + TreeSequenceInitialSegment (J.series.data.tree (Fin.last J.rounds).castSucc) + (HierarchyStarredStage H (Fin.last H.dividerCount)) := by + classical + intro V E _ _ _ _ G k e0 T segmentTrans inp col J b H + have forward : ∀ (a d : ℕ), (hbound : a + d ≤ H.dividerCount + 1) → + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + intro a d + induction d with + | zero => intro h; exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + | succ d ih => + intro h + exact segmentTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let Tn := J.series.data.tree (Fin.last J.rounds).castSucc + change TreeSequenceInitialSegment A T ∧ TreeSequenceInitialSegment Tn A + have hTnCore : TreeSequenceInitialSegment Tn b.core := by + by_cases hp : J.series.data.kind (Fin.last J.rounds) = + some TashkinovExtensionKind.PE + · exact (b.parallel hp).2.2.some.leftSegment + · rw [b.nonparallel hp] + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + by_cases hq : H.dividerCount = 0 + · have hA : A = b.core := by + simp [A, HierarchyStarredStage, Fin.last, hq] + have hlast : H.stage ⟨1, by omega⟩ = T := by + convert H.terminalStage using 1 + apply congrArg H.stage + apply Fin.ext + simp [hq] + constructor + · rw [hA] + exact Eq.mp (congrArg (fun W : TreeSequence G e0 => + TreeSequenceInitialSegment b.core W) hlast) H.coreInsideFirst + · rw [hA] + exact hTnCore + · have hpos : 0 < H.dividerCount := Nat.pos_of_ne_zero hq + have hindex : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp + omega + have hA : A = H.stage ⟨H.dividerCount, by omega⟩ := by + dsimp [A, HierarchyStarredStage] + rw [hindex] + dsimp + apply congrArg H.stage + apply Fin.ext + simp + omega + have hlast : H.stage ⟨H.dividerCount + 1, by omega⟩ = T := H.terminalStage + have hTnStage : H.stage (0 : Fin (H.dividerCount + 2)) = Tn := H.baseStage + refine ⟨?_, ?_⟩ + · simpa [hA, hlast] using forward H.dividerCount 1 (by omega) + · simpa [hA, hTnStage] using forward 0 H.dividerCount (by omega) + +private theorem helper_hgammaTail_297.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (eta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + X.length = T.length - (1 : ℕ) → + (↑D.penultimateVertexIndex : ℕ) = X.length → + (↑D.lastEdgeIndex : ℕ) = X.length → + X.length + (1 : ℕ) = T.length → + X.length = A.length + (ell - (1 : ℕ)) → + HierarchyFirstMissingPosition phi T eta = D.penultimateVertexIndex → + ∀ (gamma : Fin k), + D.theta ≠ gamma → + gamma ∈ HierarchyStageMissingColors C.hierarchy q ∧ + gamma ∉ HierarchySegmentColors C.hierarchy q eta → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some gamma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta H q A ell X hXlen hPenVal hLastVal + hTlen hXexact hetaFirst gamma hthetaGamma hgammaAvoid t ht hc + by_cases hlast : t = D.lastEdgeIndex + · have htg : D.theta = gamma := + Option.some.inj (D.thetaOnLastEdge.symm.trans (hlast ▸ hc)) + exact hthetaGamma htg + · have hpos : t.val < D.penultimateVertexIndex.val := by + have hp := D.penultimateVertexPosition + have he := D.lastEdgePosition + have htlt := t.isLt + have hneq : t.val ≠ D.lastEdgeIndex.val := fun h => hlast (Fin.ext h) + omega + apply hgammaAvoid.2 + unfold HierarchySegmentColors + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + have hend : H.stage q.succ = T := H.terminalStage + let r : Fin (H.stage q.succ).length := + Fin.cast (congrArg TreeSequence.length hend.symm) t + refine ⟨r, ht, ?_, ?_⟩ + · simp only [hetaFirst] + dsimp [r] + rw [hend] + omega + · have edgeCast (U W : TreeSequence G e0) (h : U = W) + (i : Fin W.length) : + U.edge (Fin.cast (congrArg TreeSequence.length h.symm) i) = W.edge i := by + cases h + rfl + change phi ((H.stage q.succ).edge r) = some gamma + rw [edgeCast _ _ hend t] + exact hc + +private theorem helper_continuation_834.{u_1, u_2} : + helperContinuation834Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta firstMissing H q A ell X hAT hXlen + hPenVal hLastVal hTlen hXexact hXT hyp hetaFirst P a b hne haA hb hterminal J C' col H' q' + z mu hstar hstar' hXeq hxElem hbFirst v hv i haFirst va vb vt hvaX horder hmissingP rootMem + hdis hpath hcase hbehavior hprefix htailEdges + have hbNew : b ∈ MissingColors G mu (T.vertex D.penultimateVertexIndex) := by + rw [hprefix _ hyp] + exact hb + have hbNewFirst : HierarchyFirstMissingPosition mu T b = + D.penultimateVertexIndex := by + have hm := firstMissing mu b D.penultimateVertexIndex hbNew + let i : Fin (X.length + 1) := ⟨(HierarchyFirstMissingPosition mu T b).val, by + exact Nat.lt_succ_of_le (hm.2.trans (Nat.le_of_eq hPenVal))⟩ + have hv : T.vertex (HierarchyFirstMissingPosition mu T b) ∈ + TreeSequenceVertexSet X := + (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, Finset.mem_univ _, rfl⟩ + have hmOld : b ∈ MissingColors G col + (T.vertex (HierarchyFirstMissingPosition mu T b)) := by + rw [← hprefix _ hv] + exact hm.1 + by_contra hn + exact Finset.disjoint_left.mp + (hxElem hv hyp (fun he => hn (T.vertex_injective he))) hmOld hb + have hstoredFirst : ∀ c, c ∈ HierarchyStoredColorsAt H' q' → + HierarchyFirstMissingPosition mu T c = HierarchyFirstMissingPosition col T c := by + intro c hc + have hca : c ≠ a := by + intro he + have hnot := (Finset.mem_sdiff.mp hc).2 + apply hnot + change c ∈ TreeMissingColors col (HierarchyStarredStage H' q') + rw [hstar', he] + exact haA + by_cases hcb : c = b + · subst c + exact hbNewFirst.trans hbFirst.symm + · have hcandidates : + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G mu (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G col (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hbehavior.2.2.2 _ c hca hcb + unfold HierarchyFirstMissingPosition + simp only [hcandidates] + have hfull := StableChangeCasesOneTwoFullTail G k e0 + P.corresponding.replacementInput T col J P.replacementBase C' P.minimumContext + a b hne hmissingP + z hpath mu rfl hcase hdis + (by dsimp only; intro t ht + exact htailEdges t (by simpa only [hstar] using ht)) + (by intro v hv; rw [hXeq] at hv; exact hprefix v hv) hstoredFirst + obtain ⟨corr, hmax, baseNew, Hnew, goodNew, hsameGood⟩ := hfull.2.2.2.2 + have hnonElem : ¬ ColoredVertexSetElementary G mu (TreeSequenceVertexSet T) := by + intro he + have htMem : vt ∈ TreeSequenceVertexSet T := + (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨D.terminalVertexIndex, Finset.mem_univ _, rfl⟩ + rcases hterminal with hta | htb + · have hbTerminal : b ∈ MissingColors G mu vt := hbehavior.2.1 vt (rootMem z) hta + have hpMem := TreeSequenceInitialSegmentVertexSetSubset hXT hyp + have hnept : vb ≠ vt := by + intro heq + have hi := congrArg Fin.val (T.vertex_injective heq) + have hpp := D.penultimateVertexPosition + have htp := D.terminalVertexPosition + omega + exact Finset.disjoint_left.mp (he hpMem htMem hnept) hbNew hbTerminal + · have haTerminal : a ∈ MissingColors G mu vt := hbehavior.2.2.1 vt (rootMem z) htb + have hvaNot : Sum.inl va ∉ TwoColorComponent G col a b z := by + intro hva + exact Set.disjoint_left.mp hdis hva (rootMem (Sum.inl va)) + have haNew : a ∈ MissingColors G mu va := by + rw [hbehavior.1 va hvaNot] + exact haFirst.1 + have haMem := TreeSequenceInitialSegmentVertexSetSubset hXT hvaX + have hneat : va ≠ vt := by + intro heq + have hi := congrArg Fin.val (T.vertex_injective heq) + have htp := D.terminalVertexPosition + omega + exact Finset.disjoint_left.mp (he haMem htMem hneat) haNew haTerminal + let Cnew : HierarchyCounterexample baseNew := { + positive := by rw [corr.rungAgreement]; exact C'.positive + hierarchy := Hnew + good := goodNew + maximum := hmax + notElementary := hnonElem } + obtain ⟨Pnew, hcolor⟩ := HierarchyReplacementPresentationTrans + G k e0 input T phi ett base C ctx P mu corr baseNew Cnew hsameGood + refine ⟨Pnew, hcolor, ?_, ?_⟩ + · simpa [hcolor] using hprefix + · simpa [hcolor] using htailEdges + +private theorem helper_hdis_835.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (eta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (hAT : TreeSequenceInitialSegment A T), + X.length = T.length - (1 : ℕ) → + (↑D.penultimateVertexIndex : ℕ) = X.length → + (↑D.lastEdgeIndex : ℕ) = X.length → + X.length + (1 : ℕ) = T.length → + X.length = A.length + (ell - (1 : ℕ)) → + HierarchyFirstMissingPosition phi T eta = D.penultimateVertexIndex → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (a b : Fin k), + b ∈ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ + b ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) → + let col : PartialEdgeColoring E k := P.coloring; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + IsProperEdgeColoring G col → + HierarchyFirstMissingPosition col T b = D.penultimateVertexIndex → + ∀ (i : Fin (A.length + (1 : ℕ))), + a ∈ MissingColors G col (T.vertex (HierarchyFirstMissingPosition col T a)) ∧ + (↑(HierarchyFirstMissingPosition col T a) : ℕ) ≤ + (↑(Fin.castLE (Nat.succ_le_succ hAT.1) i) : ℕ) → + let va : V := T.vertex (HierarchyFirstMissingPosition col T a); + let vb : V := T.vertex D.penultimateVertexIndex; + let _ : V := T.vertex D.terminalVertexIndex; + (↑(HierarchyFirstMissingPosition col T a) : ℕ) < (↑D.penultimateVertexIndex : ℕ) → + TwoColorComponent G col a b (Sum.inl va) = TwoColorComponent G col a b (Sum.inl vb) → + (∀ (w : V ⊕ E), w ∈ TwoColorComponent G col a b w) → + (∀ (w : V), + a ∈ MissingColors G col w ∨ b ∈ MissingColors G col w → + ((TwoColorIncidenceGraph G col a b).neighborSet (Sum.inl w)).Subsingleton) → + Disjoint (TwoColorComponent G col a b z) (TwoColorComponent G col a b (Sum.inl va)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta H q A ell X hAT hXlen hPenVal + hLastVal hTlen hXexact hetaFirst P a b hb hterminal col z hp hbFirst i haFirst va vb vt + horder hsame rootMem leaf + rcases TwoColorComponentsDisjoint G col a b z (Sum.inl va) with heq | hd + · obtain ⟨u, w, p, hpPath, hsupp⟩ := + TwoColorComponentSpanningPath G col a b hp z + have endpoint (y : V) + (hy : Sum.inl y ∈ TwoColorComponent G col a b z) + (hm : a ∈ MissingColors G col y ∨ b ∈ MissingColors G col y) : + Sum.inl y = u ∨ Sum.inl y = w := by + have hySupp : Sum.inl y ∈ p.support := by + change Sum.inl y ∈ {x | x ∈ p.support} + rw [hsupp] + exact hy + by_contra hn + push Not at hn + exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 (leaf y hm) hySupp + have haEnd := endpoint va (heq.symm ▸ rootMem (Sum.inl va)) (Or.inl haFirst.1) + have hbEnd := endpoint vb + (heq.symm ▸ hsame.symm ▸ rootMem (Sum.inl vb)) (Or.inr hb) + have htEnd := endpoint vt (rootMem z) hterminal + have hab : (Sum.inl va : Sum V E) ≠ Sum.inl vb := by + intro h + have hi := congrArg Fin.val (T.vertex_injective (Sum.inl.inj h)) + omega + have hat : (Sum.inl va : Sum V E) ≠ Sum.inl vt := by + intro h + have hi := congrArg Fin.val (T.vertex_injective (Sum.inl.inj h)) + have ht := D.terminalVertexPosition + omega + have hbt : (Sum.inl vb : Sum V E) ≠ Sum.inl vt := by + intro h + have hi := congrArg Fin.val (T.vertex_injective (Sum.inl.inj h)) + have hbp := D.penultimateVertexPosition + have htp := D.terminalVertexPosition + omega + rcases haEnd with haEnd | haEnd <;> + rcases hbEnd with hbEnd | hbEnd <;> + rcases htEnd with htEnd | htEnd + · exact (hab (haEnd.trans hbEnd.symm)).elim + · exact (hab (haEnd.trans hbEnd.symm)).elim + · exact (hat (haEnd.trans htEnd.symm)).elim + · exact (hbt (hbEnd.trans htEnd.symm)).elim + · exact (hbt (hbEnd.trans htEnd.symm)).elim + · exact (hat (haEnd.trans htEnd.symm)).elim + · exact (hab (haEnd.trans hbEnd.symm)).elim + · exact (hab (haEnd.trans hbEnd.symm)).elim + · exact hd + +private theorem helper_hprefix_914.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (hAT : TreeSequenceInitialSegment A T), + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (a b : Fin k), + a ≠ b → + b ∈ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + let col : PartialEdgeColoring E k := P.coloring; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; + ColoredVertexSetElementary G col (TreeSequenceVertexSet X) → + ∀ (i : Fin (A.length + (1 : ℕ))), + a ∈ MissingColors G col (T.vertex (HierarchyFirstMissingPosition col T a)) ∧ + (↑(HierarchyFirstMissingPosition col T a) : ℕ) ≤ + (↑(Fin.castLE (Nat.succ_le_succ hAT.1) i) : ℕ) → + let va : V := T.vertex (HierarchyFirstMissingPosition col T a); + let vb : V := T.vertex D.penultimateVertexIndex; + va ∈ TreeSequenceVertexSet X → + TwoColorComponent G col a b (Sum.inl va) = TwoColorComponent G col a b (Sum.inl vb) → + (∀ (w : V ⊕ E), w ∈ TwoColorComponent G col a b w) → + Disjoint (TwoColorComponent G col a b z) (TwoColorComponent G col a b (Sum.inl va)) → + (have C : Set (V ⊕ E) := TwoColorComponent G col a b z; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G col v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → a ∈ MissingColors G col v → b ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → b ∈ MissingColors G col v → a ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ a → c ≠ b → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G col v)) → + (∀ {u : V} {e : E}, + Sum.inl u ∈ TwoColorComponent G col a b z → + Incident G u e → + col e = some a ∨ col e = some b → Sum.inr e ∈ TwoColorComponent G col a b z) → + ∀ u ∈ TreeSequenceVertexSet X, + MissingColors G mu u = MissingColors G col u := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell X hAT hyp P a b hne hb col z mu + hxElem i haFirst va vb hvaX hsame rootMem hdis hbehavior edgeIn u hu + by_cases huQ : Sum.inl u ∈ TwoColorComponent G col a b z + · have haNot : a ∉ MissingColors G col u := by + intro hau + have huv : u = va := by + by_contra hn + exact Finset.disjoint_left.mp (hxElem hu hvaX hn) hau haFirst.1 + exact Set.disjoint_left.mp hdis huQ (huv.symm ▸ rootMem (Sum.inl va)) + have hbNot : b ∉ MissingColors G col u := by + intro hbu + have huv : u = vb := by + by_contra hn + exact Finset.disjoint_left.mp (hxElem hu hyp hn) hbu hb + exact Set.disjoint_left.mp hdis huQ + (huv.symm ▸ hsame.symm ▸ rootMem (Sum.inl vb)) + obtain ⟨ea, hea, hca⟩ : ∃ e, Incident G u e ∧ col e = some a := by + simpa [MissingColors, PresentColors] using haNot + obtain ⟨eb, heb, hcb⟩ : ∃ e, Incident G u e ∧ col e = some b := by + simpa [MissingColors, PresentColors] using hbNot + have hnewa : mu eb = some a := by + simp [mu, TwoColorComponentSwap, edgeIn huQ heb (Or.inr hcb), hcb, hne.symm] + have hnewb : mu ea = some b := by + simp [mu, TwoColorComponentSwap, edgeIn huQ hea (Or.inl hca), hca] + have haNewNot : a ∉ MissingColors G mu u := by + simpa [MissingColors, PresentColors] using + (show ∃ e, Incident G u e ∧ mu e = some a from ⟨eb, heb, hnewa⟩) + have hbNewNot : b ∉ MissingColors G mu u := by + simpa [MissingColors, PresentColors] using + (show ∃ e, Incident G u e ∧ mu e = some b from ⟨ea, hea, hnewb⟩) + apply Finset.ext + intro c + by_cases hca : c = a + · simp [hca, haNot, haNewNot] + · by_cases hcb : c = b + · simp [hcb, hbNot, hbNewNot] + · exact hbehavior.2.2.2 u c hca hcb + · exact hbehavior.1 u huQ + +private theorem helper_htailEdges_977.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → + ell = T.length - A.length → + (↑D.lastEdgeIndex : ℕ) = X.length → + X.length + (1 : ℕ) = T.length → + X.length = A.length + (ell - (1 : ℕ)) → + (1 : ℕ) ≤ ell - (1 : ℕ) → + ell - (1 : ℕ) < ell → + TreeSequenceInitialSegment X T → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (a b : Fin k), + a ≠ b → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some a) → + b ∈ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + P.coloring (T.edge D.lastEdgeIndex) = some D.theta → + D.theta ∉ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + let J : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let C' : HierarchyCounterexample P.replacementBase := P.counterexample; + let col : PartialEdgeColoring E k := P.coloring; + let H' : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + C'.hierarchy; + let q' : Fin (H'.dividerCount + (1 : ℕ)) := Fin.last H'.dividerCount; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A ∧ + HierarchyFullTailLength P.counterexample = ell ∧ + HierarchyFullTailPrefix P.counterexample (ell - (1 : ℕ)) = X ∧ + HierarchyPathNumber P.counterexample.hierarchy = HierarchyPathNumber H → + HierarchyStarredStage H' q' = A → + ∀ (_ : Fin (A.length + (1 : ℕ))), + ColoredVertexSetElementary G col + (TreeSequenceVertexSet + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - (1 : ℕ)))) → + let Tn : TreeSequence G e0 := J.series.data.tree (Fin.last J.rounds).castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors J.series.data (Fin.last J.rounds); + StableColoring Tn Dn col mu → + X.vertex (Fin.last X.length) = T.vertex D.penultimateVertexIndex → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + mu (T.edge t) = col (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell X hAT hell hLastVal hTlen + hXexact hEllone hElllt hXT P a b hne haTail hb htheta hthetaPresent J C' col H' q' z mu hg + hstar' i helemP Tn Dn stableTn lastX t ht + have hna : col (T.edge t) ≠ some a := haTail t ht + by_cases hcb : col (T.edge t) = some b + · by_cases hlast : t = D.lastEdgeIndex + · have htb : D.theta = b := + Option.some.inj (htheta.symm.trans (hlast ▸ hcb)) + exact (hthetaPresent (htb.symm ▸ hb)).elim + · have htX : t.val < X.length := by + have hle : t.val ≤ X.length := Nat.le_of_lt_succ + (by change t.val < X.length + 1; rw [hTlen]; exact t.isLt) + have hne : t.val ≠ X.length := by + intro he + exact hlast (Fin.ext (he.trans hLastVal.symm)) + exact lt_of_le_of_ne hle hne + let r : Fin X.length := ⟨t.val, htX⟩ + have hbLast : b ∈ MissingColors G col (X.vertex (Fin.last X.length)) := by + rw [lastX] + exact hb + let Y := HierarchyFullTailPrefix C' (ell - 1) + have hYX : Y = X := hg.2.2.1 + let rY : Fin Y.length := Fin.cast (congrArg TreeSequence.length hYX.symm) r + have hrY : rY.val = t.val := rfl + have hedgeY : Y.edge rY = T.edge t := by + have edgeCast (U W : TreeSequence G e0) (h : U = W) + (i : Fin W.length) : + U.edge (Fin.cast (congrArg TreeSequence.length h.symm) i) = W.edge i := by + cases h + rfl + exact (edgeCast Y X hYX r).trans (hXT.2.2 r).symm + have hbY : b ∈ MissingColors G col (Y.vertex (Fin.last Y.length)) := by + rw [hYX] + exact hbLast + have hexc := HierarchyTailMissingColorExclusion G k e0 + P.corresponding.replacementInput T col J P.replacementBase H' + helemP + (ell - 1) hEllone + (by + change ell - 1 < T.length - (HierarchyStarredStage H' q').length + rw [hstar', ← hell] + exact hElllt) + b hbY rY + (by + change (HierarchyStarredStage H' q').length ≤ rY.val + rw [hstar', hrY] + exact ht) + (by + change rY.val < (HierarchyStarredStage H' q').length + (ell - 1) + rw [hstar', hrY] + rw [← hXexact] + exact htX) + ((congrArg col hedgeY).trans hcb) + obtain ⟨hqzero, hcore, hrpos, f, hstep, hkind, hsingleton, + hrf, hfb, hstored⟩ := hexc + have hAcore : A = P.replacementBase.core := by + have hi : q' = 0 := by apply Fin.ext; simp [q', hqzero] + have hcore' : HierarchyStarredStage H' q' = P.replacementBase.core := by + rw [hi] + rfl + exact hstar'.symm.trans hcore' + have hATn : A = Tn := hAcore.trans hcore + have htpos : t.val = A.length := by + change rY.val = (HierarchyStarredStage H' q').length at hrpos + simpa only [hrY, hstar'] using hrpos + obtain ⟨j, hj⟩ := T.attaches t + let ia : Fin (A.length + 1) := ⟨j.val, by rw [← htpos]; exact j.isLt⟩ + have hvertex : A.vertex ia = + T.vertex (Fin.castLT j (Nat.lt_trans j.isLt (Nat.succ_lt_succ t.isLt))) := by + rw [← hAT.2.1 ia] + apply congrArg T.vertex + apply Fin.ext + rfl + have hincident : TreeIncidentEdge Tn (T.edge t) := by + rw [← hATn] + refine ⟨A.vertex ia, ?_, ?_⟩ + · exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨ia, Finset.mem_univ _, rfl⟩ + · rw [hvertex] + simp [Incident, hj] + exact stableTn.1 (T.edge t) hincident + ⟨b, Finset.mem_union_right _ hstored, hcb⟩ + · dsimp only [mu] + unfold TwoColorComponentSwap + simp only [ite_eq_right hna, ite_eq_right hcb, ite_self] + +private theorem helper_continuation_404.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (eta : Fin k), + (∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G col (T.vertex i) → + c ∈ MissingColors G col (T.vertex (HierarchyFirstMissingPosition col T c)) ∧ + (↑(HierarchyFirstMissingPosition col T c) : ℕ) ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (hAT : TreeSequenceInitialSegment A T), + ell = T.length - A.length → + X.length = T.length - (1 : ℕ) → + (↑D.penultimateVertexIndex : ℕ) = X.length → + (↑D.lastEdgeIndex : ℕ) = X.length → + X.length + (1 : ℕ) = T.length → + X.length = A.length + (ell - (1 : ℕ)) → + (1 : ℕ) ≤ ell - (1 : ℕ) → + ell - (1 : ℕ) < ell → + TreeSequenceInitialSegment X T → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + HierarchyFirstMissingPosition phi T eta = D.penultimateVertexIndex → + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (a b : Fin k), + a ≠ b → + a ∈ TreeMissingColors P.coloring A → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P.coloring (T.edge t) ≠ some a) → + b ∈ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + a ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) ∨ + b ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex) → + P.coloring (T.edge D.lastEdgeIndex) = some D.theta → + D.theta ∉ MissingColors G P.coloring (T.vertex D.penultimateVertexIndex) → + let J : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let C' : HierarchyCounterexample P.replacementBase := P.counterexample; + let col : PartialEdgeColoring E k := P.coloring; + let H' : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + C'.hierarchy; + let q' : Fin (H'.dividerCount + (1 : ℕ)) := Fin.last H'.dividerCount; + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G col a b z; + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A ∧ + HierarchyFullTailLength P.counterexample = ell ∧ + HierarchyFullTailPrefix P.counterexample (ell - (1 : ℕ)) = X ∧ + HierarchyPathNumber P.counterexample.hierarchy = HierarchyPathNumber H → + HierarchyStarredStage C'.hierarchy (Fin.last C'.hierarchy.dividerCount) = A → + HierarchyStarredStage H' q' = A → + HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - (1 : ℕ)) = X → + IsProperEdgeColoring G col → + ColoredVertexSetElementary G col (TreeSequenceVertexSet X) → + HierarchyFirstMissingPosition col T b = D.penultimateVertexIndex → + ∀ v ∈ TreeSequenceVertexSet A, + ∀ (i : Fin (A.length + (1 : ℕ))), + a ∈ MissingColors G col (T.vertex (HierarchyFirstMissingPosition col T a)) ∧ + (↑(HierarchyFirstMissingPosition col T a) : ℕ) ≤ + (↑(Fin.castLE (Nat.succ_le_succ hAT.1) i) : ℕ) → + let va : V := T.vertex (HierarchyFirstMissingPosition col T a); + let vb : V := T.vertex D.penultimateVertexIndex; + let _ : V := T.vertex D.terminalVertexIndex; + va ∈ TreeSequenceVertexSet X → + (↑(HierarchyFirstMissingPosition col T a) : ℕ) < (↑D.penultimateVertexIndex : ℕ) → + (0 : ℕ) < H'.dividerCount ∧ + a ∈ + TreeMissingColors col + (H'.stage + (⟨H'.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H'.dividerCount + (2 : ℕ)))) ∨ + H'.dividerCount = (0 : ℕ) ∧ + a ∈ TreeMissingColors col (J.series.data.tree (Fin.last J.rounds).castSucc) → + a ∈ + TreeMissingColors col + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - (1 : ℕ))) ∧ + b ∈ + TreeMissingColors col + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - (1 : ℕ))) → + ColoredVertexSetElementary G col + (TreeSequenceVertexSet + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - (1 : ℕ)))) → + TwoColorComponent G col a b (Sum.inl va) = TwoColorComponent G col a b (Sum.inl vb) → + (∀ (w : V ⊕ E), w ∈ TwoColorComponent G col a b w) → + (∀ (w : V), + a ∈ MissingColors G col w ∨ b ∈ MissingColors G col w → + ((TwoColorIncidenceGraph G col a b).neighborSet (Sum.inl w)).Subsingleton) → + ∃ (P' : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P'.coloring = + TwoColorComponentSwap G P.coloring a b (Sum.inl (T.vertex D.terminalVertexIndex)) ∧ + (∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P'.coloring v = MissingColors G P.coloring v) ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → P'.coloring (T.edge t) = P.coloring (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta firstMissing H q A ell X hAT hell + hXlen hPenVal hLastVal hTlen hXexact hEllone hElllt hXT hyp hetaFirst P a b hne haA haTail + hb hterminal htheta hthetaPresent J C' col H' q' z mu hg hstar hstar' hXeq hp hxElem + hbFirst v hv i haFirst va vb vt hvaX horder hnorm hmissingP helemP hsame rootMem leaf + have hdis := @helper_hdis_835 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) (@hAT) (@hXlen) + (@hPenVal) (@hLastVal) (@hTlen) (@hXexact) (@hetaFirst) (@P) (@a) (@b) (@hb) (@hterminal) + (@hp) (@hbFirst) (@i) (@haFirst) (@horder) (@hsame) (@rootMem) (@leaf) + have hpath : TwoColorPathComponent G col a b z := + ⟨hne, z, rootMem z, leaf vt hterminal⟩ + have hcase : + (0 < H'.dividerCount ∧ + a ∈ TreeMissingColors col (H'.stage ⟨H'.dividerCount, by omega⟩)) ∨ + (H'.dividerCount = 0 ∧ + (a ∈ TreeMissingColors col (J.series.data.tree (Fin.last J.rounds).castSucc) ∨ + (a ∈ TreeMissingColors col + (HierarchyStarredStage H' q') ∧ + a ∉ TashkinovStoredColors J.series.data (Fin.last J.rounds) ∧ + b ∉ TashkinovStoredColors J.series.data (Fin.last J.rounds)))) := by + rcases hnorm with h | ⟨hq, ha⟩ + · exact Or.inl h + · exact Or.inr ⟨hq, Or.inl ha⟩ + -- Obtain weak stability before protecting the possible SE/RE seed. + have hstable := StableChangeCasesOneTwo G k e0 P.corresponding.replacementInput + T col J P.replacementBase C' hp P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality + helemP + P.minimumContext.largeMissingSet a b hne + hmissingP + z hpath mu rfl hcase hdis + have hbehavior := TwoColorComponentSwapMissingBehavior G col a b hne hp z + have edgeIn {u : V} {e : E} + (hu : Sum.inl u ∈ TwoColorComponent G col a b z) + (he : Incident G u e) (hc : col e = some a ∨ col e = some b) : + Sum.inr e ∈ TwoColorComponent G col a b z := by + have hadj : (TwoColorIncidenceGraph G col a b).Adj (Sum.inr e) (Sum.inl u) := + ⟨he, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hu + have hprefix := @helper_hprefix_914 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) + (@hyp) (@P) (@a) (@b) (@hne) (@hb) (@hxElem) (@i) (@haFirst) (@hvaX) (@hsame) (@rootMem) + (@hdis) (@hbehavior) (@edgeIn) + let Tn := J.series.data.tree (Fin.last J.rounds).castSucc + let Dn := TashkinovStoredColors J.series.data (Fin.last J.rounds) + have stableTn : StableColoring Tn Dn col mu := by + let baseStable := if J.series.data.kind (Fin.last J.rounds) = + some TashkinovExtensionKind.PE then + CombinedStableColoring Tn P.replacementBase.closure Dn col mu + else StableColoring Tn Dn col mu + have extract : ∀ j : Fin (H'.dividerCount + 1), + HierarchyWeaklyStable H' j mu → baseStable := by + exact Fin.cases (motive := fun j => HierarchyWeaklyStable H' j mu → baseStable) + (fun h => h) (fun i h => h.1) + have hs := extract q' hstable.1 + by_cases hk : J.series.data.kind (Fin.last J.rounds) = + some TashkinovExtensionKind.PE + · have hs' : CombinedStableColoring Tn P.replacementBase.closure Dn col mu := by + simpa [baseStable, hk] using hs + exact hs'.1 + · simpa [baseStable, hk] using hs + have lastX : X.vertex (Fin.last X.length) = T.vertex D.penultimateVertexIndex := by + change T.vertex _ = T.vertex _ + apply congrArg T.vertex + apply Fin.ext + change X.length = D.penultimateVertexIndex.val + exact hPenVal.symm + have htailEdges := @helper_htailEdges_977 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) + (@hell) (@hLastVal) (@hTlen) (@hXexact) (@hEllone) (@hElllt) (@hXT) (@P) (@a) (@b) (@hne) + (@haTail) (@hb) (@htheta) (@hthetaPresent) (@hg) (@hstar') (@i) (@helemP) (@stableTn) (@lastX) + exact @helper_continuation_834 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@firstMissing) (@hAT) (@hXlen) (@hPenVal) (@hLastVal) (@hTlen) (@hXexact) (@hXT) (@hyp) + (@hetaFirst) (@P) (@a) (@b) (@hne) (@haA) (@hb) (@hterminal) (@hstar) (@hstar') (@hXeq) + (@hxElem) (@hbFirst) (@v) (@hv) (@i) (@haFirst) (@hvaX) (@horder) (@hmissingP) (@rootMem) + (@hdis) (@hpath) (@hcase) (@hbehavior) (@hprefix) (@htailEdges) +private theorem helper_swapStep_439.{u_1, u_2} : + helperSwapStep439Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta missingMono firstMissing H q A ell X + hAT hell hXlen hPenVal hLastVal hTlen hXexact hEllone hElllt hXT hAX hyp hetaFirst + presentationGeometry P a b hne haA haStage haTail hb hterminal htheta hthetaPresent + let J := P.corresponding.replacementETT + let C' := P.counterexample + let col := P.coloring + let H' := C'.hierarchy + let q' := Fin.last H'.dividerCount + let z : Sum V E := Sum.inl (T.vertex D.terminalVertexIndex) + let mu := TwoColorComponentSwap G col a b z + have hg := presentationGeometry P + have hstar : HierarchyStarredStage C'.hierarchy + (Fin.last C'.hierarchy.dividerCount) = A := hg.1 + have hstar' : HierarchyStarredStage H' q' = A := hstar + have hXeq : HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1) = X := by + rw [hg.2.1] + exact hg.2.2.1 + have hp : IsProperEdgeColoring G col := P.minimumContext.proper + have hxElem : ColoredVertexSetElementary G col (TreeSequenceVertexSet X) := by + have he : ColoredVertexSetElementary G col + (TreeSequenceVertexSet (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1))) := + HierarchyCounterexamplePenultimateElementary G k e0 + P.corresponding.replacementInput T col J P.replacementBase C' + P.minimumContext.proper P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality P.minimumContext.largeMissingSet + intro u hu v hv huv + have hu' : u ∈ TreeSequenceVertexSet + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1)) := by + rw [hXeq] + exact hu + have hv' : v ∈ TreeSequenceVertexSet + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1)) := by + rw [hXeq] + exact hv + exact he hu' hv' huv + have hbFirst : HierarchyFirstMissingPosition col T b = + D.penultimateVertexIndex := by + have hm := firstMissing col b D.penultimateVertexIndex hb + have hv : T.vertex (HierarchyFirstMissingPosition col T b) ∈ + TreeSequenceVertexSet X := by + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨⟨(HierarchyFirstMissingPosition col T b).val, by + rw [hXlen] + have hpos := D.penultimateVertexPosition + omega⟩, Finset.mem_univ _, ?_⟩ + rfl + by_contra hi + exact Finset.disjoint_left.mp + (hxElem hv hyp (fun h => hi (T.vertex_injective h))) hm.1 hb + obtain ⟨v, hv, hav⟩ := Finset.mem_biUnion.mp haA + obtain ⟨i, _, hiv⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + have hai : a ∈ MissingColors G col + (T.vertex (Fin.castLE (Nat.succ_le_succ hAT.1) i)) := by + rw [hAT.2.1 i, hiv] + exact hav + have haFirst := firstMissing col a _ hai + have haBound : (HierarchyFirstMissingPosition col T a).val ≤ A.length := + le_trans haFirst.2 (Nat.le_of_lt_succ i.isLt) + let va := T.vertex (HierarchyFirstMissingPosition col T a) + let vb := T.vertex D.penultimateVertexIndex + let vt := T.vertex D.terminalVertexIndex + have hvaX : va ∈ TreeSequenceVertexSet X := by + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨⟨(HierarchyFirstMissingPosition col T a).val, by + rw [hXlen] + omega⟩, Finset.mem_univ _, ?_⟩ + rfl + have horder : (HierarchyFirstMissingPosition col T a).val < + D.penultimateVertexIndex.val := by + have hp := D.penultimateVertexPosition + omega + have hnorm : + (0 < H'.dividerCount ∧ + a ∈ TreeMissingColors col (H'.stage ⟨H'.dividerCount, by omega⟩)) ∨ + (H'.dividerCount = 0 ∧ a ∈ TreeMissingColors col + (J.series.data.tree (Fin.last J.rounds).castSucc)) := by + change a ∈ HierarchyStageMissingColors H' q' at haStage + by_cases hq : H'.dividerCount = 0 + · right + refine ⟨hq, ?_⟩ + have hi : q' = 0 := by apply Fin.ext; simp [q', hq] + simpa [HierarchyStageMissingColors, hi] using haStage + · left + refine ⟨Nat.pos_of_ne_zero hq, ?_⟩ + have hi : q' = + (⟨H'.dividerCount - 1, by omega⟩ : Fin H'.dividerCount).succ := by + apply Fin.ext + simp [q'] + omega + have ha := haStage + simp only [HierarchyStageMissingColors, hi, Fin.cases] at ha + convert ha using 1 + apply congrArg (TreeMissingColors col) + apply congrArg H'.stage + apply Fin.ext + simp + omega + have hmissing : a ∈ TreeMissingColors col X ∧ b ∈ TreeMissingColors col X := + ⟨missingMono hAX col haA, Finset.mem_biUnion.mpr ⟨vb, hyp, hb⟩⟩ + have hmissingP : a ∈ TreeMissingColors col + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1)) ∧ + b ∈ TreeMissingColors col + (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1)) := by + rw [hXeq] + exact hmissing + have helemP : ColoredVertexSetElementary G col + (TreeSequenceVertexSet (HierarchyFullTailPrefix C' (HierarchyFullTailLength C' - 1))) := by + rw [hXeq] + exact hxElem + have hchange := ChangeLemma G k e0 P.corresponding.replacementInput T col + J P.replacementBase C' hp P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality + helemP + P.minimumContext.largeMissingSet a b hne + hmissingP + (by + dsimp only + intro hcond + refine ⟨⟨HierarchyFirstMissingPosition col T a, + HierarchyFirstMissingPosition col T b, rfl, rfl, ?_⟩, ?_⟩ + · simpa [hbFirst] using horder + · intro hc + obtain ⟨t, ht, _, hcol⟩ := (Finset.mem_filter.mp hc).2 + exact haTail t (by simpa only [hstar] using ht) hcol) + have hsame : TwoColorComponent G col a b (Sum.inl va) = + TwoColorComponent G col a b (Sum.inl vb) := by + rcases hnorm with ⟨hq, ha⟩ | ⟨hq, ha⟩ + · simpa [va, vb, hbFirst] using hchange.1 ⟨hq, Or.inl ha⟩ + · simpa [va, vb, hbFirst] using hchange.2.1 ⟨hq, Or.inl ha⟩ + have rootMem (w : Sum V E) : w ∈ TwoColorComponent G col a b w := by + change (TwoColorIncidenceGraph G col a b).connectedComponentMk w = _ + rfl + have leaf (w : V) + (hm : a ∈ MissingColors G col w ∨ b ∈ MissingColors G col w) : + ((TwoColorIncidenceGraph G col a b).neighborSet (Sum.inl w)).Subsingleton := by + have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G col a b) + (Sum.inl w) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with hm | hm + · exact MissingColorIncidenceEndpoint G col a b hne hp w hm + · have hs : TwoColorIncidenceGraph G col b a = + TwoColorIncidenceGraph G col a b := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + rw [← hs] + exact MissingColorIncidenceEndpoint G col b a hne.symm hp w hm + let : Fintype ((TwoColorIncidenceGraph G col a b).neighborSet (Sum.inl w)) := + Fintype.ofFinite _ + have hc : Fintype.card + ((TwoColorIncidenceGraph G col a b).neighborSet (Sum.inl w)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hd + intro x hx y hy + exact congrArg Subtype.val (Fintype.card_le_one_iff.mp hc ⟨x, hx⟩ ⟨y, hy⟩) + exact @helper_continuation_404 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@firstMissing) (@hAT) (@hell) (@hXlen) (@hPenVal) (@hLastVal) (@hTlen) (@hXexact) + (@hEllone) (@hElllt) (@hXT) (@hyp) (@hetaFirst) (@P) (@a) (@b) (@hne) (@haA) (@haTail) + (@hb) (@hterminal) (@htheta) (@hthetaPresent) (@hg) (@hstar) (@hstar') (@hXeq) (@hp) + (@hxElem) (@hbFirst) (@v) (@hv) (@i) (@haFirst) (@hvaX) (@horder) (@hnorm) (@hmissingP) + (@helemP) (@hsame) (@rootMem) (@leaf) +private theorem helper_branch_993.{u_1, u_2} : + helperBranch993Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hetaMissing H q A ell X + hAX hyp gamma hgammaA hgammaTail seriesProper seriesOne selfCorr P0 swapStep hlastTail + storedPair reduceCaseOne P1 hprefix1 hedges1 hgammaTerminal + have hetaPenultimate : eta ∈ MissingColors G P1.coloring + (T.vertex D.penultimateVertexIndex) := by + rw [hprefix1 _ hyp] + exact hetaMissing + have hgammaA1 : gamma ∈ TreeMissingColors P1.coloring A := by + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp hgammaA + exact Finset.mem_biUnion.mpr ⟨v, hv, by + rw [hprefix1 v (TreeSequenceInitialSegmentVertexSetSubset hAX hv)] + exact hc⟩ + have hgammaEta : gamma ≠ eta := by + intro he + exact (Finset.mem_sdiff.mp hetaStored).2 (he ▸ hgammaA) + have hpair1 := storedPair P1 + have hgammaMem1 : gamma ∈ P1.counterexample.good.gamma + (Fin.last P1.counterexample.hierarchy.dividerCount) eta := by + rw [hpair1.2] + exact Finset.mem_insert_of_mem (Finset.mem_singleton_self gamma) + have hstage1 := (Finset.mem_sdiff.mp + (P1.counterexample.good.avoidance _ eta hpair1.1 hgammaMem1)).1 + have hgammaTail1 : ∀ t : Fin T.length, A.length ≤ t.val → + P1.coloring (T.edge t) ≠ some gamma := by + intro t ht + rw [hedges1 t ht] + exact hgammaTail t ht + have htheta1 := (hedges1 _ hlastTail).trans D.thetaOnLastEdge + have hthetaPresent1 : D.theta ∉ MissingColors G P1.coloring + (T.vertex D.penultimateVertexIndex) := by + rw [hprefix1 _ hyp] + exact D.thetaPresentPenultimate + obtain ⟨P2, hmu2, hprefix2, hedges2⟩ := swapStep P1 gamma eta hgammaEta + hgammaA1 hstage1 hgammaTail1 hetaPenultimate (Or.inl hgammaTerminal) + htheta1 hthetaPresent1 + have hetaTerminal2 : eta ∈ MissingColors G P2.coloring + (T.vertex D.terminalVertexIndex) := by + rw [hmu2] + apply (TwoColorComponentSwapMissingBehavior G P1.coloring gamma eta + hgammaEta P1.minimumContext.proper + (Sum.inl (T.vertex D.terminalVertexIndex))).2.1 + · change (TwoColorIncidenceGraph G P1.coloring gamma eta).connectedComponentMk _ = _ + rfl + · exact hgammaTerminal + exact reduceCaseOne P2 (fun v hv => (hprefix2 v hv).trans (hprefix1 v hv)) + (fun t ht => (hedges2 t ht).trans (hedges1 t ht)) hetaTerminal2 + +private theorem helper_continuation_1279.{u_1, u_2} : + helperContinuation1279Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hetaMissing H q A ell X + htail hAX hyp gamma hthetaGamma hgammaAvoid hgammaA hgammaAlpha hgammaTail + presentationGeometry seriesProper seriesOne selfCorr P0 swapStep hlastTail storedPair + have reduceCaseOne + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hprefix : ∀ v ∈ TreeSequenceVertexSet X, + MissingColors G P.coloring v = MissingColors G phi v) + (hedges : ∀ t : Fin T.length, A.length ≤ t.val → + P.coloring (T.edge t) = phi (T.edge t)) + (hterminal : eta ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex)) : + False := by + have hg := presentationGeometry P + have hsp := storedPair P + let D1 : HierarchySituationTwoCaseOneData G k e0 P.corresponding.replacementInput + T P.coloring P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext := { + tailAtLeastTwo := by simpa [hg.2.1] using htail + pathNumberFull := hg.2.2.2.trans (D.pathNumberFull.trans hg.2.1.symm) + lastEdgeIndex := D.lastEdgeIndex + penultimateVertexIndex := D.penultimateVertexIndex + terminalVertexIndex := D.terminalVertexIndex + lastEdgePosition := D.lastEdgePosition + penultimateVertexPosition := D.penultimateVertexPosition + terminalVertexPosition := D.terminalVertexPosition + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate + theta := D.theta + thetaOnLastEdge := (hedges _ hlastTail).trans D.thetaOnLastEdge + thetaPresentPenultimate := by rw [hprefix _ hyp]; exact D.thetaPresentPenultimate + alpha := eta + gammaOne := D.theta + gammaTwo := gamma + alphaMissingPenultimate := by rw [hprefix _ hyp]; exact hetaMissing + alphaMissingTerminal := hterminal + alphaStored := hsp.1 + gammaPair := hsp.2 + gammaDistinct := hthetaGamma } + exact HierarchySituationTwoSubcaseOneOne G k e0 P.corresponding.replacementInput + T P.coloring P.corresponding.replacementETT P.replacementBase + P.counterexample P.minimumContext D1 + obtain ⟨P1, hmu1, hprefix1, hedges1⟩ := swapStep P0 gamma D.alpha hgammaAlpha + hgammaA hgammaAvoid.1 hgammaTail D.alphaMissingPenultimate + (Or.inr D.alphaMissingTerminal) D.thetaOnLastEdge D.thetaPresentPenultimate + have hgammaTerminal : gamma ∈ MissingColors G P1.coloring + (T.vertex D.terminalVertexIndex) := by + rw [hmu1] + apply (TwoColorComponentSwapMissingBehavior G phi gamma D.alpha + hgammaAlpha ctx.proper (Sum.inl (T.vertex D.terminalVertexIndex))).2.2.1 + · change (TwoColorIncidenceGraph G phi gamma D.alpha).connectedComponentMk _ = _ + rfl + · exact D.alphaMissingTerminal + by_cases hetaTerminal : eta ∈ MissingColors G P1.coloring (T.vertex D.terminalVertexIndex) + · exact reduceCaseOne P1 hprefix1 hedges1 hetaTerminal + · exact @helper_branch_993 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx D eta hetaStored hetaMissing hAX hyp gamma hgammaA hgammaTail + seriesProper seriesOne swapStep hlastTail storedPair reduceCaseOne P1 hprefix1 hedges1 + hgammaTerminal + +private theorem helper_continuation_1111.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + (∀ {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + ∀ (col : PartialEdgeColoring E k), + TreeMissingColors col X ⊆ TreeMissingColors col Y) → + (∀ (col : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G col (T.vertex i) → + c ∈ MissingColors G col (T.vertex (HierarchyFirstMissingPosition col T c)) ∧ + (↑(HierarchyFirstMissingPosition col T c) : ℕ) ≤ (↑i : ℕ)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → + ell = T.length - A.length → + (2 : ℕ) ≤ ell → + X.length = T.length - (1 : ℕ) → + (↑D.penultimateVertexIndex : ℕ) = X.length → + (↑D.lastEdgeIndex : ℕ) = X.length → + X.length + (1 : ℕ) = T.length → + X.length = A.length + (ell - (1 : ℕ)) → + (1 : ℕ) ≤ ell - (1 : ℕ) → + ell - (1 : ℕ) < ell → + TreeSequenceInitialSegment X T → + TreeSequenceInitialSegment A X → + TreeSequenceInitialSegment A B → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X → + HierarchyFirstMissingPosition phi T eta = D.penultimateVertexIndex → + ∀ (gamma : Fin k), + D.theta ≠ gamma → + C.good.gamma q eta = (insert D.theta ({ gamma } : Finset (Fin k)) : Finset (Fin k)) → + gamma ∈ HierarchyStageMissingColors C.hierarchy q ∧ + gamma ∉ HierarchySegmentColors C.hierarchy q eta → + gamma ∈ TreeMissingColors phi A → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D eta hetaStored hetaMissing missingMono + firstMissing H q A ell B X hAT hell htail hXlen hPenVal hLastVal hTlen hXexact hEllone + hElllt hXT hAX hAB hyp hetaFirst gamma hthetaGamma hpair hgammaAvoid hgammaA + have halpha := HierarchySituationTwoCaseTwoExclusions + G k e0 input T phi ett base C ctx D + have hgammaAlpha : gamma ≠ D.alpha := by + intro heq + exact halpha.1 (heq ▸ missingMono hAB phi hgammaA) + have hgammaTail := @helper_hgammaTail_297 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C ctx D eta hXlen hPenVal hLastVal hTlen hXexact + hetaFirst gamma hthetaGamma hgammaAvoid + have starCongr (n m : ℕ) (coreLeft coreRight : TreeSequence G e0) + (stageLeft : Fin (n + 2) → TreeSequence G e0) + (stageRight : Fin (m + 2) → TreeSequence G e0) + (hnm : n = m) (hcore : coreLeft = coreRight) + (hstage : HEq stageLeft stageRight) : + Fin.cases (motive := fun _ => TreeSequence G e0) coreLeft + (fun i : Fin n => stageLeft i.succ.castSucc) (Fin.last n) = + Fin.cases (motive := fun _ => TreeSequence G e0) coreRight + (fun i : Fin m => stageRight i.succ.castSucc) (Fin.last m) := by + subst m + have hs := eq_of_heq hstage + simp [hcore, hs] + have presentationGeometry + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = A ∧ + HierarchyFullTailLength P.counterexample = ell ∧ + HierarchyFullTailPrefix P.counterexample (ell - 1) = X ∧ + HierarchyPathNumber P.counterexample.hierarchy = HierarchyPathNumber H := by + have hs := P.sameGood.1 + have hstar : HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = A := + (starCongr _ _ base.core P.replacementBase.core H.stage + P.counterexample.hierarchy.stage hs.2.1 hs.1 hs.2.2.1).symm + refine ⟨hstar, ?_, ?_, ?_⟩ + · change T.length - _ = ell + rw [hstar] + rfl + · simp only [HierarchyFullTailPrefix, hstar] + rfl + · simp only [HierarchyPathNumber, hstar] + rfl + have seriesProper : ∀ j : Fin (ett.rounds + 1), + IsProperEdgeColoring G (ett.series.data.coloring j) := by + intro j + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.1 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedProper + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => exact currentProper + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact previousProper + have seriesOne : ∀ j : Fin (ett.rounds + 1), + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + intro j + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.2 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedOneUncolored + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => exact currentOneUncolored + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact previousOneUncolored + let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := { + replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := seriesProper + replacementOneUncolored := seriesOne + replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := { + coloring := phi + corresponding := selfCorr + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + minimumContext := ctx } + have swapStep := @helper_swapStep_439 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C ctx D eta missingMono firstMissing hAT hell hXlen hPenVal + hLastVal hTlen hXexact hEllone hElllt hXT hAX hyp hetaFirst presentationGeometry + have hlastTail : A.length ≤ D.lastEdgeIndex.val := by + have hp := D.lastEdgePosition + omega + have storedPair (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + eta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta = + {D.theta, gamma} := by + obtain ⟨hcount, hslots⟩ := P.sameGood.2 + have hs := hslots q + have hi : Fin.cast (congrArg (fun n => n + 1) hcount) q = + Fin.last P.counterexample.hierarchy.dividerCount := by + apply Fin.ext + exact hcount + rw [hi] at hs + exact ⟨hs.1 ▸ hetaStored, (hs.2 eta hetaStored).symm.trans hpair⟩ + exact @helper_continuation_1279 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@hetaStored) (@hetaMissing) (@htail) (@hAX) (@hyp) (@gamma) (@hthetaGamma) (@hgammaAvoid) + (@hgammaA) (@hgammaAlpha) (@hgammaTail) (@presentationGeometry) (@seriesProper) + (@seriesOne) (@swapStep) (@hlastTail) (@storedPair) +theorem HierarchySituationTwoSubcaseTwoOneStoredException {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData + G k e0 input T phi ett base C ctx) + (eta : Fin k) + (hetaStored : eta ∈ HierarchyStoredColorsAt C.hierarchy + (Fin.last C.hierarchy.dividerCount)) + (hetaMissing : + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) + (hthetaPair : + D.theta ∈ C.good.gamma (Fin.last C.hierarchy.dividerCount) eta) : + False := by + classical + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + refine ⟨le_trans hXY.1 hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + have commonPrefix {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + have hierarchyGeometry := @helper_hierarchyGeometry_101 V E inferInstance inferInstance + inferInstance inferInstance G k e0 T segmentTrans + have missingMono {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) (col : PartialEdgeColoring E k) : + TreeMissingColors col X ⊆ TreeMissingColors col Y := by + intro c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hcv⟩ + have firstMissing (col : PartialEdgeColoring E k) (c : Fin k) + (i : Fin (T.length + 1)) (hc : c ∈ MissingColors G col (T.vertex i)) : + c ∈ MissingColors G col + (T.vertex (HierarchyFirstMissingPosition col T c)) ∧ + (HierarchyFirstMissingPosition col T c).val ≤ i.val := by + let S := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G col (T.vertex j) + have hs : S.Nonempty := ⟨i, by simp [S, hc]⟩ + have heq : HierarchyFirstMissingPosition col T c = S.min' hs := by + simp [HierarchyFirstMissingPosition, S, hs] + rw [heq] + exact ⟨(Finset.mem_filter.mp (Finset.min'_mem S hs)).2, + Finset.min'_le S i (by simp [S, hc])⟩ + let H := C.hierarchy + let q := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (ell - 2) + let X := HierarchyFullTailPrefix C (ell - 1) + have hAT : TreeSequenceInitialSegment A T := (hierarchyGeometry H).1 + have hell : ell = T.length - A.length := rfl + have htail : 2 ≤ ell := D.tailAtLeastTwo + have hBlen : B.length = T.length - 2 := by + change min (A.length + (ell - 2)) T.length = T.length - 2 + rw [hell] + omega + have hXlen : X.length = T.length - 1 := by + change min (A.length + (ell - 1)) T.length = T.length - 1 + rw [hell] + omega + have hPenVal : D.penultimateVertexIndex.val = X.length := by + rw [hXlen] + have hp := D.penultimateVertexPosition + omega + have hLastVal : D.lastEdgeIndex.val = X.length := by + rw [hXlen] + have hp := D.lastEdgePosition + omega + have hTlen : X.length + 1 = T.length := by + rw [hXlen] + have hp := T.positive + omega + have hXexact : X.length = A.length + (ell - 1) := by + rw [hXlen] + omega + have hEllone : 1 ≤ ell - 1 := by omega + have hElllt : ell - 1 < ell := by omega + have hXT : TreeSequenceInitialSegment X T := + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + have hAX : TreeSequenceInitialSegment A X := + commonPrefix hAT hXT (by rw [hXlen]; omega) + have hAB : TreeSequenceInitialSegment A B := + commonPrefix hAT + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + (by rw [hBlen]; omega) + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet X) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have hyp : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet X := by + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨Fin.last X.length, Finset.mem_univ _, ?_⟩ + change T.vertex _ = T.vertex _ + apply congrArg T.vertex + apply Fin.ext + change X.length = D.penultimateVertexIndex.val + rw [hXlen] + have hp := D.penultimateVertexPosition + omega + have uniquePenultimate (c : Fin k) + (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by + have hm := firstMissing phi c D.penultimateVertexIndex hc + have hv : T.vertex (HierarchyFirstMissingPosition phi T c) ∈ + TreeSequenceVertexSet X := by + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨⟨(HierarchyFirstMissingPosition phi T c).val, by + have hp := D.penultimateVertexPosition + rw [hXlen] + omega⟩, Finset.mem_univ _, ?_⟩ + rfl + by_contra hi + have hn : T.vertex (HierarchyFirstMissingPosition phi T c) ≠ + T.vertex D.penultimateVertexIndex := fun h => hi (T.vertex_injective h) + exact Finset.disjoint_left.mp (helem hv hyp hn) hm.1 hc + have hetaFirst := uniquePenultimate eta hetaMissing + have hcard : (C.good.gamma q eta).card = 2 := + C.good.twoColors q eta hetaStored + obtain ⟨gamma, hgamma, hthetaGamma⟩ : + ∃ gamma, gamma ∈ C.good.gamma q eta ∧ D.theta ≠ gamma := by + by_contra hn + push Not at hn + have hsubset : C.good.gamma q eta ⊆ {D.theta} := by + intro c hc + simp only [Finset.mem_singleton] + exact (hn c hc).symm + have hle := Finset.card_le_card hsubset + simp only [Finset.card_singleton] at hle + omega + have hpair : C.good.gamma q eta = {D.theta, gamma} := by + symm + apply Finset.eq_of_subset_of_card_le + · intro c hc + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with rfl | rfl + · exact hthetaPair + · exact hgamma + · simp [hthetaGamma, hcard] + have hgammaAvoid := Finset.mem_sdiff.mp + (C.good.avoidance q eta hetaStored hgamma) + have hgammaA : gamma ∈ TreeMissingColors phi A := by + by_cases hq : H.dividerCount = 0 + · have hz : q = 0 := by apply Fin.ext; simp [q, hq] + have hm : gamma ∈ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + simpa [HierarchyStageMissingColors, hz] using hgammaAvoid.1 + exact missingMono (hierarchyGeometry H).2 phi hm + · have hpos : 0 < H.dividerCount := Nat.pos_of_ne_zero hq + have hi : q = (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp [q] + omega + simpa [A, HierarchyStarredStage, HierarchyStageMissingColors, hi] + using hgammaAvoid.1 + exact @helper_continuation_1111 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@eta) + (@hetaStored) (@hetaMissing) (@missingMono) (@firstMissing) (@hAT) (@hell) (@htail) + (@hXlen) (@hPenVal) (@hLastVal) (@hTlen) (@hXexact) (@hEllone) (@hElllt) (@hXT) (@hAX) + (@hAB) (@hyp) (@hetaFirst) (@gamma) (@hthetaGamma) (@hpair) (@hgammaAvoid) (@hgammaA) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean new file mode 100644 index 0000000000..8315152d7c --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean @@ -0,0 +1,6258 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.NineN +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCaseThree +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute + +/-! +# Hierarchy Situation Two Subcase Two Two + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperHsameTwo964Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta) → + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + beta ≠ D.alpha → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex → + T.vertex ib ≠ T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (beta ∉ TreeMissingColors phi A → + beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi beta D.alpha (Sum.inl va) = + TwoColorComponent G phi beta D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.penultimateVertexIndex)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi beta D.alpha z; + Disjoint + (TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib))) → + TwoColorPathComponent G phi beta D.alpha z → + Sum.inl (T.vertex ib) ∉ TwoColorComponent G phi beta D.alpha z → + Sum.inl (T.vertex D.penultimateVertexIndex) ∉ + TwoColorComponent G phi beta D.alpha z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G phi beta D.alpha z) w = + MissingColors G phi w) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + (∀ c ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition muOne T c = + HierarchyFirstMissingPosition phi T c) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < H.dividerCount ∧ + beta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∨ + H.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T), + MaximumProperty corrOne.replacementETT → + ∀ (baseOne : HierarchyBase corrOne.replacementETT muOne) + (KOne : TashkinovHierarchy corrOne.replacementETT baseOne) + (goodOne : GoodHierarchy KOne), + SameGoodHierarchy C.good goodOne → + beta ∈ MissingColors G muOne (T.vertex D.terminalVertexIndex) → + ∀ + (POne : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + POne.coloring = muOne → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 + POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let baseOne' : + HierarchyBase POne.corresponding.replacementETT + POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := + POne.counterexample; + let HOne : + TashkinovHierarchy POne.corresponding.replacementETT + POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := + Fin.last HOne.dividerCount; + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∉ HierarchyStoredColorsAt HOne qOne → + beta ∉ + MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ + MissingColors G rho (T.vertex D.terminalVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = + D.penultimateVertexIndex → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree + (Fin.last ettOne.rounds).castSucc)) → + beta ∈ TreeMissingColors rho B ∧ + D.theta ∈ TreeMissingColors rho B → + (let H : TashkinovHierarchy ettOne baseOne' := + COne'.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + have n : Fin (ettOne.rounds + (1 : ℕ)) := + Fin.last ettOne.rounds; + have A : TreeSequence G e0 := + HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := + ettOne.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := + TashkinovStoredColors ettOne.series.data n; + have Dnq : Finset (Fin k) := + HierarchyStoredColorsAt H q; + have va : V := + T.vertex + (HierarchyFirstMissingPosition rho T beta); + have vb : V := + T.vertex + (HierarchyFirstMissingPosition rho T D.theta); + have sameComponent : Prop := + TwoColorComponent G rho beta D.theta + (Sum.inl va) = + TwoColorComponent G rho beta D.theta + (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors rho Tnq ∨ + Disjoint + (insert beta ({ D.theta } : Finset (Fin k)) : + Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors rho Tn ∨ + Disjoint + (insert beta ({ D.theta } : Finset (Fin k)) : + Finset (Fin k)) + Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors rho A ∧ + TreeColorSetClosed G rho A + ({ beta } : Finset (Fin k)) → + sameComponent ∧ + TreeInterchangeable G A rho beta D.theta)) → + TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex ib)) = + TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex D.penultimateVertexIndex)) + +private abbrev helperBranch3242Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → + (∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) + (base' : HierarchyBase ett' rho) (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho + sigma) → + (∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) + (base' : HierarchyBase ett' old) (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t)) → + ∀ (beta : Fin k), + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := + HierarchyFirstMissingPosition phi T beta; + T.vertex ib ∈ TreeSequenceVertexSet B → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi beta D.alpha z; + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + ∀ + (POne : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + POne.coloring = muOne → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T + POne.coloring := + POne.corresponding.replacementETT; + let _ : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := + POne.counterexample; + let _ : + HierarchyMinimumCounterexampleContext G k e0 + POne.corresponding.replacementInput T POne.coloring + POne.corresponding.replacementETT POne.replacementBase + POne.counterexample := + POne.minimumContext; + let HOne : + TashkinovHierarchy POne.corresponding.replacementETT + POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := + Fin.last HOne.dividerCount; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree + (Fin.last ettOne.rounds).castSucc)) → + beta ∈ TreeMissingColors rho B ∧ + D.theta ∈ TreeMissingColors rho B → + Disjoint + (TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex ib))) → + let muTwo : PartialEdgeColoring E k := + TwoColorComponentSwap G rho beta D.theta z; + TwoColorPathComponent G rho beta D.theta z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho beta D.theta z) + w = + MissingColors G rho w) → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = + HierarchyFirstMissingPosition rho T c) → + TashkinovAugmentationSequence rho B T → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + beta ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c → + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ + B.length) → + beta ∈ TreeMissingColors phi A → + ∃ (corrTwo : + CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo + T), + MaximumProperty corrTwo.replacementETT ∧ + ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) + (KTwo : + TashkinovHierarchy corrTwo.replacementETT baseTwo) + (goodTwo : GoodHierarchy KTwo), + SameGoodHierarchy COne'.good goodTwo + +private abbrev helperHsameTwo3799Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta) → + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + beta ≠ D.alpha → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex → + T.vertex ib ≠ T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (beta ∉ TreeMissingColors phi A → + beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi beta D.alpha (Sum.inl va) = + TwoColorComponent G phi beta D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.penultimateVertexIndex)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi beta D.alpha z; + Disjoint + (TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib))) → + TwoColorPathComponent G phi beta D.alpha z → + Sum.inl (T.vertex ib) ∉ TwoColorComponent G phi beta D.alpha z → + Sum.inl (T.vertex D.penultimateVertexIndex) ∉ + TwoColorComponent G phi beta D.alpha z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G phi beta D.alpha z) w = + MissingColors G phi w) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + (∀ c ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition muOne T c = + HierarchyFirstMissingPosition phi T c) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < H.dividerCount ∧ + beta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∨ + H.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T), + MaximumProperty corrOne.replacementETT → + ∀ (baseOne : HierarchyBase corrOne.replacementETT muOne) + (KOne : TashkinovHierarchy corrOne.replacementETT baseOne) + (goodOne : GoodHierarchy KOne), + SameGoodHierarchy C.good goodOne → + beta ∈ MissingColors G muOne (T.vertex D.terminalVertexIndex) → + ∀ + (POne : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + POne.coloring = muOne → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 + POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let baseOne' : + HierarchyBase POne.corresponding.replacementETT + POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := + POne.counterexample; + let HOne : + TashkinovHierarchy POne.corresponding.replacementETT + POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := + Fin.last HOne.dividerCount; + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∉ HierarchyStoredColorsAt HOne qOne → + beta ∉ + MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ + MissingColors G rho (T.vertex D.terminalVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = + D.penultimateVertexIndex → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree + (Fin.last ettOne.rounds).castSucc)) → + beta ∈ TreeMissingColors rho B ∧ + D.theta ∈ TreeMissingColors rho B → + (let H : TashkinovHierarchy ettOne baseOne' := + COne'.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + have n : Fin (ettOne.rounds + (1 : ℕ)) := + Fin.last ettOne.rounds; + have A : TreeSequence G e0 := + HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := + ettOne.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := + TashkinovStoredColors ettOne.series.data n; + have Dnq : Finset (Fin k) := + HierarchyStoredColorsAt H q; + have va : V := + T.vertex + (HierarchyFirstMissingPosition rho T beta); + have vb : V := + T.vertex + (HierarchyFirstMissingPosition rho T D.theta); + have sameComponent : Prop := + TwoColorComponent G rho beta D.theta + (Sum.inl va) = + TwoColorComponent G rho beta D.theta + (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors rho Tnq ∨ + Disjoint + (insert beta ({ D.theta } : Finset (Fin k)) : + Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors rho Tn ∨ + Disjoint + (insert beta ({ D.theta } : Finset (Fin k)) : + Finset (Fin k)) + Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors rho A ∧ + TreeColorSetClosed G rho A + ({ beta } : Finset (Fin k)) → + sameComponent ∧ + TreeInterchangeable G A rho beta D.theta)) → + TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex ib)) = + TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex D.penultimateVertexIndex)) + +private abbrev helperContinuation4157Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + D.alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi Bshort) → + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some D.alpha) → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ + MissingColors G rho + (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (rho : PartialEdgeColoring E k) (X Y : TreeSequence G e0), + ∀ + c ∉ + (TreeSequenceVertexSet X \ TreeSequenceVertexSet Y).biUnion + fun (v : V) ↦ MissingColors G rho v, + c ∈ TreeMissingColors rho X → c ∈ TreeMissingColors rho Y) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet + (Sum.inl v)).Subsingleton) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet B → + v ∈ TreeSequenceVertexSet B → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + False + +private abbrev helperHsameTwo4804Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta) → + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + beta ≠ D.alpha → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex → + T.vertex ib ≠ T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (beta ∉ TreeMissingColors phi A → + beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi beta D.alpha (Sum.inl va) = + TwoColorComponent G phi beta D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.penultimateVertexIndex)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi beta D.alpha z; + Disjoint + (TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib))) → + TwoColorPathComponent G phi beta D.alpha z → + Sum.inl (T.vertex ib) ∉ TwoColorComponent G phi beta D.alpha z → + Sum.inl (T.vertex D.penultimateVertexIndex) ∉ + TwoColorComponent G phi beta D.alpha z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G phi beta D.alpha z) w = + MissingColors G phi w) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + (∀ c ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition muOne T c = + HierarchyFirstMissingPosition phi T c) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < H.dividerCount ∧ + beta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∨ + H.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T), + MaximumProperty corrOne.replacementETT → + ∀ (baseOne : HierarchyBase corrOne.replacementETT muOne) + (KOne : TashkinovHierarchy corrOne.replacementETT baseOne) + (goodOne : GoodHierarchy KOne), + SameGoodHierarchy C.good goodOne → + beta ∈ MissingColors G muOne (T.vertex D.terminalVertexIndex) → + ∀ + (POne : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + POne.coloring = muOne → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 + POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let baseOne' : + HierarchyBase POne.corresponding.replacementETT + POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := + POne.counterexample; + let HOne : + TashkinovHierarchy POne.corresponding.replacementETT + POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := + Fin.last HOne.dividerCount; + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∉ HierarchyStoredColorsAt HOne qOne → + beta ∉ + MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ + MissingColors G rho (T.vertex D.terminalVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = + D.penultimateVertexIndex → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree + (Fin.last ettOne.rounds).castSucc)) → + beta ∈ TreeMissingColors rho B ∧ + D.theta ∈ TreeMissingColors rho B → + (let H : TashkinovHierarchy ettOne baseOne' := + COne'.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + have n : Fin (ettOne.rounds + (1 : ℕ)) := + Fin.last ettOne.rounds; + have A : TreeSequence G e0 := + HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := + ettOne.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := + TashkinovStoredColors ettOne.series.data n; + have Dnq : Finset (Fin k) := + HierarchyStoredColorsAt H q; + have va : V := + T.vertex + (HierarchyFirstMissingPosition rho T beta); + have vb : V := + T.vertex + (HierarchyFirstMissingPosition rho T D.theta); + have sameComponent : Prop := + TwoColorComponent G rho beta D.theta + (Sum.inl va) = + TwoColorComponent G rho beta D.theta + (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors rho Tnq ∨ + Disjoint + (insert beta ({ D.theta } : Finset (Fin k)) : + Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors rho Tn ∨ + Disjoint + (insert beta ({ D.theta } : Finset (Fin k)) : + Finset (Fin k)) + Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors rho A ∧ + TreeColorSetClosed G rho A + ({ beta } : Finset (Fin k)) → + sameComponent ∧ + TreeInterchangeable G A rho beta D.theta)) → + TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex ib)) = + TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex D.penultimateVertexIndex)) + +private abbrev helperReduction4203Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + D.alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi Bshort) → + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some D.alpha) → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ + MissingColors G rho + (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet + (Sum.inl v)).Subsingleton) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet B → + v ∈ TreeSequenceVertexSet B → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition + (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c) → + ∀ + (seriesFacts : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j) ∧ + IsOneEdgeUncolored (ett.series.data.coloring j) e0), + let corrRefl : + CorrespondingExtendedTashkinovTree G k e0 ett phi T := by + exact + { + replacementInput := input, replacementSeries := ett.series, + replacementETT := ett, rungAgreement := rfl, + seriesPresentation := HEq.rfl, + finalGeneratingColoring := ett.generatingColoring, + ladderTreesAgree := fun (x : Fin ett.rounds) ↦ rfl, + storedColorsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ rfl, + connectingEdgesAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ + rfl, + extensionKindsAgree := fun (x : Fin (ett.rounds + (1 : ℕ))) ↦ + rfl, + replacementProper := fun (j : Fin (ett.rounds + (1 : ℕ))) ↦ + (seriesFacts j).left, + replacementOneUncolored := fun (j : Fin (ett.rounds + (1 : ℕ))) ↦ + (seriesFacts j).right, + replacementStable := fun (x : Fin ett.rounds) ↦ + (⟨fun (x_1 : E) + (x_2 : + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) x_1) + (x_3 : + ∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ x_1 = some c) ↦ + rfl, + fun (x_1 : V) + (x_2 : + x_1 ∈ + TreeSequenceVertexSet + (ett.series.data.tree x.succ.castSucc)) ↦ + rfl⟩ : + (∀ (f : E), + TreeIncidentEdge (ett.series.data.tree x.succ.castSucc) f → + (∃ + c ∈ + TreeMissingColors (ett.series.data.coloring x.succ) + (ett.series.data.tree x.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data x.succ, + ett.series.data.coloring x.succ f = some c) → + ett.series.data.coloring x.succ f = + ett.series.data.coloring x.succ f) ∧ + ∀ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree x.succ.castSucc), + MissingColors G (ett.series.data.coloring x.succ) v = + MissingColors G (ett.series.data.coloring x.succ) v) : + CorrespondingExtendedTashkinovTree G k e0 ett phi T }; + let PRefl : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx := by + exact + { + coloring := phi, corresponding := corrRefl, + maximum := C.maximum, replacementBase := base, + counterexample := C, + sameGood := + (⟨(⟨rfl, + (⟨by + have := GoldbergSeymour.TreeSequence.positive T + omega, + (⟨HEq.rfl, + (⟨HEq.rfl, + (⟨Iff.rfl, + fun + (x : + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) ↦ + rfl⟩ : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerPosition ≍ + C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ + C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ + C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure))⟩ : + base.core = base.core ∧ + C.hierarchy.dividerCount = C.hierarchy.dividerCount ∧ + C.hierarchy.stage ≍ C.hierarchy.stage ∧ + C.hierarchy.dividerPosition ≍ + C.hierarchy.dividerPosition ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ↔ + corrRefl.replacementETT.series.data.kind + (Fin.last corrRefl.replacementETT.rounds) = + some TashkinovExtensionKind.PE) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + base.closure = base.closure)), + Exists.intro + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + fun (x : Fin (C.hierarchy.dividerCount + (1 : ℕ))) ↦ + (⟨rfl, + fun (x_1 : Fin k) + (x_2 : x_1 ∈ HierarchyStoredColorsAt C.hierarchy x) ↦ + rfl⟩ : + HierarchyStoredColorsAt C.hierarchy x = + HierarchyStoredColorsAt C.hierarchy + (Fin.cast + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + corrRefl + have := GoldbergSeymour.TreeSequence.positive T + omega) + x) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy x, + C.good.gamma x eta = + C.good.gamma + (Fin.cast + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + corrRefl + have := GoldbergSeymour.TreeSequence.positive T + omega) + x) + eta)⟩ : + SameHierarchyStages C.hierarchy C.hierarchy ∧ + ∃ (hcount : + C.hierarchy.dividerCount = C.hierarchy.dividerCount), + ∀ (j : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + have j₂ : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + Fin.cast + (by + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + corrRefl + have := GoldbergSeymour.TreeSequence.positive T + omega) + j; + HierarchyStoredColorsAt C.hierarchy j = + HierarchyStoredColorsAt C.hierarchy j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy j, + C.good.gamma j eta = C.good.gamma j₂ eta), + minimumContext := ctx : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx }; + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma + (Fin.last P.counterexample.hierarchy.dividerCount) eta) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), + (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → + (∀ {input' : PartialEdgeColoring E k} + (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) + (base' : HierarchyBase ett' rho) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring + (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data + (Fin.last ett'.rounds)) + rho sigma) → + (∀ {input' : PartialEdgeColoring E k} + (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) + (base' : HierarchyBase ett' old) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ + (t : + Fin + (HierarchyStarredStage K + (Fin.last K.dividerCount)).length), + new + ((HierarchyStarredStage K + (Fin.last K.dividerCount)).edge + t) = + old + ((HierarchyStarredStage K + (Fin.last K.dividerCount)).edge + t)) → + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ + TreeMissingColors phi + (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → + D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ + eta ∈ TreeMissingColors phi Bshort) → + False + +private abbrev helperContinuation5379Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet + (Sum.inl v)).Subsingleton) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u))) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet B → + v ∈ TreeSequenceVertexSet B → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w) → + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = + HierarchyFirstMissingPosition rho T c) → + (∀ + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma + (Fin.last P.counterexample.hierarchy.dividerCount) eta) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), + (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → + (∀ {input' : PartialEdgeColoring E k} + (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) + (base' : HierarchyBase ett' rho) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring + (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) + rho sigma) → + (∀ {input' : PartialEdgeColoring E k} + (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) + (base' : HierarchyBase ett' old) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ + (t : + Fin + (HierarchyStarredStage K + (Fin.last K.dividerCount)).length), + new + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge + t) = + old + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge + t)) → + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → + D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + beta ≠ D.alpha → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := + HierarchyFirstMissingPosition phi T beta; + beta ∈ + MissingColors G phi + (T.vertex + (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ + Bshort.length → + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex → + T.vertex ib ≠ T.vertex D.terminalVertexIndex → + T.vertex D.penultimateVertexIndex ≠ + T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) + (T.vertex D.penultimateVertexIndex) → + (∀ (rho : PartialEdgeColoring E k), + ∀ + c ∈ + MissingColors G rho + (T.vertex + (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < + (↑(HierarchyFirstMissingPosition rho T c) : + ℕ)) → + (beta ∉ TreeMissingColors phi A → + beta ∉ + TashkinovStoredColors ett.series.data + (Fin.last ett.rounds)) → + beta ∈ TreeMissingColors phi B ∧ + D.alpha ∈ TreeMissingColors phi B → + (let H : TashkinovHierarchy ett base := + C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := + Fin.last ett.rounds; + have A : TreeSequence G e0 := + HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := + ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := + TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := + HierarchyStoredColorsAt H q; + have va : V := + T.vertex + (HierarchyFirstMissingPosition phi T beta); + have vb : V := + T.vertex + (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi beta D.alpha + (Sum.inl va) = + TwoColorComponent G phi beta D.alpha + (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors phi Tnq ∨ + Disjoint + (insert beta + ({ D.alpha } : Finset (Fin k)) : + Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors phi Tn ∨ + Disjoint + (insert beta + ({ D.alpha } : Finset (Fin k)) : + Finset (Fin k)) + Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A + ({ beta } : Finset (Fin k)) → + sameComponent ∧ + TreeInterchangeable G A phi beta D.alpha)) → + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex ib)) = + TwoColorComponent G phi beta D.alpha + (Sum.inl + (T.vertex D.penultimateVertexIndex)) → + let z : V ⊕ E := + Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi beta D.alpha z; + Disjoint + (TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex ib))) → + TwoColorPathComponent G phi beta D.alpha z → + Sum.inl (T.vertex ib) ∉ + TwoColorComponent G phi beta D.alpha z → + Sum.inl + (T.vertex D.penultimateVertexIndex) ∉ + TwoColorComponent G phi beta D.alpha z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G + (TwoColorComponentSwap G phi beta + D.alpha z) + w = + MissingColors G phi w) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + muOne (T.edge t) = phi (T.edge t)) → + (∀ c ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition muOne T + c = + HierarchyFirstMissingPosition phi T + c) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < H.dividerCount ∧ + beta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin + (H.dividerCount + (2 : ℕ)))) ∨ + H.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors phi + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc)) → + ∀ + (corrOne : + CorrespondingExtendedTashkinovTree G + k e0 ett muOne T), + MaximumProperty + corrOne.replacementETT → + ∀ + (baseOne : + HierarchyBase + corrOne.replacementETT muOne) + (KOne : + TashkinovHierarchy + corrOne.replacementETT baseOne) + (goodOne : GoodHierarchy KOne), + SameGoodHierarchy C.good goodOne → + beta ∈ + MissingColors G muOne + (T.vertex + D.terminalVertexIndex) → + ∀ + (POne : + HierarchyReplacementPresentation + G k e0 input T phi ett base C + ctx), + POne.coloring = muOne → + let rho : + PartialEdgeColoring E k := + POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 + POne.corresponding.replacementInput + T POne.coloring := + POne.corresponding.replacementETT; + let baseOne' : + HierarchyBase + POne.corresponding.replacementETT + POne.coloring := + POne.replacementBase; + let COne' : + HierarchyCounterexample + POne.replacementBase := + POne.counterexample; + let ctxOne : + HierarchyMinimumCounterexampleContext + G k e0 + POne.corresponding.replacementInput + T POne.coloring + POne.corresponding.replacementETT + POne.replacementBase + POne.counterexample := + POne.minimumContext; + let HOne : + TashkinovHierarchy + POne.corresponding.replacementETT + POne.replacementBase := + COne'.hierarchy; + let qOne : + Fin + (HOne.dividerCount + + (1 : ℕ)) := + Fin.last HOne.dividerCount; + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G rho v = + MissingColors G phi v) → + ColoredVertexSetElementary G + rho + (TreeSequenceVertexSet B) → + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X + B → + TreeMissingColors rho X = + TreeMissingColors phi X) → + False + +private theorem helper_hBT_115.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C B hBlen + refine ⟨?_, ?_, ?_⟩ + · omega + · intro i + rfl + · intro i + rfl + +private theorem helper_hApositive_122.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hq + have hi : q = (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp [q] + omega + change HierarchyStarredStage H q = _ + rw [hi] + simp only [HierarchyStarredStage, Fin.cases_succ] + congr 1 + apply Fin.ext + simp + omega + +private theorem helper_hAT_140.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hApositive hAzero + by_cases hz : H.dividerCount = 0 + · have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by apply Fin.ext; simp [hz] + simpa [hAzero hz, hi, H.terminalStage] using H.coreInsideFirst + · rw [hApositive (Nat.pos_of_ne_zero hz)] + have hi : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + q.castSucc := Fin.ext rfl + have hj : H.stage q.succ = T := by + convert H.terminalStage using 1 + congr 1 + simpa only [hi, hj] using H.nested q + +private theorem helper_hAB_152.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A B htail hBlen hApositive hAzero hAT + refine ⟨by omega, ?_, ?_⟩ + · intro i + exact hAT.2.1 i + · intro i + exact hAT.2.2 i + +private theorem helper_hBterminal_158.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hBT + rw [← hBT.2.1 (Fin.last B.length)] + congr 1 + apply Fin.ext + have hp := D.penultimateVertexPosition + simp only [Fin.val_castLE, Fin.val_last] + omega + +private theorem helper_firstAt_172.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + ∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hyB hElementary c hc + let candidates := Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex i) + have hy : D.penultimateVertexIndex ∈ candidates := by simp [candidates, hc] + have hn : candidates.Nonempty := ⟨_, hy⟩ + have hmin := Finset.min'_le candidates _ hy + have hm : c ∈ MissingColors G phi (T.vertex (candidates.min' hn)) := + (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hmem : T.vertex (candidates.min' hn) ∈ TreeSequenceVertexSet B := by + let j : Fin (B.length + 1) := ⟨(candidates.min' hn).val, by + have hp := D.penultimateVertexPosition + change (candidates.min' hn).val ≤ D.penultimateVertexIndex.val at hmin + omega⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨j, ?_⟩ + rfl + have heq : candidates.min' hn = D.penultimateVertexIndex := by + by_contra hne + have hvne := fun h => hne (T.vertex_injective h) + exact Finset.disjoint_left.mp (hElementary hmem hyB hvne) hm hc + simpa only [HierarchyFirstMissingPosition, candidates, dite_eq_left hn] using heq + +private theorem helper_hnotA_197.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + ∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hApositive hAzero hAT hAB + hyB hElementary hfirstTheta c hc ha + rcases Finset.mem_biUnion.mp ha with ⟨v, hv, hvc⟩ + have hvB := TreeSequenceInitialSegmentVertexSetSubset hAB hv + have hvne : v ≠ T.vertex D.penultimateVertexIndex := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨i, rfl⟩ + intro he + have hi := T.vertex_injective ((hAT.2.1 i).trans he) + have hp := D.penultimateVertexPosition + have hib := i.isLt + have hiv := congrArg Fin.val hi + simp only [Fin.val_castLE] at hiv + omega + exact Finset.disjoint_left.mp (hElementary hvB hyB hvne) hvc hc + +private theorem helper_hshortB_225.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + TreeSequenceInitialSegment Bshort B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen Bshort hshortLen + refine ⟨by omega, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + +private theorem helper_hnotShort_231.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + ∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi Bshort := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hyB hElementary hfirstTheta Bshort + hshortLen hshortT hshortB c hc hm + rcases Finset.mem_biUnion.mp hm with ⟨v, hv, hvc⟩ + have hvB := TreeSequenceInitialSegmentVertexSetSubset hshortB hv + have hne : v ≠ T.vertex D.penultimateVertexIndex := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨i, rfl⟩ + intro he + have hi := congrArg Fin.val (T.vertex_injective ((hshortT.2.1 i).trans he)) + have hp := D.penultimateVertexPosition + have hib := i.isLt + simp only [Fin.val_castLE] at hi + omega + exact Finset.disjoint_left.mp (hElementary hvB hyB hne) hvc hc + +private theorem helper_hterminalIncident_247.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D Bshort hshortLen + obtain ⟨i, hi⟩ := T.attaches D.lastEdgeIndex + have hj : D.lastEdgeIndex.succ = D.terminalVertexIndex := by + apply Fin.ext + have hl := D.lastEdgePosition + have ht := D.terminalVertexPosition + simp only [Fin.val_succ] + omega + change _ ∈ G.ends (T.edge D.lastEdgeIndex) + rw [hi, hj] + exact Sym2.mem_mk_left _ _ + +private theorem helper_halphaLast_259.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → + phi (T.edge D.lastEdgeIndex) ≠ some D.alpha := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hterminalIncident he + have hm := (Finset.mem_sdiff.mp D.alphaMissingTerminal).2 + apply hm + exact Finset.mem_filter.mpr + ⟨Finset.mem_univ _, T.edge D.lastEdgeIndex, hterminalIncident, he⟩ + +private theorem helper_halphaUnused_265.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + D.alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + phi (T.edge D.lastEdgeIndex) ≠ some D.alpha → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hApositive hAzero + hBterminal hElementary halphaNotRaw Bshort hshortLen halphaLast + have hexclusion := HierarchyTailMissingColorExclusion G k e0 input T phi + ett base H hElementary (HierarchyFullTailLength C - 1) + (by change 1 ≤ T.length - A.length - 1; omega) + (by change T.length - A.length - 1 < T.length - A.length; omega) + D.alpha (by + change D.alpha ∈ MissingColors G phi (B.vertex (Fin.last B.length)) + rw [hBterminal] + exact D.alphaMissingPenultimate) + intro t ht he + by_cases hlast : t = D.lastEdgeIndex + · exact halphaLast (hlast ▸ he) + · have hb : t.val < B.length := by + have hp := D.lastEdgePosition + have hne : t.val ≠ D.lastEdgeIndex.val := fun h => hlast (Fin.ext h) + have htlt := t.isLt + omega + let tB : Fin B.length := ⟨t.val, hb⟩ + have hcast : Fin.castLE hBT.1 tB = t := Fin.ext rfl + have heB : phi (B.edge tB) = some D.alpha := by + rw [← hBT.2.2 tB, hcast] + exact he + obtain ⟨_, _, _, f, _, _, _, _, _, hs⟩ := hexclusion tB ht + (by change tB.val < A.length + (T.length - A.length - 1); omega) heB + exact halphaNotRaw hs + +private theorem helper_firstWitness_291.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (rho : PartialEdgeColoring E k) + (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length := by + classical + intro V E _ _ G k e0 T rho X hXT c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hvc⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨i, rfl⟩ + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex j) + have hi : Fin.castLE (Nat.succ_le_succ hXT.1) i ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [hXT.2.1 i] + exact hvc + have hn : candidates.Nonempty := ⟨_, hi⟩ + have hm := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hle := Finset.min'_le candidates _ hi + have hib := i.isLt + unfold HierarchyFirstMissingPosition + change (c ∈ MissingColors G rho (T.vertex (if h : candidates.Nonempty then + candidates.min' h else Fin.last T.length))) ∧ _ + rw [dite_eq_left hn] + refine ⟨hm, ?_⟩ + change (candidates.min' hn).val ≤ i.val at hle + omega + +private theorem helper_missingSubset_322.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y := by + classical + intro V E _ _ G k e0 rho X Y hXY + let _ := Fintype.ofFinite V + as_aux_lemma => + intro c hc + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hm⟩ + +private theorem helper_missingWithoutExtra_331.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (rho : PartialEdgeColoring E k) + (X Y : TreeSequence G e0), + ∀ + c ∉ + (TreeSequenceVertexSet X \ TreeSequenceVertexSet Y).biUnion fun (v : V) ↦ + MissingColors G rho v, + c ∈ TreeMissingColors rho X → + c ∈ TreeMissingColors rho Y := by + classical + intro V E _ _ _ G k e0 rho X Y c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + intro hm + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hm + have hvY : v ∈ TreeSequenceVertexSet Y := by + by_contra hn + exact hc (Finset.mem_biUnion.mpr ⟨v, Finset.mem_sdiff.mpr ⟨hv, hn⟩, hvc⟩) + exact Finset.mem_biUnion.mpr ⟨v, hvY, hvc⟩ + +private theorem helper_leaf_344.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ G k rho a b hne hp v hm + let _ := Fintype.ofFinite V + have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G rho a b) + (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with ha | hb + · exact MissingColorIncidenceEndpoint G rho a b hne hp v ha + · have he : TwoColorIncidenceGraph G rho a b = TwoColorIncidenceGraph G rho b a := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + rw [he] + exact MissingColorIncidenceEndpoint G rho b a hne.symm hp v hb + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx y hy + exact Finset.card_le_one_iff.mp hd + (by simpa [SimpleGraph.mem_neighborFinset] using hx) + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + +private theorem helper_separate_363.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ), + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → + (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (v : V), + a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → + ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton) → + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ∀ (u v w : V), + u ≠ v → + u ≠ w → + v ≠ w → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → + TwoColorComponent G rho a b (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + classical + intro V E _ _ G k self leaf rho a b hne hp u v w huv huw hvw hu hv hw hsame + let _ := Fintype.ofFinite V + rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd + · exfalso + obtain ⟨s, t, p, hpPath, hsupport⟩ := + TwoColorComponentSpanningPath G rho a b hp (Sum.inl w) + have ends (x : V) (hx : Sum.inl x ∈ TwoColorComponent G rho a b (Sum.inl w)) + (hm : a ∈ MissingColors G rho x ∨ b ∈ MissingColors G rho x) : + Sum.inl x = s ∨ Sum.inl x = t := by + by_contra hnot + push Not at hnot + have hs : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {z | z ∈ p.support} + rw [hsupport] + exact hx + exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet + hnot.1 hnot.2 (leaf rho a b hne hp x hm) hs + have hue := ends u (he ▸ self rho a b u) (Or.inl hu) + have hve := ends v (by rw [he, hsame]; exact self rho a b v) (Or.inr hv) + have hwe := ends w (self rho a b w) hw + rcases hue with hu | hu <;> rcases hve with hv | hv <;> rcases hwe with hw | hw + all_goals first + | exact huv (Sum.inl.inj (hu.trans hv.symm)) + | exact huw (Sum.inl.inj (hu.trans hw.symm)) + | exact hvw (Sum.inl.inj (hv.trans hw.symm)) + · exact hd + +private theorem helper_prefixMissing_397.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + ∀ (u v : V), + u ∈ TreeSequenceVertexSet B → + v ∈ TreeSequenceVertexSet B → + a ∈ MissingColors G rho u → + b ∈ MissingColors G rho v → + Sum.inl u ∉ TwoColorComponent G rho a b z → + Sum.inl v ∉ TwoColorComponent G rho a b z → + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C B z rho a b hne hp helem u v huB hvB hu hv hdu hdv + as_aux_lemma => + clear_value B + clear * - G rho a b hne hp helem u v huB hvB hu hv hdu hdv B z + have behavior := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + intro w hwB + by_cases hw : Sum.inl w ∈ TwoColorComponent G rho a b z + · have hwa : a ∉ MissingColors G rho w := by + intro hm + have hwu : w ≠ u := fun he => hdu (he ▸ hw) + exact Finset.disjoint_left.mp (helem hwB huB hwu) hm hu + have hwb : b ∉ MissingColors G rho w := by + intro hm + have hwv : w ≠ v := fun he => hdv (he ▸ hw) + exact Finset.disjoint_left.mp (helem hwB hvB hwv) hm hv + have presentSwapped (c d : Fin k) + (hd : d ∉ MissingColors G rho w) + (hdab : (d = a ∧ c = b) ∨ (d = b ∧ c = a)) : + c ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by + have hpres : d ∈ PresentColors G rho w := by simpa [MissingColors] using hd + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpres + rcases hpres with ⟨e, hwe, he⟩ + have hadj : (TwoColorIncidenceGraph G rho a b).Adj (Sum.inr e) (Sum.inl w) := by + simp only [TwoColorIncidenceGraph] + exact ⟨hwe, hdab.elim (fun h => Or.inl (he.trans (congrArg some h.1))) + (fun h => Or.inr (he.trans (congrArg some h.1)))⟩ + have heC : Sum.inr e ∈ TwoColorComponent G rho a b z := by + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = _ at hw + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inr e) = _ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hw + have heSwap : TwoColorComponentSwap G rho a b z e = some c := by + rcases hdab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · simp [TwoColorComponentSwap, heC, he] + · simp [TwoColorComponentSwap, heC, he] + have hpresent : c ∈ PresentColors G (TwoColorComponentSwap G rho a b z) w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, heSwap⟩ + simpa [MissingColors] using hpresent + have hnewa := presentSwapped a b hwb (Or.inr ⟨rfl, rfl⟩) + have hnewb := presentSwapped b a hwa (Or.inl ⟨rfl, rfl⟩) + apply Finset.ext + intro c + by_cases hca : c = a + · subst c + simp only [hnewa, hwa] + · by_cases hcb : c = b + · subst c + simp only [hnewb, hwb] + · exact behavior.2.2.2 w c hca hcb + · exact behavior.1 w hw + +private theorem helper_firstPreserved_455.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment B T → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C B hBT firstWitness rho sigma c helem hmiss hc + as_aux_lemma => + clear_value B + clear * - G T B rho sigma c helem hmiss hc firstWitness hBT + have hr := firstWitness rho B hBT c hc + have hc' : c ∈ TreeMissingColors sigma B := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ + have hs := firstWitness sigma B hBT c hc' + have pref (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : + T.vertex i ∈ TreeSequenceVertexSet B := by + let j : Fin (B.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hBT.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, (hBT.2.1 j).symm.trans (congrArg T.vertex he)⟩ + by_contra hne + have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ + T.vertex (HierarchyFirstMissingPosition rho T c) := + fun he => hne (T.vertex_injective he) + have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 + exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 + +private theorem helper_firstUnaffected_480.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) + (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ G k e0 T z rho a b c hne hp hca hcb + let _ := Fintype.ofFinite V + have hb := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + have he : (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G (TwoColorComponentSwap G rho a b z) (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hb.2.2.2 _ c hca hcb + unfold HierarchyFirstMissingPosition + rw [he] + +private theorem helper_seriesFacts_495.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j) ∧ + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + classical + intro V E _ _ _ G k e0 input T phi ett j + have certificate := ett.series.certified j + cases certificate with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact ⟨currentProper, currentOneUncolored⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact ⟨previousProper, previousOneUncolored⟩ + +private theorem helper_sameStar_549.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A P + have helper : ∀ (n m : ℕ) (X Y : TreeSequence G e0) + (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → TreeSequence G e0), + n = m → X = Y → HEq s t → + Fin.cases (motive := fun _ => TreeSequence G e0) + X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = + Fin.cases (motive := fun _ => TreeSequence G e0) + Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by + intro n m X Y s t hnm hXY hst + subst m + have he := eq_of_heq hst + simp [hXY, he] + exact (helper _ _ base.core P.replacementBase.core H.stage + P.counterexample.hierarchy.stage P.sameGood.1.2.1 P.sameGood.1.1 + P.sameGood.1.2.2.1).symm + +private theorem helper_commonPrefix_588.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → + TreeSequenceInitialSegment X Y := by + classical + intro V E G e0 X Y F hXF hYF hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYF.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXF.2.1 i) + · intro i + exact (hYF.2.2 (Fin.castLE hXY i)).symm.trans (hXF.2.2 i) + +private theorem helper_hcoreLength_597.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + base.core.length ≤ A.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hApositive hAzero + by_cases hz : H.dividerCount = 0 + · exact le_of_eq (congrArg TreeSequence.length (hAzero hz).symm) + · rw [hApositive (Nat.pos_of_ne_zero hz)] + have hm : Monotone (fun i : Fin (H.dividerCount + 2) => (H.stage i).length) := + Fin.monotone_iff_le_succ.mpr fun i => (H.nested i).1 + exact H.coreInsideFirst.1.trans (hm (show + (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) ≤ + ⟨H.dividerCount, by omega⟩ from Nat.pos_of_ne_zero hz)) + +private theorem helper_predecessorIncident_606.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) + (e0 : E) (T X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), + (↑t : ℕ) = X.length → + TreeIncidentEdge X (T.edge t) := by + classical + intro V E _ _ G e0 T X hXT t ht + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨i, hi⟩ := T.attaches t + let j : Fin (X.length + 1) := ⟨i.val, by have := i.isLt; omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hXT.1) j = + Fin.castLE (by omega : t.val + 1 ≤ T.length + 1) i := Fin.ext rfl + refine ⟨X.vertex j, (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, rfl⟩, ?_⟩ + rw [← hXT.2.1 j, he, Incident, hi] + exact Sym2.mem_mk_right _ _ + +private theorem helper_seedStable_618.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma := by + classical + intro V E _ _ _ _ G k e0 T input' rho sigma ett' base' K hw hq + have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hq + rw [hi] at hw + change (if ett'.series.data.kind (Fin.last ett'.rounds) = + some TashkinovExtensionKind.PE then _ else _) at hw + split_ifs at hw with hpe + · exact hw.1 + · exact hw + +private theorem helper_weakEdges_634.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by + classical + intro V E _ _ _ _ G k e0 T input' old new ett' base' K hw ho hno + by_cases hz : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz + rw [hi] at hw ⊢ + exact P2813_T1_BaseDisplayedEdges G k e0 input' T old ett' base' new ho hno hw + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := + Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) + rw [hi] at hw ⊢ + intro t + have hinv := hw.2 + by_cases ht : 1 ≤ t.val + · exact hinv.1 t ht + · let S := HierarchyStarredStage K + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ + have he : t = ⟨0, S.positive⟩ := Fin.ext (by change t.val = 0; omega) + rw [he, S.first_edge, hno.1, ho.1] + +private theorem helper_hbetaTheta_676.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (2 : ℕ) ≤ T.length - A.length → + ∀ (beta : Fin k), + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ≠ D.theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail beta hbetaUnused he + exact hbetaUnused D.lastEdgeIndex (by + have hp := D.lastEdgePosition + clear * - hp htail + omega) (D.thetaOnLastEdge.trans (congrArg some he.symm)) + +private theorem helper_hby_688.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + ∀ (beta : Fin k), + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D Bshort hshortLen beta ib hbFirst he + have hi := congrArg Fin.val (T.vertex_injective he) + have hp := D.penultimateVertexPosition + have hb : ib.val ≤ Bshort.length := hbFirst.2 + clear * - hi hp hb hshortLen + omega + +private theorem helper_hbt_695.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + ∀ (beta : Fin k), + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ≠ T.vertex D.terminalVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D Bshort hshortLen beta ib hbFirst he + have hi := congrArg Fin.val (T.vertex_injective he) + have hp := D.terminalVertexPosition + have hb : ib.val ≤ Bshort.length := hbFirst.2 + clear * - hi hp hb hshortLen + omega + +private theorem helper_hyt_702.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D he + have hi := congrArg Fin.val (T.vertex_injective he) + have hp := D.penultimateVertexPosition + have ht := D.terminalVertexPosition + clear * - hi hp ht + omega + +private theorem helper_firstAfter_715.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + ∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hAT rho c hc hn + by_contra h + have hi : (HierarchyFirstMissingPosition rho T c).val ≤ A.length := Nat.le_of_not_gt h + let i : Fin (A.length + 1) := ⟨(HierarchyFirstMissingPosition rho T c).val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hAT.1) i = + HierarchyFirstMissingPosition rho T c := Fin.ext rfl + apply hn + refine Finset.mem_biUnion.mpr ⟨A.vertex i, (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, + Finset.mem_univ _, rfl⟩, ?_⟩ + rw [← hAT.2.1 i, he] + exact hc + +private theorem helper_hsame_747.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + D.alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + beta ≠ D.alpha → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex → + T.vertex ib ≠ T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (beta ∉ TreeMissingColors phi A → + beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi beta D.alpha (Sum.inl va) = + TwoColorComponent G phi beta D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hfirstAlpha halphaNotRaw Bshort + beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib + hbFirst hibB hby hbt horder hrawBeta hmissing hchange + rw [← hfirstAlpha] + by_cases hz : H.dividerCount = 0 + · apply hchange.2.1 + refine ⟨hz, ?_⟩ + by_cases hm : beta ∈ TreeMissingColors phi A + · exact Or.inl (hzero hz hm) + · right + rw [Finset.disjoint_left] + intro c hc hd + rcases Finset.mem_insert.mp hc with rfl | hc + · exact hrawBeta hm hd + · exact halphaNotRaw (Finset.mem_singleton.mp hc ▸ hd) + · apply hchange.1 + refine ⟨Nat.pos_of_ne_zero hz, Or.inr ?_⟩ + rw [Finset.disjoint_left] + intro c hc hd + rcases Finset.mem_insert.mp hc with rfl | hc + · exact hbetaStored hd + · exact D.alphaOutsideStored (Finset.mem_singleton.mp hc ▸ hd) + +private theorem helper_branch_815.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (beta : Fin k), + beta ≠ D.alpha → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta D.alpha z; + Disjoint + (TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib))) → + TwoColorPathComponent G phi beta D.alpha z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G phi beta D.alpha z) w = + MissingColors G phi w) → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + (∀ c ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition muOne T c = HierarchyFirstMissingPosition phi T c) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < H.dividerCount ∧ + beta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∨ + H.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + beta ∈ TreeMissingColors phi A → + ∃ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T), + MaximumProperty corrOne.replacementETT ∧ + ∃ (baseOne : HierarchyBase corrOne.replacementETT muOne) (KOne : + TashkinovHierarchy corrOne.replacementETT baseOne) (goodOne : GoodHierarchy KOne), + SameGoodHierarchy C.good goodOne := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B beta hbetaAlpha ib hmissing z + muOne hdisjoint hpath hmissingOne hfixedOne hstoredOne hcase hm + exact (StableChangeCasesOneTwoFullTail G k e0 input T phi ett base C ctx + beta D.alpha hbetaAlpha hmissing z hpath muOne rfl + (by dsimp only; rcases hcase hm with hpos | ⟨hz, hn⟩ + · exact Or.inl hpos + · exact Or.inr ⟨hz, Or.inl hn⟩) + hdisjoint hfixedOne hmissingOne hstoredOne).2.2.2.2 + +private theorem helper_branch_821.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment A T → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ (beta : Fin k), + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + beta ≠ D.alpha → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ)) → + beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta D.alpha z; + beta ∉ TreeMissingColors phi A → + ∃ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T), + MaximumProperty corrOne.replacementETT ∧ + ∃ (baseOne : HierarchyBase corrOne.replacementETT muOne) (KOne : + TashkinovHierarchy corrOne.replacementETT baseOne) (goodOne : GoodHierarchy KOne), + SameGoodHierarchy C.good goodOne := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT hElementary hfirstAlpha + Bshort beta hbetaUnused hbetaStored hbetaAlpha ib hbFirst horder firstAfter hmissing z + muOne hm + have ha := firstAfter phi beta hbFirst.1 hm + exact (StableChangeCaseThree G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality hElementary ctx.largeMissingSet + beta D.alpha hbetaAlpha hmissing z muOne rfl + (by + intro u hu + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hu + exact ⟨Fin.castLE (Nat.succ_le_succ hAT.1) i, ib, hAT.2.1 i, rfl, by + change i.val < ib.val + have hi : i.val ≤ A.length := Nat.le_of_lt_succ i.isLt + exact lt_of_le_of_lt hi ha⟩) + (by rw [hfirstAlpha]; exact horder) + ⟨hbetaStored, D.alphaOutsideStored⟩ + (by + intro hc + obtain ⟨t, ht, _, he⟩ := (Finset.mem_filter.mp hc).2 + exact hbetaUnused t (by clear * - ha ht; omega) he)).2.2.2.2 + +private theorem helper_hcaseOne_906.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + ∀ (beta : Fin k), + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let _ : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X B → + TreeMissingColors rho X = TreeMissingColors phi X) → + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors rho (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hBlen hBT sameStar sameTn + commonPrefix beta hzero POne rho ettOne COne' HOne qOne missingEq hmissingA hm + have hcount : H.dividerCount = HOne.dividerCount := POne.sameGood.1.2.1 + by_cases hz : HOne.dividerCount = 0 + · refine Or.inr ⟨hz, ?_⟩ + rw [sameTn POne] + have hTnB := commonPrefix ett.abovePenultimate hBT (by + have hs := ett.strictAbovePenultimate + clear * - hs hBlen + omega) + change TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) B at hTnB + rw [missingEq _ hTnB] + exact hzero (hcount.trans hz) hm + · refine Or.inl ⟨Nat.pos_of_ne_zero hz, ?_⟩ + have hi : qOne = + (⟨HOne.dividerCount - 1, by omega⟩ : Fin HOne.dividerCount).succ := + Fin.ext (by simp only [qOne, Fin.val_last, Fin.val_succ]; omega) + have hs := sameStar POne + change HierarchyStarredStage HOne qOne = A at hs + rw [hi] at hs + have hind : (⟨HOne.dividerCount - 1, by omega⟩ : Fin HOne.dividerCount).succ.castSucc = + (⟨HOne.dividerCount, by omega⟩ : Fin (HOne.dividerCount + 2)) := + Fin.ext (by simp only [Fin.val_succ, Fin.val_castSucc]; omega) + change HOne.stage _ = A at hs + rw [hind] at hs + rw [hs, hmissingA] + exact hm + +private theorem helper_hsameTwo_964.{u_1, u_2} : + helperHsameTwo964Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast + beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib + hbFirst hibB hby hbt horder hrawBeta hmissing hchange hsame z muOne hdisjoint hpath + houtsideBeta houtsideAlpha hmissingOne hfixedOne hstoredOne hcase corrOne hmaxOne baseOne + KOne goodOne hsameOne hbTerminalOne POne hPOne rho ettOne baseOne' COne' HOne qOne + hmissingA hbetaStoredOne hgammaPenOne hgammaTermOne hgammaWitnessOne' hfirstGammaOne + hfirstThetaOne hgammaUnusedOne hcaseOne hmissingPairOne hchangeOne + rw [← hfirstGammaOne, ← hfirstThetaOne] + by_cases hm : beta ∈ TreeMissingColors phi A + · rcases hcaseOne hm with ⟨hp, hb⟩ | ⟨hz, hb⟩ + · exact hchangeOne.1 ⟨hp, Or.inl hb⟩ + · exact hchangeOne.2.1 ⟨hz, Or.inl hb⟩ + · have hnTheta : D.theta ∉ HierarchyStoredColorsAt HOne qOne := by + rw [← (sameLast POne).1] + exact houtside hm + by_cases hz : HOne.dividerCount = 0 + · apply hchangeOne.2.1 + refine ⟨hz, Or.inr ?_⟩ + rw [Finset.disjoint_left] + intro c hc hd + rcases Finset.mem_insert.mp hc with rfl | hc + · apply hbetaStoredOne + refine Finset.mem_sdiff.mpr ⟨hd, ?_⟩ + rw [sameStar POne, hmissingA] + exact hm + · have he : c = D.theta := Finset.mem_singleton.mp hc + subst c + apply hnTheta + refine Finset.mem_sdiff.mpr ⟨hd, ?_⟩ + rw [sameStar POne, hmissingA] + exact hnotA (c := D.theta) D.thetaMissingPenultimate + · apply hchangeOne.1 + refine ⟨Nat.pos_of_ne_zero hz, Or.inr ?_⟩ + rw [Finset.disjoint_left] + intro c hc hd + rcases Finset.mem_insert.mp hc with rfl | hc + · exact hbetaStoredOne hd + · exact hnTheta (Finset.mem_singleton.mp hc ▸ hd) + +private theorem helper_hstoredTwo_1017.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c) → + ∀ (beta : Fin k), + beta ≠ D.theta → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let _ : + HierarchyMinimumCounterexampleContext G k e0 POne.corresponding.replacementInput T + POne.coloring POne.corresponding.replacementETT POne.replacementBase + POne.counterexample := + POne.minimumContext; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + beta ∉ HierarchyStoredColorsAt HOne qOne → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho beta D.theta z) w = + MissingColors G rho w) → + ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B firstPreserved firstUnaffected beta + hbetaTheta z POne rho COne' ctxOne HOne qOne hElementaryOne hbetaStoredOne hmissingPairOne + muTwo hmissingTwo c hc + have hcb : c ≠ beta := fun he => hbetaStoredOne (he ▸ hc) + by_cases hct : c = D.theta + · exact hct.symm ▸ + firstPreserved rho muTwo D.theta hElementaryOne hmissingTwo hmissingPairOne.2 + · exact firstUnaffected z rho beta D.theta c hbetaTheta ctxOne.proper hcb hct + +private theorem helper_hthetaLastOne_1025.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (2 : ℕ) ≤ T.length - A.length → + ∀ (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta D.alpha z; + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + POne.coloring = muOne → + let rho : PartialEdgeColoring E k := POne.coloring; + rho (T.edge D.lastEdgeIndex) = some D.theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail beta z muOne hfixedOne POne + hPOne rho + rw [show rho = muOne from hPOne, hfixedOne D.lastEdgeIndex (by + have hl := D.lastEdgePosition + clear * - hl htail + omega)] + exact D.thetaOnLastEdge + +private theorem helper_hsuffix_1031.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + ∀ (beta : Fin k) + (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + rho (T.edge D.lastEdgeIndex) = some D.theta → + TashkinovAugmentationSequence rho B T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hBT beta POne rho hmissingPairOne + hthetaLastOne + apply Relation.ReflTransGen.single + refine ⟨hBlen.symm, hBT, D.theta, ?_, hmissingPairOne.2⟩ + have hi : Fin.cast hBlen (Fin.last B.length) = D.lastEdgeIndex := + Fin.ext (by + have hl := D.lastEdgePosition + simp only [Fin.val_cast, Fin.val_last] + clear * - hBlen hl + omega) + rw [hi] + exact hthetaLastOne + +private theorem helper_hgammaCutoff_1047.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + TreeSequenceInitialSegment Bshort T → + TreeSequenceInitialSegment Bshort B → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + ∀ (beta : Fin k), + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G rho v = MissingColors G phi v) → + (↑(HierarchyFirstMissingPosition rho T D.theta) : ℕ) ≤ B.length → + ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + beta ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c → + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hElementary hnotA Bshort hshortT + hshortB firstWitness missingSubset firstPreserved sameLast beta hcutoff POne rho COne' HOne + qOne hmissingOne' hthetaBound c hc hpair + have hcOld : c ∈ HierarchyStoredColorsAt H q := + Finset.subset_of_eq (sameLast POne).1.symm hc + have hpairOld : beta ∈ C.good.gamma q c ∨ D.theta ∈ C.good.gamma q c := + ((sameLast POne).2 c hcOld).symm ▸ hpair + rcases hpairOld with hb | ht + · rcases hcutoff c hcOld hb with he | hm + · exact he.symm ▸ hthetaBound + · have hmB : c ∈ TreeMissingColors phi B := missingSubset (X := Bshort) (Y := B) phi hshortB hm + exact (le_of_eq (congrArg Fin.val + (firstPreserved phi rho c hElementary hmissingOne' hmB))).trans + ((firstWitness phi Bshort hshortT c hm).2.trans hshortB.1) + · exact False.elim (hnotA (c := D.theta) D.thetaMissingPenultimate + ((GoodHierarchyReservedDisjoint C.good q).1 c hcOld ht)) + +private theorem helper_hfixedPrefix_1144.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment A T → + ∀ (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → (↑t : ℕ) < B.length → muTwo (T.edge t) = rho (T.edge t)) → + (∀ (t : Fin A.length), muTwo (A.edge t) = rho (A.edge t)) → + ∀ (t : Fin T.length), + (↑t : ℕ) < B.length → + muTwo (T.edge t) = rho (T.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT beta z POne rho muTwo + hfixedTailTwo hfixedCore t ht + by_cases ha : t.val < A.length + · let ta : Fin A.length := ⟨t.val, ha⟩ + have he : Fin.castLE hAT.1 ta = t := Fin.ext rfl + rw [← he, hAT.2.2 ta] + exact hfixedCore ta + · exact hfixedTailTwo t (Nat.le_of_not_gt ha) ht + +private theorem helper_transportRoute_1153.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + TreeSequenceInitialSegment B T → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + ∀ (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho beta D.theta z) w = + MissingColors G rho w) → + beta ∈ TreeMissingColors phi A → + (∀ (t : Fin T.length), (↑t : ℕ) < B.length → muTwo (T.edge t) = rho (T.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence rho S B → + TashkinovAugmentationSequence muTwo S B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBT commonPrefix beta z + POne rho muTwo hmissingTwo hm hfixedPrefix S hs + clear * - G T B rho muTwo hBT hfixedPrefix hmissingTwo commonPrefix hs + unfold TashkinovAugmentationSequence at hs ⊢ + induction hs using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head X Y hstep htail ih => + have hYB := TashkinovAugmentationSequenceInitialSegment rho Y B htail + obtain ⟨hlen, hXY, c, hedge, hm⟩ := hstep + have hXB : TreeSequenceInitialSegment X B := + ⟨hXY.1.trans hYB.1, + fun i => (hYB.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i), + fun i => (hYB.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i)⟩ + refine Relation.ReflTransGen.head ⟨hlen, hXY, c, ?_, ?_⟩ ih + · let tY : Fin Y.length := Fin.cast hlen.symm (Fin.last X.length) + let tB : Fin B.length := Fin.castLE hYB.1 tY + have hf := hfixedPrefix (Fin.castLE hBT.1 tB) tB.isLt + rw [hBT.2.2 tB, hYB.2.2 tY] at hf + exact hf.trans hedge + · obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hm + exact Finset.mem_biUnion.mpr ⟨v, hv, + (hmissingTwo v (TreeSequenceInitialSegmentVertexSetSubset hXB hv)).symm ▸ hvc⟩ + +private theorem helper_hrouteTwo_1176.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + ∀ (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let _ : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence rho S B → TashkinovAugmentationSequence muTwo S B) → + ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence muTwo + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) B ∨ + (ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.SE ∨ + ettOne.series.data.kind (Fin.last ettOne.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ettOne.series.data.connectingEdges (Fin.last ettOne.rounds) = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence muTwo seed B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT commonPrefix + hcoreLength beta z POne rho ettOne baseOne' muTwo transportRoute + rcases P2813_T1_TerminalRoute G k e0 POne.corresponding.replacementInput T rho ettOne with + ⟨hp, hseq⟩ | ⟨hp, f, seed, hedges, hseed, _, _, hseq⟩ + · have hTnB := commonPrefix ettOne.abovePenultimate hBT (by + have hs := ettOne.strictAbovePenultimate + clear * - hs hBlen + omega) + exact Or.inl ⟨hp, transportRoute _ (TashkinovAugmentationSequenceRestrict rho _ B T + hseq hTnB hBT)⟩ + · have hseedT := TashkinovAugmentationSequenceInitialSegment rho seed T hseq + have hTnCore : (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc).length ≤ + baseOne'.core.length := by + have hnp : ettOne.series.data.kind (Fin.last ettOne.rounds) ≠ + some TashkinovExtensionKind.PE := by + intro he + rcases hp with he' | he' <;> rw [he'] at he <;> cases he + rw [baseOne'.nonparallel hnp] + have hcLen : baseOne'.core.length ≤ A.length := by + rw [← POne.sameGood.1.1] + exact hcoreLength + have hsLen : seed.length ≤ B.length := by + have hl := hseed.1 + change seed.length = (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc).length + 1 + at hl + clear * - hl hTnCore hcLen htail hBlen + omega + have hseedB := commonPrefix hseedT hBT hsLen + exact Or.inr ⟨hp, f, seed, hedges, hseed, + transportRoute seed (TashkinovAugmentationSequenceRestrict rho seed B T hseq hseedB hBT)⟩ + +private theorem helper_branch_1228.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment A T → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + ∀ beta ∉ HierarchyStoredColorsAt H q, + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let _ : HierarchyBase POne.corresponding.replacementETT POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let _ : + HierarchyMinimumCounterexampleContext G k e0 POne.corresponding.replacementInput T + POne.coloring POne.corresponding.replacementETT POne.replacementBase + POne.counterexample := + POne.minimumContext; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + beta ∉ TreeMissingColors phi A → + ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), + MaximumProperty corrTwo.replacementETT ∧ + ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : + TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), + SameGoodHierarchy COne'.good goodTwo := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT sameStar samePrefix sameLast + beta hbetaStored houtside hbetaTheta ib horder firstAfter z POne rho ettOne baseOne' COne' + ctxOne hElementaryOne hmissingA hgammaWitnessOne' hfirstGammaOne hfirstThetaOne + hgammaUnusedOne hmissingPairOne muTwo hm + have hnotAOne : beta ∉ TreeMissingColors rho A := by rw [hmissingA]; exact hm + have ha := firstAfter rho beta (by rw [hfirstGammaOne]; exact hgammaWitnessOne') hnotAOne + rw [hfirstGammaOne] at ha + exact (StableChangeCaseThree G k e0 POne.corresponding.replacementInput T rho ettOne + baseOne' COne' ctxOne.proper ctxOne.oneEdgeUncolored ctxOne.lowerRung ctxOne.fewerDividers + ctxOne.lexicographicMinimality + (by + change ColoredVertexSetElementary G rho (TreeSequenceVertexSet + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1))) + rw [samePrefix POne] + exact hElementaryOne) + ctxOne.largeMissingSet beta D.theta hbetaTheta + (by + change beta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) ∧ + D.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) + rw [samePrefix POne] + exact hmissingPairOne) + z muTwo rfl + (by + rw [sameStar POne, hfirstGammaOne] + intro u hu + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hu + exact ⟨Fin.castLE (Nat.succ_le_succ hAT.1) i, ib, hAT.2.1 i, rfl, + lt_of_le_of_lt (Nat.le_of_lt_succ i.isLt) ha⟩) + (by rw [hfirstGammaOne, hfirstThetaOne]; exact horder) + (by rw [← (sameLast POne).1]; exact ⟨hbetaStored, houtside hm⟩) + (by + rw [hfirstGammaOne] + intro hc + obtain ⟨t, ht, _, he⟩ := (Finset.mem_filter.mp hc).2 + exact hgammaUnusedOne t (by clear * - ht ha; omega) he)).2.2.2.2 + +private theorem helper_hlastComponent_1263.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) → + ∀ (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + rho (T.edge D.lastEdgeIndex) = some D.theta → + Sum.inr (T.edge D.lastEdgeIndex) ∈ TwoColorComponent G rho beta D.theta z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hterminalIncident beta z POne rho + hthetaLastOne + have hadj : (TwoColorIncidenceGraph G rho beta D.theta).Adj + (Sum.inr (T.edge D.lastEdgeIndex)) z := by + exact ⟨hterminalIncident, Or.inr hthetaLastOne⟩ + change (TwoColorIncidenceGraph G rho beta D.theta).connectedComponentMk + (Sum.inr (T.edge D.lastEdgeIndex)) = _ + exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + +private theorem helper_branch_1360.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (2 : ℕ) ≤ T.length - A.length → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + HierarchyFirstMissingPosition phi T D.theta = D.penultimateVertexIndex → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + False) → + D.theta ∈ HierarchyStoredColorsAt H q → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail hApositive hAzero hAT + hfirstTheta Bshort hshortLen missingSubset reduction hthetaStored + obtain ⟨epsOne, epsTwo, heps, hpair⟩ := Finset.card_eq_two.mp + (C.good.twoColors q D.theta hthetaStored) + have hgammaPair : epsOne ∈ C.good.gamma q D.theta := by + rw [hpair] + exact Finset.mem_insert_self _ _ + have hgammaA : epsOne ∈ TreeMissingColors phi A := + (GoodHierarchyReservedDisjoint C.good q).1 D.theta hthetaStored hgammaPair + have hgammaTheta : epsOne ≠ D.theta := by + intro he + exact (Finset.mem_sdiff.mp hthetaStored).2 (he ▸ hgammaA) + have hgammaUnused : ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some epsOne := by + intro t ht he + by_cases hlast : t = D.lastEdgeIndex + · rw [hlast, D.thetaOnLastEdge] at he + exact hgammaTheta (Option.some.inj he).symm + · have hav := (Finset.mem_sdiff.mp + (C.good.avoidance q D.theta hthetaStored hgammaPair)).2 + apply hav + unfold HierarchySegmentColors + simp only + have hend : H.stage q.succ = T := by + convert H.terminalStage using 1 + congr 1 + rw [hend, hfirstTheta] + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, t, ht, ?_, he⟩ + have hp := D.penultimateVertexPosition + have hl := D.lastEdgePosition + have hvne : t.val ≠ D.lastEdgeIndex.val := fun he => hlast (Fin.ext he) + have hb := t.isLt + omega + have hAS : TreeSequenceInitialSegment A Bshort := + ⟨by omega, hAT.2.1, hAT.2.2⟩ + apply reduction epsOne + · exact missingSubset (X := A) (Y := Bshort) phi hAS hgammaA + · exact hgammaUnused + · intro he + exact Finset.disjoint_left.mp (GoodHierarchyReservedDisjoint C.good q).2 + (Finset.mem_biUnion.mpr ⟨D.theta, hthetaStored, hgammaPair⟩) he + · intro hz _ + have hi : q = 0 := Fin.ext (by simpa only [q, Fin.val_last, Fin.val_zero] using hz) + have hm := (Finset.mem_sdiff.mp (C.good.avoidance q D.theta hthetaStored hgammaPair)).1 + rw [hi] at hm + exact hm + · intro hn + exact False.elim (hn hgammaA) + · intro eta heta hb + left + by_contra he + exact Finset.disjoint_left.mp + (C.good.disjointPairs q eta D.theta heta hthetaStored he) hb hgammaPair + +private theorem helper_hfinalCard_1448.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ (hshortLen : Bshort.length + (2 : ℕ) = T.length), + let previousEdge : Fin T.length := + (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let finalColors : Finset (Fin k) := + ({c : Fin k | phi (T.edge previousEdge) = some c} : Finset (Fin k)) ∪ + ({c : Fin k | phi (T.edge D.lastEdgeIndex) = some c} : Finset (Fin k)); + (∀ (f : E), ({c : Fin k | phi f = some c} : Finset (Fin k)).card ≤ (1 : ℕ)) → + finalColors.card ≤ (2 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D Bshort hshortLen previousEdge finalColors + singleColorCard + have hu := Finset.card_union_le + (Finset.univ.filter fun c => phi (T.edge previousEdge) = some c) + (Finset.univ.filter fun c => phi (T.edge D.lastEdgeIndex) = some c) + have hp := singleColorCard (T.edge previousEdge) + have hl := singleColorCard (T.edge D.lastEdgeIndex) + dsimp [finalColors] + omega + +private theorem helper_unused_1456.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ (hshortLen : Bshort.length + (2 : ℕ) = T.length), + let prefixUsed : Finset (Fin k) := + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < A.length + (HierarchyFullTailLength C - (2 : ℕ)) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)); + let previousEdge : Fin T.length := + (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let finalColors : Finset (Fin k) := + ({c : Fin k | phi (T.edge previousEdge) = some c} : Finset (Fin k)) ∪ + ({c : Fin k | phi (T.edge D.lastEdgeIndex) = some c} : Finset (Fin k)); + ∀ {c : Fin k}, + c ∉ prefixUsed → + c ∉ finalColors → + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A Bshort hshortLen prefixUsed + previousEdge finalColors c hp hf t ht he + by_cases hb : t.val < A.length + (HierarchyFullTailLength C - 2) + · exact hp (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, ht, hb, he⟩) + · have hlast := D.lastEdgePosition + have htlt := t.isLt + have hpositions : t = previousEdge ∨ t = D.lastEdgeIndex := by + by_cases hprev : t.val = T.length - 2 + · exact Or.inl (Fin.ext hprev) + · right + apply Fin.ext + have hell : HierarchyFullTailLength C = T.length - A.length := rfl + rw [hell] at hb + omega + apply hf + rcases hpositions with rfl | rfl + · exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, he⟩) + · exact Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, he⟩) + +private theorem helper_segmentTrans_1475.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z := by + classical + intro V E G e0 X Y Z hXY hYZ + refine ⟨le_trans hXY.1 hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +private theorem helper_forward_1483.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ (_ : Bshort.length + (2 : ℕ) = T.length), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H Bshort hshortLen segmentTrans a d + induction d with + | zero => intro hb; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ d ih => + intro hb + exact segmentTrans (ih (by omega)) + (by + convert H.nested ⟨a + d, by omega⟩ using 1 <;> + congr 1 ) + +private theorem helper_coreStar_1495.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ (_ : Bshort.length + (2 : ℕ) = T.length), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + (∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H Bshort hshortLen segmentTrans forward j + refine Fin.cases ?_ (fun i => ?_) j + · exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact segmentTrans H.coreInsideFirst + (by + change TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) (H.stage i.succ.castSucc) + convert forward 1 i.val (by omega) using 1; + congr 1; apply Fin.ext; simp; omega) + +private theorem helper_starA_1505.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ (_ : Bshort.length + (2 : ℕ) = T.length), + (∀ (a d : ℕ) (hb : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j)) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hApositive Bshort hshortLen forward + coreStar j + obtain rfl | ⟨i, rfl⟩ := Fin.eq_zero_or_eq_succ j + · exact coreStar q + · have hpos : 0 < H.dividerCount := by have hi := i.isLt; omega + rw [hApositive hpos] + convert forward (i.val + 1) (H.dividerCount - (i.val + 1)) (by omega) using 1 + · rfl + · congr 1 + apply Fin.ext + change H.dividerCount = i.val + 1 + (H.dividerCount - (i.val + 1)) + have hi := i.isLt + omega + +private theorem helper_hTnCore_1521.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + TreeSequenceInitialSegment Tn base.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base n Tn + by_cases hpe : ett.series.data.kind n = some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨u⟩⟩ := base.parallel hpe + exact u.leftSegment + · rw [base.nonparallel hpe] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + +private theorem helper_gammaExtra_1527.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment A B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let extra : Finset (Fin k) := + (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ + MissingColors G phi v; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j)) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + TreeSequenceInitialSegment base.core B → + TreeSequenceInitialSegment Tn base.core → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, + ∀ c ∈ C.good.gamma j eta, + c ∉ extra := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A B hAB hElementary n Tn extra segmentTrans + coreStar starA hcoreB hTnCore + as_aux_lemma => + intro j + induction j using Fin.induction with + | zero => + intro eta heta c hc he + have hm := (Finset.mem_sdiff.mp (C.good.avoidance 0 eta heta hc)).1 + change c ∈ TreeMissingColors phi Tn at hm + rcases Finset.mem_biUnion.mp hm with ⟨u, hu, huc⟩ + rcases Finset.mem_biUnion.mp he with ⟨v, hv, hvc⟩ + have huB := TreeSequenceInitialSegmentVertexSetSubset + (segmentTrans hTnCore hcoreB) hu + have hvB := TreeSequenceInitialSegmentVertexSetSubset hcoreB + (Finset.mem_sdiff.mp hv).1 + have huv : u ≠ v := by + intro h + exact (Finset.mem_sdiff.mp hv).2 (h ▸ hu) + exact Finset.disjoint_left.mp (hElementary huB hvB huv) huc hvc + | succ i ih => + intro eta heta c hc he + obtain ⟨refresh, hr, _⟩ := C.good.uniqueRefresh i + by_cases hsame : eta = refresh + · subst eta + have hm := hr.2.1 hc + rcases Finset.mem_biUnion.mp hm with ⟨u, hu, huc⟩ + rcases Finset.mem_biUnion.mp he with ⟨v, hv, hvc⟩ + have huB := TreeSequenceInitialSegmentVertexSetSubset + (segmentTrans (starA i.succ) hAB) (Finset.mem_sdiff.mp hu).1 + have hvB := TreeSequenceInitialSegmentVertexSetSubset hcoreB + (Finset.mem_sdiff.mp hv).1 + have huv : u ≠ v := by + intro h + apply (Finset.mem_sdiff.mp hu).2 + rw [h] + exact TreeSequenceInitialSegmentVertexSetSubset (coreStar i.castSucc) + (Finset.mem_sdiff.mp hv).1 + exact Finset.disjoint_left.mp (hElementary huB hvB huv) huc hvc + · rw [hr.2.2 eta heta hsame] at hc + exact ih eta (HierarchyStoredColorsAntitone H i heta) c hc he + +private theorem helper_hAshort_1568.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (2 : ℕ) ≤ T.length - A.length → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let stored : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := stored.biUnion (C.good.gamma q); + let extra : Finset (Fin k) := + (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ + MissingColors G phi v; + let prefixUsed : Finset (Fin k) := + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < A.length + (HierarchyFullTailLength C - (2 : ℕ)) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)); + let available : Finset (Fin k) := (TreeMissingColors phi Bshort \ extra) \ prefixUsed; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ available.card ∧ + ((available \ (Gamma ∪ stored)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), + Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), + eta h ∈ stored ∧ + eta h ∈ TreeMissingColors phi Bshort ∧ + Disjoint (C.good.gamma q (eta h) ∪ ({eta h} : Finset (Fin k))) + prefixUsed) → + TreeSequenceInitialSegment A Bshort := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail hApositive hAzero hAT Bshort + hshortLen n Tn stored Gamma extra prefixUsed available hnine + refine ⟨by omega, ?_, ?_⟩ + · intro i + exact hAT.2.1 i + · intro i + exact hAT.2.2 i + +private theorem helper_hchoice_1574.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ (hshortLen : Bshort.length + (2 : ℕ) = T.length), + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let stored : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := stored.biUnion (C.good.gamma q); + let extra : Finset (Fin k) := + (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion fun (v : V) ↦ + MissingColors G phi v; + let prefixUsed : Finset (Fin k) := + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < A.length + (HierarchyFullTailLength C - (2 : ℕ)) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)); + let available : Finset (Fin k) := (TreeMissingColors phi Bshort \ extra) \ prefixUsed; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ available.card ∧ + ((available \ (Gamma ∪ stored)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), + Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), + eta h ∈ stored ∧ + eta h ∈ TreeMissingColors phi Bshort ∧ + Disjoint (C.good.gamma q (eta h) ∪ ({eta h} : Finset (Fin k))) + prefixUsed) → + let previousEdge : Fin T.length := + (⟨T.length - (2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let finalColors : Finset (Fin k) := + ({c : Fin k | phi (T.edge previousEdge) = some c} : Finset (Fin k)) ∪ + ({c : Fin k | phi (T.edge D.lastEdgeIndex) = some c} : Finset (Fin k)); + finalColors.card ≤ (2 : ℕ) → + (∀ {c : Fin k}, + c ∉ prefixUsed → + c ∉ finalColors → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some c) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, ∀ c ∈ C.good.gamma j eta, c ∉ extra) → + TreeSequenceInitialSegment A Bshort → + ∃ beta ∈ TreeMissingColors phi Bshort, + beta ∉ extra ∧ + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) ∧ + beta ∉ stored ∧ + (beta ∉ Gamma ∨ + ∃ eta ∈ stored, eta ∈ TreeMissingColors phi Bshort ∧ beta ∈ C.good.gamma q eta) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A Bshort hshortLen missingSubset n Tn + stored Gamma extra prefixUsed available hnine previousEdge finalColors hfinalCard unused + gammaExtra hAshort + clear_value finalColors + clear * - G phi T A Bshort C H q stored Gamma extra available prefixUsed + finalColors hnine hfinalCard unused gammaExtra hAshort missingSubset + by_cases hsmall : (available \ (Gamma ∪ stored)).card ≤ 4 + · obtain ⟨eta, hinj, heta⟩ := hnine.2 hsmall + let Q := fun h : Fin 7 => C.good.gamma q (eta h) ∪ {eta h} + have hGD : Disjoint Gamma stored := (GoodHierarchyReservedDisjoint C.good q).2 + have hQdisjoint : ∀ a b : Fin 7, a ≠ b → Disjoint (Q a) (Q b) := by + intro a b hab + have hne : eta a ≠ eta b := fun he => hab (hinj he) + have hp := C.good.disjointPairs q (eta a) (eta b) + (heta a).1 (heta b).1 hne + rw [Finset.disjoint_left] + intro c hca hcb + rcases Finset.mem_union.mp hca with hca | hca <;> + rcases Finset.mem_union.mp hcb with hcb | hcb + · exact Finset.disjoint_left.mp hp hca hcb + · apply Finset.disjoint_left.mp hGD + (Finset.mem_biUnion.mpr ⟨eta a, (heta a).1, hca⟩) + simpa only [Finset.mem_singleton.mp hcb] using (heta b).1 + · apply Finset.disjoint_left.mp hGD + (Finset.mem_biUnion.mpr ⟨eta b, (heta b).1, hcb⟩) + simpa only [Finset.mem_singleton.mp hca] using (heta a).1 + · exact hne ((Finset.mem_singleton.mp hca).symm.trans + (Finset.mem_singleton.mp hcb)) + let bad := (Finset.univ : Finset (Fin 7)).filter fun h => + ∃ c : Fin k, c ∈ Q h ∧ c ∈ finalColors + have badWitness (h : bad) : ∃ c : Fin k, c ∈ Q h.val ∧ c ∈ finalColors := + (Finset.mem_filter.mp h.property).2 + let f : bad → finalColors := fun h => + ⟨Classical.choose (badWitness h), (Classical.choose_spec (badWitness h)).2⟩ + have hf (h : bad) : (f h).val ∈ Q h.val := + (Classical.choose_spec (badWitness h)).1 + have hfinj : Function.Injective f := by + intro a b hab + apply Subtype.ext + by_contra hne + have hfb := hf b + rw [← congrArg Subtype.val hab] at hfb + exact Finset.disjoint_left.mp (hQdisjoint a.val b.val hne) (hf a) hfb + have hbadCard : bad.card ≤ 2 := + (Finset.card_le_card_of_injective hfinj).trans hfinalCard + have hnot : ¬ (Finset.univ : Finset (Fin 7)) ⊆ bad := by + intro hs + have hc := Finset.card_le_card hs + simp only [Finset.card_univ, Fintype.card_fin] at hc + clear * - hc hbadCard + omega + obtain ⟨h, _, hh⟩ := Finset.not_subset.mp hnot + have hQFinal : Disjoint (Q h) finalColors := by + rw [Finset.disjoint_left] + intro c hc hf + exact hh (Finset.mem_filter.mpr ⟨Finset.mem_univ _, c, hc, hf⟩) + obtain ⟨b1, b2, _, hp⟩ := Finset.card_eq_two.mp + (C.good.twoColors q (eta h) (heta h).1) + have hb : b1 ∈ C.good.gamma q (eta h) := by rw [hp]; simp + have hbGamma : b1 ∈ Gamma := Finset.mem_biUnion.mpr ⟨eta h, (heta h).1, hb⟩ + have hbQ : b1 ∈ Q h := Finset.mem_union_left _ hb + have hbPrefix : b1 ∉ prefixUsed := fun hu => + Finset.disjoint_left.mp (heta h).2.2 hbQ hu + have hbFinal : b1 ∉ finalColors := fun hu => Finset.disjoint_left.mp hQFinal hbQ hu + have hbA := (GoodHierarchyReservedDisjoint C.good q).1 (eta h) (heta h).1 hb + have hbShort : b1 ∈ TreeMissingColors phi Bshort := missingSubset (X := A) (Y := Bshort) phi + hAshort hbA + exact ⟨b1, hbShort, gammaExtra q (eta h) (heta h).1 b1 hb, + unused hbPrefix hbFinal, fun hs => Finset.disjoint_left.mp hGD hbGamma hs, + Or.inr ⟨eta h, (heta h).1, (heta h).2.1, hb⟩⟩ + · have hnot : ¬ available \ (Gamma ∪ stored) ⊆ finalColors := by + intro hs + have hc := Finset.card_le_card hs + clear * - hc hsmall hfinalCard + omega + obtain ⟨beta, hb, hf⟩ := Finset.not_subset.mp hnot + rcases Finset.mem_sdiff.mp hb with ⟨hav, houtside⟩ + rcases Finset.mem_sdiff.mp hav with ⟨hmissExtra, hprefix⟩ + rcases Finset.mem_sdiff.mp hmissExtra with ⟨hmiss, hextra⟩ + exact ⟨beta, hmiss, hextra, unused hprefix hf, + fun hs => houtside (Finset.mem_union_right _ hs), + Or.inl (fun hg => houtside (Finset.mem_union_left _ hg))⟩ + +private theorem helper_hseventeenPositive_1664.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ (_ : Bshort.length + (2 : ℕ) = T.length), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let stored : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ beta ∉ stored, + (0 : ℕ) < H.dividerCount → + beta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∨ + beta ∉ Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hApositive Bshort hshortLen n Dn + stored beta hbetaStored hq + by_cases hd : beta ∈ Dn + · left + rw [← hApositive hq] + by_contra hm + exact hbetaStored (Finset.mem_sdiff.mpr ⟨hd, hm⟩) + · exact Or.inr hd + +private theorem helper_hseventeenZero_1672.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let stored : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ beta ∉ stored, + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → beta ∈ TreeMissingColors phi Tn) → + H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi Tn ∨ beta ∉ Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n Tn Dn stored beta hbetaStored hzeroBeta hq + by_cases hd : beta ∈ Dn + · left + have hm : beta ∈ TreeMissingColors phi A := by + by_contra hm + exact hbetaStored (Finset.mem_sdiff.mpr ⟨hd, hm⟩) + exact hzeroBeta hq hm + · exact Or.inr hd + +private theorem helper_branch_1685.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + let stored : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := stored.biUnion (C.good.gamma q); + ∀ (beta : Fin k), + (beta ∉ Gamma ∨ + ∃ eta ∈ stored, eta ∈ TreeMissingColors phi Bshort ∧ beta ∈ C.good.gamma q eta) → + ∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q Bshort stored Gamma beta hbetaGamma + eta heta hb + rcases hbetaGamma with hn | ⟨eta', heta', hm, hb'⟩ + · exact False.elim (hn (Finset.mem_biUnion.mpr ⟨eta, heta, hb⟩)) + · right + have he : eta = eta' := by + by_contra hne + exact Finset.disjoint_left.mp (C.good.disjointPairs q eta eta' heta heta' hne) hb hb' + exact he ▸ hm + +private theorem helper_branch_3242.{u_1, u_2} : + helperBranch3242Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB + hBterminal hyB hElementary hnotA sameStar samePrefix sameTn sameLast commonPrefix + hcoreLength predecessorIncident seedStable weakEdges beta hbetaTheta ib hibB z muOne + hfixedOne POne hPOne rho ettOne baseOne' COne' ctxOne HOne qOne hElementaryOne hthetaPenOne + hgammaWitnessOne' hfirstGammaOne hgammaUnusedOne hcaseOne hmissingPairOne hdisjointTwo + muTwo hpathTwo hmissingTwo hstoredTwo hsuffix hgammaCutoff hm + have hstableTwo := StableChangeCasesOneTwo G k e0 POne.corresponding.replacementInput T rho + ettOne baseOne' COne' ctxOne.proper ctxOne.oneEdgeUncolored ctxOne.lowerRung + ctxOne.fewerDividers ctxOne.lexicographicMinimality + (by + change ColoredVertexSetElementary G rho (TreeSequenceVertexSet + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1))) + rw [samePrefix POne] + exact hElementaryOne) + ctxOne.largeMissingSet beta D.theta hbetaTheta + (by + change beta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) ∧ + D.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) + rw [samePrefix POne] + exact hmissingPairOne) + z hpathTwo muTwo rfl + (by dsimp only; rcases hcaseOne hm with hpos | ⟨hz, hb⟩ + · exact Or.inl hpos + · exact Or.inr ⟨hz, Or.inl hb⟩) + (by dsimp only; rw [hfirstGammaOne]; exact hdisjointTwo) + have hthetaExclusion := HierarchyTailMissingColorExclusion G k e0 input T phi + ett base H hElementary (HierarchyFullTailLength C - 1) + (by change 1 ≤ T.length - A.length - 1; clear * - htail; omega) + (by change T.length - A.length - 1 < T.length - A.length; clear * - htail; omega) + D.theta (by + change D.theta ∈ MissingColors G phi (B.vertex (Fin.last B.length)) + rw [hBterminal] + exact D.thetaMissingPenultimate) + have hfixedTailTwo : ∀ t : Fin T.length, A.length ≤ t.val → t.val < B.length → + muTwo (T.edge t) = rho (T.edge t) := by + intro t ht hb + have hng := hgammaUnusedOne t ht + by_cases htheta : rho (T.edge t) = some D.theta + · let tB : Fin B.length := ⟨t.val, hb⟩ + have hcast : Fin.castLE hBT.1 tB = t := Fin.ext rfl + have heOld : phi (T.edge t) = some D.theta := by + rw [show rho = muOne from hPOne, hfixedOne t ht] at htheta + exact htheta + have heB : phi (B.edge tB) = some D.theta := by + rw [← hBT.2.2 tB, hcast] + exact heOld + obtain ⟨hz, hcore, hpos, f, _, _, _, _, _, hs⟩ := + hthetaExclusion tB ht (by + change tB.val < A.length + (T.length - A.length - 1) + have hv := tB.isLt + clear * - hv htail hBlen + change tB.val < B.length at hv + omega) heB + have hzOne : HOne.dividerCount = 0 := POne.sameGood.1.2.1.symm.trans hz + have htn : ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc = A := + (sameTn POne).trans ((hAzero hz).trans hcore).symm + have hinc : TreeIncidentEdge + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) (T.edge t) := by + rw [htn] + exact predecessorIncident A hAT t hpos + have hsOld : D.theta ∈ HierarchyStoredColorsAt H q := + Finset.mem_sdiff.mpr ⟨hs, hnotA (c := D.theta) D.thetaMissingPenultimate⟩ + have hsOne : D.theta ∈ HierarchyStoredColorsAt HOne qOne := + (sameLast POne).1 ▸ hsOld + exact (seedStable rho muTwo ettOne baseOne' HOne hstableTwo.1 hzOne).1 _ hinc + ⟨D.theta, Finset.mem_union_right _ (Finset.mem_sdiff.mp hsOne).1, htheta⟩ + · simp only [muTwo, TwoColorComponentSwap, hng, htheta, ite_false, ite_self] + have hfixedCore := weakEdges rho muTwo ettOne baseOne' HOne hstableTwo.1 + ctxOne.oneEdgeUncolored hstableTwo.2.1.2.1 + change ∀ t : Fin (HierarchyStarredStage POne.counterexample.hierarchy + (Fin.last POne.counterexample.hierarchy.dividerCount)).length, + muTwo ((HierarchyStarredStage POne.counterexample.hierarchy + (Fin.last POne.counterexample.hierarchy.dividerCount)).edge t) = + rho ((HierarchyStarredStage POne.counterexample.hierarchy + (Fin.last POne.counterexample.hierarchy.dividerCount)).edge t) at hfixedCore + rw [sameStar POne] at hfixedCore + have hfixedPrefix : ∀ t : Fin T.length, t.val < B.length → + muTwo (T.edge t) = rho (T.edge t) := by + exact @helper_hfixedPrefix_1144 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) + (@beta) (@POne) (@hfixedTailTwo) (@hfixedCore) + have transportRoute (S : TreeSequence G e0) + (hs : TashkinovAugmentationSequence rho S B) : + TashkinovAugmentationSequence muTwo S B := by + exact @helper_transportRoute_1153 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBT) (@commonPrefix) (@beta) (@POne) (@hmissingTwo) (@hm) (@hfixedPrefix) (@S) + (@hs) + have hrouteTwo : + (ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence muTwo + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) B) ∨ + ((ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.SE ∨ + ettOne.series.data.kind (Fin.last ettOne.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, ettOne.series.data.connectingEdges (Fin.last ettOne.rounds) = {f} ∧ + TreeSequenceAdjoinEdge (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) f + seed ∧ + TashkinovAugmentationSequence muTwo seed B) := by + exact @helper_hrouteTwo_1176 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@commonPrefix) (@hcoreLength) (@beta) (@POne) (@transportRoute) + exact (StableChangeCasesOneTwoSplitTail G k e0 POne.corresponding.replacementInput T rho + ettOne baseOne' COne' ctxOne beta D.theta hbetaTheta + (by rw [samePrefix POne]; exact hmissingPairOne) + z hpathTwo muTwo rfl + (by dsimp only; rcases hcaseOne hm with hpos | ⟨hz, hb⟩ + · exact Or.inl hpos + · exact Or.inr ⟨hz, Or.inl hb⟩) + (by dsimp only; rw [hfirstGammaOne]; exact hdisjointTwo) + B (by dsimp only; rw [sameStar POne]; exact hAB) + (by dsimp only; rw [sameStar POne]; clear * - htail hBlen; omega) + (by rw [samePrefix POne]; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩) + (by dsimp only; intro t _ ht; exact hfixedPrefix t ht) + hrouteTwo hsuffix + ⟨Finset.mem_biUnion.mpr ⟨_, hibB, (hmissingTwo _ hibB).symm ▸ hgammaWitnessOne'⟩, + Finset.mem_biUnion.mpr ⟨_, hyB, (hmissingTwo _ hyB).symm ▸ hthetaPenOne⟩⟩ + (by rw [samePrefix POne]; exact hmissingTwo) hstoredTwo hgammaCutoff).2.2 + +private theorem helper_branch_3441.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + Bshort.length + (2 : ℕ) = T.length → + (∀ (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y) → + (∀ (rho : PartialEdgeColoring E k) (X Y : TreeSequence G e0), + ∀ + c ∉ + (TreeSequenceVertexSet X \ TreeSequenceVertexSet Y).biUnion fun (v : V) ↦ + MissingColors G rho v, + c ∈ TreeMissingColors rho X → c ∈ TreeMissingColors rho Y) → + (∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + False) → + D.theta ∉ HierarchyStoredColorsAt H q → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hApositive hAzero hAT hAB + hElementary hnotA Bshort hshortLen missingSubset missingWithoutExtra reduction hthetaStored + have hthetaNotRaw : + D.theta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + intro hc + exact hthetaStored + (Finset.mem_sdiff.mpr ⟨hc, hnotA (c := D.theta) D.thetaMissingPenultimate⟩) + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let stored := HierarchyStoredColorsAt H q + let Gamma := stored.biUnion (C.good.gamma q) + let extra := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion + (fun v => MissingColors G phi v) + let prefixUsed : Finset (Fin k) := Finset.univ.filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ + t.val < A.length + (HierarchyFullTailLength C - 2) ∧ + phi (T.edge t) = some c + let available := (TreeMissingColors phi Bshort \ extra) \ prefixUsed + have hnine := NineN G k e0 input T phi ett C.positive base H C.good + hElementary ctx.largeMissingSet (HierarchyFullTailLength C - 2) + (by change T.length - A.length - 2 < T.length - A.length; omega) + change (2 * ett.rounds + 11 ≤ available.card) ∧ + ((available \ (Gamma ∪ stored)).card ≤ 4 → + ∃ eta : Fin 7 → Fin k, Function.Injective eta ∧ + ∀ h : Fin 7, eta h ∈ stored ∧ eta h ∈ TreeMissingColors phi Bshort ∧ + Disjoint (C.good.gamma q (eta h) ∪ {eta h}) prefixUsed) at hnine + have havailable : 2 * ett.rounds + 11 ≤ available.card := hnine.1 + let previousEdge : Fin T.length := ⟨T.length - 2, by omega⟩ + let finalColors : Finset (Fin k) := + (Finset.univ.filter fun c => phi (T.edge previousEdge) = some c) ∪ + (Finset.univ.filter fun c => phi (T.edge D.lastEdgeIndex) = some c) + have singleColorCard (f : E) : + (Finset.univ.filter fun c => phi f = some c).card ≤ 1 := by + apply Finset.card_le_one.mpr + intro a ha b hb + exact Option.some.inj ((Finset.mem_filter.mp ha).2.symm.trans + (Finset.mem_filter.mp hb).2) + have hfinalCard : finalColors.card ≤ 2 := by + exact @helper_hfinalCard_1448 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hshortLen) (@singleColorCard) + have unused {c : Fin k} (hp : c ∉ prefixUsed) (hf : c ∉ finalColors) : + ∀ t : Fin T.length, A.length ≤ t.val → phi (T.edge t) ≠ some c := by + exact @helper_unused_1456 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hshortLen) (@c) + (@hp) (@hf) + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + exact @helper_segmentTrans_1475 (@V) (@E) (@G) (@e0) (@X) (@Y) (@Z) (@hXY) (@hYZ) + have forward : ∀ a d : ℕ, ∀ hb : a + d ≤ H.dividerCount + 1, + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + exact @helper_forward_1483 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hshortLen) + (@segmentTrans) + have coreStar : ∀ j : Fin (H.dividerCount + 1), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j) := by + exact @helper_coreStar_1495 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hshortLen) + (@segmentTrans) (@forward) + have starA : ∀ j : Fin (H.dividerCount + 1), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + exact @helper_starA_1505 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hApositive) + (@hshortLen) (@forward) (@coreStar) + have hcoreB : TreeSequenceInitialSegment base.core B := + segmentTrans (coreStar q) hAB + have hTnCore : TreeSequenceInitialSegment Tn base.core := by + exact @helper_hTnCore_1521 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + have gammaExtra : ∀ j : Fin (H.dividerCount + 1), + ∀ eta ∈ HierarchyStoredColorsAt H j, + ∀ c ∈ C.good.gamma j eta, c ∉ extra := by + exact @helper_gammaExtra_1527 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAB) + (@hElementary) (@segmentTrans) (@coreStar) (@starA) (@hcoreB) (@hTnCore) + have hAshort : TreeSequenceInitialSegment A Bshort := by + exact @helper_hAshort_1568 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hApositive) (@hAzero) (@hAT) (@hshortLen) (@hnine) + have hchoice : ∃ beta : Fin k, + beta ∈ TreeMissingColors phi Bshort ∧ beta ∉ extra ∧ + (∀ t : Fin T.length, A.length ≤ t.val → phi (T.edge t) ≠ some beta) ∧ + beta ∉ stored ∧ + (beta ∉ Gamma ∨ ∃ eta : Fin k, + eta ∈ stored ∧ eta ∈ TreeMissingColors phi Bshort ∧ + beta ∈ C.good.gamma q eta) := by + exact @helper_hchoice_1574 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hshortLen) + (@missingSubset) (@hnine) (@hfinalCard) (@unused) (@gammaExtra) (@hAshort) + obtain ⟨beta, hbetaMissing, hbetaExtra, hbetaUnused, hbetaStored, hbetaGamma⟩ := hchoice + have hzeroBeta (hq : H.dividerCount = 0) (hm : beta ∈ TreeMissingColors phi A) : + beta ∈ TreeMissingColors phi Tn := by + rw [hAzero hq] at hm + exact missingWithoutExtra phi base.core Tn beta hbetaExtra hm + have hseventeenPositive (hq : 0 < H.dividerCount) : + beta ∈ TreeMissingColors phi (H.stage ⟨H.dividerCount, by omega⟩) ∨ beta ∉ Dn := by + exact @helper_hseventeenPositive_1664 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hApositive) (@hshortLen) (@beta) (@hbetaStored) (@hq) + have hseventeenZero (hq : H.dividerCount = 0) : + beta ∈ TreeMissingColors phi Tn ∨ beta ∉ Dn := by + exact @helper_hseventeenZero_1672 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@beta) + (@hbetaStored) (@hzeroBeta) (@hq) + apply reduction beta hbetaMissing hbetaUnused hbetaStored + · exact hzeroBeta + · intro _ + exact hthetaStored + · exact @helper_branch_1685 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@beta) (@hbetaGamma) + +private theorem helper_hsame_3634.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + D.alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + beta ≠ D.alpha → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex → + T.vertex ib ≠ T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (beta ∉ TreeMissingColors phi A → + beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi beta D.alpha (Sum.inl va) = + TwoColorComponent G phi beta D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hfirstAlpha halphaNotRaw Bshort + beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib + hbFirst hibB hby hbt horder hrawBeta hmissing hchange + exact @helper_hsame_747 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hfirstAlpha) + (@halphaNotRaw) (@beta) (@hbetaMissing) (@hbetaUnused) (@hbetaStored) (@hzero) + (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) (@hibB) (@hby) (@hbt) + (@horder) (@hrawBeta) (@hmissing) (@hchange) + +private theorem helper_hsameTwo_3799.{u_1, u_2} : + helperHsameTwo3799Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast + beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib + hbFirst hibB hby hbt horder hrawBeta hmissing hchange hsame z muOne hdisjoint hpath + houtsideBeta houtsideAlpha hmissingOne hfixedOne hstoredOne hcase corrOne hmaxOne baseOne + KOne goodOne hsameOne hbTerminalOne POne hPOne rho ettOne baseOne' COne' HOne qOne + hmissingA hbetaStoredOne hgammaPenOne hgammaTermOne hgammaWitnessOne' hfirstGammaOne + hfirstThetaOne hgammaUnusedOne hcaseOne hmissingPairOne hchangeOne + exact @helper_hsameTwo_964 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnotA) (@sameStar) (@sameLast) (@beta) (@hbetaMissing) (@hbetaUnused) + (@hbetaStored) (@hzero) (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) + (@hibB) (@hby) (@hbt) (@horder) (@hrawBeta) (@hmissing) (@hchange) (@hsame) + (@hdisjoint) (@hpath) (@houtsideBeta) (@houtsideAlpha) (@hmissingOne) (@hfixedOne) + (@hstoredOne) (@hcase) (@corrOne) (@hmaxOne) (@baseOne) (@KOne) (@goodOne) + (@hsameOne) (@hbTerminalOne) (@POne) (@hPOne) (@hmissingA) (@hbetaStoredOne) + (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') (@hfirstGammaOne) + (@hfirstThetaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hchangeOne) + +private theorem helper_branch_3865.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → + (∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma) → + (∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t)) → + ∀ (beta : Fin k), + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + T.vertex ib ∈ TreeSequenceVertexSet B → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta D.alpha z; + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + POne.coloring = muOne → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc)) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + Disjoint + (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib))) → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + TwoColorPathComponent G rho beta D.theta z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho beta D.theta z) w = + MissingColors G rho w) → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c) → + TashkinovAugmentationSequence rho B T → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + beta ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c → + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ B.length) → + beta ∈ TreeMissingColors phi A → + ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), + MaximumProperty corrTwo.replacementETT ∧ + ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : + TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), + SameGoodHierarchy COne'.good goodTwo := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB + hBterminal hyB hElementary hnotA sameStar samePrefix sameTn sameLast commonPrefix + hcoreLength predecessorIncident seedStable weakEdges beta hbetaTheta ib hibB z muOne + hfixedOne POne hPOne rho ettOne COne' HOne qOne hElementaryOne hthetaPenOne + hgammaWitnessOne' hfirstGammaOne hgammaUnusedOne hcaseOne hmissingPairOne hdisjointTwo + muTwo hpathTwo hmissingTwo hstoredTwo hsuffix hgammaCutoff hm + exact @helper_branch_3242 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) + (@hnotA) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) + (@hcoreLength) (@predecessorIncident) (@seedStable) (@weakEdges) (@beta) + (@hbetaTheta) (@hibB) (@hfixedOne) (@POne) (@hPOne) (@hElementaryOne) (@hthetaPenOne) + (@hgammaWitnessOne') (@hfirstGammaOne) (@hgammaUnusedOne) (@hcaseOne) + (@hmissingPairOne) (@hdisjointTwo) (@hpathTwo) (@hmissingTwo) (@hstoredTwo) + (@hsuffix) (@hgammaCutoff) (@hm) + +private theorem helper_branch_3874.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment A T → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + ∀ beta ∉ HierarchyStoredColorsAt H q, + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + beta ∉ TreeMissingColors phi A → + ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), + MaximumProperty corrTwo.replacementETT ∧ + ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : + TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), + SameGoodHierarchy COne'.good goodTwo := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT sameStar samePrefix sameLast + beta hbetaStored houtside hbetaTheta ib horder firstAfter z POne rho ettOne COne' + hElementaryOne hmissingA hgammaWitnessOne' hfirstGammaOne hfirstThetaOne hgammaUnusedOne + hmissingPairOne muTwo hm + exact @helper_branch_1228 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hAT) (@sameStar) (@samePrefix) (@sameLast) (@beta) (@hbetaStored) (@houtside) + (@hbetaTheta) (@horder) (@firstAfter) (@POne) (@hElementaryOne) (@hmissingA) + (@hgammaWitnessOne') (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) + (@hmissingPairOne) (@hm) + +private theorem helper_hsame_4639.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → + D.alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + beta ≠ D.alpha → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex → + T.vertex ib ≠ T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (beta ∉ TreeMissingColors phi A → + beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi beta D.alpha (Sum.inl va) = + TwoColorComponent G phi beta D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hfirstAlpha halphaNotRaw Bshort + beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib + hbFirst hibB hby hbt horder hrawBeta hmissing hchange + exact @helper_hsame_3634 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hfirstAlpha) (@halphaNotRaw) (@beta) (@hbetaMissing) (@hbetaUnused) (@hbetaStored) + (@hzero) (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) (@hibB) (@hby) + (@hbt) (@horder) (@hrawBeta) (@hmissing) (@hchange) + +private theorem helper_hsameTwo_4804.{u_1, u_2} : + helperHsameTwo4804Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast + beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib + hbFirst hibB hby hbt horder hrawBeta hmissing hchange hsame z muOne hdisjoint hpath + houtsideBeta houtsideAlpha hmissingOne hfixedOne hstoredOne hcase corrOne hmaxOne baseOne + KOne goodOne hsameOne hbTerminalOne POne hPOne rho ettOne baseOne' COne' HOne qOne + hmissingA hbetaStoredOne hgammaPenOne hgammaTermOne hgammaWitnessOne' hfirstGammaOne + hfirstThetaOne hgammaUnusedOne hcaseOne hmissingPairOne hchangeOne + exact @helper_hsameTwo_3799 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hnotA) (@sameStar) (@sameLast) (@beta) (@hbetaMissing) (@hbetaUnused) + (@hbetaStored) (@hzero) (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) + (@hibB) (@hby) (@hbt) (@horder) (@hrawBeta) (@hmissing) (@hchange) (@hsame) + (@hdisjoint) (@hpath) (@houtsideBeta) (@houtsideAlpha) (@hmissingOne) (@hfixedOne) + (@hstoredOne) (@hcase) (@corrOne) (@hmaxOne) (@baseOne) (@KOne) (@goodOne) + (@hsameOne) (@hbTerminalOne) (@POne) (@hPOne) (@hmissingA) (@hbetaStoredOne) + (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') (@hfirstGammaOne) + (@hfirstThetaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hchangeOne) + +private theorem helper_branch_4870.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + TreeSequenceInitialSegment B T → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B → + B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → + T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → + c ∉ TreeMissingColors phi A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + (∀ {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + base.core.length ≤ A.length → + (∀ (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → + (∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma) → + (∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t)) → + ∀ (beta : Fin k), + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + T.vertex ib ∈ TreeSequenceVertexSet B → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta D.alpha z; + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + POne.coloring = muOne → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc)) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + Disjoint + (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib))) → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + TwoColorPathComponent G rho beta D.theta z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho beta D.theta z) w = + MissingColors G rho w) → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c) → + TashkinovAugmentationSequence rho B T → + (∀ c ∈ HierarchyStoredColorsAt HOne qOne, + beta ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c → + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ B.length) → + beta ∈ TreeMissingColors phi A → + ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), + MaximumProperty corrTwo.replacementETT ∧ + ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : + TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), + SameGoodHierarchy COne'.good goodTwo := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB + hBterminal hyB hElementary hnotA sameStar samePrefix sameTn sameLast commonPrefix + hcoreLength predecessorIncident seedStable weakEdges beta hbetaTheta ib hibB z muOne + hfixedOne POne hPOne rho ettOne COne' HOne qOne hElementaryOne hthetaPenOne + hgammaWitnessOne' hfirstGammaOne hgammaUnusedOne hcaseOne hmissingPairOne hdisjointTwo + muTwo hpathTwo hmissingTwo hstoredTwo hsuffix hgammaCutoff hm + exact @helper_branch_3865 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) + (@hnotA) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) + (@hcoreLength) (@predecessorIncident) (@seedStable) (@weakEdges) (@beta) + (@hbetaTheta) (@hibB) (@hfixedOne) (@POne) (@hPOne) (@hElementaryOne) (@hthetaPenOne) + (@hgammaWitnessOne') (@hfirstGammaOne) (@hgammaUnusedOne) (@hcaseOne) + (@hmissingPairOne) (@hdisjointTwo) (@hpathTwo) (@hmissingTwo) (@hstoredTwo) + (@hsuffix) (@hgammaCutoff) (@hm) + +private theorem helper_branch_4879.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment A T → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix P.counterexample + (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = + B) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) + eta) → + ∀ beta ∉ HierarchyStoredColorsAt H q, + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + beta ∉ TreeMissingColors phi A → + ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), + MaximumProperty corrTwo.replacementETT ∧ + ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : + TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), + SameGoodHierarchy COne'.good goodTwo := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT sameStar samePrefix sameLast + beta hbetaStored houtside hbetaTheta ib horder firstAfter z POne rho ettOne COne' + hElementaryOne hmissingA hgammaWitnessOne' hfirstGammaOne hfirstThetaOne hgammaUnusedOne + hmissingPairOne muTwo hm + exact @helper_branch_3874 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hAT) (@sameStar) (@samePrefix) (@sameLast) (@beta) (@hbetaStored) (@houtside) + (@hbetaTheta) (@horder) (@firstAfter) (@POne) (@hElementaryOne) (@hmissingA) + (@hgammaWitnessOne') (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) + (@hmissingPairOne) (@hm) + +private noncomputable abbrev helperTailTwo6007.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett + base C ctx) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (2 : ℕ) ≤ T.length - A.length → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi + ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount) = + A) → + (beta : Fin k) → + let z : V ⊕ E := + Sum.inl (T.vertex D.terminalVertexIndex); + (POne : + HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx) → + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := + TwoColorComponentSwap G rho beta D.theta z; + muTwo (T.edge D.lastEdgeIndex) = some beta → + beta ∉ + MissingColors G muTwo + (T.vertex D.penultimateVertexIndex) → + (PTwo : + HierarchyReplacementPresentation G k e0 + input T phi ett base C ctx) → + PTwo.coloring = muTwo → + HierarchySituationTwoTailData G k e0 + PTwo.corresponding.replacementInput T + PTwo.coloring + PTwo.corresponding.replacementETT + PTwo.replacementBase PTwo.counterexample + PTwo.minimumContext := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail sameStar beta z POne rho + muTwo hlastTwo hgammaPenTwo PTwo hPTwo + exact { + tailAtLeastTwo := by + change 2 ≤ T.length - (HierarchyStarredStage PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount)).length + rw [sameStar PTwo] + exact htail + pathNumberFull := by + have hp := D.pathNumberFull + unfold HierarchyPathNumber HierarchyFullTailLength at hp ⊢ + dsimp only at hp ⊢ + rw [sameStar PTwo] + exact hp + lastEdgeIndex := D.lastEdgeIndex + penultimateVertexIndex := D.penultimateVertexIndex + terminalVertexIndex := D.terminalVertexIndex + lastEdgePosition := D.lastEdgePosition + penultimateVertexPosition := D.penultimateVertexPosition + terminalVertexPosition := D.terminalVertexPosition + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate + theta := beta + thetaOnLastEdge := hPTwo.symm ▸ hlastTwo + thetaPresentPenultimate := hPTwo.symm ▸ hgammaPenTwo } + +private theorem helper_branch_6081.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (htail : (2 : ℕ) ≤ T.length - A.length) + (sameStar : + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) + (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + ∀ (hlastTwo : muTwo (T.edge D.lastEdgeIndex) = some beta), + D.theta ∈ MissingColors G muTwo (T.vertex D.terminalVertexIndex) → + D.theta ∈ MissingColors G muTwo (T.vertex D.penultimateVertexIndex) → + ∀ (hgammaPenTwo : beta ∉ MissingColors G muTwo (T.vertex D.penultimateVertexIndex)) + (PTwo : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hPTwo : PTwo.coloring = muTwo), + let _ : + HierarchySituationTwoTailData G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := + helperTailTwo6007 G k e0 input T phi ett base C ctx D htail sameStar beta POne + hlastTwo hgammaPenTwo PTwo hPTwo; + D.theta ∈ + HierarchyStoredColorsAt PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount) → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail sameStar beta z POne rho + muTwo hlastTwo hthetaTermTwo hthetaPenTwo hgammaPenTwo PTwo hPTwo tailTwo hstored + obtain ⟨g1, g2, hne, hpair⟩ := Finset.card_eq_two.mp + (PTwo.counterexample.good.twoColors _ D.theta hstored) + let finalData : HierarchySituationTwoCaseOneData G k e0 + PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := + { toHierarchySituationTwoTailData := tailTwo + alpha := D.theta + gammaOne := g1 + gammaTwo := g2 + alphaMissingPenultimate := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.penultimateVertexIndex) + rw [hPTwo] + exact hthetaPenTwo + alphaMissingTerminal := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.terminalVertexIndex) + rw [hPTwo] + exact hthetaTermTwo + alphaStored := hstored + gammaPair := hpair + gammaDistinct := hne } + exact HierarchySituationTwoSubcaseOneOne G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext finalData + +private theorem helper_branch_6105.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (htail : (2 : ℕ) ≤ T.length - A.length) + (sameStar : + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) + (beta : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; + ∀ (hlastTwo : muTwo (T.edge D.lastEdgeIndex) = some beta), + D.theta ∈ MissingColors G muTwo (T.vertex D.terminalVertexIndex) → + D.theta ∈ MissingColors G muTwo (T.vertex D.penultimateVertexIndex) → + ∀ (hgammaPenTwo : beta ∉ MissingColors G muTwo (T.vertex D.penultimateVertexIndex)) + (PTwo : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hPTwo : PTwo.coloring = muTwo), + let _ : + HierarchySituationTwoTailData G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := + helperTailTwo6007 G k e0 input T phi ett base C ctx D htail sameStar beta POne + hlastTwo hgammaPenTwo PTwo hPTwo; + D.theta ∉ + HierarchyStoredColorsAt PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount) → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail sameStar beta z POne rho + muTwo hlastTwo hthetaTermTwo hthetaPenTwo hgammaPenTwo PTwo hPTwo tailTwo hstored + let finalData : HierarchySituationTwoCaseTwoData G k e0 + PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := + { toHierarchySituationTwoTailData := tailTwo + alpha := D.theta + alphaMissingPenultimate := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.penultimateVertexIndex) + rw [hPTwo] + exact hthetaPenTwo + alphaMissingTerminal := by + change D.theta ∈ MissingColors G PTwo.coloring (T.vertex D.terminalVertexIndex) + rw [hPTwo] + exact hthetaTermTwo + alphaOutsideStored := hstored } + exact HierarchySituationTwoSubcaseTwoOne G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext finalData + +private theorem helper_continuation_5379.{u_1, u_2} : + helperContinuation5379Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB + hBterminal hyB hElementary hfirstTheta hnotA Bshort hshortT hshortB hterminalIncident + firstWitness self missingSubset leaf separate prefixMissing firstPreserved firstUnaffected + sameStar samePrefix sameTn sameLast commonPrefix hcoreLength predecessorIncident seedStable + weakEdges beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha + hbetaTheta ib hbFirst hibB hby hbt hyt horder firstAfter hrawBeta hmissing hchange hsame z + muOne hdisjoint hpath houtsideBeta houtsideAlpha hmissingOne hfixedOne hstoredOne hcase + corrOne hmaxOne baseOne KOne goodOne hsameOne hbTerminalOne POne hPOne rho ettOne baseOne' + COne' ctxOne HOne qOne hmissingOne' hElementaryOne missingEq + have hmissingA := missingEq A hAB + have hbetaStoredOne : beta ∉ HierarchyStoredColorsAt HOne qOne := by + rw [← (sameLast POne).1] + exact hbetaStored + have hthetaPenOne : D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) := by + rw [hmissingOne' _ hyB] + exact D.thetaMissingPenultimate + have hgammaPenOne : beta ∉ MissingColors G rho (T.vertex D.penultimateVertexIndex) := by + rw [hmissingOne' _ hyB] + intro hm + exact Finset.disjoint_left.mp (hElementary hibB hyB hby) hbFirst.1 hm + have hgammaTermOne : beta ∈ MissingColors G rho (T.vertex D.terminalVertexIndex) := by + rw [show rho = muOne from hPOne] + exact hbTerminalOne + have hgammaWitnessOne' : beta ∈ MissingColors G rho (T.vertex ib) := by + rw [hmissingOne' _ hibB] + exact hbFirst.1 + have hfirstGammaOne : HierarchyFirstMissingPosition rho T beta = ib := + firstPreserved phi rho beta hElementary hmissingOne' hmissing.1 + have hfirstThetaOne : HierarchyFirstMissingPosition rho T D.theta = + D.penultimateVertexIndex := + (firstPreserved phi rho D.theta hElementary hmissingOne' + (Finset.mem_biUnion.mpr ⟨_, hyB, D.thetaMissingPenultimate⟩)).trans hfirstTheta + have hgammaUnusedOne : ∀ t : Fin T.length, A.length ≤ t.val → + rho (T.edge t) ≠ some beta := by + intro t ht + rw [show rho = muOne from hPOne, hfixedOne t ht] + exact hbetaUnused t ht + have hcaseOne (hm : beta ∈ TreeMissingColors phi A) : + (0 < HOne.dividerCount ∧ beta ∈ TreeMissingColors rho + (HOne.stage ⟨HOne.dividerCount, by omega⟩)) ∨ + (HOne.dividerCount = 0 ∧ beta ∈ TreeMissingColors rho + (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc)) := by + exact @helper_hcaseOne_906 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@sameStar) (@sameTn) (@commonPrefix) (@beta) (@hzero) (@POne) + (@missingEq) (@hmissingA) (@hm) + have hmissingPairOne : beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B := + ⟨Finset.mem_biUnion.mpr ⟨_, hibB, hgammaWitnessOne'⟩, + Finset.mem_biUnion.mpr ⟨_, hyB, hthetaPenOne⟩⟩ + have hchangeOne := ChangeLemma G k e0 POne.corresponding.replacementInput T rho ettOne + baseOne' COne' ctxOne.proper ctxOne.oneEdgeUncolored ctxOne.lowerRung + ctxOne.fewerDividers ctxOne.lexicographicMinimality + (by + change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' + - 1))) + rw [samePrefix POne] + exact hElementaryOne) + ctxOne.largeMissingSet beta D.theta hbetaTheta + (by + change beta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) ∧ + D.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix COne' (HierarchyFullTailLength COne' - 1)) + rw [samePrefix POne] + exact hmissingPairOne) + (by + dsimp only + rw [sameStar POne, hfirstGammaOne, hfirstThetaOne] + intro _ + refine ⟨horder, ?_⟩ + intro hc + obtain ⟨t, ht, _, he⟩ := (Finset.mem_filter.mp hc).2 + exact hgammaUnusedOne t ht he) + have hsameTwo : TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib)) = + TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + exact @helper_hsameTwo_4804 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hnotA) (@sameStar) + (@sameLast) (@beta) (@hbetaMissing) (@hbetaUnused) (@hbetaStored) (@hzero) (@houtside) + (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) (@hibB) (@hby) (@hbt) (@horder) + (@hrawBeta) (@hmissing) (@hchange) (@hsame) (@hdisjoint) (@hpath) (@houtsideBeta) + (@houtsideAlpha) (@hmissingOne) (@hfixedOne) (@hstoredOne) (@hcase) (@corrOne) (@hmaxOne) + (@baseOne) (@KOne) (@goodOne) (@hsameOne) (@hbTerminalOne) (@POne) (@hPOne) (@hmissingA) + (@hbetaStoredOne) (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') (@hfirstGammaOne) + (@hfirstThetaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hchangeOne) + have hdisjointTwo := separate rho beta D.theta hbetaTheta ctxOne.proper + (T.vertex ib) (T.vertex D.penultimateVertexIndex) (T.vertex D.terminalVertexIndex) + hby hbt hyt hgammaWitnessOne' hthetaPenOne (Or.inl hgammaTermOne) hsameTwo + let muTwo := TwoColorComponentSwap G rho beta D.theta z + have hpathTwo : TwoColorPathComponent G rho beta D.theta z := + ⟨hbetaTheta, _, self rho beta D.theta _, + leaf rho beta D.theta hbetaTheta ctxOne.proper _ (Or.inl hgammaTermOne)⟩ + have houtsideBetaTwo : Sum.inl (T.vertex ib) ∉ TwoColorComponent G rho beta D.theta z := by + intro hm + exact Set.disjoint_left.mp hdisjointTwo hm (self rho beta D.theta _) + have houtsideThetaTwo : Sum.inl (T.vertex D.penultimateVertexIndex) ∉ + TwoColorComponent G rho beta D.theta z := by + intro hm + apply Set.disjoint_left.mp hdisjointTwo hm + rw [hsameTwo] + exact self rho beta D.theta _ + have hmissingTwo := prefixMissing z rho beta D.theta hbetaTheta ctxOne.proper + hElementaryOne _ _ hibB hyB hgammaWitnessOne' hthetaPenOne + houtsideBetaTwo houtsideThetaTwo + have hstoredTwo : ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c := by + exact @helper_hstoredTwo_1017 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@firstPreserved) (@firstUnaffected) (@beta) (@hbetaTheta) (@POne) (@hElementaryOne) + (@hbetaStoredOne) (@hmissingPairOne) (@hmissingTwo) + have hthetaLastOne : rho (T.edge D.lastEdgeIndex) = some D.theta := by + exact @helper_hthetaLastOne_1025 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@beta) (@hfixedOne) (@POne) (@hPOne) + have hsuffix : TashkinovAugmentationSequence rho B T := by + exact @helper_hsuffix_1031 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) (@beta) (@POne) (@hmissingPairOne) (@hthetaLastOne) + have hthetaBound : (HierarchyFirstMissingPosition rho T D.theta).val ≤ B.length := by + rw [hfirstThetaOne] + have hp := D.penultimateVertexPosition + clear * - hp hBlen + omega + have hgammaCutoff : ∀ c ∈ HierarchyStoredColorsAt HOne qOne, + (beta ∈ POne.counterexample.good.gamma qOne c ∨ + D.theta ∈ POne.counterexample.good.gamma qOne c) → + (HierarchyFirstMissingPosition rho T c).val ≤ B.length := by + exact @helper_hgammaCutoff_1047 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hElementary) (@hnotA) (@hshortT) (@hshortB) (@firstWitness) (@missingSubset) + (@firstPreserved) (@sameLast) (@beta) (@hcutoff) (@POne) (@hmissingOne') (@hthetaBound) + obtain ⟨corrTwo, hmaxTwo, baseTwo, KTwo, goodTwo, hsameGoodTwo⟩ : ∃ corrTwo : + CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T, + MaximumProperty corrTwo.replacementETT ∧ + ∃ baseTwo : HierarchyBase corrTwo.replacementETT muTwo, + ∃ KTwo : TashkinovHierarchy corrTwo.replacementETT baseTwo, + ∃ goodTwo : GoodHierarchy KTwo, SameGoodHierarchy COne'.good goodTwo := by + by_cases hm : beta ∈ TreeMissingColors phi A + · exact @helper_branch_4870 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hBlen) + (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) (@hnotA) (@sameStar) + (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) (@hcoreLength) (@predecessorIncident) + (@seedStable) (@weakEdges) (@beta) (@hbetaTheta) (@hibB) (@hfixedOne) (@POne) (@hPOne) + (@hElementaryOne) (@hthetaPenOne) (@hgammaWitnessOne') (@hfirstGammaOne) + (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hdisjointTwo) (@hpathTwo) + (@hmissingTwo) (@hstoredTwo) (@hsuffix) (@hgammaCutoff) (@hm) + · exact @helper_branch_4879 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) (@sameStar) + (@samePrefix) (@sameLast) (@beta) (@hbetaStored) (@houtside) (@hbetaTheta) (@horder) + (@firstAfter) (@POne) (@hElementaryOne) (@hmissingA) (@hgammaWitnessOne') + (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) (@hmissingPairOne) (@hm) + have hlastComponent : Sum.inr (T.edge D.lastEdgeIndex) ∈ TwoColorComponent G rho beta + D.theta z := by + exact @helper_hlastComponent_1263 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hterminalIncident) (@beta) (@POne) (@hthetaLastOne) + have hlastTwo : muTwo (T.edge D.lastEdgeIndex) = some beta := by + simp [muTwo, TwoColorComponentSwap, hlastComponent, hthetaLastOne, hbetaTheta.symm] + have hthetaTermTwo : D.theta ∈ MissingColors G muTwo (T.vertex D.terminalVertexIndex) := + (TwoColorComponentSwapMissingBehavior G rho beta D.theta hbetaTheta ctxOne.proper z).2.1 + _ (self rho beta D.theta _) hgammaTermOne + have hthetaPenTwo : D.theta ∈ MissingColors G muTwo (T.vertex D.penultimateVertexIndex) := by + rw [hmissingTwo _ hyB] + exact hthetaPenOne + have hgammaPenTwo : beta ∉ MissingColors G muTwo (T.vertex D.penultimateVertexIndex) := by + rw [hmissingTwo _ hyB] + exact hgammaPenOne + let CTwo : HierarchyCounterexample baseTwo := + { positive := by rw [corrTwo.rungAgreement]; exact COne'.positive + hierarchy := KTwo + good := goodTwo + maximum := hmaxTwo + notElementary := by + intro he + have hy : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet T := by simp + [TreeSequenceVertexSet] + have ht : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet T := by simp + [TreeSequenceVertexSet] + exact Finset.disjoint_left.mp (he hy ht hyt) hthetaPenTwo hthetaTermTwo } + obtain ⟨PTwo, hPTwo⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx POne muTwo corrTwo baseTwo CTwo hsameGoodTwo + let tailTwo : HierarchySituationTwoTailData G k e0 PTwo.corresponding.replacementInput T + PTwo.coloring PTwo.corresponding.replacementETT PTwo.replacementBase + PTwo.counterexample PTwo.minimumContext := by + exact @helperTailTwo6007 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@sameStar) + (@beta) (@POne) (@hlastTwo) (@hgammaPenTwo) (@PTwo) (@hPTwo) + by_cases hstored : D.theta ∈ HierarchyStoredColorsAt PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount) + · exact @helper_branch_6081 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@sameStar) + (@beta) (@POne) (@hlastTwo) (@hthetaTermTwo) (@hthetaPenTwo) (@hgammaPenTwo) (@PTwo) + (@hPTwo) (@hstored) + · exact @helper_branch_6105 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@sameStar) + (@beta) (@POne) (@hlastTwo) (@hthetaTermTwo) (@hthetaPenTwo) (@hgammaPenTwo) (@PTwo) + (@hPTwo) (@hstored) +private theorem helper_reduction_4203.{u_1, u_2} : + helperReduction4203Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hApositive hAzero + hAT hAB hBterminal hyB hElementary hfirstAlpha hfirstTheta hnotA halphaNotRaw Bshort + hshortLen hshortT hshortB hnotShort hterminalIncident halphaUnused firstWitness self + missingSubset leaf separate prefixMissing firstPreserved firstUnaffected seriesFacts + corrRefl PRefl sameStar samePrefix sameTn sameLast commonPrefix hcoreLength + predecessorIncident seedStable weakEdges beta hbetaMissing hbetaUnused hbetaStored hzero + houtside hcutoff + as_aux_lemma => + have hbetaAlpha : beta ≠ D.alpha := by + exact ne_of_mem_of_not_mem hbetaMissing (hnotShort (c := D.alpha) D.alphaMissingPenultimate) + have hbetaTheta : beta ≠ D.theta := by + exact @helper_hbetaTheta_676 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@beta) (@hbetaUnused) + let ib := HierarchyFirstMissingPosition phi T beta + have hbFirst := firstWitness phi Bshort hshortT beta hbetaMissing + have hibB : T.vertex ib ∈ TreeSequenceVertexSet B := by + let i : Fin (Bshort.length + 1) := ⟨ib.val, by have := hbFirst.2; omega⟩ + exact TreeSequenceInitialSegmentVertexSetSubset hshortB + ((@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, Finset.mem_univ _, rfl⟩) + have hby : T.vertex ib ≠ T.vertex D.penultimateVertexIndex := by + exact @helper_hby_688 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hshortLen) + (@beta) (@hbFirst) + have hbt : T.vertex ib ≠ T.vertex D.terminalVertexIndex := by + exact @helper_hbt_695 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hshortLen) + (@beta) (@hbFirst) + have hyt : T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex := by + exact @helper_hyt_702 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + have horder : TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) := + ⟨ib, D.penultimateVertexIndex, rfl, rfl, by + have hb : ib.val ≤ Bshort.length := hbFirst.2 + have hp := D.penultimateVertexPosition + clear * - hb hp hshortLen + omega⟩ + have firstAfter (rho : PartialEdgeColoring E k) (c : Fin k) + (hc : c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c))) + (hn : c ∉ TreeMissingColors rho A) : + A.length < (HierarchyFirstMissingPosition rho T c).val := by + exact @helper_firstAfter_715 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) (@rho) + (@c) (@hc) (@hn) + have hrawBeta (hn : beta ∉ TreeMissingColors phi A) : + beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + intro hd + exact hbetaStored (Finset.mem_sdiff.mpr ⟨hd, hn⟩) + have hmissing : beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B := + ⟨Finset.mem_biUnion.mpr ⟨_, hibB, hbFirst.1⟩, + Finset.mem_biUnion.mpr ⟨_, hyB, D.alphaMissingPenultimate⟩⟩ + have hchange := ChangeLemma G k e0 input T phi ett base C ctx.proper + ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers ctx.lexicographicMinimality + hElementary ctx.largeMissingSet beta D.alpha hbetaAlpha hmissing + (by + dsimp only + rw [hfirstAlpha] + intro _ + refine ⟨horder, ?_⟩ + intro hc + obtain ⟨t, ht, _, he⟩ := (Finset.mem_filter.mp hc).2 + exact hbetaUnused t ht he) + have hsame : TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.penultimateVertexIndex)) := by + exact @helper_hsame_4639 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hfirstAlpha) + (@halphaNotRaw) (@beta) (@hbetaMissing) (@hbetaUnused) (@hbetaStored) (@hzero) + (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) (@hibB) (@hby) (@hbt) + (@horder) (@hrawBeta) (@hmissing) (@hchange) + let z : Sum V E := Sum.inl (T.vertex D.terminalVertexIndex) + let muOne := TwoColorComponentSwap G phi beta D.alpha z + have hdisjoint := separate phi beta D.alpha hbetaAlpha ctx.proper + (T.vertex ib) (T.vertex D.penultimateVertexIndex) (T.vertex D.terminalVertexIndex) + hby hbt hyt hbFirst.1 D.alphaMissingPenultimate (Or.inr D.alphaMissingTerminal) hsame + have hpath : TwoColorPathComponent G phi beta D.alpha z := + ⟨hbetaAlpha, _, self phi beta D.alpha _, + leaf phi beta D.alpha hbetaAlpha ctx.proper _ (Or.inr D.alphaMissingTerminal)⟩ + have houtsideBeta : Sum.inl (T.vertex ib) ∉ TwoColorComponent G phi beta D.alpha z := by + intro hm + exact Set.disjoint_left.mp hdisjoint hm (self phi beta D.alpha _) + have houtsideAlpha : Sum.inl (T.vertex D.penultimateVertexIndex) ∉ + TwoColorComponent G phi beta D.alpha z := by + intro hm + apply Set.disjoint_left.mp hdisjoint hm + rw [hsame] + exact self phi beta D.alpha _ + have hmissingOne := prefixMissing z phi beta D.alpha hbetaAlpha ctx.proper + hElementary _ _ hibB hyB hbFirst.1 D.alphaMissingPenultimate houtsideBeta houtsideAlpha + have hfixedOne : ∀ t : Fin T.length, A.length ≤ t.val → + muOne (T.edge t) = phi (T.edge t) := by + intro t ht + have ha := halphaUnused t ht + have hb := hbetaUnused t ht + simp only [muOne, TwoColorComponentSwap, hb, ha, ite_false, ite_self] + have hstoredOne : ∀ c ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition muOne T c = HierarchyFirstMissingPosition phi T c := by + intro c hc + have hcb : c ≠ beta := fun he => hbetaStored (he ▸ hc) + have hca : c ≠ D.alpha := fun he => D.alphaOutsideStored (he ▸ hc) + exact firstUnaffected z phi beta D.alpha c hbetaAlpha ctx.proper hcb hca + have hcase (hm : beta ∈ TreeMissingColors phi A) : + (0 < H.dividerCount ∧ beta ∈ TreeMissingColors phi + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ beta ∈ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + by_cases hz : H.dividerCount = 0 + · exact Or.inr ⟨hz, hzero hz hm⟩ + · exact Or.inl ⟨Nat.pos_of_ne_zero hz, hApositive (Nat.pos_of_ne_zero hz) ▸ hm⟩ + obtain ⟨corrOne, hmaxOne, baseOne, KOne, goodOne, hsameOne⟩ : ∃ corrOne : + CorrespondingExtendedTashkinovTree G k e0 ett muOne T, + MaximumProperty corrOne.replacementETT ∧ + ∃ baseOne : HierarchyBase corrOne.replacementETT muOne, + ∃ KOne : TashkinovHierarchy corrOne.replacementETT baseOne, + ∃ goodOne : GoodHierarchy KOne, SameGoodHierarchy C.good goodOne := by + by_cases hm : beta ∈ TreeMissingColors phi A + · exact @helper_branch_815 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@beta) (@hbetaAlpha) (@hmissing) (@hdisjoint) (@hpath) (@hmissingOne) (@hfixedOne) + (@hstoredOne) (@hcase) (@hm) + · exact @helper_branch_821 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hAT) (@hElementary) (@hfirstAlpha) (@beta) (@hbetaUnused) (@hbetaStored) + (@hbetaAlpha) (@hbFirst) (@horder) (@firstAfter) (@hmissing) (@hm) + have hbTerminalOne : beta ∈ MissingColors G muOne (T.vertex D.terminalVertexIndex) := + (TwoColorComponentSwapMissingBehavior G phi beta D.alpha hbetaAlpha ctx.proper z).2.2.1 + _ (self phi beta D.alpha _) D.alphaMissingTerminal + let COne : HierarchyCounterexample baseOne := + { positive := by rw [corrOne.rungAgreement]; exact C.positive + hierarchy := KOne + good := goodOne + maximum := hmaxOne + notElementary := by + intro he + have hb : T.vertex ib ∈ TreeSequenceVertexSet T := + (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨ib, Finset.mem_univ _, rfl⟩ + have ht : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet T := + (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨_, Finset.mem_univ _, rfl⟩ + exact Finset.disjoint_left.mp (he hb ht hbt) + ((hmissingOne _ hibB).symm ▸ hbFirst.1) hbTerminalOne } + obtain ⟨POne, hPOne⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx PRefl muOne corrOne baseOne COne hsameOne + let rho := POne.coloring + let ettOne := POne.corresponding.replacementETT + let baseOne' := POne.replacementBase + let COne' := POne.counterexample + let ctxOne := POne.minimumContext + let HOne := COne'.hierarchy + let qOne : Fin (HOne.dividerCount + 1) := Fin.last HOne.dividerCount + have hmissingOne' : ∀ v ∈ TreeSequenceVertexSet B, + MissingColors G rho v = MissingColors G phi v := by + rw [show rho = muOne from hPOne] + exact hmissingOne + have hElementaryOne : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) := by + intro u hu v hv huv + rw [hmissingOne' u hu, hmissingOne' v hv] + exact hElementary hu hv huv + have missingEq (X : TreeSequence G e0) (hXB : TreeSequenceInitialSegment X B) : + TreeMissingColors rho X = TreeMissingColors phi X := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => + hmissingOne' v (TreeSequenceInitialSegmentVertexSetSubset hXB hv)) + exact @helper_continuation_5379 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) + (@hfirstTheta) (@hnotA) (@hshortT) (@hshortB) (@hterminalIncident) (@firstWitness) + (@self) (@missingSubset) (@leaf) (@separate) (@prefixMissing) (@firstPreserved) + (@firstUnaffected) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) + (@hcoreLength) (@predecessorIncident) (@seedStable) (@weakEdges) (@beta) (@hbetaMissing) + (@hbetaUnused) (@hbetaStored) (@hzero) (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) + (@hbFirst) (@hibB) (@hby) (@hbt) (@hyt) (@horder) (@firstAfter) (@hrawBeta) (@hmissing) + (@hchange) (@hsame) (@hdisjoint) (@hpath) (@houtsideBeta) (@houtsideAlpha) (@hmissingOne) + (@hfixedOne) (@hstoredOne) (@hcase) (@corrOne) (@hmaxOne) (@baseOne) (@KOne) (@goodOne) + (@hsameOne) (@hbTerminalOne) (@POne) (@hPOne) (@hmissingOne') (@hElementaryOne) (@missingEq) +private theorem helper_continuation_4157.{u_1, u_2} : + helperContinuation4157Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hApositive hAzero + hAT hAB hBterminal hyB hElementary hfirstAlpha hfirstTheta hnotA halphaNotRaw Bshort + hshortLen hshortT hshortB hnotShort hterminalIncident halphaUnused firstWitness self + missingSubset missingWithoutExtra leaf separate prefixMissing firstPreserved + have firstUnaffected (z : Sum V E) (rho : PartialEdgeColoring E k) (a b c : Fin k) + (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (hca : c ≠ a) (hcb : c ≠ b) : + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c := by + exact @helper_firstUnaffected_480 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@z) (@rho) (@a) (@b) (@c) (@hne) (@hp) (@hca) (@hcb) + have seriesFacts : ∀ j : Fin (ett.rounds + 1), + IsProperEdgeColoring G (ett.series.data.coloring j) ∧ + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + exact @helper_seriesFacts_495 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) + let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := + { replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := fun j => (seriesFacts j).1 + replacementOneUncolored := fun j => (seriesFacts j).2 + replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } + let PRefl : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + { coloring := phi + corresponding := corrRefl + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + minimumContext := ctx } + have sameStar (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = A := by + exact @helper_sameStar_549 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + have samePrefix (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1) = B + := by + simp only [HierarchyFullTailPrefix, HierarchyFullTailLength, sameStar P] + rfl + have sameTn (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + P.corresponding.replacementETT.series.data.tree + (Fin.last P.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + have hs := (Fin.heq_fun_iff + (congrArg (fun n => n + 2) P.sameGood.1.2.1)).mp P.sameGood.1.2.2.1 0 + exact P.counterexample.hierarchy.baseStage.symm.trans (hs.symm.trans H.baseStage) + have sameLast (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = P.counterexample.good.gamma + (Fin.last P.counterexample.hierarchy.dividerCount) eta := by + obtain ⟨hc, hd⟩ := P.sameGood.2 + have hi : Fin.cast (congrArg (fun n => n + 1) hc) q = + Fin.last P.counterexample.hierarchy.dividerCount := Fin.ext hc + simpa only [hi] using hd q + have commonPrefix {X Y F : TreeSequence G e0} + (hXF : TreeSequenceInitialSegment X F) (hYF : TreeSequenceInitialSegment Y F) + (hXY : X.length ≤ Y.length) : TreeSequenceInitialSegment X Y := by + exact @helper_commonPrefix_588 (@V) (@E) (@G) (@e0) (@X) (@Y) (@F) (@hXF) (@hYF) (@hXY) + have hcoreLength : base.core.length ≤ A.length := by + exact @helper_hcoreLength_597 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hApositive) (@hAzero) + have predecessorIncident (X : TreeSequence G e0) + (hXT : TreeSequenceInitialSegment X T) (t : Fin T.length) + (ht : t.val = X.length) : TreeIncidentEdge X (T.edge t) := by + exact @helper_predecessorIncident_606 (@V) (@E) inferInstance inferInstance (@G) (@e0) (@T) + (@X) (@hXT) (@t) (@ht) + have seedStable {input' : PartialEdgeColoring E k} + (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) + (base' : HierarchyBase ett' rho) (K : TashkinovHierarchy ett' base') + (hw : HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma) + (hq : K.dividerCount = 0) : + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma := by + exact @helper_seedStable_618 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@input') (@rho) (@sigma) (@ett') (@base') (@K) (@hw) + (@hq) + have weakEdges {input' : PartialEdgeColoring E k} + (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) + (base' : HierarchyBase ett' old) (K : TashkinovHierarchy ett' base') + (hw : HierarchyWeaklyStable K (Fin.last K.dividerCount) new) + (ho : IsOneEdgeUncolored old e0) (hno : IsOneEdgeUncolored new e0) : + ∀ t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length, + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by + exact @helper_weakEdges_634 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@T) (@input') (@old) (@new) (@ett') (@base') (@K) (@hw) (@ho) (@hno) + have reduction (beta : Fin k) + (hbetaMissing : beta ∈ TreeMissingColors phi Bshort) + (hbetaUnused : ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some beta) + (hbetaStored : beta ∉ HierarchyStoredColorsAt H q) + (hzero : H.dividerCount = 0 → beta ∈ TreeMissingColors phi A → + beta ∈ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (houtside : beta ∉ TreeMissingColors phi A → + D.theta ∉ HierarchyStoredColorsAt H q) + (hcutoff : ∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → + eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) : False := by + exact @helper_reduction_4203 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@hApositive) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) + (@hElementary) (@hfirstAlpha) (@hfirstTheta) (@hnotA) (@halphaNotRaw) (@hshortLen) + (@hshortT) (@hshortB) (@hnotShort) (@hterminalIncident) (@halphaUnused) (@firstWitness) + (@self) (@missingSubset) (@leaf) (@separate) (@prefixMissing) (@firstPreserved) + (@firstUnaffected) (@seriesFacts) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) + (@commonPrefix) (@hcoreLength) (@predecessorIncident) (@seedStable) (@weakEdges) (@beta) + (@hbetaMissing) (@hbetaUnused) (@hbetaStored) (@hzero) (@houtside) (@hcutoff) + by_cases hthetaStored : D.theta ∈ HierarchyStoredColorsAt H q + · exact @helper_branch_1360 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hApositive) + (@hAzero) (@hAT) (@hfirstTheta) (@hshortLen) (@missingSubset) (@reduction) (@hthetaStored) + · exact @helper_branch_3441 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hApositive) + (@hAzero) (@hAT) (@hAB) (@hElementary) (@hnotA) (@hshortLen) (@missingSubset) + (@missingWithoutExtra) (@reduction) (@hthetaStored) + +theorem HierarchySituationTwoSubcaseTwoTwo {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData + G k e0 input T phi ett base C ctx) : + False := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + have htail : 2 ≤ T.length - A.length := D.tailAtLeastTwo + have hBlen : B.length + 1 = T.length := by + simp only [B, HierarchyFullTailPrefix, HierarchyFullTailLength, + TreeSequencePrefix] + change min (A.length + (T.length - A.length - 1)) T.length + 1 = T.length + omega + have hBT : TreeSequenceInitialSegment B T := by + exact @helper_hBT_115 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBlen) + have hApositive (hq : 0 < H.dividerCount) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact @helper_hApositive_122 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hq) + have hAzero (hq : H.dividerCount = 0) : A = base.core := by + have hi : q = 0 := by apply Fin.ext; simp [q, hq] + change HierarchyStarredStage H q = _ + rw [hi] + rfl + have hAT : TreeSequenceInitialSegment A T := by + exact @helper_hAT_140 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hApositive) (@hAzero) + have hAB : TreeSequenceInitialSegment A B := by + exact @helper_hAB_152 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htail) (@hBlen) (@hApositive) + (@hAzero) (@hAT) + have hBterminal : B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex := by + exact @helper_hBterminal_158 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hBlen) (@hBT) + have hyB : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last B.length, hBterminal⟩ + have hElementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have firstAt {c : Fin k} + (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by + exact @helper_firstAt_172 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hyB) + (@hElementary) (@c) (@hc) + have hfirstAlpha := firstAt D.alphaMissingPenultimate + have hfirstTheta := firstAt D.thetaMissingPenultimate + have hnotA {c : Fin k} + (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + c ∉ TreeMissingColors phi A := by + exact @helper_hnotA_197 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hApositive) (@hAzero) (@hAT) (@hAB) (@hyB) (@hElementary) (@hfirstTheta) (@c) (@hc) + have halphaNotRaw : + D.alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + intro hc + exact D.alphaOutsideStored + (Finset.mem_sdiff.mpr ⟨hc, hnotA (c := D.alpha) D.alphaMissingPenultimate⟩) + let Bshort := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2) + have hshortLen : Bshort.length + 2 = T.length := by + change min (A.length + (T.length - A.length - 2)) T.length + 2 = T.length + omega + have hshortT : TreeSequenceInitialSegment Bshort T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hshortB : TreeSequenceInitialSegment Bshort B := by + exact @helper_hshortB_225 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hshortLen) + have hnotShort {c : Fin k} + (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : + c ∉ TreeMissingColors phi Bshort := by + exact @helper_hnotShort_231 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hyB) + (@hElementary) (@hfirstTheta) (@hshortLen) (@hshortT) (@hshortB) (@c) (@hc) + have hterminalIncident : + Incident G (T.vertex D.terminalVertexIndex) (T.edge D.lastEdgeIndex) := by + exact @helper_hterminalIncident_247 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hshortLen) + have halphaLast : phi (T.edge D.lastEdgeIndex) ≠ some D.alpha := by + exact @helper_halphaLast_259 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@hterminalIncident) + have halphaUnused : ∀ t : Fin T.length, A.length ≤ t.val → + phi (T.edge t) ≠ some D.alpha := by + exact @helper_halphaUnused_265 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) + (@htail) (@hBlen) (@hBT) (@hApositive) (@hAzero) (@hBterminal) (@hElementary) + (@halphaNotRaw) (@hshortLen) (@halphaLast) + have firstWitness (rho : PartialEdgeColoring E k) (X : TreeSequence G e0) + (hXT : TreeSequenceInitialSegment X T) (c : Fin k) + (hc : c ∈ TreeMissingColors rho X) : + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (HierarchyFirstMissingPosition rho T c).val ≤ X.length := by + exact @helper_firstWitness_291 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (@rho) (@X) (@hXT) (@c) (@hc) + have self (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := by + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl v) = _ + rfl + have missingSubset (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) : + TreeMissingColors rho X ⊆ TreeMissingColors rho Y := by + exact @helper_missingSubset_322 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@rho) + (@X) (@Y) (@hXY) + have missingWithoutExtra (rho : PartialEdgeColoring E k) + (X Y : TreeSequence G e0) (c : Fin k) + (hc : c ∉ (TreeSequenceVertexSet X \ TreeSequenceVertexSet Y).biUnion + (fun v => MissingColors G rho v)) : + c ∈ TreeMissingColors rho X → c ∈ TreeMissingColors rho Y := by + exact @helper_missingWithoutExtra_331 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@rho) (@X) (@Y) (@c) (@hc) + have leaf (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) (v : V) + (hm : a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v) : + Set.Subsingleton ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)) := by + exact @helper_leaf_344 (@V) (@E) inferInstance inferInstance (@G) (@k) (@rho) (@a) (@b) + (@hne) (@hp) (@v) (@hm) + have separate (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) (u v w : V) + (huv : u ≠ v) (huw : u ≠ w) (hvw : v ≠ w) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hw : a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w) + (hsame : TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v)) : + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + exact @helper_separate_363 (@V) (@E) inferInstance inferInstance + (@G) (@k) (@self) (@leaf) (@rho) (@a) (@b) (@hne) (@hp) (@u) (@v) (@w) (@huv) (@huw) + (@hvw) (@hu) (@hv) (@hw) (@hsame) + have prefixMissing (z : Sum V E) (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) + (hp : IsProperEdgeColoring G rho) + (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B)) + (u v : V) (huB : u ∈ TreeSequenceVertexSet B) (hvB : v ∈ TreeSequenceVertexSet B) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hdu : Sum.inl u ∉ TwoColorComponent G rho a b z) + (hdv : Sum.inl v ∉ TwoColorComponent G rho a b z) : + ∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by + exact @helper_prefixMissing_397 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@z) (@rho) (@a) + (@b) (@hne) (@hp) (@helem) (@u) (@v) (@huB) (@hvB) (@hu) (@hv) (@hdu) (@hdv) + have firstPreserved (rho sigma : PartialEdgeColoring E k) (c : Fin k) + (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B)) + (hmiss : ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) + (hc : c ∈ TreeMissingColors rho B) : + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by + exact @helper_firstPreserved_455 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBT) + (@firstWitness) (@rho) (@sigma) (@c) (@helem) (@hmiss) (@hc) + exact @helper_continuation_4157 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) + (@hBlen) (@hBT) (@hApositive) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) + (@hfirstAlpha) (@hfirstTheta) (@hnotA) (@halphaNotRaw) (@hshortLen) (@hshortT) (@hshortB) + (@hnotShort) (@hterminalIncident) (@halphaUnused) (@firstWitness) (@self) (@missingSubset) + (@missingWithoutExtra) (@leaf) (@separate) (@prefixMissing) (@firstPreserved) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoTailData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoTailData.lean new file mode 100644 index 0000000000..d0bd95b6f5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoTailData.lean @@ -0,0 +1,50 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext + +/-! +# Hierarchy Situation Two Tail Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Common final-tail data with the last-edge color present at the penultimate vertex. -/ +structure HierarchySituationTwoTailData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) where + tailAtLeastTwo : 2 ≤ HierarchyFullTailLength C + pathNumberFull : HierarchyPathNumber C.hierarchy = HierarchyFullTailLength C + /-- The index of the final tree edge. -/ + lastEdgeIndex : Fin T.length + /-- The index of the penultimate tree vertex. -/ + penultimateVertexIndex : Fin (T.length + 1) + /-- The index of the final tree vertex. -/ + terminalVertexIndex : Fin (T.length + 1) + lastEdgePosition : lastEdgeIndex.val + 1 = T.length + penultimateVertexPosition : penultimateVertexIndex.val + 1 = T.length + terminalVertexPosition : terminalVertexIndex.val = T.length + lastEdgeNotIncidentPenultimate : + ¬Incident G (T.vertex penultimateVertexIndex) (T.edge lastEdgeIndex) + /-- The auxiliary color with the missing-color conditions recorded below. -/ + theta : Fin k + thetaOnLastEdge : phi (T.edge lastEdgeIndex) = some theta + thetaPresentPenultimate : theta ∉ MissingColors G phi (T.vertex penultimateVertexIndex) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchySplitter.lean b/LeanPool/GoldbergSeymour/HierarchySplitter.lean new file mode 100644 index 0000000000..a365b47821 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchySplitter.lean @@ -0,0 +1,492 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.Td + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Hierarchy Splitter + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch57Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (_ : (0 : ℕ) < ett.rounds) + (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) + (_ : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) + (_ : + (let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + have seed : TreeSequence G e0 := + TreeSequencePrefix Tn (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt); + (∀ (j : Fin Tn.length), sigma (Tn.edge j) = phi (Tn.edge j)) ∧ + (∀ (j : Fin base.closure.length), sigma (base.closure.edge j) = phi (base.closure.edge j)) ∧ + TashkinovClosure sigma seed base.closure)) + (replacementInput : PartialEdgeColoring E k) + (replacementSeries : TashkinovSeries G k ett.rounds e0 replacementInput) + (finalGeneratingColoring : sigma = replacementSeries.data.coloring (Fin.last ett.rounds)) + (ladderTreesAgree : + ∀ (i : Fin ett.rounds), + replacementSeries.data.tree i.succ.castSucc = ett.series.data.tree i.succ.castSucc) + (storedColorsAgree : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeries.data.stored i = ett.series.data.stored i) + (connectingEdgesAgree : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeries.data.connectingEdges i = ett.series.data.connectingEdges i) + (extensionKindsAgree : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), replacementSeries.data.kind i = ett.series.data.kind i) + (replacementProper : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (replacementSeries.data.coloring i)) + (replacementOneUncolored : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (replacementSeries.data.coloring i) e0) + (replacementStable : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (replacementSeries.data.coloring i.succ)) + (rounds : ℕ) (roundsPositive : (1 : ℕ) ≤ rounds) + (replacementData : TashkinovSeries G k rounds e0 replacementInput) + (above : + TreeSequenceInitialSegment + (replacementData.data.tree (⟨rounds, (by omega)⟩ : Fin (rounds + (2 : ℕ)))) T) + (strict : + (replacementData.data.tree (⟨rounds, (by omega)⟩ : Fin (rounds + (2 : ℕ)))).length < T.length) + (below : TreeSequenceInitialSegment T (replacementData.data.tree (Fin.last (rounds + (1 : ℕ))))) + (generating : sigma = replacementData.data.coloring (Fin.last rounds)) + (rungAgreement : + { rounds := rounds, roundsPositive := roundsPositive, series := replacementData, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : + ExtendedTashkinovTree G k e0 replacementInput T sigma }.rounds = + ett.rounds) + (seriesPresentation : + { rounds := rounds, roundsPositive := roundsPositive, series := replacementData, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : + ExtendedTashkinovTree G k e0 replacementInput T sigma }.series ≍ + replacementSeries) + (_ : + MaximumProperty + { replacementInput := replacementInput, replacementSeries := replacementSeries, + replacementETT := + { + rounds := rounds, roundsPositive := roundsPositive, series := replacementData, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 replacementInput T sigma }, + rungAgreement := rungAgreement, seriesPresentation := seriesPresentation, + finalGeneratingColoring := finalGeneratingColoring, ladderTreesAgree := ladderTreesAgree, + storedColorsAgree := storedColorsAgree, connectingEdgesAgree := connectingEdgesAgree, + extensionKindsAgree := extensionKindsAgree, replacementProper := replacementProper, + replacementOneUncolored := replacementOneUncolored, replacementStable := replacementStable : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T }.replacementETT), + ∃ (baseSigma : + HierarchyBase + { replacementInput := replacementInput, replacementSeries := replacementSeries, + replacementETT := + { + rounds := rounds, roundsPositive := roundsPositive, series := replacementData, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 replacementInput T sigma }, + rungAgreement := rungAgreement, seriesPresentation := seriesPresentation, + finalGeneratingColoring := finalGeneratingColoring, ladderTreesAgree := ladderTreesAgree, + storedColorsAgree := storedColorsAgree, connectingEdgesAgree := connectingEdgesAgree, + extensionKindsAgree := extensionKindsAgree, replacementProper := replacementProper, + replacementOneUncolored := replacementOneUncolored, replacementStable := replacementStable : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T }.replacementETT + sigma) + (K : + TashkinovHierarchy + { replacementInput := replacementInput, replacementSeries := replacementSeries, + replacementETT := + { + rounds := rounds, roundsPositive := roundsPositive, series := replacementData, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := generating : ExtendedTashkinovTree G k e0 replacementInput T sigma }, + rungAgreement := rungAgreement, seriesPresentation := seriesPresentation, + finalGeneratingColoring := finalGeneratingColoring, ladderTreesAgree := ladderTreesAgree, + storedColorsAgree := storedColorsAgree, connectingEdgesAgree := connectingEdgesAgree, + extensionKindsAgree := extensionKindsAgree, replacementProper := replacementProper, + replacementOneUncolored := replacementOneUncolored, replacementStable := replacementStable : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T }.replacementETT + baseSigma), + SameHierarchyStages H K + +private theorem helper_chosenAgree_167.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (hpositive : (0 : ℕ) < ett.rounds) + (_ : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) + (replacementInput : PartialEdgeColoring E k) + (replacementSeries : TashkinovSeries G k ett.rounds e0 replacementInput) + (_ : + (∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeries.data.connectingEdges i = ett.series.data.connectingEdges i)), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) + (Decidable.byContradiction fun (a : ¬(0 : ℕ) < (1 : ℕ)) => by omega)⟩ : + Fin ett.rounds); + ∀ (_ : q.succ = Fin.last ett.rounds) + (_ : + replacementSeries.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (_ : + (∀ (u v x y : V) (e : E) + (_ : + u ∈ + TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc)) + (_ : + v ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (_ : + x ∉ + TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc)) + (_ : + y ∉ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (_ : G.ends e = s(u, x)) (_ : G.ends e = s(v, y)), u = v)), + replacementSeries.data.chosenVertex (Fin.last ett.rounds) = + ett.series.data.chosenVertex (Fin.last ett.rounds) := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive hPE replacementInput replacementSeries + connectingEdgesAgree q hq hkind insideUnique + have oldStep := ett.series.certified (Fin.last ett.rounds) + have newStep := replacementSeries.certified (Fin.last ett.rounds) + generalize oldIndex : Fin.last ett.rounds = oldTarget at oldStep + generalize newIndex : Fin.last ett.rounds = newTarget at newStep + cases oldStep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + rw [oldIndex] at hPE + rw [initialKind] at hPE + cases hPE + | SE oi previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [oldIndex] at hPE + rw [currentKind] at hPE + cases hPE + | RE oi previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [oldIndex] at hPE + rw [currentKind] at hPE + cases hPE + | PE oi previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting oldChoice seriesAlternativeFails + oldGamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness oldColoring oldProper oldOneUncolored + oldStored oldEdges oldKind oldVertex oldOutside oldDelta oldGamma2 + closedExtension orderedExtension strictExtension => + have hio : oi = q := by + apply Fin.ext + have hv := congrArg Fin.val oldIndex + simp [q] at hv ⊢ + omega + subst oi + cases newStep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + rw [newIndex] at hkind + rw [initialKind] at hkind + cases hkind + | SE ni previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [newIndex] at hkind + rw [currentKind] at hkind + cases hkind + | RE ni previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [newIndex] at hkind + rw [currentKind] at hkind + cases hkind + | PE ni previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting newChoice seriesAlternativeFails + newGamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness newColoring newProper newOneUncolored + newStored newEdges newKind newVertex newOutside newDelta newGamma2 + closedExtension orderedExtension strictExtension => + have hin : ni = q := by + apply Fin.ext + have hv := congrArg Fin.val newIndex + simp [q] at hv ⊢ + omega + subst ni + have hedge : newChoice.edge = oldChoice.edge := by + have he := connectingEdgesAgree (Fin.last ett.rounds) + rw [← hq] at he + rw [newEdges, oldEdges] at he + simpa using he + have hnew : newChoice.vertex ∈ TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) := by + simpa [hq] using newChoice.vertexDefective.1 + have hold : oldChoice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + simpa [hq] using oldChoice.vertexDefective.1 + have hnewOutside : newChoice.otherEndpoint ∉ TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) := by + simpa [hq] using newChoice.otherOutside + have holdOutside : oldChoice.otherEndpoint ∉ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + simpa [hq] using oldChoice.otherOutside + have hv := insideUnique newChoice.vertex oldChoice.vertex + newChoice.otherEndpoint oldChoice.otherEndpoint newChoice.edge + hnew hold hnewOutside holdOutside + newChoice.edgeEnds (hedge ▸ oldChoice.edgeEnds) + have hvertices := newVertex.trans ((congrArg some hv).trans oldVertex.symm) + simpa [hq] using hvertices + +private theorem helper_branch_57.{u_1, u_2} : + helperBranch57Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett hpositive base H hPE hbase replacementInput + replacementSeries finalGeneratingColoring ladderTreesAgree storedColorsAgree + connectingEdgesAgree extensionKindsAgree replacementProper replacementOneUncolored + replacementStable rounds roundsPositive replacementData above strict below generating + rungAgreement seriesPresentation hc + cases rungAgreement + have seriesSame : replacementData = replacementSeries := + eq_of_heq seriesPresentation + cases seriesSame + let q : Fin ett.rounds := + ⟨ett.rounds - 1, Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ + have hq : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + have hfinal : replacementSeries.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rw [← hq] + exact ladderTreesAgree q + have hkindEq : replacementSeries.data.kind (Fin.last ett.rounds) = + ett.series.data.kind (Fin.last ett.rounds) := by + have hk := extensionKindsAgree q.succ + rw [hq] at hk + exact hk + have hkind : replacementSeries.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := hkindEq.trans hPE + have insideUnique : ∀ (u v x y : V) (e : E), + u ∈ TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) → + v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) → + x ∉ TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) → + y ∉ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) → + G.ends e = s(u, x) → G.ends e = s(v, y) → u = v := by + intro u v x y e hu hv hx hy he₁ he₂ + rcases (Sym2.eq_iff.mp (he₁.symm.trans he₂)) with h | h + · exact h.1 + · have hv' := hv + rw [← hfinal] at hv' + exact False.elim (hx (h.2 ▸ hv')) + have chosenAgree := @helper_chosenAgree_167 V E inferInstance inferInstance inferInstance G k e0 + input T phi ett hpositive hPE replacementInput replacementSeries connectingEdgesAgree hq hkind + insideUnique + have transportVertex : ∀ (A B : TreeSequence G e0), ∀ (h : A = B), + ∀ i : Fin (B.length + 1), + A.vertex (Fin.cast (congrArg (fun W : TreeSequence G e0 => W.length + 1) + h.symm) i) = B.vertex i := by + intro A B h i + cases h + rfl + let pos : Fin ((replacementSeries.data.tree + (Fin.last ett.rounds).castSucc).length + 1) := + Fin.cast (congrArg (fun W : TreeSequence G e0 => W.length + 1) + hfinal.symm) base.supportPosition + let baseSigma : HierarchyBase + { rounds := ett.rounds + roundsPositive := by omega + series := replacementSeries + abovePenultimate := above + strictAbovePenultimate := strict + belowFinal := below + generatingColoring := generating } sigma := + { core := base.core + closure := base.closure + supportPosition := pos + supportPositive := by simpa [pos] using base.supportPositive + terminalMissingColors := by rfl + parallel := by + dsimp + intro hp + have hp' : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := by + exact hkindEq ▸ hp + have hb := base.parallel hp' + refine ⟨?_, ?_, ?_⟩ + · have hvertex : + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc).vertex pos = + (ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex + base.supportPosition := by + exact transportVertex _ _ hfinal base.supportPosition + rw [chosenAgree] + rw [hvertex] + simpa [hfinal] using hb.1 + · simpa [pos, hfinal] using hbase.2.2 + · simpa [hfinal] using hb.2.2 + nonparallel := by + dsimp + intro hp + exact False.elim (hp hkind) } + refine ⟨baseSigma, ?_⟩ + let K : TashkinovHierarchy _ baseSigma := + { dividerCount := H.dividerCount + stage := H.stage + baseStage := by simpa [hfinal] using H.baseStage + terminalStage := H.terminalStage + nested := H.nested + strict := H.strict + dividerPosition := H.dividerPosition + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := H.dividerStage + coreInsideFirst := H.coreInsideFirst } + refine ⟨K, ?_⟩ + simp [SameHierarchyStages, baseSigma, K, hPE, hkind] + +private theorem HierarchySplitter_finish_92.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (_ : 0 < ett.rounds) + (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) + (_ : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) + (_ : + (let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc; + have seed := + TreeSequencePrefix Tn (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt); + (∀ (j : Fin Tn.length), sigma (Tn.edge j) = phi (Tn.edge j)) ∧ + (∀ (j : Fin base.closure.length), + sigma (base.closure.edge j) = phi (base.closure.edge j)) ∧ + TashkinovClosure sigma seed base.closure)) + (c : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (_ : MaximumProperty c.replacementETT), + ∃ (baseSigma : HierarchyBase c.replacementETT sigma) (K : + TashkinovHierarchy c.replacementETT baseSigma), SameHierarchyStages H K := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett hpositive base H hPE hbase c hc + rcases c with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + exact @helper_branch_57 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi sigma ett hpositive base H hPE hbase replacementInput replacementSeries + finalGeneratingColoring ladderTreesAgree storedColorsAgree connectingEdgesAgree + extensionKindsAgree replacementProper replacementOneUncolored replacementStable rounds + roundsPositive replacementData above strict below generating rungAgreement + seriesPresentation hc +theorem HierarchySplitter {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (hproperPhi : IsProperEdgeColoring G phi) + (honePhi : IsOneEdgeUncolored phi e0) + (hproperSigma : IsProperEdgeColoring G sigma) + (honeSigma : IsOneEdgeUncolored sigma e0) + (hcombined : CombinedStableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma) + (hbuilt : TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) T) : + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T, + MaximumProperty corr.replacementETT ∧ + ∃ baseSigma : HierarchyBase corr.replacementETT sigma, + ∃ K : TashkinovHierarchy corr.replacementETT baseSigma, + SameHierarchyStages H K := by + classical + have hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma := by + simpa [ett.generatingColoring] using hcombined.1 + have hmod : ModColoring ett sigma := by + exact Td G k e0 input T phi ett hMP hpositive hlower sigma + hproperSigma honeSigma hstable + rcases hmod with ⟨hsProper, hsOne, hmodProp⟩ + have hbase := CombinedStableClosurePreserved G k e0 input T phi phi sigma ett + hpositive base ett.generatingColoring hPE hproperPhi honePhi hproperSigma honeSigma hcombined + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + have hinitial : TreeSequenceInitialSegment Tn T := by + have hi : (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + (Fin.last ett.rounds).castSucc := Fin.ext (by rfl) + change TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) T + rw [← hi] + exact ett.abovePenultimate + have hstrict : Tn.length < T.length := by + have hi : (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + (Fin.last ett.rounds).castSucc := Fin.ext (by rfl) + change (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < T.length + rw [← hi] + exact ett.strictAbovePenultimate + have hcorr : Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma T) := by + exact hmodProp T hinitial hstrict (Or.inl ⟨hPE, hbuilt⟩) + let corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T := + Classical.choice hcorr + have hcorrMP : MaximumProperty corr.replacementETT := by + exact MaximumPropertyTransport G k e0 ett sigma + ⟨hsProper, hsOne, hmodProp⟩ T corr hMP + refine ⟨corr, hcorrMP, ?_⟩ + have finish : ∀ (c : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty c.replacementETT → + ∃ baseSigma : HierarchyBase c.replacementETT sigma, + ∃ K : TashkinovHierarchy c.replacementETT baseSigma, + SameHierarchyStages H K := by + exact @HierarchySplitter_finish_92 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi sigma ett hpositive base H hPE hbase + exact finish corr hcorrMP + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyStageInterchangeability.lean b/LeanPool/GoldbergSeymour/HierarchyStageInterchangeability.lean new file mode 100644 index 0000000000..50eb6d9e5b --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyStageInterchangeability.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Step1CaseOneInsideStar +public import LeanPool.GoldbergSeymour.Step1CaseOneOutsideStar +public import LeanPool.GoldbergSeymour.Step1CaseTwoInsideStar +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsideStar + +public import LeanPool.GoldbergSeymour.Step1ExitLegGlobalMinimum + +/-! +# step1 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem step1 {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < H.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (i : Fin H.dividerCount) (alpha beta : Fin k) + (halpha : alpha ∈ + TreeMissingColors phi (H.stage i.succ.castSucc)) + (hne : alpha ≠ beta) + (hclosed : TreeColorSetClosed G phi + (H.stage i.succ.castSucc) {alpha}) : + TreeInterchangeable G (H.stage i.succ.castSucc) phi alpha beta := by + by_contra hnot + obtain ⟨input', T', psi, other, base', K, good', hround, hmp', hdiv, + hproper', hone', hlarge', hterm', helem', hrest⟩ := + Step1ExitLegGlobalMinimum G k e0 input T phi ett hMP hpositive hproper hone + hlower base H good hfewer hlarge i alpha beta halpha hne hclosed hnot + rcases hrest with ⟨a, b, theta, a₁, b₁, a₂, b₂, P₁, P₂, f₁, f₂, + hab, ha, hac, hp₁, hp₂, hpaths, haa, hbb, horder, hf₁, hf₂, + hi₁, hi₂, hpf₁, hpf₂, hta, htb, htm, htcstar, htc, hnoSmaller, + hcases⟩ + have hpos : 0 < other.rounds := by omega + rcases hcases with hmissing | ⟨hnotmissing, hthird⟩ + · by_cases hinside : b₂ ∈ TreeSequenceVertexSet + (HierarchyStarredStage K (Fin.last K.dividerCount)) + · exact Step1CaseOneInsideStar G k e0 input' T' psi other hmp' hpos + hproper' hone' (fun lower hp hlt hm => hlower lower hp (by omega) hm) + base' K good' H.dividerCount hdiv + (fun lower hr hm => hfewer lower (by omega) hm) hlarge' hterm' helem' + a b ha hac hab hmissing a₁ b₁ a₂ b₂ P₁ P₂ hp₁ hp₂ hpaths haa hbb horder + f₁ f₂ hf₁ hf₂ hi₁ hi₂ hpf₁ hpf₂ hinside theta hta htb htm htcstar htc + hnoSmaller + · exact Step1CaseOneOutsideStar G k e0 input' T' psi other hmp' hpos + hproper' hone' (fun lower hp hlt hm => hlower lower hp (by omega) hm) + base' K good' H.dividerCount hdiv + (fun lower hr hm => hfewer lower (by omega) hm) hlarge' hterm' helem' + a b ha hac hab hmissing a₁ b₁ a₂ b₂ P₁ P₂ hp₁ hp₂ hpaths haa hbb horder + f₁ f₂ hf₁ hf₂ hi₁ hi₂ hpf₁ hpf₂ hinside + · rcases hthird with ⟨a₃, b₃, P₃, f₃, hp₃, hpaths₁₃, hpaths₂₃, + haa₃, haa₃', hbb₃, hbb₃', horder₃, hf₃, hi₃, hpf₃, hnoBetter⟩ + by_cases hinside : b₃ ∈ TreeSequenceVertexSet + (HierarchyStarredStage K (Fin.last K.dividerCount)) + · exact Step1CaseTwoInsideStar G k e0 input' T' psi other hmp' hpos + hproper' hone' (fun lower hp hlt hm => hlower lower hp (by omega) hm) + base' K good' H.dividerCount hdiv + (fun lower hr hm => hfewer lower (by omega) hm) hlarge' hterm' helem' + a b ha hac hab hnotmissing a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ hp₁ hp₂ hp₃ + hpaths hpaths₁₃ hpaths₂₃ haa haa₃ haa₃' hbb hbb₃ hbb₃' horder horder₃ + f₁ f₂ f₃ hf₁ hf₂ hf₃ hi₁ hi₂ hi₃ hpf₁ hpf₂ hpf₃ hinside theta hta htb + htm htcstar htc hnoSmaller + · exact Step1CaseTwoOutsideStar G k e0 input' T' psi other hmp' hpos + hproper' hone' (fun lower hp hlt hm => hlower lower hp (by omega) hm) + base' K good' H.dividerCount hdiv + (fun lower hr hm => hfewer lower (by omega) hm) hlarge' hterm' helem' + a b ha hac hab hnotmissing a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ hp₁ hp₂ hp₃ + hpaths hpaths₁₃ hpaths₂₃ haa haa₃ haa₃' hbb hbb₃ hbb₃' horder horder₃ + f₁ f₂ f₃ hf₁ hf₂ hf₃ hi₁ hi₂ hi₃ hpf₁ hpf₂ hpf₃ hinside hnoBetter + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyStageMissingColors.lean b/LeanPool/GoldbergSeymour/HierarchyStageMissingColors.lean new file mode 100644 index 0000000000..75df977852 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyStageMissingColors.lean @@ -0,0 +1,36 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStarredStage + +/-! +# Hierarchy Stage Missing Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Missing colors at the ladder base or the corresponding ordinary hierarchy stage. -/ +noncomputable def HierarchyStageMissingColors {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} {base : HierarchyBase ett phi} + (H : TashkinovHierarchy ett base) (j : Fin (H.dividerCount + 1)) : Finset (Fin k) := by + classical + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + exact Fin.cases (TreeMissingColors phi Tn) + (fun i : Fin H.dividerCount => + TreeMissingColors phi (H.stage i.succ.castSucc)) j + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyStarredStage.lean b/LeanPool/GoldbergSeymour/HierarchyStarredStage.lean new file mode 100644 index 0000000000..60bfe7a890 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyStarredStage.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovHierarchy + +/-! +# Hierarchy Starred Stage + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The base core at index zero and the ordinary preceding stage at later indices. -/ +def HierarchyStarredStage {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} {base : HierarchyBase ett phi} + (H : TashkinovHierarchy ett base) (j : Fin (H.dividerCount + 1)) : TreeSequence G e0 := + Fin.cases base.core (fun i : Fin H.dividerCount => H.stage i.succ.castSucc) j + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyStoredColorsAntitone.lean b/LeanPool/GoldbergSeymour/HierarchyStoredColorsAntitone.lean new file mode 100644 index 0000000000..5d9c767f53 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyStoredColorsAntitone.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt + +/-! +# Hierarchy Stored Colors Antitone + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchyStoredColorsAntitone {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} + {base : HierarchyBase ett phi} (H : TashkinovHierarchy ett base) + (i : Fin H.dividerCount) : + HierarchyStoredColorsAt H i.succ ⊆ + HierarchyStoredColorsAt H i.castSucc := by + classical + unfold HierarchyStoredColorsAt + intro c hc + have initialVertices : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hab v hv + unfold TreeSequenceVertexSet at hv ⊢ + simp only [Finset.mem_image] at hv ⊢ + obtain ⟨x, hx, rfl⟩ := hv + obtain ⟨hlen, hvertices, hedges⟩ := hab + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) x, Finset.mem_univ _, ?_⟩ + exact hvertices x + have hstage : TreeSequenceInitialSegment + (HierarchyStarredStage H i.castSucc) + (HierarchyStarredStage H i.succ) := by + by_cases hi : i.val = 0 + · have hi' : i = ⟨0, Fin.pos i⟩ := Fin.ext hi + rw [hi'] + simpa [HierarchyStarredStage] using H.coreInsideFirst + · have hne : i.castSucc ≠ 0 := by + intro hz + apply hi + exact congrArg Fin.val hz + change TreeSequenceInitialSegment + (Fin.cases base.core (fun j => H.stage j.castSucc.succ) i.castSucc) + (H.stage i.castSucc.succ) + have hindex : (i.castSucc.pred hne).succ = i.castSucc := + Fin.succ_pred i.castSucc hne + have hstar : + Fin.cases base.core (fun j => H.stage j.castSucc.succ) i.castSucc = + H.stage i.castSucc.castSucc := by + rw [← hindex] + rfl + rw [hstar] + exact H.nested i.castSucc + apply Finset.mem_sdiff.mpr + refine ⟨(Finset.mem_sdiff.mp hc).1, ?_⟩ + intro hprev + apply (Finset.mem_sdiff.mp hc).2 + unfold TreeMissingColors at hprev ⊢ + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hprev + apply Finset.mem_biUnion.mpr + refine ⟨v, ?_, hcv⟩ + exact initialVertices hstage hv + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyStoredColorsAt.lean b/LeanPool/GoldbergSeymour/HierarchyStoredColorsAt.lean new file mode 100644 index 0000000000..77dc99e2ff --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyStoredColorsAt.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStarredStage + +/-! +# Hierarchy Stored Colors At + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Terminal stored colors excluding colors missing on the specified starred stage. -/ +noncomputable def HierarchyStoredColorsAt {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} {base : HierarchyBase ett phi} + (H : TashkinovHierarchy ett base) (j : Fin (H.dividerCount + 1)) : Finset (Fin k) := by + classical + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + exact TashkinovStoredColors ett.series.data n \ + TreeMissingColors phi (HierarchyStarredStage H j) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyStoredColorsCardinality.lean b/LeanPool/GoldbergSeymour/HierarchyStoredColorsCardinality.lean new file mode 100644 index 0000000000..16b44dc7b3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyStoredColorsCardinality.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.TashkinovStoredColorsCardinality + +/-! +# Hierarchy Stored Colors Cardinality + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchyStoredColorsCardinality {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} + {base : HierarchyBase ett phi} (H : TashkinovHierarchy ett base) + (j : Fin (H.dividerCount + 1)) : + (HierarchyStoredColorsAt H j).card ≤ ett.rounds := by + classical + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + have hsub : HierarchyStoredColorsAt H j ⊆ + TashkinovStoredColors ett.series.data n := by + intro c hc + unfold HierarchyStoredColorsAt at hc + exact (Finset.mem_sdiff.mp hc).1 + calc + (HierarchyStoredColorsAt H j).card ≤ + (TashkinovStoredColors ett.series.data n).card := + Finset.card_le_card hsub + _ ≤ n.val := TashkinovStoredColorsCardinality G k ett.rounds e0 input + ett.series n + _ = ett.rounds := by simp [n] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyTailMissingColorExclusion.lean b/LeanPool/GoldbergSeymour/HierarchyTailMissingColorExclusion.lean new file mode 100644 index 0000000000..151f711b69 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyTailMissingColorExclusion.lean @@ -0,0 +1,974 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyTailPrefix + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.RevisitingExtensionSeedStoredColor +public import LeanPool.GoldbergSeymour.SimpleExtensionSeedStoredColor +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Hierarchy Tail Missing Color Exclusion + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_segmentTrans_135.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y + Z → TreeSequenceInitialSegment X Z := by + classical + intro V E G e0 X Y Z hXY hYZ + rcases hXY with ⟨hxy, hvxy, hexy⟩ + rcases hYZ with ⟨hyz, hvyz, heyz⟩ + refine ⟨le_trans hxy hyz, ?_, ?_⟩ + · intro r + have hmid := hvyz (Fin.castLE (Nat.succ_le_succ hxy) r) + simpa using hmid.trans (hvxy r) + · intro r + have hmid := heyz (Fin.castLE hxy r) + simpa using hmid.trans (hexy r) + +private theorem helper_commonPrefix_148.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y + Z → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by + classical + intro V E G e0 X Y Z hXZ hYZ hXY + rcases hXZ with ⟨hxz, hvxz, hexz⟩ + rcases hYZ with ⟨hyz, hvyz, heyz⟩ + refine ⟨hXY, ?_, ?_⟩ + · intro r + calc + Y.vertex (Fin.castLE (Nat.succ_le_succ hXY) r) = + Z.vertex (Fin.castLE (Nat.succ_le_succ hyz) + (Fin.castLE (Nat.succ_le_succ hXY) r)) := + (hvyz _).symm + _ = Z.vertex (Fin.castLE (Nat.succ_le_succ hxz) r) := by + congr 1 + _ = X.vertex r := hvxz r + · intro r + calc + Y.edge (Fin.castLE hXY r) = + Z.edge (Fin.castLE hyz (Fin.castLE hXY r)) := + (heyz _).symm + _ = Z.edge (Fin.castLE hxz r) := by + congr 1 + _ = X.edge r := hexz r + +private theorem helper_prefixToTree_173.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (X : TreeSequence G e0) (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmX : m ≤ X.length), + TreeSequenceInitialSegment (TreeSequencePrefix X m hm hmX) X := by + classical + intro V E G e0 X m hm hmX + refine ⟨hmX, ?_, ?_⟩ + · intro r + simp [TreeSequencePrefix] + · intro r + simp [TreeSequencePrefix] + +private theorem helper_stageToEnd_206.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (i : ℕ) (_ : + Fin (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )).length), ( + ∀ (X : TreeSequence G e0), TreeSequenceInitialSegment X X) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage r.castSucc) + (H.stage (Fin.last (H.dividerCount + (1 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H i t segmentRefl segmentTrans + have forward : ∀ r : Fin (H.dividerCount + 1), ∀ d : ℕ, + ∀ hbound : r.val + d ≤ H.dividerCount + 1, + TreeSequenceInitialSegment (H.stage r.castSucc) + (H.stage ⟨r.val + d, by omega⟩) := by + intro r d + induction d with + | zero => + intro hbound + exact segmentRefl _ + | succ d ih => + intro hbound + let s : Fin (H.dividerCount + 1) := + ⟨r.val + d, by omega⟩ + have hfirst := ih (by omega) + have hnext := H.nested s + have hmid : H.stage s.castSucc = + H.stage ⟨r.val + d, by omega⟩ := by + congr 1 + have hlast : H.stage s.succ = + H.stage ⟨r.val + Nat.succ d, by omega⟩ := by + apply congrArg H.stage + apply Fin.ext + rfl + rw [← hmid] at hfirst + rw [hlast] at hnext + exact segmentTrans hfirst hnext + intro r + have hforward := forward r (H.dividerCount + 1 - r.val) (by omega) + simpa [Fin.last] using hforward + +private theorem helper_hAT_238.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (i : ℕ) (_ : + Fin (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )).length), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage r.castSucc) + (H.stage (Fin.last (H.dividerCount + (1 : ℕ))))) → TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H i t q A stageToEnd + rw [show T = H.stage (Fin.last (H.dividerCount + 1)) from + H.terminalStage.symm] + by_cases hq : H.dividerCount = 0 + · have hA : A = base.core := by + dsimp [A, q, HierarchyStarredStage] + have hz : Fin.last H.dividerCount = + (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [hq] + rw [hz] + rfl + have hs : H.stage (Fin.last (H.dividerCount + 1)) = H.stage 1 := by + apply congrArg H.stage + apply Fin.ext + simp [hq] + simpa [hA, hs] using H.coreInsideFirst + · have hs : A = H.stage q.castSucc := by + have hqsucc : ∃ r : Fin H.dividerCount, q = r.succ := by + refine ⟨⟨H.dividerCount - 1, by omega⟩, ?_⟩ + apply Fin.ext + simp [q] + omega + rcases hqsucc with ⟨r, hr⟩ + change HierarchyStarredStage H q = H.stage q.castSucc + rw [hr] + dsimp [HierarchyStarredStage] + rw [hs] + exact stageToEnd q + +private theorem helper_stageFromFirst_267.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (i : ℕ) (_ : + Fin (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )).length), ( + ∀ (X : TreeSequence G e0), TreeSequenceInitialSegment X X) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (d : ℕ) (hd : d ≤ H.dividerCount), TreeSequenceInitialSegment (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨(1 : ℕ) + d, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H i t segmentRefl segmentTrans d + induction d with + | zero => + intro hd + exact segmentRefl _ + | succ d ih => + intro hd + have hprev := ih (by omega) + have hnext := H.nested ⟨1 + d, by omega⟩ + have hnext' : TreeSequenceInitialSegment + (H.stage ⟨1 + d, by omega⟩) + (H.stage ⟨1 + (d + 1), by omega⟩) := by + simpa [Nat.add_assoc] using hnext + exact segmentTrans hprev hnext' + +private theorem helper_hAeqPositive_284.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (i : ℕ) (_ : + Fin (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )).length), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; (0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H i t q A hq + have hlast : q = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp [q] + omega + dsimp [A, HierarchyStarredStage] + rw [hlast] + simp only [Fin.cases] + apply congrArg H.stage + apply Fin.ext + simp + omega + +private theorem helper_hFirstA_298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (i : ℕ) (_ : + Fin (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )).length), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; ( + ∀ (d : ℕ) (hd : d ≤ H.dividerCount), TreeSequenceInitialSegment (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨(1 : ℕ) + d, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))) → ((0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (hq : (0 : ℕ) < H.dividerCount), TreeSequenceInitialSegment (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H i t q A stageFromFirst hAeqPositive hq + have hs := stageFromFirst (H.dividerCount - 1) (by omega) + rw [hAeqPositive hq] + convert hs using 1 + apply congrArg H.stage + apply Fin.ext + simp + omega + +private theorem helper_hCoreA_307.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (i : ℕ) (_ : + Fin (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega + )).length), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; ( + ∀ (X : TreeSequence G e0), TreeSequenceInitialSegment X X) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ (hq : (0 : ℕ) < H.dividerCount), TreeSequenceInitialSegment (H.stage (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) A) → TreeSequenceInitialSegment base.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H i t q A segmentRefl segmentTrans hFirstA + by_cases hq : H.dividerCount = 0 + · have hA : A = base.core := by + simp [A, q, HierarchyStarredStage, Fin.last, Fin.cases, hq] + rw [hA] + exact segmentRefl _ + · exact segmentTrans H.coreInsideFirst (hFirstA (Nat.pos_of_ne_zero hq)) + +private theorem helper_finishNonparallel_499.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (i : ℕ), (1 + : ℕ) ≤ i → + ∀ (beta : Fin k) (t : Fin (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + i) T.length) ( + have this : (1 : ℕ) ≤ T.length := T.positive; + have this_1 : (1 : ℕ) ≤ (HierarchyStarredStage H (Fin.last H.dividerCount)).length := + (HierarchyStarredStage H (Fin.last H.dividerCount)).positive; + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ↦ + by + omega + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length)).length), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let Ty : ℕ → TreeSequence G e0 := fun (j : ℕ) ↦ TreeSequencePrefix T (min (A.length + j) + T.length) ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + by + omega + ) (Nat.min_le_right (A.length + j) T.length); + let B : TreeSequence G e0 := Ty (ell - (1 : ℕ)); + let Ti : TreeSequence G e0 := Ty i; A.length ≤ (↑t : ℕ) → phi (Ti.edge t) = some beta → ( + ∀ (X : TreeSequence G e0), TreeSequenceInitialSegment X X) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage r.castSucc) + (H.stage (Fin.last (H.dividerCount + (1 : ℕ))))) → ( + ∀ (hq : (0 : ℕ) < H.dividerCount), TreeSequenceInitialSegment (H.stage (⟨(1 : ℕ), + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) A) → Ti.length = A.length + i → B.length = A.length + + (ell - (1 : ℕ)) → TreeSequenceInitialSegment A Ti → ( + ∀ {X : TreeSequence G e0}, TashkinovAugmentationSequence phi X Ti → X.length ≤ (↑t : ℕ) → + False) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Tfinal : TreeSequence G e0 := ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))); + TreeSequenceInitialSegment Ti Tfinal → TashkinovSeriesStep G k ett.rounds e0 input + ett.series.data n → ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE → + ∀ (f : E), ett.series.data.connectingEdges n = ({ f } : Finset E) → + ∀ (seed : TreeSequence G e0), TreeSequenceAdjoinEdge Tn f seed → TashkinovClosure phi seed + Tfinal → (phi f = some beta → beta ∈ TashkinovStoredColors ett.series.data n) → + H.dividerCount = (0 : ℕ) ∧ base.core = ett.series.data.tree (Fin.last ett.rounds).castSucc + ∧ (↑t : ℕ) = A.length ∧ + ∃ (f : E), TashkinovSeriesStep G k ett.rounds e0 input ett.series.data (Fin.last ett.rounds) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ Ti.edge t = f + ∧ phi f = some beta ∧ beta ∈ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H i hi beta t q A ell Ty B Ti htA hedge + segmentRefl segmentTrans commonPrefix stageToEnd hFirstA hTiLen hBLen hATi + augmentationContradiction n Tn Tfinal hTiFinal hstep hkind f hedges seed hadjoin hclosure + hstored + have hnotPE : ett.series.data.kind n ≠ + some TashkinovExtensionKind.PE := by + intro hpe + rcases hkind with hse | hre + · rw [hpe] at hse + simp at hse + · rw [hpe] at hre + simp at hre + have hcore : base.core = Tn := by + simpa [Tn, n] using base.nonparallel hnotPE + have hseedFinal : TreeSequenceInitialSegment seed Tfinal := + TashkinovAugmentationSequenceInitialSegment phi seed Tfinal + hclosure.1 + have hqzero : H.dividerCount = 0 := by + by_contra hqzero + have hqpos : 0 < H.dividerCount := Nat.pos_of_ne_zero hqzero + have hfirstT : TreeSequenceInitialSegment + (H.stage ⟨1, by omega⟩) T := by + have hs := stageToEnd (⟨1, by omega⟩ : + Fin (H.dividerCount + 1)) + simpa [H.terminalStage] using hs + have hfirstFinal : TreeSequenceInitialSegment + (H.stage ⟨1, by omega⟩) Tfinal := + segmentTrans hfirstT ett.belowFinal + have hseedLen : seed.length = Tn.length + 1 := hadjoin.1 + have hTnFirst : Tn.length < (H.stage ⟨1, by omega⟩).length := by + have hs := H.strict (0 : Fin (H.dividerCount + 1)) + have hstageZero : H.stage (Fin.castSucc + (0 : Fin (H.dividerCount + 1))) = Tn := by + simpa [Tn, n] using H.baseStage + rw [hstageZero] at hs + simpa using hs + have hseedFirst : TreeSequenceInitialSegment seed + (H.stage ⟨1, by omega⟩) := + commonPrefix hseedFinal hfirstFinal (by omega) + have hseedA : TreeSequenceInitialSegment seed A := + segmentTrans hseedFirst (hFirstA hqpos) + have hseedTi : TreeSequenceInitialSegment seed Ti := + segmentTrans hseedA hATi + have hseqSeedTi : TashkinovAugmentationSequence phi seed Ti := + TashkinovAugmentationSequenceRestrict phi seed Ti Tfinal + hclosure.1 hseedTi hTiFinal + have hseqATi : TashkinovAugmentationSequence phi A Ti := + TashkinovAugmentationSequenceSuffix phi seed A Ti + hseqSeedTi hseedA hATi + exact augmentationContradiction hseqATi htA + have hAcore : A = base.core := by + simp [A, q, HierarchyStarredStage, Fin.last, Fin.cases, hqzero] + have hATn : A = Tn := hAcore.trans hcore + have htEq : t.val = A.length := by + apply Nat.le_antisymm + · by_contra hnotle + have hAlt : A.length < t.val := by omega + have hseedLen : seed.length = A.length + 1 := by + rw [hadjoin.1, hATn] + have hseedTi : TreeSequenceInitialSegment seed Ti := + commonPrefix hseedFinal hTiFinal (by omega) + have hseqSeedTi : TashkinovAugmentationSequence phi seed Ti := + TashkinovAugmentationSequenceRestrict phi seed Ti Tfinal + hclosure.1 hseedTi hTiFinal + exact augmentationContradiction hseqSeedTi (by omega) + · exact htA + obtain ⟨r, hrval, hredge⟩ := + HierarchyNonparallelFirstEdge H f hkind hedges + have hstageOne : H.stage ⟨1, by omega⟩ = T := by + calc + H.stage ⟨1, by omega⟩ = + H.stage (Fin.last (H.dividerCount + 1)) := by + apply congrArg H.stage + apply Fin.ext + simp [hqzero] + _ = T := H.terminalStage + have hstageOneT : TreeSequenceInitialSegment + (H.stage ⟨1, by omega⟩) T := by + rw [hstageOne] + exact segmentRefl T + have hstageOneFinal : TreeSequenceInitialSegment + (H.stage ⟨1, by omega⟩) Tfinal := + segmentTrans hstageOneT ett.belowFinal + have hedgeExact : Ti.edge t = f := by + calc + Ti.edge t = Tfinal.edge (Fin.castLE hTiFinal.1 t) := + (hTiFinal.2.2 t).symm + _ = Tfinal.edge (Fin.castLE hstageOneFinal.1 r) := by + congr 1 + apply Fin.ext + simp only [Fin.val_castLE] + rw [hrval, htEq, hATn] + _ = (H.stage ⟨1, by omega⟩).edge r := + hstageOneFinal.2.2 r + _ = f := hredge + have hfcolor : phi f = some beta := by + rw [← hedgeExact] + exact hedge + have hstored' := hstored hfcolor + refine ⟨hqzero, ?_, htEq, f, ?_, ?_, ?_, hedgeExact, hfcolor, ?_⟩ + · simpa [Tn, n] using hcore + · simpa [n] using hstep + · simpa [n] using hkind + · simpa [n] using hedges + · simpa [n] using hstored' + +private theorem helper_continuation_613.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (i : ℕ), (1 + : ℕ) ≤ i → + ∀ (beta : Fin k) (t : Fin (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last + H.dividerCount)).length + i) T.length) ( + by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ) (Nat.min_le_right ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) + T.length)).length), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let Ty : ℕ → TreeSequence G e0 := fun (j : ℕ) ↦ TreeSequencePrefix T (min (A.length + j) + T.length) ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + j) T.length) ↦ + by + omega + ) (Nat.min_le_right (A.length + j) T.length); + let B : TreeSequence G e0 := Ty (ell - (1 : ℕ)); + let Ti : TreeSequence G e0 := Ty i; A.length ≤ (↑t : ℕ) → phi (Ti.edge t) = some beta → ( + ∀ (X : TreeSequence G e0), TreeSequenceInitialSegment X X) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage r.castSucc) + (H.stage (Fin.last (H.dividerCount + (1 : ℕ))))) → ( + ∀ (hq : (0 : ℕ) < H.dividerCount), TreeSequenceInitialSegment (H.stage (⟨(1 : ℕ), + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) A) → TreeSequenceInitialSegment base.core A → Ti.length = + A.length + i → B.length = A.length + (ell - (1 : ℕ)) → TreeSequenceInitialSegment A Ti → ( + ∀ {X : TreeSequence G e0}, TashkinovAugmentationSequence phi X Ti → X.length ≤ (↑t : ℕ) → + False) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Tfinal : TreeSequence G e0 := ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))); + TreeSequenceInitialSegment Ti Tfinal → phi = ett.series.data.coloring n → n.succ = + Fin.last (ett.rounds + (1 : ℕ)) → H.dividerCount = (0 : ℕ) ∧ base.core = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ (↑t : ℕ) = A.length ∧ + ∃ (f : E), TashkinovSeriesStep G k ett.rounds e0 input ett.series.data (Fin.last ett.rounds) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ Ti.edge t = f + ∧ phi f = some beta ∧ beta ∈ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H i hi beta t q A ell Ty B Ti htA hedge + segmentRefl segmentTrans commonPrefix stageToEnd hFirstA hCoreA hTiLen hBLen hATi + augmentationContradiction n Tn Tfinal hTiFinal hphiN hnSucc + have finishNonparallel + (hstep : TashkinovSeriesStep G k ett.rounds e0 input + ett.series.data n) + (hkind : ett.series.data.kind n = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) + (f : E) (hedges : ett.series.data.connectingEdges n = {f}) + (seed : TreeSequence G e0) + (hadjoin : TreeSequenceAdjoinEdge Tn f seed) + (hclosure : TashkinovClosure phi seed Tfinal) + (hstored : phi f = some beta → + beta ∈ TashkinovStoredColors ett.series.data n) : + H.dividerCount = 0 ∧ + base.core = ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + t.val = A.length ∧ + ∃ f : E, + TashkinovSeriesStep G k ett.rounds e0 input ett.series.data + (Fin.last ett.rounds) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + Ti.edge t = f ∧ phi f = some beta ∧ + beta ∈ TashkinovStoredColors ett.series.data + (Fin.last ett.rounds) := by + apply helper_finishNonparallel_499 <;> assumption + have hcert := ett.series.certified n + generalize hn : n = j at hcert + cases hcert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exfalso + have hnval := congrArg Fin.val hn + simp [n] at hnval + have hrounds := ett.roundsPositive + omega + | SE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hkindN : ett.series.data.kind n = + some TashkinovExtensionKind.SE := by + rw [hn] + exact currentKind + have hedgesN : ett.series.data.connectingEdges n = {choice.edge} := by + rw [hn] + exact currentEdges + have hadjoinN : TreeSequenceAdjoinEdge Tn choice.edge adjoined := by + simpa [Tn, hn] using adjoinedExactly + have hclosureN : TashkinovClosure phi adjoined Tfinal := by + have hc := closedExtension + rw [← hn, hnSucc, ← hphiN] at hc + exact hc + apply finishNonparallel (ett.series.certified n) (Or.inl hkindN) + choice.edge hedgesN adjoined hadjoinN hclosureN + intro hfcolor + exact SimpleExtensionSeedStoredColor G k ett.rounds e0 input + ett.series.data n (ett.series.certified n) hkindN choice.edge + hedgesN beta (by rw [← hphiN]; exact hfcolor) + | PE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hkindN : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by + rw [hn] + exact currentKind + obtain ⟨hchosen, hbaseClosure, ⟨hunion⟩⟩ := base.parallel hkindN + have hTnA : TreeSequenceInitialSegment Tn A := + segmentTrans (by simpa [Tn, n] using hunion.leftSegment) hCoreA + have hclosureN : TashkinovClosure phi Tn Tfinal := by + have hc := closedExtension + rw [← hn, hnSucc, ← hphiN] at hc + exact hc + have hTnTi : TreeSequenceInitialSegment Tn Ti := + segmentTrans hTnA hATi + have hseqTnTi : TashkinovAugmentationSequence phi Tn Ti := + TashkinovAugmentationSequenceRestrict phi Tn Ti Tfinal + hclosureN.1 hTnTi hTiFinal + have hseqATi : TashkinovAugmentationSequence phi A Ti := + TashkinovAugmentationSequenceSuffix phi Tn A Ti + hseqTnTi hTnA hATi + exact (augmentationContradiction hseqATi htA).elim + | RE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hkindN : ett.series.data.kind n = + some TashkinovExtensionKind.RE := by + rw [hn] + exact currentKind + have hedgesN : ett.series.data.connectingEdges n = {available.edge} := by + rw [hn] + exact currentEdges + have hadjoinN : TreeSequenceAdjoinEdge Tn available.edge adjoined := by + simpa [Tn, hn] using adjoinedExactly + have hclosureN : TashkinovClosure phi adjoined Tfinal := by + have hc := closedExtension + rw [← hn, hnSucc, ← hphiN] at hc + exact hc + apply finishNonparallel (ett.series.certified n) (Or.inr hkindN) + available.edge hedgesN adjoined hadjoinN hclosureN + intro hfcolor + exact RevisitingExtensionSeedStoredColor G k ett.rounds e0 input + ett.series.data n (ett.series.certified n) hkindN available.edge + hedgesN beta (by rw [← hphiN]; exact hfcolor) + +theorem HierarchyTailMissingColorExclusion {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) + (hpenultimate : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyTailPrefix H + (T.length - (HierarchyStarredStage H (Fin.last H.dividerCount)).length - 1)))) : + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := T.length - A.length + let Ty := fun i : ℕ => + TreeSequencePrefix T (min (A.length + i) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + ∀ i : ℕ, 1 ≤ i → i < ell → + ∀ beta : Fin k, + beta ∈ MissingColors G phi + ((Ty i).vertex (Fin.last (Ty i).length)) → + ∀ t : Fin (Ty i).length, + A.length ≤ t.val → t.val < A.length + i → + phi ((Ty i).edge t) = some beta → + H.dividerCount = 0 ∧ base.core = Tn ∧ + t.val = A.length ∧ + ∃ f : E, + TashkinovSeriesStep G k ett.rounds e0 input + ett.series.data n ∧ + (ett.series.data.kind n = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = + some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges n = {f} ∧ + (Ty i).edge t = f ∧ phi f = some beta ∧ + beta ∈ TashkinovStoredColors ett.series.data n := by + classical + dsimp only at hpenultimate ⊢ + intro i hi hilt beta hbeta t htA hti hedge + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := T.length - A.length + let Ty := fun j : ℕ => + TreeSequencePrefix T (min (A.length + j) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + let B := Ty (ell - 1) + let Ti := Ty i + change ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) at hpenultimate + change beta ∈ MissingColors G phi (Ti.vertex (Fin.last Ti.length)) at hbeta + change i < ell at hilt + change A.length ≤ t.val at htA + change t.val < A.length + i at hti + change phi (Ti.edge t) = some beta at hedge + change H.dividerCount = 0 ∧ + base.core = ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + t.val = A.length ∧ + ∃ f : E, + TashkinovSeriesStep G k ett.rounds e0 input ett.series.data + (Fin.last ett.rounds) ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + Ti.edge t = f ∧ phi f = some beta ∧ + beta ∈ TashkinovStoredColors ett.series.data + (Fin.last ett.rounds) + have segmentRefl (X : TreeSequence G e0) : + TreeSequenceInitialSegment X X := + ⟨le_rfl, (by intro r; rfl), (by intro r; rfl)⟩ + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + exact helper_segmentTrans_135 (@G) (@e0) (@hXY) (@hYZ) + have commonPrefix {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) + (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + exact helper_commonPrefix_148 (@G) (@e0) (@hXZ) (@hYZ) (@hXY) + have prefixToTree (X : TreeSequence G e0) (m : ℕ) + (hm : 1 ≤ m) (hmX : m ≤ X.length) : + TreeSequenceInitialSegment (TreeSequencePrefix X m hm hmX) X := by + exact helper_prefixToTree_173 (@G) (@e0) (@X) (@m) (@hm) (@hmX) + have stageToEnd : ∀ r : Fin (H.dividerCount + 1), + TreeSequenceInitialSegment (H.stage r.castSucc) + (H.stage (Fin.last (H.dividerCount + 1))) := by + apply helper_stageToEnd_206 <;> assumption + have hAT : TreeSequenceInitialSegment A T := by + exact helper_hAT_238 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@i) (@t) + (@stageToEnd) + have stageFromFirst : ∀ d : ℕ, ∀ hd : d ≤ H.dividerCount, + TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) + (H.stage ⟨1 + d, by omega⟩) := by + apply helper_stageFromFirst_267 <;> assumption + have hAeqPositive (hq : 0 < H.dividerCount) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + exact helper_hAeqPositive_284 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@i) + (@t) (@hq) + have hFirstA (hq : 0 < H.dividerCount) : + TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) A := by + exact helper_hFirstA_298 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@i) (@t) + (@stageFromFirst) + (@hAeqPositive) (@hq) + have hCoreA : TreeSequenceInitialSegment base.core A := by + apply helper_hCoreA_307 <;> assumption + have hsum : A.length + ell = T.length := by + dsimp [ell] + exact Nat.add_sub_of_le hAT.1 + have hell : 2 ≤ ell := by omega + have hTiBound : A.length + i ≤ T.length := by omega + have hTiLen : Ti.length = A.length + i := by + simp [Ti, Ty, TreeSequencePrefix, Nat.min_eq_left hTiBound] + have htTi : t.val < Ti.length := by + exact t.isLt + have hBBound : A.length + (ell - 1) ≤ T.length := by omega + have hBLen : B.length = A.length + (ell - 1) := by + simp [B, Ty, TreeSequencePrefix, Nat.min_eq_left hBBound] + have hTiT : TreeSequenceInitialSegment Ti T := by + dsimp [Ti, Ty] + exact prefixToTree T _ _ _ + have hBT : TreeSequenceInitialSegment B T := by + dsimp [B, Ty] + exact prefixToTree T _ _ _ + have hATi : TreeSequenceInitialSegment A Ti := + commonPrefix hAT hTiT (by rw [hTiLen]; omega) + have hTiB : TreeSequenceInitialSegment Ti B := + commonPrefix hTiT hBT (by rw [hTiLen, hBLen]; omega) + have augmentationContradiction {X : TreeSequence G e0} + (hseq : TashkinovAugmentationSequence phi X Ti) + (hXt : X.length ≤ t.val) : False := by + obtain ⟨hstep, hlast⟩ := + TashkinovAugmentationSequencePosition phi X Ti hseq t hXt + let Bt := TreeSequencePrefix Ti t.val + (le_trans X.positive hXt) (Nat.le_of_lt htTi) + let Bt1 := TreeSequencePrefix Ti (t.val + 1) + (by omega) (Nat.succ_le_of_lt htTi) + change TashkinovAugmentation phi Bt Bt1 at hstep + change Bt1.edge (Fin.last t.val) = Ti.edge t at hlast + rcases hstep with ⟨hstepLen, hBtBt1, c, hc, hcmissing⟩ + have hcEdge : phi (Bt1.edge (Fin.last t.val)) = some beta := by + rw [hlast] + exact hedge + have hcbeta : c = beta := Option.some.inj (hc.symm.trans hcEdge) + subst c + simp only [TreeMissingColors, Finset.mem_biUnion] at hcmissing + rcases hcmissing with ⟨z, hzBt, hzmissing⟩ + have hBtTi : TreeSequenceInitialSegment Bt Ti := by + dsimp [Bt] + exact prefixToTree Ti _ _ _ + have hzB : z ∈ TreeSequenceVertexSet B := + TreeSequenceInitialSegmentVertexSetSubset + (segmentTrans hBtTi hTiB) hzBt + have hyTi : Ti.vertex (Fin.last Ti.length) ∈ + TreeSequenceVertexSet Ti := by + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + exact ⟨Fin.last Ti.length, rfl⟩ + have hyB : Ti.vertex (Fin.last Ti.length) ∈ + TreeSequenceVertexSet B := + TreeSequenceInitialSegmentVertexSetSubset hTiB hyTi + have hzy : z ≠ Ti.vertex (Fin.last Ti.length) := by + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hzBt + rcases hzBt with ⟨s, rfl⟩ + intro heq + have hvertex := hBtTi.2.1 s + have hinj : Fin.castLE (Nat.succ_le_succ hBtTi.1) s = + Fin.last Ti.length := + Ti.vertex_injective (hvertex.trans heq) + have hvals := congrArg Fin.val hinj + have hsle : s.val ≤ t.val := by + have hs := s.isLt + simp [Bt, TreeSequencePrefix] at hs + omega + simp only [Fin.val_castLE, Fin.val_last] at hvals + omega + have hdisjoint := hpenultimate hzB hyB hzy + exact (Finset.disjoint_left.mp hdisjoint) hzmissing hbeta + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Tfinal := ett.series.data.tree (Fin.last (ett.rounds + 1)) + have hTiFinal : TreeSequenceInitialSegment Ti Tfinal := + segmentTrans hTiT ett.belowFinal + have hphiN : phi = ett.series.data.coloring n := by + simpa [n] using ett.generatingColoring + have hnSucc : n.succ = Fin.last (ett.rounds + 1) := by + apply Fin.ext + simp [n] + apply helper_continuation_613 <;> assumption +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyTailPrefix.lean b/LeanPool/GoldbergSeymour/HierarchyTailPrefix.lean new file mode 100644 index 0000000000..f19bf45d64 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyTailPrefix.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStarredStage + +/-! +# Prefixes of a hierarchy's terminal tail + +Adapted from Wesley Pegden's Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. This construction applies to any +hierarchy, independently of the counterexample data used in the main proof. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The prefix ending `i` edges after the last starred stage, capped by the full tree. -/ +noncomputable def HierarchyTailPrefix {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T phi} {base : HierarchyBase ett phi} + (H : TashkinovHierarchy ett base) (i : ℕ) : TreeSequence G e0 := + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + TreeSequencePrefix T (min (A.length + i) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) (Nat.min_le_right _ _) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColors.lean b/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColors.lean new file mode 100644 index 0000000000..3e3aaadbb4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColors.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt + +/-! +# Hierarchy Terminal Stored Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Terminal stored colors excluding colors missing on the full tree. -/ +noncomputable def HierarchyTerminalStoredColors {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} {base : HierarchyBase ett phi} + (_ : TashkinovHierarchy ett base) : Finset (Fin k) := by + classical + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + exact TashkinovStoredColors ett.series.data n \ TreeMissingColors phi T + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColorsSubsetLast.lean b/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColorsSubsetLast.lean new file mode 100644 index 0000000000..8d8204de1a --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColorsSubsetLast.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors + +/-! +# Hierarchy Terminal Stored Colors Subset Last + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem HierarchyTerminalStoredColorsSubsetLast {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} + {base : HierarchyBase ett phi} (H : TashkinovHierarchy ett base) : + HierarchyTerminalStoredColors H ⊆ + HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ + (∀ eta : Fin k, + eta ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) → + eta ∉ HierarchyTerminalStoredColors H → + eta ∈ TreeMissingColors phi T) := by + classical + have segmentRight {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) (hBC : B = C) : + TreeSequenceInitialSegment A C := by + subst C + exact hAB + have starToTerminal : TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T := by + by_cases hz : H.dividerCount = 0 + · have hstar : HierarchyStarredStage H (Fin.last H.dividerCount) = + base.core := by + have hlast : Fin.last H.dividerCount = + (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [hz] + rw [hlast] + rfl + rw [hstar] + have hindex : (1 : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [hz] + have hstage : H.stage (1 : Fin (H.dividerCount + 2)) = T := + (congrArg H.stage hindex).trans H.terminalStage + exact segmentRight H.coreInsideFirst hstage + · let i : Fin H.dividerCount := + ⟨H.dividerCount - 1, Nat.sub_lt (Nat.zero_lt_of_ne_zero hz) (by omega)⟩ + have hlast : Fin.last H.dividerCount = i.succ := by + apply Fin.ext + simp [i] + omega + have hstar : HierarchyStarredStage H (Fin.last H.dividerCount) = + H.stage i.succ.castSucc := by + rw [hlast] + rfl + rw [hstar] + have hterminal : H.stage i.succ.succ = T := by + have hindex : i.succ.succ = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [i] + omega + exact (congrArg H.stage hindex).trans H.terminalStage + exact segmentRight (H.nested i.succ) hterminal + have vertexSubset : TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount)) ⊆ + TreeSequenceVertexSet T := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨i, rfl⟩ := hv + exact ⟨Fin.castLE (Nat.succ_le_succ starToTerminal.1) i, + starToTerminal.2.1 i⟩ + have missingSubset : TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) ⊆ + TreeMissingColors phi T := by + intro c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + obtain ⟨v, hv, hc⟩ := hc + exact ⟨v, vertexSubset hv, hc⟩ + constructor + · intro c hc + simp only [HierarchyTerminalStoredColors, Finset.mem_sdiff] at hc + simp only [HierarchyStoredColorsAt, Finset.mem_sdiff] + exact ⟨hc.1, fun hm => hc.2 (missingSubset hm)⟩ + · intro c hc hnot + simp only [HierarchyStoredColorsAt, Finset.mem_sdiff] at hc + simp only [HierarchyTerminalStoredColors, Finset.mem_sdiff] at hnot + by_contra hmissing + exact hnot ⟨hc.1, hmissing⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HierarchyWeaklyStable.lean b/LeanPool/GoldbergSeymour/HierarchyWeaklyStable.lean new file mode 100644 index 0000000000..2439de5ef0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyWeaklyStable.lean @@ -0,0 +1,48 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt + +public import LeanPool.GoldbergSeymour.TreeColoringInvariant + +/-! +# Hierarchy Weakly Stable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Base stability, together with invariance on the relevant hierarchy stage when the index is +positive. +-/ +def HierarchyWeaklyStable {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T generating} {base : HierarchyBase ett phi} + (H : TashkinovHierarchy ett base) (j : Fin (H.dividerCount + 1)) + (sigma : PartialEdgeColoring E k) : Prop := + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let baseStable := + if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma + Fin.cases baseStable + (fun i : Fin H.dividerCount => + baseStable ∧ TreeColoringInvariant (H.stage i.succ.castSucc) phi sigma) + j + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HkuIncidentColorPreserved.lean b/LeanPool/GoldbergSeymour/HkuIncidentColorPreserved.lean new file mode 100644 index 0000000000..3d287413ac --- /dev/null +++ b/LeanPool/GoldbergSeymour/HkuIncidentColorPreserved.lean @@ -0,0 +1,618 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Hku Incident Color Preserved + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hdegree_128.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (f : E), TreeIncidentEdge + (series.data.tree q.succ.castSucc) f → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)) (w : V), + gamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G secondStable w → + (TwoColorIncidenceGraph G secondStable gamma choice.color).degree (Sum.inl w) ≤ (1 : ℕ) + := by + classical + intro V E _ _ _ G k rounds e0 input series q f hf gamma secondStable secondStableProper choice + w hw + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro y hy z hz + simp only [SimpleGraph.mem_neighborFinset] at hy hz + cases y with + | inl y => simp [TwoColorIncidenceGraph] at hy + | inr e => + cases z with + | inl z => simp [TwoColorIncidenceGraph] at hz + | inr f => + simp only [TwoColorIncidenceGraph] at hy hz + rcases hw with hw | hw + · have he : secondStable e = some choice.color := + hy.2.resolve_left (by + intro he + have hn : gamma ∉ PresentColors G secondStable w := by simpa [MissingColors] using hw + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, hy.1, he⟩) + have hf : secondStable f = some choice.color := + hz.2.resolve_left (by + intro hf + have hn : gamma ∉ PresentColors G secondStable w := by simpa [MissingColors] using hw + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, hz.1, hf⟩) + by_cases h : e = f + · exact congrArg Sum.inr h + · exact (secondStableProper h ⟨w, hy.1, hz.1⟩ he hf).elim + · have he : secondStable e = some gamma := + hy.2.resolve_right (by + intro he + have hn : choice.color ∉ PresentColors G secondStable w := by simpa [MissingColors] + using hw + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, hy.1, he⟩) + have hf : secondStable f = some gamma := + hz.2.resolve_right (by + intro hf + have hn : choice.color ∉ PresentColors G secondStable w := by simpa [MissingColors] + using hw + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, hz.1, hf⟩) + by_cases h : e = f + · exact congrArg Sum.inr h + · exact (secondStableProper h ⟨w, hy.1, hz.1⟩ he hf).elim + +private theorem helper_hcomponent_179.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds), + ∀ c ∈ TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.castSucc, + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)), + TreeExit (series.data.tree q.succ.castSucc) secondStable gamma choice.color choice.vertex + → ( + ∀ (w : V), gamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G + secondStable w → (TwoColorIncidenceGraph G secondStable gamma choice.color).degree + (Sum.inl w) ≤ (1 : ℕ)) → (TwoColorIncidenceGraph G secondStable gamma choice.color).degree + (Sum.inl choice.vertex) ≤ (1 : ℕ) → + ∀ w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), Sum.inl w ∈ TwoColorComponent + G secondStable gamma choice.color (Sum.inl choice.vertex) → w = choice.vertex := by + classical + intro V E _ _ _ G k rounds e0 input series q c hc gamma secondStable secondStableProper choice + exitWitness hdegree hvdegree w hwT hwC + rcases exitWitness with ⟨u, path, pathData⟩ + rcases pathData with ⟨pathIs, pathLen, uOut, endTree, endOnly⟩ + have hne : ¬ path.Nil := by + intro hn + have : path.length = 0 := by simpa [SimpleGraph.Walk.nil_iff_support_eq] using hn + omega + have huDegree := hdegree u endOnly.1 + let H := TwoColorIncidenceGraph G secondStable gamma choice.color + have hbound : ∀ x, @SimpleGraph.degree _ H x (Fintype.ofFinite _) ≤ 2 := by + intro x + exact TwoColorIncidenceDegreeAtMostTwo G secondStable gamma choice.color + secondStableProper x + have closed : ∀ x, x ∈ path.support → ∀ y, H.Adj x y → y ∈ path.support := by + intro x hx y hxy + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hx + by_cases hn0 : n = 0 + · subst n + have hx0 : x = Sum.inl u := by simpa using hn.symm + let : Fintype (H.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (H.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert huDegree using 1 + cases hx0 + exact congrArg (fun z => @SimpleGraph.degree _ H (Sum.inl u) z) (Subsingleton.elim _ _) + have hy' : y ∈ H.neighborSet x := by simpa [SimpleGraph.mem_neighborSet] using hxy + have hn' : path.getVert 1 ∈ H.neighborSet x := by + simpa [hx0, SimpleGraph.mem_neighborSet] using path.adj_getVert_succ (show 0 < + path.length by omega) + have heq := Fintype.card_le_one_iff.mp card ⟨y, hy'⟩ ⟨path.getVert 1, hn'⟩ + have hey : y = path.getVert 1 := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support 1 + by_cases hlast : n = path.length + · have hx1 : x = Sum.inl choice.vertex := by + rw [← hn, pathIs.getVert_eq_end_iff hnle] + exact hlast + let : Fintype (H.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (H.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert hvdegree using 1 + cases hx1 + exact congrArg (fun z => @SimpleGraph.degree _ H (Sum.inl choice.vertex) z) + (Subsingleton.elim _ _) + have hy' : y ∈ H.neighborSet x := by simpa [SimpleGraph.mem_neighborSet] using hxy + have hp : path.getVert (path.length - 1) ∈ H.neighborSet x := by + have ha : H.Adj (Sum.inl choice.vertex) (path.getVert (path.length - 1)) := by + simpa [H, show path.length - 1 + 1 = path.length by omega] using + (path.adj_getVert_succ (show path.length - 1 < path.length by omega)).symm + simpa [hx1, SimpleGraph.mem_neighborSet] using ha + have heq := Fintype.card_le_one_iff.mp card ⟨y, hy'⟩ ⟨path.getVert (path.length - 1), hp⟩ + have hey : y = path.getVert (path.length - 1) := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support _ + have hl : H.Adj (path.getVert n) (path.getVert (n - 1)) := by + rw [← show n - 1 + 1 = n by omega] + exact (path.adj_getVert_succ (by omega)).symm + have hr : H.Adj (path.getVert n) (path.getVert (n + 1)) := path.adj_getVert_succ (by omega) + by_contra hyout + have hyout' := hxy + rw [← hn] at hyout' + have hnl : path.getVert (n - 1) ≠ y := by + intro h; apply hyout; rw [← h]; exact path.getVert_mem_support _ + have hnr : path.getVert (n + 1) ≠ y := by + intro h; apply hyout; rw [← h]; exact path.getVert_mem_support _ + have hnp : path.getVert (n - 1) ≠ path.getVert (n + 1) := by + intro h + have hi := pathIs.getVert_injOn (show n - 1 ≤ path.length by omega) + (show n + 1 ≤ path.length by omega) h + omega + let : Fintype (H.neighborSet (path.getVert n)) := Fintype.ofFinite _ + have three : 3 ≤ H.degree (path.getVert n) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset _ := {y, path.getVert (n - 1), path.getVert (n + 1)} + have hs : s ⊆ H.neighborFinset (path.getVert n) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hyout' + · simpa [SimpleGraph.mem_neighborFinset] using hl + · simpa [SimpleGraph.mem_neighborFinset] using hr + have hc : 3 ≤ s.card := by simp [s, hnp, hnl.symm, hnr.symm] + exact hc.trans (Finset.card_le_card hs) + have upper : @SimpleGraph.degree _ H (path.getVert n) (Fintype.ofFinite _) ≤ 2 := + hbound (path.getVert n) + exact (by omega : False).elim + have reach : H.Reachable (Sum.inl choice.vertex) (Sum.inl w) := by + change H.connectedComponentMk (Sum.inl w) = + H.connectedComponentMk (Sum.inl choice.vertex) at hwC + exact SimpleGraph.ConnectedComponent.eq.mp hwC |>.symm + have ws : Sum.inl w ∈ path.support := by + apply reach.mem_subgraphVerts (H := (⊤ : H.Subgraph).induce {x | x ∈ path.support}) + (fun x hx y hadj => ⟨by simpa using hx, closed x (by simpa using hx) y hadj, hadj⟩) + (by simp) + exact (endOnly.2 w hwT).mp ws + +private theorem helper_hbase_286.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (f : E) (c : Fin k), + TreeIncidentEdge (series.data.tree q.succ.castSucc) f → series.data.coloring q.castSucc f + = some c → c ∈ TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree + q.succ.castSucc) ∪ TashkinovStoredColors series.data q.castSucc → + ∀ (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)), StableColoring (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc)) choice.selected + secondStable → secondStable f = series.data.coloring q.castSucc f := by + classical + intro V E _ _ _ G k rounds e0 input series q f c hf hfc hc secondStable choice + secondStableRelation + have hs : choice.selected f = series.data.coloring q.castSucc f := + choice.selectedStable.1 f hf ⟨c, hc, hfc⟩ + have hm : c ∈ TreeMissingColors choice.selected + (series.data.tree q.succ.castSucc) ∪ + insert choice.color (TashkinovStoredColors series.data q.castSucc) := by + have hc' := hc + simp only [Finset.mem_union] at hc' + rcases hc' with hc | hc + · apply Finset.mem_union.mpr + apply Or.inl + obtain ⟨v, hv, hcv⟩ : ∃ v, v ∈ TreeSequenceVertexSet + (series.data.tree q.succ.castSucc) ∧ c ∈ MissingColors G + (series.data.coloring q.castSucc) v := by + unfold TreeMissingColors at hc + simpa only [Finset.mem_biUnion] using hc + have hcv' : c ∈ MissingColors G choice.selected v := by + rw [choice.selectedStable.2 v hv] + exact hcv + simpa only [TreeMissingColors, Finset.mem_biUnion] using ⟨v, hv, hcv'⟩ + · apply Finset.mem_union.mpr + exact Or.inr (Finset.mem_insert_of_mem hc) + exact (secondStableRelation.1 f hf ⟨c, hm, hs.trans hfc⟩).trans hs + +private theorem helper_hincident_309.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (gamma : Fin k) (secondStable : + PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)), + StableColoring (series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data q.castSucc)) choice.selected secondStable → gamma ∈ + MissingColors G secondStable choice.vertex → ( + ∀ w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), Sum.inl w ∈ TwoColorComponent + G secondStable gamma choice.color (Sum.inl choice.vertex) → w = choice.vertex) → + ∀ (g : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) g → Sum.inr g ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → g = + choice.edge := by + classical + intro V E _ _ _ G k rounds e0 input series q gamma secondStable secondStableProper choice + secondStableRelation hmissing hcomponent g hgi hg + rcases hgi with ⟨w, hw, hwg⟩ + have hsupport : Sum.inr g ∈ + (TwoColorIncidenceGraph G secondStable gamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G secondStable gamma choice.color) + (u := Sum.inr g) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp hg + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G secondStable gamma choice.color).mem_support.mp hsupport + have hcol : secondStable g = some gamma ∨ secondStable g = some choice.color := by + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + have hvertex : Sum.inl w ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl w) = _ + have hadj : (TwoColorIncidenceGraph G secondStable gamma choice.color).Adj + (Sum.inl w) (Sum.inr g) := by + simp [TwoColorIncidenceGraph, hwg, hcol] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hg + have hw_eq : w = choice.vertex := hcomponent w hw hvertex + subst w + have hne : secondStable g = some gamma → False := by + intro hh + have hn : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨g, hwg, hh⟩ + have hgcol : secondStable g = some choice.color := hcol.resolve_left hne + have hecol : secondStable choice.edge = some choice.color := by + exact (secondStableRelation.1 choice.edge + ⟨choice.vertex, hw, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union.mpr (Or.inr (Finset.mem_insert_self _ _)), + choice.edgeColor⟩).trans choice.edgeColor + by_contra hneedge + exact (secondStableProper hneedge ⟨choice.vertex, hwg, choice.edgeIncident⟩ hgcol hecol).elim + +private theorem helper_branch_364.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (f : E) (c : Fin k), + series.data.coloring q.castSucc f = some c → c ∈ TreeMissingColors (series.data.coloring + q.castSucc) (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors series.data + q.castSucc → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)), StableColoring (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc)) choice.selected + secondStable → series.data.coloring q.succ = TwoColorComponentSwap G secondStable gamma + choice.color (Sum.inl choice.vertex) → series.data.stored q.succ = { choice.color, gamma } + → series.data.connectingEdges q.succ = { choice.edge } → series.data.kind q.succ = some + TashkinovExtensionKind.PE → series.data.delta q.succ = some choice.color → + series.data.gamma q.succ = some gamma → gamma ∈ MissingColors G secondStable choice.vertex + → secondStable f = series.data.coloring q.castSucc f → ( + ∀ (g : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) g → Sum.inr g ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → g = + choice.edge) → + ∀ v ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), Incident G v f → (Sum.inl v ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → v = + choice.vertex) → Sum.inr f ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex) → (series.data.coloring q.succ f = series.data.coloring q.castSucc f ∨ + series.data.kind q.succ = some TashkinovExtensionKind.PE ∧ series.data.connectingEdges + q.succ = { f } ∧ series.data.delta q.succ = some c ∧ + ∃ (gamma : Fin k), series.data.gamma q.succ = some gamma ∧ series.data.coloring q.succ f = + some gamma) ∧ + ∃ (d : Fin k), series.data.coloring q.succ f = some d ∧ d ∈ TreeMissingColors + (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors + series.data q.succ := by + classical + intro V E _ _ _ G k rounds e0 input series q f c hfc hc gamma secondStable choice + secondStableRelation currentColoring currentStored currentEdges currentKind currentDelta + currentGamma hmissing hbase hincident v hv hvf hvertexComp hcomp + have hfcol : secondStable f = some gamma ∨ + secondStable f = some choice.color := by + have hfsupport : Sum.inr f ∈ + (TwoColorIncidenceGraph G secondStable gamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G secondStable gamma choice.color) + (u := Sum.inr f) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp hcomp + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G secondStable gamma choice.color).mem_support.mp hfsupport + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + have hvcomp : Sum.inl v ∈ TwoColorComponent G secondStable gamma + choice.color (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl v) = _ + have hadj : (TwoColorIncidenceGraph G secondStable gamma choice.color).Adj + (Sum.inl v) (Sum.inr f) := by + simp [TwoColorIncidenceGraph, hvf, hfcol] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hcomp + have hv_eq : v = choice.vertex := hvertexComp hvcomp + have hfedge : f = choice.edge := hincident f ⟨v, hv, hvf⟩ hcomp + subst f + have hecol : secondStable choice.edge = some choice.color := by + exact (secondStableRelation.1 choice.edge + ⟨choice.vertex, by rw [← hv_eq]; exact hv, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union.mpr (Or.inr (Finset.mem_insert_self _ _)), + choice.edgeColor⟩).trans choice.edgeColor + have hce : c = choice.color := by + apply Option.some.inj + exact hfc.symm.trans (hbase.symm.trans hecol) + subst c + have hneq : choice.color ≠ gamma := by + intro heq + have hn : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, + heq ▸ hecol⟩ + refine ⟨Or.inr ⟨currentKind, ?_, currentDelta, ?_⟩, ?_⟩ + · simp [currentEdges] + · refine ⟨gamma, currentGamma, ?_⟩ + rw [congrFun currentColoring choice.edge] + simp [TwoColorComponentSwap, hcomp, hecol, hneq] + · refine ⟨gamma, ?_, ?_⟩ + · rw [congrFun currentColoring choice.edge] + simp [TwoColorComponentSwap, hcomp, hecol, hneq] + · by_cases hm : gamma ∈ TreeMissingColors + (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) + · apply Finset.mem_union.mpr + exact Or.inl hm + · apply Finset.mem_union.mpr + apply Or.inr + simp only [TashkinovStoredColors] + have qnz : q.succ.val ≠ 0 := by + intro hz + apply Fin.succ_ne_zero q + apply Fin.ext + exact hz + rw [ite_eq_right qnz] + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · refine ⟨q.succ, ?_⟩ + simp [currentStored] + · simpa using hm + +private theorem helper_branch_101.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (f : E) (c : Fin k), + TreeIncidentEdge (series.data.tree q.succ.castSucc) f → series.data.coloring q.castSucc f + = some c → c ∈ TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree + q.succ.castSucc) ∪ TashkinovStoredColors series.data q.castSucc → TreeMissingColors + (series.data.coloring q.castSucc) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.castSucc ⊆ TreeMissingColors (series.data.coloring + q.succ) (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors series.data q.succ ∧ + TreeMissingColors (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.succ ⊆ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.succ) ∪ TashkinovStoredColors series.data q.succ → + ∀ (i : Fin rounds), IsProperEdgeColoring G (series.data.coloring i.castSucc) → + IsOneEdgeUncolored (series.data.coloring i.castSucc) e0 → ColoredVertexSetClosed G + (series.data.coloring i.castSucc) (TreeSequenceVertexSet (series.data.tree + i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (series.data.coloring i.castSucc) + (TreeSequenceVertexSet (series.data.tree i.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate series.data i.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree i.succ.castSucc) + (TashkinovStoredColors series.data i.castSucc) (series.data.coloring i.castSucc)), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data i.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (series.data.tree + i.succ.castSucc))) → + ∀ (gamma : Fin k), ParallelExtensionColor series.data i.castSucc choice.selected choice.vertex + gamma → + ∀ (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + StableColoring (series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data i.castSucc)) choice.selected secondStable → TreeExit + (series.data.tree i.succ.castSucc) secondStable gamma choice.color choice.vertex → + series.data.coloring i.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) → IsProperEdgeColoring G (series.data.coloring i.succ) → + IsOneEdgeUncolored (series.data.coloring i.succ) e0 → series.data.stored i.succ = + { choice.color, gamma } → series.data.connectingEdges i.succ = { choice.edge } → + series.data.kind i.succ = some TashkinovExtensionKind.PE → series.data.chosenVertex i.succ + = some choice.vertex → series.data.outsideVertex i.succ = some choice.otherEndpoint → + series.data.delta i.succ = some choice.color → series.data.gamma i.succ = some gamma → + TashkinovClosure (series.data.coloring i.succ) (series.data.tree i.succ.castSucc) + (series.data.tree i.succ.succ) → TreeSequenceInitialSegment (series.data.tree + i.succ.castSucc) (series.data.tree i.succ.succ) → (series.data.tree + i.succ.castSucc).length < (series.data.tree i.succ.succ).length → i.succ ≠ (0 : Fin + (rounds + (1 : ℕ))) → i.succ = q.succ → (series.data.coloring q.succ f = + series.data.coloring q.castSucc f ∨ series.data.kind q.succ = some + TashkinovExtensionKind.PE ∧ series.data.connectingEdges q.succ = { f } ∧ series.data.delta + q.succ = some c ∧ + ∃ (gamma : Fin k), series.data.gamma q.succ = some gamma ∧ series.data.coloring q.succ f = + some gamma) ∧ + ∃ (d : Fin k), series.data.coloring q.succ f = some d ∧ d ∈ TreeMissingColors + (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors + series.data q.succ := by + classical + intro V E _ _ _ G k rounds e0 input series q f c hf hfc hc monotone i previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails gamma gammaRule secondStable secondStableProper secondStableRelation + exitWitness currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hj hjeq + have hvals := congrArg Fin.val hjeq + simp at hvals + have hi : i = q := by apply Fin.ext; omega + subst i + have hmissing : gamma ∈ MissingColors G secondStable choice.vertex := by + exact (secondStableRelation.2 choice.vertex choice.vertexDefective.1).symm ▸ gammaRule.1 + have hdegree := @helper_hdegree_128 V E inferInstance inferInstance inferInstance G k rounds e0 + input series q f hf gamma secondStable secondStableProper choice + have hvdegree := hdegree choice.vertex (Or.inl hmissing) + have hcomponent := @helper_hcomponent_179 V E inferInstance inferInstance inferInstance G k rounds + e0 input series q c hc gamma secondStable secondStableProper choice exitWitness hdegree + hvdegree + have htree : TreeMissingColors secondStable + (series.data.tree q.succ.castSucc) = + TreeMissingColors choice.selected + (series.data.tree q.succ.castSucc) := by + ext a + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor <;> rintro ⟨v, hv, ha⟩ <;> refine ⟨v, hv, ?_⟩ + · rw [(secondStableRelation.2 v hv)] at ha + exact ha + · rw [← (secondStableRelation.2 v hv)] at ha + exact ha + have hbase := @helper_hbase_286 V E inferInstance inferInstance inferInstance G k rounds e0 input + series q f c hf hfc hc secondStable choice secondStableRelation + have hincident := @helper_hincident_309 V E inferInstance inferInstance inferInstance G k rounds + e0 input series q gamma secondStable secondStableProper choice secondStableRelation hmissing + hcomponent + have hswap : ∀ g, ¬ Sum.inr g ∈ TwoColorComponent G secondStable gamma + choice.color (Sum.inl choice.vertex) → + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) g = secondStable g := by + intro g hg + simp [TwoColorComponentSwap, hg] + rcases hf with ⟨v, hv, hvf⟩ + have hvertexComp : Sum.inl v ∈ TwoColorComponent G secondStable gamma + choice.color (Sum.inl choice.vertex) → v = choice.vertex := + fun h => hcomponent v hv h + by_cases hcomp : Sum.inr f ∈ TwoColorComponent G secondStable gamma + choice.color (Sum.inl choice.vertex) + · exact @helper_branch_364 V E inferInstance inferInstance inferInstance G k rounds e0 input + series q f c hfc hc gamma secondStable choice secondStableRelation currentColoring + currentStored currentEdges currentKind currentDelta currentGamma hmissing hbase hincident v + hv hvf hvertexComp hcomp + · have hnew := hswap f hcomp + have hcur : series.data.coloring q.succ f = + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) f := congrFun currentColoring f + refine ⟨Or.inl (hcur.trans (hnew.trans hbase)), ?_⟩ + exact ⟨c, (hcur.trans (hnew.trans hbase)).trans hfc, monotone.1 hc⟩ + +theorem HkuIncidentColorPreserved {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) + (f : E) (c : Fin k) + (hf : TreeIncidentEdge (series.data.tree q.succ.castSucc) f) + (hfc : series.data.coloring q.castSucc f = some c) + (hc : c ∈ TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.castSucc) : + (series.data.coloring q.succ f = series.data.coloring q.castSucc f ∨ + (series.data.kind q.succ = some TashkinovExtensionKind.PE ∧ + series.data.connectingEdges q.succ = { f } ∧ + series.data.delta q.succ = some c ∧ + ∃ gamma : Fin k, + series.data.gamma q.succ = some gamma ∧ + series.data.coloring q.succ f = some gamma)) ∧ + ∃ d : Fin k, + series.data.coloring q.succ f = some d ∧ + d ∈ + TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.succ := by + classical + have monotone := (HkuMissingStoredMonotone G k rounds e0 input series q) + have process : + ∀ j : Fin (rounds + 1), j ≠ 0 → j = q.succ → (series.data.coloring q.succ f = + series.data.coloring q.castSucc f ∨ (series.data.kind q.succ = some + TashkinovExtensionKind.PE ∧ series.data.connectingEdges q.succ = {f} ∧ series.data.delta + q.succ = some c ∧ + ∃ gamma : Fin k, series.data.gamma q.succ = some gamma ∧ series.data.coloring q.succ f = some + gamma)) ∧ + ∃ d : Fin k, series.data.coloring q.succ f = some d ∧ d ∈ TreeMissingColors + (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors + series.data q.succ := by + intro j hj hjeq + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (hj (by omega)).elim + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hjeq + simp at hvals + have hi : i = q := by apply Fin.ext; omega + subst i + have hcolor : series.data.coloring q.succ = + series.data.coloring q.castSucc := by + rw [← hjeq, currentColoring] + refine ⟨Or.inl (congrFun hcolor f), ?_⟩ + exact ⟨c, hcolor ▸ hfc, monotone.1 hc⟩ + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hjeq + simp at hvals + have hi : i = q := by apply Fin.ext; omega + subst i + have hf' := choice.selectedStable.1 f hf ⟨c, hc, hfc⟩ + have hcolor : series.data.coloring q.succ f = choice.selected f := + congrFun currentColoring f + refine ⟨Or.inl (hcolor.trans hf'), ?_⟩ + refine ⟨c, (hcolor.trans hf').trans hfc, monotone.1 hc⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_101 V E inferInstance inferInstance inferInstance G k rounds e0 + input series q f c hf hfc hc monotone i previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hj hjeq + exact process q.succ (Fin.succ_ne_zero q) rfl + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean b/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean new file mode 100644 index 0000000000..5e035784df --- /dev/null +++ b/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean @@ -0,0 +1,353 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeries + +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo + +/-! +# Hku Missing Stored Monotone + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem HkuMissingStoredMonotone_segment_78.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ + → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree + i.succ.succ) := by + classical + intro V E _ _ _ G k rounds e0 input series j i hji + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero i) hji.symm |>.elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + +private theorem HkuMissingStoredMonotone_branch_237.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds), (∀ {phi : PartialEdgeColoring E + k} (alpha beta : Fin k) (z : V ⊕ E) {v : V} {c : Fin k}, c ∈ MissingColors G phi v → c ≠ + alpha → c ≠ beta → c ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta z) v) → (∀ + {A : TreeSequence G e0} {C : Finset (Fin k)} {phi pi : PartialEdgeColoring E k}, + StableColoring A C phi pi → TreeMissingColors phi A = TreeMissingColors pi A) → (∀ c ∈ + series.data.stored q.succ, c ∉ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) → c ∈ TashkinovStoredColors series.data q.succ) → (∀ c + ∈ TashkinovStoredColors series.data q.castSucc, c ∈ TreeMissingColors + (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors + series.data q.succ) → TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors series.data q.castSucc ⊆ + TreeMissingColors (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.succ := by + classical + intro V E _ _ _ G k rounds e0 input series q swapMissing stableMissing currentStoredTransfer + storedTransfer c hc + rcases Finset.mem_union.mp hc with hc | hc + · have cert := series.certified q.succ + generalize hj : q.succ = j at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q) hj |>.elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hi : i = q := by apply Fin.ext; omega + subst i + have heq := stableMissing choice.selectedStable + have hnew : c ∈ TreeMissingColors choice.selected + (series.data.tree q.succ.castSucc) := by + rw [← heq] + exact hc + exact Finset.mem_union.mpr (Or.inl (by simpa [currentColoring] using hnew)) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hi : i = q := by apply Fin.ext; omega + subst i + have hfirst := stableMissing choice.selectedStable + have hsecond := stableMissing secondStableRelation + have hsecondold : TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc) = + TreeMissingColors secondStable (series.data.tree q.succ.castSucc) := + hfirst.trans hsecond + have hsc : c ∈ TreeMissingColors secondStable + (series.data.tree q.succ.castSucc) := by + rw [← hsecondold] + exact hc + by_cases hcg : c = gamma + · by_cases hn : c ∈ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) + · exact Finset.mem_union.mpr (Or.inl hn) + · apply Finset.mem_union.mpr + right + apply currentStoredTransfer c + · rw [currentStored] + simp [hcg] + · exact hn + · by_cases hcd : c = choice.color + · by_cases hn : c ∈ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) + · exact Finset.mem_union.mpr (Or.inl hn) + · apply Finset.mem_union.mpr + right + apply currentStoredTransfer c + · rw [currentStored] + simp [hcd] + · exact hn + · simp only [TreeMissingColors, Fin.castSucc_succ, Finset.mem_biUnion] at hsc + rcases hsc with ⟨v, hv, hvc⟩ + have htrans := swapMissing gamma choice.color + (Sum.inl choice.vertex) hvc hcg hcd + apply Finset.mem_union.mpr + left + rw [currentColoring] + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + exact ⟨v, hv, htrans⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hi : i = q := by apply Fin.ext; omega + subst i + exact Finset.mem_union.mpr (Or.inl (by simpa [currentColoring] using hc)) + · exact storedTransfer c hc + +theorem HkuMissingStoredMonotone {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) : + TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.castSucc ⊆ + TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.succ ∧ + TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.succ ⊆ + TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.succ) ∪ + TashkinovStoredColors series.data q.succ := by + classical + let : DecidableEq V := Classical.decEq V + have vertexTransfer {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + rcases hv with ⟨i, hi⟩ + rcases hab with ⟨hlen, hvertices, hedges⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, ?_⟩ + exact (hvertices i).trans hi + have augmentationTransfer {A B : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hab : TashkinovAugmentation phi A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + rcases hab with ⟨hlen, hseg, hc⟩ + exact vertexTransfer hseg hv + have closureTransfer {A B : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hab : TashkinovAugmentationSequence phi A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + unfold TashkinovAugmentationSequence at hab + induction hab using Relation.ReflTransGen.head_induction_on with + | refl => exact hv + | head hstep htail ih => + exact ih (augmentationTransfer hstep hv) + have segment : ∀ (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ → + TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) + (series.data.tree i.succ.succ) := by + exact @HkuMissingStoredMonotone_segment_78 V E inferInstance inferInstance inferInstance G k + rounds e0 input series + have missingTransfer {A B : TreeSequence G e0} + (hab : ∀ v, v ∈ TreeSequenceVertexSet A → + v ∈ TreeSequenceVertexSet B) (phi : PartialEdgeColoring E k) : + TreeMissingColors phi A ⊆ TreeMissingColors phi B := by + intro c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨v, hv, hvc⟩ + exact ⟨v, hab v hv, hvc⟩ + have secondSegment := segment q.succ q (by rfl) + have oldVertices : ∀ v, v ∈ TreeSequenceVertexSet (series.data.tree q.castSucc.castSucc) → + v ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc) := by + intro v hv + by_cases hq : q.val = 0 + · have hzero : q = ⟨0, by omega⟩ := by apply Fin.ext; exact hq + cases series.certified 0 with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hidx : q.castSucc.castSucc = (0 : Fin (rounds + 2)) := by + apply Fin.ext + simp [hq] + have hv' : v ∈ TreeSequenceVertexSet (series.data.tree 0) := by + rw [hidx] at hv + exact hv + have hres := closureTransfer initialClosure.1 hv' + have hnext : q.succ.castSucc = (1 : Fin (rounds + 2)) := by + apply Fin.ext + simp [hq] + rw [hnext] + exact hres + · let i : Fin rounds := ⟨q.val - 1, by omega⟩ + have hi : i.succ = q.castSucc := by apply Fin.ext; simp [i]; omega + have hs := segment q.castSucc i hi.symm + have hv' : v ∈ TreeSequenceVertexSet (series.data.tree i.succ.castSucc) := by + simpa [hi] using hv + have hres := vertexTransfer hs hv' + simpa [hi] using hres + have laterMissing := missingTransfer (fun v hv => vertexTransfer secondSegment hv) + (series.data.coloring q.succ) + have swapMissing {phi : PartialEdgeColoring E k} (alpha beta : Fin k) + (z : Sum V E) {v : V} {c : Fin k} + (hc : c ∈ MissingColors G phi v) (hca : c ≠ alpha) (hcb : c ≠ beta) : + c ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta z) v := by + unfold MissingColors at hc ⊢ + rw [Finset.mem_sdiff] at hc ⊢ + refine ⟨Finset.mem_univ _, ?_⟩ + intro hp + rw [PresentColors] at hp + rcases Finset.mem_filter.mp hp with ⟨_, hp⟩ + rcases hp with ⟨e, he, hpe⟩ + apply hc.2 + rw [PresentColors] + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩ + refine ⟨e, he, ?_⟩ + unfold TwoColorComponentSwap at hpe + by_cases hh : Sum.inr e ∈ TwoColorComponent G phi alpha beta z + · rw [ite_eq_left hh] at hpe + by_cases ha : phi e = some alpha + · rw [ite_eq_left ha] at hpe + exact False.elim (hcb (Option.some.inj hpe).symm) + · by_cases hb : phi e = some beta + · rw [ite_eq_right ha, ite_eq_left hb] at hpe + exact False.elim (hca (Option.some.inj hpe).symm) + · rw [ite_eq_right ha, ite_eq_right hb] at hpe + exact hpe + · rw [ite_eq_right hh] at hpe + exact hpe + have stableMissing {A : TreeSequence G e0} {C : Finset (Fin k)} + {phi pi : PartialEdgeColoring E k} + (hstable : StableColoring A C phi pi) : + TreeMissingColors phi A = TreeMissingColors pi A := by + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hvc⟩ + have hcopy := hvc + rw [← hstable.2 v hv] at hcopy + exact ⟨v, hv, hcopy⟩ + · rintro ⟨v, hv, hvc⟩ + have hcopy := hvc + rw [hstable.2 v hv] at hcopy + exact ⟨v, hv, hcopy⟩ + have currentStoredTransfer : + ∀ c : Fin k, c ∈ series.data.stored q.succ → c ∉ TreeMissingColors (series.data.coloring + q.succ) (series.data.tree q.succ.castSucc) → c ∈ TashkinovStoredColors series.data q.succ + := by + intro c hs hn + unfold TashkinovStoredColors + simp only [Fin.val_succ, Nat.add_eq_zero_iff, one_ne_zero, and_false, ↓reduceIte, + Fin.castSucc_succ, + Finset.mem_sdiff, Finset.mem_biUnion, Finset.mem_univ, true_and] + refine ⟨⟨q.succ, ?_⟩, ?_⟩ + · simpa using hs + · simpa using hn + have storedTransfer : + ∀ c : Fin k, c ∈ TashkinovStoredColors series.data q.castSucc → c ∈ TreeMissingColors + (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors + series.data q.succ := by + intro c hc + by_cases hn : c ∈ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) + · exact Finset.mem_union.mpr (Or.inl hn) + · exact Finset.mem_union.mpr (Or.inr (by + by_cases hq : q.val = 0 + · simp [TashkinovStoredColors, hq] at hc + · unfold TashkinovStoredColors at hc ⊢ + simp only [Fin.val_castSucc, hq, ↓reduceIte, Finset.mem_sdiff, Finset.mem_biUnion, + Finset.mem_univ, true_and, + Fin.val_succ, Nat.add_eq_zero_iff, one_ne_zero, and_self, Fin.castSucc_succ] at hc ⊢ + have hcum := hc.1 + refine ⟨?_, hn⟩ + rcases hcum with ⟨i, hci⟩ + refine ⟨i, ?_⟩ + by_cases hi : i.val ≤ q.val + · simp [hi] at hci + have hnext : i.val ≤ q.val + 1 := by omega + simpa [hnext] using hci + · simp [hi] at hci + )) + refine ⟨?_, ?_⟩ + · exact @HkuMissingStoredMonotone_branch_237 V E inferInstance inferInstance inferInstance G k + rounds e0 input series q swapMissing stableMissing currentStoredTransfer storedTransfer + intro c hc + rcases Finset.mem_union.mp hc with hc | hc + · exact Finset.mem_union.mpr (Or.inl (laterMissing hc)) + · exact Finset.mem_union.mpr (Or.inr hc) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HkuParallelBoundaryStructure.lean b/LeanPool/GoldbergSeymour/HkuParallelBoundaryStructure.lean new file mode 100644 index 0000000000..75463ea3a6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HkuParallelBoundaryStructure.lean @@ -0,0 +1,952 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.TashkinovSeries + +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo + +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Hku Parallel Boundary Structure + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hdegree_159.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) + (_ : E) (chosenGamma : Fin k) (secondStable : PartialEdgeColoring E k), + IsProperEdgeColoring G secondStable → ∀ (choice : MaximumDefectiveChoice G e0 + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)) (w : V), chosenGamma ∈ MissingColors G secondStable w ∨ + choice.color ∈ MissingColors G secondStable w → (TwoColorIncidenceGraph G secondStable + chosenGamma choice.color).degree (Sum.inl w) ≤ (1 : ℕ) := by + classical + intro V E _ _ _ G k rounds e0 input series q f chosenGamma secondStable secondStableProper + choice w hw + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro y hy z hz + simp only [SimpleGraph.mem_neighborFinset] at hy hz + cases y with + | inl y => simp [TwoColorIncidenceGraph] at hy + | inr e => + cases z with + | inl z => simp [TwoColorIncidenceGraph] at hz + | inr f => + simp only [TwoColorIncidenceGraph] at hy hz + rcases hw with hw | hw + · have he : secondStable e = some choice.color := + hy.2.resolve_left (by + intro he + have hn : chosenGamma ∉ PresentColors G secondStable w := by + simpa [MissingColors] using hw + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, hy.1, he⟩) + have hf : secondStable f = some choice.color := + hz.2.resolve_left (by + intro hf + have hn : chosenGamma ∉ PresentColors G secondStable w := by + simpa [MissingColors] using hw + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, hz.1, hf⟩) + by_cases h : e = f + · exact congrArg Sum.inr h + · exact (secondStableProper h ⟨w, hy.1, hz.1⟩ he hf).elim + · have he : secondStable e = some chosenGamma := + hy.2.resolve_right (by + intro he + have hn : choice.color ∉ PresentColors G secondStable w := by + simpa [MissingColors] using hw + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, hy.1, he⟩) + have hf : secondStable f = some chosenGamma := + hz.2.resolve_right (by + intro hf + have hn : choice.color ∉ PresentColors G secondStable w := by + simpa [MissingColors] using hw + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, hz.1, hf⟩) + by_cases h : e = f + · exact congrArg Sum.inr h + · exact (secondStableProper h ⟨w, hy.1, hz.1⟩ he hf).elim + +private theorem helper_hcomponent_214.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)), + TreeExit (series.data.tree q.succ.castSucc) secondStable chosenGamma choice.color + choice.vertex → + let tree : TreeSequence G e0 := series.data.tree q.succ.castSucc; + let vertices : Finset V := TreeSequenceVertexSet tree; chosenGamma ∈ MissingColors G + secondStable choice.vertex → ( + ∀ (w : V), chosenGamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G + secondStable w → (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).degree + (Sum.inl w) ≤ (1 : ℕ)) → + ∀ w ∈ vertices, Sum.inl w ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → w = choice.vertex := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable secondStableProper choice + exitWitness tree vertices hmissing hdegree w hwT hwC + rcases exitWitness with ⟨u, path, pathData⟩ + rcases pathData with ⟨pathIs, pathLen, uOut, endTree, endOnly⟩ + have hne : ¬ path.Nil := by + intro hn + have hl : path.length = 0 := by simpa [SimpleGraph.Walk.nil_iff_support_eq] using hn + omega + have huDegree := hdegree u endOnly.1 + let graph := TwoColorIncidenceGraph G secondStable chosenGamma choice.color + have hbound : ∀ x, @SimpleGraph.degree _ graph x (Fintype.ofFinite _) ≤ 2 := by + intro x + exact TwoColorIncidenceDegreeAtMostTwo G secondStable chosenGamma choice.color + secondStableProper x + have closed : ∀ x, x ∈ path.support → ∀ y, graph.Adj x y → y ∈ path.support := by + intro x hx y hxy + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hx + by_cases hn0 : n = 0 + · subst n + have hx0 : x = Sum.inl u := by simpa using hn.symm + let : Fintype (graph.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (graph.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert huDegree using 1 + cases hx0 + exact congrArg (fun z => @SimpleGraph.degree _ graph (Sum.inl u) z) (Subsingleton.elim _ _) + have hy' : y ∈ graph.neighborSet x := by simpa [SimpleGraph.mem_neighborSet] using hxy + have hn' : path.getVert 1 ∈ graph.neighborSet x := by + simpa [hx0, SimpleGraph.mem_neighborSet] using path.adj_getVert_succ (show 0 < + path.length by omega) + have heq := Fintype.card_le_one_iff.mp card ⟨y, hy'⟩ ⟨path.getVert 1, hn'⟩ + have hey : y = path.getVert 1 := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support 1 + by_cases hlast : n = path.length + · have hx1 : x = Sum.inl choice.vertex := by + rw [← hn, pathIs.getVert_eq_end_iff hnle] + exact hlast + let : Fintype (graph.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (graph.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert hdegree choice.vertex (Or.inl hmissing) using 1 + cases hx1 + exact congrArg (fun z => @SimpleGraph.degree _ graph (Sum.inl choice.vertex) z) + (Subsingleton.elim _ _) + have hy' : y ∈ graph.neighborSet x := by simpa [SimpleGraph.mem_neighborSet] using hxy + have hp : path.getVert (path.length - 1) ∈ graph.neighborSet x := by + have ha : graph.Adj (Sum.inl choice.vertex) (path.getVert (path.length - 1)) := by + simpa [graph, show path.length - 1 + 1 = path.length by omega] using + (path.adj_getVert_succ (show path.length - 1 < path.length by omega)).symm + simpa [hx1, SimpleGraph.mem_neighborSet] using ha + have heq := Fintype.card_le_one_iff.mp card ⟨y, hy'⟩ ⟨path.getVert (path.length - 1), hp⟩ + have hey : y = path.getVert (path.length - 1) := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support _ + have hl : graph.Adj (path.getVert n) (path.getVert (n - 1)) := by + rw [← show n - 1 + 1 = n by omega] + exact (path.adj_getVert_succ (by omega)).symm + have hr : graph.Adj (path.getVert n) (path.getVert (n + 1)) := path.adj_getVert_succ (by omega) + by_contra hyout + have hyout' := hxy + rw [← hn] at hyout' + have hnl : path.getVert (n - 1) ≠ y := by + intro h + apply hyout + rw [← h] + exact path.getVert_mem_support _ + have hnr : path.getVert (n + 1) ≠ y := by + intro h + apply hyout + rw [← h] + exact path.getVert_mem_support _ + have hnp : path.getVert (n - 1) ≠ path.getVert (n + 1) := by + intro h + have hi := pathIs.getVert_injOn (show n - 1 ≤ path.length by omega) + (show n + 1 ≤ path.length by omega) h + omega + let : Fintype (graph.neighborSet (path.getVert n)) := Fintype.ofFinite _ + have three : 3 ≤ graph.degree (path.getVert n) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset _ := {y, path.getVert (n - 1), path.getVert (n + 1)} + have hs : s ⊆ graph.neighborFinset (path.getVert n) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hyout' + · simpa [SimpleGraph.mem_neighborFinset] using hl + · simpa [SimpleGraph.mem_neighborFinset] using hr + have hc : 3 ≤ s.card := by simp [s, hnp, hnl.symm, hnr.symm] + exact hc.trans (Finset.card_le_card hs) + have upper : @SimpleGraph.degree _ graph (path.getVert n) (Fintype.ofFinite _) ≤ 2 := + hbound (path.getVert n) + omega + have reach : graph.Reachable (Sum.inl choice.vertex) (Sum.inl w) := by + change graph.connectedComponentMk (Sum.inl w) = graph.connectedComponentMk (Sum.inl + choice.vertex) at hwC + exact SimpleGraph.ConnectedComponent.eq.mp hwC |>.symm + have ws : Sum.inl w ∈ path.support := by + apply reach.mem_subgraphVerts (H := (⊤ : graph.Subgraph).induce {x | x ∈ path.support}) + (fun x hx y hadj => ⟨by simpa using hx, closed x (by simpa using hx) y hadj, hadj⟩) + (by simp) + exact (endOnly.2 w hwT).mp ws + +private theorem helper_hcurrentGamma_463.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)), + let tree : TreeSequence G e0 := series.data.tree q.succ.castSucc; + let vertices : Finset V := TreeSequenceVertexSet tree; chosenGamma ∈ MissingColors G + secondStable choice.vertex → ( + ∀ w ∈ vertices, Sum.inl w ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → w = choice.vertex) → choice.edge ∈ BoundaryEdges G vertices → + secondStable choice.edge = some choice.color → BoundaryColorEdges G secondStable vertices + chosenGamma = ∅ → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) → + ( + ∀ (e : E), Sum.inr e ∉ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → series.data.coloring q.succ e = secondStable e) → series.data.coloring + q.succ choice.edge = some chosenGamma → + ∀ (e : E), e ∈ BoundaryColorEdges G (series.data.coloring q.succ) vertices chosenGamma ↔ e = + choice.edge := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable secondStableProper choice + tree vertices hmissing hcomponent hchoiceBoundary hchoiceSecond hrhoGammaEmpty + hcomponentEdge hcurrentOutside hcurrentF e + constructor + · intro he + simp only [BoundaryColorEdges, Finset.mem_filter] at he + have hb0 : e ∈ BoundaryEdges G vertices := he.1 + have hb := hb0 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hb + have hc : series.data.coloring q.succ e = some chosenGamma := he.2 + by_cases hcomp : Sum.inr e ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) + · have hce := hcomponentEdge e hcomp + have hcol : secondStable e = some choice.color := by + rcases hce with hce | hce + · have hn : secondStable e ≠ some chosenGamma := by + intro heq + have hp : chosenGamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + rcases hb with ⟨x, hx, y, hy, hexy⟩ + have hxe : Incident G x e := by simp [Incident, hexy] + have hxcomp : Sum.inl x ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable chosenGamma + choice.color).connectedComponentMk + (Sum.inl x) = _ + have hadj : (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj + (Sum.inl x) (Sum.inr e) := by + simp [TwoColorIncidenceGraph, hxe, hce] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans + hcomp + have hxv : x = choice.vertex := hcomponent x hx hxcomp + subst x + exact ⟨e, hxe, heq⟩ + have hpnot : chosenGamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + exact hpnot hp + exact (hn hce).elim + · exact hce + have hceq : e = choice.edge := by + by_contra hne + have hx : ∃ x, x ∈ vertices ∧ Incident G x e := by + rcases hb with ⟨x, hx, y, hy, hexy⟩ + exact ⟨x, hx, by simp [Incident, hexy]⟩ + rcases hx with ⟨x, hx, hxe⟩ + have hxcomp : Sum.inl x ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable chosenGamma + choice.color).connectedComponentMk + (Sum.inl x) = _ + have hadj : (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj + (Sum.inl x) (Sum.inr e) := by + simp [TwoColorIncidenceGraph, hxe, hcol] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hcomp + have hxv : x = choice.vertex := hcomponent x hx hxcomp + subst x + exact (secondStableProper hne + ⟨choice.vertex, hxe, choice.edgeIncident⟩ hcol hchoiceSecond).elim + exact hceq + · have heq := hcurrentOutside e hcomp + have hbad : e ∈ BoundaryColorEdges G secondStable vertices chosenGamma := by + apply Finset.mem_filter.mpr + exact ⟨hb0, heq.symm.trans hc⟩ + rw [hrhoGammaEmpty] at hbad + simp at hbad + · intro he + subst e + apply Finset.mem_filter.mpr + exact ⟨hchoiceBoundary, hcurrentF⟩ + +private theorem helper_branch_537.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)), series.data.coloring q.succ = TwoColorComponentSwap G + secondStable chosenGamma choice.color (Sum.inl choice.vertex) → + let tree : TreeSequence G e0 := series.data.tree q.succ.castSucc; + let vertices : Finset V := TreeSequenceVertexSet tree; chosenGamma ∈ MissingColors G + secondStable choice.vertex → ( + ∀ w ∈ vertices, Sum.inl w ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → w = choice.vertex) → choice.edge ∈ BoundaryEdges G vertices → + choice.color ≠ chosenGamma → ( + ∀ {e : E}, + ∀ c ∈ TreeMissingColors choice.selected tree ∪ insert choice.color (TashkinovStoredColors + series.data q.castSucc), e ∈ BoundaryColorEdges G secondStable vertices c ↔ e ∈ + BoundaryColorEdges G choice.selected vertices c) → Sum.inr choice.edge ∈ TwoColorComponent + G secondStable chosenGamma choice.color (Sum.inl choice.vertex) → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) → + ( + ∀ (e : E), Sum.inr e ∉ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → series.data.coloring q.succ e = secondStable e) → + ∀ g ∈ BoundaryColorEdges G (series.data.coloring q.succ) (TreeSequenceVertexSet + (series.data.tree q.succ.castSucc)) choice.color, + ∃ (w : V), TreeVertexOrder (series.data.tree q.succ.castSucc) w choice.vertex ∧ Incident G w g + := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable choice currentColoring + tree vertices hmissing hcomponent hchoiceBoundary hneq hboundaryColor hfGamma + hcomponentEdge hcurrentOutside g hg + simp only [BoundaryColorEdges, Finset.mem_filter] at hg + have hb0 : g ∈ BoundaryEdges G vertices := hg.1 + have hb := hb0 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hb + have hc : series.data.coloring q.succ g = some choice.color := hg.2 + have hcomp : Sum.inr g ∉ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) := by + intro hm + have hce := hcomponentEdge g hm + have hinside : ∃ x, x ∈ vertices ∧ Incident G x g := by + rcases hb with ⟨x, hx, y, hy, hexy⟩ + exact ⟨x, hx, by simp [Incident, hexy]⟩ + rcases hinside with ⟨x, hx, hxe⟩ + have hxcomp : Sum.inl x ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).connectedComponentMk + (Sum.inl x) = _ + have hadj : (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj + (Sum.inl x) (Sum.inr g) := by + simp [TwoColorIncidenceGraph, hxe, hce] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hm + have hxv : x = choice.vertex := hcomponent x hx hxcomp + subst x + rcases hce with hce | hce + · have hp : chosenGamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨g, hxe, hce⟩ + have hpnot : chosenGamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + exact hpnot hp + · rw [congrFun currentColoring g] at hc + simp [TwoColorComponentSwap, hm, hce, hneq, hneq.symm] at hc + have hs : secondStable g = series.data.coloring q.succ g := + (hcurrentOutside g hcomp).symm + have hsc : secondStable g = some choice.color := by + rw [hs] + exact hc + have hgsel : g ∈ BoundaryColorEdges G choice.selected vertices choice.color := by + apply (hboundaryColor choice.color + (Finset.mem_union.mpr (Or.inr (Finset.mem_insert_self _ _)))).1 + apply Finset.mem_filter.mpr + exact ⟨hb0, hsc⟩ + have hdef : DefectiveColor G choice.selected vertices choice.color := by + have hfmem : choice.edge ∈ BoundaryColorEdges G choice.selected vertices choice.color := by + apply Finset.mem_filter.mpr + exact ⟨hchoiceBoundary, choice.edgeColor⟩ + unfold DefectiveColor + have hne : g ≠ choice.edge := by + intro heq + subst g + exact hcomp hfGamma + have hsset : ({choice.edge, g} : Finset E) ⊆ + BoundaryColorEdges G choice.selected vertices choice.color := by + intro z hz + simp only [Finset.mem_insert, Finset.mem_singleton] at hz + rcases hz with rfl | rfl <;> assumption + have : 2 ≤ ({choice.edge, g} : Finset E).card := by simp [hne.symm] + exact this.trans (Finset.card_le_card hsset) + rcases hb with ⟨x, hx, y, hy, hexy⟩ + have hdefv : DefectiveVertex G choice.selected vertices x := + ⟨hx, ⟨g, ⟨choice.color, hdef, hgsel⟩, by simp [Incident, hexy]⟩⟩ + rcases choice.maximal choice.selected x choice.selectedProper + choice.selectedOneUncolored choice.selectedStable hdefv with hxv | horder + · subst x + exfalso + apply hcomp + change (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).connectedComponentMk + (Sum.inr g) = (TwoColorIncidenceGraph G secondStable chosenGamma + choice.color).connectedComponentMk + (Sum.inl choice.vertex) + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, Incident, hexy, hsc] + · exact ⟨x, horder, by simp [Incident, hexy]⟩ + +private theorem helper_branch_612.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (_ : E) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)), StableColoring (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc)) choice.selected + secondStable → series.data.coloring q.succ = TwoColorComponentSwap G secondStable + chosenGamma choice.color (Sum.inl choice.vertex) → + let tree : TreeSequence G e0 := series.data.tree q.succ.castSucc; + let vertices : Finset V := TreeSequenceVertexSet tree; chosenGamma ∈ MissingColors G + secondStable choice.vertex → ( + ∀ w ∈ vertices, Sum.inl w ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → w = choice.vertex) → ColoredVertexSetClosed G secondStable vertices → + choice.color ≠ chosenGamma → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) → + ( + ∀ (e : E), Sum.inr e ∉ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → series.data.coloring q.succ e = secondStable e) → series.data.coloring + q.succ choice.edge = some chosenGamma → ColoredVertexSetElementary G (series.data.coloring + q.castSucc) (TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (series.data.coloring q.succ) (series.data.tree q.succ.castSucc), + alpha ≠ choice.color → BoundaryColorEdges G (series.data.coloring q.succ) + (TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) alpha = ∅ := by + classical + intro V E _ _ _ G k rounds e0 input series q f chosenGamma secondStable choice + secondStableRelation currentColoring tree vertices hmissing hcomponent hclosedSecond hneq + hcomponentEdge hcurrentOutside hcurrentF helem alpha halpha hne + have hsecondElementary : ColoredVertexSetElementary G secondStable vertices := by + intro x hx y hy hxy + have hd := helem hx hy hxy + simpa only [← secondStableRelation.2 x hx, ← secondStableRelation.2 y hy, + ← choice.selectedStable.2 x hx, ← choice.selectedStable.2 y hy] using hd + have hgammaNoOther : ∀ x, x ∈ vertices → x ≠ choice.vertex → + chosenGamma ∉ MissingColors G secondStable x := by + intro x hx hneX hm + have hd := hsecondElementary hx choice.vertexDefective.1 hneX + exact (Finset.disjoint_left.mp hd) hm hmissing + have hgammaCurrent : chosenGamma ∉ + TreeMissingColors (series.data.coloring q.succ) tree := by + intro hm + rcases (show chosenGamma ∈ TreeMissingColors + (series.data.coloring q.succ) tree from hm) with hm + simp only [TreeMissingColors, Finset.mem_biUnion] at hm + rcases hm with ⟨x, hx, hmx⟩ + by_cases hxeq : x = choice.vertex + · subst x + have hp : chosenGamma ∈ PresentColors G (series.data.coloring q.succ) choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, hcurrentF⟩ + have hpnot : chosenGamma ∉ PresentColors G (series.data.coloring q.succ) choice.vertex := by + simpa [MissingColors] using hmx + exact hpnot hp + · have hnot := hgammaNoOther x hx hxeq + by_cases hp : chosenGamma ∈ MissingColors G secondStable x + · exact (hnot hp).elim + · have hp' : chosenGamma ∈ PresentColors G secondStable x := by + simpa [MissingColors] using hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp' + rcases hp' with ⟨e, hex, hec⟩ + have heout : Sum.inr e ∉ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) := by + intro hein + have hecomp := hcomponentEdge e hein + have hxcomp : Sum.inl x ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable chosenGamma + choice.color).connectedComponentMk + (Sum.inl x) = _ + apply (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, hex, hecomp])).trans hein + exact hxeq (hcomponent x hx hxcomp) + have heeq := hcurrentOutside e heout + have hpCurrent : chosenGamma ∈ PresentColors G (series.data.coloring q.succ) x := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hex, heeq.trans hec⟩ + have hpnot : chosenGamma ∉ PresentColors G (series.data.coloring q.succ) x := by + simpa [MissingColors] using hmx + exact hpnot hpCurrent + have halphaGamma : alpha ≠ chosenGamma := by + intro heq + subst alpha + exact hgammaCurrent halpha + have halphaSecond : ∃ x, x ∈ vertices ∧ + alpha ∈ MissingColors G secondStable x := by + unfold TreeMissingColors at halpha + simp only [Finset.mem_biUnion] at halpha + rcases halpha with ⟨x, hx, hmx⟩ + refine ⟨x, hx, ?_⟩ + by_contra hp + have hp' : alpha ∈ PresentColors G secondStable x := by + simpa [MissingColors] using hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp' + rcases hp' with ⟨e, hex, hec⟩ + have hsame : series.data.coloring q.succ e = some alpha ↔ + secondStable e = some alpha := by + rw [congrFun currentColoring e] + by_cases hm : Sum.inr e ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) + · have hce := hcomponentEdge e hm + rcases hce with hce | hce + · simp only [TwoColorComponentSwap, Fin.castSucc_succ, hm, ↓reduceIte, hce, + Option.some.injEq] + constructor + · intro h + exact (hne h.symm).elim + · intro h + exact (halphaGamma h.symm).elim + · simp only [TwoColorComponentSwap, Fin.castSucc_succ, hm, ↓reduceIte, hce, + Option.some.injEq, hneq] + constructor + · intro h + exact (halphaGamma h.symm).elim + · intro h + exact (hne h.symm).elim + · simp [TwoColorComponentSwap, hm] + have hpCurrent : alpha ∈ PresentColors G (series.data.coloring q.succ) x := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hex, (hsame.mpr hec)⟩ + have hpnot : alpha ∉ PresentColors G (series.data.coloring q.succ) x := by + simpa [MissingColors] using hmx + exact hpnot hpCurrent + rcases halphaSecond with ⟨alphaVertex, halphaVertexIn, halphaVertexMissing⟩ + have hsecondEmpty : BoundaryColorEdges G secondStable vertices alpha = ∅ := by + apply Finset.not_nonempty_iff_eq_empty.mp + intro hn + rcases hn with ⟨e, he⟩ + simp only [BoundaryColorEdges, Finset.mem_filter] at he + have hb : e ∈ BoundaryEdges G vertices := he.1 + exact (hclosedSecond (f := e) (c := alpha) (v := alphaVertex) + he.1 halphaVertexIn he.2) halphaVertexMissing + have hsameAlpha : ∀ e, series.data.coloring q.succ e = some alpha ↔ + secondStable e = some alpha := by + intro e + rw [congrFun currentColoring e] + by_cases hm : Sum.inr e ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) + · have hce := hcomponentEdge e hm + rcases hce with hce | hce + · simp only [TwoColorComponentSwap, Fin.castSucc_succ, hm, ↓reduceIte, hce, Option.some.injEq] + constructor + · intro h + exact (hne h.symm).elim + · intro h + exact (halphaGamma h.symm).elim + · simp only [TwoColorComponentSwap, Fin.castSucc_succ, hm, ↓reduceIte, hce, + Option.some.injEq, hneq] + constructor + · intro h + exact (halphaGamma h.symm).elim + · intro h + exact (hne h.symm).elim + · simp [TwoColorComponentSwap, hm] + ext e + constructor + · intro he + have hs : e ∈ BoundaryColorEdges G secondStable vertices alpha := by + apply Finset.mem_filter.mpr + exact ⟨(Finset.mem_filter.mp he).1, + (hsameAlpha e).mp (Finset.mem_filter.mp he).2⟩ + rw [hsecondEmpty] at hs + exact False.elim (by simp at hs) + · intro he + exact False.elim (by simp at he) + +private theorem helper_continuation_891.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (f : E), + series.data.connectingEdges q.succ = ({f} : Finset E) → + ∀ (chosenGamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)), + StableColoring (series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) choice.selected + secondStable → series.data.coloring q.succ = TwoColorComponentSwap G secondStable + chosenGamma choice.color (Sum.inl choice.vertex) → series.data.connectingEdges q.succ = + ({choice.edge} : Finset E) → + let tree : TreeSequence G e0 := series.data.tree q.succ.castSucc; + let vertices : Finset V := TreeSequenceVertexSet tree; chosenGamma ∈ MissingColors G + secondStable choice.vertex → ( + ∀ w ∈ vertices, Sum.inl w ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → w = choice.vertex) → ( + ∀ {e : E}, e ∈ BoundaryEdges G vertices → TreeIncidentEdge tree e) → ( + ∀ (e : E), TreeIncidentEdge tree e → (( + ∃ c ∈ TreeMissingColors choice.selected tree ∪ (insert choice.color (TashkinovStoredColors + series.data q.castSucc) : Finset (Fin k)), choice.selected e = some c) ∨ + ∃ c ∈ TreeMissingColors choice.selected tree ∪ (insert choice.color (TashkinovStoredColors + series.data q.castSucc) : Finset (Fin k)), secondStable e = some c) → secondStable e = + choice.selected e) → ColoredVertexSetClosed G secondStable vertices → choice.edge ∈ + BoundaryEdges G vertices → secondStable choice.edge = choice.selected choice.edge → + BoundaryColorEdges G (series.data.coloring q.succ) (TreeSequenceVertexSet + (series.data.tree q.succ.castSucc)) chosenGamma = ({f} : Finset E) ∧ ( + ∀ g ∈ BoundaryColorEdges G (series.data.coloring q.succ) (TreeSequenceVertexSet + (series.data.tree q.succ.castSucc)) choice.color, + ∃ (w : V), TreeVertexOrder (series.data.tree q.succ.castSucc) w choice.vertex ∧ Incident G w + g) ∧ (ColoredVertexSetElementary G (series.data.coloring q.castSucc) + (TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (series.data.coloring q.succ) (series.data.tree q.succ.castSucc), + alpha ≠ choice.color → BoundaryColorEdges G (series.data.coloring q.succ) + (TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) alpha = ∅) := by + classical + intro V E _ _ _ G k rounds e0 input series q f hedge chosenGamma secondStable + secondStableProper choice secondStableRelation currentColoring currentEdges tree vertices + hmissing hcomponent hboundary hreverseEdge hclosedSecond hchoiceBoundary hchoiceStable + have hchoiceSecond : secondStable choice.edge = some choice.color := + hchoiceStable.trans choice.edgeColor + have hneq : choice.color ≠ chosenGamma := by + intro heq + have hp : chosenGamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, heq ▸ hchoiceSecond⟩ + have hpnot : chosenGamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + exact hpnot hp + have hgammaSelected : chosenGamma ∈ + TreeMissingColors choice.selected tree := by + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + exact ⟨choice.vertex, choice.vertexDefective.1, + (secondStableRelation.2 choice.vertex choice.vertexDefective.1).symm ▸ hmissing⟩ + have hboundaryColor : + ∀ {e : E} (c : Fin k), c ∈ TreeMissingColors choice.selected tree ∪ insert choice.color + (TashkinovStoredColors series.data q.castSucc) → (e ∈ BoundaryColorEdges G secondStable + vertices c ↔ e ∈ BoundaryColorEdges G choice.selected vertices c) := by + intro e c hcset + constructor <;> intro he + · have hb : e ∈ BoundaryEdges G vertices := (Finset.mem_filter.mp he).1 + have hc : secondStable e = some c := (Finset.mem_filter.mp he).2 + have hs : secondStable e = choice.selected e := by + apply hreverseEdge e (hboundary hb) + exact Or.inr ⟨c, hcset, hc⟩ + apply Finset.mem_filter.mpr + exact ⟨hb, hs.symm ▸ hc⟩ + · have hb : e ∈ BoundaryEdges G vertices := (Finset.mem_filter.mp he).1 + have hc : choice.selected e = some c := (Finset.mem_filter.mp he).2 + have hs : secondStable e = choice.selected e := by + apply hreverseEdge e (hboundary hb) + exact Or.inl ⟨c, hcset, hc⟩ + apply Finset.mem_filter.mpr + exact ⟨hb, hs.trans hc⟩ + have hrhoGammaEmpty : BoundaryColorEdges G secondStable vertices chosenGamma = ∅ := by + apply Finset.not_nonempty_iff_eq_empty.mp + intro ⟨e, he⟩ + simp only [BoundaryColorEdges, Finset.mem_filter] at he + have hb : e ∈ BoundaryEdges G vertices := he.1 + have hc : secondStable e = some chosenGamma := he.2 + have hn : chosenGamma ∉ MissingColors G secondStable choice.vertex := by + intro hm + exact (hclosedSecond hb + (show choice.vertex ∈ vertices from choice.vertexDefective.1) hc) hm + exact (hn hmissing).elim + have hfGamma : Sum.inr choice.edge ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hchoiceSecond] + have hcomponentEdge : + ∀ e, Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color + := by + intro e he + have hs : Sum.inr e ∈ + (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G secondStable chosenGamma choice.color) + (u := Sum.inr e) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp he + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).mem_support.mp hs + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + have hcurrentOutside : + ∀ e, Sum.inr e ∉ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → series.data.coloring q.succ e = secondStable e := by + intro e he + rw [congrFun currentColoring e] + simp [TwoColorComponentSwap, he] + have hcurrentF : series.data.coloring q.succ choice.edge = some chosenGamma := by + rw [congrFun currentColoring choice.edge] + simp [TwoColorComponentSwap, hfGamma, hchoiceSecond] + have f_eq : f = choice.edge := by + rw [currentEdges] at hedge + exact Finset.singleton_inj.mp hedge |>.symm + have hcurrentGamma : ∀ e, + e ∈ BoundaryColorEdges G (series.data.coloring q.succ) vertices chosenGamma ↔ + e = choice.edge := by + exact @helper_hcurrentGamma_463 V E inferInstance inferInstance inferInstance G k rounds e0 + input series q chosenGamma secondStable secondStableProper choice hmissing hcomponent + hchoiceBoundary hchoiceSecond hrhoGammaEmpty hcomponentEdge hcurrentOutside hcurrentF + refine ⟨?_, ?_, ?_⟩ + · ext e + change e ∈ BoundaryColorEdges G (series.data.coloring q.succ) vertices chosenGamma ↔ e ∈ ({f} + : Finset E) + simpa [f_eq] using hcurrentGamma e + · exact @helper_branch_537 V E inferInstance inferInstance inferInstance G k rounds e0 input + series q chosenGamma secondStable choice currentColoring hmissing hcomponent + hchoiceBoundary hneq hboundaryColor hfGamma hcomponentEdge hcurrentOutside + · exact @helper_branch_612 V E inferInstance inferInstance inferInstance G k rounds e0 input + series q f chosenGamma secondStable choice secondStableRelation currentColoring hmissing + hcomponent hclosedSecond hneq hcomponentEdge hcurrentOutside hcurrentF + +private theorem helper_branch_98.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) + (f : E) (delta gamma : Fin k) (v : V), series.data.kind q.succ = some + TashkinovExtensionKind.PE → series.data.connectingEdges q.succ = {f} → series.data.delta + q.succ = some delta → series.data.gamma q.succ = some gamma → series.data.chosenVertex + q.succ = some v → ∀ (ci : Fin rounds), IsProperEdgeColoring G (series.data.coloring + ci.castSucc) → IsOneEdgeUncolored (series.data.coloring ci.castSucc) e0 → + ColoredVertexSetClosed G (series.data.coloring ci.castSucc) (TreeSequenceVertexSet + (series.data.tree ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + (series.data.coloring ci.castSucc) (TreeSequenceVertexSet (series.data.tree + ci.succ.castSucc)) → ¬Nonempty (RevisitingExtensionCertificate series.data ci.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree ci.succ.castSucc) + (TashkinovStoredColors series.data ci.castSucc) (series.data.coloring ci.castSucc)), (∃ + (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (series.data.tree + ci.succ.castSucc))) → ∀ (chosenGamma : Fin k), ParallelExtensionColor series.data + ci.castSucc choice.selected choice.vertex chosenGamma → ∀ (secondStable : + PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → IsOneEdgeUncolored + secondStable e0 → StableColoring (series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data ci.castSucc)) choice.selected secondStable → TreeExit + (series.data.tree ci.succ.castSucc) secondStable chosenGamma choice.color choice.vertex → + series.data.coloring ci.succ = TwoColorComponentSwap G secondStable chosenGamma + choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G (series.data.coloring + ci.succ) → IsOneEdgeUncolored (series.data.coloring ci.succ) e0 → series.data.stored + ci.succ = {choice.color, chosenGamma} → series.data.connectingEdges ci.succ = + {choice.edge} → series.data.kind ci.succ = some TashkinovExtensionKind.PE → + series.data.chosenVertex ci.succ = some choice.vertex → series.data.outsideVertex ci.succ + = some choice.otherEndpoint → series.data.delta ci.succ = some choice.color → + series.data.gamma ci.succ = some chosenGamma → TashkinovClosure (series.data.coloring + ci.succ) (series.data.tree ci.succ.castSucc) (series.data.tree ci.succ.succ) → + TreeSequenceInitialSegment (series.data.tree ci.succ.castSucc) (series.data.tree + ci.succ.succ) → (series.data.tree ci.succ.castSucc).length < (series.data.tree + ci.succ.succ).length → q.succ = ci.succ → BoundaryColorEdges G (series.data.coloring + ci.succ) (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc)) gamma = {f} ∧ (∀ g ∈ + BoundaryColorEdges G (series.data.coloring ci.succ) (TreeSequenceVertexSet + (series.data.tree ci.succ.castSucc)) delta, ∃ (w : V), TreeVertexOrder (series.data.tree + ci.succ.castSucc) w v ∧ Incident G w g) ∧ (ColoredVertexSetElementary G + (series.data.coloring q.castSucc) (TreeSequenceVertexSet (series.data.tree + ci.succ.castSucc)) → ∀ alpha ∈ TreeMissingColors (series.data.coloring ci.succ) + (series.data.tree ci.succ.castSucc), alpha ≠ delta → BoundaryColorEdges G + (series.data.coloring ci.succ) (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc)) + alpha = ∅) := by + classical + intro V E _ _ _ G k rounds e0 input series q f delta gamma v hkind hedge hdelta hgamma hvertex + ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails chosenGamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension target_eq + have value := congrArg Fin.val target_eq + simp at value + have ci_eq : ci = q := by apply Fin.ext; omega + subst ci + rw [currentKind] at hkind + have delta_eq : delta = choice.color := Option.some.inj (hdelta.symm.trans currentDelta) + have gamma_eq : gamma = chosenGamma := Option.some.inj (hgamma.symm.trans currentGamma) + have vertex_eq : v = choice.vertex := Option.some.inj (hvertex.symm.trans currentVertex) + subst delta + subst gamma + subst v + let tree := series.data.tree q.succ.castSucc + let vertices := TreeSequenceVertexSet tree + have hmissing : chosenGamma ∈ MissingColors G secondStable choice.vertex := by + exact (secondStableRelation.2 choice.vertex choice.vertexDefective.1).symm ▸ gammaRule.1 + have hdegree : ∀ w, chosenGamma ∈ MissingColors G secondStable w ∨ + choice.color ∈ MissingColors G secondStable w → + (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).degree + (Sum.inl w) ≤ 1 := by + exact @helper_hdegree_159 V E inferInstance inferInstance inferInstance G k rounds e0 input + series q f chosenGamma secondStable secondStableProper choice + have hcomponent : ∀ w, w ∈ vertices → + Sum.inl w ∈ TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) → w = choice.vertex := by + exact @helper_hcomponent_214 V E inferInstance inferInstance inferInstance G k rounds e0 + input series q chosenGamma secondStable secondStableProper choice exitWitness hmissing + hdegree + have hboundary : ∀ {e : E}, e ∈ BoundaryEdges G vertices → + TreeIncidentEdge tree e := by + intro e he + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at he + rcases he with ⟨x, hx, y, hy, hexy⟩ + exact ⟨x, hx, by simp [Incident, hexy]⟩ + have hreverseEdge : + ∀ e, TreeIncidentEdge tree e → (( + ∃ c ∈ TreeMissingColors choice.selected tree ∪ insert choice.color (TashkinovStoredColors + series.data q.castSucc), choice.selected e = some c) ∨ ( + ∃ c ∈ TreeMissingColors choice.selected tree ∪ insert choice.color (TashkinovStoredColors + series.data q.castSucc), secondStable e = some c)) → secondStable e = choice.selected e + := by + intro e he h + exact (sc1 G e0 tree (insert choice.color + (TashkinovStoredColors series.data q.castSucc)) choice.selected secondStable + choice.selectedProper choice.selectedOneUncolored + secondStableProper secondStableOneUncolored).mp secondStableRelation e he h + have hclosedSelected : ColoredVertexSetClosed G choice.selected vertices := by + intro e c x he hx hec hmiss + have hmissOld : c ∈ MissingColors G (series.data.coloring q.castSucc) x := by + rw [← choice.selectedStable.2 x hx] + exact hmiss + have htreeOld : c ∈ TreeMissingColors + (series.data.coloring q.castSucc) tree := by + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + exact ⟨x, hx, hmissOld⟩ + have hstable := (sc1 G e0 tree (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc) choice.selected previousProper + previousOneUncolored choice.selectedProper choice.selectedOneUncolored).mp + choice.selectedStable e (hboundary he) + (Or.inr ⟨c, Finset.mem_union.mpr (Or.inl htreeOld), hec⟩) + have heold : series.data.coloring q.castSucc e = some c := by + exact hstable.symm ▸ hec + exact previousClosed he hx heold hmissOld + have htree : TreeMissingColors secondStable tree = + TreeMissingColors choice.selected tree := by + ext a + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor <;> rintro ⟨x, hx, ha⟩ <;> refine ⟨x, hx, ?_⟩ + · rw [(secondStableRelation.2 x hx)] at ha + exact ha + · rw [← (secondStableRelation.2 x hx)] at ha + exact ha + have hclosedSecond : ColoredVertexSetClosed G secondStable vertices := by + intro e c x he hx hec hmiss + have hmissSel : c ∈ MissingColors G choice.selected x := + (secondStableRelation.2 x hx).symm ▸ hmiss + have htreeSel : c ∈ TreeMissingColors choice.selected tree := by + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + exact ⟨x, hx, hmissSel⟩ + have hstable := hreverseEdge e (hboundary he) + (Or.inr ⟨c, Finset.mem_union.mpr (Or.inl htreeSel), hec⟩) + exact (hclosedSelected he hx (hstable ▸ hec) + hmissSel).elim + have hchoiceBoundary : choice.edge ∈ BoundaryEdges G vertices := by + rcases choice.edgeDefective with ⟨c, hc, he⟩ + exact (Finset.mem_filter.mp he).1 + have hchoiceTree : TreeIncidentEdge tree choice.edge := hboundary hchoiceBoundary + have hchoiceStable : secondStable choice.edge = choice.selected choice.edge := by + exact secondStableRelation.1 choice.edge hchoiceTree + ⟨choice.color, Finset.mem_union.mpr (Or.inr (Finset.mem_insert_self _ _)), + choice.edgeColor⟩ + exact @helper_continuation_891 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@q) (@f) (@hedge) (@chosenGamma) (@secondStable) + (@secondStableProper) (@choice) (@secondStableRelation) (@currentColoring) (@currentEdges) + (@hmissing) (@hcomponent) (@hboundary) (@hreverseEdge) (@hclosedSecond) (@hchoiceBoundary) + (@hchoiceStable) +theorem HkuParallelBoundaryStructure {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) + (f : E) (delta gamma : Fin k) (v : V) + (hkind : series.data.kind q.succ = some TashkinovExtensionKind.PE) + (hedge : series.data.connectingEdges q.succ = {f}) + (hdelta : series.data.delta q.succ = some delta) + (hgamma : series.data.gamma q.succ = some gamma) + (hvertex : series.data.chosenVertex q.succ = some v) : + BoundaryColorEdges G (series.data.coloring q.succ) + (TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) gamma = {f} ∧ + (∀ g ∈ BoundaryColorEdges G (series.data.coloring q.succ) + (TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) delta, + ∃ w : V, TreeVertexOrder (series.data.tree q.succ.castSucc) w v ∧ + Incident G w g) ∧ + (ColoredVertexSetElementary G (series.data.coloring q.castSucc) + (TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc), alpha ≠ delta → + BoundaryColorEdges G (series.data.coloring q.succ) + (TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) alpha = ∅) := by + classical + generalize target_eq : q.succ = target + cases series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q target_eq).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have value := congrArg Fin.val target_eq + simp at value + have ci_eq : ci = q := by apply Fin.ext; omega + subst ci + rw [currentKind] at hkind + simp at hkind + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have value := congrArg Fin.val target_eq + simp at value + have ci_eq : ci = q := by apply Fin.ext; omega + subst ci + rw [currentKind] at hkind + simp at hkind + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_98 V E inferInstance inferInstance inferInstance G k rounds e0 + input series q f delta gamma v hkind hedge hdelta hgamma hvertex ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness currentColoring + currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension target_eq +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HkuTreeColorsControlled.lean b/LeanPool/GoldbergSeymour/HkuTreeColorsControlled.lean new file mode 100644 index 0000000000..fe02e0301f --- /dev/null +++ b/LeanPool/GoldbergSeymour/HkuTreeColorsControlled.lean @@ -0,0 +1,966 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HkuIncidentColorPreserved +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeUsedColors + +/-! +# Hku Tree Colors Controlled + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_augmentationUsed_86.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E), (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ {phi : PartialEdgeColoring E k}, TreeMissingColors phi + A ⊆ TreeMissingColors phi B) → ∀ {A B : TreeSequence G e0} {phi : PartialEdgeColoring E + k}, TashkinovAugmentation phi A B → TreeUsedColors phi B ⊆ TreeMissingColors phi B ∪ + TreeUsedColors phi A := by + classical + intro V E _ _ G k e0 missingTransfer A B phi hab + let _ := Fintype.ofFinite V + rcases hab with ⟨hlen, hseg, c, hcolor, hmissing⟩ + intro d hd + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_union] at hd ⊢ + rcases hd with ⟨j, hj, hdj⟩ + by_cases hlast : j.val = A.length + · have hjlast : j = Fin.cast hlen.symm (Fin.last A.length) := by + apply Fin.ext + simp [hlast] + left + have : d = c := by + rw [hjlast] at hdj + exact (Option.some.inj (hcolor.symm.trans hdj)).symm + rw [this] + exact missingTransfer hseg hmissing + · have hjlt : j.val < A.length := by + have := j.isLt + omega + let jold : Fin A.length := ⟨j.val, hjlt⟩ + have hle : A.length ≤ B.length := hseg.1 + have hjcast : j = Fin.castLE hle jold := by + apply Fin.ext + rw [Fin.val_castLE] + have hedge : B.edge j = A.edge jold := by + rw [hjcast] + exact hseg.2.2 jold + right + refine ⟨jold, ?_, ?_⟩ + · simpa [jold] using hj + · rw [hedge] at hdj + exact hdj + +private theorem helper_firstClaim_290.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input), (∀ {A B : + TreeSequence G e0} {phi : PartialEdgeColoring E k}, TashkinovAugmentationSequence phi A B + → TreeUsedColors phi B ⊆ TreeMissingColors phi B ∪ TreeUsedColors phi A) → (∀ {A B : + TreeSequence G e0} {f : E}, TreeSequenceAdjoinEdge A f B → ∀ {phi : PartialEdgeColoring E + k} {c : Fin k}, phi f = some c → TreeUsedColors phi B ⊆ TreeUsedColors phi A ∪ {c}) → (∀ + {i : Fin (rounds + (1 : ℕ))} {c : Fin k}, (↑i : ℕ) ≠ (0 : ℕ) → c ∈ series.data.stored i → + c ∈ TreeMissingColors (series.data.coloring i) (series.data.tree i.castSucc) ∪ + TashkinovStoredColors series.data i) → (∀ {i : Fin rounds}, IsOneEdgeUncolored + (series.data.coloring i.castSucc) e0 → TreeUsedColors (series.data.coloring i.castSucc) + (series.data.tree i.succ.castSucc) ⊆ TreeMissingColors (series.data.coloring i.castSucc) + (series.data.tree i.succ.castSucc) ∪ TashkinovStoredColors series.data i.castSucc → ∀ {d : + Fin k}, d ∈ TreeUsedColors (series.data.coloring i.succ) (series.data.tree + i.succ.castSucc) → d ∈ TreeMissingColors (series.data.coloring i.succ) (series.data.tree + i.succ.castSucc) ∪ TashkinovStoredColors series.data i.succ) → ∀ (i : Fin (rounds + (1 : + ℕ))), TreeUsedColors (series.data.coloring i) (series.data.tree i.succ) ⊆ + TreeMissingColors (series.data.coloring i) (series.data.tree i.succ) ∪ + TashkinovStoredColors series.data i := by + classical + intro V E _ _ _ G k rounds e0 input series closureUsed adjoinUsed storedOrMissing colorTransport i + induction i using Fin.induction with + | zero => + have cert := series.certified (0 : Fin (rounds + 1)) + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hzero : TreeUsedColors (series.data.coloring 0) + (series.data.tree 0) = ∅ := by + ext c + simp [TreeUsedColors] + omega + have hbase := closureUsed initialClosure.1 + rw [hzero] at hbase + change TreeUsedColors (series.data.coloring 0) + (series.data.tree 1) ⊆ _ + intro c hc + exact Finset.mem_union.mpr (Or.inl (by + exact (Finset.mem_union.mp + (by simpa only [Fin.succ_zero_eq_one] using hbase hc)).resolve_right + (by simp))) + | succ i ih => + have cert := series.certified i.succ + generalize hz : i.succ = z at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hbad : i.succ.val + 1 = 0 := by simpa using congrArg Fin.val hz + omega + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : ci = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst ci + unfold IsOneEdgeUncolored at previousOneUncolored + intro d hd + have hclose := closureUsed closedExtension.1 hd + rcases Finset.mem_union.mp hclose with hm | ha + · exact Finset.mem_union.mpr (Or.inl hm) + · have hadj := adjoinUsed adjoinedExactly + (show series.data.coloring i.succ choice.edge = some choice.color by + rw [← choice.edgeColor, ← currentColoring]) + have hparts := hadj ha + rcases Finset.mem_union.mp hparts with hold | hnew + · exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (colorTransport previousOneUncolored ih hold) + · have hstored : choice.color ∈ series.data.stored i.succ := by + rw [currentStored] + simp + have hdcolor : d = choice.color := by simpa using hnew + exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (by simpa [hdcolor] using + storedOrMissing (c := choice.color) (by simp) hstored) + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : ci = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst ci + unfold IsOneEdgeUncolored at previousOneUncolored + intro d hd + have hclose := closureUsed closedExtension.1 hd + rcases Finset.mem_union.mp hclose with hm | ho + · exact Finset.mem_union.mpr (Or.inl hm) + · exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (colorTransport previousOneUncolored ih ho) + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : ci = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst ci + unfold IsOneEdgeUncolored at previousOneUncolored + intro d hd + have hclose := closureUsed closedExtension.1 hd + rcases Finset.mem_union.mp hclose with hm | ho + · exact Finset.mem_union.mpr (Or.inl hm) + · have hcol : series.data.coloring i.succ available.edge = + some available.delta ∨ series.data.coloring i.succ available.edge = + some available.gamma := by + rw [currentColoring] + cases available.returnPath with + | cons adjacent _ => + exact (TwoColorIncidenceEdgeColors adjacent).elim Or.inr Or.inl + rcases hcol with hdelta | hgamma + · have hparts := adjoinUsed adjoinedExactly hdelta ho + rcases Finset.mem_union.mp hparts with hold | hnew + · exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (colorTransport previousOneUncolored ih hold) + · have hstored : available.delta ∈ series.data.stored i.succ := by + rw [currentStored] + simp + have hdcolor : d = available.delta := by simpa using hnew + exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (by simpa [hdcolor] using storedOrMissing (c := available.delta) (by simp) hstored) + · have hparts := adjoinUsed adjoinedExactly hgamma ho + rcases Finset.mem_union.mp hparts with hold | hnew + · exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (colorTransport previousOneUncolored ih hold) + · have hstored : available.gamma ∈ series.data.stored i.succ := by + rw [currentStored] + simp + have hdcolor : d = available.gamma := by simpa using hnew + exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (by simpa [hdcolor] using storedOrMissing (c := available.gamma) (by simp) hstored) + +private theorem helper_firstColored_439.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input), (∀ {T : + TreeSequence G e0} {j : Fin T.length}, (1 : ℕ) ≤ (↑j : ℕ) → TreeIncidentEdge T (T.edge j)) + → (∀ {A B : TreeSequence G e0} {phi : PartialEdgeColoring E k}, + TashkinovAugmentationSequence phi A B → (∀ (j : Fin A.length), (1 : ℕ) ≤ (↑j : ℕ) → ∃ (c : + Fin k), phi (A.edge j) = some c) → ∀ (j : Fin B.length), (1 : ℕ) ≤ (↑j : ℕ) → ∃ (c : Fin + k), phi (B.edge j) = some c) → (∀ {A B : TreeSequence G e0} {f : E} {c : Fin k}, + TreeSequenceAdjoinEdge A f B → ∀ {phi : PartialEdgeColoring E k}, phi f = some c → (∀ (j : + Fin A.length), (1 : ℕ) ≤ (↑j : ℕ) → ∃ (d : Fin k), phi (A.edge j) = some d) → ∀ (j : Fin + B.length), (1 : ℕ) ≤ (↑j : ℕ) → ∃ (d : Fin k), phi (B.edge j) = some d) → (∀ (i : Fin + (rounds + (1 : ℕ))), TreeUsedColors (series.data.coloring i) (series.data.tree i.succ) ⊆ + TreeMissingColors (series.data.coloring i) (series.data.tree i.succ) ∪ + TashkinovStoredColors series.data i) → (∀ {A : TreeSequence G e0} {phi pi : + PartialEdgeColoring E k} {C : Finset (Fin k)}, StableColoring A C phi pi → + TreeMissingColors phi A ⊆ TreeMissingColors pi A) → ∀ (i : Fin (rounds + (1 : ℕ))) (j : + Fin (series.data.tree i.succ).length), (1 : ℕ) ≤ (↑j : ℕ) → ∃ (c : Fin k), + series.data.coloring i ((series.data.tree i.succ).edge j) = some c := by + classical + intro V E _ _ _ G k rounds e0 input series edgeIncident sequenceColored adjoinColored + firstClaim stableMissingTransfer i + induction i using Fin.induction with + | zero => + have cert := series.certified (0 : Fin (rounds + 1)) + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact sequenceColored initialClosure.1 (by + intro j hj + have hz : j.val = 0 := by simpa [seedLength] using j.isLt + omega) + | succ i ih => + have cert := series.certified i.succ + generalize hz : i.succ = z at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + have : i.succ.val + 1 = 0 := by simpa using congrArg Fin.val hz + omega + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : ci = i := by apply Fin.ext; have hv := congrArg Fin.val hz; simp at hv ⊢; omega + subst ci + intro j hj + rw [currentColoring] at closedExtension + have hold : ∀ j : Fin (series.data.tree i.succ.castSucc).length, + 1 ≤ j.val → ∃ c, choice.selected + ((series.data.tree i.succ.castSucc).edge j) = some c := by + intro j hj + obtain ⟨c, hc⟩ := ih j hj + have hs := choice.selectedStable.1 _ + (edgeIncident (T := series.data.tree i.succ.castSucc) hj) + have hmem := firstClaim i.castSucc + (by simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and]; exact ⟨j, + hj, hc⟩) + exact ⟨c, (hs ⟨c, hmem, hc⟩).trans hc⟩ + simpa [currentColoring] using (sequenceColored closedExtension.1 + (adjoinColored adjoinedExactly choice.edgeColor hold) j hj) + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : ci = i := by apply Fin.ext; have hv := congrArg Fin.val hz; simp at hv ⊢; omega + subst ci + intro j hj + have hold : ∀ j : Fin (series.data.tree i.succ.castSucc).length, + 1 ≤ j.val → ∃ c, series.data.coloring i.succ + ((series.data.tree i.succ.castSucc).edge j) = some c := by + intro j hj + obtain ⟨c, hc⟩ := ih j hj + have hmem := firstClaim i.castSucc + (by simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and]; exact ⟨j, + hj, hc⟩) + have hmem' : c ∈ TreeMissingColors (series.data.coloring i.castSucc) + (series.data.tree i.succ.castSucc) ∪ + TashkinovStoredColors series.data i.castSucc := by simpa using hmem + have hselmem : c ∈ TreeMissingColors choice.selected + (series.data.tree i.succ.castSucc) ∪ + TashkinovStoredColors series.data i.castSucc := by + rcases Finset.mem_union.mp hmem' with hm | hs + · exact Finset.mem_union.mpr (Or.inl + (stableMissingTransfer choice.selectedStable hm)) + · exact Finset.mem_union.mpr (Or.inr hs) + have hs := choice.selectedStable.1 _ + (edgeIncident (T := series.data.tree i.succ.castSucc) hj) + ⟨c, hmem, hc⟩ + have hss := secondStableRelation.1 _ + (edgeIncident (T := series.data.tree i.succ.castSucc) hj) + ⟨c, by + rcases Finset.mem_union.mp hselmem with hm | hs + · exact Finset.mem_union.mpr (Or.inl hm) + · exact Finset.mem_union.mpr (Or.inr (by simp [hs])), hs.trans hc⟩ + rw [currentColoring] + exact TwoColorComponentSwapColored (hss.trans (hs.trans hc)) + exact sequenceColored closedExtension.1 hold j hj + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : ci = i := by apply Fin.ext; have hv := congrArg Fin.val hz; simp at hv ⊢; omega + subst ci + intro j hj + rw [currentColoring] at closedExtension + have hcol : series.data.coloring i.succ available.edge = + some available.delta ∨ + series.data.coloring i.succ available.edge = + some available.gamma := by + rw [currentColoring] + cases available.returnPath with + | cons adjacent _ => + exact (TwoColorIncidenceEdgeColors adjacent).elim Or.inr Or.inl + rcases hcol with hcol | hcol + · have hcol' : series.data.coloring i.castSucc available.edge = + some available.delta := by simpa [currentColoring] using hcol + simpa [currentColoring] using (sequenceColored closedExtension.1 + (adjoinColored adjoinedExactly hcol' ih) j hj) + · have hcol' : series.data.coloring i.castSucc available.edge = + some available.gamma := by simpa [currentColoring] using hcol + simpa [currentColoring] using (sequenceColored closedExtension.1 + (adjoinColored adjoinedExactly hcol' ih) j hj) + +private theorem helper_laterClaim_567.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input), (∀ {A B : + TreeSequence G e0} {phi : PartialEdgeColoring E k}, TashkinovAugmentationSequence phi A B + → TreeUsedColors phi B ⊆ TreeMissingColors phi B ∪ TreeUsedColors phi A) → (∀ {A B : + TreeSequence G e0} {f : E}, TreeSequenceAdjoinEdge A f B → ∀ {phi : PartialEdgeColoring E + k} {c : Fin k}, phi f = some c → TreeUsedColors phi B ⊆ TreeUsedColors phi A ∪ {c}) → (∀ + {T : TreeSequence G e0} {j : Fin T.length}, (1 : ℕ) ≤ (↑j : ℕ) → TreeIncidentEdge T + (T.edge j)) → (∀ {i : Fin (rounds + (1 : ℕ))} {c : Fin k}, (↑i : ℕ) ≠ (0 : ℕ) → c ∈ + series.data.stored i → c ∈ TreeMissingColors (series.data.coloring i) (series.data.tree + i.castSucc) ∪ TashkinovStoredColors series.data i) → (∀ {i : Fin rounds}, + IsOneEdgeUncolored (series.data.coloring i.castSucc) e0 → TreeUsedColors + (series.data.coloring i.castSucc) (series.data.tree i.succ.castSucc) ⊆ TreeMissingColors + (series.data.coloring i.castSucc) (series.data.tree i.succ.castSucc) ∪ + TashkinovStoredColors series.data i.castSucc → ∀ {d : Fin k}, d ∈ TreeUsedColors + (series.data.coloring i.succ) (series.data.tree i.succ.castSucc) → d ∈ TreeMissingColors + (series.data.coloring i.succ) (series.data.tree i.succ.castSucc) ∪ TashkinovStoredColors + series.data i.succ) → ∀ (i : Fin (rounds + (1 : ℕ))), TreeUsedColors (series.data.coloring + i) (series.data.tree i.succ) ⊆ TreeMissingColors (series.data.coloring i) + (series.data.tree i.succ) ∪ TashkinovStoredColors series.data i := by + classical + intro V E _ _ _ G k rounds e0 input series closureUsed adjoinUsed edgeIncident storedOrMissing + colorTransport i + induction i using Fin.induction with + | zero => + have cert := series.certified (0 : Fin (rounds + 1)) + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hzero : TreeUsedColors (series.data.coloring 0) + (series.data.tree 0) = ∅ := by + ext c + simp [TreeUsedColors] + omega + have hbase := closureUsed initialClosure.1 + rw [hzero] at hbase + change TreeUsedColors (series.data.coloring 0) + (series.data.tree 1) ⊆ _ + intro c hc + exact Finset.mem_union.mpr (Or.inl (by + exact (Finset.mem_union.mp + (by simpa only [Fin.succ_zero_eq_one] using hbase hc)).resolve_right + (by simp))) + | succ i ih => + have cert := series.certified i.succ + generalize hz : i.succ = z at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have : i.succ.val + 1 = 0 := by simpa using congrArg Fin.val hz + omega + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : ci = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst ci + unfold IsOneEdgeUncolored at previousOneUncolored + intro d hd + have hclose := closureUsed closedExtension.1 hd + rcases Finset.mem_union.mp hclose with hm | ha + · exact Finset.mem_union.mpr (Or.inl hm) + · have hadj := adjoinUsed adjoinedExactly + (show series.data.coloring i.succ choice.edge = some choice.color by + rw [← choice.edgeColor, ← currentColoring]) + have hparts := hadj ha + rcases Finset.mem_union.mp hparts with hold | hnew + · exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (colorTransport previousOneUncolored ih hold) + /- + simp [TreeUsedColors] at hold + rcases hold with ⟨j, hj, hdj⟩ + let jj : Fin (series.data.tree i.succ.castSucc).length := + ⟨j.val, by simpa using j.isLt⟩ + have hjj : 1 ≤ jj.val := by simpa [jj] using hj + have hne : (series.data.tree i.succ.castSucc).edge jj ≠ e0 := by + intro he + have hj0 := (series.data.tree i.succ.castSucc).edge_injective + (he.trans (series.data.tree i.succ.castSucc).first_edge.symm) + have hv0 := congrArg Fin.val hj0 + omega + obtain ⟨c, hfc⟩ := previousOneUncolored.2 _ hne + have hprev : c ∈ TreeUsedColors (series.data.coloring i.castSucc) + (series.data.tree i.succ.castSucc) := by + simp [TreeUsedColors] + exact ⟨jj, hjj, hfc⟩ + have hctrl := ih hprev + have hres := HkuIncidentColorPreserved G k rounds e0 input series i + _ c (edgeIncident hjj) hfc hctrl + rcases hres.2 with ⟨d', hd', hc'⟩ + have hdj' : series.data.coloring i.succ + ((series.data.tree i.succ.castSucc).edge jj) = some d := by + simpa [jj] using hdj + have hd'' : d' = d := Option.some.inj (hd'.symm.trans hdj') + exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (by simpa [hd''] using hc') -/ + · have hstored : choice.color ∈ series.data.stored i.succ := by + rw [currentStored] + simp + have hdcolor : d = choice.color := by simpa using hnew + exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (by simpa [hdcolor] using + storedOrMissing (c := choice.color) (by simp) hstored) + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : ci = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst ci + unfold IsOneEdgeUncolored at previousOneUncolored + intro d hd + have hclose := closureUsed closedExtension.1 hd + rcases Finset.mem_union.mp hclose with hm | ho + · exact Finset.mem_union.mpr (Or.inl hm) + · exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (colorTransport previousOneUncolored ih ho) + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : ci = i := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst ci + unfold IsOneEdgeUncolored at previousOneUncolored + intro d hd + have hclose := closureUsed closedExtension.1 hd + rcases Finset.mem_union.mp hclose with hm | ho + · exact Finset.mem_union.mpr (Or.inl hm) + · have hcol : series.data.coloring i.succ available.edge = + some available.delta ∨ + series.data.coloring i.succ available.edge = + some available.gamma := by + rw [currentColoring] + cases available.returnPath with + | cons adjacent _ => + exact (TwoColorIncidenceEdgeColors adjacent).elim Or.inr Or.inl + rcases hcol with hdelta | hgamma + · have hparts := adjoinUsed adjoinedExactly hdelta ho + rcases Finset.mem_union.mp hparts with hold | hnew + · exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (colorTransport previousOneUncolored ih hold) + · have hstored : available.delta ∈ series.data.stored i.succ := by + rw [currentStored] + simp + have hdcolor : d = available.delta := by simpa using hnew + exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (by simpa [hdcolor] using storedOrMissing (c := available.delta) (by simp) hstored) + · have hparts := adjoinUsed adjoinedExactly hgamma ho + rcases Finset.mem_union.mp hparts with hold | hnew + · exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (colorTransport previousOneUncolored ih hold) + · have hstored : available.gamma ∈ series.data.stored i.succ := by + rw [currentStored] + simp + have hdcolor : d = available.gamma := by simpa using hnew + exact (HkuMissingStoredMonotone G k rounds e0 input series i).2 + (by simpa [hdcolor] using storedOrMissing (c := available.gamma) (by simp) hstored) + +private theorem helper_hp_736.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds), + IsOneEdgeUncolored (series.data.coloring q.castSucc) e0 := by + classical + intro V E _ _ _ G k rounds e0 input series q + have cert := series.certified q.succ + generalize hj : q.succ = z at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero q) hj |>.elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val hj + simp at hv + have hi : i = q := by apply Fin.ext; omega + subst i + simpa using previousOneUncolored + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val hj + simp at hv + have hi : i = q := by apply Fin.ext; omega + subst i + simpa using previousOneUncolored + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val hj + simp at hv + have hi : i = q := by apply Fin.ext; omega + subst i + simpa using previousOneUncolored + +private theorem helper_branch_776.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) + (sigma : PartialEdgeColoring E k), IsOneEdgeUncolored sigma e0 → ∀ (j : Fin + (series.data.tree q.succ.castSucc).length), (↑j : ℕ) = (0 : ℕ) → sigma ((series.data.tree + q.succ.castSucc).edge j) = series.data.coloring q.succ ((series.data.tree + q.succ.castSucc).edge j) := by + classical + intro V E _ _ _ G k rounds e0 input series q sigma hone j hj + have he : (series.data.tree q.succ.castSucc).edge j = e0 := by + rw [show j = ⟨0, (series.data.tree q.succ.castSucc).positive⟩ by + apply Fin.ext; exact hj] + exact (series.data.tree q.succ.castSucc).first_edge + have hroot : series.data.coloring q.succ e0 = none := by + have cert := series.certified q.succ + generalize hq : q.succ = z at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero q) hq |>.elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val hq + simp at hv + have hi : i = q := by apply Fin.ext; omega + subst i + rw [currentColoring] + exact choice.selectedOneUncolored.1 + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val hq + simp at hv + have hi : i = q := by apply Fin.ext; omega + subst i + exact currentOneUncolored.1 + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val hq + simp at hv + have hi : i = q := by apply Fin.ext; omega + subst i + rw [currentColoring] + exact previousOneUncolored.1 + rw [he, hroot, hone.1] + +private theorem helper_branch_820.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds), + (∀ {T : TreeSequence G e0} {j : Fin T.length}, (1 : ℕ) ≤ (↑j : ℕ) → TreeIncidentEdge T + (T.edge j)) → (∀ {i : Fin rounds}, IsOneEdgeUncolored (series.data.coloring i.castSucc) e0 + → TreeUsedColors (series.data.coloring i.castSucc) (series.data.tree i.succ.castSucc) ⊆ + TreeMissingColors (series.data.coloring i.castSucc) (series.data.tree i.succ.castSucc) ∪ + TashkinovStoredColors series.data i.castSucc → ∀ {d : Fin k}, d ∈ TreeUsedColors + (series.data.coloring i.succ) (series.data.tree i.succ.castSucc) → d ∈ TreeMissingColors + (series.data.coloring i.succ) (series.data.tree i.succ.castSucc) ∪ TashkinovStoredColors + series.data i.succ) → (∀ (i : Fin (rounds + (1 : ℕ))), TreeUsedColors + (series.data.coloring i) (series.data.tree i.succ) ⊆ TreeMissingColors + (series.data.coloring i) (series.data.tree i.succ) ∪ TashkinovStoredColors series.data i) + → (∀ (i : Fin (rounds + (1 : ℕ))) (j : Fin (series.data.tree i.succ).length), (1 : ℕ) ≤ + (↑j : ℕ) → ∃ (c : Fin k), series.data.coloring i ((series.data.tree i.succ).edge j) = some + c) → ∀ (sigma : PartialEdgeColoring E k), StableColoring (series.data.tree + q.succ.castSucc) (TashkinovStoredColors series.data q.succ) (series.data.coloring q.succ) + sigma → ∀ (j : Fin (series.data.tree q.succ.castSucc).length), ¬(↑j : ℕ) = (0 : ℕ) → sigma + ((series.data.tree q.succ.castSucc).edge j) = series.data.coloring q.succ + ((series.data.tree q.succ.castSucc).edge j) := by + classical + intro V E _ _ _ G k rounds e0 input series q edgeIncident colorTransport firstClaim + firstColored sigma hstable j hj + have hjinc : TreeIncidentEdge (series.data.tree q.succ.castSucc) + ((series.data.tree q.succ.castSucc).edge j) := by + exact edgeIncident (T := series.data.tree q.succ.castSucc) (by omega) + /- + obtain ⟨v, hv⟩ := (series.data.tree q.succ.castSucc).attaches j + exact ⟨_, by simp [TreeSequenceVertexSet], by + unfold Incident + rw [hv] + exact Sym2.mem_mk_left _ _⟩ -/ + have hprev : IsOneEdgeUncolored (series.data.coloring q.castSucc) e0 := by + have cert := series.certified q.succ + generalize hq : q.succ = z at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero q) hq |>.elim + | SE i a b c d e f g h j l m n o p r s t u => + have hv := congrArg Fin.val hq + simp at hv + have hi : i = q := by apply Fin.ext; omega + subst i + simpa using b + | PE i a b c d e f g h j l m n o p r s t u v w x y z aa ab ac ad => + have hv := congrArg Fin.val hq + simp at hv + have hi : i = q := by apply Fin.ext; omega + subst i + simpa using b + | RE i a b c d e f g h j l m n o p q' r s t => + have hv := congrArg Fin.val hq + simp at hv + have hi : i = q := by apply Fin.ext; omega + subst i + simpa using b + have hmem : + ∀ {d : Fin k}, d ∈ TreeUsedColors (series.data.coloring q.succ) (series.data.tree + q.succ.castSucc) → d ∈ TreeMissingColors (series.data.coloring q.succ) (series.data.tree + q.succ.castSucc) ∪ TashkinovStoredColors series.data q.succ := + colorTransport (i := q) hprev (firstClaim q.castSucc) + have hstableEdge := hstable.1 _ hjinc + obtain ⟨d, hd⟩ := firstColored q.castSucc j (by omega) + have hmove := HkuIncidentColorPreserved G k rounds e0 input series q + _ d hjinc hd (firstClaim q.castSucc (by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨j, Nat.one_le_iff_ne_zero.mpr hj, hd⟩)) + obtain ⟨d', hd', hctrl⟩ := hmove.2 + apply hstableEdge + refine ⟨d', hmem ?_, hd'⟩ + simp only [TreeUsedColors, Fin.castSucc_succ, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨j, Nat.one_le_iff_ne_zero.mpr hj, hd'⟩ + +private theorem helper_adjoinUsed_863.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : + ℕ) (e0 : E) {A B : TreeSequence G e0} {f : E}, TreeSequenceAdjoinEdge A f B → ∀ {phi : + PartialEdgeColoring E k} {c : Fin k}, phi f = some c → TreeUsedColors phi B ⊆ + TreeUsedColors phi A ∪ {c} := by + classical + intro V E G k e0 A B f hadj phi c hcolor + rcases hadj with ⟨hlen, hseg, hlast⟩ + intro d hd + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and, Finset.union_singleton, + Finset.mem_insert] at hd ⊢ + rcases hd with ⟨j, hj, hdj⟩ + by_cases hold : j.val < A.length + · let jold : Fin A.length := ⟨j.val, hold⟩ + have hle : A.length ≤ B.length := hseg.1 + have hjcast : j = Fin.castLE hle jold := by + apply Fin.ext + rw [Fin.val_castLE] + exact Or.inr (by + refine ⟨jold, ?_, ?_⟩ + · simpa [jold] using hj + · rw [hjcast, hseg.2.2 jold] at hdj + exact hdj) + · exact Or.inl (by + have hjlast : j = Fin.cast hlen.symm (Fin.last A.length) := by + apply Fin.ext + have := j.isLt + simp at * + omega + have : d = c := by + rw [hjlast, hlast] at hdj + exact (Option.some.inj (hcolor.symm.trans hdj)).symm + exact this) + +private theorem helper_colorTransport_913.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input), (∀ {T : + TreeSequence G e0} {j : Fin T.length}, (1 : ℕ) ≤ (↑j : ℕ) → TreeIncidentEdge T (T.edge j)) + → ∀ {i : Fin rounds}, IsOneEdgeUncolored (series.data.coloring i.castSucc) e0 → + TreeUsedColors (series.data.coloring i.castSucc) (series.data.tree i.succ.castSucc) ⊆ + TreeMissingColors (series.data.coloring i.castSucc) (series.data.tree i.succ.castSucc) ∪ + TashkinovStoredColors series.data i.castSucc → ∀ {d : Fin k}, d ∈ TreeUsedColors + (series.data.coloring i.succ) (series.data.tree i.succ.castSucc) → d ∈ TreeMissingColors + (series.data.coloring i.succ) (series.data.tree i.succ.castSucc) ∪ TashkinovStoredColors + series.data i.succ := by + classical + intro V E _ _ _ G k rounds e0 input series edgeIncident i hone hclaim d hd + unfold IsOneEdgeUncolored at hone + simp only [TreeUsedColors, Fin.castSucc_succ, Finset.mem_filter, Finset.mem_univ, true_and] at hd + rcases hd with ⟨j, hj, hdj⟩ + let jj : Fin (series.data.tree i.succ.castSucc).length := + ⟨j.val, by simp⟩ + have hjj : 1 ≤ jj.val := by simpa [jj] using hj + have hne : (series.data.tree i.succ.castSucc).edge jj ≠ e0 := by + intro he + have hj0 := (series.data.tree i.succ.castSucc).edge_injective + (he.trans (series.data.tree i.succ.castSucc).first_edge.symm) + have hv0 := congrArg Fin.val hj0 + have hz0 : jj.val = 0 := by simpa using hv0 + omega + obtain ⟨c, hfc⟩ := hone.2 _ hne + have hp : c ∈ TreeUsedColors (series.data.coloring i.castSucc) + (series.data.tree i.succ.castSucc) := by + simp only [TreeUsedColors, Fin.castSucc_succ, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨jj, hjj, hfc⟩ + have hc := hclaim hp + have hr := HkuIncidentColorPreserved G k rounds e0 input series i + _ c (edgeIncident hjj) hfc hc + rcases hr.2 with ⟨d', hd', hc'⟩ + have hdj' : series.data.coloring i.succ + ((series.data.tree i.succ.castSucc).edge jj) = some d := by + simpa [jj] using hdj + have heq : d' = d := Option.some.inj (hd'.symm.trans hdj') + simpa [heq] using hc' + +theorem HkuTreeColorsControlled {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) : + TreeUsedColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc) ⊆ + TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.castSucc ∧ + TreeUsedColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) ⊆ + TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.succ ∧ + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.succ) + (series.data.coloring q.succ) sigma → + ∀ j : Fin (series.data.tree q.succ.castSucc).length, + sigma ((series.data.tree q.succ.castSucc).edge j) = + series.data.coloring q.succ + ((series.data.tree q.succ.castSucc).edge j) := by + classical + have vertexTransfer {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + rcases hv with ⟨i, hi⟩ + rcases hab with ⟨hlen, hvertices, hedges⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, ?_⟩ + exact (hvertices i).trans hi + have missingTransfer {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {phi : PartialEdgeColoring E k} : + TreeMissingColors phi A ⊆ TreeMissingColors phi B := by + intro c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨v, hv, hvc⟩ + exact ⟨v, vertexTransfer hab hv, hvc⟩ + have usedSegment {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {phi : PartialEdgeColoring E k} : + TreeUsedColors phi A ⊆ TreeUsedColors phi B := by + intro c hc + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc ⊢ + rcases hab with ⟨hlen, hvertices, hedges⟩ + rcases hc with ⟨j, hj, hcolor⟩ + refine ⟨Fin.castLE hlen j, ?_, ?_⟩ + · exact hj + · rw [hedges j] + exact hcolor + have augmentationUsed := @helper_augmentationUsed_86 V E inferInstance inferInstance G k e0 + missingTransfer + have closureMissing {A B : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hseq : TashkinovAugmentationSequence phi A B) : + TreeMissingColors phi A ⊆ TreeMissingColors phi B := by + unfold TashkinovAugmentationSequence at hseq + induction hseq using Relation.ReflTransGen.head_induction_on with + | refl => intro c hc; exact hc + | head hstep htail ih => + intro c hc + exact ih (missingTransfer hstep.2.1 hc) + have closureUsed {A B : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hseq : TashkinovAugmentationSequence phi A B) : + TreeUsedColors phi B ⊆ TreeMissingColors phi B ∪ TreeUsedColors phi A := by + unfold TashkinovAugmentationSequence at hseq + induction hseq using Relation.ReflTransGen.head_induction_on with + | refl => + intro c hc + exact Finset.mem_union.mpr (Or.inr hc) + | head hstep htail ih => + intro c hc + have middle := ih hc + rcases Finset.mem_union.mp middle with hm | ho + · exact Finset.mem_union.mpr (Or.inl hm) + · have earlier := augmentationUsed (phi := phi) hstep ho + rcases Finset.mem_union.mp earlier with hm | ho + · exact Finset.mem_union.mpr (Or.inl (closureMissing htail hm)) + · exact Finset.mem_union.mpr (Or.inr ho) + have adjoinUsed := @helper_adjoinUsed_863 V E G k e0 + have edgeIncident {T : TreeSequence G e0} {j : Fin T.length} + (hj : 1 ≤ j.val) : TreeIncidentEdge T (T.edge j) := by + obtain ⟨v, hv⟩ := T.attaches j + refine ⟨T.vertex j.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · unfold Incident + rw [hv] + exact Sym2.mem_mk_left _ _ + have storedOrMissing {i : Fin (rounds + 1)} {c : Fin k} + (hi : i.val ≠ 0) (hs : c ∈ series.data.stored i) : + c ∈ TreeMissingColors (series.data.coloring i) + (series.data.tree i.castSucc) ∪ TashkinovStoredColors series.data i := by + by_cases hm : c ∈ TreeMissingColors (series.data.coloring i) + (series.data.tree i.castSucc) + · exact Finset.mem_union.mpr (Or.inl hm) + · exact Finset.mem_union.mpr (Or.inr (by + unfold TashkinovStoredColors + simp only [hi, ↓reduceIte, Fin.val_fin_le, Finset.mem_sdiff, Finset.mem_biUnion, + Finset.mem_univ, true_and, + hm, not_false_eq_true, and_true] + exact ⟨⟨i, by omega⟩, by simpa using hs⟩)) + have colorTransport := @helper_colorTransport_913 V E inferInstance inferInstance inferInstance G + k rounds e0 input series edgeIncident + have augmentationColored {A B : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hab : TashkinovAugmentation phi A B) + (hold : ∀ j : Fin A.length, 1 ≤ j.val → ∃ c, phi (A.edge j) = some c) : + ∀ j : Fin B.length, 1 ≤ j.val → ∃ c, phi (B.edge j) = some c := by + rcases hab with ⟨hlen, hseg, c, hcolor, hmissing⟩ + intro j hj + by_cases hlt : j.val < A.length + · let jold : Fin A.length := ⟨j.val, hlt⟩ + obtain ⟨d, hd⟩ := hold jold (by simpa [jold] using hj) + refine ⟨d, ?_⟩ + rw [show j = Fin.castLE hseg.1 jold by + apply Fin.ext; simp [jold]] + rw [hseg.2.2 jold] + exact hd + · have heq : j = Fin.cast hlen.symm (Fin.last A.length) := by + apply Fin.ext + have hjlt := j.isLt + simp at * + omega + exact ⟨c, by simpa [heq] using hcolor⟩ + have sequenceColored {A B : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hseq : TashkinovAugmentationSequence phi A B) + (hold : ∀ j : Fin A.length, 1 ≤ j.val → ∃ c, phi (A.edge j) = some c) : + ∀ j : Fin B.length, 1 ≤ j.val → ∃ c, phi (B.edge j) = some c := by + unfold TashkinovAugmentationSequence at hseq + induction hseq using Relation.ReflTransGen.head_induction_on with + | refl => exact hold + | head hstep htail ih => exact ih (augmentationColored hstep hold) + have adjoinColored {A B : TreeSequence G e0} {f : E} {c : Fin k} + (hadj : TreeSequenceAdjoinEdge A f B) {phi : PartialEdgeColoring E k} + (hcolor : phi f = some c) + (hold : ∀ j : Fin A.length, 1 ≤ j.val → ∃ d, phi (A.edge j) = some d) : + ∀ j : Fin B.length, 1 ≤ j.val → ∃ d, phi (B.edge j) = some d := by + rcases hadj with ⟨hlen, hseg, hlast⟩ + intro j hj + by_cases hlt : j.val < A.length + · let jold : Fin A.length := ⟨j.val, hlt⟩ + obtain ⟨d, hd⟩ := hold jold (by simpa [jold] using hj) + refine ⟨d, ?_⟩ + rw [show j = Fin.castLE hseg.1 jold by + apply Fin.ext; simp [jold], hseg.2.2 jold] + exact hd + · have heq : j = Fin.cast hlen.symm (Fin.last A.length) := by + apply Fin.ext + have hjlt := j.isLt + simp at * + omega + rw [← hlast] at hcolor + exact ⟨c, by simpa [heq] using hcolor⟩ + have firstClaim := @helper_firstClaim_290 V E inferInstance inferInstance inferInstance G k rounds + e0 input series closureUsed adjoinUsed storedOrMissing colorTransport + have stableMissingTransfer {A : TreeSequence G e0} + {phi pi : PartialEdgeColoring E k} {C : Finset (Fin k)} + (hst : StableColoring A C phi pi) : + TreeMissingColors phi A ⊆ TreeMissingColors pi A := by + intro c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨v, hv, hvc⟩ + refine ⟨v, hv, ?_⟩ + exact (hst.2 v hv) ▸ hvc + have firstColored := @helper_firstColored_439 V E inferInstance inferInstance inferInstance G k + rounds e0 input series edgeIncident sequenceColored adjoinColored firstClaim + stableMissingTransfer + have laterClaim := @helper_laterClaim_567 V E inferInstance inferInstance inferInstance G k rounds + e0 input series closureUsed adjoinUsed edgeIncident storedOrMissing colorTransport + exact ⟨firstClaim q.castSucc, by + have hp := @helper_hp_736 V E inferInstance inferInstance inferInstance G k rounds e0 input + series q + exact fun d hd => colorTransport hp (firstClaim q.castSucc) hd, by + intro sigma hproper hone hstable j + by_cases hj : j.val = 0 + · exact @helper_branch_776 V E inferInstance inferInstance inferInstance G k rounds e0 input + series q sigma hone j hj + · exact @helper_branch_820 V E inferInstance inferInstance inferInstance G k rounds e0 input + series q edgeIncident colorTransport firstClaim firstColored sigma hstable j hj + ⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean b/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean new file mode 100644 index 0000000000..7566665698 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean @@ -0,0 +1,528 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeries + +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Hku Unsupported Vertex Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_degree_one_of_missing_109.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (i : Fin rounds) + (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree i.succ.castSucc) + (TashkinovStoredColors series.data i.castSucc) (series.data.coloring i.castSucc)) (w : V), + gamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G secondStable w → + (TwoColorIncidenceGraph G secondStable gamma choice.color).degree (Sum.inl w) ≤ (1 : ℕ) := by + classical + intro V E _ _ _ G k rounds e0 input series i gamma secondStable secondStableProper choice w hwm + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro y hy z hz + simp only [SimpleGraph.mem_neighborFinset] at hy hz + cases y with + | inl y => simp [TwoColorIncidenceGraph] at hy + | inr e => + cases z with + | inl z => simp [TwoColorIncidenceGraph] at hz + | inr f => + have he0 := hy + have hf0 := hz + simp only [TwoColorIncidenceGraph] at he0 hf0 + rcases hwm with hwm | hwm + · have no_gamma : ¬ secondStable e = some gamma := by + intro he + have hn : gamma ∉ PresentColors G secondStable w := by + simpa [MissingColors] using hwm + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, he0.1, he⟩ + have no_gamma_f : ¬ secondStable f = some gamma := by + intro hf + have hn : gamma ∉ PresentColors G secondStable w := by simpa [MissingColors] using hwm + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, hf0.1, hf⟩ + have he : secondStable e = some choice.color := he0.2.resolve_left no_gamma + have hf : secondStable f = some choice.color := hf0.2.resolve_left no_gamma_f + by_cases hef : e = f + · exact congrArg Sum.inr hef + · exact (secondStableProper hef (⟨w, he0.1, hf0.1⟩) he hf).elim + · have no_color : ¬ secondStable e = some choice.color := by + intro he + have hn : choice.color ∉ PresentColors G secondStable w := by + simpa [MissingColors] using hwm + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, he0.1, he⟩ + have no_color_f : ¬ secondStable f = some choice.color := by + intro hf + have hn : choice.color ∉ PresentColors G secondStable w := by simpa [MissingColors] + using hwm + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨_, hf0.1, hf⟩ + have he : secondStable e = some gamma := he0.2.resolve_right no_color + have hf : secondStable f = some gamma := hf0.2.resolve_right no_color_f + by_cases hef : e = f + · exact congrArg Sum.inr hef + · exact (secondStableProper hef (⟨w, he0.1, hf0.1⟩) he hf).elim + +private theorem helper_hcomponent_167.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (i : Fin rounds) + (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree i.succ.castSucc) + (TashkinovStoredColors series.data i.castSucc) (series.data.coloring i.castSucc)), + TreeExit (series.data.tree i.succ.castSucc) secondStable gamma choice.color choice.vertex + → gamma ∈ MissingColors G secondStable choice.vertex → (∀ (w : V), gamma ∈ MissingColors G + secondStable w ∨ choice.color ∈ MissingColors G secondStable w → (TwoColorIncidenceGraph G + secondStable gamma choice.color).degree (Sum.inl w) ≤ (1 : ℕ)) → (TwoColorIncidenceGraph G + secondStable gamma choice.color).degree (Sum.inl choice.vertex) ≤ (1 : ℕ) → ∀ y ∈ + TreeSequenceVertexSet (series.data.tree i.castSucc.succ), Sum.inl y ∈ TwoColorComponent G + secondStable gamma choice.color (Sum.inl choice.vertex) → y = choice.vertex := by + classical + intro V E _ _ _ G k rounds e0 input series i gamma secondStable secondStableProper choice + exitWitness hmissing degree_one_of_missing hdegree_one y hyT hyC + rcases exitWitness with ⟨u, path, pathData⟩ + rcases pathData with ⟨path_is, path_len, u_not_tree, endpoint_tree, endpoint_only⟩ + have path_nonempty : ¬ path.Nil := by + intro hnil + have : path.length = 0 := by simpa [SimpleGraph.Walk.nil_iff_support_eq] using hnil + omega + have endpoint_missing : gamma ∈ MissingColors G secondStable choice.vertex := hmissing + have outside_degree : (TwoColorIncidenceGraph G secondStable gamma choice.color).degree + (Sum.inl u) ≤ 1 := by + apply degree_one_of_missing u + exact endpoint_only.1 + let H := TwoColorIncidenceGraph G secondStable gamma choice.color + have outside_degree' : H.degree (Sum.inl u) ≤ 1 := outside_degree + have hdegree_one' : H.degree (Sum.inl choice.vertex) ≤ 1 := hdegree_one + have all_degree : ∀ w, @SimpleGraph.degree _ H w (Fintype.ofFinite _) ≤ 2 := by + intro w + exact TwoColorIncidenceDegreeAtMostTwo G secondStable gamma choice.color + secondStableProper w + have support_closed : ∀ w, w ∈ path.support → ∀ z, H.Adj w z → z ∈ path.support := by + intro w hw z hwz + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hw + by_cases hn0 : n = 0 + · subst n + have hwstart : w = Sum.inl u := by simpa using hn.symm + let : Fintype (H.neighborSet w) := Fintype.ofFinite _ + have hcard : Fintype.card (H.neighborSet w) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert outside_degree' using 1 + cases hwstart + exact congrArg (fun inst : Fintype (H.neighborSet (Sum.inl u)) => + @SimpleGraph.degree _ H (Sum.inl u) inst) (Subsingleton.elim _ _) + have hzmem : z ∈ H.neighborSet w := by simpa [SimpleGraph.mem_neighborSet] using hwz + have hnext : path.getVert 1 ∈ H.neighborSet w := by + simpa [hwstart, SimpleGraph.mem_neighborSet] using path.adj_getVert_succ (show 0 < + path.length by omega) + have heq := Fintype.card_le_one_iff.mp hcard + ⟨z, hzmem⟩ ⟨path.getVert 1, hnext⟩ + have hz_eq : z = path.getVert 1 := congrArg Subtype.val heq + simp [hz_eq] + by_cases hne : n = path.length + · have hwend : w = Sum.inl choice.vertex := by + rw [← hn, path_is.getVert_eq_end_iff hnle] + exact hne + let : Fintype (H.neighborSet w) := Fintype.ofFinite _ + have hcard : Fintype.card (H.neighborSet w) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert hdegree_one' using 1 + cases hwend + exact congrArg (fun inst : Fintype (H.neighborSet (Sum.inl choice.vertex)) => + @SimpleGraph.degree _ H (Sum.inl choice.vertex) inst) (Subsingleton.elim _ _) + have hzmem : z ∈ H.neighborSet w := by simpa [SimpleGraph.mem_neighborSet] using hwz + have hprev : path.getVert (path.length - 1) ∈ H.neighborSet w := by + have hadj : H.Adj (Sum.inl choice.vertex) + (path.getVert (path.length - 1)) := by + have hlt : path.length - 1 < path.length := by omega + simpa [H, show path.length - 1 + 1 = path.length by omega] using + (path.adj_getVert_succ hlt).symm + have hprev' : path.getVert (path.length - 1) ∈ + H.neighborSet (Sum.inl choice.vertex) := by + simpa [SimpleGraph.mem_neighborSet] using hadj + simpa [hwend] using hprev' + have heq := Fintype.card_le_one_iff.mp hcard + ⟨z, hzmem⟩ ⟨path.getVert (path.length - 1), hprev⟩ + have hz_eq : z = path.getVert (path.length - 1) := congrArg Subtype.val heq + simp [hz_eq] + have hleft : H.Adj (path.getVert n) (path.getVert (n - 1)) := by + rw [← show n - 1 + 1 = n by omega] + exact (path.adj_getVert_succ (by omega)).symm + have hright : H.Adj (path.getVert n) (path.getVert (n + 1)) := + path.adj_getVert_succ (by omega) + by_contra hznot + have hwz' := hwz + rw [← hn] at hwz' + have hneleft : path.getVert (n - 1) ≠ z := by + intro he + apply hznot + rw [← he] + exact path.getVert_mem_support _ + have hneright : path.getVert (n + 1) ≠ z := by + intro he + apply hznot + rw [← he] + exact path.getVert_mem_support _ + have hnelr : path.getVert (n - 1) ≠ path.getVert (n + 1) := by + have hnlt : n < path.length := by omega + intro he + have hi := path_is.getVert_injOn (show n - 1 ≤ path.length by omega) + (show n + 1 ≤ path.length by omega) he + omega + let : Fintype (H.neighborSet (path.getVert n)) := Fintype.ofFinite _ + have hthree : 3 ≤ H.degree (path.getVert n) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset _ := {z, path.getVert (n - 1), path.getVert (n + 1)} + have hs : s ⊆ H.neighborFinset (path.getVert n) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hwz' + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc : 3 ≤ s.card := by + simp [s, hnelr, hneleft.symm, hneright.symm] + exact hc.trans (Finset.card_le_card hs) + have hupper : @SimpleGraph.degree _ H (path.getVert n) (Fintype.ofFinite _) ≤ 2 := + all_degree (path.getVert n) + omega + have reach : H.Reachable (Sum.inl choice.vertex) (Sum.inl y) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).Reachable _ _ + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl y) = + (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl choice.vertex) at hyC + exact SimpleGraph.ConnectedComponent.eq.mp hyC |>.symm + have ypath : Sum.inl y ∈ path.support := by + apply reach.mem_subgraphVerts + (H := (⊤ : H.Subgraph).induce {w | w ∈ path.support}) + (fun w hw z hadj => by + exact ⟨by simpa using hw, support_closed w (by simpa using hw) z hadj, + hadj⟩) + (by simp) + exact (endpoint_only.2 y hyT).mp ypath + +private theorem helper_vertex_step_297.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (_ : V) (i : Fin + rounds) (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : + MaximumDefectiveChoice G e0 (series.data.tree i.succ.castSucc) (TashkinovStoredColors + series.data i.castSucc) (series.data.coloring i.castSucc)) (a : V) (e : E), Incident G a e + → Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) + → Sum.inl a ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) := by + classical + intro V E _ _ _ G k rounds e0 input series v i gamma secondStable choice a e hae hem + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl a) = _ + have support : Sum.inr e ∈ + (TwoColorIncidenceGraph G secondStable gamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G secondStable gamma choice.color) + (u := Sum.inr e) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp hem + obtain ⟨r, hr⟩ := (TwoColorIncidenceGraph G secondStable gamma choice.color).mem_support.mp + support + have hcolors : secondStable e = some gamma ∨ + secondStable e = some choice.color := by + cases r with + | inl a => exact hr.2 + | inr r => simp [TwoColorIncidenceGraph] at hr + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, hae, hcolors])).trans hem + +private theorem helper_branch_71.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (_ : V) (i : Fin + rounds), ∀ x ∈ TreeSequenceVertexSet (series.data.tree i.succ.castSucc), ∀ (ci : Fin + rounds), IsProperEdgeColoring G (series.data.coloring ci.castSucc) → IsOneEdgeUncolored + (series.data.coloring ci.castSucc) e0 → ColoredVertexSetClosed G (series.data.coloring + ci.castSucc) (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G (series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate series.data ci.castSucc) → ∀ (choice : + MaximumDefectiveChoice G e0 (series.data.tree ci.succ.castSucc) (TashkinovStoredColors + series.data ci.castSucc) (series.data.coloring ci.castSucc)), (∃ (rho : + PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (series.data.tree + ci.succ.castSucc))) → ∀ (gamma : Fin k), ParallelExtensionColor series.data ci.castSucc + choice.selected choice.vertex gamma → ∀ (secondStable : PartialEdgeColoring E k), + IsProperEdgeColoring G secondStable → StableColoring (series.data.tree ci.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data ci.castSucc)) choice.selected + secondStable → TreeExit (series.data.tree ci.succ.castSucc) secondStable gamma + choice.color choice.vertex → series.data.coloring ci.succ = TwoColorComponentSwap G + secondStable gamma choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G + (series.data.coloring ci.succ) → IsOneEdgeUncolored (series.data.coloring ci.succ) e0 → + series.data.stored ci.succ = {choice.color, gamma} → series.data.connectingEdges ci.succ = + {choice.edge} → series.data.kind ci.succ = some TashkinovExtensionKind.PE → + series.data.chosenVertex ci.succ = some choice.vertex → series.data.outsideVertex ci.succ + = some choice.otherEndpoint → series.data.delta ci.succ = some choice.color → + series.data.gamma ci.succ = some gamma → TashkinovClosure (series.data.coloring ci.succ) + (series.data.tree ci.succ.castSucc) (series.data.tree ci.succ.succ) → + TreeSequenceInitialSegment (series.data.tree ci.succ.castSucc) (series.data.tree + ci.succ.succ) → (series.data.tree ci.succ.castSucc).length < (series.data.tree + ci.succ.succ).length → ci.succ = i.succ → ¬(series.data.kind ci.succ = some + TashkinovExtensionKind.PE ∧ series.data.chosenVertex ci.succ = some x) → MissingColors G + (series.data.coloring i.castSucc) x = MissingColors G (series.data.coloring ci.succ) x := by + classical + intro V E _ _ _ G k rounds e0 input series v i x hx ci previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma + gammaRule secondStable secondStableProper secondStableRelation exitWitness currentColoring + currentProper currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension strictExtension + hj hno + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + have hvneq : choice.vertex ≠ x := by + intro he + apply hno + exact ⟨currentKind, currentVertex.trans (congrArg some he)⟩ + have hstable := (show StableColoring _ _ _ _ from + secondStableRelation).2 x hx + rw [currentColoring] + rw [(choice.selectedStable.2 x hx).symm] + rw [hstable.symm] + have hmissing : gamma ∈ MissingColors G secondStable choice.vertex := by + exact (secondStableRelation.2 choice.vertex choice.vertexDefective.1).symm ▸ + gammaRule.1 + have degree_one_of_missing := @helper_degree_one_of_missing_109 V E inferInstance inferInstance + inferInstance G k rounds e0 input series i gamma secondStable secondStableProper choice + have hdegree_one : (TwoColorIncidenceGraph G secondStable gamma choice.color).degree + (Sum.inl choice.vertex) ≤ 1 := + degree_one_of_missing choice.vertex (Or.inl hmissing) + have hcomponent := @helper_hcomponent_167 V E inferInstance inferInstance inferInstance G k rounds + e0 input series i gamma secondStable secondStableProper choice exitWitness hmissing + degree_one_of_missing hdegree_one + have hyout : Sum.inl x ∉ TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + intro hyC + exact hvneq (hcomponent x hx hyC).symm + unfold MissingColors + have vertex_step := @helper_vertex_step_297 V E inferInstance inferInstance inferInstance G k + rounds e0 input series v i gamma secondStable choice + have edge_out : ∀ e, Incident G x e → + Sum.inr e ∉ TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + intro e he hec + apply hyout + exact vertex_step x e he hec + ext c + simp only [Finset.mem_sdiff, Finset.mem_univ, true_and] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + constructor + · intro hc hec + obtain ⟨e, he, hec⟩ := hec + apply hc + refine ⟨e, he, ?_⟩ + simpa [TwoColorComponentSwap, edge_out e he] using hec + · intro hc hec + obtain ⟨e, he, hec⟩ := hec + apply hc + refine ⟨e, he, ?_⟩ + simpa [TwoColorComponentSwap, edge_out e he] using hec + +private theorem helper_one_step_55.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (_ _ : Fin rounds) + (_ : V) (j : Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = i.succ → ∀ x ∈ + TreeSequenceVertexSet (series.data.tree i.succ.castSucc), ¬(series.data.kind j = some + TashkinovExtensionKind.PE ∧ series.data.chosenVertex j = some x) → MissingColors G + (series.data.coloring i.castSucc) x = MissingColors G (series.data.coloring j) x := by + classical + intro V E _ _ _ G k rounds e0 input series q p v j i hj x hx hno + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero i) hj.symm |>.elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + rw [currentColoring] + exact ((show StableColoring _ _ _ _ from choice.selectedStable).2 x hx).symm + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + rw [currentColoring] + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_71 V E inferInstance inferInstance inferInstance G k rounds e0 + input series v i x hx ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma + gammaRule secondStable secondStableProper secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hj hno +private theorem helper_next_segment_342.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + + (1 : ℕ))) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment (series.data.tree + i.succ.castSucc) (series.data.tree i.succ.succ) := by + classical + intro V E _ _ _ G k rounds e0 input series j i hj + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero i) hj.symm |>.elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + +private theorem helper_chain_383.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (_ _ : Fin + rounds), (∀ (T T' : TreeSequence G e0), TreeSequenceInitialSegment T T' → ∀ x ∈ + TreeSequenceVertexSet T, x ∈ TreeSequenceVertexSet T') → (∀ (j : Fin (rounds + (1 : ℕ))) + (i : Fin rounds), j = i.succ → ∀ x ∈ TreeSequenceVertexSet (series.data.tree + i.succ.castSucc), ¬(series.data.kind j = some TashkinovExtensionKind.PE ∧ + series.data.chosenVertex j = some x) → MissingColors G (series.data.coloring i.castSucc) x + = MissingColors G (series.data.coloring j) x) → (∀ (j : Fin (rounds + (1 : ℕ))) (i : Fin + rounds), j = i.succ → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) + (series.data.tree i.succ.succ)) → ∀ (a b : Fin rounds), (↑a : ℕ) ≤ (↑b : ℕ) → ∀ x ∈ + TreeSequenceVertexSet (series.data.tree a.succ.castSucc), (∀ (j : Fin rounds), (↑a : ℕ) ≤ + (↑j : ℕ) → (↑j : ℕ) ≤ (↑b : ℕ) → ¬(series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.chosenVertex j.succ = some x)) → MissingColors G + (series.data.coloring a.castSucc) x = MissingColors G (series.data.coloring b.succ) x := by + classical + intro V E _ _ _ G k rounds e0 input series q p vertex_transfer one_step next_segment a b hab x + hxa hnu + induction h : b.val - a.val using Nat.strong_induction_on generalizing a b with + | h n ih => + by_cases he : a.val = b.val + · have habeq : a = b := Fin.ext he + subst b + exact one_step a.succ a rfl x hxa (by + intro hh + exact hnu a le_rfl le_rfl hh) + · have halt : a.val + 1 ≤ b.val := by omega + let mid : Fin rounds := ⟨a.val + 1, by omega⟩ + have hmidval : mid.val = a.val + 1 := rfl + have hseg := next_segment a.succ a rfl + have hmid : mid = ⟨a.val + 1, by omega⟩ := rfl + have hxm : x ∈ TreeSequenceVertexSet (series.data.tree mid.succ.castSucc) := by + apply vertex_transfer _ _ (show TreeSequenceInitialSegment + (series.data.tree a.succ.castSucc) + (series.data.tree mid.succ.castSucc) from ?_) x hxa + have heq : mid.succ.castSucc = a.succ.succ := by + apply Fin.ext + simp [mid] + rw [heq] + exact hseg + have hfirst := one_step a.succ a rfl x hxa (by + intro hh + exact hnu a le_rfl (by omega) hh) + have hrest := ih (b.val - mid.val) (by omega) mid b (by omega) hxm (by + intro j hj1 hj2 + exact hnu j (by omega) (by omega)) (by simp) + exact hfirst.trans hrest + +theorem HkuUnsupportedVertexColors {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q p : Fin rounds) + (v : V) (hpq : p.val ≤ q.val) + (hv : v ∈ TreeSequenceVertexSet (series.data.tree p.succ.castSucc)) + (hunused : ∀ j : Fin rounds, p.val ≤ j.val → j.val ≤ q.val → + ¬ (series.data.kind j.succ = some TashkinovExtensionKind.PE ∧ + series.data.chosenVertex j.succ = some v)) : + MissingColors G (series.data.coloring p.castSucc) v = + MissingColors G (series.data.coloring q.succ) v := by + classical + have vertex_transfer : + ∀ (T T' : TreeSequence G e0), TreeSequenceInitialSegment T T' → + ∀ x, x ∈ TreeSequenceVertexSet T → x ∈ TreeSequenceVertexSet T' := by + intro T T' hseg x hx + unfold TreeSequenceVertexSet at hx ⊢ + simp only [Finset.mem_image] at hx ⊢ + obtain ⟨i, hi, rfl⟩ := hx + rcases hseg with ⟨hlen, hvertex, hedge⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, by + simpa using (hvertex i)⟩ + have one_step := @helper_one_step_55 V E inferInstance inferInstance inferInstance G k rounds e0 + input series q p v + have next_segment := @helper_next_segment_342 V E inferInstance inferInstance inferInstance G k + rounds e0 input series + have chain := @helper_chain_383 V E inferInstance inferInstance inferInstance G k rounds e0 input + series q p vertex_transfer one_step next_segment + exact chain p q hpq v hv hunused + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Imports.lean b/LeanPool/GoldbergSeymour/Imports.lean new file mode 100644 index 0000000000..dc6e768ca2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Imports.lean @@ -0,0 +1,736 @@ +/- +Copyright (c) 2026 Lean Pool contributors. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Lean Pool contributors +-/ +module -- shake: keep-all --deprecated_module: ignore + +-- Generated project imports; run `lake exe mk_all`. +public import LeanPool.GoldbergSeymour +public import LeanPool.GoldbergSeymour.AbsentOwnerReplacement +public import LeanPool.GoldbergSeymour.AbsorbingVertex +public import LeanPool.GoldbergSeymour.AbsorbingVertices +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveBaseStage +public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveInitialGoodHierarchy +public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveParallelStrictGrowth +public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveSeed +public import LeanPool.GoldbergSeymour.AlgorithmFiveSixFixedRootRefresh +public import LeanPool.GoldbergSeymour.AlgorithmThreeOneChoiceDataExists +public import LeanPool.GoldbergSeymour.AlgorithmThreeOneInitialSeriesExists +public import LeanPool.GoldbergSeymour.AlgorithmThreeOneStepExists +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.BaseControl +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.BaseExtraReplacement +public import LeanPool.GoldbergSeymour.Basic2 +public import LeanPool.GoldbergSeymour.Basic2TerminalPE +public import LeanPool.GoldbergSeymour.Basic2TerminalSERE +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.BoundaryMissingColorAugmentation +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.CertifiedSeriesRoundsBound +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ChangeLemmaBothInside +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation1 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation2 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation3 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation4 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation5 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation6 +public import LeanPool.GoldbergSeymour.ChangeLemmaInsideOutside +public import LeanPool.GoldbergSeymour.ChangeLemmaMixedClosedFinal +public import LeanPool.GoldbergSeymour.ChangeLemmaMixedLargestClosed +public import LeanPool.GoldbergSeymour.ChangeLemmaMixedNoClosed +public import LeanPool.GoldbergSeymour.ChangeLemmaMixedZeroNonclosed +public import LeanPool.GoldbergSeymour.ChromaticIndex +public import LeanPool.GoldbergSeymour.ChromaticIndexRestrict +public import LeanPool.GoldbergSeymour.ChromaticIndexSpec +public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge +public import LeanPool.GoldbergSeymour.ClosedCoreElementary +public import LeanPool.GoldbergSeymour.ClosedSetTwoColorComponentAvoidance +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed +public import LeanPool.GoldbergSeymour.ColoringExists +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CommonMissingColorsAtUncoloredEndpoints +public import LeanPool.GoldbergSeymour.ConditionNineTransport +public import LeanPool.GoldbergSeymour.CopyAugmentationPrefix +public import LeanPool.GoldbergSeymour.CoreClosurePresentation +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTransTrees +public import LeanPool.GoldbergSeymour.CorrespondingTerminalClosureEq +public import LeanPool.GoldbergSeymour.Critical +public import LeanPool.GoldbergSeymour.CriticalCoreExists +public import LeanPool.GoldbergSeymour.CriticalGraphElementaryWitness +public import LeanPool.GoldbergSeymour.CurrentElementaryOrGoodHierarchyConstructionLarge +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveColorComponentPath +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.DefectiveEdge +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.DeleteEdge +public import LeanPool.GoldbergSeymour.Density +public import LeanPool.GoldbergSeymour.DensityCeil +public import LeanPool.GoldbergSeymour.DensityLowerBound +public import LeanPool.GoldbergSeymour.DensityMonotone +public import LeanPool.GoldbergSeymour.DensityValue +public import LeanPool.GoldbergSeymour.DisplayedEdges +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable +public import LeanPool.GoldbergSeymour.EarlierPECycleFirstNonrevisitingInternal +public import LeanPool.GoldbergSeymour.Elementary +public import LeanPool.GoldbergSeymour.ElementaryClosedExitPairDistinctComponents +public import LeanPool.GoldbergSeymour.ElementaryClosedExitPairExtendsTriple +public import LeanPool.GoldbergSeymour.ElementaryClosedExitPairSameComponent +public import LeanPool.GoldbergSeymour.ElementaryClosedMissingColorOdd +public import LeanPool.GoldbergSeymour.ElementaryClosedNoninterchangeableDisjointExitPaths +public import LeanPool.GoldbergSeymour.ElementaryClosedNoninterchangeableExitPair +public import LeanPool.GoldbergSeymour.ElementaryEndpointExclusion +public import LeanPool.GoldbergSeymour.ElementaryPrefixSwap +public import LeanPool.GoldbergSeymour.ElementarySingleBoundaryInterchangeable +public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent +public import LeanPool.GoldbergSeymour.ElementaryTransfer +public import LeanPool.GoldbergSeymour.EligibleIndexBoundConstruction +public import LeanPool.GoldbergSeymour.EligibleIndexBoundPreparation +public import LeanPool.GoldbergSeymour.EligibleOddSet +public import LeanPool.GoldbergSeymour.EmptyCommonMissingLocation +public import LeanPool.GoldbergSeymour.ExtendedTashkinovColoringSequence +public import LeanPool.GoldbergSeymour.ExtendedTashkinovLadderStage +public import LeanPool.GoldbergSeymour.ExtendedTashkinovRungNumber +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTreePrefix +public import LeanPool.GoldbergSeymour.ExtensionBase +public import LeanPool.GoldbergSeymour.ExtensionBaseActiveIndices +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmA +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmAColorState +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmAInduction +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmASingleStep +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmATraceExists +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmB +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBInduction +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBInvariant +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBSingleStep +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTraceExists +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmC +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmCInvariant +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmCTrace +public import LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary +public import LeanPool.GoldbergSeymour.ExtensionBaseBranchLemmas +public import LeanPool.GoldbergSeymour.ExtensionBaseBranchPreparation +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneIndices +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneSelection +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoContradiction +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation19 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation20 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation21 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation23 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43EdgeEffects +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43MissingColors +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43Stability +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43TreeEdges +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim44 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim45 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim45Singleton +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim46 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimMissingColors +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimStrongInterchangeable +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimTreeEdgeColors +public import LeanPool.GoldbergSeymour.ExtensionBaseClosure +public import LeanPool.GoldbergSeymour.ExtensionBaseDeltaExclusion +public import LeanPool.GoldbergSeymour.ExtensionBaseLeastActiveDeltaTransport +public import LeanPool.GoldbergSeymour.ExtensionBasePESlotDeltaNotMissing +public import LeanPool.GoldbergSeymour.ExtensionBasePreparations +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationIndices +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationInvariant +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace +public import LeanPool.GoldbergSeymour.ExtensionBaseSameSupportStoredPairOverlap +public import LeanPool.GoldbergSeymour.ExtensionBaseStepLemmas +public import LeanPool.GoldbergSeymour.ExtensionBaseStoredPairOverlap +public import LeanPool.GoldbergSeymour.ExtensionBaseStrictDeltaExclusion +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassEnumeration +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportOrder +public import LeanPool.GoldbergSeymour.ExtensionRules +public import LeanPool.GoldbergSeymour.ExtensionRulesEarlierIndices +public import LeanPool.GoldbergSeymour.ExtensionRulesPEFirstAppearanceBound +public import LeanPool.GoldbergSeymour.ExtensionRulesTerminalEarlierAppearance +public import LeanPool.GoldbergSeymour.ExtensionRulesTerminalLastAppearance +public import LeanPool.GoldbergSeymour.ExtensionRulesTerminalStoredDisjoint +public import LeanPool.GoldbergSeymour.FiniteStrictGrowthReachesTerminal +public import LeanPool.GoldbergSeymour.FirstEntryClipping +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.GeneralHighIndexElementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.GlobalMaximumTripleExists +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport +public import LeanPool.GoldbergSeymour.GoodHierarchyElementaryLarge +public import LeanPool.GoldbergSeymour.GoodHierarchyInitialPairsNonPE +public import LeanPool.GoldbergSeymour.GoodHierarchyInitialPairsPE +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixConstruction +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixPreparation +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedAugmentation +public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedEndpointMinusClosed +public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedEndpointReconstruction +public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedMaximalChain +public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerReconstruction +public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerTransport +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HasKEdgeColoring +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport +public import LeanPool.GoldbergSeymour.HierarchyBaseExists +public import LeanPool.GoldbergSeymour.HierarchyCaseThreePreparation +public import LeanPool.GoldbergSeymour.HierarchyClaimNine +public import LeanPool.GoldbergSeymour.HierarchyClaimNineFirstUseAfterSeed +public import LeanPool.GoldbergSeymour.HierarchyClaimNineFirstUseSeed +public import LeanPool.GoldbergSeymour.HierarchyClaimNinePENormalization +public import LeanPool.GoldbergSeymour.HierarchyClaimNineUnusedTailColor +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleOneAdditionPositiveDividerImpossible +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleOneAdditionZeroDividerImpossible +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePathNumberBounds +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTerminalCommonMissing +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyNormalizationLemmas +public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction +public import LeanPool.GoldbergSeymour.HierarchyOutsideKempeStable +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchyPrefixData +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySituationOneAdvanceInsideStored +public import LeanPool.GoldbergSeymour.HierarchySituationOneAdvanceOutsideStored +public import LeanPool.GoldbergSeymour.HierarchySituationOneImpossible +public import LeanPool.GoldbergSeymour.HierarchySituationOnePenultimateCommonMissing +public import LeanPool.GoldbergSeymour.HierarchySituationOneShorteningContradiction +public import LeanPool.GoldbergSeymour.HierarchySituationThreeClaimJMinusOneEmpty +public import LeanPool.GoldbergSeymour.HierarchySituationThreeClaimJMinusOneNonempty +public import LeanPool.GoldbergSeymour.HierarchySituationThreeColorChoice +public import LeanPool.GoldbergSeymour.HierarchySituationThreeComponentIntersectionShortening +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointPreparation +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaStoredImpossible +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible +public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound +public import LeanPool.GoldbergSeymour.HierarchySituationThreeImpossible +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalization +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalizedData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeOneData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoExclusions +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoTwoData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCommonTailData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoImpossible +public import LeanPool.GoldbergSeymour.HierarchySituationTwoOutsidePenultimateReconstruction +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified.Preparation1 +public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified.Preparation2 +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOneNonexceptional +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOneStoredException +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneTwo +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeOne.Preparation1 +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeOne.Preparation2 +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeTwo +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOneNonexceptional +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOneStoredException +public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoTwo +public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.HkuIncidentColorPreserved +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IncidentCore +public import LeanPool.GoldbergSeymour.IncidentCoreChromaticIndex +public import LeanPool.GoldbergSeymour.IncidentCoreColoringTransport +public import LeanPool.GoldbergSeymour.IncidentCoreCritical +public import LeanPool.GoldbergSeymour.IncidentCoreDegree +public import LeanPool.GoldbergSeymour.IncidentCoreDensity +public import LeanPool.GoldbergSeymour.IncidentCoreElementaryTransfer +public import LeanPool.GoldbergSeymour.IncidentCoreEndpoints +public import LeanPool.GoldbergSeymour.IncidentCoreIncidence +public import LeanPool.GoldbergSeymour.IncidentCoreInternalEdges +public import LeanPool.GoldbergSeymour.IncidentCoreKTriple +public import LeanPool.GoldbergSeymour.IncidentCoreMaximumDegree +public import LeanPool.GoldbergSeymour.IncidentCoreMissingColors +public import LeanPool.GoldbergSeymour.IncidentCoreNoIsolated +public import LeanPool.GoldbergSeymour.IncidentCoreReduction +public import LeanPool.GoldbergSeymour.IncidentCoreTashkinovOrder +public import LeanPool.GoldbergSeymour.IncidentCoreTreeTransport +public import LeanPool.GoldbergSeymour.IncidentVertex +public import LeanPool.GoldbergSeymour.IncidentVertexFintype +public import LeanPool.GoldbergSeymour.InterchangePEClosedCore +public import LeanPool.GoldbergSeymour.InterchangePEClosureConstituent +public import LeanPool.GoldbergSeymour.InterchangePECommonMissingClosed +public import LeanPool.GoldbergSeymour.InterchangePEMixedCore +public import LeanPool.GoldbergSeymour.InterchangePETreeAwayFromDelta +public import LeanPool.GoldbergSeymour.InterchangePETreeConstituent +public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.IsFullEdgeColoring +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.KempeOrientation +public import LeanPool.GoldbergSeymour.LargeOrderTerminalWitness +public import LeanPool.GoldbergSeymour.LateOwnerReplacement +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis +public import LeanPool.GoldbergSeymour.LowerRoundProperties +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoiceExists +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumDegreeRestrict +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyAppend +public import LeanPool.GoldbergSeymour.MaximumPropertyPrefix +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MaximumStableClosureExists +public import LeanPool.GoldbergSeymour.MinimumContextTransport +public import LeanPool.GoldbergSeymour.MinusClosedTransport +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.MixedNoClosedTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.NestedOddMissingPair +public import LeanPool.GoldbergSeymour.NineN +public import LeanPool.GoldbergSeymour.NormalCycleEdge +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.NormalTripleTrunk +public import LeanPool.GoldbergSeymour.NormalizePositiveTerminalMaximum +public import LeanPool.GoldbergSeymour.NormalizedDatum +public import LeanPool.GoldbergSeymour.OneAdditionPreparatoryLemmas +public import LeanPool.GoldbergSeymour.OneDividerRefresh +public import LeanPool.GoldbergSeymour.OppositeRootComponents +public import LeanPool.GoldbergSeymour.OrderedExitCounterexample +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OrderedTreeUnionAugmentationSequence +public import LeanPool.GoldbergSeymour.OrderedTreeUnionExists +public import LeanPool.GoldbergSeymour.OutsideExitTransport +public import LeanPool.GoldbergSeymour.OutsideKempeGoodHierarchy +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.OutsidePrefixBranch +public import LeanPool.GoldbergSeymour.OutsideSwapPrefixEffects +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable +public import LeanPool.GoldbergSeymour.ParallelBaseFourCommonMissingColors +public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.ParallelCoreAugmentationStrict +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.ParallelExtensionColorAppend +public import LeanPool.GoldbergSeymour.ParallelExtensionColorExists +public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.ParallelSpecialClosurePreparation +public import LeanPool.GoldbergSeymour.ParallelStepRootComponentSetup +public import LeanPool.GoldbergSeymour.ParallelSupportClosureProperties +public import LeanPool.GoldbergSeymour.ParallelTerminalAwayInterchangeable +public import LeanPool.GoldbergSeymour.ParallelTerminalFacts +public import LeanPool.GoldbergSeymour.ParallelTerminalPEPreprocessing +public import LeanPool.GoldbergSeymour.ParallelTwoConstituentPathContradiction +public import LeanPool.GoldbergSeymour.PartialEdgeColoring +public import LeanPool.GoldbergSeymour.PositivePrefixNoRevisiting +public import LeanPool.GoldbergSeymour.PositivePrefixPresentation +public import LeanPool.GoldbergSeymour.PositiveWellDefinedness +public import LeanPool.GoldbergSeymour.Preamble +public import LeanPool.GoldbergSeymour.PredecessorElementary +public import LeanPool.GoldbergSeymour.PrefixSegmentTransport +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ProperColoringRestricts +public import LeanPool.GoldbergSeymour.RecoloredPrefixReconstruction +public import LeanPool.GoldbergSeymour.RestrictEdges +public import LeanPool.GoldbergSeymour.RestrictedAugmentationCorrespondingEndpoint +public import LeanPool.GoldbergSeymour.RetainedHierarchy +public import LeanPool.GoldbergSeymour.RevisitingCertificatePreparation +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificateAppend +public import LeanPool.GoldbergSeymour.RevisitingExtensionSeedStoredColor +public import LeanPool.GoldbergSeymour.RevisitingTerminalPreparation +public import LeanPool.GoldbergSeymour.RevisitingTerminalStatements +public import LeanPool.GoldbergSeymour.RutgersClosedPresentation +public import LeanPool.GoldbergSeymour.RutgersCounterexample +public import LeanPool.GoldbergSeymour.RutgersCounterexampleMeasure +public import LeanPool.GoldbergSeymour.RutgersCounterexampleMinimumExists +public import LeanPool.GoldbergSeymour.RutgersCurrentRungInterchangeability +public import LeanPool.GoldbergSeymour.RutgersMiddleExitOutsideTerminalLadder +public import LeanPool.GoldbergSeymour.RutgersStrictShortening +public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.ScheideAbsorbingElementary +public import LeanPool.GoldbergSeymour.ScheideBalancedCandidate +public import LeanPool.GoldbergSeymour.ScheideBalancedCandidateMaximumExists +public import LeanPool.GoldbergSeymour.ScheideBalancedCandidateMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideBalancedCandidateNormalTransport +public import LeanPool.GoldbergSeymour.ScheideBalancedExists +public import LeanPool.GoldbergSeymour.ScheideBalancedFromMaxNormal +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainDepartureReturn +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainLastReturnNoFree +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists +public import LeanPool.GoldbergSeymour.ScheideDefectiveCrossingSelection +public import LeanPool.GoldbergSeymour.ScheideDefectiveDeletedTreePair +public import LeanPool.GoldbergSeymour.ScheideDefectiveLastReturnExists +public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross +public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnContradiction +public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData +public import LeanPool.GoldbergSeymour.ScheideDefectiveSecondTerminalComponent +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetupExists +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideDefectiveTailExternal +public import LeanPool.GoldbergSeymour.ScheideDefectiveTerminalComponent +public import LeanPool.GoldbergSeymour.ScheideDefectiveThirdBoundaryEdge +public import LeanPool.GoldbergSeymour.ScheideDeletedMissingReplacementInternal +public import LeanPool.GoldbergSeymour.ScheideDepartureReturn +public import LeanPool.GoldbergSeymour.ScheideEnlargedBoundarySelection +public import LeanPool.GoldbergSeymour.ScheideEnlargedClosed +public import LeanPool.GoldbergSeymour.ScheideEnlargedElementary +public import LeanPool.GoldbergSeymour.ScheideEnlargedStrictAugmentation +public import LeanPool.GoldbergSeymour.ScheideEnlargedStronglyClosed +public import LeanPool.GoldbergSeymour.ScheideEnlargedSwitchTransport +public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet +public import LeanPool.GoldbergSeymour.ScheideExitNoFree +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertexTreeExit +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFourFree +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd +public import LeanPool.GoldbergSeymour.ScheideHeightFiveGammaEdges +public import LeanPool.GoldbergSeymour.ScheideHeightFiveOutsideLinks +public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound +public import LeanPool.GoldbergSeymour.ScheideLargeHeightElementary +public import LeanPool.GoldbergSeymour.ScheideLargeHeightFullTrunk +public import LeanPool.GoldbergSeymour.ScheideLargeHeightOneTailPair +public import LeanPool.GoldbergSeymour.ScheideLastExitPath +public import LeanPool.GoldbergSeymour.ScheideMaximalContainsEveryTree +public import LeanPool.GoldbergSeymour.ScheideMaximalElementaryClosed +public import LeanPool.GoldbergSeymour.ScheideMaximalExtendsEveryTree +public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath +public import LeanPool.GoldbergSeymour.ScheideMaximalOddOrder +public import LeanPool.GoldbergSeymour.ScheideMaximumExtensionNormalWitness +public import LeanPool.GoldbergSeymour.ScheideNormalisation +public import LeanPool.GoldbergSeymour.ScheideOrderNineBlockCompletion +public import LeanPool.GoldbergSeymour.ScheideOrderNineBlockStructure +public import LeanPool.GoldbergSeymour.ScheideOrderNineExitLocalization +public import LeanPool.GoldbergSeymour.ScheideOrderNineParameters +public import LeanPool.GoldbergSeymour.ScheideOrderNineRebasingPreparation +public import LeanPool.GoldbergSeymour.ScheideOrderNineStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideOriginalDefectiveConfinement +public import LeanPool.GoldbergSeymour.ScheideOriginalNondefectiveConfinement +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideReplacementAbsorbing +public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryAtLeastThree +public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryAtMostThree +public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryParity +public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryUnique +public import LeanPool.GoldbergSeymour.ScheideReplacementConfinement +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementExitNotDefective +public import LeanPool.GoldbergSeymour.ScheideReplacementFamilyExists +public import LeanPool.GoldbergSeymour.ScheideReplacementInternalMissing +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideReplacementMissingDeletedInternal +public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed +public import LeanPool.GoldbergSeymour.ScheideReplacementPairsLaminar +public import LeanPool.GoldbergSeymour.ScheideReplacementPathPrefix +public import LeanPool.GoldbergSeymour.ScheideReplacementTreeSplice +public import LeanPool.GoldbergSeymour.ScheideReplacementUnionClosed +public import LeanPool.GoldbergSeymour.ScheideReplacementUsedWitness +public import LeanPool.GoldbergSeymour.ScheideReversedKempePathTree +public import LeanPool.GoldbergSeymour.ScheideReversedPathCertificate +public import LeanPool.GoldbergSeymour.ScheideReversedPathPreparation +public import LeanPool.GoldbergSeymour.ScheideSelectedBlockDeletion +public import LeanPool.GoldbergSeymour.ScheideSingleBoundaryCrossing +public import LeanPool.GoldbergSeymour.ScheideSmallHeightElementary +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair +public import LeanPool.GoldbergSeymour.ScheideStructuralLemma +public import LeanPool.GoldbergSeymour.ScheideStructuralReducedAssembly +public import LeanPool.GoldbergSeymour.ScheideStructuralReduction +public import LeanPool.GoldbergSeymour.ScheideStructuralReordering +public import LeanPool.GoldbergSeymour.ScheideStructuralReorderingData +public import LeanPool.GoldbergSeymour.ScheideStructuralSelection +public import LeanPool.GoldbergSeymour.ScheideStructuralSelectionData +public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal +public import LeanPool.GoldbergSeymour.ScheideSymmetricMissingInternal +public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalBoundaryAvoidance +public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalFreePath +public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalPathOrder +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryAvoidance +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryConfiguration +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementFreePath +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementPathOrder +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationNormal +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationPreserves +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree +public import LeanPool.GoldbergSeymour.ScheideTwoColorLastExitPath +public import LeanPool.GoldbergSeymour.SimpleExtensionSeedStoredColor +public import LeanPool.GoldbergSeymour.SplitSwapData +public import LeanPool.GoldbergSeymour.SplitSwapPreparation +public import LeanPool.GoldbergSeymour.StableChange +public import LeanPool.GoldbergSeymour.StableChangeCaseThree +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation1 +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation2 +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation3 +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation4 +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation5 +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoStarredTail +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.StableColoringExitExtension +public import LeanPool.GoldbergSeymour.StableColoringFullCertificate +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.StableSeriesCycleComponentTransport +public import LeanPool.GoldbergSeymour.StarredPrefixPreparation +public import LeanPool.GoldbergSeymour.Step1CaseOneInsidePositiveDivider +public import LeanPool.GoldbergSeymour.Step1CaseOneInsideStar +public import LeanPool.GoldbergSeymour.Step1CaseOneInsideZeroNonPE +public import LeanPool.GoldbergSeymour.Step1CaseOneInsideZeroPE +public import LeanPool.GoldbergSeymour.Step1CaseOneOutsideStar +public import LeanPool.GoldbergSeymour.Step1CaseTwoInsidePositiveDivider +public import LeanPool.GoldbergSeymour.Step1CaseTwoInsideStar +public import LeanPool.GoldbergSeymour.Step1CaseTwoInsideZeroNonPE +public import LeanPool.GoldbergSeymour.Step1CaseTwoInsideZeroPE +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsidePrefixHierarchy +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsidePrefixTwoEdges +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsideRecoloredPrefix +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsideRestrictedAugmentation +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsideStar +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsideTwoEdgeExtension +public import LeanPool.GoldbergSeymour.Step1ExitLegGlobalMinimum +public import LeanPool.GoldbergSeymour.Step1ExitLegMinimum +public import LeanPool.GoldbergSeymour.Step1ExitLegMinimumExists +public import LeanPool.GoldbergSeymour.Step1ExitLegPrecoloringElementary +public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation +public import LeanPool.GoldbergSeymour.Step1ExitLegPresentationExists +public import LeanPool.GoldbergSeymour.Step1ExitLegThetaPositive +public import LeanPool.GoldbergSeymour.Step1ExitLegThetaZeroNonparallel +public import LeanPool.GoldbergSeymour.Step1ExitLegThetaZeroParallel +public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchor +public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchorNonPE +public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchorPE +public import LeanPool.GoldbergSeymour.StrongInterchangeabilityKempePreserved +public import LeanPool.GoldbergSeymour.StronglyClosedWitnessElementary +public import LeanPool.GoldbergSeymour.SupportingPEColorChain +public import LeanPool.GoldbergSeymour.SupportingPEMissingTransport +public import LeanPool.GoldbergSeymour.SupportingPEStoredIntersection +public import LeanPool.GoldbergSeymour.TashTree +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeCaseNoRepeatedOnPath +public import LeanPool.GoldbergSeymour.TashTreeCasePathIndexLast +public import LeanPool.GoldbergSeymour.TashTreeCaseRepeatedOnPath +public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange +public import LeanPool.GoldbergSeymour.TashTreeControlledRepeatedSuffixContradiction +public import LeanPool.GoldbergSeymour.TashTreeDisjointComponentNormalization +public import LeanPool.GoldbergSeymour.TashTreeEarlyBetaNormalization +public import LeanPool.GoldbergSeymour.TashTreeFourUnusedColors +public import LeanPool.GoldbergSeymour.TashTreeGammaEpsilonSetup +public import LeanPool.GoldbergSeymour.TashTreeLastIndexDeletion +public import LeanPool.GoldbergSeymour.TashTreeLastIndexFirstNormalForm +public import LeanPool.GoldbergSeymour.TashTreeLastIndexIntersectionShortening +public import LeanPool.GoldbergSeymour.TashTreeLastIndexSecondNormalForm +public import LeanPool.GoldbergSeymour.TashTreeLastIndexThirdNormalForm +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadLengthAtLeastTwo +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPairExists +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPathIndex +public import LeanPool.GoldbergSeymour.TashTreeNoMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreeNoRepeatedDisjointReduction +public import LeanPool.GoldbergSeymour.TashTreeNoRepeatedIntersectionShortening +public import LeanPool.GoldbergSeymour.TashTreePathIndex +public import LeanPool.GoldbergSeymour.TashTreePathIndexTwoReplacement +public import LeanPool.GoldbergSeymour.TashTreeProperInitialSegmentRankLess +public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary +public import LeanPool.GoldbergSeymour.TashTreeRankLess +public import LeanPool.GoldbergSeymour.TashTreeRhoOneAdvance +public import LeanPool.GoldbergSeymour.TashTreeRhoOneIterate +public import LeanPool.GoldbergSeymour.TashTreeRhoOneRepeatedColor +public import LeanPool.GoldbergSeymour.TashTreeRhoOneTerminalReplacement +public import LeanPool.GoldbergSeymour.TashTreeSuffixAdvance +public import LeanPool.GoldbergSeymour.TashTreeSuffixIterate +public import LeanPool.GoldbergSeymour.TashTreeSuffixPath +public import LeanPool.GoldbergSeymour.TashTreeSuffixTerminalReplacement +public import LeanPool.GoldbergSeymour.TashkinovAlternatingSegmentAppend +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceStrictBoundaryWitness +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovClosureExists +public import LeanPool.GoldbergSeymour.TashkinovClosureOfRouteAndAllMissingClosed +public import LeanPool.GoldbergSeymour.TashkinovClosureVertexSetUnique +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovOrderBound +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesAppend +public import LeanPool.GoldbergSeymour.TashkinovSeriesColoringProperties +public import LeanPool.GoldbergSeymour.TashkinovSeriesData +public import LeanPool.GoldbergSeymour.TashkinovSeriesDataAppend +public import LeanPool.GoldbergSeymour.TashkinovSeriesDataPrefix +public import LeanPool.GoldbergSeymour.TashkinovSeriesFinalETTExists +public import LeanPool.GoldbergSeymour.TashkinovSeriesPrefix +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovSeriesStepAppend +public import LeanPool.GoldbergSeymour.TashkinovSeriesStepPrefix +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TashkinovStoredColorsAppend +public import LeanPool.GoldbergSeymour.TashkinovStoredColorsCardinality +public import LeanPool.GoldbergSeymour.TashkinovStoredColorsPrefix +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TashkinovTreeComponentSwapWitnessTransport +public import LeanPool.GoldbergSeymour.TashkinovTreeFromLengthOnePrefix +public import LeanPool.GoldbergSeymour.Tchange +public import LeanPool.GoldbergSeymour.TchangeCounterexample +public import LeanPool.GoldbergSeymour.TchangeCounterexampleMeasure +public import LeanPool.GoldbergSeymour.TchangeKempeClosureData +public import LeanPool.GoldbergSeymour.TchangeKempeClosurePreparation +public import LeanPool.GoldbergSeymour.TchangeOutsideSwapPreparation +public import LeanPool.GoldbergSeymour.TchangeStrictShortening +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TdEarlierPEWitnessIdentification +public import LeanPool.GoldbergSeymour.TdReplacementPrefixExact +public import LeanPool.GoldbergSeymour.TdTerminalRERebuild +public import LeanPool.GoldbergSeymour.TdTerminalSEPERebuild +public import LeanPool.GoldbergSeymour.TechnicalCurrentLadderMissingBoundLarge +public import LeanPool.GoldbergSeymour.TechnicalCurrentRungElementaryLarge +public import LeanPool.GoldbergSeymour.TechnicalInductionContext +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TechnicalTheoremLarge +public import LeanPool.GoldbergSeymour.TerminalClosureMaximum +public import LeanPool.GoldbergSeymour.TerminalHierarchyPrefixConstruction +public import LeanPool.GoldbergSeymour.TerminalHierarchyPrefixPreparation +public import LeanPool.GoldbergSeymour.TerminalHierarchyRestore +public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch +public import LeanPool.GoldbergSeymour.TerminalPrefixReconstruction +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TerminalSeriesRebuildPreparation +public import LeanPool.GoldbergSeymour.TerminalSeriesRebuildTransport +public import LeanPool.GoldbergSeymour.TerminalStableRoute +public import LeanPool.GoldbergSeymour.TerminalStoredColors +public import LeanPool.GoldbergSeymour.ThetaExclusion +public import LeanPool.GoldbergSeymour.ThmGS +public import LeanPool.GoldbergSeymour.ThmGS2 +public import LeanPool.GoldbergSeymour.ThmScheide +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeMissingColorsCardLowerBound +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeUnique +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetEq +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetStrict +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TreeVerticesBefore +public import LeanPool.GoldbergSeymour.TrunkRotation +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorComponentNearestSegment +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapDisjointPairGraph +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapNonElementary +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapPreservesDisjointComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentTashkinovSplice +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TwoColorPathComponentNotCycle diff --git a/LeanPool/GoldbergSeymour/Incident.lean b/LeanPool/GoldbergSeymour/Incident.lean new file mode 100644 index 0000000000..85d6f79882 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Incident.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.LooplessMultigraph + +/-! +# Incident + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A vertex is incident to an edge when it belongs to its unordered pair of endpoints. -/ +def Incident {V E : Type*} (G : LooplessMultigraph V E) (v : V) (e : E) : Prop := + v ∈ G.ends e + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCore.lean b/LeanPool/GoldbergSeymour/IncidentCore.lean new file mode 100644 index 0000000000..8f78634453 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCore.lean @@ -0,0 +1,43 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentVertex + +/-! +# Incident Core + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- The multigraph restricted to vertices incident to an edge, retaining every original edge. -/ +noncomputable def IncidentCore {V E : Type*} (G : LooplessMultigraph V E) : + LooplessMultigraph (IncidentVertex G) E := by + classical + let coreEnds : E → Sym2 (IncidentVertex G) := fun e => + s(⟨(G.ends e).out.1, e, Sym2.out_fst_mem (G.ends e)⟩, + ⟨(G.ends e).out.2, e, Sym2.out_snd_mem (G.ends e)⟩) + refine ⟨coreEnds, ?_⟩ + intro e v hloop + apply G.loopless e v.1 + have hmapped := congrArg (Sym2.map (fun x : IncidentVertex G => x.1)) hloop + have hout : Sym2.map (fun x : IncidentVertex G => x.1) (coreEnds e) = G.ends e := by + simp only [coreEnds] + exact (G.ends e).out_eq + rw [hout] at hmapped + exact hmapped + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreChromaticIndex.lean b/LeanPool/GoldbergSeymour/IncidentCoreChromaticIndex.lean new file mode 100644 index 0000000000..c4402886b3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreChromaticIndex.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ChromaticIndexSpec +public import LeanPool.GoldbergSeymour.IncidentCoreColoringTransport + +/-! +# Incident Core Chromatic Index + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreChromaticIndex {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) : + ChromaticIndex (IncidentCore G) = ChromaticIndex G ∧ + ∀ F : Finset E, + ChromaticIndex (RestrictEdges (IncidentCore G) F) = + ChromaticIndex (RestrictEdges G F) := by + classical + let _ := Fintype.ofFinite V + have full : ChromaticIndex (IncidentCore G) = ChromaticIndex G := by + apply Nat.le_antisymm + · obtain ⟨phi, hp, hf⟩ := (ChromaticIndexSpec G).1 + apply (ChromaticIndexSpec (IncidentCore G)).2 (ChromaticIndex G) + exact ⟨phi, (IncidentCoreColoringTransport G).2.1 + (ChromaticIndex G) phi |>.2 hp, hf⟩ + · obtain ⟨phi, hp, hf⟩ := (ChromaticIndexSpec (IncidentCore G)).1 + apply (ChromaticIndexSpec G).2 (ChromaticIndex (IncidentCore G)) + exact ⟨phi, (IncidentCoreColoringTransport G).2.1 + (ChromaticIndex (IncidentCore G)) phi |>.1 hp, hf⟩ + refine ⟨full, ?_⟩ + intro F + apply Nat.le_antisymm + · obtain ⟨phi, hp, hf⟩ := (ChromaticIndexSpec (RestrictEdges G F)).1 + apply (ChromaticIndexSpec (RestrictEdges (IncidentCore G) F)).2 + (ChromaticIndex (RestrictEdges G F)) + exact ⟨phi, (IncidentCoreColoringTransport G).2.2.2 F + (ChromaticIndex (RestrictEdges G F)) phi |>.2 hp, hf⟩ + · obtain ⟨phi, hp, hf⟩ := + (ChromaticIndexSpec (RestrictEdges (IncidentCore G) F)).1 + apply (ChromaticIndexSpec (RestrictEdges G F)).2 + (ChromaticIndex (RestrictEdges (IncidentCore G) F)) + exact ⟨phi, (IncidentCoreColoringTransport G).2.2.2 F + (ChromaticIndex (RestrictEdges (IncidentCore G) F)) phi |>.1 hp, hf⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreColoringTransport.lean b/LeanPool/GoldbergSeymour/IncidentCoreColoringTransport.lean new file mode 100644 index 0000000000..8983c35678 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreColoringTransport.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.IncidentCoreIncidence +public import LeanPool.GoldbergSeymour.IncidentVertexFintype +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.RestrictEdges + +/-! +# Incident Core Coloring Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreColoringTransport {V E : Type*} [Finite V] [Finite E] + (G : LooplessMultigraph V E) : + (∀ e f : E, AdjacentEdges (IncidentCore G) e f ↔ AdjacentEdges G e f) ∧ + (∀ (k : ℕ) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring (IncidentCore G) phi ↔ IsProperEdgeColoring G phi) ∧ + (∀ (F : Finset E) (e f : {e // e ∈ F}), + AdjacentEdges (RestrictEdges (IncidentCore G) F) e f ↔ + AdjacentEdges (RestrictEdges G F) e f) ∧ + (∀ (F : Finset E) (k : ℕ) (phi : PartialEdgeColoring {e // e ∈ F} k), + IsProperEdgeColoring (RestrictEdges (IncidentCore G) F) phi ↔ + IsProperEdgeColoring (RestrictEdges G F) phi) := by + classical + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + have hadj : ∀ e f : E, + AdjacentEdges (IncidentCore G) e f ↔ AdjacentEdges G e f := by + intro e f + unfold AdjacentEdges + constructor + · rintro ⟨x, hxe, hxf⟩ + exact ⟨x.1, (IncidentCoreIncidence G x e).1 hxe, + (IncidentCoreIncidence G x f).1 hxf⟩ + · rintro ⟨v, hve, hvf⟩ + let x : IncidentVertex G := ⟨v, e, hve⟩ + exact ⟨x, (IncidentCoreIncidence G x e).2 hve, + (IncidentCoreIncidence G x f).2 hvf⟩ + have hproper : ∀ (k : ℕ) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring (IncidentCore G) phi ↔ IsProperEdgeColoring G phi := by + intro k phi + unfold IsProperEdgeColoring + constructor + · intro hp e f c hne haf he hf + exact hp hne ((hadj e f).2 haf) he hf + · intro hp e f c hne haf he hf + exact hp hne ((hadj e f).1 haf) he hf + have hadjF : ∀ (F : Finset E) (e f : {e // e ∈ F}), + AdjacentEdges (RestrictEdges (IncidentCore G) F) e f ↔ + AdjacentEdges (RestrictEdges G F) e f := by + intro F e f + unfold AdjacentEdges + constructor + · rintro ⟨x, hxe, hxf⟩ + refine ⟨x.1, ?_, ?_⟩ + · change Incident G x.1 e.1 + exact (IncidentCoreIncidence G x e.1).1 hxe + · change Incident G x.1 f.1 + exact (IncidentCoreIncidence G x f.1).1 hxf + · rintro ⟨v, hve, hvf⟩ + let x : IncidentVertex G := ⟨v, e.1, by + change Incident G v e.1 at hve + exact hve⟩ + refine ⟨x, ?_, ?_⟩ + · change Incident (IncidentCore G) x e.1 + apply (IncidentCoreIncidence G x e.1).2 + exact hve + · change Incident (IncidentCore G) x f.1 + apply (IncidentCoreIncidence G x f.1).2 + exact hvf + have hproperF : + ∀ (F : Finset E) (k : ℕ) (phi : PartialEdgeColoring {e // e ∈ F} k), IsProperEdgeColoring + (RestrictEdges (IncidentCore G) F) phi ↔ IsProperEdgeColoring (RestrictEdges G F) phi := by + intro F k phi + unfold IsProperEdgeColoring + constructor + · intro hp e f c hne haf he hf + exact hp hne ((hadjF F e f).2 haf) he hf + · intro hp e f c hne haf he hf + exact hp hne ((hadjF F e f).1 haf) he hf + exact ⟨hadj, hproper, hadjF, hproperF⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreCritical.lean b/LeanPool/GoldbergSeymour/IncidentCoreCritical.lean new file mode 100644 index 0000000000..f5b1dc79a4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreCritical.lean @@ -0,0 +1,44 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Critical +public import LeanPool.GoldbergSeymour.IncidentCoreChromaticIndex + +/-! +# Incident Core Critical + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreCritical {V E : Type*} [Finite V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) : + Critical (IncidentCore G) ↔ Critical G := by + classical + let _ := Fintype.ofFinite V + constructor + · intro hcore e + change ChromaticIndex (RestrictEdges G (Finset.univ.erase e)) < + ChromaticIndex G + rw [← (IncidentCoreChromaticIndex G).2 (Finset.univ.erase e), + ← (IncidentCoreChromaticIndex G).1] + exact hcore e + · intro horiginal e + change ChromaticIndex (RestrictEdges (IncidentCore G) (Finset.univ.erase e)) < + ChromaticIndex (IncidentCore G) + rw [(IncidentCoreChromaticIndex G).2 (Finset.univ.erase e), + (IncidentCoreChromaticIndex G).1] + exact horiginal e + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreDegree.lean b/LeanPool/GoldbergSeymour/IncidentCoreDegree.lean new file mode 100644 index 0000000000..ca25cca4c6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreDegree.lean @@ -0,0 +1,38 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.IncidentCoreIncidence +public import LeanPool.GoldbergSeymour.IncidentVertexFintype + +/-! +# Incident Core Degree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreDegree {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (x : IncidentVertex G) : + Degree (IncidentCore G) x = Degree G x.1 := by + classical + let _ := Fintype.ofFinite V + unfold Degree + congr 1 + ext e + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact IncidentCoreIncidence G x e + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreDensity.lean b/LeanPool/GoldbergSeymour/IncidentCoreDensity.lean new file mode 100644 index 0000000000..636951fd77 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreDensity.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DensityCeil + +public import LeanPool.GoldbergSeymour.IncidentCoreInternalEdges + +/-! +# Incident Core Density + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreDensity {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) : + DensityCeil (IncidentCore G) ≤ DensityCeil G := by + classical + unfold DensityCeil Density + dsimp + apply Nat.ceil_mono + apply Finset.max'_le + intro q hq + rcases Finset.mem_insert.mp hq with rfl | hq + · exact Finset.le_max' _ _ (Finset.mem_insert_self _ _) + · rcases Finset.mem_image.mp hq with ⟨U, hU, rfl⟩ + let image : Finset V := U.map + ⟨(fun x : IncidentVertex G => x.1), Subtype.coe_injective⟩ + have hdata := IncidentCoreInternalEdges G U + have hcard : image.card = U.card := hdata.1 + have hodd : Odd image.card := by + rw [hcard] + exact (Finset.mem_filter.mp hU).2.2 + have hlarge : 3 ≤ image.card := by + rw [hcard] + exact (Finset.mem_filter.mp hU).2.1 + have himage : EligibleOddSet image := ⟨hlarge, hodd⟩ + have hvalue : DensityValue (IncidentCore G) U = DensityValue G image := by + unfold DensityValue + rw [hdata.2, hcard] + rw [hvalue] + exact Finset.le_max' _ _ + (Finset.mem_insert_of_mem (Finset.mem_image.mpr ⟨image, by + exact Finset.mem_filter.mpr ⟨Finset.mem_powerset.mpr (by + intro v hv + exact Finset.mem_univ v), himage⟩, rfl⟩)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreElementaryTransfer.lean b/LeanPool/GoldbergSeymour/IncidentCoreElementaryTransfer.lean new file mode 100644 index 0000000000..68205d1769 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreElementaryTransfer.lean @@ -0,0 +1,39 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DensityLowerBound +public import LeanPool.GoldbergSeymour.Elementary +public import LeanPool.GoldbergSeymour.IncidentCoreChromaticIndex +public import LeanPool.GoldbergSeymour.IncidentCoreDensity + +/-! +# Incident Core Elementary Transfer + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreElementaryTransfer {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (hcore : Elementary (IncidentCore G)) : + Elementary G := by + unfold Elementary at hcore ⊢ + apply Nat.le_antisymm + · calc + ChromaticIndex G = ChromaticIndex (IncidentCore G) := + (IncidentCoreChromaticIndex G).1.symm + _ = DensityCeil (IncidentCore G) := hcore + _ ≤ DensityCeil G := IncidentCoreDensity G + · exact DensityLowerBound G + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreEndpoints.lean b/LeanPool/GoldbergSeymour/IncidentCoreEndpoints.lean new file mode 100644 index 0000000000..a5deb95cf4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreEndpoints.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCore + +/-! +# Incident Core Endpoints + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreEndpoints {V E : Type*} (G : LooplessMultigraph V E) + (e : E) : + Sym2.map (fun x : IncidentVertex G => x.1) ((IncidentCore G).ends e) = + G.ends e := by + classical + simp only [IncidentCore] + exact (G.ends e).out_eq + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreIncidence.lean b/LeanPool/GoldbergSeymour/IncidentCoreIncidence.lean new file mode 100644 index 0000000000..bb61e59998 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreIncidence.lean @@ -0,0 +1,42 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCoreEndpoints + +/-! +# Incident Core Incidence + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreIncidence {V E : Type*} (G : LooplessMultigraph V E) + (x : IncidentVertex G) (e : E) : + Incident (IncidentCore G) x e ↔ Incident G x.1 e := by + classical + change x ∈ (IncidentCore G).ends e ↔ x.1 ∈ G.ends e + constructor + · intro hx + rw [← IncidentCoreEndpoints G e] + exact Sym2.mem_map.mpr ⟨x, hx, rfl⟩ + · intro hx + have hx' : x.1 ∈ Sym2.map (fun y : IncidentVertex G => y.1) + ((IncidentCore G).ends e) := by + rw [IncidentCoreEndpoints G e] + exact hx + obtain ⟨y, hy, heq⟩ := Sym2.mem_map.mp hx' + have : y = x := Subtype.ext heq + simpa [this] using hy + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreInternalEdges.lean b/LeanPool/GoldbergSeymour/IncidentCoreInternalEdges.lean new file mode 100644 index 0000000000..9119eede3a --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreInternalEdges.lean @@ -0,0 +1,50 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCoreIncidence +public import LeanPool.GoldbergSeymour.IncidentVertexFintype +public import LeanPool.GoldbergSeymour.InternalEdges + +/-! +# Incident Core Internal Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreInternalEdges {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (U : Finset (IncidentVertex G)) : + (U.map ⟨(fun x : IncidentVertex G => x.1), Subtype.coe_injective⟩).card = + U.card ∧ + InternalEdges (IncidentCore G) U = + InternalEdges G + (U.map ⟨(fun x : IncidentVertex G => x.1), Subtype.coe_injective⟩) := by + classical + constructor + · exact Finset.card_map _ + · unfold InternalEdges + ext e + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + constructor + · intro h v hv + let x : IncidentVertex G := ⟨v, e, hv⟩ + have hx : x ∈ U := h x ((IncidentCoreIncidence G x e).2 hv) + exact Finset.mem_map.mpr ⟨x, hx, rfl⟩ + · intro h x hx + have hv := h x.1 ((IncidentCoreIncidence G x e).1 hx) + obtain ⟨y, hy, heq⟩ := Finset.mem_map.mp hv + have hyx : y = x := Subtype.ext heq + simpa [hyx] using hy + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreKTriple.lean b/LeanPool/GoldbergSeymour/IncidentCoreKTriple.lean new file mode 100644 index 0000000000..eb1af7f55e --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreKTriple.lean @@ -0,0 +1,44 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCoreCritical +public import LeanPool.GoldbergSeymour.IncidentCoreMaximumDegree +public import LeanPool.GoldbergSeymour.KTriple + +/-! +# Incident Core KTriple + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreKTriple {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) : + KTriple (IncidentCore G) k e0 phi ↔ KTriple G k e0 phi := by + constructor + · rintro ⟨hcrit, hchi, hdegree, hproper, huncolored⟩ + exact ⟨(IncidentCoreCritical G).1 hcrit, + (IncidentCoreChromaticIndex G).1 ▸ hchi, + (IncidentCoreMaximumDegree G) ▸ hdegree, + (IncidentCoreColoringTransport G).2.1 k phi |>.1 hproper, + huncolored⟩ + · rintro ⟨hcrit, hchi, hdegree, hproper, huncolored⟩ + exact ⟨(IncidentCoreCritical G).2 hcrit, + (IncidentCoreChromaticIndex G).1.symm ▸ hchi, + (IncidentCoreMaximumDegree G).symm ▸ hdegree, + (IncidentCoreColoringTransport G).2.1 k phi |>.2 hproper, + huncolored⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreMaximumDegree.lean b/LeanPool/GoldbergSeymour/IncidentCoreMaximumDegree.lean new file mode 100644 index 0000000000..b76159c30c --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreMaximumDegree.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCoreDegree +public import LeanPool.GoldbergSeymour.MaximumDegree + +/-! +# Incident Core Maximum Degree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreMaximumDegree {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) : + MaximumDegree (IncidentCore G) = MaximumDegree G := by + classical + unfold MaximumDegree + apply Nat.le_antisymm + · apply Finset.max'_le + intro y hy + simp only [Finset.mem_insert, Finset.mem_image, Finset.mem_univ, + true_and] at hy + rcases hy with rfl | ⟨x, rfl⟩ + · exact Nat.zero_le _ + · rw [IncidentCoreDegree G x] + apply Finset.le_max' + exact Finset.mem_insert_of_mem (Finset.mem_image.mpr ⟨x.1, by simp⟩) + · apply Finset.max'_le + intro y hy + simp only [Finset.mem_insert, Finset.mem_image, Finset.mem_univ, + true_and] at hy + rcases hy with rfl | ⟨v, rfl⟩ + · exact Nat.zero_le _ + · by_cases hz : Degree G v = 0 + · rw [hz] + exact Nat.zero_le _ + · have hpos : 0 < Degree G v := Nat.pos_of_ne_zero hz + unfold Degree at hpos + obtain ⟨e, he⟩ := Finset.card_pos.mp hpos + have hie : Incident G v e := (Finset.mem_filter.mp he).2 + let x : IncidentVertex G := ⟨v, e, hie⟩ + rw [← IncidentCoreDegree G x] + apply Finset.le_max' + exact Finset.mem_insert_of_mem (Finset.mem_image.mpr ⟨x, by simp⟩) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreMissingColors.lean b/LeanPool/GoldbergSeymour/IncidentCoreMissingColors.lean new file mode 100644 index 0000000000..1391c382af --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreMissingColors.lean @@ -0,0 +1,46 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCoreIncidence +public import LeanPool.GoldbergSeymour.IncidentVertexFintype +public import LeanPool.GoldbergSeymour.MissingColors + +/-! +# Incident Core Missing Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreMissingColors {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (phi : PartialEdgeColoring E k) + (x : IncidentVertex G) : + PresentColors (IncidentCore G) phi x = PresentColors G phi x.1 ∧ + MissingColors (IncidentCore G) phi x = MissingColors G phi x.1 := by + classical + let _ := Fintype.ofFinite V + have hp : PresentColors (IncidentCore G) phi x = PresentColors G phi x.1 := by + unfold PresentColors + ext c + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + constructor + · rintro ⟨e, he, hc⟩ + exact ⟨e, (IncidentCoreIncidence G x e).1 he, hc⟩ + · rintro ⟨e, he, hc⟩ + exact ⟨e, (IncidentCoreIncidence G x e).2 he, hc⟩ + refine ⟨hp, ?_⟩ + unfold MissingColors + rw [hp] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreNoIsolated.lean b/LeanPool/GoldbergSeymour/IncidentCoreNoIsolated.lean new file mode 100644 index 0000000000..08cff685f2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreNoIsolated.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCoreIncidence + +/-! +# Incident Core No Isolated + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreNoIsolated {V E : Type*} (G : LooplessMultigraph V E) : + ∀ x : IncidentVertex G, ∃ e : E, Incident (IncidentCore G) x e := by + intro x + obtain ⟨e, he⟩ := x.2 + exact ⟨e, (IncidentCoreIncidence G x e).2 he⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreReduction.lean b/LeanPool/GoldbergSeymour/IncidentCoreReduction.lean new file mode 100644 index 0000000000..6dc83768ce --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreReduction.lean @@ -0,0 +1,44 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCoreElementaryTransfer + +public import LeanPool.GoldbergSeymour.IncidentCoreNoIsolated +public import LeanPool.GoldbergSeymour.IncidentCoreTashkinovOrder + +/-! +# Incident Core Reduction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreReduction {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) : + let H := IncidentCore G + (∀ e : E, + Sym2.map (fun x : IncidentVertex G => x.1) (H.ends e) = G.ends e) ∧ + (∀ x : IncidentVertex G, ∃ e : E, Incident H x e) ∧ + (Critical H ↔ Critical G) ∧ + ChromaticIndex H = ChromaticIndex G ∧ + MaximumDegree H = MaximumDegree G ∧ + TashkinovOrder H = TashkinovOrder G ∧ + (Elementary H → Elementary G) := by + dsimp + exact ⟨IncidentCoreEndpoints G, IncidentCoreNoIsolated G, + IncidentCoreCritical G, (IncidentCoreChromaticIndex G).1, + IncidentCoreMaximumDegree G, IncidentCoreTashkinovOrder G, + IncidentCoreElementaryTransfer G⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreTashkinovOrder.lean b/LeanPool/GoldbergSeymour/IncidentCoreTashkinovOrder.lean new file mode 100644 index 0000000000..3120dde227 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreTashkinovOrder.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCoreKTriple +public import LeanPool.GoldbergSeymour.IncidentCoreTreeTransport +public import LeanPool.GoldbergSeymour.TashkinovOrder + +/-! +# Incident Core Tashkinov Order + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreTashkinovOrder {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) : + TashkinovOrder (IncidentCore G) = TashkinovOrder G := by + classical + have hindex := (IncidentCoreChromaticIndex G).1 + have hforward := (IncidentCoreTreeTransport G).1 + have hbackward := (IncidentCoreTreeTransport G).2 + let k := ChromaticIndex G - 1 + unfold TashkinovOrder + dsimp only + apply Nat.le_antisymm + · apply Finset.max'_le + intro n hn + rcases Finset.mem_insert.mp hn with rfl | hn + · exact Nat.zero_le _ + · rcases Finset.mem_filter.mp hn with ⟨hnrange, ⟨e0, phi, Tc, htriple, htree, hcard⟩⟩ + obtain ⟨T, hlen, hvertices, hedges, hsize, htreeeq⟩ := + hbackward e0 (ChromaticIndex (IncidentCore G) - 1) phi Tc + have hbound : (TreeSequenceVertexSet T).card ≤ Fintype.card V := by + simpa [TreeSequenceVertexSet, Finset.card_image_of_injective _ T.vertex_injective] using + (Fintype.card_le_of_injective T.vertex T.vertex_injective) + apply Finset.le_max' _ _ + apply Finset.mem_insert.mpr + right + apply Finset.mem_filter.mpr + constructor + · exact Finset.mem_range.mpr (by omega) + · have hmem : ∃ (e : E) (p : PartialEdgeColoring E (ChromaticIndex (IncidentCore G) - 1)) + (S : TreeSequence G e), + KTriple G (ChromaticIndex (IncidentCore G) - 1) e p ∧ + TashkinovTree G e p S ∧ (TreeSequenceVertexSet S).card = n := by + refine ⟨e0, phi, T, ?_, htreeeq.mpr htree, hsize.symm.trans hcard⟩ + exact (IncidentCoreKTriple G (ChromaticIndex (IncidentCore G) - 1) e0 phi).mp htriple + have bridge : + (∃ (e : E) (p : PartialEdgeColoring E (ChromaticIndex (IncidentCore G) - 1)) + (S : TreeSequence G e), + KTriple G (ChromaticIndex (IncidentCore G) - 1) e p ∧ + TashkinovTree G e p S ∧ (TreeSequenceVertexSet S).card = n) = + (∃ (e : E) (p : PartialEdgeColoring E (ChromaticIndex G - 1)) + (S : TreeSequence G e), + KTriple G (ChromaticIndex G - 1) e p ∧ + TashkinovTree G e p S ∧ (TreeSequenceVertexSet S).card = n) := by + exact congrArg (fun q => ∃ (e : E) (p : PartialEdgeColoring E (q - 1)) + (S : TreeSequence G e), KTriple G (q - 1) e p ∧ + TashkinovTree G e p S ∧ (TreeSequenceVertexSet S).card = n) hindex + exact bridge ▸ hmem + · apply Finset.max'_le + intro n hn + rcases Finset.mem_insert.mp hn with rfl | hn + · exact Nat.zero_le _ + · rcases Finset.mem_filter.mp hn with ⟨hnrange, ⟨e0, phi, T, htriple, htree, hcard⟩⟩ + obtain ⟨Tc, hlen, hvertices, hedges, hsize, htreeeq⟩ := + hforward e0 k phi T + have hbound : (TreeSequenceVertexSet Tc).card ≤ Fintype.card (IncidentVertex G) := by + simpa [TreeSequenceVertexSet, Finset.card_image_of_injective _ Tc.vertex_injective] using + (Fintype.card_le_of_injective Tc.vertex Tc.vertex_injective) + apply Finset.le_max' _ _ + apply Finset.mem_insert.mpr + right + apply Finset.mem_filter.mpr + constructor + · exact Finset.mem_range.mpr (by omega) + · have hmem : ∃ (e : E) (p : PartialEdgeColoring E (ChromaticIndex G - 1)) + (S : TreeSequence (IncidentCore G) e), + KTriple (IncidentCore G) (ChromaticIndex G - 1) e p ∧ + TashkinovTree (IncidentCore G) e p S ∧ (TreeSequenceVertexSet S).card = n := by + refine ⟨e0, phi, Tc, (IncidentCoreKTriple G k e0 phi).mpr htriple, + htreeeq.mpr htree, hsize.trans hcard⟩ + have bridge : + (∃ (e : E) (p : PartialEdgeColoring E (ChromaticIndex G - 1)) + (S : TreeSequence (IncidentCore G) e), + KTriple (IncidentCore G) (ChromaticIndex G - 1) e p ∧ + TashkinovTree (IncidentCore G) e p S ∧ (TreeSequenceVertexSet S).card = n) = + (∃ (e : E) (p : PartialEdgeColoring E (ChromaticIndex (IncidentCore G) - 1)) + (S : TreeSequence (IncidentCore G) e), + KTriple (IncidentCore G) (ChromaticIndex (IncidentCore G) - 1) e p ∧ + TashkinovTree (IncidentCore G) e p S ∧ (TreeSequenceVertexSet S).card = n) := by + exact congrArg (fun q => ∃ (e : E) (p : PartialEdgeColoring E (q - 1)) + (S : TreeSequence (IncidentCore G) e), KTriple (IncidentCore G) (q - 1) e p ∧ + TashkinovTree (IncidentCore G) e p S ∧ (TreeSequenceVertexSet S).card = n) hindex.symm + exact bridge ▸ hmem + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentCoreTreeTransport.lean b/LeanPool/GoldbergSeymour/IncidentCoreTreeTransport.lean new file mode 100644 index 0000000000..b93f7967d7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentCoreTreeTransport.lean @@ -0,0 +1,185 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCoreMissingColors +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Incident Core Tree Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem IncidentCoreTreeTransport {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) : + (∀ (e0 : E) (k : ℕ) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0), + ∃ Tc : TreeSequence (IncidentCore G) e0, + ∃ hlen : Tc.length = T.length, + (∀ i : Fin (Tc.length + 1), + (Tc.vertex i).1 = T.vertex (Fin.cast + (congrArg (fun n => n + 1) hlen) i)) ∧ + (∀ j : Fin Tc.length, + Tc.edge j = T.edge (Fin.cast hlen j)) ∧ + (TreeSequenceVertexSet Tc).card = (TreeSequenceVertexSet T).card ∧ + (TashkinovTree (IncidentCore G) e0 phi Tc ↔ + TashkinovTree G e0 phi T)) ∧ + (∀ (e0 : E) (k : ℕ) (phi : PartialEdgeColoring E k) + (Tc : TreeSequence (IncidentCore G) e0), + ∃ T : TreeSequence G e0, + ∃ hlen : T.length = Tc.length, + (∀ i : Fin (T.length + 1), + T.vertex i = (Tc.vertex (Fin.cast + (congrArg (fun n => n + 1) hlen) i)).1) ∧ + (∀ j : Fin T.length, + T.edge j = Tc.edge (Fin.cast hlen j)) ∧ + (TreeSequenceVertexSet Tc).card = (TreeSequenceVertexSet T).card ∧ + (TashkinovTree G e0 phi T ↔ + TashkinovTree (IncidentCore G) e0 phi Tc)) := by + classical + let _ := Fintype.ofFinite V + constructor + · intro e0 k phi T + have incidentAt : ∀ i : Fin (T.length + 1), + ∃ e : E, Incident G (T.vertex i) e := by + intro i + refine Fin.cases ?_ (fun q => ?_) i + · refine ⟨T.edge ⟨0, T.positive⟩, ?_⟩ + change T.vertex ⟨0, _⟩ ∈ G.ends (T.edge ⟨0, T.positive⟩) + obtain ⟨h, hends⟩ := T.attaches ⟨0, T.positive⟩ + rw [hends] + simp [Fin.castLT] + · refine ⟨T.edge q, ?_⟩ + change T.vertex q.succ ∈ G.ends (T.edge q) + obtain ⟨h, hends⟩ := T.attaches q + rw [hends] + exact Sym2.mem_mk_left _ _ + let witness : ∀ i : Fin (T.length + 1), + {e : E // Incident G (T.vertex i) e} := + fun i => ⟨Classical.choose (incidentAt i), Classical.choose_spec (incidentAt i)⟩ + let lifted : Fin (T.length + 1) → IncidentVertex G := + fun i => ⟨T.vertex i, ⟨(witness i).val, (witness i).property⟩⟩ + have lifted_coe : ∀ i, (lifted i).1 = T.vertex i := by + intro i + rfl + have lifted_injective : Function.Injective lifted := by + intro i j h + apply T.vertex_injective + exact congrArg Subtype.val h + let Tc : TreeSequence (IncidentCore G) e0 := + { length := T.length + positive := T.positive + vertex := lifted + edge := T.edge + vertex_injective := lifted_injective + edge_injective := T.edge_injective + first_edge := T.first_edge + attaches := by + intro j + obtain ⟨i, hi⟩ := T.attaches j + refine ⟨i, ?_⟩ + apply (Sym2.map.injective (f := fun x : IncidentVertex G => x.1) + Subtype.coe_injective) + rw [IncidentCoreEndpoints G (T.edge j)] + simpa only [Sym2.map_mk, lifted_coe] using hi } + refine ⟨Tc, rfl, ?_, ?_, ?_, ?_⟩ + · intro i + rfl + · intro j + rfl + · simp [Tc, TreeSequenceVertexSet, + Finset.card_image_of_injective Finset.univ lifted_injective, + Finset.card_image_of_injective Finset.univ T.vertex_injective] + · unfold TashkinovTree + constructor + · intro h j hj + obtain ⟨i, c, hc, hm⟩ := h j hj + let ii : Fin (T.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) + refine ⟨i, c, hc, ?_⟩ + have colorTransport := IncidentCoreMissingColors G k phi (Tc.vertex ii) + have bridge : c ∈ MissingColors G phi + (Tc.vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)))).1 := by + rw [← colorTransport.2] + exact hm + simpa [Tc, lifted, ii] using bridge + · intro h j hj + obtain ⟨i, c, hc, hm⟩ := h j hj + let ii : Fin (T.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) + refine ⟨i, c, hc, ?_⟩ + have colorTransport := IncidentCoreMissingColors G k phi (Tc.vertex ii) + have bridge : c ∈ MissingColors (IncidentCore G) phi + (Tc.vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)))) := by + rw [colorTransport.2] + exact hm + simpa [Tc, lifted, ii] using bridge + · intro e0 k phi Tc + let T : TreeSequence G e0 := + { length := Tc.length + positive := Tc.positive + vertex := fun i => (Tc.vertex i).1 + edge := Tc.edge + vertex_injective := by + intro i j h + apply Tc.vertex_injective + exact Subtype.ext h + edge_injective := Tc.edge_injective + first_edge := Tc.first_edge + attaches := by + intro j + obtain ⟨i, hi⟩ := Tc.attaches j + refine ⟨i, ?_⟩ + have hm := congrArg (Sym2.map (fun x : IncidentVertex G => x.1)) hi + simpa [IncidentCoreEndpoints] using hm } + refine ⟨T, rfl, ?_, ?_, ?_, ?_⟩ + · intro i + rfl + · intro j + rfl + · simp only [TreeSequenceVertexSet, T] + rw [Finset.card_image_of_injective _ Tc.vertex_injective] + have underlying_injective : Function.Injective (fun i => (Tc.vertex i).1) := by + intro i j h + apply Tc.vertex_injective + exact Subtype.ext h + rw [Finset.card_image_of_injective _ underlying_injective] + · unfold TashkinovTree + constructor + · intro h j hj + obtain ⟨i, c, hc, hm⟩ := h j hj + let ii : Fin (Tc.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) + refine ⟨i, c, hc, ?_⟩ + have colorTransport := IncidentCoreMissingColors G k phi (Tc.vertex ii) + have bridge : c ∈ MissingColors (IncidentCore G) phi + (Tc.vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)))) := by + rw [colorTransport.2] + exact hm + simpa [T, ii] using bridge + · intro h j hj + obtain ⟨i, c, hc, hm⟩ := h j hj + let ii : Fin (Tc.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) + refine ⟨i, c, hc, ?_⟩ + have colorTransport := IncidentCoreMissingColors G k phi (Tc.vertex ii) + have bridge : c ∈ MissingColors G phi + (Tc.vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)))).1 := by + rw [← colorTransport.2] + exact hm + simpa [T, ii] using bridge + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentVertex.lean b/LeanPool/GoldbergSeymour/IncidentVertex.lean new file mode 100644 index 0000000000..99f9b1759e --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentVertex.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Incident + +/-! +# Incident Vertex + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The subtype of vertices incident to at least one edge. -/ +def IncidentVertex {V E : Type*} (G : LooplessMultigraph V E) := + { v : V // ∃ e : E, Incident G v e } + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IncidentVertexFintype.lean b/LeanPool/GoldbergSeymour/IncidentVertexFintype.lean new file mode 100644 index 0000000000..b5413564ee --- /dev/null +++ b/LeanPool/GoldbergSeymour/IncidentVertexFintype.lean @@ -0,0 +1,36 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.Basic + +public import LeanPool.GoldbergSeymour.IncidentVertex + +/-! +# Incident Vertex Fintype + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +noncomputable section + +instance IncidentVertexFintype {V E : Type*} [Fintype V] (G : LooplessMultigraph V E) : + Fintype (IncidentVertex G) := by + classical + unfold IncidentVertex + infer_instance + +end + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/InterchangePEClosedCore.lean b/LeanPool/GoldbergSeymour/InterchangePEClosedCore.lean new file mode 100644 index 0000000000..5719f5925d --- /dev/null +++ b/LeanPool/GoldbergSeymour/InterchangePEClosedCore.lean @@ -0,0 +1,904 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.InterchangePEClosureConstituent +public import LeanPool.GoldbergSeymour.InterchangePECommonMissingClosed +public import LeanPool.GoldbergSeymour.InterchangePETreeAwayFromDelta + +public import LeanPool.GoldbergSeymour.ParallelBaseFourCommonMissingColors + +/-! +# Interchange PEClosed Core + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hterminal_154.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : ett.series.data.kind + (Fin.last ett.rounds) = some TashkinovExtensionKind.PE), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) => + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : q.succ = n), + ∃ (gamma : Fin k) (delta : Fin k) (f : E), ett.series.data.gamma n = some gamma ∧ + ett.series.data.delta n = some delta ∧ ett.series.data.connectingEdges n = { f } ∧ + ett.series.data.stored n = { delta, gamma } := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive hPE n q hq + have hp : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE := by simpa [hq, n] using hPE + generalize ht : q.succ = slot at hp + have cert := ett.series.certified slot + cases cert with + | initial => exact (Fin.succ_ne_zero q ht).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentKind] at hp + cases hp + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [currentKind] at hp + cases hp + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hh := congrArg Fin.val ht + simp at hh + omega + subst i + exact ⟨gamma, choice.color, choice.edge, + by simpa [hq] using currentGamma, + by simpa [hq] using currentDelta, + by simpa [hq] using currentEdges, + by simpa [hq] using currentStored⟩ + +private theorem helper_hdeltaBoundary_215.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : CombinedStableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) base.closure (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) generating sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet Tn; + let Y : Finset V := TreeSequenceVertexSet base.closure; + ∀ (_ : ett.series.data.chosenVertex (Fin.last ett.rounds) = some ((ett.series.data.tree + (Fin.last ett.rounds).castSucc).vertex base.supportPosition)) (_ : generating = + ett.series.data.coloring (Fin.last ett.rounds)) (_ : IsProperEdgeColoring G generating) (_ + : IsOneEdgeUncolored generating e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) => + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : q.succ = n) (gamma delta : Fin k) (f : E) (_ : ett.series.data.gamma n = some gamma) (_ + : ett.series.data.delta n = some delta) (_ : ett.series.data.connectingEdges n = { f }) (_ + : delta ∈ TreeMissingColors generating Tn ∪ TashkinovStoredColors ett.series.data n), + let seed : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (_ : TreeSequenceVertexSet seed ⊆ Y), + ∀ g ∈ BoundaryColorEdges G sigma X delta, + ∃ w ∈ Y, Incident G w g := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hpositive hPE base hproper hone hstable n + Tn X Y hchosen hgen hproperGen honeGen q hq gamma delta f hgamma hdelta hf hdeltaControl + seed hseedY g hg + have hgb := (Finset.mem_filter.mp hg).1 + have hgc := (Finset.mem_filter.mp hg).2 + obtain ⟨v, hv, r, hr, hend⟩ := by + simpa [BoundaryEdges] using hgb + have hinc : TreeIncidentEdge Tn g := + ⟨v, hv, by simp [Incident, hend]⟩ + have hfix := (sc1 G e0 Tn (TashkinovStoredColors ett.series.data n) + generating sigma hproperGen honeGen hproper hone).mp hstable.1 g hinc + (Or.inr ⟨delta, hdeltaControl, hgc⟩) + have hgg : g ∈ BoundaryColorEdges G generating X delta := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hgb, hfix.symm.trans hgc⟩ + have hb := (HkuParallelBoundaryStructure G k ett.rounds e0 input + ett.series q f delta gamma (Tn.vertex base.supportPosition) + (by simpa [hq, n] using hPE) (by simpa [hq] using hf) + (by simpa [hq] using hdelta) (by simpa [hq] using hgamma) + (by simpa [hq] using hchosen)).2.1 + have hgg' : g ∈ BoundaryColorEdges G (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) delta := by + simpa [hq, Tn, n, ← hgen] using hgg + obtain ⟨w, hw, hwi⟩ := hb g hgg' + have hw' : TreeVertexOrder Tn w (Tn.vertex base.supportPosition) := by + simpa [hq, Tn] using hw + obtain ⟨i, j, hi, hj, hij⟩ := hw' + have hj' : j = base.supportPosition := Tn.vertex_injective hj + subst j + have hwseed : w ∈ TreeSequenceVertexSet seed := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨(⟨i.val, by omega⟩ : Fin (base.supportPosition.val + 1)), ?_⟩ + simpa [seed, TreeSequencePrefix] using hi + exact ⟨w, hseedY hwseed, hwi⟩ + +private theorem helper_transport_460.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : (0 : ℕ) < ett.rounds) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet Tn; + let Y : Finset V := TreeSequenceVertexSet base.closure; + let U : Finset V := TreeSequenceVertexSet base.core; + ∀ (_ : U = X ∪ Y) (delta : Fin k) (_ : ( + ∀ g ∈ BoundaryColorEdges G sigma X delta, + ∃ w ∈ Y, Incident G w g)) (_ : alpha ≠ beta) (c : Fin k) (_ : c ≠ beta), + ∀ w ∈ TreeSequenceVertexSet base.closure, + let psi : PartialEdgeColoring E k := OutsideTreeColorSwap base.core sigma alpha c; ( + ∀ (e : E), TreeIncidentEdge base.core e → psi e = sigma e) → ( + ∀ {e : E}, e ∈ BoundaryEdges G U → sigma e ≠ some alpha ∧ sigma e ≠ some c) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi c beta; + ∀ r ∉ U, ( + ∃ x ∈ U, Sum.inl x ∈ TwoColorComponent G sigma alpha beta (Sum.inl r)) → + ∃ s ∈ U, (beta = delta → s ∈ Y) ∧ H.Reachable (Sum.inl r) (Sum.inl s) := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hpositive base hproper alpha beta n Tn X + Y U hU delta hdeltaBoundary hab c hcb w hwY psi fixed boundaryAvoid H r hr hmeet + obtain ⟨m, hm, pv, pe, hpv, hpe, hs, hlast, hout, hvcomp, + hecomp, hcolors, hends, hfresh⟩ := + TwoColorComponentNearestSegment G sigma base.core alpha beta r + hproper hab hr hmeet + let s := pv 0 + let z : Fin m := ⟨0, by omega⟩ + have hend0 : G.ends (pe z) = s(s, pv z.succ) := by + simpa [s, z] using hends z + have hb0 : pe z ∈ BoundaryEdges G U := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨s, hs, pv z.succ, hout z, hend0⟩ + have hcolor0 : sigma (pe z) = some beta := + (hcolors z).resolve_left (boundaryAvoid hb0).1 + have hinc0 : TreeIncidentEdge base.core (pe z) := + ⟨s, hs, by simp [Incident, hend0]⟩ + have hsY : beta = delta → s ∈ Y := by + intro hbd + by_cases hsX : s ∈ X + · have hoX : pv z.succ ∉ X := by + intro hx + apply hout z + change pv z.succ ∈ U + rw [hU] + exact Finset.mem_union_left _ hx + have hbX : pe z ∈ BoundaryColorEdges G sigma X delta := by + apply Finset.mem_filter.mpr + refine ⟨?_, by simpa [hbd] using hcolor0⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨s, hsX, pv z.succ, hoX, hend0⟩ + obtain ⟨w, hwY, hwi⟩ := hdeltaBoundary (pe z) hbX + have hw : w = s := by + simp only [Incident, hend0, Sym2.mem_iff] at hwi + rcases hwi with hw | hw + · exact hw + · exfalso + apply hout z + change pv z.succ ∈ U + rw [← hw, hU] + exact Finset.mem_union_right _ hwY + exact hw ▸ hwY + · have hsU : s ∈ U := hs + rw [hU] at hsU + exact (Finset.mem_union.mp hsU).resolve_left hsX + have newColors (i : Fin m) : + psi (pe i) = some c ∨ psi (pe i) = some beta := by + by_cases hi : i.val = 0 + · have hiz : i = z := by apply Fin.ext; exact hi + subst i + exact Or.inr ((fixed (pe z) hinc0).trans hcolor0) + · let j : Fin m := ⟨i.val - 1, by omega⟩ + have hji : j.succ = i.castSucc := by + apply Fin.ext + simp [j] + omega + have hleftout : pv i.castSucc ∉ U := by + rw [← hji] + exact hout j + have hnotinc : ¬ TreeIncidentEdge base.core (pe i) := by + rintro ⟨x, hx, hxi⟩ + simp only [Incident, hends i, Sym2.mem_iff] at hxi + rcases hxi with hxi | hxi + · exact hleftout (hxi ▸ hx) + · exact hout i (hxi ▸ hx) + rcases hcolors i with ha | hb + · exact Or.inl (by simp [psi, OutsideTreeColorSwap, hnotinc, ha]) + · exact Or.inr (by + simp [psi, OutsideTreeColorSwap, hnotinc, hb, hab.symm, hcb.symm]) + have stepLeft (i : Fin m) : H.Adj (Sum.inl (pv i.castSucc)) (Sum.inr (pe i)) := + ⟨by simp [Incident, hends i], newColors i⟩ + have stepRight (i : Fin m) : H.Adj (Sum.inr (pe i)) (Sum.inl (pv i.succ)) := + ⟨by simp [Incident, hends i], newColors i⟩ + have reach : ∀ t (ht : t ≤ m), + H.Reachable (Sum.inl s) (Sum.inl (pv ⟨t, by omega⟩)) := by + intro t + induction t with + | zero => intro ht; exact SimpleGraph.Reachable.refl _ + | succ t ih => + intro ht + let i : Fin m := ⟨t, by omega⟩ + exact (ih (by omega)).trans + ((stepLeft i).reachable.trans (stepRight i).reachable) + refine ⟨s, hs, hsY, ?_⟩ + have hr' := (reach m le_rfl).symm + change H.Reachable (Sum.inl (pv (Fin.last m))) (Sum.inl s) at hr' + rw [hlast] at hr' + exact hr' + +private theorem helper_hcolor_383.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett generating) + (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (delta : Fin k) (_ : (4 : ℕ) ≤ (TreeMissingColors sigma Tn ∩ TreeMissingColors sigma + base.closure).card), + ∃ c ∈ TreeMissingColors sigma Tn ∩ TreeMissingColors sigma base.closure, c ≠ alpha ∧ c ≠ beta + ∧ c ≠ delta := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett base alpha beta n Tn delta hfour + by_contra hn + push Not at hn + have hsubset : TreeMissingColors sigma Tn ∩ + TreeMissingColors sigma base.closure ⊆ {alpha, beta, delta} := by + intro c hc + simp only [Finset.mem_insert, Finset.mem_singleton] + by_cases ha : c = alpha + · exact Or.inl ha + by_cases hb : c = beta + · exact Or.inr (Or.inl hb) + exact Or.inr (Or.inr (hn c hc ha hb)) + have hle := Finset.card_le_card hsubset + have hthree : ({alpha, beta, delta} : Finset (Fin k)).card ≤ 3 := by + exact (Finset.card_insert_le _ _).trans + (Nat.add_le_add_right ((Finset.card_insert_le _ _).trans + (by simp)) 1) + omega + +private theorem helper_hproperPsi_447.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett generating) (_ + : IsProperEdgeColoring G sigma) (alpha : Fin k), + let U : Finset V := TreeSequenceVertexSet base.core; + ∀ (c : Fin k), + let psi : PartialEdgeColoring E k := OutsideTreeColorSwap base.core sigma alpha c; + let flip : Equiv.Perm (Option (Fin k)) := Equiv.swap (some alpha) (some c); + ∀ (_ : ( + ∀ (e : E) (_ : TreeIncidentEdge base.core e), psi e = sigma e)) (_ : ( + ∀ r ∉ U, + ∀ (e : E), Incident G r e → psi e = (flip : Option (Fin k) → Option (Fin k)) (sigma e))), + IsProperEdgeColoring G psi := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett base hproper alpha U c psi flip fixed + outside e g d heg hadj hed hgd + obtain ⟨r, hre, hrg⟩ := hadj + have hold : sigma e = sigma g := by + by_cases hr : r ∈ U + · rw [← fixed e ⟨r, hr, hre⟩, ← fixed g ⟨r, hr, hrg⟩] + exact hed.trans hgd.symm + · apply flip.injective + rw [← outside r hr e hre, ← outside r hr g hrg] + exact hed.trans hgd.symm + cases he : sigma e with + | none => + by_cases hr : r ∈ U + · rw [fixed e ⟨r, hr, hre⟩, he] at hed + cases hed + · rw [outside r hr e hre, he] at hed + simp [flip, Equiv.swap_apply_def] at hed + | some d' => + exact hproper heg ⟨r, hre, hrg⟩ he (hold.symm.trans he) + +private theorem helper_hstablePsi_495.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett generating) (_ + : CombinedStableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) generating + sigma) (alpha : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet Tn; + let Y : Finset V := TreeSequenceVertexSet base.closure; + let U : Finset V := TreeSequenceVertexSet base.core; + ∀ (_ : U = X ∪ Y) (c : Fin k), + let psi : PartialEdgeColoring E k := OutsideTreeColorSwap base.core sigma alpha c; + ∀ (_ : ( + ∀ (e : E) (_ : TreeIncidentEdge base.core e), psi e = sigma e)) (_ : ( + ∀ x ∈ U, MissingColors G psi x = MissingColors G sigma x)), CombinedStableColoring Tn + base.closure (TashkinovStoredColors ett.series.data n) generating psi := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett base hstable alpha n Tn X Y U hU c psi + fixed missingFixed + constructor + · constructor + · intro e he hc' + obtain ⟨x, hx, hxe⟩ := he + have hxU : x ∈ U := by rw [hU]; exact Finset.mem_union_left _ hx + exact (fixed e ⟨x, hxU, hxe⟩).trans + (hstable.1.1 e ⟨x, hx, hxe⟩ hc') + · intro x hx + have hxU : x ∈ U := by rw [hU]; exact Finset.mem_union_left _ hx + exact (missingFixed x hxU).trans (hstable.1.2 x hx) + · constructor + · intro e he hc' + obtain ⟨x, hx, hxe⟩ := he + have hxU : x ∈ U := by rw [hU]; exact Finset.mem_union_right _ hx + exact (fixed e ⟨x, hxU, hxe⟩).trans + (hstable.2.1 e ⟨x, hx, hxe⟩ hc') + · intro x hx + have hxU : x ∈ U := by rw [hU]; exact Finset.mem_union_right _ hx + exact (missingFixed x hxU).trans (hstable.2.2 x hx) + +private theorem helper_missingOutside_524.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett generating) + (alpha beta : Fin k), + let U : Finset V := TreeSequenceVertexSet base.core; + ∀ (c : Fin k), + let psi : PartialEdgeColoring E k := OutsideTreeColorSwap base.core sigma alpha c; + ∀ (_ : ( + ∀ r ∉ U, + ∀ (e : E), Incident G r e → (psi e = some c ↔ sigma e = some alpha) ∧ (psi e = some beta ↔ + sigma e = some beta))), + ∀ r ∉ U, alpha ∈ MissingColors G sigma r ∨ beta ∈ MissingColors G sigma r → c ∈ MissingColors + G psi r ∨ beta ∈ MissingColors G psi r := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett base alpha beta U c psi colorOutside r hr hm + rcases hm with hm | hm + · left + have hn : ∀ e, Incident G r e → sigma e ≠ some alpha := by + simpa [MissingColors, PresentColors] using hm + have hn' : ∀ e, Incident G r e → psi e ≠ some c := by + intro e he hd + exact hn e he ((colorOutside r hr e he).1.mp hd) + simpa [MissingColors, PresentColors] using hn' + · right + have hn : ∀ e, Incident G r e → sigma e ≠ some beta := by + simpa [MissingColors, PresentColors] using hm + have hn' : ∀ e, Incident G r e → psi e ≠ some beta := by + intro e he hd + exact hn e he ((colorOutside r hr e he).2.mp hd) + simpa [MissingColors, PresentColors] using hn' + +private theorem helper_leaf_543.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (base : HierarchyBase ett generating) (alpha beta c : Fin k) (_ : c ≠ beta), + let psi : PartialEdgeColoring E k := OutsideTreeColorSwap base.core sigma alpha c; + ∀ (_ : IsProperEdgeColoring G psi), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi c beta; + ∀ (r : V) (_ : c ∈ MissingColors G psi r ∨ beta ∈ MissingColors G psi r), + (H.neighborSet (Sum.inl r)).Subsingleton := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett base alpha beta c hcb psi hproperPsi H r hm + have hd : @SimpleGraph.degree _ H (Sum.inl r) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with hm | hm + · exact MissingColorIncidenceEndpoint G psi c beta hcb hproperPsi r hm + · have hgraph : H = TwoColorIncidenceGraph G psi beta c := by + ext x y + cases x <;> cases y <;> simp [H, TwoColorIncidenceGraph, or_comm] + rw [hgraph] + exact MissingColorIncidenceEndpoint G psi beta c hcb.symm hproperPsi r hm + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx y hy + exact Finset.card_le_one_iff.mp hd + (by simpa [SimpleGraph.mem_neighborFinset] using hx) + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + +private theorem helper_equalRoot_593.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (_ : (0 : ℕ) < + ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) (base : + HierarchyBase ett generating) (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet Tn; + let Y : Finset V := TreeSequenceVertexSet base.closure; + let U : Finset V := TreeSequenceVertexSet base.core; + ∀ (_ : ett.series.data.chosenVertex (Fin.last ett.rounds) = some ((ett.series.data.tree + (Fin.last ett.rounds).castSucc).vertex base.supportPosition)) (_ : U = X ∪ Y) (gamma delta + : Fin k) (_ : ett.series.data.gamma n = some gamma) (_ : ett.series.data.delta n = some + delta) (c : Fin k) (_ : c ≠ beta) (_ : c ≠ delta), + ∀ v ∈ TreeSequenceVertexSet Tn, v ∈ Y → + let psi : PartialEdgeColoring E k := OutsideTreeColorSwap base.core sigma alpha c; + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → CombinedStableColoring Tn + base.closure (TashkinovStoredColors ett.series.data n) generating psi → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi c beta; ( + ∀ (r : V), c ∈ MissingColors G psi r ∨ beta ∈ MissingColors G psi r → (H.neighborSet (Sum.inl + r)).Subsingleton) → c ∈ TreeMissingColors psi Tn → TreeInterchangeable G base.closure psi + c beta → ( + ∀ (r : V), Sum.inl r ∈ TwoColorComponent G psi c beta (Sum.inl r)) → TwoColorPathComponent G + psi c beta (Sum.inl v) → + ∀ (r s : V), s ∈ U → (beta = delta → s ∈ Y) → H.Reachable (Sum.inl r) (Sum.inl s) → c ∈ + MissingColors G psi r ∨ beta ∈ MissingColors G psi r → TwoColorComponent G psi c beta + (Sum.inl r) = TwoColorComponent G psi c beta (Sum.inl v) := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hPE base alpha beta + n Tn X Y U hchosen hU gamma delta hgamma hdelta c hcb hcd v hvX hvY psi hproperPsi honePsi + hstablePsi H leaf hcX hinterY selfMem hvPath r s hs hsY hr hm + have hrPath : TwoColorPathComponent G psi c beta (Sum.inl r) := + ⟨hcb, Sum.inl r, selfMem r, leaf r hm⟩ + have hsC : Sum.inl s ∈ TwoColorComponent G psi c beta (Sum.inl r) := + SimpleGraph.ConnectedComponent.eq.mpr hr.symm + by_cases hbd : beta = delta + · exact hinterY _ _ hrPath hvPath ⟨s, hsY hbd, hsC⟩ + ⟨v, hvY, selfMem v⟩ + · rw [hU] at hs + rcases Finset.mem_union.mp hs with hsX | hsY' + · have hinterX := InterchangePETreeAwayFromDelta G k e0 input T + generating psi ett hMP hpositive hlower hPE base hproperPsi honePsi + hstablePsi (Tn.vertex base.supportPosition) gamma delta c beta + hchosen hgamma hdelta hcX hcd hbd + exact hinterX _ _ hrPath hvPath ⟨s, hsX, hsC⟩ + ⟨v, hvX, selfMem v⟩ + · exact hinterY _ _ hrPath hvPath ⟨s, hsY', hsC⟩ + ⟨v, hvY, selfMem v⟩ + +private theorem helper_continuation_720.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (_ : (0 : ℕ) < + ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet Tn; + let Y : Finset V := TreeSequenceVertexSet base.closure; + let U : Finset V := TreeSequenceVertexSet base.core; + ∀ (_ : ett.series.data.chosenVertex (Fin.last ett.rounds) = some ((ett.series.data.tree + (Fin.last ett.rounds).castSucc).vertex base.supportPosition)) (_ : U = X ∪ Y) (_ : + TashkinovClosure generating (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) (gamma delta : Fin k) (_ : + ett.series.data.gamma n = some gamma) (_ : ett.series.data.delta n = some delta) (_ : ( + ∀ g ∈ BoundaryColorEdges G sigma X delta, + ∃ w ∈ Y, Incident G w g)) (_ : alpha ≠ beta) (u1 s1 u2 s2 : V) (P1 : (TwoColorIncidenceGraph G + sigma alpha beta).Walk (Sum.inl u1) (Sum.inl s1)) (P2 : (TwoColorIncidenceGraph G sigma + alpha beta).Walk (Sum.inl u2) (Sum.inl s2)) (_ : TreeExitPath base.core sigma alpha beta + u1 s1 P1) (_ : TreeExitPath base.core sigma alpha beta u2 s2 P2) (_ : u1 ≠ u2) (c : Fin k) + (_ : c ≠ beta) (_ : c ≠ delta), + ∀ v ∈ TreeSequenceVertexSet Tn, c ∈ MissingColors G sigma v → + ∀ w ∈ TreeSequenceVertexSet base.closure, v ∈ Y → + let psi : PartialEdgeColoring E k := OutsideTreeColorSwap base.core sigma alpha c; ( + ∀ (e : E), TreeIncidentEdge base.core e → psi e = sigma e) → ( + ∀ {e : E}, e ∈ BoundaryEdges G U → sigma e ≠ some alpha ∧ sigma e ≠ some c) → + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → ( + ∀ x ∈ U, MissingColors G psi x = MissingColors G sigma x) → CombinedStableColoring Tn + base.closure (TashkinovStoredColors ett.series.data n) generating psi → ( + ∀ r ∉ U, alpha ∈ MissingColors G sigma r ∨ beta ∈ MissingColors G sigma r → c ∈ MissingColors + G psi r ∨ beta ∈ MissingColors G psi r) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi c beta; ( + ∀ (r : V), c ∈ MissingColors G psi r ∨ beta ∈ MissingColors G psi r → (H.neighborSet (Sum.inl + r)).Subsingleton) → False := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper + alpha beta n Tn X Y U hchosen hU _ gamma delta hgamma hdelta hdeltaBoundary hab u1 s1 u2 s2 + P1 P2 hP1 hP2 hu12 c hcb hcd v hvX hcv w hwY hvY psi fixed boundaryAvoid hproperPsi honePsi + missingFixed hstablePsi missingOutside H leaf + have transport (r : V) (hr : r ∉ U) + (hmeet : ∃ x ∈ U, + Sum.inl x ∈ TwoColorComponent G sigma alpha beta (Sum.inl r)) : + ∃ s ∈ U, (beta = delta → s ∈ Y) ∧ + H.Reachable (Sum.inl r) (Sum.inl s) := by + exact @helper_transport_460 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating sigma ett hpositive base hproper alpha beta hU delta hdeltaBoundary + hab c hcb w hwY fixed boundaryAvoid r hr hmeet + have oldMeet (u s : V) + (P : (TwoColorIncidenceGraph G sigma alpha beta).Walk (Sum.inl u) (Sum.inl s)) + (hs : s ∈ U) : + ∃ x ∈ U, Sum.inl x ∈ TwoColorComponent G sigma alpha beta (Sum.inl u) := by + refine ⟨s, hs, ?_⟩ + exact SimpleGraph.ConnectedComponent.eq.mpr P.reachable.symm + obtain ⟨t1, ht1, ht1Y, hr1⟩ := transport u1 hP1.2.2.1 + (oldMeet u1 s1 P1 hP1.2.2.2.1) + obtain ⟨t2, ht2, ht2Y, hr2⟩ := transport u2 hP2.2.2.1 + (oldMeet u2 s2 P2 hP2.2.2.2.1) + have hm1 := missingOutside u1 hP1.2.2.1 hP1.2.2.2.2.1 + have hm2 := missingOutside u2 hP2.2.2.1 hP2.2.2.2.2.1 + have hvU : v ∈ U := by rw [hU]; exact Finset.mem_union_left _ hvX + have hcvPsi : c ∈ MissingColors G psi v := by + rw [missingFixed v hvU] + exact hcv + have hcX : c ∈ TreeMissingColors psi Tn := + Finset.mem_biUnion.mpr ⟨v, hvX, hcvPsi⟩ + have hcY : c ∈ TreeMissingColors psi base.closure := + Finset.mem_biUnion.mpr ⟨v, hvY, hcvPsi⟩ + have hinterY := InterchangePEClosureConstituent G k e0 input T + generating psi ett hMP hpositive hlower hPE base hproperPsi honePsi + hstablePsi c beta hcY + have selfMem (r : V) : Sum.inl r ∈ TwoColorComponent G psi c beta (Sum.inl r) := + SimpleGraph.ConnectedComponent.eq.mpr (SimpleGraph.Reachable.refl _) + have hvPath : TwoColorPathComponent G psi c beta (Sum.inl v) := + ⟨hcb, Sum.inl v, selfMem v, leaf v (Or.inl hcvPsi)⟩ + have equalRoot (r s : V) (hs : s ∈ U) + (hsY : beta = delta → s ∈ Y) + (hr : H.Reachable (Sum.inl r) (Sum.inl s)) + (hm : c ∈ MissingColors G psi r ∨ beta ∈ MissingColors G psi r) : + TwoColorComponent G psi c beta (Sum.inl r) = + TwoColorComponent G psi c beta (Sum.inl v) := by + exact @helper_equalRoot_593 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating sigma ett hMP hpositive hlower hPE base alpha beta hchosen hU gamma + delta hgamma hdelta c hcb hcd v hvX hvY hproperPsi honePsi hstablePsi leaf hcX hinterY + selfMem hvPath r s hs hsY hr hm + have heq1 := equalRoot u1 t1 ht1 ht1Y hr1 hm1 + have heq2 := equalRoot u2 t2 ht2 ht2Y hr2 hm2 + obtain ⟨a, b, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G psi c beta hproperPsi (Sum.inl v) + have endpoint (r : V) + (hr : Sum.inl r ∈ TwoColorComponent G psi c beta (Sum.inl v)) + (hleaf : Set.Subsingleton (H.neighborSet (Sum.inl r))) : + Sum.inl r = a ∨ Sum.inl r = b := by + have hrp : Sum.inl r ∈ p.support := by + change Sum.inl r ∈ {x | x ∈ p.support} + rw [hsupport] + exact hr + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hleaf) hrp + have hu1C : Sum.inl u1 ∈ TwoColorComponent G psi c beta (Sum.inl v) := by + rw [← heq1] + exact selfMem u1 + have hu2C : Sum.inl u2 ∈ TwoColorComponent G psi c beta (Sum.inl v) := by + rw [← heq2] + exact selfMem u2 + have end1 := endpoint u1 hu1C (leaf u1 hm1) + have end2 := endpoint u2 hu2C (leaf u2 hm2) + have endv := endpoint v (selfMem v) (leaf v (Or.inl hcvPsi)) + have hu1v : u1 ≠ v := by rintro rfl; exact hP1.2.2.1 hvU + have hu2v : u2 ≠ v := by rintro rfl; exact hP2.2.2.1 hvU + have hn12 : (Sum.inl u1 : Sum V E) ≠ Sum.inl u2 := by simpa using hu12 + have hn1v : (Sum.inl u1 : Sum V E) ≠ Sum.inl v := by simpa using hu1v + have hn2v : (Sum.inl u2 : Sum V E) ≠ Sum.inl v := by simpa using hu2v + rcases end1 with h1 | h1 + · rcases end2 with h2 | h2 + · exact hn12 (h1.trans h2.symm) + · rcases endv with hv | hv + · exact hn1v (h1.trans hv.symm) + · exact hn2v (h2.trans hv.symm) + · rcases end2 with h2 | h2 + · rcases endv with hv | hv + · exact hn2v (h2.trans hv.symm) + · exact hn1v (h1.trans hv.symm) + · exact hn12 (h1.trans h2.symm) + +private theorem helper_continuation_462.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (_ : (0 : ℕ) < + ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : CombinedStableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) base.closure (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) generating sigma) (alpha beta : Fin k) (_ : TreeColorSetClosed G sigma + base.core { alpha }), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet Tn; + let Y : Finset V := TreeSequenceVertexSet base.closure; + let U : Finset V := TreeSequenceVertexSet base.core; + ∀ (_ : ett.series.data.chosenVertex (Fin.last ett.rounds) = some ((ett.series.data.tree + (Fin.last ett.rounds).castSucc).vertex base.supportPosition)) (_ : U = X ∪ Y) (_ : + TashkinovClosure generating (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) (_ : ColoredVertexSetElementary + G sigma U) (gamma delta : Fin k) (_ : ett.series.data.gamma n = some gamma) (_ : + ett.series.data.delta n = some delta) (_ : ( + ∀ g ∈ BoundaryColorEdges G sigma X delta, + ∃ w ∈ Y, Incident G w g)) (_ : alpha ≠ beta) (u1 s1 u2 s2 : V) (P1 : (TwoColorIncidenceGraph G + sigma alpha beta).Walk (Sum.inl u1) (Sum.inl s1)) (P2 : (TwoColorIncidenceGraph G sigma + alpha beta).Walk (Sum.inl u2) (Sum.inl s2)) (_ : TreeExitPath base.core sigma alpha beta + u1 s1 P1) (_ : TreeExitPath base.core sigma alpha beta u2 s2 P2) (_ : u1 ≠ u2) (_ : (4 : + ℕ) ≤ (TreeMissingColors sigma Tn ∩ TreeMissingColors sigma base.closure).card), False := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper + hone hstable alpha beta hclosed n Tn X Y U hchosen hU _ helem gamma delta hgamma hdelta + hdeltaBoundary hab u1 s1 u2 s2 P1 P2 hP1 hP2 hu12 hfour + have hcolor : ∃ c ∈ TreeMissingColors sigma Tn ∩ + TreeMissingColors sigma base.closure, + c ≠ alpha ∧ c ≠ beta ∧ c ≠ delta := by + exact @helper_hcolor_383 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett base alpha beta delta hfour + obtain ⟨c, hc, hca, hcb, hcd⟩ := hcolor + obtain ⟨v, hvX, hcv⟩ := Finset.mem_biUnion.mp (Finset.mem_inter.mp hc).1 + obtain ⟨w, hwY, hcw⟩ := Finset.mem_biUnion.mp (Finset.mem_inter.mp hc).2 + have hvY : v ∈ Y := by + have hvU : v ∈ U := by rw [hU]; exact Finset.mem_union_left _ hvX + have hwU : w ∈ U := by rw [hU]; exact Finset.mem_union_right _ hwY + have hvw : v = w := by + by_contra hvw + exact (Finset.disjoint_left.mp (helem hvU hwU hvw)) hcv hcw + exact hvw ▸ hwY + have hcclosed := InterchangePECommonMissingClosed G k e0 input T + generating sigma ett hMP hpositive hlower hPE base hproper hone hstable c + (Finset.mem_inter.mp hc).1 (Finset.mem_inter.mp hc).2 + let psi := OutsideTreeColorSwap base.core sigma alpha c + let flip := Equiv.swap (some alpha) (some c) + have fixed (e : E) (he : TreeIncidentEdge base.core e) : + psi e = sigma e := by + simp [psi, OutsideTreeColorSwap, he] + have boundaryOutside {r : V} {e : E} (hr : r ∉ U) + (hre : Incident G r e) (he : TreeIncidentEdge base.core e) : + e ∈ BoundaryEdges G U := by + obtain ⟨x, hx, hxe⟩ := he + have hxr : x ≠ r := by rintro rfl; exact hr hx + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hx, r, hr, (Sym2.mem_and_mem_iff hxr).mp ⟨hxe, hre⟩⟩ + have boundaryAvoid {e : E} (he : e ∈ BoundaryEdges G U) : + sigma e ≠ some alpha ∧ sigma e ≠ some c := by + constructor + · intro ha + have hm : e ∈ BoundaryColorEdges G sigma U alpha := + Finset.mem_filter.mpr ⟨he, ha⟩ + rw [hclosed alpha (Finset.mem_singleton_self _)] at hm + exact Finset.notMem_empty e hm + · intro hc' + have hm : e ∈ BoundaryColorEdges G sigma U c := + Finset.mem_filter.mpr ⟨he, hc'⟩ + rw [hcclosed c (Finset.mem_singleton_self _)] at hm + exact Finset.notMem_empty e hm + have outside (r : V) (hr : r ∉ U) (e : E) (hre : Incident G r e) : + psi e = flip (sigma e) := by + by_cases he : TreeIncidentEdge base.core e + · obtain ⟨ha, hc'⟩ := boundaryAvoid (boundaryOutside hr hre he) + simp [fixed e he, flip, Equiv.swap_apply_def, ha, hc'] + · simp [psi, OutsideTreeColorSwap, he, flip, Equiv.swap_apply_def] + have hproperPsi : IsProperEdgeColoring G psi := by + exact @helper_hproperPsi_447 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating sigma ett base hproper alpha c fixed outside + have hnone (e : E) : psi e = none ↔ sigma e = none := by + by_cases he : TreeIncidentEdge base.core e + · rw [fixed e he] + · simp only [psi, OutsideTreeColorSwap, he, ite_false] + by_cases ha : sigma e = some alpha + · simp [ha] + by_cases hc' : sigma e = some c + · simp [hc', hca] + · simp [ha, hc'] + have honePsi : IsOneEdgeUncolored psi e0 := by + refine ⟨(hnone e0).mpr hone.1, ?_⟩ + intro e he + obtain ⟨d, hd⟩ := hone.2 e he + cases hpsi : psi e with + | none => + have hn := (hnone e).mp hpsi + rw [hd] at hn + cases hn + | some d' => exact ⟨d', rfl⟩ + have missingFixed (x : V) (hx : x ∈ U) : + MissingColors G psi x = MissingColors G sigma x := by + ext d + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + constructor + · intro hn ⟨e, hxe, hed⟩ + exact hn ⟨e, hxe, (fixed e ⟨x, hx, hxe⟩).trans hed⟩ + · intro hn ⟨e, hxe, hed⟩ + exact hn ⟨e, hxe, (fixed e ⟨x, hx, hxe⟩).symm.trans hed⟩ + have hstablePsi : CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data n) generating psi := by + exact @helper_hstablePsi_495 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating sigma ett base hstable alpha hU c fixed missingFixed + have colorOutside (r : V) (hr : r ∉ U) (e : E) (hre : Incident G r e) : + (psi e = some c ↔ sigma e = some alpha) ∧ + (psi e = some beta ↔ sigma e = some beta) := by + rw [outside r hr e hre] + by_cases ha : sigma e = some alpha <;> + by_cases hc' : sigma e = some c <;> + simp [flip, Equiv.swap_apply_def, ha, hc', hca, hca.symm, + hcb, hab] + have missingOutside (r : V) (hr : r ∉ U) + (hm : alpha ∈ MissingColors G sigma r ∨ beta ∈ MissingColors G sigma r) : + c ∈ MissingColors G psi r ∨ beta ∈ MissingColors G psi r := by + exact @helper_missingOutside_524 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T generating sigma ett base alpha beta c colorOutside r hr hm + let H := TwoColorIncidenceGraph G psi c beta + have leaf (r : V) + (hm : c ∈ MissingColors G psi r ∨ beta ∈ MissingColors G psi r) : + Set.Subsingleton (H.neighborSet (Sum.inl r)) := by + exact @helper_leaf_543 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett base alpha beta c hcb hproperPsi r hm + -- Transport exact incidence segments; no old full component is reused after the swap. + exact @helper_continuation_720 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating sigma ett hMP hpositive hlower hPE base hproper alpha beta hchosen hU + (by assumption) gamma delta hgamma hdelta hdeltaBoundary hab u1 s1 u2 s2 P1 P2 hP1 hP2 hu12 + c hcb hcd v hvX hcv w hwY hvY fixed boundaryAvoid hproperPsi honePsi missingFixed + hstablePsi missingOutside leaf +theorem InterchangePEClosedCore {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (base : HierarchyBase ett generating) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : CombinedStableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + generating sigma) + (alpha beta : Fin k) : + alpha ∈ TreeMissingColors sigma base.core → + TreeColorSetClosed G sigma base.core {alpha} → + TreeInterchangeable G base.core sigma alpha beta := by + classical + intro halpha hclosed + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let X := TreeSequenceVertexSet Tn + let Y := TreeSequenceVertexSet base.closure + let U := TreeSequenceVertexSet base.core + obtain ⟨hchosen, hclosure, ⟨hunion⟩⟩ := base.parallel hPE + have hU : U = X ∪ Y := hunion.vertexSet + have hgen := ett.generatingColoring + obtain ⟨hproperGen, honeGen, _⟩ := P2634_T1_PETerminalFacts ett hPE + have hpreserved := CombinedStableClosurePreserved G k e0 input T + generating generating sigma ett hpositive base hgen hPE + hproperGen honeGen hproper hone hstable + let baseSigma : HierarchyBase ett sigma := { + core := base.core + closure := base.closure + supportPosition := base.supportPosition + supportPositive := base.supportPositive + terminalMissingColors := by + dsimp + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by rw [← hstable.1.2 v hv]; exact hc⟩ + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by rw [hstable.1.2 v hv]; exact hc⟩ + parallel := fun hp => ⟨(base.parallel hp).1, + hpreserved.2.2, (base.parallel hp).2.2⟩ + nonparallel := base.nonparallel } + have helem : ColoredVertexSetElementary G sigma U := + ParallelClosureUnionElementary G k e0 input T generating ett hMP + hpositive hlower hPE sigma hproper hone hstable.1 baseSigma + have hdegree : MaximumDegree G + 1 ≤ k := by + have htriple : KTriple G k e0 input := by + cases ett.series.certified 0 with + | initial => assumption + exact htriple.2.2.1 + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hq : q.succ = n := by + apply Fin.ext + simp [q, n] + omega + have hterminal : ∃ (gamma delta : Fin k) (f : E), + ett.series.data.gamma n = some gamma ∧ + ett.series.data.delta n = some delta ∧ + ett.series.data.connectingEdges n = {f} ∧ + ett.series.data.stored n = {delta, gamma} := by + exact @helper_hterminal_154 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive hPE hq + obtain ⟨gamma, delta, f, hgamma, hdelta, hf, hstored⟩ := hterminal + have hdeltaControl : delta ∈ TreeMissingColors generating Tn ∪ + TashkinovStoredColors ett.series.data n := by + by_cases hm : delta ∈ TreeMissingColors generating Tn + · exact Finset.mem_union_left _ hm + · apply Finset.mem_union_right + simp only [TashkinovStoredColors] + rw [ite_eq_right (show n.val ≠ 0 by simp [n]; omega)] + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_biUnion.mpr ⟨n, Finset.mem_univ _, ?_⟩, ?_⟩ + · simp [hstored] + · simpa [Tn, n, ← hgen] using hm + let seed := TreeSequencePrefix Tn base.supportPosition.val + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt) + have hseedY : TreeSequenceVertexSet seed ⊆ Y := + TreeSequenceInitialSegmentVertexSetSubset + (TashkinovAugmentationSequenceInitialSegment generating seed base.closure + hclosure.1) + have hdeltaBoundary : ∀ g ∈ BoundaryColorEdges G sigma X delta, + ∃ w ∈ Y, Incident G w g := by + exact @helper_hdeltaBoundary_215 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T generating sigma ett hpositive hPE base hproper hone hstable hchosen hgen + hproperGen honeGen hq gamma delta f hgamma hdelta hf hdeltaControl hseedY + by_cases hab : alpha = beta + · intro z w hz + exact (hz.1 hab).elim + change alpha ≠ beta at hab + by_contra hnot + obtain ⟨u1, s1, u2, s2, P1, P2, hP1, hP2, hdisjoint, hu12, hs12⟩ := + ElementaryClosedNoninterchangeableDisjointExitPaths G base.core sigma + hproper helem alpha beta hab hclosed hnot + have stableMissing {A : TreeSequence G e0} {C : Finset (Fin k)} + {rho tau : PartialEdgeColoring E k} (hh : StableColoring A C rho tau) : + TreeMissingColors tau A = TreeMissingColors rho A := by + ext d + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨x, hx, hd⟩ + exact ⟨x, hx, by rw [← hh.2 x hx]; exact hd⟩ + · rintro ⟨x, hx, hd⟩ + exact ⟨x, hx, by rw [hh.2 x hx]; exact hd⟩ + have missingGen (x : V) (hx : x ∈ U) : + MissingColors G sigma x = MissingColors G generating x := by + rw [hU] at hx + rcases Finset.mem_union.mp hx with hx | hx + · exact hstable.1.2 x hx + · exact hstable.2.2 x hx + have helemGen : ColoredVertexSetElementary G generating U := by + intro x hx y hy hxy + rw [← missingGen x hx, ← missingGen y hy] + exact helem hx hy hxy + have hfour : 4 ≤ (TreeMissingColors sigma Tn ∩ + TreeMissingColors sigma base.closure).card := by + rw [stableMissing hstable.1, stableMissing hstable.2] + exact ParallelBaseFourCommonMissingColors ett base hPE + hproperGen honeGen hdegree helemGen + exact @helper_continuation_462 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating sigma ett hMP hpositive hlower hPE base hproper hone hstable alpha + beta hclosed hchosen hU (by assumption) helem gamma delta hgamma hdelta hdeltaBoundary hab + u1 s1 u2 s2 P1 P2 hP1 hP2 hu12 hfour +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/InterchangePEClosureConstituent.lean b/LeanPool/GoldbergSeymour/InterchangePEClosureConstituent.lean new file mode 100644 index 0000000000..4f1b817240 --- /dev/null +++ b/LeanPool/GoldbergSeymour/InterchangePEClosureConstituent.lean @@ -0,0 +1,870 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtensionRules +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PartialEdgeColoring +public import LeanPool.GoldbergSeymour.ParallelTerminalFacts +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesData +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Interchange PEClosure Constituent + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_transportRoute_255.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : (0 : ℕ) < ett.rounds) (base : + HierarchyBase ett generating) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let B : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + let v : V := Tn.vertex base.supportPosition; + ∀ (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hcandidates : candidates.Nonempty), + let j : Fin (ett.rounds + (1 : ℕ)) := candidates.min' hcandidates; + ∀ (_ : (↑j : ℕ) + (1 : ℕ) ≤ ett.rounds), + let A : TreeSequence G e0 := ett.series.data.tree j.succ; + ∀ (_ : TreeSequenceInitialSegment B A) (_ : StableColoringBeforeVertex T v hvT + (TashkinovStoredColors ett.series.data j) (ett.series.data.coloring j) sigma ∧ ((0 : ℕ) < + (↑j : ℕ) → StableColoring (ett.series.data.tree j.castSucc) (TashkinovStoredColors + ett.series.data j) (ett.series.data.coloring j) sigma)) (_ : ( + ∀ {X : TreeSequence G e0} (_ : TreeSequenceInitialSegment X B) (_ : X.length < B.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet X), x ∈ TreeVerticesBefore T v hvT)) (S : + TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring j) S A) (_ + : TreeSequenceInitialSegment S B), TashkinovAugmentationSequence sigma S B := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hpositive base segmentTrans n Tn B v hvT + candidates hcandidates j hjbound A hBA hbefore vertexBefore S hSA hSB + have hroute := TashkinovAugmentationSequenceRestrict _ S B A hSA hSB hBA + clear hSA hSB + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head X Y hstep htail ih => + have hYB := TashkinovAugmentationSequenceInitialSegment _ _ _ htail + rcases hstep with ⟨hlen, hXY, c, hcolor, hcmissing⟩ + have hXB := segmentTrans hXY hYB + have hlt : X.length < B.length := by have := hYB.1; omega + have beforeX : ∀ x ∈ TreeSequenceVertexSet X, + x ∈ TreeVerticesBefore T v hvT := fun x hx => vertexBefore hXB hlt hx + obtain ⟨x, hx, hxc⟩ := Finset.mem_biUnion.mp hcmissing + have hcsigma : c ∈ TreeMissingColors sigma X := by + apply Finset.mem_biUnion.mpr + exact ⟨x, hx, (hbefore.1.2 x (beforeX x hx)) ▸ hxc⟩ + let last : Fin Y.length := Fin.cast hlen.symm (Fin.last X.length) + obtain ⟨i, hi⟩ := Y.attaches last + let ix : Fin (X.length + 1) := ⟨i.val, by + have := i.isLt + change i.val < last.val + 1 at this + dsimp [last] at this + omega⟩ + have hinc : Incident G (X.vertex ix) (Y.edge last) := by + change X.vertex ix ∈ G.ends (Y.edge last) + rw [hi] + have heq : Y.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ last.isLt))) = X.vertex ix := by + exact hXY.2.1 ix + rw [heq] + exact Sym2.mem_mk_right _ _ + have hix : X.vertex ix ∈ TreeSequenceVertexSet X := by + simp [TreeSequenceVertexSet] + have heq := hbefore.1.1 (Y.edge last) + ⟨X.vertex ix, beforeX _ hix, hinc⟩ + ⟨c, Finset.mem_union_left _ + (Finset.mem_biUnion.mpr ⟨x, beforeX x hx, hxc⟩), hcolor⟩ + exact Relation.ReflTransGen.head + ⟨hlen, hXY, c, heq.trans hcolor, hcsigma⟩ ih + +private theorem helper_branch_368.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (_ : (0 : ℕ) < + ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (base : HierarchyBase + ett generating) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) + (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors sigma base.closure) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let B : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + let v : V := Tn.vertex base.supportPosition; + ∀ (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hcandidates : candidates.Nonempty), + let j : Fin (ett.rounds + (1 : ℕ)) := candidates.min' hcandidates; + ∀ (hjbound : (↑j : ℕ) + (1 : ℕ) ≤ ett.rounds), + let p : Fin ett.rounds := (⟨(↑j : ℕ), Decidable.byContradiction fun (a : ¬(↑j : ℕ) < + ett.rounds) => + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : p.castSucc = j), + let A : TreeSequence G e0 := ett.series.data.tree j.succ; + let P : TreeSequence G e0 := ett.series.data.tree j.castSucc; + ∀ (_ : TreeSequenceInitialSegment P A) (_ : TreeSequenceInitialSegment B A) (_ : + StableColoringBeforeVertex T v hvT (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma ∧ ((0 : ℕ) < (↑j : ℕ) → StableColoring + (ett.series.data.tree j.castSucc) (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma)) (_ : ( + ∀ (_ : (0 : ℕ) < (↑j : ℕ)), P.length < B.length)) (S : TreeSequence G e0) (_ : ((↑j : ℕ) = (0 + : ℕ) ∧ S = ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ))) ∧ S.length = (1 : ℕ) ∨ + ett.series.data.kind j = some TashkinovExtensionKind.PE ∧ S = ett.series.data.tree + j.castSucc ∨ (ett.series.data.kind j = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind j = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges j = { f } ∧ TreeSequenceAdjoinEdge + (ett.series.data.tree j.castSucc) f S)) (_ : TashkinovAugmentationSequence sigma S + base.closure) (_ : TreeSequenceInitialSegment B base.closure) (_ : (0 : ℕ) < (↑j : ℕ)), + TreeInterchangeable G base.closure sigma alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower base hproper hone + alpha beta hmissing segmentTrans commonPrefix n Tn B v hvT candidates hcandidates j hjbound + p hpj A P hPA hBA hbefore hPBstrict S hseed hSR hBR hj + have hjlt : j.val < ett.rounds := by omega + obtain ⟨restricted, hr, hmax, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP j.val hj hjlt + let rn : Fin (restricted.rounds + 1) := Fin.last restricted.rounds + have hidx : Fin.castLE (by omega : restricted.rounds + 1 ≤ ett.rounds + 1) rn = j := by + apply Fin.ext + simpa only [rn, Fin.val_castLE, Fin.val_last] using hr + have htidx : Fin.castLE (by omega : restricted.rounds + 2 ≤ ett.rounds + 2) + rn.castSucc = j.castSucc := by + apply Fin.ext + simpa only [rn, Fin.val_castLE, Fin.val_castSucc, Fin.val_last] using hr + have htree : restricted.series.data.tree rn.castSucc = P := by + simpa only [htidx, P] using htrees rn.castSucc + have hcolor : restricted.series.data.coloring rn = ett.series.data.coloring j := by + simpa only [hidx] using (hdata rn).1 + have hstored : TashkinovStoredColors restricted.series.data rn = + TashkinovStoredColors ett.series.data j := by + simpa only [hidx] using (hdata rn).2.2.2.2.2.2.2.2.1 + have hkind : restricted.series.data.kind rn = ett.series.data.kind j := by + simpa only [hidx] using (hdata rn).2.2.2.1 + have hedges : restricted.series.data.connectingEdges rn = + ett.series.data.connectingEdges j := by + simpa only [hidx] using (hdata rn).2.2.1 + have hmod : ModColoring restricted sigma := by + apply Td G k e0 input _ _ restricted hmax (by omega) + (fun lower hp hlt hmax => hlower lower hp (by omega) hmax) + sigma hproper hone + change StableColoring (restricted.series.data.tree rn.castSucc) + (TashkinovStoredColors restricted.series.data rn) + (restricted.series.data.coloring rn) sigma + rw [htree, hstored, hcolor] + exact hbefore.2 hj + have hPR : TreeSequenceInitialSegment P base.closure := + segmentTrans (commonPrefix hPA hBA (le_of_lt (hPBstrict hj))) hBR + have hstrict : P.length < base.closure.length := + lt_of_lt_of_le (hPBstrict hj) hBR.1 + have hextension : + ((restricted.series.data.kind rn = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma + (restricted.series.data.tree rn.castSucc) base.closure) ∨ + ((restricted.series.data.kind rn = some TashkinovExtensionKind.SE ∨ + restricted.series.data.kind rn = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + restricted.series.data.connectingEdges rn = {f} ∧ + TreeSequenceAdjoinEdge (restricted.series.data.tree rn.castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed base.closure)) := by + rw [hkind, htree, hedges] + rcases hseed with ⟨hjzero, _, _⟩ | ⟨hPEj, hs⟩ | ⟨hSEj, f, hf, hadjoin⟩ + · omega + · exact Or.inl ⟨hPEj, by simpa only [hs, P] using hSR⟩ + · exact Or.inr ⟨hSEj, f, S, hf, hadjoin, hSR⟩ + obtain ⟨corr⟩ := hmod.2.2 base.closure + (by change TreeSequenceInitialSegment (restricted.series.data.tree rn.castSucc) _ + rw [htree] + exact hPR) + (by change (restricted.series.data.tree rn.castSucc).length < _ + rw [htree] + exact hstrict) hextension + have hmaxCorr := MaximumPropertyTransport G k e0 restricted sigma hmod + base.closure corr hmax + have hroundCorr : corr.replacementETT.rounds < ett.rounds := by + rw [corr.rungAgreement, hr] + exact hjlt + have htwo := (hlower corr.replacementETT + (by have := corr.replacementETT.roundsPositive; omega) hroundCorr hmaxCorr).2.1 + let L := corr.replacementETT.series.data.tree + (Fin.last (corr.replacementETT.rounds + 1)) + have hRL : TreeSequenceInitialSegment base.closure L := + corr.replacementETT.belowFinal + have hmissingL : alpha ∈ TreeMissingColors sigma L := by + obtain ⟨x, hx, hxc⟩ := Finset.mem_biUnion.mp hmissing + exact Finset.mem_biUnion.mpr + ⟨x, TreeSequenceInitialSegmentVertexSetSubset hRL hx, hxc⟩ + have hreflexive : StableColoring L + (TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds)) + (corr.replacementETT.series.data.coloring + (Fin.last corr.replacementETT.rounds)) sigma := by + rw [← corr.replacementETT.generatingColoring] + exact ⟨(by intro f hf hc; rfl), (by intro x hx; rfl)⟩ + have hinterchange := htwo sigma hproper hone hreflexive alpha beta (Or.inl hmissingL) + intro z w hz hw hzR hwR + obtain ⟨x, hx, hxz⟩ := hzR + obtain ⟨y, hy, hyw⟩ := hwR + exact hinterchange z w hz hw + ⟨x, TreeSequenceInitialSegmentVertexSetSubset hRL hx, hxz⟩ + ⟨y, TreeSequenceInitialSegmentVertexSetSubset hRL hy, hyw⟩ + +private theorem helper_branch_455.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : (0 : ℕ) < ett.rounds) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors sigma base.closure), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let B : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + let v : V := Tn.vertex base.supportPosition; + ∀ (_ : v ∈ TreeSequenceVertexSet T) (_ : TashkinovClosure sigma B base.closure), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hcandidates : candidates.Nonempty), + let j : Fin (ett.rounds + (1 : ℕ)) := candidates.min' hcandidates; + ∀ (hjbound : (↑j : ℕ) + (1 : ℕ) ≤ ett.rounds), + let p : Fin ett.rounds := (⟨(↑j : ℕ), Decidable.byContradiction fun (a : ¬(↑j : ℕ) < + ett.rounds) => + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : p.castSucc = j) (S : TreeSequence G e0) (_ : ((↑j : ℕ) = (0 : ℕ) ∧ S = + ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ))) ∧ S.length = (1 : ℕ) ∨ + ett.series.data.kind j = some TashkinovExtensionKind.PE ∧ S = ett.series.data.tree + j.castSucc ∨ (ett.series.data.kind j = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind j = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges j = { f } ∧ TreeSequenceAdjoinEdge + (ett.series.data.tree j.castSucc) f S)) (_ : TashkinovAugmentationSequence sigma S + base.closure) (_ : ¬(0 : ℕ) < (↑j : ℕ)), TreeInterchangeable G base.closure sigma alpha + beta := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hpositive base hproper hone alpha beta + hmissing n Tn B v hvT hclosure candidates hcandidates j hjbound p hpj S hseed hSR hj + have hjzero : j = 0 := by apply Fin.ext; change j.val = 0; omega + have hkindzero : ett.series.data.kind 0 = none := by + cases ett.series.certified 0 with + | initial => assumption + have hs : S = ett.series.data.tree 0 := by + rcases hseed with ⟨_, hs, _⟩ | ⟨hkind, _⟩ | ⟨hkind, _⟩ + · exact hs + · rw [hjzero, hkindzero] at hkind + cases hkind + · rw [hjzero, hkindzero] at hkind + rcases hkind with hkind | hkind <;> cases hkind + have hseedLength : (ett.series.data.tree 0).length = 1 := by + cases ett.series.certified 0 with + | initial => assumption + have htriple : KTriple G k e0 sigma := by + have hinput : KTriple G k e0 input := by + cases ett.series.certified 0 with + | initial => assumption + exact ⟨hinput.1, hinput.2.1, hinput.2.2.1, hproper, hone⟩ + -- First appearance in T1 uses an actual zero-round series, not a zero-rung ETT. + let data0 : TashkinovSeriesData G k 0 e0 := + { tree := fun i => if i.val = 0 then ett.series.data.tree 0 else base.closure + coloring := fun _ => sigma + stored := fun _ => ∅ + connectingEdges := fun _ => ∅ + kind := fun _ => none + chosenVertex := fun _ => none + outsideVertex := fun _ => none + delta := fun _ => none + gamma := fun _ => none } + have hclosure0 : TashkinovClosure sigma (ett.series.data.tree 0) base.closure := + ⟨hs ▸ hSR, hclosure.2⟩ + let series0 : TashkinovSeries G k 0 e0 sigma := + { data := data0 + certified := by + intro i + have hi : i = 0 := by + apply Fin.ext + have := i.isLt + change i.val = 0 + omega + subst i + apply TashkinovSeriesStep.initial + · exact htriple + · exact hseedLength + · rfl + · rfl + · rfl + · rfl + · rfl + · rfl + · rfl + · rfl + · exact hclosure0 } + have htwo := (TechnicalTheoremBase G k 0 e0 sigma series0).2 + have hreflexive : StableColoring (series0.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors series0.data 0) (series0.data.coloring 0) sigma := + ⟨(by intro f hf hc; rfl), (by intro x hx; rfl)⟩ + exact htwo sigma hproper hone hreflexive alpha beta (Or.inl hmissing) + +private theorem helper_seedData_592.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (t : Fin (ett.rounds + (1 : ℕ))), + ∃ (S : TreeSequence G e0), TashkinovAugmentationSequence (ett.series.data.coloring t) S + (ett.series.data.tree t.succ) ∧ ((↑t : ℕ) = (0 : ℕ) ∧ S = ett.series.data.tree (0 : Fin + (ett.rounds + (2 : ℕ))) ∧ S.length = (1 : ℕ) ∨ ett.series.data.kind t = some + TashkinovExtensionKind.PE ∧ S = ett.series.data.tree t.castSucc ∨ (ett.series.data.kind t + = some TashkinovExtensionKind.SE ∨ ett.series.data.kind t = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges t = { f } ∧ TreeSequenceAdjoinEdge + (ett.series.data.tree t.castSucc) f S) := by + classical + intro V E _ _ _ G k e0 input T generating ett t + cases ett.series.certified t with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact ⟨_, initialClosure.1, Or.inl ⟨rfl, rfl, seedLength⟩⟩ + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact ⟨adjoined, closedExtension.1, + Or.inr (Or.inr ⟨Or.inl currentKind, choice.edge, currentEdges, adjoinedExactly⟩)⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact ⟨_, closedExtension.1, Or.inr (Or.inl ⟨currentKind, rfl⟩)⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact ⟨adjoined, closedExtension.1, + Or.inr (Or.inr ⟨Or.inr currentKind, available.edge, currentEdges, adjoinedExactly⟩)⟩ + +private theorem helper_hSlen_631.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let B : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + let v : V := Tn.vertex base.supportPosition; + ∀ (_ : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hcandidates : candidates.Nonempty), + let j : Fin (ett.rounds + (1 : ℕ)) := candidates.min' hcandidates; + ∀ (hjbound : (↑j : ℕ) + (1 : ℕ) ≤ ett.rounds), + let p : Fin ett.rounds := (⟨(↑j : ℕ), Decidable.byContradiction fun (a : ¬(↑j : ℕ) < + ett.rounds) => + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : p.castSucc = j), + let P : TreeSequence G e0 := ett.series.data.tree j.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑j : ℕ)), P.length < B.length)) (S : TreeSequence G e0) (_ : ((↑j : ℕ) = (0 + : ℕ) ∧ S = ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ))) ∧ S.length = (1 : ℕ) ∨ + ett.series.data.kind j = some TashkinovExtensionKind.PE ∧ S = ett.series.data.tree + j.castSucc ∨ (ett.series.data.kind j = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind j = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges j = { f } ∧ TreeSequenceAdjoinEdge + (ett.series.data.tree j.castSucc) f S)), S.length ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive base n Tn B v hvT candidates + hcandidates j hjbound p hpj P hPBstrict S hseed + rcases hseed with ⟨hj, hs, hlen⟩ | ⟨hkind, hs⟩ | ⟨hkind, f, hf, hadjoin⟩ + · rw [hlen] + exact B.positive + · rw [hs] + by_cases hj : 0 < j.val + · exact le_of_lt (hPBstrict hj) + · have hjzero : j = 0 := by apply Fin.ext; change j.val = 0; omega + have hkindzero : ett.series.data.kind 0 = none := by + cases ett.series.certified 0 with + | initial => assumption + rw [hjzero, hkindzero] at hkind + cases hkind + · obtain ⟨hlen, _, _⟩ := hadjoin + have hj : 0 < j.val := by + by_contra hn + have hjzero : j = 0 := by apply Fin.ext; change j.val = 0; omega + have hkindzero : ett.series.data.kind 0 = none := by + cases ett.series.certified 0 with + | initial => assumption + rw [hjzero, hkindzero] at hkind + rcases hkind with hkind | hkind <;> cases hkind + have hstrict := hPBstrict hj + dsimp [P] at hstrict + omega + +private theorem helper_segmentTrans_553.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B + C → TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + refine ⟨hAB.1.trans hBC.1, ?_, ?_⟩ + · intro i + exact (hBC.2.1 (Fin.castLE (Nat.succ_le_succ hAB.1) i)).trans + (hAB.2.1 i) + · intro i + exact (hBC.2.2 (Fin.castLE hAB.1 i)).trans (hAB.2.2 i) + +private theorem helper_commonPrefix_563.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B + C → A.length ≤ B.length → TreeSequenceInitialSegment A B := by + classical + intro V E G e0 A B C hAC hBC hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hBC.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans + (hAC.2.1 i) + · intro i + exact (hBC.2.2 (Fin.castLE hlen i)).symm.trans (hAC.2.2 i) + +private theorem helper_stepSegment_573.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (i : Fin (ett.rounds + (1 : ℕ))), TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett i + cases ett.series.certified i with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact TashkinovAugmentationSequenceInitialSegment _ _ _ initialClosure.1 + | SE => assumption + | PE => assumption + | RE => assumption + +private theorem helper_stageSegment_584.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : HierarchyBase ett generating), ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), TreeSequenceInitialSegment (ett.series.data.tree + i.castSucc) (ett.series.data.tree i.succ)) → + ∀ (a b : ℕ) (hab : a ≤ b) (hb : b ≤ ett.rounds + (1 : ℕ)), TreeSequenceInitialSegment + (ett.series.data.tree (⟨a, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett base segmentTrans stepSegment a b hab hb + induction b, hab using Nat.le_induction with + | base => exact ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + | succ b hab ih => + have hprev := ih (by omega) + have hstep := stepSegment ⟨b, by omega⟩ + exact segmentTrans hprev hstep + +private theorem helper_hfirst_628.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (base : HierarchyBase ett generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + ∀ (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := ({i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)} : Finset (Fin (ett.rounds + (1 + : ℕ)))); + ∀ (hcandidates : candidates.Nonempty), + let j : Fin (ett.rounds + (1 : ℕ)) := candidates.min' hcandidates; ETTFirstAppearanceIndex ett + v hvT = (↑j : ℕ) + (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett base n Tn v hvT candidates hcandidates j + unfold ETTFirstAppearanceIndex + dsimp + apply congrArg (fun i : Fin (ett.rounds + 1) => i.val + 1) + apply (Finset.min'_eq_iff _ _ j).mpr + constructor + · have hmem := Finset.min'_mem candidates hcandidates + change j ∈ candidates at hmem + simpa only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] using hmem + · intro b hb + exact Finset.min'_le candidates b (by + simpa only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] using hb) + +private theorem helper_hjbound_645.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.PE → + ∀ (base : HierarchyBase ett generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + ∀ (hvT : v ∈ TreeSequenceVertexSet T), ett.series.data.chosenVertex n = some v → + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := ({i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)} : Finset (Fin (ett.rounds + (1 + : ℕ)))); + ∀ (hcandidates : candidates.Nonempty), + let j : Fin (ett.rounds + (1 : ℕ)) := candidates.min' hcandidates; ETTFirstAppearanceIndex ett + v hvT = (↑j : ℕ) + (1 : ℕ) → + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = n → (↑j : ℕ) + (1 : ℕ) ≤ ett.rounds := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive hPE base n Tn v hvT hchosen + candidates hcandidates j hfirst q hq + have hbound := ExtensionRulesPEFirstAppearanceBound G k e0 input T + generating ett q v (by simpa [hq] using hPE) + (by simpa [hq] using hchosen) hvT + rw [hfirst] at hbound + dsimp [q] at hbound + omega + +private theorem helper_hvA_656.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + ∀ (_ : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := ({i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)} : Finset (Fin (ett.rounds + (1 + : ℕ)))); + ∀ (hcandidates : candidates.Nonempty), + let j : Fin (ett.rounds + (1 : ℕ)) := candidates.min' hcandidates; + ∀ (hjbound : (↑j : ℕ) + (1 : ℕ) ≤ ett.rounds), + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive Tn + omega + ⟩ : Fin ett.rounds); p.castSucc = j → + let A : TreeSequence G e0 := ett.series.data.tree j.succ; v ∈ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive base n Tn v hvT candidates + hcandidates j hjbound p hpj A + have hmem := Finset.min'_mem candidates hcandidates + have hvstage : v ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett j) := (Finset.mem_filter.mp hmem).2 + rw [← hpj, ExtendedTashkinovLadderStage, Fin.lastCases_castSucc] at hvstage + have hidx : p.succ.castSucc = j.succ := by apply Fin.ext; rfl + simpa only [hidx, A] using hvstage + +private theorem helper_hvNotP_682.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + ∀ (_ : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := ({i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)} : Finset (Fin (ett.rounds + (1 + : ℕ)))); + ∀ (hcandidates : candidates.Nonempty), + let j : Fin (ett.rounds + (1 : ℕ)) := candidates.min' hcandidates; + ∀ (hjbound : (↑j : ℕ) + (1 : ℕ) ≤ ett.rounds), + let p : Fin ett.rounds := (⟨(↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive Tn + omega + ⟩ : Fin ett.rounds); p.castSucc = j → + let P : TreeSequence G e0 := ett.series.data.tree j.castSucc; (0 : ℕ) < (↑j : ℕ) → v ∉ + TreeSequenceVertexSet P := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive base n Tn v hvT candidates + hcandidates j hjbound p hpj P hj hvP + let u : Fin ett.rounds := ⟨j.val - 1, by omega⟩ + have huj : u.succ = j := by apply Fin.ext; dsimp [u]; omega + have huMem : u.castSucc ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [ExtendedTashkinovLadderStage, Fin.lastCases_castSucc, huj] + exact hvP + have hle := Finset.min'_le candidates u.castSucc huMem + change j ≤ u.castSucc at hle + have := Fin.le_iff_val_le_val.mp hle + dsimp [u] at this + omega + +theorem InterchangePEClosureConstituent {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (base : HierarchyBase ett generating) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : CombinedStableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + generating sigma) + (alpha beta : Fin k) : + alpha ∈ TreeMissingColors sigma base.closure → + TreeInterchangeable G base.closure sigma alpha beta := by + classical + intro hmissing + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + exact @helper_segmentTrans_553 (@V) (@E) (@G) (@e0) (@A) (@B) (@C) (@hAB) (@hBC) + have commonPrefix {A B C : TreeSequence G e0} + (hAC : TreeSequenceInitialSegment A C) + (hBC : TreeSequenceInitialSegment B C) (hlen : A.length ≤ B.length) : + TreeSequenceInitialSegment A B := by + exact @helper_commonPrefix_563 (@V) (@E) (@G) (@e0) (@A) (@B) (@C) (@hAC) (@hBC) (@hlen) + have stepSegment (i : Fin (ett.rounds + 1)) : + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) + (ett.series.data.tree i.succ) := by + exact @helper_stepSegment_573 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@i) + have stageSegment (a b : ℕ) (hab : a ≤ b) (hb : b ≤ ett.rounds + 1) : + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) + (ett.series.data.tree ⟨b, by omega⟩) := by + exact @helper_stageSegment_584 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@base) (@segmentTrans) + (@stepSegment) (@a) (@b) (@hab) (@hb) + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let B := TreeSequencePrefix Tn base.supportPosition.val + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt) + let v := Tn.vertex base.supportPosition + have hBTn : TreeSequenceInitialSegment B Tn := + ⟨Nat.le_of_lt_succ base.supportPosition.isLt, + (fun _ => rfl), (fun _ => rfl)⟩ + have hTnT : TreeSequenceInitialSegment Tn T := ett.abovePenultimate + have hBT := segmentTrans hBTn hTnT + have hvTn : v ∈ TreeSequenceVertexSet Tn := by + simp [v, TreeSequenceVertexSet] + have hvT : v ∈ TreeSequenceVertexSet T := + TreeSequenceInitialSegmentVertexSetSubset hTnT hvTn + have hvB : B.vertex (Fin.last B.length) = v := by + dsimp [B, TreeSequencePrefix, v] + congr 1 + have hchosen : ett.series.data.chosenVertex n = some v := + (base.parallel hPE).1 + obtain ⟨hproperGen, honeGen, _⟩ := P2634_T1_PETerminalFacts ett hPE + have hclosure : TashkinovClosure sigma B base.closure := + (CombinedStableClosurePreserved G k e0 input T generating generating sigma + ett hpositive base ett.generatingColoring hPE hproperGen honeGen + hproper hone hstable).2.2 + -- The zero-based index j corresponds to first appearance in stage j + 1. + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hcandidates : candidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [ExtendedTashkinovLadderStage, Fin.lastCases_last] + exact hvT + let j := candidates.min' hcandidates + have hfirst : ETTFirstAppearanceIndex ett v hvT = j.val + 1 := by + exact @helper_hfirst_628 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@base) (@hvT) (@hcandidates) + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hq : q.succ = n := by + apply Fin.ext + dsimp [q, n] + omega + have hjbound : j.val + 1 ≤ ett.rounds := by + exact @helper_hjbound_645 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@hPE) (@base) (@hvT) + (@hchosen) (@hcandidates) (@hfirst) (@hq) + let p : Fin ett.rounds := ⟨j.val, by omega⟩ + have hpj : p.castSucc = j := by apply Fin.ext; rfl + let A := ett.series.data.tree j.succ + let P := ett.series.data.tree j.castSucc + have hvA : v ∈ TreeSequenceVertexSet A := by + exact @helper_hvA_656 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@base) (@hvT) (@hcandidates) + (@hjbound) (@hpj) + have hATn : TreeSequenceInitialSegment A Tn := + stageSegment (j.val + 1) ett.rounds hjbound (by omega) + have hPA : TreeSequenceInitialSegment P A := stepSegment j + have hBA : TreeSequenceInitialSegment B A := by + obtain ⟨iv, hiv⟩ := (show ∃ iv, A.vertex iv = v from by + simpa [TreeSequenceVertexSet] using hvA) + have hivEq : Fin.castLE (Nat.succ_le_succ hATn.1) iv = + base.supportPosition := + Tn.vertex_injective ((hATn.2.1 iv).trans hiv) + have hlen : B.length ≤ A.length := by + have := congrArg Fin.val hivEq + dsimp [B, TreeSequencePrefix] at ⊢ + simp only [Fin.val_castLE] at this + omega + exact commonPrefix hBTn hATn hlen + have hbefore := (ExtensionRules G k e0 input T generating ett hMP hpositive + (fun lower hp hlt hmax => hlower lower hp hlt hmax)).1 q v + (by simpa [hq] using hPE) (by simpa [hq] using hchosen) hvT j hfirst + sigma hproper hone (by simpa only [hq, n, ← ett.generatingColoring] using hstable.1) + have hvNotP (hj : 0 < j.val) : v ∉ TreeSequenceVertexSet P := by + exact @helper_hvNotP_682 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@base) (@hvT) + (@hcandidates) (@hjbound) (@hpj) (@hj) + have hPBstrict (hj : 0 < j.val) : P.length < B.length := by + by_contra hnot + have hBP := commonPrefix hBA hPA (by omega) + apply hvNotP hj + apply TreeSequenceInitialSegmentVertexSetSubset hBP + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last B.length, hvB⟩ + have vertexBefore {X : TreeSequence G e0} + (hXB : TreeSequenceInitialSegment X B) (hlen : X.length < B.length) + {x : V} (hx : x ∈ TreeSequenceVertexSet X) : + x ∈ TreeVerticesBefore T v hvT := by + obtain ⟨ix, hix⟩ := (show ∃ ix, X.vertex ix = x from by + simpa [TreeSequenceVertexSet] using hx) + have hXT := segmentTrans hXB hBT + refine Finset.mem_filter.mpr + ⟨TreeSequenceInitialSegmentVertexSetSubset hXT hx, ?_⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hXT.1) ix, + Fin.castLE (Nat.succ_le_succ hBT.1) (Fin.last B.length), + (hXT.2.1 ix).trans hix, (hBT.2.1 _).trans hvB, ?_⟩ + simp only [Fin.val_castLE, Fin.val_last] + omega + -- This transports the step adjoining the support as well as all earlier steps. + have transportRoute (S : TreeSequence G e0) + (hSA : TashkinovAugmentationSequence (ett.series.data.coloring j) S A) + (hSB : TreeSequenceInitialSegment S B) : + TashkinovAugmentationSequence sigma S B := by + exact @helper_transportRoute_255 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T generating sigma ett hpositive base segmentTrans hvT hcandidates hjbound + hBA hbefore vertexBefore S hSA hSB + have seedData (t : Fin (ett.rounds + 1)) : + ∃ S : TreeSequence G e0, + TashkinovAugmentationSequence (ett.series.data.coloring t) S + (ett.series.data.tree t.succ) ∧ + ((t.val = 0 ∧ S = ett.series.data.tree 0 ∧ S.length = 1) ∨ + (ett.series.data.kind t = some TashkinovExtensionKind.PE ∧ + S = ett.series.data.tree t.castSucc) ∨ + ((ett.series.data.kind t = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind t = some TashkinovExtensionKind.RE) ∧ + ∃ f : E, ett.series.data.connectingEdges t = {f} ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree t.castSucc) f S)) := by + exact @helper_seedData_592 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett t + obtain ⟨S, hSA, hseed⟩ := seedData j + have hSlen : S.length ≤ B.length := by + exact @helper_hSlen_631 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating ett hpositive base hvT hcandidates hjbound hpj hPBstrict S hseed + have hSB : TreeSequenceInitialSegment S B := + commonPrefix (TashkinovAugmentationSequenceInitialSegment _ _ _ hSA) hBA hSlen + have hSR : TashkinovAugmentationSequence sigma S base.closure := + (transportRoute S hSA hSB).trans hclosure.1 + have hBR := TashkinovAugmentationSequenceInitialSegment _ _ _ hclosure.1 + by_cases hj : 0 < j.val + · exact @helper_branch_368 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett hMP hpositive hlower base hproper hone alpha beta hmissing + segmentTrans commonPrefix hvT hcandidates hjbound hpj hPA hBA hbefore hPBstrict S hseed hSR + hBR hj + · exact @helper_branch_455 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett hpositive base hproper hone alpha beta hmissing hvT hclosure + hcandidates hjbound hpj S hseed hSR hj +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/InterchangePECommonMissingClosed.lean b/LeanPool/GoldbergSeymour/InterchangePECommonMissingClosed.lean new file mode 100644 index 0000000000..83dea96992 --- /dev/null +++ b/LeanPool/GoldbergSeymour/InterchangePECommonMissingClosed.lean @@ -0,0 +1,297 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved + +public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed + +/-! +# Interchange PECommon Missing Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem InterchangePECommonMissingClosed_hproperGen_91.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), 0 < ett.rounds → ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE → let _ := Fin.last ett.rounds; generating = + ett.series.data.coloring (Fin.last ett.rounds) → IsProperEdgeColoring G generating := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive hPE n hgen + have hstep := ett.series.certified n + generalize targetEq : n = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hn : n ≠ 0 := by simp [n]; omega + exact (hn targetEq).elim + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i.succ = n := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + simpa [hgen, n, hi] using currentProper + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hlast : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by simpa [n] using hPE + rw [targetEq, currentKind] at hlast + contradiction + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hlast : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by simpa [n] using hPE + rw [targetEq, currentKind] at hlast + contradiction + +private theorem InterchangePECommonMissingClosed_honeGen_131.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), 0 < ett.rounds → ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE → let _ := Fin.last ett.rounds; generating = + ett.series.data.coloring (Fin.last ett.rounds) → IsOneEdgeUncolored generating e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive hPE n hgen + have hstep := ett.series.certified n + generalize targetEq : n = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hn : n ≠ 0 := by simp [n]; omega + exact (hn targetEq).elim + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i.succ = n := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + simpa [hgen, n, hi] using currentOneUncolored + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hlast : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by simpa [n] using hPE + rw [targetEq, currentKind] at hlast + contradiction + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hlast : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by simpa [n] using hPE + rw [targetEq, currentKind] at hlast + contradiction + +theorem InterchangePECommonMissingClosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (base : HierarchyBase ett generating) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : CombinedStableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + generating sigma) + (color : Fin k) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + color ∈ TreeMissingColors sigma Tn → + color ∈ TreeMissingColors sigma base.closure → + TreeColorSetClosed G sigma base.core {color} := by + classical + dsimp + intro hcolorT hcolorR + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + have hgen : generating = ett.series.data.coloring (Fin.last ett.rounds) := + ett.generatingColoring + have hstableTree : StableColoring Tn + (TashkinovStoredColors ett.series.data n) generating sigma := by + simpa [Tn, n] using hstable.1 + have hproperGen : IsProperEdgeColoring G generating := by + exact @InterchangePECommonMissingClosed_hproperGen_91 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett hpositive hPE hgen + have honeGen : IsOneEdgeUncolored generating e0 := by + exact @InterchangePECommonMissingClosed_honeGen_131 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett hpositive hPE hgen + have hlowerElem : ColoredVertexSetElementary G + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) + (TreeSequenceVertexSet Tn) := by + by_cases honeRound : ett.rounds = 1 + · have htech := TechnicalTheoremBase G k ett.rounds e0 input ett.series + have hn : n = (⟨1, by omega⟩ : Fin (ett.rounds + 1)) := by + apply Fin.ext + simp [n, honeRound] + have hTn : Tn = ett.series.data.tree ⟨1, by omega⟩ := by + apply congrArg (fun i : Fin (ett.rounds + 2) => ett.series.data.tree i) + apply Fin.ext + simp [n, honeRound] + have hcol : (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) = 0 := by + apply Fin.ext + simp [honeRound] + rw [hTn, hcol] + exact htech.1 + · have hgt : 1 < ett.rounds := by omega + obtain ⟨pred, hpredRound, hpredMP, htrees, hdata⟩ := + CertifiedETTPredecessor G k e0 input T generating ett hMP hgt + have hpredElem := hlower pred (by omega) (by omega) hpredMP + have htree : ColoredVertexSetElementary G + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) + (TreeSequenceVertexSet + (ett.series.data.tree ⟨ett.rounds, by omega⟩)) := hpredElem.1 + have hidx : (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + rfl + rw [hidx] at htree + exact htree + have hcommon := ParallelCommonMissingClosed G k e0 input T generating + generating ett hpositive base hgen hPE hlowerElem + have hgenCommon : color ∈ TreeMissingColors generating Tn := by + have hs := hstable.1.2 + unfold TreeMissingColors at * + rcases Finset.mem_biUnion.mp (show color ∈ + TreeMissingColors sigma Tn from hcolorT) with ⟨v, hv, hc⟩ + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [← hs v hv] + exact hc + have hgenClosure : color ∈ TreeMissingColors generating base.closure := by + have hs := hstable.2.2 + unfold TreeMissingColors at * + rcases Finset.mem_biUnion.mp (show color ∈ + TreeMissingColors sigma base.closure from hcolorR) with ⟨v, hv, hc⟩ + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [← hs v hv] + exact hc + have hstableRevTree : StableColoring Tn + (TashkinovStoredColors ett.series.data n) sigma generating := by + let a : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨generating, hproperGen, honeGen⟩ + let b : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨sigma, hproper, hone⟩ + have hab : StableColoring Tn + (TashkinovStoredColors ett.series.data n) a.1 b.1 := by + simpa [a, b] using hstableTree + have hba := (sc2 G e0 Tn + (TashkinovStoredColors ett.series.data n)).symm hab + simpa [a, b] using hba + have hstableRevClosure : StableColoring base.closure ∅ sigma generating := by + let a : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨generating, hproperGen, honeGen⟩ + let b : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨sigma, hproper, hone⟩ + have hab : StableColoring base.closure ∅ a.1 b.1 := by + simpa [a, b] using hstable.2 + have hba := (sc2 G e0 base.closure ∅).symm hab + simpa [a, b] using hba + obtain ⟨orderedUnion⟩ := (base.parallel hPE).2.2 + have coreVertices : TreeSequenceVertexSet base.core = + TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet base.closure := by + rw [← orderedUnion.vertexSet] + unfold TreeColorSetClosed + intro c hc + have hcEq : c = color := by simpa using hc + subst c + apply Finset.eq_empty_iff_forall_notMem.mpr + intro g hg + have hgParts : g ∈ BoundaryEdges G (TreeSequenceVertexSet base.core) ∧ + sigma g = some color := by + simpa [BoundaryColorEdges] using hg + obtain ⟨hb, hcolorSigma⟩ := hgParts + have hbParts : ∃ p ∈ TreeSequenceVertexSet base.core, ∃ r ∉ + TreeSequenceVertexSet base.core, G.ends g = s(p, r) := by + simpa [BoundaryEdges] using hb + obtain ⟨p, hp, r, hr, hends⟩ := hbParts + have hxCore : TreeSequenceVertexSet Tn ⊆ + TreeSequenceVertexSet base.core := by + rw [coreVertices] + exact Finset.subset_union_left + have hyCore : TreeSequenceVertexSet base.closure ⊆ + TreeSequenceVertexSet base.core := by + rw [coreVertices] + exact Finset.subset_union_right + have incidentAt : Incident G p g := by + change p ∈ G.ends g + rw [hends] + exact Sym2.mem_mk_left _ _ + have hgenBoundary : g ∈ BoundaryColorEdges G generating + (TreeSequenceVertexSet base.core) color := by + have hbgen : g ∈ BoundaryEdges G (TreeSequenceVertexSet base.core) := hb + have hcoreColor : generating g = some color := by + by_cases hpX : p ∈ TreeSequenceVertexSet Tn + · have hinc : TreeIncidentEdge Tn g := ⟨p, hpX, incidentAt⟩ + have hmiss : color ∈ TreeMissingColors sigma Tn := by + simpa [Tn, n] using hcolorT + have heq := hstableRevTree.1 g hinc + ⟨color, Finset.mem_union_left _ hmiss, hcolorSigma⟩ + exact heq.trans hcolorSigma + · have hpY : p ∈ TreeSequenceVertexSet base.closure := by + have hu : p ∈ TreeSequenceVertexSet Tn ∪ + TreeSequenceVertexSet base.closure := by + rw [← coreVertices] + exact hp + exact (Finset.mem_union.mp hu).resolve_left hpX + have hinc : TreeIncidentEdge base.closure g := + ⟨p, hpY, incidentAt⟩ + have hmiss : color ∈ TreeMissingColors sigma base.closure := hcolorR + have heq := hstableRevClosure.1 g hinc + ⟨color, Finset.mem_union_left _ hmiss, hcolorSigma⟩ + exact heq.trans hcolorSigma + simp [BoundaryColorEdges, hbgen, hcoreColor] + have hgenEmpty := hcommon color + (Finset.mem_inter.mpr ⟨hgenCommon, hgenClosure⟩) + rw [hgenEmpty] at hgenBoundary + simp at hgenBoundary + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/InterchangePEMixedCore.lean b/LeanPool/GoldbergSeymour/InterchangePEMixedCore.lean new file mode 100644 index 0000000000..20cbb6405f --- /dev/null +++ b/LeanPool/GoldbergSeymour/InterchangePEMixedCore.lean @@ -0,0 +1,206 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.InterchangePETreeConstituent + +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable + +public import LeanPool.GoldbergSeymour.CopyAugmentationPrefix +public import LeanPool.GoldbergSeymour.OppositeRootComponents + +/-! +# Interchange PEMixed Core + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem InterchangePEMixedCore {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (base : HierarchyBase ett generating) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : CombinedStableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + generating sigma) + (alpha beta : Fin k) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + alpha ∈ TreeMissingColors sigma Tn → + beta ∈ TreeMissingColors sigma base.closure → + TreeInterchangeable G base.core sigma alpha beta := by + classical + dsimp + intro halpha hbeta + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let S := TreeSequencePrefix Tn base.supportPosition.val + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt) + have hSTn : TreeSequenceInitialSegment S Tn := + ⟨Nat.le_of_lt_succ base.supportPosition.isLt, + (fun _ => rfl), (fun _ => rfl)⟩ + obtain ⟨hchosen, _, ⟨ord⟩⟩ := base.parallel hPE + obtain ⟨hproperGen, honeGen, _⟩ := P2634_T1_PETerminalFacts ett hPE + have hpreserved := CombinedStableClosurePreserved G k e0 input T + generating generating sigma ett hpositive base ett.generatingColoring hPE + hproperGen honeGen hproper hone hstable + have hclosure : TashkinovClosure sigma S base.closure := hpreserved.2.2 + let baseSigma : HierarchyBase ett sigma := { + core := base.core + closure := base.closure + supportPosition := base.supportPosition + supportPositive := base.supportPositive + terminalMissingColors := by + dsimp + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by rw [← hstable.1.2 v hv]; exact hc⟩ + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by rw [hstable.1.2 v hv]; exact hc⟩ + parallel := fun hp => ⟨(base.parallel hp).1, + hclosure, (base.parallel hp).2.2⟩ + nonparallel := base.nonparallel } + have helem : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet base.core) := + ParallelClosureUnionElementary G k e0 input T generating ett hMP + hpositive hlower hPE sigma hproper hone hstable.1 baseSigma + have hX : TreeInterchangeable G Tn sigma alpha beta := + InterchangePETreeConstituent G k e0 input T generating sigma ett hMP + hpositive hlower hPE base hproper hone hstable alpha beta halpha + have hgraph : TwoColorIncidenceGraph G sigma beta alpha = + TwoColorIncidenceGraph G sigma alpha beta := by + ext a b + cases a <;> cases b <;> simp [TwoColorIncidenceGraph, or_comm] + have hY : TreeInterchangeable G base.closure sigma alpha beta := by + have hcomp : ∀ z, TwoColorComponent G sigma beta alpha z = + TwoColorComponent G sigma alpha beta z := by + intro z + unfold TwoColorComponent + rw [hgraph] + have hrev := InterchangePEClosureConstituent G k e0 input T + generating sigma ett hMP hpositive hlower hPE base hproper hone + hstable beta alpha hbeta + simpa only [TreeInterchangeable, TwoColorPathComponent, + hcomp, hgraph, ne_comm] using hrev + by_contra hnot + obtain ⟨u, hu, hua⟩ := Finset.mem_biUnion.mp halpha + obtain ⟨v, hv, hvb⟩ := Finset.mem_biUnion.mp hbeta + obtain ⟨hab, huR, hvTn, avoidTn, _⟩ := + P2668_T2_OppositeRootComponents sigma alpha beta Tn base.closure + base.core ⟨ord⟩ hproper hX hY u v hu hv hua hvb hnot + let psi := TwoColorComponentSwap G sigma alpha beta (Sum.inl v) + have hrecolor : OutsideKempeRecoloring Tn sigma psi alpha beta := by + refine ⟨hab, {Sum.inl v}, ?_, ?_⟩ + · intro z hz x hxc hx + have hzv : z = Sum.inl v := Finset.mem_singleton.mp hz + subst z + exact avoidTn x hx hxc + · intro f + simp [psi, TwoColorComponentSwap] + obtain ⟨hproperPsi, honePsi, hchange, _, _⟩ := + OutsideKempeRecoloringStable G e0 Tn + (TashkinovStoredColors ett.series.data n) + sigma psi alpha beta hproper hone hrecolor + have hterminal : StableColoring Tn + (TashkinovStoredColors ett.series.data n) generating psi := by + let a : {chi : PartialEdgeColoring E k // + IsProperEdgeColoring G chi ∧ IsOneEdgeUncolored chi e0} := + ⟨generating, hproperGen, honeGen⟩ + let b : {chi : PartialEdgeColoring E k // + IsProperEdgeColoring G chi ∧ IsOneEdgeUncolored chi e0} := + ⟨sigma, hproper, hone⟩ + let c : {chi : PartialEdgeColoring E k // + IsProperEdgeColoring G chi ∧ IsOneEdgeUncolored chi e0} := + ⟨psi, hproperPsi, honePsi⟩ + have hab' : StableColoring Tn + (TashkinovStoredColors ett.series.data n) a.1 b.1 := hstable.1 + have hbc' : StableColoring Tn + (TashkinovStoredColors ett.series.data n) b.1 c.1 := hchange + exact (sc2 G e0 Tn (TashkinovStoredColors ett.series.data n)).trans + (x := a) (y := b) (z := c) hab' hbc' + have huCore : u ∈ TreeSequenceVertexSet base.core := by + rw [ord.vertexSet] + exact Finset.mem_union_left _ hu + have hRCore : TreeSequenceVertexSet base.closure ⊆ + TreeSequenceVertexSet base.core := by + intro x hx + rw [ord.vertexSet] + exact Finset.mem_union_right _ hx + have hvS : v ∉ TreeSequenceVertexSet S := by + intro h + exact hvTn (TreeSequenceInitialSegmentVertexSetSubset hSTn h) + obtain ⟨B, _, hlast, hcopied⟩ := + P2668_T2_CopyAugmentationPrefix sigma alpha beta hab hproper + (Sum.inl v) S base.closure (TreeSequenceVertexSet base.core) + helem hRCore u v huCore huR hv hvS hua hvb hclosure.1 + obtain ⟨R', hR'⟩ := TashkinovClosureExists psi B + have hnewClosure : TashkinovClosure psi S R' := + ⟨hcopied.trans hR'.1, hR'.2⟩ + obtain ⟨U', hU'⟩ := OrderedTreeUnionExists Tn R' + let newBase : HierarchyBase ett psi := { + core := U' + closure := R' + supportPosition := base.supportPosition + supportPositive := base.supportPositive + terminalMissingColors := by + dsimp + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨x, hx, hc⟩ + exact ⟨x, hx, by rw [← hterminal.2 x hx]; exact hc⟩ + · rintro ⟨x, hx, hc⟩ + exact ⟨x, hx, by rw [hterminal.2 x hx]; exact hc⟩ + parallel := fun hp => ⟨(base.parallel hp).1, hnewClosure, hU'⟩ + nonparallel := by dsimp only; intro hn; exact (hn hPE).elim } + have hnewElementary : ColoredVertexSetElementary G psi + (TreeSequenceVertexSet U') := + ParallelClosureUnionElementary G k e0 input T generating ett hMP + hpositive hlower hPE psi hproperPsi honePsi hterminal newBase + obtain ⟨newOrd⟩ := hU' + have hvB : v ∈ TreeSequenceVertexSet B := by + rw [← hlast] + simp [TreeSequenceVertexSet] + have hvR' : v ∈ TreeSequenceVertexSet R' := + TreeSequenceInitialSegmentVertexSetSubset + (TashkinovAugmentationSequenceInitialSegment psi B R' hR'.1) hvB + have huU' : u ∈ TreeSequenceVertexSet U' := by + rw [newOrd.vertexSet] + exact Finset.mem_union_left _ hu + have hvU' : v ∈ TreeSequenceVertexSet U' := by + rw [newOrd.vertexSet] + exact Finset.mem_union_right _ hvR' + have huv : u ≠ v := by intro h; exact hvTn (h ▸ hu) + have huaPsi : alpha ∈ MissingColors G psi u := by + rw [hchange.2 u hu] + exact hua + have selfv : Sum.inl v ∈ TwoColorComponent G sigma alpha beta (Sum.inl v) := + SimpleGraph.ConnectedComponent.eq.mpr (SimpleGraph.Reachable.refl _) + have hvaPsi : alpha ∈ MissingColors G psi v := + (TwoColorComponentSwapMissingBehavior G sigma alpha beta hab hproper + (Sum.inl v)).2.2.1 v selfv hvb + exact (Finset.disjoint_left.mp (hnewElementary huU' hvU' huv)) huaPsi hvaPsi + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/InterchangePETreeAwayFromDelta.lean b/LeanPool/GoldbergSeymour/InterchangePETreeAwayFromDelta.lean new file mode 100644 index 0000000000..64f152620c --- /dev/null +++ b/LeanPool/GoldbergSeymour/InterchangePETreeAwayFromDelta.lean @@ -0,0 +1,1464 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.ElementarySingleBoundaryInterchangeable +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtensionBase +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable +public import LeanPool.GoldbergSeymour.PartialEdgeColoring +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Interchange PETree Away From Delta + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hproperGen_107.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : (0 : ℕ) < ett.rounds) (_ : ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.PE) (_ : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ (_ : generating = ett.series.data.coloring n), IsProperEdgeColoring G generating := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive hPE gamma n hgen + have hstep := ett.series.certified n + generalize targetEq : n = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hn : n ≠ 0 := by simp [n]; omega + exact (hn targetEq).elim + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i.succ = n := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + simpa [hgen, hi] using currentProper + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hp : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by simpa [n] using hPE + rw [targetEq, currentKind] at hp + contradiction + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hp : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by simpa [n] using hPE + rw [targetEq, currentKind] at hp + contradiction + +private theorem helper_honeGen_147.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : (0 : ℕ) < ett.rounds) (_ : ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.PE) (_ : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ (_ : generating = ett.series.data.coloring n), IsOneEdgeUncolored generating e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive hPE gamma n hgen + have hstep := ett.series.certified n + generalize targetEq : n = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hn : n ≠ 0 := by simp [n]; omega + exact (hn targetEq).elim + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i.succ = n := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + simpa [hgen, hi] using currentOneUncolored + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hp : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by simpa [n] using hPE + rw [targetEq, currentKind] at hp + contradiction + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hp : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by simpa [n] using hPE + rw [targetEq, currentKind] at hp + contradiction + +private theorem helper_hlowerElem_240.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : Fin ett.rounds), ColoredVertexSetElementary G (ett.series.data.coloring (⟨ett.rounds - + (1 : ℕ), Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) + ↦ + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower n Tn i + by_cases honeRound : ett.rounds = 1 + · have htech := TechnicalTheoremBase G k ett.rounds e0 input ett.series + have hT : Tn = ett.series.data.tree ⟨1, by omega⟩ := by + apply congrArg (fun j : Fin (ett.rounds + 2) => ett.series.data.tree j) + apply Fin.ext + simp [n, honeRound] + have hc : (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) = 0 := by + apply Fin.ext + simp [honeRound] + rw [hT, hc] + exact htech.1 + · have hgt : 1 < ett.rounds := by omega + obtain ⟨pred, hpredRound, hpredMP, htrees, hdata⟩ := + CertifiedETTPredecessor G k e0 input T generating ett hMP hgt + have hpredElem := hlower pred (by omega) (by omega) hpredMP + have hp : ColoredVertexSetElementary G + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) + (TreeSequenceVertexSet + (ett.series.data.tree ⟨ett.rounds, by omega⟩)) := hpredElem.1 + have heq : (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + rfl + rw [heq] at hp + exact hp + +private theorem helper_hsigmaEmpty_384.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + ∀ alpha ∈ TreeMissingColors sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + StableColoring Tn (TashkinovStoredColors ett.series.data n) sigma generating → + BoundaryColorEdges G generating (TreeSequenceVertexSet Tn) alpha = ∅ → + BoundaryColorEdges G sigma (TreeSequenceVertexSet Tn) alpha = ∅ := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett alpha halpha n Tn hstableRev hgenEmpty + apply Finset.eq_empty_iff_forall_notMem.mpr + intro g hg + have hg' : g ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) ∧ + sigma g = some alpha := by + simpa [BoundaryColorEdges] using hg + have hinc : TreeIncidentEdge Tn g := by + unfold TreeIncidentEdge + obtain ⟨u, hu, v, hv, he⟩ := by + simpa [BoundaryEdges] using hg'.1 + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends g + rw [he] + simp + have hctrl : ∃ c ∈ TreeMissingColors sigma Tn ∪ + TashkinovStoredColors ett.series.data n, sigma g = some c := + ⟨alpha, Finset.mem_union_left _ halpha, hg'.2⟩ + have heq : generating g = sigma g := hstableRev.1 g hinc hctrl + have : g ∈ BoundaryColorEdges G generating (TreeSequenceVertexSet Tn) alpha := by + simp [BoundaryColorEdges, hg'.1, heq, hg'.2] + rw [hgenEmpty] at this + simp at this + +private theorem helper_hgammaSingleton_407.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : generating = ett.series.data.coloring n) (_ : StableColoring Tn (TashkinovStoredColors + ett.series.data n) generating sigma) (i : Fin ett.rounds) (choice : MaximumDefectiveChoice + G e0 (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors ett.series.data + i.castSucc) (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k) (_ : i.succ = + n) (_ : BoundaryColorEdges G (ett.series.data.coloring i.succ) (TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc)) terminalGamma = { choice.edge } ∧ ( + ∀ g ∈ BoundaryColorEdges G (ett.series.data.coloring i.succ) (TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc)) choice.color, + ∃ (w : V), TreeVertexOrder (ett.series.data.tree i.succ.castSucc) w choice.vertex ∧ Incident G + w g) ∧ (ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (ett.series.data.coloring i.succ) (ett.series.data.tree + i.succ.castSucc), alpha ≠ choice.color → BoundaryColorEdges G (ett.series.data.coloring + i.succ) (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) alpha = ∅)) (_ : + ett.series.data.coloring n choice.edge = some terminalGamma) (_ : terminalGamma ∈ + TashkinovStoredColors ett.series.data n) (_ : StableColoring Tn (TashkinovStoredColors + ett.series.data n) sigma generating), BoundaryColorEdges G sigma (TreeSequenceVertexSet + Tn) terminalGamma = { choice.edge } := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett n Tn hgen hstableTree i choice + terminalGamma hi hbound hcurrentEdge hgammaStored hstableRev + apply Finset.Subset.antisymm + · intro g hg + have hg' : g ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) ∧ + sigma g = some terminalGamma := by + simpa [BoundaryColorEdges] using hg + have hinc : TreeIncidentEdge Tn g := by + unfold TreeIncidentEdge + obtain ⟨u, hu, v, hv, he⟩ := by + simpa [BoundaryEdges] using hg'.1 + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends g + rw [he] + simp + have hctrl : ∃ c ∈ TreeMissingColors sigma Tn ∪ + TashkinovStoredColors ett.series.data n, sigma g = some c := + ⟨terminalGamma, Finset.mem_union_right _ hgammaStored, hg'.2⟩ + have heq : generating g = sigma g := hstableRev.1 g hinc hctrl + have : g ∈ BoundaryColorEdges G generating (TreeSequenceVertexSet Tn) + terminalGamma := by + simp [BoundaryColorEdges, hg'.1, heq, hg'.2] + have ht : g ∈ BoundaryColorEdges G + (ett.series.data.coloring i.succ) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) terminalGamma := by + simpa [hgen, Tn, hi] using this + rw [hbound.1] at ht + simpa using ht + · intro g hg + have : g = choice.edge := by simpa using hg + subst g + have hce : generating choice.edge = some terminalGamma := by + simpa [hgen, Tn, hi] using hcurrentEdge + have hb : choice.edge ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) := by + obtain ⟨c, hc, hm⟩ := choice.edgeDefective + have hm' := hm + simp only [BoundaryColorEdges, Finset.mem_filter] at hm' + simpa [Tn, hi] using hm'.1 + have hinc : TreeIncidentEdge Tn choice.edge := by + unfold TreeIncidentEdge + obtain ⟨u, hu, v, hv, he⟩ := by simpa [BoundaryEdges] using hb + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends choice.edge + rw [he] + simp + have hs : sigma choice.edge = generating choice.edge := + hstableTree.1 choice.edge hinc + ⟨terminalGamma, Finset.mem_union_right _ hgammaStored, hce⟩ + have hcs : sigma choice.edge = some terminalGamma := hs.trans hce + simp [BoundaryColorEdges, hb, hcs] + +private theorem helper_undoneOne_411.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : IsOneEdgeUncolored sigma e0) (i : + Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k) (_ : terminalGamma ≠ + choice.color), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); IsOneEdgeUncolored undone e0 := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett hone i choice terminalGamma hnegc undone + dsimp [undone] + unfold IsOneEdgeUncolored + have hone' := hone + unfold IsOneEdgeUncolored at hone' + constructor + · simp [TwoColorComponentSwap, hone'.1] + · intro e he + obtain ⟨c, hc⟩ := hone'.2 e he + by_cases hem : Sum.inr e ∈ + TwoColorComponent G sigma terminalGamma choice.color + (Sum.inl choice.vertex) + · by_cases hcg : c = terminalGamma + · exact ⟨choice.color, by simp [TwoColorComponentSwap, hem, hc, hcg]⟩ + · by_cases hcd : c = choice.color + · exact ⟨terminalGamma, by simp [TwoColorComponentSwap, hem, hc, hcd, + hnegc.symm]⟩ + · exact ⟨c, by simp [TwoColorComponentSwap, hem, hc, hcg, hcd]⟩ + · exact ⟨c, by simp [TwoColorComponentSwap, hem, hc]⟩ + +private theorem helper_hreach_473.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (alpha beta : Fin k) (i : Fin ett.rounds) + (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)) + (terminalGamma : Fin k), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); + ∀ (_ : ( + ∀ (x y : V ⊕ E), (TwoColorIncidenceGraph G undone alpha beta).Adj x y ↔ + (TwoColorIncidenceGraph G sigma alpha beta).Adj x y)) {x y : V ⊕ E}, + (TwoColorIncidenceGraph G undone alpha beta).Reachable x y ↔ (TwoColorIncidenceGraph G + sigma alpha beta).Reachable x y := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett alpha beta i choice terminalGamma undone + hadj x y + constructor <;> intro hp + · rcases hp with ⟨p⟩ + refine ⟨?_⟩ + induction p with + | nil => exact .nil + | cons ha p ih => exact .cons ((hadj _ _).mp ha) ih + · rcases hp with ⟨p⟩ + refine ⟨?_⟩ + induction p with + | nil => exact .nil + | cons ha p ih => exact .cons ((hadj _ _).mpr ha) ih + +private theorem helper_htransport_500.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); + ∀ (_ : ( + ∀ (x y : V ⊕ E), (TwoColorIncidenceGraph G undone alpha beta).Adj x y ↔ + (TwoColorIncidenceGraph G sigma alpha beta).Adj x y)) (_ : ( + ∀ (z : V ⊕ E), TwoColorComponent G undone alpha beta z = TwoColorComponent G sigma alpha beta + z)) (_ : TreeInterchangeable G Tn undone alpha beta), TreeInterchangeable G Tn sigma alpha + beta := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett alpha beta n Tn i choice terminalGamma + undone hadj hcomponentEq hinter + unfold TreeInterchangeable at hinter ⊢ + intro z w hz hw hzX hwX + rw [← hcomponentEq z, ← hcomponentEq w] + apply hinter z w + · rcases hz with ⟨hn, x, hx, hs⟩ + refine ⟨hn, x, ?_, ?_⟩ + · rw [← hcomponentEq z] at hx + exact hx + · intro y hy z hz + apply hs + · exact (hadj x y).mp hy + · exact (hadj x z).mp hz + · rcases hw with ⟨hn, x, hx, hs⟩ + refine ⟨hn, x, ?_, ?_⟩ + · rw [← hcomponentEq w] at hx + exact hx + · intro y hy z hz + apply hs + · exact (hadj x y).mp hy + · exact (hadj x z).mp hz + · rcases hzX with ⟨v, hv, hx⟩ + exact ⟨v, hv, by rw [hcomponentEq z]; exact hx⟩ + · rcases hwX with ⟨v, hv, hx⟩ + exact ⟨v, hv, by rw [hcomponentEq w]; exact hx⟩ + +private theorem helper_branch_528.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : (0 : ℕ) < ett.rounds) (alpha beta : + Fin k) (_ : alpha ∈ TreeMissingColors sigma (ett.series.data.tree (Fin.last + ett.rounds).castSucc)), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k) (_ : i.succ = n) (_ : + StableColoring (ett.series.data.tree i.castSucc.succ) (TashkinovStoredColors + ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc) (TwoColorComponentSwap G + sigma terminalGamma choice.color (Sum.inl choice.vertex))), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); + ∀ (_ : IsProperEdgeColoring G undone) (_ : IsOneEdgeUncolored undone e0) (_ : ( + ∀ (e : E), undone e = some alpha ↔ sigma e = some alpha)) (_ : ( + ∀ (_ : TreeInterchangeable G Tn undone alpha beta), TreeInterchangeable G Tn sigma alpha + beta)) (_ : ett.rounds = (1 : ℕ)), TreeInterchangeable G (ett.series.data.tree (Fin.last + ett.rounds).castSucc) sigma alpha beta := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett hpositive alpha beta halpha n Tn i choice + terminalGamma hi stablePreviousUndone undone undoneProper' undoneOne' hswapAlpha htransport + honeRound + have htech := TechnicalTheoremBase G k ett.rounds e0 input ett.series + let undone := TwoColorComponentSwap G sigma terminalGamma choice.color + (Sum.inl choice.vertex) + have hi0 : i = (⟨0, by omega⟩ : Fin ett.rounds) := by + apply Fin.ext + have hv := congrArg Fin.val hi + simp [n, honeRound] at hv ⊢ + omega + have htree0 : ett.series.data.tree (⟨1, by omega⟩ : Fin (ett.rounds + 2)) = Tn := by + apply congrArg ett.series.data.tree + apply Fin.ext + simp [n, honeRound] + have htreeLast : ett.series.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply congrArg ett.series.data.tree + apply Fin.ext + simp [honeRound] + have hstable0 : StableColoring + (ett.series.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors ett.series.data 0) + (ett.series.data.coloring 0) undone := by + have hci : i.castSucc = 0 := by + apply Fin.ext + simp [hi0, honeRound] + have hti : i.castSucc.succ = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp [hi0, honeRound] + convert stablePreviousUndone using 1 <;> simp [hci] + have hmissing0 : alpha ∈ TreeMissingColors undone + (ett.series.data.tree ⟨1, by omega⟩) := by + unfold TreeMissingColors + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp halpha + refine Finset.mem_biUnion.mpr ⟨v, ?_, ?_⟩ + · rw [htreeLast] at hv + exact hv + · have hnot : ∀ x, Incident G v x → ¬undone x = some alpha := by + intro x hx hxa + unfold MissingColors at hmv + have hmv' : ∀ x, Incident G v x → ¬sigma x = some alpha := by + simpa [PresentColors] using (Finset.mem_sdiff.mp hmv).2 + exact hmv' x hx ((hswapAlpha x).mp hxa) + simpa [MissingColors, PresentColors] using hnot + have hres := htech.2 undone undoneProper' undoneOne' hstable0 alpha beta + have htemp := hres (Or.inl hmissing0) + have htemp' : TreeInterchangeable G Tn undone alpha beta := by + rw [← htree0] + exact htemp + simpa [Tn] using (htransport htemp') + +private theorem helper_undoneOne_605.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : IsOneEdgeUncolored sigma e0) (i : + Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k) (_ : terminalGamma ≠ + choice.color), + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma choice.color + (Sum.inl choice.vertex); + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); IsOneEdgeUncolored undone e0 := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett hone i choice terminalGamma hnegc undone + undone + dsimp [undone] + unfold IsOneEdgeUncolored + have hone' := hone + unfold IsOneEdgeUncolored at hone' + constructor + · simp [TwoColorComponentSwap, hone'.1] + · intro e he + obtain ⟨c, hc⟩ := hone'.2 e he + by_cases hem : Sum.inr e ∈ + TwoColorComponent G sigma terminalGamma choice.color + (Sum.inl choice.vertex) + · by_cases hcg : c = terminalGamma + · exact ⟨choice.color, by simp [TwoColorComponentSwap, hem, hc, hcg] + ⟩ + · by_cases hcd : c = choice.color + · exact ⟨terminalGamma, by simp [TwoColorComponentSwap, hem, hc, hcd, + hnegc.symm]⟩ + · exact ⟨c, by simp [TwoColorComponentSwap, hem, hc, hcg, hcd]⟩ + · exact ⟨c, by simp [TwoColorComponentSwap, hem, hc]⟩ + +private theorem helper_hstablePred_651.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k) (_ : i.succ = n) (_ : + StableColoring (ett.series.data.tree i.castSucc.succ) (TashkinovStoredColors + ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc) (TwoColorComponentSwap G + sigma terminalGamma choice.color (Sum.inl choice.vertex))), + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma choice.color + (Sum.inl choice.vertex); + ∀ (hgt : (1 : ℕ) < ett.rounds) (pred : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); + ∀ (_ : pred.series.data.tree (Fin.last (pred.rounds + (1 : ℕ))) = Tn) (_ : + pred.series.data.coloring (Fin.last pred.rounds) = ett.series.data.coloring i.castSucc) (_ + : TashkinovStoredColors pred.series.data (Fin.last pred.rounds) = TashkinovStoredColors + ett.series.data i.castSucc), StableColoring (pred.series.data.tree (Fin.last (pred.rounds + + (1 : ℕ)))) (TashkinovStoredColors pred.series.data (Fin.last pred.rounds)) + (pred.series.data.coloring (Fin.last pred.rounds)) undone := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett n Tn i choice terminalGamma hi + stablePreviousUndone undone hgt pred undone hpredNext hpredColor hpredStored + rw [hpredStored, hpredColor] + have htreeI : i.castSucc.succ = n.castSucc := by + apply Fin.ext + have hv := congrArg Fin.val hi + simp [n] at hv ⊢ + omega + rw [hpredNext] + change StableColoring (ett.series.data.tree n.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc) undone + rw [← htreeI] + simpa [undone] using stablePreviousUndone + +private theorem helper_hreach_710.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (alpha beta : Fin k) (i : Fin ett.rounds) + (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)) + (terminalGamma : Fin k), + let undone_1 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); + ∀ (_ : ( + ∀ (x y : V ⊕ E), (TwoColorIncidenceGraph G undone_1 alpha beta).Adj x y ↔ + (TwoColorIncidenceGraph G sigma alpha beta).Adj x y)), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); + ∀ (_ : ( + ∀ (x y : V ⊕ E), (TwoColorIncidenceGraph G undone alpha beta).Adj x y ↔ + (TwoColorIncidenceGraph G sigma alpha beta).Adj x y)) {x y : V ⊕ E}, + (TwoColorIncidenceGraph G undone alpha beta).Reachable x y ↔ (TwoColorIncidenceGraph G + sigma alpha beta).Reachable x y := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett alpha beta i choice terminalGamma undone + hadj undone hadj x y + constructor <;> intro hp + · rcases hp with ⟨p⟩ + refine ⟨?_⟩ + induction p with + | nil => exact .nil + | cons ha p ih => exact .cons ((hadj _ _).mp ha) ih + · rcases hp with ⟨p⟩ + refine ⟨?_⟩ + induction p with + | nil => exact .nil + | cons ha p ih => exact .cons ((hadj _ _).mpr ha) ih + +private theorem helper_htransport_737.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k), + let undone_1 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); + ∀ (_ : ( + ∀ (x y : V ⊕ E), (TwoColorIncidenceGraph G undone_1 alpha beta).Adj x y ↔ + (TwoColorIncidenceGraph G sigma alpha beta).Adj x y)) (_ : ( + ∀ (z : V ⊕ E), TwoColorComponent G undone_1 alpha beta z = TwoColorComponent G sigma alpha + beta z)), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); + ∀ (_ : ( + ∀ (x y : V ⊕ E), (TwoColorIncidenceGraph G undone alpha beta).Adj x y ↔ + (TwoColorIncidenceGraph G sigma alpha beta).Adj x y)) (_ : ( + ∀ (z : V ⊕ E), TwoColorComponent G undone alpha beta z = TwoColorComponent G sigma alpha beta + z)) (_ : TreeInterchangeable G Tn undone alpha beta), TreeInterchangeable G Tn sigma alpha + beta := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett alpha beta n Tn i choice terminalGamma + undone hadj hcomponentEq undone hadj hcomponentEq hinter + unfold TreeInterchangeable at hinter ⊢ + intro z w hz hw hzX hwX + rw [← hcomponentEq z, ← hcomponentEq w] + apply hinter z w + · rcases hz with ⟨hn, x, hx, hs⟩ + refine ⟨hn, x, ?_, ?_⟩ + · rw [← hcomponentEq z] at hx + exact hx + · intro y hy z hz + apply hs + · exact (hadj x y).mp hy + · exact (hadj x z).mp hz + · rcases hw with ⟨hn, x, hx, hs⟩ + refine ⟨hn, x, ?_, ?_⟩ + · rw [← hcomponentEq w] at hx + exact hx + · intro y hy z hz + apply hs + · exact (hadj x y).mp hy + · exact (hadj x z).mp hz + · rcases hzX with ⟨v, hv, hx⟩ + exact ⟨v, hv, by rw [hcomponentEq z]; exact hx⟩ + · rcases hwX with ⟨v, hv, hx⟩ + exact ⟨v, hv, by rw [hcomponentEq w]; exact hx⟩ + +private theorem helper_branch_576.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (_ : (0 : ℕ) < + ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (delta alpha beta : Fin k) + (_ : ett.series.data.delta (Fin.last ett.rounds) = some delta) (_ : alpha ∈ + TreeMissingColors sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : ¬alpha + = delta) (_ : ¬beta = delta), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k) (_ : i.succ = n) (_ : + ett.series.data.delta n = some choice.color) (_ : terminalGamma ≠ choice.color) (_ : alpha + ≠ terminalGamma) (_ : ¬beta = terminalGamma) (_ : StableColoring (ett.series.data.tree + i.castSucc.succ) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc) (TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex))), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); + ∀ (_ : IsProperEdgeColoring G undone) (_ : IsOneEdgeUncolored undone e0) (_ : alpha ≠ + choice.color) (_ : beta ≠ terminalGamma) (_ : beta ≠ choice.color) (_ : ( + ∀ (e : E), undone e = some alpha ↔ sigma e = some alpha)) (_ : ( + ∀ (e : E), undone e = some beta ↔ sigma e = some beta)) (_ : ( + ∀ (x y : V ⊕ E), (TwoColorIncidenceGraph G undone alpha beta).Adj x y ↔ + (TwoColorIncidenceGraph G sigma alpha beta).Adj x y)) (_ : ( + ∀ {x y : V ⊕ E}, (TwoColorIncidenceGraph G undone alpha beta).Reachable x y ↔ + (TwoColorIncidenceGraph G sigma alpha beta).Reachable x y)) (_ : ( + ∀ (z : V ⊕ E), TwoColorComponent G undone alpha beta z = TwoColorComponent G sigma alpha beta + z)) (_ : ( + ∀ (_ : TreeInterchangeable G Tn undone alpha beta), TreeInterchangeable G Tn sigma alpha + beta)) (_ : ¬ett.rounds = (1 : ℕ)), TreeInterchangeable G (ett.series.data.tree (Fin.last + ett.rounds).castSucc) sigma alpha beta := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hproper hone delta alpha + beta hdelta halpha hne hbeta n Tn i choice terminalGamma hi hdelta' hnegc halphaGamma hbg + stablePreviousUndone undone undoneProper' undoneOne' halphaDelta hbetaGamma hbetaDelta + hswapAlpha hswapBeta hadj hreach hcomponentEq htransport honeRound + have hgt : 1 < ett.rounds := by omega + have hpred := CertifiedETTPredecessor G k e0 input T generating ett hMP hgt + rcases hpred with ⟨pred, predRound, predMP, predTrees, predData⟩ + have hiVal : i.val + 1 = ett.rounds := by + have hv := congrArg Fin.val hi + simp [n] at hv + omega + have low := (hlower pred (by omega) (by omega) predMP).2.1 + let undone := TwoColorComponentSwap G sigma terminalGamma choice.color + (Sum.inl choice.vertex) + have undoneProper' : IsProperEdgeColoring G undone := by + exact TwoColorComponentSwapProper G sigma terminalGamma choice.color + hnegc hproper (Sum.inl choice.vertex) + have undoneOne' : IsOneEdgeUncolored undone e0 := by + exact @helper_undoneOne_605 V E inferInstance inferInstance inferInstance G k e0 input T + generating sigma ett hone i choice terminalGamma hnegc + have hpredNext : pred.series.data.tree + (Fin.last (pred.rounds + 1)) = Tn := by + have hh := predTrees (Fin.last (pred.rounds + 1)) + have hidx : (Fin.castLE (by omega) (Fin.last (pred.rounds + 1))) = n.castSucc := by + apply Fin.ext + simp [predRound, n] + omega + simpa [Tn] using hh.trans (congrArg ett.series.data.tree hidx) + have hpredColor : pred.series.data.coloring (Fin.last pred.rounds) = + ett.series.data.coloring i.castSucc := by + have hh := (predData (Fin.last pred.rounds)).1 + have hidx : (Fin.castLE (by omega) (Fin.last pred.rounds)) = i.castSucc := by + apply Fin.ext + simp [predRound] + omega + rw [hidx] at hh + exact hh + have hpredStored : TashkinovStoredColors pred.series.data + (Fin.last pred.rounds) = TashkinovStoredColors ett.series.data i.castSucc := by + have hh := (predData (Fin.last pred.rounds)).2.2.2.2.2.2.2.2.1 + have hidx : (Fin.castLE (by omega) (Fin.last pred.rounds)) = i.castSucc := by + apply Fin.ext + simp [predRound] + omega + rw [hidx] at hh + exact hh + have hstablePred := @helper_hstablePred_651 V E inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett i choice terminalGamma hi stablePreviousUndone hgt pred hpredNext + hpredColor hpredStored + have halphaDelta : alpha ≠ choice.color := by + intro heq + apply hne + have hcd : choice.color = delta := by + rw [← Option.some.injEq] + rw [← hdelta', hdelta] + exact heq.trans hcd + have hbetaGamma : beta ≠ terminalGamma := hbg + have hbetaDelta : beta ≠ choice.color := by + intro heq + apply hbeta + have hcd : choice.color = delta := by + rw [← Option.some.injEq] + rw [← hdelta', hdelta] + exact heq.trans hcd + have hswapAlpha : ∀ e, undone e = some alpha ↔ sigma e = some alpha := by + intro e + by_cases he : Sum.inr e ∈ + TwoColorComponent G sigma terminalGamma choice.color + (Sum.inl choice.vertex) + · by_cases h1 : sigma e = some terminalGamma <;> + by_cases h2 : sigma e = some choice.color <;> + simp [undone, TwoColorComponentSwap, he, h1, h2, + halphaGamma.symm, halphaDelta.symm, + hnegc.symm] + · simp [undone, TwoColorComponentSwap, he] + have hswapBeta : ∀ e, undone e = some beta ↔ sigma e = some beta := by + intro e + by_cases he : Sum.inr e ∈ + TwoColorComponent G sigma terminalGamma choice.color + (Sum.inl choice.vertex) + · by_cases h1 : sigma e = some terminalGamma <;> + by_cases h2 : sigma e = some choice.color <;> + simp [undone, TwoColorComponentSwap, he, h1, h2, + hbetaGamma.symm, hbetaDelta.symm, + hnegc.symm] + · simp [undone, TwoColorComponentSwap, he] + have hadj : ∀ x y, + (TwoColorIncidenceGraph G undone alpha beta).Adj x y ↔ + (TwoColorIncidenceGraph G sigma alpha beta).Adj x y := by + intro x y + cases x <;> cases y <;> + simp [TwoColorIncidenceGraph, hswapAlpha, hswapBeta] + have hreach := @helper_hreach_710 V E inferInstance inferInstance inferInstance G k e0 input T + generating sigma ett alpha beta i choice terminalGamma hadj hadj + have hcomponentEq : + ∀ z, TwoColorComponent G undone alpha beta z = TwoColorComponent G sigma alpha beta z := by + intro z + apply Set.ext + intro x + change (TwoColorIncidenceGraph G undone alpha beta).connectedComponentMk x = + (TwoColorIncidenceGraph G undone alpha beta).connectedComponentMk z ↔ + (TwoColorIncidenceGraph G sigma alpha beta).connectedComponentMk x = + (TwoColorIncidenceGraph G sigma alpha beta).connectedComponentMk z + rw [SimpleGraph.ConnectedComponent.eq, SimpleGraph.ConnectedComponent.eq] + exact hreach + have htransport := @helper_htransport_737 V E inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett alpha beta i choice terminalGamma hadj hcomponentEq hadj + hcomponentEq + have hmissingPred : alpha ∈ TreeMissingColors undone + (pred.series.data.tree (Fin.last (pred.rounds + 1))) := by + rw [hpredNext] + unfold TreeMissingColors + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp halpha + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + simpa [MissingColors, PresentColors, hswapAlpha] using hmv + have hstablePredNext : StableColoring + (pred.series.data.tree (Fin.last (pred.rounds + 1))) + (TashkinovStoredColors pred.series.data (Fin.last pred.rounds)) + (pred.series.data.coloring (Fin.last pred.rounds)) undone := by + exact hstablePred + have hmissingPredNext : alpha ∈ TreeMissingColors undone + (pred.series.data.tree (Fin.last (pred.rounds + 1))) := by + exact hmissingPred + apply htransport + simpa [hpredNext] using + (low undone undoneProper' undoneOne' hstablePredNext alpha beta + (Or.inl hmissingPredNext)) + +private theorem helper_branch_563.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (_ : (0 : ℕ) < + ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (delta alpha beta : Fin k) + (_ : ett.series.data.delta (Fin.last ett.rounds) = some delta) (_ : alpha ∈ + TreeMissingColors sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : ¬alpha + = delta) (_ : ¬beta = delta), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k) (_ : i.succ = n) (_ : + ett.series.data.delta n = some choice.color) (_ : terminalGamma ≠ choice.color) (_ : alpha + ≠ terminalGamma) (_ : ( + ∃ (selected : PartialEdgeColoring E k) (secondStable : PartialEdgeColoring E k), + IsProperEdgeColoring G selected ∧ IsOneEdgeUncolored selected e0 ∧ StableColoring + (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc) selected ∧ IsProperEdgeColoring G secondStable ∧ + IsOneEdgeUncolored secondStable e0 ∧ StableColoring (ett.series.data.tree i.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data i.castSucc)) selected + secondStable ∧ ett.series.data.coloring i.succ = TwoColorComponentSwap G secondStable + terminalGamma choice.color (Sum.inl choice.vertex) ∧ + have undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma terminalGamma + choice.color (Sum.inl choice.vertex); StableColoring (ett.series.data.tree + i.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data i.castSucc)) + secondStable undone ∧ StableColoring (ett.series.data.tree i.succ.castSucc) (insert + choice.color (TashkinovStoredColors ett.series.data i.castSucc)) selected undone ∧ + StableColoring (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors + ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc) undone)) (_ : ¬beta = + terminalGamma), TreeInterchangeable G (ett.series.data.tree (Fin.last + ett.rounds).castSucc) sigma alpha beta := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hproper hone delta alpha + beta hdelta halpha hne hbeta n Tn i choice terminalGamma hi hdelta' hnegc halphaGamma hundo + hbg + rcases hundo with ⟨selected, undoneStable, selectedProper, selectedOne, + selectedStable, undoneProper, undoneOne, undoneRelation, currentSwap, + finalStable⟩ + dsimp at finalStable + rcases finalStable with ⟨stableSecondUndone, stableSelectedUndone, + stablePreviousUndone⟩ + let undone := TwoColorComponentSwap G sigma terminalGamma choice.color + (Sum.inl choice.vertex) + have undoneProper' : IsProperEdgeColoring G undone := by + exact TwoColorComponentSwapProper G sigma terminalGamma choice.color + hnegc hproper (Sum.inl choice.vertex) + have undoneOne' : IsOneEdgeUncolored undone e0 := by + exact @helper_undoneOne_411 V E inferInstance inferInstance inferInstance G k e0 input T + generating sigma ett hone i choice terminalGamma hnegc + have halphaDelta : alpha ≠ choice.color := by + intro heq + apply hne + have hcd : choice.color = delta := by + rw [← Option.some.injEq] + rw [← hdelta', hdelta] + exact heq.trans hcd + have hbetaGamma : beta ≠ terminalGamma := hbg + have hbetaDelta : beta ≠ choice.color := by + intro heq + apply hbeta + have hcd : choice.color = delta := by + rw [← Option.some.injEq] + rw [← hdelta', hdelta] + exact heq.trans hcd + have hswapAlpha : ∀ e, undone e = some alpha ↔ sigma e = some alpha := by + intro e + by_cases he : Sum.inr e ∈ + TwoColorComponent G sigma terminalGamma choice.color + (Sum.inl choice.vertex) + · by_cases h1 : sigma e = some terminalGamma <;> + by_cases h2 : sigma e = some choice.color <;> + simp [undone, TwoColorComponentSwap, he, h1, h2, + halphaGamma.symm, halphaDelta.symm, + hnegc.symm] + · simp [undone, TwoColorComponentSwap, he] + have hswapBeta : ∀ e, undone e = some beta ↔ sigma e = some beta := by + intro e + by_cases he : Sum.inr e ∈ + TwoColorComponent G sigma terminalGamma choice.color + (Sum.inl choice.vertex) + · by_cases h1 : sigma e = some terminalGamma <;> + by_cases h2 : sigma e = some choice.color <;> + simp [undone, TwoColorComponentSwap, he, h1, h2, + hbetaGamma.symm, hbetaDelta.symm, + hnegc.symm] + · simp [undone, TwoColorComponentSwap, he] + have hadj : ∀ x y, + (TwoColorIncidenceGraph G undone alpha beta).Adj x y ↔ + (TwoColorIncidenceGraph G sigma alpha beta).Adj x y := by + intro x y + cases x <;> cases y <;> + simp [TwoColorIncidenceGraph, hswapAlpha, hswapBeta] + have hreach := @helper_hreach_473 V E inferInstance inferInstance inferInstance G k e0 input T + generating sigma ett alpha beta i choice terminalGamma hadj + have hcomponentEq : + ∀ z, TwoColorComponent G undone alpha beta z = TwoColorComponent G sigma alpha beta z := by + intro z + apply Set.ext + intro x + change (TwoColorIncidenceGraph G undone alpha beta).connectedComponentMk x = + (TwoColorIncidenceGraph G undone alpha beta).connectedComponentMk z ↔ + (TwoColorIncidenceGraph G sigma alpha beta).connectedComponentMk x = + (TwoColorIncidenceGraph G sigma alpha beta).connectedComponentMk z + rw [SimpleGraph.ConnectedComponent.eq, SimpleGraph.ConnectedComponent.eq] + exact hreach + have htransport := @helper_htransport_500 V E inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett alpha beta i choice terminalGamma hadj hcomponentEq + by_cases honeRound : ett.rounds = 1 + · exact @helper_branch_528 V E inferInstance inferInstance inferInstance G k e0 input T + generating sigma ett hpositive alpha beta halpha i choice terminalGamma hi + stablePreviousUndone undoneProper' undoneOne' hswapAlpha htransport honeRound + · exact @helper_branch_576 V E inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett hMP hpositive hlower hproper hone delta alpha beta hdelta + halpha hne hbeta i choice terminalGamma hi hdelta' hnegc halphaGamma hbg + stablePreviousUndone undoneProper' undoneOne' halphaDelta hbetaGamma hbetaDelta hswapAlpha + hswapBeta hadj hreach hcomponentEq htransport honeRound +private theorem helper_hpre_845.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (i : Fin ett.rounds) (terminalGamma : Fin k) (_ : i.succ = n) (_ : ett.series.data.gamma n = + some terminalGamma) (_ : ColoredVertexSetElementary G (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < + ett.rounds + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (TreeSequenceVertexSet Tn)), ColoredVertexSetElementary G + (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + i.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive n Tn i terminalGamma hi hcolor hlowerElem + have hidx : i.castSucc = (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) := by + apply Fin.ext + have hv := congrArg Fin.val hi + simp [n] at hv ⊢ + omega + have htree : Tn = ett.series.data.tree i.succ.castSucc := by + have hidx2 : n.castSucc = i.succ.castSucc := by + apply Fin.ext + have hv := congrArg Fin.val hi + simp [n] at hv ⊢ + omega + simpa [Tn] using congrArg (fun j => ett.series.data.tree j) hidx2 + have hcolor : ett.series.data.coloring i.castSucc = + ett.series.data.coloring (⟨ett.rounds - 1, by omega⟩) := + congrArg ett.series.data.coloring hidx + unfold ColoredVertexSetElementary at hlowerElem ⊢ + rw [hcolor, ← htree] + exact fun {u} hu {v} hv huv => hlowerElem hu hv huv + +private theorem helper_hgammaStored_906.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : (0 : ℕ) < ett.rounds), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : generating = ett.series.data.coloring n) (i : Fin ett.rounds) (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors + ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k) + (_ : ett.series.data.stored i.succ = { choice.color, terminalGamma }) (_ : i.succ = n) (_ + : terminalGamma ∉ TreeMissingColors generating Tn), terminalGamma ∈ TashkinovStoredColors + ett.series.data n := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive n Tn hgen i choice terminalGamma + currentStored hi hgammaNotTree + have hn : n.val ≠ 0 := by simp [n]; omega + rw [TashkinovStoredColors] + simp only [hn, ↓reduceIte] + apply Finset.mem_sdiff.mpr + constructor + · simp only [Finset.mem_biUnion] + refine ⟨n, Finset.mem_univ _, ?_⟩ + rw [← hi, currentStored] + simp + · intro hm + apply hgammaNotTree + simpa [hgen] using hm + +private theorem helper_hstableRev_920.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : StableColoring Tn (TashkinovStoredColors ett.series.data n) generating sigma) + (_ : IsProperEdgeColoring G generating) (_ : IsOneEdgeUncolored generating e0), + StableColoring Tn (TashkinovStoredColors ett.series.data n) sigma generating := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett hproper hone n Tn hstableTree hproperGen + honeGen + let left : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨generating, hproperGen, honeGen⟩ + let right : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨sigma, hproper, hone⟩ + have forward : StableColoring Tn + (TashkinovStoredColors ett.series.data n) left.1 right.1 := by + simpa [left, right] using hstableTree + have reverse := (sc2 G e0 Tn + (TashkinovStoredColors ett.series.data n)).symm forward + simpa [left, right] using reverse + +private theorem helper_hbad_970.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)), + ∀ terminalGamma ∈ TashkinovStoredColors ett.series.data n, StableColoring Tn + (TashkinovStoredColors ett.series.data n) sigma generating → choice.edge ∈ BoundaryEdges G + (TreeSequenceVertexSet Tn) ∧ sigma choice.edge = some terminalGamma → choice.edge ∈ + BoundaryColorEdges G generating (TreeSequenceVertexSet Tn) terminalGamma := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett n Tn i choice terminalGamma hgammaStored + hstableRev hnonemptyData + have hinc : TreeIncidentEdge Tn choice.edge := by + unfold TreeIncidentEdge + have hb := hnonemptyData.1 + obtain ⟨u, hu, v, hv, he⟩ := by simpa [BoundaryEdges] using hb + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends choice.edge + rw [he] + simp + have hc : generating choice.edge = sigma choice.edge := by + exact hstableRev.1 choice.edge hinc + ⟨terminalGamma, Finset.mem_union_right _ hgammaStored, + hnonemptyData.2⟩ + simp [BoundaryColorEdges, hnonemptyData.1, hc, hnonemptyData.2] + +private theorem helper_continuation_1320.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (_ : (0 : ℕ) < + ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : CombinedStableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) base.closure (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) generating sigma) (delta alpha beta : Fin k) (_ : ett.series.data.delta + (Fin.last ett.rounds) = some delta) (_ : alpha ∈ TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : ¬alpha = delta) (_ : ¬beta = + delta), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : generating = ett.series.data.coloring n) (_ : StableColoring Tn (TashkinovStoredColors + ett.series.data n) generating sigma) (_ : IsProperEdgeColoring G generating) (_ : + IsOneEdgeUncolored generating e0) (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors ett.series.data + i.castSucc) (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k) (_ : + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE) (_ : + ett.series.data.chosenVertex i.succ = some choice.vertex) (_ : ett.series.data.delta + i.succ = some choice.color) (_ : ett.series.data.gamma i.succ = some terminalGamma) (_ : + i.succ = n) (_ : ett.series.data.delta n = some choice.color) (_ : BoundaryColorEdges G + (ett.series.data.coloring i.succ) (TreeSequenceVertexSet (ett.series.data.tree + i.succ.castSucc)) terminalGamma = { choice.edge } ∧ ( + ∀ g ∈ BoundaryColorEdges G (ett.series.data.coloring i.succ) (TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc)) choice.color, + ∃ (w : V), TreeVertexOrder (ett.series.data.tree i.succ.castSucc) w choice.vertex ∧ Incident G + w g) ∧ (ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (ett.series.data.coloring i.succ) (ett.series.data.tree + i.succ.castSucc), alpha ≠ choice.color → BoundaryColorEdges G (ett.series.data.coloring + i.succ) (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) alpha = ∅)) (_ : + terminalGamma ≠ choice.color) (_ : ett.series.data.coloring n choice.edge = some + terminalGamma) (_ : terminalGamma ∈ TashkinovStoredColors ett.series.data n) (_ : + StableColoring Tn (TashkinovStoredColors ett.series.data n) sigma generating) (_ : alpha ≠ + terminalGamma) (_ : BoundaryColorEdges G sigma (TreeSequenceVertexSet Tn) alpha = ∅), + TreeInterchangeable G (ett.series.data.tree (Fin.last ett.rounds).castSucc) sigma alpha + beta := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper + hone hstable delta alpha beta hdelta halpha hne hbeta n Tn hgen hstableTree hproperGen + honeGen i choice terminalGamma currentKind currentVertex currentDelta terminalGammaValue hi + hdelta' hbound hnegc hcurrentEdge hgammaStored hstableRev halphaGamma hsigmaEmpty + have hgammaSingleton := @helper_hgammaSingleton_407 V E inferInstance inferInstance inferInstance + G k e0 input T generating sigma ett hgen hstableTree i choice terminalGamma hi hbound + hcurrentEdge hgammaStored hstableRev + have hnonempty : choice.edge ∈ BoundaryColorEdges G sigma + (TreeSequenceVertexSet Tn) terminalGamma := by + rw [hgammaSingleton] + simp + have hnonemptyData : choice.edge ∈ BoundaryEdges G + (TreeSequenceVertexSet Tn) ∧ + sigma choice.edge = some terminalGamma := by + simpa [BoundaryColorEdges] using hnonempty + have hbad := @helper_hbad_970 V E inferInstance inferInstance inferInstance G k e0 input T + generating sigma ett i choice terminalGamma hgammaStored hstableRev hnonemptyData + have hmissEq : TreeMissingColors sigma Tn = + TreeMissingColors generating Tn := by + unfold TreeMissingColors + apply Finset.ext + intro c + constructor <;> intro hc + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + exact hstableTree.2 v hv ▸ hcv + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + exact (hstableTree.2 v hv).symm ▸ hcv + have hclosure := CombinedStableClosurePreserved G k e0 input T generating generating sigma ett + hpositive base (by simpa [n] using hgen) hPE hproperGen honeGen hproper hone hstable + let baseSigma : HierarchyBase ett sigma := + { core := base.core + closure := base.closure + supportPosition := base.supportPosition + supportPositive := base.supportPositive + terminalMissingColors := by + simpa [hgen] using hmissEq + parallel := by + dsimp + intro hp + have hh := base.parallel hp + exact ⟨hh.1, hclosure.2.2, hh.2.2⟩ + nonparallel := base.nonparallel } + have hcoreElem : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet base.core) := ParallelClosureUnionElementary G k e0 input T generating + ett hMP hpositive hlower hPE sigma hproper hone hstableTree baseSigma + have helemSigma : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet Tn) := by + intro u hu v hv huv + have huCore : u ∈ TreeSequenceVertexSet base.core := by + obtain ⟨ou⟩ := (base.parallel hPE).2.2 + rw [ou.vertexSet] + exact Finset.mem_union_left _ hu + have hvCore : v ∈ TreeSequenceVertexSet base.core := by + obtain ⟨ou⟩ := (base.parallel hPE).2.2 + rw [ou.vertexSet] + exact Finset.mem_union_left _ hv + exact hcoreElem huCore hvCore huv + have hext := ExtensionBase G k e0 input T generating ett hMP hpositive hlower + dsimp at hext + have hstableLast : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma := by + simpa [Tn, n, hgen] using hstableTree + have hstableI : StableColoring + (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) + (ett.series.data.coloring i.succ) sigma := by + simpa [Tn, n, hgen, hi] using hstableTree + have hcomponent := hext choice.vertex terminalGamma choice.color + (by simpa [n, hi] using currentKind) (by simpa [n, hi] using currentVertex) + (by simpa [n, hi] using terminalGammaValue) (by simpa [n, hi] using currentDelta) + sigma hproper hone hstableLast + have hvchoice : choice.vertex ∈ TreeSequenceVertexSet Tn := by + simpa [Tn, hi] using choice.vertexDefective.1 + have hvchoiceI : choice.vertex ∈ + TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc) := by + simpa [Tn, hi] using hvchoice + have hcomponentI : ∀ w, w ∈ + TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc) → + (Sum.inl w ∈ TwoColorComponent G sigma terminalGamma choice.color + (Sum.inl choice.vertex) ↔ w = choice.vertex) := by + intro w hw + apply hcomponent w + simpa [Tn, hi] using hw + have hundo := ParallelExtensionUndoStable G k ett.rounds e0 input ett.series i + choice.vertex terminalGamma choice.color + (by simpa using currentKind) (by simpa using currentVertex) + (by simpa using terminalGammaValue) (by simpa using currentDelta) + sigma hproper hone hstableI hvchoiceI hcomponentI + by_cases hbg : beta = terminalGamma + · subst beta + apply ElementarySingleBoundaryInterchangeable G sigma Tn alpha terminalGamma hproper + · exact helemSigma + · exact hsigmaEmpty + · rw [hgammaSingleton] + simp + · exact @helper_branch_563 V E inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett hMP hpositive hlower hproper hone delta alpha beta hdelta + halpha hne hbeta i choice terminalGamma hi hdelta' hnegc halphaGamma hundo hbg + +private theorem helper_branch_213.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (_ : (0 : ℕ) < + ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : CombinedStableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) base.closure (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) generating sigma) (_ delta alpha beta : Fin k) (_ : ett.series.data.delta + (Fin.last ett.rounds) = some delta) (_ : alpha ∈ TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : ¬alpha = delta) (_ : ¬beta = + delta), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : generating = ett.series.data.coloring n) (_ : StableColoring Tn (TashkinovStoredColors + ett.series.data n) generating sigma) (_ : IsProperEdgeColoring G generating) (_ : + IsOneEdgeUncolored generating e0) (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree i.succ.castSucc) (TashkinovStoredColors ett.series.data + i.castSucc) (ett.series.data.coloring i.castSucc)) (terminalGamma : Fin k) (_ : + ParallelExtensionColor ett.series.data i.castSucc choice.selected choice.vertex + terminalGamma) (secondStable : PartialEdgeColoring E k) (_ : StableColoring + (ett.series.data.tree i.succ.castSucc) (insert choice.color (TashkinovStoredColors + ett.series.data i.castSucc)) choice.selected secondStable) (_ : ett.series.data.coloring + i.succ = TwoColorComponentSwap G secondStable terminalGamma choice.color (Sum.inl + choice.vertex)) (_ : ett.series.data.stored i.succ = { choice.color, terminalGamma }) (_ : + ett.series.data.connectingEdges i.succ = { choice.edge }) (_ : ett.series.data.kind i.succ + = some TashkinovExtensionKind.PE) (_ : ett.series.data.chosenVertex i.succ = some + choice.vertex) (_ : ett.series.data.delta i.succ = some choice.color) (_ : + ett.series.data.gamma i.succ = some terminalGamma) (_ : n = i.succ), TreeInterchangeable G + (ett.series.data.tree (Fin.last ett.rounds).castSucc) sigma alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper + hone hstable gamma delta alpha beta hdelta halpha hne hbeta n Tn hgen hstableTree + hproperGen honeGen i choice terminalGamma gammaRule secondStable secondStableRelation + currentColoring currentStored currentEdges currentKind currentVertex currentDelta + terminalGammaValue targetEq + have hi : i.succ = n := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + have hvertex : ett.series.data.chosenVertex n = some choice.vertex := by + rw [← hi] + exact currentVertex + have hcolor : ett.series.data.gamma n = some terminalGamma := by + rw [← hi] + exact terminalGammaValue + have hdelta' : ett.series.data.delta n = some choice.color := by + rw [← hi] + exact currentDelta + have hlowerElem := @helper_hlowerElem_240 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett hMP hpositive hlower i + have hbound := HkuParallelBoundaryStructure G k ett.rounds e0 input ett.series i + choice.edge choice.color terminalGamma choice.vertex + (by simpa using currentKind) (by simpa using currentEdges) + (by simpa using currentDelta) (by simpa using terminalGammaValue) + (by simpa using currentVertex) + have hpre := @helper_hpre_845 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive i terminalGamma hi hcolor hlowerElem + have hnegc : terminalGamma ≠ choice.color := by + intro heq + have hp : choice.color ∈ PresentColors G choice.selected choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, choice.edgeColor⟩ + have hm : terminalGamma ∉ PresentColors G choice.selected choice.vertex := by + simpa [MissingColors] using gammaRule.1 + exact hm (heq ▸ hp) + have hsecondEdge : secondStable choice.edge = some choice.color := by + have hs := secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union_right _ (Finset.mem_insert_self _ _), + choice.edgeColor⟩ + exact hs.trans choice.edgeColor + have hcomponentEdge : Sum.inr choice.edge ∈ + TwoColorComponent G secondStable terminalGamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable terminalGamma choice.color).connectedComponentMk + (Sum.inr choice.edge) = + (TwoColorIncidenceGraph G secondStable terminalGamma choice.color).connectedComponentMk + (Sum.inl choice.vertex) + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hsecondEdge] + have hcurrentEdge : ett.series.data.coloring n choice.edge = + some terminalGamma := by + have hcur : ett.series.data.coloring n = + TwoColorComponentSwap G secondStable terminalGamma choice.color + (Sum.inl choice.vertex) := by + simpa [hi] using currentColoring + rw [hcur] + simp [TwoColorComponentSwap, hcomponentEdge, hsecondEdge] + have hgammaNotTree : terminalGamma ∉ TreeMissingColors generating Tn := by + intro hm + have hm' : terminalGamma ∈ TreeMissingColors + (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) := by + simpa [hgen, Tn, hi] using hm + have hx := hbound.2.2 hpre terminalGamma hm' hnegc + rw [hbound.1] at hx + simp at hx + have hgammaStored := @helper_hgammaStored_906 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hpositive hgen i choice terminalGamma currentStored hi hgammaNotTree + have hstableRev := @helper_hstableRev_920 V E inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett hproper hone hstableTree hproperGen honeGen + have hgenMissing : alpha ∈ TreeMissingColors generating Tn := by + unfold TreeMissingColors at halpha ⊢ + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp halpha + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [← hstableTree.2 v hv] + exact hm + have halphaGamma : alpha ≠ terminalGamma := by + intro heq + apply hgammaNotTree + simpa [heq] using hgenMissing + have hgenEmpty : BoundaryColorEdges G generating + (TreeSequenceVertexSet Tn) alpha = {} := by + have hx := hbound.2.2 hpre alpha + (by simpa [hgen, Tn, hi] using hgenMissing) + (by + have hcd : choice.color = delta := by + rw [← Option.some.injEq] + rw [← hdelta', hdelta] + intro ha + apply hne + exact ha.trans hcd) + simpa [hgen, Tn, hi] using hx + have hsigmaEmpty := @helper_hsigmaEmpty_384 V E inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett alpha halpha hstableRev hgenEmpty + exact @helper_continuation_1320 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating sigma ett hMP hpositive hlower hPE base hproper hone hstable delta + alpha beta hdelta halpha hne hbeta hgen hstableTree hproperGen honeGen i choice + terminalGamma currentKind currentVertex currentDelta terminalGammaValue hi hdelta' hbound + hnegc hcurrentEdge hgammaStored hstableRev halphaGamma hsigmaEmpty +theorem InterchangePETreeAwayFromDelta {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (base : HierarchyBase ett generating) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : CombinedStableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + generating sigma) + (support : V) (gamma delta alpha beta : Fin k) + (_ : ett.series.data.chosenVertex (Fin.last ett.rounds) = + some support) + (_ : ett.series.data.gamma (Fin.last ett.rounds) = some gamma) + (hdelta : ett.series.data.delta (Fin.last ett.rounds) = some delta) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + alpha ∈ TreeMissingColors sigma Tn → + alpha ≠ delta → + beta ≠ delta → + TreeInterchangeable G Tn sigma alpha beta := by + classical + dsimp + intro halpha hne hbeta + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + have hgen : generating = ett.series.data.coloring n := by + simpa [n] using ett.generatingColoring + have hstableTree : StableColoring Tn + (TashkinovStoredColors ett.series.data n) generating sigma := by + simpa [Tn, hgen] using hstable.1 + have hproperGen := @helper_hproperGen_107 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hpositive hPE gamma hgen + have honeGen := @helper_honeGen_147 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive hPE gamma hgen + have hstep := ett.series.certified n + generalize targetEq : n = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hn : n ≠ 0 := by simp [n]; omega + exact (hn targetEq).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hp : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by simpa [n] using hPE + rw [targetEq, currentKind] at hp + contradiction + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hp : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by simpa [n] using hPE + rw [targetEq, currentKind] at hp + contradiction + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + terminalGamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta terminalGammaValue closedExtension orderedExtension + strictExtension => + exact @helper_branch_213 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper hone + hstable gamma delta alpha beta hdelta halpha hne hbeta hgen hstableTree hproperGen + honeGen i choice terminalGamma gammaRule secondStable secondStableRelation + currentColoring currentStored currentEdges currentKind currentVertex currentDelta + terminalGammaValue targetEq +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/InterchangePETreeConstituent.lean b/LeanPool/GoldbergSeymour/InterchangePETreeConstituent.lean new file mode 100644 index 0000000000..f94ee5b270 --- /dev/null +++ b/LeanPool/GoldbergSeymour/InterchangePETreeConstituent.lean @@ -0,0 +1,711 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.InterchangePEClosedCore +public import LeanPool.GoldbergSeymour.InterchangePECommonMissingClosed +public import LeanPool.GoldbergSeymour.InterchangePETreeAwayFromDelta +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.PartialEdgeColoring +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Interchange PETree Constituent + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch320Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 + : ℕ) < ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : CombinedStableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) base.closure (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) generating sigma) (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) => + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : q.succ = n) (_ : q.succ = Fin.last ett.rounds) (gamma : Fin k) (secondStable : + PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (_ : ParallelExtensionColor ett.series.data + q.castSucc choice.selected choice.vertex gamma) (_ : StableColoring (ett.series.data.tree + q.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected secondStable) (_ : ett.series.data.coloring q.succ = TwoColorComponentSwap + G secondStable gamma choice.color (Sum.inl choice.vertex)) (_ : + ett.series.data.chosenVertex q.succ = some choice.vertex) (_ : ett.series.data.kind n = + some TashkinovExtensionKind.PE) (_ : alpha = choice.color), TreeInterchangeable G + (ett.series.data.tree (Fin.last ett.rounds).castSucc) sigma alpha beta + +private theorem helper_sharedCore_164.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 + : ℕ) < ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : CombinedStableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) base.closure (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) generating sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) => + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : q.succ = n) (_ : q.succ = Fin.last ett.rounds) (gamma : Fin k) (secondStable : + PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (_ : ParallelExtensionColor ett.series.data + q.castSucc choice.selected choice.vertex gamma) (_ : StableColoring (ett.series.data.tree + q.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected secondStable) (_ : ett.series.data.coloring q.succ = TwoColorComponentSwap + G secondStable gamma choice.color (Sum.inl choice.vertex)) (_ : + ett.series.data.chosenVertex q.succ = some choice.vertex) (_ : ett.series.data.kind n = + some TashkinovExtensionKind.PE), choice.color ∈ TreeMissingColors sigma base.core ∧ + TreeColorSetClosed G sigma base.core { choice.color } := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper + hone hstable n q hqn hlast gamma secondStable choice gammaRule secondStableRelation + currentColoring currentVertex hPE' + have hgm : gamma ∈ MissingColors G secondStable choice.vertex := by + exact (secondStableRelation.2 choice.vertex choice.vertexDefective.1).symm ▸ gammaRule.1 + have hse : secondStable choice.edge = some choice.color := by + have hs := secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union_right _ (Finset.mem_insert_self _ _), + choice.edgeColor⟩ + exact hs.trans choice.edgeColor + have hdn : choice.color ∉ MissingColors G secondStable choice.vertex := by + intro hm + have hp : choice.color ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, hse⟩ + have hn : choice.color ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hm + exact hn hp + have hswap : choice.color ∈ MissingColors G + (TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex)) choice.vertex := by + unfold MissingColors + simp only [Finset.mem_sdiff] + constructor + · exact Finset.mem_univ _ + · intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp + rcases hp with ⟨e, he, hec⟩ + have heold : secondStable e = some gamma ∨ + secondStable e = some choice.color := by + by_cases hc : Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · simp [TwoColorComponentSwap, hc] at hec + by_cases hg : secondStable e = some gamma + · exact Or.inl hg + · by_cases hd : secondStable e = some choice.color + · exact Or.inr hd + · simp [hg, hd] at hec + · right + simpa [TwoColorComponentSwap, hc] using hec + have heK : Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inr e) = (TwoColorIncidenceGraph G secondStable gamma + choice.color).connectedComponentMk + (Sum.inl choice.vertex) + rcases heold with hg | hd + · exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, he, hg]) + · exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, he, hd]) + have hneq : gamma ≠ choice.color := by + intro heq + have hgp : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, heq ▸ hse⟩ + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgm + exact hnot hgp + have hgp : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + rcases heold with heold | heold + · exact ⟨e, he, heold⟩ + · exfalso + have hs : TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) e = some gamma := by + simp [TwoColorComponentSwap, heK, heold] + exact hneq (Option.some.inj (hs.symm.trans hec)) + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgm + exact hnot hgp + have hgen : choice.color ∈ MissingColors G generating choice.vertex := by + have hcur : ett.series.data.coloring n = + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + rw [← hqn] + exact currentColoring + have hcur' : ett.series.data.coloring (Fin.last ett.rounds) = + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + rw [← hlast] + exact currentColoring + apply (congrArg (fun c => choice.color ∈ MissingColors G c choice.vertex) + ett.generatingColoring).mpr + apply (congrArg (fun c => choice.color ∈ MissingColors G c choice.vertex) + hcur').mpr + exact hswap + have hvt : choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree n.castSucc) := by + simpa [hqn] using choice.vertexDefective.1 + have hdt : choice.color ∈ TreeMissingColors sigma + (ett.series.data.tree n.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨choice.vertex, hvt, (hstable.1.2 choice.vertex hvt).symm ▸ hgen⟩ + have hdtcore : choice.color ∈ TreeMissingColors sigma base.core := by + obtain ⟨unionData⟩ := (base.parallel hPE).2.2 + simp only [TreeMissingColors, Finset.mem_biUnion] + refine ⟨choice.vertex, ?_, ?_⟩ + · rw [unionData.vertexSet] + apply Finset.mem_union_left + simpa [n] using hvt + · exact (hstable.1.2 choice.vertex hvt).symm ▸ hgen + have hcore : TreeColorSetClosed G sigma base.core {choice.color} := by + apply InterchangePECommonMissingClosed G k e0 input T generating sigma ett + hMP hpositive hlower hPE' base hproper hone hstable choice.color + · exact hdt + · have augmentSubset : ∀ {A B : TreeSequence G e0}, + TashkinovAugmentationSequence generating A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hab + have initialSubset : ∀ {C D : TreeSequence G e0}, + TreeSequenceInitialSegment C D → + TreeSequenceVertexSet C ⊆ TreeSequenceVertexSet D := by + intro C D hCD x hx + unfold TreeSequenceVertexSet at hx ⊢ + simp only [Finset.mem_image] at hx ⊢ + obtain ⟨i, hi, rfl⟩ := hx + obtain ⟨hlen, hvertices, hedges⟩ := hCD + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, + Finset.mem_univ _, hvertices i⟩ + unfold TashkinovAugmentationSequence at hab + induction hab using Relation.ReflTransGen.head_induction_on with + | refl => exact fun x hx => hx + | head hstep htail ih => + intro x hx + exact ih (initialSubset hstep.2.1 hx) + obtain ⟨unionData⟩ := (base.parallel hPE).2.2 + have prefixSubset : TreeSequenceVertexSet + (TreeSequencePrefix + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) ⊆ + TreeSequenceVertexSet base.closure := by + exact augmentSubset (base.parallel hPE).2.1.1 + have hprefix : choice.vertex ∈ TreeSequenceVertexSet + (TreeSequencePrefix + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) := by + simp only [TreeSequenceVertexSet, Finset.mem_image] + refine ⟨⟨base.supportPosition.val, Nat.lt_succ_self _⟩, Finset.mem_univ _, ?_⟩ + change (ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex base.supportPosition = _ + have cv : ett.series.data.chosenVertex (Fin.last ett.rounds) = + some choice.vertex := by + rw [← hlast] + exact currentVertex + exact Option.some.inj ((base.parallel hPE).1.symm.trans cv) + have hclosureVertex : choice.vertex ∈ TreeSequenceVertexSet base.closure := + prefixSubset hprefix + have hdc : choice.color ∈ TreeMissingColors sigma base.closure := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨choice.vertex, hclosureVertex, + (hstable.2.2 choice.vertex hclosureVertex).symm ▸ hgen⟩ + exact hdc + exact ⟨hdtcore, hcore⟩ + +private theorem helper_branch_320.{u_1, u_2} : + helperBranch320Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper + hone hstable alpha beta halpha n q hqn hlast gamma secondStable choice gammaRule + secondStableRelation currentColoring currentVertex hPE' ha + have hgm : gamma ∈ MissingColors G secondStable choice.vertex := by + exact (secondStableRelation.2 choice.vertex choice.vertexDefective.1).symm ▸ gammaRule.1 + have hse : secondStable choice.edge = some choice.color := by + have hs := secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union_right _ (Finset.mem_insert_self _ _), + choice.edgeColor⟩ + exact hs.trans choice.edgeColor + have hdn : choice.color ∉ MissingColors G secondStable choice.vertex := by + intro hm + have hp : choice.color ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, hse⟩ + have hn : choice.color ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hm + exact hn hp + have hswap : choice.color ∈ MissingColors G + (TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex)) choice.vertex := by + unfold MissingColors + simp only [Finset.mem_sdiff] + constructor + · exact Finset.mem_univ _ + · intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp + rcases hp with ⟨e, he, hec⟩ + have heold : secondStable e = some gamma ∨ + secondStable e = some choice.color := by + by_cases hc : Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · simp [TwoColorComponentSwap, hc] at hec + by_cases hg : secondStable e = some gamma + · exact Or.inl hg + · by_cases hd : secondStable e = some choice.color + · exact Or.inr hd + · simp [hg, hd] at hec + · right + simpa [TwoColorComponentSwap, hc] using hec + have heK : Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inr e) = (TwoColorIncidenceGraph G secondStable gamma + choice.color).connectedComponentMk + (Sum.inl choice.vertex) + rcases heold with hg | hd + · exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, he, hg]) + · exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, he, hd]) + have hneq : gamma ≠ choice.color := by + intro heq + have hgp : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, heq ▸ hse⟩ + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgm + exact hnot hgp + have hgp : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + rcases heold with heold | heold + · exact ⟨e, he, heold⟩ + · exfalso + have hs : TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) e = some gamma := by + simp [TwoColorComponentSwap, heK, heold] + exact hneq (Option.some.inj (hs.symm.trans hec)) + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgm + exact hnot hgp + have hgen : choice.color ∈ MissingColors G generating choice.vertex := by + have hcur : ett.series.data.coloring n = + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + rw [← hqn] + exact currentColoring + have hcur' : ett.series.data.coloring (Fin.last ett.rounds) = + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + rw [← hlast] + exact currentColoring + apply (congrArg (fun c => choice.color ∈ MissingColors G c choice.vertex) + ett.generatingColoring).mpr + apply (congrArg (fun c => choice.color ∈ MissingColors G c choice.vertex) + hcur').mpr + exact hswap + have hvt : choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree n.castSucc) := by + simpa [hqn] using choice.vertexDefective.1 + have hdt : choice.color ∈ TreeMissingColors sigma + (ett.series.data.tree n.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨choice.vertex, hvt, (hstable.1.2 choice.vertex hvt).symm ▸ hgen⟩ + have hdtcore : choice.color ∈ TreeMissingColors sigma base.core := by + obtain ⟨unionData⟩ := (base.parallel hPE).2.2 + simp only [TreeMissingColors, Finset.mem_biUnion] + refine ⟨choice.vertex, ?_, ?_⟩ + · rw [unionData.vertexSet] + apply Finset.mem_union_left + simpa [n] using hvt + · exact (hstable.1.2 choice.vertex hvt).symm ▸ hgen + have hcore : TreeColorSetClosed G sigma base.core {choice.color} := by + apply InterchangePECommonMissingClosed G k e0 input T generating sigma ett + hMP hpositive hlower hPE' base hproper hone hstable choice.color + · exact hdt + · have augmentSubset : ∀ {A B : TreeSequence G e0}, + TashkinovAugmentationSequence generating A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hab + have initialSubset : ∀ {C D : TreeSequence G e0}, + TreeSequenceInitialSegment C D → + TreeSequenceVertexSet C ⊆ TreeSequenceVertexSet D := by + intro C D hCD x hx + unfold TreeSequenceVertexSet at hx ⊢ + simp only [Finset.mem_image] at hx ⊢ + obtain ⟨i, hi, rfl⟩ := hx + obtain ⟨hlen, hvertices, hedges⟩ := hCD + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, + Finset.mem_univ _, hvertices i⟩ + unfold TashkinovAugmentationSequence at hab + induction hab using Relation.ReflTransGen.head_induction_on with + | refl => exact fun x hx => hx + | head hstep htail ih => + intro x hx + exact ih (initialSubset hstep.2.1 hx) + obtain ⟨unionData⟩ := (base.parallel hPE).2.2 + have prefixSubset : TreeSequenceVertexSet + (TreeSequencePrefix + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) ⊆ + TreeSequenceVertexSet base.closure := by + exact augmentSubset (base.parallel hPE).2.1.1 + have hprefix : choice.vertex ∈ TreeSequenceVertexSet + (TreeSequencePrefix + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) := by + simp only [TreeSequenceVertexSet, Finset.mem_image] + refine ⟨⟨base.supportPosition.val, Nat.lt_succ_self _⟩, Finset.mem_univ _, ?_⟩ + change (ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex base.supportPosition = _ + have cv : ett.series.data.chosenVertex (Fin.last ett.rounds) = + some choice.vertex := by + rw [← hlast] + exact currentVertex + exact Option.some.inj ((base.parallel hPE).1.symm.trans cv) + have hclosureVertex : choice.vertex ∈ TreeSequenceVertexSet base.closure := + prefixSubset hprefix + have hdc : choice.color ∈ TreeMissingColors sigma base.closure := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨choice.vertex, hclosureVertex, + (hstable.2.2 choice.vertex hclosureVertex).symm ▸ hgen⟩ + exact hdc + subst alpha + have hci := InterchangePEClosedCore G k e0 input T generating sigma ett hMP + hpositive hlower hPE' base hproper hone hstable choice.color beta hdtcore hcore + have hsub : TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ⊆ + TreeSequenceVertexSet base.core := by + obtain ⟨unionData⟩ := (base.parallel hPE).2.2 + intro v hv + rw [unionData.vertexSet] + exact Finset.mem_union_left _ hv + unfold TreeInterchangeable at hci ⊢ + intro z w hz hw hzT hwT + apply hci z w hz hw + · obtain ⟨v, hv, hvc⟩ := hzT + exact ⟨v, hsub hv, hvc⟩ + · obtain ⟨v, hv, hvc⟩ := hwT + exact ⟨v, hsub hv, hvc⟩ + +private theorem helper_branch_489.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 + : ℕ) < ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : CombinedStableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) base.closure (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) generating sigma) (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) => + by + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (_ : ett.series.data.kind n = some TashkinovExtensionKind.PE) (_ : choice.color ∈ + TreeMissingColors sigma base.core ∧ TreeColorSetClosed G sigma base.core { choice.color }) + (_ : beta = choice.color), TreeInterchangeable G (ett.series.data.tree (Fin.last + ett.rounds).castSucc) sigma alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper + hone hstable alpha beta n q choice hPE' sharedCore hb + subst beta + have hci := InterchangePEClosedCore G k e0 input T generating sigma ett hMP + hpositive hlower hPE' base hproper hone hstable choice.color alpha + sharedCore.1 sharedCore.2 + have graphSwap : TwoColorIncidenceGraph G sigma alpha choice.color = + TwoColorIncidenceGraph G sigma choice.color alpha := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + have componentSwap (z : Sum V E) : + TwoColorComponent G sigma alpha choice.color z = + TwoColorComponent G sigma choice.color alpha z := by + unfold TwoColorComponent + rw [graphSwap] + have pathSwap (z : Sum V E) : + TwoColorPathComponent G sigma alpha choice.color z → + TwoColorPathComponent G sigma choice.color alpha z := by + intro hz + rcases hz with ⟨hne, x, hx, hs⟩ + refine ⟨hne.symm, x, ?_, ?_⟩ + · exact (congrArg (fun s : Set (Sum V E) => x ∈ s) + (componentSwap z)).mp hx + · exact (congrArg (fun g : SimpleGraph (Sum V E) => + Set.Subsingleton (g.neighborSet x)) graphSwap).mp hs + have hsub : TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ⊆ + TreeSequenceVertexSet base.core := by + obtain ⟨unionData⟩ := (base.parallel hPE).2.2 + intro v hv + rw [unionData.vertexSet] + exact Finset.mem_union_left _ hv + have hreverse : TreeInterchangeable G base.core sigma alpha choice.color := by + unfold TreeInterchangeable at hci ⊢ + intro z w hz hw hzT hwT + have hz' : ∃ v ∈ TreeSequenceVertexSet base.core, + Sum.inl v ∈ TwoColorComponent G sigma choice.color alpha z := by + obtain ⟨v, hv, hvc⟩ := hzT + exact ⟨v, hv, componentSwap z ▸ hvc⟩ + have hw' : ∃ v ∈ TreeSequenceVertexSet base.core, + Sum.inl v ∈ TwoColorComponent G sigma choice.color alpha w := by + obtain ⟨v, hv, hvc⟩ := hwT + exact ⟨v, hv, componentSwap w ▸ hvc⟩ + exact (componentSwap z).trans + ((hci z w (pathSwap z hz) (pathSwap w hw) hz' hw').trans + (componentSwap w).symm) + unfold TreeInterchangeable at hreverse ⊢ + intro z w hz hw hzT hwT + apply hreverse z w hz hw + · obtain ⟨v, hv, hvc⟩ := hzT + exact ⟨v, hsub hv, hvc⟩ + · obtain ⟨v, hv, hvc⟩ := hwT + exact ⟨v, hsub hv, hvc⟩ + +private theorem helper_branch_126.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 + : ℕ) < ett.rounds) (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) (base : + HierarchyBase ett generating) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : CombinedStableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) base.closure (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) generating sigma) (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) => + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : q.succ = n) (_ : q.succ = Fin.last ett.rounds) (ci : Fin ett.rounds) (_ : + IsProperEdgeColoring G (ett.series.data.coloring ci.castSucc)) (_ : IsOneEdgeUncolored + (ett.series.data.coloring ci.castSucc) e0) (_ : ColoredVertexSetClosed G + (ett.series.data.coloring ci.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + ci.succ.castSucc))) (_ : ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring + ci.castSucc) (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : + ¬Nonempty (RevisitingExtensionCertificate ett.series.data ci.castSucc)) (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree ci.succ.castSucc) (TashkinovStoredColors + ett.series.data ci.castSucc) (ett.series.data.coloring ci.castSucc)) (_ : ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc)))) (gamma : Fin k) (_ : ParallelExtensionColor ett.series.data + ci.castSucc choice.selected choice.vertex gamma) (secondStable : PartialEdgeColoring E k) + (_ : StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected secondStable) (_ : + TreeExit (ett.series.data.tree ci.succ.castSucc) secondStable gamma choice.color + choice.vertex) (_ : ett.series.data.coloring ci.succ = TwoColorComponentSwap G + secondStable gamma choice.color (Sum.inl choice.vertex)) (_ : IsProperEdgeColoring G + (ett.series.data.coloring ci.succ)) (_ : IsOneEdgeUncolored (ett.series.data.coloring + ci.succ) e0) (_ : ett.series.data.stored ci.succ = { choice.color, gamma }) (_ : + ett.series.data.connectingEdges ci.succ = { choice.edge }) (_ : ett.series.data.kind + ci.succ = some TashkinovExtensionKind.PE) (_ : ett.series.data.chosenVertex ci.succ = some + choice.vertex) (_ : ett.series.data.outsideVertex ci.succ = some choice.otherEndpoint) (_ + : ett.series.data.delta ci.succ = some choice.color) (_ : ett.series.data.gamma ci.succ = + some gamma) (_ : TashkinovClosure (ett.series.data.coloring ci.succ) (ett.series.data.tree + ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : TreeSequenceInitialSegment + (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : + (ett.series.data.tree ci.succ.castSucc).length < (ett.series.data.tree + ci.succ.succ).length) (_ : q.succ = ci.succ), TreeInterchangeable G (ett.series.data.tree + (Fin.last ett.rounds).castSucc) sigma alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper + hone hstable alpha beta halpha n q hqn hlast ci previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma + gammaRule secondStable secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension target_eq + have hci : ci = q := by + apply Fin.ext + have hv := congrArg Fin.val target_eq + simp at hv + omega + subst ci + have hsupport : ett.series.data.chosenVertex n = some choice.vertex := by + rw [← hqn] + exact currentVertex + have hgamma : ett.series.data.gamma n = some gamma := by + rw [← hqn] + exact currentGamma + have hdel : ett.series.data.delta n = some choice.color := by + rw [← hqn] + exact currentDelta + have hPE' : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by + change ett.series.data.kind (Fin.last ett.rounds) = _ + exact hPE + have sharedCore := @helper_sharedCore_164 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper hone + hstable hqn hlast gamma secondStable choice gammaRule secondStableRelation currentColoring + currentVertex hPE' + by_cases ha : alpha = choice.color + · exact @helper_branch_320 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett hMP hpositive hlower hPE base hproper hone hstable alpha beta + halpha hqn hlast gamma secondStable choice gammaRule secondStableRelation currentColoring + currentVertex hPE' ha + by_cases hb : beta = choice.color + · exact @helper_branch_489 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating sigma ett hMP hpositive hlower hPE base hproper hone hstable alpha beta + choice hPE' sharedCore hb + exact InterchangePETreeAwayFromDelta G k e0 input T generating sigma ett + hMP hpositive hlower hPE' base hproper hone hstable choice.vertex gamma + choice.color alpha beta (by simpa [n] using hsupport) + (by simpa [n] using hgamma) (by simpa [n] using hdel) halpha ha hb + +theorem InterchangePETreeConstituent {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (base : HierarchyBase ett generating) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : CombinedStableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + generating sigma) + (alpha beta : Fin k) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + alpha ∈ TreeMissingColors sigma Tn → + TreeInterchangeable G Tn sigma alpha beta := by + dsimp + intro halpha + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hqn : q.succ = n := by + apply Fin.ext + simp [q, n] + omega + have hlast : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + generalize target_eq : q.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q target_eq).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hci : ci = q := by + apply Fin.ext + have hv := congrArg Fin.val target_eq + simp at hv + omega + subst ci + have hp : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE := by rw [hlast]; exact hPE + rw [currentKind] at hp + simp at hp + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hci : ci = q := by + apply Fin.ext + have hv := congrArg Fin.val target_eq + simp at hv + omega + subst ci + have hp : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE := by rw [hlast]; exact hPE + rw [currentKind] at hp + simp at hp + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact @helper_branch_126 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T generating sigma ett hMP hpositive hlower hPE base hproper hone + hstable alpha beta halpha hqn hlast ci previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableRelation exitWitness currentColoring + currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension target_eq +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/InternalEdges.lean b/LeanPool/GoldbergSeymour/InternalEdges.lean new file mode 100644 index 0000000000..aa3ef0fd51 --- /dev/null +++ b/LeanPool/GoldbergSeymour/InternalEdges.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Incident + +/-! +# Internal Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Edges all of whose endpoints belong to the given vertex set. -/ +noncomputable def InternalEdges {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) + (U : Finset V) : Finset E := by + classical + exact Finset.univ.filter fun e => ∀ v, Incident G v e → v ∈ U + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IsFullEdgeColoring.lean b/LeanPool/GoldbergSeymour/IsFullEdgeColoring.lean new file mode 100644 index 0000000000..a52d96dd60 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IsFullEdgeColoring.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.PartialEdgeColoring + +/-! +# Is Full Edge Coloring + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Every edge has an assigned color. -/ +def IsFullEdgeColoring {E : Type*} {k : ℕ} (φ : PartialEdgeColoring E k) : Prop := + ∀ e, ∃ c, φ e = some c + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IsOneEdgeUncolored.lean b/LeanPool/GoldbergSeymour/IsOneEdgeUncolored.lean new file mode 100644 index 0000000000..0581e4210c --- /dev/null +++ b/LeanPool/GoldbergSeymour/IsOneEdgeUncolored.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.PartialEdgeColoring + +/-! +# Is One Edge Uncolored + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Exactly the distinguished edge is uncolored. -/ +def IsOneEdgeUncolored {E : Type*} {k : ℕ} (φ : PartialEdgeColoring E k) (e0 : E) : Prop := + φ e0 = none ∧ ∀ e, e ≠ e0 → ∃ c, φ e = some c + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/IsProperEdgeColoring.lean b/LeanPool/GoldbergSeymour/IsProperEdgeColoring.lean new file mode 100644 index 0000000000..ce3756ef81 --- /dev/null +++ b/LeanPool/GoldbergSeymour/IsProperEdgeColoring.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.PartialEdgeColoring + +/-! +# Is Proper Edge Coloring + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Distinct adjacent edges cannot carry the same assigned color. -/ +def IsProperEdgeColoring {V E : Type*} (G : LooplessMultigraph V E) {k : ℕ} + (φ : PartialEdgeColoring E k) : Prop := + ∀ ⦃e f c⦄, e ≠ f → AdjacentEdges G e f → φ e = some c → φ f ≠ some c + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/KTriple.lean b/LeanPool/GoldbergSeymour/KTriple.lean new file mode 100644 index 0000000000..848755f714 --- /dev/null +++ b/LeanPool/GoldbergSeymour/KTriple.lean @@ -0,0 +1,36 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Critical +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored + +public import LeanPool.GoldbergSeymour.MaximumDegree + +/-! +# KTriple + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A critical graph with chromatic index `k + 1`, sufficiently many colors and one distinguished +uncolored edge. +-/ +def KTriple {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) : Prop := + Critical G ∧ + ChromaticIndex G = k + 1 ∧ + MaximumDegree G + 1 ≤ k ∧ IsProperEdgeColoring G phi ∧ IsOneEdgeUncolored phi e0 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/KempeOrientation.lean b/LeanPool/GoldbergSeymour/KempeOrientation.lean new file mode 100644 index 0000000000..05f55f7f58 --- /dev/null +++ b/LeanPool/GoldbergSeymour/KempeOrientation.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# P2880_T1_Kempe Orientation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2880_T1_KempeOrientation + {V E : Type*} (G : LooplessMultigraph V E) + {k : Nat} (mu : PartialEdgeColoring E k) (alpha beta : Fin k) + (hne : alpha ≠ beta) : + TwoColorIncidenceGraph G mu alpha beta = + TwoColorIncidenceGraph G mu beta alpha ∧ + (∀ z, TwoColorComponent G mu alpha beta z = + TwoColorComponent G mu beta alpha z) ∧ + (∀ z, TwoColorComponentSwap G mu alpha beta z = + TwoColorComponentSwap G mu beta alpha z) ∧ + (∀ z, TwoColorPathComponent G mu alpha beta z ↔ + TwoColorPathComponent G mu beta alpha z) := by + classical + have hgraph : TwoColorIncidenceGraph G mu alpha beta = + TwoColorIncidenceGraph G mu beta alpha := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + have hcomp : ∀ z, TwoColorComponent G mu alpha beta z = + TwoColorComponent G mu beta alpha z := by + intro z + unfold TwoColorComponent + rw [hgraph] + refine ⟨hgraph, hcomp, ?_, ?_⟩ + · intro z + funext e + unfold TwoColorComponentSwap + rw [← hcomp z] + by_cases hc : Sum.inr e ∈ TwoColorComponent G mu alpha beta z + · by_cases ha : mu e = some alpha + · simp [hc, ha, hne] + · by_cases hb : mu e = some beta + · simp [hc, hb] + · simp [hc, ha, hb] + · simp [hc] + · intro z + unfold TwoColorPathComponent + rw [hgraph, hcomp] + simp only [ne_comm] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/LargeOrderTerminalWitness.lean b/LeanPool/GoldbergSeymour/LargeOrderTerminalWitness.lean new file mode 100644 index 0000000000..0cdd0dc724 --- /dev/null +++ b/LeanPool/GoldbergSeymour/LargeOrderTerminalWitness.lean @@ -0,0 +1,198 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AlgorithmThreeOneInitialSeriesExists +public import LeanPool.GoldbergSeymour.AlgorithmThreeOneStepExists +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.PositiveWellDefinedness +public import LeanPool.GoldbergSeymour.CertifiedSeriesRoundsBound +public import LeanPool.GoldbergSeymour.TashkinovSeriesDataAppend +public import LeanPool.GoldbergSeymour.TashkinovSeriesFinalETTExists +public import LeanPool.GoldbergSeymour.TechnicalTheoremLarge + +/-! +# Large Order Terminal Witness + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem LargeOrderTerminalWitness + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) + (hcritical : Critical G) (hindex : ChromaticIndex G = k + 1) + (hdegree : MaximumDegree G + 1 <= k) + (hlarge : 11 <= TashkinovOrder G) : + exists (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V), + IsProperEdgeColoring G phi /\ IsOneEdgeUncolored phi e0 /\ + (forall v, v ∈ G.ends e0 -> v ∈ X) /\ + ColoredVertexSetElementary G phi X /\ + ColoredVertexSetStronglyClosed G phi X := by + classical + have endpointsInTree : forall (e0 : E) (R : TreeSequence G e0) (v : V), + v ∈ G.ends e0 -> v ∈ TreeSequenceVertexSet R := by + intro e0 R v hv + obtain ⟨i, hi⟩ := R.attaches ⟨0, R.positive⟩ + have iz : i = ⟨0, by omega⟩ := Fin.eq_zero i + subst i + rw [← R.first_edge] at hv + rw [hi] at hv + simp only [Sym2.mem_iff] at hv + rcases hv with hv | hv + · subst v + simp [TreeSequenceVertexSet] + · simp only [TreeSequenceVertexSet, Finset.mem_image] + exact ⟨_, Finset.mem_univ _, hv.symm⟩ + obtain ⟨e0, phi, T0, initial, hglobal, htreeZero, htreeOne, + hcolor, hstored, hedges, hkind, hchosen, houtside, hdelta, hgamma, + hfirstMaximum, hfirstThree, hfirstOdd, hfirstElementary, + hfirstClosed⟩ := + AlgorithmThreeOneInitialSeriesExists G k hcritical hindex hdegree + have hproper : IsProperEdgeColoring G phi := hglobal.1.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := hglobal.1.2.2.2.2 + by_cases hfirstStrong : ColoredVertexSetStronglyClosed G phi + (TreeSequenceVertexSet (initial.data.tree 1)) + · exact ⟨e0, phi, TreeSequenceVertexSet (initial.data.tree 1), hproper, + hone, endpointsInTree e0 (initial.data.tree 1), hfirstElementary, + hfirstStrong⟩ + · obtain ⟨newTree, newColoring, newStored, newConnectingEdges, + newKind, newChosenVertex, newOutsideVertex, newDelta, newGamma, + firstPositiveSeries, hfirstAppend, hfirstStrict⟩ := + have lastColor : Fin.last 0 = (0 : Fin 1) := by + ext + rfl + have lastTree : Fin.last (0 + 1) = (1 : Fin 2) := by + ext + rfl + AlgorithmThreeOneStepExists G k 0 e0 phi initial hdegree + (by rw [lastColor, hcolor]; exact hproper) + (by rw [lastColor, hcolor]; exact hone) + (by rw [lastColor, hcolor, lastTree]; exact hfirstClosed) + (by rw [lastColor, hcolor, lastTree]; exact hfirstStrong) + obtain ⟨rawFirstETT, hrawRounds, hrawSeries⟩ := + TashkinovSeriesFinalETTExists G k 1 e0 phi firstPositiveSeries (by omega) + cases rawFirstETT with + | mk rawRounds rawPositive rawSeries rawAbove rawStrict rawBelow rawGenerating => + dsimp at hrawRounds + subst rawRounds + have rawSeriesEq : rawSeries = firstPositiveSeries := eq_of_heq hrawSeries + subst rawSeries + let firstETT : ExtendedTashkinovTree G k e0 phi + (firstPositiveSeries.data.tree (Fin.last (1 + 1))) + (firstPositiveSeries.data.coloring (Fin.last 1)) := { + rounds := 1 + roundsPositive := rawPositive + series := firstPositiveSeries + abovePenultimate := rawAbove + strictAbovePenultimate := rawStrict + belowFinal := rawBelow + generatingColoring := rawGenerating } + have hfirstMP : MaximumProperty firstETT := by + unfold MaximumProperty + constructor + · change (TreeSequenceVertexSet (firstPositiveSeries.data.tree 1)).card = + TashkinovOrder G + rw [hfirstAppend] + have firstIndex : (1 : Fin (1 + 2)) = (1 : Fin (0 + 2)).castSucc := by + ext + rfl + rw [firstIndex] + simpa only [TashkinovSeriesDataAppend, Fin.lastCases_castSucc] using + hfirstMaximum + · intro i hi hlast + dsimp [firstETT] at hlast + omega + let Attainable : Nat -> Prop := fun n => + exists (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + ett.rounds = n /\ + T = ett.series.data.tree (Fin.last (ett.rounds + 1)) /\ + MaximumProperty ett + let candidates := (Finset.range (Fintype.card V)).filter Attainable + have hfirstAttainable : Attainable 1 := by + exact ⟨phi, firstPositiveSeries.data.tree (Fin.last (1 + 1)), + firstPositiveSeries.data.coloring (Fin.last 1), firstETT, rfl, rfl, + hfirstMP⟩ + have hfirstBound : 1 < Fintype.card V := by + have hb := CertifiedSeriesRoundsBound G k 1 e0 phi + firstPositiveSeries + omega + have honeMem : 1 ∈ candidates := by + exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr hfirstBound, + hfirstAttainable⟩ + have hcandidatesNonempty : candidates.Nonempty := ⟨1, honeMem⟩ + let n := candidates.max' hcandidatesNonempty + have hnMem : n ∈ candidates := Finset.max'_mem candidates hcandidatesNonempty + have hnAttainable : Attainable n := (Finset.mem_filter.mp hnMem).2 + obtain ⟨inputN, TN, generatingN, ettN, hroundsN, hfinalN, hMPN⟩ := + hnAttainable + obtain normalized | extended := + PositiveWellDefinedness G k e0 inputN TN generatingN ettN + hfinalN hMPN hdegree hlarge + · obtain ⟨replacementInput, replacementSeries, normalizedETT, + hnormalizedRounds, hnormalizedSeries, hnormalizedProper, + hnormalizedOne, hnormalizedClosed, hnormalizedStrong, + hnormalizedMP, hnormalizedTerminal⟩ := normalized + have hnormalizedElementary : ColoredVertexSetElementary G + (replacementSeries.data.coloring (Fin.last ettN.rounds)) + (TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last (ettN.rounds + 1)))) := by + exact (TechnicalTheoremLarge G k e0 replacementInput + (replacementSeries.data.tree (Fin.last (ettN.rounds + 1))) + (replacementSeries.data.coloring (Fin.last ettN.rounds)) + normalizedETT hnormalizedMP hdegree hlarge).1 + exact ⟨e0, replacementSeries.data.coloring (Fin.last ettN.rounds), + TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last (ettN.rounds + 1))), + hnormalizedProper, hnormalizedOne, + endpointsInTree e0 + (replacementSeries.data.tree (Fin.last (ettN.rounds + 1))), + hnormalizedElementary, hnormalizedStrong⟩ + · obtain ⟨replacementInput, extendedSeries, extendedETT, + hextendedRounds, hextendedSeries, hextendedProper, hextendedOne, + hextendedClosed, hextendedMP⟩ := extended + have hextendedFinal : + extendedSeries.data.tree (Fin.last ((ettN.rounds + 1) + 1)) = + extendedETT.series.data.tree + (Fin.last (extendedETT.rounds + 1)) := by + cases extendedETT with + | mk extendedRounds extendedPositive extendedData extendedAbove + extendedStrict extendedBelow extendedGenerating => + dsimp at hextendedRounds + subst extendedRounds + have extendedDataEq : extendedData = extendedSeries := + eq_of_heq hextendedSeries + subst extendedData + rfl + have hextendedAttainable : Attainable (n + 1) := by + refine ⟨replacementInput, + extendedSeries.data.tree (Fin.last ((ettN.rounds + 1) + 1)), + extendedSeries.data.coloring (Fin.last (ettN.rounds + 1)), + extendedETT, ?_, hextendedFinal, hextendedMP⟩ + omega + have hextendedBound : n + 1 < Fintype.card V := by + have hb := CertifiedSeriesRoundsBound G k + (ettN.rounds + 1) e0 replacementInput extendedSeries + omega + have hextendedMem : n + 1 ∈ candidates := by + exact Finset.mem_filter.mpr + ⟨Finset.mem_range.mpr hextendedBound, hextendedAttainable⟩ + have hmax := Finset.le_max' candidates (n + 1) hextendedMem + have himpossible : n + 1 <= n := by + simpa only [n] using hmax + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean b/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean new file mode 100644 index 0000000000..448a88b7fa --- /dev/null +++ b/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean @@ -0,0 +1,1231 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport + +/-! +# P2905_T2_Late Owner Replacement + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation769Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + ∀ alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), alpha ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → + ∀ (t : ℕ), (1 : ℕ) ≤ t → (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) = + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + t → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C t; ( + ∀ (i : ℕ), TreeSequenceInitialSegment (HierarchyFullTailPrefix C i) T) → + TreeSequenceInitialSegment A X → TreeSequenceInitialSegment X B → alpha ≠ eta → X.length = + A.length + t → eta ∈ MissingColors G phi (X.vertex (Fin.last X.length)) → alpha ∈ + TreeMissingColors phi B ∧ eta ∈ TreeMissingColors phi B → (↑(HierarchyFirstMissingPosition + phi T eta) : ℕ) = A.length + t → (0 : ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors phi + (H.stage (⟨H.dividerCount, + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬H.dividerCount < H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∨ alpha ∈ TreeMissingColors phi + A ∧ alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) ∧ eta ∉ + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → X.vertex (Fin.last + X.length) ∈ TreeSequenceVertexSet B → T.vertex (Fin.last T.length) ≠ X.vertex (Fin.last + X.length) → Disjoint (TwoColorComponent G phi alpha eta (Sum.inl (T.vertex (Fin.last + T.length)))) (TwoColorComponent G phi alpha eta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition phi T alpha)))) → TwoColorPathComponent G phi alpha eta + (Sum.inl (T.vertex (Fin.last T.length))) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G phi alpha eta (Sum.inl + (T.vertex (Fin.last T.length)))) x = MissingColors G phi x) → + let w : V := T.vertex (Fin.last T.length); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha eta (Sum.inl w); + alpha ∈ TreeMissingColors sigma X ∧ eta ∈ TreeMissingColors sigma X → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; ( + ∀ (r : Fin T.length), A.length ≤ (↑r : ℕ) → (↑r : ℕ) < X.length → sigma (T.edge r) = phi + (T.edge r)) → (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X ∨ (ett.series.data.kind n = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X) → + TashkinovAugmentationSequence phi X T → ( + ∀ rho ∈ HierarchyStoredColorsAt H q, HierarchyFirstMissingPosition sigma T rho = + HierarchyFirstMissingPosition phi T rho) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), eta ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ eta ∈ MissingColors G + P.coloring ((HierarchyFullTailPrefix C t).vertex (Fin.last (HierarchyFullTailPrefix C + t).length)) + +private abbrev helperContinuation681Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + ∀ alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)), + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), alpha ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → + ∀ (t : ℕ), (1 : ℕ) ≤ t → t < HierarchyFullTailLength C → (↑(HierarchyFirstMissingPosition phi + T eta) : ℕ) = (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length + t → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C t; ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U Z → TreeSequenceInitialSegment W Z + → U.length ≤ W.length → TreeSequenceInitialSegment U W) → ColoredVertexSetElementary G phi + (TreeSequenceVertexSet B) → TreeSequenceInitialSegment A T → ell = T.length - A.length → + A.length + ell = T.length → ( + ∀ (i : ℕ), TreeSequenceInitialSegment (HierarchyFullTailPrefix C i) T) → + TreeSequenceInitialSegment A X → TreeSequenceInitialSegment X B → alpha ≠ eta → X.length = + A.length + t → B.length = T.length - (1 : ℕ) → eta ∈ MissingColors G phi (X.vertex + (Fin.last X.length)) → alpha ∈ TreeMissingColors phi B ∧ eta ∈ TreeMissingColors phi B → + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) = A.length + t → alpha ∉ + HierarchySegmentColors H q eta → ( + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T eta); + have sameComponent : Prop := TwoColorComponent G phi alpha eta (Sum.inl va) = + TwoColorComponent G phi alpha eta (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (alpha ∈ + TreeMissingColors phi Tnq ∨ Disjoint (insert alpha ({ eta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + phi Tn ∨ Disjoint (insert alpha ({ eta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ (alpha ∈ TreeMissingColors phi A ∧ TreeColorSetClosed G phi A ({ alpha } + : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A phi alpha eta)) → + (H.dividerCount = (0 : ℕ) → alpha ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) → (H.dividerCount ≠ (0 : ℕ) → alpha ∈ TreeMissingColors phi + (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))) → (0 : ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors + phi (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (alpha ∈ TreeMissingColors + phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∨ alpha ∈ TreeMissingColors phi + A ∧ alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) ∧ eta ∉ + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → X.vertex (Fin.last + X.length) ∈ TreeSequenceVertexSet B → T.vertex (Fin.last T.length) ≠ X.vertex (Fin.last + X.length) → Disjoint (TwoColorComponent G phi alpha eta (Sum.inl (T.vertex (Fin.last + T.length)))) (TwoColorComponent G phi alpha eta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition phi T alpha)))) → TwoColorPathComponent G phi alpha eta + (Sum.inl (T.vertex (Fin.last T.length))) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G phi alpha eta (Sum.inl + (T.vertex (Fin.last T.length)))) x = MissingColors G phi x) → + let w : V := T.vertex (Fin.last T.length); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha eta (Sum.inl w); + alpha ∈ TreeMissingColors sigma X ∧ eta ∈ TreeMissingColors sigma X → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), eta ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ eta ∈ MissingColors G + P.coloring ((HierarchyFullTailPrefix C t).vertex (Fin.last (HierarchyFullTailPrefix C + t).length)) + +private abbrev helperContinuation649Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + ∀ alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)), alpha ∈ TreeMissingColors phi + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) → + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), alpha ∈ + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta → + ∀ (t : ℕ), (1 : ℕ) ≤ t → t < HierarchyFullTailLength C → (↑(HierarchyFirstMissingPosition phi + T eta) : ℕ) = (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length + t → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C t; ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U Z → TreeSequenceInitialSegment W Z + → U.length ≤ W.length → TreeSequenceInitialSegment U W) → ColoredVertexSetElementary G phi + (TreeSequenceVertexSet B) → TreeSequenceInitialSegment A T → (3 : ℕ) ≤ ell → ell = + T.length - A.length → A.length + ell = T.length → ( + ∀ (i : ℕ), TreeSequenceInitialSegment (HierarchyFullTailPrefix C i) T) → + TreeSequenceInitialSegment A B → TreeSequenceInitialSegment A X → + TreeSequenceInitialSegment X B → alpha ≠ eta → X.length = A.length + t → B.length = + T.length - (1 : ℕ) → eta ∈ MissingColors G phi (X.vertex (Fin.last X.length)) → alpha ∈ + TreeMissingColors phi B ∧ eta ∈ TreeMissingColors phi B → (↑(HierarchyFirstMissingPosition + phi T alpha) : ℕ) ≤ A.length → (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) = A.length + + t → alpha ∉ HierarchySegmentColors H q eta → (alpha ∉ TreeMissingColors phi A ∨ eta ∉ + TreeMissingColors phi A → TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T + alpha)) (T.vertex (HierarchyFirstMissingPosition phi T eta)) ∧ alpha ∉ ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < (↑(HierarchyFirstMissingPosition phi T + eta) : ℕ) ∧ phi (T.edge r) = some c} : Finset (Fin k))) → + ∃ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), eta ∈ + MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ eta ∈ MissingColors G + P.coloring ((HierarchyFullTailPrefix C t).vertex (Fin.last (HierarchyFullTailPrefix C + t).length)) + +private theorem helper_coreToA_409.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ _ : Fin + k) (_ : ℕ), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : ( + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, Decidable.byContradiction fun (a_1 : ¬a < H.dividerCount + (2 : ℕ)) ↦ + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, Decidable.byContradiction fun (a_1 : ¬a + + d < H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))))), TreeSequenceInitialSegment base.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha eta t H q A segTrans stageSegment + by_cases hz : H.dividerCount = 0 + · have hA : A = base.core := by + change HierarchyStarredStage H q = base.core + have hq : q = 0 := by + apply Fin.ext + simp [q, hz] + rw [hq] + rfl + rw [hA] + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + · have hqsucc : ∃ r : Fin H.dividerCount, q = r.succ := by + refine ⟨⟨H.dividerCount - 1, by omega⟩, ?_⟩ + apply Fin.ext + simp [q] + omega + obtain ⟨r, hr⟩ := hqsucc + have hA : A = H.stage ⟨H.dividerCount, by omega⟩ := by + have hidx : r.succ.castSucc = + (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := by + apply Fin.ext + have hh := congrArg Fin.val hr + simp [q] at hh ⊢ + omega + calc + A = HierarchyStarredStage H q := rfl + _ = HierarchyStarredStage H r.succ := by rw [hr] + _ = H.stage r.succ.castSucc := rfl + _ = H.stage ⟨H.dividerCount, by omega⟩ := congrArg H.stage hidx + rw [hA] + have hstep := stageSegment 1 (H.dividerCount - 1) (by omega) + have hsum : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + have hstep' : TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) + (H.stage ⟨H.dividerCount, by omega⟩) := by + simpa [hsum] using hstep + exact segTrans H.coreInsideFirst hstep' + +private theorem helper_sourceRoute_458.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ eta : + Fin k) (t : ℕ) (_ : (1 : ℕ) ≤ t) (_ : (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) = + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + t), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C t; + ∀ (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U Z) (_ : + TreeSequenceInitialSegment W Z) (_ : U.length ≤ W.length), TreeSequenceInitialSegment U + W)) (_ : ( + ∀ (i : ℕ), TreeSequenceInitialSegment (HierarchyFullTailPrefix C i) T)) (_ : + TreeSequenceInitialSegment A X) (_ : X.length = A.length + t) (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : ( + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, Decidable.byContradiction fun (a_1 : ¬a < H.dividerCount + (2 : ℕ)) ↦ + by + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, Decidable.byContradiction fun (a_1 : ¬a + + d < H.dividerCount + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))))), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : TreeSequenceInitialSegment Tn (HierarchyFullTailPrefix C t)) (_ : (ett.series.data.kind + (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) T ∨ (ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) + = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = + { f } ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f + seed ∧ TreeIncidentEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f ∧ ( + ∃ c ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∪ + TashkinovStoredColors ett.series.data (Fin.last ett.rounds), phi f = some c) ∧ + TashkinovAugmentationSequence phi seed T)), ett.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence phi Tn T ∧ + TreeSequenceInitialSegment Tn X ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE + ∨ ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed T ∧ + TreeSequenceInitialSegment seed X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha eta t htpos hfirst H q A X commonPrefix + hprefixT hAX hXlen segTrans stageSegment n Tn TnToX terminalRoute + rcases terminalRoute with ⟨hp, hroute⟩ | ⟨hk, f, seed, hedges, hadjoin, + hincident, hcolor, hroute⟩ + · exact Or.inl ⟨hp, hroute, TnToX⟩ + · have hseedT := TashkinovAugmentationSequenceInitialSegment phi seed T hroute + by_cases hz : H.dividerCount = 0 + · have hA : A = Tn := by + have hpPE : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE := by + intro hp + rcases hk with hk | hk + · rw [hk] at hp + cases hp + · rw [hk] at hp + cases hp + have hAcore : A = base.core := by + change HierarchyStarredStage H q = base.core + have hq : q = 0 := by + apply Fin.ext + simp [q, hz] + rw [hq] + rfl + exact hAcore.trans (base.nonparallel hpPE) + have hlen := hadjoin.1 + change seed.length = Tn.length + 1 at hlen + have hSXlen : seed.length ≤ X.length := by + have heq : Tn.length = A.length := congrArg TreeSequence.length hA.symm + rw [heq] at hlen + rw [hlen, hXlen] + omega + exact Or.inr ⟨hk, f, seed, hedges, hadjoin, hroute, + commonPrefix hseedT (hprefixT t) hSXlen⟩ + · obtain ⟨r, hr⟩ := by + have hqsucc : ∃ r : Fin H.dividerCount, q = r.succ := by + refine ⟨⟨H.dividerCount - 1, by omega⟩, ?_⟩ + apply Fin.ext + simp [q] + omega + exact hqsucc + have hfirstEdge := HierarchyNonparallelFirstEdge H f hk hedges + obtain ⟨edgePos, heval, hedge⟩ := hfirstEdge + have hstage1T : TreeSequenceInitialSegment + (H.stage ⟨1, by omega⟩) T := by + have hst := stageSegment 1 H.dividerCount (by omega) + have hidx : (⟨1 + H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp + omega + rw [hidx] at hst + simpa [H.terminalStage] using hst + have hseedLen := hadjoin.1 + change seed.length = Tn.length + 1 at hseedLen + have hstrict : Tn.length < (H.stage ⟨1, by omega⟩).length := by + have hh := edgePos.isLt + change edgePos.val < (H.stage ⟨1, by omega⟩).length at hh + rw [heval] at hh + exact hh + have hseedStage : TreeSequenceInitialSegment seed (H.stage ⟨1, by omega⟩) := + commonPrefix hseedT hstage1T (by rw [hseedLen]; omega) + have hstageA : TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) A := by + have hstage := stageSegment 1 (H.dividerCount - 1) (by omega) + have hsum : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + have hstage' : TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) + (H.stage ⟨H.dividerCount, by omega⟩) := by + simpa [hsum] using hstage + have hidx : r.succ.castSucc = + (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := by + apply Fin.ext + have hh := congrArg Fin.val hr + simp [q] at hh ⊢ + omega + have hA : A = H.stage ⟨H.dividerCount, by omega⟩ := by + calc + A = HierarchyStarredStage H q := rfl + _ = HierarchyStarredStage H r.succ := by rw [hr] + _ = H.stage r.succ.castSucc := rfl + _ = H.stage ⟨H.dividerCount, by omega⟩ := congrArg H.stage hidx + simpa [hA] using hstage' + have hseedA := segTrans hseedStage hstageA + exact Or.inr ⟨hk, f, seed, hedges, hadjoin, hroute, + segTrans hseedA hAX⟩ + +private theorem helper_hfixedPrefix_551.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha eta + : Fin k) (t : ℕ) (_ : (1 : ℕ) ≤ t) (_ : t < HierarchyFullTailLength C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C t; + ∀ (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B)) (_ : ( + ∀ (i : ℕ), TreeSequenceInitialSegment (HierarchyFullTailPrefix C i) T)) (_ : X.length = + A.length + t) (_ : eta ∈ MissingColors G phi (X.vertex (Fin.last X.length))) (_ : + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) = A.length + t) (_ : alpha ∉ + HierarchySegmentColors H q eta), + let w : V := T.vertex (Fin.last T.length); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha eta (Sum.inl w); + ∀ (_ : (if ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE then + CombinedStableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma else + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma)), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) T + ∨ (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = + { f } ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f + seed ∧ TreeIncidentEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f ∧ ( + ∃ c ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∪ + TashkinovStoredColors ett.series.data (Fin.last ett.rounds), phi f = some c) ∧ + TashkinovAugmentationSequence phi seed T)) (_ : H.stage q.succ = T) (r : Fin T.length) (_ + : A.length ≤ (↑r : ℕ)) (_ : (↑r : ℕ) < X.length), sigma (T.edge r) = phi (T.edge r) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha eta t htpos htupper H q A ell B X hB + hprefixT hXlen hXmissingEta hposEta hnotSegment w sigma hbase n Tn terminalRoute + hstageTerminal r hrA hrX + have halphaNot : phi (T.edge r) ≠ some alpha := by + intro hc + apply hnotSegment + have hseg : alpha ∈ HierarchySegmentColors H q eta := by + rw [HierarchySegmentColors, hstageTerminal] + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨r, hrA, ?_, hc⟩ + have hrFirst : r.val < (HierarchyFirstMissingPosition phi T eta).val := by + rw [hposEta] + rw [hXlen] at hrX + exact lt_of_lt_of_le hrX (by omega) + exact lt_min hrFirst r.isLt + exact hseg + by_cases hetaColor : phi (T.edge r) = some eta + · let rX : Fin X.length := ⟨r.val, hrX⟩ + have hrCast : Fin.castLE (hprefixT t).1 rX = r := Fin.ext rfl + have hEdge : X.edge rX = T.edge r := by + rw [← hrCast] + exact (hprefixT t).2.2 rX |>.symm + have hEtaColorX : phi (X.edge rX) = some eta := by rw [hEdge]; exact hetaColor + have exception := HierarchyTailMissingColorExclusion G k e0 input T phi ett + base H hB t htpos htupper eta hXmissingEta rX hrA (by + have hx : r.val < A.length + t := by + rw [← hXlen] + exact hrX + simpa [rX] using hx) hEtaColorX + obtain ⟨hz, hcore, hindex, fTail, hstep, hkind, hconn, hedgeTail, + hcolorTail, hstoredTail⟩ := exception + have hnotPE : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE := by + intro hp + rcases hkind with hse | hre + · rw [hp] at hse + cases hse + · rw [hp] at hre + cases hre + have hstableTn : StableColoring Tn + (TashkinovStoredColors ett.series.data n) phi sigma := by + change (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data n) phi sigma + else StableColoring Tn (TashkinovStoredColors ett.series.data n) phi sigma) + at hbase + simpa [hnotPE] using hbase + rcases terminalRoute with ⟨hp, _⟩ | ⟨_, fRoute, _, hconnRoute, _, hincident, _, _⟩ + · exact (hnotPE hp).elim + · have hfEq : fTail = fRoute := + Finset.singleton_inj.mp (hconn.symm.trans hconnRoute) + have hincidentTail : TreeIncidentEdge Tn fTail := by + rw [hfEq] + exact hincident + have hfix := hstableTn.1 fTail hincidentTail + ⟨eta, Finset.mem_union_right _ hstoredTail, hcolorTail⟩ + have hTedge : T.edge r = fTail := hEdge.symm.trans hedgeTail + rw [hTedge] + exact hfix + · simp [sigma, TwoColorComponentSwap, halphaNot, hetaColor] + +private theorem helper_hrouteTransport_610.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha eta + : Fin k) (t : ℕ) (_ : (1 : ℕ) ≤ t) (_ : (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) = + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + t), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C t; + ∀ (_ : TreeSequenceInitialSegment A T) (_ : ( + ∀ (i : ℕ), TreeSequenceInitialSegment (HierarchyFullTailPrefix C i) T)) (_ : + TreeSequenceInitialSegment X B) (_ : X.length = A.length + t) (_ : + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) = A.length + t) (_ : ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G phi alpha eta (Sum.inl + (T.vertex (Fin.last T.length)))) x = MissingColors G phi x)), + let w : V := T.vertex (Fin.last T.length); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha eta (Sum.inl w); + ∀ (_ : ( + have A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t))) (_ : ( + ∀ (r : Fin T.length) (_ : A.length ≤ (↑r : ℕ)) (_ : (↑r : ℕ) < X.length), sigma (T.edge r) = + phi (T.edge r))) (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence phi S T) (_ : + TreeSequenceInitialSegment S X), TashkinovAugmentationSequence sigma S X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha eta t htpos hfirst H q A ell B X hAT + hprefixT hXB hXlen hposEta hpenultimateMissing w sigma hfixedA hfixedPrefix S hroute hSX + let Xminus := TreeSequencePrefix X (X.length - 1) + (by have := A.positive; rw [hXlen]; omega) + (by omega) + have hminusX : TreeSequenceInitialSegment Xminus X := by + refine ⟨by dsimp [Xminus, TreeSequencePrefix]; omega, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have hminusLen : X.length = Xminus.length + 1 := by + dsimp [Xminus, TreeSequencePrefix] + omega + have hfixedX : ∀ i : Fin X.length, + sigma (X.edge i) = phi (X.edge i) := by + intro i + let r : Fin T.length := Fin.castLE (hprefixT t).1 i + have hr : r.val = i.val := rfl + have hedge : T.edge r = X.edge i := (hprefixT t).2.2 i + rw [← hedge] + by_cases hiA : i.val < A.length + · let j : Fin A.length := ⟨i.val, hiA⟩ + have hAj : Fin.castLE hAT.1 j = r := Fin.ext rfl + rw [← hAj, hAT.2.2 j] + exact hfixedA j + · have hrA : A.length ≤ r.val := by rw [hr]; omega + have hrX : r.val < X.length := by rw [hr]; exact i.isLt + exact hfixedPrefix r hrA hrX + have hmissingXminus : ∀ v, v ∈ TreeSequenceVertexSet Xminus → + MissingColors G sigma v = MissingColors G phi v := by + intro v hv + exact hpenultimateMissing v + (TreeSequenceInitialSegmentVertexSetSubset hXB + (TreeSequenceInitialSegmentVertexSetSubset hminusX hv)) + have hrouteSX := TashkinovAugmentationSequenceRestrict phi S X T hroute + hSX (hprefixT t) + exact TashkinovAugmentationSequenceColoringTransport phi sigma S Xminus X + hrouteSX hminusX hminusLen (by + intro i _ + exact hfixedX i) hmissingXminus + +private theorem helper_continuation_769.{u_1, u_2} : + helperContinuation769Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha hterminal eta heta hgamma t htpos + hfirst H q A ell B X hprefixT hAX hXB hne hXlen hXmissingEta hmissingB hposEta hcase vB + htermNeV hdisjoint hpath hpenultimateMissing w sigma hsplitMissing n Tn hfixedPrefix + hrouteX hsuffix hstoredFirst + have hgammaCutoff : ∀ rho, rho ∈ HierarchyStoredColorsAt H q → + (alpha ∈ C.good.gamma q rho ∨ eta ∈ C.good.gamma q rho) → + (HierarchyFirstMissingPosition phi T rho).val ≤ X.length := by + have hreserved := GoodHierarchyReservedDisjoint C.good q + intro rho hrho haffected + rcases haffected with ha | hetaGamma + · by_cases heq : rho = eta + · subst rho + rw [hposEta, hXlen] + · have hdisj := C.good.disjointPairs q rho eta hrho heta heq + exact False.elim (Finset.disjoint_left.mp hdisj ha hgamma) + · have hm : eta ∈ + (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := + Finset.mem_biUnion.mpr ⟨rho, hrho, hetaGamma⟩ + exact False.elim (Finset.disjoint_left.mp hreserved.2 hm heta) + have splitTail := StableChangeCasesOneTwoSplitTail G k e0 input T phi ett + base C ctx alpha eta hne hmissingB (Sum.inl w) hpath sigma rfl hcase + hdisjoint X hAX (by rw [hXlen]; have := A.positive; omega) hXB + hfixedPrefix hrouteX hsuffix hsplitMissing hpenultimateMissing + hstoredFirst hgammaCutoff + obtain ⟨hweakFinal, hmodFinal, corrT, hmaximumT, baseT, K, goodT, + hsameGood⟩ := splitTail + have seriesProper : ∀ j : Fin (ett.rounds + 1), + IsProperEdgeColoring G (ett.series.data.coloring j) := by + intro j + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.1 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedProper + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => exact currentProper + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [currentColoring] + exact previousProper + have seriesOne : ∀ j : Fin (ett.rounds + 1), + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by + intro j + cases ett.series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + simpa [initialColoring] using triple.2.2.2.2 + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentColoring] + exact choice.selectedOneUncolored + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => exact currentOneUncolored + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [currentColoring] + exact previousOneUncolored + let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := { + replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := seriesProper + replacementOneUncolored := seriesOne + replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := { + coloring := phi + corresponding := selfCorr + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + minimumContext := ctx } + have hterminalEta : eta ∈ MissingColors G sigma (T.vertex (Fin.last T.length)) := by + have hbehavior := TwoColorComponentSwapMissingBehavior G phi alpha eta hne + ctx.proper (Sum.inl (T.vertex (Fin.last T.length))) + have hroot : Sum.inl (T.vertex (Fin.last T.length)) ∈ + TwoColorComponent G phi alpha eta (Sum.inl (T.vertex (Fin.last T.length))) := by + change Sum.inl (T.vertex (Fin.last T.length)) ∈ + (TwoColorIncidenceGraph G phi alpha eta).connectedComponentMk + (Sum.inl (T.vertex (Fin.last T.length))) + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + have h := hbehavior.2.1 (T.vertex (Fin.last T.length)) hroot hterminal + simpa [sigma] using h + have hXetaSigma : eta ∈ MissingColors G sigma (X.vertex (Fin.last X.length)) := by + rw [hpenultimateMissing _ vB] + exact hXmissingEta + let CSecond : HierarchyCounterexample baseT := { + positive := by rw [corrT.rungAgreement]; exact C.positive + hierarchy := K + good := goodT + maximum := hmaximumT + notElementary := by + intro helem + have hw : T.vertex (Fin.last T.length) ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last T.length, rfl⟩ + have hx : X.vertex (Fin.last X.length) ∈ TreeSequenceVertexSet T := + TreeSequenceInitialSegmentVertexSetSubset (hprefixT t) (by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.last X.length, rfl⟩) + exact (Finset.disjoint_left.mp (helem hw hx htermNeV) + hterminalEta hXetaSigma) } + obtain ⟨P, hPcolor⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi + ett base C ctx P0 sigma corrT baseT CSecond (by + dsimp only [P0, CSecond] + exact hsameGood) + refine ⟨P, ?_, ?_⟩ + · rw [hPcolor] + exact hterminalEta + · rw [hPcolor] + exact hXetaSigma + +private theorem helper_continuation_681.{u_1, u_2} : + helperContinuation681Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha hterminal eta heta hgamma t htpos + htupper hfirst H q A ell B X commonPrefix hB hAT hEll hEllAdd hprefixT hAX hXB hne hXlen + hBlen hXmissingEta hmissingB hposEta hnotSegment hchange hAlphaTn hAlphaTnq hcase vB + htermNeV hdisjoint hpath hpenultimateMissing w sigma hsplitMissing + have hchangeCases := StableChangeCasesOneTwo G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality hB ctx.largeMissingSet alpha eta hne hmissingB + (Sum.inl w) hpath sigma rfl hcase hdisjoint + obtain ⟨hweak, hmod, _, _⟩ := hchangeCases + have controls := P2813_T1_BaseControl G k e0 input T phi ett base C ctx + hB alpha eta hne hmissingB (Sum.inl w) hpath sigma rfl hcase hdisjoint + obtain ⟨hbase, _, hsproper, hsone, houtside⟩ := controls + have preStepElementary : + let i : Fin ett.rounds := ⟨ett.rounds - 1, by + have := C.positive + omega⟩ + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + dsimp only + by_cases hn : ett.rounds = 1 + · have hi : (⟨ett.rounds - 1, by omega⟩ : Fin ett.rounds).castSucc = 0 := + Fin.ext (by simp [hn]) + have ht : (Fin.last ett.rounds).castSucc = + (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := Fin.ext (by simp [hn]) + rw [hi, ht] + exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + · have hm : 1 < ett.rounds := by have := C.positive; omega + obtain ⟨pred, hpred, hmax, _, _⟩ := + CertifiedETTPredecessor G k e0 input T phi ett C.maximum hm + have ht : (Fin.last ett.rounds).castSucc = + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := Fin.ext rfl + rw [ht] + exact (ctx.lowerRung pred (by omega) (by omega) hmax).1 + have hfixedA := P2813_T1_DisplayedEdges G k e0 input T phi ett base H C.good + ctx.proper ctx.oneEdgeUncolored preStepElementary hB alpha eta (Sum.inl w) + sigma rfl hsone hbase houtside + have segTrans {U W Z : TreeSequence G e0} + (hUW : TreeSequenceInitialSegment U W) + (hWZ : TreeSequenceInitialSegment W Z) : TreeSequenceInitialSegment U Z := by + refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ + · intro i + exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) i)).trans (hUW.2.1 i) + · intro i + exact (hWZ.2.2 (Fin.castLE hUW.1 i)).trans (hUW.2.2 i) + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + induction d with + | zero => exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + have coreToA := @helper_coreToA_409 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base C alpha eta t segTrans stageSegment + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + have TnToCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · obtain ⟨union⟩ := (base.parallel hp).2.2 + exact union.leftSegment + · rw [base.nonparallel hp] + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have TnToA := segTrans TnToCore coreToA + have TnToX := commonPrefix (segTrans TnToA hAT) (hprefixT t) + (TnToA.1.trans hAX.1) + have terminalRoute := P2813_T1_TerminalRoute G k e0 input T phi ett + dsimp only at terminalRoute + have sourceRoute := @helper_sourceRoute_458 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C alpha eta t htpos hfirst commonPrefix hprefixT hAX + hXlen segTrans stageSegment TnToX terminalRoute + have hstageTerminal : H.stage q.succ = T := by + have hidx : q.succ = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + rfl + rw [hidx, H.terminalStage] + have hfixedPrefix := @helper_hfixedPrefix_551 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C alpha eta t htpos htupper hB hprefixT hXlen + hXmissingEta hposEta hnotSegment hbase terminalRoute hstageTerminal + have hrouteTransport := @helper_hrouteTransport_610 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C alpha eta t htpos hfirst hAT hprefixT hXB hXlen + hposEta hpenultimateMissing hfixedA hfixedPrefix + have hrouteX : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, ett.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X) := by + rcases sourceRoute with ⟨hp, hroute, hSX⟩ | ⟨hk, f, seed, hconn, hadjoin, + hroute, hSX⟩ + · exact Or.inl ⟨hp, hrouteTransport Tn hroute hSX⟩ + · exact Or.inr ⟨hk, f, seed, hconn, hadjoin, hrouteTransport seed hroute hSX⟩ + have hsuffix : TashkinovAugmentationSequence phi X T := by + rcases sourceRoute with ⟨hp, hroute, hSX⟩ | ⟨hk, f, seed, hconn, hadjoin, + hroute, hSX⟩ + · exact TashkinovAugmentationSequenceSuffix phi Tn X T hroute hSX (hprefixT t) + · exact TashkinovAugmentationSequenceSuffix phi seed X T hroute hSX (hprefixT t) + have firstLeColor (psi : PartialEdgeColoring E k) (c : Fin k) + (i : Fin (T.length + 1)) (hi : c ∈ MissingColors G psi (T.vertex i)) : + HierarchyFirstMissingPosition psi T c ≤ i := by + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + have hm : i ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ + have hn : candidates.Nonempty := ⟨i, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates i hm + have firstMemColor (psi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + have hstoredFirst : ∀ rho, rho ∈ HierarchyStoredColorsAt H q → + HierarchyFirstMissingPosition sigma T rho = + HierarchyFirstMissingPosition phi T rho := by + intro rho hrho + have early (i : Fin (T.length + 1)) (hi : i.val < T.length) : + MissingColors G sigma (T.vertex i) = MissingColors G phi (T.vertex i) := by + let j : Fin (B.length + 1) := ⟨i.val, by rw [hBlen]; omega⟩ + have hj : Fin.castLE (Nat.succ_le_succ (hprefixT (ell - 1)).1) j = i := + Fin.ext rfl + rw [← hj, (hprefixT (ell - 1)).2.1 j] + exact hpenultimateMissing (B.vertex j) (by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩) + apply Fin.ext + apply Nat.le_antisymm + · by_contra hn + have hlt : (HierarchyFirstMissingPosition phi T rho).val < T.length := by + have := (HierarchyFirstMissingPosition sigma T rho).isLt + omega + have hm := firstMemColor phi rho hlt + rw [← early _ hlt] at hm + have hle := firstLeColor sigma rho _ hm + omega + · by_contra hn + have hlt : (HierarchyFirstMissingPosition sigma T rho).val < T.length := by + have := (HierarchyFirstMissingPosition phi T rho).isLt + omega + have hm := firstMemColor sigma rho hlt + rw [early _ hlt] at hm + have hle := firstLeColor phi rho _ hm + omega + exact @helper_continuation_769 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@alpha) + (@hterminal) (@eta) (@heta) (@hgamma) (@t) (@htpos) (@hfirst) (@hprefixT) (@hAX) (@hXB) + (@hne) (@hXlen) (@hXmissingEta) (@hmissingB) (@hposEta) (@hcase) (@vB) (@htermNeV) + (@hdisjoint) (@hpath) (@hpenultimateMissing) (@hsplitMissing) (@hfixedPrefix) (@hrouteX) + (@hsuffix) (@hstoredFirst) +private theorem helper_continuation_649.{u_1, u_2} : + helperContinuation649Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha hterminal hstar eta heta hgamma t + htpos htupper hfirst H q A ell B X commonPrefix hB hAT htail hEll hEllAdd hprefixT hAB hAX + hXB hne hXlen hBlen hXmissingEta hmissingB alphaFirstBound hposEta hnotSegment horderedUnused + have hchange := ChangeLemma G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality hB ctx.largeMissingSet alpha eta hne hmissingB + horderedUnused + have hGammaStage : alpha ∈ HierarchyStageMissingColors H q := by + have hav := C.good.avoidance q eta heta + exact (Finset.mem_sdiff.mp (hav hgamma)).1 + have hAlphaTn : H.dividerCount = 0 → alpha ∈ TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + intro hz + have hq : q = 0 := by + apply Fin.ext + simp [q, hz] + rw [hq] at hGammaStage + simp only [HierarchyStageMissingColors, Fin.cases] at hGammaStage + exact hGammaStage + have hAlphaTnq : ∀ (_ : H.dividerCount ≠ 0), + alpha ∈ TreeMissingColors phi + (H.stage ⟨H.dividerCount, by omega⟩) := by + intro hz + have hqsucc : ∃ r : Fin H.dividerCount, q = r.succ := by + refine ⟨⟨H.dividerCount - 1, by omega⟩, ?_⟩ + apply Fin.ext + simp [q] + omega + obtain ⟨r, hr⟩ := hqsucc + rw [hr] at hGammaStage + change alpha ∈ TreeMissingColors phi (H.stage r.succ.castSucc) at hGammaStage + have hidx : r.succ.castSucc = (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := by + apply Fin.ext + have := congrArg Fin.val hr + simp [q] at this ⊢ + omega + simpa [hidx] using hGammaStage + have hcase : + (0 < H.dividerCount ∧ alpha ∈ TreeMissingColors phi + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi (ett.series.data.tree + (Fin.last ett.rounds).castSucc) ∨ + (alpha ∈ TreeMissingColors phi A ∧ + alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) ∧ + eta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)))) := by + by_cases hz : H.dividerCount = 0 + · right + refine ⟨hz, ?_⟩ + exact Or.inl (hAlphaTn hz) + · exact Or.inl ⟨Nat.pos_of_ne_zero hz, hAlphaTnq hz⟩ + have hsame : TwoColorComponent G phi alpha eta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T alpha))) = + TwoColorComponent G phi alpha eta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition phi T eta))) := by + dsimp only at hchange + by_cases hz : H.dividerCount = 0 + · exact hchange.2.1 ⟨hz, Or.inl (hAlphaTn hz)⟩ + · exact hchange.1 ⟨Nat.pos_of_ne_zero hz, Or.inl (hAlphaTnq hz)⟩ + have firstMem (c : Fin k) + (hlt : (HierarchyFirstMissingPosition phi T c).val < T.length) : + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) := by + let candidates := Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex i) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hval : (HierarchyFirstMissingPosition phi T c).val = T.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + have hfirstAlpha : alpha ∈ MissingColors G phi + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) := + firstMem alpha (by have := alphaFirstBound; have := hAT.1; omega) + have uB : T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ + TreeSequenceVertexSet B := by + have hi : (HierarchyFirstMissingPosition phi T alpha).val ≤ A.length := alphaFirstBound + have hlt : (HierarchyFirstMissingPosition phi T alpha).val < B.length + 1 := by + rw [hBlen] + omega + have ht : TreeSequenceInitialSegment A B := hAB + have hvertex : T.vertex (HierarchyFirstMissingPosition phi T alpha) ∈ + TreeSequenceVertexSet A := by + obtain ⟨i, hiEq⟩ : ∃ i : Fin (A.length + 1), + T.vertex (HierarchyFirstMissingPosition phi T alpha) = A.vertex i := by + refine ⟨⟨(HierarchyFirstMissingPosition phi T alpha).val, Nat.lt_succ_of_le hi⟩, ?_⟩ + have hidx : Fin.castLE (Nat.succ_le_succ hAT.1) + ⟨(HierarchyFirstMissingPosition phi T alpha).val, + Nat.lt_succ_of_le hi⟩ = HierarchyFirstMissingPosition phi T alpha := Fin.ext rfl + rw [← hAT.2.1 ⟨(HierarchyFirstMissingPosition phi T alpha).val, + Nat.lt_succ_of_le hi⟩, hidx] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, hiEq.symm⟩ + exact TreeSequenceInitialSegmentVertexSetSubset hAB hvertex + have vB : X.vertex (Fin.last X.length) ∈ TreeSequenceVertexSet B := + TreeSequenceInitialSegmentVertexSetSubset hXB (by simp [TreeSequenceVertexSet]) + have hterminalNotB : T.vertex (Fin.last T.length) ∉ TreeSequenceVertexSet B := by + intro hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + have hidx := T.vertex_injective ((hprefixT (ell - 1)).2.1 i |>.symm.trans hi) + have hvindex : i.val = T.length := by + have hh := congrArg Fin.val hidx + change i.val = T.length at hh + exact hh + have hi' : i.val < B.length + 1 := i.isLt + have hlen : B.length + 1 = T.length := by omega + omega + have htermNeU : T.vertex (Fin.last T.length) ≠ + T.vertex (HierarchyFirstMissingPosition phi T alpha) := by + intro heq + exact hterminalNotB (heq ▸ uB) + have htermNeV : T.vertex (Fin.last T.length) ≠ X.vertex (Fin.last X.length) := by + intro heq + exact hterminalNotB (heq ▸ vB) + have hVeqFirst : X.vertex (Fin.last X.length) = + T.vertex (HierarchyFirstMissingPosition phi T eta) := by + have hvertex := (hprefixT t).2.1 (Fin.last X.length) + have hidx : Fin.castLE (Nat.succ_le_succ (hprefixT t).1) (Fin.last X.length) = + HierarchyFirstMissingPosition phi T eta := by + apply Fin.ext + simp only [Fin.val_castLE, Fin.val_last] + rw [hposEta, hXlen] + rw [hidx] at hvertex + exact hvertex.symm + have terminalComponent := P2905_T2_ElementaryTerminalComponent G phi alpha eta hne + ctx.proper (TreeSequenceVertexSet B) hB + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (X.vertex (Fin.last X.length)) (T.vertex (Fin.last T.length)) + uB vB htermNeU htermNeV hfirstAlpha hXmissingEta (Or.inl hterminal) + (by simpa only [hVeqFirst] using hsame) + obtain ⟨hdisjoint, hpath, hpenultimateMissing⟩ := terminalComponent + let w := T.vertex (Fin.last T.length) + let sigma := TwoColorComponentSwap G phi alpha eta (Sum.inl w) + have hsplitMissing : alpha ∈ TreeMissingColors sigma X ∧ + eta ∈ TreeMissingColors sigma X := by + constructor + · obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hstar + have hvA : v ∈ TreeSequenceVertexSet A := hv + have hvB : v ∈ TreeSequenceVertexSet B := TreeSequenceInitialSegmentVertexSetSubset hAB hvA + have hmNew : alpha ∈ MissingColors G sigma v := by + rw [hpenultimateMissing v hvB] + exact hm + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset hAX hvA, hmNew⟩ + · exact Finset.mem_biUnion.mpr ⟨X.vertex (Fin.last X.length), + by simp [TreeSequenceVertexSet], by + rw [hpenultimateMissing (X.vertex (Fin.last X.length)) vB] + exact hXmissingEta⟩ + exact @helper_continuation_681 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@alpha) + (@hterminal) (@eta) (@heta) (@hgamma) (@t) (@htpos) (@htupper) (@hfirst) (@commonPrefix) + (@hB) (@hAT) (@hEll) (@hEllAdd) (@hprefixT) (@hAX) (@hXB) (@hne) (@hXlen) (@hBlen) + (@hXmissingEta) (@hmissingB) (@hposEta) (@hnotSegment) (@hchange) (@hAlphaTn) (@hAlphaTnq) + (@hcase) (@vB) (@htermNeV) (@hdisjoint) (@hpath) (@hpenultimateMissing) (@hsplitMissing) +theorem P2905_T2_LateOwnerReplacement {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (hpathLower : 2 ≤ HierarchyPathNumber C.hierarchy) + (hpathUpper : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (alpha : Fin k) + (hterminal : alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length))) + (hstar : alpha ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount))) + (eta : Fin k) (heta : eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last + C.hierarchy.dividerCount)) + (hgamma : alpha ∈ C.good.gamma (Fin.last C.hierarchy.dividerCount) eta) + (t : ℕ) (htpos : 1 ≤ t) (htupper : t < HierarchyFullTailLength C) + (_ : HierarchyPathNumber C.hierarchy - 1 ≤ t) + (hfirst : (HierarchyFirstMissingPosition phi T eta).val = + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + t) + (hmissing : eta ∈ MissingColors G phi + ((HierarchyFullTailPrefix C t).vertex + (Fin.last (HierarchyFullTailPrefix C t).length))) : + ∃ P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + eta ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)) ∧ + eta ∈ MissingColors G P.coloring + ((HierarchyFullTailPrefix C t).vertex + (Fin.last (HierarchyFullTailPrefix C t).length)) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := HierarchyFullTailLength C + let B := HierarchyFullTailPrefix C (ell - 1) + let X := HierarchyFullTailPrefix C t + have commonPrefix {U W Z : TreeSequence G e0} + (hUZ : TreeSequenceInitialSegment U Z) + (hWZ : TreeSequenceInitialSegment W Z) (hUW : U.length ≤ W.length) : + TreeSequenceInitialSegment U W := by + rcases hUZ with ⟨hu, huv, hue⟩ + rcases hWZ with ⟨hw, hwv, hwe⟩ + refine ⟨hUW, ?_, ?_⟩ + · intro i + exact (hwv (Fin.castLE (Nat.succ_le_succ hUW) i)).symm.trans (huv i) + · intro i + exact (hwe (Fin.castLE hUW i)).symm.trans (hue i) + have hB : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 input T phi + ett base C ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have hAT : TreeSequenceInitialSegment A T := by + have hnext (i : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H i) (H.stage i.succ) := + Fin.cases H.coreInsideFirst (fun i => H.nested i.succ) i + simpa [A, q, Fin.succ_last, H.terminalStage] using hnext q + have htail : 3 ≤ ell := by + change 2 ≤ HierarchyPathNumber H at hpathLower + change HierarchyPathNumber H < ell at hpathUpper + omega + have hEll : ell = T.length - A.length := by + rfl + have hEllAdd : A.length + ell = T.length := by + change A.length + (T.length - A.length) = T.length + exact Nat.add_sub_of_le hAT.1 + have hprefixLen (i : ℕ) (hi : i ≤ ell) : + (HierarchyFullTailPrefix C i).length = A.length + i := by + change min (A.length + i) T.length = A.length + i + apply Nat.min_eq_left + rw [← hEllAdd] + omega + have hprefixT (i : ℕ) : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C i) T := by + change TreeSequenceInitialSegment (TreeSequencePrefix T _ _ _) T + exact ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hAB : TreeSequenceInitialSegment A B := by + have hlen := hprefixLen (ell - 1) (by omega) + exact commonPrefix hAT (hprefixT _) (by rw [hlen]; omega) + have hAX : TreeSequenceInitialSegment A X := by + have hlen := hprefixLen t (by omega) + exact commonPrefix hAT (hprefixT _) (by rw [hlen]; omega) + have hXB : TreeSequenceInitialSegment X B := by + have htlen := hprefixLen t (by omega) + have hblen := hprefixLen (ell - 1) (by omega) + exact commonPrefix (hprefixT t) (hprefixT (ell - 1)) (by rw [htlen, hblen]; omega) + have hne : alpha ≠ eta := by + intro he + have hmissA : alpha ∈ TreeMissingColors phi A := by + simpa [A, q, H] using hstar + have hnotA : eta ∉ TreeMissingColors phi A := by + have hstored : eta ∈ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) \ + TreeMissingColors phi A := by + simpa [HierarchyStoredColorsAt, A, q, H] using heta + exact (Finset.mem_sdiff.mp hstored).2 + subst alpha + exact hnotA hmissA + have hXlen : X.length = A.length + t := by + change (HierarchyFullTailPrefix C t).length = A.length + t + exact hprefixLen t (by omega) + have hBlen : B.length = T.length - 1 := by + have hp := hprefixLen (ell - 1) (by omega) + change B.length = A.length + (ell - 1) at hp + rw [hEll] at hp + omega + have hXmissingEta : eta ∈ MissingColors G phi + (X.vertex (Fin.last X.length)) := by + change eta ∈ MissingColors G phi + ((HierarchyFullTailPrefix C t).vertex + (Fin.last (HierarchyFullTailPrefix C t).length)) + exact hmissing + have hmissingB : alpha ∈ TreeMissingColors phi B ∧ eta ∈ TreeMissingColors phi B := by + constructor + · obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hstar + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset hAB hv, hm⟩ + · exact Finset.mem_biUnion.mpr ⟨X.vertex (Fin.last X.length), + TreeSequenceInitialSegmentVertexSetSubset hXB + (by simp [TreeSequenceVertexSet]), hXmissingEta⟩ + have firstLe (c : Fin k) (i : Fin (T.length + 1)) + (hi : c ∈ MissingColors G phi (T.vertex i)) : + HierarchyFirstMissingPosition phi T c ≤ i := by + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex j) + have hm : i ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ + have hn : candidates.Nonempty := ⟨i, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates i hm + have alphaFirstBound : + (HierarchyFirstMissingPosition phi T alpha).val ≤ A.length := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hstar + obtain ⟨i, hi⟩ : ∃ i, A.vertex i = v := by + simpa [TreeSequenceVertexSet] using hv + have hmiss : alpha ∈ MissingColors G phi + (T.vertex (Fin.castLE (Nat.succ_le_succ hAT.1) i)) := by + rw [hAT.2.1 i, hi] + exact hm + have hle := firstLe alpha _ hmiss + change (HierarchyFirstMissingPosition phi T alpha).val ≤ i.val at hle + have := i.isLt + omega + have hposEta : (HierarchyFirstMissingPosition phi T eta).val = A.length + t := by + simpa [A, q, H] using hfirst + have hfirstOrder : TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T eta)) := by + exact ⟨_, _, rfl, rfl, by rw [hposEta]; omega⟩ + have hnotSegment : alpha ∉ HierarchySegmentColors H q eta := by + intro hs + have hav := C.good.avoidance q eta heta + exact (Finset.mem_sdiff.mp (hav hgamma)).2 hs + have horderedUnused : + (alpha ∉ TreeMissingColors phi A ∨ eta ∉ TreeMissingColors phi A) → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T eta)) ∧ + alpha ∉ Finset.univ.filter (fun c => ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < (HierarchyFirstMissingPosition phi T eta).val ∧ + phi (T.edge r) = some c) := by + intro _ + refine ⟨hfirstOrder, ?_⟩ + intro hmem + obtain ⟨_, r, hrA, hrpos, hcolor⟩ := Finset.mem_filter.mp hmem + have hstage : H.stage q.succ = T := by + rw [show q.succ = Fin.last (H.dividerCount + 1) by + apply Fin.ext + rfl, H.terminalStage] + have hsegment : alpha ∈ HierarchySegmentColors H q eta := by + rw [HierarchySegmentColors] + rw [hstage] + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨r, hrA, ?_, ?_⟩ + · rw [hposEta] + have hcut : A.length + t < T.length := by + rw [← hEllAdd] + omega + have hrfirst : r.val < A.length + t := by + rw [← hposEta] + exact hrpos + exact lt_min hrfirst (lt_trans hrfirst hcut) + · exact hcolor + exact hnotSegment hsegment + exact @helper_continuation_649 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@alpha) + (@hterminal) (@hstar) (@eta) (@heta) (@hgamma) (@t) (@htpos) (@htupper) (@hfirst) + (@commonPrefix) (@hB) (@hAT) (@htail) (@hEll) (@hEllAdd) (@hprefixT) (@hAB) (@hAX) (@hXB) + (@hne) (@hXlen) (@hBlen) (@hXmissingEta) (@hmissingB) (@alphaFirstBound) (@hposEta) + (@hnotSegment) (@horderedUnused) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/LooplessMultigraph.lean b/LeanPool/GoldbergSeymour/LooplessMultigraph.lean new file mode 100644 index 0000000000..63a33853a9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/LooplessMultigraph.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Preamble + +/-! +# Loopless Multigraph + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- A multigraph with independently identified edges, unordered endpoint pairs and no loops. -/ +structure LooplessMultigraph (V E : Type*) where + /-- The unordered pair of endpoints of each independently identified edge. -/ + ends : E → Sym2 V + loopless : ∀ e v, ends e ≠ s(v, v) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/LowerRoundInductionHypothesis.lean b/LeanPool/GoldbergSeymour/LowerRoundInductionHypothesis.lean new file mode 100644 index 0000000000..f9fc9e765f --- /dev/null +++ b/LeanPool/GoldbergSeymour/LowerRoundInductionHypothesis.lean @@ -0,0 +1,45 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex + +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.ModColoring + +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex + +public import LeanPool.GoldbergSeymour.TreeInterchangeable + +public import LeanPool.GoldbergSeymour.LowerRoundProperties + +/-! +# Lower-round induction hypothesis + +The complete six-part induction package for smaller extended Tashkinov trees. +Factored from the repeated hypotheses in Wesley Pegden’s formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Elementarity, interchangeability, stability, separation and recoloring +properties assumed for every positive smaller number of extension rounds. -/ +def LowerRoundInductionHypothesis {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (rounds : ℕ) : Prop := + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), 0 < lower.rounds → lower.rounds < rounds → MaximumProperty lower → (open + scoped Classical in LowerRoundProperties lower) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/LowerRoundProperties.lean b/LeanPool/GoldbergSeymour/LowerRoundProperties.lean new file mode 100644 index 0000000000..af456fe36d --- /dev/null +++ b/LeanPool/GoldbergSeymour/LowerRoundProperties.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex + +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.ModColoring + +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex + +public import LeanPool.GoldbergSeymour.TreeInterchangeable + +/-! +# Lower-round induction properties + +The six conclusions of the extension-round induction: elementarity, +interchangeability, stability, separation, defective-colour order and recolouring. +The input colouring and tree are parameters, so the same package can be used +with both fixed-input and unrestricted induction hypotheses. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The complete six-part property proved at an extension-induction stage. -/ +def LowerRoundProperties {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating') : Prop := + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T') ∧ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tnext : TreeSequence G e0 := lower.series.data.tree (Fin.last (lower.rounds + 1)) + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma Tnext) → + TreeInterchangeable G Tnext sigma alpha beta) ∧ + ((∀ (q : Fin lower.rounds) (v : V), + lower.series.data.kind q.succ = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex q.succ = some v → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T', + ∀ j : Fin (lower.rounds + 1), + ETTFirstAppearanceIndex lower v hvFinal = j.val + 1 → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (lower.series.data.tree q.succ.castSucc) + (TashkinovStoredColors lower.series.data q.succ) (lower.series.data.coloring q.succ) + sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma ∧ + (0 < j.val → + StableColoring (lower.series.data.tree j.castSucc) + (TashkinovStoredColors lower.series.data j) (lower.series.data.coloring j) + sigma)) ∧ + ∀ (q r : Fin lower.rounds) (vq vr : V), + q ≠ r → + vq ≠ vr → + lower.series.data.kind q.succ = some TashkinovExtensionKind.PE → + lower.series.data.kind r.succ = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex q.succ = some vq → + lower.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex lower vq hvq = ETTFirstAppearanceIndex lower vr hvr → + Disjoint (lower.series.data.stored q.succ) (lower.series.data.stored r.succ)) ∧ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc + ∀ (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex n = some v → + lower.series.data.gamma n = some gamma → + lower.series.data.delta n = some delta → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ w, + w ∈ TreeSequenceVertexSet Tn → + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ w = v)) ∧ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (delta : Fin k), + DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ (v : V), + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → + (∃ w, + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ + TreeVertexOrder Tn w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin lower.rounds) (vi : V), + (lower.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ + lower.series.data.kind q.succ = some TashkinovExtensionKind.SE) → + lower.series.data.chosenVertex q.succ = some vi → + ETTFirstAppearanceIndex lower v hvFinal ≤ q.val + 1 → + v = vi ∨ TreeVertexOrder T' v vi) ∧ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ModColoring lower sigma) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MaximumDefectiveChoice.lean b/LeanPool/GoldbergSeymour/MaximumDefectiveChoice.lean new file mode 100644 index 0000000000..e1cbec101a --- /dev/null +++ b/LeanPool/GoldbergSeymour/MaximumDefectiveChoice.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TreeVertexOrder + +/-! +# Maximum Defective Choice + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- +A stable coloring with a latest possible defective vertex and a chosen incident defective edge. -/ +structure MaximumDefectiveChoice {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) + {k : ℕ} (e0 : E) (T : TreeSequence G e0) (C : Finset (Fin k)) + (phi : PartialEdgeColoring E k) where + /-- The chosen stable coloring. -/ + selected : PartialEdgeColoring E k + selectedProper : IsProperEdgeColoring G selected + selectedOneUncolored : IsOneEdgeUncolored selected e0 + selectedStable : StableColoring T C phi selected + /-- The selected vertex, or ordered vertices when the field is indexed. -/ + vertex : V + vertexDefective : DefectiveVertex G selected (TreeSequenceVertexSet T) vertex + maximal : + ∀ (pi : PartialEdgeColoring E k) (w : V), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 + → StableColoring T C phi pi → DefectiveVertex G pi (TreeSequenceVertexSet T) w → w = + vertex ∨ TreeVertexOrder T w vertex + /-- The selected edge, or ordered edges when the field is indexed. -/ + edge : E + edgeDefective : DefectiveEdge G selected (TreeSequenceVertexSet T) edge + edgeIncident : Incident G vertex edge + /-- The endpoint of the selected defective edge lying outside the tree. -/ + otherEndpoint : V + otherOutside : otherEndpoint ∉ TreeSequenceVertexSet T + edgeEnds : G.ends edge = s(vertex, otherEndpoint) + /-- The assigned color of the selected defective edge. -/ + color : Fin k + edgeColor : selected edge = some color + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MaximumDefectiveChoiceExists.lean b/LeanPool/GoldbergSeymour/MaximumDefectiveChoiceExists.lean new file mode 100644 index 0000000000..b4e40409b8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/MaximumDefectiveChoiceExists.lean @@ -0,0 +1,144 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Finset.Max + +public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed + +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice + +/-! +# Maximum Defective Choice Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem MaximumDefectiveChoiceExists {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : Nat} (e0 : E) + (T : TreeSequence G e0) (C : Finset (Fin k)) + (phi : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T)) + (hnotStrong : + ¬ ColoredVertexSetStronglyClosed G phi (TreeSequenceVertexSet T)) : + Nonempty (MaximumDefectiveChoice G e0 T C phi) := by + classical + let X := TreeSequenceVertexSet T + have hrepeat : exists f g c, + f ∈ BoundaryEdges G X ∧ g ∈ BoundaryEdges G X ∧ f ≠ g ∧ + phi f = some c ∧ phi g = some c := by + unfold ColoredVertexSetStronglyClosed at hnotStrong + push Not at hnotStrong + exact hnotStrong hclosed + obtain ⟨f, g, c, hf, hg, hfg, hfc, hgc⟩ := hrepeat + have hfcolor : f ∈ BoundaryColorEdges G phi X c := by + simp [BoundaryColorEdges, hf, hfc] + have hgcolor : g ∈ BoundaryColorEdges G phi X c := by + simp [BoundaryColorEdges, hg, hgc] + have hcdef : DefectiveColor G phi X c := by + unfold DefectiveColor + have hsubset : ({f, g} : Finset E) ⊆ BoundaryColorEdges G phi X c := by + intro a ha + simp only [Finset.mem_insert, Finset.mem_singleton] at ha + rcases ha with rfl | rfl + · exact hfcolor + · exact hgcolor + have hcard : ({f, g} : Finset E).card = 2 := by simp [hfg] + rw [← hcard] + exact Finset.card_le_card hsubset + obtain ⟨v, hvX, u, huX, hfends⟩ := by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + using hf + have hfdef : DefectiveEdge G phi X f := ⟨c, hcdef, hfcolor⟩ + have hvf : Incident G v f := by + change v ∈ G.ends f + rw [hfends] + simp + have hvdef : DefectiveVertex G phi X v := ⟨hvX, f, hfdef, hvf⟩ + let eligible : Finset (Fin (T.length + 1)) := Finset.univ.filter fun i => + exists pi : PartialEdgeColoring E k, + IsProperEdgeColoring G pi ∧ IsOneEdgeUncolored pi e0 ∧ + StableColoring T C phi pi ∧ DefectiveVertex G pi X (T.vertex i) + have hvindex : exists i : Fin (T.length + 1), T.vertex i = v := by + simp only [X, TreeSequenceVertexSet, Finset.mem_image] at hvX + obtain ⟨i, _, hi⟩ := hvX + exact ⟨i, hi⟩ + obtain ⟨iv, hiv⟩ := hvindex + have hivEligible : iv ∈ eligible := by + simp only [eligible, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨phi, hproper, hone, ?_, ?_⟩ + · unfold StableColoring + exact ⟨by intros; rfl, by intros; rfl⟩ + · simpa [hiv] using hvdef + have heligible : eligible.Nonempty := ⟨iv, hivEligible⟩ + let imax : Fin (T.length + 1) := eligible.max' heligible + have himaxEligible : imax ∈ eligible := Finset.max'_mem eligible heligible + obtain ⟨selected, hselectedProper, hselectedOne, hselectedStable, + hselectedDefective⟩ := by + simpa only [eligible, Finset.mem_filter, Finset.mem_univ, true_and] + using himaxEligible + obtain ⟨edge, hedgeDefective, hedgeIncident⟩ := hselectedDefective.2 + obtain ⟨color, hcolorDefective, hedgeColorMem⟩ := hedgeDefective + have hedgeBoundary : edge ∈ BoundaryEdges G X := by + exact (Finset.mem_filter.mp hedgeColorMem).1 + have hedgeColor : selected edge = some color := by + exact (Finset.mem_filter.mp hedgeColorMem).2 + obtain ⟨inside, hinsideX, outside, houtsideX, hedgeEnds⟩ := by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + using hedgeBoundary + have hvertexEq : T.vertex imax = inside := by + have hmem : T.vertex imax = inside ∨ T.vertex imax = outside := by + change T.vertex imax ∈ G.ends edge at hedgeIncident + rw [hedgeEnds] at hedgeIncident + simpa using hedgeIncident + rcases hmem with h | h + · exact h + · exact (houtsideX (h ▸ hselectedDefective.1)).elim + refine ⟨{ + selected := selected + selectedProper := hselectedProper + selectedOneUncolored := hselectedOne + selectedStable := hselectedStable + vertex := T.vertex imax + vertexDefective := hselectedDefective + maximal := ?_ + edge := edge + edgeDefective := ⟨color, hcolorDefective, hedgeColorMem⟩ + edgeIncident := hedgeIncident + otherEndpoint := outside + otherOutside := houtsideX + edgeEnds := by simpa [hvertexEq] using hedgeEnds + color := color + edgeColor := hedgeColor }⟩ + intro pi w hpiProper hpiOne hpiStable hwDefective + have hwX := hwDefective.1 + obtain ⟨iw, hiw⟩ : exists iw : Fin (T.length + 1), T.vertex iw = w := by + simp only [TreeSequenceVertexSet, Finset.mem_image] at hwX + obtain ⟨iw, _, hiw⟩ := hwX + exact ⟨iw, hiw⟩ + have hiwEligible : iw ∈ eligible := by + simp only [eligible, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨pi, hpiProper, hpiOne, hpiStable, by simpa [hiw] using hwDefective⟩ + have hiwLe : iw ≤ imax := Finset.le_max' eligible iw hiwEligible + rcases hiwLe.eq_or_lt with hEq | hLt + · left + simpa [hiw] using congrArg T.vertex hEq + · right + exact ⟨iw, imax, hiw, rfl, hLt⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MaximumDegree.lean b/LeanPool/GoldbergSeymour/MaximumDegree.lean new file mode 100644 index 0000000000..0ccc782e6a --- /dev/null +++ b/LeanPool/GoldbergSeymour/MaximumDegree.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Finset.Max +public import LeanPool.GoldbergSeymour.Degree + +/-! +# Maximum Degree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The largest vertex degree, with zero included to handle an empty vertex type. -/ +noncomputable def MaximumDegree {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) : + ℕ := by classical exact (insert 0 (Finset.univ.image fun v => Degree G v)).max' (by simp) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MaximumDegreeRestrict.lean b/LeanPool/GoldbergSeymour/MaximumDegreeRestrict.lean new file mode 100644 index 0000000000..bbc30a40bb --- /dev/null +++ b/LeanPool/GoldbergSeymour/MaximumDegreeRestrict.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.Sets + +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.RestrictEdges + +/-! +# Maximum Degree Restrict + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem MaximumDegreeRestrict {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (F : Finset E) : + MaximumDegree (RestrictEdges G F) ≤ MaximumDegree G := by + classical + unfold MaximumDegree + have degree_le (v : V) : Degree (RestrictEdges G F) v ≤ Degree G v := by + unfold Degree + apply Finset.card_le_card_of_injOn (fun e : {e // e ∈ F} => e.1) + · intro e he + have filtered := Finset.mem_filter.mp he + have incident : v ∈ G.ends e.1 := by + simpa [Incident, RestrictEdges] using filtered.2 + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, incident⟩ + · intro a ha b hb hab + exact Subtype.ext hab + apply Finset.max'_le + intro n hn + simp only [Finset.mem_insert, Finset.mem_image] at hn + rcases hn with rfl | ⟨v, hv, hdeg⟩ + · exact Nat.zero_le _ + · rw [← hdeg] + have member : Degree G v ∈ insert 0 (Finset.image (fun v => Degree G v) Finset.univ) := + Finset.mem_insert_of_mem (Finset.mem_image.2 ⟨v, Finset.mem_univ _, rfl⟩) + exact (degree_le v).trans (Finset.le_max' + (insert 0 (Finset.image (fun v => Degree G v) Finset.univ)) (Degree G v) member) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MaximumProperty.lean b/LeanPool/GoldbergSeymour/MaximumProperty.lean new file mode 100644 index 0000000000..cd400cf585 --- /dev/null +++ b/LeanPool/GoldbergSeymour/MaximumProperty.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +public import LeanPool.GoldbergSeymour.TashkinovOrder + +/-! +# Maximum Property + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Maximum first-rung order and maximality of intermediate extension closures under stable +recolorings. +-/ +def MaximumProperty {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) : Prop := + let T1 : TreeSequence G e0 := ett.series.data.tree ⟨1, by omega⟩ + (TreeSequenceVertexSet T1).card = TashkinovOrder G ∧ + ∀ (i : ℕ) (hi : 1 ≤ i) (hbeforeLast : i < ett.rounds), + let idx : Fin (ett.rounds + 1) := ⟨i, by omega⟩ + let nextIdx : Fin (ett.rounds + 2) := ⟨i + 1, by omega⟩ + let Ti : TreeSequence G e0 := ett.series.data.tree idx.castSucc + ∀ (pi : PartialEdgeColoring E k) (seed candidate : TreeSequence G e0), + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring Ti (TashkinovStoredColors ett.series.data idx) (ett.series.data.coloring idx) + pi → + ((ett.series.data.kind idx = some TashkinovExtensionKind.PE ∧ seed = Ti) ∨ + ((ett.series.data.kind idx = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind idx = some TashkinovExtensionKind.RE) ∧ + ∃ f : E, + ett.series.data.connectingEdges idx = { f } ∧ TreeSequenceAdjoinEdge Ti f seed)) → + TashkinovClosure pi seed candidate → + (TreeSequenceVertexSet candidate).card ≤ + (TreeSequenceVertexSet (ett.series.data.tree nextIdx)).card + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MaximumPropertyAppend.lean b/LeanPool/GoldbergSeymour/MaximumPropertyAppend.lean new file mode 100644 index 0000000000..88eb8f13f3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/MaximumPropertyAppend.lean @@ -0,0 +1,209 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MaximumProperty + +public import LeanPool.GoldbergSeymour.TashkinovSeriesFinalETTExists +public import LeanPool.GoldbergSeymour.TashkinovStoredColorsAppend +public import LeanPool.GoldbergSeymour.TerminalClosureMaximum + +/-! +# Maximum Property Append + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem MaximumPropertyAppend + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hterminal : TerminalClosureMaximum ett) + (newTree : TreeSequence G e0) + (newColoring : PartialEdgeColoring E k) + (newStored : Finset (Fin k)) + (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) + (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)) + (extended : TashkinovSeries G k (ett.rounds + 1) e0 input) + (happend : extended.data = + TashkinovSeriesDataAppend ett.series.data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma) : + exists newETT : ExtendedTashkinovTree G k e0 input + (extended.data.tree (Fin.last ((ett.rounds + 1) + 1))) + (extended.data.coloring (Fin.last (ett.rounds + 1))), + newETT.rounds = ett.rounds + 1 /\ + HEq newETT.series extended /\ + MaximumProperty newETT := by + classical + obtain ⟨newETT, hrounds, hseries⟩ := + TashkinovSeriesFinalETTExists G k (ett.rounds + 1) e0 input extended (by omega) + refine ⟨newETT, hrounds, hseries, ?_⟩ + cases newETT with + | mk newRounds newRoundsPositive newSeries above strict below generatingEq => + dsimp at hrounds + subst newRounds + have seriesEq : newSeries = extended := eq_of_heq hseries + subst newSeries + rcases hMP with ⟨hfirst, hold⟩ + unfold MaximumProperty + constructor + · let oldOne : Fin (ett.rounds + 2) := ⟨1, by omega⟩ + let newOne : Fin ((ett.rounds + 1) + 2) := ⟨1, by omega⟩ + have oneEq : newOne = oldOne.castSucc := by ext; rfl + have firstTree : extended.data.tree newOne = + ett.series.data.tree oldOne := by + rw [happend, oneEq] + simp [TashkinovSeriesDataAppend] + rw [firstTree] + simpa [newOne, oldOne] using hfirst + · intro i hi hlast + dsimp + intro pi seed candidate proper one stable seedRoute closure + by_cases hiold : i < ett.rounds + · let oldIdx : Fin (ett.rounds + 1) := ⟨i, by omega⟩ + let newIdx : Fin ((ett.rounds + 1) + 1) := ⟨i, by omega⟩ + let oldNext : Fin (ett.rounds + 2) := ⟨i + 1, by omega⟩ + let newNext : Fin ((ett.rounds + 1) + 2) := ⟨i + 1, by omega⟩ + have indexEq : newIdx = oldIdx.castSucc := by ext; rfl + have treeIndexEq : newIdx.castSucc = oldIdx.castSucc.castSucc := by + rw [indexEq] + have nextIndexEq : newNext = oldNext.castSucc := by ext; rfl + have treeEq : extended.data.tree newIdx.castSucc = + ett.series.data.tree oldIdx.castSucc := by + rw [happend, treeIndexEq] + simp [TashkinovSeriesDataAppend] + have coloringEq : extended.data.coloring newIdx = + ett.series.data.coloring oldIdx := by + rw [happend, indexEq] + simp [TashkinovSeriesDataAppend] + have kindEq : extended.data.kind newIdx = ett.series.data.kind oldIdx := by + rw [happend, indexEq] + simp [TashkinovSeriesDataAppend] + have edgesEq : extended.data.connectingEdges newIdx = + ett.series.data.connectingEdges oldIdx := by + rw [happend, indexEq] + simp [TashkinovSeriesDataAppend] + have storedEq : TashkinovStoredColors extended.data newIdx = + TashkinovStoredColors ett.series.data oldIdx := by + rw [happend, indexEq] + have h := TashkinovStoredColorsAppend ett.series.data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma oldIdx + exact h + have nextEq : extended.data.tree newNext = ett.series.data.tree oldNext := by + rw [happend, nextIndexEq] + simp [TashkinovSeriesDataAppend] + have stableOld : StableColoring (ett.series.data.tree oldIdx.castSucc) + (TashkinovStoredColors ett.series.data oldIdx) + (ett.series.data.coloring oldIdx) pi := by + rw [← treeEq, ← storedEq, ← coloringEq] + simpa [newIdx] using stable + have routeOld : + (ett.series.data.kind oldIdx = some TashkinovExtensionKind.PE /\ + seed = ett.series.data.tree oldIdx.castSucc) \/ + ((ett.series.data.kind oldIdx = some TashkinovExtensionKind.SE \/ + ett.series.data.kind oldIdx = some TashkinovExtensionKind.RE) /\ + exists f : E, ett.series.data.connectingEdges oldIdx = {f} /\ + TreeSequenceAdjoinEdge + (ett.series.data.tree oldIdx.castSucc) f seed) := by + rcases seedRoute with hPE | hSER + · left + exact ⟨kindEq.symm.trans hPE.1, hPE.2.trans treeEq⟩ + · right + rcases hSER with ⟨hk, f, he, hs⟩ + refine ⟨?_, f, ?_, ?_⟩ + · rcases hk with hk | hk + · exact Or.inl (kindEq.symm.trans hk) + · exact Or.inr (kindEq.symm.trans hk) + · exact edgesEq.symm.trans he + · rw [← treeEq] + exact hs + have bound := hold i hi hiold pi seed candidate proper one stableOld + routeOld closure + rw [nextEq] + simpa [newNext, oldNext] using bound + · have hlast' : i < ett.rounds + 1 := by + simpa using hlast + have hieq : i = ett.rounds := by omega + subst i + let oldIdx : Fin (ett.rounds + 1) := Fin.last ett.rounds + let newIdx : Fin ((ett.rounds + 1) + 1) := ⟨ett.rounds, by omega⟩ + let oldNext : Fin (ett.rounds + 2) := Fin.last (ett.rounds + 1) + let newNext : Fin ((ett.rounds + 1) + 2) := + ⟨ett.rounds + 1, by omega⟩ + have indexEq : newIdx = oldIdx.castSucc := by ext; rfl + have treeIndexEq : newIdx.castSucc = oldIdx.castSucc.castSucc := by + rw [indexEq] + have nextIndexEq : newNext = oldNext.castSucc := by ext; rfl + have treeEq : extended.data.tree newIdx.castSucc = + ett.series.data.tree oldIdx.castSucc := by + rw [happend, treeIndexEq] + simp [TashkinovSeriesDataAppend] + have coloringEq : extended.data.coloring newIdx = + ett.series.data.coloring oldIdx := by + rw [happend, indexEq] + simp [TashkinovSeriesDataAppend] + have kindEq : extended.data.kind newIdx = ett.series.data.kind oldIdx := by + rw [happend, indexEq] + simp [TashkinovSeriesDataAppend] + have edgesEq : extended.data.connectingEdges newIdx = + ett.series.data.connectingEdges oldIdx := by + rw [happend, indexEq] + simp [TashkinovSeriesDataAppend] + have storedEq : TashkinovStoredColors extended.data newIdx = + TashkinovStoredColors ett.series.data oldIdx := by + rw [happend, indexEq] + have h := TashkinovStoredColorsAppend ett.series.data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma oldIdx + exact h + have nextEq : extended.data.tree newNext = ett.series.data.tree oldNext := by + rw [happend, nextIndexEq] + simp [TashkinovSeriesDataAppend] + have stableOld : StableColoring (ett.series.data.tree oldIdx.castSucc) + (TashkinovStoredColors ett.series.data oldIdx) + (ett.series.data.coloring oldIdx) pi := by + rw [← treeEq, ← storedEq, ← coloringEq] + simpa [newIdx] using stable + have routeOld : + (ett.series.data.kind oldIdx = some TashkinovExtensionKind.PE /\ + seed = ett.series.data.tree oldIdx.castSucc) \/ + ((ett.series.data.kind oldIdx = some TashkinovExtensionKind.SE \/ + ett.series.data.kind oldIdx = some TashkinovExtensionKind.RE) /\ + exists f : E, ett.series.data.connectingEdges oldIdx = {f} /\ + TreeSequenceAdjoinEdge + (ett.series.data.tree oldIdx.castSucc) f seed) := by + rcases seedRoute with hPE | hSER + · left + exact ⟨kindEq.symm.trans hPE.1, hPE.2.trans treeEq⟩ + · right + rcases hSER with ⟨hk, f, he, hs⟩ + refine ⟨?_, f, ?_, ?_⟩ + · rcases hk with hk | hk + · exact Or.inl (kindEq.symm.trans hk) + · exact Or.inr (kindEq.symm.trans hk) + · exact edgesEq.symm.trans he + · rw [← treeEq] + exact hs + have bound := hterminal pi seed candidate proper one stableOld routeOld closure + rw [nextEq] + simpa [newNext, oldNext] using bound + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MaximumPropertyPrefix.lean b/LeanPool/GoldbergSeymour/MaximumPropertyPrefix.lean new file mode 100644 index 0000000000..8b1267858f --- /dev/null +++ b/LeanPool/GoldbergSeymour/MaximumPropertyPrefix.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MaximumProperty + +/-! +# Maximum Property Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem MaximumPropertyPrefix {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (m : ℕ) + (hmPositive : 1 ≤ m) (hmBefore : m < ett.rounds) + {restrictedTree : TreeSequence G e0} + {restrictedColoring : PartialEdgeColoring E k} + (restricted : ExtendedTashkinovTree G k e0 input + restrictedTree restrictedColoring) + (hr : restricted.rounds = m) + (tree_eq : ∀ i : Fin (restricted.rounds + 2), + restricted.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) + (data_eq : ∀ i : Fin (restricted.rounds + 1), + restricted.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + restricted.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + restricted.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors restricted.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i)) : + MaximumProperty restricted := by + unfold MaximumProperty at hMP ⊢ + dsimp only at hMP ⊢ + constructor + · have htreeOne := tree_eq (⟨1, by omega⟩ : Fin (restricted.rounds + 2)) + have hcastOne : Fin.castLE (by omega) + (⟨1, by omega⟩ : Fin (restricted.rounds + 2)) = + (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + rw [hcastOne] at htreeOne + rw [htreeOne] + exact hMP.1 + · intro i hi hbefore pi seed candidate hproper hone hstable hroute hclosure + have holdBefore : i < ett.rounds := by omega + let restrictedIdx : Fin (restricted.rounds + 1) := ⟨i, by omega⟩ + let oldIdx : Fin (ett.rounds + 1) := ⟨i, by omega⟩ + have hcastIdx : Fin.castLE (by omega) restrictedIdx = oldIdx := by + apply Fin.ext + rfl + have hcastTree : Fin.castLE (by omega) restrictedIdx.castSucc = + oldIdx.castSucc := by + apply Fin.ext + rfl + have hTi : restricted.series.data.tree restrictedIdx.castSucc = + ett.series.data.tree oldIdx.castSucc := by + rw [tree_eq] + rw [hcastTree] + have hcastNext : Fin.castLE (by omega) + (⟨i + 1, by omega⟩ : Fin (restricted.rounds + 2)) = + (⟨i + 1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + have hnext : restricted.series.data.tree (⟨i + 1, by omega⟩) = + ett.series.data.tree (⟨i + 1, by omega⟩) := by + rw [tree_eq] + rw [hcastNext] + rcases data_eq restrictedIdx with ⟨hcolor, hedges, hkind, hstored⟩ + rw [hcastIdx] at hcolor hedges hkind hstored + have hstableOld : StableColoring + (ett.series.data.tree oldIdx.castSucc) + (TashkinovStoredColors ett.series.data oldIdx) + (ett.series.data.coloring oldIdx) pi := by + rw [← hTi, ← hstored, ← hcolor] + exact hstable + have hrouteOld : + ((ett.series.data.kind oldIdx = some TashkinovExtensionKind.PE ∧ + seed = ett.series.data.tree oldIdx.castSucc) ∨ + ((ett.series.data.kind oldIdx = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind oldIdx = some TashkinovExtensionKind.RE) ∧ + ∃ f : E, ett.series.data.connectingEdges oldIdx = {f} ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree oldIdx.castSucc) f seed)) := by + rw [← hTi, ← hedges, ← hkind] + exact hroute + have bound := hMP.2 i hi holdBefore pi seed candidate hproper hone + hstableOld hrouteOld hclosure + rw [hnext] + exact bound + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MaximumPropertyTransport.lean b/LeanPool/GoldbergSeymour/MaximumPropertyTransport.lean new file mode 100644 index 0000000000..2fb825a74d --- /dev/null +++ b/LeanPool/GoldbergSeymour/MaximumPropertyTransport.lean @@ -0,0 +1,197 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesColoringProperties + +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.ModColoring + +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Maximum Property Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem MaximumPropertyTransport {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 input T generating) + (sigmaN : PartialEdgeColoring E k) (_ : ModColoring base sigmaN) + (Tstar : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 base sigmaN Tstar) + (hMP : MaximumProperty base) : MaximumProperty corr.replacementETT := by + classical + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, rungAgreement, + seriesPresentation, finalGeneratingColoring, ladderTreesAgree, storedColorsAgree, + connectingEdgesAgree, extensionKindsAgree, replacementProper, + replacementOneUncolored, replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have seriesSame : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases seriesSame + unfold MaximumProperty + constructor + · have firstTree := ladderTreesAgree ⟨0, Nat.zero_lt_of_lt base.roundsPositive⟩ + have firstIndex : (1 : Fin (base.rounds + 2)) = + (⟨0, Nat.zero_lt_of_lt base.roundsPositive⟩ : Fin base.rounds).succ.castSucc := + Fin.ext (by rfl) + have firstTree' : replacementSeries.data.tree 1 = base.series.data.tree 1 := by + rw [firstIndex] + exact firstTree + exact (congrArg (fun x => (TreeSequenceVertexSet x).card) firstTree').trans hMP.1 + · intro i hi hlast + dsimp + intro pi seed candidate proper one stable premise closure + have hlastBase : i < base.rounds := by simpa using hlast + have indexValue : i - 1 + 1 = i := Nat.sub_add_cancel (by omega) + let idx : Fin (base.rounds + 1) := ⟨i, by omega⟩ + let q : Fin base.rounds := ⟨i - 1, by omega⟩ + have idxSucc : idx = q.succ := by + apply Fin.ext + simp [idx, q, indexValue] + have treeEq : replacementSeries.data.tree idx.castSucc = + base.series.data.tree idx.castSucc := by + have ladder := ladderTreesAgree ⟨i - 1, by omega⟩ + simpa [idx, indexValue] using ladder + have stableBridge := replacementStable q + have missingEq : ∀ v ∈ TreeSequenceVertexSet + (base.series.data.tree idx.castSucc), + MissingColors G (replacementSeries.data.coloring idx) v = + MissingColors G (base.series.data.coloring idx) v := by + rw [idxSucc] + intro v hv + exact stableBridge.2 v hv + have treeMissingEq : TreeMissingColors + (replacementSeries.data.coloring idx) + (replacementSeries.data.tree idx.castSucc) = + TreeMissingColors (base.series.data.coloring idx) + (base.series.data.tree idx.castSucc) := by + rw [treeEq] + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by rw [← missingEq v hv]; exact hc⟩ + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by rw [missingEq v hv]; exact hc⟩ + have storedEq : TashkinovStoredColors replacementSeries.data idx = + TashkinovStoredColors base.series.data idx := by + have nonzero : ¬ i = 0 := by omega + dsimp [idx] + unfold TashkinovStoredColors + simp only [ite_eq_right nonzero] + ext c + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · rintro ⟨⟨h, hh, hc⟩, hn⟩ + refine ⟨⟨h, hh, ?_⟩, ?_⟩ + · by_cases hle : h.val ≤ i + · simp only [ite_eq_left hle] at hc ⊢ + simpa [storedColorsAgree h] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rw [treeMissingEq] at hn + exact hn + · rintro ⟨⟨h, hh, hc⟩, hn⟩ + refine ⟨⟨h, hh, ?_⟩, ?_⟩ + · by_cases hle : h.val ≤ i + · simp only [ite_eq_left hle] at hc ⊢ + simpa [storedColorsAgree h] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rw [← treeMissingEq] at hn + exact hn + have baseGood : IsProperEdgeColoring G (base.series.data.coloring idx) ∧ + IsOneEdgeUncolored (base.series.data.coloring idx) e0 := by + have allGood : ∀ j : Fin base.rounds, + IsProperEdgeColoring G (base.series.data.coloring j.succ) ∧ + IsOneEdgeUncolored (base.series.data.coloring j.succ) e0 := by + intro j + exact base.series.coloringProperties j.succ + rw [idxSucc] + exact allGood q + have baseStable : StableColoring + (base.series.data.tree idx.castSucc) + (TashkinovStoredColors base.series.data idx) + (base.series.data.coloring idx) pi := by + have bridgeStable : StableColoring + (base.series.data.tree idx.castSucc) + (TashkinovStoredColors base.series.data idx) + (base.series.data.coloring idx) (replacementSeries.data.coloring idx) := by + repeat rw [idxSucc] + exact stableBridge + have replacementToPi : StableColoring + (base.series.data.tree idx.castSucc) + (TashkinovStoredColors base.series.data idx) + (replacementSeries.data.coloring idx) pi := by + rw [← treeEq] + rw [← storedEq] + repeat rw [idxSucc] + have qSuccIndex : q.succ = (⟨i, by omega⟩ : Fin (base.rounds + 1)) := by + apply Fin.ext + simp [q, indexValue] + have stable' := stable + repeat rw [← qSuccIndex] at stable' + have qTreeIndex : q.succ.castSucc = + (⟨i, by omega⟩ : Fin (base.rounds + 2)) := Fin.ext (by simp [q, indexValue]) + rw [← qTreeIndex] at stable' + exact stable' + exact (sc2 G e0 (base.series.data.tree idx.castSucc) + (TashkinovStoredColors base.series.data idx)).trans + (x := ⟨base.series.data.coloring idx, baseGood⟩) + (y := ⟨replacementSeries.data.coloring idx, + ⟨replacementProper idx, replacementOneUncolored idx⟩⟩) + (z := ⟨pi, ⟨proper, one⟩⟩) bridgeStable replacementToPi + have basePremise : + (base.series.data.kind idx = some TashkinovExtensionKind.PE ∧ + seed = base.series.data.tree idx.castSucc) ∨ + ((base.series.data.kind idx = some TashkinovExtensionKind.SE ∨ + base.series.data.kind idx = some TashkinovExtensionKind.RE) ∧ + ∃ f, base.series.data.connectingEdges idx = {f} ∧ + TreeSequenceAdjoinEdge (base.series.data.tree idx.castSucc) f seed) := by + rcases premise with premise | premise + · left + constructor + · rw [← extensionKindsAgree idx] + simpa [idx] using premise.1 + · rw [← treeEq] + exact premise.2 + · right + constructor + · rw [← extensionKindsAgree idx] + simpa [idx] using premise.1 + · rcases premise.2 with ⟨f, edgeSet, seedDef⟩ + refine ⟨f, ?_, ?_⟩ + · rw [← connectingEdgesAgree idx] + simpa [idx] using edgeSet + · rw [← treeEq] + exact seedDef + have bound := hMP.2 i hi hlastBase pi seed candidate proper one baseStable + basePremise closure + have nextTree := ladderTreesAgree ⟨i, hlastBase⟩ + have nextIndex : (⟨i + 1, by omega⟩ : Fin (base.rounds + 2)) = + (⟨i, hlastBase⟩ : Fin base.rounds).succ.castSucc := Fin.ext (by rfl) + have nextTree' : replacementSeries.data.tree ⟨i + 1, by omega⟩ = + base.series.data.tree ⟨i + 1, by omega⟩ := by + rw [nextIndex] + exact nextTree + rw [nextTree'] + exact bound + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MaximumStableClosureExists.lean b/LeanPool/GoldbergSeymour/MaximumStableClosureExists.lean new file mode 100644 index 0000000000..8da376f399 --- /dev/null +++ b/LeanPool/GoldbergSeymour/MaximumStableClosureExists.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Finset.Max + +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovClosure + +/-! +# Maximum Stable Closure Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem MaximumStableClosureExists + {V E : Type*} [Fintype V] [Fintype E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (T seed : TreeSequence G e0) (C : Finset (Fin k)) + (phi : PartialEdgeColoring E k) + (hnonempty : exists (pi : PartialEdgeColoring E k) + (candidate : TreeSequence G e0), + IsProperEdgeColoring G pi ∧ IsOneEdgeUncolored pi e0 ∧ + StableColoring T C phi pi ∧ TashkinovClosure pi seed candidate) : + exists (pi : PartialEdgeColoring E k) (candidate : TreeSequence G e0), + IsProperEdgeColoring G pi ∧ IsOneEdgeUncolored pi e0 ∧ + StableColoring T C phi pi ∧ TashkinovClosure pi seed candidate ∧ + forall (rho : PartialEdgeColoring E k) (other : TreeSequence G e0), + IsProperEdgeColoring G rho → IsOneEdgeUncolored rho e0 → + StableColoring T C phi rho → TashkinovClosure rho seed other → + (TreeSequenceVertexSet other).card ≤ + (TreeSequenceVertexSet candidate).card := by + classical + have card_bound : forall S : TreeSequence G e0, + (TreeSequenceVertexSet S).card ≤ Fintype.card V := by + intro S + exact Finset.card_le_card (Finset.subset_univ _) + let sizes : Finset Nat := + (Finset.range (Fintype.card V + 1)).filter (fun n => + exists (pi : PartialEdgeColoring E k) (candidate : TreeSequence G e0), + IsProperEdgeColoring G pi ∧ IsOneEdgeUncolored pi e0 ∧ + StableColoring T C phi pi ∧ TashkinovClosure pi seed candidate ∧ + (TreeSequenceVertexSet candidate).card = n) + have sizes_nonempty : sizes.Nonempty := by + obtain ⟨pi, candidate, hproper, hone, hstable, hclosure⟩ := hnonempty + refine ⟨(TreeSequenceVertexSet candidate).card, ?_⟩ + simp only [sizes, Finset.mem_filter, Finset.mem_range] + exact ⟨Nat.lt_succ_of_le (card_bound candidate), + ⟨pi, candidate, hproper, hone, hstable, hclosure, rfl⟩⟩ + let largest : Nat := sizes.max' sizes_nonempty + have largest_mem : largest ∈ sizes := + Finset.max'_mem sizes sizes_nonempty + obtain ⟨pi, candidate, hproper, hone, hstable, hclosure, hcard⟩ := + (Finset.mem_filter.mp largest_mem).2 + refine ⟨pi, candidate, hproper, hone, hstable, hclosure, ?_⟩ + intro rho other hrhoProper hrhoOne hrhoStable hotherClosure + have other_mem : (TreeSequenceVertexSet other).card ∈ sizes := by + simp only [sizes, Finset.mem_filter, Finset.mem_range] + exact ⟨Nat.lt_succ_of_le (card_bound other), + ⟨rho, other, hrhoProper, hrhoOne, hrhoStable, hotherClosure, rfl⟩⟩ + rw [hcard] + exact Finset.le_max' sizes _ other_mem + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MinimumContextTransport.lean b/LeanPool/GoldbergSeymour/MinimumContextTransport.lean new file mode 100644 index 0000000000..90ff173573 --- /dev/null +++ b/LeanPool/GoldbergSeymour/MinimumContextTransport.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext + +public import LeanPool.GoldbergSeymour.SameGoodHierarchy + +/-! +# P2752_T2_Minimum Context Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2752_T2_MinimumContextTransport {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (newBase : HierarchyBase corr.replacementETT sigma) + (Cnew : HierarchyCounterexample newBase) + (hsame : SameGoodHierarchy C.good Cnew.good) : + Nonempty (HierarchyMinimumCounterexampleContext G k e0 + corr.replacementInput T sigma corr.replacementETT newBase Cnew) := by + classical + obtain ⟨hstar, hpath, hstage⟩ := + P2752_T2_HierarchyMeasures C.hierarchy Cnew.hierarchy hsame.1 + have hmeasure : HierarchyCounterexampleMeasure Cnew = + HierarchyCounterexampleMeasure C := by + unfold HierarchyCounterexampleMeasure + rw [← hpath, ← hstage] + have hcount : C.hierarchy.dividerCount = Cnew.hierarchy.dividerCount := hsame.2.choose + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive series above strict below generating => + cases rungAgreement + have hseries : series = replacementSeries := eq_of_heq seriesPresentation + cases hseries + let i : Fin ett.rounds := ⟨ett.rounds - 1, by have hp := ett.roundsPositive; omega⟩ + have hi : i.succ = Fin.last ett.rounds := by + apply Fin.ext + change ett.rounds - 1 + 1 = ett.rounds + exact Nat.sub_add_cancel ett.roundsPositive + have htree : replacementSeries.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + simpa [hi] using ladderTreesAgree i + have hmissing : TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + have hs := replacementStable i + rw [hi, ← ett.generatingColoring, ← finalGeneratingColoring] at hs + unfold TreeMissingColors + apply Finset.biUnion_congr rfl + intro v hv + exact hs.2 v hv + refine ⟨{ + proper := finalGeneratingColoring ▸ replacementProper (Fin.last ett.rounds) + oneEdgeUncolored := finalGeneratingColoring ▸ + replacementOneUncolored (Fin.last ett.rounds) + lowerRung := ?_ + fewerDividers := ?_ + lexicographicMinimality := ?_ + largeMissingSet := ?_ }⟩ + · intro input' T' generating' lower hp hlt hm + exact ctx.lowerRung lower hp hlt hm + · intro input' T' generating' other hr hm base' K good hdiv + exact ctx.fewerDividers other hr hm base' K good (by simpa [hcount] using hdiv) + · intro input' T' generating' other base' C' hr hc + rw [hmeasure] + exact ctx.lexicographicMinimality C' hr (hc.trans hcount.symm) + · change 2 * ett.rounds + 11 ≤ + (TreeMissingColors sigma (replacementSeries.data.tree (Fin.last ett.rounds).castSucc)).card + rw [htree, hmissing] + exact ctx.largeMissingSet + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MinusClosedTransport.lean b/LeanPool/GoldbergSeymour/MinusClosedTransport.lean new file mode 100644 index 0000000000..4dcbaa3d73 --- /dev/null +++ b/LeanPool/GoldbergSeymour/MinusClosedTransport.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap + +/-! +# P2813_T1_Minus Closed Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem P2813_T1_MinusClosedTransport {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (U : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) + (alpha beta : Fin k) (hne : alpha ≠ beta) (z : Sum V E) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (reserved : Finset (Fin k)) + (hclosed : TreeColorSetMinusClosed G phi U reserved) + (hmissing : ∀ v ∈ TreeSequenceVertexSet U, + MissingColors G sigma v = MissingColors G phi v) + (houtside : ∀ c : Fin k, (c = alpha ∨ c = beta) → + c ∈ TreeMissingColors phi U → TreeColorSetClosed G phi U {c} → + OutsideKempeRecoloring U phi sigma alpha beta) : + TreeColorSetMinusClosed G sigma U reserved := by + classical + have hm : TreeMissingColors sigma U = TreeMissingColors phi U := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl hmissing + have unaffected (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + sigma f = some c ↔ phi f = some c := by + clear * - G phi sigma alpha beta hne z hsigma f c hca hcb + rw [hsigma] + by_cases hf : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · by_cases ha : phi f = some alpha + · simp [TwoColorComponentSwap, hf, ha, hca.symm, hcb.symm] + · by_cases hb : phi f = some beta + · simp [TwoColorComponentSwap, hf, hb, hne.symm, hca.symm, hcb.symm] + · simp [TwoColorComponentSwap, hf, ha, hb] + · simp [TwoColorComponentSwap, hf] + intro c hc + rw [hm] at hc + have hcm := (Finset.mem_sdiff.mp hc).1 + have hcClosed : TreeColorSetClosed G phi U {c} := by + intro d hd + have hdEq : d = c := Finset.mem_singleton.mp hd + subst d + exact hclosed c hc + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + have hboundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet U) ∧ + sigma f = some c := by simpa only [BoundaryColorEdges, Finset.mem_filter, + Finset.mem_univ, true_and] using hf + have hi : TreeIncidentEdge U f := by + have hends : ∃ u ∈ TreeSequenceVertexSet U, + ∃ v ∉ TreeSequenceVertexSet U, G.ends f = s(u, v) := by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + using hboundary.1 + obtain ⟨u, hu, v, hv, he⟩ := hends + refine ⟨u, hu, ?_⟩ + rw [Incident, he] + exact Sym2.mem_mk_left _ _ + have hold : phi f = some c := by + by_cases hca : c = alpha + · have hout := houtside c (Or.inl hca) hcm hcClosed + have hh := OutsideKempeRecoloringStable G e0 U ∅ phi sigma alpha beta hproper hone hout + exact (hh.2.2.2.2 f hi).symm.trans hboundary.2 + · by_cases hcb : c = beta + · have hout := houtside c (Or.inr hcb) hcm hcClosed + have hh := OutsideKempeRecoloringStable G e0 U ∅ phi sigma alpha beta hproper hone hout + exact (hh.2.2.2.2 f hi).symm.trans hboundary.2 + · exact (unaffected f c hca hcb).mp hboundary.2 + have hfOld : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet U) c := by + exact Finset.mem_filter.mpr ⟨hboundary.1, hold⟩ + rw [hclosed c hc] at hfOld + exact Finset.notMem_empty f hfOld + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MissingColorIncidenceEndpoint.lean b/LeanPool/GoldbergSeymour/MissingColorIncidenceEndpoint.lean new file mode 100644 index 0000000000..e2d0f8c396 --- /dev/null +++ b/LeanPool/GoldbergSeymour/MissingColorIncidenceEndpoint.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin + +public import LeanPool.GoldbergSeymour.MissingColors + +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo + +/-! +# Missing Color Incidence Endpoint + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem MissingColorIncidenceEndpoint {V E : Type*} + [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) + (alpha beta : Fin k) (_ : alpha ≠ beta) + (hproper : IsProperEdgeColoring G phi) (v : V) + (hmissing : alpha ∈ MissingColors G phi v) : + @SimpleGraph.degree _ (TwoColorIncidenceGraph G phi alpha beta) (Sum.inl v) + (Fintype.ofFinite _) ≤ 1 := by + classical + let _ := Fintype.ofFinite V + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro a ha b hb + have haAdj : (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) a := + by simpa [SimpleGraph.neighborFinset] using ha + have hbAdj : (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) b := + by simpa [SimpleGraph.neighborFinset] using hb + cases a with + | inl a => simp [TwoColorIncidenceGraph] at haAdj + | inr a => + cases b with + | inl b => simp [TwoColorIncidenceGraph] at hbAdj + | inr b => + by_contra hab + have haData := haAdj + have hbData := hbAdj + simp only [TwoColorIncidenceGraph] at haData hbData + rcases haData with ⟨haIncident, haColor⟩ + rcases hbData with ⟨hbIncident, hbColor⟩ + have haNot : ¬ phi a = some alpha := by + intro haAlpha + have hpresent : alpha ∈ PresentColors G phi v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨a, haIncident, haAlpha⟩ + have hnotpresent : alpha ∉ PresentColors G phi v := by + simpa [MissingColors] using hmissing + exact hnotpresent hpresent + have haBeta : phi a = some beta := haColor.resolve_left haNot + have hbBeta : phi b = some beta := hbColor.resolve_left (by + intro hbAlpha + have hpresent : alpha ∈ PresentColors G phi v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨b, hbIncident, hbAlpha⟩ + have hnotpresent : alpha ∉ PresentColors G phi v := by + simpa [MissingColors] using hmissing + exact hnotpresent hpresent) + have hadj : AdjacentEdges G a b := ⟨v, haIncident, hbIncident⟩ + have habEdges : a ≠ b := by + intro habEdges + exact hab (congrArg Sum.inr habEdges) + exact (hproper habEdges hadj haBeta) hbBeta + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MissingColors.lean b/LeanPool/GoldbergSeymour/MissingColors.lean new file mode 100644 index 0000000000..1a5e66898e --- /dev/null +++ b/LeanPool/GoldbergSeymour/MissingColors.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.PresentColors + +/-! +# Missing Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Colors not assigned to any edge incident to the vertex. -/ +noncomputable def MissingColors {V E : Type*} [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (φ : PartialEdgeColoring E k) (v : V) : Finset (Fin k) := by + classical + exact Finset.univ \ PresentColors G φ v + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MissingColorsNonemptyOfMaximumDegree.lean b/LeanPool/GoldbergSeymour/MissingColorsNonemptyOfMaximumDegree.lean new file mode 100644 index 0000000000..8d8ba81512 --- /dev/null +++ b/LeanPool/GoldbergSeymour/MissingColorsNonemptyOfMaximumDegree.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors + +/-! +# Missing Colors Nonempty Of Maximum Degree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma MissingColorsNonemptyOfMaximumDegree + {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : Nat} + (phi : PartialEdgeColoring E k) + (hdegree : MaximumDegree G + 1 <= k) (v : V) : + (MissingColors G phi v).Nonempty := by + classical + have hdeg : Degree G v <= MaximumDegree G := by + unfold MaximumDegree + exact Finset.le_max' _ _ (Finset.mem_insert.mpr (Or.inr + (Finset.mem_image.mpr <| Exists.intro v (by simp)))) + have present_le_degree : (PresentColors G phi v).card <= Degree G v := by + have chooseData (c : {c : Fin k // c ∈ PresentColors G phi v}) : + exists e, Incident G v e /\ phi e = some c.1 := by + simpa [PresentColors] using c.property + let choices : {c : Fin k // c ∈ PresentColors G phi v} -> + {e : E // Incident G v e} := fun c => + Subtype.mk (Classical.choose (chooseData c)) + (Classical.choose_spec (chooseData c)).1 + have choice_spec : forall c : {c : Fin k // c ∈ PresentColors G phi v}, + phi (choices c).1 = some c.1 := by + intro c + exact (Classical.choose_spec (chooseData c)).2 + have hinj : Function.Injective choices := by + intro a b hab + apply Subtype.ext + apply Option.some.inj + calc + some (a : Fin k) = phi (choices a).1 := (choice_spec a).symm + _ = phi (choices b).1 := by rw [hab] + _ = some (b : Fin k) := choice_spec b + let : Fintype {c : Fin k // c ∈ PresentColors G phi v} := + Fintype.ofFinite _ + have hc := Fintype.card_le_of_injective choices hinj + change (PresentColors G phi v).card <= + (Finset.univ.filter (fun e => Incident G v e)).card + simpa [Fintype.card_subtype] using hc + by_contra hn + have hempty : MissingColors G phi v = Finset.empty := + Finset.not_nonempty_iff_eq_empty.mp hn + have hall : PresentColors G phi v = Finset.univ := by + apply Finset.eq_univ_of_forall + intro c + by_contra hc + have hm : c ∈ MissingColors G phi v := by simp [MissingColors, hc] + rw [hempty] at hm + exact Finset.notMem_empty c hm + have hk : k <= Degree G v := by + simpa [hall] using present_le_degree + have : MaximumDegree G + 1 <= MaximumDegree G := + hdegree.trans (hk.trans hdeg) + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/MixedNoClosedTransport.lean b/LeanPool/GoldbergSeymour/MixedNoClosedTransport.lean new file mode 100644 index 0000000000..1116adfb7d --- /dev/null +++ b/LeanPool/GoldbergSeymour/MixedNoClosedTransport.lean @@ -0,0 +1,342 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Preparatory lemmas for hierarchy normalization + +Extracted from Wesley Pegden’s Trellis formalization of the Goldberg–Seymour +theorem at 88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. These lemmas establish +properties used in the computed hierarchy records of `ChangeLemmaMixedNoClosed`. +-/ + +@[expose] public section + +namespace GoldbergSeymour.MixedNoClosedTransport + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperParallelBase4040Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (coreToA : TreeSequenceInitialSegment base.core A) (TnToA : TreeSequenceInitialSegment Tn A) + (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (Nat.le_of_lt_succ ib.isLt); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) + B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) + (belowB : TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (hcoreB : baseB.core = base.core), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (treeMissingEq : + ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A), + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) + (closureBToA : + ∀ (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A) + (minusEq : + ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) + (D : Finset (Fin k)) (haD : alpha ∈ D), + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D) + (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (goodB : + GoodHierarchy + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }) + (reservedZeroB : + alpha ∈ + (HierarchyStoredColorsAt + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + (0 : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ)))).biUnion + (goodB.gamma + (0 : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))))) + (hcore : baseB.core = baseS.core) + (hpe : + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.kind + (Fin.last + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.kind + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = baseS.closure) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (storedEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j), + let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last corr.replacementETT.rounds; + let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; + corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma baseS.core + ((HierarchyStoredColorsAt HS (0 : Fin (HS.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (HS.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma baseS.closure : Finset (Fin k)) \ + (HierarchyStoredColorsAt HS (0 : Fin (HS.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (HS.dividerCount + (1 : ℕ))))).card + +theorem helper_parallelBase_4040.{u_1, u_2} : + helperParallelBase4040Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb coreToA TnToA hAib + B rpB aboveB strictB belowB genB baseB hcoreB ettB sigma treeMissingEq corr baseS + closureBToA minusEq count stages hbbase hbterminal hbnested hbstrict positions hbpositive + hbincreasing hbdivider hbcore goodB reservedZeroB hcore hpe hclosure positionsS hspositive + hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS storedEq + dsimp only + intro hp + have hpOld := hpe.mpr hp + have hc := hclosure hpOld + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := hsbase.symm.trans hbbase + change ¬TreeColorSetMinusClosed G sigma baseS.core + ((HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)) ∧ + 4 ≤ ((TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseS.closure) \ + (HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)).card + rw [← hcore, ← hc, storedEq, htree, + treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA), + treeMissingEq _ (closureBToA hpOld), + minusEq _ (by rw [hcoreB]; exact TreeSequenceInitialSegmentVertexSetSubset coreToA) + _ reservedZeroB] + exact goodB.parallelBase hpOld + +end GoldbergSeymour.MixedNoClosedTransport + +end diff --git a/LeanPool/GoldbergSeymour/ModColoring.lean b/LeanPool/GoldbergSeymour/ModColoring.lean new file mode 100644 index 0000000000..129eaec518 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ModColoring.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree + +/-! +# Mod Coloring + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A proper one-edge-uncolored coloring for which every eligible terminal extension has a +corresponding extended tree. +-/ +def ModColoring {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (base : ExtendedTashkinovTree G k e0 input T generating) + (sigmaN : PartialEdgeColoring E k) : Prop := + let n : Fin (base.rounds + 1) := Fin.last base.rounds + let Tn : TreeSequence G e0 := base.series.data.tree n.castSucc + IsProperEdgeColoring G sigmaN ∧ + IsOneEdgeUncolored sigmaN e0 ∧ + ∀ Tstar : TreeSequence G e0, + TreeSequenceInitialSegment Tn Tstar → + Tn.length < Tstar.length → + ((base.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigmaN Tn Tstar) ∨ + ((base.series.data.kind n = some TashkinovExtensionKind.SE ∨ + base.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + base.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigmaN seed Tstar)) → + Nonempty (CorrespondingExtendedTashkinovTree G k e0 base sigmaN Tstar) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/NestedOddMissingPair.lean b/LeanPool/GoldbergSeymour/NestedOddMissingPair.lean new file mode 100644 index 0000000000..29e3ccdb89 --- /dev/null +++ b/LeanPool/GoldbergSeymour/NestedOddMissingPair.lean @@ -0,0 +1,143 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryMissingColorAugmentation + +public import LeanPool.GoldbergSeymour.ElementaryClosedMissingColorOdd +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed + +/-! +# P2940_T1_Nested Odd Missing Pair + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2940_T1_NestedOddMissingPair + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (phi : PartialEdgeColoring E k) (A U : TreeSequence G e0) + (hproper : IsProperEdgeColoring G phi) + (helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet U)) + (hAU : TreeSequenceInitialSegment A U) (hstrict : A.length < U.length) + (hoddA : Odd (TreeSequenceVertexSet A).card) + (hdegree : MaximumDegree G + 1 <= k) + (D : Finset (Fin k)) (gamma : Fin k -> Finset (Fin k)) + (hreserved : forall eta, eta ∈ D -> gamma eta ⊆ TreeMissingColors phi A) + (hdisjoint : forall eta theta, eta ∈ D -> theta ∈ D -> eta ≠ theta -> + Disjoint (gamma eta) (gamma theta)) + (hgap : (D.biUnion gamma).card < (TreeMissingColors phi U).card) + (hminus : TreeColorSetMinusClosed G phi U (D.biUnion gamma)) + (hnotClosed : Not (TreeColorSetClosed G phi U (TreeMissingColors phi U))) : + exists (alpha beta eta gammaOne gammaTwo : Fin k) (f : E) + (W : TreeSequence G e0), + Odd (TreeSequenceVertexSet U).card /\ + alpha ∈ TreeMissingColors phi U \ D.biUnion gamma /\ + TreeColorSetClosed G phi U {alpha} /\ + beta ∈ TreeMissingColors phi U /\ beta ∈ D.biUnion gamma /\ + eta ∈ D /\ beta ∈ gamma eta /\ + (forall theta, theta ∈ D -> beta ∈ gamma theta -> theta = eta) /\ + f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet U) beta /\ + phi f = some beta /\ TreeSequenceAdjoinEdge U f W /\ + TashkinovAugmentation phi U W /\ gammaOne ≠ gammaTwo /\ + gammaOne ∈ (TreeSequenceVertexSet U \ TreeSequenceVertexSet A).biUnion + (MissingColors G phi) /\ + gammaTwo ∈ (TreeSequenceVertexSet U \ TreeSequenceVertexSet A).biUnion + (MissingColors G phi) /\ + Disjoint {gammaOne, gammaTwo} (D.biUnion gamma) /\ + beta ∉ ({gammaOne, gammaTwo} : Finset (Fin k)) := by + classical + have halphaExists : (TreeMissingColors phi U \ D.biUnion gamma).Nonempty := by + by_contra hn + have hsub : TreeMissingColors phi U ⊆ D.biUnion gamma := by + intro c hc + by_contra hcnot + exact hn ⟨c, Finset.mem_sdiff.mpr ⟨hc, hcnot⟩⟩ + have := Finset.card_le_card hsub + omega + obtain ⟨alpha, halpha⟩ := halphaExists + have halphaClosed : TreeColorSetClosed G phi U {alpha} := by + intro c hc + have hcEq := Finset.mem_singleton.mp hc + subst c + exact hminus alpha halpha + have hoddU := ElementaryClosedMissingColorOdd G k e0 phi U alpha + hproper helem (Finset.mem_sdiff.mp halpha).1 halphaClosed + have hsub := TreeSequenceInitialSegmentVertexSetSubset hAU + have hcardA : (TreeSequenceVertexSet A).card = A.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, A.vertex_injective] + have hcardU : (TreeSequenceVertexSet U).card = U.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, U.vertex_injective] + have htwo : 1 < (TreeSequenceVertexSet U \ TreeSequenceVertexSet A).card := by + rw [Finset.card_sdiff_of_subset hsub] + obtain ⟨a, ha⟩ := hoddA + obtain ⟨u, hu⟩ := hoddU + omega + obtain ⟨x, hx, y, hy, hxy⟩ := Finset.one_lt_card.mp htwo + obtain ⟨gammaOne, hg1x⟩ := MissingColorsNonemptyOfMaximumDegree G phi hdegree x + obtain ⟨gammaTwo, hg2y⟩ := MissingColorsNonemptyOfMaximumDegree G phi hdegree y + have hne : gammaOne ≠ gammaTwo := by + intro heq + have hd := helem (Finset.mem_sdiff.mp hx).1 (Finset.mem_sdiff.mp hy).1 hxy + exact Finset.disjoint_left.mp hd hg1x (heq ▸ hg2y) + have outside_not_reserved : forall v, v ∈ TreeSequenceVertexSet U \ + TreeSequenceVertexSet A -> forall c, c ∈ MissingColors G phi v -> + c ∉ D.biUnion gamma := by + intro v hv c hc hr + obtain ⟨owner, ho, hco⟩ := Finset.mem_biUnion.mp hr + obtain ⟨w, hw, hcw⟩ := Finset.mem_biUnion.mp (hreserved owner ho hco) + have hvw : v ≠ w := by + intro h + exact (Finset.mem_sdiff.mp hv).2 (h ▸ hw) + exact Finset.disjoint_left.mp + (helem (Finset.mem_sdiff.mp hv).1 (hsub hw) hvw) hc hcw + have hfresh : Disjoint {gammaOne, gammaTwo} (D.biUnion gamma) := by + rw [Finset.disjoint_left] + intro c hc hr + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + rcases hc with hc | hc + · subst c + exact outside_not_reserved x hx gammaOne hg1x hr + · subst c + exact outside_not_reserved y hy gammaTwo hg2y hr + have hboundary : exists beta, beta ∈ TreeMissingColors phi U /\ + (BoundaryColorEdges G phi (TreeSequenceVertexSet U) beta).Nonempty := by + by_contra hn + apply hnotClosed + intro beta hb + apply Finset.not_nonempty_iff_eq_empty.mp + intro hne + exact hn ⟨beta, hb, hne⟩ + obtain ⟨beta, hbeta, f, hf⟩ := hboundary + have hbReserved : beta ∈ D.biUnion gamma := by + by_contra hn + have hemp := hminus beta (Finset.mem_sdiff.mpr ⟨hbeta, hn⟩) + exact Finset.notMem_empty f (hemp ▸ hf) + obtain ⟨eta, heta, hbEta⟩ := Finset.mem_biUnion.mp hbReserved + have howner : forall theta, theta ∈ D -> beta ∈ gamma theta -> theta = eta := by + intro theta ht hb + by_contra hne + exact Finset.disjoint_left.mp (hdisjoint theta eta ht heta hne) hb hbEta + have hfc : phi f = some beta := (Finset.mem_filter.mp hf).2 + obtain ⟨W, hadjoin, haug, _⟩ := + BoundaryMissingColorAugmentation G k e0 phi U beta f hf hbeta + refine ⟨alpha, beta, eta, gammaOne, gammaTwo, f, W, hoddU, halpha, + halphaClosed, hbeta, hbReserved, heta, hbEta, howner, hf, hfc, hadjoin, + haug, hne, Finset.mem_biUnion.mpr ⟨x, hx, hg1x⟩, + Finset.mem_biUnion.mpr ⟨y, hy, hg2y⟩, hfresh, ?_⟩ + intro hbPair + exact Finset.disjoint_left.mp hfresh hbPair hbReserved + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/NineN.lean b/LeanPool/GoldbergSeymour/NineN.lean new file mode 100644 index 0000000000..ace10543ed --- /dev/null +++ b/LeanPool/GoldbergSeymour/NineN.lean @@ -0,0 +1,622 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import Mathlib.Algebra.BigOperators.Group.Finset.Basic +public import Mathlib.Algebra.Order.BigOperators.Group.Finset +public import Mathlib.Order.Fin.Basic + +/-! +# Nine N + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hcontribution_261.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : ℕ → TreeSequence G e0 := fun (i : ℕ) => TreeSequencePrefix T (min (A.length + i) + T.length) ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + i) T.length) => + by + omega + ) (Nat.min_le_right (A.length + i) T.length); + let B : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion + fun (v : V) => MissingColors G phi v; + let U : ℕ → Finset (Fin k) := fun (i : ℕ) => {c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + i ∧ phi (T.edge r) = some + c}; + let X : ℕ → Finset (Fin k) := fun (i : ℕ) => (TreeMissingColors phi (Ty i) \ B) \ U i; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (good.gamma q); + ∀ (i : ℕ), + let C : Finset (Fin k) := X i ∩ (Gamma ∪ D); + let Q : Fin k → Finset (Fin k) := fun (eta : Fin k) => good.gamma q eta ∪ { eta }; + let F : Finset (Fin k) := {eta ∈ D | Q eta ⊆ C}; + ∀ (_ : ( + ∀ eta ∈ D, (Q eta).card = (3 : ℕ))), + ∀ eta ∈ D, (Q eta ∩ C).card ≤ (2 : ℕ) + if eta ∈ F then (1 : ℕ) else (0 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good n Tn q A Ty B U X D Gamma i C Q F hQcard + eta heta + by_cases hf : eta ∈ F + · have hc := Finset.card_le_card + (show Q eta ∩ C ⊆ Q eta from Finset.inter_subset_left) + rw [hQcard eta heta] at hc + simpa [hf] using hc + · have hstrict : Q eta ∩ C ⊂ Q eta := by + apply Finset.ssubset_iff_subset_ne.mpr + refine ⟨Finset.inter_subset_left, ?_⟩ + intro heq + apply hf + apply Finset.mem_filter.mpr + refine ⟨heta, ?_⟩ + intro c hc + have hcc : c ∈ Q eta ∩ C := heq.symm ▸ hc + exact (Finset.mem_inter.mp hcc).2 + have hc := Finset.card_lt_card hstrict + rw [hQcard eta heta] at hc + simp only [hf, ↓reduceIte, Nat.add_zero] + omega + +private theorem helper_hUcard_229.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : ℕ → TreeSequence G e0 := fun (i : ℕ) => TreeSequencePrefix T (min (A.length + i) + T.length) ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + i) T.length) => ( + by first | omega + )) (Nat.min_le_right (A.length + i) T.length); + let U : ℕ → Finset (Fin k) := fun (i : ℕ) => {c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + i ∧ phi (T.edge r) = some + c}; + ∀ (i : ℕ) (_ : (Ty i).length = A.length + i), + let N : Finset V := TreeSequenceVertexSet (Ty i) \ TreeSequenceVertexSet A; + ∀ (_ : N.card = i), (U i).card ≤ i := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H q A Ty U i hilen N hNcard + have witnesses : ∀ c ∈ U i, ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < A.length + i ∧ phi (T.edge r) = some c := by + intro c hc + exact (Finset.mem_filter.mp hc).2 + let r := fun c : {c // c ∈ U i} => Classical.choose (witnesses c.val c.property) + have hr (c : {c // c ∈ U i}) := Classical.choose_spec (witnesses c.val c.property) + let f : {c // c ∈ U i} → Fin i := fun c => + ⟨(r c).val - A.length, by have := hr c; dsimp [r]; omega⟩ + have hf : Function.Injective f := by + intro c d hcd + have hc := hr c + have hd := hr d + have hval := congrArg Fin.val hcd + change (r c).val - A.length = (r d).val - A.length at hval + have he : r c = r d := by apply Fin.ext; dsimp [r] at *; omega + apply Subtype.ext + apply Option.some.inj + exact hc.2.2.symm.trans ((congrArg (fun s => phi (T.edge s)) he).trans hd.2.2) + simpa using Fintype.card_le_of_injective f hf + +private theorem helper_hQdis_274.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (good.gamma q); + let Q : Fin k → Finset (Fin k) := fun (eta : Fin k) => good.gamma q eta ∪ { eta }; + ∀ (_ : Disjoint Gamma D), + (↑D : Set (Fin k)).PairwiseDisjoint Q := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good q D Gamma Q hreserved eta heta theta + htheta hne + change Disjoint (Q eta) (Q theta) + rw [Finset.disjoint_left] + intro c hc hd + simp only [Q, Finset.mem_union, Finset.mem_singleton] at hc hd + rcases hc with hc | hc <;> rcases hd with hd | hd + · exact Finset.disjoint_left.mp (good.disjointPairs q eta theta heta htheta hne) hc hd + · exact Finset.disjoint_left.mp hreserved + (Finset.mem_biUnion.mpr ⟨eta, heta, hc⟩) (hd.symm ▸ htheta) + · exact Finset.disjoint_left.mp hreserved + (Finset.mem_biUnion.mpr ⟨theta, htheta, hd⟩) (hc.symm ▸ heta) + · exact hne (hc.symm.trans hd) + +private theorem helper_hcover_287.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : ℕ → TreeSequence G e0 := fun (i : ℕ) => TreeSequencePrefix T (min (A.length + i) + T.length) ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + i) T.length) => ( + by first | omega + )) (Nat.min_le_right (A.length + i) T.length); + let B : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion + fun (v : V) => MissingColors G phi v; + let U : ℕ → Finset (Fin k) := fun (i : ℕ) => {c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + i ∧ phi (T.edge r) = some + c}; + let X : ℕ → Finset (Fin k) := fun (i : ℕ) => (TreeMissingColors phi (Ty i) \ B) \ U i; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (good.gamma q); + ∀ (i : ℕ), + let C : Finset (Fin k) := X i ∩ (Gamma ∪ D); + let Q : Fin k → Finset (Fin k) := fun (eta : Fin k) => good.gamma q eta ∪ { eta }; C = + D.biUnion fun (eta : Fin k) => Q eta ∩ C := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good n Tn q A Ty B U X D Gamma i C Q + ext c + constructor + · intro hc + have hstored := (Finset.mem_inter.mp hc).2 + rcases Finset.mem_union.mp hstored with hg | hd + · obtain ⟨eta, heta, hce⟩ := Finset.mem_biUnion.mp hg + exact Finset.mem_biUnion.mpr + ⟨eta, heta, Finset.mem_inter.mpr ⟨Finset.mem_union_left _ hce, hc⟩⟩ + · exact Finset.mem_biUnion.mpr + ⟨c, hd, Finset.mem_inter.mpr ⟨Finset.mem_union_right _ (Finset.mem_singleton_self c), hc⟩⟩ + · intro hc + obtain ⟨eta, _, hce⟩ := Finset.mem_biUnion.mp hc + exact (Finset.mem_inter.mp hce).2 + +private theorem helper_continuation_351.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Ty : ℕ → TreeSequence G e0 := fun (i : ℕ) => TreeSequencePrefix T (min (A.length + i) + T.length) ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + i) T.length) => ( + by first | omega + )) (Nat.min_le_right (A.length + i) T.length); + let B : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion + fun (v : V) => MissingColors G phi v; + let U : ℕ → Finset (Fin k) := fun (i : ℕ) => {c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + i ∧ phi (T.edge r) = some + c}; + let X : ℕ → Finset (Fin k) := fun (i : ℕ) => (TreeMissingColors phi (Ty i) \ B) \ U i; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (good.gamma q); + ∀ (i : ℕ) (_ : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (X i).card) (_ : (X i \ (Gamma ∪ D)).card ≤ + (4 : ℕ)), + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ TreeMissingColors phi (Ty i) ∧ Disjoint (good.gamma q + (eta h) ∪ {eta h}) (U i) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good n Tn q A Ty B U X D Gamma i havailable hsmall + let C := X i ∩ (Gamma ∪ D) + let Q := fun eta => good.gamma q eta ∪ {eta} + let F := D.filter fun eta => Q eta ⊆ C + have hCcard : 2 * ett.rounds + 7 ≤ C.card := by + have hc := Finset.card_inter_add_card_sdiff (X i) (Gamma ∪ D) + change C.card + (X i \ (Gamma ∪ D)).card = (X i).card at hc + omega + have hreserved : Disjoint Gamma D := (GoodHierarchyReservedDisjoint good q).2 + have hQcard : ∀ eta ∈ D, (Q eta).card = 3 := by + intro eta heta + have hn : eta ∉ good.gamma q eta := by + intro he + exact Finset.disjoint_left.mp hreserved + (Finset.mem_biUnion.mpr ⟨eta, heta, he⟩) heta + simp only [Q, Finset.union_singleton, Finset.card_insert_of_notMem hn, + good.twoColors q eta heta] + have hQdis : (D : Set (Fin k)).PairwiseDisjoint Q := by + exact @helper_hQdis_274 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base H good hreserved + have hcover : C = D.biUnion (fun eta => Q eta ∩ C) := by + exact @helper_hcover_287 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base H good i + have hCsum : C.card = ∑ eta ∈ D, (Q eta ∩ C).card := by + calc + C.card = (D.biUnion fun eta => Q eta ∩ C).card := congrArg Finset.card hcover + _ = ∑ eta ∈ D, (Q eta ∩ C).card := ?_ + apply Finset.card_biUnion + intro eta heta theta htheta hne + change Disjoint (Q eta ∩ C) (Q theta ∩ C) + rw [Finset.disjoint_left] + intro c hc hd + exact Finset.disjoint_left.mp (hQdis heta htheta hne) + (Finset.mem_inter.mp hc).1 (Finset.mem_inter.mp hd).1 + have hcontribution : ∀ eta ∈ D, + (Q eta ∩ C).card ≤ 2 + if eta ∈ F then 1 else 0 := by + exact @helper_hcontribution_261 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base H good i hQcard + have hFsub : F ⊆ D := Finset.filter_subset _ _ + have hindicator : (∑ eta ∈ D, if eta ∈ F then (1 : ℕ) else 0) = F.card := by + rw [← Finset.sum_filter] + have hfilter : D.filter (fun eta => eta ∈ F) = F := by + ext eta + simp only [Finset.mem_filter] + exact ⟨fun h => h.2, fun h => ⟨hFsub h, h⟩⟩ + rw [hfilter] + simp + have hupper : C.card ≤ 2 * D.card + F.card := by + rw [hCsum] + calc + (∑ eta ∈ D, (Q eta ∩ C).card) ≤ + ∑ eta ∈ D, (2 + if eta ∈ F then 1 else 0) := + Finset.sum_le_sum hcontribution + _ = 2 * D.card + F.card := by + rw [Finset.sum_add_distrib, hindicator] + simp [Nat.mul_comm] + have hseven : 7 ≤ F.card := by + have hd : D.card ≤ ett.rounds := HierarchyStoredColorsCardinality H q + omega + obtain ⟨eta, heta⟩ := Function.Embedding.exists_of_card_le_finset + (α := Fin 7) (s := F) (by simpa using hseven) + refine ⟨eta, eta.injective, ?_⟩ + intro h + have hf : eta h ∈ F := heta ⟨h, rfl⟩ + obtain ⟨hd, hfull⟩ := Finset.mem_filter.mp hf + have hCX : C ⊆ X i := Finset.inter_subset_left + have hself : eta h ∈ Q (eta h) := Finset.mem_union_right _ (Finset.mem_singleton_self _) + have hx : eta h ∈ X i := hCX (hfull hself) + refine ⟨hd, (Finset.mem_sdiff.mp (Finset.mem_sdiff.mp hx).1).1, ?_⟩ + rw [Finset.disjoint_left] + intro c hc hu + exact (Finset.mem_sdiff.mp (hCX (hfull hc))).2 hu + +private theorem helper_continuation_195.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let Ty : ℕ → TreeSequence G e0 := fun (i : ℕ) => TreeSequencePrefix T (min (A.length + i) + T.length) ( + have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min + (A.length + i) T.length) => + by + omega + ) (Nat.min_le_right (A.length + i) T.length); + let B : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion + fun (v : V) => MissingColors G phi v; + let U : ℕ → Finset (Fin k) := fun (i : ℕ) => {c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + i ∧ phi (T.edge r) = some + c}; + let X : ℕ → Finset (Fin k) := fun (i : ℕ) => (TreeMissingColors phi (Ty i) \ B) \ U i; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (good.gamma q); + ∀ (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet (Ty (ell - (1 : ℕ))))) (_ : (2 + : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) (_ : + TreeSequenceInitialSegment A T) (_ : TreeSequenceVertexSet base.core ⊆ + TreeSequenceVertexSet A) (_ : TreeSequenceVertexSet Tn ⊆ TreeSequenceVertexSet base.core) + (_ : MaximumDegree G + (1 : ℕ) ≤ k) (_ : ( + ∀ j ≤ ell, (Ty j).length = A.length + j)) (_ : ( + ∀ (a b : ℕ) (_ : (Ty a).length ≤ (Ty b).length), TreeSequenceVertexSet (Ty a) ⊆ + TreeSequenceVertexSet (Ty b))) (_ : ( + ∀ {S R : TreeSequence G e0} (_ : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R), + TreeMissingColors phi S ⊆ TreeMissingColors phi R)), + ∀ i < ell, i ≤ ell - (1 : ℕ) → (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (X i).card ∧ ((X i \ (Gamma ∪ + D)).card ≤ (4 : ℕ) → + ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ + ∀ (h : Fin (7 : ℕ)), eta h ∈ D ∧ eta h ∈ TreeMissingColors phi (Ty i) ∧ Disjoint (good.gamma q + (eta h) ∪ {eta h}) (U i)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good n Tn q A ell Ty B U X D Gamma + hprefixElementary hlarge hAT hcoreA hTnCore hdegree hTylen prefixMono missingMono i hi hiell + have hilen := hTylen i (by omega) + have hlastlen := hTylen (ell - 1) (by omega) + have hYiLast := prefixMono i (ell - 1) (by omega) + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet (Ty i)) := by + intro u hu v hv huv + exact hprefixElementary (hYiLast hu) (hYiLast hv) huv + have hAY : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet (Ty i) := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + obtain ⟨r, hr⟩ := hv + obtain ⟨hlen, hver, _⟩ := hAT + refine ⟨⟨r.val, by have := r.isLt; omega⟩, ?_⟩ + change T.vertex _ = v + exact (hver r).trans hr + let N := TreeSequenceVertexSet (Ty i) \ TreeSequenceVertexSet A + let M := N.biUnion fun v => MissingColors G phi v + have hNcard : N.card = i := by + have hcard (S : TreeSequence G e0) : (TreeSequenceVertexSet S).card = S.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, S.vertex_injective] + have hc := Finset.card_sdiff_add_card_eq_card hAY + change N.card + (TreeSequenceVertexSet A).card = + (TreeSequenceVertexSet (Ty i)).card at hc + rw [hcard, hcard, hilen] at hc + omega + have hMcard : i ≤ M.card := by + have hdis : (N : Set V).PairwiseDisjoint (fun v => MissingColors G phi v) := by + intro u hu v hv huv + exact helem (Finset.mem_sdiff.mp hu).1 (Finset.mem_sdiff.mp hv).1 huv + change i ≤ (N.biUnion fun v => MissingColors G phi v).card + rw [Finset.card_biUnion hdis] + calc + i = ∑ v ∈ N, (1 : ℕ) := by simp [hNcard] + _ ≤ ∑ v ∈ N, (MissingColors G phi v).card := by + apply Finset.sum_le_sum + intro v hv + exact Finset.one_le_card.mpr (MissingColorsNonemptyOfMaximumDegree G phi hdegree v) + have unionDisjoint : ∀ (P Q : Finset V), + P ⊆ TreeSequenceVertexSet (Ty i) → Q ⊆ TreeSequenceVertexSet (Ty i) → + Disjoint P Q → Disjoint (P.biUnion fun v => MissingColors G phi v) + (Q.biUnion fun v => MissingColors G phi v) := by + intro P Q hP hQ hd + rw [Finset.disjoint_left] + intro c hc hd' + obtain ⟨u, hu, hcu⟩ := Finset.mem_biUnion.mp hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hd' + have hne : u ≠ v := by + intro huv + exact Finset.disjoint_left.mp hd hu (huv.symm ▸ hv) + exact Finset.disjoint_left.mp (helem (hP hu) (hQ hv) hne) hcu hcv + have hAMdis : Disjoint (TreeMissingColors phi A) M := by + apply unionDisjoint (TreeSequenceVertexSet A) N hAY + (fun v hv => (Finset.mem_sdiff.mp hv).1) + rw [Finset.disjoint_left] + exact fun v hv hn => (Finset.mem_sdiff.mp hn).2 hv + have hAMeq : TreeMissingColors phi A ∪ M = TreeMissingColors phi (Ty i) := by + ext c + simp only [TreeMissingColors, M, N, Finset.mem_union, Finset.mem_biUnion, + Finset.mem_sdiff] + constructor + · rintro (⟨v, hv, hc⟩ | ⟨v, ⟨hv, _⟩, hc⟩) + · exact ⟨v, hAY hv, hc⟩ + · exact ⟨v, hv, hc⟩ + · rintro ⟨v, hv, hc⟩ + by_cases ha : v ∈ TreeSequenceVertexSet A + · exact Or.inl ⟨v, ha, hc⟩ + · exact Or.inr ⟨v, ⟨hv, ha⟩, hc⟩ + have hAMcard : (TreeMissingColors phi A).card + M.card = + (TreeMissingColors phi (Ty i)).card := by + rw [← hAMeq, Finset.card_union_of_disjoint hAMdis] + have hTnA := hTnCore.trans hcoreA + have hTBdis : Disjoint (TreeMissingColors phi Tn) B := by + apply unionDisjoint (TreeSequenceVertexSet Tn) + (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn) + (hTnA.trans hAY) + (fun v hv => hAY (hcoreA (Finset.mem_sdiff.mp hv).1)) + rw [Finset.disjoint_left] + exact fun v hv hn => (Finset.mem_sdiff.mp hn).2 hv + have hTBA : TreeMissingColors phi Tn ∪ B ⊆ TreeMissingColors phi A := by + intro c hc + rcases Finset.mem_union.mp hc with hc | hc + · exact missingMono hTnA hc + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, hcoreA (Finset.mem_sdiff.mp hv).1, hcv⟩ + have hbaseCount : (TreeMissingColors phi Tn).card + B.card ≤ + (TreeMissingColors phi A).card := by + rw [← Finset.card_union_of_disjoint hTBdis] + exact Finset.card_le_card hTBA + have hUcard : (U i).card ≤ i := by + exact @helper_hUcard_229 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base H i hilen hNcard + have havailable : 2 * ett.rounds + 11 ≤ (X i).card := by + have hfirst : (TreeMissingColors phi (Ty i)).card ≤ + (TreeMissingColors phi (Ty i) \ B).card + B.card := + Finset.card_le_card_sdiff_add_card + have hsecond : (TreeMissingColors phi (Ty i) \ B).card ≤ (X i).card + (U i).card := + Finset.card_le_card_sdiff_add_card + omega + refine ⟨havailable, ?_⟩ + intro hsmall + exact @helper_continuation_351 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base H good i havailable hsmall +theorem NineN {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (_ : 0 < ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) + (good : GoodHierarchy H) + (hprefixElementary : + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := fun i : ℕ => + TreeSequencePrefix T (min (A.length + i) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (Ty (ell - 1)))) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := T.length - A.length + let Ty := fun i : ℕ => + TreeSequencePrefix T (min (A.length + i) T.length) + (by have hA := A.positive; have hT := T.positive; omega) (Nat.min_le_right _ _) + let baseExtraMissing := + ((TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion fun v => + MissingColors G phi v) + let tailUsed := fun i : ℕ => + (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < A.length + i ∧ phi (T.edge r) = some c + let available := fun i : ℕ => + (TreeMissingColors phi (Ty i) \ baseExtraMissing) \ tailUsed i + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (good.gamma q) + ∀ i : ℕ, + i < ell → + 2 * ett.rounds + 11 ≤ (available i).card ∧ + ((available i \ (Gamma ∪ D)).card ≤ 4 → + ∃ eta : Fin 7 → Fin k, + Function.Injective eta ∧ + ∀ h : Fin 7, + eta h ∈ D ∧ + eta h ∈ TreeMissingColors phi (Ty i) ∧ + Disjoint (good.gamma q (eta h) ∪ {eta h}) (tailUsed i)) := by + classical + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let ell := T.length - A.length + let Ty := fun i : ℕ => + TreeSequencePrefix T (min (A.length + i) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + let B := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G phi v + let U := fun i : ℕ => (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < A.length + i ∧ phi (T.edge r) = some c + let X := fun i : ℕ => (TreeMissingColors phi (Ty i) \ B) \ U i + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (good.gamma q) + change ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (Ty (ell - 1))) at hprefixElementary + change 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card at hlarge + change ∀ i : ℕ, i < ell → + 2 * ett.rounds + 11 ≤ (X i).card ∧ + ((X i \ (Gamma ∪ D)).card ≤ 4 → + ∃ eta : Fin 7 → Fin k, Function.Injective eta ∧ + ∀ h : Fin 7, eta h ∈ D ∧ + eta h ∈ TreeMissingColors phi (Ty i) ∧ + Disjoint (good.gamma q (eta h) ∪ {eta h}) (U i)) + have stageMono : Monotone (fun j => TreeSequenceVertexSet (H.stage j)) := by + apply Fin.monotone_iff_le_succ.mpr + intro j + exact TreeSequenceInitialSegmentVertexSetSubset (H.nested j) + have hAT : TreeSequenceInitialSegment A T := by + by_cases hz : H.dividerCount = 0 + · have hA : A = base.core := by + have hq : q = 0 := by apply Fin.ext; simp [q, hz] + simp [A, HierarchyStarredStage, hq] + have ht : H.stage ⟨1, by omega⟩ = T := by + convert H.terminalStage using 1; congr 1; apply Fin.ext; simp [hz] + simpa only [hA, ht] using H.coreInsideFirst + · let r : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hq : q = r.succ := by apply Fin.ext; simp [q, r]; omega + have hA : A = H.stage r.succ.castSucc := by + change HierarchyStarredStage H q = _ + rw [hq] + rfl + have ht : q.succ = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [q] + have hc : H.stage r.succ.succ = T := by + simpa only [hq] using (congrArg H.stage ht).trans H.terminalStage + simpa only [hq, ← hA, hc] using H.nested q + have hcoreA : TreeSequenceVertexSet base.core ⊆ TreeSequenceVertexSet A := by + by_cases hz : H.dividerCount = 0 + · have hA : A = base.core := by + have hq : q = 0 := by apply Fin.ext; simp [q, hz] + simp [A, HierarchyStarredStage, hq] + rw [hA] + · let r : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hq : q = r.succ := by apply Fin.ext; simp [q, r]; omega + have hA : A = H.stage r.succ.castSucc := by + change HierarchyStarredStage H q = _ + rw [hq] + rfl + rw [hA] + exact (TreeSequenceInitialSegmentVertexSetSubset H.coreInsideFirst).trans + (stageMono (by change 1 ≤ r.val + 1; omega)) + have hTnCore : TreeSequenceVertexSet Tn ⊆ TreeSequenceVertexSet base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨u⟩⟩ := base.parallel hp + exact TreeSequenceInitialSegmentVertexSetSubset u.leftSegment + · have hc := base.nonparallel hp + change base.core = Tn at hc + rw [hc] + have hdegree : MaximumDegree G + 1 ≤ k := by + have hzero := ett.series.certified 0 + cases hzero with + | initial triple => exact triple.2.2.1 + have hAlen : A.length ≤ T.length := hAT.choose + have hTylen : ∀ j, j ≤ ell → (Ty j).length = A.length + j := by + intro j hj + change min (A.length + j) T.length = A.length + j + apply Nat.min_eq_left + dsimp [ell] at hj + omega + have prefixMono : ∀ a b, (Ty a).length ≤ (Ty b).length → + TreeSequenceVertexSet (Ty a) ⊆ TreeSequenceVertexSet (Ty b) := by + intro a b hab v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + obtain ⟨r, hr⟩ := hv + refine ⟨Fin.castLE (Nat.succ_le_succ hab) r, ?_⟩ + simpa only [Ty, TreeSequencePrefix, Fin.castLE] using hr + have missingMono : ∀ {S R : TreeSequence G e0}, + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → + TreeMissingColors phi S ⊆ TreeMissingColors phi R := by + intro S R h c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, h hv, hcv⟩ + intro i hi + have hiell : i ≤ ell - 1 := by omega + exact @helper_continuation_195 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base H good hprefixElementary hlarge hAT hcoreA hTnCore hdegree hTylen + prefixMono missingMono i hi hiell +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/NormalCycleEdge.lean b/LeanPool/GoldbergSeymour/NormalCycleEdge.lean new file mode 100644 index 0000000000..cb04824a77 --- /dev/null +++ b/LeanPool/GoldbergSeymour/NormalCycleEdge.lean @@ -0,0 +1,42 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple + +/-! +# Normal Cycle Edge + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The distinguished cycle edge at a position, using the uncolored edge first and the closing edge +last. +-/ +noncomputable def NormalCycleEdge {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {T : TreeSequence G e0} (N : NormalGlobalMaximumTriple G k e0 phi T) (i : Fin N.height) : E + := by + classical + if hzero : i.val = 0 then + exact e0 + else if hlast : i.val + 1 = N.height then + exact N.closingEdge + else + exact T.edge ⟨i.val, by + have hi := i.isLt + have hu := N.height_upper + omega⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/NormalGlobalMaximumTriple.lean b/LeanPool/GoldbergSeymour/NormalGlobalMaximumTriple.lean new file mode 100644 index 0000000000..64f059c13c --- /dev/null +++ b/LeanPool/GoldbergSeymour/NormalGlobalMaximumTriple.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Combinatorics.SimpleGraph.Walk.Traversal +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple + +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Normal Global Maximum Triple + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- A maximum triple with a specified alternating trunk, missing colors and a closing path. -/ +structure NormalGlobalMaximumTriple {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) where + global : GlobalMaximumTriple G k e0 phi T + /-- The number of vertices in the distinguished normal trunk. -/ + height : ℕ + height_lower : 2 ≤ height + height_upper : height ≤ T.length + 1 + /-- The distinguished color constrained by the accompanying missing-color conditions. -/ + alpha : Fin k + /-- The second distinguished color in the alternating configuration. -/ + beta : Fin k + alpha_missing : alpha ∈ MissingColors G phi (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩) + beta_missing : beta ∈ MissingColors G phi (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩) + /-- The edge closing the alternating trunk. -/ + closingEdge : E + /-- The index of the distinguished final trunk or departure vertex. -/ + lastIndex : Fin (T.length + 1) + lastIndex_height : lastIndex.val + 1 = height + closing_ends : G.ends closingEdge = s(T.vertex lastIndex, T.vertex ⟨0, Nat.zero_lt_succ T.length⟩) + /-- The alternating path joining the trunk endpoints. -/ + closingPath : + (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩)) + (Sum.inl (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + closingPath_isPath : closingPath.IsPath + closingPath_length : closingPath.length = 2 * (height - 1) + closingPath_vertices : + ∀ v : V, + Sum.inl v ∈ closingPath.support ↔ ∃ i : Fin height, v = T.vertex (Fin.castLE height_upper i) + closingPath_edges : + ∀ f : E, + Sum.inr f ∈ closingPath.support ↔ + f = closingEdge ∨ ∃ j : Fin T.length, 1 ≤ j.val ∧ j.val + 2 ≤ height ∧ f = T.edge j + trunk_edge_ends : + ∀ j : Fin T.length, 1 ≤ j.val → j.val + 2 ≤ height → G.ends (T.edge j) = s(T.vertex ⟨j.val, + Nat.lt_succ_of_lt j.isLt⟩, T.vertex j.succ) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/NormalTripleTrunk.lean b/LeanPool/GoldbergSeymour/NormalTripleTrunk.lean new file mode 100644 index 0000000000..1d3d69cb4f --- /dev/null +++ b/LeanPool/GoldbergSeymour/NormalTripleTrunk.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +/-! +# Normal Triple Trunk + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The prefix of a normal maximum triple ending at its distinguished height. -/ +noncomputable def NormalTripleTrunk {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {T : TreeSequence G e0} (N : NormalGlobalMaximumTriple G k e0 phi T) : TreeSequence G e0 := by + exact TreeSequencePrefix T (N.height - 1) + (by have h := N.height_lower; omega) + (by have h := N.height_upper; omega) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/NormalizePositiveTerminalMaximum.lean b/LeanPool/GoldbergSeymour/NormalizePositiveTerminalMaximum.lean new file mode 100644 index 0000000000..7d512cce7d --- /dev/null +++ b/LeanPool/GoldbergSeymour/NormalizePositiveTerminalMaximum.lean @@ -0,0 +1,478 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingTerminalClosureEq +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MaximumStableClosureExists +public import LeanPool.GoldbergSeymour.TechnicalTheoremLarge +public import LeanPool.GoldbergSeymour.TerminalClosureMaximum +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeUnique +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Normalize Positive Terminal Maximum + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem NormalizePositiveTerminalMaximum_terminalSeedAndClosure_63.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), + ∃ (seed : TreeSequence G e0), IsProperEdgeColoring G (ett.series.data.coloring (Fin.last + ett.rounds)) ∧ IsOneEdgeUncolored (ett.series.data.coloring (Fin.last ett.rounds)) e0 ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ seed = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∨ (ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) + = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges (Fin.last ett.rounds) = { f } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed) ∧ + TashkinovClosure (ett.series.data.coloring (Fin.last ett.rounds)) seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + classical + intro V E _ _ _ G k e0 input T generating ett + let q : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt ett.roundsPositive) (by omega)⟩ + have hq : q.succ = Fin.last ett.rounds := by + apply Fin.ext + exact Nat.sub_add_cancel ett.roundsPositive + have hq2 : q.succ.succ = Fin.last (ett.rounds + 1) := by + rw [hq] + rfl + have step := ett.series.certified (Fin.last ett.rounds) + generalize hidx : Fin.last ett.rounds = target at step + cases step with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv : ett.rounds = 0 := by + simpa using congrArg Fin.val hidx + have hp := ett.roundsPositive + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val hidx + simp [q] at hv ⊢ + omega + subst i + refine ⟨adjoined, ?_, ?_, Or.inr ?_, ?_⟩ + · rw [currentColoring] + exact choice.selectedProper + · rw [currentColoring] + exact choice.selectedOneUncolored + · refine ⟨Or.inl ?_, choice.edge, ?_, ?_⟩ + · exact currentKind + · exact currentEdges + · exact adjoinedExactly + · rw [← hq2] + exact closedExtension + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val hidx + simp [q] at hv ⊢ + omega + subst i + refine ⟨ett.series.data.tree (Fin.last ett.rounds).castSucc, + ?_, ?_, Or.inl ?_, ?_⟩ + · exact currentProper + · exact currentOneUncolored + · refine ⟨currentKind, ?_⟩ + rw [← hq] + · rw [← hq, ← hq2] + exact closedExtension + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val hidx + simp [q] at hv ⊢ + omega + subst i + refine ⟨adjoined, ?_, ?_, Or.inr ?_, ?_⟩ + · rw [currentColoring] + exact previousProper + · rw [currentColoring] + exact previousOneUncolored + · refine ⟨Or.inr ?_, available.edge, ?_, ?_⟩ + · exact currentKind + · exact currentEdges + · exact adjoinedExactly + · rw [← hq2] + exact closedExtension + +private theorem NormalizePositiveTerminalMaximum_terminalMaximum_253.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), + let terminal := Fin.last ett.rounds; + let Tn := ett.series.data.tree terminal.castSucc; + let phiN := ett.series.data.coloring terminal; + let C := TashkinovStoredColors ett.series.data terminal; + ∀ (seed : TreeSequence G e0), IsProperEdgeColoring G (ett.series.data.coloring (Fin.last + ett.rounds)) → IsOneEdgeUncolored (ett.series.data.coloring (Fin.last ett.rounds)) e0 → + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ seed = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∨ (ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) + = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges (Fin.last ett.rounds) = { f } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed) → + ∀ (sigmaN : PartialEdgeColoring E k) (Tstar : TreeSequence G e0), ( + ∀ (rho : PartialEdgeColoring E k) (other : TreeSequence G e0), IsProperEdgeColoring G rho → + IsOneEdgeUncolored rho e0 → StableColoring Tn C phiN rho → TashkinovClosure rho seed other + → (TreeSequenceVertexSet other).card ≤ (TreeSequenceVertexSet Tstar).card) → + ∀ (hcorr : Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigmaN Tstar)), + let corr := Classical.choice hcorr; corr.replacementSeries.data.tree (Fin.last (ett.rounds + + 1)) = Tstar → MaximumProperty corr.replacementETT → TerminalClosureMaximum + corr.replacementETT := by + classical + intro V E _ _ _ G k e0 input T generating ett terminal Tn phiN C seed hproper hone hroute + sigmaN _ hmax hcorr corr terminalEq replacementMP + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generatingEq => + cases rungAgreement + have seriesSame : replacementData = replacementSeries := + eq_of_heq seriesPresentation + cases seriesSame + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let q : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt ett.roundsPositive) (by omega)⟩ + have hq : q.succ = terminal := by + apply Fin.ext + exact Nat.sub_add_cancel ett.roundsPositive + have treeEq : replacementSeries.data.tree terminal.castSucc = + ett.series.data.tree terminal.castSucc := by + rw [← hq] + exact ladderTreesAgree q + have kindEq : replacementSeries.data.kind terminal = + ett.series.data.kind terminal := extensionKindsAgree terminal + have edgesEq : replacementSeries.data.connectingEdges terminal = + ett.series.data.connectingEdges terminal := + connectingEdgesAgree terminal + have stableBridge : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) + (replacementSeries.data.coloring terminal) := by + rw [← hq] + exact replacementStable q + have missingEq : + forall v, v ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc) -> MissingColors + G (replacementSeries.data.coloring terminal) v = MissingColors G (ett.series.data.coloring + terminal) v := by + intro v hv + exact stableBridge.2 v hv + have treeMissingEq : + TreeMissingColors (replacementSeries.data.coloring terminal) + (replacementSeries.data.tree terminal.castSucc) = + TreeMissingColors (ett.series.data.coloring terminal) + (ett.series.data.tree terminal.castSucc) := by + rw [treeEq] + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by rw [← missingEq v hv]; exact hc⟩ + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by rw [missingEq v hv]; exact hc⟩ + have storedEq : TashkinovStoredColors replacementSeries.data terminal = + TashkinovStoredColors ett.series.data terminal := by + have nonzero : ¬ terminal.val = 0 := by + simpa [terminal] using + (Nat.ne_of_gt (Nat.zero_lt_of_lt ett.roundsPositive)) + unfold TashkinovStoredColors + simp only [ite_eq_right nonzero] + ext c + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · rintro ⟨⟨h, hh, hc⟩, hn⟩ + refine ⟨⟨h, hh, ?_⟩, ?_⟩ + · by_cases hle : h.val ≤ terminal.val + · simp only [ite_eq_left hle] at hc ⊢ + simpa [storedColorsAgree h] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rw [treeMissingEq] at hn + exact hn + · rintro ⟨⟨h, hh, hc⟩, hn⟩ + refine ⟨⟨h, hh, ?_⟩, ?_⟩ + · by_cases hle : h.val ≤ terminal.val + · simp only [ite_eq_left hle] at hc ⊢ + simpa [storedColorsAgree h] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rw [← treeMissingEq] at hn + exact hn + unfold TerminalClosureMaximum + dsimp + intro rho candidateSeed candidate rhoProper rhoOne rhoStable + replacementRoute candidateClosure + have replacementColorProper := replacementProper terminal + have replacementColorOne := replacementOneUncolored terminal + have rhoStableBaseTree : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal) + (replacementSeries.data.coloring terminal) rho := by + rw [← treeEq, ← storedEq] + exact rhoStable + have rhoStableBase : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) rho := by + exact (sc2 G e0 (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal)).trans + (x := ⟨ett.series.data.coloring terminal, ⟨hproper, hone⟩⟩) + (y := ⟨replacementSeries.data.coloring terminal, + ⟨replacementColorProper, replacementColorOne⟩⟩) + (z := ⟨rho, ⟨rhoProper, rhoOne⟩⟩) + stableBridge rhoStableBaseTree + have candidateSeedEq : candidateSeed = seed := by + rcases replacementRoute with replacementPE | replacementSER + · rcases hroute with basePE | baseSER + · exact replacementPE.2.trans (treeEq.trans basePE.2.symm) + · rcases baseSER.1 with baseSE | baseRE + · have impossible : some TashkinovExtensionKind.PE = + some TashkinovExtensionKind.SE := by + calc + some TashkinovExtensionKind.PE = + replacementSeries.data.kind terminal := + replacementPE.1.symm + _ = ett.series.data.kind terminal := kindEq + _ = some TashkinovExtensionKind.SE := baseSE + cases impossible + · have impossible : some TashkinovExtensionKind.PE = + some TashkinovExtensionKind.RE := by + calc + some TashkinovExtensionKind.PE = + replacementSeries.data.kind terminal := + replacementPE.1.symm + _ = ett.series.data.kind terminal := kindEq + _ = some TashkinovExtensionKind.RE := baseRE + cases impossible + · rcases replacementSER with ⟨replacementKind, f, + replacementEdges, replacementAdjoin⟩ + rcases hroute with basePE | baseSER + · rcases replacementKind with replacementSE | replacementRE + · have impossible : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := by + calc + some TashkinovExtensionKind.SE = + replacementSeries.data.kind terminal := replacementSE.symm + _ = ett.series.data.kind terminal := kindEq + _ = some TashkinovExtensionKind.PE := basePE.1 + cases impossible + · have impossible : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := by + calc + some TashkinovExtensionKind.RE = + replacementSeries.data.kind terminal := replacementRE.symm + _ = ett.series.data.kind terminal := kindEq + _ = some TashkinovExtensionKind.PE := basePE.1 + cases impossible + · rcases baseSER with ⟨_, g, baseEdges, baseAdjoin⟩ + have singletonEq : ({f} : Finset E) = {g} := by + calc + {f} = replacementSeries.data.connectingEdges terminal := + replacementEdges.symm + _ = ett.series.data.connectingEdges terminal := edgesEq + _ = {g} := baseEdges + have edgeEq : f = g := by simpa using singletonEq + have replacementAdjoinBase : TreeSequenceAdjoinEdge + (ett.series.data.tree terminal.castSucc) g candidateSeed := by + rw [← treeEq, ← edgeEq] + exact replacementAdjoin + exact TreeSequenceAdjoinEdgeUnique _ _ _ _ + replacementAdjoinBase baseAdjoin + rw [candidateSeedEq] at candidateClosure + have bound := hmax rho candidate rhoProper rhoOne + rhoStableBase candidateClosure + rw [terminalEq] + exact bound + +theorem NormalizePositiveTerminalMaximum + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hfinal : T = ett.series.data.tree (Fin.last (ett.rounds + 1))) + (hMP : MaximumProperty ett) + (hdegree : MaximumDegree G + 1 <= k) + (hlarge : 11 <= TashkinovOrder G) : + exists (sigmaN : PartialEdgeColoring E k) + (Tstar seed : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigmaN Tstar), + IsProperEdgeColoring G sigmaN /\ IsOneEdgeUncolored sigmaN e0 /\ + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigmaN /\ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE /\ + seed = ett.series.data.tree (Fin.last ett.rounds).castSucc) \/ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE \/ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) /\ + exists f : E, + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} /\ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed)) /\ + TashkinovClosure sigmaN seed Tstar /\ + corr.replacementSeries.data.tree (Fin.last (ett.rounds + 1)) = Tstar /\ + MaximumProperty corr.replacementETT /\ + TerminalClosureMaximum corr.replacementETT := by + classical + have terminalSeedAndClosure : + exists seed : TreeSequence G e0, + IsProperEdgeColoring G + (ett.series.data.coloring (Fin.last ett.rounds)) /\ + IsOneEdgeUncolored + (ett.series.data.coloring (Fin.last ett.rounds)) e0 /\ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE /\ + seed = ett.series.data.tree (Fin.last ett.rounds).castSucc) \/ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE \/ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) /\ + exists f : E, + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} /\ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed)) /\ + TashkinovClosure + (ett.series.data.coloring (Fin.last ett.rounds)) seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + exact @NormalizePositiveTerminalMaximum_terminalSeedAndClosure_63 V E inferInstance + inferInstance inferInstance G k e0 input T generating ett + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree terminal.castSucc + let Tfinal : TreeSequence G e0 := + ett.series.data.tree (Fin.last (ett.rounds + 1)) + let phiN : PartialEdgeColoring E k := ett.series.data.coloring terminal + let C : Finset (Fin k) := TashkinovStoredColors ett.series.data terminal + obtain ⟨seed, hproper, hone, hroute, holdClosure⟩ := terminalSeedAndClosure + have hself : StableColoring Tn C phiN phiN := by + exact (sc2 G e0 Tn C).refl ⟨phiN, hproper, hone⟩ + obtain ⟨sigmaN, Tstar, hsproper, hsone, hstable, hclosure, hmax⟩ := + MaximumStableClosureExists Tn seed C phiN + ⟨phiN, Tfinal, hproper, hone, hself, holdClosure⟩ + have holdBound : (TreeSequenceVertexSet Tfinal).card <= + (TreeSequenceVertexSet Tstar).card := + hmax phiN Tfinal hproper hone hself holdClosure + have hlengthBound : Tfinal.length <= Tstar.length := by + simpa [TreeSequenceVertexSet, Finset.card_image_of_injective, + Tfinal.vertex_injective, Tstar.vertex_injective] using holdBound + have hstrictOld : Tn.length < Tfinal.length := by + have hprefix : Tn.length < T.length := by + have hslot : + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + terminal.castSucc := by + apply Fin.ext + rfl + change (ett.series.data.tree terminal.castSucc).length < T.length + rw [← hslot] + exact ett.strictAbovePenultimate + have hfinalLength : T.length = Tfinal.length := + congrArg TreeSequence.length hfinal + exact hprefix.trans_le hfinalLength.le + have hstrict : Tn.length < Tstar.length := by omega + have segmentTrans : forall (A B D : TreeSequence G e0), + TreeSequenceInitialSegment A B -> TreeSequenceInitialSegment B D -> + TreeSequenceInitialSegment A D := by + intro A B D hab hbd + rcases hab with ⟨hab, hvab, heab⟩ + rcases hbd with ⟨hbd, hvbd, hebd⟩ + refine ⟨Nat.le_trans hab hbd, ?_, ?_⟩ + · intro j + calc + D.vertex (Fin.castLE (Nat.succ_le_succ (Nat.le_trans hab hbd)) j) = + D.vertex (Fin.castLE (Nat.succ_le_succ hbd) + (Fin.castLE (Nat.succ_le_succ hab) j)) := by congr 1 + _ = B.vertex (Fin.castLE (Nat.succ_le_succ hab) j) := hvbd _ + _ = A.vertex j := hvab _ + · intro j + calc + D.edge (Fin.castLE (Nat.le_trans hab hbd) j) = + D.edge (Fin.castLE hbd (Fin.castLE hab j)) := by congr 1 + _ = B.edge (Fin.castLE hab j) := hebd _ + _ = A.edge j := heab _ + have hseg : TreeSequenceInitialSegment Tn Tstar := by + have seedToStar := + TashkinovAugmentationSequenceInitialSegment sigmaN seed Tstar hclosure.1 + rcases hroute with hPE | hSER + · simpa [Tn, terminal] using hPE.2 ▸ seedToStar + · rcases hSER with ⟨_, f, _, hadjoin⟩ + exact segmentTrans Tn seed Tstar hadjoin.choose_spec.1 seedToStar + have heligible : + (ett.series.data.kind terminal = some TashkinovExtensionKind.PE /\ + TashkinovAugmentationSequence sigmaN Tn Tstar) \/ + ((ett.series.data.kind terminal = some TashkinovExtensionKind.SE \/ + ett.series.data.kind terminal = some TashkinovExtensionKind.RE) /\ + exists (f : E) (S : TreeSequence G e0), + ett.series.data.connectingEdges terminal = {f} /\ + TreeSequenceAdjoinEdge Tn f S /\ + TashkinovAugmentationSequence sigmaN S Tstar) := by + rcases hroute with hPE | hSER + · exact Or.inl ⟨hPE.1, by simpa [hPE.2] using hclosure.1⟩ + · rcases hSER with ⟨hk, f, hf, hadjoin⟩ + exact Or.inr ⟨hk, f, seed, hf, hadjoin, hclosure.1⟩ + have hmod : ModColoring ett sigmaN := by + exact (TechnicalTheoremLarge G k e0 input T generating ett hMP hdegree hlarge).2.2.2.2.2 + sigmaN hsproper hsone hstable + have hcorr : Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigmaN Tstar) := + hmod.2.2 Tstar hseg hstrict heligible + let corr : CorrespondingExtendedTashkinovTree G k e0 ett sigmaN Tstar := + Classical.choice hcorr + have terminalEq : + corr.replacementSeries.data.tree (Fin.last (ett.rounds + 1)) = Tstar := + CorrespondingTerminalClosureEq G k e0 input T generating ett sigmaN + Tstar seed corr hroute hclosure + have replacementMP : MaximumProperty corr.replacementETT := + MaximumPropertyTransport G k e0 ett sigmaN hmod Tstar corr hMP + have terminalMaximum : TerminalClosureMaximum corr.replacementETT := by + exact @NormalizePositiveTerminalMaximum_terminalMaximum_253 V E inferInstance inferInstance + inferInstance G k e0 input T generating ett seed hproper hone hroute sigmaN Tstar hmax + hcorr terminalEq replacementMP + exact ⟨sigmaN, Tstar, seed, corr, hsproper, hsone, hstable, hroute, + hclosure, terminalEq, replacementMP, terminalMaximum⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/NormalizedDatum.lean b/LeanPool/GoldbergSeymour/NormalizedDatum.lean new file mode 100644 index 0000000000..03a27ba1e1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/NormalizedDatum.lean @@ -0,0 +1,203 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.TerminalStoredColors +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalizedData +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# P2752_T2_Normalized Datum + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2752_T2_NormalizedDatum {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx) + (beta : Fin k) + (hmissing : beta ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2))) + (hunused : ∀ t : Fin T.length, + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + ≤ t.val → phi (T.edge t) ≠ some beta) + (halternative : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Dn := TashkinovStoredColors ett.series.data n + let Dnq := HierarchyStoredColorsAt H q + let Gamma := Dnq.biUnion (C.good.gamma q) + let A := HierarchyStarredStage H q + let tailUsed := (Finset.univ : Finset (Fin k)).filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ phi (T.edge t) = some c + (0 < H.dividerCount ∧ beta ∉ Dnq ∧ beta ∉ Gamma) ∨ + (H.dividerCount = 0 ∧ beta ∉ Dn ∧ beta ∉ Gamma) ∨ + (beta ∈ Dnq ∧ Disjoint (C.good.gamma q beta) tailUsed)) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (hfixed : ∀ t : Fin T.length, P.coloring (T.edge t) = phi (T.edge t)) + (hinvariant : TreeColoringInvariant + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) phi P.coloring) + (hterminal : beta ∈ MissingColors G P.coloring (T.vertex D.terminalVertexIndex)) : + ∃ N : HierarchySituationTwoCaseThreeNormalizedData + G k e0 P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase + P.counterexample P.minimumContext, + N.alpha = beta := by + classical + obtain ⟨hstar, hpath, _⟩ := + P2752_T2_HierarchyMeasures C.hierarchy P.counterexample.hierarchy P.sameGood.1 + have htail : HierarchyFullTailLength P.counterexample = HierarchyFullTailLength C := by + unfold HierarchyFullTailLength + dsimp only + rw [← hstar] + have hprefix : ∀ i : ℕ, HierarchyFullTailPrefix P.counterexample i = + HierarchyFullTailPrefix C i := by + intro i + unfold HierarchyFullTailPrefix + dsimp only + simp only [← hstar] + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + let B := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2) + let Bplus := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + have hlenB : B.length = T.length - 2 := by + have hp : 2 ≤ T.length - A.length := D.tailAtLeastTwo + change min (A.length + (T.length - A.length - 2)) T.length = T.length - 2 + omega + have hlenPlus : Bplus.length = T.length - 1 := by + have hp : 2 ≤ T.length - A.length := D.tailAtLeastTwo + change min (A.length + (T.length - A.length - 1)) T.length = T.length - 1 + omega + have hBT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, (fun _ => rfl), (fun _ => rfl)⟩ + have hplusT : TreeSequenceInitialSegment Bplus T := + ⟨Nat.min_le_right _ _, (fun _ => rfl), (fun _ => rfl)⟩ + have hBplus : TreeSequenceInitialSegment B Bplus := by + have hle : B.length ≤ Bplus.length := by omega + refine ⟨hle, ?_, ?_⟩ + · intro i + rw [← hplusT.2.1 (Fin.castLE (Nat.succ_le_succ hle) i)] + convert hBT.2.1 i using 1 + congr 1 + · intro i + rw [← hplusT.2.2 (Fin.castLE hle i)] + convert hBT.2.2 i using 1 + congr 1 + have hmissingNew : beta ∈ TreeMissingColors P.coloring B := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hmissing + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [hinvariant.2 v (TreeSequenceInitialSegmentVertexSetSubset hBplus hv)] + exact hm + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hmissingNew + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨j, hj⟩ := hv + let earlier : Fin (T.length + 1) := Fin.castLE (Nat.succ_le_succ hBT.1) j + have hearlier : T.vertex earlier = v := (hBT.2.1 j).trans hj + have hearlierBefore : earlier.val < D.penultimateVertexIndex.val := by + have hjbound : j.val ≤ T.length - 2 := by + rw [← hlenB] + exact Nat.le_of_lt_succ j.isLt + have hT : 2 ≤ T.length := + le_trans D.tailAtLeastTwo (Nat.sub_le T.length A.length) + have numeric {a b c : ℕ} (ha : a ≤ c - 2) (hc : 2 ≤ c) + (hb : b + 1 = c) : a < b := by omega + change j.val < D.penultimateVertexIndex.val + exact numeric hjbound hT D.penultimateVertexPosition + have hraw := P2752_T2_TerminalStoredColors ett P.corresponding + obtain ⟨hcount, hcolors⟩ := P.sameGood.2 + have hlast : Fin.cast (congrArg (fun q : ℕ => q + 1) hcount) + (Fin.last C.hierarchy.dividerCount) = + Fin.last P.counterexample.hierarchy.dividerCount := by + apply Fin.ext + exact hcount + have hstored : HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) := by + simpa only [hlast] using (hcolors (Fin.last C.hierarchy.dividerCount)).1 + have hgamma : ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy + (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta := by + simpa only [hlast] using (hcolors (Fin.last C.hierarchy.dividerCount)).2 + have hGamma : + (HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount)).biUnion + (C.good.gamma (Fin.last C.hierarchy.dividerCount)) = + (HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount)) := by + rw [← hstored] + exact Finset.biUnion_congr rfl hgamma + have hused : + (Finset.univ : Finset (Fin k)).filter (fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ phi (T.edge t) = some c) = + (Finset.univ : Finset (Fin k)).filter (fun c => + ∃ t : Fin T.length, + (HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount)).length ≤ t.val ∧ + P.coloring (T.edge t) = some c) := by + apply Finset.filter_congr + intro c _ + simp only [← hstar, hfixed, A] + refine ⟨{ + toHierarchySituationTwoCaseThreeData := { + toHierarchySituationTwoCommonTailData := { + tailAtLeastTwo := by rw [htail]; exact D.tailAtLeastTwo + pathNumberFull := by rw [← hpath, htail]; exact D.pathNumberFull + lastEdgeIndex := D.lastEdgeIndex + penultimateVertexIndex := D.penultimateVertexIndex + terminalVertexIndex := D.terminalVertexIndex + lastEdgePosition := D.lastEdgePosition + penultimateVertexPosition := D.penultimateVertexPosition + terminalVertexPosition := D.terminalVertexPosition + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate + theta := D.theta + thetaOnLastEdge := (hfixed D.lastEdgeIndex).trans D.thetaOnLastEdge } + alpha := beta + alphaMissingTerminal := hterminal + earlierVertexIndex := earlier + earlierVertexBeforePenultimate := hearlierBefore + alphaMissingEarlier := by rw [hearlier]; exact hm } + alphaMissingTwoBefore := by + change beta ∈ TreeMissingColors P.coloring + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 2)) + rw [htail, hprefix] + exact hmissingNew + alphaUnusedOnFullTail := ?_ + normalizedAlternative := ?_ }, rfl⟩ + · dsimp only + intro t ht + rw [hfixed t] + apply hunused t + simpa only [hstar] using ht + · dsimp only + rcases halternative with h | h | h + · exact Or.inl ⟨by simpa only [← hcount] using h.1, + by simpa only [← hstored] using h.2.1, + by simpa only [← hGamma] using h.2.2⟩ + · exact Or.inr (Or.inl ⟨by simpa only [← hcount] using h.1, + by simpa only [hraw] using h.2.1, + by simpa only [← hGamma] using h.2.2⟩) + · refine Or.inr (Or.inr ⟨by simpa only [← hstored] using h.1, ?_⟩) + simpa only [← hgamma beta h.1, ← hused] using h.2 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OneAdditionPreparatoryLemmas.lean b/LeanPool/GoldbergSeymour/OneAdditionPreparatoryLemmas.lean new file mode 100644 index 0000000000..e1710381ec --- /dev/null +++ b/LeanPool/GoldbergSeymour/OneAdditionPreparatoryLemmas.lean @@ -0,0 +1,169 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.ChangeLemmaBothInside +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableChange +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Preparatory lemmas for hierarchy normalization + +Extracted from Wesley Pegden’s Trellis formalization of the Goldberg–Seymour +theorem at 88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. These lemmas establish +properties used in the computed hierarchy records of + `HierarchyCounterexampleOneAdditionPositiveDividerImpossible`. +-/ + +@[expose] public section + +namespace GoldbergSeymour.OneAdditionPreparatoryLemmas + +theorem helper_hnew_2064.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let y : V := T.vertex (Fin.last T.length); + ∀ (alpha theta : Fin k), + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi theta alpha (Sum.inl y); + ∀ + (_ : + (IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 ∧ + StableColoring A (TashkinovStoredColors ett.series.data n) phi sigma ∧ + TreeColoringInvariant A phi sigma ∧ + ∀ (f : E), TreeIncidentEdge A f → sigma f = phi f)) + (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (hterminalTree : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm hterminalTree), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment _a + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + ∀ + (_ : + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A)) + (a : Fin K.dividerCount), + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H a.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H a.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n Tn y alpha theta sigma hstableA corrT + baseT hcoreT hterminalTree K stageInsideA a + ext c + simp only [Finset.mem_biUnion] + constructor <;> rintro ⟨v, hv, hc⟩ + · exact ⟨v, hv, by + rw [← hstableA.2.2.2.1.2 v + (TreeSequenceInitialSegmentVertexSetSubset (stageInsideA a.succ) + (Finset.mem_sdiff.mp hv).1)] + exact hc⟩ + · exact ⟨v, hv, by + rw [hstableA.2.2.2.1.2 v + (TreeSequenceInitialSegmentVertexSetSubset (stageInsideA a.succ) + (Finset.mem_sdiff.mp hv).1)] + exact hc⟩ + +end GoldbergSeymour.OneAdditionPreparatoryLemmas + +end diff --git a/LeanPool/GoldbergSeymour/OneDividerRefresh.lean b/LeanPool/GoldbergSeymour/OneDividerRefresh.lean new file mode 100644 index 0000000000..5c5dc6f939 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OneDividerRefresh.lean @@ -0,0 +1,2079 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +/-! +# P2940_T1_One Divider Refresh + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable abbrev helperHW360.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (U W : TreeSequence G e0) → + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U) → + (corrW : CorrespondingExtendedTashkinovTree G k e0 ett phi W) → + (baseU : HierarchyBase corrU.replacementETT phi) → + (baseW : HierarchyBase corrW.replacementETT phi) → + baseW.core = baseU.core → + (H : TashkinovHierarchy corrU.replacementETT baseU) → + let d : ℕ := H.dividerCount; + let N : ℕ := d + (1 : ℕ); + (∀ (X : TreeSequence G e0) + (corr : + CorrespondingExtendedTashkinovTree G k e0 ett + phi X), + corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc = + ett.series.data.tree + (Fin.last ett.rounds).castSucc ∧ + corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors + corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors ett.series.data + (Fin.last ett.rounds)) → + let stageW : + Fin (N + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (N + (2 : ℕ))) ↦ + if hj : (↑j : ℕ) = d + (2 : ℕ) then W + else + H.stage + (⟨(↑j : ℕ), + (by + have := corrU.rungAgreement; + have := T.positive; have := U.positive; + omega)⟩ : + Fin (H.dividerCount + (2 : ℕ))); + (hsize : W.length = U.length + (1 : ℕ)) → + TreeSequenceInitialSegment U W → + (∀ {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B), + A = + TreeSequencePrefix B A.length A.positive + hAB.1) → + (∀ (p : ℕ) (hp : (1 : ℕ) ≤ p) + (hpU : p ≤ U.length), + TreeSequencePrefix U p hp hpU = + TreeSequencePrefix W p hp + ((by have := W.positive; omega))) → + (∀ (j : Fin (N + (2 : ℕ))) + (hj : (↑j : ℕ) ≤ d + (1 : ℕ)), + stageW j = + H.stage + (⟨(↑j : ℕ), + (by + have := corrU.rungAgreement; + have := T.positive; + have := U.positive; omega)⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (∀ (j : Fin (d + (2 : ℕ))), + stageW + (⟨(↑j : ℕ), + (by + have := corrU.rungAgreement; + have := T.positive; + have := U.positive; + omega)⟩ : + Fin (N + (2 : ℕ))) = + H.stage j) → + stageW + (⟨d + (2 : ℕ), + (by + have := corrU.rungAgreement; + have := T.positive; + have := U.positive; + omega)⟩ : + Fin (N + (2 : ℕ))) = + W → + let _ : + Fin N → Fin (W.length + (1 : ℕ)) := + fun (i : Fin N) ↦ + if hi : (↑i : ℕ) < d then + (⟨(↑(H.dividerPosition + (⟨(↑i : ℕ), hi⟩ : + Fin H.dividerCount)) : + ℕ), + have hpos : + (↑(H.dividerPosition + (⟨(↑i : ℕ), hi⟩ : + Fin + H.dividerCount)) : + ℕ) < + U.length + (1 : ℕ) := + (by + have := + corrU.rungAgreement; + have := T.positive; + have := U.positive; + omega); + have _ : + W.length = + U.length + (1 : ℕ) := + hsize; + Decidable.byContradiction + fun + (a : + ¬(↑(H.dividerPosition + (⟨(↑i : ℕ), + hi⟩ : + Fin + H.dividerCount)) : + ℕ) < + W.length + + (1 : ℕ)) ↦ + (by omega)⟩ : + Fin (W.length + (1 : ℕ))) + else + (⟨U.length, + (by + have := U.positive; + have := W.positive; + omega)⟩ : + Fin (W.length + (1 : ℕ))); + (∀ (i : Fin d), + (↑(H.dividerPosition i) : ℕ) < + U.length) → + TashkinovHierarchy + corrW.replacementETT baseW := by + classical + intro V E _ _ _ _ G k e0 input T phi ett U W corrU corrW baseU baseW hcore H d N corrTerminal + stageW hsize hUW prefixEqOfSegment prefixTransfer stageAtOld stageOld stageNew divW + dividerBeforeTerminal + exact { + dividerCount := N + stage := stageW + baseStage := by + calc + stageW 0 = H.stage 0 := by + simpa using stageOld (0 : Fin (d + 2)) + _ = corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc := H.baseStage + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := + (corrTerminal U corrU).1 + _ = corrW.replacementETT.series.data.tree + (Fin.last corrW.replacementETT.rounds).castSucc := + (corrTerminal W corrW).1.symm + terminalStage := by + have hidx : Fin.last (N + 1) = (⟨d + 2, by omega⟩ : Fin (N + 2)) := by + apply Fin.ext + simp [N] + rw [hidx] + exact stageNew + nested := by + intro j + by_cases hj : j.val = d + 1 + · have hleft : stageW j.castSucc = U := by + rw [stageAtOld j.castSucc (by simp [hj])] + have hi : (⟨j.castSucc.val, by simp [hj]⟩ : Fin (d + 2)) = + Fin.last (d + 1) := by apply Fin.ext; simp [hj] + rw [hi, H.terminalStage] + have hright : stageW j.succ = W := by + have hi : j.succ = (⟨d + 2, by omega⟩ : Fin (N + 2)) := by + apply Fin.ext + simp [hj, N] + rw [hi, stageNew] + rw [hleft, hright] + exact hUW + · have hjlt : j.val < d + 1 := by have := j.isLt; omega + have hleft := stageAtOld j.castSucc (by + change j.val ≤ d + 1 + exact Nat.le_of_lt hjlt) + have hright := stageAtOld j.succ (by + change j.val + 1 ≤ d + 1 + omega) + rw [hleft, hright] + let io : Fin (d + 1) := ⟨j.val, by omega⟩ + have hleftIdx : (⟨j.castSucc.val, by exact j.isLt⟩ : Fin (d + 2)) = io.castSucc := + Fin.ext rfl + have hrightIdx : (⟨j.succ.val, by change j.val + 1 < d + 2; omega⟩ : Fin (d + 2)) = + io.succ := + Fin.ext rfl + rw [hleftIdx, hrightIdx] + exact H.nested io + strict := by + intro j + by_cases hj : j.val < d + 1 + · have hleft := stageAtOld j.castSucc (by + change j.val ≤ d + 1 + exact Nat.le_of_lt hj) + have hright := stageAtOld j.succ (by + change j.val + 1 ≤ d + 1 + omega) + rw [hleft, hright] + let io : Fin (d + 1) := ⟨j.val, by omega⟩ + have hleftIdx : (⟨j.castSucc.val, by exact j.isLt⟩ : Fin (d + 2)) = io.castSucc := + Fin.ext rfl + have hrightIdx : (⟨j.succ.val, by change j.val + 1 < d + 2; omega⟩ : Fin (d + 2)) = + io.succ := + Fin.ext rfl + rw [hleftIdx, hrightIdx] + exact H.strict io + · have hjlast : j.val = d + 1 := by have := j.isLt; omega + have hleft : stageW j.castSucc = U := by + rw [stageAtOld j.castSucc (by simp [hjlast])] + have hi : (⟨j.castSucc.val, by simp [hjlast]⟩ : Fin (d + 2)) = + Fin.last (d + 1) := by apply Fin.ext; simp [hjlast] + rw [hi, H.terminalStage] + have hright : stageW j.succ = W := by + have hi : j.succ = (⟨d + 2, by omega⟩ : Fin (N + 2)) := by + apply Fin.ext + simp [hjlast, N] + rw [hi, stageNew] + rw [hleft, hright] + omega + dividerPosition := divW + dividerPositive := by + intro i + by_cases hi : i.val < d + · simpa [divW, hi] using H.dividerPositive ⟨i.val, hi⟩ + · simpa [divW, hi] using U.positive + dividerIncreasing := by + intro i j hij + by_cases hi : i.val < d <;> by_cases hj : j.val < d + · simpa [divW, hi, hj] using + H.dividerIncreasing ⟨i.val, hi⟩ ⟨j.val, hj⟩ hij + · have hpos := dividerBeforeTerminal ⟨i.val, hi⟩ + simp only [hi, ↓reduceDIte, hj, gt_iff_lt, divW] + exact hpos + · omega + · omega + dividerStage := by + intro i + by_cases hi : i.val < d + · let j : Fin (N + 2) := ⟨i.val + 1, by change i.val + 1 < d + 3; omega⟩ + have hstage := stageAtOld j (by + change i.val + 1 ≤ d + 1 + omega) + rw [hstage] + let oldI : Fin d := ⟨i.val, hi⟩ + have hidx : (⟨j.val, by change i.val + 1 < d + 2; omega⟩ : Fin (d + 2)) = + oldI.succ.castSucc := by + apply Fin.ext + simp [j, oldI] + rw [hidx] + have hidx2 : oldI.succ.castSucc = + (⟨oldI.val + 1, by omega⟩ : Fin (d + 2)) := Fin.ext rfl + rw [hidx2, H.dividerStage oldI] + have hp : (H.dividerPosition oldI).val ≤ U.length := + Nat.le_of_lt_succ (H.dividerPosition oldI).isLt + rw [prefixTransfer (H.dividerPosition oldI).val + (H.dividerPositive oldI) hp] + simp [oldI, divW, hi] + · have hlast : i.val = d := by have := i.isLt; omega + have hidx : (⟨i.val + 1, by omega⟩ : Fin (N + 2)) = + (⟨d + 1, by omega⟩ : Fin (N + 2)) := by + apply Fin.ext + simp [hlast] + rw [hidx] + have hstage : stageW ⟨d + 1, by omega⟩ = U := by + let jOld : Fin (N + 2) := ⟨d + 1, by simp [N]⟩ + have hjOld : jOld.val ≤ d + 1 := by change d + 1 ≤ d + 1; omega + have hold := stageAtOld jOld hjOld + have hindex : jOld = (⟨d + 1, by simp [N]⟩ : Fin (N + 2)) := + Fin.ext rfl + change stageW (⟨d + 1, by simp [N]⟩ : Fin (N + 2)) = U + rw [← hindex, hold] + have heq : (⟨d + 1, by omega⟩ : Fin (d + 2)) = Fin.last (d + 1) := + Fin.ext rfl + rw [heq, H.terminalStage] + rw [hstage] + simpa [divW, hi] using (prefixEqOfSegment hUW) + coreInsideFirst := by + by_cases hd : d = 0 + · have hfirst : stageW ⟨1, by omega⟩ = U := by + let jOld : Fin (N + 2) := ⟨1, by simp [N, hd]⟩ + have hbound : jOld.val ≤ d + 1 := by change 1 ≤ d + 1; omega + have hOld := stageAtOld jOld hbound + have hindex : jOld = (⟨1, by omega⟩ : Fin (N + 2)) := Fin.ext rfl + change stageW (⟨1, by omega⟩ : Fin (N + 2)) = U + rw [← hindex, hOld] + have hi : (⟨1, by omega⟩ : Fin (d + 2)) = Fin.last (d + 1) := by + apply Fin.ext + simp [hd] + rw [hi, H.terminalStage] + rw [hfirst, hcore] + have hcoreU := H.coreInsideFirst + have hterminal : H.stage ⟨1, by omega⟩ = U := by + have hi : (⟨1, by omega⟩ : Fin (d + 2)) = Fin.last (d + 1) := by + apply Fin.ext + simp [hd] + rw [hi] + exact H.terminalStage + rw [hterminal] at hcoreU + exact hcoreU + · have hfirst : stageW ⟨1, by omega⟩ = H.stage ⟨1, by omega⟩ := by + simp [stageW, d] + rw [hfirst, hcore] + exact H.coreInsideFirst + } + +private noncomputable abbrev helperGoodW888.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (U W : TreeSequence G e0) → + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U) → + (corrW : CorrespondingExtendedTashkinovTree G k e0 ett phi W) → + (baseU : HierarchyBase corrU.replacementETT phi) → + (baseW : HierarchyBase corrW.replacementETT phi) → + (hcore : baseW.core = baseU.core) → + baseW.closure = baseU.closure → + (H : TashkinovHierarchy corrU.replacementETT baseU) → + (good : GoodHierarchy H) → + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet U) → + (eta beta gammaOne gammaTwo : Fin k) → + (f : E) → + eta ∈ HierarchyTerminalStoredColors H → + beta ∈ + good.gamma (Fin.last H.dividerCount) + eta → + phi f = some beta → + gammaOne ≠ gammaTwo → + gammaOne ∈ + (TreeSequenceVertexSet U \ + TreeSequenceVertexSet + (HierarchyStarredStage H + (Fin.last + H.dividerCount))).biUnion + (MissingColors G phi) → + gammaTwo ∈ + (TreeSequenceVertexSet U \ + TreeSequenceVertexSet + (HierarchyStarredStage + H + (Fin.last + H.dividerCount))).biUnion + (MissingColors G phi) → + Disjoint + (insert gammaOne + ({ gammaTwo } : + Finset (Fin k)) : + Finset (Fin k)) + ((HierarchyTerminalStoredColors + H).biUnion + (good.gamma + (Fin.last + H.dividerCount))) → + TreeColorSetMinusClosed G phi + U + ((HierarchyTerminalStoredColors + H).biUnion + (good.gamma + (Fin.last + H.dividerCount))) → + let d : ℕ := H.dividerCount; + let N : ℕ := d + (1 : ℕ); + (corrTerminal : + ∀ + (X : + TreeSequence G e0) + (corr : + CorrespondingExtendedTashkinovTree + G k e0 ett phi X), + corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc ∧ + corr.replacementETT.series.data.kind + (Fin.last + corr.replacementETT.rounds) = + ett.series.data.kind + (Fin.last + ett.rounds) ∧ + TashkinovStoredColors + corr.replacementETT.series.data + (Fin.last + corr.replacementETT.rounds) = + TashkinovStoredColors + ett.series.data + (Fin.last + ett.rounds)) → + let stageW : + Fin (N + (2 : ℕ)) → + TreeSequence G e0 := + fun + (j : + Fin (N + (2 : ℕ))) ↦ + if hj : + (↑j : ℕ) = + d + (2 : ℕ) then + W + else + H.stage + (⟨(↑j : ℕ), + have _ : + corrU.replacementETT.rounds = + ett.rounds := + corrU.rungAgreement; + have _ : + (1 : ℕ) ≤ + T.length := + T.positive; + have _ : + (1 : ℕ) ≤ + U.length := + U.positive; + Decidable.byContradiction + fun + (a : + ¬(↑j : + ℕ) < + H.dividerCount + + (2 : + ℕ)) ↦ + (by omega)⟩ : + Fin + (H.dividerCount + + (2 : ℕ))); + (hsize : + W.length = + U.length + + (1 : ℕ)) → + (hUW : + TreeSequenceInitialSegment + U W) → + W.edge + (Fin.cast + (have _ : + (1 : ℕ) ≤ + U.length := + U.positive; + have _ : + (1 : ℕ) ≤ + W.length := + W.positive; + Decidable.byContradiction + fun + (a : + ¬U.length + + (1 : + ℕ) = + W.length) ↦ + (by omega)) + (Fin.last + U.length)) = + f → + (prefixEqOfSegment : + ∀ + {A B : + TreeSequence + G e0} + (hAB : + TreeSequenceInitialSegment + A B), + A = + TreeSequencePrefix + B A.length + A.positive + hAB.1) → + (prefixTransfer : + ∀ (p : ℕ) + (hp : + (1 : ℕ) ≤ + p) + (hpU : + p ≤ + U.length), + TreeSequencePrefix + U p hp + hpU = + TreeSequencePrefix + W p hp + (have + _ : + (1 : + ℕ) ≤ + W.length := + W.positive; + Decidable.byContradiction + fun + (a : + ¬p ≤ + W.length) ↦ + (by + omega))) → + (stageAtOld : + ∀ + (j : + Fin + (N + + (2 : + ℕ))) + (hj : + (↑j : + ℕ) ≤ + d + + (1 : + ℕ)), + stageW j = + H.stage + (⟨(↑j : + ℕ), + have + _ : + corrU.replacementETT.rounds = + ett.rounds := + corrU.rungAgreement; + have + _ : + (1 : + ℕ) ≤ + T.length := + T.positive; + have + _ : + (1 : + ℕ) ≤ + U.length := + U.positive; + Decidable.byContradiction + fun + (a : + ¬(↑j : + ℕ) < + H.dividerCount + + (2 : + ℕ)) ↦ + (by + omega)⟩ : + Fin + (H.dividerCount + + (2 : + ℕ)))) → + (stageOld : + ∀ + (j : + Fin + (d + + (2 : + ℕ))), + stageW + (⟨(↑j : + ℕ), + have + _ : + corrU.replacementETT.rounds = + ett.rounds := + corrU.rungAgreement; + have + _ : + (1 : + ℕ) ≤ + T.length := + T.positive; + have + _ : + (1 : + ℕ) ≤ + U.length := + U.positive; + Decidable.byContradiction + fun + (a : + ¬(↑j : + ℕ) < + N + + (2 : + ℕ)) ↦ + (by + omega)⟩ : + Fin + (N + + (2 : + ℕ))) = + H.stage + j) → + (stageNew : + stageW + (⟨d + + (2 : + ℕ), + have + _ : + corrU.replacementETT.rounds = + ett.rounds := + corrU.rungAgreement; + have + _ : + (1 : + ℕ) ≤ + T.length := + T.positive; + have + _ : + (1 : + ℕ) ≤ + U.length := + U.positive; + Decidable.byContradiction + fun + (a : + ¬d + + (2 : + ℕ) < + N + + (2 : + ℕ)) ↦ + (by + omega)⟩ : + Fin + (N + + (2 : + ℕ))) = + W) → + (dividerBeforeTerminal : + ∀ + (i : + Fin + d), + (↑(H.dividerPosition + i) : + ℕ) < + U.length) → + let HW : + TashkinovHierarchy + corrW.replacementETT + baseW := + helperHW360 + G k + e0 + input + T + phi + ett + U W + corrU + corrW + baseU + baseW + hcore + H + corrTerminal + hsize + hUW + (fun + {A + B : + TreeSequence + G + e0} ↦ + prefixEqOfSegment) + prefixTransfer + stageAtOld + stageOld + stageNew + dividerBeforeTerminal; + (hcountW : + HW.dividerCount = + H.dividerCount + + (1 : + ℕ)) → + (∀ + (j : + Fin + (d + + (2 : + ℕ))), + HW.stage + (Fin.castLE + (have + _ : + corrU.replacementETT.rounds = + ett.rounds := + corrU.rungAgreement; + have + _ : + corrW.replacementETT.rounds = + ett.rounds := + corrW.rungAgreement; + have + _ : + (1 : + ℕ) ≤ + T.length := + T.positive; + have + _ : + (1 : + ℕ) ≤ + U.length := + U.positive; + have + _ : + (1 : + ℕ) ≤ + W.length := + W.positive; + Decidable.byContradiction + fun + (a : + ¬d + + (2 : + ℕ) ≤ + HW.dividerCount + + (2 : + ℕ)) ↦ + (by + omega)) + j) = + H.stage + j) → + let + oldIndex : + Fin + (d + + (1 : + ℕ)) → + Fin + (N + + (1 : + ℕ)) := + fun + (j : + Fin + (d + + (1 : + ℕ))) ↦ + (⟨(↑j : + ℕ), + have + _ : + corrU.replacementETT.rounds = + ett.rounds := + corrU.rungAgreement; + have + _ : + (1 : + ℕ) ≤ + T.length := + T.positive; + have + _ : + (1 : + ℕ) ≤ + U.length := + U.positive; + Decidable.byContradiction + fun + (a : + ¬(↑j : + ℕ) < + N + + (1 : + ℕ)) ↦ + (by + omega)⟩ : + Fin + (N + + (1 : + ℕ))); + (∀ + (j : + Fin + (d + + (1 : + ℕ))), + HierarchyStarredStage + HW + (oldIndex + j) = + HierarchyStarredStage + H + j) → + (∀ + (j : + Fin + (d + + (1 : + ℕ))), + HierarchyStageMissingColors + HW + (oldIndex + j) = + HierarchyStageMissingColors + H + j) → + (∀ + (j : + Fin + (d + + (1 : + ℕ))), + HierarchyStoredColorsAt + HW + (oldIndex + j) = + HierarchyStoredColorsAt + H + j) → + HierarchyStarredStage + HW + (Fin.last + HW.dividerCount) = + U → + HierarchyStoredColorsAt + HW + (Fin.last + HW.dividerCount) = + HierarchyTerminalStoredColors + H → + HW.stage + (Fin.last + HW.dividerCount).castSucc = + U → + (∀ + (j : + Fin + (d + + (1 : + ℕ))) + (theta : + Fin + k), + HierarchySegmentColors + HW + (oldIndex + j) + theta = + HierarchySegmentColors + H + j + theta) → + TreeSequenceInitialSegment + (HierarchyStarredStage + H + (Fin.last + d)) + U → + let + newIndex : + Fin + (N + + (1 : + ℕ)) := + Fin.last + N; + let + gammaW : + Fin + (N + + (1 : + ℕ)) → + Fin + k → + Finset + (Fin + k) := + fun + (j : + Fin + (N + + (1 : + ℕ))) + (theta : + Fin + k) ↦ + if + hj : + (↑j : + ℕ) ≤ + d then + good.gamma + (⟨(↑j : + ℕ), + (by + have := + corrU.rungAgreement; + have := + T.positive; + have := + U.positive; + omega)⟩ : + Fin + (H.dividerCount + + (1 : + ℕ))) + theta + else + if + theta = + eta then + (insert + gammaOne + ({ + gammaTwo } : + Finset + (Fin + k)) : + Finset + (Fin + k)) + else + good.gamma + (Fin.last + d) + theta; + (∀ + (j : + Fin + (d + + (1 : + ℕ))) + (theta : + Fin + k), + gammaW + (oldIndex + j) + theta = + good.gamma + j + theta) → + (∀ + (S : + Finset + (Fin + k)) + (j : + Fin + (d + + (1 : + ℕ))), + S.biUnion + (gammaW + (oldIndex + j)) = + S.biUnion + (good.gamma + j)) → + gammaW + newIndex + eta = + (insert + gammaOne + ({ + gammaTwo } : + Finset + (Fin + k)) : + Finset + (Fin + k)) → + (∀ + (theta : + Fin + k), + theta ≠ + eta → + gammaW + newIndex + theta = + good.gamma + (Fin.last + d) + theta) → + GoodHierarchy + HW := by + classical + intro V E _ _ _ _ G k e0 input T phi ett U W corrU corrW baseU baseW hcore hclosure H good + helem eta beta gammaOne gammaTwo f heta hbeta hfc hne hg1 hg2 hfresh hminus d N + corrTerminal stageW hsize hUW hedge prefixEqOfSegment prefixTransfer stageAtOld stageOld + stageNew dividerBeforeTerminal HW hcountW stageCopy oldIndex starredCopy missingCopy + storedCopy lastStar newStored hstageU segmentCopy starToU newIndex gammaW gammaCopy + gammaSetCopy gammaNewEta gammaNewOther + exact { + gamma := gammaW + twoColors := by + intro j theta htheta + by_cases hj : j.val ≤ d + · let jo : Fin (d + 1) := ⟨j.val, by omega⟩ + have hjEq : j = oldIndex jo := Fin.ext (by simp [oldIndex, jo]) + have hmem : theta ∈ HierarchyStoredColorsAt H jo := by + rw [← storedCopy jo, ← hjEq] + exact htheta + rw [hjEq, gammaCopy jo theta] + exact good.twoColors jo theta hmem + · have hjlast : j = newIndex := Fin.ext (by + apply le_antisymm + · have := j.isLt; simp [newIndex, N, d] at this ⊢; omega + · have := j.isLt; simp [newIndex, N, d] at this ⊢; omega) + subst j + rw [newStored] at htheta + by_cases hte : theta = eta + · subst theta + simp [gammaNewEta, hne] + · have hmem : theta ∈ HierarchyStoredColorsAt H (Fin.last d) := + (HierarchyTerminalStoredColorsSubsetLast H).1 htheta + rw [gammaNewOther theta hte] + exact good.twoColors (Fin.last d) theta hmem + avoidance := by + intro j theta htheta c hc + by_cases hj : j.val ≤ d + · let jo : Fin (d + 1) := ⟨j.val, by omega⟩ + have hjEq : j = oldIndex jo := Fin.ext (by simp [oldIndex, jo]) + have holdMem : theta ∈ HierarchyStoredColorsAt H jo := by + rw [← storedCopy jo, ← hjEq] + exact htheta + have hcOld : c ∈ good.gamma jo theta := by + rw [← gammaCopy jo theta, ← hjEq] + exact hc + have hold := good.avoidance jo theta holdMem hcOld + rw [hjEq] + exact Finset.mem_sdiff.mpr ⟨ + (by simpa [missingCopy jo] using (Finset.mem_sdiff.mp hold).1), + (by simpa [segmentCopy jo theta] using (Finset.mem_sdiff.mp hold).2)⟩ + · have hjlast : j = newIndex := Fin.ext (by + apply le_antisymm + · have := j.isLt; simp [newIndex, N, d] at this ⊢; omega + · have := j.isLt; simp [newIndex, N, d] at this ⊢; omega) + subst j + rw [newStored] at htheta + have hmissingU : c ∈ TreeMissingColors phi U := by + by_cases hte : theta = eta + · subst theta + have hcP : c ∈ ({gammaOne, gammaTwo} : Finset (Fin k)) := by + simpa [gammaNewEta] using hc + have hcCases : c = gammaOne ∨ c = gammaTwo := by + simpa [Finset.mem_insert, Finset.mem_singleton] using hcP + rcases hcCases with rfl | rfl + · rcases Finset.mem_biUnion.mp hg1 with ⟨v, hv, hmiss⟩ + exact Finset.mem_biUnion.mpr ⟨v, (Finset.mem_sdiff.mp hv).1, hmiss⟩ + · rcases Finset.mem_biUnion.mp hg2 with ⟨v, hv, hmiss⟩ + exact Finset.mem_biUnion.mpr ⟨v, (Finset.mem_sdiff.mp hv).1, hmiss⟩ + · have hmem : theta ∈ HierarchyStoredColorsAt H (Fin.last d) := + (HierarchyTerminalStoredColorsSubsetLast H).1 htheta + have hold := (good.avoidance (Fin.last d) theta hmem) + have hcOld : c ∈ good.gamma (Fin.last d) theta := by + simpa [gammaNewOther theta hte] using hc + have hmiss := (Finset.mem_sdiff.mp (hold hcOld)).1 + have hmissStar : c ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last d)) := by + have hreserved := + (GoodHierarchyReservedDisjoint good (Fin.last d)).1 theta hmem + exact hreserved hcOld + have hmissTree : c ∈ TreeMissingColors phi U := by + rcases Finset.mem_biUnion.mp hmissStar with ⟨v, hv, hmissV⟩ + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset starToU hv, hmissV⟩ + exact hmissTree + have hstageMissing : HierarchyStageMissingColors HW newIndex = + TreeMissingColors phi U := by + change TreeMissingColors phi (HierarchyStarredStage HW newIndex) = _ + rw [lastStar] + rw [hstageMissing] + refine Finset.mem_sdiff.mpr ⟨hmissingU, ?_⟩ + intro hseg + have hseg' : ∃ r : Fin (HW.stage newIndex.succ).length, + U.length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi W theta).val + (HW.stage newIndex.succ).length ∧ + phi ((HW.stage newIndex.succ).edge r) = some c := by + change c ∈ HierarchySegmentColors HW newIndex theta at hseg + dsimp [HierarchySegmentColors] at hseg + have hnewIndex : newIndex = Fin.last HW.dividerCount := by + apply Fin.ext + simp [newIndex, HW, N, d] + rw [hnewIndex, lastStar] at hseg + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hseg + have hstageNext : HW.stage (Fin.last HW.dividerCount).succ = + HW.stage newIndex.succ := congrArg (fun j => HW.stage j.succ) hnewIndex.symm + rw [hstageNext] at hseg + exact hseg + have hWstage : HW.stage newIndex.succ = W := by + have hi : newIndex.succ = Fin.last (HW.dividerCount + 1) := by + apply Fin.ext + simp [newIndex, HW, N, d] + rw [hi, HW.terminalStage] + rw [hWstage] at hseg' + rcases hseg' with ⟨r, hlo, hhi, hcolor⟩ + have hrval : r.val = U.length := by + have hrlt : r.val < U.length + 1 := by simpa [hsize] using r.isLt + omega + have hrEq : r = Fin.cast (by omega : U.length + 1 = W.length) + (Fin.last U.length) := by + apply Fin.ext + simp [hrval] + have hrEdge : W.edge r = f := by + rw [hrEq] + simpa using hedge + have hcbeta : c = beta := by + rw [hrEdge, hfc] at hcolor + injection hcolor with heq + exact heq.symm + subst c + by_cases hte : theta = eta + · subst theta + have hbUnion : beta ∈ + (HierarchyTerminalStoredColors H).biUnion (good.gamma (Fin.last d)) := + Finset.mem_biUnion.mpr ⟨eta, heta, hbeta⟩ + have hcPair : beta ∈ ({gammaOne, gammaTwo} : Finset (Fin k)) := by + simpa [gammaNewEta] using hc + exact (Finset.disjoint_left.mp hfresh) hcPair hbUnion + · have hthetaLast : theta ∈ HierarchyStoredColorsAt H (Fin.last d) := + (HierarchyTerminalStoredColorsSubsetLast H).1 htheta + have hetaLast : eta ∈ HierarchyStoredColorsAt H (Fin.last d) := + (HierarchyTerminalStoredColorsSubsetLast H).1 heta + have hne' : eta ≠ theta := Ne.symm hte + have hdis := good.disjointPairs (Fin.last d) eta theta hetaLast hthetaLast hne' + have hbOld : beta ∈ good.gamma (Fin.last d) theta := by + simpa [gammaNewOther theta hte] using hc + exact (Finset.disjoint_left.mp hdis) hbeta hbOld + disjointPairs := by + intro j theta rho ht hr hne' + by_cases hj : j.val ≤ d + · let jo : Fin (d + 1) := ⟨j.val, by omega⟩ + have hjEq : j = oldIndex jo := Fin.ext (by simp [oldIndex, jo]) + have htOld : theta ∈ HierarchyStoredColorsAt H jo := by + rw [← storedCopy jo, ← hjEq] + exact ht + have hrOld : rho ∈ HierarchyStoredColorsAt H jo := by + rw [← storedCopy jo, ← hjEq] + exact hr + rw [hjEq] + rw [gammaCopy jo theta, gammaCopy jo rho] + exact good.disjointPairs jo theta rho htOld hrOld hne' + · have hjlast : j = newIndex := Fin.ext (by + apply le_antisymm + · have := j.isLt; simp [newIndex, N, d] at this ⊢; omega + · have := j.isLt; simp [newIndex, N, d] at this ⊢; omega) + subst j + rw [newStored] at ht hr + by_cases hte : theta = eta + · subst theta + have hrD : rho ∈ HierarchyTerminalStoredColors H := hr + have hneR : rho ≠ eta := by + intro heq + exact hne' heq.symm + exact Finset.disjoint_left.mpr (by + intro c hcP hcR + have hcPair : c ∈ ({gammaOne, gammaTwo} : Finset (Fin k)) := by + simpa [gammaNewEta] using hcP + have hcOld : c ∈ good.gamma (Fin.last d) rho := by + simpa [gammaNewOther rho hneR] using hcR + exact (Finset.disjoint_left.mp hfresh) hcPair + (Finset.mem_biUnion.mpr ⟨rho, hrD, hcOld⟩)) + · by_cases hre : rho = eta + · subst rho + exact Finset.disjoint_left.mpr (by + intro c hcOther hcP + have hcPair : c ∈ ({gammaOne, gammaTwo} : Finset (Fin k)) := by + simpa [gammaNewEta] using hcP + have hcOld : c ∈ good.gamma (Fin.last d) theta := by + simpa [gammaNewOther theta hte] using hcOther + exact (Finset.disjoint_left.mp hfresh) hcPair + (Finset.mem_biUnion.mpr ⟨theta, ht, hcOld⟩)) + · have hOld := good.disjointPairs (Fin.last d) theta rho + ((HierarchyTerminalStoredColorsSubsetLast H).1 ht) + ((HierarchyTerminalStoredColorsSubsetLast H).1 hr) hne' + rw [gammaNewOther theta hte, gammaNewOther rho hre] + exact hOld + uniqueRefresh := by + intro i + by_cases hi : i.val < d + · let io : Fin d := ⟨i.val, hi⟩ + have hOld := good.uniqueRefresh io + rcases hOld with ⟨chosen, hchosen, huniq⟩ + have hprev : i.castSucc = oldIndex io.castSucc := by + apply Fin.ext + simp [oldIndex, io] + have hnext : i.succ = oldIndex io.succ := by + apply Fin.ext + simp [oldIndex, io] + have hstageNext : (oldIndex io.succ).castSucc = + Fin.castLE (by omega) io.succ.castSucc := by + apply Fin.ext + simp [oldIndex, io] + refine ⟨chosen, ?_, ?_⟩ + · rcases hchosen with ⟨hmem, hloc, hrest⟩ + refine ⟨?_, ?_, ?_⟩ + · rw [hnext, storedCopy io.succ] + exact hmem + · simpa only [hnext, hprev, hstageNext, stageCopy io.succ.castSucc, + starredCopy io.castSucc, gammaCopy io.succ] using hloc + · intro theta htheta hne' + have hthetaOld : theta ∈ HierarchyStoredColorsAt H io.succ := by + rw [← storedCopy io.succ, ← hnext] + exact htheta + simpa only [hnext, hprev, gammaCopy io.succ, gammaCopy io.castSucc] using + hrest theta hthetaOld hne' + · intro theta htheta + have hthetaOld : theta ∈ HierarchyStoredColorsAt H io.succ := by + rw [← storedCopy io.succ, ← hnext] + exact htheta.1 + apply huniq theta + refine ⟨hthetaOld, ?_, ?_⟩ + · simpa only [hnext, hprev, hstageNext, stageCopy io.succ.castSucc, + starredCopy io.castSucc, gammaCopy io.succ] using htheta.2.1 + · intro rho hrho hne' + have hrhoNew : rho ∈ HierarchyStoredColorsAt HW i.succ := by + rw [hnext, storedCopy io.succ] + exact hrho + simpa only [hnext, hprev, gammaCopy io.succ, gammaCopy io.castSucc] using + htheta.2.2 rho hrhoNew hne' + · have hlast : i.val = d := by have := i.isLt; omega + have hidx : i = Fin.last d := Fin.ext (by simp [hlast]) + rw [hidx] + have hlastIndex : (Fin.last d).succ = Fin.last HW.dividerCount := by + apply Fin.ext + change d + 1 = HW.dividerCount + simpa [d] using hcountW.symm + have hindexNew : Fin.last HW.dividerCount = newIndex := by + apply Fin.ext + simp [newIndex, HW, N, d] + let P : Finset (Fin k) := {gammaOne, gammaTwo} + refine ⟨eta, ?_, ?_⟩ + · refine ⟨?_, ?_, ?_⟩ + · rw [hlastIndex, newStored] + exact heta + · rw [hlastIndex, hindexNew, gammaNewEta] + intro c hc + have hcP : c = gammaOne ∨ c = gammaTwo := by + simpa [Finset.mem_insert, Finset.mem_singleton] using hc + rcases hcP with rfl | rfl + · have hstarIndex : (Fin.last d).castSucc = oldIndex (Fin.last d) := Fin.ext rfl + rw [hstageU, hstarIndex, starredCopy (Fin.last d)] + simpa [d] using (Finset.mem_biUnion.mp hg1) + · have hstarIndex : (Fin.last d).castSucc = oldIndex (Fin.last d) := Fin.ext rfl + rw [hstageU, hstarIndex, starredCopy (Fin.last d)] + simpa [d] using (Finset.mem_biUnion.mp hg2) + · intro theta htheta hne' + rw [hlastIndex, hindexNew] + have hstarIndex : (Fin.last d).castSucc = oldIndex (Fin.last d) := Fin.ext rfl + calc + gammaW newIndex theta = good.gamma (Fin.last d) theta := + gammaNewOther theta hne' + _ = gammaW (oldIndex (Fin.last d)) theta := + (gammaCopy (Fin.last d) theta).symm + _ = gammaW ((Fin.last d).castSucc) theta := by rw [hstarIndex] + · intro theta htheta + by_cases hte : theta = eta + · exact hte + · have hthetaOld : theta ∈ HierarchyStoredColorsAt H (Fin.last d) := by + have hterm : theta ∈ HierarchyTerminalStoredColors H := by + rw [← newStored, ← hlastIndex] + exact htheta.1 + exact (HierarchyTerminalStoredColorsSubsetLast H).1 hterm + have hpair : (good.gamma (Fin.last d) theta).card = 2 := + good.twoColors (Fin.last d) theta hthetaOld + obtain ⟨c, hc⟩ := Finset.card_pos.mp (by omega : 0 < (good.gamma (Fin.last d) + theta).card) + have hreservedSubset := + (GoodHierarchyReservedDisjoint good (Fin.last d)).1 theta hthetaOld + have hreserved : c ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last d)) := hreservedSubset hc + have hlocal := htheta.2.1 + have hcOld : c ∈ good.gamma (Fin.last d) theta := by + simpa only [hlastIndex, hindexNew, gammaNewOther theta hte] using hc + have hcNew : c ∈ gammaW (Fin.last d).succ theta := by + rw [hlastIndex, hindexNew, gammaNewOther theta hte] + exact hcOld + have hcLocal := hlocal hcNew + have hstarIndex : (Fin.last d).castSucc = oldIndex (Fin.last d) := Fin.ext rfl + have hUStage : HW.stage (Fin.last d).succ.castSucc = U := by + have hidx : (Fin.last d).succ.castSucc = + (Fin.last HW.dividerCount).castSucc := congrArg Fin.castSucc hlastIndex + rw [hidx] + exact hstageU + have hstarStage : HierarchyStarredStage HW (Fin.last d).castSucc = + HierarchyStarredStage H (Fin.last d) := by + rw [hstarIndex, starredCopy (Fin.last d)] + rcases Finset.mem_biUnion.mp hcLocal with ⟨u, hu, hmiss⟩ + simp only [TreeMissingColors, Finset.mem_biUnion] at hreserved + rcases hreserved with ⟨a, ha, hmissA⟩ + have haU : a ∈ TreeSequenceVertexSet U := + TreeSequenceInitialSegmentVertexSetSubset starToU ha + have huU : u ∈ TreeSequenceVertexSet U := by + rw [hUStage] at hu + exact (Finset.mem_sdiff.mp hu).1 + have hau : a ≠ u := by + intro heq + subst u + have haStarHW : a ∈ TreeSequenceVertexSet + (HierarchyStarredStage HW (Fin.last d).castSucc) := by + rw [hstarStage] + exact ha + exact (Finset.mem_sdiff.mp hu).2 haStarHW + have hdis := helem haU huU hau + exact False.elim ((Finset.disjoint_left.mp hdis) hmissA hmiss) + parallelBase := by + dsimp + intro hpe + have hkind : corrW.replacementETT.series.data.kind + (Fin.last corrW.replacementETT.rounds) = + corrU.replacementETT.series.data.kind + (Fin.last corrU.replacementETT.rounds) := + (corrTerminal W corrW).2.1.trans (corrTerminal U corrU).2.1.symm + have hpeU : corrU.replacementETT.series.data.kind + (Fin.last corrU.replacementETT.rounds) = some TashkinovExtensionKind.PE := by + rw [← hkind] + exact hpe + have hzero : (HierarchyStoredColorsAt HW 0).biUnion (gammaW 0) = + (HierarchyStoredColorsAt H 0).biUnion (good.gamma 0) := by + have hidx : (0 : Fin (N + 1)) = oldIndex (0 : Fin (d + 1)) := Fin.ext rfl + rw [hidx, storedCopy (0 : Fin (d + 1))] + exact gammaSetCopy (HierarchyStoredColorsAt H 0) 0 + have old := good.parallelBase hpeU + have htree : corrW.replacementETT.series.data.tree + (Fin.last corrW.replacementETT.rounds).castSucc = + corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc := + (corrTerminal W corrW).1.trans (corrTerminal U corrU).1.symm + rw [hcore, hclosure, hzero, htree] + exact old + minusClosed := by + intro i + by_cases hi : i.val < d + · let io : Fin d := ⟨i.val, hi⟩ + have hnext : i.succ = oldIndex io.succ := by + apply Fin.ext + simp [oldIndex, io] + have hprev : i.castSucc = oldIndex io.castSucc := by + apply Fin.ext + simp [oldIndex, io] + have hstage : i.succ.castSucc = + Fin.castLE (by omega) io.succ.castSucc := by + apply Fin.ext + simp [io] + rw [hstage, stageCopy io.succ.castSucc, hnext, hprev, storedCopy io.succ, + gammaSetCopy (HierarchyStoredColorsAt H io.succ) io.castSucc] + exact good.minusClosed io + · have hlast : i.val = d := by have := i.isLt; omega + have hidx : i = Fin.last d := Fin.ext (by simp [hlast]) + rw [hidx] + have hlastIndex : (Fin.last d).succ = Fin.last HW.dividerCount := by + apply Fin.ext + change d + 1 = HW.dividerCount + simpa [d] using hcountW.symm + have hstarIndex : (Fin.last d).castSucc = oldIndex (Fin.last d) := Fin.ext rfl + have hstageIndex : (Fin.last d).succ.castSucc = + (Fin.last HW.dividerCount).castSucc := congrArg Fin.castSucc hlastIndex + rw [hstageIndex, hstageU, hlastIndex, newStored, hstarIndex, + gammaSetCopy (HierarchyTerminalStoredColors H) (Fin.last d)] + exact hminus + } + +private abbrev helperContinuation694Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (U W : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 + ett phi U) (corrW : CorrespondingExtendedTashkinovTree G k e0 ett phi W) (baseU : + HierarchyBase corrU.replacementETT phi) (baseW : HierarchyBase corrW.replacementETT phi) + (hcore : baseW.core = baseU.core), baseW.closure = baseU.closure → + ∀ (H : TashkinovHierarchy corrU.replacementETT baseU) (good : GoodHierarchy H), + ColoredVertexSetElementary G phi (TreeSequenceVertexSet U) → + ∀ (eta beta gammaOne gammaTwo : Fin k) (f : E), eta ∈ HierarchyTerminalStoredColors H → beta ∈ + good.gamma (Fin.last H.dividerCount) eta → phi f = some beta → gammaOne ≠ gammaTwo → + gammaOne ∈ (TreeSequenceVertexSet U \ TreeSequenceVertexSet (HierarchyStarredStage H + (Fin.last H.dividerCount))).biUnion (MissingColors G phi) → gammaTwo ∈ + (TreeSequenceVertexSet U \ TreeSequenceVertexSet (HierarchyStarredStage H (Fin.last + H.dividerCount))).biUnion (MissingColors G phi) → Disjoint (insert gammaOne ({ gammaTwo } + : Finset (Fin k)) : Finset (Fin k)) ((HierarchyTerminalStoredColors H).biUnion (good.gamma + (Fin.last H.dividerCount))) → TreeColorSetMinusClosed G phi U + ((HierarchyTerminalStoredColors H).biUnion (good.gamma (Fin.last H.dividerCount))) → + let d : ℕ := H.dividerCount; + let N : ℕ := d + (1 : ℕ); + ∀ (corrTerminal : + ∀ (X : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi X), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors corr.replacementETT.series.data (Fin.last + corr.replacementETT.rounds) = TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)), + let stageW : Fin (N + (2 : ℕ)) → TreeSequence G e0 := fun (j : Fin (N + (2 : ℕ))) ↦ if hj : + (↑j : ℕ) = d + (2 : ℕ) then W else H.stage (⟨(↑j : ℕ), ( + by + have := corrU.rungAgreement; have := T.positive; have := U.positive; + omega + )⟩ : Fin (H.dividerCount + (2 : ℕ))); + ∀ (hsize : W.length = U.length + (1 : ℕ)) (hUW : TreeSequenceInitialSegment U W), W.edge + (Fin.cast (( + by have := U.positive; have := W.positive; omega + )) (Fin.last U.length)) = f → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → B = C → + TreeSequenceInitialSegment A C) → + ∀ (prefixEqOfSegment : + ∀ {A B : TreeSequence G e0} (hAB : TreeSequenceInitialSegment A B), A = TreeSequencePrefix B + A.length A.positive hAB.1) (prefixTransfer : + ∀ (p : ℕ) (hp : (1 : ℕ) ≤ p) (hpU : p ≤ U.length), TreeSequencePrefix U p hp hpU = + TreeSequencePrefix W p hp (( + by have := W.positive; omega + ))), ( + ∀ (j : Fin (d + (2 : ℕ))), (↑j : ℕ) ≤ d + (1 : ℕ) → TreeSequenceInitialSegment (H.stage j) U) + → + ∀ (stageAtOld : + ∀ (j : Fin (N + (2 : ℕ))) (hj : (↑j : ℕ) ≤ d + (1 : ℕ)), stageW j = H.stage (⟨(↑j : ℕ), ( + by + have := corrU.rungAgreement; have := T.positive; have := U.positive; + omega + )⟩ : Fin (H.dividerCount + (2 : ℕ)))) (stageOld : + ∀ (j : Fin (d + (2 : ℕ))), stageW (⟨(↑j : ℕ), ( + by + have := corrU.rungAgreement; have := T.positive; have := U.positive; + omega + )⟩ : Fin (N + (2 : ℕ))) = H.stage j) (stageNew : stageW (⟨d + (2 : ℕ), ( + by + have := corrU.rungAgreement; have := T.positive; have := U.positive; + omega + )⟩ : Fin (N + (2 : ℕ))) = W), + let divW : Fin N → Fin (W.length + (1 : ℕ)) := fun (i : Fin N) ↦ if hi : (↑i : ℕ) < d then + (⟨(↑(H.dividerPosition (⟨(↑i : ℕ), hi⟩ : Fin H.dividerCount)) : ℕ), + have hpos : (↑(H.dividerPosition (⟨(↑i : ℕ), hi⟩ : Fin H.dividerCount)) : ℕ) < U.length + (1 : + ℕ) := ( + by + have := corrU.rungAgreement; have := T.positive; have := U.positive; + omega + ); + have hlen : W.length = U.length + (1 : ℕ) := hsize; Decidable.byContradiction fun (a : + ¬(↑(H.dividerPosition (⟨(↑i : ℕ), hi⟩ : Fin H.dividerCount)) : ℕ) < W.length + (1 : ℕ)) ↦ + ( + by omega + )⟩ : Fin (W.length + (1 : ℕ))) else (⟨U.length, ( + by have := U.positive; have := W.positive; omega + )⟩ : Fin (W.length + (1 : ℕ))); + ∀ (dividerBeforeTerminal : + ∀ (i : Fin d), (↑(H.dividerPosition i) : ℕ) < U.length), + let HW : TashkinovHierarchy corrW.replacementETT baseW := helperHW360 G k e0 input T phi ett U + W corrU corrW baseU baseW hcore H corrTerminal hsize hUW prefixEqOfSegment prefixTransfer + stageAtOld stageOld stageNew dividerBeforeTerminal; + ∀ (hcountW : HW.dividerCount = H.dividerCount + (1 : ℕ)), ( + ∀ (j : Fin (d + (2 : ℕ))), HW.stage (Fin.castLE (( + by + have := corrU.rungAgreement + have := corrW.rungAgreement + have := T.positive + have := U.positive + have := W.positive + omega + )) j) = H.stage j) → + let oldIndex : Fin (d + (1 : ℕ)) → Fin (N + (1 : ℕ)) := fun (j : Fin (d + (1 : ℕ))) ↦ (⟨(↑j : + ℕ), ( + by + have := corrU.rungAgreement; have := T.positive; have := U.positive; + omega + )⟩ : Fin (N + (1 : ℕ))); ( + ∀ (j : Fin (d + (1 : ℕ))), HierarchyStarredStage HW (oldIndex j) = HierarchyStarredStage H j) + → ( + ∀ (j : Fin (d + (1 : ℕ))), HierarchyStageMissingColors HW (oldIndex j) = + HierarchyStageMissingColors H j) → + ∃ (HW : TashkinovHierarchy corrW.replacementETT baseW) (hcountW : HW.dividerCount = + H.dividerCount + (1 : ℕ)), ( + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), HW.stage (Fin.castLE (( + by + have := corrU.rungAgreement + have := corrW.rungAgreement + have := T.positive + have := U.positive + have := W.positive + omega + )) j) = H.stage j) ∧ HW.stage (Fin.last HW.dividerCount).castSucc = U ∧ HierarchyStarredStage + HW (Fin.last HW.dividerCount) = U ∧ HW.stage (Fin.last HW.dividerCount).succ = W ∧ ( + ∀ (i : Fin H.dividerCount), (↑(HW.dividerPosition (Fin.castLE (( + by + have := corrU.rungAgreement + have := corrW.rungAgreement + have := T.positive + have := U.positive + have := W.positive + omega + )) i)) : ℕ) = (↑(H.dividerPosition i) : ℕ)) ∧ (↑(HW.dividerPosition (Fin.cast (( + by + have := corrU.rungAgreement + have := corrW.rungAgreement + have := T.positive + have := U.positive + have := W.positive + omega + )) (Fin.last H.dividerCount))) : ℕ) = U.length ∧ ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt HW (Fin.castLE (( + by + have := corrU.rungAgreement + have := corrW.rungAgreement + have := T.positive + have := U.positive + have := W.positive + omega + )) j) = HierarchyStoredColorsAt H j) ∧ HierarchyStoredColorsAt HW (Fin.last HW.dividerCount) = + HierarchyTerminalStoredColors H ∧ + ∃ (goodW : GoodHierarchy HW), ( + ∀ (j : Fin (H.dividerCount + (1 : ℕ))) (theta : Fin k), goodW.gamma (Fin.castLE (( + by + have := corrU.rungAgreement + have := corrW.rungAgreement + have := T.positive + have := U.positive + have := W.positive + omega + )) j) theta = good.gamma j theta) ∧ goodW.gamma (Fin.last HW.dividerCount) eta = (insert + gammaOne ({ gammaTwo } : Finset (Fin k)) : Finset (Fin k)) ∧ + ∀ theta ∈ HierarchyTerminalStoredColors H, theta ≠ eta → goodW.gamma (Fin.last + HW.dividerCount) theta = good.gamma (Fin.last H.dividerCount) theta + +private theorem helper_corrTerminal_89.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (X : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett + phi X), corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc = ett.series.data.tree (Fin.last ett.rounds).castSucc + ∧ corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ TashkinovStoredColors + corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + classical + intro V E _ _ _ G k e0 input T phi ett X corr + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have seriesSame : replacementData = replacementSeries := + eq_of_heq seriesPresentation + cases seriesSame + let q : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt ett.roundsPositive) (by omega)⟩ + have hq : q.succ = Fin.last ett.rounds := by + apply Fin.ext + exact Nat.sub_add_cancel ett.roundsPositive + refine ⟨?_, ?_, ?_⟩ + · rw [← hq] + exact (ladderTreesAgree q).trans rfl + · exact extensionKindsAgree (Fin.last ett.rounds) + · unfold TashkinovStoredColors + have hnonzero : (Fin.last ett.rounds).val ≠ 0 := by + simpa using Nat.ne_of_gt (Nat.zero_lt_of_lt ett.roundsPositive) + simp only [ite_eq_right hnonzero] + have hfinalColor : replacementSeries.data.coloring (Fin.last ett.rounds) = + ett.series.data.coloring (Fin.last ett.rounds) := by + calc + _ = phi := finalGeneratingColoring.symm + _ = _ := ett.generatingColoring + have hfinalTree : replacementSeries.data.tree + (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := + by rw [← hq]; exact (ladderTreesAgree q).trans rfl + ext c + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · rintro ⟨⟨i, hi, hc⟩, hn⟩ + refine ⟨⟨i, hi, ?_⟩, ?_⟩ + · have hle : i.val ≤ ett.rounds := Nat.le_of_lt_succ i.isLt + have hle' : i.val ≤ (Fin.last ett.1).val := by simpa using hle + rw [ite_eq_left hle'] at hc ⊢ + rw [storedColorsAgree i] at hc + exact hc + · simpa [hfinalColor, hfinalTree] using hn + · rintro ⟨⟨i, hi, hc⟩, hn⟩ + refine ⟨⟨i, hi, ?_⟩, ?_⟩ + · have hle : i.val ≤ ett.rounds := Nat.le_of_lt_succ i.isLt + have hle' : i.val ≤ (Fin.last ett.1).val := by simpa using hle + rw [ite_eq_left hle'] at hc ⊢ + rw [(storedColorsAgree i).symm] at hc + exact hc + · simpa [hfinalColor, hfinalTree] using hn + +private theorem helper_starToU_526.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (U W : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 + ett phi U) (corrW : CorrespondingExtendedTashkinovTree G k e0 ett phi W) (baseU : + HierarchyBase corrU.replacementETT phi) (baseW : HierarchyBase corrW.replacementETT phi) + (_ : baseW.core = baseU.core) (H : TashkinovHierarchy corrU.replacementETT baseU), + let d : ℕ := H.dividerCount; + let N : ℕ := d + (1 : ℕ); + ∀ (_ : ( + ∀ (X : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi X), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors corr.replacementETT.series.data (Fin.last + corr.replacementETT.rounds) = TashkinovStoredColors ett.series.data (Fin.last + ett.rounds))), + let stageW : Fin (N + (2 : ℕ)) → TreeSequence G e0 := fun (j : Fin (N + (2 : ℕ))) ↦ if hj : + (↑j : ℕ) = d + (2 : ℕ) then W else H.stage (⟨(↑j : ℕ), ( + by omega + )⟩ : Fin (H.dividerCount + (2 : ℕ))); + ∀ (hsize : W.length = U.length + (1 : ℕ)) (_ : TreeSequenceInitialSegment U W) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : B = C), + TreeSequenceInitialSegment A C)) (_ : ( + ∀ {A B : TreeSequence G e0} (hAB : TreeSequenceInitialSegment A B), A = TreeSequencePrefix B + A.length A.positive hAB.1)) (_ : ( + ∀ (p : ℕ) (hp : (1 : ℕ) ≤ p) (hpU : p ≤ U.length), TreeSequencePrefix U p hp hpU = + TreeSequencePrefix W p hp (( + by omega + )))) (_ : ( + ∀ (j : Fin (N + (2 : ℕ))) (hj : (↑j : ℕ) ≤ d + (1 : ℕ)), stageW j = H.stage (⟨(↑j : ℕ), ( + by omega + )⟩ : Fin (H.dividerCount + (2 : ℕ))))) (_ : ( + ∀ (j : Fin (d + (2 : ℕ))), stageW (⟨(↑j : ℕ), ( + by omega + )⟩ : Fin (N + (2 : ℕ))) = H.stage j)) (_ : stageW (⟨d + (2 : ℕ), ( + by omega + )⟩ : Fin (N + (2 : ℕ))) = W) (_ : ( + ∀ (i : Fin d), (↑(H.dividerPosition i) : ℕ) < U.length)), TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last d)) U := by + classical + intro V E _ _ _ _ G k e0 input T phi ett U W corrU corrW baseU baseW hcore H d N corrTerminal + stageW hsize hUW segmentEqRight prefixEqOfSegment prefixTransfer stageAtOld stageOld + stageNew dividerBeforeTerminal + by_cases hd : d = 0 + · have hstar : HierarchyStarredStage H (Fin.last d) = baseU.core := by + have hz : Fin.last d = (0 : Fin (d + 1)) := by + apply Fin.ext + simp [hd] + rw [hz] + simp [HierarchyStarredStage] + rw [hstar] + have hidx : (⟨1, by omega⟩ : Fin (d + 2)) = Fin.last (d + 1) := by + apply Fin.ext + simp [hd] + have hstage : H.stage ⟨1, by omega⟩ = U := by + rw [hidx, H.terminalStage] + exact segmentEqRight H.coreInsideFirst hstage + · let ii : Fin d := ⟨d - 1, by omega⟩ + have hlast : ii.succ = Fin.last d := by + apply Fin.ext + simp [ii] + omega + have hstar : HierarchyStarredStage H (Fin.last d) = + H.stage ii.succ.castSucc := by + rw [← hlast] + simp [HierarchyStarredStage] + rw [hstar] + have hterm : H.stage ii.succ.succ = U := by + have hi : ii.succ.succ = Fin.last (d + 1) := by + apply Fin.ext + simp [ii] + omega + rw [hi, H.terminalStage] + exact segmentEqRight (H.nested ii.succ) hterm + +private theorem helper_continuation_694.{u_1, u_2} : + helperContinuation694Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett U W corrU corrW baseU baseW hcore hclosure H good + helem eta beta gammaOne gammaTwo f heta hbeta hfc hne hg1 hg2 hfresh hminus d N + corrTerminal stageW hsize hUW hedge segmentEqRight prefixEqOfSegment prefixTransfer + stageToU stageAtOld stageOld stageNew divW dividerBeforeTerminal HW hcountW stageCopy + oldIndex starredCopy missingCopy + have terminalStoredEq : + TashkinovStoredColors corrW.replacementETT.series.data + (Fin.last corrW.replacementETT.rounds) = + TashkinovStoredColors corrU.replacementETT.series.data + (Fin.last corrU.replacementETT.rounds) := by + exact (corrTerminal W corrW).2.2.trans (corrTerminal U corrU).2.2.symm + have storedCopy (j : Fin (d + 1)) : + HierarchyStoredColorsAt HW (oldIndex j) = HierarchyStoredColorsAt H j := by + change (TashkinovStoredColors corrW.replacementETT.series.data + (Fin.last corrW.replacementETT.rounds) \ + TreeMissingColors phi (HierarchyStarredStage HW (oldIndex j))) = + (TashkinovStoredColors corrU.replacementETT.series.data + (Fin.last corrU.replacementETT.rounds) \ + TreeMissingColors phi (HierarchyStarredStage H j)) + rw [terminalStoredEq, starredCopy j] + have lastStar : HierarchyStarredStage HW (Fin.last HW.dividerCount) = U := by + change HW.stage (Fin.last d).succ.castSucc = U + let j : Fin (d + 2) := ⟨d + 1, by omega⟩ + have hidx : (Fin.last d).succ.castSucc = Fin.castLE (by omega) j := Fin.ext rfl + rw [hidx, stageCopy j] + exact H.terminalStage + have newStored : + HierarchyStoredColorsAt HW (Fin.last HW.dividerCount) = + HierarchyTerminalStoredColors H := by + change (TashkinovStoredColors corrW.replacementETT.series.data + (Fin.last corrW.replacementETT.rounds) \ + TreeMissingColors phi (HierarchyStarredStage HW (Fin.last HW.dividerCount))) = + (TashkinovStoredColors corrU.replacementETT.series.data + (Fin.last corrU.replacementETT.rounds) \ + TreeMissingColors phi U) + rw [terminalStoredEq, lastStar] + have hstageU : HW.stage (Fin.last HW.dividerCount).castSucc = U := by + let j : Fin (d + 2) := ⟨d + 1, by omega⟩ + have hidx : (Fin.last HW.dividerCount).castSucc = Fin.castLE (by omega) j := + Fin.ext (by + change d + 1 = HW.dividerCount + simpa [d] using hcountW.symm) + rw [hidx, stageCopy j] + have hterm : j = Fin.last (d + 1) := Fin.ext (by simp [j]) + rw [hterm] + simpa [d] using H.terminalStage + have stageMissingEq (j : Fin (d + 1)) : + HierarchyStageMissingColors HW (oldIndex j) = + HierarchyStageMissingColors H j := missingCopy j + have segmentCopy (j : Fin (d + 1)) (theta : Fin k) : + HierarchySegmentColors HW (oldIndex j) theta = + HierarchySegmentColors H j theta := by + have hnextU : TreeSequenceInitialSegment (H.stage j.succ) U := + stageToU j.succ (by omega) + have hcut := HierarchyFirstMissingPositionPrefixCutoff phi U W hUW theta + (H.stage j.succ).length hnextU.1 + unfold HierarchySegmentColors + dsimp + have hnextIdx : (oldIndex j).succ = + (⟨j.val + 1, by omega⟩ : Fin (N + 2)) := Fin.ext rfl + have hstageNext : HW.stage (oldIndex j).succ = H.stage j.succ := by + rw [hnextIdx] + exact stageCopy j.succ + rw [starredCopy j, hstageNext] + apply Finset.ext + intro c + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + constructor <;> intro h + · rcases h with ⟨r, hlo, hhi, hcolor⟩ + refine ⟨r, hlo, ?_, hcolor⟩ + simpa [hcut] using hhi + · rcases h with ⟨r, hlo, hhi, hcolor⟩ + refine ⟨r, hlo, ?_, hcolor⟩ + simpa [hcut] using hhi + have starToU : TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last d)) U := by + apply helper_starToU_526 <;> assumption + let newIndex : Fin (N + 1) := Fin.last N + let gammaW : Fin (N + 1) → Fin k → Finset (Fin k) := fun j theta => + if hj : j.val ≤ d then good.gamma ⟨j.val, by omega⟩ theta + else if theta = eta then {gammaOne, gammaTwo} + else good.gamma (Fin.last d) theta + have gammaCopy (j : Fin (d + 1)) (theta : Fin k) : + gammaW (oldIndex j) theta = good.gamma j theta := by + simp only [gammaW] + split + · congr 1 + · rename_i h + have : (oldIndex j).val ≤ d := by simp [oldIndex]; omega + contradiction + have gammaSetCopy (S : Finset (Fin k)) (j : Fin (d + 1)) : + S.biUnion (gammaW (oldIndex j)) = S.biUnion (good.gamma j) := by + apply Finset.ext + intro c + simp only [Finset.mem_biUnion] + constructor + · rintro ⟨theta, htheta, hc⟩ + exact ⟨theta, htheta, (by simpa only [gammaCopy] using hc)⟩ + · rintro ⟨theta, htheta, hc⟩ + exact ⟨theta, htheta, (by simpa only [gammaCopy] using hc)⟩ + have gammaNewEta : gammaW newIndex eta = {gammaOne, gammaTwo} := by + have hj : newIndex.val = d + 1 := by simp [newIndex, N, d] + simp [gammaW, newIndex, N, d] + have gammaNewOther (theta : Fin k) (hneEta : theta ≠ eta) : + gammaW newIndex theta = good.gamma (Fin.last d) theta := by + have hj : newIndex.val = d + 1 := by simp [newIndex, N, d] + simp [gammaW, newIndex, N, d, hneEta] + let goodW := @helperGoodW888 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@U) (@W) (@corrU) (@corrW) (@baseU) (@baseW) + (@hcore) (@hclosure) (@H) (@good) (@helem) (@eta) (@beta) (@gammaOne) (@gammaTwo) (@f) (@heta) + (@hbeta) (@hfc) (@hne) (@hg1) (@hg2) (@hfresh) (@hminus) (@corrTerminal) (@hsize) (@hUW) + (@hedge) (@prefixEqOfSegment) (@prefixTransfer) (@stageAtOld) (@stageOld) (@stageNew) + (@dividerBeforeTerminal) (@hcountW) (@stageCopy) (@starredCopy) (@missingCopy) (@storedCopy) + (@lastStar) (@newStored) (@hstageU) (@segmentCopy) (@starToU) (@gammaCopy) (@gammaSetCopy) + (@gammaNewEta) (@gammaNewOther) + have hpreceding : HW.stage (Fin.last HW.dividerCount).castSucc = U := by + exact hstageU + have hstarred : HierarchyStarredStage HW (Fin.last HW.dividerCount) = U := lastStar + have hterminal : HW.stage (Fin.last HW.dividerCount).succ = W := HW.terminalStage + refine ⟨HW, hcountW, ?_, hpreceding, hstarred, hterminal, ?_, ?_, ?_, newStored, + goodW, ?_, ?_, ?_⟩ + · intro j + simpa [hcountW] using stageCopy j + · intro i + change (divW (Fin.castLE (by omega) i)).val = (H.dividerPosition i).val + have hbound : H.dividerCount ≤ HW.dividerCount := by + rw [hcountW] + omega + have hidx : Fin.castLE (by omega) i = Fin.castLE hbound i := Fin.ext rfl + rw [hidx] + have hi : i.val < d := by + change i.val < H.dividerCount + exact i.isLt + simp [divW, hi] + · change (HW.dividerPosition (Fin.last d)).val = U.length + have hnot : ¬ (Fin.last N).val < d := by simp [N, d] + simp [HW, d] + · intro j + have hidx : Fin.castLE (by omega) j = oldIndex j := Fin.ext rfl + rw [hidx] + exact storedCopy j + · intro j theta + have hidx : Fin.castLE (by omega) j = oldIndex j := Fin.ext rfl + rw [hidx] + exact gammaCopy j theta + · change gammaW newIndex eta = {gammaOne, gammaTwo} + exact gammaNewEta + · intro theta htheta hneEta + change gammaW newIndex theta = good.gamma (Fin.last d) theta + exact gammaNewOther theta hneEta + +theorem P2940_T1_OneDividerRefresh + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (U W : TreeSequence G e0) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (corrW : CorrespondingExtendedTashkinovTree G k e0 ett phi W) + (baseU : HierarchyBase corrU.replacementETT phi) + (baseW : HierarchyBase corrW.replacementETT phi) + (hcore : baseW.core = baseU.core) + (hclosure : baseW.closure = baseU.closure) + (H : TashkinovHierarchy corrU.replacementETT baseU) + (good : GoodHierarchy H) + (helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet U)) + (eta beta gammaOne gammaTwo : Fin k) (f : E) + (heta : eta ∈ HierarchyTerminalStoredColors H) + (hbeta : beta ∈ good.gamma (Fin.last H.dividerCount) eta) + (hfc : phi f = some beta) (hadjoin : TreeSequenceAdjoinEdge U f W) + (hne : gammaOne ≠ gammaTwo) + (hg1 : gammaOne ∈ (TreeSequenceVertexSet U \ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))).biUnion + (MissingColors G phi)) + (hg2 : gammaTwo ∈ (TreeSequenceVertexSet U \ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))).biUnion + (MissingColors G phi)) + (hfresh : Disjoint {gammaOne, gammaTwo} + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (hminus : TreeColorSetMinusClosed G phi U + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) : + exists HW : TashkinovHierarchy corrW.replacementETT baseW, + exists hcountW : HW.dividerCount = H.dividerCount + 1, + (forall j : Fin (H.dividerCount + 2), + HW.stage (Fin.castLE (by omega) j) = H.stage j) /\ + HW.stage (Fin.last HW.dividerCount).castSucc = U /\ + HierarchyStarredStage HW (Fin.last HW.dividerCount) = U /\ + HW.stage (Fin.last HW.dividerCount).succ = W /\ + (forall i : Fin H.dividerCount, + (HW.dividerPosition (Fin.castLE (by omega) i)).val = + (H.dividerPosition i).val) /\ + (HW.dividerPosition (Fin.cast hcountW.symm + (Fin.last H.dividerCount))).val = U.length /\ + (forall j : Fin (H.dividerCount + 1), + HierarchyStoredColorsAt HW (Fin.castLE (by omega) j) = + HierarchyStoredColorsAt H j) /\ + HierarchyStoredColorsAt HW (Fin.last HW.dividerCount) = + HierarchyTerminalStoredColors H /\ + exists goodW : GoodHierarchy HW, + (forall j : Fin (H.dividerCount + 1), forall theta : Fin k, + goodW.gamma (Fin.castLE (by omega) j) theta = good.gamma j theta) /\ + goodW.gamma (Fin.last HW.dividerCount) eta = {gammaOne, gammaTwo} /\ + (forall theta : Fin k, theta ∈ HierarchyTerminalStoredColors H -> + theta ≠ eta -> goodW.gamma (Fin.last HW.dividerCount) theta = + good.gamma (Fin.last H.dividerCount) theta) := by + classical + let d := H.dividerCount + let N := d + 1 + have corrTerminal (X : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi X) : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + apply helper_corrTerminal_89 + let stageW : Fin (N + 2) → TreeSequence G e0 := fun j => + if hj : j.val = d + 2 then W else H.stage ⟨j.val, by omega⟩ + rcases hadjoin with ⟨hsize, hUW, hedge⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + refine ⟨hAB.1.trans hBC.1, ?_, ?_⟩ + · intro i + exact (hBC.2.1 (Fin.castLE (Nat.succ_le_succ hAB.1) i)).trans + (hAB.2.1 i) + · intro i + exact (hBC.2.2 (Fin.castLE hAB.1 i)).trans (hAB.2.2 i) + have segmentRefl (A : TreeSequence G e0) : TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentEqRight {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) (hBC : B = C) : + TreeSequenceInitialSegment A C := by + cases hBC + exact hAB + have prefixEqOfSegment {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) : + A = TreeSequencePrefix B A.length A.positive hAB.1 := by + cases A with + | mk la pa va ea via eia fea aa => + cases B with + | mk lb pb vb eb vib eib feb ab => + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa [TreeSequencePrefix] using (hAB.2.1 i).symm + · apply heq_of_eq + funext i + simpa [TreeSequencePrefix] using (hAB.2.2 i).symm + have prefixTransfer (p : Nat) (hp : 1 ≤ p) (hpU : p ≤ U.length) : + TreeSequencePrefix U p hp hpU = + TreeSequencePrefix W p hp (by omega) := by + rw [TreeSequencePrefix, TreeSequencePrefix] + congr 1 + · funext i + have h := hUW.2.1 (Fin.castLE (Nat.succ_le_succ hpU) i) + simpa [TreeSequencePrefix] using h.symm + · funext i + have h := hUW.2.2 (Fin.castLE hpU i) + simpa [TreeSequencePrefix] using h.symm + have stageSegment : ∀ (a r : Nat) (h : a + r ≤ d + 1), + TreeSequenceInitialSegment + (H.stage ⟨a, by have := h; omega⟩) + (H.stage ⟨a + r, by exact Nat.lt_succ_of_le h⟩) := by + intro a r + induction r with + | zero => + intro h + exact segmentRefl _ + | succ r ih => + intro h + have hprev : a + r ≤ d + 1 := by omega + exact segmentTrans (ih hprev) (H.nested ⟨a + r, by omega⟩) + have stageToU (j : Fin (d + 2)) (hj : j.val ≤ d + 1) : + TreeSequenceInitialSegment (H.stage j) U := by + have hseg := stageSegment j.val (d + 1 - j.val) (by omega) + have hidx : (⟨j.val + (d + 1 - j.val), by omega⟩ : Fin (d + 2)) = + Fin.last (d + 1) := by + apply Fin.ext + simp + omega + rw [hidx, H.terminalStage] at hseg + have hstart : (⟨j.val, by omega⟩ : Fin (d + 2)) = j := by + apply Fin.ext + rfl + rw [hstart] at hseg + exact hseg + have stageAtOld (j : Fin (N + 2)) (hj : j.val ≤ d + 1) : + stageW j = H.stage ⟨j.val, by omega⟩ := by + have hneq : j.val ≠ d + 2 := by omega + simp [stageW, hneq] + have stageOld (j : Fin (d + 2)) : + stageW ⟨j.val, by omega⟩ = H.stage j := by + have hneq : j.val ≠ d + 2 := by have := j.isLt; omega + simp only [stageW, hneq] + congr 1 + have stageNew : stageW ⟨d + 2, by omega⟩ = W := by + simp [stageW] + let divW : Fin N → Fin (W.length + 1) := fun i => + if hi : i.val < d then + ⟨(H.dividerPosition ⟨i.val, hi⟩).val, by + have hpos := (H.dividerPosition ⟨i.val, hi⟩).isLt + have hlen := hsize + omega⟩ + else ⟨U.length, by omega⟩ + have dividerBeforeTerminal (i : Fin d) : + (H.dividerPosition i).val < U.length := by + have hstrict := H.strict i.succ + let next : Fin (d + 2) := i.succ.succ + have hnext : next.val ≤ d + 1 := by + change i.val + 2 ≤ d + 1 + omega + have htoU := stageToU next hnext + have hposEq : (H.dividerPosition i).val = + (H.stage i.succ.castSucc).length := by + have hidx : (⟨i.val + 1, by omega⟩ : Fin (d + 2)) = + i.succ.castSucc := Fin.ext rfl + rw [← hidx, H.dividerStage i] + rfl + rw [hposEq] + exact Nat.lt_of_lt_of_le hstrict htoU.1 + let HW := @helperHW360 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@U) (@W) (@corrU) (@corrW) (@baseU) (@baseW) (@hcore) + (@H) (@corrTerminal) (@hsize) (@hUW) (@prefixEqOfSegment) (@prefixTransfer) (@stageAtOld) + (@stageOld) (@stageNew) (@dividerBeforeTerminal) + have hcountW : HW.dividerCount = H.dividerCount + 1 := by rfl + have stageCopy (j : Fin (d + 2)) : + HW.stage (Fin.castLE (by omega) j) = H.stage j := by + change stageW (Fin.castLE (by omega) j) = H.stage j + have hidx : Fin.castLE (by omega) j = (⟨j.val, by omega⟩ : Fin (N + 2)) := + Fin.ext rfl + rw [hidx] + exact stageOld j + let oldIndex (j : Fin (d + 1)) : Fin (N + 1) := ⟨j.val, by omega⟩ + have starredCopy (j : Fin (d + 1)) : + HierarchyStarredStage HW (oldIndex j) = HierarchyStarredStage H j := by + refine Fin.cases ?_ (fun i => ?_) j + · simpa [oldIndex, HierarchyStarredStage] using hcore + · change HW.stage (⟨i.val + 1, by omega⟩ : Fin (N + 2)) = + H.stage (⟨i.val + 1, by omega⟩ : Fin (d + 2)) + exact stageCopy ⟨i.val + 1, by omega⟩ + have missingCopy (j : Fin (d + 1)) : + HierarchyStageMissingColors HW (oldIndex j) = + HierarchyStageMissingColors H j := by + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors phi + (corrW.replacementETT.series.data.tree + (Fin.last corrW.replacementETT.rounds).castSucc) = + TreeMissingColors phi + (corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc) + exact congrArg (TreeMissingColors phi) + ((corrTerminal W corrW).1.trans (corrTerminal U corrU).1.symm) + · change TreeMissingColors phi (HW.stage (⟨i.val + 1, by omega⟩ : Fin (N + 2))) = + TreeMissingColors phi (H.stage (⟨i.val + 1, by omega⟩ : Fin (d + 2))) + exact congrArg (TreeMissingColors phi) (stageCopy ⟨i.val + 1, by omega⟩) + apply helper_continuation_694 <;> assumption +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OppositeRootComponents.lean b/LeanPool/GoldbergSeymour/OppositeRootComponents.lean new file mode 100644 index 0000000000..948e3ce169 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OppositeRootComponents.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.TreeInterchangeable + +/-! +# P2668_T2_Opposite Root Components + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2668_T2_OppositeRootComponents + {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] {G : LooplessMultigraph V E} {k : Nat} + {e0 : E} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (X Y U : TreeSequence G e0) + (hunion : Nonempty (OrderedTreeUnion X Y U)) + (hproper : IsProperEdgeColoring G phi) + (hX : TreeInterchangeable G X phi alpha beta) + (hY : TreeInterchangeable G Y phi alpha beta) + (u v : V) (hu : u ∈ TreeSequenceVertexSet X) + (hv : v ∈ TreeSequenceVertexSet Y) + (hua : alpha ∈ MissingColors G phi u) + (hvb : beta ∈ MissingColors G phi v) + (hnot : ¬ TreeInterchangeable G U phi alpha beta) : + alpha ≠ beta ∧ u ∉ TreeSequenceVertexSet Y ∧ + v ∉ TreeSequenceVertexSet X ∧ + (∀ x ∈ TreeSequenceVertexSet X, + Sum.inl x ∉ TwoColorComponent G phi alpha beta (Sum.inl v)) ∧ + (∀ x ∈ TreeSequenceVertexSet Y, + Sum.inl x ∉ TwoColorComponent G phi alpha beta (Sum.inl u)) := by + classical + obtain ⟨ord⟩ := hunion + have hab : alpha ≠ beta := by + intro heq + apply hnot + intro z w hz + exact (hz.1 heq).elim + let H := TwoColorIncidenceGraph G phi alpha beta + have self (x : V) : Sum.inl x ∈ + TwoColorComponent G phi alpha beta (Sum.inl x) := + SimpleGraph.ConnectedComponent.eq.mpr (SimpleGraph.Reachable.refl _) + have leaf (x : V) + (hm : alpha ∈ MissingColors G phi x ∨ beta ∈ MissingColors G phi x) : + Set.Subsingleton (H.neighborSet (Sum.inl x)) := by + have hd : @SimpleGraph.degree _ H (Sum.inl x) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with ha | hb + · exact MissingColorIncidenceEndpoint G phi alpha beta hab hproper x ha + · have hgraph : H = TwoColorIncidenceGraph G phi beta alpha := by + ext a b + cases a <;> cases b <;> simp [H, TwoColorIncidenceGraph, or_comm] + rw [hgraph] + exact MissingColorIncidenceEndpoint G phi beta alpha hab.symm hproper x hb + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro a ha b hb + exact Finset.card_le_one_iff.mp hd + (by simpa [SimpleGraph.mem_neighborFinset] using ha) + (by simpa [SimpleGraph.mem_neighborFinset] using hb) + have pu : TwoColorPathComponent G phi alpha beta (Sum.inl u) := + ⟨hab, Sum.inl u, self u, leaf u (Or.inl hua)⟩ + have pv : TwoColorPathComponent G phi alpha beta (Sum.inl v) := + ⟨hab, Sum.inl v, self v, leaf v (Or.inr hvb)⟩ + have distinct : TwoColorComponent G phi alpha beta (Sum.inl u) ≠ + TwoColorComponent G phi alpha beta (Sum.inl v) := by + intro heq + apply hnot + have rooted (z : Sum V E) (pz : TwoColorPathComponent G phi alpha beta z) + (hz : ∃ x ∈ TreeSequenceVertexSet U, + Sum.inl x ∈ TwoColorComponent G phi alpha beta z) : + TwoColorComponent G phi alpha beta z = + TwoColorComponent G phi alpha beta (Sum.inl u) := by + obtain ⟨x, hx, hxc⟩ := hz + rw [ord.vertexSet] at hx + rcases Finset.mem_union.mp hx with hx | hx + · exact hX z _ pz pu ⟨x, hx, hxc⟩ ⟨u, hu, self u⟩ + · exact (hY z _ pz pv ⟨x, hx, hxc⟩ ⟨v, hv, self v⟩).trans heq.symm + intro z w pz pw hz hw + exact (rooted z pz hz).trans (rooted w pw hw).symm + have avoidX : ∀ x ∈ TreeSequenceVertexSet X, + Sum.inl x ∉ TwoColorComponent G phi alpha beta (Sum.inl v) := by + intro x hx hxc + exact distinct (hX _ _ pu pv ⟨u, hu, self u⟩ ⟨x, hx, hxc⟩) + have avoidY : ∀ x ∈ TreeSequenceVertexSet Y, + Sum.inl x ∉ TwoColorComponent G phi alpha beta (Sum.inl u) := by + intro x hx hxc + exact distinct (hY _ _ pu pv ⟨x, hx, hxc⟩ ⟨v, hv, self v⟩) + exact ⟨hab, (fun h => avoidY u h (self u)), + (fun h => avoidX v h (self v)), avoidX, avoidY⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OrderedExitCounterexample.lean b/LeanPool/GoldbergSeymour/OrderedExitCounterexample.lean new file mode 100644 index 0000000000..8756eb25e0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OrderedExitCounterexample.lean @@ -0,0 +1,220 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ElementaryClosedExitPairExtendsTriple +public import LeanPool.GoldbergSeymour.ElementaryClosedNoninterchangeableExitPair +public import LeanPool.GoldbergSeymour.ElementarySingleBoundaryInterchangeable +public import LeanPool.GoldbergSeymour.RutgersCounterexample + +public import Mathlib.Data.Fin.VecNotation +public import Mathlib.Tactic.FinCases + +/-! +# P2647_T1_Ordered Exit Counterexample + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2647_T1_OrderedExitCounterexample + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (hproper : IsProperEdgeColoring G presentation.sigma) + (helementary : ColoredVertexSetElementary G presentation.sigma + (TreeSequenceVertexSet presentation.U)) + (hclosed : ColoredVertexSetClosed G presentation.sigma + (TreeSequenceVertexSet presentation.U)) + (alpha beta : Fin k) (hcolors : alpha ≠ beta) + (halpha : alpha ∈ TreeMissingColors presentation.sigma presentation.U) + (hnot : ¬ TreeInterchangeable G presentation.U presentation.sigma alpha beta) : + ∃ counterexample : RutgersCounterexample G k e0 original presentation, + counterexample.alpha = alpha ∧ counterexample.beta = beta := by + classical + have missingClosed (c : Fin k) + (hc : c ∈ TreeMissingColors presentation.sigma presentation.U) : + BoundaryColorEdges G presentation.sigma + (TreeSequenceVertexSet presentation.U) c = ∅ := by + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + simp only [BoundaryColorEdges, Finset.mem_filter] at hf + exact hclosed hf.1 hv hf.2 hcv + have halphaClosed : TreeColorSetClosed G presentation.sigma presentation.U {alpha} := by + intro c hc + have : c = alpha := Finset.mem_singleton.mp hc + subst c + exact missingClosed alpha halpha + have hbeta : beta ∉ TreeMissingColors presentation.sigma presentation.U := by + intro hb + apply hnot + apply ElementarySingleBoundaryInterchangeable G presentation.sigma + presentation.U alpha beta hproper helementary (missingClosed alpha halpha) + rw [missingClosed beta hb] + simp + obtain ⟨a1, b1, a2, b2, Q1, Q2, f1, f2, hx1, hx2, hd12, + ha12, hb12, hf1, hf2, hi1, hi2, hs1, hs2⟩ := + ElementaryClosedNoninterchangeableExitPair G presentation.U presentation.sigma + hproper helementary alpha beta hcolors halpha halphaClosed hnot + obtain ⟨a3, b3, Q3, f3, hx3, hd13, hd23, ha31, ha32, hb31, hb32, + hf3, hi3, hs3⟩ := + ElementaryClosedExitPairExtendsTriple G presentation.U presentation.sigma + hproper helementary alpha beta hcolors halpha halphaClosed hbeta + a1 b1 a2 b2 Q1 Q2 hx1 hx2 hd12 ha12 hb12 + let package : Fin 3 → Σ a b : V, + (TwoColorIncidenceGraph G presentation.sigma alpha beta).Walk + (Sum.inl a) (Sum.inl b) × E := + ![⟨a1, b1, Q1, f1⟩, ⟨a2, b2, Q2, f2⟩, ⟨a3, b3, Q3, f3⟩] + let a := fun i => (package i).1 + let b := fun i => (package i).2.1 + let Q := fun i => (package i).2.2.1 + let f := fun i => (package i).2.2.2 + have exits : ∀ i, TreeExitPath presentation.U presentation.sigma + alpha beta (a i) (b i) (Q i) := by + intro i + fin_cases i + · simpa [a, b, Q, package] using hx1 + · simpa [a, b, Q, package] using hx2 + · simpa [a, b, Q, package] using hx3 + have boundary : ∀ i, f i ∈ BoundaryColorEdges G presentation.sigma + (TreeSequenceVertexSet presentation.U) beta := by + intro i + fin_cases i + · simpa [f, package] using hf1 + · simpa [f, package] using hf2 + · simpa [f, package] using hf3 + have incidence : ∀ i, Incident G (b i) (f i) := by + intro i + fin_cases i + · simpa [b, f, package] using hi1 + · simpa [b, f, package] using hi2 + · simpa [b, f, package] using hi3 + have onWalk : ∀ i, Sum.inr (f i) ∈ (Q i).support := by + intro i + fin_cases i + · simpa [f, Q, package] using hs1 + · simpa [f, Q, package] using hs2 + · simpa [f, Q, package] using hs3 + have disjoint : ∀ i j, i ≠ j → ∀ x, x ∈ (Q i).support → x ∉ (Q j).support := by + intro i j hij + fin_cases i <;> fin_cases j + all_goals first + | exact (hij rfl).elim + | exact hd12 + | exact hd13 + | exact hd23 + | exact fun x hx hy => hd12 x hy hx + | exact fun x hx hy => hd13 x hy hx + | exact fun x hx hy => hd23 x hy hx + have outsideDistinct : ∀ i j, i ≠ j → a i ≠ a j := by + intro i j hij + fin_cases i <;> fin_cases j + all_goals first + | exact (hij rfl).elim + | exact ha12 + | exact ha31 + | exact ha32 + | exact ha12.symm + | exact ha31.symm + | exact ha32.symm + have insideDistinct : ∀ i j, i ≠ j → b i ≠ b j := by + intro i j hij + fin_cases i <;> fin_cases j + all_goals first + | exact (hij rfl).elim + | exact hb12 + | exact hb31 + | exact hb32 + | exact hb12.symm + | exact hb31.symm + | exact hb32.symm + have positions : ∀ i, ∃ r : Fin (presentation.U.length + 1), + presentation.U.vertex r = b i := by + intro i + have hv := (exits i).2.2.2.1 + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] using hv + choose rank hrank using positions + have rankDistinct : ∀ i j, i ≠ j → (rank i).val ≠ (rank j).val := by + intro i j hij heq + apply insideDistinct i j hij + rw [← hrank i, ← hrank j, Fin.ext heq] + have sorted : ∃ i j l : Fin 3, + (rank i).val < (rank j).val ∧ (rank j).val < (rank l).val := by + have h01 := rankDistinct 0 1 (by decide) + have h02 := rankDistinct 0 2 (by decide) + have h12 := rankDistinct 1 2 (by decide) + by_cases hij : (rank 0).val < (rank 1).val + · by_cases hjl : (rank 1).val < (rank 2).val + · exact ⟨0, 1, 2, hij, hjl⟩ + · by_cases hil : (rank 0).val < (rank 2).val + · exact ⟨0, 2, 1, hil, by omega⟩ + · exact ⟨2, 0, 1, by omega, hij⟩ + · by_cases hil : (rank 0).val < (rank 2).val + · exact ⟨1, 0, 2, by omega, hil⟩ + · by_cases hjl : (rank 1).val < (rank 2).val + · exact ⟨1, 2, 0, hjl, by omega⟩ + · exact ⟨2, 1, 0, by omega, by omega⟩ + obtain ⟨i, j, l, hij, hjl⟩ := sorted + have hneij : i ≠ j := by intro h; subst j; omega + have hneil : i ≠ l := by intro h; subst l; omega + have hnejl : j ≠ l := by intro h; subst l; omega + refine ⟨{ + alpha := alpha + beta := beta + colorsDistinct := hcolors + alphaMissing := halpha + betaPresent := hbeta + a1 := a i + b1 := b i + a2 := a j + b2 := b j + a3 := a l + b3 := b l + Q1 := Q i + Q2 := Q j + Q3 := Q l + f1 := f i + f2 := f j + f3 := f l + exit1 := exits i + exit2 := exits j + exit3 := exits l + supportDisjoint12 := disjoint i j hneij + supportDisjoint13 := disjoint i l hneil + supportDisjoint23 := disjoint j l hnejl + outsideDistinct12 := outsideDistinct i j hneij + outsideDistinct13 := outsideDistinct i l hneil + outsideDistinct23 := outsideDistinct j l hnejl + insideDistinct12 := insideDistinct i j hneij + insideDistinct13 := insideDistinct i l hneil + insideDistinct23 := insideDistinct j l hnejl + insideOrder12 := ⟨rank i, rank j, hrank i, hrank j, hij⟩ + insideOrder23 := ⟨rank j, rank l, hrank j, hrank l, hjl⟩ + boundary1 := boundary i + boundary2 := boundary j + boundary3 := boundary l + incident1 := incidence i + incident2 := incidence j + incident3 := incidence l + edgeOnWalk1 := onWalk i + edgeOnWalk2 := onWalk j + edgeOnWalk3 := onWalk l + }, rfl, rfl⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OrderedTreeUnion.lean b/LeanPool/GoldbergSeymour/OrderedTreeUnion.lean new file mode 100644 index 0000000000..6b72b9c824 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OrderedTreeUnion.lean @@ -0,0 +1,48 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Ordered Tree Union + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A union tree extending the left tree and preserving the relative order of new entries from the +right tree. +-/ +structure OrderedTreeUnion {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + {G : LooplessMultigraph V E} {e0 : E} (left right union : TreeSequence G e0) where + leftSegment : TreeSequenceInitialSegment left union + vertexSet : TreeSequenceVertexSet union = TreeSequenceVertexSet left ∪ TreeSequenceVertexSet right + newEntryFromRight : + ∀ j : Fin union.length, + left.length ≤ j.val → + ∃ i : Fin right.length, + union.edge j = right.edge i ∧ union.vertex j.succ = right.vertex i.succ + everyNewRightEntry : + ∀ i : Fin right.length, right.vertex i.succ ∉ TreeSequenceVertexSet left → + ∃ j : Fin union.length, left.length ≤ j.val ∧ union.edge j = right.edge i ∧ union.vertex + j.succ = right.vertex i.succ + rightOrder : + ∀ i j : Fin right.length, right.vertex i.succ ∉ TreeSequenceVertexSet left → right.vertex + j.succ ∉ TreeSequenceVertexSet left → i.val < j.val → + ∀ p q : Fin union.length, union.vertex p.succ = right.vertex i.succ → union.vertex q.succ = + right.vertex j.succ → p.val < q.val + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OrderedTreeUnionAugmentationSequence.lean b/LeanPool/GoldbergSeymour/OrderedTreeUnionAugmentationSequence.lean new file mode 100644 index 0000000000..ca32ccf9a4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OrderedTreeUnionAugmentationSequence.lean @@ -0,0 +1,327 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +/-! +# Ordered Tree Union Augmentation Sequence + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_replay_113.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (P L R U : TreeSequence G e0), + TashkinovAugmentationSequence phi P R → TreeSequenceInitialSegment P L → + ∀ (hleftSegment : TreeSequenceInitialSegment L U), ( + ∀ (j : Fin U.length), L.length ≤ (↑j : ℕ) → + ∃ (i : Fin R.length), U.edge j = R.edge i ∧ U.vertex j.succ = R.vertex i.succ) → ( + ∀ (i : Fin R.length), R.vertex i.succ ∉ TreeSequenceVertexSet L → + ∃ (j : Fin U.length), L.length ≤ (↑j : ℕ) ∧ U.edge j = R.edge i ∧ U.vertex j.succ = R.vertex + i.succ) → ( + ∀ (i j : Fin R.length), R.vertex i.succ ∉ TreeSequenceVertexSet L → R.vertex j.succ ∉ + TreeSequenceVertexSet L → (↑i : ℕ) < (↑j : ℕ) → + ∀ (p q : Fin U.length), U.vertex p.succ = R.vertex i.succ → U.vertex q.succ = R.vertex j.succ + → (↑p : ℕ) < (↑q : ℕ)) → ( + ∀ (T : TreeSequence G e0) (q : ℕ) (hq : (1 : ℕ) ≤ q) (hqT : q ≤ T.length), + TreeSequenceInitialSegment (TreeSequencePrefix T q hq hqT) T) → ( + ∀ (T : TreeSequence G e0) (q : ℕ) (hq : (1 : ℕ) ≤ q) (hqT : q + (1 : ℕ) ≤ T.length), + TreeSequenceInitialSegment (TreeSequencePrefix T q hq (Nat.le_trans (Nat.le_succ q) hqT)) + (TreeSequencePrefix T (q + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ q + (1 + : ℕ)) => + by + omega + ) hqT)) → TreeSequencePrefix U L.length L.positive hleftSegment.1 = L → + TreeSequenceInitialSegment P R → ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence phi A B → A.length < B.length → + ∃ (C : TreeSequence G e0), TashkinovAugmentation phi A C ∧ TashkinovAugmentationSequence phi C + B) → + ∀ (n : ℕ) (hnL : L.length ≤ n) (hnU : n ≤ U.length), TashkinovAugmentationSequence phi L + (TreeSequencePrefix U n (Nat.le_trans L.positive hnL) hnU) := by + classical + intro V E _ _ G k e0 phi P L R U hPR hPL hleftSegment hnewEntryFromRight heveryNewRightEntry + hrightOrder prefixSegment prefixPrefix prefixAtLeft hPRSegment firstStep n hnL hnU + let _ := Fintype.ofFinite V + induction n, hnL using Nat.le_induction with + | base => + simpa [prefixAtLeft] using + (show TashkinovAugmentationSequence phi L L from + Relation.ReflTransGen.refl) + | @succ n hnL ih => + by_cases hnEq : n = U.length + · omega + have hnSuccU : n + 1 ≤ U.length := by omega + have hnU' : n ≤ U.length := Nat.le_trans (Nat.le_succ n) hnSuccU + have ih' := ih hnU' + let X := TreeSequencePrefix U n (Nat.le_trans L.positive hnL) hnU' + let Y := TreeSequencePrefix U (n + 1) + (Nat.le_trans L.positive (Nat.le_trans hnL (Nat.le_succ n))) hnSuccU + let j : Fin U.length := ⟨n, by omega⟩ + obtain ⟨i, hedgeUR, hvertexUR⟩ := hnewEntryFromRight j hnL + have hrightOutside : R.vertex i.succ ∉ TreeSequenceVertexSet L := by + intro hmem + rw [TreeSequenceVertexSet] at hmem + obtain ⟨a, -, ha⟩ := + (@Finset.mem_image _ _ (Classical.decEq V)).mp hmem + have huvertex : U.vertex + (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) = + L.vertex a := hleftSegment.2.1 a + have heq : U.vertex j.succ = + U.vertex (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) := + hvertexUR.trans (ha.symm.trans huvertex.symm) + have hindex := congrArg Fin.val (U.vertex_injective heq) + simp [j] at hindex + omega + have hiP : P.length ≤ i.val := by + by_contra hnot + have hi : i.val < P.length := Nat.lt_of_not_ge hnot + let a : Fin (P.length + 1) := ⟨i.val + 1, by omega⟩ + have hRPa : R.vertex + (Fin.castLE (Nat.succ_le_succ hPRSegment.1) a) = P.vertex a := + hPRSegment.2.1 a + apply hrightOutside + rw [TreeSequenceVertexSet] + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨Fin.castLE (Nat.succ_le_succ hPL.1) a, Finset.mem_univ _, ?_⟩ + have hia : Fin.castLE (Nat.succ_le_succ hPRSegment.1) a = i.succ := + Fin.ext (by simp [a]) + rw [hia] at hRPa + exact (hPL.2.1 a).trans hRPa.symm + have hiR : i.val < R.length := i.isLt + let RX := TreeSequencePrefix R i.val + (Nat.le_trans P.positive hiP) (Nat.le_of_lt hiR) + have hPRX : TreeSequenceInitialSegment P RX := by + refine ⟨hiP, ?_, ?_⟩ + · intro a + change R.vertex _ = P.vertex a + calc + R.vertex _ = R.vertex + (Fin.castLE (Nat.succ_le_succ hPRSegment.1) a) := by congr 1 + _ = P.vertex a := hPRSegment.2.1 a + · intro a + change R.edge _ = P.edge a + calc + R.edge _ = R.edge (Fin.castLE hPRSegment.1 a) := by congr 1 + _ = P.edge a := hPRSegment.2.2 a + have hRXR : TreeSequenceInitialSegment RX R := + prefixSegment R i.val (Nat.le_trans P.positive hiP) (Nat.le_of_lt hiR) + have hsuffix : TashkinovAugmentationSequence phi RX R := + TashkinovAugmentationSequenceSuffix phi P RX R hPR hPRX hRXR + have hRXlen : RX.length = i.val := rfl + obtain ⟨C, hRXC, hCR⟩ := firstStep hsuffix (by omega) + rcases hRXC with ⟨hlenC, hRXCsegment, c, hcolorC, hmissingRX⟩ + have hCRSegment : TreeSequenceInitialSegment C R := + TashkinovAugmentationSequenceInitialSegment phi C R hCR + have hCi : C.length = i.val + 1 := by omega + let ci : Fin C.length := ⟨i.val, by omega⟩ + have hcolorR : phi (R.edge i) = some c := by + have hciLast : ci = Fin.cast hlenC.symm (Fin.last RX.length) := by + apply Fin.ext + simp [ci, hRXlen] + have hRci : R.edge (Fin.castLE hCRSegment.1 ci) = C.edge ci := + hCRSegment.2.2 ci + have hcast : Fin.castLE hCRSegment.1 ci = i := by + apply Fin.ext + simp [ci] + rw [← hcast, hRci, hciLast] + exact hcolorC + have hmissingX : c ∈ TreeMissingColors phi X := by + rw [TreeMissingColors] at hmissingRX ⊢ + obtain ⟨v, hvRX, hcMissing⟩ := Finset.mem_biUnion.mp hmissingRX + rw [TreeSequenceVertexSet] at hvRX + obtain ⟨a, -, ha⟩ := + (@Finset.mem_image _ _ (Classical.decEq V)).mp hvRX + apply Finset.mem_biUnion.mpr + refine ⟨v, ?_, hcMissing⟩ + by_cases hvL : v ∈ TreeSequenceVertexSet L + · rw [TreeSequenceVertexSet] at hvL ⊢ + obtain ⟨b, -, hb⟩ := + (@Finset.mem_image _ _ (Classical.decEq V)).mp hvL + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨Fin.castLE (Nat.succ_le_succ hnL) b, Finset.mem_univ _, ?_⟩ + change U.vertex _ = v + calc + U.vertex _ = U.vertex + (Fin.castLE (Nat.succ_le_succ hleftSegment.1) b) := by congr 1 + _ = L.vertex b := hleftSegment.2.1 b + _ = v := hb + · have haPos : 1 ≤ a.val := by + by_contra hzero + have haZero : a.val = 0 := by omega + let p0 : Fin (P.length + 1) := ⟨0, by omega⟩ + have hRp0 := hPRSegment.2.1 p0 + have hLp0 := hPL.2.1 p0 + apply hvL + rw [TreeSequenceVertexSet] + refine (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨Fin.castLE (Nat.succ_le_succ hPL.1) p0, Finset.mem_univ _, ?_⟩ + have haR : R.vertex (Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiR)) a) = v := by + simpa [RX, TreeSequencePrefix] using ha + have ha0 : Fin.castLE + (Nat.succ_le_succ (Nat.le_of_lt hiR)) a = + Fin.castLE (Nat.succ_le_succ hPRSegment.1) p0 := by + apply Fin.ext + exact haZero + rw [ha0, hRp0] at haR + exact hLp0.trans haR + let r : Fin R.length := ⟨a.val - 1, by + have haLt : a.val < RX.length + 1 := a.isLt + simp [RX] at haLt + omega⟩ + have hrSucc : r.succ = + Fin.castLE (Nat.succ_le_succ (Nat.le_of_lt hiR)) a := by + apply Fin.ext + exact Nat.sub_add_cancel haPos + have hrv : R.vertex r.succ = v := by + rw [hrSucc] + simpa [RX, TreeSequencePrefix] using ha + have hrOutside : R.vertex r.succ ∉ TreeSequenceVertexSet L := by + simpa [hrv] using hvL + have hri : r.val < i.val := by + have haLt : a.val < RX.length + 1 := a.isLt + simp [RX, r] at haLt ⊢ + omega + obtain ⟨q, hqL, hedgeq, hvertexq⟩ := + heveryNewRightEntry r hrOutside + have hqn : q.val < n := + hrightOrder r i hrOutside hrightOutside hri q j + hvertexq hvertexUR + rw [TreeSequenceVertexSet] + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + have hXlen : X.length = n := rfl + let qX : Fin (X.length + 1) := ⟨q.val + 1, by omega⟩ + refine ⟨qX, Finset.mem_univ _, ?_⟩ + rw [← hrv, ← hvertexq] + change U.vertex _ = U.vertex q.succ + congr 1 + have hXY : TashkinovAugmentation phi X Y := by + have hlenXY : Y.length = X.length + 1 := by + change n + 1 = n + 1 + rfl + refine ⟨hlenXY, ?_, c, ?_, hmissingX⟩ + · simpa [X, Y] using prefixPrefix U n + (Nat.le_trans L.positive hnL) hnSuccU + · have hcolorU : phi (U.edge j) = some c := by + rw [hedgeUR] + exact hcolorR + change phi (U.edge _) = some c + convert hcolorU using 1 + apply congrArg phi + apply congrArg U.edge + apply Fin.ext + rfl + change TashkinovAugmentationSequence phi L Y + exact Relation.ReflTransGen.tail ih' hXY + +theorem OrderedTreeUnionAugmentationSequence + {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (P L R U : TreeSequence G e0) + (hPR : TashkinovAugmentationSequence phi P R) + (hPL : TreeSequenceInitialSegment P L) + (hunion : OrderedTreeUnion L R U) : + TashkinovAugmentationSequence phi L U := by + rcases hunion with + ⟨hleftSegment, hunionVertices, hnewEntryFromRight, + heveryNewRightEntry, hrightOrder⟩ + classical + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + rcases hAB with ⟨hlenAB, hvertexAB, hedgeAB⟩ + rcases hBC with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨hlenAB.trans hlenBC, ?_, ?_⟩ + · intro i + calc + C.vertex (Fin.castLE (Nat.succ_le_succ (hlenAB.trans hlenBC)) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hlenBC) + (Fin.castLE (Nat.succ_le_succ hlenAB) i)) := by congr 1 + _ = B.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) i) := hvertexBC _ + _ = A.vertex i := hvertexAB i + · intro i + calc + C.edge (Fin.castLE (hlenAB.trans hlenBC) i) = + C.edge (Fin.castLE hlenBC (Fin.castLE hlenAB i)) := by congr 1 + _ = B.edge (Fin.castLE hlenAB i) := hedgeBC _ + _ = A.edge i := hedgeAB i + have prefixSegment (T : TreeSequence G e0) (q : Nat) + (hq : 1 ≤ q) (hqT : q ≤ T.length) : + TreeSequenceInitialSegment (TreeSequencePrefix T q hq hqT) T := by + refine ⟨hqT, ?_, ?_⟩ + · intro i + simp [TreeSequencePrefix] + · intro i + simp [TreeSequencePrefix] + have prefixPrefix (T : TreeSequence G e0) (q : Nat) + (hq : 1 ≤ q) (hqT : q + 1 ≤ T.length) : + TreeSequenceInitialSegment + (TreeSequencePrefix T q hq (Nat.le_trans (Nat.le_succ q) hqT)) + (TreeSequencePrefix T (q + 1) (by omega) hqT) := by + refine ⟨Nat.le_succ q, ?_, ?_⟩ + · intro i + change T.vertex _ = T.vertex _ + congr 1 + · intro i + change T.edge _ = T.edge _ + congr 1 + have prefixSelf (T : TreeSequence G e0) : + TreeSequencePrefix T T.length T.positive le_rfl = T := by + cases T with + | mk len pos vertex edge vinj einj first attach => + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + rfl + · apply heq_of_eq + funext i + rfl + have prefixAtLeft : + TreeSequencePrefix U L.length L.positive hleftSegment.1 = L := by + cases L with + | mk llen lpos lvertex ledge lvinj leinj lfirst lattach => + cases U with + | mk ulen upos uvertex uedge uvinj ueinj ufirst uattach => + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa [TreeSequencePrefix] using hleftSegment.2.1 i + · apply heq_of_eq + funext i + simpa [TreeSequencePrefix] using hleftSegment.2.2 i + have hPRSegment : TreeSequenceInitialSegment P R := + TashkinovAugmentationSequenceInitialSegment phi P R hPR + have firstStep {A B : TreeSequence G e0} + (hAB : TashkinovAugmentationSequence phi A B) + (hlt : A.length < B.length) : + ∃ C, TashkinovAugmentation phi A C ∧ + TashkinovAugmentationSequence phi C B := by + unfold TashkinovAugmentationSequence at hAB ⊢ + induction hAB using Relation.ReflTransGen.head_induction_on with + | refl => omega + | @head A C hAC hCB ih => exact ⟨C, hAC, hCB⟩ + have replay := @helper_replay_113 V E inferInstance inferInstance G k e0 phi P L R U hPR hPL + hleftSegment hnewEntryFromRight heveryNewRightEntry hrightOrder prefixSegment prefixPrefix + prefixAtLeft hPRSegment firstStep + have hfull := replay U.length hleftSegment.1 le_rfl + simpa [prefixSelf] using hfull + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OrderedTreeUnionExists.lean b/LeanPool/GoldbergSeymour/OrderedTreeUnionExists.lean new file mode 100644 index 0000000000..711eb286f4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OrderedTreeUnionExists.lean @@ -0,0 +1,875 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.OrderedTreeUnion + +/-! +# Ordered Tree Union Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (A B : TreeSequence G + e0), + let this : DecidableEq V := Classical.decEq V; + let Good : ℕ → TreeSequence G e0 → Prop := fun (n : ℕ) (T : TreeSequence G e0) ↦ + TreeSequenceInitialSegment A T ∧ ( + ∀ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ n → B.vertex i ∈ TreeSequenceVertexSet T) ∧ + TreeSequenceVertexSet T ⊆ TreeSequenceVertexSet A ∪ TreeSequenceVertexSet B ∧ ( + ∀ (j : Fin T.length), A.length ≤ (↑j : ℕ) → + ∃ (i : Fin B.length), (↑i : ℕ) < n ∧ T.edge j = B.edge i ∧ T.vertex j.succ = B.vertex i.succ) + ∧ ( + ∀ (i : Fin B.length), (↑i : ℕ) < n → B.vertex i.succ ∉ TreeSequenceVertexSet A → + ∃ (j : Fin T.length), A.length ≤ (↑j : ℕ) ∧ T.edge j = B.edge i ∧ T.vertex j.succ = B.vertex + i.succ) ∧ + ∀ (i j : Fin B.length), (↑i : ℕ) < n → (↑j : ℕ) < n → B.vertex i.succ ∉ TreeSequenceVertexSet + A → B.vertex j.succ ∉ TreeSequenceVertexSet A → (↑i : ℕ) < (↑j : ℕ) → + ∀ (p q : Fin T.length), T.vertex p.succ = B.vertex i.succ → T.vertex q.succ = B.vertex j.succ + → (↑p : ℕ) < (↑q : ℕ); + ∀ (n : ℕ) (hn : n + (1 : ℕ) ≤ B.length) (T : TreeSequence G e0) (_ : Good n T) (_ : B.vertex + (⟨n + (1 : ℕ), + by omega + ⟩ : Fin (B.length + (1 : ℕ))) ∈ TreeSequenceVertexSet A), + ∃ (T : TreeSequence G e0), Good (n + (1 : ℕ)) T := by + classical + intro V E G e0 A B this Good n hn T hT hout + refine ⟨T, ?_⟩ + rcases hT with ⟨hseg, hall, hsub, hnew, hcov, hord⟩ + refine ⟨hseg, ?_, hsub, ?_, ?_, ?_⟩ + · intro i hi + by_cases hil : i.val ≤ n + · exact hall i (by omega) + · have heq : i = ⟨n + 1, Nat.lt_succ_of_le hn⟩ := by + apply Fin.ext + have hil' : n < i.val := Nat.lt_of_not_ge hil + change i.val = n + 1 + omega + rw [heq] + have hleft : B.vertex ⟨n + 1, Nat.lt_succ_of_le hn⟩ ∈ TreeSequenceVertexSet T := by + rcases hseg with ⟨hlen, hv, he⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hout ⊢ + obtain ⟨k, hk⟩ := hout + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) k, ?_⟩ + rw [hv k] + exact hk + exact hleft + · intro j hj + obtain ⟨k, hk, he, hv⟩ := hnew j hj + exact ⟨k, by omega, he, hv⟩ + · intro i hi ho + by_cases hil : i.val < n + · exact hcov i hil ho + · have heq : i.succ = ⟨n + 1, Nat.lt_succ_of_le hn⟩ := by + apply Fin.ext + change i.val + 1 = n + 1 + omega + exact (ho (heq ▸ hout)).elim + · intro i j hi hj ho1 ho2 hlt + have hil : i.val < n := by + by_contra hni + have heq : i.succ = ⟨n + 1, Nat.lt_succ_of_le hn⟩ := by + apply Fin.ext + change i.val + 1 = n + 1 + omega + exact (ho1 (heq ▸ hout)).elim + have hjl : j.val < n := by + by_contra hnj + have heq : j.succ = ⟨n + 1, Nat.lt_succ_of_le hn⟩ := by + apply Fin.ext + change j.val + 1 = n + 1 + omega + exact (ho2 (heq ▸ hout)).elim + exact hord i j hil hjl ho1 ho2 hlt + +private theorem helper_hnewv_297.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} + (A B : TreeSequence G e0) (n : ℕ) (hn : n + (1 : ℕ) ≤ B.length) + (T : TreeSequence G e0) + (_ : + B.vertex (⟨n + (1 : ℕ), by omega⟩ : Fin (B.length + (1 : ℕ))) ∉ + TreeSequenceVertexSet A) + (_ : TreeSequenceInitialSegment A T) + (_ : + (∀ (j : Fin T.length) (_ : A.length ≤ (↑j : ℕ)), + ∃ (i : Fin B.length), + (↑i : ℕ) < n ∧ T.edge j = B.edge i ∧ T.vertex j.succ = B.vertex i.succ)), + let k : Fin B.length := (⟨n, by omega⟩ : Fin B.length); + ∀ (i : Fin ((↑k : ℕ) + (1 : ℕ))) (_ : (↑i : ℕ) ≤ n), + B.vertex k.succ ∉ TreeSequenceVertexSet T := by + classical + intro V E G e0 A B n hn T hout hseg hnew k i hiBound hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv + obtain ⟨r, hr⟩ := hv + by_cases hold : r.val ≤ A.length + · rcases hseg with ⟨hlen, hvertices, hedges⟩ + apply hout + let rA : Fin (A.length + 1) := r.castLT (by omega) + refine Finset.mem_image.mpr ⟨rA, + Finset.mem_univ _, ?_⟩ + have ridx : Fin.castLE (Nat.succ_le_succ hlen) rA = r := by + apply Fin.ext + rfl + rw [← hvertices rA, ridx] + exact hr + · by_cases rz : r.val = 0 + · rcases hseg with ⟨hlen, hvertices, hedges⟩ + apply hout + refine Finset.mem_image.mpr ⟨⟨0, Nat.zero_lt_succ _⟩, + Finset.mem_univ _, ?_⟩ + rw [← hvertices (⟨0, Nat.zero_lt_succ _⟩ : Fin (A.length + 1))] + have rr : r = ⟨0, Nat.zero_lt_succ _⟩ := by apply Fin.ext; exact rz + rw [rr] at hr + exact hr + · have rz' : r ≠ 0 := by + intro hrz + apply rz + simp [hrz] + let j := r.pred rz' + have rpos : 1 ≤ r.val := by + apply Nat.one_le_iff_ne_zero.mpr + intro hrzero + apply rz + exact hrzero + have jform : j.val + 1 = r.val := by + dsimp [j] + exact Nat.sub_add_cancel rpos + obtain ⟨z, hz, he, hvz⟩ := hnew j (by omega) + have hrj : T.vertex j.succ = B.vertex k.succ := by + calc + T.vertex j.succ = T.vertex r := by + congr 1 + apply Fin.ext + simp [j] + _ = B.vertex k.succ := hr + have zedge : B.vertex z.succ = B.vertex k.succ := hvz.symm.trans hrj + have zsucc : z.succ = k.succ := B.vertex_injective zedge + have zval : z.val + 1 = k.val + 1 := congrArg Fin.val zsucc + have zk : z = k := by + apply Fin.ext + exact Nat.succ.inj (by simpa [Nat.succ_eq_add_one] using zval) + have zkval : z.val = k.val := congrArg Fin.val zk + have kval : k.val = n := rfl + omega + +private theorem helper_branch_351.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (A B : TreeSequence G + e0), + let _ : DecidableEq V := Classical.decEq V; + ∀ (_ : (1 : ℕ) < B.length + (1 : ℕ)) (_ : B.vertex (⟨(0 : ℕ), Nat.zero_lt_succ B.length⟩ : Fin + (B.length + (1 : ℕ))) ∈ TreeSequenceVertexSet A), + let Good : ℕ → TreeSequence G e0 → Prop := fun (n : ℕ) (T : TreeSequence G e0) ↦ + TreeSequenceInitialSegment A T ∧ ( + ∀ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ n → B.vertex i ∈ TreeSequenceVertexSet T) ∧ + TreeSequenceVertexSet T ⊆ TreeSequenceVertexSet A ∪ TreeSequenceVertexSet B ∧ ( + ∀ (j : Fin T.length), A.length ≤ (↑j : ℕ) → + ∃ (i : Fin B.length), (↑i : ℕ) < n ∧ T.edge j = B.edge i ∧ T.vertex j.succ = B.vertex i.succ) + ∧ ( + ∀ (i : Fin B.length), (↑i : ℕ) < n → B.vertex i.succ ∉ TreeSequenceVertexSet A → + ∃ (j : Fin T.length), A.length ≤ (↑j : ℕ) ∧ T.edge j = B.edge i ∧ T.vertex j.succ = B.vertex + i.succ) ∧ + ∀ (i j : Fin B.length), (↑i : ℕ) < n → (↑j : ℕ) < n → B.vertex i.succ ∉ TreeSequenceVertexSet + A → B.vertex j.succ ∉ TreeSequenceVertexSet A → (↑i : ℕ) < (↑j : ℕ) → + ∀ (p q : Fin T.length), T.vertex p.succ = B.vertex i.succ → T.vertex q.succ = B.vertex j.succ + → (↑p : ℕ) < (↑q : ℕ); + ∀ (_ : (0 : ℕ) ≤ B.length), + ∃ (T : TreeSequence G e0), Good (0 : ℕ) T := by + classical + intro V E G e0 A B this hB2 first_in_left Good hn + refine ⟨A, ?_⟩ + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · refine ⟨le_rfl, ?_, ?_⟩ + · intro i + rfl + · intro j + rfl + · intro i hi + have hi0 : i.val = 0 := by omega + have heq : i = ⟨0, by omega⟩ := by apply Fin.ext; exact hi0 + rw [heq] + exact first_in_left + · intro x hx + exact Finset.mem_union_left _ hx + · intro j hj + have hj' := j.isLt + omega + · intro i hi hout + omega + · intro i j hi hj ho1 ho2 hlt + omega + +private theorem helper_branch_319.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (T : TreeSequence G e0) + (f : E) (v : V) (i : Fin (T.length + (1 : ℕ))), G.ends f = s(v, T.vertex i) → + ∀ (j : Fin (T.length + (1 : ℕ))), j = Fin.last T.length → + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), G.ends (Fin.lastCases f (fun (j : Fin T.length) ↦ T.edge j) + j) = s(Fin.lastCases v (fun (j : Fin (T.length + (1 : ℕ))) ↦ T.vertex j) j.succ, + Fin.lastCases v (fun (j : Fin (T.length + (1 : ℕ))) ↦ T.vertex j) (i.castLT ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt j + have := Fin.isLt i + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) := by + classical + intro V E G e0 T f v i hi j hj + subst j + refine ⟨i, ?_⟩ + have hc : (Fin.castLT i (by omega) : Fin (T.length + 1 + 1)) = i.castSucc := by + apply Fin.ext + rfl + rw [hc] + simp only [Fin.lastCases, Fin.reverseInduction_last, + Fin.reverseInduction_castSucc] + rw [hi] + simp [] + +private theorem helper_first_in_left_366.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (A B : TreeSequence G + e0), (1 : ℕ) < A.length + (1 : ℕ) → B.vertex (⟨(0 : ℕ), Nat.zero_lt_succ B.length⟩ : Fin + (B.length + (1 : ℕ))) ∈ TreeSequenceVertexSet A := by + classical + intro V E G e0 A B hA2 + obtain ⟨i, hi⟩ := B.attaches ⟨0, B.positive⟩ + have hi0 : i = ⟨0, Nat.zero_lt_succ _⟩ := Fin.eq_zero i + subst i + rw [B.first_edge] at hi + obtain ⟨j, hj⟩ := A.attaches ⟨0, A.positive⟩ + have hj0 : j = ⟨0, Nat.zero_lt_succ _⟩ := Fin.eq_zero j + subst j + rw [A.first_edge] at hj + have hm : B.vertex ⟨0, Nat.zero_lt_succ B.length⟩ ∈ G.ends e0 := by + rw [hi] + exact (Sym2.mem_iff).2 (Or.inr rfl) + rw [hj] at hm + rcases Sym2.mem_iff.mp hm with hm | hm + · refine Finset.mem_image.mpr ⟨⟨1, hA2⟩, Finset.mem_univ _, ?_⟩ + convert hm.symm using 1 + exact congrArg A.vertex (by apply Fin.ext; rfl) + · refine Finset.mem_image.mpr ⟨⟨0, Nat.zero_lt_succ _⟩, Finset.mem_univ _, ?_⟩ + convert hm.symm using 1 + exact congrArg A.vertex (by apply Fin.ext; rfl) + +private theorem helper_first_next_in_left_386.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (A B : TreeSequence G e0), + (1 : ℕ) < A.length + (1 : ℕ) → + ∀ (hB2 : (1 : ℕ) < B.length + (1 : ℕ)), + B.vertex (⟨(1 : ℕ), hB2⟩ : Fin (B.length + (1 : ℕ))) ∈ TreeSequenceVertexSet A := by + classical + intro V E G e0 A B hA2 hB2 + obtain ⟨i, hi⟩ := B.attaches ⟨0, B.positive⟩ + have hi0 : i = ⟨0, Nat.zero_lt_succ _⟩ := Fin.eq_zero i + subst i + rw [B.first_edge] at hi + obtain ⟨j, hj⟩ := A.attaches ⟨0, A.positive⟩ + have hj0 : j = ⟨0, Nat.zero_lt_succ _⟩ := Fin.eq_zero j + subst j + rw [A.first_edge] at hj + have hm : B.vertex ⟨1, hB2⟩ ∈ G.ends e0 := by + rw [hi] + simp + rw [hj] at hm + rcases Sym2.mem_iff.mp hm with hm | hm + · refine Finset.mem_image.mpr ⟨⟨1, hA2⟩, Finset.mem_univ _, ?_⟩ + convert hm.symm using 1 + exact congrArg A.vertex (by apply Fin.ext; rfl) + · refine Finset.mem_image.mpr ⟨⟨0, Nat.zero_lt_succ _⟩, Finset.mem_univ _, ?_⟩ + exact hm.symm + +private theorem helper_hedge_452.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (A B : TreeSequence G + e0), ( + ∀ (T : TreeSequence G e0) (i : Fin (T.length + (1 : ℕ))), T.vertex i ∈ TreeSequenceVertexSet + T) → + ∀ (n : ℕ) (hn : n + (1 : ℕ) ≤ B.length) (T : TreeSequence G e0), + let k : Fin B.length := (⟨n, + by + have := GoldbergSeymour.TreeSequence.positive B + have := GoldbergSeymour.TreeSequence.positive B + omega + ⟩ : Fin B.length); + ∀ (i : Fin ((↑k : ℕ) + (1 : ℕ))), G.ends (B.edge k) = s(B.vertex k.succ, B.vertex (i.castLT ( + by + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive B + have := Fin.isLt k + have := Fin.isLt i + have := GoldbergSeymour.TreeSequence.positive B + omega + ))) → (↑i : ℕ) ≤ n → B.vertex k.succ ∉ TreeSequenceVertexSet T → + ∀ (j : Fin T.length), B.edge k ≠ T.edge j := by + classical + intro V E G e0 A B vertex_in_set n hn T k i hi hiBound hnewv j he + obtain ⟨r, hr⟩ := T.attaches j + have hv : B.vertex k.succ ∈ TreeSequenceVertexSet T := by + have hm : B.vertex k.succ ∈ G.ends (T.edge j) := by + rw [← he, hi] + exact (Sym2.mem_iff).2 (Or.inl rfl) + rw [hr] at hm + rcases Sym2.mem_iff.mp hm with hm | hm + · rw [hm] + exact vertex_in_set T j.succ + · rw [hm] + exact vertex_in_set T (Fin.castLT r (by omega)) + exact (hnewv hv).elim + +private theorem helper_branch_695.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ DecidableEq V] {G : LooplessMultigraph V E} {e0 : E} (A B U + : TreeSequence G e0), ( + ∀ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ B.length → B.vertex i ∈ TreeSequenceVertexSet U) + → + ∀ (hlen : A.length ≤ U.length), ( + ∀ (i : Fin (A.length + (1 : ℕ))), U.vertex (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive U + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.TreeSequence.positive U + omega + ) i) = A.vertex i) → ( + ∀ (T : TreeSequence G e0) (x : V), x ∈ TreeSequenceVertexSet T ↔ + ∃ (i : Fin (T.length + (1 : ℕ))), T.vertex i = x) → TreeSequenceVertexSet A ∪ + TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet U := by + classical + intro V E _ G e0 A B U hvertices hlen hv vertex_mem_iff x hx + rcases Finset.mem_union.mp hx with hx | hx + · obtain ⟨i, hi⟩ := (vertex_mem_iff A x).mp hx + apply (vertex_mem_iff U x).mpr + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, (hv i).trans hi⟩ + · obtain ⟨i, hi⟩ := (vertex_mem_iff B x).mp hx + have him := hvertices i (Nat.le_of_lt_succ i.isLt) + rw [hi] at him + exact him + +private noncomputable abbrev helperU414.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + {G : LooplessMultigraph V E} → + {e0 : E} → + (T : TreeSequence G e0) → + (f : E) → + (v : V) → + (i : Fin (T.length + (1 : ℕ))) → + (hi : G.ends f = s(v, T.vertex i)) → + (hv : v ∉ TreeSequenceVertexSet T) → + (hf : ∀ (j : Fin T.length), f ≠ T.edge j) → TreeSequence G e0 := by + classical + intro V E G e0 T f v i hi hv hf + exact { + length := T.length + 1 + positive := by omega + vertex := Fin.lastCases v (fun j => T.vertex j) + edge := Fin.lastCases f (fun j => T.edge j) + vertex_injective := by + intro a b hab + revert b + refine Fin.lastCases ?_ (fun a => ?_) a + · intro b + refine Fin.lastCases ?_ (fun b => ?_) b + · intro h + apply Fin.ext + rfl + · intro h + dsimp only [Fin.lastCases] at h + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at h + have hm : T.vertex b ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet] + exact (hv (h ▸ hm)).elim + · intro b + refine Fin.lastCases ?_ (fun b => ?_) b + · intro h + dsimp only [Fin.lastCases] at h + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_last] at h + have hm : T.vertex a ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet] + exact (hv (h ▸ hm)).elim + · intro h + dsimp only [Fin.lastCases] at h + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_castSucc] at h + exact congrArg Fin.castSucc (T.vertex_injective h) + edge_injective := by + intro a b hab + revert b + refine Fin.lastCases ?_ (fun a => ?_) a + · intro b + refine Fin.lastCases ?_ (fun b => ?_) b + · intro h + rfl + · intro h + dsimp only [Fin.lastCases] at h + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at h + exact (hf b h).elim + · intro b + refine Fin.lastCases ?_ (fun b => ?_) b + · intro h + dsimp only [Fin.lastCases] at h + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_last] at h + exact (hf a h.symm).elim + · intro h + dsimp only [Fin.lastCases] at h + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_castSucc] at h + exact congrArg Fin.castSucc (T.edge_injective h) + first_edge := by + have hz : (⟨0, Nat.succ_pos _⟩ : Fin (T.length + 1)) = + (⟨0, T.positive⟩ : Fin T.length).castSucc := by rfl + rw [hz] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + exact T.first_edge + attaches := by + intro j + by_cases hj : j = Fin.last T.length + · exact @helper_branch_319 (@V) (@E) (@G) (@e0) (@T) (@f) (@v) (@i) (@hi) (@j) (@hj) + · have hlast : (Fin.last T.length).val = T.length := by rfl + have hj' : j.val < T.length := by omega + obtain ⟨q, hq⟩ := T.attaches (j.castPred hj) + have hform : j = (j.castPred hj).castSucc := by + apply Fin.ext + rfl + have hle : (j.castPred hj).val + 1 ≤ j.val + 1 := by + simp + refine ⟨Fin.castLE hle q, ?_⟩ + convert hq using 1 + · apply congrArg G.ends + conv_lhs => rw [hform] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + · apply (Sym2.eq_iff).2 + left + constructor + · have hjs : j.succ = (j.castPred hj).succ.castSucc := by + apply Fin.ext + rfl + rw [hjs] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + · have hq' : q.val < T.length + 1 := by omega + have heq : (Fin.castLE hle q).castLT (by omega) = + (q.castLT hq').castSucc := by + apply Fin.ext + rfl + rw [heq] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] } + +private theorem helper_branch_710.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (A B : TreeSequence G + e0), + let appendStep : (T : TreeSequence G e0) → (f : E) → (v : V) → (i : Fin (T.length + (1 : ℕ))) + → G.ends f = s(v, T.vertex i) → v ∉ TreeSequenceVertexSet T → ( + ∀ (j : Fin T.length), f ≠ T.edge j) → TreeSequence G e0 := fun (T : TreeSequence G e0) (f : E) + (v : V) (i : Fin (T.length + (1 : ℕ))) (hi : G.ends f = s(v, T.vertex i)) (hv : v ∉ + TreeSequenceVertexSet T) (hf : + ∀ (j : Fin T.length), f ≠ T.edge j) ↦ + let U : TreeSequence G e0 := helperU414 T f v i hi hv hf; U; + ∀ (n : ℕ) (hn : n + (1 : ℕ) ≤ B.length) (T : TreeSequence G e0) (_ : + ∀ (i j : Fin B.length), (↑i : ℕ) < n → (↑j : ℕ) < n → B.vertex i.succ ∉ TreeSequenceVertexSet + A → B.vertex j.succ ∉ TreeSequenceVertexSet A → (↑i : ℕ) < (↑j : ℕ) → + ∀ (p q : Fin T.length), T.vertex p.succ = B.vertex i.succ → T.vertex q.succ = B.vertex j.succ + → (↑p : ℕ) < (↑q : ℕ)), + let k : Fin B.length := (⟨n, + by + omega + ⟩ : Fin B.length); + ∀ (i : Fin ((↑k : ℕ) + (1 : ℕ))) (_ : G.ends (B.edge k) = s(B.vertex k.succ, B.vertex + (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ k.isLt))))) (hiBound : (↑i : ℕ) ≤ n), + let iB : Fin (B.length + (1 : ℕ)) := (⟨(↑i : ℕ), + by + omega + ⟩ : Fin (B.length + (1 : ℕ))); + ∀ (q : Fin (T.length + (1 : ℕ))) (_ : T.vertex q = B.vertex iB) (hattach : G.ends (B.edge k) = + s(B.vertex k.succ, T.vertex q)) (hnewv : B.vertex k.succ ∉ TreeSequenceVertexSet T) (hedge + : + ∀ (j : Fin T.length), B.edge k ≠ T.edge j), + let _ : TreeSequence G e0 := appendStep T (B.edge k) (B.vertex k.succ) q hattach hnewv hedge; + ∀ (i j : Fin B.length), (↑i : ℕ) < n + (1 : ℕ) → (↑j : ℕ) < n + (1 : ℕ) → B.vertex i.succ ∉ + TreeSequenceVertexSet A → B.vertex j.succ ∉ TreeSequenceVertexSet A → (↑i : ℕ) < (↑j : ℕ) + → + ∀ (p q_1 : Fin (helperU414 T (B.edge k) (B.vertex k.succ) q hattach hnewv hedge).length), + (helperU414 T (B.edge k) (B.vertex k.succ) q hattach hnewv hedge).vertex p.succ = B.vertex + i.succ → (helperU414 T (B.edge k) (B.vertex k.succ) q hattach hnewv hedge).vertex q_1.succ + = B.vertex j.succ → (↑p : ℕ) < (↑q_1 : ℕ) := by + classical + intro V E G e0 A B appendStep n hn T hord k i hi hiBound iB q hq hattach hnewv hedge S i j hi + hj hoi hoj hlt p q hp hq + by_cases hpi : p.val < T.length + · by_cases hqj : q.val < T.length + · let pT : Fin T.length := ⟨p.val, hpi⟩ + let qT : Fin T.length := ⟨q.val, hqj⟩ + have pp : p = pT.castSucc := by apply Fin.ext; rfl + have qq : q = qT.castSucc := by apply Fin.ext; rfl + rw [pp] at hp + rw [qq] at hq + have hps : pT.castSucc.succ = pT.succ.castSucc := by + apply Fin.ext + rfl + have hqs : qT.castSucc.succ = qT.succ.castSucc := by + apply Fin.ext + rfl + rw [hps] at hp + rw [hqs] at hq + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] at hp hq + rw [pp, qq] + have hiold : i.val < n := by + by_contra hn' + have hik : i = k := by apply Fin.ext; omega + subst i + apply hnewv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨pT.succ, hp⟩ + have hjold : j.val < n := by + by_contra hn' + have hjk : j = k := by + apply Fin.ext + have hjbound : j.val ≤ n := by omega + have hjlow : n ≤ j.val := by omega + exact Nat.le_antisymm hjbound hjlow + subst j + apply hnewv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨qT.succ, hq⟩ + exact hord i j hiold hjold hoi hoj hlt pT qT hp hq + · have qq : q = Fin.last T.length := by + apply Fin.ext + simp only [Fin.last] + have hqbound : q.val < T.length + 1 := by simp + omega + rw [qq] at hq + simp only [Fin.lastCases] at hq + rw [qq] + omega + · have pp : p = Fin.last T.length := by + apply Fin.ext + simp only [Fin.last] + have hpbound : p.val < T.length + 1 := by simp + omega + rw [pp] at hp + simp only [Fin.lastCases] at hp + by_cases hqj : q.val < T.length + · rw [pp] + have hqbound : q.val < T.length := hqj + have hpval : (Fin.last T.length).val = T.length := rfl + have hpi' : B.vertex k.succ = B.vertex i.succ := by + simpa [S, appendStep] using hp + have hik : k.succ = i.succ := B.vertex_injective hpi' + have hikval : k.val = i.val := + Nat.succ.inj (congrArg Fin.val hik) + have hkn : k.val = n := rfl + exfalso + omega + · have qq : q = Fin.last T.length := by + apply Fin.ext + simp only [Fin.last] + have hqbound : q.val < T.length + 1 := by simp + omega + rw [qq] at hq + simp only [Fin.lastCases] at hq + have hp' : B.vertex k.succ = B.vertex i.succ := by + simpa [S, appendStep] using hp + have hq' : B.vertex k.succ = B.vertex j.succ := by + simpa [S, appendStep] using hq + have hki : k.succ = i.succ := by + apply B.vertex_injective + exact hp' + have hkj : k.succ = j.succ := by + apply B.vertex_injective + exact hq' + have hij : i = j := by + apply Fin.ext + exact Nat.succ.inj (congrArg Fin.val (hki.symm.trans hkj)) + omega + +private abbrev helperBranch718Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (A B : TreeSequence G + e0), + let _ : DecidableEq V := Classical.decEq V; + let _ : (T : TreeSequence G e0) → (f : E) → (v : V) → (i : Fin (T.length + (1 : ℕ))) → G.ends + f = s(v, T.vertex i) → v ∉ TreeSequenceVertexSet T → ( + ∀ (j : Fin T.length), f ≠ T.edge j) → TreeSequence G e0 := fun (T : TreeSequence G e0) (f : E) + (v : V) (i : Fin (T.length + (1 : ℕ))) (hi : G.ends f = s(v, T.vertex i)) (hv : v ∉ + TreeSequenceVertexSet T) (hf : + ∀ (j : Fin T.length), f ≠ T.edge j) ↦ + let U : TreeSequence G e0 := helperU414 T f v i hi hv hf; U; + ∀ (_ : + ∀ (T : TreeSequence G e0) (i : Fin (T.length + (1 : ℕ))), T.vertex i ∈ TreeSequenceVertexSet + T), + let Good : ℕ → TreeSequence G e0 → Prop := fun (n : ℕ) (T : TreeSequence G e0) ↦ + TreeSequenceInitialSegment A T ∧ ( + ∀ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ n → B.vertex i ∈ TreeSequenceVertexSet T) ∧ + TreeSequenceVertexSet T ⊆ TreeSequenceVertexSet A ∪ TreeSequenceVertexSet B ∧ ( + ∀ (j : Fin T.length), A.length ≤ (↑j : ℕ) → + ∃ (i : Fin B.length), (↑i : ℕ) < n ∧ T.edge j = B.edge i ∧ T.vertex j.succ = B.vertex i.succ) + ∧ ( + ∀ (i : Fin B.length), (↑i : ℕ) < n → B.vertex i.succ ∉ TreeSequenceVertexSet A → + ∃ (j : Fin T.length), A.length ≤ (↑j : ℕ) ∧ T.edge j = B.edge i ∧ T.vertex j.succ = B.vertex + i.succ) ∧ + ∀ (i j : Fin B.length), (↑i : ℕ) < n → (↑j : ℕ) < n → B.vertex i.succ ∉ TreeSequenceVertexSet + A → B.vertex j.succ ∉ TreeSequenceVertexSet A → (↑i : ℕ) < (↑j : ℕ) → + ∀ (p q : Fin T.length), T.vertex p.succ = B.vertex i.succ → T.vertex q.succ = B.vertex j.succ + → (↑p : ℕ) < (↑q : ℕ); + ∀ (n : ℕ) (hn : n + (1 : ℕ) ≤ B.length) (T : TreeSequence G e0) (_ : Good n T) (_ : B.vertex + (⟨n + (1 : ℕ), Nat.lt_succ_of_le hn⟩ : Fin (B.length + (1 : ℕ))) ∉ TreeSequenceVertexSet + A), + ∃ (T : TreeSequence G e0), Good (n + (1 : ℕ)) T + +private theorem helper_branch_718.{u_1, u_2} : + helperBranch718Conditions.{u_1, u_2} := by + classical + intro V E G e0 A B this appendStep vertex_in_set Good n hn T hT hout + rcases hT with ⟨hseg, hall, hsub, hnew, hcov, hord⟩ + let k : Fin B.length := ⟨n, by omega⟩ + obtain ⟨i, hi⟩ := B.attaches k + have hiBound : (i : ℕ) ≤ n := by + have hiSmall := Nat.le_of_lt_succ i.isLt + simpa [k] using hiSmall + let iB : Fin (B.length + 1) := ⟨i.val, by omega⟩ + have hiAll : B.vertex iB ∈ TreeSequenceVertexSet T := by + apply hall iB + exact hiBound + have iBForm : iB = i.castLT (by omega) := by + apply Fin.ext + rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hiAll + obtain ⟨q, hq⟩ := hiAll + have hattach : G.ends (B.edge k) = + s(B.vertex k.succ, T.vertex q) := by + rw [hi, ← iBForm, hq] + have hnewv := @helper_hnewv_297 (@V) (@E) (@G) (@e0) (@A) (@B) (@n) (@hn) (@T) (@hout) (@hseg) + (@hnew) (@i) (@hiBound) + have hedge := @helper_hedge_452 (@V) (@E) (@G) (@e0) (@A) (@B) (@vertex_in_set) (@n) (@hn) (@T) + (@i) (@hi) (@hiBound) (@hnewv) + let S := appendStep T (B.edge k) (B.vertex k.succ) q hattach hnewv hedge + have oldVertex : ∀ r : Fin (T.length + 1), + S.vertex r.castSucc = T.vertex r := by + intro r + simp [S, appendStep] + have oldEdge : ∀ r : Fin T.length, + S.edge r.castSucc = T.edge r := by + intro r + simp [S, appendStep] + have newVertex : S.vertex (Fin.last (T.length + 1)) = B.vertex k.succ := by + simp [S, appendStep] + have newEdge : S.edge (Fin.last T.length) = B.edge k := by + simp [S, appendStep] + refine ⟨S, ?_⟩ + dsimp [S, appendStep] + rcases hseg with ⟨hlenT, hvT, heT⟩ + constructor + · have hlen' : A.length ≤ T.length + 1 := by omega + refine ⟨by omega, ?_, ?_⟩ + · intro i + have hi : (Fin.castLE (Nat.succ_le_succ (by omega : A.length ≤ T.length + 1)) i) = + (Fin.castLE (Nat.succ_le_succ hlenT) i).castSucc := by + apply Fin.ext + rfl + rw [hi] + exact oldVertex _ |>.trans (hvT i) + · intro i + have hi : (Fin.castLE (by omega : A.length ≤ T.length + 1) i) = + (Fin.castLE hlenT i).castSucc := by + apply Fin.ext + rfl + rw [hi] + exact oldEdge _ |>.trans (heT i) + constructor + · intro i hi + by_cases hold : i.val ≤ n + · have hm := hall i hold + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hm + obtain ⟨q, hq⟩ := hm + apply Finset.mem_image.mpr + refine ⟨⟨q.val, Nat.lt_succ_of_lt q.isLt⟩, Finset.mem_univ _, ?_⟩ + have hqi : (⟨q.val, by omega⟩ : Fin (T.length + 2)) = q.castSucc := by + apply Fin.ext + rfl + rw [hqi] + exact (oldVertex q).trans hq + · have hi' : i = ⟨n + 1, by omega⟩ := by + apply Fin.ext + have hle : i.val ≤ n + 1 := hi + have hgt : n < i.val := Nat.lt_of_not_ge hold + exact Nat.le_antisymm hle ((Nat.succ_le_iff).2 hgt) + rw [hi'] + apply Finset.mem_image.mpr + refine ⟨⟨T.length + 1, Nat.lt_succ_self _⟩, Finset.mem_univ _, ?_⟩ + have hi : (⟨T.length + 1, by omega⟩ : Fin (T.length + 2)) = + Fin.last (T.length + 1) := by apply Fin.ext; rfl + rw [hi] + exact newVertex + constructor + · intro x hx + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hx + obtain ⟨i, hi⟩ := hx + by_cases hlt : i.val ≤ T.length + · have hi' : (⟨i.val, by omega⟩ : Fin (T.length + 1)).castSucc = i := by + apply Fin.ext + rfl + apply hsub + let r : Fin (T.length + 1) := ⟨i.val, by omega⟩ + have hir : r.castSucc = i := by apply Fin.ext; rfl + exact Finset.mem_image.mpr ⟨r, Finset.mem_univ _, by + have hix := hi + rw [← hir] at hix + exact (oldVertex r).symm.trans hix⟩ + · have hi' : i = Fin.last (T.length + 1) := by + apply Fin.ext + simp only [Fin.last] + omega + rw [hi'] at hi + apply Finset.mem_union_right _ + exact Finset.mem_image.mpr ⟨k.succ, Finset.mem_univ _, by + simpa [newVertex] using hi⟩ + constructor + · intro j hj + by_cases hlt : j.val < T.length + · let jT : Fin T.length := ⟨j.val, hlt⟩ + have hj' : j = jT.castSucc := by apply Fin.ext; rfl + rw [hj'] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + obtain ⟨i, hi, he, hv⟩ := hnew jT (by omega) + have hjs : jT.castSucc.succ = jT.succ.castSucc := by + apply Fin.ext + rfl + rw [hjs] + simp only [Fin.reverseInduction_castSucc] + exact ⟨i, by omega, he, hv⟩ + · have hj' : j = Fin.last T.length := by + apply Fin.ext + simp only [Fin.last] + have hjlt : j.val < T.length + 1 := by simp + omega + rw [hj'] + exact ⟨k, Nat.lt_succ_self _, newEdge, newVertex⟩ + constructor + · intro i hi ho + by_cases hlt : i.val < n + · obtain ⟨j, hj, he, hv⟩ := hcov i hlt ho + refine ⟨j.castSucc, (by simpa using hj), ?_, ?_⟩ + · simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + exact he + · have hjs : j.castSucc.succ = j.succ.castSucc := by + apply Fin.ext + rfl + rw [hjs] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + exact hv + · have hi' : i.val = n := by + have hle : i.val ≤ n := by omega + have hgt : n ≤ i.val := by omega + exact Nat.le_antisymm hle hgt + have hi'' : i = k := by apply Fin.ext; exact hi' + subst i + exact ⟨Fin.last T.length, (by simpa using hlenT), newEdge, newVertex⟩ + · exact @helper_branch_710 (@V) (@E) (@G) (@e0) (@A) (@B) (@n) (@hn) (@T) (@hord) (@i) (@hi) + (@hiBound) (@q) (@hq) (@hattach) (@hnewv) (@hedge) + +theorem OrderedTreeUnionExists + {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + {G : LooplessMultigraph V E} {e0 : E} + (A B : TreeSequence G e0) : + exists U : TreeSequence G e0, Nonempty (OrderedTreeUnion A B U) := by + classical + let originalDecidable : DecidableEq V := inferInstance + let : DecidableEq V := Classical.decEq V + let appendStep : + ∀ (T : TreeSequence G e0) (f : E) (v : V) (i : Fin (T.length + 1)), G.ends f = s(v, T.vertex + i) → v ∉ TreeSequenceVertexSet T → ( + ∀ j : Fin T.length, f ≠ T.edge j) → TreeSequence G e0 := by + intro T f v i hi hv hf + let U := @helperU414 (@V) (@E) (@G) (@e0) (@T) (@f) (@v) (@i) (@hi) (@hv) (@hf) + exact U + have vertex_in_set : ∀ (T : TreeSequence G e0) (i : Fin (T.length + 1)), + T.vertex i ∈ TreeSequenceVertexSet T := by + intro T i + simp [TreeSequenceVertexSet] + have hA2 : 1 < A.length + 1 := by + exact Nat.lt_of_lt_of_le (Nat.lt_succ_self 1) (Nat.succ_le_succ A.positive) + have hB2 : 1 < B.length + 1 := by + exact Nat.lt_of_lt_of_le (Nat.lt_succ_self 1) (Nat.succ_le_succ B.positive) + have first_in_left := @helper_first_in_left_366 (@V) (@E) (@G) (@e0) (@A) (@B) (@hA2) + have first_next_in_left := @helper_first_next_in_left_386 (@V) (@E) (@G) (@e0) (@A) (@B) (@hA2) + (@hB2) + let Good : ℕ → TreeSequence G e0 → Prop := fun n T => + TreeSequenceInitialSegment A T ∧ + (∀ i : Fin (B.length + 1), i.val ≤ n → B.vertex i ∈ TreeSequenceVertexSet T) ∧ + TreeSequenceVertexSet T ⊆ TreeSequenceVertexSet A ∪ TreeSequenceVertexSet B ∧ + (∀ j : Fin T.length, A.length ≤ j.val → + ∃ i : Fin B.length, i.val < n ∧ + T.edge j = B.edge i ∧ T.vertex j.succ = B.vertex i.succ) ∧ + (∀ i : Fin B.length, i.val < n → B.vertex i.succ ∉ TreeSequenceVertexSet A → + ∃ j : Fin T.length, A.length ≤ j.val ∧ + T.edge j = B.edge i ∧ T.vertex j.succ = B.vertex i.succ) ∧ + (∀ i j : Fin B.length, i.val < n → j.val < n → + B.vertex i.succ ∉ TreeSequenceVertexSet A → + B.vertex j.succ ∉ TreeSequenceVertexSet A → i.val < j.val → + ∀ p q : Fin T.length, T.vertex p.succ = B.vertex i.succ → + T.vertex q.succ = B.vertex j.succ → p.val < q.val) + have process : ∀ n : ℕ, n ≤ B.length → ∃ T : TreeSequence G e0, Good n T := by + intro n + induction n with + | zero => exact @helper_branch_351 (@V) (@E) (@G) (@e0) (@A) (@B) (@hB2) (@first_in_left) + | succ n ih => + intro hn + obtain ⟨T, hT⟩ := ih (by omega) + by_cases hout : B.vertex ⟨n + 1, Nat.lt_succ_of_le hn⟩ ∈ TreeSequenceVertexSet A + · exact @helper_branch_230 (@V) (@E) (@G) (@e0) (@A) (@B) (@n) (@hn) (@T) (@hT) (@hout) + · exact @helper_branch_718 (@V) (@E) (@G) (@e0) (@A) (@B) (@vertex_in_set) (@n) (@hn) + (@T) (@hT) (@hout) + obtain ⟨U, hU⟩ := process B.length (le_rfl) + let : DecidableEq V := originalDecidable + refine ⟨U, ⟨?_⟩⟩ + rcases hU with ⟨hleft, hvertices, hsub, hnewentries, hcoverage, horder⟩ + rcases hleft with ⟨hlen, hv, he⟩ + have vertex_mem_iff : ∀ (T : TreeSequence G e0) (x : V), + x ∈ TreeSequenceVertexSet T ↔ ∃ i : Fin (T.length + 1), T.vertex i = x := by + intro T x + simp [TreeSequenceVertexSet] + exact + { leftSegment := ⟨hlen, hv, he⟩ + vertexSet := by + apply Finset.Subset.antisymm + · intro x hx + have hx' := hsub hx + simpa only [Finset.mem_union] using hx' + · exact @helper_branch_695 (@V) (@E) inferInstance (@G) (@e0) (@A) (@B) (@U) (@hvertices) + (@hlen) (@hv) (@vertex_mem_iff) + newEntryFromRight := by + intro j hj + obtain ⟨i, _, he', hv'⟩ := hnewentries j hj + exact ⟨i, he', hv'⟩ + everyNewRightEntry := by + intro i hi + obtain ⟨j, hj, he, hv⟩ := hcoverage i (by omega) hi + exact ⟨j, hj, he, hv⟩ + rightOrder := by + intro i j hi hj hlt + exact horder i j (by omega) (by omega) hi hj hlt } + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OutsideExitTransport.lean b/LeanPool/GoldbergSeymour/OutsideExitTransport.lean new file mode 100644 index 0000000000..e098374a5b --- /dev/null +++ b/LeanPool/GoldbergSeymour/OutsideExitTransport.lean @@ -0,0 +1,436 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeExitPath + +public import Mathlib.Combinatorics.SimpleGraph.Paths + +/-! +# P2716_T1_Outside Exit Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem P2716_T1_OutsideExitTransport_alphaOutside_256.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : + ℕ} {e0 : E} (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha theta beta : + Fin k), let X := TreeSequenceVertexSet T; (∀ {f : E} {u v : V}, phi f = some alpha ∨ phi f + = some theta → Incident G u f → Incident G v f → (u ∈ X ↔ v ∈ X)) → ∀ (a b : V) (P : + (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a) (Sum.inl b)), P.IsPath → (∀ w ∈ + TreeSequenceVertexSet T, Sum.inl w ∈ P.support ↔ w = b) → ∀ {f : E}, Sum.inr f ∈ P.support + → phi f = some alpha → ¬TreeIncidentEdge T f := by + classical + intro V E _ _ G k e0 T phi alpha theta beta X sameSide a b P path only + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + as_aux_lemma => + intro f hf hfa hi + obtain ⟨j, hj, hjle⟩ := P.mem_support_iff_exists_getVert.mp hf + have hj0 : 0 < j := by + by_contra hn + have hz : j = 0 := by omega + simp [hz] at hj + have hjlt : j < P.length := by + by_contra hn + have hz : j = P.length := by omega + simp [hz] at hj + obtain ⟨u, hu, huf⟩ := hi + have leftAdj := P.adj_getVert_succ (show j - 1 < P.length by omega) + rw [show j - 1 + 1 = j by omega, hj] at leftAdj + have rightAdj := P.adj_getVert_succ hjlt + rw [hj] at rightAdj + have left : ∃ v : V, P.getVert (j - 1) = Sum.inl v ∧ v ∈ X := by + cases hx : P.getVert (j - 1) with + | inr e => rw [hx] at leftAdj; exact leftAdj.elim + | inl v => + rw [hx] at leftAdj + exact ⟨v, rfl, (sameSide (Or.inl hfa) huf leftAdj.1).mp hu⟩ + have right : ∃ v : V, P.getVert (j + 1) = Sum.inl v ∧ v ∈ X := by + cases hx : P.getVert (j + 1) with + | inr e => rw [hx] at rightAdj; exact rightAdj.elim + | inl v => + rw [hx] at rightAdj + exact ⟨v, rfl, (sameSide (Or.inl hfa) huf rightAdj.1).mp hu⟩ + obtain ⟨v, hv, hvX⟩ := left + obtain ⟨w, hw, hwX⟩ := right + have hvb : v = b := (only v hvX).mp (hv ▸ P.getVert_mem_support _) + have hwb : w = b := (only w hwX).mp (hw ▸ P.getVert_mem_support _) + have hidx := path.getVert_injOn (show j - 1 ≤ P.length by omega) + (show j + 1 ≤ P.length by omega) (by rw [hv, hw, hvb, hwb]) + omega + +private theorem P2716_T1_OutsideExitTransport_sideAdj_144.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha theta : Fin k), + let X := TreeSequenceVertexSet T; + (∀ {f : E} {u v : V}, phi f = some alpha ∨ phi f = some theta → Incident G u f → Incident G + v f → (u ∈ X ↔ v ∈ X)) → + let side := fun (z : V ⊕ E) => + match z with + | Sum.inl v => v ∈ X + | Sum.inr f => TreeIncidentEdge T f; + ∀ {x y : V ⊕ E}, (TwoColorIncidenceGraph G phi alpha theta).Adj x y → (side x ↔ side y) + := by + classical + intro V E _ _ G k e0 T phi alpha theta X sameSide side + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + as_aux_lemma => + intro x y h + cases x with + | inl v => + cases y with + | inl w => exact h.elim + | inr f => + change Incident G v f ∧ (phi f = some alpha ∨ phi f = some theta) at h + change v ∈ X ↔ TreeIncidentEdge T f + refine ⟨fun hv => ⟨v, hv, h.1⟩, ?_⟩ + rintro ⟨u, hu, huf⟩ + exact (sameSide h.2 huf h.1).mp hu + | inr f => + cases y with + | inr g => exact h.elim + | inl v => + change Incident G v f ∧ (phi f = some alpha ∨ phi f = some theta) at h + change TreeIncidentEdge T f ↔ v ∈ X + refine ⟨?_, fun hv => ⟨v, hv, h.1⟩⟩ + rintro ⟨u, hu, huf⟩ + exact (sameSide h.2 huf h.1).mp hu + +private theorem P2716_T1_OutsideExitTransport_recolor_206.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Finite E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (alpha theta : Fin k), + alpha ≠ theta → + let X := TreeSequenceVertexSet T; + let roots := Finset.image Sum.inl {v : V | v ∉ X}; + (∀ z ∈ roots, ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phi alpha theta z → v ∉ X) → + let sigma := OutsideTreeColorSwap T phi alpha theta; + (∀ {f : E}, + ¬TreeIncidentEdge T f → + phi f = some alpha ∨ phi f = some theta → ∃ z ∈ roots, Sum.inr f ∈ + TwoColorComponent G phi alpha theta z) → + OutsideKempeRecoloring T phi sigma alpha theta := by + classical + intro V E _ _ _ _ G k e0 T phi alpha theta hat X roots outsideComponents sigma selected + let _ := Fintype.ofFinite E + as_aux_lemma => + refine ⟨hat, roots, outsideComponents, ?_⟩ + intro f + by_cases hf : TreeIncidentEdge T f + · have fix : sigma f = phi f := by simp [sigma, OutsideTreeColorSwap, hf] + rw [fix] + by_cases hc : phi f = some alpha ∨ phi f = some theta + · have hn : ¬ ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha theta z := by + rintro ⟨z, hz, hzf⟩ + obtain ⟨v, hv, hvf⟩ := hf + have heq := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha theta).Adj + (Sum.inl v) (Sum.inr f) from ⟨hvf, hc⟩) + have hvz : Sum.inl v ∈ TwoColorComponent G phi alpha theta z := + heq.trans ((SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mp hzf) + exact outsideComponents z hz v hvz hv + simp [hn] + · push Not at hc + simp [hc.1, hc.2] + · by_cases ha : phi f = some alpha + · simp [sigma, OutsideTreeColorSwap, hf, ha, selected hf (Or.inl ha)] + · by_cases ht : phi f = some theta + · simp [sigma, OutsideTreeColorSwap, hf, ht, selected hf (Or.inr ht)] + · simp [sigma, OutsideTreeColorSwap, hf, ha, ht] + +private theorem P2716_T1_OutsideExitTransport_subsetData_233.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : + ℕ} {e0 : E} (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha theta : Fin k), + let X := TreeSequenceVertexSet T; let sigma := OutsideTreeColorSwap T phi alpha theta; + StableColoring T ∅ phi sigma → (∀ (f : E), TreeIncidentEdge T f → sigma f = phi f) → ∀ (U + : TreeSequence G e0), TreeSequenceVertexSet U ⊆ X → (∀ (C : Finset (Fin k)), + StableColoring U C phi sigma) ∧ TreeMissingColors sigma U = TreeMissingColors phi U ∧ ∀ (c + : Fin k), TreeColorSetClosed G phi U {c} → TreeColorSetClosed G sigma U {c} := by + classical + intro V E _ _ G k e0 T phi alpha theta X sigma stable fixed + as_aux_lemma => + intro U hU + have inc : ∀ f, TreeIncidentEdge U f → TreeIncidentEdge T f := by + rintro f ⟨v, hv, hvf⟩ + exact ⟨v, hU hv, hvf⟩ + refine ⟨fun C => ⟨fun f hf _ => fixed f (inc f hf), + fun v hv => stable.2 v (hU hv)⟩, ?_, ?_⟩ + · exact Finset.biUnion_congr rfl (fun v hv => stable.2 v (hU hv)) + · intro c hc d hd + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + change f ∈ (BoundaryEdges G (TreeSequenceVertexSet U)).filter + (fun f => sigma f = some d) at hf + obtain ⟨hb, hcolor⟩ := Finset.mem_filter.mp hf + have hbData := hb + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hbData + obtain ⟨u, hu, v, hv, he⟩ := hbData + have hi : TreeIncidentEdge U f := by + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [he] + exact Sym2.mem_mk_left _ _ + have old : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet U) d := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hb, (fixed f (inc f hi)).symm.trans hcolor⟩ + rw [hc d hd] at old + exact Finset.notMem_empty _ old + +private theorem P2716_T1_OutsideExitTransport_outsideMissing_274.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha theta beta : Fin k), + alpha ≠ theta → + let X := TreeSequenceVertexSet T; + (∀ {f : E} {u v : V}, phi f = some alpha ∨ phi f = some theta → Incident G u f → Incident + G v f → (u ∈ X ↔ v ∈ X)) → + let sigma := OutsideTreeColorSwap T phi alpha theta; + (∀ (f : E), TreeIncidentEdge T f → sigma f = phi f) → + (∀ (f : E), sigma f = some beta ↔ phi f = some beta) → + ∀ a ∉ X, + (alpha ∈ MissingColors G phi a → theta ∈ MissingColors G sigma a) ∧ + (beta ∈ MissingColors G phi a → beta ∈ MissingColors G sigma a) := by + classical + intro V E _ _ G k e0 T phi alpha theta beta hat X sameSide sigma fixed betaEq + let _ := Fintype.ofFinite V + as_aux_lemma => + intro a ha + have missing : ∀ (psi : PartialEdgeColoring E k) (c : Fin k), + c ∈ MissingColors G psi a ↔ ∀ f, Incident G a f → psi f ≠ some c := by + simp [MissingColors, PresentColors] + constructor + · intro hm + rw [missing] at hm ⊢ + intro f haf hsf + by_cases hi : TreeIncidentEdge T f + · have hpf : phi f = some theta := (fixed f hi).symm.trans hsf + obtain ⟨v, hv, hvf⟩ := hi + exact ha ((sameSide (Or.inr hpf) hvf haf).mp hv) + · have hpf : phi f = some alpha := by + by_cases hfa : phi f = some alpha + · exact hfa + · by_cases hft : phi f = some theta + · simp [sigma, OutsideTreeColorSwap, hi, hft, hat, hat.symm] at hsf + · simp [sigma, OutsideTreeColorSwap, hi, hfa, hft] at hsf + exact hm f haf hpf + · intro hm + rw [missing] at hm ⊢ + intro f haf hs + exact hm f haf ((betaEq f).mp hs) + +private theorem P2716_T1_OutsideExitTransport_transferEdges_307.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : + ℕ} {e0 : E} (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha theta beta : + Fin k), let sigma := OutsideTreeColorSwap T phi alpha theta; (∀ (f : E), sigma f = some + beta ↔ phi f = some beta) → ∀ (a b : V) (P : (TwoColorIncidenceGraph G phi alpha + beta).Walk (Sum.inl a) (Sum.inl b)), (∀ {f : E}, Sum.inr f ∈ P.support → phi f = some + alpha → ¬TreeIncidentEdge T f) → ∀ e ∈ P.edges, e ∈ (TwoColorIncidenceGraph G sigma theta + beta).edgeSet := by + classical + intro V E _ _ G k e0 T phi alpha theta beta sigma betaEq a b P alphaOutside + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + as_aux_lemma => + intro e he + induction e using Sym2.inductionOn with + | _ x y => + have adj := P.adj_of_mem_edges he + have convert : ∀ {v : V} {f : E}, + Incident G v f → (phi f = some alpha ∨ phi f = some beta) → + Sum.inr f ∈ P.support → + Incident G v f ∧ (sigma f = some theta ∨ sigma f = some beta) := by + intro v f hv hc hf + refine ⟨hv, ?_⟩ + rcases hc with hc | hc + · left + simp [sigma, OutsideTreeColorSwap, alphaOutside hf hc, hc] + · exact Or.inr ((betaEq f).mpr hc) + cases x with + | inl v => + cases y with + | inl w => exact adj.elim + | inr f => exact convert adj.1 adj.2 (P.snd_mem_support_of_mem_edges he) + | inr f => + cases y with + | inr g => exact adj.elim + | inl v => exact convert adj.1 adj.2 (P.fst_mem_support_of_mem_edges he) + +theorem P2716_T1_OutsideExitTransport {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (alpha theta beta : Fin k) (hat : alpha ≠ theta) + (hab : alpha ≠ beta) (htb : theta ≠ beta) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (haClosed : TreeColorSetClosed G phi T {alpha}) + (htClosed : TreeColorSetClosed G phi T {theta}) : + ∃ sigma : PartialEdgeColoring E k, + OutsideKempeRecoloring T phi sigma alpha theta ∧ + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ + (∀ U : TreeSequence G e0, + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet T → + (∀ C : Finset (Fin k), StableColoring U C phi sigma) ∧ + TreeMissingColors sigma U = TreeMissingColors phi U ∧ + (∀ c : Fin k, TreeColorSetClosed G phi U {c} → + TreeColorSetClosed G sigma U {c})) ∧ + (∀ a : V, a ∉ TreeSequenceVertexSet T → + (alpha ∈ MissingColors G phi a → theta ∈ MissingColors G sigma a) ∧ + (beta ∈ MissingColors G phi a → beta ∈ MissingColors G sigma a)) ∧ + (∀ (A : TreeSequence G e0), + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → + ∀ (a b : V) + (P : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a) (Sum.inl b)), + TreeExitPath T phi alpha beta a b P → + b ∈ TreeSequenceVertexSet A → + ∃ Q : (TwoColorIncidenceGraph G sigma theta beta).Walk + (Sum.inl a) (Sum.inl b), + TreeExitPath A sigma theta beta a b Q ∧ + Q.support = P.support ∧ Q.length = P.length) := by + classical + let X := TreeSequenceVertexSet T + have boundaryColor : ∀ {f : E}, f ∈ BoundaryEdges G X → + phi f ≠ some alpha ∧ phi f ≠ some theta := by + as_aux_lemma => + intro f hf + constructor + · intro hc + have hm : f ∈ BoundaryColorEdges G phi X alpha := by + simp [BoundaryColorEdges, hf, hc] + rw [haClosed alpha (Finset.mem_singleton_self _)] at hm + exact Finset.notMem_empty _ hm + · intro hc + have hm : f ∈ BoundaryColorEdges G phi X theta := by + simp [BoundaryColorEdges, hf, hc] + rw [htClosed theta (Finset.mem_singleton_self _)] at hm + exact Finset.notMem_empty _ hm + have sameSide : ∀ {f : E} {u v : V}, + (phi f = some alpha ∨ phi f = some theta) → + Incident G u f → Incident G v f → (u ∈ X ↔ v ∈ X) := by + as_aux_lemma => + intro f u v hc hu hv + have forward : ∀ {u v : V}, Incident G u f → Incident G v f → + u ∈ X → v ∈ X := by + intro u v hu hv hux + by_contra hvx + have huv : u ≠ v := by rintro rfl; exact hvx hux + have hf : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, hux, v, hvx, (Sym2.mem_and_mem_iff huv).mp ⟨hu, hv⟩⟩ + rcases hc with hc | hc + · exact (boundaryColor hf).1 hc + · exact (boundaryColor hf).2 hc + exact ⟨forward hu hv, forward hv hu⟩ + let side : Sum V E → Prop := fun z => match z with + | Sum.inl v => v ∈ X + | Sum.inr f => TreeIncidentEdge T f + have sideAdj : ∀ {x y : Sum V E}, + (TwoColorIncidenceGraph G phi alpha theta).Adj x y → + (side x ↔ side y) := by + exact @P2716_T1_OutsideExitTransport_sideAdj_144 V E inferInstance inferInstance G k e0 T phi + alpha theta sameSide + have sideWalk : ∀ {x y : Sum V E} + (p : (TwoColorIncidenceGraph G phi alpha theta).Walk x y), + side x ↔ side y := by + as_aux_lemma => + intro x y p + induction p with + | nil => rfl + | cons h p ih => exact (sideAdj h).trans ih + let roots : Finset (Sum V E) := (Finset.univ.filter fun v : V => v ∉ X).image Sum.inl + have outsideComponents : ∀ z ∈ roots, ∀ v : V, + Sum.inl v ∈ TwoColorComponent G phi alpha theta z → v ∉ X := by + as_aux_lemma => + intro z hz v hv + obtain ⟨a, ha, rfl⟩ := Finset.mem_image.mp hz + have haout : a ∉ X := (Finset.mem_filter.mp ha).2 + have reach : (TwoColorIncidenceGraph G phi alpha theta).Reachable + (Sum.inl v) (Sum.inl a) := by + exact SimpleGraph.ConnectedComponent.eq.mp + ((SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mp hv) + obtain ⟨p⟩ := reach + exact fun hvx => haout ((sideWalk p).mp hvx) + let sigma := OutsideTreeColorSwap T phi alpha theta + have selected : ∀ {f : E}, ¬ TreeIncidentEdge T f → + (phi f = some alpha ∨ phi f = some theta) → + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha theta z := by + as_aux_lemma => + intro f hf hc + obtain ⟨u, v, huv⟩ : ∃ u v, G.ends f = s(u, v) := by + exact Sym2.inductionOn (G.ends f) (fun u v => ⟨u, v, rfl⟩) + have hu : Incident G u f := by + change u ∈ G.ends f + rw [huv] + exact Sym2.mem_mk_left _ _ + have huout : u ∉ X := fun hx => hf ⟨u, hx, hu⟩ + refine ⟨Sum.inl u, Finset.mem_image.mpr ⟨u, by simp [huout], rfl⟩, ?_⟩ + exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha theta).Adj + (Sum.inr f) (Sum.inl u) from ⟨hu, hc⟩) + have recolor : OutsideKempeRecoloring T phi sigma alpha theta := by + exact @P2716_T1_OutsideExitTransport_recolor_206 V E inferInstance inferInstance + inferInstance inferInstance G k e0 T phi alpha theta hat outsideComponents selected + obtain ⟨proper, one, stable, invariant, fixed⟩ := + OutsideKempeRecoloringStable G e0 T ∅ phi sigma alpha theta hproper hone recolor + have subsetData : ∀ U : TreeSequence G e0, + TreeSequenceVertexSet U ⊆ X → + (∀ C : Finset (Fin k), StableColoring U C phi sigma) ∧ + TreeMissingColors sigma U = TreeMissingColors phi U ∧ + (∀ c : Fin k, TreeColorSetClosed G phi U {c} → + TreeColorSetClosed G sigma U {c}) := by + exact @P2716_T1_OutsideExitTransport_subsetData_233 V E inferInstance inferInstance G k e0 T + phi alpha theta stable fixed + have betaEq : ∀ f : E, sigma f = some beta ↔ phi f = some beta := by + as_aux_lemma => + intro f + by_cases hi : TreeIncidentEdge T f + · simp [sigma, OutsideTreeColorSwap, hi] + · by_cases ha : phi f = some alpha <;> by_cases ht : phi f = some theta <;> + simp [sigma, OutsideTreeColorSwap, hi, ha, ht, hat.symm, hab, htb] + have outsideMissing : ∀ a : V, a ∉ X → + (alpha ∈ MissingColors G phi a → theta ∈ MissingColors G sigma a) ∧ + (beta ∈ MissingColors G phi a → beta ∈ MissingColors G sigma a) := by + exact @P2716_T1_OutsideExitTransport_outsideMissing_274 V E inferInstance inferInstance G k + e0 T phi alpha theta beta hat sameSide fixed betaEq + refine ⟨sigma, recolor, proper, one, subsetData, outsideMissing, ?_⟩ + intro A hA a b P hP hbA + rcases hP with ⟨path, plen, haout, hbin, hamiss, only⟩ + have alphaOutside : ∀ {f : E}, Sum.inr f ∈ P.support → + phi f = some alpha → ¬ TreeIncidentEdge T f := by + exact @P2716_T1_OutsideExitTransport_alphaOutside_256 V E inferInstance inferInstance G k e0 + T phi alpha theta beta sameSide a b P path only + have transferEdges : ∀ e ∈ P.edges, + e ∈ (TwoColorIncidenceGraph G sigma theta beta).edgeSet := by + exact @P2716_T1_OutsideExitTransport_transferEdges_307 V E inferInstance inferInstance G k e0 + T phi alpha theta beta betaEq a b P alphaOutside + let Q := P.transfer (TwoColorIncidenceGraph G sigma theta beta) transferEdges + have supportEq : Q.support = P.support := P.support_transfer _ + have lengthEq : Q.length = P.length := P.length_transfer _ + refine ⟨Q, ⟨path.transfer _, by omega, fun ha => haout (hA ha), hbA, ?_, ?_⟩, + supportEq, lengthEq⟩ + · rcases hamiss with ham | hbm + · exact Or.inl ((outsideMissing a haout).1 ham) + · exact Or.inr ((outsideMissing a haout).2 hbm) + · intro v hv + rw [supportEq] + exact only v (hA hv) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OutsideKempeGoodHierarchy.lean b/LeanPool/GoldbergSeymour/OutsideKempeGoodHierarchy.lean new file mode 100644 index 0000000000..527a934b80 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OutsideKempeGoodHierarchy.lean @@ -0,0 +1,617 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable + +public import LeanPool.GoldbergSeymour.SameGoodHierarchy + +/-! +# Outside Kempe Good Hierarchy + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_254.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) {input₁ input₂ : PartialEdgeColoring E k} (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett₁ : ExtendedTashkinovTree G k + e0 input₁ T phi) (ett₂ : ExtendedTashkinovTree G k e0 input₂ T sigma) (base₁ : + HierarchyBase ett₁ phi) (base₂ : HierarchyBase ett₂ sigma) (H₁ : TashkinovHierarchy ett₁ + base₁) (H₂ : TashkinovHierarchy ett₂ base₂) (good₁ : GoodHierarchy H₁) (hcount : + H₁.dividerCount = H₂.dividerCount), + let gamma : Fin (H₂.dividerCount + (1 : ℕ)) → Fin k → Finset (Fin k) := fun (j : Fin + (H₂.dividerCount + (1 : ℕ))) (eta : Fin k) => good₁.gamma (Fin.cast (Eq.symm (congrArg + (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) eta; TreeMissingColors phi (ett₁.series.data.tree + (Fin.last ett₁.rounds).castSucc) = TreeMissingColors sigma (ett₂.series.data.tree + (Fin.last ett₂.rounds).castSucc) → ( + ∀ (j : Fin (H₂.dividerCount + (2 : ℕ))), TreeMissingColors phi (H₁.stage (Fin.cast (Eq.symm + (congrArg (fun (q : ℕ) => q + (2 : ℕ)) hcount)) j)) = TreeMissingColors sigma (H₂.stage + j)) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))) (eta : Fin k), HierarchySegmentColors H₁ (Fin.cast + (Eq.symm (congrArg (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) eta = HierarchySegmentColors + H₂ j eta) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt H₁ (Fin.cast (Eq.symm + (congrArg (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) = HierarchyStoredColorsAt H₂ j) → + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H₂ j, gamma j eta ⊆ HierarchyStageMissingColors H₂ j \ + HierarchySegmentColors H₂ j eta := by + classical + intro V E _ _ _ _ G k e0 input₁ input₂ T phi sigma ett₁ ett₂ base₁ base₂ H₁ H₂ good₁ hcount + gamma finalMissingEq stageMissingAt segmentAt storedEq j eta heta + have h := good₁.avoidance + (Fin.cast (congrArg (fun q => q + 1) hcount).symm j) eta + (by simpa [storedEq j] using heta) + rw [← segmentAt j] + have stageMissingEq : + HierarchyStageMissingColors H₁ + (Fin.cast (congrArg (fun q => q + 1) hcount).symm j) = + HierarchyStageMissingColors H₂ j := by + unfold HierarchyStageMissingColors + refine Fin.cases ?_ (fun i => ?_) j + · have hz : Fin.cast (congrArg (fun q => q + 1) hcount).symm + (0 : Fin (H₂.dividerCount + 1)) = 0 := by + apply Fin.ext + rfl + rw [hz] + exact finalMissingEq + · have hi : Fin.cast (congrArg (fun q => q + 1) hcount).symm i.succ = + (Fin.cast hcount.symm i).succ := by + apply Fin.ext + rfl + rw [hi] + have hs := stageMissingAt i.succ.castSucc + simpa using hs + rw [← stageMissingEq] + simpa [gamma] using h + +private theorem helper_branch_295.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) {input₁ input₂ : PartialEdgeColoring E k} (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett₁ : ExtendedTashkinovTree G k + e0 input₁ T phi) (ett₂ : ExtendedTashkinovTree G k e0 input₂ T sigma) (base₁ : + HierarchyBase ett₁ phi) (base₂ : HierarchyBase ett₂ sigma) (H₁ : TashkinovHierarchy ett₁ + base₁) (H₂ : TashkinovHierarchy ett₂ base₂) (good₁ : GoodHierarchy H₁), ( + ∀ v ∈ TreeSequenceVertexSet T, MissingColors G phi v = MissingColors G sigma v) → ( + ∀ (f : E), TreeIncidentEdge T f → sigma f = phi f) → base₁.core = base₂.core → + ∀ (hcount : H₁.dividerCount = H₂.dividerCount), (ett₁.series.data.kind (Fin.last ett₁.rounds) + = some TashkinovExtensionKind.PE ↔ ett₂.series.data.kind (Fin.last ett₂.rounds) = some + TashkinovExtensionKind.PE) ∧ (ett₁.series.data.kind (Fin.last ett₁.rounds) = some + TashkinovExtensionKind.PE → base₁.closure = base₂.closure) → ( + ∀ (j : Fin (H₂.dividerCount + (2 : ℕ))), H₁.stage (Fin.cast (Eq.symm (congrArg (fun (q : ℕ) => + q + (2 : ℕ)) hcount)) j) = H₂.stage j) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))), HierarchyStarredStage H₁ (Fin.cast (Eq.symm (congrArg + (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) = HierarchyStarredStage H₂ j) → + let gamma : Fin (H₂.dividerCount + (1 : ℕ)) → Fin k → Finset (Fin k) := fun (j : Fin + (H₂.dividerCount + (1 : ℕ))) (eta : Fin k) => good₁.gamma (Fin.cast (Eq.symm (congrArg + (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) eta; ( + ∀ {A : TreeSequence G e0}, TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → + TreeMissingColors phi A = TreeMissingColors sigma A) → TreeMissingColors phi + (ett₁.series.data.tree (Fin.last ett₁.rounds).castSucc) = TreeMissingColors sigma + (ett₂.series.data.tree (Fin.last ett₂.rounds).castSucc) → ( + ∀ (j : Fin (H₂.dividerCount + (2 : ℕ))), TreeMissingColors phi (H₁.stage (Fin.cast (Eq.symm + (congrArg (fun (q : ℕ) => q + (2 : ℕ)) hcount)) j)) = TreeMissingColors sigma (H₂.stage + j)) → ( + ∀ (eta : Fin k), HierarchyFirstMissingPosition phi T eta = HierarchyFirstMissingPosition sigma + T eta) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))), H₁.stage (Fin.cast (Eq.symm (congrArg (fun (q : ℕ) => + q + (1 : ℕ)) hcount)) j).succ = H₂.stage j.succ) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))) (eta : Fin k), HierarchySegmentColors H₁ (Fin.cast + (Eq.symm (congrArg (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) eta = HierarchySegmentColors + H₂ j eta) → TreeSequenceVertexSet base₁.core ⊆ TreeSequenceVertexSet T → + TreeSequenceVertexSet base₂.core ⊆ TreeSequenceVertexSet T → ( + ∀ {A : TreeSequence G e0}, TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → + ∀ (C : Finset (Fin k)), TreeColorSetMinusClosed G phi A C ↔ TreeColorSetMinusClosed G sigma A + C) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt H₁ (Fin.cast (Eq.symm + (congrArg (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) = HierarchyStoredColorsAt H₂ j) → + let n : Fin (ett₂.rounds + (1 : ℕ)) := Fin.last ett₂.rounds; + let Tn : TreeSequence G e0 := ett₂.series.data.tree n.castSucc; ett₂.series.data.kind n = some + TashkinovExtensionKind.PE → ¬TreeColorSetMinusClosed G sigma base₂.core + ((HierarchyStoredColorsAt H₂ (0 : Fin (H₂.dividerCount + (1 : ℕ)))).biUnion (gamma (0 : + Fin (H₂.dividerCount + (1 : ℕ))))) ∧ (4 : ℕ) ≤ ((TreeMissingColors sigma Tn ∩ + TreeMissingColors sigma base₂.closure) \ (HierarchyStoredColorsAt H₂ (0 : Fin + (H₂.dividerCount + (1 : ℕ)))).biUnion (gamma (0 : Fin (H₂.dividerCount + (1 : ℕ))))).card + := by + classical + intro V E _ _ _ _ G k e0 input₁ input₂ T phi sigma ett₁ ett₂ base₁ base₂ H₁ H₂ good₁ hmissing + hfixed hcore hcount hpe stageAt starredAt gamma missingTree finalMissingEq stageMissingAt + firstMissingAt stageSuccAt segmentAt coreSubset₁ coreSubset₂ minusAt storedEq + change (ett₂.series.data.kind (Fin.last ett₂.rounds) = + some TashkinovExtensionKind.PE) → _ + intro hkind + have hkind₁ : ett₁.series.data.kind (Fin.last ett₁.rounds) = + some TashkinovExtensionKind.PE := hpe.1.mpr hkind + have hclosure := hpe.2 hkind₁ + have closureSubset₂ : TreeSequenceVertexSet base₂.closure ⊆ + TreeSequenceVertexSet T := by + intro v hv + apply coreSubset₂ + obtain ⟨_, _, ⟨ordered⟩⟩ := base₂.parallel hkind + rw [ordered.vertexSet] + exact Finset.mem_union_right _ hv + have closureMissingEq : + TreeMissingColors phi base₂.closure = + TreeMissingColors sigma base₂.closure := + missingTree closureSubset₂ + rw [← storedEq 0] + simpa [gamma, HierarchyStageMissingColors, HierarchySegmentColors, + HierarchyStarredStage, stageAt, stageSuccAt, starredAt, stageMissingAt, + firstMissingAt, segmentAt, storedEq, hmissing, hfixed, hcore, + finalMissingEq, hclosure, closureMissingEq, minusAt coreSubset₁, + minusAt coreSubset₂] using + good₁.parallelBase hkind₁ + +private theorem helper_boundaryAt_316.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : + ℕ) (e0 : E) (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k), (∀ (f : E), + TreeIncidentEdge T f → sigma f = phi f) → ∀ {A : TreeSequence G e0}, TreeSequenceVertexSet + A ⊆ TreeSequenceVertexSet T → ∀ (c : Fin k), BoundaryColorEdges G phi + (TreeSequenceVertexSet A) c = BoundaryColorEdges G sigma (TreeSequenceVertexSet A) c := by + classical + intro V E _ _ G k e0 T phi sigma hfixed A hA c + ext f + simp only [BoundaryColorEdges, BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + constructor <;> intro hf + · obtain ⟨hboundary, hfc⟩ := hf + obtain ⟨u, hu, v, hv, he⟩ := hboundary + refine ⟨⟨u, hu, v, hv, he⟩, ?_⟩ + exact (hfixed f ⟨u, hA hu, + by simp [Incident, he]⟩).trans hfc + · obtain ⟨hboundary, hfc⟩ := hf + obtain ⟨u, hu, v, hv, he⟩ := hboundary + refine ⟨⟨u, hu, v, hv, he⟩, ?_⟩ + exact (hfixed f ⟨u, hA hu, + by simp [Incident, he]⟩).symm.trans hfc + +private theorem helper_continuation_343.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) {input₁ input₂ : PartialEdgeColoring E k} (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett₁ : ExtendedTashkinovTree G k + e0 input₁ T phi) (ett₂ : ExtendedTashkinovTree G k e0 input₂ T sigma) (base₁ : + HierarchyBase ett₁ phi) (base₂ : HierarchyBase ett₂ sigma) (H₁ : TashkinovHierarchy ett₁ + base₁) (H₂ : TashkinovHierarchy ett₂ base₂) (good₁ : GoodHierarchy H₁), ( + ∀ v ∈ TreeSequenceVertexSet T, MissingColors G phi v = MissingColors G sigma v) → ( + ∀ (f : E), TreeIncidentEdge T f → sigma f = phi f) → base₁.core = base₂.core → + ∀ (hcount : H₁.dividerCount = H₂.dividerCount), (ett₁.series.data.kind (Fin.last ett₁.rounds) + = some TashkinovExtensionKind.PE ↔ ett₂.series.data.kind (Fin.last ett₂.rounds) = some + TashkinovExtensionKind.PE) ∧ (ett₁.series.data.kind (Fin.last ett₁.rounds) = some + TashkinovExtensionKind.PE → base₁.closure = base₂.closure) → SameHierarchyStages H₁ H₂ → ( + ∀ (j : Fin (H₂.dividerCount + (2 : ℕ))), H₁.stage (Fin.cast (Eq.symm (congrArg (fun (q : ℕ) => + q + (2 : ℕ)) hcount)) j) = H₂.stage j) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))), HierarchyStarredStage H₁ (Fin.cast (Eq.symm (congrArg + (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) = HierarchyStarredStage H₂ j) → + let _ : Fin (H₂.dividerCount + (1 : ℕ)) → Fin k → Finset (Fin k) := fun (j : Fin + (H₂.dividerCount + (1 : ℕ))) (eta : Fin k) => good₁.gamma (Fin.cast (Eq.symm (congrArg + (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) eta; ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → ( + ∀ (j : Fin (H₁.dividerCount + (2 : ℕ))), TreeSequenceVertexSet (H₁.stage j) ⊆ + TreeSequenceVertexSet T) → ( + ∀ (j : Fin (H₂.dividerCount + (2 : ℕ))), TreeSequenceVertexSet (H₂.stage j) ⊆ + TreeSequenceVertexSet T) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → + TreeMissingColors phi A = TreeMissingColors sigma A) → TreeMissingColors phi + (ett₁.series.data.tree (Fin.last ett₁.rounds).castSucc) = TreeMissingColors sigma + (ett₂.series.data.tree (Fin.last ett₂.rounds).castSucc) → TashkinovStoredColors + ett₁.series.data (Fin.last ett₁.rounds) = TashkinovStoredColors ett₂.series.data (Fin.last + ett₂.rounds) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))), TreeMissingColors phi (HierarchyStarredStage H₁ + (Fin.cast (Eq.symm (congrArg (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j)) = TreeMissingColors + sigma (HierarchyStarredStage H₂ j)) → ( + ∀ (j : Fin (H₂.dividerCount + (2 : ℕ))), TreeMissingColors phi (H₁.stage (Fin.cast (Eq.symm + (congrArg (fun (q : ℕ) => q + (2 : ℕ)) hcount)) j)) = TreeMissingColors sigma (H₂.stage + j)) → ( + ∀ (eta : Fin k), HierarchyFirstMissingPosition phi T eta = HierarchyFirstMissingPosition sigma + T eta) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))), H₁.stage (Fin.cast (Eq.symm (congrArg (fun (q : ℕ) => + q + (1 : ℕ)) hcount)) j).succ = H₂.stage j.succ) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))) (eta : Fin k), HierarchySegmentColors H₁ (Fin.cast + (Eq.symm (congrArg (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) eta = HierarchySegmentColors + H₂ j eta) → + ∃ (good₂ : GoodHierarchy H₂), SameGoodHierarchy good₁ good₂ := by + classical + intro V E _ _ _ _ G k e0 input₁ input₂ T phi sigma ett₁ ett₂ base₁ base₂ H₁ H₂ good₁ hmissing + hfixed hcore hcount hpe hsame' stageAt starredAt gamma initialSubset stageSubset₁ + stageSubset₂ missingTree finalMissingEq storedBaseEq starredMissingAt stageMissingAt + firstMissingAt stageSuccAt segmentAt + have boundaryAt := @helper_boundaryAt_316 V E inferInstance inferInstance G k e0 T phi sigma + hfixed + have closedAt : ∀ {A : TreeSequence G e0}, + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → ∀ C, + TreeColorSetClosed G phi A C ↔ TreeColorSetClosed G sigma A C := by + intro A hA C + unfold TreeColorSetClosed + constructor <;> intro h c hc + · exact (boundaryAt hA c).symm ▸ h c hc + · exact (boundaryAt hA c) ▸ h c hc + have coreSubset₁ : TreeSequenceVertexSet base₁.core ⊆ TreeSequenceVertexSet T := + (initialSubset H₁.coreInsideFirst).trans (stageSubset₁ ⟨1, by omega⟩) + have coreSubset₂ : TreeSequenceVertexSet base₂.core ⊆ TreeSequenceVertexSet T := by + rw [← hcore] + exact coreSubset₁ + have minusAt : ∀ {A : TreeSequence G e0}, + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → ∀ C, + TreeColorSetMinusClosed G phi A C ↔ TreeColorSetMinusClosed G sigma A C := by + intro A hA C + unfold TreeColorSetMinusClosed + rw [missingTree hA] + exact closedAt hA _ + have storedEq : ∀ j : Fin (H₂.dividerCount + 1), + HierarchyStoredColorsAt H₁ (Fin.cast (congrArg (fun q => q + 1) hcount).symm j) = + HierarchyStoredColorsAt H₂ j := by + intro j + dsimp [HierarchyStoredColorsAt] + rw [storedBaseEq, starredMissingAt] + have stageTreeAt : ∀ i : Fin H₂.dividerCount, + H₁.stage (Fin.cast hcount.symm i).castSucc.succ = + H₂.stage i.castSucc.succ := by + intro i + have hs := stageSuccAt i.castSucc + simpa using hs + have stageMissingSucc : ∀ i : Fin H₂.dividerCount, + TreeMissingColors phi (H₁.stage (Fin.cast hcount.symm i).castSucc.succ) = + TreeMissingColors sigma (H₂.stage i.castSucc.succ) := by + intro i + rw [stageTreeAt i] + exact missingTree (stageSubset₂ _) + have refreshMissingAt : + ∀ i : Fin H₂.dividerCount, (TreeSequenceVertexSet (H₂.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H₂ i.castSucc)).biUnion (fun v => + MissingColors G phi v) = (TreeSequenceVertexSet (H₂.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H₂ i.castSucc)).biUnion (fun v => + MissingColors G sigma v) := by + intro i + ext c + simp only [Finset.mem_biUnion] + constructor <;> intro hc + · obtain ⟨v, hv, hvc⟩ := hc + exact ⟨v, hv, (Finset.ext_iff.mp (hmissing v + (stageSubset₂ _ (Finset.mem_sdiff.mp hv).1)) c).mp hvc⟩ + · obtain ⟨v, hv, hvc⟩ := hc + exact ⟨v, hv, (Finset.ext_iff.mp (hmissing v + (stageSubset₂ _ (Finset.mem_sdiff.mp hv).1)) c).mpr hvc⟩ + refine ⟨⟨gamma, ?_, ?_, ?_, ?_, ?_, ?_⟩, ?_⟩ + · intro j eta heta + apply good₁.twoColors + (Fin.cast (congrArg (fun q => q + 1) hcount).symm j) eta + rw [storedEq] + exact heta + · exact @helper_branch_254 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input₁ input₂ T phi sigma ett₁ ett₂ base₁ base₂ H₁ H₂ good₁ hcount finalMissingEq + stageMissingAt segmentAt storedEq + · intro j eta theta heta htheta hne + apply good₁.disjointPairs + (Fin.cast (congrArg (fun q => q + 1) hcount).symm j) eta theta + · simpa [storedEq j] using heta + · simpa [storedEq j] using htheta + · exact hne + · intro i + rw [← storedEq i.succ] + rw [← refreshMissingAt i] + rw [← starredAt i.castSucc] + simpa [gamma, HierarchyStageMissingColors, HierarchySegmentColors, + stageAt, stageSuccAt, starredAt, stageMissingAt, + firstMissingAt, segmentAt, storedEq, hmissing, hfixed, hcore, + stageTreeAt, stageMissingSucc] using + good₁.uniqueRefresh (Fin.cast hcount.symm i) + · exact @helper_branch_295 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input₁ input₂ T phi sigma ett₁ ett₂ base₁ base₂ H₁ H₂ good₁ hmissing hfixed hcore hcount + hpe stageAt starredAt missingTree finalMissingEq stageMissingAt firstMissingAt stageSuccAt + segmentAt coreSubset₁ coreSubset₂ minusAt storedEq + · intro i + rw [← storedEq i.succ] + simpa [gamma, HierarchyStageMissingColors, HierarchySegmentColors, + HierarchyStarredStage, stageAt, stageSuccAt, starredAt, stageMissingAt, + firstMissingAt, segmentAt, storedEq, hmissing, hfixed, hcore, + minusAt (stageSubset₂ _), stageTreeAt, stageMissingSucc] using + good₁.minusClosed (Fin.cast hcount.symm i) + · change SameHierarchyStages H₁ H₂ ∧ _ + refine ⟨hsame', hcount, ?_⟩ + intro j + constructor + · exact storedEq (Fin.cast (congrArg (fun q => q + 1) hcount) j) + · intro eta heta + dsimp [gamma] + +private theorem helper_continuation_155.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) {input₁ input₂ : PartialEdgeColoring E k} (T : + TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett₁ : ExtendedTashkinovTree G k + e0 input₁ T phi) (ett₂ : ExtendedTashkinovTree G k e0 input₂ T sigma) (base₁ : + HierarchyBase ett₁ phi) (base₂ : HierarchyBase ett₂ sigma) (H₁ : TashkinovHierarchy ett₁ + base₁) (H₂ : TashkinovHierarchy ett₂ base₂) (good₁ : GoodHierarchy H₁) (hrung : + ett₁.rounds = ett₂.rounds), ( + ∀ (i : Fin (ett₁.rounds + (1 : ℕ))), ett₁.series.data.stored i = ett₂.series.data.stored + (Fin.cast (congrArg (fun (r : ℕ) => r + (1 : ℕ)) hrung) i)) → ( + ∀ v ∈ TreeSequenceVertexSet T, MissingColors G phi v = MissingColors G sigma v) → ( + ∀ (f : E), TreeIncidentEdge T f → sigma f = phi f) → base₁.core = base₂.core → + ∀ (hcount : H₁.dividerCount = H₂.dividerCount), H₁.stage ≍ H₂.stage → (ett₁.series.data.kind + (Fin.last ett₁.rounds) = some TashkinovExtensionKind.PE ↔ ett₂.series.data.kind (Fin.last + ett₂.rounds) = some TashkinovExtensionKind.PE) ∧ (ett₁.series.data.kind (Fin.last + ett₁.rounds) = some TashkinovExtensionKind.PE → base₁.closure = base₂.closure) → + SameHierarchyStages H₁ H₂ → ( + ∀ {n m : ℕ} (h : n = m) (f : Fin (n + (2 : ℕ)) → TreeSequence G e0) (g : Fin (m + (2 : ℕ)) → + TreeSequence G e0), f ≍ g → + ∀ (j : Fin (m + (2 : ℕ))), f (Fin.cast (Eq.symm (congrArg (fun (q : ℕ) => q + (2 : ℕ)) h)) j) + = g j) → ( + ∀ (j : Fin (H₂.dividerCount + (2 : ℕ))), H₁.stage (Fin.cast (Eq.symm (congrArg (fun (q : ℕ) => + q + (2 : ℕ)) hcount)) j) = H₂.stage j) → ( + ∀ (j : Fin (H₂.dividerCount + (1 : ℕ))), HierarchyStarredStage H₁ (Fin.cast (Eq.symm (congrArg + (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) = HierarchyStarredStage H₂ j) → ( + ∀ {n m : ℕ} (h : n = m) (d₁ : TashkinovSeriesData G k n e0) (d₂ : TashkinovSeriesData G k m + e0), ( + ∀ (i : Fin (n + (1 : ℕ))), d₁.stored i = d₂.stored (Fin.cast (congrArg (fun (q : ℕ) => q + (1 + : ℕ)) h) i)) → TreeMissingColors (d₁.coloring (Fin.last n)) (d₁.tree (Fin.last + n).castSucc) = TreeMissingColors (d₂.coloring (Fin.last m)) (d₂.tree (Fin.last + m).castSucc) → TashkinovStoredColors d₁ (Fin.last n) = TashkinovStoredColors d₂ (Fin.last + m)) → + let _ : Fin (H₂.dividerCount + (1 : ℕ)) → Fin k → Finset (Fin k) := fun (j : Fin + (H₂.dividerCount + (1 : ℕ))) (eta : Fin k) => good₁.gamma (Fin.cast (Eq.symm (congrArg + (fun (q : ℕ) => q + (1 : ℕ)) hcount)) j) eta; ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → ( + ∀ (j : Fin (H₁.dividerCount + (2 : ℕ))), TreeSequenceVertexSet (H₁.stage j) ⊆ + TreeSequenceVertexSet T) → ( + ∀ (j : Fin (H₂.dividerCount + (2 : ℕ))), TreeSequenceVertexSet (H₂.stage j) ⊆ + TreeSequenceVertexSet T) → ( + ∀ {A : TreeSequence G e0}, TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → + TreeMissingColors phi A = TreeMissingColors sigma A) → + ∃ (good₂ : GoodHierarchy H₂), SameGoodHierarchy good₁ good₂ + := by + classical + intro V E _ _ _ _ G k e0 input₁ input₂ T phi sigma ett₁ ett₂ base₁ base₂ H₁ H₂ good₁ hrung + hseries hmissing hfixed hcore hcount hstage hpe hsame' transportStageAt stageAt starredAt + storedTransport gamma initialSubset stageSubset₁ stageSubset₂ missingTree + have finalTreeEq : + ett₁.series.data.tree (Fin.last ett₁.rounds).castSucc = + ett₂.series.data.tree (Fin.last ett₂.rounds).castSucc := by + calc + _ = H₁.stage 0 := H₁.baseStage.symm + _ = H₂.stage 0 := by + have hh := transportStageAt hcount H₁.stage H₂.stage hstage 0 + have hz : Fin.cast (congrArg (fun q : ℕ => q + 2) hcount).symm + (0 : Fin (H₂.dividerCount + 2)) = 0 := by + apply Fin.ext + rfl + rw [hz] at hh + exact hh + _ = _ := H₂.baseStage + have finalMissingEq : + TreeMissingColors phi (ett₁.series.data.tree (Fin.last ett₁.rounds).castSucc) = + TreeMissingColors sigma (ett₂.series.data.tree (Fin.last ett₂.rounds).castSucc) := by + rw [← finalTreeEq] + apply missingTree + simpa [H₁.baseStage] using stageSubset₁ 0 + have storedBaseEq : + TashkinovStoredColors ett₁.series.data (Fin.last ett₁.rounds) = + TashkinovStoredColors ett₂.series.data (Fin.last ett₂.rounds) := by + have finalColorMissingEq : + TreeMissingColors (ett₁.series.data.coloring (Fin.last ett₁.rounds)) + (ett₁.series.data.tree (Fin.last ett₁.rounds).castSucc) = + TreeMissingColors (ett₂.series.data.coloring (Fin.last ett₂.rounds)) + (ett₂.series.data.tree (Fin.last ett₂.rounds).castSucc) := by + simpa [← ett₁.generatingColoring, ← ett₂.generatingColoring] using finalMissingEq + exact storedTransport hrung ett₁.series.data ett₂.series.data hseries + finalColorMissingEq + have starredSubset₁ : ∀ j : Fin (H₁.dividerCount + 1), + TreeSequenceVertexSet (HierarchyStarredStage H₁ j) ⊆ TreeSequenceVertexSet T := by + intro j + refine Fin.cases ?_ (fun i => ?_) j + · exact (initialSubset H₁.coreInsideFirst).trans (stageSubset₁ ⟨1, by omega⟩) + · exact stageSubset₁ i.succ.castSucc + have starredSubset₂ : ∀ j : Fin (H₂.dividerCount + 1), + TreeSequenceVertexSet (HierarchyStarredStage H₂ j) ⊆ TreeSequenceVertexSet T := by + intro j + refine Fin.cases ?_ (fun i => ?_) j + · exact (initialSubset H₂.coreInsideFirst).trans (stageSubset₂ ⟨1, by omega⟩) + · exact stageSubset₂ i.succ.castSucc + have starredMissingAt : ∀ j : Fin (H₂.dividerCount + 1), + TreeMissingColors phi (HierarchyStarredStage H₁ + (Fin.cast (congrArg (fun q => q + 1) hcount).symm j)) = + TreeMissingColors sigma (HierarchyStarredStage H₂ j) := by + intro j + rw [starredAt j] + apply missingTree + exact starredSubset₂ _ + have stageMissingAt : ∀ j : Fin (H₂.dividerCount + 2), + TreeMissingColors phi (H₁.stage (Fin.cast (congrArg (fun q : ℕ => q + 2) hcount).symm j)) = + TreeMissingColors sigma (H₂.stage j) := by + intro j + rw [stageAt j] + apply missingTree + exact stageSubset₂ j + have firstMissingAt : ∀ eta : Fin k, + HierarchyFirstMissingPosition phi T eta = HierarchyFirstMissingPosition sigma T eta := by + intro eta + unfold HierarchyFirstMissingPosition + have candidatesEq : + (Finset.univ.filter fun i => eta ∈ MissingColors G phi (T.vertex i)) = + (Finset.univ.filter fun i => eta ∈ MissingColors G sigma (T.vertex i)) := by + ext i + have hv := hmissing (T.vertex i) (by simp [TreeSequenceVertexSet]) + simpa only [Finset.mem_filter, Finset.mem_univ, true_and] using + (show (eta ∈ MissingColors G phi (T.vertex i)) ↔ + eta ∈ MissingColors G sigma (T.vertex i) from by rw [hv]) + rw [candidatesEq] + have edgeFixed : ∀ {A : TreeSequence G e0}, + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → + ∀ r : Fin A.length, sigma (A.edge r) = phi (A.edge r) := by + intro A hA r + rcases A.attaches r with ⟨i, hi⟩ + apply hfixed + refine ⟨A.vertex r.succ, ?_, ?_⟩ + · apply hA + simp [TreeSequenceVertexSet] + · simp [Incident, hi] + have stageSuccAt : ∀ (j : Fin (H₂.dividerCount + 1)), + H₁.stage ((Fin.cast (congrArg (fun q : ℕ => q + 1) hcount).symm j).succ) = + H₂.stage j.succ := by + intro j + have hi : (Fin.cast (congrArg (fun q : ℕ => q + 1) hcount).symm j).succ = + Fin.cast (congrArg (fun q : ℕ => q + 2) hcount).symm j.succ := by + apply Fin.ext + rfl + rw [hi] + exact stageAt j.succ + have segmentAt : + ∀ (j : Fin (H₂.dividerCount + 1)) (eta : Fin k), HierarchySegmentColors H₁ (Fin.cast (congrArg + (fun q => q + 1) hcount).symm j) eta = HierarchySegmentColors H₂ j eta := by + intro j eta + simp only [HierarchySegmentColors, starredAt, firstMissingAt, stageSuccAt, lt_min_iff, + and_assoc, Fin.is_lt, + and_true, edgeFixed (stageSubset₂ _)]; rw [stageSuccAt j]; + ext x; simp [] + exact @helper_continuation_343 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input₁ input₂ T phi sigma ett₁ ett₂ base₁ base₂ H₁ H₂ good₁ hmissing hfixed hcore hcount + hpe hsame' stageAt starredAt initialSubset stageSubset₁ stageSubset₂ missingTree + finalMissingEq storedBaseEq starredMissingAt stageMissingAt firstMissingAt stageSuccAt + segmentAt +theorem OutsideKempeGoodHierarchy {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + {input₁ input₂ : PartialEdgeColoring E k} (T : TreeSequence G e0) + (phi sigma : PartialEdgeColoring E k) + (ett₁ : ExtendedTashkinovTree G k e0 input₁ T phi) + (ett₂ : ExtendedTashkinovTree G k e0 input₂ T sigma) + (base₁ : HierarchyBase ett₁ phi) (base₂ : HierarchyBase ett₂ sigma) + (H₁ : TashkinovHierarchy ett₁ base₁) + (H₂ : TashkinovHierarchy ett₂ base₂) + (hsame : SameHierarchyStages H₁ H₂) + (good₁ : GoodHierarchy H₁) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (alpha beta : Fin k) + (hrecolor : OutsideKempeRecoloring T phi sigma alpha beta) + (hrung : ett₁.rounds = ett₂.rounds) + (hseries : + ∀ i : Fin (ett₁.rounds + 1), + ett₁.series.data.stored i = ett₂.series.data.stored + (Fin.cast (congrArg (fun r => r + 1) hrung) i)) : + ∃ good₂ : GoodHierarchy H₂, SameGoodHierarchy good₁ good₂ := by + classical + have stable := OutsideKempeRecoloringStable G e0 T ∅ phi sigma alpha beta + hproper hone hrecolor + have hmissing : ∀ v ∈ TreeSequenceVertexSet T, + MissingColors G phi v = MissingColors G sigma v := fun v hv => + (stable.2.2.1.2 v hv).symm + have hfixed : ∀ f, TreeIncidentEdge T f → sigma f = phi f := stable.2.2.2.2 + rcases hsame with ⟨hcore, hcount, hstage, hposition, hpe⟩ + have hsame' : SameHierarchyStages H₁ H₂ := + ⟨hcore, hcount, hstage, hposition, hpe⟩ + let stageTypes : ℕ → Sort _ := fun q => Fin (q + 2) → TreeSequence G e0 + let positionTypes : ℕ → Sort _ := fun q => Fin q → Fin (T.length + 1) + have transportStage : + ∀ {n m : ℕ} (h : n = m) (f : Fin (n + 2) → TreeSequence G e0) (g : Fin (m + 2) → TreeSequence + G e0), HEq f g → f = cast (congrArg (fun q => Fin (q + 2) → TreeSequence G e0) h).symm g + := by + intro n m h f g hg + cases h + exact eq_of_heq hg + have transportPosition : + ∀ {n m : ℕ} (h : n = m) (f : Fin n → Fin (T.length + 1)) (g : Fin m → Fin (T.length + 1)), HEq + f g → f = cast (congrArg (fun q => Fin q → Fin (T.length + 1)) h).symm g := by + intro n m h f g hg + cases h + exact eq_of_heq hg + have transportStageAt : ∀ {n m : ℕ} (h : n = m) + (f : Fin (n + 2) → TreeSequence G e0) + (g : Fin (m + 2) → TreeSequence G e0), HEq f g → + ∀ j : Fin (m + 2), f (Fin.cast (congrArg (fun q : ℕ => q + 2) h).symm j) = g j := by + intro n m h f g hg j + cases h + simpa using congrFun (eq_of_heq hg) j + have transportPositionAt : ∀ {n m : ℕ} (h : n = m) + (f : Fin n → Fin (T.length + 1)) + (g : Fin m → Fin (T.length + 1)), HEq f g → + ∀ j : Fin m, f (Fin.cast h.symm j) = g j := by + intro n m h f g hg j + cases h + simpa using congrFun (eq_of_heq hg) j + have hstageEq : H₁.stage = cast (congrArg stageTypes hcount).symm H₂.stage := by + exact transportStage hcount H₁.stage H₂.stage hstage + have hpositionEq : H₁.dividerPosition = + cast (congrArg positionTypes hcount).symm H₂.dividerPosition := by + exact transportPosition hcount H₁.dividerPosition H₂.dividerPosition hposition + have stageAt : ∀ j : Fin (H₂.dividerCount + 2), + H₁.stage (Fin.cast (congrArg (fun q => q + 2) hcount).symm j) = H₂.stage j := by + intro j + exact transportStageAt hcount H₁.stage H₂.stage hstage j + have positionAt : ∀ j : Fin H₂.dividerCount, + H₁.dividerPosition (Fin.cast hcount.symm j) = H₂.dividerPosition j := by + intro j + exact transportPositionAt hcount H₁.dividerPosition H₂.dividerPosition hposition j + have starredAt : ∀ j : Fin (H₂.dividerCount + 1), + HierarchyStarredStage H₁ (Fin.cast (congrArg (fun q => q + 1) hcount).symm j) = + HierarchyStarredStage H₂ j := by + intro j + refine Fin.cases ?_ (fun i => ?_) j + · simpa [HierarchyStarredStage] using hcore + · have hs := stageAt i.succ.castSucc + simpa [HierarchyStarredStage] using hs + have storedTransport : + ∀ {n m : ℕ} (h : n = m) (d₁ : TashkinovSeriesData G k n e0) (d₂ : TashkinovSeriesData G k m + e0), ( + ∀ i : Fin (n + 1), d₁.stored i = d₂.stored (Fin.cast (congrArg (fun q : ℕ => q + 1) h) i)) → + TreeMissingColors (d₁.coloring (Fin.last n)) (d₁.tree (Fin.last n).castSucc) = + TreeMissingColors (d₂.coloring (Fin.last m)) (d₂.tree (Fin.last m).castSucc) → + TashkinovStoredColors d₁ (Fin.last n) = TashkinovStoredColors d₂ (Fin.last m) := by + intro n m h d₁ d₂ hs hm + cases h + simp [TashkinovStoredColors, hs, hm] + let gamma : Fin (H₂.dividerCount + 1) → Fin k → Finset (Fin k) := + fun j eta => good₁.gamma (Fin.cast (congrArg (fun q => q + 1) hcount).symm j) eta + have initialSubset : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hab v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + obtain ⟨i, hi, hvi⟩ := hv + obtain ⟨hlen, hvertices, hedges⟩ := hab + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, + (hvertices i).trans hvi⟩ + have stageSubset₁ : ∀ j : Fin (H₁.dividerCount + 2), + TreeSequenceVertexSet (H₁.stage j) ⊆ TreeSequenceVertexSet T := by + intro j + exact Fin.reverseInduction (motive := fun q => + TreeSequenceVertexSet (H₁.stage q) ⊆ TreeSequenceVertexSet T) (by + simp [H₁.terminalStage]) (by + intro i hi + exact (initialSubset (H₁.nested i)).trans hi) j + have stageSubset₂ : ∀ j : Fin (H₂.dividerCount + 2), + TreeSequenceVertexSet (H₂.stage j) ⊆ TreeSequenceVertexSet T := by + intro j + exact Fin.reverseInduction (motive := fun q => + TreeSequenceVertexSet (H₂.stage q) ⊆ TreeSequenceVertexSet T) (by + simp [H₂.terminalStage]) (by + intro i hi + exact (initialSubset (H₂.nested i)).trans hi) j + have missingTree : ∀ {A : TreeSequence G e0}, + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → + TreeMissingColors phi A = TreeMissingColors sigma A := by + intro A hA + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor <;> intro hc + · obtain ⟨v, hv, hvc⟩ := hc + exact ⟨v, hv, (Finset.ext_iff.mp (hmissing v (hA hv)) c).mp hvc⟩ + · obtain ⟨v, hv, hvc⟩ := hc + exact ⟨v, hv, (Finset.ext_iff.mp (hmissing v (hA hv)) c).mpr hvc⟩ + exact @helper_continuation_155 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input₁ input₂ T phi sigma ett₁ ett₂ base₁ base₂ H₁ H₂ good₁ hrung hseries hmissing + hfixed hcore hcount hstage hpe hsame' transportStageAt stageAt starredAt storedTransport + initialSubset stageSubset₁ stageSubset₂ missingTree +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OutsideKempeRecoloring.lean b/LeanPool/GoldbergSeymour/OutsideKempeRecoloring.lean new file mode 100644 index 0000000000..18101830ec --- /dev/null +++ b/LeanPool/GoldbergSeymour/OutsideKempeRecoloring.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent + +/-! +# Outside Kempe Recoloring + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A coloring obtained by swapping a fixed color pair on components disjoint from the tree. -/ +def OutsideKempeRecoloring {V E : Type*} {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (alpha beta : Fin k) : Prop := by + classical + exact + alpha ≠ beta ∧ + ∃ roots : Finset (Sum V E), + (∀ z ∈ roots, + ∀ v : V, Sum.inl v ∈ TwoColorComponent G phi alpha beta z → v ∉ TreeSequenceVertexSet T) ∧ + ∀ f : E, + sigma f = + if ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha beta z then + if phi f = some alpha then some beta else if phi f = some beta then some alpha else phi f + else phi f + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OutsideKempeRecoloringStable.lean b/LeanPool/GoldbergSeymour/OutsideKempeRecoloringStable.lean new file mode 100644 index 0000000000..1df12203b4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OutsideKempeRecoloringStable.lean @@ -0,0 +1,274 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TreeColoringInvariant + +/-! +# Outside Kempe Recoloring Stable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem OutsideKempeRecoloringStable {V E : Type*} + [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} (e0 : E) + (T : TreeSequence G e0) (C : Finset (Fin k)) + (phi sigma : PartialEdgeColoring E k) (alpha beta : Fin k) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hrecolor : OutsideKempeRecoloring T phi sigma alpha beta) : + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ + StableColoring T C phi sigma ∧ + TreeColoringInvariant T phi sigma ∧ + ∀ f : E, TreeIncidentEdge T f → sigma f = phi f := by + classical + let _ := Fintype.ofFinite V + rcases hrecolor with ⟨hab, roots, hout, hsigma⟩ + let changeColor : Option (Fin k) → Option (Fin k) := fun q => + if q = some alpha then some beta else + if q = some beta then some alpha else q + have hroot : ∀ {f : E}, (∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha beta z) → + (phi f = some alpha ∨ phi f = some beta) → ¬ TreeIncidentEdge T f := by + intro f hf hcol htf + obtain ⟨z, hz, hzf⟩ := hf + obtain ⟨v, hv, hvf⟩ := htf + have hadj : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inl v) (Sum.inr f) := by + exact ⟨hvf, hcol⟩ + have heq := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + have hzf' : (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inr f) = (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk z := by + change Sum.inr f ∈ ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk z).supp + at hzf + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mp hzf + have hvcomp : Sum.inl v ∈ TwoColorComponent G phi alpha beta z := by + change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk (Sum.inl v) = + (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk z + exact heq.trans hzf' + exact (hout z hz v hvcomp) hv + have hswap : ∀ f, sigma f = if ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha beta z then changeColor (phi f) + else phi f := by + intro f + simpa [changeColor] using hsigma f + have hfixed : ∀ {f}, TreeIncidentEdge T f → sigma f = phi f := by + intro f hf + rw [hswap f] + by_cases ha : phi f = some alpha + · by_cases h : ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · exact False.elim (hroot h (Or.inl ha) hf) + · simp [changeColor, h, ha] + · by_cases hb' : phi f = some beta + · by_cases h : ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · exact False.elim (hroot h (Or.inr hb') hf) + · simp [changeColor, h, hb'] + · simp [changeColor, ha, hb'] + have swap_injective : Function.Injective changeColor := by + intro x y h + dsimp [changeColor] at h + by_cases xa : x = some alpha <;> by_cases xb : x = some beta <;> + by_cases ya : y = some alpha <;> by_cases yb : y = some beta <;> + simp_all [] + have component_step : + ∀ {e f : E}, ( + ∃ z ∈ roots, Sum.inr e ∈ TwoColorComponent G phi alpha beta z) → AdjacentEdges G e f → (phi e + = some alpha ∨ phi e = some beta) → (phi f = some alpha ∨ phi f = some beta) → + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha beta z := by + intro e f he hadj hce hcf + obtain ⟨z, hz, hze⟩ := he + obtain ⟨v, hve, hvf⟩ := hadj + have hae : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inr e) (Sum.inl v) := ⟨hve, hce⟩ + have haf : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inl v) (Sum.inr f) := ⟨hvf, hcf⟩ + have heq := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hae + have hfq := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj haf + have hze' : (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inr e) = (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk z := by + change Sum.inr e ∈ ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk z).supp + at hze + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mp hze + exact ⟨z, hz, hfq.symm.trans (heq.symm.trans hze')⟩ + have hproper' : IsProperEdgeColoring G sigma := by + intro e f c hef hadj hec hfc + by_cases se : ∃ z ∈ roots, Sum.inr e ∈ TwoColorComponent G phi alpha beta z + · by_cases sf : ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · have heq : phi e = phi f := by + apply swap_injective + rw [hswap e] at hec + rw [hswap f] at hfc + simp only [se, sf, ↓reduceIte] at hec hfc + exact hec.trans hfc.symm + have hne : phi e ≠ none := by + intro hn + rw [hswap e, hn] at hec + simp [changeColor] at hec + obtain ⟨d, hd⟩ := Option.ne_none_iff_exists.mp hne + exact (hproper hef hadj hd.symm) (heq ▸ hd.symm) + · rw [hswap e] at hec + rw [ite_eq_left se] at hec + rw [hswap f] at hfc + rw [ite_eq_right sf] at hfc + by_cases ha' : phi e = some alpha + · have hc : c = beta := by simpa [changeColor, ha'] using hec.symm + have hf : phi f = some beta := hc ▸ hfc + exact sf (component_step se hadj (Or.inl ha') (Or.inr hf)) + · by_cases hb' : phi e = some beta + · have hc : c = alpha := by simpa [changeColor, hb', hab, hab.symm] using hec.symm + have hf : phi f = some alpha := hc ▸ hfc + exact sf (component_step se hadj (Or.inr hb') (Or.inl hf)) + · have he : phi e = some c := by simpa [changeColor, ha', hb'] using hec + exact (hproper hef hadj he) hfc + /- + have hce : phi e = some alpha ∨ phi e = some beta := by + rw [hswap e] at hec + simp only [se, ↓reduceIte] at hec + by_cases ha' : phi e = some alpha + · exact Or.inl ha' + · by_cases hb' : phi e = some beta + · exact Or.inr hb' + · simp [changeColor, ha', hb'] at hec + have hcc : c = alpha ∨ c = beta := by + rw [hswap e] at hec + rcases hce with ha' | hb' + · simp [changeColor, ha'] at hec + exact Or.inr (Option.some.inj hec).symm + · simp [changeColor, hb', hab] at hec + exact Or.inl (Option.some.inj hec).symm + have hfc' : phi f = some c := by + rw [hswap f] at hfc + simp [sf] at hfc + have hcf : phi f = some alpha ∨ phi f = some beta := by + rcases hcc with rfl | rfl + · exact Or.inl hfc' + · exact Or.inr hfc' + exact sf (component_step se hadj hce hcf) -/ + · by_cases sf : ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · rw [hswap e] at hec + rw [ite_eq_right se] at hec + rw [hswap f] at hfc + rw [ite_eq_left sf] at hfc + by_cases ha' : phi f = some alpha + · have hc : c = beta := by simpa [changeColor, ha'] using hfc.symm + have he : phi e = some beta := hc ▸ hec + obtain ⟨v, hve, hvf⟩ := hadj + exact se (component_step sf ⟨v, hvf, hve⟩ (Or.inl ha') (Or.inr he)) + · by_cases hb' : phi f = some beta + · have hc : c = alpha := by simpa [changeColor, hb', hab, hab.symm] using hfc.symm + have he : phi e = some alpha := hc ▸ hec + obtain ⟨v, hve, hvf⟩ := hadj + exact se (component_step sf ⟨v, hvf, hve⟩ (Or.inr hb') (Or.inl he)) + · have hf : phi f = some c := by simpa [changeColor, ha', hb'] using hfc + obtain ⟨v, hve, hvf⟩ := hadj + exact (hproper hef.symm ⟨v, hvf, hve⟩ hf) hec + /- + have hce : phi e ≠ some alpha ∧ phi e ≠ some beta := by + constructor <;> intro hce + · have : se := by + rw [hswap e] at hec + simp [changeColor, hce] at hec + exact False.elim (by simpa [hce] using hec) + exact this + · have : se := by + rw [hswap e] at hec + simp [changeColor, hce] at hec + exact False.elim (by simpa [hce] using hec) + exact this + have hcc : c = alpha ∨ c = beta := by + rw [hswap f] at hfc + by_cases ha' : phi f = some alpha + · simp [changeColor, ha'] at hfc + exact Or.inl (Option.some.inj hfc).symm + · by_cases hb' : phi f = some beta + · simp [changeColor, ha', hb', hab] at hfc + exact Or.inr (Option.some.inj hfc).symm + · simp [changeColor, ha', hb'] at hfc + have hec' : phi e = some c := by + rw [hswap e] at hec + simp [se] at hec + have hce' : phi e = some alpha ∨ phi e = some beta := by + rcases hcc with rfl | rfl + · exact Or.inl hec' + · exact Or.inr hec' + have hcf' : phi f = some alpha ∨ phi f = some beta := by + rcases hcc with rfl | rfl + · exact Or.inl hfc' + · exact Or.inr hfc' + exact se (component_step sf hadj.symm hcf' hce') -/ + · rw [hswap e] at hec + rw [ite_eq_right se] at hec + rw [hswap f] at hfc + rw [ite_eq_right sf] at hfc + exact hproper hef hadj hec hfc + refine ⟨hproper', ?_, ?_, ?_, fun f hf => hfixed hf⟩ + · unfold IsOneEdgeUncolored + constructor + · rw [hswap e0] + by_cases h : ∃ z ∈ roots, Sum.inr e0 ∈ TwoColorComponent G phi alpha beta z + · simp [changeColor, hone.1] + · simp [h, hone.1] + · intro f hfe + obtain ⟨d, hd⟩ := hone.2 f hfe + rw [hswap f] + by_cases h : ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · rw [ite_eq_left h] + by_cases ha' : phi f = some alpha + · exact ⟨beta, by simp [changeColor, ha']⟩ + · by_cases hb' : phi f = some beta + · exact ⟨alpha, by simp [changeColor, hb']⟩ + · exact ⟨d, by simp only [ha', ↓reduceIte, hb', changeColor]; exact hd⟩ + · rw [ite_eq_right h] + exact ⟨d, hd⟩ + · unfold StableColoring + constructor + · intro f hf h + exact hfixed hf + · intro v hv + unfold MissingColors PresentColors + congr 1 + ext d + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + constructor <;> intro hd + · obtain ⟨f, hfv, hfc⟩ := hd + exact ⟨f, hfv, by simpa [hfixed ⟨v, hv, hfv⟩] using hfc⟩ + · obtain ⟨f, hfv, hfc⟩ := hd + exact ⟨f, hfv, by simpa [hfixed ⟨v, hv, hfv⟩] using hfc⟩ + · unfold TreeColoringInvariant + constructor + · intro j hj + apply hfixed + obtain ⟨i, hi⟩ := T.attaches j + exact ⟨T.vertex j.succ, by + unfold TreeSequenceVertexSet + simp, by + unfold Incident + rw [hi] + simp⟩ + · intro v hv + unfold MissingColors PresentColors + congr 1 + ext d + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + constructor <;> intro hd + · obtain ⟨f, hfv, hfc⟩ := hd + exact ⟨f, hfv, by simpa [hfixed ⟨v, hv, hfv⟩] using hfc⟩ + · obtain ⟨f, hfv, hfc⟩ := hd + exact ⟨f, hfv, by simpa [hfixed ⟨v, hv, hfv⟩] using hfc⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean b/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean new file mode 100644 index 0000000000..4beb349945 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean @@ -0,0 +1,1877 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.SplitSwapData +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.TerminalStoredColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerTransport +public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerReconstruction +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTransTrees + +public import LeanPool.GoldbergSeymour.LowerRoundProperties + +/-! +# P2880_T1_Outside Prefix Branch + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable abbrev helperCorrMX773.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [inst : Fintype V] → + [inst_1 : Fintype E] → + [inst_2 : DecidableEq V] → + [inst_3 : DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + let X : TreeSequence G e0 := + HierarchyFullTailPrefix C + (HierarchyPathNumber C.hierarchy - (1 : ℕ)); + let m : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + (ettX : + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput X P.coloring) → + ettX.rounds = m.rounds → + ettX.series ≍ m.series → + let seriesCast : + TashkinovSeries G k + P.corresponding.replacementETT.rounds e0 + P.corresponding.replacementInput := + @Eq.rec Nat + (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_3 G k e0 input T phi ett) + (fun (x : Nat) + (_ : + @Eq Nat + (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T phi ett) + x) ↦ + @TashkinovSeries V E inst inst_1 inst_3 G k x e0 + (@CorrespondingExtendedTashkinovTree.replacementInput + V E inst inst_1 inst_3 G k e0 input T phi + ett + (@HierarchyReplacementPresentation.coloring + V E inst inst_1 inst_2 inst_3 G k e0 input + T phi ett base C ctx P) + T + (@HierarchyReplacementPresentation.corresponding + V E inst inst_1 inst_2 inst_3 G k e0 input + T phi ett base C ctx P))) + (@CorrespondingExtendedTashkinovTree.replacementSeries + V E inst inst_1 inst_3 G k e0 input T phi ett + (@HierarchyReplacementPresentation.coloring V E + inst inst_1 inst_2 inst_3 G k e0 input T phi + ett base C ctx P) + T + (@HierarchyReplacementPresentation.corresponding + V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C ctx P)) + (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput + V E inst inst_1 inst_3 G k e0 input T phi ett + (@HierarchyReplacementPresentation.coloring V + E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C ctx P) + T + (@HierarchyReplacementPresentation.corresponding + V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C ctx P)) + T + (@HierarchyReplacementPresentation.coloring V E + inst inst_1 inst_2 inst_3 G k e0 input T phi + ett base C ctx P) + (@CorrespondingExtendedTashkinovTree.replacementETT + V E inst inst_1 inst_3 G k e0 input T phi ett + (@HierarchyReplacementPresentation.coloring V + E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C ctx P) + T + (@HierarchyReplacementPresentation.corresponding + V E inst inst_1 inst_2 inst_3 G k e0 input T + phi ett base C ctx P))) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := P.corresponding.rungAgreement + simp_all only); + m.series = seriesCast → + (∀ {r s : ℕ} (h : r = s) + (ser : + TashkinovSeries G k s e0 + P.corresponding.replacementInput) + (i : Fin (r + (1 : ℕ))), + (@Eq.rec Nat s + (fun (x : Nat) (_ : @Eq Nat s x) ↦ + @TashkinovSeries V E inst inst_1 + inst_3 G k x e0 + (@CorrespondingExtendedTashkinovTree.replacementInput + V E inst inst_1 inst_3 G k e0 + input T phi ett + (@HierarchyReplacementPresentation.coloring + V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + P) + T + (@HierarchyReplacementPresentation.corresponding + V E inst inst_1 inst_2 inst_3 G + k e0 input T phi ett base C ctx + P))) + ser r + (@Eq.symm Nat r s h)).data.coloring + i = + ser.data.coloring + (Fin.cast + (congrArg (fun (z : ℕ) ↦ z + (1 : ℕ)) h) + i)) → + CorrespondingExtendedTashkinovTree G k e0 m + P.coloring X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P X m ettX hroundX hseriesX seriesCast + hsourceSeries castColor + exact { + replacementInput := P.corresponding.replacementInput + replacementSeries := m.series + replacementETT := ettX + rungAgreement := hroundX + seriesPresentation := hseriesX + finalGeneratingColoring := m.generatingColoring + ladderTreesAgree := by intro i; rfl + storedColorsAgree := by intro i; rfl + connectingEdgesAgree := by intro i; rfl + extensionKindsAgree := by intro i; rfl + replacementProper := by + intro i + rw [hsourceSeries] + rw [castColor P.corresponding.rungAgreement + P.corresponding.replacementSeries i] + exact P.corresponding.replacementProper + (Fin.cast (congrArg (fun r => r + 1) + P.corresponding.rungAgreement) i) + replacementOneUncolored := by + intro i + rw [hsourceSeries] + rw [castColor P.corresponding.rungAgreement + P.corresponding.replacementSeries i] + exact P.corresponding.replacementOneUncolored + (Fin.cast (congrArg (fun r => r + 1) + P.corresponding.rungAgreement) i) + replacementStable := by + intro i + constructor + · intro f hf h + rfl + · intro v hv + rfl } + +private abbrev helperContinuation1640Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (sigma : + PartialEdgeColoring E k), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring) (HX : TashkinovHierarchy ettX baseX) (hcountX : + HX.dividerCount = H.dividerCount) (hstagesX : + ∀ (j : Fin (HX.dividerCount + (1 : ℕ))), HX.stage j.castSucc = H.stage (Fin.cast ( + by omega + ) j).castSucc ∧ HierarchyStarredStage HX j = HierarchyStarredStage H (Fin.cast ( + by omega + ) j)) (hpositionsX : + ∀ (i : Fin HX.dividerCount), (↑(HX.dividerPosition i) : ℕ) = (↑(H.dividerPosition (Fin.cast + hcountX i)) : ℕ)) (goodX : GoodHierarchy HX) (hcolorsX : + ∀ (j : Fin (HX.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt HX j = + HierarchyStoredColorsAt H (Fin.cast (congrArg (fun n : ℕ => n + 1) hcountX) j) ∧ + HierarchyStageMissingColors HX j = HierarchyStageMissingColors H (Fin.cast (congrArg (fun + n : ℕ => n + 1) hcountX) j) ∧ + ∀ (eta : Fin k), goodX.gamma j eta = P.counterexample.good.gamma (Fin.cast (congrArg (fun n : + ℕ => n + 1) hcountX) j) eta ∧ HierarchySegmentColors HX j eta ⊆ HierarchySegmentColors H + (Fin.cast (congrArg (fun n : ℕ => n + 1) hcountX) j) eta) (corrPrefix : + CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : HierarchyBase + corrPrefix.replacementETT sigma) (KPrefix : TashkinovHierarchy corrPrefix.replacementETT + basePrefix) (goodPrefix : GoodHierarchy KPrefix) (samePrefix : SameGoodHierarchy goodX + goodPrefix) (corrFull : CorrespondingExtendedTashkinovTree G k e0 m sigma T) (hmaximumFull + : MaximumProperty corrFull.replacementETT) (baseFull : HierarchyBase + corrFull.replacementETT sigma) (KFull : TashkinovHierarchy corrFull.replacementETT + baseFull) (hsameFull : SameHierarchyStages H KFull) (Ktransport : TashkinovHierarchy + corrFull.replacementETT baseFull) (hcountTransport : Ktransport.dividerCount = + KPrefix.dividerCount) (hstagesTransport : + ∀ (j : Fin (Ktransport.dividerCount + (1 : ℕ))), + have jo : Fin (KPrefix.dividerCount + (1 : ℕ)) := Fin.cast ( + by omega + ) j; Ktransport.stage j.castSucc = KPrefix.stage jo.castSucc ∧ HierarchyStarredStage + Ktransport j = HierarchyStarredStage KPrefix jo ∧ HierarchyStoredColorsAt Ktransport j = + HierarchyStoredColorsAt KPrefix jo ∧ HierarchyStageMissingColors Ktransport j = + HierarchyStageMissingColors KPrefix jo) (hpositionsTransport : + ∀ (i : Fin Ktransport.dividerCount), (↑(Ktransport.dividerPosition i) : ℕ) = + (↑(KPrefix.dividerPosition (Fin.cast hcountTransport i)) : ℕ)) (goodFull : GoodHierarchy + Ktransport) (hsamePrefixFull : + ∀ (j : Fin (Ktransport.dividerCount + (1 : ℕ))), + have jo : Fin (KPrefix.dividerCount + (1 : ℕ)) := Fin.cast ( + by omega + ) j; + ∀ (eta : Fin k), goodFull.gamma j eta = goodPrefix.gamma jo eta), + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT sigma T), + MaximumProperty corr.replacementETT ∧ + ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT newBase) (good : GoodHierarchy K), SameGoodHierarchy + P.counterexample.good good + +private abbrev helperContinuation1844Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k) (S : P2880_T1_SplitSwapData G k e0 input T phi ett base + C ctx P alpha beta sigma), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring) (hcoreX : baseX.core = P.replacementBase.core) (hclosureX : + baseX.closure = P.replacementBase.closure) (HX : TashkinovHierarchy ettX baseX) (hcountX : + HX.dividerCount = H.dividerCount) (hstagesX : + ∀ (j : Fin (HX.dividerCount + (1 : ℕ))), HX.stage j.castSucc = H.stage (Fin.cast ( + by omega + ) j).castSucc ∧ HierarchyStarredStage HX j = HierarchyStarredStage H (Fin.cast ( + by omega + ) j)) (hpositionsX : + ∀ (i : Fin HX.dividerCount), (↑(HX.dividerPosition i) : ℕ) = (↑(H.dividerPosition (Fin.cast + hcountX i)) : ℕ)) (goodX : GoodHierarchy HX) (hcolorsX : + ∀ (j : Fin (HX.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt HX j = + HierarchyStoredColorsAt H (Fin.cast (congrArg (fun n : ℕ => n + 1) hcountX) j) ∧ + HierarchyStageMissingColors HX j = HierarchyStageMissingColors H (Fin.cast (congrArg (fun + n : ℕ => n + 1) hcountX) j) ∧ + ∀ (eta : Fin k), goodX.gamma j eta = P.counterexample.good.gamma (Fin.cast (congrArg (fun n : + ℕ => n + 1) hcountX) j) eta ∧ HierarchySegmentColors HX j eta ⊆ HierarchySegmentColors H + (Fin.cast (congrArg (fun n : ℕ => n + 1) hcountX) j) eta) (hsigmaProper : + IsProperEdgeColoring G sigma) (hsigmaOne : IsOneEdgeUncolored sigma e0) (hstableX : + StableColoring X (TashkinovStoredColors ettX.series.data (Fin.last ettX.rounds)) + P.coloring sigma), + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors m.series.data n; + ∀ (hstableTn : StableColoring Tn Dn P.coloring sigma) (hmod : ModColoring m sigma) (hroute : + m.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + sigma Tn T ∨ (m.series.data.kind n = some TashkinovExtensionKind.SE ∨ m.series.data.kind n + = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), m.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T) (hNT : + TreeSequenceInitialSegment Tn T) (hNstrict : Tn.length < T.length) (corrPrefix : + CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : HierarchyBase + corrPrefix.replacementETT sigma) (KPrefix : TashkinovHierarchy corrPrefix.replacementETT + basePrefix) (goodPrefix : GoodHierarchy KPrefix) (samePrefix : SameGoodHierarchy goodX + goodPrefix) (hkindX : ettX.series.data.kind (Fin.last ettX.rounds) = m.series.data.kind + n), + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT sigma T), + MaximumProperty corr.replacementETT ∧ + ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT newBase) (good : GoodHierarchy K), SameGoodHierarchy + P.counterexample.good good + +private theorem helper_hrecolorX_82.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), P2880_T1_SplitSwapData G k e0 input T phi ett base C + ctx P alpha beta sigma → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); OutsideKempeRecoloring X P.coloring sigma alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X + refine ⟨S.distinct, {Sum.inl (T.vertex (Fin.last T.length))}, ?_, ?_⟩ + · intro z hz v hv + simp only [Finset.mem_singleton] at hz + subst z + intro hvX + exact S.splitOutside v hvX hv + · intro f + have hswap := S.swapped + rw [hswap] + simp [TwoColorComponentSwap] + +private theorem helper_segmentTrans_194.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B + C → TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨le_trans hab hbc, ?_, ?_⟩ + · intro i + calc + C.vertex (Fin.castLE (Nat.succ_le_succ hbc) + (Fin.castLE (Nat.succ_le_succ hab) i)) = + B.vertex (Fin.castLE (Nat.succ_le_succ hab) i) := + hvbc (Fin.castLE (Nat.succ_le_succ hab) i) + _ = A.vertex i := hvab i + · intro i + calc + C.edge (Fin.castLE hbc (Fin.castLE hab i)) = B.edge (Fin.castLE hab i) := + hebc _ + _ = A.edge i := heab i + +private theorem helper_hTnCore_213.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; + TreeSequenceInitialSegment Tn P.replacementBase.core := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P m n Tn + by_cases hpe : m.series.data.kind n = some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨u⟩⟩ := P.replacementBase.parallel hpe + exact u.leftSegment + · rw [P.replacementBase.nonparallel hpe] + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + +private theorem helper_hstableTn_223.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), P2880_T1_SplitSwapData G k e0 input T phi ett base C + ctx P alpha beta sigma → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring), + StableColoring X (TashkinovStoredColors ettX.series.data (Fin.last ettX.rounds)) + P.coloring sigma → + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors m.series.data n; TreeSequenceVertexSet Tn ⊆ + TreeSequenceVertexSet X → StableColoring Tn Dn P.coloring sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m ettX hstableX n Tn + Dn hTnXvertices + constructor + · intro f hf hcontrol + rcases hf with ⟨v, hv, hinc⟩ + exact S.incidentFixed v (hTnXvertices hv) f hinc + · intro v hv + exact hstableX.2 v (hTnXvertices hv) + +private theorem helper_hroute_241.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), P2880_T1_SplitSwapData G k e0 input T phi ett base C + ctx P alpha beta sigma → + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; m.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence sigma Tn T ∨ (m.series.data.kind + n = some TashkinovExtensionKind.SE ∨ m.series.data.kind n = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), m.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S m n Tn + rcases S.prefixRoute with hp | hs + · left + refine ⟨hp.1, ?_⟩ + exact Relation.ReflTransGen.trans hp.2 S.newSuffix + · right + refine ⟨hs.1, ?_⟩ + obtain ⟨f, seed, hconn, hadjoin, hseq⟩ := hs.2 + exact ⟨f, seed, hconn, hadjoin, + Relation.ReflTransGen.trans hseq S.newSuffix⟩ + +private theorem helper_hNT_259.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring) (_ : TashkinovHierarchy ettX baseX), + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; TreeSequenceInitialSegment Tn T + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P X m ettX baseX HX n Tn + have hi : (⟨m.rounds, by omega⟩ : Fin (m.rounds + 2)) = n.castSucc := by + apply Fin.ext + rfl + change TreeSequenceInitialSegment + (m.series.data.tree n.castSucc) T + rw [← hi] + exact m.abovePenultimate + +private theorem helper_hNstrict_267.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring) (_ : TashkinovHierarchy ettX baseX), + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; Tn.length < T.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P X m ettX baseX HX n Tn + have hi : (⟨m.rounds, by omega⟩ : Fin (m.rounds + 2)) = n.castSucc := by + apply Fin.ext + rfl + change (m.series.data.tree n.castSucc).length < T.length + rw [← hi] + exact m.strictAbovePenultimate + +private theorem helper_hkindX_358.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring), + ettX.rounds = m.rounds → ettX.series ≍ m.series → + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; ettX.series.data.kind (Fin.last + ettX.rounds) = m.series.data.kind n := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P X m ettX hroundX hseriesX n + let seriesCastX := hroundX ▸ ettX.series + have hcastX : HEq seriesCastX ettX.series := by + have typeLink := congrArg (fun r => TashkinovSeries G k r e0 + P.corresponding.replacementInput) hroundX + simp [seriesCastX] + have heqX : seriesCastX = m.series := eq_of_heq (HEq.trans hcastX hseriesX) + have hkind := congrArg + (fun s : TashkinovSeries G k m.rounds e0 + P.corresponding.replacementInput => s.data.kind n) heqX + have castKind {r s : ℕ} (h : r = s) + (ser : TashkinovSeries G k r e0 P.corresponding.replacementInput) + (i : Fin (s + 1)) : + (h ▸ ser).data.kind i = + ser.data.kind (Fin.cast (congrArg (fun z => z + 1) h.symm) i) := by + cases h + rfl + have hindex : Fin.cast (congrArg (fun z => z + 1) hroundX.symm) n = + Fin.last ettX.rounds := by + apply Fin.ext + simp [n] + have hkindCast : seriesCastX.data.kind n = + ettX.series.data.kind (Fin.last ettX.rounds) := by + rw [castKind hroundX ettX.series n, hindex] + exact hkindCast.symm.trans hkind + +private theorem helper_branch_392.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), P2880_T1_SplitSwapData G k e0 input T phi ett base C + ctx P alpha beta sigma → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring), baseX.closure = P.replacementBase.closure → + ∀ (HX : TashkinovHierarchy ettX baseX) (goodX : GoodHierarchy HX), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → StableColoring X (TashkinovStoredColors + ettX.series.data (Fin.last ettX.rounds)) P.coloring sigma → + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors m.series.data n; StableColoring Tn Dn + P.coloring sigma → (m.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ (m.series.data.kind n = some + TashkinovExtensionKind.SE ∨ m.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), m.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T) → + ∀ (corrPrefix : CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : + HierarchyBase corrPrefix.replacementETT sigma) (KPrefix : TashkinovHierarchy + corrPrefix.replacementETT basePrefix) (goodPrefix : GoodHierarchy KPrefix), + SameGoodHierarchy goodX goodPrefix → ettX.series.data.kind (Fin.last ettX.rounds) = + m.series.data.kind n → m.series.data.kind n = some TashkinovExtensionKind.PE → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), MaximumProperty + corr.replacementETT ∧ + ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT newBase), newBase.closure = basePrefix.closure ∧ SameHierarchyStages H + K := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m H ettX baseX + hclosureX HX goodX hsigmaProper hsigmaOne hstableX n Tn Dn hstableTn hroute corrPrefix + basePrefix KPrefix goodPrefix samePrefix hkindX hpe + rcases hroute with ⟨_, hbuilt⟩ | hnonpe + · have hbaseParallel := P.replacementBase.parallel hpe + rcases hbaseParallel with ⟨_, _, ⟨union⟩⟩ + have hcoreVertices : + TreeSequenceVertexSet P.replacementBase.core ⊆ + TreeSequenceVertexSet X := + TreeSequenceInitialSegmentVertexSetSubset S.coreInSplit + have hclosureVertices : + TreeSequenceVertexSet P.replacementBase.closure ⊆ + TreeSequenceVertexSet X := by + intro v hv + apply hcoreVertices + rw [union.vertexSet] + exact Finset.mem_union_right _ hv + have hcombined : CombinedStableColoring Tn + P.replacementBase.closure Dn P.coloring sigma := by + constructor + · exact hstableTn + · constructor + · intro f hf _ + rcases hf with ⟨v, hv, hinc⟩ + exact S.incidentFixed v (hclosureVertices hv) f hinc + · intro v hv + exact hstableX.2 v (hclosureVertices hv) + have hsplit := HierarchySplitter G k e0 + P.corresponding.replacementInput T P.coloring sigma m P.maximum + P.counterexample.positive P.minimumContext.lowerRung + P.replacementBase H hpe P.minimumContext.proper + P.minimumContext.oneEdgeUncolored hsigmaProper hsigmaOne + hcombined hbuilt + rcases hsplit with ⟨corr, hmaximum, newBase, K, hsame⟩ + have hclosure : newBase.closure = basePrefix.closure := by + have hclFull := hsame.2.2.2.2.2 hpe + have hclPrefix := samePrefix.1.2.2.2.2.2 (hkindX.trans hpe) + exact hclFull.symm.trans (hclosureX.symm.trans hclPrefix) + exact ⟨corr, hmaximum, newBase, K, hclosure, hsame⟩ + · rcases hnonpe.1 with hse | hre + · have heq : some TashkinovExtensionKind.SE = + some TashkinovExtensionKind.PE := hse.symm.trans hpe + cases heq + · have heq : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := hre.symm.trans hpe + cases heq + +private theorem helper_hseries_463.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (sigma : + PartialEdgeColoring E k), + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds e0 + corr.replacementInput := cast (congrArg (fun (r : ℕ) ↦ TashkinovSeries G k r e0 + corr.replacementInput) ( + by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + )) corr.replacementSeries; corr.replacementETT.series = replacementSeries := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P sigma m corr replacementSeries + exact ((cast_eq_iff_heq + (e := congrArg (fun r => TashkinovSeries G k r e0 + corr.replacementInput) corr.rungAgreement.symm) + (a := corr.replacementSeries) + (a' := corr.replacementETT.series)).2 + corr.seriesPresentation.symm).symm + +private theorem helper_hkindEq_493.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (sigma : + PartialEdgeColoring E k), + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds e0 + corr.replacementInput := cast (congrArg (fun (r : ℕ) ↦ TashkinovSeries G k r e0 + corr.replacementInput) ( + by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + )) corr.replacementSeries; ( + ∀ {a b : ℕ} (h : a = b) (s : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (cast (congrArg (fun (r : ℕ) ↦ TashkinovSeries G k r e0 corr.replacementInput) h) + s).data.kind i = s.data.kind (Fin.cast ( + by omega + ) i)) → corr.replacementETT.series = replacementSeries → + ∀ (i : Fin (corr.replacementETT.rounds + (1 : ℕ))), corr.replacementETT.series.data.kind i = + m.series.data.kind (Fin.cast ( + by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P sigma m corr replacementSeries castKind + hseries i + rw [hseries] + exact (castKind corr.rungAgreement.symm corr.replacementSeries i).trans + (corr.extensionKindsAgree + (Fin.cast (congrArg (fun r => r + 1) corr.rungAgreement) i)) + +private theorem helper_hkindP_512.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; m.series.data.kind n = some + TashkinovExtensionKind.SE ∨ m.series.data.kind n = some TashkinovExtensionKind.RE → + m.series.data.kind (Fin.last m.rounds) ≠ some TashkinovExtensionKind.PE := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P m n hkind hp + rcases hkind with hse | hre + · rw [hp] at hse + cases hse + · rw [hp] at hre + cases hre + +private theorem helper_branch_667.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), P2880_T1_SplitSwapData G k e0 input T phi ett base C + ctx P alpha beta sigma → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ (corrPrefix : CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : + HierarchyBase corrPrefix.replacementETT sigma) (KPrefix : TashkinovHierarchy + corrPrefix.replacementETT basePrefix) (goodPrefix : GoodHierarchy KPrefix), + ∀ eta ∈ HierarchyStoredColorsAt KPrefix (Fin.last KPrefix.dividerCount), + let _ : Fin (KPrefix.dividerCount + (1 : ℕ)) := Fin.last KPrefix.dividerCount; eta ∈ + HierarchyStoredColorsAt H q → + ∀ ⦃c : Fin k⦄, c ∈ goodPrefix.gamma (Fin.last KPrefix.dividerCount) eta → + ∀ (r : Fin T.length), (HierarchyStarredStage KPrefix (Fin.last KPrefix.dividerCount)).length ≤ + (↑r : ℕ) → (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition sigma T eta) : ℕ) T.length → + sigma (T.edge r) = some c → alpha ∈ P.counterexample.good.gamma q eta ∨ beta ∈ + P.counterexample.good.gamma q eta → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m H q corrPrefix + basePrefix KPrefix goodPrefix eta heta qP hstoreOld c hcG r hlo hhi hcol haffected + have hcut := S.gammaCutoff eta hstoreOld haffected + have hfirst := S.storedFirst eta hstoreOld + have hrX : r.val < X.length := by + have hlt := (lt_min_iff.mp hhi).1 + have hle : (HierarchyFirstMissingPosition sigma T eta).val ≤ X.length := by + rw [hfirst] + exact hcut + exact lt_of_lt_of_le hlt hle + have hprefixCut := HierarchyFirstMissingPositionPrefixCutoff sigma X T + S.splitInFull eta X.length le_rfl + let rX : Fin X.length := ⟨r.val, hrX⟩ + have hidx : (Fin.castLE (by have hlen := S.splitInFull.1; omega) rX) = r := by + apply Fin.ext + rfl + have hedge : T.edge r = X.edge rX := by + have he := S.splitInFull.2.2 rX + rw [hidx] at he + exact he.symm + have hhiX : r.val < min (HierarchyFirstMissingPosition sigma X eta).val X.length := by + rw [hprefixCut] + exact (lt_min_iff).2 ⟨(lt_min_iff.mp hhi).1, hrX⟩ + have hsegX : c ∈ HierarchySegmentColors KPrefix qP eta := by + unfold HierarchySegmentColors + have hterm : KPrefix.stage qP.succ = X := by + simpa [qP] using KPrefix.terminalStage + rw [hterm] + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨rX, ?_, hhiX, ?_⟩ + · simpa [rX, qP] using hlo + · rw [← hedge] + exact hcol + have havo := goodPrefix.avoidance qP eta heta hcG + exact (Finset.mem_sdiff.mp havo).2 hsegX + +private theorem helper_branch_700.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), P2880_T1_SplitSwapData G k e0 input T phi ett base C + ctx P alpha beta sigma → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ (corrPrefix : CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : + HierarchyBase corrPrefix.replacementETT sigma) (KPrefix : TashkinovHierarchy + corrPrefix.replacementETT basePrefix) (goodPrefix : GoodHierarchy KPrefix) (eta : Fin k), + let qP : Fin (KPrefix.dividerCount + (1 : ℕ)) := Fin.last KPrefix.dividerCount; eta ∈ + HierarchyStoredColorsAt H q → P.counterexample.good.gamma q eta = goodPrefix.gamma qP eta + → HierarchyStarredStage KPrefix qP = HierarchyStarredStage H q → + ∀ ⦃c : Fin k⦄, c ∈ goodPrefix.gamma (Fin.last KPrefix.dividerCount) eta → + ∀ (r : Fin T.length), (HierarchyStarredStage KPrefix (Fin.last KPrefix.dividerCount)).length ≤ + (↑r : ℕ) → (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition sigma T eta) : ℕ) T.length → + sigma (T.edge r) = some c → ¬(alpha ∈ P.counterexample.good.gamma q eta ∨ beta ∈ + P.counterexample.good.gamma q eta) → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m H q corrPrefix + basePrefix KPrefix goodPrefix eta qP hstoreOld hgammaOldPrefix hstarOld c hcG r hlo hhi + hcol haffected + have hgammaMem : c ∈ P.counterexample.good.gamma q eta := by + rw [hgammaOldPrefix] + exact hcG + have hcnotAlpha : c ≠ alpha := by + intro he + apply haffected + exact Or.inl (he ▸ hgammaMem) + have hcnotBeta : c ≠ beta := by + intro he + apply haffected + exact Or.inr (he ▸ hgammaMem) + have hcolOld : P.coloring (T.edge r) = some c := by + rw [S.swapped] at hcol + unfold TwoColorComponentSwap at hcol + split_ifs at hcol with hmem ha hb + · exact False.elim (hcnotBeta (Option.some.inj hcol).symm) + · exact False.elim (hcnotAlpha (Option.some.inj hcol).symm) + · exact hcol + · exact hcol + have hltOld : r.val < (HierarchyFirstMissingPosition P.coloring T eta).val := by + have hlt := (lt_min_iff.mp hhi).1 + rw [S.storedFirst eta hstoreOld] at hlt + exact hlt + have hsegOld : c ∈ HierarchySegmentColors H q eta := by + unfold HierarchySegmentColors + have hterm : H.stage q.succ = T := by + convert H.terminalStage using 1 + apply congrArg H.stage + apply Fin.ext + simp [q] + rw [hterm] + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨r, ?_, ?_, hcolOld⟩ + · rw [← hstarOld] + exact hlo + · exact (lt_min_iff.mpr ⟨hltOld, r.isLt⟩) + have havo := P.counterexample.good.avoidance q eta hstoreOld hgammaMem + exact (Finset.mem_sdiff.mp havo).2 hsegOld + +private theorem helper_hseriesCast_889.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + V] [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : + ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) (C : + HierarchyCounterexample base) (ctx : HierarchyMinimumCounterexampleContext G k e0 input T + phi ett base C) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let _ : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let seriesCast : TashkinovSeries G k P.corresponding.replacementETT.rounds e0 + P.corresponding.replacementInput := @Eq.rec Nat (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T phi ett) (fun (x : Nat) (_ : @Eq Nat + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T phi ett) x) ↦ + @TashkinovSeries V E inst inst_1 inst_3 G k x e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 input + T phi ett (@HierarchyReplacementPresentation.coloring V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx P) T (@HierarchyReplacementPresentation.corresponding V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx P))) + (@CorrespondingExtendedTashkinovTree.replacementSeries V E inst inst_1 inst_3 G k e0 input + T phi ett (@HierarchyReplacementPresentation.coloring V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx P) T (@HierarchyReplacementPresentation.corresponding V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx P)) (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_3 G k e0 (@CorrespondingExtendedTashkinovTree.replacementInput V E + inst inst_1 inst_3 G k e0 input T phi ett (@HierarchyReplacementPresentation.coloring V E + inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx P) T + (@HierarchyReplacementPresentation.corresponding V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx P)) T (@HierarchyReplacementPresentation.coloring V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx P) + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 input T + phi ett (@HierarchyReplacementPresentation.coloring V E inst inst_1 inst_2 inst_3 G k e0 + input T phi ett base C ctx P) T (@HierarchyReplacementPresentation.corresponding V E inst + inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx P))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + omega + ); seriesCast ≍ P.corresponding.replacementSeries := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P m seriesCast + have typeLink : + TashkinovSeries G k ett.rounds e0 P.corresponding.replacementInput = + TashkinovSeries G k m.rounds e0 P.corresponding.replacementInput := + congrArg (fun r => TashkinovSeries G k r e0 + P.corresponding.replacementInput) P.corresponding.rungAgreement.symm + simp [seriesCast] + +private theorem helper_htree_1031.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (sigma : + PartialEdgeColoring E k), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring) (_ : TashkinovHierarchy ettX baseX), + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds e0 + corr.replacementInput := cast (congrArg (fun (r : ℕ) ↦ TashkinovSeries G k r e0 + corr.replacementInput) ( + by + first + | omega + | ( have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + all_goals omega) + )) corr.replacementSeries; ( + ∀ {a b : ℕ} (h : a = b) (s : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (2 + : ℕ))), (cast (congrArg (fun (r : ℕ) ↦ TashkinovSeries G k r e0 corr.replacementInput) h) + s).data.tree i = s.data.tree (Fin.cast ( + by + omega + ) i)) → corr.replacementETT.series = replacementSeries → + let terminalIndex : Fin corr.replacementETT.rounds := Fin.cast ( + by + first + | omega + | ( have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + all_goals omega) + ) (⟨m.rounds - (1 : ℕ), + have hp : (1 : ℕ) ≤ m.rounds := m.roundsPositive; Decidable.byContradiction fun (a : ¬m.rounds + - (1 : ℕ) < m.rounds) ↦ + by + omega + ⟩ : Fin m.rounds); corr.replacementETT.series.data.tree terminalIndex.succ.castSucc = Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P sigma X m ettX baseX HX n Tn corr + replacementSeries castTree hseries terminalIndex + rw [hseries] + calc + replacementSeries.data.tree terminalIndex.succ.castSucc = + corr.replacementSeries.data.tree + (Fin.cast (congrArg (fun r => r + 2) corr.rungAgreement) + terminalIndex.succ.castSucc) := by + simpa [replacementSeries] using + castTree corr.rungAgreement.symm corr.replacementSeries + terminalIndex.succ.castSucc + _ = m.series.data.tree n.castSucc := by + convert corr.ladderTreesAgree + (Fin.cast corr.rungAgreement terminalIndex) using 1 + · congr 1 + · congr 1 + apply Fin.ext + have hp : m.rounds - 1 + 1 = m.rounds := by + exact Nat.sub_add_cancel (by have := m.roundsPositive; omega) + simp [terminalIndex, hp, n] + +private theorem helper_htreeFinal_1056.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (sigma : + PartialEdgeColoring E k), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring) (_ : TashkinovHierarchy ettX baseX), + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), + let terminalIndex : Fin corr.replacementETT.rounds := Fin.cast ( + by + first + | omega + | ( have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement + (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) + all_goals omega) + ) (⟨m.rounds - (1 : ℕ), + have hp : (1 : ℕ) ≤ m.rounds := m.roundsPositive; Decidable.byContradiction fun (a : ¬m.rounds + - (1 : ℕ) < m.rounds) ↦ + by + omega + ⟩ : Fin m.rounds); corr.replacementETT.series.data.tree terminalIndex.succ.castSucc = Tn → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P sigma X m ettX baseX HX n Tn corr + terminalIndex htree + have hi : (Fin.last corr.replacementETT.rounds).castSucc = + terminalIndex.succ.castSucc := by + apply Fin.ext + have hp : m.rounds - 1 + 1 = m.rounds := by + exact Nat.sub_add_cancel (by have := m.roundsPositive; omega) + simp [terminalIndex, hp, corr.rungAgreement] + rw [hi] + exact htree + +private theorem helper_branch_1125.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (sigma : + PartialEdgeColoring E k), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring) (_ : TashkinovHierarchy ettX baseX), + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; ModColoring m sigma → + TreeSequenceInitialSegment Tn T → Tn.length < T.length → + ∀ (corrPrefix : CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : + HierarchyBase corrPrefix.replacementETT sigma), ((m.series.data.kind n = some + TashkinovExtensionKind.SE ∨ m.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), m.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), MaximumProperty + corr.replacementETT ∧ + ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT newBase), newBase.closure = basePrefix.closure ∧ SameHierarchyStages H + K := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P sigma X m H ettX baseX HX n Tn hmod hNT + hNstrict corrPrefix basePrefix hnonpeRoute + rcases hnonpeRoute with ⟨hkind, f, seed, hconn, hadjoin, hbuilt⟩ + obtain ⟨corr⟩ := hmod.2.2 T hNT hNstrict + (Or.inr ⟨hkind, f, seed, hconn, hadjoin, hbuilt⟩) + have hmaximum : MaximumProperty corr.replacementETT := + MaximumPropertyTransport G k e0 m sigma hmod T corr P.maximum + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds + e0 corr.replacementInput := + cast (congrArg (fun r => TashkinovSeries G k r e0 + corr.replacementInput) corr.rungAgreement.symm) + corr.replacementSeries + have castTree {a b : ℕ} (h : a = b) + (s : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 2)) : + (cast (congrArg (fun r => TashkinovSeries G k r e0 + corr.replacementInput) h) s).data.tree i = + s.data.tree (Fin.cast (congrArg (fun r => r + 2) h.symm) i) := by + cases h + rfl + have castKind {a b : ℕ} (h : a = b) + (s : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)) : + (cast (congrArg (fun r => TashkinovSeries G k r e0 + corr.replacementInput) h) s).data.kind i = + s.data.kind (Fin.cast (congrArg (fun r => r + 1) h.symm) i) := by + cases h + rfl + have hseries : corr.replacementETT.series = replacementSeries := by + apply helper_hseries_463 + let terminalIndex : Fin corr.replacementETT.rounds := + Fin.cast corr.rungAgreement.symm + ⟨m.rounds - 1, by have hp := m.roundsPositive; omega⟩ + have htree : corr.replacementETT.series.data.tree + terminalIndex.succ.castSucc = Tn := by + apply helper_htree_1031 <;> assumption + have hkindEq : + ∀ i : Fin (corr.replacementETT.rounds + 1), corr.replacementETT.series.data.kind i = + m.series.data.kind (Fin.cast (congrArg (fun r => r + 1) corr.rungAgreement) i) := by + apply helper_hkindEq_493 <;> assumption + have htreeFinal : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + apply helper_htreeFinal_1056 <;> assumption + have hkindP : m.series.data.kind (Fin.last m.rounds) ≠ + some TashkinovExtensionKind.PE := by + apply helper_hkindP_512; assumption + let newBase : HierarchyBase corr.replacementETT sigma := { + core := Tn + closure := basePrefix.closure + supportPosition := Fin.cast + (congrArg (fun U : TreeSequence G e0 => U.length + 1) + htreeFinal.symm) P.replacementBase.supportPosition + supportPositive := P.replacementBase.supportPositive + terminalMissingColors := by rfl + parallel := by + dsimp + intro hp + have hk := hkindEq (Fin.last corr.replacementETT.rounds) + have hs : m.series.data.kind n = + some TashkinovExtensionKind.PE := by + simpa [corr.rungAgreement] using hk.symm.trans hp + rcases hkind with hse | hre + · rw [hs] at hse + cases hse + · rw [hs] at hre + cases hre + nonparallel := by + dsimp + intro hn + have hc := P.replacementBase.nonparallel hkindP + simp [htreeFinal]} + let K : TashkinovHierarchy corr.replacementETT newBase := { + dividerCount := H.dividerCount + stage := H.stage + baseStage := by simpa [htreeFinal] using H.baseStage + terminalStage := H.terminalStage + nested := H.nested + strict := H.strict + dividerPosition := H.dividerPosition + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := H.dividerStage + coreInsideFirst := by + have hcoreEq : Tn = P.replacementBase.core := by + have h := P.replacementBase.nonparallel hkindP + simpa [m, Tn, n] using h.symm + simpa [newBase] using hcoreEq ▸ H.coreInsideFirst } + have hsame : SameHierarchyStages H K := by + dsimp [SameHierarchyStages, K, newBase] + have hcoreEq : Tn = P.replacementBase.core := by + have h := P.replacementBase.nonparallel hkindP + simpa [m, Tn, n] using h.symm + refine ⟨hcoreEq.symm, rfl, heq_of_eq rfl, heq_of_eq rfl, ?_, ?_⟩ + · constructor <;> intro hp + · have hk := hkindEq (Fin.last corr.replacementETT.rounds) + have hs : corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + m.series.data.kind n := by + simpa [corr.rungAgreement] using hk + exact hs ▸ hp + · have hk := hkindEq (Fin.last corr.replacementETT.rounds) + have hs : corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + m.series.data.kind n := by + simpa [corr.rungAgreement] using hk + exact hs.symm ▸ hp + · intro hp + rcases hkind with hse | hre + · have he : TashkinovExtensionKind.SE = TashkinovExtensionKind.PE := + Option.some.inj (hse.symm.trans hp) + cases he + · have he : TashkinovExtensionKind.RE = TashkinovExtensionKind.PE := + Option.some.inj (hre.symm.trans hp) + cases he + exact ⟨corr, hmaximum, newBase, K, rfl, hsame⟩ + +private theorem helper_hfull_1262.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), P2880_T1_SplitSwapData G k e0 input T phi ett base C + ctx P alpha beta sigma → + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring), baseX.closure = P.replacementBase.closure → + ∀ (HX : TashkinovHierarchy ettX baseX) (goodX : GoodHierarchy HX), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → StableColoring X (TashkinovStoredColors + ettX.series.data (Fin.last ettX.rounds)) P.coloring sigma → + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors m.series.data n; StableColoring Tn Dn + P.coloring sigma → ModColoring m sigma → (m.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence sigma Tn T ∨ (m.series.data.kind + n = some TashkinovExtensionKind.SE ∨ m.series.data.kind n = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), m.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T) → + TreeSequenceInitialSegment Tn T → Tn.length < T.length → + ∀ (corrPrefix : CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : + HierarchyBase corrPrefix.replacementETT sigma) (KPrefix : TashkinovHierarchy + corrPrefix.replacementETT basePrefix) (goodPrefix : GoodHierarchy KPrefix), + SameGoodHierarchy goodX goodPrefix → ettX.series.data.kind (Fin.last ettX.rounds) = + m.series.data.kind n → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), MaximumProperty + corr.replacementETT ∧ + ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT newBase), newBase.closure = basePrefix.closure ∧ SameHierarchyStages H + K := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m H ettX baseX + hclosureX HX goodX hsigmaProper hsigmaOne hstableX n Tn Dn hstableTn hmod hroute hNT + hNstrict corrPrefix basePrefix KPrefix goodPrefix samePrefix hkindX + by_cases hpe : m.series.data.kind n = + some TashkinovExtensionKind.PE + · apply helper_branch_392 <;> assumption + · rcases hroute with hpeRoute | hnonpeRoute + · exact False.elim (hpe hpeRoute.1) + · apply helper_branch_1125 <;> assumption +private theorem helper_hlowerX_1128.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (_ : + ettX.rounds = m.rounds) {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ettX.rounds → MaximumProperty lower + → open scoped Classical in LowerRoundProperties lower := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P X m ettX hroundX input' T' generating' + lower hpos hlt hmax + have hlt' : lower.rounds < m.rounds := by + rw [← hroundX] + exact hlt + exact P.minimumContext.lowerRung lower hpos hlt' hmax + +private theorem helper_hfull_1473.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k) (_ : P2880_T1_SplitSwapData G k e0 input T phi ett base + C ctx P alpha beta sigma), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring) (_ : baseX.closure = P.replacementBase.closure) (HX : + TashkinovHierarchy ettX baseX) (goodX : GoodHierarchy HX) (_ : IsProperEdgeColoring G + sigma) (_ : IsOneEdgeUncolored sigma e0) (_ : StableColoring X (TashkinovStoredColors + ettX.series.data (Fin.last ettX.rounds)) P.coloring sigma), + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors m.series.data n; + ∀ (_ : StableColoring Tn Dn P.coloring sigma) (_ : ModColoring m sigma) (_ : + m.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + sigma Tn T ∨ (m.series.data.kind n = some TashkinovExtensionKind.SE ∨ m.series.data.kind n + = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), m.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T) (_ : + TreeSequenceInitialSegment Tn T) (_ : Tn.length < T.length) (corrPrefix : + CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : HierarchyBase + corrPrefix.replacementETT sigma) (KPrefix : TashkinovHierarchy corrPrefix.replacementETT + basePrefix) (goodPrefix : GoodHierarchy KPrefix) (_ : SameGoodHierarchy goodX goodPrefix) + (_ : ettX.series.data.kind (Fin.last ettX.rounds) = m.series.data.kind n), + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), MaximumProperty + corr.replacementETT ∧ + ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT newBase), newBase.closure = basePrefix.closure ∧ SameHierarchyStages H + K := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m H ettX baseX + hclosureX HX goodX hsigmaProper hsigmaOne hstableX n Tn Dn hstableTn hmod hroute hNT + hNstrict corrPrefix basePrefix KPrefix goodPrefix samePrefix hkindX + apply helper_hfull_1262 <;> assumption +private theorem helper_hfull_1535.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k) (_ : P2880_T1_SplitSwapData G k e0 input T phi ett base + C ctx P alpha beta sigma), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : + HierarchyBase ettX P.coloring) (_ : baseX.closure = P.replacementBase.closure) (HX : + TashkinovHierarchy ettX baseX) (goodX : GoodHierarchy HX) (_ : IsProperEdgeColoring G + sigma) (_ : IsOneEdgeUncolored sigma e0) (_ : StableColoring X (TashkinovStoredColors + ettX.series.data (Fin.last ettX.rounds)) P.coloring sigma), + let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; + let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors m.series.data n; + ∀ (_ : StableColoring Tn Dn P.coloring sigma) (_ : ModColoring m sigma) (_ : + m.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + sigma Tn T ∨ (m.series.data.kind n = some TashkinovExtensionKind.SE ∨ m.series.data.kind n + = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), m.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T) (_ : + TreeSequenceInitialSegment Tn T) (_ : Tn.length < T.length) (corrPrefix : + CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : HierarchyBase + corrPrefix.replacementETT sigma) (KPrefix : TashkinovHierarchy corrPrefix.replacementETT + basePrefix) (goodPrefix : GoodHierarchy KPrefix) (_ : SameGoodHierarchy goodX goodPrefix) + (_ : ettX.series.data.kind (Fin.last ettX.rounds) = m.series.data.kind n), + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), MaximumProperty + corr.replacementETT ∧ + ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT newBase), newBase.closure = basePrefix.closure ∧ SameHierarchyStages H + K := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m H ettX baseX + hclosureX HX goodX hsigmaProper hsigmaOne hstableX n Tn Dn hstableTn hmod hroute hNT + hNstrict corrPrefix basePrefix KPrefix goodPrefix samePrefix hkindX + apply helper_hfull_1473 <;> assumption +private theorem helper_continuation_1640.{u_1, u_2} : + helperContinuation1640Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P sigma X m H ettX baseX HX hcountX + hstagesX hpositionsX goodX hcolorsX corrPrefix basePrefix KPrefix goodPrefix samePrefix + corrFull hmaximumFull baseFull KFull hsameFull Ktransport hcountTransport hstagesTransport + hpositionsTransport goodFull hsamePrefixFull + have hsameFinal : SameGoodHierarchy P.counterexample.good goodFull := by + let hcountGood := samePrefix.2.choose + let hcountFinal : H.dividerCount = Ktransport.dividerCount := + hcountX.symm.trans (hcountGood.trans hcountTransport.symm) + have stageAt {a b : ℕ} (h : a = b) + (f : Fin (a + 2) → TreeSequence G e0) + (g : Fin (b + 2) → TreeSequence G e0) (hfg : HEq f g) + (j : Fin (b + 2)) : + f (Fin.cast (congrArg (fun z => z + 2) h.symm) j) = g j := by + cases h + simpa using congrFun (eq_of_heq hfg) j + have positionValueAt {a b : ℕ} (h : a = b) + (f : Fin a → Fin (X.length + 1)) + (g : Fin b → Fin (X.length + 1)) (hfg : HEq f g) + (j : Fin b) : + (f (Fin.cast (congrArg (fun z => z) h.symm) j)).val = (g j).val := by + cases h + simpa using congrArg Fin.val (congrFun (eq_of_heq hfg) j) + have hierarchyStageHEq {a b : ℕ} (h : a = b) + (f : Fin (a + 2) → TreeSequence G e0) + (g : Fin (b + 2) → TreeSequence G e0) + (hmid : ∀ i : Fin (a + 1), + f i.castSucc = g + (Fin.cast (congrArg (fun z => z + 1) h) i).castSucc) + (hlast : f (Fin.last (a + 1)) = g (Fin.last (b + 1))) : + HEq f g := by + cases h + apply heq_of_eq + funext j + refine Fin.lastCases hlast (fun i => ?_) j + simpa using hmid i + have positionFamilyHEq {a b : ℕ} (h : a = b) + (f : Fin a → Fin (T.length + 1)) + (g : Fin b → Fin (T.length + 1)) + (hmid : ∀ i : Fin a, f i = g (Fin.cast h i)) : HEq f g := by + cases h + apply heq_of_eq + funext i + exact hmid i + have hstageMiddle (i : Fin (H.dividerCount + 1)) : + H.stage i.castSucc = Ktransport.stage + (Fin.cast (congrArg (fun z => z + 1) hcountFinal) i).castSucc := by + let ix := Fin.cast (congrArg (fun z => z + 1) hcountX.symm) i + let ip := Fin.cast (congrArg (fun z => z + 1) hcountGood) ix + let iu := Fin.cast (congrArg (fun z => z + 1) hcountTransport.symm) ip + have hx := (hstagesX ix).1 + have hp := stageAt hcountGood HX.stage KPrefix.stage + samePrefix.1.2.2.1 ip.castSucc + have hu := (hstagesTransport iu).1 + calc + H.stage i.castSucc = HX.stage ix.castSucc := by + convert hx.symm using 1; congr 1 + _ = KPrefix.stage ip.castSucc := by + convert hp using 1; congr 1 + _ = Ktransport.stage iu.castSucc := by + convert hu.symm using 1; congr 1 + have hstageFinal : HEq H.stage Ktransport.stage := by + apply hierarchyStageHEq hcountFinal H.stage Ktransport.stage + hstageMiddle + rw [H.terminalStage, Ktransport.terminalStage] + have hpositionMiddle (i : Fin (H.dividerCount)) : + (H.dividerPosition i).val = + (Ktransport.dividerPosition + (Fin.cast (congrArg (fun z => z) hcountFinal) i)).val := by + let ix := Fin.cast hcountX.symm i + let ip := Fin.cast hcountGood ix + let iu := Fin.cast hcountTransport.symm ip + have hp := positionValueAt hcountGood HX.dividerPosition + KPrefix.dividerPosition samePrefix.1.2.2.2.1 ip + calc + (H.dividerPosition i).val = (HX.dividerPosition ix).val := by + have hidx : Fin.cast hcountX ix = i := by + apply Fin.ext + simp [ix] + have hx := hpositionsX ix + rw [hidx] at hx + exact hx.symm + _ = (KPrefix.dividerPosition ip).val := hp + _ = (Ktransport.dividerPosition iu).val := by + have hidx : Fin.cast hcountTransport iu = ip := by + apply Fin.ext + simp [iu] + have hu := hpositionsTransport iu + rw [hidx] at hu + exact hu.symm + have hpositionFinal : HEq H.dividerPosition Ktransport.dividerPosition := by + apply positionFamilyHEq hcountFinal H.dividerPosition + Ktransport.dividerPosition + intro i + apply Fin.ext + exact hpositionMiddle i + have hsameStages : SameHierarchyStages H Ktransport := by + unfold SameHierarchyStages + dsimp only + refine ⟨hsameFull.1, hcountFinal, hstageFinal, + hpositionFinal, ?_, ?_⟩ + · exact hsameFull.2.2.2.2.1 + · intro hp + exact hsameFull.2.2.2.2.2 hp + unfold SameGoodHierarchy + refine ⟨hsameStages, hcountFinal, ?_⟩ + intro j + let jX := Fin.cast (congrArg (fun z => z + 1) hcountX.symm) j + let jP := Fin.cast (congrArg (fun z => z + 1) hcountGood) jX + let jU := Fin.cast (congrArg (fun z => z + 1) hcountTransport.symm) jP + have hx := hcolorsX jX + have hp := samePrefix.2.choose_spec jX + have hu := hstagesTransport jU + have hjX : Fin.cast (congrArg (fun z => z + 1) hcountX) jX = j := by + apply Fin.ext + simp [jX] + have hjU : Fin.cast (congrArg (fun z => z + 1) hcountTransport) jU = jP := by + apply Fin.ext + simp [jU] + refine ⟨?_, ?_⟩ + · calc + HierarchyStoredColorsAt H j = HierarchyStoredColorsAt HX jX := by + rw [← hjX] + exact hx.1.symm + _ = HierarchyStoredColorsAt KPrefix jP := hp.1 + _ = HierarchyStoredColorsAt Ktransport jU := by + rw [← hjU] + exact hu.2.2.1.symm + · intro eta heta + have hgamma := (hx.2.2 eta).1 + rw [hjX] at hgamma + calc + P.counterexample.good.gamma j eta = goodX.gamma jX eta := + hgamma.symm + _ = goodPrefix.gamma jP eta := hp.2 eta (by rw [hx.1, hjX]; exact heta) + _ = goodFull.gamma jU eta := by + rw [← hjU] + exact (hsamePrefixFull jU eta).symm + exact ⟨corrFull, hmaximumFull, baseFull, Ktransport, goodFull, hsameFinal⟩ + +private theorem helper_continuation_1844.{u_1, u_2} : + helperContinuation1844Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m H q ettX baseX + hcoreX hclosureX HX hcountX hstagesX hpositionsX goodX hcolorsX hsigmaProper hsigmaOne + hstableX n Tn Dn hstableTn hmod hroute hNT hNstrict corrPrefix basePrefix KPrefix + goodPrefix samePrefix hkindX + have hfull : + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T, + MaximumProperty corr.replacementETT ∧ + ∃ newBase : HierarchyBase corr.replacementETT sigma, + ∃ K : TashkinovHierarchy corr.replacementETT newBase, + newBase.closure = basePrefix.closure ∧ SameHierarchyStages H K := by + apply helper_hfull_1535 <;> assumption + rcases hfull with ⟨corrFull, hmaximumFull, baseFull, KFull, hclosure, hsameFull⟩ + have hcoreFull : baseFull.core = basePrefix.core := by + have hprefixCore := samePrefix.1.1 + have hfullCore := hsameFull.1 + exact hfullCore.symm.trans (hcoreX.symm.trans hprefixCore) + have hfullRoute : TashkinovAugmentationSequence sigma X T := S.newSuffix + obtain ⟨Ktransport, hcountTransport, hstagesTransport, hpositionsTransport⟩ := + GoodHierarchySameDividerReconstruction G k e0 + P.corresponding.replacementInput T P.coloring sigma m X T + corrPrefix basePrefix KPrefix corrFull baseFull hcoreFull hfullRoute + have havoid : ∀ eta : Fin k, + eta ∈ HierarchyStoredColorsAt KPrefix (Fin.last KPrefix.dividerCount) → + Disjoint (goodPrefix.gamma (Fin.last KPrefix.dividerCount) eta) + (Finset.univ.filter fun c => ∃ r : Fin T.length, + (HierarchyStarredStage KPrefix (Fin.last KPrefix.dividerCount)).length ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma T eta).val T.length ∧ + sigma (T.edge r) = some c) := by + intro eta heta + let qX : Fin (HX.dividerCount + 1) := Fin.last HX.dividerCount + let qP : Fin (KPrefix.dividerCount + 1) := Fin.last KPrefix.dividerCount + have hcountXP : HX.dividerCount = KPrefix.dividerCount := samePrefix.1.2.1 + rcases samePrefix.2 with ⟨hcountGood, hsameGamma⟩ + have hidxXP : Fin.cast (congrArg (fun z : ℕ => z + 1) hcountGood) qX = qP := by + apply Fin.ext + simp [qX, qP] + have hstoreXP : HierarchyStoredColorsAt HX qX = + HierarchyStoredColorsAt KPrefix qP := by + simpa [qX, qP, hidxXP] using (hsameGamma qX).1 + have hetaX : eta ∈ HierarchyStoredColorsAt HX qX := by + rw [hstoreXP] + exact heta + have hidxXH : Fin.cast (congrArg (fun z : ℕ => z + 1) hcountX) qX = q := by + apply Fin.ext + simp [qX, q] + have hstoreOld : eta ∈ HierarchyStoredColorsAt H q := by + have hx := (hcolorsX qX).1 + rw [hidxXH] at hx + rw [← hx] + exact hetaX + have hgammaOldPrefix : P.counterexample.good.gamma q eta = + goodPrefix.gamma qP eta := by + have hx := (hcolorsX qX).2.2 eta + have hp := hsameGamma qX + simpa [q, qX, qP, hidxXH, hidxXP] using hx.1.symm.trans (hp.2 eta hetaX) + have stageAt {a b : ℕ} (h : a = b) + (f : Fin (a + 2) → TreeSequence G e0) + (g : Fin (b + 2) → TreeSequence G e0) (hfg : HEq f g) + (j : Fin (b + 2)) : f (Fin.cast (congrArg (fun d => d + 2) h.symm) j) = g j := by + cases h + simpa using congrFun (eq_of_heq hfg) j + let index (j : Fin (HX.dividerCount + 1)) : + Fin (KPrefix.dividerCount + 1) := + Fin.cast (congrArg (fun d : ℕ => d + 1) hcountXP) j + have stageEq (j : Fin (HX.dividerCount + 1)) : + HX.stage j.castSucc = KPrefix.stage (index j).castSucc := by + have hs := stageAt hcountXP HX.stage KPrefix.stage + samePrefix.1.2.2.1 (index j).castSucc + convert hs using 1; congr 1 + have hstarXP' (j : Fin (HX.dividerCount + 1)) : + HierarchyStarredStage HX j = HierarchyStarredStage KPrefix (index j) := by + refine Fin.cases ?_ (fun i => ?_) j + · simpa [HierarchyStarredStage, index] using samePrefix.1.1 + · have hs := stageEq i.succ + simpa [HierarchyStarredStage, index] using hs + have hstarXP : HierarchyStarredStage KPrefix qP = + HierarchyStarredStage HX qX := by + have hs := hstarXP' qX + simpa [index, qX, qP, hidxXP] using hs.symm + have hstarOld : HierarchyStarredStage KPrefix qP = + HierarchyStarredStage H q := by + have hx := (hstagesX qX).2 + have hidx : Fin.cast (congrArg (fun z : ℕ => z + 1) hcountX) qX = q := hidxXH + exact hstarXP.trans (hx.trans (by simp [hidx])) + apply Finset.disjoint_left.mpr + intro c hcG hcSeg + rcases (Finset.mem_filter.mp hcSeg).2 with ⟨r, hlo, hhi, hcol⟩ + by_cases haffected : alpha ∈ P.counterexample.good.gamma q eta ∨ + beta ∈ P.counterexample.good.gamma q eta + · exact @helper_branch_667 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@sigma) (@S) (@corrPrefix) (@basePrefix) (@KPrefix) (@goodPrefix) (@eta) (@heta) + (@hstoreOld) (@c) (@hcG) (@r) (@hlo) (@hhi) (@hcol) (@haffected) + · exact @helper_branch_700 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@sigma) (@S) (@corrPrefix) (@basePrefix) (@KPrefix) (@goodPrefix) (@eta) (@hstoreOld) + (@hgammaOldPrefix) (@hstarOld) (@c) (@hcG) (@r) (@hlo) (@hhi) (@hcol) (@haffected) + obtain ⟨goodFull, hsamePrefixFull⟩ := + GoodHierarchySameDividerTransport G k e0 + P.corresponding.replacementInput T P.coloring sigma m X T + corrPrefix basePrefix KPrefix goodPrefix corrFull baseFull + hcoreFull hclosure Ktransport hcountTransport hstagesTransport + hfullRoute havoid + exact @helper_continuation_1640 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@sigma) + (@ettX) (@baseX) (@HX) (@hcountX) (@hstagesX) (@hpositionsX) (@goodX) (@hcolorsX) + (@corrPrefix) (@basePrefix) (@KPrefix) (@goodPrefix) (@samePrefix) (@corrFull) + (@hmaximumFull) (@baseFull) (@KFull) (@hsameFull) (@Ktransport) (@hcountTransport) + (@hstagesTransport) (@hpositionsTransport) (@goodFull) (@hsamePrefixFull) + +private theorem helper_continuation_1969.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k) (_ : P2880_T1_SplitSwapData G k e0 input T phi ett base + C ctx P alpha beta sigma), + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : + ℕ)); + let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := + P.corresponding.replacementETT; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (_ : + MaximumProperty ettX) (_ : ettX.rounds = m.rounds) (_ : ettX.series ≍ m.series) (baseX : + HierarchyBase ettX P.coloring) (_ : baseX.core = P.replacementBase.core) (_ : + baseX.closure = P.replacementBase.closure) (HX : TashkinovHierarchy ettX baseX) (hcountX : + HX.dividerCount = H.dividerCount) (_ : + ∀ (j : Fin (HX.dividerCount + (1 : ℕ))), HX.stage j.castSucc = H.stage (Fin.cast ( + by + omega + ) j).castSucc ∧ HierarchyStarredStage HX j = HierarchyStarredStage H (Fin.cast ( + by + omega + ) j)) (_ : + ∀ (i : Fin HX.dividerCount), (↑(HX.dividerPosition i) : ℕ) = (↑(H.dividerPosition (Fin.cast + hcountX i)) : ℕ)) (goodX : GoodHierarchy HX) (_ : + ∀ (j : Fin (HX.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt HX j = + HierarchyStoredColorsAt H (Fin.cast (congrArg (fun n : ℕ => n + 1) hcountX) j) ∧ + HierarchyStageMissingColors HX j = HierarchyStageMissingColors H (Fin.cast (congrArg (fun + n : ℕ => n + 1) hcountX) j) ∧ + ∀ (eta : Fin k), goodX.gamma j eta = P.counterexample.good.gamma (Fin.cast (congrArg (fun n : + ℕ => n + 1) hcountX) j) eta ∧ HierarchySegmentColors HX j eta ⊆ HierarchySegmentColors H + (Fin.cast (congrArg (fun n : ℕ => n + 1) hcountX) j) eta) (_ : OutsideKempeRecoloring X + P.coloring sigma alpha beta) (_ : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), (0 : ℕ) < lower.rounds → lower.rounds < ettX.rounds → MaximumProperty lower + → (open scoped Classical in LowerRoundProperties lower)), + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 P.corresponding.replacementETT sigma T), + MaximumProperty corr.replacementETT ∧ + ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT newBase) (good : GoodHierarchy K), SameGoodHierarchy + P.counterexample.good good := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m H ettX hMPX + hroundX hseriesX baseX hcoreX hclosureX HX hcountX hstagesX hpositionsX goodX hcolorsX + hrecolorX hlowerX + have hlem := HierarchyLEMStable G k e0 P.corresponding.replacementInput X + P.coloring sigma ettX hMPX (by + simpa [hroundX] using P.counterexample.positive) + hlowerX baseX HX goodX P.minimumContext.proper + P.minimumContext.oneEdgeUncolored alpha beta hrecolorX + rcases hlem with ⟨hsigmaProper, hsigmaOne, hstableX, hinvariantX, + corrX, hmaximumX, baseSigmaX, KX, goodSigmaX, hsameX, hclosedX⟩ + let n := Fin.last m.rounds + let Tn := m.series.data.tree n.castSucc + let Dn := TashkinovStoredColors m.series.data n + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + apply helper_segmentTrans_194 <;> assumption + have hTnCore : TreeSequenceInitialSegment Tn P.replacementBase.core := by + apply helper_hTnCore_213 + have hTnX : TreeSequenceInitialSegment Tn X := + segmentTrans hTnCore S.coreInSplit + have hTnXvertices : TreeSequenceVertexSet Tn ⊆ TreeSequenceVertexSet X := + TreeSequenceInitialSegmentVertexSetSubset hTnX + have hstableTn : StableColoring Tn Dn + P.coloring sigma := by + apply helper_hstableTn_223 <;> assumption + have hstableTn' : StableColoring Tn Dn + (m.series.data.coloring n) sigma := by + have hcolor : m.series.data.coloring n = P.coloring := by + simpa [n, m] using m.generatingColoring.symm + rw [hcolor] + exact hstableTn + have hmod : ModColoring m sigma := + Td G k e0 P.corresponding.replacementInput T P.coloring m P.maximum + P.counterexample.positive P.minimumContext.lowerRung sigma hsigmaProper + hsigmaOne hstableTn' + have hroute : + (m.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T) ∨ + ((m.series.data.kind n = some TashkinovExtensionKind.SE ∨ + m.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ f : E, ∃ seed : TreeSequence G e0, + m.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed T) := by + apply helper_hroute_241 <;> assumption + have hNT : TreeSequenceInitialSegment Tn T := by + apply helper_hNT_259 <;> assumption + have hNstrict : Tn.length < T.length := by + apply helper_hNstrict_267 <;> assumption + let seriesCast := P.corresponding.rungAgreement.symm ▸ + P.corresponding.replacementSeries + have hseriesCast : HEq seriesCast P.corresponding.replacementSeries := by + apply helper_hseriesCast_889 + have hsourceSeries : m.series = seriesCast := by + exact eq_of_heq (HEq.trans P.corresponding.seriesPresentation + hseriesCast.symm) + have castColor : + ∀ {r s : Nat} (h : r = s) (ser : TashkinovSeries G k s e0 P.corresponding.replacementInput) (i + : Fin (r + 1)), (h.symm ▸ ser).data.coloring i = ser.data.coloring (Fin.cast (congrArg + (fun z => z + 1) h) i) := by + intro r s h ser i + cases h + rfl + let corrMX := @helperCorrMX773 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@ettX) (@hroundX) + (@hseriesX) (@hsourceSeries) (@castColor) + obtain ⟨corrPrefix, hinputPrefix, hseriesPrefix, hETTPrefix⟩ := + CorrespondingExtendedTashkinovTreeTransTrees G k e0 + P.corresponding.replacementInput T X X P.coloring P.coloring sigma m + corrMX corrX + have transportETT {I J : PartialEdgeColoring E k} (h : I = J) + {F : ExtendedTashkinovTree G k e0 I X sigma} + {F' : ExtendedTashkinovTree G k e0 J X sigma} (hf : HEq F F') : + F = h.symm ▸ F' := by + cases h + exact eq_of_heq hf + have transportPrefixPackage {I J : PartialEdgeColoring E k} (h : I = J) + {F : ExtendedTashkinovTree G k e0 I X sigma} + {F' : ExtendedTashkinovTree G k e0 J X sigma} (hf : HEq F F') + (b : HierarchyBase F' sigma) (K : TashkinovHierarchy F' b) + (good : GoodHierarchy K) (hsame : SameGoodHierarchy goodX good) : + ∃ b' : HierarchyBase F sigma, + ∃ K' : TashkinovHierarchy F b', + ∃ good' : GoodHierarchy K', SameGoodHierarchy goodX good' := by + cases h + have heq : F = F' := eq_of_heq hf + cases heq + exact ⟨b, K, good, hsame⟩ + have prefixPackage : + ∃ b : HierarchyBase corrPrefix.replacementETT sigma, + ∃ K : TashkinovHierarchy corrPrefix.replacementETT b, + ∃ good : GoodHierarchy K, + SameGoodHierarchy goodX good := by + exact transportPrefixPackage hinputPrefix hETTPrefix + baseSigmaX KX goodSigmaX hsameX + obtain ⟨basePrefix, KPrefix, goodPrefix, samePrefix⟩ := prefixPackage + have hkindX : ettX.series.data.kind (Fin.last ettX.rounds) = + m.series.data.kind n := by + apply helper_hkindX_358 <;> assumption + exact @helper_continuation_1844 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@sigma) (@S) (@ettX) (@baseX) (@hcoreX) (@hclosureX) (@HX) (@hcountX) (@hstagesX) + (@hpositionsX) (@goodX) (@hcolorsX) (@hsigmaProper) (@hsigmaOne) (@hstableX) (@hstableTn) + (@hmod) (@hroute) (@hNT) (@hNstrict) (@corrPrefix) (@basePrefix) (@KPrefix) (@goodPrefix) + (@samePrefix) (@hkindX) + +theorem P2880_T1_OutsidePrefixBranch + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha beta : Fin k) (sigma : PartialEdgeColoring E k) + (S : P2880_T1_SplitSwapData G k e0 input T phi ett base C ctx P + alpha beta sigma) + (_ : ¬ ( + let H := P.counterexample.hierarchy + let q := Fin.last H.dividerCount + let m := P.corresponding.replacementETT + let n := Fin.last m.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := m.series.data.tree n.castSucc + let Dn := TashkinovStoredColors m.series.data n + let qualifies := fun (a b : Fin k) => + (0 < H.dividerCount ∧ a ∈ TreeMissingColors P.coloring Tnq) ∨ + (H.dividerCount = 0 ∧ + (a ∈ TreeMissingColors P.coloring Tn ∨ + (a ∈ TreeMissingColors P.coloring A ∧ a ∉ Dn ∧ b ∉ Dn))) + qualifies alpha beta ∨ qualifies beta alpha)) : + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 + P.corresponding.replacementETT sigma T, + MaximumProperty corr.replacementETT ∧ + ∃ newBase : HierarchyBase corr.replacementETT sigma, + ∃ K : TashkinovHierarchy corr.replacementETT newBase, + ∃ good : GoodHierarchy K, + SameGoodHierarchy P.counterexample.good good := by + classical + let X := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1) + let m := P.corresponding.replacementETT + let H := P.counterexample.hierarchy + let q := Fin.last H.dividerCount + have hprefix := GoodHierarchyTerminalPrefixRepackage G k e0 + P.corresponding.replacementInput T P.coloring P.coloring m P.maximum + P.replacementBase H P.counterexample.good X S.splitAboveStar.1 + S.splitAboveStar.2 S.splitInFull + obtain ⟨ettX, hMPX, hroundX, hseriesX, baseX, hcoreX, hclosureX, + hsuppX, HX, hcountX, hstagesX, hpositionsX, goodX, hcolorsX⟩ := hprefix + have hrecolorX : OutsideKempeRecoloring X P.coloring sigma alpha beta := by + apply helper_hrecolorX_82; assumption + have hlowerX : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), 0 < lower.rounds → lower.rounds < ettX.rounds → MaximumProperty lower → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T') ∧ ( + let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tnext := lower.series.data.tree (Fin.last (lower.rounds + 1)) + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ alpha beta : Fin k, alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma + Tnext → TreeInterchangeable G Tnext sigma alpha beta) ∧ (( + ∀ (q : Fin lower.rounds) (v : V), lower.series.data.kind q.succ = some + TashkinovExtensionKind.PE → lower.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (j : Fin (lower.rounds + 1)), + ETTFirstAppearanceIndex lower v hvFinal = j.val + 1 → + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring (lower.series.data.tree q.succ.castSucc) (TashkinovStoredColors + lower.series.data q.succ) (lower.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma ∧ (0 < j.val → StableColoring (lower.series.data.tree + j.castSucc) (TashkinovStoredColors lower.series.data j) (lower.series.data.coloring j) + sigma)) ∧ + ∀ (q r : Fin lower.rounds) (vq vr : V), q ≠ r → vq ≠ vr → lower.series.data.kind q.succ = some + TashkinovExtensionKind.PE → lower.series.data.kind r.succ = some TashkinovExtensionKind.PE + → lower.series.data.chosenVertex q.succ = some vq → lower.series.data.chosenVertex r.succ + = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex lower vq hvq = ETTFirstAppearanceIndex lower vr hvr → Disjoint + (lower.series.data.stored q.succ) (lower.series.data.stored r.succ)) ∧ ( + let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn := lower.series.data.tree n.castSucc + ∀ (v : V) (gamma delta : Fin k), lower.series.data.kind n = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex n = some v → lower.series.data.gamma n = some gamma → + lower.series.data.delta n = some delta → + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ w, w ∈ TreeSequenceVertexSet Tn → (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) ↔ w = v)) ∧ ( + let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn := lower.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ delta : Fin k, DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta → + ∀ v, BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v → ( + ∃ w, BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn w v) + → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') (q : Fin lower.rounds) (vi : V), + (lower.series.data.kind q.succ = some TashkinovExtensionKind.PE ∨ lower.series.data.kind + q.succ = some TashkinovExtensionKind.SE) → lower.series.data.chosenVertex q.succ = some vi + → ETTFirstAppearanceIndex lower v hvFinal ≤ q.val + 1 → (v = vi ∨ TreeVertexOrder T' v + vi)) ∧ ( + let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn := lower.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → ModColoring lower sigma) := by + apply helper_hlowerX_1128; assumption + exact @helper_continuation_1969 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@sigma) (@S) (@ettX) (@hMPX) (@hroundX) (@hseriesX) (@baseX) (@hcoreX) + (@hclosureX) (@HX) (@hcountX) (@hstagesX) (@hpositionsX) (@goodX) (@hcolorsX) (@hrecolorX) + (@hlowerX) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OutsideSwapPrefixEffects.lean b/LeanPool/GoldbergSeymour/OutsideSwapPrefixEffects.lean new file mode 100644 index 0000000000..8f97505802 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OutsideSwapPrefixEffects.lean @@ -0,0 +1,441 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +public import LeanPool.GoldbergSeymour.TreeVerticesBefore + +/-! +# P2966_T1_Outside Swap Prefix Effects + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem P2966_T1_OutsideSwapPrefixEffects_augmentation_edge_missing_98.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : + ℕ} {e0 : E} (Tj seed : TreeSequence G e0) (phiJ : PartialEdgeColoring E k) (_ : Fin + (Tj.length + 1)) {B : TreeSequence G e0}, TashkinovAugmentationSequence phiJ seed B → ∀ (a + : Fin B.length), seed.length ≤ (↑a : ℕ) → ∃ (i : Fin (B.length + 1)), (↑i : ℕ) ≤ (↑a : ℕ) + ∧ ∃ (c : Fin k), phiJ (B.edge a) = some c ∧ c ∈ MissingColors G phiJ (B.vertex i) := by + classical + intro V E _ _ G k e0 Tj seed phiJ zPosition B hreach + let _ := Fintype.ofFinite V + unfold TashkinovAugmentationSequence at hreach + induction hreach with + | refl => + intro a ha + omega + | @tail A B hprior ih hstep => + intro a ha + rcases ih with ⟨hlen, hinit, cnew, hcolor, hmissing⟩ + by_cases hold : a.val < A.length + · let old : Fin A.length := ⟨a.val, hold⟩ + obtain ⟨i, hi, c, hcol, hmiss⟩ := hstep old (by simpa [old] using ha) + refine ⟨Fin.castLE (Nat.succ_le_succ hinit.1) i, ?_, c, ?_, ?_⟩ + · simpa using hi + · have haold : Fin.castLE hinit.1 old = a := by + apply Fin.ext + rfl + rw [← haold, hinit.2.2] + simpa [old] using hcol + · simpa [hinit.2.1] using hmiss + · have hnew : a.val = A.length := by omega + let last : Fin B.length := ⟨a.val, by omega⟩ + have hlast : a = last := by + apply Fin.ext + simp [last] + rw [hlast] + rw [show B.edge last = B.edge (Fin.cast hlen.symm (Fin.last _)) by + congr 1 + apply Fin.ext + simpa [last] using hnew] + rw [hcolor] + rw [TreeMissingColors] at hmissing + obtain ⟨w, hw, hwm⟩ := Finset.mem_biUnion.mp hmissing + simp only [TreeSequenceVertexSet, Finset.mem_image] at hw + obtain ⟨i, hi, hwi⟩ := hw + refine ⟨Fin.castLE (Nat.succ_le_succ hinit.1) i, ?_, cnew, rfl, ?_⟩ + · change i.val ≤ a.val + omega + · rw [hinit.2.1, hwi] + exact hwm + +private theorem P2966_T1_OutsideSwapPrefixEffects_hTjEdgeFixed_143.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] {G : + LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn Tj seed TjPrime : TreeSequence G e0) (phiJ + rho1 rho0 mu0 : PartialEdgeColoring E k) (deltaN beta : Fin k) (u : V) (zPosition : Fin + (Tj.length + 1)), TreeSequenceInitialSegment Tj Tn → beta ∈ MissingColors G rho1 u → + TashkinovAugmentationSequence phiJ seed Tj → (∀ (a : Fin Tj.length), seed.length ≤ (↑a : + ℕ) → rho1 (Tj.edge a) = phiJ (Tj.edge a)) → deltaN ∉ TreeMissingColors phiJ Tj → u ∈ + TreeSequenceVertexSet TjPrime → u ∉ TreeSequenceVertexSet Tn → (∀ (a : Fin Tj.length), + seed.length ≤ (↑a : ℕ) → (↑a : ℕ) < (↑zPosition : ℕ) → rho1 (Tj.edge a) ≠ some beta) → + rho0 = OutsideTreeColorSwap TjPrime rho1 beta deltaN → (∀ (f : E), TreeIncidentEdge + TjPrime f → rho0 f = rho1 f) → (∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet + TjPrime, w ≠ u → ∀ (f : E), Incident G w f → mu0 f = rho0 f) → (∀ w ∈ + TreeSequenceVertexSet TjPrime, w ≠ u → MissingColors G mu0 w = MissingColors G rho1 w) → + (∀ {B : TreeSequence G e0}, TashkinovAugmentationSequence phiJ seed B → ∀ (a : Fin + B.length), seed.length ≤ (↑a : ℕ) → ∃ (i : Fin (B.length + 1)), (↑i : ℕ) ≤ (↑a : ℕ) ∧ ∃ (c + : Fin k), phiJ (B.edge a) = some c ∧ c ∈ MissingColors G phiJ (B.vertex i)) → ∀ (a : Fin + Tj.length), seed.length ≤ (↑a : ℕ) → (↑a : ℕ) < (↑zPosition : ℕ) → mu0 (Tj.edge a) = rho1 + (Tj.edge a) := by + classical + intro V E _ _ _ G k e0 Tn Tj seed TjPrime phiJ rho1 rho0 mu0 deltaN beta u zPosition hTjN hbeta + haugmentation hb2Edges hdeltaPhiJ huPrime huOutside hzEdges hrho0 hrho0Fixed hmuRho0Fixed + hmissingPrime augmentation_edge_missing a ha hapos + let _ := Fintype.ofFinite V + have hnotBeta := hzEdges a ha hapos + have hnotDelta : rho1 (Tj.edge a) ≠ some deltaN := by + intro hdelta + obtain ⟨i, hi, c, hcolor, hmissing⟩ := + augmentation_edge_missing haugmentation a ha + have hphiDelta : phiJ (Tj.edge a) = some deltaN := by + rw [← hb2Edges a ha] + exact hdelta + have hc : c = deltaN := Option.some.inj (hcolor.symm.trans hphiDelta) + subst c + apply hdeltaPhiJ + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨Tj.vertex i, by + simp [TreeSequenceVertexSet], hmissing⟩ + have hlaterJ : Tj.vertex a.succ ∈ TreeSequenceVertexSet Tj := by + simp [TreeSequenceVertexSet] + have hlaterN := TreeSequenceInitialSegmentVertexSetSubset hTjN hlaterJ + obtain ⟨i, hi⟩ := Tj.attaches a + have hlaterInc : Incident G (Tj.vertex a.succ) (Tj.edge a) := by + change Tj.vertex a.succ ∈ G.ends (Tj.edge a) + rw [hi] + simp + have hmuRho0 := hmuRho0Fixed (Tj.vertex a.succ) + (Finset.mem_union.mpr (Or.inl hlaterN)) + (by intro h; subst u; exact huOutside hlaterN) (Tj.edge a) hlaterInc + rw [hmuRho0] + by_cases ht : TreeIncidentEdge TjPrime (Tj.edge a) + · exact hrho0Fixed (Tj.edge a) ht + · simp [hrho0, OutsideTreeColorSwap, ht, hnotBeta, hnotDelta] + +private theorem P2966_T1_OutsideSwapPrefixEffects_outside_before_missing_eq_202.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] {G : + LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn Tj TjPrime : TreeSequence G e0) (phiJ rho1 + rho0 mu0 : PartialEdgeColoring E k) (deltaN beta : Fin k) (terminalSupport u z : V), + TreeSequenceInitialSegment Tj Tn → terminalSupport ∈ TreeSequenceVertexSet TjPrime → + ColoredVertexSetClosed G rho1 (TreeSequenceVertexSet TjPrime) → beta ≠ deltaN → beta ∈ + MissingColors G rho1 u → deltaN ∈ MissingColors G rho1 terminalSupport → (∀ v ∈ + (TreeSequenceVertexSet Tj).erase terminalSupport, MissingColors G rho1 v = MissingColors G + phiJ v) → deltaN ∉ TreeMissingColors phiJ Tj → ∀ (hz : z ∈ TreeSequenceVertexSet Tj), u ∈ + TreeSequenceVertexSet TjPrime → u ∉ TreeSequenceVertexSet Tn → (∀ w ∈ TreeVerticesBefore + Tj z hz, beta ∉ MissingColors G rho1 w) → rho0 = OutsideTreeColorSwap TjPrime rho1 beta + deltaN → (∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime, w ≠ u → ∀ (f : + E), Incident G w f → mu0 f = rho0 f) → (∀ (c : Fin k), c ≠ beta → c ≠ deltaN → ∀ (f : E), + rho0 f = some c ↔ rho1 f = some c) → (∀ {A : TreeSequence G e0} {a : V} (ha : a ∈ + TreeSequenceVertexSet A), ∀ w ∈ TreeVerticesBefore A a ha, w ∈ TreeSequenceVertexSet A ∧ w + ≠ a) → (∀ (w : V), (∀ (f : E), Incident G w f → mu0 f = rho0 f) → MissingColors G mu0 w = + MissingColors G rho0 w) → ∀ w ∈ TreeVerticesBefore Tj z hz, w ∉ TreeSequenceVertexSet + TjPrime → MissingColors G mu0 w = MissingColors G rho1 w := by + classical + intro V E _ _ _ G k e0 Tn Tj TjPrime phiJ rho1 rho0 mu0 deltaN beta terminalSupport u z hTjN + hterminalPrime hprimeClosed hbetaDelta hbeta hdeltaMissing hb2Missing hdeltaPhiJ hz huPrime + huOutside hzBefore hrho0 hmuRho0Fixed rho0_unaffected before_mem_and_ne missing_eq_mu_rho0 + w hwBefore hwOutsidePrime + obtain ⟨hwJ, hwz⟩ := before_mem_and_ne hz w hwBefore + have hwN := TreeSequenceInitialSegmentVertexSetSubset hTjN hwJ + have hwu : w ≠ u := by + intro h + subst w + exact huOutside hwN + have hwTerminal : w ≠ terminalSupport := by + intro h + subst w + exact hwOutsidePrime hterminalPrime + have hbetaPresentRho : beta ∈ PresentColors G rho1 w := by + simpa [MissingColors] using hzBefore w hwBefore + have hdeltaNotMissingPhi : + deltaN ∉ MissingColors G phiJ w := by + intro hdelta + apply hdeltaPhiJ + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨w, hwJ, hdelta⟩ + have hdeltaNotMissingRho : + deltaN ∉ MissingColors G rho1 w := by + rw [hb2Missing w (Finset.mem_erase.mpr ⟨hwTerminal, hwJ⟩)] + exact hdeltaNotMissingPhi + have hdeltaPresentRho : deltaN ∈ PresentColors G rho1 w := by + simpa [MissingColors] using hdeltaNotMissingRho + have affected_not_tree : ∀ (f : E), Incident G w f → + (rho1 f = some beta ∨ rho1 f = some deltaN) → + ¬ TreeIncidentEdge TjPrime f := by + intro f hwf hcolor ht + obtain ⟨q, hqPrime, hqf⟩ := ht + have hqw : q ≠ w := by + intro h + subst q + exact hwOutsidePrime hqPrime + have hboundary : f ∈ BoundaryEdges G + (TreeSequenceVertexSet TjPrime) := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, hqPrime, w, hwOutsidePrime, + (Sym2.mem_and_mem_iff hqw).mp ⟨hqf, hwf⟩⟩ + rcases hcolor with hcolor | hcolor + · exact (hprimeClosed hboundary huPrime hcolor) hbeta + · exact (hprimeClosed hboundary hterminalPrime hcolor) hdeltaMissing + have hbetaPresentRho0 : beta ∈ PresentColors G rho0 w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hdeltaPresentRho + obtain ⟨f, hwf, hcolor⟩ := hdeltaPresentRho + have ht := affected_not_tree f hwf (Or.inr hcolor) + refine ⟨f, hwf, ?_⟩ + simp [hrho0, OutsideTreeColorSwap, ht, hcolor, hbetaDelta.symm] + have hdeltaPresentRho0 : deltaN ∈ PresentColors G rho0 w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hbetaPresentRho + obtain ⟨f, hwf, hcolor⟩ := hbetaPresentRho + have ht := affected_not_tree f hwf (Or.inl hcolor) + refine ⟨f, hwf, ?_⟩ + simp [hrho0, OutsideTreeColorSwap, ht, hcolor] + have hpresentEq : PresentColors G rho0 w = PresentColors G rho1 w := by + apply Finset.ext + intro c + by_cases hcb : c = beta + · subst c + exact iff_of_true hbetaPresentRho0 hbetaPresentRho + · by_cases hcd : c = deltaN + · subst c + exact iff_of_true hdeltaPresentRho0 hdeltaPresentRho + · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + constructor + · rintro ⟨f, hwf, hfc⟩ + exact ⟨f, hwf, (rho0_unaffected c hcb hcd f).mp hfc⟩ + · rintro ⟨f, hwf, hfc⟩ + exact ⟨f, hwf, (rho0_unaffected c hcb hcd f).mpr hfc⟩ + have hrhoMissing : MissingColors G rho0 w = MissingColors G rho1 w := by + simp [MissingColors, hpresentEq] + exact (missing_eq_mu_rho0 w (hmuRho0Fixed w + (Finset.mem_union.mpr (Or.inl hwN)) hwu)).trans hrhoMissing + +private theorem P2966_T1_OutsideSwapPrefixEffects_branch_306.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] {G : + LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tn Tj TjPrime : TreeSequence G e0) (rho1 rho0 + mu0 : PartialEdgeColoring E k) (deltaN beta : Fin k) (terminalSupport u z : V), + TreeSequenceInitialSegment Tj Tn → terminalSupport ∈ TreeSequenceVertexSet TjPrime → + ColoredVertexSetClosed G rho1 (TreeSequenceVertexSet TjPrime) → ColoredVertexSetElementary + G rho1 (TreeSequenceVertexSet TjPrime) → beta ≠ deltaN → beta ∈ MissingColors G rho1 u → + deltaN ∈ MissingColors G rho1 terminalSupport → z ∈ TreeSequenceVertexSet Tj → u ∈ + TreeSequenceVertexSet TjPrime → u ∉ TreeSequenceVertexSet Tn → rho0 = OutsideTreeColorSwap + TjPrime rho1 beta deltaN → (∀ w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet + TjPrime, w ≠ u → ∀ (f : E), Incident G w f → mu0 f = rho0 f) → (∀ (w : V), (∀ (f : E), + Incident G w f → mu0 f = rho0 f) → MissingColors G mu0 w = MissingColors G rho0 w) → beta + ∈ MissingColors G rho1 z → deltaN ∈ MissingColors G mu0 z := by + classical + intro V E _ _ _ G k e0 Tn Tj TjPrime rho1 rho0 mu0 deltaN beta terminalSupport u z hTjN + hterminalPrime hprimeClosed hprimeElementary hbetaDelta hbeta hdeltaMissing hz huPrime + huOutside hrho0 hmuRho0Fixed missing_eq_mu_rho0 hbetaZ + have hzN := TreeSequenceInitialSegmentVertexSetSubset hTjN hz + have hzu : z ≠ u := by + intro h + apply huOutside + rw [← h] + exact hzN + have hmuRho0Z := missing_eq_mu_rho0 z (hmuRho0Fixed z + (Finset.mem_union.mpr (Or.inl hzN)) hzu) + rw [hmuRho0Z] + by_cases hzPrime : z ∈ TreeSequenceVertexSet TjPrime + · have hdisjoint := hprimeElementary hzPrime huPrime hzu + exact False.elim ((Finset.disjoint_left.mp hdisjoint) hbetaZ hbeta) + · apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro hdeltaPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hdeltaPresent + obtain ⟨f, hzf, hfRho0⟩ := hdeltaPresent + by_cases ht : TreeIncidentEdge TjPrime f + · have hfRho1 : rho1 f = some deltaN := by + simpa [hrho0, OutsideTreeColorSwap, ht] using hfRho0 + obtain ⟨q, hqPrime, hqf⟩ := ht + have hqz : q ≠ z := by + intro h + subst q + exact hzPrime hqPrime + have hboundary : f ∈ BoundaryEdges G + (TreeSequenceVertexSet TjPrime) := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, hqPrime, z, hzPrime, + (Sym2.mem_and_mem_iff hqz).mp ⟨hqf, hzf⟩⟩ + exact (hprimeClosed hboundary hterminalPrime hfRho1) hdeltaMissing + · have hfBeta : rho1 f = some beta := by + by_cases hfb : rho1 f = some beta + · exact hfb + · by_cases hfd : rho1 f = some deltaN + · have : (some beta : Option (Fin k)) = some deltaN := by + simp [hrho0, OutsideTreeColorSwap, ht, hfd, hbetaDelta, hbetaDelta.symm] at hfRho0 + exact False.elim (hbetaDelta (Option.some.inj this)) + · have : rho1 f = some deltaN := by + simp [hrho0, OutsideTreeColorSwap, ht, hfb, hfd] at hfRho0 + exact False.elim (hfd this) + have hbetaNotPresent : beta ∉ PresentColors G rho1 z := by + simpa [MissingColors] using hbetaZ + exact hbetaNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hzf, hfBeta⟩) + +theorem P2966_T1_OutsideSwapPrefixEffects {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (Tn Tj seed TjPrime : TreeSequence G e0) + (phiJ rho1 rho0 mu0 : PartialEdgeColoring E k) + (deltaN beta : Fin k) (terminalSupport u z : V) + (zPosition : Fin (Tj.length + 1)) + (hTjN : TreeSequenceInitialSegment Tj Tn) + (hterminalPrime : terminalSupport ∈ TreeSequenceVertexSet TjPrime) + (hprimeClosed : ColoredVertexSetClosed G rho1 + (TreeSequenceVertexSet TjPrime)) + (hprimeElementary : ColoredVertexSetElementary G rho1 + (TreeSequenceVertexSet TjPrime)) + (hbetaDelta : beta ≠ deltaN) + (hbeta : beta ∈ MissingColors G rho1 u) + (hdeltaMissing : deltaN ∈ MissingColors G rho1 terminalSupport) + (hb2Missing : ∀ v : V, + v ∈ (TreeSequenceVertexSet Tj).erase terminalSupport → + MissingColors G rho1 v = MissingColors G phiJ v) + (haugmentation : TashkinovAugmentationSequence phiJ seed Tj) + (hb2Edges : ∀ a : Fin Tj.length, seed.length ≤ a.val → + rho1 (Tj.edge a) = phiJ (Tj.edge a)) + (hdeltaPhiJ : deltaN ∉ TreeMissingColors phiJ Tj) + (hz : z ∈ TreeSequenceVertexSet Tj) + (_ : Tj.vertex zPosition = z) + (_ : seed.length ≤ zPosition.val) + (huPrime : u ∈ TreeSequenceVertexSet TjPrime) + (huOutside : u ∉ TreeSequenceVertexSet Tn) + (hzBefore : ∀ w ∈ TreeVerticesBefore Tj z hz, + beta ∉ MissingColors G rho1 w) + (hzEdges : ∀ a : Fin Tj.length, seed.length ≤ a.val → + a.val < zPosition.val → rho1 (Tj.edge a) ≠ some beta) + (hrho0 : rho0 = OutsideTreeColorSwap TjPrime rho1 beta deltaN) + (hrho0Fixed : ∀ f : E, TreeIncidentEdge TjPrime f → rho0 f = rho1 f) + (hmuRho0Fixed : ∀ w : V, + w ∈ TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet TjPrime → + w ≠ u → ∀ f : E, Incident G w f → mu0 f = rho0 f) + (hmissingPrime : ∀ w : V, + w ∈ TreeSequenceVertexSet TjPrime → w ≠ u → + MissingColors G mu0 w = MissingColors G rho1 w) + (htreeEdgeFixed : ∀ a : Fin TjPrime.length, + mu0 (TjPrime.edge a) = rho1 (TjPrime.edge a)) + (rho0_unaffected : ∀ c : Fin k, c ≠ beta → c ≠ deltaN → + ∀ f : E, (rho0 f = some c ↔ rho1 f = some c)) : + (∀ v : V, + v ∈ (((TreeVerticesBefore Tj z hz ∪ {z}) ∪ + (TreeVerticesBefore TjPrime u huPrime ∪ {u})).erase u).erase z → + MissingColors G mu0 v = MissingColors G rho1 v) ∧ + (∀ f : E, + ((∃ a : Fin Tj.length, + seed.length ≤ a.val ∧ a.val < zPosition.val ∧ + Tj.edge a = f) ∨ + (∃ (a : Fin TjPrime.length) + (uPosition : Fin (TjPrime.length + 1)), + TjPrime.vertex uPosition = u ∧ a.val < uPosition.val ∧ + TjPrime.edge a = f)) → + mu0 f = rho1 f) ∧ + (beta ∈ MissingColors G rho1 z → + deltaN ∈ MissingColors G mu0 z) ∧ + (z ∈ TreeVerticesBefore TjPrime u huPrime → + MissingColors G mu0 z = MissingColors G rho1 z) := by + classical + have augmentation_edge_missing {B : TreeSequence G e0} + (hreach : TashkinovAugmentationSequence phiJ seed B) : + ∀ a : Fin B.length, seed.length ≤ a.val → + ∃ i : Fin (B.length + 1), i.val ≤ a.val ∧ + ∃ c : Fin k, phiJ (B.edge a) = some c ∧ + c ∈ MissingColors G phiJ (B.vertex i) := by + exact @P2966_T1_OutsideSwapPrefixEffects_augmentation_edge_missing_98 V E inferInstance + inferInstance G k e0 Tj seed phiJ zPosition B hreach + have hTjEdgeFixed : ∀ a : Fin Tj.length, seed.length ≤ a.val → + a.val < zPosition.val → mu0 (Tj.edge a) = rho1 (Tj.edge a) := by + exact @P2966_T1_OutsideSwapPrefixEffects_hTjEdgeFixed_143 V E inferInstance inferInstance + inferInstance G k e0 Tn Tj seed TjPrime phiJ rho1 rho0 mu0 deltaN beta u zPosition hTjN + hbeta haugmentation hb2Edges hdeltaPhiJ huPrime huOutside hzEdges hrho0 hrho0Fixed + hmuRho0Fixed hmissingPrime augmentation_edge_missing + have before_mem_and_ne : + ∀ {A : TreeSequence G e0} {a : V} (ha : a ∈ TreeSequenceVertexSet A) (w : V), w ∈ + TreeVerticesBefore A a ha → w ∈ TreeSequenceVertexSet A ∧ w ≠ a := by + intro A a ha w hw + unfold TreeVerticesBefore at hw + obtain ⟨hwA, i, j, hiw, hja, hij⟩ := Finset.mem_filter.mp hw + refine ⟨hwA, ?_⟩ + intro hwa + have hijEq : i = j := A.vertex_injective (hiw.trans (hwa.trans hja.symm)) + subst j + omega + have missing_eq_mu_rho0 : ∀ (w : V), + (∀ f : E, Incident G w f → mu0 f = rho0 f) → + MissingColors G mu0 w = MissingColors G rho0 w := by + intro w hfixed + apply Finset.ext + intro c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + constructor + · intro hnew hold + obtain ⟨f, hwf, hfc⟩ := hold + exact hnew ⟨f, hwf, (hfixed f hwf).trans hfc⟩ + · intro hold hnew + obtain ⟨f, hwf, hfc⟩ := hnew + exact hold ⟨f, hwf, (hfixed f hwf).symm.trans hfc⟩ + have outside_before_missing_eq : + ∀ w : V, w ∈ TreeVerticesBefore Tj z hz → w ∉ TreeSequenceVertexSet TjPrime → MissingColors G + mu0 w = MissingColors G rho1 w := by + exact @P2966_T1_OutsideSwapPrefixEffects_outside_before_missing_eq_202 V E inferInstance + inferInstance inferInstance G k e0 Tn Tj TjPrime phiJ rho1 rho0 mu0 deltaN beta + terminalSupport u z hTjN hterminalPrime hprimeClosed hbetaDelta hbeta hdeltaMissing + hb2Missing hdeltaPhiJ hz huPrime huOutside hzBefore hrho0 hmuRho0Fixed rho0_unaffected + before_mem_and_ne missing_eq_mu_rho0 + refine ⟨?_, ?_, ?_, ?_⟩ + · intro v hv + obtain ⟨hvz, hv⟩ := Finset.mem_erase.mp hv + obtain ⟨hvu, hv⟩ := Finset.mem_erase.mp hv + rcases Finset.mem_union.mp hv with hv | hv + · rcases Finset.mem_union.mp hv with hvBefore | hvz' + · by_cases hvPrime : v ∈ TreeSequenceVertexSet TjPrime + · exact hmissingPrime v hvPrime hvu + · exact outside_before_missing_eq v hvBefore hvPrime + · exact False.elim (hvz (by simpa using hvz')) + · rcases Finset.mem_union.mp hv with hvBefore | hvu' + · exact hmissingPrime v (before_mem_and_ne huPrime v hvBefore).1 hvu + · exact False.elim (hvu (by simpa using hvu')) + · intro f hf + rcases hf with hf | hf + · obtain ⟨a, ha, haz, rfl⟩ := hf + exact hTjEdgeFixed a ha haz + · obtain ⟨a, uPosition, huPosition, hau, rfl⟩ := hf + exact htreeEdgeFixed a + · exact @P2966_T1_OutsideSwapPrefixEffects_branch_306 V E inferInstance inferInstance + inferInstance G k e0 Tn Tj TjPrime rho1 rho0 mu0 deltaN beta terminalSupport u z hTjN + hterminalPrime hprimeClosed hprimeElementary hbetaDelta hbeta hdeltaMissing hz huPrime + huOutside hrho0 hmuRho0Fixed missing_eq_mu_rho0 + · intro hzBeforePrime + obtain ⟨hzPrime, hzu⟩ := + before_mem_and_ne huPrime z hzBeforePrime + exact hmissingPrime z hzPrime hzu + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OutsideTreeColorSwap.lean b/LeanPool/GoldbergSeymour/OutsideTreeColorSwap.lean new file mode 100644 index 0000000000..64540cf5ac --- /dev/null +++ b/LeanPool/GoldbergSeymour/OutsideTreeColorSwap.lean @@ -0,0 +1,36 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.PartialEdgeColoring + +/-! +# Outside Tree Color Swap + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Swap two colors only on edges incident to no vertex of the tree. -/ +noncomputable def OutsideTreeColorSwap {V E : Type*} {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) : + PartialEdgeColoring E k := by + classical + exact fun e => + if TreeIncidentEdge T e then phi e + else if phi e = some alpha then some beta + else if phi e = some beta then some alpha + else phi e + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/OutsideTreeColorSwapStable.lean b/LeanPool/GoldbergSeymour/OutsideTreeColorSwapStable.lean new file mode 100644 index 0000000000..6293fb8f43 --- /dev/null +++ b/LeanPool/GoldbergSeymour/OutsideTreeColorSwapStable.lean @@ -0,0 +1,218 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed + +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring + +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap + +public import LeanPool.GoldbergSeymour.StableColoring + +/-! +# Outside Tree Color Swap Stable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem OutsideTreeColorSwapStable {V E : Type*} + [Fintype V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (C : Finset (Fin k)) + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T)) + (halpha : alpha ∈ TreeMissingColors phi T) + (hbeta : beta ∈ TreeMissingColors phi T) + (hdistinct : alpha ≠ beta) : + let psi := OutsideTreeColorSwap T phi alpha beta + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0 ∧ + StableColoring T C phi psi ∧ + ∀ f : E, TreeIncidentEdge T f → psi f = phi f := by + classical + let psi := OutsideTreeColorSwap T phi alpha beta + change IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0 ∧ + StableColoring T C phi psi ∧ + ∀ f : E, TreeIncidentEdge T f → psi f = phi f + have ends_eq_of_mem : ∀ {z : Sym2 V} {x y : V}, x ∈ z → y ∈ z → x ≠ y → + z = s(x, y) := by + intro z x y hx hy hxy + induction z using Sym2.inductionOn with + | _ a b => + simp only [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> + simp_all [] + have halpha_closed : ∀ {f}, f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → + phi f ≠ some alpha := by + intro f hf hfa + obtain ⟨v, hv, hvm⟩ := by + unfold TreeMissingColors at halpha + simpa only [Finset.mem_biUnion] using halpha + exact (hclosed hf hv hfa) hvm + have hbeta_closed : ∀ {f}, f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → + phi f ≠ some beta := by + intro f hf hfb + obtain ⟨v, hv, hvm⟩ := by + unfold TreeMissingColors at hbeta + simpa only [Finset.mem_biUnion] using hbeta + exact (hclosed hf hv hfb) hvm + have tree_fixed : ∀ {f}, TreeIncidentEdge T f → psi f = phi f := by + intro f hf + simp [psi, OutsideTreeColorSwap, hf] + have tree_boundary : ∀ {f g : E}, TreeIncidentEdge T f → + ¬ TreeIncidentEdge T g → AdjacentEdges G f g → + f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + intro f g hf hg hadj + obtain ⟨x, hx, hxf⟩ := hf + obtain ⟨w, hwf, hwg⟩ := hadj + have hw : w ∉ TreeSequenceVertexSet T := by + intro hw + exact hg ⟨w, hw, hwg⟩ + have hxw : x ≠ w := by + intro h + exact hw (h ▸ hx) + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hx, w, hw, ends_eq_of_mem hxf hwf hxw⟩ + have swap_injective : Function.Injective (fun q : Option (Fin k) => + if q = some alpha then some beta else + if q = some beta then some alpha else q) := by + intro q r h + cases q <;> cases r + · rfl + · rename_i a + by_cases ha : a = alpha + · simp [ha] at h + · by_cases hb : a = beta + · have hab : beta ≠ alpha := by + intro hab + exact ha (hb.trans hab) + simp [hb, hab] at h + · simp [ha, hb] at h + · rename_i a + by_cases ha : a = alpha + · simp [ha] at h + · by_cases hb : a = beta + · have hab : beta ≠ alpha := by + intro hab + exact ha (hb.trans hab) + simp [hb, hab] at h + · simp [ha, hb] at h + · simp only [Option.some.injEq] at h ⊢ + rename_i a b + by_cases aa : a = alpha <;> by_cases ab : a = beta <;> + by_cases ba : b = alpha <;> by_cases bb : b = beta <;> simp_all + refine ⟨?_, ?_, ?_, fun f hf => tree_fixed hf⟩ + · intro f g c hne hadj hfc + by_cases hf : TreeIncidentEdge T f + · by_cases hg : TreeIncidentEdge T g + · intro hgc + apply hproper hne hadj + · simpa [tree_fixed hf] using hfc + · simpa [tree_fixed hg] using hgc + · have hb := tree_boundary hf hg hadj + have hfa : phi f ≠ some alpha := halpha_closed hb + have hfb : phi f ≠ some beta := hbeta_closed hb + have hca : c ≠ alpha := by + intro hc + exact hfa (hc ▸ (by simpa [tree_fixed hf] using hfc)) + have hcb : c ≠ beta := by + intro hc + exact hfb (hc ▸ (by simpa [tree_fixed hf] using hfc)) + intro hgc + have hpg : phi g = some c := by + by_cases ga : phi g = some alpha + · have hs : some beta = some c := by + simpa [psi, OutsideTreeColorSwap, hg, ga] using hgc + exact False.elim (hcb (Option.some.inj hs).symm) + · by_cases gb : phi g = some beta + · have hab : alpha ≠ beta := by + intro hab + exact ga (hab ▸ gb) + have hs : some alpha = some c := by + simpa [psi, OutsideTreeColorSwap, hg, ga, gb, hab, hab.symm] + using hgc + exact False.elim (hca (Option.some.inj hs).symm) + · simpa [psi, OutsideTreeColorSwap, hg, ga, gb] using hgc + exact hproper hne hadj (by simpa [tree_fixed hf] using hfc) hpg + · by_cases hg : TreeIncidentEdge T g + · obtain ⟨w, hwf, hwg⟩ := hadj + have hb := tree_boundary hg hf ⟨w, hwg, hwf⟩ + have hga : phi g ≠ some alpha := halpha_closed hb + have hgb : phi g ≠ some beta := hbeta_closed hb + intro hgc + have hpg : phi g = some c := by simpa [tree_fixed hg] using hgc + have hca : c ≠ alpha := by + intro hc + exact hga (hc ▸ hpg) + have hcb : c ≠ beta := by + intro hc + exact hgb (hc ▸ hpg) + have hfc' : phi f = some c := by + by_cases fa : phi f = some alpha + · have hs : some beta = some c := by + simpa [psi, OutsideTreeColorSwap, hf, fa] using hfc + exact False.elim (hcb (Option.some.inj hs).symm) + · by_cases fb : phi f = some beta + · have hab : alpha ≠ beta := by + intro hab + exact fa (hab ▸ fb) + have hs : some alpha = some c := by + simpa [psi, OutsideTreeColorSwap, hf, fa, fb, hab, hab.symm] + using hfc + exact False.elim (hca (Option.some.inj hs).symm) + · simpa [psi, OutsideTreeColorSwap, hf, fa, fb] using hfc + exact (hproper hne.symm (⟨w, hwg, hwf⟩) hpg hfc') + · intro hgc + have heq : phi f = phi g := by + apply swap_injective + simpa [psi, OutsideTreeColorSwap, hf, hg] using hfc.trans hgc.symm + have hfn : phi f ≠ none := by + intro hnone + simp [psi, OutsideTreeColorSwap, hf, hnone] at hfc + obtain ⟨d, hfd⟩ := Option.ne_none_iff_exists.mp hfn + exact (hproper hne hadj hfd.symm) (heq ▸ hfd.symm) + · unfold IsOneEdgeUncolored + constructor + · by_cases ht : TreeIncidentEdge T e0 + · simpa [psi, OutsideTreeColorSwap, ht] using hone.1 + · simp [psi, OutsideTreeColorSwap, ht, hone.1] + · intro f hfe + obtain ⟨c, hcf⟩ := hone.2 f hfe + by_cases hf : TreeIncidentEdge T f + · exact ⟨c, by simpa [tree_fixed hf] using hcf⟩ + · by_cases ha : phi f = some alpha + · exact ⟨beta, by simp [psi, OutsideTreeColorSwap, hf, ha]⟩ + · by_cases hb : phi f = some beta + · exact ⟨alpha, by simp [psi, OutsideTreeColorSwap, hf, hb]⟩ + · exact ⟨c, by simpa [psi, OutsideTreeColorSwap, hf, ha, hb] using hcf⟩ + · unfold StableColoring + constructor + · intro f hf h + exact (tree_fixed hf).trans (Eq.refl _) + · intro v hv + unfold MissingColors PresentColors + congr 1 + ext c + constructor <;> intro hc + · obtain ⟨_, ⟨f, hfv, hfc⟩⟩ := Finset.mem_filter.mp hc + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, ⟨f, hfv, by simpa [tree_fixed ⟨v, hv, hfv⟩] using hfc⟩⟩ + · obtain ⟨_, ⟨f, hfv, hfc⟩⟩ := Finset.mem_filter.mp hc + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, ⟨f, hfv, by simpa [tree_fixed ⟨v, hv, hfv⟩] using hfc⟩⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelBaseFourCommonMissingColors.lean b/LeanPool/GoldbergSeymour/ParallelBaseFourCommonMissingColors.lean new file mode 100644 index 0000000000..0463d7063a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelBaseFourCommonMissingColors.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CommonMissingColorsAtUncoloredEndpoints +public import LeanPool.GoldbergSeymour.HierarchyBase + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment + +/-! +# Parallel Base Four Common Missing Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem ParallelBaseFourCommonMissingColors + {V E : Type*} [Fintype V] [Fintype E] + [ DecidableEq V] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hdegree : MaximumDegree G + 1 <= k) + (helem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet base.core)) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + 4 <= (TreeMissingColors phi Tn ∩ + TreeMissingColors phi base.closure).card := by + dsimp + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let supportPrefix := TreeSequencePrefix Tn base.supportPosition.val + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt) + obtain ⟨hchosen, hclosure, ⟨hunion⟩⟩ := base.parallel hPE + let j : Fin Tn.length := ⟨0, Tn.positive⟩ + obtain ⟨i, hi⟩ := Tn.attaches j + have hi0 : i = 0 := Fin.eq_zero i + subst i + let x := Tn.vertex j.succ + let y := Tn.vertex (0 : Fin (Tn.length + 1)) + have hends : G.ends e0 = s(x, y) := by + rw [← Tn.first_edge] + convert hi using 1 + simp only [x, y, j] + congr 2 + have hxTn : x ∈ TreeSequenceVertexSet Tn := by + rw [TreeSequenceVertexSet] + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j.succ, Finset.mem_univ _, rfl⟩ + have hyTn : y ∈ TreeSequenceVertexSet Tn := by + rw [TreeSequenceVertexSet] + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨0, Finset.mem_univ _, rfl⟩ + have hxPrefix : x ∈ TreeSequenceVertexSet supportPrefix := by + rw [TreeSequenceVertexSet] + let p : Fin (base.supportPosition.val + 1) := + ⟨1, Nat.lt_succ_of_le base.supportPositive⟩ + refine (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨p, Finset.mem_univ _, ?_⟩ + simp [supportPrefix, TreeSequencePrefix, x, j, p] + have hyPrefix : y ∈ TreeSequenceVertexSet supportPrefix := by + rw [TreeSequenceVertexSet] + let p : Fin (base.supportPosition.val + 1) := ⟨0, Nat.zero_lt_succ _⟩ + refine (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨p, Finset.mem_univ _, ?_⟩ + simp [supportPrefix, TreeSequencePrefix, y, p] + have hprefixSegment := + TashkinovAugmentationSequenceInitialSegment phi supportPrefix base.closure hclosure.1 + have prefixInClosure : TreeSequenceVertexSet supportPrefix ⊆ + TreeSequenceVertexSet base.closure := by + intro z hz + rw [TreeSequenceVertexSet] at hz ⊢ + obtain ⟨a, -, rfl⟩ := + (@Finset.mem_image _ _ (Classical.decEq V)).mp hz + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨Fin.castLE (Nat.succ_le_succ hprefixSegment.1) a, + Finset.mem_univ _, hprefixSegment.2.1 a⟩ + have hxClosure : x ∈ TreeSequenceVertexSet base.closure := + prefixInClosure hxPrefix + have hyClosure : y ∈ TreeSequenceVertexSet base.closure := + prefixInClosure hyPrefix + have hUnionElem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet base.closure) := by + rw [← hunion.vertexSet] + exact helem + exact CommonMissingColorsAtUncoloredEndpoints G k e0 phi Tn base.closure + x y hends hproper hone hdegree hxTn hyTn hxClosure hyClosure hUnionElem + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelClosureUnionElementary.lean b/LeanPool/GoldbergSeymour/ParallelClosureUnionElementary.lean new file mode 100644 index 0000000000..9cac2cd146 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelClosureUnionElementary.lean @@ -0,0 +1,124 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ParallelSupportClosureProperties +public import LeanPool.GoldbergSeymour.ParallelTerminalAwayInterchangeable +public import LeanPool.GoldbergSeymour.ParallelTerminalPEPreprocessing +public import LeanPool.GoldbergSeymour.ParallelTwoConstituentPathContradiction + +public import LeanPool.GoldbergSeymour.Td + +/-! +# Parallel Closure Union Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ParallelClosureUnionElementary {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (sigma : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma) + (baseSigma : HierarchyBase ett sigma) : + ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet baseSigma.core) := by + classical + have ctx : TechnicalInductionContext G k e0 ett.rounds := by + refine { + lowerOne := ?_ + lowerTwo := ?_ + lowerThree := ?_ + lowerFour := ?_ + lowerFive := ?_ + lowerSix := ?_ + currentThree := ?_ + currentFour := ?_ + currentFive := ?_ + currentSix := ?_ } + · intro input' T' generating' lower hp hlt hmax + exact (hlower lower hp hlt hmax).1 + · intro input' T' generating' lower hp hlt hmax + exact (hlower lower hp hlt hmax).2.1 + · intro input' T' generating' lower hp hlt hmax + exact (hlower lower hp hlt hmax).2.2.1 + · intro input' T' generating' lower hp hlt hmax + exact (hlower lower hp hlt hmax).2.2.2.1 + · intro input' T' generating' lower hp hlt hmax + exact (hlower lower hp hlt hmax).2.2.2.2.1 + · intro input' T' generating' lower hp hlt hmax + exact (hlower lower hp hlt hmax).2.2.2.2.2 + · intro input' T' generating' current hround hmax + apply ExtensionRules G k e0 input' T' generating' current hmax + current.roundsPositive + intro lowerT lowerGenerating lower hp hlt lowerMax + apply hlower lower hp (by omega) lowerMax + · intro input' T' generating' current hround hmax + apply ExtensionBase G k e0 input' T' generating' current hmax + current.roundsPositive + intro lowerInput lowerT lowerGenerating lower hp hlt lowerMax + apply hlower lower hp (by omega) lowerMax + · intro input' T' generating' current hround hmax + apply Basic2 G k e0 input' T' generating' current hmax + current.roundsPositive + intro lowerInput lowerT lowerGenerating lower hp hlt lowerMax + apply hlower lower hp (by omega) lowerMax + · intro input' T' generating' current hround hmax + apply Td G k e0 input' T' generating' current hmax + current.roundsPositive + intro lowerInput lowerT lowerGenerating lower hp hlt lowerMax + apply hlower lower hp (by omega) lowerMax + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + have hpre := ParallelTerminalPEPreprocessing G k e0 input T phi ett ctx + hMP hpositive hPE sigma hproper hone hstable baseSigma + dsimp at hpre + rcases hpre with + ⟨support, common, gamma, delta, hsupport, hgamma, hdelta, + hsupportT, hsupportJ, hcommonT, hcommonJ, hcommonNe, + hdeltaMissing, hgammaNotMissing, hcommonMissing, hTElementary⟩ + have hclosure := ParallelSupportClosureProperties G k e0 input T phi ett + ctx hMP hpositive hPE sigma hproper hone hstable baseSigma + rcases hclosure with ⟨hJElementary, hJClosed, hJInterchangeable⟩ + have hTInterchangeable := + ParallelTerminalAwayInterchangeable G k e0 input T phi ett ctx hMP + hpositive hPE sigma hproper hone hstable support gamma delta + hsupport hgamma hdelta + dsimp at hTInterchangeable + have hunion : Nonempty (OrderedTreeUnion Tn baseSigma.closure baseSigma.core) := by + simpa [n, Tn] using (baseSigma.parallel hPE).2.2 + apply ParallelTwoConstituentPathContradiction G k e0 sigma Tn + baseSigma.closure baseSigma.core hunion hproper hTElementary + hJElementary hJClosed support common gamma delta hsupportT hsupportJ + hcommonT hcommonJ hcommonNe hdeltaMissing hgammaNotMissing + hcommonMissing + · intro alpha beta halpha hbeta halphaGamma halphaDelta hbetaGamma + hbetaDelta + exact hTInterchangeable alpha beta halpha hbeta halphaGamma halphaDelta + hbetaGamma hbetaDelta + · exact hJInterchangeable + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelCommonMissingClosed.lean b/LeanPool/GoldbergSeymour/ParallelCommonMissingClosed.lean new file mode 100644 index 0000000000..705a335139 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelCommonMissingClosed.lean @@ -0,0 +1,521 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure + +public import LeanPool.GoldbergSeymour.TreeColorSetClosed + +/-! +# Parallel Common Missing Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_238.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (base : HierarchyBase ett phi), + phi = ett.series.data.coloring (Fin.last ett.rounds) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < + ett.rounds) => by omega⟩ : + Fin ett.rounds); + ∀ (gamma : Fin k) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring + q.castSucc)), + BoundaryColorEdges G (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) gamma = + {choice.edge} ∧ + (∀ + g ∈ + BoundaryColorEdges G (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color, + ∃ (w : V), TreeVertexOrder (ett.series.data.tree q.succ.castSucc) w + choice.vertex ∧ Incident G w g) ∧ + (ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc), + alpha ≠ choice.color → + BoundaryColorEdges G (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) alpha = + ∅) → + Tn = ett.series.data.tree q.succ.castSucc → + choice.vertex = Tn.vertex base.supportPosition → + q.succ = Fin.last ett.rounds → + ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + TreeSequenceVertexSet base.core = TreeSequenceVertexSet Tn ∪ + TreeSequenceVertexSet base.closure → + TreeSequenceVertexSet Tn ⊆ TreeSequenceVertexSet base.core → + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet base.core → + (∀ {w : V}, + TreeVertexOrder Tn w (Tn.vertex base.supportPosition) → + w ∈ TreeSequenceVertexSet base.closure) → + ∀ + alpha ∈ + TreeMissingColors phi (ett.series.data.tree (Fin.last + ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure, + alpha ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last + ett.rounds).castSucc) → + alpha ∈ TreeMissingColors phi base.closure → + ∀ (y : V), + alpha ∈ MissingColors G phi y → + ∀ g ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet + base.core) alpha, + phi g = some alpha → + ∀ p ∈ TreeSequenceVertexSet base.core, + ∀ r ∉ TreeSequenceVertexSet base.core, + G.ends g = s(p, r) → p ∉ TreeSequenceVertexSet + base.closure → False := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett hpositive base hphi n Tn q gamma choice + hboundary hTn hchoice hindex helem coreVertices hX hY hpreVertex alpha halpha halphaX + halphaY y hymiss g hg hcolor p hp r hr hends hpY + have hpX : p ∈ TreeSequenceVertexSet Tn := by + have : p ∈ TreeSequenceVertexSet Tn ∪ + TreeSequenceVertexSet base.closure := by + rw [← coreVertices] + exact hp + exact Finset.mem_union.mp this |>.resolve_right hpY + have hrX : r ∉ TreeSequenceVertexSet Tn := by + intro hrX + apply hr + exact hX hrX + have hbX : g ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) := by + simpa [BoundaryEdges] using + (show ∃ u ∈ TreeSequenceVertexSet Tn, ∃ v ∉ + TreeSequenceVertexSet Tn, G.ends g = s(u, v) from + ⟨p, hpX, r, hrX, hends⟩) + have hcgX : g ∈ BoundaryColorEdges G phi + (TreeSequenceVertexSet Tn) alpha := by + simp [BoundaryColorEdges, hbX, hcolor] + have hcgX' := hcgX + rw [hphi, ← hindex, hTn] at hcgX' + have hworderT : ∀ {w : V}, + TreeVertexOrder (ett.series.data.tree q.succ.castSucc) w choice.vertex → + TreeVertexOrder Tn w (Tn.vertex base.supportPosition) := by + intro w hw + simpa [hTn, hchoice] using hw + by_cases halphaDelta : alpha = choice.color + · subst alpha + obtain ⟨w, hworder, hincident⟩ := hboundary.2.1 g hcgX' + have hwX : w ∈ TreeSequenceVertexSet Tn := by + have hworder' := hworderT hworder + unfold TreeVertexOrder at hworder' + obtain ⟨i, j, hi, hj, hij⟩ := hworder' + unfold TreeSequenceVertexSet + simp only [Finset.mem_image] + exact ⟨i, Finset.mem_univ _, hi⟩ + have hwY : w ∈ TreeSequenceVertexSet base.closure := by + apply hpreVertex + exact hworderT hworder + have hwends : w = p ∨ w = r := by + change w ∈ G.ends g at hincident + rw [hends] at hincident + simpa using hincident + cases hwends with + | inl hwp => exact hpY (hwp ▸ hwY) + | inr hwr => exact hr (hY (hwr ▸ hwY)) + · have halphaX' := halphaX + rw [hphi, ← hindex] at halphaX' + have hempty := hboundary.2.2 helem alpha halphaX' halphaDelta + rw [hempty] at hcgX' + simp at hcgX' + +private theorem helper_continuation_360.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (base : HierarchyBase ett phi), + phi = ett.series.data.coloring (Fin.last ett.rounds) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring + q.castSucc)), + BoundaryColorEdges G (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) gamma = + ({choice.edge} : Finset E) ∧ + (∀ + g ∈ + BoundaryColorEdges G (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color, + ∃ (w : V), TreeVertexOrder (ett.series.data.tree q.succ.castSucc) w + choice.vertex ∧ Incident G w g) ∧ + (ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc), + alpha ≠ choice.color → + BoundaryColorEdges G (ett.series.data.coloring q.succ) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) alpha = + ∅) → + Tn = ett.series.data.tree q.succ.castSucc → + choice.vertex = Tn.vertex base.supportPosition → + q.succ = Fin.last ett.rounds → + ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + TreeSequenceVertexSet base.core = TreeSequenceVertexSet Tn ∪ + TreeSequenceVertexSet base.closure → + ColoredVertexSetClosed G phi (TreeSequenceVertexSet base.closure) → + TreeSequenceVertexSet Tn ⊆ TreeSequenceVertexSet base.core → + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet base.core → + (∀ {w : V}, + TreeVertexOrder Tn w (Tn.vertex base.supportPosition) → + w ∈ TreeSequenceVertexSet base.closure) → + ∀ + alpha ∈ + (TreeMissingColors phi (ett.series.data.tree (Fin.last + ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure : + Finset (Fin k)), + BoundaryColorEdges G phi (TreeSequenceVertexSet base.core) alpha + = ∅ := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett hpositive base hphi n Tn q gamma choice + hboundary hTn hchoice hindex helem coreVertices hclosed hX hY hpreVertex alpha halpha + obtain ⟨halphaX, halphaY⟩ := Finset.mem_inter.mp halpha + have alphaMissing : ∃ y : V, y ∈ TreeSequenceVertexSet base.closure ∧ + alpha ∈ MissingColors G phi y := by + unfold TreeMissingColors at halphaY + exact Finset.mem_biUnion.mp halphaY + obtain ⟨y, hy, hymiss⟩ := alphaMissing + apply Finset.eq_empty_iff_forall_notMem.mpr + intro g hg + have hg' : g ∈ BoundaryEdges G (TreeSequenceVertexSet base.core) ∧ + phi g = some alpha := by + simpa [BoundaryColorEdges] using hg + obtain ⟨hb, hcolor⟩ := hg' + have hb' : ∃ u ∈ TreeSequenceVertexSet base.core, ∃ v ∉ + TreeSequenceVertexSet base.core, G.ends g = s(u, v) := by + simpa [BoundaryEdges] using hb + obtain ⟨p, hp, r, hr, hends⟩ := hb' + by_cases hpY : p ∈ TreeSequenceVertexSet base.closure + · have hrY : r ∉ TreeSequenceVertexSet base.closure := by + intro hrY + apply hr + exact hY hrY + have hbY : g ∈ BoundaryEdges G (TreeSequenceVertexSet base.closure) := by + simpa [BoundaryEdges] using + (show ∃ u ∈ TreeSequenceVertexSet base.closure, ∃ v ∉ + TreeSequenceVertexSet base.closure, G.ends g = s(u, v) from + ⟨p, hpY, r, hrY, hends⟩) + have hcgY : g ∈ BoundaryColorEdges G phi + (TreeSequenceVertexSet base.closure) alpha := by + simp [BoundaryColorEdges, hbY, hcolor] + have hnot := hclosed hbY hy hcolor + exact (hnot (by simpa [MissingColors] using hymiss)).elim + · exact @helper_branch_238 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating phi ett hpositive base hphi gamma choice hboundary hTn hchoice hindex + helem coreVertices hX hY hpreVertex alpha halpha halphaX halphaY y hymiss g hg hcolor p hp + r hr hends hpY + +private theorem helper_branch_69.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (base : HierarchyBase ett phi), + phi = ett.series.data.coloring (Fin.last ett.rounds) → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + (let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc))) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < + ett.rounds) => by omega⟩ : + Fin ett.rounds); + q.succ = n → + ∀ (ci : Fin ett.rounds), + IsProperEdgeColoring G (ett.series.data.coloring ci.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring ci.castSucc) e0 → + ColoredVertexSetClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc)) → + ¬Nonempty (RevisitingExtensionCertificate ett.series.data ci.castSucc) → + ∀ + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree ci.succ.castSucc) + (TashkinovStoredColors ett.series.data ci.castSucc) + (ett.series.data.coloring ci.castSucc)), + (∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) + (insert choice.color (TashkinovStoredColors + ett.series.data ci.castSucc)) + choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc))) → + ∀ (gamma : Fin k), + ParallelExtensionColor ett.series.data ci.castSucc + choice.selected choice.vertex gamma → + ∀ (secondStable : PartialEdgeColoring E k), + StableColoring (ett.series.data.tree ci.succ.castSucc) + (insert choice.color (TashkinovStoredColors + ett.series.data ci.castSucc)) + choice.selected secondStable → + TreeExit (ett.series.data.tree ci.succ.castSucc) + secondStable gamma choice.color + choice.vertex → + ett.series.data.coloring ci.succ = + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) → + IsProperEdgeColoring G (ett.series.data.coloring + ci.succ) → + IsOneEdgeUncolored (ett.series.data.coloring ci.succ) + e0 → + ett.series.data.stored ci.succ = {choice.color, + gamma} → + ett.series.data.connectingEdges ci.succ = + {choice.edge} → + ett.series.data.kind ci.succ = some + TashkinovExtensionKind.PE → + ett.series.data.chosenVertex ci.succ = some + choice.vertex → + ett.series.data.outsideVertex ci.succ = + some choice.otherEndpoint → + ett.series.data.delta ci.succ = some + choice.color → + ett.series.data.gamma ci.succ = some + gamma → + TashkinovClosure + (ett.series.data.coloring ci.succ) + (ett.series.data.tree + ci.succ.castSucc) + (ett.series.data.tree + ci.succ.succ) → + TreeSequenceInitialSegment + (ett.series.data.tree + ci.succ.castSucc) + (ett.series.data.tree + ci.succ.succ) → + (ett.series.data.tree + ci.succ.castSucc).length < + (ett.series.data.tree + ci.succ.succ).length → + q.succ = ci.succ → + let Tn : TreeSequence G e0 := + ett.series.data.tree + (Fin.last + ett.rounds).castSucc; + TreeColorSetClosed G phi + base.core + (TreeMissingColors phi Tn ∩ + TreeMissingColors phi + base.closure) := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett hpositive base hphi hPE hlowerElementary n + Tn q hsucc ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableRelation exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension target_eq + have hci : ci = q := by + apply Fin.ext + have hv := congrArg Fin.val target_eq + simp at hv + omega + subst ci + have hboundary := HkuParallelBoundaryStructure G k ett.rounds e0 input ett.series q + choice.edge choice.color gamma choice.vertex + (by simpa using currentKind) (by simpa using currentEdges) + (by simpa using currentDelta) (by simpa using currentGamma) + (by simpa using currentVertex) + have hTn : Tn = ett.series.data.tree q.succ.castSucc := by + simpa [Tn] using congrArg + (fun z : Fin (ett.rounds + 1) => ett.series.data.tree z.castSucc) hsucc.symm + have hchoice : choice.vertex = Tn.vertex base.supportPosition := by + have hp := (base.parallel hPE).1 + change ett.series.data.chosenVertex n = + some (Tn.vertex base.supportPosition) at hp + rw [← hsucc] at hp + have hc : ett.series.data.chosenVertex q.succ = some choice.vertex := currentVertex + exact Option.some.inj (hc.symm.trans hp) + have hindex : q.succ = Fin.last ett.rounds := by + simpa [n] using hsucc + have helem : ColoredVertexSetElementary G + (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) := by + unfold ColoredVertexSetElementary at hlowerElementary ⊢ + have hqsucc : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + rw [hqsucc] + intro u hu v hv huv + exact hlowerElementary hu hv huv + have initialVertices : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hab x hx + unfold TreeSequenceVertexSet at hx ⊢ + simp only [Finset.mem_image] at hx ⊢ + obtain ⟨i, hi, rfl⟩ := hx + obtain ⟨hlen, hvertices, hedges⟩ := hab + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, ?_⟩ + exact hvertices i + have prefixClosure : TashkinovClosure phi + (TreeSequencePrefix Tn base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) base.closure := by + exact (base.parallel hPE).2.1 + have vertexReach : ∀ {A B : TreeSequence G e0}, + TashkinovAugmentationSequence phi A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hab + unfold TashkinovAugmentationSequence at hab + induction hab using Relation.ReflTransGen.head_induction_on with + | refl => exact Finset.Subset.rfl + | @head A B hstep htail ih => + intro x hx + obtain ⟨hlen, hvertices, hedges⟩ := hstep.2.1 + apply ih + apply initialVertices hstep.2.1 + exact hx + have prefixInClosure : TreeSequenceVertexSet + (TreeSequencePrefix Tn base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) ⊆ + TreeSequenceVertexSet base.closure := vertexReach prefixClosure.1 + obtain ⟨orderedUnion⟩ := (base.parallel hPE).2.2 + have coreVertices : TreeSequenceVertexSet base.core = + TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet base.closure := by + rw [← orderedUnion.vertexSet] + have hclosed : ColoredVertexSetClosed G phi + (TreeSequenceVertexSet base.closure) := prefixClosure.2 + have hX : TreeSequenceVertexSet Tn ⊆ + TreeSequenceVertexSet base.core := by + rw [coreVertices] + exact Finset.subset_union_left + have hY : TreeSequenceVertexSet base.closure ⊆ + TreeSequenceVertexSet base.core := by + rw [coreVertices] + exact Finset.subset_union_right + have hpreVertex : ∀ {w : V}, TreeVertexOrder Tn w + (Tn.vertex base.supportPosition) → w ∈ TreeSequenceVertexSet base.closure := by + intro w hw + obtain ⟨i, j, hi, hj, hij⟩ := hw + have hj' : j = base.supportPosition := Tn.vertex_injective hj + subst j + have hi' : i.val < base.supportPosition.val := hij + apply prefixInClosure + unfold TreeSequenceVertexSet + simp only [Finset.mem_image] + let i' : Fin (base.supportPosition.val + 1) := ⟨i.val, by omega⟩ + refine ⟨i', Finset.mem_univ _, ?_⟩ + simpa [TreeSequencePrefix, i'] using hi + unfold TreeColorSetClosed + dsimp + exact @helper_continuation_360 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@hpositive) + (@base) (@hphi) (@gamma) (@choice) (@hboundary) (@hTn) (@hchoice) (@hindex) (@helem) + (@coreVertices) (@hclosed) (@hX) (@hY) (@hpreVertex) +theorem ParallelCommonMissingClosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : 0 < ett.rounds) + (base : HierarchyBase ett phi) + (hphi : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (hlowerElementary : + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + ColoredVertexSetElementary G + (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc))) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + TreeColorSetClosed G phi base.core + (TreeMissingColors phi Tn ∩ TreeMissingColors phi base.closure) := by + classical + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + have hq : 0 < ett.rounds := hpositive + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hsucc : q.succ = n := by + apply Fin.ext + simp only [Fin.succ_mk, Fin.last, q, n] + omega + generalize target_eq : q.succ = target + cases ett.series.certified target with + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact @helper_branch_69 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating phi ett hpositive base hphi hPE hlowerElementary hsucc ci + previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableRelation exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension target_eq + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q target_eq).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val target_eq + simp at hv + have hci : ci = q := by ext; omega + subst ci + change ett.series.data.kind n = some TashkinovExtensionKind.PE at hPE + rw [← hsucc] at hPE + rw [currentKind] at hPE + simp at hPE + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hv := congrArg Fin.val target_eq + simp at hv + have hci : ci = q := by ext; omega + subst ci + change ett.series.data.kind n = some TashkinovExtensionKind.PE at hPE + rw [← hsucc] at hPE + rw [currentKind] at hPE + simp at hPE + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelCoreAugmentationStrict.lean b/LeanPool/GoldbergSeymour/ParallelCoreAugmentationStrict.lean new file mode 100644 index 0000000000..db61cd05b2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelCoreAugmentationStrict.lean @@ -0,0 +1,509 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveEdge +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OrderedTreeUnionAugmentationSequence +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Parallel Core Augmentation Strict + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch144Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k + e0 input T phi) (base : HierarchyBase ett phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let supportPrefix : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (_ : ett.series.data.chosenVertex (Fin.last ett.rounds) = some ((ett.series.data.tree + (Fin.last ett.rounds).castSucc).vertex base.supportPosition)) (_ : TashkinovClosure phi + (TreeSequencePrefix (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (↑base.supportPosition : ℕ) base.supportPositive (Nat.le_of_lt_succ + base.supportPosition.isLt)) base.closure) (_ : OrderedTreeUnion (ett.series.data.tree + (Fin.last ett.rounds).castSucc) base.closure base.core) (_ : TashkinovAugmentationSequence + phi Tn base.core) (hrounds : (0 : ℕ) < ett.rounds), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : q.succ = n) (_ : Tn = ett.series.data.tree q.succ.castSucc) (_ : phi = + ett.series.data.coloring q.succ) (_ : TreeSequenceVertexSet supportPrefix ⊆ + TreeSequenceVertexSet base.closure) (_ : Tn.vertex base.supportPosition ∈ + TreeSequenceVertexSet base.closure) (ci : Fin ett.rounds) (_ : IsProperEdgeColoring G + (ett.series.data.coloring ci.castSucc)) (_ : IsOneEdgeUncolored (ett.series.data.coloring + ci.castSucc) e0) (_ : ColoredVertexSetClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc))) (_ : ¬Nonempty + (RevisitingExtensionCertificate ett.series.data ci.castSucc)) (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree ci.succ.castSucc) (TashkinovStoredColors + ett.series.data ci.castSucc) (ett.series.data.coloring ci.castSucc)) (_ : ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc)))) (gamma : Fin k) (_ : ParallelExtensionColor ett.series.data + ci.castSucc choice.selected choice.vertex gamma) (secondStable : PartialEdgeColoring E k) + (_ : StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected secondStable) (_ : + TreeExit (ett.series.data.tree ci.succ.castSucc) secondStable gamma choice.color + choice.vertex) (_ : ett.series.data.coloring ci.succ = TwoColorComponentSwap G + secondStable gamma choice.color (Sum.inl choice.vertex)) (_ : IsProperEdgeColoring G + (ett.series.data.coloring ci.succ)) (_ : IsOneEdgeUncolored (ett.series.data.coloring + ci.succ) e0) (_ : ett.series.data.stored ci.succ = { choice.color, gamma }) (_ : + ett.series.data.connectingEdges ci.succ = { choice.edge }) (_ : ett.series.data.kind + ci.succ = some TashkinovExtensionKind.PE) (_ : ett.series.data.chosenVertex ci.succ = some + choice.vertex) (_ : ett.series.data.outsideVertex ci.succ = some choice.otherEndpoint) (_ + : ett.series.data.delta ci.succ = some choice.color) (_ : ett.series.data.gamma ci.succ = + some gamma) (_ : TashkinovClosure (ett.series.data.coloring ci.succ) (ett.series.data.tree + ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : TreeSequenceInitialSegment + (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : + (ett.series.data.tree ci.succ.castSucc).length < (ett.series.data.tree + ci.succ.succ).length) (_ : q.succ = ci.succ), TashkinovAugmentationSequence phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) base.core ∧ (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length < base.core.length + +private theorem helper_hdeltaMissing_244.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [instE : DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k + e0 input T phi) (hrounds : (0 : ℕ) < ett.rounds), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)) (_ : ett.series.data.coloring q.succ = + TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) (_ : + gamma ∈ MissingColors G secondStable choice.vertex) (_ : gamma ≠ choice.color), + choice.color ∈ MissingColors G (ett.series.data.coloring q.succ) choice.vertex := by + classical + intro V E _ _ instE G k e0 input T phi ett hrounds q gamma secondStable choice currentColoring + hgammaMissing hgammaNe + rw [currentColoring] + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpresent + obtain ⟨e, heIncident, heColor⟩ := hpresent + by_cases heComponent : Sum.inr e ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · by_cases heGamma : secondStable e = some gamma + · have hpGamma : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, heIncident, heGamma⟩ + have hnGamma : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgammaMissing + exact hnGamma hpGamma + · by_cases heDelta : secondStable e = some choice.color + · simp [TwoColorComponentSwap, heComponent, heDelta, + hgammaNe, hgammaNe.symm] at heColor + · simp [TwoColorComponentSwap, heComponent, heGamma, heDelta] at heColor + · have heSecond : secondStable e = some choice.color := by + simpa [TwoColorComponentSwap, heComponent] using heColor + apply heComponent + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, heIncident, heSecond] + +private theorem helper_hlengthNe_341.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k + e0 input T phi) (base : HierarchyBase ett phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ v ∈ TreeSequenceVertexSet base.core, v ∉ TreeSequenceVertexSet Tn → + TreeSequenceInitialSegment Tn base.core → Tn.length ≠ base.core.length := by + classical + intro V E _ _ instV instE G k e0 input T phi ett base n Tn v hvCore hvNotTn hsegment hlength + rw [TreeSequenceVertexSet] at hvCore + obtain ⟨j, -, hj⟩ := + (@Finset.mem_image _ _ (Classical.decEq V)).mp hvCore + let i : Fin (Tn.length + 1) := + Fin.cast (congrArg (fun m => m + 1) hlength.symm) j + have hcast : Fin.castLE (Nat.succ_le_succ hsegment.1) i = j := by + apply Fin.ext + simp [i] + have hvertex := hsegment.2.1 i + rw [hcast] at hvertex + apply hvNotTn + rw [TreeSequenceVertexSet] + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨i, Finset.mem_univ _, hvertex.symm.trans hj⟩ + +private theorem helper_continuation_309.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k + e0 input T phi) (base : HierarchyBase ett phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let supportPrefix : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (_ : TashkinovClosure phi (TreeSequencePrefix (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (↑base.supportPosition : ℕ) base.supportPositive (Nat.le_of_lt_succ + base.supportPosition.isLt)) base.closure) (_ : OrderedTreeUnion (ett.series.data.tree + (Fin.last ett.rounds).castSucc) base.closure base.core) (_ : TashkinovAugmentationSequence + phi Tn base.core) (hrounds : (0 : ℕ) < ett.rounds), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : Tn = ett.series.data.tree q.succ.castSucc) (_ : phi = ett.series.data.coloring q.succ) + (_ : TreeSequenceVertexSet supportPrefix ⊆ TreeSequenceVertexSet base.closure) (_ : + Tn.vertex base.supportPosition ∈ TreeSequenceVertexSet base.closure) (gamma : Fin k) + (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (_ : ett.series.data.coloring q.succ = + TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) (_ : + choice.vertex = Tn.vertex base.supportPosition) (_ : BoundaryColorEdges G + (ett.series.data.coloring q.succ) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) gamma = { choice.edge } ∧ ( + ∀ g ∈ BoundaryColorEdges G (ett.series.data.coloring q.succ) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color, + ∃ (w : V), TreeVertexOrder (ett.series.data.tree q.succ.castSucc) w choice.vertex ∧ Incident G + w g) ∧ (ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (ett.series.data.coloring q.succ) (ett.series.data.tree + q.succ.castSucc), alpha ≠ choice.color → BoundaryColorEdges G (ett.series.data.coloring + q.succ) (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) alpha = ∅)), + let vertices : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ g ∈ BoundaryEdges G vertices, gamma ∈ MissingColors G secondStable choice.vertex → gamma ≠ + choice.color → ett.series.data.coloring q.succ g = some choice.color → + TashkinovAugmentationSequence phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.core ∧ (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + base.core.length := by + classical + intro V E _ _ instV instE G k e0 input T phi ett base n Tn supportPrefix hclosure hunion + hsequence hrounds q hTnq hphiCurrent hprefixClosure hsupportClosure gamma secondStable + choice currentColoring hsupport hboundaryInfo vertices g hgRawBoundary hgammaMissing + hgammaNe hgCurrentDelta + have hgCurrentBoundary : g ∈ BoundaryColorEdges G + (ett.series.data.coloring q.succ) vertices choice.color := + Finset.mem_filter.mpr ⟨hgRawBoundary, hgCurrentDelta⟩ + obtain ⟨w, hworder, hwIncident⟩ := hboundaryInfo.2.1 g hgCurrentBoundary + have hdeltaMissing := @helper_hdeltaMissing_244 V E inferInstance inferInstance instE G k e0 input + T phi ett hrounds gamma secondStable choice currentColoring hgammaMissing hgammaNe + have horderTn : TreeVertexOrder Tn w (Tn.vertex base.supportPosition) := by + simpa [hTnq, hsupport] using hworder + have hwPrefix : w ∈ TreeSequenceVertexSet supportPrefix := by + obtain ⟨i, j, hi, hj, hij⟩ := horderTn + have hjpos : j = base.supportPosition := Tn.vertex_injective hj + subst j + rw [TreeSequenceVertexSet] + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + let i' : Fin (base.supportPosition.val + 1) := ⟨i.val, by omega⟩ + refine ⟨i', Finset.mem_univ _, ?_⟩ + simpa [supportPrefix, TreeSequencePrefix, i'] using hi + have hwClosure : w ∈ TreeSequenceVertexSet base.closure := + hprefixClosure hwPrefix + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hgRawBoundary + obtain ⟨u, huTn, v, hvTn, huv⟩ := hgRawBoundary + have hwEnds : w = u ∨ w = v := by + change w ∈ G.ends g at hwIncident + rw [huv] at hwIncident + simpa using hwIncident + have hwTn : w ∈ TreeSequenceVertexSet Tn := by + obtain ⟨i, j, hi, hj, hij⟩ := horderTn + rw [TreeSequenceVertexSet] + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨i, Finset.mem_univ _, hi⟩ + have hwVertices : w ∈ vertices := by + simpa [vertices, hTnq] using hwTn + have hwu : w = u := hwEnds.resolve_right + (fun hwv => hvTn (hwv ▸ hwVertices)) + subst u + have hphiG : phi g = some choice.color := by + exact (congrFun hphiCurrent g).trans hgCurrentDelta + have hdeltaSupport : choice.color ∈ MissingColors G phi + (Tn.vertex base.supportPosition) := by + have hmissingEq := congrArg + (fun coloring => MissingColors G coloring (Tn.vertex base.supportPosition)) + hphiCurrent + rw [hmissingEq, ← hsupport] + exact hdeltaMissing + have hvClosure : v ∈ TreeSequenceVertexSet base.closure := by + by_contra hvNot + have hgClosure : g ∈ BoundaryEdges G + (TreeSequenceVertexSet base.closure) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwClosure, v, hvNot, huv⟩ + exact (hclosure.2 hgClosure hsupportClosure hphiG) hdeltaSupport + have hvCore : v ∈ TreeSequenceVertexSet base.core := by + rw [hunion.vertexSet] + exact Finset.mem_union_right _ hvClosure + have hvNotTn : v ∉ TreeSequenceVertexSet Tn := by + simpa [vertices, hTnq] using hvTn + have hsegment := + TashkinovAugmentationSequenceInitialSegment phi Tn base.core hsequence + have hlengthNe := @helper_hlengthNe_341 V E inferInstance inferInstance instV instE G k e0 input T + phi ett base v hvCore hvNotTn hsegment + have hstrict : Tn.length < base.core.length := + lt_of_le_of_ne hsegment.1 hlengthNe + simpa [Tn, n] using And.intro hsequence hstrict + +private theorem helper_branch_144.{u_1, u_2} : + helperBranch144Conditions.{u_1, u_2} := by + classical + intro V E _ _ instV instE G k e0 input T phi ett base n Tn supportPrefix hchosen hclosure + hunion hsequence hrounds q hsucc hTnq hphiCurrent hprefixClosure hsupportClosure ci + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternativeFails gamma gammaRule secondStable secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension target_eq + have hv := congrArg Fin.val target_eq + simp only [Fin.val_succ, Nat.add_right_cancel_iff] at hv + have hci : ci = q := by ext; omega + subst ci + have hsupport : choice.vertex = Tn.vertex base.supportPosition := by + change ett.series.data.chosenVertex n = + some (Tn.vertex base.supportPosition) at hchosen + rw [← hsucc, currentVertex] at hchosen + exact Option.some.inj hchosen + have hboundaryInfo := HkuParallelBoundaryStructure G k ett.rounds e0 input + ett.series q choice.edge choice.color gamma choice.vertex + (by simpa using currentKind) (by simpa using currentEdges) + (by simpa using currentDelta) (by simpa using currentGamma) + (by simpa using currentVertex) + let vertices := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) + have hchoiceBoundary : choice.edge ∈ + BoundaryColorEdges G choice.selected vertices choice.color := by + rcases choice.edgeDefective with ⟨c, hcDefective, hcBoundary⟩ + have hcColor : choice.selected choice.edge = some c := + (Finset.mem_filter.mp hcBoundary).2 + have hc : c = choice.color := + Option.some.inj (hcColor.symm.trans choice.edgeColor) + simpa [vertices, hc] using hcBoundary + have hdefective : DefectiveColor G choice.selected vertices choice.color := by + rcases choice.edgeDefective with ⟨c, hcDefective, hcBoundary⟩ + have hcColor : choice.selected choice.edge = some c := + (Finset.mem_filter.mp hcBoundary).2 + have hc : c = choice.color := + Option.some.inj (hcColor.symm.trans choice.edgeColor) + simpa [vertices, hc] using hcDefective + obtain ⟨g, hgBoundary, hgne⟩ : ∃ g, + g ∈ BoundaryColorEdges G choice.selected vertices choice.color ∧ + g ≠ choice.edge := by + obtain ⟨a, ha, b, hb, hab⟩ := + Finset.one_lt_card.mp (show 1 < + (BoundaryColorEdges G choice.selected vertices choice.color).card by + exact lt_of_lt_of_le Nat.one_lt_two hdefective) + by_cases haChoice : a = choice.edge + · exact ⟨b, hb, by intro hbChoice; exact hab (haChoice.trans hbChoice.symm)⟩ + · exact ⟨a, ha, haChoice⟩ + have boundaryIncident : ∀ {e : E}, e ∈ BoundaryEdges G vertices → + TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) e := by + intro e he + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at he + obtain ⟨u, hu, v, hv, huv⟩ := he + exact ⟨u, hu, by simp [Incident, huv]⟩ + have hgRawBoundary : g ∈ BoundaryEdges G vertices := + (Finset.mem_filter.mp hgBoundary).1 + have hchoiceRawBoundary : choice.edge ∈ BoundaryEdges G vertices := + (Finset.mem_filter.mp hchoiceBoundary).1 + have hgSecond : secondStable g = some choice.color := by + have hstable := secondStableRelation.1 g (boundaryIncident hgRawBoundary) + ⟨choice.color, + Finset.mem_union.mpr (Or.inr (Finset.mem_insert_self _ _)), + (Finset.mem_filter.mp hgBoundary).2⟩ + exact hstable.trans (Finset.mem_filter.mp hgBoundary).2 + have hchoiceSecond : secondStable choice.edge = some choice.color := by + have hstable := secondStableRelation.1 choice.edge + (boundaryIncident hchoiceRawBoundary) + ⟨choice.color, + Finset.mem_union.mpr (Or.inr (Finset.mem_insert_self _ _)), + choice.edgeColor⟩ + exact hstable.trans choice.edgeColor + have hgammaMissing : gamma ∈ MissingColors G secondStable choice.vertex := by + rw [secondStableRelation.2 choice.vertex choice.vertexDefective.1] + exact gammaRule.1 + have hgammaNe : gamma ≠ choice.color := by + intro h + have hpresent : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, h ▸ hchoiceSecond⟩ + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgammaMissing + exact hnot hpresent + have hchoiceComponent : Sum.inr choice.edge ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hchoiceSecond] + have hchoiceCurrent : ett.series.data.coloring q.succ choice.edge = some gamma := by + rw [congrFun currentColoring choice.edge] + simp [TwoColorComponentSwap, hchoiceComponent, hchoiceSecond] + have hgOutside : Sum.inr g ∉ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + intro hgComponent + have hgCurrent : ett.series.data.coloring q.succ g = some gamma := by + rw [congrFun currentColoring g] + simp [TwoColorComponentSwap, hgComponent, hgSecond] + have hgGamma : g ∈ BoundaryColorEdges G + (ett.series.data.coloring q.succ) vertices gamma := + Finset.mem_filter.mpr ⟨hgRawBoundary, hgCurrent⟩ + rw [hboundaryInfo.1] at hgGamma + have hgeq : g = choice.edge := by simpa using hgGamma + exact hgne hgeq + have hgCurrentDelta : ett.series.data.coloring q.succ g = + some choice.color := by + rw [congrFun currentColoring g] + simp [TwoColorComponentSwap, hgOutside, hgSecond] + exact @helper_continuation_309 V E inferInstance inferInstance instV instE G k e0 input T phi + ett base hclosure hunion hsequence hrounds hTnq hphiCurrent hprefixClosure hsupportClosure + gamma secondStable choice currentColoring hsupport hboundaryInfo g hgRawBoundary + hgammaMissing hgammaNe hgCurrentDelta +theorem ParallelCoreAugmentationStrict + {V E : Type*} [Fintype V] [Fintype E] + [instV : DecidableEq V] [instE : DecidableEq E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + TashkinovAugmentationSequence phi Tn base.core ∧ + Tn.length < base.core.length := by + dsimp + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let supportPrefix := TreeSequencePrefix Tn base.supportPosition.val + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt) + obtain ⟨hchosen, hclosure, ⟨hunion⟩⟩ := base.parallel hPE + have hprefixSegment : TreeSequenceInitialSegment supportPrefix Tn := by + refine ⟨Nat.le_of_lt_succ base.supportPosition.isLt, ?_, ?_⟩ + · intro i + simp [supportPrefix, TreeSequencePrefix] + · intro i + simp [supportPrefix, TreeSequencePrefix] + have hsequence : TashkinovAugmentationSequence phi Tn base.core := + OrderedTreeUnionAugmentationSequence phi supportPrefix Tn base.closure base.core + hclosure.1 hprefixSegment hunion + have hrounds : 0 < ett.rounds := lt_of_lt_of_le Nat.zero_lt_one ett.roundsPositive + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hsucc : q.succ = n := by + apply Fin.ext + simp [q, n] + omega + have hTnq : Tn = ett.series.data.tree q.succ.castSucc := by + simpa [Tn] using congrArg + (fun z : Fin (ett.rounds + 1) => ett.series.data.tree z.castSucc) hsucc.symm + have hphiCurrent : phi = ett.series.data.coloring q.succ := by + calc + phi = ett.series.data.coloring n := by simpa [n] using ett.generatingColoring + _ = ett.series.data.coloring q.succ := congrArg ett.series.data.coloring hsucc.symm + have initialVertices {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro z hz + rw [TreeSequenceVertexSet] at hz ⊢ + obtain ⟨i, -, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hz + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨Fin.castLE (Nat.succ_le_succ hAB.1) i, Finset.mem_univ _, hAB.2.1 i⟩ + have hprefixClosure : TreeSequenceVertexSet supportPrefix ⊆ + TreeSequenceVertexSet base.closure := by + exact initialVertices + (TashkinovAugmentationSequenceInitialSegment phi supportPrefix base.closure hclosure.1) + have hsupportPrefix : Tn.vertex base.supportPosition ∈ + TreeSequenceVertexSet supportPrefix := by + rw [TreeSequenceVertexSet] + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + let i : Fin (base.supportPosition.val + 1) := + ⟨base.supportPosition.val, Nat.lt_succ_self _⟩ + refine ⟨i, Finset.mem_univ _, ?_⟩ + simp [supportPrefix, TreeSequencePrefix, i] + have hsupportClosure : Tn.vertex base.supportPosition ∈ + TreeSequenceVertexSet base.closure := hprefixClosure hsupportPrefix + have hPEq : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE := by + rw [hsucc] + simpa [n] using hPE + generalize target_eq : q.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q target_eq).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hv := congrArg Fin.val target_eq + simp at hv + have hci : ci = q := by ext; omega + subst ci + rw [currentKind] at hPEq + simp at hPEq + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hv := congrArg Fin.val target_eq + simp at hv + have hci : ci = q := by ext; omega + subst ci + rw [currentKind] at hPEq + simp at hPEq + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_144 V E inferInstance inferInstance instV instE G k e0 input T phi + ett base hchosen hclosure hunion hsequence hrounds hsucc hTnq hphiCurrent + hprefixClosure hsupportClosure ci previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableRelation exitWitness currentColoring + currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension target_eq +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelExtensionColor.lean b/LeanPool/GoldbergSeymour/ParallelExtensionColor.lean new file mode 100644 index 0000000000..ff699e265f --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelExtensionColor.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TashkinovSeriesData + +/-! +# Parallel Extension Color + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- An available color selected according to the latest prior parallel extension at the support +vertex. +-/ +def ParallelExtensionColor {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} + {k rounds : ℕ} {e0 : E} (data : TashkinovSeriesData G k rounds e0) (i : Fin (rounds + 1)) + (selected : PartialEdgeColoring E k) (v : V) (gamma : Fin k) : Prop := + gamma ∈ MissingColors G selected v ∧ + ((∃ h : Fin (rounds + 1), + 0 < h.val ∧ + h.val ≤ i.val ∧ + data.kind h = some TashkinovExtensionKind.PE ∧ + data.chosenVertex h = some v ∧ + data.delta h = some gamma ∧ + ∀ j : Fin (rounds + 1), + 0 < j.val → + j.val ≤ i.val → + data.kind j = some TashkinovExtensionKind.PE → + data.chosenVertex j = some v → j.val ≤ h.val) ∨ + (∀ h : Fin (rounds + 1), + 0 < h.val → + h.val ≤ i.val → data.kind h = some TashkinovExtensionKind.PE → data.chosenVertex h ≠ some v)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelExtensionColorAppend.lean b/LeanPool/GoldbergSeymour/ParallelExtensionColorAppend.lean new file mode 100644 index 0000000000..ffe774a921 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelExtensionColorAppend.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.TashkinovSeriesDataAppend + +/-! +# Parallel Extension Color Append + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ParallelExtensionColorAppend {V E : Type*} [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + (data : TashkinovSeriesData G k rounds e0) + (newTree : TreeSequence G e0) + (newColoring : PartialEdgeColoring E k) + (newStored : Finset (Fin k)) + (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) + (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)) + (i : Fin (rounds + 1)) (selected : PartialEdgeColoring E k) + (v : V) (gamma : Fin k) : + ParallelExtensionColor + (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma) + i.castSucc selected v gamma ↔ + ParallelExtensionColor data i selected v gamma := by + classical + let _ := Fintype.ofFinite V + let appended := TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma + unfold ParallelExtensionColor + constructor + · rintro ⟨hmissing, history | noHistory⟩ + · rcases history with ⟨h, hpos, hle, hPE, hv, hdelta, hmax⟩ + let oldH : Fin (rounds + 1) := ⟨h.val, lt_of_le_of_lt hle i.isLt⟩ + have hEq : h = oldH.castSucc := by ext; rfl + refine ⟨hmissing, Or.inl ⟨oldH, hpos, hle, ?_, ?_, ?_, ?_⟩⟩ + · simpa [appended, TashkinovSeriesDataAppend, hEq] using hPE + · simpa [appended, TashkinovSeriesDataAppend, hEq] using hv + · simpa [appended, TashkinovSeriesDataAppend, hEq] using hdelta + · intro j hjpos hjle hjPE hjv + exact hmax j.castSucc hjpos hjle + (by simpa [appended, TashkinovSeriesDataAppend] using hjPE) + (by simpa [appended, TashkinovSeriesDataAppend] using hjv) + · refine ⟨hmissing, Or.inr ?_⟩ + intro h hpos hle hPE + have newNe := noHistory h.castSucc hpos hle + (by simpa [appended, TashkinovSeriesDataAppend] using hPE) + simpa [appended, TashkinovSeriesDataAppend] using newNe + · rintro ⟨hmissing, history | noHistory⟩ + · rcases history with ⟨h, hpos, hle, hPE, hv, hdelta, hmax⟩ + refine ⟨hmissing, Or.inl ⟨h.castSucc, hpos, hle, ?_, ?_, ?_, ?_⟩⟩ + · simpa [appended, TashkinovSeriesDataAppend] using hPE + · simpa [appended, TashkinovSeriesDataAppend] using hv + · simpa [appended, TashkinovSeriesDataAppend] using hdelta + · intro j hjpos hjle hjPE hjv + let oldJ : Fin (rounds + 1) := ⟨j.val, lt_of_le_of_lt hjle i.isLt⟩ + have jEq : j = oldJ.castSucc := by ext; rfl + exact hmax oldJ hjpos hjle + (by simpa [appended, TashkinovSeriesDataAppend, jEq] using hjPE) + (by simpa [appended, TashkinovSeriesDataAppend, jEq] using hjv) + · refine ⟨hmissing, Or.inr ?_⟩ + intro h hpos hle hPE + let oldH : Fin (rounds + 1) := ⟨h.val, lt_of_le_of_lt hle i.isLt⟩ + have hEq : h = oldH.castSucc := by ext; rfl + have oldNe := noHistory oldH hpos hle + (by simpa [appended, TashkinovSeriesDataAppend, hEq] using hPE) + simpa [appended, TashkinovSeriesDataAppend, hEq] using oldNe + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelExtensionColorExists.lean b/LeanPool/GoldbergSeymour/ParallelExtensionColorExists.lean new file mode 100644 index 0000000000..c49e1cf00e --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelExtensionColorExists.lean @@ -0,0 +1,395 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Finset.Sort + +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree + +public import LeanPool.GoldbergSeymour.SupportingPEMissingTransport + +/-! +# Parallel Extension Color Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_peFields_108.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (i : Fin (rounds + (1 : ℕ))) (choice : + MaximumDefectiveChoice G e0 (series.data.tree i.succ) (TashkinovStoredColors series.data + i) (series.data.coloring i)) (someSlot : Fin (rounds + (1 : ℕ))), (0 : ℕ) < (↑someSlot : + ℕ) → (0 : ℕ) < (↑i : ℕ) → ∀ (j : Fin rounds), series.data.kind j.succ = some + TashkinovExtensionKind.PE → series.data.chosenVertex j.succ = some choice.vertex → ∃ (d : + Fin k) (g : Fin k), series.data.delta j.succ = some d ∧ series.data.gamma j.succ = some g + ∧ choice.vertex ∈ TreeSequenceVertexSet (series.data.tree j.succ.castSucc) ∧ + TreeSequenceInitialSegment (series.data.tree j.succ.castSucc) (series.data.tree + j.succ.succ) := by + classical + intro V E _ _ _ G k rounds e0 input series i choice someSlot somePositive iPositive j hkind + hvertex + generalize targetEq : j.succ = target + cases series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero j targetEq).elim + | SE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting selected seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have rEq : r = j := by apply Fin.ext; omega + subst r + rw [currentKind] at hkind + simp at hkind + | RE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have rEq : r = j := by apply Fin.ext; omega + subst r + rw [currentKind] at hkind + simp at hkind + | PE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting selected seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have rEq : r = j := by apply Fin.ext; omega + subst r + have vertexEq : selected.vertex = choice.vertex := + Option.some.inj (currentVertex.symm.trans hvertex) + exact ⟨selected.color, gamma, currentDelta, currentGamma, + by simpa [vertexEq] using selected.vertexDefective.1, + orderedExtension⟩ + +private theorem helper_seriesVertexLater_163.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (i : Fin (rounds + (1 : ℕ))) (_ : + MaximumDefectiveChoice G e0 (series.data.tree i.succ) (TashkinovStoredColors series.data + i) (series.data.coloring i)) (someSlot : Fin (rounds + (1 : ℕ))), (0 : ℕ) < (↑someSlot : + ℕ) → (0 : ℕ) < (↑i : ℕ) → (∀ (A B : TreeSequence G e0), TreeSequenceInitialSegment A B → ∀ + x ∈ TreeSequenceVertexSet A, x ∈ TreeSequenceVertexSet B) → ∀ (a b : Fin rounds), (↑a : ℕ) + ≤ (↑b : ℕ) → ∀ x ∈ TreeSequenceVertexSet (series.data.tree a.succ.castSucc), x ∈ + TreeSequenceVertexSet (series.data.tree b.succ.castSucc) := by + classical + intro V E _ _ _ G k rounds e0 input series i choice someSlot somePositive iPositive + vertexTransfer a b hab x hxa + induction distance : b.val - a.val using Nat.strong_induction_on + generalizing a b with + | h n ih => + by_cases equal : a.val = b.val + · have : a = b := Fin.ext equal + simpa [this] using hxa + · have stepLe : a.val + 1 ≤ b.val := by omega + let mid : Fin rounds := ⟨a.val + 1, by omega⟩ + have midVal : mid.val = a.val + 1 := rfl + have nextSegment : TreeSequenceInitialSegment + (series.data.tree a.succ.castSucc) + (series.data.tree a.succ.succ) := by + generalize targetEq : a.succ = target + cases series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => exact (Fin.succ_ne_zero a targetEq).elim + | SE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting selected seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have rEq : r = a := by apply Fin.ext; omega + simpa [rEq] using orderedExtension + | RE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have rEq : r = a := by apply Fin.ext; omega + simpa [rEq] using orderedExtension + | PE r previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting selected seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have values := congrArg Fin.val targetEq + simp at values + have rEq : r = a := by apply Fin.ext; omega + simpa [rEq] using orderedExtension + have hxm : x ∈ TreeSequenceVertexSet + (series.data.tree mid.succ.castSucc) := by + have treeEq : mid.succ.castSucc = a.succ.succ := by + apply Fin.ext + simp [mid] + rw [treeEq] + exact vertexTransfer _ _ nextSegment x hxa + have hrest := ih (b.val - mid.val) (by omega) mid b (by omega) hxm + (by simp) + exact hrest + +private theorem helper_deltaMissingCurrent_250.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (i : Fin (rounds + (1 : ℕ))) (choice : + MaximumDefectiveChoice G e0 (series.data.tree i.succ) (TashkinovStoredColors series.data + i) (series.data.coloring i)) (someSlot : Fin (rounds + (1 : ℕ))), (0 : ℕ) < (↑someSlot : + ℕ) → + ∀ (iPositive : (0 : ℕ) < (↑i : ℕ)), + let q : Fin rounds := i.pred (Fin.ne_of_gt iPositive); q.succ = i → + let supports : Finset (Fin rounds) := {j : Fin rounds | (↑j : ℕ) ≤ (↑q : ℕ) ∧ series.data.kind + j.succ = some TashkinovExtensionKind.PE ∧ series.data.chosenVertex j.succ = some + choice.vertex}; + let p : ℕ := supports.card - (1 : ℕ); + ∀ (supportsCard : supports.card = p + (1 : ℕ)), + let indices : Fin (p + (1 : ℕ)) → Fin rounds := (⇑(supports.orderEmbOfFin supportsCard) : Fin + (p + (1 : ℕ)) → Fin rounds); ( + ∀ (A B : TreeSequence G e0), TreeSequenceInitialSegment A B → + ∀ x ∈ TreeSequenceVertexSet A, x ∈ TreeSequenceVertexSet B) → + ∀ (deltaLast : Fin k), choice.vertex ∈ TreeSequenceVertexSet (series.data.tree (indices + (Fin.last p)).succ.castSucc) → TreeSequenceInitialSegment (series.data.tree (indices + (Fin.last p)).succ.castSucc) (series.data.tree (indices (Fin.last p)).succ.succ) → + deltaLast ∈ MissingColors G (series.data.coloring (indices (Fin.last p)).succ) + choice.vertex → + let lastSlot : Fin (rounds + (1 : ℕ)) := (indices (Fin.last p)).succ; (↑lastSlot : ℕ) ≤ (↑i : + ℕ) → deltaLast ∈ MissingColors G (series.data.coloring i) choice.vertex := by + classical + intro V E _ _ _ _ G k rounds e0 input series i choice someSlot somePositive iPositive q qSucc + supports p supportsCard indices vertexTransfer deltaLast lastVertex lastSegment + deltaMissingAfterLast lastSlot lastSlotLe + by_cases same : lastSlot.val = i.val + · have slotEq : lastSlot = i := Fin.ext same + simpa [lastSlot, slotEq] using deltaMissingAfterLast + · have strict : lastSlot.val < i.val := lt_of_le_of_ne lastSlotLe same + let start : Fin rounds := ⟨lastSlot.val, by omega⟩ + have startTreeVertex : choice.vertex ∈ TreeSequenceVertexSet + (series.data.tree start.succ.castSucc) := by + have treeEq : start.succ.castSucc = + (indices (Fin.last p)).succ.succ := by + apply Fin.ext + simp [start, lastSlot] + rw [treeEq] + exact vertexTransfer _ _ lastSegment choice.vertex lastVertex + have noLater : + forall j : Fin rounds, start.val ≤ j.val → j.val ≤ q.val → ¬ (series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.chosenVertex j.succ = some choice.vertex) := by + intro j hjStart hjq hpe + have jIn : j ∈ supports := by + simp only [supports, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨hjq, hpe⟩ + have jRange : j ∈ Set.range (supports.orderEmbOfFin supportsCard) := by + rw [Finset.range_orderEmbOfFin] + exact jIn + obtain ⟨a, ha⟩ := jRange + have aLe : a ≤ Fin.last p := Fin.le_last a + have embLe := (supports.orderEmbOfFin supportsCard).monotone aLe + rw [ha] at embLe + have jLeLast : j.val ≤ (indices (Fin.last p)).val := by + change j.val ≤ (supports.orderEmbOfFin supportsCard (Fin.last p)).val + change j ≤ supports.orderEmbOfFin supportsCard (Fin.last p) at embLe + exact embLe + simp [start, lastSlot] at hjStart + omega + have unchanged := HkuUnsupportedVertexColors G k rounds e0 input series q + start choice.vertex (by simp [start, q]; omega) startTreeVertex noLater + have startColorEq : start.castSucc = lastSlot := by + apply Fin.ext + rfl + rw [startColorEq, qSucc] at unchanged + exact unchanged ▸ (by simpa [lastSlot] using deltaMissingAfterLast) + +private theorem ParallelExtensionColorExists_branch_51.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (i : Fin (rounds + 1)) (choice : + MaximumDefectiveChoice G e0 (series.data.tree i.succ) (TashkinovStoredColors series.data + i) (series.data.coloring i)), (∃ (h : Fin (rounds + 1)), 0 < (↑h : ℕ) ∧ (↑h : ℕ) ≤ (↑i : + ℕ) ∧ series.data.kind h = some TashkinovExtensionKind.PE ∧ series.data.chosenVertex h = + some choice.vertex) → ∃ (gamma : Fin k), ParallelExtensionColor series.data i + choice.selected choice.vertex gamma := by + classical + intro V E _ _ _ G k rounds e0 input series i choice history + obtain ⟨someSlot, somePositive, someLe, someKind, someVertex⟩ := history + have iPositive : 0 < i.val := lt_of_lt_of_le somePositive someLe + let q : Fin rounds := i.pred (Fin.ne_of_gt iPositive) + have qSucc : q.succ = i := Fin.succ_pred i (Fin.ne_of_gt iPositive) + let supports : Finset (Fin rounds) := Finset.univ.filter fun j => + j.val ≤ q.val ∧ + series.data.kind j.succ = some TashkinovExtensionKind.PE ∧ + series.data.chosenVertex j.succ = some choice.vertex + let someRound : Fin rounds := someSlot.pred (Fin.ne_of_gt somePositive) + have someRoundSucc : someRound.succ = someSlot := + Fin.succ_pred someSlot (Fin.ne_of_gt somePositive) + have someRoundMem : someRound ∈ supports := by + simp only [supports, Finset.mem_filter, Finset.mem_univ, true_and] + constructor + · have values : q.val + 1 = i.val := congrArg Fin.val qSucc + have roundValues : someRound.val + 1 = someSlot.val := + congrArg Fin.val someRoundSucc + omega + · simpa [someRoundSucc] using And.intro someKind someVertex + have supportsNonempty : supports.Nonempty := ⟨someRound, someRoundMem⟩ + let p := supports.card - 1 + have supportsCard : supports.card = p + 1 := by + have cardPositive : 0 < supports.card := Finset.card_pos.mpr supportsNonempty + dsimp [p] + omega + let indices : Fin (p + 1) → Fin rounds := + supports.orderEmbOfFin supportsCard + have indicesIncreasing : forall a b, a.val < b.val → + (indices a).val < (indices b).val := by + intro a b hab + exact (supports.orderEmbOfFin supportsCard).strictMono hab + have indicesEnumerate : + forall j : Fin rounds, (j.val ≤ q.val ∧ series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.chosenVertex j.succ = some choice.vertex) ↔ exists + a : Fin (p + 1), indices a = j := by + intro j + constructor + · intro hj + have hjmem : j ∈ supports := by + simpa only [supports, Finset.mem_filter, Finset.mem_univ, true_and] + using hj + have hjrange : j ∈ Set.range (supports.orderEmbOfFin supportsCard) := by + rw [Finset.range_orderEmbOfFin] + exact hjmem + simpa only [Set.mem_range, indices] using hjrange + · rintro ⟨a, rfl⟩ + have hmem := Finset.orderEmbOfFin_mem supports supportsCard a + simpa only [supports, Finset.mem_filter, Finset.mem_univ, true_and, + indices] using hmem + have vertexTransfer : forall (A B : TreeSequence G e0), + TreeSequenceInitialSegment A B → forall x, + x ∈ TreeSequenceVertexSet A → x ∈ TreeSequenceVertexSet B := by + intro A B hAB x hx + rcases hAB with ⟨hlen, hvertices, _⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image] at hx ⊢ + obtain ⟨a, _, rfl⟩ := hx + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) a, Finset.mem_univ _, + hvertices a⟩ + have peFields := @helper_peFields_108 V E inferInstance inferInstance inferInstance G k rounds e0 + input series i choice someSlot somePositive iPositive + have seriesVertexLater := @helper_seriesVertexLater_163 V E inferInstance inferInstance + inferInstance G k rounds e0 input series i choice someSlot somePositive iPositive + vertexTransfer + obtain ⟨deltaLast, gammaLast, deltaLastEq, gammaLastEq, + lastVertex, lastSegment⟩ := peFields (indices (Fin.last p)) + ((indicesEnumerate (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.1 + ((indicesEnumerate (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.2 + obtain ⟨deltaFirst, gammaFirst, deltaFirstEq, gammaFirstEq, + firstVertex, firstSegment⟩ := peFields (indices 0) + ((indicesEnumerate (indices 0)).2 ⟨0, rfl⟩).2.1 + ((indicesEnumerate (indices 0)).2 ⟨0, rfl⟩).2.2 + have lastLeQ : (indices (Fin.last p)).val ≤ q.val := + ((indicesEnumerate (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).1 + have currentTreeVertex : choice.vertex ∈ TreeSequenceVertexSet + (series.data.tree q.succ.castSucc) := + seriesVertexLater (indices (Fin.last p)) q lastLeQ choice.vertex lastVertex + have transport := SupportingPEMissingTransport G k rounds p e0 input series q + choice.vertex currentTreeVertex indices indicesIncreasing indicesEnumerate + gammaFirst deltaLast gammaFirstEq deltaLastEq + have deltaMissingAfterLast : deltaLast ∈ MissingColors G + (series.data.coloring (indices (Fin.last p)).succ) choice.vertex := by + rw [transport.2] + simp + let lastSlot : Fin (rounds + 1) := (indices (Fin.last p)).succ + have lastSlotLe : lastSlot.val ≤ i.val := by + have values := congrArg Fin.val qSucc + simp at values + simp [lastSlot] + omega + have deltaMissingCurrent := @helper_deltaMissingCurrent_250 V E inferInstance inferInstance + inferInstance inferInstance G k rounds e0 input series i choice someSlot somePositive + iPositive qSucc supportsCard vertexTransfer deltaLast lastVertex lastSegment + deltaMissingAfterLast lastSlotLe + have deltaMissingSelected : deltaLast ∈ + MissingColors G choice.selected choice.vertex := by + rw [choice.selectedStable.2 choice.vertex choice.vertexDefective.1] + exact deltaMissingCurrent + refine ⟨deltaLast, deltaMissingSelected, Or.inl ?_⟩ + refine ⟨lastSlot, by simp [lastSlot], lastSlotLe, ?_, ?_, ?_, ?_⟩ + · simpa [lastSlot] using + ((indicesEnumerate (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.1 + · simpa [lastSlot] using + ((indicesEnumerate (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.2 + · simpa [lastSlot] using deltaLastEq + · intro j hjPositive hjLe hjKind hjVertex + let r : Fin rounds := j.pred (Fin.ne_of_gt hjPositive) + have rSucc : r.succ = j := Fin.succ_pred j (Fin.ne_of_gt hjPositive) + have rLeQ : r.val ≤ q.val := by + have qValues := congrArg Fin.val qSucc + have rValues := congrArg Fin.val rSucc + simp at qValues rValues + omega + have rIn : r ∈ supports := by + simp only [supports, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨rLeQ, by simpa [rSucc] using And.intro hjKind hjVertex⟩ + have rRange : r ∈ Set.range (supports.orderEmbOfFin supportsCard) := by + rw [Finset.range_orderEmbOfFin] + exact rIn + obtain ⟨a, ha⟩ := rRange + have embLe := (supports.orderEmbOfFin supportsCard).monotone + (Fin.le_last a) + rw [ha] at embLe + have rLeLast : r.val ≤ (indices (Fin.last p)).val := by + change r.val ≤ (supports.orderEmbOfFin supportsCard (Fin.last p)).val + change r ≤ supports.orderEmbOfFin supportsCard (Fin.last p) at embLe + exact embLe + have rValues := congrArg Fin.val rSucc + simp [lastSlot] at rValues ⊢ + omega + +theorem ParallelExtensionColorExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : Nat) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) + (i : Fin (rounds + 1)) + (choice : MaximumDefectiveChoice G e0 (series.data.tree i.succ) + (TashkinovStoredColors series.data i) (series.data.coloring i)) + (hdegree : MaximumDegree G + 1 ≤ k) : + exists gamma : Fin k, + ParallelExtensionColor series.data i choice.selected choice.vertex gamma := by + classical + by_cases history : exists h : Fin (rounds + 1), + 0 < h.val ∧ h.val ≤ i.val ∧ + series.data.kind h = some TashkinovExtensionKind.PE ∧ + series.data.chosenVertex h = some choice.vertex + · exact @ParallelExtensionColorExists_branch_51 V E inferInstance inferInstance + inferInstance G k rounds e0 input series i choice history + · obtain ⟨gamma, hgamma⟩ := + MissingColorsNonemptyOfMaximumDegree G choice.selected hdegree choice.vertex + refine ⟨gamma, hgamma, Or.inr ?_⟩ + intro h hpositive hle hkind heq + exact history ⟨h, hpositive, hle, hkind, heq⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean b/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean new file mode 100644 index 0000000000..b954122540 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean @@ -0,0 +1,1797 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Parallel Extension Undo Stable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hdegree_145.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)) (w : V), + chosenGamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G secondStable + w → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable + chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) (@Sum.inl V E w) + (@Subtype.fintype (Sum V E) (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V + E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V + E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit + 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) + (@Sum.inl V E w))) (fun (a : Sum V E) ↦ @SimpleGraph.neighborSet.memDecidable (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V + E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V + E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit + 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) + (@Sum.inl V E w) (fun (a b : Sum V E) ↦ Classical.propDecidable (@SimpleGraph.Adj (Sum V + E) (@TwoColorIncidenceGraph V E G k secondStable chosenGamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) + (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat + (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V + E inst_1 G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input + series) (@Fin.castSucc rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) choice)) a b)) a) (@instFintypeSum V E inst inst_1)) ≤ (1 : ℕ) := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable secondStableProper choice + w hw + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro y hy z hz + simp only [SimpleGraph.mem_neighborFinset] at hy hz + cases y with + | inl y => simp [TwoColorIncidenceGraph] at hy + | inr e => + cases z with + | inl z => simp [TwoColorIncidenceGraph] at hz + | inr f => + simp only [TwoColorIncidenceGraph] at hy hz + rcases hw with hw | hw + · have he : secondStable e = some choice.color := + hy.2.resolve_left (by + intro he + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hy.1, he⟩) + have hf : secondStable f = some choice.color := + hz.2.resolve_left (by + intro hf + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hz.1, hf⟩) + by_cases h : e = f + · exact congrArg Sum.inr h + · exact (secondStableProper h ⟨w, hy.1, hz.1⟩ he hf).elim + · have he : secondStable e = some chosenGamma := + hy.2.resolve_right (by + intro he + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hy.1, he⟩) + have hf : secondStable f = some chosenGamma := + hz.2.resolve_right (by + intro hf + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hz.1, hf⟩) + by_cases h : e = f + · exact congrArg Sum.inr h + · exact (secondStableProper h ⟨w, hy.1, hz.1⟩ he hf).elim + +private theorem helper_hclosed_201.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)), chosenGamma ∈ MissingColors G secondStable + choice.vertex → ( + ∀ (w : V), chosenGamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G + secondStable w → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k + secondStable chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) (@Sum.inl V E w) + (@Subtype.fintype (Sum V E) (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V + E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V + E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit + 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) + (@Sum.inl V E w))) (fun (a : Sum V E) ↦ @SimpleGraph.neighborSet.memDecidable (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V + E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V + E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit + 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) + (@Sum.inl V E w) (fun (a b : Sum V E) ↦ Classical.propDecidable (@SimpleGraph.Adj (Sum V + E) (@TwoColorIncidenceGraph V E G k secondStable chosenGamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) + (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat + (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V + E inst_1 G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input + series) (@Fin.castSucc rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) choice)) a b)) a) (@instFintypeSum V E inst inst_1)) ≤ (1 : ℕ)) → + ∀ (u : V) (path : (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Walk + (Sum.inl u) (Sum.inl choice.vertex)), path.IsPath → (2 : ℕ) ≤ path.length → ( + ∀ (x : V ⊕ E), @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable + chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x (@Fintype.ofFinite + (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k + secondStable chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x)) (@Subtype.finite + (Sum V E) (@Finite.instSum V E (@Finite.of_fintype V inst) (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable + chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x)))) ≤ (2 : ℕ)) → + @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable chosenGamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) + (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat + (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V + E inst_1 G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input + series) (@Fin.castSucc rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) choice)) (@Sum.inl V E u) (@Subtype.fintype (Sum V E) (@Membership.mem (Sum V + E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V + E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V + E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit + 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) + (@Sum.inl V E u))) (fun (a : Sum V E) ↦ @SimpleGraph.neighborSet.memDecidable (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V + E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V + E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit + 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) + (@Sum.inl V E u) (fun (a b : Sum V E) ↦ Classical.propDecidable (@SimpleGraph.Adj (Sum V + E) (@TwoColorIncidenceGraph V E G k secondStable chosenGamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) + (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat + (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V + E inst_1 G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input + series) (@Fin.castSucc rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) choice)) a b)) a) (@instFintypeSum V E inst inst_1)) ≤ (1 : ℕ) → + ∀ x ∈ path.support, + ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj x y → y ∈ + path.support := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable choice hmissing hdegree u + path pathIs pathLen hdegreeBound huDegree x hx y hxy + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hx + by_cases hn0 : n = 0 + · subst n + have hx0 : x = Sum.inl u := by simpa using hn.symm + let graph := TwoColorIncidenceGraph G secondStable chosenGamma choice.color + let : Fintype (graph.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (graph.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert huDegree using 1 + cases hx0 + exact congrArg (fun z => @SimpleGraph.degree _ graph (Sum.inl u) z) + (Subsingleton.elim _ _) + have hy' : y ∈ graph.neighborSet x := by simpa [graph, SimpleGraph.mem_neighborSet] using + hxy + have hn' : path.getVert 1 ∈ graph.neighborSet x := by + simpa [graph, hx0, SimpleGraph.mem_neighborSet] using + path.adj_getVert_succ (show 0 < path.length by omega) + have heq := Fintype.card_le_one_iff.mp card ⟨y, hy'⟩ ⟨path.getVert 1, hn'⟩ + have hey : y = path.getVert 1 := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support 1 + by_cases hlast : n = path.length + · have hx1 : x = Sum.inl choice.vertex := by + rw [← hn, pathIs.getVert_eq_end_iff hnle] + exact hlast + let graph := TwoColorIncidenceGraph G secondStable chosenGamma choice.color + let : Fintype (graph.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (graph.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert hdegree choice.vertex (Or.inl hmissing) using 1 + cases hx1 + exact congrArg (fun z => @SimpleGraph.degree _ graph (Sum.inl choice.vertex) z) + (Subsingleton.elim _ _) + have hy' : y ∈ graph.neighborSet x := by simpa [graph, SimpleGraph.mem_neighborSet] using + hxy + have hp : path.getVert (path.length - 1) ∈ graph.neighborSet x := by + have ha : graph.Adj (Sum.inl choice.vertex) (path.getVert (path.length - 1)) := by + simpa [graph, show path.length - 1 + 1 = path.length by omega] using + (path.adj_getVert_succ (show path.length - 1 < path.length by omega)).symm + simpa [hx1, SimpleGraph.mem_neighborSet] using ha + have heq := Fintype.card_le_one_iff.mp card ⟨y, hy'⟩ ⟨path.getVert (path.length - 1), hp⟩ + have hey : y = path.getVert (path.length - 1) := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support _ + have hl : (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj + (path.getVert n) (path.getVert (n - 1)) := by + rw [← show n - 1 + 1 = n by omega] + exact (path.adj_getVert_succ (by omega)).symm + have hnlt : n < path.length := lt_of_le_of_ne hnle hlast + have hr := path.adj_getVert_succ hnlt + by_contra hyout + rw [← hn] at hxy + have hnl : path.getVert (n - 1) ≠ y := by + intro h; apply hyout; rw [← h]; exact path.getVert_mem_support _ + have hnr : path.getVert (n + 1) ≠ y := by + intro h; apply hyout; rw [← h]; exact path.getVert_mem_support _ + have hnp : path.getVert (n - 1) ≠ path.getVert (n + 1) := by + intro h + have hi := pathIs.getVert_injOn (show n - 1 ≤ path.length by omega) + (show n + 1 ≤ path.length by omega) h + omega + let graph := TwoColorIncidenceGraph G secondStable chosenGamma choice.color + let : Fintype (graph.neighborSet (path.getVert n)) := Fintype.ofFinite _ + have three : 3 ≤ graph.degree (path.getVert n) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset _ := {y, path.getVert (n - 1), path.getVert (n + 1)} + have hs : s ⊆ graph.neighborFinset (path.getVert n) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [graph, SimpleGraph.mem_neighborFinset] using hxy + · simpa [graph, SimpleGraph.mem_neighborFinset] using hl + · simpa [graph, SimpleGraph.mem_neighborFinset] using hr + have hc : 3 ≤ s.card := by simp [s, hnp, hnl.symm, hnr.symm] + exact hc.trans (Finset.card_le_card hs) + have upper : graph.degree (path.getVert n) ≤ 2 := hdegreeBound (path.getVert n) + omega + +private theorem helper_hsigmaEdge_358.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → StableColoring (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.succ) (series.data.coloring q.succ) sigma → + ∀ (chosenGamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)), + series.data.coloring q.succ = TwoColorComponentSwap G secondStable chosenGamma + choice.color (Sum.inl choice.vertex) → series.data.stored q.succ = (insert choice.color + ({ chosenGamma } : Finset (Fin k)) : Finset (Fin k)) → series.data.gamma q.succ = some + chosenGamma → choice.vertex ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc) → ( + ∀ w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), Sum.inl w ∈ TwoColorComponent + G sigma chosenGamma choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex) → + chosenGamma ∈ MissingColors G secondStable choice.vertex → + ∀ (_ : V), ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) → + secondStable choice.edge = some choice.color → chosenGamma ≠ choice.color → Sum.inr + choice.edge ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → + ∀ (e : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) → e = + choice.edge := by + classical + intro V E _ _ _ G k rounds e0 input series q sigma hsigmaProper hsigmaStable chosenGamma + secondStable secondStableProper choice currentColoring currentStored hgamma hv hcomponent + hmissing u hcompEdge hchoiceSecond hneq hfcomponent e heT heC + rcases heT with ⟨w, hw, hwe⟩ + have hgamma : sigma choice.edge = some chosenGamma := by + have hsc := hsigmaStable.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + have hctrl : ∃ c ∈ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors series.data q.succ, + series.data.coloring q.succ choice.edge = some c := by + refine ⟨chosenGamma, ?_, ?_⟩ + · by_cases hm : chosenGamma ∈ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) + · exact Finset.mem_union.mpr (Or.inl hm) + · apply Finset.mem_union.mpr + right + unfold TashkinovStoredColors + split + · simp_all + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · refine ⟨q.succ, ?_, ?_⟩ + · simp + · simp [currentStored] + · simpa using hm + · rw [currentColoring] + simp [TwoColorComponentSwap, hfcomponent, hchoiceSecond] + exact (hsc hctrl).trans (by + rw [currentColoring] + simp [TwoColorComponentSwap, hfcomponent, hchoiceSecond]) + have hecol : sigma e = some chosenGamma ∨ sigma e = some choice.color := by + have hs : Sum.inr e ∈ + (TwoColorIncidenceGraph G sigma chosenGamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G sigma chosenGamma choice.color) + (u := Sum.inr e) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp heC + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G sigma chosenGamma choice.color).mem_support.mp hs + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + have hwC : Sum.inl w ∈ TwoColorComponent G sigma chosenGamma choice.color + (Sum.inl choice.vertex) := by + have hadj : (TwoColorIncidenceGraph G sigma chosenGamma choice.color).Adj + (Sum.inl w) (Sum.inr e) := by + simp [TwoColorIncidenceGraph, hwe, hecol] + change (TwoColorIncidenceGraph G sigma chosenGamma choice.color).connectedComponentMk + (Sum.inl w) = _ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans heC + have hwv := (hcomponent w hw).mp hwC + subst w + rcases hecol with hec | hec + · have hp : chosenGamma ∈ PresentColors G sigma choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, hec⟩ + by_contra hne + exact (hsigmaProper hne ⟨choice.vertex, hwe, choice.edgeIncident⟩ hec hgamma).elim + · by_contra hne + have hcolor : sigma e = some choice.color := hec + have hmissColor : choice.color ∈ MissingColors G sigma choice.vertex := by + rw [hsigmaStable.2 choice.vertex hv] + rw [MissingColors] + simp only [Finset.mem_sdiff] + refine ⟨?_, ?_⟩ + · exact Finset.mem_univ _ + · intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp + rcases hp with ⟨a, hae, hac⟩ + by_cases ha : Sum.inr a ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) + · rcases hcompEdge a ha with hag | hacs + · have hn : chosenGamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + exact hn (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨a, hae, hag⟩) + · rw [currentColoring] at hac + simp [TwoColorComponentSwap, ha, hacs, hneq, hneq.symm] at hac + · rw [currentColoring] at hac + have hac' : secondStable a = some choice.color := by + simpa [TwoColorComponentSwap, ha] using hac + have hne : a ≠ choice.edge := by + intro heq + apply ha + exact heq ▸ hfcomponent + exact (secondStableProper hne ⟨choice.vertex, hae, choice.edgeIncident⟩ + hac' hchoiceSecond).elim + have hnot : choice.color ∉ PresentColors G sigma choice.vertex := by + change choice.color ∈ Finset.univ \ PresentColors G sigma choice.vertex at hmissColor + exact (Finset.mem_sdiff.mp hmissColor).2 + exact (hnot (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, hcolor⟩)).elim + +private theorem helper_stableSecond_588.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : + PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data + q.succ) (series.data.coloring q.succ) sigma → + ∀ (chosenGamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → IsOneEdgeUncolored secondStable e0 → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)), + StableColoring (series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) choice.selected + secondStable → series.data.coloring q.succ = TwoColorComponentSwap G secondStable + chosenGamma choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G + (series.data.coloring q.succ) → IsOneEdgeUncolored (series.data.coloring q.succ) e0 → ( + ∀ (w : V), chosenGamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G + secondStable w → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k + secondStable chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) (@Sum.inl V E w) + (@Subtype.fintype (Sum V E) (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V + E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V + E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit + 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) + (@Sum.inl V E w))) (fun (a : Sum V E) ↦ @SimpleGraph.neighborSet.memDecidable (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V + E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V + E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit + 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) + (@Sum.inl V E w) (fun (a b : Sum V E) ↦ Classical.propDecidable (@SimpleGraph.Adj (Sum V + E) (@TwoColorIncidenceGraph V E G k secondStable chosenGamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) + (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat + (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V + E inst_1 G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input + series) (@Fin.castSucc rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) choice)) a b)) a) (@instFintypeSum V E inst inst_1)) ≤ (1 : ℕ)) → + ∀ (u : V) (path : (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Walk + (Sum.inl u) (Sum.inl choice.vertex)), ( + ∀ (x : V ⊕ E), @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable + chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x (@Fintype.ofFinite + (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k + secondStable chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x)) (@Subtype.finite + (Sum V E) (@Finite.instSum V E (@Finite.of_fintype V inst) (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable + chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x)))) ≤ (2 : ℕ)) → ( + ∀ x ∈ path.support, + ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj x y → y ∈ + path.support) → ( + ∀ y ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex), y ∈ + path.support) → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) → + secondStable choice.edge = some choice.color → ( + ∀ (e : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex) → e = + choice.edge) → ( + ∀ (e : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) → e = + choice.edge) → + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex); IsProperEdgeColoring G undone → IsOneEdgeUncolored undone e0 → + TreeMissingColors secondStable (series.data.tree q.succ.castSucc) = TreeMissingColors + choice.selected (series.data.tree q.succ.castSucc) → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G sigma chosenGamma choice.color (Sum.inl + choice.vertex) → sigma e = some chosenGamma ∨ sigma e = some choice.color) → choice.color + ∈ MissingColors G sigma choice.vertex → ( + ∀ c ∈ TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)), c ∈ + TreeMissingColors (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.succ) → chosenGamma ∈ TreeMissingColors + choice.selected (series.data.tree q.succ.castSucc) ∪ (insert choice.color + (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) → StableColoring + (series.data.tree q.succ.castSucc) (insert choice.color (TashkinovStoredColors series.data + q.castSucc) : Finset (Fin k)) secondStable undone := by + classical + intro V E _ _ _ G k rounds e0 input series q sigma hsigmaProper hsigmaOneUncolored hsigmaStable + chosenGamma secondStable secondStableProper secondStableOneUncolored choice + secondStableRelation currentColoring currentProper currentOneUncolored hdegree u path + hdegreeBound hclosed hpathComponent hcompEdge hchoiceSecond htreeEdge hsigmaEdge undone + undoneProper undoneOne treeSecondSelected sigmaComponentColor sigmaColorMissing + currentControl gammaControl + apply (sc1 G e0 (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc)) + secondStable undone secondStableProper secondStableOneUncolored + undoneProper undoneOne).2 + intro f hf h + rcases h with h | h + · rcases h with ⟨c, hc, hcf⟩ + rw [treeSecondSelected] at hc + have h' := ((sc1 G e0 (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc)) + choice.selected secondStable choice.selectedProper choice.selectedOneUncolored + secondStableProper secondStableOneUncolored).mp secondStableRelation) f hf + (Or.inr ⟨c, hc, hcf⟩) + have hs := hsigmaStable.1 f hf + by_cases hsf : Sum.inr f ∈ + TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) + · have ef := hsigmaEdge f hf hsf + subst f + rcases sigmaComponentColor choice.edge hsf with hec | hec + · simp [undone, TwoColorComponentSwap, hsf, hec, hchoiceSecond] + · exfalso + have hnot : choice.color ∉ PresentColors G sigma choice.vertex := by + simpa [MissingColors] using sigmaColorMissing + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, hec⟩ + · have hu : undone f = sigma f := by + change (if Sum.inr f ∈ + TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) then + (if sigma f = some chosenGamma then some choice.color + else if sigma f = some choice.color then some chosenGamma else sigma f) + else sigma f) = sigma f + exact ite_eq_right hsf + rw [hu] + clear hdegree hdegreeBound hclosed hpathComponent hcompEdge + hsigmaEdge sigmaComponentColor + by_cases ha : Sum.inr f ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) + · have he := htreeEdge f hf ha + subst f + have hcGamma := currentControl chosenGamma gammaControl + have hsGamma := hsigmaStable.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨chosenGamma, hcGamma, by + rw [currentColoring] + simp [TwoColorComponentSwap, ha, hchoiceSecond]⟩ + have hcurGamma : series.data.coloring q.succ choice.edge = + some chosenGamma := by + rw [currentColoring] + simp [TwoColorComponentSwap, ha, hchoiceSecond] + have hsigGamma : sigma choice.edge = some chosenGamma := + hsGamma.trans hcurGamma + have hmem : Sum.inr choice.edge ∈ + TwoColorComponent G sigma chosenGamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hsigGamma] + exact (hsf hmem).elim + · have hcur : series.data.coloring q.succ f = some c := by + rw [currentColoring] + simp [TwoColorComponentSwap, ha, hcf] + have hsig := hsigmaStable.1 f hf + ⟨c, currentControl c hc, hcur⟩ + exact hsig.trans (hcur.trans hcf.symm) + · rcases h with ⟨c, hc, hcf⟩ + by_cases hsf : Sum.inr f ∈ + TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) + · have ef := hsigmaEdge f hf hsf + subst f + rcases sigmaComponentColor choice.edge hsf with hec | hec + · simp [undone, TwoColorComponentSwap, hsf, hec, hchoiceSecond] + · exfalso + have hnot : choice.color ∉ PresentColors G sigma choice.vertex := by + simpa [MissingColors] using sigmaColorMissing + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, hec⟩ + · have hu : undone f = sigma f := by + change (if Sum.inr f ∈ + TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) then + (if sigma f = some chosenGamma then some choice.color + else if sigma f = some choice.color then some chosenGamma else sigma f) + else sigma f) = sigma f + exact ite_eq_right hsf + rw [hu] + clear hdegree hdegreeBound hclosed hpathComponent hcompEdge + hsigmaEdge sigmaComponentColor + rw [treeSecondSelected] at hc + by_cases ha : Sum.inr f ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) + · have he := htreeEdge f hf ha + subst f + have hcGamma := currentControl chosenGamma gammaControl + have hsGamma := hsigmaStable.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨chosenGamma, hcGamma, by + rw [currentColoring] + simp [TwoColorComponentSwap, ha, hchoiceSecond]⟩ + have hcurGamma : series.data.coloring q.succ choice.edge = + some chosenGamma := by + rw [currentColoring] + simp [TwoColorComponentSwap, ha, hchoiceSecond] + have hsigGamma : sigma choice.edge = some chosenGamma := + hsGamma.trans hcurGamma + have hmem : Sum.inr choice.edge ∈ + TwoColorComponent G sigma chosenGamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hsigGamma] + exact (hsf hmem).elim + · have hsigmaValue : sigma f = some c := hu.symm.trans hcf + have hsig := ((sc1 G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.succ) + (series.data.coloring q.succ) sigma currentProper currentOneUncolored + hsigmaProper hsigmaOneUncolored).mp hsigmaStable) f hf + (Or.inr ⟨c, currentControl c hc, hsigmaValue⟩) + have hcur : series.data.coloring q.succ f = some c := + (Eq.symm hsig).trans hsigmaValue + have hsecond : secondStable f = some c := by + have hcs : series.data.coloring q.succ f = secondStable f := by + rw [currentColoring] + simp [TwoColorComponentSwap, ha] + exact hcs.symm.trans hcur + exact hsig.trans (hcur.trans hsecond.symm) + +private theorem helper_stableSelected_718.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : PartialEdgeColoring E k) + (chosenGamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → IsOneEdgeUncolored secondStable e0 → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)), + StableColoring (series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) choice.selected + secondStable → + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex); IsProperEdgeColoring G undone → IsOneEdgeUncolored undone e0 → + TreeMissingColors secondStable (series.data.tree q.succ.castSucc) = TreeMissingColors + choice.selected (series.data.tree q.succ.castSucc) → StableColoring (series.data.tree + q.succ.castSucc) (insert choice.color (TashkinovStoredColors series.data q.castSucc) : + Finset (Fin k)) secondStable undone → StableColoring (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) + choice.selected undone := by + classical + intro V E _ _ _ G k rounds e0 input series q sigma chosenGamma secondStable secondStableProper + secondStableOneUncolored choice secondStableRelation undone undoneProper undoneOne + treeSecondSelected stableSecond + apply (sc1 G e0 (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc)) + choice.selected undone choice.selectedProper choice.selectedOneUncolored + undoneProper undoneOne).2 + have stableSecondCriterion := + ((sc1 G e0 (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc)) + secondStable undone secondStableProper secondStableOneUncolored + undoneProper undoneOne).mp stableSecond) + intro f hf h + rcases h with h | h + · rcases h with ⟨c, hc, hcf⟩ + have hrel := secondStableRelation.1 f hf + ⟨c, hc, hcf⟩ + have hc2 := hc + rw [← treeSecondSelected] at hc2 + have hstable := stableSecondCriterion f hf + (Or.inl ⟨c, hc2, hrel.trans hcf⟩) + exact hstable.trans hrel + · rcases h with ⟨c, hc, hcf⟩ + have hc2 := hc + rw [← treeSecondSelected] at hc2 + have hstable := stableSecondCriterion f hf + (Or.inr ⟨c, hc2, hcf⟩) + have hsecond : secondStable f = some c := hstable.symm.trans hcf + have relationCriterion := + ((sc1 G e0 (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc)) + choice.selected secondStable choice.selectedProper choice.selectedOneUncolored + secondStableProper secondStableOneUncolored).mp secondStableRelation) + have hrel := relationCriterion f hf (Or.inr ⟨c, hc, hsecond⟩) + exact hstable.trans hrel + +private theorem helper_branch_1099.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (v : V) (gamma delta : Fin k), + series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∀ (sigma : PartialEdgeColoring E k) (ci : Fin rounds), IsProperEdgeColoring G + (series.data.coloring ci.castSucc) → IsOneEdgeUncolored (series.data.coloring ci.castSucc) + e0 → ColoredVertexSetClosed G (series.data.coloring ci.castSucc) (TreeSequenceVertexSet + (series.data.tree ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + (series.data.coloring ci.castSucc) (TreeSequenceVertexSet (series.data.tree + ci.succ.castSucc)) → ¬Nonempty (RevisitingExtensionCertificate series.data ci.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree ci.succ.castSucc) + (TashkinovStoredColors series.data ci.castSucc) (series.data.coloring ci.castSucc)), ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data ci.castSucc) : Finset (Fin k)) choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) (TreeMissingColors pi (series.data.tree + ci.succ.castSucc))) → series.data.coloring ci.succ = choice.selected → series.data.stored + ci.succ = ({ choice.color } : Finset (Fin k)) → series.data.connectingEdges ci.succ = + ({ choice.edge } : Finset E) → series.data.kind ci.succ = some TashkinovExtensionKind.SE → + series.data.chosenVertex ci.succ = some choice.vertex → series.data.outsideVertex ci.succ + = some choice.otherEndpoint → series.data.delta ci.succ = some choice.color → + series.data.gamma ci.succ = none → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (series.data.tree ci.succ.castSucc) + choice.edge adjoined → TashkinovClosure (series.data.coloring ci.succ) adjoined + (series.data.tree ci.succ.succ) → TreeSequenceInitialSegment (series.data.tree + ci.succ.castSucc) (series.data.tree ci.succ.succ) → (series.data.tree + ci.succ.castSucc).length < (series.data.tree ci.succ.succ).length → q.succ = ci.succ → + ∃ (selected : PartialEdgeColoring E k) (secondStable : PartialEdgeColoring E k), + IsProperEdgeColoring G selected ∧ IsOneEdgeUncolored selected e0 ∧ StableColoring + (series.data.tree ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc) selected ∧ IsProperEdgeColoring G secondStable ∧ + IsOneEdgeUncolored secondStable e0 ∧ StableColoring (series.data.tree ci.succ.castSucc) + (insert delta (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) selected + secondStable ∧ series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma + delta (Sum.inl v) ∧ + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma delta (Sum.inl v); + StableColoring (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors + series.data q.castSucc) : Finset (Fin k)) secondStable undone ∧ StableColoring + (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors series.data + q.castSucc) : Finset (Fin k)) selected undone ∧ StableColoring (series.data.tree + ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) (series.data.coloring + q.castSucc) undone := by + classical + intro V E _ _ _ G k rounds e0 input series q v gamma delta hkind sigma ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternative currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension target_eq + have value := congrArg Fin.val target_eq + simp at value + have ci_eq : ci = q := by apply Fin.ext; omega + subst ci + rw [currentKind] at hkind + simp at hkind + +private theorem helper_branch_1110.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (v : V) (gamma delta : Fin k), + series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∀ (sigma : PartialEdgeColoring E k) (ci : Fin rounds), IsProperEdgeColoring G + (series.data.coloring ci.castSucc) → IsOneEdgeUncolored (series.data.coloring ci.castSucc) + e0 → ColoredVertexSetClosed G (series.data.coloring ci.castSucc) (TreeSequenceVertexSet + (series.data.tree ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + (series.data.coloring ci.castSucc) (TreeSequenceVertexSet (series.data.tree + ci.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate series.data ci.castSucc), series.data.coloring + ci.succ = series.data.coloring ci.castSucc → series.data.stored ci.succ = (insert + available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k)) → + series.data.connectingEdges ci.succ = ({ available.edge } : Finset E) → series.data.kind + ci.succ = some TashkinovExtensionKind.RE → series.data.chosenVertex ci.succ = some + available.insideEndpoint → series.data.outsideVertex ci.succ = some + available.outsideEndpoint → series.data.delta ci.succ = some available.delta → + series.data.gamma ci.succ = some available.gamma → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (series.data.tree ci.succ.castSucc) + available.edge adjoined → TashkinovClosure (series.data.coloring ci.succ) adjoined + (series.data.tree ci.succ.succ) → TreeSequenceInitialSegment (series.data.tree + ci.succ.castSucc) (series.data.tree ci.succ.succ) → (series.data.tree + ci.succ.castSucc).length < (series.data.tree ci.succ.succ).length → q.succ = ci.succ → + ∃ (selected : PartialEdgeColoring E k) (secondStable : PartialEdgeColoring E k), + IsProperEdgeColoring G selected ∧ IsOneEdgeUncolored selected e0 ∧ StableColoring + (series.data.tree ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc) selected ∧ IsProperEdgeColoring G secondStable ∧ + IsOneEdgeUncolored secondStable e0 ∧ StableColoring (series.data.tree ci.succ.castSucc) + (insert delta (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) selected + secondStable ∧ series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma + delta (Sum.inl v) ∧ + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma delta (Sum.inl v); + StableColoring (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors + series.data q.castSucc) : Finset (Fin k)) secondStable undone ∧ StableColoring + (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors series.data + q.castSucc) : Finset (Fin k)) selected undone ∧ StableColoring (series.data.tree + ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) (series.data.coloring + q.castSucc) undone := by + classical + intro V E _ _ _ G k rounds e0 input series q v gamma delta hkind sigma ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed available currentColoring + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension strictExtension + target_eq + have value := congrArg Fin.val target_eq + simp at value + have ci_eq : ci = q := by apply Fin.ext; omega + subst ci + rw [currentKind] at hkind + simp at hkind + +private theorem helper_hpathComponent_1164.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)) (u : V) (path : (TwoColorIncidenceGraph G secondStable + chosenGamma choice.color).Walk (Sum.inl u) (Sum.inl choice.vertex)), ( + ∀ x ∈ path.support, + ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj x y → y ∈ + path.support) → + ∀ y ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex), y ∈ + path.support := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable choice u path hclosed y hy + let graph := TwoColorIncidenceGraph G secondStable chosenGamma choice.color + have reach : graph.Reachable (Sum.inl choice.vertex) y := by + change graph.connectedComponentMk y = graph.connectedComponentMk (Sum.inl choice.vertex) + at hy + exact SimpleGraph.ConnectedComponent.eq.mp hy |>.symm + exact reach.mem_subgraphVerts (H := (⊤ : graph.Subgraph).induce {x | x ∈ path.support}) + (fun x hx z hadj => ⟨by simpa using hx, hclosed x (by simpa using hx) z hadj, hadj⟩) + (by simp) + +private theorem helper_hcompEdge_1176.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)) (_ : V) (e : E), Sum.inr e ∈ TwoColorComponent G + secondStable chosenGamma choice.color (Sum.inl choice.vertex) → secondStable e = some + chosenGamma ∨ secondStable e = some choice.color := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable choice u e he + have hs : Sum.inr e ∈ + (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G secondStable chosenGamma choice.color) + (u := Sum.inr e) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp he + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).mem_support.mp hs + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + +private theorem helper_hchoiceSecond_1192.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (secondStable : + PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 (series.data.tree + q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) (series.data.coloring + q.castSucc)), StableColoring (series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) choice.selected + secondStable → secondStable choice.edge = some choice.color := by + classical + intro V E _ _ _ G k rounds e0 input series q secondStable choice secondStableRelation + have heq := secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union.mpr (Or.inr (Finset.mem_insert_self _ _)), + choice.edgeColor⟩ + exact heq.trans choice.edgeColor + +private theorem helper_hneq_1198.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)), chosenGamma ∈ MissingColors G secondStable + choice.vertex → secondStable choice.edge = some choice.color → chosenGamma ≠ choice.color + := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable choice hmissing + hchoiceSecond heq + have hp : chosenGamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, heq ▸ hchoiceSecond⟩ + have hpnot : chosenGamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + exact hpnot hp + +private theorem helper_htreeEdge_1211.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)), + chosenGamma ∈ MissingColors G secondStable choice.vertex → + ∀ (u : V) (path : (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Walk + (Sum.inl u) (Sum.inl choice.vertex)), ((chosenGamma ∈ MissingColors G secondStable u ∨ + choice.color ∈ MissingColors G secondStable u) ∧ + ∀ w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), Sum.inl w ∈ path.support ↔ w = + choice.vertex) → ( + ∀ y ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex), y ∈ + path.support) → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) → + secondStable choice.edge = some choice.color → + ∀ (e : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex) → e = + choice.edge := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable secondStableProper choice + hmissing u path endOnly hpathComponent hcompEdge hchoiceSecond e heT heC + rcases heT with ⟨w, hw, hwe⟩ + have hwC : Sum.inl w ∈ TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) := by + have hadj : (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj + (Sum.inl w) (Sum.inr e) := by + simp [TwoColorIncidenceGraph, hwe, hcompEdge e heC] + change (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).connectedComponentMk + (Sum.inl w) = _ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans heC + have hwv : w = choice.vertex := (endOnly.2 w hw).mp (hpathComponent _ hwC) + subst w + rcases hcompEdge e heC with hec | hec + · have hnot : secondStable e ≠ some chosenGamma := by + intro heq + have hp : chosenGamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, heq⟩ + have hm : chosenGamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + exact hm hp + exact (hnot hec).elim + · by_contra hne + exact (secondStableProper hne ⟨choice.vertex, hwe, choice.edgeIncident⟩ hec + hchoiceSecond).elim + +private theorem helper_undoneOne_1250.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : PartialEdgeColoring E k), + IsOneEdgeUncolored sigma e0 → + ∀ (chosenGamma : Fin k) (choice : MaximumDefectiveChoice G e0 (series.data.tree + q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) (series.data.coloring + q.castSucc)), chosenGamma ≠ choice.color → + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex); IsOneEdgeUncolored undone e0 := by + classical + intro V E _ _ _ G k rounds e0 input series q sigma hsigmaOneUncolored chosenGamma choice hneq + undone + unfold IsOneEdgeUncolored + constructor + · by_cases he : Sum.inr e0 ∈ + TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) + · simp [undone, TwoColorComponentSwap, he, hsigmaOneUncolored.1] + · simp [undone, TwoColorComponentSwap, he, hsigmaOneUncolored.1] + · intro e he + obtain ⟨c, hc⟩ := hsigmaOneUncolored.2 e he + by_cases hec : Sum.inr e ∈ + TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) + · by_cases hcg : c = chosenGamma + · exact ⟨choice.color, by simp [undone, TwoColorComponentSwap, hec, hc, hcg]⟩ + · by_cases hcd : c = choice.color + · exact ⟨chosenGamma, by simp [undone, TwoColorComponentSwap, hec, hc, hcd, + hneq.symm]⟩ + · exact ⟨c, by simp [undone, TwoColorComponentSwap, hec, hc, hcg, hcd]⟩ + · exact ⟨c, by simp [undone, TwoColorComponentSwap, hec, hc]⟩ + +private theorem helper_treeMissingTransport_1268.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (a b : PartialEdgeColoring E k), ( + ∀ w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), MissingColors G a w = + MissingColors G b w) → TreeMissingColors a (series.data.tree q.succ.castSucc) = + TreeMissingColors b (series.data.tree q.succ.castSucc) := by + classical + intro V E _ _ _ G k rounds e0 input series q a b hab + ext c + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + constructor + · rintro ⟨w, hw, hc⟩ + exact ⟨w, hw, by rw [hab w hw] at hc; exact hc⟩ + · rintro ⟨w, hw, hc⟩ + exact ⟨w, hw, by rw [hab w hw]; exact hc⟩ + +private theorem helper_sigmaComponentColor_1288.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : PartialEdgeColoring E k) + (chosenGamma : Fin k) (choice : MaximumDefectiveChoice G e0 (series.data.tree + q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) (series.data.coloring + q.castSucc)) (_ : V) (e : E), Sum.inr e ∈ TwoColorComponent G sigma chosenGamma + choice.color (Sum.inl choice.vertex) → sigma e = some chosenGamma ∨ sigma e = some + choice.color := by + classical + intro V E _ _ _ G k rounds e0 input series q sigma chosenGamma choice u e he + have hs : Sum.inr e ∈ + (TwoColorIncidenceGraph G sigma chosenGamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G sigma chosenGamma choice.color) + (u := Sum.inr e) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp he + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G sigma chosenGamma choice.color).mem_support.mp hs + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + +private theorem helper_currentColorMissing_1304.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)), + series.data.coloring q.succ = TwoColorComponentSwap G secondStable chosenGamma + choice.color (Sum.inl choice.vertex) → chosenGamma ∈ MissingColors G secondStable + choice.vertex → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) → + secondStable choice.edge = some choice.color → chosenGamma ≠ choice.color → Sum.inr + choice.edge ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → choice.color ∈ MissingColors G (series.data.coloring q.succ) + choice.vertex := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable secondStableProper choice + currentColoring hmissing hcompEdge hchoiceSecond hneq hfcomponent + rw [MissingColors] + simp only [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp + rcases hp with ⟨e, he, hec⟩ + rw [currentColoring] at hec + by_cases hecomp : Sum.inr e ∈ + TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex) + · rcases hcompEdge e hecomp with hegamma | hecolor + · have hm : chosenGamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + apply hm + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, he, hegamma⟩ + · simp [TwoColorComponentSwap, hecomp, hecolor, hneq, hneq.symm] at hec + · have hecolor : secondStable e = some choice.color := by + simpa [TwoColorComponentSwap, hecomp] using hec + by_cases heq : e = choice.edge + · subst e + exact (hecomp hfcomponent).elim + · exact (secondStableProper heq ⟨choice.vertex, he, choice.edgeIncident⟩ + hecolor hchoiceSecond).elim + +private theorem helper_currentControl_1340.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) (choice : + MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) (TashkinovStoredColors + series.data q.castSucc) (series.data.coloring q.castSucc)), series.data.stored q.succ = + (insert choice.color ({ chosenGamma } : Finset (Fin k)) : Finset (Fin k)) → + TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) = TreeMissingColors + (series.data.coloring q.castSucc) (series.data.tree q.succ.castSucc) → + ∀ c ∈ TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)), c ∈ + TreeMissingColors (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.succ := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma choice currentStored + treeSelectedPrevious c hc + rcases Finset.mem_union.mp hc with hc | hc + · apply (HkuMissingStoredMonotone G k rounds e0 input series q).1 + rw [treeSelectedPrevious] at hc + exact Finset.mem_union.mpr (Or.inl hc) + · rcases Finset.mem_insert.mp hc with rfl | hc + · by_cases hm : choice.color ∈ TreeMissingColors + (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) + · exact Finset.mem_union.mpr (Or.inl hm) + · apply Finset.mem_union.mpr + right + unfold TashkinovStoredColors + split + · simp_all + · simp only [Finset.mem_sdiff, Finset.mem_biUnion] + exact ⟨⟨q.succ, by simp, by simp [currentStored]⟩, hm⟩ + · exact (HkuMissingStoredMonotone G k rounds e0 input series q).1 + (Finset.mem_union.mpr (Or.inr hc)) + +private theorem helper_gammaControl_1367.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)), StableColoring (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) + choice.selected secondStable → choice.vertex ∈ TreeSequenceVertexSet (series.data.tree + q.succ.castSucc) → chosenGamma ∈ MissingColors G secondStable choice.vertex → chosenGamma + ∈ TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable choice + secondStableRelation hv hmissing + apply Finset.mem_union.mpr + left + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + refine ⟨choice.vertex, hv, ?_⟩ + rw [← secondStableRelation.2 choice.vertex + choice.vertexDefective.1] + exact hmissing + +private theorem helper_branch_1407.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : PartialEdgeColoring E k) + (chosenGamma : Fin k) (choice : MaximumDefectiveChoice G e0 (series.data.tree + q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) (series.data.coloring + q.castSucc)), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex); TreeMissingColors choice.selected (series.data.tree + q.succ.castSucc) = TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree + q.succ.castSucc) → ( + ∀ (f : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) f → (( + ∃ c ∈ TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)), + choice.selected f = some c) ∨ + ∃ c ∈ TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)), undone f = + some c) → undone f = choice.selected f) → ( + ∀ (f : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) f → (( + ∃ c ∈ TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.castSucc, series.data.coloring q.castSucc f = some c) + ∨ + ∃ c ∈ TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.castSucc, choice.selected f = some c) → + choice.selected f = series.data.coloring q.castSucc f) → + ∀ (f : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) f → ( + ∃ c ∈ TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.castSucc, series.data.coloring q.castSucc f = some c) + → undone f = series.data.coloring q.castSucc f := by + classical + intro V E _ _ _ G k rounds e0 input series q sigma chosenGamma choice undone + treeSelectedPrevious selectedCriterion previousCriterion f hf h + rcases h with ⟨c, hc, hcf⟩ + have hsel := previousCriterion f hf (Or.inl ⟨c, hc, hcf⟩) + have hc2 : c ∈ TreeMissingColors choice.selected + (series.data.tree q.succ.castSucc) ∪ + insert choice.color (TashkinovStoredColors series.data q.castSucc) := by + rcases Finset.mem_union.mp hc with hc | hc + · exact Finset.mem_union.mpr (Or.inl (by rw [treeSelectedPrevious]; exact hc)) + · exact Finset.mem_union.mpr (Or.inr (Finset.mem_insert_of_mem hc)) + have hstable := selectedCriterion f hf + (Or.inl ⟨c, hc2, hsel.trans hcf⟩) + exact hstable.trans hsel + +private theorem helper_branch_1764.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (v : V) (gamma delta : Fin k) (_ : + series.data.kind q.succ = some TashkinovExtensionKind.PE) (sigma : PartialEdgeColoring E + k) (ci : Fin rounds) (_ : IsProperEdgeColoring G (series.data.coloring ci.castSucc)) (_ : + IsOneEdgeUncolored (series.data.coloring ci.castSucc) e0) (_ : ColoredVertexSetClosed G + (series.data.coloring ci.castSucc) (TreeSequenceVertexSet (series.data.tree + ci.succ.castSucc))) (_ : ¬ColoredVertexSetStronglyClosed G (series.data.coloring + ci.castSucc) (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc))) (_ : ¬Nonempty + (RevisitingExtensionCertificate series.data ci.castSucc)) (choice : MaximumDefectiveChoice + G e0 (series.data.tree ci.succ.castSucc) (TashkinovStoredColors series.data ci.castSucc) + (series.data.coloring ci.castSucc)) (_ : + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data ci.castSucc) : Finset (Fin k)) choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) (TreeMissingColors pi (series.data.tree + ci.succ.castSucc))) (_ : series.data.coloring ci.succ = choice.selected) (_ : + series.data.stored ci.succ = ({ choice.color } : Finset (Fin k))) (_ : + series.data.connectingEdges ci.succ = ({ choice.edge } : Finset E)) (_ : series.data.kind + ci.succ = some TashkinovExtensionKind.SE) (_ : series.data.chosenVertex ci.succ = some + choice.vertex) (_ : series.data.outsideVertex ci.succ = some choice.otherEndpoint) (_ : + series.data.delta ci.succ = some choice.color) (_ : series.data.gamma ci.succ = none) + (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (series.data.tree + ci.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (series.data.coloring + ci.succ) adjoined (series.data.tree ci.succ.succ)) (_ : TreeSequenceInitialSegment + (series.data.tree ci.succ.castSucc) (series.data.tree ci.succ.succ)) (_ : + (series.data.tree ci.succ.castSucc).length < (series.data.tree ci.succ.succ).length) (_ : + q.succ = ci.succ), + ∃ (selected : PartialEdgeColoring E k) (secondStable : PartialEdgeColoring E k), + IsProperEdgeColoring G selected ∧ IsOneEdgeUncolored selected e0 ∧ StableColoring + (series.data.tree ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc) selected ∧ IsProperEdgeColoring G secondStable ∧ + IsOneEdgeUncolored secondStable e0 ∧ StableColoring (series.data.tree ci.succ.castSucc) + (insert delta (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) selected + secondStable ∧ series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma + delta (Sum.inl v) ∧ + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma delta (Sum.inl v); + StableColoring (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors + series.data q.castSucc) : Finset (Fin k)) secondStable undone ∧ StableColoring + (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors series.data + q.castSucc) : Finset (Fin k)) selected undone ∧ StableColoring (series.data.tree + ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) (series.data.coloring + q.castSucc) undone := by + classical + intro V E _ _ _ G k rounds e0 input series q v gamma delta hkind sigma ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternative currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension target_eq + apply helper_branch_1099 <;> assumption +private theorem helper_branch_1776.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (v : V) (gamma delta : Fin k) (_ : + series.data.kind q.succ = some TashkinovExtensionKind.PE) (sigma : PartialEdgeColoring E + k) (ci : Fin rounds) (_ : IsProperEdgeColoring G (series.data.coloring ci.castSucc)) (_ : + IsOneEdgeUncolored (series.data.coloring ci.castSucc) e0) (_ : ColoredVertexSetClosed G + (series.data.coloring ci.castSucc) (TreeSequenceVertexSet (series.data.tree + ci.succ.castSucc))) (_ : ¬ColoredVertexSetStronglyClosed G (series.data.coloring + ci.castSucc) (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc))) (available : + RevisitingExtensionCertificate series.data ci.castSucc) (_ : series.data.coloring ci.succ + = series.data.coloring ci.castSucc) (_ : series.data.stored ci.succ = (insert + available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k))) (_ : + series.data.connectingEdges ci.succ = ({ available.edge } : Finset E)) (_ : + series.data.kind ci.succ = some TashkinovExtensionKind.RE) (_ : series.data.chosenVertex + ci.succ = some available.insideEndpoint) (_ : series.data.outsideVertex ci.succ = some + available.outsideEndpoint) (_ : series.data.delta ci.succ = some available.delta) (_ : + series.data.gamma ci.succ = some available.gamma) (adjoined : TreeSequence G e0) (_ : + TreeSequenceAdjoinEdge (series.data.tree ci.succ.castSucc) available.edge adjoined) (_ : + TashkinovClosure (series.data.coloring ci.succ) adjoined (series.data.tree ci.succ.succ)) + (_ : TreeSequenceInitialSegment (series.data.tree ci.succ.castSucc) (series.data.tree + ci.succ.succ)) (_ : (series.data.tree ci.succ.castSucc).length < (series.data.tree + ci.succ.succ).length) (_ : q.succ = ci.succ), + ∃ (selected : PartialEdgeColoring E k) (secondStable : PartialEdgeColoring E k), + IsProperEdgeColoring G selected ∧ IsOneEdgeUncolored selected e0 ∧ StableColoring + (series.data.tree ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc) selected ∧ IsProperEdgeColoring G secondStable ∧ + IsOneEdgeUncolored secondStable e0 ∧ StableColoring (series.data.tree ci.succ.castSucc) + (insert delta (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) selected + secondStable ∧ series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma + delta (Sum.inl v) ∧ + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma delta (Sum.inl v); + StableColoring (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors + series.data q.castSucc) : Finset (Fin k)) secondStable undone ∧ StableColoring + (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors series.data + q.castSucc) : Finset (Fin k)) selected undone ∧ StableColoring (series.data.tree + ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) (series.data.coloring + q.castSucc) undone := by + classical + intro V E _ _ _ G k rounds e0 input series q v gamma delta hkind sigma ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed available currentColoring + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension strictExtension + target_eq + apply helper_branch_1110 <;> assumption +private theorem helper_htreeEdge_1972.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G secondStable) (choice + : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) (TashkinovStoredColors + series.data q.castSucc) (series.data.coloring q.castSucc)) (_ : chosenGamma ∈ + MissingColors G secondStable choice.vertex) (u : V) (path : (TwoColorIncidenceGraph G + secondStable chosenGamma choice.color).Walk (Sum.inl u) (Sum.inl choice.vertex)) (_ : + (chosenGamma ∈ MissingColors G secondStable u ∨ choice.color ∈ MissingColors G + secondStable u) ∧ + ∀ w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), Sum.inl w ∈ path.support ↔ w = + choice.vertex) (_ : + ∀ y ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex), y ∈ + path.support) (_ : + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) + (_ : secondStable choice.edge = some choice.color) (e : E), TreeIncidentEdge + (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ TwoColorComponent G secondStable + chosenGamma choice.color (Sum.inl choice.vertex) → e = choice.edge := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable secondStableProper choice + hmissing u path endOnly hpathComponent hcompEdge hchoiceSecond + apply helper_htreeEdge_1211 <;> assumption +private theorem helper_hsigmaEdge_1980.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : PartialEdgeColoring E k) + (_ : IsProperEdgeColoring G sigma) (_ : StableColoring (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.succ) (series.data.coloring q.succ) sigma) + (chosenGamma : Fin k) (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G + secondStable) (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)) (_ : + series.data.coloring q.succ = TwoColorComponentSwap G secondStable chosenGamma + choice.color (Sum.inl choice.vertex)) (_ : series.data.stored q.succ = (insert + choice.color ({ chosenGamma } : Finset (Fin k)) : Finset (Fin k))) (_ : series.data.gamma + q.succ = some chosenGamma) (_ : choice.vertex ∈ TreeSequenceVertexSet (series.data.tree + q.succ.castSucc)) (_ : + ∀ w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), Sum.inl w ∈ TwoColorComponent + G sigma chosenGamma choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex) (_ : + chosenGamma ∈ MissingColors G secondStable choice.vertex) (_ : V) (_ : + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) + (_ : secondStable choice.edge = some choice.color) (_ : chosenGamma ≠ choice.color) (_ : + Sum.inr choice.edge ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex)) (e : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e + ∈ TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) → e = + choice.edge := by + classical + intro V E _ _ _ G k rounds e0 input series q sigma hsigmaProper hsigmaStable chosenGamma + secondStable secondStableProper choice currentColoring currentStored hgamma hv hcomponent + hmissing u hcompEdge hchoiceSecond hneq hfcomponent + apply helper_hsigmaEdge_358 <;> assumption +private theorem helper_currentColorMissing_2017.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G secondStable) (choice + : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) (TashkinovStoredColors + series.data q.castSucc) (series.data.coloring q.castSucc)) (_ : series.data.coloring + q.succ = TwoColorComponentSwap G secondStable chosenGamma choice.color (Sum.inl + choice.vertex)) (_ : chosenGamma ∈ MissingColors G secondStable choice.vertex) (_ : + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) + (_ : secondStable choice.edge = some choice.color) (_ : chosenGamma ≠ choice.color) (_ : + Sum.inr choice.edge ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex)), choice.color ∈ MissingColors G (series.data.coloring q.succ) + choice.vertex := by + classical + intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable secondStableProper choice + currentColoring hmissing hcompEdge hchoiceSecond hneq hfcomponent + apply helper_currentColorMissing_1304 <;> assumption +private theorem helper_stableSecond_2052.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : + PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma + e0) (_ : StableColoring (series.data.tree q.succ.castSucc) (TashkinovStoredColors + series.data q.succ) (series.data.coloring q.succ) sigma) (chosenGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G secondStable) (_ : + IsOneEdgeUncolored secondStable e0) (choice : MaximumDefectiveChoice G e0 + (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)) (_ : StableColoring (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) + choice.selected secondStable) (_ : series.data.coloring q.succ = TwoColorComponentSwap G + secondStable chosenGamma choice.color (Sum.inl choice.vertex)) (_ : IsProperEdgeColoring G + (series.data.coloring q.succ)) (_ : IsOneEdgeUncolored (series.data.coloring q.succ) e0) + (_ : + ∀ (w : V), chosenGamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G + secondStable w → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k + secondStable chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) (@Sum.inl V E w) + (@Subtype.fintype (Sum V E) (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V + E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V + E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit + 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) + (@Sum.inl V E w))) (fun (a : Sum V E) ↦ @SimpleGraph.neighborSet.memDecidable (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V + E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V + E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit + 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) + (@Sum.inl V E w) (fun (a b : Sum V E) ↦ Classical.propDecidable (@SimpleGraph.Adj (Sum V + E) (@TwoColorIncidenceGraph V E G k secondStable chosenGamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) + (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat + (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V + E inst_1 G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input + series) (@Fin.castSucc rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc + rounds q)) choice)) a b)) a) (@instFintypeSum V E inst inst_1)) ≤ (1 : ℕ)) (u : V) (path : + (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Walk (Sum.inl u) (Sum.inl + choice.vertex)) (_ : + ∀ (x : V ⊕ E), @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable + chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x (@Fintype.ofFinite + (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k + secondStable chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x)) (@Subtype.finite + (Sum V E) (@Finite.instSum V E (@Finite.of_fintype V inst) (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable + chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 + G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat + instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E + inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) + (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x)))) ≤ (2 : ℕ)) (_ + : + ∀ x ∈ path.support, + ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj x y → y ∈ + path.support) (_ : + ∀ y ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex), y ∈ + path.support) (_ : + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) + (_ : secondStable choice.edge = some choice.color) (_ : + ∀ (e : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex) → e = + choice.edge) (_ : + ∀ (e : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) → e = + choice.edge), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex); + ∀ (_ : IsProperEdgeColoring G undone) (_ : IsOneEdgeUncolored undone e0) (_ : + TreeMissingColors secondStable (series.data.tree q.succ.castSucc) = TreeMissingColors + choice.selected (series.data.tree q.succ.castSucc)) (_ : + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G sigma chosenGamma choice.color (Sum.inl + choice.vertex) → sigma e = some chosenGamma ∨ sigma e = some choice.color) (_ : + choice.color ∈ MissingColors G sigma choice.vertex) (_ : + ∀ c ∈ TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)), c ∈ + TreeMissingColors (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors series.data q.succ) (_ : chosenGamma ∈ TreeMissingColors + choice.selected (series.data.tree q.succ.castSucc) ∪ (insert choice.color + (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k))), StableColoring + (series.data.tree q.succ.castSucc) (insert choice.color (TashkinovStoredColors series.data + q.castSucc) : Finset (Fin k)) secondStable undone := by + classical + intro V E _ _ _ G k rounds e0 input series q sigma hsigmaProper hsigmaOneUncolored hsigmaStable + chosenGamma secondStable secondStableProper secondStableOneUncolored choice + secondStableRelation currentColoring currentProper currentOneUncolored hdegree u path + hdegreeBound hclosed hpathComponent hcompEdge hchoiceSecond htreeEdge hsigmaEdge undone + undoneProper undoneOne treeSecondSelected sigmaComponentColor sigmaColorMissing + currentControl gammaControl + apply helper_stableSecond_588 <;> assumption +private theorem helper_stableSelected_2064.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : PartialEdgeColoring E k) + (chosenGamma : Fin k) (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G + secondStable) (_ : IsOneEdgeUncolored secondStable e0) (choice : MaximumDefectiveChoice G + e0 (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc)) (_ : StableColoring (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) + choice.selected secondStable), + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex); + ∀ (_ : IsProperEdgeColoring G undone) (_ : IsOneEdgeUncolored undone e0) (_ : + TreeMissingColors secondStable (series.data.tree q.succ.castSucc) = TreeMissingColors + choice.selected (series.data.tree q.succ.castSucc)) (_ : StableColoring (series.data.tree + q.succ.castSucc) (insert choice.color (TashkinovStoredColors series.data q.castSucc) : + Finset (Fin k)) secondStable undone), StableColoring (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) + choice.selected undone := by + classical + intro V E _ _ _ G k rounds e0 input series q sigma chosenGamma secondStable secondStableProper + secondStableOneUncolored choice secondStableRelation undone undoneProper undoneOne + treeSecondSelected stableSecond + exact @helper_stableSelected_718 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@rounds) (@e0) (@input) (@series) (@q) (@sigma) (@chosenGamma) (@secondStable) + (@secondStableProper) (@secondStableOneUncolored) (@choice) (@secondStableRelation) + (@undoneProper) (@undoneOne) (@treeSecondSelected) (@stableSecond) + +theorem ParallelExtensionUndoStable {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) + (v : V) (gamma delta : Fin k) + (hkind : series.data.kind q.succ = some TashkinovExtensionKind.PE) + (hvertex : series.data.chosenVertex q.succ = some v) + (hgamma : series.data.gamma q.succ = some gamma) + (hdelta : series.data.delta q.succ = some delta) + (sigma : PartialEdgeColoring E k) + (hsigmaProper : IsProperEdgeColoring G sigma) + (hsigmaOneUncolored : IsOneEdgeUncolored sigma e0) + (hsigmaStable : StableColoring (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.succ) + (series.data.coloring q.succ) sigma) + (hv : v ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) + (hcomponent : ∀ w, + w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc) → + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ + w = v)) : + ∃ selected secondStable : PartialEdgeColoring E k, + IsProperEdgeColoring G selected ∧ + IsOneEdgeUncolored selected e0 ∧ + StableColoring (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc) selected ∧ + IsProperEdgeColoring G secondStable ∧ + IsOneEdgeUncolored secondStable e0 ∧ + StableColoring (series.data.tree q.succ.castSucc) + (insert delta (TashkinovStoredColors series.data q.castSucc)) + selected secondStable ∧ + series.data.coloring q.succ = + TwoColorComponentSwap G secondStable gamma delta (Sum.inl v) ∧ + StableColoring (series.data.tree q.succ.castSucc) + (insert delta (TashkinovStoredColors series.data q.castSucc)) + secondStable (TwoColorComponentSwap G sigma gamma delta (Sum.inl v)) ∧ + StableColoring (series.data.tree q.succ.castSucc) + (insert delta (TashkinovStoredColors series.data q.castSucc)) + selected (TwoColorComponentSwap G sigma gamma delta (Sum.inl v)) ∧ + StableColoring (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc) (TwoColorComponentSwap G sigma gamma delta (Sum.inl + v)) := by + classical + generalize target_eq : q.succ = target + cases series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q target_eq).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + apply helper_branch_1764 <;> assumption + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + apply helper_branch_1776 <;> assumption + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have value := congrArg Fin.val target_eq + simp at value + have ci_eq : ci = q := by apply Fin.ext; omega + subst ci + rw [currentKind] at hkind + have delta_eq : delta = choice.color := Option.some.inj (hdelta.symm.trans currentDelta) + have gamma_eq : gamma = chosenGamma := Option.some.inj (hgamma.symm.trans currentGamma) + have vertex_eq : v = choice.vertex := Option.some.inj (hvertex.symm.trans currentVertex) + subst delta + subst gamma + subst v + refine ⟨choice.selected, secondStable, choice.selectedProper, + choice.selectedOneUncolored, choice.selectedStable, + secondStableProper, secondStableOneUncolored, secondStableRelation, + currentColoring, ?_⟩ + dsimp + have hmissing : chosenGamma ∈ MissingColors G secondStable choice.vertex := by + exact (secondStableRelation.2 choice.vertex choice.vertexDefective.1).symm ▸ gammaRule.1 + have hdegree : ∀ w, chosenGamma ∈ MissingColors G secondStable w ∨ + choice.color ∈ MissingColors G secondStable w → + (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).degree + (Sum.inl w) ≤ 1 := by + apply helper_hdegree_145; assumption + rcases exitWitness with ⟨u, path, pathData⟩ + rcases pathData with ⟨pathIs, pathLen, uOut, endTree, endOnly⟩ + have hdegreeBound : ∀ x, @SimpleGraph.degree _ + (TwoColorIncidenceGraph G secondStable chosenGamma choice.color) x + (Fintype.ofFinite _) ≤ 2 := by + intro x + exact TwoColorIncidenceDegreeAtMostTwo G secondStable chosenGamma choice.color + secondStableProper x + have huDegree := hdegree u endOnly.1 + have hclosed : ∀ x, x ∈ path.support → ∀ y, + (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj x y → + y ∈ path.support := by + apply helper_hclosed_201 <;> assumption + have hpathComponent : ∀ y, + y ∈ TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) → y ∈ path.support := by + apply helper_hpathComponent_1164; assumption + have hcompEdge : + ∀ e, Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl + choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color + := by + apply helper_hcompEdge_1176; assumption + have hchoiceSecond : secondStable choice.edge = some choice.color := by + apply helper_hchoiceSecond_1192; assumption + have hneq : chosenGamma ≠ choice.color := by + apply helper_hneq_1198 <;> assumption + have hfcomponent : Sum.inr choice.edge ∈ + TwoColorComponent G secondStable chosenGamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hchoiceSecond] + have htreeEdge : + ∀ e, TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ TwoColorComponent G + secondStable chosenGamma choice.color (Sum.inl choice.vertex) → e = choice.edge := by + apply helper_htreeEdge_1972 <;> assumption + have hsigmaEdge := @helper_hsigmaEdge_1980 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@rounds) (@e0) (@input) (@series) (@q) (@sigma) (@hsigmaProper) (@hsigmaStable) + (@chosenGamma) (@secondStable) (@secondStableProper) (@choice) (@currentColoring) + (@currentStored) (@hgamma) (@hv) (@hcomponent) (@hmissing) (@u) (@hcompEdge) + (@hchoiceSecond) (@hneq) (@hfcomponent) + let undone := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex) + have undoneProper : IsProperEdgeColoring G undone := by + exact TwoColorComponentSwapProper G sigma chosenGamma choice.color hneq + hsigmaProper (Sum.inl choice.vertex) + have undoneOne : IsOneEdgeUncolored undone e0 := by + apply helper_undoneOne_1250 <;> assumption + have treeMissingTransport : ∀ (a b : PartialEdgeColoring E k), + (∀ w, w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc) → + MissingColors G a w = MissingColors G b w) → + TreeMissingColors a (series.data.tree q.succ.castSucc) = + TreeMissingColors b (series.data.tree q.succ.castSucc) := by + apply helper_treeMissingTransport_1268 + have treeSecondSelected : + TreeMissingColors secondStable (series.data.tree q.succ.castSucc) = + TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) := + treeMissingTransport secondStable choice.selected (by + intro w hw + exact secondStableRelation.2 w hw) + have sigmaComponentColor : + ∀ e, Sum.inr e ∈ TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) → + sigma e = some chosenGamma ∨ sigma e = some choice.color := by + apply helper_sigmaComponentColor_1288; assumption + have currentColorMissing := @helper_currentColorMissing_2017 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@rounds) (@e0) (@input) (@series) (@q) (@chosenGamma) + (@secondStable) (@secondStableProper) (@choice) (@currentColoring) (@hmissing) (@hcompEdge) + (@hchoiceSecond) (@hneq) (@hfcomponent) + have sigmaColorMissing : choice.color ∈ + MissingColors G sigma choice.vertex := by + rw [hsigmaStable.2 choice.vertex hv] + exact currentColorMissing + have treeSelectedPrevious : + TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) = + TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc) := + treeMissingTransport choice.selected (series.data.coloring q.castSucc) (by + intro w hw + exact choice.selectedStable.2 w hw) + have currentControl : + ∀ c, c ∈ TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) ∪ insert + choice.color (TashkinovStoredColors series.data q.castSucc) → c ∈ TreeMissingColors + (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors + series.data q.succ := by + apply helper_currentControl_1340 <;> assumption + have selectedStableFact := choice.selectedStable + have sigmaStableFact := hsigmaStable + have relationFact := secondStableRelation + have gammaControl : chosenGamma ∈ + TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) ∪ + insert choice.color (TashkinovStoredColors series.data q.castSucc) := by + apply helper_gammaControl_1367 <;> assumption + have stableSecond : StableColoring + (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc)) + secondStable undone := by + apply helper_stableSecond_2052 <;> assumption + have stableSelected := @helper_stableSelected_2064 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@rounds) (@e0) (@input) (@series) (@q) (@sigma) (@chosenGamma) + (@secondStable) (@secondStableProper) (@secondStableOneUncolored) (@choice) + (@secondStableRelation) (@undoneProper) (@undoneOne) (@treeSecondSelected) (@stableSecond) + exact ⟨stableSecond, stableSelected, by + apply (sc1 G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc) undone + (by exact previousProper) (by exact previousOneUncolored) + undoneProper undoneOne).2 + have selectedCriterion := + ((sc1 G e0 (series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data q.castSucc)) + choice.selected undone choice.selectedProper choice.selectedOneUncolored + undoneProper undoneOne).mp stableSelected) + have previousCriterion := + ((sc1 G e0 (series.data.tree q.succ.castSucc) + (TashkinovStoredColors series.data q.castSucc) + (series.data.coloring q.castSucc) choice.selected + previousProper previousOneUncolored choice.selectedProper + choice.selectedOneUncolored).mp choice.selectedStable) + intro f hf h + rcases h with h | h + · apply helper_branch_1407 <;> assumption + · rcases h with ⟨c, hc, hcf⟩ + have hc2 := hc + have hc2 : c ∈ TreeMissingColors choice.selected + (series.data.tree q.succ.castSucc) ∪ + insert choice.color (TashkinovStoredColors series.data q.castSucc) := by + rcases Finset.mem_union.mp hc with hc | hc + · exact Finset.mem_union.mpr (Or.inl (by rw [treeSelectedPrevious]; exact hc)) + · exact Finset.mem_union.mpr (Or.inr (Finset.mem_insert_of_mem hc)) + have hstable := selectedCriterion f hf (Or.inr ⟨c, hc2, hcf⟩) + have hsel := previousCriterion f hf + (Or.inr ⟨c, hc, hstable.symm.trans hcf⟩) + exact hstable.trans hsel⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelInterchangeability.lean b/LeanPool/GoldbergSeymour/ParallelInterchangeability.lean new file mode 100644 index 0000000000..8ad237ce10 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelInterchangeability.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.InterchangePEMixedCore + +/-! +# interchange + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem interchange {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (base : HierarchyBase ett generating) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : CombinedStableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + generating sigma) + (alpha beta : Fin k) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + (alpha ∈ TreeMissingColors sigma base.closure → + TreeInterchangeable G base.closure sigma alpha beta) ∧ + (alpha ∈ TreeMissingColors sigma Tn → + TreeInterchangeable G Tn sigma alpha beta) ∧ + (alpha ∈ TreeMissingColors sigma base.core → + TreeColorSetClosed G sigma base.core {alpha} → + TreeInterchangeable G base.core sigma alpha beta) ∧ + (alpha ∈ TreeMissingColors sigma Tn → + beta ∈ TreeMissingColors sigma base.closure → + TreeInterchangeable G base.core sigma alpha beta) := by + dsimp + refine ⟨?_, ?_, ?_, ?_⟩ + · exact InterchangePEClosureConstituent G k e0 input T generating sigma + ett hMP hpositive hlower hPE base hproper hone hstable alpha beta + · exact InterchangePETreeConstituent G k e0 input T generating sigma + ett hMP hpositive hlower hPE base hproper hone hstable alpha beta + · exact InterchangePEClosedCore G k e0 input T generating sigma + ett hMP hpositive hlower hPE base hproper hone hstable alpha beta + · exact InterchangePEMixedCore G k e0 input T generating sigma + ett hMP hpositive hlower hPE base hproper hone hstable alpha beta + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelSpecialClosurePreparation.lean b/LeanPool/GoldbergSeymour/ParallelSpecialClosurePreparation.lean new file mode 100644 index 0000000000..6198560d51 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelSpecialClosurePreparation.lean @@ -0,0 +1,235 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveBaseStage + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTransTrees + +public import LeanPool.GoldbergSeymour.ParallelBaseFourCommonMissingColors +public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.ParallelCoreAugmentationStrict + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceStrictBoundaryWitness + +public import LeanPool.GoldbergSeymour.PredecessorElementary +public import LeanPool.GoldbergSeymour.ClosedCoreElementary +public import LeanPool.GoldbergSeymour.CoreClosurePresentation + +/-! +# Parallel Special Closure Preparation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ParallelSpecialClosurePreparation + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (ctx : TechnicalInductionContext G k e0 ett.rounds) + (hMP : MaximumProperty ett) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (base : HierarchyBase ett phi) + (hdegree : MaximumDegree G + 1 <= k) + (hlarge : 2 * ett.rounds + 11 <= + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + TashkinovAugmentationSequence phi Tn base.core /\ + Tn.length < base.core.length /\ + (ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∨ + exists (U : TreeSequence G e0) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + MaximumProperty corrU.replacementETT /\ + TashkinovAugmentationSequence phi base.core U /\ + TreeSequenceInitialSegment base.core U /\ + base.core.length < U.length /\ + exists baseU : HierarchyBase corrU.replacementETT phi, + baseU.core = base.core /\ + baseU.closure = base.closure /\ + baseU.supportPosition.val = base.supportPosition.val /\ + exists KU : TashkinovHierarchy corrU.replacementETT baseU, + KU.dividerCount = 0 /\ + KU.stage 0 = Tn /\ + KU.stage (Fin.last (KU.dividerCount + 1)) = U /\ + exists goodU : GoodHierarchy KU, + (forall eta : Fin k, + eta ∈ HierarchyStoredColorsAt KU + (Fin.last KU.dividerCount) -> + (goodU.gamma + (Fin.last KU.dividerCount) eta).card = 2 /\ + goodU.gamma + (Fin.last KU.dividerCount) eta ⊆ + TreeMissingColors phi Tn \ + HierarchySegmentColors KU + (Fin.last KU.dividerCount) eta) /\ + (forall eta theta : Fin k, + eta ∈ HierarchyStoredColorsAt KU + (Fin.last KU.dividerCount) -> + theta ∈ HierarchyStoredColorsAt KU + (Fin.last KU.dividerCount) -> + eta ≠ theta -> + Disjoint + (goodU.gamma + (Fin.last KU.dividerCount) eta) + (goodU.gamma + (Fin.last KU.dividerCount) theta)) /\ + (¬ TreeColorSetMinusClosed G phi base.core + ((HierarchyStoredColorsAt KU + (Fin.last KU.dividerCount)).biUnion + (goodU.gamma (Fin.last KU.dividerCount)))) /\ + 4 <= ((TreeMissingColors phi Tn ∩ + TreeMissingColors phi base.closure) \ + (HierarchyStoredColorsAt KU + (Fin.last KU.dividerCount)).biUnion + (goodU.gamma + (Fin.last KU.dividerCount))).card /\ + TreeColorSetMinusClosed G phi U + ((HierarchyTerminalStoredColors KU).biUnion + (goodU.gamma (Fin.last KU.dividerCount)))) := by + classical + dsimp only + obtain ⟨hroute, hstrict⟩ := ParallelCoreAugmentationStrict ett base hPE + refine ⟨hroute, hstrict, ?_⟩ + have hpositive : 0 < ett.rounds := by have := ett.roundsPositive; omega + obtain ⟨hproper, hone, _⟩ := P2634_T1_PETerminalFacts ett hPE + have hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi phi := + (sc2 G e0 _ _).refl ⟨phi, hproper, hone⟩ + have hcoreElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet base.core) := + ParallelClosureUnionElementary G k e0 input T phi ett hMP hpositive + (by + intro input' T' generating' lower hpos hlt hmax + exact ⟨ctx.lowerOne lower hpos hlt hmax, + ctx.lowerTwo lower hpos hlt hmax, + ctx.lowerThree lower hpos hlt hmax, + ctx.lowerFour lower hpos hlt hmax, + ctx.lowerFive lower hpos hlt hmax, + ctx.lowerSix lower hpos hlt hmax⟩) + hPE phi hproper hone hstable base + by_cases hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet base.core) + · exact Or.inl + (P2634_T1_ClosedCoreElementary ett hPE base.core hroute hcoreElementary hclosed) + · apply Or.inr + have hcommon := ParallelCommonMissingClosed G k e0 input T phi phi ett + hpositive base ett.generatingColoring hPE + (P2634_T1_PredecessorElementary G k e0 input T phi ett ctx hMP) + have hfour := ParallelBaseFourCommonMissingColors ett base hPE hproper + hone hdegree hcoreElementary + have hmod : ModColoring ett phi := + Td G k e0 input T phi ett hMP hpositive + (by + intro input' T' generating' lower hpos hlt hmax + exact ⟨ctx.lowerOne lower hpos hlt hmax, + ctx.lowerTwo lower hpos hlt hmax, + ctx.lowerThree lower hpos hlt hmax, + ctx.lowerFour lower hpos hlt hmax, + ctx.lowerFive lower hpos hlt hmax, + ctx.lowerSix lower hpos hlt hmax⟩) + phi hproper hone (by + rw [← ett.generatingColoring] + exact hstable) + obtain ⟨Z, corrZ, hMPZ, hclosure, hfinal, hTn, hkind, baseZ, + hcoreZ, hclosureZ, hsupportZ⟩ := + P2634_T1_CoreClosurePresentation G k e0 input T phi ett hMP hmod + hPE base hroute hstrict + have hnonclosedColor : ∃ alpha : Fin k, + alpha ∈ TreeMissingColors phi base.core ∧ + ¬ TreeColorSetClosed G phi base.core {alpha} := by + unfold ColoredVertexSetClosed at hclosed + push Not at hclosed + obtain ⟨f, alpha, v, hf, hv, hcolor, hmissing⟩ := hclosed + refine ⟨alpha, Finset.mem_biUnion.mpr ⟨v, hv, hmissing⟩, ?_⟩ + intro h + have hboundary : f ∈ BoundaryColorEdges G phi + (TreeSequenceVertexSet base.core) alpha := + Finset.mem_filter.mpr ⟨hf, hcolor⟩ + rw [h alpha (Finset.mem_singleton_self alpha)] at hboundary + simp at hboundary + have hmodZ : ModColoring corrZ.replacementETT phi := + Td G k e0 corrZ.replacementInput Z phi corrZ.replacementETT hMPZ + (by have := corrZ.replacementETT.roundsPositive; omega) + (by + intro input' T' generating' lower hpos hlt hmax + rw [corrZ.rungAgreement] at hlt + exact ⟨ctx.lowerOne lower hpos hlt hmax, + ctx.lowerTwo lower hpos hlt hmax, + ctx.lowerThree lower hpos hlt hmax, + ctx.lowerFour lower hpos hlt hmax, + ctx.lowerFive lower hpos hlt hmax, + ctx.lowerSix lower hpos hlt hmax⟩) + phi hproper hone (by + rw [← corrZ.replacementETT.generatingColoring] + exact (sc2 G e0 _ _).refl ⟨phi, hproper, hone⟩) + obtain ⟨J, U, corrOne, hseed, hsequence, hsegment, hstrictPE, + hstrictNonPE, hMPU, baseOne, hcoreOne, hclosureOne, hsupportOne, + KOne, hzero, hstageZero, hstageLast, goodOne, hdata⟩ := + AlgorithmFiveFiveBaseStage G k e0 corrZ.replacementInput Z phi + corrZ.replacementETT hMPZ hmodZ baseZ + (by intro _; rw [hTn, hcoreZ]; exact hstrict) + (by intro _; rw [hcoreZ, hfinal]; exact hclosure) + (by rw [hTn, corrZ.rungAgreement]; exact hlarge) + (by + intro _ + rw [hcoreZ, hTn, hclosureZ] + exact ⟨hnonclosedColor, hcommon, hfour⟩) + have hJ : J = baseZ.core := by + rcases hseed with hparallel | hnonparallel + · exact hparallel.2 + · rcases hnonparallel.1 with hSE | hRE + · rw [hkind] at hSE + cases hSE + · rw [hkind] at hRE + cases hRE + rw [hJ, hcoreZ] at hsequence hsegment + have hstrictU : base.core.length < U.length := by + rw [← hcoreZ] + exact hstrictPE hkind + have hcoreOut : baseOne.core = base.core := hcoreOne.trans hcoreZ + have hclosureOut : baseOne.closure = base.closure := + hclosureOne.trans hclosureZ + have hsupportOut : baseOne.supportPosition.val = base.supportPosition.val := + hsupportOne.trans hsupportZ + rw [hTn] at hstageZero + rcases hdata with ⟨⟨hpairs, hdisjoint, hparallel⟩, hminus⟩ + rw [hTn] at hpairs + have hparallelOut := hparallel hkind + rw [hcoreZ, hTn, hclosureZ] at hparallelOut + obtain ⟨corrU, hinputU, hseriesU, hettU⟩ := + CorrespondingExtendedTashkinovTreeTransTrees G k e0 input T Z U + phi phi phi ett corrZ corrOne + refine ⟨U, corrU, ?_⟩ + -- Transport the dependent base, hierarchy, and good witness along one ETT equality. + rcases corrU with ⟨inputOut, seriesOut, ettOut, hrOut, hsOut, hcOut, + htOut, hdOut, heOut, hkOut, hpOut, hoOut, hstableOut⟩ + rcases corrOne with ⟨inputOne, seriesOne, ettOne, hrOne, hsOne, hcOne, + htOne, hdOne, heOne, hkOne, hpOne, hoOne, hstableOne⟩ + dsimp only at hinputU hettU ⊢ + cases hinputU + have hettEq : ettOut = ettOne := eq_of_heq hettU + cases hettEq + exact ⟨hMPU, hsequence, hsegment, hstrictU, baseOne, hcoreOut, + hclosureOut, hsupportOut, KOne, hzero, hstageZero, hstageLast, + goodOne, hpairs, hdisjoint, hparallelOut.1, hparallelOut.2, hminus⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelStepRootComponentSetup.lean b/LeanPool/GoldbergSeymour/ParallelStepRootComponentSetup.lean new file mode 100644 index 0000000000..acb3596e45 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelStepRootComponentSetup.lean @@ -0,0 +1,637 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Parallel Step Root Component Setup + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_continuation_239.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t : Fin rounds) (peGamma : Fin k) + (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (series.data.tree t.succ.castSucc) (TashkinovStoredColors series.data t.castSucc) + (series.data.coloring t.castSucc)), series.data.coloring t.succ = TwoColorComponentSwap G + secondStable peGamma choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G + (series.data.coloring t.succ) → TreeSequenceInitialSegment (series.data.tree + t.succ.castSucc) (series.data.tree t.succ.succ) → + let T : TreeSequence G e0 := series.data.tree t.succ.castSucc; + let X : Finset V := TreeSequenceVertexSet T; ( + ∀ v ∈ X, + ∃ (f : E), Incident G v f ∧ secondStable f = some choice.color) → peGamma ≠ choice.color → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G secondStable peGamma choice.color; ( + ∀ w ∈ X, Sum.inl w ∈ TwoColorComponent G secondStable peGamma choice.color (Sum.inl + choice.vertex) ↔ w = choice.vertex) → (H.neighborSet (Sum.inl choice.vertex)).Subsingleton + → ( + ∀ (f : E), TwoColorComponentSwap G secondStable peGamma choice.color (Sum.inl choice.vertex) f + = some peGamma ∨ TwoColorComponentSwap G secondStable peGamma choice.color (Sum.inl + choice.vertex) f = some choice.color ↔ secondStable f = some peGamma ∨ secondStable f = + some choice.color) → peGamma ≠ choice.color ∧ IsProperEdgeColoring G (series.data.coloring + t.succ) ∧ TreeSequenceInitialSegment (series.data.tree t.succ.castSucc) (series.data.tree + t.succ.succ) ∧ choice.vertex ∈ TreeSequenceVertexSet (series.data.tree t.succ.castSucc) ∧ + TwoColorPathComponent G (series.data.coloring t.succ) peGamma choice.color (Sum.inl + choice.vertex) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (series.data.tree t.succ.castSucc), Sum.inl w ∈ TwoColorComponent + G (series.data.coloring t.succ) peGamma choice.color (Sum.inl choice.vertex) ↔ w = + choice.vertex) ∧ + ∀ v ∈ TreeSequenceVertexSet (series.data.tree t.succ.castSucc), v ≠ choice.vertex → + ∃ (f : E), Sum.inr f ∈ TwoColorComponent G (series.data.coloring t.succ) peGamma choice.color + (Sum.inl v) := by + classical + intro V E _ _ _ G k rounds e0 input series t peGamma secondStable choice currentColoring + currentProper orderedExtension T X hcolorEdge hgammaNe H hrootOld rootLeaf colorPair + have graphPreserved : TwoColorIncidenceGraph G + (series.data.coloring t.succ) peGamma choice.color = H := by + rw [currentColoring] + ext x y + cases x with + | inl v => + cases y with + | inl w => simp [H, TwoColorIncidenceGraph] + | inr f => + simp only [H, TwoColorIncidenceGraph] + exact and_congr_right (fun _ => colorPair f) + | inr e => + cases y with + | inl v => + simp only [H, TwoColorIncidenceGraph] + exact and_congr_right (fun _ => colorPair e) + | inr f => simp [H, TwoColorIncidenceGraph] + have componentPreserved (z : Sum V E) : + TwoColorComponent G (series.data.coloring t.succ) + peGamma choice.color z = + TwoColorComponent G secondStable peGamma choice.color z := by + unfold TwoColorComponent + rw [graphPreserved] + refine ⟨hgammaNe, currentProper, ?_, ?_, ?_, ?_, ?_⟩ + · simpa [T] using orderedExtension + · simpa [T, X] using choice.vertexDefective.1 + · refine ⟨hgammaNe, Sum.inl choice.vertex, ?_, ?_⟩ + · change (TwoColorIncidenceGraph G (series.data.coloring t.succ) + peGamma choice.color).connectedComponentMk (Sum.inl choice.vertex) = + (TwoColorIncidenceGraph G (series.data.coloring t.succ) + peGamma choice.color).connectedComponentMk (Sum.inl choice.vertex) + rfl + · rw [graphPreserved] + exact rootLeaf + · intro w hw + rw [componentPreserved] + exact hrootOld w (by simpa [T, X] using hw) + · intro v hv hvne + obtain ⟨f, hfIncident, hfColor⟩ := + hcolorEdge v (by simpa [T, X] using hv) + have hfNotRoot : Sum.inr f ∉ + TwoColorComponent G secondStable peGamma choice.color + (Sum.inl choice.vertex) := by + intro hfRoot + have hvRoot : Sum.inl v ∈ + TwoColorComponent G secondStable peGamma choice.color + (Sum.inl choice.vertex) := by + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inl choice.vertex) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [H, TwoColorIncidenceGraph, hfIncident, hfColor])).trans + hfRoot + exact hvne ((hrootOld v (by simpa [T, X] using hv)).mp hvRoot) + have hfCurrent : series.data.coloring t.succ f = + some choice.color := by + rw [congrFun currentColoring f] + simp [TwoColorComponentSwap, hfNotRoot, hfColor] + refine ⟨f, ?_⟩ + change (TwoColorIncidenceGraph G (series.data.coloring t.succ) + peGamma choice.color).connectedComponentMk (Sum.inr f) = + (TwoColorIncidenceGraph G (series.data.coloring t.succ) + peGamma choice.color).connectedComponentMk (Sum.inl v) + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, hfIncident, hfCurrent] + +private theorem helper_continuation_253.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t : Fin rounds) (peGamma : Fin k) + (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree t.succ.castSucc) + (TashkinovStoredColors series.data t.castSucc) (series.data.coloring t.castSucc)), + TreeExit (series.data.tree t.succ.castSucc) secondStable peGamma choice.color + choice.vertex → series.data.coloring t.succ = TwoColorComponentSwap G secondStable peGamma + choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G (series.data.coloring + t.succ) → TreeSequenceInitialSegment (series.data.tree t.succ.castSucc) (series.data.tree + t.succ.succ) → + let T : TreeSequence G e0 := series.data.tree t.succ.castSucc; + let X : Finset V := TreeSequenceVertexSet T; + ∀ (_ : Fin k), ( + ∀ v ∈ X, + ∃ (f : E), Incident G v f ∧ secondStable f = some choice.color) → peGamma ∈ MissingColors G + secondStable choice.vertex → peGamma ≠ choice.color → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G secondStable peGamma choice.color; ( + ∀ (v : V), peGamma ∈ MissingColors G secondStable v ∨ choice.color ∈ MissingColors G + secondStable v → @SimpleGraph.degree (Sum V E) H (@Sum.inl V E v) (@Fintype.ofFinite + (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) H (@Sum.inl V E v))) + (@Subtype.finite (Sum V E) (@Finite.instSum V E (@Finite.of_fintype V inst) + (@Finite.of_fintype E inst_1)) (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) H (@Sum.inl V E v))))) + ≤ (1 : ℕ)) → peGamma ≠ choice.color ∧ IsProperEdgeColoring G (series.data.coloring t.succ) + ∧ TreeSequenceInitialSegment (series.data.tree t.succ.castSucc) (series.data.tree + t.succ.succ) ∧ choice.vertex ∈ TreeSequenceVertexSet (series.data.tree t.succ.castSucc) ∧ + TwoColorPathComponent G (series.data.coloring t.succ) peGamma choice.color (Sum.inl + choice.vertex) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (series.data.tree t.succ.castSucc), Sum.inl w ∈ TwoColorComponent + G (series.data.coloring t.succ) peGamma choice.color (Sum.inl choice.vertex) ↔ w = + choice.vertex) ∧ + ∀ v ∈ TreeSequenceVertexSet (series.data.tree t.succ.castSucc), v ≠ choice.vertex → + ∃ (f : E), Sum.inr f ∈ TwoColorComponent G (series.data.coloring t.succ) peGamma choice.color + (Sum.inl v) := by + classical + intro V E _ _ _ G k rounds e0 input series t peGamma secondStable secondStableProper choice + exitWitness currentColoring currentProper orderedExtension T X defectiveColor hcolorEdge + hgammaMissing hgammaNe H missingDegree + rcases exitWitness with ⟨outside, path, pathIs, pathLength, + outsideNotTree, supportInTree, outsideMissing, pathOnly⟩ + have hdegreeBound : ∀ x, + @SimpleGraph.degree _ H x (Fintype.ofFinite _) ≤ 2 := by + intro x + simpa [H] using TwoColorIncidenceDegreeAtMostTwo G secondStable + peGamma choice.color secondStableProper x + have pathClosed : ∀ x, x ∈ path.support → ∀ y, H.Adj x y → + y ∈ path.support := by + intro x hx y hxy + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hx + by_cases hn0 : n = 0 + · subst n + have hx0 : x = Sum.inl outside := by simpa using hn.symm + let : Fintype (H.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (H.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert missingDegree outside outsideMissing using 1 + cases hx0 + exact congrArg (fun z => @SimpleGraph.degree _ H + (Sum.inl outside) z) (Subsingleton.elim _ _) + have hy' : y ∈ H.neighborSet x := by + simpa [SimpleGraph.mem_neighborSet] using hxy + have hn' : path.getVert 1 ∈ H.neighborSet x := by + simpa [hx0, SimpleGraph.mem_neighborSet] using + path.adj_getVert_succ (show 0 < path.length by omega) + have heq := Fintype.card_le_one_iff.mp card + ⟨y, hy'⟩ ⟨path.getVert 1, hn'⟩ + have hey : y = path.getVert 1 := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support 1 + by_cases hlast : n = path.length + · have hx1 : x = Sum.inl choice.vertex := by + rw [← hn, pathIs.getVert_eq_end_iff hnle] + exact hlast + let : Fintype (H.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (H.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert missingDegree choice.vertex (Or.inl hgammaMissing) using 1 + cases hx1 + exact congrArg (fun z => @SimpleGraph.degree _ H + (Sum.inl choice.vertex) z) (Subsingleton.elim _ _) + have hy' : y ∈ H.neighborSet x := by + simpa [SimpleGraph.mem_neighborSet] using hxy + have hp : path.getVert (path.length - 1) ∈ H.neighborSet x := by + have ha : H.Adj (Sum.inl choice.vertex) + (path.getVert (path.length - 1)) := by + simpa [show path.length - 1 + 1 = path.length by omega] using + (path.adj_getVert_succ + (show path.length - 1 < path.length by omega)).symm + simpa [hx1, SimpleGraph.mem_neighborSet] using ha + have heq := Fintype.card_le_one_iff.mp card + ⟨y, hy'⟩ ⟨path.getVert (path.length - 1), hp⟩ + have hey : y = path.getVert (path.length - 1) := + congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support _ + have hleft : H.Adj (path.getVert n) (path.getVert (n - 1)) := by + rw [← show n - 1 + 1 = n by omega] + exact (path.adj_getVert_succ (by omega)).symm + have hnlt : n < path.length := lt_of_le_of_ne hnle hlast + have hright := path.adj_getVert_succ hnlt + by_contra hyout + rw [← hn] at hxy + have hneLeft : path.getVert (n - 1) ≠ y := by + intro h + apply hyout + rw [← h] + exact path.getVert_mem_support _ + have hneRight : path.getVert (n + 1) ≠ y := by + intro h + apply hyout + rw [← h] + exact path.getVert_mem_support _ + have hneSides : path.getVert (n - 1) ≠ path.getVert (n + 1) := by + intro h + have hi := pathIs.getVert_injOn + (show n - 1 ≤ path.length by omega) + (show n + 1 ≤ path.length by omega) h + omega + let : Fintype (H.neighborSet (path.getVert n)) := Fintype.ofFinite _ + have three : 3 ≤ @SimpleGraph.degree _ H (path.getVert n) + (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset (Sum V E) := + {y, path.getVert (n - 1), path.getVert (n + 1)} + have hs : s ⊆ H.neighborFinset (path.getVert n) := by + intro z hz + simp only [s, Finset.mem_insert, Finset.mem_singleton] at hz + rcases hz with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hxy + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc : 3 ≤ s.card := by + simp [s, hneSides, + hneLeft.symm, hneRight.symm] + exact hc.trans (Finset.card_le_card hs) + have upper : @SimpleGraph.degree _ H (path.getVert n) + (Fintype.ofFinite _) ≤ 2 := hdegreeBound (path.getVert n) + omega + have hrootOld : ∀ w : V, w ∈ X → + (Sum.inl w ∈ TwoColorComponent G secondStable peGamma + choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex) := by + intro w hw + constructor + · intro hwComponent + have reachable : H.Reachable (Sum.inl choice.vertex) (Sum.inl w) := by + change H.connectedComponentMk (Sum.inl w) = + H.connectedComponentMk (Sum.inl choice.vertex) at hwComponent + exact SimpleGraph.ConnectedComponent.eq.mp hwComponent |>.symm + have hwPath : Sum.inl w ∈ path.support := by + apply reachable.mem_subgraphVerts + (H := (⊤ : H.Subgraph).induce {x | x ∈ path.support}) + (fun x hx y hadj => + ⟨by simpa using hx, + pathClosed x (by simpa using hx) y hadj, hadj⟩) + (by simp) + exact (pathOnly w hw).mp hwPath + · rintro rfl + change H.connectedComponentMk (Sum.inl choice.vertex) = + H.connectedComponentMk (Sum.inl choice.vertex) + rfl + have rootLeaf : Set.Subsingleton + (H.neighborSet (Sum.inl choice.vertex)) := by + let : Fintype (H.neighborSet (Sum.inl choice.vertex)) := + Fintype.ofFinite _ + have hcard : Fintype.card (H.neighborSet (Sum.inl choice.vertex)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact missingDegree choice.vertex (Or.inl hgammaMissing) + intro a ha b hb + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hcard ⟨a, ha⟩ ⟨b, hb⟩) + have colorPair (f : E) : + (TwoColorComponentSwap G secondStable peGamma choice.color + (Sum.inl choice.vertex) f = some peGamma ∨ + TwoColorComponentSwap G secondStable peGamma choice.color + (Sum.inl choice.vertex) f = some choice.color) ↔ + (secondStable f = some peGamma ∨ + secondStable f = some choice.color) := by + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G secondStable peGamma choice.color + (Sum.inl choice.vertex) + · by_cases hfg : secondStable f = some peGamma + · simp [TwoColorComponentSwap, hfComponent, hfg, hgammaNe] + · by_cases hfd : secondStable f = some choice.color + · simp [TwoColorComponentSwap, hfComponent, hfd, hgammaNe] + · simp [TwoColorComponentSwap, hfComponent, hfg, hfd] + · simp [TwoColorComponentSwap, hfComponent] + exact @helper_continuation_239 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@t) (@peGamma) (@secondStable) (@choice) + (@currentColoring) (@currentProper) (@orderedExtension) (@hcolorEdge) (@hgammaNe) + (@hrootOld) (@rootLeaf) (@colorPair) +private theorem helper_branch_100.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t : Fin rounds) (support : V) (gamma delta + : Fin k), series.data.chosenVertex t.succ = some support → series.data.gamma t.succ = some + gamma → series.data.delta t.succ = some delta → + ∀ (i : Fin rounds), IsProperEdgeColoring G (series.data.coloring i.castSucc) → + IsOneEdgeUncolored (series.data.coloring i.castSucc) e0 → ColoredVertexSetClosed G + (series.data.coloring i.castSucc) (TreeSequenceVertexSet (series.data.tree + i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (series.data.coloring i.castSucc) + (TreeSequenceVertexSet (series.data.tree i.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate series.data i.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree i.succ.castSucc) + (TashkinovStoredColors series.data i.castSucc) (series.data.coloring i.castSucc)), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data i.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (series.data.tree + i.succ.castSucc))) → + ∀ (peGamma : Fin k), ParallelExtensionColor series.data i.castSucc choice.selected + choice.vertex peGamma → + ∀ (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + IsOneEdgeUncolored secondStable e0 → StableColoring (series.data.tree i.succ.castSucc) + (insert choice.color (TashkinovStoredColors series.data i.castSucc)) choice.selected + secondStable → TreeExit (series.data.tree i.succ.castSucc) secondStable peGamma + choice.color choice.vertex → series.data.coloring i.succ = TwoColorComponentSwap G + secondStable peGamma choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G + (series.data.coloring i.succ) → IsOneEdgeUncolored (series.data.coloring i.succ) e0 → + series.data.stored i.succ = { choice.color, peGamma } → series.data.connectingEdges i.succ + = { choice.edge } → series.data.kind i.succ = some TashkinovExtensionKind.PE → + series.data.chosenVertex i.succ = some choice.vertex → series.data.outsideVertex i.succ = + some choice.otherEndpoint → series.data.delta i.succ = some choice.color → + series.data.gamma i.succ = some peGamma → TashkinovClosure (series.data.coloring i.succ) + (series.data.tree i.succ.castSucc) (series.data.tree i.succ.succ) → + TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree + i.succ.succ) → (series.data.tree i.succ.castSucc).length < (series.data.tree + i.succ.succ).length → t.succ = i.succ → gamma ≠ delta ∧ IsProperEdgeColoring G + (series.data.coloring i.succ) ∧ TreeSequenceInitialSegment (series.data.tree + i.succ.castSucc) (series.data.tree i.succ.succ) ∧ support ∈ TreeSequenceVertexSet + (series.data.tree i.succ.castSucc) ∧ TwoColorPathComponent G (series.data.coloring i.succ) + gamma delta (Sum.inl support) ∧ ( + ∀ w ∈ TreeSequenceVertexSet (series.data.tree i.succ.castSucc), Sum.inl w ∈ TwoColorComponent + G (series.data.coloring i.succ) gamma delta (Sum.inl support) ↔ w = support) ∧ + ∀ v ∈ TreeSequenceVertexSet (series.data.tree i.succ.castSucc), v ≠ support → + ∃ (f : E), Sum.inr f ∈ TwoColorComponent G (series.data.coloring i.succ) gamma delta (Sum.inl + v) := by + classical + intro V E _ _ _ G k rounds e0 input series t support gamma delta htVertex htGamma htDelta i + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternativeFails peGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension hslot + have hi : i = t := by + apply Fin.ext + have h := congrArg Fin.val hslot + simp at h + omega + subst i + have hsupport : choice.vertex = support := + Option.some.inj (currentVertex.symm.trans htVertex) + have hgamma : peGamma = gamma := + Option.some.inj (currentGamma.symm.trans htGamma) + have hdelta : choice.color = delta := + Option.some.inj (currentDelta.symm.trans htDelta) + subst support + subst gamma + subst delta + let T := series.data.tree t.succ.castSucc + let X := TreeSequenceVertexSet T + let C0 := TashkinovStoredColors series.data t.castSucc + let C := insert choice.color + (TashkinovStoredColors series.data t.castSucc) + have boundaryIncident : ∀ {f : E}, f ∈ BoundaryEdges G X → + TreeIncidentEdge T f := by + intro f hf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hf + obtain ⟨v, hv, w, hw, hends⟩ := hf + exact ⟨v, hv, by simp [Incident, hends]⟩ + let previousSubtype : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨series.data.coloring t.castSucc, + previousProper, previousOneUncolored⟩ + let selectedSubtype : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨choice.selected, + choice.selectedProper, choice.selectedOneUncolored⟩ + have selectedForward : StableColoring T C0 + previousSubtype.1 selectedSubtype.1 := by + simpa [T, C0, previousSubtype, selectedSubtype] using + choice.selectedStable + have selectedReverse : StableColoring T C0 + selectedSubtype.1 previousSubtype.1 := by + exact (sc2 G e0 T C0).symm selectedForward + have selectedClosed : ColoredVertexSetClosed G choice.selected X := by + intro f c v hf hv hfc hcmissing + have hpreviousMissing : c ∈ MissingColors G + (series.data.coloring t.castSucc) v := by + rw [← choice.selectedStable.2 v (by simpa [T, X] using hv)] + exact hcmissing + have hfixed : series.data.coloring t.castSucc f = choice.selected f := by + apply selectedReverse.1 f (boundaryIncident hf) + refine ⟨c, ?_, hfc⟩ + apply Finset.mem_union_left + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, hcmissing⟩ + exact previousClosed hf hv (hfixed.trans hfc) hpreviousMissing + let secondSubtype : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨secondStable, secondStableProper, secondStableOneUncolored⟩ + have secondForward : StableColoring T C + selectedSubtype.1 secondSubtype.1 := by + simpa [T, C, selectedSubtype, secondSubtype] using + secondStableRelation + have secondReverse : StableColoring T C + secondSubtype.1 selectedSubtype.1 := by + exact (sc2 G e0 T C).symm secondForward + have secondClosed : ColoredVertexSetClosed G secondStable X := by + intro f c v hf hv hfc hcmissing + have hselectedMissing : c ∈ MissingColors G choice.selected v := by + rw [← secondStableRelation.2 v (by simpa [T, X] using hv)] + exact hcmissing + have hfixed : choice.selected f = secondStable f := by + apply secondReverse.1 f (boundaryIncident hf) + refine ⟨c, ?_, hfc⟩ + apply Finset.mem_union_left + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, hcmissing⟩ + exact selectedClosed hf hv (hfixed.trans hfc) hselectedMissing + obtain ⟨defectiveColor, defectiveColorData, hchoiceBoundaryColor⟩ := + choice.edgeDefective + have hdefectiveColor : defectiveColor = choice.color := by + have hcolor := (Finset.mem_filter.mp hchoiceBoundaryColor).2 + exact Option.some.inj (hcolor.symm.trans choice.edgeColor) + have hchoiceBoundary : choice.edge ∈ BoundaryEdges G X := by + exact (Finset.mem_filter.mp hchoiceBoundaryColor).1 + have hchoiceSecond : secondStable choice.edge = some choice.color := by + have hfixed := secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, + Finset.mem_union_right _ (Finset.mem_insert_self _ _), + choice.edgeColor⟩ + exact hfixed.trans choice.edgeColor + have hcolorPresent : ∀ v : V, v ∈ X → + choice.color ∈ PresentColors G secondStable v := by + intro v hv + have hnotMissing : choice.color ∉ MissingColors G secondStable v := + secondClosed hchoiceBoundary hv hchoiceSecond + simpa [MissingColors] using hnotMissing + have hcolorEdge : ∀ v : V, v ∈ X → + ∃ f : E, Incident G v f ∧ + secondStable f = some choice.color := by + intro v hv + simpa [PresentColors] using hcolorPresent v hv + have hgammaMissing : peGamma ∈ + MissingColors G secondStable choice.vertex := by + rw [secondStableRelation.2 choice.vertex choice.vertexDefective.1] + exact gammaRule.1 + have hgammaNe : peGamma ≠ choice.color := by + intro h + have hpresent : peGamma ∈ + PresentColors G secondStable choice.vertex := by + simpa [h] using hcolorPresent choice.vertex choice.vertexDefective.1 + have hnotPresent : peGamma ∉ + PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgammaMissing + exact hnotPresent hpresent + let H := TwoColorIncidenceGraph G secondStable peGamma choice.color + have missingDegree : + ∀ v : V, peGamma ∈ MissingColors G secondStable v ∨ choice.color ∈ MissingColors G + secondStable v → @SimpleGraph.degree _ H (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + intro v hv + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro y hy z hz + simp only [SimpleGraph.mem_neighborFinset] at hy hz + cases y with + | inl y => simp [H, TwoColorIncidenceGraph] at hy + | inr e => + cases z with + | inl z => simp [H, TwoColorIncidenceGraph] at hz + | inr f => + simp only [H, TwoColorIncidenceGraph] at hy hz + rcases hv with hv | hv + · have he : secondStable e = some choice.color := + hy.2.resolve_left (by + intro he + apply (by simpa [MissingColors] using hv) + simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨e, hy.1, he⟩) + have hf : secondStable f = some choice.color := + hz.2.resolve_left (by + intro hf + apply (by simpa [MissingColors] using hv) + simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨f, hz.1, hf⟩) + by_cases hef : e = f + · exact congrArg Sum.inr hef + · exact (secondStableProper hef ⟨v, hy.1, hz.1⟩ he hf).elim + · have he : secondStable e = some peGamma := + hy.2.resolve_right (by + intro he + apply (by simpa [MissingColors] using hv) + simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨e, hy.1, he⟩) + have hf : secondStable f = some peGamma := + hz.2.resolve_right (by + intro hf + apply (by simpa [MissingColors] using hv) + simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨f, hz.1, hf⟩) + by_cases hef : e = f + · exact congrArg Sum.inr hef + · exact (secondStableProper hef ⟨v, hy.1, hz.1⟩ he hf).elim + exact @helper_continuation_253 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@series) (@t) (@peGamma) (@secondStable) (@secondStableProper) + (@choice) (@exitWitness) (@currentColoring) (@currentProper) (@orderedExtension) + (@defectiveColor) (@hcolorEdge) (@hgammaMissing) (@hgammaNe) (@missingDegree) +theorem ParallelStepRootComponentSetup {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) + (t : Fin rounds) (support : V) (gamma delta : Fin k) + (htKind : series.data.kind t.succ = + some TashkinovExtensionKind.PE) + (htVertex : series.data.chosenVertex t.succ = some support) + (htGamma : series.data.gamma t.succ = some gamma) + (htDelta : series.data.delta t.succ = some delta) : + gamma ≠ delta ∧ + IsProperEdgeColoring G (series.data.coloring t.succ) ∧ + TreeSequenceInitialSegment + (series.data.tree t.succ.castSucc) + (series.data.tree t.succ.succ) ∧ + support ∈ + TreeSequenceVertexSet (series.data.tree t.succ.castSucc) ∧ + TwoColorPathComponent G (series.data.coloring t.succ) + gamma delta (Sum.inl support) ∧ + (∀ w : V, + w ∈ TreeSequenceVertexSet (series.data.tree t.succ.castSucc) → + (Sum.inl w ∈ TwoColorComponent G + (series.data.coloring t.succ) gamma delta + (Sum.inl support) ↔ w = support)) ∧ + ∀ v : V, + v ∈ TreeSequenceVertexSet (series.data.tree t.succ.castSucc) → + v ≠ support → + ∃ f : E, Sum.inr f ∈ TwoColorComponent G + (series.data.coloring t.succ) gamma delta (Sum.inl v) := by + classical + generalize hslot : t.succ = slot + cases series.certified slot with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero t hslot).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = t := by + apply Fin.ext + have h := congrArg Fin.val hslot + simp at h + omega + subst i + rw [currentKind] at htKind + simp at htKind + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = t := by + apply Fin.ext + have h := congrArg Fin.val hslot + simp at h + omega + subst i + rw [currentKind] at htKind + simp at htKind + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + peGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_100 V E inferInstance inferInstance inferInstance G k rounds e0 + input series t support gamma delta htVertex htGamma htDelta i previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails peGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness currentColoring + currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hslot +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean b/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean new file mode 100644 index 0000000000..62a1ebf6f7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean @@ -0,0 +1,1684 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TechnicalInductionContext +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Parallel Support Closure Properties + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation805Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : TechnicalInductionContext G k e0 ett.rounds) (hpositive : (0 : ℕ) < + ett.rounds) (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : + IsOneEdgeUncolored sigma e0) (base : HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + let P : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (_ : ( + ∀ {A B : TreeSequence G e0} {rho : PartialEdgeColoring E k} (_ : TreeSequenceInitialSegment A + B), TreeMissingColors rho A ⊆ TreeMissingColors rho B)) (hvT : v ∈ TreeSequenceVertexSet + T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : StableColoringBeforeVertex T v hvT (TashkinovStoredColors ett.series.data j.castSucc) + (ett.series.data.coloring j.castSucc) sigma ∧ ((0 : ℕ) < (↑j.castSucc : ℕ) → + StableColoring (ett.series.data.tree j.castSucc.castSucc) (TashkinovStoredColors + ett.series.data j.castSucc) (ett.series.data.coloring j.castSucc) sigma)) (_ : + TreeSequenceInitialSegment P base.closure) (_ : ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet base.closure)) (_ : (0 : ℕ) < (↑j : ℕ)), + let Tprev : TreeSequence G e0 := ett.series.data.tree j.castSucc.castSucc; + ∀ (_ : Tprev.length < P.length) (_ : TreeSequenceInitialSegment Tprev P) (seed : TreeSequence + G e0) (_ : (ett.series.data.kind j.castSucc = some TashkinovExtensionKind.PE ∧ seed = + Tprev ∨ (ett.series.data.kind j.castSucc = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind j.castSucc = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges j.castSucc = { f } ∧ TreeSequenceAdjoinEdge Tprev f + seed)) (_ : TashkinovAugmentationSequence sigma seed base.closure) (lower : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (⟨(↑j : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑j : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hround : lower.rounds = (↑j : ℕ)) (_ : MaximumProperty + lower), + let lowerTerminal : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + ∀ (_ : lower.series.data.tree lowerTerminal.castSucc = Tprev) (_ : + lower.series.data.connectingEdges lowerTerminal = ett.series.data.connectingEdges + (Fin.castLE ( + by omega + ) lowerTerminal)) (_ : lower.series.data.kind lowerTerminal = ett.series.data.kind (Fin.castLE + ( + by omega + ) lowerTerminal)) (_ : TashkinovStoredColors lower.series.data lowerTerminal = + TashkinovStoredColors ett.series.data (Fin.castLE ( + by omega + ) lowerTerminal)) (_ : lower.series.data.coloring lowerTerminal = ett.series.data.coloring + j.castSucc), ColoredVertexSetElementary G sigma (TreeSequenceVertexSet base.closure) ∧ + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet base.closure) ∧ + ∀ (alpha beta : Fin k), alpha ∈ TreeMissingColors sigma base.closure ∨ beta ∈ + TreeMissingColors sigma base.closure → TreeInterchangeable G base.closure sigma alpha beta + +private abbrev helperBranch413Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : TechnicalInductionContext G k e0 ett.rounds) (_ : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (base : HierarchyBase ett + sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + let P : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (_ : ett.series.data.chosenVertex n = some v ∧ TashkinovClosure sigma P base.closure ∧ + Nonempty (OrderedTreeUnion Tn base.closure base.core)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (_ : ( + ∀ {A B : TreeSequence G e0} {rho : PartialEdgeColoring E k} (_ : TashkinovAugmentationSequence + rho A B), TreeSequenceInitialSegment A B)) (_ : ( + ∀ {A B : TreeSequence G e0} {rho : PartialEdgeColoring E k} (_ : TreeSequenceInitialSegment A + B), TreeMissingColors rho A ⊆ TreeMissingColors rho B)) (_ : TreeSequenceInitialSegment P + Tn) (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : ETTFirstAppearanceIndex ett v hvT = (↑j : ℕ) + (1 : ℕ)) (_ : StableColoringBeforeVertex + T v hvT (TashkinovStoredColors ett.series.data j.castSucc) (ett.series.data.coloring + j.castSucc) sigma ∧ ((0 : ℕ) < (↑j.castSucc : ℕ) → StableColoring (ett.series.data.tree + j.castSucc.castSucc) (TashkinovStoredColors ett.series.data j.castSucc) + (ett.series.data.coloring j.castSucc) sigma)) (_ : ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))) (_ : (0 : ℕ) < (↑i : ℕ)), TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ))), + let Tj : TreeSequence G e0 := ett.series.data.tree j.succ.castSucc; + ∀ (_ : TreeSequenceInitialSegment Tj Tn) (_ : P.length = (↑base.supportPosition : ℕ)) (_ : + TreeSequenceInitialSegment P Tj) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring + j.castSucc) S P), TashkinovAugmentationSequence sigma S P)) (_ : + TreeSequenceInitialSegment P base.closure) (_ : ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet base.closure)) (_ : v ∈ TreeSequenceVertexSet P) (_ : (0 : ℕ) < (↑j + : ℕ)), ColoredVertexSetElementary G sigma (TreeSequenceVertexSet base.closure) ∧ + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet base.closure) ∧ + ∀ (alpha beta : Fin k), alpha ∈ TreeMissingColors sigma base.closure ∨ beta ∈ + TreeMissingColors sigma base.closure → TreeInterchangeable G base.closure sigma alpha beta + +private theorem helper_transportStep_335.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (base : + HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + let P : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (hvT : v ∈ + TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : StableColoringBeforeVertex T v hvT (TashkinovStoredColors ett.series.data j.castSucc) + (ett.series.data.coloring j.castSucc) sigma) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A P) (_ : A.length < P.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore T v hvT)) + {A B : TreeSequence G e0} (_ : TashkinovAugmentation (ett.series.data.coloring j.castSucc) + A B) (_ : TreeSequenceInitialSegment B P), TashkinovAugmentation sigma A B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma base n q Tn v P segmentTrans hvT + candidates hqmem candidatesNonempty minimum hfirstDef hfirstUpper j hsigmaBefore + segmentVertexBefore A B hstep hBP + rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ + have hAP : TreeSequenceInitialSegment A P := segmentTrans hAB hBP + have hAlen : A.length < P.length := + lt_of_lt_of_le (by omega) hBP.1 + have hcMissingSigma : c ∈ TreeMissingColors sigma A := by + unfold TreeMissingColors at hcMissing ⊢ + obtain ⟨x, hxA, hcx⟩ := Finset.mem_biUnion.mp hcMissing + refine Finset.mem_biUnion.mpr ⟨x, hxA, ?_⟩ + rw [hsigmaBefore.2 x (segmentVertexBefore hAP hAlen hxA)] + exact hcx + let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨attach, hattach⟩ := B.attaches added + let oldPosition : Fin (B.length + 1) := + Fin.castLT attach + (Nat.lt_trans attach.isLt (Nat.succ_lt_succ added.isLt)) + have holdValue : oldPosition.val < A.length + 1 := by + dsimp [oldPosition, added] + omega + let oldA : Fin (A.length + 1) := ⟨oldPosition.val, holdValue⟩ + have holdEq : B.vertex oldPosition = A.vertex oldA := by + have hcast : Fin.castLE (Nat.succ_le_succ hAB.1) oldA = + oldPosition := by + apply Fin.ext + rfl + rw [← hcast] + exact hAB.2.1 oldA + have holdBefore : B.vertex oldPosition ∈ TreeVerticesBefore T v hvT := by + rw [holdEq] + exact segmentVertexBefore hAP hAlen (by simp [TreeSequenceVertexSet]) + have holdIncident : Incident G (B.vertex oldPosition) (B.edge added) := by + unfold Incident + rw [hattach] + simp [oldPosition] + have haddedFixed : sigma (B.edge added) = + ett.series.data.coloring j.castSucc (B.edge added) := by + apply hsigmaBefore.1 (B.edge added) + ⟨B.vertex oldPosition, holdBefore, holdIncident⟩ + refine ⟨c, ?_, hcolor⟩ + apply Finset.mem_union_left + unfold TreeMissingColors at hcMissing + obtain ⟨x, hxA, hcx⟩ := Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨x, segmentVertexBefore hAP hAlen hxA, hcx⟩ + exact ⟨hlen, hAB, c, haddedFixed.trans hcolor, hcMissingSigma⟩ + +private theorem helper_hNotPrev_228.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (base : + HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + ∀ (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : ETTFirstAppearanceIndex ett v hvT = (↑j : ℕ) + (1 : ℕ)) (_ : (0 : ℕ) < (↑j : ℕ)), + let Tprev : TreeSequence G e0 := ett.series.data.tree j.castSucc.castSucc; v ∉ + TreeSequenceVertexSet Tprev := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma base n q Tn v hvT candidates hqmem + candidatesNonempty minimum hfirstDef hfirstUpper j hjFirst hjPositive Tprev hvPrev + let jp : Fin ett.rounds := ⟨j.val - 1, by omega⟩ + have hjpSucc : jp.succ = j.castSucc := by + apply Fin.ext + simp [jp] + omega + have hjpMem : jp.castSucc ∈ candidates := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + unfold ExtendedTashkinovLadderStage + rw [Fin.lastCases_castSucc] + have hindex : jp.succ.castSucc = j.castSucc.castSucc := + congrArg Fin.castSucc hjpSucc + rw [hindex] + exact hvPrev + have hle : minimum ≤ jp.castSucc := by + exact Finset.min'_le candidates jp.castSucc hjpMem + have hvals := Fin.le_iff_val_le_val.mp hle + dsimp [jp] at hvals + omega + +private theorem helper_branch_280.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (base : + HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + let P : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (_ : ( + ∀ {A B : TreeSequence G e0} {rho : PartialEdgeColoring E k} (_ : TashkinovAugmentationSequence + rho A B), TreeSequenceInitialSegment A B)) (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tj : TreeSequence G e0 := ett.series.data.tree j.succ.castSucc; + ∀ (_ : P.length = (↑base.supportPosition : ℕ)) (_ : TreeSequenceInitialSegment P Tj), + let Tprev : TreeSequence G e0 := ett.series.data.tree j.castSucc.castSucc; + ∀ (_ : Tprev.length < P.length) (ci : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree ci.succ.castSucc) (TashkinovStoredColors ett.series.data + ci.castSucc) (ett.series.data.coloring ci.castSucc)) (_ : ett.series.data.connectingEdges + ci.succ = { choice.edge }) (_ : ett.series.data.kind ci.succ = some + TashkinovExtensionKind.SE) (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge + (ett.series.data.tree ci.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure + (ett.series.data.coloring ci.succ) adjoined (ett.series.data.tree ci.succ.succ)) (_ : + j.castSucc = ci.succ), + ∃ (seed : TreeSequence G e0), (ett.series.data.kind ci.succ = some TashkinovExtensionKind.PE ∧ + seed = Tprev ∨ (ett.series.data.kind ci.succ = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind ci.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges ci.succ = { f } ∧ TreeSequenceAdjoinEdge Tprev f + seed) ∧ TashkinovAugmentationSequence (ett.series.data.coloring ci.succ) seed Tj ∧ + TreeSequenceInitialSegment seed P := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma base n q Tn v P commonPrefix + sequenceSegment hvT candidates hqmem candidatesNonempty minimum hfirstDef hfirstUpper j Tj + hPLength hPStage Tprev hPrevStrictP ci choice currentEdges currentKind adjoined + adjoinedExactly closedExtension htarget + have hciSucc : ci.succ = j.castSucc := htarget.symm + have hnext : ci.succ.succ = j.succ.castSucc := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_castSucc] + have hvals := congrArg Fin.val hciSucc + simpa using congrArg Nat.succ hvals + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring ci.succ) adjoined Tj := by + simpa only [Tj, hnext] using closedExtension.1 + have hseedStage : TreeSequenceInitialSegment adjoined Tj := + sequenceSegment hroute + have hseedLe : adjoined.length ≤ P.length := by + rcases adjoinedExactly with ⟨hlen, _, _⟩ + rw [hlen] + have hprevEq : ett.series.data.tree ci.succ.castSucc = Tprev := by + simp only [Tprev, hciSucc] + rw [hprevEq] + omega + have hseedP' : TreeSequenceInitialSegment adjoined P := + commonPrefix hseedStage hPStage hseedLe + refine ⟨adjoined, ?_, hroute, hseedP'⟩ + right + refine ⟨Or.inl ?_, choice.edge, ?_, ?_⟩ + · simpa only [hciSucc] using currentKind + · simpa only [hciSucc] using currentEdges + · simpa only [Tprev, hciSucc] using adjoinedExactly + +private theorem helper_branch_332.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (base : + HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + let P : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (_ : ( + ∀ {A B : TreeSequence G e0} {rho : PartialEdgeColoring E k} (_ : TashkinovAugmentationSequence + rho A B), TreeSequenceInitialSegment A B)) (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tj : TreeSequence G e0 := ett.series.data.tree j.succ.castSucc; + ∀ (_ : P.length = (↑base.supportPosition : ℕ)) (_ : TreeSequenceInitialSegment P Tj), + let Tprev : TreeSequence G e0 := ett.series.data.tree j.castSucc.castSucc; + ∀ (_ : Tprev.length < P.length) (ci : Fin ett.rounds) (available : + RevisitingExtensionCertificate ett.series.data ci.castSucc) (_ : + ett.series.data.connectingEdges ci.succ = { available.edge }) (_ : ett.series.data.kind + ci.succ = some TashkinovExtensionKind.RE) (adjoined : TreeSequence G e0) (_ : + TreeSequenceAdjoinEdge (ett.series.data.tree ci.succ.castSucc) available.edge adjoined) (_ + : TashkinovClosure (ett.series.data.coloring ci.succ) adjoined (ett.series.data.tree + ci.succ.succ)) (_ : j.castSucc = ci.succ), + ∃ (seed : TreeSequence G e0), (ett.series.data.kind ci.succ = some TashkinovExtensionKind.PE ∧ + seed = Tprev ∨ (ett.series.data.kind ci.succ = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind ci.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges ci.succ = { f } ∧ TreeSequenceAdjoinEdge Tprev f + seed) ∧ TashkinovAugmentationSequence (ett.series.data.coloring ci.succ) seed Tj ∧ + TreeSequenceInitialSegment seed P := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma base n q Tn v P commonPrefix + sequenceSegment hvT candidates hqmem candidatesNonempty minimum hfirstDef hfirstUpper j Tj + hPLength hPStage Tprev hPrevStrictP ci available currentEdges currentKind adjoined + adjoinedExactly closedExtension htarget + have hciSucc : ci.succ = j.castSucc := htarget.symm + have hnext : ci.succ.succ = j.succ.castSucc := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_castSucc] + have hvals := congrArg Fin.val hciSucc + simpa using congrArg Nat.succ hvals + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring ci.succ) adjoined Tj := by + simpa only [Tj, hnext] using closedExtension.1 + have hseedStage : TreeSequenceInitialSegment adjoined Tj := + sequenceSegment hroute + have hseedLe : adjoined.length ≤ P.length := by + rcases adjoinedExactly with ⟨hlen, _, _⟩ + rw [hlen] + have hprevEq : ett.series.data.tree ci.succ.castSucc = Tprev := by + simp only [Tprev, hciSucc] + rw [hprevEq] + omega + have hseedP' : TreeSequenceInitialSegment adjoined P := + commonPrefix hseedStage hPStage hseedLe + refine ⟨adjoined, ?_, hroute, hseedP'⟩ + right + refine ⟨Or.inr ?_, available.edge, ?_, ?_⟩ + · simpa only [hciSucc] using currentKind + · simpa only [hciSucc] using currentEdges + · simpa only [Tprev, hciSucc] using adjoinedExactly + +private theorem helper_branch_490.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (base : + HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + let P : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tj : TreeSequence G e0 := ett.series.data.tree j.succ.castSucc; + let Tprev : TreeSequence G e0 := ett.series.data.tree j.castSucc.castSucc; + ∀ (_ : TreeSequenceInitialSegment Tprev P) (ci : Fin ett.rounds) (_ : ett.series.data.kind + ci.succ = some TashkinovExtensionKind.PE) (_ : TashkinovClosure (ett.series.data.coloring + ci.succ) (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : + j.castSucc = ci.succ), + ∃ (seed : TreeSequence G e0), (ett.series.data.kind ci.succ = some TashkinovExtensionKind.PE ∧ + seed = Tprev ∨ (ett.series.data.kind ci.succ = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind ci.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges ci.succ = { f } ∧ TreeSequenceAdjoinEdge Tprev f + seed) ∧ TashkinovAugmentationSequence (ett.series.data.coloring ci.succ) seed Tj ∧ + TreeSequenceInitialSegment seed P := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma base n q Tn v P hvT candidates hqmem + candidatesNonempty minimum hfirstDef hfirstUpper j Tj Tprev hPrevP ci currentKind + closedExtension htarget + have hciSucc : ci.succ = j.castSucc := htarget.symm + have hnext : ci.succ.succ = j.succ.castSucc := by + apply Fin.ext + simp only [Fin.val_succ, Fin.val_castSucc] + have hvals := congrArg Fin.val hciSucc + simpa using congrArg Nat.succ hvals + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring ci.succ) Tprev Tj := by + have hroute' := closedExtension.1 + rw [hnext] at hroute' + simpa only [Tprev, Tj, hciSucc] using hroute' + refine ⟨Tprev, ?_, hroute, hPrevP⟩ + left + exact ⟨by simpa only [hciSucc] using currentKind, rfl⟩ + +private theorem helper_hEligibilityLower_608.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (base : + HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + ∀ (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tprev : TreeSequence G e0 := ett.series.data.tree j.castSucc.castSucc; + ∀ (seed : TreeSequence G e0) (_ : (ett.series.data.kind j.castSucc = some + TashkinovExtensionKind.PE ∧ seed = Tprev ∨ (ett.series.data.kind j.castSucc = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind j.castSucc = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E), ett.series.data.connectingEdges j.castSucc = { f } ∧ TreeSequenceAdjoinEdge Tprev f + seed)) (_ : TashkinovAugmentationSequence sigma seed base.closure) (lower : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (⟨(↑j : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑j : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), + let lowerTerminal : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + ∀ (_ : lower.series.data.tree lowerTerminal.castSucc = Tprev) (_ : lower.series.data.kind + lowerTerminal = ett.series.data.kind j.castSucc) (_ : lower.series.data.connectingEdges + lowerTerminal = ett.series.data.connectingEdges j.castSucc), lower.series.data.kind + lowerTerminal = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence sigma + (lower.series.data.tree lowerTerminal.castSucc) base.closure ∨ (lower.series.data.kind + lowerTerminal = some TashkinovExtensionKind.SE ∨ lower.series.data.kind lowerTerminal = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed' : TreeSequence G e0), lower.series.data.connectingEdges lowerTerminal = { f } + ∧ TreeSequenceAdjoinEdge (lower.series.data.tree lowerTerminal.castSucc) f seed' ∧ + TashkinovAugmentationSequence sigma seed' base.closure := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma base n q Tn v hvT candidates hqmem + candidatesNonempty minimum hfirstDef hfirstUpper j Tprev seed hEligibility + hrouteSigmaClosure lower lowerTerminal htreeLower hkindLower' hconnectingLower' + rcases hEligibility with hparallelSeed | hnonparallelSeed + · left + refine ⟨hkindLower'.trans hparallelSeed.1, ?_⟩ + rw [htreeLower] + simpa only [hparallelSeed.2] using hrouteSigmaClosure + · right + rcases hnonparallelSeed with ⟨hkind, f, hedgeSet, hadjoin⟩ + refine ⟨?_, f, seed, ?_, ?_, hrouteSigmaClosure⟩ + · rcases hkind with hse | hre + · exact Or.inl (hkindLower'.trans hse) + · exact Or.inr (hkindLower'.trans hre) + · exact hconnectingLower'.trans hedgeSet + · rw [htreeLower] + exact hadjoin + +private theorem helper_hselfStable_659.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (base : HierarchyBase ett + sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + ∀ (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + ∀ (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (⟨(↑j : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑j : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 lower + sigma base.closure), + let replacementTerminal : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last + corr.replacementETT.rounds; + let L : TreeSequence G e0 := corr.replacementETT.series.data.tree (Fin.last + (corr.replacementETT.rounds + (1 : ℕ))); StableColoring L (TashkinovStoredColors + corr.replacementETT.series.data replacementTerminal) + (corr.replacementETT.series.data.coloring replacementTerminal) sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma hproper hone base n q Tn v hvT + candidates hqmem candidatesNonempty minimum hfirstDef hfirstUpper j lower corr + replacementTerminal L + have hgenerating : sigma = + corr.replacementETT.series.data.coloring replacementTerminal := by + simpa [replacementTerminal] using + corr.replacementETT.generatingColoring + rw [← hgenerating] + let a : {rho : PartialEdgeColoring E k // + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0} := + ⟨sigma, hproper, hone⟩ + have hrefl := (sc2 G e0 L + (TashkinovStoredColors corr.replacementETT.series.data + replacementTerminal)).refl a + simpa [a] using hrefl + +private theorem helper_hinterchangeable_678.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : TechnicalInductionContext G k e0 ett.rounds) (hpositive : (0 : ℕ) < + ett.rounds) (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : + IsOneEdgeUncolored sigma e0) (base : HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + ∀ (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (_ : ( + ∀ {A B : TreeSequence G e0} {rho : PartialEdgeColoring E k} (_ : TreeSequenceInitialSegment A + B), TreeMissingColors rho A ⊆ TreeMissingColors rho B)) (hvT : v ∈ TreeSequenceVertexSet + T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + ∀ (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (⟨(↑j : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑j : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 lower + sigma base.closure) (_ : MaximumProperty corr.replacementETT) (_ : (0 : ℕ) < + corr.replacementETT.rounds) (_ : corr.replacementETT.rounds < ett.rounds), + let replacementTerminal : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last + corr.replacementETT.rounds; + let L : TreeSequence G e0 := corr.replacementETT.series.data.tree (Fin.last + (corr.replacementETT.rounds + (1 : ℕ))); + ∀ (_ : StableColoring L (TashkinovStoredColors corr.replacementETT.series.data + replacementTerminal) (corr.replacementETT.series.data.coloring replacementTerminal) sigma) + (_ : TreeSequenceInitialSegment base.closure L) (alpha beta : Fin k) (_ : alpha ∈ + TreeMissingColors sigma base.closure ∨ beta ∈ TreeMissingColors sigma base.closure), + TreeInterchangeable G base.closure sigma alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hpositive sigma hproper hone base n q Tn v + vertexTransfer missingTransfer hvT candidates hqmem candidatesNonempty minimum hfirstDef + hfirstUpper j lower corr hreplacementMP hreplacementPositive hreplacementBefore + replacementTerminal L hselfStable hclosureL alpha beta hmissing + have hmissingL : alpha ∈ TreeMissingColors sigma L ∨ + beta ∈ TreeMissingColors sigma L := by + rcases hmissing with ha | hb + · exact Or.inl (missingTransfer hclosureL ha) + · exact Or.inr (missingTransfer hclosureL hb) + have hinterL : TreeInterchangeable G L sigma alpha beta := by + have h := ctx.lowerTwo corr.replacementETT hreplacementPositive + hreplacementBefore hreplacementMP sigma hproper hone + (by simpa [replacementTerminal, L] using hselfStable) + alpha beta (by simpa [L] using hmissingL) + simpa [L] using h + unfold TreeInterchangeable at hinterL ⊢ + intro z w hz hw hzMeet hwMeet + apply hinterL z w hz hw + · obtain ⟨x, hx, hxComponent⟩ := hzMeet + exact ⟨x, vertexTransfer hclosureL hx, hxComponent⟩ + · obtain ⟨x, hx, hxComponent⟩ := hwMeet + exact ⟨x, vertexTransfer hclosureL hx, hxComponent⟩ + +private theorem helper_continuation_805.{u_1, u_2} : + helperContinuation805Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hpositive sigma hproper hone base n q Tn v P + segmentTrans vertexTransfer missingTransfer hvT candidates hqmem candidatesNonempty minimum + hfirstDef hfirstUpper j hcurrent hPClosure hclosed hjPositive Tprev hPrevStrictP hPrevP + seed hEligibility hrouteSigmaClosure lower hround hlowerMP lowerTerminal htreeLower + hconnectingLower hkindLower hstoredLower hcolorLower' + have hstoredLower' : TashkinovStoredColors lower.series.data + lowerTerminal = TashkinovStoredColors ett.series.data j.castSucc := by + calc + TashkinovStoredColors lower.series.data lowerTerminal = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) lowerTerminal) := hstoredLower + _ = TashkinovStoredColors ett.series.data j.castSucc := by + congr 1 + apply Fin.ext + simp [lowerTerminal, hround] + have hkindLower' : lower.series.data.kind lowerTerminal = + ett.series.data.kind j.castSucc := by + calc + lower.series.data.kind lowerTerminal = + ett.series.data.kind (Fin.castLE (by omega) lowerTerminal) := + hkindLower + _ = ett.series.data.kind j.castSucc := by + congr 1 + apply Fin.ext + simp [lowerTerminal, hround] + have hconnectingLower' : lower.series.data.connectingEdges lowerTerminal = + ett.series.data.connectingEdges j.castSucc := by + calc + lower.series.data.connectingEdges lowerTerminal = + ett.series.data.connectingEdges + (Fin.castLE (by omega) lowerTerminal) := hconnectingLower + _ = ett.series.data.connectingEdges j.castSucc := by + congr 1 + apply Fin.ext + simp [lowerTerminal, hround] + have hstableLower : StableColoring + (lower.series.data.tree lowerTerminal.castSucc) + (TashkinovStoredColors lower.series.data lowerTerminal) + (lower.series.data.coloring lowerTerminal) sigma := by + rw [htreeLower, hstoredLower', hcolorLower'] + simpa [Tprev] using hcurrent.2 (by simpa using hjPositive) + have hmod : ModColoring lower sigma := + ctx.lowerSix lower (by omega) (by omega) hlowerMP sigma hproper hone + (by simpa [lowerTerminal] using hstableLower) + have hPrevClosure : TreeSequenceInitialSegment Tprev base.closure := + segmentTrans hPrevP hPClosure + have hLowerTerminalClosure : TreeSequenceInitialSegment + (lower.series.data.tree lowerTerminal.castSucc) base.closure := by + rw [htreeLower] + exact hPrevClosure + have hLowerStrict : + (lower.series.data.tree lowerTerminal.castSucc).length < + base.closure.length := by + rw [htreeLower] + exact lt_of_lt_of_le hPrevStrictP hPClosure.1 + have hEligibilityLower := @helper_hEligibilityLower_608 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett hpositive sigma base hvT hqmem hfirstDef + hfirstUpper seed hEligibility hrouteSigmaClosure lower htreeLower hkindLower' + hconnectingLower' + obtain ⟨corr⟩ : Nonempty + (CorrespondingExtendedTashkinovTree G k e0 lower sigma base.closure) := + hmod.2.2 base.closure + (by simpa [lowerTerminal] using hLowerTerminalClosure) + (by simpa [lowerTerminal] using hLowerStrict) + (by simpa [lowerTerminal] using hEligibilityLower) + have hreplacementMP : MaximumProperty corr.replacementETT := + MaximumPropertyTransport G k e0 lower sigma hmod base.closure corr + hlowerMP + have hreplacementPositive : 0 < corr.replacementETT.rounds := by + exact corr.replacementETT.roundsPositive + have hreplacementBefore : corr.replacementETT.rounds < ett.rounds := by + rw [corr.rungAgreement, hround] + exact j.isLt + have helementary : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet base.closure) := + ctx.lowerOne corr.replacementETT hreplacementPositive + hreplacementBefore hreplacementMP + let replacementTerminal : Fin (corr.replacementETT.rounds + 1) := + Fin.last corr.replacementETT.rounds + let L : TreeSequence G e0 := + corr.replacementETT.series.data.tree + (Fin.last (corr.replacementETT.rounds + 1)) + have hselfStable := @helper_hselfStable_659 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett hpositive sigma hproper hone base hvT hqmem hfirstDef + hfirstUpper lower corr + have hclosureL : TreeSequenceInitialSegment base.closure L := by + simpa [L] using corr.replacementETT.belowFinal + have hinterchangeable := @helper_hinterchangeable_678 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett ctx hpositive sigma hproper hone base + vertexTransfer missingTransfer hvT hqmem hfirstDef hfirstUpper lower corr hreplacementMP + hreplacementPositive hreplacementBefore hselfStable hclosureL + exact ⟨helementary, hclosed, hinterchangeable⟩ + +private theorem helper_branch_413.{u_1, u_2} : + helperBranch413Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hMP hpositive sigma hproper hone base n q Tn v P + hparallel segmentTrans commonPrefix vertexTransfer sequenceSegment missingTransfer hP_Tn + hvT candidates hqmem candidatesNonempty minimum hfirstDef hfirstUpper j hjFirst hcurrent + stepSegment Tj hStageTn hPLength hPStage transportRoute hPClosure hclosed hvP hjPositive + let Tprev : TreeSequence G e0 := + ett.series.data.tree j.castSucc.castSucc + have hPrevStage : TreeSequenceInitialSegment Tprev Tj := by + have hseg := stepSegment j.castSucc (by simpa using hjPositive) + change TreeSequenceInitialSegment + (ett.series.data.tree j.castSucc.castSucc) + (ett.series.data.tree j.succ.castSucc) + convert hseg using 1; congr 1 + have hNotPrev := @helper_hNotPrev_228 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett hpositive sigma base hvT hqmem hfirstDef hfirstUpper hjFirst hjPositive + have hPrevTn : TreeSequenceInitialSegment Tprev Tn := + segmentTrans hPrevStage hStageTn + have hPrevStrictP : Tprev.length < P.length := by + by_contra hnot + have hPPrev : TreeSequenceInitialSegment P Tprev := + commonPrefix hP_Tn hPrevTn (by omega) + exact hNotPrev (vertexTransfer hPPrev hvP) + have hPrevP : TreeSequenceInitialSegment Tprev P := + commonPrefix hPrevStage hPStage (Nat.le_of_lt hPrevStrictP) + obtain ⟨seed, hEligibility, hrouteOld, hseedP⟩ : + ∃ seed : TreeSequence G e0, + ((ett.series.data.kind j.castSucc = + some TashkinovExtensionKind.PE ∧ seed = Tprev) ∨ + ((ett.series.data.kind j.castSucc = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind j.castSucc = + some TashkinovExtensionKind.RE) ∧ + ∃ f : E, ett.series.data.connectingEdges j.castSucc = {f} ∧ + TreeSequenceAdjoinEdge Tprev f seed)) ∧ + TashkinovAugmentationSequence + (ett.series.data.coloring j.castSucc) seed Tj ∧ + TreeSequenceInitialSegment seed P := by + have hcert := ett.series.certified j.castSucc + generalize htarget : j.castSucc = target at hcert + cases hcert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hvals := congrArg Fin.val htarget + simp at hvals + omega + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_280 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett hpositive sigma base commonPrefix sequenceSegment hvT + hqmem hfirstDef hfirstUpper hPLength hPStage hPrevStrictP ci choice currentEdges + currentKind adjoined adjoinedExactly closedExtension htarget + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_490 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett hpositive sigma base hvT hqmem hfirstDef hfirstUpper + hPrevP ci currentKind closedExtension htarget + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_332 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett hpositive sigma base commonPrefix sequenceSegment hvT + hqmem hfirstDef hfirstUpper hPLength hPStage hPrevStrictP ci available + currentEdges currentKind adjoined adjoinedExactly closedExtension htarget + have hrouteOldP : TashkinovAugmentationSequence + (ett.series.data.coloring j.castSucc) seed P := + TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring j.castSucc) seed P Tj + hrouteOld hseedP hPStage + have hrouteSigmaP : TashkinovAugmentationSequence sigma seed P := + transportRoute seed hrouteOldP + have hrouteSigmaClosure : TashkinovAugmentationSequence + sigma seed base.closure := + Relation.ReflTransGen.trans hrouteSigmaP hparallel.2.1.1 + have hclosureSeed : TashkinovClosure sigma seed base.closure := + ⟨hrouteSigmaClosure, hclosed⟩ + obtain ⟨lower, hround, hlowerMP, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T phi ett hMP j.val + (by omega) (by exact j.isLt) + let lowerTerminal : Fin (lower.rounds + 1) := Fin.last lower.rounds + have htreeLower : lower.series.data.tree lowerTerminal.castSucc = + Tprev := by + calc + lower.series.data.tree lowerTerminal.castSucc = + ett.series.data.tree + (Fin.castLE (by omega) lowerTerminal.castSucc) := + htrees lowerTerminal.castSucc + _ = Tprev := by + change ett.series.data.tree _ = + ett.series.data.tree j.castSucc.castSucc + congr 1 + apply Fin.ext + simp [lowerTerminal, hround] + obtain ⟨hcolorLower, hstoredRawLower, hconnectingLower, + hkindLower, hchosenLower, houtsideLower, hdeltaLower, hgammaLower, + hstoredLower, hcertLower⟩ := hdata lowerTerminal + have hcolorLower' : lower.series.data.coloring lowerTerminal = + ett.series.data.coloring j.castSucc := by + calc + lower.series.data.coloring lowerTerminal = + ett.series.data.coloring (Fin.castLE (by omega) lowerTerminal) := + hcolorLower + _ = ett.series.data.coloring j.castSucc := by + congr 1 + apply Fin.ext + simp [lowerTerminal, hround] + exact @helper_continuation_805 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett ctx hpositive sigma hproper hone base segmentTrans vertexTransfer + missingTransfer hvT hqmem hfirstDef hfirstUpper hcurrent hPClosure hclosed hjPositive + hPrevStrictP hPrevP seed hEligibility hrouteSigmaClosure lower hround hlowerMP htreeLower + hconnectingLower hkindLower hstoredLower hcolorLower' +private theorem helper_branch_742.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (base : HierarchyBase ett + sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + let P : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (_ : ett.series.data.chosenVertex n = some v ∧ TashkinovClosure sigma P base.closure ∧ + Nonempty (OrderedTreeUnion Tn base.closure base.core)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (_ : ( + ∀ {A B : TreeSequence G e0} {rho : PartialEdgeColoring E k} (_ : TashkinovAugmentationSequence + rho A B), TreeSequenceInitialSegment A B)) (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : ETTFirstAppearanceIndex ett v hvT = (↑j : ℕ) + (1 : ℕ)), + let Tj : TreeSequence G e0 := ett.series.data.tree j.succ.castSucc; + ∀ (_ : P.length = (↑base.supportPosition : ℕ)) (_ : TreeSequenceInitialSegment P Tj) (_ : ( + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence (ett.series.data.coloring + j.castSucc) S P), TashkinovAugmentationSequence sigma S P)) (_ : ColoredVertexSetClosed G + sigma (TreeSequenceVertexSet base.closure)) (_ : ¬(0 : ℕ) < (↑j : ℕ)), + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet base.closure) ∧ + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet base.closure) ∧ + ∀ (alpha beta : Fin k), alpha ∈ TreeMissingColors sigma base.closure ∨ beta ∈ + TreeMissingColors sigma base.closure → TreeInterchangeable G base.closure sigma alpha beta + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma hproper hone base n q Tn v P hparallel + commonPrefix sequenceSegment hvT candidates hqmem candidatesNonempty minimum hfirstDef + hfirstUpper j hjFirst Tj hPLength hPStage transportRoute hclosed hjPositive + have hjZero : j.val = 0 := by omega + have hjZeroIndex : j.castSucc = (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + simpa using hjZero + have hTjOne : Tj = ett.series.data.tree + (1 : Fin (ett.rounds + 2)) := by + change ett.series.data.tree j.succ.castSucc = + ett.series.data.tree (1 : Fin (ett.rounds + 2)) + congr 1 + apply Fin.ext + simp only [Fin.castSucc_succ, Fin.val_succ, Fin.val_castSucc, Fin.coe_ofNat_eq_mod, Nat.one_mod, + Nat.add_eq_right] + exact hjZero + have hcert := ett.series.certified j.castSucc + generalize htarget : j.castSucc = target at hcert + cases hcert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + let seed : TreeSequence G e0 := ett.series.data.tree 0 + have hrouteOld : TashkinovAugmentationSequence + (ett.series.data.coloring j.castSucc) seed Tj := by + simpa only [seed, hjZeroIndex, hTjOne] using initialClosure.1 + have hseedStage : TreeSequenceInitialSegment seed Tj := + sequenceSegment hrouteOld + have hseedLe : seed.length ≤ P.length := by + have hseedLength : seed.length = 1 := by + simpa only [seed] using seedLength + rw [hseedLength, hPLength] + exact base.supportPositive + have hseedP : TreeSequenceInitialSegment seed P := + commonPrefix hseedStage hPStage hseedLe + have hrouteOldP : TashkinovAugmentationSequence + (ett.series.data.coloring j.castSucc) seed P := + TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring j.castSucc) seed P Tj + hrouteOld hseedP hPStage + have hrouteSigmaP : TashkinovAugmentationSequence sigma seed P := + transportRoute seed hrouteOldP + have hrouteSigmaClosure : TashkinovAugmentationSequence + sigma seed base.closure := + Relation.ReflTransGen.trans hrouteSigmaP hparallel.2.1.1 + have hclosureSigma : TashkinovClosure sigma seed base.closure := + ⟨hrouteSigmaClosure, hclosed⟩ + let zeroData : TashkinovSeriesData G k 0 e0 := { + tree := Fin.cases seed (fun _ => base.closure) + coloring := fun _ => sigma + stored := fun _ => ∅ + connectingEdges := fun _ => ∅ + kind := fun _ => none + chosenVertex := fun _ => none + outsideVertex := fun _ => none + delta := fun _ => none + gamma := fun _ => none } + have htripleSigma : KTriple G k e0 sigma := + ⟨triple.1, triple.2.1, triple.2.2.1, hproper, hone⟩ + let zeroSeries : TashkinovSeries G k 0 e0 sigma := { + data := zeroData + certified := by + intro i + have hi : i = 0 := Fin.eq_zero i + subst i + exact TashkinovSeriesStep.initial htripleSigma + (by simpa [zeroData, seed] using seedLength) + rfl rfl rfl rfl rfl rfl rfl rfl hclosureSigma } + have htreeOne : zeroSeries.data.tree (1 : Fin 2) = + base.closure := by + rfl + have htechnical := TechnicalTheoremBase G k 0 e0 sigma zeroSeries + have helementary : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet base.closure) := by + rw [← htreeOne] + exact htechnical.1 + have hselfStable : StableColoring base.closure + (TashkinovStoredColors zeroSeries.data (0 : Fin 1)) + (zeroSeries.data.coloring 0) sigma := by + have hstoredZero : TashkinovStoredColors zeroSeries.data + (0 : Fin 1) = ∅ := by + simp [TashkinovStoredColors] + have hcolorZero : zeroSeries.data.coloring (0 : Fin 1) = sigma := by + rfl + rw [hstoredZero, hcolorZero] + let a : {rho : PartialEdgeColoring E k // + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0} := + ⟨sigma, hproper, hone⟩ + have hrefl := (sc2 G e0 base.closure (∅ : Finset (Fin k))).refl a + simpa [a] using hrefl + have hinterchangeable : + ∀ alpha beta : Fin k, (alpha ∈ TreeMissingColors sigma base.closure ∨ beta ∈ TreeMissingColors + sigma base.closure) → TreeInterchangeable G base.closure sigma alpha beta := by + intro alpha beta hmissing + have h := htechnical.2 sigma hproper hone + (by simpa [htreeOne] using hselfStable) alpha beta + (by simpa [htreeOne] using hmissing) + simpa [htreeOne] using h + exact ⟨helementary, hclosed, hinterchangeable⟩ + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val htarget + simp at hvals + omega + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val htarget + simp at hvals + omega + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val htarget + simp at hvals + omega + +private theorem helper_stageToStage_923.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (_ : + IsOneEdgeUncolored sigma e0) (base : HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + ∀ (_ : ( + ∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A A)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (hvT : v ∈ + TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (_ : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (_ : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)) (_ : ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))) (_ : (0 : ℕ) < (↑i : ℕ)), TreeSequenceInitialSegment + (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ))) (a b : ℕ) (_ : (1 : ℕ) ≤ + a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), TreeSequenceInitialSegment (ett.series.data.tree + (⟨a, Decidable.byContradiction fun (a_1 : ¬a < ett.rounds + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, Decidable.byContradiction fun (a_1 + : ¬b < ett.rounds + (2 : ℕ)) ↦ + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma hone base n q Tn v segmentRefl + segmentTrans hvT candidates hqmem candidatesNonempty minimum hfirstDef hfirstUpper + stepSegment a b ha hab hb + have chain : ∀ (d : ℕ) (_hd : a + d ≤ b), + TreeSequenceInitialSegment + (ett.series.data.tree ⟨a, by omega⟩) + (ett.series.data.tree ⟨a + d, by omega⟩) := by + intro d hd + induction d with + | zero => + simpa using segmentRefl (ett.series.data.tree ⟨a, by omega⟩) + | succ d ih => + have hprev := ih (by omega) + let idx : Fin (ett.rounds + 1) := ⟨a + d, by omega⟩ + have hone := stepSegment idx (by dsimp [idx]; omega) + have hone' : TreeSequenceInitialSegment + (ett.series.data.tree ⟨a + d, by omega⟩) + (ett.series.data.tree ⟨a + (d + 1), by omega⟩) := by + simpa [idx, Nat.add_assoc] using hone + exact segmentTrans hprev hone' + have hchain := chain (b - a) (by omega) + convert hchain using 1; congr 1; apply Fin.ext; simp; omega + +private theorem helper_commonPrefix_1011.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B + C → A.length ≤ B.length → TreeSequenceInitialSegment A B := by + classical + intro V E G e0 A B C hAC hBC hlen + rcases hAC with ⟨hACLen, hACVertices, hACEdges⟩ + rcases hBC with ⟨hBCLen, hBCVertices, hBCEdges⟩ + refine ⟨hlen, ?_, ?_⟩ + · intro i + calc + B.vertex (Fin.castLE (Nat.succ_le_succ hlen) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hBCLen) + (Fin.castLE (Nat.succ_le_succ hlen) i)) := + (hBCVertices _).symm + _ = C.vertex (Fin.castLE (Nat.succ_le_succ hACLen) i) := by + congr 1 + _ = A.vertex i := hACVertices i + · intro i + calc + B.edge (Fin.castLE hlen i) = + C.edge (Fin.castLE hBCLen (Fin.castLE hlen i)) := + (hBCEdges _).symm + _ = C.edge (Fin.castLE hACLen i) := by congr 1 + _ = A.edge i := hACEdges i + +private theorem helper_hvStage_1145.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (base : + HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + ∀ (hvT : v ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (hfirstDef : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (hfirstUpper : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)), + let j : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvT - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ETTFirstAppearanceIndex ett v hvT - (1 : ℕ) < + ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : ETTFirstAppearanceIndex ett v hvT = (↑j : ℕ) + (1 : ℕ)), + let Tj : TreeSequence G e0 := ett.series.data.tree j.succ.castSucc; v ∈ TreeSequenceVertexSet + Tj := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma base n q Tn v hvT candidates hqmem + candidatesNonempty minimum hfirstDef hfirstUpper j hjFirst Tj + rw [hfirstDef] at hjFirst + change v ∈ TreeSequenceVertexSet + (ett.series.data.tree j.succ.castSucc) + have hminVal : minimum.val = j.val := by omega + have hminEq : minimum = j.castSucc := by + apply Fin.ext + exact hminVal + have hminimumMember : minimum ∈ candidates := by + exact Finset.min'_mem candidates candidatesNonempty + have hjMember : j.castSucc ∈ candidates := by + rw [← hminEq] + exact hminimumMember + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + at hjMember + simpa [ExtendedTashkinovLadderStage, Fin.lastCases_castSucc] using + hjMember + +private theorem helper_segmentVertexBefore_1187.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (base : + HierarchyBase ett sigma), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let v : V := Tn.vertex base.supportPosition; + let P : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt); + ∀ (_ : TreeSequenceInitialSegment Tn T) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (_ : TreeSequenceInitialSegment P T) (hvT : v ∈ + TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | v ∈ + TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : q.castSucc ∈ candidates), + let candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem; + let minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty; + ∀ (_ : ETTFirstAppearanceIndex ett v hvT = (↑minimum : ℕ) + (1 : ℕ)) (_ : + ETTFirstAppearanceIndex ett v hvT ≤ (↑q : ℕ) + (1 : ℕ)) (_ : P.length = + (↑base.supportPosition : ℕ)) {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A P) + (_ : A.length < P.length) {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ + TreeVerticesBefore T v hvT := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma base n q Tn v P hTnT segmentTrans + vertexTransfer hP_T hvT candidates hqmem candidatesNonempty minimum hfirstDef hfirstUpper + hPLength A hAP hAlen x hxA + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hxA + obtain ⟨i, rfl⟩ := hxA + unfold TreeVerticesBefore + apply Finset.mem_filter.mpr + let iP : Fin (P.length + 1) := + Fin.castLE (Nat.succ_le_succ hAP.1) i + let iT : Fin (T.length + 1) := + Fin.castLE (Nat.succ_le_succ hP_T.1) iP + let vT : Fin (T.length + 1) := + Fin.castLE (Nat.succ_le_succ hTnT.1) base.supportPosition + refine ⟨vertexTransfer (segmentTrans hAP hP_T) (by + simp [TreeSequenceVertexSet]), iT, vT, ?_, ?_, ?_⟩ + · exact (hP_T.2.1 iP).trans (hAP.2.1 i) + · exact hTnT.2.1 base.supportPosition + · change i.val < base.supportPosition.val + rw [← hPLength] + omega + +private theorem helper_continuation_1407.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : TechnicalInductionContext G k e0 ett.rounds) (_ : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) (_ : ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE) (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G + sigma) (_ : IsOneEdgeUncolored sigma e0) (_ : StableColoring (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds)) phi sigma) (base : HierarchyBase ett sigma) (_ : ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = (Fin.last ett.rounds : Fin (ett.rounds + (1 : + ℕ)))) (_ : ett.series.data.chosenVertex (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))) + = some ((ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc + : TreeSequence G e0).vertex base.supportPosition : V) ∧ TashkinovClosure sigma + (TreeSequencePrefix (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : + ℕ))).castSucc : TreeSequence G e0) (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt) : TreeSequence G e0) base.closure ∧ Nonempty + (OrderedTreeUnion (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : + ℕ))).castSucc : TreeSequence G e0) base.closure base.core)) (_ : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + + (1 : ℕ))).castSucc : TreeSequence G e0) T) (_ : ( + ∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A A)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (_ : ( + ∀ {A B : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B), TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B)) (_ : ( + ∀ {A B : TreeSequence G e0} {rho : PartialEdgeColoring E k} (_ : TashkinovAugmentationSequence + rho A B), TreeSequenceInitialSegment A B)) (_ : ( + ∀ {A B : TreeSequence G e0} {rho : PartialEdgeColoring E k} (_ : TreeSequenceInitialSegment A + B), TreeMissingColors rho A ⊆ TreeMissingColors rho B)) (_ : TreeSequenceInitialSegment + (TreeSequencePrefix (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : + ℕ))).castSucc : TreeSequence G e0) (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt) : TreeSequence G e0) (ett.series.data.tree + (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc : TreeSequence G e0)) (_ : + TreeSequenceInitialSegment (TreeSequencePrefix (ett.series.data.tree (Fin.last ett.rounds + : Fin (ett.rounds + (1 : ℕ))).castSucc : TreeSequence G e0) (↑base.supportPosition : ℕ) + base.supportPositive (Nat.le_of_lt_succ base.supportPosition.isLt) : TreeSequence G e0) T) + (hvT : ((ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc + : TreeSequence G e0).vertex base.supportPosition : V) ∈ TreeSequenceVertexSet T), + let candidates : Finset (Fin (ett.rounds + (1 : ℕ))) := {i : Fin (ett.rounds + (1 : ℕ)) | + ((ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc : + TreeSequence G e0).vertex base.supportPosition : V) ∈ TreeSequenceVertexSet + (ExtendedTashkinovLadderStage ett i)}; + ∀ (hqmem : ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc ∈ candidates) (_ : ETTFirstAppearanceIndex ett + ((ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc : + TreeSequence G e0).vertex base.supportPosition : V) hvT = (↑(candidates.min' (Exists.intro + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc hqmem : candidates.Nonempty) : Fin (ett.rounds + + (1 : ℕ))) : ℕ) + (1 : ℕ)), ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + base.closure) ∧ ColoredVertexSetClosed G sigma (TreeSequenceVertexSet base.closure) ∧ + ∀ (alpha beta : Fin k), alpha ∈ TreeMissingColors sigma base.closure ∨ beta ∈ + TreeMissingColors sigma base.closure → TreeInterchangeable G base.closure sigma alpha beta + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hMP hpositive hPE sigma hproper hone hstable base + set n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds + set q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : + Fin ett.rounds) + intro hqSucc + set Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + set v : V := Tn.vertex base.supportPosition + set P : TreeSequence G e0 := TreeSequencePrefix Tn (↑base.supportPosition : ℕ) + base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt) + intro hparallel hTnT segmentRefl segmentTrans commonPrefix vertexTransfer sequenceSegment + missingTransfer hP_Tn hP_T hvT candidates hqmem + set candidatesNonempty : candidates.Nonempty := Exists.intro q.castSucc hqmem + set minimum : Fin (ett.rounds + (1 : ℕ)) := candidates.min' candidatesNonempty + intro hfirstDef + have hfirstPositive : 0 < ETTFirstAppearanceIndex ett v hvT := by + rw [hfirstDef] + omega + have hfirstUpper : ETTFirstAppearanceIndex ett v hvT ≤ q.val + 1 := by + rw [hfirstDef] + have hle : minimum ≤ q.castSucc := by + exact Finset.min'_le candidates q.castSucc hqmem + have hnat := Fin.le_iff_val_le_val.mp hle + simpa only [Fin.val_castSucc] using Nat.add_le_add_right hnat 1 + let j : Fin ett.rounds := + ⟨ETTFirstAppearanceIndex ett v hvT - 1, by omega⟩ + have hjFirst : ETTFirstAppearanceIndex ett v hvT = j.val + 1 := by + simp only [j] + omega + have hjq : j.val ≤ q.val := by + dsimp [j] + omega + have hkindQ : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE := by + simpa [hqSucc, n] using hPE + have hvertexQ : ett.series.data.chosenVertex q.succ = some v := by + simpa [hqSucc] using hparallel.1 + have hcurrent := (ctx.currentThree ett rfl hMP).1 q v hkindQ hvertexQ + hvT j.castSucc (by simpa using hjFirst) sigma hproper hone + (by + have hgenN : phi = ett.series.data.coloring n := by + simpa [n] using ett.generatingColoring + have hs : StableColoring Tn + (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma := by + rw [← hgenN] + simpa [Tn, n] using hstable + simpa [hqSucc] using hs) + have hsigmaBefore : StableColoringBeforeVertex T v hvT + (TashkinovStoredColors ett.series.data j.castSucc) + (ett.series.data.coloring j.castSucc) sigma := hcurrent.1 + have stepSegment : ∀ i : Fin (ett.rounds + 1), 0 < i.val → + TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) + (ett.series.data.tree i.succ) := by + intro i hi + cases ett.series.certified i with + | initial => simp at hi + | SE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => + assumption + | RE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption + have stageToStage := @helper_stageToStage_923 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett hpositive sigma hone base segmentRefl segmentTrans hvT + hqmem hfirstDef hfirstUpper stepSegment + let Tj : TreeSequence G e0 := ett.series.data.tree j.succ.castSucc + have hvStage := @helper_hvStage_1145 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett hpositive sigma base hvT hqmem hfirstDef hfirstUpper hjFirst + have hStageTn : TreeSequenceInitialSegment Tj Tn := by + have hseg := stageToStage (j.val + 1) ett.rounds (by omega) + (by omega) le_rfl + change TreeSequenceInitialSegment + (ett.series.data.tree j.succ.castSucc) + (ett.series.data.tree n.castSucc) + convert hseg using 1 <;> congr 1 + have hPLength : P.length = base.supportPosition.val := by + simp [P, TreeSequencePrefix] + have hPLeStage : P.length ≤ + Tj.length := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hvStage + obtain ⟨i, hi⟩ := hvStage + have hindex : Fin.castLE (Nat.succ_le_succ hStageTn.1) i = + base.supportPosition := by + apply Tn.vertex_injective + exact (hStageTn.2.1 i).trans (hi.trans (by rfl)) + rw [hPLength] + have := congrArg Fin.val hindex + dsimp at this + omega + have hPStage : TreeSequenceInitialSegment P + Tj := + commonPrefix hP_Tn hStageTn hPLeStage + have segmentVertexBefore := @helper_segmentVertexBefore_1187 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett hpositive sigma base hTnT segmentTrans + vertexTransfer hP_T hvT hqmem hfirstDef hfirstUpper hPLength + have transportStep := @helper_transportStep_335 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett hpositive sigma base segmentTrans hvT hqmem hfirstDef + hfirstUpper hsigmaBefore segmentVertexBefore + have transportRoute (S : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence + (ett.series.data.coloring j.castSucc) S P) : + TashkinovAugmentationSequence sigma S P := by + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBP ih => + have hBsegment : TreeSequenceInitialSegment B P := + sequenceSegment hBP + exact Relation.ReflTransGen.head (transportStep hAB hBsegment) ih + have hPClosure : TreeSequenceInitialSegment P base.closure := + sequenceSegment hparallel.2.1.1 + have hclosed : ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet base.closure) := hparallel.2.1.2 + have hminimumVal : minimum.val = j.val := by + rw [hfirstDef] at hjFirst + omega + have hvP : v ∈ TreeSequenceVertexSet P := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + let lastP : Fin (P.length + 1) := Fin.last P.length + refine ⟨lastP, ?_⟩ + have hlastIndex : Fin.castLE (Nat.succ_le_succ hP_Tn.1) lastP = + base.supportPosition := by + apply Fin.ext + simp [lastP, hPLength] + exact (hP_Tn.2.1 lastP).symm.trans (congrArg Tn.vertex hlastIndex) + by_cases hjPositive : 0 < j.val + · exact @helper_branch_413 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett ctx hMP hpositive sigma hproper hone base hparallel segmentTrans + commonPrefix vertexTransfer sequenceSegment missingTransfer hP_Tn hvT hqmem hfirstDef + hfirstUpper hjFirst hcurrent stepSegment hStageTn hPLength hPStage transportRoute hPClosure + hclosed hvP hjPositive + · exact @helper_branch_742 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett hpositive sigma hproper hone base hparallel commonPrefix sequenceSegment + hvT hqmem hfirstDef hfirstUpper hjFirst hPLength hPStage transportRoute hclosed hjPositive + +theorem ParallelSupportClosureProperties {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (ctx : TechnicalInductionContext G k e0 ett.rounds) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (sigma : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma) + (base : HierarchyBase ett sigma) : + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet base.closure) ∧ + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet base.closure) ∧ + ∀ alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma base.closure ∨ + beta ∈ TreeMissingColors sigma base.closure) → + TreeInterchangeable G base.closure sigma alpha beta := by + classical + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hqSucc : q.succ = n := by + apply Fin.ext + simp [q, n] + omega + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + let v : V := Tn.vertex base.supportPosition + let P : TreeSequence G e0 := + TreeSequencePrefix Tn base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt) + have hparallel : + ett.series.data.chosenVertex n = some v ∧ + TashkinovClosure sigma P base.closure ∧ + Nonempty (OrderedTreeUnion Tn base.closure base.core) := by + simpa [n, Tn, v, P] using base.parallel hPE + have hTnT : TreeSequenceInitialSegment Tn T := by + have hindex : n.castSucc = + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp [n] + change TreeSequenceInitialSegment (ett.series.data.tree n.castSucc) T + rw [hindex] + exact ett.abovePenultimate + have segmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨hab.trans hbc, ?_, ?_⟩ + · intro i + simpa using + (hvbc (Fin.castLE (Nat.succ_le_succ hab) i)).trans (hvab i) + · intro i + simpa using (hebc (Fin.castLE hab i)).trans (heab i) + have commonPrefix := @helper_commonPrefix_1011 V E G e0 + have vertexTransfer {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro x hx + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hx ⊢ + obtain ⟨i, rfl⟩ := hx + exact ⟨Fin.castLE (Nat.succ_le_succ hAB.1) i, hAB.2.1 i⟩ + have sequenceSegment {A B : TreeSequence G e0} + {rho : PartialEdgeColoring E k} + (hAB : TashkinovAugmentationSequence rho A B) : + TreeSequenceInitialSegment A B := by + unfold TashkinovAugmentationSequence at hAB + induction hAB using Relation.ReflTransGen.head_induction_on with + | refl => exact segmentRefl _ + | @head A B hstep htail ih => + exact segmentTrans hstep.2.1 ih + have missingTransfer {A B : TreeSequence G e0} + {rho : PartialEdgeColoring E k} + (hAB : TreeSequenceInitialSegment A B) : + TreeMissingColors rho A ⊆ TreeMissingColors rho B := by + intro c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + obtain ⟨x, hx, hxc⟩ := hc + exact ⟨x, vertexTransfer hAB hx, hxc⟩ + have hP_Tn : TreeSequenceInitialSegment P Tn := by + refine ⟨Nat.le_of_lt_succ base.supportPosition.isLt, ?_, ?_⟩ + · intro i + simp [P, TreeSequencePrefix] + · intro i + simp [P, TreeSequencePrefix] + have hP_T : TreeSequenceInitialSegment P T := segmentTrans hP_Tn hTnT + have hvTn : v ∈ TreeSequenceVertexSet Tn := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨base.supportPosition, rfl⟩ + have hvT : v ∈ TreeSequenceVertexSet T := vertexTransfer hTnT hvTn + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + v ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hqmem : q.castSucc ∈ candidates := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + unfold ExtendedTashkinovLadderStage + rw [Fin.lastCases_castSucc] + have hindex : q.succ.castSucc = n.castSucc := by + exact congrArg Fin.castSucc hqSucc + rw [hindex] + exact hvTn + let candidatesNonempty : candidates.Nonempty := ⟨q.castSucc, hqmem⟩ + let minimum : Fin (ett.rounds + 1) := + candidates.min' candidatesNonempty + have hfirstDef : ETTFirstAppearanceIndex ett v hvT = minimum.val + 1 := by + unfold ETTFirstAppearanceIndex + dsimp + change _ = (candidates.min' candidatesNonempty).val + 1 + congr + exact @helper_continuation_1407 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett ctx hMP hpositive hPE sigma hproper hone hstable base hqSucc hparallel + hTnT segmentRefl segmentTrans commonPrefix vertexTransfer sequenceSegment missingTransfer + hP_Tn hP_T hvT hqmem hfirstDef +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelTerminalAwayInterchangeable.lean b/LeanPool/GoldbergSeymour/ParallelTerminalAwayInterchangeable.lean new file mode 100644 index 0000000000..076213b642 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelTerminalAwayInterchangeable.lean @@ -0,0 +1,523 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TechnicalInductionContext +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Parallel Terminal Away Interchangeable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hTauOne_234.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (_ : + IsOneEdgeUncolored sigma e0), + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) => + by + omega + ⟩ : Fin ett.rounds); + ∀ (chosenGamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)) (_ : chosenGamma ≠ choice.color), + let tau : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex); IsOneEdgeUncolored tau e0 := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive sigma hone previous chosenGamma choice + hGammaDelta tau + unfold IsOneEdgeUncolored + constructor + · by_cases he : Sum.inr e0 ∈ + TwoColorComponent G sigma chosenGamma choice.color + (Sum.inl choice.vertex) + · simp [tau, TwoColorComponentSwap, he, hone.1] + · simp [tau, TwoColorComponentSwap, he, hone.1] + · intro e he0 + obtain ⟨c, hc⟩ := hone.2 e he0 + by_cases he : Sum.inr e ∈ + TwoColorComponent G sigma chosenGamma choice.color + (Sum.inl choice.vertex) + · by_cases hcg : c = chosenGamma + · exact ⟨choice.color, by + simp [tau, TwoColorComponentSwap, he, hc, hcg]⟩ + · by_cases hcd : c = choice.color + · exact ⟨chosenGamma, by + simp [tau, TwoColorComponentSwap, he, hc, hcd, + hGammaDelta.symm]⟩ + · exact ⟨c, by + simp [tau, TwoColorComponentSwap, he, hc, hcg, hcd]⟩ + · exact ⟨c, by simp [tau, TwoColorComponentSwap, he, hc]⟩ + +private theorem helper_hTauInterchangeable_319.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : TechnicalInductionContext G k e0 ett.rounds) (_ : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (alpha beta : Fin k), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) => + by + omega + ⟩ : Fin ett.rounds); + ∀ (chosenGamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)), + let tau : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex); + ∀ (_ : IsProperEdgeColoring G tau) (_ : IsOneEdgeUncolored tau e0) (_ : StableColoring + (ett.series.data.tree terminal.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc) tau) (_ : alpha ∈ + TreeMissingColors tau (ett.series.data.tree terminal.castSucc)), TreeInterchangeable G + (ett.series.data.tree terminal.castSucc) tau alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hMP hpositive sigma alpha beta terminal previous + chosenGamma choice tau hTauProper hTauOne hTauStable hAlphaTau + by_cases hOne : ett.rounds = 1 + · have hbase := (TechnicalTheoremBase G k ett.rounds e0 input + ett.series).2 + dsimp only at hbase + have hTerminalOne : terminal.castSucc = + (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp [terminal, hOne] + have hPreviousZero : previous.castSucc = + (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + simp [previous, hOne] + have hstableBase : StableColoring + (ett.series.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors ett.series.data 0) + (ett.series.data.coloring 0) tau := by + simpa only [hTerminalOne, hPreviousZero] using hTauStable + have hinter := hbase tau hTauProper hTauOne hstableBase alpha beta + (Or.inl (by simpa only [hTerminalOne] using hAlphaTau)) + simpa only [hTerminalOne] using hinter + · have hrPositive : 1 ≤ ett.rounds - 1 := by omega + have hrBefore : ett.rounds - 1 < ett.rounds := by omega + obtain ⟨restricted, hRounds, hRestrictedMP, hTreeEq, hDataEq⟩ := + CertifiedETTRestriction G k e0 input T phi ett hMP + (ett.rounds - 1) hrPositive hrBefore + let lowerTerminal : Fin (restricted.rounds + 1) := + Fin.last restricted.rounds + have hCastLower : Fin.castLE (by omega) lowerTerminal = + previous.castSucc := by + apply Fin.ext + simp [lowerTerminal, previous, hRounds] + have hLowerTree : restricted.series.data.tree + (Fin.last (restricted.rounds + 1)) = + ett.series.data.tree terminal.castSucc := by + rw [hTreeEq] + congr 1 + apply Fin.ext + simp [terminal, hRounds] + omega + obtain ⟨hLowerColor, hLowerStoredRaw, hLowerEdges, hLowerKind, + hLowerVertex, hLowerOutside, hLowerDelta, hLowerGamma, + hLowerStored, hLowerCert⟩ := hDataEq lowerTerminal + have hLowerColor' : restricted.series.data.coloring lowerTerminal = + ett.series.data.coloring previous.castSucc := by + simpa only [hCastLower] using hLowerColor + have hLowerStored' : + TashkinovStoredColors restricted.series.data lowerTerminal = + TashkinovStoredColors ett.series.data previous.castSucc := by + simpa only [hCastLower] using hLowerStored + have hLowerStable : StableColoring + (restricted.series.data.tree + (Fin.last (restricted.rounds + 1))) + (TashkinovStoredColors restricted.series.data lowerTerminal) + (restricted.series.data.coloring lowerTerminal) tau := by + rw [hLowerTree, hLowerStored', hLowerColor'] + exact hTauStable + have hlower := ctx.lowerTwo restricted + (by omega) (by omega) hRestrictedMP + dsimp only at hlower + have hinter := hlower tau hTauProper hTauOne hLowerStable alpha beta + (Or.inl (by simpa only [hLowerTree] using hAlphaTau)) + simpa only [hLowerTree] using hinter + +private theorem helper_continuation_387.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : TechnicalInductionContext G k e0 ett.rounds) (_ : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (alpha beta : Fin k) + (_ : alpha ∈ TreeMissingColors sigma (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) (_ : beta ∈ TreeMissingColors sigma (ett.series.data.tree (Fin.last + ett.rounds).castSucc)), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) => ( + by first | omega + )⟩ : Fin ett.rounds); + ∀ (chosenGamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)) (_ : alpha ≠ chosenGamma) (_ : beta ≠ + chosenGamma) (_ : alpha ≠ choice.color) (_ : beta ≠ choice.color), + let tau : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex); + ∀ (_ : IsProperEdgeColoring G tau) (_ : IsOneEdgeUncolored tau e0) (_ : StableColoring + (ett.series.data.tree terminal.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc) tau) (_ : ( + ∀ (c : Fin k) (_ : c ≠ chosenGamma) (_ : c ≠ choice.color) (f : E), tau f = some c ↔ sigma f = + some c)), TreeInterchangeable G (ett.series.data.tree (Fin.last ett.rounds).castSucc) + sigma alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hMP hpositive sigma alpha beta hAlphaMissing + hBetaMissing terminal previous chosenGamma choice hAlphaGamma hBetaGamma hAlphaDelta + hBetaDelta tau hTauProper hTauOne hTauStable hOffPair + have hAlphaEdge : ∀ f, tau f = some alpha ↔ sigma f = some alpha := + hOffPair alpha hAlphaGamma hAlphaDelta + have hBetaEdge : ∀ f, tau f = some beta ↔ sigma f = some beta := + hOffPair beta hBetaGamma hBetaDelta + have hGraph : TwoColorIncidenceGraph G tau alpha beta = + TwoColorIncidenceGraph G sigma alpha beta := by + ext x y + cases x <;> cases y <;> + simp [TwoColorIncidenceGraph, hAlphaEdge, hBetaEdge] + have hComponents (z : Sum V E) : + TwoColorComponent G tau alpha beta z = + TwoColorComponent G sigma alpha beta z := by + unfold TwoColorComponent + rw [hGraph] + have hPaths (z : Sum V E) : + TwoColorPathComponent G tau alpha beta z ↔ + TwoColorPathComponent G sigma alpha beta z := by + simp only [TwoColorPathComponent] + rw [hComponents z, hGraph] + have hMissingVertex (c : Fin k) (hcGamma : c ≠ chosenGamma) + (hcDelta : c ≠ choice.color) (v : V) : + c ∈ MissingColors G tau v ↔ c ∈ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + simp_rw [hOffPair c hcGamma hcDelta] + have hTreeMissing (c : Fin k) (hcGamma : c ≠ chosenGamma) + (hcDelta : c ≠ choice.color) : + c ∈ TreeMissingColors tau + (ett.series.data.tree terminal.castSucc) ↔ + c ∈ TreeMissingColors sigma + (ett.series.data.tree terminal.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, (hMissingVertex c hcGamma hcDelta v).mp hc⟩ + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, (hMissingVertex c hcGamma hcDelta v).mpr hc⟩ + have hAlphaTau : alpha ∈ TreeMissingColors tau + (ett.series.data.tree terminal.castSucc) := + (hTreeMissing alpha hAlphaGamma hAlphaDelta).mpr hAlphaMissing + have hBetaTau : beta ∈ TreeMissingColors tau + (ett.series.data.tree terminal.castSucc) := + (hTreeMissing beta hBetaGamma hBetaDelta).mpr hBetaMissing + have hTauInterchangeable := @helper_hTauInterchangeable_319 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett ctx hMP hpositive sigma alpha beta + chosenGamma choice hTauProper hTauOne hTauStable hAlphaTau + intro z w hz hw hzTree hwTree + have hzTau : TwoColorPathComponent G tau alpha beta z := + (hPaths z).mpr hz + have hwTau : TwoColorPathComponent G tau alpha beta w := + (hPaths w).mpr hw + have hzTreeTau : ∃ v ∈ TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc), + Sum.inl v ∈ TwoColorComponent G tau alpha beta z := by + rcases hzTree with ⟨v, hv, hvz⟩ + exact ⟨v, hv, by simpa only [hComponents z] using hvz⟩ + have hwTreeTau : ∃ v ∈ TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc), + Sum.inl v ∈ TwoColorComponent G tau alpha beta w := by + rcases hwTree with ⟨v, hv, hvw⟩ + exact ⟨v, hv, by simpa only [hComponents w] using hvw⟩ + have hinter := hTauInterchangeable z w hzTau hwTau hzTreeTau hwTreeTau + rw [hComponents z, hComponents w] at hinter + exact hinter + +private theorem helper_branch_113.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : TechnicalInductionContext G k e0 ett.rounds) (_ : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) (_ : ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE) (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G + sigma) (_ : IsOneEdgeUncolored sigma e0) (support : V) (gamma delta : Fin k) (_ : + ett.series.data.chosenVertex (Fin.last ett.rounds) = some support) (_ : + ett.series.data.gamma (Fin.last ett.rounds) = some gamma) (_ : ett.series.data.delta + (Fin.last ett.rounds) = some delta) (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors + sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : beta ∈ TreeMissingColors + sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : alpha ≠ gamma) (_ : + alpha ≠ delta) (_ : beta ≠ gamma) (_ : beta ≠ delta), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds) => + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : previous.succ = terminal) (_ : StableColoring (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal) (ett.series.data.coloring terminal) + sigma) (ci : Fin ett.rounds) (_ : IsProperEdgeColoring G (ett.series.data.coloring + ci.castSucc)) (_ : IsOneEdgeUncolored (ett.series.data.coloring ci.castSucc) e0) (_ : + ColoredVertexSetClosed G (ett.series.data.coloring ci.castSucc) (TreeSequenceVertexSet + (ett.series.data.tree ci.succ.castSucc))) (_ : ¬ColoredVertexSetStronglyClosed G + (ett.series.data.coloring ci.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + ci.succ.castSucc))) (_ : ¬Nonempty (RevisitingExtensionCertificate ett.series.data + ci.castSucc)) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + ci.succ.castSucc) (TashkinovStoredColors ett.series.data ci.castSucc) + (ett.series.data.coloring ci.castSucc)) (_ : ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc)))) (chosenGamma : Fin k) (_ : ParallelExtensionColor ett.series.data + ci.castSucc choice.selected choice.vertex chosenGamma) (secondStable : PartialEdgeColoring + E k) (_ : StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected secondStable) (_ : + TreeExit (ett.series.data.tree ci.succ.castSucc) secondStable chosenGamma choice.color + choice.vertex) (_ : ett.series.data.coloring ci.succ = TwoColorComponentSwap G + secondStable chosenGamma choice.color (Sum.inl choice.vertex)) (_ : IsProperEdgeColoring G + (ett.series.data.coloring ci.succ)) (_ : IsOneEdgeUncolored (ett.series.data.coloring + ci.succ) e0) (_ : ett.series.data.stored ci.succ = { choice.color, chosenGamma }) (_ : + ett.series.data.connectingEdges ci.succ = { choice.edge }) (_ : ett.series.data.kind + ci.succ = some TashkinovExtensionKind.PE) (_ : ett.series.data.chosenVertex ci.succ = some + choice.vertex) (_ : ett.series.data.outsideVertex ci.succ = some choice.otherEndpoint) (_ + : ett.series.data.delta ci.succ = some choice.color) (_ : ett.series.data.gamma ci.succ = + some chosenGamma) (_ : TashkinovClosure (ett.series.data.coloring ci.succ) + (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ)) (_ : + TreeSequenceInitialSegment (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree + ci.succ.succ)) (_ : (ett.series.data.tree ci.succ.castSucc).length < (ett.series.data.tree + ci.succ.succ).length) (_ : terminal = ci.succ), TreeInterchangeable G + (ett.series.data.tree (Fin.last ett.rounds).castSucc) sigma alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hMP hpositive hPE sigma hproper hone support gamma + delta hsupport hgamma hdelta alpha beta hAlphaMissing hBetaMissing hAlphaGamma hAlphaDelta + hBetaGamma hBetaDelta terminal previous hPreviousSucc hStableTerminal ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails chosenGamma gammaRule secondStable secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension hslot + have hci : ci = previous := by + apply Fin.ext + have hs := congrArg Fin.val hslot + simp [terminal, previous] at hs ⊢ + omega + subst ci + have hTerminalEq : terminal = previous.succ := hslot + have hLastEq : Fin.last ett.rounds = previous.succ := by + simpa only [terminal] using hTerminalEq + have hSupportEq : support = choice.vertex := by + apply Option.some.inj + exact hsupport.symm.trans (by + rw [hLastEq] + exact currentVertex) + have hGammaEq : gamma = chosenGamma := by + apply Option.some.inj + exact hgamma.symm.trans (by + rw [hLastEq] + exact currentGamma) + have hDeltaEq : delta = choice.color := by + apply Option.some.inj + exact hdelta.symm.trans (by + rw [hLastEq] + exact currentDelta) + subst support + subst gamma + subst delta + have hSupportTree : choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc) := by + simpa [hTerminalEq] using choice.vertexDefective.1 + have hGammaSecond : chosenGamma ∈ MissingColors G secondStable + choice.vertex := by + rw [secondStableRelation.2 choice.vertex choice.vertexDefective.1] + exact gammaRule.1 + have hChoiceSecond : secondStable choice.edge = some choice.color := by + have hfix := secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), choice.edgeColor⟩ + exact hfix.trans choice.edgeColor + have hGammaDelta : chosenGamma ≠ choice.color := by + intro heq + have hpresent : chosenGamma ∈ PresentColors G secondStable + choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨choice.edge, choice.edgeIncident, heq ▸ hChoiceSecond⟩ + have hnot : chosenGamma ∉ PresentColors G secondStable + choice.vertex := by + simpa [MissingColors] using hGammaSecond + exact hnot hpresent + have hComponent : + ∀ w, w ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc) → (Sum.inl w ∈ + TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) ↔ w = + choice.vertex) := by + exact ctx.currentFour ett rfl hMP choice.vertex chosenGamma choice.color + hPE hsupport hgamma hdelta sigma hproper hone hStableTerminal + obtain ⟨selected, recoveredSecond, hselectedProper, hselectedOne, + hselectedStable, hrecoveredSecondProper, hrecoveredSecondOne, + hrecoveredSecondStable, hcurrentSwap, hundoneSecond, + hundoneSelected, hundonePrevious⟩ := + ParallelExtensionUndoStable G k ett.rounds e0 input ett.series previous + choice.vertex chosenGamma choice.color + (by simpa only [hPreviousSucc] using hPE) + (by simpa only [hPreviousSucc] using hsupport) + (by simpa only [hPreviousSucc] using hgamma) + (by simpa only [hPreviousSucc] using hdelta) + sigma hproper hone + (by simpa only [hPreviousSucc] using hStableTerminal) + (by simpa only [hPreviousSucc] using hSupportTree) + (by simpa only [hPreviousSucc] using hComponent) + let tau := TwoColorComponentSwap G sigma chosenGamma choice.color + (Sum.inl choice.vertex) + have hTauProper : IsProperEdgeColoring G tau := by + exact TwoColorComponentSwapProper G sigma chosenGamma choice.color + hGammaDelta hproper (Sum.inl choice.vertex) + have hTauOne := @helper_hTauOne_234 V E inferInstance inferInstance inferInstance G k e0 input T + phi ett hpositive sigma hone chosenGamma choice hGammaDelta + have hTauStable : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc) tau := by + simpa [tau, hTerminalEq] using hundonePrevious + have hOffPair (c : Fin k) (hcGamma : c ≠ chosenGamma) + (hcDelta : c ≠ choice.color) (f : E) : + tau f = some c ↔ sigma f = some c := by + by_cases hf : Sum.inr f ∈ + TwoColorComponent G sigma chosenGamma choice.color + (Sum.inl choice.vertex) + · by_cases hfg : sigma f = some chosenGamma + · simp [tau, TwoColorComponentSwap, hf, hfg, hcGamma.symm, + hcDelta.symm] + · by_cases hfd : sigma f = some choice.color + · simp [tau, TwoColorComponentSwap, hf, hfd, hcGamma.symm, + hcDelta.symm, hGammaDelta.symm] + · simp [tau, TwoColorComponentSwap, hf, hfg, hfd] + · simp [tau, TwoColorComponentSwap, hf] + exact @helper_continuation_387 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett ctx hMP hpositive sigma alpha beta hAlphaMissing hBetaMissing + chosenGamma choice hAlphaGamma hBetaGamma hAlphaDelta hBetaDelta hTauProper hTauOne + hTauStable hOffPair +theorem ParallelTerminalAwayInterchangeable {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (ctx : TechnicalInductionContext G k e0 ett.rounds) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (sigma : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma) + (support : V) (gamma delta : Fin k) + (hsupport : ett.series.data.chosenVertex (Fin.last ett.rounds) = + some support) + (hgamma : ett.series.data.gamma (Fin.last ett.rounds) = some gamma) + (hdelta : ett.series.data.delta (Fin.last ett.rounds) = some delta) : + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + ∀ alpha beta : Fin k, + alpha ∈ TreeMissingColors sigma Tn → + beta ∈ TreeMissingColors sigma Tn → + alpha ≠ gamma → + alpha ≠ delta → + beta ≠ gamma → + beta ≠ delta → + TreeInterchangeable G Tn sigma alpha beta := by + classical + dsimp only + intro alpha beta hAlphaMissing hBetaMissing hAlphaGamma hAlphaDelta + hBetaGamma hBetaDelta + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let previous : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hPreviousSucc : previous.succ = terminal := by + apply Fin.ext + simp [previous, terminal] + omega + have hStableTerminal : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma := by + rw [← ett.generatingColoring] + exact hstable + have cert := ett.series.certified terminal + generalize hslot : terminal = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hz := congrArg Fin.val hslot + simp [terminal] at hz + omega + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hterm := hPE + change ett.series.data.kind terminal = + some TashkinovExtensionKind.PE at hterm + rw [hslot, currentKind] at hterm + simp at hterm + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hterm := hPE + change ett.series.data.kind terminal = + some TashkinovExtensionKind.PE at hterm + rw [hslot, currentKind] at hterm + simp at hterm + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + chosenGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_113 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett ctx hMP hpositive hPE sigma hproper hone support gamma delta + hsupport hgamma hdelta alpha beta hAlphaMissing hBetaMissing hAlphaGamma + hAlphaDelta hBetaGamma hBetaDelta hPreviousSucc hStableTerminal ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails chosenGamma gammaRule secondStable secondStableRelation + exitWitness currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta currentGamma + closedExtension orderedExtension strictExtension hslot +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelTerminalFacts.lean b/LeanPool/GoldbergSeymour/ParallelTerminalFacts.lean new file mode 100644 index 0000000000..13b2eee5a2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelTerminalFacts.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +/-! +# P2634_T1_PETerminal Facts + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2634_T1_PETerminalFacts + {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) : + IsProperEdgeColoring G phi /\ IsOneEdgeUncolored phi e0 /\ + TashkinovClosure phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + have positive : 0 < ett.rounds := by have := ett.roundsPositive; omega + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hq : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + have hout : q.succ.succ = Fin.last (ett.rounds + 1) := by + apply Fin.ext + simp [q] + omega + have hkind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE := by rwa [hq] + have hcolor : phi = ett.series.data.coloring q.succ := by + rw [hq] + exact ett.generatingColoring + rw [← hq, ← hout] + generalize hi : q.succ = z at hkind hcolor ⊢ + cases ett.series.certified z with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q hi).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentKind] at hkind + cases hkind + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [currentKind] at hkind + cases hkind + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + refine ⟨?_, ?_, ?_⟩ + · simpa only [← hcolor] using currentProper + · simpa only [← hcolor] using currentOneUncolored + · simpa only [← hcolor] using closedExtension + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelTerminalPEPreprocessing.lean b/LeanPool/GoldbergSeymour/ParallelTerminalPEPreprocessing.lean new file mode 100644 index 0000000000..4aef0050a0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelTerminalPEPreprocessing.lean @@ -0,0 +1,1670 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Basic2 +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveEdge +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.ExtensionBase +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TechnicalInductionContext +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Parallel Terminal PEPreprocessing + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation991Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), TechnicalInductionContext G k e0 ett.rounds → MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → + ∀ (base : HierarchyBase ett sigma), StableColoring (ett.series.data.tree (Fin.last ett.rounds + : Fin (ett.rounds + (1 : ℕ))).castSucc) (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds : Fin (ett.rounds + (1 : ℕ)))) (ett.series.data.coloring (Fin.last ett.rounds : + Fin (ett.rounds + (1 : ℕ)))) sigma → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (secondStableProper : + IsProperEdgeColoring G secondStable) (secondStableOneUncolored : IsOneEdgeUncolored + secondStable e0) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc)) (previousOneUncolored : IsOneEdgeUncolored + (ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) e0), ColoredVertexSetClosed G + (ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (TreeSequenceVertexSet (ett.series.data.tree + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc)) → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc) (TashkinovStoredColors ett.series.data + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (ett.series.data.coloring ((⟨ett.rounds - (1 : + ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc)), ett.series.data.coloring ((⟨ett.rounds - (1 + : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = TwoColorComponentSwap G secondStable gamma + choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ) → IsOneEdgeUncolored (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ) e0 → ett.series.data.connectingEdges ((⟨ett.rounds + - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = { choice.edge } → ett.series.data.kind + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = some choice.vertex → ett.series.data.delta + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = some choice.color → ett.series.data.gamma + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = some gamma → (Fin.last ett.rounds : Fin + (ett.rounds + (1 : ℕ))) = ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ → Fin.last ett.rounds = ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ → ett.series.data.tree (Fin.last ett.rounds : Fin + (ett.rounds + (1 : ℕ))).castSucc = ett.series.data.tree ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc → choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc) → gamma + ∈ MissingColors G secondStable choice.vertex → secondStable choice.edge = some + choice.color → gamma ≠ choice.color → choice.edge ∈ BoundaryEdges G (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc)) → ( + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc)) → TreeIncidentEdge + (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc) f) → + ColoredVertexSetElementary G (ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc)) → StableColoring + (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc) + (TashkinovStoredColors ett.series.data ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (ett.series.data.coloring ((⟨ett.rounds - (1 : + ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) choice.selected → StableColoring + (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc) (insert + choice.color (TashkinovStoredColors ett.series.data ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc)) choice.selected secondStable → + let previousSubtype : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi e0 } := (⟨ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc, (⟨previousProper, previousOneUncolored⟩ : + IsProperEdgeColoring G (ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) ∧ IsOneEdgeUncolored (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) e0)⟩ : { psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0 }); + let selectedSubtype : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi e0 } := (⟨choice.selected, (⟨choice.selectedProper, + choice.selectedOneUncolored⟩ : IsProperEdgeColoring G choice.selected ∧ IsOneEdgeUncolored + choice.selected e0)⟩ : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi e0 }); + let secondSubtype : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi e0 } := (⟨secondStable, (⟨secondStableProper, + secondStableOneUncolored⟩ : IsProperEdgeColoring G secondStable ∧ IsOneEdgeUncolored + secondStable e0)⟩ : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi e0 }); StableColoring (ett.series.data.tree (Fin.last ett.rounds : + Fin (ett.rounds + (1 : ℕ))).castSucc) (TashkinovStoredColors ett.series.data ((⟨ett.rounds + - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (↑selectedSubtype : PartialEdgeColoring E k) + (↑previousSubtype : PartialEdgeColoring E k) → StableColoring (ett.series.data.tree + (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc)) (↑secondSubtype : PartialEdgeColoring E k) + (↑selectedSubtype : PartialEdgeColoring E k) → + ∃ (support : V) (common : V) (gamma : Fin k) (delta : Fin k), ett.series.data.chosenVertex + (Fin.last ett.rounds) = some support ∧ ett.series.data.gamma (Fin.last ett.rounds) = some + gamma ∧ ett.series.data.delta (Fin.last ett.rounds) = some delta ∧ support ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ support ∈ + TreeSequenceVertexSet base.closure ∧ common ∈ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc) ∧ common ∈ TreeSequenceVertexSet base.closure ∧ common ≠ + support ∧ delta ∈ MissingColors G sigma support ∧ gamma ∉ TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ (MissingColors G sigma + common).Nonempty ∧ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + +private theorem helper_hPreviousElementary_238.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + TechnicalInductionContext G k e0 ett.rounds → + MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ColoredVertexSetElementary G (ett.series.data.coloring previous.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hMP hpositive terminal previous + by_cases hOne : ett.rounds = 1 + · have hbase : ColoredVertexSetElementary G + (ett.series.data.coloring 0) + (TreeSequenceVertexSet + (ett.series.data.tree (⟨1, by omega⟩ : + Fin (ett.rounds + 2)))) := + (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + have hTerminalOne : terminal.castSucc = + (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp [terminal, hOne] + have hPreviousZero : previous.castSucc = + (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + simp [previous, hOne] + simpa only [hTerminalOne, hPreviousZero] using hbase + · have hrPositive : 1 ≤ ett.rounds - 1 := by omega + have hrBefore : ett.rounds - 1 < ett.rounds := by omega + obtain ⟨restricted, hRounds, hRestrictedMP, hRestrictedTrees, + hRestrictedData⟩ := + CertifiedETTRestriction G k e0 input T phi ett hMP + (ett.rounds - 1) hrPositive hrBefore + have hLower : ColoredVertexSetElementary G + (ett.series.data.coloring + (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1))) + (TreeSequenceVertexSet + (ett.series.data.tree + (⟨(ett.rounds - 1) + 1, by omega⟩ : + Fin (ett.rounds + 2)))) := + ctx.lowerOne restricted (by omega) (by omega) hRestrictedMP + have hLowerTree : + (ett.series.data.tree + (⟨(ett.rounds - 1) + 1, by omega⟩ : + Fin (ett.rounds + 2))) = + ett.series.data.tree terminal.castSucc := by + congr 1 + apply Fin.ext + simp [terminal] + omega + have hLowerColor : + (ett.series.data.coloring + (⟨ett.rounds - 1, by omega⟩ : + Fin (ett.rounds + 1))) = + ett.series.data.coloring previous.castSucc := by + congr 1 + simpa only [hLowerTree, hLowerColor] using hLower + +private theorem helper_hSecondClosed_343.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (secondStable : PartialEdgeColoring E k) (secondStableProper : IsProperEdgeColoring G + secondStable) (secondStableOneUncolored : IsOneEdgeUncolored secondStable e0) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring previous.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring previous.castSucc) + e0), ColoredVertexSetClosed G (ett.series.data.coloring previous.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree previous.succ.castSucc)) → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree previous.succ.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) (ett.series.data.coloring + previous.castSucc)), ett.series.data.tree terminal.castSucc = ett.series.data.tree + previous.succ.castSucc → ( + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc)) → TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f) → + StableColoring (ett.series.data.tree terminal.castSucc) (TashkinovStoredColors + ett.series.data previous.castSucc) (ett.series.data.coloring previous.castSucc) + choice.selected → StableColoring (ett.series.data.tree terminal.castSucc) (insert + choice.color (TashkinovStoredColors ett.series.data previous.castSucc)) choice.selected + secondStable → + let previousSubtype : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi e0 } := (⟨ett.series.data.coloring previous.castSucc, + (⟨previousProper, previousOneUncolored⟩ : IsProperEdgeColoring G (ett.series.data.coloring + previous.castSucc) ∧ IsOneEdgeUncolored (ett.series.data.coloring previous.castSucc) e0)⟩ + : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi + e0 }); + let selectedSubtype : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi e0 } := (⟨choice.selected, (⟨choice.selectedProper, + choice.selectedOneUncolored⟩ : IsProperEdgeColoring G choice.selected ∧ IsOneEdgeUncolored + choice.selected e0)⟩ : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi e0 }); + let secondSubtype : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi e0 } := (⟨secondStable, (⟨secondStableProper, + secondStableOneUncolored⟩ : IsProperEdgeColoring G secondStable ∧ IsOneEdgeUncolored + secondStable e0)⟩ : { psi : PartialEdgeColoring E k // IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi e0 }); StableColoring (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) (↑selectedSubtype : + PartialEdgeColoring E k) (↑previousSubtype : PartialEdgeColoring E k) → StableColoring + (ett.series.data.tree terminal.castSucc) (insert choice.color (TashkinovStoredColors + ett.series.data previous.castSucc)) (↑secondSubtype : PartialEdgeColoring E k) + (↑selectedSubtype : PartialEdgeColoring E k) → ColoredVertexSetClosed G secondStable + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive terminal previous secondStable + secondStableProper secondStableOneUncolored previousProper previousOneUncolored + previousClosed choice hTreeEq boundaryIncident hSelectedStable hSecondStable + previousSubtype selectedSubtype secondSubtype hSelectedReverseSubtype hSecondReverseSubtype + f c v hfBoundary hv hfColor hcMissing + have hfIncident := boundaryIncident hfBoundary + have hTreeMissingSecond : c ∈ TreeMissingColors secondStable + (ett.series.data.tree terminal.castSucc) := by + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨v, hv, hcMissing⟩ + have hSelectedColor : choice.selected f = some c := by + have hfix := hSecondReverseSubtype.1 f hfIncident + ⟨c, Finset.mem_union_left _ hTreeMissingSecond, hfColor⟩ + exact hfix.trans hfColor + have hSelectedMissing : c ∈ MissingColors G choice.selected v := by + rw [← hSecondStable.2 v hv] + exact hcMissing + have hTreeMissingSelected : c ∈ TreeMissingColors choice.selected + (ett.series.data.tree terminal.castSucc) := by + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨v, hv, hSelectedMissing⟩ + have hPreviousColor : + ett.series.data.coloring previous.castSucc f = some c := by + have hfix := hSelectedReverseSubtype.1 f hfIncident + ⟨c, Finset.mem_union_left _ hTreeMissingSelected, + hSelectedColor⟩ + exact hfix.trans hSelectedColor + have hPreviousMissing : c ∈ MissingColors G + (ett.series.data.coloring previous.castSucc) v := by + rw [← hSelectedStable.2 v hv] + exact hSelectedMissing + have hclosed := previousClosed (f := f) (c := c) (v := v) + (by simpa only [hTreeEq] using hfBoundary) + (by simpa only [hTreeEq] using hv) hPreviousColor + exact hclosed hPreviousMissing + +private theorem helper_hPairColors_420.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)), ett.series.data.coloring + previous.succ = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex) → terminal = previous.succ → gamma ≠ choice.color → + ∀ (f : E), ett.series.data.coloring terminal f = some gamma ∨ ett.series.data.coloring + terminal f = some choice.color ↔ secondStable f = some gamma ∨ secondStable f = some + choice.color := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive terminal previous gamma secondStable choice + currentColoring hTerminalEq hGammaDelta f + rw [hTerminalEq, currentColoring] + by_cases hf : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · by_cases hfg : secondStable f = some gamma + · constructor + · intro h + exact Or.inl hfg + · intro h + right + simp [TwoColorComponentSwap, hf, hfg] + · by_cases hfd : secondStable f = some choice.color + · constructor + · intro h + exact Or.inr hfd + · intro h + left + simp [TwoColorComponentSwap, hf, hfd, + hGammaDelta.symm] + · simp [TwoColorComponentSwap, hf, hfg, hfd] + · simp [TwoColorComponentSwap, hf] + +private theorem helper_hOnlyIncidentComponent_489.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree previous.succ.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) (ett.series.data.coloring + previous.castSucc)), gamma ∈ MissingColors G secondStable choice.vertex → secondStable + choice.edge = some choice.color → ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), Sum.inl x ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) ↔ x = + choice.vertex) → ( + ∀ (f : E), Sum.inr f ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex) → secondStable f = some gamma ∨ secondStable f = some choice.color) → + ∀ (f : E), TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f → Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → f = + choice.edge := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive terminal previous gamma secondStable + secondStableProper choice hGammaSecond hChoiceSecond hComponentSecond hComponentEdgeColor f + hfIncident hfComponent + rcases hfIncident with ⟨x, hx, hxf⟩ + rcases hComponentEdgeColor f hfComponent with hfg | hfd + · have hpresent : gamma ∈ PresentColors G secondStable x := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hxf, hfg⟩ + have hxComponent : Sum.inl x ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl x) = + (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl choice.vertex) + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, hxf, hfg])).trans hfComponent + have hxEq := (hComponentSecond x hx).mp hxComponent + subst x + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hGammaSecond + exact (hnot hpresent).elim + · have hxComponent : Sum.inl x ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl x) = + (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl choice.vertex) + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, hxf, hfd])).trans hfComponent + have hxEq := (hComponentSecond x hx).mp hxComponent + subst x + by_contra hne + exact secondStableProper hne + ⟨choice.vertex, hxf, choice.edgeIncident⟩ hfd hChoiceSecond + +private theorem helper_hDeltaCurrentMissing_531.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree previous.succ.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) (ett.series.data.coloring + previous.castSucc)), ett.series.data.coloring previous.succ = TwoColorComponentSwap G + secondStable gamma choice.color (Sum.inl choice.vertex) → terminal = previous.succ → gamma + ∈ MissingColors G secondStable choice.vertex → secondStable choice.edge = some + choice.color → gamma ≠ choice.color → Sum.inr choice.edge ∈ TwoColorComponent G + secondStable gamma choice.color (Sum.inl choice.vertex) → choice.color ∈ MissingColors G + (ett.series.data.coloring terminal) choice.vertex := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive terminal previous gamma secondStable + secondStableProper choice currentColoring hTerminalEq hGammaSecond hChoiceSecond + hGammaDelta hChoiceComponent + rw [MissingColors] + simp only [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + rcases hpresent with ⟨f, hfIncident, hfCurrent⟩ + rw [hTerminalEq, currentColoring] at hfCurrent + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · by_cases hfg : secondStable f = some gamma + · have hp : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hfIncident, hfg⟩ + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hGammaSecond + exact hnot hp + · by_cases hfd : secondStable f = some choice.color + · have heq : choice.color = gamma := by + simpa [TwoColorComponentSwap, hfComponent, hfg, hfd, + hGammaDelta] using hfCurrent + exact hGammaDelta heq.symm + · simp [TwoColorComponentSwap, hfComponent, hfg, hfd] at hfCurrent + · have hfd : secondStable f = some choice.color := by + simpa [TwoColorComponentSwap, hfComponent] using hfCurrent + by_cases hfeq : f = choice.edge + · subst f + exact hfComponent hChoiceComponent + · exact (secondStableProper hfeq + ⟨choice.vertex, hfIncident, choice.edgeIncident⟩ + hfd hChoiceSecond).elim + +private theorem helper_hFixAway_566.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)), ett.series.data.coloring + previous.succ = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex) → terminal = previous.succ → secondStable choice.edge = some choice.color → + ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), Sum.inl x ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) ↔ x = + choice.vertex) → Sum.inr choice.edge ∈ TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) → ( + ∀ (f : E), TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f → Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → f = + choice.edge) → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), x ≠ choice.vertex → + ∀ (f : E), Incident G x f → ett.series.data.coloring terminal f = secondStable f := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive terminal previous gamma secondStable choice + currentColoring hTerminalEq hChoiceSecond hComponentSecond hChoiceComponent + hOnlyIncidentComponent x hx hxne f hxf + rw [hTerminalEq, currentColoring] + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · have htreeIncident : TreeIncidentEdge + (ett.series.data.tree terminal.castSucc) f := ⟨x, hx, hxf⟩ + have hfeq := hOnlyIncidentComponent f htreeIncident hfComponent + subst f + have hxComponent : Sum.inl x ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl x) = + (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl choice.vertex) + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [TwoColorIncidenceGraph, hxf, hChoiceSecond])).trans + hChoiceComponent + exact (hxne ((hComponentSecond x hx).mp hxComponent)).elim + · simp [TwoColorComponentSwap, hfComponent] + +private theorem helper_hMissingSupportOfNeDelta_612.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)), ett.series.data.coloring + previous.succ = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex) → terminal = previous.succ → choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc) → secondStable choice.edge = some choice.color → + ( + ∀ (f : E), TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f → Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → f = + choice.edge) → + ∀ c ∈ MissingColors G (ett.series.data.coloring terminal) choice.vertex, c ≠ choice.color → c + ∈ MissingColors G secondStable choice.vertex := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive terminal previous gamma secondStable choice + currentColoring hTerminalEq hSupportTree hChoiceSecond hOnlyIncidentComponent c hcCurrent + hcDelta + by_contra hcSecond + have hcPresent : c ∈ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hcSecond + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hcPresent + rcases hcPresent with ⟨f, hxf, hfc⟩ + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · have hfeq := hOnlyIncidentComponent f + ⟨choice.vertex, hSupportTree, hxf⟩ hfComponent + subst f + exact hcDelta (Option.some.inj (hfc.symm.trans hChoiceSecond)) + · have hCurrentColor : ett.series.data.coloring terminal f = some c := by + rw [hTerminalEq, currentColoring] + simpa [TwoColorComponentSwap, hfComponent] using hfc + have hcNotPresent : c ∉ PresentColors G + (ett.series.data.coloring terminal) choice.vertex := by + simpa [MissingColors] using hcCurrent + exact hcNotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hxf, hCurrentColor⟩) + +private theorem helper_hCurrentElementary_640.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)), choice.vertex ∈ + TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc) → + ColoredVertexSetElementary G secondStable (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc)) → choice.color ∉ TreeMissingColors secondStable (ett.series.data.tree + terminal.castSucc) → ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), x ≠ choice.vertex → + MissingColors G (ett.series.data.coloring terminal) x = MissingColors G secondStable x) → + ( + ∀ c ∈ MissingColors G (ett.series.data.coloring terminal) choice.vertex, c ≠ choice.color → c + ∈ MissingColors G secondStable choice.vertex) → ColoredVertexSetElementary G + (ett.series.data.coloring terminal) (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive terminal previous secondStable choice + hSupportTree hSecondElementary hDeltaNotTreeSecond hMissingAway hMissingSupportOfNeDelta u + hu v hv huv + apply Finset.disjoint_left.mpr + intro c hcu hcv + by_cases huSupport : u = choice.vertex + · subst u + have hvSupport : v ≠ choice.vertex := by + intro heq + exact huv heq.symm + have hcvSecond : c ∈ MissingColors G secondStable v := by + rw [← hMissingAway v hv hvSupport] + exact hcv + by_cases hcDelta : c = choice.color + · subst c + apply hDeltaNotTreeSecond + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨v, hv, hcvSecond⟩ + · have hcuSecond := hMissingSupportOfNeDelta c hcu hcDelta + exact (Finset.disjoint_left.mp + (hSecondElementary hSupportTree hv huv)) hcuSecond hcvSecond + · by_cases hvSupport : v = choice.vertex + · subst v + have hcuSecond : c ∈ MissingColors G secondStable u := by + rw [← hMissingAway u hu huSupport] + exact hcu + by_cases hcDelta : c = choice.color + · subst c + apply hDeltaNotTreeSecond + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨u, hu, hcuSecond⟩ + · have hcvSecond := hMissingSupportOfNeDelta c hcv hcDelta + exact (Finset.disjoint_left.mp + (hSecondElementary hu hSupportTree huv)) hcuSecond hcvSecond + · have hcuSecond : c ∈ MissingColors G secondStable u := by + rw [← hMissingAway u hu huSupport] + exact hcu + have hcvSecond : c ∈ MissingColors G secondStable v := by + rw [← hMissingAway v hv hvSupport] + exact hcv + exact (Finset.disjoint_left.mp (hSecondElementary hu hv huv)) + hcuSecond hcvSecond + +private theorem helper_hCommonPrefix_849.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (base : + HierarchyBase ett sigma), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree previous.succ.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) (ett.series.data.coloring + previous.castSucc)) (common : V), TreeVertexOrder (ett.series.data.tree terminal.castSucc) + common choice.vertex → choice.vertex = (ett.series.data.tree terminal.castSucc).vertex + base.supportPosition → + let supportPrefix : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree + terminal.castSucc) (↑base.supportPosition : ℕ) base.supportPositive (Nat.le_of_lt_succ + base.supportPosition.isLt); common ∈ TreeSequenceVertexSet supportPrefix := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma base terminal previous choice common + hCommonOrderTerminal hSupportPosition supportPrefix + rcases hCommonOrderTerminal with ⟨i, j, hi, hj, hij⟩ + have hjSupport : j = base.supportPosition := by + apply (ett.series.data.tree terminal.castSucc).vertex_injective + exact hj.trans hSupportPosition + rw [hjSupport] at hij + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + let i' : Fin (base.supportPosition.val + 1) := ⟨i.val, by omega⟩ + refine ⟨i', ?_⟩ + change (ett.series.data.tree terminal.castSucc).vertex + (Fin.castLE + (Nat.succ_le_succ + (Nat.le_of_lt_succ base.supportPosition.isLt)) i') = common + have hiEq : Fin.castLE + (Nat.succ_le_succ + (Nat.le_of_lt_succ base.supportPosition.isLt)) i' = i := by + apply Fin.ext + rfl + rw [hiEq] + exact hi + +private theorem helper_hComponentCurrent_860.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), TechnicalInductionContext G k e0 ett.rounds → MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)), IsProperEdgeColoring G + (ett.series.data.coloring previous.succ) → IsOneEdgeUncolored (ett.series.data.coloring + previous.succ) e0 → ett.series.data.kind previous.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex previous.succ = some choice.vertex → ett.series.data.delta + previous.succ = some choice.color → ett.series.data.gamma previous.succ = some gamma → + terminal = previous.succ → Fin.last ett.rounds = previous.succ → StableColoring + (ett.series.data.tree terminal.castSucc) (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) (ett.series.data.coloring terminal) → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), Sum.inl x ∈ + TwoColorComponent G (ett.series.data.coloring terminal) gamma choice.color (Sum.inl + choice.vertex) ↔ x = choice.vertex := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hMP hpositive terminal previous gamma choice + currentProper currentOneUncolored currentKind currentVertex currentDelta currentGamma + hTerminalEq hTerminalLast hCurrentStable + have hbase := ExtensionBase G k e0 input T phi ett hMP hpositive + (fun lower hlowerPositive hlowerRounds hlowerMP => + ⟨ctx.lowerOne lower hlowerPositive hlowerRounds hlowerMP, + ctx.lowerTwo lower hlowerPositive hlowerRounds hlowerMP, + ctx.lowerThree lower hlowerPositive hlowerRounds hlowerMP, + ctx.lowerFour lower hlowerPositive hlowerRounds hlowerMP, + ctx.lowerFive lower hlowerPositive hlowerRounds hlowerMP, + ctx.lowerSix lower hlowerPositive hlowerRounds hlowerMP⟩) + choice.vertex gamma choice.color + (by simpa only [hTerminalLast] using currentKind) + (by simpa only [hTerminalLast] using currentVertex) + (by simpa only [hTerminalLast] using currentGamma) + (by simpa only [hTerminalLast] using currentDelta) + (ett.series.data.coloring terminal) + (by simpa only [hTerminalEq] using currentProper) + (by simpa only [hTerminalEq] using currentOneUncolored) + hCurrentStable + simpa only [terminal] using hbase + +private theorem helper_hComponentEdgeColor_910.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)) (f : E), Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → secondStable + f = some gamma ∨ secondStable f = some choice.color := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive previous gamma secondStable choice f hf + have hs : Sum.inr f ∈ + (TwoColorIncidenceGraph G secondStable gamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G secondStable gamma choice.color) + (u := Sum.inr f) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp hf + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G secondStable gamma choice.color).mem_support.mp hs + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + +private theorem helper_hMissingAway_947.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)), ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), x ≠ choice.vertex → + ∀ (f : E), Incident G x f → ett.series.data.coloring terminal f = secondStable f) → + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), x ≠ choice.vertex → + MissingColors G (ett.series.data.coloring terminal) x = MissingColors G secondStable x := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive terminal previous secondStable choice hFixAway + x hx hxne + have hPresent : PresentColors G + (ett.series.data.coloring terminal) x = + PresentColors G secondStable x := by + ext c + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + constructor + · rintro ⟨f, hxf, hfc⟩ + exact ⟨f, hxf, by rw [← hFixAway x hx hxne f hxf]; exact hfc⟩ + · rintro ⟨f, hxf, hfc⟩ + exact ⟨f, hxf, by rw [hFixAway x hx hxne f hxf]; exact hfc⟩ + simp only [MissingColors, hPresent] + +private theorem helper_hSupportPrefix_1126.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k) (base : + HierarchyBase ett sigma), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree previous.succ.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) (ett.series.data.coloring + previous.castSucc)), choice.vertex = (ett.series.data.tree terminal.castSucc).vertex + base.supportPosition → + let supportPrefix : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree + terminal.castSucc) (↑base.supportPosition : ℕ) base.supportPositive (Nat.le_of_lt_succ + base.supportPosition.isLt); choice.vertex ∈ TreeSequenceVertexSet supportPrefix := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive sigma base terminal previous choice + hSupportPosition supportPrefix + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + let i : Fin (base.supportPosition.val + 1) := + ⟨base.supportPosition.val, Nat.lt_succ_self _⟩ + refine ⟨i, ?_⟩ + change (ett.series.data.tree terminal.castSucc).vertex + (Fin.castLE + (Nat.succ_le_succ + (Nat.le_of_lt_succ base.supportPosition.isLt)) i) = + choice.vertex + rw [hSupportPosition] + apply congrArg (ett.series.data.tree terminal.castSucc).vertex + apply Fin.ext + rfl + +private theorem helper_continuation_963.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.PE → + ∀ (sigma : PartialEdgeColoring E k) (base : HierarchyBase ett sigma), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + previous.succ.castSucc) (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc)), ett.series.data.chosenVertex previous.succ + = some choice.vertex → ett.series.data.delta previous.succ = some choice.color → + ett.series.data.gamma previous.succ = some gamma → terminal = previous.succ → Fin.last + ett.rounds = previous.succ → ett.series.data.tree terminal.castSucc = ett.series.data.tree + previous.succ.castSucc → choice.vertex ∈ TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc) → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) → choice.color ∈ MissingColors G sigma + choice.vertex → BoundaryColorEdges G (ett.series.data.coloring previous.succ) + (TreeSequenceVertexSet (ett.series.data.tree previous.succ.castSucc)) gamma = + { choice.edge } ∧ ( + ∀ g ∈ BoundaryColorEdges G (ett.series.data.coloring previous.succ) (TreeSequenceVertexSet + (ett.series.data.tree previous.succ.castSucc)) choice.color, + ∃ (w : V), TreeVertexOrder (ett.series.data.tree previous.succ.castSucc) w choice.vertex ∧ + Incident G w g) ∧ (ColoredVertexSetElementary G (ett.series.data.coloring + previous.castSucc) (TreeSequenceVertexSet (ett.series.data.tree previous.succ.castSucc)) → + ∀ alpha ∈ TreeMissingColors (ett.series.data.coloring previous.succ) (ett.series.data.tree + previous.succ.castSucc), alpha ≠ choice.color → BoundaryColorEdges G + (ett.series.data.coloring previous.succ) (TreeSequenceVertexSet (ett.series.data.tree + previous.succ.castSucc)) alpha = ∅) → gamma ∉ TreeMissingColors sigma + (ett.series.data.tree terminal.castSucc) → + ∀ g ∈ BoundaryColorEdges G (ett.series.data.coloring terminal) (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) choice.color, + ∃ (support : V) (common : V) (gamma : Fin k) (delta : Fin k), ett.series.data.chosenVertex + (Fin.last ett.rounds) = some support ∧ ett.series.data.gamma (Fin.last ett.rounds) = some + gamma ∧ ett.series.data.delta (Fin.last ett.rounds) = some delta ∧ support ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ support ∈ + TreeSequenceVertexSet base.closure ∧ common ∈ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc) ∧ common ∈ TreeSequenceVertexSet base.closure ∧ common ≠ + support ∧ delta ∈ MissingColors G sigma support ∧ gamma ∉ TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ (MissingColors G sigma + common).Nonempty ∧ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive hPE sigma base terminal previous gamma + choice currentVertex currentDelta currentGamma hTerminalEq hTerminalLast hTreeEq + hSupportTree hSigmaElementary hDeltaSigma hBoundaryFacts hGammaNotSigma g hgBoundaryCurrent + obtain ⟨common, hCommonOrder, hCommonIncident⟩ := + hBoundaryFacts.2.1 g (by + simpa only [hTerminalEq] using hgBoundaryCurrent) + have hCommonOrderTerminal : TreeVertexOrder + (ett.series.data.tree terminal.castSucc) common choice.vertex := by + simpa only [hTreeEq] using hCommonOrder + have hCommonTree : common ∈ TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc) := by + rcases hCommonOrderTerminal with ⟨i, j, hi, hj, hij⟩ + rw [← hi] + simp [TreeSequenceVertexSet] + have hCommonNe : common ≠ choice.vertex := by + intro heq + rcases hCommonOrderTerminal with ⟨i, j, hi, hj, hij⟩ + have hijEq : i = j := by + apply (ett.series.data.tree terminal.castSucc).vertex_injective + exact hi.trans (hj.trans heq.symm).symm + omega + have hBaseParallel := base.parallel hPE + have hSupportPosition : choice.vertex = + (ett.series.data.tree terminal.castSucc).vertex + base.supportPosition := by + apply Option.some.inj + exact currentVertex.symm.trans (by + simpa only [hTerminalLast, terminal] using hBaseParallel.1) + let supportPrefix := TreeSequencePrefix + (ett.series.data.tree terminal.castSucc) + base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt) + have hPrefixClosure : TashkinovClosure sigma supportPrefix base.closure := by + simpa only [supportPrefix, terminal] using hBaseParallel.2.1 + have initialVertices : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hAB x hx + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hx ⊢ + rcases hx with ⟨i, hi⟩ + rcases hAB with ⟨hlen, hvertices, hedges⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, + (hvertices i).trans hi⟩ + have vertexReach : ∀ {A B : TreeSequence G e0}, + TashkinovAugmentationSequence sigma A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hAB + unfold TashkinovAugmentationSequence at hAB + induction hAB using Relation.ReflTransGen.head_induction_on with + | refl => exact Finset.Subset.rfl + | @head A B hstep htail ih => + exact fun x hx => ih (initialVertices hstep.2.1 hx) + have hPrefixSubset : TreeSequenceVertexSet supportPrefix ⊆ + TreeSequenceVertexSet base.closure := vertexReach hPrefixClosure.1 + have hSupportPrefix : choice.vertex ∈ TreeSequenceVertexSet supportPrefix := by + exact @helper_hSupportPrefix_1126 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett hpositive sigma base choice hSupportPosition + have hCommonPrefix : common ∈ TreeSequenceVertexSet supportPrefix := by + exact @helper_hCommonPrefix_849 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett hpositive sigma base choice common hCommonOrderTerminal + hSupportPosition + have hSupportClosure : choice.vertex ∈ + TreeSequenceVertexSet base.closure := hPrefixSubset hSupportPrefix + have hCommonClosure : common ∈ + TreeSequenceVertexSet base.closure := hPrefixSubset hCommonPrefix + have hDegree : MaximumDegree G + 1 ≤ k := by + have hinitial := ett.series.certified (0 : Fin (ett.rounds + 1)) + cases hinitial with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => exact triple.2.2.1 + have hCommonMissing : (MissingColors G sigma common).Nonempty := + MissingColorsNonemptyOfMaximumDegree G sigma hDegree common + refine ⟨choice.vertex, common, gamma, choice.color, ?_, ?_, ?_, + hSupportTree, hSupportClosure, hCommonTree, hCommonClosure, hCommonNe, + hDeltaSigma, hGammaNotSigma, hCommonMissing, hSigmaElementary⟩ + · simpa only [hTerminalLast] using currentVertex + · simpa only [hTerminalLast] using currentGamma + · simpa only [hTerminalLast] using currentDelta + +private theorem helper_continuation_1031.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.PE → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → + ∀ (base : HierarchyBase ett sigma), StableColoring (ett.series.data.tree (Fin.last ett.rounds + : Fin (ett.rounds + (1 : ℕ))).castSucc) (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds : Fin (ett.rounds + (1 : ℕ)))) (ett.series.data.coloring (Fin.last ett.rounds : + Fin (ett.rounds + (1 : ℕ)))) sigma → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc) (TashkinovStoredColors ett.series.data + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (ett.series.data.coloring ((⟨ett.rounds - (1 : + ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc)), ett.series.data.coloring ((⟨ett.rounds - (1 + : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = TwoColorComponentSwap G secondStable gamma + choice.color (Sum.inl choice.vertex) → ett.series.data.connectingEdges ((⟨ett.rounds - (1 + : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = { choice.edge } → ett.series.data.kind + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = some choice.vertex → ett.series.data.delta + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = some choice.color → ett.series.data.gamma + ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ = some gamma → (Fin.last ett.rounds : Fin + (ett.rounds + (1 : ℕ))) = ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ → Fin.last ett.rounds = ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ → ett.series.data.tree (Fin.last ett.rounds : Fin + (ett.rounds + (1 : ℕ))).castSucc = ett.series.data.tree ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc → choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc) → gamma + ≠ choice.color → ( + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc)) → TreeIncidentEdge + (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc) f) → + ColoredVertexSetElementary G (ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) (TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc)) → StableColoring + (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc) (insert + choice.color (TashkinovStoredColors ett.series.data ((⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc)) choice.selected secondStable → + ColoredVertexSetElementary G secondStable (TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))).castSucc)) → choice.color ∉ + TreeMissingColors secondStable (ett.series.data.tree (Fin.last ett.rounds : Fin + (ett.rounds + (1 : ℕ))).castSucc) → ( + ∀ (f : E), TreeIncidentEdge (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 + : ℕ))).castSucc) f → Sum.inr f ∈ TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) → f = choice.edge) → choice.color ∈ MissingColors G + (ett.series.data.coloring (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ)))) + choice.vertex → ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds : Fin (ett.rounds + (1 + : ℕ))).castSucc), x ≠ choice.vertex → MissingColors G (ett.series.data.coloring (Fin.last + ett.rounds : Fin (ett.rounds + (1 : ℕ)))) x = MissingColors G secondStable x) → ( + ∀ c ∈ MissingColors G (ett.series.data.coloring (Fin.last ett.rounds : Fin (ett.rounds + (1 : + ℕ)))) choice.vertex, c ≠ choice.color → c ∈ MissingColors G secondStable choice.vertex) → + ∃ (support : V) (common : V) (gamma : Fin k) (delta : Fin k), ett.series.data.chosenVertex + (Fin.last ett.rounds) = some support ∧ ett.series.data.gamma (Fin.last ett.rounds) = some + gamma ∧ ett.series.data.delta (Fin.last ett.rounds) = some delta ∧ support ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ support ∈ + TreeSequenceVertexSet base.closure ∧ common ∈ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc) ∧ common ∈ TreeSequenceVertexSet base.closure ∧ common ≠ + support ∧ delta ∈ MissingColors G sigma support ∧ gamma ∉ TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ (MissingColors G sigma + common).Nonempty ∧ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive hPE sigma _ _ base + set terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds + set previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : + Fin ett.rounds) + intro hStableTerminal gamma secondStable choice currentColoring currentEdges currentKind + currentVertex currentDelta currentGamma hTerminalEq hTerminalLast hTreeEq hSupportTree + hGammaDelta boundaryIncident hPreviousElementary hSecondStable hSecondElementary + hDeltaNotTreeSecond hOnlyIncidentComponent hDeltaCurrentMissing hMissingAway + hMissingSupportOfNeDelta + have hCurrentElementary : ColoredVertexSetElementary G + (ett.series.data.coloring terminal) + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) := by + exact @helper_hCurrentElementary_640 V E inferInstance inferInstance + inferInstance G k e0 input T phi ett hpositive secondStable choice hSupportTree + hSecondElementary hDeltaNotTreeSecond hMissingAway hMissingSupportOfNeDelta + have hSigmaElementary : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) := by + intro u hu v hv huv + rw [hStableTerminal.2 u hu, hStableTerminal.2 v hv] + exact hCurrentElementary hu hv huv + have hDeltaSigma : choice.color ∈ MissingColors G sigma + choice.vertex := by + rw [hStableTerminal.2 choice.vertex hSupportTree] + exact hDeltaCurrentMissing + have hBoundaryFacts := HkuParallelBoundaryStructure G k ett.rounds e0 + input ett.series previous choice.edge choice.color gamma choice.vertex + currentKind currentEdges currentDelta currentGamma currentVertex + have hPreviousElementaryBoundary : ColoredVertexSetElementary G + (ett.series.data.coloring previous.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree previous.succ.castSucc)) := by + intro u hu v hv huv + apply hPreviousElementary + · simpa only [hTreeEq] using hu + · simpa only [hTreeEq] using hv + · exact huv + have hGammaNotCurrent : gamma ∉ TreeMissingColors + (ett.series.data.coloring terminal) + (ett.series.data.tree terminal.castSucc) := by + intro hmissing + have hempty := hBoundaryFacts.2.2 hPreviousElementaryBoundary gamma + (by simpa only [hTerminalEq] using hmissing) hGammaDelta + have hsingleton := hBoundaryFacts.1 + rw [hempty] at hsingleton + simp at hsingleton + have hGammaNotSigma : gamma ∉ TreeMissingColors sigma + (ett.series.data.tree terminal.castSucc) := by + intro hmissing + rw [TreeMissingColors] at hmissing + rcases Finset.mem_biUnion.mp hmissing with ⟨v, hv, hvmissing⟩ + apply hGammaNotCurrent + rw [TreeMissingColors] + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [← hStableTerminal.2 v hv] + exact hvmissing + rcases choice.edgeDefective with + ⟨edgeColor, hDefectiveColor, hChoiceBoundaryColor⟩ + have hEdgeColorEq : edgeColor = choice.color := by + apply Option.some.inj + exact (Finset.mem_filter.mp hChoiceBoundaryColor).2.symm.trans + choice.edgeColor + subst edgeColor + have hBoundaryCard : 1 < + (BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) choice.color).card := by + have hcard : 2 ≤ + (BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) choice.color).card := by + unfold DefectiveColor at hDefectiveColor + simpa only [hTreeEq] using hDefectiveColor + omega + obtain ⟨a, ha, b, hb, hab⟩ := Finset.one_lt_card.mp hBoundaryCard + obtain ⟨g, hgBoundarySelected, hgNe⟩ : + ∃ g, g ∈ BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) choice.color ∧ + g ≠ choice.edge := by + by_cases hae : a = choice.edge + · exact ⟨b, hb, by + intro hbe + exact hab (hae.trans hbe.symm)⟩ + · exact ⟨a, ha, hae⟩ + have hgBoundary : g ∈ BoundaryEdges G + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) := + (Finset.mem_filter.mp hgBoundarySelected).1 + have hgSelected : choice.selected g = some choice.color := + (Finset.mem_filter.mp hgBoundarySelected).2 + have hgSecond : secondStable g = some choice.color := by + have hfix := hSecondStable.1 g (boundaryIncident hgBoundary) + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), hgSelected⟩ + exact hfix.trans hgSelected + have hgOutside : Sum.inr g ∉ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + intro hgComponent + have htree := boundaryIncident hgBoundary + have hgeq := hOnlyIncidentComponent g htree hgComponent + exact hgNe hgeq + have hgCurrent : ett.series.data.coloring terminal g = + some choice.color := by + rw [hTerminalEq, currentColoring] + simpa [TwoColorComponentSwap, hgOutside] using hgSecond + have hgBoundaryCurrent : g ∈ BoundaryColorEdges G + (ett.series.data.coloring terminal) + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) choice.color := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hgBoundary, hgCurrent⟩ + exact @helper_continuation_963 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett hpositive hPE sigma base gamma choice currentVertex currentDelta + currentGamma hTerminalEq hTerminalLast hTreeEq hSupportTree hSigmaElementary hDeltaSigma + hBoundaryFacts hGammaNotSigma g hgBoundaryCurrent +private theorem helper_continuation_1628.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), ett.series.data.kind (Fin.last + ett.rounds) = some TashkinovExtensionKind.PE → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → + ∀ (base : HierarchyBase ett sigma), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); StableColoring (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal) (ett.series.data.coloring terminal) sigma + → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree previous.succ.castSucc) (TashkinovStoredColors ett.series.data + previous.castSucc) (ett.series.data.coloring previous.castSucc)), ett.series.data.coloring + previous.succ = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex) → ett.series.data.connectingEdges previous.succ = ({ choice.edge } : Finset + E) → ett.series.data.kind previous.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex previous.succ = some choice.vertex → ett.series.data.delta + previous.succ = some choice.color → ett.series.data.gamma previous.succ = some gamma → + terminal = previous.succ → Fin.last ett.rounds = previous.succ → ett.series.data.tree + terminal.castSucc = ett.series.data.tree previous.succ.castSucc → choice.vertex ∈ + TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc) → secondStable choice.edge + = some choice.color → gamma ≠ choice.color → ( + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc)) → TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f) → + ColoredVertexSetElementary G (ett.series.data.coloring previous.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc)) → StableColoring + (ett.series.data.tree terminal.castSucc) (insert choice.color (TashkinovStoredColors + ett.series.data previous.castSucc) : Finset (Fin k)) choice.selected secondStable → + ColoredVertexSetElementary G secondStable (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc)) → choice.color ∉ TreeMissingColors secondStable (ett.series.data.tree + terminal.castSucc) → ( + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), Sum.inl x ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) ↔ x = + choice.vertex) → Sum.inr choice.edge ∈ TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) → ( + ∀ (f : E), TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f → Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → f = + choice.edge) → choice.color ∈ MissingColors G (ett.series.data.coloring terminal) + choice.vertex → + ∃ (support : V) (common : V) (gamma : Fin k) (delta : Fin k), ett.series.data.chosenVertex + (Fin.last ett.rounds) = some support ∧ ett.series.data.gamma (Fin.last ett.rounds) = some + gamma ∧ ett.series.data.delta (Fin.last ett.rounds) = some delta ∧ support ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ support ∈ + TreeSequenceVertexSet base.closure ∧ common ∈ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc) ∧ common ∈ TreeSequenceVertexSet base.closure ∧ common ≠ + support ∧ delta ∈ MissingColors G sigma support ∧ gamma ∉ TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ (MissingColors G sigma + common).Nonempty ∧ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive hPE sigma _ _ base terminal previous + hStableTerminal gamma secondStable choice currentColoring currentEdges currentKind + currentVertex currentDelta currentGamma hTerminalEq hTerminalLast hTreeEq hSupportTree + hChoiceSecond hGammaDelta boundaryIncident hPreviousElementary hSecondStable + hSecondElementary hDeltaNotTreeSecond hComponentSecond hChoiceComponent + hOnlyIncidentComponent hDeltaCurrentMissing + have hFixAway : + ∀ (x : V), x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc) → x ≠ + choice.vertex → + ∀ (f : E), Incident G x f → ett.series.data.coloring terminal f = secondStable f := by + exact @helper_hFixAway_566 V E inferInstance inferInstance inferInstance G k e0 input T phi + ett hpositive gamma secondStable choice currentColoring hTerminalEq hChoiceSecond + hComponentSecond hChoiceComponent hOnlyIncidentComponent + have hMissingAway : + ∀ (x : V), x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc) → x ≠ + choice.vertex → MissingColors G (ett.series.data.coloring terminal) x = MissingColors G + secondStable x := by + exact @helper_hMissingAway_947 V E inferInstance inferInstance inferInstance G k e0 input T + phi ett hpositive secondStable choice hFixAway + have hMissingSupportOfNeDelta : + ∀ (c : Fin k), c ∈ MissingColors G (ett.series.data.coloring terminal) choice.vertex → c ≠ + choice.color → c ∈ MissingColors G secondStable choice.vertex := by + exact @helper_hMissingSupportOfNeDelta_612 V E inferInstance inferInstance inferInstance G k + e0 input T phi ett hpositive gamma secondStable choice currentColoring hTerminalEq + hSupportTree hChoiceSecond hOnlyIncidentComponent + exact @helper_continuation_1031 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett hpositive hPE sigma (by assumption) (by assumption) base hStableTerminal + gamma secondStable choice currentColoring currentEdges currentKind currentVertex + currentDelta currentGamma hTerminalEq hTerminalLast hTreeEq hSupportTree hGammaDelta + boundaryIncident hPreviousElementary hSecondStable hSecondElementary hDeltaNotTreeSecond + hOnlyIncidentComponent hDeltaCurrentMissing hMissingAway hMissingSupportOfNeDelta + +private theorem helper_continuation_991.{u_1, u_2} : + helperContinuation991Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hMP hpositive hPE sigma _ _ base + set terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds + set previous : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : + Fin ett.rounds) + intro hStableTerminal gamma secondStable secondStableProper secondStableOneUncolored + previousProper previousOneUncolored previousClosed choice currentColoring currentProper + currentOneUncolored currentEdges currentKind currentVertex currentDelta currentGamma + hTerminalEq hTerminalLast hTreeEq hSupportTree hGammaSecond hChoiceSecond hGammaDelta + hChoiceBoundary boundaryIncident hPreviousElementary hSelectedStable hSecondStable + previousSubtype selectedSubtype secondSubtype hSelectedReverseSubtype hSecondReverseSubtype + have hSecondElementary : ColoredVertexSetElementary G secondStable + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) := by + intro u hu v hv huv + rw [hSecondStable.2 u hu, hSecondStable.2 v hv, + hSelectedStable.2 u hu, hSelectedStable.2 v hv] + exact hPreviousElementary hu hv huv + have hSecondClosed : ColoredVertexSetClosed G secondStable + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) := by + exact @helper_hSecondClosed_343 V E inferInstance inferInstance inferInstance G k e0 input T + phi ett hpositive secondStable secondStableProper secondStableOneUncolored previousProper + previousOneUncolored previousClosed choice hTreeEq boundaryIncident hSelectedStable + hSecondStable hSelectedReverseSubtype hSecondReverseSubtype + have hDeltaNotTreeSecond : choice.color ∉ + TreeMissingColors secondStable + (ett.series.data.tree terminal.castSucc) := by + intro hmissing + rw [TreeMissingColors] at hmissing + rcases Finset.mem_biUnion.mp hmissing with ⟨v, hv, hvmissing⟩ + exact (hSecondClosed hChoiceBoundary hv hChoiceSecond) hvmissing + have hCurrentStable : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) + (ett.series.data.coloring terminal) := by + let currentSubtype : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨ett.series.data.coloring terminal, + by simpa only [hTerminalEq] using currentProper, + by simpa only [hTerminalEq] using currentOneUncolored⟩ + exact (sc2 G e0 (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal)).refl currentSubtype + have hComponentCurrent : + ∀ x, x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc) → (Sum.inl x ∈ + TwoColorComponent G (ett.series.data.coloring terminal) gamma choice.color (Sum.inl + choice.vertex) ↔ x = choice.vertex) := by + exact @helper_hComponentCurrent_860 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett ctx hMP hpositive gamma choice currentProper + currentOneUncolored currentKind currentVertex currentDelta currentGamma hTerminalEq + hTerminalLast hCurrentStable + have hPairColors : + ∀ f : E, (ett.series.data.coloring terminal f = some gamma ∨ ett.series.data.coloring terminal + f = some choice.color) ↔ (secondStable f = some gamma ∨ secondStable f = some + choice.color) := by + exact @helper_hPairColors_420 V E inferInstance inferInstance inferInstance G k e0 input T + phi ett hpositive gamma secondStable choice currentColoring hTerminalEq hGammaDelta + have hGraph : TwoColorIncidenceGraph G + (ett.series.data.coloring terminal) gamma choice.color = + TwoColorIncidenceGraph G secondStable gamma choice.color := by + ext x y + cases x <;> cases y <;> + simp [TwoColorIncidenceGraph, hPairColors] + have hComponents (z : Sum V E) : + TwoColorComponent G (ett.series.data.coloring terminal) + gamma choice.color z = + TwoColorComponent G secondStable gamma choice.color z := by + unfold TwoColorComponent + rw [hGraph] + have hComponentSecond : + ∀ x, x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc) → (Sum.inl x ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) ↔ x = + choice.vertex) := by + intro x hx + rw [← hComponents] + exact hComponentCurrent x hx + have hComponentEdgeColor : + ∀ f, Sum.inr f ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → + secondStable f = some gamma ∨ secondStable f = some choice.color := by + exact @helper_hComponentEdgeColor_910 V E inferInstance inferInstance inferInstance G k e0 + input T phi ett hpositive gamma secondStable choice + have hChoiceComponent : Sum.inr choice.edge ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hChoiceSecond] + have hOnlyIncidentComponent : + ∀ (f : E), TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f → Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → f = + choice.edge := by + exact @helper_hOnlyIncidentComponent_489 V E inferInstance inferInstance inferInstance G k e0 + input T phi ett hpositive gamma secondStable secondStableProper choice hGammaSecond + hChoiceSecond hComponentSecond hComponentEdgeColor + have hDeltaCurrentMissing : choice.color ∈ MissingColors G + (ett.series.data.coloring terminal) choice.vertex := by + exact @helper_hDeltaCurrentMissing_531 V E inferInstance inferInstance inferInstance G k e0 + input T phi ett hpositive gamma secondStable secondStableProper choice currentColoring + hTerminalEq hGammaSecond hChoiceSecond hGammaDelta hChoiceComponent + exact @helper_continuation_1628 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) (@hPE) (@sigma) (by + assumption) (by assumption) (@base) (@hStableTerminal) (@gamma) (@secondStable) (@choice) + (@currentColoring) (@currentEdges) (@currentKind) (@currentVertex) (@currentDelta) + (@currentGamma) (@hTerminalEq) (@hTerminalLast) (@hTreeEq) (@hSupportTree) (@hChoiceSecond) + (@hGammaDelta) (@boundaryIncident) (@hPreviousElementary) (@hSecondStable) + (@hSecondElementary) (@hDeltaNotTreeSecond) (@hComponentSecond) (@hChoiceComponent) + (@hOnlyIncidentComponent) (@hDeltaCurrentMissing) +private theorem helper_branch_133.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), TechnicalInductionContext G k e0 ett.rounds → MaximumProperty ett → + ∀ (_ : (0 : ℕ) < ett.rounds), ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → + ∀ (base : HierarchyBase ett sigma), StableColoring (ett.series.data.tree (Fin.last ett.rounds + : Fin (ett.rounds + (1 : ℕ))).castSucc) (TashkinovStoredColors ett.series.data (Fin.last + ett.rounds : Fin (ett.rounds + (1 : ℕ)))) (ett.series.data.coloring (Fin.last ett.rounds : + Fin (ett.rounds + (1 : ℕ)))) sigma → + ∀ (ci : Fin ett.rounds), IsProperEdgeColoring G (ett.series.data.coloring ci.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring ci.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring ci.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring + ci.castSucc) (TreeSequenceVertexSet (ett.series.data.tree ci.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate ett.series.data ci.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree ci.succ.castSucc) + (TashkinovStoredColors ett.series.data ci.castSucc) (ett.series.data.coloring + ci.castSucc)), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (ett.series.data.tree + ci.succ.castSucc))) → + ∀ (gamma : Fin k), ParallelExtensionColor ett.series.data ci.castSucc choice.selected + choice.vertex gamma → + ∀ (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + IsOneEdgeUncolored secondStable e0 → StableColoring (ett.series.data.tree + ci.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data + ci.castSucc)) choice.selected secondStable → TreeExit (ett.series.data.tree + ci.succ.castSucc) secondStable gamma choice.color choice.vertex → ett.series.data.coloring + ci.succ = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex) + → IsProperEdgeColoring G (ett.series.data.coloring ci.succ) → IsOneEdgeUncolored + (ett.series.data.coloring ci.succ) e0 → ett.series.data.stored ci.succ = + { choice.color, gamma } → ett.series.data.connectingEdges ci.succ = { choice.edge } → + ett.series.data.kind ci.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex ci.succ = some choice.vertex → ett.series.data.outsideVertex + ci.succ = some choice.otherEndpoint → ett.series.data.delta ci.succ = some choice.color → + ett.series.data.gamma ci.succ = some gamma → TashkinovClosure (ett.series.data.coloring + ci.succ) (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree ci.succ.succ) → + TreeSequenceInitialSegment (ett.series.data.tree ci.succ.castSucc) (ett.series.data.tree + ci.succ.succ) → (ett.series.data.tree ci.succ.castSucc).length < (ett.series.data.tree + ci.succ.succ).length → (Fin.last ett.rounds : Fin (ett.rounds + (1 : ℕ))) = ci.succ → + ∃ (support : V) (common : V) (gamma : Fin k) (delta : Fin k), ett.series.data.chosenVertex + (Fin.last ett.rounds) = some support ∧ ett.series.data.gamma (Fin.last ett.rounds) = some + gamma ∧ ett.series.data.delta (Fin.last ett.rounds) = some delta ∧ support ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ support ∈ + TreeSequenceVertexSet base.closure ∧ common ∈ TreeSequenceVertexSet (ett.series.data.tree + (Fin.last ett.rounds).castSucc) ∧ common ∈ TreeSequenceVertexSet base.closure ∧ common ≠ + support ∧ delta ∈ MissingColors G sigma support ∧ gamma ∉ TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∧ (MissingColors G sigma + common).Nonempty ∧ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hMP hpositive hPE sigma _ _ base + set terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds + let previous : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by omega⟩ : + Fin ett.rounds) + intro hStableTerminal ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule + secondStable secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension hslot + have hci : ci = previous := by + apply Fin.ext + have hs := congrArg Fin.val hslot + simp [terminal, previous] at hs ⊢ + omega + subst ci + have hTerminalEq : terminal = previous.succ := hslot + have hTerminalLast : Fin.last ett.rounds = previous.succ := by + simpa only [terminal] using hTerminalEq + have hTreeEq : ett.series.data.tree terminal.castSucc = + ett.series.data.tree previous.succ.castSucc := by + rw [hTerminalEq] + have hSupportTree : choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc) := by + simpa only [hTreeEq] using choice.vertexDefective.1 + have hGammaSecond : gamma ∈ MissingColors G secondStable + choice.vertex := by + rw [secondStableRelation.2 choice.vertex choice.vertexDefective.1] + exact gammaRule.1 + have hChoiceSecond : secondStable choice.edge = some choice.color := by + have hfix := secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), choice.edgeColor⟩ + exact hfix.trans choice.edgeColor + have hGammaDelta : gamma ≠ choice.color := by + intro heq + have hpresent : gamma ∈ PresentColors G secondStable + choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨choice.edge, choice.edgeIncident, heq ▸ hChoiceSecond⟩ + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hGammaSecond + exact hnot hpresent + have hChoiceBoundary : choice.edge ∈ BoundaryEdges G + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) := by + rcases choice.edgeDefective with ⟨c, hcDefective, hcEdge⟩ + have hcValue := (Finset.mem_filter.mp hcEdge).2 + have hcEq : c = choice.color := + Option.some.inj (hcValue.symm.trans choice.edgeColor) + simpa only [hTreeEq] using (Finset.mem_filter.mp hcEdge).1 + have boundaryIncident : + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc)) → TreeIncidentEdge (ett.series.data.tree terminal.castSucc) f := by + intro f hf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hf + rcases hf with ⟨x, hx, y, hy, hxy⟩ + exact ⟨x, hx, by simp [Incident, hxy]⟩ + have hPreviousElementary : ColoredVertexSetElementary G + (ett.series.data.coloring previous.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree terminal.castSucc)) := by + exact @helper_hPreviousElementary_238 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett ctx hMP hpositive + have hSelectedStable : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) + (ett.series.data.coloring previous.castSucc) choice.selected := by + simpa only [hTreeEq] using choice.selectedStable + have hSecondStable : StableColoring + (ett.series.data.tree terminal.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data previous.castSucc)) + choice.selected secondStable := by + simpa only [hTreeEq] using secondStableRelation + let previousSubtype : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨ett.series.data.coloring previous.castSucc, + previousProper, previousOneUncolored⟩ + let selectedSubtype : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨choice.selected, choice.selectedProper, choice.selectedOneUncolored⟩ + let secondSubtype : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨secondStable, secondStableProper, secondStableOneUncolored⟩ + have hSelectedForwardSubtype : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) + previousSubtype.1 selectedSubtype.1 := by + simpa [previousSubtype, selectedSubtype] using hSelectedStable + have hSelectedReverseSubtype : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc) + selectedSubtype.1 previousSubtype.1 := by + exact (sc2 G e0 (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data previous.castSucc)).symm + hSelectedForwardSubtype + have hSecondForwardSubtype : StableColoring + (ett.series.data.tree terminal.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data previous.castSucc)) + selectedSubtype.1 secondSubtype.1 := by + simpa [selectedSubtype, secondSubtype] using hSecondStable + have hSecondReverseSubtype : StableColoring + (ett.series.data.tree terminal.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data previous.castSucc)) + secondSubtype.1 selectedSubtype.1 := by + exact (sc2 G e0 (ett.series.data.tree terminal.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data previous.castSucc))).symm + hSecondForwardSubtype + exact @helper_continuation_991 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett ctx hMP hpositive hPE sigma (by assumption) (by assumption) base + hStableTerminal gamma secondStable secondStableProper secondStableOneUncolored + previousProper previousOneUncolored previousClosed choice currentColoring currentProper + currentOneUncolored currentEdges currentKind currentVertex currentDelta currentGamma + hTerminalEq hTerminalLast hTreeEq hSupportTree hGammaSecond hChoiceSecond hGammaDelta + hChoiceBoundary boundaryIncident hPreviousElementary hSelectedStable hSecondStable + hSelectedReverseSubtype hSecondReverseSubtype +theorem ParallelTerminalPEPreprocessing {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (ctx : TechnicalInductionContext G k e0 ett.rounds) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) + (sigma : PartialEdgeColoring E k) + (_ : IsProperEdgeColoring G sigma) + (_ : IsOneEdgeUncolored sigma e0) + (hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma) + (base : HierarchyBase ett sigma) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + ∃ support common : V, + ∃ gamma delta : Fin k, + ett.series.data.chosenVertex n = some support ∧ + ett.series.data.gamma n = some gamma ∧ + ett.series.data.delta n = some delta ∧ + support ∈ TreeSequenceVertexSet Tn ∧ + support ∈ TreeSequenceVertexSet base.closure ∧ + common ∈ TreeSequenceVertexSet Tn ∧ + common ∈ TreeSequenceVertexSet base.closure ∧ + common ≠ support ∧ + delta ∈ MissingColors G sigma support ∧ + gamma ∉ TreeMissingColors sigma Tn ∧ + (MissingColors G sigma common).Nonempty ∧ + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Tn) := by + dsimp only + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let previous : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hPreviousSucc : previous.succ = terminal := by + apply Fin.ext + simp [previous, terminal] + omega + have hStableTerminal : StableColoring + (ett.series.data.tree terminal.castSucc) + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma := by + rw [← ett.generatingColoring] + exact hstable + have cert := ett.series.certified terminal + generalize hslot : terminal = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hz := congrArg Fin.val hslot + simp [terminal] at hz + omega + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hterm := hPE + change ett.series.data.kind terminal = + some TashkinovExtensionKind.PE at hterm + rw [hslot, currentKind] at hterm + simp at hterm + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hterm := hPE + change ett.series.data.kind terminal = + some TashkinovExtensionKind.PE at hterm + rw [hslot, currentKind] at hterm + simp at hterm + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_133 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett ctx hMP hpositive hPE sigma (by assumption) (by assumption) + base hStableTerminal ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma + gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension hslot +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ParallelTwoConstituentPathContradiction.lean b/LeanPool/GoldbergSeymour/ParallelTwoConstituentPathContradiction.lean new file mode 100644 index 0000000000..7f0233d700 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ParallelTwoConstituentPathContradiction.lean @@ -0,0 +1,361 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.OrderedTreeUnion + +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors + +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath + +/-! +# Parallel Two Constituent Path Contradiction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ParallelTwoConstituentPathContradiction_missing_leaf_163.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : + ℕ) (e0 : E) (sigma : PartialEdgeColoring E k) (right : TreeSequence G e0), + IsProperEdgeColoring G sigma → ColoredVertexSetClosed G sigma (TreeSequenceVertexSet + right) → ∀ (alpha beta : Fin k), let H := TwoColorIncidenceGraph G sigma alpha beta; ∀ (x + : V), alpha ∈ MissingColors G sigma x ∨ beta ∈ MissingColors G sigma x → (H.neighborSet + (Sum.inl x)).Subsingleton := by + classical + intro V E _ _ G k e0 sigma right hproper _ alpha beta H x hmissing z hz w hw + cases hzv : z with + | inl y => + rw [hzv] at hz + simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz + | inr e => + cases hwv : w with + | inl y => + rw [hwv] at hw + simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw + | inr f => + rw [hzv] at hz + rw [hwv] at hw + have he : Incident G x e ∧ + (sigma e = some alpha ∨ sigma e = some beta) := by + simpa [H, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hz + have hf : Incident G x f ∧ + (sigma f = some alpha ∨ sigma f = some beta) := by + simpa [H, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hw + apply congrArg Sum.inr + by_contra hef + rcases hmissing with ha | hb + · have hna : alpha ∉ PresentColors G sigma x := by + simpa [MissingColors] using ha + have heBeta : sigma e = some beta := he.2.resolve_left (by + intro heAlpha + apply hna + simpa [PresentColors] using + (show ∃ q, Incident G x q ∧ sigma q = some alpha from + ⟨e, he.1, heAlpha⟩)) + have hfBeta : sigma f = some beta := hf.2.resolve_left (by + intro hfAlpha + apply hna + simpa [PresentColors] using + (show ∃ q, Incident G x q ∧ sigma q = some alpha from + ⟨f, hf.1, hfAlpha⟩)) + exact (hproper hef ⟨x, he.1, hf.1⟩ heBeta) hfBeta + · have hnb : beta ∉ PresentColors G sigma x := by + simpa [MissingColors] using hb + have heAlpha : sigma e = some alpha := he.2.resolve_right (by + intro heBeta + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G x q ∧ sigma q = some beta from + ⟨e, he.1, heBeta⟩)) + have hfAlpha : sigma f = some alpha := hf.2.resolve_right (by + intro hfBeta + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G x q ∧ sigma q = some beta from + ⟨f, hf.1, hfBeta⟩)) + exact (hproper hef ⟨x, he.1, hf.1⟩ heAlpha) hfAlpha + +private theorem ParallelTwoConstituentPathContradiction_continuation_235.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : + ℕ) (e0 : E) (sigma : PartialEdgeColoring E k) (left right : TreeSequence G e0), + IsProperEdgeColoring G sigma → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + left) → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet right) → + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet right) → ∀ (support common : V), + common ∈ TreeSequenceVertexSet left → common ∈ TreeSequenceVertexSet right → ∀ (alpha : + Fin k) (u v : V), u ∈ TreeSequenceVertexSet left → v ∈ TreeSequenceVertexSet right → u ≠ v + → alpha ∈ MissingColors G sigma u → alpha ∈ MissingColors G sigma v → u ≠ common → v ≠ + common → v ≠ support → ∀ beta ∈ MissingColors G sigma common, alpha ≠ beta → + TreeInterchangeable G left sigma alpha beta → TreeInterchangeable G right sigma alpha beta + → let H := TwoColorIncidenceGraph G sigma alpha beta; (∀ (x : V), alpha ∈ MissingColors G + sigma x ∨ beta ∈ MissingColors G sigma x → (H.neighborSet (Sum.inl x)).Subsingleton) → + False := by + classical + intro V E _ _ G k e0 sigma left right hproper hleftElementary hrightElementary _ support common + hcommonLeft hcommonRight alpha u v huLeft hvRight huv halphaU halphaV huCommon hvCommon + hvSupport beta hbetaCommon halphaBeta hleft hright H missing_leaf + have hbetaPresentU : beta ∈ PresentColors G sigma u := by + by_contra hnotPresent + have hmissing : beta ∈ MissingColors G sigma u := by + simpa [MissingColors] using hnotPresent + exact (Finset.disjoint_left.mp + (hleftElementary huLeft hcommonLeft huCommon)) hmissing hbetaCommon + have hbetaPresentV : beta ∈ PresentColors G sigma v := by + by_contra hnotPresent + have hmissing : beta ∈ MissingColors G sigma v := by + simpa [MissingColors] using hnotPresent + exact (Finset.disjoint_left.mp + (hrightElementary hvRight hcommonRight hvCommon)) hmissing hbetaCommon + have halphaPresentCommon : alpha ∈ PresentColors G sigma common := by + by_contra hnotPresent + have hmissing : alpha ∈ MissingColors G sigma common := by + simpa [MissingColors] using hnotPresent + exact (Finset.disjoint_left.mp + (hleftElementary huLeft hcommonLeft huCommon)) halphaU hmissing + have present_neighbor (x : V) + (hpresent : alpha ∈ PresentColors G sigma x ∨ + beta ∈ PresentColors G sigma x) : + (H.neighborSet (Sum.inl x)).Nonempty := by + rcases hpresent with hpresent | hpresent + · obtain ⟨e, he, hcolor⟩ := by simpa [PresentColors] using hpresent + refine ⟨Sum.inr e, ?_⟩ + simpa [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] using + (show Incident G x e ∧ + (sigma e = some alpha ∨ sigma e = some beta) from + ⟨he, Or.inl hcolor⟩) + · obtain ⟨e, he, hcolor⟩ := by simpa [PresentColors] using hpresent + refine ⟨Sum.inr e, ?_⟩ + simpa [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] using + (show Incident G x e ∧ + (sigma e = some alpha ∨ sigma e = some beta) from + ⟨he, Or.inr hcolor⟩) + have huLeaf := missing_leaf u (Or.inl halphaU) + have hvLeaf := missing_leaf v (Or.inl halphaV) + have hcommonLeaf := missing_leaf common (Or.inr hbetaCommon) + have huDegreeOne : (H.neighborSet (Sum.inl u)).Nonempty ∧ + Set.Subsingleton (H.neighborSet (Sum.inl u)) := + ⟨present_neighbor u (Or.inr hbetaPresentU), huLeaf⟩ + have hvDegreeOne : (H.neighborSet (Sum.inl v)).Nonempty ∧ + Set.Subsingleton (H.neighborSet (Sum.inl v)) := + ⟨present_neighbor v (Or.inr hbetaPresentV), hvLeaf⟩ + have hcommonDegreeOne : (H.neighborSet (Sum.inl common)).Nonempty ∧ + Set.Subsingleton (H.neighborSet (Sum.inl common)) := + ⟨present_neighbor common (Or.inl halphaPresentCommon), hcommonLeaf⟩ + have self_mem (x : V) : Sum.inl x ∈ + TwoColorComponent G sigma alpha beta (Sum.inl x) := + (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + have huPath : TwoColorPathComponent G sigma alpha beta (Sum.inl u) := + ⟨halphaBeta, Sum.inl u, self_mem u, huDegreeOne.2⟩ + have hvPath : TwoColorPathComponent G sigma alpha beta (Sum.inl v) := + ⟨halphaBeta, Sum.inl v, self_mem v, hvDegreeOne.2⟩ + have hcommonPath : TwoColorPathComponent G sigma alpha beta + (Sum.inl common) := + ⟨halphaBeta, Sum.inl common, self_mem common, hcommonDegreeOne.2⟩ + have hcompUCommon := hleft (Sum.inl u) (Sum.inl common) + huPath hcommonPath ⟨u, huLeft, self_mem u⟩ + ⟨common, hcommonLeft, self_mem common⟩ + have hcompVCommon := hright (Sum.inl v) (Sum.inl common) + hvPath hcommonPath ⟨v, hvRight, self_mem v⟩ + ⟨common, hcommonRight, self_mem common⟩ + obtain ⟨a, b, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G sigma alpha beta hproper (Sum.inl common) + have huComponent : Sum.inl u ∈ + TwoColorComponent G sigma alpha beta (Sum.inl common) := by + rw [← hcompUCommon] + exact self_mem u + have hvComponent : Sum.inl v ∈ + TwoColorComponent G sigma alpha beta (Sum.inl common) := by + rw [← hcompVCommon] + exact self_mem v + have huSupport : Sum.inl u ∈ p.support := by + change Sum.inl u ∈ {x | x ∈ p.support} + rw [hsupport] + exact huComponent + have hvSupport : Sum.inl v ∈ p.support := by + change Sum.inl v ∈ {x | x ∈ p.support} + rw [hsupport] + exact hvComponent + have hcommonSupport : Sum.inl common ∈ p.support := by + change Sum.inl common ∈ {x | x ∈ p.support} + rw [hsupport] + exact self_mem common + have huEnd : Sum.inl u = a ∨ Sum.inl u = b := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 huDegreeOne.2) huSupport + have hvEnd : Sum.inl v = a ∨ Sum.inl v = b := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hvDegreeOne.2) hvSupport + have hcommonEnd : Sum.inl common = a ∨ Sum.inl common = b := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hcommonDegreeOne.2) hcommonSupport + have huv' : (Sum.inl u : Sum V E) ≠ Sum.inl v := by simpa using huv + have huCommon' : (Sum.inl u : Sum V E) ≠ Sum.inl common := by + simpa using huCommon + have hvCommon' : (Sum.inl v : Sum V E) ≠ Sum.inl common := by + simpa using hvCommon + rcases huEnd with hua | hub <;> rcases hvEnd with hva | hvb <;> + rcases hcommonEnd with hca | hcb <;> aesop + +theorem ParallelTwoConstituentPathContradiction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (sigma : PartialEdgeColoring E k) + (left right union : TreeSequence G e0) + (hunion : Nonempty (OrderedTreeUnion left right union)) + (hproper : IsProperEdgeColoring G sigma) + (hleftElementary : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet left)) + (hrightElementary : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet right)) + (_ : ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet right)) + (support common : V) (gamma delta : Fin k) + (hsupportLeft : support ∈ TreeSequenceVertexSet left) + (hsupportRight : support ∈ TreeSequenceVertexSet right) + (hcommonLeft : common ∈ TreeSequenceVertexSet left) + (hcommonRight : common ∈ TreeSequenceVertexSet right) + (hcommonNe : common ≠ support) + (hdelta : delta ∈ MissingColors G sigma support) + (hgamma : gamma ∉ TreeMissingColors sigma left) + (hcommonMissing : (MissingColors G sigma common).Nonempty) + (hleftInterchangeable : ∀ alpha beta : Fin k, + alpha ∈ TreeMissingColors sigma left → + beta ∈ TreeMissingColors sigma left → + alpha ≠ gamma → alpha ≠ delta → + beta ≠ gamma → beta ≠ delta → + TreeInterchangeable G left sigma alpha beta) + (hrightInterchangeable : ∀ alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma right ∨ + beta ∈ TreeMissingColors sigma right) → + TreeInterchangeable G right sigma alpha beta) : + ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet union) := by + classical + by_contra hnotElementary + unfold ColoredVertexSetElementary at hnotElementary + have hbad : ∃ u, u ∈ TreeSequenceVertexSet union ∧ + ∃ v, v ∈ TreeSequenceVertexSet union ∧ u ≠ v ∧ + ¬ Disjoint (MissingColors G sigma u) (MissingColors G sigma v) := by + by_contra hnone + apply hnotElementary + intro u hu v hv huv + by_contra hdisjoint + exact hnone ⟨u, hu, v, hv, huv, hdisjoint⟩ + obtain ⟨u0, hu0, v0, hv0, huv0, hdisjoint⟩ := hbad + rw [Finset.disjoint_left] at hdisjoint + push Not at hdisjoint + obtain ⟨alpha, halphaU0, halphaV0⟩ := hdisjoint + obtain ⟨hordered⟩ := hunion + rw [hordered.vertexSet] at hu0 hv0 + obtain ⟨u, v, huLeft, huNotRight, hvRight, hvNotLeft, huv, + halphaU, halphaV⟩ : + ∃ u v : V, + u ∈ TreeSequenceVertexSet left ∧ + u ∉ TreeSequenceVertexSet right ∧ + v ∈ TreeSequenceVertexSet right ∧ + v ∉ TreeSequenceVertexSet left ∧ + u ≠ v ∧ alpha ∈ MissingColors G sigma u ∧ + alpha ∈ MissingColors G sigma v := by + rcases Finset.mem_union.mp hu0 with huLeft | huRight <;> + rcases Finset.mem_union.mp hv0 with hvLeft | hvRight + · exact False.elim + ((Finset.disjoint_left.mp + (hleftElementary huLeft hvLeft huv0)) halphaU0 halphaV0) + · refine ⟨u0, v0, huLeft, ?_, hvRight, ?_, huv0, + halphaU0, halphaV0⟩ + · intro huRight + exact (Finset.disjoint_left.mp + (hrightElementary huRight hvRight huv0)) halphaU0 halphaV0 + · intro hvLeft + exact (Finset.disjoint_left.mp + (hleftElementary huLeft hvLeft huv0)) halphaU0 halphaV0 + · refine ⟨v0, u0, hvLeft, ?_, huRight, ?_, huv0.symm, + halphaV0, halphaU0⟩ + · intro hvRight + exact (Finset.disjoint_left.mp + (hrightElementary hvRight huRight huv0.symm)) halphaV0 halphaU0 + · intro huLeft + exact (Finset.disjoint_left.mp + (hleftElementary huLeft hvLeft huv0)) halphaU0 halphaV0 + · exact False.elim + ((Finset.disjoint_left.mp + (hrightElementary huRight hvRight huv0)) halphaU0 halphaV0) + have huCommon : u ≠ common := by + intro h + exact huNotRight (h ▸ hcommonRight) + have hvCommon : v ≠ common := by + intro h + exact hvNotLeft (h ▸ hcommonLeft) + have hvSupport : v ≠ support := by + intro h + exact hvNotLeft (h ▸ hsupportLeft) + obtain ⟨beta, hbetaCommon⟩ := hcommonMissing + have halphaLeft : alpha ∈ TreeMissingColors sigma left := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨u, huLeft, halphaU⟩ + have hbetaLeft : beta ∈ TreeMissingColors sigma left := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨common, hcommonLeft, hbetaCommon⟩ + have halphaRight : alpha ∈ TreeMissingColors sigma right := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨v, hvRight, halphaV⟩ + have halphaGamma : alpha ≠ gamma := by + intro h + apply hgamma + exact h ▸ halphaLeft + have hbetaGamma : beta ≠ gamma := by + intro h + apply hgamma + exact h ▸ hbetaLeft + have halphaDelta : alpha ≠ delta := by + intro h + exact (Finset.disjoint_left.mp + (hrightElementary hvRight hsupportRight hvSupport)) halphaV + (h ▸ hdelta) + have hbetaDelta : beta ≠ delta := by + intro h + exact (Finset.disjoint_left.mp + (hrightElementary hcommonRight hsupportRight hcommonNe)) hbetaCommon + (h ▸ hdelta) + have halphaBeta : alpha ≠ beta := by + intro h + exact (Finset.disjoint_left.mp + (hleftElementary huLeft hcommonLeft huCommon)) halphaU + (h ▸ hbetaCommon) + have hleft := hleftInterchangeable alpha beta halphaLeft hbetaLeft + halphaGamma halphaDelta hbetaGamma hbetaDelta + have hright := hrightInterchangeable alpha beta (Or.inl halphaRight) + let H := TwoColorIncidenceGraph G sigma alpha beta + have missing_leaf (x : V) + (hmissing : alpha ∈ MissingColors G sigma x ∨ + beta ∈ MissingColors G sigma x) : + Set.Subsingleton (H.neighborSet (Sum.inl x)) := by + exact @ParallelTwoConstituentPathContradiction_missing_leaf_163 V E inferInstance + inferInstance G k e0 sigma right hproper (by assumption) alpha beta x hmissing + exact @ParallelTwoConstituentPathContradiction_continuation_235 V E inferInstance inferInstance + G k e0 sigma left right hproper hleftElementary + hrightElementary (by assumption) support common hcommonLeft hcommonRight alpha u v huLeft + hvRight huv halphaU halphaV huCommon hvCommon hvSupport beta hbetaCommon halphaBeta hleft + hright missing_leaf +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/PartialEdgeColoring.lean b/LeanPool/GoldbergSeymour/PartialEdgeColoring.lean new file mode 100644 index 0000000000..1dd5eafbae --- /dev/null +++ b/LeanPool/GoldbergSeymour/PartialEdgeColoring.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Preamble + +/-! +# Partial Edge Coloring + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- An optional color for each edge; `none` denotes an uncolored edge. -/ +abbrev PartialEdgeColoring (E : Type*) (k : ℕ) := + E → Option (Fin k) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean b/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean new file mode 100644 index 0000000000..1b683d25f0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean @@ -0,0 +1,6569 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TdEarlierPEWitnessIdentification +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion + +public import LeanPool.GoldbergSeymour.RevisitingCertificatePreparation + +/-! +# P2971_T1_Positive Prefix No Revisiting + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev positivePrefixContradictionStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds), + ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + (0 : ℕ) < lower.rounds → + lower.rounds < ett.rounds → + MaximumProperty lower → + ( + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tnext : TreeSequence G e0 := + lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ))); + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (alpha beta : Fin k), + alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma Tnext → + TreeInterchangeable G Tnext sigma alpha beta) ∧ + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex n = some v → + lower.series.data.gamma n = some gamma → + lower.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, + Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ w = v) → + ∀ (sigmaPrev : PartialEdgeColoring E k), + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + IsProperEdgeColoring G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + Fin ett.rounds).castSucc) → + IsOneEdgeUncolored + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + Fin ett.rounds).castSucc) + e0 → + StableColoring + (ett.series.data.tree + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + Fin ett.rounds).succ.castSucc) + (TashkinovStoredColors ett.series.data + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + Fin ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + Fin ett.rounds).castSucc) + sigmaPrev → + ∀ + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix → + ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (2 : ℕ) ≤ ett.rounds + (2 : ℕ)) ↦ by omega) + i)) → + ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigmaPrev → + MaximumProperty corr.replacementETT → + ¬Nonempty + (RevisitingExtensionCertificate ett.series.data + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds).castSucc) → + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ = + Fin.last ett.rounds → + (0 : ℕ) < originalPrefix.rounds → + Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by + omega) + (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))) = + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc → + corr.replacementSeries.data.tree + (Fin.last originalPrefix.rounds : + Fin (originalPrefix.rounds + (1 : ℕ))).succ = + ett.series.data.tree + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).succ.castSucc → + originalPrefix.series.data.tree + (Fin.last originalPrefix.rounds : + Fin (originalPrefix.rounds + (1 : ℕ))).castSucc = + ett.series.data.tree + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc.castSucc → + ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 input' T' generating'), + (0 : ℕ) < base.rounds → + base.rounds < ett.rounds → + MaximumProperty base → + ∀ (r : ℕ) (series : TashkinovSeries G k r e0 input'), + base.rounds = r → + base.series ≍ series → + ∀ (a : Fin (r + (1 : ℕ))) (v : V) (gamma delta : Fin k), + (0 : ℕ) < (↑a : ℕ) → + series.data.kind a = some TashkinovExtensionKind.PE → + series.data.chosenVertex a = some v → + series.data.gamma a = some gamma → + series.data.delta a = some delta → + IsProperEdgeColoring G (series.data.coloring a) → + IsOneEdgeUncolored (series.data.coloring a) e0 → + ∀ w ∈ TreeSequenceVertexSet (series.data.tree a.castSucc), + Sum.inl w ∈ + TwoColorComponent G (series.data.coloring a) gamma delta + (Sum.inl v) ↔ + w = v) → + ∀ + (available : + RevisitingExtensionCertificate corr.replacementSeries.data + (Fin.last originalPrefix.rounds)), + (0 : ℕ) < + (↑(available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) : ℕ) → + originalPrefix.series.data.kind + (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) = + some TashkinovExtensionKind.PE → + ∀ (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 + (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k), + ParallelExtensionColor originalPrefix.series.data oldi.castSucc + oldChoice.selected oldChoice.vertex oldGamma → + ∀ (oldSecond : PartialEdgeColoring E k), + IsProperEdgeColoring G oldSecond → + StableColoring (originalPrefix.series.data.tree oldi.succ.castSucc) + (insert oldChoice.color + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc)) + oldChoice.selected oldSecond → + originalPrefix.series.data.coloring oldi.succ = + TwoColorComponentSwap G oldSecond oldGamma oldChoice.color + (Sum.inl oldChoice.vertex) → + IsProperEdgeColoring G + (originalPrefix.series.data.coloring oldi.succ) → + IsOneEdgeUncolored (originalPrefix.series.data.coloring oldi.succ) + e0 → + originalPrefix.series.data.stored oldi.succ = + { oldChoice.color, oldGamma } → + originalPrefix.series.data.connectingEdges oldi.succ = + { oldChoice.edge } → + originalPrefix.series.data.kind oldi.succ = + some TashkinovExtensionKind.PE → + originalPrefix.series.data.chosenVertex oldi.succ = + some oldChoice.vertex → + originalPrefix.series.data.delta oldi.succ = + some oldChoice.color → + originalPrefix.series.data.gamma oldi.succ = some oldGamma → + (available.earlier : + Fin (originalPrefix.rounds + (1 : ℕ))) = + oldi.succ → + oldi.succ = + (available.earlier : + Fin (originalPrefix.rounds + (1 : ℕ))) → + ∀ (newi : Fin originalPrefix.rounds), + IsProperEdgeColoring G + (corr.replacementSeries.data.coloring newi.castSucc) → + IsOneEdgeUncolored + (corr.replacementSeries.data.coloring newi.castSucc) + e0 → + ColoredVertexSetClosed G + (corr.replacementSeries.data.coloring newi.castSucc) + (TreeSequenceVertexSet + (corr.replacementSeries.data.tree + newi.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G + (corr.replacementSeries.data.coloring + newi.castSucc) + (TreeSequenceVertexSet + (corr.replacementSeries.data.tree + newi.succ.castSucc)) → + ¬Nonempty + (RevisitingExtensionCertificate + corr.replacementSeries.data newi.castSucc) → + ∀ + (newChoicePE : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + newi.succ.castSucc) + (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring + newi.castSucc)), + (∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring + (corr.replacementSeries.data.tree + newi.succ.castSucc) + (insert newChoicePE.color + (TashkinovStoredColors + corr.replacementSeries.data + newi.castSucc)) + newChoicePE.selected rho ∧ + ¬Disjoint + (MissingColors G rho + newChoicePE.otherEndpoint) + (TreeMissingColors rho + (corr.replacementSeries.data.tree + newi.succ.castSucc))) → + ∀ (newGamma : Fin k), + ParallelExtensionColor + corr.replacementSeries.data newi.castSucc + newChoicePE.selected newChoicePE.vertex + newGamma → + ∀ (newSecond : PartialEdgeColoring E k), + IsProperEdgeColoring G newSecond → + StableColoring + (corr.replacementSeries.data.tree + newi.succ.castSucc) + (insert newChoicePE.color + (TashkinovStoredColors + corr.replacementSeries.data + newi.castSucc)) + newChoicePE.selected newSecond → + TreeExit + (corr.replacementSeries.data.tree + newi.succ.castSucc) + newSecond newGamma newChoicePE.color + newChoicePE.vertex → + corr.replacementSeries.data.coloring + newi.succ = + TwoColorComponentSwap G newSecond + newGamma newChoicePE.color + (Sum.inl newChoicePE.vertex) → + IsProperEdgeColoring G + (corr.replacementSeries.data.coloring + newi.succ) → + IsOneEdgeUncolored + (corr.replacementSeries.data.coloring + newi.succ) + e0 → + corr.replacementSeries.data.stored + newi.succ = + { newChoicePE.color, newGamma } → + corr.replacementSeries.data.connectingEdges + newi.succ = + { newChoicePE.edge } → + corr.replacementSeries.data.kind + newi.succ = + some TashkinovExtensionKind.PE → + corr.replacementSeries.data.chosenVertex + newi.succ = + some newChoicePE.vertex → + corr.replacementSeries.data.outsideVertex + newi.succ = + some newChoicePE.otherEndpoint → + corr.replacementSeries.data.delta + newi.succ = + some newChoicePE.color → + corr.replacementSeries.data.gamma + newi.succ = + some newGamma → + TashkinovClosure + (corr.replacementSeries.data.coloring + newi.succ) + (corr.replacementSeries.data.tree + newi.succ.castSucc) + (corr.replacementSeries.data.tree + newi.succ.succ) → + TreeSequenceInitialSegment + (corr.replacementSeries.data.tree + newi.succ.castSucc) + (corr.replacementSeries.data.tree + newi.succ.succ) → + (corr.replacementSeries.data.tree + newi.succ.castSucc).length < + (corr.replacementSeries.data.tree + newi.succ.succ).length → + (available.earlier : + Fin + (originalPrefix.rounds + + (1 : ℕ))) = + newi.succ → + False + +private abbrev positivePrefixColorIdentificationStatement.{u_1, u_2} : Prop := + open scoped Classical Sym2 in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : 1 < ett.rounds), + ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < lower.rounds → + lower.rounds < ett.rounds → + MaximumProperty lower → + ( + let n : Fin (lower.rounds + 1) := Fin.last lower.rounds; + let Tnext : TreeSequence G e0 := lower.series.data.tree (Fin.last (lower.rounds + 1)); + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (alpha beta : Fin k), + alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma Tnext → + TreeInterchangeable G Tnext sigma alpha beta) ∧ + let n : Fin (lower.rounds + 1) := Fin.last lower.rounds; + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex n = some v → + lower.series.data.gamma n = some gamma → + lower.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, + Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ w = v) → + let q : Fin ett.rounds := + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k), + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + IsProperEdgeColoring G + (ett.series.data.coloring + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).castSucc) → + IsOneEdgeUncolored + (ett.series.data.coloring + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).castSucc) + e0 → + StableColoring + (ett.series.data.tree + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).succ.castSucc) + (TashkinovStoredColors ett.series.data + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).castSucc) + sigmaPrev → + ∀ + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - 1), + MaximumProperty originalPrefix → + ( + ∀ (i : Fin (originalPrefix.rounds + 2)), + originalPrefix.series.data.tree i = + ett.series.data.tree + (Fin.castLE + (Decidable.byContradiction fun (a : ¬originalPrefix.rounds + 2 ≤ ett.rounds + 2) ↦ + (by omega)) + i)) → + ( + ∀ (i : Fin (originalPrefix.rounds + 1)), + originalPrefix.series.data.coloring i = + ett.series.data.coloring + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + MaximumProperty corr.replacementETT → + ¬Nonempty + (RevisitingExtensionCertificate ett.series.data + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ + (by omega)⟩ : + Fin ett.rounds).castSucc) → + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ + (by omega)⟩ : + Fin ett.rounds).succ = + Fin.last ett.rounds → + let replacementLast : Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.coloring replacementLast = sigmaPrev → + 0 < originalPrefix.rounds → + Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + replacementLast = + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ + (by omega)⟩ : + Fin ett.rounds).castSucc → + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ + (by omega)⟩ : + Fin ett.rounds).succ.castSucc → + originalPrefix.series.data.tree replacementLast.castSucc = + ett.series.data.tree + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ + (by omega)⟩ : + Fin ett.rounds).castSucc.castSucc → + ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < base.rounds → + base.rounds < ett.rounds → + MaximumProperty base → + ∀ (r : ℕ) (series : TashkinovSeries G k r e0 input'), + base.rounds = r → + base.series ≍ series → + ∀ (a : Fin (r + 1)) (v : V) (gamma delta : Fin k), + 0 < (↑a : ℕ) → + series.data.kind a = some TashkinovExtensionKind.PE → + series.data.chosenVertex a = some v → + series.data.gamma a = some gamma → + series.data.delta a = some delta → + IsProperEdgeColoring G (series.data.coloring a) → + IsOneEdgeUncolored (series.data.coloring a) e0 → + ∀ w ∈ TreeSequenceVertexSet (series.data.tree a.castSucc), + Sum.inl w ∈ + TwoColorComponent G (series.data.coloring a) gamma delta + (Sum.inl v) ↔ + w = v) → + ∀ + (available : + RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + 1) := available.earlier; + 0 < (↑earlierPrefix : ℕ) → + originalPrefix.series.data.kind earlierPrefix = + some TashkinovExtensionKind.PE → + ∀ (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 + (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k), + ParallelExtensionColor originalPrefix.series.data oldi.castSucc + oldChoice.selected oldChoice.vertex oldGamma → + ∀ (oldSecond : PartialEdgeColoring E k), + IsProperEdgeColoring G oldSecond → + StableColoring (originalPrefix.series.data.tree oldi.succ.castSucc) + (insert oldChoice.color + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc)) + oldChoice.selected oldSecond → + originalPrefix.series.data.coloring oldi.succ = + TwoColorComponentSwap G oldSecond oldGamma oldChoice.color + (Sum.inl oldChoice.vertex) → + IsProperEdgeColoring G + (originalPrefix.series.data.coloring oldi.succ) → + IsOneEdgeUncolored (originalPrefix.series.data.coloring oldi.succ) + e0 → + originalPrefix.series.data.stored oldi.succ = + { oldChoice.color, oldGamma } → + originalPrefix.series.data.connectingEdges oldi.succ = + { oldChoice.edge } → + originalPrefix.series.data.kind oldi.succ = + some TashkinovExtensionKind.PE → + originalPrefix.series.data.chosenVertex oldi.succ = + some oldChoice.vertex → + originalPrefix.series.data.delta oldi.succ = + some oldChoice.color → + originalPrefix.series.data.gamma oldi.succ = some oldGamma → + earlierPrefix = oldi.succ → + oldi.succ = earlierPrefix → + ∀ (newGamma : Fin k) + (newSecond : PartialEdgeColoring E k), + IsProperEdgeColoring G newSecond → + IsProperEdgeColoring G + (corr.replacementSeries.data.coloring + oldi.castSucc) → + IsOneEdgeUncolored + (corr.replacementSeries.data.coloring oldi.castSucc) + e0 → + ColoredVertexSetClosed G + (corr.replacementSeries.data.coloring + oldi.castSucc) + (TreeSequenceVertexSet + (corr.replacementSeries.data.tree + oldi.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G + (corr.replacementSeries.data.coloring + oldi.castSucc) + (TreeSequenceVertexSet + (corr.replacementSeries.data.tree + oldi.succ.castSucc)) → + ¬Nonempty + (RevisitingExtensionCertificate + corr.replacementSeries.data oldi.castSucc) → + ∀ + (newChoicePE : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (TashkinovStoredColors + corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring + oldi.castSucc)), + (∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (insert newChoicePE.color + (TashkinovStoredColors + corr.replacementSeries.data + oldi.castSucc)) + newChoicePE.selected rho ∧ + ¬Disjoint + (MissingColors G rho + newChoicePE.otherEndpoint) + (TreeMissingColors rho + (corr.replacementSeries.data.tree + oldi.succ.castSucc))) → + ParallelExtensionColor + corr.replacementSeries.data oldi.castSucc + newChoicePE.selected newChoicePE.vertex + newGamma → + StableColoring + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (insert newChoicePE.color + (TashkinovStoredColors + corr.replacementSeries.data oldi.castSucc)) + newChoicePE.selected newSecond → + TreeExit + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + newSecond newGamma newChoicePE.color + newChoicePE.vertex → + corr.replacementSeries.data.coloring + oldi.succ = + TwoColorComponentSwap G newSecond newGamma + newChoicePE.color + (Sum.inl newChoicePE.vertex) → + IsProperEdgeColoring G + (corr.replacementSeries.data.coloring + oldi.succ) → + IsOneEdgeUncolored + (corr.replacementSeries.data.coloring + oldi.succ) + e0 → + corr.replacementSeries.data.stored + oldi.succ = + { newChoicePE.color, newGamma } → + corr.replacementSeries.data.connectingEdges + oldi.succ = + { newChoicePE.edge } → + corr.replacementSeries.data.kind + oldi.succ = + some TashkinovExtensionKind.PE → + corr.replacementSeries.data.chosenVertex + oldi.succ = + some newChoicePE.vertex → + corr.replacementSeries.data.outsideVertex + oldi.succ = + some newChoicePE.otherEndpoint → + corr.replacementSeries.data.delta + oldi.succ = + some newChoicePE.color → + corr.replacementSeries.data.gamma + oldi.succ = + some newGamma → + TashkinovClosure + (corr.replacementSeries.data.coloring + oldi.succ) + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (corr.replacementSeries.data.tree + oldi.succ.succ) → + TreeSequenceInitialSegment + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (corr.replacementSeries.data.tree + oldi.succ.succ) → + (corr.replacementSeries.data.tree + oldi.succ.castSucc).length < + (corr.replacementSeries.data.tree + oldi.succ.succ).length → + earlierPrefix = oldi.succ → + oldi.succ = earlierPrefix → + ∀ + (hbaseTree : + corr.replacementSeries.data.tree + oldi.succ.castSucc = + originalPrefix.series.data.tree + oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (TashkinovStoredColors + originalPrefix.series.data + oldi.castSucc) + (originalPrefix.series.data.coloring + oldi.castSucc) := + Eq.symm hbaseTree ▸ + oldChoice; + ( + ∀ {A B : TreeSequence G e0} + (hAB : A = B) + (C : Finset (Fin k)) + (phi : + PartialEdgeColoring E k) + (ch : + MaximumDefectiveChoice G + e0 A C phi), + (hAB ▸ ch).edge = ch.edge ∧ + (hAB ▸ ch).vertex = + ch.vertex ∧ + (hAB ▸ + ch).otherEndpoint = + ch.otherEndpoint ∧ + (hAB ▸ ch).color = + ch.color) → + (Eq.symm hbaseTree ▸ + oldChoice).edge = + oldChoice.edge ∧ + (Eq.symm hbaseTree ▸ + oldChoice).vertex = + oldChoice.vertex ∧ + (Eq.symm hbaseTree ▸ + oldChoice).otherEndpoint = + oldChoice.otherEndpoint ∧ + (Eq.symm hbaseTree ▸ + oldChoice).color = + oldChoice.color → + oldChoiceOnNew.edge = + oldChoice.edge → + oldChoiceOnNew.vertex = + oldChoice.vertex → + oldChoiceOnNew.otherEndpoint = + oldChoice.otherEndpoint → + oldChoiceOnNew.color = + oldChoice.color → + ({oldChoiceOnNew.edge} : Finset E) = + { + newChoicePE.edge } → + ({oldChoiceOnNew.color, oldGamma} : Finset (Fin k)) = + { newChoicePE.color, + newGamma } → + newChoicePE.edge = + oldChoiceOnNew.edge → + s(oldChoiceOnNew.vertex, + oldChoiceOnNew.otherEndpoint) = + s(newChoicePE.vertex, + newChoicePE.otherEndpoint) → + newChoicePE.vertex = + oldChoiceOnNew.vertex → + newChoicePE.otherEndpoint = + oldChoiceOnNew.otherEndpoint → + ( + ∀ + (X : + TreeSequence G + e0) + (C : + Finset + (Fin k)) + (phi : + PartialEdgeColoring + E k) + (ch : + MaximumDefectiveChoice + G e0 X C phi) + (g : Fin k) + (second : + PartialEdgeColoring + E k), + IsProperEdgeColoring + G second → + StableColoring + X + (insert + ch.color C) + ch.selected + second → + g ∈ + MissingColors + G + ch.selected + ch.vertex → + have post : + PartialEdgeColoring + E k := + TwoColorComponentSwap + G second g + ch.color + (Sum.inl + ch.vertex); + ch.color ∈ + MissingColors + G post + ch.vertex ∧ + g ∉ + MissingColors + G post + ch.vertex ∧ + g ≠ + ch.color) → + oldChoice.color ∈ + MissingColors + G + (originalPrefix.series.data.coloring + oldi.succ) + oldChoice.vertex → + oldGamma ∉ + MissingColors + G + (originalPrefix.series.data.coloring + oldi.succ) + oldChoice.vertex → + oldGamma ≠ + oldChoice.color → + newChoicePE.color ∈ + MissingColors + G + (corr.replacementSeries.data.coloring + oldi.succ) + newChoicePE.vertex → + newGamma ∉ + MissingColors + G + (corr.replacementSeries.data.coloring + oldi.succ) + newChoicePE.vertex → + newGamma ≠ + newChoicePE.color → + False + +private abbrev positivePrefixReturnTransportStatement.{u_1, u_2} : Prop := + open scoped Classical Sym2 in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : 1 < ett.rounds), + ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < lower.rounds → + lower.rounds < ett.rounds → + MaximumProperty lower → + ( + let n : Fin (lower.rounds + 1) := Fin.last lower.rounds; + let Tnext : TreeSequence G e0 := lower.series.data.tree (Fin.last (lower.rounds + 1)); + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (alpha beta : Fin k), + alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma Tnext → + TreeInterchangeable G Tnext sigma alpha beta) ∧ + let n : Fin (lower.rounds + 1) := Fin.last lower.rounds; + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex n = some v → + lower.series.data.gamma n = some gamma → + lower.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, + Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ w = v) → + let q : Fin ett.rounds := + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k), + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + IsProperEdgeColoring G + (ett.series.data.coloring + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).castSucc) → + IsOneEdgeUncolored + (ett.series.data.coloring + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).castSucc) + e0 → + StableColoring + (ett.series.data.tree + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).succ.castSucc) + (TashkinovStoredColors ett.series.data + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).castSucc) + sigmaPrev → + ∀ + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ (by omega)⟩ : + Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - 1), + MaximumProperty originalPrefix → + ( + ∀ (i : Fin (originalPrefix.rounds + 2)), + originalPrefix.series.data.tree i = + ett.series.data.tree + (Fin.castLE + (Decidable.byContradiction fun (a : ¬originalPrefix.rounds + 2 ≤ ett.rounds + 2) ↦ + (by omega)) + i)) → + ( + ∀ (i : Fin (originalPrefix.rounds + 1)), + originalPrefix.series.data.coloring i = + ett.series.data.coloring + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + MaximumProperty corr.replacementETT → + ¬Nonempty + (RevisitingExtensionCertificate ett.series.data + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ + (by omega)⟩ : + Fin ett.rounds).castSucc) → + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ + (by omega)⟩ : + Fin ett.rounds).succ = + Fin.last ett.rounds → + let replacementLast : Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.coloring replacementLast = sigmaPrev → + 0 < originalPrefix.rounds → + Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + 1 ≤ ett.rounds + 1) ↦ (by omega)) + replacementLast = + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ + (by omega)⟩ : + Fin ett.rounds).castSucc → + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ + (by omega)⟩ : + Fin ett.rounds).succ.castSucc → + originalPrefix.series.data.tree replacementLast.castSucc = + ett.series.data.tree + (⟨ett.rounds - 1, + Decidable.byContradiction fun (a : ¬ett.rounds - 1 < ett.rounds) ↦ + (by omega)⟩ : + Fin ett.rounds).castSucc.castSucc → + ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < base.rounds → + base.rounds < ett.rounds → + MaximumProperty base → + ∀ (r : ℕ) (series : TashkinovSeries G k r e0 input'), + base.rounds = r → + base.series ≍ series → + ∀ (a : Fin (r + 1)) (v : V) (gamma delta : Fin k), + 0 < (↑a : ℕ) → + series.data.kind a = some TashkinovExtensionKind.PE → + series.data.chosenVertex a = some v → + series.data.gamma a = some gamma → + series.data.delta a = some delta → + IsProperEdgeColoring G (series.data.coloring a) → + IsOneEdgeUncolored (series.data.coloring a) e0 → + ∀ w ∈ TreeSequenceVertexSet (series.data.tree a.castSucc), + Sum.inl w ∈ + TwoColorComponent G (series.data.coloring a) gamma delta + (Sum.inl v) ↔ + w = v) → + ∀ + (available : + RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + 1) := available.earlier; + 0 < (↑earlierPrefix : ℕ) → + originalPrefix.series.data.kind earlierPrefix = + some TashkinovExtensionKind.PE → + ∀ (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 + (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k), + ParallelExtensionColor originalPrefix.series.data oldi.castSucc + oldChoice.selected oldChoice.vertex oldGamma → + ∀ (oldSecond : PartialEdgeColoring E k), + IsProperEdgeColoring G oldSecond → + StableColoring (originalPrefix.series.data.tree oldi.succ.castSucc) + (insert oldChoice.color + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc)) + oldChoice.selected oldSecond → + originalPrefix.series.data.coloring oldi.succ = + TwoColorComponentSwap G oldSecond oldGamma oldChoice.color + (Sum.inl oldChoice.vertex) → + IsProperEdgeColoring G + (originalPrefix.series.data.coloring oldi.succ) → + IsOneEdgeUncolored (originalPrefix.series.data.coloring oldi.succ) + e0 → + originalPrefix.series.data.stored oldi.succ = + { oldChoice.color, oldGamma } → + originalPrefix.series.data.connectingEdges oldi.succ = + { oldChoice.edge } → + originalPrefix.series.data.kind oldi.succ = + some TashkinovExtensionKind.PE → + originalPrefix.series.data.chosenVertex oldi.succ = + some oldChoice.vertex → + originalPrefix.series.data.delta oldi.succ = + some oldChoice.color → + originalPrefix.series.data.gamma oldi.succ = some oldGamma → + earlierPrefix = oldi.succ → + oldi.succ = earlierPrefix → + ∀ (newGamma : Fin k) + (newSecond : PartialEdgeColoring E k), + IsProperEdgeColoring G newSecond → + IsProperEdgeColoring G + (corr.replacementSeries.data.coloring + oldi.castSucc) → + IsOneEdgeUncolored + (corr.replacementSeries.data.coloring oldi.castSucc) + e0 → + ColoredVertexSetClosed G + (corr.replacementSeries.data.coloring + oldi.castSucc) + (TreeSequenceVertexSet + (corr.replacementSeries.data.tree + oldi.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G + (corr.replacementSeries.data.coloring + oldi.castSucc) + (TreeSequenceVertexSet + (corr.replacementSeries.data.tree + oldi.succ.castSucc)) → + ¬Nonempty + (RevisitingExtensionCertificate + corr.replacementSeries.data oldi.castSucc) → + ∀ + (newChoicePE : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (TashkinovStoredColors + corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring + oldi.castSucc)), + (∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (insert newChoicePE.color + (TashkinovStoredColors + corr.replacementSeries.data + oldi.castSucc)) + newChoicePE.selected rho ∧ + ¬Disjoint + (MissingColors G rho + newChoicePE.otherEndpoint) + (TreeMissingColors rho + (corr.replacementSeries.data.tree + oldi.succ.castSucc))) → + ParallelExtensionColor + corr.replacementSeries.data oldi.castSucc + newChoicePE.selected newChoicePE.vertex + newGamma → + StableColoring + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (insert newChoicePE.color + (TashkinovStoredColors + corr.replacementSeries.data oldi.castSucc)) + newChoicePE.selected newSecond → + TreeExit + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + newSecond newGamma newChoicePE.color + newChoicePE.vertex → + corr.replacementSeries.data.coloring + oldi.succ = + TwoColorComponentSwap G newSecond newGamma + newChoicePE.color + (Sum.inl newChoicePE.vertex) → + IsProperEdgeColoring G + (corr.replacementSeries.data.coloring + oldi.succ) → + IsOneEdgeUncolored + (corr.replacementSeries.data.coloring + oldi.succ) + e0 → + corr.replacementSeries.data.stored + oldi.succ = + { newChoicePE.color, newGamma } → + corr.replacementSeries.data.connectingEdges + oldi.succ = + { newChoicePE.edge } → + corr.replacementSeries.data.kind + oldi.succ = + some TashkinovExtensionKind.PE → + corr.replacementSeries.data.chosenVertex + oldi.succ = + some newChoicePE.vertex → + corr.replacementSeries.data.outsideVertex + oldi.succ = + some newChoicePE.otherEndpoint → + corr.replacementSeries.data.delta + oldi.succ = + some newChoicePE.color → + corr.replacementSeries.data.gamma + oldi.succ = + some newGamma → + TashkinovClosure + (corr.replacementSeries.data.coloring + oldi.succ) + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (corr.replacementSeries.data.tree + oldi.succ.succ) → + TreeSequenceInitialSegment + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (corr.replacementSeries.data.tree + oldi.succ.succ) → + (corr.replacementSeries.data.tree + oldi.succ.castSucc).length < + (corr.replacementSeries.data.tree + oldi.succ.succ).length → + earlierPrefix = oldi.succ → + oldi.succ = earlierPrefix → + ∀ + (hbaseTree : + corr.replacementSeries.data.tree + oldi.succ.castSucc = + originalPrefix.series.data.tree + oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (TashkinovStoredColors + originalPrefix.series.data + oldi.castSucc) + (originalPrefix.series.data.coloring + oldi.castSucc) := + Eq.symm hbaseTree ▸ + oldChoice; + ( + ∀ {A B : TreeSequence G e0} + (hAB : A = B) + (C : Finset (Fin k)) + (phi : + PartialEdgeColoring E k) + (ch : + MaximumDefectiveChoice G + e0 A C phi), + (hAB ▸ ch).edge = ch.edge ∧ + (hAB ▸ ch).vertex = + ch.vertex ∧ + (hAB ▸ + ch).otherEndpoint = + ch.otherEndpoint ∧ + (hAB ▸ ch).color = + ch.color) → + (Eq.symm hbaseTree ▸ + oldChoice).edge = + oldChoice.edge ∧ + (Eq.symm hbaseTree ▸ + oldChoice).vertex = + oldChoice.vertex ∧ + (Eq.symm hbaseTree ▸ + oldChoice).otherEndpoint = + oldChoice.otherEndpoint ∧ + (Eq.symm hbaseTree ▸ + oldChoice).color = + oldChoice.color → + oldChoiceOnNew.edge = + oldChoice.edge → + oldChoiceOnNew.vertex = + oldChoice.vertex → + oldChoiceOnNew.otherEndpoint = + oldChoice.otherEndpoint → + oldChoiceOnNew.color = + oldChoice.color → + ({oldChoiceOnNew.edge} : Finset E) = + { + newChoicePE.edge } → + ({oldChoiceOnNew.color, oldGamma} : Finset (Fin k)) = + { newChoicePE.color, + newGamma } → + newChoicePE.edge = + oldChoiceOnNew.edge → + s(oldChoiceOnNew.vertex, + oldChoiceOnNew.otherEndpoint) = + s(newChoicePE.vertex, + newChoicePE.otherEndpoint) → + newChoicePE.vertex = + oldChoiceOnNew.vertex → + newChoicePE.otherEndpoint = + oldChoiceOnNew.otherEndpoint → + ( + ∀ + (X : + TreeSequence G + e0) + (C : + Finset + (Fin k)) + (phi : + PartialEdgeColoring + E k) + (ch : + MaximumDefectiveChoice + G e0 X C phi) + (g : Fin k) + (second : + PartialEdgeColoring + E k), + IsProperEdgeColoring + G second → + StableColoring + X + (insert + ch.color C) + ch.selected + second → + g ∈ + MissingColors + G + ch.selected + ch.vertex → + have post : + PartialEdgeColoring + E k := + TwoColorComponentSwap + G second g + ch.color + (Sum.inl + ch.vertex); + ch.color ∈ + MissingColors + G post + ch.vertex ∧ + g ∉ + MissingColors + G post + ch.vertex ∧ + g ≠ + ch.color) → + oldChoice.color ∈ + MissingColors + G + (originalPrefix.series.data.coloring + oldi.succ) + oldChoice.vertex → + oldGamma ∉ + MissingColors + G + (originalPrefix.series.data.coloring + oldi.succ) + oldChoice.vertex → + oldGamma ≠ + oldChoice.color → + newChoicePE.color ∈ + MissingColors + G + (corr.replacementSeries.data.coloring + oldi.succ) + newChoicePE.vertex → + newGamma ∉ + MissingColors + G + (corr.replacementSeries.data.coloring + oldi.succ) + newChoicePE.vertex → + newGamma ≠ + newChoicePE.color → + MissingColors + G + (originalPrefix.series.data.coloring + oldi.succ) + oldChoice.vertex = + MissingColors + G + (corr.replacementSeries.data.coloring + oldi.succ) + oldChoice.vertex → + MissingColors + G + (originalPrefix.series.data.coloring + oldi.succ) + (Eq.symm + hbaseTree ▸ + oldChoice).vertex = + MissingColors + G + (corr.replacementSeries.data.coloring + oldi.succ) + newChoicePE.vertex → + oldChoiceOnNew.color ∈ + MissingColors + G + (originalPrefix.series.data.coloring + oldi.succ) + oldChoiceOnNew.vertex → + oldGamma ∉ + MissingColors + G + (originalPrefix.series.data.coloring + oldi.succ) + oldChoiceOnNew.vertex → + newChoicePE.edge = + oldChoiceOnNew.edge → + newChoicePE.vertex = + oldChoiceOnNew.vertex → + newChoicePE.otherEndpoint = + oldChoiceOnNew.otherEndpoint → + newChoicePE.color = + oldChoiceOnNew.color → + newGamma = + oldGamma → + newChoicePE.color = + available.delta → + newGamma = + available.gamma → + oldChoice.color = + available.delta → + oldGamma = + available.gamma → + newChoicePE.vertex = + oldChoice.vertex → + newChoicePE.otherEndpoint = + oldChoice.otherEndpoint → + ( + ∀ + {rounds' : + ℕ} + {input' : + PartialEdgeColoring + E + k} + (series : + TashkinovSeries + G + k + rounds' + e0 + input') + (j : + Fin + rounds'), + series.data.kind + j.succ = + some + TashkinovExtensionKind.RE → + series.data.coloring + j.succ = + series.data.coloring + j.castSucc) → + ( + ∀ + {rounds' : + ℕ} + {input' : + PartialEdgeColoring + E + k} + (series : + TashkinovSeries + G + k + rounds' + e0 + input') + (a + b : + Fin + (rounds' + + 1)), + (↑a : + ℕ) ≤ + (↑b : + ℕ) → + ( + ∀ + (j : + Fin + (rounds' + + 1)), + (↑a : + ℕ) < + (↑j : + ℕ) → + (↑j : + ℕ) ≤ + (↑b : + ℕ) → + series.data.kind + j = + some + TashkinovExtensionKind.RE) → + series.data.coloring + b = + series.data.coloring + a) → + corr.replacementSeries.data.coloring + (Fin.last + originalPrefix.rounds) = + corr.replacementSeries.data.coloring + oldi.succ → + originalPrefix.series.data.coloring + (Fin.last + originalPrefix.rounds) = + originalPrefix.series.data.coloring + oldi.succ → + corr.replacementSeries.data.coloring + oldi.succ = + sigmaPrev → + originalPrefix.series.data.coloring + replacementLast = + ett.series.data.coloring + q.castSucc → + originalPrefix.series.data.coloring + oldi.succ = + ett.series.data.coloring + q.castSucc → + available.delta ∈ + MissingColors + G + sigmaPrev + newChoicePE.vertex → + available.gamma ∉ + MissingColors + G + sigmaPrev + newChoicePE.vertex → + available.delta ∈ + MissingColors + G + (ett.series.data.coloring + (⟨ett.rounds - + 1, + have + this : + 1 ≤ + T.length := + T.positive; + Decidable.byContradiction + fun + (a : + ¬ett.rounds - + 1 < + ett.rounds) ↦ + (by + omega)⟩ : + Fin + ett.rounds).castSucc) + oldChoice.vertex → + available.gamma ∉ + MissingColors + G + (ett.series.data.coloring + (⟨ett.rounds - + 1, + have + this : + 1 ≤ + T.length := + T.positive; + Decidable.byContradiction + fun + (a : + ¬ett.rounds - + 1 < + ett.rounds) ↦ + (by + omega)⟩ : + Fin + ett.rounds).castSucc) + oldChoice.vertex → + available.gamma ≠ + available.delta → + ( + ∀ + (r : + Fin + originalPrefix.rounds), + TreeSequenceInitialSegment + (originalPrefix.series.data.tree + r.succ.castSucc) + (originalPrefix.series.data.tree + r.succ.succ)) → + ( + ∀ + (A + B + C : + TreeSequence + G + e0), + TreeSequenceInitialSegment + A + B → + TreeSequenceInitialSegment + B + C → + TreeSequenceInitialSegment + A + C) → + ( + ∀ + (d : + ℕ) + (idx : + Fin + (originalPrefix.rounds + + 2)), + (↑idx : + ℕ) + + d = + originalPrefix.rounds + + 1 → + 1 ≤ + (↑idx : + ℕ) → + TreeSequenceInitialSegment + (originalPrefix.series.data.tree + idx) + (originalPrefix.series.data.tree + (Fin.last + (originalPrefix.rounds + + 1)))) → + False + +private abbrev helperBranch280Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds) + (_ : + ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating') (_ : (0 : ℕ) < lower.rounds) + (_ : lower.rounds < ett.rounds) (_ : MaximumProperty lower), + ( + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tnext : TreeSequence G e0 := lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ))); + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (alpha beta : Fin k), + alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma Tnext → + TreeInterchangeable G Tnext sigma alpha beta) ∧ + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex n = some v → + lower.series.data.gamma n = some gamma → + lower.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, + Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ w = v)) + (sigmaPrev : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigmaPrev) + (_ : IsOneEdgeUncolored sigmaPrev e0) + (_ : + IsProperEdgeColoring G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (_ : + IsOneEdgeUncolored + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) e0) + (_ : + StableColoring + (ett.series.data.tree (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).succ.castSucc) + (TashkinovStoredColors ett.series.data + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + sigmaPrev) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : MaximumProperty originalPrefix) + (_ : + ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i))) + (_ : + ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i))) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (_ : corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigmaPrev) + (_ : MaximumProperty corr.replacementETT) + (_ : + ¬Nonempty + (RevisitingExtensionCertificate ett.series.data + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (_ : + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ = + Fin.last ett.rounds) + (_ : (0 : ℕ) < originalPrefix.rounds) + (_ : + Fin.castLE + (Decidable.byContradiction fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega) + (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))) = + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) + (_ : + corr.replacementSeries.data.tree + (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))).succ = + ett.series.data.tree + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc) + (_ : + originalPrefix.series.data.tree + (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))).castSucc = + ett.series.data.tree + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc.castSucc) + (_ : + ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 input' T' generating') (_ : (0 : ℕ) < base.rounds) + (_ : base.rounds < ett.rounds) (_ : MaximumProperty base) (r : ℕ) + (series : TashkinovSeries G k r e0 input') (_ : base.rounds = r) (_ : base.series ≍ series) + (a : Fin (r + (1 : ℕ))) (v : V) (gamma delta : Fin k) (_ : (0 : ℕ) < (↑a : ℕ)) + (_ : series.data.kind a = some TashkinovExtensionKind.PE) + (_ : series.data.chosenVertex a = some v) (_ : series.data.gamma a = some gamma) + (_ : series.data.delta a = some delta) (_ : IsProperEdgeColoring G (series.data.coloring a)) + (_ : IsOneEdgeUncolored (series.data.coloring a) e0), + ∀ w ∈ TreeSequenceVertexSet (series.data.tree a.castSucc), + Sum.inl w ∈ TwoColorComponent G (series.data.coloring a) gamma delta (Sum.inl v) ↔ w = v)) + (available : + RevisitingExtensionCertificate corr.replacementSeries.data (Fin.last originalPrefix.rounds)) + (_ : (0 : ℕ) < (↑(available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) : ℕ)) + (_ : + originalPrefix.series.data.kind (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) = + some TashkinovExtensionKind.PE) + (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) + (_ : + ParallelExtensionColor originalPrefix.series.data oldi.castSucc oldChoice.selected + oldChoice.vertex oldGamma) + (oldSecond : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G oldSecond) + (_ : + StableColoring (originalPrefix.series.data.tree oldi.succ.castSucc) + (insert oldChoice.color (TashkinovStoredColors originalPrefix.series.data oldi.castSucc)) + oldChoice.selected oldSecond) + (_ : + originalPrefix.series.data.coloring oldi.succ = + TwoColorComponentSwap G oldSecond oldGamma oldChoice.color (Sum.inl oldChoice.vertex)) + (_ : IsProperEdgeColoring G (originalPrefix.series.data.coloring oldi.succ)) + (_ : IsOneEdgeUncolored (originalPrefix.series.data.coloring oldi.succ) e0) + (_ : originalPrefix.series.data.stored oldi.succ = { oldChoice.color, oldGamma }) + (_ : originalPrefix.series.data.connectingEdges oldi.succ = { oldChoice.edge }) + (_ : originalPrefix.series.data.kind oldi.succ = some TashkinovExtensionKind.PE) + (_ : originalPrefix.series.data.chosenVertex oldi.succ = some oldChoice.vertex) + (_ : originalPrefix.series.data.delta oldi.succ = some oldChoice.color) + (_ : originalPrefix.series.data.gamma oldi.succ = some oldGamma) + (_ : (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) = oldi.succ), + False + +private abbrev helperHtreePrefixFull719Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds) + (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (available : + RevisitingExtensionCertificate corr.replacementSeries.data (Fin.last originalPrefix.rounds)), + ∀ (oldi : Fin originalPrefix.rounds) + (_ : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (_ : Fin k), + (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) = oldi.succ → + oldi.succ = (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) → + ∀ (horiginalRoundsLess : originalPrefix.rounds < ett.rounds), + ∀ (fulli : Fin ett.rounds), + fulli.succ = + (Fin.castLE (by omega) (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) : + Fin (ett.rounds + (1 : ℕ))) → + originalPrefix.series.data.tree oldi.succ.castSucc = + ett.series.data.tree fulli.succ.castSucc + +private abbrev helperBranch3084Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i)) → + ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + ¬Nonempty + (RevisitingExtensionCertificate ett.series.data + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc) → + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + replacementLast = + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc → + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).succ.castSucc → + ∀ + (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k), + originalPrefix.series.data.stored oldi.succ = + (insert oldChoice.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k)) → + originalPrefix.series.data.connectingEdges oldi.succ = + ({ oldChoice.edge } : Finset E) → + earlierPrefix = oldi.succ → + oldi.succ = earlierPrefix → + ∀ (newGamma : Fin k) + (newChoicePE : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)) + (hbaseTree : + corr.replacementSeries.data.tree oldi.succ.castSucc = + originalPrefix.series.data.tree oldi.succ.castSucc), + ( + ∀ {A B : TreeSequence G e0} (hAB : A = B) (C : Finset (Fin k)) + (phi : PartialEdgeColoring E k) (ch : MaximumDefectiveChoice G e0 A C phi), + (@Eq.rec (@TreeSequence V E G e0) A + (fun (x : @TreeSequence V E G e0) (h : @Eq (@TreeSequence V E G e0) A x) ↦ + @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) + ch B hAB).edge = + ch.edge ∧ + (@Eq.rec (@TreeSequence V E G e0) A + (fun (x : @TreeSequence V E G e0) (h : @Eq (@TreeSequence V E G e0) A x) ↦ + @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) + ch B hAB).vertex = + ch.vertex ∧ + (@Eq.rec (@TreeSequence V E G e0) A + (fun (x : @TreeSequence V E G e0) (h : @Eq (@TreeSequence V E G e0) A x) ↦ + @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) + ch B hAB).otherEndpoint = + ch.otherEndpoint ∧ + (@Eq.rec (@TreeSequence V E G e0) A + (fun (x : @TreeSequence V E G e0) (h : @Eq (@TreeSequence V E G e0) A x) ↦ + @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) + ch B hAB).color = + ch.color) → + ( + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) + (second : PartialEdgeColoring E k), + IsProperEdgeColoring G second → + StableColoring X (insert ch.color C : Finset (Fin k)) ch.selected second → + g ∈ MissingColors G ch.selected ch.vertex → + let post : PartialEdgeColoring E k := + TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex); + ch.color ∈ MissingColors G post ch.vertex ∧ + g ∉ MissingColors G post ch.vertex ∧ g ≠ ch.color) → + oldChoice.color ∈ + MissingColors G (originalPrefix.series.data.coloring oldi.succ) + oldChoice.vertex → + oldGamma ∉ + MissingColors G (originalPrefix.series.data.coloring oldi.succ) + oldChoice.vertex → + oldChoice.color = available.delta → + oldGamma = available.gamma → + available.returnVertex ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree earlierPrefix.castSucc) → + let originalReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) + available.gamma available.delta; + ∀ + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, edge ∈ originalReturnGraph.edgeSet), + let originalReturnPath : + originalReturnGraph.Walk (Sum.inr available.edge) + (Sum.inl available.returnVertex) := + available.returnPath.transfer originalReturnGraph returnEdgeTransfer; + originalReturnPath.IsPath → + ( + ∀ (z : V ⊕ E), + z ∈ originalReturnPath.support ↔ z ∈ available.returnPath.support) → + Sum.inl available.returnVertex ∈ + TwoColorComponent G (ett.series.data.coloring q.castSucc) + available.gamma available.delta (Sum.inr available.edge) → + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G (ett.series.data.coloring q.castSucc) + available.gamma available.delta (Sum.inr available.edge) → + ∀ (horiginalRoundsLess : originalPrefix.rounds < ett.rounds) + (originalCycle : + TwoColorCycle G (ett.series.data.coloring q.castSucc) available.gamma + available.delta), + ( + ∀ (x : V ⊕ E), + x ∈ originalCycle.walk.support ↔ + x ∈ + TwoColorComponent G (ett.series.data.coloring q.castSucc) + available.gamma available.delta (Sum.inr available.edge)) → + let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := + Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + earlierPrefix; + ett.series.data.kind oldEarlier = some TashkinovExtensionKind.PE → + ∀ (fulli : Fin ett.rounds) + (fullChoice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree fulli.succ.castSucc) + (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) + (fullGamma : Fin k), + ParallelExtensionColor ett.series.data fulli.castSucc + fullChoice.selected fullChoice.vertex fullGamma → + ∀ (fullSecond : PartialEdgeColoring E k), + IsProperEdgeColoring G fullSecond → + StableColoring (ett.series.data.tree fulli.succ.castSucc) + (insert fullChoice.color + (TashkinovStoredColors ett.series.data fulli.castSucc) : + Finset (Fin k)) + fullChoice.selected fullSecond → + ett.series.data.coloring fulli.succ = + TwoColorComponentSwap G fullSecond fullGamma fullChoice.color + (Sum.inl fullChoice.vertex) → + ett.series.data.stored fulli.succ = + (insert fullChoice.color ({ fullGamma } : Finset (Fin k)) : + Finset (Fin k)) → + ett.series.data.connectingEdges fulli.succ = + ({ fullChoice.edge } : Finset E) → + ett.series.data.delta fulli.succ = some fullChoice.color → + ett.series.data.gamma fulli.succ = some fullGamma → + oldEarlier = fulli.succ → + False + +private abbrev helperHoriginalPathInQ1511Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let originalReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) available.gamma + available.delta; + ∀ + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, edge ∈ originalReturnGraph.edgeSet), + let originalReturnPath : + originalReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer originalReturnGraph returnEdgeTransfer; + ∀ z ∈ originalReturnPath.support, + z ∈ + TwoColorComponent G (ett.series.data.coloring q.castSucc) available.gamma available.delta + (Sum.inr available.edge) + +private abbrev helperContinuation1990Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hprefixTrees : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) + (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (noRevisiting : + ¬Nonempty + (RevisitingExtensionCertificate ett.series.data + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ + (hlastMap : + Fin.castLE (by omega) replacementLast = + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + (hreplacementCurrentTree : + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).succ.castSucc) + (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) + (hreturnInOldEarlier : + available.returnVertex ∈ + TreeSequenceVertexSet (originalPrefix.series.data.tree earlierPrefix.castSucc)), + let originalReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) available.gamma + available.delta; + ∀ + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, edge ∈ originalReturnGraph.edgeSet), + let originalReturnPath : + originalReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer originalReturnGraph returnEdgeTransfer; + ∀ (horiginalReturnIsPath : originalReturnPath.IsPath) + (horiginalReturnSupport : + ∀ (z : V ⊕ E), + z ∈ originalReturnPath.support ↔ z ∈ available.returnPath.support) + (hreturnInQ : + Sum.inl available.returnVertex ∈ + TwoColorComponent G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + available.gamma available.delta (Sum.inr available.edge)) + (houtsideInQ : + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + available.gamma available.delta (Sum.inr available.edge)) + (horiginalRoundsLess : originalPrefix.rounds < ett.rounds) + (originalCycle : + TwoColorCycle G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + available.gamma available.delta) + (hcycleFull : + ∀ (x : V ⊕ E), + x ∈ originalCycle.walk.support ↔ + x ∈ + TwoColorComponent G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + available.gamma available.delta (Sum.inr available.edge)), + let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE (by omega) earlierPrefix; + ∀ (hfullEarlierKind : ett.series.data.kind oldEarlier = some TashkinovExtensionKind.PE) + (fulli : Fin ett.rounds) + (fullChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree fulli.succ.castSucc) + (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) + (fullGamma : Fin k) + (fullCurrentDelta : ett.series.data.delta fulli.succ = some fullChoice.color) + (fullCurrentGamma : ett.series.data.gamma fulli.succ = some fullGamma) + (hfullIndex : fulli.succ = oldEarlier) + (htreePrefixFull : + originalPrefix.series.data.tree oldi.succ.castSucc = + ett.series.data.tree fulli.succ.castSucc), + let prefixChoiceOnFull : + MaximumDefectiveChoice G e0 (ett.series.data.tree fulli.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) := + (htreePrefixFull ▸ oldChoice); + ∀ (hprefColorCast : prefixChoiceOnFull.color = oldChoice.color) + (hfullEdgePairs : + ({ prefixChoiceOnFull.edge } : Finset E) = ({ fullChoice.edge } : Finset E)) + (hfullColorPairs : + (insert prefixChoiceOnFull.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k)) = + (insert fullChoice.color ({ fullGamma } : Finset (Fin k)) : Finset (Fin k))) + (hfullDeltaMissing : + fullChoice.color ∈ + MissingColors G (ett.series.data.coloring fulli.succ) fullChoice.vertex) + (hfullGammaNotMissing : + fullGamma ∉ MissingColors G (ett.series.data.coloring fulli.succ) fullChoice.vertex) + (hmissingPrefixFull : + MissingColors G (originalPrefix.series.data.coloring oldi.succ) + prefixChoiceOnFull.vertex = + MissingColors G (ett.series.data.coloring fulli.succ) fullChoice.vertex) + (hprefDeltaForFull : + prefixChoiceOnFull.color ∈ + MissingColors G (originalPrefix.series.data.coloring oldi.succ) + prefixChoiceOnFull.vertex) + (hprefGammaForFull : + oldGamma ∉ + MissingColors G (originalPrefix.series.data.coloring oldi.succ) + prefixChoiceOnFull.vertex), + False + +private abbrev helperBranch1721Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds), + ∀ (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) → + ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + ¬Nonempty + (RevisitingExtensionCertificate ett.series.data + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) → + Fin.castLE (by omega) + (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))) = + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc → + corr.replacementSeries.data.tree + (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))).succ = + ett.series.data.tree + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc → + ∀ + (available : + RevisitingExtensionCertificate corr.replacementSeries.data + (Fin.last originalPrefix.rounds)), + ∀ (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k), + originalPrefix.series.data.stored oldi.succ = + (insert oldChoice.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k)) → + originalPrefix.series.data.connectingEdges oldi.succ = + ({ oldChoice.edge } : Finset E) → + (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) = oldi.succ → + oldi.succ = (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) → + ∀ (_ : Fin k) + (_ : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)) + (_ : + corr.replacementSeries.data.tree oldi.succ.castSucc = + originalPrefix.series.data.tree oldi.succ.castSucc), + ( + ∀ {A B : TreeSequence G e0} (hAB : A = B) (C : Finset (Fin k)) + (phi : PartialEdgeColoring E k) (ch : MaximumDefectiveChoice G e0 A C phi), + (@Eq.rec (@TreeSequence V E G e0) A + (fun (x : @TreeSequence V E G e0) (_ : @Eq (@TreeSequence V E G e0) A x) ↦ + @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) + ch B hAB).edge = + ch.edge ∧ + (@Eq.rec (@TreeSequence V E G e0) A + (fun (x : @TreeSequence V E G e0) (_ : @Eq (@TreeSequence V E G e0) A x) ↦ + @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) + ch B hAB).vertex = + ch.vertex ∧ + (@Eq.rec (@TreeSequence V E G e0) A + (fun (x : @TreeSequence V E G e0) (_ : @Eq (@TreeSequence V E G e0) A x) ↦ + @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) + ch B hAB).otherEndpoint = + ch.otherEndpoint ∧ + (@Eq.rec (@TreeSequence V E G e0) A + (fun (x : @TreeSequence V E G e0) (_ : @Eq (@TreeSequence V E G e0) A x) ↦ + @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) + ch B hAB).color = + ch.color) → + ( + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) + (second : PartialEdgeColoring E k), + IsProperEdgeColoring G second → + StableColoring X (insert ch.color C : Finset (Fin k)) ch.selected second → + g ∈ MissingColors G ch.selected ch.vertex → + let post : PartialEdgeColoring E k := + TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex); + ch.color ∈ MissingColors G post ch.vertex ∧ + g ∉ MissingColors G post ch.vertex ∧ g ≠ ch.color) → + oldChoice.color ∈ + MissingColors G (originalPrefix.series.data.coloring oldi.succ) + oldChoice.vertex → + oldGamma ∉ + MissingColors G (originalPrefix.series.data.coloring oldi.succ) + oldChoice.vertex → + oldChoice.color = available.delta → + oldGamma = available.gamma → + available.returnVertex ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree + (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))).castSucc) → + ∀ + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, + edge ∈ + (TwoColorIncidenceGraph G + (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc) + available.gamma available.delta : + SimpleGraph (V ⊕ E)).edgeSet), + (available.returnPath.transfer + (TwoColorIncidenceGraph G + (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc) + available.gamma available.delta : + SimpleGraph (V ⊕ E)) + returnEdgeTransfer : + (TwoColorIncidenceGraph G + (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc) + available.gamma available.delta : + SimpleGraph (V ⊕ E)).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)).IsPath → + ( + ∀ (z : V ⊕ E), + z ∈ + (available.returnPath.transfer + (TwoColorIncidenceGraph G + (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc) + available.gamma available.delta : + SimpleGraph (V ⊕ E)) + returnEdgeTransfer : + (TwoColorIncidenceGraph G + (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc) + available.gamma available.delta : + SimpleGraph (V ⊕ E)).Walk + (Sum.inr available.edge) + (Sum.inl available.returnVertex)).support ↔ + z ∈ available.returnPath.support) → + Sum.inl available.returnVertex ∈ + TwoColorComponent G + (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc) + available.gamma available.delta (Sum.inr available.edge) → + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G + (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc) + available.gamma available.delta (Sum.inr available.edge) → + ∀ (horiginalRoundsLess : originalPrefix.rounds < ett.rounds) + (originalCycle : + TwoColorCycle G + (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc) + available.gamma available.delta), + ( + ∀ (x : V ⊕ E), + x ∈ originalCycle.walk.support ↔ + x ∈ + TwoColorComponent G + (ett.series.data.coloring + ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + Fin ett.rounds).castSucc) + available.gamma available.delta (Sum.inr available.edge)) → + ett.series.data.kind + (Fin.castLE (by omega) + (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) : + Fin (ett.rounds + (1 : ℕ))) = + some TashkinovExtensionKind.PE → + ∀ (fulli : Fin ett.rounds) + (fullChoice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree fulli.succ.castSucc) + (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) + (fullGamma : Fin k), + ParallelExtensionColor ett.series.data fulli.castSucc + fullChoice.selected fullChoice.vertex fullGamma → + ∀ (fullSecond : PartialEdgeColoring E k), + IsProperEdgeColoring G fullSecond → + StableColoring (ett.series.data.tree fulli.succ.castSucc) + (insert fullChoice.color + (TashkinovStoredColors ett.series.data fulli.castSucc) : + Finset (Fin k)) + fullChoice.selected fullSecond → + ett.series.data.coloring fulli.succ = + TwoColorComponentSwap G fullSecond fullGamma fullChoice.color + (Sum.inl fullChoice.vertex) → + ett.series.data.stored fulli.succ = + (insert fullChoice.color ({ fullGamma } : Finset (Fin k)) : + Finset (Fin k)) → + ett.series.data.connectingEdges fulli.succ = + ({ fullChoice.edge } : Finset E) → + ett.series.data.delta fulli.succ = some fullChoice.color → + ett.series.data.gamma fulli.succ = some fullGamma → + (Fin.castLE (by omega) + (available.earlier : + Fin (originalPrefix.rounds + (1 : ℕ))) : + Fin (ett.rounds + (1 : ℕ))) = + fulli.succ → + False + +private abbrev helperPePostStatus3432Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + IsProperEdgeColoring G second → + StableColoring X (insert ch.color C : Finset (Fin k)) ch.selected second → + g ∈ MissingColors G ch.selected ch.vertex → + let post : PartialEdgeColoring E k := + TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex); + ch.color ∈ MissingColors G post ch.vertex ∧ g ∉ MissingColors G post ch.vertex ∧ g ≠ ch.color + +private abbrev helperContinuation4070Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds) + (hlower : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + (0 : ℕ) < lower.rounds → + lower.rounds < ett.rounds → + MaximumProperty lower → + ( + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tnext : TreeSequence G e0 := + lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ))); + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (alpha beta : Fin k), + alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma Tnext → + TreeInterchangeable G Tnext sigma alpha beta) ∧ + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex n = some v → + lower.series.data.gamma n = some gamma → + lower.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, + Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ w = v), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) + (previousProper : + IsProperEdgeColoring G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (previousOneUncolored : + IsOneEdgeUncolored + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) e0) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (hprefixMP : MaximumProperty originalPrefix) + (hprefixTrees : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) + (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (hcorrMP : MaximumProperty corr.replacementETT) + (noRevisiting : + ¬Nonempty + (RevisitingExtensionCertificate ett.series.data + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (horiginalPositive : (0 : ℕ) < originalPrefix.rounds) + (hlastMap : + Fin.castLE (by omega) replacementLast = + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + (hreplacementCurrentTree : + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).succ.castSucc) + (peRootOnly : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 input' T' generating'), + (0 : ℕ) < base.rounds → + base.rounds < ett.rounds → + MaximumProperty base → + ∀ (r : ℕ) (series : TashkinovSeries G k r e0 input'), + base.rounds = r → + base.series ≍ series → + ∀ (a : Fin (r + (1 : ℕ))) (v : V) (gamma delta : Fin k), + (0 : ℕ) < (↑a : ℕ) → + series.data.kind a = some TashkinovExtensionKind.PE → + series.data.chosenVertex a = some v → + series.data.gamma a = some gamma → + series.data.delta a = some delta → + IsProperEdgeColoring G (series.data.coloring a) → + IsOneEdgeUncolored (series.data.coloring a) e0 → + ∀ w ∈ TreeSequenceVertexSet (series.data.tree a.castSucc), + Sum.inl w ∈ + TwoColorComponent G (series.data.coloring a) gamma delta (Sum.inl v) ↔ + w = v) + (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ + (hbaseEarlierKind : + originalPrefix.series.data.kind earlierPrefix = some TashkinovExtensionKind.PE) + (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) + (oldCurrentProper : IsProperEdgeColoring G (originalPrefix.series.data.coloring oldi.succ)) + (oldCurrentOne : IsOneEdgeUncolored (originalPrefix.series.data.coloring oldi.succ) e0) + (oldCurrentStored : + originalPrefix.series.data.stored oldi.succ = + (insert oldChoice.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k))) + (oldCurrentEdges : + originalPrefix.series.data.connectingEdges oldi.succ = ({ oldChoice.edge } : Finset E)) + (oldCurrentKind : originalPrefix.series.data.kind oldi.succ = some TashkinovExtensionKind.PE) + (oldCurrentVertex : originalPrefix.series.data.chosenVertex oldi.succ = some oldChoice.vertex) + (oldCurrentDelta : originalPrefix.series.data.delta oldi.succ = some oldChoice.color) + (oldCurrentGamma : originalPrefix.series.data.gamma oldi.succ = some oldGamma) + (hbaseTarget : earlierPrefix = oldi.succ) (holdIndex : oldi.succ = earlierPrefix) + (newGamma : Fin k) + (newChoicePE : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)) + (newCurrentProper : IsProperEdgeColoring G (corr.replacementSeries.data.coloring oldi.succ)) + (newCurrentOne : IsOneEdgeUncolored (corr.replacementSeries.data.coloring oldi.succ) e0) + (newCurrentKind : corr.replacementSeries.data.kind oldi.succ = some TashkinovExtensionKind.PE) + (newCurrentVertex : + corr.replacementSeries.data.chosenVertex oldi.succ = some newChoicePE.vertex) + (newCurrentDelta : corr.replacementSeries.data.delta oldi.succ = some newChoicePE.color) + (newCurrentGamma : corr.replacementSeries.data.gamma oldi.succ = some newGamma) + (hbaseTree : + corr.replacementSeries.data.tree oldi.succ.castSucc = + originalPrefix.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) := + (Eq.symm hbaseTree ▸ oldChoice); + ∀ + (transportChoiceFields : + ∀ {A B : TreeSequence G e0} (hAB : A = B) (C : Finset (Fin k)) + (phi : PartialEdgeColoring E k) (ch : MaximumDefectiveChoice G e0 A C phi), + (hAB ▸ ch).edge = ch.edge ∧ + (hAB ▸ ch).vertex = ch.vertex ∧ + (hAB ▸ ch).otherEndpoint = ch.otherEndpoint ∧ (hAB ▸ ch).color = ch.color) + (holdColorCast : oldChoiceOnNew.color = oldChoice.color) + (pePostStatus : + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + IsProperEdgeColoring G second → + StableColoring X (insert ch.color C : Finset (Fin k)) ch.selected second → + g ∈ MissingColors G ch.selected ch.vertex → + let post : PartialEdgeColoring E k := + TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex); + ch.color ∈ MissingColors G post ch.vertex ∧ + g ∉ MissingColors G post ch.vertex ∧ g ≠ ch.color) + (holdDeltaMissing : + oldChoice.color ∈ + MissingColors G (originalPrefix.series.data.coloring oldi.succ) oldChoice.vertex) + (holdGammaNotMissing : + oldGamma ∉ MissingColors G (originalPrefix.series.data.coloring oldi.succ) oldChoice.vertex) + (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma ≠ newChoicePE.color) + (hidentifiedDelta : newChoicePE.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) + (hnewDeltaAvailable : newChoicePE.color = available.delta) + (hnewGammaAvailable : newGamma = available.gamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) + (hnewVertexOld : newChoicePE.vertex = oldChoice.vertex) + (hnewPostSigmaPrev : corr.replacementSeries.data.coloring oldi.succ = sigmaPrev) + (hbaseFinalColor : + originalPrefix.series.data.coloring replacementLast = ett.series.data.coloring q.castSucc) + (holdPostOriginal : + originalPrefix.series.data.coloring oldi.succ = ett.series.data.coloring q.castSucc) + (holdDeltaOriginal : + available.delta ∈ MissingColors G (ett.series.data.coloring q.castSucc) oldChoice.vertex) + (hgammaDeltaNe : available.gamma ≠ available.delta) + (holdVertexFinal : + oldChoice.vertex ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))))) + (hreturnInOldEarlier : + available.returnVertex ∈ + TreeSequenceVertexSet (originalPrefix.series.data.tree earlierPrefix.castSucc)) + (hreturnInFinal : + available.returnVertex ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))))), + let originalReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) available.gamma + available.delta; + ∀ + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, edge ∈ originalReturnGraph.edgeSet), + let originalReturnPath : + originalReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer originalReturnGraph returnEdgeTransfer; + ∀ (horiginalReturnIsPath : originalReturnPath.IsPath) + (horiginalReturnSupport : + ∀ (z : V ⊕ E), + z ∈ originalReturnPath.support ↔ z ∈ available.returnPath.support) + (hreturnInQ : + Sum.inl available.returnVertex ∈ + TwoColorComponent G (ett.series.data.coloring q.castSucc) available.gamma available.delta + (Sum.inr available.edge)) + (houtsideInQ : + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G (ett.series.data.coloring q.castSucc) available.gamma available.delta + (Sum.inr available.edge)) + (hpathComponent : + TwoColorNontrivialPathComponent G (ett.series.data.coloring q.castSucc) available.gamma + available.delta (Sum.inl oldChoice.vertex)) + (hpathMeetsFinal : + ∃ + v ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ)))), + Sum.inl v ∈ + TwoColorComponent G (ett.series.data.coloring q.castSucc) available.gamma + available.delta (Sum.inl oldChoice.vertex)) + (hreplacementLeaf : + ((TwoColorIncidenceGraph G (corr.replacementSeries.data.coloring replacementLast) + available.gamma available.delta).neighborSet + (Sum.inl newChoicePE.vertex)).Subsingleton), + False + +private abbrev helperContinuation4611Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds) + (hlower : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + (0 : ℕ) < lower.rounds → + lower.rounds < ett.rounds → + MaximumProperty lower → + ( + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tnext : TreeSequence G e0 := + lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ))); + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (alpha beta : Fin k), + alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma Tnext → + TreeInterchangeable G Tnext sigma alpha beta) ∧ + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex n = some v → + lower.series.data.gamma n = some gamma → + lower.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, + Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ w = v), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (previousProper : + IsProperEdgeColoring G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (previousOneUncolored : + IsOneEdgeUncolored + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) e0) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (hprefixMP : MaximumProperty originalPrefix) + (hprefixTrees : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) + (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (hcorrMP : MaximumProperty corr.replacementETT) + (noRevisiting : + ¬Nonempty + (RevisitingExtensionCertificate ett.series.data + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (hcorrFinalColor : corr.replacementSeries.data.coloring replacementLast = sigmaPrev) + (horiginalPositive : (0 : ℕ) < originalPrefix.rounds) + (hlastMap : + Fin.castLE (by omega) replacementLast = + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + (hreplacementCurrentTree : + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).succ.castSucc) + (peRootOnly : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 input' T' generating'), + (0 : ℕ) < base.rounds → + base.rounds < ett.rounds → + MaximumProperty base → + ∀ (r : ℕ) (series : TashkinovSeries G k r e0 input'), + base.rounds = r → + base.series ≍ series → + ∀ (a : Fin (r + (1 : ℕ))) (v : V) (gamma delta : Fin k), + (0 : ℕ) < (↑a : ℕ) → + series.data.kind a = some TashkinovExtensionKind.PE → + series.data.chosenVertex a = some v → + series.data.gamma a = some gamma → + series.data.delta a = some delta → + IsProperEdgeColoring G (series.data.coloring a) → + IsOneEdgeUncolored (series.data.coloring a) e0 → + ∀ w ∈ TreeSequenceVertexSet (series.data.tree a.castSucc), + Sum.inl w ∈ + TwoColorComponent G (series.data.coloring a) gamma delta (Sum.inl v) ↔ + w = v) + (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ + (hbaseEarlierKind : + originalPrefix.series.data.kind earlierPrefix = some TashkinovExtensionKind.PE) + (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) + (oldCurrentProper : IsProperEdgeColoring G (originalPrefix.series.data.coloring oldi.succ)) + (oldCurrentOne : IsOneEdgeUncolored (originalPrefix.series.data.coloring oldi.succ) e0) + (oldCurrentStored : + originalPrefix.series.data.stored oldi.succ = + (insert oldChoice.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k))) + (oldCurrentEdges : + originalPrefix.series.data.connectingEdges oldi.succ = ({ oldChoice.edge } : Finset E)) + (oldCurrentKind : originalPrefix.series.data.kind oldi.succ = some TashkinovExtensionKind.PE) + (oldCurrentVertex : originalPrefix.series.data.chosenVertex oldi.succ = some oldChoice.vertex) + (oldCurrentDelta : originalPrefix.series.data.delta oldi.succ = some oldChoice.color) + (oldCurrentGamma : originalPrefix.series.data.gamma oldi.succ = some oldGamma) + (hbaseTarget : earlierPrefix = oldi.succ) (holdIndex : oldi.succ = earlierPrefix) + (newGamma : Fin k) + (newChoicePE : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)) + (newCurrentProper : IsProperEdgeColoring G (corr.replacementSeries.data.coloring oldi.succ)) + (newCurrentOne : IsOneEdgeUncolored (corr.replacementSeries.data.coloring oldi.succ) e0) + (newCurrentKind : corr.replacementSeries.data.kind oldi.succ = some TashkinovExtensionKind.PE) + (newCurrentVertex : + corr.replacementSeries.data.chosenVertex oldi.succ = some newChoicePE.vertex) + (newCurrentDelta : corr.replacementSeries.data.delta oldi.succ = some newChoicePE.color) + (newCurrentGamma : corr.replacementSeries.data.gamma oldi.succ = some newGamma) + (hbaseTree : + corr.replacementSeries.data.tree oldi.succ.castSucc = + originalPrefix.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) := + (Eq.symm hbaseTree ▸ oldChoice); + ∀ + (transportChoiceFields : + ∀ {A B : TreeSequence G e0} (hAB : A = B) (C : Finset (Fin k)) + (phi : PartialEdgeColoring E k) (ch : MaximumDefectiveChoice G e0 A C phi), + (hAB ▸ ch).edge = ch.edge ∧ + (hAB ▸ ch).vertex = ch.vertex ∧ + (hAB ▸ ch).otherEndpoint = ch.otherEndpoint ∧ (hAB ▸ ch).color = ch.color) + (holdColorCast : oldChoiceOnNew.color = oldChoice.color) + (pePostStatus : + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + IsProperEdgeColoring G second → + StableColoring X (insert ch.color C : Finset (Fin k)) ch.selected second → + g ∈ MissingColors G ch.selected ch.vertex → + let post : PartialEdgeColoring E k := + TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex); + ch.color ∈ MissingColors G post ch.vertex ∧ + g ∉ MissingColors G post ch.vertex ∧ g ≠ ch.color) + (holdDeltaMissing : + oldChoice.color ∈ + MissingColors G (originalPrefix.series.data.coloring oldi.succ) oldChoice.vertex) + (holdGammaNotMissing : + oldGamma ∉ MissingColors G (originalPrefix.series.data.coloring oldi.succ) oldChoice.vertex) + (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma ≠ newChoicePE.color) + (hidentifiedDelta : newChoicePE.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) + (hnewDeltaAvailable : newChoicePE.color = available.delta) + (hnewGammaAvailable : newGamma = available.gamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) + (hnewVertexOld : newChoicePE.vertex = oldChoice.vertex) + (hnewPostSigmaPrev : corr.replacementSeries.data.coloring oldi.succ = sigmaPrev) + (hbaseFinalColor : + originalPrefix.series.data.coloring replacementLast = ett.series.data.coloring q.castSucc) + (holdPostOriginal : + originalPrefix.series.data.coloring oldi.succ = ett.series.data.coloring q.castSucc) + (hnewDeltaSigmaPrev : available.delta ∈ MissingColors G sigmaPrev newChoicePE.vertex) + (holdDeltaOriginal : + available.delta ∈ MissingColors G (ett.series.data.coloring q.castSucc) oldChoice.vertex) + (holdGammaOriginalNot : + available.gamma ∉ MissingColors G (ett.series.data.coloring q.castSucc) oldChoice.vertex) + (hgammaDeltaNe : available.gamma ≠ available.delta) + (holdVertexFinal : + oldChoice.vertex ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))))) + (hreturnInOldEarlier : + available.returnVertex ∈ + TreeSequenceVertexSet (originalPrefix.series.data.tree earlierPrefix.castSucc)) + (hreturnInFinal : + available.returnVertex ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))))) + (replacementReturnEdgeData : + ∀ (f : E) (hf : Sum.inr f ∈ available.returnPath.support), + TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) f ∧ + (sigmaPrev f = some available.gamma ∨ sigmaPrev f = some available.delta)) + (copyReturnEdge : + ∀ (f : E) (hf : Sum.inr f ∈ available.returnPath.support), + sigmaPrev f = ett.series.data.coloring q.castSucc f), + False + +private noncomputable abbrev helperOriginalCertificate1229.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (hroundLarge : (1 : ℕ) < ett.rounds) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (sigmaPrev : PartialEdgeColoring E k) → + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) → + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) → + ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored + (Fin.castLE + (by + have := + GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE + (by + have := + GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind + (Fin.castLE + (by + have := + GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + TashkinovStoredColors originalPrefix.series.data + i = + TashkinovStoredColors ett.series.data + (Fin.castLE + (by + have := + GoldbergSeymour.TreeSequence.positive T + omega) + i)) → + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix + sigmaPrev + (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) → + let replacementLast : + Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + replacementLast = + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc → + (available : + RevisitingExtensionCertificate + corr.replacementSeries.data replacementLast) → + let earlierPrefix : + Fin (originalPrefix.rounds + (1 : ℕ)) := + available.earlier; + (oldi : Fin originalPrefix.rounds) → + (oldChoice : + MaximumDefectiveChoice G e0 + (originalPrefix.series.data.tree + oldi.succ.castSucc) + (TashkinovStoredColors + originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring + oldi.castSucc)) → + (oldGamma : Fin k) → + available.returnVertex ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree + earlierPrefix.castSucc) → + let originalReturnGraph : + SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta; + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, + edge ∈ originalReturnGraph.edgeSet) → + let originalReturnPath : + originalReturnGraph.Walk + (Sum.inr available.edge) + (Sum.inl available.returnVertex) := + available.returnPath.transfer + originalReturnGraph returnEdgeTransfer; + originalReturnPath.IsPath → + ( + ∀ (z : V ⊕ E), + z ∈ originalReturnPath.support ↔ + z ∈ available.returnPath.support) → + Sum.inl available.returnVertex ∈ + TwoColorComponent G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin ett.rounds).castSucc) + available.gamma available.delta + (Sum.inr available.edge) → + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin ett.rounds).castSucc) + available.gamma available.delta + (Sum.inr available.edge) → + (horiginalRoundsLess : + originalPrefix.rounds < + ett.rounds) → + (originalCycle : + TwoColorCycle G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin + ett.rounds).castSucc) + available.gamma + available.delta) → + ( + ∀ (x : V ⊕ E), + x ∈ + originalCycle.walk.support ↔ + x ∈ + TwoColorComponent G + (ett.series.data.coloring + (⟨ett.rounds - + (1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin + ett.rounds).castSucc) + available.gamma + available.delta + (Sum.inr + available.edge)) → + let oldEarlier : + Fin + (ett.rounds + (1 : ℕ)) := + Fin.castLE + (by + have := + GoldbergSeymour.TreeSequence.positive + T + omega) + earlierPrefix; + ett.series.data.kind + oldEarlier = + some + TashkinovExtensionKind.PE → + (fulli : Fin ett.rounds) → + (fullChoice : + MaximumDefectiveChoice + G e0 + (ett.series.data.tree + fulli.succ.castSucc) + (TashkinovStoredColors + ett.series.data + fulli.castSucc) + (ett.series.data.coloring + fulli.castSucc)) → + (fullGamma : Fin k) → + ett.series.data.delta + fulli.succ = + some + fullChoice.color → + ett.series.data.gamma + fulli.succ = + some fullGamma → + fulli.succ = + oldEarlier → + originalPrefix.series.data.tree + oldi.succ.castSucc = + ett.series.data.tree + fulli.succ.castSucc → + fullChoice.color = + available.delta → + fullGamma = + available.gamma → + ett.series.data.tree + q.castSucc.succ = + corr.replacementSeries.data.tree + replacementLast.succ → + originalPrefix.series.data.tree + earlierPrefix.castSucc = + ett.series.data.tree + oldEarlier.castSucc → + (∀ + z ∈ + originalReturnPath.support, + z ∈ + TwoColorComponent + G + (ett.series.data.coloring + q.castSucc) + available.gamma + available.delta + (Sum.inr + available.edge)) → + RevisitingExtensionCertificate + ett.series.data + q.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix hr + hprefixData corr replacementLast hlastMap available earlierPrefix oldi oldChoice oldGamma + hreturnInOldEarlier originalReturnGraph returnEdgeTransfer originalReturnPath + horiginalReturnIsPath horiginalReturnSupport hreturnInQ houtsideInQ horiginalRoundsLess + originalCycle hcycleFull oldEarlier hfullEarlierKind fulli fullChoice fullGamma + fullCurrentDelta fullCurrentGamma hfullIndex htreePrefixFull hfullDeltaAvailable + hfullGammaAvailable hcertificateCurrentTree hprefixEarlierTree horiginalPathInQ + exact { + earlier := oldEarlier + earlierPositive := by + simpa [oldEarlier, earlierPrefix] using + available.earlierPositive + earlierAtMost := by + have hle := available.earlierAtMost + have hlastVals := congrArg Fin.val hlastMap + simpa [oldEarlier, earlierPrefix] using + hle.trans_eq hlastVals + earlierPE := hfullEarlierKind + interveningRevisiting := by + apply revisitingExtensionKindsInPrefix <;> assumption + gamma := available.gamma + delta := available.delta + earlierGamma := by + rw [← hfullIndex, fullCurrentGamma, + hfullGammaAvailable] + earlierDelta := by + rw [← hfullIndex, fullCurrentDelta, + hfullDeltaAvailable] + cycle := originalCycle + meetsEarlier := by + refine ⟨available.returnVertex, ?_, ?_⟩ + · rw [← hprefixEarlierTree] + exact hreturnInOldEarlier + · exact (hcycleFull _).2 hreturnInQ + leavesCurrent := by + refine ⟨available.outsideEndpoint, ?_, ?_⟩ + · rw [hcertificateCurrentTree] + exact available.outsideNotCurrent + · exact (hcycleFull _).2 houtsideInQ + edge := available.edge + edgeOnCycle := (hcycleFull _).2 rfl + edgeBoundary := by + rw [hcertificateCurrentTree] + exact available.edgeBoundary + insideEndpoint := available.insideEndpoint + outsideEndpoint := available.outsideEndpoint + insideInCurrent := by + rw [hcertificateCurrentTree] + exact available.insideInCurrent + outsideNotCurrent := by + rw [hcertificateCurrentTree] + exact available.outsideNotCurrent + edgeEnds := available.edgeEnds + returnVertex := available.returnVertex + returnInEarlier := by + rw [← hprefixEarlierTree] + exact hreturnInOldEarlier + returnPath := originalReturnPath + returnPathIsPath := horiginalReturnIsPath + returnPathOnCycle := by + intro z hz + exact (hcycleFull z).2 (horiginalPathInQ z hz) + returnPathInternal := by + intro v hv + have hvAvailable : Sum.inl v ∈ + available.returnPath.support := + (horiginalReturnSupport (Sum.inl v)).mp hv + rw [hcertificateCurrentTree] + exact available.returnPathInternal v hvAvailable + } + +private theorem helper_peRootOnly_167.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) + (_ : + ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating') + (_ : (0 : ℕ) < lower.rounds) (_ : lower.rounds < ett.rounds) + (_ : MaximumProperty lower), + ( + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tnext : TreeSequence G e0 := + lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ))); + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ (alpha beta : Fin k), + alpha ∈ TreeMissingColors sigma Tnext ∨ + beta ∈ TreeMissingColors sigma Tnext → + TreeInterchangeable G Tnext sigma alpha beta) ∧ + let n : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc; + ∀ (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex n = some v → + lower.series.data.gamma n = some gamma → + lower.series.data.delta n = some delta → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ w ∈ TreeSequenceVertexSet Tn, + Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ + w = v)) + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 input' T' generating') + (_ : (0 : ℕ) < base.rounds) (_ : base.rounds < ett.rounds) + (_ : MaximumProperty base) (r : ℕ) (series : TashkinovSeries G k r e0 input') + (_ : base.rounds = r) (_ : base.series ≍ series) (a : Fin (r + (1 : ℕ))) (v : V) + (gamma delta : Fin k) (_ : (0 : ℕ) < (↑a : ℕ)) + (_ : series.data.kind a = some TashkinovExtensionKind.PE) + (_ : series.data.chosenVertex a = some v) (_ : series.data.gamma a = some gamma) + (_ : series.data.delta a = some delta) + (_ : IsProperEdgeColoring G (series.data.coloring a)) + (_ : IsOneEdgeUncolored (series.data.coloring a) e0), + ∀ w ∈ TreeSequenceVertexSet (series.data.tree a.castSucc), + Sum.inl w ∈ TwoColorComponent G (series.data.coloring a) gamma delta (Sum.inl v) ↔ + w = v := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge hlower originalPrefix hr input' T' + generating' base hp hl hm r series hrSeries hseries + cases hrSeries + cases hseries + intro a v gamma delta ha hk hv hg hd hproper hone + by_cases hlast : a.val = base.rounds + · have haLast : a = Fin.last base.rounds := Fin.ext hlast + subst a + exact (hlower base hp hl hm).2 v gamma delta hk hv hg hd + (base.series.data.coloring (Fin.last base.rounds)) hproper hone + ⟨(by intros; rfl), (by intros; rfl)⟩ + · have habefore : a.val < base.rounds := by + have habound := a.isLt + omega + obtain ⟨restricted, hrRestricted, hmaxRestricted, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input' T' generating' base hm + a.val (by omega) habefore + have hrestrictedPositive : 0 < restricted.rounds := by + rw [hrRestricted] + exact ha + have hrestrictedLess : restricted.rounds < ett.rounds := by + rw [hrRestricted] + exact habefore.trans hl + let lastRestricted : Fin (restricted.rounds + 1) := + Fin.last restricted.rounds + have hmap : Fin.castLE (by omega) lastRestricted = a := by + apply Fin.ext + simp [lastRestricted, hrRestricted] + have htree : restricted.series.data.tree lastRestricted.castSucc = + base.series.data.tree a.castSucc := by + calc + restricted.series.data.tree lastRestricted.castSucc = + base.series.data.tree + (Fin.castLE (by omega) lastRestricted.castSucc) := + htrees lastRestricted.castSucc + _ = base.series.data.tree a.castSucc := by + congr 1 + apply Fin.ext + simp [lastRestricted, hrRestricted] + rcases hdata lastRestricted with + ⟨hc, _, _, hkind, hvertex, _, hdelta, hgamma, _, _⟩ + rw [hmap] at hc hkind hvertex hdelta hgamma + have hroot := (hlower restricted hrestrictedPositive hrestrictedLess + hmaxRestricted).2 v gamma delta + (by simpa only [← hkind] using hk) + (by simpa only [← hvertex] using hv) + (by simpa only [← hgamma] using hg) + (by simpa only [← hdelta] using hd) + (base.series.data.coloring a) hproper hone (by + change StableColoring _ _ + (restricted.series.data.coloring lastRestricted) _ + rw [hc] + exact ⟨(by intros; rfl), (by intros; rfl)⟩) + intro w hw + apply hroot w + change w ∈ TreeSequenceVertexSet + (restricted.series.data.tree lastRestricted.castSucc) + rw [htree] + exact hw + +private theorem helper_reStepColoring_872.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < + ett.rounds) (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree + G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : RevisitingExtensionCertificate + corr.replacementSeries.data (Fin.last originalPrefix.rounds)) (oldi : Fin + originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree + oldi.succ.castSucc) (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) (_ _ : Fin k) (_ : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)), + corr.replacementSeries.data.tree + oldi.succ.castSucc = originalPrefix.series.data.tree oldi.succ.castSucc → + ∀ {rounds' : ℕ} + {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 input') (j : + Fin rounds'), + series.data.kind j.succ = some TashkinovExtensionKind.RE → + series.data.coloring j.succ = series.data.coloring j.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + available oldi oldChoice oldGamma newGamma newChoicePE hbaseTree rounds' input' series j hj + have hstep := series.certified j.succ + generalize hslot : j.succ = slot at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored + initialEdges initialKind initialVertex initialOutside + initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero j hslot).elim + | SE i prevProper prevOne prevClosed prevNotStrong noRE + ch alternative coloring stored edges kind vertex + outside delta gamma adjoined adjoinedExactly closed + ordered strict => + have hbad := kind.symm.trans + (by simpa [hslot] using hj) + cases hbad + | PE i prevProper prevOne prevClosed prevNotStrong noRE + ch alternativeFails gamma gammaRule second + secondProper secondOne secondStable exit coloring + coloringProper coloringOne stored edges kind vertex + outside delta gammaValue closed ordered strict => + have hbad := kind.symm.trans + (by simpa [hslot] using hj) + cases hbad + | RE i prevProper prevOne prevClosed prevNotStrong cert + coloring stored edges kind vertex outside delta gamma + adjoined adjoinedExactly closed ordered strict => + have hi : i = j := by + apply Fin.ext + have hv := congrArg Fin.val hslot + simp only [Fin.val_succ] at hv + omega + subst i + simpa [hslot] using coloring + +private theorem helper_reIntervalColoring_913.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < + ett.rounds) (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree + G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : RevisitingExtensionCertificate + corr.replacementSeries.data (Fin.last originalPrefix.rounds)) (oldi : Fin + originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree + oldi.succ.castSucc) (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) (_ _ : Fin k) (_ : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)), + corr.replacementSeries.data.tree + oldi.succ.castSucc = originalPrefix.series.data.tree oldi.succ.castSucc → + ( + ∀ {rounds' : ℕ} + {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 input') (j : + Fin rounds'), + series.data.kind j.succ = some TashkinovExtensionKind.RE → + series.data.coloring j.succ = series.data.coloring j.castSucc) → + ∀ {rounds' : ℕ} {input' : + PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 input') (a b : Fin + (rounds' + (1 : ℕ))), + (↑a : ℕ) ≤ (↑b : ℕ) → + ( + ∀ (j : Fin (rounds' + (1 : ℕ))), + (↑a : ℕ) < + (↑j : ℕ) → + (↑j : ℕ) ≤ (↑b : ℕ) → + series.data.kind j = some TashkinovExtensionKind.RE) → + series.data.coloring b = series.data.coloring a := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + available oldi oldChoice oldGamma newGamma newChoicePE hbaseTree reStepColoring rounds' + input' series a b hab hbetween + have coloringAlong : ∀ m : ℕ, a.val ≤ m → + m ≤ b.val → ∀ x : Fin (rounds' + 1), + x.val = m → + series.data.coloring x = series.data.coloring a := by + intro m ham + induction m, ham using Nat.le_induction with + | base => + intro hmb x hx + have hxa : x = a := by + apply Fin.ext + omega + rw [hxa] + | succ m ham ih => + intro hmb x hx + let j : Fin rounds' := ⟨m, by + have hbLt := b.isLt + omega⟩ + have hjKind : series.data.kind j.succ = + some TashkinovExtensionKind.RE := by + apply hbetween j.succ + · simp [j] + omega + · simp [j] + omega + have hstep := reStepColoring series j hjKind + have hxj : x = j.succ := by + apply Fin.ext + simp [j, hx] + calc + series.data.coloring x = + series.data.coloring j.succ := by rw [hxj] + _ = series.data.coloring j.castSucc := hstep + _ = series.data.coloring a := + ih (by omega) j.castSucc (by simp [j]) + exact coloringAlong b.val hab le_rfl b rfl + +private theorem helper_stepSegment_1041.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < + ett.rounds) (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree + G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : RevisitingExtensionCertificate + corr.replacementSeries.data (Fin.last originalPrefix.rounds)) (oldi : Fin + originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree + oldi.succ.castSucc) (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) (_ _ : Fin k) (_ : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)), + corr.replacementSeries.data.tree + oldi.succ.castSucc = originalPrefix.series.data.tree oldi.succ.castSucc → + ∀ (r : Fin + originalPrefix.rounds), + TreeSequenceInitialSegment (originalPrefix.series.data.tree + r.succ.castSucc) (originalPrefix.series.data.tree r.succ.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + available oldi oldChoice oldGamma newGamma newChoicePE hbaseTree r + have hstep := originalPrefix.series.certified r.succ + generalize hslot : r.succ = slot at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored + initialEdges initialKind initialVertex initialOutside + initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero r hslot).elim + | SE i prevProper prevOne prevClosed prevNotStrong noRE ch + alternative coloring stored edges kind vertex outside + delta gamma adjoined adjoinedExactly closed ordered strict => + have hi : i = r := by + apply Fin.ext + have hv := congrArg Fin.val hslot + simp only [Fin.val_succ] at hv + omega + subst i + simpa [hslot] using ordered + | PE i prevProper prevOne prevClosed prevNotStrong noRE ch + alternativeFails gamma gammaRule second secondProper + secondOne secondStable exit coloring coloringProper + coloringOne stored edges kind vertex outside delta + gammaValue closed ordered strict => + have hi : i = r := by + apply Fin.ext + have hv := congrArg Fin.val hslot + simp only [Fin.val_succ] at hv + omega + subst i + simpa [hslot] using ordered + | RE i prevProper prevOne prevClosed prevNotStrong cert + coloring stored edges kind vertex outside delta gamma + adjoined adjoinedExactly closed ordered strict => + have hi : i = r := by + apply Fin.ext + have hv := congrArg Fin.val hslot + simp only [Fin.val_succ] at hv + omega + subst i + simpa [hslot] using ordered + +private theorem helper_treeToFinal_1111.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < + ett.rounds) (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree + G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : RevisitingExtensionCertificate + corr.replacementSeries.data (Fin.last originalPrefix.rounds)) (oldi : Fin + originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree + oldi.succ.castSucc) (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) (_ _ : Fin k) (_ : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)), + corr.replacementSeries.data.tree + oldi.succ.castSucc = originalPrefix.series.data.tree oldi.succ.castSucc → + ( + ∀ (r : Fin + originalPrefix.rounds), + TreeSequenceInitialSegment (originalPrefix.series.data.tree + r.succ.castSucc) (originalPrefix.series.data.tree r.succ.succ)) → + ( + ∀ (A B C : TreeSequence + G e0), + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → + TreeSequenceInitialSegment A C) → + ∀ (d : ℕ) (idx : Fin (originalPrefix.rounds + (2 : ℕ))), + (↑idx : ℕ) + d = originalPrefix.rounds + (1 : ℕ) → + (1 : ℕ) ≤ (↑idx : ℕ) → + TreeSequenceInitialSegment (originalPrefix.series.data.tree idx) + (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + available oldi oldChoice oldGamma newGamma newChoicePE hbaseTree stepSegment segmentTrans d + induction d with + | zero => + intro idx hidx hpos + have hi : idx = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp + omega + rw [hi] + exact ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + | succ d ih => + intro idx hidx hpos + have hlt : idx.val < originalPrefix.rounds + 1 := by + omega + let r : Fin originalPrefix.rounds := + ⟨idx.val - 1, by omega⟩ + have hleft : idx = r.succ.castSucc := by + apply Fin.ext + simp [r] + omega + let next : Fin (originalPrefix.rounds + 2) := + ⟨idx.val + 1, by omega⟩ + have hright : next = r.succ.succ := by + apply Fin.ext + simp [next, r] + omega + have hfirst : TreeSequenceInitialSegment + (originalPrefix.series.data.tree idx) + (originalPrefix.series.data.tree next) := by + rw [hleft, hright] + exact stepSegment r + exact segmentTrans _ _ _ hfirst + (ih next (by simp [next]; omega) + (by simp [next])) + +private theorem helper_returnEdgeTransfer_1317.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < + ett.rounds), + ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigmaPrev → + ∀ + (available : RevisitingExtensionCertificate corr.replacementSeries.data (Fin.last + originalPrefix.rounds)), + ( + ∀ (f : E), + Sum.inr f ∈ available.returnPath.support → + sigmaPrev + f = ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin + ett.rounds).castSucc f) → + ∀ edge ∈ available.returnPath.edges, edge ∈ + (TwoColorIncidenceGraph G (ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), by omega⟩ : + Fin ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta : SimpleGraph + (V ⊕ E)).edgeSet := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge + set q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) + intro sigmaPrev originalPrefix corr hcorrFinalColor + set replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds + intro available copyReturnEdge + set replacementReturnGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G + (corr.replacementSeries.data.coloring replacementLast) + available.gamma + available.delta + set originalReturnGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) available.gamma + available.delta + intro edge hedge + induction edge using Sym2.inductionOn with + | _ a b => + have haSupport := + available.returnPath.fst_mem_support_of_mem_edges + hedge + have hbSupport := + available.returnPath.snd_mem_support_of_mem_edges + hedge + have habReplacement : replacementReturnGraph.Adj a b := by + simpa [replacementReturnGraph] using + available.returnPath.edges_subset_edgeSet hedge + cases a with + | inl v => + cases b with + | inl w => + simp [replacementReturnGraph, TwoColorIncidenceGraph] at habReplacement + | inr f => + have hdata : Incident G v f ∧ + (corr.replacementSeries.data.coloring + replacementLast f = + some available.gamma ∨ + corr.replacementSeries.data.coloring + replacementLast f = + some available.delta) := by + simpa [replacementReturnGraph, + TwoColorIncidenceGraph] using habReplacement + have hcopy := copyReturnEdge f hbSupport + have hfinal : + corr.replacementSeries.data.coloring + replacementLast f = sigmaPrev f := by + simpa [replacementLast] using + congrFun hcorrFinalColor f + simpa [originalReturnGraph, + TwoColorIncidenceGraph, hfinal, hcopy] using hdata + | inr f => + cases b with + | inl v => + have hdata : Incident G v f ∧ + (corr.replacementSeries.data.coloring + replacementLast f = + some available.gamma ∨ + corr.replacementSeries.data.coloring + replacementLast f = + some available.delta) := by + simpa [replacementReturnGraph, + TwoColorIncidenceGraph] using habReplacement + have hcopy := copyReturnEdge f haSupport + have hfinal : + corr.replacementSeries.data.coloring + replacementLast f = sigmaPrev f := by + simpa [replacementLast] using + congrFun hcorrFinalColor f + simpa [originalReturnGraph, + TwoColorIncidenceGraph, hfinal, hcopy] using hdata + | inr g => + simp [replacementReturnGraph, TwoColorIncidenceGraph] at habReplacement + +private theorem helper_htreePrefixFull_719.{u_1, u_2} : + helperHtreePrefixFull719Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr + hprefixTrees corr available + set earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier + intro oldi oldChoice oldGamma hbaseTarget holdIndex horiginalRoundsLess + set oldEarlier : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE (by omega) + earlierPrefix + intro fulli hfullIndex + calc + originalPrefix.series.data.tree + oldi.succ.castSucc = + ett.series.data.tree + (Fin.castLE (by omega) + oldi.succ.castSucc) := + hprefixTrees oldi.succ.castSucc + _ = ett.series.data.tree fulli.succ.castSucc := by + congr 1 + apply Fin.ext + have holdVals := congrArg Fin.val holdIndex + have hfullVals := congrArg Fin.val hfullIndex + change oldi.val + 1 = earlierPrefix.val at holdVals + change fulli.val + 1 = earlierPrefix.val at hfullVals + simp only [Fin.val_castLE, Fin.val_castSucc, + Fin.val_succ] + omega + +private theorem helper_hpostColorPrefixFull_1435.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (oldi : Fin originalPrefix.rounds) + (_ : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (_ : Fin k), + oldi.succ = earlierPrefix → + ∀ (horiginalRoundsLess : originalPrefix.rounds < ett.rounds), + let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := + Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + earlierPrefix; + ∀ (fulli : Fin ett.rounds), + oldEarlier = fulli.succ → + originalPrefix.series.data.tree oldi.succ.castSucc = ett.series.data.tree + fulli.succ.castSucc → + originalPrefix.series.data.coloring oldi.succ = ett.series.data.coloring + fulli.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr + hprefixData corr replacementLast available earlierPrefix oldi oldChoice oldGamma holdIndex + horiginalRoundsLess oldEarlier fulli hfullTarget htreePrefixFull + calc + originalPrefix.series.data.coloring oldi.succ = + originalPrefix.series.data.coloring + earlierPrefix := by rw [holdIndex] + _ = ett.series.data.coloring + (Fin.castLE (by omega) earlierPrefix) := + (hprefixData earlierPrefix).1 + _ = ett.series.data.coloring fulli.succ := by + congr 1 + +private theorem helper_hprefixEarlierTree_1498.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (oldi : Fin originalPrefix.rounds) + (_ : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (_ : Fin k) (horiginalRoundsLess : originalPrefix.rounds < ett.rounds), + let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := + Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + earlierPrefix; + ∀ (fulli : Fin ett.rounds) + (_ : + MaximumDefectiveChoice G e0 (ett.series.data.tree fulli.succ.castSucc) + (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) + (_ : Fin k), + originalPrefix.series.data.tree oldi.succ.castSucc = ett.series.data.tree + fulli.succ.castSucc → + originalPrefix.series.data.tree earlierPrefix.castSucc = ett.series.data.tree + oldEarlier.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr + hprefixTrees corr replacementLast available earlierPrefix oldi oldChoice oldGamma + horiginalRoundsLess oldEarlier fulli fullChoice fullGamma htreePrefixFull + calc + originalPrefix.series.data.tree + earlierPrefix.castSucc = + ett.series.data.tree + (Fin.castLE (by omega) + earlierPrefix.castSucc) := + hprefixTrees earlierPrefix.castSucc + _ = ett.series.data.tree oldEarlier.castSucc := by + congr 1 + +private theorem helper_horiginalPathInQ_1511.{u_1, u_2} : + helperHoriginalPathInQ1511Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix corr + replacementLast available originalReturnGraph returnEdgeTransfer originalReturnPath z hz + obtain ⟨m, hm, hmle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hz + change originalReturnGraph.connectedComponentMk z = + originalReturnGraph.connectedComponentMk + (Sum.inr available.edge) + rw [← hm] + exact (SimpleGraph.ConnectedComponent.sound + (originalReturnPath.take m).reachable).symm + +private theorem helper_continuation_1990.{u_1, u_2} : + helperContinuation1990Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix hr + hprefixTrees hprefixData corr noRevisiting replacementLast hlastMap hreplacementCurrentTree + available earlierPrefix oldi oldChoice oldGamma holdDeltaAvailable holdGammaAvailable + hreturnInOldEarlier originalReturnGraph returnEdgeTransfer originalReturnPath + horiginalReturnIsPath horiginalReturnSupport hreturnInQ houtsideInQ horiginalRoundsLess + originalCycle hcycleFull oldEarlier hfullEarlierKind fulli fullChoice fullGamma + fullCurrentDelta fullCurrentGamma hfullIndex htreePrefixFull prefixChoiceOnFull + hprefColorCast hfullEdgePairs hfullColorPairs hfullDeltaMissing hfullGammaNotMissing + hmissingPrefixFull hprefDeltaForFull hprefGammaForFull + have hfullIdentified := TdEarlierPEWitnessIdentification + G k e0 + (ett.series.data.tree fulli.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data + oldi.castSucc) + (TashkinovStoredColors ett.series.data fulli.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) + (ett.series.data.coloring fulli.castSucc) + prefixChoiceOnFull fullChoice oldGamma fullGamma + (originalPrefix.series.data.coloring oldi.succ) + (ett.series.data.coloring fulli.succ) + hfullEdgePairs hfullColorPairs hmissingPrefixFull + hprefDeltaForFull hprefGammaForFull + hfullDeltaMissing hfullGammaNotMissing + rcases hfullIdentified with ⟨hfullIdentifiedEdge, + hfullIdentifiedVertex, hfullIdentifiedOther, + hfullIdentifiedDelta, hfullIdentifiedGamma⟩ + have hfullDeltaAvailable : fullChoice.color = + available.delta := + hfullIdentifiedDelta.trans + (hprefColorCast.trans holdDeltaAvailable) + have hfullGammaAvailable : fullGamma = + available.gamma := + hfullIdentifiedGamma.trans holdGammaAvailable + have hcurrentIndex : q.castSucc.succ = + q.succ.castSucc := by + apply Fin.ext + rfl + have hcertificateCurrentTree : + ett.series.data.tree q.castSucc.succ = + corr.replacementSeries.data.tree + replacementLast.succ := by + rw [hcurrentIndex, hreplacementCurrentTree] + have hprefixEarlierTree : + originalPrefix.series.data.tree + earlierPrefix.castSucc = + ett.series.data.tree oldEarlier.castSucc := by + apply helper_hprefixEarlierTree_1498 <;> assumption + have horiginalPathInQ : ∀ z, + z ∈ originalReturnPath.support → + z ∈ TwoColorComponent G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta + (Sum.inr available.edge) := by + apply helper_horiginalPathInQ_1511; assumption + let originalCertificate : RevisitingExtensionCertificate + ett.series.data q.castSucc := by + exact helperOriginalCertificate1229 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@hprefixData) (@corr) (@hlastMap) + (@available) (@oldi) (@oldChoice) (@oldGamma) (@hreturnInOldEarlier) + (@returnEdgeTransfer) (@horiginalReturnIsPath) (@horiginalReturnSupport) (@hreturnInQ) + (@houtsideInQ) (@horiginalRoundsLess) (@originalCycle) (@hcycleFull) (@hfullEarlierKind) + (@fulli) (@fullChoice) (@fullGamma) (@fullCurrentDelta) (@fullCurrentGamma) (@hfullIndex) + (@htreePrefixFull) (@hfullDeltaAvailable) (@hfullGammaAvailable) + (@hcertificateCurrentTree) (@hprefixEarlierTree) (@horiginalPathInQ) + exact noRevisiting ⟨originalCertificate⟩ + +private theorem helper_branch_1721.{u_1, u_2} : + helperBranch1721Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge + set q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) + intro sigmaPrev originalPrefix hr hprefixTrees hprefixData corr noRevisiting + set replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds + intro hlastMap hreplacementCurrentTree available + set earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier + intro oldi oldChoice oldGamma oldCurrentStored oldCurrentEdges hbaseTarget holdIndex newGamma + newChoicePE hbaseTree transportChoiceFields pePostStatus holdDeltaMissing + holdGammaNotMissing holdDeltaAvailable holdGammaAvailable hreturnInOldEarlier + set originalReturnGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta + intro returnEdgeTransfer + set originalReturnPath : originalReturnGraph.Walk (Sum.inr + available.edge) + (Sum.inl available.returnVertex) := + available.returnPath.transfer + originalReturnGraph returnEdgeTransfer + intro horiginalReturnIsPath horiginalReturnSupport hreturnInQ houtsideInQ horiginalRoundsLess + originalCycle hcycleFull + set oldEarlier : Fin (ett.rounds + + (1 : ℕ)) := Fin.castLE (by + omega) earlierPrefix + intro hfullEarlierKind fulli fullChoice fullGamma fullGammaRule fullSecond fullSecondProper + fullSecondStable fullCurrentColoring fullCurrentStored fullCurrentEdges fullCurrentDelta + fullCurrentGamma hfullTarget + have hfullIndex : fulli.succ = oldEarlier := by + simpa using hfullTarget.symm + have htreePrefixFull : + originalPrefix.series.data.tree + oldi.succ.castSucc = + ett.series.data.tree fulli.succ.castSucc := by + apply helper_htreePrefixFull_719 <;> assumption + let prefixChoiceOnFull : MaximumDefectiveChoice G e0 + (ett.series.data.tree fulli.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data + oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) := + htreePrefixFull ▸ oldChoice + have htransportFull := transportChoiceFields + htreePrefixFull + (TashkinovStoredColors originalPrefix.series.data + oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) + oldChoice + have hprefEdgeCast : prefixChoiceOnFull.edge = + oldChoice.edge := htransportFull.1 + have hprefVertexCast : prefixChoiceOnFull.vertex = + oldChoice.vertex := htransportFull.2.1 + have hprefOtherCast : prefixChoiceOnFull.otherEndpoint = + oldChoice.otherEndpoint := htransportFull.2.2.1 + have hprefColorCast : prefixChoiceOnFull.color = + oldChoice.color := htransportFull.2.2.2 + have hfullMap : Fin.castLE (by omega) earlierPrefix = + oldEarlier := by rfl + have hfullEdgePairs : + ({prefixChoiceOnFull.edge} : Finset E) = + {fullChoice.edge} := by + have hprefEdges : + originalPrefix.series.data.connectingEdges + earlierPrefix = {oldChoice.edge} := by + simpa only [holdIndex] using oldCurrentEdges + have hfullEdges : ett.series.data.connectingEdges + oldEarlier = {fullChoice.edge} := by + simpa only [hfullIndex] using fullCurrentEdges + simpa only [hprefEdgeCast] using + hprefEdges.symm.trans + (((hprefixData earlierPrefix).2.2.1.trans + (by rw [hfullMap])).trans hfullEdges) + have hfullColorPairs : + ({prefixChoiceOnFull.color, oldGamma} : + Finset (Fin k)) = + {fullChoice.color, fullGamma} := by + have hprefStored : originalPrefix.series.data.stored + earlierPrefix = {oldChoice.color, oldGamma} := by + simpa only [holdIndex] using oldCurrentStored + have hfullStored : ett.series.data.stored oldEarlier = + {fullChoice.color, fullGamma} := by + simpa only [hfullIndex] using fullCurrentStored + simpa only [hprefColorCast] using + hprefStored.symm.trans + (((hprefixData earlierPrefix).2.1.trans + (by rw [hfullMap])).trans hfullStored) + have hfullEdgeIdentity : fullChoice.edge = + prefixChoiceOnFull.edge := by + apply Finset.mem_singleton.mp + rw [hfullEdgePairs] + exact Finset.mem_singleton_self _ + have hfullEnds : s(prefixChoiceOnFull.vertex, + prefixChoiceOnFull.otherEndpoint) = + s(fullChoice.vertex, fullChoice.otherEndpoint) := by + calc + s(prefixChoiceOnFull.vertex, + prefixChoiceOnFull.otherEndpoint) = + G.ends prefixChoiceOnFull.edge := + prefixChoiceOnFull.edgeEnds.symm + _ = G.ends fullChoice.edge := + congrArg G.ends hfullEdgeIdentity.symm + _ = s(fullChoice.vertex, + fullChoice.otherEndpoint) := fullChoice.edgeEnds + have hfullVertexIdentity : fullChoice.vertex = + prefixChoiceOnFull.vertex := by + rcases Sym2.eq_iff.mp hfullEnds with + hstraight | hcross + · exact hstraight.1.symm + · exfalso + exact fullChoice.otherOutside + (hcross.1 ▸ + prefixChoiceOnFull.vertexDefective.1) + have hfullOtherIdentity : fullChoice.otherEndpoint = + prefixChoiceOnFull.otherEndpoint := by + rcases Sym2.eq_iff.mp hfullEnds with + hstraight | hcross + · exact hstraight.2.symm + · exfalso + exact prefixChoiceOnFull.otherOutside + (hcross.2 ▸ fullChoice.vertexDefective.1) + obtain ⟨hfullDeltaMissing, hfullGammaNotMissing, + hfullColorNe⟩ := pePostStatus + (ett.series.data.tree fulli.succ.castSucc) + (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) + fullChoice fullGamma fullSecond fullSecondProper + fullSecondStable fullGammaRule.1 + rw [← fullCurrentColoring] at hfullDeltaMissing hfullGammaNotMissing + have hpostColorPrefixFull : + originalPrefix.series.data.coloring oldi.succ = + ett.series.data.coloring fulli.succ := by + apply helper_hpostColorPrefixFull_1435 <;> assumption + have hmissingPrefixFull : MissingColors G + (originalPrefix.series.data.coloring oldi.succ) + prefixChoiceOnFull.vertex = + MissingColors G + (ett.series.data.coloring fulli.succ) + fullChoice.vertex := by + rw [hpostColorPrefixFull, hfullVertexIdentity] + have hprefDeltaForFull : prefixChoiceOnFull.color ∈ + MissingColors G + (originalPrefix.series.data.coloring oldi.succ) + prefixChoiceOnFull.vertex := by + simpa only [hprefColorCast, hprefVertexCast] using + holdDeltaMissing + have hprefGammaForFull : oldGamma ∉ MissingColors G + (originalPrefix.series.data.coloring oldi.succ) + prefixChoiceOnFull.vertex := by + simpa only [hprefVertexCast] using + holdGammaNotMissing + exact helper_continuation_1990 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) + (@noRevisiting) (@hlastMap) (@hreplacementCurrentTree) (@available) (@oldi) (@oldChoice) + (@oldGamma) (@holdDeltaAvailable) (@holdGammaAvailable) (@hreturnInOldEarlier) + (@returnEdgeTransfer) (@horiginalReturnIsPath) (@horiginalReturnSupport) (@hreturnInQ) + (@houtsideInQ) (@horiginalRoundsLess) (@originalCycle) (@hcycleFull) (@hfullEarlierKind) + (@fulli) (@fullChoice) (@fullGamma) (@fullCurrentDelta) (@fullCurrentGamma) (@hfullIndex) + (@htreePrefixFull) (@hprefColorCast) (@hfullEdgePairs) (@hfullColorPairs) + (@hfullDeltaMissing) (@hfullGammaNotMissing) (@hmissingPrefixFull) (@hprefDeltaForFull) + (@hprefGammaForFull) +private theorem helper_segmentTrans_1816.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 + : E) (A B C : TreeSequence G e0), + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → + TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + rcases hAB with ⟨hlenAB, hvertexAB, hedgeAB⟩ + rcases hBC with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨hlenAB.trans hlenBC, ?_, ?_⟩ + · intro x + calc + C.vertex (Fin.castLE + (Nat.succ_le_succ (hlenAB.trans hlenBC)) x) = + C.vertex (Fin.castLE (Nat.succ_le_succ hlenBC) + (Fin.castLE (Nat.succ_le_succ hlenAB) x)) := by + congr 1 + _ = B.vertex + (Fin.castLE (Nat.succ_le_succ hlenAB) x) := + hvertexBC _ + _ = A.vertex x := hvertexAB x + · intro x + calc + C.edge (Fin.castLE (hlenAB.trans hlenBC) x) = + C.edge (Fin.castLE hlenBC + (Fin.castLE hlenAB x)) := by congr 1 + _ = B.edge (Fin.castLE hlenAB x) := hedgeBC _ + _ = A.edge x := hedgeAB x + +private theorem helper_replacementReturnEdgeData_1963.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < + ett.rounds), + ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigmaPrev → + corr.replacementSeries.data.tree (Fin.last originalPrefix.rounds : Fin + (originalPrefix.rounds + (1 : ℕ))).succ = ett.series.data.tree ((⟨ett.rounds - (1 : ℕ), by + omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc → + ∀ (available : + RevisitingExtensionCertificate corr.replacementSeries.data (Fin.last + originalPrefix.rounds)), + ¬available.returnPath.Nil → + ∀ (f : E), + Sum.inr f ∈ + available.returnPath.support → + TreeIncidentEdge (ett.series.data.tree ((⟨ett.rounds - (1 : + ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc) f ∧ (sigmaPrev f = some + available.gamma ∨ sigmaPrev f = some available.delta) := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge + set q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) + intro sigmaPrev originalPrefix corr hcorrFinalColor + set replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds + intro hreplacementCurrentTree available hreturnNotNil f hf + obtain ⟨node, hnode, hadj⟩ := + SimpleGraph.adj_of_mem_walk_support available.returnPath + hreturnNotNil hf + cases node with + | inl v => + have hdataRaw : Incident G v f ∧ + (corr.replacementSeries.data.coloring + replacementLast f = some available.gamma ∨ + corr.replacementSeries.data.coloring + replacementLast f = some available.delta) := by + simpa [TwoColorIncidenceGraph] using hadj + have hdata : Incident G v f ∧ + (sigmaPrev f = some available.gamma ∨ + sigmaPrev f = some available.delta) := by + simpa [replacementLast, hcorrFinalColor] using hdataRaw + refine ⟨⟨v, ?_, hdata.1⟩, hdata.2⟩ + rw [← hreplacementCurrentTree] + exact available.returnPathInternal v hnode + | inr g => + simp [TwoColorIncidenceGraph] at hadj + +private theorem helper_hreturnNeOld_2171.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < + ett.rounds) (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree + G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + ∀ (available : + RevisitingExtensionCertificate corr.replacementSeries.data (Fin.last + originalPrefix.rounds)) (oldi : Fin originalPrefix.rounds) (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) (newChoicePE : MaximumDefectiveChoice + G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data oldi.castSucc) (corr.replacementSeries.data.coloring + oldi.castSucc)), + newChoicePE.vertex = oldChoice.vertex → + ((TwoColorIncidenceGraph G + (corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds : Fin + (originalPrefix.rounds + (1 : ℕ)))) available.gamma available.delta).neighborSet (Sum.inl + newChoicePE.vertex)).Subsingleton → + available.returnVertex ≠ oldChoice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix corr + set replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds + intro available oldi oldChoice newChoicePE hnewVertexOld hreplacementLeaf heq + have hsupport : Sum.inl newChoicePE.vertex ∈ + available.cycle.walk.support := by + rw [hnewVertexOld, ← heq] + apply available.returnPathOnCycle + simp + let rotated := available.cycle.walk.rotate + (Sum.inl newChoicePE.vertex) hsupport + have hrotated : rotated.IsCycle := + available.cycle.isCycle.rotate hsupport + have hfirst : (TwoColorIncidenceGraph G + (corr.replacementSeries.data.coloring replacementLast) + available.gamma available.delta).Adj + (Sum.inl newChoicePE.vertex) rotated.snd := + rotated.adj_snd hrotated.not_nil + have hlast : (TwoColorIncidenceGraph G + (corr.replacementSeries.data.coloring replacementLast) + available.gamma available.delta).Adj + (Sum.inl newChoicePE.vertex) rotated.penultimate := + (rotated.adj_penultimate hrotated.not_nil).symm + exact hrotated.snd_ne_penultimate + (hreplacementLeaf hfirst hlast) + +private theorem helper_hbaseColorConstant_1908.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < + ett.rounds) (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree + G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)), + ∀ (available : RevisitingExtensionCertificate + corr.replacementSeries.data (Fin.last originalPrefix.rounds)), + (0 : ℕ) < + (↑(available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) : ℕ) → + ∀ (oldi : Fin + originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree + oldi.succ.castSucc) (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) (_ : Fin k), + (available.earlier : Fin + (originalPrefix.rounds + (1 : ℕ))) = oldi.succ → + oldi.succ = (available.earlier : Fin + (originalPrefix.rounds + (1 : ℕ))) → + ∀ (_ : Fin k) (_ : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree oldi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data oldi.castSucc) (corr.replacementSeries.data.coloring + oldi.castSucc)), + corr.replacementSeries.data.tree oldi.succ.castSucc = + originalPrefix.series.data.tree oldi.succ.castSucc → + ( + ∀ {rounds' : ℕ} {input' : + PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 input') (a b : Fin + (rounds' + (1 : ℕ))), + (↑a : ℕ) ≤ (↑b : ℕ) → + ( + ∀ (j : Fin (rounds' + (1 : ℕ))), + (↑a : ℕ) < + (↑j : ℕ) → + (↑j : ℕ) ≤ (↑b : ℕ) → + series.data.kind j = some TashkinovExtensionKind.RE) → + series.data.coloring b = series.data.coloring a) → + originalPrefix.series.data.coloring + (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))) = + originalPrefix.series.data.coloring oldi.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + set replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds + intro available + set earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier + intro hearlierPositive oldi oldChoice oldGamma hbaseTarget holdIndex newGamma newChoicePE + hbaseTree reIntervalColoring + apply reIntervalColoring originalPrefix.series oldi.succ + replacementLast + · have hvals := congrArg Fin.val holdIndex + simp [replacementLast] at hvals ⊢ + · intro j hjLower hjUpper + rw [← corr.extensionKindsAgree j] + apply available.interveningRevisiting j + · omega + · have hvals := congrArg Fin.val holdIndex + simp only [Fin.val_succ] at hvals + omega + · exact hjUpper + +private theorem helper_hreturnInOldEarlier_2009.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < + ett.rounds) (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree + G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (available : + RevisitingExtensionCertificate corr.replacementSeries.data (Fin.last + originalPrefix.rounds)), + ∀ (oldi : Fin originalPrefix.rounds), + oldi.succ = + (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) → + oldi.succ = + (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) → + corr.replacementSeries.data.tree oldi.succ.castSucc = originalPrefix.series.data.tree + oldi.succ.castSucc → + available.returnVertex ∈ TreeSequenceVertexSet + (originalPrefix.series.data.tree (available.earlier : Fin (originalPrefix.rounds + (1 : + ℕ))).castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix corr available + set earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier + intro oldi holdIndex hnewIndex hbaseTree + have htreeEarlier : corr.replacementSeries.data.tree + earlierPrefix.castSucc = + originalPrefix.series.data.tree + earlierPrefix.castSucc := by + calc + corr.replacementSeries.data.tree + earlierPrefix.castSucc = + corr.replacementSeries.data.tree + oldi.succ.castSucc := by + congr 1 + exact congrArg Fin.castSucc hnewIndex.symm + _ = originalPrefix.series.data.tree + oldi.succ.castSucc := hbaseTree + _ = originalPrefix.series.data.tree + earlierPrefix.castSucc := by + congr 1 + exact congrArg Fin.castSucc holdIndex + rw [← htreeEarlier] + simpa [earlierPrefix] using available.returnInEarlier + +private theorem helper_hcomponentDistinct_2345.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < + ett.rounds), + ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (available : + RevisitingExtensionCertificate corr.replacementSeries.data (Fin.last + originalPrefix.rounds)), + ∀ (oldi : Fin originalPrefix.rounds) (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)), + oldi.succ = (available.earlier : Fin + (originalPrefix.rounds + (1 : ℕ))) → + available.returnVertex ∈ TreeSequenceVertexSet + (originalPrefix.series.data.tree (available.earlier : Fin (originalPrefix.rounds + (1 : + ℕ))).castSucc) → + Sum.inl available.returnVertex ∈ TwoColorComponent G + (ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin + ett.rounds).castSucc) available.gamma available.delta (Sum.inr available.edge) → + (∀ w ∈ + TreeSequenceVertexSet (originalPrefix.series.data.tree oldi.succ.castSucc), Sum.inl w ∈ + TwoColorComponent G (ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta (Sum.inl + oldChoice.vertex) ↔ w = oldChoice.vertex) → + Sum.inl available.returnVertex ∉ + TwoColorComponent G sigmaPrev available.gamma available.delta (Sum.inl oldChoice.vertex) → + TwoColorComponent G (ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta (Sum.inl + oldChoice.vertex) ≠ TwoColorComponent G (ett.series.data.coloring ((⟨ett.rounds - (1 : ℕ), + by omega⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta + (Sum.inr available.edge) := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge + set q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) + intro sigmaPrev originalPrefix corr available + set earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier + intro oldi oldChoice holdIndex hreturnInOldEarlier hreturnInQ hcomponentOnly + hreplacementRootAvoidsReturn heq + have hreturnExitOriginal : Sum.inl available.returnVertex ∈ + TwoColorComponent G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta + (Sum.inl oldChoice.vertex) := by + rw [heq] + exact hreturnInQ + have hreturnExitSecond : Sum.inl available.returnVertex ∈ + TwoColorComponent G sigmaPrev available.gamma available.delta + (Sum.inl oldChoice.vertex) := by + have hreturnEq := (hcomponentOnly available.returnVertex + (by simpa only [holdIndex] using hreturnInOldEarlier)).1 + hreturnExitOriginal + rw [hreturnEq] + rfl + exact hreplacementRootAvoidsReturn hreturnExitSecond + +private theorem helper_hindices_2256.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)), + originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (oldi : Fin originalPrefix.rounds), + earlierPrefix = oldi.succ → + oldi.succ = earlierPrefix → + ∀ (newi : Fin originalPrefix.rounds), + earlierPrefix = newi.succ → + newi.succ = + earlierPrefix → + oldi = newi := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + replacementLast available earlierPrefix oldi hbaseTarget holdIndex newi hnewTarget hnewIndex + apply Fin.ext + have holdVals := congrArg Fin.val holdIndex + have hnewVals := congrArg Fin.val hnewIndex + simp only [Fin.val_succ] at holdVals hnewVals + omega + +private theorem helper_hedgeSecond_2373.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) + (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 X C phi) (second : PartialEdgeColoring E k), + StableColoring X (insert ch.color C : Finset (Fin k)) ch.selected second → + second ch.edge = + some ch.color := by + classical + intro V E _ _ G k e0 X C phi ch second hsecondStable + exact (hsecondStable.1 ch.edge + ⟨ch.vertex, ch.vertexDefective.1, ch.edgeIncident⟩ + ⟨ch.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), ch.edgeColor⟩).trans + ch.edgeColor + +private theorem helper_hne_2379.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) + (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + g ∈ MissingColors G second ch.vertex → + second ch.edge = some ch.color → + g ≠ ch.color := by + classical + intro V E _ _ G k e0 X C phi ch g second hgSecond hedgeSecond heq + have hpresent : g ∈ PresentColors G second ch.vertex := by + simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨ch.edge, ch.edgeIncident, + by simpa [heq] using hedgeSecond⟩ + have hnotPresent : g ∉ PresentColors G second ch.vertex := by + simpa [MissingColors] using hgSecond + exact hnotPresent hpresent + +private theorem helper_hreplacementColorConstant_2536.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)), + originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + (0 : ℕ) < (↑earlierPrefix : ℕ) → + ∀ (oldi : Fin originalPrefix.rounds) + (_ : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (_ : Fin k), + earlierPrefix = oldi.succ → + ∀ (_ : Fin k) + (_ : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)), + oldi.succ = earlierPrefix → + corr.replacementSeries.data.tree oldi.succ.castSucc = + originalPrefix.series.data.tree oldi.succ.castSucc → + ( + ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : + TashkinovSeries G k rounds' e0 input') + (a b : Fin (rounds' + (1 : ℕ))), + (↑a : ℕ) ≤ (↑b : ℕ) → + ( + ∀ (j : Fin (rounds' + (1 : ℕ))), + (↑a : ℕ) < (↑j : ℕ) → + (↑j : ℕ) ≤ (↑b : ℕ) → + series.data.kind j = some + TashkinovExtensionKind.RE) → + series.data.coloring b = series.data.coloring a) → + corr.replacementSeries.data.coloring replacementLast = + corr.replacementSeries.data.coloring oldi.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + replacementLast available earlierPrefix hearlierPositive oldi oldChoice oldGamma + hbaseTarget newGamma newChoicePE hnewIndex hbaseTree reIntervalColoring + apply reIntervalColoring corr.replacementSeries + oldi.succ replacementLast + · have hvals := congrArg Fin.val hnewIndex + simp [replacementLast] at hvals ⊢ + · intro j hjLower hjUpper + apply available.interveningRevisiting j + · omega + · have hvals := congrArg Fin.val hnewIndex + simp only [Fin.val_succ] at hvals + omega + · exact hjUpper + +private theorem helper_hbaseColorConstant_2550.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)), + originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + (0 : ℕ) < (↑earlierPrefix : ℕ) → + ∀ (oldi : Fin originalPrefix.rounds) + (_ : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (_ : Fin k), + earlierPrefix = oldi.succ → + oldi.succ = earlierPrefix → + ∀ (_ : Fin k) + (_ : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)), + corr.replacementSeries.data.tree oldi.succ.castSucc = + originalPrefix.series.data.tree oldi.succ.castSucc → + ( + ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : + TashkinovSeries G k rounds' e0 input') + (a b : Fin (rounds' + (1 : ℕ))), + (↑a : ℕ) ≤ (↑b : ℕ) → + ( + ∀ (j : Fin (rounds' + (1 : ℕ))), + (↑a : ℕ) < (↑j : ℕ) → + (↑j : ℕ) ≤ (↑b : ℕ) → + series.data.kind j = some + TashkinovExtensionKind.RE) → + series.data.coloring b = series.data.coloring a) → + originalPrefix.series.data.coloring replacementLast = + originalPrefix.series.data.coloring oldi.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + replacementLast available earlierPrefix hearlierPositive oldi oldChoice oldGamma + hbaseTarget holdIndex newGamma newChoicePE hbaseTree reIntervalColoring + apply helper_hbaseColorConstant_1908 <;> assumption +private theorem helper_hnewDeltaSigmaPrev_2577.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast) + (oldi : Fin originalPrefix.rounds) + (newChoicePE : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)), + newChoicePE.color ∈ MissingColors G (corr.replacementSeries.data.coloring oldi.succ) + newChoicePE.vertex → + newChoicePE.color = available.delta → + corr.replacementSeries.data.coloring oldi.succ = sigmaPrev → + available.delta ∈ MissingColors G sigmaPrev newChoicePE.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix corr + replacementLast available oldi newChoicePE hnewDeltaMissing hnewDeltaAvailable + hnewPostSigmaPrev + have hm := hnewDeltaMissing + rw [hnewDeltaAvailable] at hm + exact Eq.mp (congrArg (fun phi => available.delta ∈ + MissingColors G phi newChoicePE.vertex) + hnewPostSigmaPrev) hm + +private theorem helper_hnewGammaSigmaPrevNot_2584.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast) + (oldi : Fin originalPrefix.rounds) (newGamma : Fin k) + (newChoicePE : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)), + newGamma ∉ MissingColors G (corr.replacementSeries.data.coloring oldi.succ) + newChoicePE.vertex → + newGamma = available.gamma → + corr.replacementSeries.data.coloring oldi.succ = sigmaPrev → + available.gamma ∉ MissingColors G sigmaPrev newChoicePE.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix corr + replacementLast available oldi newGamma newChoicePE hnewGammaNotMissing hnewGammaAvailable + hnewPostSigmaPrev + have hm := hnewGammaNotMissing + rw [hnewGammaAvailable] at hm + exact Eq.mp (congrArg (fun phi => available.gamma ∉ + MissingColors G phi newChoicePE.vertex) + hnewPostSigmaPrev) hm + +private theorem helper_holdDeltaOriginal_2591.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast) + (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)), + oldChoice.color ∈ MissingColors G (originalPrefix.series.data.coloring oldi.succ) + oldChoice.vertex → + oldChoice.color = available.delta → + originalPrefix.series.data.coloring oldi.succ = ett.series.data.coloring q.castSucc → + available.delta ∈ MissingColors G (ett.series.data.coloring q.castSucc) + oldChoice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix corr + replacementLast available oldi oldChoice holdDeltaMissing holdDeltaAvailable holdPostOriginal + have hm := holdDeltaMissing + rw [holdDeltaAvailable] at hm + exact Eq.mp (congrArg (fun phi => available.delta ∈ + MissingColors G phi oldChoice.vertex) + holdPostOriginal) hm + +private theorem helper_holdGammaOriginalNot_2599.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast) + (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)), + ∀ oldGamma ∉ MissingColors G (originalPrefix.series.data.coloring oldi.succ) + oldChoice.vertex, + oldGamma = available.gamma → + originalPrefix.series.data.coloring oldi.succ = ett.series.data.coloring q.castSucc → + available.gamma ∉ MissingColors G (ett.series.data.coloring q.castSucc) + oldChoice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix corr + replacementLast available oldi oldChoice oldGamma holdGammaNotMissing holdGammaAvailable + holdPostOriginal + have hm := holdGammaNotMissing + rw [holdGammaAvailable] at hm + exact Eq.mp (congrArg (fun phi => available.gamma ∉ + MissingColors G phi oldChoice.vertex) + holdPostOriginal) hm + +private theorem helper_missingPreviousToTn_2668.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + TreeSequenceInitialSegment (ett.series.data.tree q.castSucc.castSucc) (ett.series.data.tree + q.succ.castSucc) → + ∀ c ∈ TreeMissingColors (ett.series.data.coloring q.castSucc) (ett.series.data.tree + q.castSucc.castSucc), + c ∈ TreeMissingColors (ett.series.data.coloring q.castSucc) (ett.series.data.tree + q.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q hpreviousToTn c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + obtain ⟨v, hv, hvc⟩ := hc + exact ⟨v, + TreeSequenceInitialSegmentVertexSetSubset + hpreviousToTn hv, hvc⟩ + +private theorem helper_hreturnInQ_2783.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let originalReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) available.gamma + available.delta; + ∀ (returnEdgeTransfer : ∀ edge ∈ available.returnPath.edges, edge ∈ + originalReturnGraph.edgeSet), + let _ : originalReturnGraph.Walk (Sum.inr available.edge) (Sum.inl + available.returnVertex) := + available.returnPath.transfer originalReturnGraph returnEdgeTransfer; + Sum.inl available.returnVertex ∈ + TwoColorComponent G (ett.series.data.coloring q.castSucc) available.gamma + available.delta + (Sum.inr available.edge) := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix corr + replacementLast available originalReturnGraph returnEdgeTransfer originalReturnPath + change originalReturnGraph.connectedComponentMk + (Sum.inl available.returnVertex) = + originalReturnGraph.connectedComponentMk + (Sum.inr available.edge) + exact (SimpleGraph.ConnectedComponent.sound + originalReturnPath.reachable).symm + +private theorem helper_hedgeOriginalActive_2794.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + ( + ∀ (f : E), + Sum.inr f ∈ available.returnPath.support → + TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) f ∧ + (sigmaPrev f = some available.gamma ∨ sigmaPrev f = some available.delta)) → + ( + ∀ (f : E), + Sum.inr f ∈ available.returnPath.support → + sigmaPrev f = + ett.series.data.coloring q.castSucc f) → + ett.series.data.coloring q.castSucc available.edge = some available.gamma ∨ + ett.series.data.coloring q.castSucc available.edge = some available.delta := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix corr + replacementLast available replacementReturnEdgeData copyReturnEdge + have hsupport : Sum.inr available.edge ∈ + available.returnPath.support := by simp + have hdata := + (replacementReturnEdgeData available.edge hsupport).2 + have hcopy := copyReturnEdge available.edge hsupport + rw [hcopy] at hdata + exact hdata + +private theorem helper_houtsideInQ_2806.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + ett.series.data.coloring q.castSucc available.edge = some available.gamma ∨ + ett.series.data.coloring q.castSucc available.edge = some available.delta → + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G (ett.series.data.coloring q.castSucc) available.gamma + available.delta + (Sum.inr available.edge) := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix corr + replacementLast available hedgeOriginalActive + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + have houtIncident : Incident G available.outsideEndpoint + available.edge := by + unfold Incident + rw [available.edgeEnds] + exact Sym2.mem_mk_right _ _ + simp [TwoColorIncidenceGraph, + houtIncident, hedgeOriginalActive] + +private theorem helper_hreplacementRootAvoidsReturn_2970.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)), + oldi.succ = earlierPrefix → + corr.replacementSeries.data.tree oldi.succ.castSucc = originalPrefix.series.data.tree + oldi.succ.castSucc → + available.returnVertex ∈ TreeSequenceVertexSet (originalPrefix.series.data.tree + earlierPrefix.castSucc) → + available.returnVertex ≠ oldChoice.vertex → + (∀ w ∈ TreeSequenceVertexSet (corr.replacementSeries.data.tree + oldi.succ.castSucc), + Sum.inl w ∈ TwoColorComponent G sigmaPrev available.gamma available.delta + (Sum.inl oldChoice.vertex) ↔ + w = oldChoice.vertex) → + Sum.inl available.returnVertex ∉ + TwoColorComponent G sigmaPrev available.gamma available.delta (Sum.inl + oldChoice.vertex) := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix corr + replacementLast available earlierPrefix oldi oldChoice holdIndex hbaseTree + hreturnInOldEarlier hreturnNeOld hreplacementComponentOnly hreturn + apply hreturnNeOld + apply (hreplacementComponentOnly available.returnVertex ?_).1 hreturn + rw [hbaseTree] + simpa only [holdIndex] using hreturnInOldEarlier + +private theorem helper_branch_3047.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (oldi : Fin originalPrefix.rounds) + (_ : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (_ _ : Fin k) + (_ : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)) + (_ : + corr.replacementSeries.data.tree oldi.succ.castSucc = originalPrefix.series.data.tree + oldi.succ.castSucc) + (horiginalRoundsLess : originalPrefix.rounds < ett.rounds), + let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := + Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + earlierPrefix; + ett.series.data.kind oldEarlier = some TashkinovExtensionKind.PE → + ett.series.data.kind (0 : Fin (ett.rounds + (1 : ℕ))) = none → + oldEarlier = (0 : Fin (ett.rounds + (1 : ℕ))) → + False := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + replacementLast available earlierPrefix oldi oldChoice oldGamma newGamma newChoicePE + hbaseTree horiginalRoundsLess oldEarlier hfullEarlierKind initialKindFull hfullTarget + have hk : ett.series.data.kind 0 = + some TashkinovExtensionKind.PE := by + rw [← hfullTarget] + exact hfullEarlierKind + have hbad := initialKindFull.symm.trans hk + simp at hbad + +private theorem helper_branch_3057.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (oldi : Fin originalPrefix.rounds) + (_ : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (_ _ : Fin k) + (_ : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)) + (_ : + corr.replacementSeries.data.tree oldi.succ.castSucc = originalPrefix.series.data.tree + oldi.succ.castSucc) + (horiginalRoundsLess : originalPrefix.rounds < ett.rounds), + let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := + Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + earlierPrefix; + ett.series.data.kind oldEarlier = some TashkinovExtensionKind.PE → + ∀ (fulli : Fin ett.rounds), + ett.series.data.kind fulli.succ = some TashkinovExtensionKind.SE → + oldEarlier = + fulli.succ → + False := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + replacementLast available earlierPrefix oldi oldChoice oldGamma newGamma newChoicePE + hbaseTree horiginalRoundsLess oldEarlier hfullEarlierKind fulli fullCurrentKind hfullTarget + have hk : ett.series.data.kind fulli.succ = + some TashkinovExtensionKind.PE := by + rw [← hfullTarget] + exact hfullEarlierKind + have hbad := fullCurrentKind.symm.trans hk + cases hbad + +private theorem helper_branch_3071.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (oldi : Fin originalPrefix.rounds) + (_ : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (_ _ : Fin k) + (_ : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)) + (_ : + corr.replacementSeries.data.tree oldi.succ.castSucc = originalPrefix.series.data.tree + oldi.succ.castSucc) + (horiginalRoundsLess : originalPrefix.rounds < ett.rounds), + let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := + Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + earlierPrefix; + ett.series.data.kind oldEarlier = some TashkinovExtensionKind.PE → + ∀ (fulli : Fin ett.rounds), + ett.series.data.kind fulli.succ = some TashkinovExtensionKind.RE → + oldEarlier = + fulli.succ → + False := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr + replacementLast available earlierPrefix oldi oldChoice oldGamma newGamma newChoicePE + hbaseTree horiginalRoundsLess oldEarlier hfullEarlierKind fulli fullCurrentKind hfullTarget + have hk : ett.series.data.kind fulli.succ = + some TashkinovExtensionKind.PE := by + rw [← hfullTarget] + exact hfullEarlierKind + have hbad := fullCurrentKind.symm.trans hk + cases hbad + +private theorem helper_branch_3084.{u_1, u_2} : + helperBranch3084Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix hr + hprefixTrees hprefixData corr noRevisiting replacementLast hlastMap hreplacementCurrentTree + available earlierPrefix oldi oldChoice oldGamma oldCurrentStored oldCurrentEdges + hbaseTarget holdIndex newGamma newChoicePE hbaseTree transportChoiceFields pePostStatus + holdDeltaMissing holdGammaNotMissing holdDeltaAvailable holdGammaAvailable + hreturnInOldEarlier originalReturnGraph returnEdgeTransfer originalReturnPath + horiginalReturnIsPath horiginalReturnSupport hreturnInQ houtsideInQ horiginalRoundsLess + originalCycle hcycleFull oldEarlier hfullEarlierKind fulli fullChoice fullGamma + fullGammaRule fullSecond fullSecondProper fullSecondStable fullCurrentColoring + fullCurrentStored fullCurrentEdges fullCurrentDelta fullCurrentGamma hfullTarget + exact helper_branch_1721 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) + (@sigmaPrev) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) (@noRevisiting) + (@hlastMap) (@hreplacementCurrentTree) (@available) (@oldi) (@oldChoice) (@oldGamma) + (@oldCurrentStored) (@oldCurrentEdges) (@hbaseTarget) (@holdIndex) (@newGamma) + (@newChoicePE) (@hbaseTree) (@transportChoiceFields) (@pePostStatus) (@holdDeltaMissing) + (@holdGammaNotMissing) (@holdDeltaAvailable) (@holdGammaAvailable) (@hreturnInOldEarlier) + (@returnEdgeTransfer) (@horiginalReturnIsPath) (@horiginalReturnSupport) (@hreturnInQ) + (@houtsideInQ) (@horiginalRoundsLess) (@originalCycle) (@hcycleFull) (@hfullEarlierKind) + (@fulli) (@fullChoice) (@fullGamma) (@fullGammaRule) (@fullSecond) (@fullSecondProper) + (@fullSecondStable) (@fullCurrentColoring) (@fullCurrentStored) (@fullCurrentEdges) + (@fullCurrentDelta) (@fullCurrentGamma) (@hfullTarget) + +private theorem helper_pePostStatus_3432.{u_1, u_2} : + helperPePostStatus3432Conditions.{u_1, u_2} := by + classical + intro V E _ _ G k e0 X C phi ch g second hsecondProper hsecondStable hgSelected + dsimp + have hgSecond : g ∈ MissingColors G second ch.vertex := by + rw [hsecondStable.2 ch.vertex ch.vertexDefective.1] + exact hgSelected + have hedgeSecond : second ch.edge = some ch.color := by + apply helper_hedgeSecond_2373; assumption + have hne : g ≠ ch.color := by + apply helper_hne_2379 <;> assumption + have hedgeComponent : Sum.inr ch.edge ∈ + TwoColorComponent G second g ch.color + (Sum.inl ch.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, + ch.edgeIncident, hedgeSecond] + have hmissingDelta : ch.color ∈ MissingColors G + (TwoColorComponentSwap G second g ch.color + (Sum.inl ch.vertex)) ch.vertex := by + exact (TwoColorComponentSwapMissingBehavior G second g + ch.color hne hsecondProper (Sum.inl ch.vertex)).2.1 + ch.vertex rfl hgSecond + have hedgePost : TwoColorComponentSwap G second g ch.color + (Sum.inl ch.vertex) ch.edge = some g := by + simp [TwoColorComponentSwap, hedgeComponent, hedgeSecond, + hne.symm] + have hgammaPresent : g ∈ PresentColors G + (TwoColorComponentSwap G second g ch.color + (Sum.inl ch.vertex)) ch.vertex := by + simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨ch.edge, ch.edgeIncident, hedgePost⟩ + exact ⟨hmissingDelta, + by simpa [MissingColors] using hgammaPresent, hne⟩ + +private theorem helper_continuation_4070.{u_1, u_2} : + helperContinuation4070Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge hlower q sigmaPrev previousProper + previousOneUncolored originalPrefix hr hprefixMP hprefixTrees hprefixData corr hcorrMP + noRevisiting replacementLast horiginalPositive hlastMap hreplacementCurrentTree peRootOnly + available earlierPrefix hbaseEarlierKind oldi oldChoice oldGamma oldCurrentProper + oldCurrentOne oldCurrentStored oldCurrentEdges oldCurrentKind oldCurrentVertex + oldCurrentDelta oldCurrentGamma hbaseTarget holdIndex newGamma newChoicePE newCurrentProper + newCurrentOne newCurrentKind newCurrentVertex newCurrentDelta newCurrentGamma hbaseTree + oldChoiceOnNew transportChoiceFields holdColorCast pePostStatus holdDeltaMissing + holdGammaNotMissing holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + hnewDeltaAvailable hnewGammaAvailable holdDeltaAvailable holdGammaAvailable hnewVertexOld + hnewPostSigmaPrev hbaseFinalColor holdPostOriginal holdDeltaOriginal hgammaDeltaNe + holdVertexFinal hreturnInOldEarlier hreturnInFinal originalReturnGraph returnEdgeTransfer + originalReturnPath horiginalReturnIsPath horiginalReturnSupport hreturnInQ houtsideInQ + hpathComponent hpathMeetsFinal hreplacementLeaf + have hreturnNeOld : available.returnVertex ≠ + oldChoice.vertex := by + apply helper_hreturnNeOld_2171 <;> assumption + have horiginalRoundsLess : originalPrefix.rounds < ett.rounds := by + rw [hr] + omega + have holdRootOnly := peRootOnly originalPrefix horiginalPositive + horiginalRoundsLess hprefixMP originalPrefix.rounds + originalPrefix.series rfl HEq.rfl oldi.succ oldChoice.vertex + oldGamma oldChoice.color (by simp) oldCurrentKind + oldCurrentVertex oldCurrentGamma oldCurrentDelta + oldCurrentProper oldCurrentOne + have hreplacementPositive : 0 < corr.replacementETT.rounds := by + rw [corr.rungAgreement] + exact horiginalPositive + have hreplacementLess : corr.replacementETT.rounds < ett.rounds := by + rw [corr.rungAgreement] + exact horiginalRoundsLess + have hnewRootOnly := peRootOnly corr.replacementETT + hreplacementPositive hreplacementLess hcorrMP originalPrefix.rounds + corr.replacementSeries corr.rungAgreement corr.seriesPresentation + oldi.succ newChoicePE.vertex newGamma newChoicePE.color + (by simp) newCurrentKind newCurrentVertex newCurrentGamma + newCurrentDelta newCurrentProper newCurrentOne + have hcomponentOnly : ∀ w, + w ∈ TreeSequenceVertexSet + (originalPrefix.series.data.tree oldi.succ.castSucc) → + (Sum.inl w ∈ TwoColorComponent G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta (Sum.inl oldChoice.vertex) ↔ + w = oldChoice.vertex) := by + simpa only [holdPostOriginal, holdGammaAvailable, + holdDeltaAvailable] using holdRootOnly + have hreplacementComponentOnly : ∀ w, + w ∈ TreeSequenceVertexSet + (corr.replacementSeries.data.tree oldi.succ.castSucc) → + (Sum.inl w ∈ TwoColorComponent G sigmaPrev + available.gamma available.delta (Sum.inl oldChoice.vertex) ↔ + w = oldChoice.vertex) := by + simpa only [hnewPostSigmaPrev, hnewGammaAvailable, + hnewDeltaAvailable, hnewVertexOld] using hnewRootOnly + have hreplacementRootAvoidsReturn : + Sum.inl available.returnVertex ∉ TwoColorComponent G sigmaPrev + available.gamma available.delta (Sum.inl oldChoice.vertex) := by + apply helper_hreplacementRootAvoidsReturn_2970 <;> assumption + have hcomponentDistinct := + helper_hcomponentDistinct_2345 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@corr) (@available) (@oldi) (@oldChoice) + (@holdIndex) (@hreturnInOldEarlier) (@hreturnInQ) (@hcomponentOnly) + (@hreplacementRootAvoidsReturn) + have hQMeetsFinal : ∃ v ∈ TreeSequenceVertexSet + (originalPrefix.series.data.tree + (Fin.last (originalPrefix.rounds + 1))), + Sum.inl v ∈ TwoColorComponent G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta + (Sum.inr available.edge) := + ⟨available.returnVertex, hreturnInFinal, hreturnInQ⟩ + have hlowerColor : originalPrefix.series.data.coloring + (Fin.last originalPrefix.rounds) = + ett.series.data.coloring q.castSucc := by + simpa [replacementLast] using hbaseFinalColor + have hstableLower : StableColoring + (originalPrefix.series.data.tree + (Fin.last (originalPrefix.rounds + 1))) + (TashkinovStoredColors originalPrefix.series.data + (Fin.last originalPrefix.rounds)) + (originalPrefix.series.data.coloring + (Fin.last originalPrefix.rounds)) + (ett.series.data.coloring q.castSucc) := by + rw [hlowerColor] + exact ⟨(by intros; rfl), (by intros; rfl)⟩ + have hdeltaLower : available.delta ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (originalPrefix.series.data.tree + (Fin.last (originalPrefix.rounds + 1))) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨oldChoice.vertex, holdVertexFinal, + holdDeltaOriginal⟩ + have hlowerPackage := hlower originalPrefix + horiginalPositive horiginalRoundsLess hprefixMP + have hinterchangeLower := hlowerPackage.1 + (ett.series.data.coloring q.castSucc) previousProper + previousOneUncolored hstableLower available.gamma + available.delta (Or.inr hdeltaLower) + have hcycleComponent := + TwoColorInterchangeableDistinctComponentCycle G + (originalPrefix.series.data.tree + (Fin.last (originalPrefix.rounds + 1))) + (ett.series.data.coloring q.castSucc) + available.gamma available.delta previousProper + (Sum.inl oldChoice.vertex) (Sum.inr available.edge) + hpathComponent.1 hinterchangeLower hpathMeetsFinal + hQMeetsFinal hcomponentDistinct + obtain ⟨originalCycle, hcycleFull⟩ := hcycleComponent + let oldEarlier : Fin (ett.rounds + 1) := + Fin.castLE (by omega) earlierPrefix + have holdEarlierMap : oldEarlier = + Fin.castLE (by omega) earlierPrefix := rfl + have hfullEarlierKind : ett.series.data.kind oldEarlier = + some TashkinovExtensionKind.PE := by + rw [holdEarlierMap, ← (hprefixData earlierPrefix).2.2.2.1] + exact hbaseEarlierKind + have hfullStep := ett.series.certified oldEarlier + generalize hfullTarget : oldEarlier = fullTarget at hfullStep + cases hfullStep with + | initial tripleFull seedLengthFull initialColoringFull + initialStoredFull initialEdgesFull initialKindFull + initialVertexFull initialOutsideFull initialDeltaFull + initialGammaFull initialClosureFull => + exact helper_branch_3047 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) (@oldi) + (@oldChoice) (@oldGamma) (@newGamma) (@newChoicePE) (@hbaseTree) + (@horiginalRoundsLess) (@hfullEarlierKind) (@initialKindFull) (@hfullTarget) + | SE fulli fullPreviousProper fullPreviousOne + fullPreviousClosed fullPreviousNotStrong fullNoRE + fullChoice fullAlternative fullCurrentColoring + fullCurrentStored fullCurrentEdges fullCurrentKind + fullCurrentVertex fullCurrentOutside fullCurrentDelta + fullCurrentGamma fullAdjoined fullAdjoinedExactly + fullClosedExtension fullOrderedExtension + fullStrictExtension => + exact helper_branch_3057 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) (@oldi) + (@oldChoice) (@oldGamma) (@newGamma) (@newChoicePE) (@hbaseTree) + (@horiginalRoundsLess) (@hfullEarlierKind) (@fulli) (@fullCurrentKind) (@hfullTarget) + | RE fulli fullPreviousProper fullPreviousOne + fullPreviousClosed fullPreviousNotStrong fullAvailable + fullCurrentColoring fullCurrentStored fullCurrentEdges + fullCurrentKind fullCurrentVertex fullCurrentOutside + fullCurrentDelta fullCurrentGamma fullAdjoined + fullAdjoinedExactly fullClosedExtension + fullOrderedExtension fullStrictExtension => + exact helper_branch_3071 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) (@oldi) + (@oldChoice) (@oldGamma) (@newGamma) (@newChoicePE) (@hbaseTree) + (@horiginalRoundsLess) (@hfullEarlierKind) (@fulli) (@fullCurrentKind) (@hfullTarget) + | PE fulli fullPreviousProper fullPreviousOne + fullPreviousClosed fullPreviousNotStrong fullNoRE + fullChoice fullAlternativeFails fullGamma fullGammaRule + fullSecond fullSecondProper fullSecondOne + fullSecondStable fullExit fullCurrentColoring + fullCurrentProper fullCurrentOne fullCurrentStored + fullCurrentEdges fullCurrentKind fullCurrentVertex + fullCurrentOutside fullCurrentDelta fullCurrentGamma + fullClosedExtension fullOrderedExtension + fullStrictExtension => + exact helper_branch_3084 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) + (@corr) (@noRevisiting) (@hlastMap) (@hreplacementCurrentTree) (@available) (@oldi) + (@oldChoice) (@oldGamma) (@oldCurrentStored) (@oldCurrentEdges) (@hbaseTarget) + (@holdIndex) (@newGamma) (@newChoicePE) (@hbaseTree) (@transportChoiceFields) + (@pePostStatus) (@holdDeltaMissing) (@holdGammaNotMissing) (@holdDeltaAvailable) + (@holdGammaAvailable) (@hreturnInOldEarlier) (@returnEdgeTransfer) + (@horiginalReturnIsPath) (@horiginalReturnSupport) (@hreturnInQ) (@houtsideInQ) + (@horiginalRoundsLess) (@originalCycle) (@hcycleFull) (@hfullEarlierKind) (@fulli) + (@fullChoice) (@fullGamma) (@fullGammaRule) (@fullSecond) (@fullSecondProper) + (@fullSecondStable) (@fullCurrentColoring) (@fullCurrentStored) (@fullCurrentEdges) + (@fullCurrentDelta) (@fullCurrentGamma) (@hfullTarget) + +private theorem helper_continuation_4611.{u_1, u_2} : + helperContinuation4611Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge hlower q sigmaPrev hsigmaPrevProper + previousProper previousOneUncolored originalPrefix hr hprefixMP hprefixTrees hprefixData + corr hcorrMP noRevisiting replacementLast hcorrFinalColor horiginalPositive hlastMap + hreplacementCurrentTree peRootOnly available earlierPrefix hbaseEarlierKind oldi oldChoice + oldGamma oldCurrentProper oldCurrentOne oldCurrentStored oldCurrentEdges oldCurrentKind + oldCurrentVertex oldCurrentDelta oldCurrentGamma hbaseTarget holdIndex newGamma newChoicePE + newCurrentProper newCurrentOne newCurrentKind newCurrentVertex newCurrentDelta + newCurrentGamma hbaseTree oldChoiceOnNew transportChoiceFields holdColorCast pePostStatus + holdDeltaMissing holdGammaNotMissing holdColorNe hnewColorNe hidentifiedDelta + hidentifiedGamma hnewDeltaAvailable hnewGammaAvailable holdDeltaAvailable + holdGammaAvailable hnewVertexOld hnewPostSigmaPrev hbaseFinalColor holdPostOriginal + hnewDeltaSigmaPrev holdDeltaOriginal holdGammaOriginalNot hgammaDeltaNe holdVertexFinal + hreturnInOldEarlier hreturnInFinal replacementReturnEdgeData copyReturnEdge + let replacementReturnGraph := TwoColorIncidenceGraph G + (corr.replacementSeries.data.coloring replacementLast) + available.gamma available.delta + let originalReturnGraph := TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) available.gamma + available.delta + have returnEdgeTransfer := + helper_returnEdgeTransfer_1317 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@corr) (@hcorrFinalColor) (@available) + (@copyReturnEdge) + let originalReturnPath := + available.returnPath.transfer originalReturnGraph + returnEdgeTransfer + have horiginalReturnIsPath : originalReturnPath.IsPath := + available.returnPathIsPath.transfer returnEdgeTransfer + have horiginalReturnSupport : ∀ z, + z ∈ originalReturnPath.support ↔ + z ∈ available.returnPath.support := by + intro z + simp [originalReturnPath] + have hreturnInQ := + helper_hreturnInQ_2783 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) + (@sigmaPrev) (@originalPrefix) (@corr) (@available) (@returnEdgeTransfer) + have hedgeOriginalActive := + helper_hedgeOriginalActive_2794 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@corr) (@available) + (@replacementReturnEdgeData) (@copyReturnEdge) + have houtsideInQ := + helper_houtsideInQ_2806 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) + (@sigmaPrev) (@originalPrefix) (@corr) (@available) (@hedgeOriginalActive) + have hgammaPresentOriginal : available.gamma ∈ + PresentColors G (ett.series.data.coloring q.castSucc) + oldChoice.vertex := by + simpa [MissingColors] using holdGammaOriginalNot + obtain ⟨pathEdge, hpathEdgeIncident, hpathEdgeColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] using hgammaPresentOriginal + have hpathEdgeComponent : Sum.inr pathEdge ∈ + TwoColorComponent G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta + (Sum.inl oldChoice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, + hpathEdgeIncident, hpathEdgeColor] + have hleafDegree : @SimpleGraph.degree _ + (TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta) + (Sum.inl oldChoice.vertex) (Fintype.ofFinite _) ≤ 1 := by + have hgraphSwapOrder : + TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) + available.delta available.gamma = + TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta := by + ext x y + cases x <;> cases y <;> + simp [TwoColorIncidenceGraph, or_comm] + rw [← hgraphSwapOrder] + exact MissingColorIncidenceEndpoint G + (ett.series.data.coloring q.castSucc) available.delta + available.gamma hgammaDeltaNe.symm previousProper + oldChoice.vertex holdDeltaOriginal + have hleaf : Set.Subsingleton + ((TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta).neighborSet + (Sum.inl oldChoice.vertex)) := by + let : Fintype + ((TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta).neighborSet + (Sum.inl oldChoice.vertex)) := Fintype.ofFinite _ + rw [← SimpleGraph.card_neighborSet_eq_degree] at hleafDegree + have hsub := Fintype.card_le_one_iff.mp hleafDegree + intro a ha b hb + exact congrArg Subtype.val + (hsub ⟨a, ha⟩ ⟨b, hb⟩) + have hpathComponent : TwoColorNontrivialPathComponent G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta + (Sum.inl oldChoice.vertex) := by + refine ⟨⟨hgammaDeltaNe, Sum.inl oldChoice.vertex, + rfl, hleaf⟩, pathEdge, hpathEdgeComponent⟩ + have hpathMeetsFinal : ∃ v ∈ TreeSequenceVertexSet + (originalPrefix.series.data.tree + (Fin.last (originalPrefix.rounds + 1))), + Sum.inl v ∈ TwoColorComponent G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta + (Sum.inl oldChoice.vertex) := + ⟨oldChoice.vertex, holdVertexFinal, rfl⟩ + have hreplacementLeafDegree : @SimpleGraph.degree _ + (TwoColorIncidenceGraph G + (corr.replacementSeries.data.coloring replacementLast) + available.gamma available.delta) + (Sum.inl newChoicePE.vertex) (Fintype.ofFinite _) ≤ 1 := by + have hgraphSwapOrder : + TwoColorIncidenceGraph G sigmaPrev available.delta + available.gamma = + TwoColorIncidenceGraph G sigmaPrev available.gamma + available.delta := by + ext x y + cases x <;> cases y <;> + simp [TwoColorIncidenceGraph, or_comm] + have hdegree : @SimpleGraph.degree _ + (TwoColorIncidenceGraph G sigmaPrev available.gamma + available.delta) (Sum.inl newChoicePE.vertex) + (Fintype.ofFinite _) ≤ 1 := by + rw [← hgraphSwapOrder] + exact MissingColorIncidenceEndpoint G sigmaPrev + available.delta available.gamma hgammaDeltaNe.symm + hsigmaPrevProper newChoicePE.vertex hnewDeltaSigmaPrev + have hcolorEq : + corr.replacementSeries.data.coloring replacementLast = + sigmaPrev := by + simpa [replacementLast] using hcorrFinalColor + rw [hcolorEq] + exact hdegree + have hreplacementLeaf : Set.Subsingleton + ((TwoColorIncidenceGraph G + (corr.replacementSeries.data.coloring replacementLast) + available.gamma available.delta).neighborSet + (Sum.inl newChoicePE.vertex)) := by + let : Fintype + ((TwoColorIncidenceGraph G + (corr.replacementSeries.data.coloring replacementLast) + available.gamma available.delta).neighborSet + (Sum.inl newChoicePE.vertex)) := Fintype.ofFinite _ + rw [← SimpleGraph.card_neighborSet_eq_degree] at hreplacementLeafDegree + have hsub := Fintype.card_le_one_iff.mp + hreplacementLeafDegree + intro a ha b hb + exact congrArg Subtype.val + (hsub ⟨a, ha⟩ ⟨b, hb⟩) + exact helper_continuation_4070 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@hlower) (@sigmaPrev) (@previousProper) (@previousOneUncolored) + (@originalPrefix) (@hr) (@hprefixMP) (@hprefixTrees) (@hprefixData) (@corr) (@hcorrMP) + (@noRevisiting) (@horiginalPositive) (@hlastMap) (@hreplacementCurrentTree) (@peRootOnly) + (@available) (@hbaseEarlierKind) (@oldi) (@oldChoice) (@oldGamma) (@oldCurrentProper) + (@oldCurrentOne) (@oldCurrentStored) (@oldCurrentEdges) (@oldCurrentKind) + (@oldCurrentVertex) (@oldCurrentDelta) (@oldCurrentGamma) (@hbaseTarget) (@holdIndex) + (@newGamma) (@newChoicePE) (@newCurrentProper) (@newCurrentOne) (@newCurrentKind) + (@newCurrentVertex) (@newCurrentDelta) (@newCurrentGamma) (@hbaseTree) + (@transportChoiceFields) (@holdColorCast) (@pePostStatus) (@holdDeltaMissing) + (@holdGammaNotMissing) (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) + (@hidentifiedGamma) (@hnewDeltaAvailable) (@hnewGammaAvailable) (@holdDeltaAvailable) + (@holdGammaAvailable) (@hnewVertexOld) (@hnewPostSigmaPrev) (@hbaseFinalColor) + (@holdPostOriginal) (@holdDeltaOriginal) (@hgammaDeltaNe) (@holdVertexFinal) + (@hreturnInOldEarlier) (@hreturnInFinal) (@returnEdgeTransfer) (@horiginalReturnIsPath) + (@horiginalReturnSupport) (@hreturnInQ) (@houtsideInQ) (@hpathComponent) (@hpathMeetsFinal) + (@hreplacementLeaf) + +private theorem helper_hmissingForIdentification_5050.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds).castSucc)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (newChoicePE : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)) + (hbaseTree : + corr.replacementSeries.data.tree oldi.succ.castSucc = originalPrefix.series.data.tree + oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) := + (Eq.symm hbaseTree ▸ oldChoice); + ∀ (_ : oldChoiceOnNew.vertex = oldChoice.vertex) + (_ : newChoicePE.vertex = oldChoiceOnNew.vertex) + (_ : + MissingColors G (originalPrefix.series.data.coloring oldi.succ) oldChoice.vertex = + MissingColors G (corr.replacementSeries.data.coloring oldi.succ) oldChoice.vertex), + MissingColors G (originalPrefix.series.data.coloring oldi.succ) oldChoiceOnNew.vertex = + MissingColors G (corr.replacementSeries.data.coloring oldi.succ) newChoicePE.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix corr oldi + oldChoice newChoicePE hbaseTree oldChoiceOnNew holdVertexCast hvertexIdentity + hmissingSameVertex + calc + MissingColors G + (originalPrefix.series.data.coloring oldi.succ) + oldChoiceOnNew.vertex = + MissingColors G + (originalPrefix.series.data.coloring oldi.succ) + oldChoice.vertex := congrArg _ holdVertexCast + _ = MissingColors G + (corr.replacementSeries.data.coloring oldi.succ) + oldChoice.vertex := hmissingSameVertex + _ = MissingColors G + (corr.replacementSeries.data.coloring oldi.succ) + newChoicePE.vertex := by + exact congrArg _ + (hvertexIdentity.trans holdVertexCast).symm + +private theorem helper_colorControlAtQ_5343.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) + (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; + ∀ (_ : (0 : ℕ) < originalPrefix.rounds) + (_ : + Fin.castLE + (by + omega) + replacementLast = + (⟨ett.rounds - (1 : ℕ), by + omega⟩ : + Fin ett.rounds).castSucc) + (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (oldi : Fin originalPrefix.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc)) + (oldGamma newGamma : Fin k) + (newChoicePE : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc)) + (hbaseTree : + corr.replacementSeries.data.tree oldi.succ.castSucc = + originalPrefix.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) := + (Eq.symm hbaseTree ▸ oldChoice); + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) (holdColorNe : oldGamma ≠ + oldChoice.color) + (hnewColorNe : newGamma ≠ newChoicePE.color) (hidentifiedDelta : newChoicePE.color + = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) (hnewDeltaAvailable : newChoicePE.color = + available.delta) + (hnewGammaAvailable : newGamma = available.gamma) (hgammaDeltaNe : available.gamma + ≠ available.delta) + (_ : + ∀ (c : Fin k) + (_ : + c ∈ TreeMissingColors (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.castSucc.castSucc)), + c ∈ TreeMissingColors (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc)) + (c : Fin k) + (_ : + c ∈ + ett.series.data.stored + (Fin.castLE + (by + omega) + earlierPrefix)), + c ∈ + TreeMissingColors (ett.series.data.coloring q.castSucc) (ett.series.data.tree + q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix hr corr + replacementLast horiginalPositive hlastMap available earlierPrefix oldi oldChoice oldGamma + newGamma newChoicePE hbaseTree oldChoiceOnNew holdColorCast holdColorNe hnewColorNe + hidentifiedDelta hidentifiedGamma hnewDeltaAvailable hnewGammaAvailable hgammaDeltaNe + missingPreviousToTn c hc + by_cases hm : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.castSucc.castSucc) + · exact Finset.mem_union_left _ + (missingPreviousToTn c hm) + · apply Finset.mem_union_right + unfold TashkinovStoredColors + have hqne : q.castSucc.val ≠ 0 := by + change ett.rounds - 1 ≠ 0 + omega + rw [ite_eq_right hqne, Finset.mem_sdiff] + refine ⟨?_, hm⟩ + simp only [Finset.mem_biUnion, Finset.mem_univ, + true_and] + refine ⟨Fin.castLE (by omega) earlierPrefix, ?_⟩ + rw [ite_eq_left] + · exact hc + · have hle := available.earlierAtMost + have hlastVal : replacementLast.val = q.castSucc.val := by + exact congrArg Fin.val hlastMap + simpa [earlierPrefix] using hle.trans_eq hlastVal + +private theorem positivePrefixReturnTransport.{u_1, u_2} : + positivePrefixReturnTransportStatement.{u_1, u_2} := by + classical + intro «V» «E» «inst» «inst_1» «inst_3» «G» «k» «e0» «input» «T» «generating» «ett» «hroundLarge» + «hlower» «q» «sigmaPrev» «hsigmaPrevProper» «hsigmaPrevOne» «previousProper» + «previousOneUncolored» «hsigmaPrevStableQ» «originalPrefix» «hr» «hprefixMP» «hprefixTrees» + «hprefixData» «corr» «hcorrMP» «noRevisiting» «hqSucc» «replacementLast» «hcorrFinalColor» + «horiginalPositive» «hlastMap» «hreplacementCurrentTree» «horiginalCurrentTree» «peRootOnly» + «available» «earlierPrefix» «hearlierPositive» «hbaseEarlierKind» «oldi» «oldChoice» + «oldGamma» «oldGammaRule» «oldSecond» «oldSecondProper» «oldSecondStable» «oldCurrentColoring» + «oldCurrentProper» «oldCurrentOne» «oldCurrentStored» «oldCurrentEdges» «oldCurrentKind» + «oldCurrentVertex» «oldCurrentDelta» «oldCurrentGamma» «hbaseTarget» «holdIndex» «newGamma» + «newSecond» «newSecondProper» «newPreviousProper» «newPreviousOne» «newPreviousClosed» + «newPreviousNotStrong» «newNoRE» «newChoicePE» «newAlternativeFails» «newGammaRule» + «newSecondStable» «newExit» «newCurrentColoring» «newCurrentProper» «newCurrentOne» + «newCurrentStored» «newCurrentEdges» «newCurrentKind» «newCurrentVertex» «newCurrentOutside» + «newCurrentDelta» «newCurrentGamma» «newClosedExtension» «newOrderedExtension» + «newStrictExtension» «hnewTarget» «hnewIndex» «hbaseTree» «oldChoiceOnNew» + «transportChoiceFields» «htransport» «holdEdgeCast» «holdVertexCast» «holdOtherCast» + «holdColorCast» «hedgePairs» «hcolorPairs» «hedgeIdentity» «hends» «hvertexIdentity» + «hotherIdentity» «pePostStatus» «holdDeltaMissing» «holdGammaNotMissing» «holdColorNe» + «hnewDeltaMissing» «hnewGammaNotMissing» «hnewColorNe» «hmissingSameVertex» + «hmissingForIdentification» «holdDeltaForIdentification» «holdGammaForIdentification» + «hidentifiedEdge» «hidentifiedVertex» «hidentifiedOther» «hidentifiedDelta» «hidentifiedGamma» + «hnewDeltaAvailable» «hnewGammaAvailable» «holdDeltaAvailable» «holdGammaAvailable» + «hnewVertexOld» «hnewOtherOld» «reStepColoring» «reIntervalColoring» + «hreplacementColorConstant» «hbaseColorConstant» «hnewPostSigmaPrev» «hbaseFinalColor» + «holdPostOriginal» «hnewDeltaSigmaPrev» «hnewGammaSigmaPrevNot» «holdDeltaOriginal» + «holdGammaOriginalNot» «hgammaDeltaNe» «stepSegment» «segmentTrans» «treeToFinal» + have holdTreeFinal : TreeSequenceInitialSegment + (originalPrefix.series.data.tree oldi.succ.castSucc) + (originalPrefix.series.data.tree + (Fin.last (originalPrefix.rounds + 1))) := by + apply treeToFinal (originalPrefix.rounds - oldi.val) + · simp + omega + · simp + have holdVertexFinal : oldChoice.vertex ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree + (Fin.last (originalPrefix.rounds + 1))) := + TreeSequenceInitialSegmentVertexSetSubset holdTreeFinal + oldChoice.vertexDefective.1 + have hreturnInOldEarlier := + helper_hreturnInOldEarlier_2009 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@corr) (@available) (@oldi) (@holdIndex) + (@hnewIndex) (@hbaseTree) + have hreturnInFinal : available.returnVertex ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree + (Fin.last (originalPrefix.rounds + 1))) := + TreeSequenceInitialSegmentVertexSetSubset holdTreeFinal + (by simpa only [holdIndex] using hreturnInOldEarlier) + have hpreviousToTn : TreeSequenceInitialSegment + (ett.series.data.tree q.castSucc.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + rw [← horiginalCurrentTree, hqSucc] + exact originalPrefix.abovePenultimate + have missingPreviousToTn (c : Fin k) + (hc : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.castSucc.castSucc)) := + helper_missingPreviousToTn_2668 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@hpreviousToTn) (@c) (@hc) + have hgammaEarlierStored : available.gamma ∈ + originalPrefix.series.data.stored earlierPrefix := by + rw [← holdIndex, oldCurrentStored, + ← holdGammaAvailable] + simp + have hdeltaEarlierStored : available.delta ∈ + originalPrefix.series.data.stored earlierPrefix := by + rw [← holdIndex, oldCurrentStored, + ← holdDeltaAvailable] + simp + have hgammaEarlierStoredFull : available.gamma ∈ + ett.series.data.stored + (Fin.castLE (by omega) earlierPrefix) := by + rw [← (hprefixData earlierPrefix).2.1] + exact hgammaEarlierStored + have hdeltaEarlierStoredFull : available.delta ∈ + ett.series.data.stored + (Fin.castLE (by omega) earlierPrefix) := by + rw [← (hprefixData earlierPrefix).2.1] + exact hdeltaEarlierStored + have colorControlAtQ (c : Fin k) + (hc : c ∈ ett.series.data.stored + (Fin.castLE (by omega) earlierPrefix)) := + helper_colorControlAtQ_5343 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) + (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@horiginalPositive) (@hlastMap) + (@available) (@oldi) (@oldChoice) (@oldGamma) (@newGamma) (@newChoicePE) (@hbaseTree) + (@holdColorCast) (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) + (@hnewDeltaAvailable) (@hnewGammaAvailable) (@hgammaDeltaNe) (@missingPreviousToTn) (@c) + (@hc) + have hreturnNotNil : ¬ available.returnPath.Nil := by + intro hnil + have hend := SimpleGraph.Walk.Nil.eq hnil + simp at hend + have replacementReturnEdgeData (f : E) + (hf : Sum.inr f ∈ available.returnPath.support) := + helper_replacementReturnEdgeData_1963 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@corr) (@hcorrFinalColor) + (@hreplacementCurrentTree) (@available) (@hreturnNotNil) (@f) (@hf) + have copyReturnEdge (f : E) + (hf : Sum.inr f ∈ available.returnPath.support) : + sigmaPrev f = ett.series.data.coloring q.castSucc f := by + obtain ⟨hfIncident, hcolor⟩ := + replacementReturnEdgeData f hf + have hcriterion := (sc1 G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev + previousProper previousOneUncolored hsigmaPrevProper + hsigmaPrevOne).mp hsigmaPrevStableQ + apply hcriterion f hfIncident + rcases hcolor with hgamma | hdelta + · exact Or.inr ⟨available.gamma, + colorControlAtQ available.gamma + hgammaEarlierStoredFull, hgamma⟩ + · exact Or.inr ⟨available.delta, + colorControlAtQ available.delta + hdeltaEarlierStoredFull, hdelta⟩ + exact helper_continuation_4611 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@hlower) (@sigmaPrev) (@hsigmaPrevProper) (@previousProper) + (@previousOneUncolored) (@originalPrefix) (@hr) (@hprefixMP) (@hprefixTrees) (@hprefixData) + (@corr) (@hcorrMP) (@noRevisiting) (@hcorrFinalColor) (@horiginalPositive) (@hlastMap) + (@hreplacementCurrentTree) (@peRootOnly) (@available) (@hbaseEarlierKind) (@oldi) + (@oldChoice) (@oldGamma) (@oldCurrentProper) (@oldCurrentOne) (@oldCurrentStored) + (@oldCurrentEdges) (@oldCurrentKind) (@oldCurrentVertex) (@oldCurrentDelta) + (@oldCurrentGamma) (@hbaseTarget) (@holdIndex) (@newGamma) (@newChoicePE) + (@newCurrentProper) (@newCurrentOne) (@newCurrentKind) (@newCurrentVertex) + (@newCurrentDelta) (@newCurrentGamma) (@hbaseTree) (@transportChoiceFields) + (@holdColorCast) (@pePostStatus) (@holdDeltaMissing) (@holdGammaNotMissing) (@holdColorNe) + (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@hnewDeltaAvailable) + (@hnewGammaAvailable) (@holdDeltaAvailable) (@holdGammaAvailable) (@hnewVertexOld) + (@hnewPostSigmaPrev) (@hbaseFinalColor) (@holdPostOriginal) (@hnewDeltaSigmaPrev) + (@holdDeltaOriginal) (@holdGammaOriginalNot) (@hgammaDeltaNe) (@holdVertexFinal) + (@hreturnInOldEarlier) (@hreturnInFinal) (@replacementReturnEdgeData) (@copyReturnEdge) + +private theorem positivePrefixColorIdentification.{u_1, u_2} : + positivePrefixColorIdentificationStatement.{u_1, u_2} := by + classical + intro «V» «E» «inst» «inst_1» «inst_3» «G» «k» «e0» «input» «T» «generating» «ett» «hroundLarge» + «hlower» «q» «sigmaPrev» «hsigmaPrevProper» «hsigmaPrevOne» «previousProper» + «previousOneUncolored» «hsigmaPrevStableQ» «originalPrefix» «hr» «hprefixMP» «hprefixTrees» + «hprefixData» «corr» «hcorrMP» «noRevisiting» «hqSucc» «replacementLast» «hcorrFinalColor» + «horiginalPositive» «hlastMap» «hreplacementCurrentTree» «horiginalCurrentTree» «peRootOnly» + «available» «earlierPrefix» «hearlierPositive» «hbaseEarlierKind» «oldi» «oldChoice» + «oldGamma» «oldGammaRule» «oldSecond» «oldSecondProper» «oldSecondStable» «oldCurrentColoring» + «oldCurrentProper» «oldCurrentOne» «oldCurrentStored» «oldCurrentEdges» «oldCurrentKind» + «oldCurrentVertex» «oldCurrentDelta» «oldCurrentGamma» «hbaseTarget» «holdIndex» «newGamma» + «newSecond» «newSecondProper» «newPreviousProper» «newPreviousOne» «newPreviousClosed» + «newPreviousNotStrong» «newNoRE» «newChoicePE» «newAlternativeFails» «newGammaRule» + «newSecondStable» «newExit» «newCurrentColoring» «newCurrentProper» «newCurrentOne» + «newCurrentStored» «newCurrentEdges» «newCurrentKind» «newCurrentVertex» «newCurrentOutside» + «newCurrentDelta» «newCurrentGamma» «newClosedExtension» «newOrderedExtension» + «newStrictExtension» «hnewTarget» «hnewIndex» «hbaseTree» «oldChoiceOnNew» + «transportChoiceFields» «htransport» «holdEdgeCast» «holdVertexCast» «holdOtherCast» + «holdColorCast» «hedgePairs» «hcolorPairs» «hedgeIdentity» «hends» «hvertexIdentity» + «hotherIdentity» «pePostStatus» «holdDeltaMissing» «holdGammaNotMissing» «holdColorNe» + «hnewDeltaMissing» «hnewGammaNotMissing» «hnewColorNe» + have hmissingSameVertex : MissingColors G + (originalPrefix.series.data.coloring oldi.succ) + oldChoice.vertex = + MissingColors G + (corr.replacementSeries.data.coloring oldi.succ) + oldChoice.vertex := by + have hs := (corr.replacementStable oldi).2 + oldChoice.vertex (by + exact oldChoice.vertexDefective.1) + exact hs.symm + have hmissingForIdentification := + helper_hmissingForIdentification_5050 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@corr) (@oldi) (@oldChoice) (@newChoicePE) + (@hbaseTree) (@holdVertexCast) (@hvertexIdentity) (@hmissingSameVertex) + have holdDeltaForIdentification : oldChoiceOnNew.color ∈ + MissingColors G + (originalPrefix.series.data.coloring oldi.succ) + oldChoiceOnNew.vertex := by + simpa only [holdColorCast, holdVertexCast] using + holdDeltaMissing + have holdGammaForIdentification : oldGamma ∉ + MissingColors G + (originalPrefix.series.data.coloring oldi.succ) + oldChoiceOnNew.vertex := by + simpa only [holdVertexCast] using holdGammaNotMissing + have hidentified := TdEarlierPEWitnessIdentification G k e0 + (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data + oldi.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc) + oldChoiceOnNew newChoicePE oldGamma newGamma + (originalPrefix.series.data.coloring oldi.succ) + (corr.replacementSeries.data.coloring oldi.succ) + hedgePairs hcolorPairs hmissingForIdentification + holdDeltaForIdentification holdGammaForIdentification + hnewDeltaMissing hnewGammaNotMissing + rcases hidentified with ⟨hidentifiedEdge, + hidentifiedVertex, hidentifiedOther, hidentifiedDelta, + hidentifiedGamma⟩ + have hnewDeltaAvailable : newChoicePE.color = + available.delta := by + exact Option.some.inj (newCurrentDelta.symm.trans + ((congrArg corr.replacementSeries.data.delta + hnewIndex).trans available.earlierDelta)) + have hnewGammaAvailable : newGamma = available.gamma := by + exact Option.some.inj (newCurrentGamma.symm.trans + ((congrArg corr.replacementSeries.data.gamma + hnewIndex).trans available.earlierGamma)) + have holdDeltaAvailable : oldChoice.color = + available.delta := by + exact holdColorCast.symm.trans + (hidentifiedDelta.symm.trans hnewDeltaAvailable) + have holdGammaAvailable : oldGamma = available.gamma := by + exact hidentifiedGamma.symm.trans hnewGammaAvailable + have hnewVertexOld : newChoicePE.vertex = oldChoice.vertex := + hidentifiedVertex.trans holdVertexCast + have hnewOtherOld : newChoicePE.otherEndpoint = + oldChoice.otherEndpoint := + hidentifiedOther.trans holdOtherCast + have reStepColoring := + @helper_reStepColoring_872 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) (@sigmaPrev) + (@originalPrefix) (@hr) (@corr) (@available) (@oldi) (@oldChoice) (@oldGamma) (@newGamma) + (@newChoicePE) (@hbaseTree) + have reIntervalColoring := + @helper_reIntervalColoring_913 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) (@sigmaPrev) + (@originalPrefix) (@hr) (@corr) (@available) (@oldi) (@oldChoice) (@oldGamma) (@newGamma) + (@newChoicePE) (@hbaseTree) (@reStepColoring) + have hreplacementColorConstant := + helper_hreplacementColorConstant_2536 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) + (@hearlierPositive) (@oldi) (@oldChoice) (@oldGamma) (@hbaseTarget) (@newGamma) + (@newChoicePE) (@hnewIndex) (@hbaseTree) (@reIntervalColoring) + have hbaseColorConstant := + helper_hbaseColorConstant_2550 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) + (@hearlierPositive) (@oldi) (@oldChoice) (@oldGamma) (@hbaseTarget) (@holdIndex) + (@newGamma) (@newChoicePE) (@hbaseTree) (@reIntervalColoring) + have hnewPostSigmaPrev : + corr.replacementSeries.data.coloring oldi.succ = + sigmaPrev := + hreplacementColorConstant.symm.trans + (by simpa [replacementLast] using hcorrFinalColor) + have hbaseFinalColor : + originalPrefix.series.data.coloring replacementLast = + ett.series.data.coloring q.castSucc := by + calc + originalPrefix.series.data.coloring replacementLast = + ett.series.data.coloring + (Fin.castLE (by omega) replacementLast) := + (hprefixData replacementLast).1 + _ = ett.series.data.coloring q.castSucc := by + rw [hlastMap] + have holdPostOriginal : + originalPrefix.series.data.coloring oldi.succ = + ett.series.data.coloring q.castSucc := + hbaseColorConstant.symm.trans hbaseFinalColor + have hnewDeltaSigmaPrev := + helper_hnewDeltaSigmaPrev_2577 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@corr) (@available) (@oldi) (@newChoicePE) + (@hnewDeltaMissing) (@hnewDeltaAvailable) (@hnewPostSigmaPrev) + have hnewGammaSigmaPrevNot := + helper_hnewGammaSigmaPrevNot_2584 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@corr) (@available) (@oldi) (@newGamma) + (@newChoicePE) (@hnewGammaNotMissing) (@hnewGammaAvailable) (@hnewPostSigmaPrev) + have holdDeltaOriginal := + helper_holdDeltaOriginal_2591 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@corr) (@available) (@oldi) (@oldChoice) + (@holdDeltaMissing) (@holdDeltaAvailable) (@holdPostOriginal) + have holdGammaOriginalNot := + helper_holdGammaOriginalNot_2599 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@corr) (@available) (@oldi) (@oldChoice) + (@oldGamma) (@holdGammaNotMissing) (@holdGammaAvailable) (@holdPostOriginal) + have hgammaDeltaNe : available.gamma ≠ available.delta := by + intro heq + apply hnewColorNe + rw [hnewGammaAvailable, hnewDeltaAvailable, heq] + have stepSegment := + helper_stepSegment_1041 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) + (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) (@oldi) (@oldChoice) + (@oldGamma) (@newGamma) (@newChoicePE) (@hbaseTree) + have segmentTrans := + @helper_segmentTrans_1816 (@V) (@E) (@G) (@e0) + have treeToFinal := + helper_treeToFinal_1111 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) + (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) (@oldi) (@oldChoice) + (@oldGamma) (@newGamma) (@newChoicePE) (@hbaseTree) (@stepSegment) (@segmentTrans) + exact @positivePrefixReturnTransport (@«V») (@«E») inferInstance inferInstance inferInstance + (@«G») (@«k») (@«e0») (@«input») (@«T») (@«generating») (@«ett») (@«hroundLarge») (@«hlower») + (@«sigmaPrev») (@«hsigmaPrevProper») (@«hsigmaPrevOne») (@«previousProper») + (@«previousOneUncolored») (@«hsigmaPrevStableQ») (@«originalPrefix») (@«hr») (@«hprefixMP») + (@«hprefixTrees») (@«hprefixData») (@«corr») (@«hcorrMP») (@«noRevisiting») (@«hqSucc») + (@«hcorrFinalColor») (@«horiginalPositive») (@«hlastMap») (@«hreplacementCurrentTree») + (@«horiginalCurrentTree») (@«peRootOnly») (@«available») (@«hearlierPositive») + (@«hbaseEarlierKind») (@«oldi») (@«oldChoice») (@«oldGamma») (@«oldGammaRule») (@«oldSecond») + (@«oldSecondProper») (@«oldSecondStable») (@«oldCurrentColoring») (@«oldCurrentProper») + (@«oldCurrentOne») (@«oldCurrentStored») (@«oldCurrentEdges») (@«oldCurrentKind») + (@«oldCurrentVertex») (@«oldCurrentDelta») (@«oldCurrentGamma») (@«hbaseTarget») + (@«holdIndex») (@«newGamma») (@«newSecond») (@«newSecondProper») (@«newPreviousProper») + (@«newPreviousOne») (@«newPreviousClosed») (@«newPreviousNotStrong») (@«newNoRE») + (@«newChoicePE») (@«newAlternativeFails») (@«newGammaRule») (@«newSecondStable») (@«newExit») + (@«newCurrentColoring») (@«newCurrentProper») (@«newCurrentOne») (@«newCurrentStored») + (@«newCurrentEdges») (@«newCurrentKind») (@«newCurrentVertex») (@«newCurrentOutside») + (@«newCurrentDelta») (@«newCurrentGamma») (@«newClosedExtension») (@«newOrderedExtension») + (@«newStrictExtension») (@«hnewTarget») (@«hnewIndex») (@«hbaseTree») + (@«transportChoiceFields») (@«htransport») (@«holdEdgeCast») (@«holdVertexCast») + (@«holdOtherCast») (@«holdColorCast») (@«hedgePairs») (@«hcolorPairs») (@«hedgeIdentity») + (@«hends») (@«hvertexIdentity») (@«hotherIdentity») (@«pePostStatus») (@«holdDeltaMissing») + (@«holdGammaNotMissing») (@«holdColorNe») (@«hnewDeltaMissing») (@«hnewGammaNotMissing») + (@«hnewColorNe») (@«hmissingSameVertex») (@«hmissingForIdentification») + (@«holdDeltaForIdentification») (@«holdGammaForIdentification») (@«hidentifiedEdge») + (@«hidentifiedVertex») (@«hidentifiedOther») (@«hidentifiedDelta») (@«hidentifiedGamma») + (@«hnewDeltaAvailable») (@«hnewGammaAvailable») (@«holdDeltaAvailable») + (@«holdGammaAvailable») (@«hnewVertexOld») (@«hnewOtherOld») (@«reStepColoring») + (@«reIntervalColoring») (@«hreplacementColorConstant») (@«hbaseColorConstant») + (@«hnewPostSigmaPrev») (@«hbaseFinalColor») (@«holdPostOriginal») (@«hnewDeltaSigmaPrev») + (@«hnewGammaSigmaPrevNot») (@«holdDeltaOriginal») (@«holdGammaOriginalNot») (@«hgammaDeltaNe») + (@«stepSegment») (@«segmentTrans») (@«treeToFinal») + +private theorem helper_branch_377.{u_1, u_2} : positivePrefixContradictionStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge hlower + set q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : + Fin ett.rounds) + intro sigmaPrev hsigmaPrevProper hsigmaPrevOne previousProper previousOneUncolored + hsigmaPrevStableQ originalPrefix hr hprefixMP hprefixTrees hprefixData corr hcorrFinalColor + hcorrMP noRevisiting hqSucc + set replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds + intro horiginalPositive hlastMap hreplacementCurrentTree horiginalCurrentTree peRootOnly available + set earlierPrefix : Fin (originalPrefix.rounds + + (1 : ℕ)) := available.earlier + intro hearlierPositive hbaseEarlierKind oldi oldChoice oldGamma oldGammaRule oldSecond + oldSecondProper oldSecondStable oldCurrentColoring oldCurrentProper oldCurrentOne + oldCurrentStored oldCurrentEdges oldCurrentKind oldCurrentVertex oldCurrentDelta + oldCurrentGamma hbaseTarget holdIndex newi newPreviousProper newPreviousOne + newPreviousClosed newPreviousNotStrong newNoRE newChoicePE newAlternativeFails newGamma + newGammaRule newSecond newSecondProper newSecondStable newExit newCurrentColoring + newCurrentProper newCurrentOne newCurrentStored newCurrentEdges newCurrentKind + newCurrentVertex newCurrentOutside newCurrentDelta newCurrentGamma newClosedExtension + newOrderedExtension newStrictExtension hnewTarget + have hnewIndex : newi.succ = earlierPrefix := by + simpa using hnewTarget.symm + have hindices := + helper_hindices_2256 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) + (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) (@oldi) (@hbaseTarget) + (@holdIndex) (@newi) (@hnewTarget) (@hnewIndex) + subst newi + have hbaseTree : + corr.replacementSeries.data.tree oldi.succ.castSucc = + originalPrefix.series.data.tree oldi.succ.castSucc := + corr.ladderTreesAgree oldi + let oldChoiceOnNew : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data + oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) := + hbaseTree.symm ▸ oldChoice + have transportChoiceFields : ∀ + {A B : TreeSequence G e0} (hAB : A = B) + (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 A C phi), + (hAB ▸ ch).edge = ch.edge ∧ + (hAB ▸ ch).vertex = ch.vertex ∧ + (hAB ▸ ch).otherEndpoint = ch.otherEndpoint ∧ + (hAB ▸ ch).color = ch.color := by + intro A B hAB C phi ch + subst B + exact ⟨rfl, rfl, rfl, rfl⟩ + have htransport := transportChoiceFields hbaseTree.symm + (TashkinovStoredColors originalPrefix.series.data + oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) + oldChoice + have holdEdgeCast : oldChoiceOnNew.edge = oldChoice.edge := + htransport.1 + have holdVertexCast : oldChoiceOnNew.vertex = + oldChoice.vertex := htransport.2.1 + have holdOtherCast : oldChoiceOnNew.otherEndpoint = + oldChoice.otherEndpoint := htransport.2.2.1 + have holdColorCast : oldChoiceOnNew.color = + oldChoice.color := htransport.2.2.2 + have hedgePairs : ({oldChoiceOnNew.edge} : Finset E) = + {newChoicePE.edge} := by + have holdEdges : originalPrefix.series.data.connectingEdges + earlierPrefix = {oldChoice.edge} := by + simpa only [holdIndex] using oldCurrentEdges + have hnewEdges : + corr.replacementSeries.data.connectingEdges + earlierPrefix = {newChoicePE.edge} := by + simpa only [hnewIndex] using newCurrentEdges + simpa only [holdEdgeCast] using + holdEdges.symm.trans + ((corr.connectingEdgesAgree earlierPrefix).symm.trans + hnewEdges) + have hcolorPairs : + ({oldChoiceOnNew.color, oldGamma} : Finset (Fin k)) = + {newChoicePE.color, newGamma} := by + have holdStored : originalPrefix.series.data.stored + earlierPrefix = {oldChoice.color, oldGamma} := by + simpa only [holdIndex] using oldCurrentStored + have hnewStored : corr.replacementSeries.data.stored + earlierPrefix = {newChoicePE.color, newGamma} := by + simpa only [hnewIndex] using newCurrentStored + simpa only [holdColorCast] using + holdStored.symm.trans + ((corr.storedColorsAgree earlierPrefix).symm.trans + hnewStored) + have hedgeIdentity : newChoicePE.edge = + oldChoiceOnNew.edge := by + apply Finset.mem_singleton.mp + rw [hedgePairs] + exact Finset.mem_singleton_self _ + have hends : s(oldChoiceOnNew.vertex, + oldChoiceOnNew.otherEndpoint) = + s(newChoicePE.vertex, newChoicePE.otherEndpoint) := by + calc + s(oldChoiceOnNew.vertex, + oldChoiceOnNew.otherEndpoint) = + G.ends oldChoiceOnNew.edge := + oldChoiceOnNew.edgeEnds.symm + _ = G.ends newChoicePE.edge := + congrArg G.ends hedgeIdentity.symm + _ = s(newChoicePE.vertex, + newChoicePE.otherEndpoint) := newChoicePE.edgeEnds + have hvertexIdentity : newChoicePE.vertex = + oldChoiceOnNew.vertex := by + rcases Sym2.eq_iff.mp hends with hstraight | hcross + · exact hstraight.1.symm + · exfalso + exact newChoicePE.otherOutside + (hcross.1 ▸ oldChoiceOnNew.vertexDefective.1) + have hotherIdentity : newChoicePE.otherEndpoint = + oldChoiceOnNew.otherEndpoint := by + rcases Sym2.eq_iff.mp hends with hstraight | hcross + · exact hstraight.2.symm + · exfalso + exact oldChoiceOnNew.otherOutside + (hcross.2 ▸ newChoicePE.vertexDefective.1) + have pePostStatus := + helper_pePostStatus_3432 (@G) (@k) (@e0) + obtain ⟨holdDeltaMissing, holdGammaNotMissing, + holdColorNe⟩ := pePostStatus + (originalPrefix.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors originalPrefix.series.data + oldi.castSucc) + (originalPrefix.series.data.coloring oldi.castSucc) + oldChoice oldGamma oldSecond oldSecondProper + oldSecondStable oldGammaRule.1 + obtain ⟨hnewDeltaMissing, hnewGammaNotMissing, + hnewColorNe⟩ := pePostStatus + (corr.replacementSeries.data.tree oldi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + oldi.castSucc) + (corr.replacementSeries.data.coloring oldi.castSucc) + newChoicePE newGamma newSecond newSecondProper + newSecondStable newGammaRule.1 + rw [← oldCurrentColoring] at holdDeltaMissing holdGammaNotMissing + rw [← newCurrentColoring] at hnewDeltaMissing hnewGammaNotMissing + exact @positivePrefixColorIdentification (@«V») (@«E») inferInstance inferInstance inferInstance + (@«G») (@«k») (@«e0») (@«input») (@«T») (@«generating») (@«ett») (@«hroundLarge») (@«hlower») + (@«sigmaPrev») (@«hsigmaPrevProper») (@«hsigmaPrevOne») (@«previousProper») + (@«previousOneUncolored») (@«hsigmaPrevStableQ») (@«originalPrefix») (@«hr») (@«hprefixMP») + (@«hprefixTrees») (@«hprefixData») (@«corr») (@«hcorrMP») (@«noRevisiting») (@«hqSucc») + (@«hcorrFinalColor») (@«horiginalPositive») (@«hlastMap») (@«hreplacementCurrentTree») + (@«horiginalCurrentTree») (@«peRootOnly») (@«available») (@«hearlierPositive») + (@«hbaseEarlierKind») (@«oldi») (@«oldChoice») (@«oldGamma») (@«oldGammaRule») (@«oldSecond») + (@«oldSecondProper») (@«oldSecondStable») (@«oldCurrentColoring») (@«oldCurrentProper») + (@«oldCurrentOne») (@«oldCurrentStored») (@«oldCurrentEdges») (@«oldCurrentKind») + (@«oldCurrentVertex») (@«oldCurrentDelta») (@«oldCurrentGamma») (@«hbaseTarget») + (@«holdIndex») (@«newGamma») (@«newSecond») (@«newSecondProper») (@«newPreviousProper») + (@«newPreviousOne») (@«newPreviousClosed») (@«newPreviousNotStrong») (@«newNoRE») + (@«newChoicePE») (@«newAlternativeFails») (@«newGammaRule») (@«newSecondStable») (@«newExit») + (@«newCurrentColoring») (@«newCurrentProper») (@«newCurrentOne») (@«newCurrentStored») + (@«newCurrentEdges») (@«newCurrentKind») (@«newCurrentVertex») (@«newCurrentOutside») + (@«newCurrentDelta») (@«newCurrentGamma») (@«newClosedExtension») (@«newOrderedExtension») + (@«newStrictExtension») (@«hnewTarget») (@«hnewIndex») (@«hbaseTree») + (@«transportChoiceFields») (@«htransport») (@«holdEdgeCast») (@«holdVertexCast») + (@«holdOtherCast») (@«holdColorCast») (@«hedgePairs») (@«hcolorPairs») (@«hedgeIdentity») + (@«hends») (@«hvertexIdentity») (@«hotherIdentity») (@«pePostStatus») (@«holdDeltaMissing») + (@«holdGammaNotMissing») (@«holdColorNe») (@«hnewDeltaMissing») (@«hnewGammaNotMissing») + (@«hnewColorNe») + +private theorem helper_branch_280.{u_1, u_2} : + helperBranch280Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge hlower + set q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : + Fin ett.rounds) + intro sigmaPrev hsigmaPrevProper hsigmaPrevOne previousProper previousOneUncolored + hsigmaPrevStableQ originalPrefix hr hprefixMP hprefixTrees hprefixData corr hcorrFinalColor + hcorrMP noRevisiting hqSucc + set replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds + intro horiginalPositive hlastMap hreplacementCurrentTree horiginalCurrentTree peRootOnly available + set earlierPrefix : Fin (originalPrefix.rounds + + (1 : ℕ)) := available.earlier + intro hearlierPositive hbaseEarlierKind oldi oldChoice oldGamma oldGammaRule oldSecond + oldSecondProper oldSecondStable oldCurrentColoring oldCurrentProper oldCurrentOne + oldCurrentStored oldCurrentEdges oldCurrentKind oldCurrentVertex oldCurrentDelta + oldCurrentGamma hbaseTarget + have holdIndex : oldi.succ = earlierPrefix := by + simpa using hbaseTarget.symm + have hnewStep := + corr.replacementSeries.certified earlierPrefix + generalize hnewTarget : earlierPrefix = newTarget at hnewStep + cases hnewStep with + | initial tripleNew seedLengthNew initialColoringNew + initialStoredNew initialEdgesNew initialKindNew + initialVertexNew initialOutsideNew initialDeltaNew + initialGammaNew initialClosureNew => + have hk : corr.replacementSeries.data.kind 0 = + some TashkinovExtensionKind.PE := by + rw [← hnewTarget] + exact available.earlierPE + have hbad := initialKindNew.symm.trans + hk + simp at hbad + | SE newi newPreviousProper newPreviousOne newPreviousClosed + newPreviousNotStrong newNoRE newChoicePE newAlternative + newCurrentColoring newCurrentStored newCurrentEdges + newCurrentKind newCurrentVertex newCurrentOutside + newCurrentDelta newCurrentGamma newAdjoined + newAdjoinedExactly newClosedExtension newOrderedExtension + newStrictExtension => + have hk : corr.replacementSeries.data.kind newi.succ = + some TashkinovExtensionKind.PE := by + rw [← hnewTarget] + exact available.earlierPE + have hbad := newCurrentKind.symm.trans + hk + cases hbad + | RE newi newPreviousProper newPreviousOne newPreviousClosed + newPreviousNotStrong newAvailable newCurrentColoring + newCurrentStored newCurrentEdges newCurrentKind + newCurrentVertex newCurrentOutside newCurrentDelta + newCurrentGamma newAdjoined newAdjoinedExactly + newClosedExtension newOrderedExtension newStrictExtension => + have hk : corr.replacementSeries.data.kind newi.succ = + some TashkinovExtensionKind.PE := by + rw [← hnewTarget] + exact available.earlierPE + have hbad := newCurrentKind.symm.trans + hk + cases hbad + | PE newi newPreviousProper newPreviousOne newPreviousClosed + newPreviousNotStrong newNoRE newChoicePE + newAlternativeFails newGamma newGammaRule newSecond + newSecondProper newSecondOne newSecondStable newExit + newCurrentColoring newCurrentProper newCurrentOne + newCurrentStored newCurrentEdges newCurrentKind + newCurrentVertex newCurrentOutside newCurrentDelta + newCurrentGamma newClosedExtension newOrderedExtension + newStrictExtension => + exact @helper_branch_377 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hroundLarge hlower sigmaPrev hsigmaPrevProper hsigmaPrevOne + previousProper previousOneUncolored hsigmaPrevStableQ originalPrefix hr hprefixMP + hprefixTrees hprefixData corr hcorrFinalColor hcorrMP noRevisiting hqSucc + horiginalPositive hlastMap hreplacementCurrentTree horiginalCurrentTree peRootOnly + available hearlierPositive hbaseEarlierKind oldi oldChoice oldGamma oldGammaRule + oldSecond oldSecondProper oldSecondStable oldCurrentColoring oldCurrentProper + oldCurrentOne oldCurrentStored oldCurrentEdges oldCurrentKind oldCurrentVertex + oldCurrentDelta oldCurrentGamma hbaseTarget holdIndex newi newPreviousProper + newPreviousOne newPreviousClosed newPreviousNotStrong newNoRE newChoicePE + newAlternativeFails newGamma newGammaRule newSecond newSecondProper newSecondStable + newExit newCurrentColoring newCurrentProper newCurrentOne newCurrentStored + newCurrentEdges newCurrentKind newCurrentVertex newCurrentOutside newCurrentDelta + newCurrentGamma newClosedExtension newOrderedExtension newStrictExtension hnewTarget +theorem P2971_T1_PositivePrefixNoRevisiting {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (_ : MaximumProperty ett) (hroundLarge : 1 < ett.rounds) + (hlower : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tnext : TreeSequence G e0 := + lower.series.data.tree (Fin.last (lower.rounds + 1)) + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring Tnext + (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma Tnext ∨ + beta ∈ TreeMissingColors sigma Tnext) → + TreeInterchangeable G Tnext sigma alpha beta) ∧ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn : TreeSequence G e0 := lower.series.data.tree n.castSucc + ∀ (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE → + lower.series.data.chosenVertex n = some v → + lower.series.data.gamma n = some gamma → + lower.series.data.delta n = some delta → + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring Tn + (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma → + ∀ w, w ∈ TreeSequenceVertexSet Tn → + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) ↔ w = v))) : + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + let Tn : TreeSequence G e0 := + ett.series.data.tree (Fin.last ett.rounds).castSucc + ∀ (sigmaPrev : PartialEdgeColoring E k), + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input Tn + (ett.series.data.coloring q.castSucc)) + (hr : originalPrefix.rounds = ett.rounds - 1), + MaximumProperty originalPrefix → + ( + ∀ i : Fin (originalPrefix.rounds + 2), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) → + ( + ∀ i : Fin (originalPrefix.rounds + 1), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev Tn), + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1)) = Tn → + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = sigmaPrev → + MaximumProperty corr.replacementETT → + (¬ Nonempty (RevisitingExtensionCertificate ett.series.data + q.castSucc)) → + ¬ Nonempty (RevisitingExtensionCertificate + corr.replacementSeries.data (Fin.last originalPrefix.rounds)) := by + classical + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + change ∀ sigmaPrev, _ + intro sigmaPrev hsigmaPrevProper hsigmaPrevOne previousProper + previousOneUncolored hsigmaPrevStableQ originalPrefix hr hprefixMP + hprefixTrees hprefixData corr hcorrFinalTree hcorrFinalColor hcorrMP + noRevisiting + have hqSucc : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + let replacementLast : Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds + have horiginalPositive : 0 < originalPrefix.rounds := by + rw [hr] + omega + have hlastMap : Fin.castLE (by omega) replacementLast = + q.castSucc := by + apply Fin.ext + simp [replacementLast, q, hr] + have hreplacementCurrentTree : + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree q.succ.castSucc := by + have hlastTree : replacementLast.succ = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [replacementLast] + rw [hlastTree, hcorrFinalTree, hqSucc] + have horiginalCurrentTree : + originalPrefix.series.data.tree replacementLast.castSucc = + ett.series.data.tree q.castSucc.castSucc := by + calc + originalPrefix.series.data.tree replacementLast.castSucc = + ett.series.data.tree + (Fin.castLE (by omega) replacementLast.castSucc) := + hprefixTrees replacementLast.castSucc + _ = ett.series.data.tree q.castSucc.castSucc := by + congr 1 + apply Fin.ext + simp [replacementLast, q, hr] + have peRootOnly := + @helper_peRootOnly_167 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hroundLarge hlower originalPrefix hr + rintro ⟨available⟩ + let earlierPrefix : Fin (originalPrefix.rounds + 1) := + available.earlier + have hearlierPositive : 0 < earlierPrefix.val := + available.earlierPositive + have hbaseEarlierKind : originalPrefix.series.data.kind + earlierPrefix = some TashkinovExtensionKind.PE := by + rw [← corr.extensionKindsAgree earlierPrefix] + exact available.earlierPE + have hbaseStep := originalPrefix.series.certified earlierPrefix + generalize hbaseTarget : earlierPrefix = baseTarget at hbaseStep + cases hbaseStep with + | initial tripleBase seedLengthBase initialColoringBase + initialStoredBase initialEdgesBase initialKindBase + initialVertexBase initialOutsideBase initialDeltaBase + initialGammaBase initialClosureBase => + have hbad := initialKindBase.symm.trans + (by simpa [hbaseTarget] using hbaseEarlierKind) + simp at hbad + | SE oldi oldPreviousProper oldPreviousOne oldPreviousClosed + oldPreviousNotStrong oldNoRE oldChoice oldAlternative + oldCurrentColoring oldCurrentStored oldCurrentEdges + oldCurrentKind oldCurrentVertex oldCurrentOutside + oldCurrentDelta oldCurrentGamma oldAdjoined + oldAdjoinedExactly oldClosedExtension oldOrderedExtension + oldStrictExtension => + have hbad := oldCurrentKind.symm.trans + (by simpa [hbaseTarget] using hbaseEarlierKind) + cases hbad + | RE oldi oldPreviousProper oldPreviousOne oldPreviousClosed + oldPreviousNotStrong oldAvailable oldCurrentColoring + oldCurrentStored oldCurrentEdges oldCurrentKind + oldCurrentVertex oldCurrentOutside oldCurrentDelta + oldCurrentGamma oldAdjoined oldAdjoinedExactly + oldClosedExtension oldOrderedExtension oldStrictExtension => + have hbad := oldCurrentKind.symm.trans + (by simpa [hbaseTarget] using hbaseEarlierKind) + cases hbad + | PE oldi oldPreviousProper oldPreviousOne oldPreviousClosed + oldPreviousNotStrong oldNoRE oldChoice oldAlternativeFails + oldGamma oldGammaRule oldSecond oldSecondProper oldSecondOne + oldSecondStable oldExit oldCurrentColoring oldCurrentProper + oldCurrentOne oldCurrentStored oldCurrentEdges oldCurrentKind + oldCurrentVertex oldCurrentOutside oldCurrentDelta + oldCurrentGamma oldClosedExtension oldOrderedExtension + oldStrictExtension => + exact @helper_branch_280 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hroundLarge hlower sigmaPrev hsigmaPrevProper hsigmaPrevOne + previousProper previousOneUncolored hsigmaPrevStableQ originalPrefix hr hprefixMP + hprefixTrees hprefixData corr hcorrFinalColor hcorrMP noRevisiting hqSucc + horiginalPositive hlastMap hreplacementCurrentTree horiginalCurrentTree peRootOnly + available hearlierPositive hbaseEarlierKind oldi oldChoice oldGamma oldGammaRule + oldSecond oldSecondProper oldSecondStable oldCurrentColoring oldCurrentProper + oldCurrentOne oldCurrentStored oldCurrentEdges oldCurrentKind oldCurrentVertex + oldCurrentDelta oldCurrentGamma hbaseTarget +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/PositivePrefixPresentation.lean b/LeanPool/GoldbergSeymour/PositivePrefixPresentation.lean new file mode 100644 index 0000000000..7aa924a9ce --- /dev/null +++ b/LeanPool/GoldbergSeymour/PositivePrefixPresentation.lean @@ -0,0 +1,186 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage + +/-! +# P2716_T1_Positive Prefix Presentation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2716_T1_PositivePrefixPresentation {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (alpha theta : Fin k) + (hrecolor : OutsideKempeRecoloring T phi sigma alpha theta) + (hd : 0 < H.dividerCount) : + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma + (HierarchyStarredStage H (Fin.last H.dividerCount)), + MaximumProperty corr.replacementETT ∧ + ∃ basePrefix : HierarchyBase corr.replacementETT sigma, + ∃ K : TashkinovHierarchy corr.replacementETT basePrefix, + ∃ goodPrefix : GoodHierarchy K, + K.dividerCount = H.dividerCount - 1 ∧ + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card ∧ + TreeColorSetMinusClosed G sigma + (HierarchyStarredStage H (Fin.last H.dividerCount)) + ((HierarchyTerminalStoredColors K).biUnion + (goodPrefix.gamma (Fin.last K.dividerCount))) := by + classical + have starPositive : + ∀ {input' : PartialEdgeColoring E k} {generating' psi : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T generating'} {b : HierarchyBase other psi} + (L : TashkinovHierarchy other b) (j : Fin (L.dividerCount + 1)), 0 < j.val → + HierarchyStarredStage L j = L.stage j.castSucc := by + intro input' generating' psi other b L j + refine Fin.cases ?_ ?_ j + · intro hj + simp at hj + · intro i hj + rfl + have treeOfSeriesEq {m n : ℕ} {psi : PartialEdgeColoring E k} + (s : TashkinovSeries G k m e0 psi) + (t : TashkinovSeries G k n e0 psi) + (h : m = n) (hs : HEq s t) (j : Fin (m + 2)) : + s.data.tree j = t.data.tree (Fin.cast (congrArg (fun a => a + 2) h) j) := by + cases h + cases hs + rfl + have storedOfSeriesEq {m n : ℕ} {psi : PartialEdgeColoring E k} + (s : TashkinovSeries G k m e0 psi) + (t : TashkinovSeries G k n e0 psi) + (h : m = n) (hs : HEq s t) : + TashkinovStoredColors s.data (Fin.last m) = + TashkinovStoredColors t.data (Fin.last n) := by + cases h + cases hs + rfl + have ladderOfCorr : ∀ {U : TreeSequence G e0} + (c : CorrespondingExtendedTashkinovTree G k e0 ett sigma U), + c.replacementETT.series.data.tree (Fin.last c.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + intro U c + have ht := treeOfSeriesEq c.replacementETT.series c.replacementSeries + c.rungAgreement c.seriesPresentation (Fin.last c.replacementETT.rounds).castSucc + let i : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hi : Fin.cast (congrArg (fun a => a + 2) c.rungAgreement) + (Fin.last c.replacementETT.rounds).castSucc = i.succ.castSucc := by + apply Fin.ext + dsimp [i] + have hr := c.rungAgreement + omega + have hi' : i.succ.castSucc = (Fin.last ett.rounds).castSucc := by + apply Fin.ext + dsimp [i] + omega + rw [hi] at ht + exact ht.trans ((c.ladderTreesAgree i).trans (congrArg ett.series.data.tree hi')) + obtain ⟨proper, one, stable, invariant, c, cMP, b, L, goodL, same, terminal⟩ := + HierarchyLEMStable G k e0 input T phi sigma ett hMP hpositive hlower + base H good hproper hone alpha theta hrecolor + have count : H.dividerCount = L.dividerCount := same.1.2.1 + have stages : HEq H.stage L.stage := same.1.2.2.1 + let r : Fin (L.dividerCount + 1) := Fin.last L.dividerCount + have hr : 1 ≤ r.val := by dsimp [r]; omega + have treeEq : L.stage r.castSucc = + HierarchyStarredStage H (Fin.last H.dividerCount) := by + have stageEq := (Fin.heq_fun_iff (congrArg (fun q => q + 2) count)).mp + stages (Fin.last H.dividerCount).castSucc + have indexEq : Fin.cast (congrArg (fun q => q + 2) count) + (Fin.last H.dividerCount).castSucc = r.castSucc := by + apply Fin.ext + dsimp [r] + exact count + change H.stage (Fin.last H.dividerCount).castSucc = + L.stage (Fin.cast (congrArg (fun q => q + 2) count) + (Fin.last H.dividerCount).castSucc) at stageEq + rw [indexEq] at stageEq + exact stageEq.symm.trans (starPositive H _ (by simpa using hd)).symm + obtain ⟨ep, epMP, epRounds, epSeries, bp, core, closure, support, + K, kcount, kstages, positions, goodK, gammaData, minus⟩ := + GoodHierarchyPrefixRepackage G k e0 c.replacementInput T sigma sigma + c.replacementETT cMP b L goodL r hr + have hstored : HierarchyTerminalStoredColors K = HierarchyStoredColorsAt L r := by + unfold HierarchyTerminalStoredColors HierarchyStoredColorsAt + dsimp only + rw [storedOfSeriesEq ep.series c.replacementETT.series epRounds epSeries] + rw [starPositive L r (by omega)] + have gammaEq : goodK.gamma (Fin.last K.dividerCount) = + goodL.gamma ⟨r.val - 1, by omega⟩ := by + funext eta + have hdta := (gammaData ⟨r.val - 1, by omega⟩).2 eta + have hindex : Fin.cast (by omega) + (⟨r.val - 1, by omega⟩ : Fin r.val) = Fin.last K.dividerCount := by + apply Fin.ext + simp only [Fin.val_cast, Fin.val_last] + exact kcount.symm + simpa only [hindex] using hdta + have minusK : TreeColorSetMinusClosed G sigma (L.stage r.castSucc) + ((HierarchyTerminalStoredColors K).biUnion + (goodK.gamma (Fin.last K.dividerCount))) := by + rw [hstored, gammaEq] + exact minus + let cp : CorrespondingExtendedTashkinovTree G k e0 ett sigma (L.stage r.castSucc) := + { replacementInput := c.replacementInput + replacementSeries := c.replacementSeries + replacementETT := ep + rungAgreement := epRounds.trans c.rungAgreement + seriesPresentation := epSeries.trans c.seriesPresentation + finalGeneratingColoring := c.finalGeneratingColoring + ladderTreesAgree := c.ladderTreesAgree + storedColorsAgree := c.storedColorsAgree + connectingEdgesAgree := c.connectingEdgesAgree + extensionKindsAgree := c.extensionKindsAgree + replacementProper := c.replacementProper + replacementOneUncolored := c.replacementOneUncolored + replacementStable := c.replacementStable } + have large : 2 * cp.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma (cp.replacementETT.series.data.tree + (Fin.last cp.replacementETT.rounds).castSucc)).card := by + rw [ladderOfCorr cp, cp.rungAgreement] + have TnInside : TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ⊆ + TreeSequenceVertexSet T := + TreeSequenceInitialSegmentVertexSetSubset ett.abovePenultimate + have missingEq : TreeMissingColors sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) := + Finset.biUnion_congr rfl (fun v hv => stable.2 v (TnInside hv)) + rw [missingEq] + exact hlarge + have fewer : K.dividerCount = H.dividerCount - 1 := by + dsimp [r] at kcount + omega + rw [← treeEq] + exact ⟨cp, epMP, bp, K, goodK, fewer, large, minusK⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/PositiveWellDefinedness.lean b/LeanPool/GoldbergSeymour/PositiveWellDefinedness.lean new file mode 100644 index 0000000000..14a2134480 --- /dev/null +++ b/LeanPool/GoldbergSeymour/PositiveWellDefinedness.lean @@ -0,0 +1,217 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AlgorithmThreeOneStepExists +public import LeanPool.GoldbergSeymour.MaximumPropertyAppend +public import LeanPool.GoldbergSeymour.NormalizePositiveTerminalMaximum + +/-! +# Positive Well Definedness + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem PositiveWellDefinedness + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hfinal : T = ett.series.data.tree (Fin.last (ett.rounds + 1))) + (hMP : MaximumProperty ett) + (hdegree : MaximumDegree G + 1 <= k) + (hlarge : 11 <= TashkinovOrder G) : + (exists (replacementInput : PartialEdgeColoring E k) + (replacementSeries : TashkinovSeries G k ett.rounds e0 replacementInput) + (normalized : ExtendedTashkinovTree G k e0 replacementInput + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) + (replacementSeries.data.coloring (Fin.last ett.rounds))), + normalized.rounds = ett.rounds /\ + HEq normalized.series replacementSeries /\ + IsProperEdgeColoring G + (replacementSeries.data.coloring (Fin.last ett.rounds)) /\ + IsOneEdgeUncolored + (replacementSeries.data.coloring (Fin.last ett.rounds)) e0 /\ + ColoredVertexSetClosed G + (replacementSeries.data.coloring (Fin.last ett.rounds)) + (TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last (ett.rounds + 1)))) /\ + ColoredVertexSetStronglyClosed G + (replacementSeries.data.coloring (Fin.last ett.rounds)) + (TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last (ett.rounds + 1)))) /\ + MaximumProperty normalized /\ + TerminalClosureMaximum normalized) \/ + (exists (replacementInput : PartialEdgeColoring E k) + (extended : TashkinovSeries G k (ett.rounds + 1) e0 replacementInput) + (extendedETT : ExtendedTashkinovTree G k e0 replacementInput + (extended.data.tree (Fin.last ((ett.rounds + 1) + 1))) + (extended.data.coloring (Fin.last (ett.rounds + 1)))), + extendedETT.rounds = ett.rounds + 1 /\ + HEq extendedETT.series extended /\ + IsProperEdgeColoring G + (extended.data.coloring (Fin.last (ett.rounds + 1))) /\ + IsOneEdgeUncolored + (extended.data.coloring (Fin.last (ett.rounds + 1))) e0 /\ + ColoredVertexSetClosed G + (extended.data.coloring (Fin.last (ett.rounds + 1))) + (TreeSequenceVertexSet + (extended.data.tree (Fin.last ((ett.rounds + 1) + 1)))) /\ + MaximumProperty extendedETT) := by + classical + obtain ⟨sigmaN, Tstar, seed, corr, hsproper, hsone, hstable, + hroute, hclosure, hterminalEq, hreplacementMP, hterminalMaximum⟩ := + NormalizePositiveTerminalMaximum G k e0 input T generating ett hfinal hMP + hdegree hlarge + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk replacementRounds replacementRoundsPositive replacementData + abovePenultimate strictAbovePenultimate belowFinal generatingColoring => + dsimp at rungAgreement + subst replacementRounds + have replacementDataEq : replacementData = replacementSeries := + eq_of_heq seriesPresentation + subst replacementData + subst sigmaN + dsimp at hterminalEq hreplacementMP hterminalMaximum + subst Tstar + let normalized : ExtendedTashkinovTree G k e0 replacementInput + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) + (replacementSeries.data.coloring (Fin.last ett.rounds)) := { + rounds := ett.rounds + roundsPositive := replacementRoundsPositive + series := replacementSeries + abovePenultimate := abovePenultimate + strictAbovePenultimate := strictAbovePenultimate + belowFinal := belowFinal + generatingColoring := generatingColoring } + change MaximumProperty normalized at hreplacementMP + change TerminalClosureMaximum normalized at hterminalMaximum + have hclosed : ColoredVertexSetClosed G + (replacementSeries.data.coloring (Fin.last ett.rounds)) + (TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last (ett.rounds + 1)))) := + hclosure.2 + by_cases hstrong : ColoredVertexSetStronglyClosed G + (replacementSeries.data.coloring (Fin.last ett.rounds)) + (TreeSequenceVertexSet + (replacementSeries.data.tree (Fin.last (ett.rounds + 1)))) + · exact Or.inl ⟨replacementInput, replacementSeries, normalized, rfl, + HEq.rfl, hsproper, hsone, hclosed, hstrong, hreplacementMP, + hterminalMaximum⟩ + · obtain ⟨newTree, newColoring, newStored, newConnectingEdges, newKind, + newChosenVertex, newOutsideVertex, newDelta, newGamma, extended, + happend, hstrict⟩ := + AlgorithmThreeOneStepExists G k ett.rounds e0 replacementInput + replacementSeries hdegree hsproper hsone hclosed hstrong + obtain ⟨extendedETT, hettRounds, hettSeries, hettMP⟩ := + MaximumPropertyAppend G k e0 replacementInput + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) + (replacementSeries.data.coloring (Fin.last ett.rounds)) normalized + hreplacementMP hterminalMaximum newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma extended happend + have terminalFacts : + forall (rounds : Nat) (series : TashkinovSeries G k rounds e0 replacementInput), 0 < rounds -> + IsProperEdgeColoring G (series.data.coloring (Fin.last rounds)) /\ IsOneEdgeUncolored + (series.data.coloring (Fin.last rounds)) e0 /\ ColoredVertexSetClosed G + (series.data.coloring (Fin.last rounds)) (TreeSequenceVertexSet (series.data.tree + (Fin.last (rounds + 1)))) := by + intro rounds series hrounds + let q : Fin rounds := + ⟨rounds - 1, Nat.sub_lt hrounds (by omega)⟩ + have hq : q.succ = Fin.last rounds := by + apply Fin.ext + exact Nat.sub_add_cancel hrounds + have hq2 : q.succ.succ = Fin.last (rounds + 1) := by + rw [hq] + rfl + have step := series.certified (Fin.last rounds) + generalize hidx : Fin.last rounds = target at step + cases step with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv : rounds = 0 := by + simpa using congrArg Fin.val hidx + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val hidx + simp [q] at hv ⊢ + omega + subst i + constructor + · rw [currentColoring] + exact choice.selectedProper + constructor + · rw [currentColoring] + exact choice.selectedOneUncolored + · rw [← hq2] + exact closedExtension.2 + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val hidx + simp [q] at hv ⊢ + omega + subst i + constructor + · exact currentProper + constructor + · exact currentOneUncolored + · rw [← hq2] + exact closedExtension.2 + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val hidx + simp [q] at hv ⊢ + omega + subst i + constructor + · rw [currentColoring] + exact previousProper + constructor + · rw [currentColoring] + exact previousOneUncolored + · rw [← hq2] + exact closedExtension.2 + obtain ⟨hextProper, hextOne, hextClosed⟩ := + terminalFacts (ett.rounds + 1) extended (by omega) + exact Or.inr ⟨replacementInput, extended, extendedETT, hettRounds, + hettSeries, hextProper, hextOne, hextClosed, hettMP⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Preamble.lean b/LeanPool/GoldbergSeymour/Preamble.lean new file mode 100644 index 0000000000..02e1c3f1fc --- /dev/null +++ b/LeanPool/GoldbergSeymour/Preamble.lean @@ -0,0 +1,24 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Sym.Sym2 + +/-! +# Preamble + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/PredecessorElementary.lean b/LeanPool/GoldbergSeymour/PredecessorElementary.lean new file mode 100644 index 0000000000..722cb42ff9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/PredecessorElementary.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor + +public import LeanPool.GoldbergSeymour.TechnicalInductionContext +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase + +/-! +# P2634_T1_Predecessor Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2634_T1_PredecessorElementary + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (ctx : TechnicalInductionContext G k e0 ett.rounds) + (hMP : MaximumProperty ett) : + let q : Fin ett.rounds := ⟨ett.rounds - 1, by + have := ett.roundsPositive + omega⟩ + ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) := by + dsimp only + intro u hu v hv hne + by_cases hone : ett.rounds = 1 + · have hbase : ColoredVertexSetElementary G (ett.series.data.coloring 0) + (TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩)) := + (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + have hc : (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) = 0 := by + apply Fin.ext + simp [hone] + have ht : (Fin.last ett.rounds).castSucc = + (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp [hone] + rw [ht] at hu hv + have hd := hbase hu hv hne + simpa only [Fin.castSucc_mk, hc] using hd + · have hmore : 1 < ett.rounds := by have := ett.roundsPositive; omega + obtain ⟨pred, hr, hmax, _, _⟩ := + CertifiedETTPredecessor G k e0 input T phi ett hMP hmore + have helem : ColoredVertexSetElementary G + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) + (TreeSequenceVertexSet (ett.series.data.tree ⟨ett.rounds, by omega⟩)) := + ctx.lowerOne pred (by omega) (by omega) hmax + have ht : (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + rfl + rw [← ht] at hu hv + simpa only [Fin.castSucc_mk] using helem hu hv hne + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/PrefixSegmentTransport.lean b/LeanPool/GoldbergSeymour/PrefixSegmentTransport.lean new file mode 100644 index 0000000000..66c4f7320d --- /dev/null +++ b/LeanPool/GoldbergSeymour/PrefixSegmentTransport.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff + +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# P2813_T1_Prefix Segment Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2813_T1_PrefixSegmentTransport {V E : Type*} + [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi sigma : PartialEdgeColoring E k) (U A T : TreeSequence G e0) + (hUA : TreeSequenceInitialSegment U A) + (hAT : TreeSequenceInitialSegment A T) + (hfixed : ∀ t : Fin A.length, sigma (A.edge t) = phi (A.edge t)) + (hmissing : ∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) + (eta : Fin k) (lower : Nat) : + (Finset.univ.filter fun c : Fin k => + ∃ r : Fin U.length, lower ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition sigma A eta).val U.length ∧ + sigma (U.edge r) = some c) = + (Finset.univ.filter fun c : Fin k => + ∃ r : Fin U.length, lower ≤ r.val ∧ + r.val < min (HierarchyFirstMissingPosition phi T eta).val U.length ∧ + phi (U.edge r) = some c) := by + classical + let _ := Fintype.ofFinite V + have firstEq : HierarchyFirstMissingPosition sigma A eta = + HierarchyFirstMissingPosition phi A eta := by + have candidates : + (Finset.univ.filter fun j : Fin (A.length + 1) => + eta ∈ MissingColors G sigma (A.vertex j)) = + (Finset.univ.filter fun j : Fin (A.length + 1) => + eta ∈ MissingColors G phi (A.vertex j)) := by + apply Finset.filter_congr + intro j _ + have hj : A.vertex j ∈ TreeSequenceVertexSet A := by + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + rw [hmissing _ hj] + unfold HierarchyFirstMissingPosition + rw [candidates] + have cutoff := HierarchyFirstMissingPositionPrefixCutoff phi A T hAT eta U.length hUA.1 + rw [firstEq, cutoff] + apply Finset.filter_congr + intro c _ + constructor + · rintro ⟨r, hr, hp, hc⟩ + refine ⟨r, hr, hp, ?_⟩ + have he : sigma (U.edge r) = phi (U.edge r) := by + rw [← hUA.2.2 r] + exact hfixed _ + exact he.symm.trans hc + · rintro ⟨r, hr, hp, hc⟩ + refine ⟨r, hr, hp, ?_⟩ + have he : sigma (U.edge r) = phi (U.edge r) := by + rw [← hUA.2.2 r] + exact hfixed _ + exact he.trans hc + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/PresentColors.lean b/LeanPool/GoldbergSeymour/PresentColors.lean new file mode 100644 index 0000000000..16b754fb9b --- /dev/null +++ b/LeanPool/GoldbergSeymour/PresentColors.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.Fin + +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.PartialEdgeColoring + +/-! +# Present Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Colors carried by edges incident to the vertex. -/ +noncomputable def PresentColors {V E : Type*} [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (φ : PartialEdgeColoring E k) (v : V) : Finset (Fin k) := by + classical + exact Finset.univ.filter fun c => ∃ e, Incident G v e ∧ φ e = some c + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ProperColoringRestricts.lean b/LeanPool/GoldbergSeymour/ProperColoringRestricts.lean new file mode 100644 index 0000000000..85eb586546 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ProperColoringRestricts.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.RestrictEdges +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring + +/-! +# Proper Coloring Restricts + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ProperColoringRestricts {V E : Type*} [Finite V] [Finite E] + (G : LooplessMultigraph V E) (F : Finset E) {k : ℕ} + (φ : PartialEdgeColoring E k) (hφ : IsProperEdgeColoring G φ) : + IsProperEdgeColoring (RestrictEdges G F) (fun e => φ e.1) := by + classical + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + intro e f c hne hadj he hf + apply hφ (e := e.1) (f := f.1) ?_ + (by simpa [AdjacentEdges, Incident, RestrictEdges] using hadj) he hf + intro hef + apply hne + exact Subtype.ext hef + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RecoloredPrefixReconstruction.lean b/LeanPool/GoldbergSeymour/RecoloredPrefixReconstruction.lean new file mode 100644 index 0000000000..469a659b2c --- /dev/null +++ b/LeanPool/GoldbergSeymour/RecoloredPrefixReconstruction.lean @@ -0,0 +1,270 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext + +public import LeanPool.GoldbergSeymour.Td + +/-! +# P2813_T1_Prefix Reconstruction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem P2813_T1_PrefixReconstruction_branch_184.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (sigma : + PartialEdgeColoring E k), ( + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + ∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) → ( + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + let H := C.hierarchy; + let q := Fin.last H.dividerCount; + let A := HierarchyStarredStage H q; + let n := Fin.last ett.rounds; + let Tn := ett.series.data.tree n.castSucc; ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → TreeSequenceInitialSegment A T → ( + ∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S U → S.length = U.length → S = U) → + TreeSequenceInitialSegment Tn A → ModColoring ett sigma → ¬A = Tn → HierarchyStarredStage + C.hierarchy (Fin.last C.hierarchy.dividerCount) = ett.series.data.tree (Fin.last + ett.rounds).castSucc ∨ + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma (HierarchyStarredStage + C.hierarchy (Fin.last C.hierarchy.dividerCount))), MaximumProperty corr.replacementETT := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma hfixed hmissing H q A n Tn trans hAT + equalTrees TnA hmod he + have hstrict : Tn.length < A.length := by + have hle := TnA.1 + by_contra h + have hlen : Tn.length = A.length := by omega + exact he (equalTrees TnA hlen).symm + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + have transport (S : TreeSequence G e0) : + ∀ (X : TreeSequence G e0), TashkinovAugmentationSequence phi S X → + TreeSequenceInitialSegment X A → TashkinovAugmentationSequence sigma S X := by + intro X hseq + unfold TashkinovAugmentationSequence at hseq ⊢ + induction hseq with + | refl => intro _; exact Relation.ReflTransGen.refl + | @tail U W hSU hUW ih => + intro hWA + obtain ⟨hlen, hseg, c, hcolor, hcm⟩ := hUW + have hUA := trans hseg hWA + have hcSigma : c ∈ TreeMissingColors sigma U := by + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hcm + exact Finset.mem_biUnion.mpr ⟨v, hv, by + rw [hmissing v (TreeSequenceInitialSegmentVertexSetSubset hUA hv)] + exact hcv⟩ + let t : Fin W.length := Fin.cast hlen.symm (Fin.last U.length) + have he : sigma (W.edge t) = phi (W.edge t) := by + rw [← hWA.2.2 t] + exact hfixed _ + exact Relation.ReflTransGen.tail (ih hUA) + ⟨hlen, hseg, c, he.trans hcolor, hcSigma⟩ + have routeA : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn A) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed A) := by + rcases P2813_T1_TerminalRoute G k e0 input T phi ett with + ⟨hp, hseq⟩ | ⟨hp, f, seed, hedges, hseed, hincident, hcontrol, hseq⟩ + · have hpre := TashkinovAugmentationSequenceRestrict phi Tn A T hseq TnA hAT + exact Or.inl ⟨hp, transport Tn A hpre ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩⟩ + · have hseedA := commonPrefix + (TashkinovAugmentationSequenceInitialSegment phi seed T hseq) hAT + (by have hseedLen : seed.length = Tn.length + 1 := hseed.1; omega) + have hpre := TashkinovAugmentationSequenceRestrict phi seed A T hseq hseedA hAT + exact Or.inr ⟨hp, f, seed, hedges, hseed, + transport seed A hpre ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩⟩ + obtain ⟨corr⟩ := hmod.2.2 A TnA hstrict routeA + exact Or.inr ⟨corr, MaximumPropertyTransport G k e0 ett sigma hmod A corr C.maximum⟩ + +theorem P2813_T1_PrefixReconstruction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (sigma : PartialEdgeColoring E k) + (hsproper : IsProperEdgeColoring G sigma) + (hsone : IsOneEdgeUncolored sigma e0) + (hbase : + let n := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) + (hfixed : + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + ∀ t : Fin A.length, sigma (A.edge t) = phi (A.edge t)) + (hmissing : + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + ∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) : + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + let n := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + ModColoring ett sigma ∧ + (A = Tn ∨ + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma A, + MaximumProperty corr.replacementETT) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Ty := TreeSequencePrefix T + (min (A.length + ((T.length - A.length) - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + have trans {U W Z : TreeSequence G e0} + (hUW : TreeSequenceInitialSegment U W) + (hWZ : TreeSequenceInitialSegment W Z) : + TreeSequenceInitialSegment U Z := by + clear * - hUW hWZ + refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ + · intro j + exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) j)).trans + (hUW.2.1 j) + · intro j + exact (hWZ.2.2 (Fin.castLE hUW.1 j)).trans (hUW.2.2 j) + have stageChain : ∀ (j : ℕ) (hj : j < H.dividerCount + 2) + (i : Fin (H.dividerCount + 2)), i.val ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage ⟨j, hj⟩) := by + clear * - H trans + intro j + induction j with + | zero => + intro hj i hi + have hi0 : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have heq' : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) + (H.nested ⟨j, by omega⟩) + have starStage (r : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H r) + (H.stage r.succ) := by + clear * - H r + refine Fin.cases ?_ (fun i => ?_) r + · exact H.coreInsideFirst + · exact H.nested i.succ + have starChain (r s : Fin (H.dividerCount + 1)) (hrs : r ≤ s) : + TreeSequenceInitialSegment (HierarchyStarredStage H r) + (HierarchyStarredStage H s) := by + clear * - H r s hrs stageChain starStage trans + by_cases heq : r = s + · subst s + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have hrlt : r.val < s.val := by + have := Fin.le_iff_val_le_val.mp hrs + have : r.val ≠ s.val := fun h => heq (Fin.ext h) + omega + have hs : s ≠ 0 := by intro hs; subst s; simp at hrlt + have hstar : HierarchyStarredStage H s = H.stage s.castSucc := by + rw [← Fin.succ_pred s hs] + rfl + rw [hstar] + exact trans (starStage r) + (stageChain s.val (by omega) r.succ (by simp; omega)) + have hAT : TreeSequenceInitialSegment A T := by + have hh := starStage q + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa [hlast, H.terminalStage] using hh + have hATy : TreeSequenceInitialSegment A Ty := by + clear * - hAT A Ty + have hlen : A.length ≤ Ty.length := by + change A.length ≤ min (A.length + ((T.length - A.length) - 1)) T.length + exact Nat.le_min.mpr ⟨Nat.le_add_right _ _, hAT.1⟩ + refine ⟨hlen, ?_, ?_⟩ + · intro j + change T.vertex _ = A.vertex j + exact hAT.2.1 j + · intro j + change T.edge _ = A.edge j + exact hAT.2.2 j + have hTyT : TreeSequenceInitialSegment Ty T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have equalTrees {S U : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) (hlen : S.length = U.length) : S = U := by + cases S with + | mk ls ps vs es vis eis fs aas => + cases U with + | mk lu pu vu eu viu eiu fu aau => + simp only at hlen + subst lu + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.1 i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.2 i).symm + have coreChain : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (base.parallel hp).2.2.some.leftSegment + · rw [base.nonparallel hp] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have coreA : TreeSequenceInitialSegment base.core A := starChain 0 q (Fin.zero_le _) + have TnA := trans coreChain coreA + have hnStable : StableColoring Tn + (TashkinovStoredColors ett.series.data n) phi sigma := by + change (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure (TashkinovStoredColors ett.series.data n) phi sigma + else StableColoring Tn (TashkinovStoredColors ett.series.data n) phi sigma) at hbase + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (ite_eq_left hp ▸ hbase).1 + · simpa only [hp, ite_false] using hbase + have stableLadder : StableColoring Tn + (TashkinovStoredColors ett.series.data n) (ett.series.data.coloring n) sigma := by + rw [show ett.series.data.coloring n = phi from ett.generatingColoring.symm] + exact hnStable + have hmod : ModColoring ett sigma := Td G k e0 input T phi ett C.maximum + C.positive ctx.lowerRung sigma hsproper hsone stableLadder + refine ⟨hmod, ?_⟩ + by_cases he : A = Tn + · exact Or.inl he + · exact @P2813_T1_PrefixReconstruction_branch_184 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C sigma hfixed hmissing trans hAT equalTrees TnA + hmod he +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RestrictEdges.lean b/LeanPool/GoldbergSeymour/RestrictEdges.lean new file mode 100644 index 0000000000..59086866ff --- /dev/null +++ b/LeanPool/GoldbergSeymour/RestrictEdges.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.LooplessMultigraph + +/-! +# Restrict Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The multigraph retaining precisely the edges of the specified finite set. -/ +noncomputable def RestrictEdges {V E : Type*} (G : LooplessMultigraph V E) (F : Finset E) : + LooplessMultigraph V { e // e ∈ F } := by + classical + exact { ends := fun e => G.ends e.1 + loopless := fun e v => G.loopless e.1 v } + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RestrictedAugmentationCorrespondingEndpoint.lean b/LeanPool/GoldbergSeymour/RestrictedAugmentationCorrespondingEndpoint.lean new file mode 100644 index 0000000000..04950ca69a --- /dev/null +++ b/LeanPool/GoldbergSeymour/RestrictedAugmentationCorrespondingEndpoint.lean @@ -0,0 +1,367 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment + +/-! +# Restricted Augmentation Corresponding Endpoint + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch102Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + MaximumProperty ett → + ∀ (J U : TreeSequence G e0), + TashkinovAugmentationSequence sigma J U → + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar ∨ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = { f } ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f + seed ∧ + TashkinovAugmentationSequence sigma seed Tstar) → + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar)) → + (∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → + (∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A C → + TreeSequenceInitialSegment B C → A.length ≤ B.length → TreeSequenceInitialSegment A B) → + ∀ (replacementInput : PartialEdgeColoring E k) + (replacementSeries : TashkinovSeries G k ett.rounds e0 replacementInput), + sigma = replacementSeries.data.coloring (Fin.last ett.rounds) → + (∀ (i : Fin ett.rounds), + replacementSeries.data.tree i.succ.castSucc = ett.series.data.tree i.succ.castSucc) → + (∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeries.data.connectingEdges i = ett.series.data.connectingEdges i) → + (∀ (i : Fin (ett.rounds + (1 : ℕ))), + replacementSeries.data.kind i = ett.series.data.kind i) → + ∀ (rounds : ℕ) (roundsPositive : (1 : ℕ) ≤ rounds) + (replacementData : TashkinovSeries G k rounds e0 replacementInput) + (above : + TreeSequenceInitialSegment + (replacementData.data.tree (⟨rounds, (by omega)⟩ : Fin (rounds + (2 : ℕ)))) J) + (strict : + (replacementData.data.tree + (⟨rounds, (by omega)⟩ : Fin (rounds + (2 : ℕ)))).length < + J.length) + (below : + TreeSequenceInitialSegment J + (replacementData.data.tree (Fin.last (rounds + (1 : ℕ))))) + (generatingEq : sigma = replacementData.data.coloring (Fin.last rounds)), + { rounds := rounds, roundsPositive := roundsPositive, series := replacementData, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := generatingEq : + ExtendedTashkinovTree G k e0 replacementInput J sigma }.rounds = + ett.rounds → + { rounds := rounds, roundsPositive := roundsPositive, series := replacementData, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := generatingEq : + ExtendedTashkinovTree G k e0 replacementInput J sigma }.series ≍ + replacementSeries → + ∃ (corrU : CorrespondingExtendedTashkinovTree G k e0 ett sigma U), + MaximumProperty corrU.replacementETT + +private theorem helper_branch_102.{u_1, u_2} : + helperBranch102Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating sigma ett hMP J U hJU sigmaProper sigmaOneUncolored + hmodExtension initialSegmentTrans initialSegmentOfCommonExtension replacementInput + replacementSeries finalGeneratingColoring ladderTreesAgree connectingEdgesAgree + extensionKindsAgree rounds roundsPositive replacementData above strict below generatingEq + rungAgreement seriesPresentation + cases rungAgreement + have seriesSame : replacementData = replacementSeries := + eq_of_heq seriesPresentation + cases seriesSame + let q : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt ett.roundsPositive) (by omega)⟩ + have hq : q.succ = Fin.last ett.rounds := by + apply Fin.ext + exact Nat.sub_add_cancel ett.roundsPositive + have hq2 : q.succ.succ = Fin.last (ett.rounds + 1) := by + rw [hq] + rfl + have ladderEq : replacementSeries.data.tree + (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rw [← hq] + exact ladderTreesAgree q + have lastIndexEq : (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + (Fin.last ett.rounds).castSucc := Fin.ext (by rfl) + have replacementLastToJ : TreeSequenceInitialSegment + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) J := by + rw [← lastIndexEq] + exact above + have replacementLastStrict : + (replacementSeries.data.tree + (Fin.last ett.rounds).castSucc).length < J.length := by + rw [← lastIndexEq] + exact strict + have originalLastToJ : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) J := by + rw [← ladderEq] + exact replacementLastToJ + have originalLastStrict : + (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length < J.length := by + rw [← ladderEq] + exact replacementLastStrict + have hJUInitial : TreeSequenceInitialSegment J U := + TashkinovAugmentationSequenceInitialSegment sigma J U hJU + have originalLastToU : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) U := + initialSegmentTrans originalLastToJ hJUInitial + have originalLastStrictU : + (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length < U.length := + lt_of_lt_of_le originalLastStrict hJUInitial.1 + have hroute : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) U) ∨ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed U) := by + have finalStep := replacementSeries.certified (Fin.last ett.rounds) + generalize finalIndex : Fin.last ett.rounds = target at finalStep + cases finalStep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hzero : ett.rounds = 0 := by + simpa using congrArg Fin.val finalIndex + have hpositive := ett.roundsPositive + rw [hzero] at hpositive + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val finalIndex + simp [q] at hv ⊢ + omega + subst i + rw [hq] + right + refine ⟨Or.inl ?_, choice.edge, adjoined, ?_, ?_, ?_⟩ + · rw [← extensionKindsAgree (Fin.last ett.rounds), ← hq] + exact currentKind + · rw [← connectingEdgesAgree (Fin.last ett.rounds), ← hq] + exact currentEdges + · rw [← ladderEq, ← hq] + exact adjoinedExactly + · have routeToFinal : TashkinovAugmentationSequence sigma adjoined + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := by + rw [finalGeneratingColoring, ← hq, ← hq2] + exact closedExtension.1 + have adjoinedToFinal : TreeSequenceInitialSegment adjoined + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := + TashkinovAugmentationSequenceInitialSegment sigma adjoined _ routeToFinal + have adjoinedLength : adjoined.length ≤ J.length := by + have hlen := adjoinedExactly.1 + rw [hq] at hlen + have hcommon := congrArg TreeSequence.length ladderEq + omega + have adjoinedToJ : TreeSequenceInitialSegment adjoined J := + initialSegmentOfCommonExtension adjoinedToFinal below adjoinedLength + have routeToJ := TashkinovAugmentationSequenceRestrict sigma + adjoined J _ routeToFinal adjoinedToJ below + exact routeToJ.trans hJU + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val finalIndex + simp [q] at hv ⊢ + omega + subst i + rw [hq] + left + refine ⟨?_, ?_⟩ + · rw [← extensionKindsAgree (Fin.last ett.rounds), ← hq] + exact currentKind + · have routeToFinal : TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := by + rw [finalGeneratingColoring, ← ladderEq, ← hq, ← hq2] + exact closedExtension.1 + have routeToJ := TashkinovAugmentationSequenceRestrict sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) J _ + routeToFinal originalLastToJ below + exact routeToJ.trans hJU + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val finalIndex + simp [q] at hv ⊢ + omega + subst i + rw [hq] + right + refine ⟨Or.inr ?_, available.edge, adjoined, ?_, ?_, ?_⟩ + · rw [← extensionKindsAgree (Fin.last ett.rounds), ← hq] + exact currentKind + · rw [← connectingEdgesAgree (Fin.last ett.rounds), ← hq] + exact currentEdges + · rw [← ladderEq, ← hq] + exact adjoinedExactly + · have routeToFinal : TashkinovAugmentationSequence sigma adjoined + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := by + rw [finalGeneratingColoring, ← hq, ← hq2] + exact closedExtension.1 + have adjoinedToFinal : TreeSequenceInitialSegment adjoined + (replacementSeries.data.tree (Fin.last (ett.rounds + 1))) := + TashkinovAugmentationSequenceInitialSegment sigma adjoined _ routeToFinal + have adjoinedLength : adjoined.length ≤ J.length := by + have hlen := adjoinedExactly.1 + rw [hq] at hlen + have hcommon := congrArg TreeSequence.length ladderEq + omega + have adjoinedToJ : TreeSequenceInitialSegment adjoined J := + initialSegmentOfCommonExtension adjoinedToFinal below adjoinedLength + have routeToJ := TashkinovAugmentationSequenceRestrict sigma + adjoined J _ routeToFinal adjoinedToJ below + exact routeToJ.trans hJU + have corrUNonempty : Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma U) := + hmodExtension U originalLastToU originalLastStrictU hroute + let corrU : CorrespondingExtendedTashkinovTree G k e0 ett sigma U := + Classical.choice corrUNonempty + refine ⟨corrU, ?_⟩ + exact MaximumPropertyTransport G k e0 ett sigma + ⟨sigmaProper, sigmaOneUncolored, hmodExtension⟩ U corrU hMP + +theorem RestrictedAugmentationCorrespondingEndpoint {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hmod : ModColoring ett sigma) (hMP : MaximumProperty ett) + (J U : TreeSequence G e0) + (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett sigma J) + (hJU : TashkinovAugmentationSequence sigma J U) : + ∃ corrU : CorrespondingExtendedTashkinovTree G k e0 ett sigma U, + MaximumProperty corrU.replacementETT := by + classical + rcases hmod with ⟨sigmaProper, sigmaOneUncolored, hmodExtension⟩ + have initialSegmentTrans : ∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → + TreeSequenceInitialSegment A C := by + intro A B C hAB hBC + rcases hAB with ⟨hlenAB, hvertexAB, hedgeAB⟩ + rcases hBC with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨Nat.le_trans hlenAB hlenBC, ?_, ?_⟩ + · intro i + calc + C.vertex (Fin.castLE + (Nat.succ_le_succ (Nat.le_trans hlenAB hlenBC)) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hlenBC) + (Fin.castLE (Nat.succ_le_succ hlenAB) i)) := by congr 1 + _ = B.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) i) := + hvertexBC _ + _ = A.vertex i := hvertexAB i + · intro i + calc + C.edge (Fin.castLE (Nat.le_trans hlenAB hlenBC) i) = + C.edge (Fin.castLE hlenBC (Fin.castLE hlenAB i)) := by congr 1 + _ = B.edge (Fin.castLE hlenAB i) := hedgeBC _ + _ = A.edge i := hedgeAB i + have initialSegmentOfCommonExtension : ∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A C → + TreeSequenceInitialSegment B C → + A.length ≤ B.length → + TreeSequenceInitialSegment A B := by + intro A B C hAC hBC hlenAB + rcases hAC with ⟨hlenAC, hvertexAC, hedgeAC⟩ + rcases hBC with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨hlenAB, ?_, ?_⟩ + · intro i + calc + B.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hlenBC) + (Fin.castLE (Nat.succ_le_succ hlenAB) i)) := + (hvertexBC _).symm + _ = C.vertex (Fin.castLE (Nat.succ_le_succ hlenAC) i) := by + congr 1 + _ = A.vertex i := hvertexAC i + · intro i + calc + B.edge (Fin.castLE hlenAB i) = + C.edge (Fin.castLE hlenBC (Fin.castLE hlenAB i)) := + (hedgeBC _).symm + _ = C.edge (Fin.castLE hlenAC i) := by congr 1 + _ = A.edge i := hedgeAC i + rcases corrJ with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generatingEq => + exact @helper_branch_102 V E inferInstance inferInstance inferInstance G k e0 input T + generating sigma ett hMP J U hJU sigmaProper sigmaOneUncolored hmodExtension + initialSegmentTrans initialSegmentOfCommonExtension replacementInput replacementSeries + finalGeneratingColoring ladderTreesAgree connectingEdgesAgree extensionKindsAgree + rounds roundsPositive replacementData above strict below generatingEq rungAgreement + seriesPresentation +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RetainedHierarchy.lean b/LeanPool/GoldbergSeymour/RetainedHierarchy.lean new file mode 100644 index 0000000000..d9c2ccea10 --- /dev/null +++ b/LeanPool/GoldbergSeymour/RetainedHierarchy.lean @@ -0,0 +1,389 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MinusClosedTransport +public import LeanPool.GoldbergSeymour.PrefixSegmentTransport +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.BoundaryColorEdges + +/-! +# P2813_T1_Retained Hierarchy + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_continuation_184.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H) (hq : (0 : ℕ) < H.dividerCount) (alpha beta : Fin k) (_ : alpha ≠ beta) + (z : V ⊕ E) (sigma : PartialEdgeColoring E k) (_ : sigma = TwoColorComponentSwap G phi + alpha beta z) (_ : IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (inputA : + PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA + (HierarchyStarredStage H (Fin.last H.dividerCount)) sigma) (baseA : HierarchyBase ettA + sigma) (K : TashkinovHierarchy ettA baseA) (_ : ettA.series.data.tree (Fin.last + ettA.rounds).castSucc = ett.series.data.tree (Fin.last ett.rounds).castSucc) (_ : + ettA.series.data.kind (Fin.last ettA.rounds) = ett.series.data.kind (Fin.last ett.rounds)) + (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount) (_ : baseA.core = base.core) (_ : + baseA.closure = base.closure) (_ : ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))))) (_ : ( + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t))) (_ : ( + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v)) (_ : ( + ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c : Fin k) (_ : c = alpha ∨ c = beta) (_ : c ∈ + TreeMissingColors phi (HierarchyStarredStage H r)) (_ : TreeColorSetClosed G phi + (HierarchyStarredStage H r) { c }), OutsideKempeRecoloring (HierarchyStarredStage H r) phi + sigma alpha beta)) (_ : ( + ∀ (_ : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE), + ∃ c ∈ TreeMissingColors phi base.core \ (HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + + (1 : ℕ)))).biUnion (good.gamma (0 : Fin (H.dividerCount + (1 : ℕ)))), + ∃ f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet base.core) c, sigma f = phi f)), + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : + TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : + TreeSequenceInitialSegment A T) (_ : ( + ∀ (j : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑j : ℕ) ≤ H.dividerCount), + TreeSequenceInitialSegment (H.stage j) A)) (_ : TreeSequenceInitialSegment base.core A) (_ + : TreeSequenceInitialSegment Tn A) (_ : ( + ∀ (U : TreeSequence G e0) (_ : TreeSequenceInitialSegment U A), TreeMissingColors sigma U = + TreeMissingColors phi U)), + let oldIndex : Fin (K.dividerCount + (1 : ℕ)) → Fin (H.dividerCount + (1 : ℕ)) := fun (j : Fin + (K.dividerCount + (1 : ℕ))) => (⟨(↑j : ℕ), + have this : (↑j : ℕ) < K.dividerCount + (1 : ℕ) := j.isLt; Decidable.byContradiction fun (a : + ¬(↑j : ℕ) < H.dividerCount + (1 : ℕ)) => + by + omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); + ∀ (_ : ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), HierarchyStarredStage K j = HierarchyStarredStage H + (oldIndex j))) (_ : ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), HierarchyStoredColorsAt K j = HierarchyStoredColorsAt + H (oldIndex j))), + ∃ (goodA : GoodHierarchy K), ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + let jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ (eta : Fin k), goodA.gamma j eta = good.gamma jH eta) ∧ TreeColorSetMinusClosed G sigma + (H.stage (Fin.last H.dividerCount).castSucc) ((HierarchyStoredColorsAt H (Fin.last + H.dividerCount)).biUnion (good.gamma (⟨H.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good hq alpha beta hne z sigma hsigma hproper + hone inputA ettA baseA K htreeA hkindA hcount hcoreA hclosureA stageEq hfixed hmissing + houtside hPEWitness q A n Tn trans hAT ordinaryToA coreA TnA treeMissingEq oldIndex + starredEq storedEq + have stageMissingEq (j : Fin (K.dividerCount + 1)) : + HierarchyStageMissingColors K j = HierarchyStageMissingColors H (oldIndex j) := by + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma + (ettA.series.data.tree (Fin.last ettA.rounds).castSucc) = TreeMissingColors phi Tn + rw [htreeA] + exact treeMissingEq Tn TnA + · change TreeMissingColors sigma (K.stage i.succ.castSucc) = + TreeMissingColors phi (H.stage ⟨i.val + 1, by omega⟩) + rw [stageEq i.succ.castSucc] + have hbound : i.val + 1 ≤ H.dividerCount := by + clear * - i hcount + have := i.isLt + omega + exact treeMissingEq _ (ordinaryToA ⟨i.val + 1, by omega⟩ hbound) + have segmentEq (j : Fin (K.dividerCount + 1)) (eta : Fin k) : + HierarchySegmentColors K j eta = HierarchySegmentColors H (oldIndex j) eta := by + have hnext : K.stage j.succ = H.stage (oldIndex j).succ := stageEq j.succ + unfold HierarchySegmentColors + dsimp only + rw [hnext, starredEq j] + exact P2813_T1_PrefixSegmentTransport phi sigma (H.stage (oldIndex j).succ) A T + (ordinaryToA _ (by have := j.isLt; simp only [oldIndex, Fin.val_succ]; omega)) + hAT hfixed hmissing eta (HierarchyStarredStage H (oldIndex j)).length + have closureA (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A := by + obtain ⟨union⟩ := (base.parallel hp).2.2 + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreA + rw [union.vertexSet] + exact Finset.mem_union_right _ hv + let R0 := (HierarchyStoredColorsAt H 0).biUnion (good.gamma 0) + have notClosedCore (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + ¬ TreeColorSetMinusClosed G sigma base.core R0 := by + obtain ⟨c, hc, f, hf, hvalue⟩ := hPEWitness hp + have hb := Finset.mem_filter.mp hf + intro hnew + have hcmNew : c ∈ TreeMissingColors sigma base.core \ R0 := by + rw [treeMissingEq base.core coreA] + exact hc + have hfNew : f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet base.core) c := + Finset.mem_filter.mpr ⟨hb.1, hvalue.trans hb.2⟩ + rw [hnew c hcmNew] at hfNew + exact Finset.notMem_empty f hfNew + have transportClosed (i : Fin H.dividerCount) : + TreeColorSetMinusClosed G sigma (H.stage i.succ.castSucc) + ((HierarchyStoredColorsAt H i.succ).biUnion (good.gamma i.castSucc)) := by + have hstar : HierarchyStarredStage H i.succ = H.stage i.succ.castSucc := rfl + apply P2813_T1_MinusClosedTransport G k e0 _ phi sigma alpha beta hne z hsigma + hproper hone _ (good.minusClosed i) + · intro v hv + exact hmissing v (TreeSequenceInitialSegmentVertexSetSubset + (ordinaryToA i.succ.castSucc + (by have := i.isLt; simp only [Fin.val_succ, Fin.val_castSucc]; omega)) hv) + · intro c hc hm hclosed + rw [← hstar] at hm hclosed ⊢ + exact houtside i.succ c hc hm hclosed + let goodA : GoodHierarchy K := + { gamma := fun j eta => good.gamma (oldIndex j) eta + twoColors := by + intro j eta heta + exact good.twoColors (oldIndex j) eta (storedEq j ▸ heta) + avoidance := by + intro j eta heta + rw [stageMissingEq j, segmentEq j eta] + exact good.avoidance (oldIndex j) eta (storedEq j ▸ heta) + disjointPairs := by + intro j eta theta heta htheta hne + exact good.disjointPairs (oldIndex j) eta theta + (storedEq j ▸ heta) (storedEq j ▸ htheta) hne + uniqueRefresh := by + intro i + let io : Fin H.dividerCount := ⟨i.val, by have := i.isLt; omega⟩ + have hdifference : + ((TreeSequenceVertexSet (H.stage io.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H io.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (H.stage io.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H io.castSucc)).biUnion + fun v => MissingColors G phi v) := by + apply Finset.biUnion_congr rfl + intro v hv + exact hmissing v (TreeSequenceInitialSegmentVertexSetSubset + (ordinaryToA io.succ.castSucc + (by have := io.isLt; simp only [Fin.val_succ, Fin.val_castSucc]; omega)) + (Finset.mem_sdiff.mp hv).1) + rw [storedEq i.succ, stageEq i.succ.castSucc, starredEq i.castSucc] + change ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt H io.succ ∧ + good.gamma io.succ eta ⊆ + ((TreeSequenceVertexSet (H.stage io.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H io.castSucc)).biUnion + fun v => MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt H io.succ, theta ≠ eta → + good.gamma io.succ theta = good.gamma io.castSucc theta + rw [hdifference] + exact good.uniqueRefresh io + parallelBase := by + dsimp only + intro hp + have hpOld : ett.series.data.kind n = some TashkinovExtensionKind.PE := + hkindA.symm.trans hp + rw [hcoreA, hclosureA, htreeA, storedEq 0] + change ¬ TreeColorSetMinusClosed G sigma base.core R0 ∧ + 4 ≤ ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma base.closure) \ R0).card + refine ⟨notClosedCore hpOld, ?_⟩ + have hmR : TreeMissingColors sigma base.closure = TreeMissingColors phi base.closure := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => hmissing v (closureA hpOld hv)) + rw [treeMissingEq Tn TnA, hmR] + exact (good.parallelBase hpOld).2 + minusClosed := by + intro i + let io : Fin H.dividerCount := ⟨i.val, by have := i.isLt; omega⟩ + rw [stageEq i.succ.castSucc, storedEq i.succ] + exact transportClosed io } + refine ⟨goodA, ?_, ?_⟩ + · intro j + exact ⟨storedEq j, fun _ => rfl⟩ + · have hh := transportClosed (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount) + have hlast : (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ = q := by + apply Fin.ext + dsimp [q] + omega + rw [hlast] at hh + exact hh + +theorem P2813_T1_RetainedHierarchy {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (hq : 0 < H.dividerCount) + (alpha beta : Fin k) (hne : alpha ≠ beta) (z : Sum V E) + (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hproper : IsProperEdgeColoring G phi) (hone : IsOneEdgeUncolored phi e0) + (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) + (inputA : PartialEdgeColoring E k) + (ettA : ExtendedTashkinovTree G k e0 inputA + (HierarchyStarredStage H (Fin.last H.dividerCount)) sigma) + (baseA : HierarchyBase ettA sigma) + (K : TashkinovHierarchy ettA baseA) + (htreeA : ettA.series.data.tree (Fin.last ettA.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (hkindA : ettA.series.data.kind (Fin.last ettA.rounds) = + ett.series.data.kind (Fin.last ett.rounds)) + (hstoredA : TashkinovStoredColors ettA.series.data (Fin.last ettA.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (hcount : K.dividerCount + 1 = H.dividerCount) + (hcoreA : baseA.core = base.core) (hclosureA : baseA.closure = base.closure) + (stageEq : ∀ j : Fin (K.dividerCount + 2), + K.stage j = H.stage ⟨j.val, by have := j.isLt; omega⟩) + (hfixed : + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + ∀ t : Fin A.length, sigma (A.edge t) = phi (A.edge t)) + (hmissing : + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + ∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) + (houtside : ∀ (r : Fin (H.dividerCount + 1)) (c : Fin k), + (c = alpha ∨ c = beta) → + c ∈ TreeMissingColors phi (HierarchyStarredStage H r) → + TreeColorSetClosed G phi (HierarchyStarredStage H r) {c} → + OutsideKempeRecoloring (HierarchyStarredStage H r) phi sigma alpha beta) + (hPEWitness : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + ∃ c : Fin k, + c ∈ TreeMissingColors phi base.core \ + (HierarchyStoredColorsAt H 0).biUnion (good.gamma 0) ∧ + ∃ f : E, f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet base.core) c ∧ + sigma f = phi f) : + ∃ goodA : GoodHierarchy K, + (∀ j : Fin (K.dividerCount + 1), + let jH : Fin (H.dividerCount + 1) := ⟨j.val, by have := j.isLt; omega⟩ + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H jH ∧ + ∀ eta : Fin k, goodA.gamma j eta = good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma (H.stage (Fin.last H.dividerCount).castSucc) + ((HierarchyStoredColorsAt H (Fin.last H.dividerCount)).biUnion + (good.gamma ⟨H.dividerCount - 1, by omega⟩)) := by + classical + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + have trans {U W Z : TreeSequence G e0} + (hUW : TreeSequenceInitialSegment U W) + (hWZ : TreeSequenceInitialSegment W Z) : + TreeSequenceInitialSegment U Z := by + clear * - hUW hWZ + refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ + · intro j + exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) j)).trans + (hUW.2.1 j) + · intro j + exact (hWZ.2.2 (Fin.castLE hUW.1 j)).trans (hUW.2.2 j) + have stageChain : ∀ (j : ℕ) (hj : j < H.dividerCount + 2) + (i : Fin (H.dividerCount + 2)), i.val ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage ⟨j, hj⟩) := by + clear * - H trans + intro j + induction j with + | zero => + intro hj i hi + have hi0 : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have heq' : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) + (H.nested ⟨j, by omega⟩) + have starPositive (j : Fin (H.dividerCount + 1)) (hj : 0 < j.val) : + HierarchyStarredStage H j = H.stage j.castSucc := by + clear * - hj + have hn : j ≠ 0 := by + intro h + have := congrArg Fin.val h + simp only [Fin.val_zero] at this + omega + rw [← Fin.succ_pred j hn] + rfl + have hA : A = H.stage q.castSucc := starPositive q hq + have hAT : TreeSequenceInitialSegment A T := by + rw [hA] + have hh := H.nested q + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa only [hlast, H.terminalStage] using hh + have ordinaryToA (j : Fin (H.dividerCount + 2)) (hj : j.val ≤ H.dividerCount) : + TreeSequenceInitialSegment (H.stage j) A := by + rw [hA] + exact stageChain H.dividerCount (by omega) j hj + have coreToStar (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j) := by + clear * - H trans stageChain starPositive + by_cases hj : j = 0 + · subst j + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have hjp : 0 < j.val := by + have hne : j.val ≠ 0 := fun hh => hj (Fin.ext hh) + omega + rw [starPositive j hjp] + exact trans H.coreInsideFirst + (stageChain j.val (by omega) ⟨1, by omega⟩ (by simp; omega)) + have starToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + by_cases hj : j = 0 + · subst j + exact coreToStar q + · rw [starPositive j (by + have hne : j.val ≠ 0 := fun hh => hj (Fin.ext hh) + omega)] + exact ordinaryToA j.castSucc (by have := j.isLt; simp only [Fin.val_castSucc]; omega) + have coreA : TreeSequenceInitialSegment base.core A := coreToStar q + have TnCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (base.parallel hp).2.2.some.leftSegment + · rw [base.nonparallel hp] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have TnA := trans TnCore coreA + have treeMissingEq (U : TreeSequence G e0) + (hUA : TreeSequenceInitialSegment U A) : + TreeMissingColors sigma U = TreeMissingColors phi U := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl + (fun v hv => hmissing v (TreeSequenceInitialSegmentVertexSetSubset hUA hv)) + let oldIndex (j : Fin (K.dividerCount + 1)) : Fin (H.dividerCount + 1) := + ⟨j.val, by have := j.isLt; omega⟩ + have starredEq (j : Fin (K.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage H (oldIndex j) := by + refine Fin.cases ?_ (fun i => ?_) j + · exact hcoreA + · change K.stage i.succ.castSucc = H.stage ⟨i.val + 1, by omega⟩ + exact stageEq i.succ.castSucc + have storedEq (j : Fin (K.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H (oldIndex j) := by + unfold HierarchyStoredColorsAt + dsimp only + rw [hstoredA, starredEq j, treeMissingEq _ (starToA (oldIndex j))] + exact @helper_continuation_184 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base H good hq alpha beta hne z sigma hsigma hproper hone inputA ettA + baseA K htreeA hkindA hcount hcoreA hclosureA stageEq hfixed hmissing houtside hPEWitness + trans hAT ordinaryToA coreA TnA treeMissingEq starredEq storedEq +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RevisitingCertificatePreparation.lean b/LeanPool/GoldbergSeymour/RevisitingCertificatePreparation.lean new file mode 100644 index 0000000000..f956cc3373 --- /dev/null +++ b/LeanPool/GoldbergSeymour/RevisitingCertificatePreparation.lean @@ -0,0 +1,159 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TdEarlierPEWitnessIdentification +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion + +/-! +# Revisiting extension kinds in certified prefixes + +Supporting lemmas for the Goldberg–Seymour revisiting-certificate construction. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Transfer revisiting extension kinds from a certified replacement prefix to the original + series. -/ +theorem revisitingExtensionKindsInPrefix.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬ett.rounds - (1 + : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬ett.rounds - (1 + : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds).castSucc)) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + Fin.castLE ( + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by + omega + ) replacementLast = (⟨ett.rounds - (1 : ℕ), + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬ett.rounds - (1 + : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds).castSucc → + ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; + ∀ (horiginalRoundsLess : originalPrefix.rounds < ett.rounds), + let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( + have _ : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by + omega + ) earlierPrefix; + ∀ (fulli : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (_ : Fin k) (j : Fin (ett.rounds + (1 : ℕ))), + (0 : ℕ) < (↑j : ℕ) → (↑oldEarlier : ℕ) < (↑j : ℕ) → (↑j : ℕ) ≤ (↑q.castSucc : ℕ) → + ett.series.data.kind j = some TashkinovExtensionKind.RE := by + classical + intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix hr + hprefixData corr replacementLast hlastMap available earlierPrefix horiginalRoundsLess + oldEarlier fulli fullChoice fullGamma j hjPositive hjLower hjUpper + let jPrefix : Fin (originalPrefix.rounds + 1) := + ⟨j.val, by + have hjBound := j.isLt + simp [q, hr] at hjUpper ⊢ + omega⟩ + have hjMap : Fin.castLE (by omega) jPrefix = j := by + apply Fin.ext + rfl + calc + ett.series.data.kind j = + ett.series.data.kind + (Fin.castLE (by omega) jPrefix) := by + rw [hjMap] + _ = originalPrefix.series.data.kind jPrefix := + (hprefixData jPrefix).2.2.2.1.symm + _ = corr.replacementSeries.data.kind jPrefix := + (corr.extensionKindsAgree jPrefix).symm + _ = some TashkinovExtensionKind.RE := by + apply available.interveningRevisiting jPrefix + · exact hjPositive + · simpa [jPrefix, oldEarlier, + earlierPrefix] using hjLower + · have hlastVals := + congrArg Fin.val hlastMap + simpa [jPrefix, replacementLast] using + hjUpper.trans_eq hlastVals.symm + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RevisitingExtensionCertificate.lean b/LeanPool/GoldbergSeymour/RevisitingExtensionCertificate.lean new file mode 100644 index 0000000000..1a176c4216 --- /dev/null +++ b/LeanPool/GoldbergSeymour/RevisitingExtensionCertificate.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.TashkinovSeriesData +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorCycle + +/-! +# Revisiting Extension Certificate + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- An earlier parallel extension, a two-color cycle and a boundary-return path certifying a +revisiting extension. +-/ +structure RevisitingExtensionCertificate {V E : Type*} [Fintype V] [Fintype E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} (data : TashkinovSeriesData G k rounds e0) + (i : Fin (rounds + 1)) where + /-- The earlier parallel-extension slot revisited by this certificate. -/ + earlier : Fin (rounds + 1) + earlierPositive : 0 < earlier.val + earlierAtMost : earlier.val ≤ i.val + earlierPE : data.kind earlier = some TashkinovExtensionKind.PE + interveningRevisiting : + ∀ j : Fin (rounds + 1), + 0 < j.val → earlier.val < j.val → j.val ≤ i.val → data.kind j = some TashkinovExtensionKind.RE + /-- The auxiliary color or color family used by this configuration. -/ + gamma : Fin k + /-- The companion color used for the component swap at each stage. -/ + delta : Fin k + earlierGamma : data.gamma earlier = some gamma + earlierDelta : data.delta earlier = some delta + /-- The two-color cycle witnessing the revisiting extension. -/ + cycle : TwoColorCycle G (data.coloring i) gamma delta + meetsEarlier : + ∃ v ∈ TreeSequenceVertexSet (data.tree earlier.castSucc), Sum.inl v ∈ cycle.walk.support + leavesCurrent : ∃ u ∉ TreeSequenceVertexSet (data.tree i.succ), Sum.inl u ∈ cycle.walk.support + /-- The selected edge, or ordered edges when the field is indexed. -/ + edge : E + edgeOnCycle : Sum.inr edge ∈ cycle.walk.support + edgeBoundary : edge ∈ BoundaryEdges G (TreeSequenceVertexSet (data.tree i.succ)) + /-- The chosen boundary-edge endpoint inside the current tree. -/ + insideEndpoint : V + /-- The chosen boundary-edge endpoint outside the current tree. -/ + outsideEndpoint : V + insideInCurrent : insideEndpoint ∈ TreeSequenceVertexSet (data.tree i.succ) + outsideNotCurrent : outsideEndpoint ∉ TreeSequenceVertexSet (data.tree i.succ) + edgeEnds : G.ends edge = s(insideEndpoint, outsideEndpoint) + /-- The vertex of the earlier tree at which the return path begins. -/ + returnVertex : V + returnInEarlier : returnVertex ∈ TreeSequenceVertexSet (data.tree earlier.castSucc) + /-- The cycle-supported path from the earlier tree toward the boundary edge. -/ + returnPath : + (TwoColorIncidenceGraph G (data.coloring i) gamma delta).Walk (Sum.inr edge) + (Sum.inl returnVertex) + returnPathIsPath : returnPath.IsPath + returnPathOnCycle : ∀ z ∈ returnPath.support, z ∈ cycle.walk.support + returnPathInternal : + ∀ v, Sum.inl v ∈ returnPath.support → v ∈ TreeSequenceVertexSet (data.tree i.succ) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RevisitingExtensionCertificateAppend.lean b/LeanPool/GoldbergSeymour/RevisitingExtensionCertificateAppend.lean new file mode 100644 index 0000000000..c7253ef8c7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/RevisitingExtensionCertificateAppend.lean @@ -0,0 +1,230 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.TashkinovSeriesDataAppend + +/-! +# Revisiting Extension Certificate Append + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem RevisitingExtensionCertificateAppend {V E : Type*} [Fintype V] [Fintype E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + (data : TashkinovSeriesData G k rounds e0) + (newTree : TreeSequence G e0) + (newColoring : PartialEdgeColoring E k) + (newStored : Finset (Fin k)) + (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) + (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)) + (i : Fin (rounds + 1)) : let appended := + (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma) + (∀ cert : RevisitingExtensionCertificate appended i.castSucc, + ∃ oldCert : RevisitingExtensionCertificate data i, + oldCert.gamma = cert.gamma ∧ oldCert.delta = cert.delta ∧ + oldCert.edge = cert.edge ∧ + oldCert.insideEndpoint = cert.insideEndpoint ∧ + oldCert.outsideEndpoint = cert.outsideEndpoint) ∧ + (∀ cert : RevisitingExtensionCertificate data i, + ∃ newCert : RevisitingExtensionCertificate appended i.castSucc, + newCert.gamma = cert.gamma ∧ newCert.delta = cert.delta ∧ + newCert.edge = cert.edge ∧ + newCert.insideEndpoint = cert.insideEndpoint ∧ + newCert.outsideEndpoint = cert.outsideEndpoint) := by + let appended := TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma + constructor + · intro cert + let oldEarlier : Fin (rounds + 1) := + ⟨cert.earlier.val, lt_of_le_of_lt cert.earlierAtMost i.isLt⟩ + have earlierEq : cert.earlier = oldEarlier.castSucc := by ext; rfl + let Package (phi : PartialEdgeColoring E k) + (earlierTree currentTree : TreeSequence G e0) : Prop := + ∃ cycle : TwoColorCycle G phi cert.gamma cert.delta, + (∃ v ∈ TreeSequenceVertexSet earlierTree, + Sum.inl v ∈ cycle.walk.support) ∧ + (∃ u ∉ TreeSequenceVertexSet currentTree, + Sum.inl u ∈ cycle.walk.support) ∧ + Sum.inr cert.edge ∈ cycle.walk.support ∧ + cert.edge ∈ BoundaryEdges G (TreeSequenceVertexSet currentTree) ∧ + cert.insideEndpoint ∈ TreeSequenceVertexSet currentTree ∧ + cert.outsideEndpoint ∉ TreeSequenceVertexSet currentTree ∧ + cert.returnVertex ∈ TreeSequenceVertexSet earlierTree ∧ + ∃ returnPath : (TwoColorIncidenceGraph G phi cert.gamma cert.delta).Walk + (Sum.inr cert.edge) (Sum.inl cert.returnVertex), + returnPath.IsPath ∧ + (∀ z ∈ returnPath.support, z ∈ cycle.walk.support) ∧ + (∀ v, Sum.inl v ∈ returnPath.support → + v ∈ TreeSequenceVertexSet currentTree) + have newPackage : Package (appended.coloring i.castSucc) + (appended.tree cert.earlier.castSucc) + (appended.tree i.castSucc.succ) := by + exact ⟨cert.cycle, cert.meetsEarlier, cert.leavesCurrent, + cert.edgeOnCycle, cert.edgeBoundary, cert.insideInCurrent, + cert.outsideNotCurrent, cert.returnInEarlier, cert.returnPath, + cert.returnPathIsPath, cert.returnPathOnCycle, cert.returnPathInternal⟩ + have colorEq : appended.coloring i.castSucc = data.coloring i := by + simp [appended, TashkinovSeriesDataAppend] + have earlierTreeEq : appended.tree cert.earlier.castSucc = + data.tree oldEarlier.castSucc := by + simp [appended, TashkinovSeriesDataAppend, earlierEq] + have currentIndexEq : i.castSucc.succ = i.succ.castSucc := by ext; rfl + have currentTreeEq : appended.tree i.castSucc.succ = data.tree i.succ := by + calc + appended.tree i.castSucc.succ = appended.tree i.succ.castSucc := + congrArg appended.tree currentIndexEq + _ = data.tree i.succ := by + simp only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + have oldPackage : Package (data.coloring i) + (data.tree oldEarlier.castSucc) (data.tree i.succ) := by + rw [← colorEq, ← earlierTreeEq, ← currentTreeEq] + exact newPackage + rcases oldPackage with ⟨cycle, meetsEarlier, leavesCurrent, edgeOnCycle, + edgeBoundary, insideInCurrent, outsideNotCurrent, returnInEarlier, + returnPath, returnPathIsPath, returnPathOnCycle, returnPathInternal⟩ + refine ⟨{ + earlier := oldEarlier + earlierPositive := cert.earlierPositive + earlierAtMost := cert.earlierAtMost + earlierPE := ?_ + interveningRevisiting := ?_ + gamma := cert.gamma + delta := cert.delta + earlierGamma := ?_ + earlierDelta := ?_ + cycle := cycle + meetsEarlier := meetsEarlier + leavesCurrent := leavesCurrent + edge := cert.edge + edgeOnCycle := edgeOnCycle + edgeBoundary := edgeBoundary + insideEndpoint := cert.insideEndpoint + outsideEndpoint := cert.outsideEndpoint + insideInCurrent := insideInCurrent + outsideNotCurrent := outsideNotCurrent + edgeEnds := cert.edgeEnds + returnVertex := cert.returnVertex + returnInEarlier := returnInEarlier + returnPath := returnPath + returnPathIsPath := returnPathIsPath + returnPathOnCycle := returnPathOnCycle + returnPathInternal := returnPathInternal + }, ?_, ?_, ?_, ?_, ?_⟩ + · simpa [appended, TashkinovSeriesDataAppend, earlierEq] using cert.earlierPE + · intro j hjpos hjafter hjle + simpa [appended, TashkinovSeriesDataAppend] using + cert.interveningRevisiting j.castSucc hjpos hjafter hjle + · simpa [appended, TashkinovSeriesDataAppend, earlierEq] using cert.earlierGamma + · simpa [appended, TashkinovSeriesDataAppend, earlierEq] using cert.earlierDelta + · rfl + · rfl + · rfl + · rfl + · rfl + · intro cert + let Package (phi : PartialEdgeColoring E k) + (earlierTree currentTree : TreeSequence G e0) : Prop := + ∃ cycle : TwoColorCycle G phi cert.gamma cert.delta, + (∃ v ∈ TreeSequenceVertexSet earlierTree, + Sum.inl v ∈ cycle.walk.support) ∧ + (∃ u ∉ TreeSequenceVertexSet currentTree, + Sum.inl u ∈ cycle.walk.support) ∧ + Sum.inr cert.edge ∈ cycle.walk.support ∧ + cert.edge ∈ BoundaryEdges G (TreeSequenceVertexSet currentTree) ∧ + cert.insideEndpoint ∈ TreeSequenceVertexSet currentTree ∧ + cert.outsideEndpoint ∉ TreeSequenceVertexSet currentTree ∧ + cert.returnVertex ∈ TreeSequenceVertexSet earlierTree ∧ + ∃ returnPath : (TwoColorIncidenceGraph G phi cert.gamma cert.delta).Walk + (Sum.inr cert.edge) (Sum.inl cert.returnVertex), + returnPath.IsPath ∧ + (∀ z ∈ returnPath.support, z ∈ cycle.walk.support) ∧ + (∀ v, Sum.inl v ∈ returnPath.support → + v ∈ TreeSequenceVertexSet currentTree) + have oldPackage : Package (data.coloring i) + (data.tree cert.earlier.castSucc) (data.tree i.succ) := by + exact ⟨cert.cycle, cert.meetsEarlier, cert.leavesCurrent, + cert.edgeOnCycle, cert.edgeBoundary, cert.insideInCurrent, + cert.outsideNotCurrent, cert.returnInEarlier, cert.returnPath, + cert.returnPathIsPath, cert.returnPathOnCycle, cert.returnPathInternal⟩ + have colorEq : appended.coloring i.castSucc = data.coloring i := by + simp [appended, TashkinovSeriesDataAppend] + have earlierTreeEq : appended.tree cert.earlier.castSucc.castSucc = + data.tree cert.earlier.castSucc := by + simp [appended, TashkinovSeriesDataAppend] + have currentIndexEq : i.castSucc.succ = i.succ.castSucc := by ext; rfl + have currentTreeEq : appended.tree i.castSucc.succ = data.tree i.succ := by + calc + appended.tree i.castSucc.succ = appended.tree i.succ.castSucc := + congrArg appended.tree currentIndexEq + _ = data.tree i.succ := by + simp only [appended, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + have newPackage : Package (appended.coloring i.castSucc) + (appended.tree cert.earlier.castSucc.castSucc) + (appended.tree i.castSucc.succ) := by + rw [colorEq, earlierTreeEq, currentTreeEq] + exact oldPackage + rcases newPackage with ⟨cycle, meetsEarlier, leavesCurrent, edgeOnCycle, + edgeBoundary, insideInCurrent, outsideNotCurrent, returnInEarlier, + returnPath, returnPathIsPath, returnPathOnCycle, returnPathInternal⟩ + refine ⟨{ + earlier := cert.earlier.castSucc + earlierPositive := cert.earlierPositive + earlierAtMost := cert.earlierAtMost + earlierPE := ?_ + interveningRevisiting := ?_ + gamma := cert.gamma + delta := cert.delta + earlierGamma := ?_ + earlierDelta := ?_ + cycle := cycle + meetsEarlier := meetsEarlier + leavesCurrent := leavesCurrent + edge := cert.edge + edgeOnCycle := edgeOnCycle + edgeBoundary := edgeBoundary + insideEndpoint := cert.insideEndpoint + outsideEndpoint := cert.outsideEndpoint + insideInCurrent := insideInCurrent + outsideNotCurrent := outsideNotCurrent + edgeEnds := cert.edgeEnds + returnVertex := cert.returnVertex + returnInEarlier := returnInEarlier + returnPath := returnPath + returnPathIsPath := returnPathIsPath + returnPathOnCycle := returnPathOnCycle + returnPathInternal := returnPathInternal + }, ?_, ?_, ?_, ?_, ?_⟩ + · simpa [appended, TashkinovSeriesDataAppend] using cert.earlierPE + · intro j hjpos hjafter hjle + let oldJ : Fin (rounds + 1) := ⟨j.val, lt_of_le_of_lt hjle i.isLt⟩ + have jEq : j = oldJ.castSucc := by ext; rfl + simpa [appended, TashkinovSeriesDataAppend, jEq] using + cert.interveningRevisiting oldJ hjpos hjafter hjle + · simpa [appended, TashkinovSeriesDataAppend] using cert.earlierGamma + · simpa [appended, TashkinovSeriesDataAppend] using cert.earlierDelta + · rfl + · rfl + · rfl + · rfl + · rfl + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RevisitingExtensionSeedStoredColor.lean b/LeanPool/GoldbergSeymour/RevisitingExtensionSeedStoredColor.lean new file mode 100644 index 0000000000..cf89aaf44b --- /dev/null +++ b/LeanPool/GoldbergSeymour/RevisitingExtensionSeedStoredColor.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep + +/-! +# Revisiting Extension Seed Stored Color + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem RevisitingExtensionSeedStoredColor {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) + (j : Fin (rounds + 1)) + (hstep : TashkinovSeriesStep G k rounds e0 input data j) + (hkind : data.kind j = some TashkinovExtensionKind.RE) + (f : E) (hedges : data.connectingEdges j = {f}) + (beta : Fin k) (hcolor : data.coloring j f = some beta) : + beta ∈ TashkinovStoredColors data j := by + classical + generalize hj : j = j' at hstep hkind hedges hcolor ⊢ + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + rw [initialKind] at hkind + simp at hkind + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentKind] at hkind + simp at hkind + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + rw [currentKind] at hkind + simp at hkind + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hf : f = available.edge := by + have hm : f ∈ data.connectingEdges i.succ := by + rw [hedges] + simp + rw [currentEdges] at hm + simpa using hm + subst f + have hpathNonempty : ¬ available.returnPath.Nil := by + intro hnil + have hzero : available.returnPath.length = 0 := + SimpleGraph.Walk.length_eq_zero_iff.mpr hnil + have heq := available.returnPath.eq_of_length_eq_zero hzero + exact Sum.inr_ne_inl heq + have hadj := available.returnPath.adj_snd hpathNonempty + have hedgeColor : data.coloring i.castSucc available.edge = + some available.gamma ∨ + data.coloring i.castSucc available.edge = some available.delta := by + cases hsnd : available.returnPath.snd with + | inl v => + rw [hsnd] at hadj + exact hadj.2 + | inr g => + rw [hsnd] at hadj + simp [TwoColorIncidenceGraph] at hadj + have hbeta : beta = available.gamma ∨ beta = available.delta := by + rw [currentColoring] at hcolor + rcases hedgeColor with hgamma | hdelta + · exact Or.inl (Option.some.inj (hcolor.symm.trans hgamma)) + · exact Or.inr (Option.some.inj (hcolor.symm.trans hdelta)) + have hnotTree : beta ∉ TreeMissingColors + (data.coloring i.succ) (data.tree i.succ.castSucc) := by + intro hmissing + simp only [TreeMissingColors, Finset.mem_biUnion] at hmissing + rcases hmissing with ⟨v, hv, hvmissing⟩ + apply previousClosed available.edgeBoundary hv + · rw [currentColoring] at hcolor + exact hcolor + · rw [currentColoring] at hvmissing + exact hvmissing + unfold TashkinovStoredColors + simp only [Fin.val_succ, Nat.succ_ne_zero, ↓reduceIte, + Finset.mem_sdiff, Finset.mem_biUnion, Finset.mem_univ, true_and] + refine ⟨⟨i.succ, ?_⟩, hnotTree⟩ + rcases hbeta with hbeta | hbeta <;> + simp [Fin.val_succ, currentStored, hbeta] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean b/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean new file mode 100644 index 0000000000..535b8515d4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean @@ -0,0 +1,3677 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ + +module + +public import LeanPool.GoldbergSeymour.Basic2 +public import LeanPool.GoldbergSeymour.TdEarlierPEWitnessIdentification +public import LeanPool.GoldbergSeymour.TdReplacementPrefixExact +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveEdge +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtensionBase +public import LeanPool.GoldbergSeymour.ExtensionRules +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovClosureExists +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesAppend +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Preparation for a revisiting terminal rebuild + +Supporting material for the Goldberg–Seymour revisiting construction. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +-/ + +@[expose] public section + +namespace GoldbergSeymour.TerminalRebuild + +open scoped Sym2 + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch4795Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (hlower : + LowerRoundInductionHypothesis G k e0 ett.rounds) (sigma : PartialEdgeColoring E k) + (hsigmaProper : IsProperEdgeColoring G sigma) (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma) (Tstar : TreeSequence G e0) (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (fstar : E) (seed : TreeSequence G e0) (hfinalEdges : ett.series.data.connectingEdges + (Fin.last ett.rounds) = ({ fstar } : Finset E)) (hadjoin : TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar seed) (closureTree : + TreeSequence G e0) (hseedClosure : TashkinovClosure sigma seed closureTree) (hTstarClosure + : TreeSequenceInitialSegment Tstar closureTree) (hTnClosure : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) ( + by omega + )⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) (hqCast : q.castSucc = (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (adjoined : TreeSequence G e0) (previousProper : + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc))) (available : RevisitingExtensionCertificate + ett.series.data q.castSucc) (currentStored : ett.series.data.stored q.succ = (insert + available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k))) (currentEdges : + ett.series.data.connectingEdges q.succ = ({ available.edge } : Finset E)) (currentKind : + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE) (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree q.succ.castSucc) available.edge adjoined) + (hsigmaPrevStable : StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) sigma) (hroundLarge : (1 : ℕ) < ett.rounds) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hprefixTrees : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by omega + ) i)) (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by omega + ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (hcorrFinalTree : + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc) (hcorrFinalColor : + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigma) (hcorrMP : + MaximumProperty corr.replacementETT) (earlierPrefixBound : (↑available.earlier : ℕ) < + originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := (⟨(↑available.earlier : ℕ), + earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ (hearlierMap : Fin.castLE ( + by omega + ) earlierPrefix = available.earlier) (hearlierPositive : (0 : ℕ) < (↑earlierPrefix : ℕ)) + (hreplacementEarlierKind : corr.replacementSeries.data.kind earlierPrefix = some + TashkinovExtensionKind.PE) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G + e0 (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (oldGammaRule + : ParallelExtensionColor ett.series.data oldi.castSucc oldChoice.selected oldChoice.vertex + oldGamma) (oldSecond : PartialEdgeColoring E k) (oldSecondProper : IsProperEdgeColoring G + oldSecond) (oldSecondStable : StableColoring (ett.series.data.tree oldi.succ.castSucc) + (insert oldChoice.color (TashkinovStoredColors ett.series.data oldi.castSucc) : Finset + (Fin k)) oldChoice.selected oldSecond) (oldCurrentColoring : ett.series.data.coloring + oldi.succ = TwoColorComponentSwap G oldSecond oldGamma oldChoice.color (Sum.inl + oldChoice.vertex)) (oldCurrentStored : ett.series.data.stored oldi.succ = (insert + oldChoice.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k))) (oldCurrentEdges : + ett.series.data.connectingEdges oldi.succ = ({ oldChoice.edge } : Finset E)) + (oldCurrentDelta : ett.series.data.delta oldi.succ = some oldChoice.color) + (oldCurrentGamma : ett.series.data.gamma oldi.succ = some oldGamma) (holdTarget : + available.earlier = oldi.succ) (holdIndex : oldi.succ = available.earlier) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (newGammaRule : ParallelExtensionColor + corr.replacementSeries.data newi.castSucc newChoice.selected newChoice.vertex newGamma) + (newSecond : PartialEdgeColoring E k) (newSecondProper : IsProperEdgeColoring G newSecond) + (newSecondStable : StableColoring (corr.replacementSeries.data.tree newi.succ.castSucc) + (insert newChoice.color (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + : Finset (Fin k)) newChoice.selected newSecond) (newExit : TreeExit + (corr.replacementSeries.data.tree newi.succ.castSucc) newSecond newGamma newChoice.color + newChoice.vertex) (newCurrentColoring : corr.replacementSeries.data.coloring newi.succ = + TwoColorComponentSwap G newSecond newGamma newChoice.color (Sum.inl newChoice.vertex)) + (newCurrentStored : corr.replacementSeries.data.stored newi.succ = (insert newChoice.color + ({ newGamma } : Finset (Fin k)) : Finset (Fin k))) (newCurrentEdges : + corr.replacementSeries.data.connectingEdges newi.succ = ({ newChoice.edge } : Finset E)) + (newCurrentDelta : corr.replacementSeries.data.delta newi.succ = some newChoice.color) + (newCurrentGamma : corr.replacementSeries.data.gamma newi.succ = some newGamma) + (hnewTarget : earlierPrefix = newi.succ), Nonempty (CorrespondingExtendedTashkinovTree G k + e0 ett sigma Tstar) + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch5611Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (hlower : + LowerRoundInductionHypothesis G k e0 ett.rounds) (sigma : PartialEdgeColoring E k) + (hsigmaProper : IsProperEdgeColoring G sigma) (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma) (Tstar : TreeSequence G e0) (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (fstar : E) (seed : TreeSequence G e0) (hfinalEdges : ett.series.data.connectingEdges + (Fin.last ett.rounds) = ({ fstar } : Finset E)) (hadjoin : TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar seed) (closureTree : + TreeSequence G e0) (hseedClosure : TashkinovClosure sigma seed closureTree) (hTstarClosure + : TreeSequenceInitialSegment Tstar closureTree) (hTnClosure : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) ( + by omega + )⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) (hqCast : q.castSucc = (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (adjoined : TreeSequence G e0) (previousProper : + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc))) (available : RevisitingExtensionCertificate + ett.series.data q.castSucc) (currentStored : ett.series.data.stored q.succ = (insert + available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k))) (currentEdges : + ett.series.data.connectingEdges q.succ = ({ available.edge } : Finset E)) (currentKind : + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE) (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree q.succ.castSucc) available.edge adjoined) + (hsigmaPrevStable : StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) sigma) (hpositivePrefix : (1 : ℕ) < ett.rounds ∧ + ∃ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix ∧ ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by omega + ) i)) ∧ ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by omega + ) i)) ∧ + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)), corr.replacementSeries.data.tree (Fin.last + (originalPrefix.rounds + (1 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigma ∧ + MaximumProperty corr.replacementETT), Nonempty (CorrespondingExtendedTashkinovTree G k e0 + ett sigma Tstar) + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperReturnPathOnCycle4421Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_3 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigma available.gamma + available.delta; + ∀ (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl + available.returnVertex) := available.returnPath.transfer sigmaReturnGraph + returnEdgeTransfer; + ∀ (replacementCycle : TwoColorCycle G sigma available.gamma available.delta) + (hreplacementColor : corr.replacementSeries.data.coloring replacementLast = sigma), + let castReturnWalk : (phi psi : PartialEdgeColoring E k) → (hphi : phi = psi) → (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk (Sum.inr + available.edge) (Sum.inl available.returnVertex)) → (TwoColorIncidenceGraph G phi + available.gamma available.delta).Walk (Sum.inr available.edge) (Sum.inl + available.returnVertex) := fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk (Sum.inr + available.edge) (Sum.inl available.returnVertex)) ↦ @Eq.ndrec (PartialEdgeColoring E k) + phi (fun (psi : PartialEdgeColoring E k) ↦ (P : @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k psi (@RevisitingExtensionCertificate.gamma V E inst + inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V + E inst inst_1 inst_3 G k e0 input T generating ett) e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating ett)) + (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available) (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available)) (@Sum.inr V E (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available)) (@Sum.inl V E (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G + k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available))) → @SimpleGraph.Walk (Sum V E) (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_3 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_3 G k e0 input T generating ett) q) available) (@RevisitingExtensionCertificate.delta + V E inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available)) (@Sum.inr V E (@RevisitingExtensionCertificate.edge V E + inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available)) (@Sum.inl V E (@RevisitingExtensionCertificate.returnVertex + V E inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available))) (fun (P : @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi (@RevisitingExtensionCertificate.gamma V E inst + inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V + E inst inst_1 inst_3 G k e0 input T generating ett) e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating ett)) + (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available) (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available)) (@Sum.inr V E (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available)) (@Sum.inl V E (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G + k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available))) ↦ P) psi hphi P; + ∀ (castReturnWalkSupport : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) (P : (TwoColorIncidenceGraph G psi + available.gamma available.delta).Walk (Sum.inr available.edge) (Sum.inl + available.returnVertex)) (z : V ⊕ E), z ∈ (castReturnWalk phi psi hphi P).support ↔ z ∈ + P.support), + let castCycle : (phi psi : PartialEdgeColoring E k) → (hphi : phi = psi) → (C : TwoColorCycle + G psi available.gamma available.delta) → TwoColorCycle G phi available.gamma + available.delta := fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) (C : + TwoColorCycle G psi available.gamma available.delta) ↦ @Eq.ndrec (PartialEdgeColoring E k) + phi (fun (psi : PartialEdgeColoring E k) ↦ (C : @TwoColorCycle V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_3 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_3 G k e0 input T generating ett) q) available) (@RevisitingExtensionCertificate.delta + V E inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available)) → @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_3 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_3 G k e0 input T generating ett) q) available) (@RevisitingExtensionCertificate.delta + V E inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available)) (fun (C : @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_3 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_3 G k e0 input T generating ett) q) available) (@RevisitingExtensionCertificate.delta + V E inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available)) ↦ C) psi hphi C; + ∀ (castCycleSupport : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) (C : TwoColorCycle G psi + available.gamma available.delta) (z : V ⊕ E), z ∈ (castCycle phi psi hphi C).walk.support + ↔ z ∈ C.walk.support), + let replacementCycleForPrefix : TwoColorCycle G (corr.replacementSeries.data.coloring + replacementLast) available.gamma available.delta := castCycle + (corr.replacementSeries.data.coloring replacementLast) sigma hreplacementColor + replacementCycle; + let replacementReturnPath : (TwoColorIncidenceGraph G (corr.replacementSeries.data.coloring + replacementLast) available.gamma available.delta).Walk (Sum.inr available.edge) (Sum.inl + available.returnVertex) := castReturnWalk (corr.replacementSeries.data.coloring + replacementLast) sigma hreplacementColor sigmaReturnPath; + ∀ (hsigmaPathOnCycle : + ∀ z ∈ sigmaReturnPath.support, z ∈ replacementCycle.walk.support), + ∀ z ∈ replacementReturnPath.support, z ∈ replacementCycleForPrefix.walk.support + +/-- Typed data construction shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev transportDefectiveChoice {V E : Type*} [Fintype V] [Fintype E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} {A B : TreeSequence G e0} (equality : A = B) {colors : Finset (Fin k)} + {coloring : PartialEdgeColoring E k} (choice : MaximumDefectiveChoice G e0 A colors coloring) : + MaximumDefectiveChoice G e0 B colors coloring := + equality ▸ choice + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev returnPathInternalStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_3 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigma available.gamma + available.delta; + ∀ (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl + available.returnVertex) := available.returnPath.transfer sigmaReturnGraph + returnEdgeTransfer; + ∀ (_ : + ∀ (z : V ⊕ E), z ∈ sigmaReturnPath.support ↔ z ∈ available.returnPath.support) (_ : + have replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc) (_ : ett.series.data.tree + q.castSucc.succ = ett.series.data.tree (Fin.last ett.rounds).castSucc) (hreplacementColor + : corr.replacementSeries.data.coloring replacementLast = sigma), + let castReturnWalk : (phi psi : PartialEdgeColoring E k) → (hphi : phi = psi) → (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk (Sum.inr + available.edge) (Sum.inl available.returnVertex)) → (TwoColorIncidenceGraph G phi + available.gamma available.delta).Walk (Sum.inr available.edge) (Sum.inl + available.returnVertex) := fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk (Sum.inr + available.edge) (Sum.inl available.returnVertex)) ↦ @Eq.ndrec (PartialEdgeColoring E k) + phi (fun (psi : PartialEdgeColoring E k) ↦ (P : @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k psi (@RevisitingExtensionCertificate.gamma V E inst + inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V + E inst inst_1 inst_3 G k e0 input T generating ett) e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating ett)) + (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available) (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available)) (@Sum.inr V E (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available)) (@Sum.inl V E (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G + k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available))) → @SimpleGraph.Walk (Sum V E) (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_3 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_3 G k e0 input T generating ett) q) available) (@RevisitingExtensionCertificate.delta + V E inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available)) (@Sum.inr V E (@RevisitingExtensionCertificate.edge V E + inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available)) (@Sum.inl V E (@RevisitingExtensionCertificate.returnVertex + V E inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available))) (fun (P : @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi (@RevisitingExtensionCertificate.gamma V E inst + inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V + E inst inst_1 inst_3 G k e0 input T generating ett) e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating ett)) + (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available) (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available)) (@Sum.inr V E (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available)) (@Sum.inl V E (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G + k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_3 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_3 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) q) + available))) ↦ P) psi hphi P; + ∀ (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) (P : (TwoColorIncidenceGraph G psi + available.gamma available.delta).Walk (Sum.inr available.edge) (Sum.inl + available.returnVertex)) (z : V ⊕ E), z ∈ (castReturnWalk phi psi hphi P).support ↔ z ∈ + P.support), + let replacementReturnPath : (TwoColorIncidenceGraph G (corr.replacementSeries.data.coloring + replacementLast) available.gamma available.delta).Walk (Sum.inr available.edge) (Sum.inl + available.returnVertex) := castReturnWalk (corr.replacementSeries.data.coloring + replacementLast) sigma hreplacementColor sigmaReturnPath; + ∀ (v : V), Sum.inl v ∈ replacementReturnPath.support → v ∈ TreeSequenceVertexSet + (corr.replacementSeries.data.tree replacementLast.succ) + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperCaseContinuation2517Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G + k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) Tstar → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length + < Tstar.length → + ∀ (fstar : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last + ett.rounds) = ({ fstar } : Finset E) → TreeSequenceAdjoinEdge (ett.series.data.tree + (Fin.last ett.rounds).castSucc) fstar seed → + ∀ (closureTree : TreeSequence G e0), TashkinovClosure sigma seed closureTree → + TreeSequenceInitialSegment Tstar closureTree → TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) ( + by omega + )⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → q.castSucc = (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))) → + ∀ (adjoined : TreeSequence G e0), IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) + → IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + ett.series.data.stored q.succ = (insert available.delta ({ available.gamma } : Finset (Fin + k)) : Finset (Fin k)) → ett.series.data.connectingEdges q.succ = ({ available.edge } : + Finset E) → ett.series.data.kind q.succ = some TashkinovExtensionKind.RE → + TreeSequenceAdjoinEdge (ett.series.data.tree q.succ.castSucc) available.edge adjoined → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) sigma → + ∀ (hroundLarge : (1 : ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by omega + ) i)) → ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)), corr.replacementSeries.data.tree (Fin.last + (originalPrefix.rounds + (1 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc → + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigma → + MaximumProperty corr.replacementETT → + ∀ (earlierPrefixBound : (↑available.earlier : ℕ) < originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := (⟨(↑available.earlier : ℕ), + earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); Fin.castLE ( + by omega + ) earlierPrefix = available.earlier → (0 : ℕ) < (↑earlierPrefix : ℕ) → + corr.replacementSeries.data.kind earlierPrefix = some TashkinovExtensionKind.PE → + ∀ (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + oldi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (oldSecond : + PartialEdgeColoring E k), ett.series.data.coloring oldi.succ = TwoColorComponentSwap G + oldSecond oldGamma oldChoice.color (Sum.inl oldChoice.vertex) → ett.series.data.stored + oldi.succ = (insert oldChoice.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.delta oldi.succ = some oldChoice.color → ett.series.data.gamma oldi.succ = + some oldGamma → available.earlier = oldi.succ → oldi.succ = available.earlier → + ∀ (newi : Fin originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k), ParallelExtensionColor corr.replacementSeries.data + newi.castSucc newChoice.selected newChoice.vertex newGamma → + ∀ (newSecond : PartialEdgeColoring E k), IsProperEdgeColoring G newSecond → StableColoring + (corr.replacementSeries.data.tree newi.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) : Finset (Fin k)) + newChoice.selected newSecond → TreeExit (corr.replacementSeries.data.tree + newi.succ.castSucc) newSecond newGamma newChoice.color newChoice.vertex → + corr.replacementSeries.data.coloring newi.succ = TwoColorComponentSwap G newSecond + newGamma newChoice.color (Sum.inl newChoice.vertex) → corr.replacementSeries.data.delta + newi.succ = some newChoice.color → corr.replacementSeries.data.gamma newi.succ = some + newGamma → earlierPrefix = newi.succ → newi.succ = earlierPrefix → + ∀ (htree : corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; oldChoiceOnNew.vertex = oldChoice.vertex → oldChoiceOnNew.otherEndpoint = + oldChoice.otherEndpoint → oldChoiceOnNew.color = oldChoice.color → + ({ oldChoiceOnNew.edge } : Finset E) = ({ newChoice.edge } : Finset E) → (insert + oldChoiceOnNew.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k)) = (insert + newChoice.color ({ newGamma } : Finset (Fin k)) : Finset (Fin k)) → + s(oldChoiceOnNew.vertex, oldChoiceOnNew.otherEndpoint) = s(newChoice.vertex, + newChoice.otherEndpoint) → newChoice.vertex = oldChoiceOnNew.vertex → ( + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch : + MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + IsProperEdgeColoring G second → StableColoring X (insert ch.color C : Finset (Fin k)) + ch.selected second → g ∈ MissingColors G ch.selected ch.vertex → + let post : PartialEdgeColoring E k := TwoColorComponentSwap G second g ch.color (Sum.inl + ch.vertex); ch.color ∈ MissingColors G post ch.vertex ∧ g ∉ MissingColors G post ch.vertex + ∧ g ≠ ch.color) → oldChoice.color ∈ MissingColors G (TwoColorComponentSwap G oldSecond + oldGamma oldChoice.color (Sum.inl oldChoice.vertex)) oldChoice.vertex → oldGamma ∉ + MissingColors G (TwoColorComponentSwap G oldSecond oldGamma oldChoice.color (Sum.inl + oldChoice.vertex)) oldChoice.vertex → oldGamma ≠ oldChoice.color → Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation2808Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (hlower : + LowerRoundInductionHypothesis G k e0 ett.rounds) (sigma : PartialEdgeColoring E k) + (hsigmaProper : IsProperEdgeColoring G sigma) (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma) (Tstar : TreeSequence G e0) (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (fstar : E) (seed : TreeSequence G e0) (hfinalEdges : ett.series.data.connectingEdges + (Fin.last ett.rounds) = ({ fstar } : Finset E)) (hadjoin : TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar seed) (closureTree : + TreeSequence G e0) (hseedClosure : TashkinovClosure sigma seed closureTree) (hTstarClosure + : TreeSequenceInitialSegment Tstar closureTree) (hTnClosure : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) ( + by omega + )⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) (hqCast : q.castSucc = (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (adjoined : TreeSequence G e0) (previousProper : + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc))) (available : RevisitingExtensionCertificate + ett.series.data q.castSucc) (currentStored : ett.series.data.stored q.succ = (insert + available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k))) (currentEdges : + ett.series.data.connectingEdges q.succ = ({ available.edge } : Finset E)) (currentKind : + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE) (adjoinedExactly : + TreeSequenceAdjoinEdge (ett.series.data.tree q.succ.castSucc) available.edge adjoined) + (hsigmaPrevStable : StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) sigma) (hroundLarge : (1 : ℕ) < ett.rounds) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hprefixTrees : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by omega + ) i)) (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by omega + ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (hcorrFinalTree : + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc) (hcorrFinalColor : + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigma) (hcorrMP : + MaximumProperty corr.replacementETT) (earlierPrefixBound : (↑available.earlier : ℕ) < + originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := (⟨(↑available.earlier : ℕ), + earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ (hearlierMap : Fin.castLE ( + by omega + ) earlierPrefix = available.earlier) (hearlierPositive : (0 : ℕ) < (↑earlierPrefix : ℕ)) + (hreplacementEarlierKind : corr.replacementSeries.data.kind earlierPrefix = some + TashkinovExtensionKind.PE) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G + e0 (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) + (oldCurrentStored : ett.series.data.stored oldi.succ = (insert oldChoice.color + ({ oldGamma } : Finset (Fin k)) : Finset (Fin k))) (holdTarget : available.earlier = + oldi.succ) (holdIndex : oldi.succ = available.earlier) (newi : Fin originalPrefix.rounds) + (newChoice : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (newGamma : Fin k) (newGammaRule : + ParallelExtensionColor corr.replacementSeries.data newi.castSucc newChoice.selected + newChoice.vertex newGamma) (newSecond : PartialEdgeColoring E k) (newSecondProper : + IsProperEdgeColoring G newSecond) (newSecondStable : StableColoring + (corr.replacementSeries.data.tree newi.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) : Finset (Fin k)) + newChoice.selected newSecond) (newExit : TreeExit (corr.replacementSeries.data.tree + newi.succ.castSucc) newSecond newGamma newChoice.color newChoice.vertex) + (newCurrentColoring : corr.replacementSeries.data.coloring newi.succ = + TwoColorComponentSwap G newSecond newGamma newChoice.color (Sum.inl newChoice.vertex)) + (newCurrentDelta : corr.replacementSeries.data.delta newi.succ = some newChoice.color) + (newCurrentGamma : corr.replacementSeries.data.gamma newi.succ = some newGamma) + (hnewTarget : earlierPrefix = newi.succ) (hnewIndex : newi.succ = earlierPrefix) (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) (hends : s(oldChoiceOnNew.vertex, + oldChoiceOnNew.otherEndpoint) = s(newChoice.vertex, newChoice.otherEndpoint)) + (holdDeltaMissing : oldChoice.color ∈ MissingColors G (ett.series.data.coloring oldi.succ) + oldChoice.vertex) (holdColorNe : oldGamma ≠ oldChoice.color) (hnewDeltaMissing : + newChoice.color ∈ MissingColors G (corr.replacementSeries.data.coloring newi.succ) + newChoice.vertex) (hnewGammaNotMissing : newGamma ∉ MissingColors G + (corr.replacementSeries.data.coloring newi.succ) newChoice.vertex) (hnewColorNe : newGamma + ≠ newChoice.color) (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) (holdDeltaAvailable : oldChoice.color = + available.delta) (holdGammaAvailable : oldGamma = available.gamma) (hnewDeltaAvailable : + newChoice.color = available.delta) (hnewGammaAvailable : newGamma = available.gamma) + (hnewVertexOld : newChoice.vertex = oldChoice.vertex) (holdColorConstant : + ett.series.data.coloring q.castSucc = ett.series.data.coloring oldi.succ), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (hreplacementLastMap : Fin.castLE ( + by omega + ) replacementLast = q.castSucc) (hreplacementColorConstant : + corr.replacementSeries.data.coloring replacementLast = + corr.replacementSeries.data.coloring newi.succ), Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation3509Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (hlower : + LowerRoundInductionHypothesis G k e0 ett.rounds) (sigma : PartialEdgeColoring E k) + (hsigmaProper : IsProperEdgeColoring G sigma) (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma) (Tstar : TreeSequence G e0) (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (fstar : E) (seed : TreeSequence G e0) (hfinalEdges : ett.series.data.connectingEdges + (Fin.last ett.rounds) = ({ fstar } : Finset E)) (hadjoin : TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar seed) (closureTree : + TreeSequence G e0) (hseedClosure : TashkinovClosure sigma seed closureTree) (hTstarClosure + : TreeSequenceInitialSegment Tstar closureTree) (hTnClosure : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) ( + by omega + )⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) (hqCast : q.castSucc = (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (adjoined : TreeSequence G e0) (previousProper : + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc))) (available : RevisitingExtensionCertificate + ett.series.data q.castSucc) (currentStored : ett.series.data.stored q.succ = (insert + available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k))) (currentEdges : + ett.series.data.connectingEdges q.succ = ({ available.edge } : Finset E)) (currentKind : + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hprefixTrees : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by omega + ) i)) (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by omega + ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (hcorrFinalTree : + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc) (hcorrFinalColor : + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigma) (hcorrMP : + MaximumProperty corr.replacementETT) (earlierPrefixBound : (↑available.earlier : ℕ) < + originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := (⟨(↑available.earlier : ℕ), + earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ (hearlierMap : Fin.castLE ( + by omega + ) earlierPrefix = available.earlier) (hearlierPositive : (0 : ℕ) < (↑earlierPrefix : ℕ)) + (hreplacementEarlierKind : corr.replacementSeries.data.kind earlierPrefix = some + TashkinovExtensionKind.PE) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G + e0 (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (holdTarget : + available.earlier = oldi.succ) (holdIndex : oldi.succ = available.earlier) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (newGammaRule : ParallelExtensionColor + corr.replacementSeries.data newi.castSucc newChoice.selected newChoice.vertex newGamma) + (newSecond : PartialEdgeColoring E k) (newSecondProper : IsProperEdgeColoring G newSecond) + (newSecondStable : StableColoring (corr.replacementSeries.data.tree newi.succ.castSucc) + (insert newChoice.color (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + : Finset (Fin k)) newChoice.selected newSecond) (newExit : TreeExit + (corr.replacementSeries.data.tree newi.succ.castSucc) newSecond newGamma newChoice.color + newChoice.vertex) (newCurrentColoring : corr.replacementSeries.data.coloring newi.succ = + TwoColorComponentSwap G newSecond newGamma newChoice.color (Sum.inl newChoice.vertex)) + (newCurrentDelta : corr.replacementSeries.data.delta newi.succ = some newChoice.color) + (newCurrentGamma : corr.replacementSeries.data.gamma newi.succ = some newGamma) (hnewIndex + : newi.succ = earlierPrefix) (htree : corr.replacementSeries.data.tree newi.succ.castSucc + = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) (hends : s(oldChoiceOnNew.vertex, + oldChoiceOnNew.otherEndpoint) = s(newChoice.vertex, newChoice.otherEndpoint)) + (holdDeltaMissing : oldChoice.color ∈ MissingColors G (ett.series.data.coloring oldi.succ) + oldChoice.vertex) (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma ≠ + newChoice.color) (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) (holdDeltaAvailable : oldChoice.color = + available.delta) (holdGammaAvailable : oldGamma = available.gamma) (hnewDeltaAvailable : + newChoice.color = available.delta) (hnewGammaAvailable : newGamma = available.gamma) + (hnewVertexOld : newChoice.vertex = oldChoice.vertex) (holdColorConstant : + ett.series.data.coloring q.castSucc = ett.series.data.coloring oldi.succ), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (hreplacementLastMap : Fin.castLE ( + by omega + ) replacementLast = q.castSucc) (hnewPostSigma : corr.replacementSeries.data.coloring + newi.succ = sigma) (hnewDeltaSigma : available.delta ∈ MissingColors G sigma + newChoice.vertex) (hgammaDeltaNe : available.gamma ≠ available.delta) (hnewTreeFinal : + TreeSequenceInitialSegment (corr.replacementSeries.data.tree newi.succ.castSucc) + (corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))))) + (hnewVertexTn : newChoice.vertex ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc)) (hpathComponent : TwoColorNontrivialPathComponent G sigma + available.gamma available.delta (Sum.inl newChoice.vertex)) (hpathMeetsTn : + ∃ v ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc), Sum.inl v ∈ + TwoColorComponent G sigma available.gamma available.delta (Sum.inl newChoice.vertex)) + (hsigmaPrevStableQ : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigma) (hgammaEarlierStored : available.gamma ∈ ett.series.data.stored available.earlier) + (hdeltaEarlierStored : available.delta ∈ ett.series.data.stored available.earlier) + (colorControlAtQ : + ∀ (c : Fin k) (hc : c ∈ ett.series.data.stored available.earlier), c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.castSucc), Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperInterveningRevisiting4368Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqCast : q.castSucc = (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (available : RevisitingExtensionCertificate ett.series.data + q.castSucc) (hroundLarge : (1 : ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G + k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by omega + ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (earlierPrefixBound : + (↑available.earlier : ℕ) < originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := (⟨(↑available.earlier : ℕ), + earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ (hearlierMap : Fin.castLE ( + by omega + ) earlierPrefix = available.earlier) (oldi : Fin ett.rounds) (oldChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) (ett.series.data.coloring + oldi.castSucc)) (oldGamma : Fin k) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (newGamma : Fin k) (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) (holdColorNe : oldGamma ≠ + oldChoice.color) (hnewColorNe : newGamma ≠ newChoice.color) (hidentifiedDelta : + newChoice.color = oldChoiceOnNew.color) (hidentifiedGamma : newGamma = oldGamma) + (holdDeltaAvailable : oldChoice.color = available.delta) (holdGammaAvailable : oldGamma = + available.gamma), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (hreplacementLastMap : Fin.castLE ( + by omega + ) replacementLast = q.castSucc) (hgammaDeltaNe : available.gamma ≠ available.delta) + (replacementCycle : TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (firstOutsideNotOne : (↑firstOutside : ℕ) ≠ (1 : ℕ)) (firstOutsideAtLeastTwo : (2 : ℕ) ≤ + (↑firstOutside : ℕ)) (firstCrossingIndex : (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = + (↑firstOutside : ℕ)) (beforeFirstCrossingIndex : (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = + (↑firstOutside : ℕ) - (1 : ℕ)), + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({idx : Fin + (rootedCycle.length + (1 : ℕ)) | (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := laterInsideIndices.min' + laterInsideNonempty; + ∀ (hreturnNotNext : (↑firstReturn : ℕ) ≠ (↑firstOutside : ℕ) + (1 : ℕ)) (hreturnGap : + (↑firstOutside : ℕ) + (2 : ℕ) ≤ (↑firstReturn : ℕ)) (returnCrossingIndex : (↑firstReturn : + ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ)) (beforeReturnCrossingIndex : (↑firstReturn : + ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ) - (1 : ℕ)) (j : Fin (originalPrefix.rounds + + (1 : ℕ))), (0 : ℕ) < (↑j : ℕ) → (↑earlierPrefix : ℕ) < (↑j : ℕ) → (↑j : ℕ) ≤ + (↑replacementLast : ℕ) → corr.replacementSeries.data.kind j = some + TashkinovExtensionKind.RE + +theorem helper_hTnClosure_110.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + ∀ (closureTree : TreeSequence G e0), + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree := by + classical + intro V E _ _ _ G k e0 input T generating ett Tstar hTnTstar closureTree hTstarClosure + rcases hTnTstar with ⟨hlenAB, hvertexAB, hedgeAB⟩ + rcases hTstarClosure with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨Nat.le_trans hlenAB hlenBC, ?_, ?_⟩ + · intro j + calc + closureTree.vertex (Fin.castLE (Nat.succ_le_succ (Nat.le_trans hlenAB hlenBC)) j) = + closureTree.vertex + (Fin.castLE (Nat.succ_le_succ hlenBC) (Fin.castLE (Nat.succ_le_succ hlenAB) j)) := + by congr 1 + _ = Tstar.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) j) := hvertexBC _ + _ = (ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex j := hvertexAB j + · intro j + calc + closureTree.edge (Fin.castLE (Nat.le_trans hlenAB hlenBC) j) = + closureTree.edge (Fin.castLE hlenBC (Fin.castLE hlenAB j)) := + by congr 1 + _ = Tstar.edge (Fin.castLE hlenAB j) := hedgeBC _ + _ = (ett.series.data.tree (Fin.last ett.rounds).castSucc).edge j := hedgeAB j + +theorem helper_reStepColoring_588.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (adjoined : TreeSequence G e0) (available : RevisitingExtensionCertificate ett.series.data + q.castSucc), TreeSequenceAdjoinEdge (ett.series.data.tree q.succ.castSucc) available.edge + adjoined → (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (oldi : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (_ : Fin k) (newi : Fin + originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (_ : Fin k), + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + oldi.succ.castSucc → + ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 + input') (j : Fin rounds'), series.data.kind j.succ = some TashkinovExtensionKind.RE → + series.data.coloring j.succ = series.data.coloring j.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q adjoined available + adjoinedExactly hroundLarge originalPrefix hr corr oldi oldChoice oldGamma newi newChoice + newGamma htree rounds' input' series j hj + have hstep := series.certified j.succ + generalize hslot : j.succ = slot at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges initialKind initialVertex + initialOutside initialDelta initialGamma initialClosure => exact (Fin.succ_ne_zero j hslot).elim + | SE i prevProper prevOne prevClosed prevNotStrong noRE choice alternative coloring stored edges + kind vertex outside delta gamma adjoined adjoinedExactly closed ordered + strict => + have hbad := kind.symm.trans (by simpa [hslot] using hj) + cases hbad + | PE i prevProper prevOne prevClosed prevNotStrong noRE choice alternativeFails gamma gammaRule + second secondProper secondOne secondStable exit coloring coloringProper coloringOne stored edges + kind vertex outside delta gammaValue closed ordered + strict => + have hbad := kind.symm.trans (by simpa [hslot] using hj) + cases hbad + | RE i prevProper prevOne prevClosed prevNotStrong cert coloring stored edges kind vertex outside + delta gamma adjoined adjoinedExactly closed ordered + strict => + have hi : i = j := by + apply Fin.ext + have hv := congrArg Fin.val hslot + simp only [Fin.val_succ] at hv + omega + subst i + simpa [hslot] using coloring + +theorem helper_reIntervalColoring_625.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : RevisitingExtensionCertificate ett.series.data q.castSucc), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (oldi : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (_ : Fin k) (newi : Fin + originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (_ : Fin k), + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + oldi.succ.castSucc → ( + ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 + input') (j : Fin rounds'), series.data.kind j.succ = some TashkinovExtensionKind.RE → + series.data.coloring j.succ = series.data.coloring j.castSucc) → + ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 + input') (a b : Fin (rounds' + (1 : ℕ))), (↑a : ℕ) ≤ (↑b : ℕ) → ( + ∀ (j : Fin (rounds' + (1 : ℕ))), (↑a : ℕ) < (↑j : ℕ) → (↑j : ℕ) ≤ (↑b : ℕ) → series.data.kind + j = some TashkinovExtensionKind.RE) → series.data.coloring b = series.data.coloring a := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr oldi oldChoice oldGamma newi newChoice newGamma htree reStepColoring + rounds' input' series a b hab hbetween + have coloringAlong : + ∀ m : ℕ, a.val ≤ m → m ≤ b.val → + ∀ x : Fin (rounds' + 1), x.val = m → series.data.coloring x = series.data.coloring a := by + intro m ham + induction m, ham using Nat.le_induction with + | base => + intro hmb x hx + have hxa : x = a := by + apply Fin.ext + omega + rw [hxa] + | succ m ham ih => + intro hmb x hx + let j : Fin rounds' := + ⟨m, by + have hbLt := b.isLt + omega⟩ + have hjKind : series.data.kind j.succ = some TashkinovExtensionKind.RE := by + apply hbetween j.succ + · simp [j] + omega + · simp [j] + omega + have hstep := reStepColoring series j hjKind + have hxj : x = j.succ := by + apply Fin.ext + simp [j, hx] + calc + series.data.coloring x = series.data.coloring j.succ := by rw [hxj] + _ = series.data.coloring j.castSucc := hstep + _ = series.data.coloring a := ih (by omega) j.castSucc (by simp [j]) + exact coloringAlong b.val hab le_rfl b rfl + +theorem helper_holdColorConstant_669.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); q.castSucc = (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))) → + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), (1 : ℕ) < + ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (oldi : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (_ : Fin k), available.earlier = + oldi.succ → oldi.succ = available.earlier → + ∀ (newi : Fin originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (_ : Fin k), corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc → ( + ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 + input') (a b : Fin (rounds' + (1 : ℕ))), (↑a : ℕ) ≤ (↑b : ℕ) → ( + ∀ (j : Fin (rounds' + (1 : ℕ))), (↑a : ℕ) < (↑j : ℕ) → (↑j : ℕ) ≤ (↑b : ℕ) → series.data.kind + j = some TashkinovExtensionKind.RE) → series.data.coloring b = series.data.coloring a) → + ett.series.data.coloring q.castSucc = ett.series.data.coloring oldi.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q hqCast available hroundLarge + originalPrefix hr corr oldi oldChoice oldGamma holdTarget holdIndex newi newChoice newGamma + htree reIntervalColoring + apply reIntervalColoring ett.series oldi.succ q.castSucc + · have hvals := congrArg Fin.val holdIndex + have hle := available.earlierAtMost + simp only [Fin.val_succ] at hvals + omega + · intro j hjLower hjUpper + apply available.interveningRevisiting j + · have holdPositive := available.earlierPositive + have hvals := congrArg Fin.val holdIndex + simp only [Fin.val_succ] at hvals + omega + · have hvals := congrArg Fin.val holdIndex + simp only [Fin.val_succ] at hvals + omega + · exact hjUpper + +theorem helper_segmentTrans_778.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (A B C : TreeSequence G e0), + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + rcases hAB with ⟨hlenAB, hvertexAB, hedgeAB⟩ + rcases hBC with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨hlenAB.trans hlenBC, ?_, ?_⟩ + · intro x + calc + C.vertex (Fin.castLE (Nat.succ_le_succ (hlenAB.trans hlenBC)) x) = + C.vertex + (Fin.castLE (Nat.succ_le_succ hlenBC) (Fin.castLE (Nat.succ_le_succ hlenAB) x)) := + by congr 1 + _ = B.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) x) := hvertexBC _ + _ = A.vertex x := hvertexAB x + · intro x + calc + C.edge (Fin.castLE (hlenAB.trans hlenBC) x) = + C.edge (Fin.castLE hlenBC (Fin.castLE hlenAB x)) := + by congr 1 + _ = B.edge (Fin.castLE hlenAB x) := hedgeBC _ + _ = A.edge x := hedgeAB x + +theorem helper_oldReturnEdgeData_978.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + ¬available.returnPath.Nil → + ∀ (f : E), Sum.inr f ∈ available.returnPath.support → TreeIncidentEdge (ett.series.data.tree + q.succ.castSucc) f ∧ (ett.series.data.coloring q.castSucc f = some available.gamma ∨ + ett.series.data.coloring q.castSucc f = some available.delta) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q available hreturnNotNil f hf + obtain ⟨node, hnode, hadj⟩ := + SimpleGraph.adj_of_mem_walk_support available.returnPath hreturnNotNil hf + cases node with + | inl + v => + have hdata : + Incident G v f ∧ + (ett.series.data.coloring q.castSucc f = some available.gamma ∨ + ett.series.data.coloring q.castSucc f = some available.delta) := + by simpa [TwoColorIncidenceGraph] using hadj + exact ⟨⟨v, available.returnPathInternal v hnode, hdata.1⟩, hdata.2⟩ + | inr g => simp [TwoColorIncidenceGraph] at hadj + +theorem helper_returnEdgeTransfer_1018.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + (∀ (f : E), + Sum.inr f ∈ available.returnPath.support → + sigma f = ett.series.data.coloring q.castSucc f) → + let _ : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) available.gamma + available.delta; + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma available.gamma available.delta; + ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available copyReturnEdge + oldReturnGraph sigmaReturnGraph edge hedge + induction edge using Sym2.inductionOn with + | _ a b => + have haSupport := available.returnPath.fst_mem_support_of_mem_edges hedge + have hbSupport := available.returnPath.snd_mem_support_of_mem_edges hedge + have habOld : oldReturnGraph.Adj a b := by + simpa [oldReturnGraph] using available.returnPath.edges_subset_edgeSet hedge + cases a with + | inl v => + cases b with + | inl w => simp [oldReturnGraph, TwoColorIncidenceGraph] at habOld + | inr + f => + have hdata : + Incident G v f ∧ + (ett.series.data.coloring q.castSucc f = some available.gamma ∨ + ett.series.data.coloring q.castSucc f = some available.delta) := + by simpa [oldReturnGraph, TwoColorIncidenceGraph] using habOld + have hcopy := copyReturnEdge f hbSupport + simpa [sigmaReturnGraph, TwoColorIncidenceGraph, hcopy] using hdata + | inr f => + cases b with + | inl + v => + have hdata : + Incident G v f ∧ + (ett.series.data.coloring q.castSucc f = some available.gamma ∨ + ett.series.data.coloring q.castSucc f = some available.delta) := + by simpa [oldReturnGraph, TwoColorIncidenceGraph] using habOld + have hcopy := copyReturnEdge f haSupport + simpa [sigmaReturnGraph, TwoColorIncidenceGraph, hcopy] using hdata + | inr g => simp [oldReturnGraph, TwoColorIncidenceGraph] at habOld + +theorem helper_correspondingTerminalTree_1299.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (C : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + C.replacementETT.series.data.tree (Fin.last (C.replacementETT.rounds + (1 : ℕ))) = + C.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma originalPrefix C + rcases C with + ⟨replacementInput, replacementSeries, replacementETT, rungAgreement, seriesPresentation, + finalGeneratingColoring, ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below + generatingColoring => + cases rungAgreement + have hseries : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases hseries + rfl + +theorem helper_endpointIdentity_1568.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {f : E} {a b : V}, + Incident G a f → Incident G b f → a ≠ b → G.ends f = s(a, b) := by + classical + intro V E G f a b ha hb hab + have endsEq : ∀ {z : Sym2 V} {x y : V}, x ∈ z → y ∈ z → x ≠ y → z = s(x, y) := by + as_aux_lemma => + intro z x y hx hy hxy + induction z using Sym2.inductionOn with + | _ u v => + simp only [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl + · rcases hy with rfl | rfl + · exact (hxy rfl).elim + · rfl + · rcases hy with rfl | rfl + · exact Sym2.eq_swap + · exact (hxy rfl).elim + exact endsEq ha hb hab + +theorem helper_holdLeafDegree_1372.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)), available.gamma ≠ available.delta → available.delta ∈ MissingColors G + (ett.series.data.coloring q.castSucc) newChoice.vertex → (TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) available.gamma available.delta).degree (Sum.inl + newChoice.vertex) ≤ (1 : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q previousProper available + originalPrefix corr newi newChoice hgammaDeltaNe holdDeltaAtNewVertex + have hgraphSwapOrder : + TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) available.delta available.gamma = + TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) available.gamma + available.delta := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + rw [← hgraphSwapOrder] + simpa only [← SimpleGraph.card_neighborSet_eq_degree, Fintype.card_eq_nat_card] using + (MissingColorIncidenceEndpoint G (ett.series.data.coloring q.castSucc) available.delta + available.gamma hgammaDeltaNe.symm previousProper newChoice.vertex holdDeltaAtNewVertex) + +theorem helper_hreturnNeNew_1406.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)), ((TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) + available.gamma available.delta).neighborSet (Sum.inl newChoice.vertex)).Subsingleton → + available.returnVertex ≠ newChoice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available originalPrefix + corr newi newChoice holdLeaf heq + have hsupport : Sum.inl newChoice.vertex ∈ available.cycle.walk.support := by + rw [← heq] + apply available.returnPathOnCycle + simp + let rotated := available.cycle.walk.rotate (Sum.inl newChoice.vertex) hsupport + have hrotated : rotated.IsCycle := available.cycle.isCycle.rotate hsupport + have hfirst : + (TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) available.gamma + available.delta).Adj + (Sum.inl newChoice.vertex) rotated.snd := + rotated.adj_snd hrotated.not_nil + have hlast : + (TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) available.gamma + available.delta).Adj + (Sum.inl newChoice.vertex) rotated.penultimate := + (rotated.adj_penultimate hrotated.not_nil).symm + exact hrotated.snd_ne_penultimate (holdLeaf hfirst hlast) + +theorem helper_hswapGraph_1429.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (newSecond : PartialEdgeColoring E k), + TwoColorIncidenceGraph G (TwoColorComponentSwap G newSecond newGamma newChoice.color + (Sum.inl newChoice.vertex)) newGamma newChoice.color = TwoColorIncidenceGraph G newSecond + newGamma newChoice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma originalPrefix corr newi newChoice + newGamma newSecond + ext x y + cases x with + | inl v => + cases y with + | inl w => simp [TwoColorIncidenceGraph] + | inr + f => + by_cases hf : + Sum.inr f ∈ + TwoColorComponent G newSecond newGamma newChoice.color (Sum.inl newChoice.vertex) + · by_cases hfg : newSecond f = some newGamma + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf, hfg] + · by_cases hfd : newSecond f = some newChoice.color + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf, hfd] + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf, hfg, hfd] + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf] + | inr f => + cases y with + | inl + v => + by_cases hf : + Sum.inr f ∈ + TwoColorComponent G newSecond newGamma newChoice.color (Sum.inl newChoice.vertex) + · by_cases hfg : newSecond f = some newGamma + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf, hfg] + · by_cases hfd : newSecond f = some newChoice.color + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf, hfd] + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf, hfg, hfd] + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf] + | inr g => simp [TwoColorIncidenceGraph] + +theorem helper_hsigmaExitGraph_1471.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (newSecond : PartialEdgeColoring E k), + corr.replacementSeries.data.coloring newi.succ = TwoColorComponentSwap G newSecond + newGamma newChoice.color (Sum.inl newChoice.vertex) → newChoice.color = available.delta → + newGamma = available.gamma → corr.replacementSeries.data.coloring newi.succ = sigma → + TwoColorIncidenceGraph G (TwoColorComponentSwap G newSecond newGamma newChoice.color + (Sum.inl newChoice.vertex)) newGamma newChoice.color = TwoColorIncidenceGraph G newSecond + newGamma newChoice.color → TwoColorIncidenceGraph G sigma available.gamma available.delta + = TwoColorIncidenceGraph G newSecond newGamma newChoice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available originalPrefix + corr newi newChoice newGamma newSecond newCurrentColoring hnewDeltaAvailable hnewGammaAvailable + hnewPostSigma hswapGraph + calc + TwoColorIncidenceGraph G sigma available.gamma available.delta = + TwoColorIncidenceGraph G (corr.replacementSeries.data.coloring newi.succ) available.gamma + available.delta := + congrArg (fun phi => TwoColorIncidenceGraph G phi available.gamma available.delta) + hnewPostSigma.symm + _ = + TwoColorIncidenceGraph G + (TwoColorComponentSwap G newSecond newGamma newChoice.color (Sum.inl newChoice.vertex)) + available.gamma available.delta := + congrArg (fun phi => TwoColorIncidenceGraph G phi available.gamma available.delta) + newCurrentColoring + _ = + TwoColorIncidenceGraph G + (TwoColorComponentSwap G newSecond newGamma newChoice.color (Sum.inl newChoice.vertex)) + newGamma newChoice.color := + by rw [hnewGammaAvailable, hnewDeltaAvailable] + _ = TwoColorIncidenceGraph G newSecond newGamma newChoice.color := hswapGraph + +theorem helper_hi_768.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (i : Fin ett.rounds), Fin.last ett.rounds = i.succ → i = q := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q i htarget + apply Fin.ext + have hv : ett.rounds = i.val + 1 := by simpa using congrArg Fin.val htarget + change i.val = ett.rounds - 1 + omega + +theorem helper_branch_787.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.castSucc = (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))) → + ∀ (_ : RevisitingExtensionCertificate ett.series.data q.castSucc), (ett.rounds = (1 : ℕ) ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), zeroPrefix.data.tree (Fin.last (1 : ℕ)) = ett.series.data.tree (Fin.last + ett.rounds).castSucc ∧ zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigma) → Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q hqCast available hzero + rcases hzero with ⟨hroundOne, prefixInput, zeroPrefix, hzeroTree, hzeroColor⟩ + have : available.earlier.val ≤ 0 := by + have hqzero : q.castSucc.val = 0 := by simp [q, hroundOne] + have hle := available.earlierAtMost + omega + have hearlierPositive := available.earlierPositive + omega + +theorem helper_hne_1035.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + g ∈ MissingColors G second ch.vertex → second ch.edge = some ch.color → g ≠ ch.color := by + classical + intro V E _ _ G k e0 X C phi ch g second hgSecond hedgeSecond heq + have hpresent : g ∈ PresentColors G second ch.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨ch.edge, ch.edgeIncident, by simpa [heq] using hedgeSecond⟩ + have hnotPresent : g ∉ PresentColors G second ch.vertex := by simpa [MissingColors] using hgSecond + exact hnotPresent hpresent + +theorem helper_hbaseTree_1084.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (oldi : Fin + ett.rounds) (newi : Fin originalPrefix.rounds), corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc → + originalPrefix.series.data.tree newi.succ.castSucc = ett.series.data.tree + oldi.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma originalPrefix corr oldi newi htree + calc + originalPrefix.series.data.tree newi.succ.castSucc = + corr.replacementSeries.data.tree newi.succ.castSucc := + (corr.ladderTreesAgree newi).symm + _ = ett.series.data.tree oldi.succ.castSucc := htree + +theorem helper_hmissingSameVertex_1108.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (oldi : Fin + ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + oldi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) (newi : Fin originalPrefix.rounds), + originalPrefix.series.data.tree newi.succ.castSucc = ett.series.data.tree + oldi.succ.castSucc → originalPrefix.series.data.coloring newi.succ = + ett.series.data.coloring oldi.succ → MissingColors G (ett.series.data.coloring oldi.succ) + oldChoice.vertex = MissingColors G (corr.replacementSeries.data.coloring newi.succ) + oldChoice.vertex := + by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma originalPrefix corr oldi oldChoice + newi hbaseTree hbaseColor + have hvBase : + oldChoice.vertex ∈ TreeSequenceVertexSet (originalPrefix.series.data.tree newi.succ.castSucc) := + by + rw [hbaseTree] + exact oldChoice.vertexDefective.1 + have hs := (corr.replacementStable newi).2 oldChoice.vertex hvBase + rw [hbaseColor] at hs + exact hs.symm + +theorem helper_hnewVertexTn_1347.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc → + ∀ (newi : Fin originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)), TreeSequenceInitialSegment (corr.replacementSeries.data.tree + newi.succ.castSucc) (corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + + (1 : ℕ)))) → newChoice.vertex ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last + ett.rounds).castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma originalPrefix corr hcorrFinalTree + newi newChoice hnewTreeFinal + have hvFinal : + newChoice.vertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + 1))) := + TreeSequenceInitialSegmentVertexSetSubset hnewTreeFinal newChoice.vertexDefective.1 + exact + Eq.mp (congrArg (fun X => newChoice.vertex ∈ TreeSequenceVertexSet X) hcorrFinalTree) hvFinal + +theorem helper_missingPreviousToTn_1435.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); TreeSequenceInitialSegment (ett.series.data.tree q.castSucc.castSucc) + (ett.series.data.tree q.succ.castSucc) → + ∀ c ∈ TreeMissingColors (ett.series.data.coloring q.castSucc) (ett.series.data.tree + q.castSucc.castSucc), c ∈ TreeMissingColors (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q hpreviousToTn c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + obtain ⟨v, hv, hvc⟩ := hc + exact ⟨v, TreeSequenceInitialSegmentVertexSetSubset hpreviousToTn hv, hvc⟩ + +theorem helper_copyReturnEdge_1482.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma → available.gamma ∈ ett.series.data.stored + available.earlier → available.delta ∈ ett.series.data.stored available.earlier → ( + ∀ c ∈ ett.series.data.stored available.earlier, c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.castSucc) → ( + ∀ (f : E), Sum.inr f ∈ available.returnPath.support → TreeIncidentEdge (ett.series.data.tree + q.succ.castSucc) f ∧ (ett.series.data.coloring q.castSucc f = some available.gamma ∨ + ett.series.data.coloring q.castSucc f = some available.delta)) → + ∀ (f : E), Sum.inr f ∈ available.returnPath.support → sigma f = ett.series.data.coloring + q.castSucc f := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available hsigmaPrevStableQ + hgammaEarlierStored hdeltaEarlierStored colorControlAtQ oldReturnEdgeData f hf + obtain ⟨hfIncident, hcolor⟩ := oldReturnEdgeData f hf + apply hsigmaPrevStableQ.1 f hfIncident + rcases hcolor with hgamma | hdelta + · exact ⟨available.gamma, colorControlAtQ available.gamma hgammaEarlierStored, hgamma⟩ + · exact ⟨available.delta, colorControlAtQ available.delta hdeltaEarlierStored, hdelta⟩ + +theorem helper_hreturnInQ_1513.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigma available.gamma + available.delta; + ∀ (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let _ : sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer sigmaReturnGraph returnEdgeTransfer; Sum.inl + available.returnVertex ∈ TwoColorComponent G sigma available.gamma available.delta + (Sum.inr available.edge) := + by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available sigmaReturnGraph + returnEdgeTransfer sigmaReturnPath + change + sigmaReturnGraph.connectedComponentMk (Sum.inl available.returnVertex) = + sigmaReturnGraph.connectedComponentMk (Sum.inr available.edge) + exact (SimpleGraph.ConnectedComponent.sound sigmaReturnPath.reachable).symm + +theorem helper_hedgeSigmaActive_1522.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), ( + ∀ (f : E), Sum.inr f ∈ available.returnPath.support → TreeIncidentEdge (ett.series.data.tree + q.succ.castSucc) f ∧ (ett.series.data.coloring q.castSucc f = some available.gamma ∨ + ett.series.data.coloring q.castSucc f = some available.delta)) → ( + ∀ (f : E), Sum.inr f ∈ available.returnPath.support → sigma f = ett.series.data.coloring + q.castSucc f) → sigma available.edge = some available.gamma ∨ sigma available.edge = some + available.delta := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available oldReturnEdgeData + copyReturnEdge + have hsupport : Sum.inr available.edge ∈ available.returnPath.support := by simp + have hold := (oldReturnEdgeData available.edge hsupport).2 + rw [copyReturnEdge available.edge hsupport] + exact hold + +theorem helper_houtsideInQ_1530.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), sigma + available.edge = some available.gamma ∨ sigma available.edge = some available.delta → + Sum.inl available.outsideEndpoint ∈ TwoColorComponent G sigma available.gamma + available.delta (Sum.inr available.edge) := + by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available hedgeSigmaActive + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + have houtIncident : Incident G available.outsideEndpoint available.edge := by + unfold Incident + rw [available.edgeEnds] + exact Sym2.mem_mk_right _ _ + simp [TwoColorIncidenceGraph, houtIncident, hedgeSigmaActive] + +theorem helper_holdDeltaAtNewVertex_1560.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (oldi : Fin + ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + oldi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)), oldChoice.color ∈ MissingColors G + (ett.series.data.coloring oldi.succ) oldChoice.vertex → oldChoice.color = available.delta + → newChoice.vertex = oldChoice.vertex → ett.series.data.coloring q.castSucc = + ett.series.data.coloring oldi.succ → available.delta ∈ MissingColors G + (ett.series.data.coloring q.castSucc) newChoice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available originalPrefix + corr oldi oldChoice newi newChoice holdDeltaMissing holdDeltaAvailable hnewVertexOld + holdColorConstant + have hm := holdDeltaMissing + rw [holdDeltaAvailable] at hm + have hm' : + available.delta ∈ MissingColors G (ett.series.data.coloring oldi.succ) newChoice.vertex := by + simpa only [hnewVertexOld] using hm + exact + Eq.mpr + (congrArg (fun phi => available.delta ∈ MissingColors G phi newChoice.vertex) + holdColorConstant) + hm' + +theorem helper_hreplacementCurrentTree_1736.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc → + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree replacementLast.succ = ett.series.data.tree (Fin.last + ett.rounds).castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma originalPrefix corr hcorrFinalTree + replacementLast + as_aux_lemma => + calc + corr.replacementSeries.data.tree replacementLast.succ = + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + 1)) := + by congr 1 + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := hcorrFinalTree + +theorem helper_hreturnNotNext_1938.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (replacementCycle : + TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (outsideOne : V), rootedCycle.getVert (↑(outsideIndices.min' outsideIndicesNonempty) : ℕ) = + Sum.inl outsideOne → (↑firstOutside : ℕ) < rootedCycle.length → + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({idx : Fin + (rootedCycle.length + (1 : ℕ)) | (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := laterInsideIndices.min' + laterInsideNonempty; + ∀ (insideTwo : V), rootedCycle.getVert (↑(laterInsideIndices.min' laterInsideNonempty) : ℕ) = + Sum.inl insideTwo → (↑firstReturn : ℕ) ≠ (↑firstOutside : ℕ) + (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q available replacementCycle + currentTree hreturnCycle rootedCycle outsideIndices outsideIndicesNonempty firstOutside + outsideOne houtsideOneAt firstOutsideLt laterInsideIndices laterInsideNonempty firstReturn + insideTwo hinsideTwoAt heq + have hadj := rootedCycle.adj_getVert_succ (i := firstOutside.val) (by omega) + rw [houtsideOneAt] at hadj + have hnext : rootedCycle.getVert (firstOutside.val + 1) = Sum.inl insideTwo := by + have heq' : (laterInsideIndices.min' laterInsideNonempty).val = firstOutside.val + 1 := heq + rw [heq'] at hinsideTwoAt + exact hinsideTwoAt + rw [hnext] at hadj + simp [TwoColorIncidenceGraph] at hadj + +theorem helper_hfirstGamma_2063.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)), available.delta ∈ MissingColors G sigma newChoice.vertex → + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) → + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (firstEdge : E), sigma firstEdge = some available.gamma ∨ sigma firstEdge = some + available.delta → firstEdge ∈ BoundaryEdges G currentTree → newChoice.vertex ∈ currentTree + → sigma firstEdge = some available.gamma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available originalPrefix + corr newi newChoice hnewDeltaSigma hclosedSigma currentTree firstEdge hfirstEdgeActive + hfirstBoundary hnewVertexCurrent + rcases hfirstEdgeActive with hgamma | hdelta + · exact hgamma + · exfalso + exact (hclosedSigma hfirstBoundary hnewVertexCurrent hdelta) hnewDeltaSigma + +theorem helper_hsecondGamma_2070.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)), available.delta ∈ MissingColors G sigma newChoice.vertex → + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) → + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (secondEdge : E), sigma secondEdge = some available.gamma ∨ sigma secondEdge = some + available.delta → secondEdge ∈ BoundaryEdges G currentTree → newChoice.vertex ∈ + currentTree → sigma secondEdge = some available.gamma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available originalPrefix + corr newi newChoice hnewDeltaSigma hclosedSigma currentTree secondEdge hsecondEdgeActive + hsecondBoundary hnewVertexCurrent + rcases hsecondEdgeActive with hgamma | hdelta + · exact hgamma + · exfalso + exact (hclosedSigma hsecondBoundary hnewVertexCurrent hdelta) hnewDeltaSigma + +theorem helper_hsigmaPathInQ_2135.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigma available.gamma + available.delta; + ∀ (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl + available.returnVertex) := available.returnPath.transfer sigmaReturnGraph + returnEdgeTransfer; + ∀ z ∈ sigmaReturnPath.support, z ∈ TwoColorComponent G sigma available.gamma available.delta + (Sum.inr available.edge) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available sigmaReturnGraph + returnEdgeTransfer sigmaReturnPath z hz + obtain ⟨m, hm, hmle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hz + change + sigmaReturnGraph.connectedComponentMk z = + sigmaReturnGraph.connectedComponentMk (Sum.inr available.edge) + rw [← hm] + exact (SimpleGraph.ConnectedComponent.sound (sigmaReturnPath.take m).reachable).symm + +theorem helper_hfstar_2233.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0) (fstar : + E), ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ fstar } : Finset E) → + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + ett.series.data.connectingEdges q.succ = ({ available.edge } : Finset E) → fstar = + available.edge := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ fstar hfinalEdges q hqSucc available + currentEdges + have hcurrentEdgesFinal : + ett.series.data.connectingEdges (Fin.last ett.rounds) = { available.edge } := by + rw [← hqSucc] + exact currentEdges + apply Finset.mem_singleton.mp + rw [← hcurrentEdgesFinal, hfinalEdges] + exact Finset.mem_singleton_self fstar + +theorem helper_hfinalTree_2464.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let newStored : Finset (Fin k) := (insert available.delta ({ available.gamma } : Finset (Fin + k)) : Finset (Fin k)); + let newEdges : Finset E := ({ available.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.RE; + let newVertex : Option V := some available.insideEndpoint; + let newOutside : Option V := some available.outsideEndpoint; + let newDelta : Option (Fin k) := some available.delta; + let newGamma : Option (Fin k) := some available.gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigma (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E + inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (2 + : ℕ))), (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let rawFinalTree : Fin (originalPrefix.rounds + (3 : ℕ)) := Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) (Fin.last (ett.rounds + (1 : ℕ))); rawFinalTree = Fin.last (originalPrefix.rounds + (2 : ℕ)) + → finalSeries.data.tree (Fin.last (ett.rounds + (1 : ℕ))) = closureTree := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q available + originalPrefix corr newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesTree finalSeries + rawFinalTree hrawFinalTree + calc + finalSeries.data.tree (Fin.last (ett.rounds + 1)) = extendedSeries.data.tree rawFinalTree := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree rawFinalTree := by rw [hextendedData] + _ = closureTree := by + rw [hrawFinalTree] + simp [appendedData, TashkinovSeriesDataAppend] + +theorem helper_hfinalColor_2482.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let newStored : Finset (Fin k) := (insert available.delta ({ available.gamma } : Finset (Fin + k)) : Finset (Fin k)); + let newEdges : Finset E := ({ available.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.RE; + let newVertex : Option V := some available.insideEndpoint; + let newOutside : Option V := some available.outsideEndpoint; + let newDelta : Option (Fin k) := some available.delta; + let newGamma : Option (Fin k) := some available.gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigma (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E + inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let rawFinalColor : Fin (originalPrefix.rounds + (2 : ℕ)) := Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) (Fin.last ett.rounds); rawFinalColor = Fin.last (originalPrefix.rounds + (1 : ℕ)) → + finalSeries.data.coloring (Fin.last ett.rounds) = sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q available + originalPrefix corr newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesColoring finalSeries + rawFinalColor hrawFinalColor + calc + finalSeries.data.coloring (Fin.last ett.rounds) = extendedSeries.data.coloring rawFinalColor := + by exact castSeriesColoring hroundsEq extendedSeries _ + _ = appendedData.coloring rawFinalColor := by rw [hextendedData] + _ = sigma := by + rw [hrawFinalColor] + simp [appendedData, TashkinovSeriesDataAppend] + +theorem helper_pePostStatus_2097.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch + : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + IsProperEdgeColoring G second → StableColoring X (insert ch.color C : Finset (Fin k)) + ch.selected second → g ∈ MissingColors G ch.selected ch.vertex → + let post : PartialEdgeColoring E k := TwoColorComponentSwap G second g ch.color (Sum.inl + ch.vertex); ch.color ∈ MissingColors G post ch.vertex ∧ g ∉ MissingColors G post ch.vertex + ∧ g ≠ ch.color := by + classical + intro V E _ _ G k e0 X C phi ch g second hsecondProper hsecondStable hgSelected + dsimp + have hgSecond : g ∈ MissingColors G second ch.vertex := by + rw [hsecondStable.2 ch.vertex ch.vertexDefective.1] + exact hgSelected + have hedgeSecond : second ch.edge = some ch.color := by + exact + (hsecondStable.1 ch.edge ⟨ch.vertex, ch.vertexDefective.1, ch.edgeIncident⟩ + ⟨ch.color, Finset.mem_union_right _ (Finset.mem_insert_self _ _), ch.edgeColor⟩).trans + ch.edgeColor + have hne : g ≠ ch.color := by + exact + @helper_hne_1035 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@X) (@C) (@phi) (@ch) + (@g) (@second) (@hgSecond) (@hedgeSecond) + have hedgeComponent : + Sum.inr ch.edge ∈ TwoColorComponent G second g ch.color (Sum.inl ch.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, ch.edgeIncident, hedgeSecond] + have hmissingDelta : + ch.color ∈ + MissingColors G (TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex)) ch.vertex := + by + exact + (TwoColorComponentSwapMissingBehavior G second g ch.color hne hsecondProper + (Sum.inl ch.vertex)).2.1 + ch.vertex rfl hgSecond + have hedgePost : TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex) ch.edge = some g := + by simp [TwoColorComponentSwap, hedgeComponent, hedgeSecond, hne.symm] + have hgammaPresent : + g ∈ PresentColors G (TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex)) ch.vertex := + by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨ch.edge, ch.edgeIncident, hedgePost⟩ + exact ⟨hmissingDelta, by simpa [MissingColors] using hgammaPresent, hne⟩ + +theorem helper_reStepColoring_2269.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (adjoined : TreeSequence G e0) (available : RevisitingExtensionCertificate ett.series.data + q.castSucc), TreeSequenceAdjoinEdge (ett.series.data.tree q.succ.castSucc) available.edge + adjoined → (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (oldi : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (_ : Fin k) (newi : Fin + originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (_ : Fin k), + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + oldi.succ.castSucc → + ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 + input') (j : Fin rounds'), series.data.kind j.succ = some TashkinovExtensionKind.RE → + series.data.coloring j.succ = series.data.coloring j.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar q adjoined available + adjoinedExactly hroundLarge originalPrefix hr corr oldi oldChoice oldGamma newi newChoice + newGamma htree + exact + @helper_reStepColoring_588 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@adjoined) (@available) + (@adjoinedExactly) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@oldi) (@oldChoice) + (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) + +theorem helper_reIntervalColoring_2281.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (_ : RevisitingExtensionCertificate ett.series.data q.castSucc), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (oldi : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (_ : Fin k) (newi : Fin + originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (_ : Fin k), + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + oldi.succ.castSucc → ( + ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 + input') (j : Fin rounds'), series.data.kind j.succ = some TashkinovExtensionKind.RE → + series.data.coloring j.succ = series.data.coloring j.castSucc) → + ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 + input') (a b : Fin (rounds' + (1 : ℕ))), (↑a : ℕ) ≤ (↑b : ℕ) → ( + ∀ (j : Fin (rounds' + (1 : ℕ))), (↑a : ℕ) < (↑j : ℕ) → (↑j : ℕ) ≤ (↑b : ℕ) → series.data.kind + j = some TashkinovExtensionKind.RE) → series.data.coloring b = series.data.coloring a := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar q available hroundLarge + originalPrefix hr corr oldi oldChoice oldGamma newi newChoice newGamma htree reStepColoring + exact + @helper_reIntervalColoring_625 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@available) + (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@oldi) (@oldChoice) (@oldGamma) (@newi) + (@newChoice) (@newGamma) (@htree) (@reStepColoring) + +theorem helper_holdColorConstant_2295.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.castSucc = (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))) → + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), (1 : ℕ) < + ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (oldi : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (_ : Fin k), available.earlier = + oldi.succ → oldi.succ = available.earlier → + ∀ (newi : Fin originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (_ : Fin k), corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc → ( + ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 + input') (a b : Fin (rounds' + (1 : ℕ))), (↑a : ℕ) ≤ (↑b : ℕ) → ( + ∀ (j : Fin (rounds' + (1 : ℕ))), (↑a : ℕ) < (↑j : ℕ) → (↑j : ℕ) ≤ (↑b : ℕ) → series.data.kind + j = some TashkinovExtensionKind.RE) → series.data.coloring b = series.data.coloring a) → + ett.series.data.coloring q.castSucc = ett.series.data.coloring oldi.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar q hqCast available hroundLarge + originalPrefix hr corr oldi oldChoice oldGamma holdTarget holdIndex newi newChoice newGamma + htree reIntervalColoring + exact + @helper_holdColorConstant_669 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@hqCast) (@available) + (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@oldi) (@oldChoice) (@oldGamma) (@holdTarget) + (@holdIndex) (@newi) (@newChoice) (@newGamma) (@htree) (@reIntervalColoring) + +theorem helper_copyReturnEdge_2580.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma → available.gamma ∈ ett.series.data.stored + available.earlier → available.delta ∈ ett.series.data.stored available.earlier → ( + ∀ c ∈ ett.series.data.stored available.earlier, c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.castSucc) → ( + ∀ (f : E), Sum.inr f ∈ available.returnPath.support → TreeIncidentEdge (ett.series.data.tree + q.succ.castSucc) f ∧ (ett.series.data.coloring q.castSucc f = some available.gamma ∨ + ett.series.data.coloring q.castSucc f = some available.delta)) → + ∀ (f : E), Sum.inr f ∈ available.returnPath.support → sigma f = ett.series.data.coloring + q.castSucc f := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar q available hsigmaPrevStableQ + hgammaEarlierStored hdeltaEarlierStored colorControlAtQ oldReturnEdgeData f hf + exact + @helper_copyReturnEdge_1482 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@available) + (@hsigmaPrevStableQ) (@hgammaEarlierStored) (@hdeltaEarlierStored) (@colorControlAtQ) + (@oldReturnEdgeData) (@f) (@hf) + +theorem helper_holdDeltaAtNewVertex_2647.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (oldi : Fin + ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + oldi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)), oldChoice.color ∈ MissingColors G + (ett.series.data.coloring oldi.succ) oldChoice.vertex → oldChoice.color = available.delta + → newChoice.vertex = oldChoice.vertex → ett.series.data.coloring q.castSucc = + ett.series.data.coloring oldi.succ → available.delta ∈ MissingColors G + (ett.series.data.coloring q.castSucc) newChoice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar q available originalPrefix + corr oldi oldChoice newi newChoice holdDeltaMissing holdDeltaAvailable hnewVertexOld + holdColorConstant + exact + @helper_holdDeltaAtNewVertex_1560 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@available) + (@originalPrefix) (@corr) (@oldi) (@oldChoice) (@newi) (@newChoice) (@holdDeltaMissing) + (@holdDeltaAvailable) (@hnewVertexOld) (@holdColorConstant) + +theorem helper_hsigmaExitGraph_2697.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (newSecond : PartialEdgeColoring E k), + corr.replacementSeries.data.coloring newi.succ = TwoColorComponentSwap G newSecond + newGamma newChoice.color (Sum.inl newChoice.vertex) → newChoice.color = available.delta → + newGamma = available.gamma → corr.replacementSeries.data.coloring newi.succ = sigma → + TwoColorIncidenceGraph G (TwoColorComponentSwap G newSecond newGamma newChoice.color + (Sum.inl newChoice.vertex)) newGamma newChoice.color = TwoColorIncidenceGraph G newSecond + newGamma newChoice.color → TwoColorIncidenceGraph G sigma available.gamma available.delta + = TwoColorIncidenceGraph G newSecond newGamma newChoice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar q available originalPrefix + corr newi newChoice newGamma newSecond newCurrentColoring hnewDeltaAvailable hnewGammaAvailable + hnewPostSigma hswapGraph + exact + @helper_hsigmaExitGraph_1471 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@available) + (@originalPrefix) (@corr) (@newi) (@newChoice) (@newGamma) (@newSecond) (@newCurrentColoring) + (@hnewDeltaAvailable) (@hnewGammaAvailable) (@hnewPostSigma) (@hswapGraph) + +theorem helper_hreturnNotNext_3034.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (replacementCycle : + TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (outsideOne : V), rootedCycle.getVert (↑(outsideIndices.min' outsideIndicesNonempty) : ℕ) = + Sum.inl outsideOne → (↑firstOutside : ℕ) < rootedCycle.length → + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({idx : Fin + (rootedCycle.length + (1 : ℕ)) | (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := laterInsideIndices.min' + laterInsideNonempty; + ∀ (insideTwo : V), rootedCycle.getVert (↑(laterInsideIndices.min' laterInsideNonempty) : ℕ) = + Sum.inl insideTwo → (↑firstReturn : ℕ) ≠ (↑firstOutside : ℕ) + (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma Tstar q available replacementCycle + currentTree hreturnCycle rootedCycle outsideIndices outsideIndicesNonempty firstOutside + outsideOne houtsideOneAt firstOutsideLt laterInsideIndices laterInsideNonempty firstReturn + insideTwo hinsideTwoAt + exact + @helper_hreturnNotNext_1938 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@available) + (@replacementCycle) (@hreturnCycle) (@outsideIndicesNonempty) (@outsideOne) (@houtsideOneAt) + (@firstOutsideLt) (@laterInsideNonempty) (@insideTwo) (@hinsideTwoAt) + +theorem helper_stepSegment_2938.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) ( + by omega + )⟩ : Fin ett.rounds); + ∀ (adjoined : TreeSequence G e0) (available : RevisitingExtensionCertificate ett.series.data + q.castSucc) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree q.succ.castSucc) + available.edge adjoined) (hroundLarge : (1 : ℕ) < ett.rounds) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (r : Fin + originalPrefix.rounds), TreeSequenceInitialSegment (corr.replacementSeries.data.tree + r.succ.castSucc) (corr.replacementSeries.data.tree r.succ.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q adjoined available + adjoinedExactly hroundLarge originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma + newi newChoice newGamma htree oldChoiceOnNew holdColorCast holdColorNe hnewColorNe + hidentifiedDelta hidentifiedGamma holdDeltaAvailable holdGammaAvailable r + have hstep := corr.replacementSeries.certified r.succ + generalize hslot : r.succ = slot at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges initialKind initialVertex + initialOutside initialDelta initialGamma initialClosure => exact (Fin.succ_ne_zero r hslot).elim + | SE i prevProper prevOne prevClosed prevNotStrong noRE choice alternative coloring stored edges + kind vertex outside delta gamma adjoined adjoinedExactly closed ordered + strict => + have hi : i = r := by + apply Fin.ext + have hv := congrArg Fin.val hslot + simp only [Fin.val_succ] at hv + omega + subst i + simpa [hslot] using ordered + | PE i prevProper prevOne prevClosed prevNotStrong noRE choice alternativeFails gamma gammaRule + second secondProper secondOne secondStable exit coloring coloringProper coloringOne stored edges + kind vertex outside delta gammaValue closed ordered + strict => + have hi : i = r := by + apply Fin.ext + have hv := congrArg Fin.val hslot + simp only [Fin.val_succ] at hv + omega + subst i + simpa [hslot] using ordered + | RE i prevProper prevOne prevClosed prevNotStrong cert coloring stored edges kind vertex outside + delta gamma adjoined adjoinedExactly closed ordered + strict => + have hi : i = r := by + apply Fin.ext + have hv := congrArg Fin.val hslot + simp only [Fin.val_succ] at hv + omega + subst i + simpa [hslot] using ordered + +theorem helper_treeToFinal_2987.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) ( + by omega + )⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (_ : + ∀ (r : Fin originalPrefix.rounds), TreeSequenceInitialSegment + (corr.replacementSeries.data.tree r.succ.castSucc) (corr.replacementSeries.data.tree + r.succ.succ)) (_ : + ∀ (A B C : TreeSequence G e0), TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) (d : ℕ) (idx : Fin (originalPrefix.rounds + (2 : ℕ))), + (↑idx : ℕ) + d = originalPrefix.rounds + (1 : ℕ) → (1 : ℕ) ≤ (↑idx : ℕ) → + TreeSequenceInitialSegment (corr.replacementSeries.data.tree idx) + (corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ)))) := + by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma newi newChoice newGamma htree + oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable stepSegment segmentTrans d + induction d with + | zero => + intro idx hidx hpos + have hi : idx = Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp + omega + rw [hi] + exact ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + | succ d ih => + intro idx hidx hpos + have hlt : idx.val < originalPrefix.rounds + 1 := by omega + let r : Fin originalPrefix.rounds := ⟨idx.val - 1, by omega⟩ + have hleft : idx = r.succ.castSucc := by + apply Fin.ext + simp [r] + omega + let next : Fin (originalPrefix.rounds + 2) := ⟨idx.val + 1, by omega⟩ + have hright : next = r.succ.succ := by + apply Fin.ext + simp [next, r] + omega + have hfirst : + TreeSequenceInitialSegment (corr.replacementSeries.data.tree idx) + (corr.replacementSeries.data.tree next) := by + rw [hleft, hright] + exact stepSegment r + exact segmentTrans _ _ _ hfirst (ih next (by simp [next]; omega) (by simp [next])) + +theorem helper_hclosedSigma_3647.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (_ : TreeSequence + G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (_ : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) (_ : IsOneEdgeUncolored + (ett.series.data.coloring q.castSucc) e0) (_ : ColoredVertexSetClosed G + (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc))) (hroundLarge : (1 : ℕ) < ett.rounds) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (oldi : Fin + ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + oldi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : s(oldChoiceOnNew.vertex, oldChoiceOnNew.otherEndpoint) = s(newChoice.vertex, + newChoice.otherEndpoint)) (_ : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigma), ColoredVertexSetClosed G sigma (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne _ q + previousProper previousOneUncolored previousClosed hroundLarge originalPrefix corr oldi + oldChoice newi newChoice htree oldChoiceOnNew hends hsigmaPrevStableQ f c v hf hv hsf hcm + obtain ⟨x, hx, y, hy, hends⟩ := by simpa [BoundaryEdges] using hf + have hxf : Incident G x f := by + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + have hmissingEq := hsigmaPrevStableQ.2 v hv + have hcTree : + c ∈ + TreeMissingColors (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, hmissingEq ▸ hcm⟩ + have hcriterion := + (sc1 G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigma previousProper previousOneUncolored hsigmaProper hsigmaOne).mp + hsigmaPrevStableQ + have hcopy := hcriterion f ⟨x, hx, hxf⟩ (Or.inr ⟨c, Finset.mem_union_left _ hcTree, hsf⟩) + have holdf : ett.series.data.coloring q.castSucc f = some c := hcopy.symm.trans hsf + have hnotOld := previousClosed hf hv holdf + exact hnotOld (hmissingEq ▸ hcm) + +theorem helper_outsideIndicesNonempty_4016.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (replacementCycle + : TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support) (_ : + available.outsideEndpoint ∉ currentTree), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + ∀ (_ : Sum.inl available.outsideEndpoint ∈ rootedCycle.support), + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); outsideIndices.Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma newi newChoice newGamma htree + oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable replacementCycle currentTree hreturnCycle + houtsideNotCurrent rootedCycle houtsideRooted outsideIndices + obtain ⟨m, hm, hmle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp houtsideRooted + let idx : Fin (rootedCycle.length + 1) := ⟨m, by omega⟩ + refine ⟨idx, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩⟩ + exact ⟨available.outsideEndpoint, by simpa [idx] using hm, houtsideNotCurrent⟩ + +theorem helper_beforeFirstOutside_4031.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (replacementCycle + : TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (idx : Fin (rootedCycle.length + (1 : ℕ))), (↑idx : ℕ) < (↑firstOutside : ℕ) → + ∀ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v → v ∈ currentTree := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma newi newChoice newGamma + htree oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable replacementCycle currentTree hreturnCycle rootedCycle + outsideIndices outsideIndicesNonempty firstOutside idx hidx v hv + by_contra hvNot + have hmem : idx ∈ outsideIndices := Finset.mem_filter.mpr ⟨Finset.mem_univ _, ⟨v, hv, hvNot⟩⟩ + have hmin := Finset.min'_le outsideIndices idx hmem + omega + +theorem helper_firstOutsidePositive_4043.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (replacementCycle + : TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support) (_ : + available.returnVertex ∈ currentTree), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (outsideOne : V) (_ : rootedCycle.getVert (↑(outsideIndices.min' outsideIndicesNonempty) : + ℕ) = Sum.inl outsideOne) (_ : outsideOne ∉ currentTree), (0 : ℕ) < (↑firstOutside : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma newi newChoice newGamma htree + oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable replacementCycle currentTree hreturnCycle hreturnCurrent + rootedCycle outsideIndices outsideIndicesNonempty firstOutside outsideOne houtsideOneAt + houtsideOneNot + by_contra hnot + have hzero : firstOutside.val = 0 := by omega + have heq : outsideOne = available.returnVertex := by + apply Sum.inl.inj + calc + Sum.inl outsideOne = rootedCycle.getVert firstOutside.val := houtsideOneAt.symm + _ = rootedCycle.getVert 0 := by rw [hzero] + _ = Sum.inl available.returnVertex := rootedCycle.getVert_zero + exact houtsideOneNot (heq.symm ▸ hreturnCurrent) + +theorem helper_firstOutsideLt_4055.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (replacementCycle + : TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support) (_ : + available.returnVertex ∈ currentTree), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (outsideOne : V) (_ : rootedCycle.getVert (↑(outsideIndices.min' outsideIndicesNonempty) : + ℕ) = Sum.inl outsideOne) (_ : outsideOne ∉ currentTree), (↑firstOutside : ℕ) < + rootedCycle.length := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma newi newChoice newGamma htree + oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable replacementCycle currentTree hreturnCycle hreturnCurrent + rootedCycle outsideIndices outsideIndicesNonempty firstOutside outsideOne houtsideOneAt + houtsideOneNot + by_contra hnot + have hlast : firstOutside.val = rootedCycle.length := by + have := firstOutside.isLt + omega + have heq : outsideOne = available.returnVertex := by + apply Sum.inl.inj + calc + Sum.inl outsideOne = rootedCycle.getVert firstOutside.val := houtsideOneAt.symm + _ = rootedCycle.getVert rootedCycle.length := by rw [hlast] + _ = Sum.inl available.returnVertex := rootedCycle.getVert_length + exact houtsideOneNot (heq.symm ▸ hreturnCurrent) + +theorem helper_firstOutsideNotOne_4070.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (replacementCycle + : TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (outsideOne : V) (_ : rootedCycle.getVert (↑(outsideIndices.min' outsideIndicesNonempty) : + ℕ) = Sum.inl outsideOne) (_ : (↑firstOutside : ℕ) < rootedCycle.length), (↑firstOutside : + ℕ) ≠ (1 : ℕ) := + by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma newi newChoice newGamma + htree oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable replacementCycle currentTree hreturnCycle rootedCycle + outsideIndices outsideIndicesNonempty firstOutside outsideOne houtsideOneAt firstOutsideLt + hone + have hadj := rootedCycle.adj_getVert_succ (i := 0) (by omega) + have hy : rootedCycle.getVert 1 = Sum.inl outsideOne := by + have hone' : (outsideIndices.min' outsideIndicesNonempty).val = 1 := hone + rw [hone'] at houtsideOneAt + exact houtsideOneAt + rw [rootedCycle.getVert_zero, hy] at hadj + simp [TwoColorIncidenceGraph] at hadj + +theorem helper_hinsideOneCurrent_4119.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (replacementCycle + : TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (_ : + ∀ (idx : Fin (rootedCycle.length + (1 : ℕ))), (↑idx : ℕ) < (↑firstOutside : ℕ) → + ∀ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v → v ∈ currentTree) (_ : (↑firstOutside : + ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ)) (_ : (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) + = (↑firstOutside : ℕ) - (1 : ℕ)) (insideOne : V) (_ : rootedCycle.getVert ((↑firstOutside + : ℕ) - (2 : ℕ)) = Sum.inl insideOne), insideOne ∈ currentTree := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma newi newChoice newGamma htree + oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable replacementCycle currentTree hreturnCycle rootedCycle + outsideIndices outsideIndicesNonempty firstOutside beforeFirstOutside firstCrossingIndex + beforeFirstCrossingIndex insideOne hinsideOneAt + let idx : Fin (rootedCycle.length + 1) := + ⟨firstOutside.val - 2, lt_of_le_of_lt (Nat.sub_le _ _) firstOutside.isLt⟩ + apply + beforeFirstOutside idx + (by + change firstOutside.val - 2 < firstOutside.val + omega) + insideOne + simpa [idx] using hinsideOneAt + +theorem helper_laterInsideNonempty_4150.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (replacementCycle + : TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support) (_ : + available.returnVertex ∈ currentTree), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (_ : (↑firstOutside : ℕ) < rootedCycle.length), + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({idx : Fin + (rootedCycle.length + (1 : ℕ)) | (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); laterInsideIndices.Nonempty := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma newi newChoice newGamma htree + oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable replacementCycle currentTree hreturnCycle hreturnCurrent + rootedCycle outsideIndices outsideIndicesNonempty firstOutside firstOutsideLt laterInsideIndices + let idx : Fin (rootedCycle.length + 1) := ⟨rootedCycle.length, by omega⟩ + refine ⟨idx, Finset.mem_filter.mpr ⟨Finset.mem_univ _, firstOutsideLt, ?_⟩⟩ + exact ⟨available.returnVertex, by simp [idx], hreturnCurrent⟩ + +theorem helper_houtsideTwoNot_4210.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (replacementCycle + : TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (outsideOne : V) (_ : rootedCycle.getVert (↑(outsideIndices.min' outsideIndicesNonempty) : + ℕ) = Sum.inl outsideOne) (_ : outsideOne ∉ currentTree) (_ : (↑firstOutside : ℕ) - (1 : ℕ) + + (1 : ℕ) = (↑firstOutside : ℕ)) (_ : (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = + (↑firstOutside : ℕ) - (1 : ℕ)), + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({idx : Fin + (rootedCycle.length + (1 : ℕ)) | (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := laterInsideIndices.min' + laterInsideNonempty; + ∀ (_ : (↑firstOutside : ℕ) + (2 : ℕ) ≤ (↑firstReturn : ℕ)) (_ : (↑firstReturn : ℕ) - (1 : ℕ) + + (1 : ℕ) = (↑firstReturn : ℕ)) (_ : (↑firstReturn : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstReturn + : ℕ) - (1 : ℕ)) (outsideTwo : V) (_ : rootedCycle.getVert ((↑firstReturn : ℕ) - (2 : ℕ)) = + Sum.inl outsideTwo), outsideTwo ∉ currentTree := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma newi newChoice newGamma + htree oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable replacementCycle currentTree hreturnCycle rootedCycle + outsideIndices outsideIndicesNonempty firstOutside outsideOne houtsideOneAt houtsideOneNot + firstCrossingIndex beforeFirstCrossingIndex laterInsideIndices laterInsideNonempty firstReturn + hreturnGap returnCrossingIndex beforeReturnCrossingIndex outsideTwo houtsideTwoAt + houtsideTwoCurrent + by_cases heq : firstReturn.val - 2 = firstOutside.val + · have hvertices : outsideTwo = outsideOne := by + apply Sum.inl.inj + calc + Sum.inl outsideTwo = rootedCycle.getVert (firstReturn.val - 2) := houtsideTwoAt.symm + _ = rootedCycle.getVert firstOutside.val := by rw [heq] + _ = Sum.inl outsideOne := houtsideOneAt + exact houtsideOneNot (hvertices.symm ▸ houtsideTwoCurrent) + · have hbetween : firstOutside.val < firstReturn.val - 2 := by omega + let idx : Fin (rootedCycle.length + 1) := + ⟨firstReturn.val - 2, lt_of_le_of_lt (Nat.sub_le _ _) firstReturn.isLt⟩ + have hmem : idx ∈ laterInsideIndices := + Finset.mem_filter.mpr + ⟨Finset.mem_univ _, by simpa [idx], outsideTwo, by simpa [idx] using houtsideTwoAt, + houtsideTwoCurrent⟩ + have hmin := Finset.min'_le laterInsideIndices idx hmem + have hmin' : firstReturn.val ≤ idx.val := by simpa [firstReturn] using hmin + simp [idx] at hmin' + omega + +theorem helper_hcrossingEdgesNe_4255.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (↑available.earlier : ℕ) < originalPrefix.rounds + + (1 : ℕ)) (oldi : Fin ett.rounds) (oldChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors ett.series.data + oldi.castSucc) (ett.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k) (htree : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := transportDefectiveChoice (Eq.symm htree) + oldChoice; + ∀ (_ : oldChoiceOnNew.color = oldChoice.color) (_ : oldGamma ≠ oldChoice.color) (_ : newGamma + ≠ newChoice.color) (_ : newChoice.color = oldChoiceOnNew.color) (_ : newGamma = oldGamma) + (_ : oldChoice.color = available.delta) (_ : oldGamma = available.gamma) (replacementCycle + : TwoColorCycle G sigma available.gamma available.delta), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support), + let rootedCycle : (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + ∀ (_ : rootedCycle.IsCycle), + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({i : Fin + (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := outsideIndices.min' + outsideIndicesNonempty; + ∀ (_ : (↑firstOutside : ℕ) < rootedCycle.length) (_ : (2 : ℕ) ≤ (↑firstOutside : ℕ)) (_ : + (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ)) (firstEdge : E) (_ : + rootedCycle.getVert ((↑firstOutside : ℕ) - (1 : ℕ)) = Sum.inr firstEdge) (_ : + (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) - (1 : ℕ)), + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := ({idx : Fin + (rootedCycle.length + (1 : ℕ)) | (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : Finset (Fin + (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := laterInsideIndices.min' + laterInsideNonempty; + ∀ (_ : (↑firstOutside : ℕ) + (2 : ℕ) ≤ (↑firstReturn : ℕ)) (_ : (↑firstReturn : ℕ) - (1 : ℕ) + + (1 : ℕ) = (↑firstReturn : ℕ)) (secondEdge : E) (_ : rootedCycle.getVert ((↑firstReturn : + ℕ) - (1 : ℕ)) = Sum.inr secondEdge) (_ : (↑firstReturn : ℕ) - (2 : ℕ) + (1 : ℕ) = + (↑firstReturn : ℕ) - (1 : ℕ)), firstEdge ≠ secondEdge := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix hr corr earlierPrefixBound oldi oldChoice oldGamma newi newChoice newGamma + htree oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable replacementCycle currentTree hreturnCycle rootedCycle + rootedIsCycle outsideIndices outsideIndicesNonempty firstOutside firstOutsideLt + firstOutsideAtLeastTwo firstCrossingIndex firstEdge hfirstEdgeAt beforeFirstCrossingIndex + laterInsideIndices laterInsideNonempty firstReturn hreturnGap returnCrossingIndex secondEdge + hsecondEdgeAt beforeReturnCrossingIndex heq + have hp1Positive : 0 < firstOutside.val - 1 := by omega + have hp1AtMost : firstOutside.val - 1 ≤ rootedCycle.length := by omega + have hp2Positive : 0 < firstReturn.val - 1 := by omega + have hreturnAtMost : firstReturn.val ≤ rootedCycle.length := by + exact Nat.lt_succ_iff.mp firstReturn.isLt + have hp2AtMost : firstReturn.val - 1 ≤ rootedCycle.length := (Nat.sub_le _ _).trans hreturnAtMost + have hindices := + rootedIsCycle.getVert_injOn + (by + simp only [Set.mem_ofPred_eq] + exact ⟨hp1Positive, hp1AtMost⟩) + (by + simp only [Set.mem_ofPred_eq] + exact ⟨hp2Positive, hp2AtMost⟩) + have hvertices : + rootedCycle.getVert (firstOutside.val - 1) = rootedCycle.getVert (firstReturn.val - 1) := by + rw [hfirstEdgeAt, hsecondEdgeAt, heq] + have := hindices hvertices + omega + +theorem helper_interveningRevisiting_4368.{u_1, u_2} : + helperInterveningRevisiting4368Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ q hqCast available + hroundLarge originalPrefix hr hprefixData corr earlierPrefixBound earlierPrefix hearlierMap + oldi oldChoice oldGamma newi newChoice newGamma htree oldChoiceOnNew holdColorCast holdColorNe + hnewColorNe hidentifiedDelta hidentifiedGamma holdDeltaAvailable holdGammaAvailable + replacementLast hreplacementLastMap hgammaDeltaNe replacementCycle currentTree hreturnCycle + rootedCycle outsideIndices outsideIndicesNonempty firstOutside firstOutsideNotOne + firstOutsideAtLeastTwo firstCrossingIndex beforeFirstCrossingIndex laterInsideIndices + laterInsideNonempty firstReturn hreturnNotNext hreturnGap returnCrossingIndex + beforeReturnCrossingIndex j hjPositive hjLower hjUpper + rw [corr.extensionKindsAgree j, (hprefixData j).2.2.2.1] + apply available.interveningRevisiting (Fin.castLE (by omega) j) + · exact hjPositive + · have hvals := congrArg Fin.val hearlierMap + simp only [Fin.val_castLE] at hvals ⊢ + omega + · simp only [Fin.val_castLE] + have hupper := hjUpper + simp [replacementLast] at hupper + have hqval : q.castSucc.val = originalPrefix.rounds := by simp [q, hr] + omega + +theorem helper_leavesCurrent_4395.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_3 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc) (hroundLarge : (1 : + ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (replacementCycle : TwoColorCycle G sigma available.gamma available.delta) (_ : + have replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last + originalPrefix.rounds; corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc) (_ : ett.series.data.tree + q.castSucc.succ = ett.series.data.tree (Fin.last ett.rounds).castSucc) (_ : Sum.inl + available.outsideEndpoint ∈ replacementCycle.walk.support) (hreplacementColor : + corr.replacementSeries.data.coloring replacementLast = sigma), + let castCycle : (phi psi : PartialEdgeColoring E k) → (hphi : phi = psi) → (C : TwoColorCycle + G psi available.gamma available.delta) → TwoColorCycle G phi available.gamma + available.delta := fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) (C : + TwoColorCycle G psi available.gamma available.delta) ↦ @Eq.ndrec (PartialEdgeColoring E k) + phi (fun (psi : PartialEdgeColoring E k) ↦ (C : @TwoColorCycle V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_3 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_3 G k e0 input T generating ett) q) available) (@RevisitingExtensionCertificate.delta + V E inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available)) → @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_3 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_3 G k e0 input T generating ett) q) available) (@RevisitingExtensionCertificate.delta + V E inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available)) (fun (C : @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_3 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_3 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_3 G k e0 input T generating ett) q) available) (@RevisitingExtensionCertificate.delta + V E inst inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) q) available)) ↦ C) psi hphi C; + ∀ (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) (C : TwoColorCycle G psi + available.gamma available.delta) (z : V ⊕ E), z ∈ (castCycle phi psi hphi C).walk.support + ↔ z ∈ C.walk.support), + let replacementCycleForPrefix : TwoColorCycle G (corr.replacementSeries.data.coloring + replacementLast) available.gamma available.delta := castCycle + (corr.replacementSeries.data.coloring replacementLast) sigma hreplacementColor + replacementCycle; + ∃ u ∉ TreeSequenceVertexSet (corr.replacementSeries.data.tree replacementLast.succ), Sum.inl u + ∈ replacementCycleForPrefix.walk.support := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix corr replacementLast replacementCycle hreplacementCurrentTree + havailableCurrentTree houtsideCycle hreplacementColor castCycle castCycleSupport + replacementCycleForPrefix + refine ⟨available.outsideEndpoint, ?_, ?_⟩ + · rw [hreplacementCurrentTree, ← havailableCurrentTree] + exact available.outsideNotCurrent + · exact (castCycleSupport _ _ hreplacementColor replacementCycle _).2 houtsideCycle + +theorem helper_returnPathOnCycle_4421.{u_1, u_2} : + helperReturnPathOnCycle4421Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix corr replacementLast sigmaReturnGraph returnEdgeTransfer sigmaReturnPath + replacementCycle hreplacementColor castReturnWalk castReturnWalkSupport castCycle + castCycleSupport replacementCycleForPrefix replacementReturnPath hsigmaPathOnCycle z hz + apply (castCycleSupport _ _ hreplacementColor replacementCycle _).2 + apply hsigmaPathOnCycle + exact (castReturnWalkSupport _ _ hreplacementColor sigmaReturnPath z).1 hz + +theorem helper_returnPathInternal_4428.{u_1, u_2} : returnPathInternalStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge + originalPrefix corr replacementLast sigmaReturnGraph returnEdgeTransfer sigmaReturnPath + hsigmaReturnSupport hreplacementCurrentTree havailableCurrentTree hreplacementColor + castReturnWalk castReturnWalkSupport replacementReturnPath v hv + have hvOld : Sum.inl v ∈ available.returnPath.support := + (hsigmaReturnSupport (Sum.inl v)).mp + ((castReturnWalkSupport _ _ hreplacementColor sigmaReturnPath _).1 hv) + rw [hreplacementCurrentTree, ← havailableCurrentTree] + exact available.returnPathInternal v hvOld + +end GoldbergSeymour.TerminalRebuild + +end diff --git a/LeanPool/GoldbergSeymour/RevisitingTerminalStatements.lean b/LeanPool/GoldbergSeymour/RevisitingTerminalStatements.lean new file mode 100644 index 0000000000..cebb2dcbea --- /dev/null +++ b/LeanPool/GoldbergSeymour/RevisitingTerminalStatements.lean @@ -0,0 +1,3452 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ + +module + +public import LeanPool.GoldbergSeymour.RevisitingTerminalPreparation + +/-! +# Dependent statements for a revisiting terminal rebuild + +Supporting material for the Goldberg–Seymour revisiting construction. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +-/ + +@[expose] public section + +namespace GoldbergSeymour.TerminalRebuild + +open scoped Sym2 + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev terminalLastStepStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [ DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) + (_ : IsOneEdgeUncolored sigma e0) (Tstar : TreeSequence G e0) (fstar : E) + (seed : TreeSequence G e0) + (_ : TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar seed) + (closureTree : TreeSequence G e0) (_ : TashkinovClosure sigma seed closureTree) + (_ : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : q.succ = Fin.last ett.rounds) + (hqCast : q.castSucc = (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ)))) + (_ : TreeSequence G e0) (_ : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (_ : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (_ : + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc))) + (available : RevisitingExtensionCertificate ett.series.data q.castSucc) + (hroundLarge : (1 : ℕ) < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (_ : + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (earlierPrefixBound : (↑available.earlier : ℕ) < originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ (hearlierMap : Fin.castLE (by omega) earlierPrefix = available.earlier) + (hearlierPositive : (0 : ℕ) < (↑earlierPrefix : ℕ)) + (hreplacementEarlierKind : + corr.replacementSeries.data.kind earlierPrefix = some TashkinovExtensionKind.PE) + (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) (_ : available.earlier = oldi.succ) (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma_1 : Fin k) + (newCurrentDelta : corr.replacementSeries.data.delta newi.succ = some newChoice.color) + (newCurrentGamma : corr.replacementSeries.data.gamma newi.succ = some newGamma_1) + (hnewIndex : newi.succ = earlierPrefix) + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice (Eq.symm htree) oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) + (_ : + s(oldChoiceOnNew.vertex, oldChoiceOnNew.otherEndpoint) = + s(newChoice.vertex, newChoice.otherEndpoint)) + (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma_1 ≠ newChoice.color) + (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma_1 = oldGamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) + (hnewDeltaAvailable : newChoice.color = available.delta) + (hnewGammaAvailable : newGamma_1 = available.gamma), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (hreplacementLastMap : Fin.castLE (by omega) replacementLast = q.castSucc) + (hgammaDeltaNe : available.gamma ≠ available.delta) + (_ : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigma), + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma available.gamma available.delta; + ∀ + (returnEdgeTransfer : ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer sigmaReturnGraph returnEdgeTransfer; + ∀ (hsigmaReturnIsPath : sigmaReturnPath.IsPath) + (hsigmaReturnSupport : + ∀ (z : V ⊕ E), z ∈ sigmaReturnPath.support ↔ z ∈ available.returnPath.support) + (hreturnInNewEarlier : + available.returnVertex ∈ + TreeSequenceVertexSet (corr.replacementSeries.data.tree earlierPrefix.castSucc)) + (replacementCycle : TwoColorCycle G sigma available.gamma available.delta) + (hcycleFull : + ∀ (x : V ⊕ E), + x ∈ replacementCycle.walk.support ↔ + x ∈ TwoColorComponent G sigma available.gamma available.delta (Sum.inr available.edge)) + (_ : + ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc))) + (hreplacementCurrentTree : + have replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (havailableCurrentTree : + ett.series.data.tree q.castSucc.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support) + (houtsideCycle : Sum.inl available.outsideEndpoint ∈ replacementCycle.walk.support), + let rootedCycle : + (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({i : Fin (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := + outsideIndices.min' outsideIndicesNonempty; + ∀ (firstOutsideNotOne : (↑firstOutside : ℕ) ≠ (1 : ℕ)) + (firstOutsideAtLeastTwo : (2 : ℕ) ≤ (↑firstOutside : ℕ)) + (firstCrossingIndex : (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ)) + (beforeFirstCrossingIndex : + (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) - (1 : ℕ)), + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({idx : Fin (rootedCycle.length + (1 : ℕ)) | + (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := + laterInsideIndices.min' laterInsideNonempty; + ∀ (hreturnNotNext : (↑firstReturn : ℕ) ≠ (↑firstOutside : ℕ) + (1 : ℕ)) + (hreturnGap : (↑firstOutside : ℕ) + (2 : ℕ) ≤ (↑firstReturn : ℕ)) + (returnCrossingIndex : (↑firstReturn : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ)) + (beforeReturnCrossingIndex : + (↑firstReturn : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ) - (1 : ℕ)) + (_ : ¬ColoredVertexSetStronglyClosed G sigma currentTree) + (hreplacementColor : corr.replacementSeries.data.coloring replacementLast = sigma), + let castReturnWalk : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) → + (TwoColorIncidenceGraph G phi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex) := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) → + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) + (fun + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) ↦ + P) + psi hphi P; + ∀ + (castReturnWalkIsPath : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)), + P.IsPath → (castReturnWalk phi psi hphi P).IsPath) + (castReturnWalkSupport : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) + (z : V ⊕ E), z ∈ (castReturnWalk phi psi hphi P).support ↔ z ∈ P.support), + let castCycle : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (C : TwoColorCycle G psi available.gamma available.delta) → + TwoColorCycle G phi available.gamma available.delta := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (C : + @TwoColorCycle V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) → + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (fun + (C : + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) ↦ + C) + psi hphi C; + ∀ + (castCycleSupport : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) (z : V ⊕ E), + z ∈ (castCycle phi psi hphi C).walk.support ↔ z ∈ C.walk.support), + let replacementCycleForPrefix : + TwoColorCycle G (corr.replacementSeries.data.coloring replacementLast) + available.gamma available.delta := + castCycle (corr.replacementSeries.data.coloring replacementLast) sigma + hreplacementColor replacementCycle; + let replacementReturnPath : + (TwoColorIncidenceGraph G (corr.replacementSeries.data.coloring replacementLast) + available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex) := + castReturnWalk (corr.replacementSeries.data.coloring replacementLast) sigma + hreplacementColor sigmaReturnPath; + ∀ + (hsigmaPathOnCycle : + ∀ z ∈ sigmaReturnPath.support, z ∈ replacementCycle.walk.support), + let replacementCertificate : + RevisitingExtensionCertificate corr.replacementSeries.data replacementLast := + { + earlier := earlierPrefix, earlierPositive := hearlierPositive, + earlierAtMost := Nat.le_of_lt_succ earlierPrefix.isLt, + earlierPE := hreplacementEarlierKind, + interveningRevisiting := + helper_interveningRevisiting_4368 G k e0 input T generating ett hpositive sigma + Tstar hqCast available hroundLarge originalPrefix hr hprefixData corr + earlierPrefixBound hearlierMap oldi oldChoice oldGamma newi newChoice + newGamma_1 htree holdColorCast holdColorNe hnewColorNe hidentifiedDelta + hidentifiedGamma holdDeltaAvailable holdGammaAvailable hreplacementLastMap + hgammaDeltaNe replacementCycle hreturnCycle outsideIndicesNonempty + firstOutsideNotOne firstOutsideAtLeastTwo firstCrossingIndex + beforeFirstCrossingIndex laterInsideNonempty hreturnNotNext hreturnGap + returnCrossingIndex beforeReturnCrossingIndex, + gamma := available.gamma, delta := available.delta, + earlierGamma := + ((Eq.symm + (id + (congrArg + (fun (_a : Fin (originalPrefix.rounds + (1 : ℕ))) ↦ + corr.replacementSeries.data.gamma _a = some available.gamma) + (Eq.symm hnewIndex)))) ▸ + ((Eq.symm + (id + (congrArg (fun (_a : Option (Fin k)) ↦ _a = some available.gamma) + newCurrentGamma))) ▸ + ((Eq.symm + (id + (congrArg (fun (_a : Fin k) ↦ some _a = some available.gamma) + hnewGammaAvailable))) ▸ + Eq.refl (some available.gamma)))), + earlierDelta := + ((Eq.symm + (id + (congrArg + (fun (_a : Fin (originalPrefix.rounds + (1 : ℕ))) ↦ + corr.replacementSeries.data.delta _a = some available.delta) + (Eq.symm hnewIndex)))) ▸ + ((Eq.symm + (id + (congrArg (fun (_a : Option (Fin k)) ↦ _a = some available.delta) + newCurrentDelta))) ▸ + ((Eq.symm + (id + (congrArg (fun (_a : Fin k) ↦ some _a = some available.delta) + hnewDeltaAvailable))) ▸ + Eq.refl (some available.delta)))), + cycle := replacementCycleForPrefix, + meetsEarlier := + Exists.intro available.returnVertex + (⟨hreturnInNewEarlier, + (castCycleSupport (corr.replacementSeries.data.coloring replacementLast) + sigma hreplacementColor replacementCycle + (Sum.inl available.returnVertex)).mpr + hreturnCycle⟩ : + available.returnVertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree earlierPrefix.castSucc) ∧ + Sum.inl available.returnVertex ∈ replacementCycleForPrefix.walk.support), + leavesCurrent := + helper_leavesCurrent_4395 G k e0 input T generating ett hpositive sigma Tstar + available hroundLarge originalPrefix corr replacementCycle + hreplacementCurrentTree havailableCurrentTree houtsideCycle hreplacementColor + castCycleSupport, + edge := available.edge, + edgeOnCycle := + (castCycleSupport (corr.replacementSeries.data.coloring replacementLast) sigma + hreplacementColor replacementCycle (Sum.inr available.edge)).mpr + ((hcycleFull (Sum.inr available.edge)).mpr rfl), + edgeBoundary := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + available.edge ∈ BoundaryEdges G (TreeSequenceVertexSet _a)) + hreplacementCurrentTree))) ▸ + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + available.edge ∈ BoundaryEdges G (TreeSequenceVertexSet _a)) + (Eq.symm havailableCurrentTree)))) ▸ + available.edgeBoundary)), + insideEndpoint := available.insideEndpoint, + outsideEndpoint := available.outsideEndpoint, + insideInCurrent := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + available.insideEndpoint ∈ TreeSequenceVertexSet _a) + hreplacementCurrentTree))) ▸ + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + available.insideEndpoint ∈ TreeSequenceVertexSet _a) + (Eq.symm havailableCurrentTree)))) ▸ + available.insideInCurrent)), + outsideNotCurrent := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + available.outsideEndpoint ∉ TreeSequenceVertexSet _a) + hreplacementCurrentTree))) ▸ + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + available.outsideEndpoint ∉ TreeSequenceVertexSet _a) + (Eq.symm havailableCurrentTree)))) ▸ + available.outsideNotCurrent)), + edgeEnds := available.edgeEnds, returnVertex := available.returnVertex, + returnInEarlier := hreturnInNewEarlier, returnPath := replacementReturnPath, + returnPathIsPath := + castReturnWalkIsPath (corr.replacementSeries.data.coloring replacementLast) + sigma hreplacementColor sigmaReturnPath hsigmaReturnIsPath, + returnPathOnCycle := + helper_returnPathOnCycle_4421 G k e0 input T generating ett hpositive sigma + Tstar available hroundLarge originalPrefix corr returnEdgeTransfer + replacementCycle hreplacementColor castReturnWalkSupport castCycleSupport + hsigmaPathOnCycle, + returnPathInternal := + helper_returnPathInternal_4428 G k e0 input T generating ett hpositive sigma + Tstar available hroundLarge originalPrefix corr returnEdgeTransfer + hsigmaReturnSupport hreplacementCurrentTree havailableCurrentTree + hreplacementColor castReturnWalkSupport : + RevisitingExtensionCertificate corr.replacementSeries.data replacementLast }; + ∀ (_ : fstar = available.edge), + let newStored : Finset (Fin k) := + (insert available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k)); + let newEdges : Finset E := ({ available.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.RE; + let newVertex : Option V := some available.insideEndpoint; + let newOutside : Option V := some available.outsideEndpoint; + let newDelta : Option (Fin k) := some available.delta; + let newGamma : Option (Fin k) := some available.gamma; + let appendedData : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma; + ∀ + (appendedCertificate : + RevisitingExtensionCertificate + (TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma) + replacementLast.castSucc) + (_ : appendedCertificate.gamma = replacementCertificate.gamma) + (_ : appendedCertificate.delta = replacementCertificate.delta) + (_ : appendedCertificate.edge = replacementCertificate.edge) + (_ : appendedCertificate.insideEndpoint = replacementCertificate.insideEndpoint) + (_ : + appendedCertificate.outsideEndpoint = replacementCertificate.outsideEndpoint) + (_ : + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + closureTree.length), + TashkinovSeriesStep G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput appendedData (Fin.last (originalPrefix.rounds + (1 : ℕ))) + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev penultimateTreeStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [ DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : q.castSucc = (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ)))) + (available : RevisitingExtensionCertificate ett.series.data q.castSucc) + (hroundLarge : (1 : ℕ) < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (_ : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (earlierPrefixBound : (↑available.earlier : ℕ) < originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ (_ : Fin.castLE (by omega) earlierPrefix = available.earlier) + (_ : (0 : ℕ) < (↑earlierPrefix : ℕ)) + (_ : corr.replacementSeries.data.kind earlierPrefix = some TashkinovExtensionKind.PE) + (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) (_ : available.earlier = oldi.succ) (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma_1 : Fin k) (_ : corr.replacementSeries.data.delta newi.succ = some newChoice.color) + (_ : corr.replacementSeries.data.gamma newi.succ = some newGamma_1) + (_ : newi.succ = earlierPrefix) + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice (Eq.symm htree) oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) + (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma_1 ≠ newChoice.color) + (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma_1 = oldGamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) (_ : newChoice.color = available.delta) + (_ : newGamma_1 = available.gamma), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (_ : Fin.castLE (by omega) replacementLast = q.castSucc) + (_ : available.gamma ≠ available.delta), + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma available.gamma available.delta; + ∀ + (returnEdgeTransfer : ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer sigmaReturnGraph returnEdgeTransfer; + ∀ (_ : sigmaReturnPath.IsPath) + (_ : ∀ (z : V ⊕ E), z ∈ sigmaReturnPath.support ↔ z ∈ available.returnPath.support) + (_ : + available.returnVertex ∈ + TreeSequenceVertexSet (corr.replacementSeries.data.tree earlierPrefix.castSucc)) + (replacementCycle : TwoColorCycle G sigma available.gamma available.delta) + (_ : + ∀ (x : V ⊕ E), + x ∈ replacementCycle.walk.support ↔ + x ∈ TwoColorComponent G sigma available.gamma available.delta (Sum.inr available.edge)) + (_ : + have replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (_ : + ett.series.data.tree q.castSucc.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support) + (_ : Sum.inl available.outsideEndpoint ∈ replacementCycle.walk.support), + let rootedCycle : + (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({i : Fin (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := + outsideIndices.min' outsideIndicesNonempty; + ∀ (_ : (↑firstOutside : ℕ) ≠ (1 : ℕ)) (_ : (2 : ℕ) ≤ (↑firstOutside : ℕ)) + (_ : (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ)) + (_ : (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) - (1 : ℕ)), + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({idx : Fin (rootedCycle.length + (1 : ℕ)) | + (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := + laterInsideIndices.min' laterInsideNonempty; + ∀ (_ : (↑firstReturn : ℕ) ≠ (↑firstOutside : ℕ) + (1 : ℕ)) + (_ : (↑firstOutside : ℕ) + (2 : ℕ) ≤ (↑firstReturn : ℕ)) + (_ : (↑firstReturn : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ)) + (_ : (↑firstReturn : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ) - (1 : ℕ)) + (_ : corr.replacementSeries.data.coloring replacementLast = sigma), + let castReturnWalk : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) → + (TwoColorIncidenceGraph G phi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex) := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) → + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) + (fun + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) ↦ + P) + psi hphi P; + ∀ + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)), + P.IsPath → (castReturnWalk phi psi hphi P).IsPath) + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) + (z : V ⊕ E), z ∈ (castReturnWalk phi psi hphi P).support ↔ z ∈ P.support), + let castCycle : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (C : TwoColorCycle G psi available.gamma available.delta) → + TwoColorCycle G phi available.gamma available.delta := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (C : + @TwoColorCycle V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) → + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (fun + (C : + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) ↦ + C) + psi hphi C; + ∀ + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) (z : V ⊕ E), + z ∈ (castCycle phi psi hphi C).walk.support ↔ z ∈ C.walk.support) + (_ : ∀ z ∈ sigmaReturnPath.support, z ∈ replacementCycle.walk.support), + let newStored : Finset (Fin k) := + (insert available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k)); + let newEdges : Finset E := ({ available.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.RE; + let newVertex : Option V := some available.insideEndpoint; + let newOutside : Option V := some available.outsideEndpoint; + let newDelta : Option (Fin k) := some available.delta; + let newGamma : Option (Fin k) := some available.gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma; + ∀ + (_ : + RevisitingExtensionCertificate + (TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma) + replacementLast.castSucc) + (extendedSeries : + TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 corr.replacementInput) + (_ : + extendedSeries.data = + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma) + (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : + {a b : ℕ} → + (h : a = b) → + (S : TashkinovSeries G k a e0 corr.replacementInput) → + TashkinovSeries G k b e0 corr.replacementInput := + fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) ↦ + (h ▸ S); + ∀ + (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast (by omega) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := + castSeries hroundsEq extendedSeries; + let rawPenultimate : Fin (originalPrefix.rounds + (3 : ℕ)) := + Fin.cast (by omega) (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ))); + ∀ (_ : rawPenultimate = replacementLast.succ.castSucc), + finalSeries.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev storedDataAgreementStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [ DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : q.succ = Fin.last ett.rounds) + (_ : q.castSucc = (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ)))) + (available : RevisitingExtensionCertificate ett.series.data q.castSucc) + (_ : + ett.series.data.stored q.succ = + (insert available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k))) + (_ : ett.series.data.connectingEdges q.succ = ({ available.edge } : Finset E)) + (_ : ett.series.data.kind q.succ = some TashkinovExtensionKind.RE) + (hroundLarge : (1 : ℕ) < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (_ : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (earlierPrefixBound : (↑available.earlier : ℕ) < originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ (_ : Fin.castLE (by omega) earlierPrefix = available.earlier) + (_ : (0 : ℕ) < (↑earlierPrefix : ℕ)) + (_ : corr.replacementSeries.data.kind earlierPrefix = some TashkinovExtensionKind.PE) + (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) (_ : available.earlier = oldi.succ) (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma_1 : Fin k) (_ : corr.replacementSeries.data.delta newi.succ = some newChoice.color) + (_ : corr.replacementSeries.data.gamma newi.succ = some newGamma_1) + (_ : newi.succ = earlierPrefix) + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice (Eq.symm htree) oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) + (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma_1 ≠ newChoice.color) + (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma_1 = oldGamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) (_ : newChoice.color = available.delta) + (_ : newGamma_1 = available.gamma), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (_ : Fin.castLE (by omega) replacementLast = q.castSucc) + (_ : available.gamma ≠ available.delta), + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma available.gamma available.delta; + ∀ + (returnEdgeTransfer : ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer sigmaReturnGraph returnEdgeTransfer; + ∀ (_ : sigmaReturnPath.IsPath) + (_ : ∀ (z : V ⊕ E), z ∈ sigmaReturnPath.support ↔ z ∈ available.returnPath.support) + (_ : + available.returnVertex ∈ + TreeSequenceVertexSet (corr.replacementSeries.data.tree earlierPrefix.castSucc)) + (replacementCycle : TwoColorCycle G sigma available.gamma available.delta) + (_ : + ∀ (x : V ⊕ E), + x ∈ replacementCycle.walk.support ↔ + x ∈ TwoColorComponent G sigma available.gamma available.delta (Sum.inr available.edge)) + (_ : + have replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (_ : + ett.series.data.tree q.castSucc.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support) + (_ : Sum.inl available.outsideEndpoint ∈ replacementCycle.walk.support), + let rootedCycle : + (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({i : Fin (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := + outsideIndices.min' outsideIndicesNonempty; + ∀ (_ : (↑firstOutside : ℕ) ≠ (1 : ℕ)) (_ : (2 : ℕ) ≤ (↑firstOutside : ℕ)) + (_ : (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ)) + (_ : (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) - (1 : ℕ)), + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({idx : Fin (rootedCycle.length + (1 : ℕ)) | + (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := + laterInsideIndices.min' laterInsideNonempty; + ∀ (_ : (↑firstReturn : ℕ) ≠ (↑firstOutside : ℕ) + (1 : ℕ)) + (_ : (↑firstOutside : ℕ) + (2 : ℕ) ≤ (↑firstReturn : ℕ)) + (_ : (↑firstReturn : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ)) + (_ : (↑firstReturn : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ) - (1 : ℕ)) + (_ : corr.replacementSeries.data.coloring replacementLast = sigma), + let castReturnWalk : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) → + (TwoColorIncidenceGraph G phi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex) := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) → + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) + (fun + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) ↦ + P) + psi hphi P; + ∀ + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)), + P.IsPath → (castReturnWalk phi psi hphi P).IsPath) + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) + (z : V ⊕ E), z ∈ (castReturnWalk phi psi hphi P).support ↔ z ∈ P.support), + let castCycle : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (C : TwoColorCycle G psi available.gamma available.delta) → + TwoColorCycle G phi available.gamma available.delta := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (C : + @TwoColorCycle V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) → + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (fun + (C : + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) ↦ + C) + psi hphi C; + ∀ + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) (z : V ⊕ E), + z ∈ (castCycle phi psi hphi C).walk.support ↔ z ∈ C.walk.support) + (_ : ∀ z ∈ sigmaReturnPath.support, z ∈ replacementCycle.walk.support), + let newStored : Finset (Fin k) := + (insert available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k)); + let newEdges : Finset E := ({ available.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.RE; + let newVertex : Option V := some available.insideEndpoint; + let newOutside : Option V := some available.outsideEndpoint; + let newDelta : Option (Fin k) := some available.delta; + let newGamma : Option (Fin k) := some available.gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma; + ∀ + (_ : + RevisitingExtensionCertificate + (TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma) + replacementLast.castSucc) + (extendedSeries : + TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 corr.replacementInput) + (_ : + extendedSeries.data = + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma) + (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : + {a b : ℕ} → + (h : a = b) → + (S : TashkinovSeries G k a e0 corr.replacementInput) → + TashkinovSeries G k b e0 corr.replacementInput := + fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) ↦ + (h ▸ S); + ∀ + (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.stored i = S.data.stored (Fin.cast (by omega) i)) + (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.connectingEdges i = + S.data.connectingEdges (Fin.cast (by omega) i)) + (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.kind i = S.data.kind (Fin.cast (by omega) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := + castSeries hroundsEq extendedSeries; + let _ : + (i : Fin (ett.rounds + (1 : ℕ))) → Fin (originalPrefix.rounds + (2 : ℕ)) := + fun (i : Fin (ett.rounds + (1 : ℕ))) ↦ Fin.cast (by omega) i; + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + finalSeries.data.stored i = ett.series.data.stored i ∧ + finalSeries.data.connectingEdges i = ett.series.data.connectingEdges i ∧ + finalSeries.data.kind i = ett.series.data.kind i + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev treeAgreementStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [ DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : q.castSucc = (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ)))) + (available : RevisitingExtensionCertificate ett.series.data q.castSucc) + (hroundLarge : (1 : ℕ) < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (_ : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) + (_ : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (earlierPrefixBound : (↑available.earlier : ℕ) < originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ (_ : Fin.castLE (by omega) earlierPrefix = available.earlier) + (_ : (0 : ℕ) < (↑earlierPrefix : ℕ)) + (_ : corr.replacementSeries.data.kind earlierPrefix = some TashkinovExtensionKind.PE) + (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) (_ : available.earlier = oldi.succ) (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma_1 : Fin k) (_ : corr.replacementSeries.data.delta newi.succ = some newChoice.color) + (_ : corr.replacementSeries.data.gamma newi.succ = some newGamma_1) + (_ : newi.succ = earlierPrefix) + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice (Eq.symm htree) oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) + (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma_1 ≠ newChoice.color) + (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma_1 = oldGamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) (_ : newChoice.color = available.delta) + (_ : newGamma_1 = available.gamma), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (_ : Fin.castLE (by omega) replacementLast = q.castSucc) + (_ : available.gamma ≠ available.delta), + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma available.gamma available.delta; + ∀ + (returnEdgeTransfer : ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer sigmaReturnGraph returnEdgeTransfer; + ∀ (_ : sigmaReturnPath.IsPath) + (_ : ∀ (z : V ⊕ E), z ∈ sigmaReturnPath.support ↔ z ∈ available.returnPath.support) + (_ : + available.returnVertex ∈ + TreeSequenceVertexSet (corr.replacementSeries.data.tree earlierPrefix.castSucc)) + (replacementCycle : TwoColorCycle G sigma available.gamma available.delta) + (_ : + ∀ (x : V ⊕ E), + x ∈ replacementCycle.walk.support ↔ + x ∈ TwoColorComponent G sigma available.gamma available.delta (Sum.inr available.edge)) + (_ : + have replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (_ : + ett.series.data.tree q.castSucc.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support) + (_ : Sum.inl available.outsideEndpoint ∈ replacementCycle.walk.support), + let rootedCycle : + (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({i : Fin (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := + outsideIndices.min' outsideIndicesNonempty; + ∀ (_ : (↑firstOutside : ℕ) ≠ (1 : ℕ)) (_ : (2 : ℕ) ≤ (↑firstOutside : ℕ)) + (_ : (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ)) + (_ : (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) - (1 : ℕ)), + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({idx : Fin (rootedCycle.length + (1 : ℕ)) | + (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := + laterInsideIndices.min' laterInsideNonempty; + ∀ (_ : (↑firstReturn : ℕ) ≠ (↑firstOutside : ℕ) + (1 : ℕ)) + (_ : (↑firstOutside : ℕ) + (2 : ℕ) ≤ (↑firstReturn : ℕ)) + (_ : (↑firstReturn : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ)) + (_ : (↑firstReturn : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ) - (1 : ℕ)) + (_ : corr.replacementSeries.data.coloring replacementLast = sigma), + let castReturnWalk : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) → + (TwoColorIncidenceGraph G phi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex) := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) → + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) + (fun + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) ↦ + P) + psi hphi P; + ∀ + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)), + P.IsPath → (castReturnWalk phi psi hphi P).IsPath) + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) + (z : V ⊕ E), z ∈ (castReturnWalk phi psi hphi P).support ↔ z ∈ P.support), + let castCycle : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (C : TwoColorCycle G psi available.gamma available.delta) → + TwoColorCycle G phi available.gamma available.delta := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (C : + @TwoColorCycle V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) → + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (fun + (C : + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) ↦ + C) + psi hphi C; + ∀ + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) (z : V ⊕ E), + z ∈ (castCycle phi psi hphi C).walk.support ↔ z ∈ C.walk.support) + (_ : ∀ z ∈ sigmaReturnPath.support, z ∈ replacementCycle.walk.support), + let newStored : Finset (Fin k) := + (insert available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k)); + let newEdges : Finset E := ({ available.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.RE; + let newVertex : Option V := some available.insideEndpoint; + let newOutside : Option V := some available.outsideEndpoint; + let newDelta : Option (Fin k) := some available.delta; + let newGamma : Option (Fin k) := some available.gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma; + ∀ + (_ : + RevisitingExtensionCertificate + (TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma) + replacementLast.castSucc) + (extendedSeries : + TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 corr.replacementInput) + (_ : + extendedSeries.data = + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma) + (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : + {a b : ℕ} → + (h : a = b) → + (S : TashkinovSeries G k a e0 corr.replacementInput) → + TashkinovSeries G k b e0 corr.replacementInput := + fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) ↦ + (h ▸ S); + ∀ + (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast (by omega) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := + castSeries hroundsEq extendedSeries; + ∀ + (_ : + finalSeries.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let _ : + (i : Fin (ett.rounds + (2 : ℕ))) → Fin (originalPrefix.rounds + (3 : ℕ)) := + fun (i : Fin (ett.rounds + (2 : ℕ))) ↦ Fin.cast (by omega) i; + ∀ (i : Fin ett.rounds), + finalSeries.data.tree i.succ.castSucc = ett.series.data.tree i.succ.castSucc + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev coloringPropertiesStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [ DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) + (_ : IsOneEdgeUncolored sigma e0) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : q.castSucc = (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ)))) + (available : RevisitingExtensionCertificate ett.series.data q.castSucc) + (hroundLarge : (1 : ℕ) < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (_ : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (earlierPrefixBound : (↑available.earlier : ℕ) < originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ (_ : Fin.castLE (by omega) earlierPrefix = available.earlier) + (_ : (0 : ℕ) < (↑earlierPrefix : ℕ)) + (_ : corr.replacementSeries.data.kind earlierPrefix = some TashkinovExtensionKind.PE) + (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) (_ : available.earlier = oldi.succ) (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma_1 : Fin k) (_ : corr.replacementSeries.data.delta newi.succ = some newChoice.color) + (_ : corr.replacementSeries.data.gamma newi.succ = some newGamma_1) + (_ : newi.succ = earlierPrefix) + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice (Eq.symm htree) oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) + (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma_1 ≠ newChoice.color) + (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma_1 = oldGamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) (_ : newChoice.color = available.delta) + (_ : newGamma_1 = available.gamma), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (_ : Fin.castLE (by omega) replacementLast = q.castSucc) + (_ : available.gamma ≠ available.delta), + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma available.gamma available.delta; + ∀ + (returnEdgeTransfer : ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer sigmaReturnGraph returnEdgeTransfer; + ∀ (_ : sigmaReturnPath.IsPath) + (_ : ∀ (z : V ⊕ E), z ∈ sigmaReturnPath.support ↔ z ∈ available.returnPath.support) + (_ : + available.returnVertex ∈ + TreeSequenceVertexSet (corr.replacementSeries.data.tree earlierPrefix.castSucc)) + (replacementCycle : TwoColorCycle G sigma available.gamma available.delta) + (_ : + ∀ (x : V ⊕ E), + x ∈ replacementCycle.walk.support ↔ + x ∈ TwoColorComponent G sigma available.gamma available.delta (Sum.inr available.edge)) + (_ : + have replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (_ : + ett.series.data.tree q.castSucc.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support) + (_ : Sum.inl available.outsideEndpoint ∈ replacementCycle.walk.support), + let rootedCycle : + (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({i : Fin (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := + outsideIndices.min' outsideIndicesNonempty; + ∀ (_ : (↑firstOutside : ℕ) ≠ (1 : ℕ)) (_ : (2 : ℕ) ≤ (↑firstOutside : ℕ)) + (_ : (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ)) + (_ : (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) - (1 : ℕ)), + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({idx : Fin (rootedCycle.length + (1 : ℕ)) | + (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := + laterInsideIndices.min' laterInsideNonempty; + ∀ (_ : (↑firstReturn : ℕ) ≠ (↑firstOutside : ℕ) + (1 : ℕ)) + (_ : (↑firstOutside : ℕ) + (2 : ℕ) ≤ (↑firstReturn : ℕ)) + (_ : (↑firstReturn : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ)) + (_ : (↑firstReturn : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ) - (1 : ℕ)) + (_ : corr.replacementSeries.data.coloring replacementLast = sigma), + let castReturnWalk : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) → + (TwoColorIncidenceGraph G phi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex) := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) → + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) + (fun + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) ↦ + P) + psi hphi P; + ∀ + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)), + P.IsPath → (castReturnWalk phi psi hphi P).IsPath) + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) + (z : V ⊕ E), z ∈ (castReturnWalk phi psi hphi P).support ↔ z ∈ P.support), + let castCycle : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (C : TwoColorCycle G psi available.gamma available.delta) → + TwoColorCycle G phi available.gamma available.delta := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (C : + @TwoColorCycle V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) → + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (fun + (C : + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) ↦ + C) + psi hphi C; + ∀ + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) (z : V ⊕ E), + z ∈ (castCycle phi psi hphi C).walk.support ↔ z ∈ C.walk.support) + (_ : ∀ z ∈ sigmaReturnPath.support, z ∈ replacementCycle.walk.support), + let newStored : Finset (Fin k) := + (insert available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k)); + let newEdges : Finset E := ({ available.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.RE; + let newVertex : Option V := some available.insideEndpoint; + let newOutside : Option V := some available.outsideEndpoint; + let newDelta : Option (Fin k) := some available.delta; + let newGamma : Option (Fin k) := some available.gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma; + ∀ + (_ : + RevisitingExtensionCertificate + (TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma) + replacementLast.castSucc) + (extendedSeries : + TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 corr.replacementInput) + (_ : + extendedSeries.data = + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma) + (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : + {a b : ℕ} → + (h : a = b) → + (S : TashkinovSeries G k a e0 corr.replacementInput) → + TashkinovSeries G k b e0 corr.replacementInput := + fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) ↦ + (h ▸ S); + ∀ + (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast (by omega) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := + castSeries hroundsEq extendedSeries; + ∀ + (_ : + ((fun {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) ↦ + (h ▸ S)) + hroundsEq extendedSeries).data.coloring + (Fin.last ett.rounds) = + sigma), + let _ : + (i : Fin (ett.rounds + (1 : ℕ))) → Fin (originalPrefix.rounds + (2 : ℕ)) := + fun (i : Fin (ett.rounds + (1 : ℕ))) ↦ Fin.cast (by omega) i; + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ + IsOneEdgeUncolored (finalSeries.data.coloring i) e0 + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev coloringStabilityStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [ DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k) + (_ : + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) + (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : q.castSucc = (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ)))) + (available : RevisitingExtensionCertificate ett.series.data q.castSucc) + (hroundLarge : (1 : ℕ) < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (_ : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) + (_ : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (earlierPrefixBound : (↑available.earlier : ℕ) < originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ (_ : Fin.castLE (by omega) earlierPrefix = available.earlier) + (_ : (0 : ℕ) < (↑earlierPrefix : ℕ)) + (_ : corr.replacementSeries.data.kind earlierPrefix = some TashkinovExtensionKind.PE) + (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) (_ : available.earlier = oldi.succ) (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma_1 : Fin k) (_ : corr.replacementSeries.data.delta newi.succ = some newChoice.color) + (_ : corr.replacementSeries.data.gamma newi.succ = some newGamma_1) + (_ : newi.succ = earlierPrefix) + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice (Eq.symm htree) oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) + (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma_1 ≠ newChoice.color) + (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma_1 = oldGamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) (_ : newChoice.color = available.delta) + (_ : newGamma_1 = available.gamma), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (_ : Fin.castLE (by omega) replacementLast = q.castSucc) + (_ : available.gamma ≠ available.delta), + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma available.gamma available.delta; + ∀ + (returnEdgeTransfer : ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer sigmaReturnGraph returnEdgeTransfer; + ∀ (_ : sigmaReturnPath.IsPath) + (_ : ∀ (z : V ⊕ E), z ∈ sigmaReturnPath.support ↔ z ∈ available.returnPath.support) + (_ : + available.returnVertex ∈ + TreeSequenceVertexSet (corr.replacementSeries.data.tree earlierPrefix.castSucc)) + (replacementCycle : TwoColorCycle G sigma available.gamma available.delta) + (_ : + ∀ (x : V ⊕ E), + x ∈ replacementCycle.walk.support ↔ + x ∈ TwoColorComponent G sigma available.gamma available.delta (Sum.inr available.edge)) + (_ : + have replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (_ : + ett.series.data.tree q.castSucc.succ = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let currentTree : Finset V := TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc); + ∀ (hreturnCycle : Sum.inl available.returnVertex ∈ replacementCycle.walk.support) + (_ : Sum.inl available.outsideEndpoint ∈ replacementCycle.walk.support), + let rootedCycle : + (TwoColorIncidenceGraph G sigma available.gamma available.delta).Walk + (Sum.inl available.returnVertex) (Sum.inl available.returnVertex) := + replacementCycle.walk.rotate (Sum.inl available.returnVertex) hreturnCycle; + let outsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({i : Fin (rootedCycle.length + (1 : ℕ)) | + ∃ (v : V), rootedCycle.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (outsideIndicesNonempty : outsideIndices.Nonempty), + let firstOutside : Fin (rootedCycle.length + (1 : ℕ)) := + outsideIndices.min' outsideIndicesNonempty; + ∀ (_ : (↑firstOutside : ℕ) ≠ (1 : ℕ)) (_ : (2 : ℕ) ≤ (↑firstOutside : ℕ)) + (_ : (↑firstOutside : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ)) + (_ : (↑firstOutside : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstOutside : ℕ) - (1 : ℕ)), + let laterInsideIndices : Finset (Fin (rootedCycle.length + (1 : ℕ))) := + ({idx : Fin (rootedCycle.length + (1 : ℕ)) | + (↑firstOutside : ℕ) < (↑idx : ℕ) ∧ + ∃ (v : V), rootedCycle.getVert (↑idx : ℕ) = Sum.inl v ∧ v ∈ currentTree} : + Finset (Fin (rootedCycle.length + (1 : ℕ)))); + ∀ (laterInsideNonempty : laterInsideIndices.Nonempty), + let firstReturn : Fin (rootedCycle.length + (1 : ℕ)) := + laterInsideIndices.min' laterInsideNonempty; + ∀ (_ : (↑firstReturn : ℕ) ≠ (↑firstOutside : ℕ) + (1 : ℕ)) + (_ : (↑firstOutside : ℕ) + (2 : ℕ) ≤ (↑firstReturn : ℕ)) + (_ : (↑firstReturn : ℕ) - (1 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ)) + (_ : (↑firstReturn : ℕ) - (2 : ℕ) + (1 : ℕ) = (↑firstReturn : ℕ) - (1 : ℕ)) + (_ : corr.replacementSeries.data.coloring replacementLast = sigma), + let castReturnWalk : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) → + (TwoColorIncidenceGraph G phi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex) := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) → + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) + (fun + (P : + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available))) ↦ + P) + psi hphi P; + ∀ + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)), + P.IsPath → (castReturnWalk phi psi hphi P).IsPath) + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk + (Sum.inr available.edge) (Sum.inl available.returnVertex)) + (z : V ⊕ E), z ∈ (castReturnWalk phi psi hphi P).support ↔ z ∈ P.support), + let castCycle : + (phi psi : PartialEdgeColoring E k) → + (hphi : phi = psi) → + (C : TwoColorCycle G psi available.gamma available.delta) → + TwoColorCycle G phi available.gamma available.delta := + fun (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) ↦ + @Eq.ndrec (PartialEdgeColoring E k) phi + (fun (psi : PartialEdgeColoring E k) ↦ + (C : + @TwoColorCycle V E G k psi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) → + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T generating + ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) + (fun + (C : + @TwoColorCycle V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 + (@TashkinovSeries.data V E inst inst_1 inst_3 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + e0 input + (@ExtendedTashkinovTree.series V E inst inst_1 inst_3 G k e0 input T + generating ett)) + (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_3 G k e0 input T + generating ett) + q) + available)) ↦ + C) + psi hphi C; + ∀ + (_ : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) (z : V ⊕ E), + z ∈ (castCycle phi psi hphi C).walk.support ↔ z ∈ C.walk.support) + (_ : ∀ z ∈ sigmaReturnPath.support, z ∈ replacementCycle.walk.support), + let newStored : Finset (Fin k) := + (insert available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k)); + let newEdges : Finset E := ({ available.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.RE; + let newVertex : Option V := some available.insideEndpoint; + let newOutside : Option V := some available.outsideEndpoint; + let newDelta : Option (Fin k) := some available.delta; + let newGamma : Option (Fin k) := some available.gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma; + ∀ + (_ : + RevisitingExtensionCertificate + (TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma) + replacementLast.castSucc) + (extendedSeries : + TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 corr.replacementInput) + (_ : + extendedSeries.data = + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma) + (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : + {a b : ℕ} → + (h : a = b) → + (S : TashkinovSeries G k a e0 corr.replacementInput) → + TashkinovSeries G k b e0 corr.replacementInput := + fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) ↦ + (h ▸ S); + ∀ + (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast (by omega) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := + castSeries hroundsEq extendedSeries; + ∀ + (_ : + ((fun {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) ↦ + (h ▸ S)) + hroundsEq extendedSeries).data.coloring + (Fin.last ett.rounds) = + sigma), + let _ : + (i : Fin (ett.rounds + (1 : ℕ))) → Fin (originalPrefix.rounds + (2 : ℕ)) := + fun (i : Fin (ett.rounds + (1 : ℕ))) ↦ Fin.cast (by omega) i; + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) + (ett.series.data.coloring i.succ) (finalSeries.data.coloring i.succ) + +/-- Dependent contract shared by the revisiting terminal reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev terminalContinuationStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) (sigma : PartialEdgeColoring E k) + (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) + (_ : + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) + (Tstar : TreeSequence G e0) + (_ : TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (_ : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) (fstar : E) + (seed : TreeSequence G e0) + (_ : ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ fstar } : Finset E)) + (_ : TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar seed) + (closureTree : TreeSequence G e0) (_ : TashkinovClosure sigma seed closureTree) + (_ : TreeSequenceInitialSegment Tstar closureTree) + (_ : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (_ : q.succ = Fin.last ett.rounds) + (_ : q.castSucc = (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ)))) + (_ : TreeSequence G e0) (_ : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (_ : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (_ : + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc))) + (available : RevisitingExtensionCertificate ett.series.data q.castSucc) + (_ : + ett.series.data.stored q.succ = + (insert available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k))) + (_ : ett.series.data.connectingEdges q.succ = ({ available.edge } : Finset E)) + (_ : ett.series.data.kind q.succ = some TashkinovExtensionKind.RE) + (hroundLarge : (1 : ℕ) < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (_ : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (2 : ℕ) ≤ ett.rounds + (2 : ℕ)) ↦ (by omega)) + i)) + (_ : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ (by omega)) + i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ (by omega)) + i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ (by omega)) + i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ (by omega)) + i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ (by omega)) + i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (_ : + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (_ : corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigma) + (_ : MaximumProperty corr.replacementETT) + (earlierPrefixBound : (↑available.earlier : ℕ) < originalPrefix.rounds + (1 : ℕ)), + let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : Fin (originalPrefix.rounds + (1 : ℕ))); + ∀ + (_ : + Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ (by omega)) + earlierPrefix = + available.earlier) + (_ : (0 : ℕ) < (↑earlierPrefix : ℕ)) + (_ : corr.replacementSeries.data.kind earlierPrefix = some TashkinovExtensionKind.PE) + (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k) (_ : available.earlier = oldi.succ) (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma : Fin k) (_ : corr.replacementSeries.data.delta newi.succ = some newChoice.color) + (_ : corr.replacementSeries.data.gamma newi.succ = some newGamma) + (_ : newi.succ = earlierPrefix) + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice (Eq.symm htree) oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color) + (_ : + s(oldChoiceOnNew.vertex, oldChoiceOnNew.otherEndpoint) = + s(newChoice.vertex, newChoice.otherEndpoint)) + (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma ≠ newChoice.color) + (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) (_ : newChoice.color = available.delta) + (_ : newGamma = available.gamma), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ + (_ : + Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ (by omega)) + replacementLast = + q.castSucc) + (_ : available.delta ∈ MissingColors G sigma newChoice.vertex) + (_ : available.gamma ≠ available.delta) + (_ : + newChoice.vertex ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (_ : + TwoColorNontrivialPathComponent G sigma available.gamma available.delta + (Sum.inl newChoice.vertex)) + (_ : + ∃ v ∈ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma available.gamma available.delta (Sum.inl newChoice.vertex)) + (_ : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigma), + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma available.gamma available.delta; + ∀ + (returnEdgeTransfer : ∀ edge ∈ available.returnPath.edges, edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := + available.returnPath.transfer sigmaReturnGraph returnEdgeTransfer; + ∀ (_ : sigmaReturnPath.IsPath) + (_ : ∀ (z : V ⊕ E), z ∈ sigmaReturnPath.support ↔ z ∈ available.returnPath.support) + (_ : + Sum.inl available.returnVertex ∈ + TwoColorComponent G sigma available.gamma available.delta (Sum.inr available.edge)) + (_ : + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G sigma available.gamma available.delta (Sum.inr available.edge)) + (_ : + available.returnVertex ∈ + TreeSequenceVertexSet (corr.replacementSeries.data.tree earlierPrefix.castSucc)) + (_ : + available.returnVertex ∈ + TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (_ : + TwoColorComponent G sigma available.gamma available.delta (Sum.inl newChoice.vertex) ≠ + TwoColorComponent G sigma available.gamma available.delta (Sum.inr available.edge)), + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +end GoldbergSeymour.TerminalRebuild + +end diff --git a/LeanPool/GoldbergSeymour/RutgersClosedPresentation.lean b/LeanPool/GoldbergSeymour/RutgersClosedPresentation.lean new file mode 100644 index 0000000000..2f6aec27ff --- /dev/null +++ b/LeanPool/GoldbergSeymour/RutgersClosedPresentation.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.MaximumProperty + +/-! +# Rutgers Closed Presentation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A closed replacement-tree presentation with a corresponding maximum-property extended tree. -/ +structure RutgersClosedPresentation {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) where + /-- The replacement coloring constrained by this certificate. -/ + sigma : PartialEdgeColoring E k + /-- The replacement tree under the new coloring. -/ + U : TreeSequence G e0 + /-- The replacement extended tree with its ladder and coloring agreement certificates. -/ + corresponding : CorrespondingExtendedTashkinovTree G k e0 original sigma U + maximum : MaximumProperty corresponding.replacementETT + terminalRoute : + let replacement := corresponding.replacementETT + let n : Fin (replacement.rounds + 1) := Fin.last replacement.rounds + let Tn : TreeSequence G e0 := replacement.series.data.tree n.castSucc + (replacement.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovClosure sigma Tn U) ∨ + ((replacement.series.data.kind n = some TashkinovExtensionKind.SE ∨ + replacement.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + exists (f : E) (seed : TreeSequence G e0), + replacement.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovClosure sigma seed U) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RutgersCounterexample.lean b/LeanPool/GoldbergSeymour/RutgersCounterexample.lean new file mode 100644 index 0000000000..92b0c1cd78 --- /dev/null +++ b/LeanPool/GoldbergSeymour/RutgersCounterexample.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.RutgersClosedPresentation + +/-! +# Rutgers Counterexample + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Three disjoint ordered exit paths and their boundary edges for a closed replacement +presentation. +-/ +structure RutgersCounterexample {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) where + /-- The distinguished color constrained by the accompanying missing-color conditions. -/ + alpha : Fin k + /-- The second distinguished color in the alternating configuration. -/ + beta : Fin k + colorsDistinct : alpha ≠ beta + alphaMissing : alpha ∈ TreeMissingColors presentation.sigma presentation.U + betaPresent : beta ∉ TreeMissingColors presentation.sigma presentation.U + /-- The outside endpoint of the first exit path. -/ + a1 : V + /-- The inside endpoint of the first exit path. -/ + b1 : V + /-- The outside endpoint of the second exit path. -/ + a2 : V + /-- The inside endpoint of the second exit path. -/ + b2 : V + /-- The outside endpoint of the third exit path. -/ + a3 : V + /-- The inside endpoint of the third exit path. -/ + b3 : V + /-- The first two-color exit walk. -/ + Q1 : (TwoColorIncidenceGraph G presentation.sigma alpha beta).Walk (Sum.inl a1) (Sum.inl b1) + /-- The second two-color exit walk. -/ + Q2 : (TwoColorIncidenceGraph G presentation.sigma alpha beta).Walk (Sum.inl a2) (Sum.inl b2) + /-- The third two-color exit walk. -/ + Q3 : (TwoColorIncidenceGraph G presentation.sigma alpha beta).Walk (Sum.inl a3) (Sum.inl b3) + /-- The first selected boundary edge. -/ + f1 : E + /-- The second selected boundary edge. -/ + f2 : E + /-- The third selected boundary edge. -/ + f3 : E + exit1 : TreeExitPath presentation.U presentation.sigma alpha beta a1 b1 Q1 + exit2 : TreeExitPath presentation.U presentation.sigma alpha beta a2 b2 Q2 + exit3 : TreeExitPath presentation.U presentation.sigma alpha beta a3 b3 Q3 + supportDisjoint12 : ∀ x, x ∈ Q1.support → x ∉ Q2.support + supportDisjoint13 : ∀ x, x ∈ Q1.support → x ∉ Q3.support + supportDisjoint23 : ∀ x, x ∈ Q2.support → x ∉ Q3.support + outsideDistinct12 : a1 ≠ a2 + outsideDistinct13 : a1 ≠ a3 + outsideDistinct23 : a2 ≠ a3 + insideDistinct12 : b1 ≠ b2 + insideDistinct13 : b1 ≠ b3 + insideDistinct23 : b2 ≠ b3 + insideOrder12 : TreeVertexOrder presentation.U b1 b2 + insideOrder23 : TreeVertexOrder presentation.U b2 b3 + boundary1 : + f1 ∈ BoundaryColorEdges G presentation.sigma (TreeSequenceVertexSet presentation.U) beta + boundary2 : + f2 ∈ BoundaryColorEdges G presentation.sigma (TreeSequenceVertexSet presentation.U) beta + boundary3 : + f3 ∈ BoundaryColorEdges G presentation.sigma (TreeSequenceVertexSet presentation.U) beta + incident1 : Incident G b1 f1 + incident2 : Incident G b2 f2 + incident3 : Incident G b3 f3 + edgeOnWalk1 : Sum.inr f1 ∈ Q1.support + edgeOnWalk2 : Sum.inr f2 ∈ Q2.support + edgeOnWalk3 : Sum.inr f3 ∈ Q3.support + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RutgersCounterexampleMeasure.lean b/LeanPool/GoldbergSeymour/RutgersCounterexampleMeasure.lean new file mode 100644 index 0000000000..4d65f5a7c4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/RutgersCounterexampleMeasure.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.RutgersCounterexample + +/-! +# Rutgers Counterexample Measure + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The sum of the lengths of the three exit walks in a Rutgers counterexample. -/ +def RutgersCounterexampleMeasure {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + {original : ExtendedTashkinovTree G k e0 input T generating} + {presentation : RutgersClosedPresentation G k e0 original} + (counterexample : RutgersCounterexample G k e0 original presentation) : Nat := + counterexample.Q1.length + counterexample.Q2.length + counterexample.Q3.length + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RutgersCounterexampleMinimumExists.lean b/LeanPool/GoldbergSeymour/RutgersCounterexampleMinimumExists.lean new file mode 100644 index 0000000000..8201f53ea0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/RutgersCounterexampleMinimumExists.lean @@ -0,0 +1,182 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport + +public import LeanPool.GoldbergSeymour.OrderedExitCounterexample +public import LeanPool.GoldbergSeymour.TerminalStableRoute + +public import LeanPool.GoldbergSeymour.RutgersCounterexampleMeasure + +/-! +# Rutgers Counterexample Minimum Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem RutgersCounterexampleMinimumExists + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (original : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty original) + (hcurrentOne : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = original.rounds -> MaximumProperty current -> + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hcurrentSix : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = original.rounds -> MaximumProperty current -> + let n : Fin (current.rounds + 1) := Fin.last current.rounds + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tn + (TashkinovStoredColors current.series.data n) + (current.series.data.coloring n) sigma -> + ModColoring current sigma) + (sigma : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : StableColoring + (original.series.data.tree (Fin.last (original.rounds + 1))) + (TashkinovStoredColors original.series.data + (Fin.last original.rounds)) + (original.series.data.coloring (Fin.last original.rounds)) sigma) + (alpha beta : Fin k) (hcolors : alpha ≠ beta) + (halpha : alpha ∈ TreeMissingColors sigma + (original.series.data.tree (Fin.last (original.rounds + 1)))) + (hnot : ¬ TreeInterchangeable G + (original.series.data.tree (Fin.last (original.rounds + 1))) + sigma alpha beta) : + exists (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : + RutgersCounterexample G k e0 original presentation), + forall (otherPresentation : + RutgersClosedPresentation G k e0 original) + (otherCounterexample : + RutgersCounterexample G k e0 original otherPresentation), + RutgersCounterexampleMeasure counterexample <= + RutgersCounterexampleMeasure otherCounterexample := by + classical + let F := original.series.data.tree (Fin.last (original.rounds + 1)) + obtain ⟨_, _, hsegment, hstrict, hterminalStable, hroute⟩ := + P2647_T1_TerminalStableRoute G k e0 original sigma hproper hone hstable + have hmod : ModColoring original sigma := + hcurrentSix original rfl hMP sigma hproper hone hterminalStable + have eligible : + (original.series.data.kind (Fin.last original.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma + (original.series.data.tree (Fin.last original.rounds).castSucc) F) ∨ + ((original.series.data.kind (Fin.last original.rounds) = + some TashkinovExtensionKind.SE ∨ + original.series.data.kind (Fin.last original.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + original.series.data.connectingEdges (Fin.last original.rounds) = {f} ∧ + TreeSequenceAdjoinEdge + (original.series.data.tree (Fin.last original.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed F) := by + rcases hroute with ⟨hkind, hclosure⟩ | ⟨hkind, f, seed, hedge, hadjoin, hclosure⟩ + · exact Or.inl ⟨hkind, hclosure.1⟩ + · exact Or.inr ⟨hkind, f, seed, hedge, hadjoin, hclosure.1⟩ + obtain ⟨corr⟩ := hmod.2.2 F hsegment hstrict eligible + have hmaximum := MaximumPropertyTransport G k e0 original sigma hmod F corr hMP + have replacementRoute : + let replacement := corr.replacementETT + let n := Fin.last replacement.rounds + let Tn := replacement.series.data.tree n.castSucc + (replacement.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovClosure sigma Tn F) ∨ + ((replacement.series.data.kind n = some TashkinovExtensionKind.SE ∨ + replacement.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + replacement.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovClosure sigma seed F) := by + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have seriesSame : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases seriesSame + let q : Fin original.rounds := ⟨original.rounds - 1, by + have := original.roundsPositive + omega⟩ + have hq : q.succ = Fin.last original.rounds := by + apply Fin.ext + dsimp [q] + have := original.roundsPositive + omega + have ladderEq : replacementSeries.data.tree + (Fin.last original.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc := by + rw [← hq] + exact ladderTreesAgree q + dsimp + simpa only [ladderEq, extensionKindsAgree, connectingEdgesAgree] using hroute + let presentation : RutgersClosedPresentation G k e0 original := + ⟨sigma, F, corr, hmaximum, replacementRoute⟩ + have hsigma : presentation.sigma = sigma := rfl + have hU : presentation.U = F := rfl + have helementary : ColoredVertexSetElementary G presentation.sigma + (TreeSequenceVertexSet presentation.U) := + hcurrentOne presentation.corresponding.replacementETT + presentation.corresponding.rungAgreement presentation.maximum + have hclosed : ColoredVertexSetClosed G presentation.sigma + (TreeSequenceVertexSet presentation.U) := by + rcases presentation.terminalRoute with ⟨_, hclosure⟩ | + ⟨_, f, seed, _, _, hclosure⟩ + · exact hclosure.2 + · exact hclosure.2 + have hproperPresentation : IsProperEdgeColoring G presentation.sigma := by + rw [hsigma] + exact hproper + have halphaPresentation : + alpha ∈ TreeMissingColors presentation.sigma presentation.U := by + rw [hsigma, hU] + exact halpha + have hnotPresentation : + ¬ TreeInterchangeable G presentation.U presentation.sigma alpha beta := by + rw [hsigma, hU] + exact hnot + obtain ⟨counterexample, _, _⟩ := + P2647_T1_OrderedExitCounterexample G k e0 original presentation + hproperPresentation helementary hclosed alpha beta hcolors + halphaPresentation hnotPresentation + let attainable : Nat → Prop := fun m => + ∃ (P : RutgersClosedPresentation G k e0 original) + (C : RutgersCounterexample G k e0 original P), + RutgersCounterexampleMeasure C = m + have inhabited : ∃ m, attainable m := + ⟨RutgersCounterexampleMeasure counterexample, presentation, counterexample, rfl⟩ + obtain ⟨minimumPresentation, minimumCounterexample, hmeasure⟩ := + Nat.find_spec inhabited + refine ⟨minimumPresentation, minimumCounterexample, ?_⟩ + intro otherPresentation otherCounterexample + rw [hmeasure] + exact Nat.find_min' inhabited ⟨otherPresentation, otherCounterexample, rfl⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RutgersCurrentRungInterchangeability.lean b/LeanPool/GoldbergSeymour/RutgersCurrentRungInterchangeability.lean new file mode 100644 index 0000000000..b4fb1d6d1a --- /dev/null +++ b/LeanPool/GoldbergSeymour/RutgersCurrentRungInterchangeability.lean @@ -0,0 +1,219 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.RutgersCounterexampleMinimumExists +public import LeanPool.GoldbergSeymour.RutgersMiddleExitOutsideTerminalLadder +public import LeanPool.GoldbergSeymour.RutgersStrictShortening + +/-! +# Rutgers Current Rung Interchangeability + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem RutgersCurrentRungInterchangeability + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty original) + (hdegree : MaximumDegree G + 1 <= k) + (hcurrentOne : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = original.rounds -> MaximumProperty current -> + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hcurrentFour : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = original.rounds -> MaximumProperty current -> + let terminal : Fin (current.rounds + 1) := Fin.last current.rounds + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc + forall (v : V) (gamma delta : Fin k), + current.series.data.kind terminal = + some TashkinovExtensionKind.PE -> + current.series.data.chosenVertex terminal = some v -> + current.series.data.gamma terminal = some gamma -> + current.series.data.delta terminal = some delta -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma -> + forall w, w ∈ TreeSequenceVertexSet Tterminal -> + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) <-> w = v)) + (hcurrentSix : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = original.rounds -> MaximumProperty current -> + let terminal : Fin (current.rounds + 1) := Fin.last current.rounds + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma -> + ModColoring current sigma) + (hlowerTwo : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < lower.rounds -> lower.rounds < original.rounds -> + MaximumProperty lower -> + let terminal : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tnext : TreeSequence G e0 := + lower.series.data.tree (Fin.last (lower.rounds + 1)) + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tnext + (TashkinovStoredColors lower.series.data terminal) + (lower.series.data.coloring terminal) sigma -> + forall alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma Tnext ∨ + beta ∈ TreeMissingColors sigma Tnext) -> + TreeInterchangeable G Tnext sigma alpha beta) : + let terminal : Fin (original.rounds + 1) := Fin.last original.rounds + let Tnext : TreeSequence G e0 := + original.series.data.tree (Fin.last (original.rounds + 1)) + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tnext + (TashkinovStoredColors original.series.data terminal) + (original.series.data.coloring terminal) sigma -> + forall alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma Tnext ∨ + beta ∈ TreeMissingColors sigma Tnext) -> + TreeInterchangeable G Tnext sigma alpha beta := by + classical + dsimp + intro sigma hproper hone hstable alpha beta hmissing + have graphSwap : + TwoColorIncidenceGraph G sigma alpha beta = + TwoColorIncidenceGraph G sigma beta alpha := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + have componentSwap (z : Sum V E) : + TwoColorComponent G sigma alpha beta z = + TwoColorComponent G sigma beta alpha z := by + unfold TwoColorComponent + rw [graphSwap] + have pathSwap (z : Sum V E) : + TwoColorPathComponent G sigma alpha beta z ↔ + TwoColorPathComponent G sigma beta alpha z := by + simp [TwoColorPathComponent, componentSwap, graphSwap, ne_comm] + have interchangeSwap : + TreeInterchangeable G + (original.series.data.tree (Fin.last (original.rounds + 1))) + sigma alpha beta ↔ + TreeInterchangeable G + (original.series.data.tree (Fin.last (original.rounds + 1))) + sigma beta alpha := by + constructor + · intro h z w hz hw hzT hwT + have hz' : TwoColorPathComponent G sigma alpha beta z := + pathSwap z |>.mpr hz + have hw' : TwoColorPathComponent G sigma alpha beta w := + pathSwap w |>.mpr hw + have hzT' : ∃ v ∈ TreeSequenceVertexSet + (original.series.data.tree (Fin.last (original.rounds + 1))), + Sum.inl v ∈ TwoColorComponent G sigma alpha beta z := by + obtain ⟨v, hv, hvz⟩ := hzT + exact ⟨v, hv, by rw [componentSwap z]; exact hvz⟩ + have hwT' : ∃ v ∈ TreeSequenceVertexSet + (original.series.data.tree (Fin.last (original.rounds + 1))), + Sum.inl v ∈ TwoColorComponent G sigma alpha beta w := by + obtain ⟨v, hv, hvw⟩ := hwT + exact ⟨v, hv, by rw [componentSwap w]; exact hvw⟩ + have result := h z w hz' hw' hzT' hwT' + exact (componentSwap z).symm.trans + (result.trans (componentSwap w)) + · intro h z w hz hw hzT hwT + have hz' : TwoColorPathComponent G sigma beta alpha z := + pathSwap z |>.mp hz + have hw' : TwoColorPathComponent G sigma beta alpha w := + pathSwap w |>.mp hw + have hzT' : ∃ v ∈ TreeSequenceVertexSet + (original.series.data.tree (Fin.last (original.rounds + 1))), + Sum.inl v ∈ TwoColorComponent G sigma beta alpha z := by + obtain ⟨v, hv, hvz⟩ := hzT + exact ⟨v, hv, by rw [componentSwap z] at hvz; exact hvz⟩ + have hwT' : ∃ v ∈ TreeSequenceVertexSet + (original.series.data.tree (Fin.last (original.rounds + 1))), + Sum.inl v ∈ TwoColorComponent G sigma beta alpha w := by + obtain ⟨v, hv, hvw⟩ := hwT + exact ⟨v, hv, by rw [componentSwap w] at hvw; exact hvw⟩ + have result := h z w hz' hw' hzT' hwT' + exact (componentSwap z).trans + (result.trans (componentSwap w).symm) + by_cases heq : alpha = beta + · subst alpha + simp [TreeInterchangeable, TwoColorPathComponent] + by_cases halpha : alpha ∈ TreeMissingColors sigma + (original.series.data.tree (Fin.last (original.rounds + 1))) + · by_contra hnot + obtain ⟨presentation, counterexample, hminimum⟩ := + RutgersCounterexampleMinimumExists G k e0 + (input := _) (T := _) (generating := _) original hMP + hcurrentOne hcurrentSix sigma hproper hone hstable alpha beta heq + halpha hnot + have helementary : + ColoredVertexSetElementary G presentation.sigma + (TreeSequenceVertexSet presentation.U) := by + apply hcurrentOne presentation.corresponding.replacementETT + · exact presentation.corresponding.rungAgreement + · exact presentation.maximum + have houtside := RutgersMiddleExitOutsideTerminalLadder G k e0 original + hdegree hcurrentFour hlowerTwo presentation counterexample helementary + obtain ⟨newPresentation, newCounterexample, hshort⟩ := + RutgersStrictShortening G k e0 original hdegree hcurrentOne hcurrentSix + presentation counterexample houtside + have hweak := hminimum newPresentation newCounterexample + exact (Nat.not_lt_of_ge hweak) hshort + · have hbeta : beta ∈ TreeMissingColors sigma + (original.series.data.tree (Fin.last (original.rounds + 1))) := by + exact hmissing.resolve_left halpha + by_contra hnot + have hnotSwap : ¬ TreeInterchangeable G + (original.series.data.tree (Fin.last (original.rounds + 1))) + sigma beta alpha := by + intro hs + exact hnot (interchangeSwap.mpr hs) + obtain ⟨presentation, counterexample, hminimum⟩ := + RutgersCounterexampleMinimumExists G k e0 + (input := _) (T := _) (generating := _) original hMP + hcurrentOne hcurrentSix sigma hproper hone hstable beta alpha + (by intro h; exact heq h.symm) + hbeta hnotSwap + have helementary : + ColoredVertexSetElementary G presentation.sigma + (TreeSequenceVertexSet presentation.U) := by + apply hcurrentOne presentation.corresponding.replacementETT + · exact presentation.corresponding.rungAgreement + · exact presentation.maximum + have houtside := RutgersMiddleExitOutsideTerminalLadder G k e0 original + hdegree hcurrentFour hlowerTwo presentation counterexample helementary + obtain ⟨newPresentation, newCounterexample, hshort⟩ := + RutgersStrictShortening G k e0 original hdegree hcurrentOne hcurrentSix + presentation counterexample houtside + have hweak := hminimum newPresentation newCounterexample + exfalso + exact (Nat.not_lt_of_ge hweak) hshort + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RutgersMiddleExitOutsideTerminalLadder.lean b/LeanPool/GoldbergSeymour/RutgersMiddleExitOutsideTerminalLadder.lean new file mode 100644 index 0000000000..72616cde2d --- /dev/null +++ b/LeanPool/GoldbergSeymour/RutgersMiddleExitOutsideTerminalLadder.lean @@ -0,0 +1,1404 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RutgersClosedPresentation +public import LeanPool.GoldbergSeymour.RutgersCounterexample +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeMissingColorsCardLowerBound +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapDisjointPairGraph +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Rutgers Middle Exit Outside Terminal Ladder + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch661Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (_ : ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating') (_ : current.rounds = original.rounds) (_ : MaximumProperty current), + let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := current.series.data.tree terminal.castSucc; + ∀ (v : V) (gamma delta : Fin k) (_ : current.series.data.kind terminal = some + TashkinovExtensionKind.PE) (_ : current.series.data.chosenVertex terminal = some v) (_ : + current.series.data.gamma terminal = some gamma) (_ : current.series.data.delta terminal = + some delta) (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : + IsOneEdgeUncolored sigma e0) (_ : StableColoring Tterminal (TashkinovStoredColors + current.series.data terminal) (current.series.data.coloring terminal) sigma), + ∀ w ∈ TreeSequenceVertexSet Tterminal, Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) ↔ w = v)) (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + ∀ (_ : q.succ = Fin.last R.rounds), + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + let beta : Fin k := counterexample.beta; + ∀ (_ : R.series.data.coloring q.succ = sigma) (_ : TreeSequenceVertexSet N ⊆ + TreeSequenceVertexSet U), + let forbidden : Finset (Fin k) := (R.series.data.gamma q.succ).toFinset ∪ (R.series.data.delta + q.succ).toFinset; + ∀ c ∈ TreeMissingColors sigma N \ forbidden, c ∈ TreeMissingColors sigma N → c ∉ forbidden → c + ∈ TreeMissingColors sigma U → c ≠ beta → ( + ∀ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho → IsOneEdgeUncolored rho e0 → + StableColoring N (TashkinovStoredColors R.series.data q.castSucc) (R.series.data.coloring + q.castSucc) rho → c ∈ TreeMissingColors rho N → TreeInterchangeable G N rho c beta) → ( + ∀ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho → c ∈ TreeMissingColors rho N → + ∀ (P1 : (TwoColorIncidenceGraph G rho c beta).Walk (Sum.inl counterexample.a1) (Sum.inl + counterexample.b1)) (P2 : (TwoColorIncidenceGraph G rho c beta).Walk (Sum.inl + counterexample.a2) (Sum.inl counterexample.b2)), TreeExitPath N rho c beta + counterexample.a1 counterexample.b1 P1 → TreeExitPath N rho c beta counterexample.a2 + counterexample.b2 P2 → ¬TreeInterchangeable G N rho c beta) → + let mu : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma alpha c; IsProperEdgeColoring + G mu → IsOneEdgeUncolored mu e0 → StableColoring U (TashkinovStoredColors R.series.data + q.succ) sigma mu → ( + ∀ (f : E), TreeIncidentEdge U f → mu f = sigma f) → StableColoring N (TashkinovStoredColors + R.series.data q.succ) (R.series.data.coloring q.succ) mu → c ∈ TreeMissingColors mu N → ( + ∀ (f : E), ¬TreeIncidentEdge U f → (mu f = some c → sigma f = some alpha) ∧ (mu f = some beta + ↔ sigma f = some beta)) → ( + ∀ {v : V}, v ∉ TreeSequenceVertexSet U → alpha ∈ MissingColors G sigma v ∨ beta ∈ + MissingColors G sigma v → c ∈ MissingColors G mu v ∨ beta ∈ MissingColors G mu v) → ( + ∀ {a b : V} (P : (TwoColorIncidenceGraph G sigma alpha beta).Walk (Sum.inl a) (Sum.inl b)), + TreeExitPath U sigma alpha beta a b P → b ∈ TreeSequenceVertexSet N → + ∃ (Q : (TwoColorIncidenceGraph G mu c beta).Walk (Sum.inl a) (Sum.inl b)), TreeExitPath N mu c + beta a b Q) → + ∀ (P1 : (TwoColorIncidenceGraph G mu c beta).Walk (Sum.inl counterexample.a1) (Sum.inl + counterexample.b1)), TreeExitPath N mu c beta counterexample.a1 counterexample.b1 P1 → + ∀ (P2 : (TwoColorIncidenceGraph G mu c beta).Walk (Sum.inl counterexample.a2) (Sum.inl + counterexample.b2)), TreeExitPath N mu c beta counterexample.a2 counterexample.b2 P2 → + ¬TreeInterchangeable G N mu c beta → ( + ∀ (phi : PartialEdgeColoring E k) (D : Finset (Fin k)), StableColoring N D phi sigma → + StableColoring N D phi mu) → counterexample.f1 ∈ BoundaryColorEdges G sigma + (TreeSequenceVertexSet N) beta → counterexample.f2 ∈ BoundaryColorEdges G sigma + (TreeSequenceVertexSet N) beta → counterexample.f1 ≠ counterexample.f2 → + ∀ (i : Fin R.rounds), IsProperEdgeColoring G (R.series.data.coloring i.castSucc) → + IsOneEdgeUncolored (R.series.data.coloring i.castSucc) e0 → ColoredVertexSetClosed G + (R.series.data.coloring i.castSucc) (TreeSequenceVertexSet (R.series.data.tree + i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (R.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (R.series.data.tree i.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate R.series.data i.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (R.series.data.tree i.succ.castSucc) + (TashkinovStoredColors R.series.data i.castSucc) (R.series.data.coloring i.castSucc)), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (R.series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors R.series.data i.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (R.series.data.tree + i.succ.castSucc))) → + ∀ (gamma : Fin k), ParallelExtensionColor R.series.data i.castSucc choice.selected + choice.vertex gamma → + ∀ (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + StableColoring (R.series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors R.series.data i.castSucc)) choice.selected secondStable → TreeExit + (R.series.data.tree i.succ.castSucc) secondStable gamma choice.color choice.vertex → + R.series.data.coloring i.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) → IsProperEdgeColoring G (R.series.data.coloring i.succ) → + IsOneEdgeUncolored (R.series.data.coloring i.succ) e0 → R.series.data.stored i.succ = + { choice.color, gamma } → R.series.data.connectingEdges i.succ = { choice.edge } → + R.series.data.kind i.succ = some TashkinovExtensionKind.PE → R.series.data.chosenVertex + i.succ = some choice.vertex → R.series.data.outsideVertex i.succ = some + choice.otherEndpoint → R.series.data.delta i.succ = some choice.color → + R.series.data.gamma i.succ = some gamma → TashkinovClosure (R.series.data.coloring i.succ) + (R.series.data.tree i.succ.castSucc) (R.series.data.tree i.succ.succ) → + TreeSequenceInitialSegment (R.series.data.tree i.succ.castSucc) (R.series.data.tree + i.succ.succ) → (R.series.data.tree i.succ.castSucc).length < (R.series.data.tree + i.succ.succ).length → q.succ = i.succ → False + +private abbrev helperContinuation1450Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (_ : ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (current : ExtendedTashkinovTree G k e0 input' T' + generating') (_ : current.rounds = original.rounds) (_ : MaximumProperty current), + let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := current.series.data.tree terminal.castSucc; + ∀ (v : V) (gamma delta : Fin k) (_ : current.series.data.kind terminal = some + TashkinovExtensionKind.PE) (_ : current.series.data.chosenVertex terminal = some v) (_ : + current.series.data.gamma terminal = some gamma) (_ : current.series.data.delta terminal = + some delta) (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : + IsOneEdgeUncolored sigma e0) (_ : StableColoring Tterminal (TashkinovStoredColors + current.series.data terminal) (current.series.data.coloring terminal) sigma), + ∀ w ∈ TreeSequenceVertexSet Tterminal, Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) ↔ w = v)) (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + ∀ (_ : q.succ = Fin.last R.rounds), + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + let beta : Fin k := counterexample.beta; + ∀ (_ : R.series.data.coloring q.succ = sigma) (_ : counterexample.b2 ∈ TreeSequenceVertexSet + N) (_ : TreeSequenceInitialSegment N U ∧ ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet U)) (_ : TreeSequenceVertexSet N ⊆ TreeSequenceVertexSet U) (_ : + counterexample.b1 ∈ TreeSequenceVertexSet N), + let forbidden : Finset (Fin k) := (R.series.data.gamma q.succ).toFinset ∪ (R.series.data.delta + q.succ).toFinset; + ∀ c ∈ TreeMissingColors sigma N \ forbidden, c ∈ TreeMissingColors sigma N → c ∉ forbidden → c + ∈ TreeMissingColors sigma U → c ≠ beta → alpha ≠ beta → ( + ∀ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho → IsOneEdgeUncolored rho e0 → + StableColoring N (TashkinovStoredColors R.series.data q.castSucc) (R.series.data.coloring + q.castSucc) rho → c ∈ TreeMissingColors rho N → TreeInterchangeable G N rho c beta) → ( + ∀ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho → c ∈ TreeMissingColors rho N → + ∀ (P1 : (TwoColorIncidenceGraph G rho c beta).Walk (Sum.inl counterexample.a1) (Sum.inl + counterexample.b1)) (P2 : (TwoColorIncidenceGraph G rho c beta).Walk (Sum.inl + counterexample.a2) (Sum.inl counterexample.b2)), TreeExitPath N rho c beta + counterexample.a1 counterexample.b1 P1 → TreeExitPath N rho c beta counterexample.a2 + counterexample.b2 P2 → ¬TreeInterchangeable G N rho c beta) → + let mu : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma alpha c; IsProperEdgeColoring + G mu → IsOneEdgeUncolored mu e0 → StableColoring U (TashkinovStoredColors R.series.data + q.succ) sigma mu → ( + ∀ (f : E), TreeIncidentEdge U f → mu f = sigma f) → StableColoring N (TashkinovStoredColors + R.series.data q.succ) (R.series.data.coloring q.succ) mu → c ∈ TreeMissingColors mu N → + False + +private theorem helper_lowerInterchangeable_228.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (_ : ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating') (_ : (0 : ℕ) < lower.rounds) (_ : lower.rounds < original.rounds) (_ : + MaximumProperty lower), + let terminal : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + let Tnext : TreeSequence G e0 := lower.series.data.tree (Fin.last (lower.rounds + (1 : ℕ))); + ∀ (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored + sigma e0) (_ : StableColoring Tnext (TashkinovStoredColors lower.series.data terminal) + (lower.series.data.coloring terminal) sigma) (alpha beta : Fin k) (_ : alpha ∈ + TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma Tnext), TreeInterchangeable + G Tnext sigma alpha beta)) (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let _ : TreeSequence G e0 := presentation.U; + let beta : Fin k := counterexample.beta; + let forbidden : Finset (Fin k) := (R.series.data.gamma q.succ).toFinset ∪ (R.series.data.delta + q.succ).toFinset; + ∀ c ∈ TreeMissingColors sigma N \ forbidden, + ∀ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho → IsOneEdgeUncolored rho e0 → + StableColoring N (TashkinovStoredColors R.series.data q.castSucc) (R.series.data.coloring + q.castSucc) rho → c ∈ TreeMissingColors rho N → TreeInterchangeable G N rho c beta := by + classical + intro V E _ _ _ _ G k e0 input T generating original hlowerTwo presentation counterexample R q + N sigma U beta forbidden c hc rho hp ho hs hc + by_cases hn : R.rounds = 1 + · have hi : q.succ.castSucc = (⟨1, by omega⟩ : Fin (R.rounds + 2)) := by + apply Fin.ext + simp [q, hn] + have hz : q.castSucc = (0 : Fin (R.rounds + 1)) := by + apply Fin.ext + simp [q, hn] + have hb := (TechnicalTheoremBase G k R.rounds e0 + presentation.corresponding.replacementInput R.series).2 + dsimp only at hb + have hs' : StableColoring (R.series.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors R.series.data 0) (R.series.data.coloring 0) rho := by + simpa only [N, hi, hz] using hs + have ht := hb rho hp ho hs' c beta + (Or.inl (by simpa only [N, hi] using hc)) + simpa only [N, hi] using ht + · have hn' : 1 < R.rounds := by have := R.roundsPositive; omega + obtain ⟨lower, hr, hmp, htrees, hdata⟩ := + CertifiedETTPredecessor G k e0 presentation.corresponding.replacementInput + U sigma R presentation.maximum hn' + let lt : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hcast : Fin.castLE (by omega) lt = q.castSucc := by + apply Fin.ext + simp [lt, q, hr] + have ht : lower.series.data.tree (Fin.last (lower.rounds + 1)) = N := by + rw [htrees] + congr 1 + apply Fin.ext + simp [hr, q] + obtain ⟨hco, _, _, _, _, _, _, _, hst, _⟩ := hdata lt + have hs' : StableColoring + (lower.series.data.tree (Fin.last (lower.rounds + 1))) + (TashkinovStoredColors lower.series.data lt) + (lower.series.data.coloring lt) rho := by + rw [ht, hco, hst, hcast] + exact hs + have hh := hlowerTwo lower (by omega) + (by + have := presentation.corresponding.rungAgreement + change R.rounds = original.rounds at this + omega) hmp + dsimp only at hh + have hi := hh rho hp ho hs' c beta (Or.inl (by simpa only [ht] using hc)) + simpa only [ht] using hi + +private theorem helper_noninterchangeable_276.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let beta : Fin k := counterexample.beta; + ∀ (_ : counterexample.b2 ∈ TreeSequenceVertexSet N) (_ : counterexample.b1 ∈ + TreeSequenceVertexSet N), + let forbidden : Finset (Fin k) := (R.series.data.gamma q.succ).toFinset ∪ (R.series.data.delta + q.succ).toFinset; + ∀ c ∈ TreeMissingColors sigma N \ forbidden, c ≠ beta → + ∀ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho → c ∈ TreeMissingColors rho N → + ∀ (P1 : (TwoColorIncidenceGraph G rho c beta).Walk (Sum.inl counterexample.a1) (Sum.inl + counterexample.b1)) (P2 : (TwoColorIncidenceGraph G rho c beta).Walk (Sum.inl + counterexample.a2) (Sum.inl counterexample.b2)), TreeExitPath N rho c beta + counterexample.a1 counterexample.b1 P1 → TreeExitPath N rho c beta counterexample.a2 + counterexample.b2 P2 → ¬TreeInterchangeable G N rho c beta := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R q N sigma + beta hb2 hb1 forbidden c hc hcb rho hp hc P1 P2 he1 he2 hinter + let H := TwoColorIncidenceGraph G rho c beta + have leaf (x : V) (hm : c ∈ MissingColors G rho x ∨ beta ∈ MissingColors G rho x) : + Set.Subsingleton (H.neighborSet (Sum.inl x)) := by + intro z hz w hw + cases z with + | inl y => simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz + | inr e => + cases w with + | inl y => simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw + | inr f => + have he : Incident G x e ∧ (rho e = some c ∨ rho e = some beta) := by + simpa [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] using hz + have hf : Incident G x f ∧ (rho f = some c ∨ rho f = some beta) := by + simpa [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] using hw + apply congrArg Sum.inr + by_contra hef + have absent (d : Fin k) (hd : d ∈ MissingColors G rho x) : + ∀ e, Incident G x e → rho e ≠ some d := by + intro e he hco + have hn : d ∉ PresentColors G rho x := by simpa [MissingColors] using hd + exact hn (by simpa [PresentColors] using + (show ∃ f, Incident G x f ∧ rho f = some d from ⟨e, he, hco⟩)) + rcases hm with hm | hm + · exact (hp hef ⟨x, he.1, hf.1⟩ + (he.2.resolve_left (absent c hm e he.1))) + (hf.2.resolve_left (absent c hm f hf.1)) + · exact (hp hef ⟨x, he.1, hf.1⟩ + (he.2.resolve_right (absent beta hm e he.1))) + (hf.2.resolve_right (absent beta hm f hf.1)) + obtain ⟨x, hx, hcx⟩ : ∃ x ∈ TreeSequenceVertexSet N, c ∈ MissingColors G rho x := by + simpa [TreeMissingColors] using hc + have self (v : V) : Sum.inl v ∈ TwoColorComponent G rho c beta (Sum.inl v) := + (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + have lx := leaf x (Or.inl hcx) + have l1 := leaf counterexample.a1 he1.2.2.2.2.1 + have l2 := leaf counterexample.a2 he2.2.2.2.2.1 + have px : TwoColorPathComponent G rho c beta (Sum.inl x) := + ⟨hcb, Sum.inl x, self x, lx⟩ + have p1 : TwoColorPathComponent G rho c beta (Sum.inl counterexample.a1) := + ⟨hcb, Sum.inl counterexample.a1, self _, l1⟩ + have p2 : TwoColorPathComponent G rho c beta (Sum.inl counterexample.a2) := + ⟨hcb, Sum.inl counterexample.a2, self _, l2⟩ + have meet1 : Sum.inl counterexample.b1 ∈ + TwoColorComponent G rho c beta (Sum.inl counterexample.a1) := by + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr + (SimpleGraph.ConnectedComponent.eq.mpr P1.reachable.symm) + have meet2 : Sum.inl counterexample.b2 ∈ + TwoColorComponent G rho c beta (Sum.inl counterexample.a2) := by + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr + (SimpleGraph.ConnectedComponent.eq.mpr P2.reachable.symm) + have eq1 := hinter (Sum.inl x) (Sum.inl counterexample.a1) px p1 + ⟨x, hx, self x⟩ ⟨counterexample.b1, hb1, meet1⟩ + have eq2 := hinter (Sum.inl x) (Sum.inl counterexample.a2) px p2 + ⟨x, hx, self x⟩ ⟨counterexample.b2, hb2, meet2⟩ + obtain ⟨u, v, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G rho c beta hp (Sum.inl x) + have endpoint (w : V) (hw : Sum.inl w ∈ TwoColorComponent G rho c beta (Sum.inl x)) + (hl : Set.Subsingleton (H.neighborSet (Sum.inl w))) : + Sum.inl w = u ∨ Sum.inl w = v := by + by_contra hn + push Not at hn + apply hp.isTrail.notMem_support_of_subsingleton_neighborSet hn.1 hn.2 hl + change Sum.inl w ∈ {z | z ∈ p.support} + rw [hsupport] + exact hw + have ex := endpoint x (self x) lx + have e1 := endpoint counterexample.a1 (by rw [eq1]; exact self _) l1 + have e2 := endpoint counterexample.a2 (by rw [eq2]; exact self _) l2 + have hx1 : (Sum.inl x : Sum V E) ≠ Sum.inl counterexample.a1 := by + intro heq + exact he1.2.2.1 ((Sum.inl.inj heq) ▸ hx) + have hx2 : (Sum.inl x : Sum V E) ≠ Sum.inl counterexample.a2 := by + intro heq + exact he2.2.2.1 ((Sum.inl.inj heq) ▸ hx) + have ha12 : (Sum.inl counterexample.a1 : Sum V E) ≠ Sum.inl counterexample.a2 := by + simpa using counterexample.outsideDistinct12 + rcases ex with ex | ex + · rcases e1 with e1 | e1 + · exact hx1 (ex.trans e1.symm) + · rcases e2 with e2 | e2 + · exact hx2 (ex.trans e2.symm) + · exact ha12 (e1.trans e2.symm) + · rcases e1 with e1 | e1 + · rcases e2 with e2 | e2 + · exact ha12 (e1.trans e2.symm) + · exact hx2 (ex.trans e2.symm) + · exact hx1 (ex.trans e1.symm) + +private theorem helper_path_boundary_419.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + let beta : Fin k := counterexample.beta; + ∀ (_ : ( + ∀ {z : Sym2 V} {x y : V} (_ : x ∈ z) (_ : y ∈ z) (_ : x ≠ y), z = s(x, y))) {a b : V} (P : + (TwoColorIncidenceGraph G sigma alpha beta).Walk (Sum.inl a) (Sum.inl b)) (_ : + TreeExitPath U sigma alpha beta a b P) {f : E} (_ : Sum.inr f ∈ P.support) (_ : + TreeIncidentEdge U f), f ∈ BoundaryEdges G (TreeSequenceVertexSet U) := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample sigma U alpha + beta ends_eq_of_mem a b P hexit f hf hftree + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hnpos : 0 < n := by + by_contra h + have hz : n = 0 := by omega + rw [hz] at hn + simp at hn + have hnlt : n < P.length := by + by_contra h + have hz : n = P.length := by omega + rw [hz] at hn + simp at hn + have hprev := P.adj_getVert_succ (i := n - 1) (by omega) + have hnext := P.adj_getVert_succ (i := n) hnlt + have hnsub : n - 1 + 1 = n := by omega + rw [hnsub, hn] at hprev + rw [hn] at hnext + cases hy : P.getVert (n - 1) with + | inr g => + rw [hy] at hprev + simp [TwoColorIncidenceGraph] at hprev + | inl y => + rw [hy] at hprev + cases hz : P.getVert (n + 1) with + | inr g => + rw [hz] at hnext + simp [TwoColorIncidenceGraph] at hnext + | inl z => + rw [hz] at hnext + have hyf : Incident G y f := hprev.1 + have hzf : Incident G z f := hnext.1 + have hyz : y ≠ z := by + intro hyz + have heq : P.getVert (n - 1) = P.getVert (n + 1) := by rw [hy, hz, hyz] + have hleft : n - 1 ≤ P.length := by omega + have hright : n + 1 ≤ P.length := by omega + have hi := hexit.1.getVert_injOn hleft hright heq + omega + have hySupport : Sum.inl y ∈ P.support := by rw [← hy]; exact P.getVert_mem_support _ + have hzSupport : Sum.inl z ∈ P.support := by rw [← hz]; exact P.getVert_mem_support _ + have he : G.ends f = Sym2.mk y z := ends_eq_of_mem hyf hzf hyz + obtain ⟨x, hx, hxf⟩ := hftree + have hxy : x = y ∨ x = z := by simpa [Incident, he] using hxf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + rcases hxy with hxy | hxz + · subst x + refine ⟨y, hx, z, ?_, he⟩ + intro hzT + exact hyz ((hexit.2.2.2.2.2 y hx).mp hySupport |>.trans + ((hexit.2.2.2.2.2 z hzT).mp hzSupport).symm) + · subst x + refine ⟨z, hx, y, ?_, ?_⟩ + · intro hyT + exact hyz ((hexit.2.2.2.2.2 y hyT).mp hySupport |>.trans + ((hexit.2.2.2.2.2 z hx).mp hzSupport).symm) + · exact he.trans (Sym2.eq_swap ..) + +private theorem helper_remote_missing_506.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + let beta : Fin k := counterexample.beta; + ∀ c ∈ TreeMissingColors sigma U, + let mu : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma alpha c; ( + ∀ (f : E), TreeIncidentEdge U f → mu f = sigma f) → ( + ∀ {z : Sym2 V} {x y : V}, x ∈ z → y ∈ z → x ≠ y → z = s(x, y)) → ( + ∀ d ∈ TreeMissingColors sigma U, + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet U) → sigma f ≠ some d) → ( + ∀ (f : E), ¬TreeIncidentEdge U f → (mu f = some c → sigma f = some alpha) ∧ (mu f = some beta + ↔ sigma f = some beta)) → + ∀ {v : V}, v ∉ TreeSequenceVertexSet U → alpha ∈ MissingColors G sigma v ∨ beta ∈ + MissingColors G sigma v → c ∈ MissingColors G mu v ∨ beta ∈ MissingColors G mu v := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample sigma U alpha + beta c hcU mu hfixed ends_eq_of_mem closed_color outside_color v hv hm + have outside_boundary {f : E} (hinc : Incident G v f) (hf : TreeIncidentEdge U f) : + f ∈ BoundaryEdges G (TreeSequenceVertexSet U) := by + obtain ⟨w, hw, hwf⟩ := hf + have hwv : w ≠ v := by intro heq; exact hv (heq ▸ hw) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hw, v, hv, ends_eq_of_mem hwf hinc hwv⟩ + rcases hm with ha | hb + · left + have hnot : alpha ∉ PresentColors G sigma v := by simpa [MissingColors] using ha + change c ∈ Finset.univ \ PresentColors G mu v + refine Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, ?_⟩ + intro hpres + obtain ⟨f, hinc, hfc⟩ : ∃ f, Incident G v f ∧ mu f = some c := by + simpa [PresentColors] using hpres + by_cases hf : TreeIncidentEdge U f + -- A fixed edge at an outside endpoint is a boundary edge of U. + · exact closed_color c hcU (outside_boundary hinc hf) ((hfixed f hf).symm.trans hfc) + · apply hnot + simpa [PresentColors] using + (show ∃ f, Incident G v f ∧ sigma f = some alpha from + ⟨f, hinc, (outside_color f hf).1 hfc⟩) + · right + have hnot : beta ∉ PresentColors G sigma v := by simpa [MissingColors] using hb + change beta ∈ Finset.univ \ PresentColors G mu v + refine Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, ?_⟩ + intro hpres + obtain ⟨f, hinc, hfb⟩ : ∃ f, Incident G v f ∧ mu f = some beta := by + simpa [PresentColors] using hpres + have hfb' : sigma f = some beta := by + by_cases hf : TreeIncidentEdge U f + · exact (hfixed f hf).symm.trans hfb + · exact (outside_color f hf).2.mp hfb + apply hnot + simpa [PresentColors] using + (show ∃ f, Incident G v f ∧ sigma f = some beta from ⟨f, hinc, hfb'⟩) + +private theorem helper_transfer_exit_545.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + let beta : Fin k := counterexample.beta; + ∀ (_ : TreeSequenceVertexSet N ⊆ TreeSequenceVertexSet U) (c : Fin k), + let mu : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma alpha c; + ∀ (_ : ( + ∀ (f : E) (_ : TreeIncidentEdge U f), mu f = sigma f)) (_ : ( + ∀ d ∈ TreeMissingColors sigma U, + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet U) → sigma f ≠ some d)) (_ : ( + ∀ {a b : V} (P : (TwoColorIncidenceGraph G sigma alpha beta).Walk (Sum.inl a) (Sum.inl b)) (_ + : TreeExitPath U sigma alpha beta a b P) {f : E} (_ : Sum.inr f ∈ P.support) (_ : + TreeIncidentEdge U f), f ∈ BoundaryEdges G (TreeSequenceVertexSet U))) (_ : ( + ∀ (f : E) (_ : ¬TreeIncidentEdge U f), (mu f = some c → sigma f = some alpha) ∧ (mu f = some + beta ↔ sigma f = some beta))) (_ : ( + ∀ {v : V} (_ : v ∉ TreeSequenceVertexSet U) (_ : alpha ∈ MissingColors G sigma v ∨ beta ∈ + MissingColors G sigma v), c ∈ MissingColors G mu v ∨ beta ∈ MissingColors G mu v)) + {a b : V} (P : (TwoColorIncidenceGraph G sigma alpha beta).Walk (Sum.inl a) (Sum.inl b)) + (_ : TreeExitPath U sigma alpha beta a b P) (_ : b ∈ TreeSequenceVertexSet N), + ∃ (Q : (TwoColorIncidenceGraph G mu c beta).Walk (Sum.inl a) (Sum.inl b)), TreeExitPath N mu c + beta a b Q := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R q N sigma U + alpha beta hsub c mu hfixed closed_color path_boundary outside_color remote_missing a b P + hexit hb + have preserve : ∀ {v : V} {f : E}, Sum.inr f ∈ P.support → + (TwoColorIncidenceGraph G sigma alpha beta).Adj (Sum.inl v) (Sum.inr f) → + (TwoColorIncidenceGraph G mu c beta).Adj (Sum.inl v) (Sum.inr f) := by + intro v f hf hadj + have hold : Incident G v f ∧ (sigma f = some alpha ∨ sigma f = some beta) := hadj + refine ⟨hold.1, ?_⟩ + by_cases ht : TreeIncidentEdge U f + · have hfb : sigma f = some beta := hold.2.resolve_left + (closed_color alpha counterexample.alphaMissing (path_boundary P hexit hf ht)) + exact Or.inr ((hfixed f ht).trans hfb) + · rcases hold.2 with ha | hb + · exact Or.inl (by simp [mu, OutsideTreeColorSwap, ht, ha]) + · exact Or.inr ((outside_color f ht).2.mpr hb) + have hedges : ∀ z, z ∈ P.edges → z ∈ (TwoColorIncidenceGraph G mu c beta).edgeSet := by + intro z hz + induction z using Sym2.inductionOn with + | _ x y => + have hadj := (SimpleGraph.mem_edgeSet _).mp (P.edges_subset_edgeSet hz) + have hx := P.fst_mem_support_of_mem_edges hz + have hy := P.snd_mem_support_of_mem_edges hz + apply (SimpleGraph.mem_edgeSet _).mpr + cases x with + | inl v => + cases y with + | inl w => simp [TwoColorIncidenceGraph] at hadj + | inr f => exact preserve hy hadj + | inr f => + cases y with + | inl v => exact (preserve hx hadj.symm).symm + | inr g => simp [TwoColorIncidenceGraph] at hadj + let Q := P.transfer (TwoColorIncidenceGraph G mu c beta) hedges + refine ⟨Q, hexit.1.transfer hedges, ?_, ?_, hb, ?_, ?_⟩ + · simpa [Q] using hexit.2.1 + · exact fun ha => hexit.2.2.1 (hsub ha) + · exact remote_missing hexit.2.2.1 hexit.2.2.2.2.1 + · intro w hw + simpa [Q] using hexit.2.2.2.2.2 w (hsub hw) + +private theorem helper_htOne_808.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + ∀ (c : Fin k), + let mu : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma alpha c; + ∀ (_ : IsOneEdgeUncolored mu e0) (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 + (R.series.data.tree q.succ.castSucc) (TashkinovStoredColors R.series.data q.castSucc) + (R.series.data.coloring q.castSucc)) (_ : gamma ≠ choice.color), + let tau : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma choice.color (Sum.inl + choice.vertex); IsOneEdgeUncolored tau e0 := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R q sigma U + alpha c mu hmuOne gamma choice hgd tau + constructor + · by_cases he : Sum.inr e0 ∈ TwoColorComponent G mu gamma choice.color (Sum.inl choice.vertex) + · simp [tau, TwoColorComponentSwap, he, hmuOne.1] + · simp [tau, TwoColorComponentSwap, he, hmuOne.1] + · intro e he0 + obtain ⟨d, hd⟩ := hmuOne.2 e he0 + by_cases he : Sum.inr e ∈ TwoColorComponent G mu gamma choice.color (Sum.inl choice.vertex) + · by_cases hdg : d = gamma + · exact ⟨choice.color, by simp [tau, TwoColorComponentSwap, he, hd, hdg]⟩ + · by_cases hdd : d = choice.color + · exact ⟨gamma, by simp [tau, TwoColorComponentSwap, he, hd, hdd, hgd.symm]⟩ + · exact ⟨d, by simp [tau, TwoColorComponentSwap, he, hd, hdg, hdd]⟩ + · exact ⟨d, by simp [tau, TwoColorComponentSwap, he, hd]⟩ + +private theorem helper_transferTau_840.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + let beta : Fin k := counterexample.beta; + let forbidden : Finset (Fin k) := (R.series.data.gamma q.succ).toFinset ∪ (R.series.data.delta + q.succ).toFinset; + ∀ c ∈ TreeMissingColors sigma N \ forbidden, + let mu : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma alpha c; IsProperEdgeColoring + G mu → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (R.series.data.tree q.succ.castSucc) + (TashkinovStoredColors R.series.data q.castSucc) (R.series.data.coloring q.castSucc)), + gamma ≠ choice.color → beta ≠ choice.color → beta ≠ gamma → c ≠ gamma → c ≠ choice.color → + let tau : PartialEdgeColoring E k := TwoColorComponentSwap G mu gamma choice.color (Sum.inl + choice.vertex); TwoColorIncidenceGraph G tau c beta = TwoColorIncidenceGraph G mu c beta → + ∀ {a b : V} (P : (TwoColorIncidenceGraph G mu c beta).Walk (Sum.inl a) (Sum.inl b)), + TreeExitPath N mu c beta a b P → + ∃ (Q : (TwoColorIncidenceGraph G tau c beta).Walk (Sum.inl a) (Sum.inl b)), TreeExitPath N tau + c beta a b Q := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R q N sigma U + alpha beta forbidden c hc mu hmuProper gamma choice hgd hbd hbg hcg hcd tau hgraph a b P he + have hedges : ∀ z, z ∈ P.edges → z ∈ (TwoColorIncidenceGraph G tau c beta).edgeSet := by + intro z hz + rw [hgraph] + exact P.edges_subset_edgeSet hz + let Q := P.transfer (TwoColorIncidenceGraph G tau c beta) hedges + refine ⟨Q, he.1.transfer hedges, ?_, he.2.2.1, he.2.2.2.1, ?_, ?_⟩ + · simpa [Q] using he.2.1 + · have hm := (TwoColorComponentSwapMissingBehavior G mu gamma choice.color hgd + hmuProper (Sum.inl choice.vertex)).2.2.2 + rcases he.2.2.2.2.1 with hc | hb + · exact Or.inl ((hm a c hcg hcd).mpr hc) + · exact Or.inr ((hm a beta hbg hbd).mpr hb) + · intro w hw + simpa [Q] using he.2.2.2.2.2 w hw + +private theorem helper_branch_661.{u_1, u_2} : + helperBranch661Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating original hcurrentFour presentation counterexample R + q hq N sigma U alpha beta hcolor hsub forbidden c hc hcN hcAvoid hcU hcb + lowerInterchangeable noninterchangeable mu hmuProper hmuOne hmuStable hfixed hstableN hcMu + outside_color remote_missing transfer_exit P1 he1 P2 he2 hnot stableAfter hf1 hf2 hfne i + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternativeFails gamma gammaRule secondStable secondStableProper + secondStableRelation exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension hslot + have hi : i = q := by + apply Fin.ext + have h := congrArg Fin.val hslot + simp only [Fin.val_succ] at h + omega + subst i + have hv : choice.vertex ∈ TreeSequenceVertexSet N := choice.vertexDefective.1 + have hgSecond : gamma ∈ MissingColors G secondStable choice.vertex := by + rw [secondStableRelation.2 choice.vertex hv] + exact gammaRule.1 + have hfSecond : secondStable choice.edge = some choice.color := by + exact (secondStableRelation.1 choice.edge + ⟨choice.vertex, hv, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union_right _ (Finset.mem_insert_self _ _), + choice.edgeColor⟩).trans choice.edgeColor + have hgd : gamma ≠ choice.color := by + intro heq + have hn : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgSecond + apply hn + simpa [PresentColors] using + (show ∃ f, Incident G choice.vertex f ∧ secondStable f = some gamma from + ⟨choice.edge, choice.edgeIncident, by rw [heq]; exact hfSecond⟩) + have hdMissing : choice.color ∈ MissingColors G sigma choice.vertex := by + rw [← hcolor, currentColoring] + exact (TwoColorComponentSwapMissingBehavior G secondStable gamma choice.color + hgd secondStableProper (Sum.inl choice.vertex)).2.1 choice.vertex + ((SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl) hgSecond + have hbd : beta ≠ choice.color := by + intro heq + apply counterexample.betaPresent + change beta ∈ TreeMissingColors sigma U + apply Finset.mem_biUnion.mpr + exact ⟨choice.vertex, hsub hv, by rw [heq]; exact hdMissing⟩ + have hboundary := (HkuParallelBoundaryStructure G k R.rounds e0 + presentation.corresponding.replacementInput R.series q choice.edge choice.color gamma + choice.vertex currentKind currentEdges currentDelta currentGamma currentVertex).1 + rw [hcolor] at hboundary + have hbg : beta ≠ gamma := by + intro heq + have h1 := hf1 + have h2 := hf2 + change counterexample.f1 ∈ BoundaryColorEdges G sigma + (TreeSequenceVertexSet (R.series.data.tree q.succ.castSucc)) beta at h1 + change counterexample.f2 ∈ BoundaryColorEdges G sigma + (TreeSequenceVertexSet (R.series.data.tree q.succ.castSucc)) beta at h2 + rw [heq, hboundary] at h1 h2 + exact hfne ((Finset.mem_singleton.mp h1).trans (Finset.mem_singleton.mp h2).symm) + have hcg : c ≠ gamma := by + intro heq + apply hcAvoid + simp [forbidden, currentGamma, heq] + have hcd : c ≠ choice.color := by + intro heq + apply hcAvoid + simp [forbidden, currentDelta, heq] + have hcomponent : ∀ w, w ∈ TreeSequenceVertexSet N → + (Sum.inl w ∈ TwoColorComponent G mu gamma choice.color (Sum.inl choice.vertex) ↔ + w = choice.vertex) := by + have hfour := hcurrentFour R presentation.corresponding.rungAgreement presentation.maximum + dsimp only at hfour + rw [← hq] at hfour + exact hfour choice.vertex gamma choice.color currentKind currentVertex currentGamma + currentDelta mu hmuProper hmuOne hstableN + obtain ⟨selected, recovered, _, _, _, _, _, _, _, _, _, hundone⟩ := + ParallelExtensionUndoStable G k R.rounds e0 presentation.corresponding.replacementInput + R.series q choice.vertex gamma choice.color currentKind currentVertex currentGamma + currentDelta mu hmuProper hmuOne hstableN hv hcomponent + let tau := TwoColorComponentSwap G mu gamma choice.color (Sum.inl choice.vertex) + have htProper : IsProperEdgeColoring G tau := + TwoColorComponentSwapProper G mu gamma choice.color hgd hmuProper (Sum.inl choice.vertex) + have htOne := @helper_htOne_808 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating original presentation counterexample c hmuOne gamma choice hgd + have hcTau : c ∈ TreeMissingColors tau N := by + obtain ⟨v, hv, hm⟩ : ∃ v ∈ TreeSequenceVertexSet N, c ∈ MissingColors G mu v := by + simpa [TreeMissingColors] using hcMu + apply Finset.mem_biUnion.mpr + exact ⟨v, hv, (TwoColorComponentSwapMissingBehavior G mu gamma choice.color hgd + hmuProper (Sum.inl choice.vertex)).2.2.2 v c hcg hcd |>.mpr hm⟩ + have hdisjoint : Disjoint ({c, beta} : Finset (Fin k)) {gamma, choice.color} := by + rw [Finset.disjoint_left] + intro d hd hs + simp only [Finset.mem_insert, Finset.mem_singleton] at hd hs + rcases hd with rfl | rfl <;> rcases hs with hs | hs + · exact hcg hs + · exact hcd hs + · exact hbg hs + · exact hbd hs + have hgraph : TwoColorIncidenceGraph G tau c beta = TwoColorIncidenceGraph G mu c beta := + TwoColorComponentSwapDisjointPairGraph G mu c beta gamma choice.color + (Sum.inl choice.vertex) hdisjoint + have transferTau := @helper_transferTau_840 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T generating original presentation counterexample c hc hmuProper + gamma choice hgd hbd hbg hcg hcd hgraph + obtain ⟨Q1, hQ1⟩ := transferTau P1 he1 + obtain ⟨Q2, hQ2⟩ := transferTau P2 he2 + exact noninterchangeable tau htProper hcTau Q1 Q2 hQ1 hQ2 + (lowerInterchangeable tau htProper htOne hundone hcTau) + +private theorem helper_outside_color_1093.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + let beta : Fin k := counterexample.beta; + let forbidden : Finset (Fin k) := (R.series.data.gamma q.succ).toFinset ∪ (R.series.data.delta + q.succ).toFinset; + ∀ c ∈ TreeMissingColors sigma N \ forbidden, c ≠ beta → alpha ≠ beta → + let mu : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma alpha c; + ∀ (f : E), ¬TreeIncidentEdge U f → (mu f = some c → sigma f = some alpha) ∧ (mu f = some beta + ↔ sigma f = some beta) := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R q N sigma U + alpha beta forbidden c hc hcb hab mu f hf + constructor + · intro hmc + by_cases ha : sigma f = some alpha + · exact ha + · by_cases hc : sigma f = some c + · have hca : c ≠ alpha := by + intro heq + exact ha (hc.trans (congrArg some heq)) + have hac : alpha = c := by + apply Option.some.inj + simpa [mu, OutsideTreeColorSwap, hf, ha, hc, hca] using hmc + exact hc.trans (congrArg some hac.symm) + · have hc' : sigma f = some c := by + simp [mu, OutsideTreeColorSwap, hf, ha, hc] at hmc + exact (hc hc').elim + · by_cases ha : sigma f = some alpha + · simp [mu, OutsideTreeColorSwap, hf, ha, hab, hcb] + · by_cases hc : sigma f = some c + · have hca : c ≠ alpha := by + intro heq + exact ha (hc.trans (congrArg some heq)) + simp [mu, OutsideTreeColorSwap, hf, hc, hca, hab, hcb] + · simp [mu, OutsideTreeColorSwap, hf, ha, hc] + +private theorem helper_hprefix_1002.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + ∀ (_ : q.succ = Fin.last R.rounds), + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; TreeSequenceInitialSegment N U ∧ + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet U) := by + classical + intro V E _ _ _ G k e0 input T generating original presentation R q hq N sigma U + have hr := presentation.terminalRoute + change (R.series.data.kind (Fin.last R.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovClosure sigma (R.series.data.tree (Fin.last R.rounds).castSucc) U) ∨ + ((R.series.data.kind (Fin.last R.rounds) = some TashkinovExtensionKind.SE ∨ + R.series.data.kind (Fin.last R.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, R.series.data.connectingEdges (Fin.last R.rounds) = {f} ∧ + TreeSequenceAdjoinEdge (R.series.data.tree (Fin.last R.rounds).castSucc) + f seed ∧ TashkinovClosure sigma seed U) at hr + rw [← hq] at hr + rcases hr with ⟨_, hc⟩ | ⟨_, f, seed, _, ha, hc⟩ + · exact ⟨TashkinovAugmentationSequenceInitialSegment sigma N U hc.1, hc.2⟩ + · obtain ⟨_, ⟨hlen1, hv1, he1⟩, _⟩ := ha + obtain ⟨hlen2, hv2, he2⟩ := + TashkinovAugmentationSequenceInitialSegment sigma seed U hc.1 + refine ⟨⟨hlen1.trans hlen2, ?_, ?_⟩, hc.2⟩ + · intro i + exact (hv2 (Fin.castLE (Nat.succ_le_succ hlen1) i)).trans (hv1 i) + · intro i + exact (he2 (Fin.castLE hlen1 i)).trans (he1 i) + +private theorem helper_hb1_1025.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + ∀ (_ : counterexample.b2 ∈ TreeSequenceVertexSet N) (_ : TreeSequenceInitialSegment N U ∧ + ColoredVertexSetClosed G sigma (TreeSequenceVertexSet U)), counterexample.b1 ∈ + TreeSequenceVertexSet N := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R q N sigma U + hb2 hprefix + obtain ⟨hlen, hv, _⟩ := hprefix.1 + obtain ⟨i, j, hi, hj, hij⟩ := counterexample.insideOrder12 + obtain ⟨t, ht⟩ : ∃ t, N.vertex t = counterexample.b2 := by + simpa [TreeSequenceVertexSet] using hb2 + have hjt : j = Fin.castLE (Nat.succ_le_succ hlen) t := + U.vertex_injective (hj.trans ((hv t).trans ht).symm) + have hil : i.val < N.length + 1 := by + have htlt := t.isLt + rw [hjt] at hij + simp only [Fin.val_castLE] at hij + omega + let r : Fin (N.length + 1) := ⟨i.val, hil⟩ + have hir : Fin.castLE (Nat.succ_le_succ hlen) r = i := by + apply Fin.ext + rfl + have hr : N.vertex r = counterexample.b1 := by + rw [← hv r, hir] + exact hi + simpa [TreeSequenceVertexSet] using (show ∃ r, N.vertex r = counterexample.b1 from ⟨r, hr⟩) + +private theorem helper_hswap_1096.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + ∀ (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (_ : + TreeSequenceInitialSegment N U ∧ ColoredVertexSetClosed G sigma (TreeSequenceVertexSet + U)), + let forbidden : Finset (Fin k) := (R.series.data.gamma q.succ).toFinset ∪ (R.series.data.delta + q.succ).toFinset; + ∀ c ∈ TreeMissingColors sigma N \ forbidden, c ∈ TreeMissingColors sigma U → + let mu : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma alpha c; IsProperEdgeColoring + G mu ∧ IsOneEdgeUncolored mu e0 ∧ StableColoring U (TashkinovStoredColors R.series.data + q.succ) sigma mu ∧ + ∀ (f : E), TreeIncidentEdge U f → mu f = sigma f := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R q N sigma U + alpha hproper hone hprefix forbidden c hc hcU mu + by_cases hac : alpha = c + · have hm : mu = sigma := by + funext f + dsimp [mu] + by_cases hf : TreeIncidentEdge U f + · simp [OutsideTreeColorSwap, hf] + · by_cases hc : sigma f = some c <;> + simp [OutsideTreeColorSwap, hf, hac, hc] + rw [hm] + exact ⟨hproper, hone, ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩, fun _ _ => rfl⟩ + · exact OutsideTreeColorSwapStable U _ sigma alpha c hproper hone hprefix.2 + counterexample.alphaMissing hcU hac + +private theorem helper_branch_1201.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + let beta : Fin k := counterexample.beta; + ∀ (_ : R.series.data.coloring q.succ = sigma) (c : Fin k) (_ : ( + ∀ (rho : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G rho) (_ : IsOneEdgeUncolored rho + e0) (_ : StableColoring N (TashkinovStoredColors R.series.data q.castSucc) + (R.series.data.coloring q.castSucc) rho) (_ : c ∈ TreeMissingColors rho N), + TreeInterchangeable G N rho c beta)), + let mu : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma alpha c; + ∀ (_ : IsProperEdgeColoring G mu) (_ : IsOneEdgeUncolored mu e0) (_ : c ∈ TreeMissingColors mu + N) (_ : ¬TreeInterchangeable G N mu c beta) (_ : ( + ∀ (phi : PartialEdgeColoring E k) (D : Finset (Fin k)) (_ : StableColoring N D phi sigma), + StableColoring N D phi mu)) (i : Fin R.rounds) (_ : IsProperEdgeColoring G + (R.series.data.coloring i.castSucc)) (_ : IsOneEdgeUncolored (R.series.data.coloring + i.castSucc) e0) (_ : ColoredVertexSetClosed G (R.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (R.series.data.tree i.succ.castSucc))) (_ : + ¬ColoredVertexSetStronglyClosed G (R.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (R.series.data.tree i.succ.castSucc))) (_ : ¬Nonempty + (RevisitingExtensionCertificate R.series.data i.castSucc)) (choice : + MaximumDefectiveChoice G e0 (R.series.data.tree i.succ.castSucc) (TashkinovStoredColors + R.series.data i.castSucc) (R.series.data.coloring i.castSucc)) (_ : ( + ∀ (pi : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G pi) (_ : IsOneEdgeUncolored pi + e0) (_ : StableColoring (R.series.data.tree i.succ.castSucc) (insert choice.color + (TashkinovStoredColors R.series.data i.castSucc)) choice.selected pi), Disjoint + (MissingColors G pi choice.otherEndpoint) (TreeMissingColors pi (R.series.data.tree + i.succ.castSucc)))) (_ : R.series.data.coloring i.succ = choice.selected) (_ : + R.series.data.stored i.succ = { choice.color }) (_ : R.series.data.connectingEdges i.succ + = { choice.edge }) (_ : R.series.data.kind i.succ = some TashkinovExtensionKind.SE) (_ : + R.series.data.chosenVertex i.succ = some choice.vertex) (_ : R.series.data.outsideVertex + i.succ = some choice.otherEndpoint) (_ : R.series.data.delta i.succ = some choice.color) + (_ : R.series.data.gamma i.succ = none) (adjoined : TreeSequence G e0) (_ : + TreeSequenceAdjoinEdge (R.series.data.tree i.succ.castSucc) choice.edge adjoined) (_ : + TashkinovClosure (R.series.data.coloring i.succ) adjoined (R.series.data.tree + i.succ.succ)) (_ : TreeSequenceInitialSegment (R.series.data.tree i.succ.castSucc) + (R.series.data.tree i.succ.succ)) (_ : (R.series.data.tree i.succ.castSucc).length < + (R.series.data.tree i.succ.succ).length) (_ : q.succ = i.succ), False := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R q N sigma U + alpha beta hcolor c lowerInterchangeable mu hmuProper hmuOne hcMu hnot stableAfter i + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternative currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension hslot + have hi : i = q := by + apply Fin.ext + have h := congrArg Fin.val hslot + simp only [Fin.val_succ] at h + omega + subst i + have hselected : choice.selected = sigma := currentColoring.symm.trans hcolor + have hs : StableColoring N (TashkinovStoredColors R.series.data q.castSucc) + (R.series.data.coloring q.castSucc) sigma := by + rw [← hselected] + exact choice.selectedStable + exact hnot (lowerInterchangeable mu hmuProper hmuOne (stableAfter _ _ hs) hcMu) + +private theorem helper_branch_1217.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (original : + ExtendedTashkinovTree G k e0 input T generating) (presentation : RutgersClosedPresentation + G k e0 original) (counterexample : RutgersCounterexample G k e0 original presentation), + let R : ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := presentation.corresponding.replacementETT; + let q : Fin R.rounds := (⟨R.rounds - (1 : ℕ), + by have this : (1 : ℕ) ≤ R.rounds := R.roundsPositive; omega + ⟩ : Fin R.rounds); + let N : TreeSequence G e0 := R.series.data.tree q.succ.castSucc; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let U : TreeSequence G e0 := presentation.U; + let alpha : Fin k := counterexample.alpha; + let beta : Fin k := counterexample.beta; + ∀ (_ : R.series.data.coloring q.succ = sigma) (c : Fin k) (_ : ( + ∀ (rho : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G rho) (_ : IsOneEdgeUncolored rho + e0) (_ : StableColoring N (TashkinovStoredColors R.series.data q.castSucc) + (R.series.data.coloring q.castSucc) rho) (_ : c ∈ TreeMissingColors rho N), + TreeInterchangeable G N rho c beta)), + let mu : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma alpha c; + ∀ (_ : IsProperEdgeColoring G mu) (_ : IsOneEdgeUncolored mu e0) (_ : c ∈ TreeMissingColors mu + N) (_ : ¬TreeInterchangeable G N mu c beta) (_ : ( + ∀ (phi : PartialEdgeColoring E k) (D : Finset (Fin k)) (_ : StableColoring N D phi sigma), + StableColoring N D phi mu)) (i : Fin R.rounds) (_ : IsProperEdgeColoring G + (R.series.data.coloring i.castSucc)) (_ : IsOneEdgeUncolored (R.series.data.coloring + i.castSucc) e0) (_ : ColoredVertexSetClosed G (R.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (R.series.data.tree i.succ.castSucc))) (_ : + ¬ColoredVertexSetStronglyClosed G (R.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (R.series.data.tree i.succ.castSucc))) (available : + RevisitingExtensionCertificate R.series.data i.castSucc) (_ : R.series.data.coloring + i.succ = R.series.data.coloring i.castSucc) (_ : R.series.data.stored i.succ = + { available.delta, available.gamma }) (_ : R.series.data.connectingEdges i.succ = + { available.edge }) (_ : R.series.data.kind i.succ = some TashkinovExtensionKind.RE) (_ : + R.series.data.chosenVertex i.succ = some available.insideEndpoint) (_ : + R.series.data.outsideVertex i.succ = some available.outsideEndpoint) (_ : + R.series.data.delta i.succ = some available.delta) (_ : R.series.data.gamma i.succ = some + available.gamma) (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge + (R.series.data.tree i.succ.castSucc) available.edge adjoined) (_ : TashkinovClosure + (R.series.data.coloring i.succ) adjoined (R.series.data.tree i.succ.succ)) (_ : + TreeSequenceInitialSegment (R.series.data.tree i.succ.castSucc) (R.series.data.tree + i.succ.succ)) (_ : (R.series.data.tree i.succ.castSucc).length < (R.series.data.tree + i.succ.succ).length) (_ : q.succ = i.succ), False := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R q N sigma U + alpha beta hcolor c lowerInterchangeable mu hmuProper hmuOne hcMu hnot stableAfter i + previousProper previousOneUncolored previousClosed previousNotStronglyClosed available + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension hslot + have hi : i = q := by + apply Fin.ext + have h := congrArg Fin.val hslot + simp only [Fin.val_succ] at h + omega + subst i + have hprevious : R.series.data.coloring q.castSucc = sigma := + currentColoring.symm.trans hcolor + have hs : StableColoring N (TashkinovStoredColors R.series.data q.castSucc) + (R.series.data.coloring q.castSucc) sigma := by + rw [hprevious] + exact ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ + exact hnot (lowerInterchangeable mu hmuProper hmuOne (stableAfter _ _ hs) hcMu) + +private theorem helper_continuation_1450.{u_1, u_2} : + helperContinuation1450Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating original hcurrentFour presentation counterexample R + q hq N sigma U alpha beta hcolor hb2 hprefix hsub hb1 forbidden c hc hcN hcAvoid hcU hcb + hab lowerInterchangeable noninterchangeable mu hmuProper hmuOne hmuStable hfixed hstableN hcMu + have ends_eq_of_mem : ∀ {z : Sym2 V} {x y : V}, x ∈ z → y ∈ z → x ≠ y → + z = Sym2.mk x y := by + intro z x y hx hy hxy + induction z using Sym2.inductionOn with + | _ a b => + simp only [Sym2.mem_iff] at hx hy + rcases hx with hx | hx <;> rcases hy with hy | hy + · exact (hxy (hx.trans hy.symm)).elim + · rw [hx, hy] + · rw [hx, hy] + exact Sym2.eq_swap .. + · exact (hxy (hx.trans hy.symm)).elim + have closed_color (d : Fin k) (hd : d ∈ TreeMissingColors sigma U) : + ∀ {f}, f ∈ BoundaryEdges G (TreeSequenceVertexSet U) → sigma f ≠ some d := by + intro f hf hfd + obtain ⟨v, hv, hm⟩ : ∃ v ∈ TreeSequenceVertexSet U, d ∈ MissingColors G sigma v := by + simpa [TreeMissingColors] using hd + exact (hprefix.2 hf hv hfd) hm + have path_boundary := @helper_path_boundary_419 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T generating original presentation counterexample ends_eq_of_mem + have outside_color := @helper_outside_color_1093 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T generating original presentation counterexample c hc hcb hab + have remote_missing := @helper_remote_missing_506 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T generating original presentation counterexample c hcU hfixed + ends_eq_of_mem closed_color outside_color + have transfer_exit := @helper_transfer_exit_545 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T generating original presentation counterexample hsub c hfixed + closed_color path_boundary outside_color remote_missing + obtain ⟨P1, he1⟩ := transfer_exit counterexample.Q1 counterexample.exit1 hb1 + obtain ⟨P2, he2⟩ := transfer_exit counterexample.Q2 counterexample.exit2 hb2 + have hnot := noninterchangeable mu hmuProper hcMu P1 P2 he1 he2 + -- The swap fixes all tree-incident identities, stronger than stable control. + have stableAfter (phi : PartialEdgeColoring E k) (D : Finset (Fin k)) + (hs : StableColoring N D phi sigma) : StableColoring N D phi mu := by + refine ⟨?_, ?_⟩ + · intro f hf hc + obtain ⟨v, hv, hinc⟩ := hf + exact (hfixed f ⟨v, hsub hv, hinc⟩).trans (hs.1 f ⟨v, hv, hinc⟩ hc) + · intro v hv + exact (hmuStable.2 v (hsub hv)).trans (hs.2 v hv) + have boundary_restrict (f : E) (b : V) + (hf : f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet U) beta) + (hb : b ∈ TreeSequenceVertexSet N) (hinc : Incident G b f) : + f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet N) beta := by + obtain ⟨hboundary, hfc⟩ := Finset.mem_filter.mp hf + obtain ⟨x, hx, y, hy, he⟩ : ∃ x ∈ TreeSequenceVertexSet U, + ∃ y ∉ TreeSequenceVertexSet U, G.ends f = Sym2.mk x y := by + simpa [BoundaryEdges] using hboundary + have hbx : b = x := by + have hbends : b = x ∨ b = y := by simpa [Incident, he] using hinc + exact hbends.resolve_right (by intro heq; exact hy (heq ▸ hsub hb)) + refine Finset.mem_filter.mpr ⟨?_, hfc⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨b, hb, y, fun h => hy (hsub h), by rw [hbx]; exact he⟩ + have hf1 := boundary_restrict counterexample.f1 counterexample.b1 + counterexample.boundary1 hb1 counterexample.incident1 + have hf2 := boundary_restrict counterexample.f2 counterexample.b2 + counterexample.boundary2 hb2 counterexample.incident2 + have hfne : counterexample.f1 ≠ counterexample.f2 := by + intro heq + exact counterexample.supportDisjoint12 (Sum.inr counterexample.f1) + counterexample.edgeOnWalk1 (by rw [heq]; exact counterexample.edgeOnWalk2) + have cert := R.series.certified q.succ + generalize hslot : q.succ = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero q hslot).elim + | SE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + exact @helper_branch_1201 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T generating original presentation counterexample hcolor c + lowerInterchangeable hmuProper hmuOne hcMu hnot stableAfter i previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternative currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension hslot + | RE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + available currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + exact @helper_branch_1217 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T generating original presentation counterexample hcolor c + lowerInterchangeable hmuProper hmuOne hcMu hnot stableAfter i previousProper + previousOneUncolored previousClosed previousNotStronglyClosed available + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension hslot + | PE i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + exact @helper_branch_661 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T generating original hcurrentFour presentation counterexample hq hcolor + hsub c hc hcN hcAvoid hcU hcb lowerInterchangeable noninterchangeable hmuProper + hmuOne hmuStable hfixed hstableN hcMu outside_color remote_missing transfer_exit P1 + he1 P2 he2 hnot stableAfter hf1 hf2 hfne i previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hslot + +theorem RutgersMiddleExitOutsideTerminalLadder + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (hdegree : MaximumDegree G + 1 <= k) + (hcurrentFour : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = original.rounds -> MaximumProperty current -> + let terminal : Fin (current.rounds + 1) := Fin.last current.rounds + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc + forall (v : V) (gamma delta : Fin k), + current.series.data.kind terminal = some TashkinovExtensionKind.PE -> + current.series.data.chosenVertex terminal = some v -> + current.series.data.gamma terminal = some gamma -> + current.series.data.delta terminal = some delta -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma -> + forall w, w ∈ TreeSequenceVertexSet Tterminal -> + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) <-> w = v)) + (hlowerTwo : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < lower.rounds -> lower.rounds < original.rounds -> + MaximumProperty lower -> + let terminal : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tnext : TreeSequence G e0 := + lower.series.data.tree (Fin.last (lower.rounds + 1)) + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tnext + (TashkinovStoredColors lower.series.data terminal) + (lower.series.data.coloring terminal) sigma -> + forall alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma Tnext ∨ + beta ∈ TreeMissingColors sigma Tnext) -> + TreeInterchangeable G Tnext sigma alpha beta) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation) + (helementary : ColoredVertexSetElementary G presentation.sigma + (TreeSequenceVertexSet presentation.U)) : + let replacement := presentation.corresponding.replacementETT + let terminal : Fin (replacement.rounds + 1) := Fin.last replacement.rounds + counterexample.b2 ∉ + TreeSequenceVertexSet (replacement.series.data.tree terminal.castSucc) := by + classical + let R := presentation.corresponding.replacementETT + let q : Fin R.rounds := ⟨R.rounds - 1, by have := R.roundsPositive; omega⟩ + have hq : q.succ = Fin.last R.rounds := by + apply Fin.ext + simp [q] + have := R.roundsPositive + omega + let N := R.series.data.tree q.succ.castSucc + let sigma := presentation.sigma + let U := presentation.U + let alpha := counterexample.alpha + let beta := counterexample.beta + have hcolor : R.series.data.coloring q.succ = sigma := by + rw [hq] + exact R.generatingColoring.symm + have hproper : IsProperEdgeColoring G sigma := by + dsimp [sigma] + rw [presentation.corresponding.finalGeneratingColoring] + exact presentation.corresponding.replacementProper _ + have hone : IsOneEdgeUncolored sigma e0 := by + dsimp [sigma] + rw [presentation.corresponding.finalGeneratingColoring] + exact presentation.corresponding.replacementOneUncolored _ + dsimp only + change counterexample.b2 ∉ TreeSequenceVertexSet (R.series.data.tree (Fin.last R.rounds).castSucc) + rw [← hq] + change counterexample.b2 ∉ TreeSequenceVertexSet N + intro hb2 + have hprefix := @helper_hprefix_1002 V E inferInstance inferInstance inferInstance G k e0 input T + generating original presentation hq + have hsub : TreeSequenceVertexSet N ⊆ TreeSequenceVertexSet U := + TreeSequenceInitialSegmentVertexSetSubset hprefix.1 + have hb1 := @helper_hb1_1025 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating original presentation counterexample hb2 hprefix + have helemN : ColoredVertexSetElementary G sigma (TreeSequenceVertexSet N) := by + intro x hx y hy hxy + exact helementary (hsub hx) (hsub hy) hxy + have hcard := TreeMissingColorsCardLowerBound G k e0 sigma N hone.1 hdegree helemN + -- Choose outside both terminal option slots, uniformly over the three kinds. + let forbidden : Finset (Fin k) := + (R.series.data.gamma q.succ).toFinset ∪ (R.series.data.delta q.succ).toFinset + have hforbidden : forbidden.card ≤ 2 := by + have ho (a : Option (Fin k)) : a.toFinset.card ≤ 1 := by + cases a <;> simp + exact (Finset.card_union_le _ _).trans (Nat.add_le_add (ho _) (ho _)) + have hnonempty : (TreeMissingColors sigma N \ forbidden).Nonempty := by + apply Finset.card_pos.mp + have hn : 0 < (TreeSequenceVertexSet N).card := + Finset.card_pos.mpr ⟨counterexample.b2, hb2⟩ + have hle := Finset.card_le_card (Finset.inter_subset_right : + TreeMissingColors sigma N ∩ forbidden ⊆ forbidden) + have heq := Finset.card_sdiff_add_card_inter (TreeMissingColors sigma N) forbidden + omega + obtain ⟨c, hc⟩ := hnonempty + obtain ⟨hcN, hcAvoid⟩ := Finset.mem_sdiff.mp hc + have hcU : c ∈ TreeMissingColors sigma U := by + obtain ⟨x, hx, hm⟩ : ∃ x ∈ TreeSequenceVertexSet N, c ∈ MissingColors G sigma x := by + simpa [TreeMissingColors] using hcN + exact Finset.mem_biUnion.mpr ⟨x, hsub hx, hm⟩ + have hcb : c ≠ beta := by + intro heq + apply counterexample.betaPresent + change beta ∈ TreeMissingColors sigma U + rw [← heq] + exact hcU + have hab : alpha ≠ beta := counterexample.colorsDistinct + -- Rung one uses the certified initial series, not a zero-rung ETT. + have lowerInterchangeable := @helper_lowerInterchangeable_228 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T generating original hlowerTwo presentation + counterexample c hc + -- Subsingleton neighbor sets also cover isolated path components. + have noninterchangeable := @helper_noninterchangeable_276 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T generating original presentation counterexample hb2 + hb1 c hc hcb + let mu := OutsideTreeColorSwap U sigma alpha c + have hswap := @helper_hswap_1096 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original presentation counterexample hproper hone hprefix c hc hcU + obtain ⟨hmuProper, hmuOne, hmuStable, hfixed⟩ := hswap + have hstableN : StableColoring N (TashkinovStoredColors R.series.data q.succ) + (R.series.data.coloring q.succ) mu := by + rw [hcolor] + refine ⟨?_, fun v hv => hmuStable.2 v (hsub hv)⟩ + intro f hf _ + obtain ⟨v, hv, hinc⟩ := hf + exact hfixed f ⟨v, hsub hv, hinc⟩ + have hcMu : c ∈ TreeMissingColors mu N := by + obtain ⟨v, hv, hm⟩ : ∃ v ∈ TreeSequenceVertexSet N, c ∈ MissingColors G sigma v := by + simpa [TreeMissingColors] using hcN + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [hmuStable.2 v (hsub hv)]; exact hm⟩ + exact @helper_continuation_1450 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original hcurrentFour presentation counterexample hq hcolor hb2 + hprefix hsub hb1 c hc hcN hcAvoid hcU hcb hab lowerInterchangeable noninterchangeable + hmuProper hmuOne hmuStable hfixed hstableN hcMu +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/RutgersStrictShortening.lean b/LeanPool/GoldbergSeymour/RutgersStrictShortening.lean new file mode 100644 index 0000000000..2e6a7f7348 --- /dev/null +++ b/LeanPool/GoldbergSeymour/RutgersStrictShortening.lean @@ -0,0 +1,3281 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTransTrees +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RutgersClosedPresentation +public import LeanPool.GoldbergSeymour.RutgersCounterexample +public import LeanPool.GoldbergSeymour.RutgersCounterexampleMeasure +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovClosureExists +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge +public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph + +/-! +# Rutgers Strict Shortening + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperFinish912Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput presentation.U + presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ∀ (seed : TreeSequence G e0) + (hseed : + R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) + (gamma : Fin k) (_ : gamma ≠ counterexample.beta), + let mu3 : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ (i3 : Fin (presentation.U.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) + (hi3le : (↑i3 : ℕ) ≤ U.length), + let C : TreeSequence G e0 := TreeSequencePrefix U (↑i3 : ℕ) hi3pos hi3le; + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (W : TreeSequence G e0) (hW : TashkinovClosure mu4 C W) + (route4W : TashkinovAugmentationSequence mu4 seed W) + (A40 : CorrespondingExtendedTashkinovTree G k e0 original mu4 W) + (max40 : MaximumProperty A40.replacementETT) + (agree40 : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)) + (agree0 : + presentation.corresponding.replacementETT.series.data.tree + (Fin.last presentation.corresponding.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + presentation.corresponding.replacementETT.series.data.kind + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + presentation.corresponding.replacementETT.series.data.connectingEdges + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)), + let newPresentation : RutgersClosedPresentation G k e0 original := + { + sigma := mu4, U := W, corresponding := A40, maximum := max40, + terminalRoute := + id + (have htree : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = Tn := + Eq.trans agree40.left (Eq.symm agree0.left); + have hkind : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + R.series.data.kind n := + Eq.trans agree40.right.left (Eq.symm agree0.right.left); + have hedges : + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + R.series.data.connectingEdges n := + Eq.trans agree40.right.right (Eq.symm agree0.right.right); + Or.casesOn hseed + (fun (hPE : R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn) ↦ + Or.inl + (⟨Eq.trans hkind hPE.left, + Eq.mpr + (id (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) htree)) + (Eq.mpr + (id + (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) + (Eq.symm hPE.right))) + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W)))⟩ : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovClosure mu4 + (A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc) + W)) + fun + (hSER : + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), + R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + Exists.casesOn hSER.right + fun (f : E) + (h : R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + And.casesOn h + fun (he : R.series.data.connectingEdges n = { f }) + (ha : TreeSequenceAdjoinEdge Tn f seed) ↦ + Or.inr + (⟨Eq.mpr + (id + (congr + (congrArg Or (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.SE))) + (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.RE)))) + hSER.left, + Exists.intro f + (Exists.intro seed + (⟨Eq.trans hedges he, + (⟨Eq.mpr + (id (congrFun' (congrFun' (congrArg TreeSequenceAdjoinEdge htree) f) seed)) + ha, + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W))⟩ : + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)⟩ : + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W))⟩ : + (A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.SE ∨ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)) : + RutgersClosedPresentation G k e0 original }; + ∀ + (_ : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a1) + (Sum.inl counterexample.b1)) + (_ : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a2) + (Sum.inl counterexample.b2)) + (_ : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a3) + (Sum.inl counterexample.b3)) + (_ : counterexample.beta ∈ TreeMissingColors mu4 W) (_ : gamma ∉ TreeMissingColors mu4 W), + let Package : Type (max u_1 u_1 u_2) := + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × E; + let Good : Package → Prop := fun (p : Package) ↦ + TreeExitPath W mu4 counterexample.beta gamma p.fst p.snd.fst p.snd.snd.1 ∧ + p.snd.snd.2 ∈ BoundaryColorEdges G mu4 (TreeSequenceVertexSet W) gamma ∧ + Incident G p.snd.fst p.snd.snd.2 ∧ Sum.inr p.snd.snd.2 ∈ p.snd.snd.1.support; + ∀ (p q r : Package) (_ : Good p) (_ : Good q) (_ : Good r) + (_ : (∀ x ∈ p.snd.snd.1.support, x ∉ q.snd.snd.1.support)) + (_ : (∀ x ∈ p.snd.snd.1.support, x ∉ r.snd.snd.1.support)) + (_ : (∀ x ∈ q.snd.snd.1.support, x ∉ r.snd.snd.1.support)) + (_ : TreeVertexOrder W p.snd.fst q.snd.fst) (_ : TreeVertexOrder W q.snd.fst r.snd.fst), + ∃ (C' : RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure C' = + p.snd.snd.1.length + q.snd.snd.1.length + r.snd.snd.1.length + +private abbrev helperBranch871Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput presentation.U + presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ∀ (seed : TreeSequence G e0) + (hseed : + R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) + (gamma : Fin k), + let mu3 : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ (i3 : Fin (presentation.U.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) + (hi3le : (↑i3 : ℕ) ≤ U.length), + let C : TreeSequence G e0 := TreeSequencePrefix U (↑i3 : ℕ) hi3pos hi3le; + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (W : TreeSequence G e0) (hW : TashkinovClosure mu4 C W) + (route4W : TashkinovAugmentationSequence mu4 seed W) + (A40 : CorrespondingExtendedTashkinovTree G k e0 original mu4 W) + (max40 : MaximumProperty A40.replacementETT) + (agree40 : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)) + (agree0 : + presentation.corresponding.replacementETT.series.data.tree + (Fin.last presentation.corresponding.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + presentation.corresponding.replacementETT.series.data.kind + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + presentation.corresponding.replacementETT.series.data.connectingEdges + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)), + let newPresentation : RutgersClosedPresentation G k e0 original := + { + sigma := mu4, U := W, corresponding := A40, maximum := max40, + terminalRoute := + id + (have htree : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = Tn := + Eq.trans agree40.left (Eq.symm agree0.left); + have hkind : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + R.series.data.kind n := + Eq.trans agree40.right.left (Eq.symm agree0.right.left); + have hedges : + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + R.series.data.connectingEdges n := + Eq.trans agree40.right.right (Eq.symm agree0.right.right); + Or.casesOn hseed + (fun (hPE : R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn) ↦ + Or.inl + (⟨Eq.trans hkind hPE.left, + Eq.mpr + (id (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) htree)) + (Eq.mpr + (id + (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) + (Eq.symm hPE.right))) + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W)))⟩ : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovClosure mu4 + (A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc) + W)) + fun + (hSER : + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), + R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + Exists.casesOn hSER.right + fun (f : E) + (h : R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + And.casesOn h + fun (he : R.series.data.connectingEdges n = { f }) + (ha : TreeSequenceAdjoinEdge Tn f seed) ↦ + Or.inr + (⟨Eq.mpr + (id + (congr + (congrArg Or (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.SE))) + (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.RE)))) + hSER.left, + Exists.intro f + (Exists.intro seed + (⟨Eq.trans hedges he, + (⟨Eq.mpr + (id (congrFun' (congrFun' (congrArg TreeSequenceAdjoinEdge htree) f) seed)) + ha, + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W))⟩ : + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)⟩ : + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W))⟩ : + (A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.SE ∨ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)) : + RutgersClosedPresentation G k e0 original }; + ∀ + (Q1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a1) + (Sum.inl counterexample.b1)) + (Q2 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a2) + (Sum.inl counterexample.b2)) + (Q3 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a3) + (Sum.inl counterexample.b3)) + (c1 : V) (hc1 : Sum.inl c1 ∈ Q1.support) (g1 : E) (c2 : V) (hc2 : Sum.inl c2 ∈ Q2.support) + (g2 : E) (c3 : V) (hc3 : Sum.inl c3 ∈ Q3.support) (g3 : E), + let L1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a1) + (Sum.inl c1) := + Q1.takeUntil (Sum.inl c1) hc1; + let L2 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a2) + (Sum.inl c2) := + Q2.takeUntil (Sum.inl c2) hc2; + let L3 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a3) + (Sum.inl c3) := + Q3.takeUntil (Sum.inl c3) hc3; + ∀ (_ : (∀ x ∈ L1.support, x ∉ L2.support)) (_ : (∀ x ∈ L1.support, x ∉ L3.support)) + (_ : (∀ x ∈ L2.support, x ∉ L3.support)) + (_ : L1.length + L2.length + L3.length < RutgersCounterexampleMeasure counterexample), + let Package : Type (max u_1 u_2) := + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E; + let Good : Package → Prop := fun (p : Package) ↦ + TreeExitPath W mu4 counterexample.beta gamma p.fst p.snd.fst p.snd.snd.1 ∧ + p.snd.snd.2 ∈ BoundaryColorEdges G mu4 (TreeSequenceVertexSet W) gamma ∧ + Incident G p.snd.fst p.snd.snd.2 ∧ Sum.inr p.snd.snd.2 ∈ p.snd.snd.1.support; + let pack1 : Package := + (⟨counterexample.a1, + (⟨c1, (L1, g1)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a1) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + let pack2 : Package := + (⟨counterexample.a2, + (⟨c2, (L2, g2)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a2) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + let pack3 : Package := + (⟨counterexample.a3, + (⟨c3, (L3, g3)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a3) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + ∀ (_ : Good pack1) (_ : Good pack2) (_ : Good pack3) + (_ : + (∀ (p q r : Package) (_ : Good p) (_ : Good q) (_ : Good r) + (_ : (∀ x ∈ p.snd.snd.1.support, x ∉ q.snd.snd.1.support)) + (_ : (∀ x ∈ p.snd.snd.1.support, x ∉ r.snd.snd.1.support)) + (_ : (∀ x ∈ q.snd.snd.1.support, x ∉ r.snd.snd.1.support)) + (_ : TreeVertexOrder W p.snd.fst q.snd.fst) (_ : TreeVertexOrder W q.snd.fst r.snd.fst), + ∃ (C' : RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure C' = + p.snd.snd.1.length + q.snd.snd.1.length + r.snd.snd.1.length)) + (j1 : Fin (W.length + (1 : ℕ))) (_ : W.vertex j1 = c1) (j2 : Fin (W.length + (1 : ℕ))) + (_ : W.vertex j2 = c2) (j3 : Fin (W.length + (1 : ℕ))) (_ : W.vertex j3 = c3) + (_ : (↑j1 : ℕ) ≠ (↑j2 : ℕ)) (_ : (↑j1 : ℕ) ≠ (↑j3 : ℕ)) (_ : (↑j2 : ℕ) ≠ (↑j3 : ℕ)) + (_ : ¬(↑j1 : ℕ) < (↑j2 : ℕ)) (_ : ¬(↑j1 : ℕ) < (↑j3 : ℕ)), + ∃ (newCounterexample : RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure newCounterexample < + RutgersCounterexampleMeasure counterexample + +private abbrev helperBranch1326Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput presentation.U + presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ∀ (seed : TreeSequence G e0) + (hseed : + R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) + (gamma : Fin k), + let mu3 : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a1) + (Sum.inl counterexample.b1)) + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a2) + (Sum.inl counterexample.b2)) + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a3) + (Sum.inl counterexample.b3)) + (_ _ i3 : Fin (presentation.U.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) + (hi3le : (↑i3 : ℕ) ≤ U.length) (_ : (1 : ℕ) ≤ (↑i3 : ℕ) - (1 : ℕ)), + let C : TreeSequence G e0 := TreeSequencePrefix U (↑i3 : ℕ) hi3pos hi3le; + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (W : TreeSequence G e0) (hW : TashkinovClosure mu4 C W) + (route4W : TashkinovAugmentationSequence mu4 seed W) + (A40 : CorrespondingExtendedTashkinovTree G k e0 original mu4 W) + (max40 : MaximumProperty A40.replacementETT) + (agree40 : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)) + (agree0 : + presentation.corresponding.replacementETT.series.data.tree + (Fin.last presentation.corresponding.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + presentation.corresponding.replacementETT.series.data.kind + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + presentation.corresponding.replacementETT.series.data.connectingEdges + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)), + let newPresentation : RutgersClosedPresentation G k e0 original := + { + sigma := mu4, U := W, corresponding := A40, maximum := max40, + terminalRoute := + id + (have htree : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = Tn := + Eq.trans agree40.left (Eq.symm agree0.left); + have hkind : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + R.series.data.kind n := + Eq.trans agree40.right.left (Eq.symm agree0.right.left); + have hedges : + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + R.series.data.connectingEdges n := + Eq.trans agree40.right.right (Eq.symm agree0.right.right); + Or.casesOn hseed + (fun (hPE : R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn) ↦ + Or.inl + (⟨Eq.trans hkind hPE.left, + Eq.mpr + (id (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) htree)) + (Eq.mpr + (id + (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) + (Eq.symm hPE.right))) + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W)))⟩ : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovClosure mu4 + (A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc) + W)) + fun + (hSER : + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), + R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + Exists.casesOn hSER.right + fun (f : E) + (h : R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + And.casesOn h + fun (he : R.series.data.connectingEdges n = { f }) + (ha : TreeSequenceAdjoinEdge Tn f seed) ↦ + Or.inr + (⟨Eq.mpr + (id + (congr + (congrArg Or (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.SE))) + (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.RE)))) + hSER.left, + Exists.intro f + (Exists.intro seed + (⟨Eq.trans hedges he, + (⟨Eq.mpr + (id (congrFun' (congrFun' (congrArg TreeSequenceAdjoinEdge htree) f) seed)) + ha, + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W))⟩ : + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)⟩ : + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W))⟩ : + (A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.SE ∨ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)) : + RutgersClosedPresentation G k e0 original }; + ∀ + (Q1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a1) + (Sum.inl counterexample.b1)) + (Q2 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a2) + (Sum.inl counterexample.b2)) + (Q3 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a3) + (Sum.inl counterexample.b3)) + (c1 : V) (hc1 : Sum.inl c1 ∈ Q1.support) (g1 : E) (c2 : V) (hc2 : Sum.inl c2 ∈ Q2.support) + (g2 : E) (c3 : V) (hc3 : Sum.inl c3 ∈ Q3.support) (g3 : E), + let L1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a1) + (Sum.inl c1) := + Q1.takeUntil (Sum.inl c1) hc1; + let L2 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a2) + (Sum.inl c2) := + Q2.takeUntil (Sum.inl c2) hc2; + let L3 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a3) + (Sum.inl c3) := + Q3.takeUntil (Sum.inl c3) hc3; + ∀ (_ : (∀ x ∈ L1.support, x ∉ L2.support)) (_ : (∀ x ∈ L1.support, x ∉ L3.support)) + (_ : (∀ x ∈ L2.support, x ∉ L3.support)) + (_ : L1.length + L2.length + L3.length < RutgersCounterexampleMeasure counterexample), + let Package : Type (max u_1 u_1 u_2) := + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E; + let Good : Package → Prop := fun (p : Package) ↦ + TreeExitPath W mu4 counterexample.beta gamma p.fst p.snd.fst p.snd.snd.1 ∧ + p.snd.snd.2 ∈ BoundaryColorEdges G mu4 (TreeSequenceVertexSet W) gamma ∧ + Incident G p.snd.fst p.snd.snd.2 ∧ Sum.inr p.snd.snd.2 ∈ p.snd.snd.1.support; + let pack1 : Package := + (⟨counterexample.a1, + (⟨c1, (L1, g1)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a1) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + let pack2 : Package := + (⟨counterexample.a2, + (⟨c2, (L2, g2)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a2) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + let pack3 : Package := + (⟨counterexample.a3, + (⟨c3, (L3, g3)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a3) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + ∀ (_ : Good pack1) (_ : Good pack2) (_ : Good pack3) + (_ : + (∀ (p q r : Package) (_ : Good p) (_ : Good q) (_ : Good r) + (_ : (∀ x ∈ p.snd.snd.1.support, x ∉ q.snd.snd.1.support)) + (_ : (∀ x ∈ p.snd.snd.1.support, x ∉ r.snd.snd.1.support)) + (_ : (∀ x ∈ q.snd.snd.1.support, x ∉ r.snd.snd.1.support)) + (_ : TreeVertexOrder W p.snd.fst q.snd.fst) (_ : TreeVertexOrder W q.snd.fst r.snd.fst), + ∃ (C' : RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure C' = + p.snd.snd.1.length + q.snd.snd.1.length + r.snd.snd.1.length)) + (j1 : Fin (W.length + (1 : ℕ))) (_ : W.vertex j1 = c1) (j2 : Fin (W.length + (1 : ℕ))) + (_ : W.vertex j2 = c2) (j3 : Fin (W.length + (1 : ℕ))) (_ : W.vertex j3 = c3) + (_ : (↑j1 : ℕ) ≠ (↑j2 : ℕ)) (_ : (↑j1 : ℕ) ≠ (↑j3 : ℕ)) (_ : (↑j2 : ℕ) ≠ (↑j3 : ℕ)) + (_ : ¬(↑j1 : ℕ) < (↑j2 : ℕ)), + ∃ (newCounterexample : RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure newCounterexample < + RutgersCounterexampleMeasure counterexample + +private abbrev helperBranch1689Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput presentation.U + presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ∀ (seed : TreeSequence G e0) + (hseed : + R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) + (gamma : Fin k), + let mu3 : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ (i3 : Fin (presentation.U.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) + (hi3le : (↑i3 : ℕ) ≤ U.length), + let C : TreeSequence G e0 := TreeSequencePrefix U (↑i3 : ℕ) hi3pos hi3le; + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (W : TreeSequence G e0) (hW : TashkinovClosure mu4 C W) + (route4W : TashkinovAugmentationSequence mu4 seed W) + (A40 : CorrespondingExtendedTashkinovTree G k e0 original mu4 W) + (max40 : MaximumProperty A40.replacementETT) + (agree40 : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)) + (agree0 : + presentation.corresponding.replacementETT.series.data.tree + (Fin.last presentation.corresponding.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + presentation.corresponding.replacementETT.series.data.kind + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + presentation.corresponding.replacementETT.series.data.connectingEdges + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)), + let newPresentation : RutgersClosedPresentation G k e0 original := + { + sigma := mu4, U := W, corresponding := A40, maximum := max40, + terminalRoute := + id + (have htree : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = Tn := + Eq.trans agree40.left (Eq.symm agree0.left); + have hkind : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + R.series.data.kind n := + Eq.trans agree40.right.left (Eq.symm agree0.right.left); + have hedges : + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + R.series.data.connectingEdges n := + Eq.trans agree40.right.right (Eq.symm agree0.right.right); + Or.casesOn hseed + (fun (hPE : R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn) ↦ + Or.inl + (⟨Eq.trans hkind hPE.left, + Eq.mpr + (id (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) htree)) + (Eq.mpr + (id + (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) + (Eq.symm hPE.right))) + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W)))⟩ : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovClosure mu4 + (A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc) + W)) + fun + (hSER : + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), + R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + Exists.casesOn hSER.right + fun (f : E) + (h : R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + And.casesOn h + fun (he : R.series.data.connectingEdges n = { f }) + (ha : TreeSequenceAdjoinEdge Tn f seed) ↦ + Or.inr + (⟨Eq.mpr + (id + (congr + (congrArg Or (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.SE))) + (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.RE)))) + hSER.left, + Exists.intro f + (Exists.intro seed + (⟨Eq.trans hedges he, + (⟨Eq.mpr + (id (congrFun' (congrFun' (congrArg TreeSequenceAdjoinEdge htree) f) seed)) + ha, + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W))⟩ : + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)⟩ : + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W))⟩ : + (A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.SE ∨ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)) : + RutgersClosedPresentation G k e0 original }; + ∀ + (Q1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a1) + (Sum.inl counterexample.b1)) + (Q2 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a2) + (Sum.inl counterexample.b2)) + (Q3 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a3) + (Sum.inl counterexample.b3)) + (c1 : V) (hc1 : Sum.inl c1 ∈ Q1.support) (g1 : E) (c2 : V) (hc2 : Sum.inl c2 ∈ Q2.support) + (g2 : E) (c3 : V) (hc3 : Sum.inl c3 ∈ Q3.support) (g3 : E), + let L1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a1) + (Sum.inl c1) := + Q1.takeUntil (Sum.inl c1) hc1; + let L2 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a2) + (Sum.inl c2) := + Q2.takeUntil (Sum.inl c2) hc2; + let L3 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a3) + (Sum.inl c3) := + Q3.takeUntil (Sum.inl c3) hc3; + ∀ (_ : (∀ x ∈ L1.support, x ∉ L2.support)) (_ : (∀ x ∈ L1.support, x ∉ L3.support)) + (_ : (∀ x ∈ L2.support, x ∉ L3.support)) + (_ : L1.length + L2.length + L3.length < RutgersCounterexampleMeasure counterexample), + let Package : Type (max u_1 u_2) := + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E; + let Good : Package → Prop := fun (p : Package) ↦ + TreeExitPath W mu4 counterexample.beta gamma p.fst p.snd.fst p.snd.snd.1 ∧ + p.snd.snd.2 ∈ BoundaryColorEdges G mu4 (TreeSequenceVertexSet W) gamma ∧ + Incident G p.snd.fst p.snd.snd.2 ∧ Sum.inr p.snd.snd.2 ∈ p.snd.snd.1.support; + let pack1 : Package := + (⟨counterexample.a1, + (⟨c1, (L1, g1)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a1) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + let pack2 : Package := + (⟨counterexample.a2, + (⟨c2, (L2, g2)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a2) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + let pack3 : Package := + (⟨counterexample.a3, + (⟨c3, (L3, g3)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a3) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + ∀ (_ : Good pack1) (_ : Good pack2) (_ : Good pack3) + (_ : + (∀ (p q r : Package) (_ : Good p) (_ : Good q) (_ : Good r) + (_ : (∀ x ∈ p.snd.snd.1.support, x ∉ q.snd.snd.1.support)) + (_ : (∀ x ∈ p.snd.snd.1.support, x ∉ r.snd.snd.1.support)) + (_ : (∀ x ∈ q.snd.snd.1.support, x ∉ r.snd.snd.1.support)) + (_ : TreeVertexOrder W p.snd.fst q.snd.fst) (_ : TreeVertexOrder W q.snd.fst r.snd.fst), + ∃ (C' : RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure C' = + p.snd.snd.1.length + q.snd.snd.1.length + r.snd.snd.1.length)) + (j1 : Fin (W.length + (1 : ℕ))) (_ : W.vertex j1 = c1) (j2 : Fin (W.length + (1 : ℕ))) + (_ : W.vertex j2 = c2) (j3 : Fin (W.length + (1 : ℕ))) (_ : W.vertex j3 = c3) + (_ : (↑j1 : ℕ) ≠ (↑j3 : ℕ)) (_ : (↑j2 : ℕ) ≠ (↑j3 : ℕ)) (_ : (↑j1 : ℕ) < (↑j2 : ℕ)) + (_ : ¬(↑j2 : ℕ) < (↑j3 : ℕ)), + ∃ (newCounterexample : RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure newCounterexample < + RutgersCounterexampleMeasure counterexample + +private abbrev helperBranch1588Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput presentation.U + presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ∀ (seed : TreeSequence G e0) + (hseed : + R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) + (gamma : Fin k), + let mu3 : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a1) + (Sum.inl counterexample.b1)) + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a2) + (Sum.inl counterexample.b2)) + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a3) + (Sum.inl counterexample.b3)) + (_ _ i3 : Fin (presentation.U.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) + (hi3le : (↑i3 : ℕ) ≤ U.length) (_ : (1 : ℕ) ≤ (↑i3 : ℕ) - (1 : ℕ)), + let C : TreeSequence G e0 := TreeSequencePrefix U (↑i3 : ℕ) hi3pos hi3le; + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (W : TreeSequence G e0) (hW : TashkinovClosure mu4 C W) + (route4W : TashkinovAugmentationSequence mu4 seed W) + (A40 : CorrespondingExtendedTashkinovTree G k e0 original mu4 W) + (max40 : MaximumProperty A40.replacementETT) + (agree40 : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)) + (agree0 : + presentation.corresponding.replacementETT.series.data.tree + (Fin.last presentation.corresponding.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + presentation.corresponding.replacementETT.series.data.kind + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + presentation.corresponding.replacementETT.series.data.connectingEdges + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)), + let newPresentation : RutgersClosedPresentation G k e0 original := + { + sigma := mu4, U := W, corresponding := A40, maximum := max40, + terminalRoute := + id + (have htree : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = Tn := + Eq.trans agree40.left (Eq.symm agree0.left); + have hkind : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + R.series.data.kind n := + Eq.trans agree40.right.left (Eq.symm agree0.right.left); + have hedges : + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + R.series.data.connectingEdges n := + Eq.trans agree40.right.right (Eq.symm agree0.right.right); + Or.casesOn hseed + (fun (hPE : R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn) ↦ + Or.inl + (⟨Eq.trans hkind hPE.left, + Eq.mpr + (id (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) htree)) + (Eq.mpr + (id + (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) + (Eq.symm hPE.right))) + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W)))⟩ : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovClosure mu4 + (A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc) + W)) + fun + (hSER : + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), + R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + Exists.casesOn hSER.right + fun (f : E) + (h : R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + And.casesOn h + fun (he : R.series.data.connectingEdges n = { f }) + (ha : TreeSequenceAdjoinEdge Tn f seed) ↦ + Or.inr + (⟨Eq.mpr + (id + (congr + (congrArg Or (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.SE))) + (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.RE)))) + hSER.left, + Exists.intro f + (Exists.intro seed + (⟨Eq.trans hedges he, + (⟨Eq.mpr + (id (congrFun' (congrFun' (congrArg TreeSequenceAdjoinEdge htree) f) seed)) + ha, + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W))⟩ : + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)⟩ : + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W))⟩ : + (A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.SE ∨ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)) : + RutgersClosedPresentation G k e0 original }; + ∀ + (Q1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a1) + (Sum.inl counterexample.b1)) + (Q2 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a2) + (Sum.inl counterexample.b2)) + (Q3 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a3) + (Sum.inl counterexample.b3)) + (c1 : V) (hc1 : Sum.inl c1 ∈ Q1.support) (g1 : E) (c2 : V) (hc2 : Sum.inl c2 ∈ Q2.support) + (g2 : E) (c3 : V) (hc3 : Sum.inl c3 ∈ Q3.support) (g3 : E), + let L1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a1) + (Sum.inl c1) := + Q1.takeUntil (Sum.inl c1) hc1; + let L2 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a2) + (Sum.inl c2) := + Q2.takeUntil (Sum.inl c2) hc2; + let L3 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a3) + (Sum.inl c3) := + Q3.takeUntil (Sum.inl c3) hc3; + ∀ (_ : (∀ x ∈ L1.support, x ∉ L2.support)) (_ : (∀ x ∈ L1.support, x ∉ L3.support)) + (_ : (∀ x ∈ L2.support, x ∉ L3.support)) + (_ : L1.length + L2.length + L3.length < RutgersCounterexampleMeasure counterexample), + let Package : Type (max u_1 u_1 u_2) := + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E; + let Good : Package → Prop := fun (p : Package) ↦ + TreeExitPath W mu4 counterexample.beta gamma p.fst p.snd.fst p.snd.snd.1 ∧ + p.snd.snd.2 ∈ BoundaryColorEdges G mu4 (TreeSequenceVertexSet W) gamma ∧ + Incident G p.snd.fst p.snd.snd.2 ∧ Sum.inr p.snd.snd.2 ∈ p.snd.snd.1.support; + let pack1 : Package := + (⟨counterexample.a1, + (⟨c1, (L1, g1)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a1) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + let pack2 : Package := + (⟨counterexample.a2, + (⟨c2, (L2, g2)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a2) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + let pack3 : Package := + (⟨counterexample.a3, + (⟨c3, (L3, g3)⟩ : + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a3) (Sum.inl b) × + E)⟩ : + (a : V) × + (b : V) × + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × + E); + ∀ (_ : Good pack1) (_ : Good pack2) (_ : Good pack3) + (_ : + (∀ (p q r : Package) (_ : Good p) (_ : Good q) (_ : Good r) + (_ : (∀ x ∈ p.snd.snd.1.support, x ∉ q.snd.snd.1.support)) + (_ : (∀ x ∈ p.snd.snd.1.support, x ∉ r.snd.snd.1.support)) + (_ : (∀ x ∈ q.snd.snd.1.support, x ∉ r.snd.snd.1.support)) + (_ : TreeVertexOrder W p.snd.fst q.snd.fst) (_ : TreeVertexOrder W q.snd.fst r.snd.fst), + ∃ (C' : RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure C' = + p.snd.snd.1.length + q.snd.snd.1.length + r.snd.snd.1.length)) + (j1 : Fin (W.length + (1 : ℕ))) (_ : W.vertex j1 = c1) (j2 : Fin (W.length + (1 : ℕ))) + (_ : W.vertex j2 = c2) (j3 : Fin (W.length + (1 : ℕ))) (_ : W.vertex j3 = c3) + (_ : (↑j1 : ℕ) ≠ (↑j3 : ℕ)) (_ : (↑j2 : ℕ) ≠ (↑j3 : ℕ)) (_ : (↑j1 : ℕ) < (↑j2 : ℕ)), + ∃ (newCounterexample : RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure newCounterexample < + RutgersCounterexampleMeasure counterexample + +private abbrev helperContinuation2244Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput presentation.U + presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + ∀ (seed : TreeSequence G e0) + (hseed : + R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) + (_ : counterexample.b1 ∈ TreeSequenceVertexSet U) + (_ : counterexample.b2 ∈ TreeSequenceVertexSet U) + (_ : counterexample.b3 ∈ TreeSequenceVertexSet U) (gamma : Fin k) + (_ : gamma ≠ counterexample.beta), + let mu3 : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ + (_ : + (∀ {phi : PartialEdgeColoring E k} {a b : Fin k} {u v : V} + (p : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl u) (Sum.inl v)) (_ : p.IsPath) {f : E} + (_ : Sum.inr f ∈ p.support), + ∃ (j : ℕ) (x : V) (y : V), + (0 : ℕ) < j ∧ + j < p.length ∧ + p.getVert j = Sum.inr f ∧ + p.getVert (j - (1 : ℕ)) = Sum.inl x ∧ + p.getVert (j + (1 : ℕ)) = Sum.inl y ∧ + Incident G x f ∧ Incident G y f ∧ x ≠ y ∧ G.ends f = s(x, y))) + (P1 : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a1) + (Sum.inl counterexample.b1)) + (_ : P1.support = counterexample.Q1.support) (_ : P1.length = counterexample.Q1.length) + (P2 : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a2) + (Sum.inl counterexample.b2)) + (_ : P2.support = counterexample.Q2.support) (_ : P2.length = counterexample.Q2.length) + (P3 : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a3) + (Sum.inl counterexample.b3)) + (_ : P3.support = counterexample.Q3.support) (_ : P3.length = counterexample.Q3.length) + (_ _ i3 : Fin (presentation.U.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) + (hi3le : (↑i3 : ℕ) ≤ U.length) (_ : (1 : ℕ) ≤ (↑i3 : ℕ) - (1 : ℕ)), + let C : TreeSequence G e0 := TreeSequencePrefix U (↑i3 : ℕ) hi3pos hi3le; + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (W : TreeSequence G e0) (hW : TashkinovClosure mu4 C W) + (route4W : TashkinovAugmentationSequence mu4 seed W) + (A40 : CorrespondingExtendedTashkinovTree G k e0 original mu4 W) + (max40 : MaximumProperty A40.replacementETT) + (agree40 : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)) + (agree0 : + presentation.corresponding.replacementETT.series.data.tree + (Fin.last presentation.corresponding.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + presentation.corresponding.replacementETT.series.data.kind + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) ∧ + presentation.corresponding.replacementETT.series.data.connectingEdges + (Fin.last presentation.corresponding.replacementETT.rounds) = + original.series.data.connectingEdges (Fin.last original.rounds)), + let _ : RutgersClosedPresentation G k e0 original := + { + sigma := mu4, U := W, corresponding := A40, maximum := max40, + terminalRoute := + id + (have htree : + A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc = Tn := + Eq.trans agree40.left (Eq.symm agree0.left); + have hkind : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + R.series.data.kind n := + Eq.trans agree40.right.left (Eq.symm agree0.right.left); + have hedges : + A40.replacementETT.series.data.connectingEdges (Fin.last A40.replacementETT.rounds) = + R.series.data.connectingEdges n := + Eq.trans agree40.right.right (Eq.symm agree0.right.right); + Or.casesOn hseed + (fun (hPE : R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn) ↦ + Or.inl + (⟨Eq.trans hkind hPE.left, + Eq.mpr + (id (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) htree)) + (Eq.mpr + (id + (congrArg (fun (_a : TreeSequence G e0) ↦ TashkinovClosure mu4 _a W) + (Eq.symm hPE.right))) + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W)))⟩ : + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovClosure mu4 + (A40.replacementETT.series.data.tree (Fin.last A40.replacementETT.rounds).castSucc) + W)) + fun + (hSER : + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), + R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + Exists.casesOn hSER.right + fun (f : E) + (h : R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed) ↦ + And.casesOn h + fun (he : R.series.data.connectingEdges n = { f }) + (ha : TreeSequenceAdjoinEdge Tn f seed) ↦ + Or.inr + (⟨Eq.mpr + (id + (congr + (congrArg Or (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.SE))) + (congrFun' (congrArg Eq hkind) (some TashkinovExtensionKind.RE)))) + hSER.left, + Exists.intro f + (Exists.intro seed + (⟨Eq.trans hedges he, + (⟨Eq.mpr + (id (congrFun' (congrFun' (congrArg TreeSequenceAdjoinEdge htree) f) seed)) + ha, + (⟨route4W, fun {_ : E} {_ : Fin k} {_ : V} ↦ hW.right⟩ : + TashkinovAugmentationSequence mu4 seed W ∧ + ColoredVertexSetClosed G mu4 (TreeSequenceVertexSet W))⟩ : + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)⟩ : + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W))⟩ : + (A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.SE ∨ + A40.replacementETT.series.data.kind (Fin.last A40.replacementETT.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = + { f } ∧ + TreeSequenceAdjoinEdge + (A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc) + f seed ∧ + TashkinovClosure mu4 seed W)) : + RutgersClosedPresentation G k e0 original }; + ∀ (_ : ColoredVertexSetElementary G mu4 (TreeSequenceVertexSet W)) + (Q1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a1) + (Sum.inl counterexample.b1)) + (_ : TreeExitPath U mu4 counterexample.beta gamma counterexample.a1 counterexample.b1 Q1) + (_ : Q1.support = P1.support) (_ : Q1.length = P1.length) + (Q2 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a2) + (Sum.inl counterexample.b2)) + (_ : TreeExitPath U mu4 counterexample.beta gamma counterexample.a2 counterexample.b2 Q2) + (_ : Q2.support = P2.support) (_ : Q2.length = P2.length) + (Q3 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl counterexample.a3) + (Sum.inl counterexample.b3)) + (_ : TreeExitPath U mu4 counterexample.beta gamma counterexample.a3 counterexample.b3 Q3) + (_ : Q3.support = P3.support) (_ : Q3.length = P3.length) + (_ : counterexample.b1 ∈ TreeSequenceVertexSet W) + (_ : counterexample.b2 ∈ TreeSequenceVertexSet W) + (_ : counterexample.b3 ∈ TreeSequenceVertexSet W) + (_ : counterexample.beta ∈ MissingColors G mu4 counterexample.b3) + (_ : counterexample.beta ∈ TreeMissingColors mu4 W) + (_ : + (∀ {b : V} {f : E} (_ : b ∈ TreeSequenceVertexSet U) (_ : b ≠ counterexample.b3) + (_ : Incident G b f) (_ : sigma f = some counterexample.beta), + mu4 f = some counterexample.beta)), + ∃ (newPresentation : RutgersClosedPresentation G k e0 original) (newCounterexample : + RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure newCounterexample < RutgersCounterexampleMeasure counterexample + +private abbrev helperContinuation2163Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (_ : current.rounds = original.rounds) (_ : MaximumProperty current), + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T'))) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation) + (_ : + (∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) + (_ : TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) + (_ : + (∀ {i : PartialEdgeColoring E k} {A : TreeSequence G e0} {phi : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 i A phi) {psi : PartialEdgeColoring E k} + {B : TreeSequence G e0} (corr : CorrespondingExtendedTashkinovTree G k e0 base psi B), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + base.series.data.tree (Fin.last base.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + base.series.data.kind (Fin.last base.rounds) ∧ + corr.replacementETT.series.data.connectingEdges (Fin.last corr.replacementETT.rounds) = + base.series.data.connectingEdges (Fin.last base.rounds))), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput presentation.U + presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.series.data n; + ∀ (seed : TreeSequence G e0) + (_ : + (R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed)) + (_ : counterexample.b1 ∈ TreeSequenceVertexSet U) + (_ : counterexample.b2 ∈ TreeSequenceVertexSet U) + (_ : counterexample.b3 ∈ TreeSequenceVertexSet U) (gamma : Fin k) + (_ : gamma ≠ counterexample.beta), + let mu3 : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ + (_ : + (IsProperEdgeColoring G mu3 ∧ + IsOneEdgeUncolored mu3 e0 ∧ + StableColoring U Dn sigma mu3 ∧ ∀ (f : E), TreeIncidentEdge U f → mu3 f = sigma f)) + (_ : TashkinovAugmentationSequence mu3 seed U) + (A3 : CorrespondingExtendedTashkinovTree G k e0 R mu3 U) + (_ : MaximumProperty A3.replacementETT) + (_ : + (∀ {phi : PartialEdgeColoring E k} {a b : Fin k} {u v : V} + (p : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl u) (Sum.inl v)) (_ : p.IsPath) {f : E} + (_ : Sum.inr f ∈ p.support), + ∃ (j : ℕ) (x : V) (y : V), + (0 : ℕ) < j ∧ + j < p.length ∧ + p.getVert j = Sum.inr f ∧ + p.getVert (j - (1 : ℕ)) = Sum.inl x ∧ + p.getVert (j + (1 : ℕ)) = Sum.inl y ∧ + Incident G x f ∧ Incident G y f ∧ x ≠ y ∧ G.ends f = s(x, y))) + (P1 : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a1) + (Sum.inl counterexample.b1)) + (_ : TreeExitPath U mu3 gamma counterexample.beta counterexample.a1 counterexample.b1 P1) + (_ : P1.support = counterexample.Q1.support) (_ : P1.length = counterexample.Q1.length) + (P2 : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a2) + (Sum.inl counterexample.b2)) + (_ : TreeExitPath U mu3 gamma counterexample.beta counterexample.a2 counterexample.b2 P2) + (_ : P2.support = counterexample.Q2.support) (_ : P2.length = counterexample.Q2.length) + (P3 : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl counterexample.a3) + (Sum.inl counterexample.b3)) + (_ : TreeExitPath U mu3 gamma counterexample.beta counterexample.a3 counterexample.b3 P3) + (_ : P3.support = counterexample.Q3.support) (_ : P3.length = counterexample.Q3.length) + (_ i2 i3 : Fin (presentation.U.length + (1 : ℕ))) (_ : (↑i2 : ℕ) < (↑i3 : ℕ)) + (_ : Tn.length < (↑i2 : ℕ)) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) (hi3le : (↑i3 : ℕ) ≤ U.length) + (hi3prevpos : (1 : ℕ) ≤ (↑i3 : ℕ) - (1 : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix U ((↑i3 : ℕ) - (1 : ℕ)) hi3prevpos + (Decidable.byContradiction fun (a : ¬(↑i3 : ℕ) - (1 : ℕ) ≤ U.length) ↦ by omega); + let C : TreeSequence G e0 := TreeSequencePrefix U (↑i3 : ℕ) hi3pos hi3le; + ∀ (_ : C.length = (↑i3 : ℕ)) (_ : TreeSequenceInitialSegment C U) + (_ : TreeSequenceInitialSegment B C) (_ : C.length = B.length + (1 : ℕ)) + (_ : TreeSequenceInitialSegment Tn B) (_ : TreeSequenceInitialSegment seed C) + (_ : counterexample.b3 ∈ TreeSequenceVertexSet C) + (_ : counterexample.b1 ∈ TreeSequenceVertexSet C) + (_ : counterexample.b2 ∈ TreeSequenceVertexSet C), + let K : Set (V ⊕ E) := + TwoColorComponent G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (_ : gamma ∈ MissingColors G mu3 counterexample.b3) + (_ : (∀ w ∈ TreeSequenceVertexSet U, Sum.inl w ∈ K ↔ w = counterexample.b3)) + (_ : (∀ {v : V} (_ : Sum.inl v ∉ K) {f : E} (_ : Incident G v f), mu4 f = mu3 f)) + (_ : + (have C : Set (V ⊕ E) := + TwoColorComponent G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G mu3 v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + gamma ∈ MissingColors G mu3 v → counterexample.beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + counterexample.beta ∈ MissingColors G mu3 v → gamma ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ gamma → + c ≠ counterexample.beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G mu3 v))) + (_ : (∀ v ∈ TreeSequenceVertexSet B, MissingColors G mu4 v = MissingColors G mu3 v)) + (_ : + A3.replacementETT.series.data.tree (Fin.last A3.replacementETT.rounds).castSucc = + R.series.data.tree (Fin.last R.rounds).castSucc ∧ + A3.replacementETT.series.data.kind (Fin.last A3.replacementETT.rounds) = + R.series.data.kind (Fin.last R.rounds) ∧ + A3.replacementETT.series.data.connectingEdges (Fin.last A3.replacementETT.rounds) = + R.series.data.connectingEdges (Fin.last R.rounds)) + (_ : ModColoring A3.replacementETT mu4) + (_ : (∀ (j : Fin C.length), mu4 (C.edge j) = mu3 (C.edge j))), + ∃ (newPresentation : RutgersClosedPresentation G k e0 original) (newCounterexample : + RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure newCounterexample < RutgersCounterexampleMeasure counterexample + +private abbrev helperContinuation2093Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (_ : current.rounds = original.rounds) (_ : MaximumProperty current), + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T'))) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (_ : current.rounds = original.rounds) (_ : MaximumProperty current), + let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := current.series.data.tree terminal.castSucc; + ∀ (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) + (_ : IsOneEdgeUncolored sigma e0) + (_ : + StableColoring Tterminal (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma), + ModColoring current sigma)) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation) + (_ : + (∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) + (_ : TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) + (_ : + (∀ {i : PartialEdgeColoring E k} {A : TreeSequence G e0} {phi : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 i A phi) {psi : PartialEdgeColoring E k} + {B : TreeSequence G e0} (corr : CorrespondingExtendedTashkinovTree G k e0 base psi B), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + base.series.data.tree (Fin.last base.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + base.series.data.kind (Fin.last base.rounds) ∧ + corr.replacementETT.series.data.connectingEdges (Fin.last corr.replacementETT.rounds) = + base.series.data.connectingEdges (Fin.last base.rounds))), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput presentation.U + presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.series.data n; + ∀ (seed : TreeSequence G e0) + (_ : + (R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed)) + (_ : counterexample.b1 ∈ TreeSequenceVertexSet U) + (_ : counterexample.b2 ∈ TreeSequenceVertexSet U) + (_ : counterexample.b3 ∈ TreeSequenceVertexSet U), + ∀ gamma ∈ MissingColors G sigma counterexample.b3, + gamma ≠ counterexample.beta → + let mu3 : PartialEdgeColoring E k := OutsideTreeColorSwap U sigma counterexample.alpha gamma; + (IsProperEdgeColoring G mu3 ∧ + IsOneEdgeUncolored mu3 e0 ∧ + StableColoring U Dn sigma mu3 ∧ ∀ (f : E), TreeIncidentEdge U f → mu3 f = sigma f) → + TashkinovAugmentationSequence mu3 seed U → + ∀ (A3 : CorrespondingExtendedTashkinovTree G k e0 R mu3 U), + MaximumProperty A3.replacementETT → + (∀ {phi : PartialEdgeColoring E k} {a b : Fin k} {u v : V} + (p : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl u) (Sum.inl v)), + p.IsPath → + ∀ {f : E}, + Sum.inr f ∈ p.support → + ∃ (j : ℕ) (x : V) (y : V), + (0 : ℕ) < j ∧ + j < p.length ∧ + p.getVert j = Sum.inr f ∧ + p.getVert (j - (1 : ℕ)) = Sum.inl x ∧ + p.getVert (j + (1 : ℕ)) = Sum.inl y ∧ + Incident G x f ∧ Incident G y f ∧ x ≠ y ∧ G.ends f = s(x, y)) → + ∀ + (P1 : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk + (Sum.inl counterexample.a1) (Sum.inl counterexample.b1)), + TreeExitPath U mu3 gamma counterexample.beta counterexample.a1 counterexample.b1 P1 → + P1.support = counterexample.Q1.support → + P1.length = counterexample.Q1.length → + ∀ + (P2 : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk + (Sum.inl counterexample.a2) (Sum.inl counterexample.b2)), + TreeExitPath U mu3 gamma counterexample.beta counterexample.a2 counterexample.b2 + P2 → + P2.support = counterexample.Q2.support → + P2.length = counterexample.Q2.length → + ∀ + (P3 : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk + (Sum.inl counterexample.a3) (Sum.inl counterexample.b3)), + TreeExitPath U mu3 gamma counterexample.beta counterexample.a3 counterexample.b3 + P3 → + P3.support = counterexample.Q3.support → + P3.length = counterexample.Q3.length → + ∀ (i1 i2 : Fin (presentation.U.length + (1 : ℕ))), + presentation.U.vertex i1 = counterexample.b1 → + presentation.U.vertex i2 = counterexample.b2 → + (↑i1 : ℕ) < (↑i2 : ℕ) → + ∀ (i3 : Fin (presentation.U.length + (1 : ℕ))), + presentation.U.vertex i3 = counterexample.b3 → + (↑i2 : ℕ) < (↑i3 : ℕ) → + Tn.length < (↑i2 : ℕ) → + ∀ (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) (hi3le : (↑i3 : ℕ) ≤ U.length) + (hi3prevpos : (1 : ℕ) ≤ (↑i3 : ℕ) - (1 : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix U ((↑i3 : ℕ) - (1 : ℕ)) hi3prevpos + (Decidable.byContradiction + fun (a : ¬(↑i3 : ℕ) - (1 : ℕ) ≤ U.length) ↦ by omega); + let C : TreeSequence G e0 := + TreeSequencePrefix U (↑i3 : ℕ) hi3pos hi3le; + C.length = (↑i3 : ℕ) → + TreeSequenceInitialSegment B U → + TreeSequenceInitialSegment C U → + TreeSequenceInitialSegment B C → + C.length = B.length + (1 : ℕ) → + TreeSequenceInitialSegment Tn B → + TreeSequenceInitialSegment seed B → + ∃ (newPresentation : + RutgersClosedPresentation G k e0 original) + (newCounterexample : + RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure newCounterexample < + RutgersCounterexampleMeasure counterexample + +private theorem helper_edgeVertices_296.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (_ : RutgersClosedPresentation G k e0 original) {phi : PartialEdgeColoring E k} + {a b : Fin k} {u v : V} + (p : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl u) (Sum.inl v)), + p.IsPath → + ∀ {f : E}, + Sum.inr f ∈ p.support → + ∃ (j : ℕ) (x : V) (y : V), + (0 : ℕ) < j ∧ + j < p.length ∧ + p.getVert j = Sum.inr f ∧ + p.getVert (j - (1 : ℕ)) = Sum.inl x ∧ + p.getVert (j + (1 : ℕ)) = Sum.inl y ∧ + Incident G x f ∧ Incident G y f ∧ x ≠ y ∧ G.ends f = s(x, y) := by + classical + intro V E _ _ _ G k e0 input T generating original presentation phi a b u v p hp f hf + obtain ⟨j, hj, hjle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hjpos : 0 < j := by + by_contra h + have : j = 0 := by omega + simp [this] at hj + have hjlt : j < p.length := by + by_contra h + have : j = p.length := by omega + simp [this] at hj + have hl := p.adj_getVert_succ (i := j - 1) (by omega) + have hr := p.adj_getVert_succ hjlt + rw [show j - 1 + 1 = j by omega, hj] at hl + rw [hj] at hr + cases hx : p.getVert (j - 1) with + | inr g => rw [hx] at hl; exact hl.elim + | inl x => + rw [hx] at hl + cases hy : p.getVert (j + 1) with + | inr g => rw [hy] at hr; exact hr.elim + | inl y => + rw [hy] at hr + have hxf : Incident G x f := hl.1 + have hyf : Incident G y f := hr.1 + have hxy : x ≠ y := by + intro h + have heq : p.getVert (j - 1) = p.getVert (j + 1) := by rw [hx, hy, h] + have := hp.getVert_injOn (by omega : j - 1 ≤ p.length) + (by omega : j + 1 ≤ p.length) heq + omega + exact ⟨j, x, y, hjpos, hjlt, hj, hx, hy, hxf, hyf, hxy, + (Sym2.mem_and_mem_iff hxy).mp ⟨hxf, hyf⟩⟩ + +private theorem helper_remote3_362.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors R.series.data n; + ∀ (seed : TreeSequence G e0) (_ : TashkinovClosure sigma seed U) + (_ : counterexample.b3 ∈ TreeSequenceVertexSet U), + ∀ gamma ∈ MissingColors G sigma counterexample.b3, + gamma ≠ counterexample.beta → + let mu3 : PartialEdgeColoring E k := + OutsideTreeColorSwap U sigma counterexample.alpha gamma; + (IsProperEdgeColoring G mu3 ∧ + IsOneEdgeUncolored mu3 e0 ∧ + StableColoring U Dn sigma mu3 ∧ + ∀ (f : E), TreeIncidentEdge U f → mu3 f = sigma f) → + ∀ (A3 : CorrespondingExtendedTashkinovTree G k e0 R mu3 U) + (A30 : CorrespondingExtendedTashkinovTree G k e0 original mu3 U), + A30.replacementInput = A3.replacementInput → + A30.replacementSeries ≍ A3.replacementSeries → + (∀ {u : V} {f : E}, + u ∉ TreeSequenceVertexSet U → + Incident G u f → + TreeIncidentEdge U f → f ∈ BoundaryEdges G (TreeSequenceVertexSet U)) → + ∀ {u : V}, + u ∉ TreeSequenceVertexSet U → + counterexample.alpha ∈ MissingColors G sigma u ∨ + counterexample.beta ∈ MissingColors G sigma u → + gamma ∈ MissingColors G mu3 u ∨ counterexample.beta ∈ MissingColors G mu3 u := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R U sigma n Dn + seed hclosure hb3 gamma hgamma hgammaBeta mu3 hswap3 A3 A30 _ _ outsideBoundary u hu hm + by_cases hag : counterexample.alpha = gamma + · have heq : mu3 = sigma := by + funext f + by_cases ht : TreeIncidentEdge U f + · simp [mu3, OutsideTreeColorSwap, ht] + · by_cases hc : sigma f = some gamma <;> + simp [mu3, OutsideTreeColorSwap, ht, hag, hc] + simpa [heq, hag] using hm + rcases hm with ha | hb + · left + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] at ha ⊢ + rintro ⟨f, huf, hnew⟩ + by_cases ht : TreeIncidentEdge U f + · have hold := (hswap3.2.2.2 f ht).symm.trans hnew + exact (hclosure.2 (outsideBoundary hu huf ht) hb3 hold) hgamma + · by_cases hfa : sigma f = some counterexample.alpha + · exact ha ⟨f, huf, hfa⟩ + · by_cases hfg : sigma f = some gamma + · have heq : counterexample.alpha = gamma := by + simpa [mu3, OutsideTreeColorSwap, ht, hfa, hfg, Ne.symm hag] using hnew + exact hag heq + · exact hfg (by simp [mu3, OutsideTreeColorSwap, ht, hfa, hfg] at hnew) + · right + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] at hb ⊢ + rintro ⟨f, huf, hnew⟩ + apply hb + refine ⟨f, huf, ?_⟩ + by_cases ht : TreeIncidentEdge U f + · exact (hswap3.2.2.2 f ht).symm.trans hnew + · by_cases hfa : sigma f = some counterexample.alpha + · have : gamma = counterexample.beta := by + simpa [mu3, OutsideTreeColorSwap, ht, hfa] using hnew + exact (hgammaBeta this).elim + · by_cases hfg : sigma f = some gamma + · have : counterexample.alpha = counterexample.beta := by + simpa [mu3, OutsideTreeColorSwap, ht, hfa, hfg, Ne.symm hag] using hnew + exact (counterexample.colorsDistinct this).elim + · simpa [mu3, OutsideTreeColorSwap, ht, hfa, hfg] using hnew + +private theorem helper_transfer3_406.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors R.series.data n; + ∀ (seed : TreeSequence G e0) (_ : TashkinovClosure sigma seed U) (gamma : Fin k) + (_ : gamma ≠ counterexample.beta), + let mu3 : PartialEdgeColoring E k := + OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ + (_ : + (IsProperEdgeColoring G mu3 ∧ + IsOneEdgeUncolored mu3 e0 ∧ + StableColoring U Dn sigma mu3 ∧ + ∀ (f : E), TreeIncidentEdge U f → mu3 f = sigma f)) + (_ : + (∀ {u v : V} + (p : + (TwoColorIncidenceGraph G sigma counterexample.alpha counterexample.beta).Walk + (Sum.inl u) (Sum.inl v)) + (_ : TreeExitPath U sigma counterexample.alpha counterexample.beta u v p) {f : E} + (_ : Sum.inr f ∈ p.support) (_ : TreeIncidentEdge U f), + f ∈ BoundaryEdges G (TreeSequenceVertexSet U))) + (_ : + (∀ {u : V} (_ : u ∉ TreeSequenceVertexSet U) + (_ : + counterexample.alpha ∈ MissingColors G sigma u ∨ + counterexample.beta ∈ MissingColors G sigma u), + gamma ∈ MissingColors G mu3 u ∨ counterexample.beta ∈ MissingColors G mu3 u)) + {u v : V} + (p : + (TwoColorIncidenceGraph G sigma counterexample.alpha counterexample.beta).Walk + (Sum.inl u) (Sum.inl v)) + (_ : TreeExitPath U sigma counterexample.alpha counterexample.beta u v p), + ∃ (q : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl u) + (Sum.inl v)), + TreeExitPath U mu3 gamma counterexample.beta u v q ∧ + q.support = p.support ∧ q.length = p.length := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R U sigma n Dn + seed hclosure gamma hgammaBeta mu3 hswap3 pathBoundary remote3 u v p hexit + have preserve {w : V} {f : E} (hf : Sum.inr f ∈ p.support) + (hadj : (TwoColorIncidenceGraph G sigma counterexample.alpha counterexample.beta).Adj + (Sum.inl w) (Sum.inr f)) : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Adj + (Sum.inl w) (Sum.inr f) := by + refine ⟨hadj.1, ?_⟩ + by_cases ht : TreeIncidentEdge U f + · have hfBound := pathBoundary p hexit hf ht + have hfNotAlpha : sigma f ≠ some counterexample.alpha := by + intro h + obtain ⟨x, hx, hc⟩ := Finset.mem_biUnion.mp counterexample.alphaMissing + exact (hclosure.2 hfBound hx h) hc + exact Or.inr ((hswap3.2.2.2 f ht).trans (hadj.2.resolve_left hfNotAlpha)) + · rcases hadj.2 with hfa | hfb + · exact Or.inl (by simp [mu3, OutsideTreeColorSwap, ht, hfa]) + · exact Or.inr (by simp [mu3, OutsideTreeColorSwap, ht, hfb, + counterexample.colorsDistinct.symm, hgammaBeta.symm]) + have hedges : ∀ z, z ∈ p.edges → + z ∈ (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).edgeSet := by + intro z hz + induction z using Sym2.inductionOn with + | _ x y => + have hadj := (SimpleGraph.mem_edgeSet _).mp (p.edges_subset_edgeSet hz) + have hx := p.fst_mem_support_of_mem_edges hz + have hy := p.snd_mem_support_of_mem_edges hz + apply (SimpleGraph.mem_edgeSet _).mpr + cases x <;> cases y + · exact hadj.elim + · exact preserve hy hadj + · exact (preserve hx hadj.symm).symm + · exact hadj.elim + let q := p.transfer (TwoColorIncidenceGraph G mu3 gamma counterexample.beta) hedges + refine ⟨q, ⟨hexit.1.transfer hedges, ?_, hexit.2.2.1, hexit.2.2.2.1, + remote3 hexit.2.2.1 hexit.2.2.2.2.1, ?_⟩, by simp [q], by simp [q]⟩ + · simpa [q] using hexit.2.1 + · intro w hw + simpa [q] using hexit.2.2.2.2.2 w hw + +private theorem helper_firstEntry_790.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + ∀ (gamma : Fin k), + let mu3 : PartialEdgeColoring E k := + OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk + (Sum.inl counterexample.a1) (Sum.inl counterexample.b1)) + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk + (Sum.inl counterexample.a2) (Sum.inl counterexample.b2)) + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk + (Sum.inl counterexample.a3) (Sum.inl counterexample.b3)) + (_ _ i3 : Fin (presentation.U.length + (1 : ℕ))) (_ : (1 : ℕ) ≤ (↑i3 : ℕ)) + (_ : (↑i3 : ℕ) ≤ U.length) (_ : (1 : ℕ) ≤ (↑i3 : ℕ) - (1 : ℕ)), + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (W : TreeSequence G e0) + (_ : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a1) (Sum.inl counterexample.b1)) + (_ : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a2) (Sum.inl counterexample.b2)) + (_ : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a3) (Sum.inl counterexample.b3)) + (_ : TreeColorSetClosed G mu4 W { counterexample.beta }) {u v : V} + (p : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl u) + (Sum.inl v)) + (_ : p.IsPath) (_ : u ∉ TreeSequenceVertexSet W) (_ : v ∈ TreeSequenceVertexSet W) + (_ : counterexample.beta ∈ MissingColors G mu4 u ∨ gamma ∈ MissingColors G mu4 u), + ∃ (c : V) (hc : Sum.inl c ∈ p.support), + TreeExitPath W mu4 counterexample.beta gamma u c (p.takeUntil (Sum.inl c) hc) ∧ + ∃ f ∈ BoundaryColorEdges G mu4 (TreeSequenceVertexSet W) gamma, + Incident G c f ∧ Sum.inr f ∈ (p.takeUntil (Sum.inl c) hc).support := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample U sigma gamma + mu3 P1 P2 P3 i1 i2 i3 hi3pos hi3le hi3prevpos mu4 W Q1 Q2 Q3 betaClosed u v p hp hu hv hm + let S : Finset (Sum V E) := (TreeSequenceVertexSet W).image Sum.inl + obtain ⟨z, hzS, hzP, hzFirst⟩ := + p.exists_mem_support_forall_mem_support_imp_eq S (by + refine ⟨Sum.inl v, ?_⟩ + simp [S, hv]) + obtain ⟨c, hcW, hcz⟩ : ∃ c, c ∈ TreeSequenceVertexSet W ∧ Sum.inl c = z := by + simpa [S] using hzS + subst z + let L := p.takeUntil (Sum.inl c) hzP + have huc : u ≠ c := by intro h; exact hu (h ▸ hcW) + have hlen : 2 ≤ L.length := by + have hpos : 0 < L.length := by + apply Nat.pos_of_ne_zero + intro h + exact huc (Sum.inl.inj (SimpleGraph.Walk.length_eq_zero_iff.mp h).eq) + by_contra h + have h1 : L.length = 1 := by omega + have hadj := L.adj_getVert_succ (i := 0) (by omega) + have hend : L.getVert 1 = Sum.inl c := by simpa [h1] using L.getVert_length + rw [L.getVert_zero, hend] at hadj + exact hadj.elim + have hexit : TreeExitPath W mu4 counterexample.beta gamma u c L := by + refine ⟨hp.takeUntil _, hlen, hu, hcW, hm, ?_⟩ + intro w hw + constructor + · intro hwp + exact Sum.inl.inj (hzFirst (Sum.inl w) (by simp [S, hw]) hwp) + · rintro rfl + exact L.end_mem_support + exact ⟨c, hzP, hexit, ClosedColorExitPathBoundaryEdge G W mu4 + counterexample.beta gamma betaClosed u c L hexit⟩ + +private theorem helper_finish_912.{u_1, u_2} : + helperFinish912Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R U sigma n Tn + seed hseed gamma hgammaBeta mu3 i3 hi3pos hi3le C mu4 W hW route4W A40 max40 agree40 agree0 + newPresentation Q1 Q2 Q3 betaTree gammaNotTree Package Good p q r hp hq hr hdpq hdpr hdqr + hopq hoqr + have distinctOutside {p q : Package} + (hd : ∀ x, x ∈ p.2.2.1.support → x ∉ q.2.2.1.support) : p.1 ≠ q.1 := by + intro h + apply hd (Sum.inl p.1) p.2.2.1.start_mem_support + rw [h] + exact q.2.2.1.start_mem_support + have distinctInside {p q : Package} + (hd : ∀ x, x ∈ p.2.2.1.support → x ∉ q.2.2.1.support) : p.2.1 ≠ q.2.1 := by + intro h + apply hd (Sum.inl p.2.1) p.2.2.1.end_mem_support + rw [h] + exact q.2.2.1.end_mem_support + let C' : RutgersCounterexample G k e0 original newPresentation := { + alpha := counterexample.beta + beta := gamma + colorsDistinct := hgammaBeta.symm + alphaMissing := betaTree + betaPresent := gammaNotTree + a1 := p.1 + b1 := p.2.1 + a2 := q.1 + b2 := q.2.1 + a3 := r.1 + b3 := r.2.1 + Q1 := p.2.2.1 + Q2 := q.2.2.1 + Q3 := r.2.2.1 + f1 := p.2.2.2 + f2 := q.2.2.2 + f3 := r.2.2.2 + exit1 := hp.1 + exit2 := hq.1 + exit3 := hr.1 + supportDisjoint12 := hdpq + supportDisjoint13 := hdpr + supportDisjoint23 := hdqr + outsideDistinct12 := distinctOutside hdpq + outsideDistinct13 := distinctOutside hdpr + outsideDistinct23 := distinctOutside hdqr + insideDistinct12 := distinctInside hdpq + insideDistinct13 := distinctInside hdpr + insideDistinct23 := distinctInside hdqr + insideOrder12 := hopq + insideOrder23 := hoqr + boundary1 := hp.2.1 + boundary2 := hq.2.1 + boundary3 := hr.2.1 + incident1 := hp.2.2.1 + incident2 := hq.2.2.1 + incident3 := hr.2.2.1 + edgeOnWalk1 := hp.2.2.2 + edgeOnWalk2 := hq.2.2.2 + edgeOnWalk3 := hr.2.2.2 } + exact ⟨C', rfl⟩ + +private theorem helper_walkContained_1125.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + ∀ (gamma : Fin k), + let mu3 : PartialEdgeColoring E k := + OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ (i3 : Fin (presentation.U.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) + (hi3le : (↑i3 : ℕ) ≤ U.length), + let C : TreeSequence G e0 := TreeSequencePrefix U (↑i3 : ℕ) hi3pos hi3le; + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (W : TreeSequence G e0) (_ : TashkinovClosure mu4 C W) + (_ : counterexample.b3 ∈ TreeSequenceVertexSet W) + (_ : counterexample.beta ∈ MissingColors G mu4 counterexample.b3) {u v : V} + (_ : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl u) + (Sum.inl v)) + (_ : v ∈ TreeSequenceVertexSet W) (_ : gamma ∈ TreeMissingColors mu4 W), + u ∈ TreeSequenceVertexSet W := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample U sigma gamma + mu3 i3 hi3pos hi3le C mu4 W hW hb3W betaMissing u v p hv hg + obtain ⟨w, hw, hgw⟩ := Finset.mem_biUnion.mp hg + let H := TwoColorIncidenceGraph G mu4 counterexample.beta gamma + let inside : Sum V E → Prop := fun z => match z with + | Sum.inl x => x ∈ TreeSequenceVertexSet W + | Sum.inr f => ∀ x, Incident G x f → x ∈ TreeSequenceVertexSet W + have neighborClosed {x y : Sum V E} (hx : inside x) (hxy : H.Adj x y) : inside y := by + cases x with + | inl x => + cases y with + | inl y => exact hxy.elim + | inr f => + intro y hyf + by_contra hy + have hne : x ≠ y := by intro h; exact hy (h ▸ hx) + have hboundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet W) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hx, y, hy, (Sym2.mem_and_mem_iff hne).mp ⟨hxy.1, hyf⟩⟩ + rcases hxy.2 with hb | hg + · exact (hW.2 hboundary hb3W hb) betaMissing + · exact (hW.2 hboundary hw hg) hgw + | inr f => + cases y with + | inl y => exact hx y hxy.1 + | inr g => exact hxy.elim + have walkClosed {x y : Sum V E} (q : H.Walk x y) : inside x → inside y := by + induction q with + | nil => exact id + | cons hadj q ih => exact fun hx => ih (neighborClosed hx hadj) + exact walkClosed p.reverse hv + +private theorem helper_branch_871.{u_1, u_2} : + helperBranch871Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R U sigma n Tn + seed hseed gamma mu3 i3 hi3pos hi3le C mu4 W hW route4W A40 max40 agree40 agree0 + newPresentation Q1 Q2 Q3 c1 hc1 g1 c2 hc2 g2 c3 hc3 g3 L1 L2 L3 hdis12 hdis13 hdis23 + hmeasure Package Good pack1 pack2 pack3 good1 good2 good3 finish j1 hj1 j2 hj2 j3 hj3 hj12 + hj13 hj23 h12 h13 + by_cases h23 : j2.val < j3.val + · obtain ⟨C', heq⟩ := finish pack2 pack3 pack1 good2 good3 good1 + hdis23 (fun x hx hy => hdis12 x hy hx) (fun x hx hy => hdis13 x hy hx) + ⟨j2, j3, hj2, hj3, h23⟩ ⟨j3, j1, hj3, hj1, by omega⟩ + refine ⟨C', ?_⟩ + simp only [pack1, pack2, pack3] at heq + omega + · obtain ⟨C', heq⟩ := finish pack3 pack2 pack1 good3 good2 good1 + (fun x hx hy => hdis23 x hy hx) (fun x hx hy => hdis13 x hy hx) + (fun x hx hy => hdis12 x hy hx) + ⟨j3, j2, hj3, hj2, by omega⟩ ⟨j2, j1, hj2, hj1, by omega⟩ + refine ⟨C', ?_⟩ + simp only [pack1, pack2, pack3] at heq + omega + +private theorem helper_branch_1326.{u_1, u_2} : + helperBranch1326Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R U sigma n Tn + seed hseed gamma mu3 P1 P2 P3 i1 i2 i3 hi3pos hi3le hi3prevpos C mu4 W hW route4W A40 max40 + agree40 agree0 newPresentation Q1 Q2 Q3 c1 hc1 g1 c2 hc2 g2 c3 hc3 g3 L1 L2 L3 hdis12 + hdis13 hdis23 hmeasure Package Good pack1 pack2 pack3 good1 good2 good3 finish j1 hj1 j2 + hj2 j3 hj3 hj12 hj13 hj23 h12 + by_cases h13 : j1.val < j3.val + · obtain ⟨C', heq⟩ := finish pack2 pack1 pack3 good2 good1 good3 + (fun x hx hy => hdis12 x hy hx) hdis23 hdis13 + ⟨j2, j1, hj2, hj1, by omega⟩ ⟨j1, j3, hj1, hj3, h13⟩ + refine ⟨C', ?_⟩ + simp only [pack1, pack2, pack3] at heq + omega + · exact @helper_branch_871 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating original presentation counterexample seed hseed gamma i3 hi3pos hi3le W + hW route4W A40 max40 agree40 agree0 Q1 Q2 Q3 c1 hc1 g1 c2 hc2 g2 c3 hc3 g3 hdis12 hdis13 + hdis23 hmeasure good1 good2 good3 finish j1 hj1 j2 hj2 j3 hj3 hj12 hj13 hj23 h12 h13 +private theorem helper_segmentTrans_928.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → + TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + refine ⟨hAB.1.trans hBC.1, ?_, ?_⟩ + · intro i + calc + C.vertex (Fin.castLE _ i) = + C.vertex (Fin.castLE _ (Fin.castLE _ i)) := by congr 1 + _ = B.vertex (Fin.castLE _ i) := hBC.2.1 _ + _ = A.vertex i := hAB.2.1 _ + · intro i + calc + C.edge (Fin.castLE _ i) = + C.edge (Fin.castLE _ (Fin.castLE _ i)) := by congr 1 + _ = B.edge (Fin.castLE _ i) := hBC.2.2 _ + _ = A.edge i := hAB.2.2 _ + +private theorem helper_commonPrefix_945.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B X : TreeSequence G e0}, + TreeSequenceInitialSegment A X → + TreeSequenceInitialSegment B X → + A.length ≤ B.length → + TreeSequenceInitialSegment A B := by + classical + intro V E G e0 A B X hAX hBX hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + calc + B.vertex (Fin.castLE _ i) = + X.vertex (Fin.castLE _ (Fin.castLE _ i)) := (hBX.2.1 _).symm + _ = X.vertex (Fin.castLE _ i) := by congr 1 + _ = A.vertex i := hAX.2.1 _ + · intro i + calc + B.edge (Fin.castLE _ i) = + X.edge (Fin.castLE _ (Fin.castLE _ i)) := (hBX.2.2 _).symm + _ = X.edge (Fin.castLE _ i) := by congr 1 + _ = A.edge i := hAX.2.2 _ + +private theorem helper_terminalAgreement_962.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {i : PartialEdgeColoring E k} + {A : TreeSequence G e0} {phi : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 i A phi) {psi : PartialEdgeColoring E k} + {B : TreeSequence G e0} (corr : CorrespondingExtendedTashkinovTree G k e0 base psi B), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + base.series.data.tree (Fin.last base.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + base.series.data.kind (Fin.last base.rounds) ∧ + corr.replacementETT.series.data.connectingEdges + (Fin.last corr.replacementETT.rounds) = + base.series.data.connectingEdges (Fin.last base.rounds) := by + classical + intro V E _ _ _ G k e0 i A phi base psi B corr + rcases corr with ⟨ri, rs, re, hr, hs, _, ht, _, he, hk, _⟩ + cases re with + | mk r hp series above strict below gen => + cases hr + have hseries : series = rs := eq_of_heq hs + subst series + let q : Fin base.rounds := ⟨base.rounds - 1, by + have := base.roundsPositive + omega⟩ + have hq : q.succ = Fin.last base.rounds := by + apply Fin.ext + simp [q] + have := base.roundsPositive + omega + exact ⟨by simpa [hq] using ht q, hk _, he _⟩ + +private theorem helper_transportRoute_1070.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation) + (_ : + (∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) + (_ : TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors R.series.data n; + ∀ (gamma : Fin k), + let mu3 : PartialEdgeColoring E k := + OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ + (_ : + (IsProperEdgeColoring G mu3 ∧ + IsOneEdgeUncolored mu3 e0 ∧ + StableColoring U Dn sigma mu3 ∧ + ∀ (f : E), TreeIncidentEdge U f → mu3 f = sigma f)) + (A B : TreeSequence G e0) (_ : TashkinovAugmentationSequence sigma A B) + (_ : TreeSequenceInitialSegment B U), + TashkinovAugmentationSequence mu3 A B := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample segmentTrans R + U sigma n Dn gamma mu3 hswap3 A B hAB hBU + induction hAB with + | refl => exact Relation.ReflTransGen.refl + | @tail B C hAB hBC ih => + have hBU' := segmentTrans hBC.2.1 hBU + refine (ih hBU').tail ?_ + rcases hBC with ⟨hlen, hBC, c, hcolor, hmissing⟩ + refine ⟨hlen, hBC, c, ?_, ?_⟩ + · apply Eq.trans (hswap3.2.2.2 _ ?_) hcolor + obtain ⟨v, hv⟩ := C.attaches (Fin.cast hlen.symm (Fin.last B.length)) + refine ⟨C.vertex (Fin.cast hlen.symm (Fin.last B.length)).succ, + TreeSequenceInitialSegmentVertexSetSubset hBU (by simp [TreeSequenceVertexSet]), ?_⟩ + simp [Incident, hv] + · obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp hmissing + exact Finset.mem_biUnion.mpr ⟨v, hv, by + rw [hswap3.2.2.1.2 v (TreeSequenceInitialSegmentVertexSetSubset hBU' hv)] + exact hc⟩ + +private theorem helper_pathBoundary_1116.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + ∀ + (_ : + (∀ {phi : PartialEdgeColoring E k} {a b : Fin k} {u v : V} + (p : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl u) (Sum.inl v)) + (_ : p.IsPath) {f : E} (_ : Sum.inr f ∈ p.support), + ∃ (j : ℕ) (x : V) (y : V), + (0 : ℕ) < j ∧ + j < p.length ∧ + p.getVert j = Sum.inr f ∧ + p.getVert (j - (1 : ℕ)) = Sum.inl x ∧ + p.getVert (j + (1 : ℕ)) = Sum.inl y ∧ + Incident G x f ∧ Incident G y f ∧ x ≠ y ∧ G.ends f = s(x, y))) + {u v : V} + (p : + (TwoColorIncidenceGraph G sigma counterexample.alpha counterexample.beta).Walk + (Sum.inl u) (Sum.inl v)) + (_ : TreeExitPath U sigma counterexample.alpha counterexample.beta u v p) {f : E} + (_ : Sum.inr f ∈ p.support) (_ : TreeIncidentEdge U f), + f ∈ BoundaryEdges G (TreeSequenceVertexSet U) := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample U sigma + edgeVertices u v p hexit f hf hti + obtain ⟨j, x, y, _, _, _, hx, hy, hxf, hyf, hxy, hends⟩ := edgeVertices p hexit.1 hf + have hxP : Sum.inl x ∈ p.support := by rw [← hx]; exact p.getVert_mem_support _ + have hyP : Sum.inl y ∈ p.support := by rw [← hy]; exact p.getVert_mem_support _ + have hnBoth : ¬ (x ∈ TreeSequenceVertexSet U ∧ y ∈ TreeSequenceVertexSet U) := by + rintro ⟨hxU, hyU⟩ + exact hxy (((hexit.2.2.2.2.2 x hxU).mp hxP).trans + ((hexit.2.2.2.2.2 y hyU).mp hyP).symm) + obtain ⟨w, hw, hwf⟩ := hti + have hwxy : w = x ∨ w = y := by simpa [Incident, hends] using hwf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + rcases hwxy with hwx | hwy + · subst w + exact ⟨x, hw, y, fun hy => hnBoth ⟨hw, hy⟩, hends⟩ + · subst w + exact ⟨y, hw, x, fun hx => hnBoth ⟨hx, hw⟩, by simpa [Sym2.eq_swap] using hends⟩ + +private theorem helper_transfer4_1373.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + ∀ (gamma : Fin k), + let mu3 : PartialEdgeColoring E k := + OutsideTreeColorSwap U sigma counterexample.alpha gamma; + let _ : Set (V ⊕ E) := + TwoColorComponent G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ + (_ : + (have C : Set (V ⊕ E) := + TwoColorComponent G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G mu3 v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + gamma ∈ MissingColors G mu3 v → + counterexample.beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + counterexample.beta ∈ MissingColors G mu3 v → + gamma ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ gamma → + c ≠ counterexample.beta → + (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G mu3 v))) + (_ : + TwoColorIncidenceGraph G mu4 counterexample.beta gamma = + TwoColorIncidenceGraph G mu3 gamma counterexample.beta) + {u v : V} + (p : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl u) + (Sum.inl v)) + (_ : TreeExitPath U mu3 gamma counterexample.beta u v p), + ∃ (q : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl u) + (Sum.inl v)), + TreeExitPath U mu4 counterexample.beta gamma u v q ∧ + q.support = p.support ∧ q.length = p.length := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample U sigma gamma + mu3 K mu4 behavior4 graph4 u v p hexit + have hremote : counterexample.beta ∈ MissingColors G mu4 u ∨ + gamma ∈ MissingColors G mu4 u := by + by_cases huK : Sum.inl u ∈ K + · rcases hexit.2.2.2.2.1 with hg | hb + · exact Or.inl (behavior4.2.1 u huK hg) + · exact Or.inr (behavior4.2.2.1 u huK hb) + · rw [behavior4.1 u huK] + exact hexit.2.2.2.2.1.symm + have hedges : ∀ z, z ∈ p.edges → + z ∈ (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).edgeSet := by + intro z hz + rw [graph4] + exact p.edges_subset_edgeSet hz + let q := p.transfer (TwoColorIncidenceGraph G mu4 counterexample.beta gamma) hedges + refine ⟨q, ⟨hexit.1.transfer hedges, ?_, hexit.2.2.1, + hexit.2.2.2.1, hremote, ?_⟩, by simp [q], by simp [q]⟩ + · simpa [q] using hexit.2.1 + · intro w hw + simpa [q] using hexit.2.2.2.2.2 w hw + +private theorem helper_outside4_1441.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + ∀ (_ : counterexample.b3 ∈ TreeSequenceVertexSet U) (gamma : Fin k), + let mu3 : PartialEdgeColoring E k := + OutsideTreeColorSwap U sigma counterexample.alpha gamma; + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (W : TreeSequence G e0) + (_ : ColoredVertexSetElementary G mu4 (TreeSequenceVertexSet W)) + (Q1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a1) (Sum.inl counterexample.b1)) + (_ : + TreeExitPath U mu4 counterexample.beta gamma counterexample.a1 counterexample.b1 Q1) + (Q2 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a2) (Sum.inl counterexample.b2)) + (_ : + TreeExitPath U mu4 counterexample.beta gamma counterexample.a2 counterexample.b2 Q2) + (_ : counterexample.b1 ∈ TreeSequenceVertexSet W) + (_ : counterexample.b2 ∈ TreeSequenceVertexSet W) + (_ : + (∀ {u v : V} + (_ : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl u) + (Sum.inl v)) + (_ : v ∈ TreeSequenceVertexSet W) (_ : gamma ∈ TreeMissingColors mu4 W), + u ∈ TreeSequenceVertexSet W)) + (_ : + (∀ {a : V} (_ : a ∈ TreeSequenceVertexSet W) (_ : a ≠ counterexample.b3), + counterexample.beta ∉ MissingColors G mu4 a)) + {a : V} (_ : a ∉ TreeSequenceVertexSet U) + (_ : counterexample.beta ∈ MissingColors G mu4 a ∨ gamma ∈ MissingColors G mu4 a), + a ∉ TreeSequenceVertexSet W := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample U sigma hb3 + gamma mu3 mu4 W elementary4 Q1 hQ1 Q2 hQ2 hb1W hb2W walkContained notBeta a haU hm haW + have hab3 : a ≠ counterexample.b3 := by intro h; exact haU (h ▸ hb3) + have hga := hm.resolve_left (notBeta haW hab3) + have hgTree : gamma ∈ TreeMissingColors mu4 W := Finset.mem_biUnion.mpr ⟨a, haW, hga⟩ + have ha1W := walkContained Q1 hb1W hgTree + have ha2W := walkContained Q2 hb2W hgTree + have ha13 : counterexample.a1 ≠ counterexample.b3 := by + intro h; exact counterexample.exit1.2.2.1 (h ▸ hb3) + have ha23 : counterexample.a2 ≠ counterexample.b3 := by + intro h; exact counterexample.exit2.2.2.1 (h ▸ hb3) + have hg1 := hQ1.2.2.2.2.1.resolve_left (notBeta ha1W ha13) + have hg2 := hQ2.2.2.2.2.1.resolve_left (notBeta ha2W ha23) + exact Finset.disjoint_left.mp + (elementary4 ha1W ha2W counterexample.outsideDistinct12) hg1 hg2 + +private theorem helper_hL1strict_1522.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let _ : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + ∀ (gamma : Fin k), + let mu3 : PartialEdgeColoring E k := + OutsideTreeColorSwap U sigma counterexample.alpha gamma; + ∀ + (_ : + (∀ {phi : PartialEdgeColoring E k} {a b : Fin k} {u v : V} + (p : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl u) (Sum.inl v)) + (_ : p.IsPath) {f : E} (_ : Sum.inr f ∈ p.support), + ∃ (j : ℕ) (x : V) (y : V), + (0 : ℕ) < j ∧ + j < p.length ∧ + p.getVert j = Sum.inr f ∧ + p.getVert (j - (1 : ℕ)) = Sum.inl x ∧ + p.getVert (j + (1 : ℕ)) = Sum.inl y ∧ + Incident G x f ∧ Incident G y f ∧ x ≠ y ∧ G.ends f = s(x, y))) + (P1 : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk + (Sum.inl counterexample.a1) (Sum.inl counterexample.b1)) + (_ : P1.support = counterexample.Q1.support) + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk + (Sum.inl counterexample.a2) (Sum.inl counterexample.b2)) + (_ : + (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk + (Sum.inl counterexample.a3) (Sum.inl counterexample.b3)) + (_ _ i3 : Fin (presentation.U.length + (1 : ℕ))) (_ : (1 : ℕ) ≤ (↑i3 : ℕ)) + (_ : (↑i3 : ℕ) ≤ U.length) (_ : (1 : ℕ) ≤ (↑i3 : ℕ) - (1 : ℕ)), + let mu4 : PartialEdgeColoring E k := + TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3); + ∀ (W : TreeSequence G e0) + (Q1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a1) (Sum.inl counterexample.b1)) + (_ : Q1.support = P1.support) + (_ : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a2) (Sum.inl counterexample.b2)) + (_ : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a3) (Sum.inl counterexample.b3)) + (_ : (∀ (v : V) (_ : Incident G v counterexample.f1), v ∈ TreeSequenceVertexSet W)) + (c1 : V) (hc1 : Sum.inl c1 ∈ Q1.support) + (_ : + TreeExitPath W mu4 counterexample.beta gamma counterexample.a1 c1 + (Q1.takeUntil (Sum.inl c1) hc1)), + let L1 : + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl counterexample.a1) (Sum.inl c1) := + Q1.takeUntil (Sum.inl c1) hc1; + L1.length < Q1.length := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R U sigma n + gamma mu3 edgeVertices P1 hsP1 P2 P3 i1 i2 i3 hi3pos hi3le hi3prevpos mu4 W Q1 hsQ1 Q2 Q3 + hf1ends c1 hc1 hL1 L1 + have hf1P : Sum.inr counterexample.f1 ∈ Q1.support := by + rw [hsQ1, hsP1] + exact counterexample.edgeOnWalk1 + have hf1notL : Sum.inr counterexample.f1 ∉ L1.support := by + intro hf + obtain ⟨j, x, y, _, _, _, hx, hy, hxf, hyf, hxy, _⟩ := edgeVertices L1 hL1.1 hf + have hxW := hf1ends x hxf + have hyW := hf1ends y hyf + have hxc := (hL1.2.2.2.2.2 x hxW).mp (by rw [← hx]; exact L1.getVert_mem_support _) + have hyc := (hL1.2.2.2.2.2 y hyW).mp (by rw [← hy]; exact L1.getVert_mem_support _) + exact hxy (hxc.trans hyc.symm) + have hle : L1.length ≤ Q1.length := Q1.length_takeUntil_le_length hc1 + by_contra h + have heq : L1.length = Q1.length := by omega + have hsEq : L1.support = Q1.support := by + have hpref := Q1.support_takeUntil_prefix_support hc1 + apply hpref.eq_of_length + simpa only [SimpleGraph.Walk.length_support] using congrArg (fun n => n + 1) heq + exact hf1notL (hsEq.symm ▸ hf1P) + +private theorem helper_branch_1689.{u_1, u_2} : + helperBranch1689Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R U sigma n Tn + seed hseed gamma mu3 i3 hi3pos hi3le C mu4 W hW route4W A40 max40 agree40 agree0 + newPresentation Q1 Q2 Q3 c1 hc1 g1 c2 hc2 g2 c3 hc3 g3 L1 L2 L3 hdis12 hdis13 hdis23 + hmeasure Package Good pack1 pack2 pack3 good1 good2 good3 finish j1 hj1 j2 hj2 j3 hj3 hj13 + hj23 h12 h23 + by_cases h13 : j1.val < j3.val + · obtain ⟨C', heq⟩ := finish pack1 pack3 pack2 good1 good3 good2 + hdis13 hdis12 (fun x hx hy => hdis23 x hy hx) + ⟨j1, j3, hj1, hj3, h13⟩ ⟨j3, j2, hj3, hj2, by omega⟩ + refine ⟨C', ?_⟩ + simp only [pack1, pack2, pack3] at heq + omega + · obtain ⟨C', heq⟩ := finish pack3 pack1 pack2 good3 good1 good2 + (fun x hx hy => hdis13 x hy hx) (fun x hx hy => hdis23 x hy hx) hdis12 + ⟨j3, j1, hj3, hj1, by omega⟩ ⟨j1, j2, hj1, hj2, h12⟩ + refine ⟨C', ?_⟩ + simp only [pack1, pack2, pack3] at heq + omega + +private theorem helper_branch_1588.{u_1, u_2} : + helperBranch1588Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R U sigma n Tn + seed hseed gamma mu3 P1 P2 P3 i1 i2 i3 hi3pos hi3le hi3prevpos C mu4 W hW route4W A40 max40 + agree40 agree0 newPresentation Q1 Q2 Q3 c1 hc1 g1 c2 hc2 g2 c3 hc3 g3 L1 L2 L3 hdis12 + hdis13 hdis23 hmeasure Package Good pack1 pack2 pack3 good1 good2 good3 finish j1 hj1 j2 + hj2 j3 hj3 hj13 hj23 h12 + by_cases h23 : j2.val < j3.val + · obtain ⟨C', heq⟩ := finish pack1 pack2 pack3 good1 good2 good3 + hdis12 hdis13 hdis23 ⟨j1, j2, hj1, hj2, h12⟩ ⟨j2, j3, hj2, hj3, h23⟩ + exact ⟨C', by simpa [pack1, pack2, pack3, heq] using hmeasure⟩ + · exact @helper_branch_1689 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating original presentation counterexample seed hseed gamma i3 hi3pos hi3le W + hW route4W A40 max40 agree40 agree0 Q1 Q2 Q3 c1 hc1 g1 c2 hc2 g2 c3 hc3 g3 hdis12 hdis13 + hdis23 hmeasure good1 good2 good3 finish j1 hj1 j2 hj2 j3 hj3 hj13 hj23 h12 h23 +private theorem helper_continuation_2244.{u_1, u_2} : + helperContinuation2244Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating original presentation counterexample R U sigma n Tn + seed hseed hb1 hb2 hb3 gamma hgammaBeta mu3 edgeVertices P1 hsP1 hlP1 P2 hsP2 hlP2 P3 hsP3 + hlP3 i1 i2 i3 hi3pos hi3le hi3prevpos C mu4 W hW route4W A40 max40 agree40 agree0 + newPresentation elementary4 Q1 hQ1 hsQ1 hlQ1 Q2 hQ2 hsQ2 hlQ2 Q3 hQ3 hsQ3 hlQ3 hb1W hb2W + hb3W betaMissing betaTree fixedRetained + have hf1color : mu4 counterexample.f1 = some counterexample.beta := + fixedRetained hb1 counterexample.insideDistinct13 counterexample.incident1 + (Finset.mem_filter.mp counterexample.boundary1).2 + have hf2color : mu4 counterexample.f2 = some counterexample.beta := + fixedRetained hb2 counterexample.insideDistinct23 counterexample.incident2 + (Finset.mem_filter.mp counterexample.boundary2).2 + have retainedEnds {b : V} {f : E} (hb : b ∈ TreeSequenceVertexSet W) + (hbf : Incident G b f) (hf : mu4 f = some counterexample.beta) : + ∀ v, Incident G v f → v ∈ TreeSequenceVertexSet W := by + intro v hv + by_contra hvW + have hbv : b ≠ v := by intro h; exact hvW (h ▸ hb) + have hboundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet W) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨b, hb, v, hvW, (Sym2.mem_and_mem_iff hbv).mp ⟨hbf, hv⟩⟩ + exact (hW.2 hboundary hb3W hf) betaMissing + have hf1ends := retainedEnds hb1W counterexample.incident1 hf1color + have hf2ends := retainedEnds hb2W counterexample.incident2 hf2color + have walkContained {u v : V} + (p : (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl u) (Sum.inl v)) + (hv : v ∈ TreeSequenceVertexSet W) (hg : gamma ∈ TreeMissingColors mu4 W) : + u ∈ TreeSequenceVertexSet W := by + exact @helper_walkContained_1125 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T generating original presentation counterexample gamma i3 hi3pos hi3le W hW + hb3W betaMissing u v p hv hg + have notBeta {a : V} (ha : a ∈ TreeSequenceVertexSet W) + (hab : a ≠ counterexample.b3) : counterexample.beta ∉ MissingColors G mu4 a := by + intro hm + exact Finset.disjoint_left.mp (elementary4 ha hb3W hab) hm betaMissing + have outside4 {a : V} (haU : a ∉ TreeSequenceVertexSet U) + (hm : counterexample.beta ∈ MissingColors G mu4 a ∨ gamma ∈ MissingColors G mu4 a) : + a ∉ TreeSequenceVertexSet W := by + exact @helper_outside4_1441 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original presentation counterexample hb3 gamma W elementary4 Q1 hQ1 + Q2 hQ2 hb1W hb2W walkContained notBeta a haU hm + have ha1W := outside4 counterexample.exit1.2.2.1 hQ1.2.2.2.2.1 + have ha2W := outside4 counterexample.exit2.2.2.1 hQ2.2.2.2.2.1 + have ha3W := outside4 counterexample.exit3.2.2.1 hQ3.2.2.2.2.1 + have betaClosed : TreeColorSetClosed G mu4 W {counterexample.beta} := by + intro c hc + have heq : c = counterexample.beta := by simpa using hc + subst c + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + have hd := Finset.mem_filter.mp hf + exact (hW.2 hd.1 hb3W hd.2) betaMissing + have firstEntry {u v : V} + (p : (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl u) (Sum.inl v)) + (hp : p.IsPath) (hu : u ∉ TreeSequenceVertexSet W) (hv : v ∈ TreeSequenceVertexSet W) + (hm : counterexample.beta ∈ MissingColors G mu4 u ∨ gamma ∈ MissingColors G mu4 u) : + ∃ (c : V) (hc : Sum.inl c ∈ p.support), + TreeExitPath W mu4 counterexample.beta gamma u c (p.takeUntil (Sum.inl c) hc) ∧ + ∃ f, f ∈ BoundaryColorEdges G mu4 (TreeSequenceVertexSet W) gamma ∧ + Incident G c f ∧ Sum.inr f ∈ (p.takeUntil (Sum.inl c) hc).support := by + exact @helper_firstEntry_790 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original presentation counterexample gamma P1 P2 P3 i1 i2 i3 hi3pos + hi3le hi3prevpos W Q1 Q2 Q3 betaClosed u v p hp hu hv hm + obtain ⟨c1, hc1, hL1, g1, hg1, hiG1, hsG1⟩ := + firstEntry Q1 hQ1.1 ha1W hb1W hQ1.2.2.2.2.1 + obtain ⟨c2, hc2, hL2, g2, hg2, hiG2, hsG2⟩ := + firstEntry Q2 hQ2.1 ha2W hb2W hQ2.2.2.2.2.1 + obtain ⟨c3, hc3, hL3, g3, hg3, hiG3, hsG3⟩ := + firstEntry Q3 hQ3.1 ha3W hb3W hQ3.2.2.2.2.1 + let L1 := Q1.takeUntil (Sum.inl c1) hc1 + let L2 := Q2.takeUntil (Sum.inl c2) hc2 + let L3 := Q3.takeUntil (Sum.inl c3) hc3 + have hdis12 : ∀ x, x ∈ L1.support → x ∉ L2.support := by + intro x hx1 hx2 + apply counterexample.supportDisjoint12 x + · rw [← hsP1, ← hsQ1] + exact Q1.support_takeUntil_subset_support hc1 hx1 + · rw [← hsP2, ← hsQ2] + exact Q2.support_takeUntil_subset_support hc2 hx2 + have hdis13 : ∀ x, x ∈ L1.support → x ∉ L3.support := by + intro x hx1 hx3 + apply counterexample.supportDisjoint13 x + · rw [← hsP1, ← hsQ1] + exact Q1.support_takeUntil_subset_support hc1 hx1 + · rw [← hsP3, ← hsQ3] + exact Q3.support_takeUntil_subset_support hc3 hx3 + have hdis23 : ∀ x, x ∈ L2.support → x ∉ L3.support := by + intro x hx2 hx3 + apply counterexample.supportDisjoint23 x + · rw [← hsP2, ← hsQ2] + exact Q2.support_takeUntil_subset_support hc2 hx2 + · rw [← hsP3, ← hsQ3] + exact Q3.support_takeUntil_subset_support hc3 hx3 + have hc12 : c1 ≠ c2 := by + intro h + exact hdis12 _ L1.end_mem_support (h ▸ L2.end_mem_support) + have hc13 : c1 ≠ c3 := by + intro h + exact hdis13 _ L1.end_mem_support (h ▸ L3.end_mem_support) + have hc23 : c2 ≠ c3 := by + intro h + exact hdis23 _ L2.end_mem_support (h ▸ L3.end_mem_support) + have gammaNotTree : gamma ∉ TreeMissingColors mu4 W := by + intro hg + obtain ⟨v, hv, hgv⟩ := Finset.mem_biUnion.mp hg + have hd := Finset.mem_filter.mp hg1 + exact (hW.2 hd.1 hv hd.2) hgv + have hL1strict : L1.length < Q1.length := by + exact @helper_hL1strict_1522 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original presentation counterexample gamma edgeVertices P1 hsP1 P2 + P3 i1 i2 i3 hi3pos hi3le hi3prevpos W Q1 hsQ1 Q2 Q3 hf1ends c1 hc1 hL1 + have hmeasure : L1.length + L2.length + L3.length < + RutgersCounterexampleMeasure counterexample := by + have hle2 : L2.length ≤ Q2.length := Q2.length_takeUntil_le_length hc2 + have hle3 : L3.length ≤ Q3.length := Q3.length_takeUntil_le_length hc3 + unfold RutgersCounterexampleMeasure + rw [← hlP1, ← hlP2, ← hlP3, ← hlQ1, ← hlQ2, ← hlQ3] + omega + let Package := Σ a : V, Σ b : V, + (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk (Sum.inl a) (Sum.inl b) × E + let Good : Package → Prop := fun p => + TreeExitPath W mu4 counterexample.beta gamma p.1 p.2.1 p.2.2.1 ∧ + p.2.2.2 ∈ BoundaryColorEdges G mu4 (TreeSequenceVertexSet W) gamma ∧ + Incident G p.2.1 p.2.2.2 ∧ Sum.inr p.2.2.2 ∈ p.2.2.1.support + let pack1 : Package := ⟨counterexample.a1, c1, L1, g1⟩ + let pack2 : Package := ⟨counterexample.a2, c2, L2, g2⟩ + let pack3 : Package := ⟨counterexample.a3, c3, L3, g3⟩ + have good1 : Good pack1 := ⟨hL1, hg1, hiG1, hsG1⟩ + have good2 : Good pack2 := ⟨hL2, hg2, hiG2, hsG2⟩ + have good3 : Good pack3 := ⟨hL3, hg3, hiG3, hsG3⟩ + have finish (p q r : Package) (hp : Good p) (hq : Good q) (hr : Good r) + (hdpq : ∀ x, x ∈ p.2.2.1.support → x ∉ q.2.2.1.support) + (hdpr : ∀ x, x ∈ p.2.2.1.support → x ∉ r.2.2.1.support) + (hdqr : ∀ x, x ∈ q.2.2.1.support → x ∉ r.2.2.1.support) + (hopq : TreeVertexOrder W p.2.1 q.2.1) + (hoqr : TreeVertexOrder W q.2.1 r.2.1) : + ∃ C' : RutgersCounterexample G k e0 original newPresentation, + RutgersCounterexampleMeasure C' = + p.2.2.1.length + q.2.2.1.length + r.2.2.1.length := by + exact @helper_finish_912 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating original presentation counterexample seed hseed gamma hgammaBeta i3 + hi3pos hi3le W hW route4W A40 max40 agree40 agree0 Q1 Q2 Q3 betaTree gammaNotTree p q r + hp hq hr hdpq hdpr hdqr hopq hoqr + obtain ⟨j1, hj1⟩ : ∃ j, W.vertex j = c1 := by + simpa [TreeSequenceVertexSet] using hL1.2.2.2.1 + obtain ⟨j2, hj2⟩ : ∃ j, W.vertex j = c2 := by + simpa [TreeSequenceVertexSet] using hL2.2.2.2.1 + obtain ⟨j3, hj3⟩ : ∃ j, W.vertex j = c3 := by + simpa [TreeSequenceVertexSet] using hL3.2.2.2.1 + have hj12 : j1.val ≠ j2.val := by + intro h + exact hc12 (hj1.symm.trans ((congrArg W.vertex (Fin.ext h)).trans hj2)) + have hj13 : j1.val ≠ j3.val := by + intro h + exact hc13 (hj1.symm.trans ((congrArg W.vertex (Fin.ext h)).trans hj3)) + have hj23 : j2.val ≠ j3.val := by + intro h + exact hc23 (hj2.symm.trans ((congrArg W.vertex (Fin.ext h)).trans hj3)) + refine ⟨newPresentation, ?_⟩ + by_cases h12 : j1.val < j2.val + · exact @helper_branch_1588 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating original presentation counterexample seed hseed gamma P1 P2 P3 i1 i2 i3 + hi3pos hi3le hi3prevpos W hW route4W A40 max40 agree40 agree0 Q1 Q2 Q3 c1 hc1 g1 c2 hc2 g2 + c3 hc3 g3 hdis12 hdis13 hdis23 hmeasure good1 good2 good3 finish j1 hj1 j2 hj2 j3 hj3 hj13 + hj23 h12 + · exact @helper_branch_1326 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating original presentation counterexample seed hseed gamma P1 P2 P3 i1 i2 i3 + hi3pos hi3le hi3prevpos W hW route4W A40 max40 agree40 agree0 Q1 Q2 Q3 c1 hc1 g1 c2 hc2 g2 + c3 hc3 g3 hdis12 hdis13 hdis23 hmeasure good1 good2 good3 finish j1 hj1 j2 hj2 j3 hj3 hj12 + hj13 hj23 h12 + +private theorem helper_continuation_2163.{u_1, u_2} : + helperContinuation2163Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating original hcurrentOne presentation counterexample + segmentTrans terminalAgreement R U sigma n Tn Dn seed hseed hb1 hb2 hb3 gamma hgammaBeta + mu3 hswap3 route3 A3 max3 edgeVertices P1 hP1 hsP1 hlP1 P2 hP2 hsP2 hlP2 P3 hP3 hsP3 hlP3 + i1 i2 i3 hi23 hTni2 hi3pos hi3le hi3prevpos B C hClen hCU hBC hpenultimate hTnB hseedC hb3C + hb1C hb2C K mu4 hgamma3 hKU fixedOutsideVertex behavior4 missingB agree3 M4 fixedC + have route3C : TashkinovAugmentationSequence mu3 seed C := + TashkinovAugmentationSequenceRestrict mu3 seed C U route3 hseedC hCU + have route4C : TashkinovAugmentationSequence mu4 seed C := + TashkinovAugmentationSequenceColoringTransport mu3 mu4 seed B C route3C + hBC hpenultimate (fun j _ => fixedC j) missingB + obtain ⟨W, hW⟩ := TashkinovClosureExists mu4 C + have hCW := TashkinovAugmentationSequenceInitialSegment mu4 C W hW.1 + have hTnW := segmentTrans (segmentTrans hTnB hBC) hCW + have hstrictW : Tn.length < W.length := by have := hCW.1; omega + have route4W : TashkinovAugmentationSequence mu4 seed W := route4C.trans hW.1 + obtain ⟨A4⟩ : Nonempty (CorrespondingExtendedTashkinovTree + G k e0 A3.replacementETT mu4 W) := by + apply M4.2.2 W (by rwa [agree3.1]) (by simpa [agree3.1] using hstrictW) + rcases hseed with hPE | hSER + · refine Or.inl ⟨by simpa [agree3.2.1] using hPE.1, ?_⟩ + rw [agree3.1] + change TashkinovAugmentationSequence mu4 Tn W + rwa [← hPE.2] + · obtain ⟨f, he, ha⟩ := hSER.2 + exact Or.inr ⟨by simpa [agree3.2.1] using hSER.1, f, seed, + by simpa [agree3.2.2] using he, by simpa [agree3.1] using ha, route4W⟩ + have max4 : MaximumProperty A4.replacementETT := + MaximumPropertyTransport G k e0 A3.replacementETT mu4 M4 W A4 max3 + obtain ⟨A4R, h4input, _, h4ETT⟩ := CorrespondingExtendedTashkinovTreeTransTrees + G k e0 presentation.corresponding.replacementInput U U W sigma mu3 mu4 R A3 A4 + obtain ⟨A40, h40input, _, h40ETT⟩ := CorrespondingExtendedTashkinovTreeTransTrees + G k e0 input T U W generating sigma mu4 original presentation.corresponding A4R + have maximumHEq {i j : PartialEdgeColoring E k} {A : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + {F : ExtendedTashkinovTree G k e0 i A phi} + {F' : ExtendedTashkinovTree G k e0 j A phi} + (hij : i = j) (hFF' : HEq F F') (hm : MaximumProperty F') : MaximumProperty F := by + subst j + rw [eq_of_heq hFF'] + exact hm + have max40 : MaximumProperty A40.replacementETT := + maximumHEq h40input h40ETT (maximumHEq h4input h4ETT max4) + have agree40 := terminalAgreement original A40 + have agree0 := terminalAgreement original presentation.corresponding + let newPresentation : RutgersClosedPresentation G k e0 original := { + sigma := mu4 + U := W + corresponding := A40 + maximum := max40 + terminalRoute := by + dsimp only + have htree : A40.replacementETT.series.data.tree + (Fin.last A40.replacementETT.rounds).castSucc = Tn := + agree40.1.trans agree0.1.symm + have hkind : A40.replacementETT.series.data.kind + (Fin.last A40.replacementETT.rounds) = R.series.data.kind n := + agree40.2.1.trans agree0.2.1.symm + have hedges : A40.replacementETT.series.data.connectingEdges + (Fin.last A40.replacementETT.rounds) = R.series.data.connectingEdges n := + agree40.2.2.trans agree0.2.2.symm + rcases hseed with hPE | hSER + · exact Or.inl ⟨hkind.trans hPE.1, by + rw [htree, ← hPE.2] + exact ⟨route4W, hW.2⟩⟩ + · obtain ⟨f, he, ha⟩ := hSER.2 + exact Or.inr ⟨by simpa [hkind] using hSER.1, f, seed, + hedges.trans he, by simpa [htree] using ha, route4W, hW.2⟩ } + have elementary4 : ColoredVertexSetElementary G mu4 (TreeSequenceVertexSet W) := + hcurrentOne A40.replacementETT A40.rungAgreement max40 + have colorPair4 (f : E) : + (mu4 f = some counterexample.beta ∨ mu4 f = some gamma) ↔ + (mu3 f = some gamma ∨ mu3 f = some counterexample.beta) := by + by_cases hK : Sum.inr f ∈ K + · by_cases hg : mu3 f = some gamma + · simp [mu4, TwoColorComponentSwap, K, hK, hg] + · by_cases hb : mu3 f = some counterexample.beta + · simp [mu4, TwoColorComponentSwap, K, hK, hb] + · simp [mu4, TwoColorComponentSwap, K, hK, hg, hb] + · simp [mu4, TwoColorComponentSwap, K, hK, or_comm] + have graph4 : TwoColorIncidenceGraph G mu4 counterexample.beta gamma = + TwoColorIncidenceGraph G mu3 gamma counterexample.beta := by + ext x y + cases x <;> cases y <;> simp only [TwoColorIncidenceGraph] + all_goals first | rw [colorPair4] + have transfer4 {u v : V} + (p : (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk (Sum.inl u) (Sum.inl v)) + (hexit : TreeExitPath U mu3 gamma counterexample.beta u v p) : + ∃ q : (TwoColorIncidenceGraph G mu4 counterexample.beta gamma).Walk + (Sum.inl u) (Sum.inl v), + TreeExitPath U mu4 counterexample.beta gamma u v q ∧ + q.support = p.support ∧ q.length = p.length := by + exact @helper_transfer4_1373 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original presentation counterexample gamma behavior4 graph4 u v p + hexit + obtain ⟨Q1, hQ1, hsQ1, hlQ1⟩ := transfer4 P1 hP1 + obtain ⟨Q2, hQ2, hsQ2, hlQ2⟩ := transfer4 P2 hP2 + obtain ⟨Q3, hQ3, hsQ3, hlQ3⟩ := transfer4 P3 hP3 + have hb1W := TreeSequenceInitialSegmentVertexSetSubset hCW hb1C + have hb2W := TreeSequenceInitialSegmentVertexSetSubset hCW hb2C + have hb3W := TreeSequenceInitialSegmentVertexSetSubset hCW hb3C + have betaMissing : counterexample.beta ∈ MissingColors G mu4 counterexample.b3 := + behavior4.2.1 counterexample.b3 (by rfl) hgamma3 + have betaTree : counterexample.beta ∈ TreeMissingColors mu4 W := + Finset.mem_biUnion.mpr ⟨counterexample.b3, hb3W, betaMissing⟩ + have fixedRetained {b : V} {f : E} (hb : b ∈ TreeSequenceVertexSet U) + (hb3 : b ≠ counterexample.b3) (hbf : Incident G b f) + (hcolor : sigma f = some counterexample.beta) : mu4 f = some counterexample.beta := by + have hbK : Sum.inl b ∉ K := fun h => hb3 ((hKU b hb).mp h) + exact (fixedOutsideVertex hbK hbf).trans ((hswap3.2.2.2 f ⟨b, hb, hbf⟩).trans hcolor) + exact @helper_continuation_2244 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original presentation counterexample seed hseed hb1 hb2 hb3 gamma + hgammaBeta edgeVertices P1 hsP1 hlP1 P2 hsP2 hlP2 P3 hsP3 hlP3 i1 i2 i3 hi3pos hi3le + hi3prevpos W hW route4W A40 max40 agree40 agree0 elementary4 Q1 hQ1 hsQ1 hlQ1 Q2 hQ2 hsQ2 + hlQ2 Q3 hQ3 hsQ3 hlQ3 hb1W hb2W hb3W betaMissing betaTree fixedRetained +private theorem helper_continuation_2093.{u_1, u_2} : + helperContinuation2093Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating original hcurrentOne hcurrentSix presentation + counterexample segmentTrans terminalAgreement R U sigma n Tn Dn seed hseed hb1 hb2 hb3 + gamma hgamma hgammaBeta mu3 hswap3 route3 A3 max3 edgeVertices P1 hP1 hsP1 hlP1 P2 hP2 hsP2 + hlP2 P3 hP3 hsP3 hlP3 i1 i2 hi1 hi2 hi12 i3 hi3 hi23 hTni2 hi3pos hi3le hi3prevpos B C + hClen hBU hCU hBC hpenultimate hTnB hseedB + have hseedC := segmentTrans hseedB hBC + have hb3C : counterexample.b3 ∈ TreeSequenceVertexSet C := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨Fin.last C.length, ?_⟩ + apply (hCU.2.1 _).symm.trans + calc + U.vertex (Fin.castLE _ (Fin.last C.length)) = U.vertex i3 := by + congr 1 + _ = counterexample.b3 := hi3 + have hb1C : counterexample.b1 ∈ TreeSequenceVertexSet C := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨⟨i1.val, by omega⟩, ?_⟩ + exact (hCU.2.1 _).symm.trans hi1 + have hb2C : counterexample.b2 ∈ TreeSequenceVertexSet C := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨⟨i2.val, by omega⟩, ?_⟩ + exact (hCU.2.1 _).symm.trans hi2 + have hb3notB : counterexample.b3 ∉ TreeSequenceVertexSet B := by + intro h + obtain ⟨j, hj⟩ : ∃ j, B.vertex j = counterexample.b3 := by + simpa [TreeSequenceVertexSet] using h + have heq := U.vertex_injective ((hBU.2.1 j).trans (hj.trans hi3.symm)) + have hval := congrArg Fin.val heq + have := j.isLt + simp only [Fin.val_castLE] at hval + omega + let K := TwoColorComponent G mu3 gamma counterexample.beta (Sum.inl counterexample.b3) + let mu4 := TwoColorComponentSwap G mu3 gamma counterexample.beta (Sum.inl counterexample.b3) + have hgamma3 : gamma ∈ MissingColors G mu3 counterexample.b3 := by + rw [hswap3.2.2.1.2 _ hb3] + exact hgamma + have hKU : ∀ w, w ∈ TreeSequenceVertexSet U → + (Sum.inl w ∈ K ↔ w = counterexample.b3) := + TreeExitComponentMeetsTreeOnlyAtExit U mu3 gamma counterexample.beta + counterexample.b3 hswap3.1 hgamma3 ⟨counterexample.a3, P3, hP3⟩ + have hKB : ∀ w, w ∈ TreeSequenceVertexSet B → Sum.inl w ∉ K := by + intro w hw hK + have hw3 := (hKU w (TreeSequenceInitialSegmentVertexSetSubset hBU hw)).mp hK + exact hb3notB (hw3 ▸ hw) + have fixedOutsideVertex {v : V} (hv : Sum.inl v ∉ K) {f : E} + (hf : Incident G v f) : mu4 f = mu3 f := by + by_cases hK : Sum.inr f ∈ K + · have hnot : ¬ (mu3 f = some gamma ∨ mu3 f = some counterexample.beta) := by + intro hcolor + have hadj : (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Adj + (Sum.inl v) (Sum.inr f) := ⟨hf, hcolor⟩ + apply hv + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hK + simp only [not_or] at hnot + simp [mu4, TwoColorComponentSwap, K, hK, hnot.1, hnot.2] + · simp [mu4, TwoColorComponentSwap, K, hK] + have fixedB : ∀ f, TreeIncidentEdge B f → mu4 f = mu3 f := by + rintro f ⟨v, hv, hf⟩ + exact fixedOutsideVertex (hKB v hv) hf + have behavior4 := TwoColorComponentSwapMissingBehavior G mu3 gamma + counterexample.beta hgammaBeta hswap3.1 (Sum.inl counterexample.b3) + have missingB : ∀ v, v ∈ TreeSequenceVertexSet B → + MissingColors G mu4 v = MissingColors G mu3 v := by + intro v hv + exact behavior4.1 v (hKB v hv) + have proper4 : IsProperEdgeColoring G mu4 := + TwoColorComponentSwapProper G mu3 gamma counterexample.beta hgammaBeta hswap3.1 _ + have one4 : IsOneEdgeUncolored mu4 e0 := by + constructor + · simp [mu4, TwoColorComponentSwap, hswap3.2.1.1] + · intro f hf + obtain ⟨c, hc⟩ := hswap3.2.1.2 f hf + by_cases hK : Sum.inr f ∈ K + · by_cases hcg : c = gamma + · exact ⟨counterexample.beta, by simp [mu4, TwoColorComponentSwap, K, hK, hc, hcg]⟩ + · by_cases hcb : c = counterexample.beta + · exact ⟨gamma, by simp [mu4, TwoColorComponentSwap, K, hK, hc, hcb, hgammaBeta.symm]⟩ + · exact ⟨c, by simp [mu4, TwoColorComponentSwap, K, hK, hc, hcg, hcb]⟩ + · exact ⟨c, by simp [mu4, TwoColorComponentSwap, K, hK, hc]⟩ + have agree3 := terminalAgreement R A3 + have stable4 : StableColoring + (A3.replacementETT.series.data.tree (Fin.last A3.replacementETT.rounds).castSucc) + (TashkinovStoredColors A3.replacementETT.series.data (Fin.last A3.replacementETT.rounds)) + (A3.replacementETT.series.data.coloring (Fin.last A3.replacementETT.rounds)) mu4 := by + rw [agree3.1, ← A3.replacementETT.generatingColoring] + refine ⟨?_, ?_⟩ + · rintro f ⟨v, hv, hf⟩ _ + exact fixedB f ⟨v, TreeSequenceInitialSegmentVertexSetSubset hTnB hv, hf⟩ + · intro v hv + exact missingB v (TreeSequenceInitialSegmentVertexSetSubset hTnB hv) + have M4 : ModColoring A3.replacementETT mu4 := + hcurrentSix A3.replacementETT + (A3.rungAgreement.trans presentation.corresponding.rungAgreement) max3 + mu4 proper4 one4 stable4 + have fixedC : ∀ j : Fin C.length, mu4 (C.edge j) = mu3 (C.edge j) := by + intro j + obtain ⟨i, hi⟩ := C.attaches j + have hiB : i.val < B.length + 1 := by have := i.isLt; have := j.isLt; omega + let q : Fin (B.length + 1) := ⟨i.val, hiB⟩ + have hiEq : C.vertex (Fin.castLT i (by omega)) = B.vertex q := by + exact hBC.2.1 q + apply fixedB + refine ⟨B.vertex q, by simp [TreeSequenceVertexSet], ?_⟩ + rw [Incident, hi, hiEq] + simp + exact @helper_continuation_2163 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original hcurrentOne presentation counterexample segmentTrans + terminalAgreement seed hseed hb1 hb2 hb3 gamma hgammaBeta hswap3 route3 A3 max3 + edgeVertices P1 hP1 hsP1 hlP1 P2 hP2 hsP2 hlP2 P3 hP3 hsP3 hlP3 i1 i2 i3 hi23 hTni2 hi3pos + hi3le hi3prevpos hClen hCU hBC hpenultimate hTnB hseedC hb3C hb1C hb2C hgamma3 hKU + fixedOutsideVertex behavior4 missingB agree3 M4 fixedC +private theorem helper_continuation_2062.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (_ : current.rounds = original.rounds) (_ : MaximumProperty current), + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T'))) + (_ : + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (_ : current.rounds = original.rounds) (_ : MaximumProperty current), + let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := current.series.data.tree terminal.castSucc; + ∀ (sigma : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) + (_ : IsOneEdgeUncolored sigma e0) + (_ : + StableColoring Tterminal (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma), + ModColoring current sigma)) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation) + (_ : + (∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) + (_ : TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) + (_ : + (∀ {A B X : TreeSequence G e0} (_ : TreeSequenceInitialSegment A X) + (_ : TreeSequenceInitialSegment B X) (_ : A.length ≤ B.length), + TreeSequenceInitialSegment A B)) + (_ : + (∀ {i : PartialEdgeColoring E k} {A : TreeSequence G e0} + {phi : PartialEdgeColoring E k} (base : ExtendedTashkinovTree G k e0 i A phi) + {psi : PartialEdgeColoring E k} {B : TreeSequence G e0} + (corr : CorrespondingExtendedTashkinovTree G k e0 base psi B), + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + base.series.data.tree (Fin.last base.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + base.series.data.kind (Fin.last base.rounds) ∧ + corr.replacementETT.series.data.connectingEdges + (Fin.last corr.replacementETT.rounds) = + base.series.data.connectingEdges (Fin.last base.rounds))), + let R : + ExtendedTashkinovTree G k e0 presentation.corresponding.replacementInput + presentation.U presentation.sigma := + presentation.corresponding.replacementETT; + let U : TreeSequence G e0 := presentation.U; + let sigma : PartialEdgeColoring E k := presentation.sigma; + let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; + let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.series.data n; + ∀ (seed : TreeSequence G e0) + (_ : + (R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn ∨ + (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), + R.series.data.connectingEdges n = { f } ∧ TreeSequenceAdjoinEdge Tn f seed)) + (_ : TashkinovClosure sigma seed U) (_ : TreeSequenceInitialSegment seed U) + (_ : TreeSequenceInitialSegment Tn U) + (_ : counterexample.b1 ∈ TreeSequenceVertexSet U) + (_ : counterexample.b2 ∈ TreeSequenceVertexSet U) + (_ : counterexample.b3 ∈ TreeSequenceVertexSet U) + (_ : counterexample.b2 ∉ TreeSequenceVertexSet Tn) (_ : Tn.length < U.length), + ∀ gamma ∈ MissingColors G sigma counterexample.b3, + gamma ≠ counterexample.beta → + let mu3 : PartialEdgeColoring E k := + OutsideTreeColorSwap U sigma counterexample.alpha gamma; + (IsProperEdgeColoring G mu3 ∧ + IsOneEdgeUncolored mu3 e0 ∧ + StableColoring U Dn sigma mu3 ∧ + ∀ (f : E), TreeIncidentEdge U f → mu3 f = sigma f) → + StableColoring Tn Dn (R.series.data.coloring n) mu3 → + ∃ (newPresentation : RutgersClosedPresentation G k e0 original) (newCounterexample : + RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure newCounterexample < + RutgersCounterexampleMeasure counterexample := by + classical + intro V E _ _ _ _ G k e0 input T generating original hcurrentOne hcurrentSix presentation + counterexample segmentTrans commonPrefix terminalAgreement R U sigma n Tn Dn seed hseed + hclosure hseedU hTnU hb1 hb2 hb3 hmiddle' hstrict gamma hgamma hgammaBeta mu3 hswap3 hstable3 + have M3 : ModColoring R mu3 := + hcurrentSix R presentation.corresponding.rungAgreement presentation.maximum + mu3 hswap3.1 hswap3.2.1 hstable3 + have transportRoute (A B : TreeSequence G e0) + (hAB : TashkinovAugmentationSequence sigma A B) + (hBU : TreeSequenceInitialSegment B U) : + TashkinovAugmentationSequence mu3 A B := by + exact @helper_transportRoute_1070 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T generating original presentation counterexample segmentTrans gamma hswap3 + A B hAB hBU + have route3 : TashkinovAugmentationSequence mu3 seed U := + transportRoute seed U hclosure.1 ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have closed3 : ColoredVertexSetClosed G mu3 (TreeSequenceVertexSet U) := by + intro f c v hf hv hfc hc + obtain ⟨x, hx, y, hy, hends⟩ := by simpa [BoundaryEdges] using hf + have hfi : TreeIncidentEdge U f := ⟨x, hx, by simp [Incident, hends]⟩ + exact (hclosure.2 hf hv ((hswap3.2.2.2 f hfi).symm.trans hfc)) + (by rwa [hswap3.2.2.1.2 v hv] at hc) + obtain ⟨A3⟩ : Nonempty (CorrespondingExtendedTashkinovTree G k e0 R mu3 U) := by + apply M3.2.2 U hTnU hstrict + rcases hseed with hPE | hSER + · exact Or.inl ⟨hPE.1, by simpa [hPE.2] using route3⟩ + · obtain ⟨f, he, ha⟩ := hSER.2 + exact Or.inr ⟨hSER.1, f, seed, he, ha, route3⟩ + have max3 : MaximumProperty A3.replacementETT := + MaximumPropertyTransport G k e0 R mu3 M3 U A3 presentation.maximum + obtain ⟨A30, _, _, hA30⟩ := CorrespondingExtendedTashkinovTreeTransTrees + G k e0 input T U U generating sigma mu3 original presentation.corresponding A3 + have edgeVertices {phi : PartialEdgeColoring E k} {a b : Fin k} + {u v : V} (p : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl u) (Sum.inl v)) + (hp : p.IsPath) {f : E} (hf : Sum.inr f ∈ p.support) : + ∃ (j : Nat) (x y : V), 0 < j ∧ j < p.length ∧ + p.getVert j = Sum.inr f ∧ p.getVert (j - 1) = Sum.inl x ∧ + p.getVert (j + 1) = Sum.inl y ∧ Incident G x f ∧ Incident G y f ∧ + x ≠ y ∧ G.ends f = s(x, y) := by + exact @helper_edgeVertices_296 V E inferInstance inferInstance inferInstance G k e0 input T + generating original presentation phi a b u v p hp f hf + have pathBoundary {u v : V} + (p : (TwoColorIncidenceGraph G sigma counterexample.alpha counterexample.beta).Walk + (Sum.inl u) (Sum.inl v)) + (hexit : TreeExitPath U sigma counterexample.alpha counterexample.beta u v p) + {f : E} (hf : Sum.inr f ∈ p.support) (hti : TreeIncidentEdge U f) : + f ∈ BoundaryEdges G (TreeSequenceVertexSet U) := by + exact @helper_pathBoundary_1116 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T generating original presentation counterexample edgeVertices u v p hexit f + hf hti + have outsideBoundary {u : V} {f : E} (hu : u ∉ TreeSequenceVertexSet U) + (huf : Incident G u f) (hti : TreeIncidentEdge U f) : + f ∈ BoundaryEdges G (TreeSequenceVertexSet U) := by + obtain ⟨x, hx, hxf⟩ := hti + have hxu : x ≠ u := by intro h; exact hu (h ▸ hx) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hx, u, hu, (Sym2.mem_and_mem_iff hxu).mp ⟨hxf, huf⟩⟩ + have remote3 {u : V} (hu : u ∉ TreeSequenceVertexSet U) + (hm : counterexample.alpha ∈ MissingColors G sigma u ∨ + counterexample.beta ∈ MissingColors G sigma u) : + gamma ∈ MissingColors G mu3 u ∨ counterexample.beta ∈ MissingColors G mu3 u := by + exact @helper_remote3_362 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating original presentation counterexample seed hclosure hb3 gamma hgamma + hgammaBeta hswap3 A3 A30 (by assumption) (by assumption) outsideBoundary u hu hm + have transfer3 {u v : V} + (p : (TwoColorIncidenceGraph G sigma counterexample.alpha counterexample.beta).Walk + (Sum.inl u) (Sum.inl v)) + (hexit : TreeExitPath U sigma counterexample.alpha counterexample.beta u v p) : + ∃ q : (TwoColorIncidenceGraph G mu3 gamma counterexample.beta).Walk + (Sum.inl u) (Sum.inl v), + TreeExitPath U mu3 gamma counterexample.beta u v q ∧ + q.support = p.support ∧ q.length = p.length := by + exact @helper_transfer3_406 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original presentation counterexample seed hclosure gamma hgammaBeta + hswap3 pathBoundary remote3 u v p hexit + obtain ⟨P1, hP1, hsP1, hlP1⟩ := transfer3 counterexample.Q1 counterexample.exit1 + obtain ⟨P2, hP2, hsP2, hlP2⟩ := transfer3 counterexample.Q2 counterexample.exit2 + obtain ⟨P3, hP3, hsP3, hlP3⟩ := transfer3 counterexample.Q3 counterexample.exit3 + obtain ⟨i1, i2, hi1, hi2, hi12⟩ := counterexample.insideOrder12 + obtain ⟨i2', i3, hi2', hi3, hi23⟩ := counterexample.insideOrder23 + have hi2eq : i2' = i2 := U.vertex_injective (hi2'.trans hi2.symm) + subst i2' + have hTni2 : Tn.length < i2.val := by + by_contra h + have hilt : i2.val < Tn.length + 1 := by omega + apply hmiddle' + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨⟨i2.val, hilt⟩, ?_⟩ + exact (hTnU.2.1 ⟨i2.val, hilt⟩).symm.trans hi2 + have hi3pos : 1 ≤ i3.val := by omega + have hi3le : i3.val ≤ U.length := Nat.lt_succ_iff.mp i3.isLt + have hi3prevpos : 1 ≤ i3.val - 1 := by have := Tn.positive; omega + let B := TreeSequencePrefix U (i3.val - 1) hi3prevpos (by omega) + let C := TreeSequencePrefix U i3.val hi3pos hi3le + have hBlen : B.length = i3.val - 1 := rfl + have hClen : C.length = i3.val := rfl + have hBU : TreeSequenceInitialSegment B U := + ⟨by dsimp [B, TreeSequencePrefix]; omega, fun _ => rfl, fun _ => rfl⟩ + have hCU : TreeSequenceInitialSegment C U := + ⟨hi3le, fun _ => rfl, fun _ => rfl⟩ + have hBC : TreeSequenceInitialSegment B C := commonPrefix hBU hCU (by omega) + have hpenultimate : C.length = B.length + 1 := by omega + have hTnB : TreeSequenceInitialSegment Tn B := commonPrefix hTnU hBU (by omega) + have hseedB : TreeSequenceInitialSegment seed B := by + apply commonPrefix hseedU hBU + rcases hseed with hPE | hSER + · rw [hPE.2] + omega + · obtain ⟨f, _, ha⟩ := hSER.2 + have := ha.1 + omega + exact @helper_continuation_2093 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original hcurrentOne hcurrentSix presentation counterexample + segmentTrans terminalAgreement seed hseed hb1 hb2 hb3 gamma hgamma hgammaBeta hswap3 route3 + A3 max3 edgeVertices P1 hP1 hsP1 hlP1 P2 hP2 hsP2 hlP2 P3 hP3 hsP3 hlP3 i1 i2 hi1 hi2 hi12 + i3 hi3 hi23 hTni2 hi3pos hi3le hi3prevpos hClen hBU hCU hBC hpenultimate hTnB hseedB +theorem RutgersStrictShortening + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (hdegree : MaximumDegree G + 1 <= k) + (hcurrentOne : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = original.rounds -> MaximumProperty current -> + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hcurrentSix : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = original.rounds -> MaximumProperty current -> + let terminal : Fin (current.rounds + 1) := Fin.last current.rounds + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma -> + ModColoring current sigma) + (presentation : RutgersClosedPresentation G k e0 original) + (counterexample : RutgersCounterexample G k e0 original presentation) + (hmiddle : + let replacement := presentation.corresponding.replacementETT + let terminal : Fin (replacement.rounds + 1) := + Fin.last replacement.rounds + counterexample.b2 ∉ TreeSequenceVertexSet + (replacement.series.data.tree terminal.castSucc)) : + exists (newPresentation : RutgersClosedPresentation G k e0 original) (newCounterexample + : RutgersCounterexample G k e0 original newPresentation), + RutgersCounterexampleMeasure newCounterexample < + RutgersCounterexampleMeasure counterexample := by + classical + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + exact @helper_segmentTrans_928 V E G e0 A B C hAB hBC + have commonPrefix {A B X : TreeSequence G e0} + (hAX : TreeSequenceInitialSegment A X) + (hBX : TreeSequenceInitialSegment B X) (hlen : A.length ≤ B.length) : + TreeSequenceInitialSegment A B := by + exact @helper_commonPrefix_945 V E G e0 A B X hAX hBX hlen + have terminalAgreement {i : PartialEdgeColoring E k} + {A : TreeSequence G e0} {phi : PartialEdgeColoring E k} + (base : ExtendedTashkinovTree G k e0 i A phi) + {psi : PartialEdgeColoring E k} {B : TreeSequence G e0} + (corr : CorrespondingExtendedTashkinovTree G k e0 base psi B) : + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + base.series.data.tree (Fin.last base.rounds).castSucc ∧ + corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + base.series.data.kind (Fin.last base.rounds) ∧ + corr.replacementETT.series.data.connectingEdges + (Fin.last corr.replacementETT.rounds) = + base.series.data.connectingEdges (Fin.last base.rounds) := by + exact @helper_terminalAgreement_962 V E inferInstance inferInstance inferInstance G k e0 i A + phi base psi B corr + let R := presentation.corresponding.replacementETT + let U := presentation.U + let sigma := presentation.sigma + let n : Fin (R.rounds + 1) := Fin.last R.rounds + let Tn := R.series.data.tree n.castSucc + let Dn := TashkinovStoredColors R.series.data n + have hproper : IsProperEdgeColoring G sigma := by + rw [show sigma = presentation.corresponding.replacementSeries.data.coloring + (Fin.last original.rounds) from presentation.corresponding.finalGeneratingColoring] + exact presentation.corresponding.replacementProper _ + have hone : IsOneEdgeUncolored sigma e0 := by + rw [show sigma = presentation.corresponding.replacementSeries.data.coloring + (Fin.last original.rounds) from presentation.corresponding.finalGeneratingColoring] + exact presentation.corresponding.replacementOneUncolored _ + obtain ⟨seed, hseed, hclosure⟩ : ∃ seed : TreeSequence G e0, + ((R.series.data.kind n = some TashkinovExtensionKind.PE ∧ seed = Tn) ∨ + ((R.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ f, R.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed)) ∧ + TashkinovClosure sigma seed U := by + rcases presentation.terminalRoute with hPE | hSER + · exact ⟨Tn, Or.inl ⟨hPE.1, rfl⟩, hPE.2⟩ + · rcases hSER with ⟨hkind, f, seed, hedges, hadjoin, hcl⟩ + exact ⟨seed, Or.inr ⟨hkind, f, hedges, hadjoin⟩, hcl⟩ + have hseedU : TreeSequenceInitialSegment seed U := + TashkinovAugmentationSequenceInitialSegment sigma seed U hclosure.1 + have hTnSeed : TreeSequenceInitialSegment Tn seed := by + rcases hseed with hPE | hSER + · rw [hPE.2] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · obtain ⟨f, _, hadjoin⟩ := hSER.2 + exact hadjoin.2.1 + have hTnU := segmentTrans hTnSeed hseedU + have hTnSubset := TreeSequenceInitialSegmentVertexSetSubset hTnU + have hb1 : counterexample.b1 ∈ TreeSequenceVertexSet U := counterexample.exit1.2.2.2.1 + have hb2 : counterexample.b2 ∈ TreeSequenceVertexSet U := counterexample.exit2.2.2.2.1 + have hb3 : counterexample.b3 ∈ TreeSequenceVertexSet U := counterexample.exit3.2.2.2.1 + have hmiddle' : counterexample.b2 ∉ TreeSequenceVertexSet Tn := hmiddle + have hstrict : Tn.length < U.length := by + by_contra hn + obtain ⟨i, hi⟩ : ∃ i, U.vertex i = counterexample.b2 := by + simpa [TreeSequenceVertexSet] using hb2 + have hil : i.val < Tn.length + 1 := by have := i.isLt; omega + apply hmiddle' + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨⟨i.val, hil⟩, ?_⟩ + exact (hTnU.2.1 ⟨i.val, hil⟩).symm.trans hi + obtain ⟨gamma, hgamma⟩ := MissingColorsNonemptyOfMaximumDegree G sigma hdegree counterexample.b3 + have hgammaTree : gamma ∈ TreeMissingColors sigma U := + Finset.mem_biUnion.mpr ⟨counterexample.b3, hb3, hgamma⟩ + have hgammaBeta : gamma ≠ counterexample.beta := by + intro h + exact counterexample.betaPresent (h ▸ hgammaTree) + let mu3 := OutsideTreeColorSwap U sigma counterexample.alpha gamma + have hswap3 : IsProperEdgeColoring G mu3 ∧ IsOneEdgeUncolored mu3 e0 ∧ + StableColoring U Dn sigma mu3 ∧ + ∀ f, TreeIncidentEdge U f → mu3 f = sigma f := by + by_cases h : counterexample.alpha = gamma + · have heq : mu3 = sigma := by + funext f + by_cases hf : TreeIncidentEdge U f + · simp [mu3, OutsideTreeColorSwap, hf] + · by_cases hc : sigma f = some gamma <;> + simp [mu3, OutsideTreeColorSwap, hf, h, hc] + rw [heq] + exact ⟨hproper, hone, ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩, fun _ _ => rfl⟩ + · exact OutsideTreeColorSwapStable U Dn sigma counterexample.alpha gamma + hproper hone hclosure.2 counterexample.alphaMissing hgammaTree h + have hstable3 : StableColoring Tn Dn (R.series.data.coloring n) mu3 := by + rw [← R.generatingColoring] + refine ⟨fun f hf _ => hswap3.2.2.2 f ?_, ?_⟩ + · obtain ⟨v, hv, hf⟩ := hf + exact ⟨v, hTnSubset hv, hf⟩ + · intro v hv + exact hswap3.2.2.1.2 v (hTnSubset hv) + exact @helper_continuation_2062 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T generating original hcurrentOne hcurrentSix presentation counterexample + segmentTrans commonPrefix terminalAgreement seed hseed hclosure hseedU hTnU hb1 hb2 hb3 + hmiddle' hstrict gamma hgamma hgammaBeta hswap3 hstable3 +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/SameColorSeriesPreserved.lean b/LeanPool/GoldbergSeymour/SameColorSeriesPreserved.lean new file mode 100644 index 0000000000..e24779924d --- /dev/null +++ b/LeanPool/GoldbergSeymour/SameColorSeriesPreserved.lean @@ -0,0 +1,343 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HkuIncidentColorPreserved + +public import LeanPool.GoldbergSeymour.InternalEdges + +/-! +# Same Color Series Preserved + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem SameColorSeriesPreserved_segment_52.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ + → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree + i.succ.succ) := by + classical + intro V E _ _ _ G k rounds e0 input series j i hji + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero i) hji.symm |>.elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + +private theorem SameColorSeriesPreserved_intervalClaim_110.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (p q : Fin rounds) (f : E) (c : Fin k), + TreeIncidentEdge (series.data.tree p.succ.castSucc) f → series.data.coloring p.castSucc f + = some c → c ∈ TreeMissingColors (series.data.coloring p.castSucc) (series.data.tree + p.succ.castSucc) ∪ TashkinovStoredColors series.data p.castSucc → (∀ (j : Fin (rounds + + 1)) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment (series.data.tree + i.succ.castSucc) (series.data.tree i.succ.succ)) → (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → ∀ {e : E}, TreeIncidentEdge A e → TreeIncidentEdge B e) → + ∀ (n : ℕ), (↑p : ℕ) ≤ n → n ≤ (↑q : ℕ) → ∀ (r : Fin rounds), (↑r : ℕ) = n → + TreeIncidentEdge (series.data.tree r.succ.castSucc) f ∧ (series.data.coloring r.succ f = + series.data.coloring p.castSucc f ∨ ∃ (j : Fin rounds), (↑p : ℕ) ≤ (↑j : ℕ) ∧ (↑j : ℕ) ≤ + (↑r : ℕ) ∧ series.data.kind j.succ = some TashkinovExtensionKind.PE ∧ + series.data.connectingEdges j.succ = {f}) ∧ ∃ (d : Fin k), series.data.coloring r.succ f = + some d ∧ d ∈ TreeMissingColors (series.data.coloring r.succ) (series.data.tree + r.succ.castSucc) ∪ TashkinovStoredColors series.data r.succ := by + classical + intro V E _ _ _ G k rounds e0 input series p q f c hf hfc hc segment incidentTransfer n hpn + induction n, hpn using Nat.le_induction with + | base => + intro hnq r hr + have hpr : r = p := by apply Fin.ext; omega + subst r + have first := HkuIncidentColorPreserved G k rounds e0 input series p f c + hf hfc hc + refine ⟨hf, ?_, first.2⟩ + rcases first.1 with hp | he + · exact Or.inl hp + · exact Or.inr ⟨p, le_rfl, le_rfl, he.1, he.2.1⟩ + | succ n hn ih => + intro hnq s hs + let r : Fin rounds := ⟨n, by omega⟩ + have current := ih (by omega) r rfl + have hseg := segment r.succ r rfl + have hinc := incidentTransfer hseg current.1 + rcases current.2.2 with ⟨d, hd, hdm⟩ + have hmem := (HkuMissingStoredMonotone G k rounds e0 input series r).2 hdm + let nextIndex : Fin rounds := ⟨n + 1, by omega⟩ + have htree : r.succ.succ = nextIndex.succ.castSucc := by + apply Fin.ext + simp [r, nextIndex] + have hcolor : r.succ = nextIndex.castSucc := by + apply Fin.ext + simp [r, nextIndex] + rw [htree] at hinc + rw [hcolor] at hd + have next := HkuIncidentColorPreserved G k rounds e0 input series nextIndex f + d (by simpa [nextIndex] using hinc) + (by simpa [nextIndex] using hd) hmem + have hsr : s = nextIndex := by apply Fin.ext; simp [nextIndex, hs] + rw [hsr] + refine ⟨hinc, ?_, next.2⟩ + rcases current.2.1 with old | witness + · rcases next.1 with keep | exception + · exact Or.inl (keep.trans old) + · exact Or.inr ⟨nextIndex, by omega, le_rfl, exception.1, exception.2.1⟩ + · rcases next.1 with keep | exception + · rcases witness with ⟨w, hwp, hwr, hwk, hwe⟩ + have hw : w.val ≤ n := by simpa [r] using hwr + exact Or.inr ⟨w, hwp, by simpa [nextIndex] using Nat.le_trans hw (Nat.le_succ n), hwk, + hwe⟩ + · exact Or.inr ⟨nextIndex, by omega, le_rfl, exception.1, exception.2.1⟩ + +private theorem SameColorSeriesPreserved_branch_168.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (p q : Fin rounds) (f : E), + let _ := Classical.decEq V; ( + ∀ (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment + (series.data.tree i.succ.castSucc) (series.data.tree i.succ.succ)) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → ( + ∀ (n : ℕ), (↑p : ℕ) ≤ n → n ≤ (↑q : ℕ) → + ∀ (r : Fin rounds), (↑r : ℕ) = n → TreeIncidentEdge (series.data.tree r.succ.castSucc) f ∧ + (series.data.coloring r.succ f = series.data.coloring p.castSucc f ∨ + ∃ (j : Fin rounds), (↑p : ℕ) ≤ (↑j : ℕ) ∧ (↑j : ℕ) ≤ (↑r : ℕ) ∧ series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.connectingEdges j.succ = {f}) ∧ + ∃ (d : Fin k), series.data.coloring r.succ f = some d ∧ d ∈ TreeMissingColors + (series.data.coloring r.succ) (series.data.tree r.succ.castSucc) ∪ TashkinovStoredColors + series.data r.succ) → (TreeIncidentEdge (series.data.tree q.succ.castSucc) f ∧ + (series.data.coloring q.succ f = series.data.coloring p.castSucc f ∨ + ∃ (j : Fin rounds), (↑p : ℕ) ≤ (↑j : ℕ) ∧ (↑j : ℕ) ≤ (↑q : ℕ) ∧ series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.connectingEdges j.succ = {f}) ∧ + ∃ (d : Fin k), series.data.coloring q.succ f = some d ∧ d ∈ TreeMissingColors + (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors + series.data q.succ) → f ∈ InternalEdges G (TreeSequenceVertexSet (series.data.tree + p.succ.castSucc)) → series.data.coloring q.succ f = series.data.coloring p.castSucc f := by + classical + intro V E _ _ _ G k rounds e0 input series p q f this segment vertexTransfer intervalClaim + finalClaim hinternal + rcases finalClaim.2.1 with preserved | witness + · exact preserved + · exfalso + rcases witness with ⟨j, hjp, hjq, hjkind, hjedges⟩ + have hsegAll : ∀ t : Fin rounds, p.val ≤ t.val → t.val ≤ q.val → + TreeIncidentEdge (series.data.tree t.succ.castSucc) f := by + intro t htp htq + have h := intervalClaim t.val htp htq t rfl + exact h.1 + have hjinc := hsegAll j hjp hjq + have hbase : ∀ v, Incident G v f → + v ∈ TreeSequenceVertexSet (series.data.tree p.succ.castSucc) := by + intro v hv + simpa [InternalEdges] using (Finset.mem_filter.mp hinternal).2 v hv + have jlt := j.isLt + have carry : ∀ n : ℕ, p.val ≤ n → n ≤ j.val → n < rounds → + ∀ z : Fin rounds, z.val = n → ∀ x : V, x ∈ TreeSequenceVertexSet + (series.data.tree p.succ.castSucc) → + x ∈ TreeSequenceVertexSet + (series.data.tree z.succ.castSucc) := by + intro n hpn + induction n, hpn using Nat.le_induction with + | base => + intro hn hnr z hz x hx + have heq : z = p := by apply Fin.ext; omega + rw [heq] + exact hx + | succ n hn ih => + intro hnq hnr z hz x hx + let prev : Fin rounds := ⟨n, by omega⟩ + have hold := ih (by omega) (by omega) prev rfl x hx + have hstep := segment prev.succ prev rfl + have hnew := vertexTransfer hstep hold + let nextStep : Fin rounds := ⟨n + 1, by omega⟩ + have htree : prev.succ.succ = nextStep.succ.castSucc := by + apply Fin.ext + simp [prev, nextStep] + rw [htree] at hnew + have hzeq : z = nextStep := by apply Fin.ext; omega + rw [hzeq] + exact hnew + have hverts : ∀ v, Incident G v f → + v ∈ TreeSequenceVertexSet (series.data.tree j.succ.castSucc) := by + intro v hv + have hvbase := hbase v hv + exact carry j.val hjp le_rfl jlt j rfl v hvbase + have hnotboundary : f ∉ BoundaryEdges G + (TreeSequenceVertexSet (series.data.tree j.succ.castSucc)) := by + intro hb + simp only [BoundaryEdges, Fin.castSucc_succ, Finset.mem_filter, Finset.mem_univ, true_and] + at hb + rcases hb with ⟨u, hu, v, hv, hend⟩ + have hvin : Incident G v f := by + simp [Incident, hend] + exact hv (hverts v hvin) + have hstep := series.certified j.succ + revert hnotboundary hjkind hjedges + generalize hz : j.succ = z at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + intro hjkind hjedges hnotboundary + have hv := congrArg Fin.val hz + simp at hv + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + intro hjkind hjedges hnotboundary + have hci : ci = j := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst ci + have hedge : choice.edge = f := by + rw [currentEdges] at hjedges + exact Finset.singleton_inj.mp hjedges + have hdef := choice.edgeDefective + rcases hdef with ⟨alpha, hcolor, hboundary⟩ + have hboundary' : choice.edge ∈ BoundaryEdges G + (TreeSequenceVertexSet (series.data.tree j.succ.castSucc)) := by + change choice.edge ∈ BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (series.data.tree j.succ.castSucc)) alpha + at hboundary + simpa [BoundaryColorEdges] using (Finset.mem_filter.mp hboundary).1 + exact hnotboundary (hedge ▸ hboundary') + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + intro hjkind hjedges hnotboundary + have hci : ci = j := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst ci + have ck := currentKind + rw [ck] at hjkind + simp at hjkind + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + intro hjkind hjedges hnotboundary + have hci : ci = j := by + apply Fin.ext + have hv := congrArg Fin.val hz + simp at hv ⊢ + omega + subst ci + have ck := currentKind + rw [ck] at hjkind + simp at hjkind + +theorem SameColorSeriesPreserved {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (p q : Fin rounds) + (hpq : p.val ≤ q.val) (f : E) (c : Fin k) + (hf : TreeIncidentEdge (series.data.tree p.succ.castSucc) f) + (hfc : series.data.coloring p.castSucc f = some c) + (hc : c ∈ TreeMissingColors (series.data.coloring p.castSucc) + (series.data.tree p.succ.castSucc) ∪ + TashkinovStoredColors series.data p.castSucc) : + (series.data.coloring q.succ f = series.data.coloring p.castSucc f ∨ + ∃ j : Fin rounds, p.val ≤ j.val ∧ j.val ≤ q.val ∧ + series.data.kind j.succ = some TashkinovExtensionKind.PE ∧ + series.data.connectingEdges j.succ = {f}) ∧ + (f ∈ InternalEdges G + (TreeSequenceVertexSet (series.data.tree p.succ.castSucc)) → + series.data.coloring q.succ f = series.data.coloring p.castSucc f) := by + classical + let : DecidableEq V := Classical.decEq V + have segment : ∀ (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ → + TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) + (series.data.tree i.succ.succ) := by + exact @SameColorSeriesPreserved_segment_52 V E inferInstance inferInstance inferInstance G k + rounds e0 input series + have vertexTransfer {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨x, hx⟩ + rcases hab with ⟨hlen, hvertices, hedges⟩ + unfold TreeSequenceVertexSet + apply Finset.mem_image.mpr + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) x, ?_, ?_⟩ + · exact Finset.mem_univ _ + · exact (hvertices x).trans hx + have incidentTransfer {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {e : E} + (he : TreeIncidentEdge A e) : TreeIncidentEdge B e := by + rcases he with ⟨v, hv, hve⟩ + exact ⟨v, vertexTransfer hab hv, hve⟩ + have intervalClaim : + ∀ (n : ℕ), p.val ≤ n → n ≤ q.val → + ∀ r : Fin rounds, r.val = n → (TreeIncidentEdge (series.data.tree r.succ.castSucc) f ∧ + (series.data.coloring r.succ f = series.data.coloring p.castSucc f ∨ + ∃ j : Fin rounds, p.val ≤ j.val ∧ j.val ≤ r.val ∧ series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.connectingEdges j.succ = {f}) ∧ + ∃ d : Fin k, series.data.coloring r.succ f = some d ∧ d ∈ TreeMissingColors + (series.data.coloring r.succ) (series.data.tree r.succ.castSucc) ∪ TashkinovStoredColors + series.data r.succ) := by + exact @SameColorSeriesPreserved_intervalClaim_110 V E inferInstance inferInstance + inferInstance G k rounds e0 input series p q f c hf hfc hc segment incidentTransfer + have finalClaim := intervalClaim q.val (by omega) le_rfl q rfl + refine ⟨?_, ?_⟩ + · exact finalClaim.2.1 + · exact @SameColorSeriesPreserved_branch_168 V E inferInstance inferInstance inferInstance G k + rounds e0 input series p q f segment vertexTransfer intervalClaim finalClaim +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/SameGoodHierarchy.lean b/LeanPool/GoldbergSeymour/SameGoodHierarchy.lean new file mode 100644 index 0000000000..dd48ac3b5a --- /dev/null +++ b/LeanPool/GoldbergSeymour/SameGoodHierarchy.lean @@ -0,0 +1,43 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages + +/-! +# Same Good Hierarchy + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Agreement of hierarchy stages, stored colors and the auxiliary color pairs after transporting +indices. +-/ +def SameGoodHierarchy {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input₁ input₂ : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating₁ generating₂ phi₁ phi₂ : PartialEdgeColoring E k} + {ett₁ : ExtendedTashkinovTree G k e0 input₁ T generating₁} + {ett₂ : ExtendedTashkinovTree G k e0 input₂ T generating₂} {base₁ : HierarchyBase ett₁ phi₁} + {base₂ : HierarchyBase ett₂ phi₂} {H₁ : TashkinovHierarchy ett₁ base₁} + {H₂ : TashkinovHierarchy ett₂ base₂} (good₁ : GoodHierarchy H₁) (good₂ : GoodHierarchy H₂) : + Prop := + SameHierarchyStages H₁ H₂ ∧ + ∃ hcount : H₁.dividerCount = H₂.dividerCount, + ∀ j : Fin (H₁.dividerCount + 1), + let j₂ : Fin (H₂.dividerCount + 1) := Fin.cast (congrArg (fun q => q + 1) hcount) j + HierarchyStoredColorsAt H₁ j = HierarchyStoredColorsAt H₂ j₂ ∧ + ∀ eta ∈ HierarchyStoredColorsAt H₁ j, good₁.gamma j eta = good₂.gamma j₂ eta + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/SameHierarchyStages.lean b/LeanPool/GoldbergSeymour/SameHierarchyStages.lean new file mode 100644 index 0000000000..84a9cadd51 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SameHierarchyStages.lean @@ -0,0 +1,39 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovHierarchy + +/-! +# Same Hierarchy Stages + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Agreement of hierarchy cores, stages, dividers and parallel-extension closure data. -/ +def SameHierarchyStages {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input₁ input₂ : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating₁ generating₂ phi₁ phi₂ : PartialEdgeColoring E k} + {ett₁ : ExtendedTashkinovTree G k e0 input₁ T generating₁} + {ett₂ : ExtendedTashkinovTree G k e0 input₂ T generating₂} {base₁ : HierarchyBase ett₁ phi₁} + {base₂ : HierarchyBase ett₂ phi₂} (H₁ : TashkinovHierarchy ett₁ base₁) + (H₂ : TashkinovHierarchy ett₂ base₂) : Prop := + let pe₁ := ett₁.series.data.kind (Fin.last ett₁.rounds) = some TashkinovExtensionKind.PE + let pe₂ := ett₂.series.data.kind (Fin.last ett₂.rounds) = some TashkinovExtensionKind.PE + base₁.core = base₂.core ∧ + H₁.dividerCount = H₂.dividerCount ∧ + HEq H₁.stage H₂.stage ∧ + HEq H₁.dividerPosition H₂.dividerPosition ∧ (pe₁ ↔ pe₂) ∧ (pe₁ → base₁.closure = base₂.closure) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideAbsorbingElementary.lean b/LeanPool/GoldbergSeymour/ScheideAbsorbingElementary.lean new file mode 100644 index 0000000000..fca220cce1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideAbsorbingElementary.lean @@ -0,0 +1,322 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin + +public import LeanPool.GoldbergSeymour.AbsorbingVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFourFree + +/-! +# Scheide Absorbing Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hcross_39.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) {a b : Fin k} {v u : V}, v ∉ TreeSequenceVertexSet T → u ∈ TreeSequenceVertexSet T → + Sum.inl u ∈ TwoColorComponent G phi a b (Sum.inl v) → a ∈ MissingColors G phi u → ∃ f ∈ + BoundaryEdges G (TreeSequenceVertexSet T), phi f = some a ∨ phi f = some b := by + classical + intro V E _ _ G k e0 phi T a b v u hv hu hcomp ham + let H := TwoColorIncidenceGraph G phi a b + have hr : H.Reachable (Sum.inl v) (Sum.inl u) := by + apply SimpleGraph.ConnectedComponent.exact + have hm := (SimpleGraph.ConnectedComponent.mem_supp_iff + (H.connectedComponentMk (Sum.inl v)) (Sum.inl u)).mp hcomp + exact hm.symm + obtain ⟨p⟩ := hr + let S : Set (Sum V E) := {y | match y with + | Sum.inl q => q ∈ TreeSequenceVertexSet T + | Sum.inr f => ∀ q, Incident G q f → q ∈ TreeSequenceVertexSet T} + have hSu : Sum.inl u ∈ S := hu + have hSv : Sum.inl v ∉ S := by simp [S, hv] + obtain ⟨d, hd, hds, hdt⟩ := p.reverse.exists_boundary_dart S hSu hSv + have hadj := d.adj + have hdmem : d.toProd.1 ∈ p.reverse.support := + p.reverse.dart_fst_mem_support_of_mem_darts hd + have hdtmem : d.toProd.2 ∈ p.reverse.support := + p.reverse.dart_snd_mem_support_of_mem_darts hd + have hfirst : ∃ q : V, d.toProd.1 = Sum.inl q ∧ + q ∈ TreeSequenceVertexSet T := by + cases h : d.toProd.1 with + | inl q => + rw [h] at hds + exact ⟨q, rfl, by simpa [S] using hds⟩ + | inr f => + exfalso + cases h2 : d.toProd.2 with + | inl r => + rw [h, h2] at hadj + change Incident G r f ∧ (phi f = some a ∨ phi f = some b) at hadj + rw [h] at hds + have hall : ∀ q, Incident G q f → q ∈ TreeSequenceVertexSet T := by + simpa [S] using hds + have hrnot : r ∉ TreeSequenceVertexSet T := by + intro hr + apply hdt + simpa [S, h2] using hr + exact hrnot (hall r hadj.1) + | inr e => + exfalso + rw [h, h2] at hadj + change False at hadj + exact hadj.elim + obtain ⟨q, hq, hqT⟩ := hfirst + have hde : ∃ f : E, d.toProd.2 = Sum.inr f := by + cases h : d.toProd.2 with + | inl r => + exfalso + rw [hq, h] at hadj + change False at hadj + exact hadj.elim + | inr f => exact ⟨f, rfl⟩ + obtain ⟨f, hf⟩ := hde + have hfadj : (TwoColorIncidenceGraph G phi a b).Adj (Sum.inl q) (Sum.inr f) := by + rw [hq, hf] at hadj + exact hadj + have hfdata : Incident G q f ∧ (phi f = some a ∨ phi f = some b) := by + simpa [TwoColorIncidenceGraph] using hfadj + have hnotall : ¬ ∀ r, Incident G r f → r ∈ TreeSequenceVertexSet T := by + intro hall + have : d.toProd.2 ∈ S := by simpa [S, hf, hall] + exact hdt this + obtain ⟨r, hrf, hrT⟩ : ∃ r, Incident G r f ∧ r ∉ TreeSequenceVertexSet T := by + push Not at hnotall + exact hnotall + have hend : G.ends f = s(q, r) := by + have hqr : q ≠ r := by + intro h + exact hrT (h ▸ hqT) + exact (Sym2.mem_and_mem_iff hqr).mp ⟨hfdata.1, hrf⟩ + have hfb : f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, hqT, r, hrT, hend⟩ + exact ⟨f, hfb, hfdata.2⟩ + +private theorem helper_endpoint_120.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [ + Fintype E] (G : LooplessMultigraph V E) (k : ℕ) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi → ∀ (a b : Fin k) (v : V), a ≠ b → a ∈ MissingColors G phi v → + @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k phi a b) (@Sum.inl V E v) + (@Fintype.ofFinite (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k phi a b) (@Sum.inl V E v))) (@Subtype.finite (Sum V E) + (inferInstance : Finite (Sum V E)) (@Membership.mem (Sum V + E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k phi a b) (@Sum.inl V E v))))) ≤ (1 : ℕ) := by + classical + intro V E _ _ G k phi hproper a b v hab hmiss + let vertexEnumeration := Fintype.ofFinite V + classical + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro x hx y hy + have hx' : (TwoColorIncidenceGraph G phi a b).Adj (Sum.inl v) x := by + simpa [SimpleGraph.neighborFinset] using hx + have hy' : (TwoColorIncidenceGraph G phi a b).Adj (Sum.inl v) y := by + simpa [SimpleGraph.neighborFinset] using hy + cases x with + | inl x => simp [TwoColorIncidenceGraph] at hx' + | inr x => + cases y with + | inl y => simp [TwoColorIncidenceGraph] at hy' + | inr y => + by_contra hxy + simp only [TwoColorIncidenceGraph] at hx' hy' + rcases hx' with ⟨hxi, hxc⟩ + rcases hy' with ⟨hyi, hyc⟩ + have hxa : ¬ phi x = some a := by + intro hxa + apply (by simpa [MissingColors] using hmiss) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxi, hxa⟩ + have hya : ¬ phi y = some a := by + intro hya + apply (by simpa [MissingColors] using hmiss) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨y, hyi, hya⟩ + have hxb : phi x = some b := hxc.resolve_left hxa + have hyb : phi y = some b := hyc.resolve_left hya + exact hproper (by simpa using hxy) ⟨v, hxi, hyi⟩ hxb hyb + +private theorem helper_branch_185.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ + Fintype E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0), IsProperEdgeColoring G phi → (4 : ℕ) ≤ (TreeFreeColors phi + T).card → (∀ (a b : Fin k) (v : V), a ≠ b → a ∈ MissingColors G phi v → + @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k phi a b) (@Sum.inl V E v) + (@Fintype.ofFinite (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k phi a b) (@Sum.inl V E v))) (@Subtype.finite (Sum V E) + (inferInstance : Finite (Sum V E)) (@Membership.mem (Sum V + E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k phi a b) (@Sum.inl V E v))))) ≤ (1 : ℕ)) → ∀ {u v : V}, u + ≠ v → u ∈ AbsorbingVertices T phi → v ∈ AbsorbingVertices T phi → Disjoint (MissingColors + G phi u) (MissingColors G phi v) := by + classical + intro V E _ _ G k e0 phi T hproper hfree endpoint u v huv huA hvA + refine Finset.disjoint_left.mpr ?_ + intro delta hdu hdv + have huabs : AbsorbingVertex T phi u := by + simpa [AbsorbingVertices] using huA + have hvabs : AbsorbingVertex T phi v := by + simpa [AbsorbingVertices] using hvA + obtain ⟨gamma, hgamma, hne⟩ := Finset.exists_mem_ne (by omega : 1 < (TreeFreeColors phi + T).card) delta + have hgraph : TwoColorIncidenceGraph G phi delta gamma = + TwoColorIncidenceGraph G phi gamma delta := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + obtain ⟨wu, hwuT, hwug, hwuc, huniq_u⟩ := huabs.2 delta hdu gamma hgamma hne + obtain ⟨wv, hwvT, hwvg, hwvc, huniq_v⟩ := hvabs.2 delta hdv gamma hgamma hne + have hwvw : wv = wu := huniq_u wv hwvT hwvg + rw [hwvw] at hwvc + have hproper_u : @SimpleGraph.degree _ (TwoColorIncidenceGraph G phi gamma delta) + (Sum.inl u) (Fintype.ofFinite _) ≤ 1 := by + rw [← hgraph] + exact endpoint delta gamma u hne.symm hdu + have hproper_v : @SimpleGraph.degree _ (TwoColorIncidenceGraph G phi gamma delta) + (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rw [← hgraph] + exact endpoint delta gamma v hne.symm hdv + obtain ⟨s, t, p, hp, hps⟩ := + TwoColorComponentSpanningPath G phi gamma delta hproper (Sum.inl u) + have hpu : Sum.inl u ∈ p.support := by + have hm : Sum.inl u ∈ TwoColorComponent G phi gamma delta (Sum.inl u) := by + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + have hm' : Sum.inl u ∈ {x | x ∈ p.support} := hps.symm ▸ hm + exact hm' + have hpv : Sum.inl v ∈ p.support := by + have hwu_u := (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mp hwuc + have hwu_v := (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mp hwvc + have heq : TwoColorComponent G phi gamma delta (Sum.inl u) = + TwoColorComponent G phi gamma delta (Sum.inl v) := by + unfold TwoColorComponent + exact congrArg SimpleGraph.ConnectedComponent.supp (hwu_u.symm.trans hwu_v) + have hm : Sum.inl v ∈ {x | x ∈ p.support} := hps.symm ▸ (heq ▸ + (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl) + exact hm + have hpsw : Sum.inl wu ∈ p.support := by + have hm : Sum.inl wu ∈ {x | x ∈ p.support} := hps.symm ▸ hwuc + exact hm + have hu_leaf : ((TwoColorIncidenceGraph G phi gamma delta).neighborSet (Sum.inl + u)).Subsingleton := by + let : Fintype ((TwoColorIncidenceGraph G phi gamma delta).neighborSet (Sum.inl u)) := + Fintype.ofFinite _ + intro z hz z2 hz2 + have hc : Fintype.card ((TwoColorIncidenceGraph G phi gamma delta).neighborSet (Sum.inl u)) + ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hproper_u + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hc ⟨z, hz⟩ ⟨z2, hz2⟩) + have hv_leaf : ((TwoColorIncidenceGraph G phi gamma delta).neighborSet (Sum.inl + v)).Subsingleton := by + let : Fintype ((TwoColorIncidenceGraph G phi gamma delta).neighborSet (Sum.inl v)) := + Fintype.ofFinite _ + intro z hz z2 hz2 + have hc : Fintype.card ((TwoColorIncidenceGraph G phi gamma delta).neighborSet (Sum.inl v)) + ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hproper_v + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hc ⟨z, hz⟩ ⟨z2, hz2⟩) + have hwu_degree := endpoint gamma delta wu hne hwug + have hwu_leaf : ((TwoColorIncidenceGraph G phi gamma delta).neighborSet (Sum.inl + wu)).Subsingleton := by + let : Fintype ((TwoColorIncidenceGraph G phi gamma delta).neighborSet (Sum.inl wu)) := + Fintype.ofFinite _ + intro z hz z2 hz2 + have hc : Fintype.card ((TwoColorIncidenceGraph G phi gamma delta).neighborSet (Sum.inl + wu)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hwu_degree + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hc ⟨z, hz⟩ ⟨z2, hz2⟩) + have hu_end : Sum.inl u = s ∨ Sum.inl u = t := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet hn.1 hn.2 hu_leaf) hpu + have hv_end : Sum.inl v = s ∨ Sum.inl v = t := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet hn.1 hn.2 hv_leaf) hpv + have hwu_end : Sum.inl wu = s ∨ Sum.inl wu = t := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet hn.1 hn.2 hwu_leaf) hpsw + have huv' : (Sum.inl u : Sum V E) ≠ Sum.inl v := by simpa using huv + have huw' : (Sum.inl u : Sum V E) ≠ Sum.inl wu := by + intro h + apply huabs.1 + exact (Sum.inl.inj h) ▸ hwuT + have hvw' : (Sum.inl v : Sum V E) ≠ Sum.inl wu := by + intro h + apply hvabs.1 + exact (Sum.inl.inj h) ▸ hwuT + rcases hu_end with hus | hut <;> rcases hv_end with hvs | hvt <;> + rcases hwu_end with hws | hwt <;> + all_goals aesop + +theorem ScheideAbsorbingElementary {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) : + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T ∪ AbsorbingVertices T phi) := by + classical + rcases hglobal with ⟨htriple, htree, hcard⟩ + have horder := ScheideGlobalMaximumOrder G k e0 phi T ⟨htriple, htree, hcard⟩ + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := horder.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := horder.2.2.2.2 + have hproper : IsProperEdgeColoring G phi := htriple.2.2.2.1 + have hfree : 4 ≤ (TreeFreeColors phi T).card := + ScheideGlobalMaximumFourFree G k e0 phi T ⟨htriple, htree, hcard⟩ + have hcross := @helper_hcross_39 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + have endpoint := @helper_endpoint_120 (@V) (@E) inferInstance inferInstance (@G) (@k) (@phi) + (@hproper) + unfold ColoredVertexSetElementary + intro u hu v hv huv + rw [Finset.mem_union] at hu hv + rcases hu with huT | huA <;> rcases hv with hvT | hvA + · exact helem huT hvT huv + · refine Finset.disjoint_left.mpr ?_ + intro delta hdu hdv + have hvabs : AbsorbingVertex T phi v := by + simpa [AbsorbingVertices] using hvA + obtain ⟨gamma, hgamma, hne⟩ := Finset.exists_mem_ne (by omega : 1 < (TreeFreeColors phi + T).card) delta + rcases hvabs.2 delta hdv gamma hgamma hne with ⟨w, hwT, hwg, hwc, huniq⟩ + obtain ⟨f, hfb, hfc⟩ := hcross (a := gamma) (b := delta) + hvabs.1 hwT hwc hwg + rcases hfc with hfc | hfc + · exact hclosed hfb hwT hfc hwg + · exact hclosed hfb huT hfc hdu + · refine Finset.disjoint_left.mpr ?_ + intro delta hdu hdv + have huabs : AbsorbingVertex T phi u := by + simpa [AbsorbingVertices] using huA + obtain ⟨gamma, hgamma, hne⟩ := Finset.exists_mem_ne (by omega : 1 < (TreeFreeColors phi + T).card) delta + rcases huabs.2 delta hdu gamma hgamma hne with ⟨w, hwT, hwg, hwc, huniq⟩ + obtain ⟨f, hfb, hfc⟩ := hcross (a := gamma) (b := delta) + huabs.1 hwT hwc hwg + rcases hfc with hfc | hfc + · exact hclosed hfb hwT hfc hwg + · exact hclosed hfb hvT hfc hdv + · exact @helper_branch_185 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + (@hproper) (@hfree) (@endpoint) (@u) (@v) (@huv) (@huA) (@hvA) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideBalancedCandidate.lean b/LeanPool/GoldbergSeymour/ScheideBalancedCandidate.lean new file mode 100644 index 0000000000..3fb9405d1a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideBalancedCandidate.lean @@ -0,0 +1,45 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.NormalTripleTrunk + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment + +public import LeanPool.GoldbergSeymour.TreeUsedColors + +/-! +# Scheide Balanced Candidate + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A Tashkinov tree preserving the normal trunk and used colors, with odd order and paired later +edge colors. +-/ +structure ScheideBalancedCandidate {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {T : TreeSequence G e0} (N : NormalGlobalMaximumTriple G k e0 phi T) (S : TreeSequence G e0) : + Prop where + tashkinov : TashkinovTree G e0 phi S + oddOrder : Odd (TreeSequenceVertexSet S).card + exactTrunk : TreeSequenceInitialSegment (NormalTripleTrunk N) S + usedColors : TreeUsedColors phi S ⊆ TreeUsedColors phi T + paired : + ∀ j : ℕ, + ∀ hlow : N.height < 2 * j, + ∀ hupp : 2 * j < S.length + 1, + phi (S.edge ⟨2 * j - 2, by omega⟩) = phi (S.edge ⟨2 * j - 1, by omega⟩) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumExists.lean b/LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumExists.lean new file mode 100644 index 0000000000..7b49b65b1e --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumExists.lean @@ -0,0 +1,115 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideBalancedCandidate +public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd + +/-! +# Scheide Balanced Candidate Maximum Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideBalancedCandidateMaximumExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hheight : N.height = ScheideGraphHeight G) : + ∃ S : TreeSequence G e0, + ScheideBalancedCandidate N S ∧ + ∀ R : TreeSequence G e0, ScheideBalancedCandidate N R → + (TreeSequenceVertexSet R).card ≤ + (TreeSequenceVertexSet S).card := by + classical + let Q : TreeSequence G e0 := NormalTripleTrunk N + have qLength : Q.length + 1 = N.height := by + dsimp [Q, NormalTripleTrunk, TreeSequencePrefix] + have := N.height_lower + omega + have qBound : Q.length ≤ T.length := by + have := N.height_upper + omega + have qTashkinov : TashkinovTree G e0 phi Q := by + intro j hj + let jT : Fin T.length := Fin.castLE qBound j + obtain ⟨i, c, hedge, hmissing⟩ := N.global.2.1 jT hj + refine ⟨i, c, ?_, ?_⟩ + · change phi (T.edge _) = some c + convert hedge using 1 + apply congrArg phi + apply congrArg T.edge + apply Fin.ext + rfl + · change c ∈ MissingColors G phi (T.vertex _) + convert hmissing using 1 + apply congrArg (MissingColors G phi) + apply congrArg T.vertex + apply Fin.ext + rfl + have qCard : (TreeSequenceVertexSet Q).card = Q.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + Q.vertex_injective] + have qOdd : Odd (TreeSequenceVertexSet Q).card := by + rw [qCard, qLength, hheight] + exact (ScheideGraphHeightOdd G k e0 phi T N.global).2 + have qInitial : TreeSequenceInitialSegment (NormalTripleTrunk N) Q := by + change TreeSequenceInitialSegment Q Q + refine ⟨le_rfl, ?_, ?_⟩ + · intro i + rfl + · intro j + rfl + have qColors : TreeUsedColors phi Q ⊆ TreeUsedColors phi T := by + intro c hc + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hc ⊢ + obtain ⟨j, hj, hcolor⟩ := hc + refine ⟨Fin.castLE qBound j, hj, ?_⟩ + simpa [Q, NormalTripleTrunk, TreeSequencePrefix] using hcolor + have qCandidate : ScheideBalancedCandidate N Q := by + refine + { tashkinov := qTashkinov + oddOrder := qOdd + exactTrunk := qInitial + usedColors := qColors + paired := ?_ } + intro j hlow hupp + omega + have cardBound : ∀ R : TreeSequence G e0, + (TreeSequenceVertexSet R).card ≤ Fintype.card V := by + intro R + exact Finset.card_le_card (Finset.subset_univ _) + let sizes : Finset ℕ := + (Finset.range (Fintype.card V + 1)).filter (fun n => + ∃ S : TreeSequence G e0, + ScheideBalancedCandidate N S ∧ + (TreeSequenceVertexSet S).card = n) + have sizesNonempty : sizes.Nonempty := by + refine ⟨(TreeSequenceVertexSet Q).card, ?_⟩ + simp only [sizes, Finset.mem_filter, Finset.mem_range] + exact ⟨Nat.lt_succ_of_le (cardBound Q), Q, qCandidate, rfl⟩ + let largest : ℕ := sizes.max' sizesNonempty + have largestMem : largest ∈ sizes := Finset.max'_mem sizes sizesNonempty + obtain ⟨S, hS, hcard⟩ := (Finset.mem_filter.mp largestMem).2 + refine ⟨S, hS, ?_⟩ + intro R hR + have hRmem : (TreeSequenceVertexSet R).card ∈ sizes := by + simp only [sizes, Finset.mem_filter, Finset.mem_range] + exact ⟨Nat.lt_succ_of_le (cardBound R), R, hR, rfl⟩ + rw [hcard] + exact Finset.le_max' sizes _ hRmem + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumOrder.lean b/LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumOrder.lean new file mode 100644 index 0000000000..8ccfcc4733 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumOrder.lean @@ -0,0 +1,1144 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.NormalTripleTrunk +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideBalancedCandidate +public import LeanPool.GoldbergSeymour.TashTree +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors + +public import LeanPool.GoldbergSeymour.TashkinovOrderBound + +/-! +# Scheide Balanced Candidate Maximum Order + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hPlusTash_173.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T S : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (_ : + ScheideBalancedCandidate N S), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (omitted : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + let n : ℕ := Nat.find omitted; + ∀ (hnlt : n < T.length + (1 : ℕ)) (hnlarge : (2 : ℕ) ≤ n), + let q : Fin T.length := (⟨n - (1 : ℕ), Decidable.byContradiction fun (a : ¬n - (1 : ℕ) < + T.length) => + by omega + ⟩ : Fin T.length); + ∀ (a : Fin ((↑q : ℕ) + (1 : ℕ))) (gamma : Fin k) (_ : phi (T.edge q) = some gamma) (_ : gamma + ∈ MissingColors G phi (T.vertex (a.castLT (( + by first | omega + ))))) (s : Fin (S.length + (1 : ℕ))) (_ : S.vertex s = T.vertex (a.castLT (Nat.lt_trans a.isLt + (Nat.succ_lt_succ q.isLt)))) (Splus : TreeSequence G e0) (hPlusLen : Splus.length = + S.length + (1 : ℕ)) (hSPlusInit : TreeSequenceInitialSegment S Splus) (_ : Splus.edge + (Fin.cast (( + by omega + )) (Fin.last S.length)) = T.edge q) (_ : ( + ∀ (i : Fin (S.length + (1 : ℕ))), Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) i) + = S.vertex i)) (_ : ( + ∀ (j : Fin S.length), Splus.edge (Fin.castLE hSPlusInit.1 j) = S.edge j)), TashkinovTree G e0 + phi Splus := by + classical + intro V E _ _ _ _ G k e0 phi T S N hS X omitted n hnlt hnlarge q a gamma hqcolor hagamma s hsa + Splus hPlusLen hSPlusInit hPlusLast hPlusVertex hPlusEdge j hj + by_cases hlast : j.val = S.length + · have hjlast : j = Fin.cast hPlusLen.symm (Fin.last S.length) := by + apply Fin.ext + simp [hlast] + let ss : Fin (j.val + 1) := ⟨s.val, by simpa [hlast] using s.isLt⟩ + refine ⟨ss, gamma, ?_, ?_⟩ + · rw [hjlast, hPlusLast, hqcolor] + · have hcast : Fin.castLT ss + (Nat.lt_trans ss.isLt (Nat.succ_lt_succ j.isLt)) = + Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s := by + apply Fin.ext + simp [ss] + rw [hcast, hPlusVertex, hsa] + exact hagamma + · have hjlt : j.val < S.length := by + rw [hPlusLen] at j + omega + let jS : Fin S.length := ⟨j.val, hjlt⟩ + obtain ⟨i, c, hcolor, hmissing⟩ := hS.tashkinov jS (by simpa [jS] using hj) + let ii : Fin (j.val + 1) := ⟨i.val, by simpa [jS] using i.isLt⟩ + refine ⟨ii, c, ?_, ?_⟩ + · have hindex : j = Fin.castLE hSPlusInit.1 jS := by + apply Fin.ext + rfl + rw [hindex, hPlusEdge] + exact hcolor + · have hidx : Fin.castLT ii + (Nat.lt_trans ii.isLt (Nat.succ_lt_succ j.isLt)) = + Fin.castLE (Nat.succ_le_succ hSPlusInit.1) + (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ jS.isLt))) := by + apply Fin.ext + rfl + rw [hidx, hPlusVertex] + exact hmissing + +private theorem helper_hPlusPlusTash_472.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] (G : LooplessMultigraph + V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T S : TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (omitted : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + let n : ℕ := Nat.find omitted; + ∀ (_ : n < T.length + (1 : ℕ)) (_ : (2 : ℕ) ≤ n) (gamma : Fin k) (s : Fin (S.length + (1 : + ℕ))) (Splus : TreeSequence G e0) (_ : Splus.length = S.length + (1 : ℕ)) (hSPlusInit : + TreeSequenceInitialSegment S Splus) (_ : TashkinovTree G e0 phi Splus) (_ : + (TreeSequenceVertexSet Splus).card = S.length + (2 : ℕ)), + let U : Finset V := TreeSequenceVertexSet Splus; + ∀ (_ : U.card = S.length + (2 : ℕ)) (f : E) (_ : phi f = some gamma) (Splusplus : TreeSequence + G e0) (hPlusPlusLen : Splusplus.length = Splus.length + (1 : ℕ)) (hPlusPlusInit : + TreeSequenceInitialSegment Splus Splusplus) (_ : Splusplus.edge (Fin.cast (( + by omega + )) (Fin.last Splus.length)) = f) (_ : ( + ∀ (i : Fin (Splus.length + (1 : ℕ))), Splusplus.vertex (Fin.castLE (Nat.succ_le_succ + hPlusPlusInit.1) i) = Splus.vertex i)) (_ : ( + ∀ (j : Fin Splus.length), Splusplus.edge (Fin.castLE hPlusPlusInit.1 j) = Splus.edge j)), + let zIndex : Fin (Splus.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s; + ∀ (_ : gamma ∈ MissingColors G phi (Splus.vertex zIndex)), TashkinovTree G e0 phi Splusplus + := by + classical + intro V E _ _ _ G k e0 phi T S X omitted n hnlt hnlarge gamma s Splus hPlusLen hSPlusInit + hPlusTash hPlusCard U hUCard f hfColor Splusplus hPlusPlusLen hPlusPlusInit hPlusPlusLast + hPlusPlusVertex hPlusPlusEdge zIndex hzIndexMissing j hj + let _ := Fintype.ofFinite V + by_cases hlast : j.val = Splus.length + · have hjlast : j = Fin.cast hPlusPlusLen.symm (Fin.last Splus.length) := by + apply Fin.ext + simp [hlast] + let zz : Fin (j.val + 1) := + ⟨zIndex.val, by simpa [hlast] using zIndex.isLt⟩ + refine ⟨zz, gamma, ?_, ?_⟩ + · rw [hjlast, hPlusPlusLast, hfColor] + · have hcast : Fin.castLT zz + (Nat.lt_trans zz.isLt (Nat.succ_lt_succ j.isLt)) = + Fin.castLE (Nat.succ_le_succ hPlusPlusInit.1) zIndex := by + apply Fin.ext + simp [zz] + rw [hcast, hPlusPlusVertex] + exact hzIndexMissing + · have hjlt : j.val < Splus.length := by + rw [hPlusPlusLen] at j + omega + let jPlus : Fin Splus.length := ⟨j.val, hjlt⟩ + obtain ⟨i, c, hcolor, hmissing⟩ := + hPlusTash jPlus (by simpa [jPlus] using hj) + let ii : Fin (j.val + 1) := + ⟨i.val, by simpa [jPlus] using i.isLt⟩ + refine ⟨ii, c, ?_, ?_⟩ + · have hindex : j = Fin.castLE hPlusPlusInit.1 jPlus := by + apply Fin.ext + rfl + rw [hindex, hPlusPlusEdge] + exact hcolor + · have hidx : Fin.castLT ii + (Nat.lt_trans ii.isLt (Nat.succ_lt_succ j.isLt)) = + Fin.castLE (Nat.succ_le_succ hPlusPlusInit.1) + (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ jPlus.isLt))) := by + apply Fin.ext + rfl + rw [hidx, hPlusPlusVertex] + exact hmissing + +private theorem helper_hUsed_577.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T S : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (_ : + ScheideBalancedCandidate N S), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (omitted : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + let n : ℕ := Nat.find omitted; + ∀ (_ : n < T.length + (1 : ℕ)) (_ : (2 : ℕ) ≤ n) (gamma : Fin k) (_ : Fin (S.length + (1 : + ℕ))) (Splus : TreeSequence G e0) (hPlusLen : Splus.length = S.length + (1 : ℕ)) + (hSPlusInit : TreeSequenceInitialSegment S Splus) (_ : ( + ∀ (j : Fin S.length), Splus.edge (Fin.castLE hSPlusInit.1 j) = S.edge j)) (_ : gamma ∈ + TreeUsedColors phi T) (_ : (TreeSequenceVertexSet Splus).card = S.length + (2 : ℕ)), + let U : Finset V := TreeSequenceVertexSet Splus; + ∀ (_ : U.card = S.length + (2 : ℕ)) (Splusplus : TreeSequence G e0) (hPlusPlusLen : + Splusplus.length = Splus.length + (1 : ℕ)) (hPlusPlusInit : TreeSequenceInitialSegment + Splus Splusplus) (_ : ( + ∀ (j : Fin Splus.length), Splusplus.edge (Fin.castLE hPlusPlusInit.1 j) = Splus.edge j)), + let firstNewPlus : Fin Splus.length := Fin.cast (Eq.symm hPlusLen) (Fin.last S.length); + let firstNew : Fin Splusplus.length := Fin.castLE hPlusPlusInit.1 firstNewPlus; + let secondNew : Fin Splusplus.length := Fin.cast (Eq.symm hPlusPlusLen) (Fin.last + Splus.length); + ∀ (_ : (↑firstNew : ℕ) = S.length) (_ : (↑secondNew : ℕ) = S.length + (1 : ℕ)) (_ : phi + (Splusplus.edge firstNew) = some gamma) (_ : phi (Splusplus.edge secondNew) = some gamma) + (_ : (TreeSequenceVertexSet Splusplus).card = S.length + (3 : ℕ)), TreeUsedColors phi + Splusplus ⊆ TreeUsedColors phi T := by + classical + intro V E _ _ _ _ G k e0 phi T S N hS X omitted n hnlt hnlarge gamma s Splus hPlusLen + hSPlusInit hPlusEdge hgammaUsedT hPlusCard U hUCard Splusplus hPlusPlusLen hPlusPlusInit + hPlusPlusEdge firstNewPlus firstNew secondNew hFirstNewVal hSecondNewVal hFirstNewColor + hSecondNewColor hPlusPlusCard c hc + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hc ⊢ + obtain ⟨j, hj, hjcolor⟩ := hc + by_cases hold : j.val < S.length + · let jS : Fin S.length := ⟨j.val, hold⟩ + have hjEq : j = Fin.castLE hPlusPlusInit.1 + (Fin.castLE hSPlusInit.1 jS) := by + apply Fin.ext + rfl + have hOldColor : phi (S.edge jS) = some c := by + rw [hjEq, hPlusPlusEdge, hPlusEdge] at hjcolor + exact hjcolor + have hcS : c ∈ TreeUsedColors phi S := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨jS, by simpa [jS] using hj, hOldColor⟩ + simpa [TreeUsedColors] using hS.usedColors hcS + · have hjcases : j.val = S.length ∨ j.val = S.length + 1 := by + rw [hPlusPlusLen, hPlusLen] at j + omega + have hcgamma : c = gamma := by + rcases hjcases with hfirst | hsecond + · have hjeq : j = firstNew := by + apply Fin.ext + simpa [hFirstNewVal] using hfirst + rw [hjeq, hFirstNewColor] at hjcolor + exact (Option.some.inj hjcolor).symm + · have hjeq : j = secondNew := by + apply Fin.ext + simpa [hSecondNewVal] using hsecond + rw [hjeq, hSecondNewColor] at hjcolor + exact (Option.some.inj hjcolor).symm + simpa [hcgamma, TreeUsedColors] using hgammaUsedT + +private theorem helper_hCandidate_618.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T S : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (_ : + ScheideBalancedCandidate N S), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (omitted : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + let n : ℕ := Nat.find omitted; + ∀ (_ : n < T.length + (1 : ℕ)) (_ : (2 : ℕ) ≤ n) (gamma : Fin k) (_ : Fin (S.length + (1 : + ℕ))) (Splus : TreeSequence G e0) (hPlusLen : Splus.length = S.length + (1 : ℕ)) + (hSPlusInit : TreeSequenceInitialSegment S Splus) (_ : ( + ∀ (j : Fin S.length), Splus.edge (Fin.castLE hSPlusInit.1 j) = S.edge j)) (_ : + (TreeSequenceVertexSet S).card = S.length + (1 : ℕ)) (_ : (TreeSequenceVertexSet + Splus).card = S.length + (2 : ℕ)), + let U : Finset V := TreeSequenceVertexSet Splus; + ∀ (_ : U.card = S.length + (2 : ℕ)) (Splusplus : TreeSequence G e0) (hPlusPlusLen : + Splusplus.length = Splus.length + (1 : ℕ)) (hPlusPlusInit : TreeSequenceInitialSegment + Splus Splusplus) (_ : ( + ∀ (j : Fin Splus.length), Splusplus.edge (Fin.castLE hPlusPlusInit.1 j) = Splus.edge j)) (_ : + TashkinovTree G e0 phi Splusplus) (_ : TreeSequenceInitialSegment (NormalTripleTrunk N) + Splusplus), + let firstNewPlus : Fin Splus.length := Fin.cast (Eq.symm hPlusLen) (Fin.last S.length); + let firstNew : Fin Splusplus.length := Fin.castLE hPlusPlusInit.1 firstNewPlus; + let secondNew : Fin Splusplus.length := Fin.cast (Eq.symm hPlusPlusLen) (Fin.last + Splus.length); + ∀ (_ : (↑firstNew : ℕ) = S.length) (_ : (↑secondNew : ℕ) = S.length + (1 : ℕ)) (_ : phi + (Splusplus.edge firstNew) = some gamma) (_ : phi (Splusplus.edge secondNew) = some gamma) + (_ : (TreeSequenceVertexSet Splusplus).card = S.length + (3 : ℕ)) (_ : TreeUsedColors phi + Splusplus ⊆ TreeUsedColors phi T) (_ : Odd (TreeSequenceVertexSet Splusplus).card), + ScheideBalancedCandidate N Splusplus := by + classical + intro V E _ _ _ _ G k e0 phi T S N hS X omitted n hnlt hnlarge gamma s Splus hPlusLen + hSPlusInit hPlusEdge hSCard hPlusCard U hUCard Splusplus hPlusPlusLen hPlusPlusInit + hPlusPlusEdge hPlusPlusTash hTrunkInit firstNewPlus firstNew secondNew hFirstNewVal + hSecondNewVal hFirstNewColor hSecondNewColor hPlusPlusCard hUsed hPlusPlusOdd + refine + { tashkinov := hPlusPlusTash + oddOrder := hPlusPlusOdd + exactTrunk := hTrunkInit + usedColors := hUsed + paired := ?_ } + intro r hlow hupp + by_cases hold : 2 * r < S.length + 1 + · have hOld := hS.paired r hlow hold + have hidxOne : + (⟨2 * r - 2, by omega⟩ : Fin Splusplus.length) = + Fin.castLE hPlusPlusInit.1 + (Fin.castLE hSPlusInit.1 + (⟨2 * r - 2, by omega⟩ : Fin S.length)) := by + apply Fin.ext + rfl + have hidxTwo : + (⟨2 * r - 1, by omega⟩ : Fin Splusplus.length) = + Fin.castLE hPlusPlusInit.1 + (Fin.castLE hSPlusInit.1 + (⟨2 * r - 1, by omega⟩ : Fin S.length)) := by + apply Fin.ext + rfl + rw [hidxOne, hidxTwo, hPlusPlusEdge, hPlusEdge, + hPlusPlusEdge, hPlusEdge] + exact hOld + · have hoddLength : Odd (S.length + 1) := by + rw [← hSCard] + exact hS.oddOrder + have hne : 2 * r ≠ S.length + 1 := by + intro heq + rcases hoddLength with ⟨m, hm⟩ + omega + have heq : 2 * r = S.length + 2 := by + rw [hPlusPlusLen, hPlusLen] at hupp + omega + have hidxOne : + (⟨2 * r - 2, by omega⟩ : Fin Splusplus.length) = firstNew := by + apply Fin.ext + simp [hFirstNewVal, heq] + have hidxTwo : + (⟨2 * r - 1, by omega⟩ : Fin Splusplus.length) = secondNew := by + apply Fin.ext + simp [hSecondNewVal, heq] + rw [hidxOne, hidxTwo, hFirstNewColor, hSecondNewColor] + +private theorem helper_firstVertices_354.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) + (e0 : E) (T S : TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (j : Fin (2 : ℕ)), + T.vertex (Fin.castLE (Nat.succ_le_succ T.positive) j) ∈ X := by + classical + intro V E _ _ G e0 T S X j + let := Fintype.ofFinite V + let := Fintype.ofFinite E + obtain ⟨it, ht⟩ := T.attaches ⟨0, T.positive⟩ + obtain ⟨is, hs⟩ := S.attaches ⟨0, S.positive⟩ + have itzero : it = 0 := Fin.eq_zero it + have iszero : is = 0 := Fin.eq_zero is + subst it + subst is + rw [T.first_edge] at ht + rw [S.first_edge] at hs + have hm : T.vertex (Fin.castLE (Nat.succ_le_succ T.positive) j) ∈ + G.ends e0 := by + have cases : j.val = 0 ∨ j.val = 1 := by omega + rcases cases with hzero | hone + · have hj : j = 0 := Fin.ext hzero + subst j + rw [ht] + exact Sym2.mem_iff.mpr (Or.inr rfl) + · have hj : j = 1 := Fin.ext hone + subst j + rw [ht] + exact Sym2.mem_iff.mpr (Or.inl rfl) + rw [hs] at hm + rcases Sym2.mem_iff.mp hm with hm | hm + · simpa [X, TreeSequenceVertexSet] using + (Finset.mem_image.mpr ⟨_, Finset.mem_univ _, hm.symm⟩) + · simpa [X, TreeSequenceVertexSet] using + (Finset.mem_image.mpr ⟨_, Finset.mem_univ _, hm.symm⟩) + +private theorem helper_hgoodUnion_524.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T S : + TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (omitted : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + let n : ℕ := Nat.find omitted; + ∀ (_ : n < T.length + (1 : ℕ)) (_ : (2 : ℕ) ≤ n) (gamma : Fin k) (Splus : TreeSequence G e0), + let U : Finset V := TreeSequenceVertexSet Splus; + let edges : Finset E := {e : E | phi e = some gamma}; + let good : Finset E := {e ∈ edges | + ∀ (v : V), Incident G v e → v ∈ U}; + ∀ (_ : ( + ∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ))) (_ : ( + ∀ ⦃e : E⦄ (_ : e ∈ good) ⦃f : E⦄ (_ : f ∈ good) (_ : e ≠ f), Disjoint (G.ends e).toFinset + (G.ends f).toFinset)), (good.biUnion fun (e : E) => (G.ends e).toFinset).card = (2 : ℕ) * + good.card := by + classical + intro V E _ _ _ G k e0 phi T S X omitted n hnlt hnlarge gamma Splus U edges good hendcard + hgoodDisjoint + have aux : ∀ A : Finset E, A ⊆ good → + (A.biUnion fun e => (G.ends e).toFinset).card = 2 * A.card := by + intro A hA + induction A using Finset.induction_on with + | empty => simp + | @insert e A heA ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset + (A.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro v hev hvA + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvA + have hh := hgoodDisjoint (hA (Finset.mem_insert_self e A)) + (hA (Finset.mem_insert_of_mem hf)) (by + intro hef + exact heA (by simpa [hef] using hf)) + exact (Finset.disjoint_left.mp hh) hev hvf + rw [Finset.card_union_of_disjoint hd, hendcard] + rw [ih (fun x hx => hA (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem heA] + omega + exact aux good (by intro e he; exact he) + +private theorem helper_hcover_548.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (S : TreeSequence G e0) (gamma : Fin k) (s : Fin (S.length + (1 : ℕ))) + (Splus : TreeSequence G e0) (hSPlusInit : TreeSequenceInitialSegment S Splus), + let U : Finset V := TreeSequenceVertexSet Splus; + let z : V := Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s); + ∀ (_ : (∀ v ∈ U, v ≠ z → gamma ∈ PresentColors G phi v)), + let B : Finset E := BoundaryColorEdges G phi U gamma; + let edges : Finset E := {e : E | phi e = some gamma}; + let good : Finset E := {e ∈ edges | ∀ (v : V), Incident G v e → v ∈ U}; + let Y : Finset V := U.erase z; + ∀ (_ : (∀ (e : E), e ∈ edges ↔ phi e = some gamma)) + (_ : (∀ (e : E), e ∈ good ↔ e ∈ edges ∧ ∀ (v : V), Incident G v e → v ∈ U)), + ∀ v ∈ Y, + (v ∈ good.biUnion fun (e : E) => (G.ends e).toFinset) ∨ + v ∈ B.biUnion fun (e : E) => {v ∈ U | Incident G v e} := by + classical + intro V E _ _ _ G k e0 phi S gamma s Splus hSPlusInit U z hpresent B edges good Y hedgeMem + hgood v hvY + have hvU : v ∈ U := Finset.mem_of_mem_erase hvY + have hvz : v ≠ z := (Finset.mem_erase.mp hvY).1 + obtain ⟨e, hve, hecolor⟩ := by + simpa [PresentColors] using hpresent v hvU hvz + by_cases hall : ∀ w, Incident G w e → w ∈ U + · left + exact Finset.mem_biUnion.mpr + ⟨e, (hgood e).mpr ⟨(hedgeMem e).mpr hecolor, hall⟩, + Sym2.mem_toFinset.mpr hve⟩ + · right + push Not at hall + obtain ⟨w, hw, hwo⟩ := hall + obtain ⟨x, hx⟩ := Sym2.mem_iff_exists.mp hw + have heq : G.ends e = s(w, x) := hx + have hxU : x ∈ U := by + have hvends : v = w ∨ v = x := by + have : v ∈ s(w, x) := by rw [← heq]; exact hve + simpa using this + rcases hvends with rfl | rfl + · exact False.elim (hwo hvU) + · exact hvU + have hbound : e ∈ BoundaryEdges G U := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxU, w, hwo, heq.trans Sym2.eq_swap⟩ + exact Finset.mem_biUnion.mpr + ⟨e, (Finset.mem_filter.mpr ⟨hbound, hecolor⟩), + Finset.mem_filter.mpr ⟨hvU, hve⟩⟩ + +private theorem helper_hbUnion_607.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T S : + TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (omitted : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + let n : ℕ := Nat.find omitted; + ∀ (_ : n < T.length + (1 : ℕ)) (_ : (2 : ℕ) ≤ n) (gamma : Fin k) (Splus : TreeSequence G e0), + let U : Finset V := TreeSequenceVertexSet Splus; + let B : Finset E := BoundaryColorEdges G phi U gamma; + ∀ (_ : ( + ∀ e ∈ B, {v ∈ U | Incident G v e}.card = (1 : ℕ))) (_ : ( + ∀ ⦃e : E⦄ (_ : e ∈ B) ⦃f : E⦄ (_ : f ∈ B) (_ : e ≠ f), Disjoint ({v ∈ U | Incident G v e}) + ({v ∈ U | Incident G v f}))), (B.biUnion fun (e : E) => {v ∈ U | Incident G v e}).card = + B.card := by + classical + intro V E _ _ _ G k e0 phi T S X omitted n hnlt hnlarge gamma Splus U B hbFiber hbDisjoint + have aux : + ∀ A : Finset E, A ⊆ B → (A.biUnion fun e => U.filter (fun v => Incident G v e)).card = A.card + := by + intro A hA + induction A using Finset.induction_on with + | empty => simp + | @insert e A heA ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (U.filter (fun v => Incident G v e)) + (A.biUnion fun f => U.filter (fun v => Incident G v f)) := by + rw [Finset.disjoint_left] + intro v hev hvA + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvA + exact (Finset.disjoint_left.mp + (hbDisjoint (hA (Finset.mem_insert_self e A)) + (hA (Finset.mem_insert_of_mem hf)) (by + intro hef + exact heA (by simpa [hef] using hf)))) hev hvf + rw [Finset.card_union_of_disjoint hd, + hbFiber e (hA (Finset.mem_insert_self e A))] + rw [ih (fun x hx => hA (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem heA] + omega + exact aux B (by intro e he; exact he) + +private theorem helper_hnlarge_542.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] [DecidableEq V] (G : LooplessMultigraph + V E) (e0 : E) (T S : TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (_ : ( + ∀ (j : Fin (2 : ℕ)), T.vertex (Fin.castLE (Nat.succ_le_succ T.positive) j) ∈ X)) (omitted : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + let n : ℕ := Nat.find omitted; + ∀ (hnlt : n < T.length + (1 : ℕ)) (_ : T.vertex (⟨n, hnlt⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + (2 : ℕ) ≤ n := by + classical + intro V E _ _ _ G e0 T S X firstVertices omitted n hnlt hnout + let := Fintype.ofFinite V + let := Fintype.ofFinite E + by_contra hh + have hcases : n = 0 ∨ n = 1 := by omega + rcases hcases with hzero | hone + · apply hnout + simpa [hzero] using firstVertices ⟨0, by omega⟩ + · apply hnout + have hv := firstVertices ⟨1, by omega⟩ + have hi : (⟨n, hnlt⟩ : Fin (T.length + 1)) = + Fin.castLE (Nat.succ_le_succ T.positive) ⟨1, by omega⟩ := by + apply Fin.ext + simp [hone] + rw [hi] + exact hv + +private theorem helper_prior_563.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] [ DecidableEq V] (G : LooplessMultigraph + V E) (e0 : E) (T S : TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (omitted : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + let n : ℕ := Nat.find omitted; + ∀ (hnlt : n < T.length + (1 : ℕ)) (hnlarge : (2 : ℕ) ≤ n), + let q : Fin T.length := (⟨n - (1 : ℕ), Decidable.byContradiction fun (a : ¬n - (1 : ℕ) < + T.length) => + by omega + ⟩ : Fin T.length); + ∀ (_ : (↑q : ℕ) + (1 : ℕ) = n) (i : Fin ((↑q : ℕ) + (1 : ℕ))), T.vertex (i.castLT + (Nat.lt_trans i.isLt (Nat.succ_lt_succ q.isLt))) ∈ X := by + classical + intro V E _ _ _ G e0 T S X omitted n hnlt hnlarge q hqrel i + let := Fintype.ofFinite V + let := Fintype.ofFinite E + by_contra hout + have hprop : ∃ hi : i.val < T.length + 1, + T.vertex ⟨i.val, hi⟩ ∉ X := + ⟨by omega, by + intro hm + apply hout + convert hm using 1 + apply congrArg T.vertex + apply Fin.ext + rfl⟩ + have hmin : n ≤ i.val := Nat.find_min' omitted hprop + omega + +private theorem helper_hbFiber_675.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (gamma : Fin k) (Splus : TreeSequence G e0), + let U : Finset V := TreeSequenceVertexSet Splus; + let B : Finset E := BoundaryColorEdges G phi U gamma; + ∀ e ∈ B, {v ∈ U | Incident G v e}.card = (1 : ℕ) := by + classical + intro V E _ _ G k e0 phi gamma Splus U B e he + obtain ⟨u, hu, v, hv, huv⟩ := by + simpa [B, BoundaryColorEdges, BoundaryEdges] using + (Finset.mem_filter.mp he).1 + have hs : U.filter (fun x => Incident G x e) = {u} := by + ext x + simp only [Finset.mem_filter, Finset.mem_singleton, Incident, + huv, Sym2.mem_iff] + constructor + · rintro ⟨hxU, rfl | hxe⟩ + · exact rfl + · exact False.elim (hv (hxe ▸ hxU)) + · intro hxu + subst hxu + exact ⟨hu, Or.inl rfl⟩ + rw [hs] + simp + +private theorem helper_hIY_708.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (S : TreeSequence G e0) (gamma : Fin k) (s : Fin (S.length + (1 : ℕ))) + (Splus : TreeSequence G e0) (hSPlusInit : TreeSequenceInitialSegment S Splus), + let U : Finset V := TreeSequenceVertexSet Splus; + let z : V := Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s); + ∀ (_ : gamma ∉ PresentColors G phi z), + let edges : Finset E := {e : E | phi e = some gamma}; + let good : Finset E := {e ∈ edges | ∀ (v : V), Incident G v e → v ∈ U}; + let Y : Finset V := U.erase z; + ∀ (_ : (∀ (e : E), e ∈ edges ↔ phi e = some gamma)) + (_ : (∀ (e : E), e ∈ good ↔ e ∈ edges ∧ ∀ (v : V), Incident G v e → v ∈ U)), + let I : Finset V := good.biUnion fun (e : E) => (G.ends e).toFinset; + I ⊆ Y := by + classical + intro V E _ _ _ G k e0 phi S gamma s Splus hSPlusInit U z hzNotPresent edges good Y hedgeMem + hgood I v hv + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hv + have hvU : v ∈ U := (hgood e).mp he |>.2 v + (Sym2.mem_toFinset.mp hve) + have hvz : v ≠ z := by + intro hvz + subst v + apply hzNotPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, Sym2.mem_toFinset.mp hve, + hedgeMem e |>.mp (hgood e |>.mp he).1⟩ + exact Finset.mem_erase.mpr ⟨hvz, hvU⟩ + +private theorem helper_hIW_733.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (gamma : Fin k) (Splus : TreeSequence G e0), + let U : Finset V := TreeSequenceVertexSet Splus; + ∀ (_ : IsProperEdgeColoring G phi), + let B : Finset E := BoundaryColorEdges G phi U gamma; + let edges : Finset E := {e : E | phi e = some gamma}; + let good : Finset E := {e ∈ edges | ∀ (v : V), Incident G v e → v ∈ U}; + ∀ (_ : (∀ (e : E), e ∈ edges ↔ phi e = some gamma)) + (_ : (∀ (e : E), e ∈ good ↔ e ∈ edges ∧ ∀ (v : V), Incident G v e → v ∈ U)), + let I : Finset V := good.biUnion fun (e : E) => (G.ends e).toFinset; + let W : Finset V := B.biUnion fun (e : E) => {v ∈ U | Incident G v e}; + Disjoint I W := by + classical + intro V E _ _ _ G k e0 phi gamma Splus U hproper B edges good hedgeMem hgood I W + rw [Finset.disjoint_left] + intro v hvI hvW + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hvI + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvW + have hef : e ≠ f := by + intro hef + subst f + obtain ⟨u, hu, w, hw, huw⟩ := by + simpa [B, BoundaryColorEdges, BoundaryEdges] using + (Finset.mem_filter.mp hf).1 + have hwU : w ∈ U := (hgood e).mp he |>.2 w + (by change w ∈ G.ends e; rw [huw]; exact Sym2.mem_mk_right u w) + exact hw hwU + exact (hproper hef + ⟨v, Sym2.mem_toFinset.mp hve, (Finset.mem_filter.mp hvf).2⟩ + (hedgeMem e |>.mp (hgood e |>.mp he).1)) + (Finset.mem_filter.mp hf).2 + +private theorem helper_hSPlusPlusInit_800.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (S : TreeSequence + G e0) (gamma : Fin k) (s : Fin (S.length + (1 : ℕ))) (Splus : TreeSequence G e0) + (hSPlusInit : TreeSequenceInitialSegment S Splus) (_ : ( + ∀ (i : Fin (S.length + (1 : ℕ))), Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) i) + = S.vertex i)) (_ : ( + ∀ (j : Fin S.length), Splus.edge (Fin.castLE hSPlusInit.1 j) = S.edge j)) (_ : gamma ∈ + MissingColors G phi (Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s))), + let U : Finset V := TreeSequenceVertexSet Splus; + let z : V := Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s); + ∀ (_ : z ∈ U) (_ : gamma ∈ MissingColors G phi z) (_ : gamma ∉ PresentColors G phi z) (_ : ( + ∀ v ∈ U, v ≠ z → gamma ∈ PresentColors G phi v)), + let B : Finset E := BoundaryColorEdges G phi U gamma; + let edges : Finset E := {e : E | phi e = some gamma}; + let good : Finset E := {e ∈ edges | + ∀ (v : V), Incident G v e → v ∈ U}; + let Y : Finset V := U.erase z; + ∀ (_ : ( + ∀ v ∈ Y, (v ∈ good.biUnion fun (e : E) => (G.ends e).toFinset) ∨ v ∈ B.biUnion fun (e : E) => + {v ∈ U | Incident G v e})), + let I : Finset V := good.biUnion fun (e : E) => (G.ends e).toFinset; + let W : Finset V := B.biUnion fun (e : E) => {v ∈ U | Incident G v e}; + ∀ (_ : I ⊆ Y) (_ : W ⊆ Y) (_ : I ∪ W = Y) (_ : Y.card = (2 : ℕ) * good.card + B.card) (_ : + Y.card = S.length + (1 : ℕ)) (_ : Odd Y.card) (Splusplus : TreeSequence G e0) + (hPlusPlusInit : TreeSequenceInitialSegment Splus Splusplus) (_ : ( + ∀ (i : Fin (Splus.length + (1 : ℕ))), Splusplus.vertex (Fin.castLE (Nat.succ_le_succ + hPlusPlusInit.1) i) = Splus.vertex i)) (_ : ( + ∀ (j : Fin Splus.length), Splusplus.edge (Fin.castLE hPlusPlusInit.1 j) = Splus.edge j)), + let zIndex : Fin (Splus.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s; + ∀ (_ : gamma ∈ MissingColors G phi (Splus.vertex zIndex)), TreeSequenceInitialSegment S + Splusplus := by + classical + intro V E _ _ _ G k e0 phi S gamma s Splus hSPlusInit hPlusVertex hPlusEdge hsGamma U z hzU + hzMissing hzNotPresent hpresent B edges good Y hcover I W hIY hWY hIYunion hYCardEq hYCard + hYOdd Splusplus hPlusPlusInit hPlusPlusVertex hPlusPlusEdge zIndex hzIndexMissing + rcases hSPlusInit with ⟨hSP, hvSP, heSP⟩ + rcases hPlusPlusInit with ⟨hPP, hvPP, hePP⟩ + refine ⟨le_trans hSP hPP, ?_, ?_⟩ + · intro i + have hi : Fin.castLE (Nat.succ_le_succ (le_trans hSP hPP)) i = + Fin.castLE (Nat.succ_le_succ hPP) + (Fin.castLE (Nat.succ_le_succ hSP) i) := by + apply Fin.ext + rfl + rw [hi, hvPP] + exact hvSP i + · intro j + have hj : Fin.castLE (le_trans hSP hPP) j = + Fin.castLE hPP (Fin.castLE hSP j) := by + apply Fin.ext + rfl + rw [hj, hePP] + exact heSP j + +private theorem helper_hTrunkInit_819.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T S : TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T), + ScheideBalancedCandidate N S → + ∀ (Splusplus : TreeSequence G e0), + TreeSequenceInitialSegment S Splusplus → + TreeSequenceInitialSegment (NormalTripleTrunk N) Splusplus := by + classical + intro V E _ _ _ G k e0 phi T S N hS Splusplus hSPlusPlusInit + rcases hS.exactTrunk with ⟨hTS, hvTS, heTS⟩ + rcases hSPlusPlusInit with ⟨hSS, hvSS, heSS⟩ + refine ⟨le_trans hTS hSS, ?_, ?_⟩ + · intro i + have hi : Fin.castLE (Nat.succ_le_succ (le_trans hTS hSS)) i = + Fin.castLE (Nat.succ_le_succ hSS) + (Fin.castLE (Nat.succ_le_succ hTS) i) := by + apply Fin.ext + rfl + rw [hi, hvSS] + exact hvTS i + · intro j + have hj : Fin.castLE (le_trans hTS hSS) j = + Fin.castLE hSS (Fin.castLE hTS j) := by + apply Fin.ext + rfl + rw [hj, heSS] + exact heTS j + +private theorem helper_continuation_951.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T S : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (_ : + ScheideBalancedCandidate N S) (_ : ( + ∀ (R : TreeSequence G e0) (_ : ScheideBalancedCandidate N R), (TreeSequenceVertexSet R).card ≤ + (TreeSequenceVertexSet S).card)), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (omitted : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + let n : ℕ := Nat.find omitted; + ∀ (hnlt : n < T.length + (1 : ℕ)) (hnlarge : (2 : ℕ) ≤ n), + let q : Fin T.length := (⟨n - (1 : ℕ), + by omega + ⟩ : Fin T.length); + ∀ (gamma : Fin k) (_ : phi (T.edge q) = some gamma) (s : Fin (S.length + (1 : ℕ))) (Splus : + TreeSequence G e0) (hPlusLen : Splus.length = S.length + (1 : ℕ)) (hSPlusInit : + TreeSequenceInitialSegment S Splus) (_ : Splus.edge (Fin.cast ( + by omega + ) (Fin.last S.length)) = T.edge q) (_ : ( + ∀ (i : Fin (S.length + (1 : ℕ))), Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) i) + = S.vertex i)) (_ : ( + ∀ (j : Fin S.length), Splus.edge (Fin.castLE hSPlusInit.1 j) = S.edge j)) (_ : TashkinovTree G + e0 phi Splus) (_ : gamma ∈ TreeUsedColors phi T) (_ : (TreeSequenceVertexSet S).card = + S.length + (1 : ℕ)) (_ : (TreeSequenceVertexSet Splus).card = S.length + (2 : ℕ)) (_ : + gamma ∈ MissingColors G phi (Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) + s))), + let U : Finset V := TreeSequenceVertexSet Splus; + let z : V := Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s); + ∀ (_ : z ∈ U) (_ : gamma ∈ MissingColors G phi z) (_ : gamma ∉ PresentColors G phi z) (_ : ( + ∀ v ∈ U, v ≠ z → gamma ∈ PresentColors G phi v)), + let B : Finset E := BoundaryColorEdges G phi U gamma; + let edges : Finset E := ({e : E | phi e = some gamma} : Finset E); + let good : Finset E := ({e ∈ edges | + ∀ (v : V), Incident G v e → v ∈ U} : Finset E); + let Y : Finset V := U.erase z; + ∀ (_ : ( + ∀ v ∈ Y, (v ∈ good.biUnion fun (e : E) ↦ (G.ends e).toFinset) ∨ v ∈ B.biUnion fun (e : E) ↦ + ({v ∈ U | Incident G v e} : Finset V))), + let I : Finset V := good.biUnion fun (e : E) ↦ (G.ends e).toFinset; + let W : Finset V := B.biUnion fun (e : E) ↦ ({v ∈ U | Incident G v e} : Finset V); + ∀ (_ : I ⊆ Y) (_ : W ⊆ Y) (_ : I ∪ W = Y) (_ : Y.card = (2 : ℕ) * good.card + B.card) (_ : + U.card = S.length + (2 : ℕ)) (_ : Y.card = S.length + (1 : ℕ)) (_ : Odd Y.card) (_ : (0 : + ℕ) < B.card), False := by + classical + intro V E _ _ _ _ G k e0 phi T S N hS hmax X omitted n hnlt hnlarge q gamma hqcolor s Splus + hPlusLen hSPlusInit hPlusLast hPlusVertex hPlusEdge hPlusTash hgammaUsedT hSCard hPlusCard + hsGamma U z hzU hzMissing hzNotPresent hpresent B edges good Y hcover I W hIY hWY hIYunion + hYCardEq hUCard hYCard hYOdd hBpos + obtain ⟨f, hfB⟩ := Finset.card_pos.mp hBpos + have hfBoundary : f ∈ BoundaryEdges G U := + (Finset.mem_filter.mp hfB).1 + have hfColor : phi f = some gamma := + (Finset.mem_filter.mp hfB).2 + obtain ⟨Splusplus, hAdjoinPlusPlus⟩ := + TreeSequenceBoundaryEdgeAppendExists Splus f hfBoundary + rcases hAdjoinPlusPlus with + ⟨hPlusPlusLen, hPlusPlusInit, hPlusPlusLast⟩ + have hPlusPlusVertex (i : Fin (Splus.length + 1)) : + Splusplus.vertex + (Fin.castLE (Nat.succ_le_succ hPlusPlusInit.1) i) = + Splus.vertex i := hPlusPlusInit.2.1 i + have hPlusPlusEdge (j : Fin Splus.length) : + Splusplus.edge (Fin.castLE hPlusPlusInit.1 j) = Splus.edge j := + hPlusPlusInit.2.2 j + let zIndex : Fin (Splus.length + 1) := + Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s + have hzIndexMissing : gamma ∈ MissingColors G phi (Splus.vertex zIndex) := by + simpa [zIndex] using hsGamma + have hPlusPlusTash : TashkinovTree G e0 phi Splusplus := by + exact @helper_hPlusPlusTash_472 V E inferInstance inferInstance inferInstance G + k e0 phi T S omitted hnlt hnlarge gamma s Splus hPlusLen hSPlusInit hPlusTash hPlusCard + hUCard f hfColor Splusplus hPlusPlusLen hPlusPlusInit hPlusPlusLast hPlusPlusVertex + hPlusPlusEdge hzIndexMissing + have hSPlusPlusInit : TreeSequenceInitialSegment S Splusplus := by + exact @helper_hSPlusPlusInit_800 V E inferInstance inferInstance inferInstance G k e0 phi S + gamma s Splus hSPlusInit hPlusVertex hPlusEdge hsGamma hzU hzMissing hzNotPresent + hpresent hcover hIY hWY hIYunion hYCardEq hYCard hYOdd Splusplus hPlusPlusInit + hPlusPlusVertex hPlusPlusEdge hzIndexMissing + have hTrunkInit : + TreeSequenceInitialSegment (NormalTripleTrunk N) Splusplus := by + exact @helper_hTrunkInit_819 V E inferInstance inferInstance inferInstance G k e0 phi T S N + hS Splusplus hSPlusPlusInit + let firstNewPlus : Fin Splus.length := + Fin.cast hPlusLen.symm (Fin.last S.length) + let firstNew : Fin Splusplus.length := + Fin.castLE hPlusPlusInit.1 firstNewPlus + let secondNew : Fin Splusplus.length := + Fin.cast hPlusPlusLen.symm (Fin.last Splus.length) + have hFirstNewVal : firstNew.val = S.length := by + simp [firstNew, firstNewPlus] + have hSecondNewVal : secondNew.val = S.length + 1 := by + simp [secondNew, hPlusLen] + have hFirstNewColor : phi (Splusplus.edge firstNew) = some gamma := by + rw [show Splusplus.edge firstNew = Splus.edge firstNewPlus by + exact hPlusPlusEdge firstNewPlus] + rw [show Splus.edge firstNewPlus = T.edge q by + exact hPlusLast] + exact hqcolor + have hSecondNewColor : phi (Splusplus.edge secondNew) = some gamma := by + rw [show Splusplus.edge secondNew = f by exact hPlusPlusLast] + exact hfColor + have hPlusPlusCard : + (TreeSequenceVertexSet Splusplus).card = S.length + 3 := by + rw [show (TreeSequenceVertexSet Splusplus).card = + Splusplus.length + 1 by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + Splusplus.vertex_injective]] + omega + have hUsed : TreeUsedColors phi Splusplus ⊆ TreeUsedColors phi T := by + exact @helper_hUsed_577 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T S N hS omitted hnlt hnlarge gamma s Splus hPlusLen hSPlusInit hPlusEdge hgammaUsedT + hPlusCard hUCard Splusplus hPlusPlusLen hPlusPlusInit hPlusPlusEdge hFirstNewVal + hSecondNewVal hFirstNewColor hSecondNewColor hPlusPlusCard + have hPlusPlusOdd : Odd (TreeSequenceVertexSet Splusplus).card := by + rcases hS.oddOrder with ⟨m, hm⟩ + refine ⟨m + 1, ?_⟩ + rw [hPlusPlusCard] + rw [hSCard] at hm + omega + have hCandidate : ScheideBalancedCandidate N Splusplus := by + exact @helper_hCandidate_618 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T S N hS omitted hnlt hnlarge gamma s Splus hPlusLen hSPlusInit hPlusEdge hSCard + hPlusCard hUCard Splusplus hPlusPlusLen hPlusPlusInit hPlusPlusEdge hPlusPlusTash + hTrunkInit hFirstNewVal hSecondNewVal hFirstNewColor hSecondNewColor hPlusPlusCard hUsed + hPlusPlusOdd + have hmaxPlusPlus := hmax Splusplus hCandidate + rw [hPlusPlusCard, hSCard] at hmaxPlusPlus + omega + +private theorem helper_continuation_856.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T S : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (_ : + ScheideBalancedCandidate N S) (_ : ( + ∀ (R : TreeSequence G e0) (_ : ScheideBalancedCandidate N R), (TreeSequenceVertexSet R).card ≤ + (TreeSequenceVertexSet S).card)), + let X : Finset V := TreeSequenceVertexSet S; + ∀ (omitted : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ X), + let n : ℕ := Nat.find omitted; + ∀ (hnlt : n < T.length + (1 : ℕ)) (hnlarge : (2 : ℕ) ≤ n), + let q : Fin T.length := (⟨n - (1 : ℕ), Decidable.byContradiction fun (a : ¬n - (1 : ℕ) < + T.length) => + by omega + ⟩ : Fin T.length); + ∀ (gamma : Fin k) (_ : phi (T.edge q) = some gamma) (s : Fin (S.length + (1 : ℕ))) (Splus : + TreeSequence G e0) (hPlusLen : Splus.length = S.length + (1 : ℕ)) (hSPlusInit : + TreeSequenceInitialSegment S Splus) (_ : Splus.edge (Fin.cast (( + by omega + )) (Fin.last S.length)) = T.edge q) (_ : ( + ∀ (i : Fin (S.length + (1 : ℕ))), Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) i) + = S.vertex i)) (_ : ( + ∀ (j : Fin S.length), Splus.edge (Fin.castLE hSPlusInit.1 j) = S.edge j)) (_ : TashkinovTree G + e0 phi Splus) (_ : gamma ∈ TreeUsedColors phi T) (_ : (TreeSequenceVertexSet S).card = + S.length + (1 : ℕ)) (_ : (TreeSequenceVertexSet Splus).card = S.length + (2 : ℕ)) (_ : + gamma ∈ MissingColors G phi (Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) + s))), + let U : Finset V := TreeSequenceVertexSet Splus; + let z : V := Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s); + ∀ (_ : z ∈ U) (_ : gamma ∈ MissingColors G phi z) (_ : gamma ∉ PresentColors G phi z) (_ : + IsProperEdgeColoring G phi) (_ : ( + ∀ v ∈ U, v ≠ z → gamma ∈ PresentColors G phi v)), False := by + classical + intro V E _ _ _ _ G k e0 phi T S N hS hmax X omitted n hnlt hnlarge q gamma hqcolor s Splus + hPlusLen hSPlusInit hPlusLast hPlusVertex hPlusEdge hPlusTash hgammaUsedT hSCard hPlusCard + hsGamma U z hzU hzMissing hzNotPresent hproper hpresent + let B := BoundaryColorEdges G phi U gamma + let edges := (Finset.univ : Finset E).filter (fun e => phi e = some gamma) + let good := edges.filter (fun e => ∀ v, Incident G v e → v ∈ U) + let Y := U.erase z + have hedgeMem : ∀ e, e ∈ edges ↔ phi e = some gamma := by + intro e + simp [edges] + have hgood : ∀ e, e ∈ good ↔ + e ∈ edges ∧ ∀ v, Incident G v e → v ∈ U := by + intro e + simp [good] + have hendcard : ∀ e : E, (G.ends e).toFinset.card = 2 := by + intro e + apply Sym2.card_toFinset_of_not_isDiag + intro hd + exact G.loopless e ((G.ends e).diagElem hd) (Sym2.diag_diagElem hd).symm + have hgoodDisjoint : ∀ ⦃e⦄, e ∈ good → ∀ ⦃f⦄, f ∈ good → + e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + exact (hproper hef + ⟨v, Sym2.mem_toFinset.mp hev, Sym2.mem_toFinset.mp hvf⟩ + (hedgeMem e |>.mp (hgood e |>.mp he).1)) + (hedgeMem f |>.mp (hgood f |>.mp hf).1) + have hgoodUnion : + (good.biUnion fun e => (G.ends e).toFinset).card = 2 * good.card := by + exact @helper_hgoodUnion_524 V E inferInstance inferInstance inferInstance G k + e0 phi T S omitted hnlt hnlarge gamma Splus hendcard hgoodDisjoint + have hcover : ∀ v, v ∈ Y → + v ∈ good.biUnion (fun e => (G.ends e).toFinset) ∨ + v ∈ B.biUnion (fun e => U.filter (fun v => Incident G v e)) := by + exact @helper_hcover_548 V E inferInstance inferInstance inferInstance G k e0 phi S gamma s + Splus hSPlusInit hpresent hedgeMem hgood + have hbFiber : ∀ e, e ∈ B → + (U.filter (fun v => Incident G v e)).card = 1 := by + exact @helper_hbFiber_675 V E inferInstance inferInstance G k e0 phi gamma Splus + have hbDisjoint : ∀ ⦃e⦄, e ∈ B → ∀ ⦃f⦄, f ∈ B → e ≠ f → + Disjoint (U.filter (fun v => Incident G v e)) + (U.filter (fun v => Incident G v f)) := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + exact (hproper hef + ⟨v, (Finset.mem_filter.mp hev).2, (Finset.mem_filter.mp hvf).2⟩ + (Finset.mem_filter.mp he).2) (Finset.mem_filter.mp hf).2 + have hbUnion : + (B.biUnion fun e => U.filter (fun v => Incident G v e)).card = B.card := by + exact @helper_hbUnion_607 V E inferInstance inferInstance inferInstance G k e0 + phi T S omitted hnlt hnlarge gamma Splus hbFiber hbDisjoint + let I := good.biUnion (fun e => (G.ends e).toFinset) + let W := B.biUnion (fun e => U.filter (fun v => Incident G v e)) + have hIY : I ⊆ Y := by + exact @helper_hIY_708 V E inferInstance inferInstance inferInstance G k e0 phi S gamma s + Splus hSPlusInit hzNotPresent hedgeMem hgood + have hWY : W ⊆ Y := by + intro v hv + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hv + have hvU := (Finset.mem_filter.mp hve).1 + have hvz : v ≠ z := by + intro hvz + subst v + apply hzNotPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, (Finset.mem_filter.mp hve).2, + (Finset.mem_filter.mp he).2⟩ + exact Finset.mem_erase.mpr ⟨hvz, hvU⟩ + have hIW : Disjoint I W := by + exact @helper_hIW_733 V E inferInstance inferInstance inferInstance G k e0 phi gamma Splus + hproper hedgeMem hgood + have hIYunion : I ∪ W = Y := by + apply Finset.Subset.antisymm + · exact Finset.union_subset hIY hWY + · intro v hv + rcases hcover v hv with hvI | hvW + · exact Finset.mem_union.mpr (Or.inl hvI) + · exact Finset.mem_union.mpr (Or.inr hvW) + have hYCardEq : Y.card = 2 * good.card + B.card := by + rw [← hIYunion, Finset.card_union_of_disjoint hIW] + simpa [I, W] using congrArg₂ (· + ·) hgoodUnion hbUnion + have hUCard : U.card = S.length + 2 := by + simpa [U] using hPlusCard + have hYCard : Y.card = S.length + 1 := by + have herase := Finset.card_erase_add_one hzU + change Y.card + 1 = U.card at herase + omega + have hYOdd : Odd Y.card := by + rw [hYCard, ← hSCard] + exact hS.oddOrder + have hBOdd : Odd B.card := by + rcases hYOdd with ⟨m, hm⟩ + have hgoodle : good.card ≤ m := by omega + refine ⟨m - good.card, ?_⟩ + omega + have hBpos : 0 < B.card := by + rcases hBOdd with ⟨m, hm⟩ + omega + exact @helper_continuation_951 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@S) (@N) (@hS) (@hmax) (@omitted) (@hnlt) + (@hnlarge) (@gamma) (@hqcolor) (@s) (@Splus) (@hPlusLen) (@hSPlusInit) (@hPlusLast) + (@hPlusVertex) (@hPlusEdge) (@hPlusTash) (@hgammaUsedT) (@hSCard) (@hPlusCard) (@hsGamma) + (@hzU) (@hzMissing) (@hzNotPresent) (@hpresent) (@hcover) (@hIY) (@hWY) (@hIYunion) + (@hYCardEq) (@hUCard) (@hYCard) (@hYOdd) (@hBpos) +theorem ScheideBalancedCandidateMaximumOrder {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T S : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hS : ScheideBalancedCandidate N S) + (hmax : ∀ R : TreeSequence G e0, ScheideBalancedCandidate N R → + (TreeSequenceVertexSet R).card ≤ + (TreeSequenceVertexSet S).card) : + (TreeSequenceVertexSet S).card = TashkinovOrder G := by + classical + have htriple : KTriple G k e0 phi := N.global.1 + have hSle := treeCard_le_tashkinovOrder G k e0 phi S htriple hS.tashkinov + apply Nat.le_antisymm hSle + by_contra hnot + have hltOrder : (TreeSequenceVertexSet S).card < TashkinovOrder G := + Nat.lt_of_not_ge hnot + have hlt : (TreeSequenceVertexSet S).card < + (TreeSequenceVertexSet T).card := by + simpa [N.global.2.2] using hltOrder + let X := TreeSequenceVertexSet S + have firstVertices : ∀ j : Fin 2, + T.vertex (Fin.castLE (Nat.succ_le_succ T.positive) j) ∈ X := by + exact @helper_firstVertices_354 V E inferInstance inferInstance G + e0 T S + have omitted : ∃ n : ℕ, ∃ hn : n < T.length + 1, + T.vertex ⟨n, hn⟩ ∉ X := by + by_contra hn + push Not at hn + have hsub : TreeSequenceVertexSet T ⊆ X := by + intro v hv + obtain ⟨j, -, rfl⟩ := Finset.mem_image.mp + (show v ∈ Finset.image T.vertex Finset.univ from by + simpa [TreeSequenceVertexSet] using hv) + exact hn j.val j.isLt + have hcard := Finset.card_le_card hsub + exact (Nat.not_le_of_gt hlt) (by simpa [X] using hcard) + let n : ℕ := Nat.find omitted + have hnlt : n < T.length + 1 := (Nat.find_spec omitted).1 + have hnout : T.vertex ⟨n, hnlt⟩ ∉ X := (Nat.find_spec omitted).2 + have hnlarge : 2 ≤ n := by + exact @helper_hnlarge_542 V E inferInstance inferInstance inferInstance G e0 T + S firstVertices omitted hnlt hnout + let q : Fin T.length := ⟨n - 1, by omega⟩ + have hqrel : q.val + 1 = n := by + simp [q, Nat.sub_add_cancel (by omega : 1 ≤ n)] + have hqout : T.vertex q.succ ∉ X := by + have hidx : q.succ = ⟨n, hnlt⟩ := Fin.ext (by simp [hqrel]) + rw [hidx] + exact hnout + have prior : ∀ (i : Fin (q.val + 1)), + T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ q.isLt))) ∈ X := by + exact @helper_prior_563 V E inferInstance inferInstance inferInstance G e0 T S + omitted hnlt hnlarge hqrel + obtain ⟨a, gamma, hqcolor, hagamma⟩ := + N.global.2.1 q (by simp [q]; omega) + have haX := prior a + obtain ⟨s, -, hsa⟩ := Finset.mem_image.mp + (show T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))) ∈ + Finset.image S.vertex Finset.univ from by + simpa [X, TreeSequenceVertexSet] using haX) + obtain ⟨b, hqb⟩ := T.attaches q + have hbX := prior b + have hboundary : T.edge q ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨T.vertex (Fin.castLT b + (Nat.lt_trans b.isLt (Nat.succ_lt_succ q.isLt))), hbX, + T.vertex q.succ, hqout, ?_⟩ + rw [hqb] + exact Sym2.eq_swap + obtain ⟨Splus, hAdjoinPlus⟩ := + TreeSequenceBoundaryEdgeAppendExists S (T.edge q) hboundary + rcases hAdjoinPlus with ⟨hPlusLen, hSPlusInit, hPlusLast⟩ + have hPlusVertex (i : Fin (S.length + 1)) : + Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) i) = + S.vertex i := hSPlusInit.2.1 i + have hPlusEdge (j : Fin S.length) : + Splus.edge (Fin.castLE hSPlusInit.1 j) = S.edge j := + hSPlusInit.2.2 j + have hPlusTash : TashkinovTree G e0 phi Splus := by + exact @helper_hPlusTash_173 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T S N hS omitted hnlt hnlarge a gamma hqcolor hagamma s hsa Splus hPlusLen + hSPlusInit hPlusLast hPlusVertex hPlusEdge + have hgammaUsedT : gamma ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, by simp [q]; omega, hqcolor⟩ + have hSCard : (TreeSequenceVertexSet S).card = S.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + S.vertex_injective] + have hPlusCard : (TreeSequenceVertexSet Splus).card = S.length + 2 := by + rw [show (TreeSequenceVertexSet Splus).card = Splus.length + 1 by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + Splus.vertex_injective]] + omega + have hsGamma : gamma ∈ MissingColors G phi + (Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s)) := by + rw [hPlusVertex, hsa] + exact hagamma + have hElem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet Splus) := + TashTree G k e0 phi Splus htriple hPlusTash + let U := TreeSequenceVertexSet Splus + let z := Splus.vertex (Fin.castLE (Nat.succ_le_succ hSPlusInit.1) s) + have hzU : z ∈ U := by + simp [z, U, TreeSequenceVertexSet] + have hzMissing : gamma ∈ MissingColors G phi z := by + simpa [z] using hsGamma + have hzNotPresent : gamma ∉ PresentColors G phi z := by + simpa [MissingColors] using hzMissing + have hproper : IsProperEdgeColoring G phi := htriple.2.2.2.1 + have hpresent : ∀ v, v ∈ U → v ≠ z → + gamma ∈ PresentColors G phi v := by + intro v hv hvz + have hnmissing : gamma ∉ MissingColors G phi v := by + intro hm + have hd : Disjoint (MissingColors G phi v) (MissingColors G phi z) := + hElem (by simpa [U] using hv) (by simpa [U] using hzU) hvz + exact (Finset.disjoint_left.mp hd) hm hzMissing + simpa [MissingColors] using hnmissing + exact @helper_continuation_856 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T S N hS hmax omitted hnlt hnlarge gamma hqcolor s Splus hPlusLen hSPlusInit + hPlusLast hPlusVertex hPlusEdge hPlusTash hgammaUsedT hSCard hPlusCard hsGamma hzU + hzMissing hzNotPresent hproper hpresent +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideBalancedCandidateNormalTransport.lean b/LeanPool/GoldbergSeymour/ScheideBalancedCandidateNormalTransport.lean new file mode 100644 index 0000000000..f5caac5c12 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideBalancedCandidateNormalTransport.lean @@ -0,0 +1,230 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideBalancedCandidate + +/-! +# Scheide Balanced Candidate Normal Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideBalancedCandidateNormalTransport {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T S : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hS : ScheideBalancedCandidate N S) + (hvertices : TreeSequenceVertexSet S = TreeSequenceVertexSet T) : + ∃ N' : NormalGlobalMaximumTriple G k e0 phi S, + N'.height = N.height := by + classical + have Tpos : 1 ≤ T.length := T.positive + have Spos : 1 ≤ S.length := S.positive + have vertexCard : ∀ R : TreeSequence G e0, + (TreeSequenceVertexSet R).card = R.length + 1 := by + intro R + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + R.vertex_injective] + have lengthEq : S.length = T.length := by + have h := congrArg Finset.card hvertices + rw [vertexCard S, vertexCard T] at h + omega + have trunkData := hS.exactTrunk + rcases trunkData with ⟨trunkBound, trunkVertices, trunkEdges⟩ + have trunkLength : (NormalTripleTrunk N).length = N.height - 1 := by + rfl + have vertexEq : ∀ i : Fin N.height, + S.vertex ⟨i.val, by omega⟩ = + T.vertex (Fin.castLE N.height_upper i) := by + intro i + have hv := trunkVertices ⟨i.val, by omega⟩ + have htr := show (NormalTripleTrunk N).vertex + ⟨i.val, by omega⟩ = T.vertex (Fin.castLE N.height_upper i) by + unfold NormalTripleTrunk TreeSequencePrefix + rfl + simpa only [Fin.castLE] using hv.trans htr + have edgeEq : ∀ j : Fin S.length, 1 ≤ j.val → j.val + 2 ≤ N.height → + S.edge j = T.edge ⟨j.val, by omega⟩ := by + intro j hjlow hjhigh + let jj : Fin (NormalTripleTrunk N).length := ⟨j.val, by + rw [trunkLength] + omega⟩ + have he := trunkEdges jj + unfold NormalTripleTrunk TreeSequencePrefix at he + have hsidx : Fin.castLE trunkBound jj = j := by + apply Fin.ext + dsimp [Fin.castLE] + have htidx : (⟨j.val, by omega⟩ : Fin T.length) = + Fin.castLE (by rw [trunkLength]; omega) jj := by + apply Fin.ext + dsimp [Fin.castLE] + calc + S.edge j = S.edge (Fin.castLE trunkBound jj) := congrArg S.edge hsidx.symm + _ = (NormalTripleTrunk N).edge jj := he + _ = T.edge (Fin.castLE (by rw [trunkLength]; omega) jj) := by + unfold NormalTripleTrunk TreeSequencePrefix + rfl + _ = T.edge ⟨j.val, by omega⟩ := congrArg T.edge htidx.symm + have zeroEq : S.vertex ⟨0, Nat.zero_lt_succ S.length⟩ = + T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ := by + have hp := N.height_lower + simpa only [Fin.castLE] using vertexEq ⟨0, by omega⟩ + have oneEq : S.vertex ⟨1, Nat.lt_succ_iff.mpr Spos⟩ = + T.vertex ⟨1, Nat.lt_succ_iff.mpr Tpos⟩ := by + have hp := N.height_lower + simpa only [Fin.castLE] using vertexEq ⟨1, by omega⟩ + have lastEq : ∀ i : Fin N.height, + S.vertex ⟨i.val, by omega⟩ = T.vertex (Fin.castLE N.height_upper ⟨i.val, by omega⟩) := by + intro i + exact vertexEq ⟨i.val, by omega⟩ + have cardEq : (TreeSequenceVertexSet S).card = TashkinovOrder G := by + rw [hvertices] + exact N.global.2.2 + have pathTransport : + ∀ {u v u' v' : Sum V E} (p : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk u v), p.IsPath + → u = u' → v = v' → + ∃ q : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk u' v', q.IsPath ∧ q.length = p.length + ∧ q.support = p.support := by + intro u v u' v' p hp hu hv + cases hu + cases hv + exact ⟨p, hp, rfl, rfl⟩ + obtain ⟨transportedPath, transportedIsPath, transportedLength, + transportedSupport⟩ := pathTransport N.closingPath N.closingPath_isPath + (congrArg Sum.inl oneEq.symm) (congrArg Sum.inl zeroEq.symm) + have pathIs : + ((transportedPath : + (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk + (Sum.inl (S.vertex ⟨1, Nat.lt_succ_iff.mpr Spos⟩)) + (Sum.inl (S.vertex ⟨0, Nat.zero_lt_succ S.length⟩))).IsPath) := by + simpa only using transportedIsPath + have pathLength : + (transportedPath : + (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk + (Sum.inl (S.vertex ⟨1, Nat.lt_succ_iff.mpr Spos⟩)) + (Sum.inl (S.vertex ⟨0, Nat.zero_lt_succ S.length⟩))).length = + N.closingPath.length := by + simpa only using transportedLength + have pathSupport : + (transportedPath : + (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk + (Sum.inl (S.vertex ⟨1, Nat.lt_succ_iff.mpr Spos⟩)) + (Sum.inl (S.vertex ⟨0, Nat.zero_lt_succ S.length⟩))).support = + N.closingPath.support := by + simpa only using transportedSupport + let hnew : NormalGlobalMaximumTriple G k e0 phi S := by + refine + { global := ⟨N.global.1, hS.tashkinov, cardEq⟩ + height := N.height + height_lower := N.height_lower + height_upper := by + rw [lengthEq] + exact N.height_upper + alpha := N.alpha + beta := N.beta + alpha_missing := ?_ + beta_missing := ?_ + closingEdge := N.closingEdge + lastIndex := ⟨N.lastIndex.val, by + rw [lengthEq] + exact N.lastIndex.isLt⟩ + lastIndex_height := N.lastIndex_height + closing_ends := ?_ + closingPath := by simpa only using transportedPath + closingPath_isPath := ?_ + closingPath_length := ?_ + closingPath_vertices := ?_ + closingPath_edges := ?_ + trunk_edge_ends := ?_ } + · rw [zeroEq] + exact N.alpha_missing + · rw [oneEq] + exact N.beta_missing + · have hlastIndex : N.lastIndex.val < N.height := + Nat.lt_of_lt_of_eq (Nat.lt_succ_self _) N.lastIndex_height + have hlast := lastEq ⟨N.lastIndex.val, hlastIndex⟩ + rw [hlast, zeroEq] + exact N.closing_ends + · simpa only using pathIs + · rw [pathLength] + exact N.closingPath_length + · intro v + constructor + · intro hv + have hv' := (N.closingPath_vertices v).mp (by + rw [← pathSupport] + exact hv) + rcases hv' with ⟨i, hi⟩ + refine (show ∃ i : Fin N.height, v = S.vertex ⟨i.val, by omega⟩ from ?_) + refine ⟨i, hi.trans (vertexEq i).symm⟩ + · intro hv + have hv' : ∃ i : Fin N.height, + v = T.vertex (Fin.castLE N.height_upper i) := by + rcases hv with ⟨i, hi⟩ + exact ⟨i, hi.trans (vertexEq i)⟩ + rw [pathSupport] + exact (N.closingPath_vertices v).mpr hv' + · intro f + constructor + · intro hf + have hf' := (N.closingPath_edges f).mp (by + rw [← pathSupport] + exact hf) + rcases hf' with hclose | ⟨j, hj, hsj, hf⟩ + · exact Or.inl hclose + · right + refine ⟨⟨j.val, by omega⟩, hj, hsj, ?_⟩ + calc + f = T.edge j := hf + _ = S.edge ⟨j.val, by omega⟩ := (edgeEq ⟨j.val, by omega⟩ hj hsj).symm + · intro hf + rw [pathSupport] + apply (N.closingPath_edges f).mpr + rcases hf with hclose | ⟨j, hj, hsj, hf⟩ + · exact Or.inl hclose + · right + refine ⟨⟨j.val, by omega⟩, hj, hsj, ?_⟩ + calc + f = S.edge j := hf + _ = T.edge ⟨j.val, by omega⟩ := edgeEq j hj hsj + · intro j hj hsj + have he := N.trunk_edge_ends ⟨j.val, by omega⟩ hj hsj + calc + G.ends (S.edge j) = G.ends (T.edge ⟨j.val, by omega⟩) := + congrArg G.ends (edgeEq j hj hsj) + _ = s(S.vertex ⟨j.val, by omega⟩, S.vertex j.succ) := by + have hcur : S.vertex ⟨j.val, by omega⟩ = + T.vertex (Fin.castLE N.height_upper ⟨j.val, by omega⟩) := + vertexEq ⟨j.val, by omega⟩ + have hnext : S.vertex j.succ = + T.vertex ⟨j.val + 1, by omega⟩ := by + have hs : j.succ = (⟨j.val + 1, by omega⟩ : Fin (S.length + 1)) := by + apply Fin.ext + rfl + have ht : (⟨j.val + 1, by omega⟩ : Fin (T.length + 1)) = + Fin.castLE N.height_upper ⟨j.val + 1, by omega⟩ := by + apply Fin.ext + dsimp [Fin.castLE] + calc + S.vertex j.succ = S.vertex ⟨j.val + 1, by omega⟩ := congrArg S.vertex hs + _ = T.vertex (Fin.castLE N.height_upper ⟨j.val + 1, by omega⟩) := + vertexEq ⟨j.val + 1, by omega⟩ + _ = T.vertex ⟨j.val + 1, by omega⟩ := congrArg T.vertex ht.symm + rw [hcur, hnext] + convert he using 1; rfl + exact ⟨hnew, rfl⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideBalancedExists.lean b/LeanPool/GoldbergSeymour/ScheideBalancedExists.lean new file mode 100644 index 0000000000..e896c18b28 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideBalancedExists.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideBalancedFromMaxNormal + +/-! +# Scheide Balanced Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideBalancedExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) : + ∃ (e1 : E) (psi : PartialEdgeColoring E k) + (T' : TreeSequence G e1) + (N' : NormalGlobalMaximumTriple G k e1 psi T'), + BalancedGlobalMaximumTriple N' := by + classical + obtain ⟨alpha, beta, p, U, N0, ha, hb, hp, hc, hU, hα, hβ, hN⟩ := + ScheideNormalisation G k e0 phi T hglobal + have hmem : ScheideGraphHeight G ∈ + insert 0 ((Finset.range (Fintype.card V + 1)).filter fun q => + ∃ (m : ℕ) (f : E) (c : PartialEdgeColoring E m) + (S : TreeSequence G f), + ∃ M : NormalGlobalMaximumTriple G m f c S, M.height = q) := by + unfold ScheideGraphHeight + exact Finset.max'_mem _ _ + have hpos : ScheideGraphHeight G ≠ 0 := by + intro hz + have hcard : U.length + 1 ≤ Fintype.card V := by + simpa using Fintype.card_le_of_injective U.vertex U.vertex_injective + have hbound : N0.height ≤ U.length + 1 := N0.height_upper + have hle : N0.height ≤ ScheideGraphHeight G := by + unfold ScheideGraphHeight + apply Finset.le_max' + apply Finset.mem_insert_of_mem + apply Finset.mem_filter.mpr + constructor + · exact Finset.mem_range.mpr (by omega) + · exact ⟨k, e0, phi, U, N0, rfl⟩ + omega + rcases Finset.mem_insert.mp hmem with hzero | hnormal + · exact (hpos hzero).elim + obtain ⟨m, f, c, S, M, hM⟩ := (Finset.mem_filter.mp hnormal).2 + have hm : m = k := by + have hmχ := M.global.1.2.1 + have hkχ := hglobal.1.2.1 + omega + subst m + obtain ⟨S', M', hbal, hset, hcolors⟩ := + ScheideBalancedFromMaxNormal G k f c S M hM + exact ⟨f, c, S', M', hbal⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideBalancedFromMaxNormal.lean b/LeanPool/GoldbergSeymour/ScheideBalancedFromMaxNormal.lean new file mode 100644 index 0000000000..4589728dcb --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideBalancedFromMaxNormal.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple + +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder + +public import LeanPool.GoldbergSeymour.ScheideBalancedCandidateMaximumExists +public import LeanPool.GoldbergSeymour.ScheideBalancedCandidateMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideBalancedCandidateNormalTransport + +/-! +# Scheide Balanced From Max Normal + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideBalancedFromMaxNormal {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hheight : N.height = ScheideGraphHeight G) : + ∃ (T' : TreeSequence G e0) + (N' : NormalGlobalMaximumTriple G k e0 phi T'), + BalancedGlobalMaximumTriple N' ∧ + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + TreeUsedColors phi T' ⊆ TreeUsedColors phi T := by + classical + obtain ⟨S, hS, hmax⟩ := + ScheideBalancedCandidateMaximumExists G k e0 phi T N hheight + have horder : (TreeSequenceVertexSet S).card = TashkinovOrder G := + ScheideBalancedCandidateMaximumOrder G k e0 phi T S N hS hmax + have hfixed : FixedPairMaximalTashkinovTree G e0 phi T := + ScheideGlobalMaximumFixedPairMaximal G k e0 phi T N.global + have hsubset : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet T := + ScheideMaximalContainsEveryTree G k e0 phi T S N.global.1 hfixed + hS.tashkinov + have hcard : (TreeSequenceVertexSet T).card ≤ + (TreeSequenceVertexSet S).card := by + rw [N.global.2.2, horder] + have hvertices : TreeSequenceVertexSet S = TreeSequenceVertexSet T := + Finset.eq_of_subset_of_card_le hsubset hcard + obtain ⟨N', hN'⟩ := + ScheideBalancedCandidateNormalTransport G k e0 phi T S N hS hvertices + refine ⟨S, N', ?_, hvertices, hS.usedColors⟩ + constructor + · exact hN'.trans hheight + · intro j hlow hupp + exact hS.paired j (by simpa [hN'] using hlow) hupp + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveChainBoundaryEdges.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveChainBoundaryEdges.lean new file mode 100644 index 0000000000..9b00b59d33 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveChainBoundaryEdges.lean @@ -0,0 +1,693 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +public import LeanPool.GoldbergSeymour.TashkinovOrderBound + +/-! +# Scheide Defective Chain Boundary Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_present_eq_179.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k) (u + : V) (f : E), alpha ≠ gamma → + let Q : Set (V ⊕ E) := TwoColorComponent G phi alpha gamma (Sum.inr f); + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha gamma (Sum.inr f); + Sum.inl u ∉ Q → ( + ∀ (e : E), Sum.inr e ∈ Q → phi e = some alpha ∨ phi e = some gamma) → ( + ∀ (v : V) (e : E), Incident G v e → Sum.inr e ∈ Q → Sum.inl v ∈ Q) → ( + ∀ v ∈ TreeSequenceVertexSet T, alpha ∈ PresentColors G phi v) → ( + ∀ v ∈ TreeSequenceVertexSet T, v ≠ u → gamma ∈ PresentColors G phi v) → ( + ∀ (v : V) (e : E), Sum.inl v ∈ Q → Incident G v e → phi e = some alpha ∨ phi e = some gamma → + Sum.inr e ∈ Q) → + ∀ v ∈ TreeSequenceVertexSet T, PresentColors G psi v = PresentColors G phi v := by + classical + intro V E _ _ G k e0 phi T alpha gamma u f hne Q psi huQ qcolor qvertex halpha_present + hgamma_present qedge_of_vertex v hv + let _ := Fintype.ofFinite V + have vnot : Sum.inl v ∉ Q ∨ v ≠ u := by + by_cases hvq : Sum.inl v ∈ Q + · right + intro hvu + exact huQ (hvu ▸ hvq) + · exact Or.inl hvq + ext c + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + constructor + · rintro ⟨e, hev, hec⟩ + by_cases heq : Sum.inr e ∈ Q + · have hce : phi e = some alpha ∨ phi e = some gamma := qcolor e heq + rcases hce with hca | hcg + · have hvne : v ≠ u := by + intro hvu + exact huQ (hvu ▸ qvertex v e hev heq) + have hgp : gamma ∈ PresentColors G phi v := + hgamma_present v hv hvne + obtain ⟨g, hgv, hgc⟩ := by simpa [PresentColors] using hgp + have hc : c = gamma := by + apply Option.some.inj + simpa [psi, Q, TwoColorComponentSwap, heq, hca, hne, hne.symm] using hec.symm + subst c + refine ⟨g, hgv, ?_⟩ + have hgq := qedge_of_vertex v g (qvertex v e hev heq) hgv (Or.inr hgc) + simp [hgc] + · have hap := halpha_present v hv + obtain ⟨a, hav, hac⟩ := by simpa [PresentColors] using hap + have hc : c = alpha := by + apply Option.some.inj + simpa [psi, Q, TwoColorComponentSwap, heq, hcg, hne, hne.symm] using hec.symm + subst c + refine ⟨a, hav, ?_⟩ + have haq := qedge_of_vertex v a (qvertex v e hev heq) hav (Or.inl hac) + simp [hac] + · refine ⟨e, hev, ?_⟩ + simpa [psi, Q, TwoColorComponentSwap, heq] using hec + · rintro ⟨e, hev, hec⟩ + by_cases heq : Sum.inr e ∈ Q + · have hce : phi e = some alpha ∨ phi e = some gamma := qcolor e heq + rcases hce with hca | hcg + · have hvne : v ≠ u := by + intro hvu + exact huQ (hvu ▸ qvertex v e hev heq) + have hgp := hgamma_present v hv hvne + obtain ⟨g, hgv, hgc⟩ := by simpa [PresentColors] using hgp + have hc : c = alpha := Option.some.inj (hec.symm.trans hca) + subst c + refine ⟨g, hgv, ?_⟩ + have hgq : Sum.inr g ∈ Q := + qedge_of_vertex v g (qvertex v e hev heq) hgv (Or.inr hgc) + simp [hgq, psi, Q, TwoColorComponentSwap, hgc] + · have hap := halpha_present v hv + obtain ⟨a, hav, hac⟩ := by simpa [PresentColors] using hap + have hc : c = gamma := Option.some.inj (hec.symm.trans hcg) + subst c + refine ⟨a, hav, ?_⟩ + have haq := qedge_of_vertex v a (qvertex v e hev heq) hav (Or.inl hac) + simp [haq, psi, Q, TwoColorComponentSwap, hac] + · refine ⟨e, hev, ?_⟩ + simpa [psi, Q, TwoColorComponentSwap, heq] using hec + +private theorem helper_huQ_190.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k) (u z : + V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p → + ∀ (f : E), Sum.inr f ∉ p.support → + let Q : Set (V ⊕ E) := TwoColorComponent G phi alpha gamma (Sum.inr f); Sum.inl u ∉ Q := by + classical + intro V E _ _ G k e0 phi T alpha gamma u z p hp f hnot Q huq + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + have huf : Sum.inl u ∈ TwoColorComponent G phi alpha gamma (Sum.inr f) := huq + have huf' : Sum.inr f ∈ TwoColorComponent G phi alpha gamma (Sum.inl u) := by + change (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk + (Sum.inr f) = (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk + (Sum.inl u) + exact huf.symm + have hps : Sum.inr f ∈ p.support := by + have hh : Sum.inr f ∈ {x | x ∈ p.support} := by + rw [hp.2.2.2] + exact huf' + exact hh + exact hnot hps + +private theorem helper_qcolor_204.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k) (f + : E), f ∈ BoundaryEdges G (TreeSequenceVertexSet T) ∧ phi f = some alpha → + let Q : Set (V ⊕ E) := TwoColorComponent G phi alpha gamma (Sum.inr f); + ∀ (e : E), Sum.inr e ∈ Q → phi e = some alpha ∨ phi e = some gamma := by + classical + intro V E _ _ G k e0 phi T alpha gamma f h Q e he + by_cases hef : e = f + · exact Or.inl (by simpa [hef] using h.2) + · have hs : Sum.inr e ∈ + (TwoColorIncidenceGraph G phi alpha gamma).support := by + apply SimpleGraph.mem_support_of_reachable + · intro hh + apply hef + exact Sum.inr.inj hh + · change (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk + (Sum.inr e) = (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk + (Sum.inr f) at he + exact SimpleGraph.ConnectedComponent.eq.mp he + obtain ⟨w, hw⟩ := (TwoColorIncidenceGraph G phi alpha gamma).mem_support.mp hs + cases w with + | inl v => exact hw.2 + | inr e' => simp [TwoColorIncidenceGraph] at hw + +private theorem helper_one_psi_274.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (alpha gamma : Fin k) (f : E), alpha ≠ gamma → + let Q : Set (V ⊕ E) := TwoColorComponent G phi alpha gamma (Sum.inr f); + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha gamma (Sum.inr f); ( + ∀ (e : E), Sum.inr e ∈ Q → phi e = some alpha ∨ phi e = some gamma) → IsOneEdgeUncolored phi + e0 → Sum.inr e0 ∉ Q → IsOneEdgeUncolored psi e0 := by + classical + intro V E G k e0 phi alpha gamma f hne Q psi qcolor one e0not + refine ⟨?_, ?_⟩ + · simpa [psi, Q, TwoColorComponentSwap, e0not] using one.1 + · intro e he + obtain ⟨c, hc⟩ := one.2 e he + by_cases hqe : Sum.inr e ∈ Q + · rcases qcolor e hqe with hα | hγ + · refine ⟨gamma, ?_⟩ + simp [psi, Q, TwoColorComponentSwap, hqe, hα] + · refine ⟨alpha, ?_⟩ + simp [psi, Q, TwoColorComponentSwap, hqe, hγ, hne.symm] + · refine ⟨c, ?_⟩ + simpa [psi, Q, TwoColorComponentSwap, hqe] using hc + +private theorem helper_tree_fixed_287.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k), + alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T) → gamma ∈ TreeFreeColors phi T → + Disjoint (DefectiveColors G phi (TreeSequenceVertexSet T)) (TreeUsedColors phi T) ∧ + Disjoint (TreeFreeColors phi T) (TreeUsedColors phi T) → + ∀ (f : E), + let Q : Set (V ⊕ E) := TwoColorComponent G phi alpha gamma (Sum.inr f); + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha gamma (Sum.inr f); ( + ∀ (e : E), Sum.inr e ∈ Q → phi e = some alpha ∨ phi e = some gamma) → IsOneEdgeUncolored phi + e0 → Sum.inr e0 ∉ Q → + ∀ (j : Fin T.length), psi (T.edge j) = phi (T.edge j) := by + classical + intro V E _ _ G k e0 phi T alpha gamma halpha hgammaFree hunused f Q psi qcolor one e0not j + by_cases hj : j.val = 0 + · have hje : j = ⟨0, T.positive⟩ := by apply Fin.ext; exact hj + subst j + rw [T.first_edge] + simp [one.1, e0not, psi, Q, TwoColorComponentSwap] + · by_cases hqe : Sum.inr (T.edge j) ∈ Q + · rcases qcolor (T.edge j) hqe with hα | hγ + · have hused : alpha ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨j, by omega, hα⟩ + exact False.elim ((Finset.disjoint_left.mp hunused.1 halpha) hused) + · have hused : gamma ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨j, by omega, hγ⟩ + exact False.elim ((Finset.disjoint_left.mp hunused.2 hgammaFree) hused) + · simp [psi, Q, TwoColorComponentSwap, hqe] + +private theorem helper_qvertex_297.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (phi : + PartialEdgeColoring E k) (alpha gamma : Fin k) (f : E), + let Q : Set (V ⊕ E) := TwoColorComponent G phi alpha gamma (Sum.inr f); ( + ∀ (e : E), Sum.inr e ∈ Q → phi e = some alpha ∨ phi e = some gamma) → + ∀ (v : V) (e : E), Incident G v e → Sum.inr e ∈ Q → Sum.inl v ∈ Q := by + classical + intro V E G k phi alpha gamma f Q qcolor v e hev he + have hc := qcolor e he + have hadj : (TwoColorIncidenceGraph G phi alpha gamma).Adj + (Sum.inl v) (Sum.inr e) := by + simp [TwoColorIncidenceGraph, hev, hc] + change (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk + (Sum.inl v) = (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk + (Sum.inr f) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans he + +private theorem helper_hgamma_present_318.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (gamma : Fin k), + ∀ u ∈ TreeSequenceVertexSet T, gamma ∈ MissingColors G phi u → TashkinovOrder G = + (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd + (TreeSequenceVertexSet T).card ∧ ColoredVertexSetElementary G phi (TreeSequenceVertexSet + T) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) → + ∀ v ∈ TreeSequenceVertexSet T, v ≠ u → gamma ∈ PresentColors G phi v := by + classical + intro V E _ _ _ G k e0 phi T gamma u hu hgamma horder v hv hnevu + have helem := horder.2.2.2.1 hu hv hnevu.symm + have hn : gamma ∉ MissingColors G phi v := by + intro hm + exact Finset.disjoint_left.mp helem hgamma hm + simpa [MissingColors] using hn + +private theorem helper_qedge_of_vertex_326.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (phi : + PartialEdgeColoring E k) (alpha gamma : Fin k) (f : E), + let Q : Set (V ⊕ E) := TwoColorComponent G phi alpha gamma (Sum.inr f); + ∀ (v : V) (e : E), Sum.inl v ∈ Q → Incident G v e → phi e = some alpha ∨ phi e = some gamma → + Sum.inr e ∈ Q := by + classical + intro V E G k phi alpha gamma f Q v e hv hev hc + change (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk + (Sum.inr e) = (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk + (Sum.inr f) + apply (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj ?_).trans hv + simp [TwoColorIncidenceGraph, hev, hc] + +private theorem helper_fnew_362.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (e0 : E) (T + : TreeSequence G e0) (f : E) (x y : V), y ∉ TreeSequenceVertexSet T → G.ends f = s(x, y) → + ( + ∀ (i : Fin (T.length + (1 : ℕ))), T.vertex i ∈ TreeSequenceVertexSet T) → + ∀ (j : Fin T.length), f ≠ T.edge j := by + classical + intro V E _ _ G e0 T f x y hy hends vertex_mem j heq + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨i, hi⟩ := T.attaches j + have hyend : y ∈ G.ends (T.edge j) := by + rw [← heq, hends] + exact Sym2.mem_iff.mpr (Or.inr rfl) + rw [hi] at hyend + rcases Sym2.mem_iff.mp hyend with hvv | hvv + · exact hy (hvv ▸ vertex_mem j.succ) + · exact hy (hvv ▸ vertex_mem (Fin.castLT i (by omega))) + +private theorem helper_first_edge_499.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] + (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) (f : E), + Fin.lastCases f (fun (i : Fin T.length) ↦ T.edge i) + (⟨(0 : ℕ), by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + e0 := by + classical + intro V E _ _ G e0 T f + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + have hz : (⟨0, Nat.succ_pos _⟩ : Fin (T.length + 1)) = + (⟨0, T.positive⟩ : Fin T.length).castSucc := by rfl + rw [hz] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + exact T.first_edge + +private noncomputable abbrev helperTplus474.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + (G : LooplessMultigraph V E) → + (e0 : E) → + (T : TreeSequence G e0) → + (f : E) → + (x : V) → + (hx : x ∈ TreeSequenceVertexSet T) → + (y : V) → + (hy : y ∉ TreeSequenceVertexSet T) → + (hends : G.ends f = s(x, y)) → + (vertex_mem : + ∀ (i : Fin (T.length + (1 : ℕ))), + T.vertex i ∈ TreeSequenceVertexSet T) → + (fnew : ∀ (j : Fin T.length), f ≠ T.edge j) → + TreeSequence G e0 := by + classical + intro V E _ _ G e0 T f x hx y hy hends vertex_mem fnew + exact { + length := T.length + 1 + positive := by omega + vertex := Fin.lastCases y (fun i => T.vertex i) + edge := Fin.lastCases f (fun i => T.edge i) + vertex_injective := by + intro i j + revert j + refine Fin.lastCases ?_ (fun i => ?_) i + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij; rfl + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at hij + exact (hy (hij ▸ vertex_mem j)).elim + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_last] at hij + exact (hy (hij ▸ vertex_mem i)).elim + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_castSucc] at hij + exact congrArg Fin.castSucc (T.vertex_injective hij) + edge_injective := by + intro i j + revert j + refine Fin.lastCases ?_ (fun i => ?_) i + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij; rfl + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at hij + exact (fnew j hij).elim + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_last] at hij + exact (fnew i hij.symm).elim + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_castSucc] at hij + exact congrArg Fin.castSucc (T.edge_injective hij) + first_edge := by + exact @helper_first_edge_499 (@V) (@E) inferInstance inferInstance (@G) (@e0) + (@T) (@f) + attaches := by + intro j + by_cases hj : j = Fin.last T.length + · subst j + obtain ⟨i, hi⟩ := by simpa [TreeSequenceVertexSet] using hx + refine ⟨i, ?_⟩ + have hc : (Fin.castLT i (by omega) : Fin (T.length + 1 + 1)) = i.castSucc := by + apply Fin.ext; rfl + rw [hc] + simp only [Fin.lastCases, Fin.reverseInduction_last, Fin.succ_last, Nat.succ_eq_add_one, + Fin.reverseInduction_castSucc] + rw [hends, ← hi] + exact (Sym2.eq_iff).2 (Or.inr ⟨rfl, rfl⟩) + · have hjle : j.val ≤ T.length := Nat.lt_succ_iff.mp j.isLt + have hjne : j.val ≠ T.length := by + intro heq; apply hj; apply Fin.ext; simpa using heq + have hj' : j.val < T.length := Nat.lt_of_le_of_ne hjle hjne + obtain ⟨i, hi⟩ := T.attaches (j.castPred hj) + have hjform : j = (j.castPred hj).castSucc := by apply Fin.ext; rfl + have hji : (j.castPred hj).val + 1 ≤ j.val + 1 := by + rw [show (j.castPred hj).val = j.val by rfl] + refine ⟨Fin.castLE hji i, ?_⟩ + convert hi using 1 + · apply congrArg G.ends + conv_lhs => rw [hjform] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + · apply (Sym2.eq_iff).2 + left + constructor + · have hjs : j.succ = (j.castPred hj).succ.castSucc := by apply Fin.ext; rfl + rw [hjs] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + · have hi' : i.val < T.length + 1 := by omega + have hq : (Fin.castLE hji i).castLT (by omega) = + (i.castLT hi').castSucc := by apply Fin.ext; rfl + rw [hq] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] } + +private theorem helper_branch_75.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), GlobalMaximumTriple G k e0 phi T → + ∀ (alpha gamma : Fin k), alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T) → gamma ∈ + TreeFreeColors phi T → + ∀ u ∈ TreeSequenceVertexSet T, gamma ∈ MissingColors G phi u → + ∀ (z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p → TashkinovOrder G = + (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd + (TreeSequenceVertexSet T).card ∧ ColoredVertexSetElementary G phi (TreeSequenceVertexSet + T) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) → ((DefectiveColors G phi + (TreeSequenceVertexSet T) = ∅ → ColoredVertexSetStronglyClosed G phi + (TreeSequenceVertexSet T)) ∧ ( + ∀ alpha ∈ TreeMissingColors phi T, BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha = + ∅) ∧ + ∀ alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T), Odd (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card ∧ (3 : ℕ) ≤ (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card) → Disjoint (DefectiveColors G phi + (TreeSequenceVertexSet T)) (TreeUsedColors phi T) ∧ Disjoint (TreeFreeColors phi T) + (TreeUsedColors phi T) → + ∀ (f : E), f ∈ BoundaryEdges G (TreeSequenceVertexSet T) ∧ phi f = some alpha → f ∈ + BoundaryEdges G (TreeSequenceVertexSet T) ∧ Sum.inr f ∈ p.support := by + classical + intro V E _ _ _ G k e0 phi T hglobal alpha gamma halpha hgammaFree u hu hgamma z p hp horder + hfacts hunused f h + refine ⟨h.1, ?_⟩ + by_contra hnot + have htreegamma : gamma ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨u, hu, hgamma⟩ + have hgammaempty := hfacts.2.1 gamma htreegamma + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + horder.2.2.2.2 + have hne : alpha ≠ gamma := by + intro heq + have ha : alpha ∉ MissingColors G phi u := by + exact hclosed h.1 hu h.2 + exact ha (heq ▸ hgamma) + let Q := TwoColorComponent G phi alpha gamma (Sum.inr f) + let psi := TwoColorComponentSwap G phi alpha gamma (Sum.inr f) + have hfQ : Sum.inr f ∈ Q := by + change (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk + (Sum.inr f) = (TwoColorIncidenceGraph G phi alpha gamma).connectedComponentMk + (Sum.inr f) + rfl + have huQ : Sum.inl u ∉ Q := by + exact @helper_huQ_190 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + (@alpha) (@gamma) (@u) (@z) (@p) (@hp) (@f) (@hnot) + have qcolor : ∀ e, Sum.inr e ∈ Q → + phi e = some alpha ∨ phi e = some gamma := by + exact @helper_qcolor_204 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + (@alpha) (@gamma) (@f) (@h) + have qvertex : ∀ v e, Incident G v e → Sum.inr e ∈ Q → + Sum.inl v ∈ Q := by + exact @helper_qvertex_297 (@V) (@E) (@G) (@k) (@phi) (@alpha) (@gamma) (@f) (@qcolor) + have qedge_not : ∀ v e, Incident G v e → Sum.inl v ∉ Q → + Sum.inr e ∉ Q := by + intro v e hev hv he + exact hv (qvertex v e hev he) + have halpha_present : ∀ v, v ∈ TreeSequenceVertexSet T → + alpha ∈ PresentColors G phi v := by + intro v hv + have hn : alpha ∉ MissingColors G phi v := by + exact hclosed h.1 hv h.2 + simpa [MissingColors] using hn + have hgamma_present : ∀ v, v ∈ TreeSequenceVertexSet T → v ≠ u → + gamma ∈ PresentColors G phi v := by + exact @helper_hgamma_present_318 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@gamma) (@u) (@hu) (@hgamma) (@horder) + have qedge_of_vertex : ∀ v e, Sum.inl v ∈ Q → Incident G v e → + (phi e = some alpha ∨ phi e = some gamma) → Sum.inr e ∈ Q := by + exact @helper_qedge_of_vertex_326 (@V) (@E) (@G) (@k) (@phi) (@alpha) (@gamma) (@f) + have present_eq : ∀ v, v ∈ TreeSequenceVertexSet T → + PresentColors G psi v = PresentColors G phi v := by + exact @helper_present_eq_179 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) + (@T) (@alpha) (@gamma) (@u) (@f) (@hne) (@huQ) (@qcolor) (@qvertex) (@halpha_present) + (@hgamma_present) (@qedge_of_vertex) + have missing_eq : ∀ v, v ∈ TreeSequenceVertexSet T → + MissingColors G psi v = MissingColors G phi v := by + intro v hv + simp [MissingColors, present_eq v hv] + have proper_psi : IsProperEdgeColoring G psi := by + exact TwoColorComponentSwapProper G phi alpha gamma hne + hglobal.1.2.2.2.1 (Sum.inr f) + have one : IsOneEdgeUncolored phi e0 := hglobal.1.2.2.2.2 + have e0not : Sum.inr e0 ∉ Q := by + intro he + rcases qcolor e0 he with hc | hc <;> simp [one.1] at hc + have one_psi : IsOneEdgeUncolored psi e0 := by + exact @helper_one_psi_274 (@V) (@E) (@G) (@k) (@e0) (@phi) (@alpha) (@gamma) (@f) (@hne) + (@qcolor) (@one) (@e0not) + have tree_fixed : ∀ j : Fin T.length, psi (T.edge j) = phi (T.edge j) := by + exact @helper_tree_fixed_287 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) + (@T) (@alpha) (@gamma) (@halpha) (@hgammaFree) (@hunused) (@f) (@qcolor) (@one) (@e0not) + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using h.1 + have vertex_mem : ∀ i : Fin (T.length + 1), + T.vertex i ∈ TreeSequenceVertexSet T := by + intro i + simp [TreeSequenceVertexSet] + have fnew : ∀ j : Fin T.length, f ≠ T.edge j := by + exact @helper_fnew_362 (@V) (@E) inferInstance inferInstance (@G) (@e0) (@T) + (@f) (@x) (@y) (@hy) (@hends) (@vertex_mem) + let Tplus : TreeSequence G e0 := by + exact @helperTplus474 (@V) (@E) inferInstance inferInstance (@G) (@e0) (@T) + (@f) (@x) (@hx) (@y) (@hy) (@hends) (@vertex_mem) (@fnew) + have hTash : TashkinovTree G e0 psi Tplus := by + intro j + revert j + refine Fin.lastCases ?_ (fun q => ?_) + · intro hj + obtain ⟨i, hi⟩ := by simpa [TreeSequenceVertexSet] using hu + have hi_lt := i.isLt + refine ⟨i, ?_⟩ + refine ⟨gamma, ?_, ?_⟩ + · simp [Tplus, psi, Q, TwoColorComponentSwap, hfQ, h.2] + · have hiold : i.val < T.length + 1 := by omega + have hb : i.val < T.length + 1 + 1 := by omega + have hii : Tplus.vertex (Fin.castLT i hb) = + T.vertex (i.castLT hiold) := by + have heq : (Fin.castLT i hb : Fin (T.length + 1 + 1)) = + (i.castLT hiold).castSucc := by apply Fin.ext; rfl + rw [heq] + simp [Tplus] + have hmu : MissingColors G psi + (Tplus.vertex (Fin.castLT i hb)) = + MissingColors G phi u := by + rw [hii] + rw [missing_eq _ (by simp [TreeSequenceVertexSet])] + exact congrArg (MissingColors G phi) hi + exact hmu.symm ▸ hgamma + · intro hj + have hqbound : q.val < T.length := by simp [] + have hq : 1 ≤ q.val := by + simpa [Fin.lastCases] using hj + obtain ⟨i, c, hc, hcm⟩ := hglobal.2.1 q hq + refine ⟨i, c, ?_, ?_⟩ + · simpa [Tplus, Fin.lastCases, Fin.reverseInduction_castSucc] using + (tree_fixed q ▸ hc) + · have hiX : T.vertex (i.castLT (by omega)) ∈ TreeSequenceVertexSet T := by + have hi_lt := i.isLt + simp [TreeSequenceVertexSet] + have hmi := missing_eq _ hiX + have hiold : i.val < T.length + 1 := by omega + have hb : i.val < T.length + 1 + 1 := by omega + have hiv : Tplus.vertex (Fin.castLT i hb) = + T.vertex (i.castLT hiold) := by + have heq : (Fin.castLT i hb : Fin (T.length + 1 + 1)) = + (i.castLT hiold).castSucc := by apply Fin.ext; rfl + rw [heq] + simp [Tplus] + rw [hiv, hmi] + exact hcm + have hK : KTriple G k e0 psi := by + refine ⟨hglobal.1.1, hglobal.1.2.1, hglobal.1.2.2.1, proper_psi, one_psi⟩ + have hsizeplus : (TreeSequenceVertexSet Tplus).card = Tplus.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + Tplus.vertex_injective] + have hle := treeCard_le_tashkinovOrder G k e0 psi Tplus hK hTash + rw [hsizeplus] at hle + rw [horder.1] at hle + have hsizeold : (TreeSequenceVertexSet T).card = T.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, T.vertex_injective] + have hlen : Tplus.length = T.length + 1 := rfl + exact False.elim (by omega) + +private theorem helper_branch_436.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k), + ∀ u ∈ TreeSequenceVertexSet T, gamma ∈ MissingColors G phi u → + ∀ (z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ((DefectiveColors G phi (TreeSequenceVertexSet T) = ∅ → ColoredVertexSetStronglyClosed G + phi (TreeSequenceVertexSet T)) ∧ ( + ∀ alpha ∈ TreeMissingColors phi T, BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha = + ∅) ∧ + ∀ alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T), Odd (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card ∧ (3 : ℕ) ≤ (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card) → + ∀ (f : E), f ∈ BoundaryEdges G (TreeSequenceVertexSet T) ∧ Sum.inr f ∈ p.support → f ∈ + BoundaryEdges G (TreeSequenceVertexSet T) ∧ phi f = some alpha := by + classical + intro V E _ _ G k e0 phi T alpha gamma u hu hgamma z p hfacts f h + have left_7 : f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := h.1 + have right_3 : Sum.inr f ∈ p.support := h.2 + have htreegamma : gamma ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨u, hu, hgamma⟩ + have hgammaempty := hfacts.2.1 gamma htreegamma + have hnalpha : phi f = some alpha ∨ phi f = some gamma := by + obtain ⟨n, hn, hnl⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp right_3 + have hn0 : 0 < n := by + by_contra hh + have he : n = 0 := by omega + subst he + simp at hn + have hnlast : n < p.length := by + by_contra hh + have he := p.getVert_of_length_le (i := n) (by omega) + rw [hn] at he + simp at he + have hadj := p.adj_getVert_succ (i := n - 1) (by omega) + have hidx : n - 1 + 1 = n := by omega + rw [hidx, hn] at hadj + cases hprev : p.getVert (n - 1) with + | inl v => + rw [hprev] at hadj + simp only [TwoColorIncidenceGraph] at hadj + exact hadj.2 + | inr e => + rw [hprev] at hadj + simp [TwoColorIncidenceGraph] at hadj + rcases hnalpha with hfa | hfg + · exact ⟨left_7, hfa⟩ + · exfalso + have hbad : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) gamma := by + simpa [BoundaryColorEdges] using (show + f ∈ BoundaryEdges G (TreeSequenceVertexSet T) ∧ phi f = some gamma + from ⟨left_7, hfg⟩) + rw [hgammaempty] at hbad + simp at hbad + +theorem ScheideDefectiveChainBoundaryEdges {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) + (alpha gamma : Fin k) + (halpha : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T)) + (hgammaFree : gamma ∈ TreeFreeColors phi T) + (u : V) (hu : u ∈ TreeSequenceVertexSet T) + (hgamma : gamma ∈ MissingColors G phi u) + (z : V) + (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk + (Sum.inl u) (Sum.inl z)) + (hp : ScheideDefectiveChainPath T phi alpha gamma u z p) : + ∀ f : E, f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha ↔ f ∈ BoundaryEdges G + (TreeSequenceVertexSet T) ∧ Sum.inr f ∈ p.support := by + classical + have horder := ScheideGlobalMaximumOrder G k e0 phi T hglobal + have hfacts := ScheideGlobalMaximumBoundaryFacts G k e0 phi T hglobal + have hunused := ScheideGlobalMaximumUnused G k e0 phi T hglobal + intro f + simp only [BoundaryColorEdges, Finset.mem_filter] + constructor + · exact @helper_branch_75 V E inferInstance inferInstance inferInstance G k e0 + phi T hglobal alpha gamma halpha hgammaFree u hu hgamma z p hp horder hfacts hunused f + · exact @helper_branch_436 V E inferInstance inferInstance G k e0 phi T alpha + gamma u hu hgamma z p hfacts f +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveChainDepartureReturn.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveChainDepartureReturn.lean new file mode 100644 index 0000000000..32acb3fda3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveChainDepartureReturn.lean @@ -0,0 +1,363 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges +public import LeanPool.GoldbergSeymour.ScheideDepartureReturn + +/-! +# Scheide Defective Chain Departure Return + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_edge_has_neighbor_89.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k) (u + z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + p.IsPath → + let X : Finset V := TreeSequenceVertexSet T; + let B : Finset E := BoundaryColorEdges G phi X alpha; + ∀ (_ : E) (_ _ _ : ℕ), + ∀ f ∈ B, + ∀ n ≤ p.length, p.getVert n = Sum.inr f → + ∃ (j : ℕ) (v : V), j ≤ p.length ∧ (j + (1 : ℕ) = n ∨ n + (1 : ℕ) = j) ∧ p.getVert j = Sum.inl + v ∧ v ∈ X := by + classical + intro V E _ _ G k e0 phi T alpha gamma u z p hpath X B f1 n1 n2 n3 f hf n hnl he + have hn0 : 0 < n := by + by_contra hn + have : n = 0 := Nat.eq_zero_of_le_zero (Nat.le_of_not_gt hn) + subst this + simp at he + have hnlast : n < p.length := by + by_contra h + have heq := p.getVert_of_length_le (i := n) (by omega) + rw [he] at heq + simp at heq + have hleft := p.adj_getVert_succ (i := n - 1) (by omega) + have hright := p.adj_getVert_succ (i := n) (by omega) + have hfboundary : f ∈ BoundaryEdges G X := by + have hfboth : f ∈ BoundaryEdges G X ∧ phi f = some alpha := by + simpa [B, BoundaryColorEdges] using hf + exact hfboth.1 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hfboundary + rcases hfboundary with ⟨a, ha, b, hb, hends⟩ + have hleft' : (TwoColorIncidenceGraph G phi alpha gamma).Adj + (p.getVert (n - 1)) (p.getVert n) := by + have hindex : n - 1 + 1 = n := by omega + simpa [hindex] using hleft + rw [he] at hleft' hright + cases hl : p.getVert (n - 1) with + | inl vl => + cases hr : p.getVert (n + 1) with + | inl vr => + rw [hl] at hleft' + rw [hr] at hright + simp only [TwoColorIncidenceGraph] at hleft' + simp only [TwoColorIncidenceGraph] at hright + simp only [Incident] at hleft' hright + rw [hends] at hleft' hright + simp only [Sym2.mem_iff] at hleft' hright + by_cases hvl : vl ∈ X + · exact ⟨n - 1, vl, by omega, by omega, hl, hvl⟩ + by_cases hvr : vr ∈ X + · exact ⟨n + 1, vr, by omega, by omega, hr, hvr⟩ + rcases hleft' with hleft' | hleft' <;> + rcases hright.1 with hright' | hright' <;> + simp_all + all_goals + have heqpath : n - 1 = n + 1 := hpath.getVert_injOn + (by simp; omega) (by simp; omega) (by simp [hl, hr]) + omega + | inr er => + rw [hr] at hright + exfalso + simp [TwoColorIncidenceGraph] at hright + | inr el => + rw [hl] at hleft' + exfalso + simp [TwoColorIncidenceGraph] at hleft' + +private theorem helper_edge_before_146.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (alpha gamma : Fin k) (u z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk + (Sum.inl u) (Sum.inl z)), p.IsPath → + let X : Finset V := TreeSequenceVertexSet T; + let outside : Finset (Fin (p.length + (1 : ℕ))) := ({i : Fin (p.length + (1 : ℕ)) | + ∃ (v : V), p.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ X} : Finset (Fin (p.length + (1 : ℕ)))); + ∀ (hout : Fin.last p.length ∈ outside), + let i1 : Fin (p.length + (1 : ℕ)) := outside.min' (Exists.intro (Fin.last p.length) hout); ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) < (↑i1 : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∈ X) → + let B : Finset E := BoundaryColorEdges G phi X alpha; + ∀ (_ : E) (_ _ _ : ℕ), + ∀ f ∈ B, + ∀ n ≤ p.length, p.getVert n = Sum.inr f → n < (↑i1 : ℕ) → n + (1 : ℕ) = (↑i1 : ℕ) := by + classical + intro V E _ _ _ G k e0 phi T alpha gamma u z p hpath X outside hout i1 hbefore B f1 n1 n2 n3 f + hf n hnl he hnfirst + have hn0 : 0 < n := by + by_contra hn + have heq : n = 0 := by omega + subst heq + simp at he + have hnlast : n < p.length := by + by_contra h + have heq := p.getVert_of_length_le (i := n) (by omega) + rw [he] at heq + simp at heq + have hleft := p.adj_getVert_succ (i := n - 1) (by omega) + have hright := p.adj_getVert_succ (i := n) (by omega) + have hleft' : (TwoColorIncidenceGraph G phi alpha gamma).Adj + (p.getVert (n - 1)) (p.getVert n) := by + have hindex : n - 1 + 1 = n := by omega + simpa [hindex] using hleft + rw [he] at hleft' hright + have hfboundary : f ∈ BoundaryEdges G X := by + have hfboth : f ∈ BoundaryEdges G X ∧ phi f = some alpha := by + simpa [B, BoundaryColorEdges] using hf + exact hfboth.1 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hfboundary + rcases hfboundary with ⟨a, ha, b, hb, hends⟩ + cases hl : p.getVert (n - 1) with + | inl vl => + cases hr : p.getVert (n + 1) with + | inl vr => + rw [hl] at hleft' + rw [hr] at hright + simp only [TwoColorIncidenceGraph, Incident] at hleft' hright + rw [hends] at hleft' hright + simp only [Sym2.mem_iff] at hleft' hright + by_cases heq : n + 1 = i1.val + · exact heq + have hvlX : vl ∈ X := by + apply hbefore ⟨n - 1, by omega⟩ (by omega : n - 1 < i1.val) + exact hl + have hvrX : vr ∈ X := by + apply hbefore ⟨n + 1, by omega⟩ (by omega : n + 1 < i1.val) + exact hr + rcases hleft' with hleft' | hleft' <;> + rcases hright.1 with hright' | hright' <;> + simp_all + all_goals + have heqpath : n - 1 = n + 1 := hpath.getVert_injOn + (by simp; omega) (by simp; omega) (by simp [hl, hr]) + omega + | inr er => + rw [hr] at hright + simp [TwoColorIncidenceGraph] at hright + | inr el => + rw [hl] at hleft' + simp [TwoColorIncidenceGraph] at hleft' + +private theorem helper_hlater_214.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (alpha gamma : Fin k) (u z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk + (Sum.inl u) (Sum.inl z)), + let X : Finset V := TreeSequenceVertexSet T; + let outside : Finset (Fin (p.length + (1 : ℕ))) := ({i : Fin (p.length + (1 : ℕ)) | + ∃ (v : V), p.getVert (↑i : ℕ) = Sum.inl v ∧ v ∉ X} : Finset (Fin (p.length + (1 : ℕ)))); + ∀ (hout : Fin.last p.length ∈ outside), + let i1 : Fin (p.length + (1 : ℕ)) := outside.min' (Exists.intro (Fin.last p.length) hout); + ∀ (v1 : V), p.getVert (↑i1 : ℕ) = Sum.inl v1 → + let B : Finset E := BoundaryColorEdges G phi X alpha; + ∀ f1 ∈ B, + ∀ f2 ∈ B, + ∀ f3 ∈ B.erase f1, + ∀ n1 ≤ p.length, p.getVert n1 = Sum.inr f1 → + ∀ n2 ≤ p.length, p.getVert n2 = Sum.inr f2 → + ∀ n3 ≤ p.length, p.getVert n3 = Sum.inr f3 → ( + ∀ f ∈ B, + ∀ n ≤ p.length, p.getVert n = Sum.inr f → n < (↑i1 : ℕ) → n + (1 : ℕ) = (↑i1 : ℕ)) → n2 ≠ n3 → + ∃ n ∈ [n1, n2, n3], (↑i1 : ℕ) < n := by + classical + intro V E _ _ _ G k e0 phi T alpha gamma u z p X outside hout i1 v1 hv1 B f1 hf1 f2 hf2 f3 hf3 + n1 hn1 he1 n2 hn2 he2 n3 hn3 he3 edge_before hn23 + by_contra hn + push Not at hn + have hle1 : n1 ≤ i1.val := hn n1 (by simp) + have hle2 : n2 ≤ i1.val := hn n2 (by simp) + have hle3 : n3 ≤ i1.val := hn n3 (by simp) + have hne1 : n1 ≠ i1.val := by + intro heq + have hbad : Sum.inl v1 = Sum.inr f1 := by + calc + Sum.inl v1 = p.getVert i1.val := hv1.symm + _ = p.getVert n1 := by rw [heq] + _ = Sum.inr f1 := he1 + simp at hbad + have hne2 : n2 ≠ i1.val := by + intro heq + have hbad : Sum.inl v1 = Sum.inr f2 := by + calc + Sum.inl v1 = p.getVert i1.val := hv1.symm + _ = p.getVert n2 := by rw [heq] + _ = Sum.inr f2 := he2 + simp at hbad + have hne3 : n3 ≠ i1.val := by + intro heq + have hbad : Sum.inl v1 = Sum.inr f3 := by + calc + Sum.inl v1 = p.getVert i1.val := hv1.symm + _ = p.getVert n3 := by rw [heq] + _ = Sum.inr f3 := he3 + simp at hbad + have hb1 := edge_before f1 hf1 n1 hn1 he1 (by omega) + have hb2 := edge_before f2 hf2 n2 hn2 he2 (by omega) + have hb3 := edge_before f3 (Finset.mem_of_mem_erase hf3) n3 hn3 he3 (by omega) + omega + +theorem ScheideDefectiveChainDepartureReturn {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) + (alpha gamma : Fin k) + (halpha : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T)) + (hgammaFree : gamma ∈ TreeFreeColors phi T) + (u : V) (hu : u ∈ TreeSequenceVertexSet T) + (hgamma : gamma ∈ MissingColors G phi u) + (z : V) + (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk + (Sum.inl u) (Sum.inl z)) + (hp : ScheideDefectiveChainPath T phi alpha gamma u z p) : + ∃ (i1 i2 : Fin (p.length + 1)) (v1 v2 : V), + ScheideDepartureReturn T i1 i2 v1 v2 := by + classical + rcases hp with ⟨huT, hpath, hzout, hcomponent⟩ + have hp0 : ScheideDefectiveChainPath T phi alpha gamma u z p := + ⟨huT, hpath, hzout, hcomponent⟩ + let X := TreeSequenceVertexSet T + let outside : Finset (Fin (p.length + 1)) := + Finset.univ.filter (fun i => ∃ v : V, p.getVert i.val = Sum.inl v ∧ v ∉ X) + have hend : p.getVert p.length = Sum.inl z := by simp + have hout : (Fin.last p.length) ∈ outside := by + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, by simpa [hend, X] using hzout⟩ + let i1 := outside.min' (by exact ⟨Fin.last p.length, hout⟩) + have hi1out : ∃ v : V, p.getVert i1.val = Sum.inl v ∧ v ∉ X := by + exact (Finset.mem_filter.mp (Finset.min'_mem outside _)).2 + rcases hi1out with ⟨v1, hv1, hv1out⟩ + have hbefore : ∀ r : Fin (p.length + 1), r.val < i1.val → + ∀ w : V, p.getVert r.val = Sum.inl w → w ∈ X := by + intro r hr w hw + by_contra hn + have hm : r ∈ outside := by + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, ⟨w, hw, hn⟩⟩ + have hmin := Finset.min'_le outside r hm + exact (Nat.not_lt_of_ge hmin) hr + have hfacts := ScheideGlobalMaximumBoundaryFacts G k e0 phi T hglobal + have hcard : 3 ≤ (BoundaryColorEdges G phi X alpha).card := by + exact (hfacts.2.2 alpha halpha).2 + let B := BoundaryColorEdges G phi X alpha + have hbcard : 3 ≤ B.card := by simpa [B, X] using hcard + have hbpos : B.Nonempty := Finset.card_pos.mp (by omega) + obtain ⟨f1, hf1⟩ := hbpos + obtain ⟨f2, hf2, hf12⟩ := B.exists_mem_ne (by omega) f1 + have hcard2 : 2 ≤ (B.erase f1).card := by + rw [Finset.card_erase_of_mem hf1] + omega + obtain ⟨f3, hf3, hf23⟩ := (B.erase f1).exists_mem_ne (by omega) f2 + have hf31 : f3 ≠ f1 := by + intro h + subst h + simp at hf3 + have edge_occurrence : ∀ f ∈ B, ∃ n ≤ p.length, p.getVert n = Sum.inr f := by + intro f hf + have hs : Sum.inr f ∈ p.support := by + have hh := (ScheideDefectiveChainBoundaryEdges G k e0 phi T hglobal + alpha gamma halpha hgammaFree u hu hgamma z p hp0) f + exact (hh.mp (by simpa [B] using hf)).2 + rcases SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hs with ⟨n, hn, hnl⟩ + exact ⟨n, hnl, hn⟩ + obtain ⟨n1, hn1, he1⟩ := edge_occurrence f1 hf1 + obtain ⟨n2, hn2, he2⟩ := edge_occurrence f2 hf2 + obtain ⟨n3, hn3, he3⟩ := edge_occurrence f3 (Finset.mem_of_mem_erase hf3) + have edge_has_neighbor := @helper_edge_has_neighbor_89 (@V) (@E) inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@alpha) (@gamma) (@u) (@z) (@p) (@hpath) (@f1) (@n1) (@n2) (@n3) + have edge_before := @helper_edge_before_146 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@alpha) (@gamma) (@u) (@z) (@p) (@hpath) (@hout) (@hbefore) (@f1) + (@n1) (@n2) (@n3) + have hn12 : n1 ≠ n2 := by + intro heq + apply hf12 + exact Sum.inr.inj (by rw [← he1, ← he2, heq]) + have hn13 : n1 ≠ n3 := by + intro heq + apply hf31 + exact Sum.inr.inj (by rw [← he1, ← he3, heq]) + have hn23 : n2 ≠ n3 := by + intro heq + apply hf23 + exact Sum.inr.inj (by rw [← he2, ← he3, heq]) + have hlater := @helper_hlater_214 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@alpha) (@gamma) (@u) (@z) (@p) (@hout) (@v1) (@hv1) (@f1) (@hf1) (@f2) + (@hf2) (@f3) (@hf3) (@n1) (@hn1) (@he1) (@n2) (@hn2) (@he2) (@n3) (@hn3) (@he3) (@edge_before) + (@hn23) + rcases hlater with ⟨nret, hnret, hnretlater⟩ + have hnretB : ∃ f ∈ B, ∃ n ≤ p.length, p.getVert n = Sum.inr f ∧ + i1.val < n := by + rcases (show nret = n1 ∨ nret = n2 ∨ nret = n3 by simpa using hnret) with h | h | h + · subst nret + exact ⟨f1, hf1, n1, hn1, he1, hnretlater⟩ + · subst nret + exact ⟨f2, hf2, n2, hn2, he2, hnretlater⟩ + · subst nret + exact ⟨f3, Finset.mem_of_mem_erase hf3, n3, hn3, he3, hnretlater⟩ + rcases hnretB with ⟨f, hf, n, hn, he, hnretlater⟩ + rcases edge_has_neighbor f hf n hn he with ⟨j, v, hjbound, hjrel, hjv, hvX⟩ + have hjlater : i1.val < j := by + by_contra hnot + have hjle : j ≤ i1.val := by omega + rcases hjrel with hjn | hnj + · by_cases hjeq : j = i1.val + · have hvEq : v = v1 := by + apply Sum.inl.inj + calc + Sum.inl v = p.getVert j := hjv.symm + _ = p.getVert i1.val := by rw [hjeq] + _ = Sum.inl v1 := hv1 + subst v + exact hv1out hvX + · have hjlt : j < i1.val := by omega + omega + · omega + let returns : Finset (Fin (p.length + 1)) := + Finset.univ.filter (fun r => i1.val < r.val ∧ + ∃ w : V, p.getVert r.val = Sum.inl w ∧ w ∈ X) + have hjmem : (⟨j, by omega⟩ : Fin (p.length + 1)) ∈ returns := by + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, hjlater, ⟨v, hjv, hvX⟩⟩ + let i2 := returns.max' (by exact ⟨⟨j, by omega⟩, hjmem⟩) + have hi2mem : i2 ∈ returns := Finset.max'_mem returns _ + rcases (Finset.mem_filter.mp hi2mem).2 with ⟨hi2later, v2, hv2, hv2X⟩ + have hafter : ∀ r : Fin (p.length + 1), i2.val < r.val → + ∀ w : V, p.getVert r.val = Sum.inl w → w ∉ X := by + intro r hri w hwr hwX + have hrmem : r ∈ returns := by + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, by omega, ⟨w, hwr, hwX⟩⟩ + have hrle := Finset.le_max' returns r hrmem + omega + refine ⟨i1, i2, v1, v2, ?_⟩ + exact ⟨hp0, hv1, hv1out, hbefore, hi2later, hv2, hv2X, hafter⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveChainLastReturnNoFree.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveChainLastReturnNoFree.lean new file mode 100644 index 0000000000..4e16c2abe8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveChainLastReturnNoFree.lean @@ -0,0 +1,888 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable + +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainDepartureReturn + +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists + +/-! +# Scheide Defective Chain Last Return No Free + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_adjacent_indices_forward_225.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (alpha gamma : Fin k), gamma ∈ TreeFreeColors phi T → ∀ (u : V), gamma ∈ + MissingColors G phi u → ∀ (z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk + (Sum.inl u) (Sum.inl z)), ScheideDefectiveChainPath T phi alpha gamma u z p → ∀ (i2 : Fin + (p.length + (1 : ℕ))), IsProperEdgeColoring G phi → alpha ≠ gamma → (↑i2 : ℕ) + (1 : ℕ) < + p.length → let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha gamma; ∀ (n m + : ℕ), n ≤ p.length → m ≤ p.length → n < m → H.Adj (p.getVert n) (p.getVert m) → m = n + (1 + : ℕ) := by + classical + intro V E _ _ G k e0 phi T alpha gamma _ u hgamma z p hp i2 hproper hag hfirstlt H n m hn hm hnm + hadj + let _ := Fintype.ofFinite V + by_contra hne + have hgap : n + 1 < m := by omega + by_cases hn0 : n = 0 + · subst n + have hfirstAdj := p.adj_getVert_succ (by omega : 0 < p.length) + have hdeg : @SimpleGraph.degree _ H (Sum.inl u) (Fintype.ofFinite _) ≤ 1 := by + have hd := MissingColorIncidenceEndpoint G phi gamma alpha hag.symm + hproper u hgamma + have hgraph : TwoColorIncidenceGraph G phi gamma alpha = H := by + ext x y + cases x <;> cases y <;> simp [H, TwoColorIncidenceGraph, or_comm] + rw [← hgraph] + exact hd + have hstart : p.getVert 0 = Sum.inl u := by simp + have hneigh : p.getVert 1 ≠ p.getVert m := by + intro heq + have h1m : 1 ≤ m := by omega + have := hp.2.1.getVert_injOn (h1m.trans hm) hm heq + omega + have htwo : 2 ≤ (@SimpleGraph.neighborFinset (Sum V E) H (Sum.inl u) + (Fintype.ofFinite _)).card := by + have hs : ({p.getVert 1, p.getVert m} : Finset (Sum V E)) ⊆ + @SimpleGraph.neighborFinset (Sum V E) H (Sum.inl u) + (Fintype.ofFinite _) := by + intro q hq + simp only [Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset, H, hstart] using hfirstAdj + · simpa [SimpleGraph.mem_neighborFinset, H, hstart] using hadj + have hc : ({p.getVert 1, p.getVert m} : Finset (Sum V E)).card = 2 := by + simp [hneigh] + rw [← hc] + exact Finset.card_le_card hs + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hdeg + have : 2 ≤ 1 := htwo.trans hdeg + omega + · have hnlt : n < p.length := by omega + have hleft : H.Adj (p.getVert n) (p.getVert (n - 1)) := by + have h := p.adj_getVert_succ (i := n - 1) (by omega) + have heq : n - 1 + 1 = n := by omega + simpa [H, heq] using h.symm + have hright : H.Adj (p.getVert n) (p.getVert (n + 1)) := by + simpa [H] using p.adj_getVert_succ hnlt + have hnm1 : p.getVert (n - 1) ≠ p.getVert (n + 1) := by + intro heq + have := hp.2.1.getVert_injOn (Nat.sub_le n 1 |>.trans hn) + (Nat.succ_le_of_lt hnlt) heq + omega + have hnm2 : p.getVert (n - 1) ≠ p.getVert m := by + intro heq + have := hp.2.1.getVert_injOn (Nat.sub_le n 1 |>.trans hn) hm heq + omega + have hnm3 : p.getVert (n + 1) ≠ p.getVert m := by + intro heq + have := hp.2.1.getVert_injOn (Nat.succ_le_of_lt hnlt) hm heq + omega + have hthree : 3 ≤ (@SimpleGraph.neighborFinset (Sum V E) H (p.getVert n) + (Fintype.ofFinite _)).card := by + let S : Finset (Sum V E) := + {p.getVert (n - 1), p.getVert (n + 1), p.getVert m} + have hs : S ⊆ @SimpleGraph.neighborFinset (Sum V E) H (p.getVert n) + (Fintype.ofFinite _) := by + intro q hq + simp only [S, Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + · simpa [SimpleGraph.mem_neighborFinset, H] using hadj + have hc : S.card = 3 := by + simp [S, hnm1, hnm2, hnm3] + rw [← hc] + exact Finset.card_le_card hs + have hdeg := TwoColorIncidenceDegreeAtMostTwo G phi alpha gamma hproper + (p.getVert n) + change @SimpleGraph.degree _ H (p.getVert n) (Fintype.ofFinite _) ≤ 2 at hdeg + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hdeg + have : 3 ≤ 2 := hthree.trans hdeg + omega + +private theorem helper_new_adj_old_344.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k), + gamma ∈ TreeFreeColors phi T → + ∀ (u z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)) (i2 + : Fin (p.length + (1 : ℕ))) (v2 : V) ⦃beta : Fin k⦄, beta ∈ MissingColors G phi v2 → + let X : Finset V := TreeSequenceVertexSet T; beta ≠ gamma → alpha ≠ gamma → alpha ≠ beta → + BoundaryColorEdges G phi X beta = ∅ → + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi beta gamma; ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha gamma; + let R : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (n : ℕ), (↑i2 : ℕ) ≤ n ∧ n ≤ p.length ∧ p.getVert n = q}; ( + ∀ {n : ℕ} {w : V}, (↑i2 : ℕ) ≤ n → n ≤ p.length → p.getVert n = Sum.inl w → n = (↑i2 : ℕ) ∧ w + = v2 ∨ (↑i2 : ℕ) < n ∧ w ∉ X) → ( + ∀ {e : E} {w : V}, TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X) → + ∀ {q r : V ⊕ E}, q ∈ R → (TwoColorIncidenceGraph G phi1 alpha beta).Adj q r → H.Adj q r := by + classical + intro V E _ _ G k e0 phi T alpha gamma _ u z p i2 v2 beta hbeta X hbg hag hab hbetaBoundary + phi1 htreeFixed1 H R tail_vertex boundary_of_tree_incident_outside q r hq hadj + obtain ⟨n, hn, hnl, hget⟩ := hq + cases q with + | inl w => + cases r with + | inl x => simp [TwoColorIncidenceGraph] at hadj + | inr e => + have hnew : Incident G w e ∧ + (phi1 e = some alpha ∨ phi1 e = some beta) := by + simpa [TwoColorIncidenceGraph] using hadj + have hold : phi e = some alpha ∨ phi e = some gamma := by + by_cases hti : TreeIncidentEdge T e + · have hfix := htreeFixed1 e hti + rcases hnew.2 with ha | hb + · exact Or.inl (hfix.symm.trans ha) + · have hbetaOld : phi e = some beta := hfix.symm.trans hb + rcases tail_vertex hn hnl hget with hbase | hout + · have hwbeta : beta ∈ PresentColors G phi w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hnew.1, hbetaOld⟩ + have hwmissing : beta ∈ MissingColors G phi w := by + simpa [hbase.2] using hbeta + have hnotPresent : beta ∉ PresentColors G phi w := by + simpa [MissingColors] using hwmissing + exact False.elim (hnotPresent hwbeta) + · have heb := boundary_of_tree_incident_outside hti hout.2 hnew.1 + have hec : e ∈ BoundaryColorEdges G phi X beta := + Finset.mem_filter.mpr ⟨heb, hbetaOld⟩ + rw [hbetaBoundary] at hec + simp at hec + · rcases hnew.2 with ha | hb + · by_cases heB : phi e = some beta + · have heq : some gamma = some alpha := by + simpa [phi1, OutsideTreeColorSwap, hti, heB, hbg] using ha + exact False.elim (hag (Option.some.inj heq).symm) + · by_cases heG : phi e = some gamma + · have heq : some beta = some alpha := by + simpa [phi1, OutsideTreeColorSwap, hti, heB, heG, hbg, + hbg.symm] using ha + exact False.elim (hab (Option.some.inj heq).symm) + · exact Or.inl (by + simpa [phi1, OutsideTreeColorSwap, hti, heB, heG] using ha) + · by_cases heB : phi e = some beta + · have heq : some gamma = some beta := by + simpa [phi1, OutsideTreeColorSwap, hti, heB, hbg] using hb + exact False.elim (hbg (Option.some.inj heq).symm) + · by_cases heG : phi e = some gamma + · exact Or.inr heG + · have : phi e = some beta := by + simp [phi1, OutsideTreeColorSwap, hti, heB, heG] at hb + exact False.elim (heB this) + simpa [H, TwoColorIncidenceGraph] using And.intro hnew.1 hold + | inr e => + cases r with + | inr f => simp [TwoColorIncidenceGraph] at hadj + | inl w => + have hn0 : 0 < n := by + by_contra hz + have hz0 : n = 0 := by omega + rw [hz0] at hget + simp at hget + have hprev := p.adj_getVert_succ (i := n - 1) (by omega) + have hidx : n - 1 + 1 = n := by omega + rw [hidx, hget] at hprev + cases hprevNode : p.getVert (n - 1) with + | inr f => + rw [hprevNode] at hprev + exfalso + simp [TwoColorIncidenceGraph] at hprev + | inl x => + have hold : phi e = some alpha ∨ phi e = some gamma := by + rw [hprevNode] at hprev + simpa [H, TwoColorIncidenceGraph] using hprev.2 + have hinc : Incident G w e := by + simpa [TwoColorIncidenceGraph] using hadj.1 + simpa [H, TwoColorIncidenceGraph] using And.intro hinc hold + +private theorem helper_R_closed_422.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k), + gamma ∈ TreeFreeColors phi T → + ∀ (u z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p → + ∀ (i1 i2 : Fin (p.length + (1 : ℕ))) (v1 v2 : V), ScheideDepartureReturn T i1 i2 v1 v2 → + ∀ ⦃beta : Fin k⦄, + let X : Finset V := TreeSequenceVertexSet T; IsProperEdgeColoring G phi → v2 ∈ X → + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi beta gamma; ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → beta ∈ MissingColors G phi1 v2 → + ∀ (fR : E), p.getVert ((↑i2 : ℕ) + (1 : ℕ)) = Sum.inr fR → Incident G v2 fR ∧ (phi fR = some + alpha ∨ phi fR = some gamma) → (↑i2 : ℕ) + (1 : ℕ) < p.length → phi fR = some alpha → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha gamma; ( + ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → H.Adj (p.getVert n) (p.getVert m) → n + (1 : ℕ) = m + ∨ m + (1 : ℕ) = n) → + let R : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (n : ℕ), (↑i2 : ℕ) ≤ n ∧ n ≤ p.length ∧ p.getVert n = q}; ( + ∀ {q r : V ⊕ E}, q ∈ R → (TwoColorIncidenceGraph G phi1 alpha beta).Adj q r → H.Adj q r) → + ∀ {q r : V ⊕ E}, q ∈ R → (TwoColorIncidenceGraph G phi1 alpha beta).Adj q r → r ∈ R := by + classical + intro V E _ _ G k e0 phi T alpha gamma _ u z p hp i1 i2 v1 v2 hdepart beta X hproper hv2X phi1 + htreeFixed1 hbeta1 fR hfRnode hfRdata hfirstlt hfRalpha H old_adjacent_indices R new_adj_old q + r hq hadj + let _ := Fintype.ofFinite V + have holdAdj := new_adj_old hq hadj + obtain ⟨n, hn, hnl, hget⟩ := hq + have hqOld : q ∈ TwoColorComponent G phi alpha gamma (Sum.inl u) := by + rw [← hp.2.2.2] + rw [← hget] + exact p.getVert_mem_support n + have hrOld : r ∈ TwoColorComponent G phi alpha gamma (Sum.inl u) := by + change H.connectedComponentMk r = H.connectedComponentMk (Sum.inl u) + change H.connectedComponentMk q = H.connectedComponentMk (Sum.inl u) at hqOld + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + holdAdj.symm).trans hqOld + have hrSupport : r ∈ p.support := by + have : r ∈ {x | x ∈ p.support} := by + rw [hp.2.2.2] + exact hrOld + exact this + obtain ⟨m, hmget, hml⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hrSupport + have hindices := old_adjacent_indices n m hnl hml (by simpa [H, hget, hmget] using holdAdj) + rcases hindices with hforward | hback + · exact ⟨m, by omega, hml, hmget⟩ + · by_cases hm : i2.val ≤ m + · exact ⟨m, hm, hml, hmget⟩ + · have hnbase : n = i2.val := by omega + have hmbase : m + 1 = i2.val := by omega + have hqv : q = Sum.inl v2 := by + rw [← hget, hnbase, hdepart.2.2.2.2.2.1] + cases hr : r with + | inl w => + have hbad : (TwoColorIncidenceGraph G phi1 alpha beta).Adj + (Sum.inl v2) (Sum.inl w) := by + simpa [hqv, hr] using hadj + exfalso + simp [TwoColorIncidenceGraph] at hbad + | inr e => + have hadj' : (TwoColorIncidenceGraph G phi1 alpha beta).Adj + (Sum.inl v2) (Sum.inr e) := by + simpa [hqv, hr] using hadj + have hnew : Incident G v2 e ∧ + (phi1 e = some alpha ∨ phi1 e = some beta) := by + simpa [TwoColorIncidenceGraph] using hadj' + have hnotBeta : phi1 e ≠ some beta := by + intro he + have hpresent : beta ∈ PresentColors G phi1 v2 := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hnew.1, he⟩ + have hnotPresent : beta ∉ PresentColors G phi1 v2 := by + simpa [MissingColors] using hbeta1 + exact hnotPresent hpresent + have heAlpha : phi1 e = some alpha := hnew.2.resolve_right hnotBeta + have heTree : TreeIncidentEdge T e := by + exact ⟨v2, by simpa [X] using hv2X, hnew.1⟩ + have heOld : phi e = some alpha := (htreeFixed1 e heTree).symm.trans heAlpha + have hef : e ≠ fR := by + intro hef + have hnodes : p.getVert m = p.getVert (i2.val + 1) := by + rw [hmget, hr, hef, hfRnode] + have hidx := hp.2.1.getVert_injOn hml + (Nat.le_of_lt hfirstlt) hnodes + omega + exact False.elim ((hproper hef ⟨v2, hnew.1, hfRdata.1⟩ heOld) hfRalpha) + +private theorem helper_boundary_tail_unique_500.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k), + gamma ∈ TreeFreeColors phi T → + ∀ (u z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p → + ∀ (i1 i2 : Fin (p.length + (1 : ℕ))) (v1 v2 : V), ScheideDepartureReturn T i1 i2 v1 v2 → + let X : Finset V := TreeSequenceVertexSet T; ( + ∀ {q : Sym2 V} {x y : V}, x ∈ q → y ∈ q → x ≠ y → q = s(x, y)) → + ∀ (fR : E), p.getVert ((↑i2 : ℕ) + (1 : ℕ)) = Sum.inr fR → + let R : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (n : ℕ), (↑i2 : ℕ) ≤ n ∧ n ≤ p.length ∧ p.getVert n = q}; + ∀ f ∈ BoundaryEdges G X, Sum.inr f ∈ R → f = fR := by + classical + intro V E _ _ G k e0 phi T alpha gamma _ u z p hp i1 i2 v1 v2 hdepart X ends_eq_of_mem fR + hfRnode R f hf hfr + obtain ⟨n, hn, hnl, hget⟩ := hfr + have hnstrict : i2.val < n := by + have hne : n ≠ i2.val := by + intro heq + have : Sum.inr f = Sum.inl v2 := by + rw [← hget, heq, hdepart.2.2.2.2.2.1] + simp at this + omega + by_cases heq : n = i2.val + 1 + · apply Sum.inr.inj + rw [← hget, heq, hfRnode] + · have hfar : i2.val + 1 < n := by omega + have hn0 : 0 < n := by omega + have hnlt : n < p.length := by + by_contra hnot + have hnend : n = p.length := by omega + have hz : p.getVert n = Sum.inl z := by simp [hnend] + rw [hget] at hz + simp at hz + have hleftAdj := p.adj_getVert_succ (i := n - 1) (by omega) + have hleftIdx : n - 1 + 1 = n := by omega + rw [hleftIdx, hget] at hleftAdj + have hrightAdj := p.adj_getVert_succ (i := n) hnlt + rw [hget] at hrightAdj + cases hl : p.getVert (n - 1) with + | inr e => + rw [hl] at hleftAdj + exfalso + simp [TwoColorIncidenceGraph] at hleftAdj + | inl a => + rw [hl] at hleftAdj + cases hr : p.getVert (n + 1) with + | inr e => + rw [hr] at hrightAdj + exfalso + simp [TwoColorIncidenceGraph] at hrightAdj + | inl b => + rw [hr] at hrightAdj + have haout : a ∉ X := by + have hi : i2.val < n - 1 := by omega + exact hdepart.2.2.2.2.2.2.2 + ⟨n - 1, Nat.lt_succ_of_le ((Nat.sub_le n 1).trans hnl)⟩ hi a hl + have hbout : b ∉ X := by + have hi : i2.val < n + 1 := by omega + exact hdepart.2.2.2.2.2.2.2 + ⟨n + 1, Nat.lt_succ_of_le (Nat.succ_le_of_lt hnlt)⟩ hi b hr + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have habv : a ≠ b := by + intro habv + have hnodes : p.getVert (n - 1) = p.getVert (n + 1) := by + rw [hl, hr, habv] + have hidx := hp.2.1.getVert_injOn + (Nat.sub_le _ _ |>.trans hnl) (Nat.succ_le_of_lt hnlt) hnodes + omega + have habEnds : G.ends f = s(a, b) := + ends_eq_of_mem hleftAdj.1 hrightAdj.1 habv + have hxab : x = a ∨ x = b := by + have hxmem : x ∈ s(a, b) := by rw [← habEnds]; exact hends ▸ Sym2.mem_iff.mpr (Or.inl rfl) + simpa using hxmem + rcases hxab with rfl | rfl + · exact False.elim (haout hx) + · exact False.elim (hbout hx) + +private theorem helper_htreeU_643.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k) (u + z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)) (_ : + Fin (p.length + (1 : ℕ))) (v2 : V) ⦃beta : Fin k⦄, + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi beta gamma; + ∀ (f : E), + let phi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 alpha beta (Sum.inl v2); + alpha ∈ MissingColors G phi2 v2 → phi2 f = some alpha → TashkinovTree G e0 phi2 T → + ∀ (U : TreeSequence G e0) (hUlen : U.length = T.length + (1 : ℕ)), TreeSequenceInitialSegment + T U → U.edge (Fin.cast (( + by omega + )) (Fin.last T.length)) = f → + ∀ (v2index : Fin (T.length + (1 : ℕ))), T.vertex v2index = v2 → TashkinovTree G e0 phi2 U := by + classical + intro V E _ _ G k e0 phi T alpha gamma u z p i2 v2 beta phi1 f phi2 halpha2 hfPhi2 htree2 U hUlen + hinit hlast v2index hv2index j hj + let _ := Fintype.ofFinite V + by_cases hjlast : j.val = T.length + · have hjeq : j = Fin.cast hUlen.symm (Fin.last T.length) := by + apply Fin.ext + simp [hjlast] + let a : Fin (j.val + 1) := ⟨v2index.val, by simpa [hjlast] using v2index.isLt⟩ + refine ⟨a, alpha, ?_, ?_⟩ + · rw [hjeq, hlast] + exact hfPhi2 + · have hacast : Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt)) = + Fin.castLE (Nat.succ_le_succ hinit.1) v2index := by + apply Fin.ext + rfl + rw [hacast, hinit.2.1, hv2index] + exact halpha2 + · have hjold : j.val < T.length := by + rw [hUlen] at j + omega + let jT : Fin T.length := ⟨j.val, hjold⟩ + obtain ⟨a, c, hcolor, hmiss⟩ := htree2 jT (by simpa [jT] using hj) + let aa : Fin (j.val + 1) := ⟨a.val, by simpa [jT] using a.isLt⟩ + refine ⟨aa, c, ?_, ?_⟩ + · have hjeq : j = Fin.castLE hinit.1 jT := by + apply Fin.ext + rfl + rw [hjeq, hinit.2.2] + exact hcolor + · have hacast : Fin.castLT aa + (Nat.lt_trans aa.isLt (Nat.succ_lt_succ j.isLt)) = + Fin.castLE (Nat.succ_le_succ hinit.1) + (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ jT.isLt))) := by + apply Fin.ext + rfl + rw [hacast, hinit.2.1] + exact hmiss + +private theorem helper_htree2_771.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k), + alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T) → + ∀ (v2 : V) ⦃beta : Fin k⦄, beta ∈ TreeFreeColors phi T → + let X : Finset V := TreeSequenceVertexSet T; Disjoint (DefectiveColors G phi + (TreeSequenceVertexSet T)) (TreeUsedColors phi T) ∧ Disjoint (TreeFreeColors phi T) + (TreeUsedColors phi T) → TashkinovTree G e0 phi T → + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi beta gamma; ( + ∀ w ∈ X, MissingColors G phi1 w = MissingColors G phi w) → ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 alpha beta (Sum.inl v2); + let phi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 alpha beta (Sum.inl v2); ( + have C : Set (V ⊕ E) := TwoColorComponent G phi1 alpha beta (Sum.inl v2); + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 alpha beta (Sum.inl v2); ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi1 v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → alpha ∈ MissingColors G phi1 v → beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → beta ∈ MissingColors G phi1 v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors + G phi1 v)) → ( + ∀ (j : Fin T.length), TreeIncidentEdge T (T.edge j)) → TashkinovTree G e0 phi2 T := by + classical + intro V E _ _ G k e0 phi T alpha gamma halpha v2 beta hbetaFree X hunused htree phi1 hmissing1 + htreeFixed1 C phi2 hbehavior tree_edge_incident j hj + obtain ⟨a, c, hcolor, hmiss⟩ := htree j hj + have hcUsed : c ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨j, hj, hcolor⟩ + have hca : c ≠ alpha := by + intro h + exact (Finset.disjoint_left.mp hunused.1) halpha (h ▸ hcUsed) + have hcb : c ≠ beta := by + intro h + exact (Finset.disjoint_left.mp hunused.2) hbetaFree (h ▸ hcUsed) + have hcolor1 : phi1 (T.edge j) = some c := + (htreeFixed1 (T.edge j) (tree_edge_incident j)).trans hcolor + have hcolor2 : phi2 (T.edge j) = some c := by + by_cases heC : Sum.inr (T.edge j) ∈ C + · simp [phi2, TwoColorComponentSwap, C, heC, hcolor1, hca, hcb] + · simp [phi2, TwoColorComponentSwap, C, heC, hcolor1] + refine ⟨a, c, hcolor2, ?_⟩ + let w := T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt))) + have hwX : w ∈ X := by simp [w, X, TreeSequenceVertexSet] + have hmiss1 : c ∈ MissingColors G phi1 w := by + rw [hmissing1 w hwX] + exact hmiss + have hcBehavior := hbehavior.2.2.2 w c hca hcb + simpa [phi2, w] using hcBehavior.mpr hmiss1 + +private theorem helper_hcomponentTail_765.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha gamma : Fin k) (u z : + V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)) (i2 : Fin + (p.length + (1 : ℕ))) (v2 : V) ⦃beta : Fin k⦄, + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi beta gamma; + let R : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (n : ℕ), (↑i2 : ℕ) ≤ n ∧ n ≤ p.length ∧ p.getVert n = q}; Sum.inl v2 ∈ R → ( + ∀ {q r : V ⊕ E}, q ∈ R → (TwoColorIncidenceGraph G phi1 alpha beta).Adj q r → r ∈ R) → + let C : Set (V ⊕ E) := TwoColorComponent G phi1 alpha beta (Sum.inl v2); C ⊆ R := by + classical + intro V E _ _ G k e0 phi T alpha gamma u z p i2 v2 beta phi1 R hv2R R_closed C q hq + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + change (TwoColorIncidenceGraph G phi1 alpha beta).connectedComponentMk q = + (TwoColorIncidenceGraph G phi1 alpha beta).connectedComponentMk (Sum.inl v2) at hq + have hreach := SimpleGraph.ConnectedComponent.exact hq + obtain ⟨walk⟩ := hreach + have propagate : ∀ {a b : Sum V E}, + (TwoColorIncidenceGraph G phi1 alpha beta).Walk a b → a ∈ R → b ∈ R := by + intro a b walk ha + induction walk with + | nil => exact ha + | @cons a c b hac rest ih => exact ih (R_closed ha hac) + exact propagate walk.reverse hv2R + +private theorem helper_continuation_778.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), GlobalMaximumTriple G k e0 phi T → + ∀ (alpha gamma : Fin k), alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T) → gamma ∈ + TreeFreeColors phi T → + ∀ (u z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p → + ∀ (i1 i2 : Fin (p.length + (1 : ℕ))) (v1 v2 : V), ScheideDepartureReturn T i1 i2 v1 v2 → + ∀ ⦃beta : Fin k⦄, beta ∈ TreeFreeColors phi T → + let X : Finset V := TreeSequenceVertexSet T; TashkinovOrder G = (TreeSequenceVertexSet T).card + ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T) → ((DefectiveColors G phi (TreeSequenceVertexSet T) = ∅ → + ColoredVertexSetStronglyClosed G phi (TreeSequenceVertexSet T)) ∧ ( + ∀ alpha ∈ TreeMissingColors phi T, BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha = + ∅) ∧ + ∀ alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T), Odd (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card ∧ (3 : ℕ) ≤ (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card) → Disjoint (DefectiveColors G phi + (TreeSequenceVertexSet T)) (TreeUsedColors phi T) ∧ Disjoint (TreeFreeColors phi T) + (TreeUsedColors phi T) → TashkinovTree G e0 phi T → v2 ∈ X → alpha ≠ beta → ( + ∀ {q : Sym2 V} {x y : V}, x ∈ q → y ∈ q → x ≠ y → q = s(x, y)) → + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi beta gamma; + IsProperEdgeColoring G phi1 → IsOneEdgeUncolored phi1 e0 → ( + ∀ w ∈ X, MissingColors G phi1 w = MissingColors G phi w) → ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → beta ∈ MissingColors G phi1 v2 → + ∀ (fR : E), p.getVert ((↑i2 : ℕ) + (1 : ℕ)) = Sum.inr fR → + let R : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (n : ℕ), (↑i2 : ℕ) ≤ n ∧ n ≤ p.length ∧ p.getVert n = q}; Sum.inl v2 ∈ R → ( + ∀ {q r : V ⊕ E}, q ∈ R → (TwoColorIncidenceGraph G phi1 alpha beta).Adj q r → r ∈ R) → False + := by + classical + intro V E _ _ _ G k e0 phi T hglobal alpha gamma halpha _ u z p hp i1 i2 v1 v2 hdepart beta + hbetaFree X horder hfacts hunused htree hv2X hab ends_eq_of_mem phi1 hproper1 hone1 + hmissing1 htreeFixed1 hbeta1 fR hfRnode R hv2R R_closed + let C := TwoColorComponent G phi1 alpha beta (Sum.inl v2) + have hcomponentTail := @helper_hcomponentTail_765 V E inferInstance inferInstance G k e0 phi T + alpha gamma u z p i2 v2 beta hv2R R_closed + have boundary_tail_unique : ∀ f : E, f ∈ BoundaryEdges G X → + Sum.inr f ∈ R → f = fR := by + exact @helper_boundary_tail_unique_500 V E inferInstance inferInstance G k e0 + phi T alpha gamma (by assumption) u z p hp i1 i2 v1 v2 hdepart ends_eq_of_mem fR hfRnode + have hBcard : 3 ≤ (BoundaryColorEdges G phi X alpha).card := by + simpa [X] using (hfacts.2.2 alpha halpha).2 + obtain ⟨f, hfB, hffR⟩ := + (BoundaryColorEdges G phi X alpha).exists_mem_ne (by omega) fR + have hfBoundary : f ∈ BoundaryEdges G X := (Finset.mem_filter.mp hfB).1 + have hfAlpha : phi f = some alpha := (Finset.mem_filter.mp hfB).2 + have hfNotC : Sum.inr f ∉ C := by + intro hfC + exact hffR (boundary_tail_unique f hfBoundary (hcomponentTail hfC)) + have hfTree : TreeIncidentEdge T f := by + obtain ⟨x, hx, y, hy, hxy⟩ := by simpa [BoundaryEdges] using hfBoundary + exact ⟨x, by simpa [X] using hx, by simp [Incident, hxy]⟩ + have hfPhi1 : phi1 f = some alpha := (htreeFixed1 f hfTree).trans hfAlpha + let phi2 := TwoColorComponentSwap G phi1 alpha beta (Sum.inl v2) + have hproper2 : IsProperEdgeColoring G phi2 := by + simpa [phi2] using TwoColorComponentSwapProper G phi1 alpha beta hab + hproper1 (Sum.inl v2) + have hone2 : IsOneEdgeUncolored phi2 e0 := by + constructor + · simp [phi2, TwoColorComponentSwap, hone1.1] + · intro g hge + obtain ⟨c, hc⟩ := hone1.2 g hge + by_cases hgC : Sum.inr g ∈ C + · by_cases hca : phi1 g = some alpha + · exact ⟨beta, by simp [phi2, TwoColorComponentSwap, C, hgC, hca]⟩ + · by_cases hcb : phi1 g = some beta + · exact ⟨alpha, by simp [phi2, TwoColorComponentSwap, C, hgC, hcb]⟩ + · exact ⟨c, by simpa [phi2, TwoColorComponentSwap, C, hgC, hca, hcb] using hc⟩ + · exact ⟨c, by simpa [phi2, TwoColorComponentSwap, C, hgC] using hc⟩ + have hbehavior := TwoColorComponentSwapMissingBehavior G phi1 alpha beta hab + hproper1 (Sum.inl v2) + have hv2C : Sum.inl v2 ∈ C := by rfl + have halpha2 : alpha ∈ MissingColors G phi2 v2 := by + simpa [phi2, C] using hbehavior.2.2.1 v2 hv2C hbeta1 + have hfPhi2 : phi2 f = some alpha := by + simp [phi2, TwoColorComponentSwap, C, hfNotC, hfPhi1] + have tree_edge_incident : ∀ j : Fin T.length, TreeIncidentEdge T (T.edge j) := by + intro j + obtain ⟨a, ha⟩ := T.attaches j + refine ⟨T.vertex j.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · simp [Incident, ha] + have htree2 := @helper_htree2_771 V E inferInstance inferInstance G k e0 phi T alpha gamma halpha + v2 beta hbetaFree hunused htree hmissing1 htreeFixed1 hbehavior tree_edge_incident + obtain ⟨U, hTU⟩ := TreeSequenceBoundaryEdgeAppendExists T f hfBoundary + rcases hTU with ⟨hUlen, hinit, hlast⟩ + obtain ⟨v2index, hv2index⟩ := by + simpa [X, TreeSequenceVertexSet] using hv2X + have htreeU := @helper_htreeU_643 V E inferInstance inferInstance G k e0 phi T alpha gamma u z p + i2 v2 beta f halpha2 hfPhi2 htree2 U hUlen hinit hlast v2index hv2index + have hK2 : KTriple G k e0 phi2 := + ⟨hglobal.1.1, hglobal.1.2.1, hglobal.1.2.2.1, hproper2, hone2⟩ + have hUcard : (TreeSequenceVertexSet U).card = U.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + U.vertex_injective] + have hTcard : X.card = T.length + 1 := by + simp [X, TreeSequenceVertexSet, Finset.card_image_of_injective, + T.vertex_injective] + have hle := treeCard_le_tashkinovOrder G k e0 phi2 U hK2 htreeU + rw [horder.1, hUcard, hUlen, hTcard] at hle + omega + +private theorem helper_continuation_700.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), GlobalMaximumTriple G k e0 phi T → + ∀ (alpha gamma : Fin k), alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T) → gamma ∈ + TreeFreeColors phi T → + ∀ (u : V), gamma ∈ MissingColors G phi u → + ∀ (z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p → + ∀ (i1 i2 : Fin (p.length + (1 : ℕ))) (v1 v2 : V), ScheideDepartureReturn T i1 i2 v1 v2 → + ∀ ⦃beta : Fin k⦄, beta ∈ MissingColors G phi v2 → beta ∈ TreeFreeColors phi T → + let X : Finset V := TreeSequenceVertexSet T; TashkinovOrder G = (TreeSequenceVertexSet T).card + ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T) → ((DefectiveColors G phi (TreeSequenceVertexSet T) = ∅ → + ColoredVertexSetStronglyClosed G phi (TreeSequenceVertexSet T)) ∧ ( + ∀ alpha ∈ TreeMissingColors phi T, BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha = + ∅) ∧ + ∀ alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T), Odd (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card ∧ (3 : ℕ) ≤ (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card) → Disjoint (DefectiveColors G phi + (TreeSequenceVertexSet T)) (TreeUsedColors phi T) ∧ Disjoint (TreeFreeColors phi T) + (TreeUsedColors phi T) → IsProperEdgeColoring G phi → TashkinovTree G e0 phi T → v2 ∈ X → + beta ≠ gamma → alpha ≠ gamma → alpha ≠ beta → BoundaryColorEdges G phi X beta = ∅ → + BoundaryColorEdges G phi X gamma = ∅ → ( + ∀ {q : Sym2 V} {x y : V}, x ∈ q → y ∈ q → x ≠ y → q = s(x, y)) → + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi beta gamma; + IsProperEdgeColoring G phi1 → IsOneEdgeUncolored phi1 e0 → ( + ∀ w ∈ X, MissingColors G phi1 w = MissingColors G phi w) → ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → beta ∈ MissingColors G phi1 v2 → (↑i2 : ℕ) + < p.length → ( + ∃ (fR : E), p.getVert ((↑i2 : ℕ) + (1 : ℕ)) = Sum.inr fR) → False := by + classical + intro V E _ _ _ G k e0 phi T hglobal alpha gamma halpha _ u hgamma z p hp i1 i2 v1 v2 hdepart + beta hbeta hbetaFree X horder hfacts hunused hproper htree hv2X hbg hag hab hbetaBoundary + hgammaBoundary ends_eq_of_mem phi1 hproper1 hone1 hmissing1 htreeFixed1 hbeta1 hi2lt + hfirstNode + obtain ⟨fR, hfRnode⟩ := hfirstNode + have hfRdata : Incident G v2 fR ∧ + (phi fR = some alpha ∨ phi fR = some gamma) := by + have hadj := p.adj_getVert_succ hi2lt + rw [hdepart.2.2.2.2.2.1, hfRnode] at hadj + simpa [TwoColorIncidenceGraph] using hadj + have hfirstlt : i2.val + 1 < p.length := by + by_contra hn + have heq : i2.val + 1 = p.length := by omega + have hz : p.getVert (i2.val + 1) = Sum.inl z := by simp [heq] + rw [hfRnode] at hz + simp at hz + have hnextNode : ∃ wR : V, p.getVert (i2.val + 2) = Sum.inl wR := by + have hadj := p.adj_getVert_succ hfirstlt + rw [hfRnode] at hadj + cases hq : p.getVert (i2.val + 2) with + | inl w => exact ⟨w, rfl⟩ + | inr f => + rw [hq] at hadj + exfalso + simp [TwoColorIncidenceGraph] at hadj + obtain ⟨wR, hwRnode⟩ := hnextNode + have hwRout : wR ∉ X := by + apply hdepart.2.2.2.2.2.2.2 ⟨i2.val + 2, by omega⟩ (by simp) + simpa [X] using hwRnode + have hwRinc : Incident G wR fR := by + have hadj := p.adj_getVert_succ hfirstlt + rw [hfRnode, hwRnode] at hadj + simpa [TwoColorIncidenceGraph] using hadj.1 + have hv2wR : v2 ≠ wR := by + intro h + exact hwRout (h ▸ hv2X) + have hfRBoundary : fR ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v2, hv2X, wR, hwRout, + ends_eq_of_mem hfRdata.1 hwRinc hv2wR⟩ + have hfRalpha : phi fR = some alpha := by + rcases hfRdata.2 with ha | hg + · exact ha + · have : fR ∈ BoundaryColorEdges G phi X gamma := + Finset.mem_filter.mpr ⟨hfRBoundary, hg⟩ + rw [hgammaBoundary] at this + simp at this + let H := TwoColorIncidenceGraph G phi alpha gamma + have adjacent_indices_forward : ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → + n < m → H.Adj (p.getVert n) (p.getVert m) → m = n + 1 := by + exact @helper_adjacent_indices_forward_225 V E inferInstance inferInstance + G k e0 phi T alpha gamma (by assumption) u hgamma z p hp i2 hproper hag + hfirstlt + have old_adjacent_indices : ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → + H.Adj (p.getVert n) (p.getVert m) → n + 1 = m ∨ m + 1 = n := by + intro n m hn hm hadj + have hne : n ≠ m := by + intro h + subst m + exact H.loopless.irrefl _ hadj + rcases lt_or_gt_of_ne hne with hnm | hmn + · exact Or.inl (adjacent_indices_forward n m hn hm hnm hadj).symm + · exact Or.inr (adjacent_indices_forward m n hm hn hmn hadj.symm).symm + let R : Set (Sum V E) := {q | ∃ n : ℕ, i2.val ≤ n ∧ n ≤ p.length ∧ + p.getVert n = q} + have hv2R : Sum.inl v2 ∈ R := by + exact ⟨i2.val, le_rfl, by omega, hdepart.2.2.2.2.2.1⟩ + have tail_vertex : ∀ {n : ℕ} {w : V}, i2.val ≤ n → n ≤ p.length → + p.getVert n = Sum.inl w → + (n = i2.val ∧ w = v2) ∨ (i2.val < n ∧ w ∉ X) := by + intro n w hn hnl hget + by_cases heq : n = i2.val + · left + refine ⟨heq, ?_⟩ + apply Sum.inl.inj + rw [← hget, heq, hdepart.2.2.2.2.2.1] + · right + have hlt : i2.val < n := by omega + refine ⟨hlt, ?_⟩ + exact hdepart.2.2.2.2.2.2.2 ⟨n, by omega⟩ hlt w hget + have boundary_of_tree_incident_outside : ∀ {e : E} {w : V}, + TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X := by + intro e w he hwout hwe + obtain ⟨x, hx, hxe⟩ := he + have hxX : x ∈ X := by simpa [X] using hx + have hxw : x ≠ w := by + intro h + exact hwout (h ▸ hxX) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxX, w, hwout, ends_eq_of_mem hxe hwe hxw⟩ + have new_adj_old : ∀ {q r : Sum V E}, q ∈ R → + (TwoColorIncidenceGraph G phi1 alpha beta).Adj q r → H.Adj q r := by + exact @helper_new_adj_old_344 V E inferInstance inferInstance G k e0 phi T + alpha gamma (by assumption) u z p i2 v2 beta hbeta hbg hag hab hbetaBoundary htreeFixed1 + tail_vertex boundary_of_tree_incident_outside + have R_closed : ∀ {q r : Sum V E}, q ∈ R → + (TwoColorIncidenceGraph G phi1 alpha beta).Adj q r → r ∈ R := by + exact @helper_R_closed_422 V E inferInstance inferInstance G k e0 phi T alpha + gamma (by assumption) u z p hp i1 i2 v1 v2 hdepart beta hproper hv2X htreeFixed1 hbeta1 + fR hfRnode hfRdata hfirstlt hfRalpha old_adjacent_indices new_adj_old + exact @helper_continuation_778 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@hglobal) (@alpha) (@gamma) (@halpha) (by assumption) (@u) (@z) (@p) + (@hp) (@i1) (@i2) (@v1) (@v2) (@hdepart) (@beta) (@hbetaFree) (@horder) (@hfacts) + (@hunused) (@htree) (@hv2X) (@hab) (@ends_eq_of_mem) (@hproper1) (@hone1) (@hmissing1) + (@htreeFixed1) (@hbeta1) (@fR) (@hfRnode) (@hv2R) (@R_closed) +theorem ScheideDefectiveChainLastReturnNoFree {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) + (alpha gamma : Fin k) + (halpha : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T)) + (_ : gamma ∈ TreeFreeColors phi T) + (u : V) (hu : u ∈ TreeSequenceVertexSet T) + (hgamma : gamma ∈ MissingColors G phi u) + (z : V) + (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk + (Sum.inl u) (Sum.inl z)) + (hp : ScheideDefectiveChainPath T phi alpha gamma u z p) + (i1 i2 : Fin (p.length + 1)) (v1 v2 : V) + (hdepart : ScheideDepartureReturn T i1 i2 v1 v2) : + Disjoint (MissingColors G phi v2) (TreeFreeColors phi T) := by + classical + rw [Finset.disjoint_left] + intro beta hbeta hbetaFree + let X := TreeSequenceVertexSet T + have horder := ScheideGlobalMaximumOrder G k e0 phi T hglobal + have hfacts := ScheideGlobalMaximumBoundaryFacts G k e0 phi T hglobal + have hunused := ScheideGlobalMaximumUnused G k e0 phi T hglobal + have hproper : IsProperEdgeColoring G phi := hglobal.1.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := hglobal.1.2.2.2.2 + have htree : TashkinovTree G e0 phi T := hglobal.2.1 + have helem : ColoredVertexSetElementary G phi X := by + exact horder.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi X := by + exact horder.2.2.2.2 + have hv2X : v2 ∈ X := by simpa [X] using hdepart.2.2.2.2.2.2.1 + have hbMissing : beta ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v2, by simpa [X] using hv2X, hbeta⟩ + have hgMissing : gamma ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨u, hu, hgamma⟩ + have hv2_ne_u : v2 ≠ u := by + intro hvu + have heq : p.getVert i2.val = p.getVert 0 := by + rw [hdepart.2.2.2.2.2.1, hvu] + simp + have hi20 : i2.val = 0 := hp.2.1.getVert_injOn + (Nat.le_of_lt_succ i2.isLt) (Nat.zero_le _) heq + have hi12 := hdepart.2.2.2.2.1 + omega + have hbg : beta ≠ gamma := by + intro h + have hd := Finset.disjoint_left.mp (helem hu (by simpa [X] using hv2X) hv2_ne_u.symm) + exact hd hgamma (h ▸ hbeta) + have halpha_present : ∀ w, w ∈ X → alpha ∈ PresentColors G phi w := by + intro w hw + have hcard : 0 < (BoundaryColorEdges G phi X alpha).card := by + have hc : 3 ≤ (BoundaryColorEdges G phi X alpha).card := by + simpa [X] using (hfacts.2.2 alpha halpha).2 + omega + obtain ⟨f, hf⟩ := Finset.card_pos.mp hcard + have hnot : alpha ∉ MissingColors G phi w := by + intro hm + exact hclosed (Finset.mem_filter.mp hf).1 hw (Finset.mem_filter.mp hf).2 hm + simpa [MissingColors] using hnot + have hag : alpha ≠ gamma := by + intro h + have hpresent := halpha_present u (by simpa [X] using hu) + have hnot : gamma ∉ PresentColors G phi u := by + simpa [MissingColors] using hgamma + exact hnot (h ▸ hpresent) + have hab : alpha ≠ beta := by + intro h + have hpresent := halpha_present v2 hv2X + have hnot : beta ∉ PresentColors G phi v2 := by + simpa [MissingColors] using hbeta + exact hnot (h ▸ hpresent) + have hbetaBoundary : BoundaryColorEdges G phi X beta = ∅ := by + simpa [X] using hfacts.2.1 beta hbMissing + have hgammaBoundary : BoundaryColorEdges G phi X gamma = ∅ := by + simpa [X] using hfacts.2.1 gamma hgMissing + have ends_eq_of_mem : ∀ {q : Sym2 V} {x y : V}, x ∈ q → y ∈ q → x ≠ y → + q = s(x, y) := by + intro q x y hx hy hxy + induction q using Sym2.inductionOn with + | _ a b => + simp only [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> + simp_all [] + let phi1 := OutsideTreeColorSwap T phi beta gamma + have hswap1 := OutsideTreeColorSwapStable T ∅ phi beta gamma hproper hone + hclosed hbMissing hgMissing hbg + have hproper1 : IsProperEdgeColoring G phi1 := by + simpa [phi1] using hswap1.1 + have hone1 : IsOneEdgeUncolored phi1 e0 := by + simpa [phi1] using hswap1.2.1 + have hmissing1 : ∀ w, w ∈ X → + MissingColors G phi1 w = MissingColors G phi w := by + intro w hw + simpa [phi1, X] using hswap1.2.2.1.2 w (by simpa [X] using hw) + have htreeFixed1 : ∀ f, TreeIncidentEdge T f → phi1 f = phi f := by + intro f hf + simpa [phi1] using hswap1.2.2.2 f hf + have hbeta1 : beta ∈ MissingColors G phi1 v2 := by + rw [hmissing1 v2 hv2X] + exact hbeta + have hi2lt : i2.val < p.length := by + by_contra hn + have hi2eq : i2.val = p.length := by omega + have hz : p.getVert i2.val = Sum.inl z := by simp [hi2eq] + have : v2 = z := Sum.inl.inj (hdepart.2.2.2.2.2.1.symm.trans hz) + exact hp.2.2.1 (this ▸ (by simpa [X] using hv2X)) + have hfirstNode : ∃ fR : E, p.getVert (i2.val + 1) = Sum.inr fR := by + have hadj := p.adj_getVert_succ hi2lt + rw [hdepart.2.2.2.2.2.1] at hadj + cases hq : p.getVert (i2.val + 1) with + | inl w => + rw [hq] at hadj + exfalso + simp [TwoColorIncidenceGraph] at hadj + | inr f => exact ⟨f, rfl⟩ + exact @helper_continuation_700 V E inferInstance inferInstance inferInstance G k + e0 phi T hglobal alpha gamma halpha (by assumption) u hgamma z p hp i1 i2 v1 v2 hdepart + beta hbeta hbetaFree horder hfacts hunused hproper htree hv2X hbg hag hab hbetaBoundary + hgammaBoundary ends_eq_of_mem hproper1 hone1 hmissing1 htreeFixed1 hbeta1 hi2lt hfirstNode +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveChainPath.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveChainPath.lean new file mode 100644 index 0000000000..c17aed9da2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveChainPath.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent + +/-! +# Scheide Defective Chain Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A simple two-color path spanning its component from a tree vertex to an outside vertex. -/ +def ScheideDefectiveChainPath {V E : Type*} {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha gamma : Fin k) (u z : V) + (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)) : Prop := + u ∈ TreeSequenceVertexSet T ∧ + p.IsPath ∧ + z ∉ TreeSequenceVertexSet T ∧ + {x | x ∈ p.support} = TwoColorComponent G phi alpha gamma (Sum.inl u) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveChainPathExists.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveChainPathExists.lean new file mode 100644 index 0000000000..8283995ff7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveChainPathExists.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DefectiveColorComponentPath + +/-! +# Scheide Defective Chain Path Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideDefectiveChainPathExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) + (alpha gamma : Fin k) + (halpha : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T)) + (_ : gamma ∈ TreeFreeColors phi T) + (u : V) (hu : u ∈ TreeSequenceVertexSet T) + (hgamma : gamma ∈ MissingColors G phi u) : + ∃ (z : V) + (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk + (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p := by + classical + exact P2968_T1_DefectiveColorComponentPath G k e0 phi T hglobal alpha gamma halpha u hu hgamma + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveCrossingSelection.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveCrossingSelection.lean new file mode 100644 index 0000000000..bb4493813d --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveCrossingSelection.lean @@ -0,0 +1,554 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Defective Crossing Selection + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem ScheideDefectiveCrossingSelection_hg3_279.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i := D.gammaIndex d; + let X := TreeSequenceVertexSet T; + let U := {C.blockVertex i 0, C.blockVertex i 1}; + let Z := X \ U; ( + ∀ (e f : E), e ∈ BoundaryColorEdges G phi X (↑d : Fin k) → f ∈ BoundaryColorEdges G phi X (↑d + : Fin k) → e ≠ f → ¬(( + ∃ a ∈ U, Incident G a e) ∧ + ∃ a ∈ U, Incident G a f)) → + ∀ (a b c : E), a ∈ BoundaryColorEdges G phi X (↑d : Fin k) → b ∈ BoundaryColorEdges G phi X + (↑d : Fin k) → c ∈ BoundaryColorEdges G phi X (↑d : Fin k) → a ≠ b → a ≠ c → b ≠ c → ( + ∀ e ∈ BoundaryColorEdges G phi X (↑d : Fin k), e = D.f0 d ∨ ( + ∃ z ∈ Z, + ∃ w ∉ X, G.ends e = s(z, w)) ∨ + ∃ a ∈ U, Incident G a e) → + ∃ g3 ∈ BoundaryColorEdges G phi X (↑d : Fin k), g3 ≠ D.f0 d ∧ + ∃ z3 ∈ Z, + ∃ w3 ∉ X, G.ends g3 = s(z3, w3) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d i X U Z hu_unique a b c ha hb hc hab hac hbc split_edge + have finish : ∀ e, e ∈ BoundaryColorEdges G phi X d.1 → e ≠ D.f0 d → + (∃ z ∈ Z, ∃ w ∉ X, G.ends e = s(z,w)) → + ∃ g3, g3 ∈ BoundaryColorEdges G phi X d.1 ∧ g3 ≠ D.f0 d ∧ + ∃ z ∈ Z, ∃ w ∉ X, G.ends g3 = s(z,w) := by + intro e he hne hext + exact ⟨e, he, hne, hext⟩ + have choose : ∀ e, e ∈ BoundaryColorEdges G phi X d.1 → + e = D.f0 d ∨ + (∃ z ∈ Z, ∃ w ∉ X, G.ends e = s(z,w)) ∨ + ∃ a ∈ U, Incident G a e := split_edge + rcases choose a ha with hae | hae | hau + · rcases choose b hb with hbe | hbe | hbu + · exact False.elim (hab (hae.trans hbe.symm)) + · exact finish b hb (by intro h; exact hab (h ▸ hae)) hbe + · rcases choose c hc with hce | hce | hcu + · exact False.elim (hac (hae.trans hce.symm)) + · exact finish c hc (by intro h; exact hac (h ▸ hae)) hce + · exact False.elim (hu_unique b c hb hc hbc ⟨hbu, hcu⟩) + · by_cases hane : a = D.f0 d + · rcases choose b hb with hbe | hbe | hbu + · exact False.elim (hab (hane.trans hbe.symm)) + · exact finish b hb (by intro h; exact hab (h ▸ hane)) hbe + · rcases choose c hc with hce | hce | hcu + · exact False.elim (hac (hane.trans hce.symm)) + · exact finish c hc (by intro h; exact hac (h ▸ hane)) hce + · exact False.elim (hu_unique b c hb hc hbc ⟨hbu, hcu⟩) + · exact finish a ha hane hae + · rcases choose b hb with hbe | hbe | hbu + · rcases choose c hc with hce | hce | hcu + · exact False.elim (hbc (hbe.trans hce.symm)) + · exact finish c hc (by intro h; exact hbc (h ▸ hbe)) hce + · exact False.elim (hu_unique a c ha hc hac ⟨hau, hcu⟩) + · by_cases hbne : b = D.f0 d + · rcases choose c hc with hce | hce | hcu + · exact False.elim (hbc (hbne.trans hce.symm)) + · exact finish c hc (by intro h; exact hbc (h ▸ hbne)) hce + · exact False.elim (hu_unique a c ha hc hac ⟨hau, hcu⟩) + · exact finish b hb hbne hbe + · exact False.elim (hu_unique a b ha hb hab ⟨hau, hbu⟩) + +private theorem helper_hu01_145.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → C.blockVertex i + (0 : Fin (2 : ℕ)) ≠ C.blockVertex i (1 : Fin (2 : ℕ)) := by + classical + intro V E _ _ _ G k e0 phi T C D d i hlen h + have hv := C.block_vertex_position i 0 + have hw := C.block_vertex_position i 1 + have hi := i.isLt + have hp := C.p_ge_two + have heq : T.vertex ⟨C.p + 2 * i.val, + by omega⟩ = T.vertex ⟨C.p + 2 * i.val + 1, by omega⟩ := by + have hv' : T.vertex ⟨C.p + 2 * i.val, by omega⟩ = C.blockVertex i 0 := by + simpa using hv + have hw' : T.vertex ⟨C.p + 2 * i.val + 1, by omega⟩ = C.blockVertex i 1 := by + simpa using hw + rw [hv', hw', h] + have hi' := T.vertex_injective heq + have hval : C.p + 2 * i.val ≠ C.p + 2 * i.val + 1 := by omega + exact hval (congrArg Fin.val hi') + +private theorem helper_hv0X_192.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; D.v0 d ∈ X := by + classical + intro V E _ _ _ G k e0 phi T C D d X + have hv := D.v0_is_exit d + have hv'' : D.v0 d ∈ (Finset.univ.filter fun v => ScheideExitVertex T phi v) := by + simpa [ScheideExitVertices] using hv + have hv' : ScheideExitVertex T phi (D.v0 d) := (Finset.mem_filter.mp hv'').2 + rcases hv' with ⟨u, gamma, delta, hu, hgamma, hdelta, z, path, hpath, r, hr, hrv, htail⟩ + exact hrv + +private theorem helper_hv0base_201.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let X : Finset V := TreeSequenceVertexSet T; T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → + ColoredVertexSetElementary G phi X → D.v0 d ∈ X → C.gamma i ∈ MissingColors G phi (D.v0 d) + → + ∃ (q : Fin C.p), D.v0 d = C.y q := by + classical + intro V E _ _ _ G k e0 phi T C D d i X hlen helem hv0X hv0gamma + obtain ⟨r, hr⟩ := C.exit_covered (D.v0 d) (D.v0_is_exit d) + obtain ⟨q, hq⟩ := C.block_color_missing_on_base i + have hsame : r = i := + (C.exit_exactly_one (D.v0 d) (D.v0_is_exit d)).unique hr hv0gamma + have hmq : C.gamma i ∈ MissingColors G phi (C.y q) := by simpa [hsame] using hq + by_cases heq : D.v0 d = C.y q + · exact ⟨q, heq⟩ + · exfalso + have hqX : C.y q ∈ X := by + simp only [X, TreeSequenceVertexSet, Finset.mem_image] + exact ⟨⟨q.val, by have hp := C.p_ge_two; omega⟩, Finset.mem_univ _, + C.base_vertex_position q⟩ + exact Finset.disjoint_left.mp (helem hv0X hqX heq) + hv0gamma hmq + +private theorem helper_base_block_ne_222.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + ∀ (q : Fin C.p) (j : Fin (2 : ℕ)), C.y q ≠ C.blockVertex i j := by + classical + intro V E _ _ _ G k e0 phi T C D d i q j heq + have hq := q.isLt + have hi := i.isLt + have hj := j.isLt + have he := C.base_vertex_position q + have hb := C.block_vertex_position i j + have hpos := T.vertex_injective (he.trans (heq ▸ hb.symm)) + have hp := C.p_ge_two + have hpos' := congrArg Fin.val hpos + simp at hpos' + omega + +private theorem helper_hv0Z_235.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; D.v0 d ∈ X → ( + ∃ (q : Fin C.p), D.v0 d = C.y q) → ( + ∀ (q : Fin C.p) (j : Fin (2 : ℕ)), C.y q ≠ C.blockVertex i j) → D.v0 d ∈ Z := by + classical + intro V E _ _ _ _ G k e0 phi T C D d i X U Z hv0X hv0base base_block_ne + apply Finset.mem_sdiff.mpr + refine ⟨hv0X, ?_⟩ + intro hv + simp only [U, Finset.mem_insert, Finset.mem_singleton] at hv + rcases hv with hv | hv + · exact base_block_ne _ _ (hv0base.choose_spec.symm.trans hv) + · exact base_block_ne _ _ (hv0base.choose_spec.symm.trans hv) + +private theorem helper_hu2_251.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + ∀ x ∈ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V), + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + ∃ (u2 : V), (insert x ({ u2 } : Finset V) : Finset V) = U := by + classical + intro V E _ _ _ _ G k e0 phi T C D d x hx i U + have hxU : x ∈ U := by simpa [U, i] using hx + rcases Finset.mem_insert.mp hxU with hxeq | hxeq + · refine ⟨C.blockVertex i 1, ?_⟩ + simp [U, hxeq] + · have hxeq' : x = C.blockVertex i 1 := by simpa using hxeq + refine ⟨C.blockVertex i 0, ?_⟩ + simp [U, hxeq', Finset.pair_comm] + +private theorem helper_hu12_262.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (x : V), + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); U.card = (2 : ℕ) → + ∀ (u2 : V), (insert x ({ u2 } : Finset V) : Finset V) = U → u2 ∈ U → x ≠ u2 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d x i U hu_card u2 hpair hu2U h + subst u2 + have := hu_card + rw [← hpair] at this + simp at this + +private theorem helper_hbad_291.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (g1 : E), + ∀ x ∈ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V), Incident G x + g1 → + ∀ z1 ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V), Incident G z1 + g1 → + let i : Fin C.s := D.gammaIndex d; + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); x ∈ X → G.ends g1 = s(x, z1) + → + ∀ (u2 : V), (insert x ({ u2 } : Finset V) : Finset V) = U → x ∈ U → x ≠ u2 → g1 ∉ + BoundaryColorEdges G phi X (↑d : Fin k) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d g1 x hx hxg1 z1 hz1 hz1g1 i X U hxX hg1ends u2 hpair hu1U + hu12 h + have hb := (Finset.mem_filter.mp h).1 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hb + rcases hb with ⟨a, ha, b, hb, he⟩ + have hmem : b ∈ s(x,z1) := by + rw [← hg1ends, he] + simp + have : b = x ∨ b = z1 := by simpa using hmem + rcases this with rfl | rfl + · exact hb hxX + · exact hb (Finset.mem_sdiff.mp hz1).1 + +private theorem helper_hu_endpoint_309.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (g1 : E), phi g1 = some (↑d + : Fin k) → + ∀ (x : V), Incident G x g1 → + let i : Fin C.s := D.gammaIndex d; + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); IsProperEdgeColoring G phi → + g1 ∉ BoundaryColorEdges G phi X (↑d : Fin k) → + ∀ e ∈ BoundaryColorEdges G phi X (↑d : Fin k), + ∀ a ∈ U, Incident G a e → a ≠ x := by + classical + intro V E _ _ _ _ G k e0 phi T C D d g1 hg1 x hxg1 i X U hproper hbad e he a ha hae hax + have heg : e ≠ g1 := by + intro heq + exact hbad (by simpa [heq] using he) + have hadj : AdjacentEdges G e g1 := by + unfold AdjacentEdges + exact ⟨a, hae, by simpa [hax] using hxg1⟩ + have hce := (Finset.mem_filter.mp he).2 + exact (hproper heg hadj hce) hg1 + +private theorem helper_hu_unique_320.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (x : V), + let i : Fin C.s := D.gammaIndex d; + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); IsProperEdgeColoring G phi → + ∀ (u2 : V), (insert x ({ u2 } : Finset V) : Finset V) = U → ( + ∀ e ∈ BoundaryColorEdges G phi X (↑d : Fin k), + ∀ a ∈ U, Incident G a e → a ≠ x) → + ∀ (e f : E), e ∈ BoundaryColorEdges G phi X (↑d : Fin k) → f ∈ BoundaryColorEdges G phi X (↑d + : Fin k) → e ≠ f → ¬(( + ∃ a ∈ U, Incident G a e) ∧ + ∃ a ∈ U, Incident G a f) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d x i X U hproper u2 hpair hu_endpoint e f he hf hef hn + rcases hn with ⟨⟨ae, hae, heae⟩, ⟨af, haf, hafinc⟩⟩ + have heax : ae ≠ x := hu_endpoint e he ae hae heae + have hafx : af ≠ x := hu_endpoint f hf af haf hafinc + have hae2 : ae = u2 := by + rw [← hpair] at hae + simpa [Finset.mem_insert, heax] using hae + have haf2 : af = u2 := by + rw [← hpair] at haf + simpa [Finset.mem_insert, hafx] using haf + subst ae + subst af + have hadj : AdjacentEdges G e f := ⟨u2, heae, hafinc⟩ + exact (hproper hef hadj (Finset.mem_filter.mp he).2) (Finset.mem_filter.mp hf).2 + +private theorem helper_split_edge_339.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := + (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : + Finset V); + let Z : Finset V := X \ U; + (∀ e ∈ BoundaryColorEdges G phi X (↑d : Fin k), ∃ a ∈ X, ∃ b ∉ X, G.ends e = s(a, b)) → + ∀ e ∈ BoundaryColorEdges G phi X (↑d : Fin k), + e = D.f0 d ∨ (∃ z ∈ Z, ∃ w ∉ X, G.ends e = s(z, w)) ∨ ∃ a ∈ U, Incident G a e := by + classical + intro V E _ _ _ _ G k e0 phi T C D d i X U Z hparts e he + obtain ⟨v, hv, w, hw, hev⟩ := hparts e he + by_cases hvU : v ∈ U + · exact Or.inr (Or.inr ⟨v, hvU, by simp [Incident, hev]⟩) + · exact Or.inr (Or.inl ⟨v, Finset.mem_sdiff.mpr ⟨hv, hvU⟩, w, hw, hev⟩) + +theorem ScheideDefectiveCrossingSelection {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (g1 : E) (hg1 : phi g1 = some d.1) + (x : V) (hx : x ∈ ({C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} : Finset V)) + (hxg1 : Incident G x g1) + (z1 : V) (hz1 : z1 ∈ TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1}) + (hz1g1 : Incident G z1 g1) : + let i := D.gammaIndex d + let X := TreeSequenceVertexSet T + let U := ({C.blockVertex i 0, C.blockVertex i 1} : Finset V) + let Z := X \ U + ∃ u1 u2 : V, ∃ g2 g3 : E, ∃ z3 w3 : V, + ({u1, u2} : Finset V) = U ∧ x = u1 ∧ + u1 ≠ u2 ∧ u1 ∈ U ∧ u2 ∈ U ∧ u1 ∈ X ∧ u2 ∈ X ∧ + D.v0 d ∈ Z ∧ + C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ Z ∧ + D.alpha0 ≠ C.gamma i ∧ D.alpha0 ≠ d.1 ∧ C.gamma i ≠ d.1 ∧ + G.ends g1 = s(u1, z1) ∧ + phi g2 = some D.alpha0 ∧ G.ends g2 = s(u1, u2) ∧ + g3 ∈ BoundaryColorEdges G phi X d.1 ∧ g3 ≠ D.f0 d ∧ + z3 ∈ Z ∧ w3 ∉ X ∧ G.ends g3 = s(z3, w3) ∧ + g1 ≠ g2 ∧ g1 ≠ g3 ∧ g2 ≠ g3 := by + classical + dsimp + let i := D.gammaIndex d + let X := TreeSequenceVertexSet T + let U := ({C.blockVertex i 0, C.blockVertex i 1} : Finset V) + let Z := X \ U + have hlen := C.length_eq + have hu01 : C.blockVertex i 0 ≠ C.blockVertex i 1 := by + exact @helper_hu01_145 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@C) (@D) (@d) (@hlen) + have hu0X : C.blockVertex i 0 ∈ X := by + simp only [X, TreeSequenceVertexSet, Finset.mem_image] + have hp := C.p_ge_two + exact ⟨⟨C.p + 2 * i.val, by omega⟩, + Finset.mem_univ _, C.block_vertex_position i 0⟩ + have hu1X : C.blockVertex i 1 ∈ X := by + simp only [X, TreeSequenceVertexSet, Finset.mem_image] + have hp := C.p_ge_two + exact ⟨⟨C.p + 2 * i.val + 1, by omega⟩, + Finset.mem_univ _, C.block_vertex_position i 1⟩ + have hxX : x ∈ X := by + rcases (show x = C.blockVertex i 0 ∨ x = C.blockVertex i 1 by simpa [i] using hx) with rfl | rfl + · exact hu0X + · exact hu1X + have hu_card : U.card = 2 := by simp [U, hu01] + have hpair_mem : ∀ {a b : V} {e : E}, a ∈ G.ends e → b ∈ G.ends e → + a ≠ b → G.ends e = s(a,b) := by + intro a b e ha hb hab + change a ∈ G.ends e at ha + change b ∈ G.ends e at hb + exact (Sym2.mem_and_mem_iff hab).mp ⟨ha, hb⟩ + have hg1ends : G.ends g1 = s(x,z1) := by + apply hpair_mem hxg1 hz1g1 + intro h + exact (Finset.mem_sdiff.mp hz1).2 (by simpa [h] using hx) + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have helem : ColoredVertexSetElementary G phi X := by + exact horder.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi X := by + exact horder.2.2.2.2 + have hproper : IsProperEdgeColoring G phi := C.globally_maximum.1.2.2.2.1 + have hv0X : D.v0 d ∈ X := by + exact @helper_hv0X_192 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@C) (@D) (@d) + have hv0gamma : C.gamma i ∈ MissingColors G phi (D.v0 d) := + D.gamma_missing_at_v0 d + have hv0base : ∃ q : Fin C.p, D.v0 d = C.y q := by + exact @helper_hv0base_201 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hlen) (@helem) (@hv0X) (@hv0gamma) + have hy0X : C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ X := by + simp only [X, TreeSequenceVertexSet, Finset.mem_image] + have hp := C.p_ge_two + exact ⟨⟨0, by omega⟩, Finset.mem_univ _, C.base_vertex_position ⟨0, by omega⟩⟩ + have hy0base : ∃ q : Fin C.p, C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ = C.y q := + ⟨⟨0, by have hp := C.p_ge_two; omega⟩, rfl⟩ + have base_block_ne : ∀ q : Fin C.p, ∀ j : Fin 2, + C.y q ≠ C.blockVertex i j := by + exact @helper_base_block_ne_222 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) + have hv0Z : D.v0 d ∈ Z := by + exact @helper_hv0Z_235 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hv0X) (@hv0base) (@base_block_ne) + have hy0Z : C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ Z := by + apply Finset.mem_sdiff.mpr + refine ⟨hy0X, ?_⟩ + simp only [U, Finset.mem_insert, Finset.mem_singleton] + intro hv + rcases hv with hv | hv + · exact base_block_ne _ _ hv + · exact base_block_ne _ _ hv + have hu2 : ∃ u2 : V, ({x, u2} : Finset V) = U := by + exact @helper_hu2_251 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@x) (@hx) + rcases hu2 with ⟨u2, hpair⟩ + have hu2U : u2 ∈ U := by rw [← hpair]; simp + have hu1U : x ∈ U := hx + have hu12 : x ≠ u2 := by + exact @helper_hu12_262 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@x) (@hu_card) (@u2) (@hpair) (@hu2U) + have hu2X : u2 ∈ X := by + simp only [U, Finset.mem_insert, Finset.mem_singleton] at hu2U + rcases hu2U with h | h + · simpa [h] using hu0X + · simpa [h] using hu1X + have halpha_gamma : D.alpha0 ≠ C.gamma i := D.alpha0_not_block i + have hg2 := ScheideStructuralInternalPair G k e0 phi T C i D.alpha0 + halpha_gamma ⟨_, hy0Z, D.alpha0_missing_at_y0⟩ + rcases hg2 with ⟨g2, hg2color, hg2ends⟩ + have hfacts := ScheideGlobalMaximumBoundaryFacts G k e0 phi T C.globally_maximum + have hBcard : 3 ≤ (BoundaryColorEdges G phi X d.1).card := by + simpa [X] using (hfacts.2.2 d.1 d.2).2 + have hdnot : ∀ v, v ∈ X → d.1 ∉ MissingColors G phi v := by + intro v hv hm + obtain ⟨b, hb⟩ := Finset.card_pos.mp (by omega : 0 < (BoundaryColorEdges G phi X d.1).card) + have hbc := Finset.mem_filter.mp hb + exact hclosed hbc.1 hv hbc.2 hm + have hgammadelta : C.gamma i ≠ d.1 := by + intro h + exact hdnot (D.v0 d) hv0X (h ▸ hv0gamma) + have halphadelta : D.alpha0 ≠ d.1 := by + intro h + exact hdnot _ hy0X (h ▸ D.alpha0_missing_at_y0) + have hbad : g1 ∉ BoundaryColorEdges G phi X d.1 := by + exact @helper_hbad_291 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@g1) (@x) (@hx) (@hxg1) (@z1) (@hz1) (@hz1g1) + (@hxX) (@hg1ends) (@u2) (@hpair) (@hu1U) (@hu12) + have hparts : ∀ e, e ∈ BoundaryColorEdges G phi X d.1 → + ∃ a ∈ X, ∃ b ∉ X, G.ends e = s(a,b) := by + intro e he + have hb := (Finset.mem_filter.mp he).1 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hb + exact hb + have hu_endpoint : ∀ e, e ∈ BoundaryColorEdges G phi X d.1 → + ∀ a, a ∈ U → Incident G a e → a ≠ x := by + exact @helper_hu_endpoint_309 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@g1) (@hg1) (@x) (@hxg1) + (@hproper) (@hbad) + have hu_unique : ∀ e f, e ∈ BoundaryColorEdges G phi X d.1 → + f ∈ BoundaryColorEdges G phi X d.1 → e ≠ f → + ¬ ((∃ a ∈ U, Incident G a e) ∧ (∃ a ∈ U, Incident G a f)) := by + exact @helper_hu_unique_320 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@x) (@hproper) (@u2) (@hpair) (@hu_endpoint) + obtain ⟨a, b, c, ha, hb, hc, hab, hac, hbc⟩ := + Finset.two_lt_card_iff.mp (lt_of_lt_of_le (by omega) hBcard) + have split_edge : ∀ e, e ∈ BoundaryColorEdges G phi X d.1 → + e = D.f0 d ∨ (∃ z ∈ Z, ∃ w ∉ X, G.ends e = s(z,w)) ∨ + ∃ a ∈ U, Incident G a e := by + exact @helper_split_edge_339 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hparts) + have hg3 : ∃ g3, g3 ∈ BoundaryColorEdges G phi X d.1 ∧ g3 ≠ D.f0 d ∧ + ∃ z3 ∈ Z, ∃ w3 ∉ X, G.ends g3 = s(z3,w3) := by + exact @ScheideDefectiveCrossingSelection_hg3_279 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D d hu_unique a b c ha hb hc hab hac hbc + split_edge + rcases hg3 with ⟨g3, hg3B, hg3f0, z3, hz3, w3, hw3, hg3ends⟩ + have hg2ends' : G.ends g2 = s(x,u2) := by + have hx' : x = C.blockVertex i 0 ∨ x = C.blockVertex i 1 := by simpa [U] using hu1U + have hu' : u2 = C.blockVertex i 0 ∨ u2 = C.blockVertex i 1 := by simpa [U] using hu2U + rcases hx' with rfl | rfl <;> rcases hu' with rfl | rfl <;> simp_all [] + refine ⟨x, u2, g2, g3, z3, w3, by simpa [i] using hpair, rfl, hu12, hu1U, hu2U, + hxX, hu2X, hv0Z, hy0Z, halpha_gamma, halphadelta, hgammadelta, + hg1ends, hg2color, hg2ends', hg3B, hg3f0, hz3, hw3, hg3ends, ?_, ?_, ?_⟩ + · intro h + exact halphadelta (Option.some.inj ((h ▸ hg2color).symm.trans hg1)) + · intro h + exact hbad (h ▸ hg3B) + · intro h + exact halphadelta (Option.some.inj (hg2color.symm.trans (h ▸ (Finset.mem_filter.mp hg3B).2))) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean new file mode 100644 index 0000000000..fc6341b91a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean @@ -0,0 +1,811 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData +public import LeanPool.GoldbergSeymour.ScheideDefectiveSecondTerminalComponent +public import LeanPool.GoldbergSeymour.ScheideDefectiveTerminalComponent +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideSelectedBlockDeletion +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Defective Deleted Tree Pair + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation619Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let _ : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let phi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let psi2 : PartialEdgeColoring E k := TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) + (Sum.inl R.v1); StableColoring T ∅ phi (OutsideTreeColorSwap T phi D.alpha0 (C.gamma + (D.gammaIndex d))) → StableColoring T ∅ phi (OutsideTreeColorSwap T phi (C.gamma + (D.gammaIndex d)) (C.gamma R.blockIndex)) → (↑d : Fin k) ∈ MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) R.v1 → + TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) (D.f0 d) = some (↑d : + Fin k) → ( + have C_1 : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) + (Sum.inl (D.v0 d)); ( + ∀ (v : V), Sum.inl v ∉ C_1 → MissingColors G phi' v = MissingColors G phi1 v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C_1 → gamma ∈ MissingColors G phi1 v → (↑d : Fin k) ∈ MissingColors G + phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C_1 → (↑d : Fin k) ∈ MissingColors G phi1 v → gamma ∈ MissingColors G + phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ gamma → c ≠ (↑d : Fin k) → (c ∈ MissingColors G phi' v ↔ c ∈ + MissingColors G phi1 v)) → ( + have C_1 : Set (V ⊕ E) := TwoColorComponent G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) + (Sum.inl R.v1); ( + ∀ (v : V), Sum.inl v ∉ C_1 → MissingColors G phi' v = MissingColors G psi1 v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C_1 → gammaJ ∈ MissingColors G psi1 v → (↑d : Fin k) ∈ MissingColors G + phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C_1 → (↑d : Fin k) ∈ MissingColors G psi1 v → gammaJ ∈ MissingColors G + phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ gammaJ → c ≠ (↑d : Fin k) → (c ∈ MissingColors G phi' v ↔ c ∈ + MissingColors G psi1 v)) → (↑d : Fin k) ∈ MissingColors G phi2 (D.v0 d) → phi2 R.f1 = some + (↑d : Fin k) → + ∀ (Tgamma : TreeSequence G e0), TreeSequenceVertexSet Tgamma = TreeSequenceVertexSet T \ + {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))} → Tgamma.length + + (2 : ℕ) = T.length → ( + ∀ (a : Fin C.p), + ∃ (q : Fin (Tgamma.length + (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ Tgamma.vertex q = C.y a) → ( + ∀ (q : Fin Tgamma.length), ( + ∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ Tgamma.edge q = C.baseEdge a) ∨ + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), r ≠ i ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ Tgamma.edge q = + C.blockEdge r j) → + ∀ (TgammaJ : TreeSequence G e0), TreeSequenceVertexSet TgammaJ = TreeSequenceVertexSet T \ + {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))} → TgammaJ.length + + (2 : ℕ) = T.length → ( + ∀ (a : Fin C.p), + ∃ (q : Fin (TgammaJ.length + (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ TgammaJ.vertex q = C.y a) → ( + ∀ (q : Fin TgammaJ.length), ( + ∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ TgammaJ.edge q = C.baseEdge a) ∨ + ∃ (r : Fin C.s) (j_1 : Fin (2 : ℕ)), r ≠ j ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ TgammaJ.edge q = + C.blockEdge r j_1) → TashkinovTree G e0 phi T → Disjoint (DefectiveColors G phi + (TreeSequenceVertexSet T)) (TreeUsedColors phi T) ∧ Disjoint (TreeFreeColors phi T) + (TreeUsedColors phi T) → ( + ∀ (q : Fin T.length) (c : Fin k), phi (T.edge q) = some c → phi2 (T.edge q) = some c) → ( + ∀ (q : Fin T.length) (c : Fin k), phi (T.edge q) = some c → psi2 (T.edge q) = some c) → + ∃ (Sgamma : TreeSequence G e0) (SgammaJ : TreeSequence G e0), TashkinovTree G e0 + (TwoColorComponentSwap G (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) Sgamma ∧ TreeSequenceVertexSet + Sgamma = TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ { R.u1 } ∧ TashkinovTree G e0 + (TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) SgammaJ ∧ + TreeSequenceVertexSet SgammaJ = TreeSequenceVertexSet T \ {C.blockVertex R.blockIndex (0 : + Fin (2 : ℕ)), C.blockVertex R.blockIndex (1 : Fin (2 : ℕ))} ∪ {D.u0 d} ∧ + TwoColorComponentSwap G (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) R.f1 = some (↑d : Fin k) ∧ + TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) (D.f0 d) = some (↑d : + Fin k) + +private theorem helper_htreeGamma_196.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let phi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + ∀ (Tgamma : TreeSequence G e0), Tgamma.length + (2 : ℕ) = T.length → ( + ∀ (a : Fin C.p), + ∃ (q : Fin (Tgamma.length + (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ Tgamma.vertex q = C.y a) → ( + ∀ (q : Fin Tgamma.length), ( + ∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ Tgamma.edge q = C.baseEdge a) ∨ + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), r ≠ i ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ Tgamma.edge q = + C.blockEdge r j) → + ∀ (TgammaJ : TreeSequence G e0), TgammaJ.length + (2 : ℕ) = T.length → TashkinovTree G e0 phi + T → Disjoint (DefectiveColors G phi (TreeSequenceVertexSet T)) (TreeUsedColors phi T) ∧ + Disjoint (TreeFreeColors phi T) (TreeUsedColors phi T) → ( + ∀ (q : Fin T.length) (c : Fin k), phi (T.edge q) = some c → phi2 (T.edge q) = some c) → ( + ∀ v ∈ X, + ∀ (c : Fin k), c ≠ gamma → c ≠ (↑d : Fin k) → (c ∈ MissingColors G phi2 v ↔ c ∈ MissingColors + G phi v)) → TashkinovTree G e0 phi2 Tgamma := by + classical + intro V E _ _ _ G k e0 phi T C D d X i gamma phi1 phi2 Tgamma hTgammaLength hTgammaBaseVertices + hTgammaEdgeCases TgammaJ hTgammaJLength htreeOld hunused edge_color_phi2 missing_unaffected + q hq + rcases hTgammaEdgeCases q with + ⟨a, hqa, hqe⟩ | ⟨r, b, hri, hqbase, hqe⟩ + · have haPos : 1 ≤ a.val := by omega + let oldq : Fin T.length := ⟨a.val, by omega⟩ + obtain ⟨w, c, hc, hm⟩ := htreeOld oldq haPos + have hwP : w.val < C.p := by + have hw := w.isLt + dsimp [oldq] at hw + omega + let wp : Fin C.p := ⟨w.val, hwP⟩ + obtain ⟨ws, hwsval, hws⟩ := hTgammaBaseVertices wp + have hwq : w.val < q.val + 1 := by + have hw := w.isLt + dsimp [oldq] at hw + omega + let wn : Fin (q.val + 1) := ⟨w.val, hwq⟩ + have hcast : Fin.castLT wn + (Nat.lt_trans wn.isLt (Nat.succ_lt_succ q.isLt)) = ws := by + apply Fin.ext + simpa [wn] using hwsval.symm + have holdedge : T.edge oldq = C.baseEdge a := by + simpa [oldq] using C.base_edge_position a + have hcbase : phi (C.baseEdge a) = some c := holdedge ▸ hc + have hcGamma : c ≠ gamma := by + simpa [gamma, i] using + C.initial_nonfirst_avoids_blocks a haPos c hcbase i + have hcUsed : c ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨oldq, haPos, hc⟩ + have hcDelta : c ≠ d.1 := by + intro heq + exact (Finset.disjoint_left.mp hunused.1) d.2 (heq ▸ hcUsed) + refine ⟨wn, c, ?_, ?_⟩ + · rw [hqe, ← holdedge] + exact edge_color_phi2 oldq c hc + · rw [hcast, hws] + have hvwpX : C.y wp ∈ X := by + rw [← C.base_vertex_position wp] + simp [X, TreeSequenceVertexSet] + have holdvertex : T.vertex + (Fin.castLT w (Nat.lt_trans w.isLt (Nat.succ_lt_succ oldq.isLt))) = + C.y wp := by + have hidx : Fin.castLT w + (Nat.lt_trans w.isLt (Nat.succ_lt_succ oldq.isLt)) = + (⟨wp.val, by omega⟩ : Fin (T.length + 1)) := by + apply Fin.ext + rfl + rw [hidx] + exact C.base_vertex_position wp + have hmwp : c ∈ MissingColors G phi (C.y wp) := by + simpa only [holdvertex] using hm + exact (missing_unaffected (C.y wp) hvwpX c hcGamma hcDelta).mpr hmwp + · obtain ⟨w, hwmissing⟩ := C.block_color_missing_on_base r + obtain ⟨ws, hwsval, hws⟩ := hTgammaBaseVertices w + let wn : Fin (q.val + 1) := ⟨w.val, by omega⟩ + have hcast : Fin.castLT wn + (Nat.lt_trans wn.isLt (Nat.succ_lt_succ q.isLt)) = ws := by + apply Fin.ext + simpa [wn] using hwsval.symm + have hrgamma : C.gamma r ≠ gamma := by + intro h + exact hri (C.gamma_injective (by simpa [gamma, i] using h)) + let oldq : Fin T.length := ⟨C.p - 1 + 2 * r.val + b.val, by + have hr := r.isLt + have hb := b.isLt + have hlen := C.length_eq + omega⟩ + have hrdelta : C.gamma r ≠ d.1 := by + intro h + have hused : d.1 ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨oldq, by + have hp := C.p_ge_two + simp [oldq] + omega, ?_⟩ + rw [show T.edge oldq = C.blockEdge r b by + simpa [oldq] using C.block_edge_position r b] + simpa [h] using C.block_color r b + exact (Finset.disjoint_left.mp hunused.1) d.2 hused + have holdedge : T.edge oldq = C.blockEdge r b := by + simpa only [oldq] using C.block_edge_position r b + have hcold : phi (T.edge oldq) = some (C.gamma r) := by + rw [holdedge] + exact C.block_color r b + refine ⟨wn, C.gamma r, ?_, ?_⟩ + · rw [hqe, ← holdedge] + exact edge_color_phi2 oldq (C.gamma r) hcold + · rw [hcast, hws] + exact (missing_unaffected (C.y w) (by + rw [← C.base_vertex_position w] + simp [X, TreeSequenceVertexSet]) + (C.gamma r) hrgamma hrdelta).mpr hwmissing + +private theorem helper_htreeGammaJ_291.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let psi2 : PartialEdgeColoring E k := TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) + (Sum.inl R.v1); + ∀ (_ TgammaJ : TreeSequence G e0), TgammaJ.length + (2 : ℕ) = T.length → ( + ∀ (a : Fin C.p), + ∃ (q : Fin (TgammaJ.length + (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ TgammaJ.vertex q = C.y a) → ( + ∀ (q : Fin TgammaJ.length), ( + ∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ TgammaJ.edge q = C.baseEdge a) ∨ + ∃ (r : Fin C.s) (j_1 : Fin (2 : ℕ)), r ≠ j ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ TgammaJ.edge q = + C.blockEdge r j_1) → TashkinovTree G e0 phi T → Disjoint (DefectiveColors G phi + (TreeSequenceVertexSet T)) (TreeUsedColors phi T) ∧ Disjoint (TreeFreeColors phi T) + (TreeUsedColors phi T) → ( + ∀ (q : Fin T.length) (c : Fin k), phi (T.edge q) = some c → psi2 (T.edge q) = some c) → ( + ∀ v ∈ X, + ∀ (c : Fin k), c ≠ gammaJ → c ≠ (↑d : Fin k) → (c ∈ MissingColors G psi2 v ↔ c ∈ MissingColors + G phi v)) → TashkinovTree G e0 psi2 TgammaJ := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ psi1 psi2 Tgamma TgammaJ + hTgammaJLength hTgammaJBaseVertices hTgammaJEdgeCases htreeOld hunused edge_color_psi2 + missing_unaffectedJ q hq + rcases hTgammaJEdgeCases q with + ⟨a, hqa, hqe⟩ | ⟨r, b, hrj, hqbase, hqe⟩ + · have haPos : 1 ≤ a.val := by omega + let oldq : Fin T.length := ⟨a.val, by omega⟩ + obtain ⟨w, c, hc, hm⟩ := htreeOld oldq haPos + have hwP : w.val < C.p := by + have hw := w.isLt + dsimp [oldq] at hw + omega + let wp : Fin C.p := ⟨w.val, hwP⟩ + obtain ⟨ws, hwsval, hws⟩ := hTgammaJBaseVertices wp + have hwq : w.val < q.val + 1 := by + have hw := w.isLt + dsimp [oldq] at hw + omega + let wn : Fin (q.val + 1) := ⟨w.val, hwq⟩ + have hcast : Fin.castLT wn + (Nat.lt_trans wn.isLt (Nat.succ_lt_succ q.isLt)) = ws := by + apply Fin.ext + simpa [wn] using hwsval.symm + have holdedge : T.edge oldq = C.baseEdge a := by + simpa [oldq] using C.base_edge_position a + have hcbase : phi (C.baseEdge a) = some c := holdedge ▸ hc + have hcGammaJ : c ≠ gammaJ := by + simpa [gammaJ, j] using + C.initial_nonfirst_avoids_blocks a haPos c hcbase j + have hcUsed : c ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨oldq, haPos, hc⟩ + have hcDelta : c ≠ d.1 := by + intro heq + exact (Finset.disjoint_left.mp hunused.1) d.2 (heq ▸ hcUsed) + refine ⟨wn, c, ?_, ?_⟩ + · rw [hqe, ← holdedge] + exact edge_color_psi2 oldq c hc + · rw [hcast, hws] + have hvwpX : C.y wp ∈ X := by + rw [← C.base_vertex_position wp] + simp [X, TreeSequenceVertexSet] + have holdvertex : T.vertex + (Fin.castLT w (Nat.lt_trans w.isLt (Nat.succ_lt_succ oldq.isLt))) = + C.y wp := by + have hidx : Fin.castLT w + (Nat.lt_trans w.isLt (Nat.succ_lt_succ oldq.isLt)) = + (⟨wp.val, by omega⟩ : Fin (T.length + 1)) := by + apply Fin.ext + rfl + rw [hidx] + exact C.base_vertex_position wp + have hmwp : c ∈ MissingColors G phi (C.y wp) := by + simpa only [holdvertex] using hm + exact (missing_unaffectedJ (C.y wp) hvwpX c hcGammaJ hcDelta).mpr hmwp + · obtain ⟨w, hwmissing⟩ := C.block_color_missing_on_base r + obtain ⟨ws, hwsval, hws⟩ := hTgammaJBaseVertices w + let wn : Fin (q.val + 1) := ⟨w.val, by omega⟩ + have hcast : Fin.castLT wn + (Nat.lt_trans wn.isLt (Nat.succ_lt_succ q.isLt)) = ws := by + apply Fin.ext + simpa [wn] using hwsval.symm + have hrgamma : C.gamma r ≠ gammaJ := by + intro h + exact hrj (C.gamma_injective (by simpa [gammaJ, j] using h)) + let oldq : Fin T.length := ⟨C.p - 1 + 2 * r.val + b.val, by + have hr := r.isLt + have hb := b.isLt + have hlen := C.length_eq + omega⟩ + have hrdelta : C.gamma r ≠ d.1 := by + intro h + have hused : d.1 ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨oldq, by + have hp := C.p_ge_two + simp [oldq] + omega, ?_⟩ + rw [show T.edge oldq = C.blockEdge r b by + simpa [oldq] using C.block_edge_position r b] + simpa [h] using C.block_color r b + exact (Finset.disjoint_left.mp hunused.1) d.2 hused + have holdedge : T.edge oldq = C.blockEdge r b := by + simpa only [oldq] using C.block_edge_position r b + have hcold : phi (T.edge oldq) = some (C.gamma r) := by + rw [holdedge] + exact C.block_color r b + refine ⟨wn, C.gamma r, ?_, ?_⟩ + · rw [hqe, ← holdedge] + exact edge_color_psi2 oldq (C.gamma r) hcold + · rw [hcast, hws] + exact (missing_unaffectedJ (C.y w) (by + rw [← C.base_vertex_position w] + simp [X, TreeSequenceVertexSet]) + (C.gamma r) hrgamma hrdelta).mpr hwmissing + +private theorem helper_tashkinov_adjoin_386.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let phi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + ∀ (_ _ S U : TreeSequence G e0) (f : E), TreeSequenceAdjoinEdge S f U → TashkinovTree G e0 + phi2 S → + ∀ (c : Fin k), phi2 f = some c → + ∀ v ∈ TreeSequenceVertexSet S, c ∈ MissingColors G phi2 v → TashkinovTree G e0 phi2 U := by + classical + intro V E _ _ _ G k e0 phi T C D d i gamma phi1 phi2 Tgamma TgammaJ S U f hadjoin hS c hf v hv + hmiss + rcases hadjoin with ⟨hlen, hinitial, hlast⟩ + rcases hinitial with ⟨hle, hvert, hedge⟩ + intro q hq + by_cases hold : q.val < S.length + · let qS : Fin S.length := ⟨q.val, hold⟩ + obtain ⟨a, color, hcolor, hcolorMissing⟩ := + hS qS (by simpa [qS] using hq) + let aU : Fin (q.val + 1) := ⟨a.val, by simpa [qS] using a.isLt⟩ + refine ⟨aU, color, ?_, ?_⟩ + · have hqeq : Fin.castLE hle qS = q := by + apply Fin.ext + rfl + have hUedge : U.edge q = S.edge qS := by + rw [← hqeq] + exact hedge qS + rw [hUedge] + exact hcolor + · let oldVertexIndex : Fin (S.length + 1) := + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ qS.isLt)) + let newVertexIndex : Fin (U.length + 1) := + Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) oldVertexIndex = + newVertexIndex := by + apply Fin.ext + rfl + have hvertex : U.vertex newVertexIndex = S.vertex oldVertexIndex := by + rw [← hindex] + exact hvert oldVertexIndex + simpa [oldVertexIndex, newVertexIndex] using hvertex.symm ▸ hcolorMissing + · have hqval : q.val = S.length := by + have hqbound : q.val < S.length + 1 := by simpa [hlen] using q.isLt + omega + obtain ⟨a, ha⟩ : ∃ a : Fin (S.length + 1), S.vertex a = v := by + simpa [TreeSequenceVertexSet] using hv + let aU : Fin (q.val + 1) := ⟨a.val, by simpa [hqval] using a.isLt⟩ + refine ⟨aU, c, ?_, ?_⟩ + · have hqlast : q = Fin.cast hlen.symm (Fin.last S.length) := by + apply Fin.ext + simpa using hqval + rw [hqlast, hlast] + exact hf + · let newVertexIndex : Fin (U.length + 1) := + Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) a = + newVertexIndex := by + apply Fin.ext + rfl + have hvertex : U.vertex newVertexIndex = v := by + rw [← hindex, hvert a, ha] + simpa [newVertexIndex, hvertex] using hmiss + +private theorem helper_tashkinov_adjoinJ_443.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let psi2 : PartialEdgeColoring E k := TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) + (Sum.inl R.v1); + ∀ (_ _ S U : TreeSequence G e0) (f : E), TreeSequenceAdjoinEdge S f U → TashkinovTree G e0 + psi2 S → + ∀ (c : Fin k), psi2 f = some c → + ∀ v ∈ TreeSequenceVertexSet S, c ∈ MissingColors G psi2 v → TashkinovTree G e0 psi2 U := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R i j gamma gammaJ psi1 psi2 Tgamma TgammaJ S U f hadjoin + hS c hf v hv hmiss + rcases hadjoin with ⟨hlen, hinitial, hlast⟩ + rcases hinitial with ⟨hle, hvert, hedge⟩ + intro q hq + by_cases hold : q.val < S.length + · let qS : Fin S.length := ⟨q.val, hold⟩ + obtain ⟨a, color, hcolor, hcolorMissing⟩ := + hS qS (by simpa [qS] using hq) + let aU : Fin (q.val + 1) := ⟨a.val, by simpa [qS] using a.isLt⟩ + refine ⟨aU, color, ?_, ?_⟩ + · have hqeq : Fin.castLE hle qS = q := by + apply Fin.ext + rfl + have hUedge : U.edge q = S.edge qS := by + rw [← hqeq] + exact hedge qS + rw [hUedge] + exact hcolor + · let oldVertexIndex : Fin (S.length + 1) := + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ qS.isLt)) + let newVertexIndex : Fin (U.length + 1) := + Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) oldVertexIndex = + newVertexIndex := by + apply Fin.ext + rfl + have hvertex : U.vertex newVertexIndex = S.vertex oldVertexIndex := by + rw [← hindex] + exact hvert oldVertexIndex + simpa [oldVertexIndex, newVertexIndex] using hvertex.symm ▸ hcolorMissing + · have hqval : q.val = S.length := by + have hqbound : q.val < S.length + 1 := by simpa [hlen] using q.isLt + omega + obtain ⟨a, ha⟩ : ∃ a : Fin (S.length + 1), S.vertex a = v := by + simpa [TreeSequenceVertexSet] using hv + let aU : Fin (q.val + 1) := ⟨a.val, by simpa [hqval] using a.isLt⟩ + refine ⟨aU, c, ?_, ?_⟩ + · have hqlast : q = Fin.cast hlen.symm (Fin.last S.length) := by + apply Fin.ext + simpa using hqval + rw [hqlast, hlast] + exact hf + · let newVertexIndex : Fin (U.length + 1) := + Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) a = + newVertexIndex := by + apply Fin.ext + rfl + have hvertex : U.vertex newVertexIndex = v := by + rw [← hindex, hvert a, ha] + simpa [newVertexIndex, hvertex] using hmiss + +private theorem helper_adjoin_vertex_set_500.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : + LooplessMultigraph V E) (e0 : E) (A B : TreeSequence G e0) (f : E) (x y : V), G.ends f = + s(x, y) → y ∉ TreeSequenceVertexSet A → TreeSequenceAdjoinEdge A f B → + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by + classical + intro V E _ G e0 A B f x y hxy hyA hAB + rcases hAB with ⟨hlen, hinit, hlast⟩ + rcases hinit with ⟨hle, hvertices, hedges⟩ + have holdSubset : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨q, hq⟩ := hv + refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ + rw [hvertices] + exact hq + have hyB : y ∈ TreeSequenceVertexSet B := by + let q : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨a, ha⟩ := B.attaches q + have hyEnds : y ∈ G.ends (B.edge q) := by + rw [hlast, hxy] + simp + rw [ha] at hyEnds + rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨q.succ, hynew.symm⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)), + hyold.symm⟩ + have hinsert : insert y (TreeSequenceVertexSet A) ⊆ + TreeSequenceVertexSet B := by + intro v hv + simp only [Finset.mem_insert] at hv + rcases hv with rfl | hv + · exact hyB + · exact holdSubset hv + have hAcard : (TreeSequenceVertexSet A).card = A.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + A.vertex_injective] + have hBcard : (TreeSequenceVertexSet B).card = B.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + B.vertex_injective] + have hcard : (TreeSequenceVertexSet B).card ≤ + (insert y (TreeSequenceVertexSet A)).card := by + rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] + exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm + +private theorem helper_continuation_619.{u_1, u_2} : + helperContinuation619Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ phi1 phi2 psi1 psi2 hstable1 + hstableJ1 hdeltaMissingJ2 hf0colorJ2 hbehavior hbehaviorJ hdeltaMissing2 hf1color2 Tgamma + hTgammaVertices hTgammaLength hTgammaBaseVertices hTgammaEdgeCases TgammaJ hTgammaJVertices + hTgammaJLength hTgammaJBaseVertices hTgammaJEdgeCases htreeOld hunused edge_color_phi2 + edge_color_psi2 + have missing_unaffected (v : V) (hvX' : v ∈ X) (c : Fin k) + (hcg : c ≠ gamma) (hcd : c ≠ d.1) : + (c ∈ MissingColors G phi2 v ↔ c ∈ MissingColors G phi v) := by + have h1 : MissingColors G phi1 v = MissingColors G phi v := + hstable1.2 v (by simpa [X] using hvX') + rw [← h1] + exact hbehavior.2.2.2 v c hcg hcd + have missing_unaffectedJ (v : V) (hvX' : v ∈ X) (c : Fin k) + (hcg : c ≠ gammaJ) (hcd : c ≠ d.1) : + (c ∈ MissingColors G psi2 v ↔ c ∈ MissingColors G phi v) := by + have h1 : MissingColors G psi1 v = MissingColors G phi v := + hstableJ1.2 v (by simpa [X] using hvX') + rw [← h1] + exact hbehaviorJ.2.2.2 v c hcg hcd + have htreeGamma := @helper_htreeGamma_196 V E inferInstance inferInstance inferInstance G k e0 phi + T C D d Tgamma hTgammaLength hTgammaBaseVertices hTgammaEdgeCases TgammaJ hTgammaJLength + htreeOld hunused edge_color_phi2 missing_unaffected + have htreeGammaJ := @helper_htreeGammaJ_291 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R Tgamma TgammaJ hTgammaJLength hTgammaJBaseVertices + hTgammaJEdgeCases htreeOld hunused edge_color_psi2 missing_unaffectedJ + have tashkinov_adjoin := @helper_tashkinov_adjoin_386 V E inferInstance inferInstance + inferInstance G k e0 phi T C D d Tgamma TgammaJ + have tashkinov_adjoinJ := @helper_tashkinov_adjoinJ_443 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D d R Tgamma TgammaJ + have adjoin_vertex_set (A B : TreeSequence G e0) (f : E) (x y : V) + (hxy : G.ends f = s(x, y)) (hxA : x ∈ TreeSequenceVertexSet A) + (hyA : y ∉ TreeSequenceVertexSet A) + (hAB : TreeSequenceAdjoinEdge A f B) : + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by + exact @helper_adjoin_vertex_set_500 V E inferInstance G e0 A B f x y hxy hyA hAB + have hv0Gamma : D.v0 d ∈ TreeSequenceVertexSet Tgamma := by + obtain ⟨a, _, ha⟩ := Finset.mem_image.mp + (ScheideStructuralExitsInBase G k e0 phi T C (D.v0_is_exit d)) + obtain ⟨q, hq, hvertex⟩ := hTgammaBaseVertices a + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨q, hvertex.trans ha⟩ + have hv1Gamma : R.v1 ∈ TreeSequenceVertexSet Tgamma := by + obtain ⟨a, _, ha⟩ := Finset.mem_image.mp R.v1_in_base + obtain ⟨q, hq, hvertex⟩ := hTgammaBaseVertices a + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨q, hvertex.trans ha⟩ + have hu1NotGamma : R.u1 ∉ TreeSequenceVertexSet Tgamma := by + rw [hTgammaVertices] + exact fun h => R.u1_outside (Finset.mem_sdiff.mp h).1 + have hf1Boundary : R.f1 ∈ BoundaryEdges G (TreeSequenceVertexSet Tgamma) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨R.v1, hv1Gamma, R.u1, hu1NotGamma, R.f1_ends⟩ + obtain ⟨Sgamma, hAdjoinGamma⟩ := + TreeSequenceBoundaryEdgeAppendExists Tgamma R.f1 hf1Boundary + have hSgammaTash : TashkinovTree G e0 phi2 Sgamma := + tashkinov_adjoin Tgamma Sgamma R.f1 hAdjoinGamma htreeGamma d.1 + hf1color2 (D.v0 d) hv0Gamma hdeltaMissing2 + have hSgammaVertices0 : TreeSequenceVertexSet Sgamma = + insert R.u1 (TreeSequenceVertexSet Tgamma) := + adjoin_vertex_set Tgamma Sgamma R.f1 R.v1 R.u1 R.f1_ends + hv1Gamma hu1NotGamma hAdjoinGamma + have hSgammaVertices : TreeSequenceVertexSet Sgamma = + (TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1}) ∪ {R.u1} := by + rw [hSgammaVertices0, hTgammaVertices] + simp [i, Finset.union_singleton] + have hv0GammaJ : D.v0 d ∈ TreeSequenceVertexSet TgammaJ := by + obtain ⟨a, _, ha⟩ := Finset.mem_image.mp + (ScheideStructuralExitsInBase G k e0 phi T C (D.v0_is_exit d)) + obtain ⟨q, hq, hvertex⟩ := hTgammaJBaseVertices a + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨q, hvertex.trans ha⟩ + have hv1GammaJ : R.v1 ∈ TreeSequenceVertexSet TgammaJ := by + obtain ⟨a, _, ha⟩ := Finset.mem_image.mp R.v1_in_base + obtain ⟨q, hq, hvertex⟩ := hTgammaJBaseVertices a + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨q, hvertex.trans ha⟩ + have hu0NotGammaJ : D.u0 d ∉ TreeSequenceVertexSet TgammaJ := by + rw [hTgammaJVertices] + exact fun h => D.u0_outside d (Finset.mem_sdiff.mp h).1 + have hf0Boundary : D.f0 d ∈ BoundaryEdges G + (TreeSequenceVertexSet TgammaJ) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨D.v0 d, hv0GammaJ, D.u0 d, hu0NotGammaJ, D.f0_ends d⟩ + obtain ⟨SgammaJ, hAdjoinGammaJ⟩ := + TreeSequenceBoundaryEdgeAppendExists TgammaJ (D.f0 d) hf0Boundary + have hSgammaJTash : TashkinovTree G e0 psi2 SgammaJ := + tashkinov_adjoinJ TgammaJ SgammaJ (D.f0 d) hAdjoinGammaJ + htreeGammaJ d.1 hf0colorJ2 R.v1 hv1GammaJ hdeltaMissingJ2 + have hSgammaJVertices0 : TreeSequenceVertexSet SgammaJ = + insert (D.u0 d) (TreeSequenceVertexSet TgammaJ) := + adjoin_vertex_set TgammaJ SgammaJ (D.f0 d) (D.v0 d) (D.u0 d) + (D.f0_ends d) hv0GammaJ hu0NotGammaJ hAdjoinGammaJ + have hSgammaJVertices : TreeSequenceVertexSet SgammaJ = + (TreeSequenceVertexSet T \ + {C.blockVertex R.blockIndex 0, + C.blockVertex R.blockIndex 1}) ∪ {D.u0 d} := by + rw [hSgammaJVertices0, hTgammaJVertices] + simp [j, Finset.union_singleton] + exact ⟨Sgamma, SgammaJ, hSgammaTash, hSgammaVertices, + hSgammaJTash, hSgammaJVertices, hf1color2, hf0colorJ2⟩ + +theorem ScheideDefectiveDeletedTreePair {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideDefectiveReturnData G k e0 phi T C D d) : + let gamma := C.gamma (D.gammaIndex d) + let gammaJ := C.gamma R.blockIndex + let phi1 := OutsideTreeColorSwap T phi D.alpha0 gamma + let phi2 := TwoColorComponentSwap G phi1 gamma d.1 (Sum.inl (D.v0 d)) + let psi1 := OutsideTreeColorSwap T phi gamma gammaJ + let psi2 := TwoColorComponentSwap G psi1 gammaJ d.1 (Sum.inl R.v1) + ∃ Sgamma SgammaJ : TreeSequence G e0, + TashkinovTree G e0 phi2 Sgamma ∧ + TreeSequenceVertexSet Sgamma = + (TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1}) ∪ {R.u1} ∧ + TashkinovTree G e0 psi2 SgammaJ ∧ + TreeSequenceVertexSet SgammaJ = + (TreeSequenceVertexSet T \ + {C.blockVertex R.blockIndex 0, + C.blockVertex R.blockIndex 1}) ∪ {D.u0 d} ∧ + phi2 R.f1 = some d.1 ∧ psi2 (D.f0 d) = some d.1 := by + classical + dsimp only + let X := TreeSequenceVertexSet T + let i := D.gammaIndex d + let j := R.blockIndex + let gamma := C.gamma i + let gammaJ := C.gamma j + let phi1 := OutsideTreeColorSwap T phi D.alpha0 gamma + let K := TwoColorComponent G phi1 gamma d.1 (Sum.inl (D.v0 d)) + let phi2 := TwoColorComponentSwap G phi1 gamma d.1 (Sum.inl (D.v0 d)) + let psi1 := OutsideTreeColorSwap T phi gamma gammaJ + let KJ := TwoColorComponent G psi1 gammaJ d.1 (Sum.inl R.v1) + let psi2 := TwoColorComponentSwap G psi1 gammaJ d.1 (Sum.inl R.v1) + have hterminal := ScheideDefectiveTerminalComponent G k e0 phi T C D d + dsimp only at hterminal + rcases hterminal with + ⟨hproper1, hone1, hstable1, hfixed1, htailK, hf0K, hKtree, + htreeEdgesOutside, hKcolors⟩ + have hterminalJ := + ScheideDefectiveSecondTerminalComponent G k e0 phi T C D d R + dsimp only at hterminalJ + rcases hterminalJ with + ⟨hproperJ1, honeJ1, hstableJ1, hfixedJ1, htailKJ, hf1KJ, hKJtree, + htreeEdgesOutsideJ, hf1colorJ1, hproperJ2, honeJ2, hdeltaMissingJ2, + hotherMissingJ2, hf0colorJ2⟩ + have tree_edge_incident : ∀ q : Fin T.length, TreeIncidentEdge T (T.edge q) := by + intro q + obtain ⟨a, ha⟩ := T.attaches q + refine ⟨T.vertex q.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · simp [Incident, ha] + have component_vertex_of_edge {v : V} {e : E} + (heK : Sum.inr e ∈ K) (hve : Incident G v e) + (hecolor : phi1 e = some gamma ∨ phi1 e = some d.1) : + Sum.inl v ∈ K := by + let H := TwoColorIncidenceGraph G phi1 gamma d.1 + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using ⟨hve, hecolor⟩ + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk (Sum.inl (D.v0 d)) at heK + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inl (D.v0 d)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans heK + have hv0X : D.v0 d ∈ X := by + have hv0base := ScheideStructuralExitsInBase G k e0 phi T C (D.v0_is_exit d) + obtain ⟨a, _, ha⟩ := Finset.mem_image.mp hv0base + rw [← ha, ← C.base_vertex_position a] + simp [X, TreeSequenceVertexSet] + have hv1X : R.v1 ∈ X := by simpa [X] using R.v1_mem + have hgammaDelta : gamma ≠ d.1 := by simpa [gamma, i] using R.gamma_ne_delta + have hgammaJDelta : gammaJ ≠ d.1 := by + simpa [gammaJ, j] using R.gammaJ_ne_delta + have hbehavior := TwoColorComponentSwapMissingBehavior G phi1 gamma d.1 + hgammaDelta hproper1 (Sum.inl (D.v0 d)) + have hbehaviorJ := TwoColorComponentSwapMissingBehavior G psi1 gammaJ d.1 + hgammaJDelta hproperJ1 (Sum.inl R.v1) + have hgammaMissing1 : gamma ∈ MissingColors G phi1 (D.v0 d) := by + rw [hstable1.2 (D.v0 d) (by simpa [X] using hv0X)] + simpa [gamma, i] using D.gamma_missing_at_v0 d + have hdeltaMissing2 : d.1 ∈ MissingColors G phi2 (D.v0 d) := by + simpa [phi2, K] using + hbehavior.2.1 (D.v0 d) (by rfl) hgammaMissing1 + have hphi1f1 : phi1 R.f1 = some d.1 := by + apply (hfixed1 R.f1 ?_).trans R.f1_color + exact ⟨R.v1, by simpa [X] using hv1X, + by simp [Incident, R.f1_ends]⟩ + have hf1NotK : Sum.inr R.f1 ∉ K := by + intro hf1K + have hv1f1 : Incident G R.v1 R.f1 := by + simp [Incident, R.f1_ends] + have hv1K := component_vertex_of_edge hf1K hv1f1 (Or.inr hphi1f1) + exact R.v1_ne_v0 ((hKtree R.v1 (by simpa [X] using hv1X)).mp hv1K) + have hf1color2 : phi2 R.f1 = some d.1 := by + simp [phi2, TwoColorComponentSwap, K, hf1NotK, hphi1f1] + obtain ⟨Tgamma, hTgammaVertices, hTgammaLength, hTgammaVertexReindex, + hTgammaEdgeReindex, hTgammaBaseVertices, hTgammaBaseEdges, + hTgammaBlockEntries, hTgammaEdgeCases, hTgammaEdgeOld, + hTgammaNotIncident⟩ := + ScheideSelectedBlockDeletion G k e0 phi T C i + obtain ⟨TgammaJ, hTgammaJVertices, hTgammaJLength, + hTgammaJVertexReindex, hTgammaJEdgeReindex, hTgammaJBaseVertices, + hTgammaJBaseEdges, hTgammaJBlockEntries, hTgammaJEdgeCases, + hTgammaJEdgeOld, hTgammaJNotIncident⟩ := + ScheideSelectedBlockDeletion G k e0 phi T C j + have htreeOld : TashkinovTree G e0 phi T := C.globally_maximum.2.1 + have hunused := ScheideGlobalMaximumUnused G k e0 phi T C.globally_maximum + have edge_color_phi2 (q : Fin T.length) (c : Fin k) + (hc : phi (T.edge q) = some c) : phi2 (T.edge q) = some c := by + have hc1 : phi1 (T.edge q) = some c := + (hfixed1 _ (tree_edge_incident q)).trans hc + have hout : Sum.inr (T.edge q) ∉ K := by + simpa [K] using htreeEdgesOutside q + simp [phi2, TwoColorComponentSwap, K, hout, hc1] + have edge_color_psi2 (q : Fin T.length) (c : Fin k) + (hc : phi (T.edge q) = some c) : psi2 (T.edge q) = some c := by + have hc1 : psi1 (T.edge q) = some c := + (hfixedJ1 _ (tree_edge_incident q)).trans hc + have hout : Sum.inr (T.edge q) ∉ KJ := by + simpa [KJ] using htreeEdgesOutsideJ q + simp [psi2, TwoColorComponentSwap, KJ, hout, hc1] + exact @helper_continuation_619 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R hstable1 hstableJ1 hdeltaMissingJ2 hf0colorJ2 hbehavior hbehaviorJ + hdeltaMissing2 hf1color2 Tgamma hTgammaVertices hTgammaLength hTgammaBaseVertices + hTgammaEdgeCases TgammaJ hTgammaJVertices hTgammaJLength hTgammaJBaseVertices + hTgammaJEdgeCases htreeOld hunused edge_color_phi2 edge_color_psi2 +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveLastReturnExists.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveLastReturnExists.lean new file mode 100644 index 0000000000..b4f0d1eacd --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveLastReturnExists.lean @@ -0,0 +1,369 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Defective Last Return Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hv1ExitProp_194.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; ScheideDefectiveChainPath T + phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (D.v0 d) (D.replacementZ d) (D.replacementPath + d) → + let indices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | + ∃ (x : V), p.getVert (↑r : ℕ) = Sum.inl x ∧ x ∈ X}; + ∀ (hindices : indices.Nonempty), + let i : Fin (p.length + (1 : ℕ)) := indices.max' hindices; + ∀ (v1 : V), p.getVert (↑i : ℕ) = Sum.inl v1 → v1 ∈ X → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) < (↑r : ℕ) → + ∀ (x : V), p.getVert (↑r : ℕ) = Sum.inl x → x ∉ X) → ScheideExitVertex T phi v1 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X p hp indices hindices i v1 hiv1 hv1X hafter + let gamma := C.gamma (D.gammaIndex d) + let swapHom : TwoColorIncidenceGraph G phi gamma d.1 →g + TwoColorIncidenceGraph G phi d.1 gamma := + ⟨id, by + intro x y h + simpa [TwoColorIncidenceGraph, or_comm] using h⟩ + let q := p.map swapHom + have hcomponentSwap : TwoColorComponent G phi gamma d.1 (Sum.inl (D.v0 d)) = + TwoColorComponent G phi d.1 gamma (Sum.inl (D.v0 d)) := by + change ((TwoColorIncidenceGraph G phi gamma d.1).connectedComponentMk + (Sum.inl (D.v0 d)) : Set (Sum V E)) = + ((TwoColorIncidenceGraph G phi d.1 gamma).connectedComponentMk + (Sum.inl (D.v0 d)) : Set (Sum V E)) + ext x + change x ∈ ((TwoColorIncidenceGraph G phi gamma d.1).connectedComponentMk + (Sum.inl (D.v0 d))).supp ↔ + x ∈ ((TwoColorIncidenceGraph G phi d.1 gamma).connectedComponentMk + (Sum.inl (D.v0 d))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff, + SimpleGraph.ConnectedComponent.mem_supp_iff, + SimpleGraph.ConnectedComponent.eq, + SimpleGraph.ConnectedComponent.eq] + constructor + · intro h + simpa [swapHom] using h.map swapHom + · intro h + let reverseHom : TwoColorIncidenceGraph G phi d.1 gamma →g + TwoColorIncidenceGraph G phi gamma d.1 := + ⟨id, by + intro x y h + simpa [TwoColorIncidenceGraph, or_comm] using h⟩ + simpa [reverseHom] using h.map reverseHom + have hq : ScheideDefectiveChainPath T phi d.1 gamma + (D.v0 d) (D.replacementZ d) q := by + change D.v0 d ∈ X ∧ q.IsPath ∧ + D.replacementZ d ∉ X ∧ + {x | x ∈ q.support} = + TwoColorComponent G phi d.1 gamma (Sum.inl (D.v0 d)) + refine ⟨hp.1, (q.isPath_def).2 ?_, hp.2.2.1, ?_⟩ + · simpa [q, p, swapHom] using (p.isPath_def.mp hp.2.1) + · have hsupp : q.support = p.support := by simp [q, p, swapHom] + rw [hsupp, ← hcomponentSwap] + exact hp.2.2.2 + let iq : Fin (q.length + 1) := ⟨i.val, by simpa [q, p] using i.isLt⟩ + refine ⟨D.v0 d, gamma, d.1, hp.1, D.gamma_missing_at_v0 d, d.2, + D.replacementZ d, q, hq, iq, ?_, hv1X, ?_⟩ + · simpa [iq, q, p, swapHom] using hiv1 + · intro r hr x hrx + let rp : Fin (p.length + 1) := ⟨r.val, by simpa [q, p] using r.isLt⟩ + apply hafter rp + · simpa [iq, rp] using hr + · simpa [rp, q, p, swapHom] using hrx + +private theorem helper_hf1Ends_230.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; ScheideDefectiveChainPath T + phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (D.v0 d) (D.replacementZ d) (D.replacementPath + d) → + ∀ (_ : ℕ), + let indices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | + ∃ (x : V), p.getVert (↑r : ℕ) = Sum.inl x ∧ x ∈ X}; + ∀ (hindices : indices.Nonempty), + let i : Fin (p.length + (1 : ℕ)) := indices.max' hindices; + ∀ (v1 : V), p.getVert (↑i : ℕ) = Sum.inl v1 → + ∀ (f1 : E), (↑i : ℕ) + (1 : ℕ) < p.length → + ∀ (u1 : V), p.getVert ((↑i : ℕ) + (2 : ℕ)) = Sum.inl u1 → Incident G v1 f1 → Incident G u1 f1 + → G.ends f1 = s(v1, u1) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X p hp iw indices hindices i v1 hiv1 f1 hi2Length u1 hu1 + hv1Incident hu1Incident + let a := (Quot.out (G.ends f1)).1 + let b := (Quot.out (G.ends f1)).2 + have hab : s(a, b) = G.ends f1 := Quot.out_eq _ + have hva : v1 = a ∨ v1 = b := by + apply Sym2.mem_iff.mp + rw [hab] + exact hv1Incident + have hua : u1 = a ∨ u1 = b := by + apply Sym2.mem_iff.mp + rw [hab] + exact hu1Incident + have hvu : v1 ≠ u1 := by + intro hvu + have hidx := hp.2.1.getVert_injOn + (show i.val ≤ p.length by omega) (show i.val + 2 ≤ p.length by omega) + (hiv1.trans (hvu ▸ hu1).symm) + omega + rw [← hab, Sym2.eq_iff] + rcases hva with hva | hva + · rcases hua with hua | hua + · exact (hvu (hva.trans hua.symm)).elim + · exact Or.inl ⟨hva.symm, hua.symm⟩ + · rcases hua with hua | hua + · exact Or.inr ⟨hua.symm, hva.symm⟩ + · exact (hvu (hva.trans hua.symm)).elim + +theorem ScheideDefectiveLastReturnExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (w : V) (hw : w ∈ TreeSequenceVertexSet T) + (hcomponent : Sum.inl w ∈ TwoColorComponent G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d))) + (hne : w ≠ D.v0 d) : + Nonempty (ScheideDefectiveReturnData G k e0 phi T C D d) := by + classical + let X := TreeSequenceVertexSet T + let p := D.replacementPath d + have hp := D.replacement_path_full d + have hwSupport : Sum.inl w ∈ p.support := by + change Sum.inl w ∈ {x | x ∈ p.support} + rw [hp.2.2.2] + exact hcomponent + obtain ⟨iw, hiw, hiwLe⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hwSupport + let indices : Finset (Fin (p.length + 1)) := + Finset.univ.filter (fun r => ∃ x : V, p.getVert r.val = Sum.inl x ∧ x ∈ X) + have hindices : indices.Nonempty := by + refine ⟨⟨iw, by omega⟩, ?_⟩ + simp only [indices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hiw, hw⟩ + let i : Fin (p.length + 1) := indices.max' hindices + have hi : i ∈ indices := Finset.max'_mem indices hindices + obtain ⟨v1, hiv1, hv1X⟩ := (Finset.mem_filter.mp hi).2 + have hiwMem : (⟨iw, by omega⟩ : Fin (p.length + 1)) ∈ indices := by + simp only [indices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hiw, hw⟩ + have hiwPos : 0 < iw := by + by_contra hn + have hiwZero : iw = 0 := by omega + have hwv0 : w = D.v0 d := by + apply Sum.inl.inj + calc + Sum.inl w = p.getVert iw := hiw.symm + _ = p.getVert 0 := by rw [hiwZero] + _ = Sum.inl (D.v0 d) := p.getVert_zero + exact hne hwv0 + have hiPos : 0 < i.val := by + have hle := Finset.le_max' indices (⟨iw, by omega⟩ : Fin (p.length + 1)) hiwMem + have hleVal : iw ≤ i.val := Fin.le_iff_val_le_val.mp hle + omega + have hiLength : i.val < p.length := by + by_contra hn + have heq : i.val = p.length := by omega + have hend : p.getVert i.val = Sum.inl (D.replacementZ d) := by + rw [heq, p.getVert_length] + have hvz : v1 = D.replacementZ d := Sum.inl.inj (hiv1.symm.trans hend) + exact hp.2.2.1 (hvz ▸ hv1X) + have hi1 : i.val + 1 < p.length + 1 := by omega + have hf1Exists : ∃ f1 : E, p.getVert (i.val + 1) = Sum.inr f1 := by + cases hnode : p.getVert (i.val + 1) with + | inl x => + have hadj := p.adj_getVert_succ hiLength + rw [hiv1, hnode] at hadj + simp [TwoColorIncidenceGraph] at hadj + | inr f1 => exact ⟨f1, rfl⟩ + obtain ⟨f1, hf1⟩ := hf1Exists + have hi1NotEnd : i.val + 1 ≠ p.length := by + intro heq + have hend := p.getVert_length + rw [heq] at hf1 + exact Sum.inr_ne_inl (hf1.symm.trans hend) + have hi2Length : i.val + 1 < p.length := by omega + have hu1Exists : ∃ u1 : V, p.getVert (i.val + 2) = Sum.inl u1 := by + cases hnode : p.getVert (i.val + 2) with + | inr e => + have hadj := p.adj_getVert_succ hi2Length + rw [hf1, hnode] at hadj + simp [TwoColorIncidenceGraph] at hadj + | inl u1 => exact ⟨u1, rfl⟩ + obtain ⟨u1, hu1⟩ := hu1Exists + let edgeIndex : Fin (p.length + 1) := ⟨i.val + 1, hi1⟩ + let outsideIndex : Fin (p.length + 1) := ⟨i.val + 2, by omega⟩ + have hafter : ∀ r : Fin (p.length + 1), i.val < r.val → + ∀ x : V, p.getVert r.val = Sum.inl x → x ∉ X := by + intro r hir x hxr hx + have hr : r ∈ indices := by + simp only [indices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxr, hx⟩ + have hle := Finset.le_max' indices r hr + have hleVal : r.val ≤ i.val := Fin.le_iff_val_le_val.mp hle + omega + have hu1Outside : u1 ∉ X := by + exact hafter outsideIndex (by simp [outsideIndex]) u1 (by simpa [outsideIndex] using hu1) + have hv1Ne : v1 ≠ D.v0 d := by + intro heq + have hidx := hp.2.1.getVert_injOn + (show i.val ≤ p.length by omega) (show 0 ≤ p.length by omega) + (show p.getVert i.val = p.getVert 0 by simpa [heq] using hiv1) + omega + have hv1f1Adj := p.adj_getVert_succ hiLength + have hf1u1Adj := p.adj_getVert_succ hi2Length + have hv1Incident : Incident G v1 f1 := by + rw [hiv1, hf1] at hv1f1Adj + have htemp : Incident G v1 f1 ∧ + (phi f1 = some (C.gamma (D.gammaIndex d)) ∨ phi f1 = some d.1) := by + simpa [TwoColorIncidenceGraph] using hv1f1Adj + exact htemp.1 + have hu1Incident : Incident G u1 f1 := by + rw [hf1, hu1] at hf1u1Adj + have htemp : Incident G u1 f1 ∧ + (phi f1 = some (C.gamma (D.gammaIndex d)) ∨ phi f1 = some d.1) := by + simpa [TwoColorIncidenceGraph] using hf1u1Adj + exact htemp.1 + have hf1Ends := @helper_hf1Ends_230 V E inferInstance inferInstance inferInstance inferInstance G + k e0 phi T C D d hp iw hindices v1 hiv1 f1 hi2Length u1 hu1 hv1Incident hu1Incident + have hstructure := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have helementary : ColoredVertexSetElementary G phi X := hstructure.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi X := hstructure.2.2.2.2 + have hf1Boundary : f1 ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v1, hv1X, u1, hu1Outside, hf1Ends⟩ + have hf1Color : phi f1 = some d.1 := by + have hcolors : phi f1 = some (C.gamma (D.gammaIndex d)) ∨ phi f1 = some d.1 := by + rw [hiv1, hf1] at hv1f1Adj + have htemp : Incident G v1 f1 ∧ + (phi f1 = some (C.gamma (D.gammaIndex d)) ∨ phi f1 = some d.1) := by + simpa [TwoColorIncidenceGraph] using hv1f1Adj + exact htemp.2 + rcases hcolors with hgamma | hdelta + · exact (hclosed hf1Boundary hp.1 hgamma (D.gamma_missing_at_v0 d)).elim + · exact hdelta + have hv1ExitProp := @helper_hv1ExitProp_194 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d hp hindices v1 hiv1 hv1X hafter + have hv1Exit : v1 ∈ ScheideExitVertices T phi := by + simp only [ScheideExitVertices, Finset.mem_filter, Finset.mem_univ, true_and] + exact hv1ExitProp + have hv1Base : v1 ∈ Finset.univ.image C.y := + ScheideStructuralExitsInBase G k e0 phi T C hv1Exit + obtain ⟨j, hjMissing, hjUnique⟩ := C.exit_exactly_one v1 hv1Exit + have hjNe : j ≠ D.gammaIndex d := by + intro heq + have hdisjoint := helementary hv1X hp.1 hv1Ne + exact (Finset.disjoint_left.mp hdisjoint) hjMissing + (by simpa [heq] using D.gamma_missing_at_v0 d) + have hy0X : C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ X := by + let y0Index : Fin C.p := ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hwitness : C.y y0Index ∈ TreeSequenceVertexSet T := + (@Finset.mem_image (Fin (T.length + 1)) V (Classical.decEq V)).mpr + ⟨⟨0, Nat.zero_lt_succ _⟩, Finset.mem_univ _, C.base_vertex_position y0Index⟩ + simpa only [X, y0Index] using hwitness + have hdeltaBoundaryExists : (BoundaryColorEdges G phi X d.1).Nonempty := by + have hdcard : 2 ≤ (BoundaryColorEdges G phi X d.1).card := by + have hmem : d.1 ∈ DefectiveColors G phi X := by simpa only [X] using d.2 + have hddef : DefectiveColor G phi X d.1 := by + simpa only [DefectiveColors, Finset.mem_filter, Finset.mem_univ, true_and] using hmem + exact hddef + exact Finset.card_pos.mp (by omega) + obtain ⟨fd, hfd⟩ := hdeltaBoundaryExists + have hfdBoundary : fd ∈ BoundaryEdges G X := + (Finset.mem_filter.mp hfd).1 + have hfdColor : phi fd = some d.1 := + (Finset.mem_filter.mp hfd).2 + have hdeltaNotMissing : ∀ v ∈ X, d.1 ∉ MissingColors G phi v := by + intro v hv + exact hclosed hfdBoundary hv hfdColor + have halphaDelta : D.alpha0 ≠ d.1 := by + intro heq + exact hdeltaNotMissing _ hy0X (heq ▸ D.alpha0_missing_at_y0) + have hgammaDelta : C.gamma (D.gammaIndex d) ≠ d.1 := by + intro heq + exact hdeltaNotMissing _ hp.1 (heq ▸ D.gamma_missing_at_v0 d) + have hgammaJDelta : C.gamma j ≠ d.1 := by + intro heq + exact hdeltaNotMissing _ hv1X (heq ▸ hjMissing) + have hgammaDistinct : C.gamma (D.gammaIndex d) ≠ C.gamma j := by + intro heq + exact hjNe (C.gamma_injective heq).symm + refine ⟨{ + pathIndex := i + edgeIndex := edgeIndex + outsideIndex := outsideIndex + v1 := v1 + f1 := f1 + u1 := u1 + blockIndex := j + v1_at_index := by simpa [p] using hiv1 + f1_at_index := by simpa [p, edgeIndex] using hf1 + u1_at_index := by simpa [p, outsideIndex] using hu1 + successive_indices := by simp [edgeIndex, outsideIndex] + after_last_tree_vertex := by simpa [p, X] using hafter + v1_mem := by simpa [X] using hv1X + v1_ne_v0 := hv1Ne + u1_outside := by simpa [X] using hu1Outside + v1_is_exit := hv1Exit + v1_in_base := hv1Base + f1_color := hf1Color + f1_ends := hf1Ends + gammaJ_missing := hjMissing + blockIndex_ne := hjNe + alpha0_ne_gamma := D.alpha0_not_block (D.gammaIndex d) + alpha0_ne_gammaJ := D.alpha0_not_block j + alpha0_ne_delta := halphaDelta + gamma_ne_gammaJ := hgammaDistinct + gamma_ne_delta := hgammaDelta + gammaJ_ne_delta := hgammaJDelta + }⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean new file mode 100644 index 0000000000..255306e08e --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean @@ -0,0 +1,786 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveCrossingSelection +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveTerminalComponent +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair +public import LeanPool.GoldbergSeymour.ScheideSelectedBlockDeletion +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +public import LeanPool.GoldbergSeymour.TashkinovOrderBound + +/-! +# Scheide Defective No Cross + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_htreeS_255.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + let X : Finset V := TreeSequenceVertexSet T; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let phi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + ∀ (S : TreeSequence G e0), S.length + (2 : ℕ) = T.length → ( + ∀ (a : Fin C.p), + ∃ (q : Fin (S.length + (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ S.vertex q = C.y a) → ( + ∀ (q : Fin S.length), ( + ∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ S.edge q = C.baseEdge a) ∨ + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), r ≠ i ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ S.edge q = C.blockEdge r + j) → TashkinovTree G e0 phi T → Disjoint (DefectiveColors G phi (TreeSequenceVertexSet T)) + (TreeUsedColors phi T) ∧ Disjoint (TreeFreeColors phi T) (TreeUsedColors phi T) → ( + ∀ v ∈ X, (↑d : Fin k) ∉ MissingColors G phi v) → ( + ∀ (q : Fin T.length) (c : Fin k), phi (T.edge q) = some c → phi2 (T.edge q) = some c) → ( + ∀ v ∈ X, + ∀ (c : Fin k), c ≠ gamma → c ≠ (↑d : Fin k) → (c ∈ MissingColors G phi2 v ↔ c ∈ MissingColors + G phi v)) → TashkinovTree G e0 phi2 S := by + classical + intro V E _ _ _ G k e0 phi T C D d i gamma X phi1 phi2 S hSlength hbaseVertices hedgeCases + htreeOld hunused hdeltaNotMissing edge_color_phi2 missing_unaffected q hq + rcases hedgeCases q with ⟨a, hqa, hqe⟩ | ⟨r, j, hri, hqbase, hqe⟩ + · have haPos : 1 ≤ a.val := by omega + let oldq : Fin T.length := ⟨a.val, by omega⟩ + obtain ⟨b, c, hc, hm⟩ := htreeOld oldq haPos + have hbP : b.val < C.p := by + have hb := b.isLt + dsimp [oldq] at hb + omega + let bp : Fin C.p := ⟨b.val, hbP⟩ + obtain ⟨bs, hbsval, hbs⟩ := hbaseVertices bp + have hbq : b.val < q.val + 1 := by + have hb := b.isLt + dsimp [oldq] at hb + omega + let bn : Fin (q.val + 1) := ⟨b.val, hbq⟩ + have hcast : Fin.castLT bn + (Nat.lt_trans bn.isLt (Nat.succ_lt_succ q.isLt)) = bs := by + apply Fin.ext + simpa [bn] using hbsval.symm + have holdedge : T.edge oldq = C.baseEdge a := by + simpa [oldq] using C.base_edge_position a + have hcbase : phi (C.baseEdge a) = some c := holdedge ▸ hc + have hcGamma : c ≠ gamma := by + simpa [gamma, i] using C.initial_nonfirst_avoids_blocks a haPos c hcbase i + have hcUsed : c ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨oldq, haPos, hc⟩ + have hcDelta : c ≠ d.1 := by + intro heq + exact (Finset.disjoint_left.mp hunused.1) d.2 (heq ▸ hcUsed) + refine ⟨bn, c, ?_, ?_⟩ + · rw [hqe] + rw [← holdedge] + exact edge_color_phi2 oldq c hc + · rw [hcast, hbs] + have hvbpX : C.y bp ∈ X := by + rw [← C.base_vertex_position bp] + simp [X, TreeSequenceVertexSet] + have holdvertex : T.vertex + (Fin.castLT b (Nat.lt_trans b.isLt (Nat.succ_lt_succ oldq.isLt))) = + C.y bp := by + have hidx : Fin.castLT b + (Nat.lt_trans b.isLt (Nat.succ_lt_succ oldq.isLt)) = + (⟨bp.val, by omega⟩ : Fin (T.length + 1)) := by + apply Fin.ext + rfl + rw [hidx] + exact C.base_vertex_position bp + have hmBP : c ∈ MissingColors G phi (C.y bp) := by + simpa only [holdvertex] using hm + exact (missing_unaffected (C.y bp) hvbpX c hcGamma hcDelta).mpr hmBP + · obtain ⟨b, hbmissing⟩ := C.block_color_missing_on_base r + obtain ⟨bs, hbsval, hbs⟩ := hbaseVertices b + let bn : Fin (q.val + 1) := ⟨b.val, by omega⟩ + have hcast : Fin.castLT bn + (Nat.lt_trans bn.isLt (Nat.succ_lt_succ q.isLt)) = bs := by + apply Fin.ext + simpa [bn] using hbsval.symm + have hrgamma : C.gamma r ≠ gamma := by + intro h + exact hri (C.gamma_injective (by simpa [gamma, i] using h)) + have hrdelta : C.gamma r ≠ d.1 := by + intro h + apply hdeltaNotMissing (C.y b) + · rw [← C.base_vertex_position b] + simp [X, TreeSequenceVertexSet] + · exact h ▸ hbmissing + let oldq : Fin T.length := ⟨C.p - 1 + 2 * r.val + j.val, by + have hr := r.isLt + have hj := j.isLt + have hlen := C.length_eq + omega⟩ + have holdedge : T.edge oldq = C.blockEdge r j := by + simpa only [oldq] using C.block_edge_position r j + have hcold : phi (T.edge oldq) = some (C.gamma r) := by + rw [holdedge] + exact C.block_color r j + refine ⟨bn, C.gamma r, ?_, ?_⟩ + · rw [hqe] + rw [← holdedge] + exact edge_color_phi2 oldq (C.gamma r) hcold + · rw [hcast, hbs] + exact (missing_unaffected (C.y b) (by + rw [← C.base_vertex_position b] + simp [X, TreeSequenceVertexSet]) (C.gamma r) hrgamma hrdelta).mpr hbmissing + +private theorem helper_adjoin_vertex_set_343.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : + LooplessMultigraph V E) (e0 : E) (A B : TreeSequence G e0) (f : E) (x y : V), G.ends f = + s(x, y) → y ∉ TreeSequenceVertexSet A → TreeSequenceAdjoinEdge A f B → + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by + classical + intro V E _ G e0 A B f x y hxy hyA hAB + rcases hAB with ⟨hlen, hinit, hlast⟩ + rcases hinit with ⟨hle, hvertices, hedges⟩ + have holdSubset : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨q, hq⟩ := hv + refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ + rw [hvertices] + exact hq + have hyB : y ∈ TreeSequenceVertexSet B := by + let j : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨a, ha⟩ := B.attaches j + have hyEnds : y ∈ G.ends (B.edge j) := by + rw [hlast, hxy] + simp + rw [ha] at hyEnds + rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨j.succ, hynew.symm⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt)), + hyold.symm⟩ + have hinsert : insert y (TreeSequenceVertexSet A) ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [Finset.mem_insert] at hv + rcases hv with rfl | hv + · exact hyB + · exact holdSubset hv + have hAcard : (TreeSequenceVertexSet A).card = A.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + A.vertex_injective] + have hBcard : (TreeSequenceVertexSet B).card = B.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + B.vertex_injective] + have hcard : (TreeSequenceVertexSet B).card ≤ + (insert y (TreeSequenceVertexSet A)).card := by + rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] + exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm + +private theorem helper_tree_edge_incident_279.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] + (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) (q : Fin T.length), + TreeIncidentEdge T (T.edge q) := by + classical + intro V E _ _ G e0 T q + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨a, ha⟩ := T.attaches q + refine ⟨T.vertex q.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · simp [Incident, ha] + +private theorem helper_component_vertex_of_edge_285.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let K : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + ∀ {v : V} {e : E}, Sum.inr e ∈ K → Incident G v e → phi1 e = some gamma ∨ phi1 e = some (↑d : + Fin k) → Sum.inl v ∈ K := by + classical + intro V E _ _ _ G k e0 phi T C D d i gamma phi1 K v e heK hve hecolor + let H := TwoColorIncidenceGraph G phi1 gamma d.1 + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using ⟨hve, hecolor⟩ + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk (Sum.inl (D.v0 d)) at heK + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inl (D.v0 d)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans heK + +private theorem helper_hz3v0_301.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + ∀ (g3 : E) (z3 w3 : V), D.v0 d ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex + (D.gammaIndex d) (0 : Fin (2 : ℕ))) ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : + Finset V) : Finset V) → g3 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) (↑d : Fin + k) → g3 ≠ D.f0 d → z3 ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) + (0 : Fin (2 : ℕ))) ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : + Finset V) → G.ends g3 = s(z3, w3) → + let _ : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + IsProperEdgeColoring G (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) → + ( + ∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex + d)) f = phi f) → z3 ≠ D.v0 d := by + classical + intro V E _ _ _ _ G k e0 phi T C D d i gamma g3 z3 w3 hv0Z hg3B hg3f0 hz3Z hg3ends phi1 hproper1 + hfixed1 h + have hboth := Finset.mem_sdiff.mp hz3Z + have hv := Finset.mem_sdiff.mp hv0Z + have hdeltaAtV0 : phi g3 = some d.1 := (Finset.mem_filter.mp hg3B).2 + have hphi1g3 : phi1 g3 = some d.1 := by + apply (hfixed1 g3 ?_).trans hdeltaAtV0 + exact ⟨z3, hboth.1, by simp [Incident, hg3ends]⟩ + have hphi1f0 : phi1 (D.f0 d) = some d.1 := by + apply (hfixed1 (D.f0 d) ?_).trans (D.f0_color d) + exact ⟨D.v0 d, hv.1, by simp [Incident, D.f0_ends d]⟩ + have hproperBad : g3 = D.f0 d := by + by_contra hne + exact False.elim (hproper1 hne + ⟨D.v0 d, by simpa [h] using + (by simp [Incident, hg3ends] : Incident G z3 g3), + by simp [Incident, D.f0_ends d]⟩ hphi1g3 hphi1f0) + exact hg3f0 hproperBad + +private theorem helper_hg1notK_326.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (g1 : E) (z1 : V), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + ∀ u1 ∈ TreeSequenceVertexSet T, G.ends g1 = s(u1, z1) → + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let K : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) ↔ v = D.v0 d) → ( + ∀ {v : V} {e : E}, Sum.inr e ∈ K → Incident G v e → phi1 e = some gamma ∨ phi1 e = some (↑d : + Fin k) → Sum.inl v ∈ K) → u1 ≠ D.v0 d → phi1 g1 = some (↑d : Fin k) → Sum.inr g1 ∉ K := by + classical + intro V E _ _ _ G k e0 phi T C D d g1 z1 i gamma u1 hu1X hg1ends phi1 K hKtree + component_vertex_of_edge hu1v0 hphi1g1 hg1K + have hu1g1 : Incident G u1 g1 := by + change u1 ∈ G.ends g1 + rw [hg1ends] + simp + have hu1K := component_vertex_of_edge hg1K hu1g1 (Or.inr hphi1g1) + exact hu1v0 ((hKtree u1 hu1X).mp hu1K) + +private theorem helper_hg3notK_339.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + ∀ (g3 : E) (z3 w3 : V), z3 ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) + (0 : Fin (2 : ℕ))) ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : + Finset V) → G.ends g3 = s(z3, w3) → + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let K : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) ↔ v = D.v0 d) → ( + ∀ {v : V} {e : E}, Sum.inr e ∈ K → Incident G v e → phi1 e = some gamma ∨ phi1 e = some (↑d : + Fin k) → Sum.inl v ∈ K) → z3 ≠ D.v0 d → phi1 g3 = some (↑d : Fin k) → Sum.inr g3 ∉ K := by + classical + intro V E _ _ _ _ G k e0 phi T C D d i gamma g3 z3 w3 hz3Z hg3ends phi1 K hKtree + component_vertex_of_edge hz3v0 hphi1g3 hg3K + have hz3g3 : Incident G z3 g3 := by + change z3 ∈ G.ends g3 + rw [hg3ends] + simp + have hz3K := component_vertex_of_edge hg3K hz3g3 (Or.inr hphi1g3) + exact hz3v0 ((hKtree z3 (Finset.mem_sdiff.mp hz3Z).1).mp hz3K) + +private theorem helper_hone2_351.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + IsOneEdgeUncolored (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) e0 → + let phi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); IsOneEdgeUncolored phi2 e0 := by + classical + intro V E _ _ _ G k e0 phi T C D d i gamma phi1 K hone1 phi2 + constructor + · have he0 : phi1 e0 = none := by simpa [phi1, gamma, i] using hone1.1 + simp [phi2, TwoColorComponentSwap, he0] + · intro f hfe + obtain ⟨c, hc⟩ := hone1.2 f hfe + by_cases hfK' : Sum.inr f ∈ K + · by_cases hcg : phi1 f = some gamma + · exact ⟨d.1, by simp [phi2, TwoColorComponentSwap, K, hfK', hcg]⟩ + · by_cases hcd : phi1 f = some d.1 + · exact ⟨gamma, by simp [phi2, TwoColorComponentSwap, K, hfK', hcd]⟩ + · exact ⟨c, by simpa [phi2, TwoColorComponentSwap, K, hfK', hcg, + hcd] using hc⟩ + · exact ⟨c, by simpa [phi2, TwoColorComponentSwap, K, hfK'] using hc⟩ + +private theorem helper_hdeltaNotMissing_397.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (d : ↥(DefectiveColors G + phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + ∀ (_ : TreeSequence G e0), ColoredVertexSetClosed G phi X → + ∀ v ∈ X, (↑d : Fin k) ∉ MissingColors G phi v := by + classical + intro V E _ _ G k e0 phi T d X S hclosed v hv hm + have hcard : 0 < (BoundaryColorEdges G phi X d.1).card := by + have htwo : 2 ≤ (BoundaryColorEdges G phi X d.1).card := by + have hdmem := d.2 + change d.1 ∈ (Finset.univ.filter fun alpha => + DefectiveColor G phi X alpha) at hdmem + exact (Finset.mem_filter.mp hdmem).2 + omega + obtain ⟨b, hb⟩ := Finset.card_pos.mp hcard + exact hclosed (Finset.mem_filter.mp hb).1 hv (Finset.mem_filter.mp hb).2 hm + +private theorem helper_edge_color_phi2_408.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); ( + ∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex + d)) f = phi f) → ( + ∀ (q : Fin T.length), Sum.inr (T.edge q) ∉ TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d))) → ( + ∀ (q : Fin T.length), TreeIncidentEdge T (T.edge q)) → + let phi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + ∀ (q : Fin T.length) (c : Fin k), phi (T.edge q) = some c → phi2 (T.edge q) = some c := by + classical + intro V E _ _ _ G k e0 phi T C D d i gamma phi1 K hfixed1 htreeEdgesOutside tree_edge_incident + phi2 q c hc + have hc1 : phi1 (T.edge q) = some c := + (hfixed1 _ (tree_edge_incident q)).trans hc + have hout : Sum.inr (T.edge q) ∉ K := by + simpa [K] using htreeEdgesOutside q + simp [phi2, TwoColorComponentSwap, K, hout, hc1] + +private theorem helper_hw3notS2_506.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; + ∀ (u1 u2 w3 : V), u1 ∈ TreeSequenceVertexSet T → u2 ∈ TreeSequenceVertexSet T → w3 ∉ + TreeSequenceVertexSet T → + ∀ (S : TreeSequence G e0), TreeSequenceVertexSet S = Z → + ∀ (S1 : TreeSequence G e0), TreeSequenceVertexSet S1 = (insert u1 (TreeSequenceVertexSet S) : + Finset V) → + ∀ (S2 : TreeSequence G e0), TreeSequenceVertexSet S2 = (insert u2 (TreeSequenceVertexSet S1) : + Finset V) → w3 ∉ TreeSequenceVertexSet S2 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d i X U Z u1 u2 w3 hu1X hu2X hw3X S hSverticesZ S1 + hS1vertices S2 hS2vertices + rw [hS2vertices, hS1vertices] + simp only [Finset.mem_insert, not_or] + refine ⟨?_, ?_, ?_⟩ + · exact fun h => hw3X (h ▸ hu2X) + · exact fun h => hw3X (h ▸ hu1X) + · intro hwS + apply hw3X + rw [hSverticesZ] at hwS + exact (Finset.mem_sdiff.mp hwS).1 + +private theorem helper_continuation_639.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (g1 : E) (z1 : V), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; + ∀ (u1 u2 : V) (g2 g3 : E) (z3 w3 : V) (_ : u1 ≠ u2) (_ : u1 ∈ TreeSequenceVertexSet T) (_ : u2 + ∈ TreeSequenceVertexSet T) (_ : G.ends g1 = s(u1, z1)) (_ : G.ends g2 = s(u1, u2)) (_ : z3 + ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V)) (_ : w3 ∉ + TreeSequenceVertexSet T) (_ : G.ends g3 = s(z3, w3)) (_ : z1 ∈ Z), + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let phi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + ∀ (_ : IsProperEdgeColoring G phi2) (_ : IsOneEdgeUncolored phi2 e0) (_ : (↑d : Fin k) ∈ + MissingColors G phi2 (D.v0 d)) (_ : D.alpha0 ∈ MissingColors G phi2 (C.y (⟨(0 : ℕ), + by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive T + have := C.p_ge_two + all_goals omega) + ⟩ : Fin C.p))) (_ : phi2 g1 = some (↑d : Fin k)) (_ : phi2 g2 = some D.alpha0) (_ : phi2 g3 = + some (↑d : Fin k)) (S : TreeSequence G e0) (_ : S.length + (2 : ℕ) = T.length) (_ : + TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet + T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet T)) (_ : + TashkinovTree G e0 phi2 S) (_ : + ∀ (A B : TreeSequence G e0) (f : E) (x y : V) (_ : G.ends f = s(x, y)) (_ : x ∈ + TreeSequenceVertexSet A) (_ : y ∉ TreeSequenceVertexSet A) (_ : TreeSequenceAdjoinEdge A f + B), TreeSequenceVertexSet B = (insert y (TreeSequenceVertexSet A) : Finset V)) (_ : + TreeSequenceVertexSet S = Z) (_ : D.v0 d ∈ TreeSequenceVertexSet S) (_ : C.y (⟨(0 : ℕ), + by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive T + have := C.p_ge_two + all_goals omega) + ⟩ : Fin C.p) ∈ TreeSequenceVertexSet S) (_ : u1 ∉ TreeSequenceVertexSet S) (_ : u2 ∉ + TreeSequenceVertexSet S), False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d g1 z1 i gamma X U Z u1 u2 g2 g3 z3 w3 hu12 hu1X hu2X + hg1ends hg2ends hz3Z hw3X hg3ends hz1Z' phi1 phi2 hproper2 hone2 hdelta2 halpha02 hphi2g1 + hphi2g2 hphi2g3 S hSlength horder htreeS adjoin_vertex_set hSverticesZ hv0S hy0S hu1notS + hu2notS + have hz1S : z1 ∈ TreeSequenceVertexSet S := by + rw [hSverticesZ] + exact hz1Z' + have hz3S : z3 ∈ TreeSequenceVertexSet S := by + rw [hSverticesZ] + exact hz3Z + have hdeltaMissingS : d.1 ∈ TreeMissingColors phi2 S := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨D.v0 d, hv0S, hdelta2⟩ + have halphaMissingS : D.alpha0 ∈ TreeMissingColors phi2 S := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩, + hy0S, halpha02⟩ + have hg1Boundary : g1 ∈ BoundaryEdges G (TreeSequenceVertexSet S) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨z1, hz1S, u1, hu1notS, hg1ends.trans Sym2.eq_swap⟩ + obtain ⟨S1, hSS1⟩ := TreeSequenceBoundaryEdgeAppendExists S g1 hg1Boundary + have hg1ends' : G.ends g1 = s(z1, u1) := by + calc + G.ends g1 = s(u1, z1) := hg1ends + _ = s(z1, u1) := Sym2.eq_swap + have hS1vertices : TreeSequenceVertexSet S1 = + insert u1 (TreeSequenceVertexSet S) := + adjoin_vertex_set S S1 g1 z1 u1 hg1ends' hz1S hu1notS hSS1 + have haug1 : TashkinovAugmentation phi2 S S1 := by + rcases hSS1 with ⟨hlen, hinit, hlast⟩ + exact ⟨hlen, hinit, d.1, (congrArg phi2 hlast).trans hphi2g1, + hdeltaMissingS⟩ + have htreeS1 : TashkinovTree G e0 phi2 S1 := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 phi2 S S1 + htreeS (Relation.ReflTransGen.single haug1) + have hu1S1 : u1 ∈ TreeSequenceVertexSet S1 := by simp [hS1vertices] + have hu2notS1 : u2 ∉ TreeSequenceVertexSet S1 := by + rw [hS1vertices] + simp [hu12.symm, hu2notS] + have hy0S1 : C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ + TreeSequenceVertexSet S1 := by + rw [hS1vertices] + exact Finset.mem_insert_of_mem hy0S + have halphaMissingS1 : D.alpha0 ∈ TreeMissingColors phi2 S1 := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨_, hy0S1, halpha02⟩ + have hg2Boundary : g2 ∈ BoundaryEdges G (TreeSequenceVertexSet S1) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u1, hu1S1, u2, hu2notS1, hg2ends⟩ + obtain ⟨S2, hS1S2⟩ := TreeSequenceBoundaryEdgeAppendExists S1 g2 hg2Boundary + have hS2vertices : TreeSequenceVertexSet S2 = + insert u2 (TreeSequenceVertexSet S1) := + adjoin_vertex_set S1 S2 g2 u1 u2 hg2ends hu1S1 hu2notS1 hS1S2 + have haug2 : TashkinovAugmentation phi2 S1 S2 := by + rcases hS1S2 with ⟨hlen, hinit, hlast⟩ + exact ⟨hlen, hinit, D.alpha0, (congrArg phi2 hlast).trans hphi2g2, + halphaMissingS1⟩ + have htreeS2 : TashkinovTree G e0 phi2 S2 := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 phi2 S1 S2 + htreeS1 (Relation.ReflTransGen.single haug2) + have hz3S2 : z3 ∈ TreeSequenceVertexSet S2 := by + rw [hS2vertices, hS1vertices] + exact Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hz3S) + have hw3notS2 : w3 ∉ TreeSequenceVertexSet S2 := by + exact @helper_hw3notS2_506 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@u1) (@u2) (@w3) (@hu1X) (@hu2X) (@hw3X) (@S) + (@hSverticesZ) (@S1) (@hS1vertices) (@S2) (@hS2vertices) + have hv0S2 : D.v0 d ∈ TreeSequenceVertexSet S2 := by + rw [hS2vertices, hS1vertices] + exact Finset.mem_insert_of_mem (Finset.mem_insert_of_mem hv0S) + have hdeltaMissingS2 : d.1 ∈ TreeMissingColors phi2 S2 := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨D.v0 d, hv0S2, hdelta2⟩ + have hg3Boundary : g3 ∈ BoundaryEdges G (TreeSequenceVertexSet S2) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨z3, hz3S2, w3, hw3notS2, hg3ends⟩ + obtain ⟨S3, hS2S3⟩ := TreeSequenceBoundaryEdgeAppendExists S2 g3 hg3Boundary + have hS3vertices : TreeSequenceVertexSet S3 = + insert w3 (TreeSequenceVertexSet S2) := + adjoin_vertex_set S2 S3 g3 z3 w3 hg3ends hz3S2 hw3notS2 hS2S3 + have haug3 : TashkinovAugmentation phi2 S2 S3 := by + rcases hS2S3 with ⟨hlen, hinit, hlast⟩ + exact ⟨hlen, hinit, d.1, (congrArg phi2 hlast).trans hphi2g3, + hdeltaMissingS2⟩ + have htreeS3 : TashkinovTree G e0 phi2 S3 := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 phi2 S2 S3 + htreeS2 (Relation.ReflTransGen.single haug3) + have hK2 : KTriple G k e0 phi2 := + ⟨C.globally_maximum.1.1, C.globally_maximum.1.2.1, + C.globally_maximum.1.2.2.1, hproper2, hone2⟩ + have hle := treeCard_le_tashkinovOrder G k e0 phi2 S3 hK2 htreeS3 + have hS3card : (TreeSequenceVertexSet S3).card = S3.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + S3.vertex_injective] + have hXcard : X.card = T.length + 1 := by + simp [X, TreeSequenceVertexSet, Finset.card_image_of_injective, + T.vertex_injective] + rcases hSS1 with ⟨hlen1, hinit1, hlast1⟩ + rcases hS1S2 with ⟨hlen2, hinit2, hlast2⟩ + rcases hS2S3 with ⟨hlen3, hinit3, hlast3⟩ + have hmore : (TreeSequenceVertexSet S3).card = X.card + 1 := by + rw [hS3card, hXcard] + omega + rw [hmore, horder.1] at hle + exact (Nat.not_succ_le_self X.card) hle + +theorem ScheideDefectiveNoCross {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) : + ∀ d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}, + ∀ f : E, phi f = some d.1 → ¬ ( + ∃ x ∈ ({C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} : Finset V), + Incident G x f ∧ + ∃ z ∈ TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1}, Incident G z f) := by + classical + intro d g1 hg1 + rintro ⟨x, hxU, hxg1, z1, hz1Z, hz1g1⟩ + let i := D.gammaIndex d + let gamma := C.gamma i + let X := TreeSequenceVertexSet T + let U := ({C.blockVertex i 0, C.blockVertex i 1} : Finset V) + let Z := X \ U + have hselection := ScheideDefectiveCrossingSelection G k e0 phi T C D d + g1 hg1 x hxU hxg1 z1 hz1Z hz1g1 + dsimp only at hselection + rcases hselection with + ⟨u1, u2, g2, g3, z3, w3, hpair, hxu1, hu12, hu1U, hu2U, hu1X, + hu2X, hv0Z, hy0Z, hagamma, hadelta, hgammadelta, hg1ends, + hg2color, hg2ends, hg3B, hg3f0, hz3Z, hw3X, hg3ends, + hg1g2, hg1g3, hg2g3⟩ + have hz1Z' : z1 ∈ Z := by simpa [i, X, U, Z] using hz1Z + let phi1 := OutsideTreeColorSwap T phi D.alpha0 gamma + let K := TwoColorComponent G phi1 gamma d.1 (Sum.inl (D.v0 d)) + have hterminal := ScheideDefectiveTerminalComponent G k e0 phi T C D d + dsimp only at hterminal + rcases hterminal with + ⟨hproper1, hone1, hstable1, hfixed1, htailK, hf0K, hKtree, + htreeEdgesOutside, hKcolors⟩ + have tree_edge_incident : ∀ q : Fin T.length, TreeIncidentEdge T (T.edge q) := by + exact @helper_tree_edge_incident_279 (@V) (@E) inferInstance inferInstance (@G) (@e0) (@T) + have component_vertex_of_edge {v : V} {e : E} + (heK : Sum.inr e ∈ K) (hve : Incident G v e) + (hecolor : phi1 e = some gamma ∨ phi1 e = some d.1) : + Sum.inl v ∈ K := by + exact @helper_component_vertex_of_edge_285 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@v) (@e) (@heK) (@hve) (@hecolor) + have hu1v0 : u1 ≠ D.v0 d := by + intro h + have : D.v0 d ∈ U := h ▸ hu1U + exact (Finset.mem_sdiff.mp hv0Z).2 this + have hz3v0 : z3 ≠ D.v0 d := by + exact @helper_hz3v0_301 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@g3) (@z3) (@w3) (@hv0Z) (@hg3B) (@hg3f0) + (@hz3Z) (@hg3ends) (@hproper1) (@hfixed1) + have hphi1g1 : phi1 g1 = some d.1 := by + exact (hfixed1 g1 ⟨u1, hu1X, by simp [Incident, hg1ends]⟩).trans hg1 + have hphi1g2 : phi1 g2 = some D.alpha0 := by + exact (hfixed1 g2 ⟨u1, hu1X, by simp [Incident, hg2ends]⟩).trans hg2color + have hphi1g3 : phi1 g3 = some d.1 := by + exact (hfixed1 g3 ⟨z3, (Finset.mem_sdiff.mp hz3Z).1, + by simp [Incident, hg3ends]⟩).trans (Finset.mem_filter.mp hg3B).2 + have hg1notK : Sum.inr g1 ∉ K := by + exact @helper_hg1notK_326 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@C) (@D) (@d) (@g1) (@z1) (@u1) (@hu1X) (@hg1ends) (@hKtree) + (@component_vertex_of_edge) (@hu1v0) (@hphi1g1) + have hg2notK : Sum.inr g2 ∉ K := by + intro hg2K + rcases hKcolors g2 hg2K with hgamma | hdelta + · exact hagamma (Option.some.inj (hphi1g2.symm.trans hgamma)) + · exact hadelta (Option.some.inj (hphi1g2.symm.trans hdelta)) + have hg3notK : Sum.inr g3 ∉ K := by + exact @helper_hg3notK_339 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@g3) (@z3) (@w3) (@hz3Z) (@hg3ends) (@hKtree) + (@component_vertex_of_edge) (@hz3v0) (@hphi1g3) + let phi2 := TwoColorComponentSwap G phi1 gamma d.1 (Sum.inl (D.v0 d)) + have hproper2 : IsProperEdgeColoring G phi2 := by + simpa [phi2] using TwoColorComponentSwapProper G phi1 gamma d.1 + hgammadelta hproper1 (Sum.inl (D.v0 d)) + have hone2 : IsOneEdgeUncolored phi2 e0 := by + exact @helper_hone2_351 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@C) (@D) (@d) (@hone1) + have hbehavior := TwoColorComponentSwapMissingBehavior G phi1 gamma d.1 + hgammadelta hproper1 (Sum.inl (D.v0 d)) + have hv0X : D.v0 d ∈ X := (Finset.mem_sdiff.mp hv0Z).1 + have hy0X : C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ X := + (Finset.mem_sdiff.mp hy0Z).1 + have hgamma1 : gamma ∈ MissingColors G phi1 (D.v0 d) := by + rw [hstable1.2 (D.v0 d) (by simpa [X] using hv0X)] + exact D.gamma_missing_at_v0 d + have hdelta2 : d.1 ∈ MissingColors G phi2 (D.v0 d) := by + simpa [phi2, K] using hbehavior.2.1 (D.v0 d) (by rfl) hgamma1 + have halpha01 : D.alpha0 ∈ MissingColors G phi1 + (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩) := by + rw [hstable1.2 _ (by simpa [X] using hy0X)] + exact D.alpha0_missing_at_y0 + have halpha02 : D.alpha0 ∈ MissingColors G phi2 + (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩) := by + exact (hbehavior.2.2.2 _ D.alpha0 hagamma hadelta).mpr halpha01 + have hphi2g1 : phi2 g1 = some d.1 := by + simp [phi2, TwoColorComponentSwap, K, hg1notK, hphi1g1] + have hphi2g2 : phi2 g2 = some D.alpha0 := by + simp [phi2, TwoColorComponentSwap, K, hg2notK, hphi1g2] + have hphi2g3 : phi2 g3 = some d.1 := by + simp [phi2, TwoColorComponentSwap, K, hg3notK, hphi1g3] + obtain ⟨S, hSvertices, hSlength, hvertexReindex, hedgeReindex, + hbaseVertices, hbaseEdges, hblockEntries, hedgeCases, hedgeOld, + hnotIncident⟩ := + ScheideSelectedBlockDeletion G k e0 phi T C i + have htreeOld : TashkinovTree G e0 phi T := C.globally_maximum.2.1 + have hunused := ScheideGlobalMaximumUnused G k e0 phi T C.globally_maximum + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hclosed : ColoredVertexSetClosed G phi X := by + exact horder.2.2.2.2 + have hdeltaNotMissing : ∀ v, v ∈ X → d.1 ∉ MissingColors G phi v := by + exact @helper_hdeltaNotMissing_397 (@V) (@E) inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@d) (@S) (@hclosed) + have edge_color_phi2 (q : Fin T.length) (c : Fin k) + (hc : phi (T.edge q) = some c) : phi2 (T.edge q) = some c := by + exact @helper_edge_color_phi2_408 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hfixed1) (@htreeEdgesOutside) + (@tree_edge_incident) (@q) (@c) (@hc) + have missing_unaffected (v : V) (hvX : v ∈ X) (c : Fin k) + (hcg : c ≠ gamma) (hcd : c ≠ d.1) : + (c ∈ MissingColors G phi2 v ↔ c ∈ MissingColors G phi v) := by + have h1 : MissingColors G phi1 v = MissingColors G phi v := + hstable1.2 v (by simpa [X] using hvX) + rw [← h1] + exact hbehavior.2.2.2 v c hcg hcd + have htreeS : TashkinovTree G e0 phi2 S := by + exact @helper_htreeS_255 V E inferInstance inferInstance inferInstance G k e0 phi T C D d S + hSlength hbaseVertices hedgeCases htreeOld hunused hdeltaNotMissing edge_color_phi2 + missing_unaffected + have adjoin_vertex_set (A B : TreeSequence G e0) (f : E) (x y : V) + (hxy : G.ends f = s(x, y)) (hxA : x ∈ TreeSequenceVertexSet A) + (hyA : y ∉ TreeSequenceVertexSet A) + (hAB : TreeSequenceAdjoinEdge A f B) : + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by + exact @helper_adjoin_vertex_set_343 V E inferInstance G e0 A B f x y hxy hyA hAB + have hSverticesZ : TreeSequenceVertexSet S = Z := by + simpa [Z, X, U, i] using hSvertices + have hv0S : D.v0 d ∈ TreeSequenceVertexSet S := by + rw [hSverticesZ] + exact hv0Z + have hy0S : C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ + TreeSequenceVertexSet S := by + rw [hSverticesZ] + exact hy0Z + have hu1notS : u1 ∉ TreeSequenceVertexSet S := by + rw [hSverticesZ] + exact fun h => (Finset.mem_sdiff.mp h).2 hu1U + have hu2notS : u2 ∉ TreeSequenceVertexSet S := by + rw [hSverticesZ] + exact fun h => (Finset.mem_sdiff.mp h).2 hu2U + exact @helper_continuation_639 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@g1) (@z1) (@u1) (@u2) (@g2) + (@g3) (@z3) (@w3) (@hu12) (@hu1X) (@hu2X) (@hg1ends) (@hg2ends) (@hz3Z) (@hw3X) (@hg3ends) + (@hz1Z') (@hproper2) (@hone2) (@hdelta2) (@halpha02) (@hphi2g1) (@hphi2g2) (@hphi2g3) (@S) + (@hSlength) (@horder) (@htreeS) (@adjoin_vertex_set) (@hSverticesZ) (@hv0S) (@hy0S) + (@hu1notS) (@hu2notS) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean new file mode 100644 index 0000000000..7568aa9409 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean @@ -0,0 +1,1276 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveDeletedTreePair +public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveSecondTerminalComponent +public import LeanPool.GoldbergSeymour.ScheideDefectiveTerminalComponent +public import LeanPool.GoldbergSeymour.ScheideDefectiveThirdBoundaryEdge +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper + +/-! +# Scheide Defective Return Contradiction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation291Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let _ : PartialEdgeColoring E k := + TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let _ : Set (V ⊕ E) := TwoColorComponent G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let _ : PartialEdgeColoring E k := + TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + IsProperEdgeColoring G (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) → + IsOneEdgeUncolored (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) e0 → + StableColoring T ∅ phi (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) → + IsProperEdgeColoring G + (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) + (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) → + IsOneEdgeUncolored + (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) + (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) + e0 → + (↑d : Fin k) ∈ + MissingColors G + (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) + (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) + R.v1 → + ∀ (Sgamma SgammaJ : TreeSequence G e0), + TashkinovTree G e0 + (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + Sgamma → + TreeSequenceVertexSet Sgamma = + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ + { R.u1 } → + TashkinovTree G e0 + (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) + (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) + SgammaJ → + TreeSequenceVertexSet SgammaJ = + TreeSequenceVertexSet T \ + {C.blockVertex R.blockIndex (0 : Fin (2 : ℕ)), + C.blockVertex R.blockIndex (1 : Fin (2 : ℕ))} ∪ + {D.u0 d} → + ∀ (f2 : E) (z2 u2 : V), + G.ends f2 = s(z2, u2) → + z2 ∈ + TreeSequenceVertexSet T \ + ({C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ + {C.blockVertex R.blockIndex (0 : Fin (2 : ℕ)), + C.blockVertex R.blockIndex (1 : Fin (2 : ℕ))}) → + u2 ∉ TreeSequenceVertexSet T → + TwoColorComponentSwap G + (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f2 = + some (↑d : Fin k) → + TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) + (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) f2 = + some (↑d : Fin k) → + u2 ≠ D.u0 d → + u2 ≠ R.u1 → + T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → + (∀ (a : Fin C.p) (r : Fin C.s) (b : Fin (2 : ℕ)), + C.y a ≠ C.blockVertex r b) → + Ui ⊆ X → + Uj ⊆ X → + Ui.card = (2 : ℕ) → + Uj.card = (2 : ℕ) → + (∀ (rho : PartialEdgeColoring E k) (S U : TreeSequence G e0) (f : E), + TreeSequenceAdjoinEdge S f U → + TashkinovTree G e0 rho S → + ∀ (c : Fin k), + rho f = some c → + ∀ v ∈ TreeSequenceVertexSet S, + c ∈ MissingColors G rho v → TashkinovTree G e0 rho U) → + False + +private theorem helper_tashkinov_adjoin_165.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (_ : ScheideDefectiveReturnData G k e0 phi T C D d) (rho : PartialEdgeColoring E k) + (S U : TreeSequence G e0) (f : E), + TreeSequenceAdjoinEdge S f U → + TashkinovTree G e0 rho S → + ∀ (c : Fin k), + rho f = some c → + ∀ v ∈ TreeSequenceVertexSet S, + c ∈ MissingColors G rho v → + TashkinovTree G e0 rho U := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R rho S U f hadjoin hS c hf v hv hmiss + rcases hadjoin with ⟨hlen, hinitial, hlast⟩ + rcases hinitial with ⟨hle, hvert, hedge⟩ + intro q hq + by_cases hold : q.val < S.length + · let qS : Fin S.length := ⟨q.val, hold⟩ + obtain ⟨a, color, hcolor, hcolorMissing⟩ := + hS qS (by simpa [qS] using hq) + let aU : Fin (q.val + 1) := ⟨a.val, by simpa [qS] using a.isLt⟩ + refine ⟨aU, color, ?_, ?_⟩ + · have hqeq : Fin.castLE hle qS = q := by + apply Fin.ext + rfl + have hUedge : U.edge q = S.edge qS := by + rw [← hqeq] + exact hedge qS + rw [hUedge] + exact hcolor + · let oldVertexIndex : Fin (S.length + 1) := + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ qS.isLt)) + let newVertexIndex : Fin (U.length + 1) := + Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) oldVertexIndex = + newVertexIndex := by + apply Fin.ext + rfl + have hvertex : U.vertex newVertexIndex = S.vertex oldVertexIndex := by + rw [← hindex] + exact hvert oldVertexIndex + simpa [oldVertexIndex, newVertexIndex] using + hvertex.symm ▸ hcolorMissing + · have hqval : q.val = S.length := by + have hqbound : q.val < S.length + 1 := by simpa [hlen] using q.isLt + omega + obtain ⟨a, ha⟩ : ∃ a : Fin (S.length + 1), S.vertex a = v := by + simpa [TreeSequenceVertexSet] using hv + let aU : Fin (q.val + 1) := ⟨a.val, by simpa [hqval] using a.isLt⟩ + refine ⟨aU, c, ?_, ?_⟩ + · have hqlast : q = Fin.cast hlen.symm (Fin.last S.length) := by + apply Fin.ext + simpa using hqval + rw [hqlast, hlast] + exact hf + · let newVertexIndex : Fin (U.length + 1) := + Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) a = + newVertexIndex := by + apply Fin.ext + rfl + have hvertex : U.vertex newVertexIndex = v := by + rw [← hindex, hvert a, ha] + simpa [newVertexIndex, hvertex] using hmiss + +private theorem helper_adjoin_vertex_set_223.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) (e0 : E) + (A B : TreeSequence G e0) (f : E) (x y : V), + G.ends f = s(x, y) → + y ∉ TreeSequenceVertexSet A → + TreeSequenceAdjoinEdge A f B → + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by + classical + intro V E _ G e0 A B f x y hxy hyA hAB + rcases hAB with ⟨hlen, hinit, hlast⟩ + rcases hinit with ⟨hle, hvertices, hedges⟩ + have holdSubset : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨q, hq⟩ := hv + refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ + rw [hvertices] + exact hq + have hyB : y ∈ TreeSequenceVertexSet B := by + let q : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨a, ha⟩ := B.attaches q + have hyEnds : y ∈ G.ends (B.edge q) := by + rw [hlast, hxy] + simp + rw [ha] at hyEnds + rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨q.succ, hynew.symm⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.castLT a (Nat.lt_trans a.isLt + (Nat.succ_lt_succ q.isLt)), hyold.symm⟩ + have hinsert : insert y (TreeSequenceVertexSet A) ⊆ + TreeSequenceVertexSet B := by + intro v hv + simp only [Finset.mem_insert] at hv + rcases hv with rfl | hv + · exact hyB + · exact holdSubset hv + have hAcard : (TreeSequenceVertexSet A).card = A.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + A.vertex_injective] + have hBcard : (TreeSequenceVertexSet B).card = B.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + B.vertex_injective] + have hcard : (TreeSequenceVertexSet B).card ≤ + (insert y (TreeSequenceVertexSet A)).card := by + rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] + exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm + +private theorem helper_hone2_388.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let phi2 : PartialEdgeColoring E k := + TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + IsOneEdgeUncolored (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) e0 → + IsOneEdgeUncolored phi2 e0 := by + classical + intro V E _ _ _ G k e0 phi T C D d i gamma phi1 K phi2 hone1 + have hone1' : IsOneEdgeUncolored phi1 e0 := by + simpa [phi1, gamma, i] using hone1 + constructor + · simp [phi2, TwoColorComponentSwap, hone1'.1] + · intro f hfe + obtain ⟨c, hc⟩ := hone1'.2 f hfe + by_cases hfK' : Sum.inr f ∈ K + · by_cases hcg : phi1 f = some gamma + · exact ⟨d.1, by simp [phi2, TwoColorComponentSwap, K, hfK', hcg]⟩ + · by_cases hcd : phi1 f = some d.1 + · exact ⟨gamma, by simp [phi2, TwoColorComponentSwap, K, hfK', + hcd]⟩ + · exact ⟨c, by simpa [phi2, TwoColorComponentSwap, K, hfK', + hcg, hcd] using hc⟩ + · exact ⟨c, by simpa [phi2, TwoColorComponentSwap, K, hfK'] using hc⟩ + +private theorem helper_hy01_441.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (_ : ScheideDefectiveReturnData G k e0 phi T C D d) (_ _ : TreeSequence G e0), + T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → + ∀ (_ _ : TreeSequence G e0), + let b0 : Fin C.p := (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let b1 : Fin C.p := (⟨(1 : ℕ), C.p_ge_two⟩ : Fin C.p); + let y0 : V := C.y b0; + let y1 : V := C.y b1; + y0 ≠ y1 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R Sgamma SgammaJ hlength Tgamma TgammaJ b0 b1 y0 y1 h + let q0 : Fin (T.length + 1) := ⟨0, by omega⟩ + let q1 : Fin (T.length + 1) := ⟨1, by + have hp := C.p_ge_two + omega⟩ + have hp0 : T.vertex q0 = y0 := by + simpa [q0, y0, b0] using C.base_vertex_position b0 + have hp1 : T.vertex q1 = y1 := by + simpa [q1, y1, b1] using C.base_vertex_position b1 + have hv : T.vertex q0 = T.vertex q1 := hp0.trans (h.trans hp1.symm) + have hi := congrArg Fin.val (T.vertex_injective hv) + simp [q0, q1] at hi + +private theorem helper_he0ends_454.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (_ : ScheideDefectiveReturnData G k e0 phi T C D d) (_ _ : TreeSequence G e0), + T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → + ∀ (_ _ : TreeSequence G e0), + let b0 : Fin C.p := (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let b1 : Fin C.p := (⟨(1 : ℕ), C.p_ge_two⟩ : Fin C.p); + let y0 : V := C.y b0; + let y1 : V := C.y b1; + G.ends e0 = s(y1, y0) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R Sgamma SgammaJ hlength Tgamma TgammaJ b0 b1 y0 y1 + let q : Fin T.length := ⟨0, T.positive⟩ + obtain ⟨a, ha⟩ := T.attaches q + have hfirst : T.edge q = e0 := by simpa [q] using T.first_edge + have hnew : T.vertex q.succ = y1 := by + simpa [q, y1, b1] using C.base_vertex_position b1 + have hold : T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))) = y0 := by + have hind : Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)) = + (⟨0, by omega⟩ : Fin (T.length + 1)) := by + apply Fin.ext + simp + rw [hind] + simpa [y0, b0] using C.base_vertex_position b0 + rw [← hfirst, ha, hnew, hold] + +private theorem helper_hbetaDelta_528.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (_ : ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + ∀ (_ _ _ _ : TreeSequence G e0), + ColoredVertexSetClosed G phi X → + let b0 : Fin C.p := (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let b1 : Fin C.p := (⟨(1 : ℕ), C.p_ge_two⟩ : Fin C.p); + let y0 : V := C.y b0; + let y1 : V := C.y b1; + let M0 : Finset (Fin k) := MissingColors G phi y0; + ∀ (beta : Fin k), + let ybeta : V := if beta ∈ M0 then y0 else y1; + beta ∈ MissingColors G phi ybeta → + ybeta ∈ X → + beta ≠ (↑d : Fin k) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X Sgamma SgammaJ Tgamma TgammaJ hclosed0 b0 b1 y0 y1 M0 + beta ybeta hybetaMissing hybetaX hbd + have hdefective : DefectiveColor G phi X d.1 := by + exact (Finset.mem_filter.mp d.2).2 + have hboundaryNonempty : + (BoundaryColorEdges G phi X d.1).Nonempty := by + apply Finset.card_pos.mp + unfold DefectiveColor at hdefective + omega + obtain ⟨fd, hfd⟩ := hboundaryNonempty + have hfdBoundary : fd ∈ BoundaryEdges G X := + (Finset.mem_filter.mp hfd).1 + have hfdColor : phi fd = some d.1 := + (Finset.mem_filter.mp hfd).2 + exact hclosed0 hfdBoundary hybetaX hfdColor (hbd ▸ hybetaMissing) + +private theorem helper_hphi2Beta_559.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let gamma : Fin k := C.gamma i; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let phi2 : PartialEdgeColoring E k := + TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + ∀ (beta : Fin k), + gamma ≠ (↑d : Fin k) → + gamma ≠ beta → + (↑d : Fin k) ≠ beta → + (∀ (e : E), phi1 e = some beta ↔ phi e = some beta) → + ∀ (e : E), + phi2 e = some beta ↔ phi e = some beta := by + classical + intro V E _ _ _ G k e0 phi T C D d i gamma phi1 K phi2 beta hgammaDelta hgammaBeta hdeltaBeta + hphi1Beta e + by_cases heK : Sum.inr e ∈ K + · rw [← hphi1Beta e] + by_cases heg : phi1 e = some gamma + · rw [heg] + simp [phi2, TwoColorComponentSwap, K, heK, heg, hgammaBeta, hdeltaBeta] + · by_cases hed : phi1 e = some d.1 + · rw [hed] + simp [phi2, TwoColorComponentSwap, K, heK, hed, hgammaDelta.symm, hgammaBeta, hdeltaBeta] + · simp [phi2, TwoColorComponentSwap, K, heK, heg, hed] + · rw [← hphi1Beta e] + simp [phi2, TwoColorComponentSwap, K, heK] + +private theorem helper_hpsi2Beta_583.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideDefectiveReturnData G k e0 phi T C D d), + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let _ : Set (V ⊕ E) := TwoColorComponent G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let psi2 : PartialEdgeColoring E k := + TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + ∀ (beta : Fin k), + gammaJ ≠ (↑d : Fin k) → + gammaJ ≠ beta → + (↑d : Fin k) ≠ beta → + (∀ (e : E), psi1 e = some beta ↔ phi e = some beta) → + ∀ (e : E), + psi2 e = some beta ↔ phi e = some beta := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R i j gamma gammaJ psi1 KJ psi2 beta hgammaJDelta + hgammaJBeta hdeltaBeta hpsi1Beta e + by_cases heK : Sum.inr e ∈ KJ + · rw [← hpsi1Beta e] + by_cases hegJ : psi1 e = some gammaJ + · rw [hegJ] + simp [psi2, TwoColorComponentSwap, KJ, heK, hegJ, hgammaJBeta, hdeltaBeta] + · by_cases hed : psi1 e = some d.1 + · rw [hed] + simp [psi2, TwoColorComponentSwap, KJ, heK, hed, hgammaJDelta.symm, hgammaJBeta, hdeltaBeta] + · simp [psi2, TwoColorComponentSwap, KJ, heK, hegJ, hed] + · rw [← hpsi1Beta e] + simp [psi2, TwoColorComponentSwap, KJ, heK] + +private theorem helper_hu1u0_688.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideDefectiveReturnData G k e0 phi T C D d), + R.u1 ≠ D.u0 d := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R hout + have hedge : R.f1 ≠ D.f0 d := by + intro heq + have hends : s(R.v1, R.u1) = s(D.v0 d, D.u0 d) := by + rw [← R.f1_ends, heq, D.f0_ends] + rcases Sym2.eq_iff.mp hends with hdirect | hcross + · exact R.v1_ne_v0 hdirect.1 + · exact D.u0_outside d (hcross.1 ▸ R.v1_mem) + have hadj : AdjacentEdges G R.f1 (D.f0 d) := by + refine ⟨R.u1, ?_, ?_⟩ + · simp [Incident, R.f1_ends] + · simp [Incident, D.f0_ends, hout] + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + exact hproper hedge hadj R.f1_color (D.f0_color d) + +private theorem helper_continuation_559.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let phi2 : PartialEdgeColoring E k := + TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let psi2 : PartialEdgeColoring E k := + TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + ∀ (Sgamma SgammaJ : TreeSequence G e0), + TreeSequenceVertexSet Sgamma = + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ + { R.u1 } → + TreeSequenceVertexSet SgammaJ = + TreeSequenceVertexSet T \ + {C.blockVertex R.blockIndex (0 : Fin (2 : ℕ)), + C.blockVertex R.blockIndex (1 : Fin (2 : ℕ))} ∪ + {D.u0 d} → + ∀ u2 ∉ TreeSequenceVertexSet T, + u2 ≠ R.u1 → + (∀ (rho : PartialEdgeColoring E k) (S U : TreeSequence G e0) (f : E), + TreeSequenceAdjoinEdge S f U → + TashkinovTree G e0 rho S → + ∀ (c : Fin k), + rho f = some c → + ∀ v ∈ TreeSequenceVertexSet S, + c ∈ MissingColors G rho v → TashkinovTree G e0 rho U) → + (∀ (A B : TreeSequence G e0) (f : E) (x y : V), + G.ends f = s(x, y) → + x ∈ TreeSequenceVertexSet A → + y ∉ TreeSequenceVertexSet A → + TreeSequenceAdjoinEdge A f B → + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A)) → + ∀ (Tgamma TgammaJ : TreeSequence G e0), + TashkinovTree G e0 psi2 TgammaJ → + TreeSequenceVertexSet Tgamma = insert u2 (TreeSequenceVertexSet Sgamma) → + TreeSequenceVertexSet TgammaJ = insert u2 (TreeSequenceVertexSet SgammaJ) → + GlobalMaximumTriple G k e0 psi2 TgammaJ → + ColoredVertexSetClosed G phi X → + ColoredVertexSetClosed G phi2 (TreeSequenceVertexSet Tgamma) → + let b0 : Fin C.p := (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let b1 : Fin C.p := (⟨(1 : ℕ), C.p_ge_two⟩ : Fin C.p); + let y0 : V := C.y b0; + let y1 : V := C.y b1; + let M0 : Finset (Fin k) := MissingColors G phi y0; + ∀ (beta : Fin k), + let ybeta : V := if beta ∈ M0 then y0 else y1; + beta ∈ MissingColors G phi ybeta → + ybeta ∈ X → + (∀ (e : E), phi2 e = some beta ↔ phi e = some beta) → + (∀ (e : E), psi2 e = some beta ↔ phi e = some beta) → + beta ∈ MissingColors G phi2 ybeta → + beta ∈ MissingColors G psi2 ybeta → + ybeta ∈ TreeSequenceVertexSet Tgamma → + ybeta ∈ TreeSequenceVertexSet TgammaJ → + u2 ∈ TreeSequenceVertexSet Tgamma → + u2 ∈ TreeSequenceVertexSet TgammaJ → + beta ∉ MissingColors G phi2 u2 → + False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ phi1 phi2 psi1 psi2 Sgamma SgammaJ + hSgammaVertices hSgammaJVertices u2 hu2X hu2u1 tashkinov_adjoin adjoin_vertex_set Tgamma + TgammaJ hTgammaJTash hTgammaVertices hTgammaJVertices hglobalJ2 hclosed0 hclosed2 b0 b1 y0 + y1 M0 beta ybeta hybetaMissing hybetaX hphi2Beta hpsi2Beta hybetaMissing2 hybetaMissingJ2 + hybetaTgamma hybetaTgammaJ hu2Tgamma hu2TgammaJ hbetaNotMissingU2 + have hbetaPresentU2 : beta ∈ PresentColors G phi2 u2 := by + by_contra hnot + exact hbetaNotMissingU2 (by simp [MissingColors, hnot]) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hbetaPresentU2 + obtain ⟨b, hbu2, hbcolor2⟩ := hbetaPresentU2 + obtain ⟨w, hbends⟩ := Sym2.mem_iff_exists.mp hbu2 + have hwu2 : w ≠ u2 := by + intro h + apply G.loopless b u2 + rw [hbends, h] + have hwTgamma : w ∈ TreeSequenceVertexSet Tgamma := by + by_contra hw + have hbBoundary : b ∈ BoundaryEdges G + (TreeSequenceVertexSet Tgamma) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u2, hu2Tgamma, w, hw, hbends⟩ + exact hclosed2 hbBoundary hybetaTgamma hbcolor2 hybetaMissing2 + have hbcolor : phi b = some beta := (hphi2Beta b).mp hbcolor2 + have hwNotX : w ∉ X := by + intro hwX + have hbBoundary : b ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwX, u2, hu2X, hbends.trans Sym2.eq_swap⟩ + exact hclosed0 hbBoundary hybetaX hbcolor hybetaMissing + have hwu1 : w = R.u1 := by + rw [hTgammaVertices] at hwTgamma + rcases Finset.mem_insert.mp hwTgamma with hwu | hwS + · exact False.elim (hwu2 hwu) + · rw [hSgammaVertices] at hwS + rcases Finset.mem_union.mp hwS with hwOld | hwu + · exact False.elim (hwNotX (Finset.mem_sdiff.mp hwOld).1) + · simpa using hwu + have hbends' : G.ends b = s(u2, R.u1) := by simpa [hwu1] using hbends + have hbcolorJ2 : psi2 b = some beta := (hpsi2Beta b).mpr hbcolor + have hu1u0 : R.u1 ≠ D.u0 d := by + exact @helper_hu1u0_688 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R + have hu1NotSgammaJ : R.u1 ∉ TreeSequenceVertexSet SgammaJ := by + rw [hSgammaJVertices] + intro hu + rcases Finset.mem_union.mp hu with huOld | hu0 + · exact R.u1_outside (Finset.mem_sdiff.mp huOld).1 + · exact hu1u0 (by simpa using hu0) + have hu1NotTgammaJ : R.u1 ∉ TreeSequenceVertexSet TgammaJ := by + rw [hTgammaJVertices] + have hu1u2 : R.u1 ≠ u2 := hu2u1.symm + simp [hu1u2, hu1NotSgammaJ] + have hbBoundaryJ : b ∈ BoundaryEdges G + (TreeSequenceVertexSet TgammaJ) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u2, hu2TgammaJ, R.u1, hu1NotTgammaJ, hbends'⟩ + obtain ⟨U, hAdjoinBeta⟩ := + TreeSequenceBoundaryEdgeAppendExists TgammaJ b hbBoundaryJ + have hUTash : TashkinovTree G e0 psi2 U := + tashkinov_adjoin psi2 TgammaJ U b hAdjoinBeta hTgammaJTash beta + hbcolorJ2 ybeta hybetaTgammaJ hybetaMissingJ2 + have hUVertices : TreeSequenceVertexSet U = + insert R.u1 (TreeSequenceVertexSet TgammaJ) := + adjoin_vertex_set TgammaJ U b u2 R.u1 hbends' hu2TgammaJ + hu1NotTgammaJ hAdjoinBeta + have hmax := ScheideGlobalMaximumFixedPairMaximal + G k e0 psi2 TgammaJ hglobalJ2 + have hforward : TreeSequenceVertexSet TgammaJ ⊆ + TreeSequenceVertexSet U := by + rw [hUVertices] + exact Finset.subset_insert _ _ + have hback := hmax.2 U hUTash hforward + have hu1U : R.u1 ∈ TreeSequenceVertexSet U := by + rw [hUVertices] + simp + exact hu1NotTgammaJ (hback hu1U) + +private theorem helper_continuation_563.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let phi2 : PartialEdgeColoring E k := + TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let psi2 : PartialEdgeColoring E k := + TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let _ : Finset V := + {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let _ : Finset V := + {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + ∀ (Sgamma SgammaJ : TreeSequence G e0), + TreeSequenceVertexSet Sgamma = + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ + { R.u1 } → + TreeSequenceVertexSet SgammaJ = + TreeSequenceVertexSet T \ + {C.blockVertex R.blockIndex (0 : Fin (2 : ℕ)), + C.blockVertex R.blockIndex (1 : Fin (2 : ℕ))} ∪ + {D.u0 d} → + ∀ u2 ∉ TreeSequenceVertexSet T, + u2 ≠ R.u1 → + (∀ (a : Fin C.p) (r : Fin C.s) (b : Fin (2 : ℕ)), C.y a ≠ C.blockVertex r b) → + (∀ (rho : PartialEdgeColoring E k) (S U : TreeSequence G e0) (f : E), + TreeSequenceAdjoinEdge S f U → + TashkinovTree G e0 rho S → + ∀ (c : Fin k), + rho f = some c → + ∀ v ∈ TreeSequenceVertexSet S, + c ∈ MissingColors G rho v → TashkinovTree G e0 rho U) → + (∀ (A B : TreeSequence G e0) (f : E) (x y : V), + G.ends f = s(x, y) → + x ∈ TreeSequenceVertexSet A → + y ∉ TreeSequenceVertexSet A → + TreeSequenceAdjoinEdge A f B → + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A)) → + ∀ (Tgamma TgammaJ : TreeSequence G e0), + TashkinovTree G e0 psi2 TgammaJ → + TreeSequenceVertexSet Tgamma = insert u2 (TreeSequenceVertexSet Sgamma) → + TreeSequenceVertexSet TgammaJ = insert u2 (TreeSequenceVertexSet SgammaJ) → + GlobalMaximumTriple G k e0 psi2 TgammaJ → + ColoredVertexSetClosed G phi X → + ColoredVertexSetElementary G phi2 (TreeSequenceVertexSet Tgamma) → + ColoredVertexSetClosed G phi2 (TreeSequenceVertexSet Tgamma) → + let b0 : Fin C.p := (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let b1 : Fin C.p := (⟨(1 : ℕ), C.p_ge_two⟩ : Fin C.p); + let y0 : V := C.y b0; + let y1 : V := C.y b1; + y0 ∈ X → + y1 ∈ X → + let M0 : Finset (Fin k) := MissingColors G phi y0; + let M1 : Finset (Fin k) := MissingColors G phi y1; + ∀ beta ∈ M0 ∪ M1, + beta ≠ D.alpha0 → + beta ≠ gamma → + beta ≠ gammaJ → + D.alpha0 ≠ gamma → + gamma ≠ gammaJ → + gamma ≠ (↑d : Fin k) → + gammaJ ≠ (↑d : Fin k) → + False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ phi1 phi2 psi1 psi2 Ui Uj Sgamma + SgammaJ hSgammaVertices hSgammaJVertices u2 hu2X hu2u1 base_ne_block tashkinov_adjoin + adjoin_vertex_set Tgamma TgammaJ hTgammaJTash hTgammaVertices hTgammaJVertices hglobalJ2 + hclosed0 helementary2 hclosed2 b0 b1 y0 y1 hy0X hy1X M0 M1 beta hbetaUnion hbetaAlpha + hbetaGamma hbetaGammaJ halphaGamma hgammaGammaJ hgammaDelta hgammaJDelta + let ybeta := if beta ∈ M0 then y0 else y1 + have hybetaMissing : beta ∈ MissingColors G phi ybeta := by + by_cases hb0 : beta ∈ M0 + · simp [ybeta, hb0, M0] + · have hb1 : beta ∈ M1 := (Finset.mem_union.mp hbetaUnion).resolve_left hb0 + simpa [ybeta, hb0, M1] using hb1 + have hybetaCases : ybeta = y0 ∨ ybeta = y1 := by + by_cases hb0 : beta ∈ M0 + · exact Or.inl (by simp [ybeta, hb0]) + · exact Or.inr (by simp [ybeta, hb0]) + have hybetaX : ybeta ∈ X := by + rcases hybetaCases with h | h + · simpa [h] using hy0X + · simpa [h] using hy1X + have hbetaDelta : beta ≠ d.1 := by + exact @helper_hbetaDelta_528 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R Sgamma SgammaJ Tgamma TgammaJ hclosed0 beta hybetaMissing hybetaX + have halphaBeta : D.alpha0 ≠ beta := hbetaAlpha.symm + have hgammaBeta : gamma ≠ beta := hbetaGamma.symm + have hgammaJBeta : gammaJ ≠ beta := hbetaGammaJ.symm + have hdeltaBeta : d.1 ≠ beta := hbetaDelta.symm + have hphi1Beta : ∀ e : E, phi1 e = some beta ↔ phi e = some beta := by + intro e + by_cases hinc : TreeIncidentEdge T e + · simp [phi1, OutsideTreeColorSwap, hinc] + · by_cases hea : phi e = some D.alpha0 + · rw [hea] + simp [phi1, OutsideTreeColorSwap, hinc, hea, halphaBeta, hgammaBeta] + · by_cases heg : phi e = some gamma + · rw [heg] + simp [phi1, OutsideTreeColorSwap, hinc, heg, halphaGamma.symm, halphaBeta, hgammaBeta] + · simp [phi1, OutsideTreeColorSwap, hinc, hea, heg] + have hphi2Beta : ∀ e : E, phi2 e = some beta ↔ phi e = some beta := by + exact @helper_hphi2Beta_559 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + beta hgammaDelta hgammaBeta hdeltaBeta hphi1Beta + have hpsi1Beta : ∀ e : E, psi1 e = some beta ↔ phi e = some beta := by + intro e + by_cases hinc : TreeIncidentEdge T e + · simp [psi1, OutsideTreeColorSwap, hinc] + · by_cases heg : phi e = some gamma + · rw [heg] + simp [psi1, OutsideTreeColorSwap, hinc, heg, hgammaBeta, hgammaJBeta] + · by_cases hegJ : phi e = some gammaJ + · rw [hegJ] + simp [psi1, OutsideTreeColorSwap, hinc, hegJ, hgammaGammaJ.symm, hgammaBeta, hgammaJBeta] + · simp [psi1, OutsideTreeColorSwap, hinc, heg, hegJ] + have hpsi2Beta : ∀ e : E, psi2 e = some beta ↔ phi e = some beta := by + exact @helper_hpsi2Beta_583 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R beta hgammaJDelta hgammaJBeta hdeltaBeta hpsi1Beta + have missing_iff_of_beta_edges + (rho sigma : PartialEdgeColoring E k) + (hedges : ∀ e : E, rho e = some beta ↔ sigma e = some beta) + (v : V) : + beta ∈ MissingColors G rho v ↔ beta ∈ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + constructor + · intro h ⟨e, hve, he⟩ + exact h ⟨e, hve, (hedges e).mpr he⟩ + · intro h ⟨e, hve, he⟩ + exact h ⟨e, hve, (hedges e).mp he⟩ + have hybetaMissing2 : beta ∈ MissingColors G phi2 ybeta := + (missing_iff_of_beta_edges phi2 phi hphi2Beta ybeta).mpr hybetaMissing + have hybetaMissingJ2 : beta ∈ MissingColors G psi2 ybeta := + (missing_iff_of_beta_edges psi2 phi hpsi2Beta ybeta).mpr hybetaMissing + have hybetaNotUi : ybeta ∉ Ui := by + rcases hybetaCases with h | h + · rw [h] + simp [Ui, y0, base_ne_block b0 i 0, base_ne_block b0 i 1] + · rw [h] + simp [Ui, y1, base_ne_block b1 i 0, base_ne_block b1 i 1] + have hybetaNotUj : ybeta ∉ Uj := by + rcases hybetaCases with h | h + · rw [h] + simp [Uj, y0, base_ne_block b0 j 0, base_ne_block b0 j 1] + · rw [h] + simp [Uj, y1, base_ne_block b1 j 0, base_ne_block b1 j 1] + have hybetaSgamma : ybeta ∈ TreeSequenceVertexSet Sgamma := by + rw [hSgammaVertices] + exact Finset.mem_union.mpr + (Or.inl (Finset.mem_sdiff.mpr ⟨hybetaX, hybetaNotUi⟩)) + have hybetaSgammaJ : ybeta ∈ TreeSequenceVertexSet SgammaJ := by + rw [hSgammaJVertices] + exact Finset.mem_union.mpr + (Or.inl (Finset.mem_sdiff.mpr ⟨hybetaX, hybetaNotUj⟩)) + have hybetaTgamma : ybeta ∈ TreeSequenceVertexSet Tgamma := by + rw [hTgammaVertices] + exact Finset.mem_insert_of_mem hybetaSgamma + have hybetaTgammaJ : ybeta ∈ TreeSequenceVertexSet TgammaJ := by + rw [hTgammaJVertices] + exact Finset.mem_insert_of_mem hybetaSgammaJ + have hu2Tgamma : u2 ∈ TreeSequenceVertexSet Tgamma := by + rw [hTgammaVertices] + simp + have hu2TgammaJ : u2 ∈ TreeSequenceVertexSet TgammaJ := by + rw [hTgammaJVertices] + simp + have hybetaU2 : ybeta ≠ u2 := by + intro h + exact hu2X (h ▸ hybetaX) + have hbetaNotMissingU2 : beta ∉ MissingColors G phi2 u2 := by + intro hmissing + have hdisjoint := helementary2 hybetaTgamma hu2Tgamma hybetaU2 + exact (Finset.disjoint_left.mp hdisjoint) hybetaMissing2 hmissing + exact @helper_continuation_559 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R Sgamma SgammaJ hSgammaVertices hSgammaJVertices u2 hu2X hu2u1 + tashkinov_adjoin adjoin_vertex_set Tgamma TgammaJ hTgammaJTash hTgammaVertices + hTgammaJVertices hglobalJ2 hclosed0 hclosed2 beta hybetaMissing hybetaX hphi2Beta hpsi2Beta + hybetaMissing2 hybetaMissingJ2 hybetaTgamma hybetaTgammaJ hu2Tgamma hu2TgammaJ + hbetaNotMissingU2 +private theorem helper_continuation_588.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let phi2 : PartialEdgeColoring E k := + TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let psi2 : PartialEdgeColoring E k := + TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let Ui : Finset V := + {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := + {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + IsProperEdgeColoring G + (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) → + IsOneEdgeUncolored (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) e0 → + IsProperEdgeColoring G + (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) + (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) → + IsOneEdgeUncolored + (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) + (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) + e0 → + ∀ (Sgamma SgammaJ : TreeSequence G e0), + TreeSequenceVertexSet Sgamma = + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ + { R.u1 } → + TreeSequenceVertexSet SgammaJ = + TreeSequenceVertexSet T \ + {C.blockVertex R.blockIndex (0 : Fin (2 : ℕ)), + C.blockVertex R.blockIndex (1 : Fin (2 : ℕ))} ∪ + {D.u0 d} → + ∀ u2 ∉ TreeSequenceVertexSet T, + u2 ≠ R.u1 → + T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → + (∀ (a : Fin C.p) (r : Fin C.s) (b : Fin (2 : ℕ)), C.y a ≠ C.blockVertex r b) → + Ui ⊆ X → + Uj ⊆ X → + Ui.card = (2 : ℕ) → + Uj.card = (2 : ℕ) → + (∀ (rho : PartialEdgeColoring E k) (S U : TreeSequence G e0) (f : E), + TreeSequenceAdjoinEdge S f U → + TashkinovTree G e0 rho S → + ∀ (c : Fin k), + rho f = some c → + ∀ v ∈ TreeSequenceVertexSet S, + c ∈ MissingColors G rho v → TashkinovTree G e0 rho U) → + (∀ (A B : TreeSequence G e0) (f : E) (x y : V), + G.ends f = s(x, y) → + x ∈ TreeSequenceVertexSet A → + y ∉ TreeSequenceVertexSet A → + TreeSequenceAdjoinEdge A f B → + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A)) → + u2 ∉ TreeSequenceVertexSet Sgamma → + u2 ∉ TreeSequenceVertexSet SgammaJ → + ∀ (Tgamma TgammaJ : TreeSequence G e0), + TashkinovTree G e0 phi2 Tgamma → + TashkinovTree G e0 psi2 TgammaJ → + TreeSequenceVertexSet Tgamma = insert u2 (TreeSequenceVertexSet Sgamma) → + TreeSequenceVertexSet TgammaJ = insert u2 (TreeSequenceVertexSet SgammaJ) → + (TreeSequenceVertexSet Sgamma).card = X.card - (1 : ℕ) → + (TreeSequenceVertexSet SgammaJ).card = X.card - (1 : ℕ) → + False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ phi1 phi2 psi1 psi2 Ui Uj hproper1 + hone1 hproperJ2 honeJ2 Sgamma SgammaJ hSgammaVertices hSgammaJVertices u2 hu2X hu2u1 + hlength base_ne_block hUiSub hUjSub hUiCard hUjCard tashkinov_adjoin adjoin_vertex_set + hu2NotSgamma hu2NotSgammaJ Tgamma TgammaJ hTgammaTash hTgammaJTash hTgammaVertices + hTgammaJVertices hSgammaCard hSgammaJCard + have hTgammaCard : (TreeSequenceVertexSet Tgamma).card = X.card := by + rw [hTgammaVertices, Finset.card_insert_of_notMem hu2NotSgamma, + hSgammaCard] + have htwo : 2 ≤ X.card := hUiCard ▸ Finset.card_le_card hUiSub + omega + have hTgammaJCard : (TreeSequenceVertexSet TgammaJ).card = X.card := by + rw [hTgammaJVertices, Finset.card_insert_of_notMem hu2NotSgammaJ, + hSgammaJCard] + have htwo : 2 ≤ X.card := hUjCard ▸ Finset.card_le_card hUjSub + omega + have hproper2 : IsProperEdgeColoring G phi2 := by + simpa [phi2] using TwoColorComponentSwapProper G phi1 gamma d.1 + (by simpa [gamma, i] using R.gamma_ne_delta) hproper1 + (Sum.inl (D.v0 d)) + have hone2 : IsOneEdgeUncolored phi2 e0 := by + exact @helper_hone2_388 V E inferInstance inferInstance inferInstance G k e0 phi T C D d hone1 + have hK2 : KTriple G k e0 phi2 := + ⟨C.globally_maximum.1.1, C.globally_maximum.1.2.1, + C.globally_maximum.1.2.2.1, hproper2, hone2⟩ + have hKJ2 : KTriple G k e0 psi2 := + ⟨C.globally_maximum.1.1, C.globally_maximum.1.2.1, + C.globally_maximum.1.2.2.1, hproperJ2, honeJ2⟩ + have horder0 := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hglobal2 : GlobalMaximumTriple G k e0 phi2 Tgamma := + ⟨hK2, hTgammaTash, hTgammaCard.trans horder0.1.symm⟩ + have hglobalJ2 : GlobalMaximumTriple G k e0 psi2 TgammaJ := + ⟨hKJ2, hTgammaJTash, hTgammaJCard.trans horder0.1.symm⟩ + have hnewOrder := ScheideGlobalMaximumOrder G k e0 phi2 Tgamma hglobal2 + have hnewOrderJ := ScheideGlobalMaximumOrder G k e0 psi2 TgammaJ hglobalJ2 + have helementary0 : ColoredVertexSetElementary G phi X := by + exact horder0.2.2.2.1 + have hclosed0 : ColoredVertexSetClosed G phi X := by + exact horder0.2.2.2.2 + have helementary2 : ColoredVertexSetElementary G phi2 + (TreeSequenceVertexSet Tgamma) := hnewOrder.2.2.2.1 + have hclosed2 : ColoredVertexSetClosed G phi2 + (TreeSequenceVertexSet Tgamma) := hnewOrder.2.2.2.2 + let b0 : Fin C.p := + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + let b1 : Fin C.p := ⟨1, C.p_ge_two⟩ + let y0 := C.y b0 + let y1 := C.y b1 + have hy0X : y0 ∈ X := by + rw [show y0 = T.vertex ⟨0, by omega⟩ by + simpa [y0, b0] using (C.base_vertex_position b0).symm] + simp [X, TreeSequenceVertexSet] + have hy1X : y1 ∈ X := by + rw [show y1 = T.vertex ⟨1, by + have hp := C.p_ge_two + omega⟩ by simpa [y1, b1] using (C.base_vertex_position b1).symm] + simp [X, TreeSequenceVertexSet] + have hy01 : y0 ≠ y1 := by + exact @helper_hy01_441 V E inferInstance inferInstance inferInstance inferInstance G k e0 phi + T C D d R Sgamma SgammaJ hlength Tgamma TgammaJ + have he0ends : G.ends e0 = s(y1, y0) := by + exact @helper_he0ends_454 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R Sgamma SgammaJ hlength Tgamma TgammaJ + have hy0Incident : Incident G y0 e0 := by simp [Incident, he0ends] + have hy1Incident : Incident G y1 e0 := by simp [Incident, he0ends] + have hcount0 := + (ScheideGlobalMaximumMissingCounts G k e0 phi T C.globally_maximum + y0 (by simpa [X] using hy0X)).1 hy0Incident + have hcount1 := + (ScheideGlobalMaximumMissingCounts G k e0 phi T C.globally_maximum + y1 (by simpa [X] using hy1X)).1 hy1Incident + let M0 := MissingColors G phi y0 + let M1 := MissingColors G phi y1 + have hMdisjoint : Disjoint M0 M1 := by + exact helementary0 hy0X hy1X hy01 + have hMcard : 4 ≤ (M0 ∪ M1).card := by + rw [Finset.card_union_of_disjoint hMdisjoint] + have hc0 : 2 ≤ M0.card := by simpa [M0] using hcount0.2 + have hc1 : 2 ≤ M1.card := by simpa [M1] using hcount1.2 + omega + let forbidden : Finset (Fin k) := {D.alpha0, gamma, gammaJ} + have hforbiddenCard : forbidden.card ≤ 3 := by + simpa [forbidden] using + (Finset.card_le_three : ({D.alpha0, gamma, gammaJ} : Finset (Fin k)).card ≤ 3) + have hnsubset : ¬ M0 ∪ M1 ⊆ forbidden := by + intro hsub + have hle := Finset.card_le_card hsub + omega + obtain ⟨beta, hbetaUnion, hbetaForbidden⟩ := + Finset.not_subset.mp hnsubset + have hbetaForbidden' : beta ≠ D.alpha0 ∧ + beta ≠ gamma ∧ beta ≠ gammaJ := by + simpa [forbidden] using hbetaForbidden + have hbetaAlpha : beta ≠ D.alpha0 := by + exact hbetaForbidden'.1 + have hbetaGamma : beta ≠ gamma := by + exact hbetaForbidden'.2.1 + have hbetaGammaJ : beta ≠ gammaJ := by + exact hbetaForbidden'.2.2 + have halphaGamma : D.alpha0 ≠ gamma := by + simpa [gamma, i] using R.alpha0_ne_gamma + have hgammaGammaJ : gamma ≠ gammaJ := by + simpa [gamma, gammaJ, i, j] using R.gamma_ne_gammaJ + have hgammaDelta : gamma ≠ d.1 := by + simpa [gamma, i] using R.gamma_ne_delta + have hgammaJDelta : gammaJ ≠ d.1 := by + simpa [gammaJ, j] using R.gammaJ_ne_delta + exact @helper_continuation_563 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R Sgamma SgammaJ hSgammaVertices hSgammaJVertices u2 hu2X hu2u1 + base_ne_block tashkinov_adjoin adjoin_vertex_set Tgamma TgammaJ hTgammaJTash + hTgammaVertices hTgammaJVertices hglobalJ2 hclosed0 helementary2 hclosed2 hy0X hy1X beta + hbetaUnion hbetaAlpha hbetaGamma hbetaGammaJ halphaGamma hgammaGammaJ hgammaDelta hgammaJDelta +private theorem helper_continuation_291.{u_1, u_2} : + helperContinuation291Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ phi1 K phi2 psi1 KJ psi2 Ui Uj + hproper1 hone1 hstable1 hproperJ2 honeJ2 hdeltaMissingJ2 Sgamma SgammaJ hSgammaTash + hSgammaVertices hSgammaJTash hSgammaJVertices f2 z2 u2 hf2ends hz2Z hu2X hphi2f2 hpsi2f2 + hu2u0 hu2u1 hlength base_ne_block hUiSub hUjSub hUiCard hUjCard tashkinov_adjoin + have adjoin_vertex_set (A B : TreeSequence G e0) (f : E) (x y : V) + (hxy : G.ends f = s(x, y)) (hxA : x ∈ TreeSequenceVertexSet A) + (hyA : y ∉ TreeSequenceVertexSet A) + (hAB : TreeSequenceAdjoinEdge A f B) : + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by + exact @helper_adjoin_vertex_set_223 V E inferInstance G e0 A B f x y hxy hyA hAB + have hz2Sgamma : z2 ∈ TreeSequenceVertexSet Sgamma := by + rw [hSgammaVertices] + apply Finset.mem_union.mpr + apply Or.inl + apply Finset.mem_sdiff.mpr + exact ⟨(Finset.mem_sdiff.mp hz2Z).1, + fun hz => (Finset.mem_sdiff.mp hz2Z).2 + (Finset.mem_union.mpr (Or.inl (by simpa [Ui, i] using hz)))⟩ + have hz2SgammaJ : z2 ∈ TreeSequenceVertexSet SgammaJ := by + rw [hSgammaJVertices] + apply Finset.mem_union.mpr + apply Or.inl + apply Finset.mem_sdiff.mpr + exact ⟨(Finset.mem_sdiff.mp hz2Z).1, + fun hz => (Finset.mem_sdiff.mp hz2Z).2 + (Finset.mem_union.mpr (Or.inr (by simpa [Uj, j] using hz)))⟩ + have hu2NotSgamma : u2 ∉ TreeSequenceVertexSet Sgamma := by + rw [hSgammaVertices] + intro hu + rcases Finset.mem_union.mp hu with huOld | hu1 + · exact hu2X (Finset.mem_sdiff.mp huOld).1 + · exact hu2u1 (by simpa using hu1) + have hu2NotSgammaJ : u2 ∉ TreeSequenceVertexSet SgammaJ := by + rw [hSgammaJVertices] + intro hu + rcases Finset.mem_union.mp hu with huOld | hu0 + · exact hu2X (Finset.mem_sdiff.mp huOld).1 + · exact hu2u0 (by simpa using hu0) + have hf2BoundaryGamma : f2 ∈ BoundaryEdges G + (TreeSequenceVertexSet Sgamma) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨z2, hz2Sgamma, u2, hu2NotSgamma, hf2ends⟩ + have hf2BoundaryGammaJ : f2 ∈ BoundaryEdges G + (TreeSequenceVertexSet SgammaJ) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨z2, hz2SgammaJ, u2, hu2NotSgammaJ, hf2ends⟩ + obtain ⟨Tgamma, hAdjoinGamma⟩ := + TreeSequenceBoundaryEdgeAppendExists Sgamma f2 hf2BoundaryGamma + obtain ⟨TgammaJ, hAdjoinGammaJ⟩ := + TreeSequenceBoundaryEdgeAppendExists SgammaJ f2 hf2BoundaryGammaJ + have hv0X : D.v0 d ∈ X := by + simpa [X] using (D.replacement_path_full d).1 + have hv0Base : D.v0 d ∈ Finset.univ.image C.y := + ScheideStructuralExitsInBase G k e0 phi T C (D.v0_is_exit d) + obtain ⟨a0, _, ha0⟩ := Finset.mem_image.mp hv0Base + have hv0NotUi : D.v0 d ∉ Ui := by + simp [Ui, ← ha0, base_ne_block a0 i 0, base_ne_block a0 i 1] + have hv0Sgamma : D.v0 d ∈ TreeSequenceVertexSet Sgamma := by + rw [hSgammaVertices] + exact Finset.mem_union.mpr + (Or.inl (Finset.mem_sdiff.mpr ⟨hv0X, hv0NotUi⟩)) + have hgammaMissing1 : gamma ∈ MissingColors G phi1 (D.v0 d) := by + rw [hstable1.2 (D.v0 d) (by simpa [X] using hv0X)] + simpa [gamma, i] using D.gamma_missing_at_v0 d + have hbehavior := TwoColorComponentSwapMissingBehavior G phi1 gamma d.1 + (by simpa [gamma, i] using R.gamma_ne_delta) hproper1 + (Sum.inl (D.v0 d)) + have hdeltaMissing2 : d.1 ∈ MissingColors G phi2 (D.v0 d) := by + simpa [phi2, K] using + hbehavior.2.1 (D.v0 d) (by rfl) hgammaMissing1 + have hTgammaTash : TashkinovTree G e0 phi2 Tgamma := + tashkinov_adjoin phi2 Sgamma Tgamma f2 hAdjoinGamma hSgammaTash + d.1 hphi2f2 (D.v0 d) hv0Sgamma hdeltaMissing2 + have hv1X : R.v1 ∈ X := by simpa [X] using R.v1_mem + obtain ⟨a1, _, ha1⟩ := Finset.mem_image.mp R.v1_in_base + have hv1NotUj : R.v1 ∉ Uj := by + simp [Uj, ← ha1, base_ne_block a1 j 0, base_ne_block a1 j 1] + have hv1SgammaJ : R.v1 ∈ TreeSequenceVertexSet SgammaJ := by + rw [hSgammaJVertices] + exact Finset.mem_union.mpr + (Or.inl (Finset.mem_sdiff.mpr ⟨hv1X, hv1NotUj⟩)) + have hTgammaJTash : TashkinovTree G e0 psi2 TgammaJ := + tashkinov_adjoin psi2 SgammaJ TgammaJ f2 hAdjoinGammaJ hSgammaJTash + d.1 hpsi2f2 R.v1 hv1SgammaJ hdeltaMissingJ2 + have hTgammaVertices : TreeSequenceVertexSet Tgamma = + insert u2 (TreeSequenceVertexSet Sgamma) := + adjoin_vertex_set Sgamma Tgamma f2 z2 u2 hf2ends hz2Sgamma + hu2NotSgamma hAdjoinGamma + have hTgammaJVertices : TreeSequenceVertexSet TgammaJ = + insert u2 (TreeSequenceVertexSet SgammaJ) := + adjoin_vertex_set SgammaJ TgammaJ f2 z2 u2 hf2ends hz2SgammaJ + hu2NotSgammaJ hAdjoinGammaJ + have hSgammaCard : (TreeSequenceVertexSet Sgamma).card = X.card - 1 := by + rw [hSgammaVertices, Finset.union_singleton, + Finset.card_insert_of_notMem] + · rw [Finset.card_sdiff_of_subset hUiSub, hUiCard] + have htwo : 2 ≤ X.card := hUiCard ▸ Finset.card_le_card hUiSub + omega + · exact fun h => R.u1_outside (Finset.mem_sdiff.mp h).1 + have hSgammaJCard : (TreeSequenceVertexSet SgammaJ).card = X.card - 1 := by + rw [hSgammaJVertices, Finset.union_singleton, + Finset.card_insert_of_notMem] + · rw [Finset.card_sdiff_of_subset hUjSub, hUjCard] + have htwo : 2 ≤ X.card := hUjCard ▸ Finset.card_le_card hUjSub + omega + · exact fun h => D.u0_outside d (Finset.mem_sdiff.mp h).1 + exact @helper_continuation_588 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R hproper1 hone1 hproperJ2 honeJ2 Sgamma SgammaJ hSgammaVertices + hSgammaJVertices u2 hu2X hu2u1 hlength base_ne_block hUiSub hUjSub hUiCard hUjCard + tashkinov_adjoin adjoin_vertex_set hu2NotSgamma hu2NotSgammaJ Tgamma TgammaJ hTgammaTash + hTgammaJTash hTgammaVertices hTgammaJVertices hSgammaCard hSgammaJCard +theorem ScheideDefectiveReturnContradiction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) : + ∀ _ : ScheideDefectiveReturnData G k e0 phi T C D d, + False := by + classical + intro R + let X := TreeSequenceVertexSet T + let i := D.gammaIndex d + let j := R.blockIndex + let gamma := C.gamma i + let gammaJ := C.gamma j + let phi1 := OutsideTreeColorSwap T phi D.alpha0 gamma + let K := TwoColorComponent G phi1 gamma d.1 (Sum.inl (D.v0 d)) + let phi2 := TwoColorComponentSwap G phi1 gamma d.1 (Sum.inl (D.v0 d)) + let psi1 := OutsideTreeColorSwap T phi gamma gammaJ + let KJ := TwoColorComponent G psi1 gammaJ d.1 (Sum.inl R.v1) + let psi2 := TwoColorComponentSwap G psi1 gammaJ d.1 (Sum.inl R.v1) + let Ui := ({C.blockVertex i 0, C.blockVertex i 1} : Finset V) + let Uj := ({C.blockVertex j 0, C.blockVertex j 1} : Finset V) + have hterminal := ScheideDefectiveTerminalComponent G k e0 phi T C D d + dsimp only at hterminal + rcases hterminal with + ⟨hproper1, hone1, hstable1, hfixed1, htailK, hf0K, hKtree, + htreeEdgesOutside, hKcolors⟩ + have hterminalJ := + ScheideDefectiveSecondTerminalComponent G k e0 phi T C D d R + dsimp only at hterminalJ + rcases hterminalJ with + ⟨hproperJ1, honeJ1, hstableJ1, hfixedJ1, htailKJ, hf1KJ, hKJtree, + htreeEdgesOutsideJ, hf1colorJ1, hproperJ2, honeJ2, hdeltaMissingJ2, + hotherMissingJ2, hf0colorJ2⟩ + have hpairs := ScheideDefectiveDeletedTreePair G k e0 phi T C D d R + dsimp only at hpairs + rcases hpairs with + ⟨Sgamma, SgammaJ, hSgammaTash, hSgammaVertices, + hSgammaJTash, hSgammaJVertices, hf1color2, hf0colorJ2'⟩ + have hthird := ScheideDefectiveThirdBoundaryEdge G k e0 phi T C D d R + dsimp only at hthird + rcases hthird with + ⟨f2, z2, u2, hf2color, hf2ends, hz2Z, hu2X, hf2f0, hf2f1, + hz2v0, hz2v1, hphi2f2, hpsi2f2, hu2u0, hu2u1⟩ + have hlength := C.length_eq + have block_pair_ne (r : Fin C.s) : + C.blockVertex r 0 ≠ C.blockVertex r 1 := by + intro h + let q0 : Fin (T.length + 1) := ⟨C.p + 2 * r.val, by + have hr := r.isLt + omega⟩ + let q1 : Fin (T.length + 1) := ⟨C.p + 2 * r.val + 1, by + have hr := r.isLt + omega⟩ + have hv : T.vertex q0 = T.vertex q1 := by + rw [show T.vertex q0 = C.blockVertex r 0 by + simpa [q0] using C.block_vertex_position r 0] + rw [show T.vertex q1 = C.blockVertex r 1 by + simpa [q1] using C.block_vertex_position r 1] + exact h + have hq := congrArg Fin.val (T.vertex_injective hv) + dsimp [q0, q1] at hq + omega + have block_mem_X (r : Fin C.s) (b : Fin 2) : + C.blockVertex r b ∈ X := by + rw [← C.block_vertex_position r b] + simp [X, TreeSequenceVertexSet] + have base_ne_block (a : Fin C.p) (r : Fin C.s) (b : Fin 2) : + C.y a ≠ C.blockVertex r b := by + intro h + let qa : Fin (T.length + 1) := ⟨a.val, by + have ha := a.isLt + omega⟩ + let qb : Fin (T.length + 1) := + ⟨C.p + 2 * r.val + b.val, by + have hr := r.isLt + have hb := b.isLt + omega⟩ + have hv : T.vertex qa = T.vertex qb := by + rw [show T.vertex qa = C.y a by + simpa [qa] using C.base_vertex_position a] + rw [show T.vertex qb = C.blockVertex r b by + simpa [qb] using C.block_vertex_position r b] + exact h + have hq := congrArg Fin.val (T.vertex_injective hv) + have ha := a.isLt + dsimp [qa, qb] at hq + omega + have hUiSub : Ui ⊆ X := by + intro v hv + simp only [Ui, Finset.mem_insert, Finset.mem_singleton] at hv + rcases hv with rfl | rfl + · exact block_mem_X i 0 + · exact block_mem_X i 1 + have hUjSub : Uj ⊆ X := by + intro v hv + simp only [Uj, Finset.mem_insert, Finset.mem_singleton] at hv + rcases hv with rfl | rfl + · exact block_mem_X j 0 + · exact block_mem_X j 1 + have hUiCard : Ui.card = 2 := by simp [Ui, block_pair_ne i] + have hUjCard : Uj.card = 2 := by simp [Uj, block_pair_ne j] + have tashkinov_adjoin (rho : PartialEdgeColoring E k) + (S U : TreeSequence G e0) (f : E) + (hadjoin : TreeSequenceAdjoinEdge S f U) + (hS : TashkinovTree G e0 rho S) (c : Fin k) + (hf : rho f = some c) (v : V) (hv : v ∈ TreeSequenceVertexSet S) + (hmiss : c ∈ MissingColors G rho v) : + TashkinovTree G e0 rho U := by + exact @helper_tashkinov_adjoin_165 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R rho S U f hadjoin hS c hf v hv hmiss + exact @helper_continuation_291 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R hproper1 hone1 hstable1 hproperJ2 honeJ2 hdeltaMissingJ2 Sgamma SgammaJ + hSgammaTash hSgammaVertices hSgammaJTash hSgammaJVertices f2 z2 u2 hf2ends hz2Z hu2X + hphi2f2 hpsi2f2 hu2u0 hu2u1 hlength base_ne_block hUiSub hUjSub hUiCard hUjCard + tashkinov_adjoin +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveReturnData.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveReturnData.lean new file mode 100644 index 0000000000..4eb47ad63f --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveReturnData.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup + +/-! +# Scheide Defective Return Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- The final departure of a replacement defective chain, with its boundary edge and block-color +witnesses. +-/ +structure ScheideDefectiveReturnData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) }) where + /-- The position of the last inside vertex on the defective chain. -/ + pathIndex : Fin ((D.replacementPath d).length + 1) + /-- The position of the boundary edge immediately following that vertex. -/ + edgeIndex : Fin ((D.replacementPath d).length + 1) + /-- The position of the following outside vertex. -/ + outsideIndex : Fin ((D.replacementPath d).length + 1) + /-- The first selected vertex inside the tree. -/ + v1 : V + /-- The first selected boundary edge. -/ + f1 : E + /-- The first selected outside vertex. -/ + u1 : V + /-- The structural block whose color is missing at the selected vertex. -/ + blockIndex : Fin C.s + v1_at_index : (D.replacementPath d).getVert pathIndex.val = Sum.inl v1 + f1_at_index : (D.replacementPath d).getVert edgeIndex.val = Sum.inr f1 + u1_at_index : (D.replacementPath d).getVert outsideIndex.val = Sum.inl u1 + successive_indices : edgeIndex.val = pathIndex.val + 1 ∧ outsideIndex.val = pathIndex.val + 2 + after_last_tree_vertex : + ∀ r : Fin ((D.replacementPath d).length + 1), + pathIndex.val < r.val → + ∀ x : V, (D.replacementPath d).getVert r.val = Sum.inl x → x ∉ TreeSequenceVertexSet T + v1_mem : v1 ∈ TreeSequenceVertexSet T + v1_ne_v0 : v1 ≠ D.v0 d + u1_outside : u1 ∉ TreeSequenceVertexSet T + v1_is_exit : v1 ∈ ScheideExitVertices T phi + v1_in_base : v1 ∈ Finset.univ.image C.y + f1_color : phi f1 = some d.1 + f1_ends : G.ends f1 = s(v1, u1) + gammaJ_missing : C.gamma blockIndex ∈ MissingColors G phi v1 + blockIndex_ne : blockIndex ≠ D.gammaIndex d + alpha0_ne_gamma : D.alpha0 ≠ C.gamma (D.gammaIndex d) + alpha0_ne_gammaJ : D.alpha0 ≠ C.gamma blockIndex + alpha0_ne_delta : D.alpha0 ≠ d.1 + gamma_ne_gammaJ : C.gamma (D.gammaIndex d) ≠ C.gamma blockIndex + gamma_ne_delta : C.gamma (D.gammaIndex d) ≠ d.1 + gammaJ_ne_delta : C.gamma blockIndex ≠ d.1 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveSecondTerminalComponent.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveSecondTerminalComponent.lean new file mode 100644 index 0000000000..93f9c89764 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveSecondTerminalComponent.lean @@ -0,0 +1,1143 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Defective Second Terminal Component + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation880Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let v0 : V := D.v0 d; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; + let i : Fin ((D.replacementPath d).length + (1 : ℕ)) := R.pathIndex; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma (↑d : Fin k); + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gammaJ (↑d : Fin k); + let _ : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑r : ℕ) ∧ p.getVert (↑r : ℕ) = q}; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gammaJ (↑d : Fin k) (Sum.inl + R.v1); IsProperEdgeColoring G phi → ColoredVertexSetClosed G phi X → v0 ∈ X → R.v1 ∈ X → + p.IsPath → {q : V ⊕ E | q ∈ p.support} = TwoColorComponent G phi gamma (↑d : Fin k) + (Sum.inl v0) → gamma ≠ (↑d : Fin k) → gammaJ ≠ (↑d : Fin k) → gamma ≠ gammaJ → + IsProperEdgeColoring G phi1 → IsOneEdgeUncolored phi1 e0 → StableColoring T ∅ phi phi1 → ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → (↑R.edgeIndex : ℕ) = (↑R.pathIndex : ℕ) + + (1 : ℕ) ∧ (↑R.outsideIndex : ℕ) = (↑R.pathIndex : ℕ) + (2 : ℕ) → (↑i : ℕ) + (1 : ℕ) < + p.length → p.getVert (↑i : ℕ) = Sum.inl R.v1 → p.getVert ((↑i : ℕ) + (1 : ℕ)) = Sum.inr + R.f1 → ( + ∀ {e : E} {w : V}, TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X) → + IsProperEdgeColoring G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) ∧ IsOneEdgeUncolored (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) + (C.gamma R.blockIndex)) e0 ∧ StableColoring T ∅ phi (OutsideTreeColorSwap T phi (C.gamma + (D.gammaIndex d)) (C.gamma R.blockIndex)) ∧ ( + ∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) + (C.gamma R.blockIndex) f = phi f) ∧ {q : V ⊕ E | + ∃ (r : Fin ((D.replacementPath d).length + (1 : ℕ))), (↑R.pathIndex : ℕ) ≤ (↑r : ℕ) ∧ + (D.replacementPath d).getVert (↑r : ℕ) = q} = TwoColorComponent G (OutsideTreeColorSwap T + phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) + (Sum.inl R.v1) ∧ Sum.inr R.f1 ∈ TwoColorComponent G (OutsideTreeColorSwap T phi (C.gamma + (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl + R.v1) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G (OutsideTreeColorSwap T phi + (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) + (Sum.inl R.v1) ↔ v = R.v1) ∧ ( + ∀ (q : Fin T.length), Sum.inr (T.edge q) ∉ TwoColorComponent G (OutsideTreeColorSwap T phi + (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) + (Sum.inl R.v1)) ∧ OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex) R.f1 = some (↑d : Fin k) ∧ IsProperEdgeColoring G (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) e0 ∧ (↑d : Fin k) ∈ MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) R.v1 ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, v ≠ R.v1 → MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) v = MissingColors G phi v) ∧ + TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) (D.f0 d) = some (↑d : + Fin k) + +private theorem helper_adjacent_indices_forward_225.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E + k) (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideDefectiveReturnData G k e0 phi T C D d), + let v0 : V := D.v0 d; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; + let i : Fin ((D.replacementPath d).length + (1 : ℕ)) := R.pathIndex; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma (↑d : Fin k); + let _ : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑r : ℕ) ∧ p.getVert (↑r : ℕ) = q}; + IsProperEdgeColoring G phi → p.IsPath → @SimpleGraph.degree (Sum V E) H0 (@Sum.inl V E v0) + (@Fintype.ofFinite (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) H0 (@Sum.inl V + E v0))) (@Subtype.finite (Sum V E) (@Finite.of_fintype (Sum V E) (@instFintypeSum V E inst + inst_1)) (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) H0 (@Sum.inl V E v0))))) ≤ (1 : ℕ) → + ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → n < m → H0.Adj (p.getVert n) (p.getVert m) → m = n + + (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R v0 gamma p i H0 S hproper hpathIs hy0Degree n m hn hm + hnm hadj + by_contra hne + have hgap : n + 1 < m := by omega + by_cases hn0 : n = 0 + · subst n + have hfirstAdj := p.adj_getVert_succ (by omega : 0 < p.length) + have hstart : p.getVert 0 = Sum.inl v0 := by simp [p, v0] + have hneigh : p.getVert 1 ≠ p.getVert m := by + intro heq + have := hpathIs.getVert_injOn (show 1 ≤ p.length by omega) hm heq + omega + have htwo : 2 ≤ (@SimpleGraph.neighborFinset (Sum V E) H0 (Sum.inl v0) + (Fintype.ofFinite _)).card := by + have hs : ({p.getVert 1, p.getVert m} : Finset (Sum V E)) ⊆ + @SimpleGraph.neighborFinset (Sum V E) H0 (Sum.inl v0) + (Fintype.ofFinite _) := by + intro q hq + simp only [Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset, H0, hstart] using hfirstAdj + · simpa [SimpleGraph.mem_neighborFinset, H0, hstart] using hadj + have hc : ({p.getVert 1, p.getVert m} : Finset (Sum V E)).card = 2 := by + simp [hneigh] + rw [← hc] + exact Finset.card_le_card hs + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hy0Degree + omega + · have hnlt : n < p.length := by omega + have hleft : H0.Adj (p.getVert n) (p.getVert (n - 1)) := by + have h := p.adj_getVert_succ (i := n - 1) (by omega) + have heq : n - 1 + 1 = n := by omega + simpa [H0, heq] using h.symm + have hright : H0.Adj (p.getVert n) (p.getVert (n + 1)) := by + simpa [H0] using p.adj_getVert_succ hnlt + have hnm1 : p.getVert (n - 1) ≠ p.getVert (n + 1) := by + intro heq + have := hpathIs.getVert_injOn (Nat.sub_le n 1 |>.trans hn) + (Nat.succ_le_of_lt hnlt) heq + omega + have hnm2 : p.getVert (n - 1) ≠ p.getVert m := by + intro heq + have := hpathIs.getVert_injOn (Nat.sub_le n 1 |>.trans hn) hm heq + omega + have hnm3 : p.getVert (n + 1) ≠ p.getVert m := by + intro heq + have := hpathIs.getVert_injOn (Nat.succ_le_of_lt hnlt) hm heq + omega + have hthree : 3 ≤ (@SimpleGraph.neighborFinset (Sum V E) H0 (p.getVert n) + (Fintype.ofFinite _)).card := by + let S : Finset (Sum V E) := + {p.getVert (n - 1), p.getVert (n + 1), p.getVert m} + have hs : S ⊆ @SimpleGraph.neighborFinset (Sum V E) H0 (p.getVert n) + (Fintype.ofFinite _) := by + intro q hq + simp only [S, Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + · simpa [SimpleGraph.mem_neighborFinset] using hadj + have hc : S.card = 3 := by + simp [S, hnm1, hnm2, hnm3] + rw [← hc] + exact Finset.card_le_card hs + have hdeg := TwoColorIncidenceDegreeAtMostTwo G phi gamma d.1 hproper + (p.getVert n) + change @SimpleGraph.degree _ H0 (p.getVert n) (Fintype.ofFinite _) ≤ 2 at hdeg + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hdeg + omega + +private theorem helper_tail_step_new_323.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; + let i : Fin ((D.replacementPath d).length + (1 : ℕ)) := R.pathIndex; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma (↑d : Fin k); + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gammaJ (↑d : Fin k); R.v1 ∈ X → + ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → (↑R.edgeIndex : ℕ) = (↑R.pathIndex : ℕ) + + (1 : ℕ) ∧ (↑R.outsideIndex : ℕ) = (↑R.pathIndex : ℕ) + (2 : ℕ) → p.getVert ((↑i : ℕ) + (1 + : ℕ)) = Sum.inr R.f1 → ( + ∀ {r : Fin (p.length + (1 : ℕ))} {w : V}, (↑i : ℕ) ≤ (↑r : ℕ) → p.getVert (↑r : ℕ) = Sum.inl w + → (↑r : ℕ) = (↑i : ℕ) ∧ w = R.v1 ∨ (↑i : ℕ) < (↑r : ℕ) ∧ w ∉ X) → ( + ∀ {w : V} {e : E}, w ∉ X → Incident G w e → phi e = some gamma ∨ phi e = some (↑d : Fin k) → + phi1 e = some gammaJ ∨ phi1 e = some (↑d : Fin k)) → + ∀ (n : ℕ), (↑i : ℕ) ≤ n → n < p.length → H1.Adj (p.getVert n) (p.getVert (n + (1 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X gamma gammaJ phi1 p i H0 H1 hv1X hfixed hsucc hf1At + tail_vertex outside_edge_effect n hin hnlt + have hold := p.adj_getVert_succ hnlt + cases hleft : p.getVert n with + | inl w => + cases hright : p.getVert (n + 1) with + | inl x => + rw [hleft, hright] at hold + simp [TwoColorIncidenceGraph] at hold + | inr e => + rw [hleft, hright] at hold + have hdata : Incident G w e ∧ + (phi e = some gamma ∨ phi e = some d.1) := by + simpa [H0, TwoColorIncidenceGraph] using hold + let rn : Fin (p.length + 1) := ⟨n, by omega⟩ + have htv := tail_vertex (r := rn) (w := w) (by simpa [rn] using hin) + (by simpa [rn] using hleft) + have hnew : phi1 e = some gammaJ ∨ phi1 e = some d.1 := by + rcases htv with hbase | hout + · have hnbase : n = i.val := hbase.1 + have heq : e = R.f1 := by + apply Sum.inr.inj + rw [← hright, hnbase, hf1At] + subst e + right + apply (hfixed (R.f1) ?_).trans (R.f1_color) + exact ⟨R.v1, by simpa [X] using hv1X, by simpa [hbase.2] using hdata.1⟩ + · exact outside_edge_effect hout.2 hdata.1 hdata.2 + simpa [H1, TwoColorIncidenceGraph] using And.intro hdata.1 hnew + | inr e => + cases hright : p.getVert (n + 1) with + | inr f => + rw [hleft, hright] at hold + simp [TwoColorIncidenceGraph] at hold + | inl w => + rw [hleft, hright] at hold + have hdata : Incident G w e ∧ + (phi e = some gamma ∨ phi e = some d.1) := by + simpa [H0, TwoColorIncidenceGraph] using hold + let rn : Fin (p.length + 1) := ⟨n + 1, by omega⟩ + have htv := tail_vertex (r := rn) (w := w) (by simp [rn]; omega) + (by simpa [rn] using hright) + have hwout : w ∉ X := by + rcases htv with hbase | hout + · simp [rn] at hbase + omega + · exact hout.2 + have hnew := outside_edge_effect hwout hdata.1 hdata.2 + simpa [H1, TwoColorIncidenceGraph] using And.intro hdata.1 hnew + +private theorem helper_new_edge_old_374.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; + let i : Fin ((D.replacementPath d).length + (1 : ℕ)) := R.pathIndex; ColoredVertexSetClosed G + phi X → R.v1 ∈ X → gamma ≠ (↑d : Fin k) → gammaJ ≠ (↑d : Fin k) → gamma ≠ gammaJ → ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → ( + ∀ {e : E} {w : V}, TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X) → ( + ∀ {c : Fin k} {v : V} {e : E}, c ∈ MissingColors G phi v → Incident G v e → phi e ≠ some c) → + ( + ∀ {r : Fin (p.length + (1 : ℕ))} {w : V}, (↑i : ℕ) ≤ (↑r : ℕ) → p.getVert (↑r : ℕ) = Sum.inl w + → (↑r : ℕ) = (↑i : ℕ) ∧ w = R.v1 ∨ (↑i : ℕ) < (↑r : ℕ) ∧ w ∉ X) → + ∀ {r : Fin (p.length + (1 : ℕ))} {w : V} {e : E}, (↑i : ℕ) ≤ (↑r : ℕ) → p.getVert (↑r : ℕ) = + Sum.inl w → Incident G w e → phi1 e = some gammaJ ∨ phi1 e = some (↑d : Fin k) → phi e = + some gamma ∨ phi e = some (↑d : Fin k) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X gamma gammaJ phi1 p i hclosed hv1X hgammaDelta + hgammaJDelta hgammaGammaJ hfixed boundary_of_tree_incident_outside missing_no_incident + tail_vertex r w e hir hget hinc hnew + have htv := tail_vertex hir hget + by_cases hti : TreeIncidentEdge T e + · have hfix := hfixed e hti + rcases hnew with hg | hd + · have hgold : phi e = some gammaJ := hfix.symm.trans hg + rcases htv with hbase | hout + · exact False.elim ((missing_no_incident + (by simpa [gammaJ] using R.gammaJ_missing) + (by simpa [hbase.2] using hinc)) hgold) + · have hb := boundary_of_tree_incident_outside hti hout.2 hinc + exact False.elim ((hclosed hb hv1X hgold) + (by simpa [gammaJ] using R.gammaJ_missing)) + · exact Or.inr (hfix.symm.trans hd) + · rcases hnew with hg | hd + · by_cases ha : phi e = some gamma + · exact Or.inl ha + · by_cases hgc : phi e = some gammaJ + · have heq : some gamma = some gammaJ := by + simp [phi1, OutsideTreeColorSwap, hti, hgc, hgammaGammaJ, hgammaGammaJ.symm] at hg + exact False.elim (hgammaGammaJ (Option.some.inj heq)) + · have : phi e = some gammaJ := by + simp [phi1, OutsideTreeColorSwap, hti, ha, hgc] at hg + exact False.elim (hgc this) + · by_cases ha : phi e = some gamma + · have heq : some gammaJ = some d.1 := by + simpa [phi1, OutsideTreeColorSwap, hti, ha] using hd + exact False.elim (hgammaJDelta (Option.some.inj heq)) + · by_cases hgc : phi e = some gammaJ + · have heq : some gamma = some d.1 := by + simpa [phi1, OutsideTreeColorSwap, hti, ha, hgc, hgammaGammaJ, + hgammaGammaJ.symm] using hd + exact False.elim (hgammaDelta (Option.some.inj heq)) + · exact Or.inr (by + simpa [phi1, OutsideTreeColorSwap, hti, ha, hgc] using hd) + +private theorem helper_new_adj_old_414.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let _ : V := D.v0 d; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; + let i : Fin ((D.replacementPath d).length + (1 : ℕ)) := R.pathIndex; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma (↑d : Fin k); + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gammaJ (↑d : Fin k); + let S : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑r : ℕ) ∧ p.getVert (↑r : ℕ) = q}; ( + ∀ {r : Fin (p.length + (1 : ℕ))} {w : V} {e : E}, (↑i : ℕ) ≤ (↑r : ℕ) → p.getVert (↑r : ℕ) = + Sum.inl w → Incident G w e → phi1 e = some gammaJ ∨ phi1 e = some (↑d : Fin k) → phi e = + some gamma ∨ phi e = some (↑d : Fin k)) → + ∀ {q r : V ⊕ E}, q ∈ S → H1.Adj q r → H0.Adj q r := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R v0 gamma gammaJ phi1 p i H0 H1 S new_edge_old q r hq hadj + obtain ⟨n, hn, hget⟩ := hq + cases q with + | inl w => + cases r with + | inl x => simp [H1, TwoColorIncidenceGraph] at hadj + | inr e => + have hnew : Incident G w e ∧ + (phi1 e = some gammaJ ∨ phi1 e = some d.1) := by + simpa [H1, TwoColorIncidenceGraph] using hadj + have hold := new_edge_old hn hget hnew.1 hnew.2 + simpa [H0, TwoColorIncidenceGraph] using And.intro hnew.1 hold + | inr e => + cases r with + | inr f => simp [H1, TwoColorIncidenceGraph] at hadj + | inl w => + have hn0 : 0 < n.val := by + by_contra hz + have hz0 : n.val = 0 := by omega + rw [hz0] at hget + have : Sum.inr e = Sum.inl v0 := by simpa [p, v0] using hget.symm + simp at this + have hprev := p.adj_getVert_succ (i := n.val - 1) (by omega) + have hidx : n.val - 1 + 1 = n.val := by omega + rw [hidx, hget] at hprev + cases hprevNode : p.getVert (n.val - 1) with + | inr f => + rw [hprevNode] at hprev + simp [TwoColorIncidenceGraph] at hprev + | inl x => + rw [hprevNode] at hprev + have hold : phi e = some gamma ∨ phi e = some d.1 := by + simpa [H0, TwoColorIncidenceGraph] using hprev.2 + have hinc : Incident G w e := by + simpa [H1, TwoColorIncidenceGraph] using hadj.1 + simpa [H0, TwoColorIncidenceGraph] using And.intro hinc hold + +private theorem helper_S_closed_452.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let v0 : V := D.v0 d; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; + let i : Fin ((D.replacementPath d).length + (1 : ℕ)) := R.pathIndex; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma (↑d : Fin k); + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gammaJ (↑d : Fin k); + let S : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑r : ℕ) ∧ p.getVert (↑r : ℕ) = q}; + IsProperEdgeColoring G phi → R.v1 ∈ X → p.IsPath → {q : V ⊕ E | q ∈ p.support} = + TwoColorComponent G phi gamma (↑d : Fin k) (Sum.inl v0) → ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → (↑R.edgeIndex : ℕ) = (↑R.pathIndex : ℕ) + + (1 : ℕ) ∧ (↑R.outsideIndex : ℕ) = (↑R.pathIndex : ℕ) + (2 : ℕ) → (↑i : ℕ) + (1 : ℕ) < + p.length → p.getVert (↑i : ℕ) = Sum.inl R.v1 → p.getVert ((↑i : ℕ) + (1 : ℕ)) = Sum.inr + R.f1 → ( + ∀ {c : Fin k} {v : V} {e : E}, c ∈ MissingColors G phi v → Incident G v e → phi e ≠ some c) → + ( + ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → H0.Adj (p.getVert n) (p.getVert m) → n + (1 : ℕ) = + m ∨ m + (1 : ℕ) = n) → ( + ∀ {q r : V ⊕ E}, q ∈ S → H1.Adj q r → H0.Adj q r) → + ∀ {q r : V ⊕ E}, q ∈ S → H1.Adj q r → r ∈ S := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X v0 gamma gammaJ phi1 p i H0 H1 S hproper hv1X hpathIs + hsupport hfixed hsucc hiOneLt hv1At hf1At missing_no_incident old_adjacent_indices + new_adj_old q r hq hadj + have holdAdj := new_adj_old hq hadj + obtain ⟨n, hn, hget⟩ := hq + have hqOld : q ∈ TwoColorComponent G phi gamma d.1 (Sum.inl v0) := by + rw [← hsupport] + rw [← hget] + exact p.getVert_mem_support n.val + have hrOld : r ∈ TwoColorComponent G phi gamma d.1 (Sum.inl v0) := by + change H0.connectedComponentMk r = H0.connectedComponentMk (Sum.inl v0) + change H0.connectedComponentMk q = H0.connectedComponentMk (Sum.inl v0) at hqOld + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + holdAdj.symm).trans hqOld + have hrSupport : r ∈ p.support := by + have : r ∈ {x | x ∈ p.support} := by + rw [hsupport] + exact hrOld + exact this + obtain ⟨m, hmget, hml⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hrSupport + have hindices := old_adjacent_indices n.val m (Nat.le_of_lt_succ n.isLt) hml + (by simpa [H0, hget, hmget] using holdAdj) + rcases hindices with hforward | hback + · refine ⟨⟨m, Nat.lt_succ_of_le hml⟩, ?_, hmget⟩ + have him : i.val ≤ m := hn.trans (by omega) + exact him + · by_cases hm : i.val ≤ m + · exact ⟨⟨m, Nat.lt_succ_of_le hml⟩, hm, hmget⟩ + · have hnbase : n.val = i.val := by omega + have hmbase : m + 1 = i.val := by omega + have hqv : q = Sum.inl (R.v1) := by + rw [← hget, hnbase, hv1At] + cases hr : r with + | inl w => + have hbad : H1.Adj (Sum.inl (R.v1)) (Sum.inl w) := by + simpa [hqv, hr] using hadj + simp [H1, TwoColorIncidenceGraph] at hbad + | inr e => + have hbad : H1.Adj (Sum.inl (R.v1)) (Sum.inr e) := by + simpa [hqv, hr] using hadj + have hnew : Incident G (R.v1) e ∧ + (phi1 e = some gammaJ ∨ phi1 e = some d.1) := by + simpa [H1, TwoColorIncidenceGraph] using hbad + have heTree : TreeIncidentEdge T e := + ⟨R.v1, by simpa [X] using hv1X, hnew.1⟩ + have heOld : phi e = some d.1 := by + rcases hnew.2 with hg | hd + · have hgold : phi e = some gammaJ := (hfixed e heTree).symm.trans hg + exact False.elim ((missing_no_incident + (by simpa [gammaJ] using R.gammaJ_missing) hnew.1) hgold) + · exact (hfixed e heTree).symm.trans hd + have hef : e ≠ R.f1 := by + intro hef + have hnodes : p.getVert m = p.getVert (i.val + 1) := by + rw [hmget, hr, hef, hf1At] + have hidx := hpathIs.getVert_injOn hml (Nat.le_of_lt hiOneLt) hnodes + omega + exact False.elim ((hproper hef + ⟨R.v1, hnew.1, by simp [Incident, R.f1_ends]⟩ heOld) + (R.f1_color)) + +private theorem helper_htreeEdges_565.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gammaJ (↑d : Fin k); + let K : Set (V ⊕ E) := TwoColorComponent G phi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); ( + ∀ v ∈ X, Sum.inl v ∈ K ↔ v = R.v1) → + ∀ (q : Fin T.length), Sum.inr (T.edge q) ∉ K := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X gamma gammaJ phi1 H1 K hKtree q hedge + have hreach : H1.Reachable (Sum.inl R.v1) (Sum.inr (T.edge q)) := by + apply SimpleGraph.ConnectedComponent.eq.mp + change H1.connectedComponentMk (Sum.inr (T.edge q)) = + H1.connectedComponentMk (Sum.inl R.v1) at hedge + exact hedge.symm + have hne : Sum.inl R.v1 ≠ Sum.inr (T.edge q) := by + intro h + cases h + have hsupp : Sum.inr (T.edge q) ∈ H1.support := + SimpleGraph.mem_support_of_reachable hne.symm hreach.symm + obtain ⟨w, hw⟩ := H1.mem_support.mp hsupp + have hcolor : phi1 (T.edge q) = some gammaJ ∨ + phi1 (T.edge q) = some d.1 := by + cases w with + | inl w => exact hw.2 + | inr w => simp [H1, TwoColorIncidenceGraph] at hw + obtain ⟨a, hends⟩ := T.attaches q + let oldIndex : Fin (T.length + 1) := + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)) + let newVertex := T.vertex q.succ + let oldVertex := T.vertex oldIndex + have hnewIncident : Incident G newVertex (T.edge q) := by + change newVertex ∈ G.ends (T.edge q) + rw [hends] + simp [newVertex] + have holdIncident : Incident G oldVertex (T.edge q) := by + change oldVertex ∈ G.ends (T.edge q) + rw [hends] + simp [oldVertex, oldIndex] + have hnewAdj : H1.Adj (Sum.inl newVertex) (Sum.inr (T.edge q)) := by + simp [H1, TwoColorIncidenceGraph, hnewIncident, hcolor] + have holdAdj : H1.Adj (Sum.inl oldVertex) (Sum.inr (T.edge q)) := by + simp [H1, TwoColorIncidenceGraph, holdIncident, hcolor] + have hnewK : Sum.inl newVertex ∈ K := by + change H1.connectedComponentMk (Sum.inl newVertex) = + H1.connectedComponentMk (Sum.inl R.v1) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hnewAdj).trans hedge + have holdK : Sum.inl oldVertex ∈ K := by + change H1.connectedComponentMk (Sum.inl oldVertex) = + H1.connectedComponentMk (Sum.inl R.v1) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + holdAdj).trans hedge + have hnewX : newVertex ∈ X := by + simp [X, TreeSequenceVertexSet, newVertex] + have holdX : oldVertex ∈ X := by + simp [X, TreeSequenceVertexSet, oldVertex] + have hnewEq : newVertex = R.v1 := (hKtree newVertex hnewX).mp hnewK + have holdEq : oldVertex = R.v1 := (hKtree oldVertex holdX).mp holdK + apply G.loopless (T.edge q) R.v1 + simpa [newVertex, oldVertex, oldIndex, hnewEq, holdEq] using hends + +private theorem helper_hy0Degree_676.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let v0 : V := D.v0 d; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma (↑d : Fin k); + IsProperEdgeColoring G phi → ( + ∀ {c : Fin k} {v : V} {e : E}, c ∈ MissingColors G phi v → Incident G v e → phi e ≠ some c) → + @SimpleGraph.degree (Sum V E) H0 (@Sum.inl V E v0) (@Fintype.ofFinite (@Set.Elem (Sum V E) + (@SimpleGraph.neighborSet (Sum V E) H0 (@Sum.inl V E v0))) (@Subtype.finite (Sum V E) + (@Finite.of_fintype (Sum V E) (@instFintypeSum V E inst inst_1)) (@Membership.mem (Sum V + E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) H0 + (@Sum.inl V E v0))))) ≤ (1 : ℕ) := by + classical + intro V E _ _ _ G k e0 phi T C D d v0 gamma H0 hproper missing_no_incident + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro a ha b hb + simp only [SimpleGraph.mem_neighborFinset] at ha hb + cases a with + | inl a => simp [H0, TwoColorIncidenceGraph] at ha + | inr e => + cases b with + | inl b => simp [H0, TwoColorIncidenceGraph] at hb + | inr f => + simp only [H0, TwoColorIncidenceGraph] at ha hb + have hea : phi e = some d.1 := ha.2.resolve_left + (missing_no_incident + (by simpa [gamma, v0] using D.gamma_missing_at_v0 d) ha.1) + have hfa : phi f = some d.1 := hb.2.resolve_left + (missing_no_incident + (by simpa [gamma, v0] using D.gamma_missing_at_v0 d) hb.1) + by_cases hef : e = f + · exact congrArg Sum.inr hef + · exact False.elim ((hproper hef ⟨v0, ha.1, hb.1⟩ hea) hfa) + +private theorem helper_hKcolors_795.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; + let i : Fin ((D.replacementPath d).length + (1 : ℕ)) := R.pathIndex; + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gammaJ (↑d : Fin k); + let S : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑r : ℕ) ∧ p.getVert (↑r : ℕ) = q}; + let K : Set (V ⊕ E) := TwoColorComponent G phi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + (↑R.edgeIndex : ℕ) = (↑R.pathIndex : ℕ) + (1 : ℕ) ∧ (↑R.outsideIndex : ℕ) = (↑R.pathIndex + : ℕ) + (2 : ℕ) → p.getVert (↑i : ℕ) = Sum.inl R.v1 → ( + ∀ (n : ℕ), (↑i : ℕ) ≤ n → n < p.length → H1.Adj (p.getVert n) (p.getVert (n + (1 : ℕ)))) → S = + K → + ∀ (f : E), Sum.inr f ∈ K → phi1 f = some gammaJ ∨ phi1 f = some (↑d : Fin k) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma gammaJ phi1 p i H1 S K hsucc hv1At tail_step_new + hRK f hfK + have hfR : Sum.inr f ∈ S := by rw [hRK]; exact hfK + obtain ⟨r, hir, hget⟩ := hfR + have hstrict : i.val < r.val := by + by_contra hn + have hre : r.val = i.val := by omega + have : Sum.inr f = Sum.inl (R.v1) := by + rw [← hget, hre, hv1At] + simp at this + have hadj := tail_step_new (r.val - 1) (by omega) (by omega) + have hidx : r.val - 1 + 1 = r.val := by omega + rw [hidx, hget] at hadj + cases hprev : p.getVert (r.val - 1) with + | inr e => + rw [hprev] at hadj + simp [H1, TwoColorIncidenceGraph] at hadj + | inl w => + rw [hprev] at hadj + simpa [H1, TwoColorIncidenceGraph] using hadj.2 + +private theorem helper_outside_edge_effect_777.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let v0 : V := D.v0 d; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + ColoredVertexSetClosed G phi X → v0 ∈ X → gamma ≠ (↑d : Fin k) → gammaJ ≠ (↑d : Fin k) → ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → ( + ∀ {e : E} {w : V}, TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X) → + ∀ {w : V} {e : E}, w ∉ X → Incident G w e → phi e = some gamma ∨ phi e = some (↑d : Fin k) → + phi1 e = some gammaJ ∨ phi1 e = some (↑d : Fin k) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X v0 gamma gammaJ phi1 hclosed hv0X hgammaDelta + hgammaJDelta hfixed boundary_of_tree_incident_outside w e hwout hinc hold + by_cases hti : TreeIncidentEdge T e + · have hb := boundary_of_tree_incident_outside hti hwout hinc + have hnotAlpha : phi e ≠ some gamma := by + intro ha + exact (hclosed hb hv0X ha) + (by simpa [v0, gamma] using D.gamma_missing_at_v0 d) + have hd : phi e = some d.1 := hold.resolve_left hnotAlpha + exact Or.inr ((hfixed e hti).trans hd) + · rcases hold with ha | hd + · left + simp [phi1, OutsideTreeColorSwap, hti, ha] + · right + simp [phi1, OutsideTreeColorSwap, hti, hd, hgammaDelta.symm, hgammaJDelta.symm] + +private theorem helper_hcomponentTail_806.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; + let i : Fin ((D.replacementPath d).length + (1 : ℕ)) := R.pathIndex; + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gammaJ (↑d : Fin k); + let S : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑r : ℕ) ∧ p.getVert (↑r : ℕ) = q}; + let K : Set (V ⊕ E) := TwoColorComponent G phi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); p.getVert + (↑i : ℕ) = Sum.inl R.v1 → ( + ∀ {q r : V ⊕ E}, q ∈ S → H1.Adj q r → r ∈ S) → K ⊆ S := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma gammaJ phi1 p i H1 S K hv1At S_closed q hq + change H1.connectedComponentMk q = + H1.connectedComponentMk (Sum.inl (R.v1)) at hq + have hreach := SimpleGraph.ConnectedComponent.exact hq + obtain ⟨walk⟩ := hreach + have propagate : ∀ {a b : Sum V E}, H1.Walk a b → a ∈ S → b ∈ S := by + intro a b walk ha + induction walk with + | nil => exact ha + | @cons a c b hac rest ih => exact ih (S_closed ha hac) + have hv1R : Sum.inl R.v1 ∈ S := by + exact ⟨i, le_rfl, hv1At⟩ + exact propagate walk.reverse hv1R + +private theorem helper_htailComponent_820.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; + let i : Fin ((D.replacementPath d).length + (1 : ℕ)) := R.pathIndex; + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gammaJ (↑d : Fin k); + let S : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑r : ℕ) ∧ p.getVert (↑r : ℕ) = q}; + let K : Set (V ⊕ E) := TwoColorComponent G phi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + (↑R.edgeIndex : ℕ) = (↑R.pathIndex : ℕ) + (1 : ℕ) ∧ (↑R.outsideIndex : ℕ) = (↑R.pathIndex + : ℕ) + (2 : ℕ) → p.getVert (↑i : ℕ) = Sum.inl R.v1 → ( + ∀ (n : ℕ), (↑i : ℕ) ≤ n → n < p.length → H1.Adj (p.getVert n) (p.getVert (n + (1 : ℕ)))) → S ⊆ + K := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma gammaJ phi1 p i H1 S K hsucc hv1At tail_step_new q hq + obtain ⟨r, hir, hget⟩ := hq + have go : ∀ t : ℕ, i.val + t ≤ p.length → + H1.connectedComponentMk (p.getVert (i.val + t)) = + H1.connectedComponentMk (Sum.inl (R.v1)) := by + intro t ht + induction t with + | zero => simpa using congrArg H1.connectedComponentMk hv1At + | succ t ih => + have hprev : i.val + t ≤ p.length := by omega + have hadj := tail_step_new (i.val + t) (by omega) (by omega) + have hcc := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + exact hcc.symm.trans (ih hprev) + change H1.connectedComponentMk q = H1.connectedComponentMk (Sum.inl (R.v1)) + rw [← hget] + have heq : i.val + (r.val - i.val) = r.val := by omega + rw [← heq] + have hrle : r.val ≤ p.length := Nat.le_of_lt_succ r.isLt + exact go (r.val - i.val) (by omega) + +private theorem helper_hone2_869.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let psi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gammaJ (↑d : Fin k) + (Sum.inl R.v1); IsOneEdgeUncolored phi1 e0 → IsOneEdgeUncolored psi2 e0 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma gammaJ phi1 K psi2 hone1 + constructor + · simp [psi2, TwoColorComponentSwap, hone1.1] + · intro f hfe + obtain ⟨c, hc⟩ := hone1.2 f hfe + by_cases hfK : Sum.inr f ∈ K + · by_cases hcg : phi1 f = some gammaJ + · exact ⟨d.1, by simp [psi2, TwoColorComponentSwap, K, hfK, hcg]⟩ + · by_cases hcd : phi1 f = some d.1 + · exact ⟨gammaJ, by simp [psi2, TwoColorComponentSwap, K, hfK, + hcd]⟩ + · exact ⟨c, by simpa [psi2, TwoColorComponentSwap, K, hfK, + hcg, hcd] using hc⟩ + · exact ⟨c, by simpa [psi2, TwoColorComponentSwap, K, hfK] using hc⟩ + +private theorem helper_continuation_977.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let v0 : V := D.v0 d; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let gammaJ : Fin k := C.gamma R.blockIndex; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let p : (TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k)).Walk (Sum.inl + (D.v0 d)) (Sum.inl (D.replacementZ d)) := D.replacementPath d; + let i : Fin ((D.replacementPath d).length + (1 : ℕ)) := R.pathIndex; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gammaJ (↑d : Fin k); + let S : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑r : ℕ) ∧ p.getVert (↑r : ℕ) = q}; + let K : Set (V ⊕ E) := TwoColorComponent G phi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let psi2 : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gammaJ (↑d : Fin k) + (Sum.inl R.v1); v0 ∈ X → IsProperEdgeColoring G phi1 → IsOneEdgeUncolored phi1 e0 → + StableColoring T ∅ phi phi1 → ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → S = K → Sum.inr R.f1 ∈ K → ( + ∀ v ∈ X, Sum.inl v ∈ K ↔ v = R.v1) → ( + ∀ (q : Fin T.length), Sum.inr (T.edge q) ∉ K) → phi1 R.f1 = some (↑d : Fin k) → + IsProperEdgeColoring G psi2 → IsOneEdgeUncolored psi2 e0 → (↑d : Fin k) ∈ MissingColors G + psi2 R.v1 → ( + ∀ v ∈ X, v ≠ R.v1 → MissingColors G psi2 v = MissingColors G phi v) → IsProperEdgeColoring G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) ∧ + IsOneEdgeUncolored (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) e0 ∧ StableColoring T ∅ phi (OutsideTreeColorSwap T phi (C.gamma + (D.gammaIndex d)) (C.gamma R.blockIndex)) ∧ ( + ∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) + (C.gamma R.blockIndex) f = phi f) ∧ {q : V ⊕ E | + ∃ (r : Fin ((D.replacementPath d).length + (1 : ℕ))), (↑R.pathIndex : ℕ) ≤ (↑r : ℕ) ∧ + (D.replacementPath d).getVert (↑r : ℕ) = q} = TwoColorComponent G (OutsideTreeColorSwap T + phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) + (Sum.inl R.v1) ∧ Sum.inr R.f1 ∈ TwoColorComponent G (OutsideTreeColorSwap T phi (C.gamma + (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl + R.v1) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G (OutsideTreeColorSwap T phi + (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) + (Sum.inl R.v1) ↔ v = R.v1) ∧ ( + ∀ (q : Fin T.length), Sum.inr (T.edge q) ∉ TwoColorComponent G (OutsideTreeColorSwap T phi + (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) + (Sum.inl R.v1)) ∧ OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex) R.f1 = some (↑d : Fin k) ∧ IsProperEdgeColoring G (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) e0 ∧ (↑d : Fin k) ∈ MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) R.v1 ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, v ≠ R.v1 → MissingColors G (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) v = MissingColors G phi v) ∧ + TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) (D.f0 d) = some (↑d : + Fin k) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X v0 gamma gammaJ phi1 p i H1 S K psi2 hv0X hproper1 + hone1 hstable1 hfixed hRK hf1K hKtree htreeEdges hf1color hproper2 hone2 hdeltaMissing2 + hotherMissing + have hf0color1 : phi1 (D.f0 d) = some d.1 := by + apply (hfixed (D.f0 d) ?_).trans (D.f0_color d) + exact ⟨v0, by simpa [X] using hv0X, by simp [v0, Incident, D.f0_ends d]⟩ + have hf0NotK : Sum.inr (D.f0 d) ∉ K := by + intro hf0K + have hv0Adj : H1.Adj (Sum.inl v0) (Sum.inr (D.f0 d)) := by + simp [H1, TwoColorIncidenceGraph, v0, Incident, D.f0_ends d, hf0color1] + have hv0K : Sum.inl v0 ∈ K := by + change H1.connectedComponentMk (Sum.inl v0) = + H1.connectedComponentMk (Sum.inl R.v1) + change H1.connectedComponentMk (Sum.inr (D.f0 d)) = + H1.connectedComponentMk (Sum.inl R.v1) at hf0K + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hv0Adj).trans hf0K + exact R.v1_ne_v0 ((hKtree v0 hv0X).mp hv0K).symm + have hf0color2 : psi2 (D.f0 d) = some d.1 := by + simp [psi2, TwoColorComponentSwap, K, hf0NotK, hf0color1] + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · simpa [phi1, gamma, gammaJ] using hproper1 + · simpa [phi1, gamma, gammaJ] using hone1 + · simpa [phi1, gamma, gammaJ] using hstable1 + · intro f hf + simpa [phi1, gamma, gammaJ] using hfixed f hf + · simpa [S, K, p, i, phi1, gamma, gammaJ] using hRK + · simpa [K, phi1, gamma, gammaJ] using hf1K + · intro v hv + simpa [K, X, phi1, gamma, gammaJ] using hKtree v (by simpa [X] using hv) + · intro q + simpa [K, phi1, gamma, gammaJ] using htreeEdges q + · simpa [phi1, gamma, gammaJ] using hf1color + · simpa [psi2, phi1, gamma, gammaJ] using hproper2 + · simpa [psi2, phi1, gamma, gammaJ] using hone2 + · simpa [psi2, phi1, gamma, gammaJ] using hdeltaMissing2 + · intro v hv hvne + simpa [psi2, phi1, gamma, gammaJ] using + hotherMissing v (by simpa [X] using hv) hvne + · simpa [psi2, phi1, gamma, gammaJ] using hf0color2 + +private theorem helper_continuation_880.{u_1, u_2} : + helperContinuation880Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X v0 gamma gammaJ phi1 p i H0 H1 S K psi2 hproper + hclosed hv0X hv1X hpathIs hsupport hgammaDelta hgammaJDelta hgammaGammaJ hproper1 hone1 + hstable1 hfixed hsucc hiOneLt hv1At hf1At boundary_of_tree_incident_outside + have missing_no_incident : ∀ {c : Fin k} {v : V} {e : E}, + c ∈ MissingColors G phi v → Incident G v e → phi e ≠ some c := by + intro c v e hm hinc hc + have hp : c ∈ PresentColors G phi v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hinc, hc⟩ + have hnot : c ∉ PresentColors G phi v := by + simpa [MissingColors] using hm + exact hnot hp + have tail_vertex : ∀ {r : Fin (p.length + 1)} {w : V}, i.val ≤ r.val → + p.getVert r.val = Sum.inl w → + (r.val = i.val ∧ w = R.v1) ∨ (i.val < r.val ∧ w ∉ X) := by + intro r w hir hget + by_cases hri : r.val = i.val + · left + refine ⟨hri, ?_⟩ + apply Sum.inl.inj + rw [← hget, hri, hv1At] + · right + have hlt : i.val < r.val := by omega + refine ⟨hlt, ?_⟩ + simpa [X, p, i] using R.after_last_tree_vertex r hlt w (by simpa [p] using hget) + have hy0Degree := @helper_hy0Degree_676 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hproper) (@missing_no_incident) + have adjacent_indices_forward := @helper_adjacent_indices_forward_225 (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) + (@hproper) (@hpathIs) (@hy0Degree) + have old_adjacent_indices : ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → + H0.Adj (p.getVert n) (p.getVert m) → n + 1 = m ∨ m + 1 = n := by + intro n m hn hm hadj + have hne : n ≠ m := by + intro h + subst m + exact H0.loopless.irrefl _ hadj + rcases lt_or_gt_of_ne hne with hnm | hmn + · exact Or.inl (adjacent_indices_forward n m hn hm hnm hadj).symm + · exact Or.inr (adjacent_indices_forward m n hm hn hmn hadj.symm).symm + have outside_edge_effect := @helper_outside_edge_effect_777 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hclosed) (@hv0X) + (@hgammaDelta) (@hgammaJDelta) (@hfixed) (@boundary_of_tree_incident_outside) + have tail_step_new := @helper_tail_step_new_323 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hv1X) (@hfixed) + (@hsucc) (@hf1At) (@tail_vertex) (@outside_edge_effect) + have new_edge_old := @helper_new_edge_old_374 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hclosed) (@hv1X) + (@hgammaDelta) (@hgammaJDelta) (@hgammaGammaJ) (@hfixed) (@boundary_of_tree_incident_outside) + (@missing_no_incident) (@tail_vertex) + have new_adj_old := @helper_new_adj_old_414 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@new_edge_old) + have S_closed := @helper_S_closed_452 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hproper) (@hv1X) (@hpathIs) + (@hsupport) (@hfixed) (@hsucc) (@hiOneLt) (@hv1At) (@hf1At) (@missing_no_incident) + (@old_adjacent_indices) (@new_adj_old) + have hcomponentTail := @helper_hcomponentTail_806 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hv1At) + (@S_closed) + have htailComponent := @helper_htailComponent_820 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hsucc) (@hv1At) + (@tail_step_new) + have hRK : S = K := Set.Subset.antisymm htailComponent hcomponentTail + have hf1K : Sum.inr (R.f1) ∈ K := by + rw [← hRK] + exact ⟨R.edgeIndex, by simp [i, hsucc.1], by simpa [p] using R.f1_at_index⟩ + have hKtree : ∀ v : V, v ∈ X → + (Sum.inl v ∈ K ↔ v = R.v1) := by + intro v hv + constructor + · intro hvK + have hvR : Sum.inl v ∈ S := by rw [hRK]; exact hvK + obtain ⟨r, hir, hget⟩ := hvR + rcases tail_vertex hir hget with hbase | hout + · exact hbase.2 + · exact False.elim (hout.2 hv) + · rintro rfl + rw [← hRK] + exact ⟨i, le_rfl, hv1At⟩ + have htreeEdges := @helper_htreeEdges_565 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hKtree) + have hKcolors := @helper_hKcolors_795 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hsucc) (@hv1At) + (@tail_step_new) (@hRK) + have hf1color : phi1 R.f1 = some d.1 := by + apply (hfixed R.f1 ?_).trans R.f1_color + exact ⟨R.v1, by simpa [X] using hv1X, by simp [Incident, R.f1_ends]⟩ + have hproper2 : IsProperEdgeColoring G psi2 := by + simpa [psi2] using TwoColorComponentSwapProper G phi1 gammaJ d.1 + hgammaJDelta hproper1 (Sum.inl R.v1) + have hone2 := @helper_hone2_869 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hone1) + have hbehavior := TwoColorComponentSwapMissingBehavior G phi1 gammaJ d.1 + hgammaJDelta hproper1 (Sum.inl R.v1) + have hv1K : Sum.inl R.v1 ∈ K := by rfl + have hgammaJMissing1 : gammaJ ∈ MissingColors G phi1 R.v1 := by + rw [hstable1.2 R.v1 (by simpa [X] using hv1X)] + simpa [gammaJ] using R.gammaJ_missing + have hdeltaMissing2 : d.1 ∈ MissingColors G psi2 R.v1 := by + simpa [psi2, K] using hbehavior.2.1 R.v1 hv1K hgammaJMissing1 + have hotherMissing : ∀ v ∈ X, v ≠ R.v1 → + MissingColors G psi2 v = MissingColors G phi v := by + intro v hv hvne + have hvNotK : Sum.inl v ∉ K := by + intro hvK + exact hvne ((hKtree v hv).mp hvK) + calc + MissingColors G psi2 v = MissingColors G phi1 v := by + simpa [psi2, K] using hbehavior.1 v hvNotK + _ = MissingColors G phi v := hstable1.2 v (by simpa [X] using hv) + exact @helper_continuation_977 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hv0X) (@hproper1) (@hone1) + (@hstable1) (@hfixed) (@hRK) (@hf1K) (@hKtree) (@htreeEdges) (@hf1color) (@hproper2) + (@hone2) (@hdeltaMissing2) (@hotherMissing) +theorem ScheideDefectiveSecondTerminalComponent {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideDefectiveReturnData G k e0 phi T C D d) : + let gamma := C.gamma (D.gammaIndex d) + let gammaJ := C.gamma R.blockIndex + let psi1 := OutsideTreeColorSwap T phi gamma gammaJ + let K := TwoColorComponent G psi1 gammaJ d.1 (Sum.inl R.v1) + let psi2 := TwoColorComponentSwap G psi1 gammaJ d.1 (Sum.inl R.v1) + IsProperEdgeColoring G psi1 ∧ + IsOneEdgeUncolored psi1 e0 ∧ + StableColoring T ∅ phi psi1 ∧ + (∀ f : E, TreeIncidentEdge T f → psi1 f = phi f) ∧ + {q | + ∃ r : Fin ((D.replacementPath d).length + 1), + R.pathIndex.val ≤ r.val ∧ (D.replacementPath d).getVert r.val = q} = + K ∧ + Sum.inr R.f1 ∈ K ∧ + (∀ v : V, v ∈ TreeSequenceVertexSet T → (Sum.inl v ∈ K ↔ v = R.v1)) ∧ + (∀ q : Fin T.length, Sum.inr (T.edge q) ∉ K) ∧ + psi1 R.f1 = some d.1 ∧ + IsProperEdgeColoring G psi2 ∧ + IsOneEdgeUncolored psi2 e0 ∧ + d.1 ∈ MissingColors G psi2 R.v1 ∧ + (∀ v ∈ TreeSequenceVertexSet T, + v ≠ R.v1 → MissingColors G psi2 v = MissingColors G phi v) ∧ + psi2 (D.f0 d) = some d.1 := by + classical + dsimp only + let X := TreeSequenceVertexSet T + let v0 := D.v0 d + let gamma := C.gamma (D.gammaIndex d) + let gammaJ := C.gamma R.blockIndex + let phi1 := OutsideTreeColorSwap T phi gamma gammaJ + let p := D.replacementPath d + let i := R.pathIndex + let H0 := TwoColorIncidenceGraph G phi gamma d.1 + let H1 := TwoColorIncidenceGraph G phi1 gammaJ d.1 + let S : Set (Sum V E) := {q | ∃ r : Fin (p.length + 1), + i.val ≤ r.val ∧ p.getVert r.val = q} + let K := TwoColorComponent G phi1 gammaJ d.1 (Sum.inl R.v1) + let psi2 := TwoColorComponentSwap G phi1 gammaJ d.1 (Sum.inl R.v1) + have hproper : IsProperEdgeColoring G phi := C.globally_maximum.1.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := C.globally_maximum.1.2.2.2.2 + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hclosed0 : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + horder.2.2.2.2 + have hclosed : ColoredVertexSetClosed G phi X := by + exact hclosed0 + have hv0X : v0 ∈ X := by + simpa [v0, X] using (D.replacement_path_full d).1 + have hv1X : R.v1 ∈ X := by + simpa [X] using R.v1_mem + have hpath : ScheideDefectiveChainPath T phi gamma d.1 + v0 (D.replacementZ d) p := by + simpa [v0, p] using D.replacement_path_full d + have hpathIs : p.IsPath := hpath.2.1 + have hsupport : {q | q ∈ p.support} = + TwoColorComponent G phi gamma d.1 (Sum.inl v0) := hpath.2.2.2 + have hdefective : DefectiveColor G phi X d.1 := by + have hd := d.2 + change d.1 ∈ (Finset.univ.filter fun delta => + DefectiveColor G phi X delta) at hd + exact (Finset.mem_filter.mp hd).2 + have hdeltaPresent : ∀ v, v ∈ X → d.1 ∈ PresentColors G phi v := by + intro v hv + have hcard : 0 < (BoundaryColorEdges G phi X d.1).card := by + change 2 ≤ (BoundaryColorEdges G phi X d.1).card at hdefective + omega + obtain ⟨b, hb⟩ := Finset.card_pos.mp hcard + have hnot : d.1 ∉ MissingColors G phi v := by + intro hm + exact hclosed (Finset.mem_filter.mp hb).1 hv + (Finset.mem_filter.mp hb).2 hm + simpa [MissingColors] using hnot + have hgammaDelta : gamma ≠ d.1 := by + simpa [gamma] using R.gamma_ne_delta + have hgammaJDelta : gammaJ ≠ d.1 := by + simpa [gammaJ] using R.gammaJ_ne_delta + have hgammaGammaJ : gamma ≠ gammaJ := by + simpa [gammaJ] using R.gamma_ne_gammaJ + have hgammaTree : gamma ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v0, by simpa [X] using hv0X, by simpa [v0, gamma] using D.gamma_missing_at_v0 d⟩ + have hgammaJTree : gammaJ ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨R.v1, by simpa [X] using hv1X, + by simpa [gammaJ] using R.gammaJ_missing⟩ + have hswap := OutsideTreeColorSwapStable T ∅ phi gamma gammaJ + hproper hone hclosed0 hgammaTree hgammaJTree hgammaGammaJ + have hproper1 : IsProperEdgeColoring G phi1 := by + simpa [phi1] using hswap.1 + have hone1 : IsOneEdgeUncolored phi1 e0 := by + simpa [phi1] using hswap.2.1 + have hstable1 : StableColoring T ∅ phi phi1 := by + simpa [phi1] using hswap.2.2.1 + have hfixed : ∀ f, TreeIncidentEdge T f → phi1 f = phi f := by + intro f hf + simpa [phi1] using hswap.2.2.2 f hf + have hsucc := R.successive_indices + have hiTwo : i.val + 2 < p.length + 1 := by + dsimp [i, p] + rw [← hsucc.2] + exact (R.outsideIndex).isLt + have hiOneLt : i.val + 1 < p.length := by omega + have hv1At : p.getVert i.val = Sum.inl (R.v1) := by + simpa [p, i] using R.v1_at_index + have hf1At : p.getVert (i.val + 1) = Sum.inr (R.f1) := by + rw [← hsucc.1] + simpa [p] using R.f1_at_index + have ends_eq_of_mem : ∀ {q : Sym2 V} {x y : V}, x ∈ q → y ∈ q → x ≠ y → + q = s(x, y) := by + intro q x y hx hy hxy + induction q using Sym2.inductionOn with + | _ a b => + simp only [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> + simp_all [] + have boundary_of_tree_incident_outside : ∀ {e : E} {w : V}, + TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X := by + intro e w he hwout hwe + obtain ⟨x, hx, hxe⟩ := he + have hxX : x ∈ X := by simpa [X] using hx + have hxw : x ≠ w := by + intro h + exact hwout (h ▸ hxX) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxX, w, hwout, ends_eq_of_mem hxe hwe hxw⟩ + exact @helper_continuation_880 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hproper) (@hclosed) (@hv0X) + (@hv1X) (@hpathIs) (@hsupport) (@hgammaDelta) (@hgammaJDelta) (@hgammaGammaJ) (@hproper1) + (@hone1) (@hstable1) (@hfixed) (@hsucc) (@hiOneLt) (@hv1At) (@hf1At) + (@boundary_of_tree_incident_outside) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveSetup.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveSetup.lean new file mode 100644 index 0000000000..953361c1e3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveSetup.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.TreeMissingColors + +/-! +# Scheide Defective Setup + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- +Initial and replacement defective-color paths with their last tree vertices and boundary edges. -/ +structure ScheideDefectiveSetup {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) where + /-- A color missing at the initial base vertex and distinct from every block color. -/ + alpha0 : Fin k + alpha0_missing_at_y0 : + alpha0 ∈ MissingColors G phi (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩) + alpha0_not_block : ∀ i : Fin C.s, alpha0 ≠ C.gamma i + /-- The last inside vertex on the initial path for each defective color. -/ + v0 : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) } → V + /-- The boundary edge following that last inside vertex. -/ + f0 : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) } → E + /-- The outside endpoint immediately following the chosen boundary edge. -/ + u0 : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) } → V + /-- The block index supplying the missing color for each defective-color path. -/ + gammaIndex : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) } → Fin C.s + /-- The outside endpoint of the initial defective-color path. -/ + initialZ : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) } → V + /-- The initial spanning path for each defective-color component. -/ + initialPath : + ∀ d, + (TwoColorIncidenceGraph G phi alpha0 d.1).Walk + (Sum.inl (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩)) (Sum.inl (initialZ d)) + initial_path_full : + ∀ d, + ScheideDefectiveChainPath T phi alpha0 d.1 + (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩) (initialZ d) (initialPath d) + /-- The position of the last inside vertex on each initial path. -/ + v0Index : ∀ d, Fin ((initialPath d).length + 1) + /-- The position of the following boundary edge on each initial path. -/ + f0Index : ∀ d, Fin ((initialPath d).length + 1) + /-- The position of the following outside endpoint on each initial path. -/ + u0Index : ∀ d, Fin ((initialPath d).length + 1) + v0_at_index : ∀ d, (initialPath d).getVert (v0Index d).val = Sum.inl (v0 d) + f0_at_index : ∀ d, (initialPath d).getVert (f0Index d).val = Sum.inr (f0 d) + u0_at_index : ∀ d, (initialPath d).getVert (u0Index d).val = Sum.inl (u0 d) + successive_indices : + ∀ d, (f0Index d).val = (v0Index d).val + 1 ∧ (u0Index d).val = (v0Index d).val + 2 + v0_is_last_tree_vertex : + ∀ d, + ∀ r : Fin ((initialPath d).length + 1), + (v0Index d).val < r.val → + ∀ w : V, (initialPath d).getVert r.val = Sum.inl w → w ∉ TreeSequenceVertexSet T + v0_is_exit : ∀ d, v0 d ∈ ScheideExitVertices T phi + gamma_missing_at_v0 : ∀ d, C.gamma (gammaIndex d) ∈ MissingColors G phi (v0 d) + f0_color : ∀ d, phi (f0 d) = some d.1 + f0_ends : ∀ d, G.ends (f0 d) = s(v0 d, u0 d) + u0_outside : ∀ d, u0 d ∉ TreeSequenceVertexSet T + v0_on_initial_component : + ∀ d, Sum.inl (v0 d) ∈ TwoColorComponent G phi alpha0 d.1 (Sum.inl (C.y ⟨0, lt_of_lt_of_le + Nat.zero_lt_two C.p_ge_two⟩)) + f0_on_initial_component : + ∀ d, Sum.inr (f0 d) ∈ TwoColorComponent G phi alpha0 d.1 (Sum.inl (C.y ⟨0, lt_of_lt_of_le + Nat.zero_lt_two C.p_ge_two⟩)) + /-- The outside endpoint of the replacement defective-color path. -/ + replacementZ : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) } → V + /-- The replacement spanning path for each defective-color component. -/ + replacementPath : + ∀ d, + (TwoColorIncidenceGraph G phi (C.gamma (gammaIndex d)) d.1).Walk (Sum.inl (v0 d)) + (Sum.inl (replacementZ d)) + replacement_path_full : + ∀ d, + ScheideDefectiveChainPath T phi (C.gamma (gammaIndex d)) d.1 (v0 d) (replacementZ d) + (replacementPath d) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveSetupExists.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveSetupExists.lean new file mode 100644 index 0000000000..53ce77941b --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveSetupExists.lean @@ -0,0 +1,668 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DefectiveColorComponentPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup + +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts + +/-! +# Scheide Defective Setup Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_extractPath_136.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E + k) (T : TreeSequence G e0) (_ : ScheideReducedConfiguration G k e0 phi T), DefectiveColors + G phi (TreeSequenceVertexSet T) ≠ ∅ → let X : Finset V := TreeSequenceVertexSet T; ∀ {a b + : Fin k} {u z : V} {p : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl u) (Sum.inl z)}, + ScheideDefectiveChainPath T phi a b u z p → ∃ (v : V) (f : E) (w : V) (i : Fin (p.length + + (1 : ℕ))) (j : Fin (p.length + (1 : ℕ))) (l : Fin (p.length + (1 : ℕ))), p.getVert (↑i : + ℕ) = Sum.inl v ∧ v ∈ X ∧ p.getVert (↑j : ℕ) = Sum.inr f ∧ p.getVert (↑l : ℕ) = Sum.inl w ∧ + (↑j : ℕ) = (↑i : ℕ) + (1 : ℕ) ∧ (↑l : ℕ) = (↑i : ℕ) + (2 : ℕ) ∧ (∀ (r : Fin (p.length + (1 + : ℕ))), (↑i : ℕ) < (↑r : ℕ) → ∀ (x : V), p.getVert (↑r : ℕ) = Sum.inl x → x ∉ X) ∧ w ∉ X := by + classical + intro V E _ _ _ G k e0 phi T C _ X a b u z p hp + let indices : Finset (Fin (p.length + 1)) := + Finset.univ.filter (fun r => ∃ x : V, p.getVert r.val = Sum.inl x ∧ x ∈ X) + have hindices : indices.Nonempty := by + refine ⟨⟨0, Nat.zero_lt_succ _⟩, ?_⟩ + simp only [indices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, p.getVert_zero, hp.1⟩ + let i : Fin (p.length + 1) := indices.max' hindices + have hi : i ∈ indices := Finset.max'_mem indices hindices + obtain ⟨v, hiv, hvX⟩ := (Finset.mem_filter.mp hi).2 + have hilength : i.val < p.length := by + by_contra hn + have heq : i.val = p.length := by omega + have hend : p.getVert i.val = Sum.inl z := by + rw [heq, p.getVert_length] + have hzv : v = z := Sum.inl.inj (hiv.symm.trans hend) + exact hp.2.2.1 (hzv ▸ hvX) + have hi1 : i.val + 1 < p.length + 1 := by omega + have hside1 : ∃ f : E, p.getVert (i.val + 1) = Sum.inr f := by + cases hnode : p.getVert (i.val + 1) with + | inl x => + have hadj := p.adj_getVert_succ hilength + rw [hiv, hnode] at hadj + simp [TwoColorIncidenceGraph] at hadj + | inr f => exact ⟨f, rfl⟩ + obtain ⟨f, hf⟩ := hside1 + have hnotend : i.val + 1 ≠ p.length := by + intro he + have hend := p.getVert_length + rw [he] at hf + exact Sum.inr_ne_inl (hf.symm.trans hend) + have hi2 : i.val + 1 < p.length := by omega + have hside2 : ∃ w : V, p.getVert (i.val + 2) = Sum.inl w := by + cases hnode : p.getVert (i.val + 2) with + | inr e => + have hadj := p.adj_getVert_succ hi2 + rw [hf, hnode] at hadj + simp [TwoColorIncidenceGraph] at hadj + | inl w => exact ⟨w, rfl⟩ + obtain ⟨w, hw⟩ := hside2 + have hmax : ∀ r : Fin (p.length + 1), i.val < r.val → + ∀ x : V, p.getVert r.val = Sum.inl x → x ∉ X := by + intro r hir x hxr hx + have hr : r ∈ indices := by + simp only [indices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxr, hx⟩ + have hle := Finset.le_max' indices r hr + have hleval : r.val ≤ i.val := Fin.le_iff_val_le_val.mp hle + omega + have hwX : w ∉ X := by + intro hwX + have hr : (⟨i.val + 2, by omega⟩ : Fin (p.length + 1)) ∈ indices := by + simp only [indices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hw, hwX⟩ + have hle := Finset.le_max' indices _ hr + change i.val + 2 ≤ i.val at hle + have hleval : i.val + 2 ≤ i.val := hle + omega + exact ⟨v, f, w, i, ⟨i.val + 1, hi1⟩, ⟨i.val + 2, by omega⟩, + hiv, hvX, hf, hw, by rfl, by rfl, hmax, hwX⟩ + +private theorem helper_initialData_208.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T), DefectiveColors G phi + (TreeSequenceVertexSet T) ≠ ∅ → ( + ∀ (alpha gamma : Fin k), alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T) → + ∀ u ∈ TreeSequenceVertexSet T, gamma ∈ MissingColors G phi u → + ∃ (z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p) → + let X : Finset V := TreeSequenceVertexSet T; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); y0 ∈ X → + ∀ alpha0 ∈ MissingColors G phi y0, ( + ∀ {a b : Fin k} {u z : V} + {p : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl u) (Sum.inl z)}, + ScheideDefectiveChainPath T phi a b u z p → + ∃ (v : V) (f : E) (w : V) (i : Fin (p.length + (1 : ℕ))) (j : Fin (p.length + (1 : ℕ))) (l : + Fin (p.length + (1 : ℕ))), p.getVert (↑i : ℕ) = Sum.inl v ∧ v ∈ X ∧ p.getVert (↑j : ℕ) = + Sum.inr f ∧ p.getVert (↑l : ℕ) = Sum.inl w ∧ (↑j : ℕ) = (↑i : ℕ) + (1 : ℕ) ∧ (↑l : ℕ) = + (↑i : ℕ) + (2 : ℕ) ∧ ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) < (↑r : ℕ) → + ∀ (x : V), p.getVert (↑r : ℕ) = Sum.inl x → x ∉ X) ∧ w ∉ X) → + ∀ (d : ↥(DefectiveColors G phi X)), + ∃ (v : V) (f : E) (u : V) (z : V) (p : (TwoColorIncidenceGraph G phi alpha0 (↑d : Fin k)).Walk + (Sum.inl y0) (Sum.inl z)) (i : Fin (p.length + (1 : ℕ))) (j : Fin (p.length + (1 : ℕ))) (l + : Fin (p.length + (1 : ℕ))), p.IsPath ∧ {x : V ⊕ E | x ∈ p.support} = TwoColorComponent G + phi alpha0 (↑d : Fin k) (Sum.inl y0) ∧ ScheideDefectiveChainPath T phi alpha0 (↑d : Fin k) + y0 z p ∧ p.getVert (↑i : ℕ) = Sum.inl v ∧ p.getVert (↑j : ℕ) = Sum.inr f ∧ p.getVert (↑l : + ℕ) = Sum.inl u ∧ (↑j : ℕ) = (↑i : ℕ) + (1 : ℕ) ∧ (↑l : ℕ) = (↑i : ℕ) + (2 : ℕ) ∧ ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ X) ∧ u ∉ X ∧ v ∈ ScheideExitVertices T phi := by + classical + intro V E _ _ _ G k e0 phi T C _ pathLemma X y0 hy0 alpha0 halpha0 extractPath d + obtain ⟨z, p, hp⟩ := pathLemma d.1 alpha0 d.2 y0 hy0 halpha0 + have hp' : ScheideDefectiveChainPath T phi d.1 alpha0 y0 z p := hp + let graphSwap : TwoColorIncidenceGraph G phi d.1 alpha0 = + TwoColorIncidenceGraph G phi alpha0 d.1 := by + ext x y + simp [TwoColorIncidenceGraph, or_comm] + let graphHom : TwoColorIncidenceGraph G phi d.1 alpha0 →g + TwoColorIncidenceGraph G phi alpha0 d.1 := + ⟨id, by intro x y h; simpa [TwoColorIncidenceGraph, or_comm] using h⟩ + let pnew := p.map graphHom + have componentSwap : TwoColorComponent G phi d.1 alpha0 (Sum.inl y0) = + TwoColorComponent G phi alpha0 d.1 (Sum.inl y0) := by + change ((TwoColorIncidenceGraph G phi d.1 alpha0).connectedComponentMk + (Sum.inl y0) : Set (Sum V E)) = + ((TwoColorIncidenceGraph G phi alpha0 d.1).connectedComponentMk + (Sum.inl y0) : Set (Sum V E)) + ext x + change x ∈ ((TwoColorIncidenceGraph G phi d.1 alpha0).connectedComponentMk + (Sum.inl y0)).supp ↔ + x ∈ ((TwoColorIncidenceGraph G phi alpha0 d.1).connectedComponentMk + (Sum.inl y0)).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff, + SimpleGraph.ConnectedComponent.mem_supp_iff, + SimpleGraph.ConnectedComponent.eq, + SimpleGraph.ConnectedComponent.eq] + constructor + · intro h + simpa [graphHom] using h.map graphHom + · intro h + let reverseHom : TwoColorIncidenceGraph G phi alpha0 d.1 →g + TwoColorIncidenceGraph G phi d.1 alpha0 := + ⟨id, by intro x y h; simpa [TwoColorIncidenceGraph, or_comm] using h⟩ + simpa [reverseHom] using h.map reverseHom + have hpnew : ScheideDefectiveChainPath T phi alpha0 d.1 y0 z pnew := by + change y0 ∈ TreeSequenceVertexSet T ∧ pnew.IsPath ∧ + z ∉ TreeSequenceVertexSet T ∧ + {x | x ∈ pnew.support} = + TwoColorComponent G phi alpha0 d.1 (Sum.inl y0) + refine ⟨hp.1, (pnew.isPath_def).2 ?_, hp.2.2.1, ?_⟩ + · simpa [pnew, graphHom] using (p.isPath_def.mp hp.2.1) + · have hsupp : pnew.support = p.support := by simp [pnew, graphHom] + rw [hsupp, ← componentSwap] + exact hp.2.2.2 + obtain ⟨v, f, u, i, j, l, hiv, hv, hjf, hlu, hij, hil, hlast, hu⟩ := + extractPath hpnew + have hexit : v ∈ ScheideExitVertices T phi := by + simp only [ScheideExitVertices, Finset.mem_filter, Finset.mem_univ, true_and] + have hy0' : y0 ∈ TreeSequenceVertexSet T := by + exact hy0 + let iBack : Fin (p.length + 1) := ⟨i.val, by + simpa [pnew] using i.isLt⟩ + refine ⟨y0, alpha0, d.1, hy0', halpha0, d.2, z, p, hp, iBack, ?_, hv, ?_⟩ + · simpa [iBack, pnew, graphHom] using hiv + · intro r hr w hw + let rnew : Fin (pnew.length + 1) := ⟨r.val, by + simpa [pnew] using r.isLt⟩ + change i.val < r.val at hr + apply hlast rnew (by simpa [rnew] using hr) w + simpa [rnew, pnew, graphHom] using hw + refine ⟨v, f, u, z, pnew, ?_⟩ + exact ⟨i, j, l, hpnew.2.1, hpnew.2.2.2, hpnew, hiv, hjf, hlu, hij, hil, hlast, hu, hexit⟩ + +private theorem helper_replacementData_301.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T), DefectiveColors G phi + (TreeSequenceVertexSet T) ≠ ∅ → ( + ∀ (alpha gamma : Fin k), alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T) → + ∀ u ∈ TreeSequenceVertexSet T, gamma ∈ MissingColors G phi u → + ∃ (z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p) → + let X : Finset V := TreeSequenceVertexSet T; + ∀ (v0 : ↥(DefectiveColors G phi X) → V) (gammaIndex : ↥(DefectiveColors G phi X) → Fin C.s), ( + ∀ (d : ↥(DefectiveColors G phi X)), C.gamma (gammaIndex d) ∈ MissingColors G phi (v0 d)) → ( + ∀ (d : ↥(DefectiveColors G phi X)), v0 d ∈ X) → + ∀ (d : ↥(DefectiveColors G phi X)), + ∃ (z : V) (p : (TwoColorIncidenceGraph G phi (C.gamma (gammaIndex d)) (↑d : Fin k)).Walk + (Sum.inl (v0 d)) (Sum.inl z)), ScheideDefectiveChainPath T phi (C.gamma (gammaIndex d)) + (↑d : Fin k) (v0 d) z p := by + classical + intro V E _ _ _ G k e0 phi T C _ pathLemma X v0 gammaIndex gamma_missing v0mem d + obtain ⟨z, p, hp⟩ := pathLemma d.1 (C.gamma (gammaIndex d)) d.2 + (v0 d) (v0mem d) (gamma_missing d) + have graphSwap : TwoColorIncidenceGraph G phi d.1 (C.gamma (gammaIndex d)) = + TwoColorIncidenceGraph G phi (C.gamma (gammaIndex d)) d.1 := by + ext x y + simp [TwoColorIncidenceGraph, or_comm] + let graphHom : TwoColorIncidenceGraph G phi d.1 (C.gamma (gammaIndex d)) →g + TwoColorIncidenceGraph G phi (C.gamma (gammaIndex d)) d.1 := + ⟨id, by intro x y h; simpa [TwoColorIncidenceGraph, or_comm] using h⟩ + let pnew := p.map graphHom + have componentSwap : TwoColorComponent G phi d.1 (C.gamma (gammaIndex d)) + (Sum.inl (v0 d)) = TwoColorComponent G phi (C.gamma (gammaIndex d)) d.1 + (Sum.inl (v0 d)) := by + change ((TwoColorIncidenceGraph G phi d.1 (C.gamma (gammaIndex d))).connectedComponentMk + (Sum.inl (v0 d)) : Set (Sum V E)) = + ((TwoColorIncidenceGraph G phi (C.gamma (gammaIndex d)) d.1).connectedComponentMk + (Sum.inl (v0 d)) : Set (Sum V E)) + ext x + change x ∈ ((TwoColorIncidenceGraph G phi d.1 (C.gamma (gammaIndex d))).connectedComponentMk + (Sum.inl (v0 d))).supp ↔ + x ∈ ((TwoColorIncidenceGraph G phi (C.gamma (gammaIndex d)) d.1).connectedComponentMk + (Sum.inl (v0 d))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff, + SimpleGraph.ConnectedComponent.mem_supp_iff, + SimpleGraph.ConnectedComponent.eq, + SimpleGraph.ConnectedComponent.eq] + constructor + · intro h + simpa [graphHom] using h.map graphHom + · intro h + let reverseHom : TwoColorIncidenceGraph G phi (C.gamma (gammaIndex d)) d.1 →g + TwoColorIncidenceGraph G phi d.1 (C.gamma (gammaIndex d)) := + ⟨id, by intro x y h; simpa [TwoColorIncidenceGraph, or_comm] using h⟩ + simpa [reverseHom] using h.map reverseHom + refine ⟨z, pnew, ?_⟩ + change v0 d ∈ TreeSequenceVertexSet T ∧ pnew.IsPath ∧ + z ∉ TreeSequenceVertexSet T ∧ + {x | x ∈ pnew.support} = + TwoColorComponent G phi (C.gamma (gammaIndex d)) d.1 (Sum.inl (v0 d)) + refine ⟨hp.1, (pnew.isPath_def).2 ?_, hp.2.2.1, ?_⟩ + · simpa [pnew, graphHom] using (p.isPath_def.mp hp.2.1) + · have hsupp : pnew.support = p.support := by simp [pnew, graphHom] + rw [hsupp, ← componentSwap] + exact hp.2.2.2 + +private theorem helper_endpointData_353.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T), + let X : Finset V := TreeSequenceVertexSet T; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + ∀ (alpha0 : Fin k), ( + ∀ (i : Fin C.s), alpha0 ≠ C.gamma i) → + ∀ (v0 : ↥(DefectiveColors G phi X) → V) (f0 : ↥(DefectiveColors G phi X) → E) (u0 z0 : + ↥(DefectiveColors G phi X) → V) (p0 : (d : ↥(DefectiveColors G phi X)) → + (TwoColorIncidenceGraph G phi alpha0 (↑d : Fin k)).Walk (Sum.inl y0) (Sum.inl (z0 d))) (i0 + j0 l0 : (d : ↥(DefectiveColors G phi X)) → Fin ((p0 d).length + (1 : ℕ))), ( + ∀ (d : ↥(DefectiveColors G phi X)), (p0 d).IsPath ∧ {x : V ⊕ E | x ∈ (p0 d).support} = + TwoColorComponent G phi alpha0 (↑d : Fin k) (Sum.inl y0) ∧ ScheideDefectiveChainPath T phi + alpha0 (↑d : Fin k) y0 (z0 d) (p0 d) ∧ (p0 d).getVert (↑(i0 d) : ℕ) = Sum.inl (v0 d) ∧ (p0 + d).getVert (↑(j0 d) : ℕ) = Sum.inr (f0 d) ∧ (p0 d).getVert (↑(l0 d) : ℕ) = Sum.inl (u0 d) + ∧ (↑(j0 d) : ℕ) = (↑(i0 d) : ℕ) + (1 : ℕ) ∧ (↑(l0 d) : ℕ) = (↑(i0 d) : ℕ) + (2 : ℕ) ∧ ( + ∀ (r : Fin ((p0 d).length + (1 : ℕ))), (↑(i0 d) : ℕ) < (↑r : ℕ) → + ∀ (w : V), (p0 d).getVert (↑r : ℕ) = Sum.inl w → w ∉ X) ∧ u0 d ∉ X ∧ v0 d ∈ + ScheideExitVertices T phi) → + ∀ (d : ↥(DefectiveColors G phi X)), G.ends (f0 d) = s(v0 d, u0 d) := by + classical + intro V E _ _ _ G k e0 phi T C X y0 alpha0 hab v0 f0 u0 z0 p0 i0 j0 l0 hinitial d + rcases hinitial d with ⟨hp, hs, hf, hi, hj, hl, hij, hil, hm, ho, he⟩ + have hav := p0 d |>.adj_getVert_succ (by omega : (i0 d).val < (p0 d).length) + rw [← hij, hi, hj] at hav + have hav' : Incident G (v0 d) (f0 d) := by + have htemp : Incident G (v0 d) (f0 d) ∧ + (phi (f0 d) = some alpha0 ∨ phi (f0 d) = some d.1) := by + simpa [TwoColorIncidenceGraph] using hav + exact htemp.1 + have hjl : (l0 d).val = (j0 d).val + 1 := by omega + have haw := p0 d |>.adj_getVert_succ (by omega : (j0 d).val < (p0 d).length) + rw [← hjl, hj, hl] at haw + have haw' : Incident G (u0 d) (f0 d) := by + have htemp : Incident G (u0 d) (f0 d) ∧ + (phi (f0 d) = some alpha0 ∨ phi (f0 d) = some d.1) := by + simpa [TwoColorIncidenceGraph] using haw + exact htemp.1 + let a := (Quot.out (G.ends (f0 d))).1 + let b := (Quot.out (G.ends (f0 d))).2 + have hab : s(a, b) = G.ends (f0 d) := Quot.out_eq _ + have hva : v0 d = a ∨ v0 d = b := by + have hmem : v0 d ∈ s(a, b) := by + rw [hab] + exact hav' + exact (Sym2.mem_iff.mp hmem) + have hua : u0 d = a ∨ u0 d = b := by + have hmem : u0 d ∈ s(a, b) := by + rw [hab] + exact haw' + exact (Sym2.mem_iff.mp hmem) + have hvu : v0 d ≠ u0 d := by + intro h + have hh := hp.getVert_injOn (show (i0 d).val ≤ (p0 d).length by omega) + (show (l0 d).val ≤ (p0 d).length by omega) + (hi.trans (h ▸ hl).symm) + omega + rw [← hab, Sym2.eq_iff] + rcases hva with hva | hva + · rcases hua with hua | hua + · exact (hvu (hva.trans hua.symm)).elim + · exact Or.inl ⟨hva.symm, hua.symm⟩ + · rcases hua with hua | hua + · exact Or.inr ⟨hua.symm, hva.symm⟩ + · exact (hvu (hva.trans hua.symm)).elim + +private theorem helper_hblock_431.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T), GlobalMaximumTriple G k e0 phi T → + let X : Finset V := TreeSequenceVertexSet T; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); y0 ∈ X → + ∀ (i : Fin C.s), C.gamma i ∈ MissingColors G phi y0 → + ∀ (j : Fin C.s), C.gamma j ∈ MissingColors G phi y0 → i = j := by + classical + intro V E _ _ _ G k e0 phi T C hglobal X y0 hy0 i hi j hj + have hexitbase : ∀ v ∈ ScheideExitVertices T phi, + v ∈ X := by + intro v hv + have hv' : ScheideExitVertex T phi v := by + simpa [ScheideExitVertices] using hv + rcases hv' with ⟨u, a, d, hu, ha, hd, z, p, hp, q, hq, hvq, hafter⟩ + exact hvq + obtain ⟨v, hv, hvm⟩ := C.every_block_color_at_exit i + have hvX := hexitbase v hv + have hsame : v = y0 := by + by_contra hne + have hd := (ScheideGlobalMaximumOrder G k e0 phi T hglobal).2.2.2.1 + hvX hy0 hne + exact (Finset.disjoint_left.1 hd hvm hi).elim + have hyexit : y0 ∈ ScheideExitVertices T phi := hsame ▸ hv + obtain ⟨q, hq, huq⟩ := C.exit_exactly_one y0 hyexit + have hiq : i = q := huq i hi + have hjq : j = q := huq j hj + exact hiq.trans hjq.symm + +private theorem helper_he0_446.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T), + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + Incident G y0 e0 := by + classical + intro V E _ _ _ G k e0 phi T C y0 + obtain ⟨q, hq⟩ := T.attaches ⟨0, T.positive⟩ + have hq0 : q = ⟨0, by omega⟩ := by + apply Fin.ext + exact Nat.eq_zero_of_le_zero (Nat.le_of_lt_succ q.isLt) + have he : T.edge ⟨0, T.positive⟩ = e0 := T.first_edge + have hv0 := C.base_vertex_position ⟨0, Nat.lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hv1 := C.base_vertex_position ⟨1, Nat.lt_of_lt_of_le (by decide) C.p_ge_two⟩ + change y0 ∈ G.ends e0 + rw [← he, hq, hq0] + rw [Sym2.mem_iff] + right + calc + y0 = C.y ⟨0, Nat.lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ := rfl + _ = T.vertex ⟨0, Nat.zero_lt_succ _⟩ := hv0.symm + _ = T.vertex (⟨0, by omega⟩ : Fin (T.length + 1)) := by + rfl + +private theorem helper_branch_590.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T), GlobalMaximumTriple G k e0 phi T → + let X : Finset V := TreeSequenceVertexSet T; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); y0 ∈ X → + ∀ alpha0 ∈ MissingColors G phi y0, + ∀ (v0 : ↥(DefectiveColors G phi X) → V) (f0 : ↥(DefectiveColors G phi X) → E) (u0 : + ↥(DefectiveColors G phi X) → V), ( + ∀ (d : ↥(DefectiveColors G phi X)), v0 d ∈ X) → ( + ∀ (d : ↥(DefectiveColors G phi X)), G.ends (f0 d) = s(v0 d, u0 d)) → + ∀ (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), u0 d ∉ X → phi (f0 d) = some + alpha0 → phi (f0 d) = some (↑d : Fin k) := by + classical + intro V E _ _ _ G k e0 phi T C hglobal X y0 hy0 alpha0 halpha0 v0 f0 u0 v0mem endpointData d ho + hcol + have hboundary : f0 d ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v0 d, v0mem d, u0 d, ho, endpointData d⟩ + have halphaTree : alpha0 ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨y0, hy0, halpha0⟩ + have hempty := (ScheideGlobalMaximumBoundaryFacts G k e0 phi T hglobal).2.1 + alpha0 halphaTree + have hbad : f0 d ∈ BoundaryColorEdges G phi X alpha0 := by + simp only [BoundaryColorEdges, Finset.mem_filter, hboundary, true_and] + exact hcol + rw [hempty] at hbad + simp at hbad + +private theorem helper_continuation_587.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T), GlobalMaximumTriple G k e0 phi T → + let X : Finset V := TreeSequenceVertexSet T; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); y0 ∈ X → + ∀ alpha0 ∈ MissingColors G phi y0, ( + ∀ (i : Fin C.s), alpha0 ≠ C.gamma i) → + ∀ (v0 : ↥(DefectiveColors G phi X) → V) (f0 : ↥(DefectiveColors G phi X) → E) (u0 z0 : + ↥(DefectiveColors G phi X) → V) (p0 : (d : ↥(DefectiveColors G phi X)) → + (TwoColorIncidenceGraph G phi alpha0 (↑d : Fin k)).Walk (Sum.inl y0) (Sum.inl (z0 d))) (i0 + j0 l0 : (d : ↥(DefectiveColors G phi X)) → Fin ((p0 d).length + (1 : ℕ))), ( + ∀ (d : ↥(DefectiveColors G phi X)), (p0 d).IsPath ∧ {x : V ⊕ E | x ∈ (p0 d).support} = + TwoColorComponent G phi alpha0 (↑d : Fin k) (Sum.inl y0) ∧ ScheideDefectiveChainPath T phi + alpha0 (↑d : Fin k) y0 (z0 d) (p0 d) ∧ (p0 d).getVert (↑(i0 d) : ℕ) = Sum.inl (v0 d) ∧ (p0 + d).getVert (↑(j0 d) : ℕ) = Sum.inr (f0 d) ∧ (p0 d).getVert (↑(l0 d) : ℕ) = Sum.inl (u0 d) + ∧ (↑(j0 d) : ℕ) = (↑(i0 d) : ℕ) + (1 : ℕ) ∧ (↑(l0 d) : ℕ) = (↑(i0 d) : ℕ) + (2 : ℕ) ∧ ( + ∀ (r : Fin ((p0 d).length + (1 : ℕ))), (↑(i0 d) : ℕ) < (↑r : ℕ) → + ∀ (w : V), (p0 d).getVert (↑r : ℕ) = Sum.inl w → w ∉ X) ∧ u0 d ∉ X ∧ v0 d ∈ + ScheideExitVertices T phi) → + ∀ (gammaIndex : ↥(DefectiveColors G phi X) → Fin C.s), ( + ∀ (d : ↥(DefectiveColors G phi X)), C.gamma (gammaIndex d) ∈ MissingColors G phi (v0 d)) → ( + ∀ (d : ↥(DefectiveColors G phi X)), v0 d ∈ X) → + ∀ (replacementZ : ↥(DefectiveColors G phi X) → V) (replacementPath : (d : ↥(DefectiveColors G + phi X)) → (TwoColorIncidenceGraph G phi (C.gamma (gammaIndex d)) (↑d : Fin k)).Walk + (Sum.inl (v0 d)) (Sum.inl (replacementZ d))), ( + ∀ (d : ↥(DefectiveColors G phi X)), ScheideDefectiveChainPath T phi (C.gamma (gammaIndex d)) + (↑d : Fin k) (v0 d) (replacementZ d) (replacementPath d)) → ( + ∀ (d : ↥(DefectiveColors G phi X)), G.ends (f0 d) = s(v0 d, u0 d)) → Nonempty + (ScheideDefectiveSetup G k e0 phi T C) := by + classical + intro V E _ _ _ G k e0 phi T C hglobal X y0 hy0 alpha0 halpha0 hab v0 f0 u0 z0 p0 i0 j0 l0 + hinitial gammaIndex gamma_missing v0mem replacementZ replacementPath replacement_full + endpointData + refine ⟨{ + alpha0 := alpha0 + alpha0_missing_at_y0 := by simpa [y0] using halpha0 + alpha0_not_block := hab + v0 := v0 + f0 := f0 + u0 := u0 + gammaIndex := gammaIndex + initialZ := z0 + initialPath := p0 + initial_path_full := by + intro d + rcases hinitial d with ⟨hp, hs, hf, hi, hj, hl, hij, hil, hm, ho, he⟩ + exact hf + v0Index := i0 + f0Index := j0 + u0Index := l0 + v0_at_index := by + intro d + exact (hinitial d).2.2.2.1 + f0_at_index := by + intro d + exact (hinitial d).2.2.2.2.1 + u0_at_index := by + intro d + exact (hinitial d).2.2.2.2.2.1 + successive_indices := by + intro d + exact ⟨(hinitial d).2.2.2.2.2.2.1, (hinitial d).2.2.2.2.2.2.2.1⟩ + v0_is_last_tree_vertex := by + intro d + exact (hinitial d).2.2.2.2.2.2.2.2.1 + v0_is_exit := by + intro d + exact (hinitial d).2.2.2.2.2.2.2.2.2.2 + gamma_missing_at_v0 := gamma_missing + f0_color := by + intro d + rcases hinitial d with ⟨hp, hs, hf, hi, hj, hl, hij, hil, hm, ho, he⟩ + have hadj := p0 d |>.adj_getVert_succ (by omega : (i0 d).val < (p0 d).length) + rw [← hij, hi, hj] at hadj + have hcol : phi (f0 d) = some alpha0 ∨ phi (f0 d) = some d.1 := by + have htemp : Incident G (v0 d) (f0 d) ∧ + (phi (f0 d) = some alpha0 ∨ phi (f0 d) = some d.1) := by + simpa [TwoColorIncidenceGraph] using hadj + exact htemp.2 + rcases hcol with hcol | hcol + · exact @helper_branch_590 V E inferInstance inferInstance inferInstance G k e0 phi T C + hglobal hy0 alpha0 halpha0 v0 f0 u0 v0mem endpointData d ho hcol + · exact hcol + f0_ends := by + intro d + rcases hinitial d with ⟨hp, hs, hf, hi, hj, hl, hij, hil, hm, ho, he⟩ + have hav := p0 d |>.adj_getVert_succ (by omega : (i0 d).val < (p0 d).length) + rw [← hij, hi, hj] at hav + have hav' : Incident G (v0 d) (f0 d) := by + have htemp : Incident G (v0 d) (f0 d) ∧ + (phi (f0 d) = some alpha0 ∨ phi (f0 d) = some d.1) := by + simpa [TwoColorIncidenceGraph] using hav + exact htemp.1 + have haw := p0 d |>.adj_getVert_succ (by omega : (j0 d).val < (p0 d).length) + have hjl : (l0 d).val = (j0 d).val + 1 := by omega + rw [← hjl, hj, hl] at haw + have haw' : Incident G (u0 d) (f0 d) := by + have htemp : Incident G (u0 d) (f0 d) ∧ + (phi (f0 d) = some alpha0 ∨ phi (f0 d) = some d.1) := by + simpa [TwoColorIncidenceGraph] using haw + exact htemp.1 + let a := (Quot.out (G.ends (f0 d))).1 + let b := (Quot.out (G.ends (f0 d))).2 + have hab : s(a, b) = G.ends (f0 d) := Quot.out_eq _ + have hva : v0 d = a ∨ v0 d = b := by + have hmem : v0 d ∈ s(a, b) := by + rw [hab] + exact hav' + exact (Sym2.mem_iff.mp hmem) + have hua : u0 d = a ∨ u0 d = b := by + have hmem : u0 d ∈ s(a, b) := by + rw [hab] + exact haw' + exact (Sym2.mem_iff.mp hmem) + have hvu : v0 d ≠ u0 d := by + intro h + have hh := hp.getVert_injOn (show (i0 d).val ≤ (p0 d).length by omega) + (show (l0 d).val ≤ (p0 d).length by omega) + (hi.trans (h ▸ hl).symm) + omega + rw [← hab, Sym2.eq_iff] + rcases hva with hva | hva + · rcases hua with hua | hua + · exact (hvu (hva.trans hua.symm)).elim + · exact Or.inl ⟨hva.symm, hua.symm⟩ + · rcases hua with hua | hua + · exact Or.inr ⟨hua.symm, hva.symm⟩ + · exact (hvu (hva.trans hua.symm)).elim + u0_outside := by + intro d + exact (hinitial d).2.2.2.2.2.2.2.2.2.1 + v0_on_initial_component := by + intro d + rcases hinitial d with ⟨hp, hs, hf, hi, hj, hl, hij, hil, hm, ho, he⟩ + rw [← hs] + have hmem := p0 d |>.getVert_mem_support (i0 d).val + simpa [hi] using hmem + f0_on_initial_component := by + intro d + rcases hinitial d with ⟨hp, hs, hf, hi, hj, hl, hij, hil, hm, ho, he⟩ + rw [← hs] + have hmem := p0 d |>.getVert_mem_support (j0 d).val + simpa [hj] using hmem + replacementZ := replacementZ + replacementPath := replacementPath + replacement_path_full := replacement_full + }⟩ + +theorem ScheideDefectiveSetupExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (_ : DefectiveColors G phi (TreeSequenceVertexSet T) ≠ ∅) : + Nonempty (ScheideDefectiveSetup G k e0 phi T C) := by + classical + have hglobal : GlobalMaximumTriple G k e0 phi T := C.globally_maximum + have pathLemma : ∀ (alpha gamma : Fin k), + ∀ (halpha : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T)), + ∀ (u : V), u ∈ TreeSequenceVertexSet T → + ∀ (hgamma : gamma ∈ MissingColors G phi u), + ∃ (z : V) (p : (TwoColorIncidenceGraph G phi alpha gamma).Walk + (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi alpha gamma u z p := by + exact P2968_T1_DefectiveColorComponentPath G k e0 phi T hglobal + let X := TreeSequenceVertexSet T + let y0 : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hy0 : y0 ∈ X := by + simp only [X, TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨⟨0, Nat.zero_lt_succ _⟩, ?_⟩ + change T.vertex ⟨0, Nat.zero_lt_succ _⟩ = + C.y ⟨0, Nat.lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + exact C.base_vertex_position ⟨0, Nat.lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have he0 := @helper_he0_446 V E inferInstance inferInstance inferInstance G k e0 phi T C + have hcounts := ScheideGlobalMaximumMissingCounts G k e0 phi T hglobal y0 hy0 + have hcard : 2 ≤ (MissingColors G phi y0).card := hcounts.1 he0 |>.2 + have hblock := @helper_hblock_431 V E inferInstance inferInstance inferInstance G k e0 phi T C + hglobal hy0 + have hgamma_bound : (Finset.univ.filter (fun i : Fin C.s => + C.gamma i ∈ MissingColors G phi y0)).card ≤ 1 := by + apply Finset.card_le_one.mpr + intro i hi j hj + exact hblock i (Finset.mem_filter.mp hi).2 j (Finset.mem_filter.mp hj).2 + have hchoose : ∃ a : Fin k, a ∈ MissingColors G phi y0 ∧ + ∀ i : Fin C.s, a ≠ C.gamma i := by + by_contra hn + push Not at hn + have hc : (MissingColors G phi y0).card ≤ 1 := by + apply Finset.card_le_one.mpr + intro a ha b hb + obtain ⟨i, hi⟩ := hn a ha + obtain ⟨j, hj⟩ := hn b hb + have hij : i = j := hblock i (by simpa [hi] using ha) + j (by simpa [hj] using hb) + simp [hi, hj, hij] + omega + obtain ⟨alpha0, halpha0, hab⟩ := hchoose + have extractPath : + ∀ {a b : Fin k} {u z : V} + {p : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl u) (Sum.inl z)}, + ScheideDefectiveChainPath T phi a b u z p → + ∃ (v : V) (f : E) (w : V) (i j l : Fin (p.length + 1)), p.getVert i.val = Sum.inl v ∧ v ∈ X ∧ + p.getVert j.val = Sum.inr f ∧ p.getVert l.val = Sum.inl w ∧ j.val = i.val + 1 ∧ l.val = + i.val + 2 ∧ ( + ∀ r : Fin (p.length + 1), i.val < r.val → + ∀ x : V, p.getVert r.val = Sum.inl x → x ∉ X) ∧ w ∉ X := by + exact @helper_extractPath_136 V E inferInstance inferInstance inferInstance G k + e0 phi T C (by assumption) + have initialData : + ∀ d : {delta // delta ∈ DefectiveColors G phi X}, + ∃ (v : V) (f : E) (u : V) (z : V) (p : (TwoColorIncidenceGraph G phi alpha0 d.1).Walk (Sum.inl + y0) (Sum.inl z)) (i j l : Fin (p.length + 1)), p.IsPath ∧ {x | x ∈ p.support} = + TwoColorComponent G phi alpha0 d.1 (Sum.inl y0) ∧ ScheideDefectiveChainPath T phi alpha0 + d.1 y0 z p ∧ p.getVert i.val = Sum.inl v ∧ p.getVert j.val = Sum.inr f ∧ p.getVert l.val = + Sum.inl u ∧ j.val = i.val + 1 ∧ l.val = i.val + 2 ∧ ( + ∀ r : Fin (p.length + 1), i.val < r.val → + ∀ w : V, p.getVert r.val = Sum.inl w → w ∉ X) ∧ u ∉ X ∧ v ∈ ScheideExitVertices T phi := by + exact @helper_initialData_208 V E inferInstance inferInstance inferInstance G k e0 phi T C + (by assumption) pathLemma hy0 alpha0 halpha0 extractPath + choose v0 f0 u0 z0 p0 i0 j0 l0 hinitial using initialData + have gammaData : ∀ d : {delta // delta ∈ DefectiveColors G phi X}, + ∃ i : Fin C.s, C.gamma i ∈ MissingColors G phi (v0 d) := by + intro d + have he := (hinitial d).2.2.2.2.2.2.2.2.2.2 + have hvX : v0 d ∈ X := by + simp only [ScheideExitVertices, Finset.mem_filter, Finset.mem_univ, true_and] at he + rcases he with ⟨u, a, q, hu, ha, hq, z, p, hp, i, hi, hv, hl⟩ + exact hv + exact (C.exit_exactly_one (v0 d) he).exists + choose gammaIndex gamma_missing using gammaData + have v0mem : ∀ d : {delta // delta ∈ DefectiveColors G phi X}, v0 d ∈ X := by + intro d + have he := (hinitial d).2.2.2.2.2.2.2.2.2.2 + simp only [ScheideExitVertices, Finset.mem_filter, Finset.mem_univ, true_and] at he + rcases he with ⟨u, a, q, hu, ha, hq, z, p, hp, i, hi, hv, hl⟩ + exact hv + have replacementData : + ∀ d : {delta // delta ∈ DefectiveColors G phi X}, + ∃ z : V, + ∃ p : (TwoColorIncidenceGraph G phi (C.gamma (gammaIndex d)) d.1).Walk (Sum.inl (v0 d)) + (Sum.inl z), ScheideDefectiveChainPath T phi (C.gamma (gammaIndex d)) d.1 (v0 d) z p := by + exact @helper_replacementData_301 V E inferInstance inferInstance inferInstance G k e0 phi T + C (by assumption) pathLemma v0 gammaIndex gamma_missing v0mem + choose replacementZ replacementPath replacement_full using replacementData + have endpointData := @helper_endpointData_353 V E inferInstance inferInstance inferInstance G k e0 + phi T C alpha0 hab v0 f0 u0 z0 p0 i0 j0 l0 hinitial + exact @helper_continuation_587 V E inferInstance inferInstance inferInstance G k e0 phi T C + hglobal hy0 alpha0 halpha0 hab v0 f0 u0 z0 p0 i0 j0 l0 hinitial gammaIndex gamma_missing + v0mem replacementZ replacementPath replacement_full endpointData +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveSwitchEffect.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveSwitchEffect.lean new file mode 100644 index 0000000000..503e08ffff --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveSwitchEffect.lean @@ -0,0 +1,270 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveTailExternal + +/-! +# Scheide Defective Switch Effect + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ScheideDefectiveSwitchEffect_present_v0_159.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let alpha := C.gamma (D.gammaIndex d); + let beta := (↑d : Fin k); + let z := Sum.inl (D.v0 d); + let component := TwoColorComponent G phi alpha beta z; + let phiD := TwoColorComponentSwap G phi alpha beta z; + IsProperEdgeColoring G phi → + phi (D.f0 d) = some beta → + Incident G (D.v0 d) (D.f0 d) → + alpha ≠ beta → + Sum.inr (D.f0 d) ∈ component → + (∀ (e : E), Incident G (D.v0 d) e → Sum.inr e ∈ component → e = D.f0 d) → + PresentColors G phiD (D.v0 d) = insert alpha ((PresentColors G phi (D.v0 + d)).erase beta) := by + classical + intro V E _ _ _ G k e0 phi T C D d alpha beta z component phiD proper f0_color f0_incident + colors_ne f0_component f0_unique + ext c + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and, + Finset.mem_insert, Finset.mem_erase] + constructor + · rintro ⟨e, he, hec⟩ + by_cases em : Sum.inr e ∈ component + · have eeq := f0_unique e he em + subst e + simp [phiD, component, TwoColorComponentSwap, f0_component, + f0_color, colors_ne.symm] at hec + exact Or.inl hec.symm + · have old : phi e = some c := by + simpa [phiD, component, TwoColorComponentSwap, em] using hec + have cne : c ≠ beta := by + intro ceq + have bad := proper (by + intro eqe + exact em (eqe ▸ f0_component)) ⟨D.v0 d, he, f0_incident⟩ old + exact bad (by simpa [ceq] using f0_color) + exact Or.inr ⟨cne, ⟨e, he, old⟩⟩ + · intro hc + rcases hc with rfl | ⟨cne, ⟨e, he, hold⟩⟩ + · refine ⟨D.f0 d, f0_incident, ?_⟩ + simp [phiD, component, TwoColorComponentSwap, f0_component, + f0_color] + · have em : Sum.inr e ∉ component := by + intro em + have eeq := f0_unique e he em + subst e + exact cne (Option.some.inj (f0_color.symm.trans hold)).symm + refine ⟨e, he, ?_⟩ + simpa [phiD, component, TwoColorComponentSwap, em] using hold + +theorem ScheideDefectiveSwitchEffect {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) : + ∀ d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}, + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + IsProperEdgeColoring G phiD ∧ IsOneEdgeUncolored phiD e0 ∧ + phiD (D.f0 d) = some (C.gamma (D.gammaIndex d)) ∧ + MissingColors G phiD (D.v0 d) = + insert d.1 ((MissingColors G phi (D.v0 d)).erase + (C.gamma (D.gammaIndex d))) ∧ + (∀ f : E, (∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → + f ≠ D.f0 d → phiD f = phi f) ∧ + (∀ v ∈ TreeSequenceVertexSet T, v ≠ D.v0 d → + MissingColors G phiD v = MissingColors G phi v) ∧ + ∀ v : V, + Sum.inl v ∉ TwoColorComponent G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) → + MissingColors G phiD v = MissingColors G phi v := by + classical + intro d + dsimp + let alpha := C.gamma (D.gammaIndex d) + let beta := d.1 + let z : Sum V E := Sum.inl (D.v0 d) + let component := TwoColorComponent G phi alpha beta z + let phiD := TwoColorComponentSwap G phi alpha beta z + have proper : IsProperEdgeColoring G phi := C.globally_maximum.1.2.2.2.1 + have gamma_missing : alpha ∈ MissingColors G phi (D.v0 d) := + D.gamma_missing_at_v0 d + have f0_color : phi (D.f0 d) = some beta := D.f0_color d + have f0_incident : Incident G (D.v0 d) (D.f0 d) := by + change D.v0 d ∈ G.ends (D.f0 d) + rw [D.f0_ends] + simp [] + have colors_ne : alpha ≠ beta := by + intro same + have no_alpha : alpha ∉ PresentColors G phi (D.v0 d) := by + simpa [MissingColors] using gamma_missing + apply no_alpha + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨D.f0 d, f0_incident, by simpa [same] using f0_color⟩ + have f0_component : Sum.inr (D.f0 d) ∈ component := by + change Sum.inr (D.f0 d) ∈ + TwoColorComponent G phi alpha beta (Sum.inl (D.v0 d)) + change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inr (D.f0 d)) = + (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl (D.v0 d)) + have link : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inl (D.v0 d)) (Sum.inr (D.f0 d)) := by + simp [TwoColorIncidenceGraph, f0_incident, f0_color] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj link).symm + have vertex_step : ∀ v e, Incident G v e → + Sum.inr e ∈ component → Sum.inl v ∈ component := by + intro v e incident edge_member + change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl v) = + (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk z + have edge_reach : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inl v) (Sum.inr e) := by + have edge_colors : phi e = some alpha ∨ phi e = some beta := by + have support : Sum.inr e ∈ + (TwoColorIncidenceGraph G phi alpha beta).support := by + apply SimpleGraph.mem_support_of_reachable (G := TwoColorIncidenceGraph G phi alpha beta) + (u := Sum.inr e) (v := z) (by simp [z]) + exact SimpleGraph.ConnectedComponent.eq.mp edge_member + obtain ⟨q, hq⟩ := (TwoColorIncidenceGraph G phi alpha beta).mem_support.mp support + cases q with + | inl q => exact hq.2 + | inr q => simp [TwoColorIncidenceGraph] at hq + simp [TwoColorIncidenceGraph, incident, edge_colors] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj edge_reach).trans + edge_member + have outside_edge : ∀ v e, Incident G v e → Sum.inl v ∉ component → + Sum.inr e ∉ component := by + intro v e incident vertex_not edge_member + exact vertex_not (vertex_step v e incident edge_member) + have component_tree : ∀ v, v ∈ TreeSequenceVertexSet T → + Sum.inl v ∈ component → v = D.v0 d := by + intro v vt vc + exact ScheideDefectiveTailExternal G k e0 phi T C D d v vt vc + have alpha_not_present : alpha ∉ PresentColors G phi (D.v0 d) := by + simpa [MissingColors] using gamma_missing + have f0_unique : ∀ e, Incident G (D.v0 d) e → Sum.inr e ∈ component → e = D.f0 d := by + intro e incident edge_member + have color_choice : phi e = some alpha ∨ phi e = some beta := by + have support : Sum.inr e ∈ + (TwoColorIncidenceGraph G phi alpha beta).support := by + apply SimpleGraph.mem_support_of_reachable (G := TwoColorIncidenceGraph G phi alpha beta) + (u := Sum.inr e) (v := z) (by simp [z]) + exact SimpleGraph.ConnectedComponent.eq.mp edge_member + obtain ⟨q, hq⟩ := (TwoColorIncidenceGraph G phi alpha beta).mem_support.mp support + cases q with + | inl q => exact hq.2 + | inr q => simp [TwoColorIncidenceGraph] at hq + rcases color_choice with ca | cb + · exact False.elim (alpha_not_present (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, incident, ca⟩)) + · by_contra unequal + have bad := proper unequal ⟨D.v0 d, incident, f0_incident⟩ cb + exact bad f0_color + have one : IsOneEdgeUncolored phi e0 := C.globally_maximum.1.2.2.2.2 + have tree_edge_not : ∀ f, (∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → + f ≠ D.f0 d → Sum.inr f ∉ component := by + intro f hf hne mem + obtain ⟨v, vt, hvf⟩ := hf + have vc := vertex_step v f hvf mem + have veq := component_tree v vt vc + apply hne + exact f0_unique f (veq ▸ hvf) mem + have present_outside : ∀ v, Sum.inl v ∉ component → + PresentColors G phiD v = PresentColors G phi v := by + intro v vout + ext c + constructor + · intro hc + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc ⊢ + obtain ⟨e, he, hec⟩ := hc + refine ⟨e, he, ?_⟩ + have emem : Sum.inr e ∉ component := outside_edge v e he vout + simpa [phiD, component, TwoColorComponentSwap, emem] using hec + · intro hc + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc ⊢ + obtain ⟨e, he, hec⟩ := hc + refine ⟨e, he, ?_⟩ + have emem : Sum.inr e ∉ component := outside_edge v e he vout + simpa [phiD, component, TwoColorComponentSwap, emem] using hec + have fixed_tree : ∀ f, (∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → + f ≠ D.f0 d → phiD f = phi f := by + intro f hf hne + have mem : Sum.inr f ∉ component := tree_edge_not f hf hne + simp [phiD, component, TwoColorComponentSwap, mem] + have present_v0 : PresentColors G phiD (D.v0 d) = + insert alpha ((PresentColors G phi (D.v0 d)).erase beta) := by + exact @ScheideDefectiveSwitchEffect_present_v0_159 V E inferInstance inferInstance + inferInstance G k e0 phi T C D d proper f0_color f0_incident colors_ne f0_component + f0_unique + have properD : IsProperEdgeColoring G phiD := by + exact TwoColorComponentSwapProper G phi alpha beta colors_ne proper z + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · simpa [phiD] using properD + · unfold IsOneEdgeUncolored + constructor + · change phiD e0 = none + simp [phiD, TwoColorComponentSwap, one.1] + · intro e he + obtain ⟨c, hc⟩ := one.2 e he + by_cases mem : Sum.inr e ∈ component + · have mem' : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by + simpa [component] using mem + refine ⟨if c = alpha then beta else if c = beta then alpha else c, ?_⟩ + by_cases ca : c = alpha <;> by_cases cb : c = beta <;> + simp [TwoColorComponentSwap, alpha, beta, z, mem', hc, ca, cb, + colors_ne.symm] + · have mem' : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by + simpa [component] using mem + exact ⟨c, by simpa [phiD, TwoColorComponentSwap, alpha, beta, z, mem'] using hc⟩ + · change phiD (D.f0 d) = some alpha + have mem' : Sum.inr (D.f0 d) ∈ TwoColorComponent G phi alpha beta z := by + simpa [component] using f0_component + simp [phiD, TwoColorComponentSwap, alpha, beta, z, mem', f0_color] + · have missing_v0 : MissingColors G phiD (D.v0 d) = + insert beta ((MissingColors G phi (D.v0 d)).erase alpha) := by + simp only [MissingColors] + rw [present_v0] + ext c + by_cases ca : c = alpha <;> by_cases cb : c = beta <;> + simp [ca, cb, colors_ne, colors_ne.symm] + change MissingColors G phiD (D.v0 d) = + insert beta ((MissingColors G phi (D.v0 d)).erase alpha) + exact missing_v0 + · intro f hf hne + exact fixed_tree f hf hne + · intro v vt hne + have vout : Sum.inl v ∉ component := by + intro vc + exact hne (component_tree v vt vc) + change MissingColors G phiD v = MissingColors G phi v + simp only [MissingColors] + rw [present_outside v vout] + · intro v hv + have vout : Sum.inl v ∉ component := hv + change MissingColors G phiD v = MissingColors G phi v + simp only [MissingColors] + rw [present_outside v vout] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveTailExternal.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveTailExternal.lean new file mode 100644 index 0000000000..f3348f02d4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveTailExternal.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveLastReturnExists +public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnContradiction + +/-! +# Scheide Defective Tail External + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideDefectiveTailExternal {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) : + ∀ d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}, + ∀ w ∈ TreeSequenceVertexSet T, Sum.inl w ∈ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) + d.1 (Sum.inl (D.v0 d)) → w = D.v0 d := by + classical + intro d w hw hcomponent + by_contra hne + obtain ⟨R⟩ := ScheideDefectiveLastReturnExists + G k e0 phi T C D d w hw hcomponent hne + exact ScheideDefectiveReturnContradiction G k e0 phi T C D d R + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveTerminalComponent.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveTerminalComponent.lean new file mode 100644 index 0000000000..c72b0c7d6c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveTerminalComponent.lean @@ -0,0 +1,890 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Defective Terminal Component + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation357Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let p : (TwoColorIncidenceGraph G phi D.alpha0 (↑d : Fin k)).Walk (Sum.inl (C.y (⟨(0 : ℕ), + lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p))) (Sum.inl (D.initialZ d)) := + D.initialPath d; + let i : Fin ((D.initialPath d).length + (1 : ℕ)) := D.v0Index d; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi D.alpha0 (↑d : Fin k); + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gamma (↑d : Fin k); + let R : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑r : ℕ) ∧ p.getVert (↑r : ℕ) = q}; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + ∀ (_ : IsProperEdgeColoring G phi) (_ : D.v0 d ∈ X) (_ : p.IsPath) (_ : + {q : V ⊕ E | q ∈ p.support} = TwoColorComponent G phi D.alpha0 (↑d : Fin k) (Sum.inl y0)) + (_ : IsProperEdgeColoring G phi1) (_ : IsOneEdgeUncolored phi1 e0) (_ : StableColoring T ∅ + phi phi1) (_ : + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) (_ : (↑(D.f0Index d) : ℕ) = (↑(D.v0Index d) + : ℕ) + (1 : ℕ) ∧ (↑(D.u0Index d) : ℕ) = (↑(D.v0Index d) : ℕ) + (2 : ℕ)) (_ : (↑i : ℕ) + (1 + : ℕ) < p.length) (_ : p.getVert (↑i : ℕ) = Sum.inl (D.v0 d)) (_ : p.getVert ((↑i : ℕ) + (1 + : ℕ)) = Sum.inr (D.f0 d)) (_ : + ∀ {c : Fin k} {v : V} {e : E}, c ∈ MissingColors G phi v → Incident G v e → phi e ≠ some c) (_ + : + ∀ {r : Fin (p.length + (1 : ℕ))} {w : V}, (↑i : ℕ) ≤ (↑r : ℕ) → p.getVert (↑r : ℕ) = Sum.inl w + → (↑r : ℕ) = (↑i : ℕ) ∧ w = D.v0 d ∨ (↑i : ℕ) < (↑r : ℕ) ∧ w ∉ X) (_ : + ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → H0.Adj (p.getVert n) (p.getVert m) → n + (1 : ℕ) = + m ∨ m + (1 : ℕ) = n) (_ : + ∀ (n : ℕ), (↑i : ℕ) ≤ n → n < p.length → H1.Adj (p.getVert n) (p.getVert (n + (1 : ℕ)))) (_ : + ∀ {q r : V ⊕ E}, q ∈ R → H1.Adj q r → H0.Adj q r), IsProperEdgeColoring G + (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) ∧ IsOneEdgeUncolored + (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) e0 ∧ StableColoring T ∅ + phi (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) ∧ ( + ∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex + d)) f = phi f) ∧ {q : V ⊕ E | + ∃ (r : Fin ((D.initialPath d).length + (1 : ℕ))), (↑(D.v0Index d) : ℕ) ≤ (↑r : ℕ) ∧ + (D.initialPath d).getVert (↑r : ℕ) = q} = TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) ∧ Sum.inr (D.f0 d) ∈ TwoColorComponent G (OutsideTreeColorSwap T phi D.alpha0 + (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) ↔ v = D.v0 d) ∧ ( + ∀ (q : Fin T.length), Sum.inr (T.edge q) ∉ TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d))) ∧ + ∀ (f : E), Sum.inr f ∈ TwoColorComponent G (OutsideTreeColorSwap T phi D.alpha0 (C.gamma + (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) → + OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d)) f = some (C.gamma + (D.gammaIndex d)) ∨ OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d)) f = + some (↑d : Fin k) + +private abbrev helperContinuation351Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let p : (TwoColorIncidenceGraph G phi D.alpha0 (↑d : Fin k)).Walk (Sum.inl (C.y (⟨(0 : ℕ), + lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p))) (Sum.inl (D.initialZ d)) := + D.initialPath d; + let i : Fin ((D.initialPath d).length + (1 : ℕ)) := D.v0Index d; + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi D.alpha0 (↑d : Fin k); + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi1 gamma (↑d : Fin k); + let _ : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑r : ℕ) ∧ p.getVert (↑r : ℕ) = q}; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + ∀ (_ : IsProperEdgeColoring G phi) (_ : ColoredVertexSetClosed G phi X) (_ : y0 ∈ X) (_ : D.v0 + d ∈ X) (_ : p.IsPath) (_ : {q : V ⊕ E | q ∈ p.support} = TwoColorComponent G phi D.alpha0 + (↑d : Fin k) (Sum.inl y0)) (_ : D.alpha0 ≠ (↑d : Fin k)) (_ : gamma ≠ (↑d : Fin k)) (_ : + D.alpha0 ≠ gamma) (_ : IsProperEdgeColoring G phi1) (_ : IsOneEdgeUncolored phi1 e0) (_ : + StableColoring T ∅ phi phi1) (_ : + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) (_ : (↑(D.f0Index d) : ℕ) = (↑(D.v0Index d) + : ℕ) + (1 : ℕ) ∧ (↑(D.u0Index d) : ℕ) = (↑(D.v0Index d) : ℕ) + (2 : ℕ)) (_ : (↑i : ℕ) + (1 + : ℕ) < p.length) (_ : p.getVert (↑i : ℕ) = Sum.inl (D.v0 d)) (_ : p.getVert ((↑i : ℕ) + (1 + : ℕ)) = Sum.inr (D.f0 d)) (_ : + ∀ {e : E} {w : V}, TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X) (_ : + ∀ {c : Fin k} {v : V} {e : E}, c ∈ MissingColors G phi v → Incident G v e → phi e ≠ some c) (_ + : + ∀ {r : Fin (p.length + (1 : ℕ))} {w : V}, (↑i : ℕ) ≤ (↑r : ℕ) → p.getVert (↑r : ℕ) = Sum.inl w + → (↑r : ℕ) = (↑i : ℕ) ∧ w = D.v0 d ∨ (↑i : ℕ) < (↑r : ℕ) ∧ w ∉ X) (_ : + ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → n < m → H0.Adj (p.getVert n) (p.getVert m) → m = n + + (1 : ℕ)), IsProperEdgeColoring G (OutsideTreeColorSwap T phi D.alpha0 (C.gamma + (D.gammaIndex d))) ∧ IsOneEdgeUncolored (OutsideTreeColorSwap T phi D.alpha0 (C.gamma + (D.gammaIndex d))) e0 ∧ StableColoring T ∅ phi (OutsideTreeColorSwap T phi D.alpha0 + (C.gamma (D.gammaIndex d))) ∧ ( + ∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex + d)) f = phi f) ∧ {q : V ⊕ E | + ∃ (r : Fin ((D.initialPath d).length + (1 : ℕ))), (↑(D.v0Index d) : ℕ) ≤ (↑r : ℕ) ∧ + (D.initialPath d).getVert (↑r : ℕ) = q} = TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) ∧ Sum.inr (D.f0 d) ∈ TwoColorComponent G (OutsideTreeColorSwap T phi D.alpha0 + (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) ↔ v = D.v0 d) ∧ ( + ∀ (q : Fin T.length), Sum.inr (T.edge q) ∉ TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d))) ∧ + ∀ (f : E), Sum.inr f ∈ TwoColorComponent G (OutsideTreeColorSwap T phi D.alpha0 (C.gamma + (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) → + OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d)) f = some (C.gamma + (D.gammaIndex d)) ∨ OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d)) f = + some (↑d : Fin k) + +private theorem helper_hv0X_82.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; D.v0 d ∈ X := by + classical + intro V E _ _ _ G k e0 phi T C D d X + have hexit : ScheideExitVertex T phi (D.v0 d) := + (Finset.mem_filter.mp (D.v0_is_exit d)).2 + rcases hexit with + ⟨u, a, b, hu, ha, hb, z, q, hq, j, hj, hv, hlast⟩ + simpa [X] using hv + +private theorem helper_hdeltaPresent_99.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (d : ↥(DefectiveColors G + phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; ColoredVertexSetClosed G phi X → DefectiveColor G + phi X (↑d : Fin k) → + ∀ v ∈ X, (↑d : Fin k) ∈ PresentColors G phi v := by + classical + intro V E _ _ G k e0 phi T d X hclosed hdefective v hv + have hcard : 0 < (BoundaryColorEdges G phi X d.1).card := by + change 2 ≤ (BoundaryColorEdges G phi X d.1).card at hdefective + omega + obtain ⟨b, hb⟩ := Finset.card_pos.mp hcard + have hnot : d.1 ∉ MissingColors G phi v := by + intro hm + exact hclosed (Finset.mem_filter.mp hb).1 hv + (Finset.mem_filter.mp hb).2 hm + simpa [MissingColors] using hnot + +private theorem helper_hgammaDelta_118.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); D.v0 d ∈ X → ( + ∀ v ∈ X, (↑d : Fin k) ∈ PresentColors G phi v) → gamma ≠ (↑d : Fin k) := by + classical + intro V E _ _ _ G k e0 phi T C D d X gamma hv0X hdeltaPresent h + have hpresent := hdeltaPresent (D.v0 d) hv0X + have hm : d.1 ∈ MissingColors G phi (D.v0 d) := by + exact h ▸ (by simpa [gamma] using D.gamma_missing_at_v0 d) + have hnot : d.1 ∉ PresentColors G phi (D.v0 d) := by + simpa [MissingColors] using hm + exact hnot hpresent + +private theorem helper_ends_eq_of_mem_157.{u_1} : + open scoped Classical in + ∀ {V : Type u_1} {q : Sym2 V} {x y : V}, x ∈ q → y ∈ q → x ≠ y → q = s(x, y) := by + classical + intro V q x y hx hy hxy + induction q using Sym2.inductionOn with + | _ a b => + simp only [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> + simp_all [] + +private theorem helper_boundary_of_tree_incident_outside_165.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (e0 : E) + (T : TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet T; ( + ∀ {q : Sym2 V} {x y : V}, x ∈ q → y ∈ q → x ≠ y → q = s(x, y)) → + ∀ {e : E} {w : V}, TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X := by + classical + intro V E _ _ G e0 T X ends_eq_of_mem e w he hwout hwe + obtain ⟨x, hx, hxe⟩ := he + have hxX : x ∈ X := by simpa [X] using hx + have hxw : x ≠ w := by + intro h + exact hwout (h ▸ hxX) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxX, w, hwout, ends_eq_of_mem hxe hwe hxw⟩ + +private theorem helper_missing_no_incident_175.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k) {c : Fin k} {v : V} {e : E}, c ∈ MissingColors G phi v → + Incident G v e → phi e ≠ some c := by + classical + intro V E _ _ G k phi c v e hm hinc hc + let _ := Fintype.ofFinite V + have hp : c ∈ PresentColors G phi v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hinc, hc⟩ + have hnot : c ∉ PresentColors G phi v := by + simpa [MissingColors] using hm + exact hnot hp + +private theorem helper_continuation_357.{u_1, u_2} : + helperContinuation357Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T C D d X y0 gamma phi1 p i H0 H1 R K hproper hv0X hpathIs hsupport + hproper1 hone1 hstable1 hfixed hsucc hiOneLt hv0At hf0At missing_no_incident tail_vertex + old_adjacent_indices tail_step_new new_adj_old + have R_closed : ∀ {q r : Sum V E}, q ∈ R → H1.Adj q r → r ∈ R := by + intro q r hq hadj + have holdAdj := new_adj_old hq hadj + obtain ⟨n, hn, hget⟩ := hq + have hqOld : q ∈ TwoColorComponent G phi D.alpha0 d.1 (Sum.inl y0) := by + rw [← hsupport] + rw [← hget] + exact p.getVert_mem_support n.val + have hrOld : r ∈ TwoColorComponent G phi D.alpha0 d.1 (Sum.inl y0) := by + change H0.connectedComponentMk r = H0.connectedComponentMk (Sum.inl y0) + change H0.connectedComponentMk q = H0.connectedComponentMk (Sum.inl y0) at hqOld + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + holdAdj.symm).trans hqOld + have hrSupport : r ∈ p.support := by + have : r ∈ {x | x ∈ p.support} := by + rw [hsupport] + exact hrOld + exact this + obtain ⟨m, hmget, hml⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hrSupport + have hindices := old_adjacent_indices n.val m (Nat.le_of_lt_succ n.isLt) hml + (by simpa [H0, hget, hmget] using holdAdj) + rcases hindices with hforward | hback + · refine ⟨⟨m, Nat.lt_succ_of_le hml⟩, ?_, hmget⟩ + have him : i.val ≤ m := hn.trans (by omega) + exact him + · by_cases hm : i.val ≤ m + · exact ⟨⟨m, Nat.lt_succ_of_le hml⟩, hm, hmget⟩ + · have hnbase : n.val = i.val := by omega + have hmbase : m + 1 = i.val := by omega + have hqv : q = Sum.inl (D.v0 d) := by + rw [← hget, hnbase, hv0At] + cases hr : r with + | inl w => + have hbad : H1.Adj (Sum.inl (D.v0 d)) (Sum.inl w) := by + simpa [hqv, hr] using hadj + simp [H1, TwoColorIncidenceGraph] at hbad + | inr e => + have hbad : H1.Adj (Sum.inl (D.v0 d)) (Sum.inr e) := by + simpa [hqv, hr] using hadj + have hnew : Incident G (D.v0 d) e ∧ + (phi1 e = some gamma ∨ phi1 e = some d.1) := by + simpa [H1, TwoColorIncidenceGraph] using hbad + have heTree : TreeIncidentEdge T e := + ⟨D.v0 d, by simpa [X] using hv0X, hnew.1⟩ + have heOld : phi e = some d.1 := by + rcases hnew.2 with hg | hd + · have hgold : phi e = some gamma := (hfixed e heTree).symm.trans hg + exact False.elim ((missing_no_incident + (by simpa [gamma] using D.gamma_missing_at_v0 d) hnew.1) hgold) + · exact (hfixed e heTree).symm.trans hd + have hef : e ≠ D.f0 d := by + intro hef + have hnodes : p.getVert m = p.getVert (i.val + 1) := by + rw [hmget, hr, hef, hf0At] + have hidx := hpathIs.getVert_injOn hml (Nat.le_of_lt hiOneLt) hnodes + omega + exact False.elim ((hproper hef + ⟨D.v0 d, hnew.1, by simp [Incident, D.f0_ends d]⟩ heOld) + (D.f0_color d)) + have hcomponentTail : K ⊆ R := by + intro q hq + change H1.connectedComponentMk q = + H1.connectedComponentMk (Sum.inl (D.v0 d)) at hq + have hreach := SimpleGraph.ConnectedComponent.exact hq + obtain ⟨walk⟩ := hreach + have propagate : ∀ {a b : Sum V E}, H1.Walk a b → a ∈ R → b ∈ R := by + intro a b walk ha + induction walk with + | nil => exact ha + | @cons a c b hac rest ih => exact ih (R_closed ha hac) + have hv0R : Sum.inl (D.v0 d) ∈ R := by + exact ⟨i, le_rfl, hv0At⟩ + exact propagate walk.reverse hv0R + have htailComponent : R ⊆ K := by + intro q hq + obtain ⟨r, hir, hget⟩ := hq + have go : ∀ t : ℕ, i.val + t ≤ p.length → + H1.connectedComponentMk (p.getVert (i.val + t)) = + H1.connectedComponentMk (Sum.inl (D.v0 d)) := by + intro t ht + induction t with + | zero => simpa using congrArg H1.connectedComponentMk hv0At + | succ t ih => + have hprev : i.val + t ≤ p.length := by omega + have hadj := tail_step_new (i.val + t) (by omega) (by omega) + have hcc := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + exact hcc.symm.trans (ih hprev) + change H1.connectedComponentMk q = H1.connectedComponentMk (Sum.inl (D.v0 d)) + rw [← hget] + have heq : i.val + (r.val - i.val) = r.val := by omega + rw [← heq] + have hrle : r.val ≤ p.length := Nat.le_of_lt_succ r.isLt + exact go (r.val - i.val) (by omega) + have hRK : R = K := Set.Subset.antisymm htailComponent hcomponentTail + have hf0K : Sum.inr (D.f0 d) ∈ K := by + rw [← hRK] + exact ⟨D.f0Index d, by simp [i, hsucc.1], by simpa [p] using D.f0_at_index d⟩ + have hKtree : ∀ v : V, v ∈ X → + (Sum.inl v ∈ K ↔ v = D.v0 d) := by + intro v hv + constructor + · intro hvK + have hvR : Sum.inl v ∈ R := by rw [hRK]; exact hvK + obtain ⟨r, hir, hget⟩ := hvR + rcases tail_vertex hir hget with hbase | hout + · exact hbase.2 + · exact False.elim (hout.2 hv) + · rintro rfl + rw [← hRK] + exact ⟨i, le_rfl, hv0At⟩ + have htreeEdges : ∀ q : Fin T.length, Sum.inr (T.edge q) ∉ K := by + intro q hqK + have hqR : Sum.inr (T.edge q) ∈ R := by rw [hRK]; exact hqK + obtain ⟨r, hir, hget⟩ := hqR + have hrlt : r.val < p.length := by + by_contra hn + have hre : r.val = p.length := by omega + have hend : p.getVert r.val = Sum.inl (D.initialZ d) := by + simp [hre] + rw [hget] at hend + simp at hend + have hadj := p.adj_getVert_succ hrlt + rw [hget] at hadj + cases hnext : p.getVert (r.val + 1) with + | inr e => + rw [hnext] at hadj + simp [TwoColorIncidenceGraph] at hadj + | inl w => + rw [hnext] at hadj + have hwout : w ∉ X := by + have hir0 : (D.v0Index d).val ≤ r.val := by simpa [i] using hir + have hout := D.v0_is_last_tree_vertex d + ⟨r.val + 1, by + dsimp [p] at hrlt ⊢ + omega⟩ (by + change (D.v0Index d).val < r.val + 1 + omega) w (by simpa [p] using hnext) + simpa [X] using hout + have hwinc : Incident G w (T.edge q) := by + simpa [H0, TwoColorIncidenceGraph] using hadj.1 + obtain ⟨a, ha⟩ := T.attaches q + have hwend : w = T.vertex q.succ ∨ + w = T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))) := by + unfold Incident at hwinc + rw [ha] at hwinc + simpa using hwinc + rcases hwend with rfl | rfl <;> exact hwout (by simp [X, TreeSequenceVertexSet]) + have hKcolors : ∀ f : E, Sum.inr f ∈ K → + phi1 f = some gamma ∨ phi1 f = some d.1 := by + intro f hfK + have hfR : Sum.inr f ∈ R := by rw [hRK]; exact hfK + obtain ⟨r, hir, hget⟩ := hfR + have hstrict : i.val < r.val := by + by_contra hn + have hre : r.val = i.val := by omega + have : Sum.inr f = Sum.inl (D.v0 d) := by + rw [← hget, hre, hv0At] + simp at this + have hadj := tail_step_new (r.val - 1) (by omega) (by omega) + have hidx : r.val - 1 + 1 = r.val := by omega + rw [hidx, hget] at hadj + cases hprev : p.getVert (r.val - 1) with + | inr e => + rw [hprev] at hadj + simp [H1, TwoColorIncidenceGraph] at hadj + | inl w => + rw [hprev] at hadj + simpa [H1, TwoColorIncidenceGraph] using hadj.2 + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · simpa [phi1, gamma] using hproper1 + · simpa [phi1, gamma] using hone1 + · simpa [phi1, gamma] using hstable1 + · intro f hf + simpa [phi1, gamma] using hfixed f hf + · simpa [R, K, p, i, phi1, gamma] using hRK + · simpa [K, phi1, gamma] using hf0K + · intro v hv + simpa [K, X, phi1, gamma] using hKtree v (by simpa [X] using hv) + · intro q + simpa [K, phi1, gamma] using htreeEdges q + · intro f hf + simpa [K, phi1, gamma] using hKcolors f (by simpa [K, phi1, gamma] using hf) + +private theorem helper_continuation_351.{u_1, u_2} : + helperContinuation351Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T C D d X y0 gamma phi1 p i H0 H1 R K hproper hclosed hy0X hv0X + hpathIs hsupport halphaDelta hgammaDelta halphaGamma hproper1 hone1 hstable1 hfixed hsucc + hiOneLt hv0At hf0At boundary_of_tree_incident_outside missing_no_incident tail_vertex + adjacent_indices_forward + have old_adjacent_indices : ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → + H0.Adj (p.getVert n) (p.getVert m) → n + 1 = m ∨ m + 1 = n := by + intro n m hn hm hadj + have hne : n ≠ m := by + intro h + subst m + exact H0.loopless.irrefl _ hadj + rcases lt_or_gt_of_ne hne with hnm | hmn + · exact Or.inl (adjacent_indices_forward n m hn hm hnm hadj).symm + · exact Or.inr (adjacent_indices_forward m n hm hn hmn hadj.symm).symm + have outside_edge_effect : ∀ {w : V} {e : E}, w ∉ X → Incident G w e → + (phi e = some D.alpha0 ∨ phi e = some d.1) → + phi1 e = some gamma ∨ phi1 e = some d.1 := by + intro w e hwout hinc hold + by_cases hti : TreeIncidentEdge T e + · have hb := boundary_of_tree_incident_outside hti hwout hinc + have hnotAlpha : phi e ≠ some D.alpha0 := by + intro ha + exact (hclosed hb hy0X ha) (by simpa [y0] using D.alpha0_missing_at_y0) + have hd : phi e = some d.1 := hold.resolve_left hnotAlpha + exact Or.inr ((hfixed e hti).trans hd) + · rcases hold with ha | hd + · left + simp [phi1, OutsideTreeColorSwap, hti, ha] + · right + simp [phi1, OutsideTreeColorSwap, hti, hd, halphaDelta.symm, hgammaDelta.symm] + have tail_step_new : ∀ n : ℕ, i.val ≤ n → n < p.length → + H1.Adj (p.getVert n) (p.getVert (n + 1)) := by + intro n hin hnlt + have hold := p.adj_getVert_succ hnlt + cases hleft : p.getVert n with + | inl w => + cases hright : p.getVert (n + 1) with + | inl x => + rw [hleft, hright] at hold + simp [TwoColorIncidenceGraph] at hold + | inr e => + rw [hleft, hright] at hold + have hdata : Incident G w e ∧ + (phi e = some D.alpha0 ∨ phi e = some d.1) := by + simpa [H0, TwoColorIncidenceGraph] using hold + let rn : Fin (p.length + 1) := ⟨n, by omega⟩ + have htv := tail_vertex (r := rn) (w := w) (by simpa [rn] using hin) + (by simpa [rn] using hleft) + have hnew : phi1 e = some gamma ∨ phi1 e = some d.1 := by + rcases htv with hbase | hout + · have hnbase : n = i.val := hbase.1 + have heq : e = D.f0 d := by + apply Sum.inr.inj + rw [← hright, hnbase, hf0At] + subst e + right + apply (hfixed (D.f0 d) ?_).trans (D.f0_color d) + exact ⟨D.v0 d, by simpa [X] using hv0X, by simpa [hbase.2] using hdata.1⟩ + · exact outside_edge_effect hout.2 hdata.1 hdata.2 + simpa [H1, TwoColorIncidenceGraph] using And.intro hdata.1 hnew + | inr e => + cases hright : p.getVert (n + 1) with + | inr f => + rw [hleft, hright] at hold + simp [TwoColorIncidenceGraph] at hold + | inl w => + rw [hleft, hright] at hold + have hdata : Incident G w e ∧ + (phi e = some D.alpha0 ∨ phi e = some d.1) := by + simpa [H0, TwoColorIncidenceGraph] using hold + let rn : Fin (p.length + 1) := ⟨n + 1, by omega⟩ + have htv := tail_vertex (r := rn) (w := w) (by simp [rn]; omega) + (by simpa [rn] using hright) + have hwout : w ∉ X := by + rcases htv with hbase | hout + · simp [rn] at hbase + omega + · exact hout.2 + have hnew := outside_edge_effect hwout hdata.1 hdata.2 + simpa [H1, TwoColorIncidenceGraph] using And.intro hdata.1 hnew + have new_edge_old : ∀ {r : Fin (p.length + 1)} {w : V} {e : E}, + i.val ≤ r.val → p.getVert r.val = Sum.inl w → Incident G w e → + (phi1 e = some gamma ∨ phi1 e = some d.1) → + phi e = some D.alpha0 ∨ phi e = some d.1 := by + intro r w e hir hget hinc hnew + have htv := tail_vertex hir hget + by_cases hti : TreeIncidentEdge T e + · have hfix := hfixed e hti + rcases hnew with hg | hd + · have hgold : phi e = some gamma := hfix.symm.trans hg + rcases htv with hbase | hout + · exact False.elim ((missing_no_incident + (by simpa [gamma] using D.gamma_missing_at_v0 d) + (by simpa [hbase.2] using hinc)) hgold) + · have hb := boundary_of_tree_incident_outside hti hout.2 hinc + exact False.elim ((hclosed hb hv0X hgold) + (by simpa [gamma] using D.gamma_missing_at_v0 d)) + · exact Or.inr (hfix.symm.trans hd) + · rcases hnew with hg | hd + · by_cases ha : phi e = some D.alpha0 + · exact Or.inl ha + · by_cases hgc : phi e = some gamma + · have heq : some D.alpha0 = some gamma := by + simp [phi1, OutsideTreeColorSwap, hti, hgc, halphaGamma, halphaGamma.symm] at hg + exact False.elim (halphaGamma (Option.some.inj heq)) + · have : phi e = some gamma := by + simp [phi1, OutsideTreeColorSwap, hti, ha, hgc] at hg + exact False.elim (hgc this) + · by_cases ha : phi e = some D.alpha0 + · have heq : some gamma = some d.1 := by + simpa [phi1, OutsideTreeColorSwap, hti, ha] using hd + exact False.elim (hgammaDelta (Option.some.inj heq)) + · by_cases hgc : phi e = some gamma + · have heq : some D.alpha0 = some d.1 := by + simpa [phi1, OutsideTreeColorSwap, hti, ha, hgc, halphaGamma, + halphaGamma.symm] using hd + exact False.elim (halphaDelta (Option.some.inj heq)) + · exact Or.inr (by + simpa [phi1, OutsideTreeColorSwap, hti, ha, hgc] using hd) + have new_adj_old : ∀ {q r : Sum V E}, q ∈ R → H1.Adj q r → H0.Adj q r := by + intro q r hq hadj + obtain ⟨n, hn, hget⟩ := hq + cases q with + | inl w => + cases r with + | inl x => simp [H1, TwoColorIncidenceGraph] at hadj + | inr e => + have hnew : Incident G w e ∧ + (phi1 e = some gamma ∨ phi1 e = some d.1) := by + simpa [H1, TwoColorIncidenceGraph] using hadj + have hold := new_edge_old hn hget hnew.1 hnew.2 + simpa [H0, TwoColorIncidenceGraph] using And.intro hnew.1 hold + | inr e => + cases r with + | inr f => simp [H1, TwoColorIncidenceGraph] at hadj + | inl w => + have hn0 : 0 < n.val := by + by_contra hz + have hz0 : n.val = 0 := by omega + rw [hz0] at hget + have : Sum.inr e = Sum.inl y0 := by simpa [p, y0] using hget.symm + simp at this + have hprev := p.adj_getVert_succ (i := n.val - 1) (by omega) + have hidx : n.val - 1 + 1 = n.val := by omega + rw [hidx, hget] at hprev + cases hprevNode : p.getVert (n.val - 1) with + | inr f => + rw [hprevNode] at hprev + simp [TwoColorIncidenceGraph] at hprev + | inl x => + rw [hprevNode] at hprev + have hold : phi e = some D.alpha0 ∨ phi e = some d.1 := by + simpa [H0, TwoColorIncidenceGraph] using hprev.2 + have hinc : Incident G w e := by + simpa [H1, TwoColorIncidenceGraph] using hadj.1 + simpa [H0, TwoColorIncidenceGraph] using And.intro hinc hold + exact @helper_continuation_357 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@C) (@D) (@d) (@hproper) (@hv0X) (@hpathIs) (@hsupport) (@hproper1) + (@hone1) (@hstable1) (@hfixed) (@hsucc) (@hiOneLt) (@hv0At) (@hf0At) (@missing_no_incident) + (@tail_vertex) (@old_adjacent_indices) (@tail_step_new) (@new_adj_old) +private theorem helper_continuation_826.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let y0 : V := C.y (⟨(0 : ℕ), + by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive T + have := C.p_ge_two + all_goals omega) + ⟩ : Fin C.p); + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let p : (TwoColorIncidenceGraph G phi D.alpha0 (↑d : Fin k)).Walk (Sum.inl (C.y (⟨(0 : ℕ), + by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive T + have := C.p_ge_two + all_goals omega) + ⟩ : Fin C.p))) (Sum.inl (D.initialZ d)) := D.initialPath d; + let i : Fin ((D.initialPath d).length + (1 : ℕ)) := D.v0Index d; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi D.alpha0 (↑d : Fin k); + ∀ (_ : IsProperEdgeColoring G phi) (_ : ColoredVertexSetClosed G phi X) (_ : y0 ∈ X) (_ : D.v0 + d ∈ X) (_ : p.IsPath) (_ : {q : V ⊕ E | q ∈ p.support} = TwoColorComponent G phi D.alpha0 + (↑d : Fin k) (Sum.inl y0)) (_ : D.alpha0 ≠ (↑d : Fin k)) (_ : gamma ≠ (↑d : Fin k)) (_ : + D.alpha0 ≠ gamma) (_ : IsProperEdgeColoring G phi1) (_ : IsOneEdgeUncolored phi1 e0) (_ : + StableColoring T ∅ phi phi1) (_ : + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) (_ : (↑(D.f0Index d) : ℕ) = (↑(D.v0Index d) + : ℕ) + (1 : ℕ) ∧ (↑(D.u0Index d) : ℕ) = (↑(D.v0Index d) : ℕ) + (2 : ℕ)) (_ : (↑i : ℕ) + (1 + : ℕ) < p.length) (_ : p.getVert (↑i : ℕ) = Sum.inl (D.v0 d)) (_ : p.getVert ((↑i : ℕ) + (1 + : ℕ)) = Sum.inr (D.f0 d)) (_ : + ∀ {e : E} {w : V}, TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X) (_ : + ∀ {c : Fin k} {v : V} {e : E}, c ∈ MissingColors G phi v → Incident G v e → phi e ≠ some c) (_ + : + ∀ {r : Fin (p.length + (1 : ℕ))} {w : V}, (↑i : ℕ) ≤ (↑r : ℕ) → p.getVert (↑r : ℕ) = Sum.inl w + → (↑r : ℕ) = (↑i : ℕ) ∧ w = D.v0 d ∨ (↑i : ℕ) < (↑r : ℕ) ∧ w ∉ X), IsProperEdgeColoring G + (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) ∧ IsOneEdgeUncolored + (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) e0 ∧ StableColoring T ∅ + phi (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) ∧ ( + ∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex + d)) f = phi f) ∧ {q : V ⊕ E | + ∃ (r : Fin ((D.initialPath d).length + (1 : ℕ))), (↑(D.v0Index d) : ℕ) ≤ (↑r : ℕ) ∧ + (D.initialPath d).getVert (↑r : ℕ) = q} = TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) ∧ Sum.inr (D.f0 d) ∈ TwoColorComponent G (OutsideTreeColorSwap T phi D.alpha0 + (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) ↔ v = D.v0 d) ∧ ( + ∀ (q : Fin T.length), Sum.inr (T.edge q) ∉ TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d))) ∧ + ∀ (f : E), Sum.inr f ∈ TwoColorComponent G (OutsideTreeColorSwap T phi D.alpha0 (C.gamma + (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) → + OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d)) f = some (C.gamma + (D.gammaIndex d)) ∨ OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d)) f = + some (↑d : Fin k) := by + classical + intro V E _ _ _ G k e0 phi T C D d X y0 gamma phi1 p i H0 hproper hclosed hy0X hv0X hpathIs + hsupport halphaDelta hgammaDelta halphaGamma hproper1 hone1 hstable1 hfixed hsucc hiOneLt + hv0At hf0At boundary_of_tree_incident_outside missing_no_incident tail_vertex + have hy0Degree : @SimpleGraph.degree _ H0 (Sum.inl y0) + (Fintype.ofFinite _) ≤ 1 := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro a ha b hb + simp only [SimpleGraph.mem_neighborFinset] at ha hb + cases a with + | inl a => simp [H0, TwoColorIncidenceGraph] at ha + | inr e => + cases b with + | inl b => simp [H0, TwoColorIncidenceGraph] at hb + | inr f => + simp only [H0, TwoColorIncidenceGraph] at ha hb + have hea : phi e = some d.1 := ha.2.resolve_left + (missing_no_incident D.alpha0_missing_at_y0 ha.1) + have hfa : phi f = some d.1 := hb.2.resolve_left + (missing_no_incident D.alpha0_missing_at_y0 hb.1) + by_cases hef : e = f + · exact congrArg Sum.inr hef + · exact False.elim ((hproper hef ⟨y0, ha.1, hb.1⟩ hea) hfa) + have adjacent_indices_forward : ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → + n < m → H0.Adj (p.getVert n) (p.getVert m) → m = n + 1 := by + intro n m hn hm hnm hadj + by_contra hne + have hgap : n + 1 < m := by omega + by_cases hn0 : n = 0 + · subst n + have hfirstAdj := p.adj_getVert_succ (by omega : 0 < p.length) + have hstart : p.getVert 0 = Sum.inl y0 := by simp [p, y0] + have hneigh : p.getVert 1 ≠ p.getVert m := by + intro heq + have := hpathIs.getVert_injOn (show 1 ≤ p.length by omega) hm heq + omega + have htwo : 2 ≤ (@SimpleGraph.neighborFinset (Sum V E) H0 (Sum.inl y0) + (Fintype.ofFinite _)).card := by + have hs : ({p.getVert 1, p.getVert m} : Finset (Sum V E)) ⊆ + @SimpleGraph.neighborFinset (Sum V E) H0 (Sum.inl y0) + (Fintype.ofFinite _) := by + intro q hq + simp only [Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset, H0, hstart] using hfirstAdj + · simpa [SimpleGraph.mem_neighborFinset, H0, hstart] using hadj + have hc : ({p.getVert 1, p.getVert m} : Finset (Sum V E)).card = 2 := by + simp [hneigh] + rw [← hc] + exact Finset.card_le_card hs + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hy0Degree + omega + · have hnlt : n < p.length := by omega + have hleft : H0.Adj (p.getVert n) (p.getVert (n - 1)) := by + have h := p.adj_getVert_succ (i := n - 1) (by omega) + have heq : n - 1 + 1 = n := by omega + simpa [H0, heq] using h.symm + have hright : H0.Adj (p.getVert n) (p.getVert (n + 1)) := by + simpa [H0] using p.adj_getVert_succ hnlt + have hnm1 : p.getVert (n - 1) ≠ p.getVert (n + 1) := by + intro heq + have := hpathIs.getVert_injOn (Nat.sub_le n 1 |>.trans hn) + (Nat.succ_le_of_lt hnlt) heq + omega + have hnm2 : p.getVert (n - 1) ≠ p.getVert m := by + intro heq + have := hpathIs.getVert_injOn (Nat.sub_le n 1 |>.trans hn) hm heq + omega + have hnm3 : p.getVert (n + 1) ≠ p.getVert m := by + intro heq + have := hpathIs.getVert_injOn (Nat.succ_le_of_lt hnlt) hm heq + omega + have hthree : 3 ≤ (@SimpleGraph.neighborFinset (Sum V E) H0 (p.getVert n) + (Fintype.ofFinite _)).card := by + let S : Finset (Sum V E) := + {p.getVert (n - 1), p.getVert (n + 1), p.getVert m} + have hs : S ⊆ @SimpleGraph.neighborFinset (Sum V E) H0 (p.getVert n) + (Fintype.ofFinite _) := by + intro q hq + simp only [S, Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + · simpa [SimpleGraph.mem_neighborFinset] using hadj + have hc : S.card = 3 := by + simp [S, hnm1, hnm2, hnm3] + rw [← hc] + exact Finset.card_le_card hs + have hdeg := TwoColorIncidenceDegreeAtMostTwo G phi D.alpha0 d.1 hproper + (p.getVert n) + change @SimpleGraph.degree _ H0 (p.getVert n) (Fintype.ofFinite _) ≤ 2 at hdeg + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hdeg + omega + exact @helper_continuation_351 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@C) (@D) (@d) (@hproper) (@hclosed) (@hy0X) (@hv0X) (@hpathIs) + (@hsupport) (@halphaDelta) (@hgammaDelta) (@halphaGamma) (@hproper1) (@hone1) (@hstable1) + (@hfixed) (@hsucc) (@hiOneLt) (@hv0At) (@hf0At) (@boundary_of_tree_incident_outside) + (@missing_no_incident) (@tail_vertex) (@adjacent_indices_forward) + +theorem ScheideDefectiveTerminalComponent {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) : + let gamma := C.gamma (D.gammaIndex d) + let phi1 := OutsideTreeColorSwap T phi D.alpha0 gamma + let K := TwoColorComponent G phi1 gamma d.1 (Sum.inl (D.v0 d)) + IsProperEdgeColoring G phi1 ∧ IsOneEdgeUncolored phi1 e0 ∧ + StableColoring T ∅ phi phi1 ∧ + (∀ f : E, TreeIncidentEdge T f → phi1 f = phi f) ∧ + {q | ∃ r : Fin ((D.initialPath d).length + 1), + (D.v0Index d).val ≤ r.val ∧ (D.initialPath d).getVert r.val = q} = K ∧ + Sum.inr (D.f0 d) ∈ K ∧ + (∀ v : V, v ∈ TreeSequenceVertexSet T → + (Sum.inl v ∈ K ↔ v = D.v0 d)) ∧ + (∀ q : Fin T.length, Sum.inr (T.edge q) ∉ K) ∧ + ∀ f : E, Sum.inr f ∈ K → + phi1 f = some gamma ∨ phi1 f = some d.1 := by + classical + dsimp only + let X := TreeSequenceVertexSet T + let y0 := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + let gamma := C.gamma (D.gammaIndex d) + let phi1 := OutsideTreeColorSwap T phi D.alpha0 gamma + let p := D.initialPath d + let i := D.v0Index d + let H0 := TwoColorIncidenceGraph G phi D.alpha0 d.1 + let H1 := TwoColorIncidenceGraph G phi1 gamma d.1 + let R : Set (Sum V E) := {q | ∃ r : Fin (p.length + 1), + i.val ≤ r.val ∧ p.getVert r.val = q} + let K := TwoColorComponent G phi1 gamma d.1 (Sum.inl (D.v0 d)) + have hproper : IsProperEdgeColoring G phi := C.globally_maximum.1.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := C.globally_maximum.1.2.2.2.2 + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hclosed0 : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + horder.2.2.2.2 + have hclosed : ColoredVertexSetClosed G phi X := by + exact hclosed0 + have hy0X : y0 ∈ X := by + dsimp [y0, X] + rw [← C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩] + simp [TreeSequenceVertexSet] + have hv0X := @helper_hv0X_82 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@C) (@D) (@d) + have hpath : ScheideDefectiveChainPath T phi D.alpha0 d.1 + y0 (D.initialZ d) p := by + simpa [y0, p] using D.initial_path_full d + have hpathIs : p.IsPath := hpath.2.1 + have hsupport : {q | q ∈ p.support} = + TwoColorComponent G phi D.alpha0 d.1 (Sum.inl y0) := hpath.2.2.2 + have hdefective : DefectiveColor G phi X d.1 := by + have hd := d.2 + change d.1 ∈ (Finset.univ.filter fun delta => + DefectiveColor G phi X delta) at hd + exact (Finset.mem_filter.mp hd).2 + have hdeltaPresent := @helper_hdeltaPresent_99 (@V) (@E) inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@d) (@hclosed) (@hdefective) + have halphaDelta : D.alpha0 ≠ d.1 := by + intro h + have hpresent := hdeltaPresent y0 hy0X + have hm : d.1 ∈ MissingColors G phi y0 := by + simpa [y0] using (h ▸ D.alpha0_missing_at_y0) + have hnot : d.1 ∉ PresentColors G phi y0 := by + simpa [MissingColors] using hm + exact hnot hpresent + have hgammaDelta := @helper_hgammaDelta_118 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hv0X) (@hdeltaPresent) + have halphaGamma : D.alpha0 ≠ gamma := by + simpa [gamma] using D.alpha0_not_block (D.gammaIndex d) + have halphaTree : D.alpha0 ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨y0, by simpa [X] using hy0X, by simpa [y0] using D.alpha0_missing_at_y0⟩ + have hgammaTree : gamma ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨D.v0 d, by simpa [X] using hv0X, + by simpa [gamma] using D.gamma_missing_at_v0 d⟩ + have hswap := OutsideTreeColorSwapStable T ∅ phi D.alpha0 gamma + hproper hone hclosed0 halphaTree hgammaTree halphaGamma + have hproper1 : IsProperEdgeColoring G phi1 := by + simpa [phi1] using hswap.1 + have hone1 : IsOneEdgeUncolored phi1 e0 := by + simpa [phi1] using hswap.2.1 + have hstable1 : StableColoring T ∅ phi phi1 := by + simpa [phi1] using hswap.2.2.1 + have hfixed : ∀ f, TreeIncidentEdge T f → phi1 f = phi f := by + intro f hf + simpa [phi1] using hswap.2.2.2 f hf + have hsucc := D.successive_indices d + have hiTwo : i.val + 2 < p.length + 1 := by + dsimp [i, p] + rw [← hsucc.2] + exact (D.u0Index d).isLt + have hiOneLt : i.val + 1 < p.length := by omega + have hv0At : p.getVert i.val = Sum.inl (D.v0 d) := by + simpa [p, i] using D.v0_at_index d + have hf0At : p.getVert (i.val + 1) = Sum.inr (D.f0 d) := by + rw [← hsucc.1] + simpa [p] using D.f0_at_index d + have ends_eq_of_mem := @helper_ends_eq_of_mem_157 (@V) + have boundary_of_tree_incident_outside := @helper_boundary_of_tree_incident_outside_165 (@V) (@E) + inferInstance inferInstance (@G) (@e0) (@T) (@ends_eq_of_mem) + have missing_no_incident := @helper_missing_no_incident_175 (@V) (@E) inferInstance inferInstance + (@G) (@k) (@phi) + have tail_vertex : ∀ {r : Fin (p.length + 1)} {w : V}, i.val ≤ r.val → + p.getVert r.val = Sum.inl w → + (r.val = i.val ∧ w = D.v0 d) ∨ (i.val < r.val ∧ w ∉ X) := by + intro r w hir hget + by_cases hri : r.val = i.val + · left + refine ⟨hri, ?_⟩ + apply Sum.inl.inj + rw [← hget, hri, hv0At] + · right + have hlt : i.val < r.val := by omega + refine ⟨hlt, ?_⟩ + simpa [X, p, i] using D.v0_is_last_tree_vertex d r hlt w (by simpa [p] using hget) + exact @helper_continuation_826 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@C) (@D) (@d) (@hproper) (@hclosed) (@hy0X) (@hv0X) (@hpathIs) + (@hsupport) (@halphaDelta) (@hgammaDelta) (@halphaGamma) (@hproper1) (@hone1) (@hstable1) + (@hfixed) (@hsucc) (@hiOneLt) (@hv0At) (@hf0At) (@boundary_of_tree_incident_outside) + (@missing_no_incident) (@tail_vertex) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean new file mode 100644 index 0000000000..fda172bed9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean @@ -0,0 +1,1367 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveDeletedTreePair +public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross +public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData +public import LeanPool.GoldbergSeymour.ScheideDefectiveSecondTerminalComponent +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveTerminalComponent +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +public import LeanPool.GoldbergSeymour.TashkinovOrderBound + +/-! +# Scheide Defective Third Boundary Edge + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private abbrev helperContinuation1024Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let K : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let KJ : Set (V ⊕ E) := TwoColorComponent G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) (Sum.inl + R.v1); + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ + (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T) → ( + ∀ (r : Fin C.s) (b : Fin (2 : ℕ)), C.blockVertex r b ∈ X) → ( + ∀ (a : Fin C.p), C.y a ∈ Z) → C.blockVertex j (0 : Fin (2 : ℕ)) ≠ C.blockVertex j (1 : Fin (2 + : ℕ)) → blocks ⊆ X → R.v1 ∈ Z → + ∀ (f2 : E), f2 ≠ D.f0 d → f2 ≠ R.f1 → phi f2 = some (↑d : Fin k) → + ∀ z2 ∈ Z, + ∀ u2 ∉ Z, G.ends f2 = s(z2, u2) → z2 ∈ X → z2 ≠ D.v0 d → z2 ≠ R.v1 → u2 ≠ D.u0 d → u2 ≠ R.u1 → + ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G (OutsideTreeColorSwap T phi + D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) ↔ v = D.v0 d) → IsProperEdgeColoring G (OutsideTreeColorSwap T phi (C.gamma + (D.gammaIndex d)) (C.gamma R.blockIndex)) → StableColoring T ∅ phi (OutsideTreeColorSwap T + phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) → ( + ∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) + (C.gamma R.blockIndex) f = phi f) → ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G (OutsideTreeColorSwap T phi + (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) + (Sum.inl R.v1) ↔ v = R.v1) → IsProperEdgeColoring G (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) → IsOneEdgeUncolored (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) e0 → (↑d : Fin k) ∈ MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) R.v1 → + TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) (D.f0 d) = some (↑d : + Fin k) → phi1 f2 = some (↑d : Fin k) → psi1 f2 = some (↑d : Fin k) → ( + ∀ {v : V} {e : E}, Sum.inr e ∈ K → Incident G v e → phi1 e = some gamma ∨ phi1 e = some (↑d : + Fin k) → Sum.inl v ∈ K) → ( + ∀ {v : V} {e : E}, Sum.inr e ∈ KJ → Incident G v e → psi1 e = some gammaJ ∨ psi1 e = some (↑d + : Fin k) → Sum.inl v ∈ KJ) → + ∃ (f2 : E) (z2 : V) (u2 : V), phi f2 = some (↑d : Fin k) ∧ G.ends f2 = s(z2, u2) ∧ z2 ∈ + TreeSequenceVertexSet T \ ({C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ {C.blockVertex R.blockIndex (0 : Fin + (2 : ℕ)), C.blockVertex R.blockIndex (1 : Fin (2 : ℕ))}) ∧ u2 ∉ TreeSequenceVertexSet T ∧ + f2 ≠ D.f0 d ∧ f2 ≠ R.f1 ∧ z2 ≠ D.v0 d ∧ z2 ≠ R.v1 ∧ TwoColorComponentSwap G + (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f2 = some (↑d : Fin k) ∧ TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) f2 = some (↑d : Fin k) ∧ u2 ≠ D.u0 d ∧ u2 ≠ R.u1 + +private theorem helper_tashkinov_adjoin_589.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (_ : + ScheideDefectiveReturnData G k e0 phi T C D d) (rho : PartialEdgeColoring E k) (S U : + TreeSequence G e0) (f : E), TreeSequenceAdjoinEdge S f U → TashkinovTree G e0 rho S → + ∀ (c : Fin k), rho f = some c → + ∀ v ∈ TreeSequenceVertexSet S, c ∈ MissingColors G rho v → TashkinovTree G e0 rho U := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R rho S U f hadjoin hS c hf v hv hmiss + rcases hadjoin with ⟨hlen, hinitial, hlast⟩ + rcases hinitial with ⟨hle, hvert, hedge⟩ + intro q hq + by_cases hold : q.val < S.length + · let qS : Fin S.length := ⟨q.val, hold⟩ + obtain ⟨a, color, hcolor, hcolorMissing⟩ := + hS qS (by simpa [qS] using hq) + let aU : Fin (q.val + 1) := ⟨a.val, by simpa [qS] using a.isLt⟩ + refine ⟨aU, color, ?_, ?_⟩ + · have hqeq : Fin.castLE hle qS = q := by + apply Fin.ext + rfl + have hUedge : U.edge q = S.edge qS := by + rw [← hqeq] + exact hedge qS + rw [hUedge] + exact hcolor + · let oldVertexIndex : Fin (S.length + 1) := + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ qS.isLt)) + let newVertexIndex : Fin (U.length + 1) := + Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) oldVertexIndex = + newVertexIndex := by + apply Fin.ext + rfl + have hvertex : U.vertex newVertexIndex = S.vertex oldVertexIndex := by + rw [← hindex] + exact hvert oldVertexIndex + simpa [oldVertexIndex, newVertexIndex] using + hvertex.symm ▸ hcolorMissing + · have hqval : q.val = S.length := by + have hqbound : q.val < S.length + 1 := by simpa [hlen] using q.isLt + omega + obtain ⟨a, ha⟩ : ∃ a : Fin (S.length + 1), S.vertex a = v := by + simpa [TreeSequenceVertexSet] using hv + let aU : Fin (q.val + 1) := ⟨a.val, by simpa [hqval] using a.isLt⟩ + refine ⟨aU, c, ?_, ?_⟩ + · have hqlast : q = Fin.cast hlen.symm (Fin.last S.length) := by + apply Fin.ext + simpa using hqval + rw [hqlast, hlast] + exact hf + · let newVertexIndex : Fin (U.length + 1) := + Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) a = + newVertexIndex := by + apply Fin.ext + rfl + have hvertex : U.vertex newVertexIndex = v := by + rw [← hindex, hvert a, ha] + simpa [newVertexIndex, hvertex] using hmiss + +private theorem helper_adjoin_vertex_set_647.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) (e0 : E) (A0 A1 : + TreeSequence G e0) (f : E) (x y : V), G.ends f = s(x, y) → y ∉ TreeSequenceVertexSet A0 → + TreeSequenceAdjoinEdge A0 f A1 → TreeSequenceVertexSet A1 = insert y + (TreeSequenceVertexSet A0) := by + classical + intro V E _ G e0 A0 A1 f x y hxy hyA hAA + rcases hAA with ⟨hlen, hinit, hlast⟩ + rcases hinit with ⟨hle, hvertices, hedges⟩ + have holdSubset : TreeSequenceVertexSet A0 ⊆ TreeSequenceVertexSet A1 := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨q, hq⟩ := hv + refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ + rw [hvertices] + exact hq + have hyB : y ∈ TreeSequenceVertexSet A1 := by + let q : Fin A1.length := Fin.cast hlen.symm (Fin.last A0.length) + obtain ⟨a, ha⟩ := A1.attaches q + have hyEnds : y ∈ G.ends (A1.edge q) := by + rw [hlast, hxy] + simp + rw [ha] at hyEnds + rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨q.succ, hynew.symm⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.castLT a (Nat.lt_trans a.isLt + (Nat.succ_lt_succ q.isLt)), hyold.symm⟩ + have hinsert : insert y (TreeSequenceVertexSet A0) ⊆ + TreeSequenceVertexSet A1 := by + intro v hv + simp only [Finset.mem_insert] at hv + rcases hv with rfl | hv + · exact hyB + · exact holdSubset hv + have hAcard : (TreeSequenceVertexSet A0).card = A0.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + A0.vertex_injective] + have hBcard : (TreeSequenceVertexSet A1).card = A1.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + A1.vertex_injective] + have hcard : (TreeSequenceVertexSet A1).card ≤ + (insert y (TreeSequenceVertexSet A0)).card := by + rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] + exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm + +private theorem helper_hfinalVertices_391.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; + ∀ (f2 : E) (z2 u2 : V), u2 ∉ Z → G.ends f2 = s(z2, u2) → u2 ≠ D.u0 d → u2 ≠ R.u1 → u2 ∉ Ui → + u2 ∈ Uj → + ∀ (SgammaJ : TreeSequence G e0), TreeSequenceVertexSet SgammaJ = TreeSequenceVertexSet T \ + {C.blockVertex R.blockIndex (0 : Fin (2 : ℕ)), C.blockVertex R.blockIndex (1 : Fin (2 : + ℕ))} ∪ {D.u0 d} → u2 ∉ TreeSequenceVertexSet SgammaJ → + ∀ (Splus : TreeSequence G e0), TreeSequenceVertexSet Splus = insert u2 (TreeSequenceVertexSet + SgammaJ) → + ∀ (g : E), + ∀ w2 ∈ Uj, w2 ≠ u2 → Uj = { u2, w2 } → G.ends g = s(u2, w2) → u2 ∈ X → w2 ∈ X → w2 ≠ D.u0 d → + w2 ∉ TreeSequenceVertexSet SgammaJ → w2 ∉ TreeSequenceVertexSet Splus → + ∀ (Splusplus : TreeSequence G e0), TreeSequenceVertexSet Splusplus = insert w2 + (TreeSequenceVertexSet Splus) → TreeSequenceVertexSet Splusplus = insert (D.u0 d) X := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j Ui Uj blocks Z f2 z2 u2 hu2Z hf2ends hu2u0 hu2u1 + hu2Ui hu2Uj SgammaJ hSgammaJVertices hu2NotS Splus hSplusVertices g w2 hw2Uj hw2ne hUjPair + hgends' hu2X hw2X hw2u0 hw2NotS hw2NotSplus Splusplus hSplusplusVertices + rw [hSplusplusVertices, hSplusVertices, hSgammaJVertices] + have hUjPair' : + ({C.blockVertex R.blockIndex 0, + C.blockVertex R.blockIndex 1} : Finset V) = {u2, w2} := by + simpa [Uj, j] using hUjPair + rw [hUjPair'] + ext v + simp only [Finset.mem_insert, Finset.mem_union, Finset.mem_sdiff, + Finset.mem_singleton] + constructor + · rintro (rfl | rfl | (⟨hvX, hneU⟩ | rfl)) + · exact Or.inr hw2X + · exact Or.inr hu2X + · exact Or.inr hvX + · exact Or.inl rfl + · rintro (rfl | hvX) + · exact Or.inr (Or.inr (Or.inr rfl)) + · by_cases hvu : v = u2 + · exact Or.inr (Or.inl hvu) + · by_cases hvw : v = w2 + · exact Or.inl hvw + · exact Or.inr (Or.inr (Or.inl ⟨hvX, by simp [hvu, hvw]⟩)) + +private theorem helper_continuation_430.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let psi2 : PartialEdgeColoring E k := TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) + (Sum.inl R.v1); + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ + (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T) → blocks ⊆ X → + ∀ (f2 : E) (z2 u2 : V), u2 ∉ Z → G.ends f2 = s(z2, u2) → u2 ≠ D.u0 d → u2 ≠ R.u1 → + IsProperEdgeColoring G (TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma + (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl + R.v1)) → IsOneEdgeUncolored (TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma + (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl + R.v1)) e0 → u2 ∉ Ui → ( + ∀ (rho : PartialEdgeColoring E k) (S U : TreeSequence G e0) (f : E), TreeSequenceAdjoinEdge S + f U → TashkinovTree G e0 rho S → + ∀ (c : Fin k), rho f = some c → + ∀ v ∈ TreeSequenceVertexSet S, c ∈ MissingColors G rho v → TashkinovTree G e0 rho U) → ( + ∀ (A0 A1 : TreeSequence G e0) (f : E) (x y : V), G.ends f = s(x, y) → x ∈ + TreeSequenceVertexSet A0 → y ∉ TreeSequenceVertexSet A0 → TreeSequenceAdjoinEdge A0 f A1 → + TreeSequenceVertexSet A1 = insert y (TreeSequenceVertexSet A0)) → u2 ∈ Uj → + ∀ (SgammaJ : TreeSequence G e0), TreeSequenceVertexSet SgammaJ = TreeSequenceVertexSet T \ + {C.blockVertex R.blockIndex (0 : Fin (2 : ℕ)), C.blockVertex R.blockIndex (1 : Fin (2 : + ℕ))} ∪ {D.u0 d} → u2 ∉ TreeSequenceVertexSet SgammaJ → + ∀ (Splus : TreeSequence G e0), TashkinovTree G e0 psi2 Splus → TreeSequenceVertexSet Splus = + insert u2 (TreeSequenceVertexSet SgammaJ) → + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + ∀ (g : E), psi2 g = some D.alpha0 → D.alpha0 ∈ MissingColors G psi2 y0 → y0 ∈ + TreeSequenceVertexSet Splus → + ∀ w2 ∈ Uj, w2 ≠ u2 → Uj = { u2, w2 } → G.ends g = s(u2, w2) → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ psi1 psi2 Ui Uj blocks Z horder + hblocksSub f2 z2 u2 hu2Z hf2ends hu2u0 hu2u1 hproperJ2 honeJ2 hu2Ui tashkinov_adjoin + adjoin_vertex_set hu2Uj SgammaJ hSgammaJVertices hu2NotS Splus hSplusTash hSplusVertices y0 + g hpsi2g hy0MissingPsi2 hy0Splus w2 hw2Uj hw2ne hUjPair hgends' + have hu2X : u2 ∈ X := hblocksSub + (Finset.mem_union.mpr (Or.inr hu2Uj)) + have hw2X : w2 ∈ X := hblocksSub + (Finset.mem_union.mpr (Or.inr hw2Uj)) + have hw2u0 : w2 ≠ D.u0 d := by + intro h + exact D.u0_outside d (h ▸ hw2X) + have hw2NotS : w2 ∉ TreeSequenceVertexSet SgammaJ := by + rw [hSgammaJVertices] + intro hw + rcases Finset.mem_union.mp hw with hwOld | hw0 + · exact (Finset.mem_sdiff.mp hwOld).2 + (by simpa [Uj, j] using hw2Uj) + · exact hw2u0 (by simpa using hw0) + have hw2NotSplus : w2 ∉ TreeSequenceVertexSet Splus := by + rw [hSplusVertices] + simp [hw2ne, hw2NotS] + have hgBoundary : g ∈ BoundaryEdges G (TreeSequenceVertexSet Splus) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u2, by simp [hSplusVertices], w2, hw2NotSplus, hgends'⟩ + obtain ⟨Splusplus, hSplusplus⟩ := + TreeSequenceBoundaryEdgeAppendExists Splus g hgBoundary + have hSplusplusTash : TashkinovTree G e0 psi2 Splusplus := + tashkinov_adjoin psi2 Splus Splusplus g hSplusplus hSplusTash + D.alpha0 hpsi2g y0 hy0Splus hy0MissingPsi2 + have hSplusplusVertices : TreeSequenceVertexSet Splusplus = + insert w2 (TreeSequenceVertexSet Splus) := + adjoin_vertex_set Splus Splusplus g u2 w2 hgends' + (by simp [hSplusVertices]) hw2NotSplus hSplusplus + have hfinalVertices := @helper_hfinalVertices_391 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R f2 z2 u2 hu2Z hf2ends hu2u0 hu2u1 hu2Ui hu2Uj SgammaJ + hSgammaJVertices hu2NotS Splus hSplusVertices g w2 hw2Uj hw2ne hUjPair hgends' hu2X hw2X hw2u0 + hw2NotS hw2NotSplus Splusplus hSplusplusVertices + have hK2 : KTriple G k e0 psi2 := + ⟨C.globally_maximum.1.1, C.globally_maximum.1.2.1, + C.globally_maximum.1.2.2.1, hproperJ2, honeJ2⟩ + have hle := treeCard_le_tashkinovOrder G k e0 psi2 Splusplus hK2 hSplusplusTash + rw [hfinalVertices, Finset.card_insert_of_notMem (D.u0_outside d), + horder.1] at hle + exact (Nat.not_succ_le_self X.card) hle + +private theorem helper_hu2Uj_695.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let _ : Set (V ⊕ E) := TwoColorComponent G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let psi2 : PartialEdgeColoring E k := TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) + (Sum.inl R.v1); + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ + (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T) → ( + ∀ (r : Fin C.s) (b : Fin (2 : ℕ)), C.blockVertex r b ∈ X) → ( + ∀ (a : Fin C.p), C.y a ∈ Z) → C.blockVertex j (0 : Fin (2 : ℕ)) ≠ C.blockVertex j (1 : Fin (2 + : ℕ)) → blocks ⊆ X → R.v1 ∈ Z → + ∀ (f2 : E), + ∀ z2 ∈ Z, + ∀ u2 ∉ Z, G.ends f2 = s(z2, u2) → z2 ∈ X → u2 ≠ D.u0 d → u2 ≠ R.u1 → IsProperEdgeColoring G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) → + StableColoring T ∅ phi (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) → ( + ∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) + (C.gamma R.blockIndex) f = phi f) → IsProperEdgeColoring G (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) → IsOneEdgeUncolored (TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) e0 → (↑d : Fin k) ∈ MissingColors G + (TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1)) R.v1 → + TwoColorComponentSwap G (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma + R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) (D.f0 d) = some (↑d : + Fin k) → psi2 f2 = some (↑d : Fin k) → u2 ∉ Ui → ( + ∀ (rho : PartialEdgeColoring E k) (S U : TreeSequence G e0) (f : E), TreeSequenceAdjoinEdge S + f U → TashkinovTree G e0 rho S → + ∀ (c : Fin k), rho f = some c → + ∀ v ∈ TreeSequenceVertexSet S, c ∈ MissingColors G rho v → TashkinovTree G e0 rho U) → ( + ∀ (A0 A1 : TreeSequence G e0) (f : E) (x y : V), G.ends f = s(x, y) → x ∈ + TreeSequenceVertexSet A0 → y ∉ TreeSequenceVertexSet A0 → TreeSequenceAdjoinEdge A0 f A1 → + TreeSequenceVertexSet A1 = insert y (TreeSequenceVertexSet A0)) → u2 ∉ Uj := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ psi1 KJ psi2 Ui Uj blocks Z horder + block_mem_X base_mem_Z hj01 hblocksSub hv1Z f2 z2 hz2Z u2 hu2Z hf2ends hz2X hu2u0 hu2u1 + hproperJ1 hstableJ1 hfixedJ1 hproperJ2 honeJ2 hdeltaMissingJ2 hf0colorJ2 hpsi2f2 hu2Ui + tashkinov_adjoin adjoin_vertex_set hu2Uj + have hpairs := ScheideDefectiveDeletedTreePair G k e0 phi T C D d R + dsimp only at hpairs + rcases hpairs with + ⟨Sgamma, SgammaJ, hSgammaTash, hSgammaVertices, + hSgammaJTash, hSgammaJVertices, hf1color2, hf0colorJ2⟩ + have hz2NotUj : z2 ∉ Uj := by + intro hz2Uj + exact (Finset.mem_sdiff.mp hz2Z).2 + (Finset.mem_union.mpr (Or.inr hz2Uj)) + have hz2S : z2 ∈ TreeSequenceVertexSet SgammaJ := by + rw [hSgammaJVertices] + exact Finset.mem_union.mpr + (Or.inl (Finset.mem_sdiff.mpr ⟨hz2X, by simpa [Uj, j] using hz2NotUj⟩)) + have hu2NotS : u2 ∉ TreeSequenceVertexSet SgammaJ := by + rw [hSgammaJVertices] + intro hu + rcases Finset.mem_union.mp hu with huOld | hu0 + · exact (Finset.mem_sdiff.mp huOld).2 + (by simpa [Uj, j] using hu2Uj) + · exact hu2u0 (by simpa using hu0) + have hf2BoundaryS : f2 ∈ BoundaryEdges G + (TreeSequenceVertexSet SgammaJ) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨z2, hz2S, u2, hu2NotS, hf2ends⟩ + obtain ⟨Splus, hSplus⟩ := + TreeSequenceBoundaryEdgeAppendExists SgammaJ f2 hf2BoundaryS + have hSplusTash : TashkinovTree G e0 psi2 Splus := + tashkinov_adjoin psi2 SgammaJ Splus f2 hSplus hSgammaJTash d.1 + hpsi2f2 R.v1 (by + rw [hSgammaJVertices] + exact Finset.mem_union.mpr (Or.inl + (Finset.mem_sdiff.mpr ⟨(Finset.mem_sdiff.mp hv1Z).1, + by + intro hv1Uj + exact (Finset.mem_sdiff.mp hv1Z).2 + (Finset.mem_union.mpr (Or.inr (by simpa [Uj, j] using hv1Uj)))⟩))) + hdeltaMissingJ2 + have hSplusVertices : TreeSequenceVertexSet Splus = + insert u2 (TreeSequenceVertexSet SgammaJ) := + adjoin_vertex_set SgammaJ Splus f2 z2 u2 hf2ends hz2S hu2NotS hSplus + let y0 := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hy0Z : y0 ∈ Z := by + exact base_mem_Z ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hy0X : y0 ∈ X := (Finset.mem_sdiff.mp hy0Z).1 + have hy0NotUj : y0 ∉ Uj := by + intro hy0Uj + exact (Finset.mem_sdiff.mp hy0Z).2 + (Finset.mem_union.mpr (Or.inr hy0Uj)) + obtain ⟨g, hgcolor, hgends⟩ := + ScheideStructuralInternalPair G k e0 phi T C j D.alpha0 + (by simpa [gammaJ, j] using R.alpha0_ne_gammaJ) + ⟨y0, by + apply Finset.mem_sdiff.mpr + exact ⟨hy0X, by simpa [Uj, j] using hy0NotUj⟩, + by simpa [y0] using D.alpha0_missing_at_y0⟩ + have hpsi1g : psi1 g = some D.alpha0 := by + apply (hfixedJ1 g ?_).trans hgcolor + exact ⟨C.blockVertex j 0, block_mem_X j 0, + by simp [Incident, hgends]⟩ + have hpsi2g : psi2 g = some D.alpha0 := by + by_cases hgK : Sum.inr g ∈ KJ + · have halphaGamma : D.alpha0 ≠ gammaJ := by + simpa [gammaJ, j] using R.alpha0_ne_gammaJ + simp [psi2, TwoColorComponentSwap, KJ, hgK, hpsi1g, + halphaGamma, R.alpha0_ne_delta] + · simp [psi2, TwoColorComponentSwap, KJ, hgK, hpsi1g] + have hbehaviorJ := TwoColorComponentSwapMissingBehavior G psi1 gammaJ d.1 + (by simpa [gammaJ, j] using R.gammaJ_ne_delta) hproperJ1 + (Sum.inl R.v1) + have hy0MissingPsi1 : D.alpha0 ∈ MissingColors G psi1 y0 := by + rw [hstableJ1.2 y0 hy0X] + simpa [y0] using D.alpha0_missing_at_y0 + have hy0MissingPsi2 : D.alpha0 ∈ MissingColors G psi2 y0 := by + exact (hbehaviorJ.2.2.2 y0 D.alpha0 + (by simpa [gammaJ, j] using R.alpha0_ne_gammaJ) + R.alpha0_ne_delta).mpr hy0MissingPsi1 + have hy0Splus : y0 ∈ TreeSequenceVertexSet Splus := by + rw [hSplusVertices, hSgammaJVertices] + exact Finset.mem_insert_of_mem (Finset.mem_union.mpr + (Or.inl (Finset.mem_sdiff.mpr + ⟨hy0X, by simpa [Uj, j] using hy0NotUj⟩))) + obtain ⟨w2, hw2Uj, hw2ne, hUjPair, hgends'⟩ : + ∃ w2 : V, w2 ∈ Uj ∧ w2 ≠ u2 ∧ Uj = {u2, w2} ∧ + G.ends g = s(u2, w2) := by + simp only [Uj, Finset.mem_insert, Finset.mem_singleton] at hu2Uj + rcases hu2Uj with hu2j0 | hu2j1 + · refine ⟨C.blockVertex j 1, by simp [Uj], ?_, ?_, ?_⟩ + · intro h + exact hj01 (hu2j0.symm.trans h.symm) + · simp [Uj, hu2j0] + · simpa [hu2j0] using hgends + · refine ⟨C.blockVertex j 0, by simp [Uj], ?_, ?_, ?_⟩ + · intro h + exact hj01 (h.trans hu2j1) + · simp [Uj, hu2j1, Finset.pair_comm] + · rw [hu2j1] + exact hgends.trans Sym2.eq_swap + exact @helper_continuation_430 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R horder hblocksSub f2 z2 u2 hu2Z hf2ends hu2u0 hu2u1 hproperJ2 honeJ2 hu2Ui + tashkinov_adjoin adjoin_vertex_set hu2Uj SgammaJ hSgammaJVertices hu2NotS Splus hSplusTash + hSplusVertices g hpsi2g hy0MissingPsi2 hy0Splus w2 hw2Uj hw2ne hUjPair hgends' +private theorem helper_block_vertex_injective_478.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T), + T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → + Function.Injective fun (q : Fin C.s × Fin (2 : ℕ)) ↦ C.blockVertex q.1 q.2 := by + classical + intro V E _ _ _ G k e0 phi T C hlength a b hab + let qa : Fin (T.length + 1) := + ⟨C.p + 2 * a.1.val + a.2.val, by + have ha1 := a.1.isLt + have ha2 := a.2.isLt + omega⟩ + let qb : Fin (T.length + 1) := + ⟨C.p + 2 * b.1.val + b.2.val, by + have hb1 := b.1.isLt + have hb2 := b.2.isLt + omega⟩ + have hv : T.vertex qa = T.vertex qb := by + rw [show T.vertex qa = C.blockVertex a.1 a.2 by + simpa [qa] using C.block_vertex_position a.1 a.2] + rw [show T.vertex qb = C.blockVertex b.1 b.2 by + simpa [qb] using C.block_vertex_position b.1 b.2] + exact hab + have hq := congrArg Fin.val (T.vertex_injective hv) + apply Prod.ext + · apply Fin.ext + dsimp [qa, qb] at hq + have ha2 := a.2.isLt + have hb2 := b.2.isLt + omega + · apply Fin.ext + dsimp [qa, qb] at hq + have ha2 := a.2.isLt + have hb2 := b.2.isLt + omega + +private theorem helper_base_ne_block_526.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T), + T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → + ∀ (a : Fin C.p) (r : Fin C.s) (b : Fin (2 : ℕ)), + C.y a ≠ C.blockVertex r b := by + classical + intro V E _ _ _ G k e0 phi T C hlength a r b h + let qa : Fin (T.length + 1) := ⟨a.val, by + have ha := a.isLt + have hr := r.isLt + have hb := b.isLt + omega⟩ + let qb : Fin (T.length + 1) := + ⟨C.p + 2 * r.val + b.val, by + have hr := r.isLt + have hb := b.isLt + omega⟩ + have hv : T.vertex qa = T.vertex qb := by + rw [show T.vertex qa = C.y a by + simpa [qa] using C.base_vertex_position a] + rw [show T.vertex qb = C.blockVertex r b by + simpa [qb] using C.block_vertex_position r b] + exact h + have hq := congrArg Fin.val (T.vertex_injective hv) + have ha := a.isLt + dsimp [qa, qb] at hq + omega + +private theorem helper_hgood_union_640.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; + let edges : Finset E := {e : E | phi e = some (↑d : Fin k)}; + let good : Finset E := {e ∈ edges | + ∀ (v : V), Incident G v e → v ∈ Z}; ( + ∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ)) → ( + ∀ ⦃e : E⦄, e ∈ good → + ∀ ⦃f : E⦄, f ∈ good → e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset) → + (good.biUnion fun (e : E) ↦ (G.ends e).toFinset).card = (2 : ℕ) * good.card := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j Ui Uj blocks Z edges good hendcard hgood_disjoint + as_aux_lemma => + have aux : ∀ s : Finset E, s ⊆ good → + (s.biUnion fun e => (G.ends e).toFinset).card = 2 * s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset + (s.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + have hh := hgood_disjoint (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf)) + exact (Finset.disjoint_left.mp hh) hev hvf + rw [Finset.card_union_of_disjoint hd, hendcard] + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem hes] + omega + exact aux good (by intro e he; exact he) + +private theorem helper_hgood_cover_665.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; + let B : Finset E := BoundaryColorEdges G phi Z (↑d : Fin k); + let edges : Finset E := {e : E | phi e = some (↑d : Fin k)}; + let good : Finset E := {e ∈ edges | + ∀ (v : V), Incident G v e → v ∈ Z}; ( + ∀ v ∈ Z, (↑d : Fin k) ∈ PresentColors G phi v) → ( + ∀ (e : E), e ∈ edges ↔ phi e = some (↑d : Fin k)) → ( + ∀ (e : E), e ∈ good ↔ e ∈ edges ∧ + ∀ (v : V), Incident G v e → v ∈ Z) → + ∀ v ∈ Z, (v ∈ good.biUnion fun (e : E) ↦ (G.ends e).toFinset) ∨ v ∈ B.biUnion fun (e : E) ↦ + {v ∈ Z | Incident G v e} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j Ui Uj blocks Z B edges good hpresent hedge_mem hgood + as_aux_lemma => + intro v hv + obtain ⟨e, he, hve⟩ := by + simpa [PresentColors] using hpresent v hv + by_cases hall : ∀ w, Incident G w e → w ∈ Z + · left + exact Finset.mem_biUnion.mpr + ⟨e, (hgood e).mpr ⟨(hedge_mem e).mpr hve, hall⟩, + Sym2.mem_toFinset.mpr he⟩ + · right + push Not at hall + obtain ⟨w, hw, hwo⟩ := hall + obtain ⟨z, hze⟩ := Sym2.mem_iff_exists.mp hw + have heq : G.ends e = s(w, z) := hze + have hzZ : z ∈ Z := by + have hvEnds : v = w ∨ v = z := by + have : v ∈ s(w, z) := by rw [← heq]; exact he + simpa using this + rcases hvEnds with rfl | rfl + · exact False.elim (hwo hv) + · exact hv + have hbound : e ∈ BoundaryEdges G Z := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨z, hzZ, w, hwo, heq.trans Sym2.eq_swap⟩ + exact Finset.mem_biUnion.mpr ⟨e, + (Finset.mem_filter.mpr ⟨hbound, hve⟩), + Finset.mem_filter.mpr ⟨hv, he⟩⟩ + +private theorem helper_hb_union_724.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; + let B : Finset E := BoundaryColorEdges G phi Z (↑d : Fin k); ( + ∀ e ∈ B, {v ∈ Z | Incident G v e}.card = (1 : ℕ)) → ( + ∀ ⦃e : E⦄, e ∈ B → + ∀ ⦃f : E⦄, f ∈ B → e ≠ f → Disjoint ({v ∈ Z | Incident G v e}) ({v ∈ Z | Incident G v f})) → + (B.biUnion fun (e : E) ↦ {v ∈ Z | Incident G v e}).card = B.card := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j Ui Uj blocks Z B hb_fiber hb_disjoint + as_aux_lemma => + have aux : + ∀ s : Finset E, s ⊆ B → (s.biUnion fun e => Z.filter (fun v => Incident G v e)).card = s.card + := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (Z.filter (fun v => Incident G v e)) + (s.biUnion fun f => Z.filter (fun v => Incident G v f)) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + exact (Finset.disjoint_left.mp + (hb_disjoint (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf)))) hev hvf + rw [Finset.card_union_of_disjoint hd, + hb_fiber e (hs (Finset.mem_insert_self e s))] + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem hes] + exact Nat.add_comm 1 s.card + exact aux B (by intro e he; exact he) + +private theorem helper_hb_fiber_855.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; + let B : Finset E := BoundaryColorEdges G phi Z (↑d : Fin k); + ∀ e ∈ B, {v ∈ Z | Incident G v e}.card = (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j Ui Uj blocks Z B + as_aux_lemma => + intro e he + obtain ⟨u, hu, v, hv, huv⟩ := by + simpa [B, BoundaryColorEdges, BoundaryEdges] using + (Finset.mem_filter.mp he).1 + have hs : Z.filter (fun x => Incident G x e) = {u} := by + ext x + simp only [Finset.mem_filter, Finset.mem_singleton, Incident, + huv, Sym2.mem_iff] + constructor + · rintro ⟨hx, rfl | hxe⟩ + · exact rfl + · exact False.elim (hv (hxe ▸ hx)) + · intro hxu + subst hxu + exact ⟨hu, Or.inl rfl⟩ + rw [hs] + simp + +private theorem helper_hAW_898.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; IsProperEdgeColoring G phi → + let B : Finset E := BoundaryColorEdges G phi Z (↑d : Fin k); + let edges : Finset E := {e : E | phi e = some (↑d : Fin k)}; + let good : Finset E := {e ∈ edges | + ∀ (v : V), Incident G v e → v ∈ Z}; ( + ∀ (e : E), e ∈ edges ↔ phi e = some (↑d : Fin k)) → ( + ∀ (e : E), e ∈ good ↔ e ∈ edges ∧ + ∀ (v : V), Incident G v e → v ∈ Z) → + let A : Finset V := good.biUnion fun (e : E) ↦ (G.ends e).toFinset; + let W : Finset V := B.biUnion fun (e : E) ↦ {v ∈ Z | Incident G v e}; Disjoint A W := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j Ui Uj blocks Z hproper B edges good hedge_mem + hgood A W + as_aux_lemma => + rw [Finset.disjoint_left] + intro v hvA hvW + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hvA + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvW + have hef : e ≠ f := by + intro hef + subst hef + obtain ⟨u, hu, w, hw, huw⟩ := by + simpa [B, BoundaryColorEdges, BoundaryEdges] using + (Finset.mem_filter.mp hf).1 + have : w ∈ Z := (hgood e).mp he |>.2 w + (by change w ∈ G.ends e; rw [huw]; simp) + exact hw this + exact (hproper hef ⟨v, Sym2.mem_toFinset.mp hve, + (Finset.mem_filter.mp hvf).2⟩ + ((hedge_mem e).mp ((hgood e).mp he).1)) + (Finset.mem_filter.mp hf).2 + +private theorem helper_hextra_974.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; + let B : Finset E := BoundaryColorEdges G phi Z (↑d : Fin k); D.f0 d ≠ R.f1 → (3 : ℕ) ≤ B.card + → + ∃ f ∈ B, f ≠ D.f0 d ∧ f ≠ R.f1 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j Ui Uj blocks Z B hf01 hBthree + by_contra h + push Not at h + have hsub : B ⊆ {D.f0 d, R.f1} := by + intro f hf + by_cases hfd : f = D.f0 d + · simp [hfd] + · have hfr : f = R.f1 := h f hf hfd + simp [hfr] + have hc := Finset.card_le_card hsub + have hp : ({D.f0 d, R.f1} : Finset E).card = 2 := by simp [hf01] + rw [hp] at hc + omega + +private theorem helper_continuation_1024.{u_1, u_2} : + helperContinuation1024Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ phi1 K phi2 psi1 KJ psi2 Ui Uj blocks + Z horder block_mem_X base_mem_Z hj01 hblocksSub hv1Z f2 hf2f0 hf2f1 hf2color z2 hz2Z u2 + hu2Z hf2ends hz2X hz2v0 hz2v1 hu2u0 hu2u1 hKtree hproperJ1 hstableJ1 hfixedJ1 hKJtree + hproperJ2 honeJ2 hdeltaMissingJ2 hf0colorJ2 hphi1f2 hpsi1f2 component_vertex_of_edge + componentJ_vertex_of_edge + have hf2NotK : Sum.inr f2 ∉ K := by + intro hf2K + have hz2K := component_vertex_of_edge hf2K + (show Incident G z2 f2 by simp [Incident, hf2ends]) + (Or.inr hphi1f2) + exact hz2v0 ((hKtree z2 hz2X).mp hz2K) + have hf2NotKJ : Sum.inr f2 ∉ KJ := by + intro hf2K + have hz2K := componentJ_vertex_of_edge hf2K + (show Incident G z2 f2 by simp [Incident, hf2ends]) + (Or.inr hpsi1f2) + exact hz2v1 ((hKJtree z2 hz2X).mp hz2K) + have hphi2f2 : phi2 f2 = some d.1 := by + simp [phi2, TwoColorComponentSwap, K, hf2NotK, hphi1f2] + have hpsi2f2 : psi2 f2 = some d.1 := by + simp [psi2, TwoColorComponentSwap, KJ, hf2NotKJ, hpsi1f2] + have hu2Ui : u2 ∉ Ui := by + intro hu2Ui + have hno := ScheideDefectiveNoCross G k e0 phi T C D d f2 hf2color + apply hno + refine ⟨u2, hu2Ui, by simp [Incident, hf2ends], z2, ?_, ?_⟩ + · apply Finset.mem_sdiff.mpr + refine ⟨hz2X, ?_⟩ + intro hz2Ui + exact (Finset.mem_sdiff.mp hz2Z).2 + (Finset.mem_union.mpr (Or.inl hz2Ui)) + · simp [Incident, hf2ends] + have tashkinov_adjoin := @helper_tashkinov_adjoin_589 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D d R + have adjoin_vertex_set (A0 A1 : TreeSequence G e0) (f : E) (x y : V) + (hxy : G.ends f = s(x, y)) (hxA : x ∈ TreeSequenceVertexSet A0) + (hyA : y ∉ TreeSequenceVertexSet A0) + (hAA : TreeSequenceAdjoinEdge A0 f A1) : + TreeSequenceVertexSet A1 = insert y (TreeSequenceVertexSet A0) := by + exact @helper_adjoin_vertex_set_647 V E inferInstance G e0 A0 A1 f x y hxy hyA hAA + have hu2Uj := @helper_hu2Uj_695 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R horder block_mem_X base_mem_Z hj01 hblocksSub hv1Z f2 z2 hz2Z u2 hu2Z hf2ends + hz2X hu2u0 hu2u1 hproperJ1 hstableJ1 hfixedJ1 hproperJ2 honeJ2 hdeltaMissingJ2 hf0colorJ2 + hpsi2f2 hu2Ui tashkinov_adjoin adjoin_vertex_set + have hu2X : u2 ∉ X := by + intro hu2X + have huBlocks : u2 ∈ blocks := by + by_contra huBlocks + exact hu2Z (Finset.mem_sdiff.mpr ⟨hu2X, huBlocks⟩) + rcases Finset.mem_union.mp huBlocks with huUi | huUj + · exact hu2Ui huUi + · exact hu2Uj huUj + have hz2Target : z2 ∈ TreeSequenceVertexSet T \ + ({C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} ∪ + {C.blockVertex R.blockIndex 0, + C.blockVertex R.blockIndex 1}) := by + apply Finset.mem_sdiff.mpr + refine ⟨by simpa [X] using hz2X, ?_⟩ + intro hzblocks + exact (Finset.mem_sdiff.mp hz2Z).2 + (by simpa [blocks, Ui, Uj, i, j] using hzblocks) + exact ⟨f2, z2, u2, hf2color, hf2ends, hz2Target, + by simpa [X] using hu2X, hf2f0, hf2f1, hz2v0, hz2v1, + hphi2f2, hpsi2f2, hu2u0, hu2u1⟩ + +private theorem helper_continuation_1022.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let _ : Set (V ⊕ E) := TwoColorComponent G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) (Sum.inl + R.v1); + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; IsProperEdgeColoring G phi → TashkinovOrder G = + (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd + (TreeSequenceVertexSet T).card ∧ ColoredVertexSetElementary G phi (TreeSequenceVertexSet + T) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) → ( + ∀ (r : Fin C.s) (b : Fin (2 : ℕ)), C.blockVertex r b ∈ X) → ( + ∀ (a : Fin C.p), C.y a ∈ Z) → C.blockVertex j (0 : Fin (2 : ℕ)) ≠ C.blockVertex j (1 : Fin (2 + : ℕ)) → blocks ⊆ X → + let B : Finset E := BoundaryColorEdges G phi Z (↑d : Fin k); Odd B.card → D.v0 d ∈ Z → R.v1 ∈ + Z → + ∃ (f2 : E) (z2 : V) (u2 : V), phi f2 = some (↑d : Fin k) ∧ G.ends f2 = s(z2, u2) ∧ z2 ∈ + TreeSequenceVertexSet T \ ({C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ {C.blockVertex R.blockIndex (0 : Fin + (2 : ℕ)), C.blockVertex R.blockIndex (1 : Fin (2 : ℕ))}) ∧ u2 ∉ TreeSequenceVertexSet T ∧ + f2 ≠ D.f0 d ∧ f2 ≠ R.f1 ∧ z2 ≠ D.v0 d ∧ z2 ≠ R.v1 ∧ TwoColorComponentSwap G + (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f2 = some (↑d : Fin k) ∧ TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) f2 = some (↑d : Fin k) ∧ u2 ≠ D.u0 d ∧ u2 ≠ R.u1 + := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ phi1 K phi2 psi1 KJ psi2 Ui Uj blocks + Z hproper horder block_mem_X base_mem_Z hj01 hblocksSub B hBodd hv0Z hv1Z + have hf0B : D.f0 d ∈ B := by + apply Finset.mem_filter.mpr + refine ⟨?_, D.f0_color d⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨D.v0 d, hv0Z, D.u0 d, + fun h => D.u0_outside d (Finset.mem_sdiff.mp h).1, D.f0_ends d⟩ + have hf1B : R.f1 ∈ B := by + apply Finset.mem_filter.mpr + refine ⟨?_, R.f1_color⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨R.v1, hv1Z, R.u1, + fun h => R.u1_outside (Finset.mem_sdiff.mp h).1, R.f1_ends⟩ + have hf01 : D.f0 d ≠ R.f1 := by + intro h + have hends : s(D.v0 d, D.u0 d) = s(R.v1, R.u1) := by + rw [← D.f0_ends d, h, R.f1_ends] + rcases Sym2.eq_iff.mp hends with hs | hs + · exact R.v1_ne_v0 hs.1.symm + · exact R.u1_outside (hs.1 ▸ (Finset.mem_sdiff.mp hv0Z).1) + have hBtwo : 2 ≤ B.card := by + have hsub : ({D.f0 d, R.f1} : Finset E) ⊆ B := by + intro f hf + simp only [Finset.mem_insert, Finset.mem_singleton] at hf + rcases hf with rfl | rfl + · exact hf0B + · exact hf1B + have hc := Finset.card_le_card hsub + simpa [hf01] using hc + have hBthree : 3 ≤ B.card := by + rcases hBodd with ⟨q, hq⟩ + omega + have hextra := @helper_hextra_974 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R hf01 hBthree + obtain ⟨f2, hf2B, hf2f0, hf2f1⟩ := hextra + have hf2color : phi f2 = some d.1 := (Finset.mem_filter.mp hf2B).2 + have hf2boundary : f2 ∈ BoundaryEdges G Z := + (Finset.mem_filter.mp hf2B).1 + obtain ⟨z2, hz2Z, u2, hu2Z, hf2ends⟩ := by + simpa [BoundaryEdges] using hf2boundary + have hz2X : z2 ∈ X := (Finset.mem_sdiff.mp hz2Z).1 + have hz2v0 : z2 ≠ D.v0 d := by + intro h + exact hproper hf2f0 + ⟨z2, by simp [Incident, hf2ends], by simp [Incident, D.f0_ends d, h]⟩ + hf2color (D.f0_color d) + have hz2v1 : z2 ≠ R.v1 := by + intro h + exact hproper hf2f1 + ⟨z2, by simp [Incident, hf2ends], by simp [Incident, R.f1_ends, h]⟩ + hf2color R.f1_color + have hu2u0 : u2 ≠ D.u0 d := by + intro h + exact hproper hf2f0 + ⟨u2, by simp [Incident, hf2ends], by simp [Incident, D.f0_ends d, h]⟩ + hf2color (D.f0_color d) + have hu2u1 : u2 ≠ R.u1 := by + intro h + exact hproper hf2f1 + ⟨u2, by simp [Incident, hf2ends], by simp [Incident, R.f1_ends, h]⟩ + hf2color R.f1_color + have hterminal := ScheideDefectiveTerminalComponent G k e0 phi T C D d + dsimp only at hterminal + rcases hterminal with + ⟨hproper1, hone1, hstable1, hfixed1, htailK, hf0K, hKtree, + htreeEdgesOutside, hKcolors⟩ + have hterminalJ := + ScheideDefectiveSecondTerminalComponent G k e0 phi T C D d R + dsimp only at hterminalJ + rcases hterminalJ with + ⟨hproperJ1, honeJ1, hstableJ1, hfixedJ1, htailKJ, hf1KJ, hKJtree, + htreeEdgesOutsideJ, hf1colorJ1, hproperJ2, honeJ2, hdeltaMissingJ2, + hotherMissingJ2, hf0colorJ2⟩ + have hf2Incident : TreeIncidentEdge T f2 := + ⟨z2, hz2X, by simp [Incident, hf2ends]⟩ + have hphi1f2 : phi1 f2 = some d.1 := + (hfixed1 f2 hf2Incident).trans hf2color + have hpsi1f2 : psi1 f2 = some d.1 := + (hfixedJ1 f2 hf2Incident).trans hf2color + have component_vertex_of_edge {v : V} {e : E} + (heK : Sum.inr e ∈ K) (hve : Incident G v e) + (hecolor : phi1 e = some gamma ∨ phi1 e = some d.1) : + Sum.inl v ∈ K := by + let H := TwoColorIncidenceGraph G phi1 gamma d.1 + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using ⟨hve, hecolor⟩ + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk (Sum.inl (D.v0 d)) at heK + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inl (D.v0 d)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans heK + have componentJ_vertex_of_edge {v : V} {e : E} + (heK : Sum.inr e ∈ KJ) (hve : Incident G v e) + (hecolor : psi1 e = some gammaJ ∨ psi1 e = some d.1) : + Sum.inl v ∈ KJ := by + let H := TwoColorIncidenceGraph G psi1 gammaJ d.1 + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using ⟨hve, hecolor⟩ + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk (Sum.inl R.v1) at heK + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inl R.v1) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans heK + exact @helper_continuation_1024 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R horder block_mem_X base_mem_Z hj01 hblocksSub hv1Z f2 hf2f0 hf2f1 hf2color + z2 hz2Z u2 hu2Z hf2ends hz2X hz2v0 hz2v1 hu2u0 hu2u1 hKtree hproperJ1 hstableJ1 hfixedJ1 + hKJtree hproperJ2 honeJ2 hdeltaMissingJ2 hf0colorJ2 hphi1f2 hpsi1f2 + component_vertex_of_edge componentJ_vertex_of_edge +private theorem helper_continuation_919.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : + ScheideDefectiveReturnData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let j : Fin C.s := R.blockIndex; + let gamma : Fin k := C.gamma i; + let gammaJ : Fin k := C.gamma j; + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi D.alpha0 gamma; + let _ : Set (V ⊕ E) := TwoColorComponent G phi1 gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G phi1 gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let psi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi gamma gammaJ; + let _ : Set (V ⊕ E) := TwoColorComponent G psi1 gammaJ (↑d : Fin k) (Sum.inl R.v1); + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G psi1 gammaJ (↑d : Fin k) (Sum.inl + R.v1); + let Ui : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Uj : Finset V := {C.blockVertex j (0 : Fin (2 : ℕ)), C.blockVertex j (1 : Fin (2 : ℕ))}; + let blocks : Finset V := Ui ∪ Uj; + let Z : Finset V := X \ blocks; IsProperEdgeColoring G phi → TashkinovOrder G = + (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd + (TreeSequenceVertexSet T).card ∧ ColoredVertexSetElementary G phi (TreeSequenceVertexSet + T) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) → ColoredVertexSetClosed G phi + X → ( + ∀ (r : Fin C.s) (b : Fin (2 : ℕ)), C.blockVertex r b ∈ X) → ( + ∀ (a : Fin C.p), C.y a ∈ Z) → C.blockVertex j (0 : Fin (2 : ℕ)) ≠ C.blockVertex j (1 : Fin (2 + : ℕ)) → blocks ⊆ X → Z.card = X.card - (4 : ℕ) → Odd Z.card → + let _ : Finset E := BoundaryColorEdges G phi Z (↑d : Fin k); + let _ : Finset E := {e : E | phi e = some (↑d : Fin k)}; + ∃ (f2 : E) (z2 : V) (u2 : V), phi f2 = some (↑d : Fin k) ∧ G.ends f2 = s(z2, u2) ∧ z2 ∈ + TreeSequenceVertexSet T \ ({C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ {C.blockVertex R.blockIndex (0 : Fin + (2 : ℕ)), C.blockVertex R.blockIndex (1 : Fin (2 : ℕ))}) ∧ u2 ∉ TreeSequenceVertexSet T ∧ + f2 ≠ D.f0 d ∧ f2 ≠ R.f1 ∧ z2 ≠ D.v0 d ∧ z2 ≠ R.v1 ∧ TwoColorComponentSwap G + (OutsideTreeColorSwap T phi D.alpha0 (C.gamma (D.gammaIndex d))) (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f2 = some (↑d : Fin k) ∧ TwoColorComponentSwap G + (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma + R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) f2 = some (↑d : Fin k) ∧ u2 ≠ D.u0 d ∧ u2 ≠ R.u1 + := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X i j gamma gammaJ phi1 K phi2 psi1 KJ psi2 Ui Uj blocks + Z hproper horder hclosed block_mem_X base_mem_Z hj01 hblocksSub hZcard hZodd B edges + let good := edges.filter (fun e => ∀ v, Incident G v e → v ∈ Z) + have hdefective : 2 ≤ + (BoundaryColorEdges G phi X d.1).card := by + have hd := d.property + change d.1 ∈ (Finset.univ : Finset (Fin k)).filter + (fun alpha => DefectiveColor G phi X alpha) at hd + exact (Finset.mem_filter.mp hd).2 + have hpresent : ∀ v, v ∈ Z → d.1 ∈ PresentColors G phi v := by + intro v hvZ + have hBpos : 0 < (BoundaryColorEdges G phi X d.1).card := by + omega + obtain ⟨b, hb⟩ := Finset.card_pos.mp hBpos + have hbb : b ∈ BoundaryEdges G X := (Finset.mem_filter.mp hb).1 + have hbc : phi b = some d.1 := (Finset.mem_filter.mp hb).2 + have hn : d.1 ∉ MissingColors G phi v := by + exact hclosed hbb (Finset.mem_sdiff.mp hvZ).1 hbc + simpa [MissingColors] using hn + have hedge_mem : ∀ e, e ∈ edges ↔ phi e = some d.1 := by + intro e + simp [edges] + have hgood : ∀ e, e ∈ good ↔ + e ∈ edges ∧ ∀ v, Incident G v e → v ∈ Z := by + intro e + simp [good] + have hendcard : ∀ e : E, (G.ends e).toFinset.card = 2 := by + intro e + apply Sym2.card_toFinset_of_not_isDiag + intro hd + exact G.loopless e ((G.ends e).diagElem hd) + (Sym2.diag_diagElem hd).symm + have hgood_disjoint : ∀ ⦃e⦄, e ∈ good → ∀ ⦃f⦄, f ∈ good → + e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + exact (hproper hef + ⟨v, Sym2.mem_toFinset.mp hev, Sym2.mem_toFinset.mp hvf⟩ + ((hedge_mem e).mp ((hgood e).mp he).1)) + ((hedge_mem f).mp ((hgood f).mp hf).1) + have hgood_union := @helper_hgood_union_640 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R hendcard hgood_disjoint + have hgood_cover := @helper_hgood_cover_665 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R hpresent hedge_mem hgood + have hb_fiber := @helper_hb_fiber_855 V E inferInstance inferInstance inferInstance inferInstance + G k e0 phi T C D d R + have hb_disjoint : ∀ ⦃e⦄, e ∈ B → ∀ ⦃f⦄, f ∈ B → + e ≠ f → Disjoint (Z.filter (fun v => Incident G v e)) + (Z.filter (fun v => Incident G v f)) := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + exact (hproper hef ⟨v, (Finset.mem_filter.mp hev).2, + (Finset.mem_filter.mp hvf).2⟩ + (Finset.mem_filter.mp he).2) (Finset.mem_filter.mp hf).2 + have hb_union := @helper_hb_union_724 V E inferInstance inferInstance inferInstance inferInstance + G k e0 phi T C D d R hb_fiber hb_disjoint + let A := good.biUnion (fun e => (G.ends e).toFinset) + let W := B.biUnion (fun e => Z.filter (fun v => Incident G v e)) + have hA : A ⊆ Z := by + intro v hv + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hv + exact (hgood e).mp he |>.2 v (Sym2.mem_toFinset.mp hve) + have hW : W ⊆ Z := by + intro v hv + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hv + exact (Finset.mem_filter.mp hve).1 + have hAW := @helper_hAW_898 V E inferInstance inferInstance inferInstance inferInstance G k e0 phi + T C D d R hproper hedge_mem hgood + have hAZ : A ∪ W = Z := by + apply Finset.Subset.antisymm + · exact Finset.union_subset hA hW + · intro v hv + rcases hgood_cover v hv with hvA | hvB + · exact Finset.mem_union.mpr (Or.inl hvA) + · exact Finset.mem_union.mpr (Or.inr hvB) + have hcardeq : Z.card = 2 * good.card + B.card := by + rw [← hAZ, Finset.card_union_of_disjoint hAW, hgood_union, hb_union] + have hBodd : Odd B.card := by + rcases hZodd with ⟨q, hq⟩ + have hq' : Z.card = 2 * q + 1 := by exact hq + have hqgood : good.card ≤ q := by omega + refine ⟨q - good.card, ?_⟩ + omega + have hv0Z : D.v0 d ∈ Z := by + have hv0base := ScheideStructuralExitsInBase G k e0 phi T C + (D.v0_is_exit d) + obtain ⟨a, _, ha⟩ := Finset.mem_image.mp hv0base + rw [← ha] + exact base_mem_Z a + have hv1Z : R.v1 ∈ Z := by + obtain ⟨a, _, ha⟩ := Finset.mem_image.mp R.v1_in_base + rw [← ha] + exact base_mem_Z a + exact @helper_continuation_1022 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R hproper horder block_mem_X base_mem_Z hj01 hblocksSub hBodd hv0Z hv1Z +theorem ScheideDefectiveThirdBoundaryEdge {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideDefectiveReturnData G k e0 phi T C D d) : + let gamma := C.gamma (D.gammaIndex d) + let gammaJ := C.gamma R.blockIndex + let phi1 := OutsideTreeColorSwap T phi D.alpha0 gamma + let phi2 := TwoColorComponentSwap G phi1 gamma d.1 (Sum.inl (D.v0 d)) + let psi1 := OutsideTreeColorSwap T phi gamma gammaJ + let psi2 := TwoColorComponentSwap G psi1 gammaJ d.1 (Sum.inl R.v1) + let Z := + TreeSequenceVertexSet T \ + ({C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} ∪ + {C.blockVertex R.blockIndex 0, C.blockVertex R.blockIndex 1}) + ∃ f2 : E, + ∃ z2 u2 : V, + phi f2 = some d.1 ∧ + G.ends f2 = s(z2, u2) ∧ + z2 ∈ Z ∧ + u2 ∉ TreeSequenceVertexSet T ∧ + f2 ≠ D.f0 d ∧ + f2 ≠ R.f1 ∧ + z2 ≠ D.v0 d ∧ + z2 ≠ R.v1 ∧ + phi2 f2 = some d.1 ∧ psi2 f2 = some d.1 ∧ u2 ≠ D.u0 d ∧ u2 ≠ R.u1 := by + classical + dsimp only + let X := TreeSequenceVertexSet T + let i := D.gammaIndex d + let j := R.blockIndex + let gamma := C.gamma i + let gammaJ := C.gamma j + let phi1 := OutsideTreeColorSwap T phi D.alpha0 gamma + let K := TwoColorComponent G phi1 gamma d.1 (Sum.inl (D.v0 d)) + let phi2 := TwoColorComponentSwap G phi1 gamma d.1 (Sum.inl (D.v0 d)) + let psi1 := OutsideTreeColorSwap T phi gamma gammaJ + let KJ := TwoColorComponent G psi1 gammaJ d.1 (Sum.inl R.v1) + let psi2 := TwoColorComponentSwap G psi1 gammaJ d.1 (Sum.inl R.v1) + let Ui := ({C.blockVertex i 0, C.blockVertex i 1} : Finset V) + let Uj := ({C.blockVertex j 0, C.blockVertex j 1} : Finset V) + let blocks := Ui ∪ Uj + let Z := X \ blocks + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hclosed0 : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + horder.2.2.2.2 + have hclosed : ColoredVertexSetClosed G phi X := by + exact hclosed0 + have hlength := C.length_eq + have hij : i ≠ j := by + simpa [i, j] using R.blockIndex_ne.symm + have block_vertex_injective := @helper_block_vertex_injective_478 V E inferInstance inferInstance + inferInstance G k e0 phi T C hlength + have block_vertex_ne_of_index_ne (r s : Fin C.s) (b c : Fin 2) + (hrs : r ≠ s) : C.blockVertex r b ≠ C.blockVertex s c := by + intro h + have hp : (r, b) = (s, c) := block_vertex_injective h + exact hrs (congrArg Prod.fst hp) + have block_pair_ne (r : Fin C.s) : + C.blockVertex r 0 ≠ C.blockVertex r 1 := by + intro h + have hp : (r, (0 : Fin 2)) = (r, (1 : Fin 2)) := + block_vertex_injective h + have hs := congrArg (fun q => q.2.val) hp + simp at hs + have block_mem_X (r : Fin C.s) (b : Fin 2) : + C.blockVertex r b ∈ X := by + rw [← C.block_vertex_position r b] + simp [X, TreeSequenceVertexSet] + have base_ne_block := @helper_base_ne_block_526 V E inferInstance inferInstance inferInstance G k + e0 phi T C hlength + have base_mem_Z (a : Fin C.p) : C.y a ∈ Z := by + have haX : C.y a ∈ X := by + rw [← C.base_vertex_position a] + simp [X, TreeSequenceVertexSet] + apply Finset.mem_sdiff.mpr + refine ⟨haX, ?_⟩ + simp [blocks, Ui, Uj, base_ne_block] + have hi01 := block_pair_ne i + have hj01 := block_pair_ne j + have hi0j0 := block_vertex_ne_of_index_ne i j 0 0 hij + have hi0j1 := block_vertex_ne_of_index_ne i j 0 1 hij + have hi1j0 := block_vertex_ne_of_index_ne i j 1 0 hij + have hi1j1 := block_vertex_ne_of_index_ne i j 1 1 hij + have hUiCard : Ui.card = 2 := by simp [Ui, hi01] + have hUjCard : Uj.card = 2 := by simp [Uj, hj01] + have hUiUj : Disjoint Ui Uj := by + rw [Finset.disjoint_left] + intro v hvi hvj + simp only [Ui, Uj, Finset.mem_insert, Finset.mem_singleton] at hvi hvj + rcases hvi with rfl | rfl <;> rcases hvj with hvj | hvj + · exact hi0j0 hvj + · exact hi0j1 hvj + · exact hi1j0 hvj + · exact hi1j1 hvj + have hblocksCard : blocks.card = 4 := by + change (Ui ∪ Uj).card = 4 + rw [Finset.card_union_of_disjoint hUiUj, hUiCard, hUjCard] + have hblocksSub : blocks ⊆ X := by + intro v hv + simp only [blocks, Ui, Uj, Finset.mem_union, Finset.mem_insert, + Finset.mem_singleton] at hv + rcases hv with (rfl | rfl) | rfl | rfl + · exact block_mem_X i 0 + · exact block_mem_X i 1 + · exact block_mem_X j 0 + · exact block_mem_X j 1 + have hZcard : Z.card = X.card - 4 := by + change (X \ blocks).card = X.card - 4 + rw [Finset.card_sdiff, Finset.inter_eq_left.mpr hblocksSub, hblocksCard] + have hZodd : Odd Z.card := by + rcases horder.2.2.1 with ⟨q, hq⟩ + have hfour : 4 ≤ X.card := by + rw [← hblocksCard] + exact Finset.card_le_card hblocksSub + refine ⟨q - 2, ?_⟩ + rw [hZcard] + have hq' : X.card = 2 * q + 1 := by simpa [X] using hq + omega + let B := BoundaryColorEdges G phi Z d.1 + let edges := (Finset.univ : Finset E).filter (fun e => phi e = some d.1) + exact @helper_continuation_919 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R hproper horder hclosed block_mem_X base_mem_Z hj01 hblocksSub hZcard hZodd +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDeletedMissingReplacementInternal.lean b/LeanPool/GoldbergSeymour/ScheideDeletedMissingReplacementInternal.lean new file mode 100644 index 0000000000..e0223f70d3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDeletedMissingReplacementInternal.lean @@ -0,0 +1,955 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ClosedSetTwoColorComponentAvoidance + +public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal + +/-! +# Scheide Deleted Missing Replacement Internal + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_hTreeTheta_414.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let _ : Finset V := TreeSequenceVertexSet R.replacementTree; GlobalMaximumTriple G k e0 phiD + R.replacementTree → + let theta : PartialEdgeColoring E k := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl + R.u1); ( + ∀ v ∈ X, + ∀ (f : E), Incident G v f → theta f = phiD f) → ( + ∀ v ∈ X, MissingColors G theta v = MissingColors G phiD v) → ( + ∀ (j : Fin R.replacementTree.length), + ∃ v ∈ X, Incident G v (R.replacementTree.edge j)) → (IsProperEdgeColoring G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ + IsOneEdgeUncolored (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) e0 ∧ TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin + k) (Sum.inl (D.v0 d)) (D.f0 d) = some (C.gamma (D.gammaIndex d)) ∧ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (D.v0 d) = insert (↑d : Fin k) ((MissingColors G phi (D.v0 d)).erase (C.gamma + (D.gammaIndex d))) ∧ ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → ¬f = D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, ¬v = D.v0 d → MissingColors G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) ∧ + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) → TashkinovTree G e0 theta + R.replacementTree := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha X gamma phiD XD hReplacementGlobal theta + hThetaFixedAtX hMissingThetaFixed hReplacementEdgeIncidentX hEffect j hj + have hlen : R.replacementTree.length = T.length := R.replacement_length + by_cases hbefore : j.val + 2 < T.length + · obtain ⟨i, c, hedge, hmissing⟩ := hReplacementGlobal.2.1 j hj + obtain ⟨v, hvX, hvEdge⟩ := hReplacementEdgeIncidentX j + refine ⟨i, c, ?_, ?_⟩ + · exact (hThetaFixedAtX v hvX _ hvEdge).trans hedge + · let w := R.replacementTree.vertex + (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) + have hwXD : w ∈ XD := by + simp [w, XD, TreeSequenceVertexSet] + have hwX : w ∈ X := by + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] at hwXD + rcases Finset.mem_union.mp hwXD with hwZ | hwPair + · exact (Finset.mem_sdiff.mp hwZ).1 + · simp only [Finset.mem_insert, Finset.mem_singleton] at hwPair + rcases hwPair with hw1 | hw2 + · have hw1' : R.replacementTree.vertex + (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ j.isLt))) = R.u1 := by + simpa [w] using hw1 + have hind := R.replacementTree.vertex_injective + (hw1'.trans R.replacement_last_vertices.1.symm) + have hiv := congrArg Fin.val hind + change i.val = T.length - 1 at hiv + have hi := i.isLt + omega + · have hw2' : R.replacementTree.vertex + (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ j.isLt))) = R.u2 := by + simpa [w] using hw2 + have hind := R.replacementTree.vertex_injective + (hw2'.trans R.replacement_last_vertices.2.symm) + have hiv := congrArg Fin.val hind + change i.val = T.length at hiv + have hi := i.isLt + omega + rw [hMissingThetaFixed w hwX] + exact hmissing + · have hbaseMem := + (ScheideStructuralExitsInBase G k e0 phi T C) (D.v0_is_exit d) + obtain ⟨a, ha, hva⟩ := Finset.mem_image.mp hbaseMem + have haLt := a.isLt + have hbound : a.val ≤ C.p - 1 + 2 * (D.gammaIndex d).val := by + omega + have haTree : a.val < T.length + 1 := by + have hc := C.length_eq + omega + have hvbase : T.vertex ⟨a.val, haTree⟩ = D.v0 d := by + rw [C.base_vertex_position a] + exact hva + have hv0X : D.v0 d ∈ X := by + rw [← hva] + change C.y a ∈ TreeSequenceVertexSet T + rw [← C.base_vertex_position a] + simp [TreeSequenceVertexSet] + have hmissD : d.1 ∈ MissingColors G phiD (D.v0 d) := by + change d.1 ∈ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) (D.v0 d) + rw [hEffect.2.2.2.1] + simp + have hmissTheta : d.1 ∈ MissingColors G theta (D.v0 d) := by + rw [hMissingThetaFixed (D.v0 d) hv0X] + exact hmissD + have hf1D : phiD R.f1 = some d.1 := by + have hp := ScheideReplacementPairFixed G k e0 phi T C D d R R.f1 + (Or.inl (by + change R.u1 ∈ G.ends R.f1 + rw [R.f1_ends] + simp [])) + simpa [phiD, gamma] using hp.trans R.f1_color + have hf2D : phiD R.f2 = some d.1 := by + have hp := ScheideReplacementPairFixed G k e0 phi T C D d R R.f2 + (Or.inr (by + change R.u2 ∈ G.ends R.f2 + rw [R.f2_ends] + simp [])) + simpa [phiD, gamma] using hp.trans R.f2_color + have hf1Theta : theta R.f1 = some d.1 := by + have hv1X : R.v1 ∈ X := (Finset.mem_sdiff.mp R.v1_in_remainder).1 + have hv1f : Incident G R.v1 R.f1 := by + change R.v1 ∈ G.ends R.f1 + rw [R.f1_ends] + simp [] + exact (hThetaFixedAtX R.v1 hv1X R.f1 hv1f).trans hf1D + have hf2Theta : theta R.f2 = some d.1 := by + have hv2X : R.v2 ∈ X := (Finset.mem_sdiff.mp R.v2_in_remainder).1 + have hv2f : Incident G R.v2 R.f2 := by + change R.v2 ∈ G.ends R.f2 + rw [R.f2_ends] + simp [] + exact (hThetaFixedAtX R.v2 hv2X R.f2 hv2f).trans hf2D + have hjlast : j.val = T.length - 2 ∨ j.val = T.length - 1 := by + have hjlt := j.isLt + omega + rcases hjlast with hjlast | hjlast + · have haearly : a.val < j.val + 1 := by + have hc := C.length_eq + omega + refine ⟨⟨a.val, haearly⟩, d.1, ?_, ?_⟩ + · rw [show R.replacementTree.edge j = + R.replacementTree.edge ⟨T.length - 2, by rw [← hlen]; omega⟩ by + apply congrArg R.replacementTree.edge + apply Fin.ext + omega] + rw [R.replacement_last_edges.1] + exact hf1Theta + · have hvrep := R.retained_vertices_before a.val hbound (by omega) + have hidx : (⟨a.val, haearly⟩ : Fin (j.val + 1)).castLT (by omega) = + (⟨a.val, by omega⟩ : Fin (R.replacementTree.length + 1)) := Fin.ext rfl + rw [hidx, hvrep, hvbase] + exact hmissTheta + · have haearly : a.val < j.val + 1 := by + have hc := C.length_eq + omega + refine ⟨⟨a.val, haearly⟩, d.1, ?_, ?_⟩ + · rw [show R.replacementTree.edge j = + R.replacementTree.edge ⟨T.length - 1, by rw [← hlen]; omega⟩ by + apply congrArg R.replacementTree.edge + apply Fin.ext + omega] + rw [R.replacement_last_edges.2] + exact hf2Theta + · have hvrep := R.retained_vertices_before a.val hbound (by omega) + have hidx : (⟨a.val, haearly⟩ : Fin (j.val + 1)).castLT (by omega) = + (⟨a.val, by omega⟩ : Fin (R.replacementTree.length + 1)) := Fin.ext rfl + rw [hidx, hvrep, hvbase] + exact hmissTheta + +private theorem helper_hNoIncident_614.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let Z : Finset V := X \ {ug0, ug1}; + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; ( + ∀ (x : V), x = R.u1 ∨ x = R.u2 → + ∀ (f : E), Incident G x f → phiD f = some alpha → + ∀ (w : V), G.ends f = s(x, w) → w ∈ Z → False) → ( + ∀ (x : V), x = R.u1 ∨ x = R.u2 → + ∀ (f : E), Incident G x f → phiD f = some alpha → + ∀ (w : V), G.ends f = s(x, w) → w ∉ XD → False) → (¬ + ∃ (f : E), phi f = some alpha ∧ G.ends f = s(R.u1, R.u2)) → + ∀ (x : V), x = R.u1 ∨ x = R.u2 → + ∀ (f : E), Incident G x f → phiD f ≠ some alpha := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha X gamma ug0 ug1 Z phiD XD hAlphaBoundaryZ + hAlphaBoundaryOutside hnone x hx f hxf hcolor + obtain ⟨w, hends⟩ := Sym2.mem_iff_exists.mp hxf + have hwne : w ≠ x := by + intro h + apply G.loopless f x + simpa [h] using hends + by_cases hwZ : w ∈ Z + · exact hAlphaBoundaryZ x hx f hxf hcolor w hends hwZ + by_cases hwXD : w ∈ XD + · have hwPair : w = R.u1 ∨ w = R.u2 := by + have hw := hwXD + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] at hw + rcases Finset.mem_union.mp hw with hwOld | hwPair + · exact False.elim (hwZ (by simpa [X, Z, ug0, ug1] using hwOld)) + · simpa using hwPair + have hinterior : G.ends f = s(R.u1, R.u2) := by + rcases hx with rfl | rfl <;> rcases hwPair with rfl | rfl + · exact False.elim (hwne rfl) + · exact hends + · simpa [Sym2.eq_swap] using hends + · exact False.elim (hwne rfl) + have hfixed := ScheideReplacementPairFixed G k e0 phi T C D d R f (by + rcases hx with rfl | rfl + · exact Or.inl hxf + · exact Or.inr hxf) + apply hnone + exact ⟨f, by simpa [phiD, gamma] using hfixed.symm.trans hcolor, + hinterior⟩ + · exact hAlphaBoundaryOutside x hx f hxf hcolor w hends hwXD + +private theorem helper_hAlphaGamma_376.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (alpha : Fin k), alpha ∈ + MissingColors G phi (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∨ alpha ∈ + MissingColors G phi (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + let gamma : Fin k := C.gamma (D.gammaIndex d); + let _ : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let _ : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); alpha ≠ gamma := by + classical + intro V E _ _ _ G k e0 phi T C D d alpha hAlpha gamma ug0 ug1 h + rcases hAlpha with hAlpha | hAlpha + · have hnot : alpha ∉ PresentColors G phi ug0 := by + simpa [MissingColors] using hAlpha + obtain ⟨q, hends⟩ := C.block_attaches_to_base (D.gammaIndex d) (0 : Fin 2) + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨C.blockEdge (D.gammaIndex d) 0, ?_, ?_⟩ + · change ug0 ∈ G.ends (C.blockEdge (D.gammaIndex d) 0) + rw [hends] + simp [ug0] + · simpa [gamma, h] using C.block_color (D.gammaIndex d) (0 : Fin 2) + · have hnot : alpha ∉ PresentColors G phi ug1 := by + simpa [MissingColors] using hAlpha + obtain ⟨q, hends⟩ := C.block_attaches_to_base (D.gammaIndex d) (1 : Fin 2) + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨C.blockEdge (D.gammaIndex d) 1, ?_, ?_⟩ + · change ug1 ∈ G.ends (C.blockEdge (D.gammaIndex d) 1) + rw [hends] + simp [ug1] + · simpa [gamma, h] using C.block_color (D.gammaIndex d) (1 : Fin 2) + +private theorem helper_hReplacementEdgeIncidentX_616.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData G k e0 + phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + ∀ (j : Fin R.replacementTree.length), ∃ v ∈ X, Incident G v (R.replacementTree.edge j) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X j + have hjmem : R.replacementTree.edge j ∈ + Finset.univ.image R.replacementTree.edge := by + exact Finset.mem_image.mpr ⟨j, Finset.mem_univ _, rfl⟩ + rw [R.replacement_edges] at hjmem + rcases Finset.mem_union.mp hjmem with hold | hnew + · have holdImage : R.replacementTree.edge j ∈ Finset.univ.image T.edge := + (Finset.mem_erase.mp (Finset.mem_erase.mp hold).2).2 + obtain ⟨q, -, hq⟩ := Finset.mem_image.mp holdImage + obtain ⟨i, hi⟩ := T.attaches q + refine ⟨T.vertex q.succ, ?_, ?_⟩ + · simp [X, TreeSequenceVertexSet] + · change T.vertex q.succ ∈ G.ends (R.replacementTree.edge j) + rw [← hq, hi] + simp [] + · simp only [Finset.mem_insert, Finset.mem_singleton] at hnew + rcases hnew with hnew | hnew + · refine ⟨R.v1, ?_, ?_⟩ + · exact (Finset.mem_sdiff.mp R.v1_in_remainder).1 + · change R.v1 ∈ G.ends (R.replacementTree.edge j) + rw [hnew, R.f1_ends] + simp [] + · refine ⟨R.v2, ?_, ?_⟩ + · exact (Finset.mem_sdiff.mp R.v2_in_remainder).1 + · change R.v2 ∈ G.ends (R.replacementTree.edge j) + rw [hnew, R.f2_ends] + simp [] + +private theorem helper_hAlphaBoundaryOutside_694.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; y0 ∈ XD → R.u1 ∈ XD → R.u2 ∈ XD + → alpha ≠ D.alpha0 → + let K : Set (V ⊕ E) := TwoColorComponent G phiD D.alpha0 alpha (Sum.inl R.u1); Sum.inl R.u1 ∈ + K → Sum.inl R.u2 ∈ K → + let theta : PartialEdgeColoring E k := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl + R.u1); ColoredVertexSetClosed G theta XD → D.alpha0 ∈ MissingColors G theta y0 → ( + ∀ (x : V), Sum.inl x ∈ K → + ∀ (f : E), Incident G x f → phiD f = some alpha → Sum.inr f ∈ K) → + ∀ (x : V), x = R.u1 ∨ x = R.u2 → + ∀ (f : E), Incident G x f → phiD f = some alpha → + ∀ (w : V), G.ends f = s(x, w) → w ∉ XD → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha gamma y0 phiD XD hy0XD hu1XD hu2XD hAlphaNeAlpha0 + K hu1K hu2K theta hXDThetaClosed hAlpha0ThetaY0 hAlphaEdgeInK x hx f hxf hcolor w hends hwXD + have hxXD : x ∈ XD := by + rcases hx with rfl | rfl + · exact hu1XD + · exact hu2XD + have hfK : Sum.inr f ∈ K := by + apply hAlphaEdgeInK x + · rcases hx with rfl | rfl + · exact hu1K + · exact hu2K + · exact hxf + · exact hcolor + have hcolorTheta : theta f = some D.alpha0 := by + simp [theta, K, TwoColorComponentSwap, hfK, hcolor, + hAlphaNeAlpha0] + have hfBoundary : f ∈ BoundaryEdges G XD := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxXD, w, hwXD, hends⟩ + exact (hXDThetaClosed hfBoundary hy0XD hcolorTheta) hAlpha0ThetaY0 + +private theorem helper_hAlphaDelta_507.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (alpha : Fin k), alpha ∈ + MissingColors G phi (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∨ alpha ∈ + MissingColors G phi (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + ∀ (fDeltaPair : E), phi fDeltaPair = some (↑d : Fin k) → Incident G ug0 fDeltaPair → Incident + G ug1 fDeltaPair → alpha ≠ (↑d : Fin k) := by + classical + intro V E _ _ _ G k e0 phi T C D d alpha hAlpha ug0 ug1 fDeltaPair hfDeltaPairColor hfDeltaUg0 + hfDeltaUg1 h + rcases hAlpha with hAlpha | hAlpha + · have hnot : alpha ∉ PresentColors G phi ug0 := by + simpa [MissingColors] using hAlpha + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fDeltaPair, hfDeltaUg0, by simpa [h] using hfDeltaPairColor⟩ + · have hnot : alpha ∉ PresentColors G phi ug1 := by + simpa [MissingColors] using hAlpha + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fDeltaPair, hfDeltaUg1, by simpa [h] using hfDeltaPairColor⟩ + +private theorem helper_hPhiDAlpha0_550.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); gamma ≠ (↑d : Fin k) → D.alpha0 ≠ gamma → D.alpha0 ≠ (↑d : Fin k) → + ∀ (f : E), phiD f = some D.alpha0 ↔ phi f = some D.alpha0 := by + classical + intro V E _ _ _ G k e0 phi T C D d gamma phiD hGammaDelta hAlpha0Gamma hAlpha0Delta f + simp only [phiD, TwoColorComponentSwap] + by_cases hf : Sum.inr f ∈ + TwoColorComponent G phi gamma d.1 (Sum.inl (D.v0 d)) + · by_cases hfg : phi f = some gamma + · simp only [hf, ite_eq_left, hfg, Option.some.injEq] + constructor + · intro h + exact False.elim (hAlpha0Delta h.symm) + · intro h + exact False.elim (hAlpha0Gamma h.symm) + · by_cases hfd : phi f = some d.1 + · simp [hf, hfd, hGammaDelta.symm, hAlpha0Gamma.symm, hAlpha0Delta.symm] + · simp [hf, hfg, hfd] + · simp [hf] + +private theorem helper_hPhiDAlpha_567.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (alpha : Fin k), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); alpha ≠ gamma → alpha ≠ (↑d : Fin k) → gamma ≠ (↑d : Fin k) → + ∀ (f : E), phiD f = some alpha ↔ phi f = some alpha := by + classical + intro V E _ _ _ G k e0 phi T C D d alpha gamma phiD hAlphaGamma hAlphaDelta hGammaDelta f + simp only [phiD, TwoColorComponentSwap] + by_cases hf : Sum.inr f ∈ + TwoColorComponent G phi gamma d.1 (Sum.inl (D.v0 d)) + · by_cases hfg : phi f = some gamma + · simp only [hf, ite_eq_left, hfg, Option.some.injEq] + constructor + · intro h + exact False.elim (hAlphaDelta h.symm) + · intro h + exact False.elim (hAlphaGamma h.symm) + · by_cases hfd : phi f = some d.1 + · simp [hf, hfd, hGammaDelta.symm, hAlphaGamma.symm, hAlphaDelta.symm] + · simp [hf, hfg, hfd] + · simp [hf] + +private theorem helper_hAvoid_657.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData G k e0 + phi T C D d) + (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) + (Sum.inl (D.v0 d)); + TwoColorIncidenceGraph G phiD D.alpha0 alpha = TwoColorIncidenceGraph G phi D.alpha0 alpha → + let K : Set (V ⊕ E) := TwoColorComponent G phiD D.alpha0 alpha (Sum.inl R.u1); + ((∀ v ∈ X, Sum.inl v ∉ TwoColorComponent G phi D.alpha0 alpha (Sum.inl R.u1)) ∧ + ∀ (f : E), (∃ v ∈ X, Incident G v f) → Sum.inr f ∉ TwoColorComponent G phi D.alpha0 + alpha (Sum.inl R.u1)) → + (∀ v ∈ X, Sum.inl v ∉ K) ∧ ∀ (f : E), (∃ v ∈ X, Incident G v f) → Sum.inr f ∉ K := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha X gamma phiD hGraph K hAvoidOld + constructor + · intro v hv hmem + apply hAvoidOld.1 v hv + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl v) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl R.u1) + rw [← hGraph] + exact hmem + · intro f hf hmem + apply hAvoidOld.2 f hf + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl R.u1) + rw [← hGraph] + exact hmem + +private theorem helper_hOneTheta_682.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); ( + have phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); IsProperEdgeColoring G phiD ∧ IsOneEdgeUncolored phiD e0 + ∧ GlobalMaximumTriple G k e0 phiD R.replacementTree) → alpha ≠ D.alpha0 → + let _ : Set (V ⊕ E) := TwoColorComponent G phiD D.alpha0 alpha (Sum.inl R.u1); + let theta : PartialEdgeColoring E k := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl + R.u1); IsOneEdgeUncolored theta e0 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha gamma phiD hReplacementMaximum hAlphaNeAlpha0 K theta + have hOne : IsOneEdgeUncolored phiD e0 := by + simpa [phiD, gamma] using hReplacementMaximum.2.1 + constructor + · simp [theta, TwoColorComponentSwap, hOne.1] + · intro f hf + obtain ⟨c, hfc⟩ := hOne.2 f hf + by_cases hmem : Sum.inr f ∈ K + · by_cases hc0 : c = D.alpha0 + · exact ⟨alpha, by + simp [theta, TwoColorComponentSwap, K, hmem, hfc, hc0]⟩ + · by_cases hca : c = alpha + · exact ⟨D.alpha0, by + simp [theta, TwoColorComponentSwap, K, hmem, hfc, hca, + hAlphaNeAlpha0]⟩ + · exact ⟨c, by + simp [theta, TwoColorComponentSwap, K, hmem, hfc, hc0, hca]⟩ + · exact ⟨c, by + simp [theta, TwoColorComponentSwap, K, hmem, hfc]⟩ + +private theorem helper_hAlphaBoundaryZ_750.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), alpha ∈ MissingColors G phi (C.blockVertex + (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∨ alpha ∈ MissingColors G phi (C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let Z : Finset V := X \ {ug0, ug1}; + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); ColoredVertexSetClosed G phi X → ug0 ∈ X → ug1 ∈ X → + ∀ (x : V), x = R.u1 ∨ x = R.u2 → + ∀ (f : E), Incident G x f → phiD f = some alpha → + ∀ (w : V), G.ends f = s(x, w) → w ∈ Z → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha hAlpha X gamma ug0 ug1 Z phiD hXClosed hug0X hug1X + x hx f hxf hcolor w hends hwZ + have hcolorOld : phi f = some alpha := by + have hfixed := ScheideReplacementPairFixed G k e0 phi T C D d R f (by + rcases hx with rfl | rfl + · exact Or.inl hxf + · exact Or.inr hxf) + simpa [phiD, gamma] using hfixed.symm.trans hcolor + have hfBoundary : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨w, (Finset.mem_sdiff.mp hwZ).1, x, ?_, hends.trans Sym2.eq_swap⟩ + rcases hx with rfl | rfl + · exact R.u1_outside + · exact R.u2_outside + rcases hAlpha with hAlpha | hAlpha + · exact (hXClosed hfBoundary hug0X hcolorOld) hAlpha + · exact (hXClosed hfBoundary hug1X hcolorOld) hAlpha + +private theorem helper_continuation_738.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), alpha ∈ MissingColors G phi (C.blockVertex + (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∨ alpha ∈ MissingColors G phi (C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let _ : Finset V := X \ {ug0, ug1}; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; ColoredVertexSetClosed G phi X → + ( + have phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); IsProperEdgeColoring G phiD ∧ IsOneEdgeUncolored phiD e0 + ∧ GlobalMaximumTriple G k e0 phiD R.replacementTree) → GlobalMaximumTriple G k e0 phiD + R.replacementTree → ColoredVertexSetElementary G phiD XD → ug0 ∈ X → ug1 ∈ X → y0 ∈ X → y0 + ∈ XD → R.u1 ∈ XD → R.u2 ∈ XD → R.u1 ≠ R.u2 → TwoColorIncidenceGraph G phiD D.alpha0 alpha + = TwoColorIncidenceGraph G phi D.alpha0 alpha → D.alpha0 ∈ MissingColors G phiD y0 → alpha + ≠ D.alpha0 → + let K : Set (V ⊕ E) := TwoColorComponent G phiD D.alpha0 alpha (Sum.inl R.u1); Sum.inl R.u1 ∈ + K → Sum.inl R.u2 ∈ K → (( + ∀ v ∈ X, Sum.inl v ∉ TwoColorComponent G phi D.alpha0 alpha (Sum.inl R.u1)) ∧ + ∀ (f : E), ( + ∃ v ∈ X, Incident G v f) → Sum.inr f ∉ TwoColorComponent G phi D.alpha0 alpha (Sum.inl R.u1)) + → + ∃ (f : E), phi f = some alpha ∧ G.ends f = s(R.u1, R.u2) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha hAlpha X gamma ug0 ug1 Z y0 phiD XD hXClosed + hReplacementMaximum hReplacementGlobal hXDElementary hug0X hug1X hy0X hy0XD hu1XD hu2XD + hu12 hGraph hAlpha0D hAlphaNeAlpha0 K hu1K hu2K hAvoidOld + have hAvoid : + (∀ v ∈ X, Sum.inl v ∉ K) ∧ + ∀ f : E, (∃ v ∈ X, Incident G v f) → Sum.inr f ∉ K := by + exact @helper_hAvoid_657 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R alpha hGraph hAvoidOld + let theta := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl R.u1) + have hProperTheta : IsProperEdgeColoring G theta := by + exact TwoColorComponentSwapProper G phiD D.alpha0 alpha hAlphaNeAlpha0.symm + hReplacementMaximum.1 (Sum.inl R.u1) + have hOneTheta : IsOneEdgeUncolored theta e0 := by + exact @helper_hOneTheta_682 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R alpha hReplacementMaximum hAlphaNeAlpha0 + have hThetaFixedAtX : ∀ v : V, v ∈ X → + ∀ f : E, Incident G v f → theta f = phiD f := by + intro v hv f hvf + have hnot := hAvoid.2 f ⟨v, hv, hvf⟩ + simp [theta, K, TwoColorComponentSwap, hnot] + have hMissingThetaFixed : ∀ v : V, v ∈ X → + MissingColors G theta v = MissingColors G phiD v := by + intro v hv + simp only [MissingColors] + congr 1 + ext c + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + constructor <;> rintro ⟨f, hvf, hfc⟩ + · exact ⟨f, hvf, (hThetaFixedAtX v hv f hvf).symm.trans hfc⟩ + · exact ⟨f, hvf, (hThetaFixedAtX v hv f hvf).trans hfc⟩ + have hReplacementEdgeIncidentX : ∀ j : Fin R.replacementTree.length, + ∃ v ∈ X, Incident G v (R.replacementTree.edge j) := by + exact @helper_hReplacementEdgeIncidentX_616 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R + have hEffect := ScheideDefectiveSwitchEffect G k e0 phi T C D d + dsimp at hEffect + have hTreeTheta : TashkinovTree G e0 theta R.replacementTree := by + exact @helper_hTreeTheta_414 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R alpha hReplacementGlobal hThetaFixedAtX hMissingThetaFixed + hReplacementEdgeIncidentX hEffect + have hGlobalTheta : GlobalMaximumTriple G k e0 theta R.replacementTree := by + refine ⟨?_, hTreeTheta, hReplacementGlobal.2.2⟩ + exact ⟨hReplacementGlobal.1.1, hReplacementGlobal.1.2.1, + hReplacementGlobal.1.2.2.1, hProperTheta, hOneTheta⟩ + have hThetaOrder := + ScheideGlobalMaximumOrder G k e0 theta R.replacementTree hGlobalTheta + have hXDThetaClosed : ColoredVertexSetClosed G theta XD := by + change ColoredVertexSetClosed G theta + (TreeSequenceVertexSet R.replacementTree) + exact hThetaOrder.2.2.2.2 + have hAlpha0ThetaY0 : D.alpha0 ∈ MissingColors G theta y0 := by + rw [hMissingThetaFixed y0 hy0X] + exact hAlpha0D + have hAlphaEdgeInK : ∀ x : V, Sum.inl x ∈ K → ∀ f : E, + Incident G x f → phiD f = some alpha → Sum.inr f ∈ K := by + intro x hx f hxf hcolor + change (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl R.u1) + have hadj : (TwoColorIncidenceGraph G phiD D.alpha0 alpha).Adj + (Sum.inl x) (Sum.inr f) := by + simp [TwoColorIncidenceGraph, hxf, hcolor] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).symm.trans hx + have hAlphaBoundaryZ : ∀ x : V, (x = R.u1 ∨ x = R.u2) → ∀ f : E, + Incident G x f → phiD f = some alpha → + ∀ w : V, G.ends f = s(x, w) → w ∈ Z → False := by + exact @helper_hAlphaBoundaryZ_750 V E inferInstance inferInstance inferInstance inferInstance + G k e0 phi T C D d R alpha hAlpha hXClosed hug0X hug1X + have hAlphaBoundaryOutside : ∀ x : V, (x = R.u1 ∨ x = R.u2) → ∀ f : E, + Incident G x f → phiD f = some alpha → + ∀ w : V, G.ends f = s(x, w) → w ∉ XD → False := by + exact @helper_hAlphaBoundaryOutside_694 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R alpha hy0XD hu1XD hu2XD hAlphaNeAlpha0 hu1K hu2K + hXDThetaClosed hAlpha0ThetaY0 hAlphaEdgeInK + by_contra hnone + have hNoIncident : ∀ x : V, (x = R.u1 ∨ x = R.u2) → + ∀ f : E, Incident G x f → phiD f ≠ some alpha := by + exact @helper_hNoIncident_614 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R alpha hAlphaBoundaryZ hAlphaBoundaryOutside hnone + have hMissingU1 : alpha ∈ MissingColors G phiD R.u1 := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpresent + obtain ⟨f, hinc, hcolor⟩ := hpresent + exact hNoIncident R.u1 (Or.inl rfl) f hinc hcolor + have hMissingU2 : alpha ∈ MissingColors G phiD R.u2 := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpresent + obtain ⟨f, hinc, hcolor⟩ := hpresent + exact hNoIncident R.u2 (Or.inr rfl) f hinc hcolor + have hdj := hXDElementary hu1XD hu2XD hu12 + exact (Finset.disjoint_left.mp hdj) hMissingU1 hMissingU2 + +private theorem helper_continuation_705.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), alpha ∈ MissingColors G phi (C.blockVertex + (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∨ alpha ∈ MissingColors G phi (C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let Z : Finset V := X \ {ug0, ug1}; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; ColoredVertexSetElementary G phi + X → ColoredVertexSetClosed G phi X → ( + have phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); IsProperEdgeColoring G phiD ∧ IsOneEdgeUncolored phiD e0 + ∧ GlobalMaximumTriple G k e0 phiD R.replacementTree) → GlobalMaximumTriple G k e0 phiD + R.replacementTree → ColoredVertexSetElementary G phiD XD → ug0 ∈ X → ug1 ∈ X → y0 ∈ X → y0 + ≠ ug0 → y0 ≠ ug1 → y0 ∈ Z → y0 ∈ XD → R.u1 ∈ XD → R.u2 ∈ XD → R.u1 ≠ R.u2 → alpha ≠ gamma + → alpha ≠ (↑d : Fin k) → + ∃ (f : E), phi f = some alpha ∧ G.ends f = s(R.u1, R.u2) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha hAlpha X gamma ug0 ug1 Z y0 phiD XD hXElementary + hXClosed hReplacementMaximum hReplacementGlobal hXDElementary hug0X hug1X hy0X hy0ne0 + hy0ne1 hy0Z hy0XD hu1XD hu2XD hu12 hAlphaGamma hAlphaDelta + have hGammaDelta : gamma ≠ d.1 := by + intro h + have hnot : gamma ∉ PresentColors G phi (D.v0 d) := by + simpa [MissingColors, gamma] using D.gamma_missing_at_v0 d + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨D.f0 d, ?_, ?_⟩ + · change D.v0 d ∈ G.ends (D.f0 d) + rw [D.f0_ends] + simp [] + · simpa [h] using D.f0_color d + have hAlpha0Gamma : D.alpha0 ≠ gamma := by + simpa [gamma] using D.alpha0_not_block (D.gammaIndex d) + have hDeltaBoundary : ∃ f : E, + f ∈ BoundaryEdges G X ∧ phi f = some d.1 := by + have hdcard : 2 ≤ (BoundaryColorEdges G phi X d.1).card := by + have hd := (Finset.mem_filter.mp d.2).2 + simpa [DefectiveColor, X] using hd + have hdnonempty : (BoundaryColorEdges G phi X d.1).Nonempty := + Finset.card_pos.mp (lt_of_lt_of_le Nat.zero_lt_two hdcard) + obtain ⟨f, hf⟩ := hdnonempty + exact ⟨f, (Finset.mem_filter.mp hf).1, (Finset.mem_filter.mp hf).2⟩ + obtain ⟨fDelta, hfDeltaBoundary, hfDeltaColor⟩ := hDeltaBoundary + have hDeltaNotMissingY0 : d.1 ∉ MissingColors G phi y0 := + hXClosed hfDeltaBoundary hy0X hfDeltaColor + have hAlpha0Delta : D.alpha0 ≠ d.1 := by + intro h + apply hDeltaNotMissingY0 + simpa [y0, h] using D.alpha0_missing_at_y0 + have hPhiDAlpha0 : ∀ f : E, + phiD f = some D.alpha0 ↔ phi f = some D.alpha0 := by + exact @helper_hPhiDAlpha0_550 V E inferInstance inferInstance inferInstance G k e0 phi T C D + d hGammaDelta hAlpha0Gamma hAlpha0Delta + have hPhiDAlpha : ∀ f : E, + phiD f = some alpha ↔ phi f = some alpha := by + exact @helper_hPhiDAlpha_567 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + alpha hAlphaGamma hAlphaDelta hGammaDelta + have hGraph : TwoColorIncidenceGraph G phiD D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha := by + ext x z + cases x <;> cases z <;> + simp [TwoColorIncidenceGraph, hPhiDAlpha0, hPhiDAlpha] + have hAlpha0D : D.alpha0 ∈ MissingColors G phiD y0 := by + have hOld := D.alpha0_missing_at_y0 + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] at hOld ⊢ + intro hpresent + apply hOld + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hpresent ⊢ + obtain ⟨f, hyf, hfc⟩ := hpresent + exact ⟨f, hyf, (hPhiDAlpha0 f).mp hfc⟩ + have hAlphaNeAlpha0 : alpha ≠ D.alpha0 := by + intro h + rcases hAlpha with hAlpha | hAlpha + · have hdj := hXElementary hy0X hug0X hy0ne0 + exact (Finset.disjoint_left.mp hdj) + (by simpa [y0] using D.alpha0_missing_at_y0) (by simpa [h] using hAlpha) + · have hdj := hXElementary hy0X hug1X hy0ne1 + exact (Finset.disjoint_left.mp hdj) + (by simpa [y0] using D.alpha0_missing_at_y0) (by simpa [h] using hAlpha) + obtain ⟨fAlpha0, hfAlpha0Color, hfAlpha0Ends⟩ := + ScheideReplacementInternalMissing G k e0 phi T C D d R D.alpha0 + (by simpa [gamma] using hAlpha0Gamma) + ⟨y0, by simpa [X, Z, ug0, ug1] using hy0Z, + by simpa [y0] using D.alpha0_missing_at_y0⟩ + have hfAlpha0DColor : phiD fAlpha0 = some D.alpha0 := by + have hfixed := ScheideReplacementPairFixed G k e0 phi T C D d R fAlpha0 + (Or.inl (by simp [Incident, hfAlpha0Ends])) + simpa [phiD, gamma] using hfixed.trans hfAlpha0Color + let K := TwoColorComponent G phiD D.alpha0 alpha (Sum.inl R.u1) + have hu1K : Sum.inl R.u1 ∈ K := by + rfl + have hfAlpha0U1 : Incident G R.u1 fAlpha0 := by + simp [Incident, hfAlpha0Ends] + have hfAlpha0U2 : Incident G R.u2 fAlpha0 := by + simp [Incident, hfAlpha0Ends] + have hfAlpha0K : Sum.inr fAlpha0 ∈ K := by + change (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inr fAlpha0) = + (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl R.u1) + have hadj : (TwoColorIncidenceGraph G phiD D.alpha0 alpha).Adj + (Sum.inl R.u1) (Sum.inr fAlpha0) := by + simp [TwoColorIncidenceGraph, hfAlpha0U1, hfAlpha0DColor] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).symm + have hu2K : Sum.inl R.u2 ∈ K := by + change (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl R.u2) = + (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl R.u1) + have hadj : (TwoColorIncidenceGraph G phiD D.alpha0 alpha).Adj + (Sum.inl R.u2) (Sum.inr fAlpha0) := by + simp [TwoColorIncidenceGraph, hfAlpha0U2, hfAlpha0DColor] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans + hfAlpha0K + have hAvoidOld : + (∀ v ∈ X, Sum.inl v ∉ + TwoColorComponent G phi D.alpha0 alpha (Sum.inl R.u1)) ∧ + ∀ f : E, (∃ v ∈ X, Incident G v f) → + Sum.inr f ∉ + TwoColorComponent G phi D.alpha0 alpha (Sum.inl R.u1) := by + rcases hAlpha with hAlpha | hAlpha + · exact ClosedSetTwoColorComponentAvoidance G phi D.alpha0 alpha X + R.u1 y0 ug0 hXClosed R.u1_outside hy0X hug0X + (by simpa [y0] using D.alpha0_missing_at_y0) hAlpha + · exact ClosedSetTwoColorComponentAvoidance G phi D.alpha0 alpha X + R.u1 y0 ug1 hXClosed R.u1_outside hy0X hug1X + (by simpa [y0] using D.alpha0_missing_at_y0) hAlpha + exact @helper_continuation_738 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R alpha hAlpha hXClosed hReplacementMaximum hReplacementGlobal hXDElementary + hug0X hug1X hy0X hy0XD hu1XD hu2XD hu12 hGraph hAlpha0D hAlphaNeAlpha0 hu1K hu2K hAvoidOld +theorem ScheideDeletedMissingReplacementInternal {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + ∀ alpha : Fin k, + (alpha ∈ MissingColors G phi (C.blockVertex (D.gammaIndex d) 0) ∨ + alpha ∈ MissingColors G phi (C.blockVertex (D.gammaIndex d) 1)) → + ∃ f : E, phi f = some alpha ∧ G.ends f = s(R.u1, R.u2) := by + classical + intro alpha hAlpha + let X := TreeSequenceVertexSet T + let gamma := C.gamma (D.gammaIndex d) + let ug0 := C.blockVertex (D.gammaIndex d) 0 + let ug1 := C.blockVertex (D.gammaIndex d) 1 + let Z := X \ {ug0, ug1} + let y0 := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let XD := TreeSequenceVertexSet R.replacementTree + have hOriginalOrder := + ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hXElementary : ColoredVertexSetElementary G phi X := by + change ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) + exact hOriginalOrder.2.2.2.1 + have hXClosed : ColoredVertexSetClosed G phi X := by + change ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) + exact hOriginalOrder.2.2.2.2 + have hReplacementMaximum := + ScheideReplacementMaximum G k e0 phi T C D d R + have hReplacementGlobal : GlobalMaximumTriple G k e0 phiD R.replacementTree := by + simpa [phiD, gamma] using hReplacementMaximum.2.2 + have hReplacementOrder := + ScheideGlobalMaximumOrder G k e0 phiD R.replacementTree hReplacementGlobal + have hXDElementary : ColoredVertexSetElementary G phiD XD := by + change ColoredVertexSetElementary G phiD + (TreeSequenceVertexSet R.replacementTree) + exact hReplacementOrder.2.2.2.1 + have hug0X : ug0 ∈ X := by + change C.blockVertex (D.gammaIndex d) 0 ∈ TreeSequenceVertexSet T + rw [← C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)] + simp [TreeSequenceVertexSet] + have hug1X : ug1 ∈ X := by + change C.blockVertex (D.gammaIndex d) 1 ∈ TreeSequenceVertexSet T + rw [← C.block_vertex_position (D.gammaIndex d) (1 : Fin 2)] + simp [TreeSequenceVertexSet] + have hug01 : ug0 ≠ ug1 := by + intro h + have hv := + (C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)).trans + (h.trans (C.block_vertex_position (D.gammaIndex d) (1 : Fin 2)).symm) + have hi := congrArg Fin.val (T.vertex_injective hv) + simp at hi + have hy0X : y0 ∈ X := by + change C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ + TreeSequenceVertexSet T + rw [← C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩] + simp [TreeSequenceVertexSet] + have hy0ne0 : y0 ≠ ug0 := by + intro h + have hv := + (C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩).trans + (h.trans (C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)).symm) + have hi := congrArg Fin.val (T.vertex_injective hv) + simp at hi + have hp := C.p_ge_two + omega + have hy0ne1 : y0 ≠ ug1 := by + intro h + have hv := + (C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩).trans + (h.trans (C.block_vertex_position (D.gammaIndex d) (1 : Fin 2)).symm) + have hi := congrArg Fin.val (T.vertex_injective hv) + simp at hi + have hy0Z : y0 ∈ Z := by + simp [Z, hy0X, hy0ne0, hy0ne1] + have hy0XD : y0 ∈ XD := by + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] + exact Finset.mem_union_left _ (by simpa [X, Z, ug0, ug1] using hy0Z) + have hu1XD : R.u1 ∈ XD := by + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] + simp + have hu2XD : R.u2 ∈ XD := by + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] + simp + have hu12 : R.u1 ≠ R.u2 := by + intro h + have hi := R.replacementTree.vertex_injective + (R.replacement_last_vertices.1.trans + (h.trans R.replacement_last_vertices.2.symm)) + have hv : T.length - 1 = T.length := by + simpa using congrArg Fin.val hi + have ht := T.positive + omega + have hAlphaGamma : alpha ≠ gamma := by + exact @helper_hAlphaGamma_376 V E inferInstance inferInstance inferInstance G k e0 phi T C D + d alpha hAlpha + obtain ⟨fDeltaPair, hfDeltaPairColor, hfDeltaPairEnds⟩ := + (ScheideSymmetricDefectiveInternal G k e0 phi T C D d R).1 + have hfDeltaUg0 : Incident G ug0 fDeltaPair := by + simp [Incident, hfDeltaPairEnds, ug0] + have hfDeltaUg1 : Incident G ug1 fDeltaPair := by + simp [Incident, hfDeltaPairEnds, ug1] + have hAlphaDelta : alpha ≠ d.1 := by + exact @helper_hAlphaDelta_507 V E inferInstance inferInstance inferInstance G k e0 phi T C D + d alpha hAlpha fDeltaPair hfDeltaPairColor hfDeltaUg0 hfDeltaUg1 + exact @helper_continuation_705 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R alpha hAlpha hXElementary hXClosed hReplacementMaximum hReplacementGlobal + hXDElementary hug0X hug1X hy0X hy0ne0 hy0ne1 hy0Z hy0XD hu1XD hu2XD hu12 hAlphaGamma + hAlphaDelta +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideDepartureReturn.lean b/LeanPool/GoldbergSeymour/ScheideDepartureReturn.lean new file mode 100644 index 0000000000..023b2e0f75 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideDepartureReturn.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Combinatorics.SimpleGraph.Walk.Traversal +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath + +/-! +# Scheide Departure Return + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A defective chain's first outside vertex and later last return to the tree. -/ +def ScheideDepartureReturn {V E : Type*} {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (T : TreeSequence G e0) {phi : PartialEdgeColoring E k} {alpha gamma : Fin k} {u z : V} + {p : (TwoColorIncidenceGraph G phi alpha gamma).Walk (Sum.inl u) (Sum.inl z)} + (i1 i2 : Fin (p.length + 1)) (v1 v2 : V) : Prop := + ScheideDefectiveChainPath T phi alpha gamma u z p ∧ + p.getVert i1.val = Sum.inl v1 ∧ + v1 ∉ TreeSequenceVertexSet T ∧ + (∀ r : Fin (p.length + 1), + r.val < i1.val → ∀ w : V, p.getVert r.val = Sum.inl w → w ∈ TreeSequenceVertexSet T) ∧ + i1.val < i2.val ∧ + p.getVert i2.val = Sum.inl v2 ∧ + v2 ∈ TreeSequenceVertexSet T ∧ + ∀ r : Fin (p.length + 1), + i2.val < r.val → ∀ w : V, p.getVert r.val = Sum.inl w → w ∉ TreeSequenceVertexSet T + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideEnlargedBoundarySelection.lean b/LeanPool/GoldbergSeymour/ScheideEnlargedBoundarySelection.lean new file mode 100644 index 0000000000..7aa3fa439f --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideEnlargedBoundarySelection.lean @@ -0,0 +1,1134 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideSingleBoundaryCrossing + +/-! +# Scheide Enlarged Boundary Selection + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_hDefUnique_410.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → ScheideReplacementData G k + e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + let Pair : ↥Def → Finset V := fun (d : ↥Def) ↦ {(R d).u1, (R d).u2}; + IsProperEdgeColoring G phi → + (∀ (a : ↥Def) (j : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex a) j ∈ VT) → + ∀ (a : ↥Def), ∀ e ∈ BoundaryColorEdges G phi (VT ∪ Pair a) (↑a : Fin k), e = D.f0 a := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def Pair hproper hblockVT a e he + let XA := VT ∪ Pair a + let Z := VT \ {C.blockVertex (D.gammaIndex a) 0, + C.blockVertex (D.gammaIndex a) 1} + have heBoundary : e ∈ BoundaryEdges G XA := + (Finset.mem_filter.mp he).1 + have heColor : phi e = some a.1 := + (Finset.mem_filter.mp he).2 + obtain ⟨x, hxXA, z, hzXA, hexz⟩ := by + simpa [BoundaryEdges] using heBoundary + obtain ⟨g, hgColor, hgEnds⟩ := + (ScheideSymmetricDefectiveInternal G k e0 phi T C D a (R a)).1 + have hblock0XA : C.blockVertex (D.gammaIndex a) 0 ∈ XA := + Finset.mem_union_left _ (hblockVT a 0) + have hblock1XA : C.blockVertex (D.gammaIndex a) 1 ∈ XA := + Finset.mem_union_left _ (hblockVT a 1) + have heg : e ≠ g := by + intro heg + have hzEnds : z ∈ G.ends g := by + rw [← heg, hexz] + simp + rw [hgEnds] at hzEnds + simp only [Sym2.mem_iff] at hzEnds + rcases hzEnds with hz0 | hz1 + · exact hzXA (hz0 ▸ hblock0XA) + · exact hzXA (hz1 ▸ hblock1XA) + by_cases hxVT : x ∈ VT + · have hx0 : x ≠ C.blockVertex (D.gammaIndex a) 0 := by + intro hx0 + exact (hproper heg + ⟨x, by change x ∈ G.ends e; rw [hexz]; simp, + by change x ∈ G.ends g; rw [hgEnds, hx0]; simp⟩ heColor) hgColor + have hx1 : x ≠ C.blockVertex (D.gammaIndex a) 1 := by + intro hx1 + exact (hproper heg + ⟨x, by change x ∈ G.ends e; rw [hexz]; simp, + by change x ∈ G.ends g; rw [hgEnds, hx1]; simp⟩ heColor) hgColor + have hxZ : x ∈ Z := by + exact Finset.mem_sdiff.mpr ⟨hxVT, by simp [hx0, hx1]⟩ + have hzVT : z ∉ VT := by + intro hz + exact hzXA (Finset.mem_union_left _ hz) + have heZ : e ∈ BoundaryColorEdges G phi Z a.1 := by + apply Finset.mem_filter.mpr + refine ⟨?_, heColor⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxZ, z, fun hz => hzVT (Finset.mem_sdiff.mp hz).1, hexz⟩ + have heOutside : ∃ w, w ∉ VT ∧ Incident G w e := by + exact ⟨z, hzVT, by change z ∈ G.ends e; rw [hexz]; simp⟩ + rcases ((R a).exact_three e).mp ⟨by simpa [Z] using heZ, heOutside⟩ with + he0 | he1 | he2 + · exact he0 + · exfalso + have hzEnds : z ∈ G.ends (R a).f1 := by + rw [← he1, hexz] + simp + rw [(R a).f1_ends] at hzEnds + simp only [Sym2.mem_iff] at hzEnds + rcases hzEnds with hzv | hzu + · exact hzXA (hzv ▸ Finset.mem_union_left _ + (Finset.mem_sdiff.mp (R a).v1_in_remainder).1) + · exact hzXA (hzu ▸ Finset.mem_union_right _ (by simp [Pair])) + · exfalso + have hzEnds : z ∈ G.ends (R a).f2 := by + rw [← he2, hexz] + simp + rw [(R a).f2_ends] at hzEnds + simp only [Sym2.mem_iff] at hzEnds + rcases hzEnds with hzv | hzu + · exact hzXA (hzv ▸ Finset.mem_union_left _ + (Finset.mem_sdiff.mp (R a).v2_in_remainder).1) + · exact hzXA (hzu ▸ Finset.mem_union_right _ (by simp [Pair])) + · have hxPair : x ∈ Pair a := by + exact (Finset.mem_union.mp hxXA).resolve_left hxVT + simp only [Pair, Finset.mem_insert, Finset.mem_singleton] at hxPair + rcases hxPair with hx1 | hx2 + · have hef : e ≠ (R a).f1 := by + intro hef + have hzEnds : z ∈ G.ends (R a).f1 := by + rw [← hef, hexz] + simp + rw [(R a).f1_ends] at hzEnds + simp only [Sym2.mem_iff] at hzEnds + rcases hzEnds with hzv | hzu + · exact hzXA (hzv ▸ Finset.mem_union_left _ + (Finset.mem_sdiff.mp (R a).v1_in_remainder).1) + · exact hzXA (hzu ▸ Finset.mem_union_right _ (by simp [Pair])) + exfalso + exact (hproper hef + ⟨x, by change x ∈ G.ends e; rw [hexz]; simp, + by change x ∈ G.ends (R a).f1; rw [(R a).f1_ends, hx1]; simp⟩ + heColor) (R a).f1_color + · have hef : e ≠ (R a).f2 := by + intro hef + have hzEnds : z ∈ G.ends (R a).f2 := by + rw [← hef, hexz] + simp + rw [(R a).f2_ends] at hzEnds + simp only [Sym2.mem_iff] at hzEnds + rcases hzEnds with hzv | hzu + · exact hzXA (hzv ▸ Finset.mem_union_left _ + (Finset.mem_sdiff.mp (R a).v2_in_remainder).1) + · exact hzXA (hzu ▸ Finset.mem_union_right _ (by simp [Pair])) + exfalso + exact (hproper hef + ⟨x, by change x ∈ G.ends e; rw [hexz]; simp, + by change x ∈ G.ends (R a).f2; rw [(R a).f2_ends, hx2]; simp⟩ + heColor) (R a).f2_color + +private theorem helper_hBaseBone_523.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → ScheideReplacementData G k + e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let X : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + let Pair : ↥Def → Finset V := fun (d : ↥Def) ↦ {(R d).u1, (R d).u2}; + VT ⊆ X → + ∀ (alpha : Fin k), + let B : Finset E := BoundaryColorEdges G phi X alpha; + (∀ (a : ↥Def), Pair a ⊆ X) → + (∀ S ⊆ X, ∀ e ∈ BoundaryEdges G X, (∃ v ∈ S, Incident G v e) → e ∈ BoundaryEdges G S) → + (∀ (a : ↥Def), ∀ e ∈ BoundaryColorEdges G phi (VT ∪ Pair a) (↑a : Fin k), e = D.f0 + a) → + let BaseB : Finset E := {e ∈ B | ∃ v ∈ VT, Incident G v e}; + BaseB.card ≤ (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def Pair hVTsubX alpha B hPairSubX + boundaryOfIncidentSubset hDefUnique BaseB + apply Finset.card_le_one.mpr + intro e he f hf + have heB := (Finset.mem_filter.mp he).1 + have hfB := (Finset.mem_filter.mp hf).1 + have heInc := (Finset.mem_filter.mp he).2 + have hfInc := (Finset.mem_filter.mp hf).2 + by_cases hdef : alpha ∈ Def + · let a : {delta // delta ∈ Def} := ⟨alpha, hdef⟩ + have hSsub : VT ∪ Pair a ⊆ X := + Finset.union_subset hVTsubX (hPairSubX a) + have heXA : e ∈ BoundaryColorEdges G phi (VT ∪ Pair a) a.1 := by + apply Finset.mem_filter.mpr + refine ⟨boundaryOfIncidentSubset (VT ∪ Pair a) hSsub e + (Finset.mem_filter.mp heB).1 ?_, ?_⟩ + · obtain ⟨v, hv, hve⟩ := heInc + exact ⟨v, Finset.mem_union_left _ hv, hve⟩ + · exact (Finset.mem_filter.mp heB).2 + have hfXA : f ∈ BoundaryColorEdges G phi (VT ∪ Pair a) a.1 := by + apply Finset.mem_filter.mpr + refine ⟨boundaryOfIncidentSubset (VT ∪ Pair a) hSsub f + (Finset.mem_filter.mp hfB).1 ?_, ?_⟩ + · obtain ⟨v, hv, hvf⟩ := hfInc + exact ⟨v, Finset.mem_union_left _ hv, hvf⟩ + · exact (Finset.mem_filter.mp hfB).2 + exact (hDefUnique a e heXA).trans (hDefUnique a f hfXA).symm + · by_contra hef + have heVT : e ∈ BoundaryColorEdges G phi VT alpha := by + apply Finset.mem_filter.mpr + exact ⟨boundaryOfIncidentSubset VT hVTsubX e + (Finset.mem_filter.mp heB).1 heInc, (Finset.mem_filter.mp heB).2⟩ + have hfVT : f ∈ BoundaryColorEdges G phi VT alpha := by + apply Finset.mem_filter.mpr + exact ⟨boundaryOfIncidentSubset VT hVTsubX f + (Finset.mem_filter.mp hfB).1 hfInc, (Finset.mem_filter.mp hfB).2⟩ + have htwo : 2 ≤ (BoundaryColorEdges G phi VT alpha).card := by + have hp : ({e, f} : Finset E).card = 2 := by simp [hef] + rw [← hp] + apply Finset.card_le_card + intro g hg + simp only [Finset.mem_insert, Finset.mem_singleton] at hg + rcases hg with rfl | rfl + · exact heVT + · exact hfVT + apply hdef + dsimp [Def] + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + change 2 ≤ (BoundaryColorEdges G phi VT alpha).card + exact htwo + +private theorem helper_avoidComponent_658.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let X : Finset V := ScheideEnlargedVertexSet R; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + ∀ (alpha : Fin k), + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi D.alpha0 alpha; + let P : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0); + ∀ (_ : E), + ∀ u ∉ X, + let Q : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); ( + ∀ z ∈ P, z ∉ Q) → + ∀ S ⊆ X, ColoredVertexSetClosed G phi S → y0 ∈ S → + ∀ (g : E), ( + ∀ e ∈ BoundaryColorEdges G phi S alpha, e = g) → Sum.inr g ∈ P → + ∀ v ∈ S, Sum.inl v ∉ Q := by + classical + intro V E _ _ _ _ G k e0 phi T C D R X y0 alpha H P f u huX Q hPQ S hSX hclosed hy0S g hunique hgP + have hgQ : Sum.inr g ∉ Q := hPQ (Sum.inr g) hgP + let Outside : Sum V E → Prop + | Sum.inl v => v ∉ S + | Sum.inr e => ∀ v ∈ S, ¬ Incident G v e + have step : ∀ {z z' : Sum V E}, H.Adj z z' → + Outside z → z ∈ Q → Outside z' := by + intro z z' hzz' hz hzQ + cases z with + | inl v => + cases z' with + | inl x => simp [H, TwoColorIncidenceGraph] at hzz' + | inr e => + simp only [H, TwoColorIncidenceGraph] at hzz' + intro x hxS hxe + have hvx : x ≠ v := by + intro hvx + exact hz (hvx ▸ hxS) + have hends : G.ends e = s(x, v) := + (Sym2.mem_and_mem_iff hvx).mp ⟨hxe, hzz'.1⟩ + have heBoundary : e ∈ BoundaryEdges G S := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨x, hxS, v, hz, hends⟩ + rcases hzz'.2 with he0 | hea + · exact (hclosed heBoundary hy0S he0) + D.alpha0_missing_at_y0 + · have heg : e = g := hunique e + (Finset.mem_filter.mpr ⟨heBoundary, hea⟩) + apply hgQ + rw [← heg] + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk (Sum.inl u) + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inl u) at hzQ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hzz').symm.trans hzQ + | inr e => + cases z' with + | inl v => + simp only [H, TwoColorIncidenceGraph] at hzz' + intro hvS + exact hz v hvS hzz'.1 + | inr f => simp [H, TwoColorIncidenceGraph] at hzz' + have componentOutside : ∀ z, z ∈ Q → Outside z := by + intro z hzQ + have hreach : H.Reachable (Sum.inl u) z := by + apply SimpleGraph.ConnectedComponent.exact + change H.connectedComponentMk z = H.connectedComponentMk (Sum.inl u) at hzQ + exact hzQ.symm + clear hzQ + rw [SimpleGraph.reachable_iff_reflTransGen] at hreach + induction hreach with + | refl => exact fun huS => huX (hSX huS) + | @tail z z' hreach hlast ih => + have hzQ : z ∈ Q := by + change H.connectedComponentMk z = H.connectedComponentMk (Sum.inl u) + exact (SimpleGraph.ConnectedComponent.sound + (by simpa [SimpleGraph.reachable_iff_reflTransGen] using hreach)).symm + exact step hlast ih hzQ + intro v hvS hvQ + exact (componentOutside (Sum.inl v) hvQ) hvS + +private theorem helper_hQavoidVT_727.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let X : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + let Pair : ↥Def → Finset V := fun (d : ↥Def) ↦ {(R d).u1, (R d).u2}; ColoredVertexSetClosed G + phi VT → + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); y0 ∈ VT → + VT ⊆ X → + ∀ (alpha : Fin k), ( + ∀ (a : ↥Def), Pair a ⊆ X) → ( + ∀ (a : ↥Def), + ∀ e ∈ BoundaryColorEdges G phi (VT ∪ Pair a) (↑a : Fin k), e = D.f0 a) → + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi D.alpha0 alpha; + let P : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0); + ∀ p ∈ BoundaryEdges G X, Sum.inr p ∈ P → phi p = some alpha → + ∀ (_ : E) (u : V), + let Q : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); ( + ∀ S ⊆ X, ColoredVertexSetClosed G phi S → y0 ∈ S → + ∀ (g : E), ( + ∀ e ∈ BoundaryColorEdges G phi S alpha, e = g) → Sum.inr g ∈ P → + ∀ v ∈ S, Sum.inl v ∉ Q) → + ∀ v ∈ VT, Sum.inl v ∉ Q := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def Pair hVTclosed y0 hy0VT hVTsubX alpha hPairSubX + hDefUnique H P p hpBoundary hpP hpColor f u Q avoidComponent + by_cases hdef : alpha ∈ Def + · let a : {delta // delta ∈ Def} := ⟨alpha, hdef⟩ + let XA := VT ∪ Pair a + have hXAsub : XA ⊆ X := + Finset.union_subset hVTsubX (hPairSubX a) + have hXAclosed : ColoredVertexSetClosed G phi XA := by + change ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T ∪ {(R a).u1, (R a).u2}) + exact ScheideReplacementUnionClosed G k e0 phi T C D a (R a) + have hy0XA : y0 ∈ XA := Finset.mem_union_left _ hy0VT + have havoid := avoidComponent XA hXAsub hXAclosed hy0XA (D.f0 a) + (by + intro e he + exact hDefUnique a e (by simpa [XA] using he)) + (by simpa [P, y0, a] using D.f0_on_initial_component a) + intro v hv + exact havoid v (Finset.mem_union_left _ hv) + · let BaseColor := BoundaryColorEdges G phi VT alpha + have hBaseColorOne : BaseColor.card ≤ 1 := by + by_contra hnotOne + have htwo : 2 ≤ BaseColor.card := by omega + apply hdef + dsimp [Def] + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + change 2 ≤ (BoundaryColorEdges G phi VT alpha).card + simpa [BaseColor] using htwo + have hBaseP : ∃ g : E, g ∈ BaseColor ∧ Sum.inr g ∈ P := by + by_contra hnone + push Not at hnone + let Inside : Sum V E → Prop + | Sum.inl v => v ∈ VT + | Sum.inr e => ∃ v ∈ VT, Incident G v e + have stepInside : ∀ {z z' : Sum V E}, H.Adj z z' → + Inside z → z ∈ P → Inside z' := by + intro z z' hzz' hz hzP + cases z with + | inl v => + cases z' with + | inl x => simp [H, TwoColorIncidenceGraph] at hzz' + | inr e => + simp only [H, TwoColorIncidenceGraph] at hzz' + exact ⟨v, hz, hzz'.1⟩ + | inr e => + cases z' with + | inl v => + simp only [H, TwoColorIncidenceGraph] at hzz' + by_cases hvVT : v ∈ VT + · exact hvVT + · obtain ⟨x, hxVT, hxe⟩ := hz + have hxv : x ≠ v := by + intro hxv + exact hvVT (hxv ▸ hxVT) + have hends : G.ends e = s(x, v) := + (Sym2.mem_and_mem_iff hxv).mp ⟨hxe, hzz'.1⟩ + have heBoundary : e ∈ BoundaryEdges G VT := by + simp only [BoundaryEdges, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨x, hxVT, v, hvVT, hends⟩ + rcases hzz'.2 with he0 | hea + · exact False.elim ((hVTclosed heBoundary hy0VT he0) + D.alpha0_missing_at_y0) + · exact False.elim (hnone e + (Finset.mem_filter.mpr ⟨heBoundary, hea⟩) hzP) + | inr f => simp [H, TwoColorIncidenceGraph] at hzz' + have componentInside : ∀ z, z ∈ P → Inside z := by + intro z hzP + have hreach : H.Reachable (Sum.inl y0) z := by + apply SimpleGraph.ConnectedComponent.exact + change H.connectedComponentMk z = H.connectedComponentMk (Sum.inl y0) at hzP + exact hzP.symm + clear hzP + rw [SimpleGraph.reachable_iff_reflTransGen] at hreach + induction hreach with + | refl => exact hy0VT + | @tail z z' hreach hlast ih => + have hzP : z ∈ P := by + change H.connectedComponentMk z = H.connectedComponentMk (Sum.inl y0) + exact (SimpleGraph.ConnectedComponent.sound + (by simpa [SimpleGraph.reachable_iff_reflTransGen] using hreach)).symm + exact stepInside hlast ih hzP + obtain ⟨x, hxX, z, hzX, hpEnds⟩ := by + simpa [BoundaryEdges] using hpBoundary + have hzVT : z ∉ VT := fun hz => hzX (hVTsubX hz) + have hzP : Sum.inl z ∈ P := by + change H.connectedComponentMk (Sum.inl z) = + H.connectedComponentMk (Sum.inl y0) + change H.connectedComponentMk (Sum.inr p) = + H.connectedComponentMk (Sum.inl y0) at hpP + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simp [H, TwoColorIncidenceGraph, Incident, hpEnds, hpColor])).trans hpP + exact hzVT (componentInside (Sum.inl z) hzP) + obtain ⟨g, hgBase, hgP⟩ := hBaseP + have hunique : ∀ e : E, e ∈ BoundaryColorEdges G phi VT alpha → + e = g := by + intro e he + exact Finset.card_le_one.mp hBaseColorOne e (by simpa [BaseColor] using he) + g hgBase + exact avoidComponent VT hVTsubX hVTclosed hy0VT g hunique hgP + +private theorem helper_hUeven_520.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → ScheideReplacementData G k + e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + let Pair : ↥Def → Finset V := fun (d : ↥Def) ↦ {(R d).u1, (R d).u2}; + let U : Finset V := Finset.univ.biUnion Pair; + (∀ (d : ↥Def), (Pair d).card = (2 : ℕ)) → Even U.card := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def Pair U hPairCard + have aux : ∀ s : Finset {delta // delta ∈ Def}, + Even (s.biUnion Pair).card := by + intro s + induction s using Finset.induction_on with + | empty => simp + | @insert d s hds ih => + rw [Finset.biUnion_insert] + by_cases heq : ∃ q ∈ s, Pair d = Pair q + · obtain ⟨q, hqs, hdq⟩ := heq + have hsub : Pair d ⊆ s.biUnion Pair := by + intro v hv + exact Finset.mem_biUnion.mpr ⟨q, hqs, by simpa [hdq] using hv⟩ + rw [Finset.union_eq_right.mpr hsub] + exact ih + · have hdisj : Disjoint (Pair d) (s.biUnion Pair) := by + rw [Finset.disjoint_left] + intro v hvd hvU + obtain ⟨q, hqs, hvq⟩ := Finset.mem_biUnion.mp hvU + rcases ScheideReplacementPairsLaminar G k e0 phi T C D R d q with + hdq | hdq + · exact heq ⟨q, hqs, by simpa [Pair, Def] using hdq⟩ + · exact (Finset.disjoint_left.mp + (by simpa [Pair, Def] using hdq)) hvd hvq + rw [Finset.card_union_of_disjoint hdisj, hPairCard d] + rcases ih with ⟨q, hq⟩ + refine ⟨q + 1, ?_⟩ + omega + simpa [U] using aux Finset.univ + +private theorem helper_hinternalUnion_636.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → ScheideReplacementData G k + e0 phi T C D d), + let X : Finset V := ScheideEnlargedVertexSet R; + ∀ (alpha : Fin k), + let edges : Finset E := {e : E | phi e = some alpha}; + let internal : Finset E := {e ∈ edges | ∀ (v : V), Incident G v e → v ∈ X}; + (∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ)) → + (∀ ⦃e : E⦄, e ∈ internal → ∀ ⦃f : E⦄, f ∈ internal → e ≠ f → Disjoint (G.ends + e).toFinset (G.ends f).toFinset) → + (internal.biUnion fun (e : E) ↦ (G.ends e).toFinset).card = (2 : ℕ) * internal.card + := by + classical + intro V E _ _ _ _ G k e0 phi T C D R X alpha edges internal hendcard hinternalDisjoint + have aux : ∀ s : Finset E, s ⊆ internal → + (s.biUnion fun e => (G.ends e).toFinset).card = 2 * s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset + (s.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + have hh := hinternalDisjoint + (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf)) + exact (Finset.disjoint_left.mp hh) hev hvf + rw [Finset.card_union_of_disjoint hd, hendcard] + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem hes] + omega + exact aux internal (by intro e he; exact he) + +private theorem helper_hcover_662.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → ScheideReplacementData G k + e0 phi T C D d), + let X : Finset V := ScheideEnlargedVertexSet R; + ∀ (alpha : Fin k), + let B : Finset E := BoundaryColorEdges G phi X alpha; + (∀ v ∈ X, alpha ∈ PresentColors G phi v) → + let edges : Finset E := {e : E | phi e = some alpha}; + let internal : Finset E := {e ∈ edges | ∀ (v : V), Incident G v e → v ∈ X}; + (∀ (e : E), e ∈ edges ↔ phi e = some alpha) → + (∀ (e : E), e ∈ internal ↔ e ∈ edges ∧ ∀ (v : V), Incident G v e → v ∈ X) → + ∀ v ∈ X, + (v ∈ internal.biUnion fun (e : E) ↦ (G.ends e).toFinset) ∨ + v ∈ B.biUnion fun (e : E) ↦ {w ∈ X | Incident G w e} := by + classical + intro V E _ _ _ _ G k e0 phi T C D R X alpha B hpresent edges internal hedge_mem hinternal v hv + obtain ⟨e, hve, hecolor⟩ := by + simpa [PresentColors] using hpresent v hv + by_cases hall : ∀ w, Incident G w e → w ∈ X + · left + exact Finset.mem_biUnion.mpr + ⟨e, (hinternal e).mpr ⟨(hedge_mem e).mpr hecolor, hall⟩, + Sym2.mem_toFinset.mpr hve⟩ + · right + push Not at hall + obtain ⟨w, hwe, hwX⟩ := hall + obtain ⟨z, hze⟩ := Sym2.mem_iff_exists.mp hwe + have heq : G.ends e = s(w, z) := hze + have hzv : z = v := by + have hvEnds : v = w ∨ v = z := by + have : v ∈ s(w, z) := by rw [← heq]; exact hve + simpa using this + rcases hvEnds with hvw | hvz + · exact False.elim (hwX (hvw ▸ hv)) + · exact hvz.symm + have heboundary : e ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hv, w, hwX, by simpa [hzv] using heq.trans Sym2.eq_swap⟩ + have heB : e ∈ B := by + exact Finset.mem_filter.mpr ⟨heboundary, hecolor⟩ + exact Finset.mem_biUnion.mpr ⟨e, heB, + Finset.mem_filter.mpr ⟨hv, hve⟩⟩ + +private theorem helper_hBunion_721.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → ScheideReplacementData G k + e0 phi T C D d), + let X : Finset V := ScheideEnlargedVertexSet R; + ∀ (alpha : Fin k), + let B : Finset E := BoundaryColorEdges G phi X alpha; + (∀ e ∈ B, {v ∈ X | Incident G v e}.card = (1 : ℕ)) → + (∀ ⦃e : E⦄, e ∈ B → ∀ ⦃f : E⦄, f ∈ B → e ≠ f → Disjoint ({v ∈ X | Incident G v e}) ({v + ∈ X | Incident G v f})) → + (B.biUnion fun (e : E) ↦ {v ∈ X | Incident G v e}).card = B.card := by + classical + intro V E _ _ _ _ G k e0 phi T C D R X alpha B hBfiber hBdisjoint + have aux : + ∀ s : Finset E, s ⊆ B → (s.biUnion fun e => X.filter (fun v => Incident G v e)).card = s.card + := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (X.filter (fun v => Incident G v e)) + (s.biUnion fun f => X.filter (fun v => Incident G v f)) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + exact (Finset.disjoint_left.mp + (hBdisjoint (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf)))) hev hvf + rw [Finset.card_union_of_disjoint hd, + hBfiber e (hs (Finset.mem_insert_self e s))] + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem hes] + exact Nat.add_comm 1 s.card + exact aux B (by intro e he; exact he) + +private theorem helper_hBfiber_785.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → ScheideReplacementData G k + e0 phi T C D d), + let X : Finset V := ScheideEnlargedVertexSet R; + ∀ (alpha : Fin k), + let B : Finset E := BoundaryColorEdges G phi X alpha; + ∀ e ∈ B, {v ∈ X | Incident G v e}.card = (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 phi T C D R X alpha B e he + have heboundary : e ∈ BoundaryEdges G X := + (Finset.mem_filter.mp he).1 + obtain ⟨u, hu, v, hv, huv⟩ := by + simpa [BoundaryEdges] using heboundary + have hs : X.filter (fun x => Incident G x e) = {u} := by + ext x + simp only [Finset.mem_filter, Finset.mem_singleton, Incident, + huv, Sym2.mem_iff] + constructor + · rintro ⟨hx, rfl | hxe⟩ + · exact rfl + · exact False.elim (hv (hxe ▸ hx)) + · intro hxu + subst hxu + exact ⟨hu, Or.inl rfl⟩ + rw [hs] + simp + +private theorem helper_hAW_828.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → ScheideReplacementData G k + e0 phi T C D d), + let X : Finset V := ScheideEnlargedVertexSet R; + IsProperEdgeColoring G phi → + ∀ (alpha : Fin k), + let B : Finset E := BoundaryColorEdges G phi X alpha; + let edges : Finset E := {e : E | phi e = some alpha}; + let internal : Finset E := {e ∈ edges | ∀ (v : V), Incident G v e → v ∈ X}; + (∀ (e : E), e ∈ edges ↔ phi e = some alpha) → + (∀ (e : E), e ∈ internal ↔ e ∈ edges ∧ ∀ (v : V), Incident G v e → v ∈ X) → + let A : Finset V := internal.biUnion fun (e : E) ↦ (G.ends e).toFinset; + let W : Finset V := B.biUnion fun (e : E) ↦ {v ∈ X | Incident G v e}; + Disjoint A W := by + classical + intro V E _ _ _ _ G k e0 phi T C D R X hproper alpha B edges internal hedge_mem hinternal A W + rw [Finset.disjoint_left] + intro v hvA hvW + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hvA + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvW + have hef : e ≠ f := by + intro hef + have hfboundary : f ∈ BoundaryEdges G X := + (Finset.mem_filter.mp hf).1 + obtain ⟨u, hu, w, hw, huw⟩ := by + simpa [BoundaryEdges] using hfboundary + have : w ∈ X := ((hinternal e).mp he).2 w (by + change w ∈ G.ends e + rw [hef, huw] + simp) + exact hw this + exact (hproper hef ⟨v, Sym2.mem_toFinset.mp hve, + (Finset.mem_filter.mp hvf).2⟩ + (hedge_mem e |>.mp (hinternal e |>.mp he).1)) + (Finset.mem_filter.mp hf).2 + +private theorem helper_boundaryOfIncidentSubset_877.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) + (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → ScheideReplacementData G k + e0 phi T C D d), + let X : Finset V := ScheideEnlargedVertexSet R; + ∀ S ⊆ X, ∀ e ∈ BoundaryEdges G X, (∃ v ∈ S, Incident G v e) → e ∈ BoundaryEdges G S := by + classical + intro V E _ _ _ _ G k e0 phi T C D R X S hSX e heX heInc + obtain ⟨x, hxX, z, hzX, hexz⟩ := by + simpa [BoundaryEdges] using heX + obtain ⟨v, hvS, hve⟩ := heInc + have hvEnds : v = x ∨ v = z := by + have : v ∈ s(x, z) := by rw [← hexz]; exact hve + simpa using this + have hvx : v = x := by + rcases hvEnds with hvx | hvz + · exact hvx + · exact False.elim (hzX (hSX (hvz ▸ hvS))) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hvS, z, fun hzS => hzX (hSX hzS), by simpa [hvx] using hexz⟩ + +private theorem helper_edgeColorOfP_914.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi T C), + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + ∀ (alpha : Fin k), + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi D.alpha0 alpha; + let P : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0); + ∀ (e : E), Sum.inr e ∈ P → phi e = some D.alpha0 ∨ phi e = some alpha := by + classical + intro V E _ _ _ G k e0 phi T C D y0 alpha H P e heP + have hs : Sum.inr e ∈ H.support := by + apply SimpleGraph.mem_support_of_reachable (v := Sum.inl y0) + · simp + · change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr e) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl y0) at heP + exact SimpleGraph.ConnectedComponent.eq.mp heP + obtain ⟨z, hz⟩ := H.mem_support.mp hs + cases z with + | inl v => simpa [H, TwoColorIncidenceGraph] using hz.2 + | inr f => simp [H, TwoColorIncidenceGraph] at hz + +private theorem helper_continuation_896.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let X : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + let Pair : ↥Def → Finset V := fun (d : ↥Def) ↦ {(R d).u1, (R d).u2}; + let U : Finset V := Finset.univ.biUnion Pair; ColoredVertexSetClosed G phi VT → + ColoredVertexSetClosed G phi X → X = VT ∪ U → + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); y0 ∈ VT → + VT ⊆ X → y0 ∈ X → + ∀ (alpha : Fin k), + let B : Finset E := BoundaryColorEdges G phi X alpha; ( + ∀ v ∈ X, alpha ∈ PresentColors G phi v) → alpha ≠ D.alpha0 → + let edges : Finset E := {e : E | phi e = some alpha}; + let internal : Finset E := {e ∈ edges | + ∀ (v : V), Incident G v e → v ∈ X}; (B.biUnion fun (e : E) ↦ {v ∈ X | Incident G v e}).card = + B.card → X.card = (2 : ℕ) * internal.card + B.card → (3 : ℕ) ≤ B.card → ( + ∀ (a : ↥Def), Pair a ⊆ X) → ( + ∀ (a : ↥Def), + ∀ e ∈ BoundaryColorEdges G phi (VT ∪ Pair a) (↑a : Fin k), e = D.f0 a) → + let BaseB : Finset E := {e ∈ B | + ∃ v ∈ VT, Incident G v e}; BaseB.card ≤ (1 : ℕ) → + let OutB : Finset E := {e ∈ B | ¬ + ∃ v ∈ VT, Incident G v e}; BaseB.card + OutB.card = B.card → + ∃ (alpha : Fin k) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (f : E) (w : V) (u + : V), alpha ≠ D.alpha0 ∧ phi f = some alpha ∧ G.ends f = s(w, u) ∧ w ∈ + ScheideEnlargedVertexSet R ∧ w ∉ TreeSequenceVertexSet T ∧ u ∉ ScheideEnlargedVertexSet R + ∧ (w = (R d).u1 ∨ w = (R d).u2) ∧ Sum.inr f ∈ TwoColorComponent G phi D.alpha0 alpha + (Sum.inl u) ∧ + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∉ TwoColorComponent G phi D.alpha0 alpha (Sum.inl u) + := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def Pair U hVTclosed hXclosed hXeq y0 hy0VT hVTsubX + hy0X alpha B hpresent halpha edges internal hBunion hcardeq hBthree hPairSubX hDefUnique + BaseB hBaseBone OutB hpartition + have hOutBtwo : 2 ≤ OutB.card := by omega + let H := TwoColorIncidenceGraph G phi D.alpha0 alpha + let P := TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0) + obtain ⟨p, hp, hpUnique⟩ := + ScheideSingleBoundaryCrossing G k e0 phi T C D R alpha + (by simpa [X] using hpresent) + have hpBoundary : p ∈ BoundaryEdges G X := by simpa [X] using hp.1 + have hpP : Sum.inr p ∈ P := by simpa [P, y0] using hp.2 + have edgeColorOfP : ∀ e : E, Sum.inr e ∈ P → + phi e = some D.alpha0 ∨ phi e = some alpha := by + exact @helper_edgeColorOfP_914 V E inferInstance inferInstance inferInstance G k e0 phi T C D + alpha + have hpColor : phi p = some alpha := by + rcases edgeColorOfP p hpP with hp0 | hpa + · exact False.elim ((hXclosed hpBoundary hy0X hp0) + D.alpha0_missing_at_y0) + · exact hpa + have hpB : p ∈ B := Finset.mem_filter.mpr ⟨hpBoundary, hpColor⟩ + have hchoose : ∃ f : E, f ∈ OutB ∧ f ≠ p := by + by_contra hnone + push Not at hnone + have hle : OutB.card ≤ 1 := by + apply Finset.card_le_one.mpr + intro e he f hf + exact (hnone e he).trans (hnone f hf).symm + omega + obtain ⟨f, hfOut, hfp⟩ := hchoose + have hfB : f ∈ B := (Finset.mem_filter.mp hfOut).1 + have hfNoBase : ¬ ∃ v ∈ VT, Incident G v f := + (Finset.mem_filter.mp hfOut).2 + have hfBoundary : f ∈ BoundaryEdges G X := + (Finset.mem_filter.mp hfB).1 + have hfColor : phi f = some alpha := + (Finset.mem_filter.mp hfB).2 + obtain ⟨w, hwX, u, huX, hfEnds⟩ := by + simpa [BoundaryEdges] using hfBoundary + have hwVT : w ∉ VT := by + intro hw + exact hfNoBase ⟨w, hw, by change w ∈ G.ends f; rw [hfEnds]; simp⟩ + have hwU : w ∈ U := by + rw [hXeq] at hwX + exact (Finset.mem_union.mp hwX).resolve_left hwVT + obtain ⟨d, _, hwd⟩ := Finset.mem_biUnion.mp hwU + have hwPair : w = (R d).u1 ∨ w = (R d).u2 := by + simpa [Pair] using hwd + let Q := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u) + have hfQ : Sum.inr f ∈ Q := by + change H.connectedComponentMk (Sum.inr f) = + H.connectedComponentMk (Sum.inl u) + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [H, TwoColorIncidenceGraph, Incident, hfEnds, hfColor] + have hfNotP : Sum.inr f ∉ P := by + intro hfP + have hpf : f = p := hpUnique f ⟨by simpa [X] using hfBoundary, + by simpa [P, y0] using hfP⟩ + exact hfp hpf + have hPQ : ∀ z, z ∈ P → z ∉ Q := by + intro z hzP hzQ + apply hfNotP + change H.connectedComponentMk (Sum.inr f) = + H.connectedComponentMk (Sum.inl y0) + change H.connectedComponentMk (Sum.inr f) = + H.connectedComponentMk (Sum.inl u) at hfQ + change H.connectedComponentMk z = H.connectedComponentMk (Sum.inl u) at hzQ + change H.connectedComponentMk z = H.connectedComponentMk (Sum.inl y0) at hzP + exact hfQ.trans (hzQ.symm.trans hzP) + have avoidComponent : + ∀ (S : Finset V), S ⊆ X → ColoredVertexSetClosed G phi S → y0 ∈ S → + ∀ (g : E), ( + ∀ e : E, e ∈ BoundaryColorEdges G phi S alpha → e = g) → Sum.inr g ∈ P → + ∀ v ∈ S, Sum.inl v ∉ Q := by + exact @helper_avoidComponent_658 V E inferInstance inferInstance inferInstance inferInstance + G k e0 phi T C D R alpha f u huX hPQ + have hQavoidVT : ∀ v ∈ VT, Sum.inl v ∉ Q := by + exact @helper_hQavoidVT_727 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D R hVTclosed hy0VT hVTsubX alpha hPairSubX hDefUnique p hpBoundary hpP + hpColor f u avoidComponent + refine ⟨alpha, d, f, w, u, halpha, hfColor, hfEnds, ?_, hwVT, huX, + hwPair, hfQ, ?_⟩ + · simpa [X] using hwX + · intro v hv + exact hQavoidVT v hv + +private theorem helper_continuation_878.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let X : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + let Pair : ↥Def → Finset V := fun (d : ↥Def) ↦ {(R d).u1, (R d).u2}; + let U : Finset V := Finset.univ.biUnion Pair; IsProperEdgeColoring G phi → + ColoredVertexSetClosed G phi VT → ColoredVertexSetClosed G phi X → X = VT ∪ U → Odd X.card + → + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); y0 ∈ VT → + VT ⊆ X → y0 ∈ X → + ∀ (alpha : Fin k), + let B : Finset E := BoundaryColorEdges G phi X alpha; (2 : ℕ) ≤ B.card → ( + ∀ v ∈ X, alpha ∈ PresentColors G phi v) → alpha ≠ D.alpha0 → + let edges : Finset E := {e : E | phi e = some alpha}; + let _ : Finset E := {e ∈ edges | + ∀ (v : V), Incident G v e → v ∈ X}; ( + ∀ (e : E), e ∈ edges ↔ phi e = some alpha) → + ∃ (alpha : Fin k) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (f : E) (w : V) (u + : V), alpha ≠ D.alpha0 ∧ phi f = some alpha ∧ G.ends f = s(w, u) ∧ w ∈ + ScheideEnlargedVertexSet R ∧ w ∉ TreeSequenceVertexSet T ∧ u ∉ ScheideEnlargedVertexSet R + ∧ (w = (R d).u1 ∨ w = (R d).u2) ∧ Sum.inr f ∈ TwoColorComponent G phi D.alpha0 alpha + (Sum.inl u) ∧ + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∉ TwoColorComponent G phi D.alpha0 alpha (Sum.inl u) + := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def Pair U hproper hVTclosed hXclosed hXeq hXodd y0 + hy0VT hVTsubX hy0X alpha B hBtwo hpresent halpha edges internal hedge_mem + have hinternal : ∀ e, e ∈ internal ↔ + e ∈ edges ∧ ∀ v, Incident G v e → v ∈ X := by + intro e + simp [internal] + have hendcard : ∀ e : E, (G.ends e).toFinset.card = 2 := by + intro e + apply Sym2.card_toFinset_of_not_isDiag + intro hd + exact G.loopless e ((G.ends e).diagElem hd) + (Sym2.diag_diagElem hd).symm + have hinternalDisjoint : ∀ ⦃e⦄, e ∈ internal → ∀ ⦃f⦄, + f ∈ internal → e ≠ f → + Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + exact (hproper hef + ⟨v, Sym2.mem_toFinset.mp hev, Sym2.mem_toFinset.mp hvf⟩ + (hedge_mem e |>.mp (hinternal e |>.mp he).1)) + (hedge_mem f |>.mp (hinternal f |>.mp hf).1) + have hinternalUnion : + (internal.biUnion fun e => (G.ends e).toFinset).card = + 2 * internal.card := by + exact @helper_hinternalUnion_636 V E inferInstance inferInstance inferInstance inferInstance + G k e0 phi T C D R alpha hendcard hinternalDisjoint + have hcover : ∀ v, v ∈ X → + v ∈ internal.biUnion (fun e => (G.ends e).toFinset) ∨ + v ∈ B.biUnion (fun e => X.filter (fun w => Incident G w e)) := by + exact @helper_hcover_662 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D R alpha hpresent hedge_mem hinternal + have hBfiber : ∀ e, e ∈ B → + (X.filter (fun v => Incident G v e)).card = 1 := by + exact @helper_hBfiber_785 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D R alpha + have hBdisjoint : ∀ ⦃e⦄, e ∈ B → ∀ ⦃f⦄, f ∈ B → e ≠ f → + Disjoint (X.filter (fun v => Incident G v e)) + (X.filter (fun v => Incident G v f)) := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + exact (hproper hef ⟨v, (Finset.mem_filter.mp hev).2, + (Finset.mem_filter.mp hvf).2⟩ + (Finset.mem_filter.mp he).2) (Finset.mem_filter.mp hf).2 + have hBunion : + (B.biUnion fun e => X.filter (fun v => Incident G v e)).card = + B.card := by + exact @helper_hBunion_721 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D R alpha hBfiber hBdisjoint + let A := internal.biUnion (fun e => (G.ends e).toFinset) + let W := B.biUnion (fun e => X.filter (fun v => Incident G v e)) + have hA : A ⊆ X := by + intro v hv + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hv + exact ((hinternal e).mp he).2 v (Sym2.mem_toFinset.mp hve) + have hW : W ⊆ X := by + intro v hv + obtain ⟨e, _, hve⟩ := Finset.mem_biUnion.mp hv + exact (Finset.mem_filter.mp hve).1 + have hAW : Disjoint A W := by + exact @helper_hAW_828 V E inferInstance inferInstance inferInstance inferInstance G k e0 phi + T C D R hproper alpha hedge_mem hinternal + have hAX : A ∪ W = X := by + apply Finset.Subset.antisymm + · exact Finset.union_subset hA hW + · intro v hv + rcases hcover v hv with hvA | hvW + · exact Finset.mem_union.mpr (Or.inl hvA) + · exact Finset.mem_union.mpr (Or.inr hvW) + have hcardeq : X.card = 2 * internal.card + B.card := by + rw [← hAX, Finset.card_union_of_disjoint hAW, + hinternalUnion, hBunion] + have hBodd : Odd B.card := by + rcases hXodd with ⟨q, hq⟩ + have hile : internal.card ≤ q := by omega + refine ⟨q - internal.card, ?_⟩ + omega + have hBthree : 3 ≤ B.card := by + rcases hBodd with ⟨q, hq⟩ + omega + have hblockVT : ∀ (a : {delta // delta ∈ Def}) (j : Fin 2), + C.blockVertex (D.gammaIndex a) j ∈ VT := by + intro a j + rw [← C.block_vertex_position (D.gammaIndex a) j] + simp [VT, TreeSequenceVertexSet] + have hPairSubX : ∀ a : {delta // delta ∈ Def}, Pair a ⊆ X := by + intro a v hv + rw [hXeq] + apply Finset.mem_union_right + exact Finset.mem_biUnion.mpr ⟨a, Finset.mem_univ _, hv⟩ + have boundaryOfIncidentSubset : ∀ (S : Finset V), S ⊆ X → + ∀ (e : E), e ∈ BoundaryEdges G X → + (∃ v ∈ S, Incident G v e) → e ∈ BoundaryEdges G S := by + exact @helper_boundaryOfIncidentSubset_877 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D R + have hDefUnique : ∀ a : {delta // delta ∈ Def}, + ∀ e : E, e ∈ BoundaryColorEdges G phi (VT ∪ Pair a) a.1 → + e = D.f0 a := by + exact @helper_hDefUnique_410 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D R hproper hblockVT + let BaseB := B.filter (fun e => ∃ v ∈ VT, Incident G v e) + have hBaseBone : BaseB.card ≤ 1 := by + exact @helper_hBaseBone_523 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D R hVTsubX alpha hPairSubX boundaryOfIncidentSubset hDefUnique + let OutB := B.filter (fun e => ¬ ∃ v ∈ VT, Incident G v e) + have hpartition : BaseB.card + OutB.card = B.card := by + simpa [BaseB, OutB] using + (Finset.card_filter_add_card_filter_not + (s := B) (fun e => ∃ v ∈ VT, Incident G v e)) + exact @helper_continuation_896 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D R hVTclosed hXclosed hXeq hy0VT hVTsubX hy0X alpha hpresent halpha hBunion + hcardeq hBthree hPairSubX hDefUnique hBaseBone hpartition +theorem ScheideEnlargedBoundarySelection {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) + (hnot : ¬ ColoredVertexSetStronglyClosed G phi + (ScheideEnlargedVertexSet R)) : + ∃ (alpha : Fin k) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (f : E) (w u : V), + alpha ≠ D.alpha0 ∧ + phi f = some alpha ∧ + G.ends f = s(w, u) ∧ + w ∈ ScheideEnlargedVertexSet R ∧ + w ∉ TreeSequenceVertexSet T ∧ + u ∉ ScheideEnlargedVertexSet R ∧ + (w = (R d).u1 ∨ w = (R d).u2) ∧ + Sum.inr f ∈ TwoColorComponent G phi D.alpha0 alpha (Sum.inl u) ∧ + ∀ v ∈ TreeSequenceVertexSet T, + Sum.inl v ∉ TwoColorComponent G phi D.alpha0 alpha (Sum.inl u) := by + classical + let VT := TreeSequenceVertexSet T + let X := ScheideEnlargedVertexSet R + let Def := DefectiveColors G phi VT + let Pair : {delta // delta ∈ Def} → Finset V := + fun d => {(R d).u1, (R d).u2} + let U := Finset.univ.biUnion Pair + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have hVTclosed : ColoredVertexSetClosed G phi VT := + (ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).2.2.2.2 + have hVTodd : Odd VT.card := + (ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).2.2.1 + have hXclosed : ColoredVertexSetClosed G phi X := by + change ColoredVertexSetClosed G phi (ScheideEnlargedVertexSet R) + exact ScheideEnlargedClosed G k e0 phi T C D R + have hPairCard : ∀ d : {delta // delta ∈ Def}, (Pair d).card = 2 := by + intro d + obtain ⟨g, _, hg⟩ := + (ScheideSymmetricDefectiveInternal G k e0 phi T C D d (R d)).2 + have hne : (R d).u1 ≠ (R d).u2 := by + intro h + exact G.loopless g (R d).u1 (by simpa [h] using hg) + simp [Pair, hne] + have hPairOutside : ∀ d : {delta // delta ∈ Def}, + Disjoint VT (Pair d) := by + intro d + rw [Finset.disjoint_left] + intro v hvT hvPair + simp only [Pair, Finset.mem_insert, Finset.mem_singleton] at hvPair + rcases hvPair with rfl | rfl + · exact (R d).u1_outside hvT + · exact (R d).u2_outside hvT + have hUeven : Even U.card := by + exact @helper_hUeven_520 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D R hPairCard + have hVTU : Disjoint VT U := by + rw [Finset.disjoint_left] + intro v hvT hvU + obtain ⟨d, _, hvd⟩ := Finset.mem_biUnion.mp hvU + exact (Finset.disjoint_left.mp (hPairOutside d)) hvT hvd + have hXeq : X = VT ∪ U := by + simp [X, VT, U, Pair, Def, ScheideEnlargedVertexSet] + have hXodd : Odd X.card := by + rw [hXeq, Finset.card_union_of_disjoint hVTU] + rcases hVTodd with ⟨a, ha⟩ + rcases hUeven with ⟨b, hb⟩ + refine ⟨a + b, ?_⟩ + omega + let y0 : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hy0VT : y0 ∈ VT := by + have hpos : (0 : ℕ) < T.length + 1 := by omega + have hv := C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [y0, VT, TreeSequenceVertexSet] using + (show ∃ i : Fin (T.length + 1), T.vertex i = y0 from + ⟨⟨0, hpos⟩, by simpa [y0] using hv⟩) + have hVTsubX : VT ⊆ X := by + intro v hv + rw [hXeq] + exact Finset.mem_union_left _ hv + have hy0X : y0 ∈ X := hVTsubX hy0VT + have hnotSep : ¬ ∀ {f g c}, f ∈ BoundaryEdges G X → + g ∈ BoundaryEdges G X → f ≠ g → phi f = some c → + phi g ≠ some c := by + intro hsep + exact hnot ⟨hXclosed, hsep⟩ + push Not at hnotSep + obtain ⟨b0, b1, alpha, hb0Boundary, hb1Boundary, hb01, + hb0Color, hb1Color⟩ := hnotSep + let B := BoundaryColorEdges G phi X alpha + have hb0B : b0 ∈ B := by + exact Finset.mem_filter.mpr ⟨hb0Boundary, hb0Color⟩ + have hb1B : b1 ∈ B := by + exact Finset.mem_filter.mpr ⟨hb1Boundary, hb1Color⟩ + have hBtwo : 2 ≤ B.card := by + have hpair : ({b0, b1} : Finset E).card = 2 := by simp [hb01] + rw [← hpair] + apply Finset.card_le_card + intro f hf + simp only [Finset.mem_insert, Finset.mem_singleton] at hf + rcases hf with rfl | rfl + · exact hb0B + · exact hb1B + have hpresent : ∀ v, v ∈ X → alpha ∈ PresentColors G phi v := by + intro v hv + have hn : alpha ∉ MissingColors G phi v := by + intro hm + exact (hXclosed hb0Boundary hv hb0Color) hm + simpa [MissingColors] using hn + have halpha : alpha ≠ D.alpha0 := by + intro h + have hp := hpresent y0 hy0X + have hn : D.alpha0 ∉ PresentColors G phi y0 := by + simpa [MissingColors] using D.alpha0_missing_at_y0 + exact hn (h ▸ hp) + let edges := (Finset.univ : Finset E).filter (fun e => phi e = some alpha) + let internal := edges.filter (fun e => ∀ v, Incident G v e → v ∈ X) + have hedge_mem : ∀ e, e ∈ edges ↔ phi e = some alpha := by + intro e + simp [edges] + exact @helper_continuation_878 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D R hproper hVTclosed hXclosed hXeq hXodd hy0VT hVTsubX hy0X alpha hBtwo + hpresent halpha hedge_mem +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideEnlargedClosed.lean b/LeanPool/GoldbergSeymour/ScheideEnlargedClosed.lean new file mode 100644 index 0000000000..0bb44b7c84 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideEnlargedClosed.lean @@ -0,0 +1,1067 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.ClosedSetTwoColorComponentAvoidance +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideEnlargedElementary +public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideReplacementPairsLaminar +public import LeanPool.GoldbergSeymour.ScheideReplacementUnionClosed +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper + +/-! +# Scheide Enlarged Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_69.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let X : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ u ∈ X, u ∉ VT → + ∃ (d : ↥Def), u ∈ VT ∪ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V) := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def u huX huT + have huPairs : u ∈ Finset.univ.biUnion + (fun d : {delta // delta ∈ Def} => {(R d).u1, (R d).u2}) := by + simpa [X, VT, Def, ScheideEnlargedVertexSet, huT] using huX + simp only [Finset.mem_biUnion, Finset.mem_univ, true_and] at huPairs + obtain ⟨d, hud⟩ := huPairs + exact ⟨d, Finset.mem_union_right _ hud⟩ + +private theorem helper_hXdSub_76.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let X : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ (d : ↥Def), + let Xd : Finset V := VT ∪ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V); Xd ⊆ X := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def d Xd v hv + simp only [Xd, Finset.mem_union, Finset.mem_insert, + Finset.mem_singleton] at hv + rcases hv with hvT | hv1 | hv2 + · exact Finset.mem_union_left _ hvT + · unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_right + apply Finset.mem_biUnion.mpr + exact ⟨d, Finset.mem_univ _, by simp [hv1]⟩ + · unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_right + apply Finset.mem_biUnion.mpr + exact ⟨d, Finset.mem_univ _, by simp [hv2]⟩ + +private theorem helper_hclosedD_95.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ (d : ↥Def), + let Xd : Finset V := VT ∪ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V); + ColoredVertexSetClosed G phi Xd := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def d Xd + unfold ColoredVertexSetClosed + intro g c v hg hv hgc + exact ScheideReplacementUnionClosed G k e0 phi T C D d (R d) + (by simpa only [Xd, VT] using hg) + (by simpa only [Xd, VT] using hv) hgc + +private theorem helper_hpairsDisjoint_112.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {x : V} (d : ↥Def), + let Xd : Finset V := VT ∪ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V); x ∉ Xd → + ∀ (d' : ↥Def), x ∈ (insert (R d').u1 ({(R d').u2} : Finset V) : Finset V) → Disjoint (insert + (R d).u1 ({(R d).u2} : Finset V) : Finset V) (insert (R d').u1 ({(R d').u2} : Finset V) : + Finset V) := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def x d Xd hxNotXd d' hxd' + rcases ScheideReplacementPairsLaminar G k e0 phi T C D R d d' with + heq | hdisj + · exfalso + apply hxNotXd + apply Finset.mem_union_right + rw [heq] + exact hxd' + · exact hdisj + +private theorem helper_hXd'Sub_123.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let X : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ (d' : ↥Def), + let Xd' : Finset V := VT ∪ (insert (R d').u1 ({(R d').u2} : Finset V) : Finset V); Xd' ⊆ X := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def d' Xd' v hv + simp only [Xd', Finset.mem_union, Finset.mem_insert, + Finset.mem_singleton] at hv + rcases hv with hvT | hv1 | hv2 + · exact Finset.mem_union_left _ hvT + · unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_right + apply Finset.mem_biUnion.mpr + exact ⟨d', Finset.mem_univ _, by simp [hv1]⟩ + · unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_right + apply Finset.mem_biUnion.mpr + exact ⟨d', Finset.mem_univ _, by simp [hv2]⟩ + +private theorem helper_hclosedD_138.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ (d' : ↥Def), + let Xd' : Finset V := VT ∪ (insert (R d').u1 ({(R d').u2} : Finset V) : Finset V); + ColoredVertexSetClosed G phi Xd' := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def d' Xd' + unfold ColoredVertexSetClosed + intro g c v hg hv hgc + exact ScheideReplacementUnionClosed G k e0 phi T C D d' (R d') + (by simpa only [Xd', VT] using hg) + (by simpa only [Xd', VT] using hv) hgc + +private theorem helper_huNotT_145.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {f : E} {alpha : Fin k} {x : V}, phi f = some alpha → alpha ∈ MissingColors G phi x → + ∀ (u w : V), G.ends f = s(u, w) → + ∀ (d' : ↥Def), + let Xd' : Finset V := VT ∪ (insert (R d').u1 ({(R d').u2} : Finset V) : Finset V); w ∉ Xd' → + ColoredVertexSetClosed G phi Xd' → x ∈ Xd' → u ∉ VT := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def f alpha x hfalpha hmiss u w hfends d' Xd' hwXd' + hclosedD' hxXd' huT + have hfXd' : f ∈ BoundaryEdges G Xd' := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, Finset.mem_union_left _ huT, w, hwXd', hfends⟩ + exact (hclosedD' hfXd' hxXd' hfalpha) hmiss + +private theorem helper_alphaNotBlock_189.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let X : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {alpha : Fin k} {x : V}, x ∈ ScheideEnlargedVertexSet R → alpha ∈ MissingColors G phi x → + ∀ (d : ↥Def), + let Xd : Finset V := VT ∪ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V); Xd ⊆ X → x ∉ + VT → + ∀ (i : Fin C.s), alpha ≠ C.gamma i := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def alpha x hx hmiss d Xd hXdSub hxNotT i h + obtain ⟨q, hq⟩ := C.block_color_missing_on_base i + have hyqT : C.y q ∈ VT := by + have hlen := C.length_eq + have hpos : q.val < T.length + 1 := by omega + have hv := C.base_vertex_position q + simpa [VT, TreeSequenceVertexSet] using + (show ∃ j : Fin (T.length + 1), T.vertex j = C.y q from + ⟨⟨q.val, hpos⟩, by simpa using hv⟩) + have hyqX : C.y q ∈ X := hXdSub (Finset.mem_union_left _ hyqT) + have hyqne : C.y q ≠ x := by + intro heq + exact hxNotT (heq ▸ hyqT) + have hdisj := ScheideEnlargedElementary G k e0 phi T C D R + hyqX hx hyqne + exact (Finset.disjoint_left.mp hdisj) hq (h.symm ▸ hmiss) + +private theorem helper_pairDOutsideD_206.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ (d d' : ↥Def), Disjoint (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V) (insert (R + d').u1 ({(R d').u2} : Finset V) : Finset V) → + let Xd' : Finset V := VT ∪ (insert (R d').u1 ({(R d').u2} : Finset V) : Finset V); + ∀ v ∈ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V), v ∉ Xd' := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def d d' hpairsDisjoint Xd' v hvD hvD' + simp only [Xd', Finset.mem_union] at hvD' + rcases hvD' with hvT | hvPair + · simp only [Finset.mem_insert, Finset.mem_singleton] at hvD + rcases hvD with rfl | rfl + · exact (R d).u1_outside hvT + · exact (R d).u2_outside hvT + · exact (Finset.disjoint_left.mp hpairsDisjoint) hvD hvPair + +private theorem helper_hf1Boundary_216.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ (d d' : ↥Def), + let Xd' : Finset V := VT ∪ (insert (R d').u1 ({(R d').u2} : Finset V) : Finset V); ( + ∀ v ∈ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V), v ∉ Xd') → (R d).f1 ∈ + BoundaryEdges G Xd' := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def d d' Xd' pairDOutsideD' + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨(R d).v1, Finset.mem_union_left _ + (Finset.mem_sdiff.mp (R d).v1_in_remainder).1, + (R d).u1, ?_, (R d).f1_ends⟩ + exact pairDOutsideD' (R d).u1 (by simp) + +private theorem helper_gammaNeDelta_230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ (d : ↥Def), C.gamma (D.gammaIndex d) ≠ (↑d : Fin k) := by + classical + intro V E _ _ _ G k e0 phi T C D VT Def d h + have hnotPresent : C.gamma (D.gammaIndex d) ∉ + PresentColors G phi (D.v0 d) := by + simpa [MissingColors] using D.gamma_missing_at_v0 d + apply hnotPresent + unfold PresentColors + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨D.f0 d, ?_, ?_⟩ + · unfold Incident + rw [D.f0_ends] + simp + · exact h.symm ▸ D.f0_color d + +private theorem helper_hfirstOther_253.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi T C), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ (d : ↥Def), + C.gamma (D.gammaIndex d) ≠ (↑d : Fin k) → + let phiD : PartialEdgeColoring E k := + TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)); + ∀ (e : E) (c : Fin k), c ≠ C.gamma (D.gammaIndex d) → c ≠ (↑d : Fin k) → (phiD e = some + c ↔ phi e = some c) := by + classical + intro V E _ _ _ G k e0 phi T C D VT Def d gammaNeDelta phiD e c hcGamma hcDelta + by_cases he : Sum.inr e ∈ TwoColorComponent G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + · by_cases heGamma : phi e = some (C.gamma (D.gammaIndex d)) + · have hvalue : phiD e = some d.1 := by + simp [phiD, TwoColorComponentSwap, he, heGamma] + rw [hvalue, heGamma] + simp [hcGamma.symm, hcDelta.symm] + · by_cases heDelta : phi e = some d.1 + · have hvalue : phiD e = some (C.gamma (D.gammaIndex d)) := by + simp [phiD, TwoColorComponentSwap, he, heDelta, + gammaNeDelta.symm] + rw [hvalue, heDelta] + simp [hcGamma.symm, hcDelta.symm] + · simp [phiD, TwoColorComponentSwap, he, heGamma, heDelta] + · simp [phiD, TwoColorComponentSwap, he] + +private theorem helper_hgraph_278.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {alpha : Fin k} (_ : V) (d : ↥Def), + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); ( + ∀ (e : E), (phiD e = some D.alpha0 ↔ phi e = some D.alpha0) ∧ (phiD e = some alpha ↔ phi e = + some alpha)) → TwoColorIncidenceGraph G phiD D.alpha0 alpha = TwoColorIncidenceGraph G phi + D.alpha0 alpha := by + classical + intro V E _ _ _ G k e0 phi T C D VT Def alpha w d phiD hfirstFixed + ext z z' + cases z with + | inl v => + cases z' with + | inl w => simp [TwoColorIncidenceGraph] + | inr e => + simp only [TwoColorIncidenceGraph] + rw [(hfirstFixed e).1, (hfirstFixed e).2] + | inr e => + cases z' with + | inl v => + simp only [TwoColorIncidenceGraph] + rw [(hfirstFixed e).1, (hfirstFixed e).2] + | inr g => simp [TwoColorIncidenceGraph] + +private theorem helper_hcomponent_294.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {alpha : Fin k} (u : V) (d : ↥Def), + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); TwoColorIncidenceGraph G phiD D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha → TwoColorComponent G phiD D.alpha0 alpha + (Sum.inl u) = K := by + classical + intro V E _ _ _ G k e0 phi T C D VT Def alpha u d K phiD hgraph + change ((TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl u)).supp = + ((TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl u)).supp + rw [hgraph] + +private theorem helper_hrepEdgeAvoid_300.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {alpha : Fin k} (u : V) (d d' : ↥Def), + let Xd' : Finset V := VT ∪ (insert (R d').u1 ({(R d').u2} : Finset V) : Finset V); + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); ( + ∀ (e : E), ( + ∃ v ∈ Xd', Incident G v e) → Sum.inr e ∉ K) → + ∀ (r : Fin (R d).replacementTree.length), Sum.inr ((R d).replacementTree.edge r) ∉ K := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def alpha u d d' Xd' K hKavoidE r + apply hKavoidE ((R d).replacementTree.edge r) + have hmem : (R d).replacementTree.edge r ∈ + Finset.univ.image (R d).replacementTree.edge := by simp + rw [(R d).replacement_edges] at hmem + rcases Finset.mem_union.mp hmem with hold | hnew + · have hold' : (R d).replacementTree.edge r ∈ + Finset.univ.image T.edge := + (Finset.mem_erase.mp (Finset.mem_erase.mp hold).2).2 + obtain ⟨q, _, hq⟩ := Finset.mem_image.mp hold' + obtain ⟨i, hi⟩ := T.attaches q + refine ⟨T.vertex q.succ, Finset.mem_union_left _ ?_, ?_⟩ + · simp [VT, TreeSequenceVertexSet] + · unfold Incident + rw [← hq, hi] + simp + · simp only [Finset.mem_insert, Finset.mem_singleton] at hnew + rcases hnew with hnew | hnew + · refine ⟨(R d).v1, Finset.mem_union_left _ + (Finset.mem_sdiff.mp (R d).v1_in_remainder).1, ?_⟩ + unfold Incident + rw [hnew, (R d).f1_ends] + simp + · refine ⟨(R d).v2, Finset.mem_union_left _ + (Finset.mem_sdiff.mp (R d).v2_in_remainder).1, ?_⟩ + unfold Incident + rw [hnew, (R d).f2_ends] + simp + +private theorem helper_pairMissingFixed_380.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {alpha : Fin k} (u : V) (d : ↥Def), + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) = K → + ( + ∀ q ∈ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V), D.alpha0 ∉ MissingColors G phiD q + ∧ alpha ∉ MissingColors G phiD q) → + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u); + (( + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) → MissingColors G + (TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u)) v = MissingColors G phiD v) ∧ ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) → D.alpha0 ∈ + MissingColors G phiD v → alpha ∈ MissingColors G (TwoColorComponentSwap G phiD D.alpha0 + alpha (Sum.inl u)) v) ∧ ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) → alpha ∈ + MissingColors G phiD v → D.alpha0 ∈ MissingColors G (TwoColorComponentSwap G phiD D.alpha0 + alpha (Sum.inl u)) v) ∧ + ∀ (v : V) (c : Fin k), c ≠ D.alpha0 → c ≠ alpha → (c ∈ MissingColors G (TwoColorComponentSwap + G phiD D.alpha0 alpha (Sum.inl u)) v ↔ c ∈ MissingColors G phiD v)) → + ∀ q ∈ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V), MissingColors G psi q = + MissingColors G phiD q := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def alpha u d K phiD hcomponent pairNotMissing psi + hbehaviorPsi q hq + by_cases hqK : Sum.inl q ∈ K + · have hqKD : Sum.inl q ∈ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) := by + rw [hcomponent] + exact hqK + have hnotOld := pairNotMissing q hq + have alphaPresent : alpha ∈ PresentColors G phiD q := by + simpa [MissingColors] using hnotOld.2 + obtain ⟨ea, heaInc, heaColor⟩ := by + simpa [PresentColors] using alphaPresent + have heaK : Sum.inr ea ∈ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) := by + change (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inr ea) = + (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl u) + have hadj : (TwoColorIncidenceGraph G phiD D.alpha0 alpha).Adj + (Sum.inr ea) (Sum.inl q) := by + simp [TwoColorIncidenceGraph, heaInc, heaColor] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans + hqKD + have alpha0PresentNew : D.alpha0 ∈ PresentColors G psi q := by + unfold PresentColors + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨ea, heaInc, ?_⟩ + simp [psi, TwoColorComponentSwap, heaK, heaColor] + have alpha0NotNew : D.alpha0 ∉ MissingColors G psi q := by + simpa [MissingColors] using alpha0PresentNew + have alpha0Present : D.alpha0 ∈ PresentColors G phiD q := by + simpa [MissingColors] using hnotOld.1 + obtain ⟨e0, he0Inc, he0Color⟩ := by + simpa [PresentColors] using alpha0Present + have he0K : Sum.inr e0 ∈ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) := by + change (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inr e0) = + (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl u) + have hadj : (TwoColorIncidenceGraph G phiD D.alpha0 alpha).Adj + (Sum.inr e0) (Sum.inl q) := by + simp [TwoColorIncidenceGraph, he0Inc, he0Color] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans + hqKD + have alphaPresentNew : alpha ∈ PresentColors G psi q := by + unfold PresentColors + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨e0, he0Inc, ?_⟩ + simp [psi, TwoColorComponentSwap, he0K, he0Color] + have alphaNotNew : alpha ∉ MissingColors G psi q := by + simpa [MissingColors] using alphaPresentNew + apply Finset.ext + intro c + by_cases hc0 : c = D.alpha0 + · subst c + simp [hnotOld.1, alpha0NotNew] + · by_cases hca : c = alpha + · subst c + simp [hnotOld.2, alphaNotNew] + · exact hbehaviorPsi.2.2.2 q c hc0 hca + · apply hbehaviorPsi.1 + rw [hcomponent] + exact hqK + +private theorem helper_hrepMissingFixed_445.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {alpha : Fin k} (u : V) (d d' : ↥Def), + let Xd' : Finset V := VT ∪ (insert (R d').u1 ({(R d').u2} : Finset V) : Finset V); + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); ( + ∀ v ∈ Xd', Sum.inl v ∉ K) → + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) = K → + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u); + (( + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) → MissingColors G + (TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u)) v = MissingColors G phiD v) ∧ ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) → D.alpha0 ∈ + MissingColors G phiD v → alpha ∈ MissingColors G (TwoColorComponentSwap G phiD D.alpha0 + alpha (Sum.inl u)) v) ∧ ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) → alpha ∈ + MissingColors G phiD v → D.alpha0 ∈ MissingColors G (TwoColorComponentSwap G phiD D.alpha0 + alpha (Sum.inl u)) v) ∧ + ∀ (v : V) (c : Fin k), c ≠ D.alpha0 → c ≠ alpha → (c ∈ MissingColors G (TwoColorComponentSwap + G phiD D.alpha0 alpha (Sum.inl u)) v ↔ c ∈ MissingColors G phiD v)) → ( + ∀ q ∈ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V), MissingColors G psi q = + MissingColors G phiD q) → + ∀ q ∈ TreeSequenceVertexSet (R d).replacementTree, MissingColors G psi q = MissingColors G + phiD q := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def alpha u d d' Xd' K hKavoidV phiD hcomponent psi + hbehaviorPsi pairMissingFixed q hq + rw [(R d).replacement_vertices] at hq + rcases Finset.mem_union.mp hq with hqOld | hqPair + · apply hbehaviorPsi.1 + rw [hcomponent] + apply hKavoidV q + exact Finset.mem_union_left _ (Finset.mem_sdiff.mp hqOld).1 + · exact pairMissingFixed q hqPair + +private theorem helper_hTashPsi_460.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {alpha : Fin k} (u : V) (d : ↥Def), + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); IsProperEdgeColoring G phiD ∧ IsOneEdgeUncolored phiD e0 + ∧ GlobalMaximumTriple G k e0 phiD (R d).replacementTree → + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u); + ( + ∀ q ∈ TreeSequenceVertexSet (R d).replacementTree, MissingColors G psi q = MissingColors G + phiD q) → ( + ∀ (r : Fin (R d).replacementTree.length), psi ((R d).replacementTree.edge r) = phiD ((R + d).replacementTree.edge r)) → TashkinovTree G e0 psi (R d).replacementTree := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def alpha u d phiD hmaximum psi hrepMissingFixed + hrepEdgeFixed r hr + obtain ⟨i, c, hc, hm⟩ := hmaximum.2.2.2.1 r hr + refine ⟨i, c, (hrepEdgeFixed r).trans hc, ?_⟩ + rw [hrepMissingFixed] + · exact hm + · simp [TreeSequenceVertexSet] + +private theorem helper_honePsi_470.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {alpha : Fin k} (u : V) (d : ↥Def), + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); IsProperEdgeColoring G phiD ∧ IsOneEdgeUncolored phiD e0 + ∧ GlobalMaximumTriple G k e0 phiD (R d).replacementTree → + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u); + IsOneEdgeUncolored psi e0 := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT Def alpha u d phiD hmaximum psi + constructor + · by_cases heK : Sum.inr e0 ∈ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) + · have he0none : phiD e0 = none := hmaximum.2.1.1 + simp [psi, TwoColorComponentSwap, heK, he0none] + · have he0none : phiD e0 = none := hmaximum.2.1.1 + simp [psi, TwoColorComponentSwap, heK, he0none] + · intro e he0 + obtain ⟨c, hc⟩ := hmaximum.2.1.2 e he0 + change phiD e = some c at hc + by_cases heK : Sum.inr e ∈ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) + · by_cases hc0 : c = D.alpha0 + · refine ⟨alpha, ?_⟩ + simp only [psi, TwoColorComponentSwap, heK, ite_eq_left] + rw [hc0] at hc + rw [hc] + simp [] + · by_cases hca : c = alpha + · refine ⟨D.alpha0, ?_⟩ + simp only [psi, TwoColorComponentSwap, heK, ite_eq_left] + rw [hca] at hc + rw [hc] + simp + · refine ⟨c, ?_⟩ + simp only [psi, TwoColorComponentSwap, heK, ite_eq_left] + rw [hc] + simp [hc0, hca] + · refine ⟨c, ?_⟩ + simp only [psi, TwoColorComponentSwap, heK] + exact hc + +private theorem helper_hrepSubX_524.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let X : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ (d : ↥Def), + let Xd : Finset V := VT ∪ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V); Xd ⊆ X → + TreeSequenceVertexSet (R d).replacementTree ⊆ X := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def d Xd hXdSub v hv + rw [(R d).replacement_vertices] at hv + rcases Finset.mem_union.mp hv with hvOld | hvPair + · exact hXdSub (Finset.mem_union_left _ (Finset.mem_sdiff.mp hvOld).1) + · exact hXdSub (Finset.mem_union_right _ hvPair) + +private theorem helper_hfK_545.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) {f : E} {alpha : Fin k}, phi f = some alpha → + ∀ (u w : V), G.ends f = s(u, w) → + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); Sum.inr f ∈ K := by + classical + intro V E _ _ _ G k e0 phi T C D f alpha hfalpha u w hfends K + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl u) + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, Incident, hfends, hfalpha] + +private theorem helper_continuation_878.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let X : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {f : E} {alpha : Fin k} (_ : phi f = some alpha) (u w : V) (_ : w ∉ X) (_ : G.ends f = s(u, + w)) (d : ↥Def), + let Xd : Finset V := VT ∪ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V); + ∀ (_ : Xd ⊆ X) (d' : ↥Def), + let Xd' : Finset V := VT ∪ (insert (R d').u1 ({(R d').u2} : Finset V) : Finset V); + ∀ (_ : u ∈ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V)), + let _ : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + ∀ (_ : D.alpha0 ≠ alpha), + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); + ∀ (_ : + ∀ v ∈ Xd', Sum.inl v ∉ K) (_ : D.alpha0 ≠ (↑d : Fin k)) (_ : D.alpha0 ≠ C.gamma (D.gammaIndex + d)), + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); + ∀ (_ : IsProperEdgeColoring G phiD ∧ IsOneEdgeUncolored phiD e0 ∧ GlobalMaximumTriple G k e0 + phiD (R d).replacementTree) (_ : + ∀ (e : E), (phiD e = some D.alpha0 ↔ phi e = some D.alpha0) ∧ (phiD e = some alpha ↔ phi e = + some alpha)) (_ : TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) = K) (_ : + ∀ (r : Fin (R d).replacementTree.length), Sum.inr ((R d).replacementTree.edge r) ∉ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u)) (_ : ( + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → C.gamma (D.gammaIndex d) ∈ MissingColors G phi v → (↑d : Fin k) ∈ + MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) v) ∧ ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → (↑d : Fin k) ∈ MissingColors G phi v → C.gamma (D.gammaIndex d) ∈ + MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) v) ∧ + ∀ (v : V) (c : Fin k), c ≠ C.gamma (D.gammaIndex d) → c ≠ (↑d : Fin k) → (c ∈ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v + ↔ c ∈ MissingColors G phi v)) (_ : + ∀ q ∈ (insert (R d).u1 ({(R d).u2} : Finset V) : Finset V), D.alpha0 ∉ MissingColors G phiD q + ∧ alpha ∉ MissingColors G phiD q), False := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def f alpha hfalpha u w hwX hfends d Xd hXdSub d' Xd' + hud y0 ha0alpha K hKavoidV alpha0NeDelta alpha0NeGamma phiD hmaximum hfirstFixed hcomponent + hrepEdgeAvoidD hbehaviorD pairNotMissing + let psi := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u) + have hbehaviorPsi := TwoColorComponentSwapMissingBehavior G phiD + D.alpha0 alpha ha0alpha hmaximum.1 (Sum.inl u) + dsimp only at hbehaviorPsi + have pairMissingFixed : ∀ q ∈ ({(R d).u1, (R d).u2} : Finset V), + MissingColors G psi q = MissingColors G phiD q := by + exact @helper_pairMissingFixed_380 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@alpha) (@u) (@d) (@hcomponent) + (@pairNotMissing) (@hbehaviorPsi) + have hrepMissingFixed : ∀ q ∈ TreeSequenceVertexSet (R d).replacementTree, + MissingColors G psi q = MissingColors G phiD q := by + exact @helper_hrepMissingFixed_445 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@alpha) (@u) (@d) (@d') + (@hKavoidV) (@hcomponent) (@hbehaviorPsi) (@pairMissingFixed) + have hrepEdgeFixed : ∀ r : Fin (R d).replacementTree.length, + psi ((R d).replacementTree.edge r) = + phiD ((R d).replacementTree.edge r) := by + intro r + simp [psi, TwoColorComponentSwap, hrepEdgeAvoidD r] + have hTashPsi : TashkinovTree G e0 psi (R d).replacementTree := by + exact @helper_hTashPsi_460 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@alpha) (@u) (@d) (@hmaximum) + (@hrepMissingFixed) (@hrepEdgeFixed) + have hproperPsi : IsProperEdgeColoring G psi := + TwoColorComponentSwapProper G phiD D.alpha0 alpha ha0alpha + hmaximum.1 (Sum.inl u) + have honePsi : IsOneEdgeUncolored psi e0 := by + exact @helper_honePsi_470 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@alpha) (@u) (@d) (@hmaximum) + have hglobalPsi : GlobalMaximumTriple G k e0 psi (R d).replacementTree := by + refine ⟨?_, hTashPsi, hmaximum.2.2.2.2⟩ + exact ⟨hmaximum.2.2.1.1, hmaximum.2.2.1.2.1, + hmaximum.2.2.1.2.2.1, hproperPsi, honePsi⟩ + have hy0Rep : y0 ∈ TreeSequenceVertexSet (R d).replacementTree := by + have hposOld : (0 : ℕ) < T.length + 1 := by omega + have hposNew : (0 : ℕ) < (R d).replacementTree.length + 1 := by omega + have hzeroBound : (0 : ℕ) ≤ C.p - 1 + 2 * (D.gammaIndex d).val := by + have hp := C.p_ge_two + omega + have hvertex : (R d).replacementTree.vertex ⟨0, hposNew⟩ = y0 := by + calc + (R d).replacementTree.vertex ⟨0, hposNew⟩ = + T.vertex ⟨0, hposOld⟩ := + (R d).retained_vertices_before 0 hzeroBound hposOld + _ = y0 := by + simpa [y0] using C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [TreeSequenceVertexSet] using + (show ∃ i : Fin ((R d).replacementTree.length + 1), + (R d).replacementTree.vertex i = y0 from + ⟨⟨0, hposNew⟩, hvertex⟩) + have hrepSubX : TreeSequenceVertexSet (R d).replacementTree ⊆ X := by + exact @helper_hrepSubX_524 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@d) (@hXdSub) + have huRep : u ∈ TreeSequenceVertexSet (R d).replacementTree := by + rw [(R d).replacement_vertices] + exact Finset.mem_union_right _ hud + have hwRep : w ∉ TreeSequenceVertexSet (R d).replacementTree := + fun hw => hwX (hrepSubX hw) + have hfRep : f ∈ BoundaryEdges G (TreeSequenceVertexSet (R d).replacementTree) := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, huRep, w, hwRep, hfends⟩ + have hy0MissingD : D.alpha0 ∈ MissingColors G phiD y0 := + (hbehaviorD.2.2.2 y0 D.alpha0 alpha0NeGamma alpha0NeDelta).2 + D.alpha0_missing_at_y0 + have hy0MissingPsi : D.alpha0 ∈ MissingColors G psi y0 := by + rw [hrepMissingFixed y0 hy0Rep] + exact hy0MissingD + have hfK : Sum.inr f ∈ K := by + exact @helper_hfK_545 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@C) (@D) (@f) (@alpha) (@hfalpha) (@u) (@w) (@hfends) + have hfKD : Sum.inr f ∈ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) := by + rw [hcomponent] + exact hfK + have hfalphaD : phiD f = some alpha := (hfirstFixed f).2.2 hfalpha + have hfalpha0Psi : psi f = some D.alpha0 := by + simp [psi, TwoColorComponentSwap, hfKD, hfalphaD] + have hfinalClosed : ColoredVertexSetClosed G psi + (TreeSequenceVertexSet (R d).replacementTree) := + (ScheideGlobalMaximumOrder G k e0 psi (R d).replacementTree + hglobalPsi).2.2.2.2 + exact (hfinalClosed hfRep hy0Rep hfalpha0Psi) hy0MissingPsi + +private abbrev helperBranch62Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d), + let VT : Finset V := TreeSequenceVertexSet T; + let _ : Finset V := ScheideEnlargedVertexSet R; + let Def : Finset (Fin k) := DefectiveColors G phi VT; + ∀ {f : E} {alpha : Fin k} {x : V}, f ∈ BoundaryEdges G (ScheideEnlargedVertexSet R) → x ∈ + ScheideEnlargedVertexSet R → phi f = some alpha → alpha ∈ MissingColors G phi x → + Def.Nonempty → False + +private theorem helper_branch_62.{u_1, u_2} : + helperBranch62Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D R VT X Def f alpha x hf hx hfalpha hmiss hdef + have hfEnds : ∃ u ∈ X, ∃ w ∉ X, G.ends f = s(u, w) := by + simpa [X, BoundaryEdges, Sym2.mem_iff] using hf + obtain ⟨u, huX, w, hwX, hfends⟩ := hfEnds + obtain ⟨d, huXd⟩ : ∃ d : {delta // delta ∈ Def}, + u ∈ VT ∪ {(R d).u1, (R d).u2} := by + by_cases huT : u ∈ VT + · obtain ⟨delta, hdelta⟩ := hdef + exact ⟨⟨delta, hdelta⟩, Finset.mem_union_left _ huT⟩ + · exact @helper_branch_69 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@u) (@huX) (@huT) + let Xd : Finset V := VT ∪ {(R d).u1, (R d).u2} + have hXdSub : Xd ⊆ X := by + exact @helper_hXdSub_76 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@d) + have hwXd : w ∉ Xd := fun hw => hwX (hXdSub hw) + have hfXd : f ∈ BoundaryEdges G Xd := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, huXd, w, hwXd, hfends⟩ + have hclosedD : ColoredVertexSetClosed G phi Xd := by + exact @helper_hclosedD_95 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@d) + have hxNotXd : x ∉ Xd := by + intro hxXd + exact (hclosedD hfXd hxXd hfalpha) hmiss + have hxNotT : x ∉ VT := by + intro hxT + exact hxNotXd (Finset.mem_union_left _ hxT) + have hxPairs : x ∈ Finset.univ.biUnion + (fun d : {delta // delta ∈ Def} => {(R d).u1, (R d).u2}) := by + simpa [X, VT, Def, ScheideEnlargedVertexSet, hxNotT] using hx + simp only [Finset.mem_biUnion, Finset.mem_univ, true_and] at hxPairs + obtain ⟨d', hxd'⟩ := hxPairs + have hpairsDisjoint : Disjoint ({(R d).u1, (R d).u2} : Finset V) + ({(R d').u1, (R d').u2} : Finset V) := by + exact @helper_hpairsDisjoint_112 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@x) (@d) (@hxNotXd) (@d') (@hxd') + let Xd' : Finset V := VT ∪ {(R d').u1, (R d').u2} + have hXd'Sub : Xd' ⊆ X := by + exact @helper_hXd'Sub_123 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@d') + have hwXd' : w ∉ Xd' := fun hw => hwX (hXd'Sub hw) + have hclosedD' : ColoredVertexSetClosed G phi Xd' := by + exact @helper_hclosedD_138 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@d') + have hxXd' : x ∈ Xd' := Finset.mem_union_right _ hxd' + have huNotT : u ∉ VT := by + exact @helper_huNotT_145 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@f) (@alpha) (@x) (@hfalpha) (@hmiss) (@u) + (@w) (@hfends) (@d') (@hwXd') (@hclosedD') (@hxXd') + have hud : u ∈ ({(R d).u1, (R d).u2} : Finset V) := by + simpa [Xd, huNotT] using huXd + have huNotPairD' : u ∉ ({(R d').u1, (R d').u2} : Finset V) := + fun hu' => Finset.disjoint_left.mp hpairsDisjoint hud hu' + have huNotXd' : u ∉ Xd' := by + intro hu + rcases Finset.mem_union.mp hu with huT | huPair + · exact huNotT huT + · exact huNotPairD' huPair + let y0 : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hy0T : y0 ∈ VT := by + have hpos : (0 : ℕ) < T.length + 1 := by omega + have hv := C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [y0, VT, TreeSequenceVertexSet] using + (show ∃ i : Fin (T.length + 1), T.vertex i = y0 from + ⟨⟨0, hpos⟩, by simpa [y0] using hv⟩) + have hy0X : y0 ∈ X := hXdSub (Finset.mem_union_left _ hy0T) + have hy0Xd' : y0 ∈ Xd' := Finset.mem_union_left _ hy0T + have hy0neX : y0 ≠ x := by + intro h + exact hxNotT (h ▸ hy0T) + have ha0alpha : D.alpha0 ≠ alpha := by + intro h + have hdisj := ScheideEnlargedElementary G k e0 phi T C D R + hy0X hx hy0neX + exact (Finset.disjoint_left.mp hdisj) D.alpha0_missing_at_y0 + (h ▸ hmiss) + let K := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u) + have havoid := ClosedSetTwoColorComponentAvoidance G phi D.alpha0 alpha + Xd' u y0 x hclosedD' huNotXd' hy0Xd' hxXd' + D.alpha0_missing_at_y0 hmiss + have hKavoidV : ∀ v ∈ Xd', Sum.inl v ∉ K := by + simpa [K] using havoid.1 + have hKavoidE : ∀ e : E, (∃ v ∈ Xd', Incident G v e) → + Sum.inr e ∉ K := by + simpa [K] using havoid.2 + have alphaNotBlock : ∀ i : Fin C.s, alpha ≠ C.gamma i := by + exact @helper_alphaNotBlock_189 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@alpha) (@x) (@hx) (@hmiss) + (@d) (@hXdSub) (@hxNotT) + have pairDOutsideD' : ∀ v ∈ ({(R d).u1, (R d).u2} : Finset V), + v ∉ Xd' := by + exact @helper_pairDOutsideD_206 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@d) (@d') (@hpairsDisjoint) + have hf1Boundary : (R d).f1 ∈ BoundaryEdges G Xd' := by + exact @helper_hf1Boundary_216 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@d) (@d') (@pairDOutsideD') + have alphaNeDelta : alpha ≠ d.1 := by + intro h + exact (hclosedD' hf1Boundary hxXd' (h.symm ▸ (R d).f1_color)) hmiss + have alpha0NeDelta : D.alpha0 ≠ d.1 := by + intro h + exact (hclosedD' hf1Boundary hy0Xd' + (h.symm ▸ (R d).f1_color)) D.alpha0_missing_at_y0 + have gammaNeDelta : C.gamma (D.gammaIndex d) ≠ d.1 := by + exact @helper_gammaNeDelta_230 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@C) (@D) (@d) + have alpha0NeGamma : D.alpha0 ≠ C.gamma (D.gammaIndex d) := + D.alpha0_not_block (D.gammaIndex d) + have alphaNeGamma : alpha ≠ C.gamma (D.gammaIndex d) := + alphaNotBlock (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + have hmaximum := ScheideReplacementMaximum G k e0 phi T C D d (R d) + dsimp only at hmaximum + change IsProperEdgeColoring G phiD ∧ IsOneEdgeUncolored phiD e0 ∧ + GlobalMaximumTriple G k e0 phiD (R d).replacementTree at hmaximum + have hfirstOther : ∀ (e : E) (c : Fin k), + c ≠ C.gamma (D.gammaIndex d) → c ≠ d.1 → + (phiD e = some c ↔ phi e = some c) := by + exact @helper_hfirstOther_253 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@C) (@D) (@d) (@gammaNeDelta) + have hfirstFixed : ∀ e : E, + (phiD e = some D.alpha0 ↔ phi e = some D.alpha0) ∧ + (phiD e = some alpha ↔ phi e = some alpha) := by + intro e + exact ⟨hfirstOther e D.alpha0 alpha0NeGamma alpha0NeDelta, + hfirstOther e alpha alphaNeGamma alphaNeDelta⟩ + have hgraph : TwoColorIncidenceGraph G phiD D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha := by + exact @helper_hgraph_278 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@C) (@D) (@alpha) (@w) (@d) (@hfirstFixed) + have hcomponent : TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) = K := by + exact @helper_hcomponent_294 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@C) (@D) (@alpha) (@u) (@d) (@hgraph) + have hrepEdgeAvoid : ∀ r : Fin (R d).replacementTree.length, + Sum.inr ((R d).replacementTree.edge r) ∉ K := by + exact @helper_hrepEdgeAvoid_300 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@alpha) (@u) (@d) (@d') + (@hKavoidE) + have hrepEdgeAvoidD : ∀ r : Fin (R d).replacementTree.length, + Sum.inr ((R d).replacementTree.edge r) ∉ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) := by + intro r hr + apply hrepEdgeAvoid r + rw [← hcomponent] + exact hr + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have hbehaviorD := TwoColorComponentSwapMissingBehavior G phi + (C.gamma (D.gammaIndex d)) d.1 gammaNeDelta hproper + (Sum.inl (D.v0 d)) + dsimp only at hbehaviorD + have pairNotMissing : ∀ q ∈ ({(R d).u1, (R d).u2} : Finset V), + D.alpha0 ∉ MissingColors G phiD q ∧ + alpha ∉ MissingColors G phiD q := by + intro q hq + have hqT : q ∉ VT := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl + · exact (R d).u1_outside + · exact (R d).u2_outside + have hqX : q ∈ X := hXdSub (Finset.mem_union_right _ hq) + have hy0q : y0 ≠ q := by + intro h + exact hqT (h ▸ hy0T) + have hxq : x ≠ q := by + intro h + exact pairDOutsideD' q hq (h ▸ hxXd') + have ha0Old : D.alpha0 ∉ MissingColors G phi q := by + intro hqmiss + have hdisj := ScheideEnlargedElementary G k e0 phi T C D R + hy0X hqX hy0q + exact (Finset.disjoint_left.mp hdisj) D.alpha0_missing_at_y0 hqmiss + have halphaOld : alpha ∉ MissingColors G phi q := by + intro hqmiss + have hdisj := ScheideEnlargedElementary G k e0 phi T C D R + hx hqX hxq + exact (Finset.disjoint_left.mp hdisj) hmiss hqmiss + constructor + · intro hnew + exact ha0Old ((hbehaviorD.2.2.2 q D.alpha0 alpha0NeGamma + alpha0NeDelta).mp hnew) + · intro hnew + exact halphaOld ((hbehaviorD.2.2.2 q alpha alphaNeGamma + alphaNeDelta).mp hnew) + exact @helper_continuation_878 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@f) (@alpha) (@hfalpha) (@u) (@w) + (@hwX) (@hfends) (@d) (@hXdSub) (@d') (@hud) (@ha0alpha) (@hKavoidV) (@alpha0NeDelta) + (@alpha0NeGamma) (@hmaximum) (@hfirstFixed) (@hcomponent) (@hrepEdgeAvoidD) (@hbehaviorD) + (@pairNotMissing) +theorem ScheideEnlargedClosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) : + ColoredVertexSetClosed G phi (ScheideEnlargedVertexSet R) := by + classical + let VT := TreeSequenceVertexSet T + let X := ScheideEnlargedVertexSet R + let Def := DefectiveColors G phi VT + have htreeClosed : ColoredVertexSetClosed G phi VT := + (ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).2.2.2.2 + unfold ColoredVertexSetClosed at htreeClosed ⊢ + intro f alpha x hf hx hfalpha hmiss + by_cases hdef : Def.Nonempty + · exact @helper_branch_62 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D R f alpha x hf hx hfalpha hmiss hdef + · let : IsEmpty {delta // delta ∈ + DefectiveColors G phi (TreeSequenceVertexSet T)} := + ⟨fun d => hdef ⟨d.1, by simp [Def, VT]⟩⟩ + have hXeq : X = VT := by + unfold X ScheideEnlargedVertexSet + simp [VT] + exact htreeClosed (by simpa [X, hXeq] using hf) + (by simpa [X, hXeq] using hx) hfalpha hmiss + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideEnlargedElementary.lean b/LeanPool/GoldbergSeymour/ScheideEnlargedElementary.lean new file mode 100644 index 0000000000..8c1921daa4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideEnlargedElementary.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideAbsorbingElementary +public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet +public import LeanPool.GoldbergSeymour.ScheideReplacementAbsorbing + +/-! +# Scheide Enlarged Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideEnlargedElementary {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) : + ColoredVertexSetElementary G phi (ScheideEnlargedVertexSet R) := by + classical + have hbase : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T ∪ AbsorbingVertices T phi) := + ScheideAbsorbingElementary G k e0 phi T C.globally_maximum + unfold ColoredVertexSetElementary at hbase ⊢ + intro u hu v hv huv + apply hbase + · exact (by + have hsub : ScheideEnlargedVertexSet R ⊆ + TreeSequenceVertexSet T ∪ AbsorbingVertices T phi := by + unfold ScheideEnlargedVertexSet + intro w hw + simp only [Finset.mem_union, Finset.mem_biUnion, Finset.mem_univ, + Finset.mem_insert, Finset.mem_singleton] at hw + rcases hw with hw | ⟨d, _, hw | hw⟩ + · exact Finset.mem_union_left _ hw + · exact Finset.mem_union_right _ + ((ScheideReplacementAbsorbing G k e0 phi T C D d (R d)) + (by simp [hw])) + · exact Finset.mem_union_right _ + ((ScheideReplacementAbsorbing G k e0 phi T C D d (R d)) + (by simp [hw])) + exact hsub hu) + · exact (by + have hsub : ScheideEnlargedVertexSet R ⊆ + TreeSequenceVertexSet T ∪ AbsorbingVertices T phi := by + unfold ScheideEnlargedVertexSet + intro w hw + simp only [Finset.mem_union, Finset.mem_biUnion, Finset.mem_univ, + Finset.mem_insert, Finset.mem_singleton] at hw + rcases hw with hw | ⟨d, _, hw | hw⟩ + · exact Finset.mem_union_left _ hw + · exact Finset.mem_union_right _ + ((ScheideReplacementAbsorbing G k e0 phi T C D d (R d)) + (by simp [hw])) + · exact Finset.mem_union_right _ + ((ScheideReplacementAbsorbing G k e0 phi T C D d (R d)) + (by simp [hw])) + exact hsub hv) + exact huv + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideEnlargedStrictAugmentation.lean b/LeanPool/GoldbergSeymour/ScheideEnlargedStrictAugmentation.lean new file mode 100644 index 0000000000..2ae1991f34 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideEnlargedStrictAugmentation.lean @@ -0,0 +1,200 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideReplacementData + +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists + +/-! +# Scheide Enlarged Strict Augmentation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem ScheideEnlargedStrictAugmentation {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) : + (∃ (alpha : Fin k) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (f : E) (w u : V), + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + let Q := TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) + let psi := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u) + alpha ≠ D.alpha0 ∧ + G.ends f = s(w, u) ∧ + phiD f = some alpha ∧ + Sum.inr f ∈ Q ∧ + (∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∉ Q) ∧ + GlobalMaximumTriple G k e0 psi (R d).replacementTree ∧ + D.alpha0 ∈ MissingColors G phiD + (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩) ∧ + C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ + TreeSequenceVertexSet (R d).replacementTree ∧ + w ∈ TreeSequenceVertexSet (R d).replacementTree ∧ + u ∉ TreeSequenceVertexSet (R d).replacementTree ∧ + f ∉ Finset.univ.image (R d).replacementTree.edge) → + ∃ (psi : PartialEdgeColoring E k) (S : TreeSequence G e0), + KTriple G k e0 psi ∧ + TashkinovTree G e0 psi S ∧ + (TreeSequenceVertexSet S).card = TashkinovOrder G + 1 := by + classical + rintro ⟨alpha, d, f, w, u, hpack⟩ + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + let Q := TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) + let psi := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u) + let Td := (R d).replacementTree + let y0 : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + change alpha ≠ D.alpha0 ∧ + G.ends f = s(w, u) ∧ + phiD f = some alpha ∧ + Sum.inr f ∈ Q ∧ + (∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∉ Q) ∧ + GlobalMaximumTriple G k e0 psi Td ∧ + D.alpha0 ∈ MissingColors G phiD y0 ∧ + y0 ∈ TreeSequenceVertexSet Td ∧ + w ∈ TreeSequenceVertexSet Td ∧ + u ∉ TreeSequenceVertexSet Td ∧ + f ∉ Finset.univ.image Td.edge at hpack + rcases hpack with ⟨halpha, hfends, hfcolor, hfQ, hQavoid, hmaximum, + halpha0Missing, hy0Td, hwTd, huTd, hfFresh⟩ + have hfPsi : psi f = some D.alpha0 := by + have hfQ' : Sum.inr f ∈ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) := by + simpa [Q] using hfQ + simp [psi, TwoColorComponentSwap, hfQ', hfcolor, halpha] + have hy0T : y0 ∈ TreeSequenceVertexSet T := by + have hp : (0 : ℕ) < T.length + 1 := by omega + have hv := C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [y0, TreeSequenceVertexSet] using + (show ∃ i : Fin (T.length + 1), T.vertex i = y0 from + ⟨⟨0, hp⟩, by simpa [y0] using hv⟩) + have hedgeColor : ∀ g : E, Sum.inr g ∈ Q → + phiD g = some D.alpha0 ∨ phiD g = some alpha := by + intro g hg + change (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inr g) = + (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl u) at hg + have heq := (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mp hg + have hp : (TwoColorIncidenceGraph G phiD D.alpha0 alpha).Reachable + (Sum.inr g) (Sum.inl u) := SimpleGraph.ConnectedComponent.exact heq + have hsupp := SimpleGraph.mem_support_of_reachable (by simp) hp + obtain ⟨z, hz⟩ := + ((TwoColorIncidenceGraph G phiD D.alpha0 alpha).mem_support).mp hsupp + cases z with + | inl v => exact hz.2 + | inr e => simp [TwoColorIncidenceGraph] at hz + have hedgeAvoid : ∀ g : E, Incident G y0 g → Sum.inr g ∉ Q := by + intro g hinc hg + have hcolor := hedgeColor g hg + have hadj : (TwoColorIncidenceGraph G phiD D.alpha0 alpha).Adj + (Sum.inl y0) (Sum.inr g) := by + simp [TwoColorIncidenceGraph, hinc, hcolor] + have hc := + SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + apply hQavoid y0 hy0T + change (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl y0) = + (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl u) + change (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inr g) = + (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl u) at hg + exact hc.trans hg + have hincidentFixed : ∀ g : E, Incident G y0 g → psi g = phiD g := by + intro g hinc + have hg : Sum.inr g ∉ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) := by + simpa [Q] using hedgeAvoid g hinc + simp [psi, TwoColorComponentSwap, hg] + have halpha0MissingPsi : D.alpha0 ∈ MissingColors G psi y0 := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + at halpha0Missing ⊢ + intro hpresent + apply halpha0Missing + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hpresent ⊢ + obtain ⟨g, hinc, hg⟩ := hpresent + refine ⟨g, hinc, ?_⟩ + rw [hincidentFixed g hinc] at hg + exact hg + have hfBoundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet Td) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwTd, u, huTd, hfends⟩ + obtain ⟨S, hTdS⟩ := TreeSequenceBoundaryEdgeAppendExists Td f hfBoundary + have htreeS : TashkinovTree G e0 psi S := by + rcases hTdS with ⟨hlen, hinitial, hlast⟩ + rcases hinitial with ⟨hle, hvert, hedge⟩ + intro q hq + by_cases hold : q.val < Td.length + · let qTd : Fin Td.length := ⟨q.val, hold⟩ + obtain ⟨a, c, hc, hm⟩ := hmaximum.2.1 qTd + (by simpa [qTd] using hq) + let aS : Fin (q.val + 1) := ⟨a.val, by simpa [qTd] using a.isLt⟩ + refine ⟨aS, c, ?_, ?_⟩ + · have hqeq : Fin.castLE hle qTd = q := Fin.ext rfl + rw [← hqeq, hedge] + exact hc + · let oldVertexIndex : Fin (Td.length + 1) := + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ qTd.isLt)) + let newVertexIndex : Fin (S.length + 1) := + Fin.castLT aS (Nat.lt_trans aS.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) oldVertexIndex = + newVertexIndex := Fin.ext rfl + have hvertex : S.vertex newVertexIndex = Td.vertex oldVertexIndex := by + rw [← hindex] + exact hvert oldVertexIndex + simpa [oldVertexIndex, newVertexIndex] using hvertex.symm ▸ hm + · have hqval : q.val = Td.length := by + have hqbound : q.val < Td.length + 1 := by simpa [hlen] using q.isLt + omega + obtain ⟨i, hi⟩ : ∃ i : Fin (Td.length + 1), Td.vertex i = y0 := by + simpa [TreeSequenceVertexSet] using hy0Td + let a : Fin (q.val + 1) := ⟨i.val, by omega⟩ + refine ⟨a, D.alpha0, ?_, ?_⟩ + · have hqlast : q = Fin.cast hlen.symm (Fin.last Td.length) := by + apply Fin.ext + simpa using hqval + rw [hqlast, hlast] + exact hfPsi + · let newVertexIndex : Fin (S.length + 1) := + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) i = + newVertexIndex := Fin.ext rfl + have hvertex : S.vertex newVertexIndex = y0 := by + rw [← hindex, hvert] + exact hi + simpa [newVertexIndex, hvertex] using halpha0MissingPsi + refine ⟨psi, S, hmaximum.1, htreeS, ?_⟩ + have hcardS : (TreeSequenceVertexSet S).card = S.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + S.vertex_injective] + have hcardTd : (TreeSequenceVertexSet Td).card = Td.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + Td.vertex_injective] + rw [hcardS, hTdS.1, ← hcardTd, hmaximum.2.2] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideEnlargedStronglyClosed.lean b/LeanPool/GoldbergSeymour/ScheideEnlargedStronglyClosed.lean new file mode 100644 index 0000000000..69842049cd --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideEnlargedStronglyClosed.lean @@ -0,0 +1,42 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideEnlargedStrictAugmentation +public import LeanPool.GoldbergSeymour.ScheideEnlargedSwitchTransport + +/-! +# Scheide Enlarged Strongly Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideEnlargedStronglyClosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) : + ColoredVertexSetStronglyClosed G phi (ScheideEnlargedVertexSet R) := by + classical + by_contra hnot + have htransport := ScheideEnlargedSwitchTransport G k e0 phi T C D R hnot + obtain ⟨psi, S, htriple, htree, hcard⟩ := + ScheideEnlargedStrictAugmentation G k e0 phi T C D R htransport + have hle := treeCard_le_tashkinovOrder G k e0 psi S htriple htree + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideEnlargedSwitchTransport.lean b/LeanPool/GoldbergSeymour/ScheideEnlargedSwitchTransport.lean new file mode 100644 index 0000000000..80a59a1815 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideEnlargedSwitchTransport.lean @@ -0,0 +1,754 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideEnlargedBoundarySelection +public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Enlarged Switch Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_hαδ_129.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (d : ↥(DefectiveColors G phi + (TreeSequenceVertexSet T))) (f : E) (w u : V), phi f = some alpha → G.ends f = s(w, u) → u + ∉ ScheideEnlargedVertexSet R → w = (R d).u1 ∨ w = (R d).u2 → + let _ : Finset V := ScheideEnlargedVertexSet R; IsProperEdgeColoring G phi → alpha ≠ (↑d : Fin + k) := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha d f w u hfα hfends huX hwpair X hproper he + have hu1X : (R d).u1 ∈ X := by + unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_right + apply Finset.mem_biUnion.mpr + exact ⟨d, Finset.mem_univ _, by simp⟩ + have hu2X : (R d).u2 ∈ X := by + unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_right + apply Finset.mem_biUnion.mpr + exact ⟨d, Finset.mem_univ _, by simp⟩ + rcases hwpair with hw1 | hw2 + · have hne : f ≠ (R d).f1 := by + intro heq + have hv1X : (R d).v1 ∈ X := by + unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_left + exact (Finset.mem_sdiff.mp (R d).v1_in_remainder).1 + have hu : u = (R d).u1 := by + rw [heq, (R d).f1_ends] at hfends + rcases (by simpa [hw1] using hfends) with h | h + · exact h.2.symm + · exfalso + exact huX (h.symm ▸ hv1X) + exact huX (hu ▸ hu1X) + apply (hproper hne) + · refine ⟨w, ?_, ?_⟩ + · unfold Incident + rw [hfends] + simp + · unfold Incident + rw [(R d).f1_ends, ← hw1] + simp + · exact hfα + · rw [he] + exact (R d).f1_color + · have hne : f ≠ (R d).f2 := by + intro heq + have hv2X : (R d).v2 ∈ X := by + unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_left + exact (Finset.mem_sdiff.mp (R d).v2_in_remainder).1 + have hu : u = (R d).u2 := by + rw [heq, (R d).f2_ends] at hfends + rcases (by simpa [hw2] using hfends) with h | h + · exact h.2.symm + · exfalso + exact huX (h.symm ▸ hv2X) + exact huX (hu ▸ hu2X) + apply (hproper hne) + · refine ⟨w, ?_, ?_⟩ + · unfold Incident + rw [hfends] + simp + · unfold Incident + rw [(R d).f2_ends, ← hw2] + simp + · exact hfα + · rw [he] + exact (R d).f2_color + +private theorem helper_hαgamma_190.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (d : ↥(DefectiveColors G phi + (TreeSequenceVertexSet T))) (f : E) (w u : V), phi f = some alpha → G.ends f = s(w, u) → u + ∉ ScheideEnlargedVertexSet R → w = (R d).u1 ∨ w = (R d).u2 → + let _ : Finset V := ScheideEnlargedVertexSet R; + let gamma : Fin k := C.gamma (D.gammaIndex d); IsProperEdgeColoring G phi → alpha ≠ gamma := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha d f w u hfα hfends huX hwpair X gamma hproper he + obtain ⟨g, hgc, hge⟩ := + (ScheideSymmetricDefectiveInternal G k e0 phi T C D d (R d)).2 + have hu1X : (R d).u1 ∈ X := by + unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_right + apply Finset.mem_biUnion.mpr + exact ⟨d, Finset.mem_univ _, by simp⟩ + have hu2X : (R d).u2 ∈ X := by + unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_right + apply Finset.mem_biUnion.mpr + exact ⟨d, Finset.mem_univ _, by simp⟩ + rcases hwpair with hw1 | hw2 + · have hne : f ≠ g := by + intro hfg + have hu : u = (R d).u1 := by + rw [hfg, hge] at hfends + rcases (by simpa [hw1] using hfends) with h | h + · exfalso + exact huX (h.symm ▸ hu2X) + · exact h.1.symm + exact huX (hu ▸ hu1X) + apply (hproper hne) + · refine ⟨w, ?_, ?_⟩ + · unfold Incident; rw [hfends]; simp + · unfold Incident; rw [hge, ← hw1]; simp + · exact hfα + · rw [he]; exact hgc + · have hne : f ≠ g := by + intro hfg + have hu : u = (R d).u2 := by + rw [hfg, hge] at hfends + rcases (by simpa [hw2] using hfends) with h | h + · exact h.2.symm + · exfalso + exact huX (h.symm ▸ hu1X) + exact huX (hu ▸ hu2X) + apply (hproper hne) + · refine ⟨w, ?_, ?_⟩ + · unfold Incident; rw [hfends]; simp + · unfold Incident; rw [hge, ← hw2]; simp + · exact hfα + · rw [he]; exact hgc + +private theorem helper_hrepEdgeAvoid_302.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (d : ↥(DefectiveColors G phi + (TreeSequenceVertexSet T))) (u : V), ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∉ TwoColorComponent G phi D.alpha0 alpha (Sum.inl u)) + → + let _ : Finset V := TreeSequenceVertexSet T; + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); ( + ∀ (e : E), Sum.inr e ∈ K → + ∃ (c : Fin k), phi e = some c ∧ (c = D.alpha0 ∨ c = alpha)) → + ∀ (r : Fin (R d).replacementTree.length), Sum.inr ((R d).replacementTree.edge r) ∉ K := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha d u havoid VT K hcomponentColor r hr + have hm : (R d).replacementTree.edge r ∈ + Finset.univ.image (R d).replacementTree.edge := by simp + rw [(R d).replacement_edges] at hm + rcases Finset.mem_union.mp hm with hold | hnew + · have hold' := (Finset.mem_erase.mp (Finset.mem_erase.mp hold).2).2 + obtain ⟨q, _, hq⟩ := Finset.mem_image.mp hold' + obtain ⟨i, hi⟩ := T.attaches q + have hv : T.vertex q.succ ∈ VT := by simp [VT, TreeSequenceVertexSet] + have he : Incident G (T.vertex q.succ) ((R d).replacementTree.edge r) := by + unfold Incident + rw [← hq, hi] + simp + obtain ⟨c, hce, hc⟩ := hcomponentColor _ (by simpa [K] using hr) + have hadj : (TwoColorIncidenceGraph G phi D.alpha0 alpha).Adj + (Sum.inr ((R d).replacementTree.edge r)) (Sum.inl (T.vertex q.succ)) := by + simp [TwoColorIncidenceGraph, he, hce, hc] + have hc := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + have heq : (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr ((R d).replacementTree.edge r)) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl u) := by + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr ((R d).replacementTree.edge r)) = _ at hr + exact hr + exact havoid _ hv (hc.symm.trans heq) + · simp only [Finset.mem_insert, Finset.mem_singleton] at hnew + rcases hnew with hnew | hnew + · have hv : (R d).v1 ∈ VT := + (Finset.mem_sdiff.mp (R d).v1_in_remainder).1 + have he : Incident G (R d).v1 ((R d).replacementTree.edge r) := by + unfold Incident + rw [hnew, (R d).f1_ends] + simp + obtain ⟨c, hce, hc⟩ := hcomponentColor _ (by simpa [K] using hr) + have hadj : (TwoColorIncidenceGraph G phi D.alpha0 alpha).Adj + (Sum.inr ((R d).replacementTree.edge r)) (Sum.inl (R d).v1) := by + simp [TwoColorIncidenceGraph, he, hce, hc] + have hc := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + have heq : (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr ((R d).replacementTree.edge r)) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl u) := by + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr ((R d).replacementTree.edge r)) = _ at hr + exact hr + exact havoid _ hv (hc.symm.trans heq) + · have hv : (R d).v2 ∈ VT := + (Finset.mem_sdiff.mp (R d).v2_in_remainder).1 + have he : Incident G (R d).v2 ((R d).replacementTree.edge r) := by + unfold Incident + rw [hnew, (R d).f2_ends] + simp + obtain ⟨c, hce, hc⟩ := hcomponentColor _ (by simpa [K] using hr) + have hadj : (TwoColorIncidenceGraph G phi D.alpha0 alpha).Adj + (Sum.inr ((R d).replacementTree.edge r)) (Sum.inl (R d).v2) := by + simp [TwoColorIncidenceGraph, he, hce, hc] + have hc := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + have heq : (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr ((R d).replacementTree.edge r)) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl u) := by + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr ((R d).replacementTree.edge r)) = _ at hr + exact hr + exact havoid _ hv (hc.symm.trans heq) + +private theorem helper_hmissFixed_378.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (alpha : Fin k) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (u : V), ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∉ TwoColorComponent G phi D.alpha0 alpha (Sum.inl u)) + → + let VT : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); TwoColorComponent G + phiD D.alpha0 alpha (Sum.inl u) = K → ( + ∀ (e : E), Sum.inr e ∈ K → + ∃ (c : Fin k), phi e = some c ∧ (c = D.alpha0 ∨ c = alpha)) → + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u); + ∀ v ∈ VT, MissingColors G psi v = MissingColors G phiD v := by + classical + intro V E _ _ _ G k e0 phi T C D alpha d u havoid VT gamma phiD K hcomponent hcomponentColor + psi v hv + have hefix : ∀ e, Incident G v e → psi e = phiD e := by + intro e he + have hn : Sum.inr e ∉ TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) := by + intro heQ + rw [hcomponent] at heQ + have hadj : (TwoColorIncidenceGraph G phi D.alpha0 alpha).Adj + (Sum.inr e) (Sum.inl v) := by + obtain ⟨c, hce, hc⟩ := hcomponentColor e (by simpa [K] using heQ) + simp [TwoColorIncidenceGraph, he, hce, hc] + have hc := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + have heq : (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr e) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl u) := by + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr e) = _ at heQ + exact heQ + exact havoid v hv (hc.symm.trans heq) + simp [psi, TwoColorComponentSwap, hn] + apply Finset.ext + intro c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + constructor + · intro hc hpresent + rcases (by simpa [PresentColors] using hpresent) with ⟨e, he, hec⟩ + apply hc + unfold PresentColors + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, he, (hefix e he).trans hec⟩ + · intro hc hpresent + rcases (by simpa [PresentColors] using hpresent) with ⟨e, he, hec⟩ + apply hc + unfold PresentColors + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, he, (hefix e he).symm.trans hec⟩ + +private theorem helper_htreePsi_415.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (d : ↥(DefectiveColors G phi + (TreeSequenceVertexSet T))) (u : V), + let VT : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); (IsProperEdgeColoring G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) e0 ∧ TwoColorComponentSwap G + phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) (D.f0 d) = some (C.gamma + (D.gammaIndex d)) ∧ MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (D.v0 d) = insert (↑d : Fin k) ((MissingColors G phi + (D.v0 d)).erase (C.gamma (D.gammaIndex d))) ∧ ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → ¬f = D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, ¬v = D.v0 d → MissingColors G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) ∧ + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) → IsProperEdgeColoring G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ + IsOneEdgeUncolored (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) e0 ∧ GlobalMaximumTriple G k e0 (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (R d).replacementTree → ( + ∀ (r : Fin (R d).replacementTree.length), Sum.inr ((R d).replacementTree.edge r) ∉ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u)) → + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u); + ( + ∀ v ∈ VT, MissingColors G psi v = MissingColors G phiD v) → TashkinovTree G e0 psi (R + d).replacementTree := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha d u VT gamma phiD heffect hmax hrepEdgeAvoidD psi + hmissFixed r hr + obtain ⟨i, c, hc, hm⟩ := hmax.2.2.2.1 r hr + have he : psi ((R d).replacementTree.edge r) = + phiD ((R d).replacementTree.edge r) := by + simp [psi, TwoColorComponentSwap, hrepEdgeAvoidD r] + refine ⟨i, c, he.trans hc, ?_⟩ + have hiv : (R d).replacementTree.vertex + (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ r.isLt))) ∈ VT := by + have hvset : (R d).replacementTree.vertex + (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ r.isLt))) ∈ + TreeSequenceVertexSet (R d).replacementTree := by + simp [TreeSequenceVertexSet] + rw [(R d).replacement_vertices] at hvset + rcases Finset.mem_union.mp hvset with hold | hpairs + · exact (Finset.mem_sdiff.mp hold).1 + · simp only [Finset.mem_insert, Finset.mem_singleton] at hpairs + rcases hpairs with hi1 | hi2 + · have hlast := (R d).replacement_last_vertices.1 + have hidx : i.val = (R d).replacementTree.length - 1 := by + have hlast' : (R d).replacementTree.vertex + ⟨(R d).replacementTree.length - 1, by omega⟩ = (R d).u1 := by + simpa [(R d).replacement_length] using hlast + have hiEq : (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ r.isLt))) = + ⟨(R d).replacementTree.length - 1, by omega⟩ := by + apply (R d).replacementTree.vertex_injective + exact hi1.trans hlast'.symm + exact congrArg Fin.val hiEq + have hrlast : r.val = (R d).replacementTree.length - 1 := by omega + have hredge := (R d).replacement_last_edges.2 + have her : (R d).replacementTree.edge r = (R d).f2 := by + have hri : r = ⟨(R d).replacementTree.length - 1, by omega⟩ := by + apply Fin.ext + exact hrlast + rw [hri] + simpa [(R d).replacement_length] using hredge + have hf2 : phiD ((R d).f2) = some d.1 := by + have hh := heffect.2.2.2.2.1 (R d).f2 + ⟨(R d).v2, (Finset.mem_sdiff.mp (R d).v2_in_remainder).1, + by unfold Incident; rw [(R d).f2_ends]; simp⟩ (R d).f0_ne_f2.symm + have hh' : phiD (R d).f2 = phi ((R d).f2) := by + simpa [phiD, gamma] using hh + rw [hh', (R d).f2_color] + have hcf : c = d.1 := by + rw [her] at hc + exact Option.some.inj (hc.symm.trans hf2) + have hf1 : phiD ((R d).f1) = some d.1 := by + have hh := heffect.2.2.2.2.1 (R d).f1 + ⟨(R d).v1, (Finset.mem_sdiff.mp (R d).v1_in_remainder).1, + by unfold Incident; rw [(R d).f1_ends]; simp⟩ (R d).f0_ne_f1.symm + have hh' : phiD (R d).f1 = phi ((R d).f1) := by + simpa [phiD, gamma] using hh + rw [hh', (R d).f1_color] + exfalso + have hpresent : d.1 ∈ PresentColors G phiD (R d).u1 := by + unfold PresentColors + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨(R d).f1, by unfold Incident; rw [(R d).f1_ends]; simp, hf1⟩ + have hnotmiss : d.1 ∉ MissingColors G phiD (R d).u1 := by + simpa [MissingColors] using hpresent + have hm' : c ∈ MissingColors G phiD (R d).u1 := by + simpa [hi1] using hm + exact hnotmiss (hcf ▸ hm') + · have hlast := (R d).replacement_last_vertices.2 + have hlast' : (R d).replacementTree.vertex + ⟨(R d).replacementTree.length, by omega⟩ = (R d).u2 := by + simpa [(R d).replacement_length] using hlast + have hidx : i.val = (R d).replacementTree.length := by + have hiEq : (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ r.isLt))) = + ⟨(R d).replacementTree.length, by omega⟩ := by + apply (R d).replacementTree.vertex_injective + exact hi2.trans hlast'.symm + exact congrArg Fin.val hiEq + omega + rw [hmissFixed _ hiv] + exact hm + +private theorem helper_continuation_593.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (d : ↥(DefectiveColors G phi + (TreeSequenceVertexSet T))) (f : E) (w u : V), alpha ≠ D.alpha0 → G.ends f = s(w, u) → u ∉ + ScheideEnlargedVertexSet R → w = (R d).u1 ∨ w = (R d).u2 → Sum.inr f ∈ TwoColorComponent G + phi D.alpha0 alpha (Sum.inl u) → ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∉ TwoColorComponent G phi D.alpha0 alpha (Sum.inl u)) + → + let VT : Finset V := TreeSequenceVertexSet T; + let _ : Finset V := ScheideEnlargedVertexSet R; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u); y0 ∈ VT → D.alpha0 + ≠ gamma → (IsProperEdgeColoring G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) e0 ∧ TwoColorComponentSwap G + phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) (D.f0 d) = some (C.gamma + (D.gammaIndex d)) ∧ MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (D.v0 d) = insert (↑d : Fin k) ((MissingColors G phi + (D.v0 d)).erase (C.gamma (D.gammaIndex d))) ∧ ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → ¬f = D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, ¬v = D.v0 d → MissingColors G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) ∧ + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) → TwoColorComponent G phiD + D.alpha0 alpha (Sum.inl u) = K → ( + ∀ v ∈ VT, Sum.inl v ∉ TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u)) → phiD f = some + alpha → IsProperEdgeColoring G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d + : Fin k) (Sum.inl (D.v0 d))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) e0 ∧ GlobalMaximumTriple G k e0 + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (R d).replacementTree → ( + ∀ (e : E), Sum.inr e ∈ K → + ∃ (c : Fin k), phi e = some c ∧ (c = D.alpha0 ∨ c = alpha)) → + ∃ (alpha : Fin k) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (f : E) (w : V) (u + : V), + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); + let Q : Set (V ⊕ E) := TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u); + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u); + alpha ≠ D.alpha0 ∧ G.ends f = s(w, u) ∧ phiD f = some alpha ∧ Sum.inr f ∈ Q ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∉ Q) ∧ GlobalMaximumTriple G k e0 psi (R + d).replacementTree ∧ D.alpha0 ∈ MissingColors G phiD (C.y (⟨(0 : ℕ), lt_of_lt_of_le + Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p)) ∧ C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two + C.p_ge_two⟩ : Fin C.p) ∈ TreeSequenceVertexSet (R d).replacementTree ∧ w ∈ + TreeSequenceVertexSet (R d).replacementTree ∧ u ∉ TreeSequenceVertexSet (R + d).replacementTree ∧ f ∉ Finset.image (R d).replacementTree.edge Finset.univ := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha d f w u hα hfends huX hwpair hfComp havoid VT X y0 + gamma phiD K hy0T h0gamma heffect hcomponent hQavoid hfD hmax hcomponentColor + have hrepEdgeAvoid : ∀ r : Fin (R d).replacementTree.length, + Sum.inr ((R d).replacementTree.edge r) ∉ K := by + exact @helper_hrepEdgeAvoid_302 V E inferInstance inferInstance inferInstance inferInstance G + k e0 phi T C D R alpha d u havoid hcomponentColor + have hrepEdgeAvoidD : ∀ r : Fin (R d).replacementTree.length, + Sum.inr ((R d).replacementTree.edge r) ∉ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) := by + intro r hr + apply hrepEdgeAvoid r + rw [← hcomponent] + exact hr + let psi := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u) + have hmissFixed : ∀ v ∈ VT, MissingColors G psi v = MissingColors G phiD v := by + exact @helper_hmissFixed_378 V E inferInstance inferInstance inferInstance G k e0 phi T C D + alpha d u havoid hcomponent hcomponentColor + have htreePsi : TashkinovTree G e0 psi (R d).replacementTree := by + exact @helper_htreePsi_415 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D R alpha d u heffect hmax hrepEdgeAvoidD hmissFixed + have hproperPsi : IsProperEdgeColoring G psi := + TwoColorComponentSwapProper G phiD D.alpha0 alpha hα.symm hmax.1 + (Sum.inl u) + have honePsi : IsOneEdgeUncolored psi e0 := by + constructor + · have he := hmax.2.1.1 + change phiD e0 = none at he + simp [psi, TwoColorComponentSwap, he] + · intro e he + obtain ⟨c, hc⟩ := hmax.2.1.2 e he + change phiD e = some c at hc + by_cases heQ : Sum.inr e ∈ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) + · by_cases hc0 : c = D.alpha0 + · refine ⟨alpha, ?_⟩ + simp [psi, TwoColorComponentSwap, heQ, hc, hc0] + · by_cases hca : c = alpha + · refine ⟨D.alpha0, ?_⟩ + simp [psi, TwoColorComponentSwap, heQ, hc, hca] + · refine ⟨c, ?_⟩ + simp [psi, TwoColorComponentSwap, heQ, hc, hc0, hca] + · exact ⟨c, by simp [psi, TwoColorComponentSwap, heQ, hc]⟩ + have hglobal : GlobalMaximumTriple G k e0 psi (R d).replacementTree := by + refine ⟨?_, htreePsi, hmax.2.2.2.2⟩ + exact ⟨hmax.2.2.1.1, hmax.2.2.1.2.1, hmax.2.2.1.2.2.1, + hproperPsi, honePsi⟩ + have hy0Rep : y0 ∈ TreeSequenceVertexSet (R d).replacementTree := by + have hp0 : (0 : ℕ) ≤ C.p - 1 + 2 * (D.gammaIndex d).val := by omega + have ho : (0 : ℕ) < T.length + 1 := by omega + have hn : (0 : ℕ) < (R d).replacementTree.length + 1 := by + rw [(R d).replacement_length] + omega + have hv := (R d).retained_vertices_before 0 hp0 ho + have hbase := C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have heq : (R d).replacementTree.vertex ⟨0, hn⟩ = y0 := by + simpa [y0] using hv.trans hbase + simpa [TreeSequenceVertexSet] using + (show ∃ i : Fin ((R d).replacementTree.length + 1), + (R d).replacementTree.vertex i = y0 from ⟨⟨0, hn⟩, heq⟩) + have hy0D : D.alpha0 ∈ MissingColors G phiD y0 := by + by_cases hy : y0 = D.v0 d + · rw [hy] + change D.alpha0 ∈ MissingColors G + (TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d))) (D.v0 d) + rw [heffect.2.2.2.1] + apply Finset.mem_insert_of_mem + exact Finset.mem_erase.mpr ⟨h0gamma, hy ▸ D.alpha0_missing_at_y0⟩ + · rw [heffect.2.2.2.2.2.1 y0 hy0T hy] + exact D.alpha0_missing_at_y0 + have hsub : TreeSequenceVertexSet (R d).replacementTree ⊆ X := by + intro z hz + rw [(R d).replacement_vertices] at hz + rcases Finset.mem_union.mp hz with hz | hz + · exact (by + unfold X ScheideEnlargedVertexSet + exact Finset.mem_union_left _ (Finset.mem_sdiff.mp hz).1) + · unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_right + apply Finset.mem_biUnion.mpr + exact ⟨d, Finset.mem_univ _, hz⟩ + have huRep : u ∉ TreeSequenceVertexSet (R d).replacementTree := by + intro hu + exact huX (hsub hu) + have hwRep : w ∈ TreeSequenceVertexSet (R d).replacementTree := by + rw [(R d).replacement_vertices] + apply Finset.mem_union_right + rcases hwpair with h | h + · simp [h] + · simp [h] + have hfFresh : f ∉ Finset.univ.image (R d).replacementTree.edge := by + intro hf + obtain ⟨r, _, hr⟩ := Finset.mem_image.mp hf + have hfK : Sum.inr f ∈ K := by simpa [K, TwoColorComponent] using hfComp + apply hrepEdgeAvoid r + simpa [hr] using hfK + refine ⟨alpha, d, f, w, u, hα, hfends, hfD, ?_, ?_, hglobal, hy0D, + hy0Rep, hwRep, huRep, hfFresh⟩ + · rw [hcomponent] + exact hfComp + · exact hQavoid + +theorem ScheideEnlargedSwitchTransport {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) + (hnot : ¬ ColoredVertexSetStronglyClosed G phi + (ScheideEnlargedVertexSet R)) : + ∃ (alpha : Fin k) (d : + { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) }) (f : E) (w u : + V), + let phiD := + TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + let Q := TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) + let psi := TwoColorComponentSwap G phiD D.alpha0 alpha (Sum.inl u) + alpha ≠ D.alpha0 ∧ + G.ends f = s(w, u) ∧ + phiD f = some alpha ∧ + Sum.inr f ∈ Q ∧ + (∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∉ Q) ∧ + GlobalMaximumTriple G k e0 psi (R d).replacementTree ∧ + D.alpha0 ∈ + MissingColors G phiD + (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩) ∧ + C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ + TreeSequenceVertexSet (R d).replacementTree ∧ + w ∈ TreeSequenceVertexSet (R d).replacementTree ∧ + u ∉ TreeSequenceVertexSet (R d).replacementTree ∧ + f ∉ Finset.univ.image (R d).replacementTree.edge := by + classical + obtain ⟨alpha, d, f, w, u, hα, hfα, hfends, hwX, hwT, huX, + hwpair, hfComp, havoid⟩ := + ScheideEnlargedBoundarySelection G k e0 phi T C D R hnot + let VT := TreeSequenceVertexSet T + let X := ScheideEnlargedVertexSet R + let y0 : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let K := TwoColorComponent G phi D.alpha0 alpha (Sum.inl u) + have hclosed : ColoredVertexSetClosed G phi X := + ScheideEnlargedClosed G k e0 phi T C D R + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have hy0T : y0 ∈ VT := by + have hp : (0 : ℕ) < T.length + 1 := by omega + have hv := C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [y0, VT, TreeSequenceVertexSet] using + (show ∃ i : Fin (T.length + 1), T.vertex i = y0 from + ⟨⟨0, hp⟩, by simpa [y0] using hv⟩) + have hy0X : y0 ∈ X := by + unfold X ScheideEnlargedVertexSet + exact Finset.mem_union_left _ hy0T + have hfBoundary : f ∈ BoundaryEdges G X := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwX, u, huX, hfends⟩ + have hα0δ : D.alpha0 ≠ d.1 := by + intro he + have htclosed : ColoredVertexSetClosed G phi VT := + (ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).2.2.2.2 + have hdcard : 2 ≤ (BoundaryColorEdges G phi VT d.1).card := by + have hd : DefectiveColor G phi VT d.1 := by + simpa [DefectiveColors] using d.property + exact hd + obtain ⟨q, hq⟩ := Finset.card_pos.mp + (lt_of_lt_of_le Nat.zero_lt_two hdcard) + have hq' : q ∈ BoundaryEdges G VT := (Finset.mem_filter.mp hq).1 + have hqc : phi q = some d.1 := (Finset.mem_filter.mp hq).2 + have hδmiss : d.1 ∉ MissingColors G phi y0 := by + intro hm + exact (htclosed hq' hy0T hqc) hm + exact hδmiss (he ▸ D.alpha0_missing_at_y0) + have hαδ : alpha ≠ d.1 := by + exact @helper_hαδ_129 V E inferInstance inferInstance inferInstance inferInstance G k e0 phi + T C D R alpha d f w u hfα hfends huX hwpair hproper + have hαgamma : alpha ≠ gamma := by + exact @helper_hαgamma_190 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D R alpha d f w u hfα hfends huX hwpair hproper + have h0gamma : D.alpha0 ≠ gamma := D.alpha0_not_block _ + have heffect := ScheideDefectiveSwitchEffect G k e0 phi T C D d + dsimp [phiD, gamma] at heffect + have hfirst : ∀ (e : E) (c : Fin k), c ≠ gamma → c ≠ d.1 → + (phiD e = some c ↔ phi e = some c) := by + intro e c hc hd + by_cases he : Sum.inr e ∈ TwoColorComponent G phi gamma d.1 + (Sum.inl (D.v0 d)) + · by_cases hcg : phi e = some gamma + · have hv : phiD e = some d.1 := by + simp [phiD, TwoColorComponentSwap, he, hcg] + rw [hv, hcg] + simp [hc.symm, hd.symm] + · by_cases hcd : phi e = some d.1 + · have hv : phiD e = some gamma := by + simp [phiD, TwoColorComponentSwap, he, hcd] + rw [hv, hcd] + simp [hc.symm, hd.symm] + · simp [phiD, TwoColorComponentSwap, he, hcg, hcd] + · simp [phiD, TwoColorComponentSwap, he] + have hfixed : ∀ e : E, + (phiD e = some D.alpha0 ↔ phi e = some D.alpha0) ∧ + (phiD e = some alpha ↔ phi e = some alpha) := by + intro e + exact ⟨hfirst e D.alpha0 h0gamma hα0δ, + hfirst e alpha hαgamma hαδ⟩ + have hgraph : TwoColorIncidenceGraph G phiD D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha := by + ext z z' + cases z with + | inl v => cases z' with + | inl w => simp [TwoColorIncidenceGraph] + | inr e => simp only [TwoColorIncidenceGraph]; rw [(hfixed e).1, (hfixed e).2] + | inr e => cases z' with + | inl v => simp only [TwoColorIncidenceGraph]; rw [(hfixed e).1, (hfixed e).2] + | inr g => simp [TwoColorIncidenceGraph] + have hcomponent : TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) = K := by + change ((TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl u)).supp = ((TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl u)).supp + rw [hgraph] + have hQavoid : ∀ v ∈ VT, Sum.inl v ∉ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl u) := by + intro v hv + rw [hcomponent] + exact havoid v hv + have hfD : phiD f = some alpha := (hfixed f).2.mpr hfα + have hmax := ScheideReplacementMaximum G k e0 phi T C D d (R d) + dsimp [phiD, gamma] at hmax + have hcomponentColor : ∀ e : E, Sum.inr e ∈ K → + ∃ c : Fin k, phi e = some c ∧ (c = D.alpha0 ∨ c = alpha) := by + intro e he + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr e) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl u) at he + have heq := (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mp he + have hp : (TwoColorIncidenceGraph G phi D.alpha0 alpha).Reachable + (Sum.inr e) (Sum.inl u) := SimpleGraph.ConnectedComponent.exact heq + have hsupp := SimpleGraph.mem_support_of_reachable (by simp) hp + obtain ⟨z, hz⟩ := ((TwoColorIncidenceGraph G phi D.alpha0 alpha).mem_support).mp hsupp + cases z with + | inl v => + rcases hz.2 with h | h + · exact ⟨D.alpha0, h, Or.inl rfl⟩ + · exact ⟨alpha, h, Or.inr rfl⟩ + | inr g => simp [TwoColorIncidenceGraph] at hz + exact @helper_continuation_593 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D R alpha d f w u hα hfends huX hwpair hfComp havoid hy0T h0gamma heffect + hcomponent hQavoid hfD hmax hcomponentColor +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideEnlargedVertexSet.lean b/LeanPool/GoldbergSeymour/ScheideEnlargedVertexSet.lean new file mode 100644 index 0000000000..377e8f0f8e --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideEnlargedVertexSet.lean @@ -0,0 +1,38 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideReplacementData + +/-! +# Scheide Enlarged Vertex Set + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The original tree vertices together with the two outside endpoints supplied by each defective- +color replacement. +-/ +noncomputable def ScheideEnlargedVertexSet {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {T : TreeSequence G e0} {C : ScheideReducedConfiguration G k e0 phi T} + {D : ScheideDefectiveSetup G k e0 phi T C} + (R : + ∀ d : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) }, + ScheideReplacementData G k e0 phi T C D d) : + Finset V := by + classical + exact TreeSequenceVertexSet T ∪ Finset.univ.biUnion (fun d => {R d |>.u1, R d |>.u2}) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideExitNoFree.lean b/LeanPool/GoldbergSeymour/ScheideExitNoFree.lean new file mode 100644 index 0000000000..111a7f7054 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideExitNoFree.lean @@ -0,0 +1,817 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainDepartureReturn +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainLastReturnNoFree +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists +public import LeanPool.GoldbergSeymour.ScheideDepartureReturn +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertexTreeExit +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Exit No Free + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_adjacent_indices_forward_266.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (u : V) (gamma delta : + Fin k), gamma ∈ MissingColors G phi u → + ∀ (z : V) (p : (TwoColorIncidenceGraph G phi delta gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi delta gamma u z p → + ∀ (_ : Fin (p.length + (1 : ℕ))), IsProperEdgeColoring G phi → delta ≠ gamma → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi delta gamma; + ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → n < m → H.Adj (p.getVert n) (p.getVert m) → m = n + + (1 : ℕ) := by + classical + intro V E _ _ G k e0 phi T u gamma delta hGammaMissing z p hp i hproper hDeltaGamma H n m hn hm + hnm hadj + let _ := Fintype.ofFinite V + by_contra hne + have hgap : n + 1 < m := by omega + by_cases hn0 : n = 0 + · subst n + have hfirstAdj := p.adj_getVert_succ (by omega : 0 < p.length) + have hdeg : @SimpleGraph.degree _ H (Sum.inl u) (Fintype.ofFinite _) ≤ 1 := by + have hd := MissingColorIncidenceEndpoint G phi gamma delta hDeltaGamma.symm + hproper u hGammaMissing + have hgraph : TwoColorIncidenceGraph G phi gamma delta = H := by + ext x y + cases x <;> cases y <;> simp [H, TwoColorIncidenceGraph, or_comm] + rw [← hgraph] + exact hd + have hstart : p.getVert 0 = Sum.inl u := by simp + have hneigh : p.getVert 1 ≠ p.getVert m := by + intro heq + have h1m : 1 ≤ m := by omega + have := hp.2.1.getVert_injOn (h1m.trans hm) hm heq + omega + have htwo : 2 ≤ (@SimpleGraph.neighborFinset (Sum V E) H (Sum.inl u) + (Fintype.ofFinite _)).card := by + have hs : ({p.getVert 1, p.getVert m} : Finset (Sum V E)) ⊆ + @SimpleGraph.neighborFinset (Sum V E) H (Sum.inl u) + (Fintype.ofFinite _) := by + intro q hq + simp only [Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset, H, hstart] using hfirstAdj + · simpa [SimpleGraph.mem_neighborFinset, H, hstart] using hadj + have hc : ({p.getVert 1, p.getVert m} : Finset (Sum V E)).card = 2 := by + simp [hneigh] + rw [← hc] + exact Finset.card_le_card hs + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hdeg + have : 2 ≤ 1 := htwo.trans hdeg + omega + · have hnlt : n < p.length := by omega + have hleft : H.Adj (p.getVert n) (p.getVert (n - 1)) := by + have h := p.adj_getVert_succ (i := n - 1) (by omega) + have heq : n - 1 + 1 = n := by omega + simpa [H, heq] using h.symm + have hright : H.Adj (p.getVert n) (p.getVert (n + 1)) := by + simpa [H] using p.adj_getVert_succ hnlt + have hnm1 : p.getVert (n - 1) ≠ p.getVert (n + 1) := by + intro heq + have := hp.2.1.getVert_injOn (Nat.sub_le n 1 |>.trans hn) + (Nat.succ_le_of_lt hnlt) heq + omega + have hnm2 : p.getVert (n - 1) ≠ p.getVert m := by + intro heq + have := hp.2.1.getVert_injOn (Nat.sub_le n 1 |>.trans hn) hm heq + omega + have hnm3 : p.getVert (n + 1) ≠ p.getVert m := by + intro heq + have := hp.2.1.getVert_injOn (Nat.succ_le_of_lt hnlt) hm heq + omega + have hthree : 3 ≤ (@SimpleGraph.neighborFinset (Sum V E) H (p.getVert n) + (Fintype.ofFinite _)).card := by + let S : Finset (Sum V E) := + {p.getVert (n - 1), p.getVert (n + 1), p.getVert m} + have hs : S ⊆ @SimpleGraph.neighborFinset (Sum V E) H (p.getVert n) + (Fintype.ofFinite _) := by + intro q hq + simp only [S, Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + · simpa [SimpleGraph.mem_neighborFinset, H] using hadj + have hc : S.card = 3 := by + simp [S, hnm1, hnm2, hnm3] + rw [← hc] + exact Finset.card_le_card hs + have hdeg := TwoColorIncidenceDegreeAtMostTwo G phi delta gamma hproper + (p.getVert n) + change @SimpleGraph.degree _ H (p.getVert n) (Fintype.ofFinite _) ≤ 2 at hdeg + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hdeg + have : 3 ≤ 2 := hthree.trans hdeg + omega + +private theorem helper_new_adj_old_385.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (v : V) ⦃alpha : Fin k⦄, + alpha ∈ MissingColors G phi v → + ∀ (u : V) (gamma delta : Fin k) (z : V) (p : (TwoColorIncidenceGraph G phi delta gamma).Walk + (Sum.inl u) (Sum.inl z)) (i : Fin (p.length + (1 : ℕ))), + let X : Finset V := TreeSequenceVertexSet T; ¬alpha = gamma → BoundaryColorEdges G phi X alpha + = ∅ → delta ≠ gamma → delta ≠ alpha → + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha gamma; ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi delta gamma; + let R : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (n : ℕ), (↑i : ℕ) ≤ n ∧ n ≤ p.length ∧ p.getVert n = q}; ( + ∀ {n : ℕ} {w : V}, (↑i : ℕ) ≤ n → n ≤ p.length → p.getVert n = Sum.inl w → n = (↑i : ℕ) ∧ w = + v ∨ (↑i : ℕ) < n ∧ w ∉ X) → ( + ∀ {e : E} {w : V}, TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X) → + ∀ {q r : V ⊕ E}, q ∈ R → (TwoColorIncidenceGraph G phi1 delta alpha).Adj q r → H.Adj q r := by + classical + intro V E _ _ G k e0 phi T v alpha hAlphaMissing u gamma delta z p i X hAlphaGamma + hAlphaBoundary hDeltaGamma hDeltaAlpha phi1 htreeFixed1 H R tail_vertex + boundary_of_tree_incident_outside q r hq hadj + obtain ⟨n, hn, hnl, hget⟩ := hq + cases q with + | inl w => + cases r with + | inl x => simp [TwoColorIncidenceGraph] at hadj + | inr e => + have hnew : Incident G w e ∧ + (phi1 e = some delta ∨ phi1 e = some alpha) := by + simpa [TwoColorIncidenceGraph] using hadj + have hold : phi e = some delta ∨ phi e = some gamma := by + by_cases hti : TreeIncidentEdge T e + · have hfix := htreeFixed1 e hti + rcases hnew.2 with hd | ha + · exact Or.inl (hfix.symm.trans hd) + · have hAlphaOld : phi e = some alpha := hfix.symm.trans ha + rcases tail_vertex hn hnl hget with hbase | hout + · have hwAlpha : alpha ∈ PresentColors G phi w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hnew.1, hAlphaOld⟩ + have hwMissing : alpha ∈ MissingColors G phi w := by + simpa [hbase.2] using hAlphaMissing + have hnotPresent : alpha ∉ PresentColors G phi w := by + simpa [MissingColors] using hwMissing + exact False.elim (hnotPresent hwAlpha) + · have heb := boundary_of_tree_incident_outside hti hout.2 hnew.1 + have hec : e ∈ BoundaryColorEdges G phi X alpha := + Finset.mem_filter.mpr ⟨heb, hAlphaOld⟩ + rw [hAlphaBoundary] at hec + simp at hec + · rcases hnew.2 with hd | ha + · by_cases heA : phi e = some alpha + · have heq : some gamma = some delta := by + simpa [phi1, OutsideTreeColorSwap, hti, heA, hAlphaGamma] using hd + exact False.elim (hDeltaGamma (Option.some.inj heq).symm) + · by_cases heG : phi e = some gamma + · have heq : some alpha = some delta := by + simpa [phi1, OutsideTreeColorSwap, hti, heA, heG, + Ne.symm hAlphaGamma] using hd + exact False.elim (hDeltaAlpha (Option.some.inj heq).symm) + · exact Or.inl (by + simpa [phi1, OutsideTreeColorSwap, hti, heA, heG] using hd) + · by_cases heA : phi e = some alpha + · have heq : some gamma = some alpha := by + simpa [phi1, OutsideTreeColorSwap, hti, heA, hAlphaGamma] using ha + exact False.elim (hAlphaGamma (Option.some.inj heq).symm) + · by_cases heG : phi e = some gamma + · exact Or.inr heG + · have : phi e = some alpha := by + simp [phi1, OutsideTreeColorSwap, hti, heA, heG] at ha + exact False.elim (heA this) + simpa [H, TwoColorIncidenceGraph] using And.intro hnew.1 hold + | inr e => + cases r with + | inr f => simp [TwoColorIncidenceGraph] at hadj + | inl w => + have hn0 : 0 < n := by + by_contra hz + have hz0 : n = 0 := by omega + rw [hz0] at hget + simp at hget + have hprev := p.adj_getVert_succ (i := n - 1) (by omega) + have hidx : n - 1 + 1 = n := by omega + rw [hidx, hget] at hprev + cases hprevNode : p.getVert (n - 1) with + | inr f => + rw [hprevNode] at hprev + exfalso + simp [TwoColorIncidenceGraph] at hprev + | inl x => + have hold : phi e = some delta ∨ phi e = some gamma := by + rw [hprevNode] at hprev + simpa [H, TwoColorIncidenceGraph] using hprev.2 + have hinc : Incident G w e := by + simpa [TwoColorIncidenceGraph] using hadj.1 + simpa [H, TwoColorIncidenceGraph] using And.intro hinc hold + +private theorem helper_R_closed_463.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (v : V) ⦃alpha : Fin k⦄ + (u : V) (gamma delta : Fin k) (z : V) (p : (TwoColorIncidenceGraph G phi delta gamma).Walk + (Sum.inl u) (Sum.inl z)), ScheideDefectiveChainPath T phi delta gamma u z p → + ∀ (i : Fin (p.length + (1 : ℕ))), p.getVert (↑i : ℕ) = Sum.inl v → v ∈ TreeSequenceVertexSet T + → IsProperEdgeColoring G phi → + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha gamma; ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → alpha ∈ MissingColors G phi1 v → + ∀ (fR : E), p.getVert ((↑i : ℕ) + (1 : ℕ)) = Sum.inr fR → Incident G v fR ∧ (phi fR = some + delta ∨ phi fR = some gamma) → (↑i : ℕ) + (1 : ℕ) < p.length → phi fR = some delta → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi delta gamma; ( + ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → H.Adj (p.getVert n) (p.getVert m) → n + (1 : ℕ) = m + ∨ m + (1 : ℕ) = n) → + let R : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (n : ℕ), (↑i : ℕ) ≤ n ∧ n ≤ p.length ∧ p.getVert n = q}; ( + ∀ {q r : V ⊕ E}, q ∈ R → (TwoColorIncidenceGraph G phi1 delta alpha).Adj q r → H.Adj q r) → + ∀ {q r : V ⊕ E}, q ∈ R → (TwoColorIncidenceGraph G phi1 delta alpha).Adj q r → r ∈ R := by + classical + intro V E _ _ G k e0 phi T v alpha u gamma delta z p hp i hiVertex hvT hproper phi1 htreeFixed1 + hAlphaMissing1 fR hfRnode hfRdata hfirstLt hfRDelta H old_adjacent_indices R new_adj_old q r + hq hadj + let _ := Fintype.ofFinite V + have holdAdj := new_adj_old hq hadj + obtain ⟨n, hn, hnl, hget⟩ := hq + have hqOld : q ∈ TwoColorComponent G phi delta gamma (Sum.inl u) := by + rw [← hp.2.2.2] + rw [← hget] + exact p.getVert_mem_support n + have hrOld : r ∈ TwoColorComponent G phi delta gamma (Sum.inl u) := by + change H.connectedComponentMk r = H.connectedComponentMk (Sum.inl u) + change H.connectedComponentMk q = H.connectedComponentMk (Sum.inl u) at hqOld + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + holdAdj.symm).trans hqOld + have hrSupport : r ∈ p.support := by + have : r ∈ {x | x ∈ p.support} := by + rw [hp.2.2.2] + exact hrOld + exact this + obtain ⟨m, hmget, hml⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hrSupport + have hindices := old_adjacent_indices n m hnl hml + (by simpa [H, hget, hmget] using holdAdj) + rcases hindices with hforward | hback + · exact ⟨m, by omega, hml, hmget⟩ + · by_cases hm : i.val ≤ m + · exact ⟨m, hm, hml, hmget⟩ + · have hnbase : n = i.val := by omega + have hmbase : m + 1 = i.val := by omega + have hqv : q = Sum.inl v := by + rw [← hget, hnbase, hiVertex] + cases hr : r with + | inl w => + have hbad : (TwoColorIncidenceGraph G phi1 delta alpha).Adj + (Sum.inl v) (Sum.inl w) := by + simpa [hqv, hr] using hadj + exfalso + simp [TwoColorIncidenceGraph] at hbad + | inr e => + have hadj' : (TwoColorIncidenceGraph G phi1 delta alpha).Adj + (Sum.inl v) (Sum.inr e) := by + simpa [hqv, hr] using hadj + have hnew : Incident G v e ∧ + (phi1 e = some delta ∨ phi1 e = some alpha) := by + simpa [TwoColorIncidenceGraph] using hadj' + have hnotAlpha : phi1 e ≠ some alpha := by + intro he + have hpresent : alpha ∈ PresentColors G phi1 v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hnew.1, he⟩ + have hnotPresent : alpha ∉ PresentColors G phi1 v := by + simpa [MissingColors] using hAlphaMissing1 + exact hnotPresent hpresent + have heDelta : phi1 e = some delta := hnew.2.resolve_right hnotAlpha + have heTree : TreeIncidentEdge T e := by + exact ⟨v, hvT, hnew.1⟩ + have heOld : phi e = some delta := + (htreeFixed1 e heTree).symm.trans heDelta + have hef : e ≠ fR := by + intro hef + have hnodes : p.getVert m = p.getVert (i.val + 1) := by + rw [hmget, hr, hef, hfRnode] + have hidx := hp.2.1.getVert_injOn hml + (Nat.le_of_lt hfirstLt) hnodes + omega + exact False.elim + ((hproper hef ⟨v, hnew.1, hfRdata.1⟩ heOld) hfRDelta) + +private theorem helper_boundary_tail_unique_545.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (v u : V) (gamma delta : + Fin k) (z : V) (p : (TwoColorIncidenceGraph G phi delta gamma).Walk (Sum.inl u) (Sum.inl + z)), ScheideDefectiveChainPath T phi delta gamma u z p → + ∀ (i : Fin (p.length + (1 : ℕ))), p.getVert (↑i : ℕ) = Sum.inl v → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet T) → + let X : Finset V := TreeSequenceVertexSet T; ( + ∀ {q : Sym2 V} {x y : V}, x ∈ q → y ∈ q → x ≠ y → q = s(x, y)) → + ∀ (fR : E), p.getVert ((↑i : ℕ) + (1 : ℕ)) = Sum.inr fR → + let R : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (n : ℕ), (↑i : ℕ) ≤ n ∧ n ≤ p.length ∧ p.getVert n = q}; + ∀ f ∈ BoundaryEdges G X, Sum.inr f ∈ R → f = fR := by + classical + intro V E _ _ G k e0 phi T v u gamma delta z p hp i hiVertex hAfter X ends_eq_of_mem fR hfRnode + R f hf hfr + obtain ⟨n, hn, hnl, hget⟩ := hfr + have hnstrict : i.val < n := by + have hne : n ≠ i.val := by + intro heq + have : Sum.inr f = Sum.inl v := by + rw [← hget, heq, hiVertex] + simp at this + omega + by_cases heq : n = i.val + 1 + · apply Sum.inr.inj + rw [← hget, heq, hfRnode] + · have hfar : i.val + 1 < n := by omega + have hn0 : 0 < n := by omega + have hnlt : n < p.length := by + by_contra hnot + have hnend : n = p.length := by omega + have hz : p.getVert n = Sum.inl z := by simp [hnend] + rw [hget] at hz + simp at hz + have hleftAdj := p.adj_getVert_succ (i := n - 1) (by omega) + have hleftIdx : n - 1 + 1 = n := by omega + rw [hleftIdx, hget] at hleftAdj + have hrightAdj := p.adj_getVert_succ (i := n) hnlt + rw [hget] at hrightAdj + cases hl : p.getVert (n - 1) with + | inr e => + rw [hl] at hleftAdj + exfalso + simp [TwoColorIncidenceGraph] at hleftAdj + | inl a => + rw [hl] at hleftAdj + cases hr : p.getVert (n + 1) with + | inr e => + rw [hr] at hrightAdj + exfalso + simp [TwoColorIncidenceGraph] at hrightAdj + | inl b => + rw [hr] at hrightAdj + have haout : a ∉ X := by + have hi : i.val < n - 1 := by omega + exact hAfter + ⟨n - 1, Nat.lt_succ_of_le ((Nat.sub_le n 1).trans hnl)⟩ hi a hl + have hbout : b ∉ X := by + have hi : i.val < n + 1 := by omega + exact hAfter + ⟨n + 1, Nat.lt_succ_of_le (Nat.succ_le_of_lt hnlt)⟩ hi b hr + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have habv : a ≠ b := by + intro habv + have hnodes : p.getVert (n - 1) = p.getVert (n + 1) := by + rw [hl, hr, habv] + have hidx := hp.2.1.getVert_injOn + (Nat.sub_le _ _ |>.trans hnl) (Nat.succ_le_of_lt hnlt) hnodes + omega + have habEnds : G.ends f = s(a, b) := + ends_eq_of_mem hleftAdj.1 hrightAdj.1 habv + have hxab : x = a ∨ x = b := by + have hxmem : x ∈ s(a, b) := by + rw [← habEnds] + exact hends ▸ Sym2.mem_iff.mpr (Or.inl rfl) + simpa using hxmem + rcases hxab with rfl | rfl + · exact False.elim (haout hx) + · exact False.elim (hbout hx) + +private theorem helper_hcomponentTail_689.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (v : V) ⦃alpha : Fin k⦄ (u : + V) (gamma delta : Fin k) (z : V) (p : (TwoColorIncidenceGraph G phi delta gamma).Walk + (Sum.inl u) (Sum.inl z)) (i : Fin (p.length + (1 : ℕ))), + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha gamma; + let R : Set (V ⊕ E) := {q : V ⊕ E | + ∃ (n : ℕ), (↑i : ℕ) ≤ n ∧ n ≤ p.length ∧ p.getVert n = q}; Sum.inl v ∈ R → ( + ∀ {q r : V ⊕ E}, q ∈ R → (TwoColorIncidenceGraph G phi1 delta alpha).Adj q r → r ∈ R) → + let C : Set (V ⊕ E) := TwoColorComponent G phi1 delta alpha (Sum.inl v); C ⊆ R := by + classical + intro V E _ _ G k e0 phi T v alpha u gamma delta z p i phi1 R hvR R_closed C q hq + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + change (TwoColorIncidenceGraph G phi1 delta alpha).connectedComponentMk q = + (TwoColorIncidenceGraph G phi1 delta alpha).connectedComponentMk + (Sum.inl v) at hq + have hreach := SimpleGraph.ConnectedComponent.exact hq + obtain ⟨walk⟩ := hreach + have propagate : ∀ {a b : Sum V E}, + (TwoColorIncidenceGraph G phi1 delta alpha).Walk a b → a ∈ R → b ∈ R := by + intro a b walk ha + induction walk with + | nil => exact ha + | @cons a c b hac rest ih => exact ih (R_closed ha hac) + exact propagate walk.reverse hvR + +private theorem helper_continuation_592.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), GlobalMaximumTriple G k e0 phi T → + ∀ (v : V) ⦃alpha : Fin k⦄, alpha ∈ MissingColors G phi v → + ∀ (u : V) (gamma delta : Fin k), gamma ∈ MissingColors G phi u → + ∀ (z : V) (p : (TwoColorIncidenceGraph G phi delta gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi delta gamma u z p → + ∀ (i : Fin (p.length + (1 : ℕ))), p.getVert (↑i : ℕ) = Sum.inl v → v ∈ TreeSequenceVertexSet T + → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet T) → + let X : Finset V := TreeSequenceVertexSet T; IsProperEdgeColoring G phi → TashkinovTree G e0 + phi T → ¬alpha = gamma → BoundaryColorEdges G phi X alpha = ∅ → BoundaryColorEdges G phi X + gamma = ∅ → delta ≠ gamma → delta ≠ alpha → ( + ∀ {q : Sym2 V} {x y : V}, x ∈ q → y ∈ q → x ≠ y → q = s(x, y)) → + let phi1 : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha gamma; + IsProperEdgeColoring G phi1 → IsOneEdgeUncolored phi1 e0 → ( + ∀ w ∈ X, MissingColors G phi1 w = MissingColors G phi w) → ( + ∀ (f : E), TreeIncidentEdge T f → phi1 f = phi f) → alpha ∈ MissingColors G phi1 v → delta ∈ + DefectiveColors G phi1 X → ( + ∀ (j : Fin T.length), TreeIncidentEdge T (T.edge j)) → alpha ∈ TreeFreeColors phi1 T → False + := by + classical + intro V E _ _ _ G k e0 phi T hglobal v alpha hAlphaMissing u gamma delta hGammaMissing z p hp i + hiVertex hvT hAfter X hproper htree hAlphaGamma hAlphaBoundary hGammaBoundary hDeltaGamma + hDeltaAlpha ends_eq_of_mem phi1 hproper1 hone1 hmissing1 htreeFixed1 hAlphaMissing1 hDelta1 + tree_edge_incident hAlphaFree1 + have htree1 : TashkinovTree G e0 phi1 T := by + intro j hj + obtain ⟨a, c, hcolor, hmiss⟩ := htree j hj + refine ⟨a, c, ?_, ?_⟩ + · exact (htreeFixed1 (T.edge j) (tree_edge_incident j)).trans hcolor + · let w := T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt))) + have hwX : w ∈ X := by simp [w, X, TreeSequenceVertexSet] + rw [hmissing1 w hwX] + exact hmiss + have hglobal1 : GlobalMaximumTriple G k e0 phi1 T := by + refine ⟨?_, htree1, hglobal.2.2⟩ + exact ⟨hglobal.1.1, hglobal.1.2.1, hglobal.1.2.2.1, hproper1, hone1⟩ + have hiLt : i.val < p.length := by + by_contra hn + have hiEq : i.val = p.length := by omega + have hz : p.getVert i.val = Sum.inl z := by simp [hiEq] + have hvz : v = z := Sum.inl.inj (hiVertex.symm.trans hz) + exact hp.2.2.1 (hvz ▸ hvT) + have hfirstNode : ∃ fR : E, p.getVert (i.val + 1) = Sum.inr fR := by + have hadj := p.adj_getVert_succ hiLt + rw [hiVertex] at hadj + cases hq : p.getVert (i.val + 1) with + | inl w => + rw [hq] at hadj + exfalso + simp [TwoColorIncidenceGraph] at hadj + | inr f => exact ⟨f, rfl⟩ + obtain ⟨fR, hfRnode⟩ := hfirstNode + have hfRdata : Incident G v fR ∧ + (phi fR = some delta ∨ phi fR = some gamma) := by + have hadj := p.adj_getVert_succ hiLt + rw [hiVertex, hfRnode] at hadj + simpa [TwoColorIncidenceGraph] using hadj + have hfirstLt : i.val + 1 < p.length := by + by_contra hn + have heq : i.val + 1 = p.length := by omega + have hz : p.getVert (i.val + 1) = Sum.inl z := by simp [heq] + rw [hfRnode] at hz + simp at hz + have hnextNode : ∃ wR : V, p.getVert (i.val + 2) = Sum.inl wR := by + have hadj := p.adj_getVert_succ hfirstLt + rw [hfRnode] at hadj + cases hq : p.getVert (i.val + 2) with + | inl w => exact ⟨w, rfl⟩ + | inr f => + rw [hq] at hadj + exfalso + simp [TwoColorIncidenceGraph] at hadj + obtain ⟨wR, hwRnode⟩ := hnextNode + have hwRout : wR ∉ X := by + have hibound : i.val + 2 < p.length + 1 := by omega + let r : Fin (p.length + 1) := ⟨i.val + 2, hibound⟩ + have hir : i.val < r.val := by simp [r] + have hout := hAfter r hir wR (by simpa [r] using hwRnode) + simpa [X] using hout + have hwRinc : Incident G wR fR := by + have hadj := p.adj_getVert_succ hfirstLt + rw [hfRnode, hwRnode] at hadj + simpa [TwoColorIncidenceGraph] using hadj.1 + have hvwR : v ≠ wR := by + intro h + exact hwRout (h ▸ (by simpa [X] using hvT)) + have hfRBoundary : fR ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, by simpa [X] using hvT, wR, hwRout, + ends_eq_of_mem hfRdata.1 hwRinc hvwR⟩ + have hfRDelta : phi fR = some delta := by + rcases hfRdata.2 with hd | hg + · exact hd + · have : fR ∈ BoundaryColorEdges G phi X gamma := + Finset.mem_filter.mpr ⟨hfRBoundary, hg⟩ + rw [hGammaBoundary] at this + simp at this + let H := TwoColorIncidenceGraph G phi delta gamma + have adjacent_indices_forward := @helper_adjacent_indices_forward_266 V E inferInstance + inferInstance G k e0 phi T u gamma delta hGammaMissing z p hp i hproper hDeltaGamma + have old_adjacent_indices : ∀ (n m : ℕ), n ≤ p.length → m ≤ p.length → + H.Adj (p.getVert n) (p.getVert m) → n + 1 = m ∨ m + 1 = n := by + intro n m hn hm hadj + have hne : n ≠ m := by + intro h + subst m + exact H.loopless.irrefl _ hadj + rcases lt_or_gt_of_ne hne with hnm | hmn + · exact Or.inl (adjacent_indices_forward n m hn hm hnm hadj).symm + · exact Or.inr (adjacent_indices_forward m n hm hn hmn hadj.symm).symm + let R : Set (Sum V E) := {q | ∃ n : ℕ, i.val ≤ n ∧ n ≤ p.length ∧ + p.getVert n = q} + have hvR : Sum.inl v ∈ R := by + exact ⟨i.val, le_rfl, by omega, hiVertex⟩ + have tail_vertex : ∀ {n : ℕ} {w : V}, i.val ≤ n → n ≤ p.length → + p.getVert n = Sum.inl w → + (n = i.val ∧ w = v) ∨ (i.val < n ∧ w ∉ X) := by + intro n w hn hnl hget + by_cases heq : n = i.val + · left + refine ⟨heq, ?_⟩ + apply Sum.inl.inj + rw [← hget, heq, hiVertex] + · right + have hlt : i.val < n := by omega + refine ⟨hlt, ?_⟩ + exact hAfter ⟨n, by omega⟩ hlt w hget + have boundary_of_tree_incident_outside : ∀ {e : E} {w : V}, + TreeIncidentEdge T e → w ∉ X → Incident G w e → e ∈ BoundaryEdges G X := by + intro e w he hwout hwe + obtain ⟨x, hx, hxe⟩ := he + have hxX : x ∈ X := by simpa [X] using hx + have hxw : x ≠ w := by + intro h + exact hwout (h ▸ hxX) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxX, w, hwout, ends_eq_of_mem hxe hwe hxw⟩ + have new_adj_old := @helper_new_adj_old_385 V E inferInstance inferInstance G k e0 phi T v alpha + hAlphaMissing u gamma delta z p i hAlphaGamma hAlphaBoundary hDeltaGamma hDeltaAlpha + htreeFixed1 tail_vertex boundary_of_tree_incident_outside + have R_closed := @helper_R_closed_463 V E inferInstance inferInstance G k e0 phi T v alpha u gamma + delta z p hp i hiVertex hvT hproper htreeFixed1 hAlphaMissing1 fR hfRnode hfRdata hfirstLt + hfRDelta old_adjacent_indices new_adj_old + let C := TwoColorComponent G phi1 delta alpha (Sum.inl v) + have hcomponentTail := @helper_hcomponentTail_689 V E inferInstance inferInstance G k e0 phi T v + alpha u gamma delta z p i hvR R_closed + have boundary_tail_unique := @helper_boundary_tail_unique_545 V E inferInstance inferInstance G k + e0 phi T v u gamma delta z p hp i hiVertex hAfter ends_eq_of_mem fR hfRnode + obtain ⟨z1, q, hq⟩ := ScheideDefectiveChainPathExists G k e0 phi1 T + hglobal1 delta alpha hDelta1 hAlphaFree1 v hvT hAlphaMissing1 + have hboundary := ScheideDefectiveChainBoundaryEdges G k e0 phi1 T + hglobal1 delta alpha hDelta1 hAlphaFree1 v hvT hAlphaMissing1 z1 q hq + have hnewFacts := ScheideGlobalMaximumBoundaryFacts G k e0 phi1 T hglobal1 + have hcard : 3 ≤ (BoundaryColorEdges G phi1 X delta).card := by + simpa [X] using (hnewFacts.2.2 delta (by simpa [X] using hDelta1)).2 + obtain ⟨f, hf⟩ := Finset.card_pos.mp (by omega : + 0 < (BoundaryColorEdges G phi1 X delta).card) + obtain ⟨g, hg, hgf⟩ := + (BoundaryColorEdges G phi1 X delta).exists_mem_ne (by omega) f + have edge_in_tail : ∀ e ∈ BoundaryColorEdges G phi1 X delta, + Sum.inr e ∈ R := by + intro e he + have heq := (hboundary e).mp (by simpa [X] using he) + apply hcomponentTail + change Sum.inr e ∈ TwoColorComponent G phi1 delta alpha (Sum.inl v) + have hs : Sum.inr e ∈ {x | x ∈ q.support} := heq.2 + rw [hq.2.2.2] at hs + exact hs + have hfEq : f = fR := by + exact boundary_tail_unique f (Finset.mem_filter.mp hf).1 (edge_in_tail f hf) + have hgEq : g = fR := by + exact boundary_tail_unique g (Finset.mem_filter.mp hg).1 (edge_in_tail g hg) + exact hgf (hgEq.trans hfEq.symm) + +private theorem helper_branch_109.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), GlobalMaximumTriple G k e0 phi T → + ∀ (v : V) ⦃alpha : Fin k⦄, alpha ∈ MissingColors G phi v → alpha ∈ TreeFreeColors phi T → + ∀ (u : V) (gamma delta : Fin k), u ∈ TreeSequenceVertexSet T → gamma ∈ MissingColors G phi u → + delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) → + ∀ (z : V) (p : (TwoColorIncidenceGraph G phi delta gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi delta gamma u z p → + ∀ (i : Fin (p.length + (1 : ℕ))), p.getVert (↑i : ℕ) = Sum.inl v → v ∈ TreeSequenceVertexSet T + → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet T) → + let X : Finset V := TreeSequenceVertexSet T; IsProperEdgeColoring G phi → IsOneEdgeUncolored + phi e0 → TashkinovTree G e0 phi T → ColoredVertexSetClosed G phi X → ¬alpha = gamma → + False := by + classical + intro V E _ _ _ G k e0 phi T hglobal v alpha hAlphaMissing hAlphaFree u gamma delta hu + hGammaMissing hDelta z p hp i hiVertex hvT hAfter X hproper hone htree hclosed hAlphaGamma + have hfacts := ScheideGlobalMaximumBoundaryFacts G k e0 phi T hglobal + have hAlphaTree : alpha ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hvT, hAlphaMissing⟩ + have hGammaTree : gamma ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨u, hu, hGammaMissing⟩ + have hAlphaBoundary : BoundaryColorEdges G phi X alpha = ∅ := by + simpa [X] using hfacts.2.1 alpha hAlphaTree + have hGammaBoundary : BoundaryColorEdges G phi X gamma = ∅ := by + simpa [X] using hfacts.2.1 gamma hGammaTree + have hDeltaPresent : ∀ w, w ∈ X → delta ∈ PresentColors G phi w := by + intro w hw + have hcard : 0 < (BoundaryColorEdges G phi X delta).card := by + have hc : 3 ≤ (BoundaryColorEdges G phi X delta).card := by + simpa [X] using (hfacts.2.2 delta hDelta).2 + omega + obtain ⟨f, hf⟩ := Finset.card_pos.mp hcard + have hnot : delta ∉ MissingColors G phi w := by + intro hm + exact hclosed (Finset.mem_filter.mp hf).1 hw + (Finset.mem_filter.mp hf).2 hm + simpa [MissingColors] using hnot + have hDeltaGamma : delta ≠ gamma := by + intro h + have hpresent := hDeltaPresent u (by simpa [X] using hu) + have hnot : gamma ∉ PresentColors G phi u := by + simpa [MissingColors] using hGammaMissing + exact hnot (h ▸ hpresent) + have hDeltaAlpha : delta ≠ alpha := by + intro h + have hpresent := hDeltaPresent v (by simpa [X] using hvT) + have hnot : alpha ∉ PresentColors G phi v := by + simpa [MissingColors] using hAlphaMissing + exact hnot (h ▸ hpresent) + have ends_eq_of_mem : ∀ {q : Sym2 V} {x y : V}, x ∈ q → y ∈ q → x ≠ y → + q = s(x, y) := by + intro q x y hx hy hxy + induction q using Sym2.inductionOn with + | _ a b => + simp only [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> + simp_all [] + let phi1 := OutsideTreeColorSwap T phi alpha gamma + have hswap := OutsideTreeColorSwapStable T ∅ phi alpha gamma hproper hone + hclosed hAlphaTree hGammaTree hAlphaGamma + have hproper1 : IsProperEdgeColoring G phi1 := by + simpa [phi1] using hswap.1 + have hone1 : IsOneEdgeUncolored phi1 e0 := by + simpa [phi1] using hswap.2.1 + have hmissing1 : ∀ w, w ∈ X → + MissingColors G phi1 w = MissingColors G phi w := by + intro w hw + simpa [phi1, X] using hswap.2.2.1.2 w (by simpa [X] using hw) + have htreeFixed1 : ∀ f, TreeIncidentEdge T f → phi1 f = phi f := by + intro f hf + simpa [phi1] using hswap.2.2.2 f hf + have hAlphaMissing1 : alpha ∈ MissingColors G phi1 v := by + rw [hmissing1 v (by simpa [X] using hvT)] + exact hAlphaMissing + have boundary_tree_incident : ∀ {f}, f ∈ BoundaryEdges G X → + TreeIncidentEdge T f := by + intro f hf + obtain ⟨x, hx, y, hy, hxy⟩ := by + simpa [BoundaryEdges] using hf + exact ⟨x, by simpa [X] using hx, by simp [Incident, hxy]⟩ + have hboundaryColors : ∀ c, + BoundaryColorEdges G phi1 X c = BoundaryColorEdges G phi X c := by + intro c + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + constructor + · rintro ⟨hf, hc⟩ + exact ⟨hf, (htreeFixed1 f (boundary_tree_incident hf)).symm.trans hc⟩ + · rintro ⟨hf, hc⟩ + exact ⟨hf, (htreeFixed1 f (boundary_tree_incident hf)).trans hc⟩ + have hDelta1 : delta ∈ DefectiveColors G phi1 X := by + have hDeltaDef : DefectiveColor G phi X delta := by + change delta ∈ Finset.univ.filter (fun c => DefectiveColor G phi X c) at hDelta + exact (Finset.mem_filter.mp hDelta).2 + change delta ∈ Finset.univ.filter (fun c => DefectiveColor G phi1 X c) + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + unfold DefectiveColor at hDeltaDef ⊢ + rw [hboundaryColors delta] + exact hDeltaDef + have tree_edge_incident : ∀ j : Fin T.length, + TreeIncidentEdge T (T.edge j) := by + intro j + obtain ⟨a, ha⟩ := T.attaches j + refine ⟨T.vertex j.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · simp [Incident, ha] + have hAlphaFree1 : alpha ∈ TreeFreeColors phi1 T := by + simp only [TreeFreeColors, Finset.mem_sdiff] at hAlphaFree ⊢ + refine ⟨?_, ?_⟩ + · simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hvT, hAlphaMissing1⟩ + · intro hused + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hused + rcases hused with ⟨j, hj, hc⟩ + apply hAlphaFree.2 + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨j, hj, (htreeFixed1 (T.edge j) (tree_edge_incident j)).symm.trans hc⟩ + exact @helper_continuation_592 V E inferInstance inferInstance inferInstance G k + e0 phi T hglobal v alpha hAlphaMissing u gamma delta hGammaMissing z p hp i hiVertex hvT + hAfter hproper htree hAlphaGamma hAlphaBoundary hGammaBoundary hDeltaGamma hDeltaAlpha + ends_eq_of_mem hproper1 hone1 hmissing1 htreeFixed1 hAlphaMissing1 hDelta1 + tree_edge_incident hAlphaFree1 +theorem ScheideExitNoFree {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) : + ∀ v ∈ ScheideExitVertices T phi, + Disjoint (MissingColors G phi v) (TreeFreeColors phi T) := by + classical + intro v hvExit + rw [Finset.disjoint_left] + intro alpha hAlphaMissing hAlphaFree + have hExit : ScheideExitVertex T phi v := by + simpa [ScheideExitVertices] using hvExit + rcases hExit with + ⟨u, gamma, delta, hu, hGammaMissing, hDelta, z, p, hp, + i, hiVertex, hvT, hAfter⟩ + let X := TreeSequenceVertexSet T + have horder := ScheideGlobalMaximumOrder G k e0 phi T hglobal + have hproper : IsProperEdgeColoring G phi := hglobal.1.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := hglobal.1.2.2.2.2 + have htree : TashkinovTree G e0 phi T := hglobal.2.1 + have helem : ColoredVertexSetElementary G phi X := by + exact horder.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi X := by + exact horder.2.2.2.2 + by_cases hAlphaGamma : alpha = gamma + · subst gamma + have huv : u = v := by + by_contra hne + have hd := Finset.disjoint_left.mp + (helem (by simpa [X] using hu) (by simpa [X] using hvT) hne) + exact hd hGammaMissing hAlphaMissing + rcases ScheideDefectiveChainDepartureReturn G k e0 phi T hglobal + delta alpha hDelta hAlphaFree u hu hGammaMissing z p hp with + ⟨i1, i2, v1, v2, hdepart⟩ + have hiEq : i.val = i2.val := by + by_contra hne + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hv2out := hAfter i2 hlt v2 hdepart.2.2.2.2.2.1 + exact hv2out hdepart.2.2.2.2.2.2.1 + · have hvout := hdepart.2.2.2.2.2.2.2 i hgt v hiVertex + exact hvout hvT + have hvEq : v = v2 := by + apply Sum.inl.inj + calc + Sum.inl v = p.getVert i.val := hiVertex.symm + _ = p.getVert i2.val := by rw [hiEq] + _ = Sum.inl v2 := hdepart.2.2.2.2.2.1 + have hno := ScheideDefectiveChainLastReturnNoFree G k e0 phi T hglobal + delta alpha hDelta hAlphaFree u hu hGammaMissing z p hp + i1 i2 v1 v2 hdepart + exact (Finset.disjoint_left.mp hno) (hvEq ▸ hAlphaMissing) hAlphaFree + · exact @helper_branch_109 V E inferInstance inferInstance inferInstance G k e0 + phi T hglobal v alpha hAlphaMissing hAlphaFree u gamma delta hu hGammaMissing hDelta z p hp + i hiVertex hvT hAfter hproper hone htree hclosed hAlphaGamma +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideExitVertex.lean b/LeanPool/GoldbergSeymour/ScheideExitVertex.lean new file mode 100644 index 0000000000..319996ec0d --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideExitVertex.lean @@ -0,0 +1,42 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Combinatorics.SimpleGraph.Walk.Traversal +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath + +/-! +# Scheide Exit Vertex + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A tree vertex that is the last tree vertex on an appropriate defective-color component path. -/ +def ScheideExitVertex {V E : Type*} [Fintype V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (v : V) : Prop := + ∃ (u : V) (gamma delta : Fin k), + u ∈ TreeSequenceVertexSet T ∧ + gamma ∈ MissingColors G phi u ∧ + delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) ∧ + ∃ (z : V) (p : (TwoColorIncidenceGraph G phi delta gamma).Walk (Sum.inl u) (Sum.inl z)), + ScheideDefectiveChainPath T phi delta gamma u z p ∧ + ∃ i : Fin (p.length + 1), + p.getVert i.val = Sum.inl v ∧ + v ∈ TreeSequenceVertexSet T ∧ + ∀ r : Fin (p.length + 1), + i.val < r.val → ∀ w : V, p.getVert r.val = Sum.inl w → w ∉ TreeSequenceVertexSet T + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideExitVertexTreeExit.lean b/LeanPool/GoldbergSeymour/ScheideExitVertexTreeExit.lean new file mode 100644 index 0000000000..e5e14b133e --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideExitVertexTreeExit.lean @@ -0,0 +1,284 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.TreeExit + +/-! +# Scheide Exit Vertex Tree Exit + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_108.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (v u : V) (gamma delta : + Fin k), gamma ∈ MissingColors G phi u → + ∀ (z : V) (p : (TwoColorIncidenceGraph G phi delta gamma).Walk (Sum.inl u) (Sum.inl z)) (i : + Fin (p.length + (1 : ℕ))), p.getVert (↑i : ℕ) = Sum.inl v → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑i : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet T) → p.IsPath → z ∉ + TreeSequenceVertexSet T → {x : V ⊕ E | x ∈ p.support} = TwoColorComponent G phi delta + gamma (Sum.inl u) → + ∀ (hivmem : Sum.inl v ∈ p.support), + let a : (TwoColorIncidenceGraph G phi delta gamma).Walk (Sum.inl u) (Sum.inl v) := p.takeUntil + (Sum.inl v) hivmem; + let q : (TwoColorIncidenceGraph G phi delta gamma).Walk (Sum.inl v) (Sum.inl z) := p.dropUntil + (Sum.inl v) hivmem; a.append q = p → a.length + q.length = p.length → a.length = (↑i : ℕ) + → q.IsPath → q.reverse.IsPath → (0 : ℕ) < q.length → q.length ≠ (1 : ℕ) → ( + ∀ w ∈ TreeSequenceVertexSet T, Sum.inl w ∈ q.reverse.support ↔ w = v) → delta ∈ MissingColors + G phi z ∨ gamma ∈ MissingColors G phi z := by + classical + intro V E _ _ G k e0 T phi v u gamma delta hgamma z p i hiv hafter hppath hz hpsupp hivmem a q + hsplit hlen halen hqpath hqrev hqpos hqnotone hqonly + let _ := Fintype.ofFinite V + by_cases hd : delta ∈ MissingColors G phi z + · exact Or.inl hd + · right + have component_of_endpoint : ∀ e, Incident G z e → + Sum.inr e ∈ p.support → p.getVert (p.length - 1) = Sum.inr e := by + intro e hez hem + have hem' := hem + obtain ⟨j, hj, hjle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hem' + have hje : p.getVert j = Sum.inr e := hj + have hjlt : j < p.length := by + by_contra hnot + have : j = p.length := by omega + subst j + simp [p.getVert_length] at hje + have endpoint_cases : ∀ x y : V, x ≠ y → x ∈ G.ends e → y ∈ G.ends e → + z ∈ G.ends e → x = z ∨ y = z := by + intro x y hxy hx hy hz + refine Sym2.inductionOn (G.ends e) ?_ hx hy hz + intro a b hx hy hz + simp only [Sym2.mem_iff] at hx hy hz + aesop + have hprev : j = 0 ∨ p.getVert (j - 1) = Sum.inl z ∨ + p.getVert (j + 1) = Sum.inl z := by + by_cases hj0 : j = 0 + · exact Or.inl hj0 + · right + have hadj := p.adj_getVert_succ (i := j - 1) (by omega) + have hleft : (TwoColorIncidenceGraph G phi delta gamma).Adj + (p.getVert (j - 1)) (Sum.inr e) := by + rw [← hje] + simpa [Nat.sub_add_cancel (Nat.one_le_iff_ne_zero.mpr hj0)] using hadj + have hright := p.adj_getVert_succ (i := j) hjlt + cases hcase : p.getVert (j - 1) with + | inl x => + have hleft' := hleft + rw [hcase] at hleft' + simp only [TwoColorIncidenceGraph] at hleft' + rcases hleft' with ⟨hx, hxcol⟩ + cases hcase2 : p.getVert (j + 1) with + | inl y => + have hright' := hright + rw [hje, hcase2] at hright' + simp only [TwoColorIncidenceGraph] at hright' + rcases hright' with ⟨hy, hycol⟩ + have hxy : x ≠ y := by + intro hxy + have hjnext : j + 1 ≤ p.length := by omega + have hjprev : j - 1 ≤ p.length := by omega + have hi := hppath.getVert_injOn hjprev hjnext + (show p.getVert (j - 1) = p.getVert (j + 1) by rw [hcase, hcase2, hxy]) + omega + rcases endpoint_cases x y hxy hx hy hez with h | h + · aesop + · aesop + | inr y => rw [hje, hcase2] at hright; simp [TwoColorIncidenceGraph] at hright + | inr x => + have hleft' := hleft + rw [hcase] at hleft' + simp [TwoColorIncidenceGraph] at hleft' + cases hprev with + | inl hj0 => subst j; simp at hje + | inr hrest => + rcases hrest with hzprev | hznext + · have hjprev : j - 1 ≤ p.length := by omega + have hinj := hppath.getVert_injOn hjprev (by omega : p.length ≤ p.length) + (hzprev.trans (p.getVert_length).symm) + have hEq := hinj + have hji : p.length - 1 = j := by omega + rw [hji] + exact hje + · have hjnext : j + 1 ≤ p.length := by omega + have hinj := hppath.getVert_injOn hjnext (by omega : p.length ≤ p.length) + (hznext.trans (p.getVert_length).symm) + have hEq := hinj + have hji : p.length - 1 = j := by omega + rw [hji] + exact hje + have support_of_endpoint : ∀ e, Incident G z e → + (phi e = some delta ∨ phi e = some gamma) → Sum.inr e ∈ p.support := by + intro e hez hecolor + have hedge : + (TwoColorIncidenceGraph G phi delta gamma).Adj (Sum.inl z) (Sum.inr e) := + ⟨hez, hecolor⟩ + have hecomp := + SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hedge + have hzcomp : + (TwoColorIncidenceGraph G phi delta gamma).connectedComponentMk + (Sum.inl z) = + (TwoColorIncidenceGraph G phi delta gamma).connectedComponentMk + (Sum.inl u) := by + apply (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mp + change Sum.inl z ∈ TwoColorComponent G phi delta gamma (Sum.inl u) + rw [← hpsupp] + exact p.end_mem_support + have hmem : Sum.inr e ∈ TwoColorComponent G phi delta gamma (Sum.inl u) := by + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr (hecomp.symm.trans hzcomp) + have hset := congrArg (fun s : Set (Sum V E) => Sum.inr e ∈ s) hpsupp + exact hset.mpr hmem + change gamma ∈ Finset.univ \ PresentColors G phi z + have hdp : delta ∈ PresentColors G phi z := by + by_contra hn + apply hd + exact Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, hn⟩ + change gamma ∈ Finset.univ \ PresentColors G phi z + apply Finset.mem_sdiff.mpr + constructor + · exact Finset.mem_univ _ + · intro hgp + change gamma ∈ (Finset.univ.filter (fun c => ∃ e, Incident G z e ∧ phi e = some c)) at hgp + change delta ∈ (Finset.univ.filter (fun c => ∃ e, Incident G z e ∧ phi e = some c)) at hdp + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hgp hdp + rcases hgp with ⟨e, hez, hec⟩ + rcases hdp with ⟨d, hdz, hdc⟩ + have helast := component_of_endpoint e hez + (support_of_endpoint e hez (Or.inr hec)) + have hdlast := component_of_endpoint d hdz + (support_of_endpoint d hdz (Or.inl hdc)) + have hed : e = d := by + apply Sum.inr.inj + exact helast.symm.trans hdlast + have hcol : gamma = delta := by + have hc := congrArg phi hed + rw [hec, hdc] at hc + exact Option.some.inj hc + have hpnon : 0 < p.length := by omega + have hfirst := p.adj_getVert_succ (i := 0) (by omega) + have hnot : gamma ∉ PresentColors G phi u := by + exact (Finset.mem_sdiff.mp (show gamma ∈ MissingColors G phi u from hgamma)).2 + rw [p.getVert_zero] at hfirst + cases hnext : p.getVert 1 with + | inl x => rw [hnext] at hfirst; simp [TwoColorIncidenceGraph] at hfirst + | inr f => + have hfirst' := hfirst + rw [hnext] at hfirst' + simp only [TwoColorIncidenceGraph] at hfirst' + rcases hfirst' with ⟨hinc, hcolor⟩ + have hcolor' : phi f = some gamma := by + rcases hcolor with hcolor | hcolor + · rw [hcol] + exact hcolor + · exact hcolor + apply hnot + unfold PresentColors + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, ⟨f, hinc, hcolor'⟩⟩ + +theorem ScheideExitVertexTreeExit {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (v : V) + (hexit : ScheideExitVertex T phi v) : + ∃ gamma delta : Fin k, + delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) ∧ TreeExit T phi delta gamma v := by + classical + rcases hexit with ⟨u, gamma, delta, hu, hgamma, hdelta, z, p, hp, i, hiv, hvi, hafter⟩ + rcases hp with ⟨hpu, hppath, hz, hpsupp⟩ + have hivmem : Sum.inl v ∈ p.support := by + apply SimpleGraph.Walk.mem_support_iff_exists_getVert.mpr + exact ⟨i.val, hiv, by omega⟩ + let a := p.takeUntil (Sum.inl v) hivmem + let q := p.dropUntil (Sum.inl v) hivmem + have hsplit : a.append q = p := p.take_spec hivmem + have hlen : a.length + q.length = p.length := by + have ht := congrArg SimpleGraph.Walk.length hsplit + simpa using ht + have halen : a.length = i.val := by + have haend : a.getVert a.length = Sum.inl v := by simp [a] + have hpidx : p.getVert a.length = Sum.inl v := by + rw [← hsplit, SimpleGraph.Walk.getVert_append] + simp [] + have hpidx' : p.getVert a.length = p.getVert i.val := hpidx.trans hiv.symm + apply hppath.getVert_injOn + · have hale : a.length ≤ p.length := by rw [← hlen]; omega + exact hale + · have hi_le : i.val ≤ p.length := by omega + exact hi_le + · exact hpidx' + have hqpath : q.IsPath := hppath.dropUntil _ + have hqrev : q.reverse.IsPath := hqpath.reverse + have hqpos : 0 < q.length := by + apply (SimpleGraph.Walk.not_nil_iff_lt_length).mp + intro hnil + have hev : (Sum.inl v : Sum V E) = Sum.inl z := SimpleGraph.Walk.Nil.eq hnil + have hvz : v = z := Sum.inl.inj hev + exact hz (hvz.symm ▸ hvi) + have hqnotone : q.length ≠ 1 := by + intro hone + have hadj := q.adj_getVert_succ (i := 0) (by omega) + have hend := q.getVert_length + rw [hone] at hend + rw [q.getVert_zero, hend] at hadj + simp [TwoColorIncidenceGraph] at hadj + have hqv : v ∈ TreeSequenceVertexSet T := hvi + have hqonly : ∀ w ∈ TreeSequenceVertexSet T, + (Sum.inl w ∈ q.reverse.support ↔ w = v) := by + intro w hw + constructor + · intro hmem + obtain ⟨j, hj, hjle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hmem + have hj' : j ≤ q.reverse.length := hjle + have hjq : q.reverse.getVert j = Sum.inl w := hj + have hji : q.getVert (q.length - j) = Sum.inl w := by + exact (SimpleGraph.Walk.getVert_reverse q j).symm.trans hjq + have hqidx : q.getVert (q.length - j) = Sum.inl w := hji + by_cases hn : q.length - j = 0 + · have : q.getVert 0 = Sum.inl w := by simpa [hn] using hqidx + have hvw : v = w := by simpa using this + exact hvw.symm + · have hpos : 0 < q.length - j := Nat.pos_of_ne_zero hn + have hpw : p.getVert (i.val + (q.length - j)) = Sum.inl w := by + calc + p.getVert (i.val + (q.length - j)) = + (a.append q).getVert (i.val + (q.length - j)) := by rw [hsplit] + _ = Sum.inl w := by + have hnot : ¬ i.val + (q.length - j) < a.length := by omega + simpa [SimpleGraph.Walk.getVert_append, hnot, halen] using hji + have hjleq : j ≤ q.length := by simpa using hj' + have hbound : i.val + (q.length - j) ≤ p.length := by omega + have hgt : i.val < i.val + (q.length - j) := by omega + exact (hafter ⟨i.val + (q.length - j), by omega⟩ hgt w hpw).elim hw + · intro hwv + subst w + apply SimpleGraph.Walk.mem_support_iff_exists_getVert.mpr + exact ⟨q.reverse.length, q.reverse.getVert_length, by simp⟩ + refine ⟨gamma, delta, hdelta, ?_⟩ + refine ⟨z, q.reverse, ?_⟩ + unfold TreeExitPath + refine ⟨hqrev, ?_, ?_, hqv, ?_, ?_⟩ + · have hlenrev : q.reverse.length = q.length := q.length_reverse + omega + · exact hz + · exact @helper_branch_108 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) (@phi) + (@v) (@u) (@gamma) (@delta) (@hgamma) (@z) (@p) (@i) (@hiv) (@hafter) (@hppath) (@hz) + (@hpsupp) (@hivmem) (@hsplit) (@hlen) (@halen) (@hqpath) (@hqrev) (@hqpos) (@hqnotone) + (@hqonly) + · exact hqonly + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideExitVertices.lean b/LeanPool/GoldbergSeymour/ScheideExitVertices.lean new file mode 100644 index 0000000000..9a246687bb --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideExitVertices.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideExitVertex + +/-! +# Scheide Exit Vertices + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The finite set of last tree vertices of defective-color component paths. -/ +noncomputable def ScheideExitVertices {V E : Type*} [Fintype V] [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) : Finset V := by + classical + exact Finset.univ.filter fun v => ScheideExitVertex T phi v + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideGlobalMaximumBoundaryFacts.lean b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumBoundaryFacts.lean new file mode 100644 index 0000000000..d31f57a396 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumBoundaryFacts.lean @@ -0,0 +1,284 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed + +public import LeanPool.GoldbergSeymour.DefectiveColors + +public import LeanPool.GoldbergSeymour.InternalEdges + +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder + +/-! +# Scheide Global Maximum Boundary Facts + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ScheideGlobalMaximumBoundaryFacts_branch_90.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0), ColoredVertexSetClosed G + phi (TreeSequenceVertexSet T) → Odd (TreeSequenceVertexSet T).card → IsProperEdgeColoring + G phi → + let _ := TreeSequenceVertexSet T; + ∀ alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T), Odd (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card ∧ 3 ≤ (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card := by + classical + intro V E _ _ G k e0 phi T hclosed hodd hproper X alpha halpha + have hcard : 2 ≤ (BoundaryColorEdges G phi X alpha).card := by + exact (Finset.mem_filter.mp halpha).2 + let B := BoundaryColorEdges G phi X alpha + let edges := (Finset.univ : Finset E).filter (fun e => phi e = some alpha) + let good := edges.filter (fun e => ∀ v, Incident G v e → v ∈ X) + have hpresent : ∀ v, v ∈ X → alpha ∈ PresentColors G phi v := by + intro v hv + have hBpos : 0 < B.card := by dsimp [B]; omega + obtain ⟨b, hb⟩ := Finset.card_pos.mp hBpos + have hbb : b ∈ BoundaryEdges G X := (Finset.mem_filter.mp hb).1 + have hbc : phi b = some alpha := (Finset.mem_filter.mp hb).2 + have hn : alpha ∉ MissingColors G phi v := by + intro hm + exact (hclosed hbb hv hbc) hm + simpa [MissingColors] using hn + have hedge_mem : ∀ e, e ∈ edges ↔ phi e = some alpha := by + intro e + simp [edges] + have hgood : ∀ e, e ∈ good ↔ e ∈ edges ∧ ∀ v, Incident G v e → v ∈ X := by + intro e + simp [good] + have hendcard : ∀ e : E, (G.ends e).toFinset.card = 2 := by + intro e + apply Sym2.card_toFinset_of_not_isDiag + intro hd + exact G.loopless e ((G.ends e).diagElem hd) (Sym2.diag_diagElem hd).symm + have hgood_disjoint : ∀ ⦃e⦄, e ∈ good → ∀ ⦃f⦄, f ∈ good → + e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + exact (hproper hef ⟨v, Sym2.mem_toFinset.mp hev, Sym2.mem_toFinset.mp hvf⟩ + (hedge_mem e |>.mp (hgood e |>.mp he).1)) + (hedge_mem f |>.mp (hgood f |>.mp hf).1) + have hgood_union : (good.biUnion fun e => (G.ends e).toFinset).card = 2 * good.card := by + have aux : ∀ s : Finset E, s ⊆ good → + (s.biUnion fun e => (G.ends e).toFinset).card = 2 * s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset + (s.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + have hh := hgood_disjoint (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf)) + exact (Finset.disjoint_left.mp hh) hev hvf + rw [Finset.card_union_of_disjoint hd, hendcard] + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem hes] + omega + exact aux good (by intro e he; exact he) + have hgood_cover : ∀ v, v ∈ X → + v ∈ good.biUnion (fun e => (G.ends e).toFinset) ∨ + v ∈ B.biUnion (fun e => X.filter (fun v => Incident G v e)) := by + intro v hv + obtain ⟨e, he, hve⟩ := by simpa [PresentColors] using hpresent v hv + by_cases hall : ∀ w, Incident G w e → w ∈ X + · left + exact Finset.mem_biUnion.mpr ⟨e, (hgood e).mpr ⟨(hedge_mem e).mpr hve, hall⟩, + Sym2.mem_toFinset.mpr he⟩ + · right + push Not at hall + obtain ⟨w, hw, hwo⟩ := hall + obtain ⟨z, hze⟩ := Sym2.mem_iff_exists.mp hw + have heq : G.ends e = s(w, z) := hze + have hne : w ≠ z := by + intro h + exact G.loopless e w (by simpa [h] using heq) + have hzX : z ∈ X := by + have : v = w ∨ v = z := by + have : v ∈ s(w, z) := by rw [← heq]; exact he + simpa using this + rcases this with rfl | rfl + · exact False.elim (hwo hv) + · exact hv + have hbound : e ∈ BoundaryEdges G X := by + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, z, hzX, w, hwo, heq.trans Sym2.eq_swap⟩ + exact Finset.mem_biUnion.mpr ⟨e, + (Finset.mem_filter.mpr ⟨hbound, hve⟩), + Finset.mem_filter.mpr ⟨hv, he⟩⟩ + have hb_fiber : ∀ e, e ∈ B → + (X.filter (fun v => Incident G v e)).card = 1 := by + intro e he + obtain ⟨u, hu, v, hv, huv⟩ := by + simpa [B, BoundaryColorEdges, BoundaryEdges] using + (Finset.mem_filter.mp he).1 + have hs : X.filter (fun x => Incident G x e) = {u} := by + ext x + simp only [Finset.mem_filter, Finset.mem_singleton, Incident, + huv, Sym2.mem_iff] + constructor + · rintro ⟨hx, rfl | hxe⟩ + · exact rfl + · exact False.elim (hv (hxe ▸ hx)) + · intro hxu + subst hxu + exact ⟨hu, Or.inl rfl⟩ + rw [hs] + simp + have hb_disjoint : ∀ ⦃e⦄, e ∈ B → ∀ ⦃f⦄, f ∈ B → + e ≠ f → Disjoint (X.filter (fun v => Incident G v e)) + (X.filter (fun v => Incident G v f)) := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + exact (hproper hef ⟨v, (Finset.mem_filter.mp hev).2, + (Finset.mem_filter.mp hvf).2⟩ + (Finset.mem_filter.mp he).2) + (Finset.mem_filter.mp hf).2 + have hb_union : (B.biUnion fun e => X.filter (fun v => Incident G v e)).card = B.card := by + have aux : ∀ s : Finset E, s ⊆ B → + (s.biUnion fun e => X.filter (fun v => Incident G v e)).card = s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (X.filter (fun v => Incident G v e)) + (s.biUnion fun f => X.filter (fun v => Incident G v f)) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + exact (Finset.disjoint_left.mp (hb_disjoint (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf))) hev hvf) + rw [Finset.card_union_of_disjoint hd, hb_fiber e (hs (Finset.mem_insert_self e s))] + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem hes] + exact Nat.add_comm 1 s.card + exact aux B (by intro e he; exact he) + let U := good.biUnion (fun e => (G.ends e).toFinset) + let W := B.biUnion (fun e => X.filter (fun v => Incident G v e)) + have hU : U ⊆ X := by + intro v hv + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hv + exact (hgood e).mp he |>.2 v (Sym2.mem_toFinset.mp hve) + have hW : W ⊆ X := by + intro v hv + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hv + exact (Finset.mem_filter.mp hve).1 + have hUW : Disjoint U W := by + rw [Finset.disjoint_left] + intro v hvU hvW + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hvU + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvW + have hef : e ≠ f := by + intro hef + subst hef + obtain ⟨u, hu, w, hw, huw⟩ := by + simpa [B, BoundaryColorEdges, BoundaryEdges] using + (Finset.mem_filter.mp hf).1 + have : w ∈ X := (hgood e).mp he |>.2 w + (by change w ∈ G.ends e; rw [huw]; exact Sym2.mem_mk_right u w) + exact hw this + exact (hproper hef ⟨v, Sym2.mem_toFinset.mp hve, + (Finset.mem_filter.mp hvf).2⟩ + (hedge_mem e |>.mp (hgood e |>.mp he).1)) + (Finset.mem_filter.mp hf).2 + have hUX : U ∪ W = X := by + apply Finset.Subset.antisymm + · exact Finset.union_subset hU hW + · intro v hv + rcases hgood_cover v hv with hvU | hvB + · exact Finset.mem_union.mpr (Or.inl hvU) + · obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hvB + exact Finset.mem_union.mpr (Or.inr (Finset.mem_biUnion.mpr + ⟨e, he, hve⟩)) + have hcardeq : X.card = 2 * good.card + B.card := by + rw [← hUX, Finset.card_union_of_disjoint hUW, hgood_union, hb_union] + rcases hodd with ⟨q, hq⟩ + have hBodd : Odd B.card := by + have hq' : X.card = 2 * q + 1 := by simpa [X] using hq + have hqgood : good.card ≤ q := by omega + refine ⟨q - good.card, ?_⟩ + omega + have hBthree : 3 ≤ B.card := by + rcases hBodd with ⟨q, hq⟩ + have hcardB : 2 ≤ B.card := by simpa [B] using hcard + omega + exact ⟨by simpa [B] using hBodd, by simpa [B] using hBthree⟩ + +theorem ScheideGlobalMaximumBoundaryFacts {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) : + (DefectiveColors G phi (TreeSequenceVertexSet T) = ∅ → + ColoredVertexSetStronglyClosed G phi (TreeSequenceVertexSet T)) ∧ + (∀ alpha ∈ TreeMissingColors phi T, + BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha = ∅) ∧ + (∀ alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T), + Odd (BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha).card ∧ + 3 ≤ (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card) := by + classical + have horder := ScheideGlobalMaximumOrder G k e0 phi T hglobal + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + horder.2.2.2.2 + have hodd : Odd (TreeSequenceVertexSet T).card := horder.2.2.1 + have hproper : IsProperEdgeColoring G phi := hglobal.1.2.2.2.1 + let X := TreeSequenceVertexSet T + constructor + · intro hempty + refine ⟨hclosed, ?_⟩ + intro f g c hf hg hfg hfc hgc + exfalso + have htwo : 2 ≤ (BoundaryColorEdges G phi X c).card := by + have hinsert : 2 ≤ ({f, g} : Finset E).card := by simp [hfg] + apply le_trans hinsert + exact Finset.card_le_card (by + intro e he + simp only [Finset.mem_insert, Finset.mem_singleton] at he + rcases he with rfl | rfl + · exact (Finset.mem_filter.mpr ⟨hf, hfc⟩) + · exact (Finset.mem_filter.mpr ⟨hg, hgc⟩)) + have hmem : c ∈ DefectiveColors G phi X := by + simp only [DefectiveColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact htwo + rw [hempty] at hmem + simp at hmem + constructor + · intro alpha halpha + ext f + constructor + · intro hf + have hfb : f ∈ BoundaryEdges G X := (Finset.mem_filter.mp hf).1 + have hfc : phi f = some alpha := (Finset.mem_filter.mp hf).2 + change alpha ∈ X.biUnion (fun v => MissingColors G phi v) at halpha + simp only [Finset.mem_biUnion] at halpha + obtain ⟨v, hvX, hva⟩ := halpha + exact False.elim ((hclosed hfb hvX hfc) hva) + · intro hf + simp at hf + · exact @ScheideGlobalMaximumBoundaryFacts_branch_90 V E inferInstance inferInstance + G k e0 phi T hclosed hodd hproper +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideGlobalMaximumFixedPairMaximal.lean b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumFixedPairMaximal.lean new file mode 100644 index 0000000000..4065acc38a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumFixedPairMaximal.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple + +/-! +# Scheide Global Maximum Fixed Pair Maximal + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideGlobalMaximumFixedPairMaximal {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) : + FixedPairMaximalTashkinovTree G e0 phi T := by + classical + refine ⟨hglobal.2.1, ?_⟩ + intro S hS hsub + have hk : ChromaticIndex G - 1 = k := by + have hchrom := hglobal.1.2.1 + omega + have hScard : (TreeSequenceVertexSet S).card ≤ TashkinovOrder G := by + unfold TashkinovOrder + dsimp only + apply Finset.le_max' + apply Finset.mem_insert_of_mem + apply Finset.mem_filter.mpr + constructor + · exact Finset.mem_range.mpr (Nat.lt_succ_of_le (Finset.card_le_univ _)) + · rw [hk] + exact ⟨e0, phi, S, hglobal.1, hS, rfl⟩ + have hcard : (TreeSequenceVertexSet S).card ≤ + (TreeSequenceVertexSet T).card := by + rw [hglobal.2.2] + exact hScard + have heq : TreeSequenceVertexSet T = TreeSequenceVertexSet S := + Finset.eq_of_subset_of_card_le hsub hcard + exact heq.symm.subset + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideGlobalMaximumFourFree.lean b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumFourFree.lean new file mode 100644 index 0000000000..7a66d91ed9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumFourFree.lean @@ -0,0 +1,228 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts + +/-! +# Scheide Global Maximum Four Free + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideGlobalMaximumFourFree {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) : + 4 ≤ (TreeFreeColors phi T).card := by + classical + have horder := ScheideGlobalMaximumOrder G k e0 phi T hglobal + have htree := hglobal.2.1 + have hcounts := ScheideGlobalMaximumMissingCounts G k e0 phi T hglobal + let X := TreeSequenceVertexSet T + let D := (G.ends e0).toFinset + have hDsub : D ⊆ X := by + intro v hv + have hv' : v ∈ G.ends e0 := Sym2.mem_toFinset.mp hv + rw [← T.first_edge] at hv' + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + rw [hi, Sym2.mem_iff] at hv' + rcases hv' with hv | hv <;> subst v <;> + simp [X, TreeSequenceVertexSet] + have hDcard : D.card = 2 := by + have hn : ¬ (G.ends e0).IsDiag := by + intro hd + induction he : G.ends e0 using Sym2.inductionOn with + | _ a b => + rw [he] at hd + rw [Sym2.mk_isDiag_iff] at hd + apply G.loopless e0 a + rw [he, hd] + exact Sym2.card_toFinset_of_not_isDiag _ hn + have hDinc : ∀ v ∈ D, Incident G v e0 := by + intro v hv + exact Sym2.mem_toFinset.mp hv + have hdisj : (X : Set V).PairwiseDisjoint (fun v => MissingColors G phi v) := by + intro u hu v hv huv + exact horder.2.2.2.1 hu hv huv + have hnonempty : ∀ v ∈ X, (MissingColors G phi v).Nonempty := by + intro v hv + apply Finset.card_pos.mp + by_cases hi : Incident G v e0 + · have hh := (hcounts v hv).1 hi |>.2 + omega + · have hh := (hcounts v hv).2 hi |>.2 + omega + let firstColor : (v : V) → v ∈ X → Fin k := fun v hv => + Classical.choose (hnonempty v hv) + have firstMem : ∀ (v : V) (hv : v ∈ X), firstColor v hv ∈ MissingColors G phi v := by + intro v hv + exact Classical.choose_spec (hnonempty v hv) + have hsecond : ∀ (v : V) (hv : v ∈ D), + ((MissingColors G phi v).erase (firstColor v (hDsub hv))).Nonempty := by + intro v hv + apply Finset.card_pos.mp + rw [Finset.card_erase_of_mem (firstMem v (hDsub hv))] + have hh := (hcounts v (hDsub hv)).1 (hDinc v hv) |>.2 + omega + let extraColor : (v : V) → v ∈ D → Fin k := fun v hv => + Classical.choose (hsecond v hv) + have extraMem : ∀ (v : V) (hv : v ∈ D), + extraColor v hv ∈ (MissingColors G phi v).erase (firstColor v (hDsub hv)) := by + intro v hv + exact Classical.choose_spec (hsecond v hv) + have hmissing : X.card + 2 ≤ (TreeMissingColors phi T).card := by + let domain := Sum {v : V // v ∈ X} {v : V // v ∈ D} + let color : domain → Fin k := fun p => match p with + | Sum.inl v => firstColor v.1 v.2 + | Sum.inr v => extraColor v.1 v.2 + have hmap : ∀ p : domain, color p ∈ TreeMissingColors phi T := by + intro p + rcases p with p | p + · apply Finset.mem_biUnion.mpr + exact ⟨p.1, p.2, firstMem p.1 p.2⟩ + · apply Finset.mem_biUnion.mpr + exact ⟨p.1, hDsub p.2, Finset.mem_erase.mp (extraMem p.1 p.2) |>.2⟩ + have hinj : Function.Injective color := by + intro p q hpq + rcases p with p | p <;> rcases q with q | q + · have hu : p.1 = q.1 := by + by_contra hn + have hd := hdisj p.2 q.2 hn + have hpq' : firstColor p.1 p.2 = firstColor q.1 q.2 := by simpa [color] using hpq + exact (Finset.disjoint_left.mp hd) (firstMem p.1 p.2) + (by simpa only [hpq'] using firstMem q.1 q.2) + have heq : p = q := Subtype.ext hu + cases heq + rfl + · have hu : p.1 = q.1 := by + by_contra hn + have hd := hdisj p.2 (hDsub q.2) hn + have hpq' : firstColor p.1 p.2 = extraColor q.1 q.2 := by simpa [color] using hpq + exact (Finset.disjoint_left.mp hd) (firstMem p.1 p.2) + (by simpa only [hpq'] using Finset.mem_erase.mp (extraMem q.1 q.2) |>.2) + have he := Finset.mem_erase.mp (extraMem q.1 q.2) + exact False.elim (he.1 (by simpa [color, hu] using hpq.symm)) + · have hu : p.1 = q.1 := by + by_contra hn + have hd := hdisj (hDsub p.2) q.2 hn + have hpq' : extraColor p.1 p.2 = firstColor q.1 q.2 := by simpa [color] using hpq + exact (Finset.disjoint_left.mp hd) (Finset.mem_erase.mp (extraMem p.1 p.2) |>.2) + (by simpa only [hpq'] using firstMem q.1 q.2) + have he := Finset.mem_erase.mp (extraMem p.1 p.2) + exact False.elim (he.1 (by simpa [color, hu] using hpq)) + · have hu : p.1 = q.1 := by + by_contra hn + have hd := hdisj (hDsub p.2) (hDsub q.2) hn + have hpq' : extraColor p.1 p.2 = extraColor q.1 q.2 := by simpa [color] using hpq + exact (Finset.disjoint_left.mp hd) (Finset.mem_erase.mp (extraMem p.1 p.2) |>.2) + (by simpa only [hpq'] using Finset.mem_erase.mp (extraMem q.1 q.2) |>.2) + have heq : p = q := Subtype.ext hu + cases heq + rfl + let A : Finset domain := + X.attach.map ⟨Sum.inl, Sum.inl_injective⟩ ∪ + D.attach.map ⟨Sum.inr, Sum.inr_injective⟩ + have hAdisj : Disjoint + (X.attach.map ⟨Sum.inl, Sum.inl_injective⟩) + (D.attach.map ⟨Sum.inr, Sum.inr_injective⟩) := by + rw [Finset.disjoint_left] + intro z hz1 hz2 + have hx := hz1 + have hy := hz2 + rw [Finset.mem_map] at hx hy + rcases hx with ⟨u, hu, rfl⟩ + rcases hy with ⟨v, hv, h⟩ + cases h + have hAc : A.card = X.card + 2 := by + dsimp [A] + rw [Finset.card_union_of_disjoint hAdisj] + simp [hDcard] + have hle : A.card ≤ (TreeMissingColors phi T).card := by + apply Finset.card_le_card_of_injOn color + · intro p hp + exact hmap p + · exact hinj.injOn + omega + have hused : (TreeUsedColors phi T).card ≤ X.card - 2 := by + let J := (Finset.univ : Finset (Fin T.length)).filter (fun j => 1 ≤ j.val) + let edgeColor : (j : Fin T.length) → 1 ≤ j.val → Fin k := fun j hj => + Classical.choose (htree j hj |>.choose_spec) + have edgeColor_spec : ∀ (j : Fin T.length) (hj : 1 ≤ j.val), + phi (T.edge j) = some (edgeColor j hj) := by + intro j hj + exact (Classical.choose_spec (htree j hj |>.choose_spec)).1 + let B := J.attach.image (fun j : {j // j ∈ J} => edgeColor j.1 (by exact + (Finset.mem_filter.mp j.2).2)) + have husedsub : TreeUsedColors phi T ⊆ B := by + intro c hc + change c ∈ Finset.univ.filter (fun alpha => ∃ j, 1 ≤ j.val ∧ phi (T.edge j) = some alpha) + at hc + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hc + rcases hc with ⟨j, hj, hc⟩ + have hj' : 1 ≤ j.val := hj + have hm := edgeColor_spec j hj' + have he : edgeColor j hj' = c := by simpa [hc] using hm.symm + apply Finset.mem_image.mpr + exact ⟨⟨j, by exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj'⟩⟩, by simp [he]⟩ + have hJ : J.card = T.length - 1 := by + have hje : J = (Finset.univ : Finset (Fin T.length)).erase ⟨0, T.positive⟩ := by + ext j + simp only [J, Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_erase, + Finset.mem_univ, true_and, and_true] + constructor + · intro hj hz + subst j + simp at hj + · intro hj + by_contra hz + apply hj + apply Fin.ext + have hz' : j.val = 0 := by omega + simp [hz'] + rw [hje, Finset.card_erase_of_mem (Finset.mem_univ _)] + simp + have hX : X.card = T.length + 1 := by + dsimp [X, TreeSequenceVertexSet] + rw [Finset.card_image_iff.mpr (by + intro a ha b hb hab + exact T.vertex_injective hab)] + simp + have hb : B.card ≤ J.card := by simpa [B] using (Finset.card_image_le : B.card ≤ J.attach.card) + exact (Finset.card_le_card husedsub).trans (hb.trans_eq hJ) |>.trans_eq (by omega) + unfold TreeFreeColors + have hsub : TreeUsedColors phi T ⊆ TreeMissingColors phi T := by + intro c hc + change c ∈ Finset.univ.filter (fun alpha => ∃ j, 1 ≤ j.val ∧ phi (T.edge j) = some alpha) at hc + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hc + rcases hc with ⟨j, hj, hc⟩ + obtain ⟨i, d, hd, hdm⟩ := htree j hj + apply Finset.mem_biUnion.mpr + refine ⟨T.vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))), ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · have heq : d = c := Option.some.inj (hd.symm.trans hc) + simpa [heq] using hdm + rw [Finset.card_sdiff_of_subset hsub] + have hX : X.card = T.length + 1 := by + dsimp [X, TreeSequenceVertexSet] + rw [Finset.card_image_iff.mpr (by + intro a ha b hb hab + exact T.vertex_injective hab)] + simp + dsimp [X] at hmissing hused ⊢ + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideGlobalMaximumMissingCounts.lean b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumMissingCounts.lean new file mode 100644 index 0000000000..6b38fab7d9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumMissingCounts.lean @@ -0,0 +1,145 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple + +/-! +# Scheide Global Maximum Missing Counts + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideGlobalMaximumMissingCounts {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) + (v : V) (_ : v ∈ TreeSequenceVertexSet T) : + (Incident G v e0 → + (MissingColors G phi v).card = k - Degree G v + 1 ∧ + 2 ≤ (MissingColors G phi v).card) ∧ + (¬ Incident G v e0 → + (MissingColors G phi v).card = k - Degree G v ∧ + 1 ≤ (MissingColors G phi v).card) := by + classical + have htriple : KTriple G k e0 phi := hglobal.1 + have hproper : IsProperEdgeColoring G phi := htriple.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := htriple.2.2.2.2 + have colored_iff : ∀ v e, + (Incident G v e ∧ ∃ c, phi e = some c) ↔ Incident G v e ∧ e ≠ e0 := by + intro w e + constructor + · rintro ⟨hw, c, hc⟩ + refine ⟨hw, ?_⟩ + intro he + subst e + rw [hone.1] at hc + cases hc + · rintro ⟨hw, he⟩ + obtain ⟨c, hc⟩ := hone.2 e he + exact ⟨hw, c, hc⟩ + have present_card : ∀ w, + (PresentColors G phi w).card = + (Finset.univ.filter fun e => Incident G w e ∧ ∃ c, phi e = some c).card := by + intro w + let colored := Finset.univ.filter fun e => Incident G w e ∧ ∃ c, phi e = some c + let chooseColor : (e : E) → e ∈ colored → Fin k := + fun e he => Classical.choose (Finset.mem_filter.mp he).2.2 + have choose_spec : ∀ (e : E) (he : e ∈ colored), + phi e = some (chooseColor e he) := by + intro e he + exact Classical.choose_spec (Finset.mem_filter.mp he).2.2 + symm + apply (Finset.card_bij chooseColor) + · intro e he + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, (Finset.mem_filter.mp he).2.1, choose_spec e he⟩ + · intro e₁ h₁ e₂ h₂ heq + by_contra hne + have hi₁ := (Finset.mem_filter.mp h₁).2.1 + have hi₂ := (Finset.mem_filter.mp h₂).2.1 + have ha : AdjacentEdges G e₁ e₂ := ⟨w, hi₁, hi₂⟩ + have hp := hproper hne ha (choose_spec e₁ h₁) + exact hp (by simpa [heq] using choose_spec e₂ h₂) + · intro c hc + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc + obtain ⟨e, he, hce⟩ := hc + have hecol : e ∈ colored := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and, colored] + exact ⟨he, c, hce⟩ + refine ⟨e, hecol, ?_⟩ + exact Option.some.inj ((choose_spec e hecol).symm.trans hce) + have colored_card : ∀ w, + (Finset.univ.filter fun e => Incident G w e ∧ ∃ c, phi e = some c).card = + if Incident G w e0 then Degree G w - 1 else Degree G w := by + intro w + have hset : (Finset.univ.filter fun e => Incident G w e ∧ ∃ c, phi e = some c) = + (Finset.univ.filter fun e => Incident G w e).filter (fun e => e ≠ e0) := by + ext e + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + rw [colored_iff w e] + rw [hset] + by_cases hw : Incident G w e0 + · have hmem : e0 ∈ Finset.univ.filter (fun e => Incident G w e) := by + simp [hw] + rw [Finset.filter_ne', Finset.card_erase_of_mem hmem] + simp [Degree, hw] + · have hnot : e0 ∉ Finset.univ.filter (fun e => Incident G w e) := by + simp [hw] + rw [Finset.filter_ne'] + rw [Finset.erase_eq_self.mpr hnot] + simp [hw, Degree] + have missing_card : ∀ w, + (MissingColors G phi w).card = k - + (if Incident G w e0 then Degree G w - 1 else Degree G w) := by + intro w + rw [show (MissingColors G phi w).card = k - (PresentColors G phi w).card by + simp [MissingColors, Finset.card_sdiff]] + rw [present_card w, colored_card w] + have hdeg : ∀ w, Degree G w ≤ MaximumDegree G := by + intro w + unfold MaximumDegree + apply Finset.le_max' + simp [Degree] + have hkdeg : ∀ w, Degree G w + 1 ≤ k := by + intro w + exact (Nat.le_trans (Nat.succ_le_succ (hdeg w)) htriple.2.2.1) + constructor + · intro hw + have hm := missing_card v + rw [ite_eq_left hw] at hm + have hkv := hkdeg v + have hd : Degree G v ≤ k := by omega + have hpos : 1 ≤ Degree G v := by + unfold Degree + apply Finset.card_pos.mpr + exact ⟨e0, Finset.mem_filter.mpr ⟨Finset.mem_univ _, hw⟩⟩ + have hrem : k - Degree G v + Degree G v = k := Nat.sub_add_cancel hd + have hremd : Degree G v - 1 + 1 = Degree G v := Nat.sub_add_cancel hpos + constructor + · omega + · rw [hm] + apply Nat.le_sub_of_add_le + omega + · intro hw + have hm := missing_card v + rw [ite_eq_right hw] at hm + have hkv := hkdeg v + constructor + · exact hm + · have hd : Degree G v ≤ k := by omega + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideGlobalMaximumOrder.lean b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumOrder.lean new file mode 100644 index 0000000000..bb9e231705 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumOrder.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple + +public import LeanPool.GoldbergSeymour.ScheideMaximalOddOrder + +public import LeanPool.GoldbergSeymour.TashkinovOrderBound + +/-! +# Scheide Global Maximum Order + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideGlobalMaximumOrder {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) : + TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ + 3 ≤ (TreeSequenceVertexSet T).card ∧ + Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ + ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := by + classical + rcases hglobal with ⟨htriple, htree, hcard⟩ + have hmax : FixedPairMaximalTashkinovTree G e0 phi T := by + refine ⟨htree, ?_⟩ + intro S hS hsubset + have hle : (TreeSequenceVertexSet S).card ≤ + (TreeSequenceVertexSet T).card := by + exact (treeCard_le_tashkinovOrder G k e0 phi S htriple hS).trans_eq hcard.symm + have heq : TreeSequenceVertexSet S = TreeSequenceVertexSet T := by + exact (Finset.eq_of_subset_of_card_le hsubset hle).symm + rw [heq] + have hodd := ScheideMaximalOddOrder G k e0 phi T htriple hmax + have hec := ScheideMaximalElementaryClosed G k e0 phi T htriple hmax + have htwo : 2 ≤ (TreeSequenceVertexSet T).card := by + let v₀ : V := T.vertex ⟨0, Nat.zero_lt_succ _⟩ + have hp := T.positive + let v₁ : V := T.vertex ⟨1, by omega⟩ + have hne : v₀ ≠ v₁ := by + intro hv + have hi := T.vertex_injective hv + simp [] at hi + have hpair : ({v₀, v₁} : Finset V).card = 2 := by + simp [hne] + have hsub : ({v₀, v₁} : Finset V) ⊆ TreeSequenceVertexSet T := by + intro v hv + simp only [Finset.mem_insert, Finset.mem_singleton] at hv + rcases hv with rfl | rfl + · simp [TreeSequenceVertexSet, v₀] + · simp [TreeSequenceVertexSet, v₁] + rw [← hpair] + exact Finset.card_le_card hsub + have hthree : 3 ≤ (TreeSequenceVertexSet T).card := by + rcases hodd with ⟨n, hn⟩ + omega + exact ⟨hcard.symm, hthree, hodd, hec.1, hec.2⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideGlobalMaximumUnused.lean b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumUnused.lean new file mode 100644 index 0000000000..1147e20484 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumUnused.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DefectiveColors + +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder + +/-! +# Scheide Global Maximum Unused + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideGlobalMaximumUnused {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) : + Disjoint (DefectiveColors G phi (TreeSequenceVertexSet T)) + (TreeUsedColors phi T) ∧ + Disjoint (TreeFreeColors phi T) (TreeUsedColors phi T) := by + classical + have horder := ScheideGlobalMaximumOrder G k e0 phi T hglobal + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + horder.2.2.2.2 + constructor + · rw [Finset.disjoint_left] + intro alpha hdef hused + have hcard : 2 ≤ (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card := by + change alpha ∈ Finset.univ.filter + (fun alpha => DefectiveColor G phi (TreeSequenceVertexSet T) alpha) at hdef + exact (Finset.mem_filter.mp hdef).2 + have hpos : 0 < (BoundaryColorEdges G phi + (TreeSequenceVertexSet T) alpha).card := + lt_of_lt_of_le Nat.zero_lt_two hcard + obtain ⟨f, hf⟩ := Finset.card_pos.mp hpos + have hfb : f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + exact (Finset.mem_filter.mp hf).1 + have hfc : phi f = some alpha := by + exact (Finset.mem_filter.mp hf).2 + have hnot : ∀ v, v ∈ TreeSequenceVertexSet T → + alpha ∉ MissingColors G phi v := by + intro v hv hm + exact (hclosed hfb hv hfc) hm + have htree := hglobal.2.1 + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hused + obtain ⟨j, hj, hje⟩ := hused + obtain ⟨i, c, hcolor, hmiss⟩ := htree j hj + have hac : c = alpha := by + have hac' : alpha = c := by simpa [hje] using hcolor + exact hac'.symm + have hv : T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) ∈ + TreeSequenceVertexSet T := by + exact Finset.mem_image.mpr ⟨_, Finset.mem_univ _, rfl⟩ + exact hnot _ hv (hac ▸ hmiss) + · change Disjoint (TreeMissingColors phi T \ TreeUsedColors phi T) + (TreeUsedColors phi T) + exact Finset.sdiff_disjoint + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideGraphHeight.lean b/LeanPool/GoldbergSeymour/ScheideGraphHeight.lean new file mode 100644 index 0000000000..17ed4a68bb --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideGraphHeight.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple + +/-! +# Scheide Graph Height + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The maximum height of any normal global maximum triple, including zero when none exists. -/ +noncomputable def ScheideGraphHeight {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) : ℕ := by + classical + let heights := (Finset.range (Fintype.card V + 1)).filter fun p => + ∃ (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0), + ∃ N : NormalGlobalMaximumTriple G k e0 phi T, N.height = p + exact (insert 0 heights).max' (by simp) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideGraphHeightOdd.lean b/LeanPool/GoldbergSeymour/ScheideGraphHeightOdd.lean new file mode 100644 index 0000000000..801ae5a3cd --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideGraphHeightOdd.lean @@ -0,0 +1,358 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.ScheideNormalisation +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Graph Height Odd + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_188.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (alpha beta : Fin k) (_ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl + (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl + (T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (T' : + TreeSequence G e0) (_ : NormalGlobalMaximumTriple G k e0 phi T'), alpha ∈ MissingColors G + phi (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ)))) → + ∀ (m : ℕ) (f : E) (c : PartialEdgeColoring E m) (S : TreeSequence G f) (M : + NormalGlobalMaximumTriple G m f c S), IsProperEdgeColoring G c → + let path : (TwoColorIncidenceGraph G c M.alpha M.beta).Walk (Sum.inl (S.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ S.positive⟩ : Fin (S.length + (1 : ℕ))))) (Sum.inl (S.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ S.length⟩ : Fin (S.length + (1 : ℕ))))) := M.closingPath; path.length = + (2 : ℕ) * (M.height - (1 : ℕ)) → ( + ∀ i ≤ path.length, (i % (2 : ℕ) = (0 : ℕ) → + ∃ (v : V), path.getVert i = Sum.inl v) ∧ (i % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), path.getVert i = Sum.inr e)) → ( + ∀ i < M.height - (1 : ℕ), + ∃ (e : E), path.getVert ((2 : ℕ) * i + (1 : ℕ)) = Sum.inr e ∧ (c e = some M.alpha ∨ c e = some + M.beta)) → + ∀ (i : ℕ), (i < M.height - (1 : ℕ) → (i % (2 : ℕ) = (0 : ℕ) → + ∃ (e : E), path.getVert ((2 : ℕ) * i + (1 : ℕ)) = Sum.inr e ∧ c e = some M.alpha) ∧ (i % (2 : + ℕ) = (1 : ℕ) → + ∃ (e : E), path.getVert ((2 : ℕ) * i + (1 : ℕ)) = Sum.inr e ∧ c e = some M.beta)) → i + (1 : + ℕ) < M.height - (1 : ℕ) → ((i + (1 : ℕ)) % (2 : ℕ) = (0 : ℕ) → + ∃ (e : E), path.getVert ((2 : ℕ) * (i + (1 : ℕ)) + (1 : ℕ)) = Sum.inr e ∧ c e = some M.alpha) + ∧ ((i + (1 : ℕ)) % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), path.getVert ((2 : ℕ) * (i + (1 : ℕ)) + (1 : ℕ)) = Sum.inr e ∧ c e = some M.beta) + := by + classical + intro V E _ _ _ G k e0 phi T alpha beta path0 T' N ha m f c S M hproper path hpathlen hshape + hcolored i ih hi + have hold : i < M.height - 1 := by omega + have hprev := ih hold + have hcur := hcolored (i + 1) hi + constructor + · intro heven + obtain ⟨e, he, hc⟩ := hprev.2 (by omega) + obtain ⟨f, hf, hfcol⟩ := hcur + have hdiff : e ≠ f := by + intro hef + subst f + have hinj : Function.Injective path.support.get := + (SimpleGraph.Walk.isPath_iff_injective_get_support path).mp M.closingPath_isPath + have hia : 2 * i + 1 < path.support.length := by + simp only [path.length_support] + rw [hpathlen] + omega + have hib : 2 * (i + 1) + 1 < path.support.length := by + simp only [path.length_support] + rw [hpathlen] + omega + let a : Fin path.support.length := ⟨2 * i + 1, hia⟩ + let b : Fin path.support.length := ⟨2 * (i + 1) + 1, hib⟩ + have hab : a = b := by + apply hinj + have ha' := congrFun path.getVert_comp_val_eq_get_support a + have hb' := congrFun path.getVert_comp_val_eq_get_support b + rw [← ha', ← hb'] + exact he.trans hf.symm + have habval : 2 * i + 1 = 2 * (i + 1) + 1 := by + simpa [a, b] using congrArg Fin.val hab + omega + have hv : ∃ v, path.getVert (2 * i + 2) = Sum.inl v := (hshape (2 * i + 2) + (by rw [hpathlen]; omega)).1 (by omega) + obtain ⟨v, hv⟩ := hv + have ha := path.adj_getVert_succ (i := 2 * i + 1) (by rw [hpathlen]; omega) + have hb' := path.adj_getVert_succ (i := 2 * i + 2) (by rw [hpathlen]; omega) + rw [he, hv] at ha + have hf' : path.getVert (2 * i + 2 + 1) = Sum.inr f := by + have hidx : 2 * i + 2 + 1 = 2 * (i + 1) + 1 := by omega + rw [hidx] + exact hf + rw [hv, hf'] at hb' + have hb'' : (TwoColorIncidenceGraph G c M.alpha M.beta).Adj (Sum.inl v) + (path.getVert (2 * (i + 1) + 1)) := by + have hidx : 2 * i + 2 + 1 = 2 * (i + 1) + 1 := by omega + rw [← hf] at hb' + convert hb' using 1 + have haInfo : Incident G v e ∧ (c e = some M.alpha ∨ c e = some M.beta) := by + simpa [TwoColorIncidenceGraph] using ha + rw [hf] at hb'' + have hbInfo : Incident G v f ∧ (c f = some M.alpha ∨ c f = some M.beta) := by + simpa [TwoColorIncidenceGraph] using hb'' + have hne : ∀ {q : Fin m}, c e = some q → c f ≠ some q := by + intro q hq + exact hproper (c := q) hdiff ⟨v, haInfo.1, hbInfo.1⟩ hq + have bad : c f = some M.alpha := hfcol.resolve_right (by + intro hfb + exact (hne hc) hfb) + exact ⟨f, hf, bad⟩ + · intro hodd + obtain ⟨e, he, hc⟩ := hprev.1 (by omega) + obtain ⟨f, hf, hfcol⟩ := hcur + have hdiff : e ≠ f := by + intro hef + subst f + have hinj : Function.Injective path.support.get := + (SimpleGraph.Walk.isPath_iff_injective_get_support path).mp M.closingPath_isPath + have hia : 2 * i + 1 < path.support.length := by + simp only [path.length_support] + rw [hpathlen] + omega + have hib : 2 * (i + 1) + 1 < path.support.length := by + simp only [path.length_support] + rw [hpathlen] + omega + let a : Fin path.support.length := ⟨2 * i + 1, hia⟩ + let b : Fin path.support.length := ⟨2 * (i + 1) + 1, hib⟩ + have hab : a = b := by + apply hinj + have ha' := congrFun path.getVert_comp_val_eq_get_support a + have hb' := congrFun path.getVert_comp_val_eq_get_support b + rw [← ha', ← hb'] + exact he.trans hf.symm + have habval : 2 * i + 1 = 2 * (i + 1) + 1 := by + simpa [a, b] using congrArg Fin.val hab + omega + obtain ⟨v, hv⟩ := (hshape (2 * i + 2) (by rw [hpathlen]; omega)).1 (by omega) + have ha := path.adj_getVert_succ (i := 2 * i + 1) (by rw [hpathlen]; omega) + have hb' := path.adj_getVert_succ (i := 2 * i + 2) (by rw [hpathlen]; omega) + rw [he, hv] at ha + have hf' : path.getVert (2 * i + 2 + 1) = Sum.inr f := by + have hidx : 2 * i + 2 + 1 = 2 * (i + 1) + 1 := by omega + rw [hidx] + exact hf + rw [hv, hf'] at hb' + have hb'' : (TwoColorIncidenceGraph G c M.alpha M.beta).Adj (Sum.inl v) + (path.getVert (2 * (i + 1) + 1)) := by + have hidx : 2 * i + 2 + 1 = 2 * (i + 1) + 1 := by omega + rw [← hf] at hb' + convert hb' using 1 + have haInfo : Incident G v e ∧ (c e = some M.alpha ∨ c e = some M.beta) := by + simpa [TwoColorIncidenceGraph] using ha + rw [hf] at hb'' + have hbInfo : Incident G v f ∧ (c f = some M.alpha ∨ c f = some M.beta) := by + simpa [TwoColorIncidenceGraph] using hb'' + have bad : c f = some M.beta := hfcol.resolve_left (by + intro hfa + exact (hproper (c := M.alpha) hdiff ⟨v, haInfo.1, hbInfo.1⟩ hc) hfa) + exact ⟨f, hf, bad⟩ + +theorem ScheideGraphHeightOdd {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) : + 3 ≤ ScheideGraphHeight G ∧ Odd (ScheideGraphHeight G) := by + classical + obtain ⟨alpha, beta, path0, T', N, ha, hb, hpath0, hcomp, hNa, hNb, hNh⟩ := + ScheideNormalisation G k e0 phi T hglobal + have hcard : T'.length + 1 ≤ Fintype.card V := by + simpa using Fintype.card_le_of_injective T'.vertex T'.vertex_injective + have hNcard : N.height < Fintype.card V + 1 := by + exact lt_of_le_of_lt N.height_upper (by omega) + let heights := (Finset.range (Fintype.card V + 1)).filter (fun p => + ∃ (m : ℕ) (f : E) (c : PartialEdgeColoring E m) + (S : TreeSequence G f), + ∃ M : NormalGlobalMaximumTriple G m f c S, M.height = p) + have hmem : N.height ∈ heights := by + simp only [Finset.mem_filter, Finset.mem_range.mpr hNcard, true_and, heights] + exact ⟨k, e0, phi, T', N, rfl⟩ + unfold ScheideGraphHeight + dsimp [heights] at hmem ⊢ + let witness := (insert 0 ((Finset.range (Fintype.card V + 1)).filter (fun p => + ∃ (m : ℕ) (f : E) (c : PartialEdgeColoring E m) + (S : TreeSequence G f), + ∃ M : NormalGlobalMaximumTriple G m f c S, M.height = p))).max' + (by simp []) + have hw : witness ∈ insert 0 ((Finset.range (Fintype.card V + 1)).filter (fun p => + ∃ (m : ℕ) (f : E) (c : PartialEdgeColoring E m) + (S : TreeSequence G f), + ∃ M : NormalGlobalMaximumTriple G m f c S, M.height = p)) := + Finset.max'_mem _ _ + have hle : N.height ≤ witness := by + apply Finset.le_max' + exact Finset.mem_insert_of_mem hmem + rcases Finset.mem_insert.mp hw with hz | hz + · exfalso + omega + · rcases Finset.mem_filter.mp hz with ⟨_, ⟨m, f, c, S, M, hM⟩⟩ + have hm : M.height = witness := hM + have hproper : IsProperEdgeColoring G c := M.global.1.2.2.2.1 + let path := M.closingPath + have hpathlen : path.length = 2 * (M.height - 1) := by + simpa [path] using M.closingPath_length + have hshape : ∀ i ≤ path.length, + (i % 2 = 0 → ∃ v, path.getVert i = Sum.inl v) ∧ + (i % 2 = 1 → ∃ e, path.getVert i = Sum.inr e) := by + intro i + induction i with + | zero => + intro hi + constructor <;> intro hpar + · exact ⟨S.vertex ⟨1, Nat.succ_lt_succ S.positive⟩, by + simpa [path] using path.getVert_zero⟩ + · omega + | succ i ih => + intro hi + have hil : i < path.length := by omega + have hadj := path.adj_getVert_succ hil + have hs := ih (by omega) + constructor + · intro heven + obtain ⟨e, he⟩ := hs.2 (by omega) + cases hn : path.getVert (i + 1) with + | inl v => exact ⟨v, rfl⟩ + | inr e' => + rw [he, hn] at hadj + simp [TwoColorIncidenceGraph] at hadj + · intro hodd + obtain ⟨v, hv⟩ := hs.1 (by omega) + cases hn : path.getVert (i + 1) with + | inl v' => + rw [hv, hn] at hadj + simp [TwoColorIncidenceGraph] at hadj + | inr e => exact ⟨e, rfl⟩ + have hcolored : ∀ i < M.height - 1, ∃ e, + path.getVert (2 * i + 1) = Sum.inr e ∧ + (c e = some M.alpha ∨ c e = some M.beta) := by + intro i hi + have hlen : 2 * i + 1 ≤ path.length := by + rw [hpathlen] + omega + obtain ⟨e, he⟩ := (hshape (2 * i + 1) hlen).2 (by omega) + obtain ⟨v, hv⟩ := (hshape (2 * i) (by omega)).1 (by omega) + have hadj := path.adj_getVert_succ (by omega : 2 * i < path.length) + rw [hv, he] at hadj + simp only [TwoColorIncidenceGraph] at hadj + exact ⟨e, he, hadj.2⟩ + have hlow := M.height_lower + have hfirst : ∃ e, path.getVert 1 = Sum.inr e ∧ c e = some M.alpha := by + obtain ⟨e, he, hc⟩ := hcolored 0 (by omega) + have hv : path.getVert 0 = Sum.inl (S.vertex ⟨1, Nat.succ_lt_succ S.positive⟩) := by + simpa [path] using path.getVert_zero + have hadj := path.adj_getVert_succ (i := 0) (by rw [hpathlen]; omega) + rw [hv, he] at hadj + simp only [TwoColorIncidenceGraph] at hadj + have hnot : c e ≠ some M.beta := by + intro heβ + have hp : M.beta ∈ PresentColors G c (S.vertex ⟨1, Nat.succ_lt_succ S.positive⟩) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hadj.1, heβ⟩ + have hm := M.beta_missing + have hnotmem : M.beta ∉ PresentColors G c (S.vertex ⟨1, Nat.succ_lt_succ S.positive⟩) := by + simpa [MissingColors] using hm + exact hnotmem hp + exact ⟨e, he, hc.resolve_right hnot⟩ + have hlast : ∃ e, path.getVert (path.length - 1) = Sum.inr e ∧ c e = some M.beta := by + have hmpos : 0 < M.height - 1 := by + have hlow := M.height_lower + omega + obtain ⟨e, he, hc⟩ := hcolored (M.height - 2) (by omega) + have hv : path.getVert path.length = Sum.inl (S.vertex ⟨0, Nat.zero_lt_succ S.length⟩) := by + simpa [path] using path.getVert_length + have hepos : 2 * (M.height - 2) + 1 = path.length - 1 := by + rw [hpathlen] + omega + have hadj := path.adj_getVert_succ (i := path.length - 1) (by rw [hpathlen]; omega) + have hnext : path.length - 1 + 1 = path.length := by rw [hpathlen]; omega + rw [hepos] at he + have hnext : path.length - 1 + 1 = path.length := by rw [hpathlen]; omega + rw [hnext] at hadj + rw [hv, he] at hadj + simp only [TwoColorIncidenceGraph, Fin.zero_eta] at hadj + have hnot : c e ≠ some M.alpha := by + intro heα + have hp : M.alpha ∈ PresentColors G c (S.vertex ⟨0, Nat.zero_lt_succ S.length⟩) := by + change M.alpha ∈ (Finset.univ.filter (fun q => + ∃ g, Incident G (S.vertex ⟨0, Nat.zero_lt_succ S.length⟩) g ∧ c g = some q)) + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_univ _, e, hadj.1, heα⟩ + have hm := M.alpha_missing + have hnotmem : M.alpha ∉ PresentColors G c (S.vertex ⟨0, Nat.zero_lt_succ S.length⟩) := by + simpa [MissingColors] using hm + exact hnotmem hp + exact ⟨e, he, hc.resolve_left hnot⟩ + have hnecolor : M.alpha ≠ M.beta := by + intro hab + obtain ⟨e, he, hc⟩ := hfirst + have hv : path.getVert 0 = Sum.inl (S.vertex ⟨1, Nat.succ_lt_succ S.positive⟩) := by + simpa [path] using path.getVert_zero + have hadj := path.adj_getVert_succ (i := 0) (by rw [hpathlen]; omega) + rw [hv, he] at hadj + simp only [TwoColorIncidenceGraph] at hadj + have hp : M.beta ∈ PresentColors G c (S.vertex ⟨1, Nat.succ_lt_succ S.positive⟩) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hadj.1, hab ▸ hc⟩ + have hnotmem : M.beta ∉ PresentColors G c (S.vertex ⟨1, Nat.succ_lt_succ S.positive⟩) := by + simpa [MissingColors] using M.beta_missing + exact hnotmem hp + have hflip : ∀ i < M.height - 1, + (i % 2 = 0 → ∃ e, path.getVert (2 * i + 1) = Sum.inr e ∧ c e = some M.alpha) ∧ + (i % 2 = 1 → ∃ e, path.getVert (2 * i + 1) = Sum.inr e ∧ c e = some M.beta) := by + intro i + induction i with + | zero => + intro hi + exact ⟨fun _ => hfirst, fun h => by omega⟩ + | succ i ih => + exact @helper_branch_188 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@alpha) (@beta) (@path0) (@T') (@N) (@ha) (@m) (@f) (@c) (@S) + (@M) (@hproper) (@hpathlen) (@hshape) (@hcolored) (@i) (@ih) + have hlastIndex : 2 * (M.height - 2) + 1 = path.length - 1 := by + rw [hpathlen] + omega + obtain ⟨el, hel, hcl⟩ := hlast + have hpar : (M.height - 2) % 2 = 1 := by + by_contra hn + have heven : (M.height - 2) % 2 = 0 := by omega + obtain ⟨ea, hea, hca⟩ := (hflip (M.height - 2) (by omega)).1 heven + have heq : ea = el := by + apply Sum.inr.inj + rw [← hea, hlastIndex, hel] + subst el + exact hnecolor (Option.some.inj (hca.symm.trans hcl)) + have hoddM : Odd M.height := by + refine ⟨(M.height - 1) / 2, ?_⟩ + omega + constructor + · omega + · simpa [hm] using hoddM + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean b/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean new file mode 100644 index 0000000000..9588fb5407 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean @@ -0,0 +1,3326 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound +public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Height Five Gamma Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private abbrev helperContinuation2789Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (g : E) (v : V) (hgcolor : phi g = some gamma) (hgends : G.ends g = s(T.vertex + (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(1 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v)) (x : v ∈ TreeSequenceVertexSet T) (hv1 : v ≠ T.vertex (⟨(1 + : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) (hv2 : v ≠ T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) (hv3 : v ≠ T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) (hv4 : v ≠ T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (hgamma0 : gamma ∈ MissingColors G phi y0) (f1 : E) (hf1inc : Incident G y1 f1) (hf1color : + phi f1 = some gamma) (f2 : E) (hf2inc : Incident G y2 f2) (hf2color : phi f2 = some gamma) + (f3 : E) (hf3inc : Incident G y3 f3) (hf3color : phi f3 = some gamma) (f4 : E) (hf4inc : + Incident G y4 f4) (hf4color : phi f4 = some gamma) (z1 : V) (hf1ends : G.ends f1 = s(y1, + z1)) (z2 : V) (hf2ends : G.ends f2 = s(y2, z2)) (z3 : V) (hf3ends : G.ends f3 = s(y3, z3)) + (z4 : V) (hf4ends : G.ends f4 = s(y4, z4)) (hz2trunk : z2 = y0 ∨ z2 = y1 ∨ z2 = y2 ∨ z2 = + y3 ∨ z2 = y4) (hz3trunk : z3 = y0 ∨ z3 = y1 ∨ z3 = y2 ∨ z3 = y3 ∨ z3 = y4) (hz1T : z1 ∈ + TreeSequenceVertexSet T) (hz4T : z4 ∈ TreeSequenceVertexSet T) (hy12 : y1 ≠ y2) (hy13 : y1 + ≠ y3) (hy14 : y1 ≠ y4) (hy23 : y2 ≠ y3) (hy24 : y2 ≠ y4) (hy34 : y3 ≠ y4), + ∃ (f1 : E) (f2 : E) (f3 : E) (v1 : V) (v2 : V), G.ends f1 = s(T.vertex (⟨(1 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v1) ∧ G.ends f2 = s(T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v2) ∧ G.ends f3 = s(T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) ∧ phi f1 = some gamma ∧ phi f2 = some gamma ∧ phi f3 = some + gamma ∧ v1 ∈ TreeSequenceVertexSet T ∧ v2 ∈ TreeSequenceVertexSet T ∧ v1 ≠ T.vertex (⟨(0 : + ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v1 ≠ T.vertex (⟨(1 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v1 ≠ T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v1 ≠ T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v1 ≠ T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v2 ≠ T.vertex (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v2 ≠ T.vertex (⟨(1 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v2 ≠ T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v2 ≠ T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v2 ≠ T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T + have := N.height_upper + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) + +private abbrev helperContinuation3161Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (g : E) (v : V) (hgcolor : phi g = some gamma) (hgends : G.ends g = s(T.vertex + (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(1 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v)) (x : v ∈ TreeSequenceVertexSet T) (hv1 : v ≠ T.vertex (⟨(1 + : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) (hv2 : v ≠ T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) (hv3 : v ≠ T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) (hv4 : v ≠ T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T)) (hy0T : y0 ∈ + TreeSequenceVertexSet T) (hy1T : y1 ∈ TreeSequenceVertexSet T) (hy4T : y4 ∈ + TreeSequenceVertexSet T) (hgamma0 : gamma ∈ MissingColors G phi y0) (f1 : E) (hf1inc : + Incident G y1 f1) (hf1color : phi f1 = some gamma) (f2 : E) (hf2inc : Incident G y2 f2) + (hf2color : phi f2 = some gamma) (f3 : E) (hf3inc : Incident G y3 f3) (hf3color : phi f3 = + some gamma) (f4 : E) (hf4inc : Incident G y4 f4) (hf4color : phi f4 = some gamma) (z1 : V) + (hf1ends : G.ends f1 = s(y1, z1)) (z2 : V) (hf2ends : G.ends f2 = s(y2, z2)) (z3 : V) + (hf3ends : G.ends f3 = s(y3, z3)) (z4 : V) (hf4ends : G.ends f4 = s(y4, z4)) + (middle_no_escape : + ∀ (r : E) (w : V) (hrcolor : phi r = some gamma) (hrends : G.ends r = s(T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))), w) ∨ G.ends r = s(T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))), w)), w = T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ)))), + ∃ (f1 : E) (f2 : E) (f3 : E) (v1 : V) (v2 : V), G.ends f1 = s(T.vertex (⟨(1 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v1) ∧ G.ends f2 = s(T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v2) ∧ G.ends f3 = s(T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) ∧ phi f1 = some gamma ∧ phi f2 = some gamma ∧ phi f3 = some + gamma ∧ v1 ∈ TreeSequenceVertexSet T ∧ v2 ∈ TreeSequenceVertexSet T ∧ v1 ≠ T.vertex (⟨(0 : + ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v1 ≠ T.vertex (⟨(1 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v1 ≠ T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v1 ≠ T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v1 ≠ T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v2 ≠ T.vertex (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v2 ≠ T.vertex (⟨(1 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v2 ≠ T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v2 ≠ T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) ∧ v2 ≠ T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))) + +private abbrev helperCaseContinuation3625Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) + (hGheight : ScheideGraphHeight G = (5 : ℕ)) (gamma : Fin k) (v : V) (x : v ∈ + TreeSequenceVertexSet T) (r : E) (w : V) (hrcolor : phi r = some gamma), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; + ∀ (hy01 : y0 ≠ y1) (hy02 : y0 ≠ y2) (hy03 : y0 ≠ y3) (hy04 : y0 ≠ y4) (hy12 : y1 ≠ y2) (hy13 : + y1 ≠ y3) (hy14 : y1 ≠ y4) (hy23 : y2 ≠ y3) (hy24 : y2 ≠ y4) (hy34 : y3 ≠ y4) (ha1ends : + G.ends a1 = s(y1, y2)) (ha3ends : G.ends a3 = s(y3, y4)) (hproper : IsProperEdgeColoring G + phi) (ha1color : phi a1 = some N.alpha) (ha3color : phi a3 = some N.alpha) (hqcolor : phi + q = some N.beta) (halpha_beta : N.alpha ≠ N.beta) (p1 : (TwoColorIncidenceGraph G phi + gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin + (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin + (T.length + (1 : ℕ)))))), + let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); + ∀ (hqinc0 : Incident G y0 q) (hqinc4 : Incident G y4 q) (hqC1 : Sum.inr q ∈ C1) (hy1C1 : + Sum.inl y1 ∈ C1) (hqa1 : q ≠ a1) (hqa3 : q ≠ a3) (ha13ne : a1 ≠ a3) (hgamma_alpha : gamma + ≠ N.alpha) (hgamma_beta : gamma ≠ N.beta) (hw0 : w ≠ y0) (hw1 : w ≠ y1) (hw2 : w ≠ y2) + (hw3 : w ≠ y3) (hw4 : w ≠ y4) (hrincw : Incident G w r) (hrmiddle : Incident G y2 r ∨ + Incident G y3 r) (hrq : r ≠ q) (hrnotC1 : Sum.inr r ∉ C1), + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (pmax : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (hchangedata : IsProperEdgeColoring G (TwoColorComponentSwap G phi gamma + N.beta (Sum.inl (T.vertex i0))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi gamma + N.beta (Sum.inl (T.vertex i0))) e0 ∧ TashkinovTree G e0 (TwoColorComponentSwap G phi gamma + N.beta (Sum.inl (T.vertex i0))) T), + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma N.beta (Sum.inl y0); + ∀ (hproper' : IsProperEdgeColoring G phi') (hone' : IsOneEdgeUncolored phi' e0), False + +private abbrev helperCaseContinuation3777Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) + (hGheight : ScheideGraphHeight G = (5 : ℕ)) (gamma : Fin k) (hgamma : gamma ∈ + MissingColors G phi (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : + ℕ))))) (g : E) (v : V) (hgcolor : phi g = some gamma) (x : v ∈ TreeSequenceVertexSet T) (r + : E) (w : V) (hrcolor : phi r = some gamma) (hrends : G.ends r = s(T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))), w) ∨ G.ends r = s(T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))), w)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; + ∀ (hy01 : y0 ≠ y1) (hy02 : y0 ≠ y2) (hy03 : y0 ≠ y3) (hy04 : y0 ≠ y4) (hy12 : y1 ≠ y2) (hy13 : + y1 ≠ y3) (hy14 : y1 ≠ y4) (hy23 : y2 ≠ y3) (hy24 : y2 ≠ y4) (hy34 : y3 ≠ y4) (ha1ends : + G.ends a1 = s(y1, y2)) (ha2ends : G.ends a2 = s(y2, y3)) (ha3ends : G.ends a3 = s(y3, y4)) + (hqends : G.ends q = s(y4, y0)) (hproper : IsProperEdgeColoring G phi) (missing_excludes : + ∀ {c : Fin k} {x : V} {f : E} (hc : c ∈ MissingColors G phi x) (hinc : Incident G x f), phi f + ≠ some c) (ha1color : phi a1 = some N.alpha) (ha12ne : a1 ≠ a2) (ha2color : phi a2 = some + N.beta) (ha23ne : a2 ≠ a3) (ha3color : phi a3 = some N.alpha) (ha3qne : a3 ≠ q) (hqcolor : + phi q = some N.beta) (halpha_beta : N.alpha ≠ N.beta) (hv0' : v ≠ y0) (hv1' : v ≠ y1) + (hv2' : v ≠ y2) (hv3' : v ≠ y3) (hv4' : v ≠ y4) (hgends' : G.ends g = s(y0, v) ∨ G.ends g + = s(y1, v) ∨ G.ends g = s(y2, v) ∨ G.ends g = s(y3, v) ∨ G.ends g = s(y4, v)) (p1 : + (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (hp1 : p1.IsPath) (hp1div : (4 + : ℕ) ∣ p1.length) (hp1bound : p1.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G), + let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); + ∀ (hC1root : Sum.inl y0 ∈ C1) (support_of_C1 : + ∀ {z : V ⊕ E} (hz : z ∈ C1), z ∈ p1.support) (edge_step_C1 : + ∀ {x : V} {f : E} (hx : Sum.inl x ∈ C1) (hxf : Incident G x f) (hfc : phi f = some gamma ∨ phi + f = some N.beta), Sum.inr f ∈ C1) (vertex_step_C1 : + ∀ {f : E} {x : V} (hf : Sum.inr f ∈ C1) (hxf : Incident G x f) (hfc : phi f = some gamma ∨ phi + f = some N.beta), Sum.inl x ∈ C1) (hqinc0 : Incident G y0 q) (hqinc4 : Incident G y4 q) + (hqC1 : Sum.inr q ∈ C1) (hy4C1 : Sum.inl y4 ∈ C1) (hy1C1 : Sum.inl y1 ∈ C1) (helem : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T)) (hy0T : y0 ∈ + TreeSequenceVertexSet T) (hy1T : y1 ∈ TreeSequenceVertexSet T), w = T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) + +private abbrev helperCaseContinuation4022Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) + (hGheight : ScheideGraphHeight G = (5 : ℕ)) (gamma : Fin k) (hgamma : gamma ∈ + MissingColors G phi (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : + ℕ))))) (g : E) (v : V) (hgcolor : phi g = some gamma) (hgends : G.ends g = s(T.vertex (⟨(0 + : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(1 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v) ∨ G.ends g = s(T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ))), v)) (x : v ∈ TreeSequenceVertexSet T) (hv0 : v ≠ T.vertex (⟨(0 + : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) (hv1 : v ≠ T.vertex (⟨(1 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) (hv2 : v ≠ T.vertex (⟨(2 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) (hv3 : v ≠ T.vertex (⟨(3 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))) (hv4 : v ≠ T.vertex (⟨(4 : ℕ), + by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := NormalGlobalMaximumTriple.height_upper N + have := GoldbergSeymour.TreeSequence.positive T + all_goals omega) + ⟩ : Fin (T.length + (1 : ℕ)))), + let y0_1 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1_1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T)) (hy0T : y0_1 ∈ + TreeSequenceVertexSet T) (hy1T : y1_1 ∈ TreeSequenceVertexSet T) (r : E) (w : V) (hrcolor + : phi r = some gamma) (hrends : G.ends r = s(T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))), w) ∨ G.ends r = s(T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))), w)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; + ∀ (hy01 : y0 ≠ y1) (hy02 : y0 ≠ y2) (hy03 : y0 ≠ y3) (hy04 : y0 ≠ y4) (hy12 : y1 ≠ y2) (hy13 : + y1 ≠ y3) (hy14 : y1 ≠ y4) (hy23 : y2 ≠ y3) (hy24 : y2 ≠ y4) (hy34 : y3 ≠ y4) (ha1ends : + G.ends a1 = s(y1, y2)) (ha2ends : G.ends a2 = s(y2, y3)) (ha3ends : G.ends a3 = s(y3, y4)) + (hqends : G.ends q = s(y4, y0)) (hproper : IsProperEdgeColoring G phi) (missing_excludes : + ∀ {c : Fin k} {x : V} {f : E} (hc : c ∈ MissingColors G phi x) (hinc : Incident G x f), phi f + ≠ some c) (edge_color_of_closing_support : + ∀ (f : E) (hf : Sum.inr f ∈ N.closingPath.support), phi f = some N.alpha ∨ phi f = some + N.beta) (ha1support : Sum.inr a1 ∈ N.closingPath.support) (ha2support : Sum.inr a2 ∈ + N.closingPath.support) (ha3support : Sum.inr a3 ∈ N.closingPath.support), w = T.vertex + (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) ∨ w = T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) + +private theorem helper_gamma_present_127.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) → y0 + ∈ TreeSequenceVertexSet T → gamma ∈ MissingColors G phi y0 → + ∀ {x : V}, x ∈ TreeSequenceVertexSet T → x ≠ y0 → gamma ∈ PresentColors G phi x := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma y0 helem hy0T hgamma0 x hxT hx0 + have hnot : gamma ∉ MissingColors G phi x := by + intro hxmiss + have hd := helem hxT hy0T hx0 + exact (Finset.disjoint_left.mp hd) hxmiss hgamma0 + simpa [MissingColors] using hnot + +private theorem helper_hqends_222.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; G.ends q = s(y4, y0) := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y4 q + have hlast : N.lastIndex = ⟨4, by have := N.height_upper; omega⟩ := by + apply Fin.ext + have := N.lastIndex_height + simp + rw [hNheight] at this + omega + simpa [q, y0, y4, hlast] using N.closing_ends + +private theorem helper_missing_excludes_231.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k) {c : Fin k} {x : V} {f : E}, c ∈ MissingColors G phi x → + Incident G x f → phi f ≠ some c := by + classical + intro V E _ _ G k phi c x f hc hinc hfc + let _ := Fintype.ofFinite V + have hp : c ∈ PresentColors G phi x := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hinc, hfc⟩ + have hn : c ∉ PresentColors G phi x := by + simpa [MissingColors] using hc + exact hn hp + +private theorem helper_edge_color_of_closing_support_241.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T), + ∀ v ∈ TreeSequenceVertexSet T, + ∀ (f : E), Sum.inr f ∈ N.closingPath.support → phi f = some N.alpha ∨ phi f = some N.beta := by + classical + intro V E _ _ _ G k e0 phi T N v _ f hf + obtain ⟨i, hi, hile⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hilt : i < N.closingPath.length := by + by_contra hn + have hil : N.closingPath.length ≤ i := by omega + have hend := N.closingPath.getVert_of_length_le (i := i) hil + rw [hi] at hend + simp at hend + have hadj := N.closingPath.adj_getVert_succ hilt + rw [hi] at hadj + cases hz : N.closingPath.getVert (i + 1) with + | inl x => + rw [hz] at hadj + have hdata : Incident G x f ∧ + (phi f = some N.alpha ∨ phi f = some N.beta) := by + simpa [TwoColorIncidenceGraph] using hadj + exact hdata.2 + | inr e => + rw [hz] at hadj + simp [TwoColorIncidenceGraph] at hadj + +private theorem helper_ha1color_275.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; G.ends a1 = s(y1, y2) → ( + ∀ {c : Fin k} {x : V} {f : E}, c ∈ MissingColors G phi x → Incident G x f → phi f ≠ some c) → + ( + ∀ (f : E), Sum.inr f ∈ N.closingPath.support → phi f = some N.alpha ∨ phi f = some N.beta) → + Sum.inr a1 ∈ N.closingPath.support → phi a1 = some N.alpha := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y1 y2 r1 a1 ha1ends missing_excludes + edge_color_of_closing_support ha1support + rcases edge_color_of_closing_support a1 ha1support with h | h + · exact h + · have hbmiss : N.beta ∈ MissingColors G phi y1 := by + simpa [y1] using N.beta_missing + have hinc : Incident G y1 a1 := by + unfold Incident + rw [ha1ends] + simp + exact False.elim ((missing_excludes hbmiss hinc) h) + +private theorem helper_ha1a2_285.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; G.ends a1 = s(y1, y2) → G.ends a2 = s(y2, y3) → AdjacentEdges G a1 a2 + := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y1 y2 y3 r1 r2 a1 a2 ha1ends ha2ends + refine ⟨y2, ?_, ?_⟩ <;> unfold Incident + · rw [ha1ends] + simp + · rw [ha2ends] + simp + +private theorem helper_ha2a3_299.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; G.ends a2 = s(y2, y3) → G.ends a3 = s(y3, y4) → AdjacentEdges G a2 a3 + := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y2 y3 y4 r2 r3 a2 a3 ha2ends ha3ends + refine ⟨y3, ?_, ?_⟩ <;> unfold Incident + · rw [ha2ends] + simp + · rw [ha3ends] + simp + +private theorem helper_ha3q_313.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a3 : E := T.edge r3; + let q : E := N.closingEdge; G.ends a3 = s(y3, y4) → G.ends q = s(y4, y0) → AdjacentEdges G a3 + q := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y3 y4 r3 a3 q ha3ends hqends + refine ⟨y4, ?_, ?_⟩ <;> unfold Incident + · rw [ha3ends] + simp + · rw [hqends] + simp + +private theorem helper_ha3qne_319.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a3 : E := T.edge r3; + let q : E := N.closingEdge; y0 ≠ y3 → y3 ≠ y4 → G.ends a3 = s(y3, y4) → G.ends q = s(y4, y0) → + a3 ≠ q := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y3 y4 r3 a3 q hy03 hy34 ha3ends hqends h + have hpairs : s(y3, y4) = s(y4, y0) := by + rw [← ha3ends, h, hqends] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hy34 hd.1 + · exact hy03 hs.1.symm + +private theorem helper_halpha_beta_330.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; G.ends a1 = s(y1, y2) → ( + ∀ {c : Fin k} {x : V} {f : E}, c ∈ MissingColors G phi x → Incident G x f → phi f ≠ some c) → + phi a1 = some N.alpha → N.alpha ≠ N.beta := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y1 y2 r1 a1 ha1ends missing_excludes ha1color h + have hinc : Incident G y1 a1 := by + unfold Incident + rw [ha1ends] + simp + exact (missing_excludes (by simpa [y1] using N.beta_missing) hinc) + (by simpa [h] using ha1color) + +private theorem helper_hqa1_406.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let q : E := N.closingEdge; y1 ≠ y4 → y2 ≠ y4 → G.ends a1 = s(y1, y2) → G.ends q = s(y4, y0) → + q ≠ a1 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y1 y2 y4 r1 a1 q hy14 hy24 ha1ends hqends h + have hpairs : s(y4, y0) = s(y1, y2) := by + rw [← hqends, h, ha1ends] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hy14 hd.1.symm + · exact hy24 hs.1.symm + +private theorem helper_hqa2_413.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a2 : E := T.edge r2; + let q : E := N.closingEdge; y2 ≠ y4 → y3 ≠ y4 → G.ends a2 = s(y2, y3) → G.ends q = s(y4, y0) → + q ≠ a2 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y2 y3 y4 r2 a2 q hy24 hy34 ha2ends hqends h + have hpairs : s(y4, y0) = s(y2, y3) := by + rw [← hqends, h, ha2ends] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hy24 hd.1.symm + · exact hy34 hs.1.symm + +private theorem helper_hgamma_alpha_425.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + ScheideGraphHeight G = (5 : ℕ) → + ∀ (gamma : Fin k) (g : E) (v : V), phi g = some gamma → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; y0 ≠ y1 → y0 ≠ y2 → y0 ≠ y3 → y0 ≠ y4 → y1 ≠ y2 → y1 ≠ y3 → y1 ≠ + y4 → y2 ≠ y3 → y2 ≠ y4 → y3 ≠ y4 → G.ends a1 = s(y1, y2) → G.ends a2 = s(y2, y3) → G.ends + a3 = s(y3, y4) → phi a1 = some N.alpha → a1 ≠ a2 → phi a2 = some N.beta → a2 ≠ a3 → phi a3 + = some N.alpha → v ≠ y0 → v ≠ y1 → v ≠ y2 → v ≠ y3 → v ≠ y4 → G.ends g = s(y0, v) ∨ G.ends + g = s(y1, v) ∨ G.ends g = s(y2, v) ∨ G.ends g = s(y3, v) ∨ G.ends g = s(y4, v) → + ∀ (p1 : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), p1.IsPath → (4 : ℕ) ∣ + p1.length → p1.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G → + let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); Sum.inl y0 ∈ C1 → ( + ∀ {z : V ⊕ E}, z ∈ C1 → z ∈ p1.support) → ( + ∀ {x : V} {f : E}, Sum.inl x ∈ C1 → Incident G x f → phi f = some gamma ∨ phi f = some N.beta + → Sum.inr f ∈ C1) → ( + ∀ {f : E} {x : V}, Sum.inr f ∈ C1 → Incident G x f → phi f = some gamma ∨ phi f = some N.beta + → Sum.inl x ∈ C1) → Sum.inr q ∈ C1 → Sum.inl y4 ∈ C1 → Sum.inl y1 ∈ C1 → q ≠ a1 → q ≠ a2 → + q ≠ a3 → a1 ≠ a3 → gamma ≠ N.alpha := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hGheight gamma g v hgcolor y0 y1 y2 y3 y4 r1 r2 r3 a1 + a2 a3 q hy01 hy02 hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 ha1ends ha2ends ha3ends ha1color + ha12ne ha2color ha23ne ha3color hv0' hv1' hv2' hv3' hv4' hgends' p1 hp1 hp1div hp1bound C1 + hC1root support_of_C1 edge_step_C1 vertex_step_C1 hqC1 hy4C1 hy1C1 hqa1 hqa2 hqa3 ha13ne hga + have ha3C1 : Sum.inr a3 ∈ C1 := by + apply edge_step_C1 hy4C1 + · unfold Incident + rw [ha3ends] + simp + · left + simpa [hga] using ha3color + have hy3C1 : Sum.inl y3 ∈ C1 := by + apply vertex_step_C1 ha3C1 + · unfold Incident + rw [ha3ends] + simp + · left + simpa [hga] using ha3color + have ha2C1 : Sum.inr a2 ∈ C1 := by + apply edge_step_C1 hy3C1 + · unfold Incident + rw [ha2ends] + simp + · exact Or.inr ha2color + have hy2C1 : Sum.inl y2 ∈ C1 := by + apply vertex_step_C1 ha2C1 + · unfold Incident + rw [ha2ends] + simp + · exact Or.inr ha2color + have ha1C1 : Sum.inr a1 ∈ C1 := by + apply edge_step_C1 hy2C1 + · unfold Incident + rw [ha1ends] + simp + · left + simpa [hga] using ha1color + have hvC1 : Sum.inl v ∈ C1 := by + rcases hgends' with hgv | hgv | hgv | hgv | hgv + all_goals + have hgi : Incident G v g := by unfold Incident; rw [hgv]; simp + · have hgC := edge_step_C1 hC1root (by unfold Incident; rw [hgv]; simp) + (Or.inl hgcolor) + exact vertex_step_C1 hgC hgi (Or.inl hgcolor) + · have hgC := edge_step_C1 hy1C1 (by unfold Incident; rw [hgv]; simp) + (Or.inl hgcolor) + exact vertex_step_C1 hgC hgi (Or.inl hgcolor) + · have hgC := edge_step_C1 hy2C1 (by unfold Incident; rw [hgv]; simp) + (Or.inl hgcolor) + exact vertex_step_C1 hgC hgi (Or.inl hgcolor) + · have hgC := edge_step_C1 hy3C1 (by unfold Incident; rw [hgv]; simp) + (Or.inl hgcolor) + exact vertex_step_C1 hgC hgi (Or.inl hgcolor) + · have hgC := edge_step_C1 hy4C1 (by unfold Incident; rw [hgv]; simp) + (Or.inl hgcolor) + exact vertex_step_C1 hgC hgi (Or.inl hgcolor) + let K10 : Finset (Sum V E) := + {Sum.inl y0, Sum.inl y1, Sum.inl y2, Sum.inl y3, Sum.inl y4, + Sum.inl v, Sum.inr q, Sum.inr a1, Sum.inr a2, Sum.inr a3} + have hK10card : K10.card = 10 := by + simp [K10, hy01, hy02, hy03, hy04, hy12, hy13, hy14, hy23, hy24, + hy34, hqa1, hqa2, hqa3, + ha12ne, ha13ne, ha23ne, Ne.symm hv0', + Ne.symm hv1', Ne.symm hv2', Ne.symm hv3', Ne.symm hv4'] + have hK10sub : K10 ⊆ p1.support.toFinset := by + intro z hz + simp only [K10, Finset.mem_insert, Finset.mem_singleton] at hz + simp only [List.mem_toFinset] + rcases hz with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact support_of_C1 hC1root + · exact support_of_C1 hy1C1 + · exact support_of_C1 hy2C1 + · exact support_of_C1 hy3C1 + · exact support_of_C1 hy4C1 + · exact support_of_C1 hvC1 + · exact support_of_C1 hqC1 + · exact support_of_C1 ha1C1 + · exact support_of_C1 ha2C1 + · exact support_of_C1 ha3C1 + have hp1lower : 9 ≤ p1.length := by + have hc := Finset.card_le_card hK10sub + rw [hK10card, List.toFinset_card_of_nodup hp1.support_nodup, + p1.length_support] at hc + omega + rcases hp1div with ⟨d, hd⟩ + omega + +private theorem helper_hrmiddle_523.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (r : E) + (w : V), + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); G.ends r = s(y2, w) ∨ G.ends r = s(y3, w) → Incident G y2 r ∨ + Incident G y3 r := by + classical + intro V E _ _ _ G k e0 phi T N hNheight r w y2 y3 hrends' + rcases hrends' with h | h + · left + unfold Incident + rw [h] + simp + · right + unfold Incident + rw [h] + simp + +private theorem helper_hbr_549.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (r : E) + (w : V), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); y1 ≠ y2 → y1 ≠ y3 → + ∀ (b : E), Incident G y1 b → G.ends r = s(y2, w) ∨ G.ends r = s(y3, w) → w ≠ y1 → b ≠ r := by + classical + intro V E _ _ _ G k e0 phi T N hNheight r w y1 y2 y3 hy12 hy13 b hbinc hrends' hw1 h + have hinc : Incident G y1 r := by simpa [h] using hbinc + rcases hrends' with hr | hr + · unfold Incident at hinc + rw [hr] at hinc + simp [hy12] at hinc + exact hw1 hinc.symm + · unfold Incident at hinc + rw [hr] at hinc + simp [hy13] at hinc + exact hw1 hinc.symm + +private theorem helper_middle_too_large_561.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + ScheideGraphHeight G = (5 : ℕ) → + ∀ (gamma : Fin k) (r : E) (w : V), phi r = some gamma → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a2 : E := T.edge r2; + let q : E := N.closingEdge; y0 ≠ y1 → y0 ≠ y2 → y0 ≠ y3 → y0 ≠ y4 → y1 ≠ y2 → y1 ≠ y3 → y1 ≠ + y4 → y2 ≠ y3 → y2 ≠ y4 → y3 ≠ y4 → phi a2 = some N.beta → + ∀ (p1 : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), p1.IsPath → (4 : ℕ) ∣ + p1.length → p1.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G → + let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); Sum.inl y0 ∈ C1 → ( + ∀ {z : V ⊕ E}, z ∈ C1 → z ∈ p1.support) → ( + ∀ {x : V} {f : E}, Sum.inl x ∈ C1 → Incident G x f → phi f = some gamma ∨ phi f = some N.beta + → Sum.inr f ∈ C1) → Sum.inr q ∈ C1 → Sum.inl y4 ∈ C1 → Sum.inl y1 ∈ C1 → + ∀ (b : E), Sum.inr b ∈ C1 → q ≠ a2 → w ≠ y0 → w ≠ y1 → w ≠ y2 → w ≠ y3 → w ≠ y4 → Incident G + y2 a2 → Incident G y2 r ∨ Incident G y3 r → b ≠ q → b ≠ a2 → r ≠ q → r ≠ a2 → b ≠ r → + Sum.inl y2 ∈ C1 → Sum.inl y3 ∈ C1 → Sum.inl w ∈ C1 → False := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hGheight gamma r w hrcolor y0 y1 y2 y3 y4 r2 a2 q hy01 + hy02 hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 ha2color p1 hp1 hp1div hp1bound C1 hC1root + support_of_C1 edge_step_C1 hqC1 hy4C1 hy1C1 b hbC1 hqa2 hw0 hw1 hw2 hw3 hw4 ha2inc2 + hrmiddle hbq hba2 hrq hra2 hbr hy2C hy3C hwC + have ha2C : Sum.inr a2 ∈ C1 := + edge_step_C1 hy2C ha2inc2 (Or.inr ha2color) + have hrC : Sum.inr r ∈ C1 := by + rcases hrmiddle with h | h + · exact edge_step_C1 hy2C h (Or.inl hrcolor) + · exact edge_step_C1 hy3C h (Or.inl hrcolor) + let L10 : Finset (Sum V E) := + {Sum.inl y0, Sum.inl y1, Sum.inl y2, Sum.inl y3, Sum.inl y4, + Sum.inl w, Sum.inr q, Sum.inr a2, Sum.inr b, Sum.inr r} + have hL10card : L10.card = 10 := by + simp [L10, hy01, hy02, hy03, hy04, hy12, hy13, hy14, hy23, hy24, + hy34, hqa2, hbr, + Ne.symm hw0, Ne.symm hw1, + Ne.symm hw2, Ne.symm hw3, Ne.symm hw4, Ne.symm hbq, Ne.symm hba2, Ne.symm hrq, Ne.symm hra2] + have hL10sub : L10 ⊆ p1.support.toFinset := by + intro z hz + simp only [L10, Finset.mem_insert, Finset.mem_singleton] at hz + simp only [List.mem_toFinset] + rcases hz with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact support_of_C1 hC1root + · exact support_of_C1 hy1C1 + · exact support_of_C1 hy2C + · exact support_of_C1 hy3C + · exact support_of_C1 hy4C1 + · exact support_of_C1 hwC + · exact support_of_C1 hqC1 + · exact support_of_C1 ha2C + · exact support_of_C1 hbC1 + · exact support_of_C1 hrC + have hp1lower : 9 ≤ p1.length := by + have hc := Finset.card_le_card hL10sub + rw [hL10card, List.toFinset_card_of_nodup hp1.support_nodup, + p1.length_support] at hc + omega + rcases hp1div with ⟨d, hd⟩ + omega + +private theorem helper_hy2notC1_600.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (r : E) (w : V), phi r = some gamma → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a2 : E := T.edge r2; phi a2 = some N.beta → + let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); ( + ∀ {x : V} {f : E}, Sum.inl x ∈ C1 → Incident G x f → phi f = some gamma ∨ phi f = some N.beta + → Sum.inr f ∈ C1) → ( + ∀ {f : E} {x : V}, Sum.inr f ∈ C1 → Incident G x f → phi f = some gamma ∨ phi f = some N.beta + → Sum.inl x ∈ C1) → Incident G y2 a2 → Incident G y3 a2 → Incident G w r → Incident G y2 r + ∨ Incident G y3 r → (Sum.inl y2 ∈ C1 → Sum.inl y3 ∈ C1 → Sum.inl w ∈ C1 → False) → Sum.inl + y2 ∉ C1 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma r w hrcolor y0 y2 y3 r2 a2 ha2color C1 + edge_step_C1 vertex_step_C1 ha2inc2 ha2inc3 hrincw hrmiddle middle_too_large hy2C + have ha2C := edge_step_C1 hy2C ha2inc2 (Or.inr ha2color) + have hy3C := vertex_step_C1 ha2C ha2inc3 (Or.inr ha2color) + have hrC : Sum.inr r ∈ C1 := by + rcases hrmiddle with h | h + · exact edge_step_C1 hy2C h (Or.inl hrcolor) + · exact edge_step_C1 hy3C h (Or.inl hrcolor) + have hwC := vertex_step_C1 hrC hrincw (Or.inl hrcolor) + exact middle_too_large hy2C hy3C hwC + +private theorem helper_hwnotC1_614.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (r : E) (w : V), phi r = some gamma → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); ( + ∀ {x : V} {f : E}, Sum.inl x ∈ C1 → Incident G x f → phi f = some gamma ∨ phi f = some N.beta + → Sum.inr f ∈ C1) → ( + ∀ {f : E} {x : V}, Sum.inr f ∈ C1 → Incident G x f → phi f = some gamma ∨ phi f = some N.beta + → Sum.inl x ∈ C1) → Incident G w r → Incident G y2 r ∨ Incident G y3 r → Sum.inl y2 ∉ C1 → + Sum.inl y3 ∉ C1 → Sum.inl w ∉ C1 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma r w hrcolor y0 y2 y3 C1 edge_step_C1 + vertex_step_C1 hrincw hrmiddle hy2notC1 hy3notC1 hwC + have hrC := edge_step_C1 hwC hrincw (Or.inl hrcolor) + rcases hrmiddle with h | h + · exact hy2notC1 (vertex_step_C1 hrC h (Or.inl hrcolor)) + · exact hy3notC1 (vertex_step_C1 hrC h (Or.inl hrcolor)) + +private theorem helper_alpha_fixed_657.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); N.alpha ≠ N.beta → + let _ : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); gamma ≠ N.alpha → + gamma ≠ N.beta → + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma N.beta (Sum.inl y0); + ∀ (f : E), phi' f = some N.alpha ↔ phi f = some N.alpha := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma y0 halpha_beta C1 hgamma_alpha hgamma_beta phi' f + by_cases hfC : Sum.inr f ∈ C1 + · by_cases hfg : phi f = some gamma + · simp [phi', TwoColorComponentSwap, C1, hfC, hfg, hgamma_alpha, + Ne.symm halpha_beta] + · by_cases hfb : phi f = some N.beta + · simp [phi', TwoColorComponentSwap, C1, hfC, hfb, + hgamma_alpha, Ne.symm halpha_beta, Ne.symm hgamma_beta] + · simp [phi', TwoColorComponentSwap, C1, hfC, hfg, hfb] + · simp [phi', TwoColorComponentSwap, C1, hfC] + +private theorem helper_hM10sub_738.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)) (gamma : Fin k) (r : E) (w : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma N.beta (Sum.inl y0); + ∀ (p2 : (TwoColorIncidenceGraph G phi' N.alpha gamma).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let C2 : Set (V ⊕ E) := TwoColorComponent G phi' N.alpha gamma (Sum.inl y0); Sum.inl y0 ∈ C2 → + ( + ∀ {z : V ⊕ E}, z ∈ C2 → z ∈ p2.support) → Sum.inr q ∈ C2 → Sum.inl y4 ∈ C2 → Sum.inr a3 ∈ C2 → + Sum.inl y3 ∈ C2 → Sum.inl y1 ∈ C2 → Sum.inr a1 ∈ C2 → Sum.inl y2 ∈ C2 → Sum.inr r ∈ C2 → + Sum.inl w ∈ C2 → + let M10 : Finset (V ⊕ E) := (insert (Sum.inl y0) (insert (Sum.inl y1) (insert (Sum.inl y2) + (insert (Sum.inl y3) (insert (Sum.inl y4) (insert (Sum.inl w) (insert (Sum.inr q) (insert + (Sum.inr a1) (insert (Sum.inr a3) ({Sum.inr r} : Finset (V ⊕ E)) : Finset (V ⊕ E)) : + Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : + Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)); M10 ⊆ p2.support.toFinset := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight gamma r w y0 y1 y2 y3 y4 r1 r3 a1 a3 q phi' p2 C2 + hC2root support_of_C2 hqC2 hy4C2 ha3C2 hy3C2 hy1C2 ha1C2 hy2C2 hrC2 hwC2 M10 z hz + simp only [M10, Finset.mem_insert, Finset.mem_singleton] at hz + simp only [List.mem_toFinset] + rcases hz with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact support_of_C2 hC2root + · exact support_of_C2 hy1C2 + · exact support_of_C2 hy2C2 + · exact support_of_C2 hy3C2 + · exact support_of_C2 hy4C2 + · exact support_of_C2 hwC2 + · exact support_of_C2 hqC2 + · exact support_of_C2 ha1C2 + · exact support_of_C2 ha3C2 + · exact support_of_C2 hrC2 + +private theorem helper_endpoint_in_tree_768.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) → y0 ∈ + TreeSequenceVertexSet T → gamma ∈ MissingColors G phi y0 → + ∀ {x z : V} {f : E}, x ∈ TreeSequenceVertexSet T → G.ends f = s(x, z) → phi f = some gamma → z + ∈ TreeSequenceVertexSet T := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma y0 hclosed hy0T hgamma0 x z f hxT hfends hfcolor + by_contra hzT + have hboundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxT, z, hzT, hfends⟩ + exact (hclosed hboundary hy0T hfcolor) hgamma0 + +private theorem helper_missing_excludes_806.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k) (gamma : Fin k) {x : V} {f : E}, gamma ∈ MissingColors G + phi x → Incident G x f → phi f ≠ some gamma := by + classical + intro V E _ _ G k phi gamma x f hm hinc hfc + let _ := Fintype.ofFinite V + have hp : gamma ∈ PresentColors G phi x := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hinc, hfc⟩ + have hn : gamma ∉ PresentColors G phi x := by + simpa [MissingColors] using hm + exact hn hp + +private theorem helper_hz20_822.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); gamma ∈ MissingColors G phi y0 → + ∀ (f2 : E), phi f2 = some gamma → + ∀ (z2 : V), G.ends f2 = s(y2, z2) → ( + ∀ {x : V} {f : E}, gamma ∈ MissingColors G phi x → Incident G x f → phi f ≠ some gamma) → z2 ≠ + y0 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma y0 y2 hgamma0 f2 hf2color z2 hf2ends + missing_excludes h + have hinc : Incident G y0 f2 := by + unfold Incident + rw [hf2ends, h] + simp + exact (missing_excludes hgamma0 hinc) hf2color + +private theorem helper_hz30_829.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); gamma ∈ MissingColors G phi y0 → + ∀ (f3 : E), phi f3 = some gamma → + ∀ (z3 : V), G.ends f3 = s(y3, z3) → ( + ∀ {x : V} {f : E}, gamma ∈ MissingColors G phi x → Incident G x f → phi f ≠ some gamma) → z3 ≠ + y0 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma y0 y3 hgamma0 f3 hf3color z3 hf3ends + missing_excludes h + have hinc : Incident G y0 f3 := by + unfold Incident + rw [hf3ends, h] + simp + exact (missing_excludes hgamma0 hinc) hf3color + +private theorem helper_hz23_849.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k), + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (f2 : E), phi f2 = some gamma → + ∀ (f3 : E), Incident G y3 f3 → phi f3 = some gamma → + ∀ (z2 : V), G.ends f2 = s(y2, z2) → IsProperEdgeColoring G phi → ¬f2 = f3 → z2 ≠ y3 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma y2 y3 f2 hf2color f3 hf3inc hf3color z2 hf2ends + hproper hne h + have hinc : Incident G y3 f2 := by + unfold Incident + rw [hf2ends, h] + simp + exact (hproper hne ⟨y3, hinc, hf3inc⟩ hf2color) hf3color + +private theorem helper_hz32_856.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k), + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (f2 : E), Incident G y2 f2 → phi f2 = some gamma → + ∀ (f3 : E), phi f3 = some gamma → + ∀ (z3 : V), G.ends f3 = s(y3, z3) → IsProperEdgeColoring G phi → ¬f2 = f3 → z3 ≠ y2 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma y2 y3 f2 hf2inc hf2color f3 hf3color z3 hf3ends + hproper hne h + have hinc : Incident G y2 f3 := by + unfold Incident + rw [hf3ends, h] + simp + exact (hproper (Ne.symm hne) ⟨y2, hinc, hf2inc⟩ hf3color) hf2color + +private theorem helper_hz2cases_863.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (z2 : V), z2 = y0 ∨ z2 = y1 ∨ z2 = y2 ∨ z2 = y3 ∨ z2 = y4 → z2 ≠ y2 → z2 ≠ y0 → z2 ≠ y3 → z2 + = y1 ∨ z2 = y4 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y1 y2 y3 y4 z2 hz2trunk hz22 hz20 hz23 + rcases hz2trunk with h | h | h | h | h + · exact False.elim (hz20 h) + · exact Or.inl h + · exact False.elim (hz22 h) + · exact False.elim (hz23 h) + · exact Or.inr h + +private theorem helper_hz3cases_870.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (z3 : V), z3 = y0 ∨ z3 = y1 ∨ z3 = y2 ∨ z3 = y3 ∨ z3 = y4 → z3 ≠ y3 → z3 ≠ y0 → z3 ≠ y2 → z3 + = y1 ∨ z3 = y4 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y1 y2 y3 y4 z3 hz3trunk hz33 hz30 hz32 + rcases hz3trunk with h | h | h | h | h + · exact False.elim (hz30 h) + · exact Or.inl h + · exact False.elim (hz32 h) + · exact False.elim (hz33 h) + · exact Or.inr h + +private theorem helper_crossing_contra_877.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (g : E) (v : V), phi g = some gamma → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); gamma ∈ MissingColors G phi y0 → + ∀ (f2 : E), Incident G y2 f2 → phi f2 = some gamma → + ∀ (f3 : E), Incident G y3 f3 → phi f3 = some gamma → + ∀ (z2 : V), G.ends f2 = s(y2, z2) → + ∀ (z3 : V), G.ends f3 = s(y3, z3) → IsProperEdgeColoring G phi → ( + ∀ {x : V} {f : E}, gamma ∈ MissingColors G phi x → Incident G x f → phi f ≠ some gamma) → + G.ends g = s(y0, v) ∨ G.ends g = s(y1, v) ∨ G.ends g = s(y2, v) ∨ G.ends g = s(y3, v) ∨ + G.ends g = s(y4, v) → v ≠ y1 → v ≠ y2 → v ≠ y3 → v ≠ y4 → Incident G v g → ¬f2 = f3 → z2 = + y1 ∨ z2 = y4 → z3 = y1 ∨ z3 = y4 → False := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma g v hgcolor y0 y1 y2 y3 y4 hgamma0 f2 hf2inc + hf2color f3 hf3inc hf3color z2 hf2ends z3 hf3ends hproper missing_excludes hgends' hv1' + hv2' hv3' hv4' hgvinc hne hz2 hz3 + have hgf2 : g ≠ f2 := by + intro h + have hinc : Incident G v f2 := by simpa [h] using hgvinc + unfold Incident at hinc + rw [hf2ends] at hinc + rcases hz2 with h2 | h2 + · rw [h2] at hinc + simp only [Sym2.mem_iff] at hinc + exact hinc.elim hv2' hv1' + · rw [h2] at hinc + simp only [Sym2.mem_iff] at hinc + exact hinc.elim hv2' hv4' + have hgf3 : g ≠ f3 := by + intro h + have hinc : Incident G v f3 := by simpa [h] using hgvinc + unfold Incident at hinc + rw [hf3ends] at hinc + rcases hz3 with h3 | h3 + · rw [h3] at hinc + simp only [Sym2.mem_iff] at hinc + exact hinc.elim hv3' hv1' + · rw [h3] at hinc + simp only [Sym2.mem_iff] at hinc + exact hinc.elim hv3' hv4' + rcases hz2 with h2 | h2 <;> rcases hz3 with h3 | h3 + · have hi2 : Incident G y1 f2 := by + unfold Incident + rw [hf2ends, h2] + simp + have hi3 : Incident G y1 f3 := by + unfold Incident + rw [hf3ends, h3] + simp + exact (hproper hne ⟨y1, hi2, hi3⟩ hf2color) hf3color + · rcases hgends' with h | h | h | h | h + · have hinc : Incident G y0 g := by unfold Incident; rw [h]; simp + exact (missing_excludes hgamma0 hinc) hgcolor + · have hginc : Incident G y1 g := by unfold Incident; rw [h]; simp + have hfinc : Incident G y1 f2 := by + unfold Incident + rw [hf2ends, h2] + simp + exact (hproper hgf2 ⟨y1, hginc, hfinc⟩ hgcolor) hf2color + · have hginc : Incident G y2 g := by unfold Incident; rw [h]; simp + exact (hproper hgf2 ⟨y2, hginc, hf2inc⟩ hgcolor) hf2color + · have hginc : Incident G y3 g := by unfold Incident; rw [h]; simp + exact (hproper hgf3 ⟨y3, hginc, hf3inc⟩ hgcolor) hf3color + · have hginc : Incident G y4 g := by unfold Incident; rw [h]; simp + have hfinc : Incident G y4 f3 := by + unfold Incident + rw [hf3ends, h3] + simp + exact (hproper hgf3 ⟨y4, hginc, hfinc⟩ hgcolor) hf3color + · rcases hgends' with h | h | h | h | h + · have hinc : Incident G y0 g := by unfold Incident; rw [h]; simp + exact (missing_excludes hgamma0 hinc) hgcolor + · have hginc : Incident G y1 g := by unfold Incident; rw [h]; simp + have hfinc : Incident G y1 f3 := by + unfold Incident + rw [hf3ends, h3] + simp + exact (hproper hgf3 ⟨y1, hginc, hfinc⟩ hgcolor) hf3color + · have hginc : Incident G y2 g := by unfold Incident; rw [h]; simp + exact (hproper hgf2 ⟨y2, hginc, hf2inc⟩ hgcolor) hf2color + · have hginc : Incident G y3 g := by unfold Incident; rw [h]; simp + exact (hproper hgf3 ⟨y3, hginc, hf3inc⟩ hgcolor) hf3color + · have hginc : Incident G y4 g := by unfold Incident; rw [h]; simp + have hfinc : Incident G y4 f2 := by + unfold Incident + rw [hf2ends, h2] + simp + exact (hproper hgf2 ⟨y4, hginc, hfinc⟩ hgcolor) hf2color + · have hi2 : Incident G y4 f2 := by + unfold Incident + rw [hf2ends, h2] + simp + have hi3 : Incident G y4 f3 := by + unfold Incident + rw [hf3ends, h3] + simp + exact (hproper hne ⟨y4, hi2, hi3⟩ hf2color) hf3color + +private theorem helper_hz2eq_964.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (f2 : E) (z2 : V), G.ends f2 = s(y2, z2) → y2 ≠ y3 → Incident G y3 f2 → z2 = y3 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y2 y3 f2 z2 hf2ends hy23 hf23inc3 + have hm : y3 ∈ s(y2, z2) := by + rw [← hf2ends] + exact hf23inc3 + simp only [Sym2.mem_iff] at hm + rcases hm with h | h + · exact False.elim (hy23 h.symm) + · exact h.symm + +private theorem helper_hf1ne2_973.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (f1 : E), Incident G y1 f1 → + ∀ (f2 : E), y1 ≠ y2 → y1 ≠ y3 → G.ends f2 = s(y2, y3) → f1 ≠ f2 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y1 y2 y3 f1 hf1inc f2 hy12 hy13 hf23ends heq + have hinc : Incident G y1 f2 := by + rw [← heq] + exact hf1inc + unfold Incident at hinc + rw [hf23ends] at hinc + simp only [Sym2.mem_iff] at hinc + exact hinc.elim hy12 hy13 + +private theorem helper_hz14_997.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (g : E) (v : V), phi g = some gamma → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); gamma ∈ MissingColors G phi y0 → + ∀ (f1 : E), Incident G y1 f1 → phi f1 = some gamma → + ∀ (f2 : E), Incident G y2 f2 → phi f2 = some gamma → + ∀ (z1 : V), G.ends f1 = s(y1, z1) → IsProperEdgeColoring G phi → ( + ∀ {x : V} {f : E}, gamma ∈ MissingColors G phi x → Incident G x f → phi f ≠ some gamma) → + G.ends g = s(y0, v) ∨ G.ends g = s(y1, v) ∨ G.ends g = s(y2, v) ∨ G.ends g = s(y3, v) ∨ + G.ends g = s(y4, v) → v ≠ y1 → v ≠ y2 → v ≠ y3 → v ≠ y4 → Incident G v g → Incident G y3 + f2 → G.ends f2 = s(y2, y3) → z1 ≠ y4 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma g v hgcolor y0 y1 y2 y3 y4 hgamma0 f1 hf1inc + hf1color f2 hf2inc hf2color z1 hf1ends hproper missing_excludes hgends' hv1' hv2' hv3' hv4' + hgvinc hf23inc3 hf23ends h14 + have hgf1 : g ≠ f1 := by + intro h + have hinc : Incident G v f1 := by simpa [h] using hgvinc + unfold Incident at hinc + rw [hf1ends, h14] at hinc + simp only [Sym2.mem_iff] at hinc + exact hinc.elim hv1' hv4' + have hgf2 : g ≠ f2 := by + intro h + have hinc : Incident G v f2 := by simpa [h] using hgvinc + unfold Incident at hinc + rw [hf23ends] at hinc + simp only [Sym2.mem_iff] at hinc + exact hinc.elim hv2' hv3' + rcases hgends' with h | h | h | h | h + · have hginc : Incident G y0 g := by unfold Incident; rw [h]; simp + exact (missing_excludes hgamma0 hginc) hgcolor + · have hginc : Incident G y1 g := by unfold Incident; rw [h]; simp + exact (hproper hgf1 ⟨y1, hginc, hf1inc⟩ hgcolor) hf1color + · have hginc : Incident G y2 g := by unfold Incident; rw [h]; simp + exact (hproper hgf2 ⟨y2, hginc, hf2inc⟩ hgcolor) hf2color + · have hginc : Incident G y3 g := by unfold Incident; rw [h]; simp + exact (hproper hgf2 ⟨y3, hginc, hf23inc3⟩ hgcolor) hf2color + · have hginc : Incident G y4 g := by unfold Incident; rw [h]; simp + have hfinc : Incident G y4 f1 := by + unfold Incident + rw [hf1ends, h14] + simp + exact (hproper hgf1 ⟨y4, hginc, hfinc⟩ hgcolor) hf1color + +private theorem helper_hf4ne2_1035.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (f2 f4 : E), Incident G y4 f4 → y2 ≠ y4 → y3 ≠ y4 → G.ends f2 = s(y2, y3) → f4 ≠ f2 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y2 y3 y4 f2 f4 hf4inc hy24 hy34 hf23ends heq + have hinc : Incident G y4 f2 := by + rw [← heq] + exact hf4inc + unfold Incident at hinc + rw [hf23ends] at hinc + simp only [Sym2.mem_iff] at hinc + exact hinc.elim (Ne.symm hy24) (Ne.symm hy34) + +private theorem helper_hz41_1052.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (f1 : E), Incident G y1 f1 → phi f1 = some gamma → + ∀ (f4 : E), phi f4 = some gamma → + ∀ (z1 : V), G.ends f1 = s(y1, z1) → + ∀ (z4 : V), G.ends f4 = s(y4, z4) → y1 ≠ y4 → IsProperEdgeColoring G phi → z1 ≠ y4 → z4 ≠ y1 + := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma y1 y4 f1 hf1inc hf1color f4 hf4color z1 hf1ends + z4 hf4ends hy14 hproper hz14 h41 + have hf4inc1 : Incident G y1 f4 := by + unfold Incident + rw [hf4ends, h41] + simp + have heq : f4 = f1 := by + by_contra hne + exact (hproper hne ⟨y1, hf4inc1, hf1inc⟩ hf4color) hf1color + have hpairs : s(y4, y1) = s(y1, z1) := by + calc + s(y4, y1) = G.ends f4 := by rw [hf4ends, h41] + _ = G.ends f1 := congrArg G.ends heq + _ = s(y1, z1) := hf1ends + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hy14 hd.1.symm + · exact hz14 hs.1.symm + +private theorem helper_f2_eq_f3_2262.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (g : E) (v : V), phi g = some gamma → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); gamma ∈ MissingColors G phi y0 → + ∀ (f2 : E), Incident G y2 f2 → phi f2 = some gamma → + ∀ (f3 : E), Incident G y3 f3 → phi f3 = some gamma → + ∀ (z2 : V), G.ends f2 = s(y2, z2) → + ∀ (z3 : V), G.ends f3 = s(y3, z3) → z2 = y0 ∨ z2 = y1 ∨ z2 = y2 ∨ z2 = y3 ∨ z2 = y4 → z3 = y0 + ∨ z3 = y1 ∨ z3 = y2 ∨ z3 = y3 ∨ z3 = y4 → IsProperEdgeColoring G phi → ( + ∀ {x : V} {f : E}, gamma ∈ MissingColors G phi x → Incident G x f → phi f ≠ some gamma) → z2 ≠ + y2 → z3 ≠ y3 → z2 ≠ y0 → z3 ≠ y0 → G.ends g = s(y0, v) ∨ G.ends g = s(y1, v) ∨ G.ends g = + s(y2, v) ∨ G.ends g = s(y3, v) ∨ G.ends g = s(y4, v) → v ≠ y1 → v ≠ y2 → v ≠ y3 → v ≠ y4 → + Incident G v g → f2 = f3 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma g v hgcolor y0 y1 y2 y3 y4 hgamma0 f2 hf2inc + hf2color f3 hf3inc hf3color z2 hf2ends z3 hf3ends hz2trunk hz3trunk hproper + missing_excludes hz22 hz33 hz20 hz30 hgends' hv1' hv2' hv3' hv4' hgvinc + by_contra hne + have hz23 := @helper_hz23_849 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@gamma) (@f2) (@hf2color) (@f3) (@hf3inc) (@hf3color) (@z2) + (@hf2ends) (@hproper) (@hne) + have hz32 := @helper_hz32_856 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@gamma) (@f2) (@hf2inc) (@hf2color) (@f3) (@hf3color) (@z3) + (@hf3ends) (@hproper) (@hne) + have hz2cases := @helper_hz2cases_863 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@z2) (@hz2trunk) (@hz22) (@hz20) (@hz23) + have hz3cases := @helper_hz3cases_870 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@z3) (@hz3trunk) (@hz33) (@hz30) (@hz32) + have crossing_contra := @helper_crossing_contra_877 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@g) (@v) (@hgcolor) + (@hgamma0) (@f2) (@hf2inc) (@hf2color) (@f3) (@hf3inc) (@hf3color) (@z2) (@hf2ends) (@z3) + (@hf3ends) (@hproper) (@missing_excludes) (@hgends') (@hv1') (@hv2') (@hv3') (@hv4') (@hgvinc) + (@hne) + exact crossing_contra hz2cases hz3cases + +private theorem helper_hgamma_alpha_2298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (_ : + ScheideGraphHeight G = (5 : ℕ)) (gamma : Fin k) (g : E) (v : V) (_ : phi g = some gamma), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by + omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by + omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by + omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; + ∀ (_ : y0 ≠ y1) (_ : y0 ≠ y2) (_ : y0 ≠ y3) (_ : y0 ≠ y4) (_ : y1 ≠ y2) (_ : y1 ≠ y3) (_ : y1 + ≠ y4) (_ : y2 ≠ y3) (_ : y2 ≠ y4) (_ : y3 ≠ y4) (_ : G.ends a1 = s(y1, y2)) (_ : G.ends a2 + = s(y2, y3)) (_ : G.ends a3 = s(y3, y4)) (_ : phi a1 = some N.alpha) (_ : a1 ≠ a2) (_ : + phi a2 = some N.beta) (_ : a2 ≠ a3) (_ : phi a3 = some N.alpha) (_ : v ≠ y0) (_ : v ≠ y1) + (_ : v ≠ y2) (_ : v ≠ y3) (_ : v ≠ y4) (_ : G.ends g = s(y0, v) ∨ G.ends g = s(y1, v) ∨ + G.ends g = s(y2, v) ∨ G.ends g = s(y3, v) ∨ G.ends g = s(y4, v)) (p1 : + (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (_ : p1.IsPath) (_ : (4 : ℕ) ∣ + p1.length) (_ : p1.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G), + let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); + ∀ (_ : Sum.inl y0 ∈ C1) (_ : + ∀ {z : V ⊕ E} (_ : z ∈ C1), z ∈ p1.support) (_ : + ∀ {x : V} {f : E} (_ : Sum.inl x ∈ C1) (_ : Incident G x f) (_ : phi f = some gamma ∨ phi f = + some N.beta), Sum.inr f ∈ C1) (_ : + ∀ {f : E} {x : V} (_ : Sum.inr f ∈ C1) (_ : Incident G x f) (_ : phi f = some gamma ∨ phi f = + some N.beta), Sum.inl x ∈ C1) (_ : Sum.inr q ∈ C1) (_ : Sum.inl y4 ∈ C1) (_ : Sum.inl y1 ∈ + C1) (_ : q ≠ a1) (_ : q ≠ a2) (_ : q ≠ a3) (_ : a1 ≠ a3), gamma ≠ N.alpha := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hGheight gamma g v hgcolor y0 y1 y2 y3 y4 r1 r2 r3 a1 + a2 a3 q hy01 hy02 hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 ha1ends ha2ends ha3ends ha1color + ha12ne ha2color ha23ne ha3color hv0' hv1' hv2' hv3' hv4' hgends' p1 hp1 hp1div hp1bound C1 + hC1root support_of_C1 edge_step_C1 vertex_step_C1 hqC1 hy4C1 hy1C1 hqa1 hqa2 hqa3 ha13ne + exact @helper_hgamma_alpha_425 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@g) (@v) (@hgcolor) + (@hy01) (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) + (@ha1ends) (@ha2ends) (@ha3ends) (@ha1color) (@ha12ne) (@ha2color) (@ha23ne) + (@ha3color) (@hv0') (@hv1') (@hv2') (@hv3') (@hv4') (@hgends') (@p1) (@hp1) (@hp1div) + (@hp1bound) (@hC1root) (@support_of_C1) (@edge_step_C1) (@vertex_step_C1) (@hqC1) + (@hy4C1) (@hy1C1) (@hqa1) (@hqa2) (@hqa3) (@ha13ne) + +private theorem helper_middle_too_large_2342.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (_ : + ScheideGraphHeight G = (5 : ℕ)) (gamma : Fin k) (r : E) (w : V) (_ : phi r = some gamma), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by + omega + ⟩ : Fin T.length); + let a2 : E := T.edge r2; + let q : E := N.closingEdge; + ∀ (_ : y0 ≠ y1) (_ : y0 ≠ y2) (_ : y0 ≠ y3) (_ : y0 ≠ y4) (_ : y1 ≠ y2) (_ : y1 ≠ y3) (_ : y1 + ≠ y4) (_ : y2 ≠ y3) (_ : y2 ≠ y4) (_ : y3 ≠ y4) (_ : phi a2 = some N.beta) (p1 : + (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (_ : p1.IsPath) (_ : (4 : ℕ) ∣ + p1.length) (_ : p1.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G), + let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); + ∀ (_ : Sum.inl y0 ∈ C1) (_ : + ∀ {z : V ⊕ E} (_ : z ∈ C1), z ∈ p1.support) (_ : + ∀ {x : V} {f : E} (_ : Sum.inl x ∈ C1) (_ : Incident G x f) (_ : phi f = some gamma ∨ phi f = + some N.beta), Sum.inr f ∈ C1) (_ : Sum.inr q ∈ C1) (_ : Sum.inl y4 ∈ C1) (_ : Sum.inl y1 ∈ + C1) (b : E) (_ : Sum.inr b ∈ C1) (_ : q ≠ a2) (_ : w ≠ y0) (_ : w ≠ y1) (_ : w ≠ y2) (_ : + w ≠ y3) (_ : w ≠ y4) (_ : Incident G y2 a2) (_ : Incident G y2 r ∨ Incident G y3 r) (_ : b + ≠ q) (_ : b ≠ a2) (_ : r ≠ q) (_ : r ≠ a2) (_ : b ≠ r) (_ : Sum.inl y2 ∈ C1) (_ : Sum.inl + y3 ∈ C1) (_ : Sum.inl w ∈ C1), False := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hGheight gamma r w hrcolor y0 y1 y2 y3 y4 r2 a2 q hy01 + hy02 hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 ha2color p1 hp1 hp1div hp1bound C1 hC1root + support_of_C1 edge_step_C1 hqC1 hy4C1 hy1C1 b hbC1 hqa2 hw0 hw1 hw2 hw3 hw4 ha2inc2 + hrmiddle hbq hba2 hrq hra2 hbr hy2C hy3C hwC + exact @helper_middle_too_large_561 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@r) (@w) (@hrcolor) + (@hy01) (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) + (@ha2color) (@p1) (@hp1) (@hp1div) (@hp1bound) (@hC1root) (@support_of_C1) + (@edge_step_C1) (@hqC1) (@hy4C1) (@hy1C1) (@b) (@hbC1) (@hqa2) (@hw0) (@hw1) (@hw2) + (@hw3) (@hw4) (@ha2inc2) (@hrmiddle) (@hbq) (@hba2) (@hrq) (@hra2) (@hbr) (@hy2C) + (@hy3C) (@hwC) + +private theorem helper_f2_eq_f3_2563.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (g : E) (v : V) (_ : phi g = some gamma), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : gamma ∈ MissingColors G phi y0) (f2 : E) (_ : Incident G y2 f2) (_ : phi f2 = some + gamma) (f3 : E) (_ : Incident G y3 f3) (_ : phi f3 = some gamma) (z2 : V) (_ : G.ends f2 = + s(y2, z2)) (z3 : V) (_ : G.ends f3 = s(y3, z3)) (_ : z2 = y0 ∨ z2 = y1 ∨ z2 = y2 ∨ z2 = y3 + ∨ z2 = y4) (_ : z3 = y0 ∨ z3 = y1 ∨ z3 = y2 ∨ z3 = y3 ∨ z3 = y4) (_ : IsProperEdgeColoring + G phi) (_ : + ∀ {x : V} {f : E} (_ : gamma ∈ MissingColors G phi x) (_ : Incident G x f), phi f ≠ some + gamma) (_ : z2 ≠ y2) (_ : z3 ≠ y3) (_ : z2 ≠ y0) (_ : z3 ≠ y0) (_ : G.ends g = s(y0, v) ∨ + G.ends g = s(y1, v) ∨ G.ends g = s(y2, v) ∨ G.ends g = s(y3, v) ∨ G.ends g = s(y4, v)) (_ + : v ≠ y1) (_ : v ≠ y2) (_ : v ≠ y3) (_ : v ≠ y4) (_ : Incident G v g), f2 = f3 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma g v hgcolor y0 y1 y2 y3 y4 hgamma0 f2 hf2inc + hf2color f3 hf3inc hf3color z2 hf2ends z3 hf3ends hz2trunk hz3trunk hproper + missing_excludes hz22 hz33 hz20 hz30 hgends' hv1' hv2' hv3' hv4' hgvinc + exact @helper_f2_eq_f3_2262 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@g) (@v) (@hgcolor) (@hgamma0) (@f2) + (@hf2inc) (@hf2color) (@f3) (@hf3inc) (@hf3color) (@z2) (@hf2ends) (@z3) (@hf3ends) + (@hz2trunk) (@hz3trunk) (@hproper) (@missing_excludes) (@hz22) (@hz33) (@hz20) (@hz30) + (@hgends') (@hv1') (@hv2') (@hv3') (@hv4') (@hgvinc) + +private theorem helper_continuation_2789.{u_1, u_2} : + helperContinuation2789Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma g v hgcolor hgends _ hv1 hv2 hv3 hv4 y0 y1 y2 y3 + y4 hgamma0 f1 hf1inc hf1color f2 hf2inc hf2color f3 hf3inc hf3color f4 hf4inc hf4color z1 + hf1ends z2 hf2ends z3 hf3ends z4 hf4ends hz2trunk hz3trunk hz1T hz4T hy12 hy13 hy14 hy23 + hy24 hy34 + have hproper : IsProperEdgeColoring G phi := N.global.1.2.2.2.1 + have missing_excludes := @helper_missing_excludes_806 (@V) (@E) inferInstance inferInstance (@G) + (@k) (@phi) (@gamma) + have hz22 : z2 ≠ y2 := by + intro h + exact G.loopless f2 y2 (by simpa [h] using hf2ends) + have hz33 : z3 ≠ y3 := by + intro h + exact G.loopless f3 y3 (by simpa [h] using hf3ends) + have hz20 := @helper_hz20_822 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@gamma) (@hgamma0) (@f2) (@hf2color) (@z2) (@hf2ends) + (@missing_excludes) + have hz30 := @helper_hz30_829 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@gamma) (@hgamma0) (@f3) (@hf3color) (@z3) (@hf3ends) + (@missing_excludes) + have hgends' : G.ends g = s(y0, v) ∨ G.ends g = s(y1, v) ∨ + G.ends g = s(y2, v) ∨ G.ends g = s(y3, v) ∨ + G.ends g = s(y4, v) := by + simpa [y0, y1, y2, y3, y4] using hgends + have hv1' : v ≠ y1 := by simpa [y1] using hv1 + have hv2' : v ≠ y2 := by simpa [y2] using hv2 + have hv3' : v ≠ y3 := by simpa [y3] using hv3 + have hv4' : v ≠ y4 := by simpa [y4] using hv4 + have hgvinc : Incident G v g := by + rcases hgends' with h | h | h | h | h <;> + unfold Incident <;> rw [h] <;> simp + have f2_eq_f3 := @helper_f2_eq_f3_2563 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@g) (@v) (@hgcolor) (@hgamma0) (@f2) + (@hf2inc) (@hf2color) (@f3) (@hf3inc) (@hf3color) (@z2) (@hf2ends) (@z3) (@hf3ends) + (@hz2trunk) (@hz3trunk) (@hproper) (@missing_excludes) (@hz22) (@hz33) (@hz20) (@hz30) + (@hgends') (@hv1') (@hv2') (@hv3') (@hv4') (@hgvinc) + have hf23inc3 : Incident G y3 f2 := by + rw [f2_eq_f3] + exact hf3inc + have hz2eq := @helper_hz2eq_964 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@f2) (@z2) (@hf2ends) (@hy23) (@hf23inc3) + have hf23ends : G.ends f2 = s(y2, y3) := by simpa [hz2eq] using hf2ends + have hf1ne2 := @helper_hf1ne2_973 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@f1) (@hf1inc) (@f2) (@hy12) (@hy13) (@hf23ends) + have hz11 : z1 ≠ y1 := by + intro h + exact G.loopless f1 y1 (by simpa [h] using hf1ends) + have hz10 : z1 ≠ y0 := by + intro h + have hinc : Incident G y0 f1 := by unfold Incident; rw [hf1ends, h]; simp + exact (missing_excludes hgamma0 hinc) hf1color + have hz12 : z1 ≠ y2 := by + intro h + have hinc : Incident G y2 f1 := by unfold Incident; rw [hf1ends, h]; simp + exact (hproper hf1ne2 ⟨y2, hinc, hf2inc⟩ hf1color) hf2color + have hz13 : z1 ≠ y3 := by + intro h + have hinc : Incident G y3 f1 := by unfold Incident; rw [hf1ends, h]; simp + exact (hproper hf1ne2 ⟨y3, hinc, hf23inc3⟩ hf1color) hf2color + have hz14 := @helper_hz14_997 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@gamma) (@g) (@v) (@hgcolor) (@hgamma0) (@f1) (@hf1inc) + (@hf1color) (@f2) (@hf2inc) (@hf2color) (@z1) (@hf1ends) (@hproper) (@missing_excludes) + (@hgends') (@hv1') (@hv2') (@hv3') (@hv4') (@hgvinc) (@hf23inc3) (@hf23ends) + have hz44 : z4 ≠ y4 := by + intro h + exact G.loopless f4 y4 (by simpa [h] using hf4ends) + have hz40 : z4 ≠ y0 := by + intro h + have hinc : Incident G y0 f4 := by unfold Incident; rw [hf4ends, h]; simp + exact (missing_excludes hgamma0 hinc) hf4color + have hf4ne2 := @helper_hf4ne2_1035 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@f2) (@f4) (@hf4inc) (@hy24) (@hy34) (@hf23ends) + have hz42 : z4 ≠ y2 := by + intro h + have hinc : Incident G y2 f4 := by unfold Incident; rw [hf4ends, h]; simp + exact (hproper hf4ne2 ⟨y2, hinc, hf2inc⟩ hf4color) hf2color + have hz43 : z4 ≠ y3 := by + intro h + have hinc : Incident G y3 f4 := by unfold Incident; rw [hf4ends, h]; simp + exact (hproper hf4ne2 ⟨y3, hinc, hf23inc3⟩ hf4color) hf2color + have hz41 := @helper_hz41_1052 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@hf1inc) (@hf1color) (@f4) (@hf4color) (@z1) + (@hf1ends) (@z4) (@hf4ends) (@hy14) (@hproper) (@hz14) + refine ⟨f1, f4, f2, z1, z4, ?_, ?_, ?_, hf1color, hf4color, + hf2color, hz1T, hz4T, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · simpa [y1] using hf1ends + · simpa [y4] using hf4ends + · simpa [y2, y3] using hf23ends + · simpa [y0] using hz10 + · simpa [y1] using hz11 + · simpa [y2] using hz12 + · simpa [y3] using hz13 + · simpa [y4] using hz14 + · simpa [y0] using hz40 + · simpa [y1] using hz41 + · simpa [y2] using hz42 + · simpa [y3] using hz43 + · simpa [y4] using hz44 + +private theorem helper_continuation_3161.{u_1, u_2} : + helperContinuation3161Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma g v hgcolor hgends _ hv1 hv2 hv3 hv4 y0 y1 y2 y3 + y4 hclosed hy0T hy1T hy4T hgamma0 f1 hf1inc hf1color f2 hf2inc hf2color f3 hf3inc hf3color + f4 hf4inc hf4color z1 hf1ends z2 hf2ends z3 hf3ends z4 hf4ends middle_no_escape + have hz2trunk : z2 = y0 ∨ z2 = y1 ∨ z2 = y2 ∨ z2 = y3 ∨ z2 = y4 := by + simpa [y0, y1, y2, y3, y4] using + (middle_no_escape f2 z2 hf2color + (Or.inl (by simpa [y2] using hf2ends))) + have hz3trunk : z3 = y0 ∨ z3 = y1 ∨ z3 = y2 ∨ z3 = y3 ∨ z3 = y4 := by + simpa [y0, y1, y2, y3, y4] using + (middle_no_escape f3 z3 hf3color + (Or.inr (by simpa [y3] using hf3ends))) + have endpoint_in_tree := @helper_endpoint_in_tree_768 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@hclosed) (@hy0T) + (@hgamma0) + have hz1T : z1 ∈ TreeSequenceVertexSet T := + endpoint_in_tree hy1T (by simpa [y1] using hf1ends) hf1color + have hz4T : z4 ∈ TreeSequenceVertexSet T := + endpoint_in_tree hy4T (by simpa [y4] using hf4ends) hf4color + have hy12 : y1 ≠ y2 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy13 : y1 ≠ y3 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy14 : y1 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy23 : y2 ≠ y3 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy24 : y2 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy34 : y3 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + exact @helper_continuation_2789 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@g) (@v) (@hgcolor) (@hgends) (by + assumption) (@hv1) (@hv2) (@hv3) (@hv4) (@hgamma0) (@f1) (@hf1inc) (@hf1color) (@f2) + (@hf2inc) (@hf2color) (@f3) (@hf3inc) (@hf3color) (@f4) (@hf4inc) (@hf4color) (@z1) + (@hf1ends) (@z2) (@hf2ends) (@z3) (@hf3ends) (@z4) (@hf4ends) (@hz2trunk) (@hz3trunk) + (@hz1T) (@hz4T) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) + +private theorem helper_caseContinuation_3625.{u_1, u_2} : + helperCaseContinuation3625Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hGheight gamma v _ r w hrcolor y0 y1 y2 y3 y4 r1 r3 a1 + a3 q hy01 hy02 hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 ha1ends ha3ends hproper ha1color + ha3color hqcolor halpha_beta p1 C1 hqinc0 hqinc4 hqC1 hy1C1 hqa1 hqa3 ha13ne hgamma_alpha + hgamma_beta hw0 hw1 hw2 hw3 hw4 hrincw hrmiddle hrq hrnotC1 i0 i1 pmax hchangedata phi' + hproper' hone' + have hTash' : TashkinovTree G e0 phi' T := by + simpa [phi', y0, i0] using hchangedata.2.2 + have hglobal' : GlobalMaximumTriple G k e0 phi' T := by + exact ⟨⟨N.global.1.1, N.global.1.2.1, N.global.1.2.2.1, + hproper', hone'⟩, hTash', N.global.2.2⟩ + have hbehavior := TwoColorComponentSwapMissingBehavior G phi gamma N.beta + hgamma_beta hproper (Sum.inl y0) + have hgamma' : gamma ∈ MissingColors G phi' y1 := by + exact hbehavior.2.2.1 y1 hy1C1 (by simpa [y1] using N.beta_missing) + have halpha' : N.alpha ∈ MissingColors G phi' y0 := by + apply (hbehavior.2.2.2 y0 N.alpha hgamma_alpha.symm halpha_beta).2 + simpa [y0] using N.alpha_missing + have hqcolor' : phi' q = some gamma := by + simp [phi', TwoColorComponentSwap, C1, hqC1, hqcolor] + have alpha_fixed := @helper_alpha_fixed_657 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@halpha_beta) (@hgamma_alpha) + (@hgamma_beta) + have ha1color' : phi' a1 = some N.alpha := (alpha_fixed a1).2 ha1color + have ha3color' : phi' a3 = some N.alpha := (alpha_fixed a3).2 ha3color + have hrcolor' : phi' r = some gamma := by + simp [phi', TwoColorComponentSwap, C1, hrnotC1, hrcolor] + obtain ⟨p2, hp2, hp2support, hp2div, hp2vertices, hp2bound⟩ := + ScheideKempePathHeightBound G k e0 phi' T hglobal' N.alpha gamma + (by simpa [y0] using halpha') (by simpa [y1] using hgamma') + have hp2bound' : p2.length / 2 + 1 ≤ 5 := by + simpa [hGheight] using hp2bound + let H2 := TwoColorIncidenceGraph G phi' N.alpha gamma + let C2 := TwoColorComponent G phi' N.alpha gamma (Sum.inl y0) + have hp2support' : {z | z ∈ p2.support} = C2 := by + simpa [C2, y0] using hp2support + have hC2root : Sum.inl y0 ∈ C2 := by + change H2.connectedComponentMk (Sum.inl y0) = + H2.connectedComponentMk (Sum.inl y0) + rfl + have C2_of_adj {x z : Sum V E} (hx : x ∈ C2) (hxz : H2.Adj x z) : z ∈ C2 := by + change H2.connectedComponentMk x = H2.connectedComponentMk (Sum.inl y0) at hx + change H2.connectedComponentMk z = H2.connectedComponentMk (Sum.inl y0) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hxz).symm.trans hx + have support_of_C2 {z : Sum V E} (hz : z ∈ C2) : z ∈ p2.support := by + exact (Set.ext_iff.mp hp2support' z).mpr hz + have edge_step_C2 {x : V} {f : E} (hx : Sum.inl x ∈ C2) + (hxf : Incident G x f) + (hfc : phi' f = some N.alpha ∨ phi' f = some gamma) : + Sum.inr f ∈ C2 := by + apply C2_of_adj hx + simpa [H2, TwoColorIncidenceGraph] using And.intro hxf hfc + have vertex_step_C2 {f : E} {x : V} (hf : Sum.inr f ∈ C2) + (hxf : Incident G x f) + (hfc : phi' f = some N.alpha ∨ phi' f = some gamma) : + Sum.inl x ∈ C2 := by + apply C2_of_adj hf + simpa [H2, TwoColorIncidenceGraph] using And.intro hxf hfc + have hqC2 := edge_step_C2 hC2root hqinc0 (Or.inr hqcolor') + have hy4C2 := vertex_step_C2 hqC2 hqinc4 (Or.inr hqcolor') + have ha3inc4 : Incident G y4 a3 := by unfold Incident; rw [ha3ends]; simp + have ha3inc3 : Incident G y3 a3 := by unfold Incident; rw [ha3ends]; simp + have ha3C2 := edge_step_C2 hy4C2 ha3inc4 (Or.inl ha3color') + have hy3C2 := vertex_step_C2 ha3C2 ha3inc3 (Or.inl ha3color') + have hy1C2 : Sum.inl y1 ∈ C2 := by + have hm := p2.getVert_mem_support p2.length + rw [p2.getVert_length] at hm + apply (Set.ext_iff.mp hp2support' _).mp + simpa [y1] using hm + have ha1inc1 : Incident G y1 a1 := by unfold Incident; rw [ha1ends]; simp + have ha1inc2 : Incident G y2 a1 := by unfold Incident; rw [ha1ends]; simp + have ha1C2 := edge_step_C2 hy1C2 ha1inc1 (Or.inl ha1color') + have hy2C2 := vertex_step_C2 ha1C2 ha1inc2 (Or.inl ha1color') + have hrC2 : Sum.inr r ∈ C2 := by + rcases hrmiddle with h | h + · exact edge_step_C2 hy2C2 h (Or.inr hrcolor') + · exact edge_step_C2 hy3C2 h (Or.inr hrcolor') + have hwC2 := vertex_step_C2 hrC2 hrincw (Or.inr hrcolor') + have hra1 : r ≠ a1 := by + intro h + rw [h, ha1color] at hrcolor + exact hgamma_alpha (Option.some.inj hrcolor.symm) + have hra3 : r ≠ a3 := by + intro h + rw [h, ha3color] at hrcolor + exact hgamma_alpha (Option.some.inj hrcolor.symm) + let M10 : Finset (Sum V E) := + {Sum.inl y0, Sum.inl y1, Sum.inl y2, Sum.inl y3, Sum.inl y4, + Sum.inl w, Sum.inr q, Sum.inr a1, Sum.inr a3, Sum.inr r} + have hM10card : M10.card = 10 := by + simp [M10, hy01, hy02, hy03, hy04, hy12, hy13, hy14, hy23, hy24, + hy34, hqa1, hqa3, ha13ne, Ne.symm hw0, Ne.symm hw1, + Ne.symm hw2, Ne.symm hw3, Ne.symm hw4, Ne.symm hrq, Ne.symm hra1, + Ne.symm hra3] + have hM10sub := @helper_hM10sub_738 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@r) (@w) (@p2) (@hC2root) + (@support_of_C2) (@hqC2) (@hy4C2) (@ha3C2) (@hy3C2) (@hy1C2) (@ha1C2) (@hy2C2) (@hrC2) (@hwC2) + have hp2lower : 9 ≤ p2.length := by + have hc := Finset.card_le_card hM10sub + rw [hM10card, List.toFinset_card_of_nodup hp2.support_nodup, + p2.length_support] at hc + omega + rcases hp2div with ⟨d, hd⟩ + omega + +private theorem helper_caseContinuation_3777.{u_1, u_2} : + helperCaseContinuation3777Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hGheight gamma hgamma g v hgcolor _ r w hrcolor hrends + y0 y1 y2 y3 y4 r1 r2 r3 a1 a2 a3 q hy01 hy02 hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 + ha1ends ha2ends ha3ends hqends hproper missing_excludes ha1color ha12ne ha2color ha23ne + ha3color ha3qne hqcolor halpha_beta hv0' hv1' hv2' hv3' hv4' hgends' p1 hp1 hp1div hp1bound + C1 hC1root support_of_C1 edge_step_C1 vertex_step_C1 hqinc0 hqinc4 hqC1 hy4C1 hy1C1 helem + hy0T hy1T + have hgamma_not_missing_y1 : gamma ∉ MissingColors G phi y1 := by + intro hm + have hd := helem hy0T hy1T hy01 + exact (Finset.disjoint_left.mp hd) (by simpa [y0] using hgamma) hm + have hgamma_present_y1 : gamma ∈ PresentColors G phi y1 := by + simpa [MissingColors] using hgamma_not_missing_y1 + obtain ⟨b, hbinc, hbcolor⟩ : ∃ b : E, + Incident G y1 b ∧ phi b = some gamma := by + simpa [PresentColors] using hgamma_present_y1 + have hbC1 : Sum.inr b ∈ C1 := + edge_step_C1 hy1C1 hbinc (Or.inl hbcolor) + have hqa1 := @helper_hqa1_406 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@hy14) (@hy24) (@ha1ends) (@hqends) + have hqa2 := @helper_hqa2_413 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@hy24) (@hy34) (@ha2ends) (@hqends) + have hqa3 : q ≠ a3 := ha3qne.symm + have ha13ne : a1 ≠ a3 := by + intro h + exact (show r1 ≠ r3 by simp [r1, r3]) + (T.edge_injective (by simpa [a1, a3] using h)) + have hgamma_alpha := @helper_hgamma_alpha_2298 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@g) (@v) (@hgcolor) (@hy01) + (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) (@ha1ends) (@ha2ends) + (@ha3ends) (@ha1color) (@ha12ne) (@ha2color) (@ha23ne) (@ha3color) (@hv0') (@hv1') (@hv2') + (@hv3') (@hv4') (@hgends') (@p1) (@hp1) (@hp1div) (@hp1bound) (@hC1root) (@support_of_C1) + (@edge_step_C1) (@vertex_step_C1) (@hqC1) (@hy4C1) (@hy1C1) (@hqa1) (@hqa2) (@hqa3) (@ha13ne) + have hgamma_beta : gamma ≠ N.beta := by + intro h + exact (missing_excludes (by simpa [y1] using N.beta_missing) hbinc) + (by simpa [h] using hbcolor) + have hrends' : G.ends r = s(y2, w) ∨ G.ends r = s(y3, w) := by + simpa [y2, y3] using hrends + change w = y0 ∨ w = y1 ∨ w = y2 ∨ w = y3 ∨ w = y4 + by_contra hwtrunk + push Not at hwtrunk + rcases hwtrunk with ⟨hw0, hw1, hw2, hw3, hw4⟩ + have ha2inc2 : Incident G y2 a2 := by unfold Incident; rw [ha2ends]; simp + have ha2inc3 : Incident G y3 a2 := by unfold Incident; rw [ha2ends]; simp + have hrincw : Incident G w r := by + rcases hrends' with h | h <;> unfold Incident <;> rw [h] <;> simp + have hrmiddle := @helper_hrmiddle_523 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@r) (@w) (@hrends') + have hbq : b ≠ q := by + intro h + rw [h, hqcolor] at hbcolor + exact hgamma_beta (Option.some.inj hbcolor.symm) + have hba2 : b ≠ a2 := by + intro h + rw [h, ha2color] at hbcolor + exact hgamma_beta (Option.some.inj hbcolor.symm) + have hrq : r ≠ q := by + intro h + rw [h, hqcolor] at hrcolor + exact hgamma_beta (Option.some.inj hrcolor.symm) + have hra2 : r ≠ a2 := by + intro h + rw [h, ha2color] at hrcolor + exact hgamma_beta (Option.some.inj hrcolor.symm) + have hbr := @helper_hbr_549 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@r) (@w) (@hy12) (@hy13) (@b) (@hbinc) (@hrends') (@hw1) + have middle_too_large := @helper_middle_too_large_2342 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@r) (@w) + (@hrcolor) (@hy01) (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) + (@ha2color) (@p1) (@hp1) (@hp1div) (@hp1bound) (@hC1root) (@support_of_C1) (@edge_step_C1) + (@hqC1) (@hy4C1) (@hy1C1) (@b) (@hbC1) (@hqa2) (@hw0) (@hw1) (@hw2) (@hw3) (@hw4) (@ha2inc2) + (@hrmiddle) (@hbq) (@hba2) (@hrq) (@hra2) (@hbr) + have hy2notC1 := @helper_hy2notC1_600 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@r) (@w) (@hrcolor) (@ha2color) + (@edge_step_C1) (@vertex_step_C1) (@ha2inc2) (@ha2inc3) (@hrincw) (@hrmiddle) + (@middle_too_large) + have hy3notC1 : Sum.inl y3 ∉ C1 := by + intro hy3C + have ha2C := edge_step_C1 hy3C ha2inc3 (Or.inr ha2color) + exact hy2notC1 (vertex_step_C1 ha2C ha2inc2 (Or.inr ha2color)) + have hwnotC1 := @helper_hwnotC1_614 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@r) (@w) (@hrcolor) (@edge_step_C1) + (@vertex_step_C1) (@hrincw) (@hrmiddle) (@hy2notC1) (@hy3notC1) + have hrnotC1 : Sum.inr r ∉ C1 := by + intro hrC + rcases hrmiddle with h | h + · exact hy2notC1 (vertex_step_C1 hrC h (Or.inl hrcolor)) + · exact hy3notC1 (vertex_step_C1 hrC h (Or.inl hrcolor)) + have hfixed : FixedPairMaximalTashkinovTree G e0 phi T := + ScheideGlobalMaximumFixedPairMaximal G k e0 phi T N.global + let i0 : Fin (T.length + 1) := ⟨0, by omega⟩ + let i1 : Fin (T.length + 1) := ⟨1, by have := N.height_upper; omega⟩ + obtain ⟨_, pmax, hpmax, hpmaxsupport, hpmaxdiv, hpmaxvertices, hchange⟩ := + ScheideMaximalKempePath G k e0 phi T T N.global.1 hfixed N.global.2.1 + i0 i1 (by simp [i0, i1]) gamma N.beta + (by simpa [i0] using hgamma) (by simpa [i1] using N.beta_missing) + have hunused : TreeColorUnusedThrough phi T gamma i1 := by + intro j hjpos hjlt + simp [i1] at hjlt + omega + have hchangedata := hchange hunused + let phi' := TwoColorComponentSwap G phi gamma N.beta (Sum.inl y0) + have hproper' : IsProperEdgeColoring G phi' := by + simpa [phi', y0, i0] using hchangedata.1 + have hone' : IsOneEdgeUncolored phi' e0 := by + simpa [phi', y0, i0] using hchangedata.2.1 + exact @helper_caseContinuation_3625 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@v) (by + assumption) (@r) (@w) (@hrcolor) (@hy01) (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) (@hy14) + (@hy23) (@hy24) (@hy34) (@ha1ends) (@ha3ends) (@hproper) (@ha1color) (@ha3color) + (@hqcolor) (@halpha_beta) (@p1) (@hqinc0) (@hqinc4) (@hqC1) (@hy1C1) (@hqa1) (@hqa3) + (@ha13ne) (@hgamma_alpha) (@hgamma_beta) (@hw0) (@hw1) (@hw2) (@hw3) (@hw4) (@hrincw) + (@hrmiddle) (@hrq) (@hrnotC1) (@pmax) (@hchangedata) (@hproper') (@hone') + +private theorem helper_caseContinuation_4022.{u_1, u_2} : + helperCaseContinuation4022Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hGheight gamma hgamma g v hgcolor hgends _ hv0 hv1 hv2 + hv3 hv4 _ _ helem hy0T hy1T r w hrcolor hrends y0 y1 y2 y3 y4 r1 r2 r3 a1 a2 a3 q hy01 hy02 + hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 ha1ends ha2ends ha3ends hqends hproper + missing_excludes edge_color_of_closing_support ha1support ha2support ha3support + have hqsupport : Sum.inr q ∈ N.closingPath.support := by + exact (N.closingPath_edges q).2 (Or.inl rfl) + have ha1color := @helper_ha1color_275 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@ha1ends) (@missing_excludes) + (@edge_color_of_closing_support) (@ha1support) + have ha1a2 := @helper_ha1a2_285 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@ha1ends) (@ha2ends) + have ha12ne : a1 ≠ a2 := by + intro h + exact (show r1 ≠ r2 by simp [r1, r2]) + (T.edge_injective (by simpa [a1, a2] using h)) + have ha2color : phi a2 = some N.beta := by + rcases edge_color_of_closing_support a2 ha2support with h | h + · exact False.elim ((hproper ha12ne ha1a2 ha1color) h) + · exact h + have ha2a3 := @helper_ha2a3_299 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@ha2ends) (@ha3ends) + have ha23ne : a2 ≠ a3 := by + intro h + exact (show r2 ≠ r3 by simp [r2, r3]) + (T.edge_injective (by simpa [a2, a3] using h)) + have ha3color : phi a3 = some N.alpha := by + rcases edge_color_of_closing_support a3 ha3support with h | h + · exact h + · exact False.elim ((hproper ha23ne ha2a3 ha2color) h) + have ha3q := @helper_ha3q_313 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@ha3ends) (@hqends) + have ha3qne := @helper_ha3qne_319 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@hy03) (@hy34) (@ha3ends) (@hqends) + have hqcolor : phi q = some N.beta := by + rcases edge_color_of_closing_support q hqsupport with h | h + · exact False.elim ((hproper ha3qne ha3q ha3color) h) + · exact h + have halpha_beta := @helper_halpha_beta_330 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@ha1ends) (@missing_excludes) (@ha1color) + have hv0' : v ≠ y0 := by simpa [y0] using hv0 + have hv1' : v ≠ y1 := by simpa [y1] using hv1 + have hv2' : v ≠ y2 := by simpa [y2] using hv2 + have hv3' : v ≠ y3 := by simpa [y3] using hv3 + have hv4' : v ≠ y4 := by simpa [y4] using hv4 + have hgends' : G.ends g = s(y0, v) ∨ G.ends g = s(y1, v) ∨ + G.ends g = s(y2, v) ∨ G.ends g = s(y3, v) ∨ + G.ends g = s(y4, v) := by + simpa [y0, y1, y2, y3, y4] using hgends + obtain ⟨p1, hp1, hp1support, hp1div, hp1vertices, hp1bound⟩ := + ScheideKempePathHeightBound G k e0 phi T N.global gamma N.beta + hgamma N.beta_missing + have hp1bound' : p1.length / 2 + 1 ≤ 5 := by + simpa [hGheight] using hp1bound + let H1 := TwoColorIncidenceGraph G phi gamma N.beta + let C1 := TwoColorComponent G phi gamma N.beta (Sum.inl y0) + have hp1support' : {z | z ∈ p1.support} = C1 := by + simpa [C1, y0] using hp1support + have hC1root : Sum.inl y0 ∈ C1 := by + change H1.connectedComponentMk (Sum.inl y0) = + H1.connectedComponentMk (Sum.inl y0) + rfl + have C1_of_adj {x z : Sum V E} (hx : x ∈ C1) (hxz : H1.Adj x z) : z ∈ C1 := by + change H1.connectedComponentMk x = H1.connectedComponentMk (Sum.inl y0) at hx + change H1.connectedComponentMk z = H1.connectedComponentMk (Sum.inl y0) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hxz).symm.trans hx + have support_of_C1 {z : Sum V E} (hz : z ∈ C1) : z ∈ p1.support := by + exact (Set.ext_iff.mp hp1support' z).mpr hz + have edge_step_C1 {x : V} {f : E} (hx : Sum.inl x ∈ C1) + (hxf : Incident G x f) + (hfc : phi f = some gamma ∨ phi f = some N.beta) : + Sum.inr f ∈ C1 := by + apply C1_of_adj hx + simpa [H1, TwoColorIncidenceGraph] using And.intro hxf hfc + have vertex_step_C1 {f : E} {x : V} (hf : Sum.inr f ∈ C1) + (hxf : Incident G x f) + (hfc : phi f = some gamma ∨ phi f = some N.beta) : + Sum.inl x ∈ C1 := by + apply C1_of_adj hf + simpa [H1, TwoColorIncidenceGraph] using And.intro hxf hfc + have hqinc0 : Incident G y0 q := by unfold Incident; rw [hqends]; simp + have hqinc4 : Incident G y4 q := by unfold Incident; rw [hqends]; simp + have hqC1 : Sum.inr q ∈ C1 := + edge_step_C1 hC1root hqinc0 (Or.inr hqcolor) + have hy4C1 : Sum.inl y4 ∈ C1 := + vertex_step_C1 hqC1 hqinc4 (Or.inr hqcolor) + have hy1C1 : Sum.inl y1 ∈ C1 := by + have hm := p1.getVert_mem_support p1.length + rw [p1.getVert_length] at hm + apply (Set.ext_iff.mp hp1support' _).mp + simpa [y1] using hm + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := + (ScheideGlobalMaximumOrder G k e0 phi T N.global).2.2.2.1 + have hy0T : y0 ∈ TreeSequenceVertexSet T := by + simp [y0, TreeSequenceVertexSet] + have hy1T : y1 ∈ TreeSequenceVertexSet T := by + simp [y1, TreeSequenceVertexSet] + exact @helper_caseContinuation_3777 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@hgamma) (@g) (@v) (@hgcolor) + (by + assumption) (@r) (@w) (@hrcolor) (@hrends) (@hy01) (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) + (@hy14) (@hy23) (@hy24) (@hy34) (@ha1ends) (@ha2ends) (@ha3ends) (@hqends) (@hproper) + (@missing_excludes) (@ha1color) (@ha12ne) (@ha2color) (@ha23ne) (@ha3color) (@ha3qne) + (@hqcolor) (@halpha_beta) (@hv0') (@hv1') (@hv2') (@hv3') (@hv4') (@hgends') (@p1) (@hp1) + (@hp1div) (@hp1bound) (@hC1root) (@support_of_C1) (@edge_step_C1) (@vertex_step_C1) + (@hqinc0) (@hqinc4) (@hqC1) (@hy4C1) (@hy1C1) (@helem) (@hy0T) (@hy1T) + +theorem ScheideHeightFiveGammaEdges {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hNheight : N.height = 5) (hGheight : ScheideGraphHeight G = 5) + (gamma : Fin k) + (hgamma : gamma ∈ MissingColors G phi + (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + (g : E) (v : V) (hgcolor : phi g = some gamma) + (hgends : + G.ends g = s(T.vertex ⟨0, by have := N.height_upper; omega⟩, v) ∨ + G.ends g = s(T.vertex ⟨1, by have := N.height_upper; omega⟩, v) ∨ + G.ends g = s(T.vertex ⟨2, by have := N.height_upper; omega⟩, v) ∨ + G.ends g = s(T.vertex ⟨3, by have := N.height_upper; omega⟩, v) ∨ + G.ends g = s(T.vertex ⟨4, by have := N.height_upper; omega⟩, v)) + (_ : v ∈ TreeSequenceVertexSet T) + (hv0 : v ≠ T.vertex ⟨0, by have := N.height_upper; omega⟩) + (hv1 : v ≠ T.vertex ⟨1, by have := N.height_upper; omega⟩) + (hv2 : v ≠ T.vertex ⟨2, by have := N.height_upper; omega⟩) + (hv3 : v ≠ T.vertex ⟨3, by have := N.height_upper; omega⟩) + (hv4 : v ≠ T.vertex ⟨4, by have := N.height_upper; omega⟩) : + ∃ (f1 f2 f3 : E) (v1 v2 : V), + G.ends f1 = s(T.vertex ⟨1, by have := N.height_upper; omega⟩, v1) ∧ + G.ends f2 = s(T.vertex ⟨4, by have := N.height_upper; omega⟩, v2) ∧ + G.ends f3 = s(T.vertex ⟨2, by have := N.height_upper; omega⟩, + T.vertex ⟨3, by have := N.height_upper; omega⟩) ∧ + phi f1 = some gamma ∧ phi f2 = some gamma ∧ + phi f3 = some gamma ∧ + v1 ∈ TreeSequenceVertexSet T ∧ v2 ∈ TreeSequenceVertexSet T ∧ + v1 ≠ T.vertex ⟨0, by have := N.height_upper; omega⟩ ∧ + v1 ≠ T.vertex ⟨1, by have := N.height_upper; omega⟩ ∧ + v1 ≠ T.vertex ⟨2, by have := N.height_upper; omega⟩ ∧ + v1 ≠ T.vertex ⟨3, by have := N.height_upper; omega⟩ ∧ + v1 ≠ T.vertex ⟨4, by have := N.height_upper; omega⟩ ∧ + v2 ≠ T.vertex ⟨0, by have := N.height_upper; omega⟩ ∧ + v2 ≠ T.vertex ⟨1, by have := N.height_upper; omega⟩ ∧ + v2 ≠ T.vertex ⟨2, by have := N.height_upper; omega⟩ ∧ + v2 ≠ T.vertex ⟨3, by have := N.height_upper; omega⟩ ∧ + v2 ≠ T.vertex ⟨4, by have := N.height_upper; omega⟩ := by + classical + let y0 : V := T.vertex ⟨0, by have := N.height_upper; omega⟩ + let y1 : V := T.vertex ⟨1, by have := N.height_upper; omega⟩ + let y2 : V := T.vertex ⟨2, by have := N.height_upper; omega⟩ + let y3 : V := T.vertex ⟨3, by have := N.height_upper; omega⟩ + let y4 : V := T.vertex ⟨4, by have := N.height_upper; omega⟩ + have hy01 : y0 ≠ y1 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy02 : y0 ≠ y2 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy03 : y0 ≠ y3 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy04 : y0 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have horder := ScheideGlobalMaximumOrder G k e0 phi T N.global + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := + horder.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + horder.2.2.2.2 + have hy0T : y0 ∈ TreeSequenceVertexSet T := by + simp [y0, TreeSequenceVertexSet] + have hy1T : y1 ∈ TreeSequenceVertexSet T := by + simp [y1, TreeSequenceVertexSet] + have hy2T : y2 ∈ TreeSequenceVertexSet T := by + simp [y2, TreeSequenceVertexSet] + have hy3T : y3 ∈ TreeSequenceVertexSet T := by + simp [y3, TreeSequenceVertexSet] + have hy4T : y4 ∈ TreeSequenceVertexSet T := by + simp [y4, TreeSequenceVertexSet] + have hgamma0 : gamma ∈ MissingColors G phi y0 := by + simpa [y0] using hgamma + have gamma_present := @helper_gamma_present_127 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@helem) (@hy0T) + (@hgamma0) + obtain ⟨f1, hf1inc, hf1color⟩ : ∃ f1 : E, + Incident G y1 f1 ∧ phi f1 = some gamma := by + simpa [PresentColors] using gamma_present hy1T hy01.symm + obtain ⟨f2, hf2inc, hf2color⟩ : ∃ f2 : E, + Incident G y2 f2 ∧ phi f2 = some gamma := by + simpa [PresentColors] using gamma_present hy2T hy02.symm + obtain ⟨f3, hf3inc, hf3color⟩ : ∃ f3 : E, + Incident G y3 f3 ∧ phi f3 = some gamma := by + simpa [PresentColors] using gamma_present hy3T hy03.symm + obtain ⟨f4, hf4inc, hf4color⟩ : ∃ f4 : E, + Incident G y4 f4 ∧ phi f4 = some gamma := by + simpa [PresentColors] using gamma_present hy4T hy04.symm + obtain ⟨z1, hf1ends⟩ := Sym2.mem_iff_exists.mp hf1inc + obtain ⟨z2, hf2ends⟩ := Sym2.mem_iff_exists.mp hf2inc + obtain ⟨z3, hf3ends⟩ := Sym2.mem_iff_exists.mp hf3inc + obtain ⟨z4, hf4ends⟩ := Sym2.mem_iff_exists.mp hf4inc + have middle_no_escape (r : E) (w : V) + (hrcolor : phi r = some gamma) + (hrends : + G.ends r = s(T.vertex ⟨2, by have := N.height_upper; omega⟩, w) ∨ + G.ends r = s(T.vertex ⟨3, by have := N.height_upper; omega⟩, w)) : + w = T.vertex ⟨0, by have := N.height_upper; omega⟩ ∨ + w = T.vertex ⟨1, by have := N.height_upper; omega⟩ ∨ + w = T.vertex ⟨2, by have := N.height_upper; omega⟩ ∨ + w = T.vertex ⟨3, by have := N.height_upper; omega⟩ ∨ + w = T.vertex ⟨4, by have := N.height_upper; omega⟩ := by + classical + let y0 : V := T.vertex ⟨0, by have := N.height_upper; omega⟩ + let y1 : V := T.vertex ⟨1, by have := N.height_upper; omega⟩ + let y2 : V := T.vertex ⟨2, by have := N.height_upper; omega⟩ + let y3 : V := T.vertex ⟨3, by have := N.height_upper; omega⟩ + let y4 : V := T.vertex ⟨4, by have := N.height_upper; omega⟩ + let r1 : Fin T.length := ⟨1, by have := N.height_upper; omega⟩ + let r2 : Fin T.length := ⟨2, by have := N.height_upper; omega⟩ + let r3 : Fin T.length := ⟨3, by have := N.height_upper; omega⟩ + let a1 : E := T.edge r1 + let a2 : E := T.edge r2 + let a3 : E := T.edge r3 + let q : E := N.closingEdge + have hy01 : y0 ≠ y1 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy02 : y0 ≠ y2 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy03 : y0 ≠ y3 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy04 : y0 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy12 : y1 ≠ y2 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy13 : y1 ≠ y3 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy14 : y1 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy23 : y2 ≠ y3 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy24 : y2 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy34 : y3 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have ha1ends : G.ends a1 = s(y1, y2) := by + simpa [a1, r1, y1, y2, hNheight] using N.trunk_edge_ends r1 (by simp [r1]) + (by simp [r1, hNheight]) + have ha2ends : G.ends a2 = s(y2, y3) := by + simpa [a2, r2, y2, y3, hNheight] using N.trunk_edge_ends r2 (by simp [r2]) + (by simp [r2, hNheight]) + have ha3ends : G.ends a3 = s(y3, y4) := by + simpa [a3, r3, y3, y4, hNheight] using N.trunk_edge_ends r3 (by simp [r3]) + (by simp [r3, hNheight]) + have hqends := @helper_hqends_222 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) + have hproper : IsProperEdgeColoring G phi := N.global.1.2.2.2.1 + have missing_excludes := @helper_missing_excludes_231 (@V) (@E) inferInstance inferInstance (@G) + (@k) (@phi) + have edge_color_of_closing_support (f : E) + (hf : Sum.inr f ∈ N.closingPath.support) : + phi f = some N.alpha ∨ phi f = some N.beta := by + exact @helper_edge_color_of_closing_support_241 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@v) (by + assumption) (@f) (@hf) + have ha1support : Sum.inr a1 ∈ N.closingPath.support := by + apply (N.closingPath_edges a1).2 + exact Or.inr ⟨r1, by simp [r1], by simp [r1, hNheight], rfl⟩ + have ha2support : Sum.inr a2 ∈ N.closingPath.support := by + apply (N.closingPath_edges a2).2 + exact Or.inr ⟨r2, by simp [r2], by simp [r2, hNheight], rfl⟩ + have ha3support : Sum.inr a3 ∈ N.closingPath.support := by + apply (N.closingPath_edges a3).2 + exact Or.inr ⟨r3, by simp [r3], by simp [r3, hNheight], rfl⟩ + exact @helper_caseContinuation_4022 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@hgamma) (@g) (@v) + (@hgcolor) (@hgends) (by + assumption) (@hv0) (@hv1) (@hv2) (@hv3) (@hv4) (@helem) (@hy0T) (@hy1T) (@r) (@w) + (@hrcolor) (@hrends) (@hy01) (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) + (@hy24) (@hy34) (@ha1ends) (@ha2ends) (@ha3ends) (@hqends) (@hproper) + (@missing_excludes) (@edge_color_of_closing_support) (@ha1support) (@ha2support) + (@ha3support) + exact @helper_continuation_3161 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@g) (@v) (@hgcolor) (@hgends) (by + assumption) (@hv1) (@hv2) (@hv3) (@hv4) (@hclosed) (@hy0T) (@hy1T) (@hy4T) (@hgamma0) (@f1) + (@hf1inc) (@hf1color) (@f2) (@hf2inc) (@hf2color) (@f3) (@hf3inc) (@hf3color) (@f4) + (@hf4inc) (@hf4color) (@z1) (@hf1ends) (@z2) (@hf2ends) (@z3) (@hf3ends) (@z4) (@hf4ends) + (@middle_no_escape) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean b/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean new file mode 100644 index 0000000000..c015482f0a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean @@ -0,0 +1,2530 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound +public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +public import LeanPool.GoldbergSeymour.TashkinovOrderBound + +/-! +# Scheide Height Five Outside Links + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private abbrev helperContinuation1992Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)), ScheideGraphHeight G = (5 : ℕ) → + ∀ gamma ∈ MissingColors G phi (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + + (1 : ℕ)))), + ∀ (f1 f2 : E) (v1 v2 : V), phi f1 = some gamma → phi f2 = some gamma → v2 ∈ + TreeSequenceVertexSet T → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; y0 ≠ y1 → y0 ≠ y2 → y0 ≠ y3 → y0 ≠ y4 → y1 ≠ y2 → y1 ≠ y3 → y1 ≠ + y4 → y2 ≠ y3 → y2 ≠ y4 → y3 ≠ y4 → G.ends a1 = s(y1, y2) → G.ends a2 = s(y2, y3) → G.ends + a3 = s(y3, y4) → G.ends q = s(y4, y0) → IsProperEdgeColoring G phi → ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G phi v → Incident G v f → phi f ≠ some c) → + phi a1 = some N.alpha → a1 ≠ a2 → phi a2 = some N.beta → a2 ≠ a3 → phi a3 = some N.alpha → + phi q = some N.beta → gamma ≠ N.beta → G.ends f1 = s(y1, v1) → G.ends f2 = s(y4, v2) → v1 + ≠ y0 → v1 ≠ y1 → v1 ≠ y2 → v1 ≠ y3 → v1 ≠ y4 → v2 ≠ y0 → v2 ≠ y1 → v2 ≠ y2 → v2 ≠ y3 → v2 + ≠ y4 → f1 ≠ f2 → v1 ≠ v2 → q ≠ f1 → q ≠ f2 → + ∀ (p1 : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), p1.IsPath → (4 : ℕ) ∣ + p1.length → p1.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G → + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma N.beta; + let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); + {z : V ⊕ E | z ∈ p1.support} = C1 → Sum.inl y0 ∈ C1 → + ∃ (alphaEdge : E) (betaEdge : E), G.ends alphaEdge = s(v1, v2) ∧ phi alphaEdge = some N.alpha + ∧ G.ends betaEdge = s(v1, v2) ∧ phi betaEdge = some N.beta ∧ alphaEdge ≠ betaEdge + +private abbrev helperContinuation2397Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)), ScheideGraphHeight G = (5 : ℕ) → + ∀ (gamma : Fin k) (f1 f2 : E) (v1 v2 : V), v2 ∈ TreeSequenceVertexSet T → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; G.ends q = s(y4, y0) → G.ends f1 = s(y1, v1) → v2 ≠ y0 → v2 ≠ y1 → + v2 ≠ y4 → + ∀ (p1 : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let K8 : Finset (V ⊕ E) := (insert (Sum.inl y0) (insert (Sum.inl y1) (insert (Sum.inl y4) + (insert (Sum.inl v1) (insert (Sum.inl v2) (insert (Sum.inr q) (insert (Sum.inr f1) + ({Sum.inr f2} : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : + Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)); K8.card = (8 : ℕ) → + ∀ (iv2 : ℕ) (b : E), Incident G v2 f2 → phi b = some N.beta → + ∀ (w : V), G.ends b = s(v1, v2) → + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + have this : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))); N.alpha ≠ N.beta → + ∀ (pmax : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))), + let C0 : Set (V ⊕ E) := TwoColorComponent G phi N.alpha N.beta (Sum.inl y0); + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi N.alpha N.beta; ( + ∀ {x z : V ⊕ E}, x ∈ C0 → H0.Adj x z → z ∈ C0) → + ∀ (p0 : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), Sum.inl v1 ∉ C0 → gamma ≠ + N.alpha → + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + IsProperEdgeColoring G phi' → phi' f1 = some gamma → phi' f2 = some gamma → phi' q = some + N.alpha → N.alpha ∈ MissingColors G phi' y1 → ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G phi' v → Incident G v f → phi' f ≠ some c) + → + ∀ (p2 : (TwoColorIncidenceGraph G phi' gamma N.alpha).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), p2.IsPath → (4 : ℕ) ∣ + p2.length → p2.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G → + let H2 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi' gamma N.alpha; + let C2 : Set (V ⊕ E) := TwoColorComponent G phi' gamma N.alpha (Sum.inl y0); + {z : V ⊕ E | z ∈ p2.support} = C2 → ( + ∀ {x z : V ⊕ E}, x ∈ C2 → H2.Adj x z → z ∈ C2) → ( + ∀ {z : V ⊕ E}, z ∈ C2 → z ∈ p2.support) → Sum.inl y0 ∈ p2.support → Sum.inr q ∈ p2.support → + Sum.inl y4 ∈ p2.support → Sum.inr f2 ∈ p2.support → Sum.inl v2 ∈ p2.support → + ∃ (alphaEdge : E) (betaEdge : E), G.ends alphaEdge = s(v1, v2) ∧ phi alphaEdge = some N.alpha + ∧ G.ends betaEdge = s(v1, v2) ∧ phi betaEdge = some N.beta ∧ alphaEdge ≠ betaEdge + +private abbrev helperContinuation2127Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)), ScheideGraphHeight G = (5 : ℕ) → + ∀ gamma ∈ MissingColors G phi (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + + (1 : ℕ)))), + ∀ (f1 f2 : E) (v1 v2 : V), phi f1 = some gamma → phi f2 = some gamma → v2 ∈ + TreeSequenceVertexSet T → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; y0 ≠ y1 → y0 ≠ y2 → y0 ≠ y3 → y0 ≠ y4 → y1 ≠ y2 → y1 ≠ y3 → y1 ≠ + y4 → y2 ≠ y3 → y2 ≠ y4 → y3 ≠ y4 → G.ends a1 = s(y1, y2) → G.ends a2 = s(y2, y3) → G.ends + a3 = s(y3, y4) → G.ends q = s(y4, y0) → ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G phi v → Incident G v f → phi f ≠ some c) → + phi a1 = some N.alpha → a1 ≠ a2 → phi a2 = some N.beta → a2 ≠ a3 → phi a3 = some N.alpha → + phi q = some N.beta → gamma ≠ N.beta → G.ends f1 = s(y1, v1) → G.ends f2 = s(y4, v2) → v1 + ≠ y0 → v1 ≠ y1 → v1 ≠ y2 → v1 ≠ y3 → v1 ≠ y4 → v2 ≠ y0 → v2 ≠ y1 → v2 ≠ y2 → v2 ≠ y3 → v2 + ≠ y4 → + ∀ (p1 : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let K8 : Finset (V ⊕ E) := (insert (Sum.inl y0) (insert (Sum.inl y1) (insert (Sum.inl y4) + (insert (Sum.inl v1) (insert (Sum.inl v2) (insert (Sum.inr q) (insert (Sum.inr f1) + ({Sum.inr f2} : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : + Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)); K8.card = (8 : ℕ) → + ∀ (iv2 : ℕ) (b : E), Incident G v2 f2 → phi b = some N.beta → + ∀ (w : V), G.ends b = s(v1, v2) → + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); N.alpha ≠ N.beta → + ∀ (pmax : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))), {z : V ⊕ E | z ∈ pmax.support} = TwoColorComponent G phi N.alpha N.beta + (Sum.inl (T.vertex i0)) → IsProperEdgeColoring G (TwoColorComponentSwap G phi N.alpha + N.beta (Sum.inl (T.vertex i0))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi N.alpha + N.beta (Sum.inl (T.vertex i0))) e0 ∧ TashkinovTree G e0 (TwoColorComponentSwap G phi + N.alpha N.beta (Sum.inl (T.vertex i0))) T → + ∃ (alphaEdge : E) (betaEdge : E), G.ends alphaEdge = s(v1, v2) ∧ phi alphaEdge = some N.alpha + ∧ G.ends betaEdge = s(v1, v2) ∧ phi betaEdge = some N.beta ∧ alphaEdge ≠ betaEdge + +private theorem helper_hqends_137.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; G.ends q = s(y4, y0) := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y4 q + have hlast : N.lastIndex = ⟨4, by have := N.height_upper; omega⟩ := by + apply Fin.ext + have := N.lastIndex_height + simp + rw [hNheight] at this + omega + simpa [q, y0, y4, hlast] using N.closing_ends + +private theorem helper_missing_excludes_146.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k) {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G phi v → + Incident G v f → phi f ≠ some c := by + classical + intro V E _ _ G k phi c v f hc hinc hfc + let _ := Fintype.ofFinite V + have hp : c ∈ PresentColors G phi v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hinc, hfc⟩ + have hn : c ∉ PresentColors G phi v := by + simpa [MissingColors] using hc + exact hn hp + +private theorem helper_edge_color_of_closing_support_156.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (f : E), + Sum.inr f ∈ N.closingPath.support → + phi f = some N.alpha ∨ phi f = some N.beta := by + classical + intro V E _ _ _ G k e0 phi T N f hf + obtain ⟨i, hi, hile⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hilt : i < N.closingPath.length := by + by_contra hn + have hil : N.closingPath.length ≤ i := by omega + have hend := N.closingPath.getVert_of_length_le (i := i) hil + rw [hi] at hend + simp at hend + have hadj := N.closingPath.adj_getVert_succ hilt + rw [hi] at hadj + cases hz : N.closingPath.getVert (i + 1) with + | inl v => + rw [hz] at hadj + have hdata : Incident G v f ∧ + (phi f = some N.alpha ∨ phi f = some N.beta) := by + simpa [TwoColorIncidenceGraph] using hadj + exact hdata.2 + | inr e => + rw [hz] at hadj + simp [TwoColorIncidenceGraph] at hadj + +private theorem helper_ha1color_190.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; G.ends a1 = s(y1, y2) → ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G phi v → Incident G v f → phi f ≠ some c) → + ( + ∀ (f : E), Sum.inr f ∈ N.closingPath.support → phi f = some N.alpha ∨ phi f = some N.beta) → + Sum.inr a1 ∈ N.closingPath.support → phi a1 = some N.alpha := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y1 y2 r1 a1 ha1ends missing_excludes + edge_color_of_closing_support ha1support + rcases edge_color_of_closing_support a1 ha1support with h | h + · exact h + · have hbmiss : N.beta ∈ MissingColors G phi y1 := by + simpa [y1] using N.beta_missing + have hinc : Incident G y1 a1 := by + unfold Incident + rw [ha1ends] + simp [Sym2.mem_iff] + exact False.elim ((missing_excludes hbmiss hinc) h) + +private theorem helper_ha1a2_200.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; G.ends a1 = s(y1, y2) → G.ends a2 = s(y2, y3) → AdjacentEdges G a1 a2 + := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y1 y2 y3 r1 r2 a1 a2 ha1ends ha2ends + refine ⟨y2, ?_, ?_⟩ <;> unfold Incident + · rw [ha1ends] + simp [Sym2.mem_iff] + · rw [ha2ends] + simp [Sym2.mem_iff] + +private theorem helper_ha2a3_213.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; G.ends a2 = s(y2, y3) → G.ends a3 = s(y3, y4) → AdjacentEdges G a2 a3 + := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y2 y3 y4 r2 r3 a2 a3 ha2ends ha3ends + refine ⟨y3, ?_, ?_⟩ <;> unfold Incident + · rw [ha2ends] + simp [Sym2.mem_iff] + · rw [ha3ends] + simp [Sym2.mem_iff] + +private theorem helper_ha3q_226.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a3 : E := T.edge r3; + let q : E := N.closingEdge; G.ends a3 = s(y3, y4) → G.ends q = s(y4, y0) → AdjacentEdges G a3 + q := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y3 y4 r3 a3 q ha3ends hqends + refine ⟨y4, ?_, ?_⟩ <;> unfold Incident + · rw [ha3ends] + simp [Sym2.mem_iff] + · rw [hqends] + simp [Sym2.mem_iff] + +private theorem helper_ha3qne_232.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a3 : E := T.edge r3; + let q : E := N.closingEdge; y0 ≠ y3 → y3 ≠ y4 → G.ends a3 = s(y3, y4) → G.ends q = s(y4, y0) → + a3 ≠ q := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y3 y4 r3 a3 q hy03 hy34 ha3ends hqends h + have hpairs : s(y3, y4) = s(y4, y0) := by + rw [← ha3ends, h, hqends] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hy34 hd.1 + · exact hy03 hs.1.symm + +private theorem helper_hgamma_beta_243.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (f1 : E) (v1 : V), G.ends f1 = s(T.vertex (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))), v1) → phi f1 = some gamma → + let _ : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G phi v → Incident G v f → phi f ≠ some c) → + gamma ≠ N.beta := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma f1 v1 hf1ends hf1color y1 missing_excludes h + have hinc : Incident G y1 f1 := by + unfold Incident + rw [hf1ends] + simp [y1, Sym2.mem_iff] + exact (missing_excludes (by simpa [y1] using N.beta_missing) hinc) + (by simpa [h] using hf1color) + +private theorem helper_hf12ne_263.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (f1 f2 + : E) (v1 v2 : V), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); y1 ≠ y4 → G.ends f1 = s(y1, v1) → G.ends f2 = s(y4, v2) → v2 ≠ + y1 → f1 ≠ f2 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight f1 f2 v1 v2 y1 y4 hy14 hf1ends' hf2ends' hv21' h + have hpairs : s(y1, v1) = s(y4, v2) := by + rw [← hf1ends', h, hf2ends'] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hy14 hd.1 + · exact hv21' hs.1.symm + +private theorem helper_hv12ne_270.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (f1 f2 : E) (v1 v2 : V), phi f1 = some gamma → phi f2 = some gamma → + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); IsProperEdgeColoring G phi → G.ends f1 = s(y1, v1) → G.ends f2 + = s(y4, v2) → f1 ≠ f2 → v1 ≠ v2 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma f1 f2 v1 v2 hf1color hf2color y1 y4 hproper + hf1ends' hf2ends' hf12ne h + have hadj : AdjacentEdges G f1 f2 := by + refine ⟨v1, ?_, ?_⟩ <;> unfold Incident + · rw [hf1ends'] + simp [Sym2.mem_iff] + · rw [hf2ends', ← h] + simp [Sym2.mem_iff] + exact (hproper hf12ne hadj hf1color) hf2color + +private theorem helper_hK8sub_343.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)) (gamma : Fin k) (f1 f2 : E) (v1 v2 : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; + ∀ (p1 : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), Sum.inl y0 ∈ p1.support → + Sum.inr q ∈ p1.support → Sum.inl y4 ∈ p1.support → Sum.inr f2 ∈ p1.support → Sum.inl v2 ∈ + p1.support → Sum.inl y1 ∈ p1.support → Sum.inr f1 ∈ p1.support → Sum.inl v1 ∈ p1.support → + let K8 : Finset (V ⊕ E) := (insert (Sum.inl y0) (insert (Sum.inl y1) (insert (Sum.inl y4) + (insert (Sum.inl v1) (insert (Sum.inl v2) (insert (Sum.inr q) (insert (Sum.inr f1) + ({Sum.inr f2} : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : + Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)); K8 ⊆ + p1.support.toFinset := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight gamma f1 f2 v1 v2 y0 y1 y4 q p1 hy0p1 hqp1 hy4p1 + hf2p1 hv2p1 hy1p1 hf1p1 hv1p1 K8 z hz + simp only [K8, Finset.mem_insert, Finset.mem_singleton] at hz + rcases hz with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · simpa using hy0p1 + · simpa using hy1p1 + · simpa using hy4p1 + · simpa using hv1p1 + · simpa using hv2p1 + · simpa using hqp1 + · simpa using hf1p1 + · simpa using hf2p1 + +private theorem helper_hiv2lt_370.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (_ _ : E) (_ v2 : V), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); v2 ≠ y1 → + ∀ (p1 : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), (4 : ℕ) ∣ p1.length → + p1.length = (8 : ℕ) → + ∀ (iv2 : ℕ), p1.getVert iv2 = Sum.inl v2 → iv2 ≤ p1.length → iv2 < p1.length := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma f1 f2 v1 v2 y1 hv21' p1 hp1div hp1length iv2 hiv2 + hiv2le + by_contra h + have hil : p1.length ≤ iv2 := by omega + have hvend := p1.getVert_of_length_le hil + have hv : (Sum.inl v2 : Sum V E) = Sum.inl y1 := by + rw [hiv2] at hvend + simpa [y1] using hvend + exact hv21' (Sum.inl_injective hv) + +private theorem helper_hprevnext_387.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T), N.height = (5 : ℕ) → + ∀ (gamma : Fin k) (_ _ : E) (_ _ : V) (p1 : (TwoColorIncidenceGraph G phi gamma N.beta).Walk + (Sum.inl (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) + (Sum.inl (T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + p1.IsPath → (4 : ℕ) ∣ p1.length → p1.length = (8 : ℕ) → + ∀ iv2 ≤ p1.length, iv2 < p1.length → p1.getVert (iv2 - (1 : ℕ)) ≠ p1.getVert (iv2 + (1 : ℕ)) + := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma f1 f2 v1 v2 p1 hp1 hp1div hp1length iv2 hiv2le + hiv2lt h + have hi := hp1.getVert_injOn + (show iv2 - 1 ≤ p1.length by omega) + (show iv2 + 1 ≤ p1.length by omega) h + omega + +private theorem helper_branch_396.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (gamma : Fin k) (f2 : E) (v2 : V) (p1 : + (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma N.beta; + ∀ (iv2 : ℕ), H1.Adj (Sum.inl v2) (p1.getVert (iv2 + (1 : ℕ))) → p1.getVert (iv2 - (1 : ℕ)) ≠ + p1.getVert (iv2 + (1 : ℕ)) → p1.getVert (iv2 - (1 : ℕ)) = Sum.inr f2 → + ∃ (b : E), H1.Adj (Sum.inl v2) (Sum.inr b) ∧ Sum.inr b ∈ p1.support ∧ b ≠ f2 := by + classical + intro V E _ _ _ G k e0 phi T N gamma f2 v2 p1 H1 iv2 hnextAdj hprevnext hp + cases hn : p1.getVert (iv2 + 1) with + | inl w => + rw [hn] at hnextAdj + simp [H1, TwoColorIncidenceGraph] at hnextAdj + | inr b => + rw [hn] at hnextAdj + refine ⟨b, hnextAdj, ?_, ?_⟩ + · rw [← hn] + exact p1.getVert_mem_support (iv2 + 1) + · intro h + apply hprevnext + rw [hp, hn, h] + +private theorem helper_branch_408.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (gamma : Fin k) (f2 : E) (v2 : V) (p1 : + (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let H1 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma N.beta; + ∀ (iv2 : ℕ), H1.Adj (Sum.inl v2) (p1.getVert (iv2 - (1 : ℕ))) → ¬p1.getVert (iv2 - (1 : ℕ)) = + Sum.inr f2 → + ∃ (b : E), H1.Adj (Sum.inl v2) (Sum.inr b) ∧ Sum.inr b ∈ p1.support ∧ b ≠ f2 := by + classical + intro V E _ _ _ G k e0 phi T N gamma f2 v2 p1 H1 iv2 hprevAdj hp + cases hn : p1.getVert (iv2 - 1) with + | inl w => + rw [hn] at hprevAdj + simp [H1, TwoColorIncidenceGraph] at hprevAdj + | inr b => + rw [hn] at hprevAdj + refine ⟨b, hprevAdj, ?_, ?_⟩ + · rw [← hn] + exact p1.getVert_mem_support (iv2 - 1) + · intro h + exact hp (by rw [hn, h]) + +private theorem helper_hbq_431.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v2 : + V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; G.ends q = s(y4, y0) → v2 ≠ y0 → v2 ≠ y4 → + ∀ (b : E) (w : V), G.ends b = s(v2, w) → b ≠ q := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v2 y0 y4 q hqends hv20' hv24' b w hbends h + have hpairs : s(v2, w) = s(y4, y0) := by + rw [← hbends, h, hqends] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hv24' hd.1 + · exact hv20' hs.1 + +private theorem helper_hK9sub_447.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)) (gamma : Fin k) (f1 f2 : E) (v1 v2 : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; + ∀ (p1 : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let K8 : Finset (V ⊕ E) := (insert (Sum.inl y0) (insert (Sum.inl y1) (insert (Sum.inl y4) + (insert (Sum.inl v1) (insert (Sum.inl v2) (insert (Sum.inr q) (insert (Sum.inr f1) + ({Sum.inr f2} : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : + Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)); K8 ⊆ + p1.support.toFinset → + ∀ (b : E), Sum.inr b ∈ p1.support → + let K9 : Finset (V ⊕ E) := (insert (Sum.inr b) K8 : Finset (V ⊕ E)); K9 ⊆ p1.support.toFinset + := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight gamma f1 f2 v1 v2 y0 y1 y4 q p1 K8 hK8sub b hbp1 K9 z hz + simp only [K9, Finset.mem_insert] at hz + rcases hz with rfl | hz + · simpa using hbp1 + · exact hK8sub hz + +private theorem helper_hwy0_470.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v2 : + V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; G.ends q = s(y4, y0) → IsProperEdgeColoring G phi → phi q = some + N.beta → + ∀ (b : E), phi b = some N.beta → + ∀ (w : V), G.ends b = s(v2, w) → b ≠ q → w ≠ y0 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v2 y0 y4 q hqends hproper hqcolor b hbcolor w hbends hbq h + have hadj : AdjacentEdges G b q := ⟨y0, by + unfold Incident + rw [hbends, h] + simp [Sym2.mem_iff], by + unfold Incident + rw [hqends] + simp [Sym2.mem_iff]⟩ + exact (hproper hbq hadj hbcolor) hqcolor + +private theorem helper_hwy1_480.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v2 : + V), + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G phi v → Incident G v f → phi f ≠ some c) → + ∀ (b : E), phi b = some N.beta → + ∀ (w : V), G.ends b = s(v2, w) → w ≠ y1 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v2 y1 missing_excludes b hbcolor w hbends h + have hinc : Incident G y1 b := by + unfold Incident + rw [hbends, h] + simp [Sym2.mem_iff] + exact (missing_excludes (by simpa [y1] using N.beta_missing) hinc) hbcolor + +private theorem helper_hwy4_487.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v2 : + V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; G.ends q = s(y4, y0) → IsProperEdgeColoring G phi → phi q = some + N.beta → + ∀ (b : E), phi b = some N.beta → + ∀ (w : V), G.ends b = s(v2, w) → b ≠ q → w ≠ y4 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v2 y0 y4 q hqends hproper hqcolor b hbcolor w hbends hbq h + have hadj : AdjacentEdges G b q := ⟨y4, by + unfold Incident + rw [hbends, h] + simp [Sym2.mem_iff], by + unfold Incident + rw [hqends] + simp [Sym2.mem_iff]⟩ + exact (hproper hbq hadj hbcolor) hqcolor + +private theorem helper_hwv1_500.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v1 v2 + : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (w : V), w = y0 ∨ w = y1 ∨ w = y4 ∨ w = v1 ∨ w = v2 → w ≠ y0 → w ≠ y1 → w ≠ y4 → w ≠ v2 → w + = v1 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v1 v2 y0 y1 y4 w hwcases hwy0 hwy1 hwy4 hwv2 + rcases hwcases with h | h | h | h | h + · exact False.elim (hwy0 h) + · exact False.elim (hwy1 h) + · exact False.elim (hwy4 h) + · exact h + · exact False.elim (hwv2 h) + +private theorem helper_hfixed_509.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (_ : NormalGlobalMaximumTriple G k e0 phi T), + FixedPairMaximalTashkinovTree G e0 phi T := by + classical + intro V E _ _ _ G k e0 phi T N + refine ⟨N.global.2.1, ?_⟩ + intro S hS hsub + have hScard := treeCard_le_tashkinovOrder G k e0 phi S N.global.1 hS + have hcard : (TreeSequenceVertexSet S).card ≤ + (TreeSequenceVertexSet T).card := by + rw [N.global.2.2] + exact hScard + have heq : TreeSequenceVertexSet T = TreeSequenceVertexSet S := + Finset.eq_of_subset_of_card_le hsub hcard + exact heq.symm.subset + +private theorem helper_hqa2_588.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a2 : E := T.edge r2; + let q : E := N.closingEdge; y2 ≠ y4 → y3 ≠ y4 → G.ends a2 = s(y2, y3) → G.ends q = s(y4, y0) → + q ≠ a2 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y2 y3 y4 r2 a2 q hy24 hy34 ha2ends hqends h + have hpairs : s(y4, y0) = s(y2, y3) := by + rw [← hqends, h, ha2ends] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hy24 hd.1.symm + · exact hy34 hs.1.symm + +private theorem helper_hK0sub_601.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; + let C0 : Set (V ⊕ E) := TwoColorComponent G phi N.alpha N.beta (Sum.inl y0); Sum.inl y0 ∈ C0 → + ∀ (p0 : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), ( + ∀ {z : V ⊕ E}, z ∈ C0 → z ∈ p0.support) → Sum.inr q ∈ C0 → Sum.inl y4 ∈ C0 → Sum.inr a3 ∈ C0 → + Sum.inl y3 ∈ C0 → Sum.inr a2 ∈ C0 → Sum.inl y2 ∈ C0 → Sum.inr a1 ∈ C0 → Sum.inl y1 ∈ C0 → + let K0 : Finset (V ⊕ E) := (insert (Sum.inl y0) (insert (Sum.inl y1) (insert (Sum.inl y2) + (insert (Sum.inl y3) (insert (Sum.inl y4) (insert (Sum.inr q) (insert (Sum.inr a1) (insert + (Sum.inr a2) ({Sum.inr a3} : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset + (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset + (V ⊕ E)); K0 ⊆ p0.support.toFinset := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight y0 y1 y2 y3 y4 r1 r2 r3 a1 a2 a3 q C0 hC0root p0 + support_of_C0 hqC0 hy4C0 ha3C0 hy3C0 ha2C0 hy2C0 ha1C0 hy1C0 K0 z hz + simp only [K0, Finset.mem_insert, Finset.mem_singleton] at hz + rcases hz with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · simpa using support_of_C0 hC0root + · simpa using support_of_C0 hy1C0 + · simpa using support_of_C0 hy2C0 + · simpa using support_of_C0 hy3C0 + · simpa using support_of_C0 hy4C0 + · simpa using support_of_C0 hqC0 + · simpa using support_of_C0 ha1C0 + · simpa using support_of_C0 ha2C0 + · simpa using support_of_C0 ha3C0 + +private theorem helper_hv1notC0_629.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)) (v1 : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; v1 ≠ y0 → v1 ≠ y1 → v1 ≠ y2 → v1 ≠ y3 → v1 ≠ y4 → + let C0 : Set (V ⊕ E) := TwoColorComponent G phi N.alpha N.beta (Sum.inl y0); + ∀ (p0 : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), ( + ∀ {z : V ⊕ E}, z ∈ C0 → z ∈ p0.support) → + let K0 : Finset (V ⊕ E) := (insert (Sum.inl y0) (insert (Sum.inl y1) (insert (Sum.inl y2) + (insert (Sum.inl y3) (insert (Sum.inl y4) (insert (Sum.inr q) (insert (Sum.inr a1) (insert + (Sum.inr a2) ({Sum.inr a3} : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset + (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset + (V ⊕ E)); K0 = p0.support.toFinset → Sum.inl v1 ∉ C0 := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight v1 y0 y1 y2 y3 y4 r1 r2 r3 a1 a2 a3 q hv10' hv11' + hv12' hv13' hv14' C0 p0 support_of_C0 K0 hK0eq hv + have hvp := support_of_C0 hv + have hvK : Sum.inl v1 ∈ K0 := by + rw [hK0eq] + simpa using hvp + simp [K0, hv10', hv11', hv12', hv13', hv14'] at hvK + +private theorem helper_hv2notC0_636.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)) (v2 : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r1 : Fin T.length := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a1 : E := T.edge r1; + let a2 : E := T.edge r2; + let a3 : E := T.edge r3; + let q : E := N.closingEdge; v2 ≠ y0 → v2 ≠ y1 → v2 ≠ y2 → v2 ≠ y3 → v2 ≠ y4 → + let C0 : Set (V ⊕ E) := TwoColorComponent G phi N.alpha N.beta (Sum.inl y0); + ∀ (p0 : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), ( + ∀ {z : V ⊕ E}, z ∈ C0 → z ∈ p0.support) → + let K0 : Finset (V ⊕ E) := (insert (Sum.inl y0) (insert (Sum.inl y1) (insert (Sum.inl y2) + (insert (Sum.inl y3) (insert (Sum.inl y4) (insert (Sum.inr q) (insert (Sum.inr a1) (insert + (Sum.inr a2) ({Sum.inr a3} : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset + (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset + (V ⊕ E)); K0 = p0.support.toFinset → Sum.inl v2 ∉ C0 := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight v2 y0 y1 y2 y3 y4 r1 r2 r3 a1 a2 a3 q hv20' hv21' + hv22' hv23' hv24' C0 p0 support_of_C0 K0 hK0eq hv + have hvp := support_of_C0 hv + have hvK : Sum.inl v2 ∈ K0 := by + rw [hK0eq] + simpa using hvp + simp [K0, hv20', hv21', hv22', hv23', hv24'] at hvK + +private theorem helper_hgamma_alpha_643.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (f1 : E) (v1 : V), phi f1 = some gamma → + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); G.ends f1 = s(y1, v1) → + let C0 : Set (V ⊕ E) := TwoColorComponent G phi N.alpha N.beta (Sum.inl y0); + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi N.alpha N.beta; ( + ∀ {x z : V ⊕ E}, x ∈ C0 → H0.Adj x z → z ∈ C0) → Sum.inl y1 ∈ C0 → Sum.inl v1 ∉ C0 → gamma ≠ + N.alpha := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma f1 v1 hf1color y0 y1 hf1ends' C0 H0 C0_of_adj + hy1C0 hv1notC0 h + have hf1adj : H0.Adj (Sum.inl y1) (Sum.inr f1) := by + simp [H0, TwoColorIncidenceGraph, Incident, hf1ends', hf1color, h, + Sym2.mem_iff] + have hf1C : Sum.inr f1 ∈ C0 := C0_of_adj hy1C0 hf1adj + have hv1adj : H0.Adj (Sum.inr f1) (Sum.inl v1) := by + simp [H0, TwoColorIncidenceGraph, Incident, hf1ends', hf1color, h, + Sym2.mem_iff] + exact hv1notC0 (C0_of_adj hf1C hv1adj) + +private theorem helper_hgamma_fixed_663.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); gamma ≠ N.beta → N.alpha ≠ N.beta → + let _ : Set (V ⊕ E) := TwoColorComponent G phi N.alpha N.beta (Sum.inl y0); gamma ≠ N.alpha → + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + ∀ (e : E), phi' e = some gamma ↔ phi e = some gamma := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma y0 hgamma_beta hab C0 hgamma_alpha phi' e + by_cases heC : Sum.inr e ∈ C0 + · by_cases hea : phi e = some N.alpha + · simp [phi', TwoColorComponentSwap, C0, heC, hea, Ne.symm hgamma_alpha, Ne.symm hgamma_beta] + · by_cases heb : phi e = some N.beta + · simp [phi', TwoColorComponentSwap, C0, heC, heb, + Ne.symm hab, Ne.symm hgamma_alpha, + Ne.symm hgamma_beta] + · simp [phi', TwoColorComponentSwap, C0, heC, hea, heb] + · simp [phi', TwoColorComponentSwap, C0, heC] + +private theorem helper_hgamma_677.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + ∀ gamma ∈ MissingColors G phi (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + + (1 : ℕ)))), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + ( + ∀ (e : E), phi' e = some gamma ↔ phi e = some gamma) → gamma ∈ MissingColors G phi' y0 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma hgamma y0 phi' hgamma_fixed + have hn : gamma ∉ PresentColors G phi' y0 := by + intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp + obtain ⟨e, heinc, hecolor⟩ := hp + have hpold : gamma ∈ PresentColors G phi y0 := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, heinc, (hgamma_fixed e).1 hecolor⟩ + have hnold : gamma ∉ PresentColors G phi y0 := by + simpa [y0, MissingColors] using hgamma + exact hnold hpold + simpa [MissingColors] using hn + +private theorem helper_halpha_689.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G phi v → Incident G v f → phi f ≠ some c) → + N.alpha ≠ N.beta → + let C0 : Set (V ⊕ E) := TwoColorComponent G phi N.alpha N.beta (Sum.inl y0); + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi N.alpha N.beta; ( + ∀ {x z : V ⊕ E}, x ∈ C0 → H0.Adj x z → z ∈ C0) → Sum.inl y1 ∈ C0 → + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + N.alpha ∈ MissingColors G phi' y1 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y1 missing_excludes hab C0 H0 C0_of_adj hy1C0 phi' + have hn : N.alpha ∉ PresentColors G phi' y1 := by + intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp + obtain ⟨e, heinc, hecolor⟩ := hp + by_cases heC : Sum.inr e ∈ C0 + · by_cases hea : phi e = some N.alpha + · have : phi' e = some N.beta := by + simp [phi', TwoColorComponentSwap, C0, heC, hea] + exact hab (Option.some.inj (this.symm.trans hecolor)).symm + · by_cases heb : phi e = some N.beta + · have hbmiss : N.beta ∈ MissingColors G phi y1 := by + simpa [y1] using N.beta_missing + exact (missing_excludes hbmiss heinc) heb + · have hfix : phi' e = phi e := by + simp [phi', TwoColorComponentSwap, C0, heC, hea, heb] + exact hea (hfix.symm.trans hecolor) + · have heold : phi e = some N.alpha := by + simpa [phi', TwoColorComponentSwap, C0, heC] using hecolor + have hadj : H0.Adj (Sum.inl y1) (Sum.inr e) := by + simp [H0, TwoColorIncidenceGraph, heinc, heold] + exact heC (C0_of_adj hy1C0 hadj) + rw [MissingColors, Finset.mem_sdiff] + exact ⟨Finset.mem_univ _, hn⟩ + +private theorem helper_missing_excludes_713.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G phi' v → Incident G v f → phi' f ≠ some c + := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 phi' c v f hc hinc hfc + have hp : c ∈ PresentColors G phi' v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hinc, hfc⟩ + have hn : c ∉ PresentColors G phi' v := by + simpa [MissingColors] using hc + exact hn hp + +private theorem helper_hK8sub2_773.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)) (gamma : Fin k) (f1 f2 : E) (v1 v2 : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; + let K8 : Finset (V ⊕ E) := (insert (Sum.inl y0) (insert (Sum.inl y1) (insert (Sum.inl y4) + (insert (Sum.inl v1) (insert (Sum.inl v2) (insert (Sum.inr q) (insert (Sum.inr f1) + ({Sum.inr f2} : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : + Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)); + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + ∀ (p2 : (TwoColorIncidenceGraph G phi' gamma N.alpha).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), Sum.inl y0 ∈ p2.support → + Sum.inr q ∈ p2.support → Sum.inl y4 ∈ p2.support → Sum.inr f2 ∈ p2.support → Sum.inl v2 ∈ + p2.support → Sum.inl y1 ∈ p2.support → Sum.inr f1 ∈ p2.support → Sum.inl v1 ∈ p2.support → + K8 ⊆ p2.support.toFinset := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight gamma f1 f2 v1 v2 y0 y1 y4 q K8 phi' p2 hy0p2 hqp2 + hy4p2 hf2p2 hv2p2 hy1p2 hf1p2 hv1p2 z hz + simp only [K8, Finset.mem_insert, Finset.mem_singleton] at hz + rcases hz with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · simpa using hy0p2 + · simpa using hy1p2 + · simpa using hy4p2 + · simpa using hv1p2 + · simpa using hv2p2 + · simpa using hqp2 + · simpa using hf1p2 + · simpa using hf2p2 + +private theorem helper_hiv2lt_800.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (_ _ : E) (_ v2 : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); v2 ≠ y1 → + ∀ (_ : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (_ : ℕ) (_ : E), + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + ∀ (p2 : (TwoColorIncidenceGraph G phi' gamma N.alpha).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), (4 : ℕ) ∣ p2.length → + p2.length = (8 : ℕ) → + ∀ (iv2' : ℕ), p2.getVert iv2' = Sum.inl v2 → iv2' ≤ p2.length → iv2' < p2.length := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma f1 f2 v1 v2 y0 y1 hv21' p1 iv2 b i0 i1 pmax p0 + phi' p2 hp2div hp2length iv2' hiv2' hiv2le' + by_contra h + have hil : p2.length ≤ iv2' := by omega + have hvend := p2.getVert_of_length_le hil + have hv : (Sum.inl v2 : Sum V E) = Sum.inl y1 := by + rw [hiv2'] at hvend + simpa [y1] using hvend + exact hv21' (Sum.inl_injective hv) + +private theorem helper_hprevnext2_817.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (_ _ : E) (_ _ : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (_ : ℕ) (_ : E), + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + ∀ (p2 : (TwoColorIncidenceGraph G phi' gamma N.alpha).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), p2.IsPath → (4 : ℕ) ∣ + p2.length → p2.length = (8 : ℕ) → + ∀ iv2' ≤ p2.length, iv2' < p2.length → p2.getVert (iv2' - (1 : ℕ)) ≠ p2.getVert (iv2' + (1 : + ℕ)) := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma f1 f2 v1 v2 y0 p1 iv2 b i0 i1 pmax p0 phi' p2 hp2 + hp2div hp2length iv2' hiv2le' hiv2lt' h + have hi := hp2.getVert_injOn + (show iv2' - 1 ≤ p2.length by omega) + (show iv2' + 1 ≤ p2.length by omega) h + omega + +private theorem helper_branch_826.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (f2 : E) (v2 : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : V), + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + ∀ (p2 : (TwoColorIncidenceGraph G phi' gamma N.alpha).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let H2 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi' gamma N.alpha; + ∀ (iv2' : ℕ), H2.Adj (Sum.inl v2) (p2.getVert (iv2' + (1 : ℕ))) → p2.getVert (iv2' - (1 : ℕ)) + ≠ p2.getVert (iv2' + (1 : ℕ)) → p2.getVert (iv2' - (1 : ℕ)) = Sum.inr f2 → + ∃ (a : E), H2.Adj (Sum.inl v2) (Sum.inr a) ∧ Sum.inr a ∈ p2.support ∧ a ≠ f2 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma f2 v2 y0 w phi' p2 H2 iv2' hnextAdj2 hprevnext2 hp + cases hn : p2.getVert (iv2' + 1) with + | inl w => + rw [hn] at hnextAdj2 + simp [H2, TwoColorIncidenceGraph] at hnextAdj2 + | inr a => + rw [hn] at hnextAdj2 + refine ⟨a, hnextAdj2, ?_, ?_⟩ + · rw [← hn] + exact p2.getVert_mem_support (iv2' + 1) + · intro h + apply hprevnext2 + rw [hp, hn, h] + +private theorem helper_branch_838.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma + : Fin k) (f2 : E) (v2 : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : V), + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + ∀ (p2 : (TwoColorIncidenceGraph G phi' gamma N.alpha).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let H2 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi' gamma N.alpha; + ∀ (iv2' : ℕ), H2.Adj (Sum.inl v2) (p2.getVert (iv2' - (1 : ℕ))) → ¬p2.getVert (iv2' - (1 : ℕ)) + = Sum.inr f2 → + ∃ (a : E), H2.Adj (Sum.inl v2) (Sum.inr a) ∧ Sum.inr a ∈ p2.support ∧ a ≠ f2 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight gamma f2 v2 y0 w phi' p2 H2 iv2' hprevAdj2 hp + cases hn : p2.getVert (iv2' - 1) with + | inl w => + rw [hn] at hprevAdj2 + simp [H2, TwoColorIncidenceGraph] at hprevAdj2 + | inr a => + rw [hn] at hprevAdj2 + refine ⟨a, hprevAdj2, ?_, ?_⟩ + · rw [← hn] + exact p2.getVert_mem_support (iv2' - 1) + · intro h + exact hp (by rw [hn, h]) + +private theorem helper_haq_857.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v2 : + V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; G.ends q = s(y4, y0) → v2 ≠ y0 → v2 ≠ y4 → + ∀ (a : E) (x : V), G.ends a = s(v2, x) → a ≠ q := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v2 y0 y4 q hqends hv20' hv24' a x haends h + have hpairs : s(v2, x) = s(y4, y0) := by + rw [← haends, h, hqends] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hv24' hd.1 + · exact hv20' hs.1 + +private theorem helper_hK9asub_873.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 + : ℕ)) (gamma : Fin k) (f1 f2 : E) (v1 v2 : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; + let K8 : Finset (V ⊕ E) := (insert (Sum.inl y0) (insert (Sum.inl y1) (insert (Sum.inl y4) + (insert (Sum.inl v1) (insert (Sum.inl v2) (insert (Sum.inr q) (insert (Sum.inr f1) + ({Sum.inr f2} : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : + Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)) : Finset (V ⊕ E)); + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + ∀ (p2 : (TwoColorIncidenceGraph G phi' gamma N.alpha).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), K8 ⊆ p2.support.toFinset → + ∀ (a : E), Sum.inr a ∈ p2.support → + let K9a : Finset (V ⊕ E) := (insert (Sum.inr a) K8 : Finset (V ⊕ E)); K9a ⊆ + p2.support.toFinset := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight gamma f1 f2 v1 v2 y0 y1 y4 q K8 phi' p2 hK8sub2 a + hap2 K9a z hz + simp only [K9a, Finset.mem_insert] at hz + rcases hz with rfl | hz + · simpa using hap2 + · exact hK8sub2 hz + +private theorem helper_hxy0_896.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v2 : + V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; G.ends q = s(y4, y0) → + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + IsProperEdgeColoring G phi' → phi' q = some N.alpha → + ∀ (a : E), phi' a = some N.alpha → + ∀ (x : V), G.ends a = s(v2, x) → a ≠ q → x ≠ y0 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v2 y0 y4 q hqends phi' hproper' hqcolor' a hacolor' x + haends haq h + have hadj : AdjacentEdges G a q := ⟨y0, by + unfold Incident + rw [haends, h] + simp [Sym2.mem_iff], by + unfold Incident + rw [hqends] + simp [Sym2.mem_iff]⟩ + exact (hproper' haq hadj hacolor') hqcolor' + +private theorem helper_hxy1_906.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v2 : + V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + N.alpha ∈ MissingColors G phi' y1 → ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G phi' v → Incident G v f → phi' f ≠ some c) + → + ∀ (a : E), phi' a = some N.alpha → + ∀ (x : V), G.ends a = s(v2, x) → x ≠ y1 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v2 y0 y1 phi' halpha' missing_excludes' a hacolor' x + haends h + have hinc : Incident G y1 a := by + unfold Incident + rw [haends, h] + simp [Sym2.mem_iff] + exact (missing_excludes' halpha' hinc) hacolor' + +private theorem helper_hxy4_913.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v2 : + V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; G.ends q = s(y4, y0) → + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + IsProperEdgeColoring G phi' → phi' q = some N.alpha → + ∀ (a : E), phi' a = some N.alpha → + ∀ (x : V), G.ends a = s(v2, x) → a ≠ q → x ≠ y4 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v2 y0 y4 q hqends phi' hproper' hqcolor' a hacolor' x + haends haq h + have hadj : AdjacentEdges G a q := ⟨y4, by + unfold Incident + rw [haends, h] + simp [Sym2.mem_iff], by + unfold Incident + rw [hqends] + simp [Sym2.mem_iff]⟩ + exact (hproper' haq hadj hacolor') hqcolor' + +private theorem helper_hxv1_926.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v1 v2 + : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y1 : V := T.vertex (⟨(1 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (x : V), x = y0 ∨ x = y1 ∨ x = y4 ∨ x = v1 ∨ x = v2 → x ≠ y0 → x ≠ y1 → x ≠ y4 → x ≠ v2 → x + = v1 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v1 v2 y0 y1 y4 x hxcases hxy0 hxy1 hxy4 hxv2 + rcases hxcases with h | h | h | h | h + · exact False.elim (hxy0 h) + · exact False.elim (hxy1 h) + · exact False.elim (hxy4 h) + · exact h + · exact False.elim (hxv2 h) + +private theorem helper_haNotC0_935.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (v1 v2 + : V), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); N.alpha ≠ N.beta → + let C0 : Set (V ⊕ E) := TwoColorComponent G phi N.alpha N.beta (Sum.inl y0); + let H0 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi N.alpha N.beta; ( + ∀ {x z : V ⊕ E}, x ∈ C0 → H0.Adj x z → z ∈ C0) → Sum.inl v1 ∉ C0 → + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0); + ∀ (a : E), phi' a = some N.alpha → G.ends a = s(v1, v2) → Sum.inr a ∉ C0 := by + classical + intro V E _ _ _ G k e0 phi T N hNheight v1 v2 y0 hab C0 H0 C0_of_adj hv1notC0 phi' a hacolor' + haends' haC + have habeta : phi a = some N.beta := by + by_cases haa : phi a = some N.alpha + · have hs : phi' a = some N.beta := by + simp [phi', TwoColorComponentSwap, C0, haC, haa] + exact False.elim (hab (Option.some.inj (hacolor'.symm.trans hs))) + · by_cases habeta : phi a = some N.beta + · exact habeta + · have hfix : phi' a = phi a := by + simp [phi', TwoColorComponentSwap, C0, haC, haa, habeta] + exact False.elim (haa (hfix.symm.trans hacolor')) + have hadj : H0.Adj (Sum.inr a) (Sum.inl v1) := by + simp [H0, TwoColorIncidenceGraph, Incident, haends', habeta, Sym2.mem_iff] + exact hv1notC0 (C0_of_adj haC hadj) + +private theorem helper_continuation_2397.{u_1, u_2} : + helperContinuation2397Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight hGheight gamma f1 f2 v1 v2 _ y0 y1 y4 q hqends + hf1ends' hv20' hv21' hv24' p1 K8 hK8card iv2 b hf2inc hbcolor w hbends' i0 i1 hab pmax C0 + H0 C0_of_adj p0 hv1notC0 hgamma_alpha phi' hproper' hf1color' hf2color' hqcolor' halpha' + missing_excludes' p2 hp2 hp2div hp2bound H2 C2 hp2support' C2_of_adj support_of_C2 hy0p2 + hqp2 hy4p2 hf2p2 hv2p2 + have hy1p2 : Sum.inl y1 ∈ p2.support := by + simpa [y1] using p2.end_mem_support + have hy1C2 : Sum.inl y1 ∈ C2 := by + rw [← hp2support'] + exact hy1p2 + have hf1adj12 : H2.Adj (Sum.inl y1) (Sum.inr f1) := by + simp [H2, TwoColorIncidenceGraph, Incident, hf1ends', hf1color', Sym2.mem_iff] + have hf1C2 : Sum.inr f1 ∈ C2 := C2_of_adj hy1C2 hf1adj12 + have hf1p2 : Sum.inr f1 ∈ p2.support := support_of_C2 hf1C2 + have hf1adjv12 : H2.Adj (Sum.inr f1) (Sum.inl v1) := by + simp [H2, TwoColorIncidenceGraph, Incident, hf1ends', hf1color', Sym2.mem_iff] + have hv1C2 : Sum.inl v1 ∈ C2 := C2_of_adj hf1C2 hf1adjv12 + have hv1p2 : Sum.inl v1 ∈ p2.support := support_of_C2 hv1C2 + have hK8sub2 : K8 ⊆ p2.support.toFinset := by + exact @helper_hK8sub2_773 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@f2) (@v1) (@v2) (@p2) + (@hy0p2) (@hqp2) (@hy4p2) (@hf2p2) (@hv2p2) (@hy1p2) (@hf1p2) (@hv1p2) + have hp2lower : 7 ≤ p2.length := by + have hc := Finset.card_le_card hK8sub2 + rw [hK8card, List.toFinset_card_of_nodup hp2.support_nodup, + SimpleGraph.Walk.length_support] at hc + omega + have hp2length : p2.length = 8 := by + rcases hp2div with ⟨d, hd⟩ + omega + obtain ⟨iv2', hiv2', hiv2le'⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hv2p2 + have hiv20' : iv2' ≠ 0 := by + intro h + have hv : (Sum.inl v2 : Sum V E) = Sum.inl y0 := by + rw [← hiv2', h, p2.getVert_zero] + exact hv20' (Sum.inl_injective hv) + have hiv2lt' : iv2' < p2.length := by + exact @helper_hiv2lt_800 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@f2) (@v1) (@v2) (@hv21') (@p1) (@iv2) (@b) + (@pmax) (@p0) (@p2) (@hp2div) (@hp2length) (@iv2') (@hiv2') (@hiv2le') + have hprevAdj2 : H2.Adj (Sum.inl v2) (p2.getVert (iv2' - 1)) := by + have h := (p2.adj_getVert_succ (i := iv2' - 1) (by omega)).symm + have heq : iv2' - 1 + 1 = iv2' := by omega + rw [heq, hiv2'] at h + exact h + have hnextAdj2 : H2.Adj (Sum.inl v2) (p2.getVert (iv2' + 1)) := by + have h := p2.adj_getVert_succ hiv2lt' + rw [hiv2'] at h + exact h + have hprevnext2 : p2.getVert (iv2' - 1) ≠ p2.getVert (iv2' + 1) := by + exact @helper_hprevnext2_817 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@f2) (@v1) (@v2) (@p1) (@iv2) (@b) + (@pmax) (@p0) (@p2) (@hp2) (@hp2div) (@hp2length) (@iv2') (@hiv2le') (@hiv2lt') + obtain ⟨a, haAdj, hap2, haf2⟩ : ∃ a : E, + H2.Adj (Sum.inl v2) (Sum.inr a) ∧ Sum.inr a ∈ p2.support ∧ a ≠ f2 := by + by_cases hp : p2.getVert (iv2' - 1) = Sum.inr f2 + · exact @helper_branch_826 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@f2) (@v2) (@w) (@p2) (@iv2') (@hnextAdj2) + (@hprevnext2) (@hp) + · exact @helper_branch_838 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@f2) (@v2) (@w) (@p2) (@iv2') (@hprevAdj2) + (@hp) + have hainc : Incident G v2 a := by + simpa [H2, TwoColorIncidenceGraph] using haAdj |>.1 + have hfaadj : AdjacentEdges G f2 a := ⟨v2, hf2inc, hainc⟩ + have hacolor' : phi' a = some N.alpha := by + have hc : phi' a = some gamma ∨ phi' a = some N.alpha := by + simpa [H2, TwoColorIncidenceGraph] using haAdj |>.2 + exact hc.resolve_left (hproper' haf2.symm hfaadj hf2color') + obtain ⟨x, haends⟩ := Sym2.mem_iff_exists.mp hainc + have haq : a ≠ q := by + exact @helper_haq_857 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v2) (@hqends) (@hv20') (@hv24') (@a) (@x) (@haends) + have haf1 : a ≠ f1 := by + intro h + have hc : some N.alpha = some gamma := by rw [← hacolor', h, hf1color'] + exact hgamma_alpha (Option.some.inj hc).symm + let K9a : Finset (Sum V E) := insert (Sum.inr a) K8 + have hK9acard : K9a.card = 9 := by + rw [Finset.card_insert_of_notMem] + · rw [hK8card] + · simp [K8, haf2, haf1, haq] + have hK9asub : K9a ⊆ p2.support.toFinset := by + exact @helper_hK9asub_873 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@f2) (@v1) (@v2) (@p2) + (@hK8sub2) (@a) (@hap2) + have hp2card : p2.support.toFinset.card = 9 := by + rw [List.toFinset_card_of_nodup hp2.support_nodup, + SimpleGraph.Walk.length_support, hp2length] + have hK9aeq : K9a = p2.support.toFinset := + Finset.eq_of_subset_of_card_le hK9asub (by rw [hK9acard, hp2card]) + have haAdjx : H2.Adj (Sum.inr a) (Sum.inl x) := by + simp [H2, TwoColorIncidenceGraph, Incident, haends, hacolor', Sym2.mem_iff] + have haC2 : Sum.inr a ∈ C2 := by + rw [← hp2support'] + exact hap2 + have hxC2 : Sum.inl x ∈ C2 := C2_of_adj haC2 haAdjx + have hxp2 : Sum.inl x ∈ p2.support := support_of_C2 hxC2 + have hxcases : x = y0 ∨ x = y1 ∨ x = y4 ∨ x = v1 ∨ x = v2 := by + have hxfin : Sum.inl x ∈ K9a := by + rw [hK9aeq] + simpa using hxp2 + simpa [K9a, K8] using hxfin + have hxy0 : x ≠ y0 := by + exact @helper_hxy0_896 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v2) (@hqends) (@hproper') (@hqcolor') (@a) (@hacolor') + (@x) (@haends) (@haq) + have hxy1 : x ≠ y1 := by + exact @helper_hxy1_906 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v2) (@halpha') (@missing_excludes') (@a) (@hacolor') (@x) + (@haends) + have hxy4 : x ≠ y4 := by + exact @helper_hxy4_913 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v2) (@hqends) (@hproper') (@hqcolor') (@a) (@hacolor') + (@x) (@haends) (@haq) + have hxv2 : x ≠ v2 := by + intro h + exact G.loopless a v2 (by simpa [h] using haends) + have hxv1 : x = v1 := by + exact @helper_hxv1_926 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v1) (@v2) (@x) (@hxcases) (@hxy0) (@hxy1) (@hxy4) (@hxv2) + have haends' : G.ends a = s(v1, v2) := by + rw [haends, hxv1, Sym2.eq_swap] + have haNotC0 : Sum.inr a ∉ C0 := by + exact @helper_haNotC0_935 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v1) (@v2) (@hab) (@C0_of_adj) (@hv1notC0) (@a) (@hacolor') + (@haends') + have hacolor : phi a = some N.alpha := by + simpa [phi', TwoColorComponentSwap, C0, haNotC0] using hacolor' + have habedge : a ≠ b := by + intro h + have hc : some N.alpha = some N.beta := by rw [← hacolor, h, hbcolor] + exact hab (Option.some.inj hc) + exact ⟨a, b, haends', hacolor, hbends', hbcolor, habedge⟩ + +private theorem helper_continuation_2127.{u_1, u_2} : + helperContinuation2127Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight hGheight gamma hgamma f1 f2 v1 v2 hf1color hf2color _ + y0 y1 y2 y3 y4 r1 r2 r3 a1 a2 a3 q hy01 hy02 hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 + ha1ends ha2ends ha3ends hqends missing_excludes ha1color ha12ne ha2color ha23ne ha3color + hqcolor hgamma_beta hf1ends' hf2ends' hv10' hv11' hv12' hv13' hv14' hv20' hv21' hv22' hv23' + hv24' p1 K8 hK8card iv2 b hf2inc hbcolor w hbends' i0 i1 hab pmax hpmaxsupport hchangedata + let C0 := TwoColorComponent G phi N.alpha N.beta (Sum.inl y0) + let H0 := TwoColorIncidenceGraph G phi N.alpha N.beta + have hpmaxsupport' : {z | z ∈ pmax.support} = C0 := by + simpa [C0, i0, y0] using hpmaxsupport + have hC0root : Sum.inl y0 ∈ C0 := by + change Sum.inl y0 ∈ H0.connectedComponentMk (Sum.inl y0) + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + have C0_of_adj {x z : Sum V E} (hx : x ∈ C0) (hxz : H0.Adj x z) : z ∈ C0 := by + change H0.connectedComponentMk x = H0.connectedComponentMk (Sum.inl y0) at hx + change H0.connectedComponentMk z = H0.connectedComponentMk (Sum.inl y0) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hxz).symm.trans hx + obtain ⟨p0, hp0, hp0support, hp0div, hp0vertices, hp0bound⟩ := + ScheideKempePathHeightBound G k e0 phi T N.global N.alpha N.beta + N.alpha_missing N.beta_missing + have hp0support' : {z | z ∈ p0.support} = C0 := by + simpa [C0, y0] using hp0support + have support_of_C0 {z : Sum V E} (hz : z ∈ C0) : z ∈ p0.support := by + change z ∈ {w | w ∈ p0.support} + rw [hp0support'] + exact hz + have hq0adj : H0.Adj (Sum.inl y0) (Sum.inr q) := by + simp [H0, TwoColorIncidenceGraph, Incident, hqends, hqcolor, Sym2.mem_iff] + have hqC0 : Sum.inr q ∈ C0 := C0_of_adj hC0root hq0adj + have hq4adj : H0.Adj (Sum.inr q) (Sum.inl y4) := by + simp [H0, TwoColorIncidenceGraph, Incident, hqends, hqcolor, Sym2.mem_iff] + have hy4C0 : Sum.inl y4 ∈ C0 := C0_of_adj hqC0 hq4adj + have ha34adj : H0.Adj (Sum.inl y4) (Sum.inr a3) := by + simp [H0, TwoColorIncidenceGraph, Incident, ha3ends, ha3color, Sym2.mem_iff] + have ha3C0 : Sum.inr a3 ∈ C0 := C0_of_adj hy4C0 ha34adj + have ha33adj : H0.Adj (Sum.inr a3) (Sum.inl y3) := by + simp [H0, TwoColorIncidenceGraph, Incident, ha3ends, ha3color, Sym2.mem_iff] + have hy3C0 : Sum.inl y3 ∈ C0 := C0_of_adj ha3C0 ha33adj + have ha23adj : H0.Adj (Sum.inl y3) (Sum.inr a2) := by + simp [H0, TwoColorIncidenceGraph, Incident, ha2ends, ha2color, Sym2.mem_iff] + have ha2C0 : Sum.inr a2 ∈ C0 := C0_of_adj hy3C0 ha23adj + have ha22adj : H0.Adj (Sum.inr a2) (Sum.inl y2) := by + simp [H0, TwoColorIncidenceGraph, Incident, ha2ends, ha2color, Sym2.mem_iff] + have hy2C0 : Sum.inl y2 ∈ C0 := C0_of_adj ha2C0 ha22adj + have ha12adj : H0.Adj (Sum.inl y2) (Sum.inr a1) := by + simp [H0, TwoColorIncidenceGraph, Incident, ha1ends, ha1color, Sym2.mem_iff] + have ha1C0 : Sum.inr a1 ∈ C0 := C0_of_adj hy2C0 ha12adj + have ha11adj : H0.Adj (Sum.inr a1) (Sum.inl y1) := by + simp [H0, TwoColorIncidenceGraph, Incident, ha1ends, ha1color, Sym2.mem_iff] + have hy1C0 : Sum.inl y1 ∈ C0 := C0_of_adj ha1C0 ha11adj + have ha13ne : a1 ≠ a3 := by + intro h + exact (show r1 ≠ r3 by simp [r1, r3]) + (T.edge_injective (by simpa [a1, a3] using h)) + have hqa1 : q ≠ a1 := by + intro h + have hc : some N.beta = some N.alpha := by rw [← hqcolor, h, ha1color] + exact hab (Option.some.inj hc).symm + have hqa3 : q ≠ a3 := by + intro h + have hc : some N.beta = some N.alpha := by rw [← hqcolor, h, ha3color] + exact hab (Option.some.inj hc).symm + have hqa2 : q ≠ a2 := by + exact @helper_hqa2_588 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@hy24) (@hy34) (@ha2ends) (@hqends) + let K0 : Finset (Sum V E) := + {Sum.inl y0, Sum.inl y1, Sum.inl y2, Sum.inl y3, Sum.inl y4, + Sum.inr q, Sum.inr a1, Sum.inr a2, Sum.inr a3} + have hK0card : K0.card = 9 := by + simp [K0, hy01, hy02, hy03, hy04, hy12, hy13, hy14, hy23, hy24, hy34, + ha12ne, ha13ne, ha23ne, hqa1, hqa2, hqa3] + have hK0sub : K0 ⊆ p0.support.toFinset := by + exact @helper_hK0sub_601 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hC0root) (@p0) (@support_of_C0) (@hqC0) + (@hy4C0) (@ha3C0) (@hy3C0) (@ha2C0) (@hy2C0) (@ha1C0) (@hy1C0) + have hp0lower : 8 ≤ p0.length := by + have hc := Finset.card_le_card hK0sub + rw [hK0card, List.toFinset_card_of_nodup hp0.support_nodup, + SimpleGraph.Walk.length_support] at hc + omega + have hp0bound' : p0.length / 2 + 1 ≤ 5 := by + simpa [hGheight] using hp0bound + have hp0length : p0.length = 8 := by + rcases hp0div with ⟨d, hd⟩ + omega + have hp0card : p0.support.toFinset.card = 9 := by + rw [List.toFinset_card_of_nodup hp0.support_nodup, + SimpleGraph.Walk.length_support, hp0length] + have hK0eq : K0 = p0.support.toFinset := + Finset.eq_of_subset_of_card_le hK0sub (by rw [hK0card, hp0card]) + have hv1notC0 : Sum.inl v1 ∉ C0 := by + exact @helper_hv1notC0_629 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@v1) (@hv10') (@hv11') (@hv12') (@hv13') + (@hv14') (@p0) (@support_of_C0) (@hK0eq) + have hv2notC0 : Sum.inl v2 ∉ C0 := by + exact @helper_hv2notC0_636 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@v2) (@hv20') (@hv21') (@hv22') (@hv23') + (@hv24') (@p0) (@support_of_C0) (@hK0eq) + have hgamma_alpha : gamma ≠ N.alpha := by + exact @helper_hgamma_alpha_643 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@v1) (@hf1color) (@hf1ends') + (@C0_of_adj) (@hy1C0) (@hv1notC0) + let phi' := TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl y0) + have hproper' : IsProperEdgeColoring G phi' := by + simpa [phi', y0, i0] using hchangedata.1 + have hone' : IsOneEdgeUncolored phi' e0 := by + simpa [phi', y0, i0] using hchangedata.2.1 + have hTash' : TashkinovTree G e0 phi' T := by + simpa [phi', y0, i0] using hchangedata.2.2 + have hglobal' : GlobalMaximumTriple G k e0 phi' T := by + refine ⟨⟨N.global.1.1, N.global.1.2.1, N.global.1.2.2.1, + hproper', hone'⟩, hTash', N.global.2.2⟩ + have hgamma_fixed (e : E) : phi' e = some gamma ↔ phi e = some gamma := by + exact @helper_hgamma_fixed_663 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@hgamma_beta) (@hab) (@hgamma_alpha) (@e) + have hf1color' : phi' f1 = some gamma := (hgamma_fixed f1).2 hf1color + have hf2color' : phi' f2 = some gamma := (hgamma_fixed f2).2 hf2color + have hqcolor' : phi' q = some N.alpha := by + simp [phi', TwoColorComponentSwap, C0, hqC0, hqcolor] + have hgamma' : gamma ∈ MissingColors G phi' y0 := by + exact @helper_hgamma_677 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@gamma) (@hgamma) (@hgamma_fixed) + have halpha' : N.alpha ∈ MissingColors G phi' y1 := by + exact @helper_halpha_689 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@missing_excludes) (@hab) (@C0_of_adj) (@hy1C0) + have missing_excludes' {c : Fin k} {v : V} {f : E} + (hc : c ∈ MissingColors G phi' v) (hinc : Incident G v f) : + phi' f ≠ some c := by + exact @helper_missing_excludes_713 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@c) (@v) (@f) (@hc) (@hinc) + obtain ⟨p2, hp2, hp2support, hp2div, hp2vertices, hp2bound⟩ := + ScheideKempePathHeightBound G k e0 phi' T hglobal' gamma N.alpha + (by simpa [y0] using hgamma') (by simpa [y1] using halpha') + have hp2bound' : p2.length / 2 + 1 ≤ 5 := by + simpa [hGheight] using hp2bound + let H2 := TwoColorIncidenceGraph G phi' gamma N.alpha + let C2 := TwoColorComponent G phi' gamma N.alpha (Sum.inl y0) + have hp2support' : {z | z ∈ p2.support} = C2 := by + simpa [C2, y0] using hp2support + have hC2root : Sum.inl y0 ∈ C2 := by + change Sum.inl y0 ∈ H2.connectedComponentMk (Sum.inl y0) + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + have C2_of_adj {x z : Sum V E} (hx : x ∈ C2) (hxz : H2.Adj x z) : z ∈ C2 := by + change H2.connectedComponentMk x = H2.connectedComponentMk (Sum.inl y0) at hx + change H2.connectedComponentMk z = H2.connectedComponentMk (Sum.inl y0) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hxz).symm.trans hx + have support_of_C2 {z : Sum V E} (hz : z ∈ C2) : z ∈ p2.support := by + change z ∈ {w | w ∈ p2.support} + rw [hp2support'] + exact hz + have hy0p2 : Sum.inl y0 ∈ p2.support := support_of_C2 hC2root + have hqadj02 : H2.Adj (Sum.inl y0) (Sum.inr q) := by + simp [H2, TwoColorIncidenceGraph, Incident, hqends, hqcolor', Sym2.mem_iff] + have hqC2 : Sum.inr q ∈ C2 := C2_of_adj hC2root hqadj02 + have hqp2 : Sum.inr q ∈ p2.support := support_of_C2 hqC2 + have hqadj42 : H2.Adj (Sum.inr q) (Sum.inl y4) := by + simp [H2, TwoColorIncidenceGraph, Incident, hqends, hqcolor', Sym2.mem_iff] + have hy4C2 : Sum.inl y4 ∈ C2 := C2_of_adj hqC2 hqadj42 + have hy4p2 : Sum.inl y4 ∈ p2.support := support_of_C2 hy4C2 + have hf2adj42 : H2.Adj (Sum.inl y4) (Sum.inr f2) := by + simp [H2, TwoColorIncidenceGraph, Incident, hf2ends', hf2color', Sym2.mem_iff] + have hf2C2 : Sum.inr f2 ∈ C2 := C2_of_adj hy4C2 hf2adj42 + have hf2p2 : Sum.inr f2 ∈ p2.support := support_of_C2 hf2C2 + have hf2adjv22 : H2.Adj (Sum.inr f2) (Sum.inl v2) := by + simp [H2, TwoColorIncidenceGraph, Incident, hf2ends', hf2color', Sym2.mem_iff] + have hv2C2 : Sum.inl v2 ∈ C2 := C2_of_adj hf2C2 hf2adjv22 + have hv2p2 : Sum.inl v2 ∈ p2.support := support_of_C2 hv2C2 + exact @helper_continuation_2397 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@f1) (@f2) + (@v1) (@v2) (by assumption) (@hqends) (@hf1ends') (@hv20') (@hv21') (@hv24') (@p1) + (@hK8card) (@iv2) (@b) (@hf2inc) (@hbcolor) (@w) (@hbends') (@hab) (@pmax) (@C0_of_adj) + (@p0) (@hv1notC0) (@hgamma_alpha) (@hproper') (@hf1color') (@hf2color') (@hqcolor') + (@halpha') (@missing_excludes') (@p2) (@hp2) (@hp2div) (@hp2bound) (@hp2support') + (@C2_of_adj) (@support_of_C2) (@hy0p2) (@hqp2) (@hy4p2) (@hf2p2) (@hv2p2) +private theorem helper_continuation_1992.{u_1, u_2} : + helperContinuation1992Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T N hNheight hGheight gamma hgamma f1 f2 v1 v2 hf1color hf2color _ + y0 y1 y2 y3 y4 r1 r2 r3 a1 a2 a3 q hy01 hy02 hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 + ha1ends ha2ends ha3ends hqends hproper missing_excludes ha1color ha12ne ha2color ha23ne + ha3color hqcolor hgamma_beta hf1ends' hf2ends' hv10' hv11' hv12' hv13' hv14' hv20' hv21' + hv22' hv23' hv24' hf12ne hv12ne hqf1 hqf2 p1 hp1 hp1div hp1bound H1 C1 hp1support' hC1root + have C1_of_adj {x z : Sum V E} (hx : x ∈ C1) (hxz : H1.Adj x z) : z ∈ C1 := by + change H1.connectedComponentMk x = H1.connectedComponentMk (Sum.inl y0) at hx + change H1.connectedComponentMk z = H1.connectedComponentMk (Sum.inl y0) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hxz).symm.trans hx + have support_of_C1 {z : Sum V E} (hz : z ∈ C1) : z ∈ p1.support := by + change z ∈ {w | w ∈ p1.support} + rw [hp1support'] + exact hz + have hy0p1 : Sum.inl y0 ∈ p1.support := support_of_C1 hC1root + have hqadj0 : H1.Adj (Sum.inl y0) (Sum.inr q) := by + simp [H1, TwoColorIncidenceGraph, Incident, hqends, hqcolor, Sym2.mem_iff] + have hqC1 : Sum.inr q ∈ C1 := C1_of_adj hC1root hqadj0 + have hqp1 : Sum.inr q ∈ p1.support := support_of_C1 hqC1 + have hqadj4 : H1.Adj (Sum.inr q) (Sum.inl y4) := by + simp [H1, TwoColorIncidenceGraph, Incident, hqends, hqcolor, Sym2.mem_iff] + have hy4C1 : Sum.inl y4 ∈ C1 := C1_of_adj hqC1 hqadj4 + have hy4p1 : Sum.inl y4 ∈ p1.support := support_of_C1 hy4C1 + have hf2adj4 : H1.Adj (Sum.inl y4) (Sum.inr f2) := by + simp [H1, TwoColorIncidenceGraph, Incident, hf2ends', hf2color, Sym2.mem_iff] + have hf2C1 : Sum.inr f2 ∈ C1 := C1_of_adj hy4C1 hf2adj4 + have hf2p1 : Sum.inr f2 ∈ p1.support := support_of_C1 hf2C1 + have hf2adjv2 : H1.Adj (Sum.inr f2) (Sum.inl v2) := by + simp [H1, TwoColorIncidenceGraph, Incident, hf2ends', hf2color, Sym2.mem_iff] + have hv2C1 : Sum.inl v2 ∈ C1 := C1_of_adj hf2C1 hf2adjv2 + have hv2p1 : Sum.inl v2 ∈ p1.support := support_of_C1 hv2C1 + have hy1p1 : Sum.inl y1 ∈ p1.support := by + simpa [y1] using p1.end_mem_support + have hy1C1 : Sum.inl y1 ∈ C1 := by + rw [← hp1support'] + exact hy1p1 + have hf1adj1 : H1.Adj (Sum.inl y1) (Sum.inr f1) := by + simp [H1, TwoColorIncidenceGraph, Incident, hf1ends', hf1color, Sym2.mem_iff] + have hf1C1 : Sum.inr f1 ∈ C1 := C1_of_adj hy1C1 hf1adj1 + have hf1p1 : Sum.inr f1 ∈ p1.support := support_of_C1 hf1C1 + have hf1adjv1 : H1.Adj (Sum.inr f1) (Sum.inl v1) := by + simp [H1, TwoColorIncidenceGraph, Incident, hf1ends', hf1color, Sym2.mem_iff] + have hv1C1 : Sum.inl v1 ∈ C1 := C1_of_adj hf1C1 hf1adjv1 + have hv1p1 : Sum.inl v1 ∈ p1.support := support_of_C1 hv1C1 + let K8 : Finset (Sum V E) := + {Sum.inl y0, Sum.inl y1, Sum.inl y4, Sum.inl v1, Sum.inl v2, + Sum.inr q, Sum.inr f1, Sum.inr f2} + have hK8card : K8.card = 8 := by + simp [K8, hy01, hy04, hy14, hv12ne, hqf1, hqf2, hf12ne, Ne.symm hv10', Ne.symm hv11', Ne.symm + hv14', Ne.symm hv20', + Ne.symm hv21', Ne.symm hv24'] + have hK8sub : K8 ⊆ p1.support.toFinset := by + exact @helper_hK8sub_343 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@f2) (@v1) (@v2) (@p1) + (@hy0p1) (@hqp1) (@hy4p1) (@hf2p1) (@hv2p1) (@hy1p1) (@hf1p1) (@hv1p1) + have hp1lower : 7 ≤ p1.length := by + have hc := Finset.card_le_card hK8sub + rw [hK8card, List.toFinset_card_of_nodup hp1.support_nodup, + SimpleGraph.Walk.length_support] at hc + omega + have hp1length : p1.length = 8 := by + rcases hp1div with ⟨d, hd⟩ + omega + obtain ⟨iv2, hiv2, hiv2le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hv2p1 + have hiv20 : iv2 ≠ 0 := by + intro h + have hv : (Sum.inl v2 : Sum V E) = Sum.inl y0 := by + rw [← hiv2, h, p1.getVert_zero] + exact hv20' (Sum.inl_injective hv) + have hiv2lt : iv2 < p1.length := by + exact @helper_hiv2lt_370 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@f2) (@v1) (@v2) (@hv21') (@p1) (@hp1div) + (@hp1length) (@iv2) (@hiv2) (@hiv2le) + have hprevAdj : H1.Adj (Sum.inl v2) (p1.getVert (iv2 - 1)) := by + have h := (p1.adj_getVert_succ (i := iv2 - 1) (by omega)).symm + have heq : iv2 - 1 + 1 = iv2 := by omega + rw [heq, hiv2] at h + exact h + have hnextAdj : H1.Adj (Sum.inl v2) (p1.getVert (iv2 + 1)) := by + have h := p1.adj_getVert_succ hiv2lt + rw [hiv2] at h + exact h + have hprevnext : p1.getVert (iv2 - 1) ≠ p1.getVert (iv2 + 1) := by + exact @helper_hprevnext_387 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@f2) (@v1) (@v2) (@p1) (@hp1) + (@hp1div) (@hp1length) (@iv2) (@hiv2le) (@hiv2lt) + obtain ⟨b, hbAdj, hbp1, hbf2⟩ : ∃ b : E, + H1.Adj (Sum.inl v2) (Sum.inr b) ∧ Sum.inr b ∈ p1.support ∧ b ≠ f2 := by + by_cases hp : p1.getVert (iv2 - 1) = Sum.inr f2 + · exact @helper_branch_396 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@gamma) (@f2) (@v2) (@p1) (@iv2) (@hnextAdj) (@hprevnext) (@hp) + · exact @helper_branch_408 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@gamma) (@f2) (@v2) (@p1) (@iv2) (@hprevAdj) (@hp) + have hbinc : Incident G v2 b := by + simpa [H1, TwoColorIncidenceGraph] using hbAdj |>.1 + have hf2inc : Incident G v2 f2 := by + unfold Incident + rw [hf2ends'] + simp [Sym2.mem_iff] + have hfbadj : AdjacentEdges G f2 b := ⟨v2, hf2inc, hbinc⟩ + have hbcolor : phi b = some N.beta := by + have hc : phi b = some gamma ∨ phi b = some N.beta := by + simpa [H1, TwoColorIncidenceGraph] using hbAdj |>.2 + exact hc.resolve_left (hproper hbf2.symm hfbadj hf2color) + obtain ⟨w, hbends⟩ := Sym2.mem_iff_exists.mp hbinc + have hbq : b ≠ q := by + exact @helper_hbq_431 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v2) (@hqends) (@hv20') (@hv24') (@b) (@w) (@hbends) + have hbf1 : b ≠ f1 := by + intro h + have hc : some N.beta = some gamma := by rw [← hbcolor, h, hf1color] + exact hgamma_beta (Option.some.inj hc).symm + let K9 : Finset (Sum V E) := insert (Sum.inr b) K8 + have hK9card : K9.card = 9 := by + rw [Finset.card_insert_of_notMem] + · rw [hK8card] + · simp [K8, hbf2, hbf1, hbq] + have hK9sub : K9 ⊆ p1.support.toFinset := by + exact @helper_hK9sub_447 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@f2) (@v1) (@v2) (@p1) + (@hK8sub) (@b) (@hbp1) + have hp1card : p1.support.toFinset.card = 9 := by + rw [List.toFinset_card_of_nodup hp1.support_nodup, + SimpleGraph.Walk.length_support, hp1length] + have hK9eq : K9 = p1.support.toFinset := by + exact Finset.eq_of_subset_of_card_le hK9sub (by rw [hK9card, hp1card]) + have hbAdjw : H1.Adj (Sum.inr b) (Sum.inl w) := by + simp [H1, TwoColorIncidenceGraph, Incident, hbends, hbcolor, Sym2.mem_iff] + have hbC1 : Sum.inr b ∈ C1 := by + rw [← hp1support'] + exact hbp1 + have hwC1 : Sum.inl w ∈ C1 := C1_of_adj hbC1 hbAdjw + have hwp1 : Sum.inl w ∈ p1.support := support_of_C1 hwC1 + have hwcases : w = y0 ∨ w = y1 ∨ w = y4 ∨ w = v1 ∨ w = v2 := by + have hwfin : Sum.inl w ∈ K9 := by + rw [hK9eq] + simpa using hwp1 + simpa [K9, K8] using hwfin + have hwy0 : w ≠ y0 := by + exact @helper_hwy0_470 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v2) (@hqends) (@hproper) (@hqcolor) (@b) (@hbcolor) (@w) + (@hbends) (@hbq) + have hwy1 : w ≠ y1 := by + exact @helper_hwy1_480 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v2) (@missing_excludes) (@b) (@hbcolor) (@w) (@hbends) + have hwy4 : w ≠ y4 := by + exact @helper_hwy4_487 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v2) (@hqends) (@hproper) (@hqcolor) (@b) (@hbcolor) (@w) + (@hbends) (@hbq) + have hwv2 : w ≠ v2 := by + intro h + exact G.loopless b v2 (by simpa [h] using hbends) + have hwv1 : w = v1 := by + exact @helper_hwv1_500 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@v1) (@v2) (@w) (@hwcases) (@hwy0) (@hwy1) (@hwy4) (@hwv2) + have hbends' : G.ends b = s(v1, v2) := by + rw [hbends, hwv1, Sym2.eq_swap] + have hfixed : FixedPairMaximalTashkinovTree G e0 phi T := by + exact @helper_hfixed_509 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) + let i0 : Fin (T.length + 1) := ⟨0, by omega⟩ + let i1 : Fin (T.length + 1) := ⟨1, by have := N.height_upper; omega⟩ + obtain ⟨hab, pmax, hpmax, hpmaxsupport, hpmaxdiv, hpmaxvertices, hchange⟩ := + ScheideMaximalKempePath G k e0 phi T T N.global.1 hfixed N.global.2.1 + i0 i1 (by simp [i0, i1]) N.alpha N.beta + (by simpa [i0] using N.alpha_missing) + (by simpa [i1] using N.beta_missing) + have hunused : TreeColorUnusedThrough phi T N.alpha i1 := by + intro r hr hrj + simp [i1] at hrj + omega + have hchangedata := hchange hunused + exact @helper_continuation_2127 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@hgamma) + (@f1) (@f2) (@v1) (@v2) (@hf1color) (@hf2color) (by assumption) (@hy01) (@hy02) (@hy03) + (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) (@ha1ends) (@ha2ends) (@ha3ends) + (@hqends) (@missing_excludes) (@ha1color) (@ha12ne) (@ha2color) (@ha23ne) (@ha3color) + (@hqcolor) (@hgamma_beta) (@hf1ends') (@hf2ends') (@hv10') (@hv11') (@hv12') (@hv13') + (@hv14') (@hv20') (@hv21') (@hv22') (@hv23') (@hv24') (@p1) (@hK8card) (@iv2) (@b) + (@hf2inc) (@hbcolor) (@w) (@hbends') (@hab) (@pmax) (@hpmaxsupport) (@hchangedata) +theorem ScheideHeightFiveOutsideLinks {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hNheight : N.height = 5) (hGheight : ScheideGraphHeight G = 5) + (gamma : Fin k) + (hgamma : gamma ∈ MissingColors G phi + (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + (f1 f2 : E) (v1 v2 : V) + (hf1ends : G.ends f1 = + s(T.vertex ⟨1, by have := N.height_upper; omega⟩, v1)) + (hf2ends : G.ends f2 = + s(T.vertex ⟨4, by have := N.height_upper; omega⟩, v2)) + (hf1color : phi f1 = some gamma) (hf2color : phi f2 = some gamma) + (_ : v1 ∈ TreeSequenceVertexSet T) + (_ : v2 ∈ TreeSequenceVertexSet T) + (hv10 : v1 ≠ T.vertex ⟨0, by have := N.height_upper; omega⟩) + (hv11 : v1 ≠ T.vertex ⟨1, by have := N.height_upper; omega⟩) + (hv12 : v1 ≠ T.vertex ⟨2, by have := N.height_upper; omega⟩) + (hv13 : v1 ≠ T.vertex ⟨3, by have := N.height_upper; omega⟩) + (hv14 : v1 ≠ T.vertex ⟨4, by have := N.height_upper; omega⟩) + (hv20 : v2 ≠ T.vertex ⟨0, by have := N.height_upper; omega⟩) + (hv21 : v2 ≠ T.vertex ⟨1, by have := N.height_upper; omega⟩) + (hv22 : v2 ≠ T.vertex ⟨2, by have := N.height_upper; omega⟩) + (hv23 : v2 ≠ T.vertex ⟨3, by have := N.height_upper; omega⟩) + (hv24 : v2 ≠ T.vertex ⟨4, by have := N.height_upper; omega⟩) : + ∃ alphaEdge betaEdge : E, + G.ends alphaEdge = s(v1, v2) ∧ + phi alphaEdge = some N.alpha ∧ + G.ends betaEdge = s(v1, v2) ∧ phi betaEdge = some N.beta ∧ alphaEdge ≠ betaEdge := by + classical + let y0 : V := T.vertex ⟨0, by have := N.height_upper; omega⟩ + let y1 : V := T.vertex ⟨1, by have := N.height_upper; omega⟩ + let y2 : V := T.vertex ⟨2, by have := N.height_upper; omega⟩ + let y3 : V := T.vertex ⟨3, by have := N.height_upper; omega⟩ + let y4 : V := T.vertex ⟨4, by have := N.height_upper; omega⟩ + let r1 : Fin T.length := ⟨1, by have := N.height_upper; omega⟩ + let r2 : Fin T.length := ⟨2, by have := N.height_upper; omega⟩ + let r3 : Fin T.length := ⟨3, by have := N.height_upper; omega⟩ + let a1 : E := T.edge r1 + let a2 : E := T.edge r2 + let a3 : E := T.edge r3 + let q : E := N.closingEdge + have hy01 : y0 ≠ y1 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy02 : y0 ≠ y2 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy03 : y0 ≠ y3 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy04 : y0 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy12 : y1 ≠ y2 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy13 : y1 ≠ y3 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy14 : y1 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy23 : y2 ≠ y3 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy24 : y2 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have hy34 : y3 ≠ y4 := by + intro h + have := T.vertex_injective h + simp [] at this + have ha1ends : G.ends a1 = s(y1, y2) := by + simpa [a1, r1, y1, y2, hNheight] using N.trunk_edge_ends r1 (by simp [r1]) + (by simp [r1, hNheight]) + have ha2ends : G.ends a2 = s(y2, y3) := by + simpa [a2, r2, y2, y3, hNheight] using N.trunk_edge_ends r2 (by simp [r2]) + (by simp [r2, hNheight]) + have ha3ends : G.ends a3 = s(y3, y4) := by + simpa [a3, r3, y3, y4, hNheight] using N.trunk_edge_ends r3 (by simp [r3]) + (by simp [r3, hNheight]) + have hqends : G.ends q = s(y4, y0) := by + exact @helper_hqends_137 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) + have hproper : IsProperEdgeColoring G phi := N.global.1.2.2.2.1 + have missing_excludes {c : Fin k} {v : V} {f : E} + (hc : c ∈ MissingColors G phi v) (hinc : Incident G v f) : + phi f ≠ some c := by + exact @helper_missing_excludes_146 (@V) (@E) inferInstance inferInstance (@G) (@k) (@phi) + (@c) (@v) (@f) (@hc) (@hinc) + have edge_color_of_closing_support (f : E) + (hf : Sum.inr f ∈ N.closingPath.support) : + phi f = some N.alpha ∨ phi f = some N.beta := by + exact @helper_edge_color_of_closing_support_156 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@f) (@hf) + have ha1support : Sum.inr a1 ∈ N.closingPath.support := by + apply (N.closingPath_edges a1).2 + exact Or.inr ⟨r1, by simp [r1], by simp [r1, hNheight], rfl⟩ + have ha2support : Sum.inr a2 ∈ N.closingPath.support := by + apply (N.closingPath_edges a2).2 + exact Or.inr ⟨r2, by simp [r2], by simp [r2, hNheight], rfl⟩ + have ha3support : Sum.inr a3 ∈ N.closingPath.support := by + apply (N.closingPath_edges a3).2 + exact Or.inr ⟨r3, by simp [r3], by simp [r3, hNheight], rfl⟩ + have hqsupport : Sum.inr q ∈ N.closingPath.support := by + exact (N.closingPath_edges q).2 (Or.inl rfl) + have ha1color : phi a1 = some N.alpha := by + exact @helper_ha1color_190 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@ha1ends) (@missing_excludes) + (@edge_color_of_closing_support) (@ha1support) + have ha1a2 : AdjacentEdges G a1 a2 := by + exact @helper_ha1a2_200 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@ha1ends) (@ha2ends) + have ha12ne : a1 ≠ a2 := by + intro h + exact (show r1 ≠ r2 by simp [r1, r2]) (T.edge_injective (by simpa [a1, a2] using h)) + have ha2color : phi a2 = some N.beta := by + rcases edge_color_of_closing_support a2 ha2support with h | h + · exact False.elim ((hproper ha12ne ha1a2 ha1color) h) + · exact h + have ha2a3 : AdjacentEdges G a2 a3 := by + exact @helper_ha2a3_213 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@ha2ends) (@ha3ends) + have ha23ne : a2 ≠ a3 := by + intro h + exact (show r2 ≠ r3 by simp [r2, r3]) (T.edge_injective (by simpa [a2, a3] using h)) + have ha3color : phi a3 = some N.alpha := by + rcases edge_color_of_closing_support a3 ha3support with h | h + · exact h + · exact False.elim ((hproper ha23ne ha2a3 ha2color) h) + have ha3q : AdjacentEdges G a3 q := by + exact @helper_ha3q_226 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@ha3ends) (@hqends) + have ha3qne : a3 ≠ q := by + exact @helper_ha3qne_232 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@hy03) (@hy34) (@ha3ends) (@hqends) + have hqcolor : phi q = some N.beta := by + rcases edge_color_of_closing_support q hqsupport with h | h + · exact False.elim ((hproper ha3qne ha3q ha3color) h) + · exact h + have hgamma_beta : gamma ≠ N.beta := by + exact @helper_hgamma_beta_243 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@v1) (@hf1ends) (@hf1color) + (@missing_excludes) + have hf1ends' : G.ends f1 = s(y1, v1) := by simpa [y1] using hf1ends + have hf2ends' : G.ends f2 = s(y4, v2) := by simpa [y4] using hf2ends + have hv10' : v1 ≠ y0 := by simpa [y0] using hv10 + have hv11' : v1 ≠ y1 := by simpa [y1] using hv11 + have hv12' : v1 ≠ y2 := by simpa [y2] using hv12 + have hv13' : v1 ≠ y3 := by simpa [y3] using hv13 + have hv14' : v1 ≠ y4 := by simpa [y4] using hv14 + have hv20' : v2 ≠ y0 := by simpa [y0] using hv20 + have hv21' : v2 ≠ y1 := by simpa [y1] using hv21 + have hv22' : v2 ≠ y2 := by simpa [y2] using hv22 + have hv23' : v2 ≠ y3 := by simpa [y3] using hv23 + have hv24' : v2 ≠ y4 := by simpa [y4] using hv24 + have hf12ne : f1 ≠ f2 := by + exact @helper_hf12ne_263 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@f1) (@f2) (@v1) (@v2) (@hy14) (@hf1ends') (@hf2ends') + (@hv21') + have hv12ne : v1 ≠ v2 := by + exact @helper_hv12ne_270 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hNheight) (@gamma) (@f1) (@f2) (@v1) (@v2) (@hf1color) (@hf2color) + (@hproper) (@hf1ends') (@hf2ends') (@hf12ne) + have hqf1 : q ≠ f1 := by + intro h + have hc : some N.beta = some gamma := by rw [← hqcolor, h, hf1color] + exact hgamma_beta (Option.some.inj hc).symm + have hqf2 : q ≠ f2 := by + intro h + have hc : some N.beta = some gamma := by rw [← hqcolor, h, hf2color] + exact hgamma_beta (Option.some.inj hc).symm + obtain ⟨p1, hp1, hp1support, hp1div, hp1vertices, hp1bound⟩ := + ScheideKempePathHeightBound G k e0 phi T N.global gamma N.beta + hgamma N.beta_missing + have hp1bound' : p1.length / 2 + 1 ≤ 5 := by + simpa [hGheight] using hp1bound + let H1 := TwoColorIncidenceGraph G phi gamma N.beta + let C1 := TwoColorComponent G phi gamma N.beta (Sum.inl y0) + have hp1support' : {z | z ∈ p1.support} = C1 := by + simpa [C1, y0] using hp1support + have hC1root : Sum.inl y0 ∈ C1 := by + change Sum.inl y0 ∈ H1.connectedComponentMk (Sum.inl y0) + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + exact @helper_continuation_1992 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@hgamma) + (@f1) (@f2) (@v1) (@v2) (@hf1color) (@hf2color) (by assumption) (@hy01) (@hy02) (@hy03) + (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) (@ha1ends) (@ha2ends) (@ha3ends) + (@hqends) (@hproper) (@missing_excludes) (@ha1color) (@ha12ne) (@ha2color) (@ha23ne) + (@ha3color) (@hqcolor) (@hgamma_beta) (@hf1ends') (@hf2ends') (@hv10') (@hv11') (@hv12') + (@hv13') (@hv14') (@hv20') (@hv21') (@hv22') (@hv23') (@hv24') (@hf12ne) (@hv12ne) (@hqf1) + (@hqf2) (@p1) (@hp1) (@hp1div) (@hp1bound) (@hp1support') (@hC1root) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideKempePathHeightBound.lean b/LeanPool/GoldbergSeymour/ScheideKempePathHeightBound.lean new file mode 100644 index 0000000000..ab628f8547 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideKempePathHeightBound.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal +public import LeanPool.GoldbergSeymour.ScheideMaximumExtensionNormalWitness +public import LeanPool.GoldbergSeymour.ScheideMaximalExtendsEveryTree +public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath +public import LeanPool.GoldbergSeymour.ScheideReversedKempePathTree +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Kempe Path Height Bound + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideKempePathHeightBound {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) + (alpha beta : Fin k) + (halpha : alpha ∈ MissingColors G phi + (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + (hbeta : beta ∈ MissingColors G phi + (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩)) : + ∃ p : + (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + (Sum.inl (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩)), + p.IsPath ∧ + {x | x ∈ p.support} = + TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) ∧ + 4 ∣ p.length ∧ + (∀ v : V, Sum.inl v ∈ p.support → v ∈ TreeSequenceVertexSet T) ∧ + p.length / 2 + 1 ≤ ScheideGraphHeight G := by + classical + have hmax : FixedPairMaximalTashkinovTree G e0 phi T := + ScheideGlobalMaximumFixedPairMaximal G k e0 phi T hglobal + obtain ⟨_, p, hp, hsupport, hdiv, hvertices, _⟩ := + ScheideMaximalKempePath G k e0 phi T T hglobal.1 hmax hglobal.2.1 + ⟨0, Nat.zero_lt_succ T.length⟩ + ⟨1, Nat.succ_lt_succ T.positive⟩ (by norm_num) + alpha beta halpha hbeta + obtain ⟨C⟩ := ScheideReversedKempePathTree G k e0 phi T hglobal.1 + alpha beta halpha hbeta p hp hdiv + obtain ⟨T', N, _, _, _, hN⟩ := + ScheideMaximumExtensionNormalWitness G k e0 phi T hglobal hmax + alpha beta halpha hbeta p hp C + have hheight : p.length / 2 + 1 ≤ ScheideGraphHeight G := by + rw [← hN] + have hcard : T'.length + 1 ≤ Fintype.card V := by + simpa using Fintype.card_le_of_injective T'.vertex T'.vertex_injective + have hNcard : N.height < Fintype.card V + 1 := + lt_of_le_of_lt N.height_upper (by omega) + let heights := (Finset.range (Fintype.card V + 1)).filter fun q => + ∃ (m : ℕ) (f : E) (c : PartialEdgeColoring E m) + (S : TreeSequence G f), + ∃ M : NormalGlobalMaximumTriple G m f c S, M.height = q + have hmem : N.height ∈ heights := by + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_range.mpr hNcard, k, e0, phi, T', N, rfl⟩ + unfold ScheideGraphHeight + dsimp only + apply Finset.le_max' + exact Finset.mem_insert_of_mem hmem + exact ⟨p, hp, hsupport, hdiv, hvertices, hheight⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideLargeHeightElementary.lean b/LeanPool/GoldbergSeymour/ScheideLargeHeightElementary.lean new file mode 100644 index 0000000000..99508ff4f4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideLargeHeightElementary.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Critical +public import LeanPool.GoldbergSeymour.Elementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.GlobalMaximumTripleExists +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ScheideBalancedExists +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd +public import LeanPool.GoldbergSeymour.ScheideLargeHeightFullTrunk +public import LeanPool.GoldbergSeymour.ScheideLargeHeightOneTailPair +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Scheide Large Height Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideLargeHeightElementary {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) + (hcritical : Critical G) (hindex : ChromaticIndex G = k + 1) + (hdegree : MaximumDegree G + 1 ≤ k) + (hnoisolated : ∀ v : V, ∃ e : E, Incident G v e) + (hlarge : TashkinovOrder G - 4 < ScheideGraphHeight G) : + Elementary G := by + classical + let : DecidableEq V := Classical.decEq V + obtain ⟨e0, phi, T, hglobal⟩ := + GlobalMaximumTripleExists G k hcritical hindex hdegree + obtain ⟨e1, psi, S, N, hbalanced⟩ := + ScheideBalancedExists G k e0 phi T hglobal + have hcard : (TreeSequenceVertexSet S).card = S.length + 1 := by + unfold TreeSequenceVertexSet + rw [Finset.card_image_of_injective Finset.univ S.vertex_injective] + simp + have hheight_le : ScheideGraphHeight G ≤ TashkinovOrder G := by + calc + ScheideGraphHeight G = N.height := hbalanced.1.symm + _ ≤ S.length + 1 := N.height_upper + _ = (TreeSequenceVertexSet S).card := hcard.symm + _ = TashkinovOrder G := N.global.2.2 + have hheight_odd : Odd (ScheideGraphHeight G) := + (ScheideGraphHeightOdd G k e0 phi T hglobal).2 + have horder_odd : Odd (TashkinovOrder G) := + N.global.2.2 ▸ + (ScheideGlobalMaximumOrder G k e1 psi S N.global).2.2.1 + rcases hheight_odd with ⟨a, ha⟩ + rcases horder_odd with ⟨b, hb⟩ + have hcases : ScheideGraphHeight G = TashkinovOrder G ∨ + ScheideGraphHeight G + 2 = TashkinovOrder G := by + omega + rcases hcases with heq | heq + · exact ScheideLargeHeightFullTrunk G k e1 psi S N hbalanced + hnoisolated heq + · exact ScheideLargeHeightOneTailPair G k e1 psi S N hbalanced + hnoisolated heq + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideLargeHeightFullTrunk.lean b/LeanPool/GoldbergSeymour/ScheideLargeHeightFullTrunk.lean new file mode 100644 index 0000000000..e9983f3e47 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideLargeHeightFullTrunk.lean @@ -0,0 +1,245 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.Elementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainDepartureReturn +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists +public import LeanPool.GoldbergSeymour.ScheideDepartureReturn +public import LeanPool.GoldbergSeymour.ScheideExitNoFree +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.CriticalGraphElementaryWitness + +/-! +# Scheide Large Height Full Trunk + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideLargeHeightFullTrunk {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hbalanced : BalancedGlobalMaximumTriple N) + (hnoisolated : ∀ v : V, ∃ e : E, Incident G v e) + (hheight : ScheideGraphHeight G = TashkinovOrder G) : + Elementary G := by + classical + let : DecidableEq V := Classical.decEq V + have hcard : (TreeSequenceVertexSet T).card = T.length + 1 := by + unfold TreeSequenceVertexSet + rw [Finset.card_image_iff.mpr (by + intro a ha b hb hab + exact T.vertex_injective hab)] + simp + have horder := ScheideGlobalMaximumOrder G k e0 phi T N.global + have hheight : N.height = T.length + 1 := by + calc + N.height = ScheideGraphHeight G := hbalanced.1 + _ = TashkinovOrder G := hheight + _ = (TreeSequenceVertexSet T).card := horder.1 + _ = T.length + 1 := hcard + have hheight_eq : N.height = T.length + 1 := hheight + have htrunk : ∀ j : Fin T.length, 1 ≤ j.val → + ∃ c : Fin k, phi (T.edge j) = some c ∧ (c = N.alpha ∨ c = N.beta) := by + intro j hj + have hjh : j.val + 2 ≤ N.height := by rw [hheight_eq]; omega + have hs := (N.closingPath_edges (T.edge j)).2 + (Or.inr ⟨j, hj, hjh, rfl⟩) + have he := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hs + rcases he with ⟨n, hnedge, hn⟩ + have hnpos : 0 < n := by + by_contra hnpos + have hnzero : n = 0 := by omega + subst n + have hz := N.closingPath.getVert_zero + rw [hz] at hnedge + simp at hnedge + have hnlt : n < N.closingPath.length := by + by_contra hnlt + have hlen := N.closingPath_length + rw [hheight_eq] at hlen + have hh := N.height_lower + have hstart := N.closingPath.getVert_of_length_le (i := n) (by omega) + rw [hnedge] at hstart + simp at hstart + have hn' := N.closingPath.adj_getVert_succ (i := n - 1) (by omega) + have hn'' : n - 1 + 1 = n := by omega + have hnedge' : N.closingPath.getVert (n - 1 + 1) = Sum.inr (T.edge j) := by + simpa [hn''] using hnedge + rw [hnedge'] at hn' + cases hx : N.closingPath.getVert (n - 1) with + | inl v => + rw [hx] at hn' + simp only [TwoColorIncidenceGraph] at hn' + rcases hn' with ⟨_, h | h⟩ + · exact ⟨N.alpha, h, Or.inl rfl⟩ + · exact ⟨N.beta, h, Or.inr rfl⟩ + | inr e => + rw [hx] at hn' + simp [TwoColorIncidenceGraph] at hn' + have hdef : DefectiveColors G phi (TreeSequenceVertexSet T) = ∅ := by + by_contra hnon + have hmem := Finset.nonempty_iff_ne_empty.mpr hnon + rcases hmem with ⟨delta, hdelta⟩ + have hfree : ∀ v : V, v ∈ TreeSequenceVertexSet T → + ∃ gamma, gamma ∈ MissingColors G phi v ∧ + gamma ∈ TreeFreeColors phi T := by + intro v hv + have hmissing : 1 ≤ (MissingColors G phi v).card := by + have hm := ScheideGlobalMaximumMissingCounts G k e0 phi T N.global v hv + by_cases hi : Incident G v e0 + · have hm' := (hm.1 hi).2 + omega + · exact (hm.2 hi).2 + have hpos : 0 < (MissingColors G phi v).card := by omega + obtain ⟨gamma, hgamma⟩ := Finset.card_pos.mp hpos + let vzero : V := T.vertex ⟨0, T.length.succ_pos⟩ + let vone : V := T.vertex ⟨1, by omega⟩ + have hvzero : vzero ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet, vzero] + have hvone : vone ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet, vone] + have hne : vzero ≠ vone := by + intro heq + have hi := T.vertex_injective heq + simp [] at hi + have hinczero : Incident G vzero e0 := by + unfold Incident + rw [← T.first_edge] + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + have iz : i = ⟨0, by omega⟩ := Fin.eq_zero i + subst i + rw [hi] + simp only [Sym2.mem_iff] + exact Or.inr rfl + have hincone : Incident G vone e0 := by + unfold Incident + rw [← T.first_edge] + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + have iz : i = ⟨0, by omega⟩ := Fin.eq_zero i + subst i + rw [hi] + simp only [Sym2.mem_iff] + exact Or.inl rfl + have hgamma' : ∃ c, c ∈ MissingColors G phi v ∧ + c ≠ N.alpha ∧ c ≠ N.beta := by + by_cases hv0 : v = vzero + · subst v + have hm := (ScheideGlobalMaximumMissingCounts G k e0 phi T N.global + vzero hvzero).1 hinczero + obtain ⟨c, hc, hca⟩ := Finset.exists_mem_ne hm.2 N.alpha + have hcb : c ≠ N.beta := by + intro hce + have he := horder.2.2.2.1 hvzero hvone hne + exact Finset.disjoint_left.mp he hc (by simpa [hce, vzero] using N.beta_missing) + exact ⟨c, hc, hca, hcb⟩ + · by_cases hv1 : v = vone + · have hm := (ScheideGlobalMaximumMissingCounts G k e0 phi T N.global + vone hvone).1 hincone + obtain ⟨c, hc, hcb⟩ := Finset.exists_mem_ne hm.2 N.beta + have hca : c ≠ N.alpha := by + intro hce + have he := horder.2.2.2.1 hvone hvzero hne.symm + exact Finset.disjoint_left.mp he hc (by simpa [hce, vzero] using N.alpha_missing) + exact ⟨c, by simpa [hv1] using hc, hca, hcb⟩ + · have hca : gamma ≠ N.alpha := by + intro h + exact Finset.disjoint_left.mp + (horder.2.2.2.1 hv hvzero hv0) hgamma + (by simpa [h, vzero] using N.alpha_missing) + have hcb : gamma ≠ N.beta := by + intro h + exact Finset.disjoint_left.mp + (horder.2.2.2.1 hv hvone hv1) hgamma + (by simpa [h, vone] using N.beta_missing) + exact ⟨gamma, hgamma, hca, hcb⟩ + rcases hgamma' with ⟨gamma, hgamma, hnotzero, hnotone⟩ + have htm : gamma ∈ TreeMissingColors phi T := by + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + exact ⟨v, hv, hgamma⟩ + have htu : gamma ∉ TreeUsedColors phi T := by + intro hu + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hu + rcases hu with ⟨j, hj, he⟩ + obtain ⟨c, hc, hcb⟩ := htrunk j hj + have heq := Option.some.inj (he.symm.trans hc) + rcases hcb with rfl | rfl + · exact hnotzero heq + · exact hnotone heq + refine ⟨gamma, hgamma, ?_⟩ + change gamma ∈ TreeMissingColors phi T \ TreeUsedColors phi T + exact Finset.mem_sdiff.mpr ⟨htm, htu⟩ + let vzero : V := T.vertex ⟨0, T.length.succ_pos⟩ + have hvzero : vzero ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet, vzero] + obtain ⟨gamma, hgamma, hfreegamma⟩ := hfree vzero hvzero + obtain ⟨z, p, hp⟩ := ScheideDefectiveChainPathExists G k e0 phi T N.global + delta gamma hdelta hfreegamma vzero hvzero hgamma + obtain ⟨i1, i2, v1, v2, hreturn⟩ := + ScheideDefectiveChainDepartureReturn G k e0 phi T N.global delta gamma + hdelta hfreegamma vzero hvzero hgamma z p hp + rcases hreturn with ⟨hpathret, hi1, hvout, hbefore, hlt, hi2, hv2, hafter⟩ + have hexit : ScheideExitVertex T phi v2 := by + exact ⟨vzero, gamma, delta, hvzero, hgamma, hdelta, z, p, hpathret, + ⟨i2, hi2, hv2, hafter⟩⟩ + have hmemexit : v2 ∈ ScheideExitVertices T phi := by + simp [ScheideExitVertices, hexit] + have hdis := ScheideExitNoFree G k e0 phi T N.global v2 hmemexit + obtain ⟨gamma2, hgamma2, hfree2⟩ := hfree v2 hv2 + exact (Finset.disjoint_left.mp hdis) hgamma2 hfree2 + have hstrong := (ScheideGlobalMaximumBoundaryFacts G k e0 phi T N.global).1 hdef + have hends : ∀ v : V, v ∈ G.ends e0 → v ∈ TreeSequenceVertexSet T := by + intro v hv + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + have iz : i = ⟨0, by omega⟩ := Fin.eq_zero i + subst i + rw [← T.first_edge] at hv + rw [hi] at hv + simp only [Sym2.mem_iff] at hv + rcases hv with hv | hv + · subst v + simp [TreeSequenceVertexSet] + · apply Finset.mem_image.mpr + exact ⟨_, Finset.mem_univ _, hv.symm⟩ + have hw : ∃ (e : E) (p : PartialEdgeColoring E k) (X : Finset V), + IsProperEdgeColoring G p ∧ IsOneEdgeUncolored p e ∧ + (∀ v, v ∈ G.ends e → v ∈ X) ∧ + ColoredVertexSetElementary G p X ∧ + ColoredVertexSetStronglyClosed G p X := + ⟨e0, phi, TreeSequenceVertexSet T, N.global.1.2.2.2.1, + N.global.1.2.2.2.2, hends, horder.2.2.2.1, hstrong⟩ + have hc := (egraph2 G k N.global.1.1 N.global.1.2.1 N.global.1.2.2.1 hnoisolated).2.2.2 hw + exact (egraph2 G k N.global.1.1 N.global.1.2.1 N.global.1.2.2.1 hnoisolated).1.mpr + ((egraph2 G k N.global.1.1 N.global.1.2.1 N.global.1.2.2.1 hnoisolated).2.1.mpr hc) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideLargeHeightOneTailPair.lean b/LeanPool/GoldbergSeymour/ScheideLargeHeightOneTailPair.lean new file mode 100644 index 0000000000..2d12a82dc8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideLargeHeightOneTailPair.lean @@ -0,0 +1,1113 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.Elementary +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ScheideExitNoFree +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal +public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound +public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralLemma +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Large Height One Tail Pair + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation929Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T), BalancedGlobalMaximumTriple N → ( + ∀ (v : V), + ∃ (e : E), Incident G v e) → ScheideGraphHeight G + (2 : ℕ) = TashkinovOrder G → + let this : DecidableEq V := Classical.decEq V; + ∀ (hcard : (TreeSequenceVertexSet T).card = T.length + (1 : ℕ)) (horder : TashkinovOrder G = + (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd + (TreeSequenceVertexSet T).card ∧ ColoredVertexSetElementary G phi (TreeSequenceVertexSet + T) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) + = N.height + (2 : ℕ)), + let firstTail : Fin T.length := (⟨N.height - (1 : ℕ), + by omega + ⟩ : Fin T.length); + let secondTail : Fin T.length := (⟨N.height, + by omega + ⟩ : Fin T.length); + let firstNew : Fin (T.length + (1 : ℕ)) := (⟨N.height, + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let secondNew : Fin (T.length + (1 : ℕ)) := (⟨N.height + (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (a0 : Fin ((↑firstTail : ℕ) + (1 : ℕ))) (gamma : Fin k), phi (T.edge firstTail) = some gamma + → + let gammaBase : Fin N.height := (⟨(↑a0 : ℕ), + have ha : (↑a0 : ℕ) < (↑firstTail : ℕ) + (1 : ℕ) := a0.isLt; + have hh : (2 : ℕ) ≤ N.height := N.height_lower; Eq.mpr (id rfl) (Eq.mp (congrArg (LT.lt (↑a0 : + ℕ)) (Nat.sub_add_cancel (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ N.height) => ( + by omega + )))) ha)⟩ : Fin N.height); gamma ∈ MissingColors G phi (T.vertex (Fin.castLE N.height_upper + gammaBase)) → + ∀ (m : ℕ) (hm : N.height = (2 : ℕ) * m + (1 : ℕ)), phi (T.edge secondTail) = some gamma → + ∀ (base0raw : Fin ((↑firstTail : ℕ) + (1 : ℕ))), + let base0 : Fin N.height := (⟨(↑base0raw : ℕ), + have hb : (↑base0raw : ℕ) < (↑firstTail : ℕ) + (1 : ℕ) := base0raw.isLt; + have hh : (2 : ℕ) ≤ N.height := N.height_lower; Eq.mpr (id rfl) (Eq.mp (congrArg (LT.lt + (↑base0raw : ℕ)) (Nat.sub_add_cancel (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + N.height) => + by omega + ))) hb)⟩ : Fin N.height); G.ends (T.edge firstTail) = s(T.vertex (Fin.castLE N.height_upper + base0), T.vertex firstNew) → + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (w : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))), w.IsPath → {z : V ⊕ E | z ∈ w.support} = TwoColorComponent G phi N.alpha + N.beta (Sum.inl (T.vertex i0)) → (4 : ℕ) ∣ w.length → ( + ∀ (v : V), Sum.inl v ∈ w.support → v ∈ TreeSequenceVertexSet T) → (TreeColorUnusedThrough phi + T N.alpha i1 → IsProperEdgeColoring G (TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl + (T.vertex i0))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi N.alpha N.beta (Sum.inl + (T.vertex i0))) e0 ∧ TashkinovTree G e0 (TwoColorComponentSwap G phi N.alpha N.beta + (Sum.inl (T.vertex i0))) T) → + ∀ (P : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), P.IsPath → (4 : ℕ) ∣ P.length + → ( + ∀ (v : V), Sum.inl v ∈ P.support → v ∈ TreeSequenceVertexSet T) → P.length / (2 : ℕ) + (1 : ℕ) + ≤ ScheideGraphHeight G → ( + ∀ {z : V ⊕ E}, z ∈ N.closingPath.support → z ∈ P.support) → (phi (T.edge firstTail) = some + N.alpha ∨ phi (T.edge firstTail) = some N.beta → Sum.inl (T.vertex firstNew) ∈ P.support) + → Sum.inl (T.vertex firstNew) ∉ N.closingPath.support → Elementary G + +private theorem helper_free_of_ne_gamma_377.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T), + let _ : DecidableEq V := Classical.decEq V; + ∀ (hcard : (TreeSequenceVertexSet T).card = T.length + (1 : ℕ)) (horder : TashkinovOrder G = + (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd + (TreeSequenceVertexSet T).card ∧ ColoredVertexSetElementary G phi (TreeSequenceVertexSet + T) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) + = N.height + (2 : ℕ)), + let firstTail : Fin T.length := (⟨N.height - (1 : ℕ), + by omega + ⟩ : Fin T.length); + let secondTail : Fin T.length := (⟨N.height, + by omega + ⟩ : Fin T.length); + ∀ (a0 : Fin ((↑firstTail : ℕ) + (1 : ℕ))) (gamma : Fin k), + let gammaBase : Fin N.height := (⟨(↑a0 : ℕ), + have ha : (↑a0 : ℕ) < (↑firstTail : ℕ) + (1 : ℕ) := a0.isLt; + have hh : (2 : ℕ) ≤ N.height := N.height_lower; Eq.mpr (id rfl) (Eq.mp (congrArg (LT.lt (↑a0 : + ℕ)) (Nat.sub_add_cancel (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ N.height) => + by omega + ))) ha)⟩ : Fin N.height); gamma ∈ MissingColors G phi (T.vertex (Fin.castLE N.height_upper + gammaBase)) → + ∀ (m : ℕ) (hm : N.height = (2 : ℕ) * m + (1 : ℕ)), + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (_ : Fin + ((↑secondTail : ℕ) + (1 : ℕ))), + let X : Finset V := TreeSequenceVertexSet T; + let yzero : V := T.vertex (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let yone : V := T.vertex (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let ygamma : V := T.vertex (Fin.castLE N.height_upper gammaBase); yzero ∈ X → yone ∈ X → + ygamma ∈ X → yzero ≠ yone → Incident G yzero e0 → Incident G yone e0 → + ColoredVertexSetElementary G phi X → ( + ∀ {v : V}, v ∈ X → + ∀ {c : Fin k}, c ∈ MissingColors G phi v → c ≠ N.alpha → c ≠ N.beta → c ≠ gamma → c ∈ + TreeFreeColors phi T) → + ∀ v ∈ X, v ≠ ygamma → + ∃ c ∈ MissingColors G phi v, c ∈ TreeFreeColors phi T := by + classical + intro V E _ _ _ G k e0 phi T N this hcard horder hlength firstTail secondTail a0 gamma + gammaBase hgammaMissing m hm i0 i1 _ P base1raw X yzero yone ygamma hyzero hyone hygamma + hyzero_ne_yone hinczero hincone helem color_is_free v hv hvGamma + by_cases hv0 : v = yzero + · subst v + have hm := (ScheideGlobalMaximumMissingCounts G k e0 phi T N.global + yzero (by simpa [X] using hyzero)).1 hinczero + obtain ⟨c, hc, hca⟩ := Finset.exists_mem_ne hm.2 N.alpha + have hcb : c ≠ N.beta := by + intro h + have hd := helem hyzero hyone hyzero_ne_yone + exact (Finset.disjoint_left.mp hd) hc + (by simpa [h, yone] using N.beta_missing) + have hcg : c ≠ gamma := by + intro h + have hd := helem hyzero hygamma hvGamma + exact (Finset.disjoint_left.mp hd) hc + (by simpa [h, ygamma] using hgammaMissing) + exact ⟨c, hc, color_is_free hyzero hc hca hcb hcg⟩ + · by_cases hv1 : v = yone + · subst v + have hm := (ScheideGlobalMaximumMissingCounts G k e0 phi T N.global + yone (by simpa [X] using hyone)).1 hincone + obtain ⟨c, hc, hcb⟩ := Finset.exists_mem_ne hm.2 N.beta + have hca : c ≠ N.alpha := by + intro h + have hd := helem hyone hyzero hyzero_ne_yone.symm + exact (Finset.disjoint_left.mp hd) hc + (by simpa [h, yzero] using N.alpha_missing) + have hcg : c ≠ gamma := by + intro h + have hd := helem hyone hygamma hvGamma + exact (Finset.disjoint_left.mp hd) hc + (by simpa [h, ygamma] using hgammaMissing) + exact ⟨c, hc, color_is_free hyone hc hca hcb hcg⟩ + · have hmissing : 1 ≤ (MissingColors G phi v).card := by + have hm := ScheideGlobalMaximumMissingCounts G k e0 phi T N.global + v (by simpa [X] using hv) + by_cases hi : Incident G v e0 + · have htwo := (hm.1 hi).2 + omega + · exact (hm.2 hi).2 + obtain ⟨c, hc⟩ := Finset.card_pos.mp (by omega : + 0 < (MissingColors G phi v).card) + have hca : c ≠ N.alpha := by + intro h + have hd := helem hv hyzero hv0 + exact (Finset.disjoint_left.mp hd) hc + (by simpa [h, yzero] using N.alpha_missing) + have hcb : c ≠ N.beta := by + intro h + have hd := helem hv hyone hv1 + exact (Finset.disjoint_left.mp hd) hc + (by simpa [h, yone] using N.beta_missing) + have hcg : c ≠ gamma := by + intro h + have hd := helem hv hygamma hvGamma + exact (Finset.disjoint_left.mp hd) hc + (by simpa [h, ygamma] using hgammaMissing) + exact ⟨c, hc, color_is_free hv hc hca hcb hcg⟩ + +private theorem helper_path_length_contradiction_328.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T), BalancedGlobalMaximumTriple N → + ScheideGraphHeight G + (2 : ℕ) = TashkinovOrder G → + let _ : DecidableEq V := Classical.decEq V; + ∀ (hcard : (TreeSequenceVertexSet T).card = T.length + (1 : ℕ)) (horder : TashkinovOrder G = + (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd + (TreeSequenceVertexSet T).card ∧ ColoredVertexSetElementary G phi (TreeSequenceVertexSet + T) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) + = N.height + (2 : ℕ)), + let firstNew : Fin (T.length + (1 : ℕ)) := (⟨N.height, + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (m : ℕ) (hm : N.height = (2 : ℕ) * m + (1 : ℕ)), + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (P : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), P.IsPath → (4 : ℕ) + ∣ P.length → P.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G → ( + ∀ {z : V ⊕ E}, z ∈ N.closingPath.support → z ∈ P.support) → Sum.inl (T.vertex firstNew) ∉ + N.closingPath.support → Sum.inl (T.vertex firstNew) ∈ P.support → False := by + classical + intro V E _ _ _ G k e0 phi T N hbalanced hheight this hcard horder hlength firstNew m hm i0 i1 + _ P hPpath hPdiv hPbound closing_mem_P hfirstNewNotClosing hnew + let S : Finset (Sum V E) := + insert (Sum.inl (T.vertex firstNew)) N.closingPath.support.toFinset + have hSsub : S ⊆ P.support.toFinset := by + intro z hz + simp only [S, Finset.mem_insert, List.mem_toFinset] at hz ⊢ + rcases hz with rfl | hz + · exact hnew + · exact closing_mem_P hz + have hScard : S.card = N.closingPath.length + 2 := by + rw [show S = insert (Sum.inl (T.vertex firstNew)) + N.closingPath.support.toFinset by rfl, + Finset.card_insert_of_notMem (by + simpa only [List.mem_toFinset] using hfirstNewNotClosing), + List.toFinset_card_of_nodup N.closingPath_isPath.support_nodup, + SimpleGraph.Walk.length_support] + have hc := Finset.card_le_card hSsub + rw [hScard, List.toFinset_card_of_nodup hPpath.support_nodup, + SimpleGraph.Walk.length_support] at hc + rcases hPdiv with ⟨d, hd⟩ + have hbound : P.length / 2 + 1 ≤ N.height := by + rw [hbalanced.1] + exact hPbound + have hcloseLength := N.closingPath_length + omega + +private theorem helper_hbase1lt_366.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hcard : (TreeSequenceVertexSet T).card + = T.length + (1 : ℕ)) (horder : TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : + ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) = N.height + (2 : ℕ)), + let firstTail : Fin T.length := (⟨N.height - (1 : ℕ), + by omega + ⟩ : Fin T.length); + let secondTail : Fin T.length := (⟨N.height, + by omega + ⟩ : Fin T.length); + let firstNew : Fin (T.length + (1 : ℕ)) := (⟨N.height, + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (gamma : Fin k), phi (T.edge firstTail) = some gamma → + ∀ (m : ℕ) (hm : N.height = (2 : ℕ) * m + (1 : ℕ)), phi (T.edge secondTail) = some gamma → + ∀ (base0raw : Fin ((↑firstTail : ℕ) + (1 : ℕ))), + let base0 : Fin N.height := (⟨(↑base0raw : ℕ), + have hb : (↑base0raw : ℕ) < (↑firstTail : ℕ) + (1 : ℕ) := base0raw.isLt; + have hh : (2 : ℕ) ≤ N.height := N.height_lower; Eq.mpr (id rfl) (Eq.mp (congrArg (LT.lt + (↑base0raw : ℕ)) (Nat.sub_add_cancel (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + N.height) => + by omega + ))) hb)⟩ : Fin N.height); G.ends (T.edge firstTail) = s(T.vertex (Fin.castLE N.height_upper + base0), T.vertex firstNew) → + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (base1raw : Fin + ((↑secondTail : ℕ) + (1 : ℕ))), G.ends (T.edge secondTail) = s(T.vertex secondTail.succ, + T.vertex (base1raw.castLT (Nat.lt_trans base1raw.isLt (Nat.succ_lt_succ + secondTail.isLt)))) → (↑base1raw : ℕ) < N.height := by + classical + intro V E _ _ _ G k e0 phi T N hcard horder hlength firstTail secondTail firstNew gamma + hfirstColor m hm hsecondColor base0raw base0 hfirstEnds i0 i1 _ P base1raw hbase1raw + by_contra hn + have heq : base1raw.val = N.height := by + have hb := base1raw.isLt + simp [secondTail] at hb + omega + have hinc0 : Incident G (T.vertex firstNew) (T.edge firstTail) := by + simp [Incident, hfirstEnds] + have hcast : T.vertex (Fin.castLT base1raw + (Nat.lt_trans base1raw.isLt + (Nat.succ_lt_succ secondTail.isLt))) = T.vertex firstNew := by + apply congrArg T.vertex + apply Fin.ext + exact heq + have hinc1 : Incident G (T.vertex firstNew) (T.edge secondTail) := by + unfold Incident + rw [hbase1raw] + simp [hcast] + have hne : T.edge firstTail ≠ T.edge secondTail := by + intro he + have hi := T.edge_injective he + have hiv := congrArg Fin.val hi + simp [firstTail, secondTail] at hiv + omega + exact (N.global.1.2.2.2.1 hne ⟨T.vertex firstNew, hinc0, hinc1⟩ + hfirstColor) hsecondColor + +private theorem helper_hfirstEnds_388.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hcard : (TreeSequenceVertexSet T).card + = T.length + (1 : ℕ)) (horder : TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : + ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) = N.height + (2 : ℕ)), + let firstTail : Fin T.length := (⟨N.height - (1 : ℕ), + by omega + ⟩ : Fin T.length); + let firstNew : Fin (T.length + (1 : ℕ)) := (⟨N.height, + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (m : ℕ) (hm : N.height = (2 : ℕ) * m + (1 : ℕ)) (base0raw : Fin ((↑firstTail : ℕ) + (1 : + ℕ))), G.ends (T.edge firstTail) = s(T.vertex firstTail.succ, T.vertex (base0raw.castLT + (Nat.lt_trans base0raw.isLt (Nat.succ_lt_succ firstTail.isLt)))) → + let base0 : Fin N.height := (⟨(↑base0raw : ℕ), + have hb : (↑base0raw : ℕ) < (↑firstTail : ℕ) + (1 : ℕ) := base0raw.isLt; + have hh : (2 : ℕ) ≤ N.height := N.height_lower; Eq.mpr (id rfl) (Eq.mp (congrArg (LT.lt + (↑base0raw : ℕ)) (Nat.sub_add_cancel (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + N.height) => + by omega + ))) hb)⟩ : Fin N.height); G.ends (T.edge firstTail) = s(T.vertex (Fin.castLE N.height_upper + base0), T.vertex firstNew) := by + classical + intro V E _ _ _ G k e0 phi T N hcard horder hlength firstTail firstNew m hm base0raw hbase0raw + base0 + calc + G.ends (T.edge firstTail) = + s(T.vertex firstTail.succ, + T.vertex (Fin.castLT base0raw + (Nat.lt_trans base0raw.isLt + (Nat.succ_lt_succ firstTail.isLt)))) := hbase0raw + _ = s(T.vertex firstNew, + T.vertex (Fin.castLE N.height_upper base0)) := by + congr 2; apply Fin.ext; simp [firstTail, firstNew]; omega + _ = s(T.vertex (Fin.castLE N.height_upper base0), + T.vertex firstNew) := Sym2.eq_swap + +private theorem helper_closing_mem_P_419.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hcard : (TreeSequenceVertexSet T).card + = T.length + (1 : ℕ)) (horder : TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : + ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) = N.height + (2 : ℕ)) (m : ℕ) (hm + : N.height = (2 : ℕ) * m + (1 : ℕ)), + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (P : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi N.alpha N.beta; + let C : Set (V ⊕ E) := TwoColorComponent G phi N.alpha N.beta (Sum.inl (T.vertex i0)); + {z : V ⊕ E | z ∈ P.support} = C → + ∀ {z : V ⊕ E}, z ∈ N.closingPath.support → z ∈ P.support := by + classical + intro V E _ _ _ G k e0 phi T N hcard horder hlength m hm i0 i1 _ P H C hPspan' z hz + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hz + have hr : H.Reachable z (Sum.inl (T.vertex i0)) := by + have hd := (N.closingPath.drop n).reachable + rw [← hn] + simpa [H, i0] using hd + have hzC : z ∈ C := by + change H.connectedComponentMk z = + H.connectedComponentMk (Sum.inl (T.vertex i0)) + exact SimpleGraph.ConnectedComponent.sound hr + change z ∈ {w | w ∈ P.support} + rw [hPspan'] + exact hzC + +private theorem helper_first_new_mem_P_449.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hcard : (TreeSequenceVertexSet T).card + = T.length + (1 : ℕ)) (horder : TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : + ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) = N.height + (2 : ℕ)), + let firstTail : Fin T.length := (⟨N.height - (1 : ℕ), + by omega + ⟩ : Fin T.length); + let firstNew : Fin (T.length + (1 : ℕ)) := (⟨N.height, + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (m : ℕ) (hm : N.height = (2 : ℕ) * m + (1 : ℕ)) (base0raw : Fin ((↑firstTail : ℕ) + (1 : + ℕ))), + let base0 : Fin N.height := (⟨(↑base0raw : ℕ), + have hb : (↑base0raw : ℕ) < (↑firstTail : ℕ) + (1 : ℕ) := base0raw.isLt; + have hh : (2 : ℕ) ≤ N.height := N.height_lower; Eq.mpr (id rfl) (Eq.mp (congrArg (LT.lt + (↑base0raw : ℕ)) (Nat.sub_add_cancel (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + N.height) => + by omega + ))) hb)⟩ : Fin N.height); G.ends (T.edge firstTail) = s(T.vertex (Fin.castLE N.height_upper + base0), T.vertex firstNew) → + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (P : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi N.alpha N.beta; + let C : Set (V ⊕ E) := TwoColorComponent G phi N.alpha N.beta (Sum.inl (T.vertex i0)); + {z : V ⊕ E | z ∈ P.support} = C → Sum.inl (T.vertex (Fin.castLE N.height_upper base0)) ∈ C + → ( + ∀ {x z : V ⊕ E}, x ∈ C → H.Adj x z → z ∈ C) → phi (T.edge firstTail) = some N.alpha ∨ phi + (T.edge firstTail) = some N.beta → Sum.inl (T.vertex firstNew) ∈ P.support := by + classical + intro V E _ _ _ G k e0 phi T N hcard horder hlength firstTail firstNew m hm base0raw base0 + hfirstEnds i0 i1 _ P H C hPspan' hrootC C_of_adj hc + have hbaseEdge : H.Adj + (Sum.inl (T.vertex (Fin.castLE N.height_upper base0))) + (Sum.inr (T.edge firstTail)) := by + simp [H, TwoColorIncidenceGraph, Incident, hfirstEnds, hc] + have hedgeC : Sum.inr (T.edge firstTail) ∈ C := + C_of_adj hrootC hbaseEdge + have hedgeNew : H.Adj (Sum.inr (T.edge firstTail)) + (Sum.inl (T.vertex firstNew)) := by + simp [H, TwoColorIncidenceGraph, Incident, hfirstEnds, hc] + have hnewC := C_of_adj hedgeC hedgeNew + change Sum.inl (T.vertex firstNew) ∈ {w | w ∈ P.support} + rw [hPspan'] + exact hnewC + +private theorem helper_hsecondEnds_493.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hlength : T.length + (1 : ℕ) = + N.height + (2 : ℕ)), + let secondTail : Fin T.length := (⟨N.height, + by omega + ⟩ : Fin T.length); + let secondNew : Fin (T.length + (1 : ℕ)) := (⟨N.height + (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (base1raw : Fin ((↑secondTail : ℕ) + (1 : ℕ))), G.ends (T.edge secondTail) = s(T.vertex + secondTail.succ, T.vertex (base1raw.castLT (Nat.lt_trans base1raw.isLt (Nat.succ_lt_succ + secondTail.isLt)))) → + ∀ (hbase1lt : (↑base1raw : ℕ) < N.height), + let base1 : Fin N.height := (⟨(↑base1raw : ℕ), hbase1lt⟩ : Fin N.height); G.ends (T.edge + secondTail) = s(T.vertex (Fin.castLE N.height_upper base1), T.vertex secondNew) := by + classical + intro V E _ _ _ G k e0 phi T N hlength secondTail secondNew base1raw hbase1raw hbase1lt base1 + calc + G.ends (T.edge secondTail) = + s(T.vertex secondTail.succ, + T.vertex (Fin.castLT base1raw + (Nat.lt_trans base1raw.isLt + (Nat.succ_lt_succ secondTail.isLt)))) := hbase1raw + _ = s(T.vertex secondNew, + T.vertex (Fin.castLE N.height_upper base1)) := by + congr 2 + _ = s(T.vertex (Fin.castLE N.height_upper base1), + T.vertex secondNew) := Sym2.eq_swap + +private theorem helper_edge_color_of_closing_support_507.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hcard : (TreeSequenceVertexSet T).card + = T.length + (1 : ℕ)) (horder : TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : + ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) = N.height + (2 : ℕ)), + let secondTail : Fin T.length := (⟨N.height, + by omega + ⟩ : Fin T.length); + ∀ (m : ℕ) (hm : N.height = (2 : ℕ) * m + (1 : ℕ)), + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (_ : Fin + ((↑secondTail : ℕ) + (1 : ℕ))) (f : E), Sum.inr f ∈ N.closingPath.support → phi f = some + N.alpha ∨ phi f = some N.beta := by + classical + intro V E _ _ _ G k e0 phi T N hcard horder hlength secondTail m hm i0 i1 _ P base1raw f hf + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hnlt : n < N.closingPath.length := by + by_contra hnl + have hend := N.closingPath.getVert_of_length_le (i := n) (by omega) + rw [hn] at hend + simp at hend + have hadj := N.closingPath.adj_getVert_succ hnlt + rw [hn] at hadj + cases hz : N.closingPath.getVert (n + 1) with + | inl v => + rw [hz] at hadj + simpa [TwoColorIncidenceGraph] using hadj.2 + | inr e => + rw [hz] at hadj + simp [TwoColorIncidenceGraph] at hadj + +private theorem helper_used_color_cases_532.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hcard : (TreeSequenceVertexSet T).card + = T.length + (1 : ℕ)) (horder : TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : + ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) = N.height + (2 : ℕ)), + let firstTail : Fin T.length := (⟨N.height - (1 : ℕ), + by omega + ⟩ : Fin T.length); + let secondTail : Fin T.length := (⟨N.height, + by omega + ⟩ : Fin T.length); + ∀ (gamma : Fin k), phi (T.edge firstTail) = some gamma → + ∀ (m : ℕ) (hm : N.height = (2 : ℕ) * m + (1 : ℕ)), phi (T.edge secondTail) = some gamma → + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (_ : Fin + ((↑secondTail : ℕ) + (1 : ℕ))), ( + ∀ (j : Fin T.length), (1 : ℕ) ≤ (↑j : ℕ) → (↑j : ℕ) + (2 : ℕ) ≤ N.height → phi (T.edge j) = + some N.alpha ∨ phi (T.edge j) = some N.beta) → + ∀ {c : Fin k} (j : Fin T.length), (1 : ℕ) ≤ (↑j : ℕ) → phi (T.edge j) = some c → c = N.alpha ∨ + c = N.beta ∨ c = gamma := by + classical + intro V E _ _ _ G k e0 phi T N hcard horder hlength firstTail secondTail gamma hfirstColor m hm + hsecondColor i0 i1 _ P base1raw base_nonfirst_color c j hj hc + by_cases htrunk : j.val + 2 ≤ N.height + · rcases base_nonfirst_color j hj htrunk with h | h + · exact Or.inl (Option.some.inj (hc.symm.trans h)) + · exact Or.inr (Or.inl (Option.some.inj (hc.symm.trans h))) + · have hjbound := j.isLt + have hcases : j.val = N.height - 1 ∨ j.val = N.height := by + simp [] at hjbound + omega + rcases hcases with h | h + · have he : j = firstTail := by apply Fin.ext; simpa [firstTail] + subst j + exact Or.inr (Or.inr (Option.some.inj (hc.symm.trans hfirstColor))) + · have he : j = secondTail := by apply Fin.ext; simpa [secondTail] + subst j + exact Or.inr (Or.inr (Option.some.inj (hc.symm.trans hsecondColor))) + +private theorem helper_hfirstEdgeEnds_562.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hcard : (TreeSequenceVertexSet T).card + = T.length + (1 : ℕ)) (horder : TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : + ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) = N.height + (2 : ℕ)), + let secondTail : Fin T.length := (⟨N.height, + by omega + ⟩ : Fin T.length); + ∀ (m : ℕ) (hm : N.height = (2 : ℕ) * m + (1 : ℕ)), + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (_ : Fin + ((↑secondTail : ℕ) + (1 : ℕ))), + let yzero : V := T.vertex (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let yone : V := T.vertex (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); G.ends e0 = s(yone, yzero) := by + classical + intro V E _ _ _ G k e0 phi T N hcard horder hlength secondTail m hm i0 i1 _ P base1raw yzero yone + obtain ⟨q, hq⟩ := T.attaches ⟨0, T.positive⟩ + have hq0 : q = 0 := Fin.eq_zero q + subst q + rw [T.first_edge] at hq + have hsucc : (⟨0, T.positive⟩ : Fin T.length).succ = + (⟨1, by omega⟩ : Fin (T.length + 1)) := by + apply Fin.ext + rfl + have hcast : Fin.castLT (0 : Fin 1) + (Nat.lt_trans (0 : Fin 1).isLt + (Nat.succ_lt_succ (⟨0, T.positive⟩ : Fin T.length).isLt)) = + (⟨0, by omega⟩ : Fin (T.length + 1)) := by + apply Fin.ext + rfl + simpa [yzero, yone, hsucc, hcast] using hq + +private theorem helper_color_is_free_590.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (gamma : Fin k), ( + ∀ {c : Fin k} (j : Fin T.length), (1 : ℕ) ≤ (↑j : ℕ) → phi (T.edge j) = some c → c = N.alpha ∨ + c = N.beta ∨ c = gamma) → + let X : Finset V := TreeSequenceVertexSet T; + ∀ {v : V}, v ∈ X → + ∀ {c : Fin k}, c ∈ MissingColors G phi v → c ≠ N.alpha → c ≠ N.beta → c ≠ gamma → c ∈ + TreeFreeColors phi T := by + classical + intro V E _ _ _ G k e0 phi T N gamma used_color_cases X v hv c hc hca hcb hcg + apply Finset.mem_sdiff.mpr + constructor + · simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, by simpa [X] using hv, hc⟩ + · intro hu + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hu + obtain ⟨j, hj, hcol⟩ := hu + rcases used_color_cases j hj hcol with h | h | h + · exact hca h + · exact hcb h + · exact hcg h + +private theorem helper_hexit_609.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T), + let _ : DecidableEq V := Classical.decEq V; + ∀ (hcard : (TreeSequenceVertexSet T).card = T.length + (1 : ℕ)) (horder : TashkinovOrder G = + (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd + (TreeSequenceVertexSet T).card ∧ ColoredVertexSetElementary G phi (TreeSequenceVertexSet + T) ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) + = N.height + (2 : ℕ)), + let firstTail : Fin T.length := (⟨N.height - (1 : ℕ), + by omega + ⟩ : Fin T.length); + ∀ (a0 : Fin ((↑firstTail : ℕ) + (1 : ℕ))) (gamma : Fin k), + let gammaBase : Fin N.height := (⟨(↑a0 : ℕ), + have ha : (↑a0 : ℕ) < (↑firstTail : ℕ) + (1 : ℕ) := a0.isLt; + have hh : (2 : ℕ) ≤ N.height := N.height_lower; Eq.mpr (id rfl) (Eq.mp (congrArg (LT.lt (↑a0 : + ℕ)) (Nat.sub_add_cancel (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ N.height) => ( + by omega + )))) ha)⟩ : Fin N.height); gamma ∈ MissingColors G phi (T.vertex (Fin.castLE N.height_upper + gammaBase)) → + let X : Finset V := TreeSequenceVertexSet T; + let ygamma : V := T.vertex (Fin.castLE N.height_upper gammaBase); ( + ∀ v ∈ X, v ≠ ygamma → + ∃ c ∈ MissingColors G phi v, c ∈ TreeFreeColors phi T) → + ∀ v ∈ ScheideExitVertices T phi, gamma ∈ MissingColors G phi v := by + classical + intro V E _ _ _ G k e0 phi T N this hcard horder hlength firstTail a0 gamma gammaBase + hgammaMissing X ygamma free_of_ne_gamma v hvExit + have hExit : ScheideExitVertex T phi v := by + simpa [ScheideExitVertices] using hvExit + obtain ⟨u, c, d, hu, hc, hd, z, p, hp, i, hi, hv, hafter⟩ := hExit + have hvX : v ∈ X := by simpa [X] using hv + by_contra hn + have hvne : v ≠ ygamma := by + intro h + subst v + exact hn (by simpa [ygamma] using hgammaMissing) + obtain ⟨c', hc', hfree⟩ := free_of_ne_gamma v hvX hvne + have hdis := ScheideExitNoFree G k e0 phi T N.global v hvExit + exact (Finset.disjoint_left.mp hdis) hc' hfree + +private theorem helper_branch_677.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hcard : (TreeSequenceVertexSet T).card + = T.length + (1 : ℕ)) (horder : TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : + ℕ) ≤ (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T)) (hlength : T.length + (1 : ℕ) = N.height + (2 : ℕ)), + let secondTail : Fin T.length := (⟨N.height, + by omega + ⟩ : Fin T.length); + let secondNew : Fin (T.length + (1 : ℕ)) := (⟨N.height + (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (m : ℕ) (hm : N.height = (2 : ℕ) * m + (1 : ℕ)), + let i0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let i1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex i0)) (Sum.inl + (T.vertex i1))) (_ : (TwoColorIncidenceGraph G phi N.alpha N.beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (base1raw : Fin + ((↑secondTail : ℕ) + (1 : ℕ))) (hbase1lt : (↑base1raw : ℕ) < N.height), + let base1 : Fin N.height := (⟨(↑base1raw : ℕ), hbase1lt⟩ : Fin N.height); G.ends (T.edge + secondTail) = s(T.vertex (Fin.castLE N.height_upper base1), T.vertex secondNew) → + ∃ (q : Fin N.height), G.ends (T.edge (⟨N.height - (1 : ℕ) + (↑(1 : Fin (2 : ℕ)) : ℕ), + by + have _ : (↑(1 : Fin (2 : ℕ)) : ℕ) < (2 : ℕ) := Fin.isLt (1 : Fin (2 : ℕ)); + omega + ⟩ : Fin T.length)) = s(T.vertex (Fin.castLE N.height_upper q), T.vertex (⟨N.height + (↑(1 : + Fin (2 : ℕ)) : ℕ), + by + have _ : (↑(1 : Fin (2 : ℕ)) : ℕ) < (2 : ℕ) := Fin.isLt (1 : Fin (2 : ℕ)); + omega + ⟩ : Fin (T.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 phi T N hcard horder hlength secondTail secondNew m hm i0 i1 _ P + base1raw hbase1lt base1 hsecondEnds + refine ⟨base1, ?_⟩ + have hedge : (⟨N.height - 1 + 1, by omega⟩ : Fin T.length) = + secondTail := by + apply Fin.ext + simp [secondTail] + omega + have hvertex : (⟨N.height + 1, by omega⟩ : Fin (T.length + 1)) = + secondNew := by + apply Fin.ext + rfl + norm_num at ⊢ + rw [hedge, hvertex] + exact hsecondEnds + +private theorem helper_continuation_929.{u_1, u_2} : + helperContinuation929Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hbalanced hnoisolated hheight this hcard horder hlength + firstTail secondTail firstNew secondNew a0 gamma hfirstColor gammaBase hgammaMissing m hm + hsecondColor base0raw base0 hfirstEnds i0 i1 _ _ _ _ _ _ P hPpath hPdiv _ hPbound + closing_mem_P first_new_mem_P hfirstNewNotClosing + have path_length_contradiction + (hnew : Sum.inl (T.vertex firstNew) ∈ P.support) : False := by + exact @helper_path_length_contradiction_328 V E inferInstance inferInstance inferInstance G k + e0 phi T N hbalanced hheight hcard horder hlength m hm (by assumption) P hPpath hPdiv + hPbound closing_mem_P hfirstNewNotClosing hnew + have hgammaAlpha : gamma ≠ N.alpha := by + intro h + apply path_length_contradiction + apply first_new_mem_P + exact Or.inl (by simpa [h] using hfirstColor) + have hgammaBeta : gamma ≠ N.beta := by + intro h + apply path_length_contradiction + apply first_new_mem_P + exact Or.inr (by simpa [h] using hfirstColor) + obtain ⟨base1raw, hbase1raw⟩ := T.attaches secondTail + have hbase1lt : base1raw.val < N.height := by + exact @helper_hbase1lt_366 V E inferInstance inferInstance inferInstance G k e0 phi T N hcard + horder hlength gamma hfirstColor m hm hsecondColor base0raw hfirstEnds (by assumption) P + base1raw hbase1raw + let base1 : Fin N.height := ⟨base1raw.val, hbase1lt⟩ + have hsecondEnds := @helper_hsecondEnds_493 V E inferInstance inferInstance inferInstance G k e0 + phi T N hlength base1raw hbase1raw hbase1lt + have edge_color_of_closing_support (f : E) + (hf : Sum.inr f ∈ N.closingPath.support) : + phi f = some N.alpha ∨ phi f = some N.beta := by + exact @helper_edge_color_of_closing_support_507 V E inferInstance inferInstance inferInstance + G k e0 phi T N hcard horder hlength m hm (by assumption) P base1raw f hf + have base_nonfirst_color (j : Fin T.length) + (hj : 1 ≤ j.val) (hjh : j.val + 2 ≤ N.height) : + phi (T.edge j) = some N.alpha ∨ phi (T.edge j) = some N.beta := by + apply edge_color_of_closing_support + apply (N.closingPath_edges (T.edge j)).2 + exact Or.inr ⟨j, hj, hjh, rfl⟩ + have used_color_cases {c : Fin k} (j : Fin T.length) (hj : 1 ≤ j.val) + (hc : phi (T.edge j) = some c) : + c = N.alpha ∨ c = N.beta ∨ c = gamma := by + exact @helper_used_color_cases_532 V E inferInstance inferInstance inferInstance G k e0 phi T + N hcard horder hlength gamma hfirstColor m hm hsecondColor (by assumption) P base1raw + base_nonfirst_color c j hj hc + let X := TreeSequenceVertexSet T + let yzero : V := T.vertex ⟨0, by omega⟩ + let yone : V := T.vertex ⟨1, by omega⟩ + let ygamma : V := T.vertex (Fin.castLE N.height_upper gammaBase) + have hyzero : yzero ∈ X := by simp [yzero, X, TreeSequenceVertexSet] + have hyone : yone ∈ X := by simp [yone, X, TreeSequenceVertexSet] + have hygamma : ygamma ∈ X := by simp [ygamma, X, TreeSequenceVertexSet] + have hyzero_ne_yone : yzero ≠ yone := by + intro h + have hi := T.vertex_injective h + simp [] at hi + have hfirstEdgeEnds : G.ends e0 = s(yone, yzero) := by + exact @helper_hfirstEdgeEnds_562 V E inferInstance inferInstance inferInstance G k e0 phi T N + hcard horder hlength m hm (by assumption) P base1raw + have hinczero : Incident G yzero e0 := by + unfold Incident + rw [hfirstEdgeEnds] + simp + have hincone : Incident G yone e0 := by + unfold Incident + rw [hfirstEdgeEnds] + simp + have helem : ColoredVertexSetElementary G phi X := by + intro u hu v hv huv + exact horder.2.2.2.1 (by simpa [X] using hu) + (by simpa [X] using hv) huv + have color_is_free := @helper_color_is_free_590 V E inferInstance inferInstance inferInstance G k + e0 phi T N gamma used_color_cases + have free_of_ne_gamma : ∀ v ∈ X, v ≠ ygamma → + ∃ c, c ∈ MissingColors G phi v ∧ c ∈ TreeFreeColors phi T := by + exact @helper_free_of_ne_gamma_377 V E inferInstance inferInstance inferInstance G k e0 phi T + N hcard horder hlength a0 gamma hgammaMissing m hm (by assumption) P base1raw hyzero + hyone hygamma hyzero_ne_yone hinczero hincone helem color_is_free + have hexit := @helper_hexit_609 V E inferInstance inferInstance inferInstance G k e0 phi T N hcard + horder hlength a0 gamma hgammaMissing free_of_ne_gamma + let Config : ScheideStructuralConfiguration G k e0 phi T := { + p := N.height + s := 1 + p_ge_two := N.height_lower + gamma := fun _ => gamma + gamma_injective := fun a b _ => Subsingleton.elim a b + y := fun i => T.vertex (Fin.castLE N.height_upper i) + baseEdge := fun i => T.edge ⟨i.val, by + have hi := i.isLt + omega⟩ + blockVertex := fun _ j => T.vertex ⟨N.height + j.val, by + have hj := j.isLt + omega⟩ + blockEdge := fun _ j => T.edge ⟨N.height - 1 + j.val, by + have hj := j.isLt + omega⟩ + length_eq := by simpa using hlength + base_vertex_position := by + intro i + rfl + block_vertex_position := by + intro i j + apply congrArg T.vertex + apply Fin.ext + have hi := i.isLt + have hiz : i.val = 0 := by omega + simp [] + base_edge_position := by + intro i + rfl + block_edge_position := by + intro i j + apply congrArg T.edge + apply Fin.ext + have hi := i.isLt + have hiz : i.val = 0 := by omega + simp [] + block_attaches_to_base := by + intro i j + have hi : i = 0 := Subsingleton.elim i 0 + subst i + have hj : j = 0 ∨ j = 1 := by + by_cases hz : j.val = 0 + · left + apply Fin.ext + exact hz + · right + apply Fin.ext + have hjlt := j.isLt + omega + rcases hj with rfl | rfl + · exact ⟨base0, by simpa [firstTail, firstNew] using hfirstEnds⟩ + · exact @helper_branch_677 V E inferInstance inferInstance inferInstance G k e0 phi T N + hcard horder hlength m hm (by assumption) P base1raw hbase1lt hsecondEnds + block_color := by + intro i j + have hi : i = 0 := Subsingleton.elim i 0 + subst i + have hj : j = 0 ∨ j = 1 := by + by_cases hz : j.val = 0 + · left + apply Fin.ext + exact hz + · right + apply Fin.ext + have hjlt := j.isLt + omega + rcases hj with rfl | rfl + · simpa [firstTail] using hfirstColor + · convert hsecondColor using 1 + apply congrArg phi + apply congrArg T.edge + apply Fin.ext + simp [secondTail] + omega + block_color_missing_on_base := by + intro i + exact ⟨gammaBase, hgammaMissing⟩ + initial_nonfirst_avoids_blocks := by + intro i hi c hc r + let j : Fin T.length := ⟨i.val, by + have hil := i.isLt + omega⟩ + have hjh : j.val + 2 ≤ N.height := by + have hil := i.isLt + simp [j] + omega + have hcol : phi (T.edge j) = some N.alpha ∨ + phi (T.edge j) = some N.beta := base_nonfirst_color j hi hjh + have heq : T.edge j = T.edge ⟨i.val, by + have hil := i.isLt + omega⟩ := by + apply congrArg T.edge + apply Fin.ext + rfl + rw [heq, hc] at hcol + rcases hcol with h | h + · have : c = N.alpha := Option.some.inj h + simpa [this] using hgammaAlpha.symm + · have : c = N.beta := Option.some.inj h + simpa [this] using hgammaBeta.symm + exit_covered := by + intro v hv + exact ⟨0, hexit v hv⟩ + no_isolated := hnoisolated + globally_maximum := N.global + } + exact ScheideStructuralLemma G k e0 phi T Config + +theorem ScheideLargeHeightOneTailPair {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hbalanced : BalancedGlobalMaximumTriple N) + (hnoisolated : ∀ v : V, ∃ e : E, Incident G v e) + (hheight : ScheideGraphHeight G + 2 = TashkinovOrder G) : + Elementary G := by + classical + let : DecidableEq V := Classical.decEq V + have hcard : (TreeSequenceVertexSet T).card = T.length + 1 := by + unfold TreeSequenceVertexSet + rw [Finset.card_image_iff.mpr (by + intro a ha b hb hab + exact T.vertex_injective hab)] + simp + have horder := ScheideGlobalMaximumOrder G k e0 phi T N.global + have hlength : T.length + 1 = N.height + 2 := by + calc + T.length + 1 = (TreeSequenceVertexSet T).card := hcard.symm + _ = TashkinovOrder G := N.global.2.2 + _ = ScheideGraphHeight G + 2 := hheight.symm + _ = N.height + 2 := by rw [hbalanced.1] + have hodd : Odd N.height := by + rw [hbalanced.1] + exact (ScheideGraphHeightOdd G k e0 phi T N.global).2 + let firstTail : Fin T.length := ⟨N.height - 1, by omega⟩ + let secondTail : Fin T.length := ⟨N.height, by omega⟩ + let firstNew : Fin (T.length + 1) := ⟨N.height, by omega⟩ + let secondNew : Fin (T.length + 1) := ⟨N.height + 1, by omega⟩ + obtain ⟨a0, gamma, hfirstColor, hgammaMissing0⟩ := + N.global.2.1 firstTail (by + have hh := N.height_lower + simp [firstTail] + omega) + let gammaBase : Fin N.height := ⟨a0.val, by + have ha := a0.isLt + have hh := N.height_lower + simpa [firstTail, Nat.sub_add_cancel (by omega : 1 ≤ N.height)] using ha⟩ + have hgammaMissing : gamma ∈ MissingColors G phi + (T.vertex (Fin.castLE N.height_upper gammaBase)) := by + have hi : Fin.castLE N.height_upper gammaBase = + Fin.castLT a0 + (Nat.lt_trans a0.isLt (Nat.succ_lt_succ firstTail.isLt)) := by + apply Fin.ext + rfl + rw [hi] + exact hgammaMissing0 + rcases hodd with ⟨m, hm⟩ + have hpair := hbalanced.2 (m + 1) (by omega) (by omega) + have hsecondColor : phi (T.edge secondTail) = some gamma := by + have hpair' : phi (T.edge firstTail) = phi (T.edge secondTail) := by + convert hpair using 1 <;> apply congrArg phi <;> apply congrArg T.edge <;> + apply Fin.ext <;> simp [firstTail, secondTail] <;> omega + rw [hpair'] at hfirstColor + exact hfirstColor + obtain ⟨base0raw, hbase0raw⟩ := T.attaches firstTail + let base0 : Fin N.height := ⟨base0raw.val, by + have hb := base0raw.isLt + have hh := N.height_lower + simpa [firstTail, Nat.sub_add_cancel (by omega : 1 ≤ N.height)] using hb⟩ + have hfirstEnds := @helper_hfirstEnds_388 V E inferInstance inferInstance inferInstance G k e0 phi + T N hcard horder hlength m hm base0raw hbase0raw + have hfixed : FixedPairMaximalTashkinovTree G e0 phi T := + ScheideGlobalMaximumFixedPairMaximal G k e0 phi T N.global + let i0 : Fin (T.length + 1) := ⟨0, by omega⟩ + let i1 : Fin (T.length + 1) := ⟨1, by omega⟩ + obtain ⟨hab, _, _, _, _, _, _⟩ := + ScheideMaximalKempePath G k e0 phi T T N.global.1 hfixed N.global.2.1 + i0 i1 (by simp [i0, i1]) N.alpha N.beta + (by simpa [i0] using N.alpha_missing) + (by simpa [i1] using N.beta_missing) + obtain ⟨P, hPpath, hPspan, hPdiv, _, hPbound⟩ := + ScheideKempePathHeightBound G k e0 phi T N.global N.alpha N.beta + N.alpha_missing N.beta_missing + let H := TwoColorIncidenceGraph G phi N.alpha N.beta + let C := TwoColorComponent G phi N.alpha N.beta + (Sum.inl (T.vertex i0)) + have hPspan' : {z | z ∈ P.support} = C := by + simpa [C, i0] using hPspan + have closing_mem_P {z : Sum V E} (hz : z ∈ N.closingPath.support) : + z ∈ P.support := by + exact @helper_closing_mem_P_419 V E inferInstance inferInstance inferInstance G k e0 phi T N + hcard horder hlength m hm (by assumption) P hPspan' z hz + have hbase0Closing : + Sum.inl (T.vertex (Fin.castLE N.height_upper base0)) ∈ + N.closingPath.support := by + apply (N.closingPath_vertices _).2 + exact ⟨base0, rfl⟩ + have hrootC : Sum.inl (T.vertex (Fin.castLE N.height_upper base0)) ∈ C := by + rw [← hPspan'] + exact closing_mem_P hbase0Closing + have C_of_adj {x z : Sum V E} (hx : x ∈ C) (hxz : H.Adj x z) : z ∈ C := by + change H.connectedComponentMk x = + H.connectedComponentMk (Sum.inl (T.vertex i0)) at hx + change H.connectedComponentMk z = + H.connectedComponentMk (Sum.inl (T.vertex i0)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hxz).symm.trans hx + have first_new_mem_P + (hc : phi (T.edge firstTail) = some N.alpha ∨ + phi (T.edge firstTail) = some N.beta) : + Sum.inl (T.vertex firstNew) ∈ P.support := by + exact @helper_first_new_mem_P_449 V E inferInstance inferInstance inferInstance G k e0 phi T + N hcard horder hlength m hm base0raw hfirstEnds (by assumption) P hPspan' hrootC C_of_adj hc + have hfirstNewNotClosing : + Sum.inl (T.vertex firstNew) ∉ N.closingPath.support := by + intro hmem + obtain ⟨q, hq⟩ := (N.closingPath_vertices (T.vertex firstNew)).1 hmem + have hi := T.vertex_injective hq + have hqv := q.isLt + have hiv := congrArg Fin.val hi + simp [firstNew] at hiv + omega + exact @helper_continuation_929 V E inferInstance inferInstance inferInstance G k e0 phi T N + hbalanced hnoisolated hheight hcard horder hlength a0 gamma hfirstColor hgammaMissing m hm + hsecondColor base0raw hfirstEnds (by assumption) (by assumption) (by assumption) + (by assumption) (by assumption) (by assumption) P hPpath hPdiv (by assumption) hPbound + closing_mem_P first_new_mem_P hfirstNewNotClosing +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideLastExitPath.lean b/LeanPool/GoldbergSeymour/ScheideLastExitPath.lean new file mode 100644 index 0000000000..44b44ef33c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideLastExitPath.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet + +/-! +# Scheide Last Exit Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A two-color path with a recorded last departure from the enlarged vertex set. -/ +structure ScheideLastExitPath {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : + ∀ d : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) }, + ScheideReplacementData G k e0 phi T C D d) + (alpha : Fin k) where + /-- The terminal vertex of the path, lying outside the enlarged vertex set. -/ + terminal : V + /-- The last vertex of the path belonging to the enlarged vertex set. -/ + lastInside : V + /-- The vertex immediately after the last departure from the enlarged set. -/ + firstOutside : V + /-- The boundary edge at the recorded last departure. -/ + crossing : E + /-- The two-color path witnessing the last departure. -/ + path : + (TwoColorIncidenceGraph G phi D.alpha0 alpha).Walk + (Sum.inl (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩)) (Sum.inl terminal) + /-- The index of the distinguished final trunk or departure vertex. -/ + lastIndex : Fin (path.length + 1) + pathSimple : path.IsPath + pathSpans : + {z | z ∈ path.support} = + TwoColorComponent G phi D.alpha0 alpha + (Sum.inl (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩)) + terminalOutside : terminal ∉ ScheideEnlargedVertexSet R + lastInsideAt : path.getVert lastIndex.val = Sum.inl lastInside + lastInsideMem : lastInside ∈ ScheideEnlargedVertexSet R + followingVertex : lastIndex.val + 2 ≤ path.length + crossingAt : path.getVert (lastIndex.val + 1) = Sum.inr crossing + firstOutsideAt : path.getVert (lastIndex.val + 2) = Sum.inl firstOutside + firstOutsideNotMem : firstOutside ∉ ScheideEnlargedVertexSet R + afterLastOutside : + ∀ (j : Fin (path.length + 1)), + lastIndex.val < j.val → + ∀ x : V, path.getVert j.val = Sum.inl x → x ∉ ScheideEnlargedVertexSet R + crossingBoundary : crossing ∈ BoundaryEdges G (ScheideEnlargedVertexSet R) + crossingColor : phi crossing = some alpha + crossingComponent : + Sum.inr crossing ∈ + TwoColorComponent G phi D.alpha0 alpha + (Sum.inl (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideMaximalContainsEveryTree.lean b/LeanPool/GoldbergSeymour/ScheideMaximalContainsEveryTree.lean new file mode 100644 index 0000000000..cb30b2ab09 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideMaximalContainsEveryTree.lean @@ -0,0 +1,135 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideMaximalElementaryClosed + +/-! +# Scheide Maximal Contains Every Tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideMaximalContainsEveryTree {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T S : TreeSequence G e0) + (htriple : KTriple G k e0 phi) + (hmax : FixedPairMaximalTashkinovTree G e0 phi T) + (hS : TashkinovTree G e0 phi S) : + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet T := by + classical + let X := TreeSequenceVertexSet T + have hclosed : ColoredVertexSetClosed G phi X := by + exact (ScheideMaximalElementaryClosed G k e0 phi T htriple hmax).2 + have first_mem : ∀ j : Fin 2, + S.vertex (Fin.castLE (Nat.succ_le_succ S.positive) j) ∈ X := by + intro j + obtain ⟨is, hsatt⟩ := S.attaches ⟨0, S.positive⟩ + obtain ⟨it, htatt⟩ := T.attaches ⟨0, T.positive⟩ + have iszero : is = 0 := Fin.eq_zero is + have itzero : it = 0 := Fin.eq_zero it + subst is + subst it + have hse := hsatt + rw [S.first_edge] at hse + have hte := htatt + rw [T.first_edge] at hte + have hm : S.vertex (Fin.castLE (Nat.succ_le_succ S.positive) j) ∈ G.ends e0 := by + have cases : j.val = 0 ∨ j.val = 1 := by omega + rcases cases with hzero | hone + · have hj : j = 0 := Fin.ext hzero + subst j + rw [hse] + apply Sym2.mem_iff.mpr + right + congr 1 + · have hj : j = 1 := Fin.ext hone + subst j + rw [hse] + apply Sym2.mem_iff.mpr + left + congr 1 + rw [hte] at hm + have cases : j.val = 0 ∨ j.val = 1 := by omega + rcases cases with hzero | hone + · have hj : j = 0 := Fin.ext hzero + subst j + rcases Sym2.mem_iff.mp hm with h | h + · change S.vertex (Fin.castLE (Nat.succ_le_succ S.positive) 0) ∈ + Finset.image T.vertex Finset.univ + exact Finset.mem_image.mpr ⟨_, Finset.mem_univ _, h.symm⟩ + · change S.vertex (Fin.castLE (Nat.succ_le_succ S.positive) 0) ∈ + Finset.image T.vertex Finset.univ + exact Finset.mem_image.mpr ⟨_, Finset.mem_univ _, h.symm⟩ + · have hj : j = 1 := Fin.ext hone + subst j + rcases Sym2.mem_iff.mp hm with h | h + · change S.vertex (Fin.castLE (Nat.succ_le_succ S.positive) 1) ∈ + Finset.image T.vertex Finset.univ + exact Finset.mem_image.mpr ⟨_, Finset.mem_univ _, h.symm⟩ + · change S.vertex (Fin.castLE (Nat.succ_le_succ S.positive) 1) ∈ + Finset.image T.vertex Finset.univ + exact Finset.mem_image.mpr ⟨_, Finset.mem_univ _, h.symm⟩ + have all_mem : ∀ n : ℕ, ∀ hn : n < S.length + 1, + S.vertex ⟨n, hn⟩ ∈ X := by + intro n hn + induction n using Nat.strong_induction_on with + | h n ih => + by_cases hj : n < 2 + · exact first_mem ⟨n, by omega⟩ + · by_contra hout + have hjpos : 1 ≤ n - 1 := by omega + obtain ⟨i, c, hcolor, hmiss⟩ := hS ⟨n - 1, by omega⟩ hjpos + have hi0 := i.isLt + have hi : i.val < n := by + have hi1 : i.val < (n - 1) + 1 := i.isLt + have hnrel : (n - 1) + 1 = n := Nat.sub_add_cancel (by omega) + simpa only [hnrel] using hi1 + have hiS : i.val < S.length + 1 := lt_of_lt_of_le hi (Nat.le_of_lt hn) + have hbefore : S.vertex (Fin.castLT i hiS) ∈ X := by + exact ih i.val hi (by omega) + obtain ⟨q, hatt⟩ := S.attaches ⟨n - 1, by omega⟩ + have hq0 := q.isLt + have hq : q.val < n := by + have hq1 : q.val < (n - 1) + 1 := q.isLt + have hnrel : (n - 1) + 1 = n := Nat.sub_add_cancel (by omega) + simpa only [hnrel] using hq1 + have hqS : q.val < S.length + 1 := lt_of_lt_of_le hq (Nat.le_of_lt hn) + have hqbefore : S.vertex (Fin.castLT q hqS) ∈ X := by + exact ih q.val hq (by omega) + have hnedge : n - 1 < S.length := by omega + have hcurr : S.vertex ⟨n, hn⟩ = + S.vertex (⟨n - 1, by omega⟩ : Fin S.length).succ := by + congr 1 + apply Fin.ext + dsimp + exact (Nat.sub_add_cancel (by omega)).symm + have hedge : G.ends (S.edge ⟨n - 1, by omega⟩) = + Sym2.mk (S.vertex ⟨n, hn⟩) + (S.vertex (Fin.castLT q hqS)) := by + rw [hcurr] + exact hatt + have hb : S.edge ⟨n - 1, by omega⟩ ∈ BoundaryEdges G X := by + unfold BoundaryEdges + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩ + exact ⟨S.vertex (Fin.castLT q hqS), hqbefore, + S.vertex ⟨n, hn⟩, hout, by + exact hedge.trans Sym2.eq_swap⟩ + exact hclosed hb hbefore hcolor hmiss + intro v hv + obtain ⟨j, -, rfl⟩ := Finset.mem_image.mp hv + simpa [X] using all_mem j.val j.isLt + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideMaximalElementaryClosed.lean b/LeanPool/GoldbergSeymour/ScheideMaximalElementaryClosed.lean new file mode 100644 index 0000000000..a00c9da99f --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideMaximalElementaryClosed.lean @@ -0,0 +1,176 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.TashTree + +/-! +# Scheide Maximal Elementary Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideMaximalElementaryClosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (htriple : KTriple G k e0 phi) + (hmax : FixedPairMaximalTashkinovTree G e0 phi T) : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ + ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := by + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := + TashTree (V := V) (E := E) G k e0 phi T htriple (hT := hmax.1) + refine ⟨helem, ?_⟩ + unfold ColoredVertexSetClosed + classical + intro f c v hf hv hfc + by_contra hbad + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf + rcases hf with ⟨u, hu, w, hw, hends⟩ + let nv : Fin (T.length + 2) → V := Fin.lastCases w (fun i => T.vertex i) + let ne : Fin (T.length + 1) → E := Fin.lastCases f (fun i => T.edge i) + let hs : TreeSequence G e0 := by + refine ⟨T.length + 1, by omega, nv, ne, ?_, ?_, ?_, ?_⟩ + · intro a + refine Fin.lastCases ?_ (fun i => ?_) a + · intro b + refine Fin.lastCases ?_ (fun j => ?_) b + · intro hab + rfl + · intro hab + apply False.elim + apply hw + rw [TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨j, Finset.mem_univ _, by simpa [nv] using hab.symm⟩ + · intro b + refine Fin.lastCases ?_ (fun j => ?_) b + · intro hab + apply False.elim + apply hw + rw [TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨i, Finset.mem_univ _, by simpa [nv] using hab⟩ + · intro hab + have hvertex : T.vertex i = T.vertex j := by simpa [nv] using hab + exact congrArg Fin.castSucc (T.vertex_injective hvertex) + · intro a + refine Fin.lastCases ?_ (fun i => ?_) a + · intro b + refine Fin.lastCases ?_ (fun j => ?_) b + · intro hab + rfl + · intro hab + apply False.elim + apply hw + have he : f = T.edge j := by simpa [ne] using hab + have hm : w ∈ G.ends (T.edge j) := by rw [← he, hends]; simp + rw [T.attaches j |>.choose_spec] at hm + simp only [Sym2.mem_iff] at hm + rcases hm with hm | hm + · exact Finset.mem_image.mpr ⟨j.succ, Finset.mem_univ _, hm.symm⟩ + · exact Finset.mem_image.mpr ⟨Fin.castLT (T.attaches j).choose (by omega), + Finset.mem_univ _, hm.symm⟩ + · intro b + refine Fin.lastCases ?_ (fun j => ?_) b + · intro hab + apply False.elim + apply hw + have he : T.edge i = f := by simpa [ne] using hab + have hm : w ∈ G.ends (T.edge i) := by rw [he, hends]; simp + rw [T.attaches i |>.choose_spec] at hm + simp only [Sym2.mem_iff] at hm + rcases hm with hm | hm + · exact Finset.mem_image.mpr ⟨i.succ, Finset.mem_univ _, hm.symm⟩ + · exact Finset.mem_image.mpr ⟨Fin.castLT (T.attaches i).choose (by omega), + Finset.mem_univ _, hm.symm⟩ + · intro hab + have hedge : T.edge i = T.edge j := by simpa [ne] using hab + exact congrArg Fin.castSucc (T.edge_injective hedge) + · have hz : (0 : Fin (T.length + 1)) = (⟨0, T.positive⟩ : Fin T.length).castSucc := by rfl + have he : ne ⟨0, by omega⟩ = T.edge ⟨0, T.positive⟩ := by + calc + ne ⟨0, by omega⟩ = ne (⟨0, T.positive⟩ : Fin T.length).castSucc := congrArg ne hz + _ = T.edge ⟨0, T.positive⟩ := by + simp only [ne, Fin.lastCases_castSucc] + rw [he] + exact T.first_edge + · intro j + refine Fin.lastCases ?_ (fun q => ?_) j + · rw [TreeSequenceVertexSet] at hu + rcases Finset.mem_image.mp hu with ⟨i, hi, hui⟩ + refine ⟨i, ?_⟩ + have hidx : Fin.castLT i (by omega) = i.castSucc := by ext; rfl + rw [hidx] + have he : ne (Fin.last T.length) = f := by simp [ne] + have hvlast : nv (Fin.last T.length).succ = w := by simp [nv] + rw [he, hvlast, hends] + simp only [nv, Fin.lastCases_castSucc] + rw [hui] + exact Sym2.eq_swap + · rcases T.attaches q with ⟨i, hi⟩ + refine ⟨i, ?_⟩ + have hidx : Fin.castLT i (by omega) = i := by ext; rfl + have hnext : q.castSucc.succ = q.succ.castSucc := by ext; rfl + have hiNv : nv (Fin.castLT i (by omega)) = + T.vertex (Fin.castLT i (by omega)) := by + let ilarge : Fin (T.length + 1) := Fin.castLT i (by omega) + have heq : (Fin.castLT i (by omega) : Fin (T.length + 2)) = ilarge.castSucc := by + ext + rfl + rw [heq] + simp [nv, ilarge] + rw [hnext, hiNv] + simpa only [nv, ne, Fin.lastCases_castSucc] using hi + have ht : TashkinovTree G e0 phi hs := by + intro j + dsimp [hs] at j ⊢ + change Fin (T.length + 1) at j + refine Fin.lastCases ?_ (fun q => ?_) j + · intro hj + rw [TreeSequenceVertexSet] at hv + rcases Finset.mem_image.mp hv with ⟨i, hi, hiv⟩ + have hne : hs.edge (Fin.last T.length) = f := by simp [hs, ne] + refine ⟨i, c, ?_, ?_⟩ + · simpa [hs, ne, Fin.lastCases_last] using hfc + · have hidx : Fin.castLT i (by omega) = i.castSucc := by ext; rfl + rw [hidx] + simp only [nv, Fin.lastCases_castSucc] + rw [hiv] + exact hbad + · intro hj + have hjq : 1 ≤ q.val := by exact hj + rcases hmax.1 q hjq with ⟨r, d, hd, hm⟩ + refine ⟨r, d, ?_, ?_⟩ + · simpa [hs, ne] using hd + · let rlarge : Fin (T.length + 1) := Fin.castLT r (by omega) + have hidx : Fin.castLT r (by omega) = rlarge.castSucc := by ext; rfl + rw [hidx] + simp only [nv, Fin.lastCases_castSucc] + exact hm + have hsub : TreeSequenceVertexSet T ⊆ TreeSequenceVertexSet hs := by + intro x hx + rw [TreeSequenceVertexSet] at hx ⊢ + rcases Finset.mem_image.mp hx with ⟨i, hi, hxi⟩ + refine Finset.mem_image.mpr ⟨Fin.castLT i (by dsimp [hs]; omega), Finset.mem_univ _, ?_⟩ + have hidx : Fin.castLT i (by omega) = i.castSucc := by ext; rfl + simpa [hs, nv, hidx, Fin.lastCases_castSucc] using hxi + have hback := hmax.2 hs ht hsub + apply hw + apply hback + rw [TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨Fin.last (T.length + 1), Finset.mem_univ _, by simp [hs, nv]⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideMaximalExtendsEveryTree.lean b/LeanPool/GoldbergSeymour/ScheideMaximalExtendsEveryTree.lean new file mode 100644 index 0000000000..84b7c622a1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideMaximalExtendsEveryTree.lean @@ -0,0 +1,568 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.ScheideMaximalContainsEveryTree +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Maximal Extends Every Tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_first_vertices_42.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (T C : TreeSequence G e0) (j : Fin (2 : ℕ)), + T.vertex (Fin.castLE (Nat.succ_le_succ T.positive) j) ∈ TreeSequenceVertexSet C := by + classical + intro V E G e0 T C j + obtain ⟨it, ht⟩ := T.attaches ⟨0, T.positive⟩ + obtain ⟨ic, hc⟩ := C.attaches ⟨0, C.positive⟩ + have itzero : it = 0 := Fin.eq_zero it + have iczero : ic = 0 := Fin.eq_zero ic + subst it + subst ic + rw [T.first_edge] at ht + rw [C.first_edge] at hc + have hm : T.vertex (Fin.castLE (Nat.succ_le_succ T.positive) j) ∈ G.ends e0 := by + have cases : j.val = 0 ∨ j.val = 1 := by omega + rcases cases with hzero | hone + · have hj : j = 0 := Fin.ext hzero + subst j + rw [ht] + apply Sym2.mem_iff.mpr + right + rfl + · have hj : j = 1 := Fin.ext hone + subst j + rw [ht] + apply Sym2.mem_iff.mpr + left + rfl + rw [hc] at hm + rcases Sym2.mem_iff.mp hm with hm | hm + · change T.vertex (Fin.castLE (Nat.succ_le_succ T.positive) j) ∈ + Finset.image C.vertex Finset.univ + exact Finset.mem_image.mpr ⟨_, Finset.mem_univ _, hm.symm⟩ + · change T.vertex (Fin.castLE (Nat.succ_le_succ T.positive) j) ∈ + Finset.image C.vertex Finset.univ + exact Finset.mem_image.mpr ⟨_, Finset.mem_univ _, hm.symm⟩ + +private theorem helper_hex_83.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet T; + ∀ (C : TreeSequence G e0), TreeSequenceVertexSet C ⊆ X → ¬TreeSequenceVertexSet C = X → + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ + TreeSequenceVertexSet C := by + classical + intro V E G e0 T X C hCX heq + obtain ⟨v, hv, hvc⟩ : ∃ v, v ∈ X ∧ v ∉ TreeSequenceVertexSet C := by + by_contra hn + apply heq + apply Finset.Subset.antisymm hCX + intro v hv + by_contra hvo + exact hn ⟨v, hv, hvo⟩ + obtain ⟨j, hj, rfl⟩ := Finset.mem_image.mp + (show v ∈ Finset.image T.vertex Finset.univ from + by simpa [X, TreeSequenceVertexSet] using hv) + exact ⟨j.val, j.isLt, by simpa using hvc⟩ + +private theorem helper_hnlarge_106.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0), + ( + ∀ (C : TreeSequence G e0) (j : Fin (2 : ℕ)), T.vertex (Fin.castLE (Nat.succ_le_succ + T.positive) j) ∈ TreeSequenceVertexSet C) → + ∀ (C : TreeSequence G e0) (hex : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ + TreeSequenceVertexSet C), + let n : ℕ := Nat.find hex; + ∀ (hnlt : n < T.length + (1 : ℕ)), T.vertex (⟨n, hnlt⟩ : Fin (T.length + (1 : ℕ))) ∉ + TreeSequenceVertexSet C → (1 : ℕ) ≤ n → (2 : ℕ) ≤ n := by + classical + intro V E G e0 T first_vertices C hex n hnlt hnout hnpos + by_contra hh + have hcases : n = 0 ∨ n = 1 := by omega + rcases hcases with hzero | hone + · apply hnout + simpa [hzero] using first_vertices C ⟨0, by omega⟩ + · apply hnout + have hv := first_vertices C ⟨1, by omega⟩ + have hi : (⟨n, hnlt⟩ : Fin (T.length + 1)) = + Fin.castLE (Nat.succ_le_succ T.positive) ⟨1, by omega⟩ := by + apply Fin.ext + simp [hone] + rw [hi] + exact hv + +private theorem helper_prior_127.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T C : TreeSequence G + e0) (hex : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ + TreeSequenceVertexSet C), + let n : ℕ := Nat.find hex; + ∀ (hnlt : n < T.length + (1 : ℕ)) (hnlarge : (2 : ℕ) ≤ n), + let j : Fin T.length := (⟨n - (1 : ℕ), + by + omega + ⟩ : Fin T.length); (↑j : ℕ) + (1 : ℕ) = n → + ∀ (i : Fin ((↑j : ℕ) + (1 : ℕ))), (↑i : ℕ) ≤ (↑j : ℕ) → T.vertex (i.castLT (Nat.lt_trans + i.isLt (Nat.succ_lt_succ j.isLt))) ∈ TreeSequenceVertexSet C := by + classical + intro V E G e0 T C hex n hnlt hnlarge j hjrel i hil + by_contra hout + have hprop : ∃ hn : i.val < T.length + 1, + T.vertex ⟨i.val, hn⟩ ∉ TreeSequenceVertexSet C := + ⟨by omega, by + intro hm + apply hout + congr 1⟩ + have hmin : n ≤ i.val := Nat.find_min' hex hprop + exact (not_le_of_gt (by omega : i.val < n)) hmin + +private theorem helper_hedgenew_146.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ DecidableEq E] (G : LooplessMultigraph V E) (e0 : E) (T C : + TreeSequence G e0) (hex : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ + TreeSequenceVertexSet C), + let n : ℕ := Nat.find hex; + ∀ (hnlt : n < T.length + (1 : ℕ)) (hnlarge : (2 : ℕ) ≤ n), + let j : Fin T.length := (⟨n - (1 : ℕ), + by + omega + ⟩ : Fin T.length); T.vertex j.succ ∉ TreeSequenceVertexSet C → + ∀ (i : Fin ((↑j : ℕ) + (1 : ℕ))), G.ends (T.edge j) = s(T.vertex j.succ, T.vertex (i.castLT + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)))) → T.edge j ∉ Finset.image C.edge + Finset.univ := by + classical + intro V E _ G e0 T C hex n hnlt hnlarge j hjout i hiatt hedge + obtain ⟨l, -, hle⟩ := Finset.mem_image.mp hedge + obtain ⟨lc, hlc⟩ := C.attaches l + have hends : G.ends (C.edge l) = + Sym2.mk (C.vertex l.succ) (C.vertex (Fin.castLT lc + (Nat.lt_trans lc.isLt (Nat.succ_lt_succ l.isLt)))) := hlc + have hnew : T.vertex j.succ = + C.vertex l.succ ∨ T.vertex j.succ = + C.vertex (Fin.castLT lc (Nat.lt_trans lc.isLt (Nat.succ_lt_succ l.isLt))) := by + have hm : T.vertex j.succ ∈ + Sym2.mk (C.vertex l.succ) (C.vertex (Fin.castLT lc + (Nat.lt_trans lc.isLt (Nat.succ_lt_succ l.isLt)))) := by + rw [← hends, hle, hiatt] + exact Sym2.mem_iff.mpr (by exact Or.inl rfl) + exact Sym2.mem_iff.mp hm + rcases hnew with hnew | hnew + · have hmem : T.vertex j.succ ∈ + Finset.image C.vertex Finset.univ := by + exact Finset.mem_image.mpr ⟨l.succ, Finset.mem_univ _, hnew.symm⟩ + exact hjout hmem + · have hmem : T.vertex j.succ ∈ + Finset.image C.vertex Finset.univ := by + exact Finset.mem_image.mpr ⟨_, Finset.mem_univ _, hnew.symm⟩ + exact hjout hmem + +private theorem helper_branch_233.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T C : TreeSequence G + e0) (hex : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ + TreeSequenceVertexSet C), + let n : ℕ := Nat.find hex; + ∀ (hnlt : n < T.length + (1 : ℕ)) (hnlarge : (2 : ℕ) ≤ n), + let j : Fin T.length := (⟨n - (1 : ℕ), + by + omega + ⟩ : Fin T.length); + ∀ (i : Fin ((↑j : ℕ) + (1 : ℕ))), G.ends (T.edge j) = s(T.vertex j.succ, T.vertex (i.castLT + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)))) → + ∀ (r : Fin (C.length + (1 : ℕ))), C.vertex r = T.vertex (i.castLT (Nat.lt_trans i.isLt + (Nat.succ_lt_succ j.isLt))) → + ∃ (i : Fin ((↑(Fin.last C.length) : ℕ) + (1 : ℕ))), G.ends (Fin.lastCases (T.edge j) C.edge + (Fin.last C.length)) = s(Fin.lastCases (T.vertex j.succ) C.vertex (Fin.last + C.length).succ, Fin.lastCases (T.vertex j.succ) C.vertex (i.castLT (Nat.lt_trans i.isLt + (Nat.succ_lt_succ (Fin.last C.length).isLt)))) := by + classical + intro V E G e0 T C hex n hnlt hnlarge j i hiatt r hri + refine ⟨r, ?_⟩ + have hqidx : ((Fin.last C.length).succ : Fin (C.length + 2)) = + Fin.last (C.length + 1) := by + apply Fin.ext + simp + rw [hqidx] + simp only [Fin.lastCases_last] + have hridx : (Fin.castLT r (by omega) : Fin (C.length + 2)) = + r.castSucc := by + apply Fin.ext + rfl + rw [hridx] + simp only [Fin.lastCases_castSucc] + rw [hiatt] + congr 1 + exact hri.symm + +private theorem helper_branch_249.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T C : TreeSequence G + e0) (hex : + ∃ (n : ℕ) (hn : n < T.length + (1 : ℕ)), T.vertex (⟨n, hn⟩ : Fin (T.length + (1 : ℕ))) ∉ + TreeSequenceVertexSet C), + let n : ℕ := Nat.find hex; + ∀ (hnlt : n < T.length + (1 : ℕ)) (hnlarge : (2 : ℕ) ≤ n), + let j : Fin T.length := (⟨n - (1 : ℕ), + by + omega + ⟩ : Fin T.length); + ∀ (q : Fin C.length), + ∃ (i : Fin ((↑q.castSucc : ℕ) + (1 : ℕ))), G.ends (Fin.lastCases (T.edge j) C.edge q.castSucc) + = s(Fin.lastCases (T.vertex j.succ) C.vertex q.castSucc.succ, Fin.lastCases (T.vertex + j.succ) C.vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ q.castSucc.isLt)))) := by + classical + intro V E G e0 T C hex n hnlt hnlarge j q + obtain ⟨a, ha⟩ := C.attaches q + refine ⟨a, ?_⟩ + simp only [Fin.lastCases_castSucc] + have hqidx : (q.castSucc.succ : Fin (C.length + 2)) = + (q.succ : Fin (C.length + 1)).castSucc := by + apply Fin.ext + rfl + let aa : Fin (C.length + 1) := ⟨a.val, by omega⟩ + have haidx : (Fin.castLT a (by omega) : Fin (C.length + 2)) = + aa.castSucc := by + apply Fin.ext + rfl + have haold : (Fin.castLT a (by omega) : Fin (C.length + 1)) = aa := by + apply Fin.ext + rfl + rw [hqidx, haidx] + simp only [Fin.lastCases_castSucc] + simpa [haold] using ha + +private theorem helper_branch_88.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet T; TashkinovTree G e0 phi T → ( + ∀ (C : TreeSequence G e0) (j : Fin (2 : ℕ)), T.vertex (Fin.castLE (Nat.succ_le_succ + T.positive) j) ∈ TreeSequenceVertexSet C) → + ∀ (C : TreeSequence G e0), TashkinovTree G e0 phi C → TreeSequenceVertexSet C ⊆ X → + ¬TreeSequenceVertexSet C = X → + ∃ (D : TreeSequence G e0), TashkinovTree G e0 phi D ∧ TreeSequenceInitialSegment C D ∧ + TreeSequenceVertexSet D ⊆ X ∧ (D.length = C.length + (1 : ℕ) ∨ TreeSequenceVertexSet C = + X) := by + classical + intro V E _ _ G k e0 phi T X hTash first_vertices C hC hCX heq + let _ := Fintype.ofFinite V + have hex : ∃ n : ℕ, ∃ hn : n < T.length + 1, + T.vertex ⟨n, hn⟩ ∉ TreeSequenceVertexSet C := by + exact @helper_hex_83 (@V) (@E) (@G) (@e0) (@T) (@C) (@hCX) (@heq) + let n : ℕ := Nat.find hex + have hnlt : n < T.length + 1 := (Nat.find_spec hex).1 + have hnout : T.vertex ⟨n, hnlt⟩ ∉ TreeSequenceVertexSet C := + (Nat.find_spec hex).2 + have hnle : n ≤ T.length := by omega + have hnpos : 1 ≤ n := by + by_contra hp + have hnzero : n = 0 := by omega + apply hnout + simpa [hnzero] using first_vertices C ⟨0, by omega⟩ + have hnlarge : 2 ≤ n := by + exact @helper_hnlarge_106 (@V) (@E) (@G) (@e0) (@T) (@first_vertices) (@C) (@hex) (@hnlt) + (@hnout) (@hnpos) + let j : Fin T.length := ⟨n - 1, by omega⟩ + have hjrel : j.val + 1 = n := by + simp [j, Nat.sub_add_cancel hnpos] + have hjout : T.vertex j.succ ∉ TreeSequenceVertexSet C := by + have hidx : j.succ = ⟨n, hnlt⟩ := Fin.ext (by simp [j, hjrel]) + rw [hidx] + exact hnout + have prior : ∀ (i : Fin (j.val + 1)), i.val ≤ j.val → + T.vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) ∈ + TreeSequenceVertexSet C := by + exact @helper_prior_127 (@V) (@E) (@G) (@e0) (@T) (@C) (@hex) (@hnlt) (@hnlarge) (@hjrel) + obtain ⟨i, hiatt⟩ := T.attaches j + have hprior := prior i (by omega) + obtain ⟨r, hrC, hri⟩ := Finset.mem_image.mp + (show T.vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) ∈ + Finset.image C.vertex Finset.univ from by + simpa [TreeSequenceVertexSet] using hprior) + have hedgenew : T.edge j ∉ Finset.image C.edge Finset.univ := by + exact @helper_hedgenew_146 (@V) (@E) inferInstance (@G) (@e0) (@T) (@C) (@hex) (@hnlt) + (@hnlarge) (@hjout) (@i) (@hiatt) + let D : TreeSequence G e0 := + { length := C.length + 1 + positive := by omega + vertex := Fin.lastCases (T.vertex j.succ) C.vertex + edge := Fin.lastCases (T.edge j) C.edge + vertex_injective := by + intro a b + revert b + refine Fin.lastCases ?_ (fun a => ?_) a + · intro b + refine Fin.lastCases ?_ (fun b => ?_) b + · intro h; rfl + · intro h + dsimp only [Fin.lastCases] at h + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at h + exact (hjout (by + apply Finset.mem_image.mpr + exact ⟨b, Finset.mem_univ _, h.symm⟩)).elim + · intro b + refine Fin.lastCases ?_ (fun b => ?_) b + · intro h + dsimp only [Fin.lastCases] at h + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at h + exact (hjout (by + apply Finset.mem_image.mpr + exact ⟨a, Finset.mem_univ _, h⟩)).elim + · intro h + exact congrArg Fin.castSucc (C.vertex_injective (by + simpa only [Fin.lastCases_castSucc] using h)) + edge_injective := by + intro a b + revert b + refine Fin.lastCases ?_ (fun a => ?_) a + · intro b + refine Fin.lastCases ?_ (fun b => ?_) b + · intro h; rfl + · intro h + dsimp only [Fin.lastCases] at h + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at h + exact (hedgenew (by + apply Finset.mem_image.mpr + exact ⟨b, Finset.mem_univ _, h.symm⟩)).elim + · intro b + refine Fin.lastCases ?_ (fun b => ?_) b + · intro h + dsimp only [Fin.lastCases] at h + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at h + exact (hedgenew (by + apply Finset.mem_image.mpr + exact ⟨a, Finset.mem_univ _, h⟩)).elim + · intro h + exact congrArg Fin.castSucc (C.edge_injective (by + simpa only [Fin.lastCases_castSucc] using h)) + first_edge := by + have hzero : (⟨0, Nat.succ_pos C.length⟩ : Fin (C.length + 1)) = + (⟨0, C.positive⟩ : Fin C.length).castSucc := by rfl + rw [hzero] + simp only [Fin.lastCases_castSucc] + exact C.first_edge + attaches := by + intro q + refine Fin.lastCases ?_ (fun q => ?_) q + · exact @helper_branch_233 (@V) (@E) (@G) (@e0) (@T) (@C) (@hex) (@hnlt) (@hnlarge) (@i) + (@hiatt) (@r) (@hri) + · exact @helper_branch_249 (@V) (@E) (@G) (@e0) (@T) (@C) (@hex) (@hnlt) (@hnlarge) (@q) + } + refine ⟨D, ?_, ?_, ?_, Or.inl rfl⟩ + · intro q + refine Fin.lastCases ?_ (fun q => ?_) q + · intro hq + obtain ⟨a, c, hcolor, hmissing⟩ := hTash j (by omega) + have hav : T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt))) ∈ + TreeSequenceVertexSet C := prior a (by omega) + obtain ⟨s, hsC, hsa⟩ := Finset.mem_image.mp + (show T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt))) ∈ + Finset.image C.vertex Finset.univ from by + simpa [TreeSequenceVertexSet] using hav) + refine ⟨s, c, ?_, ?_⟩ + · simpa [D, Fin.lastCases] using hcolor + · have hsidx : (Fin.castLT s (by omega) : Fin (C.length + 2)) = + s.castSucc := by + apply Fin.ext + rfl + simpa [D, Fin.lastCases, hsidx, hsa] using hmissing + · intro hq + have hqold : 1 ≤ q.val := by exact hq + obtain ⟨a, c, hcolor, hmissing⟩ := hC q hqold + refine ⟨a, c, ?_, ?_⟩ + · simpa [D, Fin.lastCases] using hcolor + · have hqidx : (q.castSucc.succ : Fin (C.length + 2)) = + (q.succ : Fin (C.length + 1)).castSucc := by + apply Fin.ext + rfl + let aa : Fin (C.length + 1) := ⟨a.val, by omega⟩ + have haidx : (Fin.castLT a (by omega) : Fin (C.length + 2)) = + aa.castSucc := by + apply Fin.ext + rfl + have haold : (Fin.castLT a (by omega) : Fin (C.length + 1)) = aa := by + apply Fin.ext + rfl + simpa [D, Fin.lastCases, hqidx, haidx, haold] using hmissing + · change ∃ hlen : C.length ≤ D.length, + (∀ i : Fin (C.length + 1), + D.vertex (Fin.castLE (Nat.succ_le_succ hlen) i) = C.vertex i) ∧ + ∀ jx : Fin C.length, D.edge (Fin.castLE hlen jx) = C.edge jx + refine ⟨by dsimp [D]; omega, ?_, ?_⟩ + · intro i + have hi : Fin.castLE (Nat.succ_le_succ (Nat.le_succ C.length)) i = + i.castSucc := by + apply Fin.ext + rfl + rw [hi] + simp [D, Fin.lastCases_castSucc] + · intro jx + have hjx : Fin.castLE (Nat.le_succ C.length) jx = + jx.castSucc := by + apply Fin.ext + rfl + rw [hjx] + simp [D, Fin.lastCases_castSucc] + · intro v hv + change v ∈ Finset.univ.image D.vertex at hv + obtain ⟨a, -, haeq⟩ := Finset.mem_image.mp hv + rw [← haeq] + by_cases ha : a.val ≤ C.length + · let b : Fin (C.length + 1) := ⟨a.val, by omega⟩ + have haidx : a = b.castSucc := by + apply Fin.ext + rfl + have hb : C.vertex b ∈ TreeSequenceVertexSet C := by + change C.vertex b ∈ Finset.univ.image C.vertex + exact Finset.mem_image.mpr ⟨b, Finset.mem_univ _, rfl⟩ + have hc : C.vertex b ∈ X := hCX hb + simpa [D, Fin.lastCases, haidx] using hc + · have halt : a.val < C.length + 2 := by simp [D] + have haeq : a = Fin.last (C.length + 1) := by + apply Fin.ext + simp + omega + have hnew : T.vertex j.succ ∈ X := by + change T.vertex j.succ ∈ Finset.univ.image T.vertex + exact Finset.mem_image.mpr ⟨j.succ, Finset.mem_univ _, rfl⟩ + simpa [D, Fin.lastCases, haeq] using hnew + +private theorem helper_extend_77.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet T; TashkinovTree G e0 phi T → ( + ∀ (C : TreeSequence G e0) (j : Fin (2 : ℕ)), T.vertex (Fin.castLE (Nat.succ_le_succ + T.positive) j) ∈ TreeSequenceVertexSet C) → + ∀ (C : TreeSequence G e0), TashkinovTree G e0 phi C → TreeSequenceVertexSet C ⊆ X → + ∃ (D : TreeSequence G e0), TashkinovTree G e0 phi D ∧ TreeSequenceInitialSegment C D ∧ + TreeSequenceVertexSet D ⊆ X ∧ (D.length = C.length + (1 : ℕ) ∨ TreeSequenceVertexSet C = + X) := by + classical + intro V E _ _ G k e0 phi T X hTash first_vertices C hC hCX + let _ := Fintype.ofFinite V + by_cases heq : TreeSequenceVertexSet C = X + · exact ⟨C, hC, by + refine ⟨le_rfl, ?_, ?_⟩ + · intro i; rfl + · intro j; rfl, by simp [heq]⟩ + · exact @helper_branch_88 V E inferInstance inferInstance G k e0 phi T hTash + first_vertices C hC hCX heq +theorem ScheideMaximalExtendsEveryTree {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T S : TreeSequence G e0) + (htriple : KTriple G k e0 phi) + (hmax : FixedPairMaximalTashkinovTree G e0 phi T) + (hS : TashkinovTree G e0 phi S) : + ∃ T' : TreeSequence G e0, + TashkinovTree G e0 phi T' ∧ + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + TreeSequenceInitialSegment S T' := by + classical + let X := TreeSequenceVertexSet T + have hsub : TreeSequenceVertexSet S ⊆ X := + ScheideMaximalContainsEveryTree G k e0 phi T S htriple hmax hS + have hTash : TashkinovTree G e0 phi T := hmax.1 + have first_vertices : ∀ (C : TreeSequence G e0) (j : Fin 2), + T.vertex (Fin.castLE (Nat.succ_le_succ T.positive) j) ∈ + TreeSequenceVertexSet C := by + exact @helper_first_vertices_42 V E G e0 T + have extend : + ∀ (C : TreeSequence G e0), TashkinovTree G e0 phi C → TreeSequenceVertexSet C ⊆ X → + ∃ D : TreeSequence G e0, TashkinovTree G e0 phi D ∧ TreeSequenceInitialSegment C D ∧ + TreeSequenceVertexSet D ⊆ X ∧ (D.length = C.length + 1 ∨ TreeSequenceVertexSet C = X) := by + exact @helper_extend_77 V E inferInstance inferInstance G k e0 phi T hTash + first_vertices + have initial_trans : ∀ (A B C : TreeSequence G e0), + TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C → + TreeSequenceInitialSegment A C := by + intro A B C hab hbc + rcases hab with ⟨hab, hvab, heab⟩ + rcases hbc with ⟨hbc, hvbc, hebc⟩ + refine ⟨le_trans hab hbc, ?_, ?_⟩ + · intro i + have hi : Fin.castLE (Nat.succ_le_succ (le_trans hab hbc)) i = + Fin.castLE (Nat.succ_le_succ hbc) + (Fin.castLE (Nat.succ_le_succ hab) i) := by + apply Fin.ext + rfl + rw [hi, hvbc] + exact hvab i + · intro j + have hj : Fin.castLE (le_trans hab hbc) j = + Fin.castLE hbc (Fin.castLE hab j) := by + apply Fin.ext + rfl + rw [hj, hebc] + exact heab j + have vertex_card : ∀ U : TreeSequence G e0, + (TreeSequenceVertexSet U).card = U.length + 1 := by + intro U + rw [TreeSequenceVertexSet, + Finset.card_image_of_injective Finset.univ U.vertex_injective, + Finset.card_univ, Fintype.card_fin] + let measure : TreeSequence G e0 → ℕ := fun U => + X.card - (TreeSequenceVertexSet U).card + have finish : ∀ m : ℕ, ∀ C : TreeSequence G e0, + measure C = m → TashkinovTree G e0 phi C → + TreeSequenceVertexSet C ⊆ X → TreeSequenceInitialSegment S C → + ∃ R : TreeSequence G e0, TashkinovTree G e0 phi R ∧ + TreeSequenceVertexSet R = X ∧ TreeSequenceInitialSegment S R := by + intro m + induction m using Nat.strong_induction_on with + | h m ih => + intro C hm hC hCX hSC + by_cases heq : TreeSequenceVertexSet C = X + · exact ⟨C, hC, heq, hSC⟩ + · obtain ⟨D, hD, hCD, hDX, hlenOr⟩ := extend C hC hCX + have hcardC : (TreeSequenceVertexSet C).card = C.length + 1 := + vertex_card C + have hcardD : (TreeSequenceVertexSet D).card = D.length + 1 := + vertex_card D + have hlen : C.length + 1 = D.length := by + rcases hlenOr with hlen | heqC + · exact hlen.symm + · exact (heq heqC).elim + have hmeasure : measure D < m := by + have hX : (TreeSequenceVertexSet D).card ≤ X.card := + Finset.card_le_card hDX + have hpos : 1 ≤ C.length + 1 := by omega + simp [measure, hcardC, hcardD, hlen] at hm ⊢ + omega + obtain ⟨R, hR, hRX, hSR⟩ := ih _ hmeasure D rfl hD hDX + (initial_trans S C D hSC hCD) + exact ⟨R, hR, hRX, hSR⟩ + obtain ⟨R, hR, hRX, hSR⟩ := finish (measure S) S rfl hS hsub + ⟨le_rfl, (by intro i; rfl), (by intro j; rfl)⟩ + exact ⟨R, hR, hRX, hSR⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideMaximalKempePath.lean b/LeanPool/GoldbergSeymour/ScheideMaximalKempePath.lean new file mode 100644 index 0000000000..4b2fd5da27 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideMaximalKempePath.lean @@ -0,0 +1,783 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideMaximalContainsEveryTree +public import LeanPool.GoldbergSeymour.ScheideMaximalElementaryClosed +public import LeanPool.GoldbergSeymour.TashTree +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TashkinovTreeComponentSwapWitnessTransport + +/-! +# Scheide Maximal Kempe Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hend_neighbor_227.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) (i _ : Fin (S.length + (1 + : ℕ))) (gamma delta : Fin k), gamma ∈ MissingColors G phi (S.vertex i) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G phi gamma delta (Sum.inl (S.vertex i)); + IsProperEdgeColoring G phi → gamma ≠ delta → + ∀ (_ b : V ⊕ E) (p : H.Walk (Sum.inl (S.vertex i)) b), p.IsPath → {z : V ⊕ E | z ∈ p.support} + = C → ¬p.Nil → (0 : ℕ) < p.length → b ∈ C → + ∀ (z : V ⊕ E), H.Adj b z → z = p.getVert (p.length - (1 : ℕ)) := by + classical + intro V E _ _ G k e0 phi S i j gamma delta hgamma H C hproper hne b b p hp hps hpnil hp_pos hbC z + hbz + let _ := Fintype.ofFinite V + have hzC : z ∈ C := by + change H.connectedComponentMk z = + H.connectedComponentMk (Sum.inl (S.vertex i)) + change H.connectedComponentMk b = + H.connectedComponentMk (Sum.inl (S.vertex i)) at hbC + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hbz).symm.trans hbC + have hzSupport : z ∈ p.support := by + change z ∈ {w | w ∈ p.support} + rw [hps] + exact hzC + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hzSupport + have hnlt : n < p.length := by + have hnne : n ≠ p.length := by + intro heq + have hzb : z = b := by + rw [← hn, heq, p.getVert_length] + exact hbz.ne hzb.symm + omega + by_cases hpen : n + 1 = p.length + · rw [← hn] + congr 1 + omega + by_cases hn0 : n = 0 + · have hnext : H.Adj (Sum.inl (S.vertex i)) (p.getVert 1) := by + simpa [hn0, p.getVert_zero] using p.adj_getVert_succ hnlt + have hbstart : H.Adj (Sum.inl (S.vertex i)) b := by + rw [← hn, hn0, p.getVert_zero] at hbz + exact hbz.symm + have hneNext : p.getVert 1 ≠ b := by + intro heq + have hindices := hp.getVert_injOn + (show 1 ≤ p.length by omega) (show p.length ≤ p.length by rfl) + (heq.trans p.getVert_length.symm) + omega + let : Fintype (H.neighborSet (Sum.inl (S.vertex i))) := + Fintype.ofFinite _ + have htwo : 2 ≤ @SimpleGraph.degree _ H (Sum.inl (S.vertex i)) + (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let ss : Finset (Sum V E) := {p.getVert 1, b} + have hss : ss ⊆ H.neighborFinset (Sum.inl (S.vertex i)) := by + intro w hw + simp only [ss, Finset.mem_insert, Finset.mem_singleton] at hw + rcases hw with rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hnext + · simpa [SimpleGraph.mem_neighborFinset] using hbstart + have hc : 2 ≤ ss.card := by simp [ss, hneNext] + exact hc.trans (Finset.card_le_card hss) + have honeDeg : @SimpleGraph.degree _ H (Sum.inl (S.vertex i)) + (Fintype.ofFinite _) ≤ 1 := by + simpa [H] using MissingColorIncidenceEndpoint G phi gamma delta hne + hproper (S.vertex i) hgamma + omega + · have hnpos : 0 < n := Nat.pos_of_ne_zero hn0 + have hleft : H.Adj z (p.getVert (n - 1)) := by + rw [← hn] + have hadj := p.adj_getVert_succ (i := n - 1) (by omega) + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ n)] using hadj.symm + have hright : H.Adj z (p.getVert (n + 1)) := by + rw [← hn] + exact p.adj_getVert_succ hnlt + have hbneLeft : b ≠ p.getVert (n - 1) := by + intro heq + have hindices := hp.getVert_injOn + (show p.length ≤ p.length by rfl) (show n - 1 ≤ p.length by omega) + (p.getVert_length.trans heq) + omega + have hbneRight : b ≠ p.getVert (n + 1) := by + intro heq + have hindices := hp.getVert_injOn + (show p.length ≤ p.length by rfl) (show n + 1 ≤ p.length by omega) + (p.getVert_length.trans heq) + omega + have hlrne : p.getVert (n - 1) ≠ p.getVert (n + 1) := by + intro heq + have hindices := hp.getVert_injOn + (show n - 1 ≤ p.length by omega) (show n + 1 ≤ p.length by omega) heq + omega + let : Fintype (H.neighborSet z) := Fintype.ofFinite _ + have hthree : 3 ≤ @SimpleGraph.degree _ H z (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let ss : Finset (Sum V E) := {b, p.getVert (n - 1), p.getVert (n + 1)} + have hss : ss ⊆ H.neighborFinset z := by + intro w hw + simp only [ss, Finset.mem_insert, Finset.mem_singleton] at hw + rcases hw with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hbz.symm + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc : 3 ≤ ss.card := by + simp [ss, hbneLeft, hbneRight, hlrne] + exact hc.trans (Finset.card_le_card hss) + have htwo : @SimpleGraph.degree _ H z (Fintype.ofFinite _) ≤ 2 := by + simpa [H] using TwoColorIncidenceDegreeAtMostTwo G phi gamma delta hproper z + omega + +private theorem helper_hbVertex_325.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (S : TreeSequence G e0) (i _ : Fin (S.length + (1 : ℕ))) (gamma + delta : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma delta; + ∀ (_ b : V ⊕ E) (p : H.Walk (Sum.inl (S.vertex i)) b), (0 : ℕ) < p.length → ( + ∀ (z : V ⊕ E), H.Adj b z → z = p.getVert (p.length - (1 : ℕ))) → + ∃ (v : V), b = Sum.inl v := by + classical + intro V E G k e0 phi S i j gamma delta H b b p hp_pos hend_neighbor + cases hbcase : b with + | inl v => exact ⟨v, rfl⟩ + | inr e => + have hlastAdj : H.Adj (p.getVert (p.length - 1)) b := by + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ p.length), + p.getVert_length] using + p.adj_getVert_succ (i := p.length - 1) (by omega) + have hecolor : phi e = some gamma ∨ phi e = some delta := by + cases hprev : p.getVert (p.length - 1) with + | inl v => + rw [hprev, hbcase] at hlastAdj + simpa [H, TwoColorIncidenceGraph] using hlastAdj |>.2 + | inr f => + rw [hprev, hbcase] at hlastAdj + simp [H, TwoColorIncidenceGraph] at hlastAdj + induction hends : G.ends e using Sym2.inductionOn with + | _ u v => + have huv : u ≠ v := by + intro huv + subst v + exact G.loopless e u hends + have huAdj : H.Adj b (Sum.inl u) := by + rw [hbcase] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G u e ∧ + (phi e = some gamma ∨ phi e = some delta) from + ⟨by simp [Incident, hends], hecolor⟩) + have hvAdj : H.Adj b (Sum.inl v) := by + rw [hbcase] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G v e ∧ + (phi e = some gamma ∨ phi e = some delta) from + ⟨by simp [Incident, hends], hecolor⟩) + have heq := (hend_neighbor _ huAdj).trans (hend_neighbor _ hvAdj).symm + exact False.elim (huv (Sum.inl.inj heq)) + +private theorem helper_hvlast_eq_j_369.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T S : TreeSequence G e0) (i j : Fin (S.length + + (1 : ℕ))) (gamma delta : Fin k), gamma ∈ MissingColors G phi (S.vertex i) → delta ∈ + MissingColors G phi (S.vertex j) → + let X : Finset V := TreeSequenceVertexSet T; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma delta; gamma ≠ delta → + S.vertex i ∈ X → S.vertex j ∈ X → ColoredVertexSetElementary G phi X → + ∀ (_ b : V ⊕ E) (p : H.Walk (Sum.inl (S.vertex i)) b), ( + ∀ (z : V ⊕ E), H.Adj b z → z = p.getVert (p.length - (1 : ℕ))) → + ∀ (vlast : V), b = Sum.inl vlast → vlast ∈ X → vlast ≠ S.vertex i → vlast = S.vertex j := by + classical + intro V E _ _ G k e0 phi T S i j gamma delta hgamma hdelta X H hne hXi hXj hXelem b b p + hend_neighbor vlast hb hvlastX hvlast_ne_i + let _ := Fintype.ofFinite V + by_contra hne_j + have hgnot : gamma ∉ MissingColors G phi vlast := by + intro hm + have hd := hXelem hXi hvlastX (Ne.symm hvlast_ne_i) + exact (Finset.disjoint_left.mp hd) hgamma hm + have hdnot : delta ∉ MissingColors G phi vlast := by + intro hm + have hd := hXelem hXj hvlastX (Ne.symm hne_j) + exact (Finset.disjoint_left.mp hd) hdelta hm + have hgpres : gamma ∈ PresentColors G phi vlast := by + simpa [MissingColors] using hgnot + have hdpres : delta ∈ PresentColors G phi vlast := by + simpa [MissingColors] using hdnot + obtain ⟨eg, hegInc, hegColor⟩ := by simpa [PresentColors] using hgpres + obtain ⟨ed, hedInc, hedColor⟩ := by simpa [PresentColors] using hdpres + have hegAdj : H.Adj b (Sum.inr eg) := by + rw [hb] + simpa [H, TwoColorIncidenceGraph] using + (show Incident G vlast eg ∧ + (phi eg = some gamma ∨ phi eg = some delta) from + ⟨hegInc, Or.inl hegColor⟩) + have hedAdj : H.Adj b (Sum.inr ed) := by + rw [hb] + simpa [H, TwoColorIncidenceGraph] using + (show Incident G vlast ed ∧ + (phi ed = some gamma ∨ phi ed = some delta) from + ⟨hedInc, Or.inr hedColor⟩) + have heq := (hend_neighbor _ hegAdj).trans (hend_neighbor _ hedAdj).symm + have egeq : eg = ed := Sum.inr.inj heq + subst ed + exact hne (Option.some.inj (hegColor.symm.trans hedColor)) + +private theorem helper_hflip_497.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi + : PartialEdgeColoring E k) (S : TreeSequence G e0) (i j : Fin (S.length + (1 : ℕ))) (gamma + delta : Fin k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma delta; IsProperEdgeColoring + G phi → gamma ≠ delta → + ∀ (p : H.Walk (Sum.inl (S.vertex i)) (Sum.inl (S.vertex j))), p.IsPath → ( + ∀ n ≤ p.length, (n % (2 : ℕ) = (0 : ℕ) → + ∃ (v : V), p.getVert n = Sum.inl v) ∧ (n % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), p.getVert n = Sum.inr e)) → + let m : ℕ := p.length / (2 : ℕ); p.length = (2 : ℕ) * m → ( + ∀ n < m, + ∃ (e : E), p.getVert ((2 : ℕ) * n + (1 : ℕ)) = Sum.inr e ∧ (phi e = some gamma ∨ phi e = some + delta)) → ( + ∃ (e : E), p.getVert (1 : ℕ) = Sum.inr e ∧ phi e = some delta) → + ∀ n < m, (n % (2 : ℕ) = (0 : ℕ) → + ∃ (e : E), p.getVert ((2 : ℕ) * n + (1 : ℕ)) = Sum.inr e ∧ phi e = some delta) ∧ (n % (2 : ℕ) + = (1 : ℕ) → + ∃ (e : E), p.getVert ((2 : ℕ) * n + (1 : ℕ)) = Sum.inr e ∧ phi e = some gamma) := by + classical + intro V E _ G k e0 phi S i j gamma delta H hproper hne p hp hshape m hlen hcolored hfirst n + let := Fintype.ofFinite E + induction n with + | zero => + intro hn + exact ⟨fun _ => hfirst, fun h => by omega⟩ + | succ n ih => + intro hn + have hnold : n < m := by omega + have hold := ih hnold + obtain ⟨f, hf, hfcolor⟩ := hcolored (n + 1) hn + have step_data : ∀ (e : E), + p.getVert (2 * n + 1) = Sum.inr e → + ∀ (c : Fin k), phi e = some c → + ∃ f, p.getVert (2 * (n + 1) + 1) = Sum.inr f ∧ + phi f = some (if c = gamma then delta else gamma) := by + intro e he c hec + have hef : e ≠ f := by + intro heq + subst f + have hindices := hp.getVert_injOn + (show 2 * n + 1 ≤ p.length by rw [hlen]; omega) + (show 2 * (n + 1) + 1 ≤ p.length by rw [hlen]; omega) + (he.trans hf.symm) + omega + obtain ⟨v, hv⟩ := + (hshape (2 * n + 2) (by rw [hlen]; omega)).1 (by omega) + have ha := p.adj_getVert_succ (i := 2 * n + 1) + (by rw [hlen]; omega) + have hb := p.adj_getVert_succ (i := 2 * n + 2) + (by rw [hlen]; omega) + rw [he, hv] at ha + have hf' : p.getVert (2 * n + 2 + 1) = Sum.inr f := by + rw [show 2 * n + 2 + 1 = 2 * (n + 1) + 1 by omega] + exact hf + rw [hv, hf'] at hb + have haData : Incident G v e ∧ + (phi e = some gamma ∨ phi e = some delta) := by + simpa [H, TwoColorIncidenceGraph] using ha + have hbData : Incident G v f ∧ + (phi f = some gamma ∨ phi f = some delta) := by + simpa [H, TwoColorIncidenceGraph] using hb + by_cases hcg : c = gamma + · subst c + have hfd : phi f = some delta := hfcolor.resolve_left (by + intro hfg + exact (hproper hef ⟨v, haData.1, hbData.1⟩ hec) hfg) + exact ⟨f, hf, by simpa [hne] using hfd⟩ + · have hcd : c = delta := by + rcases haData.2 with h | h + · exact False.elim (hcg (Option.some.inj (hec.symm.trans h))) + · exact Option.some.inj (hec.symm.trans h) + have hfg : phi f = some gamma := hfcolor.resolve_right (by + intro hfd + exact (hproper hef ⟨v, haData.1, hbData.1⟩ + (hcd ▸ hec)) hfd) + exact ⟨f, hf, by simpa [hcg] using hfg⟩ + constructor + · intro heven + obtain ⟨e, he, hec⟩ := hold.2 (by omega) + obtain ⟨f, hf', hfc⟩ := step_data e he gamma hec + exact ⟨f, hf', by simpa [hne] using hfc⟩ + · intro hodd + obtain ⟨e, he, hec⟩ := hold.1 (by omega) + obtain ⟨f, hf', hfc⟩ := step_data e he delta hec + have hdg : delta ≠ gamma := hne.symm + exact ⟨f, hf', by simpa [hdg] using hfc⟩ + +private theorem helper_branch_588.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (S : TreeSequence G e0), TashkinovTree G e0 phi S + → + ∀ (i j : Fin (S.length + (1 : ℕ))), (↑i : ℕ) < (↑j : ℕ) → + ∀ (gamma delta : Fin k), gamma ∈ MissingColors G phi (S.vertex i) → delta ∈ MissingColors G + phi (S.vertex j) → + let XS : Finset V := TreeSequenceVertexSet S; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma delta; + let _ : Set (V ⊕ E) := TwoColorComponent G phi gamma delta (Sum.inl (S.vertex i)); + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → ColoredVertexSetElementary G phi + XS → S.vertex j ∈ XS → gamma ≠ delta → + ∀ (_ : H.Walk (Sum.inl (S.vertex i)) (Sum.inl (S.vertex j))), TreeColorUnusedThrough phi S + gamma j → IsProperEdgeColoring G (TwoColorComponentSwap G phi gamma delta (Sum.inl + (S.vertex i))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi gamma delta (Sum.inl + (S.vertex i))) e0 ∧ TashkinovTree G e0 (TwoColorComponentSwap G phi gamma delta (Sum.inl + (S.vertex i))) S := by + classical + intro V E _ _ G k e0 phi S hS i j hij gamma delta hgamma hdelta XS H C hproper hone hSelem hjS hne + p hgammaUnused + let _ := Fintype.ofFinite V + have hdeltaUnused : TreeColorUnusedThrough phi S delta j := by + intro r hr hrj hed + obtain ⟨w, c, hc, hm⟩ := hS r hr + have hcEq : c = delta := Option.some.inj (hc.symm.trans hed) + subst c + let wfull : Fin (S.length + 1) := Fin.castLT w + (Nat.lt_trans w.isLt (Nat.succ_lt_succ r.isLt)) + have hwS : S.vertex wfull ∈ XS := by + simp [XS, TreeSequenceVertexSet] + have hwlt : wfull.val < j.val := by + dsimp [wfull] + omega + have hwne : S.vertex wfull ≠ S.vertex j := by + intro heq + have hind := S.vertex_injective heq + exact (Fin.ne_of_lt hwlt) hind + have hd := hSelem hwS hjS hwne + exact (Finset.disjoint_left.mp hd) hm hdelta + have hcc : H.connectedComponentMk (Sum.inl (S.vertex i)) = + H.connectedComponentMk (Sum.inl (S.vertex j)) := by + exact SimpleGraph.ConnectedComponent.eq.mpr ⟨p⟩ + have hiCj : Sum.inl (S.vertex i) ∈ + TwoColorComponent G phi gamma delta (Sum.inl (S.vertex j)) := by + change H.connectedComponentMk (Sum.inl (S.vertex i)) = + H.connectedComponentMk (Sum.inl (S.vertex j)) + exact hcc + have htransport := TashkinovTreeComponentSwapWitnessTransport + G k e0 phi S hproper hS i j hij gamma delta hne hgamma hdelta + hgammaUnused hdeltaUnused + dsimp only at htransport + have hTashJ : TashkinovTree G e0 + (TwoColorComponentSwap G phi gamma delta + (Sum.inl (S.vertex j))) S := + (htransport.2.2 hiCj).2 + have hcompEq : + TwoColorComponent G phi gamma delta (Sum.inl (S.vertex i)) = + TwoColorComponent G phi gamma delta (Sum.inl (S.vertex j)) := by + exact congrArg SimpleGraph.ConnectedComponent.supp hcc + have hswapEq : + TwoColorComponentSwap G phi gamma delta (Sum.inl (S.vertex i)) = + TwoColorComponentSwap G phi gamma delta (Sum.inl (S.vertex j)) := by + funext e + simp only [TwoColorComponentSwap] + rw [hcompEq] + have hproper' : IsProperEdgeColoring G + (TwoColorComponentSwap G phi gamma delta + (Sum.inl (S.vertex i))) := + TwoColorComponentSwapProper G phi gamma delta hne hproper + (Sum.inl (S.vertex i)) + have hone' : IsOneEdgeUncolored + (TwoColorComponentSwap G phi gamma delta + (Sum.inl (S.vertex i))) e0 := by + constructor + · simp [TwoColorComponentSwap, hone.1] + · intro e he0 + obtain ⟨c, hc⟩ := hone.2 e he0 + by_cases heC : Sum.inr e ∈ C + · by_cases hcg : c = gamma + · refine ⟨delta, ?_⟩ + simp [TwoColorComponentSwap, C, heC, hc, hcg] + · by_cases hcd : c = delta + · refine ⟨gamma, ?_⟩ + simp [TwoColorComponentSwap, C, heC, hc, hcd] + · refine ⟨c, ?_⟩ + simp [TwoColorComponentSwap, C, heC, hc, hcg, hcd] + · exact ⟨c, by + simpa [TwoColorComponentSwap, C, heC] using hc⟩ + exact ⟨hproper', hone', by simpa [hswapEq] using hTashJ⟩ + +private theorem helper_continuation_613.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T S : TreeSequence G e0), TashkinovTree G e0 phi + S → + ∀ (i j : Fin (S.length + (1 : ℕ))), (↑i : ℕ) < (↑j : ℕ) → + ∀ (gamma delta : Fin k), gamma ∈ MissingColors G phi (S.vertex i) → delta ∈ MissingColors G + phi (S.vertex j) → + let X : Finset V := TreeSequenceVertexSet T; + let XS : Finset V := TreeSequenceVertexSet S; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi gamma delta; + let C : Set (V ⊕ E) := TwoColorComponent G phi gamma delta (Sum.inl (S.vertex i)); + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → ColoredVertexSetElementary G phi + XS → S.vertex j ∈ XS → gamma ≠ delta → S.vertex i ∈ X → S.vertex j ∈ X → + ColoredVertexSetElementary G phi X → ( + ∀ (v : V), Sum.inl v ∈ C → v ∈ X) → + ∀ (b : V ⊕ E) (p : H.Walk (Sum.inl (S.vertex i)) b), p.IsPath → {z : V ⊕ E | z ∈ p.support} = + C → + ∀ (firstEdge : E), Sum.inr firstEdge ∈ C → + ∃ (p : (TwoColorIncidenceGraph G phi gamma delta).Walk (Sum.inl (S.vertex i)) (Sum.inl + (S.vertex j))), p.IsPath ∧ {z : V ⊕ E | z ∈ p.support} = TwoColorComponent G phi gamma + delta (Sum.inl (S.vertex i)) ∧ (4 : ℕ) ∣ p.length ∧ ( + ∀ (v : V), Sum.inl v ∈ p.support → v ∈ TreeSequenceVertexSet T) ∧ (TreeColorUnusedThrough phi + S gamma j → IsProperEdgeColoring G (TwoColorComponentSwap G phi gamma delta (Sum.inl + (S.vertex i))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi gamma delta (Sum.inl + (S.vertex i))) e0 ∧ TashkinovTree G e0 (TwoColorComponentSwap G phi gamma delta (Sum.inl + (S.vertex i))) S) := by + classical + intro V E _ _ G k e0 phi T S hS i j hij gamma delta hgamma hdelta X XS H C hproper hone hSelem hjS + hne hXi hXj hXelem hcomponent_vertex b p hp hps firstEdge hfirstC + let _ := Fintype.ofFinite V + have hpnil : ¬ p.Nil := by + intro hnil + have hfirstSupport : Sum.inr firstEdge ∈ p.support := by + change Sum.inr firstEdge ∈ {z | z ∈ p.support} + rw [hps] + exact hfirstC + cases hnil + simp at hfirstSupport + have hp_pos : 0 < p.length := SimpleGraph.Walk.not_nil_iff_lt_length.mp hpnil + have hbC : b ∈ C := by + rw [← hps] + change b ∈ p.support + simpa only [p.getVert_length] using p.getVert_mem_support p.length + have hend_neighbor := @helper_hend_neighbor_227 V E inferInstance inferInstance G k e0 phi S i j + gamma delta hgamma hproper hne b b p hp hps hpnil hp_pos hbC + have hbVertex := @helper_hbVertex_325 V E G k e0 phi S i j gamma delta b b p hp_pos hend_neighbor + obtain ⟨vlast, hb⟩ := hbVertex + have hvlastC : Sum.inl vlast ∈ C := by simpa [hb] using hbC + have hvlastX : vlast ∈ X := hcomponent_vertex vlast hvlastC + have hvlast_ne_i : vlast ≠ S.vertex i := by + intro heq + have hendsame : b = Sum.inl (S.vertex i) := by simp [hb, heq] + have : p.Nil := hp.nil_iff_eq.mpr hendsame.symm + exact hpnil this + have hvlast_eq_j := @helper_hvlast_eq_j_369 V E inferInstance inferInstance G k e0 phi T S i j + gamma delta hgamma hdelta hne hXi hXj hXelem b b p hend_neighbor vlast hb hvlastX hvlast_ne_i + subst vlast + have hbfinal : b = Sum.inl (S.vertex j) := hb + subst b + have hshape : ∀ n ≤ p.length, + (n % 2 = 0 → ∃ v, p.getVert n = Sum.inl v) ∧ + (n % 2 = 1 → ∃ e, p.getVert n = Sum.inr e) := by + intro n + induction n with + | zero => + intro hn + constructor + · intro _ + exact ⟨S.vertex i, p.getVert_zero⟩ + · omega + | succ n ih => + intro hn + have hnlt : n < p.length := by omega + have hadj := p.adj_getVert_succ hnlt + have hold := ih (by omega) + constructor + · intro heven + obtain ⟨e, he⟩ := hold.2 (by omega) + cases hnext : p.getVert (n + 1) with + | inl v => exact ⟨v, rfl⟩ + | inr f => + rw [he, hnext] at hadj + simp [H, TwoColorIncidenceGraph] at hadj + · intro hodd + obtain ⟨v, hv⟩ := hold.1 (by omega) + cases hnext : p.getVert (n + 1) with + | inl w => + rw [hv, hnext] at hadj + simp [H, TwoColorIncidenceGraph] at hadj + | inr e => exact ⟨e, rfl⟩ + have hlenEven : p.length % 2 = 0 := by + by_contra hnot + have hodd : p.length % 2 = 1 := by omega + obtain ⟨e, he⟩ := (hshape p.length (by rfl)).2 hodd + rw [p.getVert_length] at he + simp at he + let m := p.length / 2 + have hlen : p.length = 2 * m := by + dsimp [m] + omega + have hmpos : 0 < m := by + rw [hlen] at hp_pos + omega + have hcolored : ∀ n < m, ∃ e, + p.getVert (2 * n + 1) = Sum.inr e ∧ + (phi e = some gamma ∨ phi e = some delta) := by + intro n hn + have hindex : 2 * n + 1 ≤ p.length := by rw [hlen]; omega + obtain ⟨e, he⟩ := (hshape (2 * n + 1) hindex).2 (by omega) + obtain ⟨v, hv⟩ := (hshape (2 * n) (by rw [hlen]; omega)).1 (by omega) + have hadj := p.adj_getVert_succ (i := 2 * n) (by rw [hlen]; omega) + rw [hv, he] at hadj + have hdata : Incident G v e ∧ + (phi e = some gamma ∨ phi e = some delta) := by + simpa [H, TwoColorIncidenceGraph] using hadj + exact ⟨e, he, hdata.2⟩ + have hfirst : ∃ e, p.getVert 1 = Sum.inr e ∧ phi e = some delta := by + obtain ⟨e, he, hecolor⟩ := hcolored 0 hmpos + have hadj := p.adj_getVert_succ (i := 0) (by rw [hlen]; omega) + rw [p.getVert_zero, he] at hadj + have hdata : Incident G (S.vertex i) e ∧ + (phi e = some gamma ∨ phi e = some delta) := by + simpa [H, TwoColorIncidenceGraph] using hadj + have hnotGamma : phi e ≠ some gamma := by + intro heg + have hpresent : gamma ∈ PresentColors G phi (S.vertex i) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hdata.1, heg⟩ + have hnotpresent : gamma ∉ PresentColors G phi (S.vertex i) := by + simpa [MissingColors] using hgamma + exact hnotpresent hpresent + exact ⟨e, he, hecolor.resolve_left hnotGamma⟩ + have hlast : ∃ e, p.getVert (p.length - 1) = Sum.inr e ∧ + phi e = some gamma := by + obtain ⟨e, he, hecolor⟩ := hcolored (m - 1) (by omega) + have hindex : 2 * (m - 1) + 1 = p.length - 1 := by rw [hlen]; omega + rw [hindex] at he + have hadj := p.adj_getVert_succ (i := p.length - 1) (by omega) + have hnext : p.length - 1 + 1 = p.length := by omega + rw [hnext, p.getVert_length, he] at hadj + have hdata : Incident G (S.vertex j) e ∧ + (phi e = some gamma ∨ phi e = some delta) := by + simpa [H, TwoColorIncidenceGraph] using hadj.symm + have hnotDelta : phi e ≠ some delta := by + intro hed + have hpresent : delta ∈ PresentColors G phi (S.vertex j) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hdata.1, hed⟩ + have hnotpresent : delta ∉ PresentColors G phi (S.vertex j) := by + simpa [MissingColors] using hdelta + exact hnotpresent hpresent + exact ⟨e, he, hecolor.resolve_right hnotDelta⟩ + have hflip := @helper_hflip_497 V E inferInstance G k e0 phi S i j gamma delta hproper hne p hp + hshape hlen hcolored hfirst + have hlastIndex : 2 * (m - 1) + 1 = p.length - 1 := by rw [hlen]; omega + have hmpar : (m - 1) % 2 = 1 := by + by_contra hnot + have heven : (m - 1) % 2 = 0 := by omega + obtain ⟨ed, hed, hedcolor⟩ := (hflip (m - 1) (by omega)).1 heven + obtain ⟨eg, heg, hegcolor⟩ := hlast + have heq : ed = eg := by + apply Sum.inr.inj + rw [← hed, hlastIndex, heg] + subst eg + exact hne (Option.some.inj (hegcolor.symm.trans hedcolor)) + have hmEven : m % 2 = 0 := by omega + have hdiv : 4 ∣ p.length := by + refine ⟨m / 2, ?_⟩ + omega + refine ⟨p, hp, hps, hdiv, ?_, ?_⟩ + · intro v hvp + apply hcomponent_vertex v + rw [← hps] + exact hvp + · exact @helper_branch_588 V E inferInstance inferInstance G k e0 phi S hS i j hij gamma delta + hgamma hdelta hproper hone hSelem hjS hne p + +theorem ScheideMaximalKempePath {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T S : TreeSequence G e0) + (htriple : KTriple G k e0 phi) + (hmax : FixedPairMaximalTashkinovTree G e0 phi T) + (hS : TashkinovTree G e0 phi S) + (i j : Fin (S.length + 1)) (hij : i.val < j.val) + (gamma delta : Fin k) + (hgamma : gamma ∈ MissingColors G phi (S.vertex i)) + (hdelta : delta ∈ MissingColors G phi (S.vertex j)) : + gamma ≠ delta ∧ + ∃ p : + (TwoColorIncidenceGraph G phi gamma delta).Walk (Sum.inl (S.vertex i)) + (Sum.inl (S.vertex j)), + p.IsPath ∧ + {z | z ∈ p.support} = TwoColorComponent G phi gamma delta (Sum.inl (S.vertex i)) ∧ + 4 ∣ p.length ∧ + (∀ v : V, Sum.inl v ∈ p.support → v ∈ TreeSequenceVertexSet T) ∧ + (TreeColorUnusedThrough phi S gamma j → + IsProperEdgeColoring G + (TwoColorComponentSwap G phi gamma delta (Sum.inl (S.vertex i))) ∧ + IsOneEdgeUncolored + (TwoColorComponentSwap G phi gamma delta (Sum.inl (S.vertex i))) + e0 ∧ + TashkinovTree G e0 + (TwoColorComponentSwap G phi gamma delta (Sum.inl (S.vertex i))) S) := by + classical + let X := TreeSequenceVertexSet T + let XS := TreeSequenceVertexSet S + let H := TwoColorIncidenceGraph G phi gamma delta + let C := TwoColorComponent G phi gamma delta (Sum.inl (S.vertex i)) + have hproper : IsProperEdgeColoring G phi := htriple.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := htriple.2.2.2.2 + have hSelem : ColoredVertexSetElementary G phi XS := + TashTree G k e0 phi S htriple hS + have hiS : S.vertex i ∈ XS := by + simp [XS, TreeSequenceVertexSet] + have hjS : S.vertex j ∈ XS := by + simp [XS, TreeSequenceVertexSet] + have hvne : S.vertex i ≠ S.vertex j := by + intro h + exact (Fin.ne_of_lt hij) (S.vertex_injective h) + have hne : gamma ≠ delta := by + intro h + subst delta + have hd := hSelem hiS hjS hvne + exact (Finset.disjoint_left.mp hd) hgamma hdelta + refine ⟨hne, ?_⟩ + have hsub : XS ⊆ X := by + exact ScheideMaximalContainsEveryTree G k e0 phi T S htriple hmax hS + have hXi : S.vertex i ∈ X := hsub hiS + have hXj : S.vertex j ∈ X := hsub hjS + have hXdata := ScheideMaximalElementaryClosed G k e0 phi T htriple hmax + have hXelem : ColoredVertexSetElementary G phi X := hXdata.1 + have hXclosed : ColoredVertexSetClosed G phi X := hXdata.2 + have edge_internal : ∀ (e : E), + (phi e = some gamma ∨ phi e = some delta) → + ∀ u, u ∈ X → Incident G u e → + ∀ v, Incident G v e → v ∈ X := by + intro e hecolor u hu hue v hve + by_contra hv + obtain ⟨w, hw⟩ := Sym2.mem_iff_exists.mp hve + have hevw : G.ends e = s(v, w) := hw + have hupair : u = v ∨ u = w := by + have : u ∈ s(v, w) := by rw [← hevw]; exact hue + simpa using this + have hwX : w ∈ X := by + rcases hupair with huv | huw + · exact False.elim (hv (huv ▸ hu)) + · exact huw ▸ hu + have heb : e ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwX, v, hv, hevw.trans Sym2.eq_swap⟩ + rcases hecolor with heg | hed + · exact (hXclosed heb hXi heg) hgamma + · exact (hXclosed heb hXj hed) hdelta + let Good : Sum V E → Prop := fun z => + match z with + | Sum.inl v => v ∈ X + | Sum.inr e => ∀ v, Incident G v e → v ∈ X + let HG := (⊤ : H.Subgraph).induce Good + have hGoodClosed : ∀ z ∈ HG.verts, ∀ w, H.Adj z w → HG.Adj z w := by + intro z hz w hzw + have hzGood : Good z := by + change Good z at hz + exact hz + have hwGood : Good w := by + cases z with + | inl u => + cases w with + | inl v => simp [H, TwoColorIncidenceGraph] at hzw + | inr e => + have hdata : Incident G u e ∧ + (phi e = some gamma ∨ phi e = some delta) := by + simpa [H, TwoColorIncidenceGraph] using hzw + exact edge_internal e hdata.2 u (by simpa [Good] using hzGood) + hdata.1 + | inr e => + cases w with + | inl v => + have hdata : Incident G v e ∧ + (phi e = some gamma ∨ phi e = some delta) := by + simpa [H, TwoColorIncidenceGraph] using hzw + exact hzGood v hdata.1 + | inr f => simp [H, TwoColorIncidenceGraph] at hzw + exact ⟨hzGood, hwGood, by simpa [HG] using hzw⟩ + have hcomponent_vertex : ∀ v : V, Sum.inl v ∈ C → v ∈ X := by + intro v hvC + have hreach : H.Reachable (Sum.inl (S.vertex i)) (Sum.inl v) := by + change H.connectedComponentMk (Sum.inl v) = + H.connectedComponentMk (Sum.inl (S.vertex i)) at hvC + exact SimpleGraph.ConnectedComponent.eq.mp hvC.symm + have hroot : Sum.inl (S.vertex i) ∈ HG.verts := by + change Good (Sum.inl (S.vertex i)) + simpa [Good] using hXi + have hvHG := hreach.mem_subgraphVerts hGoodClosed hroot + change Good (Sum.inl v) at hvHG + simpa [Good] using hvHG + have hiSub : Set.Subsingleton (H.neighborSet (Sum.inl (S.vertex i))) := by + let : Fintype (H.neighborSet (Sum.inl (S.vertex i))) := + Fintype.ofFinite _ + have hdeg := MissingColorIncidenceEndpoint G phi gamma delta hne hproper + (S.vertex i) hgamma + have hcard : (H.neighborFinset (Sum.inl (S.vertex i))).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + simpa [H] using hdeg + intro z hz w hw + exact (Finset.card_le_one.mp hcard) z + (by simpa [SimpleGraph.mem_neighborFinset] using hz) w + (by simpa [SimpleGraph.mem_neighborFinset] using hw) + obtain ⟨a, b, q, hq, hqs⟩ := + TwoColorComponentSpanningPath G phi gamma delta hproper + (Sum.inl (S.vertex i)) + have hiC : Sum.inl (S.vertex i) ∈ C := by + change Sum.inl (S.vertex i) ∈ + H.connectedComponentMk (Sum.inl (S.vertex i)) + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + have hiq : Sum.inl (S.vertex i) ∈ q.support := by + change Sum.inl (S.vertex i) ∈ {z | z ∈ q.support} + rw [hqs] + exact hiC + have hiEnd : (Sum.inl (S.vertex i) : Sum V E) = a ∨ + Sum.inl (S.vertex i) = b := by + by_contra hn + push Not at hn + exact (hq.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hiSub) hiq + obtain ⟨b, p, hp, hps⟩ : ∃ b, + ∃ p : H.Walk (Sum.inl (S.vertex i)) b, + p.IsPath ∧ {z | z ∈ p.support} = C := by + rcases hiEnd with hia | hib + · subst a + exact ⟨b, q, hq, hqs⟩ + · subst b + refine ⟨a, q.reverse, hq.reverse, ?_⟩ + ext z + rw [SimpleGraph.Walk.support_reverse] + simpa using Set.ext_iff.mp hqs z + have hdeltaPresentI : delta ∈ PresentColors G phi (S.vertex i) := by + have hnot : delta ∉ MissingColors G phi (S.vertex i) := by + intro hm + have hd := hXelem hXi hXj hvne + exact (Finset.disjoint_left.mp hd) hm hdelta + simpa [MissingColors] using hnot + obtain ⟨firstEdge, hfirstInc, hfirstColor⟩ := by + simpa [PresentColors] using hdeltaPresentI + have hfirstAdj : H.Adj (Sum.inl (S.vertex i)) (Sum.inr firstEdge) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G (S.vertex i) firstEdge ∧ + (phi firstEdge = some gamma ∨ phi firstEdge = some delta) from + ⟨hfirstInc, Or.inr hfirstColor⟩) + have hfirstC : Sum.inr firstEdge ∈ C := by + change H.connectedComponentMk (Sum.inr firstEdge) = + H.connectedComponentMk (Sum.inl (S.vertex i)) + exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hfirstAdj |>.symm + exact @helper_continuation_613 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) + (@T) (@S) (@hS) (@i) (@j) (@hij) (@gamma) (@delta) (@hgamma) (@hdelta) (@hproper) (@hone) + (@hSelem) (@hjS) (@hne) (@hXi) (@hXj) (@hXelem) (@hcomponent_vertex) (@b) (@p) (@hp) (@hps) + (@firstEdge) (@hfirstC) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideMaximalOddOrder.lean b/LeanPool/GoldbergSeymour/ScheideMaximalOddOrder.lean new file mode 100644 index 0000000000..6b34e72649 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideMaximalOddOrder.lean @@ -0,0 +1,208 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideMaximalElementaryClosed + +/-! +# Scheide Maximal Odd Order + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideMaximalOddOrder {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (htriple : KTriple G k e0 phi) + (hmax : FixedPairMaximalTashkinovTree G e0 phi T) : + Odd (TreeSequenceVertexSet T).card := by + classical + let X := TreeSequenceVertexSet T + have hdata := ScheideMaximalElementaryClosed G k e0 phi T htriple hmax + have hproper : IsProperEdgeColoring G phi := htriple.2.2.2.1 + have hbound : MaximumDegree G + 1 ≤ k := htriple.2.2.1 + have hdeg : ∀ v : V, Degree G v ≤ MaximumDegree G := by + intro v + unfold MaximumDegree + exact Finset.le_max' _ _ (Finset.mem_insert.mpr (Or.inr + (Finset.mem_image.mpr ⟨v, by simp⟩))) + have present_le_degree : ∀ v : V, (PresentColors G phi v).card ≤ Degree G v := by + intro v + have chooseData (c : {c : Fin k // c ∈ PresentColors G phi v}) : + ∃ e, Incident G v e ∧ phi e = some c.1 := by + simpa [PresentColors] using c.property + let choices : {c : Fin k // c ∈ PresentColors G phi v} → + {e : E // Incident G v e} := fun c => + ⟨Classical.choose (chooseData c), (Classical.choose_spec (chooseData c)).1⟩ + have choice_spec : ∀ c : {c : Fin k // c ∈ PresentColors G phi v}, + phi (choices c).1 = some c.1 := by + intro c + exact (Classical.choose_spec (chooseData c)).2 + have inj : Function.Injective choices := by + intro a b hab + have ha := choice_spec a + have hb := choice_spec b + apply Subtype.ext + apply Option.some.inj + calc + some (a : Fin k) = phi (choices a).1 := ha.symm + _ = phi (choices b).1 := by rw [hab] + _ = some (b : Fin k) := hb + let : Fintype {c : Fin k // c ∈ PresentColors G phi v} := Fintype.ofFinite _ + have hc := Fintype.card_le_of_injective choices inj + change (PresentColors G phi v).card ≤ + (Finset.univ.filter (fun e => Incident G v e)).card + simpa [Fintype.card_subtype] using hc + have missing_exists : ∀ v : V, (MissingColors G phi v).Nonempty := by + intro v + by_contra hn + have hempty : MissingColors G phi v = ∅ := Finset.not_nonempty_iff_eq_empty.mp hn + have hall : PresentColors G phi v = Finset.univ := by + apply Finset.eq_univ_of_forall + intro c + by_contra hc + have hm : c ∈ MissingColors G phi v := by simp [MissingColors, hc] + exact (by simp [hempty] at hm) + have hc : k ≤ Degree G v := by + have := present_le_degree v + simpa [hall] using this + have : MaximumDegree G + 1 ≤ MaximumDegree G := + le_trans hbound (le_trans hc (hdeg v)) + omega + have hx : X.Nonempty := by + refine ⟨T.vertex ⟨0, Nat.zero_lt_succ _⟩, ?_⟩ + simp [X, TreeSequenceVertexSet] + obtain ⟨x, hxX⟩ := hx + obtain ⟨eta, heta⟩ := missing_exists x + let Y := X.erase x + let edges := (Finset.univ : Finset E).filter (fun e => phi e = some eta) + have y_present : ∀ v, v ∈ Y → eta ∈ PresentColors G phi v := by + intro v hv + have hvX : v ∈ X := (Finset.mem_erase.mp hv).2 + have hvne : v ≠ x := (Finset.mem_erase.mp hv).1 + have hdis := hdata.1 hxX hvX hvne.symm + have : eta ∉ MissingColors G phi v := by + intro hm + exact (Finset.disjoint_left.mp hdis) heta hm + simpa [MissingColors] using this + have edge_inc : ∀ v, v ∈ Y → ∃! e, e ∈ edges ∧ Incident G v e := by + intro v hv + obtain ⟨e, he, hve⟩ := by simpa [PresentColors] using y_present v hv + refine ⟨e, ?_, ?_⟩ + · exact ⟨by simpa [edges] using hve, he⟩ + · intro f hf + by_contra hef + exact (hproper (fun h => hef h.symm) ⟨v, he, hf.2⟩ hve) + (Finset.mem_filter.mp hf.1).2 + have no_x : ∀ e, e ∈ edges → ¬ Incident G x e := by + intro e he hxe + have hp : eta ∈ PresentColors G phi x := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hxe, (Finset.mem_filter.mp he).2⟩ + exact (Finset.mem_sdiff.mp heta).2 hp + have internal_other : ∀ e, e ∈ edges → ∀ v, v ∈ X → Incident G v e → + ∀ z, Incident G z e → z ∈ X := by + intro e he v hvX hve z hze + by_contra hz + obtain ⟨w, hw⟩ := Sym2.mem_iff_exists.mp hze + have hzw : G.ends e = s(z, w) := hw + have hvpair : v = z ∨ v = w := by + have : v ∈ s(z, w) := by rw [← hzw]; exact hve + simpa using this + have hzwX : w ∈ X := by + rcases hvpair with hvz | hvw + · exact False.elim (hz (hvz ▸ hvX)) + · exact hvw ▸ hvX + have hb : e ∈ BoundaryEdges G X := by + refine Finset.mem_filter.mpr ⟨by simp, ?_⟩ + exact ⟨w, hzwX, z, hz, hzw.trans Sym2.eq_swap⟩ + have hc := hdata.2 hb hxX (Finset.mem_filter.mp he).2 + exact hc heta + let good := edges.filter (fun e => ∀ v, Incident G v e → v ∈ X) + have good_spec : ∀ e, e ∈ good ↔ e ∈ edges ∧ ∀ v, Incident G v e → v ∈ X := by + intro e + simp [good] + have endpoint_card : ∀ e : E, (G.ends e).toFinset.card = 2 := by + intro e + apply Sym2.card_toFinset_of_not_isDiag + intro hd + exact G.loopless e ((G.ends e).diagElem hd) (Sym2.diag_diagElem hd).symm + have good_disjoint : ∀ ⦃e⦄, e ∈ good → ∀ ⦃f⦄, f ∈ good → + e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + have hce := (good_spec e).mp he |>.1 + have hcf := (good_spec f).mp hf |>.1 + exact (hproper hef ⟨v, Sym2.mem_toFinset.mp hev, Sym2.mem_toFinset.mp hvf⟩ + (Finset.mem_filter.mp hce).2) (Finset.mem_filter.mp hcf).2 + have union_card : (good.biUnion fun e => (G.ends e).toFinset).card = 2 * good.card := by + have aux : ∀ s : Finset E, s ⊆ good → + (s.biUnion fun e => (G.ends e).toFinset).card = 2 * s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset + (s.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + have hh := good_disjoint (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf)) + exact (Finset.disjoint_left.mp hh) hev hvf + rw [Finset.card_union_of_disjoint hd, endpoint_card] + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem hes] + omega + exact aux good (by intro e he; exact he) + have union_eq : good.biUnion (fun e => (G.ends e).toFinset) = Y := by + ext v + constructor + · intro hv + obtain ⟨e, he, hev⟩ := Finset.mem_biUnion.mp hv + have hvX := (good_spec e |>.mp he).2 v (Sym2.mem_toFinset.mp hev) + have hvx : v ≠ x := by + intro hvx + exact no_x e (good_spec e |>.mp he).1 (hvx ▸ Sym2.mem_toFinset.mp hev) + exact Finset.mem_erase.mpr ⟨hvx, hvX⟩ + · intro hv + have hvY : v ∈ Y := hv + obtain ⟨e, he, hve⟩ := edge_inc v hvY + have hg : e ∈ good := good_spec e |>.mpr ⟨he.1, + internal_other e he.1 v (Finset.mem_erase.mp hvY).2 he.2⟩ + exact Finset.mem_biUnion.mpr ⟨e, hg, Sym2.mem_toFinset.mpr he.2⟩ + have heven : Even Y.card := by + refine ⟨good.card, ?_⟩ + rw [← union_eq, union_card] + omega + have hodd : Odd (X.card) := by + have hcard : X.card = Y.card + 1 := by + have hh := Finset.card_erase_of_mem hxX + simp [Y] at hh ⊢ + have hpos : 0 < X.card := Finset.card_pos.mpr ⟨x, hxX⟩ + omega + rw [hcard] + rcases heven with ⟨q, hq⟩ + exact ⟨q, by omega⟩ + exact hodd + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideMaximumExtensionNormalWitness.lean b/LeanPool/GoldbergSeymour/ScheideMaximumExtensionNormalWitness.lean new file mode 100644 index 0000000000..73f77cd0a7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideMaximumExtensionNormalWitness.lean @@ -0,0 +1,208 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ScheideMaximalExtendsEveryTree +public import LeanPool.GoldbergSeymour.ScheideReversedPathCertificate +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Maximum Extension Normal Witness + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideMaximumExtensionNormalWitness {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) + (hmax : FixedPairMaximalTashkinovTree G e0 phi T) + (alpha beta : Fin k) + (halpha : alpha ∈ MissingColors G phi + (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + (hbeta : beta ∈ MissingColors G phi + (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩)) + (p : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + (Sum.inl (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩))) + (hp : p.IsPath) + (C : ScheideReversedPathCertificate G k e0 phi T alpha beta p) : + ∃ (T' : TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T'), + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + N.alpha = alpha ∧ N.beta = beta ∧ N.height = p.length / 2 + 1 := by + classical + obtain ⟨T', hTashkinov, hvertexSet, hinitial⟩ := + ScheideMaximalExtendsEveryTree G k e0 phi T C.tree + hglobal.1 hmax C.tashkinov + obtain ⟨hlen, hvertex, hedge⟩ := hinitial + have hglobal' : GlobalMaximumTriple G k e0 phi T' := by + refine ⟨hglobal.1, hTashkinov, ?_⟩ + rw [hvertexSet] + exact hglobal.2.2 + have hheightUpper : C.tree.length + 1 ≤ T'.length + 1 := + Nat.succ_le_succ hlen + have hfirst : + T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩ = + T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ := by + calc + T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩ = + C.tree.vertex ⟨0, Nat.zero_lt_succ C.tree.length⟩ := by + simpa using hvertex ⟨0, Nat.zero_lt_succ C.tree.length⟩ + _ = T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ := C.first_vertex + have hsecond : + T'.vertex ⟨1, Nat.succ_lt_succ T'.positive⟩ = + T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩ := by + calc + T'.vertex ⟨1, Nat.succ_lt_succ T'.positive⟩ = + C.tree.vertex ⟨1, Nat.succ_lt_succ C.tree.positive⟩ := by + simpa using hvertex ⟨1, Nat.succ_lt_succ C.tree.positive⟩ + _ = T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩ := C.second_vertex + have hshape : ∀ n ≤ p.length, + (n % 2 = 0 → ∃ v, p.getVert n = Sum.inl v) ∧ + (n % 2 = 1 → ∃ f, p.getVert n = Sum.inr f) := by + intro n + induction n with + | zero => + intro hn + constructor + · intro _ + exact ⟨T.vertex ⟨0, Nat.zero_lt_succ T.length⟩, p.getVert_zero⟩ + · omega + | succ n ih => + intro hn + have hnlt : n < p.length := by omega + have hadj := p.adj_getVert_succ hnlt + have hold := ih (by omega) + constructor + · intro heven + obtain ⟨f, hf⟩ := hold.2 (by omega) + cases hnext : p.getVert (n + 1) with + | inl v => exact ⟨v, rfl⟩ + | inr g => + rw [hf, hnext] at hadj + simp [TwoColorIncidenceGraph] at hadj + · intro hodd + obtain ⟨v, hv⟩ := hold.1 (by omega) + cases hnext : p.getVert (n + 1) with + | inl w => + rw [hv, hnext] at hadj + simp [TwoColorIncidenceGraph] at hadj + | inr f => exact ⟨f, rfl⟩ + have hlengthEven : p.length % 2 = 0 := by + by_contra hnot + have hodd : p.length % 2 = 1 := by omega + obtain ⟨f, hf⟩ := (hshape p.length (by rfl)).2 hodd + rw [p.getVert_length] at hf + simp at hf + have hlength : p.length = 2 * (p.length / 2) := by omega + have hpathData : ∃ q : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl (T'.vertex ⟨1, Nat.succ_lt_succ T'.positive⟩)) + (Sum.inl (T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩)), + q.IsPath ∧ q.length = p.length ∧ q.support = p.support.reverse := by + rw [hsecond, hfirst] + exact ⟨p.reverse, hp.reverse, p.length_reverse, p.support_reverse⟩ + obtain ⟨q, hqPath, hqLength, hqSupport⟩ := hpathData + let lastIndex : Fin (T'.length + 1) := + Fin.castLE hheightUpper (Fin.last C.tree.length) + have hclosingEnds : G.ends C.closingEdge = + s(T'.vertex lastIndex, + T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩) := by + dsimp only [lastIndex] + rw [hvertex (Fin.last C.tree.length)] + have hzero := hvertex ⟨0, Nat.zero_lt_succ C.tree.length⟩ + simpa using C.closing_ends.trans (congrArg + (fun v => s(C.tree.vertex (Fin.last C.tree.length), v)) hzero.symm) + refine ⟨T', { + global := hglobal' + height := C.tree.length + 1 + height_lower := le_trans C.length_lower (Nat.le_succ _) + height_upper := hheightUpper + alpha := alpha + beta := beta + alpha_missing := by simpa only [hfirst] using halpha + beta_missing := by simpa only [hsecond] using hbeta + closingEdge := C.closingEdge + lastIndex := lastIndex + lastIndex_height := by simp [lastIndex] + closing_ends := hclosingEnds + closingPath := q + closingPath_isPath := hqPath + closingPath_length := by + rw [hqLength] + calc + p.length = 2 * (p.length / 2) := hlength + _ = 2 * ((C.tree.length + 1) - 1) := by rw [C.length_eq]; omega + closingPath_vertices := by + intro v + rw [hqSupport] + simp only [List.mem_reverse] + rw [C.path_vertices v] + constructor + · rintro ⟨i, hi⟩ + exact ⟨i, hi.trans (hvertex i).symm⟩ + · rintro ⟨i, hi⟩ + exact ⟨i, hi.trans (hvertex i)⟩ + closingPath_edges := by + intro f + rw [hqSupport] + simp only [List.mem_reverse] + rw [C.path_edges f] + constructor + · rintro (rfl | ⟨j, hjpos, rfl⟩) + · exact Or.inl rfl + · right + refine ⟨Fin.castLE hlen j, hjpos, ?_, ?_⟩ + · change j.val + 2 ≤ C.tree.length + 1 + omega + · exact (hedge j).symm + · rintro (rfl | ⟨j, hjpos, hjbound, rfl⟩) + · exact Or.inl rfl + · right + let j' : Fin C.tree.length := ⟨j.val, by omega⟩ + have hjcast : Fin.castLE hlen j' = j := Fin.ext rfl + refine ⟨j', hjpos, ?_⟩ + rw [← hedge j', hjcast] + trunk_edge_ends := by + intro j hjpos hjbound + let j' : Fin C.tree.length := ⟨j.val, by omega⟩ + let i' : Fin (C.tree.length + 1) := ⟨j.val, by omega⟩ + have hjcast : Fin.castLE hlen j' = j := Fin.ext rfl + have hicast : Fin.castLE hheightUpper i' = + (⟨j.val, Nat.lt_succ_of_lt j.isLt⟩ : Fin (T'.length + 1)) := + Fin.ext rfl + have hsucccast : Fin.castLE hheightUpper j'.succ = j.succ := + Fin.ext rfl + have hedgeEq : T'.edge j = C.tree.edge j' := by + rw [← hjcast] + exact hedge j' + have hvertexEq : + T'.vertex ⟨j.val, Nat.lt_succ_of_lt j.isLt⟩ = + C.tree.vertex i' := by + rw [← hicast] + exact hvertex i' + have hsuccEq : T'.vertex j.succ = C.tree.vertex j'.succ := by + rw [← hsucccast] + exact hvertex j'.succ + rw [hedgeEq, hvertexEq, hsuccEq] + exact C.trunk_edge_ends j' hjpos + }, hvertexSet, rfl, rfl, ?_⟩ + change C.tree.length + 1 = p.length / 2 + 1 + rw [C.length_eq] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideNormalisation.lean b/LeanPool/GoldbergSeymour/ScheideNormalisation.lean new file mode 100644 index 0000000000..1469db6c1a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideNormalisation.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.NormalTripleTrunk +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.ScheideMaximalExtendsEveryTree +public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath +public import LeanPool.GoldbergSeymour.ScheideMaximumExtensionNormalWitness +public import LeanPool.GoldbergSeymour.ScheideReversedKempePathTree +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Normalisation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideNormalisation {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hglobal : GlobalMaximumTriple G k e0 phi T) : + ∃ (alpha beta : Fin k) (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + (Sum.inl (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩))) + (T' : TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T'), + alpha ∈ MissingColors G phi (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩) ∧ + beta ∈ MissingColors G phi (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩) ∧ + p.IsPath ∧ + {x | x ∈ p.support} = + TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) ∧ + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + N.alpha = alpha ∧ N.beta = beta ∧ N.height = p.length / 2 + 1 := by + classical + let i0 : Fin (T.length + 1) := ⟨0, Nat.zero_lt_succ T.length⟩ + let i1 : Fin (T.length + 1) := ⟨1, Nat.succ_lt_succ T.positive⟩ + have hfirstEnds : G.ends e0 = s(T.vertex i1, T.vertex i0) := by + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + have hi0 : i = 0 := Fin.eq_zero i + subst i + rw [T.first_edge] at hi + have hsucc : (⟨0, T.positive⟩ : Fin T.length).succ = i1 := by + apply Fin.ext + rfl + have hcast : Fin.castLT (0 : Fin 1) + (Nat.lt_trans (0 : Fin 1).isLt + (Nat.succ_lt_succ (⟨0, T.positive⟩ : Fin T.length).isLt)) = i0 := by + apply Fin.ext + rfl + rw [hsucc, hcast] at hi + exact hi + have hinc0 : Incident G (T.vertex i0) e0 := by + unfold Incident + rw [hfirstEnds] + simp + have hinc1 : Incident G (T.vertex i1) e0 := by + unfold Incident + rw [hfirstEnds] + simp + have hi0mem : T.vertex i0 ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet] + have hi1mem : T.vertex i1 ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet] + have hcount0 := + (ScheideGlobalMaximumMissingCounts G k e0 phi T hglobal + (T.vertex i0) hi0mem).1 hinc0 + have hcount1 := + (ScheideGlobalMaximumMissingCounts G k e0 phi T hglobal + (T.vertex i1) hi1mem).1 hinc1 + obtain ⟨alpha, halpha⟩ := Finset.card_pos.mp (by omega : + 0 < (MissingColors G phi (T.vertex i0)).card) + obtain ⟨beta, hbeta⟩ := Finset.card_pos.mp (by omega : + 0 < (MissingColors G phi (T.vertex i1)).card) + have hmax : FixedPairMaximalTashkinovTree G e0 phi T := + ScheideGlobalMaximumFixedPairMaximal G k e0 phi T hglobal + obtain ⟨_, p, hp, hsupport, hdiv, _, _⟩ := + ScheideMaximalKempePath G k e0 phi T T hglobal.1 hmax hglobal.2.1 + i0 i1 (by simp [i0, i1]) alpha beta halpha hbeta + obtain ⟨C⟩ := ScheideReversedKempePathTree G k e0 phi T hglobal.1 + alpha beta halpha hbeta p hp hdiv + obtain ⟨T', N, hvertexSet, hNalpha, hNbeta, hheight⟩ := + ScheideMaximumExtensionNormalWitness G k e0 phi T hglobal hmax + alpha beta halpha hbeta p hp C + exact ⟨alpha, beta, p, T', N, halpha, hbeta, hp, hsupport, + hvertexSet, hNalpha, hNbeta, hheight⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineBlockCompletion.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineBlockCompletion.lean new file mode 100644 index 0000000000..2ddd86afa9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineBlockCompletion.lean @@ -0,0 +1,2969 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Tactic.FinCases +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.ScheideHeightFiveGammaEdges +public import LeanPool.GoldbergSeymour.ScheideHeightFiveOutsideLinks +public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationNormal +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# P2968_T2_Scheide Order Nine Block Completion + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private abbrev helperContinuation2335Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : + TreeSequence G eX) (Q : NormalGlobalMaximumTriple G k eX psi X) (hlenX : X.length = (8 : + ℕ)) (hheightX : Q.height = (5 : ℕ)) (d1 : Fin k) (m : Fin (5 : ℕ)), d1 ≠ Q.alpha → d1 ≠ + Q.beta → + ∀ (lastA lastB : E), psi lastA = some Q.alpha → psi lastB = some Q.beta → + let Y : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ X.vertex (⟨(↑i : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))); + let C : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ X.edge (⟨(6 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length); ( + ∃ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), G.ends (C j) = s(Y (⟨(↑q : ℕ), + by omega + ⟩ : Fin (9 : ℕ)), Y (⟨(7 : ℕ) + (↑j : ℕ), + by omega + ⟩ : Fin (9 : ℕ)))) → ( + ∀ {eZ : E} (rho : PartialEdgeColoring E k) (Z : TreeSequence G eZ) (RZ : + NormalGlobalMaximumTriple G k eZ rho Z), BalancedGlobalMaximumTriple RZ → + ∀ (hlenZ : Z.length = (8 : ℕ)), RZ.height = (5 : ℕ) → + ∀ d ∈ MissingColors G rho (Z.vertex (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ)))), d ≠ RZ.alpha → d ≠ RZ.beta → + ∀ (lastAZ lastBZ : E), G.ends lastAZ = s(Z.vertex (⟨(7 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(8 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → rho lastAZ = some RZ.alpha → G.ends lastBZ = s(Z.vertex (⟨(7 + : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(8 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → rho lastBZ = some RZ.beta → ( + ∀ (j : Fin (2 : ℕ)), rho (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin Z.length)) = some d) → ( + ∃ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ))))) → + ∀ (j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ))))) → + let jQ : Fin Q.height := (⟨(↑m : ℕ), @Eq.mpr (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat + (nat_lit 5) (instOfNatNat (nat_lit 5))) m) (@NormalGlobalMaximumTriple.height V E inst + inst_1 inst_2 G k eX psi X Q)) (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit + 5) (instOfNatNat (nat_lit 5))) m) (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit + 5)))) (@id (@Eq Prop (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit 5) + (instOfNatNat (nat_lit 5))) m) (@NormalGlobalMaximumTriple.height V E inst inst_1 inst_2 G + k eX psi X Q)) (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat + (nat_lit 5))) m) (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))))) (@congrArg + Nat Prop (@NormalGlobalMaximumTriple.height V E inst inst_1 inst_2 G k eX psi X Q) + (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))) (fun (_a : Nat) ↦ @LT.lt Nat + instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))) m) _a) + hheightX)) (@Fin.isLt (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))) m)⟩ : Fin + Q.height); + ∀ (rho : PartialEdgeColoring E k) (A B : Fin k), (A = if Odd (↑jQ : ℕ) then Q.beta else + Q.alpha) → (B = if Odd (↑jQ : ℕ) then Q.alpha else Q.beta) → + ∀ (Z : TreeSequence G (NormalCycleEdge Q jQ)) (hlengthZ : Z.length = X.length), ( + ∀ (r : Fin (Z.length + (1 : ℕ))), (↑r : ℕ) < Q.height → + ∃ (i : Fin Q.height), (↑i : ℕ) = ((↑jQ : ℕ) + (↑r : ℕ)) % Q.height ∧ Z.vertex r = X.vertex + (Fin.castLE Q.height_upper i)) → + ∀ (R : NormalGlobalMaximumTriple G k (NormalCycleEdge Q jQ) rho Z), R.alpha = A → R.beta = B → + ∀ (predR : Fin Q.height), BalancedGlobalMaximumTriple R → Z.length = (8 : ℕ) → R.height = (5 : + ℕ) → d1 ∈ MissingColors G rho (Z.vertex (⟨(0 : ℕ), Nat.zero_lt_succ Z.length⟩ : Fin + (Z.length + (1 : ℕ)))) → ( + ∀ (r : Fin (9 : ℕ)) (hr : (5 : ℕ) ≤ (↑r : ℕ)), Z.vertex (⟨(↑r : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ))) = X.vertex (⟨(↑r : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ)))) → ( + ∀ (r : Fin (2 : ℕ)), Z.edge (⟨(6 : ℕ) + (↑r : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin Z.length) = X.edge (⟨(6 : ℕ) + (↑r : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length)) → ( + ∀ (r : Fin (2 : ℕ)), rho (Z.edge (⟨(6 : ℕ) + (↑r : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin Z.length)) = some d1) → rho lastA = psi lastA → rho lastB = psi lastB → G.ends lastA = + s(Z.vertex (⟨(7 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(8 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → G.ends lastB = s(Z.vertex (⟨(7 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(8 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → ( + ∀ (q : Fin (5 : ℕ)), + ∃ (r : Fin (5 : ℕ)), Z.vertex (⟨(↑r : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + have := GoldbergSeymour.TreeSequence.positive Z + omega + ⟩ : Fin (Z.length + (1 : ℕ))) = X.vertex (⟨(↑q : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ)))) → + ∀ (j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (X.edge (⟨(6 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length)) = s(X.vertex (⟨(↑q : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))), X.vertex (⟨(7 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ)))) + +private abbrev helperBranch1342Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : TreeSequence + G eX) (Q : NormalGlobalMaximumTriple G k eX psi X) (_ : BalancedGlobalMaximumTriple Q) + (hlenX : X.length = (8 : ℕ)) (_ : Q.height = (5 : ℕ)) (d1 : Fin k) (m : Fin (5 : ℕ)) (_ : + d1 ∈ MissingColors G psi (X.vertex (⟨(↑m : ℕ), Decidable.byContradiction fun (a : ¬(↑m : + ℕ) < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))))) (_ : d1 ≠ Q.alpha) (_ : d1 ≠ Q.beta) (lastA lastB : E) (_ : + G.ends lastA = s(X.vertex (⟨(7 : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))), X.vertex (⟨(8 : ℕ), Decidable.byContradiction fun (a : ¬(8 : ℕ) + < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))))) (_ : psi lastA = some Q.alpha) (_ : G.ends lastB = s(X.vertex + (⟨(7 : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))), X.vertex (⟨(8 : ℕ), Decidable.byContradiction fun (a : ¬(8 : ℕ) + < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))))) (_ : psi lastB = some Q.beta) (_ : ( + ∀ (j : Fin (2 : ℕ)), psi (X.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 + : ℕ) + (↑j : ℕ) < X.length) ↦ + by omega + ⟩ : Fin X.length)) = some d1)), + let Y : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ X.vertex (⟨(↑i : ℕ), + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))); + let C : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ X.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < X.length) ↦ + by omega + ⟩ : Fin X.length); + ∀ (_ : ( + ∃ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), G.ends (C j) = s(Y (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < (9 : ℕ)) ↦ + by omega + ⟩ : Fin (9 : ℕ)), Y (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + (↑j : + ℕ) < (9 : ℕ)) ↦ + by omega + ⟩ : Fin (9 : ℕ))))) (_ : ( + ∀ {eZ : E} (rho : PartialEdgeColoring E k) (Z : TreeSequence G eZ) (RZ : + NormalGlobalMaximumTriple G k eZ rho Z) (_ : BalancedGlobalMaximumTriple RZ) (hlenZ : + Z.length = (8 : ℕ)) (_ : RZ.height = (5 : ℕ)), + ∀ d ∈ MissingColors G rho (Z.vertex (⟨(0 : ℕ), Decidable.byContradiction fun (a : ¬(0 : ℕ) < + Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))), d ≠ RZ.alpha → d ≠ RZ.beta → + ∀ (lastAZ lastBZ : E), G.ends lastAZ = s(Z.vertex (⟨(7 : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(8 : ℕ), Decidable.byContradiction fun (a : ¬(8 : ℕ) + < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → rho lastAZ = some RZ.alpha → G.ends lastBZ = s(Z.vertex (⟨(7 + : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(8 : ℕ), Decidable.byContradiction fun (a : ¬(8 : ℕ) + < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → rho lastBZ = some RZ.beta → ( + ∀ (j : Fin (2 : ℕ)), rho (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 + : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = some d) → ( + ∃ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) + (↑j : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))))) → + ∀ (j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : + ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) + (↑j : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))))) (_ : ¬(↑m : ℕ) = (0 : ℕ)) (j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (X.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : + ¬(6 : ℕ) + (↑j : ℕ) < X.length) ↦ + by omega + ⟩ : Fin X.length)) = s(X.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))), X.vertex (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) + (↑j : ℕ) < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ)))) + +private abbrev helperCycleContradiction192Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : TreeSequence + G eX) (Q : NormalGlobalMaximumTriple G k eX psi X) (_ : BalancedGlobalMaximumTriple Q) (_ + : ScheideGraphHeight G = (5 : ℕ)) (hlenX : X.length = (8 : ℕ)) (_ : Q.height = (5 : ℕ)) + (d0 d1 : Fin k) (_ : d0 ∈ MissingColors G psi (X.vertex (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))))) (_ : d0 ≠ Q.beta) (_ : d1 ≠ Q.alpha) (_ : d1 ≠ Q.beta) (_ : d1 + ≠ d0) (x1 x2 linkB last0 lastB : E) (z1 z2 : V) (_ : G.ends x1 = s(X.vertex (⟨(1 : ℕ), + Decidable.byContradiction fun (a : ¬(1 : ℕ) < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))), z1)) (_ : G.ends x2 = s(X.vertex (⟨(4 : ℕ), + Decidable.byContradiction fun (a : ¬(4 : ℕ) < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))), z2)) (_ : psi x1 = some d0) (_ : psi x2 = some d0) (_ : G.ends + linkB = s(z1, z2)) (_ : psi linkB = some Q.beta) (_ : psi last0 = some d0) (_ : psi lastB + = some Q.beta) (_ : X.edge (⟨(4 : ℕ), Decidable.byContradiction fun (a : ¬(4 : ℕ) < + X.length) ↦ + by omega + ⟩ : Fin X.length) = x1 ∧ X.vertex (⟨(5 : ℕ), Decidable.byContradiction fun (a : ¬(5 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))) = z1 ∧ X.edge (⟨(5 : ℕ), Decidable.byContradiction fun (a : ¬(5 + : ℕ) < X.length) ↦ + by omega + ⟩ : Fin X.length) = x2 ∧ X.vertex (⟨(6 : ℕ), Decidable.byContradiction fun (a : ¬(6 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))) = z2 ∨ X.edge (⟨(4 : ℕ), Decidable.byContradiction fun (a : ¬(4 + : ℕ) < X.length) ↦ + by omega + ⟩ : Fin X.length) = x2 ∧ X.vertex (⟨(5 : ℕ), Decidable.byContradiction fun (a : ¬(5 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))) = z2 ∧ X.edge (⟨(5 : ℕ), Decidable.byContradiction fun (a : ¬(5 + : ℕ) < X.length) ↦ + by omega + ⟩ : Fin X.length) = x1 ∧ X.vertex (⟨(6 : ℕ), Decidable.byContradiction fun (a : ¬(6 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))) = z1), + let Y : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ X.vertex (⟨(↑i : ℕ), + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))); + let C : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ X.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < X.length) ↦ + by omega + ⟩ : Fin X.length); + ∀ (_ : ( + ∀ {i j : Fin (9 : ℕ)} (_ : i ≠ j), Y i ≠ Y j)) (_ : G.ends last0 = s(Y (7 : Fin (9 : ℕ)), Y (8 + : Fin (9 : ℕ)))) (_ : G.ends lastB = s(Y (7 : Fin (9 : ℕ)), Y (8 : Fin (9 : ℕ)))) (_ : + IsProperEdgeColoring G psi) (_ : ( + ∀ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), G.ends (C j) ≠ s(Y (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < (9 : ℕ)) ↦ + by omega + ⟩ : Fin (9 : ℕ)), Y (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + (↑j : + ℕ) < (9 : ℕ)) ↦ + by omega + ⟩ : Fin (9 : ℕ))))) (_ : Fin ((↑(⟨(6 : ℕ), Decidable.byContradiction fun (a : ¬(6 : ℕ) < + X.length) ↦ + by omega + ⟩ : Fin X.length) : ℕ) + (1 : ℕ))) (_ : Fin ((↑(⟨(7 : ℕ), Decidable.byContradiction fun (a : + ¬(7 : ℕ) < X.length) ↦ + by omega + ⟩ : Fin X.length) : ℕ) + (1 : ℕ))) (a b : V) (r5 r6 : E) (_ : a = Y (7 : Fin (9 : ℕ)) ∧ b = Y + (8 : Fin (9 : ℕ)) ∨ a = Y (8 : Fin (9 : ℕ)) ∧ b = Y (7 : Fin (9 : ℕ))) (_ : G.ends r5 = + s(z1, a)) (_ : G.ends r6 = s(z2, b)) (_ : psi r5 = some d1) (_ : psi r6 = some d1) (_ : r5 + = C (0 : Fin (2 : ℕ)) ∨ r5 = C (1 : Fin (2 : ℕ))) (_ : r6 = C (0 : Fin (2 : ℕ)) ∨ r6 = C + (1 : Fin (2 : ℕ))) (_ : r5 ≠ r6), False + +private abbrev helperContinuation932Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : TreeSequence + G eX) (Q : NormalGlobalMaximumTriple G k eX psi X), BalancedGlobalMaximumTriple Q → + ScheideGraphHeight G = (5 : ℕ) → + ∀ (hlenX : X.length = (8 : ℕ)), Q.height = (5 : ℕ) → + ∀ (d0 d1 : Fin k), d0 ∈ MissingColors G psi (X.vertex (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ)))) → d0 ≠ Q.beta → d1 ≠ Q.alpha → d1 ≠ Q.beta → d1 ≠ d0 → + ∀ (x1 x2 linkB last0 lastB : E) (z1 z2 : V), G.ends x1 = s(X.vertex (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))), z1) → G.ends x2 = s(X.vertex (⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))), z2) → psi x1 = some d0 → psi x2 = some d0 → G.ends linkB = + s(z1, z2) → psi linkB = some Q.beta → psi last0 = some d0 → psi lastB = some Q.beta → + X.edge (⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length) = x1 ∧ X.vertex (⟨(5 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))) = z1 ∧ X.edge (⟨(5 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length) = x2 ∧ X.vertex (⟨(6 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))) = z2 ∨ X.edge (⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length) = x2 ∧ X.vertex (⟨(5 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))) = z2 ∧ X.edge (⟨(5 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length) = x1 ∧ X.vertex (⟨(6 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))) = z1 → + let this : DecidableEq V := Classical.decEq V; + let Y : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ X.vertex (⟨(↑i : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))); + let C : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ X.edge (⟨(6 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length); ( + ∀ {i j : Fin (9 : ℕ)}, i ≠ j → Y i ≠ Y j) → G.ends last0 = s(Y (7 : Fin (9 : ℕ)), Y (8 : Fin + (9 : ℕ))) → IsProperEdgeColoring G psi → + ∀ (a b : V) (r5 r6 : E), a = Y (7 : Fin (9 : ℕ)) ∧ b = Y (8 : Fin (9 : ℕ)) ∨ a = Y (8 : Fin (9 + : ℕ)) ∧ b = Y (7 : Fin (9 : ℕ)) → G.ends r5 = s(z1, a) → G.ends r6 = s(z2, b) → psi r5 = + some d1 → psi r6 = some d1 → r5 = C (0 : Fin (2 : ℕ)) ∨ r5 = C (1 : Fin (2 : ℕ)) → r6 = C + (0 : Fin (2 : ℕ)) ∨ r6 = C (1 : Fin (2 : ℕ)) → r5 ≠ r6 → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi d1 Q.beta; + let K : Set (V ⊕ E) := TwoColorComponent G psi d1 Q.beta (Sum.inl z1); + let R : Set (V ⊕ E) := {q : V ⊕ E | q = Sum.inl z1 ∨ q = Sum.inr linkB ∨ q = Sum.inl z2 ∨ q = + Sum.inr r6 ∨ q = Sum.inl b ∨ q = Sum.inr lastB ∨ q = Sum.inl a ∨ q = Sum.inr r5}; z1 ≠ z2 + → a ≠ b → G.ends lastB = s(a, b) → linkB ≠ r5 → linkB ≠ r6 → lastB ≠ r5 → lastB ≠ r6 → z1 + ≠ a → z2 ≠ b → H.Adj (Sum.inl z1) (Sum.inr linkB) → H.Adj (Sum.inl z2) (Sum.inr linkB) → + H.Adj (Sum.inl z1) (Sum.inr r5) → H.Adj (Sum.inl a) (Sum.inr r5) → H.Adj (Sum.inl z2) + (Sum.inr r6) → H.Adj (Sum.inl b) (Sum.inr r6) → H.Adj (Sum.inl a) (Sum.inr lastB) → H.Adj + (Sum.inl b) (Sum.inr lastB) → ( + ∀ {q r : V ⊕ E}, q ∈ R → H.Adj q r → r ∈ R) → K ⊆ R → R ⊆ K → K = R → z1 = Y (5 : Fin (9 : ℕ)) + ∨ z1 = Y (6 : Fin (9 : ℕ)) → z2 = Y (5 : Fin (9 : ℕ)) ∨ z2 = Y (6 : Fin (9 : ℕ)) → ( + ∀ (q : Fin (5 : ℕ)), Sum.inl (Y (⟨(↑q : ℕ), + by omega + ⟩ : Fin (9 : ℕ))) ∉ K) → False + +private abbrev helperContinuation1527Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : TreeSequence + G eX) (Q : NormalGlobalMaximumTriple G k eX psi X), ScheideGraphHeight G = (5 : ℕ) → + ∀ (hlenX : X.length = (8 : ℕ)) (d0 d1 : Fin k), d1 ≠ d0 → + ∀ (x1 x2 linkB last0 lastB : E) (z1 z2 : V), G.ends x1 = s(X.vertex (⟨(1 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))), z1) → G.ends x2 = s(X.vertex (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))), z2) → psi x1 = some d0 → psi x2 = some d0 → G.ends linkB = + s(z1, z2) → X.edge (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length) = x1 ∧ X.vertex (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))) = z1 ∧ X.edge (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length) = x2 ∧ X.vertex (⟨(6 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))) = z2 ∨ X.edge (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length) = x2 ∧ X.vertex (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))) = z2 ∧ X.edge (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length) = x1 ∧ X.vertex (⟨(6 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))) = z1 → + let this : DecidableEq V := Classical.decEq V; + let Y : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ X.vertex (⟨(↑i : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin (X.length + (1 : ℕ))); + let C : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ X.edge (⟨(6 : ℕ) + (↑j : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; + by + have := GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length); ( + ∀ {i j : Fin (9 : ℕ)}, i ≠ j → Y i ≠ Y j) → + ∀ (a b : V) (r5 r6 : E), a = Y (7 : Fin (9 : ℕ)) ∧ b = Y (8 : Fin (9 : ℕ)) ∨ a = Y (8 : Fin (9 + : ℕ)) ∧ b = Y (7 : Fin (9 : ℕ)) → G.ends r5 = s(z1, a) → G.ends r6 = s(z2, b) → psi r5 = + some d1 → psi r6 = some d1 → r5 = C (0 : Fin (2 : ℕ)) ∨ r5 = C (1 : Fin (2 : ℕ)) → r6 = C + (0 : Fin (2 : ℕ)) ∨ r6 = C (1 : Fin (2 : ℕ)) → r5 ≠ r6 → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi d1 Q.beta; + let K : Set (V ⊕ E) := TwoColorComponent G psi d1 Q.beta (Sum.inl z1); + let R : Set (V ⊕ E) := {q : V ⊕ E | q = Sum.inl z1 ∨ q = Sum.inr linkB ∨ q = Sum.inl z2 ∨ q = + Sum.inr r6 ∨ q = Sum.inl b ∨ q = Sum.inr lastB ∨ q = Sum.inl a ∨ q = Sum.inr r5}; z1 ≠ z2 + → a ≠ b → G.ends lastB = s(a, b) → linkB ≠ r5 → linkB ≠ r6 → lastB ≠ r5 → lastB ≠ r6 → z1 + ≠ a → z2 ≠ b → H.Adj (Sum.inl z1) (Sum.inr linkB) → H.Adj (Sum.inl z2) (Sum.inr linkB) → + H.Adj (Sum.inl z1) (Sum.inr r5) → H.Adj (Sum.inl a) (Sum.inr r5) → H.Adj (Sum.inl z2) + (Sum.inr r6) → H.Adj (Sum.inl b) (Sum.inr r6) → H.Adj (Sum.inl a) (Sum.inr lastB) → H.Adj + (Sum.inl b) (Sum.inr lastB) → ( + ∀ {q r : V ⊕ E}, q ∈ R → H.Adj q r → r ∈ R) → K ⊆ R → R ⊆ K → K = R → z1 = Y (5 : Fin (9 : ℕ)) + ∨ z1 = Y (6 : Fin (9 : ℕ)) → z2 = Y (5 : Fin (9 : ℕ)) ∨ z2 = Y (6 : Fin (9 : ℕ)) → ( + ∀ (q : Fin (5 : ℕ)), Sum.inl (Y (⟨(↑q : ℕ), + by omega + ⟩ : Fin (9 : ℕ))) ∉ K) → ( + ∀ {f : E} {q : Fin (5 : ℕ)}, Incident G (Y (⟨(↑q : ℕ), + by omega + ⟩ : Fin (9 : ℕ))) f → psi f = some Q.beta → Sum.inr f ∉ K) → Sum.inr (X.edge (⟨(2 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + X.length) ↦ + by omega + ⟩ : Fin X.length)) ∉ K → Sum.inr Q.closingEdge ∉ K → + let chi : PartialEdgeColoring E k := TwoColorComponentSwap G psi d1 Q.beta (Sum.inl z1); + IsProperEdgeColoring G chi → ( + ∀ {f : E} {c : Fin k}, psi f = some c → c ≠ d1 → c ≠ Q.beta → chi f = some c) → ( + ∀ {f : E}, Sum.inr f ∉ K → psi f = some Q.beta → chi f = some Q.beta) → Sum.inr r5 ∈ K → + Sum.inr r6 ∈ K → chi r5 = some Q.beta → chi r6 = some Q.beta → chi (C (0 : Fin (2 : ℕ))) = + some Q.beta → chi (C (1 : Fin (2 : ℕ))) = some Q.beta → chi (X.edge (⟨(1 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + X.length) ↦ + by + omega + ⟩ : Fin X.length)) = some Q.alpha → chi (X.edge (⟨(2 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + X.length) ↦ + by omega + ⟩ : Fin X.length)) = some Q.beta → chi (X.edge (⟨(3 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + X.length) ↦ + by omega + ⟩ : Fin X.length)) = some Q.alpha → chi x1 = some d0 → chi x2 = some d0 → chi last0 = some d0 + → chi Q.closingEdge = some Q.beta → ( + have C : Set (V ⊕ E) := TwoColorComponent G psi d1 Q.beta (Sum.inl z1); + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G psi d1 Q.beta (Sum.inl z1); ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G psi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → d1 ∈ MissingColors G psi v → Q.beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → Q.beta ∈ MissingColors G psi v → d1 ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ d1 → c ≠ Q.beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G + psi v)) → d0 ∈ MissingColors G chi (Y (0 : Fin (9 : ℕ))) → Q.alpha ∈ MissingColors G chi + (Y (0 : Fin (9 : ℕ))) → Q.beta ∈ MissingColors G chi (Y (1 : Fin (9 : ℕ))) → Sum.inr eX ∉ + K → IsOneEdgeUncolored chi eX → TashkinovTree G eX chi X → GlobalMaximumTriple G k eX chi + X → G.ends last0 = s(a, b) → + let H2 : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G chi d0 Q.beta; + let L : Set (V ⊕ E) := TwoColorComponent G chi d0 Q.beta (Sum.inl (Y (0 : Fin (9 : ℕ)))); ( + ∀ {u v : V} {f : E}, G.ends f = s(u, v) → chi f = some d0 → H2.Adj (Sum.inl u) (Sum.inr f)) → + ( + ∀ {u v : V} {f : E}, G.ends f = s(u, v) → chi f = some Q.beta → H2.Adj (Sum.inl u) (Sum.inr + f)) → H2.Adj (Sum.inl (Y (1 : Fin (9 : ℕ)))) (Sum.inr x1) → H2.Adj (Sum.inl z1) (Sum.inr + x1) → H2.Adj (Sum.inl z1) (Sum.inr r5) → H2.Adj (Sum.inl a) (Sum.inr r5) → H2.Adj (Sum.inl + a) (Sum.inr last0) → H2.Adj (Sum.inl b) (Sum.inr last0) → H2.Adj (Sum.inl b) (Sum.inr r6) + → H2.Adj (Sum.inl z2) (Sum.inr r6) → H2.Adj (Sum.inl z2) (Sum.inr x2) → H2.Adj (Sum.inl (Y + (4 : Fin (9 : ℕ)))) (Sum.inr x2) → H2.Adj (Sum.inl (Y (4 : Fin (9 : ℕ)))) (Sum.inr + Q.closingEdge) → H2.Adj (Sum.inl (Y (0 : Fin (9 : ℕ)))) (Sum.inr Q.closingEdge) → Sum.inl + (Y (0 : Fin (9 : ℕ))) ∈ L → Sum.inr Q.closingEdge ∈ L → Sum.inl (Y (4 : Fin (9 : ℕ))) ∈ L + → Sum.inr x2 ∈ L → Sum.inl z2 ∈ L → Sum.inr r6 ∈ L → Sum.inl b ∈ L → Sum.inr last0 ∈ L → + Sum.inl a ∈ L → False + +private abbrev helperContinuation1135Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : TreeSequence + G eX) (Q : NormalGlobalMaximumTriple G k eX psi X), ScheideGraphHeight G = (5 : ℕ) → + ∀ (hlenX : X.length = (8 : ℕ)) (d0 d1 : Fin k), d1 ≠ d0 → + ∀ (x1 x2 linkB last0 lastB : E) (z1 z2 : V), G.ends x1 = s(X.vertex (⟨(1 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))), z1) → G.ends x2 = s(X.vertex (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))), z2) → psi x1 = some d0 → psi x2 = some d0 → G.ends linkB = + s(z1, z2) → X.edge (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + X.length) ↦ + by omega + ⟩ : Fin X.length) = x1 ∧ X.vertex (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))) = z1 ∧ X.edge (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + X.length) ↦ + by omega + ⟩ : Fin X.length) = x2 ∧ X.vertex (⟨(6 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))) = z2 ∨ X.edge (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + X.length) ↦ + by omega + ⟩ : Fin X.length) = x2 ∧ X.vertex (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))) = z2 ∧ X.edge (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + X.length) ↦ + by omega + ⟩ : Fin X.length) = x1 ∧ X.vertex (⟨(6 : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))) = z1 → + let this : DecidableEq V := Classical.decEq V; + let Y : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ X.vertex (⟨(↑i : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(↑i : ℕ) < + X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))); + let C : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ X.edge (⟨(6 : ℕ) + (↑j : ℕ), + have this : (1 : ℕ) ≤ X.length := X.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) + + (↑j : ℕ) < X.length) ↦ + by omega + ⟩ : Fin X.length); ( + ∀ {i j : Fin (9 : ℕ)}, i ≠ j → Y i ≠ Y j) → G.ends last0 = s(Y (7 : Fin (9 : ℕ)), Y (8 : Fin + (9 : ℕ))) → + ∀ (a b : V) (r5 r6 : E), a = Y (7 : Fin (9 : ℕ)) ∧ b = Y (8 : Fin (9 : ℕ)) ∨ a = Y (8 : Fin (9 + : ℕ)) ∧ b = Y (7 : Fin (9 : ℕ)) → G.ends r5 = s(z1, a) → G.ends r6 = s(z2, b) → psi r5 = + some d1 → psi r6 = some d1 → r5 = C (0 : Fin (2 : ℕ)) ∨ r5 = C (1 : Fin (2 : ℕ)) → r6 = C + (0 : Fin (2 : ℕ)) ∨ r6 = C (1 : Fin (2 : ℕ)) → r5 ≠ r6 → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi d1 Q.beta; + let K : Set (V ⊕ E) := TwoColorComponent G psi d1 Q.beta (Sum.inl z1); + let R : Set (V ⊕ E) := {q : V ⊕ E | q = Sum.inl z1 ∨ q = Sum.inr linkB ∨ q = Sum.inl z2 ∨ q = + Sum.inr r6 ∨ q = Sum.inl b ∨ q = Sum.inr lastB ∨ q = Sum.inl a ∨ q = Sum.inr r5}; z1 ≠ z2 + → a ≠ b → G.ends lastB = s(a, b) → linkB ≠ r5 → linkB ≠ r6 → lastB ≠ r5 → lastB ≠ r6 → z1 + ≠ a → z2 ≠ b → H.Adj (Sum.inl z1) (Sum.inr linkB) → H.Adj (Sum.inl z2) (Sum.inr linkB) → + H.Adj (Sum.inl z1) (Sum.inr r5) → H.Adj (Sum.inl a) (Sum.inr r5) → H.Adj (Sum.inl z2) + (Sum.inr r6) → H.Adj (Sum.inl b) (Sum.inr r6) → H.Adj (Sum.inl a) (Sum.inr lastB) → H.Adj + (Sum.inl b) (Sum.inr lastB) → ( + ∀ {q r : V ⊕ E}, q ∈ R → H.Adj q r → r ∈ R) → K ⊆ R → R ⊆ K → K = R → z1 = Y (5 : Fin (9 : ℕ)) + ∨ z1 = Y (6 : Fin (9 : ℕ)) → z2 = Y (5 : Fin (9 : ℕ)) ∨ z2 = Y (6 : Fin (9 : ℕ)) → ( + ∀ (q : Fin (5 : ℕ)), Sum.inl (Y (⟨(↑q : ℕ), + by omega + ⟩ : Fin (9 : ℕ))) ∉ K) → ( + ∀ {f : E} {q : Fin (5 : ℕ)}, Incident G (Y (⟨(↑q : ℕ), + by omega + ⟩ : Fin (9 : ℕ))) f → psi f = some Q.beta → Sum.inr f ∉ K) → Sum.inr (X.edge (⟨(2 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive X + omega + ⟩ : Fin X.length)) ∉ K → G.ends Q.closingEdge = s(Y (4 : Fin (9 : ℕ)), Y (0 : Fin (9 : ℕ))) → + Sum.inr Q.closingEdge ∉ K → + let chi : PartialEdgeColoring E k := TwoColorComponentSwap G psi d1 Q.beta (Sum.inl z1); + IsProperEdgeColoring G chi → ( + ∀ {f : E} {c : Fin k}, psi f = some c → c ≠ d1 → c ≠ Q.beta → chi f = some c) → ( + ∀ {f : E}, Sum.inr f ∉ K → psi f = some Q.beta → chi f = some Q.beta) → Sum.inr r5 ∈ K → + Sum.inr r6 ∈ K → chi r5 = some Q.beta → chi r6 = some Q.beta → chi (C (0 : Fin (2 : ℕ))) = + some Q.beta → chi (C (1 : Fin (2 : ℕ))) = some Q.beta → chi (X.edge (⟨(1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + X + omega + ⟩ : Fin X.length)) = some Q.alpha → chi (X.edge (⟨(2 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + X + omega + ⟩ : Fin X.length)) = some Q.beta → chi (X.edge (⟨(3 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + X + omega + ⟩ : Fin X.length)) = some Q.alpha → chi x1 = some d0 → chi x2 = some d0 → chi last0 = some d0 + → chi Q.closingEdge = some Q.beta → ( + have C : Set (V ⊕ E) := TwoColorComponent G psi d1 Q.beta (Sum.inl z1); + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G psi d1 Q.beta (Sum.inl z1); ( + ∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G psi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → d1 ∈ MissingColors G psi v → Q.beta ∈ MissingColors G phi' v) ∧ ( + ∀ (v : V), Sum.inl v ∈ C → Q.beta ∈ MissingColors G psi v → d1 ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), c ≠ d1 → c ≠ Q.beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G + psi v)) → d0 ∈ MissingColors G chi (Y (0 : Fin (9 : ℕ))) → Q.alpha ∈ MissingColors G chi + (Y (0 : Fin (9 : ℕ))) → Q.beta ∈ MissingColors G chi (Y (1 : Fin (9 : ℕ))) → Sum.inr eX ∉ + K → False + +private theorem helper_R_closed_323.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : TreeSequence + G eX) (Q : NormalGlobalMaximumTriple G k eX psi X) (d1 : Fin k) (linkB lastB : E) (z1 z2 a + b : V) (r5 r6 : E), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi d1 Q.beta; + let R : Set (V ⊕ E) := {q : V ⊕ E | q = Sum.inl z1 ∨ q = Sum.inr linkB ∨ q = Sum.inl z2 ∨ q = + Sum.inr r6 ∨ q = Sum.inl b ∨ q = Sum.inr lastB ∨ q = Sum.inl a ∨ q = Sum.inr r5}; + ∀ (_ : z1 ≠ z2) (_ : a ≠ b) (_ : linkB ≠ r5) (_ : linkB ≠ r6) (_ : lastB ≠ r5) (_ : lastB ≠ + r6) (_ : z1 ≠ a) (_ : z2 ≠ b) (_ : H.Adj (Sum.inl z1) (Sum.inr linkB)) (_ : H.Adj (Sum.inl + z2) (Sum.inr linkB)) (_ : H.Adj (Sum.inl z1) (Sum.inr r5)) (_ : H.Adj (Sum.inl a) (Sum.inr + r5)) (_ : H.Adj (Sum.inl z2) (Sum.inr r6)) (_ : H.Adj (Sum.inl b) (Sum.inr r6)) (_ : H.Adj + (Sum.inl a) (Sum.inr lastB)) (_ : H.Adj (Sum.inl b) (Sum.inr lastB)) (_ : ( + ∀ {q r s t : V ⊕ E} (_ : H.Adj q r) (_ : H.Adj q s) (_ : r ≠ s) (_ : H.Adj q t), t = r ∨ t = + s)) {q r : V ⊕ E} (_ : q ∈ R) (_ : H.Adj q r), r ∈ R := by + classical + intro V E _ _ _ G k eX psi X Q d1 linkB lastB z1 z2 a b r5 r6 H R hz12 habv hlink_r5 hlink_r6 + hlast_r5 hlast_r6 hz1a hz2b hz1link hz2link hz1r5 har5 hz2r6 hbr6 halast hblast + neighbor_of_two q r hq hr + simp only [R] at hq ⊢ + rcases hq with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · rcases neighbor_of_two hz1link hz1r5 + (by simp [hlink_r5]) hr with h | h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr (Or.inr (Or.inr + (Or.inr (Or.inr (Or.inr h)))))) + · rcases neighbor_of_two hz1link.symm hz2link.symm + (by simp [hz12]) hr with h | h + · exact Or.inl h + · exact Or.inr (Or.inr (Or.inl h)) + · rcases neighbor_of_two hz2link hz2r6 + (by simp [hlink_r6]) hr with h | h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr (Or.inr (Or.inl h))) + · rcases neighbor_of_two hz2r6.symm hbr6.symm + (by simp [hz2b]) hr with h | h + · exact Or.inr (Or.inr (Or.inl h)) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl h)))) + · rcases neighbor_of_two hbr6 hblast + (by simp [hlast_r6, Ne.symm]) hr with h | h + · exact Or.inr (Or.inr (Or.inr (Or.inl h))) + · exact Or.inr (Or.inr (Or.inr (Or.inr + (Or.inr (Or.inl h))))) + · rcases neighbor_of_two hblast.symm halast.symm + (by simp [habv, Ne.symm]) hr with h | h + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl h)))) + · exact Or.inr (Or.inr (Or.inr (Or.inr + (Or.inr (Or.inr (Or.inl h)))))) + · rcases neighbor_of_two halast har5 + (by simp [hlast_r5]) hr with h | h + · exact Or.inr (Or.inr (Or.inr (Or.inr + (Or.inr (Or.inl h))))) + · exact Or.inr (Or.inr (Or.inr (Or.inr + (Or.inr (Or.inr (Or.inr h)))))) + · rcases neighbor_of_two hz1r5.symm har5.symm + (by simp [hz1a]) hr with h | h + · exact Or.inl h + · exact Or.inr (Or.inr (Or.inr (Or.inr + (Or.inr (Or.inr (Or.inl h)))))) + +private theorem helper_hRK_376.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : TreeSequence + G eX) (Q : NormalGlobalMaximumTriple G k eX psi X) (d1 : Fin k) (linkB lastB : E) (z1 z2 a + b : V) (r5 r6 : E), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi d1 Q.beta; + let K : Set (V ⊕ E) := TwoColorComponent G psi d1 Q.beta (Sum.inl z1); + let R : Set (V ⊕ E) := {q : V ⊕ E | q = Sum.inl z1 ∨ q = Sum.inr linkB ∨ q = Sum.inl z2 ∨ q = + Sum.inr r6 ∨ q = Sum.inl b ∨ q = Sum.inr lastB ∨ q = Sum.inl a ∨ q = Sum.inr r5}; + ∀ (_ : H.Adj (Sum.inl z1) (Sum.inr linkB)) (_ : H.Adj (Sum.inl z2) (Sum.inr linkB)) (_ : H.Adj + (Sum.inl a) (Sum.inr r5)) (_ : H.Adj (Sum.inl z2) (Sum.inr r6)) (_ : H.Adj (Sum.inl b) + (Sum.inr r6)) (_ : H.Adj (Sum.inl a) (Sum.inr lastB)) (_ : H.Adj (Sum.inl b) (Sum.inr + lastB)), R ⊆ K := by + classical + intro V E _ _ _ G k eX psi X Q d1 linkB lastB z1 z2 a b r5 r6 H K R hz1link hz2link har5 hz2r6 + hbr6 halast hblast + have mz1 : Sum.inl z1 ∈ K := rfl + have mlink : Sum.inr linkB ∈ K := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hz1link.symm).trans mz1 + have mz2 : Sum.inl z2 ∈ K := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hz2link).trans mlink + have mr6 : Sum.inr r6 ∈ K := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hz2r6.symm).trans mz2 + have mb : Sum.inl b ∈ K := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hbr6).trans mr6 + have mlast : Sum.inr lastB ∈ K := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hblast.symm).trans mb + have ma : Sum.inl a ∈ K := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + halast).trans mlast + have mr5 : Sum.inr r5 ∈ K := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + har5.symm).trans ma + intro q hq + simp only [R] at hq + rcases hq with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact mz1 + · exact mlink + · exact mz2 + · exact mr6 + · exact mb + · exact mlast + · exact ma + · exact mr5 + +private theorem helper_continuation_1527.{u_1, u_2} : + helperContinuation1527Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k eX psi X Q hgraphHeight hlenX d0 d1 hd10 x1 x2 linkB last0 lastB z1 z2 + hx1ends hx2ends hx1color hx2color hlinkBends hfirstOrient this Y C hYne a b r5 r6 ha7or8 + hr5ends hr6ends hr5color hr6color hr5which hr6which hr56 H K R hz12 habv hlastab hlink_r5 + hlink_r6 hlast_r5 hlast_r6 hz1a hz2b hz1link hz2link hz1r5 har5 hz2r6 hbr6 halast hblast + R_closed hKR hRK hKR_eq hz1pos hz2pos htrunkNotK beta_edge_not_K he2notK hcloseNotK chi + hchiProper unaffected beta_fixed hr5K hr6K hchir5 hchir6 hchiC0 hchiC1 hchie1 hchie2 hchie3 + hchix1 hchix2 hchilast0 hchiclose hbehavior hmissD0 hmissA hmissB he0notK honeChi htashChi + hglobalChi hlast0ab H2 L adj0 adj2B hY1x1 hz1x1 hz1r5' har5' halast0 hblast0 hbr6' hz2r6' + hz2x2 hY4x2 hY4close hY0close mY0 mclose mY4 mx2 mz2 mr6 mb mlast0 ma + have mr5 : Sum.inr r5 ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + har5'.symm).trans ma + have mz1 : Sum.inl z1 ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hz1r5').trans mr5 + have mx1 : Sum.inr x1 ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hz1x1.symm).trans mz1 + have mY1 : Sum.inl (Y 1) ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hY1x1).trans mx1 + obtain ⟨p, hp, hpsupport, hdiv, hvertices, hpbound⟩ := + ScheideKempePathHeightBound G k eX chi X hglobalChi d0 Q.beta + (by simpa [Y] using hmissD0) (by simpa [Y] using hmissB) + have in_support {u : Sum V E} (hu : u ∈ L) : u ∈ p.support := by + have hu' : u ∈ {x | x ∈ p.support} := by + rw [hpsupport] + exact hu + exact hu' + have sx1 := in_support mx1 + have sx2 := in_support mx2 + have sr5 := in_support mr5 + have sr6 := in_support mr6 + have sY0 := in_support mY0 + have sY1 := in_support mY1 + have sY4 := in_support mY4 + have sz1 := in_support mz1 + have sz2 := in_support mz2 + have sa := in_support ma + have sb := in_support mb + have hx12 : x1 ≠ x2 := by + intro h + rcases hfirstOrient with ho | ho + · have he : X.edge ⟨4, by omega⟩ = X.edge ⟨5, by omega⟩ := + ho.1.trans (h.trans ho.2.2.1.symm) + have hi := X.edge_injective he + norm_num at hi + · have he : X.edge ⟨5, by omega⟩ = X.edge ⟨4, by omega⟩ := + ho.2.2.1.trans (h.trans ho.1.symm) + have hi := X.edge_injective he + norm_num at hi + have x_d_ne {u v : E} (hu : psi u = some d0) + (hv : psi v = some d1) : u ≠ v := by + intro h + subst v + rw [hu] at hv + exact hd10 (Option.some.inj hv.symm) + have hx1r5 := x_d_ne hx1color hr5color + have hx1r6 := x_d_ne hx1color hr6color + have hx2r5 := x_d_ne hx2color hr5color + have hx2r6 := x_d_ne hx2color hr6color + let vs : List V := [Y 0, Y 1, Y 4, z1, z2, a, b] + have hvs : vs.Nodup := by + rcases hfirstOrient with ho | ho <;> + rcases ha7or8 with ha | ha + · have hz1 : z1 = Y 5 := by simpa [Y] using ho.2.1.symm + have hz2 : z2 = Y 6 := by simpa [Y] using ho.2.2.2.symm + simp [vs, hz1, hz2, ha.1, ha.2, hYne] + · have hz1 : z1 = Y 5 := by simpa [Y] using ho.2.1.symm + have hz2 : z2 = Y 6 := by simpa [Y] using ho.2.2.2.symm + simp [vs, hz1, hz2, ha.1, ha.2, hYne] + · have hz2 : z2 = Y 5 := by simpa [Y] using ho.2.1.symm + have hz1 : z1 = Y 6 := by simpa [Y] using ho.2.2.2.symm + simp [vs, hz1, hz2, ha.1, ha.2, hYne] + · have hz2 : z2 = Y 5 := by simpa [Y] using ho.2.1.symm + have hz1 : z1 = Y 6 := by simpa [Y] using ho.2.2.2.symm + simp [vs, hz1, hz2, ha.1, ha.2, hYne] + let es : List E := [x1, x2, r5, r6] + have hes : es.Nodup := by + simp [es, hx12, hx1r5, hx1r6, hx2r5, hx2r6, hr56] + let nodes : List (Sum V E) := + vs.map Sum.inl ++ es.map Sum.inr + have hnodes : nodes.Nodup := by + simp only [nodes, List.nodup_append] + refine ⟨hvs.map Sum.inl_injective, hes.map Sum.inr_injective, ?_⟩ + intro u hu v hv huv + obtain ⟨u, _, rfl⟩ := List.mem_map.mp hu + obtain ⟨v, _, rfl⟩ := List.mem_map.mp hv + exact Sum.inl_ne_inr huv + have hnodesMem : ∀ u ∈ nodes, u ∈ p.support := by + intro u hu + simp only [nodes, vs, es, List.mem_append, List.mem_map, + List.mem_cons] at hu + rcases hu with (⟨_, h, rfl⟩ | ⟨_, h, rfl⟩) + all_goals simp only [List.not_mem_nil, or_false] at h + · rcases h with rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact sY0 + · exact sY1 + · exact sY4 + · exact sz1 + · exact sz2 + · exact sa + · exact sb + · rcases h with rfl | rfl | rfl | rfl + · exact sx1 + · exact sx2 + · exact sr5 + · exact sr6 + have hsub : nodes.toFinset ⊆ p.support.toFinset := by + intro u hu + simp only [List.mem_toFinset] at hu ⊢ + exact hnodesMem u hu + have hcard := Finset.card_le_card hsub + have hpNodup : p.support.Nodup := by + rwa [SimpleGraph.Walk.isPath_def] at hp + rw [List.toFinset_card_of_nodup hnodes, + List.toFinset_card_of_nodup hpNodup] at hcard + have hnodesLength : nodes.length = 11 := by simp [nodes, vs, es] + have hpSupportLength : p.support.length = p.length + 1 := by + exact p.length_support + rw [hnodesLength, hpSupportLength] at hcard + rw [hgraphHeight] at hpbound + omega + +private theorem helper_continuation_1135.{u_1, u_2} : + helperContinuation1135Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k eX psi X Q hgraphHeight hlenX d0 d1 hd10 x1 x2 linkB last0 lastB z1 z2 + hx1ends hx2ends hx1color hx2color hlinkBends hfirstOrient this Y C hYne hlast0 a b r5 r6 + ha7or8 hr5ends hr6ends hr5color hr6color hr5which hr6which hr56 H K R hz12 habv hlastab + hlink_r5 hlink_r6 hlast_r5 hlast_r6 hz1a hz2b hz1link hz2link hz1r5 har5 hz2r6 hbr6 halast + hblast R_closed hKR hRK hKR_eq hz1pos hz2pos htrunkNotK beta_edge_not_K he2notK hcloseEnds + hcloseNotK chi hchiProper unaffected beta_fixed hr5K hr6K hchir5 hchir6 hchiC0 hchiC1 + hchie1 hchie2 hchie3 hchix1 hchix2 hchilast0 hchiclose hbehavior hmissD0 hmissA hmissB he0notK + have honeChi : IsOneEdgeUncolored chi eX := by + constructor + · simpa [chi, TwoColorComponentSwap, K, he0notK] using + Q.global.1.2.2.2.2.1 + · intro f hf + obtain ⟨c, hc⟩ := Q.global.1.2.2.2.2.2 f hf + by_cases hfk : Sum.inr f ∈ K + · by_cases hcd : c = d1 + · refine ⟨Q.beta, ?_⟩ + simp [chi, TwoColorComponentSwap, K, hfk, hc, hcd] + · by_cases hcb : c = Q.beta + · refine ⟨d1, ?_⟩ + simp [chi, TwoColorComponentSwap, K, hfk, hc, hcb] + · exact ⟨c, by + simp [chi, TwoColorComponentSwap, K, hfk, hc, hcd, hcb]⟩ + · exact ⟨c, by + simp [chi, TwoColorComponentSwap, K, hfk, hc]⟩ + have htashChi : TashkinovTree G eX chi X := by + intro j hj + have hjlt : j.val < 8 := by simpa [hlenX] using j.isLt + have hjcases : j.val = 1 ∨ j.val = 2 ∨ j.val = 3 ∨ + j.val = 4 ∨ j.val = 5 ∨ j.val = 6 ∨ j.val = 7 := by + omega + rcases hjcases with hjv | hjv | hjv | hjv | hjv | hjv | hjv + · have hje : j = ⟨1, by omega⟩ := Fin.ext hjv + rw [hje] + refine ⟨0, Q.alpha, ?_, ?_⟩ + · exact hchie1 + · convert hmissA using 1 + congr 1 + · have hje : j = ⟨2, by omega⟩ := Fin.ext hjv + rw [hje] + refine ⟨1, Q.beta, ?_, ?_⟩ + · exact hchie2 + · convert hmissB using 1 + congr 1 + · have hje : j = ⟨3, by omega⟩ := Fin.ext hjv + rw [hje] + refine ⟨0, Q.alpha, ?_, ?_⟩ + · exact hchie3 + · convert hmissA using 1 + congr 1 + · have hje : j = ⟨4, by omega⟩ := Fin.ext hjv + rw [hje] + rcases hfirstOrient with ho | ho + · refine ⟨0, d0, ?_, ?_⟩ + · simpa [ho.1] using hchix1 + · convert hmissD0 using 1 + congr 1 + · refine ⟨0, d0, ?_, ?_⟩ + · simpa [ho.1] using hchix2 + · convert hmissD0 using 1 + congr 1 + · have hje : j = ⟨5, by omega⟩ := Fin.ext hjv + rw [hje] + rcases hfirstOrient with ho | ho + · refine ⟨0, d0, ?_, ?_⟩ + · simpa [ho.2.2.1] using hchix2 + · convert hmissD0 using 1 + congr 1 + · refine ⟨0, d0, ?_, ?_⟩ + · simpa [ho.2.2.1] using hchix1 + · convert hmissD0 using 1 + congr 1 + · have hje : j = ⟨6, by omega⟩ := Fin.ext hjv + rw [hje] + refine ⟨1, Q.beta, ?_, ?_⟩ + · simpa [C] using hchiC0 + · convert hmissB using 1 + congr 1 + · have hje : j = ⟨7, by omega⟩ := Fin.ext hjv + rw [hje] + refine ⟨1, Q.beta, ?_, ?_⟩ + · simpa [C] using hchiC1 + · convert hmissB using 1 + congr 1 + have hglobalChi : GlobalMaximumTriple G k eX chi X := by + refine ⟨⟨Q.global.1.1, Q.global.1.2.1, Q.global.1.2.2.1, + hchiProper, honeChi⟩, htashChi, Q.global.2.2⟩ + have hlast0ab : G.ends last0 = s(a, b) := by + rcases ha7or8 with h | h + · simpa [h.1, h.2] using hlast0 + · simpa [h.1, h.2] using hlast0.trans Sym2.eq_swap + let H2 := TwoColorIncidenceGraph G chi d0 Q.beta + let L := TwoColorComponent G chi d0 Q.beta (Sum.inl (Y 0)) + have adj0 {u v : V} {f : E} (hf : G.ends f = s(u, v)) + (hc : chi f = some d0) : H2.Adj (Sum.inl u) (Sum.inr f) := by + simp only [H2, TwoColorIncidenceGraph] + refine ⟨?_, Or.inl hc⟩ + rw [Incident, hf] + simp + have adj2B {u v : V} {f : E} (hf : G.ends f = s(u, v)) + (hc : chi f = some Q.beta) : + H2.Adj (Sum.inl u) (Sum.inr f) := by + simp only [H2, TwoColorIncidenceGraph] + refine ⟨?_, Or.inr hc⟩ + rw [Incident, hf] + simp + have hY1x1 : H2.Adj (Sum.inl (Y 1)) (Sum.inr x1) := + adj0 (by simpa [Y] using hx1ends) hchix1 + have hz1x1 : H2.Adj (Sum.inl z1) (Sum.inr x1) := + adj0 (hx1ends.trans Sym2.eq_swap) hchix1 + have hz1r5' : H2.Adj (Sum.inl z1) (Sum.inr r5) := + adj2B hr5ends hchir5 + have har5' : H2.Adj (Sum.inl a) (Sum.inr r5) := + adj2B (hr5ends.trans Sym2.eq_swap) hchir5 + have halast0 : H2.Adj (Sum.inl a) (Sum.inr last0) := + adj0 hlast0ab hchilast0 + have hblast0 : H2.Adj (Sum.inl b) (Sum.inr last0) := + adj0 (hlast0ab.trans Sym2.eq_swap) hchilast0 + have hbr6' : H2.Adj (Sum.inl b) (Sum.inr r6) := + adj2B (hr6ends.trans Sym2.eq_swap) hchir6 + have hz2r6' : H2.Adj (Sum.inl z2) (Sum.inr r6) := + adj2B hr6ends hchir6 + have hz2x2 : H2.Adj (Sum.inl z2) (Sum.inr x2) := + adj0 (hx2ends.trans Sym2.eq_swap) hchix2 + have hY4x2 : H2.Adj (Sum.inl (Y 4)) (Sum.inr x2) := + adj0 (by simpa [Y] using hx2ends) hchix2 + have hY4close : H2.Adj (Sum.inl (Y 4)) + (Sum.inr Q.closingEdge) := adj2B hcloseEnds hchiclose + have hY0close : H2.Adj (Sum.inl (Y 0)) + (Sum.inr Q.closingEdge) := + adj2B (hcloseEnds.trans Sym2.eq_swap) hchiclose + have mY0 : Sum.inl (Y 0) ∈ L := rfl + have mclose : Sum.inr Q.closingEdge ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hY0close.symm).trans mY0 + have mY4 : Sum.inl (Y 4) ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hY4close).trans mclose + have mx2 : Sum.inr x2 ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hY4x2.symm).trans mY4 + have mz2 : Sum.inl z2 ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hz2x2).trans mx2 + have mr6 : Sum.inr r6 ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hz2r6'.symm).trans mz2 + have mb : Sum.inl b ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hbr6').trans mr6 + have mlast0 : Sum.inr last0 ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hblast0.symm).trans mb + have ma : Sum.inl a ∈ L := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + halast0).trans mlast0 + exact @helper_continuation_1527 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@eX) (@psi) (@X) (@Q) (@hgraphHeight) (@hlenX) (@d0) (@d1) (@hd10) (@x1) (@x2) (@linkB) + (@last0) (@lastB) (@z1) (@z2) (@hx1ends) (@hx2ends) (@hx1color) (@hx2color) (@hlinkBends) + (@hfirstOrient) (@hYne) (@a) (@b) (@r5) (@r6) (@ha7or8) (@hr5ends) (@hr6ends) (@hr5color) + (@hr6color) (@hr5which) (@hr6which) (@hr56) (@hz12) (@habv) (@hlastab) (@hlink_r5) + (@hlink_r6) (@hlast_r5) (@hlast_r6) (@hz1a) (@hz2b) (@hz1link) (@hz2link) (@hz1r5) (@har5) + (@hz2r6) (@hbr6) (@halast) (@hblast) (@R_closed) (@hKR) (@hRK) (@hKR_eq) (@hz1pos) + (@hz2pos) (@htrunkNotK) (@beta_edge_not_K) (@he2notK) (@hcloseNotK) (@hchiProper) + (@unaffected) (@beta_fixed) (@hr5K) (@hr6K) (@hchir5) (@hchir6) (@hchiC0) (@hchiC1) + (@hchie1) (@hchie2) (@hchie3) (@hchix1) (@hchix2) (@hchilast0) (@hchiclose) (@hbehavior) + (@hmissD0) (@hmissA) (@hmissB) (@he0notK) (@honeChi) (@htashChi) (@hglobalChi) (@hlast0ab) + (@adj0) (@adj2B) (@hY1x1) (@hz1x1) (@hz1r5') (@har5') (@halast0) (@hblast0) (@hbr6') + (@hz2r6') (@hz2x2) (@hY4x2) (@hY4close) (@hY0close) (@mY0) (@mclose) (@mY4) (@mx2) (@mz2) + (@mr6) (@mb) (@mlast0) (@ma) +private theorem helper_continuation_932.{u_1, u_2} : + helperContinuation932Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k eX psi X Q hbalX hgraphHeight hlenX hheightX d0 d1 hd0missing hd0beta + hd1alpha hd1beta hd10 x1 x2 linkB last0 lastB z1 z2 hx1ends hx2ends hx1color hx2color + hlinkBends hlinkBcolor hlast0color hlastBcolor hfirstOrient this Y C hYne hlast0 hproperX a + b r5 r6 ha7or8 hr5ends hr6ends hr5color hr6color hr5which hr6which hr56 H K R hz12 habv + hlastab hlink_r5 hlink_r6 hlast_r5 hlast_r6 hz1a hz2b hz1link hz2link hz1r5 har5 hz2r6 hbr6 + halast hblast R_closed hKR hRK hKR_eq hz1pos hz2pos htrunkNotK + have beta_edge_not_K {f : E} {q : Fin 5} + (hinc : Incident G (Y ⟨q.val, by omega⟩) f) + (hfc : psi f = some Q.beta) : Sum.inr f ∉ K := by + intro hfK + have hadj : H.Adj (Sum.inl (Y ⟨q.val, by omega⟩)) + (Sum.inr f) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G (Y ⟨q.val, by omega⟩) f ∧ + (psi f = some d1 ∨ psi f = some Q.beta) from + ⟨hinc, Or.inr hfc⟩) + apply htrunkNotK q + change H.connectedComponentMk (Sum.inl (Y ⟨q.val, by omega⟩)) = + H.connectedComponentMk (Sum.inl z1) + change H.connectedComponentMk (Sum.inr f) = + H.connectedComponentMk (Sum.inl z1) at hfK + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans hfK + have hcycleX := ScheideTrunkRotationCycle G k eX psi X Q hbalX + have he1cycle : NormalCycleEdge Q (⟨1, by omega⟩ : Fin Q.height) = + X.edge ⟨1, by omega⟩ := by + simp [NormalCycleEdge, hheightX] + have he2cycle : NormalCycleEdge Q (⟨2, by omega⟩ : Fin Q.height) = + X.edge ⟨2, by omega⟩ := by + simp [NormalCycleEdge, hheightX] + have he3cycle : NormalCycleEdge Q (⟨3, by omega⟩ : Fin Q.height) = + X.edge ⟨3, by omega⟩ := by + simp [NormalCycleEdge, hheightX] + have hcloseCycleX : NormalCycleEdge Q + (⟨4, by omega⟩ : Fin Q.height) = Q.closingEdge := by + simp [NormalCycleEdge, hheightX] + have he1color : psi (X.edge ⟨1, by omega⟩) = some Q.alpha := by + have hc := hcycleX.2.2.2.2 (⟨1, by omega⟩ : Fin Q.height) + (by norm_num) + simpa [he1cycle] using hc + have he2color : psi (X.edge ⟨2, by omega⟩) = some Q.beta := by + have hc := hcycleX.2.2.2.2 (⟨2, by omega⟩ : Fin Q.height) + (by norm_num) + have heven : ¬ Odd (2 : ℕ) := by decide + simpa [he2cycle, heven] using hc + have he3color : psi (X.edge ⟨3, by omega⟩) = some Q.alpha := by + have hc := hcycleX.2.2.2.2 (⟨3, by omega⟩ : Fin Q.height) + (by norm_num) + have hodd : Odd (3 : ℕ) := by decide + simpa [he3cycle, hodd] using hc + have hcloseColor : psi Q.closingEdge = some Q.beta := by + have hc := hcycleX.2.2.2.2 (⟨4, by omega⟩ : Fin Q.height) + (by norm_num) + have heven : ¬ Odd (4 : ℕ) := by decide + simpa [hcloseCycleX, heven] using hc + have hAB : Q.alpha ≠ Q.beta := by + intro h + have hinc : Incident G (Y 1) (X.edge ⟨1, by omega⟩) := by + have he := Q.trunk_edge_ends (⟨1, by omega⟩ : Fin X.length) + (by norm_num) (by rw [hheightX]; norm_num) + rw [Incident, he] + simp [Y] + have hnot : Q.beta ∉ PresentColors G psi (Y 1) := by + simpa [MissingColors, Y] using Q.beta_missing + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨X.edge ⟨1, by omega⟩, hinc, by simpa [h] using he1color⟩ + have he2inc : Incident G (Y 2) (X.edge ⟨2, by omega⟩) := by + have he := Q.trunk_edge_ends (⟨2, by omega⟩ : Fin X.length) + (by norm_num) (by rw [hheightX]; norm_num) + rw [Incident, he] + simp [Y] + have he2notK : Sum.inr (X.edge ⟨2, by omega⟩) ∉ K := + beta_edge_not_K (q := (2 : Fin 5)) he2inc he2color + have hlastIndexX : Q.lastIndex = + (⟨4, by omega⟩ : Fin (X.length + 1)) := by + apply Fin.ext + have h := Q.lastIndex_height + rw [hheightX] at h + simpa using h + have hcloseEnds : G.ends Q.closingEdge = s(Y 4, Y 0) := by + simpa [Y, hlastIndexX] using Q.closing_ends + have hcloseInc : Incident G (Y 4) Q.closingEdge := by + rw [Incident, hcloseEnds] + simp + have hcloseNotK : Sum.inr Q.closingEdge ∉ K := + beta_edge_not_K (q := (4 : Fin 5)) hcloseInc hcloseColor + let chi := TwoColorComponentSwap G psi d1 Q.beta (Sum.inl z1) + have hchiProper : IsProperEdgeColoring G chi := by + simpa [chi] using TwoColorComponentSwapProper G psi d1 Q.beta + hd1beta hproperX (Sum.inl z1) + have unaffected {f : E} {c : Fin k} (hc : psi f = some c) + (hcd : c ≠ d1) (hcb : c ≠ Q.beta) : chi f = some c := by + by_cases hf : Sum.inr f ∈ K + · simp [chi, TwoColorComponentSwap, K, hf, hc, hcd, hcb] + · simp [chi, TwoColorComponentSwap, K, hf, hc] + have beta_fixed {f : E} (hf : Sum.inr f ∉ K) + (hc : psi f = some Q.beta) : chi f = some Q.beta := by + simp [chi, TwoColorComponentSwap, K, hf, hc] + have hr5K : Sum.inr r5 ∈ K := by + rw [hKR_eq] + simp [R] + have hr6K : Sum.inr r6 ∈ K := by + rw [hKR_eq] + simp [R] + have hchir5 : chi r5 = some Q.beta := by + simp [chi, TwoColorComponentSwap, K, hr5K, hr5color] + have hchir6 : chi r6 = some Q.beta := by + simp [chi, TwoColorComponentSwap, K, hr6K, hr6color] + have hchiC0 : chi (C 0) = some Q.beta := by + rcases hr5which with h | h + · simpa [h] using hchir5 + · rcases hr6which with h' | h' + · simpa [h'] using hchir6 + · exact False.elim (hr56 (h.trans h'.symm)) + have hchiC1 : chi (C 1) = some Q.beta := by + rcases hr5which with h | h + · rcases hr6which with h' | h' + · exact False.elim (hr56 (h.trans h'.symm)) + · simpa [h'] using hchir6 + · simpa [h] using hchir5 + have hchie1 : chi (X.edge ⟨1, by omega⟩) = some Q.alpha := + unaffected he1color hd1alpha.symm hAB + have hchie2 : chi (X.edge ⟨2, by omega⟩) = some Q.beta := + beta_fixed he2notK he2color + have hchie3 : chi (X.edge ⟨3, by omega⟩) = some Q.alpha := + unaffected he3color hd1alpha.symm hAB + have hchix1 : chi x1 = some d0 := + unaffected hx1color hd10.symm hd0beta + have hchix2 : chi x2 = some d0 := + unaffected hx2color hd10.symm hd0beta + have hchilast0 : chi last0 = some d0 := + unaffected hlast0color hd10.symm hd0beta + have hchiclose : chi Q.closingEdge = some Q.beta := + beta_fixed hcloseNotK hcloseColor + have hbehavior := TwoColorComponentSwapMissingBehavior G psi d1 + Q.beta hd1beta hproperX (Sum.inl z1) + have hmissD0 : d0 ∈ MissingColors G chi (Y 0) := by + exact (hbehavior.2.2.2 (Y 0) d0 hd10.symm hd0beta).2 + (by simpa [Y] using hd0missing) + have hmissA : Q.alpha ∈ MissingColors G chi (Y 0) := by + exact (hbehavior.2.2.2 (Y 0) Q.alpha hd1alpha.symm hAB).2 + (by simpa [Y] using Q.alpha_missing) + have hmissB : Q.beta ∈ MissingColors G chi (Y 1) := by + have heq := hbehavior.1 (Y 1) (htrunkNotK 1) + rw [heq] + simpa [Y] using Q.beta_missing + have he0notK : Sum.inr eX ∉ K := by + intro he + rw [hKR_eq] at he + simp only [Set.mem_ofPred_eq, reduceCtorEq, Sum.inr.injEq, false_or, R] at he + rcases he with h | h | h | h + · have hc := Q.global.1.2.2.2.2.1 + rw [h, hlinkBcolor] at hc + simp at hc + · have hc := Q.global.1.2.2.2.2.1 + rw [h, hr6color] at hc + simp at hc + · have hc := Q.global.1.2.2.2.2.1 + rw [h, hlastBcolor] at hc + simp at hc + · have hc := Q.global.1.2.2.2.2.1 + rw [h, hr5color] at hc + simp at hc + exact @helper_continuation_1135 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@eX) (@psi) (@X) (@Q) (@hgraphHeight) (@hlenX) (@d0) (@d1) (@hd10) (@x1) (@x2) (@linkB) + (@last0) (@lastB) (@z1) (@z2) (@hx1ends) (@hx2ends) (@hx1color) (@hx2color) (@hlinkBends) + (@hfirstOrient) (@hYne) (@hlast0) (@a) (@b) (@r5) (@r6) (@ha7or8) (@hr5ends) (@hr6ends) + (@hr5color) (@hr6color) (@hr5which) (@hr6which) (@hr56) (@hz12) (@habv) (@hlastab) + (@hlink_r5) (@hlink_r6) (@hlast_r5) (@hlast_r6) (@hz1a) (@hz2b) (@hz1link) (@hz2link) + (@hz1r5) (@har5) (@hz2r6) (@hbr6) (@halast) (@hblast) (@R_closed) (@hKR) (@hRK) (@hKR_eq) + (@hz1pos) (@hz2pos) (@htrunkNotK) (@beta_edge_not_K) (@he2notK) (@hcloseEnds) (@hcloseNotK) + (@hchiProper) (@unaffected) (@beta_fixed) (@hr5K) (@hr6K) (@hchir5) (@hchir6) (@hchiC0) + (@hchiC1) (@hchie1) (@hchie2) (@hchie3) (@hchix1) (@hchix2) (@hchilast0) (@hchiclose) + (@hbehavior) (@hmissD0) (@hmissA) (@hmissB) (@he0notK) +private theorem helper_cycleContradiction_192.{u_1, u_2} : + helperCycleContradiction192Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k eX psi X Q hbalX hgraphHeight hlenX hheightX d0 d1 hd0missing hd0beta + hd1alpha hd1beta hd10 x1 x2 linkB last0 lastB z1 z2 hx1ends hx2ends hx1color hx2color + hlinkBends hlinkBcolor hlast0color hlastBcolor hfirstOrient + let this : DecidableEq V := + Classical.decEq V + intro Y C hYne hlast0 hlastB hproperX hn p0 p1 a b r5 r6 ha7or8 hr5ends hr6ends hr5color + hr6color hr5which hr6which hr56 + let H := TwoColorIncidenceGraph G psi d1 Q.beta + let K := TwoColorComponent G psi d1 Q.beta (Sum.inl z1) + let R : Set (Sum V E) := {q | + q = Sum.inl z1 ∨ q = Sum.inr linkB ∨ + q = Sum.inl z2 ∨ q = Sum.inr r6 ∨ + q = Sum.inl b ∨ q = Sum.inr lastB ∨ + q = Sum.inl a ∨ q = Sum.inr r5} + have hz12 : z1 ≠ z2 := by + intro h + subst z2 + exact G.loopless linkB z1 hlinkBends + have habv : a ≠ b := by + intro hab + rcases ha7or8 with h | h + · exact hYne (i := 7) (j := 8) (by decide) + (h.1.symm.trans (hab.trans h.2)) + · exact hYne (i := 8) (j := 7) (by decide) + (h.1.symm.trans (hab.trans h.2)) + have hlastab : G.ends lastB = s(a, b) := by + rcases ha7or8 with h | h + · simpa [h.1, h.2] using hlastB + · simpa [h.1, h.2] using hlastB.trans Sym2.eq_swap + have hlink_r5 : linkB ≠ r5 := by + intro h + subst r5 + rw [hlinkBcolor] at hr5color + exact hd1beta (Option.some.inj hr5color.symm) + have hlink_r6 : linkB ≠ r6 := by + intro h + subst r6 + rw [hlinkBcolor] at hr6color + exact hd1beta (Option.some.inj hr6color.symm) + have hlast_r5 : lastB ≠ r5 := by + intro h + subst r5 + rw [hlastBcolor] at hr5color + exact hd1beta (Option.some.inj hr5color.symm) + have hlast_r6 : lastB ≠ r6 := by + intro h + subst r6 + rw [hlastBcolor] at hr6color + exact hd1beta (Option.some.inj hr6color.symm) + have hz1a : z1 ≠ a := by + intro h + subst a + exact G.loopless r5 z1 hr5ends + have hz2b : z2 ≠ b := by + intro h + subst b + exact G.loopless r6 z2 hr6ends + have adjD {u v : V} {f : E} (hf : G.ends f = s(u, v)) + (hc : psi f = some d1) : H.Adj (Sum.inl u) (Sum.inr f) := by + simp only [H, TwoColorIncidenceGraph] + refine ⟨?_, Or.inl hc⟩ + rw [Incident, hf] + simp + have adjB {u v : V} {f : E} (hf : G.ends f = s(u, v)) + (hc : psi f = some Q.beta) : + H.Adj (Sum.inl u) (Sum.inr f) := by + simp only [H, TwoColorIncidenceGraph] + refine ⟨?_, Or.inr hc⟩ + rw [Incident, hf] + simp + have hz1link := adjB hlinkBends hlinkBcolor + have hz2link : H.Adj (Sum.inl z2) (Sum.inr linkB) := + adjB (hlinkBends.trans Sym2.eq_swap) hlinkBcolor + have hz1r5 := adjD hr5ends hr5color + have har5 : H.Adj (Sum.inl a) (Sum.inr r5) := + adjD (hr5ends.trans Sym2.eq_swap) hr5color + have hz2r6 := adjD hr6ends hr6color + have hbr6 : H.Adj (Sum.inl b) (Sum.inr r6) := + adjD (hr6ends.trans Sym2.eq_swap) hr6color + have halast := adjB hlastab hlastBcolor + have hblast : H.Adj (Sum.inl b) (Sum.inr lastB) := + adjB (hlastab.trans Sym2.eq_swap) hlastBcolor + have neighbor_of_two {q r s t : Sum V E} + (hr : H.Adj q r) (hs : H.Adj q s) (hrs : r ≠ s) + (ht : H.Adj q t) : t = r ∨ t = s := by + let : Fintype (H.neighborSet q) := Fintype.ofFinite _ + by_contra hn + push Not at hn + let three : Finset (Sum V E) := {r, s, t} + have hsub : three ⊆ H.neighborFinset q := by + intro x hx + simp only [three, Finset.mem_insert, Finset.mem_singleton] at hx + rcases hx with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hr + · simpa [SimpleGraph.mem_neighborFinset] using hs + · simpa [SimpleGraph.mem_neighborFinset] using ht + have hthree : 3 ≤ (H.neighborFinset q).card := by + have hc : three.card = 3 := by + simp [three, hrs, hn.1, hn.2, Ne.symm] + rw [← hc] + exact Finset.card_le_card hsub + have htwo : H.degree q ≤ 2 := by + simpa [H] using + TwoColorIncidenceDegreeAtMostTwo G psi d1 Q.beta hproperX q + rw [SimpleGraph.card_neighborFinset_eq_degree] at hthree + omega + have R_closed := @helper_R_closed_323 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@eX) (@psi) (@X) (@Q) (@d1) (@linkB) (@lastB) (@z1) (@z2) (@a) (@b) (@r5) (@r6) (@hz12) + (@habv) (@hlink_r5) (@hlink_r6) (@hlast_r5) (@hlast_r6) (@hz1a) (@hz2b) (@hz1link) (@hz2link) + (@hz1r5) (@har5) (@hz2r6) (@hbr6) (@halast) (@hblast) (@neighbor_of_two) + have hKR : K ⊆ R := by + intro q hq + change H.connectedComponentMk q = + H.connectedComponentMk (Sum.inl z1) at hq + obtain ⟨walk⟩ := SimpleGraph.ConnectedComponent.exact hq + have propagate : ∀ {u v : Sum V E}, H.Walk u v → u ∈ R → v ∈ R := by + intro u v walk hu + induction walk with + | nil => exact hu + | @cons u t v hut rest ih => exact ih (R_closed hu hut) + exact propagate walk.reverse (by simp [R]) + have hRK := @helper_hRK_376 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@eX) + (@psi) (@X) (@Q) (@d1) (@linkB) (@lastB) (@z1) (@z2) (@a) (@b) (@r5) (@r6) (@hz1link) + (@hz2link) (@har5) (@hz2r6) (@hbr6) (@halast) (@hblast) + have hKR_eq : K = R := Set.Subset.antisymm hKR hRK + have hz1pos : z1 = Y 5 ∨ z1 = Y 6 := by + rcases hfirstOrient with ho | ho + · exact Or.inl (by simpa [Y] using ho.2.1.symm) + · exact Or.inr (by simpa [Y] using ho.2.2.2.symm) + have hz2pos : z2 = Y 5 ∨ z2 = Y 6 := by + rcases hfirstOrient with ho | ho + · exact Or.inr (by simpa [Y] using ho.2.2.2.symm) + · exact Or.inl (by simpa [Y] using ho.2.1.symm) + have trunk_tail_ne (q : Fin 5) (r : Fin 9) (hr : 5 ≤ r.val) : + Y ⟨q.val, by omega⟩ ≠ Y r := by + apply hYne + intro h + have hv := congrArg (fun i : Fin 9 => i.val) h + exact (Nat.ne_of_lt (lt_of_lt_of_le q.isLt hr)) hv + have htrunkNotK (q : Fin 5) : + Sum.inl (Y ⟨q.val, by omega⟩) ∉ K := by + rw [hKR_eq] + simp only [R, Set.mem_ofPred_eq, not_or, Sum.inl.injEq, + Sum.inl_ne_inr, not_false_eq_true, true_and, and_true] + refine ⟨?_, ?_, ?_, ?_⟩ + · rcases hz1pos with rfl | rfl + · exact trunk_tail_ne q 5 (by norm_num) + · exact trunk_tail_ne q 6 (by norm_num) + · rcases hz2pos with rfl | rfl + · exact trunk_tail_ne q 5 (by norm_num) + · exact trunk_tail_ne q 6 (by norm_num) + · rcases ha7or8 with h | h + · rw [h.2] + exact trunk_tail_ne q 8 (by norm_num) + · rw [h.2] + exact trunk_tail_ne q 7 (by norm_num) + · rcases ha7or8 with h | h + · rw [h.1] + exact trunk_tail_ne q 7 (by norm_num) + · rw [h.1] + exact trunk_tail_ne q 8 (by norm_num) + exact @helper_continuation_932 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@eX) (@psi) (@X) (@Q) (@hbalX) (@hgraphHeight) (@hlenX) (@hheightX) (@d0) (@d1) + (@hd0missing) (@hd0beta) (@hd1alpha) (@hd1beta) (@hd10) (@x1) (@x2) (@linkB) (@last0) + (@lastB) (@z1) (@z2) (@hx1ends) (@hx2ends) (@hx1color) (@hx2color) (@hlinkBends) + (@hlinkBcolor) (@hlast0color) (@hlastBcolor) (@hfirstOrient) (@hYne) (@hlast0) (@hproperX) + (@a) (@b) (@r5) (@r6) (@ha7or8) (@hr5ends) (@hr6ends) (@hr5color) (@hr6color) (@hr5which) + (@hr6which) (@hr56) (@hz12) (@habv) (@hlastab) (@hlink_r5) (@hlink_r6) (@hlast_r5) + (@hlast_r6) (@hz1a) (@hz2b) (@hz1link) (@hz2link) (@hz1r5) (@har5) (@hz2r6) (@hbr6) + (@halast) (@hblast) (@R_closed) (@hKR) (@hRK) (@hKR_eq) (@hz1pos) (@hz2pos) (@htrunkNotK) +private theorem helper_hcross_132.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) {eX : E} + (psi : PartialEdgeColoring E k) (X : TreeSequence G eX) + (Q : NormalGlobalMaximumTriple G k eX psi X) (_ : BalancedGlobalMaximumTriple Q) + (_ : ScheideGraphHeight G = (5 : ℕ)) (hlenX : X.length = (8 : ℕ)) + (_ : Q.height = (5 : ℕ)) (d0 d1 : Fin k) + (_ : + d0 ∈ + MissingColors G psi (X.vertex (⟨(0 : ℕ), by omega⟩ : Fin (X.length + (1 : ℕ))))) + (_ : d0 ≠ Q.beta) (_ : d1 ≠ Q.alpha) (_ : d1 ≠ Q.beta) (_ : d1 ≠ d0) + (x1 x2 linkB last0 lastB : E) (z1 z2 : V) + (_ : G.ends x1 = s(X.vertex (⟨(1 : ℕ), by omega⟩ : Fin (X.length + (1 : ℕ))), z1)) + (_ : G.ends x2 = s(X.vertex (⟨(4 : ℕ), by omega⟩ : Fin (X.length + (1 : ℕ))), z2)) + (_ : psi x1 = some d0) (_ : psi x2 = some d0) (_ : G.ends linkB = s(z1, z2)) + (_ : psi linkB = some Q.beta) (_ : psi last0 = some d0) (_ : psi lastB = some Q.beta) + (_ : + X.edge (⟨(4 : ℕ), by omega⟩ : Fin X.length) = x1 ∧ + X.vertex (⟨(5 : ℕ), by omega⟩ : Fin (X.length + (1 : ℕ))) = z1 ∧ + X.edge (⟨(5 : ℕ), by omega⟩ : Fin X.length) = x2 ∧ + X.vertex (⟨(6 : ℕ), by omega⟩ : Fin (X.length + (1 : ℕ))) = z2 ∨ + X.edge (⟨(4 : ℕ), by omega⟩ : Fin X.length) = x2 ∧ + X.vertex (⟨(5 : ℕ), by omega⟩ : Fin (X.length + (1 : ℕ))) = z2 ∧ + X.edge (⟨(5 : ℕ), by omega⟩ : Fin X.length) = x1 ∧ + X.vertex (⟨(6 : ℕ), by omega⟩ : Fin (X.length + (1 : ℕ))) = z1), + let _ : DecidableEq V := Classical.decEq V; + let Y : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ + X.vertex + (⟨(↑i : ℕ), + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < X.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (X.length + (1 : ℕ))); + let C : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ + X.edge + (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < X.length) ↦ by omega⟩ : + Fin X.length); + ∀ (_ : (∀ {i j : Fin (9 : ℕ)} (_ : i ≠ j), Y i ≠ Y j)) + (_ : C (0 : Fin (2 : ℕ)) ≠ C (1 : Fin (2 : ℕ))) + (_ : (∀ (j : Fin (2 : ℕ)), psi (C j) = some d1)) + (_ : G.ends last0 = s(Y (7 : Fin (9 : ℕ)), Y (8 : Fin (9 : ℕ)))) + (_ : G.ends lastB = s(Y (7 : Fin (9 : ℕ)), Y (8 : Fin (9 : ℕ)))) + (_ : IsProperEdgeColoring G psi), + ∃ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), + G.ends (C j) = + s(Y + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < (9 : ℕ)) ↦ by omega⟩ : + Fin (9 : ℕ)), + Y + (⟨(7 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(7 : ℕ) + (↑j : ℕ) < (9 : ℕ)) ↦ by + omega⟩ : + Fin (9 : ℕ))) := by + classical + intro V E _ _ _ G k eX psi X Q hbalX hgraphHeight hlenX hheightX d0 d1 hd0missing hd0beta + hd1alpha hd1beta hd10 x1 x2 linkB last0 lastB z1 z2 hx1ends hx2ends hx1color hx2color + hlinkBends hlinkBcolor hlast0color hlastBcolor hfirstOrient this Y C hYne hCne hCcolor + hlast0 hlastB hproperX + by_contra hn + push Not at hn + obtain ⟨p0, hp0⟩ := X.attaches (⟨6, by omega⟩ : Fin X.length) + obtain ⟨p1, hp1⟩ := X.attaches (⟨7, by omega⟩ : Fin X.length) + have hp0lt7 : p0.val < 7 := by simp + have hp1lt8 : p1.val < 8 := by simp + have hp0v : X.vertex (Fin.castLT p0 + (Nat.lt_trans p0.isLt + (Nat.succ_lt_succ (⟨6, by omega⟩ : Fin X.length).isLt))) = + Y ⟨p0.val, by omega⟩ := by + apply congrArg X.vertex + apply Fin.ext + rfl + have hp1v : X.vertex (Fin.castLT p1 + (Nat.lt_trans p1.isLt + (Nat.succ_lt_succ (⟨7, by omega⟩ : Fin X.length).isLt))) = + Y ⟨p1.val, by omega⟩ := by + apply congrArg X.vertex + apply Fin.ext + rfl + have hp0' : G.ends (C 0) = + s(Y 7, Y ⟨p0.val, by omega⟩) := by + simpa [C, Y, hp0v] using hp0 + have hp1' : G.ends (C 1) = + s(Y 8, Y ⟨p1.val, by omega⟩) := by + simpa [C, Y, hp1v] using hp1 + have hp0ge : 5 ≤ p0.val := by + by_contra h + have hp0lt : p0.val < 5 := by omega + let q : Fin 5 := ⟨p0.val, hp0lt⟩ + exact hn 0 q (by simpa [q] using hp0'.trans Sym2.eq_swap) + have hp1ge : 5 ≤ p1.val := by + by_contra h + have hp1lt : p1.val < 5 := by omega + let q : Fin 5 := ⟨p1.val, hp1lt⟩ + exact hn 1 q (by simpa [q] using hp1'.trans Sym2.eq_swap) + have hp1not7 : p1.val ≠ 7 := by + intro hp17 + have hinc0 : Incident G (Y 7) (C 0) := by + rw [Incident, hp0'] + simp + have hinc1 : Incident G (Y 7) (C 1) := by + rw [Incident, hp1'] + simp [hp17] + exact (hproperX hCne ⟨Y 7, hinc0, hinc1⟩ (hCcolor 0)) + (hCcolor 1) + have hp0cases : p0.val = 5 ∨ p0.val = 6 := by omega + have hp1cases : p1.val = 5 ∨ p1.val = 6 := by omega + have hpne : p0.val ≠ p1.val := by + intro heq + let u : Fin 9 := ⟨p0.val, by omega⟩ + have hinc0 : Incident G (Y u) (C 0) := by + rw [Incident, hp0'] + simp [u] + have hinc1 : Incident G (Y u) (C 1) := by + rw [Incident, hp1'] + simp [u, heq] + exact (hproperX hCne ⟨_, hinc0, hinc1⟩ (hCcolor 0)) + (hCcolor 1) + have hmatch : + (G.ends (C 0) = s(Y 7, Y 5) ∧ + G.ends (C 1) = s(Y 8, Y 6)) ∨ + (G.ends (C 0) = s(Y 7, Y 6) ∧ + G.ends (C 1) = s(Y 8, Y 5)) := by + rcases hp0cases with h05 | h06 <;> + rcases hp1cases with h15 | h16 + · exact False.elim (hpne (h05.trans h15.symm)) + · left + constructor + · simpa [h05] using hp0' + · simpa [h16] using hp1' + · right + constructor + · simpa [h06] using hp0' + · simpa [h15] using hp1' + · exact False.elim (hpne (h06.trans h16.symm)) + have cycleContradiction := @helper_cycleContradiction_192 V E inferInstance inferInstance + inferInstance G k eX psi X Q hbalX hgraphHeight hlenX hheightX d0 d1 hd0missing hd0beta + hd1alpha hd1beta hd10 x1 x2 linkB last0 lastB z1 z2 hx1ends hx2ends hx1color hx2color + hlinkBends hlinkBcolor hlast0color hlastBcolor hfirstOrient hYne hlast0 hlastB hproperX hn p0 + p1 + rcases hmatch with hm | hm + · rcases hfirstOrient with ho | ho + · have hz1 : Y 5 = z1 := by simpa [Y] using ho.2.1 + have hz2 : Y 6 = z2 := by simpa [Y] using ho.2.2.2 + exact cycleContradiction (Y 7) (Y 8) (C 0) (C 1) + (Or.inl ⟨rfl, rfl⟩) + (by rw [← hz1]; exact hm.1.trans Sym2.eq_swap) + (by rw [← hz2]; exact hm.2.trans Sym2.eq_swap) + (hCcolor 0) (hCcolor 1) (Or.inl rfl) (Or.inr rfl) hCne + · have hz2 : Y 5 = z2 := by simpa [Y] using ho.2.1 + have hz1 : Y 6 = z1 := by simpa [Y] using ho.2.2.2 + exact cycleContradiction (Y 8) (Y 7) (C 1) (C 0) + (Or.inr ⟨rfl, rfl⟩) + (by rw [← hz1]; exact hm.2.trans Sym2.eq_swap) + (by rw [← hz2]; exact hm.1.trans Sym2.eq_swap) + (hCcolor 1) (hCcolor 0) (Or.inr rfl) (Or.inl rfl) hCne.symm + · rcases hfirstOrient with ho | ho + · have hz1 : Y 5 = z1 := by simpa [Y] using ho.2.1 + have hz2 : Y 6 = z2 := by simpa [Y] using ho.2.2.2 + exact cycleContradiction (Y 8) (Y 7) (C 1) (C 0) + (Or.inr ⟨rfl, rfl⟩) + (by rw [← hz1]; exact hm.2.trans Sym2.eq_swap) + (by rw [← hz2]; exact hm.1.trans Sym2.eq_swap) + (hCcolor 1) (hCcolor 0) (Or.inr rfl) (Or.inl rfl) hCne.symm + · have hz2 : Y 5 = z2 := by simpa [Y] using ho.2.1 + have hz1 : Y 6 = z1 := by simpa [Y] using ho.2.2.2 + exact cycleContradiction (Y 7) (Y 8) (C 0) (C 1) + (Or.inl ⟨rfl, rfl⟩) + (by rw [← hz1]; exact hm.1.trans Sym2.eq_swap) + (by rw [← hz2]; exact hm.2.trans Sym2.eq_swap) + (hCcolor 0) (hCcolor 1) (Or.inl rfl) (Or.inr rfl) hCne + +private theorem helper_hknown_995.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eZ : E} (rho : PartialEdgeColoring E k) (Z : TreeSequence + G eZ) (RZ : NormalGlobalMaximumTriple G k eZ rho Z) (hlenZ : Z.length = (8 : ℕ)) (_ : + RZ.height = (5 : ℕ)), + ∀ d ∈ MissingColors G rho (Z.vertex (⟨(0 : ℕ), Decidable.byContradiction fun (a : ¬(0 : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ)))), ( + ∀ (j : Fin (2 : ℕ)), rho (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 + : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = some d) → + let ZY : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ Z.vertex (⟨(↑i : ℕ), + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))); + let ZE : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by omega + ⟩ : Fin Z.length); IsProperEdgeColoring G rho → ( + ∀ {i j : Fin (9 : ℕ)}, i ≠ j → ZY i ≠ ZY j) → ( + ∀ {v : V} {f : E}, d ∈ MissingColors G rho v → Incident G v f → rho f ≠ some d) → + ∀ (j0 : Fin (2 : ℕ)) (q0 : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j0 : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j0 : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q0 : ℕ), Decidable.byContradiction fun (a : ¬(↑q0 : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j0 : ℕ), Decidable.byContradiction fun + (a : ¬(7 : ℕ) + (↑j0 : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → ( + ∀ (r : Fin (5 : ℕ)), ZY (⟨(7 : ℕ) + (↑j0 : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + + (↑j0 : ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ)) ≠ ZY (⟨(↑r : ℕ), Decidable.byContradiction fun (a : ¬(↑r : ℕ) < (9 : ℕ)) ↦ + by omega + ⟩ : Fin (9 : ℕ))) → + ∀ (f1 f2 f3 : E) (u1 u2 : V), G.ends f1 = s(Z.vertex (⟨(1 : ℕ), + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), u1) → G.ends f2 = s(Z.vertex (⟨(4 : ℕ), + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), u2) → G.ends f3 = s(Z.vertex (⟨(2 : ℕ), + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(3 : ℕ), + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → rho f1 = some d → rho f2 = some d → rho f3 = some d → u1 ≠ + Z.vertex (⟨(1 : ℕ), + by omega + ⟩ : Fin (Z.length + (1 : ℕ))) → u2 ≠ Z.vertex (⟨(4 : ℕ), + by omega + ⟩ : Fin (Z.length + (1 : ℕ))) → G.ends (ZE j0) = s(ZY (⟨(↑q0 : ℕ), Decidable.byContradiction + fun (a : ¬(↑q0 : ℕ) < (9 : ℕ)) ↦ + by omega + ⟩ : Fin (9 : ℕ)), ZY (⟨(7 : ℕ) + (↑j0 : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + (↑j0 + : ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ))) → ZY (⟨(7 : ℕ) + (↑j0 : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + + (↑j0 : ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ)) = u1 ∨ ZY (⟨(7 : ℕ) + (↑j0 : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + + (↑j0 : ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ)) = u2 := by + classical + intro V E _ _ _ G k eZ rho Z RZ hlenZ hheightZ d hdmissing hcolors ZY ZE hproperZ hZYne + missing_no_edge j0 q0 hcross0 hlastNe f1 f2 f3 u1 u2 hf1ends hf2ends hf3ends hf1color + hf2color hf3color hu11 hu24 hcross0' + fin_cases q0 + · have hi : Incident G (ZY 0) (ZE j0) := by + rw [Incident, hcross0'] + simp [ZY] + exact False.elim ((missing_no_edge hdmissing hi) + (by simpa [ZE] using hcolors j0)) + · left + have heq : ZE j0 = f1 := by + by_contra hne + have hi0 : Incident G (ZY 1) (ZE j0) := by + rw [Incident, hcross0'] + simp [ZY] + have hi1 : Incident G (ZY 1) f1 := by + rw [Incident, hf1ends] + simp [ZY] + exact (hproperZ hne ⟨ZY 1, hi0, hi1⟩ + (by simpa [ZE] using hcolors j0)) hf1color + have hpairs : s(ZY 1, ZY ⟨7 + j0.val, by omega⟩) = + s(ZY 1, u1) := by + rw [heq] at hcross0' + simpa [ZY] using hcross0'.symm.trans hf1ends + rcases Sym2.eq_iff.mp hpairs with hp | hp + · exact hp.2 + · exact False.elim (hu11 (by simpa [ZY] using hp.1.symm)) + · have heq : ZE j0 = f3 := by + by_contra hne + have hi0 : Incident G (ZY 2) (ZE j0) := by + rw [Incident, hcross0'] + simp [ZY] + have hi3 : Incident G (ZY 2) f3 := by + rw [Incident, hf3ends] + simp [ZY] + exact (hproperZ hne ⟨ZY 2, hi0, hi3⟩ + (by simpa [ZE] using hcolors j0)) hf3color + have hpairs : s(ZY 2, ZY ⟨7 + j0.val, by omega⟩) = + s(ZY 2, ZY 3) := by + rw [heq] at hcross0' + simpa [ZY] using hcross0'.symm.trans hf3ends + rcases Sym2.eq_iff.mp hpairs with hp | hp + · exact False.elim ((hlastNe 3) hp.2) + · exact False.elim (hZYne (i := 2) (j := 3) (by decide) hp.1) + · have heq : ZE j0 = f3 := by + by_contra hne + have hi0 : Incident G (ZY 3) (ZE j0) := by + rw [Incident, hcross0'] + simp [ZY] + have hi3 : Incident G (ZY 3) f3 := by + rw [Incident, hf3ends] + simp [ZY] + exact (hproperZ hne ⟨ZY 3, hi0, hi3⟩ + (by simpa [ZE] using hcolors j0)) hf3color + have hpairs : s(ZY 3, ZY ⟨7 + j0.val, by omega⟩) = + s(ZY 2, ZY 3) := by + rw [heq] at hcross0' + simpa [ZY] using hcross0'.symm.trans hf3ends + rcases Sym2.eq_iff.mp hpairs with hp | hp + · exact False.elim (hZYne (i := 3) (j := 2) (by decide) hp.1) + · exact False.elim ((hlastNe 2) hp.2) + · right + have heq : ZE j0 = f2 := by + by_contra hne + have hi0 : Incident G (ZY 4) (ZE j0) := by + rw [Incident, hcross0'] + simp [ZY] + have hi2 : Incident G (ZY 4) f2 := by + rw [Incident, hf2ends] + simp [ZY] + exact (hproperZ hne ⟨ZY 4, hi0, hi2⟩ + (by simpa [ZE] using hcolors j0)) hf2color + have hpairs : s(ZY 4, ZY ⟨7 + j0.val, by omega⟩) = + s(ZY 4, u2) := by + rw [heq] at hcross0' + simpa [ZY] using hcross0'.symm.trans hf2ends + rcases Sym2.eq_iff.mp hpairs with hp | hp + · exact hp.2 + · exact False.elim (hu24 (by simpa [ZY] using hp.1.symm)) + +private theorem helper_hAlphaEq_1084.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eZ : E} (rho : PartialEdgeColoring E k) (Z : TreeSequence + G eZ) (RZ : NormalGlobalMaximumTriple G k eZ rho Z) (hlenZ : Z.length = (8 : ℕ)) (lastAZ : + E) (_ : G.ends lastAZ = s(Z.vertex (⟨(7 : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + < Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(8 : ℕ), Decidable.byContradiction fun (a : ¬(8 : ℕ) + < Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))))) (_ : rho lastAZ = some RZ.alpha), + let ZY : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ Z.vertex (⟨(↑i : ℕ), + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))); + ∀ (_ : IsProperEdgeColoring G rho) (j0 : Fin (2 : ℕ)) (u1 u2 : V) (_ : ZY (⟨(7 : ℕ) + (↑j0 : + ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + (↑j0 : ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ)) = u1 ∨ ZY (⟨(7 : ℕ) + (↑j0 : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + + (↑j0 : ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ)) = u2) (alphaEdge : E) (_ : G.ends alphaEdge = s(u1, u2)) (_ : rho alphaEdge = + some RZ.alpha) (_ : ZY (⟨(7 : ℕ) + (↑j0 : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + + (↑j0 : ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ)) = ZY (7 : Fin (9 : ℕ)) ∨ ZY (⟨(7 : ℕ) + (↑j0 : ℕ), Decidable.byContradiction + fun (a : ¬(7 : ℕ) + (↑j0 : ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ)) = ZY (8 : Fin (9 : ℕ))), alphaEdge = lastAZ := by + classical + intro V E _ _ _ G k eZ rho Z RZ hlenZ lastAZ hlastAZends hlastAZcolor ZY hproperZ j0 u1 u2 + hknown alphaEdge halphaEnds halphaColor hfinal + by_contra hne + rcases hknown with hu | hu <;> rcases hfinal with hy | hy + · have hi1 : Incident G (ZY 7) alphaEdge := by + rw [Incident, halphaEnds] + simp [← hy, hu] + have hi2 : Incident G (ZY 7) lastAZ := by + rw [Incident, hlastAZends] + simp [ZY] + exact (hproperZ hne ⟨ZY 7, hi1, hi2⟩ halphaColor) + hlastAZcolor + · have hi1 : Incident G (ZY 8) alphaEdge := by + rw [Incident, halphaEnds] + simp [← hy, hu] + have hi2 : Incident G (ZY 8) lastAZ := by + rw [Incident, hlastAZends] + simp [ZY] + exact (hproperZ hne ⟨ZY 8, hi1, hi2⟩ halphaColor) + hlastAZcolor + · have hi1 : Incident G (ZY 7) alphaEdge := by + rw [Incident, halphaEnds] + simp [← hy, hu] + have hi2 : Incident G (ZY 7) lastAZ := by + rw [Incident, hlastAZends] + simp [ZY] + exact (hproperZ hne ⟨ZY 7, hi1, hi2⟩ halphaColor) + hlastAZcolor + · have hi1 : Incident G (ZY 8) alphaEdge := by + rw [Incident, halphaEnds] + simp [← hy, hu] + have hi2 : Incident G (ZY 8) lastAZ := by + rw [Incident, hlastAZends] + simp [ZY] + exact (hproperZ hne ⟨ZY 8, hi1, hi2⟩ halphaColor) + hlastAZcolor + +private theorem helper_branch_1133.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eZ : E} (rho : PartialEdgeColoring E k) (Z : TreeSequence + G eZ) (RZ : NormalGlobalMaximumTriple G k eZ rho Z) (hlenZ : Z.length = (8 : ℕ)) (_ : + RZ.height = (5 : ℕ)) (d : Fin k) (_ : ( + ∀ (j : Fin (2 : ℕ)), rho (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 + : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = some d)), + let ZY : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ Z.vertex (⟨(↑i : ℕ), + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))); + let ZE : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by omega + ⟩ : Fin Z.length); + ∀ (_ : IsProperEdgeColoring G rho) (f1 f2 : E) (u1 u2 : V) (_ : G.ends f1 = s(Z.vertex (⟨(1 : + ℕ), + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), u1)) (_ : G.ends f2 = s(Z.vertex (⟨(4 : ℕ), + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), u2)) (_ : rho f1 = some d) (_ : rho f2 = some d) (j : Fin (2 : + ℕ)) (pj : Fin ((↑(⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : + ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length) : ℕ) + (1 : ℕ))) (_ : G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 : + ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length).succ, Z.vertex (pj.castLT (Nat.lt_trans pj.isLt (Nat.succ_lt_succ (⟨(6 : ℕ) + + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by omega + ⟩ : Fin Z.length).isLt))))) (_ : Incident G (ZY (⟨(7 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(7 : ℕ) + (↑j : ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ))) (ZE j)) (_ : u1 = ZY (7 : Fin (9 : ℕ)) ∧ u2 = ZY (8 : Fin (9 : ℕ))), + ∃ (q : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : + ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) + (↑j : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k eZ rho Z RZ hlenZ hheightZ d hcolors ZY ZE hproperZ f1 f2 u1 u2 hf1ends + hf2ends hf1color hf2color j pj hpj hincC hout + fin_cases j + · have heq : ZE 0 = f1 := by + by_contra hne + have hi : Incident G (ZY 7) f1 := by + rw [Incident, hf1ends] + simp [ZY, hout.1] + exact (hproperZ hne ⟨ZY 7, hincC, hi⟩ (hcolors 0)) hf1color + refine ⟨1, ?_⟩ + change G.ends (ZE 0) = s(ZY 1, ZY 7) + rw [heq] + simpa [ZY, hout.1] using hf1ends + · have heq : ZE 1 = f2 := by + by_contra hne + have hi : Incident G (ZY 8) f2 := by + rw [Incident, hf2ends] + simp [ZY, hout.2] + exact (hproperZ hne ⟨ZY 8, hincC, hi⟩ (hcolors 1)) hf2color + refine ⟨4, ?_⟩ + change G.ends (ZE 1) = s(ZY 4, ZY 8) + rw [heq] + simpa [ZY, hout.2] using hf2ends + +private theorem helper_branch_1154.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eZ : E} (rho : PartialEdgeColoring E k) (Z : TreeSequence + G eZ) (RZ : NormalGlobalMaximumTriple G k eZ rho Z) (hlenZ : Z.length = (8 : ℕ)) (_ : + RZ.height = (5 : ℕ)) (d : Fin k) (_ : ( + ∀ (j : Fin (2 : ℕ)), rho (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 + : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = some d)), + let ZY : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ Z.vertex (⟨(↑i : ℕ), + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))); + let ZE : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by omega + ⟩ : Fin Z.length); + ∀ (_ : IsProperEdgeColoring G rho) (f1 f2 : E) (u1 u2 : V) (_ : G.ends f1 = s(Z.vertex (⟨(1 : + ℕ), + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), u1)) (_ : G.ends f2 = s(Z.vertex (⟨(4 : ℕ), + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), u2)) (_ : rho f1 = some d) (_ : rho f2 = some d) (j : Fin (2 : + ℕ)) (pj : Fin ((↑(⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : + ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length) : ℕ) + (1 : ℕ))) (_ : G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 : + ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length).succ, Z.vertex (pj.castLT (Nat.lt_trans pj.isLt (Nat.succ_lt_succ (⟨(6 : ℕ) + + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by omega + ⟩ : Fin Z.length).isLt))))) (_ : Incident G (ZY (⟨(7 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(7 : ℕ) + (↑j : ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ))) (ZE j)) (_ : u1 = ZY (8 : Fin (9 : ℕ)) ∧ u2 = ZY (7 : Fin (9 : ℕ))), + ∃ (q : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : + ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) + (↑j : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k eZ rho Z RZ hlenZ hheightZ d hcolors ZY ZE hproperZ f1 f2 u1 u2 hf1ends + hf2ends hf1color hf2color j pj hpj hincC hout + fin_cases j + · have heq : ZE 0 = f2 := by + by_contra hne + have hi : Incident G (ZY 7) f2 := by + rw [Incident, hf2ends] + simp [ZY, hout.2] + exact (hproperZ hne ⟨ZY 7, hincC, hi⟩ (hcolors 0)) hf2color + refine ⟨4, ?_⟩ + change G.ends (ZE 0) = s(ZY 4, ZY 7) + rw [heq] + simpa [ZY, hout.2] using hf2ends + · have heq : ZE 1 = f1 := by + by_contra hne + have hi : Incident G (ZY 8) f1 := by + rw [Incident, hf1ends] + simp [ZY, hout.1] + exact (hproperZ hne ⟨ZY 8, hincC, hi⟩ (hcolors 1)) hf1color + refine ⟨1, ?_⟩ + change G.ends (ZE 1) = s(ZY 1, ZY 8) + rw [heq] + simpa [ZY, hout.1] using hf1ends + +private theorem helper_localizeZero_898.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : TreeSequence + G eX) (_ : NormalGlobalMaximumTriple G k eX psi X) (_ : ScheideGraphHeight G = (5 : ℕ)), + let _ : DecidableEq V := Classical.decEq V; + ∀ {eZ : E} (rho : PartialEdgeColoring E k) (Z : TreeSequence G eZ) (RZ : + NormalGlobalMaximumTriple G k eZ rho Z) (hlenZ : Z.length = (8 : ℕ)) (_ : RZ.height = (5 : + ℕ)), + ∀ d ∈ MissingColors G rho (Z.vertex (⟨(0 : ℕ), Decidable.byContradiction fun (a : ¬(0 : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ)))), + ∀ (lastAZ : E), G.ends lastAZ = s(Z.vertex (⟨(7 : ℕ), Decidable.byContradiction fun (a : ¬(7 : + ℕ) < Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(8 : ℕ), Decidable.byContradiction fun (a : ¬(8 : ℕ) + < Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → rho lastAZ = some RZ.alpha → ( + ∀ (j : Fin (2 : ℕ)), rho (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 + : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = some d) → ( + ∃ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) + (↑j : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))))) → + ∀ (j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : + ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) + (↑j : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k eX psi X Q hgraphHeight this eZ rho Z RZ hlenZ hheightZ d hdmissing lastAZ + hlastAZends hlastAZcolor hcolors honeCross + let ZY (i : Fin 9) : V := Z.vertex ⟨i.val, by omega⟩ + let ZE (j : Fin 2) : E := Z.edge ⟨6 + j.val, by omega⟩ + have hproperZ : IsProperEdgeColoring G rho := RZ.global.1.2.2.2.1 + have hZYne {i j : Fin 9} (hij : i ≠ j) : ZY i ≠ ZY j := by + intro h + apply hij + apply Fin.ext + have heq : (⟨i.val, by omega⟩ : Fin (Z.length + 1)) = + ⟨j.val, by omega⟩ := Z.vertex_injective h + exact congrArg (fun r : Fin (Z.length + 1) => r.val) heq + have missing_no_edge {v : V} {f : E} + (hm : d ∈ MissingColors G rho v) (hi : Incident G v f) : + rho f ≠ some d := by + intro hf + have hp : d ∈ PresentColors G rho v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hi, hf⟩ + have hn : d ∉ PresentColors G rho v := by + simpa [MissingColors] using hm + exact hn hp + obtain ⟨j0, q0, hcross0⟩ := honeCross + have hlastMem : ZY ⟨7 + j0.val, by omega⟩ ∈ + TreeSequenceVertexSet Z := by + simp [ZY, TreeSequenceVertexSet] + have hlastNe (r : Fin 5) : + ZY ⟨7 + j0.val, by omega⟩ ≠ ZY ⟨r.val, by omega⟩ := by + apply hZYne + apply Fin.ne_of_val_ne + apply Nat.ne_of_gt + change r.val < 7 + j0.val + omega + obtain ⟨f1, f2, f3, u1, u2, hf1ends, hf2ends, hf3ends, + hf1color, hf2color, hf3color, hu1T, hu2T, hu10, hu11, hu12, + hu13, hu14, hu20, hu21, hu22, hu23, hu24⟩ := + ScheideHeightFiveGammaEdges G k eZ rho Z RZ hheightZ hgraphHeight d + hdmissing (ZE j0) (ZY ⟨7 + j0.val, by omega⟩) + (by simpa [ZE] using hcolors j0) (by + fin_cases q0 + · exact Or.inl (by simpa [ZE, ZY] using hcross0) + · exact Or.inr (Or.inl (by simpa [ZE, ZY] using hcross0)) + · exact Or.inr (Or.inr (Or.inl + (by simpa [ZE, ZY] using hcross0))) + · exact Or.inr (Or.inr (Or.inr (Or.inl + (by simpa [ZE, ZY] using hcross0)))) + · exact Or.inr (Or.inr (Or.inr (Or.inr + (by simpa [ZE, ZY] using hcross0))))) + hlastMem (hlastNe 0) (hlastNe 1) (hlastNe 2) (hlastNe 3) + (hlastNe 4) + have hcross0' : G.ends (ZE j0) = + s(ZY ⟨q0.val, by omega⟩, ZY ⟨7 + j0.val, by omega⟩) := by + simpa [ZE, ZY] using hcross0 + have hknown := @helper_hknown_995 V E inferInstance inferInstance inferInstance G k eZ rho Z RZ + hlenZ hheightZ d hdmissing hcolors hproperZ hZYne missing_no_edge j0 q0 hcross0 hlastNe f1 f2 + f3 u1 u2 hf1ends hf2ends hf3ends hf1color hf2color hf3color hu11 hu24 hcross0' + obtain ⟨alphaEdge, betaEdge, halphaEnds, halphaColor, hbetaEnds, + hbetaColor, habEdges⟩ := + ScheideHeightFiveOutsideLinks G k eZ rho Z RZ hheightZ + hgraphHeight d hdmissing f1 f2 u1 u2 hf1ends hf2ends hf1color + hf2color hu1T hu2T hu10 hu11 hu12 hu13 hu14 hu20 hu21 hu22 + hu23 hu24 + have hfinal : ZY ⟨7 + j0.val, by omega⟩ = ZY 7 ∨ + ZY ⟨7 + j0.val, by omega⟩ = ZY 8 := by + fin_cases j0 + · exact Or.inl rfl + · exact Or.inr rfl + have hAlphaEq := @helper_hAlphaEq_1084 V E inferInstance inferInstance inferInstance G k eZ rho Z + RZ hlenZ lastAZ hlastAZends hlastAZcolor hproperZ j0 u1 u2 hknown alphaEdge halphaEnds + halphaColor hfinal + have houtside : s(u1, u2) = s(ZY 7, ZY 8) := by + rw [hAlphaEq] at halphaEnds + simpa [ZY] using halphaEnds.symm.trans hlastAZends + intro j + obtain ⟨pj, hpj⟩ := Z.attaches (⟨6 + j.val, by omega⟩ : Fin Z.length) + have hincC : Incident G (ZY ⟨7 + j.val, by omega⟩) (ZE j) := by + rw [Incident, hpj] + rw [Sym2.mem_iff] + left + apply congrArg Z.vertex + apply Fin.ext + change 7 + j.val = 6 + j.val + 1 + omega + rcases Sym2.eq_iff.mp houtside with hout | hout + · exact @helper_branch_1133 V E inferInstance inferInstance inferInstance G k eZ rho Z RZ hlenZ + hheightZ d hcolors hproperZ f1 f2 u1 u2 hf1ends hf2ends hf1color hf2color j pj hpj hincC hout + · exact @helper_branch_1154 V E inferInstance inferInstance inferInstance G k eZ rho Z RZ hlenZ + hheightZ d hcolors hproperZ f1 f2 u1 u2 hf1ends hf2ends hf1color hf2color j pj hpj hincC hout +private theorem helper_hbalR_1973.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : + TreeSequence G eX) (Q : NormalGlobalMaximumTriple G k eX psi X) (_ : + BalancedGlobalMaximumTriple Q) (_ : X.length = (8 : ℕ)) (hheightX : Q.height = (5 : ℕ)) (m + : Fin (5 : ℕ)), + let jQ : Fin Q.height := (⟨(↑m : ℕ), @Eq.mpr (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat + (nat_lit 5) (instOfNatNat (nat_lit 5))) m) (@NormalGlobalMaximumTriple.height V E inst + inst_1 inst_2 G k eX psi X Q)) (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit + 5) (instOfNatNat (nat_lit 5))) m) (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit + 5)))) (@id (@Eq Prop (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit 5) + (instOfNatNat (nat_lit 5))) m) (@NormalGlobalMaximumTriple.height V E inst inst_1 inst_2 G + k eX psi X Q)) (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat + (nat_lit 5))) m) (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))))) (@congrArg + Nat Prop (@NormalGlobalMaximumTriple.height V E inst inst_1 inst_2 G k eX psi X Q) + (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))) (fun (_a : Nat) ↦ @LT.lt Nat + instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))) m) _a) + hheightX)) (@Fin.isLt (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))) m)⟩ : Fin + Q.height); + ∀ (rho : PartialEdgeColoring E k) (_ _ : Fin k) (_ : ( + ∀ (r : Fin X.length) (_ : Q.height - (1 : ℕ) ≤ (↑r : ℕ)), rho (X.edge r) = psi (X.edge r))) (Z + : TreeSequence G (NormalCycleEdge Q jQ)) (_ : Z.length = X.length) (_ : ( + ∀ (r : Fin Z.length) (_ : Q.height - (1 : ℕ) ≤ (↑r : ℕ)), + ∃ (s : Fin X.length), (↑s : ℕ) = (↑r : ℕ) ∧ Z.edge r = X.edge s)) (R : + NormalGlobalMaximumTriple G k (NormalCycleEdge Q jQ) rho Z) (_ : R.height = Q.height) (_ : + Fin Q.height), BalancedGlobalMaximumTriple R := by + classical + intro V E _ _ _ G k eX psi X Q hbalX hlenX hheightX m jQ rho A B htailColorR Z hlengthZ + htailEdgesZ R hheightR predR + constructor + · rw [hheightR] + exact hbalX.1 + · intro q hlow hupp + have hlow' : Q.height < 2 * q := by + rw [hheightR] at hlow + exact hlow + have hupp' : 2 * q < X.length + 1 := by + rw [hlengthZ] at hupp + exact hupp + have hqbound : 6 ≤ 2 * q := by + rw [hheightX] at hlow' + omega + let z4 : Fin Z.length := ⟨2 * q - 2, by omega⟩ + let z5 : Fin Z.length := ⟨2 * q - 1, by omega⟩ + obtain ⟨x4, hx4val, hx4edge⟩ := htailEdgesZ z4 (by + dsimp [z4] + rw [hheightX] + omega) + obtain ⟨x5, hx5val, hx5edge⟩ := htailEdgesZ z5 (by + dsimp [z5] + rw [hheightX] + omega) + have hx4 : x4 = (⟨2 * q - 2, by omega⟩ : Fin X.length) := by + apply Fin.ext + simpa [z4] using hx4val + have hx5 : x5 = (⟨2 * q - 1, by omega⟩ : Fin X.length) := by + apply Fin.ext + simpa [z5] using hx5val + have hx4tail : Q.height - 1 ≤ x4.val := by + rw [hheightX, hx4] + change 4 ≤ 2 * q - 2 + omega + have hx5tail : Q.height - 1 ≤ x5.val := by + rw [hheightX, hx5] + change 4 ≤ 2 * q - 1 + omega + change rho (Z.edge z4) = rho (Z.edge z5) + calc + rho (Z.edge z4) = rho (X.edge x4) := congrArg rho hx4edge + _ = psi (X.edge x4) := htailColorR x4 hx4tail + _ = psi (X.edge x5) := by + rw [hx4, hx5] + exact hbalX.2 q hlow' hupp' + _ = rho (X.edge x5) := (htailColorR x5 hx5tail).symm + _ = rho (Z.edge z5) := congrArg rho hx5edge.symm + +private theorem helper_hmissingR_2038.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : + TreeSequence G eX) (Q : NormalGlobalMaximumTriple G k eX psi X) (_ : + BalancedGlobalMaximumTriple Q) (hheightX : Q.height = (5 : ℕ)) (d1 : Fin k) (m : Fin (5 : + ℕ)) (_ : d1 ≠ Q.alpha) (_ : d1 ≠ Q.beta), + let _ : DecidableEq V := Classical.decEq V; + let jQ : Fin Q.height := (⟨(↑m : ℕ), @Eq.mpr (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat + (nat_lit 5) (instOfNatNat (nat_lit 5))) m) (@NormalGlobalMaximumTriple.height V E inst + inst_1 inst_2 G k eX psi X Q)) (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit + 5) (instOfNatNat (nat_lit 5))) m) (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit + 5)))) (@id (@Eq Prop (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit 5) + (instOfNatNat (nat_lit 5))) m) (@NormalGlobalMaximumTriple.height V E inst inst_1 inst_2 G + k eX psi X Q)) (@LT.lt Nat instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat + (nat_lit 5))) m) (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))))) (@congrArg + Nat Prop (@NormalGlobalMaximumTriple.height V E inst inst_1 inst_2 G k eX psi X Q) + (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))) (fun (_a : Nat) ↦ @LT.lt Nat + instLTNat (@Fin.val (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))) m) _a) + hheightX)) (@Fin.isLt (@OfNat.ofNat Nat (nat_lit 5) (instOfNatNat (nat_lit 5))) m)⟩ : Fin + Q.height); + ∀ (_ : (1 : ℕ) ≤ (↑jQ : ℕ)) (rho : PartialEdgeColoring E k) (_ _ : Fin k) (_ : + IsOneEdgeUncolored rho (NormalCycleEdge Q jQ)) (_ : ( + ∀ (i : Fin (↑jQ : ℕ)), rho (NormalCycleEdge Q (Fin.castLE ( + by omega + ) i)) = psi (NormalCycleEdge Q (⟨(↑i : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin Q.height)))) (_ : ( + ∀ (f : E) (_ : ( + ∀ (i : Fin ((↑jQ : ℕ) + (1 : ℕ))), f ≠ NormalCycleEdge Q (Fin.castLE ( + by omega + ) i))), rho f = psi f)) (Z : TreeSequence G (NormalCycleEdge Q jQ)) (_ : + NormalGlobalMaximumTriple G k (NormalCycleEdge Q jQ) rho Z) (_ : Fin Q.height) (_ : + Z.vertex (⟨(0 : ℕ), Nat.zero_lt_succ Z.length⟩ : Fin (Z.length + (1 : ℕ))) = X.vertex + (Fin.castLE Q.height_upper jQ)) (_ : d1 ∈ MissingColors G psi (X.vertex (Fin.castLE + Q.height_upper jQ))), d1 ∈ MissingColors G rho (Z.vertex (⟨(0 : ℕ), Nat.zero_lt_succ + Z.length⟩ : Fin (Z.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k eX psi X Q hbalX hheightX d1 m hd1alpha hd1beta this jQ hjQ rho A B honeR + hshiftR hfixedR Z R predR hnewZero holdMissing + rw [hnewZero, MissingColors, Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + obtain ⟨f, hfinc, hfcolor⟩ := hpresent + by_cases haffected : ∃ i : Fin (jQ.val + 1), + f = NormalCycleEdge Q + (Fin.castLE (Nat.succ_le_iff.mpr jQ.isLt) i) + · obtain ⟨i, rfl⟩ := haffected + by_cases hilast : i.val = jQ.val + · have hieq : Fin.castLE (Nat.succ_le_iff.mpr jQ.isLt) i = + jQ := by + apply Fin.ext + simpa using hilast + have hu := honeR.1 + rw [hieq] at hfcolor + rw [hfcolor] at hu + simp at hu + · let t : Fin jQ.val := ⟨i.val, by omega⟩ + have hcast : Fin.castLE (Nat.le_of_lt jQ.isLt) t = + Fin.castLE (Nat.succ_le_iff.mpr jQ.isLt) i := by + apply Fin.ext + rfl + have hs := hshiftR t + rw [hcast, hfcolor] at hs + have hcycleColor := + (ScheideTrunkRotationCycle G k eX psi X Q hbalX).2.2.2.2 + (⟨t.val + 1, by omega⟩ : Fin Q.height) + (Nat.succ_le_succ (Nat.zero_le _)) + by_cases ho : Odd (t.val + 1) + · rw [ite_eq_left ho] at hcycleColor + exact hd1alpha (Option.some.inj (hs.trans hcycleColor)) + · rw [ite_eq_right ho] at hcycleColor + exact hd1beta (Option.some.inj (hs.trans hcycleColor)) + · have hfix := hfixedR f (by + intro i hi + exact haffected ⟨i, hi⟩) + have holdColor : psi f = some d1 := hfix.symm.trans hfcolor + have hnotPresent : d1 ∉ PresentColors G psi + (X.vertex (Fin.castLE Q.height_upper jQ)) := by + simpa [MissingColors] using holdMissing + exact hnotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hfinc, holdColor⟩) + +private theorem helper_continuation_2335.{u_1, u_2} : + helperContinuation2335Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k eX psi X Q hlenX hheightX d1 m hd1alpha hd1beta lastA lastB hlastAcolor + hlastBcolor Y C hcross localizeZero jQ rho A B hA hB Z hlengthZ htrunkVerticesZ R halphaR + hbetaR predR hbalR hlengthR hheightR5 hmissingR htailVertexR htailEdgeR hcolorsR + hlastAFixed hlastBFixed hlastAREnds hlastBREnds htrunkPreimage + have hcrossR : ∃ r : Fin 2, ∃ q : Fin 5, + G.ends (Z.edge ⟨6 + r.val, by omega⟩) = + s(Z.vertex ⟨q.val, by omega⟩, + Z.vertex ⟨7 + r.val, by omega⟩) := by + obtain ⟨r, q, hc⟩ := hcross + obtain ⟨qR, hqR⟩ := htrunkPreimage q + refine ⟨r, qR, ?_⟩ + have hc' : G.ends (X.edge ⟨6 + r.val, by omega⟩) = + s(X.vertex ⟨q.val, by omega⟩, + X.vertex ⟨7 + r.val, by omega⟩) := by + simpa [C, Y] using hc + calc + G.ends (Z.edge ⟨6 + r.val, by omega⟩) = + G.ends (X.edge ⟨6 + r.val, by omega⟩) := + congrArg G.ends (htailEdgeR r) + _ = s(X.vertex ⟨q.val, by omega⟩, + X.vertex ⟨7 + r.val, by omega⟩) := hc' + _ = s(Z.vertex ⟨qR.val, by omega⟩, + Z.vertex ⟨7 + r.val, by omega⟩) := by + rw [hqR, htailVertexR ⟨7 + r.val, by omega⟩ (by + change 5 ≤ 7 + r.val + omega)] + have hlocalized : ∀ r : Fin 2, ∃ q : Fin 5, + G.ends (Z.edge ⟨6 + r.val, by omega⟩) = + s(Z.vertex ⟨q.val, by omega⟩, + Z.vertex ⟨7 + r.val, by omega⟩) := by + by_cases ho : Odd jQ.val + · have hAe : A = Q.beta := by simpa [ho] using hA + have hBe : B = Q.alpha := by simpa [ho] using hB + have hdA : d1 ≠ R.alpha := by + rw [halphaR, hAe] + exact hd1beta + have hdB : d1 ≠ R.beta := by + rw [hbetaR, hBe] + exact hd1alpha + exact localizeZero rho Z R hbalR hlengthR hheightR5 d1 + hmissingR hdA hdB lastB lastA hlastBREnds + (by rw [halphaR, hAe]; exact hlastBFixed.trans hlastBcolor) + hlastAREnds + (by rw [hbetaR, hBe]; exact hlastAFixed.trans hlastAcolor) + hcolorsR hcrossR + · have hAe : A = Q.alpha := by simpa [ho] using hA + have hBe : B = Q.beta := by simpa [ho] using hB + have hdA : d1 ≠ R.alpha := by + rw [halphaR, hAe] + exact hd1alpha + have hdB : d1 ≠ R.beta := by + rw [hbetaR, hBe] + exact hd1beta + exact localizeZero rho Z R hbalR hlengthR hheightR5 d1 + hmissingR hdA hdB lastA lastB hlastAREnds + (by rw [halphaR, hAe]; exact hlastAFixed.trans hlastAcolor) + hlastBREnds + (by rw [hbetaR, hBe]; exact hlastBFixed.trans hlastBcolor) + hcolorsR hcrossR + intro r + obtain ⟨q, hq⟩ := hlocalized r + obtain ⟨i, hi, hvertex⟩ := htrunkVerticesZ + (⟨q.val, by omega⟩ : Fin (Z.length + 1)) (by + rw [hheightX] + exact q.isLt) + let i5 : Fin 5 := ⟨i.val, by + rw [← hheightX] + exact i.isLt⟩ + refine ⟨i5, ?_⟩ + calc + G.ends (X.edge ⟨6 + r.val, by omega⟩) = + G.ends (Z.edge ⟨6 + r.val, by omega⟩) := + congrArg G.ends (htailEdgeR r).symm + _ = s(Z.vertex ⟨q.val, by omega⟩, + Z.vertex ⟨7 + r.val, by omega⟩) := hq + _ = s(X.vertex ⟨i5.val, by omega⟩, + X.vertex ⟨7 + r.val, by omega⟩) := by + rw [hvertex, htailVertexR ⟨7 + r.val, by omega⟩ (by + change 5 ≤ 7 + r.val + omega)] + rfl + +private theorem helper_branch_1342.{u_1, u_2} : + helperBranch1342Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k eX psi X Q hbalX hlenX hheightX d1 m hd1missing hd1alpha hd1beta lastA + lastB hlastAends hlastAcolor hlastBends hlastBcolor hsecondColor + let this : DecidableEq V := + Classical.decEq V + intro Y C hcross localizeZero hmzero + let jQ : Fin Q.height := ⟨m.val, by + rw [hheightX] + exact m.isLt⟩ + have hjQ : 1 ≤ jQ.val := by + simp [jQ] + omega + obtain ⟨rho, A, B, hAB, hA, hB, hproperR, honeR, hmissA, + hmissB, hshiftR, hfixedR, htailColorR⟩ := + ScheideTrunkRotationColoring G k eX psi X Q hbalX jQ hjQ + obtain ⟨Z, hglobalZ, hlengthZ, hverticesZ, htrunkVerticesZ, + htailVerticesZ, htrunkEdgesZ, htailEdgesZ⟩ := + ScheideTrunkRotationTree G k eX psi rho X Q hbalX jQ hjQ A B + hAB hA hB hproperR honeR hmissA hmissB hshiftR hfixedR + obtain ⟨R, hheightR, halphaR, hbetaR, predR, hpredR, + hclosingR⟩ := + ScheideTrunkRotationNormal G k eX psi rho X Q hbalX jQ hjQ A B + hAB hA hB hshiftR hfixedR Z hglobalZ hmissA hmissB hlengthZ + htrunkVerticesZ htrunkEdgesZ + have hbalR := @helper_hbalR_1973 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@eX) (@psi) (@X) (@Q) (@hbalX) (@hlenX) (@hheightX) (@m) (@rho) (@A) (@B) (@htailColorR) (@Z) + (@hlengthZ) (@htailEdgesZ) (@R) (@hheightR) (@predR) + have hlengthR : Z.length = 8 := hlengthZ.trans hlenX + have hheightR5 : R.height = 5 := hheightR.trans hheightX + have hnewZero : Z.vertex ⟨0, Nat.zero_lt_succ Z.length⟩ = + X.vertex (Fin.castLE Q.height_upper jQ) := by + obtain ⟨i, hi, hv⟩ := htrunkVerticesZ + (⟨0, Nat.zero_lt_succ Z.length⟩ : Fin (Z.length + 1)) + (by simp [hheightX]) + have hij : i = jQ := by + apply Fin.ext + simpa [jQ, Nat.mod_eq_of_lt jQ.isLt] using hi + simpa [hij] using hv + have holdMissing : d1 ∈ MissingColors G psi + (X.vertex (Fin.castLE Q.height_upper jQ)) := by + have hidx : (⟨m.val, by omega⟩ : Fin (X.length + 1)) = + Fin.castLE Q.height_upper jQ := by + apply Fin.ext + rfl + simpa [hidx] using hd1missing + have hmissingR := @helper_hmissingR_2038 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@eX) (@psi) (@X) (@Q) (@hbalX) (@hheightX) (@d1) (@m) (@hd1alpha) (@hd1beta) (@hjQ) + (@rho) (@A) (@B) (@honeR) (@hshiftR) (@hfixedR) (@Z) (@R) (@predR) (@hnewZero) (@holdMissing) + have htailVertexR (r : Fin 9) (hr : 5 ≤ r.val) : + Z.vertex ⟨r.val, by omega⟩ = X.vertex ⟨r.val, by omega⟩ := by + obtain ⟨s, hsval, hsv⟩ := htailVerticesZ + (⟨r.val, by omega⟩ : Fin (Z.length + 1)) (by + rw [hheightX] + exact hr) + have hs : s = (⟨r.val, by omega⟩ : Fin (X.length + 1)) := by + apply Fin.ext + simpa using hsval + simpa [hs] using hsv + have htailEdgeR (r : Fin 2) : + Z.edge ⟨6 + r.val, by omega⟩ = + X.edge ⟨6 + r.val, by omega⟩ := by + obtain ⟨s, hsval, hse⟩ := htailEdgesZ + (⟨6 + r.val, by omega⟩ : Fin Z.length) (by + rw [hheightX] + change 4 ≤ 6 + r.val + omega) + have hs : s = (⟨6 + r.val, by omega⟩ : Fin X.length) := by + apply Fin.ext + simpa using hsval + simpa [hs] using hse + have hcolorsR : ∀ r : Fin 2, + rho (Z.edge ⟨6 + r.val, by omega⟩) = some d1 := by + intro r + calc + rho (Z.edge ⟨6 + r.val, by omega⟩) = + rho (X.edge ⟨6 + r.val, by omega⟩) := + congrArg rho (htailEdgeR r) + _ = psi (X.edge ⟨6 + r.val, by omega⟩) := + htailColorR (⟨6 + r.val, by omega⟩ : Fin X.length) (by + rw [hheightX] + change 4 ≤ 6 + r.val + omega) + _ = some d1 := hsecondColor r + have hz7 : Z.vertex ⟨7, by omega⟩ = X.vertex ⟨7, by omega⟩ := + htailVertexR 7 (by norm_num) + have hz8 : Z.vertex ⟨8, by omega⟩ = X.vertex ⟨8, by omega⟩ := + htailVertexR 8 (by norm_num) + have htrunkNeTail (i : Fin Q.height) (r : Fin 9) + (hr : 5 ≤ r.val) : + X.vertex (Fin.castLE Q.height_upper i) ≠ + X.vertex ⟨r.val, by omega⟩ := by + intro hv + have hi := X.vertex_injective hv + have hiv := congrArg (fun q : Fin (X.length + 1) => q.val) hi + have hilt : i.val < 5 := by simpa [hheightX] using i.isLt + have heq : i.val = r.val := by simpa using hiv + omega + have hcycleEndsR := + (ScheideTrunkRotationCycle G k eX psi X Q hbalX).2.2.2.1 + have lastFixed (f : E) + (hfends : G.ends f = + s(X.vertex ⟨7, by omega⟩, X.vertex ⟨8, by omega⟩)) : + rho f = psi f := by + apply hfixedR f + intro i hfi + let ci : Fin Q.height := + Fin.castLE (Nat.succ_le_iff.mpr jQ.isLt) i + let ni : Fin Q.height := + ⟨(ci.val + 1) % Q.height, Nat.mod_lt _ (by omega)⟩ + have hpairs : + s(X.vertex ⟨7, by omega⟩, X.vertex ⟨8, by omega⟩) = + s(X.vertex (Fin.castLE Q.height_upper ci), + X.vertex (Fin.castLE Q.height_upper ni)) := by + calc + s(X.vertex ⟨7, by omega⟩, X.vertex ⟨8, by omega⟩) = + G.ends f := hfends.symm + _ = G.ends (NormalCycleEdge Q ci) := congrArg G.ends hfi + _ = s(X.vertex (Fin.castLE Q.height_upper ci), + X.vertex (Fin.castLE Q.height_upper ni)) := by + simpa [ci, ni] using hcycleEndsR ci + rcases Sym2.eq_iff.mp hpairs with hp | hp + · exact (htrunkNeTail ci 7 (by norm_num)) hp.1.symm + · exact (htrunkNeTail ni 7 (by norm_num)) hp.1.symm + have hlastAFixed : rho lastA = psi lastA := + lastFixed lastA hlastAends + have hlastBFixed : rho lastB = psi lastB := + lastFixed lastB hlastBends + have hlastAREnds : G.ends lastA = + s(Z.vertex ⟨7, by omega⟩, Z.vertex ⟨8, by omega⟩) := by + simpa [hz7, hz8] using hlastAends + have hlastBREnds : G.ends lastB = + s(Z.vertex ⟨7, by omega⟩, Z.vertex ⟨8, by omega⟩) := by + simpa [hz7, hz8] using hlastBends + have htrunkPreimage (q : Fin 5) : ∃ r : Fin 5, + Z.vertex ⟨r.val, by omega⟩ = X.vertex ⟨q.val, by omega⟩ := by + let qQ : Fin Q.height := ⟨q.val, by + rw [hheightX] + exact q.isLt⟩ + let r : Fin 5 := + ⟨(q.val + 5 - m.val) % 5, Nat.mod_lt _ (by norm_num)⟩ + obtain ⟨i, hi, hv⟩ := htrunkVerticesZ + (⟨r.val, by omega⟩ : Fin (Z.length + 1)) (by + rw [hheightX] + exact r.isLt) + have hiq : i = qQ := by + apply Fin.ext + rw [hi] + change (jQ.val + r.val) % Q.height = qQ.val + simpa [jQ, r, qQ, hheightX] using + (show (m.val + ((q.val + 5 - m.val) % 5)) % 5 = q.val by + omega) + refine ⟨r, ?_⟩ + simpa [hiq, qQ] using hv + exact @helper_continuation_2335 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@eX) (@psi) (@X) (@Q) (@hlenX) (@hheightX) (@d1) (@m) (@hd1alpha) (@hd1beta) (@lastA) + (@lastB) (@hlastAcolor) (@hlastBcolor) (@hcross) (@localizeZero) (@rho) (@A) (@B) (@hA) + (@hB) (@Z) (@hlengthZ) (@htrunkVerticesZ) (@R) (@halphaR) (@hbetaR) (@predR) (@hbalR) + (@hlengthR) (@hheightR5) (@hmissingR) (@htailVertexR) (@htailEdgeR) (@hcolorsR) + (@hlastAFixed) (@hlastBFixed) (@hlastAREnds) (@hlastBREnds) (@htrunkPreimage) +private theorem helper_hsecondAttach_1155.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {eX : E} (psi : PartialEdgeColoring E k) (X : TreeSequence + G eX) (Q : NormalGlobalMaximumTriple G k eX psi X) (_ : BalancedGlobalMaximumTriple Q) + (hlenX : X.length = (8 : ℕ)) (_ : Q.height = (5 : ℕ)) (d1 : Fin k) (m : Fin (5 : ℕ)) (_ : + d1 ∈ MissingColors G psi (X.vertex (⟨(↑m : ℕ), + by omega + ⟩ : Fin (X.length + (1 : ℕ))))) (_ : d1 ≠ Q.alpha) (_ : d1 ≠ Q.beta) (lastA lastB : E) (_ : + G.ends lastA = s(X.vertex (⟨(7 : ℕ), + by omega + ⟩ : Fin (X.length + (1 : ℕ))), X.vertex (⟨(8 : ℕ), + by omega + ⟩ : Fin (X.length + (1 : ℕ))))) (_ : psi lastA = some Q.alpha) (_ : G.ends lastB = s(X.vertex + (⟨(7 : ℕ), + by omega + ⟩ : Fin (X.length + (1 : ℕ))), X.vertex (⟨(8 : ℕ), + by omega + ⟩ : Fin (X.length + (1 : ℕ))))) (_ : psi lastB = some Q.beta) (_ : ( + ∀ (j : Fin (2 : ℕ)), psi (X.edge (⟨(6 : ℕ) + (↑j : ℕ), + by omega + ⟩ : Fin X.length)) = some d1)), + let _ : DecidableEq V := Classical.decEq V; + let Y : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ X.vertex (⟨(↑i : ℕ), + Decidable.byContradiction fun (a : ¬(↑i : ℕ) < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ))); + let C : Fin (2 : ℕ) → E := fun (j : Fin (2 : ℕ)) ↦ X.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < X.length) ↦ + by omega + ⟩ : Fin X.length); + ∀ (_ : ( + ∃ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), G.ends (C j) = s(Y (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < (9 : ℕ)) ↦ + by omega + ⟩ : Fin (9 : ℕ)), Y (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) + (↑j : + ℕ) < (9 : ℕ)) ↦ + by + omega + ⟩ : Fin (9 : ℕ))))) (_ : ( + ∀ {eZ : E} (rho : PartialEdgeColoring E k) (Z : TreeSequence G eZ) (RZ : + NormalGlobalMaximumTriple G k eZ rho Z) (_ : BalancedGlobalMaximumTriple RZ) (hlenZ : + Z.length = (8 : ℕ)) (_ : RZ.height = (5 : ℕ)), + ∀ d ∈ MissingColors G rho (Z.vertex (⟨(0 : ℕ), Decidable.byContradiction fun (a : ¬(0 : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ)))), d ≠ RZ.alpha → d ≠ RZ.beta → + ∀ (lastAZ lastBZ : E), G.ends lastAZ = s(Z.vertex (⟨(7 : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(8 : ℕ), Decidable.byContradiction fun (a : ¬(8 : ℕ) + < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → rho lastAZ = some RZ.alpha → G.ends lastBZ = s(Z.vertex (⟨(7 + : ℕ), Decidable.byContradiction fun (a : ¬(7 : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(8 : ℕ), Decidable.byContradiction fun (a : ¬(8 : ℕ) + < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))) → rho lastBZ = some RZ.beta → ( + ∀ (j : Fin (2 : ℕ)), rho (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : ¬(6 + : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = some d) → ( + ∃ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), + Decidable.byContradiction fun (a : ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) + (↑j : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ))))) → + ∀ (j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (Z.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : + ¬(6 : ℕ) + (↑j : ℕ) < Z.length) ↦ + by + omega + ⟩ : Fin Z.length)) = s(Z.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + Z.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (Z.length + (1 : ℕ))), Z.vertex (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) + (↑j : ℕ) < Z.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (Z.length + (1 : ℕ)))))) (j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (X.edge (⟨(6 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a : + ¬(6 : ℕ) + (↑j : ℕ) < X.length) ↦ + by + omega + ⟩ : Fin X.length)) = s(X.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + X.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (X.length + (1 : ℕ))), X.vertex (⟨(7 : ℕ) + (↑j : ℕ), Decidable.byContradiction fun (a + : ¬(7 : ℕ) + (↑j : ℕ) < X.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (X.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k eX psi X Q hbalX hlenX hheightX d1 m hd1missing hd1alpha hd1beta lastA + lastB hlastAends hlastAcolor hlastBends hlastBcolor hsecondColor this Y C hcross localizeZero + by_cases hmzero : m.val = 0 + · have hm : m = 0 := Fin.ext hmzero + exact localizeZero psi X Q hbalX hlenX hheightX d1 + (by simpa [hm] using hd1missing) hd1alpha hd1beta lastA lastB + hlastAends hlastAcolor hlastBends hlastBcolor hsecondColor + (by simpa [C, Y] using hcross) + · exact @helper_branch_1342 V E inferInstance inferInstance inferInstance G k eX psi X Q hbalX + hlenX hheightX d1 m hd1missing hd1alpha hd1beta lastA lastB hlastAends hlastAcolor + hlastBends hlastBcolor hsecondColor hcross localizeZero hmzero +theorem P2968_T2_ScheideOrderNineBlockCompletion {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) {eX : E} + (psi : PartialEdgeColoring E k) (X : TreeSequence G eX) + (Q : NormalGlobalMaximumTriple G k eX psi X) + (hbalX : BalancedGlobalMaximumTriple Q) + (hgraphHeight : ScheideGraphHeight G = 5) + (hlenX : X.length = 8) (hheightX : Q.height = 5) + (d0 d1 : Fin k) + (hd0missing : d0 ∈ MissingColors G psi + (X.vertex ⟨0, by omega⟩)) + (m : Fin 5) (hd1missing : d1 ∈ MissingColors G psi + (X.vertex ⟨m.val, by omega⟩)) + (hd0alpha : d0 ≠ Q.alpha) (hd0beta : d0 ≠ Q.beta) + (hd1alpha : d1 ≠ Q.alpha) (hd1beta : d1 ≠ Q.beta) + (hd10 : d1 ≠ d0) + (x1 x2 linkB last0 lastA lastB : E) (z1 z2 : V) + (hx1ends : G.ends x1 = s(X.vertex ⟨1, by omega⟩, z1)) + (hx2ends : G.ends x2 = s(X.vertex ⟨4, by omega⟩, z2)) + (hx1color : psi x1 = some d0) (hx2color : psi x2 = some d0) + (hlinkBends : G.ends linkB = s(z1, z2)) + (hlinkBcolor : psi linkB = some Q.beta) + (hlast0ends : G.ends last0 = + s(X.vertex ⟨7, by omega⟩, X.vertex ⟨8, by omega⟩)) + (hlast0color : psi last0 = some d0) + (hlastAends : G.ends lastA = + s(X.vertex ⟨7, by omega⟩, X.vertex ⟨8, by omega⟩)) + (hlastAcolor : psi lastA = some Q.alpha) + (hlastBends : G.ends lastB = + s(X.vertex ⟨7, by omega⟩, X.vertex ⟨8, by omega⟩)) + (hlastBcolor : psi lastB = some Q.beta) + (hfirstOrient : + (X.edge ⟨4, by omega⟩ = x1 ∧ X.vertex ⟨5, by omega⟩ = z1 ∧ + X.edge ⟨5, by omega⟩ = x2 ∧ X.vertex ⟨6, by omega⟩ = z2) ∨ + (X.edge ⟨4, by omega⟩ = x2 ∧ X.vertex ⟨5, by omega⟩ = z2 ∧ + X.edge ⟨5, by omega⟩ = x1 ∧ X.vertex ⟨6, by omega⟩ = z1)) + (hsecondColor : ∀ j : Fin 2, + psi (X.edge ⟨6 + j.val, by omega⟩) = some d1) : + ∃ (_ : BalancedGlobalMaximumTriple Q) (_ : X.length = 8) + (_ : Q.height = 5) (gamma : Fin 2 → Fin k), + Function.Injective gamma ∧ + (∀ (i : Fin 2) (j : Fin 2), + ∃ q : Fin 5, + G.ends (X.edge ⟨4 + 2 * i.val + j.val, by omega⟩) = + s(X.vertex ⟨q.val, by omega⟩, + X.vertex ⟨5 + 2 * i.val + j.val, by omega⟩)) ∧ + (∀ (i : Fin 2) (j : Fin 2), + psi (X.edge ⟨4 + 2 * i.val + j.val, by omega⟩) = + some (gamma i)) ∧ + (∀ i : Fin 2, ∃ q : Fin 5, + gamma i ∈ MissingColors G psi (X.vertex ⟨q.val, by omega⟩)) ∧ + (∀ i : Fin 4, 1 ≤ i.val → + ∀ c : Fin k, psi (X.edge ⟨i.val, by omega⟩) = some c → + ∀ r : Fin 2, c ≠ gamma r) := by + classical + let : DecidableEq V := Classical.decEq V + let Y (i : Fin 9) : V := X.vertex ⟨i.val, by omega⟩ + let C (j : Fin 2) : E := X.edge ⟨6 + j.val, by omega⟩ + have hYne {i j : Fin 9} (hij : i ≠ j) : Y i ≠ Y j := by + intro h + apply hij + apply Fin.ext + have heq : (⟨i.val, by omega⟩ : Fin (X.length + 1)) = + ⟨j.val, by omega⟩ := X.vertex_injective h + exact congrArg (fun r : Fin (X.length + 1) => r.val) heq + have hCne : C 0 ≠ C 1 := by + intro h + have hi := X.edge_injective h + norm_num [C] at hi + have hCcolor (j : Fin 2) : psi (C j) = some d1 := by + simpa [C] using hsecondColor j + have hlink56 : G.ends linkB = s(Y 5, Y 6) := by + rcases hfirstOrient with ho | ho + · simpa [Y, ho.2.1, ho.2.2.2] using hlinkBends + · simpa [Y, ho.2.1, ho.2.2.2, Sym2.eq_swap] using hlinkBends + have hlast0 : G.ends last0 = s(Y 7, Y 8) := by + simpa [Y] using hlast0ends + have hlastA : G.ends lastA = s(Y 7, Y 8) := by + simpa [Y] using hlastAends + have hlastB : G.ends lastB = s(Y 7, Y 8) := by + simpa [Y] using hlastBends + have hproperX : IsProperEdgeColoring G psi := Q.global.1.2.2.2.1 + have hcross := @helper_hcross_132 V E inferInstance inferInstance inferInstance G k eX psi X Q + hbalX hgraphHeight hlenX hheightX d0 d1 hd0missing hd0beta hd1alpha hd1beta hd10 x1 x2 linkB + last0 lastB z1 z2 hx1ends hx2ends hx1color hx2color hlinkBends hlinkBcolor hlast0color + hlastBcolor hfirstOrient hYne hCne hCcolor hlast0 hlastB hproperX + have localizeZero {eZ : E} (rho : PartialEdgeColoring E k) + (Z : TreeSequence G eZ) + (RZ : NormalGlobalMaximumTriple G k eZ rho Z) + (hbalZ : BalancedGlobalMaximumTriple RZ) + (hlenZ : Z.length = 8) (hheightZ : RZ.height = 5) + (d : Fin k) + (hdmissing : d ∈ MissingColors G rho + (Z.vertex ⟨0, by omega⟩)) + (hdalpha : d ≠ RZ.alpha) (hdbeta : d ≠ RZ.beta) + (lastAZ lastBZ : E) + (hlastAZends : G.ends lastAZ = + s(Z.vertex ⟨7, by omega⟩, Z.vertex ⟨8, by omega⟩)) + (hlastAZcolor : rho lastAZ = some RZ.alpha) + (hlastBZends : G.ends lastBZ = + s(Z.vertex ⟨7, by omega⟩, Z.vertex ⟨8, by omega⟩)) + (hlastBZcolor : rho lastBZ = some RZ.beta) + (hcolors : ∀ j : Fin 2, + rho (Z.edge ⟨6 + j.val, by omega⟩) = some d) + (honeCross : ∃ j : Fin 2, ∃ q : Fin 5, + G.ends (Z.edge ⟨6 + j.val, by omega⟩) = + s(Z.vertex ⟨q.val, by omega⟩, + Z.vertex ⟨7 + j.val, by omega⟩)) : + ∀ j : Fin 2, ∃ q : Fin 5, + G.ends (Z.edge ⟨6 + j.val, by omega⟩) = + s(Z.vertex ⟨q.val, by omega⟩, + Z.vertex ⟨7 + j.val, by omega⟩) := by + exact @helper_localizeZero_898 V E inferInstance inferInstance inferInstance G k eX psi X Q + hgraphHeight eZ rho Z RZ hlenZ hheightZ d hdmissing lastAZ hlastAZends hlastAZcolor + hcolors honeCross + have hsecondAttach := @helper_hsecondAttach_1155 V E inferInstance inferInstance inferInstance G k + eX psi X Q hbalX hlenX hheightX d1 m hd1missing hd1alpha hd1beta lastA lastB hlastAends + hlastAcolor hlastBends hlastBcolor hsecondColor hcross localizeZero + have hfirstAttach : ∀ j : Fin 2, ∃ q : Fin 5, + G.ends (X.edge ⟨4 + j.val, by omega⟩) = + s(X.vertex ⟨q.val, by omega⟩, + X.vertex ⟨5 + j.val, by omega⟩) := by + intro j + rcases hfirstOrient with ho | ho + · fin_cases j + · refine ⟨1, ?_⟩ + change G.ends (X.edge ⟨4, by omega⟩) = + s(X.vertex ⟨1, by omega⟩, X.vertex ⟨5, by omega⟩) + rw [ho.1] + simpa [ho.2.1] using hx1ends + · refine ⟨4, ?_⟩ + change G.ends (X.edge ⟨5, by omega⟩) = + s(X.vertex ⟨4, by omega⟩, X.vertex ⟨6, by omega⟩) + rw [ho.2.2.1] + simpa [ho.2.2.2] using hx2ends + · fin_cases j + · refine ⟨4, ?_⟩ + change G.ends (X.edge ⟨4, by omega⟩) = + s(X.vertex ⟨4, by omega⟩, X.vertex ⟨5, by omega⟩) + rw [ho.1] + simpa [ho.2.1] using hx2ends + · refine ⟨1, ?_⟩ + change G.ends (X.edge ⟨5, by omega⟩) = + s(X.vertex ⟨1, by omega⟩, X.vertex ⟨6, by omega⟩) + rw [ho.2.2.1] + simpa [ho.2.2.2] using hx1ends + have hfirstColor : ∀ j : Fin 2, + psi (X.edge ⟨4 + j.val, by omega⟩) = some d0 := by + intro j + rcases hfirstOrient with ho | ho + · fin_cases j + · simpa [ho.1] using hx1color + · simpa [ho.2.2.1] using hx2color + · fin_cases j + · simpa [ho.1] using hx2color + · simpa [ho.2.2.1] using hx1color + obtain ⟨_, _, _, hcycleEnds, hcycleColors⟩ := + ScheideTrunkRotationCycle G k eX psi X Q hbalX + have hbaseAlpha1 : psi (X.edge ⟨1, by omega⟩) = some Q.alpha := by + simpa [NormalCycleEdge, hheightX] using hcycleColors + (⟨1, by omega⟩ : Fin Q.height) (by norm_num) + have hbaseBeta2 : psi (X.edge ⟨2, by omega⟩) = some Q.beta := by + have hc := hcycleColors + (⟨2, by omega⟩ : Fin Q.height) (by norm_num) + have heven : ¬ Odd 2 := by + intro ho + obtain ⟨x, hx⟩ := ho + omega + rw [ite_eq_right heven] at hc + simpa [NormalCycleEdge, hheightX] using hc + have hbaseAlpha3 : psi (X.edge ⟨3, by omega⟩) = some Q.alpha := by + have hc := hcycleColors + (⟨3, by omega⟩ : Fin Q.height) (by norm_num) + have hodd : Odd 3 := ⟨1, by norm_num⟩ + rw [ite_eq_left hodd] at hc + simpa [NormalCycleEdge, hheightX] using hc + let gamma : Fin 2 → Fin k := fun i => if i = 0 then d0 else d1 + refine ⟨hbalX, hlenX, hheightX, gamma, ?_, ?_, ?_, ?_, ?_⟩ + · intro a b hab + fin_cases a <;> fin_cases b + · rfl + · simp [gamma] at hab + exact False.elim (hd10 hab.symm) + · simp only [Fin.isValue, Fin.mk_one, one_ne_zero, ↓reduceIte, Fin.zero_eta, gamma] at hab + exact False.elim (hd10 hab) + · rfl + · intro i j + fin_cases i + · simpa using hfirstAttach j + · simpa using hsecondAttach j + · intro i j + fin_cases i + · simpa [gamma] using hfirstColor j + · simpa [gamma] using hsecondColor j + · intro i + fin_cases i + · exact ⟨0, by simpa [gamma] using hd0missing⟩ + · exact ⟨m, by simpa [gamma] using hd1missing⟩ + · intro i hi c hc r + fin_cases i + · norm_num at hi + · have hc' : c = Q.alpha := by + exact Option.some.inj (hc.symm.trans hbaseAlpha1) + fin_cases r + · simpa [gamma, hc'] using hd0alpha.symm + · simpa [gamma, hc'] using hd1alpha.symm + · have hc' : c = Q.beta := by + exact Option.some.inj (hc.symm.trans hbaseBeta2) + fin_cases r + · simpa [gamma, hc'] using hd0beta.symm + · simpa [gamma, hc'] using hd1beta.symm + · have hc' : c = Q.alpha := by + exact Option.some.inj (hc.symm.trans hbaseAlpha3) + fin_cases r + · simpa [gamma, hc'] using hd0alpha.symm + · simpa [gamma, hc'] using hd1alpha.symm + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean new file mode 100644 index 0000000000..1f1eeac51c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean @@ -0,0 +1,2999 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideOrderNineRebasingPreparation + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideOrderNineBlockCompletion +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideHeightFiveGammaEdges +public import LeanPool.GoldbergSeymour.ScheideHeightFiveOutsideLinks +public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationNormal +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationPreserves +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TrunkRotation +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import Mathlib.Tactic.FinCases + +/-! +# Scheide Order Nine Block Structure + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open ScheideRebasing + +private abbrev scheideBlockContinuationStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (_ : NormalGlobalMaximumTriple G k e0 phi T), + ScheideGraphHeight G = (5 : ℕ) → + let Good : + {e : E} → + (psi : PartialEdgeColoring E k) → + (S : TreeSequence G e) → + NormalGlobalMaximumTriple G k e psi S → + Prop := + fun {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S) ↦ + ∃ (_ : BalancedGlobalMaximumTriple M) (x : S.length = (8 : ℕ)) (_ : M.height = (5 : ℕ)) (gamma + : + Fin (2 : ℕ) → + Fin k), + Function.Injective gamma ∧ + ( + ∀ (i j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), + G.ends + (S.edge + (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt i + have := Fin.isLt j + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + s(S.vertex + (⟨(↑q : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt q + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))), + S.vertex + (⟨(5 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt i + have := Fin.isLt j + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))))) ∧ + ( + ∀ (i j : Fin (2 : ℕ)), + psi + (S.edge + (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt i + have := Fin.isLt j + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + some (gamma i)) ∧ + ( + ∀ (i : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), + gamma i ∈ + MissingColors G psi + (S.vertex + (⟨(↑q : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt q + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))))) ∧ + ∀ (i : Fin (4 : ℕ)), + (1 : ℕ) ≤ (↑i : ℕ) → + ∀ (c : Fin k), + psi + (S.edge + (⟨(↑i : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt i + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + some c → + ∀ (r : Fin (2 : ℕ)), + c ≠ gamma r; + ∀ {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S), + BalancedGlobalMaximumTriple M → + ∀ (hlen : S.length = (8 : ℕ)), + M.height = (5 : ℕ) → + ∀ (g0 : Fin k), + TashkinovOrder G = (TreeSequenceVertexSet S).card ∧ + (3 : ℕ) ≤ (TreeSequenceVertexSet S).card ∧ + Odd (TreeSequenceVertexSet S).card ∧ + ColoredVertexSetElementary G psi (TreeSequenceVertexSet S) ∧ + ColoredVertexSetClosed G psi (TreeSequenceVertexSet S) → + let y0 : V := + S.vertex + (⟨(0 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y1 : V := + S.vertex + (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y2 : V := + S.vertex + (⟨(2 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y3 : V := + S.vertex + (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y4 : V := + S.vertex + (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y5 : V := + S.vertex + (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y6 : V := + S.vertex + (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y7 : V := + S.vertex + (⟨(7 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y8 : V := + S.vertex + (⟨(8 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))); + let a1 : E := + S.edge + (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length); + let a2 : E := + S.edge + (⟨(2 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length); + let a3 : E := + S.edge + (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length); + let b0 : E := + S.edge + (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length); + let b1 : E := + S.edge + (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length); + let c0 : E := + S.edge + (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length); + let c1 : E := + S.edge + (⟨(7 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length); + g0 ∈ MissingColors G psi y0 → + ∀ + (_ : + Fin + ((↑(⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (_ : + Fin + ((↑(⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (f1 f2 : E) (v1 v2 : V), + psi f1 = some g0 → + psi f2 = some g0 → + v1 ≠ + S.vertex + (⟨(0 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))) → + v1 ≠ + S.vertex + (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))) → + G.ends f1 = s(y1, v1) → + G.ends f2 = s(y4, v2) → + b0 ≠ b1 → + b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1 → + ∀ (beta56 : E), + G.ends beta56 = s(v1, v2) → + psi beta56 = some M.beta → + G.ends a1 = s(y1, y2) → + G.ends a2 = s(y2, y3) → + G.ends a3 = s(y3, y4) → + G.ends M.closingEdge = s(y4, y0) → + psi a1 = some M.alpha → + psi a2 = some M.beta → + psi a3 = some M.alpha → + psi M.closingEdge = some M.beta → + M.alpha ≠ M.beta → + g0 ≠ M.alpha → + g0 ≠ M.beta → + let r6' : Fin S.length := + (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction fun (a : ¬(6 : ℕ) < S.length) ↦ by + omega⟩ : + Fin S.length); + let _ : Fin S.length := + (⟨(7 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction fun (a : ¬(7 : ℕ) < S.length) ↦ by + omega⟩ : + Fin S.length); + ∀ (w : Fin ((↑r6' : ℕ) + (1 : ℕ))) (g1 : Fin k), + psi c1 = some g1 → + psi c0 = some g1 → + g1 ∈ + MissingColors G psi + (S.vertex + (⟨(↑w : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑r6' : ℕ) < S.length := r6'.isLt; + have this_1 : (↑w : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt r6' + have := Fin.isLt w + have := GoldbergSeymour.TreeSequence.positive S + omega; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction + fun (a : ¬(↑w : ℕ) < S.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (S.length + (1 : ℕ)))) → + ∀ (pc : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let pc' : Fin (7 : ℕ) := + (⟨(↑pc : ℕ), + have this : (↑pc : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt r6' + have := Fin.isLt pc + have := GoldbergSeymour.TreeSequence.positive S + omega; + this⟩ : + Fin (7 : ℕ)); + G.ends c0 = + s(y7, + S.vertex + (⟨(↑pc' : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (↑r6' : ℕ) < S.length := r6'.isLt; + have _ : (↑pc : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt r6' + have := Fin.isLt pc + have := GoldbergSeymour.TreeSequence.positive S + omega; + have this : (↑pc' : ℕ) < (7 : ℕ) := pc'.isLt; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction + fun (a : ¬(↑pc' : ℕ) < S.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (S.length + (1 : ℕ)))) → + g1 ≠ g0 → + g1 ≠ M.alpha → + g1 ≠ M.beta → + ∀ (g0last : E), + G.ends g0last = s(y7, y8) → + psi g0last = some g0 → + ∀ (alphaLast : E), + G.ends alphaLast = s(y7, y8) → + psi alphaLast = some M.alpha → + ∀ (betaLast : E), + G.ends betaLast = s(y7, y8) → + psi betaLast = some M.beta → + let a0 : E := + S.edge + (⟨(0 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive S + have := + GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length); + a0 = e → + ∀ + (_ : + Fin + ((↑(⟨(0 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S + have := + GoldbergSeymour.TreeSequence.positive + S + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))), + G.ends a0 = s(y1, y0) → + beta56 ≠ a0 → + beta56 ≠ f1 → + ∃ (e' : E) (psi' : PartialEdgeColoring E k) + (S' : TreeSequence G e') (M' : + NormalGlobalMaximumTriple G k e' psi' S'), + Good psi' S' M' + +private abbrev scheideRebasedTreeCertificateStatement.{u_1, u_2} : Prop := + open scoped Classical Sym2 in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ), + ScheideGraphHeight G = 5 → + ∀ {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S), + BalancedGlobalMaximumTriple M → + ∀ (hlen : S.length = 8), + M.height = 5 → + ∀ (g0 : Fin k), + TashkinovOrder G = (TreeSequenceVertexSet S).card ∧ + 3 ≤ (TreeSequenceVertexSet S).card ∧ + Odd (TreeSequenceVertexSet S).card ∧ + ColoredVertexSetElementary G psi (TreeSequenceVertexSet S) ∧ + ColoredVertexSetClosed G psi (TreeSequenceVertexSet S) → + ∀ (y0 : V), + ∀ (y1 : V), + ∀ (y2 : V), + ∀ (y3 : V), + ∀ (y4 : V), + ∀ (y5 : V), + ∀ (y6 : V), + ∀ (y7 : V), + ∀ (y8 : V), + ∀ (a1 : E), + ∀ (a2 : E), + ∀ (a3 : E), + ∀ (b0 : E), + ∀ (b1 : E), + ∀ (c0 : E), + ∀ (c1 : E), + g0 ∈ MissingColors G psi y0 → + ∀ + (p0 : + Fin + ((↑(⟨4, by simpa only [hlen] using (show 4 < (8 : ℕ) from by decide)⟩ : + Fin S.length) : + ℕ) + + 1)) + (p1 : + Fin + ((↑(⟨5, by simpa only [hlen] using (show 5 < (8 : ℕ) from by decide)⟩ : + Fin S.length) : + ℕ) + + 1)) + (f1 f2 : E) (v1 v2 : V), + psi f1 = some g0 → + psi f2 = some g0 → + v1 ≠ y0 → + v1 ≠ y4 → + ∀ (hf1ends' : G.ends f1 = s(y1, v1)) (hf2ends' : G.ends f2 = s(y4, v2)), + b0 ≠ b1 → + b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1 → + ∀ (beta56 : E) (hbeta56ends : G.ends beta56 = s(v1, v2)), + psi beta56 = some M.beta → + ∀ (ha1ends : G.ends a1 = s(y1, y2)), + G.ends a2 = s(y2, y3) → + ∀ (ha3ends : G.ends a3 = s(y3, y4)), + G.ends M.closingEdge = s(y4, y0) → + psi a1 = some M.alpha → + psi a2 = some M.beta → + psi a3 = some M.alpha → + psi M.closingEdge = some M.beta → + M.alpha ≠ M.beta → + g0 ≠ M.alpha → + g0 ≠ M.beta → + ∀ (r6' : Fin S.length), + ∀ (r7' : Fin S.length), + ∀ (w : Fin ((↑r6' : ℕ) + 1)) (g1 : Fin k), + psi c1 = some g1 → + psi c0 = some g1 → + g1 ∈ + MissingColors G psi + (S.vertex + (⟨(↑w : ℕ), by clear * - hlen; omega⟩ : + Fin (S.length + 1))) → + ∀ (pc : Fin ((↑r6' : ℕ) + 1)), + ∀ (pc' : Fin 7), + ∀ + (hc0ends : + G.ends c0 = + s(y7, + S.vertex + (⟨(↑pc' : ℕ), by clear * - hlen; omega⟩ : + Fin (S.length + 1)))), + g1 ≠ g0 → + g1 ≠ M.alpha → + g1 ≠ M.beta → + ∀ (g0last : E), + G.ends g0last = s(y7, y8) → + psi g0last = some g0 → + ∀ (alphaLast : E), + G.ends alphaLast = s(y7, y8) → + psi alphaLast = some M.alpha → + ∀ (betaLast : E), + G.ends betaLast = s(y7, y8) → + psi betaLast = some M.beta → + ∀ (a0 : E), + ∀ (ha0eq : a0 = e) + (pa0 : + Fin + ((↑(⟨0, by simpa only [hlen] using (show 0 < (8 : ℕ) from by decide)⟩ : + Fin S.length) : + ℕ) + + 1)) + (ha0ends : G.ends a0 = s(y1, y0)), + beta56 ≠ a0 → + beta56 ≠ f1 → + beta56 ≠ f2 → + beta56 ≠ a1 → + beta56 ≠ a3 → + beta56 ≠ c0 → + beta56 ≠ c1 → + 5 ≤ (↑w : ℕ) → + (↑w : ℕ) = 5 ∨ (↑w : ℕ) = 6 → + ∀ (cast9 : Fin 9 ≃ Fin (S.length + 1)), + ∀ (permA : Equiv.Perm (Fin 9)), + ∀ (permB : Equiv.Perm (Fin 9)), + ∀ (newVertex : + Fin 9 → + V), + ∀ (edgeList : List E), + ∀ + (hedgeListLength : + edgeList.length = 8), + ∀ (newEdge : + Fin 8 → + E), + ( + b0 = f1 → + y5 = v1 ∧ b1 = f2 ∧ y6 = v2) → + ( + b0 ≠ f1 → + y5 = v2 ∧ b1 = f1 ∧ y6 = v1) → + ( + ∀ (i : Fin 9) + (q : Fin (S.length + 1)), + (↑i : ℕ) = (↑q : ℕ) → + S.vertex + ((cast9 : + Fin 9 → + Fin (S.length + 1)) + i) = + S.vertex q) → + ∀ (nv0 : newVertex 0 = y0) + (nv1 : newVertex 1 = y1) + (nv2 : newVertex 2 = v1) + (nv3 : newVertex 3 = v2) + (nv4 : newVertex 4 = y4) + (nv5 : newVertex 5 = y2) + (nv6 : newVertex 6 = y3) + (nv7 : newVertex 7 = y7) + (nv8 : newVertex 8 = y8) + (ne0 : newEdge 0 = a0) + (ne1 : newEdge 1 = f1) + (ne2 : newEdge 2 = beta56) + (ne3 : newEdge 3 = f2) + (ne4 : newEdge 4 = a1) + (ne5 : newEdge 5 = a3) + (ne6 : newEdge 6 = c0) + (ne7 : newEdge 7 = c1), + ( + ∀ (i j : Fin (S.length + 1)), + S.vertex i = S.vertex j ↔ + i = j) → + ( + ∀ (i j : Fin S.length), + S.edge i = S.edge j ↔ i = j) → + ∀ + (newVertex_injective : + Function.Injective newVertex) + (newEdge_injective : + Function.Injective newEdge), + ( + ∀ (q : Fin 7), + ∃ (t : Fin 7), + newVertex + (Fin.castLE + (Mathlib.Meta.NormNum.isNat_le_true + (Mathlib.Meta.NormNum.isNat_ofNat + ℕ (Eq.refl 7)) + (Mathlib.Meta.NormNum.isNat_ofNat + ℕ (Eq.refl 9)) + (Eq.refl true)) + t) = + S.vertex + (⟨(↑q : ℕ), by clear * - hlen; omega⟩ : + Fin (S.length + 1))) → + ∀ (pc1 : Fin ((↑r7' : ℕ) + 1)), + G.ends (S.edge r7') = + s(S.vertex r7'.succ, + S.vertex + (pc1.castLT + (Nat.lt_trans pc1.isLt + (Nat.succ_lt_succ + r7'.isLt)))) → + ∀ (pc1' : Fin 8), + pc1.castLT + (Nat.lt_trans pc1.isLt + (Nat.succ_lt_succ + r7'.isLt)) = + (⟨(↑pc1' : ℕ), by clear * - hlen; omega⟩ : + Fin (S.length + 1)) → + ∀ + (hc1ends : + G.ends c1 = + s(y8, + S.vertex + (⟨(↑pc1' : ℕ), by clear * - hlen; omega⟩ : + Fin (S.length + 1)))), + ( + ∀ (q : Fin 8), + ∃ (t : Fin 8), + newVertex + (Fin.castLE + (Mathlib.Meta.NormNum.isNat_le_true + (Mathlib.Meta.NormNum.isNat_ofNat + ℕ (Eq.refl 8)) + (Mathlib.Meta.NormNum.isNat_ofNat + ℕ (Eq.refl 9)) + (Eq.refl true)) + t) = + S.vertex + (⟨(↑q : ℕ), by clear * - hlen; omega⟩ : + Fin + (S.length + 1))) → + ∀ (tc0 : Fin 7) + (htc0 : + newVertex + (Fin.castLE + (Mathlib.Meta.NormNum.isNat_le_true + (Mathlib.Meta.NormNum.isNat_ofNat + ℕ (Eq.refl 7)) + (Mathlib.Meta.NormNum.isNat_ofNat + ℕ (Eq.refl 9)) + (Eq.refl true)) + tc0) = + S.vertex + (⟨(↑pc' : ℕ), by clear * - hlen; omega⟩ : + Fin (S.length + 1))) + (tc1 : Fin 8) + (htc1 : + newVertex + (Fin.castLE + (Mathlib.Meta.NormNum.isNat_le_true + (Mathlib.Meta.NormNum.isNat_ofNat + ℕ (Eq.refl 8)) + (Mathlib.Meta.NormNum.isNat_ofNat + ℕ (Eq.refl 9)) + (Eq.refl true)) + tc1) = + S.vertex + (⟨(↑pc1' : ℕ), by clear * - hlen; omega⟩ : + Fin (S.length + 1))) + (tw : Fin 7), + newVertex + (Fin.castLE + (Mathlib.Meta.NormNum.isNat_le_true + (Mathlib.Meta.NormNum.isNat_ofNat + ℕ (Eq.refl 7)) + (Mathlib.Meta.NormNum.isNat_ofNat + ℕ (Eq.refl 9)) + (Eq.refl true)) + tw) = + S.vertex + (⟨(↑w : ℕ), by clear * - hlen; omega⟩ : + Fin (S.length + 1)) → + ∀ (S' : TreeSequence G e), + ∀ + (hS'length : + S'.length = 8), + ( + ∀ (i : Fin 9), + S'.vertex (Fin.cast (by omega : 9 = S'.length + 1) i) = + newVertex i) → + ( + ∀ (i : Fin 8), + S'.edge (Fin.cast hS'length.symm i) = + newEdge i) → + g1 ∈ + MissingColors G psi + (S'.vertex + (⟨(↑tw : ℕ), by omega⟩ : + Fin + (S'.length + + 1))) → + TashkinovTree G e psi S' → + M.beta ∈ MissingColors G psi y1 → + ∃ (S' : TreeSequence G e) + (M' : NormalGlobalMaximumTriple G k e psi S') + (_ : S'.length = 8) (_ : M'.height = 5), + BalancedGlobalMaximumTriple M' ∧ + S'.vertex ⟨0, by omega⟩ = y0 ∧ + S'.vertex ⟨1, by omega⟩ = y1 ∧ + S'.vertex ⟨2, by omega⟩ = v1 ∧ + S'.vertex ⟨3, by omega⟩ = v2 ∧ + S'.vertex ⟨4, by omega⟩ = y4 ∧ + S'.vertex ⟨5, by omega⟩ = y2 ∧ + S'.vertex ⟨6, by omega⟩ = y3 ∧ + S'.vertex ⟨7, by omega⟩ = y7 ∧ + S'.vertex ⟨8, by omega⟩ = y8 ∧ + S'.edge ⟨0, by omega⟩ = a0 ∧ + S'.edge ⟨1, by omega⟩ = f1 ∧ + S'.edge ⟨2, by omega⟩ = beta56 ∧ + S'.edge ⟨3, by omega⟩ = f2 ∧ + S'.edge ⟨4, by omega⟩ = a1 ∧ + S'.edge ⟨5, by omega⟩ = a3 ∧ + S'.edge ⟨6, by omega⟩ = c0 ∧ + S'.edge ⟨7, by omega⟩ = c1 ∧ + M'.alpha = g0 ∧ M'.beta = M.beta + +private theorem scheideRebasedTreeCertificate.{u_1, u_2} : + scheideRebasedTreeCertificateStatement.{u_1, u_2} := by + classical + intro V E inst inst_1 inst_2 G k hgraphHeight e psi S M hbal hlen hheight g0 horderM y0 y1 y2 y3 + y4 y5 y6 y7 y8 a1 a2 a3 b0 b1 c0 c1 hg0' p0 p1 f1 f2 v1 v2 hf1color hf2color hv10 hv14 + hf1ends' hf2ends' hb01ne horient beta56 hbeta56ends hbeta56color ha1ends ha2ends ha3ends + hclosingEnds ha1color ha2color ha3color hclosingColor hab hg0alpha hg0beta r6' r7' w g1 + hc1color hc0color' hwmissing' pc pc' hc0ends hg10 hg1alpha hg1beta g0last hg0lastEnds + hg0lastColor alphaLast halphaLastEnds halphaLastColor betaLast hbetaLastEnds hbetaLastColor a0 + ha0eq pa0 ha0ends hbeta_a0 hbeta_f1 hbeta_f2 hbeta_a1 hbeta_a3 hbeta_c0 hbeta_c1 hwbase + hwcases cast9 permA permB newVertex edgeList hedgeListLength newEdge hselectA hselectB + vertex_cast9 nv0 nv1 nv2 nv3 nv4 nv5 nv6 nv7 nv8 ne0 ne1 ne2 ne3 ne4 ne5 ne6 ne7 hvertex_iff + hedge_iff newVertex_injective newEdge_injective firstSeven pc1 hpc1 pc1' hpc1cast hc1ends + firstEight tc0 htc0 tc1 htc1 tw htw S' hS'length hS'vertex hS'edge htwMissing hS'tash + hbetaMissing + rcases S' with ⟨size, positive, vertices, edges, vertexInjective, edgeInjective, + firstEdge, attaches⟩ + change size = 8 at hS'length + subst size + have vertexEquality : vertices = newVertex := funext hS'vertex + have edgeEquality : edges = newEdge := funext hS'edge + subst vertices edges + let S' : TreeSequence G e := + ⟨8, positive, newVertex, newEdge, vertexInjective, edgeInjective, firstEdge, attaches⟩ + have hS'length : S'.length = 8 := rfl + have horderNine : TashkinovOrder G = 9 := by + calc + TashkinovOrder G = (TreeSequenceVertexSet S).card := horderM.1 + _ = S.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, S.vertex_injective] + _ = 9 := by omega + have hS'card : (TreeSequenceVertexSet S').card = 9 := by + calc + (TreeSequenceVertexSet S').card = S'.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, S'.vertex_injective] + _ = 9 := by rw [hS'length] + have hS'global : GlobalMaximumTriple G k e psi S' := by + refine ⟨M.global.1, hS'tash, ?_⟩ + rw [hS'card, horderNine] + have hf1f2 : f1 ≠ f2 := by + intro equality + have indices := newEdge_injective (show newEdge 1 = newEdge 3 by rw [ne1, ne3, equality]) + have values := congrArg Fin.val indices + norm_num at values + have hf1close : f1 ≠ M.closingEdge := by + intro hh + have hc : some g0 = some M.beta := by rw [← hf1color, hh, hclosingColor] + exact hg0beta (Option.some.inj hc) + have hf2close : f2 ≠ M.closingEdge := by + intro hh + have hc : some g0 = some M.beta := by rw [← hf2color, hh, hclosingColor] + exact hg0beta (Option.some.inj hc) + have hbetaClose : beta56 ≠ M.closingEdge := by + intro equality + have ends : s(v1, v2) = s(y4, y0) := by rw [← hbeta56ends, equality, hclosingEnds] + rcases Sym2.eq_iff.mp ends with first | second + · exact hv14 first.1 + · exact hv10 second.1 + let H := TwoColorIncidenceGraph G psi g0 M.beta + let pathNodes : List (Sum V E) := + [Sum.inl y1, Sum.inr f1, Sum.inl v1, Sum.inr beta56, Sum.inl v2, Sum.inr f2, Sum.inl y4, + Sum.inr M.closingEdge, Sum.inl y0] + have hy1f1 : Incident G y1 f1 := by simp [Incident, hf1ends'] + have hv1f1 : Incident G v1 f1 := by simp [Incident, hf1ends'] + have hv1beta : Incident G v1 beta56 := by simp [Incident, hbeta56ends] + have hv2beta : Incident G v2 beta56 := by simp [Incident, hbeta56ends] + have hv2f2 : Incident G v2 f2 := by simp [Incident, hf2ends'] + have hy4f2 : Incident G y4 f2 := by simp [Incident, hf2ends'] + have hy4close : Incident G y4 M.closingEdge := by simp [Incident, hclosingEnds] + have hy0close : Incident G y0 M.closingEdge := by simp [Incident, hclosingEnds] + have hpathChain : pathNodes.IsChain H.Adj := by + simp [pathNodes, H, TwoColorIncidenceGraph, hy1f1, hv1f1, hv1beta, hv2beta, hv2f2, hy4f2, + hy4close, hy0close, hf1color, hf2color, hbeta56color, hclosingColor] + have hpathNodesNonempty : pathNodes ≠ [] := by simp [pathNodes] + let rawPath := SimpleGraph.Walk.ofSupport pathNodes hpathNodesNonempty hpathChain + have hpathStart : pathNodes.head hpathNodesNonempty = Sum.inl (S'.vertex ⟨1, by omega⟩) := by + change Sum.inl y1 = Sum.inl (newVertex 1) + rw [nv1] + have hpathEnd : pathNodes.getLast hpathNodesNonempty = Sum.inl (S'.vertex ⟨0, by omega⟩) := by + change Sum.inl y0 = Sum.inl (newVertex 0) + rw [nv0] + let closingPath : + H.Walk (Sum.inl (S'.vertex ⟨1, by omega⟩)) (Sum.inl (S'.vertex ⟨0, by omega⟩)) := + rawPath.copy hpathStart hpathEnd + have hpathSupport : closingPath.support = pathNodes := by + calc + closingPath.support = rawPath.support := by + simpa only [closingPath] using SimpleGraph.Walk.support_copy rawPath hpathStart hpathEnd + _ = pathNodes := by + simpa only [rawPath] using SimpleGraph.Walk.support_ofSupport hpathNodesNonempty hpathChain + have hpathLength : closingPath.length = 8 := by + calc + closingPath.length = rawPath.length := by + simpa only [closingPath] using SimpleGraph.Walk.length_copy rawPath hpathStart hpathEnd + _ = pathNodes.length - 1 := by + simpa only [rawPath] using SimpleGraph.Walk.length_ofSupport hpathNodesNonempty hpathChain + _ = 8 := by simp [pathNodes] + have hpathNodesNodup : pathNodes.Nodup := by + simp [pathNodes, ← nv0, ← nv1, ← nv2, ← nv3, ← nv4, newVertex_injective.eq_iff, hf1f2, hf1close, + hf2close, hbeta_f2, hbetaClose, Ne.symm hbeta_f1] + have hpathIsPath : closingPath.IsPath := by + rw [SimpleGraph.Walk.isPath_def, hpathSupport] + exact hpathNodesNodup + have hpathVertexSupport : + ∀ v : V, + Sum.inl v ∈ closingPath.support ↔ + ∃ i : Fin 5, v = S'.vertex (Fin.castLE (by norm_num : 5 ≤ 9) i) := by + intro v + rw [hpathSupport] + let vertex5 : Fin 5 → V := fun i => newVertex (Fin.castLE (by norm_num : 5 ≤ 9) i) + change _ ↔ ∃ i : Fin 5, v = vertex5 i + have v0 : vertex5 0 = y0 := (mappedCastLE newVertex (by norm_num : 5 ≤ 9) 0 0 rfl).trans nv0 + have v1' : vertex5 1 = y1 := (mappedCastLE newVertex (by norm_num : 5 ≤ 9) 1 1 rfl).trans nv1 + have v2' : vertex5 2 = v1 := (mappedCastLE newVertex (by norm_num : 5 ≤ 9) 2 2 rfl).trans nv2 + have v3 : vertex5 3 = v2 := (mappedCastLE newVertex (by norm_num : 5 ≤ 9) 3 3 rfl).trans nv3 + have v4 : vertex5 4 = y4 := (mappedCastLE newVertex (by norm_num : 5 ≤ 9) 4 4 rfl).trans nv4 + simpa only [pathNodes, v0, v1', v2', v3, v4] using + alternatingVertexSupport vertex5 f1 beta56 f2 M.closingEdge v + have hpathEdgeSupport : + ∀ f : E, + Sum.inr f ∈ closingPath.support ↔ + f = M.closingEdge ∨ ∃ j : Fin S'.length, 1 ≤ j.val ∧ j.val + 2 ≤ 5 ∧ f = S'.edge j := by + intro f + rw [hpathSupport] + change _ ↔ f = M.closingEdge ∨ ∃ j : Fin 8, 1 ≤ j.val ∧ j.val + 2 ≤ 5 ∧ f = newEdge j + exact alternatingEdgeSupport y0 y1 v1 v2 y4 f1 beta56 f2 M.closingEdge newEdge ne1 ne2 ne3 f + have htrunkEnds : + ∀ j : Fin S'.length, + 1 ≤ j.val → + j.val + 2 ≤ 5 → + G.ends (S'.edge j) = s(S'.vertex ⟨j.val, Nat.lt_succ_of_lt j.isLt⟩, S'.vertex j.succ) := + by + intro j hj hjbound + fin_cases j <;> simp at hj hjbound + · change G.ends (newEdge 1) = s(newVertex 1, newVertex 2) + rw [ne1, nv1, nv2] + exact hf1ends' + · change G.ends (newEdge 2) = s(newVertex 2, newVertex 3) + rw [ne2, nv2, nv3] + exact hbeta56ends + · change G.ends (newEdge 3) = s(newVertex 3, newVertex 4) + rw [ne3, nv3, nv4] + exact hf2ends'.trans Sym2.eq_swap + let M' : NormalGlobalMaximumTriple G k e psi S' := by + exact + { global := hS'global + height := 5 + height_lower := by omega + height_upper := by rw [hS'length]; omega + alpha := g0 + beta := M.beta + alpha_missing := by + change g0 ∈ MissingColors G psi (newVertex 0) + rw [nv0] + exact hg0' + beta_missing := by + change M.beta ∈ MissingColors G psi (newVertex 1) + rw [nv1] + exact hbetaMissing + closingEdge := M.closingEdge + lastIndex := ⟨4, by rw [hS'length]; omega⟩ + lastIndex_height := by norm_num + closing_ends := by + change G.ends M.closingEdge = s(newVertex 4, newVertex 0) + rw [nv4, nv0] + exact hclosingEnds + closingPath := by simpa only [H] using closingPath + closingPath_isPath := by simpa only [H] using hpathIsPath + closingPath_length := by simpa using hpathLength + closingPath_vertices := hpathVertexSupport + closingPath_edges := hpathEdgeSupport + trunk_edge_ends := htrunkEnds } + have hM'height : M'.height = 5 := rfl + have hM'bal : BalancedGlobalMaximumTriple M' := by + constructor + · change 5 = ScheideGraphHeight G + exact hgraphHeight.symm + · intro q hlow hupp + have hq : q = 3 ∨ q = 4 := by + change 5 < 2 * q at hlow + change 2 * q < 8 + 1 at hupp + omega + rcases hq with rfl | rfl + · change psi (newEdge 4) = psi (newEdge 5) + rw [ne4, ne5, ha1color, ha3color] + · change psi (newEdge 6) = psi (newEdge 7) + rw [ne6, ne7, hc0color', hc1color] + exact + ⟨S', M', hS'length, hM'height, hM'bal, nv0, nv1, nv2, nv3, nv4, nv5, nv6, nv7, nv8, ne0, ne1, + ne2, ne3, ne4, ne5, ne6, ne7, rfl, rfl⟩ + +private theorem helper_continuation_1913.{u_1, u_2} : scheideBlockContinuationStatement.{u_1, u_2} + := by + classical + intro V E _ _ _ G k e0 phi T N hgraphHeight Good e psi S M hbal hlen hheight g0 horderM y0 y1 + y2 y3 y4 y5 y6 y7 y8 a1 a2 a3 b0 b1 c0 c1 hg0' p0 p1 f1 f2 v1 v2 hf1color hf2color hv10 + hv14 hf1ends' hf2ends' hb01ne horient beta56 hbeta56ends hbeta56color ha1ends ha2ends + ha3ends hclosingEnds ha1color ha2color ha3color hclosingColor hab hg0alpha hg0beta r6' r7' + w g1 hc1color hc0color' hwmissing' pc pc' hc0ends hg10 hg1alpha hg1beta g0last hg0lastEnds + hg0lastColor alphaLast halphaLastEnds halphaLastColor betaLast hbetaLastEnds hbetaLastColor + a0 ha0eq pa0 ha0ends hbeta_a0 hbeta_f1 + have hbeta_f2 : beta56 ≠ f2 := by + intro hEq + have hc : some M.beta = some g0 := by + rw [← hbeta56color, hEq, hf2color] + exact hg0beta (Option.some.inj hc).symm + have hbeta_a1 : beta56 ≠ a1 := by + intro hEq + have hc : some M.beta = some M.alpha := by + rw [← hbeta56color, hEq, ha1color] + exact hab (Option.some.inj hc).symm + have hbeta_a3 : beta56 ≠ a3 := by + intro hEq + have hc : some M.beta = some M.alpha := by + rw [← hbeta56color, hEq, ha3color] + exact hab (Option.some.inj hc).symm + have hbeta_c0 : beta56 ≠ c0 := by + intro hEq + have hc : some M.beta = some g1 := by + rw [← hbeta56color, hEq, hc0color'] + exact hg1beta (Option.some.inj hc).symm + have hbeta_c1 : beta56 ≠ c1 := by + intro hEq + have hc : some M.beta = some g1 := by + rw [← hbeta56color, hEq, hc1color] + exact hg1beta (Option.some.inj hc).symm + have rebase (hwbase : 5 ≤ w.val) : + ∃ (S' : TreeSequence G e) + (M' : NormalGlobalMaximumTriple G k e psi S') + (_ : S'.length = 8) (_ : M'.height = 5), + BalancedGlobalMaximumTriple M' ∧ + S'.vertex ⟨0, by omega⟩ = y0 ∧ + S'.vertex ⟨1, by omega⟩ = y1 ∧ + S'.vertex ⟨2, by omega⟩ = v1 ∧ + S'.vertex ⟨3, by omega⟩ = v2 ∧ + S'.vertex ⟨4, by omega⟩ = y4 ∧ + S'.vertex ⟨5, by omega⟩ = y2 ∧ + S'.vertex ⟨6, by omega⟩ = y3 ∧ + S'.vertex ⟨7, by omega⟩ = y7 ∧ + S'.vertex ⟨8, by omega⟩ = y8 ∧ + S'.edge ⟨0, by omega⟩ = a0 ∧ + S'.edge ⟨1, by omega⟩ = f1 ∧ + S'.edge ⟨2, by omega⟩ = beta56 ∧ + S'.edge ⟨3, by omega⟩ = f2 ∧ + S'.edge ⟨4, by omega⟩ = a1 ∧ + S'.edge ⟨5, by omega⟩ = a3 ∧ + S'.edge ⟨6, by omega⟩ = c0 ∧ + S'.edge ⟨7, by omega⟩ = c1 ∧ + M'.alpha = g0 ∧ M'.beta = M.beta := by + have hwcases : w.val = 5 ∨ w.val = 6 := by + have hwlt : w.val < 7 := by simp [r6'] + omega + let cast9 : Fin 9 ≃ Fin (S.length + 1) := finCongr (by omega) + let permA : Equiv.Perm (Fin 9) := + (Equiv.swap 2 5).trans (Equiv.swap 3 6) + let permB : Equiv.Perm (Fin 9) := + ((Equiv.swap 2 6).trans (Equiv.swap 2 3)).trans (Equiv.swap 2 5) + let newVertex : Fin 9 → V := fun i ↦ + if b0 = f1 then S.vertex (cast9 (permA i)) + else S.vertex (cast9 (permB i)) + let edgeList : List E := [a0, f1, beta56, f2, a1, a3, c0, c1] + have hedgeListLength : edgeList.length = 8 := by rfl + let newEdge : Fin 8 → E := fun i ↦ + edgeList.get (Fin.cast hedgeListLength.symm i) + have hselectA (hb : b0 = f1) : + y5 = v1 ∧ b1 = f2 ∧ y6 = v2 := by + apply helper_hselectA_3623 <;> assumption + have hselectB (hb : b0 ≠ f1) : + y5 = v2 ∧ b1 = f1 ∧ y6 = v1 := by + rcases horient with ho | ho + · exact (hb ho.1).elim + · exact ⟨ho.2.1, ho.2.2.1, ho.2.2.2⟩ + have vertex_cast9 (i : Fin 9) (q : Fin (S.length + 1)) + (hv : i.val = q.val) : S.vertex (cast9 i) = S.vertex q := by + apply congrArg S.vertex + apply Fin.ext + simpa [cast9] using hv + have nv0 : newVertex 0 = y0 := by + apply helper_nv0_3642 <;> assumption + have nv1 : newVertex 1 = y1 := by + apply helper_nv1_3650 <;> assumption + have nv2 : newVertex 2 = v1 := by + apply helper_nv2_3221 <;> assumption + have nv3 : newVertex 3 = v2 := by + apply helper_nv3_3235 <;> assumption + have nv4 : newVertex 4 = y4 := by + apply helper_nv4_3666 <;> assumption + have nv5 : newVertex 5 = y2 := by + apply helper_nv5_3674 <;> assumption + have nv6 : newVertex 6 = y3 := by + apply helper_nv6_3682 <;> assumption + have nv7 : newVertex 7 = y7 := by + apply helper_nv7_3690 <;> assumption + have nv8 : newVertex 8 = y8 := by + apply helper_nv8_3698 <;> assumption + have ne0 : newEdge 0 = a0 := rfl + have ne1 : newEdge 1 = f1 := rfl + have ne2 : newEdge 2 = beta56 := rfl + have ne3 : newEdge 3 = f2 := rfl + have ne4 : newEdge 4 = a1 := rfl + have ne5 : newEdge 5 = a3 := rfl + have ne6 : newEdge 6 = c0 := rfl + have ne7 : newEdge 7 = c1 := rfl + have hvertex_iff (i j : Fin (S.length + 1)) : + S.vertex i = S.vertex j ↔ i = j := S.vertex_injective.eq_iff + have hedge_iff (i j : Fin S.length) : + S.edge i = S.edge j ↔ i = j := S.edge_injective.eq_iff + have newVertex_injective : Function.Injective newVertex := by + apply helper_hedge_iff_3716 <;> assumption + have newEdge_injective : Function.Injective newEdge := by + apply helper_newEdge_injective_3726 <;> assumption + have firstSeven : ∀ q : Fin 7, ∃ t : Fin 7, + newVertex (Fin.castLE (by norm_num : 7 ≤ 9) t) = + S.vertex ⟨q.val, by omega⟩ := by + apply helper_firstSeven_3311 <;> assumption + obtain ⟨pc1, hpc1⟩ := S.attaches r7' + let pc1' : Fin 8 := ⟨pc1.val, by simp [r7']⟩ + have hpc1cast : Fin.castLT pc1 + (Nat.lt_trans pc1.isLt (Nat.succ_lt_succ r7'.isLt)) = + (⟨pc1'.val, by omega⟩ : Fin (S.length + 1)) := by + apply Fin.ext + rfl + have hc1ends : G.ends c1 = s(y8, S.vertex ⟨pc1'.val, by omega⟩) := by + simpa [c1, r7', y8, hpc1cast] using hpc1 + have firstEight : ∀ q : Fin 8, ∃ t : Fin 8, + newVertex (Fin.castLE (by norm_num : 8 ≤ 9) t) = + S.vertex ⟨q.val, by omega⟩ := by + apply helper_firstEight_3682 <;> assumption + obtain ⟨tc0, htc0⟩ := firstSeven pc' + obtain ⟨tc1, htc1⟩ := firstEight pc1' + obtain ⟨tw, htw⟩ := firstSeven w + let S' : TreeSequence G e := by + exact @helperS3810 (@V) (@E) inferInstance (@G) (@k) (@e) + (@S) (@hlen) (@f1) (@f2) (@v1) (@v2) (@hf1ends') (@hf2ends') (@beta56) + (@hbeta56ends) (@ha1ends) (@ha3ends) (@w) (@pc) (@hc0ends) (@ha0eq) (@ha0ends) + (@hedgeListLength) (@nv0) (@nv1) (@nv2) (@nv3) (@nv4) (@nv5) (@nv6) (@nv7) (@nv8) + (@ne0) (@ne1) (@ne2) (@ne3) (@ne4) (@ne5) (@ne6) (@ne7) (@newVertex_injective) + (@newEdge_injective) (@pc1) (@hc1ends) (@tc0) (@htc0) (@tc1) (@htc1) + have hS'length : S'.length = 8 := rfl + have hS'vertex (i : Fin 9) : S'.vertex i = newVertex i := rfl + have hS'edge (i : Fin 8) : S'.edge i = newEdge i := rfl + have htwMissing : g1 ∈ MissingColors G psi + (S'.vertex ⟨tw.val, by omega⟩) := by + change g1 ∈ MissingColors G psi + (newVertex (Fin.castLE (by omega) tw)) + rw [htw] + exact hwmissing' + have hS'tash : TashkinovTree G e psi S' := by apply helper_hS'tash_4523 <;> assumption + have hbetaMissing : M.beta ∈ MissingColors G psi y1 := by + simpa [y1] using M.beta_missing + exact @scheideRebasedTreeCertificate (@«V») (@«E») inferInstance inferInstance inferInstance + (@«G») (@«k») (@«hgraphHeight») (@«e») (@«psi») (@«S») (@«M») (@«hbal») (@«hlen») + (@«hheight») (@«g0») (@«horderM») (@«y0») (@«y1») (@«y2») (@«y3») (@«y4») (@«y5») (@«y6») + (@«y7») (@«y8») (@«a1») (@«a2») (@«a3») (@«b0») (@«b1») (@«c0») (@«c1») (@«hg0'») (@«p0») + (@«p1») (@«f1») (@«f2») (@«v1») (@«v2») (@«hf1color») (@«hf2color») (@«hv10») (@«hv14») + (@«hf1ends'») (@«hf2ends'») (@«hb01ne») (@«horient») (@«beta56») (@«hbeta56ends») + (@«hbeta56color») (@«ha1ends») (@«ha2ends») (@«ha3ends») (@«hclosingEnds») (@«ha1color») + (@«ha2color») (@«ha3color») (@«hclosingColor») (@«hab») (@«hg0alpha») (@«hg0beta») (@«r6'») + (@«r7'») (@«w») (@«g1») (@«hc1color») (@«hc0color'») (@«hwmissing'») (@«pc») (@«pc'») + (@«hc0ends») (@«hg10») (@«hg1alpha») (@«hg1beta») (@«g0last») (@«hg0lastEnds») + (@«hg0lastColor») (@«alphaLast») (@«halphaLastEnds») (@«halphaLastColor») (@«betaLast») + (@«hbetaLastEnds») (@«hbetaLastColor») (@«a0») (@«ha0eq») (@«pa0») (@«ha0ends») + (@«hbeta_a0») (@«hbeta_f1») (@«hbeta_f2») (@«hbeta_a1») (@«hbeta_a3») (@«hbeta_c0») + (@«hbeta_c1») (@«hwbase») (@«hwcases») (@«cast9») (@«permA») (@«permB») (@«newVertex») + (@«edgeList») (@«hedgeListLength») (@«newEdge») (@«hselectA») (@«hselectB») + (@«vertex_cast9») (@«nv0») (@«nv1») (@«nv2») (@«nv3») (@«nv4») (@«nv5») (@«nv6») (@«nv7») + (@«nv8») (@«ne0») (@«ne1») (@«ne2») (@«ne3») (@«ne4») (@«ne5») (@«ne6») (@«ne7») + (@«hvertex_iff») (@«hedge_iff») (@«newVertex_injective») (@«newEdge_injective») + (@«firstSeven») (@«pc1») (@«hpc1») (@«pc1'») (@«hpc1cast») (@«hc1ends») (@«firstEight») + (@«tc0») (@«htc0») (@«tc1») (@«htc1») (@«tw») (@«htw») (@«S'») (@«hS'length») (@«hS'vertex») + (@«hS'edge») (@«htwMissing») (@hS'tash) (@hbetaMissing) + exact @helper_continuation_2887 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@hgraphHeight) (@e) (@psi) (@S) (@M) (@hbal) (@hlen) (@hheight) (@g0) (@hg0') (@f1) (@f2) + (@v1) (@v2) (@hf1color) (@hf2color) (@hf1ends') (@hf2ends') (@horient) (@beta56) + (@hbeta56ends) (@hbeta56color) (@ha1ends) (@ha2ends) (@ha3ends) (@ha1color) (@ha2color) + (@ha3color) (@hab) (@hg0alpha) (@hg0beta) (@w) (@g1) (@hc1color) (@hc0color') (@hwmissing') + (@hg10) (@hg1alpha) (@hg1beta) (@g0last) (@hg0lastEnds) (@hg0lastColor) (@alphaLast) + (@halphaLastEnds) (@halphaLastColor) (@betaLast) (@hbetaLastEnds) (@hbetaLastColor) (@rebase) + +private theorem helper_second_ne_of_matching_4215.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) + (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)) (_ : + IsProperEdgeColoring G psi) + (_ : ColoredVertexSetElementary G psi (TreeSequenceVertexSet S)), + let y7 : V := + S.vertex + (⟨(7 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let c0 : E := + S.edge + (⟨(6 : ℕ), by + omega⟩ : + Fin S.length); + ∀ (_ : + ∀ {i j : Fin (S.length + (1 : ℕ))}, + i ≠ j → + S.vertex i ≠ S.vertex j) + (_ : + ∀ (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) + (_ : + ∀ {c : Fin k} {v : V} {f : E}, + c ∈ MissingColors G psi v → + Incident G v + f → + psi f ≠ some c) + (_ : + Fin + ((↑(⟨(4 : ℕ), by + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (_ : + Fin + ((↑(⟨(5 : ℕ), by + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))), + let r6' : Fin S.length := + (⟨(6 : ℕ), by + omega⟩ : + Fin S.length); + ∀ (w : Fin ((↑r6' : ℕ) + (1 : ℕ))) (g1 : Fin k) (_ : psi c0 = some g1) + (_ : + g1 ∈ + MissingColors G psi + (S.vertex + (⟨(↑w : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))))) + (pc : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let pc' : Fin (7 : ℕ) := + (⟨(↑pc : ℕ), by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt pc + have := GoldbergSeymour.TreeSequence.positive S + all_goals omega)⟩ : + Fin (7 : ℕ)); + ∀ + (_ : + G.ends c0 = + s(y7, + S.vertex + (⟨(↑pc' : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))))) + (c : Fin k) (m : Fin (7 : ℕ)) + (_ : + c ∈ + MissingColors G psi + (S.vertex + (⟨(↑m : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))))) + (_ : + ∀ (q : Fin (7 : ℕ)), + q ≠ m → + ∃ (f : E), + f ≠ c0 ∧ + Incident G + (S.vertex + (⟨(↑q : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ)))) + f ∧ + psi f = some c ∧ ¬Incident G y7 f), + g1 ≠ c := by + classical + intro V E _ _ _ G k e psi S M hlen hproper helem y7 c0 hvertex_ne hmem missing_excludes p0 p1 r6' + w g1 hc0color' hwmissing' pc pc' hc0ends c m hcmiss hcover hEq + have hwEq : w.val = m.val := by + by_contra hne + have hvne : S.vertex ⟨w.val, by omega⟩ ≠ + S.vertex ⟨m.val, by omega⟩ := by + apply hvertex_ne + exact Fin.ne_of_val_ne hne + have hd := helem (hmem (⟨w.val, by omega⟩ : Fin (S.length + 1))) + (hmem (⟨m.val, by omega⟩ : Fin (S.length + 1))) hvne + exact (Finset.disjoint_left.mp hd) hwmissing' + (by simpa [hEq] using hcmiss) + have hpcne : pc' ≠ m := by + intro hpm + have hinc : Incident G (S.vertex ⟨m.val, by omega⟩) c0 := by + rw [Incident, hc0ends] + have hv : S.vertex ⟨pc'.val, by omega⟩ = + S.vertex ⟨m.val, by omega⟩ := by + apply congrArg S.vertex + apply Fin.ext + simpa using congrArg Fin.val hpm + rw [hv] + simp + exact (missing_excludes hcmiss hinc) (by simpa [hEq] using hc0color') + obtain ⟨f, hfc0, hincf, hfcolor, _⟩ := hcover pc' hpcne + have hincc : Incident G (S.vertex ⟨pc'.val, by omega⟩) c0 := by + rw [Incident, hc0ends] + simp + exact (hproper hfc0.symm ⟨S.vertex ⟨pc'.val, by omega⟩, hincc, + hincf⟩ (by simpa [hEq] using hc0color')) hfcolor + +private theorem helper_hcoverG0_4250.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) (S : + TreeSequence G e) + (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)) (g0 : Fin k), + let y1 : V := + S.vertex + (⟨(1 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y2 : V := + S.vertex + (⟨(2 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y3 : V := + S.vertex + (⟨(3 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y4 : V := + S.vertex + (⟨(4 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y5 : V := + S.vertex + (⟨(5 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y6 : V := + S.vertex + (⟨(6 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y7 : V := + S.vertex + (⟨(7 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let b0 : E := + S.edge + (⟨(4 : ℕ), by + omega⟩ : + Fin S.length); + let b1 : E := + S.edge + (⟨(5 : ℕ), by + omega⟩ : + Fin S.length); + let c0 : E := + S.edge + (⟨(6 : ℕ), by + omega⟩ : + Fin S.length); + ∀ (_ : + ∀ {i j : Fin S.length}, + i ≠ j → + S.edge i ≠ S.edge j) (_ : psi b0 = some g0) + (_ : psi b1 = some g0) + (p0 : + Fin + ((↑(⟨(4 : ℕ), by + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (_ : + G.ends b0 = + s(y5, + S.vertex + (p0.castLT + (by + omega)))) + (p1 : + Fin + ((↑(⟨(5 : ℕ), by + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (_ : + G.ends b1 = + s(y6, + S.vertex + (p1.castLT + (by + omega)))) + (f1 f2 f3 : E) (v1 v2 : V) (_ : psi f1 = some g0) (_ : psi f2 = some g0) + (_ : psi f3 = some g0) + (_ : G.ends f1 = s(y1, v1)) (_ : G.ends f2 = s(y4, v2)) (_ : G.ends f3 + = s(y2, y3)) + (_ : b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1) + (_ : c0 ≠ f3) + (_ : ¬Incident G y7 f1) (_ : ¬Incident G y7 f2) (_ : ¬Incident G y7 f3) + (_ : ¬Incident G y7 b0) + (_ : ¬Incident G y7 b1) (q : Fin (7 : ℕ)), + q ≠ (0 : Fin (7 : ℕ)) → + ∃ (f : E), + f ≠ c0 ∧ + Incident G + (S.vertex + (⟨(↑q : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ)))) + f ∧ + psi f = some g0 ∧ ¬Incident G y7 f := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen g0 y1 y2 y3 y4 y5 y6 y7 b0 b1 c0 hedge_ne h4' h5' p0 + hb0ends p1 hb1ends f1 f2 f3 v1 v2 hf1color hf2color hf3color hf1ends' hf2ends' hf3ends' + horient hc0_ne_f3 hno_f1 hno_f2 hno_f3 hno_b0 hno_b1 + exact @helper_hcoverG0_732 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by + assumption) (@g0) (by + assumption) (by + assumption) (by + assumption) (@p0) (by + assumption) (@p1) (by + assumption) (@f1) (@f2) (@f3) (@v1) (@v2) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) + +private theorem helper_hcoverAlpha_4274.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) (S : + TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y1 : V := + S.vertex + (⟨(1 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y2 : V := + S.vertex + (⟨(2 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y3 : V := + S.vertex + (⟨(3 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y4 : V := + S.vertex + (⟨(4 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y5 : V := + S.vertex + (⟨(5 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y6 : V := + S.vertex + (⟨(6 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y7 : V := + S.vertex + (⟨(7 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let a1 : E := + S.edge + (⟨(1 : ℕ), by + omega⟩ : + Fin S.length); + let a3 : E := + S.edge + (⟨(3 : ℕ), by + omega⟩ : + Fin S.length); + let c0 : E := + S.edge + (⟨(6 : ℕ), by + omega⟩ : + Fin S.length); + ∀ (_ : + ∀ {i j : Fin S.length}, + i ≠ j → + S.edge i ≠ S.edge j) + (_ : + Fin + ((↑(⟨(4 : ℕ), by + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (_ : + Fin + ((↑(⟨(5 : ℕ), by + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (alpha56 : E) (_ : psi alpha56 = some M.alpha) (_ : G.ends alpha56 = + s(y5, y6)) + (_ : G.ends a1 = s(y1, y2)) (_ : G.ends a3 = s(y3, y4)) (_ : psi a1 = + some M.alpha) + (_ : psi a3 = some M.alpha) (_ : c0 ≠ alpha56) (_ : ¬Incident G y7 + a1) + (_ : ¬Incident G y7 a3) (_ : ¬Incident G y7 alpha56) (q : Fin (7 : ℕ)), + q ≠ (0 : Fin (7 : ℕ)) → + ∃ (f : E), + f ≠ c0 ∧ + Incident G + (S.vertex + (⟨(↑q : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ)))) + f ∧ + psi f = some M.alpha ∧ ¬Incident G y7 f := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen y1 y2 y3 y4 y5 y6 y7 a1 a3 c0 hedge_ne p0 p1 alpha56 + halpha56color halpha56ends' ha1ends ha3ends ha1color ha3color hc0_ne_alpha56 hno_a1 hno_a3 + hno_alpha56 + exact @helper_hcoverAlpha_795 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by + assumption) (by + assumption) (@p0) (@p1) (@alpha56) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) + +private theorem helper_hcoverBeta_4291.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) (S : + TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y0 : V := + S.vertex + (⟨(0 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y2 : V := + S.vertex + (⟨(2 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y3 : V := + S.vertex + (⟨(3 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y4 : V := + S.vertex + (⟨(4 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y5 : V := + S.vertex + (⟨(5 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y6 : V := + S.vertex + (⟨(6 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y7 : V := + S.vertex + (⟨(7 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let a2 : E := + S.edge + (⟨(2 : ℕ), by + omega⟩ : + Fin S.length); + let c0 : E := + S.edge + (⟨(6 : ℕ), by + omega⟩ : + Fin S.length); + ∀ (_ : + ∀ {i j : Fin S.length}, + i ≠ j → + S.edge i ≠ S.edge j) + (_ : + Fin + ((↑(⟨(4 : ℕ), by + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (_ : + Fin + ((↑(⟨(5 : ℕ), by + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (beta56 : E) (_ : psi beta56 = some M.beta) (_ : G.ends beta56 = s(y5, + y6)) + (_ : G.ends a2 = s(y2, y3)) (_ : G.ends M.closingEdge = s(y4, y0)) + (_ : psi a2 = some M.beta) (_ : psi M.closingEdge = some M.beta) + (_ : c0 ≠ beta56) + (_ : c0 ≠ M.closingEdge) (_ : ¬Incident G y7 a2) (_ : ¬Incident G + y7 M.closingEdge) + (_ : ¬Incident G y7 beta56) (q : Fin (7 : ℕ)), + q ≠ (1 : Fin (7 : ℕ)) → + ∃ (f : E), + f ≠ c0 ∧ + Incident G + (S.vertex + (⟨(↑q : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ)))) + f ∧ + psi f = some M.beta ∧ ¬Incident G y7 f := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen y0 y2 y3 y4 y5 y6 y7 a2 c0 hedge_ne p0 p1 beta56 + hbeta56color hbeta56ends' ha2ends hclosingEnds ha2color hclosingColor hc0_ne_beta56 + hc0_ne_closing hno_a2 hno_close hno_beta56 + exact @helper_hcoverBeta_834 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by + assumption) (by + assumption) (@p0) (@p1) (@beta56) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (by + assumption) + +private theorem helper_last_pair_edge_4317.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) (S : + TreeSequence G e) + (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)) (_ : + IsProperEdgeColoring G psi) + (_ : ColoredVertexSetElementary G psi (TreeSequenceVertexSet S)) + (_ : ColoredVertexSetClosed G psi (TreeSequenceVertexSet S)), + let y7 : V := + S.vertex + (⟨(7 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let y8 : V := + S.vertex + (⟨(8 : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))); + let c0 : E := + S.edge + (⟨(6 : ℕ), by + omega⟩ : + Fin S.length); + ∀ (_ : + ∀ {i j : Fin (S.length + (1 : ℕ))}, + i ≠ j → + S.vertex i ≠ S.vertex j) + (_ : + ∀ (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) + (_ : + ∀ {c : Fin k} {v : V} {f : E}, + c ∈ MissingColors G psi v → + Incident G v + f → + psi f ≠ some c) + (_ : + Fin + ((↑(⟨(4 : ℕ), by + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (_ : + Fin + ((↑(⟨(5 : ℕ), by + omega⟩ : + Fin S.length) : + ℕ) + + (1 : ℕ))) + (c : Fin k) (m : Fin (7 : ℕ)) + (_ : + c ∈ + MissingColors G psi + (S.vertex + (⟨(↑m : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ))))) + (_ : + ∀ (q : Fin (7 : ℕ)), + q ≠ m → + ∃ (f : E), + f ≠ c0 ∧ + Incident G + (S.vertex + (⟨(↑q : ℕ), by + omega⟩ : + Fin (S.length + (1 : ℕ)))) + f ∧ + psi f = some c ∧ ¬Incident G y7 f), + ∃ (f : E), G.ends f = s(y7, y8) ∧ psi f = some c := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen hproper helem hclosed y7 y8 c0 hvertex_ne hmem + missing_excludes p0 p1 c m hcmiss hcover + apply helper_last_pair_edge_881 <;> assumption +private theorem helper_continuation_1474.{u_1, u_2} : + helperContinuation1474Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hgraphHeight Good e psi S M hbal hlen hheight g0 hproper horderM + helem hclosed y0 y1 y2 y3 y4 y5 y6 y7 y8 a1 a2 a3 b0 b1 c0 c1 hvertex_ne hedge_ne hmem + missing_excludes h4' h5' hg0' p0 hb0ends p1 hb1ends hp1not5 f1 f2 f3 v1 v2 hf1color + hf2color hf3color hv10 hv14 hf1ends' hf2ends' hf3ends' hb01ne horient alpha56 beta56 + halpha56color hbeta56ends hbeta56color halpha56ends' hbeta56ends' ha1ends ha2ends ha3ends + hclosingEnds ha1color ha2color ha3color hclosingColor hab hg0alpha hg0beta r6' r7' w g1 + hc1color hc0color' hwmissing' pc pc' hc0ends hc0_ne_f3 hc0_ne_alpha56 hc0_ne_beta56 + hc0_ne_closing no_y7_of_ends hy0_7 hy1_7 hy2_7 hy3_7 hy4_7 hy5_7 hy6_7 hv1_7 hv2_7 + have hno_f1 : ¬ Incident G y7 f1 := + no_y7_of_ends hf1ends' hy1_7 hv1_7 + have hno_f2 : ¬ Incident G y7 f2 := + no_y7_of_ends hf2ends' hy4_7 hv2_7 + have hno_f3 : ¬ Incident G y7 f3 := + no_y7_of_ends hf3ends' hy2_7 hy3_7 + have hno_a1 : ¬ Incident G y7 a1 := + no_y7_of_ends ha1ends hy1_7 hy2_7 + have hno_a2 : ¬ Incident G y7 a2 := + no_y7_of_ends ha2ends hy2_7 hy3_7 + have hno_a3 : ¬ Incident G y7 a3 := + no_y7_of_ends ha3ends hy3_7 hy4_7 + have hno_close : ¬ Incident G y7 M.closingEdge := + no_y7_of_ends hclosingEnds hy4_7 hy0_7 + have hno_alpha56 : ¬ Incident G y7 alpha56 := + no_y7_of_ends halpha56ends' hy5_7 hy6_7 + have hno_beta56 : ¬ Incident G y7 beta56 := + no_y7_of_ends hbeta56ends' hy5_7 hy6_7 + have hp0lt : p0.val < 5 := by simp + have hp1lt : p1.val < 5 := by + have hp : p1.val < 6 := by simp + omega + have hp0vertex_ne7 : S.vertex (Fin.castLT p0 + (Nat.lt_trans p0.isLt + (Nat.succ_lt_succ (⟨4, by omega⟩ : Fin S.length).isLt))) ≠ y7 := by + apply hvertex_ne + apply Fin.ne_of_val_ne + change p0.val ≠ 7 + omega + have hp1vertex_ne7 : S.vertex (Fin.castLT p1 + (Nat.lt_trans p1.isLt + (Nat.succ_lt_succ (⟨5, by omega⟩ : Fin S.length).isLt))) ≠ y7 := by + apply hvertex_ne + apply Fin.ne_of_val_ne + change p1.val ≠ 7 + omega + have hno_b0 : ¬ Incident G y7 b0 := + no_y7_of_ends hb0ends hy5_7 hp0vertex_ne7 + have hno_b1 : ¬ Incident G y7 b1 := + no_y7_of_ends hb1ends hy6_7 hp1vertex_ne7 + have second_ne_of_matching (c : Fin k) (m : Fin 7) + (hcmiss : c ∈ MissingColors G psi + (S.vertex ⟨m.val, by omega⟩)) + (hcover : ∀ q : Fin 7, q ≠ m → + ∃ f : E, f ≠ c0 ∧ Incident G (S.vertex ⟨q.val, by omega⟩) f ∧ + psi f = some c ∧ ¬ Incident G y7 f) : g1 ≠ c := by + exact @helper_second_ne_of_matching_4215 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e) (@psi) (@S) (@M) (@hlen) (@hproper) (@helem) (@hvertex_ne) (@hmem) + (@missing_excludes) (@p0) (@p1) (@w) (@g1) (@hc0color') (@hwmissing') (@pc) (@hc0ends) (@c) + (@m) (@hcmiss) (@hcover) + have hcoverG0 : ∀ q : Fin 7, q ≠ (0 : Fin 7) → + ∃ f : E, f ≠ c0 ∧ Incident G (S.vertex ⟨q.val, by omega⟩) f ∧ + psi f = some g0 ∧ ¬ Incident G y7 f := by + exact @helper_hcoverG0_4250 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (@hlen) (@g0) (@hedge_ne) (@h4') (@h5') (@p0) + (@hb0ends) (@p1) (@hb1ends) (@f1) (@f2) (@f3) (@v1) (@v2) (@hf1color) (@hf2color) + (@hf3color) (@hf1ends') (@hf2ends') (@hf3ends') (@horient) (@hc0_ne_f3) (@hno_f1) (@hno_f2) + (@hno_f3) (@hno_b0) (@hno_b1) + have hcoverAlpha : ∀ q : Fin 7, q ≠ (0 : Fin 7) → + ∃ f : E, f ≠ c0 ∧ Incident G (S.vertex ⟨q.val, by omega⟩) f ∧ + psi f = some M.alpha ∧ ¬ Incident G y7 f := by + exact @helper_hcoverAlpha_4274 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (@hlen) (@hedge_ne) (@p0) (@p1) (@alpha56) + (@halpha56color) (@halpha56ends') (@ha1ends) (@ha3ends) (@ha1color) (@ha3color) + (@hc0_ne_alpha56) (@hno_a1) (@hno_a3) (@hno_alpha56) + have hcoverBeta : ∀ q : Fin 7, q ≠ (1 : Fin 7) → + ∃ f : E, f ≠ c0 ∧ Incident G (S.vertex ⟨q.val, by omega⟩) f ∧ + psi f = some M.beta ∧ ¬ Incident G y7 f := by + exact @helper_hcoverBeta_4291 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (@hlen) (@hedge_ne) (@p0) (@p1) (@beta56) + (@hbeta56color) (@hbeta56ends') (@ha2ends) (@hclosingEnds) (@ha2color) (@hclosingColor) + (@hc0_ne_beta56) (@hc0_ne_closing) (@hno_a2) (@hno_close) (@hno_beta56) + have hg10 : g1 ≠ g0 := + second_ne_of_matching g0 (0 : Fin 7) (by simpa [y0] using hg0') hcoverG0 + have hg1alpha : g1 ≠ M.alpha := + second_ne_of_matching M.alpha (0 : Fin 7) + (by simpa [y0] using M.alpha_missing) hcoverAlpha + have hg1beta : g1 ≠ M.beta := + second_ne_of_matching M.beta (1 : Fin 7) + (by simpa [y1] using M.beta_missing) hcoverBeta + have last_pair_edge (c : Fin k) (m : Fin 7) + (hcmiss : c ∈ MissingColors G psi + (S.vertex ⟨m.val, by omega⟩)) + (hcover : ∀ q : Fin 7, q ≠ m → + ∃ f : E, f ≠ c0 ∧ Incident G (S.vertex ⟨q.val, by omega⟩) f ∧ + psi f = some c ∧ ¬ Incident G y7 f) : + ∃ f : E, G.ends f = s(y7, y8) ∧ psi f = some c := by + apply helper_last_pair_edge_4317 <;> assumption + obtain ⟨g0last, hg0lastEnds, hg0lastColor⟩ := + last_pair_edge g0 (0 : Fin 7) (by simpa [y0] using hg0') hcoverG0 + obtain ⟨alphaLast, halphaLastEnds, halphaLastColor⟩ := + last_pair_edge M.alpha (0 : Fin 7) + (by simpa [y0] using M.alpha_missing) hcoverAlpha + obtain ⟨betaLast, hbetaLastEnds, hbetaLastColor⟩ := + last_pair_edge M.beta (1 : Fin 7) + (by simpa [y1] using M.beta_missing) hcoverBeta + have hg0AlphaLast : g0last ≠ alphaLast := by + intro hEq + have hc : some g0 = some M.alpha := by + rw [← hg0lastColor, hEq, halphaLastColor] + exact hg0alpha (Option.some.inj hc) + have hg0BetaLast : g0last ≠ betaLast := by + intro hEq + have hc : some g0 = some M.beta := by + rw [← hg0lastColor, hEq, hbetaLastColor] + exact hg0beta (Option.some.inj hc) + have hAlphaBetaLast : alphaLast ≠ betaLast := by + intro hEq + have hc : some M.alpha = some M.beta := by + rw [← halphaLastColor, hEq, hbetaLastColor] + exact hab (Option.some.inj hc) + let a0 : E := S.edge ⟨0, by omega⟩ + have ha0eq : a0 = e := by simpa [a0] using S.first_edge + have ha0color : psi a0 = none := by + rw [ha0eq] + exact M.global.1.2.2.2.2.1 + obtain ⟨pa0, hpa0⟩ := S.attaches (⟨0, by omega⟩ : Fin S.length) + have hpa0zero : pa0 = 0 := Fin.eq_zero pa0 + have hpa0cast : + (Fin.castLT pa0 (Nat.lt_trans pa0.isLt + (Nat.succ_lt_succ (show 0 < S.length by omega))) : + Fin (S.length + 1)) = + (⟨0, Nat.zero_lt_succ S.length⟩ : Fin (S.length + 1)) := by + apply Fin.ext + simp [hpa0zero] + have ha0ends : G.ends a0 = s(y1, y0) := by + simpa [a0, y0, y1, hpa0cast] using hpa0 + have hbeta_a0 : beta56 ≠ a0 := by + intro hEq + rw [hEq, ha0color] at hbeta56color + simp at hbeta56color + have hbeta_f1 : beta56 ≠ f1 := by + intro hEq + have hc : some M.beta = some g0 := by + rw [← hbeta56color, hEq, hf1color] + exact hg0beta (Option.some.inj hc).symm + exact @helper_continuation_1913 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hgraphHeight) (@e) (@psi) (@S) (@M) (@hbal) (@hlen) (@hheight) + (@g0) (@horderM) (@hg0') (@p0) (@p1) (@f1) (@f2) (@v1) (@v2) (@hf1color) (@hf2color) + (@hv10) (@hv14) (@hf1ends') (@hf2ends') (@hb01ne) (@horient) (@beta56) (@hbeta56ends) + (@hbeta56color) (@ha1ends) (@ha2ends) (@ha3ends) (@hclosingEnds) (@ha1color) (@ha2color) + (@ha3color) (@hclosingColor) (@hab) (@hg0alpha) (@hg0beta) (@w) (@g1) (@hc1color) + (@hc0color') (@hwmissing') (@pc) (@hc0ends) (@hg10) (@hg1alpha) (@hg1beta) (@g0last) + (@hg0lastEnds) (@hg0lastColor) (@alphaLast) (@halphaLastEnds) (@halphaLastColor) + (@betaLast) (@hbetaLastEnds) (@hbetaLastColor) (@ha0eq) (@pa0) (@ha0ends) (@hbeta_a0) + (@hbeta_f1) +private theorem helper_continuation_995.{u_1, u_2} : + helperContinuation995Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hgraphHeight this Good e psi S M hbal hlen hheight g0 hproper + horderM helem hclosed y0 y1 y2 y3 y4 y5 y6 y7 y8 a1 a2 a3 b0 b1 c0 c1 hvertex_ne hedge_ne + hmem missing_excludes h4' h5' hg0' p0 hb0ends p1 hb1ends hp1not5 f1 f2 f3 v1 v2 hf1ends + hf2ends hf1color hf2color hf3color hv1T hv2T hv10 hv11 hv12 hv13 hv14 hv20 hv21 hv22 hv23 + hv24 hf1ends' hf2ends' hf3ends' classifyFirst + have hb01ne : b0 ≠ b1 := by + apply hedge_ne + norm_num + have horient : + (b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2) ∨ + (b0 = f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1) := by + exact @helper_horient_1122 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e) + (@psi) (@S) (@M) (@hlen) (@f1) (@f2) (@v1) (@v2) (@classifyFirst) (@hb01ne) + obtain ⟨alpha56, beta56, halpha56ends, halpha56color, + hbeta56ends, hbeta56color, hab56ne⟩ := + ScheideHeightFiveOutsideLinks G k e psi S M hheight hgraphHeight g0 + (by simpa [y0] using hg0') f1 f2 v1 v2 hf1ends hf2ends + hf1color hf2color hv1T hv2T hv10 hv11 hv12 hv13 hv14 hv20 hv21 + hv22 hv23 hv24 + have halpha56ends' : G.ends alpha56 = s(y5, y6) := by + rcases horient with h | h + · simpa [h.2.1, h.2.2.2] using halpha56ends + · simpa [h.2.1, h.2.2.2, Sym2.eq_swap] using halpha56ends + have hbeta56ends' : G.ends beta56 = s(y5, y6) := by + rcases horient with h | h + · simpa [h.2.1, h.2.2.2] using hbeta56ends + · simpa [h.2.1, h.2.2.2, Sym2.eq_swap] using hbeta56ends + have ha1ends : G.ends a1 = s(y1, y2) := by + exact @helper_ha1ends_1148 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e) + (@psi) (@S) (@M) (@hlen) (@hheight) + have ha2ends : G.ends a2 = s(y2, y3) := by + exact @helper_ha2ends_1154 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e) + (@psi) (@S) (@M) (@hlen) (@hheight) + have ha3ends : G.ends a3 = s(y3, y4) := by + exact @helper_ha3ends_1160 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e) + (@psi) (@S) (@M) (@hlen) (@hheight) + have hlast : M.lastIndex = (⟨4, by omega⟩ : Fin (S.length + 1)) := by + apply Fin.ext + have hm := M.lastIndex_height + rw [hheight] at hm + simpa using hm + have hclosingEnds : G.ends M.closingEdge = s(y4, y0) := by + simpa [y4, y0, hlast] using M.closing_ends + have hcycle := ScheideTrunkRotationCycle G k e psi S M hbal + have ha1cycle : NormalCycleEdge M (⟨1, by omega⟩ : Fin M.height) = a1 := by + simp [NormalCycleEdge, a1, hheight] + have ha2cycle : NormalCycleEdge M (⟨2, by omega⟩ : Fin M.height) = a2 := by + simp [NormalCycleEdge, a2, hheight] + have ha3cycle : NormalCycleEdge M (⟨3, by omega⟩ : Fin M.height) = a3 := by + simp [NormalCycleEdge, a3, hheight] + have hcloseCycle : NormalCycleEdge M (⟨4, by omega⟩ : Fin M.height) = + M.closingEdge := by + simp [NormalCycleEdge, hheight] + have ha1color : psi a1 = some M.alpha := by + have hc := hcycle.2.2.2.2 (⟨1, by omega⟩ : Fin M.height) (by norm_num) + simpa [ha1cycle] using hc + have ha2color : psi a2 = some M.beta := by + have hc := hcycle.2.2.2.2 (⟨2, by omega⟩ : Fin M.height) (by norm_num) + have heven : ¬ Odd (2 : ℕ) := by decide + simpa [ha2cycle, heven] using hc + have ha3color : psi a3 = some M.alpha := by + have hc := hcycle.2.2.2.2 (⟨3, by omega⟩ : Fin M.height) (by norm_num) + have hodd : Odd (3 : ℕ) := by decide + simpa [ha3cycle, hodd] using hc + have hclosingColor : psi M.closingEdge = some M.beta := by + have hc := hcycle.2.2.2.2 (⟨4, by omega⟩ : Fin M.height) (by norm_num) + have heven : ¬ Odd (4 : ℕ) := by decide + simpa [hcloseCycle, heven] using hc + have hab : M.alpha ≠ M.beta := by + exact @helper_hab_1198 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e) + (@psi) (@S) (@M) (@hlen) (@helem) (@hvertex_ne) (@hmem) + have hg0alpha : g0 ≠ M.alpha := by + exact @helper_hg0alpha_524 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by + assumption) (@g0) (by + assumption) (by + assumption) (@f1) (@f2) (@v1) (@v2) (by + assumption) (by + assumption) (by + assumption) (@alpha56) (by + assumption) (by + assumption) + have hg0beta : g0 ≠ M.beta := by + exact @helper_hg0beta_547 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by + assumption) (@g0) (by + assumption) (by + assumption) (@f1) (@f2) (@v1) (@v2) (by + assumption) (by + assumption) (by + assumption) (@beta56) (by + assumption) (by + assumption) + let r6' : Fin S.length := ⟨6, by omega⟩ + let r7' : Fin S.length := ⟨7, by omega⟩ + obtain ⟨w, g1, hc0color, hwmissing⟩ := M.global.2.1 r6' (by simp [r6']) + have hc1color : psi c1 = some g1 := by + have hp := hbal.2 4 (by omega) (by omega) + have hc0' : psi c0 = some g1 := by simpa [c0, r6'] using hc0color + simpa [c0, c1, r6', r7'] using hp.symm.trans hc0' + have hc0color' : psi c0 = some g1 := by simpa [c0, r6'] using hc0color + have hwmissing' : g1 ∈ MissingColors G psi + (S.vertex ⟨w.val, by omega⟩) := by + have hi : Fin.castLT w + (Nat.lt_trans w.isLt (Nat.succ_lt_succ r6'.isLt)) = + (⟨w.val, by omega⟩ : Fin (S.length + 1)) := Fin.ext rfl + simpa [hi] using hwmissing + obtain ⟨pc, hpc⟩ := S.attaches r6' + let pc' : Fin 7 := ⟨pc.val, by simp [r6']⟩ + have hc0ends : G.ends c0 = s(y7, S.vertex ⟨pc'.val, by omega⟩) := by + have hi : Fin.castLT pc + (Nat.lt_trans pc.isLt (Nat.succ_lt_succ r6'.isLt)) = + (⟨pc'.val, by omega⟩ : Fin (S.length + 1)) := Fin.ext rfl + simpa [c0, y7, r6', hi] using hpc + have hc0_ne_f3 : c0 ≠ f3 := by + intro hEq + have hpairs : s(y7, S.vertex ⟨pc'.val, by omega⟩) = s(y2, y3) := by + rw [← hc0ends, hEq, hf3ends'] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact (hvertex_ne (i := (⟨7, by omega⟩ : Fin (S.length + 1))) + (j := (⟨2, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y7, y2] using hd.1) + · exact (hvertex_ne (i := (⟨7, by omega⟩ : Fin (S.length + 1))) + (j := (⟨3, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y7, y3] using hs.1) + have hc0_ne_alpha56 : c0 ≠ alpha56 := by + intro hEq + have hpairs : s(y7, S.vertex ⟨pc'.val, by omega⟩) = s(y5, y6) := by + rw [← hc0ends, hEq, halpha56ends'] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact (hvertex_ne (i := (⟨7, by omega⟩ : Fin (S.length + 1))) + (j := (⟨5, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y7, y5] using hd.1) + · exact (hvertex_ne (i := (⟨7, by omega⟩ : Fin (S.length + 1))) + (j := (⟨6, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y7, y6] using hs.1) + have hc0_ne_beta56 : c0 ≠ beta56 := by + intro hEq + have hpairs : s(y7, S.vertex ⟨pc'.val, by omega⟩) = s(y5, y6) := by + rw [← hc0ends, hEq, hbeta56ends'] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact (hvertex_ne (i := (⟨7, by omega⟩ : Fin (S.length + 1))) + (j := (⟨5, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y7, y5] using hd.1) + · exact (hvertex_ne (i := (⟨7, by omega⟩ : Fin (S.length + 1))) + (j := (⟨6, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y7, y6] using hs.1) + have hc0_ne_closing : c0 ≠ M.closingEdge := by + intro hEq + have hpairs : s(y7, S.vertex ⟨pc'.val, by omega⟩) = s(y4, y0) := by + rw [← hc0ends, hEq, hclosingEnds] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact (hvertex_ne (i := (⟨7, by omega⟩ : Fin (S.length + 1))) + (j := (⟨4, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y7, y4] using hd.1) + · exact (hvertex_ne (i := (⟨7, by omega⟩ : Fin (S.length + 1))) + (j := (⟨0, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y7, y0] using hs.1) + have no_y7_of_ends {f : E} {u v : V} (hf : G.ends f = s(u, v)) + (hu : u ≠ y7) (hv : v ≠ y7) : ¬ Incident G y7 f := by + exact @helper_no_y7_of_ends_1435 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e) (@psi) (@S) (@M) (@hlen) (@f) (@u) (@v) (@hf) (@hu) (@hv) + have hy0_7 : y0 ≠ y7 := by apply hvertex_ne; norm_num + have hy1_7 : y1 ≠ y7 := by apply hvertex_ne; norm_num + have hy2_7 : y2 ≠ y7 := by apply hvertex_ne; norm_num + have hy3_7 : y3 ≠ y7 := by apply hvertex_ne; norm_num + have hy4_7 : y4 ≠ y7 := by apply hvertex_ne; norm_num + have hy5_7 : y5 ≠ y7 := by apply hvertex_ne; norm_num + have hy6_7 : y6 ≠ y7 := by apply hvertex_ne; norm_num + have hv1_7 : v1 ≠ y7 := by + rcases horient with h | h + · exact h.2.1 ▸ hy5_7 + · exact h.2.2.2 ▸ hy6_7 + have hv2_7 : v2 ≠ y7 := by + rcases horient with h | h + · exact h.2.2.2 ▸ hy6_7 + · exact h.2.1 ▸ hy5_7 + exact @helper_continuation_1474 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hgraphHeight) (@e) (@psi) (@S) (@M) (@hbal) (@hlen) (@hheight) + (@g0) (@hproper) (@horderM) (@helem) (@hclosed) (@hvertex_ne) (@hedge_ne) (@hmem) + (@missing_excludes) (@h4') (@h5') (@hg0') (@p0) (@hb0ends) (@p1) (@hb1ends) (@hp1not5) + (@f1) (@f2) (@f3) (@v1) (@v2) (@hf1color) (@hf2color) (@hf3color) (@hv10) (@hv14) + (@hf1ends') (@hf2ends') (@hf3ends') (@hb01ne) (@horient) (@alpha56) (@beta56) + (@halpha56color) (@hbeta56ends) (@hbeta56color) (@halpha56ends') (@hbeta56ends') (@ha1ends) + (@ha2ends) (@ha3ends) (@hclosingEnds) (@ha1color) (@ha2color) (@ha3color) (@hclosingColor) + (@hab) (@hg0alpha) (@hg0beta) (@w) (@g1) (@hc1color) (@hc0color') (@hwmissing') (@pc) + (@hc0ends) (@hc0_ne_f3) (@hc0_ne_alpha56) (@hc0_ne_beta56) (@hc0_ne_closing) + (@no_y7_of_ends) (@hy0_7) (@hy1_7) (@hy2_7) (@hy3_7) (@hy4_7) (@hy5_7) (@hy6_7) (@hv1_7) + (@hv2_7) +private theorem helper_missing_excludes_2266.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (psi : PartialEdgeColoring E k) {c : Fin k} + {v : V} {f : E}, + c ∈ MissingColors G psi v → + Incident G v f → + psi f ≠ some c := by + classical + intro V E _ _ G k psi c v f hc hinc hfc + let _ := Fintype.ofFinite V + have hp : c ∈ PresentColors G psi v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hinc, hfc⟩ + have hn : c ∉ PresentColors G psi v := by + simpa [MissingColors] using hc + exact hn hp + +private theorem helper_hq0cases_2300.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) {e : E} + (psi : PartialEdgeColoring E k) (S : TreeSequence G e) + (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y5 : V := + S.vertex + (⟨(5 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))); + let b0 : E := + S.edge + (⟨(4 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length); + ∀ (q0 : Fin (5 : ℕ)), + G.ends + (S.edge + (⟨(4 : ℕ) + (↑(0 : Fin (2 : ℕ)) : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + s(S.vertex + (⟨(↑q0 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))), + S.vertex + (⟨(5 : ℕ) + (↑(0 : Fin (2 : ℕ)) : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ)))) → + G.ends b0 = + s(S.vertex + (⟨(0 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))), + y5) ∨ + G.ends b0 = + s(S.vertex + (⟨(1 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))), + y5) ∨ + G.ends b0 = + s(S.vertex + (⟨(2 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))), + y5) ∨ + G.ends b0 = + s(S.vertex + (⟨(3 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))), + y5) ∨ + G.ends b0 = + s(S.vertex + (⟨(4 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))), + y5) := by + classical + intro V E _ _ _ G k e psi S M hlen y5 b0 q0 hq0ends + have hcases : q0.val = 0 ∨ q0.val = 1 ∨ q0.val = 2 ∨ + q0.val = 3 ∨ q0.val = 4 := by omega + rcases hcases with h | h | h | h | h + · left; simpa [b0, y5, h] using hq0ends + · right; left; simpa [b0, y5, h] using hq0ends + · right; right; left; simpa [b0, y5, h] using hq0ends + · right; right; right; left; simpa [b0, y5, h] using hq0ends + · right; right; right; right; simpa [b0, y5, h] using hq0ends + +private theorem helper_classifyFirst_2342.{u_1, u_2} : + helperClassifyFirst2342Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen g0 hproper y0 y1 y2 y3 y4 b0 b1 hvertex_ne + missing_excludes h4' h5' hg0' hfirstAttach f1 f2 f3 v1 v2 hf1color hf2color hf3color + hf1ends' hf2ends' hf3ends' j + obtain ⟨q, hq⟩ := hfirstAttach j + let bj : E := S.edge ⟨4 + j.val, by omega⟩ + let z : V := S.vertex ⟨5 + j.val, by omega⟩ + have hbjends : G.ends bj = s(S.vertex ⟨q.val, by omega⟩, z) := by + simpa [bj, z] using hq + have hbjcolor : psi bj = some g0 := by + have hj : j.val = 0 ∨ j.val = 1 := by omega + rcases hj with hj | hj + · have : j = (0 : Fin 2) := Fin.ext hj + subst j + simpa [bj, b0] using h4' + · have : j = (1 : Fin 2) := Fin.ext hj + subst j + simpa [bj, b1] using h5' + have hz0 : z ≠ y0 := by + apply hvertex_ne + apply Fin.ne_of_val_ne + change 5 + j.val ≠ 0 + omega + have hz1 : z ≠ y1 := by + apply hvertex_ne + apply Fin.ne_of_val_ne + change 5 + j.val ≠ 1 + omega + have hz2 : z ≠ y2 := by + apply hvertex_ne + apply Fin.ne_of_val_ne + change 5 + j.val ≠ 2 + omega + have hz3 : z ≠ y3 := by + apply hvertex_ne + apply Fin.ne_of_val_ne + change 5 + j.val ≠ 3 + omega + have hz4 : z ≠ y4 := by + apply hvertex_ne + apply Fin.ne_of_val_ne + change 5 + j.val ≠ 4 + omega + have hq0 : q.val ≠ 0 := by + intro hqv + have hinc : Incident G y0 bj := by + rw [Incident, hbjends] + have hv : S.vertex ⟨q.val, by omega⟩ = y0 := by + apply congrArg S.vertex + apply Fin.ext + simpa [y0] using hqv + rw [hv] + simp + exact (missing_excludes hg0' hinc) hbjcolor + have hbjf3 : bj ≠ f3 := by + intro hEq + have hpairs : s(S.vertex ⟨q.val, by omega⟩, z) = s(y2, y3) := by + rw [← hbjends, hEq, hf3ends'] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hz3 hd.2 + · exact hz2 hs.2 + have hq2 : q.val ≠ 2 := by + intro hqv + have hincb : Incident G y2 bj := by + rw [Incident, hbjends] + have hv : S.vertex ⟨q.val, by omega⟩ = y2 := by + apply congrArg S.vertex + apply Fin.ext + simpa [y2] using hqv + rw [hv] + simp + have hincf : Incident G y2 f3 := by + rw [Incident, hf3ends'] + simp + exact (hproper hbjf3 ⟨y2, hincb, hincf⟩ hbjcolor) hf3color + have hq3 : q.val ≠ 3 := by + intro hqv + have hincb : Incident G y3 bj := by + rw [Incident, hbjends] + have hv : S.vertex ⟨q.val, by omega⟩ = y3 := by + apply congrArg S.vertex + apply Fin.ext + simpa [y3] using hqv + rw [hv] + simp + have hincf : Incident G y3 f3 := by + rw [Incident, hf3ends'] + simp + exact (hproper hbjf3 ⟨y3, hincb, hincf⟩ hbjcolor) hf3color + have hqcases : q.val = 1 ∨ q.val = 4 := by omega + rcases hqcases with hq1 | hq4 + · exact @helper_branch_380 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by + assumption) (@g0) (by + assumption) (@f1) (@f2) (@v1) (@v2) (by + assumption) (by + assumption) (@j) (@q) (by + assumption) (by + assumption) (by + assumption) (by + assumption) + · exact @helper_branch_409 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by + assumption) (@g0) (by + assumption) (@f1) (@f2) (@v1) (@v2) (by + assumption) (by + assumption) (@j) (@q) (by + assumption) (by + assumption) (by + assumption) (by + assumption) + +private theorem helper_finish_837.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T), + ScheideGraphHeight G = (5 : ℕ) → + let _ : DecidableEq V := Classical.decEq V; + let Good : + {e : E} → + (psi : PartialEdgeColoring E k) → + (S : TreeSequence G e) → + NormalGlobalMaximumTriple G k e psi S → + Prop := + fun {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S) ↦ + ∃ (_ : BalancedGlobalMaximumTriple M) (x : S.length = (8 : ℕ)) (_ : + M.height = (5 : ℕ)) (gamma : + Fin (2 : ℕ) → + Fin k), + Function.Injective gamma ∧ + ( + ∀ (i j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), + G.ends + (S.edge + (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), by omega⟩ : + Fin S.length)) = + s(S.vertex (⟨(↑q : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))), + S.vertex + (⟨(5 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), by omega⟩ : + Fin (S.length + (1 : ℕ))))) ∧ + ( + ∀ (i j : Fin (2 : ℕ)), + psi + (S.edge + (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), by omega⟩ : + Fin S.length)) = + some (gamma i)) ∧ + ( + ∀ (i : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), + gamma i ∈ + MissingColors G psi + (S.vertex (⟨(↑q : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))))) ∧ + ∀ (i : Fin (4 : ℕ)), + (1 : ℕ) ≤ (↑i : ℕ) → + ∀ (c : Fin k), + psi (S.edge (⟨(↑i : ℕ), by omega⟩ : Fin S.length)) = some c → + ∀ (r : Fin (2 : ℕ)), + c ≠ gamma r; + ∀ {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S), + BalancedGlobalMaximumTriple M → + ∀ (hlen : S.length = (8 : ℕ)), + M.height = (5 : ℕ) → + ∀ (g0 : Fin k), + psi (S.edge (⟨(4 : ℕ), by omega⟩ : Fin S.length)) = some g0 → + psi (S.edge (⟨(5 : ℕ), by omega⟩ : Fin S.length)) = some g0 → + g0 ∈ MissingColors G psi (S.vertex (⟨(0 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) → + ∃ (e' : E) (psi' : PartialEdgeColoring E k) (S' : TreeSequence G e') (M' : + NormalGlobalMaximumTriple G k e' psi' S'), + Good psi' S' M' := by + classical + intro V E _ _ _ G k e0 phi T N hgraphHeight this Good e psi S M hbal hlen hheight g0 h4 h5 hg0 + have hproper : IsProperEdgeColoring G psi := M.global.1.2.2.2.1 + have horderM := ScheideGlobalMaximumOrder G k e psi S M.global + have helem : ColoredVertexSetElementary G psi + (TreeSequenceVertexSet S) := horderM.2.2.2.1 + have hclosed : ColoredVertexSetClosed G psi + (TreeSequenceVertexSet S) := horderM.2.2.2.2 + let y0 : V := S.vertex ⟨0, by omega⟩ + let y1 : V := S.vertex ⟨1, by omega⟩ + let y2 : V := S.vertex ⟨2, by omega⟩ + let y3 : V := S.vertex ⟨3, by omega⟩ + let y4 : V := S.vertex ⟨4, by omega⟩ + let y5 : V := S.vertex ⟨5, by omega⟩ + let y6 : V := S.vertex ⟨6, by omega⟩ + let y7 : V := S.vertex ⟨7, by omega⟩ + let y8 : V := S.vertex ⟨8, by omega⟩ + let a1 : E := S.edge ⟨1, by omega⟩ + let a2 : E := S.edge ⟨2, by omega⟩ + let a3 : E := S.edge ⟨3, by omega⟩ + let b0 : E := S.edge ⟨4, by omega⟩ + let b1 : E := S.edge ⟨5, by omega⟩ + let c0 : E := S.edge ⟨6, by omega⟩ + let c1 : E := S.edge ⟨7, by omega⟩ + have hvertex_ne {i j : Fin (S.length + 1)} (hij : i ≠ j) : + S.vertex i ≠ S.vertex j := fun h => hij (S.vertex_injective h) + have hedge_ne {i j : Fin S.length} (hij : i ≠ j) : + S.edge i ≠ S.edge j := fun h => hij (S.edge_injective h) + have hmem (i : Fin (S.length + 1)) : + S.vertex i ∈ TreeSequenceVertexSet S := by + simp [TreeSequenceVertexSet] + have missing_excludes {c : Fin k} {v : V} {f : E} + (hc : c ∈ MissingColors G psi v) (hinc : Incident G v f) : + psi f ≠ some c := by + exact @helper_missing_excludes_2266 (@V) (@E) inferInstance inferInstance (@G) (@k) (@psi) + (@c) (@v) (@f) (@hc) (@hinc) + have h4' : psi b0 = some g0 := by simpa [b0] using h4 + have h5' : psi b1 = some g0 := by simpa [b1] using h5 + have hg0' : g0 ∈ MissingColors G psi y0 := by simpa [y0] using hg0 + obtain ⟨p0, hp0⟩ := S.attaches (⟨4, by omega⟩ : Fin S.length) + have hb0ends : G.ends b0 = s(y5, + S.vertex (Fin.castLT p0 + (Nat.lt_trans p0.isLt + (Nat.succ_lt_succ (⟨4, by omega⟩ : Fin S.length).isLt)))) := by + simpa [b0, y5] using hp0 + obtain ⟨p1, hp1⟩ := S.attaches (⟨5, by omega⟩ : Fin S.length) + have hb1ends : G.ends b1 = s(y6, + S.vertex (Fin.castLT p1 + (Nat.lt_trans p1.isLt + (Nat.succ_lt_succ (⟨5, by omega⟩ : Fin S.length).isLt)))) := by + simpa [b1, y6] using hp1 + have hp1not5 : p1.val ≠ 5 := by + exact @helper_hp1not5_194 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by + assumption) (@g0) (by + assumption) (by + assumption) (by + assumption) (by + assumption) (@p0) (by + assumption) (@p1) (by + assumption) + have hfirstAttach : ∀ j : Fin 2, ∃ q : Fin 5, + G.ends (S.edge ⟨4 + j.val, by omega⟩) = + s(S.vertex ⟨q.val, by omega⟩, + S.vertex ⟨5 + j.val, by omega⟩) := by + exact @helper_hfirstAttach_212 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by + assumption) (@p0) (by + assumption) (@p1) (by + assumption) (by + assumption) + obtain ⟨q0, hq0ends⟩ := hfirstAttach (0 : Fin 2) + have hq0cases : + G.ends b0 = s(S.vertex ⟨0, by omega⟩, y5) ∨ + G.ends b0 = s(S.vertex ⟨1, by omega⟩, y5) ∨ + G.ends b0 = s(S.vertex ⟨2, by omega⟩, y5) ∨ + G.ends b0 = s(S.vertex ⟨3, by omega⟩, y5) ∨ + G.ends b0 = s(S.vertex ⟨4, by omega⟩, y5) := by + exact @helper_hq0cases_2300 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e) (@psi) (@S) (@M) (@hlen) (@q0) (@hq0ends) + have hy5T : y5 ∈ TreeSequenceVertexSet S := by + simpa [y5] using hmem (⟨5, by omega⟩ : Fin (S.length + 1)) + have hy50 : y5 ≠ y0 := by + apply hvertex_ne + norm_num + have hy51 : y5 ≠ y1 := by + apply hvertex_ne + norm_num + have hy52 : y5 ≠ y2 := by + apply hvertex_ne + norm_num + have hy53 : y5 ≠ y3 := by + apply hvertex_ne + norm_num + have hy54 : y5 ≠ y4 := by + apply hvertex_ne + norm_num + obtain ⟨f1, f2, f3, v1, v2, hf1ends, hf2ends, hf3ends, + hf1color, hf2color, hf3color, hv1T, hv2T, hv10, hv11, hv12, + hv13, hv14, hv20, hv21, hv22, hv23, hv24⟩ := + ScheideHeightFiveGammaEdges G k e psi S M hheight hgraphHeight g0 + (by simpa [y0] using hg0') b0 y5 h4' hq0cases hy5T + (by simpa [y0] using hy50) (by simpa [y1] using hy51) + (by simpa [y2] using hy52) (by simpa [y3] using hy53) + (by simpa [y4] using hy54) + have hf1ends' : G.ends f1 = s(y1, v1) := by simpa [y1] using hf1ends + have hf2ends' : G.ends f2 = s(y4, v2) := by simpa [y4] using hf2ends + have hf3ends' : G.ends f3 = s(y2, y3) := by simpa [y2, y3] using hf3ends + have classifyFirst : ∀ j : Fin 2, + (S.edge ⟨4 + j.val, by omega⟩ = f1 ∧ + S.vertex ⟨5 + j.val, by omega⟩ = v1) ∨ + (S.edge ⟨4 + j.val, by omega⟩ = f2 ∧ + S.vertex ⟨5 + j.val, by omega⟩ = v2) := by + exact @helper_classifyFirst_2342 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (@hlen) (@g0) (@hproper) (@hvertex_ne) + (@missing_excludes) (@h4') (@h5') (@hg0') (@hfirstAttach) (@f1) (@f2) (@f3) (@v1) (@v2) + (@hf1color) (@hf2color) (@hf3color) (@hf1ends') (@hf2ends') (@hf3ends') + exact @helper_continuation_995 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@hgraphHeight) (@e) (@psi) (@S) (@M) (@hbal) (@hlen) (@hheight) + (@g0) (@hproper) (@horderM) (@helem) (@hclosed) (@hvertex_ne) (@hedge_ne) (@hmem) + (@missing_excludes) (@h4') (@h5') (@hg0') (@p0) (@hb0ends) (@p1) (@hb1ends) (@hp1not5) + (@f1) (@f2) (@f3) (@v1) (@v2) (@hf1ends) (@hf2ends) (@hf1color) (@hf2color) (@hf3color) + (@hv1T) (@hv2T) (@hv10) (@hv11) (@hv12) (@hv13) (@hv14) (@hv20) (@hv21) (@hv22) (@hv23) + (@hv24) (@hf1ends') (@hf2ends') (@hf3ends') (@classifyFirst) +private theorem helper_branch_2521.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T), + BalancedGlobalMaximumTriple N → + N.height = (5 : ℕ) → + ∀ (hlength : T.length = (8 : ℕ)), + let r4 : Fin T.length := + (⟨(4 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + let r5 : Fin T.length := + (⟨(5 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + ∀ (w0 : Fin ((↑r4 : ℕ) + (1 : ℕ))) (gamma0 : Fin k), + phi (T.edge r4) = some gamma0 → + gamma0 ∈ + MissingColors G phi + (T.vertex + (w0.castLT + (by + have := GoldbergSeymour.TreeSequence.positive T + omega))) → + phi (T.edge r5) = some gamma0 → + let Good : + {e : E} → + (psi : PartialEdgeColoring E k) → + (S : TreeSequence G e) → + NormalGlobalMaximumTriple G k e psi S → + Prop := + fun {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S) ↦ + ∃ (_ : BalancedGlobalMaximumTriple M) (x : S.length = (8 : ℕ)) (_ : + M.height = (5 : ℕ)) (gamma : + Fin (2 : ℕ) → + Fin k), + Function.Injective gamma ∧ + ( + ∀ (i j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), + G.ends + (S.edge + (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + s(S.vertex + (⟨(↑q : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))), + S.vertex + (⟨(5 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))))) ∧ + ( + ∀ (i j : Fin (2 : ℕ)), + psi + (S.edge + (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + some (gamma i)) ∧ + ( + ∀ (i : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), + gamma i ∈ + MissingColors G psi + (S.vertex + (⟨(↑q : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))))) ∧ + ∀ (i : Fin (4 : ℕ)), + (1 : ℕ) ≤ (↑i : ℕ) → + ∀ (c : Fin k), + psi + (S.edge + (⟨(↑i : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + some c → + ∀ (r : Fin (2 : ℕ)), + c ≠ gamma r; + ( + ∀ {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S), + BalancedGlobalMaximumTriple M → + ∀ (hlen : S.length = (8 : ℕ)), + M.height = (5 : ℕ) → + ∀ (g0 : Fin k), + psi + (S.edge + (⟨(4 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + some g0 → + psi + (S.edge + (⟨(5 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + some g0 → + g0 ∈ + MissingColors G psi + (S.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ S.length⟩ : + Fin (S.length + (1 : ℕ)))) → + ∃ (e' : E) (psi' : PartialEdgeColoring E k) (S' : TreeSequence G e') + (M' : NormalGlobalMaximumTriple G k e' psi' S'), Good psi' S' M') → + (↑w0 : ℕ) = (0 : ℕ) → + ∃ (e1 : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e1) (M : + NormalGlobalMaximumTriple G k e1 psi S) (_ : BalancedGlobalMaximumTriple M) (x : + S.length = (8 : ℕ)) (_ : M.height = (5 : ℕ)) (gamma : + Fin (2 : ℕ) → + Fin k), + Function.Injective gamma ∧ + ( + ∀ (i j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), + G.ends + (S.edge + (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + s(S.vertex + (⟨(↑q : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))), + S.vertex + (⟨(5 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))))) ∧ + ( + ∀ (i j : Fin (2 : ℕ)), + psi + (S.edge + (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + some (gamma i)) ∧ + ( + ∀ (i : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), + gamma i ∈ + MissingColors G psi + (S.vertex + (⟨(↑q : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin (S.length + (1 : ℕ))))) ∧ + ∀ (i : Fin (4 : ℕ)), + (1 : ℕ) ≤ (↑i : ℕ) → + ∀ (c : Fin k), + psi + (S.edge + (⟨(↑i : ℕ), by + have := GoldbergSeymour.TreeSequence.positive S + omega⟩ : + Fin S.length)) = + some c → + ∀ (r : Fin (2 : ℕ)), + c ≠ gamma r := by + classical + intro V E _ _ _ G k e0 phi T N hbalanced hNheight hlength r4 r5 w0 gamma0 hr4color hw0missing + hr5color Good finish hw0zero + have hw0vertex : + T.vertex (Fin.castLT w0 + (Nat.lt_trans w0.isLt (Nat.succ_lt_succ r4.isLt))) = + T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ := by + apply congrArg T.vertex + apply Fin.ext + simpa using hw0zero + exact finish phi T N hbalanced hlength hNheight gamma0 + (by simpa [r4] using hr4color) + (by simpa [r5] using hr5color) + (by simpa [hw0vertex] using hw0missing) + +private theorem helper_branch_4561.{u_1, u_2} : + helperBranch4561Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hbalanced this hNheight hlength r4 r5 w0 gamma0 hr4color + hw0missing hr5color Good finish hw0zero + let j : Fin N.height := ⟨w0.val, by + have hw : w0.val < 5 := by simp [r4] + rw [hNheight] + exact hw⟩ + have hj : 1 ≤ j.val := by + simp [j] + omega + obtain ⟨psi, A, B, hAB, hA, hB, hproper, hone, hmissA, hmissB, + hshift, hfixed, htailColor⟩ := + ScheideTrunkRotationColoring G k e0 phi T N hbalanced j hj + obtain ⟨S, hglobalS, hlengthS, hverticesS, htrunkVerticesS, + htailVerticesS, htrunkEdgesS, htailEdgesS⟩ := + ScheideTrunkRotationTree G k e0 phi psi T N hbalanced j hj A B + hAB hA hB hproper hone hmissA hmissB hshift hfixed + obtain ⟨M, hheightM, halphaM, hbetaM, pred, hpred, hclosingM⟩ := + ScheideTrunkRotationNormal G k e0 phi psi T N hbalanced j hj A B + hAB hA hB hshift hfixed S hglobalS hmissA hmissB hlengthS + htrunkVerticesS htrunkEdgesS + have hbalM : BalancedGlobalMaximumTriple M := by + constructor + · rw [hheightM] + exact hbalanced.1 + · intro q hlow hupp + have hlow' : N.height < 2 * q := by + rw [hheightM] at hlow + exact hlow + have hupp' : 2 * q < T.length + 1 := by + rw [hlengthS] at hupp + exact hupp + have hqbound : 6 ≤ 2 * q := by + rw [hNheight] at hlow' + omega + let s4 : Fin S.length := ⟨2 * q - 2, by omega⟩ + let s5 : Fin S.length := ⟨2 * q - 1, by omega⟩ + obtain ⟨t4, ht4val, ht4edge⟩ := htailEdgesS s4 (by + dsimp [s4] + omega) + obtain ⟨t5, ht5val, ht5edge⟩ := htailEdgesS s5 (by + dsimp [s5] + omega) + have ht4 : t4 = (⟨2 * q - 2, by omega⟩ : Fin T.length) := by + apply Fin.ext + simpa [s4] using ht4val + have ht5 : t5 = (⟨2 * q - 1, by omega⟩ : Fin T.length) := by + apply Fin.ext + simpa [s5] using ht5val + change psi (S.edge s4) = psi (S.edge s5) + calc + psi (S.edge s4) = psi (T.edge t4) := congrArg psi ht4edge + _ = phi (T.edge t4) := htailColor t4 (by + rw [ht4, hNheight] + change 4 ≤ 2 * q - 2 + omega) + _ = phi (T.edge t5) := by + rw [ht4, ht5] + exact hbalanced.2 q hlow' hupp' + _ = psi (T.edge t5) := (htailColor t5 (by + rw [ht5, hNheight] + change 4 ≤ 2 * q - 1 + omega)).symm + _ = psi (S.edge s5) := congrArg psi ht5edge.symm + have hnewZero : S.vertex ⟨0, Nat.zero_lt_succ S.length⟩ = + T.vertex (Fin.castLE N.height_upper j) := by + obtain ⟨i, hi, hv⟩ := htrunkVerticesS + (⟨0, Nat.zero_lt_succ S.length⟩ : Fin (S.length + 1)) + (by simp [hNheight]) + have hij : i = j := by + apply Fin.ext + simpa [j, Nat.mod_eq_of_lt j.isLt] using hi + simpa [hij] using hv + have holdMissing : gamma0 ∈ MissingColors G phi + (T.vertex (Fin.castLE N.height_upper j)) := by + have hidx : Fin.castLT w0 + (Nat.lt_trans w0.isLt (Nat.succ_lt_succ r4.isLt)) = + Fin.castLE N.height_upper j := by + apply Fin.ext + rfl + simpa [hidx] using hw0missing + have horderData := ScheideGlobalMaximumOrder G k e0 phi T N.global + have helem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T) := horderData.2.2.2.1 + have hgammaAlpha : gamma0 ≠ N.alpha := by + intro hga + have hzeroMem : T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ ∈ + TreeSequenceVertexSet T := by simp [TreeSequenceVertexSet] + have hjMem : T.vertex (Fin.castLE N.height_upper j) ∈ + TreeSequenceVertexSet T := by simp [TreeSequenceVertexSet] + have hne : T.vertex (Fin.castLE N.height_upper j) ≠ + T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ := by + intro hv + have hi := T.vertex_injective hv + have hiv := congrArg Fin.val hi + have hz : j.val = 0 := by simpa using hiv + exact (Nat.ne_of_gt hj) hz + have hd := helem hjMem hzeroMem hne + exact (Finset.disjoint_left.mp hd) holdMissing + (by simpa [hga] using N.alpha_missing) + have hgammaNew : gamma0 ∈ MissingColors G psi + (S.vertex ⟨0, Nat.zero_lt_succ S.length⟩) := by + rw [hnewZero] + by_cases hgb : gamma0 = N.beta + · have hjone : j.val = 1 := by + by_contra hne + have honeMem : T.vertex ⟨1, by omega⟩ ∈ + TreeSequenceVertexSet T := by simp [TreeSequenceVertexSet] + have hjMem : T.vertex (Fin.castLE N.height_upper j) ∈ + TreeSequenceVertexSet T := by simp [TreeSequenceVertexSet] + have hvne : T.vertex (Fin.castLE N.height_upper j) ≠ + T.vertex ⟨1, by omega⟩ := by + intro hv + have hi := T.vertex_injective hv + exact hne (by simpa using congrArg Fin.val hi) + have hd := helem hjMem honeMem hvne + exact (Finset.disjoint_left.mp hd) holdMissing + (by simpa [hgb] using N.beta_missing) + have hjodd : Odd j.val := by + rw [hjone] + exact odd_one + have hAeq : A = gamma0 := by simpa [hgb, hjodd] using hA + simpa [hAeq] using hmissA + · have hgammaBeta : gamma0 ≠ N.beta := hgb + rw [MissingColors, Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + obtain ⟨f, hfinc, hfcolor⟩ := hpresent + by_cases haffected : ∃ i : Fin (j.val + 1), + f = NormalCycleEdge N + (Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i) + · obtain ⟨i, rfl⟩ := haffected + by_cases hilast : i.val = j.val + · have hieq : Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i = j := by + apply Fin.ext + simpa using hilast + have hu := hone.1 + rw [hieq] at hfcolor + rw [hfcolor] at hu + simp at hu + · let t : Fin j.val := ⟨i.val, by omega⟩ + have hcast : Fin.castLE (Nat.le_of_lt j.isLt) t = + Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i := by + apply Fin.ext + rfl + have hs := hshift t + rw [hcast, hfcolor] at hs + have hcycle := + (ScheideTrunkRotationCycle G k e0 phi T N hbalanced).2.2.2.2 + (⟨t.val + 1, by + have htj := t.isLt + have hjN := j.isLt + omega⟩ : Fin N.height) (Nat.succ_le_succ (Nat.zero_le _)) + by_cases ho : Odd (t.val + 1) + · rw [ite_eq_left ho] at hcycle + have : gamma0 = N.alpha := Option.some.inj (hs.trans hcycle) + exact hgammaAlpha this + · rw [ite_eq_right ho] at hcycle + have : gamma0 = N.beta := Option.some.inj (hs.trans hcycle) + exact hgammaBeta this + · have hfix := hfixed f (by + intro i hi + exact haffected ⟨i, hi⟩) + have holdColor : phi f = some gamma0 := hfix.symm.trans hfcolor + have hnotPresent : gamma0 ∉ PresentColors G phi + (T.vertex (Fin.castLE N.height_upper j)) := by + simpa [MissingColors] using holdMissing + exact hnotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hfinc, holdColor⟩) + have hS4 : psi (S.edge ⟨4, by omega⟩) = some gamma0 := by + obtain ⟨t, htval, htedge⟩ := htailEdgesS + (⟨4, by omega⟩ : Fin S.length) (by simp [hNheight]) + have ht : t = r4 := by + apply Fin.ext + simpa [r4] using htval + calc + psi (S.edge ⟨4, by omega⟩) = psi (T.edge t) := congrArg psi htedge + _ = psi (T.edge r4) := congrArg (fun f => psi (T.edge f)) ht + _ = phi (T.edge r4) := htailColor r4 (by simp [hNheight, r4]) + _ = some gamma0 := hr4color + have hS5 : psi (S.edge ⟨5, by omega⟩) = some gamma0 := by + obtain ⟨t, htval, htedge⟩ := htailEdgesS + (⟨5, by omega⟩ : Fin S.length) (by simp [hNheight]) + have ht : t = r5 := by + apply Fin.ext + simpa [r5] using htval + calc + psi (S.edge ⟨5, by omega⟩) = psi (T.edge t) := congrArg psi htedge + _ = psi (T.edge r5) := congrArg (fun f => psi (T.edge f)) ht + _ = phi (T.edge r5) := htailColor r5 (by simp [hNheight, r5]) + _ = some gamma0 := hr5color + exact finish psi S M hbalM + (hlengthS.trans hlength) (hheightM.trans hNheight) gamma0 hS4 hS5 + hgammaNew + +theorem ScheideOrderNineBlockStructure {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hbalanced : BalancedGlobalMaximumTriple N) + (horder : TashkinovOrder G = 9) + (hgraphHeight : ScheideGraphHeight G = 5) : + ∃ (e1 : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e1) + (M : NormalGlobalMaximumTriple G k e1 psi S), + ∃ (_ : BalancedGlobalMaximumTriple M) (_ : S.length = 8) + (_ : M.height = 5) (gamma : + Fin 2 → + Fin k), + Function.Injective gamma ∧ + ( + ∀ (i : Fin 2) (j : Fin 2), + ∃ q : Fin 5, + G.ends (S.edge ⟨4 + 2 * i.val + j.val, by omega⟩) = + s(S.vertex ⟨q.val, by omega⟩, + S.vertex ⟨5 + 2 * i.val + j.val, by omega⟩)) ∧ + ( + ∀ (i : Fin 2) (j : Fin 2), + psi (S.edge ⟨4 + 2 * i.val + j.val, by omega⟩) = + some (gamma i)) ∧ + ( + ∀ i : Fin 2, + ∃ q : Fin 5, + gamma i ∈ MissingColors G psi (S.vertex ⟨q.val, by omega⟩)) ∧ + ( + ∀ i : Fin 4, + 1 ≤ i.val → + ∀ c : Fin k, + psi (S.edge ⟨i.val, by omega⟩) = some c → + ∀ r : Fin 2, + c ≠ gamma r) := by + classical + let : DecidableEq V := Classical.decEq V + have hNheight : N.height = 5 := hbalanced.1.trans hgraphHeight + have hvertexCard : (TreeSequenceVertexSet T).card = T.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + T.vertex_injective] + have hlength : T.length = 8 := by + have hcard := N.global.2.2 + rw [horder] at hcard + omega + let r4 : Fin T.length := ⟨4, by omega⟩ + let r5 : Fin T.length := ⟨5, by omega⟩ + let r6 : Fin T.length := ⟨6, by omega⟩ + let r7 : Fin T.length := ⟨7, by omega⟩ + obtain ⟨w0, gamma0, hr4color, hw0missing⟩ := + N.global.2.1 r4 (by simp [r4]) + have hr5color : phi (T.edge r5) = some gamma0 := by + have hp := hbalanced.2 3 (by omega) (by omega) + simpa [r4, r5] using hp.symm.trans hr4color + obtain ⟨w1, gamma1, hr6color, hw1missing⟩ := + N.global.2.1 r6 (by simp [r6]) + have hr7color : phi (T.edge r7) = some gamma1 := by + have hp := hbalanced.2 4 (by omega) (by omega) + simpa [r6, r7] using hp.symm.trans hr6color + let Good {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S) : Prop := + ∃ (_ : BalancedGlobalMaximumTriple M) (_ : S.length = 8) + (_ : M.height = 5) (gamma : Fin 2 → Fin k), + Function.Injective gamma ∧ + (∀ (i : Fin 2) (j : Fin 2), + ∃ q : Fin 5, + G.ends (S.edge ⟨4 + 2 * i.val + j.val, by omega⟩) = + s(S.vertex ⟨q.val, by omega⟩, + S.vertex ⟨5 + 2 * i.val + j.val, by omega⟩)) ∧ + (∀ (i : Fin 2) (j : Fin 2), + psi (S.edge ⟨4 + 2 * i.val + j.val, by omega⟩) = + some (gamma i)) ∧ + (∀ i : Fin 2, ∃ q : Fin 5, + gamma i ∈ MissingColors G psi (S.vertex ⟨q.val, by omega⟩)) ∧ + (∀ i : Fin 4, 1 ≤ i.val → + ∀ c : Fin k, psi (S.edge ⟨i.val, by omega⟩) = some c → + ∀ r : Fin 2, c ≠ gamma r) + have finish {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S) + (hbal : BalancedGlobalMaximumTriple M) + (hlen : S.length = 8) (hheight : M.height = 5) + (g0 : Fin k) + (h4 : psi (S.edge ⟨4, by omega⟩) = some g0) + (h5 : psi (S.edge ⟨5, by omega⟩) = some g0) + (hg0 : g0 ∈ MissingColors G psi + (S.vertex ⟨0, Nat.zero_lt_succ S.length⟩)) : + ∃ (e' : E) (psi' : PartialEdgeColoring E k) (S' : TreeSequence G e') + (M' : NormalGlobalMaximumTriple G k e' psi' S'), Good psi' S' M' := by + exact @helper_finish_837 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (by + assumption) (@e) (@psi) (@S) (@M) (by + assumption) (by + assumption) (by + assumption) (@g0) (by + assumption) (by + assumption) (by + assumption) + by_cases hw0zero : w0.val = 0 + · exact @helper_branch_2521 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hbalanced) (@hNheight) (@hlength) (@w0) (@gamma0) (@hr4color) + (@hw0missing) (@hr5color) (@finish) (@hw0zero) + · exact @helper_branch_4561 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@hbalanced) (@hNheight) (@hlength) (@w0) (@gamma0) (@hr4color) + (@hw0missing) (@hr5color) (@finish) (@hw0zero) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineExitLocalization.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineExitLocalization.lean new file mode 100644 index 0000000000..2927bcb70f --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineExitLocalization.lean @@ -0,0 +1,237 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideExitNoFree +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Order Nine Exit Localization + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideOrderNineExitLocalization {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (_ : BalancedGlobalMaximumTriple N) + (hlength : T.length = 8) (hheight : N.height = 5) + (gamma : Fin 2 → Fin k) + (_ : Function.Injective gamma) + (hblockColor : ∀ (i : Fin 2) (j : Fin 2), + phi (T.edge ⟨4 + 2 * i.val + j.val, by omega⟩) = + some (gamma i)) + (_ : ∀ i : Fin 2, ∃ q : Fin 5, + gamma i ∈ MissingColors G phi (T.vertex ⟨q.val, by omega⟩)) + (_ : ∀ i : Fin 4, 1 ≤ i.val → + ∀ c : Fin k, phi (T.edge ⟨i.val, by omega⟩) = some c → + ∀ r : Fin 2, c ≠ gamma r) : + ∀ v ∈ ScheideExitVertices T phi, + ∃ i : Fin 2, + gamma i ∈ MissingColors G phi v := by + classical + let : DecidableEq V := Classical.decEq V + have horder := ScheideGlobalMaximumOrder G k e0 phi T N.global + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := + horder.2.2.2.1 + let y0 : V := T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ + let y1 : V := T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩ + have hy0T : y0 ∈ TreeSequenceVertexSet T := by + simp [y0, TreeSequenceVertexSet] + have hy1T : y1 ∈ TreeSequenceVertexSet T := by + simp [y1, TreeSequenceVertexSet] + have hy01 : y0 ≠ y1 := by + intro h + have hi := T.vertex_injective h + simp [] at hi + have he0ends : G.ends e0 = s(y1, y0) := by + rw [← T.first_edge] + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + have hiz : i = ⟨0, by omega⟩ := Fin.eq_zero i + subst i + rw [hi] + congr 2 + have hy0inc : Incident G y0 e0 := by + unfold Incident + rw [he0ends] + simp [Sym2.mem_iff] + have hy1inc : Incident G y1 e0 := by + unfold Incident + rw [he0ends] + simp [Sym2.mem_iff] + have incident_cases {v : V} (hv : Incident G v e0) : v = y0 ∨ v = y1 := by + unfold Incident at hv + rw [he0ends, Sym2.mem_iff] at hv + exact hv.symm + have edge_color_of_closing_support (f : E) + (hf : Sum.inr f ∈ N.closingPath.support) : + phi f = some N.alpha ∨ phi f = some N.beta := by + obtain ⟨i, hi, hile⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hilt : i < N.closingPath.length := by + by_contra hn + have hil : N.closingPath.length ≤ i := by omega + have hend := N.closingPath.getVert_of_length_le (i := i) hil + rw [hi] at hend + simp at hend + have hadj := N.closingPath.adj_getVert_succ hilt + rw [hi] at hadj + cases hz : N.closingPath.getVert (i + 1) with + | inl v => + rw [hz] at hadj + have hdata : Incident G v f ∧ + (phi f = some N.alpha ∨ phi f = some N.beta) := by + simpa [TwoColorIncidenceGraph] using hadj + exact hdata.2 + | inr e => + rw [hz] at hadj + simp [TwoColorIncidenceGraph] at hadj + have hnormalColor : ∀ j : Fin T.length, 1 ≤ j.val → j.val < 4 → + phi (T.edge j) = some N.alpha ∨ phi (T.edge j) = some N.beta := by + intro j hjpos hjlt + apply edge_color_of_closing_support + apply (N.closingPath_edges (T.edge j)).2 + exact Or.inr ⟨j, hjpos, by omega, rfl⟩ + have hused : ∀ c : Fin k, c ∈ TreeUsedColors phi T → + c = N.alpha ∨ c = N.beta ∨ ∃ i : Fin 2, c = gamma i := by + intro c hc + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc + obtain ⟨j, hjpos, hjcolor⟩ := hc + have hjlt : j.val < 8 := by + rw [← hlength] + exact j.isLt + by_cases hjbase : j.val < 4 + · rcases hnormalColor j hjpos hjbase with ha | hb + · exact Or.inl (Option.some.inj (hjcolor.symm.trans ha)) + · exact Or.inr (Or.inl (Option.some.inj (hjcolor.symm.trans hb))) + · have hvals : j.val = 4 ∨ j.val = 5 ∨ j.val = 6 ∨ j.val = 7 := by + omega + rcases hvals with hval | hval | hval | hval + · right; right + have hjEq : j = ⟨4, by omega⟩ := Fin.ext hval + rw [hjEq] at hjcolor + refine ⟨⟨0, by omega⟩, ?_⟩ + exact Option.some.inj (hjcolor.symm.trans (by + simpa using hblockColor ⟨0, by omega⟩ ⟨0, by omega⟩)) + · right; right + have hjEq : j = ⟨5, by omega⟩ := Fin.ext hval + rw [hjEq] at hjcolor + refine ⟨⟨0, by omega⟩, ?_⟩ + exact Option.some.inj (hjcolor.symm.trans (by + simpa using hblockColor ⟨0, by omega⟩ ⟨1, by omega⟩)) + · right; right + have hjEq : j = ⟨6, by omega⟩ := Fin.ext hval + rw [hjEq] at hjcolor + refine ⟨⟨1, by omega⟩, ?_⟩ + exact Option.some.inj (hjcolor.symm.trans (by + simpa using hblockColor ⟨1, by omega⟩ ⟨0, by omega⟩)) + · right; right + have hjEq : j = ⟨7, by omega⟩ := Fin.ext hval + rw [hjEq] at hjcolor + refine ⟨⟨1, by omega⟩, ?_⟩ + exact Option.some.inj (hjcolor.symm.trans (by + simpa using hblockColor ⟨1, by omega⟩ ⟨1, by omega⟩)) + intro v hvExit + have hExitPred : ScheideExitVertex T phi v := by + simpa [ScheideExitVertices] using hvExit + obtain ⟨u, gamma', delta, hu, hgammaMissing, hdelta, z, p, hp, + i, hi, hvT, hafter⟩ := hExitPred + by_contra hgoal + push Not at hgoal + have hcounts := ScheideGlobalMaximumMissingCounts G k e0 phi T N.global v hvT + have find_free (hc : Fin k) (hcMissing : hc ∈ MissingColors G phi v) + (hcAlpha : hc ≠ N.alpha) (hcBeta : hc ≠ N.beta) : False := by + have hcGamma : ∀ r : Fin 2, hc ≠ gamma r := by + intro r hcr + apply hgoal r + simpa [← hcr] using hcMissing + have hcNotUsed : hc ∉ TreeUsedColors phi T := by + intro hcUsed + rcases hused hc hcUsed with h | h | ⟨r, h⟩ + · exact hcAlpha h + · exact hcBeta h + · exact hcGamma r h + have hcTreeMissing : hc ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hvT, hcMissing⟩ + have hcFree : hc ∈ TreeFreeColors phi T := by + exact Finset.mem_sdiff.mpr ⟨hcTreeMissing, hcNotUsed⟩ + have hnoFree := ScheideExitNoFree G k e0 phi T N.global v hvExit + exact (Finset.disjoint_left.mp hnoFree) hcMissing hcFree + by_cases hvInc : Incident G v e0 + · rcases incident_cases hvInc with rfl | rfl + · obtain ⟨c, hc, hcAlpha⟩ := + Finset.exists_mem_ne ((hcounts.1 hy0inc).2) N.alpha + have hcBeta : c ≠ N.beta := by + intro hcb + have hd := helem hy0T hy1T hy01 + exact (Finset.disjoint_left.mp hd) hc (by + simpa [hcb, y1] using N.beta_missing) + exact find_free c hc hcAlpha hcBeta + · obtain ⟨c, hc, hcBeta⟩ := + Finset.exists_mem_ne ((hcounts.1 hy1inc).2) N.beta + have hcAlpha : c ≠ N.alpha := by + intro hca + have hd := helem hy1T hy0T hy01.symm + exact (Finset.disjoint_left.mp hd) hc (by + simpa [hca, y0] using N.alpha_missing) + exact find_free c hc hcAlpha hcBeta + · have hnonempty : (MissingColors G phi v).Nonempty := + Finset.card_pos.mp (by have := (hcounts.2 hvInc).2; omega) + obtain ⟨c, hc⟩ := hnonempty + have hv0 : v ≠ y0 := by + intro h + subst v + exact hvInc hy0inc + have hv1 : v ≠ y1 := by + intro h + subst v + exact hvInc hy1inc + have hcAlpha : c ≠ N.alpha := by + intro hca + have hd := helem hvT hy0T hv0 + exact (Finset.disjoint_left.mp hd) hc (by + simpa [hca, y0] using N.alpha_missing) + have hcBeta : c ≠ N.beta := by + intro hcb + have hd := helem hvT hy1T hv1 + exact (Finset.disjoint_left.mp hd) hc (by + simpa [hcb, y1] using N.beta_missing) + exact find_free c hc hcAlpha hcBeta + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineParameters.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineParameters.lean new file mode 100644 index 0000000000..5f949df10e --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineParameters.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Critical +public import LeanPool.GoldbergSeymour.Elementary +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd +public import LeanPool.GoldbergSeymour.ScheideLargeHeightElementary +public import LeanPool.GoldbergSeymour.ScheideSmallHeightElementary +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Order Nine Parameters + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideOrderNineParameters {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) + (hcritical : Critical G) (hindex : ChromaticIndex G = k + 1) + (hdegree : MaximumDegree G + 1 ≤ k) + (hnoisolated : ∀ v : V, ∃ e : E, Incident G v e) + (hnonelementary : ¬ Elementary G) (horder : TashkinovOrder G < 11) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hbalanced : BalancedGlobalMaximumTriple N) : + TashkinovOrder G = 9 ∧ ScheideGraphHeight G = 5 ∧ T.length = 8 ∧ N.height = 5 := by + classical + let : DecidableEq V := Classical.decEq V + have hheight_ge : 5 ≤ ScheideGraphHeight G := by + by_contra h + have hsmall : ScheideGraphHeight G < 5 := by omega + exact hnonelementary + (ScheideSmallHeightElementary G k hcritical hindex hdegree + hnoisolated hsmall) + have hheight_le : ScheideGraphHeight G ≤ TashkinovOrder G - 4 := by + by_contra h + have hlarge : TashkinovOrder G - 4 < ScheideGraphHeight G := by omega + exact hnonelementary + (ScheideLargeHeightElementary G k hcritical hindex hdegree + hnoisolated hlarge) + have horder_data := ScheideGlobalMaximumOrder G k e0 phi T N.global + have hheight_odd : Odd (ScheideGraphHeight G) := + (ScheideGraphHeightOdd G k e0 phi T N.global).2 + have horder_odd : Odd (TashkinovOrder G) := by + rw [horder_data.1] + exact horder_data.2.2.1 + have hcard : (TreeSequenceVertexSet T).card = T.length + 1 := by + unfold TreeSequenceVertexSet + rw [Finset.card_image_of_injective Finset.univ T.vertex_injective] + simp + rcases hheight_odd with ⟨a, ha⟩ + rcases horder_odd with ⟨b, hb⟩ + have horder_eq : TashkinovOrder G = 9 := by omega + have hheight_eq : ScheideGraphHeight G = 5 := by omega + have hlength_eq : T.length = 8 := by omega + have hNheight : N.height = 5 := by + rw [hbalanced.1, hheight_eq] + exact ⟨horder_eq, hheight_eq, hlength_eq, hNheight⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineRebasingPreparation.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineRebasingPreparation.lean new file mode 100644 index 0000000000..d7ce490074 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineRebasingPreparation.lean @@ -0,0 +1,3816 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideOrderNineBlockCompletion +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideHeightFiveGammaEdges +public import LeanPool.GoldbergSeymour.ScheideHeightFiveOutsideLinks +public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationNormal +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationPreserves +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TrunkRotation +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import Mathlib.Tactic.FinCases + +/-! +# Scheide Order Nine Block Structure + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour.ScheideRebasing + +open scoped Sym2 + +/-- Dependent contract shared by the order-nine tree rebasing proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation995Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T), ScheideGraphHeight G = (5 : ℕ) → + let this : DecidableEq V := Classical.decEq V; + let Good : {e : E} → (psi : PartialEdgeColoring E k) → (S : TreeSequence G e) → + NormalGlobalMaximumTriple G k e psi S → Prop := fun {e : E} (psi : PartialEdgeColoring E + k) (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) ↦ + ∃ (_ : BalancedGlobalMaximumTriple M) (x : S.length = (8 : ℕ)) (_ : M.height = (5 : ℕ)) (gamma + : Fin (2 : ℕ) → Fin k), Function.Injective gamma ∧ ( + ∀ (i j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (S.edge (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length)) = s(S.vertex (⟨(↑q : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))), S.vertex (⟨(5 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))))) ∧ ( + ∀ (i j : Fin (2 : ℕ)), psi (S.edge (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length)) = some (gamma i)) ∧ ( + ∀ (i : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), gamma i ∈ MissingColors G psi (S.vertex (⟨(↑q : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))))) ∧ + ∀ (i : Fin (4 : ℕ)), (1 : ℕ) ≤ (↑i : ℕ) → + ∀ (c : Fin k), psi (S.edge (⟨(↑i : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length)) = some c → + ∀ (r : Fin (2 : ℕ)), c ≠ gamma r; + ∀ {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) (M : + NormalGlobalMaximumTriple G k e psi S), BalancedGlobalMaximumTriple M → + ∀ (hlen : S.length = (8 : ℕ)) (hheight : M.height = (5 : ℕ)) (g0 : Fin k), + IsProperEdgeColoring G psi → TashkinovOrder G = (TreeSequenceVertexSet S).card ∧ (3 : ℕ) ≤ + (TreeSequenceVertexSet S).card ∧ Odd (TreeSequenceVertexSet S).card ∧ + ColoredVertexSetElementary G psi (TreeSequenceVertexSet S) ∧ ColoredVertexSetClosed G psi + (TreeSequenceVertexSet S) → ColoredVertexSetElementary G psi (TreeSequenceVertexSet S) → + ColoredVertexSetClosed G psi (TreeSequenceVertexSet S) → + let y0 : V := S.vertex (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y1 : V := S.vertex (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y2 : V := S.vertex (⟨(2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y3 : V := S.vertex (⟨(3 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y5 : V := S.vertex (⟨(5 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y7 : V := S.vertex (⟨(7 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y8 : V := S.vertex (⟨(8 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let a1 : E := S.edge (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); + let a2 : E := S.edge (⟨(2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); + let a3 : E := S.edge (⟨(3 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); + let b0 : E := S.edge (⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); + let c0 : E := S.edge (⟨(6 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); + let c1 : E := S.edge (⟨(7 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); ( + ∀ {i j : Fin (S.length + (1 : ℕ))}, i ≠ j → S.vertex i ≠ S.vertex j) → ( + ∀ {i j : Fin S.length}, i ≠ j → S.edge i ≠ S.edge j) → ( + ∀ (i : Fin (S.length + (1 : ℕ))), S.vertex i ∈ TreeSequenceVertexSet S) → ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G psi v → Incident G v f → psi f ≠ some c) → + psi b0 = some g0 → psi b1 = some g0 → g0 ∈ MissingColors G psi y0 → + ∀ (p0 : Fin ((↑(⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length) : ℕ) + (1 : ℕ))), G.ends b0 = s(y5, S.vertex (p0.castLT ( + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ))) → + ∀ (p1 : Fin ((↑(⟨(5 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length) : ℕ) + (1 : ℕ))), G.ends b1 = s(y6, S.vertex (p1.castLT ( + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ))) → (↑p1 : ℕ) ≠ (5 : ℕ) → + ∀ (f1 f2 f3 : E) (v1 v2 : V), G.ends f1 = s(S.vertex (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))), v1) → G.ends f2 = s(S.vertex (⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))), v2) → psi f1 = some g0 → psi f2 = some g0 → psi f3 = some g0 → + v1 ∈ TreeSequenceVertexSet S → v2 ∈ TreeSequenceVertexSet S → v1 ≠ S.vertex (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) → v1 ≠ S.vertex (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) → v1 ≠ S.vertex (⟨(2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) → v1 ≠ S.vertex (⟨(3 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) → v1 ≠ S.vertex (⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) → v2 ≠ S.vertex (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) → v2 ≠ S.vertex (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) → v2 ≠ S.vertex (⟨(2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) → v2 ≠ S.vertex (⟨(3 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) → v2 ≠ S.vertex (⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) → G.ends f1 = s(y1, v1) → G.ends f2 = s(y4, v2) → G.ends f3 = + s(y2, y3) → ( + ∀ (j : Fin (2 : ℕ)), S.edge (⟨(4 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length) = f1 ∧ S.vertex (⟨(5 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) = v1 ∨ S.edge (⟨(4 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length) = f2 ∧ S.vertex (⟨(5 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) = v2) → + ∃ (e' : E) (psi' : PartialEdgeColoring E k) (S' : TreeSequence G e') (M' : + NormalGlobalMaximumTriple G k e' psi' S'), Good psi' S' M' + +/-- Dependent contract shared by the order-nine tree rebasing proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation1474Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T), ScheideGraphHeight G = (5 : ℕ) → + let Good : {e : E} → (psi : PartialEdgeColoring E k) → (S : TreeSequence G e) → + NormalGlobalMaximumTriple G k e psi S → Prop := fun {e : E} (psi : PartialEdgeColoring E + k) (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) ↦ + ∃ (_ : BalancedGlobalMaximumTriple M) (x : S.length = (8 : ℕ)) (_ : M.height = (5 : ℕ)) (gamma + : Fin (2 : ℕ) → Fin k), Function.Injective gamma ∧ ( + ∀ (i j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (S.edge (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) + (2 + : ℕ) * (↑i : ℕ) + (↑j : ℕ) < S.length) ↦ + by omega + ⟩ : Fin S.length)) = s(S.vertex (⟨(↑q : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))), S.vertex (⟨(5 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) + (2 + : ℕ) * (↑i : ℕ) + (↑j : ℕ) < S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))))) ∧ ( + ∀ (i j : Fin (2 : ℕ)), psi (S.edge (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) + (2 + : ℕ) * (↑i : ℕ) + (↑j : ℕ) < S.length) ↦ + by omega + ⟩ : Fin S.length)) = some (gamma i)) ∧ ( + ∀ (i : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), gamma i ∈ MissingColors G psi (S.vertex (⟨(↑q : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))))) ∧ + ∀ (i : Fin (4 : ℕ)), (1 : ℕ) ≤ (↑i : ℕ) → + ∀ (c : Fin k), psi (S.edge (⟨(↑i : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(↑i : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length)) = some c → + ∀ (r : Fin (2 : ℕ)), c ≠ gamma r; + ∀ {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) (M : + NormalGlobalMaximumTriple G k e psi S), BalancedGlobalMaximumTriple M → + ∀ (hlen : S.length = (8 : ℕ)), M.height = (5 : ℕ) → + ∀ (g0 : Fin k), IsProperEdgeColoring G psi → TashkinovOrder G = (TreeSequenceVertexSet S).card + ∧ (3 : ℕ) ≤ (TreeSequenceVertexSet S).card ∧ Odd (TreeSequenceVertexSet S).card ∧ + ColoredVertexSetElementary G psi (TreeSequenceVertexSet S) ∧ ColoredVertexSetClosed G psi + (TreeSequenceVertexSet S) → ColoredVertexSetElementary G psi (TreeSequenceVertexSet S) → + ColoredVertexSetClosed G psi (TreeSequenceVertexSet S) → + let y0 : V := S.vertex (⟨(0 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y1 : V := S.vertex (⟨(1 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y2 : V := S.vertex (⟨(2 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y3 : V := S.vertex (⟨(3 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y5 : V := S.vertex (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y7 : V := S.vertex (⟨(7 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y8 : V := S.vertex (⟨(8 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(8 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let a1 : E := S.edge (⟨(1 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let a2 : E := S.edge (⟨(2 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let a3 : E := S.edge (⟨(3 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let b0 : E := S.edge (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let c0 : E := S.edge (⟨(6 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let c1 : E := S.edge (⟨(7 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); ( + ∀ {i j : Fin (S.length + (1 : ℕ))}, i ≠ j → S.vertex i ≠ S.vertex j) → ( + ∀ {i j : Fin S.length}, i ≠ j → S.edge i ≠ S.edge j) → ( + ∀ (i : Fin (S.length + (1 : ℕ))), S.vertex i ∈ TreeSequenceVertexSet S) → ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G psi v → Incident G v f → psi f ≠ some c) → + psi b0 = some g0 → psi b1 = some g0 → g0 ∈ MissingColors G psi y0 → + ∀ (p0 : Fin ((↑(⟨(4 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length) : ℕ) + (1 : ℕ))), G.ends b0 = s(y5, S.vertex (p0.castLT ( + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(↑p0 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ))) → + ∀ (p1 : Fin ((↑(⟨(5 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length) : ℕ) + (1 : ℕ))), G.ends b1 = s(y6, S.vertex (p1.castLT ( + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(↑p1 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ))) → (↑p1 : ℕ) ≠ (5 : ℕ) → + ∀ (f1 f2 f3 : E) (v1 v2 : V), psi f1 = some g0 → psi f2 = some g0 → psi f3 = some g0 → v1 ≠ + S.vertex (⟨(0 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))) → v1 ≠ S.vertex (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))) → G.ends f1 = s(y1, v1) → G.ends f2 = s(y4, v2) → G.ends f3 = + s(y2, y3) → b0 ≠ b1 → b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 + ∧ y6 = v1 → + ∀ (alpha56 beta56 : E), psi alpha56 = some M.alpha → G.ends beta56 = s(v1, v2) → psi beta56 = + some M.beta → G.ends alpha56 = s(y5, y6) → G.ends beta56 = s(y5, y6) → G.ends a1 = s(y1, + y2) → G.ends a2 = s(y2, y3) → G.ends a3 = s(y3, y4) → G.ends M.closingEdge = s(y4, y0) → + psi a1 = some M.alpha → psi a2 = some M.beta → psi a3 = some M.alpha → psi M.closingEdge = + some M.beta → M.alpha ≠ M.beta → g0 ≠ M.alpha → g0 ≠ M.beta → + let r6' : Fin S.length := (⟨(6 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive S + have := + GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); + let r7' : Fin S.length := (⟨(7 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive S + have := + GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); + ∀ (w : Fin ((↑r6' : ℕ) + (1 : ℕ))) (g1 : Fin k), psi c1 = some g1 → psi c0 = some g1 → g1 ∈ + MissingColors G psi (S.vertex (⟨(↑w : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S + have := Fin.isLt r6' + have := Fin.isLt w + have := + GoldbergSeymour.TreeSequence.positive + S + omega + ⟩ : Fin (S.length + (1 : ℕ)))) → + ∀ (pc : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let pc' : Fin (7 : ℕ) := (⟨(↑pc : ℕ), + by + have := Fin.isLt pc + omega + ⟩ : Fin (7 : ℕ)); G.ends c0 = s(y7, S.vertex (⟨(↑pc' : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S + have := Fin.isLt r6' + have := Fin.isLt pc + have := Fin.isLt pc' + have := + GoldbergSeymour.TreeSequence.positive + S + omega + ⟩ : Fin (S.length + (1 : ℕ)))) → c0 ≠ f3 → c0 ≠ alpha56 → c0 ≠ beta56 → c0 ≠ M.closingEdge → ( + ∀ {f : E} {u v : V}, G.ends f = s(u, v) → u ≠ y7 → v ≠ y7 → ¬Incident G y7 f) → y0 ≠ y7 → y1 ≠ + y7 → y2 ≠ y7 → y3 ≠ y7 → y4 ≠ y7 → y5 ≠ y7 → y6 ≠ y7 → v1 ≠ y7 → v2 ≠ y7 → + ∃ (e' : E) (psi' : PartialEdgeColoring E k) (S' : TreeSequence G e') (M' : + NormalGlobalMaximumTriple G k e' psi' S'), Good psi' S' M' + +/-- Dependent contract shared by the order-nine tree rebasing proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation2887Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ), ScheideGraphHeight G = (5 : ℕ) → + let Good : {e : E} → (psi : PartialEdgeColoring E k) → (S : TreeSequence G e) → + NormalGlobalMaximumTriple G k e psi S → Prop := fun {e : E} (psi : PartialEdgeColoring E + k) (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) ↦ + ∃ (_ : BalancedGlobalMaximumTriple M) (x : S.length = (8 : ℕ)) (_ : M.height = (5 : ℕ)) (gamma + : Fin (2 : ℕ) → Fin k), Function.Injective gamma ∧ ( + ∀ (i j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (S.edge (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑i : ℕ) < (2 : ℕ) := i.isLt; + have this_1 : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have this_2 : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) + + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ) < S.length) ↦ + by omega + ⟩ : Fin S.length)) = s(S.vertex (⟨(↑q : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑q : ℕ) < (5 : ℕ) := q.isLt; + have this_1 : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))), S.vertex (⟨(5 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑i : ℕ) < (2 : ℕ) := i.isLt; + have this_1 : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have this_2 : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) + + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ) < S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))))) ∧ ( + ∀ (i j : Fin (2 : ℕ)), psi (S.edge (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑i : ℕ) < (2 : ℕ) := i.isLt; + have this_1 : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have this_2 : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) + + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ) < S.length) ↦ + by omega + ⟩ : Fin S.length)) = some (gamma i)) ∧ ( + ∀ (i : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), gamma i ∈ MissingColors G psi (S.vertex (⟨(↑q : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑q : ℕ) < (5 : ℕ) := q.isLt; + have this_1 : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))))) ∧ + ∀ (i : Fin (4 : ℕ)), (1 : ℕ) ≤ (↑i : ℕ) → + ∀ (c : Fin k), psi (S.edge (⟨(↑i : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑i : ℕ) < (4 : ℕ) := i.isLt; + have this_1 : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(↑i : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length)) = some c → + ∀ (r : Fin (2 : ℕ)), c ≠ gamma r; + ∀ {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) (M : + NormalGlobalMaximumTriple G k e psi S), BalancedGlobalMaximumTriple M → + ∀ (hlen : S.length = (8 : ℕ)), M.height = (5 : ℕ) → + ∀ (g0 : Fin k), + let y0 : V := S.vertex (⟨(0 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y1 : V := S.vertex (⟨(1 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y2 : V := S.vertex (⟨(2 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y3 : V := S.vertex (⟨(3 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y5 : V := S.vertex (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y7 : V := S.vertex (⟨(7 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y8 : V := S.vertex (⟨(8 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(8 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let a1 : E := S.edge (⟨(1 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let a2 : E := S.edge (⟨(2 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let a3 : E := S.edge (⟨(3 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let b0 : E := S.edge (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let c0 : E := S.edge (⟨(6 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let c1 : E := S.edge (⟨(7 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); g0 ∈ MissingColors G psi y0 → + ∀ (f1 f2 : E) (v1 v2 : V), psi f1 = some g0 → psi f2 = some g0 → G.ends f1 = s(y1, v1) → + G.ends f2 = s(y4, v2) → b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = + f1 ∧ y6 = v1 → + ∀ (beta56 : E), G.ends beta56 = s(v1, v2) → psi beta56 = some M.beta → G.ends a1 = s(y1, y2) → + G.ends a2 = s(y2, y3) → G.ends a3 = s(y3, y4) → psi a1 = some M.alpha → psi a2 = some + M.beta → psi a3 = some M.alpha → M.alpha ≠ M.beta → g0 ≠ M.alpha → g0 ≠ M.beta → + let r6' : Fin S.length := (⟨(6 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); + ∀ (w : Fin ((↑r6' : ℕ) + (1 : ℕ))) (g1 : Fin k), psi c1 = some g1 → psi c0 = some g1 → g1 ∈ + MissingColors G psi (S.vertex (⟨(↑w : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑r6' : ℕ) < S.length := r6'.isLt; + have this_1 : (↑w : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑r6' : ℕ) < S.length := r6'.isLt; + have this : (↑w : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := + by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt r6' + have := Fin.isLt w + have := GoldbergSeymour.TreeSequence.positive S + omega; + have this_1 : (1 : ℕ) ≤ S.length := S.positive; this; + have this_2 : (1 : ℕ) ≤ S.length := S.positive; + by + have := GoldbergSeymour.TreeSequence.positive S + have := Fin.isLt r6' + have := Fin.isLt w + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ)))) → g1 ≠ g0 → g1 ≠ M.alpha → g1 ≠ M.beta → + ∀ (g0last : E), G.ends g0last = s(y7, y8) → psi g0last = some g0 → + ∀ (alphaLast : E), G.ends alphaLast = s(y7, y8) → psi alphaLast = some M.alpha → + ∀ (betaLast : E), G.ends betaLast = s(y7, y8) → psi betaLast = some M.beta → + let a0 : E := S.edge (⟨(0 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); ((5 : ℕ) ≤ (↑w : ℕ) → + ∃ (S' : TreeSequence G e) (M' : NormalGlobalMaximumTriple G k e psi S') (x : S'.length = (8 : + ℕ)) (_ : M'.height = (5 : ℕ)), BalancedGlobalMaximumTriple M' ∧ S'.vertex (⟨(0 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive S' + have := + GoldbergSeymour.TreeSequence.positive S' + omega + ⟩ : Fin (S'.length + (1 : ℕ))) = y0 ∧ S'.vertex (⟨(1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive S' + have := + GoldbergSeymour.TreeSequence.positive S' + omega + ⟩ : Fin (S'.length + (1 : ℕ))) = y1 ∧ S'.vertex (⟨(2 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive S' + have := + GoldbergSeymour.TreeSequence.positive S' + omega + ⟩ : Fin (S'.length + (1 : ℕ))) = v1 ∧ S'.vertex (⟨(3 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive S' + have := + GoldbergSeymour.TreeSequence.positive S' + omega + ⟩ : Fin (S'.length + (1 : ℕ))) = v2 ∧ S'.vertex (⟨(4 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive S' + have := + GoldbergSeymour.TreeSequence.positive S' + omega + ⟩ : Fin (S'.length + (1 : ℕ))) = y4 ∧ S'.vertex (⟨(5 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive S' + have := + GoldbergSeymour.TreeSequence.positive S' + omega + ⟩ : Fin (S'.length + (1 : ℕ))) = y2 ∧ S'.vertex (⟨(6 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive S' + have := + GoldbergSeymour.TreeSequence.positive S' + omega + ⟩ : Fin (S'.length + (1 : ℕ))) = y3 ∧ S'.vertex (⟨(7 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S' + have := + GoldbergSeymour.TreeSequence.positive + S' + omega + ⟩ : Fin (S'.length + (1 : ℕ))) = y7 ∧ S'.vertex (⟨(8 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S' + have := + GoldbergSeymour.TreeSequence.positive + S' + omega + ⟩ : Fin (S'.length + (1 : ℕ))) = y8 ∧ S'.edge (⟨(0 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S' + have := + GoldbergSeymour.TreeSequence.positive + S' + omega + ⟩ : Fin S'.length) = a0 ∧ S'.edge (⟨(1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S' + have := + GoldbergSeymour.TreeSequence.positive + S' + omega + ⟩ : Fin S'.length) = f1 ∧ S'.edge (⟨(2 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S' + have := + GoldbergSeymour.TreeSequence.positive + S' + omega + ⟩ : Fin S'.length) = beta56 ∧ S'.edge (⟨(3 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S' + have := + GoldbergSeymour.TreeSequence.positive + S' + omega + ⟩ : Fin S'.length) = f2 ∧ S'.edge (⟨(4 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S' + have := + GoldbergSeymour.TreeSequence.positive + S' + omega + ⟩ : Fin S'.length) = a1 ∧ S'.edge (⟨(5 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S' + have := + GoldbergSeymour.TreeSequence.positive + S' + omega + ⟩ : Fin S'.length) = a3 ∧ S'.edge (⟨(6 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S' + have := + GoldbergSeymour.TreeSequence.positive + S' + omega + ⟩ : Fin S'.length) = c0 ∧ S'.edge (⟨(7 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + S' + have := + GoldbergSeymour.TreeSequence.positive + S' + omega + ⟩ : Fin S'.length) = c1 ∧ M'.alpha = g0 ∧ M'.beta = M.beta) → + ∃ (e' : E) (psi' : PartialEdgeColoring E k) (S' : TreeSequence G e') (M' : + NormalGlobalMaximumTriple G k e' psi' S'), Good psi' S' M' + +/-- Dependent contract shared by the order-nine tree rebasing proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch4561Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T), BalancedGlobalMaximumTriple N → + let this : DecidableEq V := Classical.decEq V; N.height = (5 : ℕ) → + ∀ (hlength : T.length = (8 : ℕ)), + let r4 : Fin T.length := (⟨(4 : ℕ), + by omega + ⟩ : Fin T.length); + let r5 : Fin T.length := (⟨(5 : ℕ), + by omega + ⟩ : Fin T.length); + ∀ (w0 : Fin ((↑r4 : ℕ) + (1 : ℕ))) (gamma0 : Fin k), phi (T.edge r4) = some gamma0 → gamma0 ∈ + MissingColors G phi (T.vertex (w0.castLT ( + by omega + ))) → phi (T.edge r5) = some gamma0 → + let Good : {e : E} → (psi : PartialEdgeColoring E k) → (S : TreeSequence G e) → + NormalGlobalMaximumTriple G k e psi S → Prop := fun {e : E} (psi : PartialEdgeColoring E + k) (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) ↦ + ∃ (_ : BalancedGlobalMaximumTriple M) (x : S.length = (8 : ℕ)) (_ : M.height = (5 : ℕ)) (gamma + : Fin (2 : ℕ) → Fin k), Function.Injective gamma ∧ ( + ∀ (i j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (S.edge (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by omega + ⟩ : Fin S.length)) = s(S.vertex (⟨(↑q : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ))), S.vertex (⟨(5 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ))))) ∧ ( + ∀ (i j : Fin (2 : ℕ)), psi (S.edge (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by omega + ⟩ : Fin S.length)) = some (gamma i)) ∧ ( + ∀ (i : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), gamma i ∈ MissingColors G psi (S.vertex (⟨(↑q : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ))))) ∧ + ∀ (i : Fin (4 : ℕ)), (1 : ℕ) ≤ (↑i : ℕ) → + ∀ (c : Fin k), psi (S.edge (⟨(↑i : ℕ), + by omega + ⟩ : Fin S.length)) = some c → + ∀ (r : Fin (2 : ℕ)), c ≠ gamma r; ( + ∀ {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) (M : + NormalGlobalMaximumTriple G k e psi S), BalancedGlobalMaximumTriple M → + ∀ (hlen : S.length = (8 : ℕ)), M.height = (5 : ℕ) → + ∀ (g0 : Fin k), psi (S.edge (⟨(4 : ℕ), + by omega + ⟩ : Fin S.length)) = some g0 → psi (S.edge (⟨(5 : ℕ), + by omega + ⟩ : Fin S.length)) = some g0 → g0 ∈ MissingColors G psi (S.vertex (⟨(0 : ℕ), Nat.zero_lt_succ + S.length⟩ : Fin (S.length + (1 : ℕ)))) → + ∃ (e' : E) (psi' : PartialEdgeColoring E k) (S' : TreeSequence G e') (M' : + NormalGlobalMaximumTriple G k e' psi' S'), Good psi' S' M') → ¬(↑w0 : ℕ) = (0 : ℕ) → + ∃ (e1 : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e1) (M : + NormalGlobalMaximumTriple G k e1 psi S) (_ : BalancedGlobalMaximumTriple M) (x : S.length + = (8 : ℕ)) (_ : M.height = (5 : ℕ)) (gamma : Fin (2 : ℕ) → Fin k), Function.Injective + gamma ∧ ( + ∀ (i j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (S.edge (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by omega + ⟩ : Fin S.length)) = s(S.vertex (⟨(↑q : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ))), S.vertex (⟨(5 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ))))) ∧ ( + ∀ (i j : Fin (2 : ℕ)), psi (S.edge (⟨(4 : ℕ) + (2 : ℕ) * (↑i : ℕ) + (↑j : ℕ), + by omega + ⟩ : Fin S.length)) = some (gamma i)) ∧ ( + ∀ (i : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), gamma i ∈ MissingColors G psi (S.vertex (⟨(↑q : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ))))) ∧ + ∀ (i : Fin (4 : ℕ)), (1 : ℕ) ≤ (↑i : ℕ) → + ∀ (c : Fin k), psi (S.edge (⟨(↑i : ℕ), + by omega + ⟩ : Fin S.length)) = some c → + ∀ (r : Fin (2 : ℕ)), c ≠ gamma r + +/-- Dependent contract shared by the order-nine tree rebasing proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperFirstEight3682Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (M : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y7 : V := S.vertex (⟨(7 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + ∀ (f1 f2 beta56 : E), + let r6' : Fin S.length := (⟨(6 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + by omega + ⟩ : Fin S.length); + let r7' : Fin S.length := (⟨(7 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + by omega + ⟩ : Fin S.length); + ∀ (w : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + Fin (9 : ℕ) → Fin (S.length + (1 : ℕ))) ((permA : Fin (9 : ℕ) → Fin (9 : ℕ)) i)) else + S.vertex ((cast9 : Fin (9 : ℕ) → Fin (S.length + (1 : ℕ))) ((permB : Fin (9 : ℕ) → Fin (9 + : ℕ)) i)); newVertex (7 : Fin (9 : ℕ)) = y7 → ( + ∀ (q : Fin (7 : ℕ)), + ∃ (t : Fin (7 : ℕ)), newVertex (Fin.castLE ( + by omega + ) t) = S.vertex (⟨(↑q : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ)))) → + ∀ (pc1 : Fin ((↑r7' : ℕ) + (1 : ℕ))) (q : Fin (8 : ℕ)), + ∃ (t : Fin (8 : ℕ)), newVertex (Fin.castLE ( + by omega + ) t) = S.vertex (⟨(↑q : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ))) + +/-- Dependent contract shared by the order-nine tree rebasing proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperClassifyFirst2342Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : + ℕ)) (g0 : Fin k), IsProperEdgeColoring G psi → + let y0 : V := S.vertex (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y1 : V := S.vertex (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y2 : V := S.vertex (⟨(2 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y3 : V := S.vertex (⟨(3 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length); ( + ∀ {i j : Fin (S.length + (1 : ℕ))}, i ≠ j → S.vertex i ≠ S.vertex j) → ( + ∀ {c : Fin k} {v : V} {f : E}, c ∈ MissingColors G psi v → Incident G v f → psi f ≠ some c) → + psi b0 = some g0 → psi b1 = some g0 → g0 ∈ MissingColors G psi y0 → ( + ∀ (j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), G.ends (S.edge (⟨(4 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length)) = s(S.vertex (⟨(↑q : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))), S.vertex (⟨(5 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))))) → + ∀ (f1 f2 f3 : E) (v1 v2 : V), psi f1 = some g0 → psi f2 = some g0 → psi f3 = some g0 → G.ends + f1 = s(y1, v1) → G.ends f2 = s(y4, v2) → G.ends f3 = s(y2, y3) → + ∀ (j : Fin (2 : ℕ)), S.edge (⟨(4 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length) = f1 ∧ S.vertex (⟨(5 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) = v1 ∨ S.edge (⟨(4 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin S.length) = f2 ∧ S.vertex (⟨(5 : ℕ) + (↑j : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive S + omega + ⟩ : Fin (S.length + (1 : ℕ))) = v2 + +/-- Typed data construction shared by the order-nine tree rebasing proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperS3810.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + {e : E} → + + (S : TreeSequence G e) → + (hlen : S.length = (8 : ℕ)) → + let y0 : V := + S.vertex + (⟨(0 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction + fun (a : ¬(0 : ℕ) < S.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (S.length + (1 : ℕ))); + let y1 : V := + S.vertex + (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) < S.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (S.length + (1 : ℕ))); + let y2 : V := + S.vertex + (⟨(2 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction + fun (a : ¬(2 : ℕ) < S.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (S.length + (1 : ℕ))); + let y3 : V := + S.vertex + (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction + fun (a : ¬(3 : ℕ) < S.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (S.length + (1 : ℕ))); + let y4 : V := + S.vertex + (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction + fun (a : ¬(4 : ℕ) < S.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (S.length + (1 : ℕ))); + let y7 : V := + S.vertex + (⟨(7 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction + fun (a : ¬(7 : ℕ) < S.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (S.length + (1 : ℕ))); + let y8 : V := + S.vertex + (⟨(8 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction + fun (a : ¬(8 : ℕ) < S.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (S.length + (1 : ℕ))); + let a1 : E := + S.edge + (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) < S.length) ↦ by + omega⟩ : + Fin S.length); + let a3 : E := + S.edge + (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction fun (a : ¬(3 : ℕ) < S.length) ↦ by + omega⟩ : + Fin S.length); + let b0 : E := + S.edge + (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction fun (a : ¬(4 : ℕ) < S.length) ↦ by + omega⟩ : + Fin S.length); + let c0 : E := + S.edge + (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction fun (a : ¬(6 : ℕ) < S.length) ↦ by + omega⟩ : + Fin S.length); + let c1 : E := + S.edge + (⟨(7 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction fun (a : ¬(7 : ℕ) < S.length) ↦ by + omega⟩ : + Fin S.length); + (f1 f2 : E) → + (v1 v2 : V) → + G.ends f1 = s(y1, v1) → + G.ends f2 = s(y4, v2) → + (beta56 : E) → + G.ends beta56 = s(v1, v2) → + G.ends a1 = s(y1, y2) → + G.ends a3 = s(y3, y4) → + let r6' : Fin S.length := + (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by omega⟩ : + Fin S.length); + let r7' : Fin S.length := + (⟨(7 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by omega⟩ : + Fin S.length); + (w pc : Fin ((↑r6' : ℕ) + (1 : ℕ))) → + let pc' : Fin (7 : ℕ) := + (⟨(↑pc : ℕ), + have this : (↑pc : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (↑r6' : ℕ) < S.length := r6'.isLt; + have this : + (↑pc : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := pc.isLt; + have _ : (1 : ℕ) ≤ S.length := S.positive; + this; + this⟩ : + Fin (7 : ℕ)); + G.ends c0 = + s(y7, + S.vertex + (⟨(↑pc' : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (↑r6' : ℕ) < S.length := + r6'.isLt; + have _ : + (↑pc : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := + have _ : (1 : ℕ) ≤ S.length := + S.positive; + have _ : (↑r6' : ℕ) < S.length := + r6'.isLt; + have this : + (↑pc : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := + pc.isLt; + have _ : (1 : ℕ) ≤ S.length := + S.positive; + this; + have this : (↑pc' : ℕ) < (7 : ℕ) := + pc'.isLt; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by omega⟩ : + Fin (S.length + (1 : ℕ)))) → + let a0 : E := + S.edge + (⟨(0 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction + fun (a : ¬(0 : ℕ) < S.length) ↦ by + omega⟩ : + Fin S.length); + a0 = e → + G.ends a0 = s(y1, y0) → + let cast9 : + Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := + finCongr (by omega); + let permA : Equiv.Perm (Fin (9 : ℕ)) := + Equiv.trans + (Equiv.swap (2 : Fin (9 : ℕ)) + (5 : Fin (9 : ℕ))) + (Equiv.swap (3 : Fin (9 : ℕ)) + (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := + (Equiv.trans + (Equiv.swap (2 : Fin (9 : ℕ)) + (6 : Fin (9 : ℕ))) + (Equiv.swap (2 : Fin (9 : ℕ)) + (3 : Fin (9 : ℕ)))).trans + (Equiv.swap (2 : Fin (9 : ℕ)) + (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := + fun (i : Fin (9 : ℕ)) ↦ + if b0 = f1 then + S.vertex + ((cast9 : + Fin (9 : ℕ) → + Fin (S.length + (1 : ℕ))) + ((permA : Fin (9 : ℕ) → Fin (9 : ℕ)) i)) + else + S.vertex + ((cast9 : + Fin (9 : ℕ) → + Fin (S.length + (1 : ℕ))) + ((permB : Fin (9 : ℕ) → Fin (9 : ℕ)) + i)); + let edgeList : List E := + [a0, f1, beta56, f2, a1, a3, c0, c1]; + (hedgeListLength : edgeList.length = (8 : ℕ)) → + let newEdge : Fin (8 : ℕ) → E := + fun (i : Fin (8 : ℕ)) ↦ + edgeList.get + (Fin.cast (Eq.symm hedgeListLength) i); + newVertex (0 : Fin (9 : ℕ)) = y0 → + newVertex (1 : Fin (9 : ℕ)) = y1 → + newVertex (2 : Fin (9 : ℕ)) = v1 → + newVertex (3 : Fin (9 : ℕ)) = v2 → + newVertex (4 : Fin (9 : ℕ)) = y4 → + newVertex (5 : Fin (9 : ℕ)) = y2 → + newVertex (6 : Fin (9 : ℕ)) = y3 → + newVertex (7 : Fin (9 : ℕ)) = + y7 → + newVertex (8 : Fin (9 : ℕ)) = + y8 → + newEdge (0 : Fin (8 : ℕ)) = + a0 → + newEdge + (1 : Fin (8 : ℕ)) = + f1 → + newEdge + (2 : + Fin (8 : ℕ)) = + beta56 → + newEdge + (3 : + Fin (8 : ℕ)) = + f2 → + newEdge + (4 : + Fin + (8 : ℕ)) = + a1 → + newEdge + (5 : + Fin + (8 : + ℕ)) = + a3 → + newEdge + (6 : + Fin + (8 : + ℕ)) = + c0 → + newEdge + (7 : + Fin + (8 : + ℕ)) = + c1 → + Function.Injective + newVertex → + Function.Injective + newEdge → + (pc1 : + Fin + ((↑r7' : + ℕ) + + (1 : + ℕ))) → + let + pc1' : + Fin + (8 : + ℕ) := + (⟨(↑pc1 : + ℕ), + by + omega⟩ : + Fin + (8 : + ℕ)); + G.ends + c1 = + s(y8, + S.vertex + (⟨(↑pc1' : + ℕ), + by + omega⟩ : + Fin + (S.length + + (1 : + ℕ)))) → + (tc0 : + Fin + (7 : + ℕ)) → + newVertex + (Fin.castLE + (by + omega) + tc0) = + S.vertex + (⟨(↑pc' : + ℕ), + by + omega⟩ : + Fin + (S.length + + (1 : + ℕ))) → + (tc1 : + Fin + (8 : + ℕ)) → + newVertex + (Fin.castLE + (by + omega) + tc1) = + S.vertex + (⟨(↑pc1' : + ℕ), + by + omega⟩ : + Fin + (S.length + + (1 : + ℕ))) → + TreeSequence + G + e := by + classical + intro V E _ G k e S hlen y0 y1 y2 y3 y4 y7 y8 a1 a3 b0 c0 c1 f1 f2 v1 v2 hf1ends' hf2ends' beta56 + hbeta56ends ha1ends ha3ends r6' r7' w pc pc' hc0ends a0 ha0eq ha0ends cast9 permA permB + newVertex edgeList hedgeListLength newEdge nv0 nv1 nv2 nv3 nv4 nv5 nv6 nv7 nv8 ne0 ne1 ne2 ne3 + ne4 ne5 ne6 ne7 newVertex_injective newEdge_injective pc1 pc1' hc1ends tc0 htc0 tc1 htc1 + exact { + length := 8 + positive := by omega + vertex := newVertex + edge := newEdge + vertex_injective := newVertex_injective + edge_injective := newEdge_injective + first_edge := ne0.trans ha0eq + attaches := by + intro j + fin_cases j + · refine ⟨0, ?_⟩ + change G.ends (newEdge 0) = s(newVertex 1, newVertex 0) + rw [ne0, nv0, nv1] + exact ha0ends + · refine ⟨1, ?_⟩ + change G.ends (newEdge 1) = s(newVertex 2, newVertex 1) + rw [ne1, nv1, nv2] + exact hf1ends'.trans Sym2.eq_swap + · refine ⟨2, ?_⟩ + change G.ends (newEdge 2) = s(newVertex 3, newVertex 2) + rw [ne2, nv2, nv3] + exact hbeta56ends.trans Sym2.eq_swap + · refine ⟨3, ?_⟩ + change G.ends (newEdge 3) = s(newVertex 4, newVertex 3) + rw [ne3, nv3, nv4] + exact hf2ends' + · refine ⟨1, ?_⟩ + change G.ends (newEdge 4) = s(newVertex 5, newVertex 1) + rw [ne4, nv1, nv5] + exact ha1ends.trans Sym2.eq_swap + · refine ⟨4, ?_⟩ + change G.ends (newEdge 5) = s(newVertex 6, newVertex 4) + rw [ne5, nv4, nv6] + exact ha3ends + · refine ⟨tc0, ?_⟩ + change G.ends (newEdge 6) = + s(newVertex 7, newVertex (Fin.castLE (by omega) tc0)) + rw [ne6, nv7] + exact hc0ends.trans (congrArg (fun z ↦ s(y7, z)) htc0.symm) + · refine ⟨tc1, ?_⟩ + change G.ends (newEdge 7) = + s(newVertex 8, newVertex (Fin.castLE (by omega) tc1)) + rw [ne7, nv8] + exact hc1ends.trans (congrArg (fun z ↦ s(y8, z)) htc1.symm) } + +/-- Dependent contract shared by the order-nine tree rebasing proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperHS'tash4523Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (M : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)) (g0 : Fin k), + let y0 : V := S.vertex (⟨(0 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y1 : V := S.vertex (⟨(1 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y2 : V := S.vertex (⟨(2 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y3 : V := S.vertex (⟨(3 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y7 : V := S.vertex (⟨(7 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y8 : V := S.vertex (⟨(8 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(8 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let a1 : E := S.edge (⟨(1 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let a3 : E := S.edge (⟨(3 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let b0 : E := S.edge (⟨(4 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let c0 : E := S.edge (⟨(6 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let c1 : E := S.edge (⟨(7 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + ∀ (hg0' : g0 ∈ MissingColors G psi y0) (f1 f2 : E) (v1 v2 : V) (hf1color : psi f1 = some g0) + (hf2color : psi f2 = some g0) (hf1ends' : G.ends f1 = s(y1, v1)) (hf2ends' : G.ends f2 = + s(y4, v2)) (beta56 : E) (hbeta56ends : G.ends beta56 = s(v1, v2)) (hbeta56color : psi + beta56 = some M.beta) (ha1ends : G.ends a1 = s(y1, y2)) (ha3ends : G.ends a3 = s(y3, y4)) + (ha1color : psi a1 = some M.alpha) (ha3color : psi a3 = some M.alpha), + let r6' : Fin S.length := (⟨(6 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have x : (1 : ℕ) ≤ S.length := S.positive; + by omega + ⟩ : Fin S.length); + let r7' : Fin S.length := (⟨(7 : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have x : (1 : ℕ) ≤ S.length := S.positive; + by omega + ⟩ : Fin S.length); + ∀ (w : Fin ((↑r6' : ℕ) + (1 : ℕ))) (g1 : Fin k) (hc1color : psi c1 = some g1) (hc0color' : psi + c0 = some g1) (pc : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let pc' : Fin (7 : ℕ) := (⟨(↑pc : ℕ), + have this : (↑pc : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑r6' : ℕ) < S.length := r6'.isLt; + have this : (↑pc : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := pc.isLt; + have this_1 : (1 : ℕ) ≤ S.length := S.positive; this; this⟩ : Fin (7 : ℕ)); + ∀ (hc0ends : G.ends c0 = s(y7, S.vertex (⟨(↑pc' : ℕ), + have x : (1 : ℕ) ≤ S.length := S.positive; + have x : (↑r6' : ℕ) < S.length := r6'.isLt; + have x : (↑pc : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (↑r6' : ℕ) < S.length := r6'.isLt; + have this : (↑pc : ℕ) < (↑r6' : ℕ) + (1 : ℕ) := pc.isLt; + have this_1 : (1 : ℕ) ≤ S.length := S.positive; this; + have this : (↑pc' : ℕ) < (7 : ℕ) := pc'.isLt; + have x : (1 : ℕ) ≤ S.length := S.positive; + by omega + ⟩ : Fin (S.length + (1 : ℕ))))), + let a0 : E := S.edge (⟨(0 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + have this : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + ∀ (ha0eq : a0 = e) (ha0ends : G.ends a0 = s(y1, y0)), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permA : (a : Fin (9 : ℕ)) → Fin (9 : ℕ)) + i)) else S.vertex ((cast9 : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permB : (a : + Fin (9 : ℕ)) → Fin (9 : ℕ)) i)); + let edgeList : List E := [a0, f1, beta56, f2, a1, a3, c0, c1]; + ∀ (hedgeListLength : edgeList.length = (8 : ℕ)), + let newEdge : Fin (8 : ℕ) → E := fun (i : Fin (8 : ℕ)) ↦ edgeList.get (Fin.cast (Eq.symm + hedgeListLength) i); + ∀ (nv0 : newVertex (0 : Fin (9 : ℕ)) = y0) (nv1 : newVertex (1 : Fin (9 : ℕ)) = y1) (nv2 : + newVertex (2 : Fin (9 : ℕ)) = v1) (nv3 : newVertex (3 : Fin (9 : ℕ)) = v2) (nv4 : + newVertex (4 : Fin (9 : ℕ)) = y4) (nv5 : newVertex (5 : Fin (9 : ℕ)) = y2) (nv6 : + newVertex (6 : Fin (9 : ℕ)) = y3) (nv7 : newVertex (7 : Fin (9 : ℕ)) = y7) (nv8 : + newVertex (8 : Fin (9 : ℕ)) = y8) (ne0 : newEdge (0 : Fin (8 : ℕ)) = a0) (ne1 : newEdge (1 + : Fin (8 : ℕ)) = f1) (ne2 : newEdge (2 : Fin (8 : ℕ)) = beta56) (ne3 : newEdge (3 : Fin (8 + : ℕ)) = f2) (ne4 : newEdge (4 : Fin (8 : ℕ)) = a1) (ne5 : newEdge (5 : Fin (8 : ℕ)) = a3) + (ne6 : newEdge (6 : Fin (8 : ℕ)) = c0) (ne7 : newEdge (7 : Fin (8 : ℕ)) = c1) + (newVertex_injective : Function.Injective newVertex) (newEdge_injective : + Function.Injective newEdge) (pc1 : Fin ((↑r7' : ℕ) + (1 : ℕ))), + let pc1' : Fin (8 : ℕ) := (⟨(↑pc1 : ℕ), + by omega + ⟩ : Fin (8 : ℕ)); + ∀ (hc1ends : G.ends c1 = s(y8, S.vertex (⟨(↑pc1' : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ))))) (tc0 : Fin (7 : ℕ)) (htc0 : newVertex (Fin.castLE ( + by omega + ) tc0) = S.vertex (⟨(↑pc' : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ)))) (tc1 : Fin (8 : ℕ)) (htc1 : newVertex (Fin.castLE ( + by omega + ) tc1) = S.vertex (⟨(↑pc1' : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ)))) (tw : Fin (7 : ℕ)), + let S' : TreeSequence G e := helperS3810 G k S hlen f1 f2 v1 v2 hf1ends' hf2ends' beta56 + hbeta56ends ha1ends ha3ends w pc hc0ends ha0eq ha0ends hedgeListLength nv0 nv1 nv2 nv3 nv4 + nv5 nv6 nv7 nv8 ne0 ne1 ne2 ne3 ne4 ne5 ne6 ne7 newVertex_injective newEdge_injective pc1 + hc1ends tc0 htc0 tc1 htc1; + ∀ (hS'length : S'.length = (8 : ℕ)) (htwMissing : g1 ∈ MissingColors G psi (S'.vertex (⟨(↑tw : + ℕ), + by omega + ⟩ : Fin (S'.length + (1 : ℕ))))), TashkinovTree G e psi S' + +theorem mappedCastLE {V : Type*} {m n : ℕ} (f : Fin n → V) + (h : m ≤ n) (i : Fin m) (j : Fin n) (heq : i.val = j.val) : + f (Fin.castLE h i) = f j := congrArg f (Fin.ext heq) + +theorem alternatingVertexSupport {V E : Type*} (vertex : Fin 5 → V) + (e1 e2 e3 c : E) (v : V) : + Sum.inl v ∈ [Sum.inl (vertex 1), Sum.inr e1, Sum.inl (vertex 2), Sum.inr e2, + Sum.inl (vertex 3), Sum.inr e3, Sum.inl (vertex 4), Sum.inr c, Sum.inl (vertex 0)] ↔ + ∃ i : Fin 5, v = vertex i := by + simp only [List.mem_cons, List.not_mem_nil, Sum.inl.injEq, reduceCtorEq, + or_false, false_or, Fin.exists_fin_succ, Fin.exists_fin_zero] + tauto + +theorem alternatingEdgeSupport {V E : Type*} (v0 v1 v2 v3 v4 : V) + (e1 e2 e3 c : E) (edge : Fin 8 → E) (h1 : edge 1 = e1) + (h2 : edge 2 = e2) (h3 : edge 3 = e3) (f : E) : + Sum.inr f ∈ [Sum.inl v1, Sum.inr e1, Sum.inl v2, Sum.inr e2, + Sum.inl v3, Sum.inr e3, Sum.inl v4, Sum.inr c, Sum.inl v0] ↔ + f = c ∨ ∃ j : Fin 8, 1 ≤ j.val ∧ j.val + 2 ≤ 5 ∧ f = edge j := by + simp [Fin.exists_fin_succ, h1, h2, h3, or_left_comm, or_comm] + +theorem helper_hp1not5_194.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (_ : NormalGlobalMaximumTriple G k e psi S) + (hlen : S.length = (8 : ℕ)) (g0 : Fin k), + IsProperEdgeColoring G psi → + let y5 : V := S.vertex (⟨(5 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), by omega⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), by omega⟩ : Fin S.length); + (∀ {i j : Fin S.length}, i ≠ j → S.edge i ≠ S.edge j) → + psi b0 = some g0 → + psi b1 = some g0 → + ∀ (p0 : Fin ((↑(⟨(4 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))), + G.ends b0 = s(y5, S.vertex (p0.castLT (by omega))) → + ∀ (p1 : Fin ((↑(⟨(5 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))), + G.ends b1 = s(y6, S.vertex (p1.castLT (by omega))) → + (↑p1 : ℕ) ≠ (5 : ℕ) := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen g0 hproper y5 y6 b0 b1 hedge_ne h4' h5' p0 + hb0ends p1 hb1ends hp15 + have hinc0 : Incident G y5 b0 := by + rw [Incident, hb0ends] + simp + have hp1vertex : S.vertex (Fin.castLT p1 + (Nat.lt_trans p1.isLt + (Nat.succ_lt_succ (⟨5, by omega⟩ : Fin S.length).isLt))) = y5 := by + apply congrArg S.vertex + apply Fin.ext + simpa [y5] using hp15 + have hinc1 : Incident G y5 b1 := by + rw [Incident, hb1ends, hp1vertex] + simp + have hbne : b0 ≠ b1 := by + apply hedge_ne + norm_num + exact (hproper hbne ⟨y5, hinc0, hinc1⟩ h4') h5' + +theorem helper_hfirstAttach_212.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (_ : NormalGlobalMaximumTriple G k e psi S) + (hlen : S.length = (8 : ℕ)), + let y5 : V := S.vertex (⟨(5 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), by omega⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), by omega⟩ : Fin S.length); + ∀ (p0 : Fin ((↑(⟨(4 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))), + G.ends b0 = s(y5, S.vertex (p0.castLT (by omega))) → + ∀ (p1 : Fin ((↑(⟨(5 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))), + G.ends b1 = s(y6, S.vertex (p1.castLT (by omega))) → + (↑p1 : ℕ) ≠ (5 : ℕ) → + ∀ (j : Fin (2 : ℕ)), + ∃ (q : Fin (5 : ℕ)), + G.ends (S.edge (⟨(4 : ℕ) + (↑j : ℕ), by omega⟩ : Fin S.length)) = + s(S.vertex (⟨(↑q : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))), + S.vertex (⟨(5 : ℕ) + (↑j : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen y5 y6 b0 b1 p0 hb0ends p1 hb1ends hp1not5 j + have hj : j.val = 0 ∨ j.val = 1 := by omega + rcases hj with hj | hj + · let q : Fin 5 := ⟨p0.val, by simp⟩ + refine ⟨q, ?_⟩ + have hv : S.vertex (Fin.castLT p0 + (Nat.lt_trans p0.isLt + (Nat.succ_lt_succ (⟨4, by omega⟩ : Fin S.length).isLt))) = + S.vertex ⟨q.val, by omega⟩ := by + apply congrArg S.vertex + apply Fin.ext + rfl + rw [show j = (0 : Fin 2) by apply Fin.ext; exact hj] + simpa [b0, y5, hv] using hb0ends.trans Sym2.eq_swap + · let q : Fin 5 := ⟨p1.val, by + have hp := p1.isLt + have hp' : p1.val < 6 := by simp + omega⟩ + refine ⟨q, ?_⟩ + have hv : S.vertex (Fin.castLT p1 + (Nat.lt_trans p1.isLt + (Nat.succ_lt_succ (⟨5, by omega⟩ : Fin S.length).isLt))) = + S.vertex ⟨q.val, by omega⟩ := by + apply congrArg S.vertex + apply Fin.ext + rfl + rw [show j = (1 : Fin 2) by apply Fin.ext; exact hj] + simpa [b1, y6, hv] using hb1ends.trans Sym2.eq_swap + +theorem helper_branch_380.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (_ : NormalGlobalMaximumTriple G k e psi S) + (hlen : S.length = (8 : ℕ)) (g0 : Fin k), + IsProperEdgeColoring G psi → + let y1 : V := S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + ∀ (f1 f2 : E) (v1 v2 : V), + psi f1 = some g0 → + G.ends f1 = s(y1, v1) → + ∀ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), + let bj : E := S.edge (⟨(4 : ℕ) + (↑j : ℕ), by omega⟩ : Fin S.length); + let z : V := S.vertex (⟨(5 : ℕ) + (↑j : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + G.ends bj = s(S.vertex (⟨(↑q : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))), z) → + psi bj = some g0 → + z ≠ y1 → + (↑q : ℕ) = (1 : ℕ) → + S.edge (⟨(4 : ℕ) + (↑j : ℕ), by omega⟩ : Fin S.length) = f1 ∧ + S.vertex (⟨(5 : ℕ) + (↑j : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))) = v1 ∨ + S.edge (⟨(4 : ℕ) + (↑j : ℕ), by omega⟩ : Fin S.length) = f2 ∧ + S.vertex (⟨(5 : ℕ) + (↑j : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))) = v2 := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen g0 hproper y1 f1 f2 v1 v2 hf1color hf1ends' j q + bj z hbjends hbjcolor hz1 hq1 + have hincb : Incident G y1 bj := by + rw [Incident, hbjends] + have hv : S.vertex ⟨q.val, by omega⟩ = y1 := by + apply congrArg S.vertex + apply Fin.ext + simpa [y1] using hq1 + rw [hv] + simp + have hincf : Incident G y1 f1 := by + rw [Incident, hf1ends'] + simp + have hbf : bj = f1 := by + by_contra hne + exact (hproper hne ⟨y1, hincb, hincf⟩ hbjcolor) hf1color + left + refine ⟨by simpa [bj] using hbf, ?_⟩ + have hpairs : s(y1, z) = s(y1, v1) := by + calc + s(y1, z) = G.ends bj := by + rw [hbjends] + congr 1 + apply congrArg S.vertex + apply Fin.ext + simpa [y1] using hq1.symm + _ = G.ends f1 := congrArg G.ends hbf + _ = s(y1, v1) := hf1ends' + rcases Sym2.eq_iff.mp hpairs with hd | hs + · simpa [z] using hd.2 + · exact False.elim (hz1 hs.2) + +theorem helper_branch_409.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (_ : NormalGlobalMaximumTriple G k e psi S) + (hlen : S.length = (8 : ℕ)) (g0 : Fin k), + IsProperEdgeColoring G psi → + let y4 : V := S.vertex (⟨(4 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + ∀ (f1 f2 : E) (v1 v2 : V), + psi f2 = some g0 → + G.ends f2 = s(y4, v2) → + ∀ (j : Fin (2 : ℕ)) (q : Fin (5 : ℕ)), + let bj : E := S.edge (⟨(4 : ℕ) + (↑j : ℕ), by omega⟩ : Fin S.length); + let z : V := S.vertex (⟨(5 : ℕ) + (↑j : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + G.ends bj = s(S.vertex (⟨(↑q : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))), z) → + psi bj = some g0 → + z ≠ y4 → + (↑q : ℕ) = (4 : ℕ) → + S.edge (⟨(4 : ℕ) + (↑j : ℕ), by omega⟩ : Fin S.length) = f1 ∧ + S.vertex (⟨(5 : ℕ) + (↑j : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))) = v1 ∨ + S.edge (⟨(4 : ℕ) + (↑j : ℕ), by omega⟩ : Fin S.length) = f2 ∧ + S.vertex (⟨(5 : ℕ) + (↑j : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))) = v2 := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen g0 hproper y4 f1 f2 v1 v2 hf2color hf2ends' j q + bj z hbjends hbjcolor hz4 hq4 + have hincb : Incident G y4 bj := by + rw [Incident, hbjends] + have hv : S.vertex ⟨q.val, by omega⟩ = y4 := by + apply congrArg S.vertex + apply Fin.ext + simpa [y4] using hq4 + rw [hv] + simp + have hincf : Incident G y4 f2 := by + rw [Incident, hf2ends'] + simp + have hbf : bj = f2 := by + by_contra hne + exact (hproper hne ⟨y4, hincb, hincf⟩ hbjcolor) hf2color + right + refine ⟨by simpa [bj] using hbf, ?_⟩ + have hpairs : s(y4, z) = s(y4, v2) := by + calc + s(y4, z) = G.ends bj := by + rw [hbjends] + congr 1 + apply congrArg S.vertex + apply Fin.ext + simpa [y4] using hq4.symm + _ = G.ends f2 := congrArg G.ends hbf + _ = s(y4, v2) := hf2ends' + rcases Sym2.eq_iff.mp hpairs with hd | hs + · simpa [z] using hd.2 + · exact False.elim (hz4 hs.2) + +theorem helper_hg0alpha_524.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) + (hlen : S.length = (8 : ℕ)) (g0 : Fin k), + IsProperEdgeColoring G psi → + let y1 : V := S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y5 : V := S.vertex (⟨(5 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), by omega⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), by omega⟩ : Fin S.length); + (∀ {i j : Fin (S.length + (1 : ℕ))}, i ≠ j → S.vertex i ≠ S.vertex j) → + ∀ (f1 f2 : E) (v1 v2 : V), + psi f1 = some g0 → + G.ends f1 = s(y1, v1) → + b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1 → + ∀ (alpha56 : E), + psi alpha56 = some M.alpha → + G.ends alpha56 = s(y5, y6) → + g0 ≠ M.alpha := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen g0 hproper y1 y5 y6 b0 b1 hvertex_ne f1 f2 v1 v2 + hf1color hf1ends' horient alpha56 halpha56color halpha56ends' hEq + have hfne : f1 ≠ alpha56 := by + intro heq + have hpairs : s(y1, v1) = s(y5, y6) := by + rw [← hf1ends', heq, halpha56ends'] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact (hvertex_ne (i := (⟨1, by omega⟩ : Fin (S.length + 1))) + (j := (⟨5, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y1, y5] using hd.1) + · exact (hvertex_ne (i := (⟨1, by omega⟩ : Fin (S.length + 1))) + (j := (⟨6, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y1, y6] using hs.1) + have hincf : Incident G v1 f1 := by + rw [Incident, hf1ends'] + simp + have hinca : Incident G v1 alpha56 := by + rw [Incident, halpha56ends'] + rcases horient with h | h + · simp [h.2.1] + · simp [h.2.2.2] + exact (hproper hfne ⟨v1, hincf, hinca⟩ hf1color) + (by simpa [hEq] using halpha56color) + +theorem helper_hg0beta_547.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) + (hlen : S.length = (8 : ℕ)) (g0 : Fin k), + IsProperEdgeColoring G psi → + let y1 : V := S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y5 : V := S.vertex (⟨(5 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), by omega⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), by omega⟩ : Fin S.length); + (∀ {i j : Fin (S.length + (1 : ℕ))}, i ≠ j → S.vertex i ≠ S.vertex j) → + ∀ (f1 f2 : E) (v1 v2 : V), + psi f1 = some g0 → + G.ends f1 = s(y1, v1) → + b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1 → + ∀ (beta56 : E), + psi beta56 = some M.beta → + G.ends beta56 = s(y5, y6) → + g0 ≠ M.beta := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen g0 hproper y1 y5 y6 b0 b1 hvertex_ne f1 f2 v1 v2 + hf1color hf1ends' horient beta56 hbeta56color hbeta56ends' hEq + have hfne : f1 ≠ beta56 := by + intro heq + have hpairs : s(y1, v1) = s(y5, y6) := by + rw [← hf1ends', heq, hbeta56ends'] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact (hvertex_ne (i := (⟨1, by omega⟩ : Fin (S.length + 1))) + (j := (⟨5, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y1, y5] using hd.1) + · exact (hvertex_ne (i := (⟨1, by omega⟩ : Fin (S.length + 1))) + (j := (⟨6, by omega⟩ : Fin (S.length + 1))) (by norm_num)) + (by simpa [y1, y6] using hs.1) + have hincf : Incident G v1 f1 := by + rw [Incident, hf1ends'] + simp + have hincb : Incident G v1 beta56 := by + rw [Incident, hbeta56ends'] + rcases horient with h | h + · simp [h.2.1] + · simp [h.2.2.2] + exact (hproper hfne ⟨v1, hincf, hincb⟩ hf1color) + (by simpa [hEq] using hbeta56color) + +theorem helper_hcoverG0_732.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (_ : NormalGlobalMaximumTriple G k e psi S) + (hlen : S.length = (8 : ℕ)) (g0 : Fin k), + let y1 : V := S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y2 : V := S.vertex (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y3 : V := S.vertex (⟨(3 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y5 : V := S.vertex (⟨(5 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y7 : V := S.vertex (⟨(7 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), by omega⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), by omega⟩ : Fin S.length); + let c0 : E := S.edge (⟨(6 : ℕ), by omega⟩ : Fin S.length); + (∀ {i j : Fin S.length}, i ≠ j → S.edge i ≠ S.edge j) → + psi b0 = some g0 → + psi b1 = some g0 → + ∀ (p0 : Fin ((↑(⟨(4 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))), + G.ends b0 = s(y5, S.vertex (p0.castLT (by omega))) → + ∀ (p1 : Fin ((↑(⟨(5 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))), + G.ends b1 = s(y6, S.vertex (p1.castLT (by omega))) → + ∀ (f1 f2 f3 : E) (v1 v2 : V), + psi f1 = some g0 → + psi f2 = some g0 → + psi f3 = some g0 → + G.ends f1 = s(y1, v1) → + G.ends f2 = s(y4, v2) → + G.ends f3 = s(y2, y3) → + b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1 → + c0 ≠ f3 → + ¬Incident G y7 f1 → + ¬Incident G y7 f2 → + ¬Incident G y7 f3 → + ¬Incident G y7 b0 → + ¬Incident G y7 b1 → + ∀ (q : Fin (7 : ℕ)), + q ≠ (0 : Fin (7 : ℕ)) → + ∃ (f : E), + f ≠ c0 ∧ + Incident G (S.vertex (⟨(↑q : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) f ∧ + psi f = some g0 ∧ + ¬Incident G y7 f := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen g0 y1 y2 y3 y4 y5 y6 y7 b0 b1 c0 hedge_ne h4' h5' + p0 hb0ends p1 hb1ends f1 f2 f3 v1 v2 hf1color hf2color hf3color hf1ends' hf2ends' hf3ends' + horient hc0_ne_f3 hno_f1 hno_f2 hno_f3 hno_b0 hno_b1 q hq + have hcases : q.val = 1 ∨ q.val = 2 ∨ q.val = 3 ∨ + q.val = 4 ∨ q.val = 5 ∨ q.val = 6 := by + have hq0 : q.val ≠ 0 := by intro h; apply hq; apply Fin.ext; exact h + omega + rcases hcases with h | h | h | h | h | h + · refine ⟨f1, ?_, ?_, hf1color, hno_f1⟩ + · rcases horient with ho | ho + · rw [← ho.1] + apply hedge_ne + norm_num + · rw [← ho.2.2.1] + apply hedge_ne + norm_num + · rw [Incident, hf1ends'] + have hv : S.vertex ⟨q.val, by omega⟩ = y1 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y1] using h + rw [hv] + simp + · refine ⟨f3, hc0_ne_f3.symm, ?_, hf3color, hno_f3⟩ + rw [Incident, hf3ends'] + have hv : S.vertex ⟨q.val, by omega⟩ = y2 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y2] using h + rw [hv] + simp + · refine ⟨f3, hc0_ne_f3.symm, ?_, hf3color, hno_f3⟩ + rw [Incident, hf3ends'] + have hv : S.vertex ⟨q.val, by omega⟩ = y3 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y3] using h + rw [hv] + simp + · refine ⟨f2, ?_, ?_, hf2color, hno_f2⟩ + · rcases horient with ho | ho + · rw [← ho.2.2.1] + apply hedge_ne + norm_num + · rw [← ho.1] + apply hedge_ne + norm_num + · rw [Incident, hf2ends'] + have hv : S.vertex ⟨q.val, by omega⟩ = y4 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y4] using h + rw [hv] + simp + · refine ⟨b0, ?_, ?_, h4', hno_b0⟩ + · apply hedge_ne + norm_num + · rw [Incident, hb0ends] + have hv : S.vertex ⟨q.val, by omega⟩ = y5 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y5] using h + rw [hv] + simp + · refine ⟨b1, ?_, ?_, h5', hno_b1⟩ + · apply hedge_ne + norm_num + · rw [Incident, hb1ends] + have hv : S.vertex ⟨q.val, by omega⟩ = y6 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y6] using h + rw [hv] + simp + +theorem helper_hcoverAlpha_795.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) + (hlen : S.length = (8 : ℕ)), + let y1 : V := S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y2 : V := S.vertex (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y3 : V := S.vertex (⟨(3 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y5 : V := S.vertex (⟨(5 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y7 : V := S.vertex (⟨(7 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let a1 : E := S.edge (⟨(1 : ℕ), by omega⟩ : Fin S.length); + let a3 : E := S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length); + let c0 : E := S.edge (⟨(6 : ℕ), by omega⟩ : Fin S.length); + (∀ {i j : Fin S.length}, i ≠ j → S.edge i ≠ S.edge j) → + ∀ (_ : Fin ((↑(⟨(4 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))) + (_ : Fin ((↑(⟨(5 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))) (alpha56 : E), + psi alpha56 = some M.alpha → + G.ends alpha56 = s(y5, y6) → + G.ends a1 = s(y1, y2) → + G.ends a3 = s(y3, y4) → + psi a1 = some M.alpha → + psi a3 = some M.alpha → + c0 ≠ alpha56 → + ¬Incident G y7 a1 → + ¬Incident G y7 a3 → + ¬Incident G y7 alpha56 → + ∀ (q : Fin (7 : ℕ)), + q ≠ (0 : Fin (7 : ℕ)) → + ∃ (f : E), + f ≠ c0 ∧ + Incident G (S.vertex (⟨(↑q : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) f ∧ + psi f = some M.alpha ∧ + ¬Incident G y7 f := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen y1 y2 y3 y4 y5 y6 y7 a1 a3 c0 hedge_ne p0 p1 + alpha56 halpha56color halpha56ends' ha1ends ha3ends ha1color ha3color hc0_ne_alpha56 hno_a1 + hno_a3 hno_alpha56 q hq + have hcases : q.val = 1 ∨ q.val = 2 ∨ q.val = 3 ∨ + q.val = 4 ∨ q.val = 5 ∨ q.val = 6 := by + have hq0 : q.val ≠ 0 := by intro h; apply hq; apply Fin.ext; exact h + omega + rcases hcases with h | h | h | h | h | h + · refine ⟨a1, by apply hedge_ne; norm_num, ?_, ha1color, hno_a1⟩ + rw [Incident, ha1ends] + have hv : S.vertex ⟨q.val, by omega⟩ = y1 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y1] using h + rw [hv]; simp + · refine ⟨a1, by apply hedge_ne; norm_num, ?_, ha1color, hno_a1⟩ + rw [Incident, ha1ends] + have hv : S.vertex ⟨q.val, by omega⟩ = y2 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y2] using h + rw [hv]; simp + · refine ⟨a3, by apply hedge_ne; norm_num, ?_, ha3color, hno_a3⟩ + rw [Incident, ha3ends] + have hv : S.vertex ⟨q.val, by omega⟩ = y3 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y3] using h + rw [hv]; simp + · refine ⟨a3, by apply hedge_ne; norm_num, ?_, ha3color, hno_a3⟩ + rw [Incident, ha3ends] + have hv : S.vertex ⟨q.val, by omega⟩ = y4 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y4] using h + rw [hv]; simp + · refine ⟨alpha56, hc0_ne_alpha56.symm, ?_, halpha56color, hno_alpha56⟩ + rw [Incident, halpha56ends'] + have hv : S.vertex ⟨q.val, by omega⟩ = y5 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y5] using h + rw [hv]; simp + · refine ⟨alpha56, hc0_ne_alpha56.symm, ?_, halpha56color, hno_alpha56⟩ + rw [Incident, halpha56ends'] + have hv : S.vertex ⟨q.val, by omega⟩ = y6 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y6] using h + rw [hv]; simp + +theorem helper_hcoverBeta_834.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) + (hlen : S.length = (8 : ℕ)), + let y0 : V := S.vertex (⟨(0 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y2 : V := S.vertex (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y3 : V := S.vertex (⟨(3 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y5 : V := S.vertex (⟨(5 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y7 : V := S.vertex (⟨(7 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let a2 : E := S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length); + let c0 : E := S.edge (⟨(6 : ℕ), by omega⟩ : Fin S.length); + (∀ {i j : Fin S.length}, i ≠ j → S.edge i ≠ S.edge j) → + ∀ (_ : Fin ((↑(⟨(4 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))) + (_ : Fin ((↑(⟨(5 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))) (beta56 : E), + psi beta56 = some M.beta → + G.ends beta56 = s(y5, y6) → + G.ends a2 = s(y2, y3) → + G.ends M.closingEdge = s(y4, y0) → + psi a2 = some M.beta → + psi M.closingEdge = some M.beta → + c0 ≠ beta56 → + c0 ≠ M.closingEdge → + ¬Incident G y7 a2 → + ¬Incident G y7 M.closingEdge → + ¬Incident G y7 beta56 → + ∀ (q : Fin (7 : ℕ)), + q ≠ (1 : Fin (7 : ℕ)) → + ∃ (f : E), + f ≠ c0 ∧ + Incident G (S.vertex (⟨(↑q : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) f ∧ + psi f = some M.beta ∧ + ¬Incident G y7 f := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen y0 y2 y3 y4 y5 y6 y7 a2 c0 hedge_ne p0 p1 beta56 + hbeta56color hbeta56ends' ha2ends hclosingEnds ha2color hclosingColor hc0_ne_beta56 + hc0_ne_closing hno_a2 hno_close hno_beta56 q hq + have hcases : q.val = 0 ∨ q.val = 2 ∨ q.val = 3 ∨ + q.val = 4 ∨ q.val = 5 ∨ q.val = 6 := by + have hq1 : q.val ≠ 1 := by intro h; apply hq; apply Fin.ext; exact h + omega + rcases hcases with h | h | h | h | h | h + · refine ⟨M.closingEdge, hc0_ne_closing.symm, ?_, hclosingColor, hno_close⟩ + rw [Incident, hclosingEnds] + have hv : S.vertex ⟨q.val, by omega⟩ = y0 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y0] using h + rw [hv]; simp + · refine ⟨a2, by apply hedge_ne; norm_num, ?_, ha2color, hno_a2⟩ + rw [Incident, ha2ends] + have hv : S.vertex ⟨q.val, by omega⟩ = y2 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y2] using h + rw [hv]; simp + · refine ⟨a2, by apply hedge_ne; norm_num, ?_, ha2color, hno_a2⟩ + rw [Incident, ha2ends] + have hv : S.vertex ⟨q.val, by omega⟩ = y3 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y3] using h + rw [hv]; simp + · refine ⟨M.closingEdge, hc0_ne_closing.symm, ?_, hclosingColor, hno_close⟩ + rw [Incident, hclosingEnds] + have hv : S.vertex ⟨q.val, by omega⟩ = y4 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y4] using h + rw [hv]; simp + · refine ⟨beta56, hc0_ne_beta56.symm, ?_, hbeta56color, hno_beta56⟩ + rw [Incident, hbeta56ends'] + have hv : S.vertex ⟨q.val, by omega⟩ = y5 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y5] using h + rw [hv]; simp + · refine ⟨beta56, hc0_ne_beta56.symm, ?_, hbeta56color, hno_beta56⟩ + rw [Incident, hbeta56ends'] + have hv : S.vertex ⟨q.val, by omega⟩ = y6 := by + apply congrArg S.vertex; apply Fin.ext; simpa [y6] using h + rw [hv]; simp + +theorem helper_last_pair_edge_881.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T), + let _ : DecidableEq V := Classical.decEq V; + ∀ {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence G e) + (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + IsProperEdgeColoring G psi → + ColoredVertexSetElementary G psi (TreeSequenceVertexSet S) → + ColoredVertexSetClosed G psi (TreeSequenceVertexSet S) → + let y7 : V := S.vertex (⟨(7 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y8 : V := S.vertex (⟨(8 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let c0 : E := S.edge (⟨(6 : ℕ), by omega⟩ : Fin S.length); + (∀ {i j : Fin (S.length + (1 : ℕ))}, i ≠ j → S.vertex i ≠ S.vertex j) → + (∀ (i : Fin (S.length + (1 : ℕ))), S.vertex i ∈ TreeSequenceVertexSet S) → + (∀ {c : Fin k} {v : V} {f : E}, + c ∈ MissingColors G psi v → Incident G v f → psi f ≠ some c) → + ∀ (_ : Fin ((↑(⟨(4 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))) + (_ : Fin ((↑(⟨(5 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))) (c : Fin k) + (m : Fin (7 : ℕ)), + c ∈ MissingColors G psi (S.vertex (⟨(↑m : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) → + (∀ (q : Fin (7 : ℕ)), + q ≠ m → + ∃ (f : E), + f ≠ c0 ∧ + Incident G (S.vertex (⟨(↑q : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) f ∧ + psi f = some c ∧ ¬Incident G y7 f) → + ∃ (f : E), + G.ends f = s(y7, y8) ∧ + psi f = some c := by + classical + intro V E _ _ _ G k e0 phi T N this e psi S M hlen hproper helem hclosed y7 y8 c0 hvertex_ne + hmem missing_excludes p0 p1 c m hcmiss hcover + have hmMem : S.vertex ⟨m.val, by omega⟩ ∈ TreeSequenceVertexSet S := + hmem (⟨m.val, by omega⟩ : Fin (S.length + 1)) + have hy7Mem : y7 ∈ TreeSequenceVertexSet S := by + simpa [y7] using hmem (⟨7, by omega⟩ : Fin (S.length + 1)) + have hym7 : S.vertex ⟨m.val, by omega⟩ ≠ y7 := by + apply hvertex_ne + apply Fin.ne_of_val_ne + change m.val ≠ 7 + omega + have hcnotmissing : c ∉ MissingColors G psi y7 := by + intro hc7 + have hd := helem hmMem hy7Mem hym7 + exact (Finset.disjoint_left.mp hd) hcmiss hc7 + have hcpresent : c ∈ PresentColors G psi y7 := by + simpa [MissingColors] using hcnotmissing + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hcpresent + obtain ⟨f, hfinc, hfcolor⟩ := hcpresent + obtain ⟨z, hfends⟩ := Sym2.mem_iff_exists.mp hfinc + have hzT : z ∈ TreeSequenceVertexSet S := by + by_contra hz + have hfBoundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet S) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨y7, hy7Mem, z, hz, hfends⟩ + exact (hclosed hfBoundary hmMem hfcolor) hcmiss + obtain ⟨q, -, hqz⟩ := Finset.mem_image.mp + (show z ∈ Finset.image S.vertex Finset.univ from by + simpa [TreeSequenceVertexSet] using hzT) + have hq8 : q.val = 8 := by + have hqbound : q.val < 9 := by + calc + q.val < S.length + 1 := q.isLt + _ = 9 := by omega + by_contra hne + by_cases hq7 : q.val = 7 + · have hz7 : z = y7 := by + rw [← hqz] + apply congrArg S.vertex + apply Fin.ext + simpa [y7] using hq7 + exact G.loopless f y7 (by simpa [hz7] using hfends) + · have hqlt : q.val < 7 := by omega + let q7 : Fin 7 := ⟨q.val, hqlt⟩ + have hzq : z = S.vertex ⟨q7.val, by omega⟩ := by + calc + z = S.vertex q := hqz.symm + _ = S.vertex ⟨q7.val, by omega⟩ := by + apply congrArg S.vertex + apply Fin.ext + rfl + by_cases hqm : q7 = m + · have hincm : Incident G (S.vertex ⟨m.val, by omega⟩) f := by + rw [Incident, hfends, hzq] + have hv : S.vertex ⟨q7.val, by omega⟩ = + S.vertex ⟨m.val, by omega⟩ := by + apply congrArg S.vertex + apply Fin.ext + simpa using congrArg Fin.val hqm + rw [hv] + simp + exact (missing_excludes hcmiss hincm) hfcolor + · obtain ⟨g, _, hginc, hgcolor, hgno7⟩ := hcover q7 hqm + have hfne : f ≠ g := by + intro heq + exact hgno7 (heq ▸ hfinc) + have hfincq : Incident G (S.vertex ⟨q7.val, by omega⟩) f := by + rw [Incident, hfends, hzq] + simp + exact (hproper hfne ⟨S.vertex ⟨q7.val, by omega⟩, + hfincq, hginc⟩ hfcolor) hgcolor + have hzy8 : z = y8 := by + rw [← hqz] + apply congrArg S.vertex + apply Fin.ext + simpa [y8] using hq8 + exact ⟨f, by simpa [hzy8] using hfends, hfcolor⟩ + +theorem helper_newEdge_injective_1199.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (_ : NormalGlobalMaximumTriple G k e psi S) + (hlen : S.length = (8 : ℕ)), + let y5 : V := S.vertex (⟨(5 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let a1 : E := S.edge (⟨(1 : ℕ), by omega⟩ : Fin S.length); + let a3 : E := S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length); + let b0 : E := S.edge (⟨(4 : ℕ), by omega⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), by omega⟩ : Fin S.length); + let c0 : E := S.edge (⟨(6 : ℕ), by omega⟩ : Fin S.length); + let c1 : E := S.edge (⟨(7 : ℕ), by omega⟩ : Fin S.length); + ∀ (_ : Fin ((↑(⟨(4 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))) + (_ : Fin ((↑(⟨(5 : ℕ), by omega⟩ : Fin S.length) : ℕ) + (1 : ℕ))) (f1 f2 : E) + (v1 v2 : V), + b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1 → + ∀ (beta56 : E), + let a0 : E := S.edge (⟨(0 : ℕ), by omega⟩ : Fin S.length); + a0 = e → + beta56 ≠ a0 → + beta56 ≠ f1 → + beta56 ≠ f2 → + beta56 ≠ a1 → + beta56 ≠ a3 → + beta56 ≠ c0 → + beta56 ≠ c1 → + let edgeList : List E := [a0, f1, beta56, f2, a1, a3, c0, c1]; + ∀ (hedgeListLength : edgeList.length = (8 : ℕ)), + let newEdge : Fin (8 : ℕ) → E := fun (i : Fin (8 : ℕ)) ↦ + edgeList.get (Fin.cast (by omega) i); + (∀ (i j : Fin S.length), S.edge i = S.edge j ↔ i = j) → + Function.Injective newEdge := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen y5 y6 a1 a3 b0 b1 c0 c1 p0 p1 f1 f2 v1 v2 horient + beta56 a0 ha0eq hbeta_a0 hbeta_f1 hbeta_f2 hbeta_a1 hbeta_a3 hbeta_c0 hbeta_c1 edgeList + hedgeListLength newEdge hedge_iff + have hnodup : edgeList.Nodup := by + rcases horient with ho | ho + · have hb0beta : b0 ≠ beta56 := by + intro hh + exact hbeta_f1 (hh.symm.trans ho.1) + have hbeta_b1 : beta56 ≠ b1 := by + intro hh + exact hbeta_f2 (hh.trans ho.2.2.1) + simp [edgeList, ← ho.1, ← ho.2.2.1, a0, a1, + a3, b0, b1, c0, c1, hedge_iff, hbeta_a1, hbeta_a3, hbeta_c0, hbeta_c1, + Ne.symm hbeta_a0, hb0beta, hbeta_b1] + · have hb1beta : b1 ≠ beta56 := by + intro hh + exact hbeta_f1 (hh.symm.trans ho.2.2.1) + have hbeta_b0 : beta56 ≠ b0 := by + intro hh + exact hbeta_f2 (hh.trans ho.1) + simp [edgeList, ← ho.2.2.1, ← ho.1, a0, a1, + a3, b0, b1, c0, c1, hedge_iff, hbeta_a1, hbeta_a3, hbeta_c0, hbeta_c1, + Ne.symm hbeta_a0, hb1beta, hbeta_b0] + intro i j hij + have hcast := hnodup.injective_get hij + apply Fin.ext + simpa using congrArg Fin.val hcast + +theorem helper_horient_1122.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y5 : V := S.vertex (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); + ∀ (f1 f2 : E) (v1 v2 : V), ( + ∀ (j : Fin (2 : ℕ)), S.edge (⟨(4 : ℕ) + (↑j : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) + (↑j : + ℕ) < S.length) ↦ + by + omega + ⟩ : Fin S.length) = f1 ∧ S.vertex (⟨(5 : ℕ) + (↑j : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) + (↑j : + ℕ) < S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))) = v1 ∨ S.edge (⟨(4 : ℕ) + (↑j : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) + (↑j : + ℕ) < S.length) ↦ + by + omega + ⟩ : Fin S.length) = f2 ∧ S.vertex (⟨(5 : ℕ) + (↑j : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) + (↑j : + ℕ) < S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))) = v2) → b0 ≠ b1 → b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = + f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1 := by + classical + intro V E _ _ _ G k e psi S M hlen y5 y6 b0 b1 f1 f2 v1 v2 classifyFirst hb01ne + have h0 := classifyFirst (0 : Fin 2) + have h1 := classifyFirst (1 : Fin 2) + rcases h0 with h0 | h0 <;> rcases h1 with h1 | h1 + · exact False.elim (hb01ne (by simpa [b0, b1] using h0.1.trans h1.1.symm)) + · left + simpa [b0, b1, y5, y6] using ⟨h0.1, h0.2, h1.1, h1.2⟩ + · right + simpa [b0, b1, y5, y6] using ⟨h0.1, h0.2, h1.1, h1.2⟩ + · exact False.elim (hb01ne (by simpa [b0, b1] using h0.1.trans h1.1.symm)) + +theorem helper_ha1ends_1148.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (M : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), M.height = + (5 : ℕ) → + let y1 : V := S.vertex (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y2 : V := S.vertex (⟨(2 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let a1 : E := S.edge (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); G.ends a1 = s(y1, y2) := by + classical + intro V E _ _ _ G k e psi S M hlen hheight y1 y2 a1 + let r : Fin S.length := ⟨1, by omega⟩ + have ht := M.trunk_edge_ends r (by simp [r]) (by simp [hheight, r]) + have hs : r.succ = (⟨2, by omega⟩ : Fin (S.length + 1)) := Fin.ext rfl + rw [hs] at ht + simpa [a1, y1, y2, r] using ht + +theorem helper_ha2ends_1154.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (M : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), M.height = + (5 : ℕ) → + let y2 : V := S.vertex (⟨(2 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y3 : V := S.vertex (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let a2 : E := S.edge (⟨(2 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); G.ends a2 = s(y2, y3) := by + classical + intro V E _ _ _ G k e psi S M hlen hheight y2 y3 a2 + let r : Fin S.length := ⟨2, by omega⟩ + have ht := M.trunk_edge_ends r (by simp [r]) (by simp [hheight, r]) + have hs : r.succ = (⟨3, by omega⟩ : Fin (S.length + 1)) := Fin.ext rfl + rw [hs] at ht + simpa [a2, y2, y3, r] using ht + +theorem helper_ha3ends_1160.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (M : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), M.height = + (5 : ℕ) → + let y3 : V := S.vertex (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let a3 : E := S.edge (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length) ↦ + by omega + ⟩ : Fin S.length); G.ends a3 = s(y3, y4) := by + classical + intro V E _ _ _ G k e psi S M hlen hheight y3 y4 a3 + let r : Fin S.length := ⟨3, by omega⟩ + have ht := M.trunk_edge_ends r (by simp [r]) (by simp [hheight, r]) + have hs : r.succ = (⟨4, by omega⟩ : Fin (S.length + 1)) := Fin.ext rfl + rw [hs] at ht + simpa [a3, y3, y4, r] using ht + +theorem helper_hab_1198.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (M : NormalGlobalMaximumTriple G k e psi S), S.length = (8 : ℕ) → + ColoredVertexSetElementary G psi (TreeSequenceVertexSet S) → ( + ∀ {i j : Fin (S.length + (1 : ℕ))}, i ≠ j → S.vertex i ≠ S.vertex j) → ( + ∀ (i : Fin (S.length + (1 : ℕ))), S.vertex i ∈ TreeSequenceVertexSet S) → M.alpha ≠ M.beta := by + classical + intro V E _ _ _ G k e psi S M hlen helem hvertex_ne hmem hEq + have hd := helem (hmem (⟨0, by omega⟩ : Fin (S.length + 1))) + (hmem (⟨1, by omega⟩ : Fin (S.length + 1))) + (by apply hvertex_ne; norm_num) + exact (Finset.disjoint_left.mp hd) M.alpha_missing + (by simpa [hEq] using M.beta_missing) + +theorem helper_no_y7_of_ends_1435.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y7 : V := S.vertex (⟨(7 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + ∀ {f : E} {u v : V}, G.ends f = s(u, v) → u ≠ y7 → v ≠ y7 → ¬Incident G y7 f := by + classical + intro V E _ _ _ G k e psi S M hlen y7 f u v hf hu hv hinc + rw [Incident, hf] at hinc + rcases Sym2.mem_iff.mp hinc with h | h + · exact hu h.symm + · exact hv h.symm + +theorem helper_continuation_2887.{u_1, u_2} : + helperContinuation2887Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k hgraphHeight Good e psi S M hbal hlen hheight g0 y0 y1 y2 y3 y4 y5 y6 y7 y8 + a1 a2 a3 b0 b1 c0 c1 hg0' f1 f2 v1 v2 hf1color hf2color hf1ends' hf2ends' horient beta56 + hbeta56ends hbeta56color ha1ends ha2ends ha3ends ha1color ha2color ha3color hab hg0alpha + hg0beta r6' w g1 hc1color hc0color' hwmissing' hg10 hg1alpha hg1beta g0last hg0lastEnds + hg0lastColor alphaLast halphaLastEnds halphaLastColor betaLast hbetaLastEnds hbetaLastColor + a0 rebase + by_cases hwbase : 5 ≤ w.val + · obtain ⟨S', M', hlen', hheight', hbal', hv0', hv1', hv2', hv3', + hv4', hv5', hv6', hv7', hv8', he0', he1', he2', he3', he4', + he5', he6', he7', hMalpha, hMbeta⟩ := rebase hwbase + have hwcases : w.val = 5 ∨ w.val = 6 := by + have hwlt : w.val < 7 := by simp [r6'] + omega + obtain ⟨m', hmvertex⟩ : ∃ m' : Fin 5, + S'.vertex ⟨m'.val, by omega⟩ = S.vertex ⟨w.val, by omega⟩ := by + rcases hwcases with hw5 | hw6 + · rcases horient with ho | ho + · refine ⟨2, ?_⟩ + calc + S'.vertex ⟨(2 : Fin 5).val, by omega⟩ = + S'.vertex ⟨2, by omega⟩ := by congr 1 + _ = v1 := hv2' + _ = y5 := ho.2.1.symm + _ = S.vertex ⟨w.val, by omega⟩ := by + apply congrArg S.vertex + apply Fin.ext + simpa [y5] using hw5.symm + · refine ⟨3, ?_⟩ + calc + S'.vertex ⟨(3 : Fin 5).val, by omega⟩ = + S'.vertex ⟨3, by omega⟩ := by congr 1 + _ = v2 := hv3' + _ = y5 := ho.2.1.symm + _ = S.vertex ⟨w.val, by omega⟩ := by + apply congrArg S.vertex + apply Fin.ext + simpa [y5] using hw5.symm + · rcases horient with ho | ho + · refine ⟨3, ?_⟩ + calc + S'.vertex ⟨(3 : Fin 5).val, by omega⟩ = + S'.vertex ⟨3, by omega⟩ := by congr 1 + _ = v2 := hv3' + _ = y6 := ho.2.2.2.symm + _ = S.vertex ⟨w.val, by omega⟩ := by + apply congrArg S.vertex + apply Fin.ext + simpa [y6] using hw6.symm + · refine ⟨2, ?_⟩ + calc + S'.vertex ⟨(2 : Fin 5).val, by omega⟩ = + S'.vertex ⟨2, by omega⟩ := by congr 1 + _ = v1 := hv2' + _ = y6 := ho.2.2.2.symm + _ = S.vertex ⟨w.val, by omega⟩ := by + apply congrArg S.vertex + apply Fin.ext + simpa [y6] using hw6.symm + refine ⟨e, psi, S', M', ?_⟩ + refine P2968_T2_ScheideOrderNineBlockCompletion G k psi S' M' hbal' hgraphHeight hlen' + hheight' M.alpha g1 + (by rw [hv0']; simpa [y0] using M.alpha_missing) m' + (by rw [hmvertex]; exact hwmissing') + (by rw [hMalpha]; exact hg0alpha.symm) + (by rw [hMbeta]; exact hab) + (by rw [hMalpha]; exact hg10) + (by rw [hMbeta]; exact hg1beta) + hg1alpha a1 a3 a2 alphaLast g0last betaLast y2 y3 + (by simpa only [hv1'] using ha1ends) + (by simpa only [hv4', Sym2.eq_swap] using ha3ends) + ha1color ha3color ha2ends + (by rw [hMbeta]; exact ha2color) + (by simpa only [hv7', hv8'] using halphaLastEnds) + halphaLastColor + (by simpa only [hv7', hv8'] using hg0lastEnds) + (by rw [hMalpha]; exact hg0lastColor) + (by simpa only [hv7', hv8'] using hbetaLastEnds) + (by rw [hMbeta]; exact hbetaLastColor) + (Or.inl ⟨he4', hv5', he5', hv6'⟩) ?_ + intro j + fin_cases j + · simpa only using (he6' ▸ hc0color') + · simpa only using (he7' ▸ hc1color) + · have hwlt : w.val < 5 := by omega + let m' : Fin 5 := ⟨w.val, hwlt⟩ + refine ⟨e, psi, S, M, ?_⟩ + refine P2968_T2_ScheideOrderNineBlockCompletion G k psi S M hbal hgraphHeight hlen hheight g0 + g1 hg0' m' + (by simpa [m'] using hwmissing') hg0alpha hg0beta hg1alpha hg1beta + hg10 f1 f2 beta56 g0last alphaLast betaLast v1 v2 hf1ends' hf2ends' + hf1color hf2color hbeta56ends hbeta56color hg0lastEnds hg0lastColor + halphaLastEnds halphaLastColor + hbetaLastEnds hbetaLastColor + (by simpa [b0, b1, y5, y6] using horient) ?_ + intro j + fin_cases j + · simpa [c0] using hc0color' + · simpa [c1] using hc1color + +theorem helper_nv2_3221.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y5 : V := S.vertex (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 f2 : E) (v1 v2 : V), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + Fin (9 : ℕ) → Fin (S.length + (1 : ℕ))) ((permA : Fin (9 : ℕ) → Fin (9 : ℕ)) i)) else + S.vertex ((cast9 : Fin (9 : ℕ) → Fin (S.length + (1 : ℕ))) ((permB : Fin (9 : ℕ) → Fin (9 + : ℕ)) i)); (b0 = f1 → y5 = v1 ∧ b1 = f2 ∧ y6 = v2) → (b0 ≠ f1 → y5 = v2 ∧ b1 = f1 ∧ y6 = + v1) → ( + ∀ (i : Fin (9 : ℕ)) (q : Fin (S.length + (1 : ℕ))), (↑i : ℕ) = (↑q : ℕ) → S.vertex ((cast9 : + Fin (9 : ℕ) → Fin (S.length + (1 : ℕ))) i) = S.vertex q) → newVertex (2 : Fin (9 : ℕ)) = + v1 := by + classical + intro V E _ _ _ G k e psi S M hlen y5 y6 b0 b1 f1 f2 v1 v2 r6' w cast9 permA permB newVertex + hselectA hselectB vertex_cast9 + by_cases hb : b0 = f1 + · calc + newVertex 2 = y5 := by + simp only [newVertex, ite_eq_left hb, y5] + apply vertex_cast9 + simp [permA, Equiv.swap_apply_def] + _ = v1 := (hselectA hb).1 + · calc + newVertex 2 = y6 := by + simp only [newVertex, ite_eq_right hb, y6] + apply vertex_cast9 + simp [permB, Equiv.swap_apply_def] + _ = v1 := (hselectB hb).2.2 + +theorem helper_nv3_3235.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y5 : V := S.vertex (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 f2 : E) (v1 v2 : V), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + Fin (9 : ℕ) → Fin (S.length + (1 : ℕ))) ((permA : Fin (9 : ℕ) → Fin (9 : ℕ)) i)) else + S.vertex ((cast9 : Fin (9 : ℕ) → Fin (S.length + (1 : ℕ))) ((permB : Fin (9 : ℕ) → Fin (9 + : ℕ)) i)); (b0 = f1 → y5 = v1 ∧ b1 = f2 ∧ y6 = v2) → (b0 ≠ f1 → y5 = v2 ∧ b1 = f1 ∧ y6 = + v1) → ( + ∀ (i : Fin (9 : ℕ)) (q : Fin (S.length + (1 : ℕ))), (↑i : ℕ) = (↑q : ℕ) → S.vertex ((cast9 : + Fin (9 : ℕ) → Fin (S.length + (1 : ℕ))) i) = S.vertex q) → newVertex (3 : Fin (9 : ℕ)) = + v2 := by + classical + intro V E _ _ _ G k e psi S M hlen y5 y6 b0 b1 f1 f2 v1 v2 r6' w cast9 permA permB newVertex + hselectA hselectB vertex_cast9 + by_cases hb : b0 = f1 + · calc + newVertex 3 = y6 := by + simp only [newVertex, ite_eq_left hb, y6] + apply vertex_cast9 + simp [permA, Equiv.swap_apply_def] + _ = v2 := (hselectA hb).2.2 + · calc + newVertex 3 = y5 := by + simp only [newVertex, ite_eq_right hb, y5] + apply vertex_cast9 + simp [permB, Equiv.swap_apply_def] + _ = v2 := (hselectB hb).1 + +theorem helper_firstSeven_3311.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y0 : V := S.vertex (⟨(0 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y1 : V := S.vertex (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y2 : V := S.vertex (⟨(2 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y3 : V := S.vertex (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y5 : V := S.vertex (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 f2 : E) (v1 v2 : V), b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 + ∧ y6 = v1 → + ∀ (_ : E), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + Fin (9 : ℕ) → Fin (S.length + (1 : ℕ))) ((permA : Fin (9 : ℕ) → Fin (9 : ℕ)) i)) else + S.vertex ((cast9 : Fin (9 : ℕ) → Fin (S.length + (1 : ℕ))) ((permB : Fin (9 : ℕ) → Fin (9 + : ℕ)) i)); newVertex (0 : Fin (9 : ℕ)) = y0 → newVertex (1 : Fin (9 : ℕ)) = y1 → newVertex + (2 : Fin (9 : ℕ)) = v1 → newVertex (3 : Fin (9 : ℕ)) = v2 → newVertex (4 : Fin (9 : ℕ)) = + y4 → newVertex (5 : Fin (9 : ℕ)) = y2 → newVertex (6 : Fin (9 : ℕ)) = y3 → + ∀ (q : Fin (7 : ℕ)), + ∃ (t : Fin (7 : ℕ)), newVertex (Fin.castLE ( + by + omega + ) t) = S.vertex (⟨(↑q : ℕ), + by + omega + ⟩ : Fin (S.length + (1 : ℕ))) := by + classical + intro V E _ _ _ G k e psi S M hlen y0 y1 y2 y3 y4 y5 y6 b0 b1 f1 f2 v1 v2 horient beta56 r6' w + cast9 permA permB newVertex nv0 nv1 nv2 nv3 nv4 nv5 nv6 q + fin_cases q + · exact ⟨0, by change newVertex 0 = y0; exact nv0⟩ + · exact ⟨1, by change newVertex 1 = y1; exact nv1⟩ + · exact ⟨5, by change newVertex 5 = y2; exact nv5⟩ + · exact ⟨6, by change newVertex 6 = y3; exact nv6⟩ + · exact ⟨4, by change newVertex 4 = y4; exact nv4⟩ + · rcases horient with ho | ho + · exact ⟨2, by change newVertex 2 = y5; rw [nv2]; exact ho.2.1.symm⟩ + · exact ⟨3, by change newVertex 3 = y5; rw [nv3]; exact ho.2.1.symm⟩ + · rcases horient with ho | ho + · exact ⟨3, by change newVertex 3 = y6; rw [nv3]; exact ho.2.2.2.symm⟩ + · exact ⟨2, by change newVertex 2 = y6; rw [nv2]; exact ho.2.2.2.symm⟩ + +theorem helper_firstEight_3682.{u_1, u_2} : + helperFirstEight3682Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e psi S M hlen y7 b0 f1 f2 beta56 r6' r7' w cast9 permA permB newVertex nv7 + firstSeven pc1 q + by_cases hq : q.val = 7 + · have hqeq : q = (7 : Fin 8) := Fin.ext hq + subst q + refine ⟨7, ?_⟩ + change newVertex 7 = y7 + exact nv7 + · let q' : Fin 7 := ⟨q.val, by omega⟩ + obtain ⟨t, ht⟩ := firstSeven q' + refine ⟨Fin.castLE (by norm_num : 7 ≤ 8) t, ?_⟩ + simpa [q'] using ht + +theorem helper_hselectA_3623.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {e : E} (S : TreeSequence G e) + (hlen : S.length = (8 : ℕ)), + let y5 : V := S.vertex (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 f2 : E) (v1 v2 : V) (_ : b0 ≠ b1) (_ : b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ + y5 = v2 ∧ b1 = f1 ∧ y6 = v1) (_ : b0 = f1), y5 = v1 ∧ b1 = f2 ∧ y6 = v2 := by + classical + intro V E G e S hlen y5 y6 b0 b1 f1 f2 v1 v2 hb01ne horient hb + rcases horient with ho | ho + · exact ⟨ho.2.1, ho.2.2.1, ho.2.2.2⟩ + · exfalso + apply hb01ne + calc + b0 = f1 := hb + _ = b1 := ho.2.2.1.symm + +theorem helper_nv0_3642.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y0 : V := S.vertex (⟨(0 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 : E), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permA : (a : Fin (9 : ℕ)) → Fin (9 : ℕ)) + i)) else S.vertex ((cast9 : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permB : (a : + Fin (9 : ℕ)) → Fin (9 : ℕ)) i)); + ∀ (_ : + ∀ (i : Fin (9 : ℕ)) (q : Fin (S.length + (1 : ℕ))) (_ : (↑i : ℕ) = (↑q : ℕ)), S.vertex ((cast9 + : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) i) = S.vertex q), newVertex (0 : Fin (9 : + ℕ)) = y0 := by + classical + intro V E _ _ _ G k e psi S M hlen y0 b0 f1 r6' w cast9 permA permB newVertex vertex_cast9 + by_cases hb : b0 = f1 + · simp only [newVertex, ite_eq_left hb, y0] + apply vertex_cast9 + simp [permA, Equiv.swap_apply_def] + · simp only [newVertex, ite_eq_right hb, y0] + apply vertex_cast9 + simp [permB, Equiv.swap_apply_def] + +theorem helper_nv1_3650.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y1 : V := S.vertex (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 : E), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permA : (a : Fin (9 : ℕ)) → Fin (9 : ℕ)) + i)) else S.vertex ((cast9 : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permB : (a : + Fin (9 : ℕ)) → Fin (9 : ℕ)) i)); + ∀ (_ : + ∀ (i : Fin (9 : ℕ)) (q : Fin (S.length + (1 : ℕ))) (_ : (↑i : ℕ) = (↑q : ℕ)), S.vertex ((cast9 + : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) i) = S.vertex q), newVertex (1 : Fin (9 : + ℕ)) = y1 := by + classical + intro V E _ _ _ G k e psi S M hlen y1 b0 f1 r6' w cast9 permA permB newVertex vertex_cast9 + by_cases hb : b0 = f1 + · simp only [newVertex, ite_eq_left hb, y1] + apply vertex_cast9 + simp [permA, Equiv.swap_apply_def] + · simp only [newVertex, ite_eq_right hb, y1] + apply vertex_cast9 + simp [permB, Equiv.swap_apply_def] + +theorem helper_nv4_3666.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y4 : V := S.vertex (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 : E), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permA : (a : Fin (9 : ℕ)) → Fin (9 : ℕ)) + i)) else S.vertex ((cast9 : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permB : (a : + Fin (9 : ℕ)) → Fin (9 : ℕ)) i)); + ∀ (_ : + ∀ (i : Fin (9 : ℕ)) (q : Fin (S.length + (1 : ℕ))) (_ : (↑i : ℕ) = (↑q : ℕ)), S.vertex ((cast9 + : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) i) = S.vertex q), newVertex (4 : Fin (9 : + ℕ)) = y4 := by + classical + intro V E _ _ _ G k e psi S M hlen y4 b0 f1 r6' w cast9 permA permB newVertex vertex_cast9 + by_cases hb : b0 = f1 + · simp only [newVertex, ite_eq_left hb, y4] + apply vertex_cast9 + simp [permA, Equiv.swap_apply_def] + · simp only [newVertex, ite_eq_right hb, y4] + apply vertex_cast9 + simp [permB, Equiv.swap_apply_def] + +theorem helper_nv5_3674.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y2 : V := S.vertex (⟨(2 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(2 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 : E), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permA : (a : Fin (9 : ℕ)) → Fin (9 : ℕ)) + i)) else S.vertex ((cast9 : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permB : (a : + Fin (9 : ℕ)) → Fin (9 : ℕ)) i)); + ∀ (_ : + ∀ (i : Fin (9 : ℕ)) (q : Fin (S.length + (1 : ℕ))) (_ : (↑i : ℕ) = (↑q : ℕ)), S.vertex ((cast9 + : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) i) = S.vertex q), newVertex (5 : Fin (9 : + ℕ)) = y2 := by + classical + intro V E _ _ _ G k e psi S M hlen y2 b0 f1 r6' w cast9 permA permB newVertex vertex_cast9 + by_cases hb : b0 = f1 + · simp only [newVertex, ite_eq_left hb, y2] + apply vertex_cast9 + simp [permA, Equiv.swap_apply_def] + · simp only [newVertex, ite_eq_right hb, y2] + apply vertex_cast9 + simp [permB, Equiv.swap_apply_def] + +theorem helper_nv6_3682.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y3 : V := S.vertex (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 : E), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permA : (a : Fin (9 : ℕ)) → Fin (9 : ℕ)) + i)) else S.vertex ((cast9 : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permB : (a : + Fin (9 : ℕ)) → Fin (9 : ℕ)) i)); + ∀ (_ : + ∀ (i : Fin (9 : ℕ)) (q : Fin (S.length + (1 : ℕ))) (_ : (↑i : ℕ) = (↑q : ℕ)), S.vertex ((cast9 + : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) i) = S.vertex q), newVertex (6 : Fin (9 : + ℕ)) = y3 := by + classical + intro V E _ _ _ G k e psi S M hlen y3 b0 f1 r6' w cast9 permA permB newVertex vertex_cast9 + by_cases hb : b0 = f1 + · simp only [newVertex, ite_eq_left hb, y3] + apply vertex_cast9 + simp [permA, Equiv.swap_apply_def] + · simp only [newVertex, ite_eq_right hb, y3] + apply vertex_cast9 + simp [permB, Equiv.swap_apply_def] + +theorem helper_nv7_3690.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y7 : V := S.vertex (⟨(7 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 : E), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permA : (a : Fin (9 : ℕ)) → Fin (9 : ℕ)) + i)) else S.vertex ((cast9 : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permB : (a : + Fin (9 : ℕ)) → Fin (9 : ℕ)) i)); + ∀ (_ : + ∀ (i : Fin (9 : ℕ)) (q : Fin (S.length + (1 : ℕ))) (_ : (↑i : ℕ) = (↑q : ℕ)), S.vertex ((cast9 + : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) i) = S.vertex q), newVertex (7 : Fin (9 : + ℕ)) = y7 := by + classical + intro V E _ _ _ G k e psi S M hlen y7 b0 f1 r6' w cast9 permA permB newVertex vertex_cast9 + by_cases hb : b0 = f1 + · simp only [newVertex, ite_eq_left hb, y7] + apply vertex_cast9 + simp [permA, Equiv.swap_apply_def] + · simp only [newVertex, ite_eq_right hb, y7] + apply vertex_cast9 + simp [permB, Equiv.swap_apply_def] + +theorem helper_nv8_3698.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y8 : V := S.vertex (⟨(8 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(8 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 : E), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permA : (a : Fin (9 : ℕ)) → Fin (9 : ℕ)) + i)) else S.vertex ((cast9 : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permB : (a : + Fin (9 : ℕ)) → Fin (9 : ℕ)) i)); + ∀ (_ : + ∀ (i : Fin (9 : ℕ)) (q : Fin (S.length + (1 : ℕ))) (_ : (↑i : ℕ) = (↑q : ℕ)), S.vertex ((cast9 + : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) i) = S.vertex q), newVertex (8 : Fin (9 : + ℕ)) = y8 := by + classical + intro V E _ _ _ G k e psi S M hlen y8 b0 f1 r6' w cast9 permA permB newVertex vertex_cast9 + by_cases hb : b0 = f1 + · simp only [newVertex, ite_eq_left hb, y8] + apply vertex_cast9 + simp [permA, Equiv.swap_apply_def] + · simp only [newVertex, ite_eq_right hb, y8] + apply vertex_cast9 + simp [permB, Equiv.swap_apply_def] + +theorem helper_hedge_iff_3716.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 : E), + let r6' : Fin S.length := (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑r6' : ℕ) + (1 : ℕ))), + let cast9 : Fin (9 : ℕ) ≃ Fin (S.length + (1 : ℕ)) := finCongr ( + by + omega + ); + let permA : Equiv.Perm (Fin (9 : ℕ)) := Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (5 : Fin (9 + : ℕ))) (Equiv.swap (3 : Fin (9 : ℕ)) (6 : Fin (9 : ℕ))); + let permB : Equiv.Perm (Fin (9 : ℕ)) := (Equiv.trans (Equiv.swap (2 : Fin (9 : ℕ)) (6 : Fin (9 + : ℕ))) (Equiv.swap (2 : Fin (9 : ℕ)) (3 : Fin (9 : ℕ)))).trans (Equiv.swap (2 : Fin (9 : + ℕ)) (5 : Fin (9 : ℕ))); + let newVertex : Fin (9 : ℕ) → V := fun (i : Fin (9 : ℕ)) ↦ if b0 = f1 then S.vertex ((cast9 : + (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permA : (a : Fin (9 : ℕ)) → Fin (9 : ℕ)) + i)) else S.vertex ((cast9 : (a : Fin (9 : ℕ)) → Fin (S.length + (1 : ℕ))) ((permB : (a : + Fin (9 : ℕ)) → Fin (9 : ℕ)) i)); Function.Injective newVertex := by + classical + intro V E _ _ _ G k e psi S M hlen b0 f1 r6' w cast9 permA permB newVertex + by_cases hb : b0 = f1 + · intro i j hij + simp only [newVertex, ite_eq_left hb] at hij + exact permA.injective (cast9.injective (S.vertex_injective hij)) + · intro i j hij + simp only [newVertex, ite_eq_right hb] at hij + exact permB.injective (cast9.injective (S.vertex_injective hij)) + +theorem helper_newEdge_injective_3726.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : + ℕ)), + let y5 : V := S.vertex (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y6 : V := S.vertex (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let a1 : E := S.edge (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let a3 : E := S.edge (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let b0 : E := S.edge (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let b1 : E := S.edge (⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let c0 : E := S.edge (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let c1 : E := S.edge (⟨(7 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (_ : Fin ((↑(⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length) : ℕ) + (1 : ℕ))) (_ : Fin ((↑(⟨(5 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(5 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length) : ℕ) + (1 : ℕ))) (f1 f2 : E) (v1 v2 : V) (_ : b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ + y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1) (beta56 : E), + let a0 : E := S.edge (⟨(0 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (_ : a0 = e) (_ : beta56 ≠ a0) (_ : beta56 ≠ f1) (_ : beta56 ≠ f2) (_ : beta56 ≠ a1) (_ : + beta56 ≠ a3) (_ : beta56 ≠ c0) (_ : beta56 ≠ c1), + let edgeList : List E := [a0, f1, beta56, f2, a1, a3, c0, c1]; + ∀ (hedgeListLength : edgeList.length = (8 : ℕ)), + let newEdge : Fin (8 : ℕ) → E := fun (i : Fin (8 : ℕ)) ↦ edgeList.get (Fin.cast (Eq.symm + hedgeListLength) i); + ∀ (_ : + ∀ (i j : Fin S.length), S.edge i = S.edge j ↔ i = j), Function.Injective newEdge := by + classical + intro V E _ _ _ G k e0 phi T N e psi S M hlen y5 y6 a1 a3 b0 b1 c0 c1 p0 p1 f1 f2 v1 v2 horient + beta56 a0 ha0eq hbeta_a0 hbeta_f1 hbeta_f2 hbeta_a1 hbeta_a3 hbeta_c0 hbeta_c1 edgeList + hedgeListLength newEdge hedge_iff + apply helper_newEdge_injective_1199 <;> assumption +theorem helper_hS'tash_4523.{u_1, u_2} : + helperHS'tash4523Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e psi S M hlen g0 y0 y1 y2 y3 y4 y7 y8 a1 a3 b0 c0 c1 hg0' f1 f2 v1 v2 + hf1color hf2color hf1ends' hf2ends' beta56 hbeta56ends hbeta56color ha1ends ha3ends ha1color + ha3color r6' r7' w g1 hc1color hc0color' pc pc' hc0ends a0 ha0eq ha0ends cast9 permA permB + newVertex edgeList hedgeListLength newEdge nv0 nv1 nv2 nv3 nv4 nv5 nv6 nv7 nv8 ne0 ne1 ne2 ne3 + ne4 ne5 ne6 ne7 newVertex_injective newEdge_injective pc1 pc1' hc1ends tc0 htc0 tc1 htc1 tw S' + hS'length htwMissing j hj + fin_cases j + · simp at hj + · refine ⟨0, g0, ?_, ?_⟩ + · change psi (newEdge 1) = some g0 + rw [ne1] + exact hf1color + · change g0 ∈ MissingColors G psi (newVertex 0) + rw [nv0] + exact hg0' + · refine ⟨1, M.beta, ?_, ?_⟩ + · change psi (newEdge 2) = some M.beta + rw [ne2] + exact hbeta56color + · change M.beta ∈ MissingColors G psi (newVertex 1) + rw [nv1] + simpa [y1] using M.beta_missing + · refine ⟨0, g0, ?_, ?_⟩ + · change psi (newEdge 3) = some g0 + rw [ne3] + exact hf2color + · change g0 ∈ MissingColors G psi (newVertex 0) + rw [nv0] + exact hg0' + · refine ⟨0, M.alpha, ?_, ?_⟩ + · change psi (newEdge 4) = some M.alpha + rw [ne4] + exact ha1color + · change M.alpha ∈ MissingColors G psi (newVertex 0) + rw [nv0] + simpa [y0] using M.alpha_missing + · refine ⟨0, M.alpha, ?_, ?_⟩ + · change psi (newEdge 5) = some M.alpha + rw [ne5] + exact ha3color + · change M.alpha ∈ MissingColors G psi (newVertex 0) + rw [nv0] + simpa [y0] using M.alpha_missing + · refine ⟨tw, g1, ?_, ?_⟩ + · change psi (newEdge 6) = some g1 + rw [ne6] + exact hc0color' + · have hv : S'.vertex (Fin.castLT tw (by omega)) = + S'.vertex ⟨tw.val, by omega⟩ := by + apply congrArg S'.vertex + apply Fin.ext + rfl + rw [hv] + exact htwMissing + · refine ⟨Fin.castLE (by norm_num : 7 ≤ 8) tw, g1, ?_, ?_⟩ + · change psi (newEdge 7) = some g1 + rw [ne7] + exact hc1color + · have hv : S'.vertex + (Fin.castLT (Fin.castLE (by norm_num : 7 ≤ 8) tw) + (lt_trans tw.isLt (by norm_num : 7 < 9))) = + S'.vertex ⟨tw.val, by omega⟩ := by + apply congrArg S'.vertex + apply Fin.ext + rfl + rw [hv] + exact htwMissing + +theorem helper_hbetaClose_5054.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) {e : E} (psi : PartialEdgeColoring E k) (S : TreeSequence + G e) (M : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), + let y0 : V := S.vertex (⟨(0 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + let y4 : V := S.vertex (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ))); + ∀ (v1 v2 : V) (_ : v1 ≠ S.vertex (⟨(0 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ)))) (_ : v1 ≠ S.vertex (⟨(4 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(4 : ℕ) < + S.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (S.length + (1 : ℕ)))) (beta56 : E) (_ : G.ends beta56 = s(v1, v2)) (_ : G.ends + M.closingEdge = s(y4, y0)), beta56 ≠ M.closingEdge := by + classical + intro V E _ _ _ G k e psi S M hlen y0 y4 v1 v2 hv10 hv14 beta56 hbeta56ends hclosingEnds hh + have he : s(v1, v2) = s(y4, y0) := by + rw [← hbeta56ends, hh] + exact hclosingEnds + rcases Sym2.eq_iff.mp he with hp | hp + · exact hv14 hp.1 + · exact hv10 hp.1 + +theorem helper_hf1f2_5119.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {e : E} (S : TreeSequence G e) + (hlen : S.length = (8 : ℕ)), + let a1 : E := S.edge (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let a3 : E := S.edge (⟨(3 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(3 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let c0 : E := S.edge (⟨(6 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(6 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let c1 : E := S.edge (⟨(7 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(7 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + ∀ (f1 f2 beta56 : E), + let a0 : E := S.edge (⟨(0 : ℕ), + have _ : (1 : ℕ) ≤ S.length := S.positive; + have _ : (1 : ℕ) ≤ S.length := S.positive; Decidable.byContradiction fun (a : ¬(0 : ℕ) < + S.length) ↦ + by + omega + ⟩ : Fin S.length); + let edgeList : List E := [a0, f1, beta56, f2, a1, a3, c0, c1]; + ∀ (hedgeListLength : edgeList.length = (8 : ℕ)), + let newEdge : Fin (8 : ℕ) → E := fun (i : Fin (8 : ℕ)) ↦ edgeList.get (Fin.cast (Eq.symm + hedgeListLength) i); + ∀ (_ : newEdge (1 : Fin (8 : ℕ)) = f1) (_ : newEdge (3 : Fin (8 : ℕ)) = f2) (_ : + Function.Injective newEdge), f1 ≠ f2 := by + classical + intro V E G e S hlen a1 a3 c0 c1 f1 f2 beta56 a0 edgeList hedgeListLength newEdge ne1 ne3 + newEdge_injective hh + have he : newEdge 1 = newEdge 3 := by rw [ne1, ne3, hh] + have hi := newEdge_injective he + have hiv := congrArg Fin.val hi + norm_num at hiv + +end GoldbergSeymour.ScheideRebasing + +end diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineStructuralConfiguration.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineStructuralConfiguration.lean new file mode 100644 index 0000000000..2bb5d38e98 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineStructuralConfiguration.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideOrderNineBlockStructure +public import LeanPool.GoldbergSeymour.ScheideOrderNineExitLocalization +public import LeanPool.GoldbergSeymour.ScheideOrderNineParameters + +/-! +# Scheide Order Nine Structural Configuration + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideOrderNineStructuralConfiguration {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) + (hcritical : Critical G) (hindex : ChromaticIndex G = k + 1) + (hdegree : MaximumDegree G + 1 ≤ k) + (hnoisolated : ∀ v : V, ∃ e : E, Incident G v e) + (hnonelementary : ¬ Elementary G) (horder : TashkinovOrder G < 11) : + ∃ (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0), + Nonempty (ScheideStructuralConfiguration G k e0 phi T) := by + classical + obtain ⟨e0, phi0, T0, hglobal0⟩ := + GlobalMaximumTripleExists G k hcritical hindex hdegree + obtain ⟨e0, phi, T, N, hbalanced⟩ := + ScheideBalancedExists G k e0 phi0 T0 hglobal0 + obtain ⟨horder9, hgraphHeight, hlength0, hheight0⟩ := + ScheideOrderNineParameters G k hcritical hindex hdegree hnoisolated + hnonelementary horder e0 phi T N hbalanced + obtain ⟨e0, phi, T, N, hbalanced, hlength, hheight, gamma, hgamma, + hattach, hblockColor, hblockMissing, hbaseAvoids⟩ := + ScheideOrderNineBlockStructure G k e0 phi T N hbalanced + horder9 hgraphHeight + have hexit := ScheideOrderNineExitLocalization G k e0 phi T N hbalanced + hlength hheight gamma hgamma hblockColor hblockMissing hbaseAvoids + refine ⟨e0, phi, T, ?_⟩ + refine ⟨{ + p := 5 + s := 2 + p_ge_two := by omega + gamma := gamma + gamma_injective := hgamma + y := fun i => T.vertex ⟨i.val, by omega⟩ + baseEdge := fun i => T.edge ⟨i.val, by omega⟩ + blockVertex := fun i j => T.vertex ⟨5 + 2 * i.val + j.val, by omega⟩ + blockEdge := fun i j => T.edge ⟨4 + 2 * i.val + j.val, by omega⟩ + length_eq := by omega + base_vertex_position := by + intro i + rfl + block_vertex_position := by + intro i j + rfl + base_edge_position := by + intro i + rfl + block_edge_position := by + intro i j + rfl + block_attaches_to_base := hattach + block_color := hblockColor + block_color_missing_on_base := hblockMissing + initial_nonfirst_avoids_blocks := hbaseAvoids + exit_covered := hexit + no_isolated := hnoisolated + globally_maximum := N.global }⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideOriginalDefectiveConfinement.lean b/LeanPool/GoldbergSeymour/ScheideOriginalDefectiveConfinement.lean new file mode 100644 index 0000000000..51d3cc4c27 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideOriginalDefectiveConfinement.lean @@ -0,0 +1,609 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet +public import LeanPool.GoldbergSeymour.ScheideLastExitPath +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementUnionClosed +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Original Defective Confinement + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hunique_159.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (hdef : alpha ∈ DefectiveColors + G phi (TreeSequenceVertexSet T)), + let d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T)) := (⟨alpha, hdef⟩ : + ↥(DefectiveColors G phi (TreeSequenceVertexSet T))); + let VT : Finset V := TreeSequenceVertexSet T; + let XA : Finset V := VT ∪ {(R d).u1, (R d).u2}; IsProperEdgeColoring G phi → VT ⊆ XA → + ∀ (fBlock : E), phi fBlock = some (↑d : Fin k) → G.ends fBlock = s(C.blockVertex (D.gammaIndex + d) (0 : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → C.blockVertex + (D.gammaIndex d) (0 : Fin (2 : ℕ)) ∈ VT → C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)) + ∈ VT → + ∀ f ∈ BoundaryColorEdges G phi XA alpha, f = D.f0 d := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha hdef d VT XA hproper hVTsubXA fBlock hfBlockColor + hfBlockEnds hblock0VT hblock1VT f hf + have hfBoundary : f ∈ BoundaryEdges G XA := + (Finset.mem_filter.mp hf).1 + have hfColor : phi f = some alpha := + (Finset.mem_filter.mp hf).2 + obtain ⟨a, ha, b, hb, hends⟩ : + ∃ a ∈ XA, ∃ b ∉ XA, G.ends f = s(a, b) := by + simpa [BoundaryEdges] using hfBoundary + have hfa : Incident G a f := by + unfold Incident + rw [hends] + simp + have hfb : Incident G b f := by + unfold Incident + rw [hends] + simp + have hneInternal : ∀ (g : E) (r s : V), G.ends g = s(r, s) → + r ∈ XA → s ∈ XA → f ≠ g := by + intro g r s hg hr hs heq + have hbmem : b ∈ G.ends g := by + rw [← heq] + exact hfb + rw [hg] at hbmem + rcases Sym2.mem_iff.mp hbmem with hbr | hbs + · exact hb (hbr.symm ▸ hr) + · exact hb (hbs.symm ▸ hs) + have haVT : a ∈ VT := by + simp only [XA, Finset.mem_union, Finset.mem_insert, + Finset.mem_singleton] at ha + rcases ha with ha | ha | ha + · exact ha + · subst a + have hne := hneInternal (R d).f1 (R d).v1 (R d).u1 + (R d).f1_ends + (hVTsubXA (Finset.mem_sdiff.mp (R d).v1_in_remainder).1) + (by simp [XA]) + have hadj : AdjacentEdges G f (R d).f1 := by + exact ⟨(R d).u1, hfa, by + unfold Incident + rw [(R d).f1_ends] + simp⟩ + exact False.elim ((hproper hne hadj hfColor) (R d).f1_color) + · subst a + have hne := hneInternal (R d).f2 (R d).v2 (R d).u2 + (R d).f2_ends + (hVTsubXA (Finset.mem_sdiff.mp (R d).v2_in_remainder).1) + (by simp [XA]) + have hadj : AdjacentEdges G f (R d).f2 := by + exact ⟨(R d).u2, hfa, by + unfold Incident + rw [(R d).f2_ends] + simp⟩ + exact False.elim ((hproper hne hadj hfColor) (R d).f2_color) + have haNeBlock0 : a ≠ C.blockVertex (D.gammaIndex d) 0 := by + intro heq + have hne := hneInternal fBlock + (C.blockVertex (D.gammaIndex d) 0) + (C.blockVertex (D.gammaIndex d) 1) hfBlockEnds + (hVTsubXA hblock0VT) (hVTsubXA hblock1VT) + have hadj : AdjacentEdges G f fBlock := by + refine ⟨a, hfa, ?_⟩ + unfold Incident + rw [hfBlockEnds, heq] + simp + exact (hproper hne hadj hfColor) hfBlockColor + have haNeBlock1 : a ≠ C.blockVertex (D.gammaIndex d) 1 := by + intro heq + have hne := hneInternal fBlock + (C.blockVertex (D.gammaIndex d) 0) + (C.blockVertex (D.gammaIndex d) 1) hfBlockEnds + (hVTsubXA hblock0VT) (hVTsubXA hblock1VT) + have hadj : AdjacentEdges G f fBlock := by + refine ⟨a, hfa, ?_⟩ + unfold Incident + rw [hfBlockEnds, heq] + simp + exact (hproper hne hadj hfColor) hfBlockColor + have hbVT : b ∉ VT := by + intro hbVT + exact hb (hVTsubXA hbVT) + have hfRemainder : f ∈ BoundaryColorEdges G phi + (VT \ {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1}) alpha := by + simp only [BoundaryColorEdges, Finset.mem_filter] + constructor + · unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨a, ?_, b, ?_, hends⟩ + · simp [haVT, haNeBlock0, haNeBlock1] + · simp [hbVT] + · exact hfColor + have hfOutside : ∃ w, w ∉ VT ∧ Incident G w f := + ⟨b, hbVT, hfb⟩ + rcases ((R d).exact_three f).mp ⟨by simpa [VT] using hfRemainder, + by simpa [VT] using hfOutside⟩ with heq | heq | heq + · exact heq + · exact False.elim ((hneInternal (R d).f1 (R d).v1 (R d).u1 + (R d).f1_ends + (hVTsubXA (Finset.mem_sdiff.mp (R d).v1_in_remainder).1) + (by simp [XA])) heq) + · exact False.elim ((hneInternal (R d).f2 (R d).v2 (R d).u2 + (R d).f2_ends + (hVTsubXA (Finset.mem_sdiff.mp (R d).v2_in_remainder).1) + (by simp [XA])) heq) + +private theorem helper_hnoDeparture_298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (L : ScheideLastExitPath G k e0 + phi T C D R alpha) (hdef : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T)), + let d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T)) := (⟨alpha, hdef⟩ : + ↥(DefectiveColors G phi (TreeSequenceVertexSet T))); + let VT : Finset V := TreeSequenceVertexSet T; + let XA : Finset V := VT ∪ {(R d).u1, (R d).u2}; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); y0 ∈ XA → + ( + ∀ f ∈ BoundaryColorEdges G phi XA alpha, f = D.f0 d) → ColoredVertexSetClosed G phi XA → + L.crossing = D.f0 d → + ∀ (n : ℕ) (y x : V) (e : E), n + (2 : ℕ) ≤ (↑L.lastIndex : ℕ) → L.path.getVert n = Sum.inl y → + y ∈ XA → L.path.getVert (n + (1 : ℕ)) = Sum.inr e → L.path.getVert (n + (2 : ℕ)) = Sum.inl + x → x ∉ XA → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha L hdef d VT XA y0 hy0XA hunique hXAclosed hcrossEq n + y x e hnl hny hy hne hexc hx + have ha1 := L.path.adj_getVert_succ (i := n) (by + have h := L.followingVertex + omega) + have ha2 := L.path.adj_getVert_succ (i := n + 1) (by + have h := L.followingVertex + omega) + rw [show n + 1 + 1 = n + 2 by omega] at ha2 + rw [hny, hne] at ha1 + rw [hne, hexc] at ha2 + simp only [TwoColorIncidenceGraph, Incident] at ha1 ha2 + have hvne : y ≠ x := by + intro heq + have hinj := L.pathSimple.getVert_injOn + (show n ≤ L.path.length by + have h := L.followingVertex + omega) + (show n + 2 ≤ L.path.length by + have h := L.followingVertex + omega) + (by rw [hny, hexc, heq]) + omega + have hedge : e ∈ BoundaryEdges G XA := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨y, hy, x, hx, ?_⟩ + exact (Sym2.mem_and_mem_iff hvne).mp ⟨ha1.1, ha2.1⟩ + have hnotzero : phi e ≠ some D.alpha0 := by + intro hezero + exact (hXAclosed hedge hy0XA hezero) D.alpha0_missing_at_y0 + have hecolor : phi e = some alpha := by + rcases ha1.2 with hezero | healpha + · exact False.elim (hnotzero hezero) + · exact healpha + have heq : e = D.f0 d := hunique e (by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hedge, hecolor⟩) + have hpathEq : e = L.crossing := heq.trans hcrossEq.symm + have hinj := L.pathSimple.getVert_injOn + (show n + 1 ≤ L.path.length by + have h := L.followingVertex + omega) + (show L.lastIndex.val + 1 ≤ L.path.length by + have h := L.followingVertex + omega) + (by rw [hne, L.crossingAt, hpathEq]) + omega + +private theorem helper_hconf_350.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (L : ScheideLastExitPath G k e0 + phi T C D R alpha) (hdef : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T)), + let d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T)) := (⟨alpha, hdef⟩ : + ↥(DefectiveColors G phi (TreeSequenceVertexSet T))); + let VT : Finset V := TreeSequenceVertexSet T; + let XA : Finset V := VT ∪ {(R d).u1, (R d).u2}; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); y0 ∈ XA → + ( + ∀ (n : ℕ) (y x : V) (e : E), n + (2 : ℕ) ≤ (↑L.lastIndex : ℕ) → L.path.getVert n = Sum.inl y → + y ∈ XA → L.path.getVert (n + (1 : ℕ)) = Sum.inr e → L.path.getVert (n + (2 : ℕ)) = Sum.inl + x → x ∉ XA → False) → + ∀ n ≤ (↑L.lastIndex : ℕ), + ∀ (x : V), L.path.getVert n = Sum.inl x → x ∈ XA := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha L hdef d VT XA y0 hy0XA hnoDeparture n + induction n using Nat.strong_induction_on with + | h n ih => + intro hn x hx + by_cases hn0 : n = 0 + · subst n + rw [L.path.getVert_zero] at hx + injection hx with hxe + subst x + exact hy0XA + by_cases hn1 : n = 1 + · have ha := L.path.adj_getVert_succ (i := 0) (by + have h := L.followingVertex + omega) + subst n + rw [L.path.getVert_zero, hx] at ha + simp [TwoColorIncidenceGraph] at ha + · have hprev := L.path.adj_getVert_succ (i := n - 1) (by + have h := L.followingVertex + omega) + rw [show n - 1 + 1 = n by omega, hx] at hprev + cases hmid : L.path.getVert (n - 1) with + | inl z => + rw [hmid] at hprev + simp [TwoColorIncidenceGraph] at hprev + | inr e => + have hbefore := L.path.adj_getVert_succ (i := n - 2) (by + have h := L.followingVertex + omega) + rw [show n - 2 + 1 = n - 1 by omega, hmid] at hbefore + cases hleft : L.path.getVert (n - 2) with + | inl y => + rw [hleft] at hbefore + simp only [TwoColorIncidenceGraph] at hbefore + have hy := ih (n - 2) (by omega) (by omega) y hleft + by_cases hxXA : x ∈ XA + · exact hxXA + · exfalso + apply hnoDeparture (n - 2) y x e (by omega) + hleft hy + (by simpa [show n - 2 + 1 = n - 1 by omega] using hmid) + (by simpa [show n - 2 + 2 = n by omega] using hx) hxXA + | inr q => + rw [hleft] at hbefore + simp [TwoColorIncidenceGraph] at hbefore + +private theorem helper_branch_400.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (L : ScheideLastExitPath G k e0 + phi T C D R alpha) (hdef : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T)), + let d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T)) := (⟨alpha, hdef⟩ : + ↥(DefectiveColors G phi (TreeSequenceVertexSet T))); + let VT : Finset V := TreeSequenceVertexSet T; + let XA : Finset V := VT ∪ {(R d).u1, (R d).u2}; + let X : Finset V := ScheideEnlargedVertexSet R; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); XA ⊆ X → ( + ∀ n ≤ (↑L.lastIndex : ℕ), + ∀ (x : V), L.path.getVert n = Sum.inl x → x ∈ XA) → + ∀ (f : E), f ∈ BoundaryEdges G X ∧ Sum.inr f ∈ TwoColorComponent G phi D.alpha0 alpha (Sum.inl + y0) → f = L.crossing := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha L hdef d VT XA X y0 hXAsubX hconf f hf + obtain ⟨u, hu, w, hw, hends⟩ : ∃ u ∈ X, ∃ w ∉ X, G.ends f = s(u, w) := by + simpa [X, BoundaryEdges] using hf.1 + have hneuw : u ≠ w := by + intro h + exact G.loopless f u (h ▸ hends) + have hfsupport : Sum.inr f ∈ L.path.support := by + have hcomponent := hf.2 + rw [← L.pathSpans] at hcomponent + exact hcomponent + obtain ⟨n, hnget, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hfsupport + have hnpos : 0 < n := by + by_cases hnzero : n = 0 + · subst n + rw [L.path.getVert_zero] at hnget + cases hnget + · omega + have hnlt : n < L.path.length := by + by_contra hnl + have heq : n = L.path.length := by omega + subst n + rw [L.path.getVert_length] at hnget + cases hnget + have hprev := L.path.adj_getVert_succ (i := n - 1) (by omega) + have hnext := L.path.adj_getVert_succ (i := n) hnlt + rw [show n - 1 + 1 = n by omega, hnget] at hprev + have hprevExists : ∃ vprev : V, L.path.getVert (n - 1) = Sum.inl vprev := by + cases hprevVert : L.path.getVert (n - 1) with + | inl vprev => exact ⟨vprev, rfl⟩ + | inr q => + rw [hprevVert] at hprev + simp [TwoColorIncidenceGraph] at hprev + obtain ⟨vprev, hprevVert⟩ := hprevExists + rw [hprevVert] at hprev + simp only [TwoColorIncidenceGraph, Incident] at hprev + rw [hnget] at hnext + have hnextExists : ∃ vnext : V, L.path.getVert (n + 1) = Sum.inl vnext := by + cases hnextVert : L.path.getVert (n + 1) with + | inl vnext => exact ⟨vnext, rfl⟩ + | inr q => + rw [hnextVert] at hnext + simp [TwoColorIncidenceGraph] at hnext + obtain ⟨vnext, hnextVert⟩ := hnextExists + rw [hnextVert] at hnext + simp only [TwoColorIncidenceGraph, Incident] at hnext + have hprevEnds : vprev = u ∨ vprev = w := by + rw [hends] at hprev + simpa [Sym2.mem_iff] using hprev.1 + have hnextEnds : vnext = u ∨ vnext = w := by + rw [hends] at hnext + simpa [Sym2.mem_iff] using hnext.1 + have hvne : vprev ≠ vnext := by + intro heq + have hidx := L.pathSimple.getVert_injOn + (show n - 1 ≤ L.path.length by omega) + (show n + 1 ≤ L.path.length by omega) + (by rw [hprevVert, hnextVert, heq]) + omega + have hprevXor : (vprev ∈ X ∧ vnext ∉ X) ∨ + (vprev ∉ X ∧ vnext ∈ X) := by + rcases hprevEnds with hpu | hpw <;> rcases hnextEnds with hnu | hnw + · exfalso + apply hvne + exact hpu.trans hnu.symm + · left + constructor + · simpa [hpu] using hu + · simpa [hnw] using hw + · right + constructor + · simpa [hpw] using hw + · simpa [hnu] using hu + · exfalso + apply hvne + exact hpw.trans hnw.symm + have hprevIn : n - 1 ≤ L.lastIndex.val := by + rcases hprevXor with hcase | hcase + · by_contra hnot + have hout := L.afterLastOutside ⟨n - 1, by + have h := hnlt + omega⟩ (by + change L.lastIndex.val < n - 1 + omega) + vprev hprevVert + exact hout hcase.1 + · have hnextIn : n + 1 ≤ L.lastIndex.val := by + by_contra hbad + have hout := L.afterLastOutside ⟨n + 1, by + have h := hnlt + omega⟩ (by + change L.lastIndex.val < n + 1 + omega) + vnext hnextVert + exact hout hcase.2 + exact False.elim (hcase.1 (hXAsubX (hconf (n - 1) (by omega) + vprev hprevVert))) + have hnextOut : ¬ n + 1 ≤ L.lastIndex.val := by + by_contra hnext + have hvnextX := hXAsubX (hconf (n + 1) hnext vnext hnextVert) + rcases hprevXor with hcase | hcase + · exact hcase.2 hvnextX + · exact hcase.1 (hXAsubX (hconf (n - 1) hprevIn vprev hprevVert)) + have hidx : n = L.lastIndex.val + 1 := by + have hsub : n - 1 + 1 ≤ L.lastIndex.val + 1 := + Nat.succ_le_succ hprevIn + have hle : n ≤ L.lastIndex.val + 1 := by + simpa [Nat.sub_add_cancel (by omega : 1 ≤ n)] using hsub + have hneq : n ≠ L.lastIndex.val := by + intro heq + have hbad := hnget + rw [heq, L.lastInsideAt] at hbad + cases hbad + have hgt : L.lastIndex.val < n := by + by_contra hnot + have hnle : n ≤ L.lastIndex.val := by omega + have hsucc : n + 1 ≤ L.lastIndex.val := by omega + exact hnextOut hsucc + have hge : L.lastIndex.val + 1 ≤ n := by omega + omega + have heq : (Sum.inr f : Sum V E) = Sum.inr L.crossing := by + rw [← hnget, hidx, L.crossingAt] + injection heq + +theorem ScheideOriginalDefectiveConfinement {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) + (alpha : Fin k) + (L : ScheideLastExitPath G k e0 phi T C D R alpha) + (hlast : L.lastInside ∈ TreeSequenceVertexSet T) + (hdef : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T)) : + let d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)} := ⟨alpha, hdef⟩ + D.f0 d ∈ BoundaryColorEdges G phi + (TreeSequenceVertexSet T ∪ {(R d).u1, (R d).u2}) alpha ∧ + (∀ f : E, f ∈ BoundaryColorEdges G phi + (TreeSequenceVertexSet T ∪ {(R d).u1, (R d).u2}) alpha → + f = D.f0 d) ∧ + (∀ (j : Fin (L.path.length + 1)), j.val ≤ L.lastIndex.val → + ∀ x : V, L.path.getVert j.val = Sum.inl x → + x ∈ TreeSequenceVertexSet T ∪ {(R d).u1, (R d).u2}) ∧ + ∀ f : E, f ∈ BoundaryEdges G (ScheideEnlargedVertexSet R) ∧ + Sum.inr f ∈ TwoColorComponent G phi D.alpha0 alpha + (Sum.inl (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩)) → + f = L.crossing := by + classical + let d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)} := ⟨alpha, hdef⟩ + let VT := TreeSequenceVertexSet T + let XA := VT ∪ {(R d).u1, (R d).u2} + let X := ScheideEnlargedVertexSet R + let y0 : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + change D.f0 d ∈ BoundaryColorEdges G phi XA alpha ∧ + (∀ f : E, f ∈ BoundaryColorEdges G phi XA alpha → f = D.f0 d) ∧ + (∀ (j : Fin (L.path.length + 1)), j.val ≤ L.lastIndex.val → + ∀ x : V, L.path.getVert j.val = Sum.inl x → x ∈ XA) ∧ + ∀ f : E, f ∈ BoundaryEdges G X ∧ + Sum.inr f ∈ TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0) → + f = L.crossing + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have hVTsubXA : VT ⊆ XA := by + intro v hv + simp [XA, hv] + have hXAsubX : XA ⊆ X := by + intro v hv + simp only [XA, Finset.mem_union, Finset.mem_insert, + Finset.mem_singleton] at hv + rcases hv with hv | hv | hv + · simp [X, ScheideEnlargedVertexSet, VT, hv] + · subst v + simp only [X, ScheideEnlargedVertexSet, Finset.mem_union] + right + apply Finset.mem_biUnion.mpr + exact ⟨d, Finset.mem_univ d, by simp⟩ + · subst v + simp only [X, ScheideEnlargedVertexSet, Finset.mem_union] + right + apply Finset.mem_biUnion.mpr + exact ⟨d, Finset.mem_univ d, by simp⟩ + have hy0VT : y0 ∈ VT := by + have hpos : (0 : ℕ) < T.length + 1 := by omega + have hv := C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [y0, VT, TreeSequenceVertexSet] using + (show ∃ i : Fin (T.length + 1), T.vertex i = y0 from + ⟨⟨0, hpos⟩, by simpa [y0] using hv⟩) + have hy0XA : y0 ∈ XA := hVTsubXA hy0VT + have hv0VT : D.v0 d ∈ VT := by + have hmem := D.v0_is_exit d + change D.v0 d ∈ + Finset.univ.filter (fun v => ScheideExitVertex T phi v) at hmem + have hexit : ScheideExitVertex T phi (D.v0 d) := + (Finset.mem_filter.mp hmem).2 + unfold ScheideExitVertex at hexit + rcases hexit with + ⟨u, gamma, delta, hu, hgamma, hdelta, z, p, hp, i, hi, hv, hafter⟩ + simpa only [VT] using hv + have hu0ne1 : D.u0 d ≠ (R d).u1 := by + intro heq + have hadj : AdjacentEdges G (D.f0 d) (R d).f1 := by + refine ⟨(R d).u1, ?_, ?_⟩ <;> unfold Incident + · rw [D.f0_ends d, heq] + simp + · rw [(R d).f1_ends] + simp + exact (hproper (R d).f0_ne_f1 hadj (D.f0_color d)) (R d).f1_color + have hu0ne2 : D.u0 d ≠ (R d).u2 := by + intro heq + have hadj : AdjacentEdges G (D.f0 d) (R d).f2 := by + refine ⟨(R d).u2, ?_, ?_⟩ <;> unfold Incident + · rw [D.f0_ends d, heq] + simp + · rw [(R d).f2_ends] + simp + exact (hproper (R d).f0_ne_f2 hadj (D.f0_color d)) (R d).f2_color + have hu0NotXA : D.u0 d ∉ XA := by + simp only [XA, Finset.mem_union, Finset.mem_insert, + Finset.mem_singleton, not_or] + exact ⟨D.u0_outside d, hu0ne1, hu0ne2⟩ + have hf0Boundary : D.f0 d ∈ BoundaryEdges G XA := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨D.v0 d, hVTsubXA hv0VT, D.u0 d, hu0NotXA, D.f0_ends d⟩ + have hf0BC : D.f0 d ∈ BoundaryColorEdges G phi XA alpha := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hf0Boundary, D.f0_color d⟩ + obtain ⟨fBlock, hfBlockColor, hfBlockEnds⟩ := + (ScheideSymmetricDefectiveInternal G k e0 phi T C D d (R d)).1 + have hblock0VT : C.blockVertex (D.gammaIndex d) 0 ∈ VT := by + change C.blockVertex (D.gammaIndex d) 0 ∈ TreeSequenceVertexSet T + rw [← C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)] + simp [TreeSequenceVertexSet] + have hblock1VT : C.blockVertex (D.gammaIndex d) 1 ∈ VT := by + change C.blockVertex (D.gammaIndex d) 1 ∈ TreeSequenceVertexSet T + rw [← C.block_vertex_position (D.gammaIndex d) (1 : Fin 2)] + simp [TreeSequenceVertexSet] + have hunique := @helper_hunique_159 V E inferInstance inferInstance inferInstance inferInstance G + k e0 phi T C D R alpha hdef hproper hVTsubXA fBlock hfBlockColor hfBlockEnds hblock0VT + hblock1VT + have hXAclosed : ColoredVertexSetClosed G phi XA := by + change ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T ∪ {(R d).u1, (R d).u2}) + exact ScheideReplacementUnionClosed G k e0 phi T C D d (R d) + have hcrossXA : L.crossing ∈ BoundaryEdges G XA := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨L.lastInside, hVTsubXA hlast, L.firstOutside, ?_, ?_⟩ + · intro h + exact L.firstOutsideNotMem (hXAsubX h) + · have hadj0 := L.path.adj_getVert_succ + (i := L.lastIndex.val) (by + have hfollow := L.followingVertex + omega) + have hadj := L.path.adj_getVert_succ + (i := L.lastIndex.val + 1) (by + have hfollow := L.followingVertex + omega) + rw [L.lastInsideAt, L.crossingAt] at hadj0 + rw [L.crossingAt, L.firstOutsideAt] at hadj + simp only [TwoColorIncidenceGraph, Incident] at hadj0 hadj + have hne : L.lastInside ≠ L.firstOutside := by + intro heq + have hidx := L.pathSimple.getVert_injOn + (show L.lastIndex.val ≤ L.path.length by omega) + (show L.lastIndex.val + 2 ≤ L.path.length by exact L.followingVertex) + (by rw [L.lastInsideAt, L.firstOutsideAt, heq]) + omega + exact (Sym2.mem_and_mem_iff hne).mp ⟨hadj0.1, hadj.1⟩ + have hcrossEq : L.crossing = D.f0 d := by + apply hunique + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hcrossXA, L.crossingColor⟩ + have hnoDeparture := @helper_hnoDeparture_298 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D R alpha L hdef hy0XA hunique hXAclosed hcrossEq + have hconf := @helper_hconf_350 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D R alpha L hdef hy0XA hnoDeparture + refine ⟨hf0BC, hunique, ?_, ?_⟩ + · intro j hj x hx + exact hconf j.val hj x hx + · exact @helper_branch_400 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D R alpha L hdef hXAsubX hconf +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideOriginalNondefectiveConfinement.lean b/LeanPool/GoldbergSeymour/ScheideOriginalNondefectiveConfinement.lean new file mode 100644 index 0000000000..0258c80850 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideOriginalNondefectiveConfinement.lean @@ -0,0 +1,400 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideLastExitPath +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Original Nondefective Confinement + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ScheideOriginalNondefectiveConfinement_hnoDeparture_103.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (L : ScheideLastExitPath G k e0 + phi T C D R alpha), alpha ∉ DefectiveColors G phi (TreeSequenceVertexSet T) → + let VT := TreeSequenceVertexSet T; + let y0 := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩; y0 ∈ VT → ColoredVertexSetClosed + G phi VT → L.crossing ∈ BoundaryColorEdges G phi VT alpha → + ∀ (n : ℕ) (y x : V) (e : E), n + 2 ≤ (↑L.lastIndex : ℕ) → L.path.getVert n = Sum.inl y → y ∈ + VT → L.path.getVert (n + 1) = Sum.inr e → L.path.getVert (n + 2) = Sum.inl x → x ∉ VT → + False := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha L hnondef VT y0 hy0VT hVTclosed hcrossBC n y x e hnl + hny hy hne hexc hx + have ha1 := L.path.adj_getVert_succ (i := n) (by + have h := L.followingVertex + omega) + have ha2 := L.path.adj_getVert_succ (i := n + 1) (by + have h := L.followingVertex + omega) + rw [show n + 1 + 1 = n + 2 by omega] at ha2 + rw [hny, hne] at ha1 + rw [hne, hexc] at ha2 + simp only [TwoColorIncidenceGraph, Incident] at ha1 ha2 + have hvne : y ≠ x := by + intro heq + have hinj := L.pathSimple.getVert_injOn + (show n ≤ L.path.length by + have h := L.followingVertex + omega) + (show n + 2 ≤ L.path.length by + have h := L.followingVertex + omega) + (by rw [hny, hexc, heq]) + omega + have hedge : e ∈ BoundaryEdges G VT := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨y, hy, x, hx, ?_⟩ + exact (Sym2.mem_and_mem_iff hvne).mp ⟨ha1.1, ha2.1⟩ + have hnotzero : phi e ≠ some D.alpha0 := by + intro hezero + exact (hVTclosed hedge hy0VT hezero) D.alpha0_missing_at_y0 + have hecolor : phi e = some alpha := by + rcases ha1.2 with hezero | healpha + · exact False.elim (hnotzero hezero) + · exact healpha + have hcrossne : e ≠ L.crossing := by + intro heq + have hinj := L.pathSimple.getVert_injOn + (show n + 1 ≤ L.path.length by + have h := L.followingVertex + omega) + (show L.lastIndex.val + 1 ≤ L.path.length by + have h := L.followingVertex + omega) + (by rw [hne, L.crossingAt, heq]) + omega + have hmem : alpha ∈ DefectiveColors G phi VT := by + simp only [DefectiveColors, Finset.mem_filter, Finset.mem_univ, true_and] + change 2 ≤ (BoundaryColorEdges G phi VT alpha).card + have hsub : ({L.crossing, e} : Finset E) ⊆ BoundaryColorEdges G phi VT alpha := by + intro q hq + simp only [Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl + · exact hcrossBC + · simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hedge, hecolor⟩ + have hcard := Finset.card_le_card hsub + have hpairs : ({L.crossing, e} : Finset E).card = 2 := by + exact Finset.card_pair hcrossne.symm + rw [hpairs] at hcard + exact hcard + exact hnondef (by simpa [VT] using hmem) + +private theorem ScheideOriginalNondefectiveConfinement_hconf_169.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (L : ScheideLastExitPath G k e0 + phi T C D R alpha), + let VT := TreeSequenceVertexSet T; + let y0 := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩; y0 ∈ VT → ( + ∀ (n : ℕ) (y x : V) (e : E), n + 2 ≤ (↑L.lastIndex : ℕ) → L.path.getVert n = Sum.inl y → y ∈ + VT → L.path.getVert (n + 1) = Sum.inr e → L.path.getVert (n + 2) = Sum.inl x → x ∉ VT → + False) → + ∀ n ≤ (↑L.lastIndex : ℕ), + ∀ (x : V), L.path.getVert n = Sum.inl x → x ∈ VT := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha L VT y0 hy0VT hnoDeparture n + induction n using Nat.strong_induction_on with + | h n ih => + intro hn x hx + by_cases hn0 : n = 0 + · subst n + rw [L.path.getVert_zero] at hx + injection hx with hxe + subst x + exact hy0VT + by_cases hn1 : n = 1 + · have ha := L.path.adj_getVert_succ (i := 0) (by + have h := L.followingVertex + omega) + subst n + rw [L.path.getVert_zero, hx] at ha + simp [TwoColorIncidenceGraph] at ha + · have hprev := L.path.adj_getVert_succ (i := n - 1) (by + have h := L.followingVertex + omega) + rw [show n - 1 + 1 = n by omega, hx] at hprev + cases hmid : L.path.getVert (n - 1) with + | inl z => + rw [hmid] at hprev + simp [TwoColorIncidenceGraph] at hprev + | inr e => + have hbefore := L.path.adj_getVert_succ (i := n - 2) (by + have h := L.followingVertex + omega) + rw [show n - 2 + 1 = n - 1 by omega, hmid] at hbefore + cases hleft : L.path.getVert (n - 2) with + | inl y => + rw [hleft] at hbefore + simp only [TwoColorIncidenceGraph] at hbefore + have hy := ih (n - 2) (by omega) (by omega) y hleft + by_cases hxVT : x ∈ VT + · exact hxVT + · exfalso + apply hnoDeparture (n - 2) y x e (by omega) + hleft hy (by simpa [show n - 2 + 1 = n - 1 by omega] using hmid) + (by simpa [show n - 2 + 2 = n by omega] using hx) hxVT + | inr q => + rw [hleft] at hbefore + simp [TwoColorIncidenceGraph] at hbefore + +private theorem ScheideOriginalNondefectiveConfinement_branch_218.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (L : ScheideLastExitPath G k e0 + phi T C D R alpha), + let VT := TreeSequenceVertexSet T; + let X := ScheideEnlargedVertexSet R; VT ⊆ X → ( + ∀ n ≤ (↑L.lastIndex : ℕ), + ∀ (x : V), L.path.getVert n = Sum.inl x → x ∈ VT) → + ∀ (f : E), f ∈ BoundaryEdges G (ScheideEnlargedVertexSet R) ∧ Sum.inr f ∈ TwoColorComponent G + phi D.alpha0 alpha (Sum.inl (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩)) → f = + L.crossing := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha L VT X hVTsubX hconf f hf + obtain ⟨u, hu, w, hw, hends⟩ : ∃ u ∈ X, ∃ w ∉ X, G.ends f = s(u, w) := by + simpa [X, BoundaryEdges] using hf.1 + have hneuw : u ≠ w := by + intro h + exact G.loopless f u (h ▸ hends) + have hfsupport : Sum.inr f ∈ L.path.support := by + have hcomponent := hf.2 + rw [← L.pathSpans] at hcomponent + exact hcomponent + obtain ⟨n, hnget, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hfsupport + have hnpos : 0 < n := by + by_cases hnzero : n = 0 + · subst n + rw [L.path.getVert_zero] at hnget + cases hnget + · omega + have hnlt : n < L.path.length := by + by_contra hnl + have heq : n = L.path.length := by omega + subst n + rw [L.path.getVert_length] at hnget + cases hnget + have hprev := L.path.adj_getVert_succ (i := n - 1) (by omega) + have hnext := L.path.adj_getVert_succ (i := n) hnlt + rw [show n - 1 + 1 = n by omega, hnget] at hprev + have hprevExists : ∃ vprev : V, L.path.getVert (n - 1) = Sum.inl vprev := by + cases hprevVert : L.path.getVert (n - 1) with + | inl vprev => exact ⟨vprev, rfl⟩ + | inr q => + rw [hprevVert] at hprev + simp [TwoColorIncidenceGraph] at hprev + obtain ⟨vprev, hprevVert⟩ := hprevExists + rw [hprevVert] at hprev + simp only [TwoColorIncidenceGraph, Incident] at hprev + rw [hnget] at hnext + have hnextExists : ∃ vnext : V, L.path.getVert (n + 1) = Sum.inl vnext := by + cases hnextVert : L.path.getVert (n + 1) with + | inl vnext => exact ⟨vnext, rfl⟩ + | inr q => + rw [hnextVert] at hnext + simp [TwoColorIncidenceGraph] at hnext + obtain ⟨vnext, hnextVert⟩ := hnextExists + rw [hnextVert] at hnext + simp only [TwoColorIncidenceGraph, Incident] at hnext + have hprevEnds : vprev = u ∨ vprev = w := by + rw [hends] at hprev + simpa [Sym2.mem_iff] using hprev.1 + have hnextEnds : vnext = u ∨ vnext = w := by + rw [hends] at hnext + simpa [Sym2.mem_iff] using hnext.1 + have hvne : vprev ≠ vnext := by + intro heq + have hidx := L.pathSimple.getVert_injOn + (show n - 1 ≤ L.path.length by omega) + (show n + 1 ≤ L.path.length by omega) + (by rw [hprevVert, hnextVert, heq]) + omega + have hprevXor : (vprev ∈ X ∧ vnext ∉ X) ∨ + (vprev ∉ X ∧ vnext ∈ X) := by + rcases hprevEnds with hpu | hpw <;> rcases hnextEnds with hnu | hnw + · exfalso + apply hvne + exact hpu.trans hnu.symm + · left + constructor + · simpa [hpu] using hu + · simpa [hnw] using hw + · right + constructor + · simpa [hpw] using hw + · simpa [hnu] using hu + · exfalso + apply hvne + exact hpw.trans hnw.symm + have hprevIn : n - 1 ≤ L.lastIndex.val := by + rcases hprevXor with hcase | hcase + · by_contra hnot + have hout := L.afterLastOutside ⟨n - 1, by + have h := hnlt + omega⟩ (by + change L.lastIndex.val < n - 1 + omega) + vprev hprevVert + exact hout hcase.1 + · have hnextIn : n + 1 ≤ L.lastIndex.val := by + by_contra hbad + have hout := L.afterLastOutside ⟨n + 1, by + have h := hnlt + omega⟩ (by + change L.lastIndex.val < n + 1 + omega) + vnext hnextVert + exact hout hcase.2 + exact False.elim (hcase.1 (hVTsubX (hconf (n - 1) (by omega) + vprev hprevVert))) + have hnextOut : ¬ n + 1 ≤ L.lastIndex.val := by + by_contra hnext + have hvnextX := hVTsubX (hconf (n + 1) hnext vnext hnextVert) + rcases hprevXor with hcase | hcase + · exact hcase.2 hvnextX + · exact hcase.1 (hVTsubX (hconf (n - 1) hprevIn vprev hprevVert)) + have hidx : n = L.lastIndex.val + 1 := by + have hsub : n - 1 + 1 ≤ L.lastIndex.val + 1 := + Nat.succ_le_succ hprevIn + have hle : n ≤ L.lastIndex.val + 1 := by + simpa [Nat.sub_add_cancel (by omega : 1 ≤ n)] using hsub + have hneq : n ≠ L.lastIndex.val := by + intro heq + have hbad := hnget + rw [heq, L.lastInsideAt] at hbad + cases hbad + have hgt : L.lastIndex.val < n := by + by_contra hnot + have hnle : n ≤ L.lastIndex.val := by omega + have hsucc : n + 1 ≤ L.lastIndex.val := by omega + exact hnextOut hsucc + have hge : L.lastIndex.val + 1 ≤ n := by omega + omega + have heq : (Sum.inr f : Sum V E) = Sum.inr L.crossing := by + rw [← hnget, hidx, L.crossingAt] + injection heq + +theorem ScheideOriginalNondefectiveConfinement {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) + (alpha : Fin k) + (L : ScheideLastExitPath G k e0 phi T C D R alpha) + (hlast : L.lastInside ∈ TreeSequenceVertexSet T) + (hnondef : alpha ∉ DefectiveColors G phi (TreeSequenceVertexSet T)) : + (∀ (j : Fin (L.path.length + 1)), + j.val ≤ L.lastIndex.val → + ∀ x : V, L.path.getVert j.val = Sum.inl x → x ∈ TreeSequenceVertexSet T) ∧ + ∀ f : E, + f ∈ BoundaryEdges G (ScheideEnlargedVertexSet R) ∧ + Sum.inr f ∈ + TwoColorComponent G phi D.alpha0 alpha + (Sum.inl (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩)) → + f = L.crossing := by + classical + let VT := TreeSequenceVertexSet T + let X := ScheideEnlargedVertexSet R + let y0 : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hy0VT : y0 ∈ VT := by + have hpos : (0 : ℕ) < T.length + 1 := by omega + have hv := C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [y0, VT, TreeSequenceVertexSet] using + (show ∃ i : Fin (T.length + 1), T.vertex i = y0 from + ⟨⟨0, hpos⟩, by simpa [y0] using hv⟩) + have hVTclosed : ColoredVertexSetClosed G phi VT := by + unfold ColoredVertexSetClosed + intro f c v hf hv hc + exact (ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).2.2.2.2 + hf hv hc + have hVTsubX : VT ⊆ X := by + intro v hv + simp [X, ScheideEnlargedVertexSet, VT, hv] + have hy0X : y0 ∈ X := hVTsubX hy0VT + have hcrossVT : L.crossing ∈ BoundaryEdges G VT := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨L.lastInside, hlast, L.firstOutside, ?_, ?_⟩ + · intro h + exact L.firstOutsideNotMem (hVTsubX h) + · have hadj0 := L.path.adj_getVert_succ + (i := L.lastIndex.val) (by + have hfollow := L.followingVertex + omega) + have hadj := L.path.adj_getVert_succ + (i := L.lastIndex.val + 1) (by + have hfollow := L.followingVertex + omega) + rw [L.lastInsideAt, L.crossingAt] at hadj0 + rw [L.crossingAt, L.firstOutsideAt] at hadj + simp only [TwoColorIncidenceGraph, Incident] at hadj0 hadj + have hne : L.lastInside ≠ L.firstOutside := by + intro heq + have hidx := L.pathSimple.getVert_injOn + (show L.lastIndex.val ≤ L.path.length by omega) + (show L.lastIndex.val + 2 ≤ L.path.length by exact L.followingVertex) + (by rw [L.lastInsideAt, L.firstOutsideAt, heq]) + omega + exact (Sym2.mem_and_mem_iff hne).mp ⟨hadj0.1, hadj.1⟩ + have hcrossBC : L.crossing ∈ BoundaryColorEdges G phi VT alpha := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hcrossVT, L.crossingColor⟩ + have hnoDeparture : + ∀ (n : ℕ) (y x : V) (e : E), n + 2 ≤ L.lastIndex.val → L.path.getVert n = Sum.inl y → y ∈ VT → + L.path.getVert (n + 1) = Sum.inr e → L.path.getVert (n + 2) = Sum.inl x → x ∉ VT → False + := by + exact @ScheideOriginalNondefectiveConfinement_hnoDeparture_103 V E inferInstance + inferInstance inferInstance inferInstance G k e0 phi T C D R alpha L hnondef hy0VT + hVTclosed hcrossBC + have hconf : ∀ n : ℕ, n ≤ L.lastIndex.val → + ∀ x : V, L.path.getVert n = Sum.inl x → x ∈ VT := by + exact @ScheideOriginalNondefectiveConfinement_hconf_169 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D R alpha L hy0VT hnoDeparture + constructor + · intro j hj x hx + exact hconf j.val hj x hx + · exact @ScheideOriginalNondefectiveConfinement_branch_218 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D R alpha L hVTsubX hconf +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReducedConfiguration.lean b/LeanPool/GoldbergSeymour/ScheideReducedConfiguration.lean new file mode 100644 index 0000000000..94efa30c5c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReducedConfiguration.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration + +/-! +# Scheide Reduced Configuration + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The exact exit-vertex count and block-color coverage required for a reduced structural +configuration. +-/ +structure ScheideReducedConfiguration {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) extends ScheideStructuralConfiguration G k e0 phi T where + exit_card_eq : (ScheideExitVertices T phi).card = s + exit_exactly_one : ∀ v ∈ ScheideExitVertices T phi, ∃! i : Fin s, gamma i ∈ MissingColors G phi v + every_block_color_at_exit : + ∀ i : Fin s, ∃ v ∈ ScheideExitVertices T phi, gamma i ∈ MissingColors G phi v + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementAbsorbing.lean b/LeanPool/GoldbergSeymour/ScheideReplacementAbsorbing.lean new file mode 100644 index 0000000000..f59fd54f47 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementAbsorbing.lean @@ -0,0 +1,837 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AbsorbingVertex +public import LeanPool.GoldbergSeymour.AbsorbingVertices +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.ElementarySingleBoundaryInterchangeable +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal +public import LeanPool.GoldbergSeymour.ScheideSymmetricMissingInternal +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Replacement Absorbing + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation255Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let U : Finset V := (insert ug0 ({ ug1 } : Finset V) : Finset V); + let Z : Finset V := X \ U; + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; IsProperEdgeColoring G phi → + ColoredVertexSetElementary G phi X → ColoredVertexSetClosed G phi X → IsProperEdgeColoring + G phiD → ColoredVertexSetElementary G phiD XD → ColoredVertexSetClosed G phiD XD → ug0 ∈ X + → ug1 ∈ X → X = Z ∪ U → XD = Z ∪ (insert R.u1 ({ R.u2 } : Finset V) : Finset V) → Z ⊆ X → + Z ⊆ XD → + ∀ (fGamma : E), R.u1 ≠ R.u2 → ug0 ≠ ug1 → + ∀ ⦃u : V⦄, u ∈ (insert R.u1 ({ R.u2 } : Finset V) : Finset V) → u ∉ X → + ∀ alpha ∈ MissingColors G phi u, + ∀ (beta : Fin k), beta ≠ alpha → u ∈ (insert R.u1 ({ R.u2 } : Finset V) : Finset V) → u ∈ XD → + ( + ∃ (f : E), Incident G u f ∧ phi f = some (↑d : Fin k)) → Incident G u fGamma → alpha ≠ (↑d : + Fin k) → alpha ≠ gamma → + ∀ v ∈ TreeSequenceVertexSet T, beta ∈ MissingColors G phi v → ( + ∀ (c : Fin k), c ≠ gamma → c ≠ (↑d : Fin k) → + ∀ (f : E), phiD f = some c ↔ phi f = some c) → alpha ∈ MissingColors G phiD u → beta ∈ + MissingColors G phiD v → TwoColorIncidenceGraph G phiD beta alpha = TwoColorIncidenceGraph + G phi beta alpha → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (w : V), a ≠ b → IsProperEdgeColoring G psi → + a ∈ MissingColors G psi w → TwoColorPathComponent G psi a b (Sum.inl w)) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (w : V), a ≠ b → IsProperEdgeColoring G psi → + a ∈ MissingColors G psi w → TwoColorPathComponent G psi b a (Sum.inl w)) → ( + ∀ (psi : PartialEdgeColoring E k) (Y : Finset V) (c : Fin k), + ∀ w ∈ Y, ColoredVertexSetClosed G psi Y → c ∈ MissingColors G psi w → BoundaryColorEdges G psi + Y c = ∅) → + ∃ u_1 ∈ TreeSequenceVertexSet T, beta ∈ MissingColors G phi u_1 ∧ Sum.inl u_1 ∈ + TwoColorComponent G phi beta alpha (Sum.inl u) ∧ + ∀ w ∈ TreeSequenceVertexSet T, beta ∈ MissingColors G phi w → w = u_1 + +private abbrev helperContinuation212Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let U : Finset V := (insert ug0 ({ ug1 } : Finset V) : Finset V); + let Z : Finset V := X \ U; + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; IsProperEdgeColoring G phi → + ColoredVertexSetElementary G phi X → ColoredVertexSetClosed G phi X → IsProperEdgeColoring + G phiD → ColoredVertexSetElementary G phiD XD → ColoredVertexSetClosed G phiD XD → ug0 ∈ X + → ug1 ∈ X → X = Z ∪ U → XD = Z ∪ (insert R.u1 ({ R.u2 } : Finset V) : Finset V) → Z ⊆ X → + Z ⊆ XD → gamma ≠ (↑d : Fin k) → + ∀ (fGamma : E), R.u1 ≠ R.u2 → ug0 ≠ ug1 → + ∀ ⦃u : V⦄, u ∈ (insert R.u1 ({ R.u2 } : Finset V) : Finset V) → u ∉ X → + ∀ alpha ∈ MissingColors G phi u, + ∀ (beta : Fin k), beta ≠ alpha → u ∈ (insert R.u1 ({ R.u2 } : Finset V) : Finset V) → u ∈ XD → + ( + ∃ (f : E), Incident G u f ∧ phi f = some (↑d : Fin k)) → Incident G u fGamma → alpha ≠ (↑d : + Fin k) → alpha ≠ gamma → beta ∈ TreeMissingColors phi T ∧ beta ∉ TreeUsedColors phi T → + ∀ v ∈ TreeSequenceVertexSet T, beta ∈ MissingColors G phi v → gamma ∈ TreeUsedColors phi T → + ∃ u_1 ∈ TreeSequenceVertexSet T, beta ∈ MissingColors G phi u_1 ∧ Sum.inl u_1 ∈ + TwoColorComponent G phi beta alpha (Sum.inl u) ∧ + ∀ w ∈ TreeSequenceVertexSet T, beta ∈ MissingColors G phi w → w = u_1 + +private theorem helper_branch_135.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let U : Finset V := (insert ug0 ({ ug1 } : Finset V) : Finset V); + let Z : Finset V := X \ U; + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; ColoredVertexSetElementary G phi + X → IsProperEdgeColoring G phiD → ColoredVertexSetElementary G phiD XD → + ColoredVertexSetClosed G phiD XD → Z ⊆ XD → + ∀ ⦃u : V⦄ (alpha beta : Fin k), beta ≠ alpha → u ∈ XD → + ∀ v ∈ TreeSequenceVertexSet T, beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phiD u → + beta ∈ MissingColors G phiD v → TwoColorIncidenceGraph G phiD beta alpha = + TwoColorIncidenceGraph G phi beta alpha → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (w : V), a ≠ b → IsProperEdgeColoring G psi → + a ∈ MissingColors G psi w → TwoColorPathComponent G psi a b (Sum.inl w)) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (w : V), a ≠ b → IsProperEdgeColoring G psi → + a ∈ MissingColors G psi w → TwoColorPathComponent G psi b a (Sum.inl w)) → ( + ∀ (psi : PartialEdgeColoring E k) (Y : Finset V) (c : Fin k), + ∀ w ∈ Y, ColoredVertexSetClosed G psi Y → c ∈ MissingColors G psi w → BoundaryColorEdges G psi + Y c = ∅) → v ∈ Z → + ∃ u_1 ∈ TreeSequenceVertexSet T, beta ∈ MissingColors G phi u_1 ∧ Sum.inl u_1 ∈ + TwoColorComponent G phi beta alpha (Sum.inl u) ∧ + ∀ w ∈ TreeSequenceVertexSet T, beta ∈ MissingColors G phi w → w = u_1 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD X ug0 ug1 U Z XD hXelem hproperD hXDelem + hXDclosed hZsubXD u alpha beta hBetaAlpha huXD v hvX hBetaMissing hAlphaMissingD + hBetaMissingD hgraph missingRootPath missingSecondRootPath closedBoundaryEmpty hvZ + have hvXD : v ∈ XD := hZsubXD hvZ + have hBetaBoundary : BoundaryColorEdges G phiD XD beta = ∅ := + closedBoundaryEmpty phiD XD beta v hvXD hXDclosed hBetaMissingD + have hAlphaBoundary : BoundaryColorEdges G phiD XD alpha = ∅ := + closedBoundaryEmpty phiD XD alpha u huXD hXDclosed hAlphaMissingD + have hinter : TreeInterchangeable G R.replacementTree phiD beta alpha := by + apply ElementarySingleBoundaryInterchangeable G phiD R.replacementTree + beta alpha hproperD hXDelem hBetaBoundary + rw [show BoundaryColorEdges G phiD + (TreeSequenceVertexSet R.replacementTree) alpha = ∅ by + simpa [XD] using hAlphaBoundary] + simp + have hpathU : TwoColorPathComponent G phiD beta alpha (Sum.inl u) := + missingSecondRootPath phiD alpha beta u hBetaAlpha.symm hproperD hAlphaMissingD + have hpathV : TwoColorPathComponent G phiD beta alpha (Sum.inl v) := + missingRootPath phiD beta alpha v hBetaAlpha hproperD hBetaMissingD + have hcompEq := hinter (Sum.inl u) (Sum.inl v) hpathU hpathV + ⟨u, huXD, SimpleGraph.ConnectedComponent.connectedComponentMk_mem⟩ + ⟨v, hvXD, SimpleGraph.ConnectedComponent.connectedComponentMk_mem⟩ + have hvCompD : Sum.inl v ∈ + TwoColorComponent G phiD beta alpha (Sum.inl u) := by + rw [hcompEq] + exact SimpleGraph.ConnectedComponent.connectedComponentMk_mem + refine ⟨v, by simpa [X] using hvX, hBetaMissing, ?_, ?_⟩ + · unfold TwoColorComponent at hvCompD ⊢ + rw [hgraph] at hvCompD + exact hvCompD + · intro w hwX hBetaW + by_contra hwv + have hdis := hXelem (by simpa [X] using hvX) + (by simpa [X] using hwX) (fun h => hwv h.symm) + exact (Finset.disjoint_left.mp hdis) hBetaMissing hBetaW + +private theorem helper_hAlphaBoundaryCard_298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let U : Finset V := (insert ug0 ({ ug1 } : Finset V) : Finset V); + let Z : Finset V := X \ U; + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; IsProperEdgeColoring G phi → + ColoredVertexSetClosed G phiD XD → ug0 ∈ X → ug1 ∈ X → X = Z ∪ U → XD = Z ∪ (insert R.u1 + ({ R.u2 } : Finset V) : Finset V) → Z ⊆ X → Z ⊆ XD → + ∀ ⦃u : V⦄, + ∀ alpha ∈ MissingColors G phi u, u ∈ XD → alpha ≠ (↑d : Fin k) → alpha ≠ gamma → + ∀ (v : V), ( + ∀ (c : Fin k), c ≠ gamma → c ≠ (↑d : Fin k) → + ∀ (f : E), phiD f = some c ↔ phi f = some c) → alpha ∈ MissingColors G phiD u → + let u' : V := if u = R.u1 then R.u2 else R.u1; + let v' : V := if v = ug0 then ug1 else ug0; (insert u ({ u' } : Finset V) : Finset V) = + (insert R.u1 ({ R.u2 } : Finset V) : Finset V) → (insert v ({ v' } : Finset V) : Finset V) + = (insert ug0 ({ ug1 } : Finset V) : Finset V) → v ≠ v' → + ∀ (aGamma : E), phi aGamma = some alpha → G.ends aGamma = s(v, v') → + ∀ (aZ : E), Incident G u' aZ → phi aZ = some alpha → (BoundaryColorEdges G phi X alpha).card ≤ + (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD X ug0 ug1 U Z XD hproper hXDclosed hug0X + hug1X hXsplit hXDsplit hZsubX hZsubXD u alpha hAlpha huXD hAlphaDelta hAlphaGamma v + colorFixed hAlphaMissingD u' v' hUPair hVPair hVne aGamma haGammaColor haGammaEnds aZ haZU' + haZColor + apply (Finset.card_le_card (t := ({aZ} : Finset E))) + intro q hq + have hqBoundary : q ∈ BoundaryEdges G X := (Finset.mem_filter.mp hq).1 + have hqColor : phi q = some alpha := (Finset.mem_filter.mp hq).2 + obtain ⟨x, hxX, y, hyX, hqEnds⟩ := by + simpa [BoundaryEdges] using hqBoundary + have hxSplit : x ∈ Z ∨ x ∈ U := by + have hx : x ∈ X := hxX + rw [hXsplit] at hx + exact Finset.mem_union.mp hx + have hxZ : x ∈ Z := by + rcases hxSplit with hxZ | hxU + · exact hxZ + · exfalso + have hqInc : Incident G x q := by + change x ∈ G.ends q + rw [hqEnds] + simp + have haInc : Incident G x aGamma := by + change x ∈ G.ends aGamma + rw [haGammaEnds] + have : x ∈ ({v, v'} : Finset V) := by + rw [hVPair] + simpa [U] using hxU + simpa [hVne] using this + have hqNe : q ≠ aGamma := by + intro h + apply hyX + have hyPair : y ∈ ({v, v'} : Finset V) := by + have hyInc : Incident G y aGamma := by + change y ∈ G.ends aGamma + rw [← h, hqEnds] + simp + simpa [Incident, haGammaEnds] using hyInc + rw [hVPair] at hyPair + simp only [Finset.mem_insert, Finset.mem_singleton] at hyPair + rcases hyPair with rfl | rfl + · exact hug0X + · exact hug1X + exact (hproper hqNe ⟨x, hqInc, haInc⟩ hqColor) haGammaColor + have hxXD : x ∈ XD := hZsubXD hxZ + have hqColorD : phiD q = some alpha := + (colorFixed alpha hAlphaGamma hAlphaDelta q).mpr hqColor + have hyXD : y ∈ XD := by + by_contra hy + have hboundary : q ∈ BoundaryEdges G XD := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxXD, y, hy, hqEnds⟩ + exact hXDclosed hboundary huXD hqColorD hAlphaMissingD + have hyPair : y ∈ ({R.u1, R.u2} : Finset V) := by + have hy := hyXD + rw [hXDsplit] at hy + rcases Finset.mem_union.mp hy with hyZ | hyPair + · exact False.elim (hyX (hZsubX hyZ)) + · exact hyPair + rw [← hUPair] at hyPair + simp only [Finset.mem_insert, Finset.mem_singleton] at hyPair + have hyU' : y = u' := by + rcases hyPair with hyU | hyU' + · exfalso + have hinc : Incident G u q := by + change u ∈ G.ends q + rw [hqEnds, ← hyU] + simp + have hpresent : alpha ∈ PresentColors G phi u := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, hinc, hqColor⟩ + exact (Finset.mem_sdiff.mp hAlpha).2 hpresent + · exact hyU' + have hqIncU' : Incident G u' q := by + change u' ∈ G.ends q + rw [hqEnds, hyU'] + simp + have hqaZ : q = aZ := by + by_contra hne + exact (hproper hne ⟨u', hqIncU', haZU'⟩ hqColor) haZColor + simp [hqaZ] + +private theorem helper_continuation_255.{u_1, u_2} : + helperContinuation255Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD X ug0 ug1 U Z XD hproper hXelem hXclosed + hproperD hXDelem hXDclosed hug0X hug1X hXsplit hXDsplit hZsubX hZsubXD fGamma huPairNe + hugPairNe u hu huOutside alpha hAlpha beta hBetaAlpha huPair huXD huDeltaIncident + huGammaIncident hAlphaDelta hAlphaGamma v hvX hBetaMissing colorFixed hAlphaMissingD + hBetaMissingD hgraph missingRootPath missingSecondRootPath closedBoundaryEmpty + have hvSplit : v ∈ Z ∨ v ∈ U := by + have hvX' : v ∈ X := by simpa [X] using hvX + rw [hXsplit] at hvX' + exact Finset.mem_union.mp hvX' + rcases hvSplit with hvZ | hvU + · exact @helper_branch_135 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hXelem) (@hproperD) (@hXDelem) + (@hXDclosed) (@hZsubXD) (@u) (@alpha) (@beta) (@hBetaAlpha) (@huXD) (@v) (@hvX) + (@hBetaMissing) (@hAlphaMissingD) (@hBetaMissingD) (@hgraph) (@missingRootPath) + (@missingSecondRootPath) (@closedBoundaryEmpty) (@hvZ) + · let u' : V := if u = R.u1 then R.u2 else R.u1 + let v' : V := if v = ug0 then ug1 else ug0 + have hUPair : ({u, u'} : Finset V) = {R.u1, R.u2} := by + simp only [Finset.mem_insert, Finset.mem_singleton] at huPair + rcases huPair with hu1 | hu2 + · subst u + simp [u'] + · subst u + have hne : R.u2 ≠ R.u1 := huPairNe.symm + ext x + simp [u', hne, or_comm] + have hUne : u ≠ u' := by + intro h + have hc : ({u, u'} : Finset V).card = 1 := by simp [h] + have hr : ({R.u1, R.u2} : Finset V).card = 2 := by simp [huPairNe] + rw [hUPair, hr] at hc + omega + have hVPair : ({v, v'} : Finset V) = {ug0, ug1} := by + simp only [U, Finset.mem_insert, Finset.mem_singleton] at hvU + rcases hvU with hv0 | hv1 + · subst v + simp [v'] + · subst v + have hne : ug1 ≠ ug0 := hugPairNe.symm + ext x + simp [v', hne, or_comm] + have hVne : v ≠ v' := by + intro h + have hc : ({v, v'} : Finset V).card = 1 := by simp [h] + have hr : ({ug0, ug1} : Finset V).card = 2 := by simp [hugPairNe] + rw [hVPair, hr] at hc + omega + have hu'XD : u' ∈ XD := by + rw [hXDsplit] + apply Finset.mem_union_right + rw [← hUPair] + simp + have hvX' : v ∈ X := by simpa [X] using hvX + have hv'X : v' ∈ X := by + rw [hXsplit] + apply Finset.mem_union_right + rw [show U = {v, v'} by simpa [U] using hVPair.symm] + simp + have hAlphaPair : + alpha ∈ MissingColors G phi R.u1 ∨ + alpha ∈ MissingColors G phi R.u2 := by + have huOrig : u ∈ ({R.u1, R.u2} : Finset V) := by + rw [← hUPair] + simp + simp only [Finset.mem_insert, Finset.mem_singleton] at huOrig + rcases huOrig with hu1 | hu2 + · exact Or.inl (by simpa [hu1] using hAlpha) + · exact Or.inr (by simpa [hu2] using hAlpha) + have hBetaPair : + beta ∈ MissingColors G phi ug0 ∨ + beta ∈ MissingColors G phi ug1 := by + have hvPair : v ∈ ({ug0, ug1} : Finset V) := by simpa [U] using hvU + simp only [Finset.mem_insert, Finset.mem_singleton] at hvPair + rcases hvPair with rfl | rfl + · exact Or.inl hBetaMissing + · exact Or.inr hBetaMissing + have hmissingInternal := ScheideSymmetricMissingInternal G k e0 phi T C D d R + obtain ⟨aGamma, haGammaColor, haGammaEnds0⟩ := + hmissingInternal.1 alpha hAlphaPair + obtain ⟨bDelta, hbDeltaColor, hbDeltaEnds0⟩ := + hmissingInternal.2 beta hBetaPair + have haGammaEnds : G.ends aGamma = s(v, v') := by + rw [show G.ends aGamma = s(ug0, ug1) by + simpa [ug0, ug1] using haGammaEnds0] + simp only [U, Finset.mem_insert, Finset.mem_singleton] at hvU + rcases hvU with hv0 | hv1 + · subst v + simp [v'] + · subst v + have hne : ug1 ≠ ug0 := hugPairNe.symm + simp [v', hne, Sym2.eq_swap] + have hbDeltaEnds : G.ends bDelta = s(u, u') := by + rw [hbDeltaEnds0] + have huOrig : u ∈ ({R.u1, R.u2} : Finset V) := by + rw [← hUPair] + simp + simp only [Finset.mem_insert, Finset.mem_singleton] at huOrig + rcases huOrig with hu1 | hu2 + · subst u + simp [u'] + · subst u + have hne : R.u2 ≠ R.u1 := huPairNe.symm + simp [u', hne, Sym2.eq_swap] + have hAlphaNotMissingU' : alpha ∉ MissingColors G phiD u' := by + intro hmiss + have hdis := hXDelem huXD hu'XD hUne + exact (Finset.disjoint_left.mp hdis) hAlphaMissingD hmiss + have hAlphaPresentU' : alpha ∈ PresentColors G phiD u' := by + simpa [MissingColors] using hAlphaNotMissingU' + obtain ⟨aZ, haZU', haZColorD⟩ : + ∃ aZ : E, Incident G u' aZ ∧ phiD aZ = some alpha := by + simpa [PresentColors] using hAlphaPresentU' + have haZColor : phi aZ = some alpha := + (colorFixed alpha hAlphaGamma hAlphaDelta aZ).mp haZColorD + obtain ⟨zA, haZEnds⟩ := Sym2.mem_iff_exists.mp haZU' + have hzANeU' : zA ≠ u' := by + intro h + exact G.loopless aZ u' (by simpa [h] using haZEnds) + have hzAXD : zA ∈ XD := by + by_contra hzA + have hboundary : aZ ∈ BoundaryEdges G XD := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u', hu'XD, zA, hzA, haZEnds⟩ + exact hXDclosed hboundary huXD haZColorD hAlphaMissingD + have hzANeU : zA ≠ u := by + intro h + have hinc : Incident G u aZ := by + change u ∈ G.ends aZ + rw [haZEnds, h] + simp + have hpresent : alpha ∈ PresentColors G phi u := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨aZ, hinc, haZColor⟩ + exact (Finset.mem_sdiff.mp hAlpha).2 hpresent + have hzAZ : zA ∈ Z := by + have hz := hzAXD + rw [hXDsplit] at hz + rcases Finset.mem_union.mp hz with hz | hz + · exact hz + · rw [← hUPair] at hz + simp only [Finset.mem_insert, Finset.mem_singleton] at hz + rcases hz with hz | hz + · exact False.elim (hzANeU hz) + · exact False.elim (hzANeU' hz) + have hBetaBoundary : BoundaryColorEdges G phi X beta = ∅ := + closedBoundaryEmpty phi X beta v hvX' hXclosed hBetaMissing + have hAlphaBoundaryCard := @helper_hAlphaBoundaryCard_298 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hproper) + (@hXDclosed) (@hug0X) (@hug1X) (@hXsplit) (@hXDsplit) (@hZsubX) (@hZsubXD) (@u) (@alpha) + (@hAlpha) (@huXD) (@hAlphaDelta) (@hAlphaGamma) (@v) (@colorFixed) (@hAlphaMissingD) + (@hUPair) (@hVPair) (@hVne) (@aGamma) (@haGammaColor) (@haGammaEnds) (@aZ) (@haZU') + (@haZColor) + have hinter : TreeInterchangeable G T phi beta alpha := by + exact ElementarySingleBoundaryInterchangeable G phi T beta alpha + hproper hXelem (by simpa [X] using hBetaBoundary) + (by simpa [X] using hAlphaBoundaryCard) + have hpathU : TwoColorPathComponent G phi beta alpha (Sum.inl u) := + missingSecondRootPath phi alpha beta u hBetaAlpha.symm hproper hAlpha + have hpathV : TwoColorPathComponent G phi beta alpha (Sum.inl v) := + missingRootPath phi beta alpha v hBetaAlpha hproper hBetaMissing + let H := TwoColorIncidenceGraph G phi beta alpha + have hAdjUB : H.Adj (Sum.inl u) (Sum.inr bDelta) := by + simp [H, TwoColorIncidenceGraph, Incident, hbDeltaEnds, hbDeltaColor] + have hAdjBU' : H.Adj (Sum.inr bDelta) (Sum.inl u') := by + simp [H, TwoColorIncidenceGraph, Incident, hbDeltaEnds, hbDeltaColor] + have hAdjU'A : H.Adj (Sum.inl u') (Sum.inr aZ) := by + simp [H, TwoColorIncidenceGraph, haZU', haZColor] + have hAdjAZ : H.Adj (Sum.inr aZ) (Sum.inl zA) := by + have hinc : Incident G zA aZ := by + change zA ∈ G.ends aZ + rw [haZEnds] + simp + simp [H, TwoColorIncidenceGraph, hinc, haZColor] + have hzAComp : Sum.inl zA ∈ + TwoColorComponent G phi beta alpha (Sum.inl u) := by + change H.connectedComponentMk (Sum.inl zA) = + H.connectedComponentMk (Sum.inl u) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hAdjAZ).symm.trans + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hAdjU'A).symm.trans + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hAdjBU').symm.trans + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hAdjUB).symm)) + have hcompEq := hinter (Sum.inl u) (Sum.inl v) hpathU hpathV + ⟨zA, hZsubX hzAZ, hzAComp⟩ + ⟨v, hvX', SimpleGraph.ConnectedComponent.connectedComponentMk_mem⟩ + have hvComp : Sum.inl v ∈ + TwoColorComponent G phi beta alpha (Sum.inl u) := by + rw [hcompEq] + exact SimpleGraph.ConnectedComponent.connectedComponentMk_mem + refine ⟨v, by simpa [X] using hvX, hBetaMissing, hvComp, ?_⟩ + intro w hwX hBetaW + by_contra hwv + have hdis := hXelem (by simpa [X] using hvX) + (by simpa [X] using hwX) (fun h => hwv h.symm) + exact (Finset.disjoint_left.mp hdis) hBetaMissing hBetaW + +private theorem helper_continuation_212.{u_1, u_2} : + helperContinuation212Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD X ug0 ug1 U Z XD hproper hXelem hXclosed + hproperD hXDelem hXDclosed hug0X hug1X hXsplit hXDsplit hZsubX hZsubXD hgammaDelta fGamma + huPairNe hugPairNe u hu huOutside alpha hAlpha beta hBetaAlpha huPair huXD huDeltaIncident + huGammaIncident hAlphaDelta hAlphaGamma hBetaData v hvX hBetaMissing hGammaUsed + have hBetaGamma : beta ≠ gamma := by + intro h + exact hBetaData.2 (h ▸ hGammaUsed) + have hBetaDelta : beta ≠ d.1 := by + intro h + have hdcard : 2 ≤ (BoundaryColorEdges G phi X d.1).card := by + have hd := (Finset.mem_filter.mp d.2).2 + simpa only [DefectiveColor, X] using hd + obtain ⟨f, hf⟩ := Finset.card_pos.mp + (lt_of_lt_of_le Nat.zero_lt_two hdcard) + have := hXclosed (Finset.mem_filter.mp hf).1 (by simpa [X] using hvX) + (Finset.mem_filter.mp hf).2 + exact this (by simpa [h] using hBetaMissing) + have colorFixed (c : Fin k) (hcGamma : c ≠ gamma) (hcDelta : c ≠ d.1) + (f : E) : phiD f = some c ↔ phi f = some c := by + simp only [phiD, TwoColorComponentSwap] + by_cases hf : Sum.inr f ∈ + TwoColorComponent G phi gamma d.1 (Sum.inl (D.v0 d)) + · simp only [hf, ite_eq_left] + by_cases hfg : phi f = some gamma + · rw [hfg] + simp only [ite_eq_left] + constructor + · intro hnew + exact False.elim (hcDelta (Option.some.inj hnew).symm) + · intro hold + exact False.elim (hcGamma (Option.some.inj hold).symm) + · by_cases hfd : phi f = some d.1 + · rw [hfd] + simp only [Option.some.injEq, hgammaDelta.symm, ite_false, ite_eq_left] + constructor + · intro hnew + exact False.elim (hcGamma hnew.symm) + · intro hold + exact False.elim (hcDelta hold.symm) + · simp [hfg, hfd] + · simp [hf] + have hAlphaMissingD : alpha ∈ MissingColors G phiD u := by + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ alpha, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpresent + obtain ⟨f, huf, hfc⟩ := hpresent + exact (Finset.mem_sdiff.mp hAlpha).2 (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, huf, (colorFixed alpha hAlphaGamma hAlphaDelta f).mp hfc⟩) + have hBetaMissingD : beta ∈ MissingColors G phiD v := by + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ beta, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpresent + obtain ⟨f, hvf, hfc⟩ := hpresent + exact (Finset.mem_sdiff.mp hBetaMissing).2 (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hvf, (colorFixed beta hBetaGamma hBetaDelta f).mp hfc⟩) + have hgraph : TwoColorIncidenceGraph G phiD beta alpha = + TwoColorIncidenceGraph G phi beta alpha := by + ext x y + cases x with + | inl vx => + cases y with + | inl vy => rfl + | inr e => + simp only [TwoColorIncidenceGraph] + constructor <;> rintro ⟨hi, hc⟩ <;> refine ⟨hi, ?_⟩ + · rcases hc with hc | hc + · exact Or.inl ((colorFixed beta hBetaGamma hBetaDelta e).mp hc) + · exact Or.inr ((colorFixed alpha hAlphaGamma hAlphaDelta e).mp hc) + · rcases hc with hc | hc + · exact Or.inl ((colorFixed beta hBetaGamma hBetaDelta e).mpr hc) + · exact Or.inr ((colorFixed alpha hAlphaGamma hAlphaDelta e).mpr hc) + | inr e => + cases y with + | inl vy => + simp only [TwoColorIncidenceGraph] + constructor <;> rintro ⟨hi, hc⟩ <;> refine ⟨hi, ?_⟩ + · rcases hc with hc | hc + · exact Or.inl ((colorFixed beta hBetaGamma hBetaDelta e).mp hc) + · exact Or.inr ((colorFixed alpha hAlphaGamma hAlphaDelta e).mp hc) + · rcases hc with hc | hc + · exact Or.inl ((colorFixed beta hBetaGamma hBetaDelta e).mpr hc) + · exact Or.inr ((colorFixed alpha hAlphaGamma hAlphaDelta e).mpr hc) + | inr f => rfl + have missingRootPath : + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (w : V), a ≠ b → IsProperEdgeColoring G psi → + a ∈ MissingColors G psi w → TwoColorPathComponent G psi a b (Sum.inl w) := by + intro psi a b w hab hprop hmiss + refine ⟨hab, Sum.inl w, + SimpleGraph.ConnectedComponent.connectedComponentMk_mem, ?_⟩ + rintro x hx y hy + have no_a : ∀ e : E, Incident G w e → psi e ≠ some a := by + intro e hwe hcolor + have hpresent : a ∈ PresentColors G psi w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, hcolor⟩ + exact (Finset.mem_sdiff.mp hmiss).2 hpresent + cases x with + | inl x => + simp [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hx + | inr e => + cases y with + | inl y => + simp [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hy + | inr f => + apply congrArg Sum.inr + simp only [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hx hy + have hecolor : psi e = some b := hx.2.resolve_left (no_a e hx.1) + have hfcolor : psi f = some b := hy.2.resolve_left (no_a f hy.1) + by_contra hef + exact (hprop hef ⟨w, hx.1, hy.1⟩ hecolor) hfcolor + have missingSecondRootPath : + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (w : V), a ≠ b → IsProperEdgeColoring G psi → + a ∈ MissingColors G psi w → TwoColorPathComponent G psi b a (Sum.inl w) := by + intro psi a b w hab hprop hmiss + refine ⟨hab.symm, Sum.inl w, + SimpleGraph.ConnectedComponent.connectedComponentMk_mem, ?_⟩ + rintro x hx y hy + have no_a : ∀ e : E, Incident G w e → psi e ≠ some a := by + intro e hwe hcolor + have hpresent : a ∈ PresentColors G psi w := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, hcolor⟩ + exact (Finset.mem_sdiff.mp hmiss).2 hpresent + cases x with + | inl x => + simp [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hx + | inr e => + cases y with + | inl y => + simp [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hy + | inr f => + apply congrArg Sum.inr + simp only [SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hx hy + have hecolor : psi e = some b := hx.2.resolve_right (no_a e hx.1) + have hfcolor : psi f = some b := hy.2.resolve_right (no_a f hy.1) + by_contra hef + exact (hprop hef ⟨w, hx.1, hy.1⟩ hecolor) hfcolor + have closedBoundaryEmpty : + ∀ (psi : PartialEdgeColoring E k) (Y : Finset V) (c : Fin k) (w : V), w ∈ Y → + ColoredVertexSetClosed G psi Y → c ∈ MissingColors G psi w → BoundaryColorEdges G psi Y c + = ∅ := by + intro psi Y c w hwY hclosed hmiss + apply Finset.not_nonempty_iff_eq_empty.mp + rintro ⟨e, he⟩ + exact hclosed (Finset.mem_filter.mp he).1 hwY + (Finset.mem_filter.mp he).2 hmiss + exact @helper_continuation_255 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hproper) (@hXelem) + (@hXclosed) (@hproperD) (@hXDelem) (@hXDclosed) (@hug0X) (@hug1X) (@hXsplit) (@hXDsplit) + (@hZsubX) (@hZsubXD) (@fGamma) (@huPairNe) (@hugPairNe) (@u) (@hu) (@huOutside) (@alpha) + (@hAlpha) (@beta) (@hBetaAlpha) (@huPair) (@huXD) (@huDeltaIncident) (@huGammaIncident) + (@hAlphaDelta) (@hAlphaGamma) (@v) (@hvX) (@hBetaMissing) (@colorFixed) (@hAlphaMissingD) + (@hBetaMissingD) (@hgraph) (@missingRootPath) (@missingSecondRootPath) (@closedBoundaryEmpty) +theorem ScheideReplacementAbsorbing {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + {R.u1, R.u2} ⊆ AbsorbingVertices T phi := by + classical + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let X := TreeSequenceVertexSet T + let ug0 := C.blockVertex (D.gammaIndex d) 0 + let ug1 := C.blockVertex (D.gammaIndex d) 1 + let U := ({ug0, ug1} : Finset V) + let Z := X \ U + let XD := TreeSequenceVertexSet R.replacementTree + have hproper : IsProperEdgeColoring G phi := C.globally_maximum.1.2.2.2.1 + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hXelem : ColoredVertexSetElementary G phi X := by + exact horder.2.2.2.1 + have hXclosed : ColoredVertexSetClosed G phi X := by + exact horder.2.2.2.2 + have hrep := ScheideReplacementMaximum G k e0 phi T C D d R + have hproperD : IsProperEdgeColoring G phiD := by + simpa [gamma, phiD] using hrep.1 + have hrepGlobal : GlobalMaximumTriple G k e0 phiD R.replacementTree := by + simpa [gamma, phiD] using hrep.2.2 + have horderD := ScheideGlobalMaximumOrder G k e0 phiD R.replacementTree hrepGlobal + have hXDelem : ColoredVertexSetElementary G phiD XD := by + exact horderD.2.2.2.1 + have hXDclosed : ColoredVertexSetClosed G phiD XD := by + exact horderD.2.2.2.2 + have hug0X : ug0 ∈ X := by + change C.blockVertex (D.gammaIndex d) 0 ∈ TreeSequenceVertexSet T + rw [← C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)] + simp [TreeSequenceVertexSet] + have hug1X : ug1 ∈ X := by + change C.blockVertex (D.gammaIndex d) 1 ∈ TreeSequenceVertexSet T + rw [← C.block_vertex_position (D.gammaIndex d) (1 : Fin 2)] + simp [TreeSequenceVertexSet] + have hXsplit : X = Z ∪ U := by + ext x + simp only [Z, Finset.mem_union, Finset.mem_sdiff, U] + by_cases hx : x ∈ X + · by_cases hu : x ∈ ({ug0, ug1} : Finset V) <;> simp [hx, hu] + · have hnu : x ∉ ({ug0, ug1} : Finset V) := by + intro hxu + simp only [Finset.mem_insert, Finset.mem_singleton] at hxu + rcases hxu with rfl | rfl <;> contradiction + simp [hx, hnu] + have hXDsplit : XD = Z ∪ {R.u1, R.u2} := by + simpa [XD, X, Z, U, ug0, ug1] using R.replacement_vertices + have hu1XD : R.u1 ∈ XD := by rw [hXDsplit]; simp + have hu2XD : R.u2 ∈ XD := by rw [hXDsplit]; simp + have hZsubX : Z ⊆ X := by + intro z hz + exact (Finset.mem_sdiff.mp hz).1 + have hZsubXD : Z ⊆ XD := by + intro z hz + rw [hXDsplit] + exact Finset.mem_union_left _ hz + have hgammaDelta : gamma ≠ d.1 := by + intro heq + have hmissing : gamma ∈ MissingColors G phi (D.v0 d) := by + simpa [gamma] using D.gamma_missing_at_v0 d + have hinc : Incident G (D.v0 d) (D.f0 d) := by + change D.v0 d ∈ G.ends (D.f0 d) + rw [D.f0_ends] + simp + have hpresent : gamma ∈ PresentColors G phi (D.v0 d) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨D.f0 d, hinc, by simpa [heq] using D.f0_color d⟩ + exact (Finset.mem_sdiff.mp hmissing).2 hpresent + obtain ⟨fGamma, hfGammaColor, hfGammaEnds⟩ := + (ScheideSymmetricDefectiveInternal G k e0 phi T C D d R).2 + have huPairNe : R.u1 ≠ R.u2 := by + intro h + have hi := R.replacementTree.vertex_injective + (R.replacement_last_vertices.1.trans + (h.trans R.replacement_last_vertices.2.symm)) + have hv : T.length - 1 = T.length := by + simpa using congrArg Fin.val hi + have hp := T.positive + omega + have hugPairNe : ug0 ≠ ug1 := by + intro h + let q0 : Fin (T.length + 1) := ⟨C.p + 2 * (D.gammaIndex d).val, by + have hi := (D.gammaIndex d).isLt + have hl := C.length_eq + omega⟩ + let q1 : Fin (T.length + 1) := ⟨C.p + 2 * (D.gammaIndex d).val + 1, by + have hi := (D.gammaIndex d).isLt + have hl := C.length_eq + omega⟩ + have hv : T.vertex q0 = T.vertex q1 := by + rw [show T.vertex q0 = ug0 by + simpa [q0, ug0] using C.block_vertex_position (D.gammaIndex d) 0] + rw [show T.vertex q1 = ug1 by + simpa [q1, ug1] using C.block_vertex_position (D.gammaIndex d) 1] + exact h + have hq := congrArg Fin.val (T.vertex_injective hv) + dsimp [q0, q1] at hq + omega + intro u hu + simp only [AbsorbingVertices, Finset.mem_filter, Finset.mem_univ, true_and] + have huOutside : u ∉ X := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hu + rcases hu with rfl | rfl + · exact R.u1_outside + · exact R.u2_outside + refine ⟨by simpa [X] using huOutside, ?_⟩ + intro alpha hAlpha beta hBeta hBetaAlpha + have huPair : u ∈ ({R.u1, R.u2} : Finset V) := by simpa using hu + have huXD : u ∈ XD := by + rw [hXDsplit] + exact Finset.mem_union_right _ huPair + have huDeltaIncident : ∃ f : E, Incident G u f ∧ phi f = some d.1 := by + simp only [Finset.mem_insert, Finset.mem_singleton] at huPair + rcases huPair with rfl | rfl + · refine ⟨R.f1, ?_, R.f1_color⟩ + change R.u1 ∈ G.ends R.f1 + rw [R.f1_ends] + simp + · refine ⟨R.f2, ?_, R.f2_color⟩ + change R.u2 ∈ G.ends R.f2 + rw [R.f2_ends] + simp + have huGammaIncident : Incident G u fGamma := by + change u ∈ G.ends fGamma + rw [hfGammaEnds] + simpa [huPairNe] using huPair + have hAlphaDelta : alpha ≠ d.1 := by + rintro rfl + obtain ⟨f, huf, hfc⟩ := huDeltaIncident + have hpresent : d.1 ∈ PresentColors G phi u := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, huf, hfc⟩ + exact (Finset.mem_sdiff.mp hAlpha).2 hpresent + have hAlphaGamma : alpha ≠ gamma := by + rintro rfl + have hpresent : gamma ∈ PresentColors G phi u := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fGamma, huGammaIncident, by simpa [gamma] using hfGammaColor⟩ + exact (Finset.mem_sdiff.mp hAlpha).2 hpresent + have hBetaData := Finset.mem_sdiff.mp hBeta + obtain ⟨v, hvX, hBetaMissing⟩ := Finset.mem_biUnion.mp hBetaData.1 + have hGammaUsed : gamma ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + let j : Fin T.length := ⟨C.p - 1 + 2 * (D.gammaIndex d).val, by + have hi := (D.gammaIndex d).isLt + have hp := C.p_ge_two + have hl := C.length_eq + omega⟩ + refine ⟨j, ?_, ?_⟩ + · dsimp [j] + have hp := C.p_ge_two + omega + rw [show T.edge j = C.blockEdge (D.gammaIndex d) (0 : Fin 2) by + simpa [j] using C.block_edge_position (D.gammaIndex d) 0] + simpa [gamma] using C.block_color (D.gammaIndex d) 0 + exact @helper_continuation_212 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@hproper) (@hXelem) + (@hXclosed) (@hproperD) (@hXDelem) (@hXDclosed) (@hug0X) (@hug1X) (@hXsplit) (@hXDsplit) + (@hZsubX) (@hZsubXD) (@hgammaDelta) (@fGamma) (@huPairNe) (@hugPairNe) (@u) (@hu) + (@huOutside) (@alpha) (@hAlpha) (@beta) (@hBetaAlpha) (@huPair) (@huXD) (@huDeltaIncident) + (@huGammaIncident) (@hAlphaDelta) (@hAlphaGamma) (@hBetaData) (@v) (@hvX) (@hBetaMissing) + (@hGammaUsed) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtLeastThree.lean b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtLeastThree.lean new file mode 100644 index 0000000000..28d9d258e7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtLeastThree.lean @@ -0,0 +1,1172 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused +public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryParity +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Replacement Boundary At Least Three + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_initial_avoids_U_217.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let U : Finset V := { u0, u1 }; + let Z : Finset V := X \ U; + let _ : DecidablePred fun (f : E) ↦ + ∃ w ∉ X, Incident G w f := fun (x : E) ↦ Classical.propDecidable ((fun (f : E) ↦ + ∃ w ∉ X, Incident G w f) x); + let B : Finset E := {f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f}; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); D.v0 d ∈ Z ∧ y0 ∈ Z ∧ ( + ∀ z ∈ Z, + ∃! f : E, Incident G z f ∧ phi f = some delta) ∧ D.f0 d ∈ B ∧ Odd B.card → B = {D.f0 d} → + IsProperEdgeColoring G phi → ColoredVertexSetClosed G phi X → alpha ∈ MissingColors G phi + y0 → + ∀ (h : E), phi h = some alpha → G.ends h = s(C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex + i (1 : Fin (2 : ℕ))) → Incident G u0 h → Incident G u1 h → + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha delta; + let I : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl y0); U ⊆ X → + ∀ v ∈ U, Sum.inl v ∉ I := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i u0 u1 U Z outsideDec B y0 alpha delta hp hBsingleton + hproper hclosed hy0Missing h hhcolor hhends hhInc0 hhInc1 H I hUsubX v hvU hvI + let p := D.initialPath d + have hpath : p.IsPath := (D.initial_path_full d).2.1 + have hvSupport : Sum.inl v ∈ p.support := by + change Sum.inl v ∈ {x | x ∈ p.support} + rw [(D.initial_path_full d).2.2.2] + exact hvI + obtain ⟨t, ht, htle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hvSupport + have hAtT : t ≤ p.length ∧ ∃ w : V, w ∉ Z ∧ p.getVert t = Sum.inl w := by + exact ⟨htle, v, fun hvZ => (Finset.mem_sdiff.mp hvZ).2 hvU, ht⟩ + have hleave : ∃ n : ℕ, + n ≤ p.length ∧ ∃ w : V, w ∉ Z ∧ p.getVert n = Sum.inl w := + ⟨t, hAtT⟩ + let n := Nat.find hleave + have hn := Nat.find_spec hleave + obtain ⟨hnle, w, hwZ, hnw⟩ := hn + have hnpos : 0 < n := by + by_contra hn0 + have hnzero : n = 0 := by omega + have hnw' : p.getVert n = Sum.inl w := hnw + rw [hnzero, p.getVert_zero] at hnw' + have hsum : (Sum.inl y0 : Sum V E) = Sum.inl w := hnw' + have hyw : y0 = w := Sum.inl.inj hsum + exact hwZ (hyw ▸ hp.2.1) + have hnTwo : 2 ≤ n := by + by_contra hntwo + have hnOne : n = 1 := by omega + have hadj := p.adj_getVert_succ (i := 0) (by omega : 0 < p.length) + rw [p.getVert_zero] at hadj + have hgetOne : p.getVert 1 = Sum.inl w := by + have hnw' : p.getVert n = Sum.inl w := hnw + simpa [hnOne] using hnw' + have : H.Adj (Sum.inl y0) (Sum.inl w) := by + simpa [H, alpha, delta, y0, hgetOne] using hadj + simp [H, TwoColorIncidenceGraph] at this + have hadjEnter := p.adj_getVert_succ (i := n - 1) (by omega : n - 1 < p.length) + have hadjBefore := p.adj_getVert_succ (i := n - 2) (by omega : n - 2 < p.length) + have hEnterIndex : n - 1 + 1 = n := by omega + have hBeforeIndex : n - 2 + 1 = n - 1 := by omega + rw [hEnterIndex, hnw] at hadjEnter + cases hedge : p.getVert (n - 1) with + | inl q => + rw [hedge] at hadjEnter + simp [TwoColorIncidenceGraph] at hadjEnter + | inr e => + have hEnterData : Incident G w e ∧ + (phi e = some alpha ∨ phi e = some delta) := by + rw [hedge] at hadjEnter + simpa [H, TwoColorIncidenceGraph] using hadjEnter + rw [hBeforeIndex, hedge] at hadjBefore + cases hprev : p.getVert (n - 2) with + | inr g => + rw [hprev] at hadjBefore + simp [TwoColorIncidenceGraph] at hadjBefore + | inl z => + have hBeforeData : Incident G z e ∧ + (phi e = some alpha ∨ phi e = some delta) := by + rw [hprev] at hadjBefore + simpa [H, TwoColorIncidenceGraph] using hadjBefore + have hzZ : z ∈ Z := by + by_contra hz + have hEarlier : n - 2 ≤ p.length ∧ + ∃ q : V, q ∉ Z ∧ p.getVert (n - 2) = Sum.inl q := + ⟨by omega, z, hz, hprev⟩ + have hmin := Nat.find_min' hleave hEarlier + change n ≤ n - 2 at hmin + omega + have hzX : z ∈ X := (Finset.mem_sdiff.mp hzZ).1 + have edge_is_f0 : e = D.f0 d := by + by_cases hwX : w ∈ X + · have hwU : w ∈ U := by + by_contra hwU + exact hwZ (Finset.mem_sdiff.mpr ⟨hwX, hwU⟩) + rcases hEnterData.2 with heAlpha | heDelta + · have hw0or1 : w = u0 ∨ w = u1 := by + simpa [U] using hwU + have hwh : Incident G w h := by + rcases hw0or1 with rfl | rfl + · exact hhInc0 + · exact hhInc1 + have heh : e = h := by + by_contra hne + exact (hproper hne ⟨w, hEnterData.1, hwh⟩ heAlpha) hhcolor + have hzInU : z ∈ U := by + have hzEnds : z ∈ G.ends h := by + rw [← heh] + exact hBeforeData.1 + simpa [U, u0, u1, hhends] using hzEnds + exact False.elim ((Finset.mem_sdiff.mp hzZ).2 hzInU) + · have hbad := ScheideDefectiveNoCross G k e0 phi T C D d e heDelta + exact False.elim (hbad ⟨w, hwU, hEnterData.1, z, hzZ, + hBeforeData.1⟩) + · rcases hEnterData.2 with heAlpha | heDelta + · have heBoundary : e ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + have hzw : z ≠ w := fun hzw => hwX (hzw ▸ hzX) + exact ⟨z, hzX, w, hwX, + (Sym2.mem_and_mem_iff hzw).mp + ⟨hBeforeData.1, hEnterData.1⟩⟩ + exact False.elim (hclosed heBoundary (Finset.mem_sdiff.mp hp.2.1).1 + heAlpha hy0Missing) + · have heBoundaryZ : e ∈ BoundaryEdges G Z := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + have hzw : z ≠ w := fun hzw => hwX (hzw ▸ hzX) + exact ⟨z, hzZ, w, fun hw => hwX (Finset.mem_sdiff.mp hw).1, + (Sym2.mem_and_mem_iff hzw).mp + ⟨hBeforeData.1, hEnterData.1⟩⟩ + have heB : e ∈ B := by + apply Finset.mem_filter.mpr + exact ⟨Finset.mem_filter.mpr ⟨heBoundaryZ, heDelta⟩, + w, hwX, hEnterData.1⟩ + rw [hBsingleton] at heB + simpa using heB + have hIndexEq : n - 1 = (D.f0Index d).val := by + have hget : p.getVert (n - 1) = p.getVert (D.f0Index d).val := by + calc + p.getVert (n - 1) = Sum.inr e := hedge + _ = Sum.inr (D.f0 d) := by rw [edge_is_f0] + _ = p.getVert (D.f0Index d).val := (D.f0_at_index d).symm + have hfidxle : (D.f0Index d).val ≤ p.length := by + change (D.f0Index d).val ≤ (D.initialPath d).length + exact Nat.lt_succ_iff.mp (D.f0Index d).isLt + have hnsub : n - 1 ≤ p.length := (Nat.sub_le n 1).trans hnle + exact hpath.getVert_injOn hnsub hfidxle hget + have hnv0 : (D.v0Index d).val < n := by + have hs := (D.successive_indices d).1 + omega + have hnt : n ≤ t := Nat.find_min' hleave hAtT + let rt : Fin (p.length + 1) := ⟨t, by omega⟩ + have hvOutside := D.v0_is_last_tree_vertex d rt (by + change (D.v0Index d).val < t + omega) v + have hrt : p.getVert rt.val = Sum.inl v := by simpa [rt] using ht + exact hvOutside hrt (hUsubX hvU) + +private theorem helper_hKavoidsZ_366.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let U : Finset V := { u0, u1 }; + let Z : Finset V := X \ U; + let _ : DecidablePred fun (f : E) ↦ + ∃ w ∉ X, Incident G w f := fun (x : E) ↦ Classical.propDecidable ((fun (f : E) ↦ + ∃ w ∉ X, Incident G w f) x); + let B : Finset E := {f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f}; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); D.v0 d ∈ Z ∧ y0 ∈ Z ∧ ( + ∀ z ∈ Z, + ∃! f : E, Incident G z f ∧ phi f = some delta) ∧ D.f0 d ∈ B ∧ Odd B.card → B = {D.f0 d} → + IsProperEdgeColoring G phi → ColoredVertexSetClosed G phi X → alpha ∈ MissingColors G phi + y0 → + ∀ (h : E), phi h = some alpha → G.ends h = s(C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex + i (1 : Fin (2 : ℕ))) → u0 ∉ Z → Incident G u0 h → Incident G u1 h → + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha delta; + let I : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl y0); + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl u0); Disjoint K I → + ∀ z ∈ Z, Sum.inl z ∉ K := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i u0 u1 U Z outsideDec B y0 alpha delta hp hBsingleton + hproper hclosed hy0Missing h hhcolor hhends hu0notZ hhInc0 hhInc1 H I K hKI z hzZ hzK + have hzK' : H.connectedComponentMk (Sum.inl z) = + H.connectedComponentMk (Sum.inl u0) := by + exact hzK + have hreach : H.Reachable (Sum.inl u0) (Sum.inl z) := by + exact SimpleGraph.ConnectedComponent.eq.mp hzK'.symm + obtain ⟨p, hpath⟩ := hreach.exists_isPath + have hAtEnd : p.length ≤ p.length ∧ + ∃ q : V, q ∈ Z ∧ p.getVert p.length = Sum.inl q := by + exact ⟨le_rfl, z, hzZ, p.getVert_length⟩ + have henter : ∃ n : ℕ, + n ≤ p.length ∧ ∃ q : V, q ∈ Z ∧ p.getVert n = Sum.inl q := + ⟨p.length, hAtEnd⟩ + let n := Nat.find henter + have hn := Nat.find_spec henter + obtain ⟨hnle, q, hqZ, hnq⟩ := hn + have hnpos : 0 < n := by + by_contra hn0 + have hnzero : n = 0 := by omega + have hnq' : p.getVert n = Sum.inl q := hnq + rw [hnzero, p.getVert_zero] at hnq' + have huq : u0 = q := Sum.inl.inj hnq' + exact hu0notZ (huq ▸ hqZ) + have hnTwo : 2 ≤ n := by + by_contra hntwo + have hnOne : n = 1 := by omega + have hadj := p.adj_getVert_succ (i := 0) (by omega : 0 < p.length) + rw [p.getVert_zero] at hadj + have hgetOne : p.getVert 1 = Sum.inl q := by + have hnq' : p.getVert n = Sum.inl q := hnq + simpa [hnOne] using hnq' + have : H.Adj (Sum.inl u0) (Sum.inl q) := by + simpa [hgetOne] using hadj + simp [H, TwoColorIncidenceGraph] at this + have hadjEnter := p.adj_getVert_succ (i := n - 1) (by omega : n - 1 < p.length) + have hadjBefore := p.adj_getVert_succ (i := n - 2) (by omega : n - 2 < p.length) + have hEnterIndex : n - 1 + 1 = n := by omega + have hBeforeIndex : n - 2 + 1 = n - 1 := by omega + rw [hEnterIndex, hnq] at hadjEnter + cases hedge : p.getVert (n - 1) with + | inl r => + rw [hedge] at hadjEnter + simp [H, TwoColorIncidenceGraph] at hadjEnter + | inr e => + have hEnterData : Incident G q e ∧ + (phi e = some alpha ∨ phi e = some delta) := by + rw [hedge] at hadjEnter + simpa [H, TwoColorIncidenceGraph] using hadjEnter + rw [hBeforeIndex, hedge] at hadjBefore + cases hprev : p.getVert (n - 2) with + | inr g => + rw [hprev] at hadjBefore + simp [H, TwoColorIncidenceGraph] at hadjBefore + | inl w => + have hBeforeData : Incident G w e ∧ + (phi e = some alpha ∨ phi e = some delta) := by + rw [hprev] at hadjBefore + simpa [H, TwoColorIncidenceGraph] using hadjBefore + have hwZ : w ∉ Z := by + intro hwZ + have hEarlier : n - 2 ≤ p.length ∧ + ∃ r : V, r ∈ Z ∧ p.getVert (n - 2) = Sum.inl r := + ⟨by omega, w, hwZ, hprev⟩ + have hmin := Nat.find_min' henter hEarlier + change n ≤ n - 2 at hmin + omega + by_cases hwX : w ∈ X + · have hwU : w ∈ U := by + by_contra hwU + exact hwZ (Finset.mem_sdiff.mpr ⟨hwX, hwU⟩) + rcases hEnterData.2 with heAlpha | heDelta + · have hw0or1 : w = u0 ∨ w = u1 := by simpa [U] using hwU + have hwh : Incident G w h := by + rcases hw0or1 with rfl | rfl + · exact hhInc0 + · exact hhInc1 + have heh : e = h := by + by_contra hne + exact (hproper hne ⟨w, hBeforeData.1, hwh⟩ heAlpha) hhcolor + have hqU : q ∈ U := by + have hqEnds : q ∈ G.ends h := by + rw [← heh] + exact hEnterData.1 + simpa [U, u0, u1, hhends] using hqEnds + exact (Finset.mem_sdiff.mp hqZ).2 hqU + · exact (ScheideDefectiveNoCross G k e0 phi T C D d e heDelta) + ⟨w, hwU, hBeforeData.1, q, hqZ, hEnterData.1⟩ + · rcases hEnterData.2 with heAlpha | heDelta + · have heBoundary : e ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + have hwq : q ≠ w := fun hqw => hwX (hqw ▸ (Finset.mem_sdiff.mp hqZ).1) + exact ⟨q, (Finset.mem_sdiff.mp hqZ).1, w, hwX, + (Sym2.mem_and_mem_iff hwq).mp + ⟨hEnterData.1, hBeforeData.1⟩⟩ + exact hclosed heBoundary (Finset.mem_sdiff.mp hp.2.1).1 + heAlpha hy0Missing + · have heBoundaryZ : e ∈ BoundaryEdges G Z := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + have hqw : q ≠ w := fun hqw => hwX (hqw ▸ (Finset.mem_sdiff.mp hqZ).1) + exact ⟨q, hqZ, w, fun hw => hwX (Finset.mem_sdiff.mp hw).1, + (Sym2.mem_and_mem_iff hqw).mp + ⟨hEnterData.1, hBeforeData.1⟩⟩ + have heB : e ∈ B := by + exact Finset.mem_filter.mpr + ⟨Finset.mem_filter.mpr ⟨heBoundaryZ, heDelta⟩, + w, hwX, hBeforeData.1⟩ + have hef0 : e = D.f0 d := by + rw [hBsingleton] at heB + simpa using heB + have hreachEdge : H.Reachable (Sum.inl u0) (Sum.inr e) := by + have ht := (p.take (n - 1)).reachable + simpa [hedge] using ht + have heK : Sum.inr e ∈ K := by + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk (Sum.inl u0) + exact (SimpleGraph.ConnectedComponent.eq.mpr hreachEdge).symm + have hf0I : Sum.inr (D.f0 d) ∈ I := by + simpa [I, alpha, delta, y0] using D.f0_on_initial_component d + exact (Set.disjoint_left.mp hKI) (hef0 ▸ heK) hf0I + +private theorem helper_tree_edges_outside_K_506.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let U : Finset V := { u0, u1 }; + let Z : Finset V := X \ U; + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); IsOneEdgeUncolored phi e0 → ( + ∀ (a : Fin C.p) (b : Fin (2 : ℕ)), C.y a ≠ C.blockVertex i b) → + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl u0); ( + ∀ {v : V} {e : E}, Sum.inr e ∈ K → Incident G v e → phi e = some alpha ∨ phi e = some delta → + Sum.inl v ∈ K) → ( + ∀ z ∈ Z, Sum.inl z ∉ K) → ( + ∀ {e : E}, Sum.inr e ∈ K → phi e = some alpha ∨ phi e = some delta) → + ∀ (q : Fin T.length), Sum.inr (T.edge q) ∉ K := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i u0 u1 U Z alpha delta hone base_ne_block K + vertex_mem_of_edge hKavoidsZ edge_colors_of_mem_K q hqK + have hcolors := edge_colors_of_mem_K hqK + by_cases hqzero : q.val = 0 + · have hqeq : q = ⟨0, T.positive⟩ := Fin.ext hqzero + have hedge0 : T.edge q = e0 := by simpa [hqeq] using T.first_edge + rcases hcolors with hc | hc <;> rw [hedge0, hone.1] at hc <;> simp at hc + · obtain ⟨a, ha⟩ := T.attaches q + let oldIndex : Fin (T.length + 1) := + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)) + let newVertex := T.vertex q.succ + let oldVertex := T.vertex oldIndex + have hnewX : newVertex ∈ X := by simp [newVertex, X, TreeSequenceVertexSet] + have holdX : oldVertex ∈ X := by simp [oldVertex, X, TreeSequenceVertexSet] + have hnewInc : Incident G newVertex (T.edge q) := by + simp [Incident, newVertex, ha] + have holdInc : Incident G oldVertex (T.edge q) := by + simp [Incident, oldVertex, oldIndex, ha] + have hnewK : Sum.inl newVertex ∈ K := + vertex_mem_of_edge hqK hnewInc hcolors + have holdK : Sum.inl oldVertex ∈ K := + vertex_mem_of_edge hqK holdInc hcolors + have hnewU : newVertex ∈ U := by + by_contra hnU + exact hKavoidsZ newVertex (Finset.mem_sdiff.mpr ⟨hnewX, hnU⟩) hnewK + have holdU : oldVertex ∈ U := by + by_contra hoU + exact hKavoidsZ oldVertex (Finset.mem_sdiff.mpr ⟨holdX, hoU⟩) holdK + have hverticesNe : newVertex ≠ oldVertex := by + intro hv + have hi := T.vertex_injective hv + have hiVal := congrArg Fin.val hi + dsimp [newVertex, oldVertex, oldIndex] at hiVal + have haLt := a.isLt + omega + have hnewCases : newVertex = u0 ∨ newVertex = u1 := by + simpa [U] using hnewU + have holdCases : oldVertex = u0 ∨ oldVertex = u1 := by + simpa [U] using holdU + let pos0 : Fin (T.length + 1) := ⟨C.p + 2 * i.val, by + have hi := i.isLt + have hl := C.length_eq + omega⟩ + let pos1 : Fin (T.length + 1) := ⟨C.p + 2 * i.val + 1, by + have hi := i.isLt + have hl := C.length_eq + omega⟩ + have hpos0 : T.vertex pos0 = u0 := by + simpa [pos0, u0] using C.block_vertex_position i (0 : Fin 2) + have hpos1 : T.vertex pos1 = u1 := by + simpa [pos1, u1] using C.block_vertex_position i (1 : Fin 2) + rcases hnewCases with hnew0 | hnew1 + · have hqpos : q.succ = pos0 := by + apply T.vertex_injective + exact hnew0.trans hpos0.symm + have hold1 : oldVertex = u1 := by + rcases holdCases with hold0 | hold1 + · exact False.elim (hverticesNe (hnew0.trans hold0.symm)) + · exact hold1 + have hapos : oldIndex = pos1 := by + apply T.vertex_injective + exact hold1.trans hpos1.symm + have hqv := congrArg Fin.val hqpos + have hav := congrArg Fin.val hapos + have haLt := a.isLt + dsimp [oldIndex, pos0, pos1] at hqv hav + omega + · have hqpos : q.succ = pos1 := by + apply T.vertex_injective + exact hnew1.trans hpos1.symm + have hold0 : oldVertex = u0 := by + rcases holdCases with hold0 | hold1 + · exact hold0 + · exact False.elim (hverticesNe (hnew1.trans hold1.symm)) + have hqval : q.val = C.p + 2 * i.val := by + have hv := congrArg Fin.val hqpos + dsimp [pos1] at hv + omega + let blockIndex : Fin T.length := ⟨C.p - 1 + 2 * i.val + 1, by + have hi := i.isLt + have hl := C.length_eq + have hp2 := C.p_ge_two + omega⟩ + have hqb : q = blockIndex := by + apply Fin.ext + dsimp [blockIndex] + have hp2 := C.p_ge_two + omega + have hedgeBlock : T.edge q = C.blockEdge i 1 := by + rw [hqb] + simpa [blockIndex] using C.block_edge_position i (1 : Fin 2) + obtain ⟨b, hb⟩ := C.block_attaches_to_base i (1 : Fin 2) + have hyEnds : C.y b ∈ G.ends (T.edge q) := by + rw [hedgeBlock, hb] + simp + rw [ha] at hyEnds + have hyCases : C.y b = newVertex ∨ C.y b = oldVertex := by + simpa [newVertex, oldVertex, oldIndex] using hyEnds + rcases hyCases with hyNew | hyOld + · exact base_ne_block b 1 (hyNew.trans (hnew1.trans rfl)) + · exact base_ne_block b 0 (hyOld.trans (hold0.trans rfl)) + +private theorem helper_htreePsi_732.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl u0); ( + ∀ (q : Fin T.length), Sum.inr (T.edge q) ∉ K) → + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha delta (Sum.inl u0); + alpha ∈ MissingColors G psi y0 → ( + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ delta → (c ∈ MissingColors G psi v ↔ c ∈ MissingColors + G phi v)) → TashkinovTree G e0 psi T := by + classical + intro V E _ _ _ G k e0 phi T C D d i u0 y0 alpha delta K tree_edges_outside_K psi hy0MissingPsi + other_missing q hq + obtain ⟨a, c, hcEdge, hcMissing⟩ := C.globally_maximum.2.1 q hq + have hpsiEdge : psi (T.edge q) = some c := by + simpa [psi, K, TwoColorComponentSwap, tree_edges_outside_K q] using hcEdge + by_cases hca : c = alpha + · subst c + let zero : Fin (q.val + 1) := ⟨0, by omega⟩ + refine ⟨zero, alpha, hpsiEdge, ?_⟩ + have hvertex : T.vertex (Fin.castLT zero + (Nat.lt_trans zero.isLt (Nat.succ_lt_succ q.isLt))) = y0 := by + let vi : Fin (T.length + 1) := Fin.castLT zero + (Nat.lt_trans zero.isLt (Nat.succ_lt_succ q.isLt)) + have hvi : vi = ⟨0, by + have hl := C.length_eq + omega⟩ := Fin.ext rfl + change T.vertex vi = y0 + rw [hvi] + simpa [y0] using C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [hvertex] using hy0MissingPsi + · have hcd : c ≠ delta := by + intro hcd + have hused : delta ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨q, hq, by simpa [hcd] using hcEdge⟩ + exact (Finset.disjoint_left.mp + (ScheideGlobalMaximumUnused G k e0 phi T C.globally_maximum).1) + d.2 hused + refine ⟨a, c, hpsiEdge, ?_⟩ + exact (other_missing _ c hca hcd).mpr hcMissing + +private theorem helper_htreeS_766.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); + ∀ (ell : E), + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha delta (Sum.inl u0); psi + ell = some alpha → alpha ∈ MissingColors G psi y0 → TashkinovTree G e0 psi T → + ∀ (S : TreeSequence G e0), TreeSequenceAdjoinEdge T ell S → TashkinovTree G e0 psi S := by + classical + intro V E _ _ _ G k e0 phi T C D d i u0 y0 alpha delta ell psi hellPsi hy0MissingPsi htreePsi S + hTS + rcases hTS with ⟨hlen, hinitial, hlast⟩ + rcases hinitial with ⟨hle, hvert, hedge⟩ + intro q hq + by_cases hold : q.val < T.length + · let qT : Fin T.length := ⟨q.val, hold⟩ + obtain ⟨a, c, hc, hm⟩ := htreePsi qT (by simpa [qT] using hq) + let aS : Fin (q.val + 1) := ⟨a.val, by simpa [qT] using a.isLt⟩ + refine ⟨aS, c, ?_, ?_⟩ + · have hqeq : Fin.castLE hle qT = q := Fin.ext rfl + rw [← hqeq, hedge] + exact hc + · let oldVertexIndex : Fin (T.length + 1) := + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ qT.isLt)) + let newVertexIndex : Fin (S.length + 1) := + Fin.castLT aS (Nat.lt_trans aS.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) oldVertexIndex = + newVertexIndex := Fin.ext rfl + have hvertex : S.vertex newVertexIndex = T.vertex oldVertexIndex := by + rw [← hindex] + exact hvert oldVertexIndex + simpa [oldVertexIndex, newVertexIndex] using hvertex.symm ▸ hm + · have hqval : q.val = T.length := by + have hqbound : q.val < T.length + 1 := by simpa [hlen] using q.isLt + omega + let zero : Fin (q.val + 1) := ⟨0, by omega⟩ + refine ⟨zero, alpha, ?_, ?_⟩ + · have hqlast : q = Fin.cast hlen.symm (Fin.last T.length) := by + apply Fin.ext + simpa using hqval + rw [hqlast, hlast] + exact hellPsi + · let oldZero : Fin (T.length + 1) := ⟨0, by omega⟩ + let newZero : Fin (S.length + 1) := Fin.castLT zero + (Nat.lt_trans zero.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) oldZero = newZero := + Fin.ext rfl + have hvertex : S.vertex newZero = y0 := by + rw [← hindex, hvert] + simpa [oldZero, y0] using C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [newZero, hvertex] using hy0MissingPsi + +private theorem helper_base_ne_block_716.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + ∀ (a : Fin C.p) (b : Fin (2 : ℕ)), C.y a ≠ C.blockVertex i b := by + classical + intro V E _ _ _ G k e0 phi T C D d i a b hab + let qa : Fin (T.length + 1) := ⟨a.val, by + have ha := a.isLt + have hi := i.isLt + have hb := b.isLt + have hl := C.length_eq + omega⟩ + let qb : Fin (T.length + 1) := ⟨C.p + 2 * i.val + b.val, by + have hi := i.isLt + have hb := b.isLt + have hl := C.length_eq + omega⟩ + have hv : T.vertex qa = T.vertex qb := by + rw [show T.vertex qa = C.y a by + simpa [qa] using C.base_vertex_position a] + rw [show T.vertex qb = C.blockVertex i b by + simpa [qb] using C.block_vertex_position i b] + exact hab + have hq := congrArg Fin.val (T.vertex_injective hv) + have ha := a.isLt + dsimp [qa, qb] at hq + omega + +private theorem helper_other_missing_906.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl u0); + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha delta (Sum.inl u0); + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ delta → (c ∈ MissingColors G psi v ↔ c ∈ + MissingColors G phi v) := by + classical + intro V E _ _ _ G k e0 phi T C D d i u0 alpha delta K psi v c hca hcd + have color_eq : ∀ e : E, psi e = some c ↔ phi e = some c := by + intro e + by_cases heK : Sum.inr e ∈ K + · simp only [psi, K, TwoColorComponentSwap, heK, ite_eq_left] + by_cases hea : phi e = some alpha + · rw [ite_eq_left hea, hea] + simp only [Option.some.injEq] + constructor + · intro hdc + exact False.elim (hcd hdc.symm) + · intro hac + exact False.elim (hca hac.symm) + · by_cases hed : phi e = some delta + · rw [ite_eq_right hea, ite_eq_left hed, hed] + simp only [Option.some.injEq] + constructor + · intro hac + exact False.elim (hca hac.symm) + · intro hdc + exact False.elim (hcd hdc.symm) + · rw [ite_eq_right hea, ite_eq_right hed] + · simp [psi, K, TwoColorComponentSwap, heK] + simp only [MissingColors, PresentColors, Finset.mem_sdiff, + Finset.mem_univ, true_and, Finset.mem_filter] + constructor <;> intro hm hcPresent + · obtain ⟨e, hve, hec⟩ := hcPresent + exact hm ⟨e, hve, (color_eq e).mpr hec⟩ + · obtain ⟨e, hve, hec⟩ := hcPresent + exact hm ⟨e, hve, (color_eq e).mp hec⟩ + +private theorem helper_hBsingleton_734.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let U : Finset V := { u0, u1 }; + let Z : Finset V := X \ U; + let _ : DecidablePred fun (f : E) ↦ + ∃ w ∉ X, Incident G w f := fun (x : E) ↦ Classical.propDecidable ((fun (f : E) ↦ + ∃ w ∉ X, Incident G w f) x); + let B : Finset E := {f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f}; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let delta : Fin k := (↑d : Fin k); D.v0 d ∈ Z ∧ y0 ∈ Z ∧ ( + ∀ z ∈ Z, + ∃! f : E, Incident G z f ∧ phi f = some delta) ∧ D.f0 d ∈ B ∧ Odd B.card → B.card = (1 : ℕ) → + B = {D.f0 d} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i u0 u1 U Z outsideDec B y0 delta hp hBcard + apply Finset.eq_singleton_iff_unique_mem.mpr + refine ⟨hp.2.2.2.1, ?_⟩ + intro f hf + have hsub : {D.f0 d, f} ⊆ B := by + intro e he + simp only [Finset.mem_insert, Finset.mem_singleton] at he + rcases he with rfl | rfl + · exact hp.2.2.2.1 + · exact hf + have hc := Finset.card_le_card hsub + by_contra hne + have : ({D.f0 d, f} : Finset E).card = 2 := by + simp [Ne.symm hne] + omega + +private theorem helper_hu01_771.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); u0 ≠ u1 := by + classical + intro V E _ _ _ G k e0 phi T C D d i u0 u1 hu + let q0 : Fin (T.length + 1) := ⟨C.p + 2 * i.val, by + have hi := i.isLt + have hl := C.length_eq + omega⟩ + let q1 : Fin (T.length + 1) := ⟨C.p + 2 * i.val + 1, by + have hi := i.isLt + have hl := C.length_eq + omega⟩ + have hv : T.vertex q0 = T.vertex q1 := by + rw [show T.vertex q0 = u0 by simpa [q0, u0] using C.block_vertex_position i 0] + rw [show T.vertex q1 = u1 by simpa [q1, u1] using C.block_vertex_position i 1] + exact hu + have := congrArg Fin.val (T.vertex_injective hv) + simp [q0, q1] at this + +private theorem helper_edge_colors_of_mem_K_853.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi alpha delta; + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl u0); + ∀ {e : E}, Sum.inr e ∈ K → phi e = some alpha ∨ phi e = some delta := by + classical + intro V E _ _ _ G k e0 phi T C D d i u0 alpha delta H K e heK + have hsupp : Sum.inr e ∈ H.support := by + apply SimpleGraph.mem_support_of_reachable (G := H) + (u := Sum.inr e) (v := Sum.inl u0) + · simp + · exact SimpleGraph.ConnectedComponent.eq.mp heK + obtain ⟨z, hz⟩ := H.mem_support.mp hsupp + cases z with + | inl v => + have hz' : Incident G v e ∧ + (phi e = some alpha ∨ phi e = some delta) := by + simpa [H, TwoColorIncidenceGraph] using hz + exact hz'.2 + | inr f => + have : False := by simp [H, TwoColorIncidenceGraph] at hz + exact this.elim + +private theorem helper_hxU_895.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let U : Finset V := { u0, u1 }; + let Z : Finset V := X \ U; + let _ : DecidablePred fun (f : E) ↦ + ∃ w ∉ X, Incident G w f := fun (x : E) ↦ Classical.propDecidable ((fun (f : E) ↦ + ∃ w ∉ X, Incident G w f) x); + let B : Finset E := {f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f}; + let delta : Fin k := (↑d : Fin k); B = {D.f0 d} → + ∀ (ell : E), ell ≠ D.f0 d → phi ell = some delta → + ∀ x ∈ X, + ∀ t ∉ X, G.ends ell = s(x, t) → x ∈ U := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i u0 u1 U Z outsideDec B delta hBsingleton ell hellNe + hellColor x hxX t htX hellEnds + by_contra hxU + have hxZ : x ∈ Z := Finset.mem_sdiff.mpr ⟨hxX, hxU⟩ + have hellB : ell ∈ B := by + exact Finset.mem_filter.mpr + ⟨Finset.mem_filter.mpr ⟨(by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨x, hxZ, t, fun htZ => htX (Finset.mem_sdiff.mp htZ).1, + hellEnds⟩), hellColor⟩, t, htX, + by simp [Incident, hellEnds]⟩ + rw [hBsingleton] at hellB + exact hellNe (by simpa using hellB) + +private theorem helper_honePsi_922.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); IsOneEdgeUncolored phi e0 → alpha ≠ delta → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl u0); + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha delta (Sum.inl u0); + IsOneEdgeUncolored psi e0 := by + classical + intro V E _ _ _ G k e0 phi T C D d i u0 alpha delta hone hAlphaDelta K psi + constructor + · simp [psi, TwoColorComponentSwap, hone.1] + · intro e he0 + obtain ⟨c, hc⟩ := hone.2 e he0 + by_cases heK : Sum.inr e ∈ K + · by_cases hca : c = alpha + · refine ⟨delta, ?_⟩ + simp [psi, K, TwoColorComponentSwap, heK, hc, hca] + · by_cases hcd : c = delta + · refine ⟨alpha, ?_⟩ + simp [psi, K, TwoColorComponentSwap, heK, hc, hcd, + hAlphaDelta.symm] + · refine ⟨c, ?_⟩ + simp [psi, K, TwoColorComponentSwap, heK, hc, hca, hcd] + · exact ⟨c, by simpa [psi, K, TwoColorComponentSwap, heK] using hc⟩ + +private theorem helper_missing_fixed_outside_944.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl u0); ( + ∀ {v : V} {e : E}, Sum.inr e ∈ K → Incident G v e → phi e = some alpha ∨ phi e = some delta → + Sum.inl v ∈ K) → ( + ∀ {e : E}, Sum.inr e ∈ K → phi e = some alpha ∨ phi e = some delta) → + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha delta (Sum.inl u0); + ∀ (v : V), Sum.inl v ∉ K → MissingColors G psi v = MissingColors G phi v := by + classical + intro V E _ _ _ G k e0 phi T C D d i u0 alpha delta K vertex_mem_of_edge edge_colors_of_mem_K + psi v hv + have edge_outside : ∀ e : E, Incident G v e → Sum.inr e ∉ K := by + intro e hve heK + exact hv (vertex_mem_of_edge heK hve (edge_colors_of_mem_K heK)) + have present_eq : PresentColors G psi v = PresentColors G phi v := by + ext c + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + constructor + · rintro ⟨e, hve, hc⟩ + refine ⟨e, hve, ?_⟩ + simpa [psi, K, TwoColorComponentSwap, edge_outside e hve] using hc + · rintro ⟨e, hve, hc⟩ + refine ⟨e, hve, ?_⟩ + simpa [psi, K, TwoColorComponentSwap, edge_outside e hve] using hc + simp only [MissingColors] + rw [present_eq] + +private theorem helper_hleOrder_974.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha delta (Sum.inl u0); + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → + ∀ (S : TreeSequence G e0), TashkinovTree G e0 psi S → (TreeSequenceVertexSet S).card ≤ + TashkinovOrder G := by + classical + intro V E _ _ _ G k e0 phi T C D d i u0 alpha delta psi hproperPsi honePsi S htreeS + unfold TashkinovOrder + dsimp + apply Finset.le_max' + exact Finset.mem_insert_of_mem (by + simp only [Finset.mem_filter, Finset.mem_range] + have hk : ChromaticIndex G - 1 = k := by + have hh := C.globally_maximum.1.2.1 + omega + rw [hk] + refine ⟨?_, e0, psi, S, ?_, htreeS, rfl⟩ + · have hV : (TreeSequenceVertexSet S).card ≤ Fintype.card V := by + exact Finset.card_le_card (Finset.subset_univ _) + omega + · exact ⟨C.globally_maximum.1.1, C.globally_maximum.1.2.1, + C.globally_maximum.1.2.2.1, hproperPsi, honePsi⟩) + +private theorem helper_continuation_1038.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let U : Finset V := {u0, u1}; + let Z : Finset V := X \ U; + let _ : DecidablePred fun (f : E) ↦ + ∃ w ∉ X, Incident G w f := fun (x : E) ↦ Classical.propDecidable ((fun (f : E) ↦ + ∃ w ∉ X, Incident G w f) x); + let B : Finset E := {f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f}; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let alpha : Fin k := D.alpha0; + let delta : Fin k := (↑d : Fin k); D.v0 d ∈ Z ∧ y0 ∈ Z ∧ ( + ∀ z ∈ Z, + ∃! f : E, Incident G z f ∧ phi f = some delta) ∧ D.f0 d ∈ B ∧ Odd B.card → B = {D.f0 d} → + IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → ColoredVertexSetClosed G phi X → + alpha ∈ MissingColors G phi y0 → alpha ≠ delta → + ∀ (h : E), phi h = some alpha → G.ends h = s(C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex + i (1 : Fin (2 : ℕ))) → ( + ∀ (a : Fin C.p) (b : Fin (2 : ℕ)), C.y a ≠ C.blockVertex i b) → u0 ∈ U → u0 ∉ Z → Incident G + u0 h → Incident G u1 h → + let I : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl y0); + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha delta (Sum.inl u0); Sum.inl y0 ∈ I → + Sum.inl u0 ∈ K → ( + ∀ {v : V} {e : E}, Sum.inl v ∈ K → Incident G v e → phi e = some alpha ∨ phi e = some delta → + Sum.inr e ∈ K) → ( + ∀ {v : V} {e : E}, Sum.inr e ∈ K → Incident G v e → phi e = some alpha ∨ phi e = some delta → + Sum.inl v ∈ K) → Sum.inl u1 ∈ K → U ⊆ X → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i u0 u1 U Z outsideDec B y0 alpha delta hp hBsingleton + hproper hone hclosed hy0Missing hAlphaDelta h hhcolor hhends base_ne_block hu0U hu0notZ + hhInc0 hhInc1 I K hrootI hrootK edge_mem_of_vertex vertex_mem_of_edge hu1K hUsubX + have initial_avoids_U := @helper_initial_avoids_U_217 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D d hp hBsingleton hproper hclosed hy0Missing h + hhcolor hhends hhInc0 hhInc1 hUsubX + have hu0notI : Sum.inl u0 ∉ I := initial_avoids_U u0 hu0U + have hKI : Disjoint K I := by + rcases TwoColorComponentsDisjoint G phi alpha delta (Sum.inl u0) (Sum.inl y0) with heq | hd + · exfalso + apply hu0notI + have heq' : K = I := by simpa [K, I] using heq + rw [← heq'] + exact hrootK + · exact hd + have hKavoidsZ := @helper_hKavoidsZ_366 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d hp hBsingleton hproper hclosed hy0Missing h hhcolor hhends + hu0notZ hhInc0 hhInc1 hKI + have edge_colors_of_mem_K := @helper_edge_colors_of_mem_K_853 V E inferInstance inferInstance + inferInstance G k e0 phi T C D d + have tree_edges_outside_K := @helper_tree_edges_outside_K_506 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D d hone base_ne_block vertex_mem_of_edge hKavoidsZ + edge_colors_of_mem_K + let BX := BoundaryColorEdges G phi X delta + have hf0BX : D.f0 d ∈ BX := by + apply Finset.mem_filter.mpr + refine ⟨?_, by simpa [delta] using D.f0_color d⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨D.v0 d, (Finset.mem_sdiff.mp hp.1).1, D.u0 d, + by simpa [X] using D.u0_outside d, D.f0_ends d⟩ + have hBXcard : 3 ≤ BX.card := by + simpa [BX, X, delta] using + (ScheideGlobalMaximumBoundaryFacts G k e0 phi T C.globally_maximum).2.2 + delta (by simp [delta]) |>.2 + have hErasePos : 0 < (BX.erase (D.f0 d)).card := by + rw [Finset.card_erase_of_mem hf0BX] + omega + obtain ⟨ell, hellErase⟩ := Finset.card_pos.mp hErasePos + have hellNe : ell ≠ D.f0 d := (Finset.mem_erase.mp hellErase).1 + have hellBX : ell ∈ BX := (Finset.mem_erase.mp hellErase).2 + have hellBoundary : ell ∈ BoundaryEdges G X := + (Finset.mem_filter.mp hellBX).1 + have hellColor : phi ell = some delta := + (Finset.mem_filter.mp hellBX).2 + obtain ⟨x, hxX, t, htX, hellEnds⟩ := by + simpa [BoundaryEdges] using hellBoundary + have hxU := @helper_hxU_895 V E inferInstance inferInstance inferInstance inferInstance G k e0 phi + T C D d hBsingleton ell hellNe hellColor x hxX t htX hellEnds + have hxK : Sum.inl x ∈ K := by + have hxCases : x = u0 ∨ x = u1 := by simpa [U] using hxU + rcases hxCases with rfl | rfl + · exact hrootK + · exact hu1K + have hxInc : Incident G x ell := by simp [Incident, hellEnds] + have hellK : Sum.inr ell ∈ K := + edge_mem_of_vertex hxK hxInc (Or.inr hellColor) + let psi := TwoColorComponentSwap G phi alpha delta (Sum.inl u0) + have hproperPsi : IsProperEdgeColoring G psi := by + simpa [psi, alpha, delta, u0] using + TwoColorComponentSwapProper G phi alpha delta hAlphaDelta hproper + (Sum.inl u0) + have honePsi := @helper_honePsi_922 V E inferInstance inferInstance inferInstance G k e0 phi T C D + d hone hAlphaDelta + have hellPsi : psi ell = some alpha := by + simp [psi, K, TwoColorComponentSwap, hellK, hellColor, + hAlphaDelta.symm] + have hy0notK : Sum.inl y0 ∉ K := by + intro hyK + exact (Set.disjoint_left.mp hKI) hyK hrootI + have missing_fixed_outside := @helper_missing_fixed_outside_944 V E inferInstance inferInstance + inferInstance G k e0 phi T C D d vertex_mem_of_edge edge_colors_of_mem_K + have hy0MissingPsi : alpha ∈ MissingColors G psi y0 := by + rw [missing_fixed_outside y0 hy0notK] + exact hy0Missing + have other_missing := @helper_other_missing_906 V E inferInstance inferInstance inferInstance G k + e0 phi T C D d + have htreePsi := @helper_htreePsi_732 V E inferInstance inferInstance inferInstance G k e0 phi T C + D d tree_edges_outside_K hy0MissingPsi other_missing + obtain ⟨S, hTS⟩ := TreeSequenceBoundaryEdgeAppendExists T ell (by + simpa [X] using hellBoundary) + have htreeS := @helper_htreeS_766 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + ell hellPsi hy0MissingPsi htreePsi S hTS + have hleOrder := @helper_hleOrder_974 V E inferInstance inferInstance inferInstance G k e0 phi T C + D d hproperPsi honePsi S htreeS + have hcardS : (TreeSequenceVertexSet S).card = S.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + S.vertex_injective] + have hcardT : X.card = T.length + 1 := by + simp [X, TreeSequenceVertexSet, Finset.card_image_of_injective, + T.vertex_injective] + have hlen : S.length = T.length + 1 := hTS.1 + have hglobalCard : X.card = TashkinovOrder G := by + simpa [X] using C.globally_maximum.2.2 + rw [hcardS, hlen, ← hglobalCard, hcardT] at hleOrder + omega + +theorem ScheideReplacementBoundaryAtLeastThree {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) : + ∀ d : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) }, + let X := TreeSequenceVertexSet T + let Z := X \ {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} + let B := + @Finset.filter E (fun f => ∃ w, w ∉ X ∧ Incident G w f) + (fun _ => Classical.propDecidable _) (BoundaryColorEdges G phi Z d.1) + 3 ≤ B.card := by + classical + intro d + dsimp only + let X := TreeSequenceVertexSet T + let i := D.gammaIndex d + let u0 := C.blockVertex i 0 + let u1 := C.blockVertex i 1 + let U := ({u0, u1} : Finset V) + let Z := X \ U + let outsideDec : DecidablePred (fun f : E => + ∃ w, w ∉ X ∧ Incident G w f) := + fun _ => Classical.propDecidable _ + let B := (BoundaryColorEdges G phi Z d.1).filter + (fun f => ∃ w, w ∉ X ∧ Incident G w f) + let y0 := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + let alpha := D.alpha0 + let delta := d.1 + change 3 ≤ B.card + have hp0 := ScheideReplacementBoundaryParity G k e0 phi T C D d + have hp : D.v0 d ∈ Z ∧ y0 ∈ Z ∧ + (∀ z ∈ Z, ∃! f : E, Incident G z f ∧ phi f = some delta) ∧ + D.f0 d ∈ B ∧ Odd B.card := by + simpa only [X, i, u0, u1, U, Z, B, y0, delta] using hp0 + by_contra hnot + have hsmall : B.card < 3 := Nat.lt_of_not_ge hnot + have hBcard : B.card = 1 := by + rcases hp.2.2.2.2 with ⟨q, hq⟩ + have hpos : 0 < B.card := Finset.card_pos.mpr ⟨D.f0 d, hp.2.2.2.1⟩ + omega + have hBsingleton := @helper_hBsingleton_734 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d hp hBcard + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := + C.globally_maximum.1.2.2.2.2 + have hclosed : ColoredVertexSetClosed G phi X := + (ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).2.2.2.2 + have hy0Missing : alpha ∈ MissingColors G phi y0 := by + simpa [alpha, y0] using D.alpha0_missing_at_y0 + have hAlphaDelta : alpha ≠ delta := by + intro h + obtain ⟨f, hf, hfc⟩ := hp.2.2.1 y0 hp.2.1 + have hpresent : delta ∈ PresentColors G phi y0 := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hf.1, hf.2⟩ + have : alpha ∉ PresentColors G phi y0 := by + simpa [MissingColors] using hy0Missing + exact this (by simpa [h] using hpresent) + have hAlphaGamma : alpha ≠ C.gamma i := by + simpa [alpha, i] using D.alpha0_not_block i + obtain ⟨h, hhcolor, hhends⟩ := + ScheideStructuralInternalPair G k e0 phi T C i alpha hAlphaGamma + ⟨y0, hp.2.1, hy0Missing⟩ + have hu01 := @helper_hu01_771 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + have hu0X : u0 ∈ X := by + unfold u0 X + rw [← C.block_vertex_position i 0] + simp [TreeSequenceVertexSet] + have hu1X : u1 ∈ X := by + unfold u1 X + rw [← C.block_vertex_position i 1] + simp [TreeSequenceVertexSet] + have base_ne_block := @helper_base_ne_block_716 V E inferInstance inferInstance inferInstance G k + e0 phi T C D d + have hu0U : u0 ∈ U := by simp [U] + have hu1U : u1 ∈ U := by simp [U] + have hu0notZ : u0 ∉ Z := fun hz => (Finset.mem_sdiff.mp hz).2 hu0U + have hu1notZ : u1 ∉ Z := fun hz => (Finset.mem_sdiff.mp hz).2 hu1U + have hhInc0 : Incident G u0 h := by simp [Incident, u0, hhends] + have hhInc1 : Incident G u1 h := by simp [Incident, u1, hhends] + let H := TwoColorIncidenceGraph G phi alpha delta + let I := TwoColorComponent G phi alpha delta (Sum.inl y0) + let K := TwoColorComponent G phi alpha delta (Sum.inl u0) + have hrootI : Sum.inl y0 ∈ I := by + change H.connectedComponentMk (Sum.inl y0) = H.connectedComponentMk (Sum.inl y0) + rfl + have hrootK : Sum.inl u0 ∈ K := by + change H.connectedComponentMk (Sum.inl u0) = H.connectedComponentMk (Sum.inl u0) + rfl + have edge_mem_of_vertex {v : V} {e : E} + (hv : Sum.inl v ∈ K) (hve : Incident G v e) + (hc : phi e = some alpha ∨ phi e = some delta) : Sum.inr e ∈ K := by + have ha : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using ⟨hve, hc⟩ + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk (Sum.inl u0) at hv + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk (Sum.inl u0) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj ha).symm.trans hv + have vertex_mem_of_edge {v : V} {e : E} + (he : Sum.inr e ∈ K) (hve : Incident G v e) + (hc : phi e = some alpha ∨ phi e = some delta) : Sum.inl v ∈ K := by + have ha : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using ⟨hve, hc⟩ + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk (Sum.inl u0) at he + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk (Sum.inl u0) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj ha).trans he + have hhK : Sum.inr h ∈ K := edge_mem_of_vertex hrootK hhInc0 (Or.inl hhcolor) + have hu1K : Sum.inl u1 ∈ K := vertex_mem_of_edge hhK hhInc1 (Or.inl hhcolor) + have hUsubX : U ⊆ X := by + intro v hv + simp only [U, Finset.mem_insert, Finset.mem_singleton] at hv + rcases hv with rfl | rfl + · exact hu0X + · exact hu1X + exact @helper_continuation_1038 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d hp hBsingleton hproper hone hclosed hy0Missing hAlphaDelta h hhcolor hhends + base_ne_block hu0U hu0notZ hhInc0 hhInc1 hrootI hrootK edge_mem_of_vertex + vertex_mem_of_edge hu1K hUsubX +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean new file mode 100644 index 0000000000..ba61c46ba3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean @@ -0,0 +1,747 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryParity +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Replacement Boundary At Most Three + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hout_ne_132.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; + ∀ (g1 g2 : E), g2 ≠ g1 → (g1 ∈ BoundaryColorEdges G phi Z (↑d : Fin k) ∧ + ∃ w ∉ X, Incident G w g1) → (g2 ∈ BoundaryColorEdges G phi Z (↑d : Fin k) ∧ + ∃ w ∉ X, Incident G w g2) → + ∀ (w1 : V), Incident G w1 g1 → + ∀ (w2 : V), Incident G w2 g2 → IsProperEdgeColoring G phi → w1 ≠ w2 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X U Z g1 g2 hg2g1 hg1data hg2data w1 hw1g w2 hw2g hproper h + have hadj : AdjacentEdges G g1 g2 := ⟨w1, hw1g, by simpa [h] using hw2g⟩ + have hfc : phi g1 = some d.1 := by + exact (Finset.mem_filter.mp hg1data.1).2 + have hgc : phi g2 = some d.1 := by + exact (Finset.mem_filter.mp hg2data.1).2 + exact hproper (Ne.symm hg2g1) hadj hfc hgc + +private theorem helper_hdeltaNotMissing_146.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (_ : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + ∀ (_ _ : E) (_ : TreeSequence G e0), + ∀ v ∈ X, (↑d : Fin k) ∉ MissingColors G phi v := by + classical + intro V E _ _ _ G k e0 phi T C D d X g1 g2 S v hv hm + have hclosed : ColoredVertexSetClosed G phi X := + (ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).2.2.2.2 + obtain ⟨b, hb⟩ := Finset.card_pos.mp (show 0 < (BoundaryColorEdges G phi X d.1).card by + have hd := d.2 + change d.1 ∈ Finset.univ.filter (fun c => DefectiveColor G phi X c) at hd + have := (Finset.mem_filter.mp hd).2 + change 2 ≤ (BoundaryColorEdges G phi X d.1).card at this + omega) + exact hclosed (Finset.mem_filter.mp hb).1 hv (Finset.mem_filter.mp hb).2 hm + +private theorem helper_tree_edge_incident_157.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] + (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) (q : Fin T.length), + TreeIncidentEdge T (T.edge q) := by + classical + intro V E _ _ G e0 T q + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨a, ha⟩ := T.attaches q + refine ⟨T.vertex q.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · simp [Incident, ha] + +private theorem helper_edge_color_D_163.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → f ≠ D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) → + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); ( + ∀ (q : Fin T.length), TreeIncidentEdge T (T.edge q)) → + ∀ (q : Fin T.length) (c : Fin k), phi (T.edge q) = some c → phiD (T.edge q) = some c := by + classical + intro V E _ _ _ G k e0 phi T C D d hfixD phiD tree_edge_incident q c hc + have hf := hfixD (T.edge q) (tree_edge_incident q) + calc + phiD (T.edge q) = phi (T.edge q) := by + apply hf + intro he + obtain ⟨a, ha⟩ := T.attaches q + have hu : D.u0 d ∈ G.ends (T.edge q) := by + rw [he, D.f0_ends] + simp + rw [ha] at hu + rcases Sym2.mem_iff.mp hu with hu | hu + · exact D.u0_outside d (by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨q.succ, hu.symm⟩) + · exact D.u0_outside d (by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)), hu.symm⟩) + _ = some c := hc + +private theorem helper_missing_unaffected_183.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; MissingColors G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (D.v0 d) = (insert (↑d : Fin + k) ((MissingColors G phi (D.v0 d)).erase (C.gamma (D.gammaIndex d))) : Finset (Fin k)) → ( + ∀ v ∈ TreeSequenceVertexSet T, v ≠ D.v0 d → MissingColors G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) → + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); + ∀ v ∈ X, + ∀ (c : Fin k), c ≠ C.gamma (D.gammaIndex d) → c ≠ (↑d : Fin k) → (c ∈ MissingColors G phiD v ↔ + c ∈ MissingColors G phi v) := by + classical + intro V E _ _ _ G k e0 phi T C D d X hmissD htreeD phiD v hv c hc hd + by_cases hv0 : v = D.v0 d + · subst v + rw [hmissD] + simp [hc, hd] + · rw [htreeD v hv hv0] + +private theorem helper_htreeS_191.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + ∀ (_ _ : E), + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); + ∀ (S : TreeSequence G e0), S.length + (2 : ℕ) = T.length → ( + ∀ (a : Fin C.p), + ∃ (q : Fin (S.length + (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ S.vertex q = C.y a) → ( + ∀ (q : Fin S.length), ( + ∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ S.edge q = C.baseEdge a) ∨ + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), r ≠ D.gammaIndex d ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ S.edge q = + C.blockEdge r j) → TashkinovTree G e0 phi T → Disjoint (DefectiveColors G phi + (TreeSequenceVertexSet T)) (TreeUsedColors phi T) ∧ Disjoint (TreeFreeColors phi T) + (TreeUsedColors phi T) → ( + ∀ v ∈ X, (↑d : Fin k) ∉ MissingColors G phi v) → ( + ∀ (q : Fin T.length) (c : Fin k), phi (T.edge q) = some c → phiD (T.edge q) = some c) → ( + ∀ v ∈ X, + ∀ (c : Fin k), c ≠ C.gamma (D.gammaIndex d) → c ≠ (↑d : Fin k) → (c ∈ MissingColors G phiD v ↔ + c ∈ MissingColors G phi v)) → TashkinovTree G e0 phiD S := by + classical + intro V E _ _ _ G k e0 phi T C D d X g1 g2 phiD S hSlength hbaseVertices hedgeCases htreeOld + hunused hdeltaNotMissing edge_color_D missing_unaffected q hq + rcases hedgeCases q with ⟨a, hqa, hqe⟩ | ⟨r, j, hri, hqbase, hqe⟩ + · have haPos : 1 ≤ a.val := by omega + have hlen := C.length_eq + have hi := (D.gammaIndex d).isLt + let oldq : Fin T.length := ⟨a.val, by omega⟩ + obtain ⟨b, c, hc, hm⟩ := htreeOld oldq haPos + have ha := a.isLt + have hb := b.isLt + have hb0 : b.val < oldq.val + 1 := hb + have hbP : b.val < C.p := by + have haP : a.val < C.p - 1 := a.isLt + change b.val < a.val + 1 at hb0 + omega + let bp : Fin C.p := ⟨b.val, hbP⟩ + obtain ⟨bs, hbsval, hbs⟩ := hbaseVertices bp + have hl := C.length_eq + have hq := q.isLt + let bn : Fin (q.val + 1) := ⟨b.val, by + have hb := b.isLt + have hqa' : q.val = a.val := hqa + change b.val < a.val + 1 at hb + omega⟩ + have hcast : Fin.castLT bn + (Nat.lt_trans bn.isLt (Nat.succ_lt_succ q.isLt)) = bs := by + apply Fin.ext + simpa [bn] using hbsval.symm + have holdedge : T.edge oldq = C.baseEdge a := by + simpa [oldq] using C.base_edge_position a + have hcbase : phi (C.baseEdge a) = some c := holdedge ▸ hc + have hcGamma : c ≠ C.gamma (D.gammaIndex d) := by + simpa using C.initial_nonfirst_avoids_blocks a haPos c hcbase (D.gammaIndex d) + have hcDelta : c ≠ d.1 := by + intro heq + exact (Finset.disjoint_left.mp hunused.1) d.2 (heq ▸ (by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨oldq, haPos, hc⟩)) + refine ⟨bn, c, ?_, ?_⟩ + · rw [hqe, ← holdedge] + exact edge_color_D oldq c hc + · rw [hcast, hbs] + have hvbpX : C.y bp ∈ X := by + rw [← C.base_vertex_position bp] + simp [X, TreeSequenceVertexSet] + have holdvertex : T.vertex + (Fin.castLT b (Nat.lt_trans b.isLt (Nat.succ_lt_succ oldq.isLt))) = C.y bp := by + have hi : Fin.castLT b (Nat.lt_trans b.isLt (Nat.succ_lt_succ oldq.isLt)) = + (⟨bp.val, by omega⟩ : Fin (T.length + 1)) := by apply Fin.ext; rfl + rw [hi] + exact C.base_vertex_position bp + apply (missing_unaffected (C.y bp) hvbpX c hcGamma hcDelta).mpr + simpa [holdvertex] using hm + · obtain ⟨b, hbmissing⟩ := C.block_color_missing_on_base r + obtain ⟨bs, hbsval, hbs⟩ := hbaseVertices b + let bn : Fin (q.val + 1) := ⟨b.val, by omega⟩ + have hcast : Fin.castLT bn (Nat.lt_trans bn.isLt (Nat.succ_lt_succ q.isLt)) = bs := by + apply Fin.ext + simpa [bn] using hbsval.symm + have hrgamma : C.gamma r ≠ C.gamma (D.gammaIndex d) := by + intro h + exact hri (C.gamma_injective (by simpa using h)) + have hrdelta : C.gamma r ≠ d.1 := by + intro h + apply hdeltaNotMissing (C.y b) + · rw [← C.base_vertex_position b] + simp [X, TreeSequenceVertexSet] + · exact h ▸ hbmissing + let oldq : Fin T.length := ⟨C.p - 1 + 2 * r.val + j.val, by + have hl := C.length_eq + omega⟩ + have holdedge : T.edge oldq = C.blockEdge r j := by + simpa [oldq] using C.block_edge_position r j + have hcold : phi (T.edge oldq) = some (C.gamma r) := by + rw [holdedge] + exact C.block_color r j + refine ⟨bn, C.gamma r, ?_, ?_⟩ + · rw [hqe, ← holdedge] + exact edge_color_D oldq (C.gamma r) hcold + · rw [hcast, hbs] + exact (missing_unaffected (C.y b) (by + rw [← C.base_vertex_position b] + simp [X, TreeSequenceVertexSet]) (C.gamma r) hrgamma hrdelta).mpr hbmissing + +private theorem helper_adjoin_set_312.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (_ : ScheideDefectiveSetup G k e0 phi + T C) (_ : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (_ _ : E) (_ A B : + TreeSequence G e0) (f : E) (x y : V), G.ends f = s(x, y) → y ∉ TreeSequenceVertexSet A → + TreeSequenceAdjoinEdge A f B → TreeSequenceVertexSet B = (insert y (TreeSequenceVertexSet + A) : Finset V) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d g1 g2 S A B f x y hxy hy hab + rcases hab with ⟨hlen, hinit, hlast⟩ + have sub : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + obtain ⟨i, hi⟩ := hv + exact ⟨Fin.castLE (Nat.succ_le_succ hinit.1) i, hinit.2.1 i ▸ hi⟩ + have hyB : y ∈ TreeSequenceVertexSet B := by + let j : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨i, hi⟩ := B.attaches j + have hm : y ∈ G.ends (B.edge j) := by rw [hlast, hxy]; simp + rw [hi] at hm + rcases (by simpa only [Sym2.mem_iff] using hm) with hm | hm + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and]; exact + ⟨j.succ, hm.symm⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)), hm.symm⟩ + apply (Finset.eq_of_subset_of_card_le ?_ ?_).symm + · intro v hv + rcases Finset.mem_insert.mp hv with rfl | hv + · exact hyB + · exact sub hv + · have hy' : y ∉ Finset.image A.vertex Finset.univ := by + simpa [TreeSequenceVertexSet] using hy + have hca : (TreeSequenceVertexSet A).card = A.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, A.vertex_injective] + have hcb : (TreeSequenceVertexSet B).card = B.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, B.vertex_injective] + rw [hcb] + rw [Finset.card_insert_of_notMem hy] + rw [hca] + omega + +private theorem helper_htreeS2_381.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; + ∀ (g2 : E), g2 ≠ D.f0 d → ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → f ≠ D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) → + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); (g2 ∈ BoundaryColorEdges G phi Z (↑d : Fin k) ∧ + ∃ w ∉ X, Incident G w g2) → + ∀ z2 ∈ Z, + ∀ (w2 : V), G.ends g2 = s(z2, w2) → + ∀ (S1 : TreeSequence G e0), TashkinovTree G e0 phiD S1 → + ∀ (S2 : TreeSequence G e0), TreeSequenceAdjoinEdge S1 g2 S2 → (↑d : Fin k) ∈ TreeMissingColors + phiD S1 → TashkinovTree G e0 phiD S2 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X U Z g2 hg2f0 hfixD phiD hg2data z2 hz2Z w2 he2 S1 + htreeS1 S2 hS2 d_missing_S1 + apply TashkinovAugmentationSequencePreservesTashkinovTree G e0 phiD S1 S2 htreeS1 + rcases hS2 with ⟨hlen, hinit, hlast⟩ + exact Relation.ReflTransGen.single ⟨hlen, hinit, d.1, + (congrArg phiD hlast).trans (by + have hf := hfixD g2 + (show ∃ v ∈ TreeSequenceVertexSet T, Incident G v g2 from + ⟨z2, (Finset.mem_sdiff.mp hz2Z).1, by + change z2 ∈ G.ends g2 + rw [he2] + simp⟩) hg2f0 + calc + phiD g2 = phi g2 := by simpa [phiD] using hf + _ = some d.1 := (Finset.mem_filter.mp hg2data.1).2), + d_missing_S1⟩ + +private theorem helper_hw3S2_399.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) (e0 : E) (w1 w2 + w3 : V) (S S1 : TreeSequence G e0), w3 ∉ TreeSequenceVertexSet S → w1 ≠ w3 → w3 ≠ w2 → + TreeSequenceVertexSet S1 = (insert w1 (TreeSequenceVertexSet S) : Finset V) → + ∀ (S2 : TreeSequence G e0), TreeSequenceVertexSet S2 = (insert w2 (TreeSequenceVertexSet S1) : + Finset V) → w3 ∉ TreeSequenceVertexSet S2 := by + classical + intro V E _ G e0 w1 w2 w3 S S1 hw3S hout_ne13 hout_ne23 hS1set S2 hS2set + rw [hS2set] + simp only [Finset.mem_insert, not_or] + exact ⟨hout_ne23, by + intro h + rw [hS1set] at h + rcases Finset.mem_insert.mp h with h | h + · exact hout_ne13.symm h + · exact hw3S h⟩ + +private theorem helper_htreeS3_424.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; + ∀ (g3 : E), g3 ≠ D.f0 d → ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → f ≠ D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) → + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); (g3 ∈ BoundaryColorEdges G phi Z (↑d : Fin k) ∧ + ∃ w ∉ X, Incident G w g3) → + ∀ z3 ∈ Z, + ∀ (w3 : V), G.ends g3 = s(z3, w3) → + ∀ (S2 : TreeSequence G e0), TashkinovTree G e0 phiD S2 → (↑d : Fin k) ∈ TreeMissingColors phiD + S2 → + ∀ (S3 : TreeSequence G e0), TreeSequenceAdjoinEdge S2 g3 S3 → TashkinovTree G e0 phiD S3 := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X U Z g3 hg3f0 hfixD phiD hg3data z3 hz3Z w3 he3 S2 + htreeS2 d_missing_S2 S3 hS3 + apply TashkinovAugmentationSequencePreservesTashkinovTree G e0 phiD S2 S3 htreeS2 + rcases hS3 with ⟨hlen, hinit, hlast⟩ + exact Relation.ReflTransGen.single ⟨hlen, hinit, d.1, + (congrArg phiD hlast).trans (by + have hf := hfixD g3 + (show ∃ v ∈ TreeSequenceVertexSet T, Incident G v g3 from + ⟨z3, (Finset.mem_sdiff.mp hz3Z).1, by + change z3 ∈ G.ends g3 + rw [he3] + simp⟩) hg3f0 + calc + phiD g3 = phi g3 := by simpa [phiD] using hf + _ = some d.1 := (Finset.mem_filter.mp hg3data.1).2), + d_missing_S2⟩ + +private theorem helper_hle_439.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (_ _ : E), + IsProperEdgeColoring G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin + k) (Sum.inl (D.v0 d))) → IsOneEdgeUncolored (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) e0 → + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); + ∀ (_ S3 : TreeSequence G e0), TashkinovTree G e0 phiD S3 → (TreeSequenceVertexSet S3).card ≤ + TashkinovOrder G := by + classical + intro V E _ _ _ G k e0 phi T C D d g1 g2 hproperD honeD phiD S S3 htreeS3 + unfold TashkinovOrder + dsimp + apply Finset.le_max' + exact Finset.mem_insert_of_mem (by + simp only [Finset.mem_filter, Finset.mem_range] + have hk : ChromaticIndex G - 1 = k := by + have hh := C.globally_maximum.1.2.1 + omega + rw [hk] + refine ⟨?_, e0, phiD, S3, ?_, htreeS3, rfl⟩ + · have hV : (TreeSequenceVertexSet S3).card ≤ Fintype.card V := by + simpa using Finset.card_le_card (Finset.subset_univ (TreeSequenceVertexSet S3)) + omega + · exact ⟨C.globally_maximum.1.1, C.globally_maximum.1.2.1, + C.globally_maximum.1.2.2.1, hproperD, honeD⟩) + +private theorem helper_continuation_668.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))), + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; + let B : Finset E := ({f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f} : Finset E); + ∀ (_ : D.v0 d ∈ Z ∧ C.y (⟨(0 : ℕ), + by + first + | omega + | ( have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.ScheideStructuralConfiguration.p_ge_two + (ScheideReducedConfiguration.toScheideStructuralConfiguration + C) + + all_goals omega) + ⟩ : Fin C.p) ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ))) ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V) ∧ ( + ∀ z ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V), + ∃! f : E, Incident G z f ∧ phi f = some (↑d : Fin k)) ∧ D.f0 d ∈ B ∧ Odd B.card) (g1 g2 : E) + (_ : g2 ≠ D.f0 d) (g3 : E) (_ : g3 ≠ D.f0 d) (_ : g3 ≠ g1) (_ : g3 ≠ g2) (_ : + IsProperEdgeColoring G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin + k) (Sum.inl (D.v0 d)))) (_ : IsOneEdgeUncolored (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) e0) (_ : MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (D.v0 d) = (insert (↑d : Fin k) ((MissingColors G phi (D.v0 d)).erase (C.gamma + (D.gammaIndex d))) : Finset (Fin k))) (_ : + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → f ≠ D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f), + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)); + ∀ (_ : g1 ∈ BoundaryColorEdges G phi Z (↑d : Fin k) ∧ + ∃ w ∉ X, Incident G w g1) (_ : g2 ∈ BoundaryColorEdges G phi Z (↑d : Fin k) ∧ + ∃ w ∉ X, Incident G w g2) (_ : g3 ∈ BoundaryColorEdges G phi Z (↑d : Fin k) ∧ + ∃ w ∉ X, Incident G w g3) (z1 z2 : V) (_ : z2 ∈ Z) (z3 : V) (_ : z3 ∈ Z) (w1 : V) (_ : w1 ∉ X) + (_ : Incident G w1 g1) (w2 : V) (_ : w2 ∉ X) (_ : Incident G w2 g2) (w3 : V) (_ : w3 ∉ X) + (_ : Incident G w3 g3) (_ : G.ends g1 = s(z1, w1)) (_ : G.ends g2 = s(z2, w2)) (_ : G.ends + g3 = s(z3, w3)) (_ : IsProperEdgeColoring G phi) (_ : w1 ≠ w2) (S : TreeSequence G e0) (_ + : TreeSequenceVertexSet S = TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex + d) (0 : Fin (2 : ℕ))) ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : + Finset V)) (_ : S.length + (2 : ℕ) = T.length) (_ : z1 ∈ TreeSequenceVertexSet S) (_ : z2 + ∈ TreeSequenceVertexSet S) (_ : z3 ∈ TreeSequenceVertexSet S) (_ : + ∃ (S1 : TreeSequence G e0), TreeSequenceAdjoinEdge S g1 S1 ∧ TashkinovTree G e0 phiD S1), + False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X U Z B hp g1 g2 hg2f0 g3 hg3f0 hg3g1 hg3g2 hproperD honeD + hmissD hfixD phiD hg1data hg2data hg3data z1 z2 hz2Z z3 hz3Z w1 hw1X hw1g w2 hw2X hw2g w3 + hw3X hw3g he1 he2 he3 hproper hout_ne S hSvertices hSlength hz1S hz2S hz3S htreeS1 + rcases htreeS1 with ⟨S1, hS1, htreeS1⟩ + have adjoin_set (A B : TreeSequence G e0) (f : E) (x y : V) + (hxy : G.ends f = s(x,y)) (hx : x ∈ TreeSequenceVertexSet A) + (hy : y ∉ TreeSequenceVertexSet A) (hab : TreeSequenceAdjoinEdge A f B) : + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by + apply helper_adjoin_set_312 <;> assumption + have hw1S : w1 ∉ TreeSequenceVertexSet S := by + rw [hSvertices]; exact fun h => hw1X ((Finset.mem_sdiff.mp h).1) + have hw2S : w2 ∉ TreeSequenceVertexSet S := by + rw [hSvertices]; exact fun h => hw2X ((Finset.mem_sdiff.mp h).1) + have hw3S : w3 ∉ TreeSequenceVertexSet S := by + rw [hSvertices]; exact fun h => hw3X ((Finset.mem_sdiff.mp h).1) + have hout_ne13 : w1 ≠ w3 := by + intro h + have hadj : AdjacentEdges G g1 g3 := ⟨w1, hw1g, by simpa [h] using hw3g⟩ + exact hproper (Ne.symm hg3g1) hadj + (Finset.mem_filter.mp hg1data.1).2 (Finset.mem_filter.mp hg3data.1).2 + have hout_ne23 : w3 ≠ w2 := by + intro h + have hadj : AdjacentEdges G g3 g2 := ⟨w3, hw3g, by simpa [h] using hw2g⟩ + exact hproper hg3g2 hadj + (Finset.mem_filter.mp hg3data.1).2 (Finset.mem_filter.mp hg2data.1).2 + have hS1set : TreeSequenceVertexSet S1 = insert w1 (TreeSequenceVertexSet S) := + adjoin_set S S1 g1 z1 w1 he1 hz1S hw1S hS1 + obtain ⟨S2, hS2⟩ := TreeSequenceBoundaryEdgeAppendExists S1 g2 (by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨z2, by rw [hS1set]; exact Finset.mem_insert_of_mem hz2S, + w2, by rw [hS1set]; simp [hw2S, hout_ne.symm], he2⟩) + have hS2set : TreeSequenceVertexSet S2 = insert w2 (TreeSequenceVertexSet S1) := + adjoin_set S1 S2 g2 z2 w2 he2 (by + rw [hS1set] + exact Finset.mem_insert_of_mem hz2S) (by + rw [hS1set] + simp [hw2S, hout_ne.symm]) hS2 + have d_missing_S1 : d.1 ∈ TreeMissingColors phiD S1 := by + rw [TreeMissingColors] + refine Finset.mem_biUnion.mpr ⟨D.v0 d, ?_, ?_⟩ + · rw [hS1set] + exact Finset.mem_insert_of_mem (by rw [hSvertices]; exact hp.1) + · rw [hmissD] + simp + have htreeS2 := @helper_htreeS2_381 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@g2) (@hg2f0) (@hfixD) (@hg2data) + (@z2) (@hz2Z) (@w2) (@he2) (@S1) (@htreeS1) (@S2) (@hS2) (@d_missing_S1) + have hw1S2 : w1 ∈ TreeSequenceVertexSet S2 := by + rw [hS2set] + exact Finset.mem_insert_of_mem (by rw [hS1set]; simp [hw1S]) + have hw3S2 : w3 ∉ TreeSequenceVertexSet S2 := by + apply helper_hw3S2_399 <;> assumption + have hz3S2 : z3 ∈ TreeSequenceVertexSet S2 := by + rw [hS2set] + exact Finset.mem_insert_of_mem (by + rw [hS1set] + exact Finset.mem_insert_of_mem hz3S) + have d_missing_S2 : d.1 ∈ TreeMissingColors phiD S2 := by + rw [TreeMissingColors] + refine Finset.mem_biUnion.mpr ⟨D.v0 d, ?_, ?_⟩ + · rw [hS2set, hS1set] + exact Finset.mem_insert_of_mem (Finset.mem_insert_of_mem (by rw [hSvertices]; exact hp.1)) + · rw [hmissD] + simp + obtain ⟨S3, hS3⟩ := TreeSequenceBoundaryEdgeAppendExists S2 g3 (by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + using (show ∃ u ∈ TreeSequenceVertexSet S2, ∃ v ∉ TreeSequenceVertexSet S2, + G.ends g3 = s(u, v) from ⟨z3, hz3S2, w3, hw3S2, he3⟩)) + have htreeS3 : TashkinovTree G e0 phiD S3 := by + apply helper_htreeS3_424 <;> assumption + have hle : (TreeSequenceVertexSet S3).card ≤ TashkinovOrder G := by + apply helper_hle_439 <;> assumption + have hcardS3 : (TreeSequenceVertexSet S3).card = S3.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, S3.vertex_injective] + have hcardS : (TreeSequenceVertexSet S).card = S.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, S.vertex_injective] + have hcardT : (TreeSequenceVertexSet T).card = T.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, T.vertex_injective] + rcases hS1 with ⟨hl1, hi1, he1'⟩ + rcases hS2 with ⟨hl2, hi2, he2'⟩ + rcases hS3 with ⟨hl3, hi3, he3'⟩ + rw [hcardS3] at hle + have horder : TashkinovOrder G = S.length + 3 := by + rw [(ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).1, hcardT] + omega + rw [horder] at hle + omega + +theorem ScheideReplacementBoundaryAtMostThree {V E : Type*} + [vertexFinite : Fintype V] [edgeFinite : Fintype E] [vertexEquality : DecidableEq V] + [edgeEquality : DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) : + ∀ d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}, + let X := TreeSequenceVertexSet T + let Z := X \ {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} + let B := @Finset.filter E (fun f => ∃ w, w ∉ X ∧ Incident G w f) + (fun _ => Classical.propDecidable _) (BoundaryColorEdges G phi Z d.1) + B.card ≤ 3 := by + classical + intro d + dsimp + let X := TreeSequenceVertexSet T + let U := ({C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} : Finset V) + let Z := X \ U + let B := @Finset.filter E (fun f => ∃ w, w ∉ X ∧ Incident G w f) + (fun _ => Classical.propDecidable _) (BoundaryColorEdges G phi Z d.1) + have hp := ScheideReplacementBoundaryParity G k e0 phi T C D d + change D.v0 d ∈ Z ∧ _ ∧ _ ∧ D.f0 d ∈ B ∧ Odd B.card at hp + by_contra hbad + have hlarge : 5 ≤ B.card := by + have hodd := hp.2.2.2.2 + rcases hodd with ⟨n, hn⟩ + have hgt : 3 < B.card := Nat.lt_of_not_ge hbad + omega + have hrest : 4 ≤ (B.erase (D.f0 d)).card := by + rw [Finset.card_erase_of_mem hp.2.2.2.1] + omega + obtain ⟨g1, hg1⟩ := Finset.card_pos.mp (Nat.zero_lt_of_lt hrest) + have hg1f0 : g1 ≠ D.f0 d := (Finset.mem_erase.mp hg1).1 + have hg1B : g1 ∈ B := by + exact Finset.mem_of_mem_erase hg1 + have hrest1 : 3 ≤ ((B.erase (D.f0 d)).erase g1).card := by + rw [Finset.card_erase_of_mem hg1] + omega + obtain ⟨g2, hg2⟩ := Finset.card_pos.mp (Nat.zero_lt_of_lt hrest1) + have hg2B : g2 ∈ B := Finset.mem_of_mem_erase (Finset.mem_of_mem_erase hg2) + have hg2f0 : g2 ≠ D.f0 d := by + intro h + exact (Finset.mem_erase.mp (Finset.mem_of_mem_erase hg2)).1 h + have hg2g1 : g2 ≠ g1 := (Finset.mem_erase.mp hg2).1 + have hrest2 : 2 ≤ (((B.erase (D.f0 d)).erase g1).erase g2).card := by + rw [Finset.card_erase_of_mem hg2] + omega + obtain ⟨g3, hg3⟩ := Finset.card_pos.mp (Nat.zero_lt_of_lt hrest2) + have hg3B : g3 ∈ B := Finset.mem_of_mem_erase (Finset.mem_of_mem_erase + (Finset.mem_of_mem_erase hg3)) + have hg3f0 : g3 ≠ D.f0 d := by + intro h + exact (Finset.mem_erase.mp (Finset.mem_of_mem_erase + (Finset.mem_of_mem_erase hg3))).1 h + have hg3g1 : g3 ≠ g1 := by + intro h + exact (Finset.mem_erase.mp (Finset.mem_of_mem_erase hg3)).1 h + have hg3g2 : g3 ≠ g2 := (Finset.mem_erase.mp hg3).1 + have hswitch := ScheideDefectiveSwitchEffect G k e0 phi T C D d + rcases hswitch with ⟨hproperD, honeD, hf0D, hmissD, hfixD, htreeD, hcompD⟩ + let phiD := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) + have hg1data : g1 ∈ BoundaryColorEdges G phi Z d.1 ∧ ∃ w, w ∉ X ∧ Incident G w g1 := by simpa + [B] using hg1B + have hg2data : g2 ∈ BoundaryColorEdges G phi Z d.1 ∧ ∃ w, w ∉ X ∧ Incident G w g2 := by simpa + [B] using hg2B + have hg3data : g3 ∈ BoundaryColorEdges G phi Z d.1 ∧ ∃ w, w ∉ X ∧ Incident G w g3 := by simpa + [B] using hg3B + have hB1 : g1 ∈ BoundaryEdges G Z := (Finset.mem_filter.mp hg1data.1).1 + have hB2 : g2 ∈ BoundaryEdges G Z := (Finset.mem_filter.mp hg2data.1).1 + have hB3 : g3 ∈ BoundaryEdges G Z := (Finset.mem_filter.mp hg3data.1).1 + obtain ⟨z1, hz1Z, wz1, hwz1Z, hez1⟩ := by simpa [BoundaryEdges] using hB1 + obtain ⟨z2, hz2Z, wz2, hwz2Z, hez2⟩ := by simpa [BoundaryEdges] using hB2 + obtain ⟨z3, hz3Z, wz3, hwz3Z, hez3⟩ := by simpa [BoundaryEdges] using hB3 + obtain ⟨w1, hw1X, hw1g⟩ := hg1data.2 + obtain ⟨w2, hw2X, hw2g⟩ := hg2data.2 + obtain ⟨w3, hw3X, hw3g⟩ := hg3data.2 + have pair_end : ∀ {a b : V} {f : E}, a ∈ G.ends f → b ∈ G.ends f → a ≠ b → + G.ends f = s(a,b) := by + intro a b f ha hb hab + exact (Sym2.mem_and_mem_iff hab).mp ⟨ha, hb⟩ + have he1 : G.ends g1 = s(z1,w1) := by + apply pair_end + · rw [hez1]; simp + · exact hw1g + · intro h; exact hw1X (h ▸ (Finset.mem_sdiff.mp hz1Z).1) + have he2 : G.ends g2 = s(z2,w2) := by + apply pair_end + · rw [hez2]; simp + · exact hw2g + · intro h; exact hw2X (h ▸ (Finset.mem_sdiff.mp hz2Z).1) + have he3 : G.ends g3 = s(z3,w3) := by + apply pair_end + · rw [hez3]; simp + · exact hw3g + · intro h; exact hw3X (h ▸ (Finset.mem_sdiff.mp hz3Z).1) + have hproper : IsProperEdgeColoring G phi := C.globally_maximum.1.2.2.2.1 + have hout_ne := @helper_hout_ne_132 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@g1) (@g2) (@hg2g1) (@hg1data) + (@hg2data) (@w1) (@hw1g) (@w2) (@hw2g) (@hproper) + have hdel := ScheideSelectedBlockDeletion G k e0 phi T C (D.gammaIndex d) + rcases hdel with ⟨S, hSvertices, hSlength, hvertexReindex, hedgeReindex, + hbaseVertices, hbaseEdges, hblockEntries, hedgeCases, hedgeOld, + hnotIncident⟩ + have htreeOld : TashkinovTree G e0 phi T := C.globally_maximum.2.1 + have hunused := ScheideGlobalMaximumUnused G k e0 phi T C.globally_maximum + have hdeltaNotMissing : ∀ v, v ∈ X → d.1 ∉ MissingColors G phi v := by + apply helper_hdeltaNotMissing_146 <;> assumption + have tree_edge_incident : ∀ q : Fin T.length, TreeIncidentEdge T (T.edge q) := by + apply helper_tree_edge_incident_157 + have edge_color_D (q : Fin T.length) (c : Fin k) + (hc : phi (T.edge q) = some c) : phiD (T.edge q) = some c := by + apply helper_edge_color_D_163 <;> assumption + have missing_unaffected (v : V) (hv : v ∈ X) (c : Fin k) + (hc : c ≠ C.gamma (D.gammaIndex d)) (hd : c ≠ d.1) : + (c ∈ MissingColors G phiD v ↔ c ∈ MissingColors G phi v) := by + apply helper_missing_unaffected_183 <;> assumption + have htreeS : TashkinovTree G e0 phiD S := by + apply helper_htreeS_191 <;> assumption + have hz1S : z1 ∈ TreeSequenceVertexSet S := by + rw [hSvertices] + exact hz1Z + have hz2S : z2 ∈ TreeSequenceVertexSet S := by rw [hSvertices]; exact hz2Z + have hz3S : z3 ∈ TreeSequenceVertexSet S := by rw [hSvertices]; exact hz3Z + have htreeS1 : ∃ S1, TreeSequenceAdjoinEdge S g1 S1 ∧ + TashkinovTree G e0 phiD S1 := by + have hz := (Finset.mem_sdiff.mp hz1Z).1 + have hw : w1 ∉ TreeSequenceVertexSet S := by + rw [hSvertices] + intro hw + exact hw1X (Finset.mem_sdiff.mp hw).1 + have d_missing_S : d.1 ∈ TreeMissingColors phiD S := by + rw [TreeMissingColors] + refine Finset.mem_biUnion.mpr ⟨D.v0 d, ?_, ?_⟩ + · rw [hSvertices] + exact hp.1 + · rw [hmissD] + simp + obtain ⟨S1, hS1⟩ := TreeSequenceBoundaryEdgeAppendExists S g1 (by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + using (show ∃ u ∈ TreeSequenceVertexSet S, ∃ v ∉ TreeSequenceVertexSet S, + G.ends g1 = s(u, v) from ⟨z1, hz1S, w1, hw, he1⟩)) + refine ⟨S1, hS1, ?_⟩ + apply TashkinovAugmentationSequencePreservesTashkinovTree G e0 phiD S S1 htreeS + rcases hS1 with ⟨hlen, hinit, hlast⟩ + exact Relation.ReflTransGen.single ⟨hlen, hinit, d.1, + (congrArg phiD hlast).trans (by + have hf := hfixD g1 + (show ∃ v ∈ TreeSequenceVertexSet T, Incident G v g1 from + ⟨z1, (Finset.mem_sdiff.mp hz1Z).1, by + change z1 ∈ G.ends g1 + rw [he1] + simp⟩) hg1f0 + calc + phiD g1 = phi g1 := by simpa [phiD] using hf + _ = some d.1 := (Finset.mem_filter.mp hg1data.1).2), d_missing_S⟩ + exact @helper_continuation_668 (@V) (@E) vertexFinite edgeFinite vertexEquality edgeEquality + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (by + simpa only [X, U, Z, B] using hp) (@g1) (@g2) (@hg2f0) (@g3) (@hg3f0) (@hg3g1) (@hg3g2) + (@hproperD) (@honeD) (@hmissD) (@hfixD) (@hg1data) (@hg2data) (@hg3data) (@z1) (@z2) + (@hz2Z) (@z3) (@hz3Z) (@w1) (@hw1X) (@hw1g) (@w2) (@hw2X) (@hw2g) (@w3) (@hw3X) (@hw3g) + (@he1) (@he2) (@he3) (@hproper) (@hout_ne) (@S) (@hSvertices) (@hSlength) (@hz1S) (@hz2S) + (@hz3S) (@htreeS1) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryParity.lean b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryParity.lean new file mode 100644 index 0000000000..779b1cd43c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryParity.lean @@ -0,0 +1,745 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Replacement Boundary Parity + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hcover_257.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + let B : Finset E := {f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f}; ( + ∀ v ∈ Z, (↑d : Fin k) ∈ PresentColors G phi v) → + let internal : Finset E := {e ∈ InternalEdges G Z | phi e = some (↑d : Fin k)}; ( + ∀ (e : E), e ∈ internal ↔ phi e = some (↑d : Fin k) ∧ + ∀ (v : V), Incident G v e → v ∈ Z) → + ∀ v ∈ Z, (v ∈ internal.biUnion fun (e : E) => (G.ends e).toFinset) ∨ v ∈ B.biUnion fun (e : E) + => {w ∈ Z | Incident G w e} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z B hpresent internal hinternal + as_aux_lemma => + intro v hvZ + obtain ⟨e, hve, hecolor⟩ := by + simpa [PresentColors] using hpresent v hvZ + by_cases hall : ∀ w, Incident G w e → w ∈ Z + · left + exact Finset.mem_biUnion.mpr + ⟨e, (hinternal e).mpr ⟨hecolor, hall⟩, + Sym2.mem_toFinset.mpr hve⟩ + · right + push Not at hall + obtain ⟨w, hwe, hwZ⟩ := hall + have hwX : w ∉ X := by + intro hwX + have hwU : w ∈ U := by + by_contra hwU + exact hwZ (Finset.mem_sdiff.mpr ⟨hwX, hwU⟩) + have hno := ScheideDefectiveNoCross G k e0 phi T C D d e hecolor + exact hno ⟨w, by simpa [U, i] using hwU, hwe, + v, by simpa [X, U, Z, i] using hvZ, hve⟩ + obtain ⟨z, hze⟩ := Sym2.mem_iff_exists.mp hwe + have heq : G.ends e = s(w, z) := hze + have hzv : z = v := by + have hvEnds : v = w ∨ v = z := by + have : v ∈ s(w, z) := by rw [← heq]; exact hve + simpa using this + rcases hvEnds with hvw | hvz + · exact False.elim (hwZ (hvw ▸ hvZ)) + · exact hvz.symm + have heboundary : e ∈ BoundaryEdges G Z := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hvZ, w, hwZ, by simpa [hzv] using heq.trans Sym2.eq_swap⟩ + have heB : e ∈ B := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_filter.mpr ⟨heboundary, hecolor⟩, w, hwX, hwe⟩ + exact Finset.mem_biUnion.mpr ⟨e, heB, + Finset.mem_filter.mpr ⟨hvZ, hve⟩⟩ + +private theorem helper_base_ne_block_156.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → + ∀ (a : Fin C.p) (b : Fin (2 : ℕ)), C.y a ≠ C.blockVertex i b := by + classical + intro V E _ _ _ G k e0 phi T C D d i hlength a b h + let qa : Fin (T.length + 1) := ⟨a.val, by + have ha := a.isLt + have hi := i.isLt + have hb := b.isLt + omega⟩ + let qb : Fin (T.length + 1) := + ⟨C.p + 2 * i.val + b.val, by + have hi := i.isLt + have hb := b.isLt + omega⟩ + have hv : T.vertex qa = T.vertex qb := by + rw [show T.vertex qa = C.y a by + simpa [qa] using C.base_vertex_position a] + rw [show T.vertex qb = C.blockVertex i b by + simpa [qb] using C.block_vertex_position i b] + exact h + have hq := congrArg Fin.val (T.vertex_injective hv) + have ha := a.isLt + dsimp [qa, qb] at hq + omega + +private theorem helper_hinternal_union_287.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + let internal : Finset E := {e ∈ InternalEdges G Z | phi e = some (↑d : Fin k)}; ( + ∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ)) → ( + ∀ ⦃e : E⦄, e ∈ internal → + ∀ ⦃f : E⦄, f ∈ internal → e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset) → + (internal.biUnion fun (e : E) => (G.ends e).toFinset).card = (2 : ℕ) * internal.card := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z internal hendcard hinternal_disjoint + as_aux_lemma => + have aux : ∀ s : Finset E, s ⊆ internal → + (s.biUnion fun e => (G.ends e).toFinset).card = 2 * s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset + (s.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + have hh := hinternal_disjoint + (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf)) + exact (Finset.disjoint_left.mp hh) hev hvf + rw [Finset.card_union_of_disjoint hd, hendcard] + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem hes] + omega + exact aux internal (by intro e he; exact he) + +private theorem helper_hBunion_351.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + let B : Finset E := {f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f}; ( + ∀ e ∈ B, {v ∈ Z | Incident G v e}.card = (1 : ℕ)) → ( + ∀ ⦃e : E⦄, e ∈ B → + ∀ ⦃f : E⦄, f ∈ B → e ≠ f → Disjoint ({v ∈ Z | Incident G v e}) ({v ∈ Z | Incident G v f})) → + (B.biUnion fun (e : E) => {v ∈ Z | Incident G v e}).card = B.card := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z B hBfiber hBdisjoint + as_aux_lemma => + have aux : + ∀ s : Finset E, s ⊆ B → (s.biUnion fun e => Z.filter (fun v => Incident G v e)).card = s.card + := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (Z.filter (fun v => Incident G v e)) + (s.biUnion fun f => Z.filter (fun v => Incident G v f)) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + exact (Finset.disjoint_left.mp + (hBdisjoint (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf)))) hev hvf + rw [Finset.card_union_of_disjoint hd, + hBfiber e (hs (Finset.mem_insert_self e s))] + rw [ih (fun x hx => hs (Finset.mem_insert_of_mem hx))] + rw [Finset.card_insert_of_notMem hes] + exact Nat.add_comm 1 s.card + exact aux B (by intro e he; exact he) + +private theorem helper_hpair_ne_287.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let i : Fin C.s := D.gammaIndex d; T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → C.blockVertex i + (0 : Fin (2 : ℕ)) ≠ C.blockVertex i (1 : Fin (2 : ℕ)) := by + classical + intro V E _ _ _ G k e0 phi T C D d i hlength h + let q0 : Fin (T.length + 1) := + ⟨C.p + 2 * i.val, by + have hi := i.isLt + omega⟩ + let q1 : Fin (T.length + 1) := + ⟨C.p + 2 * i.val + 1, by + have hi := i.isLt + omega⟩ + have hv : T.vertex q0 = T.vertex q1 := by + rw [show T.vertex q0 = C.blockVertex i 0 by + simpa [q0] using C.block_vertex_position i (0 : Fin 2)] + rw [show T.vertex q1 = C.blockVertex i 1 by + simpa [q1] using C.block_vertex_position i (1 : Fin 2)] + exact h + have hq := congrArg Fin.val (T.vertex_injective hv) + simp [q0, q1] at hq + +private theorem helper_hBfiber_391.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + let B : Finset E := {f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f}; + ∀ e ∈ B, {v ∈ Z | Incident G v e}.card = (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z B + as_aux_lemma => + intro e he + have heboundary : e ∈ BoundaryEdges G Z := + (Finset.mem_filter.mp (Finset.mem_filter.mp he).1).1 + obtain ⟨u, hu, v, hv, huv⟩ := by + simpa [BoundaryEdges] using heboundary + have hs : Z.filter (fun x => Incident G x e) = {u} := by + ext x + simp only [Finset.mem_filter, Finset.mem_singleton, Incident, + huv, Sym2.mem_iff] + constructor + · rintro ⟨hx, rfl | hxe⟩ + · exact rfl + · exact False.elim (hv (hxe ▸ hx)) + · intro hxu + subst hxu + exact ⟨hu, Or.inl rfl⟩ + rw [hs] + simp + +private theorem helper_hAW_437.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + let B : Finset E := {f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f}; IsProperEdgeColoring G phi → + let internal : Finset E := {e ∈ InternalEdges G Z | phi e = some (↑d : Fin k)}; ( + ∀ (e : E), e ∈ internal ↔ phi e = some (↑d : Fin k) ∧ + ∀ (v : V), Incident G v e → v ∈ Z) → ( + ∀ e ∈ B, phi e = some (↑d : Fin k)) → + let A : Finset V := internal.biUnion fun (e : E) => (G.ends e).toFinset; + let W : Finset V := B.biUnion fun (e : E) => {v ∈ Z | Incident G v e}; Disjoint A W := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z B hproper internal hinternal hBcolor A W + as_aux_lemma => + rw [Finset.disjoint_left] + intro v hvA hvW + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hvA + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvW + have hef : e ≠ f := by + intro hef + have hfboundary : f ∈ BoundaryEdges G Z := + (Finset.mem_filter.mp (Finset.mem_filter.mp hf).1).1 + obtain ⟨u, hu, w, hw, huw⟩ := by + simpa [BoundaryEdges] using hfboundary + have : w ∈ Z := ((hinternal e).mp he).2 w (by + change w ∈ G.ends e + rw [hef, huw] + simp) + exact hw this + exact (hproper hef ⟨v, Sym2.mem_toFinset.mp hve, + (Finset.mem_filter.mp hvf).2⟩ ((hinternal e).mp he).1) + (hBcolor f hf) + +private theorem helper_hv0X_361.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; D.v0 d ∈ X := by + classical + intro V E _ _ _ G k e0 phi T C D d X + have hv0exit : ScheideExitVertex T phi (D.v0 d) := by + simpa [ScheideExitVertices] using D.v0_is_exit d + rcases hv0exit with + ⟨u, gamma, delta, hu, hgamma, hdelta, z, path, hpath, + q, hq, hv0X, hafter⟩ + exact hv0X + +private theorem helper_hv0_base_368.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; ColoredVertexSetElementary G phi X → ( + ∀ (a : Fin C.p), C.y a ∈ X) → D.v0 d ∈ X → + ∃ (a : Fin C.p), D.v0 d = C.y a := by + classical + intro V E _ _ _ G k e0 phi T C D d X helementary base_mem_X hv0X + obtain ⟨r, hr0⟩ := C.exit_covered (D.v0 d) (D.v0_is_exit d) + obtain ⟨a, hra⟩ := C.block_color_missing_on_base r + refine ⟨a, ?_⟩ + by_contra hne + have hdisjoint := helementary hv0X (base_mem_X a) hne + exact (Finset.disjoint_left.mp hdisjoint) hr0 hra + +private theorem helper_hUsub_394.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); ( + ∀ (b : Fin (2 : ℕ)), C.blockVertex i b ∈ X) → U ⊆ X := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U block_mem_X v hv + simp only [U, Finset.mem_insert, Finset.mem_singleton] at hv + rcases hv with rfl | rfl + · exact block_mem_X 0 + · exact block_mem_X 1 + +private theorem helper_hZodd_403.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; TashkinovOrder G = (TreeSequenceVertexSet T).card ∧ (3 : ℕ) ≤ + (TreeSequenceVertexSet T).card ∧ Odd (TreeSequenceVertexSet T).card ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) ∧ ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T) → U.card = (2 : ℕ) → U ⊆ X → Z.card = X.card - (2 : ℕ) → Odd + Z.card := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z horder hUcard hUsub hZcard + rcases horder.2.2.1 with ⟨q, hq⟩ + have htwo : 2 ≤ X.card := by + rw [← hUcard] + exact Finset.card_le_card hUsub + refine ⟨q - 1, ?_⟩ + rw [hZcard] + have hq' : X.card = 2 * q + 1 := by simpa [X] using hq + omega + +private theorem helper_hunique_430.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; IsProperEdgeColoring G phi → ( + ∀ v ∈ Z, (↑d : Fin k) ∈ PresentColors G phi v) → + ∀ v ∈ Z, + ∃! f : E, Incident G v f ∧ phi f = some (↑d : Fin k) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z hproper hpresent v hvZ + obtain ⟨f, hvf, hfc⟩ := by + simpa [PresentColors] using hpresent v hvZ + refine ⟨f, ⟨hvf, hfc⟩, ?_⟩ + intro g hg + by_contra hgf + exact (hproper hgf ⟨v, hg.1, hvf⟩ hg.2) hfc + +private theorem helper_hf0B_440.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; + let B : Finset E := ({f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f} : Finset E); D.v0 d ∈ Z → D.f0 d ∈ B := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z B hv0Z + apply Finset.mem_filter.mpr + refine ⟨?_, D.u0 d, D.u0_outside d, ?_⟩ + · apply Finset.mem_filter.mpr + refine ⟨?_, D.f0_color d⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨D.v0 d, hv0Z, D.u0 d, + fun huZ => D.u0_outside d (Finset.mem_sdiff.mp huZ).1, + D.f0_ends d⟩ + · simp [Incident, D.f0_ends d] + +private theorem helper_hendcard_456.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) + (e : E), + (G.ends e).toFinset.card = (2 : ℕ) := by + classical + intro V E _ G e + apply Sym2.card_toFinset_of_not_isDiag + intro hd + exact G.loopless e ((G.ends e).diagElem hd) + (Sym2.diag_diagElem hd).symm + +private theorem helper_hinternal_disjoint_462.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; IsProperEdgeColoring G phi → + let internal : Finset E := ({e ∈ InternalEdges G Z | phi e = some (↑d : Fin k)} : Finset E); ( + ∀ (e : E), e ∈ internal ↔ phi e = some (↑d : Fin k) ∧ + ∀ (v : V), Incident G v e → v ∈ Z) → + ∀ ⦃e : E⦄, e ∈ internal → + ∀ ⦃f : E⦄, f ∈ internal → e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z hproper internal hinternal e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + exact (hproper hef + ⟨v, Sym2.mem_toFinset.mp hev, Sym2.mem_toFinset.mp hvf⟩ + ((hinternal e).mp he).1) ((hinternal f).mp hf).1 + +private theorem helper_hBdisjoint_484.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; + let B : Finset E := ({f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f} : Finset E); IsProperEdgeColoring G phi → ( + ∀ e ∈ B, phi e = some (↑d : Fin k)) → + ∀ ⦃e : E⦄, e ∈ B → + ∀ ⦃f : E⦄, f ∈ B → e ≠ f → Disjoint ({v ∈ Z | Incident G v e} : Finset V) + ({v ∈ Z | Incident G v f} : Finset V) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z B hproper hBcolor e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + exact (hproper hef ⟨v, (Finset.mem_filter.mp hev).2, + (Finset.mem_filter.mp hvf).2⟩ (hBcolor e he)) (hBcolor f hf) + +private theorem helper_hAZ_508.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; + let B : Finset E := ({f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f} : Finset E); + let internal : Finset E := ({e ∈ InternalEdges G Z | phi e = some (↑d : Fin k)} : Finset E); ( + ∀ v ∈ Z, (v ∈ internal.biUnion fun (e : E) ↦ (G.ends e).toFinset) ∨ v ∈ B.biUnion fun (e : E) + ↦ ({w ∈ Z | Incident G w e} : Finset V)) → + let A : Finset V := internal.biUnion fun (e : E) ↦ (G.ends e).toFinset; + let W : Finset V := B.biUnion fun (e : E) ↦ ({v ∈ Z | Incident G v e} : Finset V); A ⊆ Z → W ⊆ + Z → A ∪ W = Z := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z B internal hcover A W hA hW + apply Finset.Subset.antisymm + · exact Finset.union_subset hA hW + · intro v hv + rcases hcover v hv with hvA | hvW + · exact Finset.mem_union.mpr (Or.inl hvA) + · exact Finset.mem_union.mpr (Or.inr hvW) + +private theorem helper_hBodd_518.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let i : Fin C.s := D.gammaIndex d; + let U : Finset V := (insert (C.blockVertex i (0 : Fin (2 : ℕ))) + ({C.blockVertex i (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let Z : Finset V := X \ U; + let B : Finset E := ({f ∈ BoundaryColorEdges G phi Z (↑d : Fin k) | + ∃ w ∉ X, Incident G w f} : Finset E); Z.card = X.card - (2 : ℕ) → Odd Z.card → + let internal : Finset E := ({e ∈ InternalEdges G Z | phi e = some (↑d : Fin k)} : Finset E); + (B.biUnion fun (e : E) ↦ ({v ∈ Z | Incident G v e} : Finset V)).card = B.card → Z.card = + (2 : ℕ) * internal.card + B.card → Odd B.card := by + classical + intro V E _ _ _ _ G k e0 phi T C D d X i U Z B hZcard hZodd internal hBunion hcardeq + rcases hZodd with ⟨q, hq⟩ + have hq' : Z.card = 2 * q + 1 := hq + have hintle : internal.card ≤ q := by omega + refine ⟨q - internal.card, ?_⟩ + omega + +theorem ScheideReplacementBoundaryParity {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) : + ∀ d : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) }, + let X := TreeSequenceVertexSet T + let Z := X \ {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} + let B := + @Finset.filter E (fun f => ∃ w, w ∉ X ∧ Incident G w f) + (fun _ => Classical.propDecidable _) (BoundaryColorEdges G phi Z d.1) + D.v0 d ∈ Z ∧ + C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ Z ∧ + (∀ z ∈ Z, ∃! f : E, Incident G z f ∧ phi f = some d.1) ∧ D.f0 d ∈ B ∧ Odd B.card := by + classical + intro d + dsimp only + let X := TreeSequenceVertexSet T + let i := D.gammaIndex d + let U := ({C.blockVertex i 0, C.blockVertex i 1} : Finset V) + let Z := X \ U + let B := (BoundaryColorEdges G phi Z d.1).filter + (fun f => ∃ w, w ∉ X ∧ Incident G w f) + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have helementary : ColoredVertexSetElementary G phi X := by + exact horder.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi X := by + exact horder.2.2.2.2 + have hlength := C.length_eq + have base_mem_X (a : Fin C.p) : C.y a ∈ X := by + rw [← C.base_vertex_position a] + simp [X, TreeSequenceVertexSet] + have block_mem_X (b : Fin 2) : C.blockVertex i b ∈ X := by + rw [← C.block_vertex_position i b] + simp [X, TreeSequenceVertexSet] + have hv0X : D.v0 d ∈ X := by + exact @helper_hv0X_361 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@C) (@D) (@d) + have hv0_base : ∃ a : Fin C.p, D.v0 d = C.y a := by + exact @helper_hv0_base_368 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@C) (@D) (@d) (@helementary) (@base_mem_X) (@hv0X) + have base_ne_block (a : Fin C.p) (b : Fin 2) : + C.y a ≠ C.blockVertex i b := by + exact @helper_base_ne_block_156 V E inferInstance inferInstance inferInstance G k e0 phi T C + D d hlength a b + have base_mem_Z (a : Fin C.p) : C.y a ∈ Z := by + apply Finset.mem_sdiff.mpr + refine ⟨base_mem_X a, ?_⟩ + simp [U, base_ne_block] + have hv0Z : D.v0 d ∈ Z := by + obtain ⟨a, ha⟩ := hv0_base + rw [ha] + exact base_mem_Z a + let y0 := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hy0Z : y0 ∈ Z := by + exact base_mem_Z ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hpair_ne : C.blockVertex i 0 ≠ C.blockVertex i 1 := by + exact @helper_hpair_ne_287 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + hlength + have hUcard : U.card = 2 := by + simp [U, hpair_ne] + have hUsub : U ⊆ X := by + exact @helper_hUsub_394 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@block_mem_X) + have hZcard : Z.card = X.card - 2 := by + change (X \ U).card = X.card - 2 + rw [Finset.card_sdiff, Finset.inter_eq_left.mpr hUsub, hUcard] + have hZodd : Odd Z.card := by + exact @helper_hZodd_403 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@horder) (@hUcard) (@hUsub) (@hZcard) + have hboundary_nonempty : + 0 < (BoundaryColorEdges G phi X d.1).card := by + have hthree := + (ScheideGlobalMaximumBoundaryFacts G k e0 phi T C.globally_maximum).2.2 + d.1 d.2 |>.2 + simpa [X] using (lt_of_lt_of_le (by omega : 0 < 3) hthree) + obtain ⟨boundaryEdge, hboundaryEdge⟩ := + Finset.card_pos.mp hboundary_nonempty + have hboundary : boundaryEdge ∈ BoundaryEdges G X := + (Finset.mem_filter.mp hboundaryEdge).1 + have hboundary_color : phi boundaryEdge = some d.1 := + (Finset.mem_filter.mp hboundaryEdge).2 + have hpresent : ∀ v, v ∈ Z → d.1 ∈ PresentColors G phi v := by + intro v hvZ + have hnotmissing : d.1 ∉ MissingColors G phi v := by + exact hclosed hboundary (Finset.mem_sdiff.mp hvZ).1 hboundary_color + simpa [MissingColors] using hnotmissing + have hunique : ∀ v, v ∈ Z → + ∃! f : E, Incident G v f ∧ phi f = some d.1 := by + exact @helper_hunique_430 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hproper) (@hpresent) + have hf0B : D.f0 d ∈ B := by + exact @helper_hf0B_440 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hv0Z) + let internal := (InternalEdges G Z).filter (fun e => phi e = some d.1) + have hinternal : ∀ e, e ∈ internal ↔ + phi e = some d.1 ∧ ∀ v, Incident G v e → v ∈ Z := by + intro e + simp [internal, InternalEdges, and_comm] + have hendcard : ∀ e : E, (G.ends e).toFinset.card = 2 := by + exact @helper_hendcard_456 (@V) (@E) inferInstance (@G) + have hinternal_disjoint : ∀ ⦃e⦄, e ∈ internal → ∀ ⦃f⦄, f ∈ internal → + e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + exact @helper_hinternal_disjoint_462 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hproper) (@hinternal) + have hinternal_union : + (internal.biUnion fun e => (G.ends e).toFinset).card = + 2 * internal.card := by + exact @helper_hinternal_union_287 V E inferInstance inferInstance inferInstance inferInstance + G k e0 phi T C D d hendcard hinternal_disjoint + have hcover : ∀ v, v ∈ Z → + v ∈ internal.biUnion (fun e => (G.ends e).toFinset) ∨ + v ∈ B.biUnion (fun e => Z.filter (fun w => Incident G w e)) := by + exact @helper_hcover_257 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d hpresent hinternal + have hBfiber : ∀ e, e ∈ B → + (Z.filter (fun v => Incident G v e)).card = 1 := by + exact @helper_hBfiber_391 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d + have hBcolor : ∀ e, e ∈ B → phi e = some d.1 := by + intro e he + exact (Finset.mem_filter.mp (Finset.mem_filter.mp he).1).2 + have hBdisjoint : ∀ ⦃e⦄, e ∈ B → ∀ ⦃f⦄, f ∈ B → e ≠ f → + Disjoint (Z.filter (fun v => Incident G v e)) + (Z.filter (fun v => Incident G v f)) := by + exact @helper_hBdisjoint_484 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hproper) (@hBcolor) + have hBunion : + (B.biUnion fun e => Z.filter (fun v => Incident G v e)).card = + B.card := by + exact @helper_hBunion_351 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d hBfiber hBdisjoint + let A := internal.biUnion (fun e => (G.ends e).toFinset) + let W := B.biUnion (fun e => Z.filter (fun v => Incident G v e)) + have hA : A ⊆ Z := by + intro v hv + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hv + exact ((hinternal e).mp he).2 v (Sym2.mem_toFinset.mp hve) + have hW : W ⊆ Z := by + intro v hv + obtain ⟨e, he, hve⟩ := Finset.mem_biUnion.mp hv + exact (Finset.mem_filter.mp hve).1 + have hAW : Disjoint A W := by + exact @helper_hAW_437 V E inferInstance inferInstance inferInstance inferInstance G k e0 phi + T C D d hproper hinternal hBcolor + have hAZ : A ∪ W = Z := by + exact @helper_hAZ_508 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hcover) (@hA) (@hW) + have hcardeq : Z.card = 2 * internal.card + B.card := by + rw [← hAZ, Finset.card_union_of_disjoint hAW, + hinternal_union, hBunion] + have hBodd : Odd B.card := by + exact @helper_hBodd_518 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@hZcard) (@hZodd) (@hBunion) (@hcardeq) + let statementB := + @Finset.filter E (fun f => ∃ w, w ∉ X ∧ Incident G w f) + (fun _ => Classical.propDecidable _) (BoundaryColorEdges G phi Z d.1) + have hBstatement : B = statementB := by + ext e + simp [B, statementB] + have hstatementOdd : Odd statementB.card := by + rw [← hBstatement] + exact hBodd + exact ⟨by simpa [X, i, U, Z] using hv0Z, + by simpa [X, i, U, Z, y0] using hy0Z, + by simpa [X, i, U, Z] using hunique, + by simpa [X, i, U, Z, B] using hf0B, + by + have heq : statementB = + @Finset.filter E + (fun f => ∃ w, w ∉ TreeSequenceVertexSet T ∧ Incident G w f) + (fun _ => Classical.propDecidable _) + (BoundaryColorEdges G phi + (TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1}) d.1) := by + ext e + simp [statementB, X, i, U, Z] + rw [← heq] + exact hstatementOdd⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryUnique.lean b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryUnique.lean new file mode 100644 index 0000000000..2a1b4eafb2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryUnique.lean @@ -0,0 +1,181 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideReplacementPathPrefix + +/-! +# Scheide Replacement Boundary Unique + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideReplacementBoundaryUnique {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) + (alpha : Fin k) + (L : ScheideLastExitPath G k e0 phi T C D R alpha) + (d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}) + (hprefix : ∀ (j : Fin (L.path.length + 1)), + j.val ≤ L.lastIndex.val → + ∀ x : V, L.path.getVert j.val = Sum.inl x → + x ∈ TreeSequenceVertexSet (R d).replacementTree) : + ∀ f : E, f ∈ BoundaryEdges G (ScheideEnlargedVertexSet R) ∧ + Sum.inr f ∈ TwoColorComponent G phi D.alpha0 alpha + (Sum.inl (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩)) → + f = L.crossing := by + classical + let X := ScheideEnlargedVertexSet R + have hrep : TreeSequenceVertexSet (R d).replacementTree ⊆ X := by + intro v hv + rw [(R d).replacement_vertices] at hv + simp only [Finset.mem_union, Finset.mem_sdiff, Finset.mem_insert, + Finset.mem_singleton] at hv + rcases hv with hv | hv + · simp [X, ScheideEnlargedVertexSet, hv.1] + · simp only [X, ScheideEnlargedVertexSet, Finset.mem_union] + right + simp only [Finset.mem_biUnion, Finset.mem_univ, true_and] + rcases hv with rfl | rfl + · exact ⟨⟨d.1, d.2⟩, by simp⟩ + · exact ⟨⟨d.1, d.2⟩, by simp⟩ + intro f hf + obtain ⟨u, hu, w, hw, hends⟩ : ∃ u ∈ X, ∃ w ∉ X, G.ends f = s(u, w) := by + simpa [X, BoundaryEdges] using hf.1 + have hneuw : u ≠ w := by + intro h + exact G.loopless f u (h ▸ hends) + have hfsupport : Sum.inr f ∈ L.path.support := by + have hcomponent := hf.2 + rw [← L.pathSpans] at hcomponent + exact hcomponent + obtain ⟨n, hnget, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hfsupport + have hnpos : 0 < n := by + by_cases hnzero : n = 0 + · subst n + rw [L.path.getVert_zero] at hnget + cases hnget + · omega + have hlastlt : L.lastIndex.val < L.path.length + 1 := L.lastIndex.isLt + have hnlt : n < L.path.length := by + by_contra hnl + have heq : n = L.path.length := by omega + subst n + rw [L.path.getVert_length] at hnget + cases hnget + have hprev := L.path.adj_getVert_succ (i := n - 1) (by omega) + have hnext := L.path.adj_getVert_succ (i := n) hnlt + rw [show n - 1 + 1 = n by omega, hnget] at hprev + have hprevExists : ∃ vprev : V, L.path.getVert (n - 1) = Sum.inl vprev := by + cases hprevVert : L.path.getVert (n - 1) with + | inl vprev => exact ⟨vprev, rfl⟩ + | inr q => + rw [hprevVert] at hprev + simp [TwoColorIncidenceGraph] at hprev + obtain ⟨vprev, hprevVert⟩ := hprevExists + rw [hprevVert] at hprev + simp only [TwoColorIncidenceGraph, Incident] at hprev + rw [hnget] at hnext + have hnextExists : ∃ vnext : V, L.path.getVert (n + 1) = Sum.inl vnext := by + cases hnextVert : L.path.getVert (n + 1) with + | inl vnext => exact ⟨vnext, rfl⟩ + | inr q => + rw [hnextVert] at hnext + simp [TwoColorIncidenceGraph] at hnext + obtain ⟨vnext, hnextVert⟩ := hnextExists + rw [hnextVert] at hnext + simp only [TwoColorIncidenceGraph, Incident] at hnext + have hprevEnds : vprev = u ∨ vprev = w := by + rw [hends] at hprev + simpa [Sym2.mem_iff] using hprev.1 + have hnextEnds : vnext = u ∨ vnext = w := by + rw [hends] at hnext + simpa [Sym2.mem_iff] using hnext.1 + have hvne : vprev ≠ vnext := by + intro heq + have hidx := L.pathSimple.getVert_injOn + (show n - 1 ≤ L.path.length by omega) + (show n + 1 ≤ L.path.length by omega) + (by rw [hprevVert, hnextVert, heq]) + omega + have hprevXor : (vprev ∈ X ∧ vnext ∉ X) ∨ + (vprev ∉ X ∧ vnext ∈ X) := by + rcases hprevEnds with hpu | hpw <;> rcases hnextEnds with hnu | hnw + · exfalso + apply hvne + exact hpu.trans hnu.symm + · left + constructor + · simpa [hpu] using hu + · simpa [hnw] using hw + · right + constructor + · simpa [hpw] using hw + · simpa [hnu] using hu + · exfalso + apply hvne + exact hpw.trans hnw.symm + have hprevIn : n - 1 ≤ L.lastIndex.val := by + rcases hprevXor with hcase | hcase + · by_contra hnot + have hout := L.afterLastOutside ⟨n - 1, by omega⟩ (by + change L.lastIndex.val < n - 1 + omega) vprev hprevVert + exact hout hcase.1 + · have hnextIn : n + 1 ≤ L.lastIndex.val := by + by_contra hbad + have hout := L.afterLastOutside ⟨n + 1, by omega⟩ (by + change L.lastIndex.val < n + 1 + omega) vnext hnextVert + exact hout hcase.2 + have hprevBound : n - 1 ≤ L.lastIndex.val := by omega + exact False.elim (hcase.1 (hrep + (hprefix ⟨n - 1, by omega⟩ hprevBound vprev hprevVert))) + have hnextOut : ¬ n + 1 ≤ L.lastIndex.val := by + intro hnext + have hvnextX := hrep + (hprefix ⟨n + 1, by omega⟩ hnext vnext hnextVert) + rcases hprevXor with hcase | hcase + · exact hcase.2 hvnextX + · exact hcase.1 (hrep + (hprefix ⟨n - 1, by omega⟩ hprevIn vprev hprevVert)) + have hidx : n = L.lastIndex.val + 1 := by + have hsub : n - 1 + 1 ≤ L.lastIndex.val + 1 := + Nat.succ_le_succ hprevIn + have hle : n ≤ L.lastIndex.val + 1 := by + simpa [Nat.sub_add_cancel (by omega : 1 ≤ n)] using hsub + have hneq : n ≠ L.lastIndex.val := by + intro heq + have hbad := hnget + rw [heq, L.lastInsideAt] at hbad + cases hbad + have hgt : L.lastIndex.val < n := by + by_contra hnot + have hnle : n ≤ L.lastIndex.val := by omega + have hsucc : n + 1 ≤ L.lastIndex.val := by omega + exact hnextOut hsucc + have hge : L.lastIndex.val + 1 ≤ n := by omega + omega + have heq : (Sum.inr f : Sum V E) = Sum.inr L.crossing := by + rw [← hnget, hidx, L.crossingAt] + injection heq + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementConfinement.lean b/LeanPool/GoldbergSeymour/ScheideReplacementConfinement.lean new file mode 100644 index 0000000000..24d194a696 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementConfinement.lean @@ -0,0 +1,347 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet +public import LeanPool.GoldbergSeymour.ScheideExitNoFree +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideLastExitPath +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryUnique +public import LeanPool.GoldbergSeymour.ScheideReplacementExitNotDefective +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideReplacementPathPrefix +public import LeanPool.GoldbergSeymour.ScheideReplacementUsedWitness +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Replacement Confinement + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem ScheideReplacementConfinement_hgraph_272.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (alpha : Fin k) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), alpha ≠ (↑d + : Fin k) → alpha ≠ C.gamma (D.gammaIndex d) → D.alpha0 ≠ C.gamma (D.gammaIndex d) → + D.alpha0 ≠ (↑d : Fin k) → ( + ∀ (c : Fin k), c ≠ C.gamma (D.gammaIndex d) → c ≠ (↑d : Fin k) → + ∀ (f : E), TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)) f = some c ↔ phi f = some c) → TwoColorIncidenceGraph G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha := by + classical + intro V E _ _ _ G k e0 phi T C D alpha d hAlphaDelta hAlphaGamma hAlpha0Gamma hAlpha0Delta + colorFixed + ext x y + cases x with + | inl vx => + cases y with + | inl vy => rfl + | inr e => + simp only [TwoColorIncidenceGraph] + constructor <;> rintro ⟨hi, hc⟩ <;> refine ⟨hi, ?_⟩ + · rcases hc with hc | hc + · exact Or.inl + ((colorFixed D.alpha0 hAlpha0Gamma hAlpha0Delta e).mp hc) + · exact Or.inr ((colorFixed alpha hAlphaGamma hAlphaDelta e).mp hc) + · rcases hc with hc | hc + · exact Or.inl + ((colorFixed D.alpha0 hAlpha0Gamma hAlpha0Delta e).mpr hc) + · exact Or.inr ((colorFixed alpha hAlphaGamma hAlphaDelta e).mpr hc) + | inr e => + cases y with + | inl vy => + simp only [TwoColorIncidenceGraph] + constructor <;> rintro ⟨hi, hc⟩ <;> refine ⟨hi, ?_⟩ + · rcases hc with hc | hc + · exact Or.inl + ((colorFixed D.alpha0 hAlpha0Gamma hAlpha0Delta e).mp hc) + · exact Or.inr ((colorFixed alpha hAlphaGamma hAlphaDelta e).mp hc) + · rcases hc with hc | hc + · exact Or.inl + ((colorFixed D.alpha0 hAlpha0Gamma hAlpha0Delta e).mpr hc) + · exact Or.inr ((colorFixed alpha hAlphaGamma hAlphaDelta e).mpr hc) + | inr f => rfl + +theorem ScheideReplacementConfinement {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) + (alpha : Fin k) + (L : ScheideLastExitPath G k e0 phi T C D R alpha) + (hlast : L.lastInside ∉ TreeSequenceVertexSet T) : + ∃ d : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) }, + L.lastInside ∈ ({(R d).u1, (R d).u2} : Finset V) ∧ + TwoColorIncidenceGraph G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d))) + D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha ∧ + (∀ + c ∈ + TreeUsedColors + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) + (R d).replacementTree, + ∃ + z ∈ + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1}, + c ∈ + MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) + z) ∧ + (∃ beta, + beta ∈ + MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) + L.lastInside ∧ + beta ∈ + TreeFreeColors + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) + (R d).replacementTree) ∧ + alpha ∉ + DefectiveColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) + (TreeSequenceVertexSet (R d).replacementTree) ∧ + (∀ (j : Fin (L.path.length + 1)), + j.val ≤ L.lastIndex.val → + ∀ x : V, + L.path.getVert j.val = Sum.inl x → + x ∈ TreeSequenceVertexSet (R d).replacementTree) ∧ + ∀ f : E, + f ∈ BoundaryEdges G (ScheideEnlargedVertexSet R) ∧ + Sum.inr f ∈ + TwoColorComponent G phi D.alpha0 alpha + (Sum.inl (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩)) → + f = L.crossing := by + classical + have hpairUnion : L.lastInside ∈ Finset.univ.biUnion + (fun d => ({(R d).u1, (R d).u2} : Finset V)) := by + have hmem := L.lastInsideMem + rw [ScheideEnlargedVertexSet, Finset.mem_union] at hmem + exact hmem.resolve_left hlast + obtain ⟨d, -, hpair⟩ := Finset.mem_biUnion.mp hpairUnion + let X := ScheideEnlargedVertexSet R + have hTreeSub : TreeSequenceVertexSet T ⊆ X := by + intro v hv + simp [X, ScheideEnlargedVertexSet, hv] + have hu1X : (R d).u1 ∈ X := by + change (R d).u1 ∈ ScheideEnlargedVertexSet R + rw [ScheideEnlargedVertexSet, Finset.mem_union] + right + exact Finset.mem_biUnion.mpr + ⟨d, Finset.mem_univ d, by simp⟩ + have hu2X : (R d).u2 ∈ X := by + change (R d).u2 ∈ ScheideEnlargedVertexSet R + rw [ScheideEnlargedVertexSet, Finset.mem_union] + right + exact Finset.mem_biUnion.mpr + ⟨d, Finset.mem_univ d, by simp⟩ + have internalNotBoundary (f : E) (a b : V) + (hends : G.ends f = s(a, b)) (ha : a ∈ X) (hb : b ∈ X) : + f ∉ BoundaryEdges G X := by + intro hboundary + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + at hboundary + obtain ⟨x, hx, y, hy, hxy⟩ := hboundary + have hpairs : s(a, b) = s(x, y) := hends.symm.trans hxy + rcases Sym2.eq_iff.mp hpairs with h | h + · exact hy (by simpa [← h.2] using hb) + · exact hy (by simpa [← h.1] using ha) + have hcrossIncident : Incident G L.lastInside L.crossing := by + have hadj := L.path.adj_getVert_succ + (i := L.lastIndex.val) (by + have h := L.followingVertex + omega) + rw [L.lastInsideAt, L.crossingAt] at hadj + simpa only [TwoColorIncidenceGraph] using hadj.1 + obtain ⟨fDelta, hfDeltaColor, hfDeltaIncident, hfDeltaNe⟩ : + ∃ f : E, phi f = some d.1 ∧ Incident G L.lastInside f ∧ + f ≠ L.crossing := by + have hp := hpair + simp only [Finset.mem_insert, Finset.mem_singleton] at hp + rcases hp with hv | hv + · refine ⟨(R d).f1, (R d).f1_color, ?_, ?_⟩ + · rw [hv] + change (R d).u1 ∈ G.ends (R d).f1 + rw [(R d).f1_ends] + simp + · intro heq + have hinter : (R d).f1 ∉ BoundaryEdges G X := + internalNotBoundary (R d).f1 (R d).v1 (R d).u1 + (R d).f1_ends + (hTreeSub (Finset.mem_sdiff.mp (R d).v1_in_remainder).1) hu1X + exact hinter (heq ▸ (by simpa only [X] using L.crossingBoundary)) + · refine ⟨(R d).f2, (R d).f2_color, ?_, ?_⟩ + · rw [hv] + change (R d).u2 ∈ G.ends (R d).f2 + rw [(R d).f2_ends] + simp + · intro heq + have hinter : (R d).f2 ∉ BoundaryEdges G X := + internalNotBoundary (R d).f2 (R d).v2 (R d).u2 + (R d).f2_ends + (hTreeSub (Finset.mem_sdiff.mp (R d).v2_in_remainder).1) hu2X + exact hinter (heq ▸ (by simpa only [X] using L.crossingBoundary)) + obtain ⟨fGamma, hfGammaColor, hfGammaEnds⟩ := + (ScheideSymmetricDefectiveInternal G k e0 phi T C D d (R d)).2 + have hfGammaIncident : Incident G L.lastInside fGamma := by + have hp := hpair + simp only [Finset.mem_insert, Finset.mem_singleton] at hp + rcases hp with hv | hv + · rw [hv] + change (R d).u1 ∈ G.ends fGamma + rw [hfGammaEnds] + simp + · rw [hv] + change (R d).u2 ∈ G.ends fGamma + rw [hfGammaEnds] + simp + have hfGammaNe : fGamma ≠ L.crossing := by + intro heq + have hinter : fGamma ∉ BoundaryEdges G X := + internalNotBoundary fGamma (R d).u1 (R d).u2 hfGammaEnds hu1X hu2X + exact hinter (heq ▸ (by simpa only [X] using L.crossingBoundary)) + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have hAlphaDelta : alpha ≠ d.1 := by + intro h + have hnot := hproper hfDeltaNe.symm + ⟨L.lastInside, hcrossIncident, hfDeltaIncident⟩ L.crossingColor + exact hnot (by simpa [h] using hfDeltaColor) + have hAlphaGamma : alpha ≠ C.gamma (D.gammaIndex d) := by + intro h + have hnot := hproper hfGammaNe.symm + ⟨L.lastInside, hcrossIncident, hfGammaIncident⟩ L.crossingColor + exact hnot (by simpa [h] using hfGammaColor) + have hAlpha0Gamma : D.alpha0 ≠ C.gamma (D.gammaIndex d) := + D.alpha0_not_block (D.gammaIndex d) + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + horder.2.2.2.2 + have hy0 : C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ + TreeSequenceVertexSet T := by + rw [← C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩] + simp [TreeSequenceVertexSet] + have hdcard : 2 ≤ + (BoundaryColorEdges G phi (TreeSequenceVertexSet T) d.1).card := by + have hd := (Finset.mem_filter.mp d.2).2 + simpa only [DefectiveColor] using hd + obtain ⟨bDelta, hbDelta⟩ := Finset.card_pos.mp + (lt_of_lt_of_le Nat.zero_lt_two hdcard) + have hbDeltaBoundary : bDelta ∈ BoundaryEdges G (TreeSequenceVertexSet T) := + (Finset.mem_filter.mp hbDelta).1 + have hbDeltaColor : phi bDelta = some d.1 := + (Finset.mem_filter.mp hbDelta).2 + have hAlpha0Delta : D.alpha0 ≠ d.1 := by + intro h + have hnot := hclosed hbDeltaBoundary hy0 hbDeltaColor + exact hnot (by simpa [h] using D.alpha0_missing_at_y0) + have hGammaDelta : C.gamma (D.gammaIndex d) ≠ d.1 := by + intro h + have hmissing := D.gamma_missing_at_v0 d + have hinc : Incident G (D.v0 d) (D.f0 d) := by + change D.v0 d ∈ G.ends (D.f0 d) + rw [D.f0_ends] + simp + have hpresent : C.gamma (D.gammaIndex d) ∈ + PresentColors G phi (D.v0 d) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨D.f0 d, hinc, by simpa [h] using D.f0_color d⟩ + exact (Finset.mem_sdiff.mp hmissing).2 hpresent + have colorFixed (c : Fin k) + (hcGamma : c ≠ C.gamma (D.gammaIndex d)) (hcDelta : c ≠ d.1) + (f : E) : + TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) f = some c ↔ phi f = some c := by + simp only [TwoColorComponentSwap] + by_cases hf : Sum.inr f ∈ TwoColorComponent G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + · simp only [hf, ite_eq_left] + by_cases hfg : phi f = some (C.gamma (D.gammaIndex d)) + · rw [hfg] + simp only [ite_eq_left] + constructor + · intro hnew + exact False.elim (hcDelta (Option.some.inj hnew).symm) + · intro hold + exact False.elim (hcGamma (Option.some.inj hold).symm) + · by_cases hfd : phi f = some d.1 + · rw [hfd] + simp only [Option.some.injEq, hGammaDelta.symm, ite_false, ite_eq_left] + constructor + · intro hnew + exact False.elim (hcGamma hnew.symm) + · intro hold + exact False.elim (hcDelta hold.symm) + · simp [hfg, hfd] + · simp [hf] + have hgraph : TwoColorIncidenceGraph G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha := by + exact @ScheideReplacementConfinement_hgraph_272 V E inferInstance inferInstance inferInstance + G k e0 phi T C D alpha d hAlphaDelta hAlphaGamma hAlpha0Gamma hAlpha0Delta colorFixed + have hused := ScheideReplacementUsedWitness G k e0 phi T C D R d + obtain ⟨hfree, hnondef⟩ := + ScheideReplacementExitNotDefective G k e0 phi T C D R alpha L hlast + d hpair hgraph + have hprefix := ScheideReplacementPathPrefix G k e0 phi T C D R alpha L + d hpair hgraph hnondef + have hboundary := ScheideReplacementBoundaryUnique G k e0 phi T C D R + alpha L d hprefix + exact ⟨d, hpair, hgraph, hused, hfree, hnondef, hprefix, hboundary⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementData.lean b/LeanPool/GoldbergSeymour/ScheideReplacementData.lean new file mode 100644 index 0000000000..57e8863bb7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementData.lean @@ -0,0 +1,127 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap + +/-! +# Scheide Replacement Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- Two defective boundary edges and a replacement tree with the prescribed retained and final +positions. +-/ +structure ScheideReplacementData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) }) where + /-- The first selected boundary edge. -/ + f1 : E + /-- The second selected boundary edge. -/ + f2 : E + /-- The first selected vertex inside the tree. -/ + v1 : V + /-- The second selected vertex inside the tree. -/ + v2 : V + /-- The first selected outside vertex. -/ + u1 : V + /-- The second selected outside vertex. -/ + u2 : V + f0_ne_f1 : D.f0 d ≠ f1 + f0_ne_f2 : D.f0 d ≠ f2 + f1_ne_f2 : f1 ≠ f2 + v1_in_remainder : + v1 ∈ + TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} + v2_in_remainder : + v2 ∈ + TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} + u1_outside : u1 ∉ TreeSequenceVertexSet T + u2_outside : u2 ∉ TreeSequenceVertexSet T + f1_ends : G.ends f1 = s(v1, u1) + f2_ends : G.ends f2 = s(v2, u2) + f1_color : phi f1 = some d.1 + f2_color : phi f2 = some d.1 + exact_three : + ∀ f : E, (f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1}) d.1 ∧ + ∃ w, w ∉ TreeSequenceVertexSet T ∧ Incident G w f) ↔ f = D.f0 d ∨ f = f1 ∨ f = f2 + /-- The reordered tree retaining the prescribed vertices and edges. -/ + replacementTree : TreeSequence G e0 + replacement_length : replacementTree.length = T.length + retained_edges_before : + ∀ q : ℕ, + q < C.p - 1 + 2 * (D.gammaIndex d).val → + ∀ hq : q < T.length, replacementTree.edge ⟨q, by omega⟩ = T.edge ⟨q, hq⟩ + retained_vertices_before : + ∀ q : ℕ, + q ≤ C.p - 1 + 2 * (D.gammaIndex d).val → + ∀ hq : q < T.length + 1, replacementTree.vertex ⟨q, by omega⟩ = T.vertex ⟨q, hq⟩ + retained_edges_after : + ∀ q : ℕ, + C.p - 1 + 2 * (D.gammaIndex d).val ≤ q → + ∀ hq : q + 2 < T.length, replacementTree.edge ⟨q, by omega⟩ = T.edge ⟨q + 2, hq⟩ + retained_vertices_after : + ∀ q : ℕ, + C.p - 1 + 2 * (D.gammaIndex d).val < q → + ∀ hq : q + 2 < T.length + 1, replacementTree.vertex ⟨q, by omega⟩ = T.vertex ⟨q + 2, hq⟩ + replacement_last_edges : + replacementTree.edge + ⟨T.length - 2, by + have hi := (D.gammaIndex d).isLt + have hp := C.p_ge_two + have hc := C.length_eq + have _ := replacement_length + omega⟩ = + f1 ∧ + replacementTree.edge + ⟨T.length - 1, by + have hi := (D.gammaIndex d).isLt + have hp := C.p_ge_two + have hc := C.length_eq + have _ := replacement_length + omega⟩ = + f2 + replacement_last_vertices : + replacementTree.vertex + ⟨T.length - 1, by + have _ := (D.gammaIndex d).isLt + have _ := C.p_ge_two + have hc := C.length_eq + have _ := replacement_length + omega⟩ = + u1 ∧ + replacementTree.vertex + ⟨T.length, by + have _ := replacement_length + omega⟩ = + u2 + replacement_vertices : + TreeSequenceVertexSet replacementTree = + (TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1}) ∪ + { u1, u2 } + replacement_edges : + Finset.univ.image replacementTree.edge = + (((Finset.univ.image T.edge).erase (C.blockEdge (D.gammaIndex d) 0)).erase + (C.blockEdge (D.gammaIndex d) 1)) ∪ + { f1, f2 } + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementExitNotDefective.lean b/LeanPool/GoldbergSeymour/ScheideReplacementExitNotDefective.lean new file mode 100644 index 0000000000..5b3e63a5da --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementExitNotDefective.lean @@ -0,0 +1,234 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideLastExitPath +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideReplacementUsedWitness + +/-! +# Scheide Replacement Exit Not Defective + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideReplacementExitNotDefective {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) + (alpha : Fin k) + (L : ScheideLastExitPath G k e0 phi T C D R alpha) + (hlast : L.lastInside ∉ TreeSequenceVertexSet T) + (d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}) + (hpair : L.lastInside ∈ ({(R d).u1, (R d).u2} : Finset V)) + (hgraph : TwoColorIncidenceGraph G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha) : + (∃ beta, + beta ∈ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) L.lastInside ∧ + beta ∈ TreeFreeColors + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) (R d).replacementTree) ∧ + alpha ∉ DefectiveColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) + (TreeSequenceVertexSet (R d).replacementTree) := by + classical + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + let Td := (R d).replacementTree + let VT := TreeSequenceVertexSet Td + let Z := TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} + let X := ScheideEnlargedVertexSet R + let y0 : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hmaximum := ScheideReplacementMaximum G k e0 phi T C D d (R d) + dsimp at hmaximum + have hglobal : GlobalMaximumTriple G k e0 phiD Td := by + simpa [phiD, Td] using hmaximum.2.2 + have horder := ScheideGlobalMaximumOrder G k e0 phiD Td hglobal + have helementary : ColoredVertexSetElementary G phiD VT := by + change ColoredVertexSetElementary G phiD (TreeSequenceVertexSet Td) + exact horder.2.2.2.1 + have hVTsubX : VT ⊆ X := by + intro v hv + change v ∈ TreeSequenceVertexSet (R d).replacementTree at hv + rw [(R d).replacement_vertices] at hv + unfold X ScheideEnlargedVertexSet + rw [Finset.mem_union] + rcases Finset.mem_union.mp hv with hv | hv + · exact Or.inl (Finset.mem_sdiff.mp hv).1 + · refine Or.inr (Finset.mem_biUnion.mpr ?_) + exact ⟨d, Finset.mem_univ d, hv⟩ + have hbaseZ : ∀ a : Fin C.p, C.y a ∈ Z := by + intro a + have haT : C.y a ∈ TreeSequenceVertexSet T := by + rw [← C.base_vertex_position a] + simp [TreeSequenceVertexSet] + refine Finset.mem_sdiff.mpr ⟨haT, ?_⟩ + simp only [Finset.mem_insert, Finset.mem_singleton] + intro heq + rcases heq with heq | heq + · have hi := T.vertex_injective (C.base_vertex_position a |>.trans + (heq ▸ (C.block_vertex_position (D.gammaIndex d) (0 : Fin 2))).symm) + have hv := congrArg Fin.val hi + have hp := C.p_ge_two + have hr := (D.gammaIndex d).isLt + simp at hv + omega + · have hi := T.vertex_injective (C.base_vertex_position a |>.trans + (heq ▸ (C.block_vertex_position (D.gammaIndex d) (1 : Fin 2))).symm) + have hv := congrArg Fin.val hi + have hp := C.p_ge_two + have hr := (D.gammaIndex d).isLt + simp at hv + omega + have hy0Z : y0 ∈ Z := by + simpa [y0] using hbaseZ + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hy0T : y0 ∈ TreeSequenceVertexSet T := by + exact Finset.mem_sdiff.mp hy0Z |>.1 + have hy0VT : y0 ∈ VT := by + change y0 ∈ TreeSequenceVertexSet (R d).replacementTree + rw [(R d).replacement_vertices] + exact Finset.mem_union_left _ hy0Z + have hvVT : L.lastInside ∈ VT := by + change L.lastInside ∈ TreeSequenceVertexSet (R d).replacementTree + rw [(R d).replacement_vertices] + exact Finset.mem_union_right _ hpair + have heffect := ScheideDefectiveSwitchEffect G k e0 phi T C D d + dsimp at heffect + have hy0Missing : D.alpha0 ∈ MissingColors G phiD y0 := by + by_cases heq : y0 = D.v0 d + · rw [heq] + change D.alpha0 ∈ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) (D.v0 d) + rw [heffect.2.2.2.1] + apply Finset.mem_insert_of_mem + apply Finset.mem_erase.mpr + exact ⟨D.alpha0_not_block (D.gammaIndex d), by + simpa [y0, heq] using D.alpha0_missing_at_y0⟩ + · change D.alpha0 ∈ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) y0 + rw [heffect.2.2.2.2.2.1 y0 hy0T heq] + simpa [y0] using D.alpha0_missing_at_y0 + have hmissingNonempty : (MissingColors G phiD L.lastInside).Nonempty := by + have hcounts := ScheideGlobalMaximumMissingCounts G k e0 phiD Td hglobal + L.lastInside hvVT + by_cases hincident : Incident G L.lastInside e0 + · apply Finset.card_pos.mp + have hcard := (hcounts.1 hincident).2 + omega + · apply Finset.card_pos.mp + have hcard := (hcounts.2 hincident).2 + omega + obtain ⟨beta, hbetaMissing⟩ := hmissingNonempty + have hbetaUnused : beta ∉ TreeUsedColors phiD Td := by + intro hused + have hused' : beta ∈ TreeUsedColors + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) (R d).replacementTree := by + simpa [phiD, Td] using hused + obtain ⟨z, hzZ, hzMissing⟩ := + ScheideReplacementUsedWitness G k e0 phi T C D R d beta hused' + have hzVT : z ∈ VT := by + change z ∈ TreeSequenceVertexSet (R d).replacementTree + rw [(R d).replacement_vertices] + exact Finset.mem_union_left _ hzZ + have hzne : z ≠ L.lastInside := by + intro heq + exact hlast (heq ▸ (Finset.mem_sdiff.mp hzZ).1) + have hdisjoint := helementary hzVT hvVT hzne + exact (Finset.disjoint_left.mp hdisjoint) (by + simpa [phiD] using hzMissing) hbetaMissing + have hbetaFree : beta ∈ TreeFreeColors phiD Td := by + apply Finset.mem_sdiff.mpr + refine ⟨?_, hbetaUnused⟩ + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨L.lastInside, hvVT, hbetaMissing⟩ + refine ⟨⟨beta, hbetaMissing, hbetaFree⟩, ?_⟩ + intro halphaDefective + have hswapGraphs : ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), + TwoColorIncidenceGraph G psi a b = + TwoColorIncidenceGraph G psi b a := by + intro psi a b + ext x y + cases x <;> cases y <;> + simp only [TwoColorIncidenceGraph, and_congr_right_iff] + all_goals aesop + have hgivenGraph : TwoColorIncidenceGraph G phiD D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha := by + simpa [phiD] using hgraph + have htransportGraph : TwoColorIncidenceGraph G phiD alpha D.alpha0 = + TwoColorIncidenceGraph G phi D.alpha0 alpha := by + calc + TwoColorIncidenceGraph G phiD alpha D.alpha0 = + TwoColorIncidenceGraph G phiD D.alpha0 alpha := + hswapGraphs phiD alpha D.alpha0 + _ = TwoColorIncidenceGraph G phi D.alpha0 alpha := hgivenGraph + have hgraphLe : TwoColorIncidenceGraph G phi D.alpha0 alpha ≤ + TwoColorIncidenceGraph G phiD alpha D.alpha0 := by + rw [htransportGraph] + let pD : (TwoColorIncidenceGraph G phiD alpha D.alpha0).Walk + (Sum.inl y0) (Sum.inl L.terminal) := L.path.mapLe hgraphLe + have hpD : ScheideDefectiveChainPath Td phiD alpha D.alpha0 + y0 L.terminal pD := by + refine ⟨hy0VT, ?_, ?_, ?_⟩ + · simpa [pD] using L.pathSimple + · intro hterminal + exact L.terminalOutside (hVTsubX hterminal) + · have hcomponentEq : + TwoColorComponent G phiD alpha D.alpha0 (Sum.inl y0) = + TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0) := by + unfold TwoColorComponent + rw [htransportGraph] + rw [hcomponentEq] + simpa [pD, y0] using L.pathSpans + let lastIndexD : Fin (pD.length + 1) := ⟨L.lastIndex.val, by + simpa [pD] using L.lastIndex.isLt⟩ + have hlastAt : pD.getVert lastIndexD.val = Sum.inl L.lastInside := by + simpa [pD, lastIndexD] using L.lastInsideAt + have hafter : ∀ r : Fin (pD.length + 1), lastIndexD.val < r.val → + ∀ w : V, pD.getVert r.val = Sum.inl w → w ∉ VT := by + intro r hir w hw + let rL : Fin (L.path.length + 1) := ⟨r.val, by + simpa [pD] using r.isLt⟩ + have hirL : L.lastIndex.val < rL.val := by + simpa [lastIndexD, rL] using hir + have hwL : L.path.getVert rL.val = Sum.inl w := by + simpa [pD, rL] using hw + intro hwVT + exact (L.afterLastOutside rL hirL w hwL) (hVTsubX hwVT) + have hexit : ScheideExitVertex Td phiD L.lastInside := by + refine ⟨y0, D.alpha0, alpha, hy0VT, hy0Missing, + halphaDefective, L.terminal, pD, hpD, lastIndexD, + hlastAt, hvVT, ?_⟩ + exact hafter + have hexitMem : L.lastInside ∈ ScheideExitVertices Td phiD := by + simpa [ScheideExitVertices] using hexit + have hnoFree := ScheideExitNoFree G k e0 phiD Td hglobal + L.lastInside hexitMem + exact (Finset.disjoint_left.mp hnoFree) hbetaMissing hbetaFree + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementFamilyExists.lean b/LeanPool/GoldbergSeymour/ScheideReplacementFamilyExists.lean new file mode 100644 index 0000000000..92a3e80409 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementFamilyExists.lean @@ -0,0 +1,176 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryAtLeastThree +public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryAtMostThree + +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementTreeSplice + +/-! +# Scheide Replacement Family Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem ScheideReplacementFamilyExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) : + Nonempty (∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) := by + classical + refine ⟨fun d => ?_⟩ + let X := TreeSequenceVertexSet T + let Z := X \ {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} + letI outsideDec : DecidablePred (fun f : E => + ∃ w, w ∉ X ∧ Incident G w f) := + fun _ => Classical.propDecidable _ + let B := (BoundaryColorEdges G phi Z d.1).filter + (fun f => ∃ w, w ∉ X ∧ Incident G w f) + have hparity := ScheideReplacementBoundaryParity G k e0 phi T C D d + have hupper := ScheideReplacementBoundaryAtMostThree G k e0 phi T C D d + have hlower := ScheideReplacementBoundaryAtLeastThree G k e0 phi T C D d + dsimp only at hparity hupper hlower + have hv0Z : D.v0 d ∈ Z := by simpa [X, Z] using hparity.1 + have hf0B : D.f0 d ∈ B := by simpa [X, Z, B] using hparity.2.2.2.1 + change B.card ≤ 3 at hupper + change 3 ≤ B.card at hlower + have hupperB : B.card ≤ 3 := hupper + have hlowerB : 3 ≤ B.card := hlower + have hBcard : B.card = 3 := by omega + have hEraseCard : (B.erase (D.f0 d)).card = 2 := by + rw [Finset.card_erase_of_mem hf0B, hBcard] + have hpair := Finset.card_eq_two.mp hEraseCard + let f1 : E := Classical.choose hpair + have hpair1 := Classical.choose_spec hpair + let f2 : E := Classical.choose hpair1 + have hpair2 := Classical.choose_spec hpair1 + have hf1f2 : f1 ≠ f2 := hpair2.1 + have hErase : B.erase (D.f0 d) = {f1, f2} := hpair2.2 + have hf1Erase : f1 ∈ B.erase (D.f0 d) := by + rw [hErase] + simp + have hf2Erase : f2 ∈ B.erase (D.f0 d) := by + rw [hErase] + simp + have hf1B : f1 ∈ B := (Finset.mem_erase.mp hf1Erase).2 + have hf2B : f2 ∈ B := (Finset.mem_erase.mp hf2Erase).2 + have hf0f1 : D.f0 d ≠ f1 := (Finset.mem_erase.mp hf1Erase).1.symm + have hf0f2 : D.f0 d ≠ f2 := (Finset.mem_erase.mp hf2Erase).1.symm + have hB : B = {D.f0 d, f1, f2} := by + simpa [hErase] using (Finset.insert_erase hf0B).symm + have orient (f : E) (hf : f ∈ B) : + ∃ v ∈ Z, ∃ u ∉ X, + G.ends f = s(v, u) ∧ phi f = some d.1 := by + have hfFilter := Finset.mem_filter.mp hf + rcases hfFilter.2 with ⟨w, hwX, hwf⟩ + have hfColor := (Finset.mem_filter.mp hfFilter.1).2 + have hfBoundary := (Finset.mem_filter.mp hfFilter.1).1 + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hfBoundary + rcases hfBoundary with ⟨v, hvZ, u, huZ, hends⟩ + have hwPair : w = v ∨ w = u := by + simpa [Incident, hends] using hwf + have hwv : w ≠ v := by + intro heq + apply hwX + rw [heq] + exact (Finset.mem_sdiff.mp hvZ).1 + have hwu : w = u := hwPair.resolve_left hwv + refine ⟨v, hvZ, u, ?_, hends, hfColor⟩ + simpa [hwu] using hwX + have hf1Orient := orient f1 hf1B + let v1 : V := Classical.choose hf1Orient + have hf1Orient1 := Classical.choose_spec hf1Orient + have hv1Z : v1 ∈ Z := hf1Orient1.1 + let u1 : V := Classical.choose hf1Orient1.2 + have hf1Orient2 := Classical.choose_spec hf1Orient1.2 + have hu1X : u1 ∉ X := hf1Orient2.1 + have hf1Ends : G.ends f1 = s(v1, u1) := hf1Orient2.2.1 + have hf1Color : phi f1 = some d.1 := hf1Orient2.2.2 + have hf2Orient := orient f2 hf2B + let v2 : V := Classical.choose hf2Orient + have hf2Orient1 := Classical.choose_spec hf2Orient + have hv2Z : v2 ∈ Z := hf2Orient1.1 + let u2 : V := Classical.choose hf2Orient1.2 + have hf2Orient2 := Classical.choose_spec hf2Orient1.2 + have hu2X : u2 ∉ X := hf2Orient2.1 + have hf2Ends : G.ends f2 = s(v2, u2) := hf2Orient2.2.1 + have hf2Color : phi f2 = some d.1 := hf2Orient2.2.2 + have hu1u2 : u1 ≠ u2 := by + intro hu + have hi1 : Incident G u1 f1 := by + simp [Incident, hf1Ends] + have hi2 : Incident G u1 f2 := by + simp [Incident, hf2Ends, hu] + have hadj : AdjacentEdges G f1 f2 := ⟨u1, hi1, hi2⟩ + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + exact (hproper hf1f2 hadj hf1Color) hf2Color + have hExactThree : + ∀ f : E, (f ∈ BoundaryColorEdges G phi Z d.1 ∧ + ∃ w, w ∉ X ∧ Incident G w f) ↔ f = D.f0 d ∨ f = f1 ∨ f = f2 := by + intro f + have hmem : + (f ∈ BoundaryColorEdges G phi Z d.1 ∧ + ∃ w, w ∉ X ∧ Incident G w f) ↔ f ∈ B := by + simp [B] + rw [hmem, hB] + simp + have hsplice := ScheideReplacementTreeSplice G k e0 phi T C D d + f1 f2 v1 v2 u1 u2 hf1f2 hu1u2 hv1Z hv2Z hu1X hu2X + hf1Ends hf2Ends + let replacementTree : TreeSequence G e0 := Classical.choose hsplice + have hsplice1 := Classical.choose_spec hsplice + let replacementLength : replacementTree.length = T.length := + Classical.choose hsplice1 + have hsplice2 := Classical.choose_spec hsplice1 + exact { + f1 := f1 + f2 := f2 + v1 := v1 + v2 := v2 + u1 := u1 + u2 := u2 + f0_ne_f1 := hf0f1 + f0_ne_f2 := hf0f2 + f1_ne_f2 := hf1f2 + v1_in_remainder := hv1Z + v2_in_remainder := hv2Z + u1_outside := hu1X + u2_outside := hu2X + f1_ends := hf1Ends + f2_ends := hf2Ends + f1_color := hf1Color + f2_color := hf2Color + exact_three := by simpa [X, Z] using hExactThree + replacementTree := replacementTree + replacement_length := replacementLength + retained_edges_before := hsplice2.1 + retained_vertices_before := hsplice2.2.1 + retained_edges_after := hsplice2.2.2.1 + retained_vertices_after := hsplice2.2.2.2.1 + replacement_last_edges := hsplice2.2.2.2.2.1 + replacement_last_vertices := hsplice2.2.2.2.2.2.1 + replacement_vertices := hsplice2.2.2.2.2.2.2.1 + replacement_edges := hsplice2.2.2.2.2.2.2.2 } + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementInternalMissing.lean b/LeanPool/GoldbergSeymour/ScheideReplacementInternalMissing.lean new file mode 100644 index 0000000000..6f08388c34 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementInternalMissing.lean @@ -0,0 +1,161 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed + +/-! +# Scheide Replacement Internal Missing + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem ScheideReplacementInternalMissing {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + ∀ alpha : Fin k, alpha ≠ C.gamma (D.gammaIndex d) → ( + ∃ z ∈ TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1}, alpha ∈ + MissingColors G phi z) → + ∃ f : E, phi f = some alpha ∧ G.ends f = s(R.u1, R.u2) := by + classical + intro alpha halpha hdata + rcases hdata with ⟨z, hz, hzm⟩ + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + have hmax := ScheideReplacementMaximum G k e0 phi T C D d R + dsimp [phiD] at hmax ⊢ + have horder := ScheideGlobalMaximumOrder G k e0 phiD R.replacementTree hmax.2.2 + have hproper : IsProperEdgeColoring G phiD := hmax.1 + have helem : ColoredVertexSetElementary G phiD + (TreeSequenceVertexSet R.replacementTree) := horder.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phiD + (TreeSequenceVertexSet R.replacementTree) := horder.2.2.2.2 + have hold := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have holdclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + hold.2.2.2.2 + have hdelta_ne : alpha ≠ d.1 := by + intro heq + have hd : 2 ≤ (BoundaryColorEdges G phi (TreeSequenceVertexSet T) d.1).card := + (Finset.mem_filter.mp d.2).2 + have hpos : (BoundaryColorEdges G phi (TreeSequenceVertexSet T) d.1).Nonempty := + Finset.card_pos.mp (lt_of_lt_of_le Nat.zero_lt_two hd) + rcases hpos with ⟨f, hf⟩ + have hparts := Finset.mem_filter.mp hf + have hfb : f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := hparts.1 + have hfc : phi f = some d.1 := hparts.2 + have hn := holdclosed hfb (Finset.mem_sdiff.mp hz).1 hfc + exact hn (heq ▸ hzm) + have hsw := ScheideDefectiveSwitchEffect G k e0 phi T C D d + dsimp at hsw + have hzmD : alpha ∈ MissingColors G phiD z := by + have hn : alpha ∉ PresentColors G phiD z := by + intro hp + rcases (show ∃ e, Incident G z e ∧ phiD e = some alpha by + simpa [PresentColors] using hp) with ⟨e, he, hc⟩ + have ho : phi e = some alpha := by + by_cases hk : Sum.inr e ∈ + TwoColorComponent G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) + · rw [show phiD e = + (if phi e = some (C.gamma (D.gammaIndex d)) then some d.1 + else if phi e = some d.1 then some (C.gamma (D.gammaIndex d)) + else phi e) by simp [phiD, TwoColorComponentSwap, hk]] at hc + by_cases hg : phi e = some (C.gamma (D.gammaIndex d)) + · simp [hg] at hc + exact False.elim (hdelta_ne hc.symm) + · by_cases hd : phi e = some d.1 + · by_cases hdg : d.1 = C.gamma (D.gammaIndex d) + · simp [hd, hdg] at hc + exact False.elim (halpha hc.symm) + · simp [hd, hdg] at hc + exact False.elim (halpha hc.symm) + · simpa [hg, hd] using hc + · simpa [phiD, TwoColorComponentSwap, hk] using hc + exact (Finset.mem_sdiff.mp hzm).2 (by + simpa [PresentColors] using ⟨e, he, ho⟩) + exact Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, hn⟩ + have hzrep : z ∈ TreeSequenceVertexSet R.replacementTree := by + rw [R.replacement_vertices] + exact Finset.mem_union.mpr (Or.inl hz) + have hne1 : z ≠ R.u1 := by + intro e + subst e + exact R.u1_outside (Finset.mem_sdiff.mp hz).1 + have hne2 : z ≠ R.u2 := by + intro e + subst e + exact R.u2_outside (Finset.mem_sdiff.mp hz).1 + have hp1 : alpha ∈ PresentColors G phiD R.u1 := by + have hu : R.u1 ∈ TreeSequenceVertexSet R.replacementTree := by + rw [R.replacement_vertices] + simp [R.u1_outside] + have hdj := helem (u := z) hzrep (v := R.u1) hu hne1 + have hn : alpha ∉ MissingColors G phiD R.u1 := by + intro hu + exact Finset.disjoint_left.mp hdj hzmD hu + simpa [MissingColors] using hn + rcases (show ∃ e, Incident G R.u1 e ∧ phiD e = some alpha by + simpa [PresentColors] using hp1) with ⟨f, hf1, hfc⟩ + have hfu2 : Incident G R.u2 f := by + obtain ⟨w, hends⟩ := Sym2.mem_iff_exists.mp hf1 + have hwrep : w ∈ TreeSequenceVertexSet R.replacementTree := by + by_contra hwout + have hfb : f ∈ BoundaryEdges G (TreeSequenceVertexSet R.replacementTree) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + have hu : R.u1 ∈ TreeSequenceVertexSet R.replacementTree := by + rw [R.replacement_vertices] + simp [R.u1_outside] + exact ⟨R.u1, hu, w, hwout, hends⟩ + exact hclosed hfb hzrep hfc hzmD + rw [R.replacement_vertices] at hwrep + rcases Finset.mem_union.mp hwrep with hwz | hwu + · have hfb : f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, (Finset.mem_sdiff.mp hwz).1, R.u1, R.u1_outside, + by simpa [Sym2.eq_swap] using hends⟩ + have horig : phi f = some alpha := by + have hi := ScheideReplacementPairFixed G k e0 phi T C D d R f (Or.inl hf1) + exact hi.symm.trans hfc + have hn := holdclosed hfb (Finset.mem_sdiff.mp hz).1 horig + exact False.elim (hn hzm) + · simp only [Finset.mem_insert, Finset.mem_singleton] at hwu + rcases hwu with rfl | rfl + · exact False.elim (G.loopless f R.u1 (by simp [hends])) + · change R.u2 ∈ G.ends f + rw [hends] + exact Sym2.mem_mk_right R.u1 R.u2 + have hu1u2 : R.u1 ≠ R.u2 := by + intro h + have hi := R.replacementTree.vertex_injective + (R.replacement_last_vertices.1.trans + (h.trans R.replacement_last_vertices.2.symm)) + have hv : T.length - 1 = T.length := by + simpa using congrArg Fin.val hi + have ht := T.positive + omega + have hfixed := ScheideReplacementPairFixed G k e0 phi T C D d R f (Or.inl hf1) + exact ⟨f, hfixed.symm.trans hfc, by + exact (Sym2.mem_and_mem_iff hu1u2).mp ⟨hf1, hfu2⟩⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementMaximum.lean b/LeanPool/GoldbergSeymour/ScheideReplacementMaximum.lean new file mode 100644 index 0000000000..bfb8513173 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementMaximum.lean @@ -0,0 +1,438 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Replacement Maximum + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev ScheideReplacementMaximumBranch56Branch173Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let phiD := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)); (IsProperEdgeColoring G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) e0 ∧ TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) (D.f0 d) = some (C.gamma + (D.gammaIndex d)) ∧ MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (D.v0 d) = insert (↑d : Fin k) ((MissingColors G phi + (D.v0 d)).erase (C.gamma (D.gammaIndex d))) ∧ ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → ¬f = D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, ¬v = D.v0 d → MissingColors G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) ∧ + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) → + ∀ (j : Fin R.replacementTree.length), 1 ≤ (↑j : ℕ) → R.replacementTree.length = T.length → 1 ≤ + T.length → ( + ∀ (q : ℕ) (hq : q < T.length), T.edge ⟨q, hq⟩ ≠ D.f0 d → phiD (T.edge ⟨q, hq⟩) = phi (T.edge + ⟨q, hq⟩)) → ( + ∀ v ∈ TreeSequenceVertexSet T, v ≠ D.v0 d → MissingColors G phiD v = MissingColors G phi v) → + let alpha := C.gamma (D.gammaIndex d); ( + ∀ (c : Fin k), c ≠ alpha → c ∈ MissingColors G phi (D.v0 d) → c ∈ MissingColors G phiD (D.v0 + d)) → ¬(↑j : ℕ) < C.p - 1 + 2 * (↑(D.gammaIndex d) : ℕ) → + ∃ (i : Fin ((↑j : ℕ) + 1)) (c : Fin k), TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)) (R.replacementTree.edge j) = some c ∧ c ∈ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (R.replacementTree.vertex (i.castLT (( + by + first + | omega + )))) + +private theorem ScheideReplacementMaximum_branch_56_branch_89.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let phiD := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)); TashkinovTree G e0 phi T → + ∀ (j : Fin R.replacementTree.length), 1 ≤ (↑j : ℕ) → R.replacementTree.length = T.length → ( + ∀ (q : ℕ) (hq : q < T.length), T.edge ⟨q, hq⟩ ≠ D.f0 d → phiD (T.edge ⟨q, hq⟩) = phi (T.edge + ⟨q, hq⟩)) → ( + ∀ v ∈ TreeSequenceVertexSet T, v ≠ D.v0 d → MissingColors G phiD v = MissingColors G phi v) → + let alpha := C.gamma (D.gammaIndex d); ( + ∀ (c : Fin k), c ≠ alpha → c ∈ MissingColors G phi (D.v0 d) → c ∈ MissingColors G phiD (D.v0 + d)) → (↑j : ℕ) < C.p - 1 + 2 * (↑(D.gammaIndex d) : ℕ) → + ∃ (i : Fin ((↑j : ℕ) + 1)) (c : Fin k), TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d)) (R.replacementTree.edge j) = some c ∧ c ∈ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (R.replacementTree.vertex (i.castLT (( + by first | omega + )))) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R phiD htree j hj hlen edge_fixed missing_fixed alpha + alpha_ne hbefore + have hjold : j.val < T.length := by omega + obtain ⟨i, c, he, hm⟩ := htree ⟨j.val, hjold⟩ (by omega) + have hi := i.isLt + have hij : i.val ≤ j.val := Nat.le_of_lt_succ hi + have hcast : i.val < R.replacementTree.length := by omega + refine ⟨⟨i.val, by omega⟩, c, ?_, ?_⟩ + · rw [R.retained_edges_before j.val hbefore (by omega)] + have hfix := edge_fixed j.val (by omega) (by + intro hzero + have hz := D.f0_ends d + have ha := T.attaches ⟨j.val, by omega⟩ + rw [hzero] at ha + have hu := D.u0_outside d + obtain ⟨q, hq⟩ := ha + have huend : D.u0 d ∈ G.ends (T.edge ⟨j.val, by omega⟩) := by + rw [hzero, D.f0_ends] + simp + rw [hzero, hq] at huend + have huvertex : D.u0 d = T.vertex ⟨j.val + 1, by omega⟩ ∨ + D.u0 d = T.vertex (q.castLT (by omega)) := by + simpa using huend + have huin : D.u0 d ∈ TreeSequenceVertexSet T := by + rcases huvertex with hleft | hright + · simp [TreeSequenceVertexSet, hleft] + · simp [TreeSequenceVertexSet, hright] + exact hu huin) + change phiD (T.edge ⟨j.val, by omega⟩) = some c + rw [hfix] + exact he + · change c ∈ MissingColors G phiD (R.replacementTree.vertex ⟨i.val, by omega⟩) + rw [R.retained_vertices_before i.val (by omega) (by omega)] + by_cases hi0 : (T.vertex ⟨i.val, by omega⟩) = D.v0 d + · by_cases hsmall : j.val < C.p - 1 + · have hc : c ≠ alpha := by + dsimp [alpha] + intro hac + have havoid := C.initial_nonfirst_avoids_blocks ⟨j.val, by omega⟩ (by omega) c + (by simpa [C.base_edge_position ⟨j.val, by omega⟩] using he) (D.gammaIndex d) + exact havoid (hac.trans rfl) + rw [hi0] + apply alpha_ne c hc + rw [← hi0] + exact hm + · let h : Fin C.s := ⟨(j.val - (C.p - 1)) / 2, by omega⟩ + have hcolor : c = C.gamma h := by + have hdiv := Nat.mod_add_div (j.val - (C.p - 1)) 2 + have hlenC := C.length_eq + have hval : h.val = (j.val - (C.p - 1)) / 2 := rfl + have hb := C.block_color h ⟨(j.val - (C.p - 1)) % 2, by omega⟩ + have hentry : T.edge ⟨j.val, by omega⟩ = + C.blockEdge h ⟨(j.val - (C.p - 1)) % 2, by omega⟩ := by + calc + T.edge ⟨j.val, by omega⟩ = + T.edge ⟨C.p - 1 + 2 * h.val + ((j.val - (C.p - 1)) % 2), by omega⟩ := by + apply congrArg T.edge + apply Fin.ext + have hnum : C.p - 1 + 2 * h.val + + ((j.val - (C.p - 1)) % 2) = j.val := by + dsimp [h] + omega + exact hnum.symm + _ = C.blockEdge h ⟨(j.val - (C.p - 1)) % 2, by omega⟩ := + C.block_edge_position h ⟨(j.val - (C.p - 1)) % 2, by omega⟩ + rw [hentry] at he + exact Option.some.inj (he.symm.trans hb) + have hne : c ≠ alpha := by + intro hh + dsimp [alpha] at hh + have heq := C.gamma_injective (hcolor.symm.trans hh) + have hlt := h.isLt + have hr := (D.gammaIndex d).isLt + have heqv := congrArg Fin.val heq + dsimp [h] at hlt heqv + omega + rw [hi0] + apply alpha_ne c hne + rw [← hi0] + exact hm + · rw [missing_fixed _ (by simp [TreeSequenceVertexSet]) hi0] + have hv : T.vertex (⟨i.val, by omega⟩ : Fin (T.length + 1)) = + T.vertex (i.castLT (by omega)) := by + congr 1 + rw [hv] + exact hm + +private theorem ScheideReplacementMaximum_branch_56_branch_173.{u_1, u_2} : + ScheideReplacementMaximumBranch56Branch173Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R phiD heffect j hj hlen hpos edge_fixed missing_fixed + alpha alpha_ne hbefore + by_cases hafter : j.val + 2 < T.length + · have hjold : j.val < T.length := by omega + let h : Fin C.s := ⟨(j.val + 2 - (C.p - 1)) / 2, by + have hc := C.length_eq + omega⟩ + have hdiv := Nat.mod_add_div (j.val + 2 - (C.p - 1)) 2 + have hnum : C.p - 1 + 2 * h.val + + ((j.val + 2 - (C.p - 1)) % 2) = j.val + 2 := by + dsimp [h] + omega + have hentry : T.edge ⟨j.val + 2, hafter⟩ = + C.blockEdge h ⟨(j.val + 2 - (C.p - 1)) % 2, by omega⟩ := by + calc + T.edge ⟨j.val + 2, hafter⟩ = + T.edge ⟨C.p - 1 + 2 * h.val + + ((j.val + 2 - (C.p - 1)) % 2), by omega⟩ := by + apply congrArg T.edge + apply Fin.ext + exact hnum.symm + _ = _ := C.block_edge_position h + ⟨(j.val + 2 - (C.p - 1)) % 2, by omega⟩ + have hcolor : phi (T.edge ⟨j.val + 2, hafter⟩) = some (C.gamma h) := by + rw [hentry] + exact C.block_color h _ + obtain ⟨q, hq⟩ := C.block_color_missing_on_base h + have hbase : T.vertex ⟨q.val, by omega⟩ = C.y q := C.base_vertex_position q + have hneq : C.gamma h ≠ alpha := by + intro heq + have hh := C.gamma_injective (heq.symm.trans rfl) + have hh' := congrArg Fin.val hh + have hr := (D.gammaIndex d).isLt + have hc := C.length_eq + dsimp [alpha, h] at heq hh' + omega + have hqbound : q.val ≤ C.p - 1 + 2 * (D.gammaIndex d).val := by + have hq' := q.isLt + omega + have hqearly : q.val < j.val + 1 := by omega + refine ⟨⟨q.val, hqearly⟩, C.gamma h, ?_, ?_⟩ + · rw [R.retained_edges_after j.val (by omega) hafter] + have hfix := edge_fixed (j.val + 2) (by omega) (by + intro hzero + obtain ⟨q, hq⟩ := T.attaches ⟨j.val + 2, by omega⟩ + have hout := D.u0_outside d + have huend : D.u0 d ∈ G.ends (T.edge ⟨j.val + 2, by omega⟩) := by + have huend0 : D.u0 d ∈ G.ends (D.f0 d) := by + rw [D.f0_ends] + simp + rw [← hzero] at huend0 + exact huend0 + rw [hq] at huend + have huvertex : D.u0 d = T.vertex ⟨j.val + 3, by omega⟩ ∨ + D.u0 d = T.vertex (q.castLT (by omega)) := by + simpa using huend + have huin : D.u0 d ∈ TreeSequenceVertexSet T := by + rcases huvertex with hleft | hright + · simp [TreeSequenceVertexSet, hleft] + · simp [TreeSequenceVertexSet, hright] + exact hout huin) + change phiD (T.edge ⟨j.val + 2, by omega⟩) = some (C.gamma h) + rw [hfix, hcolor] + · have hvrep := R.retained_vertices_before q.val hqbound (by omega) + have hidx : (⟨q.val, hqearly⟩ : Fin (j.val + 1)).castLT (by omega) = + (⟨q.val, by omega⟩ : Fin (R.replacementTree.length + 1)) := Fin.ext rfl + have hvrep' : R.replacementTree.vertex ((⟨q.val, hqearly⟩ : Fin (j.val + 1)).castLT + (by omega)) = + T.vertex ⟨q.val, by omega⟩ := by + rw [hidx] + exact hvrep + rw [hvrep'] + by_cases hv : T.vertex ⟨q.val, by omega⟩ = D.v0 d + · rw [hv] + apply alpha_ne _ hneq + rw [← hv, hbase] + exact hq + · rw [missing_fixed _ (by simp [TreeSequenceVertexSet]) hv] + rw [hbase] + exact hq + · have hexit := D.v0_is_exit d + have hbaseMem := (ScheideStructuralExitsInBase G k e0 phi T C) hexit + obtain ⟨a, ha, hva⟩ := Finset.mem_image.mp hbaseMem + have haLt := a.isLt + have hbound : a.val ≤ C.p - 1 + 2 * (D.gammaIndex d).val := by + omega + have hvbase : T.vertex ⟨a.val, by omega⟩ = D.v0 d := by + rw [C.base_vertex_position a] + exact hva + have hmiss : d.1 ∈ MissingColors G phiD (D.v0 d) := by + rw [heffect.2.2.2.1] + simp + have hfirst : phiD (R.f1) = d.1 := by + have hp := ScheideReplacementPairFixed G k e0 phi T C D d R R.f1 + (Or.inl (by + change R.u1 ∈ G.ends R.f1 + rw [R.f1_ends] + simp [])) + simpa [phiD] using hp.trans R.f1_color + have hsecond : phiD (R.f2) = d.1 := by + have hp := ScheideReplacementPairFixed G k e0 phi T C D d R R.f2 + (Or.inr (by + change R.u2 ∈ G.ends R.f2 + rw [R.f2_ends] + simp [])) + simpa [phiD] using hp.trans R.f2_color + have hjlast : j.val = T.length - 2 ∨ j.val = T.length - 1 := by + omega + rcases hjlast with hjlast | hjlast + · have haearly : a.val < j.val + 1 := by + have hc := C.length_eq + omega + refine ⟨⟨a.val, haearly⟩, d.1, ?_, ?_⟩ + · rw [show R.replacementTree.edge j = + R.replacementTree.edge ⟨T.length - 2, by rw [← hlen]; omega⟩ by + apply congrArg R.replacementTree.edge + apply Fin.ext + omega] + rw [R.replacement_last_edges.1] + exact hfirst + · have hvrep := R.retained_vertices_before a.val hbound (by omega) + have hidx : (⟨a.val, haearly⟩ : Fin (j.val + 1)).castLT (by omega) = + (⟨a.val, by omega⟩ : Fin (R.replacementTree.length + 1)) := Fin.ext rfl + have hvrep' : R.replacementTree.vertex + ((⟨a.val, haearly⟩ : Fin (j.val + 1)).castLT (by omega)) = + T.vertex ⟨a.val, by omega⟩ := by + rw [hidx] + exact hvrep + rw [hvrep', hvbase] + exact hmiss + · have haearly : a.val < j.val + 1 := by + have hc := C.length_eq + omega + refine ⟨⟨a.val, haearly⟩, d.1, ?_, ?_⟩ + · rw [show R.replacementTree.edge j = + R.replacementTree.edge ⟨T.length - 1, by rw [← hlen]; omega⟩ by + apply congrArg R.replacementTree.edge + apply Fin.ext + omega] + rw [R.replacement_last_edges.2] + exact hsecond + · have hvrep := R.retained_vertices_before a.val hbound (by omega) + have hidx : (⟨a.val, haearly⟩ : Fin (j.val + 1)).castLT (by omega) = + (⟨a.val, by omega⟩ : Fin (R.replacementTree.length + 1)) := Fin.ext rfl + have hvrep' : R.replacementTree.vertex + ((⟨a.val, haearly⟩ : Fin (j.val + 1)).castLT (by omega)) = + T.vertex ⟨a.val, by omega⟩ := by + rw [hidx] + exact hvrep + rw [hvrep', hvbase] + exact hmiss + +private theorem ScheideReplacementMaximum_branch_56.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let _ := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)); (IsProperEdgeColoring G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) e0 ∧ TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) (D.f0 d) = some (C.gamma + (D.gammaIndex d)) ∧ MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (D.v0 d) = insert (↑d : Fin k) ((MissingColors G phi + (D.v0 d)).erase (C.gamma (D.gammaIndex d))) ∧ ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → ¬f = D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, ¬v = D.v0 d → MissingColors G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) ∧ + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) → TashkinovTree G e0 phi T + → TashkinovTree G e0 (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) R.replacementTree := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R phiD heffect htree j hj + have hlen : R.replacementTree.length = T.length := R.replacement_length + have hpos : 1 ≤ T.length := T.positive + have edge_fixed : ∀ q : ℕ, ∀ hq : q < T.length, + T.edge ⟨q, hq⟩ ≠ D.f0 d → phiD (T.edge ⟨q, hq⟩) = phi (T.edge ⟨q, hq⟩) := by + intro q hq hne + apply heffect.2.2.2.2.1 (T.edge ⟨q, hq⟩) + · obtain ⟨i, hi⟩ := T.attaches ⟨q, hq⟩ + refine ⟨T.vertex ⟨q + 1, by omega⟩, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · change T.vertex ⟨q + 1, by omega⟩ ∈ G.ends (T.edge ⟨q, hq⟩) + rw [hi] + simp + · exact hne + have missing_fixed : ∀ v, v ∈ TreeSequenceVertexSet T → v ≠ D.v0 d → + MissingColors G phiD v = MissingColors G phi v := heffect.2.2.2.2.2.1 + let alpha := C.gamma (D.gammaIndex d) + have alpha_ne : ∀ c : Fin k, c ≠ alpha → + c ∈ MissingColors G phi (D.v0 d) → c ∈ MissingColors G phiD (D.v0 d) := by + intro c hc hm + rw [heffect.2.2.2.1] + have hc' : c ≠ C.gamma (D.gammaIndex d) := by + simpa [alpha] using hc + exact Finset.mem_insert_of_mem (Finset.mem_erase.mpr ⟨hc', hm⟩) + by_cases hbefore : j.val < C.p - 1 + 2 * (D.gammaIndex d).val + · exact @ScheideReplacementMaximum_branch_56_branch_89 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D d R htree j hj hlen edge_fixed missing_fixed + alpha_ne hbefore + · exact @ScheideReplacementMaximum_branch_56_branch_173 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D d R heffect j hj hlen hpos edge_fixed + missing_fixed alpha_ne hbefore +theorem ScheideReplacementMaximum {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + IsProperEdgeColoring G phiD ∧ IsOneEdgeUncolored phiD e0 ∧ + GlobalMaximumTriple G k e0 phiD R.replacementTree := by + dsimp + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + have heffect := ScheideDefectiveSwitchEffect G k e0 phi T C D d + dsimp at heffect + have htriple := C.globally_maximum + have htree := htriple.2.1 + have hproper : IsProperEdgeColoring G phiD := heffect.1 + have huncolored : IsOneEdgeUncolored phiD e0 := heffect.2.1 + refine ⟨hproper, huncolored, ?_⟩ + refine ⟨?_, ?_, ?_⟩ + · refine ⟨htriple.1.1, htriple.1.2.1, htriple.1.2.2.1, hproper, huncolored⟩ + · exact @ScheideReplacementMaximum_branch_56 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R heffect htree + · classical + have vertex_card : ∀ U : TreeSequence G e0, + (TreeSequenceVertexSet U).card = U.length + 1 := by + intro U + unfold TreeSequenceVertexSet + calc + (@Finset.image (Fin (U.length + 1)) V (Classical.decEq V) + U.vertex Finset.univ).card = Finset.univ.card := + @Finset.card_image_of_injective (Fin (U.length + 1)) V U.vertex + (Classical.decEq V) Finset.univ U.vertex_injective + _ = U.length + 1 := by simp + calc + (TreeSequenceVertexSet R.replacementTree).card = R.replacementTree.length + 1 := + vertex_card R.replacementTree + _ = T.length + 1 := by rw [R.replacement_length] + _ = (TreeSequenceVertexSet T).card := (vertex_card T).symm + _ = TashkinovOrder G := htriple.2.2 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean b/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean new file mode 100644 index 0000000000..0a4e7ec463 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean @@ -0,0 +1,940 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ClosedSetTwoColorComponentAvoidance +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed +public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair +public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Replacement Missing Deleted Internal + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_hTreePsi_444.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet T; + let _ : Fin k := C.gamma (D.gammaIndex d); + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let Z : Finset V := X \ { ug0, ug1 }; + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.alpha0 alpha (Sum.inl ug0); + ( + ∀ v ∈ XD, + ∀ (f : E), Incident G v f → psi f = phi f) → ( + ∀ v ∈ XD, MissingColors G psi v = MissingColors G phi v) → ( + ∀ (q : Fin C.p), C.y q ∈ Z) → ( + ∀ v ∈ Z, v ∈ XD) → TashkinovTree G e0 psi T := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha X gamma ug0 ug1 Z XD psi hPsiFixedAt + hMissingPsiFixed hBaseInZ hZInXD j hj + by_cases hbase : j.val < C.p - 1 + · obtain ⟨i, c, hedge, hmissing⟩ := C.globally_maximum.2.1 j hj + let q : Fin C.p := ⟨i.val, by omega⟩ + have hqVertex : T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) = C.y q := by + have hind : Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) = + ⟨q.val, by + have hq := q.isLt + have hl := C.length_eq + omega⟩ := by + apply Fin.ext + rfl + rw [hind] + exact C.base_vertex_position q + let next : Fin C.p := ⟨j.val + 1, by omega⟩ + have hnextZ : C.y next ∈ Z := hBaseInZ next + have hnextVertex : T.vertex j.succ = C.y next := by + have hind : j.succ = ⟨next.val, by + have hn := next.isLt + have hl := C.length_eq + omega⟩ := by + apply Fin.ext + rfl + rw [hind] + exact C.base_vertex_position next + have hedgeIncident : Incident G (C.y next) (T.edge j) := by + obtain ⟨r, hr⟩ := T.attaches j + change C.y next ∈ G.ends (T.edge j) + rw [hr, hnextVertex] + simp + have hedgeFixed := hPsiFixedAt (C.y next) (hZInXD _ hnextZ) + (T.edge j) hedgeIncident + refine ⟨i, c, ?_, ?_⟩ + · exact hedgeFixed.trans hedge + · rw [hMissingPsiFixed _ (by + rw [hqVertex] + exact hZInXD _ (hBaseInZ q))] + exact hmissing + · let r : Fin C.s := ⟨(j.val - (C.p - 1)) / 2, by + have hj := j.isLt + have hi := (D.gammaIndex d).isLt + have hl := C.length_eq + omega⟩ + let l : Fin 2 := ⟨(j.val - (C.p - 1)) % 2, Nat.mod_lt _ (by omega)⟩ + have hjDecomp : C.p - 1 + 2 * r.val + l.val = j.val := by + dsimp [r, l] + have hmod := Nat.mod_add_div (j.val - (C.p - 1)) 2 + omega + have hedgeEq : T.edge j = C.blockEdge r l := by + rw [← C.block_edge_position r l] + apply congrArg T.edge + apply Fin.ext + exact hjDecomp.symm + obtain ⟨q, hends⟩ := C.block_attaches_to_base r l + have hqZ : C.y q ∈ Z := hBaseInZ q + have hinc : Incident G (C.y q) (T.edge j) := by + change C.y q ∈ G.ends (T.edge j) + rw [hedgeEq, hends] + simp [] + have hedgeFixed := hPsiFixedAt (C.y q) (hZInXD _ hqZ) (T.edge j) hinc + obtain ⟨w, hwMissing⟩ := C.block_color_missing_on_base r + let i : Fin (j.val + 1) := ⟨w.val, by + have hw := w.isLt + omega⟩ + refine ⟨i, C.gamma r, ?_, ?_⟩ + · rw [hedgeFixed, hedgeEq] + exact C.block_color r l + · have hvertex : T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) = C.y w := by + have hind : Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) = + ⟨w.val, by + have hw := w.isLt + have hl := C.length_eq + omega⟩ := by + apply Fin.ext + rfl + rw [hind] + exact C.base_vertex_position w + rw [hMissingPsiFixed _ (by + rw [hvertex] + exact hZInXD _ (hBaseInZ w))] + rw [hvertex] + exact hwMissing + +private theorem helper_hPairMissingFixed_364.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + ∀ (u : V), u = R.u1 ∨ u = R.u2 → MissingColors G phiD u = MissingColors G phi u := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD u hu + simp only [MissingColors] + congr 1 + ext c + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + constructor + · rintro ⟨f, huf, hfc⟩ + refine ⟨f, huf, ?_⟩ + have hfixed := ScheideReplacementPairFixed G k e0 phi T C D d R f (by + rcases hu with rfl | rfl + · exact Or.inl huf + · exact Or.inr huf) + simpa [phiD, gamma] using hfixed.symm.trans hfc + · rintro ⟨f, huf, hfc⟩ + refine ⟨f, huf, ?_⟩ + have hfixed := ScheideReplacementPairFixed G k e0 phi T C D d R f (by + rcases hu with rfl | rfl + · exact Or.inl huf + · exact Or.inr huf) + simpa [phiD, gamma] using hfixed.trans hfc + +private theorem helper_hBaseInZ_524.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (_ : ScheideReplacementData + G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let Z : Finset V := X \ { ug0, ug1 }; + ∀ (q : Fin C.p), C.y q ∈ Z := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X ug0 ug1 Z q + have hqX : C.y q ∈ X := by + change C.y q ∈ TreeSequenceVertexSet T + rw [← C.base_vertex_position q] + simp [TreeSequenceVertexSet] + have hq0 : C.y q ≠ ug0 := by + intro h + have hv := (C.base_vertex_position q).trans + (h.trans (C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)).symm) + have hi := congrArg Fin.val (T.vertex_injective hv) + simp at hi + omega + have hq1 : C.y q ≠ ug1 := by + intro h + have hv := (C.base_vertex_position q).trans + (h.trans (C.block_vertex_position (D.gammaIndex d) (1 : Fin 2)).symm) + have hi := congrArg Fin.val (T.vertex_injective hv) + simp at hi + omega + simp [Z, hqX, hq0, hq1] + +private theorem helper_hAlphaBoundaryOutside_598.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet T; + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); ug0 ∈ X → + ug1 ∈ X → y0 ∈ X → alpha ≠ D.alpha0 → + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl ug0); Sum.inl ug0 ∈ K → + Sum.inl ug1 ∈ K → + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.alpha0 alpha (Sum.inl ug0); + ColoredVertexSetClosed G psi X → D.alpha0 ∈ MissingColors G psi y0 → ( + ∀ (x : V), Sum.inl x ∈ K → + ∀ (f : E), Incident G x f → phi f = some alpha → Sum.inr f ∈ K) → + ∀ (x : V), x = ug0 ∨ x = ug1 → + ∀ (f : E), Incident G x f → phi f = some alpha → + ∀ (w : V), G.ends f = s(x, w) → w ∉ X → False := by + classical + intro V E _ _ _ G k e0 phi T C D d alpha X ug0 ug1 y0 hug0X hug1X hy0X hAlphaNeAlpha0 K hug0K + hug1K psi hXPsiClosed hAlpha0PsiY0 hAlphaEdgeInK x hx f hxf hcolor w hends hwX + have hxX : x ∈ X := by + rcases hx with rfl | rfl + · exact hug0X + · exact hug1X + have hfK : Sum.inr f ∈ K := by + apply hAlphaEdgeInK x + · rcases hx with rfl | rfl + · exact hug0K + · exact hug1K + · exact hxf + · exact hcolor + have hcolorPsi : psi f = some D.alpha0 := by + simp [psi, K, TwoColorComponentSwap, hfK, hcolor, + hAlphaNeAlpha0] + have hfBoundary : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hxX, w, hwX, hends⟩ + exact (hXPsiClosed hfBoundary hy0X hcolorPsi) hAlpha0PsiY0 + +private theorem helper_hNoIncident_622.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet T; + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let Z : Finset V := X \ { ug0, ug1 }; ( + ∀ (x : V), x = ug0 ∨ x = ug1 → + ∀ (f : E), Incident G x f → phi f = some alpha → + ∀ (w : V), G.ends f = s(x, w) → w ∈ Z → False) → ( + ∀ (x : V), x = ug0 ∨ x = ug1 → + ∀ (f : E), Incident G x f → phi f = some alpha → + ∀ (w : V), G.ends f = s(x, w) → w ∉ X → False) → (¬ + ∃ (f : E), phi f = some alpha ∧ G.ends f = s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)))) → + ∀ (x : V), x = ug0 ∨ x = ug1 → + ∀ (f : E), Incident G x f → phi f ≠ some alpha := by + classical + intro V E _ _ _ _ G k e0 phi T C D d alpha X ug0 ug1 Z hAlphaBoundaryZ hAlphaBoundaryOutside + hnone x hx f hxf hcolor + obtain ⟨w, hends⟩ := Sym2.mem_iff_exists.mp hxf + have hwne : w ≠ x := by + intro h + apply G.loopless f x + simpa [h] using hends + by_cases hwZ : w ∈ Z + · exact hAlphaBoundaryZ x hx f hxf hcolor w hends hwZ + by_cases hwX : w ∈ X + · have hwPair : w = ug0 ∨ w = ug1 := by + have : w ∈ ({ug0, ug1} : Finset V) := by + by_contra hp + exact hwZ (by simp [Z, hwX, hp]) + simpa using this + have hinterior : G.ends f = s(ug0, ug1) := by + rcases hx with rfl | rfl <;> rcases hwPair with rfl | rfl + · exact False.elim (hwne rfl) + · exact hends + · simpa [Sym2.eq_swap] using hends + · exact False.elim (hwne rfl) + exact hnone ⟨f, hcolor, by simpa [ug0, ug1] using hinterior⟩ + · exact hAlphaBoundaryOutside x hx f hxf hcolor w hends hwX + +private theorem helper_hAlphaDelta_420.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), alpha ∈ MissingColors G phi R.u1 ∨ alpha ∈ + MissingColors G phi R.u2 → Incident G R.u1 R.f1 → Incident G R.u2 R.f2 → alpha ≠ (↑d : Fin + k) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha hAlpha hf1u1 hf2u2 h + rcases hAlpha with hAlpha | hAlpha + · have hnot : alpha ∉ PresentColors G phi R.u1 := by + simpa [MissingColors] using hAlpha + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨R.f1, hf1u1, by simpa [h] using R.f1_color⟩ + · have hnot : alpha ∉ PresentColors G phi R.u2 := by + simpa [MissingColors] using hAlpha + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨R.f2, hf2u2, by simpa [h] using R.f2_color⟩ + +private theorem helper_hAlphaGamma_439.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), alpha ∈ MissingColors G phi R.u1 ∨ alpha ∈ + MissingColors G phi R.u2 → + let gamma : Fin k := C.gamma (D.gammaIndex d); + ∀ (fGamma : E), phi fGamma = some (C.gamma (D.gammaIndex d)) → Incident G R.u1 fGamma → + Incident G R.u2 fGamma → alpha ≠ gamma := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha hAlpha gamma fGamma hfGammaColor hfGammaU1 + hfGammaU2 h + rcases hAlpha with hAlpha | hAlpha + · have hnot : alpha ∉ PresentColors G phi R.u1 := by + simpa [MissingColors] using hAlpha + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fGamma, hfGammaU1, by simpa [gamma, h] using hfGammaColor⟩ + · have hnot : alpha ∉ PresentColors G phi R.u2 := by + simpa [MissingColors] using hAlpha + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨fGamma, hfGammaU2, by simpa [gamma, h] using hfGammaColor⟩ + +private theorem helper_hPhiDAlpha0_483.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); gamma ≠ (↑d : Fin k) → D.alpha0 ≠ gamma → D.alpha0 ≠ (↑d : Fin k) → + ∀ (f : E), phiD f = some D.alpha0 ↔ phi f = some D.alpha0 := by + classical + intro V E _ _ _ G k e0 phi T C D d gamma phiD hGammaDelta hAlpha0Gamma hAlpha0Delta f + simp only [phiD, TwoColorComponentSwap] + by_cases hf : Sum.inr f ∈ + TwoColorComponent G phi gamma d.1 (Sum.inl (D.v0 d)) + · by_cases hfg : phi f = some gamma + · simp only [hf, ite_eq_left, hfg, Option.some.injEq] + constructor + · intro h + exact False.elim (hAlpha0Delta h.symm) + · intro h + exact False.elim (hAlpha0Gamma h.symm) + · by_cases hfd : phi f = some d.1 + · simp [hf, hfd, hGammaDelta.symm, hAlpha0Gamma.symm, hAlpha0Delta.symm] + · simp [hf, hfg, hfd] + · simp [hf] + +private theorem helper_hPhiDAlpha_500.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (alpha : Fin k), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); alpha ≠ (↑d : Fin k) → alpha ≠ gamma → gamma ≠ (↑d : Fin k) → + ∀ (f : E), phiD f = some alpha ↔ phi f = some alpha := by + classical + intro V E _ _ _ G k e0 phi T C D d alpha gamma phiD hAlphaDelta hAlphaGamma hGammaDelta f + simp only [phiD, TwoColorComponentSwap] + by_cases hf : Sum.inr f ∈ + TwoColorComponent G phi gamma d.1 (Sum.inl (D.v0 d)) + · by_cases hfg : phi f = some gamma + · simp only [hf, ite_eq_left, hfg, Option.some.injEq] + constructor + · intro h + exact False.elim (hAlphaDelta h.symm) + · intro h + exact False.elim (hAlphaGamma h.symm) + · by_cases hfd : phi f = some d.1 + · simp [hf, hfd, hGammaDelta.symm, hAlphaGamma.symm, hAlphaDelta.symm] + · simp [hf, hfg, hfd] + · simp [hf] + +private theorem helper_hAlphaNeAlpha0_546.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; ColoredVertexSetElementary G + phiD XD → y0 ∈ X → y0 ∈ XD → R.u1 ∈ XD → R.u2 ∈ XD → alpha ∈ MissingColors G phiD R.u1 ∨ + alpha ∈ MissingColors G phiD R.u2 → D.alpha0 ∈ MissingColors G phiD y0 → alpha ≠ D.alpha0 + := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha X gamma y0 phiD XD hXDElementary hy0X hy0XD hu1XD + hu2XD hAlphaD hAlpha0D h + rcases hAlphaD with hAlphaD | hAlphaD + · have hyu : y0 ≠ R.u1 := by + intro hyu + exact R.u1_outside (hyu ▸ hy0X) + have hdj := hXDElementary hy0XD hu1XD hyu + exact (Finset.disjoint_left.mp hdj) hAlpha0D (by simpa [h] using hAlphaD) + · have hyu : y0 ≠ R.u2 := by + intro hyu + exact R.u2_outside (hyu ▸ hy0X) + have hdj := hXDElementary hy0XD hu2XD hyu + exact (Finset.disjoint_left.mp hdj) hAlpha0D (by simpa [h] using hAlphaD) + +private theorem helper_hAvoid_603.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let phiD : PartialEdgeColoring E k := + TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; + TwoColorIncidenceGraph G phiD D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha → + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl ug0); + ((∀ v ∈ XD, Sum.inl v ∉ TwoColorComponent G phiD D.alpha0 alpha (Sum.inl ug0)) ∧ + ∀ (f : E), + (∃ v ∈ XD, Incident G v f) → + Sum.inr f ∉ TwoColorComponent G phiD D.alpha0 alpha (Sum.inl ug0)) → + (∀ v ∈ XD, Sum.inl v ∉ K) ∧ ∀ (f : E), (∃ v ∈ XD, Incident G v f) → Sum.inr f ∉ K := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha gamma ug0 phiD XD hGraph K hAvoidD + constructor + · intro v hv hmem + apply hAvoidD.1 v hv + change (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl v) = + (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl ug0) + rw [hGraph] + exact hmem + · intro f hf hmem + apply hAvoidD.2 f hf + change (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G phiD D.alpha0 alpha).connectedComponentMk + (Sum.inl ug0) + rw [hGraph] + exact hmem + +private theorem helper_hOnePsi_628.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (alpha : Fin k), + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); alpha ≠ D.alpha0 → + let _ : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl ug0); + let psi : PartialEdgeColoring E k := TwoColorComponentSwap G phi D.alpha0 alpha (Sum.inl ug0); + IsOneEdgeUncolored psi e0 := by + classical + intro V E _ _ _ G k e0 phi T C D d alpha ug0 hAlphaNeAlpha0 K psi + have hOne := C.globally_maximum.1.2.2.2.2 + constructor + · simp [psi, TwoColorComponentSwap, hOne.1] + · intro f hf + obtain ⟨c, hfc⟩ := hOne.2 f hf + by_cases hmem : Sum.inr f ∈ K + · by_cases hc0 : c = D.alpha0 + · exact ⟨alpha, by + simp [psi, TwoColorComponentSwap, K, hmem, hfc, hc0]⟩ + · by_cases hca : c = alpha + · exact ⟨D.alpha0, by + simp [psi, TwoColorComponentSwap, K, hmem, hfc, hca, + hAlphaNeAlpha0]⟩ + · exact ⟨c, by + simp [psi, TwoColorComponentSwap, K, hmem, hfc, hc0, hca]⟩ + · exact ⟨c, by + simp [psi, TwoColorComponentSwap, K, hmem, hfc]⟩ + +private theorem helper_hAlphaBoundaryZ_697.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let Z : Finset V := X \ { ug0, ug1 }; + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; ColoredVertexSetClosed G phiD XD + → ug1 ∈ X → R.u1 ∈ XD → R.u2 ∈ XD → ug0 ∉ XD → ( + ∀ (f : E), phiD f = some alpha ↔ phi f = some alpha) → alpha ∈ MissingColors G phiD R.u1 ∨ + alpha ∈ MissingColors G phiD R.u2 → ( + ∀ v ∈ Z, v ∈ XD) → + ∀ (x : V), x = ug0 ∨ x = ug1 → + ∀ (f : E), Incident G x f → phi f = some alpha → + ∀ (w : V), G.ends f = s(x, w) → w ∈ Z → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha X gamma ug0 ug1 Z phiD XD hXDClosed hug1X hu1XD + hu2XD hug0NotXD hPhiDAlpha hAlphaD hZInXD x hx f hxf hcolor w hends hwZ + have hxNotXD : x ∉ XD := by + rcases hx with rfl | rfl + · exact hug0NotXD + · rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] + simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton, + Finset.mem_sdiff] + rintro (⟨-, hpair⟩ | h | h) + · exact hpair (by simp [ug1]) + · exact R.u1_outside (h ▸ hug1X) + · exact R.u2_outside (h ▸ hug1X) + have hfBoundary : f ∈ BoundaryEdges G XD := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hZInXD w hwZ, x, hxNotXD, hends.trans Sym2.eq_swap⟩ + have hcolorD : phiD f = some alpha := (hPhiDAlpha f).mpr hcolor + rcases hAlphaD with hAlphaD | hAlphaD + · exact (hXDClosed hfBoundary hu1XD hcolorD) hAlphaD + · exact (hXDClosed hfBoundary hu2XD hcolorD) hAlphaD + +private theorem helper_continuation_705.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let _ : Finset V := X \ { ug0, ug1 }; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; ColoredVertexSetElementary G phi + X → ColoredVertexSetClosed G phiD XD → ug0 ∈ X → ug1 ∈ X → ug0 ≠ ug1 → y0 ∈ X → y0 ∈ XD → + R.u1 ∈ XD → R.u2 ∈ XD → ug0 ∉ XD → ( + ∀ (f : E), phiD f = some alpha ↔ phi f = some alpha) → TwoColorIncidenceGraph G phiD D.alpha0 + alpha = TwoColorIncidenceGraph G phi D.alpha0 alpha → alpha ∈ MissingColors G phiD R.u1 ∨ + alpha ∈ MissingColors G phiD R.u2 → D.alpha0 ∈ MissingColors G phiD y0 → alpha ≠ D.alpha0 + → + let K : Set (V ⊕ E) := TwoColorComponent G phi D.alpha0 alpha (Sum.inl ug0); Sum.inl ug0 ∈ K → + Sum.inl ug1 ∈ K → + ∃ (f : E), phi f = some alpha ∧ G.ends f = s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha X gamma ug0 ug1 Z y0 phiD XD hXElementary + hXDClosed hug0X hug1X hug01 hy0X hy0XD hu1XD hu2XD hug0NotXD hPhiDAlpha hGraph hAlphaD + hAlpha0D hAlphaNeAlpha0 K hug0K hug1K + have hAvoidD : + (∀ v ∈ XD, Sum.inl v ∉ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl ug0)) ∧ + ∀ f : E, (∃ v ∈ XD, Incident G v f) → + Sum.inr f ∉ + TwoColorComponent G phiD D.alpha0 alpha (Sum.inl ug0) := by + rcases hAlphaD with hAlphaD | hAlphaD + · exact ClosedSetTwoColorComponentAvoidance G phiD D.alpha0 alpha XD + ug0 y0 R.u1 hXDClosed hug0NotXD hy0XD hu1XD hAlpha0D hAlphaD + · exact ClosedSetTwoColorComponentAvoidance G phiD D.alpha0 alpha XD + ug0 y0 R.u2 hXDClosed hug0NotXD hy0XD hu2XD hAlpha0D hAlphaD + have hAvoid : + (∀ v ∈ XD, Sum.inl v ∉ K) ∧ + ∀ f : E, (∃ v ∈ XD, Incident G v f) → Sum.inr f ∉ K := by + exact @helper_hAvoid_603 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R alpha hGraph hAvoidD + let psi := TwoColorComponentSwap G phi D.alpha0 alpha (Sum.inl ug0) + have hProperPsi : IsProperEdgeColoring G psi := by + exact TwoColorComponentSwapProper G phi D.alpha0 alpha hAlphaNeAlpha0.symm + C.globally_maximum.1.2.2.2.1 (Sum.inl ug0) + have hOnePsi : IsOneEdgeUncolored psi e0 := by + exact @helper_hOnePsi_628 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + alpha hAlphaNeAlpha0 + have hPsiFixedAt : ∀ v : V, v ∈ XD → + ∀ f : E, Incident G v f → psi f = phi f := by + intro v hv f hvf + have hnot := hAvoid.2 f ⟨v, hv, hvf⟩ + simp [psi, K, TwoColorComponentSwap, hnot] + have hMissingPsiFixed : ∀ v : V, v ∈ XD → + MissingColors G psi v = MissingColors G phi v := by + intro v hv + simp only [MissingColors] + congr 1 + ext c + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + constructor <;> rintro ⟨f, hvf, hfc⟩ + · exact ⟨f, hvf, (hPsiFixedAt v hv f hvf).symm.trans hfc⟩ + · exact ⟨f, hvf, (hPsiFixedAt v hv f hvf).trans hfc⟩ + have hBaseInZ : ∀ q : Fin C.p, C.y q ∈ Z := by + exact @helper_hBaseInZ_524 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R + have hZInXD : ∀ v : V, v ∈ Z → v ∈ XD := by + intro v hv + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] + exact Finset.mem_union_left _ (by simpa [X, Z, ug0, ug1] using hv) + have hTreePsi : TashkinovTree G e0 psi T := by + exact @helper_hTreePsi_444 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R alpha hPsiFixedAt hMissingPsiFixed hBaseInZ hZInXD + have hGlobalPsi : GlobalMaximumTriple G k e0 psi T := by + refine ⟨?_, hTreePsi, C.globally_maximum.2.2⟩ + exact ⟨C.globally_maximum.1.1, C.globally_maximum.1.2.1, + C.globally_maximum.1.2.2.1, hProperPsi, hOnePsi⟩ + have hPsiOrder := ScheideGlobalMaximumOrder G k e0 psi T hGlobalPsi + have hXPsiClosed : ColoredVertexSetClosed G psi X := by + change ColoredVertexSetClosed G psi (TreeSequenceVertexSet T) + exact hPsiOrder.2.2.2.2 + have hAlpha0PsiY0 : D.alpha0 ∈ MissingColors G psi y0 := by + rw [hMissingPsiFixed y0 hy0XD] + simpa [y0] using D.alpha0_missing_at_y0 + have hAlphaEdgeInK : ∀ x : V, Sum.inl x ∈ K → ∀ f : E, + Incident G x f → phi f = some alpha → Sum.inr f ∈ K := by + intro x hx f hxf hcolor + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl ug0) + have hadj : (TwoColorIncidenceGraph G phi D.alpha0 alpha).Adj + (Sum.inl x) (Sum.inr f) := by + simp [TwoColorIncidenceGraph, hxf, hcolor] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).symm.trans hx + have hAlphaBoundaryZ : ∀ x : V, (x = ug0 ∨ x = ug1) → ∀ f : E, + Incident G x f → phi f = some alpha → + ∀ w : V, G.ends f = s(x, w) → w ∈ Z → False := by + exact @helper_hAlphaBoundaryZ_697 V E inferInstance inferInstance inferInstance inferInstance + G k e0 phi T C D d R alpha hXDClosed hug1X hu1XD hu2XD hug0NotXD hPhiDAlpha hAlphaD hZInXD + have hAlphaBoundaryOutside : ∀ x : V, (x = ug0 ∨ x = ug1) → ∀ f : E, + Incident G x f → phi f = some alpha → + ∀ w : V, G.ends f = s(x, w) → w ∉ X → False := by + exact @helper_hAlphaBoundaryOutside_598 V E inferInstance inferInstance inferInstance G k e0 + phi T C D d alpha hug0X hug1X hy0X hAlphaNeAlpha0 hug0K hug1K hXPsiClosed hAlpha0PsiY0 + hAlphaEdgeInK + by_contra hnone + have hNoIncident : ∀ x : V, (x = ug0 ∨ x = ug1) → + ∀ f : E, Incident G x f → phi f ≠ some alpha := by + exact @helper_hNoIncident_622 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d alpha hAlphaBoundaryZ hAlphaBoundaryOutside hnone + have hMissingUg0 : alpha ∈ MissingColors G phi ug0 := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpresent + obtain ⟨f, hinc, hcolor⟩ := hpresent + exact hNoIncident ug0 (Or.inl rfl) f hinc hcolor + have hMissingUg1 : alpha ∈ MissingColors G phi ug1 := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpresent + obtain ⟨f, hinc, hcolor⟩ := hpresent + exact hNoIncident ug1 (Or.inr rfl) f hinc hcolor + have hdj := hXElementary hug0X hug1X hug01 + exact (Finset.disjoint_left.mp hdj) hMissingUg0 hMissingUg1 + +private theorem helper_continuation_675.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (alpha : Fin k), alpha ∈ MissingColors G phi R.u1 ∨ alpha ∈ + MissingColors G phi R.u2 → + let X : Finset V := TreeSequenceVertexSet T; + let gamma : Fin k := C.gamma (D.gammaIndex d); + let ug0 : V := C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)); + let ug1 : V := C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)); + let Z : Finset V := X \ { ug0, ug1 }; + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let XD : Finset V := TreeSequenceVertexSet R.replacementTree; ColoredVertexSetElementary G phi + X → ColoredVertexSetClosed G phi X → ColoredVertexSetElementary G phiD XD → + ColoredVertexSetClosed G phiD XD → ug0 ∈ X → ug1 ∈ X → ug0 ≠ ug1 → y0 ∈ X → y0 ∈ Z → y0 ∈ + XD → R.u1 ∈ XD → R.u2 ∈ XD → ug0 ∉ XD → Incident G R.u1 R.f1 → Incident G R.u2 R.f2 → + ∃ (f : E), phi f = some alpha ∧ G.ends f = s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R alpha hAlpha X gamma ug0 ug1 Z y0 phiD XD hXElementary + hXClosed hXDElementary hXDClosed hug0X hug1X hug01 hy0X hy0Z hy0XD hu1XD hu2XD hug0NotXD + hf1u1 hf2u2 + have hAlphaDelta : alpha ≠ d.1 := by + exact @helper_hAlphaDelta_420 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R alpha hAlpha hf1u1 hf2u2 + obtain ⟨fGamma, hfGammaColor, hfGammaEnds⟩ := + (ScheideSymmetricDefectiveInternal G k e0 phi T C D d R).2 + have hfGammaU1 : Incident G R.u1 fGamma := by + simp [Incident, hfGammaEnds] + have hfGammaU2 : Incident G R.u2 fGamma := by + simp [Incident, hfGammaEnds] + have hAlphaGamma : alpha ≠ gamma := by + exact @helper_hAlphaGamma_439 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R alpha hAlpha fGamma hfGammaColor hfGammaU1 hfGammaU2 + have hGammaDelta : gamma ≠ d.1 := by + intro h + have hnot : gamma ∉ PresentColors G phi (D.v0 d) := by + simpa [MissingColors, gamma] using D.gamma_missing_at_v0 d + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨D.f0 d, ?_, ?_⟩ + · change D.v0 d ∈ G.ends (D.f0 d) + rw [D.f0_ends] + simp [] + · simpa [h] using D.f0_color d + have hAlpha0Gamma : D.alpha0 ≠ gamma := by + simpa [gamma] using D.alpha0_not_block (D.gammaIndex d) + have hDeltaBoundary : ∃ f : E, + f ∈ BoundaryEdges G X ∧ phi f = some d.1 := by + have hdcard : 2 ≤ (BoundaryColorEdges G phi X d.1).card := by + have hd := (Finset.mem_filter.mp d.2).2 + simpa [DefectiveColor, X] using hd + have hdnonempty : (BoundaryColorEdges G phi X d.1).Nonempty := + Finset.card_pos.mp (lt_of_lt_of_le Nat.zero_lt_two hdcard) + obtain ⟨f, hf⟩ := hdnonempty + exact ⟨f, (Finset.mem_filter.mp hf).1, (Finset.mem_filter.mp hf).2⟩ + obtain ⟨fDelta, hfDeltaBoundary, hfDeltaColor⟩ := hDeltaBoundary + have hDeltaNotMissingY0 : d.1 ∉ MissingColors G phi y0 := + hXClosed hfDeltaBoundary hy0X hfDeltaColor + have hAlpha0Delta : D.alpha0 ≠ d.1 := by + intro h + apply hDeltaNotMissingY0 + simpa [y0, h] using D.alpha0_missing_at_y0 + have hPhiDAlpha0 : ∀ f : E, + phiD f = some D.alpha0 ↔ phi f = some D.alpha0 := by + exact @helper_hPhiDAlpha0_483 V E inferInstance inferInstance inferInstance G k e0 phi T C D + d hGammaDelta hAlpha0Gamma hAlpha0Delta + have hPhiDAlpha : ∀ f : E, + phiD f = some alpha ↔ phi f = some alpha := by + exact @helper_hPhiDAlpha_500 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + alpha hAlphaDelta hAlphaGamma hGammaDelta + have hGraph : TwoColorIncidenceGraph G phiD D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha := by + ext x z + cases x <;> cases z <;> + simp [TwoColorIncidenceGraph, hPhiDAlpha0, hPhiDAlpha] + have hPairMissingFixed : + ∀ u : V, (u = R.u1 ∨ u = R.u2) → MissingColors G phiD u = MissingColors G phi u := by + exact @helper_hPairMissingFixed_364 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R + have hAlphaD : + alpha ∈ MissingColors G phiD R.u1 ∨ + alpha ∈ MissingColors G phiD R.u2 := by + rcases hAlpha with hAlpha | hAlpha + · exact Or.inl (by + rw [hPairMissingFixed R.u1 (Or.inl rfl)] + exact hAlpha) + · exact Or.inr (by + rw [hPairMissingFixed R.u2 (Or.inr rfl)] + exact hAlpha) + have hAlpha0D : D.alpha0 ∈ MissingColors G phiD y0 := by + have hOld := D.alpha0_missing_at_y0 + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] at hOld ⊢ + intro hpresent + apply hOld + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + at hpresent ⊢ + obtain ⟨f, hyf, hfc⟩ := hpresent + exact ⟨f, hyf, (hPhiDAlpha0 f).mp hfc⟩ + have hAlphaNeAlpha0 : alpha ≠ D.alpha0 := by + exact @helper_hAlphaNeAlpha0_546 V E inferInstance inferInstance inferInstance inferInstance + G k e0 phi T C D d R alpha hXDElementary hy0X hy0XD hu1XD hu2XD hAlphaD hAlpha0D + obtain ⟨fAlpha0, hfAlpha0Color, hfAlpha0Ends⟩ := + ScheideStructuralInternalPair G k e0 phi T C (D.gammaIndex d) D.alpha0 + (by simpa [gamma] using hAlpha0Gamma) + ⟨y0, by simpa [X, Z, ug0, ug1] using hy0Z, + by simpa [y0] using D.alpha0_missing_at_y0⟩ + let K := TwoColorComponent G phi D.alpha0 alpha (Sum.inl ug0) + have hug0K : Sum.inl ug0 ∈ K := by + rfl + have hfAlpha0Ug0 : Incident G ug0 fAlpha0 := by + simp [Incident, hfAlpha0Ends, ug0] + have hfAlpha0Ug1 : Incident G ug1 fAlpha0 := by + simp [Incident, hfAlpha0Ends, ug1] + have hfAlpha0K : Sum.inr fAlpha0 ∈ K := by + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inr fAlpha0) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl ug0) + have hadj : (TwoColorIncidenceGraph G phi D.alpha0 alpha).Adj + (Sum.inl ug0) (Sum.inr fAlpha0) := by + simp [TwoColorIncidenceGraph, hfAlpha0Ug0, hfAlpha0Color] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).symm + have hug1K : Sum.inl ug1 ∈ K := by + change (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl ug1) = + (TwoColorIncidenceGraph G phi D.alpha0 alpha).connectedComponentMk + (Sum.inl ug0) + have hadj : (TwoColorIncidenceGraph G phi D.alpha0 alpha).Adj + (Sum.inl ug1) (Sum.inr fAlpha0) := by + simp [TwoColorIncidenceGraph, hfAlpha0Ug1, hfAlpha0Color] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans + hfAlpha0K + exact @helper_continuation_705 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R alpha hXElementary hXDClosed hug0X hug1X hug01 hy0X hy0XD hu1XD hu2XD + hug0NotXD hPhiDAlpha hGraph hAlphaD hAlpha0D hAlphaNeAlpha0 hug0K hug1K +theorem ScheideReplacementMissingDeletedInternal {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + ∀ alpha : Fin k, (alpha ∈ MissingColors G phi R.u1 ∨ alpha ∈ MissingColors G phi R.u2) → + ∃ f : E, phi f = some alpha ∧ G.ends f = s(C.blockVertex (D.gammaIndex d) 0, C.blockVertex + (D.gammaIndex d) 1) := by + classical + intro alpha hAlpha + let X := TreeSequenceVertexSet T + let gamma := C.gamma (D.gammaIndex d) + let ug0 := C.blockVertex (D.gammaIndex d) 0 + let ug1 := C.blockVertex (D.gammaIndex d) 1 + let Z := X \ {ug0, ug1} + let y0 := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let XD := TreeSequenceVertexSet R.replacementTree + have hOriginalOrder := + ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hXElementary : ColoredVertexSetElementary G phi X := by + change ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) + exact hOriginalOrder.2.2.2.1 + have hXClosed : ColoredVertexSetClosed G phi X := by + change ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) + exact hOriginalOrder.2.2.2.2 + have hReplacementMaximum := + ScheideReplacementMaximum G k e0 phi T C D d R + have hReplacementGlobal : GlobalMaximumTriple G k e0 phiD R.replacementTree := by + simpa [phiD, gamma] using hReplacementMaximum.2.2 + have hReplacementOrder := + ScheideGlobalMaximumOrder G k e0 phiD R.replacementTree hReplacementGlobal + have hXDElementary : ColoredVertexSetElementary G phiD XD := by + change ColoredVertexSetElementary G phiD + (TreeSequenceVertexSet R.replacementTree) + exact hReplacementOrder.2.2.2.1 + have hXDClosed : ColoredVertexSetClosed G phiD XD := by + change ColoredVertexSetClosed G phiD + (TreeSequenceVertexSet R.replacementTree) + exact hReplacementOrder.2.2.2.2 + have hug0X : ug0 ∈ X := by + change C.blockVertex (D.gammaIndex d) 0 ∈ TreeSequenceVertexSet T + rw [← C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)] + simp [TreeSequenceVertexSet] + have hug1X : ug1 ∈ X := by + change C.blockVertex (D.gammaIndex d) 1 ∈ TreeSequenceVertexSet T + rw [← C.block_vertex_position (D.gammaIndex d) (1 : Fin 2)] + simp [TreeSequenceVertexSet] + have hug01 : ug0 ≠ ug1 := by + intro h + have hv := + (C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)).trans + (h.trans (C.block_vertex_position (D.gammaIndex d) (1 : Fin 2)).symm) + have hi := congrArg Fin.val (T.vertex_injective hv) + simp at hi + have hy0X : y0 ∈ X := by + change C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ ∈ + TreeSequenceVertexSet T + rw [← C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩] + simp [TreeSequenceVertexSet] + have hy0ne0 : y0 ≠ ug0 := by + intro h + have hv := + (C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩).trans + (h.trans (C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)).symm) + have hi := congrArg Fin.val (T.vertex_injective hv) + simp at hi + have hp := C.p_ge_two + omega + have hy0ne1 : y0 ≠ ug1 := by + intro h + have hv := + (C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩).trans + (h.trans (C.block_vertex_position (D.gammaIndex d) (1 : Fin 2)).symm) + have hi := congrArg Fin.val (T.vertex_injective hv) + simp at hi + have hy0Z : y0 ∈ Z := by + simp [Z, hy0X, hy0ne0, hy0ne1] + have hy0XD : y0 ∈ XD := by + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] + exact Finset.mem_union_left _ (by simpa [X, Z, ug0, ug1] using hy0Z) + have hu1XD : R.u1 ∈ XD := by + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] + simp + have hu2XD : R.u2 ∈ XD := by + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] + simp + have hug0NotXD : ug0 ∉ XD := by + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] + simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton, + Finset.mem_sdiff] + rintro (⟨-, hpair⟩ | h | h) + · exact hpair (by simp [ug0]) + · exact R.u1_outside (h ▸ hug0X) + · exact R.u2_outside (h ▸ hug0X) + have hf1u1 : Incident G R.u1 R.f1 := by + change R.u1 ∈ G.ends R.f1 + rw [R.f1_ends] + simp [] + have hf2u2 : Incident G R.u2 R.f2 := by + change R.u2 ∈ G.ends R.f2 + rw [R.f2_ends] + simp [] + exact @helper_continuation_675 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R alpha hAlpha hXElementary hXClosed hXDElementary hXDClosed hug0X hug1X + hug01 hy0X hy0Z hy0XD hu1XD hu2XD hug0NotXD hf1u1 hf2u2 +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementPairFixed.lean b/LeanPool/GoldbergSeymour/ScheideReplacementPairFixed.lean new file mode 100644 index 0000000000..d388a1c264 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementPairFixed.lean @@ -0,0 +1,192 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideReplacementData + +/-! +# Scheide Replacement Pair Fixed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideReplacementPairFixed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + ∀ f : E, (Incident G R.u1 f ∨ Incident G R.u2 f) → + TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) f = phi f := by + classical + intro f hf + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have no_u1 : Sum.inl R.u1 ∉ + TwoColorComponent G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) := by + intro hu + have hf1u : Incident G R.u1 R.f1 := by + change R.u1 ∈ G.ends R.f1 + rw [R.f1_ends] + simp [] + have hadj₁ : (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).Adj + (Sum.inl R.u1) (Sum.inr R.f1) := by + simp [TwoColorIncidenceGraph, hf1u, R.f1_color] + have hf1c : Sum.inr R.f1 ∈ + TwoColorComponent G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) := by + change (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).connectedComponentMk + (Sum.inr R.f1) = + (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).connectedComponentMk + (Sum.inl (D.v0 d)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj₁).symm.trans hu + have hf1v : Incident G R.v1 R.f1 := by + change R.v1 ∈ G.ends R.f1 + rw [R.f1_ends] + simp [] + have hadj₂ : (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).Adj + (Sum.inr R.f1) (Sum.inl R.v1) := by + simp [TwoColorIncidenceGraph, hf1v, R.f1_color] + have hv1c : Sum.inl R.v1 ∈ + TwoColorComponent G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) := by + change (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).connectedComponentMk + (Sum.inl R.v1) = + (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).connectedComponentMk + (Sum.inl (D.v0 d)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj₂).symm.trans hf1c + have hv1tree : R.v1 ∈ TreeSequenceVertexSet T := by + have hrem : R.v1 ∈ TreeSequenceVertexSet T ∧ + R.v1 ≠ C.blockVertex (D.gammaIndex d) 0 ∧ + R.v1 ≠ C.blockVertex (D.gammaIndex d) 1 := by + simpa using R.v1_in_remainder + exact hrem.1 + have hv1 : R.v1 = D.v0 d := + ScheideDefectiveTailExternal G k e0 phi T C D d R.v1 hv1tree hv1c + have hf0v : Incident G (D.v0 d) (D.f0 d) := by + change D.v0 d ∈ G.ends (D.f0 d) + rw [D.f0_ends] + simp [] + have hf0c : phi (D.f0 d) = some d.1 := D.f0_color d + have hadj : AdjacentEdges G (D.f0 d) R.f1 := + ⟨D.v0 d, hf0v, hv1 ▸ hf1v⟩ + have hbad := hproper R.f0_ne_f1 hadj hf0c + exact hbad R.f1_color + have no_u2 : Sum.inl R.u2 ∉ + TwoColorComponent G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) := by + intro hu + have hf2u : Incident G R.u2 R.f2 := by + change R.u2 ∈ G.ends R.f2 + rw [R.f2_ends] + simp [] + have hadj₁ : (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).Adj + (Sum.inl R.u2) (Sum.inr R.f2) := by + simp [TwoColorIncidenceGraph, hf2u, R.f2_color] + have hf2c : Sum.inr R.f2 ∈ + TwoColorComponent G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) := by + change (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).connectedComponentMk + (Sum.inr R.f2) = + (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).connectedComponentMk + (Sum.inl (D.v0 d)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj₁).symm.trans hu + have hf2v : Incident G R.v2 R.f2 := by + change R.v2 ∈ G.ends R.f2 + rw [R.f2_ends] + simp [] + have hadj₂ : (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).Adj + (Sum.inr R.f2) (Sum.inl R.v2) := by + simp [TwoColorIncidenceGraph, hf2v, R.f2_color] + have hv2c : Sum.inl R.v2 ∈ + TwoColorComponent G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) := by + change (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).connectedComponentMk + (Sum.inl R.v2) = + (TwoColorIncidenceGraph G phi + (C.gamma (D.gammaIndex d)) d.1).connectedComponentMk + (Sum.inl (D.v0 d)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj₂).symm.trans hf2c + have hv2tree : R.v2 ∈ TreeSequenceVertexSet T := by + have hrem : R.v2 ∈ TreeSequenceVertexSet T ∧ + R.v2 ≠ C.blockVertex (D.gammaIndex d) 0 ∧ + R.v2 ≠ C.blockVertex (D.gammaIndex d) 1 := by + simpa using R.v2_in_remainder + exact hrem.1 + have hv2 : R.v2 = D.v0 d := + ScheideDefectiveTailExternal G k e0 phi T C D d R.v2 hv2tree hv2c + have hf0v : Incident G (D.v0 d) (D.f0 d) := by + change D.v0 d ∈ G.ends (D.f0 d) + rw [D.f0_ends] + simp [] + have hadj : AdjacentEdges G (D.f0 d) R.f2 := + ⟨D.v0 d, hf0v, hv2 ▸ hf2v⟩ + have hbad := hproper R.f0_ne_f2 hadj (D.f0_color d) + exact hbad R.f2_color + have edge_not : + ∀ (u : V) (e : E), Incident G u e → Sum.inl u ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex + d)) d.1 (Sum.inl (D.v0 d)) → Sum.inr e ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex + d)) d.1 (Sum.inl (D.v0 d)) := by + intro u e hue huc hec + let H := TwoColorIncidenceGraph G phi (C.gamma (D.gammaIndex d)) d.1 + have hr : H.Reachable (Sum.inl (D.v0 d)) (Sum.inr e) := by + apply SimpleGraph.ConnectedComponent.eq.mp + change H.connectedComponentMk (Sum.inr e) = + H.connectedComponentMk (Sum.inl (D.v0 d)) at hec + exact hec.symm + have hne : Sum.inl (D.v0 d) ≠ Sum.inr e := by + intro h + cases h + have hs : Sum.inr e ∈ H.support := + SimpleGraph.mem_support_of_reachable hne.symm hr.symm + obtain ⟨w, hw⟩ := H.mem_support.mp hs + have hcol : phi e = some (C.gamma (D.gammaIndex d)) ∨ + phi e = some d.1 := by + cases w with + | inl w => + exact hw.2 + | inr w => + simp [H, TwoColorIncidenceGraph] at hw + have ha : H.Adj (Sum.inl u) (Sum.inr e) := by + simp [H, TwoColorIncidenceGraph, hue, hcol] + apply huc + change H.connectedComponentMk (Sum.inl u) = + H.connectedComponentMk (Sum.inl (D.v0 d)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj ha).trans hec + unfold TwoColorComponentSwap + rcases hf with hf | hf + · simp [edge_not R.u1 f hf no_u1] + · simp [edge_not R.u2 f hf no_u2] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementPairsLaminar.lean b/LeanPool/GoldbergSeymour/ScheideReplacementPairsLaminar.lean new file mode 100644 index 0000000000..26a62402d4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementPairsLaminar.lean @@ -0,0 +1,126 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.ScheideReplacementInternalMissing + +/-! +# Scheide Replacement Pairs Laminar + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideReplacementPairsLaminar {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) : + ∀ d d', + ({(R d).u1, (R d).u2} : Finset V) = ({(R d').u1, (R d').u2} : Finset V) ∨ + Disjoint ({(R d).u1, (R d).u2} : Finset V) ({(R d').u1, (R d').u2} : Finset V) := by + intro d d' + let y₀ : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have y₀_mem : y₀ ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image] + refine ⟨⟨0, by omega⟩, ?_⟩ + simpa using (C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩) + have y₀_ne_block : ∀ q j, + y₀ ≠ C.blockVertex (D.gammaIndex q) j := by + intro q j h + change C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ = + C.blockVertex (D.gammaIndex q) j at h + have hv : T.vertex ⟨0, by omega⟩ = + T.vertex ⟨C.p + 2 * (D.gammaIndex q).val + j.val, by + have hp := C.p_ge_two + have hc := C.length_eq + have hq := (D.gammaIndex q).isLt + have hj := j.isLt + omega⟩ := by + calc + T.vertex ⟨0, by omega⟩ = C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ := + (C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩) + _ = C.blockVertex (D.gammaIndex q) j := h + _ = T.vertex ⟨C.p + 2 * (D.gammaIndex q).val + j.val, by + have hp := C.p_ge_two + have hc := C.length_eq + have hq := (D.gammaIndex q).isLt + have hj := j.isLt + omega⟩ := (C.block_vertex_position _ _).symm + have hind := T.vertex_injective hv + have hnum := congrArg Fin.val hind + have hzero : (0 : ℕ) = C.p + 2 * (D.gammaIndex q).val + j.val := hnum + have hp := C.p_ge_two + omega + have y₀_remainder : ∀ q, y₀ ∈ TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex q) 0, C.blockVertex (D.gammaIndex q) 1} := by + intro q + exact Finset.mem_sdiff.mpr ⟨y₀_mem, by + simp only [Finset.mem_insert, Finset.mem_singleton] + intro h + rcases h with h | h + · exact y₀_ne_block q 0 h + · exact y₀_ne_block q 1 h⟩ + have internal : ∀ q : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ∃ f : E, + phi f = some D.alpha0 ∧ G.ends f = s((R q).u1, (R q).u2) := by + intro q + apply ScheideReplacementInternalMissing G k e0 phi T C D q (R q) + D.alpha0 + · exact D.alpha0_not_block (D.gammaIndex q) + · exact ⟨y₀, y₀_remainder q, D.alpha0_missing_at_y0⟩ + have proper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + by_cases overlap : Disjoint ({(R d).u1, (R d).u2} : Finset V) + ({(R d').u1, (R d').u2} : Finset V) + · exact Or.inr overlap + · left + have common : ∃ v : V, v ∈ ({(R d).u1, (R d).u2} : Finset V) ∧ + v ∈ ({(R d').u1, (R d').u2} : Finset V) := by + by_contra no_common + apply overlap + exact Finset.disjoint_left.mpr (by + intro v hv hv' + exact no_common ⟨v, hv, hv'⟩) + obtain ⟨v, hv, hv'⟩ := common + obtain ⟨f, hfcolor, hfends⟩ := internal d + obtain ⟨f', hf'color, hf'ends⟩ := internal d' + have hinc : Incident G v f := by + change v ∈ G.ends f + rw [hfends] + apply Sym2.mem_iff.mpr + simpa using hv + have hinc' : Incident G v f' := by + change v ∈ G.ends f' + rw [hf'ends] + apply Sym2.mem_iff.mpr + simpa using hv' + have hedge : f = f' := by + by_contra hne + have hbad := proper hne ⟨v, hinc, hinc'⟩ hfcolor + exact hbad hf'color + have hpair : s((R d).u1, (R d).u2) = + s((R d').u1, (R d').u2) := by + rw [← hfends, hedge, hf'ends] + rcases Sym2.eq_iff.mp hpair with h | h + · simp [h.1, h.2] + · rw [h.1, h.2] + exact Finset.pair_comm _ _ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementPathPrefix.lean b/LeanPool/GoldbergSeymour/ScheideReplacementPathPrefix.lean new file mode 100644 index 0000000000..6fb3b21891 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementPathPrefix.lean @@ -0,0 +1,348 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideLastExitPath +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap + +/-! +# Scheide Replacement Path Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ScheideReplacementPathPrefix_hnoDeparture_193.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (L : ScheideLastExitPath G k e0 + phi T C D R alpha) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin + k) (Sum.inl (D.v0 d))) D.alpha0 alpha = TwoColorIncidenceGraph G phi D.alpha0 alpha → + alpha ∉ DefectiveColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (TreeSequenceVertexSet (R d).replacementTree) → + let phiD := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)); + let VT := TreeSequenceVertexSet (R d).replacementTree; + let y0 := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩; y0 ∈ VT → ColoredVertexSetClosed + G phiD VT → D.alpha0 ∈ MissingColors G phiD y0 → L.crossing ∈ BoundaryEdges G VT → phiD + L.crossing = some alpha → + ∀ (n : ℕ) (y x : V) (e : E), n + 2 ≤ (↑L.lastIndex : ℕ) → L.path.getVert n = Sum.inl y → y ∈ + VT → L.path.getVert (n + 1) = Sum.inr e → L.path.getVert (n + 2) = Sum.inl x → x ∉ VT → + False := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha L d hgraph hnondef phiD VT y0 hy0VT hclosed + hy0Missing hcross hcrossColor n y x e hnl hny hy hne hexc hx + have ha := L.path.adj_getVert_succ (i := n) (by + have h := L.followingVertex + omega) + have hb := L.path.adj_getVert_succ (i := n + 1) (by + have h := L.followingVertex + omega) + rw [hny, hne] at ha + rw [hne, hexc] at hb + rw [← hgraph] at ha hb + simp only [TwoColorIncidenceGraph, Incident] at ha hb + have hneYX : y ≠ x := by + intro heq + have hi := L.pathSimple.getVert_injOn + (show n ≤ L.path.length by omega) + (show n + 2 ≤ L.path.length by omega) + (by rw [hny, hexc, heq]) + omega + have hedge : e ∈ BoundaryEdges G VT := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨y, hy, x, hx, (Sym2.mem_and_mem_iff hneYX).mp ⟨ha.1, hb.1⟩⟩ + have hnot0 : phiD e ≠ some D.alpha0 := by + intro he0 + exact (hclosed hedge hy0VT he0) hy0Missing + have healpha : phiD e = some alpha := by + rcases ha.2 with he0 | hea + · exact False.elim (hnot0 he0) + · exact hea + have hene : e ≠ L.crossing := by + intro heq + have hi := L.pathSimple.getVert_injOn + (show n + 1 ≤ L.path.length by omega) + (show L.lastIndex.val + 1 ≤ L.path.length by + have hfollow := L.followingVertex + omega) + (by rw [hne, L.crossingAt, heq]) + omega + have hmem : alpha ∈ DefectiveColors G phiD VT := by + simp only [DefectiveColors, Finset.mem_filter, Finset.mem_univ, true_and] + change 2 ≤ (BoundaryColorEdges G phiD VT alpha).card + have hs : ({L.crossing, e} : Finset E) ⊆ BoundaryColorEdges G phiD VT alpha := by + intro q hq + simp only [Finset.mem_insert, Finset.mem_singleton] at hq + rcases hq with rfl | rfl + · simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hcross, hcrossColor⟩ + · simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hedge, healpha⟩ + have hc := Finset.card_le_card hs + rw [Finset.card_pair hene.symm] at hc + exact hc + exact hnondef hmem + +private theorem ScheideReplacementPathPrefix_hconf_251.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (L : ScheideLastExitPath G k e0 + phi T C D R alpha) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin + k) (Sum.inl (D.v0 d))) D.alpha0 alpha = TwoColorIncidenceGraph G phi D.alpha0 alpha → + let VT := TreeSequenceVertexSet (R d).replacementTree; + let y0 := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩; y0 ∈ VT → ( + ∀ (n : ℕ) (y x : V) (e : E), n + 2 ≤ (↑L.lastIndex : ℕ) → L.path.getVert n = Sum.inl y → y ∈ + VT → L.path.getVert (n + 1) = Sum.inr e → L.path.getVert (n + 2) = Sum.inl x → x ∉ VT → + False) → + ∀ n ≤ (↑L.lastIndex : ℕ), + ∀ (x : V), L.path.getVert n = Sum.inl x → x ∈ VT := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha L d hgraph VT y0 hy0VT hnoDeparture n + induction n using Nat.strong_induction_on with + | h n ih => + intro hn x hx + by_cases hn0 : n = 0 + · subst n + rw [L.path.getVert_zero] at hx + injection hx with hxe + subst x + exact hy0VT + by_cases hn1 : n = 1 + · have ha := L.path.adj_getVert_succ (i := 0) (by + have h := L.followingVertex + omega) + subst n + rw [L.path.getVert_zero, hx, ← hgraph] at ha + simp [TwoColorIncidenceGraph] at ha + · have hprev := L.path.adj_getVert_succ (i := n - 1) (by + have h := L.followingVertex + omega) + rw [show n - 1 + 1 = n by omega, hx] at hprev + cases hmid : L.path.getVert (n - 1) with + | inl z => + rw [hmid, ← hgraph] at hprev + simp [TwoColorIncidenceGraph] at hprev + | inr e => + have hbefore := L.path.adj_getVert_succ (i := n - 2) (by + have h := L.followingVertex + omega) + rw [show n - 2 + 1 = n - 1 by omega, hmid] at hbefore + cases hleft : L.path.getVert (n - 2) with + | inl y => + rw [hleft, ← hgraph] at hbefore + simp only [TwoColorIncidenceGraph] at hbefore + have hy := ih (n - 2) (by omega) (by omega) y hleft + by_cases hxVT : x ∈ VT + · exact hxVT + · exfalso + apply hnoDeparture (n - 2) y x e (by omega) + hleft hy (by simpa [show n - 2 + 1 = n - 1 by omega] using hmid) + (by simpa [show n - 2 + 2 = n by omega] using hx) hxVT + | inr q => + rw [hleft, ← hgraph] at hbefore + simp [TwoColorIncidenceGraph] at hbefore + +theorem ScheideReplacementPathPrefix {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) + (alpha : Fin k) + (L : ScheideLastExitPath G k e0 phi T C D R alpha) + (d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}) + (hpair : L.lastInside ∈ ({(R d).u1, (R d).u2} : Finset V)) + (hgraph : TwoColorIncidenceGraph G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) D.alpha0 alpha = + TwoColorIncidenceGraph G phi D.alpha0 alpha) + (hnondef : alpha ∉ DefectiveColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) + (TreeSequenceVertexSet (R d).replacementTree)) : + ∀ (j : Fin (L.path.length + 1)), j.val ≤ L.lastIndex.val → + ∀ x : V, L.path.getVert j.val = Sum.inl x → x ∈ TreeSequenceVertexSet (R d).replacementTree + := by + classical + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + let VT := TreeSequenceVertexSet (R d).replacementTree + let X := ScheideEnlargedVertexSet R + let y0 : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hVTsubX : VT ⊆ X := by + intro v hv + change v ∈ TreeSequenceVertexSet (R d).replacementTree at hv + rw [(R d).replacement_vertices] at hv + rcases Finset.mem_union.mp hv with hvT | hvPair + · exact Finset.mem_union_left _ (Finset.mem_sdiff.mp hvT).1 + · unfold X ScheideEnlargedVertexSet + apply Finset.mem_union_right + apply Finset.mem_biUnion.mpr + exact ⟨d, Finset.mem_univ _, hvPair⟩ + have hy0VT : y0 ∈ VT := by + have hposOld : (0 : ℕ) < T.length + 1 := by omega + have hposNew : (0 : ℕ) < (R d).replacementTree.length + 1 := by omega + have hzero : (0 : ℕ) ≤ C.p - 1 + 2 * (D.gammaIndex d).val := by omega + have hv : (R d).replacementTree.vertex ⟨0, hposNew⟩ = y0 := by + calc + (R d).replacementTree.vertex ⟨0, hposNew⟩ = T.vertex ⟨0, hposOld⟩ := + (R d).retained_vertices_before 0 hzero hposOld + _ = y0 := by + simpa [y0] using C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [VT, TreeSequenceVertexSet] using + (show ∃ i : Fin ((R d).replacementTree.length + 1), + (R d).replacementTree.vertex i = y0 from ⟨⟨0, hposNew⟩, hv⟩) + have hy0T : y0 ∈ TreeSequenceVertexSet T := by + have hpos : (0 : ℕ) < T.length + 1 := by omega + have hv := C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + simpa [y0, TreeSequenceVertexSet] using + (show ∃ i : Fin (T.length + 1), T.vertex i = y0 from + ⟨⟨0, hpos⟩, by simpa [y0] using hv⟩) + have hclosed : ColoredVertexSetClosed G phiD VT := by + have hm := ScheideReplacementMaximum G k e0 phi T C D d (R d) + dsimp at hm + change ColoredVertexSetClosed G phiD + (TreeSequenceVertexSet (R d).replacementTree) + exact (ScheideGlobalMaximumOrder G k e0 phiD (R d).replacementTree + hm.2.2).2.2.2.2 + have hTclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := by + exact (ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).2.2.2.2 + have halpha0NeDelta : D.alpha0 ≠ d.1 := by + intro heq + have hf : (R d).f1 ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨(R d).v1, (Finset.mem_sdiff.mp (R d).v1_in_remainder).1, + (R d).u1, (R d).u1_outside, (R d).f1_ends⟩ + have hm := D.alpha0_missing_at_y0 + have hc := heq ▸ (R d).f1_color + exact (hTclosed hf hy0T hc) hm + have halpha0NeGamma : D.alpha0 ≠ C.gamma (D.gammaIndex d) := + D.alpha0_not_block (D.gammaIndex d) + have hfirstFixed : ∀ e : E, + phiD e = some D.alpha0 ↔ phi e = some D.alpha0 := by + intro e + have hgamma : C.gamma (D.gammaIndex d) ≠ d.1 := by + intro heq + have hm : C.gamma (D.gammaIndex d) ∉ PresentColors G phi (D.v0 d) := by + simpa [MissingColors] using D.gamma_missing_at_v0 d + apply hm + unfold PresentColors + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨D.f0 d, by unfold Incident; rw [D.f0_ends]; simp, + heq.symm ▸ D.f0_color d⟩ + have hother : ∀ c : Fin k, c ≠ C.gamma (D.gammaIndex d) → c ≠ d.1 → + (phiD e = some c ↔ phi e = some c) := by + intro c hc hd + by_cases he : Sum.inr e ∈ TwoColorComponent G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + · by_cases hg : phi e = some (C.gamma (D.gammaIndex d)) + · have hv : phiD e = some d.1 := by + simp [phiD, TwoColorComponentSwap, he, hg] + rw [hv, hg] + simp [hc.symm, hd.symm] + · by_cases hdel : phi e = some d.1 + · have hv : phiD e = some (C.gamma (D.gammaIndex d)) := by + simp [phiD, TwoColorComponentSwap, he, hdel, hgamma.symm] + rw [hv, hdel] + simp [hc.symm, hd.symm] + · simp [phiD, TwoColorComponentSwap, he, hg, hdel] + · simp [phiD, TwoColorComponentSwap, he] + exact hother D.alpha0 halpha0NeGamma halpha0NeDelta + have hy0Missing : D.alpha0 ∈ MissingColors G phiD y0 := by + have hnot : D.alpha0 ∉ PresentColors G phiD y0 := by + intro hm + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hm + obtain ⟨e, he, hec⟩ := hm + have hec' : phi e = some D.alpha0 := (hfirstFixed e).mp hec + have hmold : D.alpha0 ∉ PresentColors G phi y0 := by + simpa [MissingColors] using D.alpha0_missing_at_y0 + apply hmold + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, he, hec'⟩ + simpa [MissingColors] using hnot + have hcross : L.crossing ∈ BoundaryEdges G VT := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨L.lastInside, ?_, L.firstOutside, ?_, ?_⟩ + · change L.lastInside ∈ TreeSequenceVertexSet (R d).replacementTree + rw [(R d).replacement_vertices] + simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] + exact Or.inr (by simpa using hpair) + · intro h + exact L.firstOutsideNotMem (hVTsubX h) + · have ha := L.path.adj_getVert_succ (i := L.lastIndex.val) (by + have h := L.followingVertex + omega) + have hb := L.path.adj_getVert_succ (i := L.lastIndex.val + 1) (by + have h := L.followingVertex + omega) + rw [L.lastInsideAt, L.crossingAt] at ha + rw [L.crossingAt, L.firstOutsideAt] at hb + simp only [TwoColorIncidenceGraph, Incident] at ha hb + have hne : L.lastInside ≠ L.firstOutside := by + intro heq + have hi := L.pathSimple.getVert_injOn + (show L.lastIndex.val ≤ L.path.length by omega) + (show L.lastIndex.val + 2 ≤ L.path.length by exact L.followingVertex) + (by rw [L.lastInsideAt, L.firstOutsideAt, heq]) + omega + exact (Sym2.mem_and_mem_iff hne).mp ⟨ha.1, hb.1⟩ + have hcrossColor : phiD L.crossing = some alpha := by + have ha := L.path.adj_getVert_succ (i := L.lastIndex.val) (by + have h := L.followingVertex + omega) + rw [L.lastInsideAt, L.crossingAt, ← hgraph] at ha + simp only [TwoColorIncidenceGraph, Incident] at ha + have hnot0 : phiD L.crossing ≠ some D.alpha0 := by + intro he0 + exact (hclosed hcross hy0VT he0) hy0Missing + rcases ha.2 with he0 | hea + · exact False.elim (hnot0 he0) + · exact hea + have hnoDeparture : + ∀ (n : ℕ) (y x : V) (e : E), n + 2 ≤ L.lastIndex.val → L.path.getVert n = Sum.inl y → y ∈ VT → + L.path.getVert (n + 1) = Sum.inr e → L.path.getVert (n + 2) = Sum.inl x → x ∉ VT → False + := by + exact @ScheideReplacementPathPrefix_hnoDeparture_193 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D R alpha L d hgraph hnondef hy0VT hclosed + hy0Missing hcross hcrossColor + have hconf : ∀ n : ℕ, n ≤ L.lastIndex.val → + ∀ x : V, L.path.getVert n = Sum.inl x → x ∈ VT := by + exact @ScheideReplacementPathPrefix_hconf_251 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D R alpha L d hgraph hy0VT hnoDeparture + intro j hj x hx + exact hconf j.val hj x hx + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementTreeSplice.lean b/LeanPool/GoldbergSeymour/ScheideReplacementTreeSplice.lean new file mode 100644 index 0000000000..0b41b77886 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementTreeSplice.lean @@ -0,0 +1,649 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideSelectedBlockDeletion +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Replacement Tree Splice + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_adjoin_facts_94.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) + (e0 : E) (A B : TreeSequence G e0) (f : E) (x y : V), G.ends f = s(x, y) → y ∉ + TreeSequenceVertexSet A → TreeSequenceAdjoinEdge A f B → B.vertex (Fin.last B.length) = y + ∧ TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) ∧ Finset.image B.edge + Finset.univ = insert f (Finset.image A.edge Finset.univ) := by + classical + intro V E _ _ G e0 A B f x y hxy hyA hAB + rcases hAB with ⟨hlen, hinit, hlast⟩ + rcases hinit with ⟨hle, hvertices, hedges⟩ + let j : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + have hjval : j.val = A.length := by simp [j] + obtain ⟨a, ha⟩ := B.attaches j + let aA : Fin (A.length + 1) := ⟨a.val, by simpa [hjval] using a.isLt⟩ + have haIndex : + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt)) = + Fin.castLE (Nat.succ_le_succ hle) aA := by + apply Fin.ext + rfl + have haOld : B.vertex + (Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt))) = + A.vertex aA := by + rw [haIndex] + exact hvertices aA + have haMem : B.vertex + (Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt))) ∈ + TreeSequenceVertexSet A := by + rw [haOld] + simp [TreeSequenceVertexSet] + have hjSucc : j.succ = Fin.last B.length := by + apply Fin.ext + simp [hjval] + omega + have hpair : s(x, y) = s(B.vertex j.succ, + B.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt)))) := by + rw [← hxy, ← hlast] + exact ha + have hlastVertex : B.vertex (Fin.last B.length) = y := by + rcases Sym2.eq_iff.mp hpair with hstraight | hcross + · exact (hyA (hstraight.2 ▸ haMem)).elim + · rw [← hjSucc] + exact hcross.2.symm + refine ⟨hlastVertex, ?_, ?_⟩ + · ext z + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and, Finset.mem_insert] + constructor + · rintro ⟨q, rfl⟩ + by_cases hq : q.val < A.length + 1 + · right + let qA : Fin (A.length + 1) := ⟨q.val, hq⟩ + refine ⟨qA, ?_⟩ + have hqIndex : q = Fin.castLE (Nat.succ_le_succ hle) qA := by + apply Fin.ext + rfl + rw [hqIndex, hvertices] + · left + have hqLast : q = Fin.last B.length := by + apply Fin.ext + simp + omega + rw [hqLast, hlastVertex] + · rintro (rfl | ⟨q, rfl⟩) + · exact ⟨Fin.last B.length, hlastVertex⟩ + · exact ⟨Fin.castLE (Nat.succ_le_succ hle) q, hvertices q⟩ + · ext g + simp only [Finset.mem_image, Finset.mem_univ, true_and, Finset.mem_insert] + constructor + · rintro ⟨q, rfl⟩ + by_cases hq : q.val < A.length + · right + let qA : Fin A.length := ⟨q.val, hq⟩ + refine ⟨qA, ?_⟩ + have hqIndex : q = Fin.castLE hle qA := by + apply Fin.ext + rfl + rw [hqIndex, hedges] + · left + have hqj : q = j := by + apply Fin.ext + simpa [hjval] using (show q.val = A.length by omega) + rw [hqj, hlast] + · rintro (rfl | ⟨q, rfl⟩) + · exact ⟨j, hlast⟩ + · exact ⟨Fin.castLE hle q, hedges q⟩ + +private theorem helper_branch_362.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (f1 f2 : E) (S : + TreeSequence G e0), S.length + (2 : ℕ) = T.length → + ∀ (rE : Fin S.length → Fin T.length), ( + ∀ (q : Fin S.length), S.edge q = T.edge (rE q)) → ( + ∀ (q : Fin S.length), (↑q : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.gammaIndex d) : ℕ) → (↑(rE q) + : ℕ) = (↑q : ℕ)) → ( + ∀ (q : Fin S.length), C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.gammaIndex d) : ℕ) ≤ (↑q : ℕ) → (↑(rE q) + : ℕ) = (↑q : ℕ) + (2 : ℕ)) → + ∀ (S1 : TreeSequence G e0), Finset.image S1.edge Finset.univ = insert f1 (Finset.image S.edge + Finset.univ) → + ∀ (S2 : TreeSequence G e0), Finset.image S2.edge Finset.univ = insert f2 (Finset.image S1.edge + Finset.univ) → S1.length = S.length + (1 : ℕ) → S2.length = S1.length + (1 : ℕ) → + Finset.image S2.edge Finset.univ = ((Finset.image T.edge Finset.univ).erase (C.blockEdge + (D.gammaIndex d) (0 : Fin (2 : ℕ)))).erase (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : + ℕ))) ∪ { f1, f2 } := by + classical + intro V E _ _ _ G k e0 phi T C D d f1 f2 S hSlen rE hSE hreBefore hreAfter S1 hS1edges S2 + hS2edges hlen1 hlen2 + have hnoBlock (q : Fin S.length) (j : Fin 2) : + S.edge q ≠ C.blockEdge (D.gammaIndex d) j := by + intro heq + let blockIndex : Fin T.length := + ⟨C.p - 1 + 2 * (D.gammaIndex d).val + j.val, by + have hi := (D.gammaIndex d).isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + omega⟩ + have hindex : rE q = blockIndex := by + apply T.edge_injective + calc + T.edge (rE q) = S.edge q := (hSE q).symm + _ = C.blockEdge (D.gammaIndex d) j := heq + _ = T.edge blockIndex := by + symm + exact C.block_edge_position (D.gammaIndex d) j + have hval := congrArg Fin.val hindex + by_cases hq : q.val < C.p - 1 + 2 * (D.gammaIndex d).val + · rw [hreBefore q hq] at hval + dsimp [blockIndex] at hval + omega + · rw [hreAfter q (by omega)] at hval + dsimp [blockIndex] at hval + have hj := j.isLt + omega + have hSedges : Finset.univ.image S.edge = + ((Finset.univ.image T.edge).erase + (C.blockEdge (D.gammaIndex d) 0)).erase + (C.blockEdge (D.gammaIndex d) 1) := by + ext e + simp only [Finset.mem_image, Finset.mem_univ, true_and, + Finset.mem_erase] + constructor + · rintro ⟨q, rfl⟩ + exact ⟨hnoBlock q 1, hnoBlock q 0, rE q, (hSE q).symm⟩ + · rintro ⟨hne1, hne0, t, rfl⟩ + let cut := C.p - 1 + 2 * (D.gammaIndex d).val + by_cases ht : t.val < cut + · let q : Fin S.length := ⟨t.val, by + have hi := (D.gammaIndex d).isLt + have hp := C.p_ge_two + have hc := C.length_eq + dsimp [cut] at ht + omega⟩ + refine ⟨q, ?_⟩ + rw [hSE q] + congr 1 + apply Fin.ext + apply hreBefore q + simpa [q, cut] using ht + · have ht0 : t.val ≠ cut := by + intro ht0 + apply hne0 + rw [← C.block_edge_position (D.gammaIndex d) 0] + congr 1 + apply Fin.ext + simpa [cut] using ht0 + have ht1 : t.val ≠ cut + 1 := by + intro ht1 + apply hne1 + rw [← C.block_edge_position (D.gammaIndex d) 1] + congr 1 + apply Fin.ext + simpa [cut] using ht1 + have ht2 : cut + 2 ≤ t.val := by omega + let q : Fin S.length := ⟨t.val - 2, by omega⟩ + refine ⟨q, ?_⟩ + rw [hSE q] + congr 1 + apply Fin.ext + have hr := hreAfter q (by dsimp [q]; omega) + rw [hr] + dsimp [q] + omega + rw [hS2edges, hS1edges, hSedges] + ext e + simp only [Finset.mem_insert, Finset.mem_union, Finset.mem_singleton] + tauto + +private theorem helper_branch_396.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (S : TreeSequence G e0) + (hSlen : S.length + (2 : ℕ) = T.length) (rV : Fin (S.length + (1 : ℕ)) → Fin (T.length + + (1 : ℕ))), ( + ∀ (q : Fin (S.length + (1 : ℕ))), S.vertex q = T.vertex (rV q)) → ( + ∀ (q : Fin (S.length + (1 : ℕ))), (↑q : ℕ) < C.p + (2 : ℕ) * (↑(D.gammaIndex d) : ℕ) → (↑(rV + q) : ℕ) = (↑q : ℕ)) → + ∀ (S1 S2 : TreeSequence G e0) (hlen1 : S1.length = S.length + (1 : ℕ)) (hlen2 : S2.length = + S1.length + (1 : ℕ)), S.length ≤ S1.length → + ∀ (_ : S2.length = T.length), ( + ∀ (q : Fin (S.length + (1 : ℕ))), S1.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : + ¬(↑q : ℕ) < S1.length + (1 : ℕ)) => + by + omega + ⟩ : Fin (S1.length + (1 : ℕ))) = S.vertex q) → ( + ∀ (q : Fin (S1.length + (1 : ℕ))), S2.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : + ¬(↑q : ℕ) < S2.length + (1 : ℕ)) => + by + omega + ⟩ : Fin (S2.length + (1 : ℕ))) = S1.vertex q) → + ∀ q ≤ C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.gammaIndex d) : ℕ), + ∀ (hq : q < T.length + (1 : ℕ)), S2.vertex (⟨q, + by omega + ⟩ : Fin (S2.length + (1 : ℕ))) = T.vertex (⟨q, hq⟩ : Fin (T.length + (1 : ℕ))) := by + classical + intro V E _ _ _ G k e0 phi T C D d S hSlen rV hSV hrvBefore S1 S2 hlen1 hlen2 hle1 + hreplacementLength hS1Vertex hS2Vertex q hqBefore hqT + let qS : Fin (S.length + 1) := ⟨q, by + have hi := (D.gammaIndex d).isLt + have hp := C.p_ge_two + have hc := C.length_eq + omega⟩ + let qS1 : Fin (S1.length + 1) := + ⟨q, Nat.lt_of_lt_of_le qS.isLt (Nat.succ_le_succ hle1)⟩ + calc + S2.vertex ⟨q, by rw [hreplacementLength]; omega⟩ = S1.vertex qS1 := + hS2Vertex qS1 + _ = S.vertex qS := hS1Vertex qS + _ = T.vertex (rV qS) := hSV qS + _ = T.vertex ⟨q, hqT⟩ := by + congr 1 + apply Fin.ext + apply hrvBefore qS + change q < C.p + 2 * (D.gammaIndex d).val + have hp := C.p_ge_two + omega + +private theorem helper_branch_429.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (S : TreeSequence G e0) + (hSlen : S.length + (2 : ℕ) = T.length) (rE : Fin S.length → Fin T.length), ( + ∀ (q : Fin S.length), S.edge q = T.edge (rE q)) → ( + ∀ (q : Fin S.length), (↑q : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.gammaIndex d) : ℕ) → (↑(rE q) + : ℕ) = (↑q : ℕ)) → + ∀ (S1 S2 : TreeSequence G e0) (hlen1 : S1.length = S.length + (1 : ℕ)) (hlen2 : S2.length = + S1.length + (1 : ℕ)), S.length ≤ S1.length → + ∀ (_ : S2.length = T.length), ( + ∀ (q : Fin S.length), S1.edge (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + S1.length) => + by omega + ⟩ : Fin S1.length) = S.edge q) → ( + ∀ (q : Fin S1.length), S2.edge (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + S2.length) => + by omega + ⟩ : Fin S2.length) = S1.edge q) → + ∀ q < C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.gammaIndex d) : ℕ), + ∀ (hq : q < T.length), S2.edge (⟨q, + by omega + ⟩ : Fin S2.length) = T.edge (⟨q, hq⟩ : Fin T.length) := by + classical + intro V E _ _ _ G k e0 phi T C D d S hSlen rE hSE hreBefore S1 S2 hlen1 hlen2 hle1 + hreplacementLength hS1Edge hS2Edge q hqBefore hqT + let qS : Fin S.length := ⟨q, by + have hi := (D.gammaIndex d).isLt + have hp := C.p_ge_two + have hc := C.length_eq + omega⟩ + let qS1 : Fin S1.length := + ⟨q, Nat.lt_of_lt_of_le qS.isLt hle1⟩ + calc + S2.edge ⟨q, by rw [hreplacementLength]; exact hqT⟩ = S1.edge qS1 := + hS2Edge qS1 + _ = S.edge qS := hS1Edge qS + _ = T.edge (rE qS) := hSE qS + _ = T.edge ⟨q, hqT⟩ := by + congr 1 + apply Fin.ext + exact hreBefore qS hqBefore + +private theorem helper_branch_447.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (S : TreeSequence G e0) + (hSlen : S.length + (2 : ℕ) = T.length) (rE : Fin S.length → Fin T.length), ( + ∀ (q : Fin S.length), S.edge q = T.edge (rE q)) → ( + ∀ (q : Fin S.length), C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.gammaIndex d) : ℕ) ≤ (↑q : ℕ) → (↑(rE q) + : ℕ) = (↑q : ℕ) + (2 : ℕ)) → + ∀ (S1 S2 : TreeSequence G e0) (hlen1 : S1.length = S.length + (1 : ℕ)) (hlen2 : S2.length = + S1.length + (1 : ℕ)), S.length ≤ S1.length → + ∀ (_ : S2.length = T.length), ( + ∀ (q : Fin S.length), S1.edge (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + S1.length) => + by omega + ⟩ : Fin S1.length) = S.edge q) → ( + ∀ (q : Fin S1.length), S2.edge (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + S2.length) => + by omega + ⟩ : Fin S2.length) = S1.edge q) → + ∀ (q : ℕ), C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.gammaIndex d) : ℕ) ≤ q → + ∀ (hq : q + (2 : ℕ) < T.length), S2.edge (⟨q, + by omega + ⟩ : Fin S2.length) = T.edge (⟨q + (2 : ℕ), hq⟩ : Fin T.length) := by + classical + intro V E _ _ _ G k e0 phi T C D d S hSlen rE hSE hreAfter S1 S2 hlen1 hlen2 hle1 + hreplacementLength hS1Edge hS2Edge q hqAfter hqT + let qS : Fin S.length := ⟨q, by omega⟩ + let qS1 : Fin S1.length := + ⟨q, Nat.lt_of_lt_of_le qS.isLt hle1⟩ + calc + S2.edge ⟨q, by rw [hreplacementLength]; omega⟩ = S1.edge qS1 := + hS2Edge qS1 + _ = S.edge qS := hS1Edge qS + _ = T.edge (rE qS) := hSE qS + _ = T.edge ⟨q + 2, hqT⟩ := by + congr 1 + apply Fin.ext + exact hreAfter qS hqAfter + +private theorem helper_branch_460.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (S : TreeSequence G e0) + (hSlen : S.length + (2 : ℕ) = T.length) (rV : Fin (S.length + (1 : ℕ)) → Fin (T.length + + (1 : ℕ))), ( + ∀ (q : Fin (S.length + (1 : ℕ))), S.vertex q = T.vertex (rV q)) → ( + ∀ (q : Fin (S.length + (1 : ℕ))), C.p + (2 : ℕ) * (↑(D.gammaIndex d) : ℕ) ≤ (↑q : ℕ) → (↑(rV + q) : ℕ) = (↑q : ℕ) + (2 : ℕ)) → + ∀ (S1 S2 : TreeSequence G e0) (hlen1 : S1.length = S.length + (1 : ℕ)) (hlen2 : S2.length = + S1.length + (1 : ℕ)), S.length ≤ S1.length → + ∀ (_ : S2.length = T.length), ( + ∀ (q : Fin (S.length + (1 : ℕ))), S1.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : + ¬(↑q : ℕ) < S1.length + (1 : ℕ)) => ( + by first | omega + )⟩ : Fin (S1.length + (1 : ℕ))) = S.vertex q) → ( + ∀ (q : Fin (S1.length + (1 : ℕ))), S2.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : + ¬(↑q : ℕ) < S2.length + (1 : ℕ)) => ( + by first | omega + )⟩ : Fin (S2.length + (1 : ℕ))) = S1.vertex q) → + ∀ (q : ℕ), C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.gammaIndex d) : ℕ) < q → + ∀ (hq : q + (2 : ℕ) < T.length + (1 : ℕ)), S2.vertex (⟨q, + by omega + ⟩ : Fin (S2.length + (1 : ℕ))) = T.vertex (⟨q + (2 : ℕ), hq⟩ : Fin (T.length + (1 : ℕ))) := by + classical + intro V E _ _ _ G k e0 phi T C D d S hSlen rV hSV hrvAfter S1 S2 hlen1 hlen2 hle1 + hreplacementLength hS1Vertex hS2Vertex q hqAfter hqT + let qS : Fin (S.length + 1) := ⟨q, by omega⟩ + let qS1 : Fin (S1.length + 1) := + ⟨q, Nat.lt_of_lt_of_le qS.isLt (Nat.succ_le_succ hle1)⟩ + calc + S2.vertex ⟨q, by rw [hreplacementLength]; omega⟩ = S1.vertex qS1 := + hS2Vertex qS1 + _ = S.vertex qS := hS1Vertex qS + _ = T.vertex (rV qS) := hSV qS + _ = T.vertex ⟨q + 2, hqT⟩ := by + congr 1 + apply Fin.ext + apply hrvAfter qS + change C.p + 2 * (D.gammaIndex d).val ≤ q + omega + +private theorem helper_branch_475.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (_ : ScheideDefectiveSetup G k e0 phi + T C) (_ : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (f1 f2 : E) (S : + TreeSequence G e0), S.length + (2 : ℕ) = T.length → + ∀ (S1 S2 : TreeSequence G e0) (hlen1 : S1.length = S.length + (1 : ℕ)), S1.edge (Fin.cast (( + by first | omega + )) (Fin.last S.length)) = f1 → + ∀ (hlen2 : S2.length = S1.length + (1 : ℕ)), S2.edge (Fin.cast (( + by first | omega + )) (Fin.last S1.length)) = f2 → + ∀ (hreplacementLength : S2.length = T.length), ( + ∀ (q : Fin S1.length), S2.edge (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < + S2.length) => + by omega + ⟩ : Fin S2.length) = S1.edge q) → S2.edge (⟨T.length - (2 : ℕ), + by omega + ⟩ : Fin S2.length) = f1 ∧ S2.edge (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin S2.length) = f2 := by + classical + intro V E _ _ _ G k e0 phi T C D d f1 f2 S hSlen S1 S2 hlen1 hlastEdge1 hlen2 hlastEdge2 + hreplacementLength hS2Edge + constructor + · let qS1 : Fin S1.length := ⟨T.length - 2, by omega⟩ + calc + S2.edge ⟨T.length - 2, by omega⟩ = S1.edge qS1 := hS2Edge qS1 + _ = S1.edge (Fin.cast hlen1.symm (Fin.last S.length)) := by + congr 1 + apply Fin.ext + simp [qS1] + omega + _ = f1 := hlastEdge1 + · calc + S2.edge ⟨T.length - 1, by omega⟩ = + S2.edge (Fin.cast hlen2.symm (Fin.last S1.length)) := by + congr 1 + apply Fin.ext + simp + omega + _ = f2 := hlastEdge2 + +private theorem helper_branch_493.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (_ : ScheideDefectiveSetup G k e0 phi + T C) (_ : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (u1 u2 : V) (S : + TreeSequence G e0), S.length + (2 : ℕ) = T.length → + ∀ (S1 : TreeSequence G e0), S1.vertex (Fin.last S1.length) = u1 → + ∀ (S2 : TreeSequence G e0), S2.vertex (Fin.last S2.length) = u2 → S1.length = S.length + (1 : + ℕ) → + ∀ (hlen2 : S2.length = S1.length + (1 : ℕ)) (hreplacementLength : S2.length = T.length), ( + ∀ (q : Fin (S1.length + (1 : ℕ))), S2.vertex (⟨(↑q : ℕ), Decidable.byContradiction fun (a : + ¬(↑q : ℕ) < S2.length + (1 : ℕ)) => ( + by first | omega + )⟩ : Fin (S2.length + (1 : ℕ))) = S1.vertex q) → S2.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (S2.length + (1 : ℕ))) = u1 ∧ S2.vertex (⟨T.length, + by omega + ⟩ : Fin (S2.length + (1 : ℕ))) = u2 := by + classical + intro V E _ _ _ G k e0 phi T C D d u1 u2 S hSlen S1 hlastVertex1 S2 hlastVertex2 hlen1 hlen2 + hreplacementLength hS2Vertex + constructor + · let qS1 : Fin (S1.length + 1) := ⟨T.length - 1, by omega⟩ + calc + S2.vertex ⟨T.length - 1, by omega⟩ = S1.vertex qS1 := + hS2Vertex qS1 + _ = S1.vertex (Fin.last S1.length) := by + congr 1 + apply Fin.ext + simp [qS1] + omega + _ = u1 := hlastVertex1 + · calc + S2.vertex ⟨T.length, by omega⟩ = S2.vertex (Fin.last S2.length) := by + congr 1 + apply Fin.ext + simp + omega + _ = u2 := hlastVertex2 + +theorem ScheideReplacementTreeSplice {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) : + ∀ (d : { delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T) }) (f1 f2 : E) (v1 + v2 u1 u2 : V), f1 ≠ f2 → u1 ≠ u2 → v1 ∈ TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} → v2 ∈ + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} → u1 ∉ + TreeSequenceVertexSet T → u2 ∉ TreeSequenceVertexSet T → G.ends f1 = s(v1, u1) → G.ends f2 + = s(v2, u2) → + ∃ replacementTree : TreeSequence G e0, + ∃ replacement_length : replacementTree.length = T.length, ( + ∀ q : ℕ, q < C.p - 1 + 2 * (D.gammaIndex d).val → + ∀ hq : q < T.length, replacementTree.edge ⟨q, + by omega + ⟩ = T.edge ⟨q, hq⟩) ∧ ( + ∀ q : ℕ, q ≤ C.p - 1 + 2 * (D.gammaIndex d).val → + ∀ hq : q < T.length + 1, replacementTree.vertex ⟨q, + by omega + ⟩ = T.vertex ⟨q, hq⟩) ∧ ( + ∀ q : ℕ, C.p - 1 + 2 * (D.gammaIndex d).val ≤ q → + ∀ hq : q + 2 < T.length, replacementTree.edge ⟨q, + by omega + ⟩ = T.edge ⟨q + 2, hq⟩) ∧ ( + ∀ q : ℕ, C.p - 1 + 2 * (D.gammaIndex d).val < q → + ∀ hq : q + 2 < T.length + 1, replacementTree.vertex ⟨q, + by omega + ⟩ = T.vertex ⟨q + 2, hq⟩) ∧ (replacementTree.edge ⟨T.length - 2, + by + have hi := (D.gammaIndex d).isLt + have hp := C.p_ge_two + have hc := C.length_eq + have _ := replacement_length + omega + ⟩ = f1 ∧ replacementTree.edge ⟨T.length - 1, + by + have hi := (D.gammaIndex d).isLt + have hp := C.p_ge_two + have hc := C.length_eq + have _ := replacement_length + omega + ⟩ = f2) ∧ (replacementTree.vertex ⟨T.length - 1, + by + have _ := (D.gammaIndex d).isLt + have _ := C.p_ge_two + have hc := C.length_eq + have _ := replacement_length + omega + ⟩ = u1 ∧ replacementTree.vertex ⟨T.length, + by + have _ := replacement_length + omega + ⟩ = u2) ∧ TreeSequenceVertexSet replacementTree = (TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1}) ∪ { u1, u2 } ∧ + Finset.univ.image replacementTree.edge = (((Finset.univ.image T.edge).erase (C.blockEdge + (D.gammaIndex d) 0)).erase (C.blockEdge (D.gammaIndex d) 1)) ∪ { f1, f2 } := by + classical + intro d f1 f2 v1 v2 u1 u2 hf12 hu12 hv1 hv2 hu1T hu2T hf1ends hf2ends + have adjoin_facts := @helper_adjoin_facts_94 V E inferInstance inferInstance G e0 + obtain ⟨S, hSvertices, hSlen, hVembedding, hEembedding, + hbaseVertices, hbaseEdges, hremainingBlocks, hedgeClass, + hSedgeOld, hSavoids⟩ := + ScheideSelectedBlockDeletion G k e0 phi T C (D.gammaIndex d) + obtain ⟨rV, hSV, hrvBefore, hrvAfter⟩ := hVembedding + obtain ⟨rE, hSE, hreBefore, hreAfter⟩ := hEembedding + have hv1S : v1 ∈ TreeSequenceVertexSet S := by + rw [hSvertices] + exact hv1 + have hv2S : v2 ∈ TreeSequenceVertexSet S := by + rw [hSvertices] + exact hv2 + have hu1S : u1 ∉ TreeSequenceVertexSet S := by + rw [hSvertices] + exact fun h => hu1T (Finset.mem_sdiff.mp h).1 + have hu2S : u2 ∉ TreeSequenceVertexSet S := by + rw [hSvertices] + exact fun h => hu2T (Finset.mem_sdiff.mp h).1 + have hf1Boundary : f1 ∈ BoundaryEdges G (TreeSequenceVertexSet S) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v1, hv1S, u1, hu1S, hf1ends⟩ + obtain ⟨S1, hSS1⟩ := + TreeSequenceBoundaryEdgeAppendExists S f1 hf1Boundary + obtain ⟨hlastVertex1, hS1vertices, hS1edges⟩ := + adjoin_facts S S1 f1 v1 u1 hf1ends hu1S hSS1 + have hv2S1 : v2 ∈ TreeSequenceVertexSet S1 := by + rw [hS1vertices] + exact Finset.mem_insert_of_mem hv2S + have hu2S1 : u2 ∉ TreeSequenceVertexSet S1 := by + rw [hS1vertices] + simp only [Finset.mem_insert, not_or] + exact ⟨hu12.symm, hu2S⟩ + have hf2Boundary : f2 ∈ BoundaryEdges G (TreeSequenceVertexSet S1) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v2, hv2S1, u2, hu2S1, hf2ends⟩ + obtain ⟨S2, hS1S2⟩ := + TreeSequenceBoundaryEdgeAppendExists S1 f2 hf2Boundary + obtain ⟨hlastVertex2, hS2vertices, hS2edges⟩ := + adjoin_facts S1 S2 f2 v2 u2 hf2ends hu2S1 hS1S2 + rcases hSS1 with ⟨hlen1, hinit1, hlastEdge1⟩ + rcases hS1S2 with ⟨hlen2, hinit2, hlastEdge2⟩ + rcases hinit1 with ⟨hle1, hV1, hE1⟩ + rcases hinit2 with ⟨hle2, hV2, hE2⟩ + have hreplacementLength : S2.length = T.length := by omega + have hS1Vertex (q : Fin (S.length + 1)) : + S1.vertex ⟨q.val, by omega⟩ = S.vertex q := by + have hq : (⟨q.val, by omega⟩ : Fin (S1.length + 1)) = + Fin.castLE (Nat.succ_le_succ hle1) q := by + apply Fin.ext + rfl + rw [hq] + exact hV1 q + have hS1Edge (q : Fin S.length) : + S1.edge ⟨q.val, by omega⟩ = S.edge q := by + have hq : (⟨q.val, by omega⟩ : Fin S1.length) = + Fin.castLE hle1 q := by + apply Fin.ext + rfl + rw [hq] + exact hE1 q + have hS2Vertex (q : Fin (S1.length + 1)) : + S2.vertex ⟨q.val, by omega⟩ = S1.vertex q := by + have hq : (⟨q.val, by omega⟩ : Fin (S2.length + 1)) = + Fin.castLE (Nat.succ_le_succ hle2) q := by + apply Fin.ext + rfl + rw [hq] + exact hV2 q + have hS2Edge (q : Fin S1.length) : + S2.edge ⟨q.val, by omega⟩ = S1.edge q := by + have hq : (⟨q.val, by omega⟩ : Fin S2.length) = + Fin.castLE hle2 q := by + apply Fin.ext + rfl + rw [hq] + exact hE2 q + refine ⟨S2, hreplacementLength, ?_⟩ + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact @helper_branch_429 V E inferInstance inferInstance inferInstance G k e0 phi T C D d S + hSlen rE hSE hreBefore S1 S2 hlen1 hlen2 hle1 hreplacementLength hS1Edge hS2Edge + · exact @helper_branch_396 V E inferInstance inferInstance inferInstance G k e0 phi T C D d S + hSlen rV hSV hrvBefore S1 S2 hlen1 hlen2 hle1 hreplacementLength hS1Vertex hS2Vertex + · exact @helper_branch_447 V E inferInstance inferInstance inferInstance G k e0 phi T C D d S + hSlen rE hSE hreAfter S1 S2 hlen1 hlen2 hle1 hreplacementLength hS1Edge hS2Edge + · exact @helper_branch_460 V E inferInstance inferInstance inferInstance G k e0 phi T C D d S + hSlen rV hSV hrvAfter S1 S2 hlen1 hlen2 hle1 hreplacementLength hS1Vertex hS2Vertex + · exact @helper_branch_475 V E inferInstance inferInstance inferInstance G k e0 phi T C D d f1 + f2 S hSlen S1 S2 hlen1 hlastEdge1 hlen2 hlastEdge2 hreplacementLength hS2Edge + · exact @helper_branch_493 V E inferInstance inferInstance inferInstance G k e0 phi T C D d u1 + u2 S hSlen S1 hlastVertex1 S2 hlastVertex2 hlen1 hlen2 hreplacementLength hS2Vertex + · rw [hS2vertices, hS1vertices, hSvertices] + ext x + simp only [Finset.mem_insert, Finset.mem_union, Finset.mem_singleton] + tauto + · exact @helper_branch_362 V E inferInstance inferInstance inferInstance G k e0 phi T C D d f1 + f2 S hSlen rE hSE hreBefore hreAfter S1 hS1edges S2 hS2edges hlen1 hlen2 +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementUnionClosed.lean b/LeanPool/GoldbergSeymour/ScheideReplacementUnionClosed.lean new file mode 100644 index 0000000000..391e090282 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementUnionClosed.lean @@ -0,0 +1,466 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideSymmetricMissingInternal + +/-! +# Scheide Replacement Union Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem ScheideReplacementUnionClosed_branch_104.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) {f : E} {c : Fin k} {v : V}, phi f = some c → c ∈ MissingColors G phi + v → ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) → + let phiD := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)); ( + ∀ {a : Fin k}, a ∈ MissingColors G phi (C.blockVertex (D.gammaIndex d) 0) ∨ a ∈ MissingColors + G phi (C.blockVertex (D.gammaIndex d) 1) → + ∃ (g : E), phi g = some a ∧ G.ends g = s(R.u1, R.u2)) → ( + ∃ (g : E), phi g = some c ∧ (G.ends g = s(R.u1, R.u2) ∨ G.ends g = s(C.blockVertex + (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1))) → + ∀ (u w : V), w ∉ TreeSequenceVertexSet T ∪ { R.u1, R.u2 } → G.ends f = s(u, w) → + IsProperEdgeColoring G phi → (u ∈ TreeSequenceVertexSet T → f ≠ D.f0 d → phiD f = phi f) → + u ∈ TreeSequenceVertexSet T ∨ u = R.u1 ∨ u = R.u2 → v ∈ TreeSequenceVertexSet T → False + := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R f c v hfc hmiss htreeClosed phiD pairInternal + pairOrBlock u w hw hends proper switchOnTree hu hvTree + have pairEdge : ∃ g : E, phi g = some c ∧ + G.ends g = s(R.u1, R.u2) := by + by_cases hv0 : v = C.blockVertex (D.gammaIndex d) 0 + · exact pairInternal (Or.inl (hv0 ▸ hmiss)) + · by_cases hv3 : v = C.blockVertex (D.gammaIndex d) 1 + · exact pairInternal (Or.inr (hv3 ▸ hmiss)) + · have hvrem : v ∈ (TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1}) := by + simp only [Finset.mem_sdiff, Finset.mem_insert, Finset.mem_singleton] + exact ⟨hvTree, by simp [hv0, hv3]⟩ + by_cases hc : c = C.gamma (D.gammaIndex d) + · subst c + obtain ⟨g, hgc, hge⟩ := + ScheideSymmetricDefectiveInternal G k e0 phi T C D d R |>.2 + exact ⟨g, hgc, hge⟩ + · exact ScheideReplacementInternalMissing G k e0 phi T C D d R c hc + ⟨v, hvrem, hmiss⟩ + rcases pairEdge with ⟨g, hgc, hge⟩ + by_cases huTree : u ∈ TreeSequenceVertexSet T + · have hb : f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨u, huTree, w, ?_, hends⟩ + intro hwT + exact hw (by simp [hwT]) + exact (htreeClosed hb hvTree hfc) hmiss + · have hpair : u = R.u1 ∨ u = R.u2 := by simpa [huTree] using hu + have hadj : AdjacentEdges G f g := by + rcases hpair with rfl | rfl + · refine ⟨R.u1, ?_, ?_⟩ <;> unfold Incident + · rw [hends]; simp + · rw [hge]; simp + · refine ⟨R.u2, ?_, ?_⟩ <;> unfold Incident + · rw [hends]; simp + · rw [hge]; simp + exact (proper (by + intro he + apply hw + simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] + right + rcases Sym2.eq_iff.mp (hends.symm.trans (he ▸ hge)) with h | h + · exact Or.inr h.2 + · exact Or.inl h.2) hadj hfc) hgc + +private theorem ScheideReplacementUnionClosed_branch_148.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) {f : E} {c : Fin k} {v : V}, phi f = some c → c ∈ MissingColors G phi + v → + let phiD := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)); ColoredVertexSetClosed G phiD (TreeSequenceVertexSet R.replacementTree) → ( + ∀ {a : Fin k}, a ∈ MissingColors G phi R.u1 ∨ a ∈ MissingColors G phi R.u2 → + ∃ (g : E), phi g = some a ∧ G.ends g = s(C.blockVertex (D.gammaIndex d) 0, C.blockVertex + (D.gammaIndex d) 1)) → ( + ∃ (g : E), phi g = some c ∧ (G.ends g = s(R.u1, R.u2) ∨ G.ends g = s(C.blockVertex + (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1))) → + ∀ (u w : V), w ∉ TreeSequenceVertexSet T ∪ { R.u1, R.u2 } → G.ends f = s(u, w) → + IsProperEdgeColoring G phi → (u ∈ TreeSequenceVertexSet T → f ≠ D.f0 d → phiD f = phi f) → + u ∈ TreeSequenceVertexSet T ∨ u = R.u1 ∨ u = R.u2 → v = R.u1 → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R f c v hfc hmiss phiD hrepClosed blockInternal + pairOrBlock u w hw hends proper switchOnTree hu hv1 + have notDelta : c ≠ d.1 := by + intro hc + subst c + have hm : d.1 ∈ MissingColors G phi R.u1 := hv1 ▸ hmiss + have hn : d.1 ∉ PresentColors G phi R.u1 := by + simpa [MissingColors] using hm + have hp : d.1 ∈ PresentColors G phi R.u1 := by + classical + rw [PresentColors] + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩ + exact ⟨R.f1, by change R.u1 ∈ G.ends R.f1; rw [R.f1_ends]; simp, + R.f1_color⟩ + exact hn hp + obtain ⟨g, hgc, hge⟩ := blockInternal (Or.inl (hv1 ▸ hmiss)) + have blockMem0 : C.blockVertex (D.gammaIndex d) 0 ∈ + TreeSequenceVertexSet T := by + let : DecidableEq V := Classical.decEq V + unfold TreeSequenceVertexSet + apply Finset.mem_image.mpr + refine ⟨⟨C.p + 2 * (D.gammaIndex d).val, by + have hh := C.length_eq + omega⟩, by simp, ?_⟩ + simpa using C.block_vertex_position (D.gammaIndex d) 0 + have blockMem1 : C.blockVertex (D.gammaIndex d) 1 ∈ + TreeSequenceVertexSet T := by + let : DecidableEq V := Classical.decEq V + unfold TreeSequenceVertexSet + apply Finset.mem_image.mpr + refine ⟨⟨C.p + 2 * (D.gammaIndex d).val + 1, by + have hh := C.length_eq + omega⟩, by simp, ?_⟩ + simpa using C.block_vertex_position (D.gammaIndex d) 1 + have hmissD : c ∈ MissingColors G phiD v := by + have hn : ¬ ∃ e, Incident G v e ∧ phi e = some c := by + simpa [MissingColors, PresentColors] using hmiss + have hnD : ¬ ∃ e, Incident G v e ∧ phiD e = some c := by + intro hp + rcases hp with ⟨e, he, hec⟩ + apply hn + refine ⟨e, he, ?_⟩ + rw [← ScheideReplacementPairFixed G k e0 phi T C D d R e] + · exact hec + · exact Or.inl (hv1 ▸ he) + simpa [MissingColors, PresentColors] using hnD + have huRep : u ∈ TreeSequenceVertexSet R.replacementTree := by + rw [R.replacement_vertices] + simp only [Finset.mem_union] + by_cases hu1 : u = R.u1 ∨ u = R.u2 + · exact Or.inr (by simpa using hu1) + · have hut : u ∈ TreeSequenceVertexSet T := by + simpa [hu1] using hu + by_cases hb0 : u = C.blockVertex (D.gammaIndex d) 0 + · have hfg : f ≠ g := by + intro he + apply hw + have hwg : w ∈ G.ends g := by + rw [← he, hends] + simp + rw [hge] at hwg + rcases Sym2.mem_iff.mp hwg with h | h + · simp [h, blockMem0] + · simp [h, blockMem1] + have hadj' : AdjacentEdges G f g := by + refine ⟨u, ?_, ?_⟩ + · change u ∈ G.ends f + rw [hends] + simp [hb0] + · change u ∈ G.ends g + rw [hge] + simp [hb0] + exact False.elim ((proper hfg hadj' hfc) hgc) + · by_cases hb1 : u = C.blockVertex (D.gammaIndex d) 1 + · have hfg : f ≠ g := by + intro he + apply hw + have hwg : w ∈ G.ends g := by + rw [← he, hends] + simp + rw [hge] at hwg + rcases Sym2.mem_iff.mp hwg with h | h + · simp [h, blockMem0] + · simp [h, blockMem1] + have hadj' : AdjacentEdges G f g := by + refine ⟨u, ?_, ?_⟩ + · change u ∈ G.ends f + rw [hends] + simp [hb1] + · change u ∈ G.ends g + rw [hge] + simp [hb1] + exact False.elim ((proper hfg hadj' hfc) hgc) + · exact Or.inl (by + simp only [Finset.mem_sdiff, Finset.mem_insert, Finset.mem_singleton] + exact ⟨hut, by simp [hb0, hb1]⟩) + have hwRep : w ∉ TreeSequenceVertexSet R.replacementTree := by + intro hwR + rw [R.replacement_vertices] at hwR + simp only [Finset.mem_union] at hwR + apply hw + apply Finset.mem_union.mpr + rcases hwR with hwR | hwR + · exact Or.inl (Finset.mem_sdiff.mp hwR).1 + · exact Or.inr (by simpa using hwR) + have hfb : f ∈ BoundaryEdges G (TreeSequenceVertexSet R.replacementTree) := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, huRep, w, hwRep, hends⟩ + have hne : f ≠ D.f0 d := by + intro he + have := hfc + rw [he, D.f0_color d] at this + exact notDelta (by simpa using this.symm) + have hfd : phiD f = some c := by + by_cases huPair : u = R.u1 ∨ u = R.u2 + · change TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) f = some c + rw [ScheideReplacementPairFixed G k e0 phi T C D d R f] + · exact hfc + · rcases huPair with huPair | huPair + · exact Or.inl (by change R.u1 ∈ G.ends f; rw [hends]; simp [huPair]) + · exact Or.inr (by change R.u2 ∈ G.ends f; rw [hends]; simp [huPair]) + · have hut : u ∈ TreeSequenceVertexSet T := by simpa [huPair] using hu + exact (switchOnTree hut hne).trans hfc + apply (hrepClosed (v := v) hfb (by + rw [R.replacement_vertices] + simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] + exact Or.inr (Or.inl hv1)) hfd) + exact hmissD + +private theorem ScheideReplacementUnionClosed_branch_276.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) {f : E} {c : Fin k} {v : V}, phi f = some c → c ∈ MissingColors G phi + v → + let phiD := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)); ColoredVertexSetClosed G phiD (TreeSequenceVertexSet R.replacementTree) → ( + ∀ {a : Fin k}, a ∈ MissingColors G phi R.u1 ∨ a ∈ MissingColors G phi R.u2 → + ∃ (g : E), phi g = some a ∧ G.ends g = s(C.blockVertex (D.gammaIndex d) 0, C.blockVertex + (D.gammaIndex d) 1)) → ( + ∃ (g : E), phi g = some c ∧ (G.ends g = s(R.u1, R.u2) ∨ G.ends g = s(C.blockVertex + (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1))) → + ∀ (u w : V), w ∉ TreeSequenceVertexSet T ∪ { R.u1, R.u2 } → G.ends f = s(u, w) → + IsProperEdgeColoring G phi → (u ∈ TreeSequenceVertexSet T → f ≠ D.f0 d → phiD f = phi f) → + u ∈ TreeSequenceVertexSet T ∨ u = R.u1 ∨ u = R.u2 → v = R.u2 → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R f c v hfc hmiss phiD hrepClosed blockInternal + pairOrBlock u w hw hends proper switchOnTree hu hv2 + have notDelta : c ≠ d.1 := by + intro hc + subst c + have hm : d.1 ∈ MissingColors G phi R.u2 := hv2 ▸ hmiss + have hn : d.1 ∉ PresentColors G phi R.u2 := by simpa [MissingColors] using hm + have hp : d.1 ∈ PresentColors G phi R.u2 := by + classical + rw [PresentColors] + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩ + exact ⟨R.f2, by change R.u2 ∈ G.ends R.f2; rw [R.f2_ends]; simp, + R.f2_color⟩ + exact hn hp + obtain ⟨g, hgc, hge⟩ := blockInternal (Or.inr (hv2 ▸ hmiss)) + have blockMem0 : C.blockVertex (D.gammaIndex d) 0 ∈ + TreeSequenceVertexSet T := by + let : DecidableEq V := Classical.decEq V + unfold TreeSequenceVertexSet + apply Finset.mem_image.mpr + refine ⟨⟨C.p + 2 * (D.gammaIndex d).val, by + have hh := C.length_eq + omega⟩, by simp, ?_⟩ + simpa using C.block_vertex_position (D.gammaIndex d) 0 + have blockMem1 : C.blockVertex (D.gammaIndex d) 1 ∈ + TreeSequenceVertexSet T := by + let : DecidableEq V := Classical.decEq V + unfold TreeSequenceVertexSet + apply Finset.mem_image.mpr + refine ⟨⟨C.p + 2 * (D.gammaIndex d).val + 1, by + have hh := C.length_eq + omega⟩, by simp, ?_⟩ + simpa using C.block_vertex_position (D.gammaIndex d) 1 + have hmissD : c ∈ MissingColors G phiD v := by + have hn : ¬ ∃ e, Incident G v e ∧ phi e = some c := by + simpa [MissingColors, PresentColors] using hmiss + have hnD : ¬ ∃ e, Incident G v e ∧ phiD e = some c := by + intro hp + rcases hp with ⟨e, he, hec⟩ + apply hn + refine ⟨e, he, ?_⟩ + rw [← ScheideReplacementPairFixed G k e0 phi T C D d R e] + · exact hec + · exact Or.inr (hv2 ▸ he) + simpa [MissingColors, PresentColors] using hnD + have huRep : u ∈ TreeSequenceVertexSet R.replacementTree := by + rw [R.replacement_vertices] + simp only [Finset.mem_union] + by_cases hu1 : u = R.u1 ∨ u = R.u2 + · exact Or.inr (by simpa using hu1) + · have hut : u ∈ TreeSequenceVertexSet T := by simpa [hu1] using hu + by_cases hb0 : u = C.blockVertex (D.gammaIndex d) 0 + · have hfg : f ≠ g := by + intro he + apply hw + have hwg : w ∈ G.ends g := by rw [← he, hends]; simp + rw [hge] at hwg + rcases Sym2.mem_iff.mp hwg with h | h + · simp [h, blockMem0] + · simp [h, blockMem1] + have hadj' : AdjacentEdges G f g := by + refine ⟨u, ?_, ?_⟩ + · change u ∈ G.ends f; rw [hends]; simp [hb0] + · change u ∈ G.ends g; rw [hge]; simp [hb0] + exact False.elim ((proper hfg hadj' hfc) hgc) + · by_cases hb1 : u = C.blockVertex (D.gammaIndex d) 1 + · have hfg : f ≠ g := by + intro he + apply hw + have hwg : w ∈ G.ends g := by rw [← he, hends]; simp + rw [hge] at hwg + rcases Sym2.mem_iff.mp hwg with h | h + · simp [h, blockMem0] + · simp [h, blockMem1] + have hadj' : AdjacentEdges G f g := by + refine ⟨u, ?_, ?_⟩ + · change u ∈ G.ends f; rw [hends]; simp [hb1] + · change u ∈ G.ends g; rw [hge]; simp [hb1] + exact False.elim ((proper hfg hadj' hfc) hgc) + · exact Or.inl (by + simp only [Finset.mem_sdiff, Finset.mem_insert, Finset.mem_singleton] + exact ⟨hut, by simp [hb0, hb1]⟩) + have hwRep : w ∉ TreeSequenceVertexSet R.replacementTree := by + intro hwR + rw [R.replacement_vertices] at hwR + simp only [Finset.mem_union] at hwR + apply hw + apply Finset.mem_union.mpr + rcases hwR with hwR | hwR + · exact Or.inl (Finset.mem_sdiff.mp hwR).1 + · exact Or.inr (by simpa using hwR) + have hfb : f ∈ BoundaryEdges G (TreeSequenceVertexSet R.replacementTree) := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, huRep, w, hwRep, hends⟩ + have hne : f ≠ D.f0 d := by + intro he + have hh := hfc + rw [he, D.f0_color d] at hh + exact notDelta (by simpa using hh.symm) + have hfd : phiD f = some c := by + by_cases huPair : u = R.u1 ∨ u = R.u2 + · change TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) f = some c + rw [ScheideReplacementPairFixed G k e0 phi T C D d R f] + · exact hfc + · rcases huPair with huPair | huPair + · exact Or.inl (by change R.u1 ∈ G.ends f; rw [hends]; simp [huPair]) + · exact Or.inr (by change R.u2 ∈ G.ends f; rw [hends]; simp [huPair]) + · have hut : u ∈ TreeSequenceVertexSet T := by simpa [huPair] using hu + exact (switchOnTree hut hne).trans hfc + apply (hrepClosed (v := v) hfb (by + rw [R.replacement_vertices] + simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] + exact Or.inr (Or.inr hv2)) hfd) + exact hmissD + +theorem ScheideReplacementUnionClosed {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + ColoredVertexSetClosed G phi (TreeSequenceVertexSet T ∪ { R.u1, R.u2 }) := by + unfold ColoredVertexSetClosed + intro f c v hf hv hfc + by_contra hmiss + have htree := ScheideGlobalMaximumOrder G k e0 phi T + C.globally_maximum + have htreeClosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + htree.2.2.2.2 + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + have hmaximum := ScheideReplacementMaximum G k e0 phi T C D d R + dsimp [phiD] at hmaximum + have hrep := ScheideGlobalMaximumOrder G k e0 phiD R.replacementTree + hmaximum.2.2 + have hrepClosed : ColoredVertexSetClosed G phiD + (TreeSequenceVertexSet R.replacementTree) := hrep.2.2.2.2 + have pairInternal : ∀ {a : Fin k}, + a ∈ MissingColors G phi (C.blockVertex (D.gammaIndex d) 0) ∨ + a ∈ MissingColors G phi (C.blockVertex (D.gammaIndex d) 1) → + ∃ g : E, phi g = some a ∧ G.ends g = s(R.u1, R.u2) := by + intro a ha + exact (ScheideSymmetricMissingInternal G k e0 phi T C D d R).2 a ha + have blockInternal : + ∀ {a : Fin k}, a ∈ MissingColors G phi R.u1 ∨ a ∈ MissingColors G phi R.u2 → + ∃ g : E, phi g = some a ∧ G.ends g = s(C.blockVertex (D.gammaIndex d) 0, C.blockVertex + (D.gammaIndex d) 1) := by + intro a ha + exact (ScheideSymmetricMissingInternal G k e0 phi T C D d R).1 a ha + have pairOrBlock : ∃ g : E, phi g = some c ∧ + (G.ends g = s(R.u1, R.u2) ∨ + G.ends g = s(C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1)) := by + simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] at hv + rcases hv with hvTree | hv1 | hv2 + · by_cases hv0 : v = C.blockVertex (D.gammaIndex d) 0 + · refine ⟨(pairInternal (Or.inl (hv0 ▸ hmiss))).choose, ?_, ?_⟩ + · exact (pairInternal (Or.inl (hv0 ▸ hmiss))).choose_spec.1 + · exact Or.inl (pairInternal (Or.inl (hv0 ▸ hmiss))).choose_spec.2 + by_cases hv3 : v = C.blockVertex (D.gammaIndex d) 1 + · refine ⟨(pairInternal (Or.inr (hv3 ▸ hmiss))).choose, ?_, ?_⟩ + · exact (pairInternal (Or.inr (hv3 ▸ hmiss))).choose_spec.1 + · exact Or.inl (pairInternal (Or.inr (hv3 ▸ hmiss))).choose_spec.2 + have hvrem : v ∈ (TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1}) := by + simp only [Finset.mem_sdiff, Finset.mem_insert, Finset.mem_singleton] + exact ⟨hvTree, by simp [hv0, hv3]⟩ + by_cases hc : c = C.gamma (D.gammaIndex d) + · subst c + obtain ⟨g, hgc, hge⟩ := + ScheideSymmetricDefectiveInternal G k e0 phi T C D d R |>.2 + exact ⟨g, hgc, Or.inl hge⟩ + · obtain ⟨g, hgc, hge⟩ := ScheideReplacementInternalMissing G k e0 phi T C D d R c + hc ⟨v, hvrem, hmiss⟩ + exact ⟨g, hgc, Or.inl hge⟩ + · obtain ⟨g, hgc, hge⟩ := blockInternal (Or.inl (hv1 ▸ hmiss)) + exact ⟨g, hgc, Or.inr hge⟩ + · obtain ⟨g, hgc, hge⟩ := blockInternal (Or.inr (hv2 ▸ hmiss)) + exact ⟨g, hgc, Or.inr hge⟩ + simp only [BoundaryEdges, Finset.union_insert, Finset.union_singleton, Finset.mem_insert, not_or, + exists_eq_or_imp, Finset.mem_filter, Finset.mem_univ, true_and] at hf + rcases (show ∃ u ∈ (TreeSequenceVertexSet T ∪ {R.u1, R.u2}), + ∃ w ∉ (TreeSequenceVertexSet T ∪ {R.u1, R.u2}), + G.ends f = s(u, w) by simpa [Sym2.mem_iff] using hf) with + ⟨u, hu, w, hw, hends⟩ + have proper := C.globally_maximum.1.2.2.2.1 + have switchOnTree (hq : u ∈ TreeSequenceVertexSet T) + (hne : f ≠ D.f0 d) : + phiD f = phi f := by + apply (ScheideDefectiveSwitchEffect G k e0 phi T C D d).2.2.2.2.1 f + · exact ⟨u, hq, by change u ∈ G.ends f; rw [hends]; simp⟩ + · exact hne + simp only [Finset.mem_union, Finset.mem_insert, Finset.mem_singleton] at hv hu + rcases hv with hvTree | hv1 | hv2 + · exact @ScheideReplacementUnionClosed_branch_104 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R f c v hfc hmiss htreeClosed pairInternal pairOrBlock u w + hw hends proper switchOnTree hu hvTree + · exact @ScheideReplacementUnionClosed_branch_148 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R f c v hfc hmiss hrepClosed blockInternal pairOrBlock u w + hw hends proper switchOnTree hu hv1 + · exact @ScheideReplacementUnionClosed_branch_276 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R f c v hfc hmiss hrepClosed blockInternal pairOrBlock u w + hw hends proper switchOnTree hu hv2 +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementUsedWitness.lean b/LeanPool/GoldbergSeymour/ScheideReplacementUsedWitness.lean new file mode 100644 index 0000000000..a7c1982eff --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReplacementUsedWitness.lean @@ -0,0 +1,344 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors + +/-! +# Scheide Replacement Used Witness + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev ScheideReplacementUsedWitnessWitness127Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (d : ↥(DefectiveColors G phi + (TreeSequenceVertexSet T))) (c0 : Fin k), ( + ∃ (j : Fin (R d).replacementTree.length), 1 ≤ (↑j : ℕ) ∧ TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) ((R d).replacementTree.edge j) = some + c0) → + let _ := C.p - 1 + 2 * (↑(D.gammaIndex d) : ℕ); + let phiD := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)); ( + have phiD := TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)); IsProperEdgeColoring G phiD ∧ IsOneEdgeUncolored phiD e0 ∧ phiD (D.f0 d) = some + (C.gamma (D.gammaIndex d)) ∧ MissingColors G phiD (D.v0 d) = insert (↑d : Fin k) + ((MissingColors G phi (D.v0 d)).erase (C.gamma (D.gammaIndex d))) ∧ ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → f ≠ D.f0 d → phiD f = phi f) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, v ≠ D.v0 d → MissingColors G phiD v = MissingColors G phi v) ∧ + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → MissingColors G phiD v = MissingColors G phi v) → ( + ∀ (n : Fin T.length), 1 ≤ (↑n : ℕ) → + ∃ (i : Fin ((↑n : ℕ) + 1)) (a : Fin k), phi (T.edge n) = some a ∧ a ∈ MissingColors G phi + (T.vertex (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ n.isLt))))) → ( + ∀ (n : Fin T.length), 1 ≤ (↑n : ℕ) → phiD (T.edge n) = phi (T.edge n)) → phiD (R d).f1 = some + (↑d : Fin k) → phiD (R d).f2 = some (↑d : Fin k) → ( + ∀ (a : Fin C.p), C.y a ∈ TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1}) → D.v0 d ∈ + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} → + ∀ c ∈ TreeUsedColors phiD (R d).replacementTree, + ∃ z ∈ TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1}, c ∈ MissingColors G + phiD z + +private theorem ScheideReplacementUsedWitness_witness_127.{u_1, u_2} : + ScheideReplacementUsedWitnessWitness127Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D R d c0 hc0 q phiD effect oldWitness originalFixed f1Fixed + f2Fixed hbaseZ hv0Z c hc + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc + rcases hc with ⟨j, hj, hjc⟩ + by_cases hbase : j.val < C.p - 1 + · let n : Fin T.length := ⟨j.val, by rw [← (R d).replacement_length]; exact j.isLt⟩ + have hlen := (R d).replacement_length + have he : (R d).replacementTree.edge j = T.edge n := by + calc + (R d).replacementTree.edge j = + (R d).replacementTree.edge ⟨j.val, by omega⟩ := by + congr 1 + _ = T.edge n := (R d).retained_edges_before j.val (by omega) n.isLt + obtain ⟨i, a, ha, hm⟩ := oldWitness n hj + have hrep : phiD ((R d).replacementTree.edge j) = some a := by + rw [he, originalFixed n hj] + exact ha + have hc' : a = c := Option.some.inj (hrep.symm.trans hjc) + have hp := C.p_ge_two + have hi := i.isLt + have hn := n.isLt + have hji : i.val ≤ n.val := Nat.le_of_lt_succ i.isLt + have hjp : j.val + 1 < C.p := by omega + have hnj : n.val = j.val := rfl + let b : Fin C.p := ⟨i.val, by omega⟩ + have hv : T.vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ n.isLt))) = C.y b := by + have hi : Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ n.isLt)) = + ⟨i.val, by omega⟩ := Fin.ext rfl + rw [hi] + exact C.base_vertex_position b + have hne : c ≠ C.gamma (D.gammaIndex d) := by + intro hcg + let bi : Fin (C.p - 1) := ⟨j.val, by omega⟩ + have oldc : phi (C.baseEdge bi) = some c := by + rw [← C.base_edge_position bi] + simpa [hc'] using ha + have hb := C.initial_nonfirst_avoids_blocks bi hj c oldc + (D.gammaIndex d) + exact hb hcg + refine ⟨C.y b, hbaseZ b, ?_⟩ + by_cases hz : C.y b = D.v0 d + · rw [hz, effect.2.2.2.1] + have hm' : c ∈ MissingColors G phi (C.y b) := by simpa [hv, hc'] using hm + exact Finset.mem_insert_of_mem (Finset.mem_erase.mpr ⟨hne, by simpa [hz] using hm'⟩) + · have hbX : C.y b ∈ TreeSequenceVertexSet T := + (Finset.mem_sdiff.mp (hbaseZ b)).1 + rw [effect.2.2.2.2.2.1 (C.y b) hbX hz] + simpa [hv, hc'] using hm + · by_cases hbefore : j.val < q + · let n := j.val - (C.p - 1) + have hp := C.p_ge_two + have hs := C.length_eq + have hlen := (R d).replacement_length + have hjlt := j.isLt + let r : Fin C.s := ⟨n / 2, by omega⟩ + let t : Fin 2 := ⟨n % 2, Nat.mod_lt _ (by omega)⟩ + have hpos : j.val = C.p - 1 + 2 * r.val + t.val := by + dsimp [r, t, n] + omega + have hr : r ≠ D.gammaIndex d := by + intro h + have hv := congrArg Fin.val h + dsimp [r, n] at hv + omega + have he : (R d).replacementTree.edge j = T.edge ⟨j.val, by omega⟩ := + (R d).retained_edges_before j.val hbefore (by omega) + have hold : T.edge ⟨j.val, by omega⟩ = C.blockEdge r t := by + calc + T.edge ⟨j.val, by omega⟩ = + T.edge ⟨C.p - 1 + 2 * r.val + t.val, by omega⟩ := by + congr 1 + exact Fin.ext hpos + _ = C.blockEdge r t := C.block_edge_position r t + have hrep : phiD ((R d).replacementTree.edge j) = some (C.gamma r) := by + rw [he, originalFixed ⟨j.val, by omega⟩ (by omega), hold, C.block_color] + have hcol : C.gamma r = c := Option.some.inj (hrep.symm.trans hjc) + obtain ⟨b, hb⟩ := C.block_color_missing_on_base r + have hne : c ≠ C.gamma (D.gammaIndex d) := by + intro h + apply hr + apply C.gamma_injective + simpa [hcol] using h + refine ⟨C.y b, hbaseZ b, ?_⟩ + by_cases hz : C.y b = D.v0 d + · rw [hz, effect.2.2.2.1] + exact Finset.mem_insert_of_mem (Finset.mem_erase.mpr ⟨hne, by simpa [hz, hcol] using hb⟩) + · have htree : C.y b ∈ TreeSequenceVertexSet T := + (Finset.mem_sdiff.mp (hbaseZ b)).1 + rw [effect.2.2.2.2.2.1 (C.y b) htree hz] + simpa [hcol] using hb + · by_cases hafter : j.val + 2 < T.length + · let n := j.val + 2 - (C.p - 1) + have hlen := (R d).replacement_length + have hstruct := C.length_eq + let r : Fin C.s := ⟨n / 2, by omega⟩ + let t : Fin 2 := ⟨n % 2, Nat.mod_lt _ (by omega)⟩ + have hpos : j.val + 2 = C.p - 1 + 2 * r.val + t.val := by + dsimp [r, t, n] + omega + have hr : r ≠ D.gammaIndex d := by + intro h + have hv := congrArg Fin.val h + dsimp [r, n] at hv + omega + have he := (R d).retained_edges_after j.val (by omega) hafter + have hold : T.edge ⟨j.val + 2, hafter⟩ = C.blockEdge r t := by + calc + T.edge ⟨j.val + 2, hafter⟩ = + T.edge ⟨C.p - 1 + 2 * r.val + t.val, by omega⟩ := by + congr 1 + exact Fin.ext hpos + _ = C.blockEdge r t := C.block_edge_position r t + have hrep : phiD ((R d).replacementTree.edge j) = some (C.gamma r) := by + have hposj : 1 ≤ j.val + 2 := by omega + rw [he, originalFixed (⟨j.val + 2, hafter⟩ : Fin T.length) hposj, hold, + C.block_color] + have hcol : C.gamma r = c := Option.some.inj (hrep.symm.trans hjc) + obtain ⟨b, hb⟩ := C.block_color_missing_on_base r + have hne : c ≠ C.gamma (D.gammaIndex d) := by + intro h + apply hr + apply C.gamma_injective + simpa [hcol] using h + refine ⟨C.y b, hbaseZ b, ?_⟩ + by_cases hz : C.y b = D.v0 d + · rw [hz, effect.2.2.2.1] + exact Finset.mem_insert_of_mem (Finset.mem_erase.mpr ⟨hne, by simpa [hz, hcol] using hb⟩) + · have htree : C.y b ∈ TreeSequenceVertexSet T := + (Finset.mem_sdiff.mp (hbaseZ b)).1 + rw [effect.2.2.2.2.2.1 (C.y b) htree hz] + simpa [hcol] using hb + · have hlen := (R d).replacement_length + have hjlast : j.val = T.length - 2 ∨ j.val = T.length - 1 := by omega + rcases hjlast with hlast | hlast + · have he : (R d).replacementTree.edge j = (R d).f1 := by + calc + (R d).replacementTree.edge j = + (R d).replacementTree.edge ⟨T.length - 2, by + rw [(R d).replacement_length] + omega⟩ := by + congr 1 + exact Fin.ext hlast + _ = (R d).f1 := (R d).replacement_last_edges.1 + refine ⟨D.v0 d, hv0Z, ?_⟩ + have hc' : c = d.1 := Option.some.inj (hjc.symm.trans (he ▸ f1Fixed)) + rw [hc', effect.2.2.2.1] + exact Finset.mem_insert_self _ _ + · have he : (R d).replacementTree.edge j = (R d).f2 := by + calc + (R d).replacementTree.edge j = + (R d).replacementTree.edge ⟨T.length - 1, by + rw [(R d).replacement_length] + omega⟩ := by + congr 1 + exact Fin.ext hlast + _ = (R d).f2 := (R d).replacement_last_edges.2 + refine ⟨D.v0 d, hv0Z, ?_⟩ + have hc' : c = d.1 := Option.some.inj (hjc.symm.trans (he ▸ f2Fixed)) + rw [hc', effect.2.2.2.1] + exact Finset.mem_insert_self _ _ + +theorem ScheideReplacementUsedWitness {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) + (d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}) : + ∀ + c ∈ + TreeUsedColors + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d))) + (R d).replacementTree, + ∃ + z ∈ + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1}, + c ∈ + MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d))) z := by + classical + intro c0 hc0 + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc0 + let q := C.p - 1 + 2 * (D.gammaIndex d).val + let phiD := TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) d.1 (Sum.inl (D.v0 d)) + have effect := ScheideDefectiveSwitchEffect G k e0 phi T C D d + have global := C.globally_maximum + have tash : TashkinovTree G e0 phi T := global.2.1 + have oldWitness : ∀ n : Fin T.length, 1 ≤ n.val → + ∃ i : Fin (n.val + 1), ∃ a : Fin k, + phi (T.edge n) = some a ∧ + a ∈ MissingColors G phi + (T.vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ n.isLt)))) := by + intro n hn + exact tash n hn + have originalFixed : ∀ n : Fin T.length, 1 ≤ n.val → + phiD (T.edge n) = phi (T.edge n) := by + intro n hnpos + apply effect.2.2.2.2.1 + · obtain ⟨i, hi⟩ := T.attaches n + refine ⟨T.vertex ⟨n + 1, by omega⟩, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · change T.vertex n.succ ∈ G.ends (T.edge n) + rw [hi] + simp + · intro heq + have unused := (ScheideGlobalMaximumUnused G k e0 phi T global).1 + apply (Finset.disjoint_left.mp unused) d.2 + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨n, hnpos, ?_⟩ + simpa [heq] using D.f0_color d + have f1Fixed : phiD (R d).f1 = some d.1 := by + have hf := effect.2.2.2.2.1 (R d).f1 + ⟨(R d).v1, (Finset.mem_sdiff.mp (R d).v1_in_remainder).1, by + change (R d).v1 ∈ G.ends ((R d).f1) + rw [(R d).f1_ends] + simp []⟩ + (R d).f0_ne_f1.symm + simpa [phiD] using hf.trans (R d).f1_color + have f2Fixed : phiD (R d).f2 = some d.1 := by + have hf := effect.2.2.2.2.1 (R d).f2 + ⟨(R d).v2, (Finset.mem_sdiff.mp (R d).v2_in_remainder).1, by + change (R d).v2 ∈ G.ends ((R d).f2) + rw [(R d).f2_ends] + simp []⟩ + (R d).f0_ne_f2.symm + simpa [phiD] using hf.trans (R d).f2_color + have hbaseZ : ∀ a : Fin C.p, C.y a ∈ + TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} := by + intro a + have haX : C.y a ∈ TreeSequenceVertexSet T := by + rw [← C.base_vertex_position a] + simp [TreeSequenceVertexSet] + refine Finset.mem_sdiff.mpr ⟨haX, ?_⟩ + simp only [Finset.mem_insert, Finset.mem_singleton] + intro heq + rcases heq with heq | heq + · have hi := T.vertex_injective (C.base_vertex_position a |>.trans + (heq ▸ (C.block_vertex_position (D.gammaIndex d) (0 : Fin 2))).symm) + have hv := congrArg Fin.val hi + have hp := C.p_ge_two + have hr := (D.gammaIndex d).isLt + simp at hv + omega + · have hi := T.vertex_injective (C.base_vertex_position a |>.trans + (heq ▸ (C.block_vertex_position (D.gammaIndex d) (1 : Fin 2))).symm) + have hv := congrArg Fin.val hi + have hp := C.p_ge_two + have hr := (D.gammaIndex d).isLt + simp at hv + omega + have hv0Z : D.v0 d ∈ TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} := by + have hb := ScheideStructuralExitsInBase G k e0 phi T C (D.v0_is_exit d) + obtain ⟨b, hbv, hvb⟩ := Finset.mem_image.mp hb + have hby : D.v0 d = C.y b := hvb.symm + simpa [hby] using hbaseZ b + have witness : ∀ c : Fin k, c ∈ TreeUsedColors phiD (R d).replacementTree → + ∃ z ∈ TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1}, c ∈ MissingColors G phiD z := by + exact @ScheideReplacementUsedWitness_witness_127 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi T C D R d c0 hc0 effect oldWitness originalFixed + f1Fixed f2Fixed hbaseZ hv0Z + have hc0' : c0 ∈ TreeUsedColors phiD (R d).replacementTree := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact hc0 + simpa [phiD] using witness c0 hc0' + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReversedKempePathTree.lean b/LeanPool/GoldbergSeymour/ScheideReversedKempePathTree.lean new file mode 100644 index 0000000000..069e4cefd4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReversedKempePathTree.lean @@ -0,0 +1,520 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideReversedPathPreparation + +/-! +# Scheide Reversed Kempe Path Tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable abbrev helperU647.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (phi : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (alpha beta : Fin k) → + (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl + (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) + (Sum.inl + (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : + Fin (T.length + (1 : ℕ)))))) → + (d : ℕ) → + (hd : p.length = (4 : ℕ) * d) → + (hparity : + ∀ n ≤ p.length, + (n % (2 : ℕ) = (0 : ℕ) → ∃ (v : V), p.getVert n = Sum.inl v) ∧ + (n % (2 : ℕ) = (1 : ℕ) → ∃ (e : E), p.getVert n = Sum.inr e)) → + let m : ℕ := p.length / (2 : ℕ); + (hm : p.length = (2 : ℕ) * m) → + (hmpos : (2 : ℕ) ≤ m) → + let vertexAt : Fin (m + (1 : ℕ)) → V := + fun (i : Fin (m + (1 : ℕ))) ↦ + Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ)) (by omega)).left (by omega)); + let edgeAt : Fin m → E := fun (i : Fin m) ↦ + Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ) + (1 : ℕ)) (by omega)).right + (by omega)); + let reversedVertex : Fin (m + (1 : ℕ)) → V := + fun (i : Fin (m + (1 : ℕ))) ↦ + if hi : (↑i : ℕ) = (0 : ℕ) then vertexAt (0 : Fin (m + (1 : ℕ))) + else + vertexAt + (⟨m + (1 : ℕ) - (↑i : ℕ), by omega⟩ : Fin (m + (1 : ℕ))); + let reversedEdge : Fin m → E := fun (i : Fin m) ↦ + if hi : (↑i : ℕ) = (0 : ℕ) then e0 + else edgeAt (⟨m - (↑i : ℕ), by omega⟩ : Fin m); + (hvzero : + reversedVertex (⟨(0 : ℕ), by omega⟩ : Fin (m + (1 : ℕ))) = + T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : + Fin (T.length + (1 : ℕ)))) → + (hvone : + reversedVertex (⟨(1 : ℕ), by omega⟩ : Fin (m + (1 : ℕ))) = + T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : + Fin (T.length + (1 : ℕ)))) → + (reversedVertex_injective : + Function.Injective reversedVertex) → + (reversedEdge_injective : Function.Injective reversedEdge) → + (edge_ends : + ∀ (i : Fin m), + G.ends (edgeAt i) = + s(vertexAt + (⟨(↑i : ℕ), by omega⟩ : Fin (m + (1 : ℕ))), + vertexAt i.succ)) → + TreeSequence G e0 := by + classical + intro V E G k e0 phi T alpha beta p d hd hparity m hm hmpos vertexAt edgeAt reversedVertex + reversedEdge hvzero hvone reversedVertex_injective reversedEdge_injective edge_ends + exact { + length := m + positive := by omega + vertex := reversedVertex + edge := reversedEdge + vertex_injective := reversedVertex_injective + edge_injective := reversedEdge_injective + first_edge := by simp [reversedEdge] + attaches := by + intro j + by_cases hj : j.val = 0 + · exact @ScheideReversedPathPreparation.helper_branch_272 (@V) (@E) (@G) (@k) (@e0) (@phi) + (@T) (@alpha) (@beta) (@p) + (@d) (@hd) (@hparity) (@hm) (@hmpos) (@hvzero) (@hvone) (@j) (@hj) + · refine ⟨⟨j.val, by omega⟩, ?_⟩ + let r : Fin m := ⟨m - j.val, by omega⟩ + have he := edge_ends r + simp [reversedEdge, hj, reversedVertex] + have hfirst : vertexAt (⟨r.val, by omega⟩ : Fin (m + 1)) = + vertexAt (⟨m - j.val, by omega⟩ : Fin (m + 1)) := by + rfl + have hsecond : vertexAt r.succ = + vertexAt (⟨m + 1 - j.val, by omega⟩ : Fin (m + 1)) := by + apply congrArg vertexAt + apply Fin.ext + dsimp [r] + omega + rw [hfirst, hsecond] at he + simpa [Fin.succ] using he } + +private theorem helper_path_vertices_314.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) + (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl + (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) + (Sum.inl + (T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) + (d : ℕ) (hd : p.length = (4 : ℕ) * d) + (hparity : + ∀ n ≤ p.length, + (n % (2 : ℕ) = (0 : ℕ) → ∃ (v : V), p.getVert n = Sum.inl v) ∧ + (n % (2 : ℕ) = (1 : ℕ) → ∃ (e : E), p.getVert n = Sum.inr e)), + let m : ℕ := p.length / (2 : ℕ); + ∀ (hm : p.length = (2 : ℕ) * m) (_ : (0 : ℕ) < p.length) (hmpos : (2 : ℕ) ≤ m), + let vertexAt : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ + Classical.choose ((hparity ((2 : ℕ) * (↑i : ℕ)) (by omega)).left (by omega)); + ∀ + (_ : + ∀ (i : Fin (m + (1 : ℕ))), p.getVert ((2 : ℕ) * (↑i : ℕ)) = Sum.inl (vertexAt i)), + let edgeAt : Fin m → E := fun (i : Fin m) ↦ + Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ) + (1 : ℕ)) (by omega)).right (by omega)); + let reversedVertex : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ + if hi : (↑i : ℕ) = (0 : ℕ) then vertexAt (0 : Fin (m + (1 : ℕ))) + else vertexAt (⟨m + (1 : ℕ) - (↑i : ℕ), by omega⟩ : Fin (m + (1 : ℕ))); + let reversedEdge : Fin m → E := fun (i : Fin m) ↦ + if hi : (↑i : ℕ) = (0 : ℕ) then e0 else edgeAt (⟨m - (↑i : ℕ), by omega⟩ : Fin m); + ∀ + (hvzero : + reversedVertex (⟨(0 : ℕ), by omega⟩ : Fin (m + (1 : ℕ))) = + T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ)))) + (hvone : + reversedVertex (⟨(1 : ℕ), by omega⟩ : Fin (m + (1 : ℕ))) = + T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))) + (reversedVertex_injective : Function.Injective reversedVertex) + (reversedEdge_injective : Function.Injective reversedEdge) + (edge_ends : + ∀ (i : Fin m), + G.ends (edgeAt i) = + s(vertexAt (⟨(↑i : ℕ), by omega⟩ : Fin (m + (1 : ℕ))), vertexAt i.succ)), + let U : TreeSequence G e0 := + helperU647 G k e0 phi T alpha beta p d hd hparity hm hmpos hvzero hvone + reversedVertex_injective reversedEdge_injective edge_ends; + ∀ (_ : U.vertex = reversedVertex) (_ : U.edge = reversedEdge) (_ : U.length = m) + (v : V), + Sum.inl v ∈ p.support ↔ ∃ (i : Fin (U.length + (1 : ℕ))), v = U.vertex i := by + classical + intro V E G k e0 phi T alpha beta p d hd hparity m hm hpos hmpos vertexAt vertexAt_eq edgeAt + reversedVertex reversedEdge hvzero hvone reversedVertex_injective reversedEdge_injective + edge_ends U uVertex uEdge uLength + simp only [SimpleGraph.Walk.mem_support_iff_exists_getVert] + change ∀ v, (∃ n, p.getVert n = Sum.inl v ∧ n ≤ p.length) ↔ + ∃ i : Fin (m + 1), v = U.vertex i + intro v + constructor + · rintro ⟨n, hn, hnle⟩ + have hcases : n % 2 = 0 ∨ n % 2 = 1 := by omega + rcases hcases with heven | hodd + · let i : Fin (m + 1) := ⟨n / 2, by omega⟩ + have hni : 2 * i.val = n := by + dsimp [i] + omega + have hv : v = vertexAt i := by + have hh := vertexAt_eq i + rw [hni] at hh + exact Sum.inl.inj (hn.symm.trans hh) + by_cases hi : i.val = 0 + · refine ⟨0, ?_⟩ + have hi' : i = 0 := Fin.ext hi + rw [hi'] at hv + simpa [uVertex, uEdge, uLength, reversedVertex] using hv + · refine ⟨⟨m + 1 - i.val, by omega⟩, ?_⟩ + let r : Fin (m + 1) := ⟨m + 1 - i.val, by omega⟩ + have hr : reversedVertex r = vertexAt i := by + have hil := i.isLt + dsimp [reversedVertex, r] + rw [dite_eq_right (by omega)] + apply congrArg vertexAt + apply Fin.ext + change m + 1 - (m + 1 - i.val) = i.val + omega + exact hv.trans (by simpa [uVertex, uEdge, uLength] using hr.symm) + · have hh := (hparity n hnle).2 hodd + rw [hn] at hh + rcases hh with ⟨e, he⟩ + cases he + · rintro ⟨i, rfl⟩ + by_cases hi : i.val = 0 + · refine ⟨0, ?_, by omega⟩ + have hi' : i = 0 := Fin.ext hi + subst i + simpa [uVertex, uEdge, uLength, reversedVertex] using vertexAt_eq (0 : Fin (m + 1)) + · let q : Fin (m + 1) := ⟨m + 1 - i.val, by omega⟩ + refine ⟨2 * q.val, ?_, ?_⟩ + · have hq := vertexAt_eq q + have hq' : p.getVert (2 * q.val) = Sum.inl (U.vertex i) := by + have hi0 : ¬ i = 0 := by + intro h + apply hi + simp [h] + have hr : reversedVertex i = vertexAt q := by + dsimp [reversedVertex] + rw [dite_eq_right (by simpa using hi)] + simpa [uVertex, uEdge, uLength] using hq.trans (congrArg Sum.inl hr.symm) + exact hq' + · rw [hm] + dsimp [q] + omega + +private theorem helper_path_edges_373.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) + (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl + (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) + (Sum.inl + (T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) + (d : ℕ) (hd : p.length = (4 : ℕ) * d) + (hparity : + ∀ n ≤ p.length, + (n % (2 : ℕ) = (0 : ℕ) → ∃ (v : V), p.getVert n = Sum.inl v) ∧ + (n % (2 : ℕ) = (1 : ℕ) → ∃ (e : E), p.getVert n = Sum.inr e)), + let m : ℕ := p.length / (2 : ℕ); + ∀ (hm : p.length = (2 : ℕ) * m) (hmpos : (2 : ℕ) ≤ m), + let vertexAt : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ + Classical.choose ((hparity ((2 : ℕ) * (↑i : ℕ)) (by omega)).left (by omega)); + let edgeAt : Fin m → E := fun (i : Fin m) ↦ + Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ) + (1 : ℕ)) (by omega)).right (by omega)); + ∀ (_ : ∀ (i : Fin m), p.getVert ((2 : ℕ) * (↑i : ℕ) + (1 : ℕ)) = Sum.inr (edgeAt i)), + let reversedVertex : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ + if hi : (↑i : ℕ) = (0 : ℕ) then vertexAt (0 : Fin (m + (1 : ℕ))) + else vertexAt (⟨m + (1 : ℕ) - (↑i : ℕ), by omega⟩ : Fin (m + (1 : ℕ))); + let reversedEdge : Fin m → E := fun (i : Fin m) ↦ + if hi : (↑i : ℕ) = (0 : ℕ) then e0 else edgeAt (⟨m - (↑i : ℕ), by omega⟩ : Fin m); + ∀ + (hvzero : + reversedVertex (⟨(0 : ℕ), by omega⟩ : Fin (m + (1 : ℕ))) = + T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ)))) + (hvone : + reversedVertex (⟨(1 : ℕ), by omega⟩ : Fin (m + (1 : ℕ))) = + T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))) + (reversedVertex_injective : Function.Injective reversedVertex) + (reversedEdge_injective : Function.Injective reversedEdge) + (edge_ends : + ∀ (i : Fin m), + G.ends (edgeAt i) = + s(vertexAt (⟨(↑i : ℕ), by omega⟩ : Fin (m + (1 : ℕ))), vertexAt i.succ)), + let U : TreeSequence G e0 := + helperU647 G k e0 phi T alpha beta p d hd hparity hm hmpos hvzero hvone + reversedVertex_injective reversedEdge_injective edge_ends; + ∀ (_ : U.vertex = reversedVertex) (_ : U.edge = reversedEdge) (_ : U.length = m) + (f : E), + Sum.inr f ∈ p.support ↔ + f = edgeAt (⟨(0 : ℕ), by omega⟩ : Fin m) ∨ + ∃ (j : Fin U.length), (1 : ℕ) ≤ (↑j : ℕ) ∧ f = U.edge j := by + classical + intro V E G k e0 phi T alpha beta p d hd hparity m hm hmpos vertexAt edgeAt edgeAt_eq + reversedVertex reversedEdge hvzero hvone reversedVertex_injective reversedEdge_injective + edge_ends U uVertex uEdge uLength + simp only [SimpleGraph.Walk.mem_support_iff_exists_getVert] + change ∀ f, (∃ n, p.getVert n = Sum.inr f ∧ n ≤ p.length) ↔ + f = edgeAt ⟨0, by omega⟩ ∨ ∃ j : Fin m, 1 ≤ j.val ∧ f = U.edge j + intro f + constructor + · rintro ⟨n, hn, hnle⟩ + have hcases : n % 2 = 0 ∨ n % 2 = 1 := by omega + rcases hcases with heven | hodd + · have hh := (hparity n hnle).1 heven + rw [hn] at hh + rcases hh with ⟨v, hv⟩ + cases hv + · let q : Fin m := ⟨n / 2, by omega⟩ + have hnq : 2 * q.val + 1 = n := by + dsimp [q] + omega + have hf : f = edgeAt q := by + have hh := edgeAt_eq q + rw [hnq] at hh + exact Sum.inr.inj (hn.symm.trans hh) + by_cases hq : q.val = 0 + · left + have hq' : q = (⟨0, by omega⟩ : Fin m) := by + apply Fin.ext + exact hq + simpa [hq'] using hf + · right + have hqpos : 0 < q.val := by omega + have hmpos' : 0 < m := by omega + have qlt := q.isLt + refine ⟨⟨m - q.val, by + exact Nat.sub_lt hmpos' hqpos⟩, ?_, ?_⟩ + · exact Nat.succ_le_of_lt (Nat.sub_pos_of_lt qlt) + have hr : reversedEdge ⟨m - q.val, by omega⟩ = edgeAt q := by + dsimp [reversedEdge] + rw [dite_eq_right (by omega)] + apply congrArg edgeAt + apply Fin.ext + dsimp [q] + have qlt := q.isLt + omega + exact hf.trans (by simpa [uVertex, uEdge, uLength] using hr.symm) + · rintro (hf | ⟨j, hj, hf⟩) + · subst f + refine ⟨1, ?_, by rw [hm]; omega⟩ + exact edgeAt_eq ⟨0, by omega⟩ + · let q : Fin m := ⟨m - j.val, by omega⟩ + refine ⟨2 * q.val + 1, ?_, ?_⟩ + · subst f + have hq := edgeAt_eq q + have hj0 : ¬ j.val = 0 := by + intro h + omega + have hr : reversedEdge j = edgeAt q := by + dsimp [reversedEdge] + rw [dite_eq_right hj0] + have hq' : p.getVert (2 * q.val + 1) = Sum.inr (U.edge j) := by + simpa [uVertex, uEdge, uLength] using hq.trans (congrArg Sum.inr hr.symm) + exact hq' + · rw [hm] + dsimp [q] + have jlt := j.isLt + omega + +theorem ScheideReversedKempePathTree {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (htriple : KTriple G k e0 phi) + (alpha beta : Fin k) + (halpha : alpha ∈ MissingColors G phi + (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + (hbeta : beta ∈ MissingColors G phi + (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩)) + (p : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + (Sum.inl (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩))) + (hp : p.IsPath) (hdiv : 4 ∣ p.length) : + Nonempty (ScheideReversedPathCertificate G k e0 phi T alpha beta p) := by + classical + obtain ⟨d, hd⟩ := hdiv + have hlen : p.length = 4 * d := by omega + have hparity : ∀ n ≤ p.length, + (n % 2 = 0 → ∃ v, p.getVert n = Sum.inl v) ∧ + (n % 2 = 1 → ∃ e, p.getVert n = Sum.inr e) := by + apply ScheideReversedPathPreparation.helper_hparity_47 <;> assumption + let m := p.length / 2 + have hm : p.length = 2 * m := by omega + have hends : T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ ≠ + T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩ := by + apply ScheideReversedPathPreparation.helper_hends_364 + have hpos : 0 < p.length := by + apply ScheideReversedPathPreparation.helper_hpos_373; assumption + have hmpos : 2 ≤ m := by omega + let vertexAt : Fin (m + 1) → V := fun i => + Classical.choose ((hparity (2 * i.val) (by omega)).1 (by omega)) + have vertexAt_eq : ∀ i : Fin (m + 1), + p.getVert (2 * i.val) = Sum.inl (vertexAt i) := by + intro i + exact Classical.choose_spec ((hparity (2 * i.val) (by omega)).1 (by omega)) + let edgeAt : Fin m → E := fun i => + Classical.choose ((hparity (2 * i.val + 1) (by omega)).2 (by omega)) + have edgeAt_eq : ∀ i : Fin m, + p.getVert (2 * i.val + 1) = Sum.inr (edgeAt i) := by + intro i + exact Classical.choose_spec ((hparity (2 * i.val + 1) (by omega)).2 (by omega)) + have edgeAt_colored : ∀ i : Fin m, ∃ c, phi (edgeAt i) = some c := by + exact @ScheideReversedPathPreparation.helper_edgeAt_colored_392 (@V) (@E) (@G) (@k) (@e0) + (@phi) (@T) (@alpha) (@beta) (@p) + (@d) (@hd) (@hparity) (@hm) (@vertexAt_eq) (@edgeAt_eq) + have edgeAt_colors : ∀ i : Fin m, + phi (edgeAt i) = some alpha ∨ phi (edgeAt i) = some beta := by + intro i + have ha := p.adj_getVert_succ (i := 2 * i.val) (by rw [hm]; omega) + rw [vertexAt_eq ⟨i.val, by omega⟩, edgeAt_eq i] at ha + simpa [TwoColorIncidenceGraph] using ha.2 + let reversedVertex : Fin (m + 1) → V := fun i => + if hi : i.val = 0 then vertexAt 0 + else vertexAt ⟨m + 1 - i.val, by omega⟩ + let reversedEdge : Fin m → E := fun i => + if hi : i.val = 0 then e0 + else edgeAt ⟨m - i.val, by omega⟩ + have hvzero : reversedVertex ⟨0, by omega⟩ = + T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ := by + simp only [reversedVertex, dite_eq_left rfl] + have hh := vertexAt_eq (0 : Fin (m + 1)) + exact Sum.inl.inj (hh.symm.trans (by simpa using p.getVert_zero)) + have hvone : reversedVertex ⟨1, by omega⟩ = + T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩ := by + exact @ScheideReversedPathPreparation.helper_hvone_418 (@V) (@E) (@G) (@k) (@e0) (@phi) (@T) + (@alpha) (@beta) (@p) (@d) + (@hd) (@hparity) (@hm) (@hmpos) (@vertexAt_eq) + have vertexAt_injective : Function.Injective vertexAt := by + exact @ScheideReversedPathPreparation.helper_vertexAt_injective_428 (@V) (@E) (@G) (@k) (@e0) + (@phi) (@T) (@alpha) (@beta) + (@p) (@hp) (@d) (@hd) (@hparity) (@hm) (@vertexAt_eq) + have edgeAt_injective : Function.Injective edgeAt := by + exact @ScheideReversedPathPreparation.helper_edgeAt_injective_438 (@V) (@E) (@G) (@k) (@e0) + (@phi) (@T) (@alpha) (@beta) + (@p) (@hp) (@d) (@hd) (@hparity) (@hm) (@edgeAt_eq) + have reversedVertex_injective : Function.Injective reversedVertex := by + exact @ScheideReversedPathPreparation.helper_reversedVertex_injective_187 (@V) (@E) (@G) (@k) + (@e0) (@phi) (@T) (@alpha) + (@beta) (@p) (@d) (@hd) (@hparity) (@hm) (@vertexAt_injective) + have reversedEdge_injective : Function.Injective reversedEdge := by + exact @ScheideReversedPathPreparation.helper_reversedEdge_injective_212 (@V) (@E) + inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@htriple) (@alpha) (@beta) (@p) (@d) (@hd) (@hparity) (@hm) + (@edgeAt_colored) (@edgeAt_injective) + have edge_ends : ∀ i : Fin m, + G.ends (edgeAt i) = s(vertexAt ⟨i.val, by omega⟩, vertexAt i.succ) := by + exact @ScheideReversedPathPreparation.helper_edge_ends_239 (@V) (@E) (@G) (@k) (@e0) (@phi) + (@T) (@alpha) (@beta) (@p) (@d) + (@hd) (@hparity) (@hm) (@vertexAt_eq) (@edgeAt_eq) (@vertexAt_injective) + let U := @helperU647 (@V) (@E) (@G) (@k) (@e0) (@phi) (@T) (@alpha) (@beta) (@p) (@d) (@hd) + (@hparity) (@hm) (@hmpos) (@hvzero) (@hvone) (@reversedVertex_injective) + (@reversedEdge_injective) (@edge_ends) + have uVertex : U.vertex = reversedVertex := rfl + have uEdge : U.edge = reversedEdge := rfl + have uLength : U.length = m := rfl + have tash : TashkinovTree G e0 phi U := by + intro j hj + have j0 : j.val ≠ 0 := by omega + rw [show U.edge j = edgeAt ⟨m - j.val, by omega⟩ by simp [uEdge, reversedEdge, dite_eq_right + j0]] + have hc := edgeAt_colors ⟨m - j.val, by omega⟩ + rcases hc with hc | hc + · refine ⟨0, alpha, hc, ?_⟩ + have hv0 := hvzero + simp only [reversedVertex, dite_eq_left rfl] at hv0 + simp only [uVertex, reversedVertex] + split + · simpa [hv0] using halpha + · rename_i h + exfalso + exact h rfl + · refine ⟨1, beta, hc, ?_⟩ + have hv1 := hvone + simp [reversedVertex] at hv1 + simp only [uVertex, reversedVertex] + split + · rename_i h + exfalso + norm_num at h + omega + · have hmod : 1 % (j.val + 1) = 1 := by + apply Nat.mod_eq_of_lt + omega + simpa [hv1, hmod] using hbeta + refine ⟨{ + tree := U + closingEdge := edgeAt ⟨0, by omega⟩ + length_lower := hmpos + length_eq := by simp [uLength, m] + tashkinov := tash + first_vertex := by simpa [uVertex, uEdge, uLength] using hvzero + second_vertex := by simpa [uVertex, uEdge, uLength] using hvone + closing_ends := by + have he := edge_ends ⟨0, by omega⟩ + have he' : G.ends (edgeAt ⟨0, by omega⟩) = + s(vertexAt ⟨1, by omega⟩, vertexAt ⟨0, by omega⟩) := + he.trans Sym2.eq_swap + have hm0 : m ≠ 0 := by omega + simpa [uVertex, uEdge, uLength, reversedVertex, hm0] using he' + path_vertices := by + exact @helper_path_vertices_314 (@V) (@E) (@G) (@k) (@e0) (@phi) (@T) (@alpha) (@beta) (@p) + (@d) (@hd) (@hparity) (@hm) (@hpos) (@hmpos) (@vertexAt_eq) (@hvzero) (@hvone) + (@reversedVertex_injective) (@reversedEdge_injective) (@edge_ends) (@uVertex) (@uEdge) + (@uLength) + path_edges := by + exact @helper_path_edges_373 (@V) (@E) (@G) (@k) (@e0) (@phi) (@T) (@alpha) (@beta) (@p) + (@d) (@hd) (@hparity) (@hm) (@hmpos) (@edgeAt_eq) (@hvzero) (@hvone) + (@reversedVertex_injective) (@reversedEdge_injective) (@edge_ends) (@uVertex) (@uEdge) + (@uLength) + trunk_edge_ends := by + change ∀ j : Fin m, 1 ≤ j.val → + G.ends (U.edge j) = s(U.vertex ⟨j.val, by change j.val < m + 1; omega⟩, U.vertex j.succ) + intro j hj + have j0 : j.val ≠ 0 := by omega + rw [show U.edge j = edgeAt ⟨m - j.val, by omega⟩ by + simp [uEdge, reversedEdge, j0]] + have he := edge_ends ⟨m - j.val, by omega⟩ + have he' := he.trans Sym2.eq_swap + have hv1 : vertexAt (⟨m - j.val, by omega⟩ : Fin m).succ = + vertexAt ⟨m + 1 - j.val, by omega⟩ := by + apply congrArg vertexAt + apply Fin.ext + simp [Fin.succ] + omega + rw [hv1] at he' + simpa [uVertex, uEdge, uLength, reversedVertex, j0] using he' + }⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReversedPathCertificate.lean b/LeanPool/GoldbergSeymour/ScheideReversedPathCertificate.lean new file mode 100644 index 0000000000..cd50990953 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReversedPathCertificate.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovTree + +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Reversed Path Certificate + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- A Tashkinov tree and closing edge obtained from a reversed alternating path, with exact vertex +and edge coverage. +-/ +structure ScheideReversedPathCertificate {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (alpha beta : Fin k) + (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl (T.vertex ⟨0, Nat.zero_lt_succ T.length⟩)) + (Sum.inl (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩))) where + /-- The ordered tree or tree sequence recorded by this certificate. -/ + tree : TreeSequence G e0 + /-- The edge closing the alternating trunk. -/ + closingEdge : E + length_lower : 2 ≤ tree.length + length_eq : tree.length = p.length / 2 + tashkinov : TashkinovTree G e0 phi tree + first_vertex : + tree.vertex ⟨0, Nat.zero_lt_succ tree.length⟩ = T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ + second_vertex : + tree.vertex ⟨1, Nat.succ_lt_succ tree.positive⟩ = T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩ + closing_ends : + G.ends closingEdge = + s(tree.vertex (Fin.last tree.length), tree.vertex ⟨0, Nat.zero_lt_succ tree.length⟩) + path_vertices : ∀ v : V, Sum.inl v ∈ p.support ↔ ∃ i : Fin (tree.length + 1), v = tree.vertex i + path_edges : + ∀ f : E, + Sum.inr f ∈ p.support ↔ f = closingEdge ∨ ∃ j : Fin tree.length, 1 ≤ j.val ∧ f = tree.edge j + trunk_edge_ends : + ∀ j : Fin tree.length, + 1 ≤ j.val → + G.ends (tree.edge j) = s(tree.vertex ⟨j.val, Nat.lt_succ_of_lt j.isLt⟩, tree.vertex j.succ) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideReversedPathPreparation.lean b/LeanPool/GoldbergSeymour/ScheideReversedPathPreparation.lean new file mode 100644 index 0000000000..b5c4383448 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideReversedPathPreparation.lean @@ -0,0 +1,528 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Tactic.NormNum + +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideReversedPathCertificate +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Preparatory lemmas for a reversed Kempe-path tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideReversedPathPreparation.helper_hparity_47.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (d : ℕ), p.length = (4 : ℕ) * + d → + ∀ n ≤ p.length, (n % (2 : ℕ) = (0 : ℕ) → + ∃ (v : V), p.getVert n = Sum.inl v) ∧ (n % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), p.getVert n = Sum.inr e) := by + classical + intro V E G k e0 phi T alpha beta p d hd n + induction n using Nat.strong_induction_on with + | h n ih => + intro hn + constructor + · intro he + by_cases hn0 : n = 0 + · exact ⟨T.vertex ⟨0, Nat.zero_lt_succ T.length⟩, by simpa [hn0] using p.getVert_zero⟩ + · obtain ⟨w, hz⟩ := (ih (n - 1) (by omega) (by omega)).2 (by omega) + have ha := p.adj_getVert_succ (i := n - 1) (by omega) + have hn' : n - 1 + 1 = n := by omega + rw [hn'] at ha + rw [hz] at ha + cases hc : p.getVert n with + | inl v => exact ⟨v, rfl⟩ + | inr e => + exfalso + have ha' : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inr w) (Sum.inr e) := hc ▸ ha + simp [TwoColorIncidenceGraph] at ha' + · intro ho + obtain ⟨w, hz⟩ := (ih (n - 1) (by omega) (by omega)).1 (by omega) + have ha := p.adj_getVert_succ (i := n - 1) (by omega) + have hn' : n - 1 + 1 = n := by omega + rw [hn'] at ha + rw [hz] at ha + cases hc : p.getVert n with + | inl v => + exfalso + have ha' : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inl w) (Sum.inl v) := hc ▸ ha + simp [TwoColorIncidenceGraph] at ha' + | inr e => exact ⟨e, rfl⟩ + +theorem ScheideReversedPathPreparation.helper_reversedVertex_injective_187.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (d : ℕ) (hd : p.length = (4 : + ℕ) * d) (hparity : + ∀ n ≤ p.length, (n % (2 : ℕ) = (0 : ℕ) → + ∃ (v : V), p.getVert n = Sum.inl v) ∧ (n % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), p.getVert n = Sum.inr e)), + let m : ℕ := p.length / (2 : ℕ); + ∀ (hm : p.length = (2 : ℕ) * m), + let vertexAt : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + exact by + have := GoldbergSeymour.TreeSequence.positive T + exact by omega + )).left ( + by omega + )); + let reversedVertex : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ if hi : (↑i : ℕ) = + (0 : ℕ) then vertexAt (0 : Fin (m + (1 : ℕ))) else vertexAt (⟨m + (1 : ℕ) - (↑i : ℕ), + by omega + ⟩ : Fin (m + (1 : ℕ))); Function.Injective vertexAt → Function.Injective reversedVertex := by + classical + intro V E G k e0 phi T alpha beta p d hd hparity m hm vertexAt reversedVertex + vertexAt_injective i j hij + have hiLt := i.isLt + have hjLt := j.isLt + by_cases hi : i.val = 0 <;> by_cases hj : j.val = 0 + · apply Fin.ext + omega + · simp only [reversedVertex, dite_eq_left hi, dite_eq_right hj] at hij + have hidx := vertexAt_injective hij + have hidx' := congrArg Fin.val hidx + apply Fin.ext + change 0 = m + 1 - j.val at hidx' + omega + · simp only [reversedVertex, dite_eq_right hi, dite_eq_left hj] at hij + have hidx := vertexAt_injective hij + have hidx' := congrArg Fin.val hidx + apply Fin.ext + change m + 1 - i.val = 0 at hidx' + omega + · simp only [reversedVertex, dite_eq_right hi, dite_eq_right hj] at hij + have hidx := vertexAt_injective hij + have hidx' := congrArg Fin.val hidx + apply Fin.ext + change m + 1 - i.val = m + 1 - j.val at hidx' + omega + +theorem ScheideReversedPathPreparation.helper_reversedEdge_injective_212.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), KTriple G k e0 phi → + ∀ (alpha beta : Fin k) (p : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl (T.vertex + (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (d : ℕ) (hd : + p.length = (4 : ℕ) * d) (hparity : + ∀ n ≤ p.length, (n % (2 : ℕ) = (0 : ℕ) → + ∃ (v : V), p.getVert n = Sum.inl v) ∧ (n % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), p.getVert n = Sum.inr e)), + let m : ℕ := p.length / (2 : ℕ); + ∀ (hm : p.length = (2 : ℕ) * m), + let edgeAt : Fin m → E := fun (i : Fin m) ↦ Classical.choose ((hparity ((2 : ℕ) * (↑i : ℕ) + + (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + exact by + have := GoldbergSeymour.TreeSequence.positive T + exact by omega + )).right ( + by omega + )); ( + ∀ (i : Fin m), + ∃ (c : Fin k), phi (edgeAt i) = some c) → + let reversedEdge : Fin m → E := fun (i : Fin m) ↦ if hi : (↑i : ℕ) = (0 : ℕ) then e0 else + edgeAt (⟨m - (↑i : ℕ), + by omega + ⟩ : Fin m); Function.Injective edgeAt → Function.Injective reversedEdge := by + classical + intro V E _ _ _ G k e0 phi T htriple alpha beta p d hd hparity m hm edgeAt edgeAt_colored + reversedEdge edgeAt_injective i j hij + have hiLt := i.isLt + have hjLt := j.isLt + by_cases hi : i.val = 0 <;> by_cases hj : j.val = 0 + · apply Fin.ext + omega + · simp only [reversedEdge, dite_eq_left hi, dite_eq_right hj] at hij + exfalso + have he0 := htriple.2.2.2.2.1 + obtain ⟨c, hc⟩ := edgeAt_colored ⟨m - j.val, by omega⟩ + rw [← hij] at hc + rw [he0] at hc + cases hc + · simp only [reversedEdge, dite_eq_right hi, dite_eq_left hj] at hij + exfalso + have he0 := htriple.2.2.2.2.1 + obtain ⟨c, hc⟩ := edgeAt_colored ⟨m - i.val, by omega⟩ + rw [hij] at hc + rw [he0] at hc + cases hc + · simp only [reversedEdge, dite_eq_right hi, dite_eq_right hj] at hij + have hidx := edgeAt_injective hij + have hidx' := congrArg Fin.val hidx + apply Fin.ext + change m - i.val = m - j.val at hidx' + omega + +theorem ScheideReversedPathPreparation.helper_edge_ends_239.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (d : ℕ) (hd : p.length = (4 : + ℕ) * d) (hparity : + ∀ n ≤ p.length, (n % (2 : ℕ) = (0 : ℕ) → + ∃ (v : V), p.getVert n = Sum.inl v) ∧ (n % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), p.getVert n = Sum.inr e)), + let m : ℕ := p.length / (2 : ℕ); + ∀ (hm : p.length = (2 : ℕ) * m), + let vertexAt : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + exact by + have := GoldbergSeymour.TreeSequence.positive T + exact by omega + )).left ( + by omega + )); ( + ∀ (i : Fin (m + (1 : ℕ))), p.getVert ((2 : ℕ) * (↑i : ℕ)) = Sum.inl (vertexAt i)) → + let edgeAt : Fin m → E := fun (i : Fin m) ↦ Classical.choose ((hparity ((2 : ℕ) * (↑i : ℕ) + + (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + exact by + have := GoldbergSeymour.TreeSequence.positive T + exact by omega + )).right ( + by omega + )); ( + ∀ (i : Fin m), p.getVert ((2 : ℕ) * (↑i : ℕ) + (1 : ℕ)) = Sum.inr (edgeAt i)) → + Function.Injective vertexAt → + ∀ (i : Fin m), G.ends (edgeAt i) = s(vertexAt (⟨(↑i : ℕ), + by omega + ⟩ : Fin (m + (1 : ℕ))), vertexAt i.succ) := by + classical + intro V E G k e0 phi T alpha beta p d hd hparity m hm vertexAt vertexAt_eq edgeAt edgeAt_eq + vertexAt_injective i + have hleft := p.adj_getVert_succ (i := 2 * i.val) (by rw [hm]; omega) + have hright := p.adj_getVert_succ (i := 2 * i.val + 1) (by rw [hm]; omega) + rw [vertexAt_eq ⟨i.val, by omega⟩, edgeAt_eq i] at hleft + rw [edgeAt_eq i] at hright + have hstep : 2 * i.val + 1 + 1 = 2 * i.succ.val := by + simp [Fin.succ] + omega + rw [hstep, vertexAt_eq i.succ] at hright + have hleft' : Incident G (vertexAt ⟨i.val, by omega⟩) (edgeAt i) := by + simpa [TwoColorIncidenceGraph] using hleft.1 + have hright' : Incident G (vertexAt i.succ) (edgeAt i) := by + simpa [TwoColorIncidenceGraph] using hright.1 + have hne : vertexAt ⟨i.val, by omega⟩ ≠ vertexAt i.succ := by + intro he + have hi := vertexAt_injective he + have hv := congrArg Fin.val hi + have hv' : i.val = i.val + 1 := by simp [Fin.succ] at hv + omega + exact (Sym2.mem_and_mem_iff hne).mp ⟨hleft', hright'⟩ + +theorem ScheideReversedPathPreparation.helper_branch_272.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) + (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl + (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) + (Sum.inl + (T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) + (d : ℕ) (hd : p.length = (4 : ℕ) * d) + (hparity : + ∀ n ≤ p.length, + (n % (2 : ℕ) = (0 : ℕ) → ∃ (v : V), p.getVert n = Sum.inl v) ∧ + (n % (2 : ℕ) = (1 : ℕ) → ∃ (e : E), p.getVert n = Sum.inr e)), + let m : ℕ := p.length / (2 : ℕ); + ∀ (hm : p.length = (2 : ℕ) * m) (hmpos : (2 : ℕ) ≤ m), + let vertexAt : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ + Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + exact by + have := GoldbergSeymour.TreeSequence.positive T + exact by omega)).left + (by omega)); + let edgeAt : Fin m → E := fun (i : Fin m) ↦ + Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ) + (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + exact by + have := GoldbergSeymour.TreeSequence.positive T + exact by omega)).right + (by omega)); + let reversedVertex : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ + if hi : (↑i : ℕ) = (0 : ℕ) then vertexAt (0 : Fin (m + (1 : ℕ))) + else vertexAt (⟨m + (1 : ℕ) - (↑i : ℕ), by omega⟩ : Fin (m + (1 : ℕ))); + let reversedEdge : Fin m → E := fun (i : Fin m) ↦ + if hi : (↑i : ℕ) = (0 : ℕ) then e0 else edgeAt (⟨m - (↑i : ℕ), by omega⟩ : Fin m); + reversedVertex (⟨(0 : ℕ), by omega⟩ : Fin (m + (1 : ℕ))) = + T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))) → + reversedVertex (⟨(1 : ℕ), by omega⟩ : Fin (m + (1 : ℕ))) = + T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ))) → + ∀ (j : Fin m), + (↑j : ℕ) = (0 : ℕ) → + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + G.ends (reversedEdge j) = s(reversedVertex j.succ, reversedVertex (i.castLT (by omega))) := by + classical + intro V E G k e0 phi T alpha beta p d hd hparity m hm hmpos vertexAt edgeAt reversedVertex + reversedEdge hvzero hvone j hj + refine ⟨0, ?_⟩ + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + have iLt := i.isLt + have hi0 : i.val = 0 := Nat.eq_zero_of_le_zero + (Nat.le_of_lt_succ (by simp)) + have hiV : (i.castLT (Nat.lt_trans i.isLt (Nat.succ_lt_succ (show 0 < T.length by + omega)))) = + (⟨0, by omega⟩ : Fin (T.length + 1)) := by + apply Fin.ext + simp [] + have heq : T.edge ⟨0, T.positive⟩ = e0 := T.first_edge + rw [hiV] at hi + rw [heq] at hi + have hj0 : j = (⟨0, by omega⟩ : Fin m) := Fin.ext (by simpa using hj) + have hsucc : (⟨0, by omega⟩ : Fin m).succ = (⟨1, by omega⟩ : Fin (m + 1)) := by + apply Fin.ext + rfl + rw [hj0, hsucc, hvone] + simp only [reversedVertex] + have hv0 := hvzero + simp only [reversedVertex, dite_eq_left rfl] at hv0 + rw [hv0] + simp [reversedEdge] + simpa using hi + +theorem ScheideReversedPathPreparation.helper_hends_364.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (T : TreeSequence G e0), + T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))) ≠ + T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ))) := by + classical + intro V E G e0 T h + have hne : (⟨0, Nat.zero_lt_succ T.length⟩ : Fin (T.length + 1)) ≠ + ⟨1, Nat.succ_lt_succ T.positive⟩ := by + intro heq + have hv := congrArg Fin.val heq + norm_num at hv + exact hne (T.vertex_injective h) + +theorem ScheideReversedPathPreparation.helper_hpos_373.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))) ≠ T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ))) → (0 : ℕ) < p.length := by + classical + intro V E G k e0 phi T alpha beta p hends + by_contra hz + have hz0 : p.length = 0 := Nat.eq_zero_of_not_pos hz + have heq := SimpleGraph.Walk.eq_of_length_eq_zero hz0 + apply hends + simpa using heq + +theorem ScheideReversedPathPreparation.helper_edgeAt_colored_392.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (d : ℕ) (hd : p.length = (4 : + ℕ) * d) (hparity : + ∀ n ≤ p.length, (n % (2 : ℕ) = (0 : ℕ) → + ∃ (v : V), p.getVert n = Sum.inl v) ∧ (n % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), p.getVert n = Sum.inr e)), + let m : ℕ := p.length / (2 : ℕ); + ∀ (hm : p.length = (2 : ℕ) * m), + let vertexAt : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + )).left ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + )); ( + ∀ (i : Fin (m + (1 : ℕ))), p.getVert ((2 : ℕ) * (↑i : ℕ)) = Sum.inl (vertexAt i)) → + let edgeAt : Fin m → E := fun (i : Fin m) ↦ Classical.choose ((hparity ((2 : ℕ) * (↑i : ℕ) + + (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + )).right ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + )); ( + ∀ (i : Fin m), p.getVert ((2 : ℕ) * (↑i : ℕ) + (1 : ℕ)) = Sum.inr (edgeAt i)) → + ∀ (i : Fin m), + ∃ (c : Fin k), phi (edgeAt i) = some c := by + classical + intro V E G k e0 phi T alpha beta p d hd hparity m hm vertexAt vertexAt_eq edgeAt edgeAt_eq i + have ha := p.adj_getVert_succ (i := 2 * i.val) (by rw [hm]; omega) + rw [vertexAt_eq ⟨i.val, by omega⟩, edgeAt_eq i] at ha + have hc : phi (edgeAt i) = some alpha ∨ phi (edgeAt i) = some beta := by + simpa [TwoColorIncidenceGraph] using ha.2 + rcases hc with hc | hc + · exact ⟨alpha, hc⟩ + · exact ⟨beta, hc⟩ + +theorem ScheideReversedPathPreparation.helper_hvone_418.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (d : ℕ) (hd : p.length = (4 : + ℕ) * d) (hparity : + ∀ n ≤ p.length, (n % (2 : ℕ) = (0 : ℕ) → + ∃ (v : V), p.getVert n = Sum.inl v) ∧ (n % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), p.getVert n = Sum.inr e)), + let m : ℕ := p.length / (2 : ℕ); + ∀ (hm : p.length = (2 : ℕ) * m) (hmpos : (2 : ℕ) ≤ m), + let vertexAt : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + )).left ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + )); ( + ∀ (i : Fin (m + (1 : ℕ))), p.getVert ((2 : ℕ) * (↑i : ℕ)) = Sum.inl (vertexAt i)) → + let reversedVertex : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ if hi : (↑i : ℕ) = + (0 : ℕ) then vertexAt (0 : Fin (m + (1 : ℕ))) else vertexAt (⟨m + (1 : ℕ) - (↑i : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (m + (1 : ℕ))); reversedVertex (⟨(1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (m + (1 : ℕ))) = T.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 + : ℕ))) := by + classical + intro V E G k e0 phi T alpha beta p d hd hparity m hm hmpos vertexAt vertexAt_eq reversedVertex + simp only [reversedVertex] + have he : p.getVert p.length = + Sum.inl (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩) := by + simpa using p.getVert_length + rw [hm] at he + have hh := vertexAt_eq ⟨m, by omega⟩ + rw [he] at hh + exact Sum.inl.inj hh.symm + +theorem ScheideReversedPathPreparation.helper_vertexAt_injective_428.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), p.IsPath → + ∀ (d : ℕ) (hd : p.length = (4 : ℕ) * d) (hparity : + ∀ n ≤ p.length, (n % (2 : ℕ) = (0 : ℕ) → + ∃ (v : V), p.getVert n = Sum.inl v) ∧ (n % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), p.getVert n = Sum.inr e)), + let m : ℕ := p.length / (2 : ℕ); + ∀ (hm : p.length = (2 : ℕ) * m), + let vertexAt : Fin (m + (1 : ℕ)) → V := fun (i : Fin (m + (1 : ℕ))) ↦ Classical.choose + ((hparity ((2 : ℕ) * (↑i : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + )).left ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + )); ( + ∀ (i : Fin (m + (1 : ℕ))), p.getVert ((2 : ℕ) * (↑i : ℕ)) = Sum.inl (vertexAt i)) → + Function.Injective vertexAt := by + classical + intro V E G k e0 phi T alpha beta p hp d hd hparity m hm vertexAt vertexAt_eq i j hij + have hi := vertexAt_eq i + have hj := vertexAt_eq j + have heq : p.getVert (2 * i.val) = p.getVert (2 * j.val) := by + rw [hi, hj, hij] + have hi' : 2 * i.val ≤ p.length := by rw [hm]; omega + have hj' : 2 * j.val ≤ p.length := by rw [hm]; omega + have hinj := hp.getVert_injOn hi' hj' heq + omega + +theorem ScheideReversedPathPreparation.helper_edgeAt_injective_438.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : + PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha beta : Fin k) (p : + (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), + Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))), p.IsPath → + ∀ (d : ℕ) (hd : p.length = (4 : ℕ) * d) (hparity : + ∀ n ≤ p.length, (n % (2 : ℕ) = (0 : ℕ) → + ∃ (v : V), p.getVert n = Sum.inl v) ∧ (n % (2 : ℕ) = (1 : ℕ) → + ∃ (e : E), p.getVert n = Sum.inr e)), + let m : ℕ := p.length / (2 : ℕ); + ∀ (hm : p.length = (2 : ℕ) * m), + let edgeAt : Fin m → E := fun (i : Fin m) ↦ Classical.choose ((hparity ((2 : ℕ) * (↑i : ℕ) + + (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + )).right ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + )); ( + ∀ (i : Fin m), p.getVert ((2 : ℕ) * (↑i : ℕ) + (1 : ℕ)) = Sum.inr (edgeAt i)) → + Function.Injective edgeAt := by + classical + intro V E G k e0 phi T alpha beta p hp d hd hparity m hm edgeAt edgeAt_eq i j hij + have hi := edgeAt_eq i + have hj := edgeAt_eq j + have heq : p.getVert (2 * i.val + 1) = p.getVert (2 * j.val + 1) := by + rw [hi, hj, hij] + have hi' : 2 * i.val + 1 ≤ p.length := by rw [hm]; omega + have hj' : 2 * j.val + 1 ≤ p.length := by rw [hm]; omega + have hinj := hp.getVert_injOn hi' hj' heq + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean b/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean new file mode 100644 index 0000000000..1e2ad7f680 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean @@ -0,0 +1,1048 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Selected Block Deletion + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hatt_115.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (hi : (↑i : ℕ) < C.s) + (hp : (2 : ℕ) ≤ C.p) (hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) + (hn : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + let d : ℕ := C.p - (1 : ℕ) + (2 : ℕ) * (↑i : ℕ); + let rV : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => + if h : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by + omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) => + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let rE : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) => + if _ : (↑q : ℕ) < d then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) => by + omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))), + (↑(rV q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(rE q) : ℕ) = if (↑q : ℕ) < d then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + d + (1 : ℕ) < T.length → + let nv : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → V := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => T.vertex (rV q); + let ne : Fin (T.length - (2 : ℕ)) → E := fun (q : Fin (T.length - (2 : ℕ))) => + T.edge (rE q); + ∀ (q : Fin (T.length - (2 : ℕ))), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)))) := by + classical + intro V E _ _ _ G k e0 phi T C i hi hp hl hn m d rV rE rV_val rE_val hd nv ne q + by_cases hq : q.val < d + · obtain ⟨a, ha⟩ := T.attaches (rE q) + have he : rE q = ⟨q.val, by omega⟩ := by + apply Fin.ext; rw [rE_val]; simp [hq] + have hav : a.val < q.val + 1 := by + simpa [he] using a.isLt + refine ⟨⟨a.val, hav⟩, ?_⟩ + dsimp [ne, nv] + have hs : rV q.succ = (rE q).succ := by + apply Fin.ext + rw [rV_val] + have her : (rE q).val = q.val := by + simpa using congrArg Fin.val he + change (if q.val + 1 < m then q.val + 1 else q.val + 1 + 2) = + (rE q).val + 1 + rw [her] + have : q.val + 1 < m := by dsimp [d, m] at *; omega + simp [this] + have haidx : rV ⟨a.val, by omega⟩ = + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ (rE q).isLt)) := by + apply Fin.ext + rw [rV_val] + have ham : a.val < m := by dsimp [m, d] at *; omega + simp [ham] + have hqidx : q.succ = ⟨q.val + 1, by omega⟩ := rfl + have hnvq : T.vertex (rV q.succ) = T.vertex (rE q).succ := + congrArg T.vertex hs + have hnva : T.vertex (rV ⟨a.val, by omega⟩) = + T.vertex (Fin.castLT a (Nat.lt_trans a.isLt + (Nat.succ_lt_succ (rE q).isLt))) := congrArg T.vertex haidx + rw [hnvq, hnva] + exact ha + · let x := q.val + 2 - (C.p - 1) + let rr := x / 2 + let jj := x % 2 + have hq : d ≤ q.val := by omega + have hqT : q.val + 2 < T.length := by omega + have hx : q.val + 2 = C.p - 1 + x := by + dsimp [x] + omega + have hdiv : x = 2 * rr + jj := by + dsimp [rr, jj] + omega + have hj : jj < 2 := by dsimp [jj]; omega + have hr : rr < C.s := by + dsimp [rr, x] + omega + let r : Fin C.s := ⟨rr, hr⟩ + let j : Fin 2 := ⟨jj, hj⟩ + obtain ⟨b, hb⟩ := C.block_attaches_to_base r j + have het : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply Fin.ext + rw [rE_val] + have hn : ¬ q.val < d := by omega + simp only [ite_eq_right hn] + dsimp [r, j, rr, jj, x] + omega + have hrv : rV q.succ = + ⟨C.p + 2 * r.val + j.val, by omega⟩ := by + apply Fin.ext + rw [rV_val] + have hn : ¬ q.val + 1 < m := by dsimp [m, d] at *; omega + simp only [] + have heq : q.val + 1 + 2 = C.p + 2 * rr + jj := by + dsimp [x] at hx + dsimp [rr, jj] + omega + simpa [r, j, hn] using heq + have heb : ne q = C.blockEdge r j := by + dsimp [ne] + rw [het, C.block_edge_position] + have hnv : nv q.succ = C.blockVertex r j := by + dsimp [nv] + rw [hrv, C.block_vertex_position] + have hbq : b.val < q.val + 1 := by + have := b.isLt + dsimp [r, j] at hb ⊢ + omega + refine ⟨⟨b.val, hbq⟩, ?_⟩ + rw [heb, hnv] + have hcast : Fin.castLT ⟨b.val, hbq⟩ + (Nat.lt_trans (show b.val < q.val + 1 from hbq) + (Nat.succ_lt_succ q.isLt)) = ⟨b.val, by omega⟩ := by + apply Fin.ext + rfl + rw [hcast] + have hnb : b.val < m := by dsimp [m]; omega + change G.ends (C.blockEdge r j) = + s(C.blockVertex r j, T.vertex (rV ⟨b.val, by omega⟩)) + have hrb : rV ⟨b.val, by omega⟩ = ⟨b.val, by omega⟩ := by + apply Fin.ext + rw [rV_val] + simp [hnb] + rw [hrb, C.base_vertex_position] + exact hb.trans Sym2.eq_swap + +private theorem helper_edge_class_global_229.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (hi : (↑i : ℕ) < C.s) + (hp : (2 : ℕ) ≤ C.p) (hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) + (hn : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + let d : ℕ := C.p - (1 : ℕ) + (2 : ℕ) * (↑i : ℕ); + let rV : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => + if h : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by + omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) => + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let rE : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) => + if _ : (↑q : ℕ) < d then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) => by + omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(rE q) : ℕ) = if (↑q : ℕ) < d then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + m + (1 : ℕ) ≤ T.length → + d + (1 : ℕ) < T.length → + ∀ + (hfirst : + rE + (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by + omega⟩ : + Fin (T.length - (2 : ℕ))) = + (⟨(0 : ℕ), T.positive⟩ : Fin T.length)), + let nv : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → V := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => T.vertex (rV q); + let ne : Fin (T.length - (2 : ℕ)) → E := fun (q : Fin (T.length - (2 : ℕ))) => + T.edge (rE q); + ∀ (nv_inj : Function.Injective nv) (ne_inj : Function.Injective ne) + (hatt : + ∀ (q : Fin (T.length - (2 : ℕ))), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), + let S : TreeSequence G e0 := + { length := T.length - (2 : ℕ), + positive := + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => by omega, + vertex := nv, edge := ne, vertex_injective := nv_inj, edge_injective := ne_inj, + first_edge := + have he : + rE + (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by + omega⟩ : + Fin (T.length - (2 : ℕ))) = + (⟨(0 : ℕ), T.positive⟩ : Fin T.length) := + hfirst; + id + (Eq.mpr (id (congrArg (fun (_a : Fin T.length) => T.edge _a = e0) he)) + T.first_edge), + attaches := hatt : TreeSequence G e0 }; + ∀ (q : Fin (T.length - (2 : ℕ))), + (∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ S.edge q = C.baseEdge a) ∨ + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + r ≠ i ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ S.edge q = C.blockEdge r j := by + classical + intro V E _ _ _ G k e0 phi T C i hi hp hl hn m d rV rE rE_val hm hd hfirst nv ne nv_inj ne_inj + hatt S q + by_cases hq : q.val < d + · by_cases hb : q.val < C.p - 1 + · left + refine ⟨⟨q.val, hb⟩, rfl, ?_⟩ + have he : rE q = ⟨q.val, by omega⟩ := by + apply Fin.ext + rw [rE_val] + simp [hq] + change T.edge (rE q) = C.baseEdge ⟨q.val, hb⟩ + rw [he] + exact C.base_edge_position ⟨q.val, hb⟩ + · right + let x := q.val - (C.p - 1) + let rr := x / 2 + let jj := x % 2 + have hx : q.val = C.p - 1 + x := by dsimp [x]; omega + have hj : jj < 2 := by dsimp [jj]; omega + have hr : rr < C.s := by + dsimp [rr, x] + omega + let r : Fin C.s := ⟨rr, hr⟩ + let j : Fin 2 := ⟨jj, hj⟩ + have hri : r.val < i.val := by dsimp [r, rr, x]; omega + refine ⟨r, j, ?_, ?_, ?_⟩ + · intro h + exact (Nat.ne_of_lt hri) (congrArg Fin.val h) + · omega + · have he : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply Fin.ext + rw [rE_val] + simp [hq] + dsimp [r, j, rr, jj] + omega + change T.edge (rE q) = C.blockEdge r j + rw [he] + exact C.block_edge_position r j + · right + let x := q.val + 2 - (C.p - 1) + let rr := x / 2 + let jj := x % 2 + have hx : q.val + 2 = C.p - 1 + x := by dsimp [x]; omega + have hdiv : x = 2 * rr + jj := by dsimp [rr, jj]; omega + have hj : jj < 2 := by dsimp [jj]; omega + have hr : rr < C.s := by + dsimp [rr, x] + omega + let r : Fin C.s := ⟨rr, hr⟩ + let j : Fin 2 := ⟨jj, hj⟩ + have hri : i.val < r.val := by + dsimp [r, rr, x] + omega + refine ⟨r, j, ?_, ?_, ?_⟩ + · intro heq + exact (Nat.ne_of_gt hri) (congrArg Fin.val heq) + · omega + · have he : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply Fin.ext + rw [rE_val] + simp only [ite_eq_right hq] + dsimp [r, j, rr, jj] + omega + change T.edge (rE q) = C.blockEdge r j + rw [he, C.block_edge_position] + +private theorem helper_branch_298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (hi : (↑i : ℕ) < C.s) + (hp : (2 : ℕ) ≤ C.p) (hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) + (hn : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + let d : ℕ := C.p - (1 : ℕ) + (2 : ℕ) * (↑i : ℕ); + let rV : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => + if h : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by + omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) => + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let rE : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) => + if _ : (↑q : ℕ) < d then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) => by + omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))), + (↑(rV q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + m + (1 : ℕ) ≤ T.length → + ∀ + (hfirst : + rE + (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by + omega⟩ : + Fin (T.length - (2 : ℕ))) = + (⟨(0 : ℕ), T.positive⟩ : Fin T.length)), + let nv : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → V := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => T.vertex (rV q); + let ne : Fin (T.length - (2 : ℕ)) → E := fun (q : Fin (T.length - (2 : ℕ))) => + T.edge (rE q); + ∀ (nv_inj : Function.Injective nv) (ne_inj : Function.Injective ne) + (hatt : + ∀ (q : Fin (T.length - (2 : ℕ))), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), + TreeSequenceVertexSet + { length := T.length - (2 : ℕ), + positive := + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => by omega, + vertex := nv, edge := ne, vertex_injective := nv_inj, edge_injective := ne_inj, + first_edge := + have he : + rE + (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => + by omega⟩ : + Fin (T.length - (2 : ℕ))) = + (⟨(0 : ℕ), T.positive⟩ : Fin T.length) := + hfirst; + id + (Eq.mpr (id (congrArg (fun (_a : Fin T.length) => T.edge _a = e0) he)) + T.first_edge), + attaches := hatt : TreeSequence G e0 } = + TreeSequenceVertexSet T \ + {C.blockVertex i (0 : Fin (2 : ℕ)), C.blockVertex i (1 : Fin (2 : ℕ))} := by + classical + intro V E _ _ _ _ G k e0 phi T C i hi hp hl hn m d rV rE rV_val hm hfirst nv ne nv_inj ne_inj hatt + ext x + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and, + Finset.mem_sdiff, Finset.mem_insert, Finset.mem_singleton] + constructor + · rintro ⟨q, rfl⟩ + refine ⟨⟨rV q, rfl⟩, ?_⟩ + · rintro (h | h) + · change T.vertex (rV q) = C.blockVertex i 0 at h + rw [← C.block_vertex_position i 0] at h + have hv := T.vertex_injective h + have heq : rV q = ⟨m, by omega⟩ := by + exact hv + have hvv := congrArg Fin.val heq + rw [rV_val] at hvv + by_cases hq : q.val < m <;> simp [hq] at hvv <;> omega + · change T.vertex (rV q) = C.blockVertex i 1 at h + rw [← C.block_vertex_position i 1] at h + have hv := T.vertex_injective h + have heq : rV q = ⟨m + 1, by omega⟩ := by + exact hv + have hvv := congrArg Fin.val heq + rw [rV_val] at hvv + by_cases hq : q.val < m <;> simp [hq] at hvv <;> omega + · rintro ⟨⟨t, rfl⟩, hnot⟩ + by_cases ht : t.val < m + · refine ⟨⟨t.val, by omega⟩, ?_⟩ + · have he : rV ⟨t.val, by omega⟩ = t := by + apply Fin.ext + rw [rV_val] + simp [ht] + exact congrArg T.vertex he + · by_cases htm : t.val = m + · exfalso + apply hnot + left + rw [← C.block_vertex_position i 0] + congr 1 + apply Fin.ext + omega + · by_cases htm1 : t.val = m + 1 + · exfalso + apply hnot + right + rw [← C.block_vertex_position i 1] + congr 1 + apply Fin.ext + omega + · have hgt : m + 1 < t.val := by omega + refine ⟨⟨t.val - 2, by omega⟩, ?_⟩ + · have he : rV ⟨t.val - 2, by omega⟩ = t := by + apply Fin.ext + rw [rV_val] + simp [show ¬ t.val - 2 < m by omega] + omega + exact congrArg T.vertex he + +private theorem helper_branch_381.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (hi : (↑i : ℕ) < C.s) + (hp : (2 : ℕ) ≤ C.p) (hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) + (hn : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + let d : ℕ := C.p - (1 : ℕ) + (2 : ℕ) * (↑i : ℕ); + let rV : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => + if h : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by + omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) => + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let rE : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) => + if _ : (↑q : ℕ) < d then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) => by + omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))), + (↑(rV q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(rE q) : ℕ) = if (↑q : ℕ) < d then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + m + (1 : ℕ) ≤ T.length → + d + (1 : ℕ) < T.length → + let nv : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → V := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => T.vertex (rV q); + let ne : Fin (T.length - (2 : ℕ)) → E := fun (q : Fin (T.length - (2 : ℕ))) => + T.edge (rE q); + ∀ (r : Fin C.s), + ¬r = i → + ∀ (j : Fin (2 : ℕ)), + ∃ (qv : Fin (T.length - (2 : ℕ) + (1 : ℕ))) (qe : Fin (T.length - (2 : ℕ))), + C.p ≤ (↑qv : ℕ) ∧ + C.p - (1 : ℕ) ≤ (↑qe : ℕ) ∧ + (↑qe : ℕ) + (1 : ℕ) = (↑qv : ℕ) ∧ + nv qv = C.blockVertex r j ∧ ne qe = C.blockEdge r j := by + classical + intro V E _ _ _ G k e0 phi T C i hi hp hl hn m d rV rE rV_val rE_val hm hd nv ne r hri j + have hr := r.isLt + have hj := j.isLt + have htwo : 2 ≤ T.length := by omega + have hlen : T.length = C.p + 2 * C.s - 1 := by omega + have hnew : T.length - 2 + 1 = T.length - 1 := by omega + by_cases hri' : r.val < i.val + · have hpos : C.p + 2 * r.val + j.val < m := by dsimp [m]; omega + have hpose : C.p - 1 + 2 * r.val + j.val < d := by dsimp [d]; omega + have hqv : C.p + 2 * r.val + j.val < T.length - 1 := by + dsimp [m] at hpos + omega + have hqe : C.p - 1 + 2 * r.val + j.val < T.length - 2 := by + dsimp [d] at hpose + omega + let qv : Fin (T.length - 2 + 1) := ⟨C.p + 2 * r.val + j.val, by omega⟩ + let qe : Fin (T.length - 2) := ⟨C.p - 1 + 2 * r.val + j.val, hqe⟩ + refine ⟨qv, qe, by dsimp [qv]; omega, by dsimp [qe]; omega, + by dsimp [qv, qe]; omega, ?_, ?_⟩ + · dsimp [nv] + have hold : C.p + 2 * r.val + j.val < T.length + 1 := by omega + have he : rV qv = + ⟨C.p + 2 * r.val + j.val, hold⟩ := by + dsimp [qv] + apply Fin.ext + rw [rV_val] + simp [hpos] + rw [he, C.block_vertex_position] + · dsimp [ne] + have hold : C.p - 1 + 2 * r.val + j.val < T.length := by omega + have he : rE qe = + ⟨C.p - 1 + 2 * r.val + j.val, hold⟩ := by + dsimp [qe] + apply Fin.ext + rw [rE_val] + simp [hpose] + rw [he, C.block_edge_position] + · have hri'' : i.val < r.val := by omega + have hpos : ¬ C.p + 2 * r.val + j.val - 2 < m := by dsimp [m]; omega + have hpose : ¬ C.p - 1 + 2 * r.val + j.val - 2 < d := by dsimp [d]; omega + have hqv : C.p + 2 * r.val + j.val - 2 < T.length - 1 := by + dsimp [m] at hpos + omega + have hqe : C.p - 1 + 2 * r.val + j.val - 2 < T.length - 2 := by + dsimp [d] at hpose + omega + let qv : Fin (T.length - 2 + 1) := ⟨C.p + 2 * r.val + j.val - 2, by rw [hnew]; exact hqv⟩ + let qe : Fin (T.length - 2) := ⟨C.p - 1 + 2 * r.val + j.val - 2, hqe⟩ + refine ⟨qv, qe, by dsimp [qv]; omega, by dsimp [qe]; omega, + by dsimp [qv, qe]; omega, ?_, ?_⟩ + · dsimp [nv] + have hold : C.p + 2 * r.val + j.val < T.length + 1 := by omega + have he : rV qv = + ⟨C.p + 2 * r.val + j.val, hold⟩ := by + dsimp [qv] + apply Fin.ext + rw [rV_val] + simp [hpos] + omega + rw [he, C.block_vertex_position] + · dsimp [ne] + have hold : C.p - 1 + 2 * r.val + j.val < T.length := by omega + have he : rE qe = + ⟨C.p - 1 + 2 * r.val + j.val, hold⟩ := by + dsimp [qe] + apply Fin.ext + rw [rE_val] + simp [hpose] + omega + rw [he, C.block_edge_position] + +private theorem helper_edge_class_455.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (hi : (↑i : ℕ) < C.s) + (hp : (2 : ℕ) ≤ C.p) (hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) + (hn : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + let d : ℕ := C.p - (1 : ℕ) + (2 : ℕ) * (↑i : ℕ); + let rV : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => + if h : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by + omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) => + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let rE : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) => + if _ : (↑q : ℕ) < d then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) => by + omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(rE q) : ℕ) = if (↑q : ℕ) < d then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + m + (1 : ℕ) ≤ T.length → + d + (1 : ℕ) < T.length → + ∀ + (hfirst : + rE + (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by + omega⟩ : + Fin (T.length - (2 : ℕ))) = + (⟨(0 : ℕ), T.positive⟩ : Fin T.length)), + let nv : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → V := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => T.vertex (rV q); + let ne : Fin (T.length - (2 : ℕ)) → E := fun (q : Fin (T.length - (2 : ℕ))) => + T.edge (rE q); + ∀ (nv_inj : Function.Injective nv) (ne_inj : Function.Injective ne) + (hatt : + ∀ (q : Fin (T.length - (2 : ℕ))), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), + let S : TreeSequence G e0 := + { length := T.length - (2 : ℕ), + positive := + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => by omega, + vertex := nv, edge := ne, vertex_injective := nv_inj, edge_injective := ne_inj, + first_edge := + have he : + rE + (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by + omega⟩ : + Fin (T.length - (2 : ℕ))) = + (⟨(0 : ℕ), T.positive⟩ : Fin T.length) := + hfirst; + id + (Eq.mpr (id (congrArg (fun (_a : Fin T.length) => T.edge _a = e0) he)) + T.first_edge), + attaches := hatt : TreeSequence G e0 }; + ∀ (q : Fin (T.length - (2 : ℕ))), + (∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ S.edge q = C.baseEdge a) ∨ + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + r ≠ i ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ S.edge q = C.blockEdge r j := by + classical + intro V E _ _ _ G k e0 phi T C i hi hp hl hn m d rV rE rE_val hm hd hfirst nv ne nv_inj ne_inj + hatt S q + by_cases hq : q.val < d + · by_cases hb : q.val < C.p - 1 + · left + refine ⟨⟨q.val, hb⟩, rfl, ?_⟩ + have he : rE q = ⟨q.val, by omega⟩ := by + apply Fin.ext + rw [rE_val] + simp [hq] + change T.edge (rE q) = C.baseEdge ⟨q.val, hb⟩ + rw [he] + exact C.base_edge_position ⟨q.val, hb⟩ + · right + let x := q.val - (C.p - 1) + let rr := x / 2 + let jj := x % 2 + have hx : q.val = C.p - 1 + x := by dsimp [x]; omega + have hj : jj < 2 := by dsimp [jj]; omega + have hr : rr < C.s := by + dsimp [rr, x] + omega + let r : Fin C.s := ⟨rr, hr⟩ + let j : Fin 2 := ⟨jj, hj⟩ + have hri : r.val < i.val := by dsimp [r, rr, x]; omega + refine ⟨r, j, ?_, ?_, ?_⟩ + · intro h + exact (Nat.ne_of_lt hri) (congrArg Fin.val h) + · omega + · have he : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply Fin.ext + rw [rE_val] + simp [hq] + dsimp [r, j, rr, jj] + omega + change T.edge (rE q) = C.blockEdge r j + rw [he] + exact C.block_edge_position r j + · right + let x := q.val + 2 - (C.p - 1) + let rr := x / 2 + let jj := x % 2 + have hx : q.val + 2 = C.p - 1 + x := by dsimp [x]; omega + have hdiv : x = 2 * rr + jj := by dsimp [rr, jj]; omega + have hj : jj < 2 := by dsimp [jj]; omega + have hr : rr < C.s := by + dsimp [rr, x] + omega + let r : Fin C.s := ⟨rr, hr⟩ + let j : Fin 2 := ⟨jj, hj⟩ + have hri : i.val < r.val := by + dsimp [r, rr, x] + omega + refine ⟨r, j, ?_, ?_, ?_⟩ + · intro heq + exact (Nat.ne_of_gt hri) (congrArg Fin.val heq) + · omega + · have he : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply Fin.ext + rw [rE_val] + simp only [ite_eq_right hq] + dsimp [r, j, rr, jj] + omega + change T.edge (rE q) = C.blockEdge r j + rw [he, C.block_edge_position] + +private theorem helper_branch_529.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (hi : (↑i : ℕ) < C.s) + (hp : (2 : ℕ) ≤ C.p) (hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) + (hn : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + let d : ℕ := C.p - (1 : ℕ) + (2 : ℕ) * (↑i : ℕ); + let rV : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => + if h : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by + omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) => + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let rE : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) => + if _ : (↑q : ℕ) < d then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) => by + omega⟩ : + Fin T.length); + d + (1 : ℕ) < T.length → + ∀ + (hfirst : + rE + (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by + omega⟩ : + Fin (T.length - (2 : ℕ))) = + (⟨(0 : ℕ), T.positive⟩ : Fin T.length)), + let nv : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → V := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => T.vertex (rV q); + let ne : Fin (T.length - (2 : ℕ)) → E := fun (q : Fin (T.length - (2 : ℕ))) => + T.edge (rE q); + ∀ (nv_inj : Function.Injective nv) (ne_inj : Function.Injective ne) + (hatt : + ∀ (q : Fin (T.length - (2 : ℕ))), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), + let S : TreeSequence G e0 := + { length := T.length - (2 : ℕ), + positive := + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => by omega, + vertex := nv, edge := ne, vertex_injective := nv_inj, edge_injective := ne_inj, + first_edge := + have he : + rE + (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by + omega⟩ : + Fin (T.length - (2 : ℕ))) = + (⟨(0 : ℕ), T.positive⟩ : Fin T.length) := + hfirst; + id + (Eq.mpr (id (congrArg (fun (_a : Fin T.length) => T.edge _a = e0) he)) + T.first_edge), + attaches := hatt : TreeSequence G e0 }; + (∀ (q : Fin (T.length - (2 : ℕ))), + (∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ S.edge q = C.baseEdge a) ∨ + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + r ≠ i ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ S.edge q = C.blockEdge r j) → + ∀ (q : Fin (T.length - (2 : ℕ))), + ¬Incident G (C.blockVertex i (0 : Fin (2 : ℕ))) (ne q) ∧ + ¬Incident G (C.blockVertex i (1 : Fin (2 : ℕ))) (ne q) := by + classical + intro V E _ _ _ G k e0 phi T C i hi hp hl hn m d rV rE hd hfirst nv ne nv_inj ne_inj hatt S + edge_class_global q + constructor + · intro hinc + change C.blockVertex i 0 ∈ G.ends (S.edge q) at hinc + have hclass := edge_class_global q + rcases hclass with ⟨a, ha, he⟩ | ⟨r, j, hri, hq, he⟩ + · obtain ⟨b, hb⟩ := T.attaches ⟨a.val, by omega⟩ + have ha' := a.isLt + have hb' := b.isLt + have hend := hb + have hmemb : C.blockVertex i 0 ∈ s(T.vertex (Fin.succ ⟨a.val, by omega⟩), + T.vertex (b.castLT (by omega))) := by + rw [← hend] + rw [he, ← C.base_edge_position a] at hinc + simpa only [Fin.succ_mk] using hinc + rcases Sym2.mem_iff.mp hmemb with h | h + · rw [← C.block_vertex_position i 0] at h + have hv := T.vertex_injective h + have hvv := congrArg Fin.val hv + simp at hvv + have hba : b.val ≤ a.val := Nat.lt_succ_iff.mp b.isLt + omega + · rw [← C.block_vertex_position i 0] at h + have hv := T.vertex_injective h + have hvv := congrArg Fin.val hv + simp at hvv + have hba : b.val ≤ a.val := Nat.lt_succ_iff.mp b.isLt + omega + · obtain ⟨b, hb⟩ := C.block_attaches_to_base r j + have hi' := i.isLt + have hj := j.isLt + have hr := r.isLt + have heq : G.ends (S.edge q) = s(C.blockVertex r j, C.y b) := by + calc + G.ends (S.edge q) = G.ends (C.blockEdge r j) := congrArg G.ends he + _ = s(C.y b, C.blockVertex r j) := hb + _ = s(C.blockVertex r j, C.y b) := Sym2.eq_swap + have hmemb : C.blockVertex i 0 ∈ s(C.blockVertex r j, C.y b) := by + rw [← heq] + exact hinc + rcases Sym2.mem_iff.mp hmemb with h | h + · rw [← C.block_vertex_position i 0, ← C.block_vertex_position r j] at h + have hv := T.vertex_injective h + have hvv := congrArg Fin.val hv + simp at hvv + apply hri + apply Fin.ext + omega + · rw [← C.block_vertex_position i 0, ← C.base_vertex_position b] at h + have hv := T.vertex_injective h + have hvv := congrArg Fin.val hv + have hb' := b.isLt + simp at hvv + omega + · intro hinc + change C.blockVertex i 1 ∈ G.ends (S.edge q) at hinc + have hclass := edge_class_global q + rcases hclass with ⟨a, ha, he⟩ | ⟨r, j, hri, hq, he⟩ + · obtain ⟨b, hb⟩ := T.attaches ⟨a.val, by omega⟩ + have ha' := a.isLt + have hb' := b.isLt + have hend := hb + have hmemb : C.blockVertex i 1 ∈ s(T.vertex (Fin.succ ⟨a.val, by omega⟩), + T.vertex (b.castLT (by omega))) := by + rw [← hend] + rw [he, ← C.base_edge_position a] at hinc + simpa only [Fin.succ_mk] using hinc + rcases Sym2.mem_iff.mp hmemb with h | h + · rw [← C.block_vertex_position i 1] at h + have hv := T.vertex_injective h + have hvv := congrArg Fin.val hv + simp at hvv + have hba : b.val ≤ a.val := Nat.lt_succ_iff.mp b.isLt + omega + · rw [← C.block_vertex_position i 1] at h + have hv := T.vertex_injective h + have hvv := congrArg Fin.val hv + simp at hvv + have hba : b.val ≤ a.val := Nat.lt_succ_iff.mp b.isLt + omega + · obtain ⟨b, hb⟩ := C.block_attaches_to_base r j + have hi' := i.isLt + have hj := j.isLt + have hr := r.isLt + have heq : G.ends (S.edge q) = s(C.blockVertex r j, C.y b) := by + calc + G.ends (S.edge q) = G.ends (C.blockEdge r j) := congrArg G.ends he + _ = s(C.y b, C.blockVertex r j) := hb + _ = s(C.blockVertex r j, C.y b) := Sym2.eq_swap + have hmemb : C.blockVertex i 1 ∈ s(C.blockVertex r j, C.y b) := by + rw [← heq] + exact hinc + rcases Sym2.mem_iff.mp hmemb with h | h + · rw [← C.block_vertex_position i 1, ← C.block_vertex_position r j] at h + have hv := T.vertex_injective h + have hvv := congrArg Fin.val hv + simp at hvv + apply hri + apply Fin.ext + omega + · rw [← C.block_vertex_position i 1, ← C.base_vertex_position b] at h + have hv := T.vertex_injective h + have hvv := congrArg Fin.val hv + have hb' := b.isLt + simp at hvv + omega + +theorem ScheideSelectedBlockDeletion {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) : + ∃ S : TreeSequence G e0, + TreeSequenceVertexSet S = + TreeSequenceVertexSet T \ {C.blockVertex i 0, C.blockVertex i 1} ∧ + S.length + 2 = T.length ∧ + (∃ rV : Fin (S.length + 1) → Fin (T.length + 1), + (∀ q : Fin (S.length + 1), S.vertex q = T.vertex (rV q)) ∧ + (∀ q : Fin (S.length + 1), q.val < C.p + 2 * i.val → (rV q).val = q.val) ∧ + ∀ q : Fin (S.length + 1), + C.p + 2 * i.val ≤ q.val → (rV q).val = q.val + 2) ∧ + (∃ rE : Fin S.length → Fin T.length, + (∀ q : Fin S.length, S.edge q = T.edge (rE q)) ∧ + (∀ q : Fin S.length, q.val < C.p - 1 + 2 * i.val → (rE q).val = q.val) ∧ + ∀ q : Fin S.length, + C.p - 1 + 2 * i.val ≤ q.val → (rE q).val = q.val + 2) ∧ + (∀ a : Fin C.p, ∃ q : Fin (S.length + 1), q.val = a.val ∧ S.vertex q = C.y a) ∧ + (∀ a : Fin (C.p - 1), + ∃ q : Fin S.length, q.val = a.val ∧ S.edge q = C.baseEdge a) ∧ + (∀ r : Fin C.s, + r ≠ i → + ∀ j : Fin 2, + ∃ qv : Fin (S.length + 1), + ∃ qe : Fin S.length, + C.p ≤ qv.val ∧ + C.p - 1 ≤ qe.val ∧ + qe.val + 1 = qv.val ∧ + S.vertex qv = C.blockVertex r j ∧ + S.edge qe = C.blockEdge r j) ∧ + (∀ q : Fin S.length, + (∃ a : Fin (C.p - 1), q.val = a.val ∧ S.edge q = C.baseEdge a) ∨ + (∃ r : Fin C.s, + ∃ j : Fin 2, + r ≠ i ∧ C.p - 1 ≤ q.val ∧ S.edge q = C.blockEdge r j)) ∧ + (∀ q : Fin S.length, ∃ r : Fin T.length, S.edge q = T.edge r) ∧ + ∀ q : Fin S.length, + ¬Incident G (C.blockVertex i 0) (S.edge q) ∧ + ¬Incident G (C.blockVertex i 1) (S.edge q) := by + classical + have hi : i.val < C.s := i.isLt + have hp : 2 ≤ C.p := C.p_ge_two + have hl : T.length + 1 = C.p + 2 * C.s := C.length_eq + have hn : 3 ≤ T.length := by omega + let m := C.p + 2 * i.val + let d := C.p - 1 + 2 * i.val + let rV : Fin (T.length - 2 + 1) → Fin (T.length + 1) := fun q => + if h : q.val < m then ⟨q.val, by omega⟩ else ⟨q.val + 2, by omega⟩ + let rE : Fin (T.length - 2) → Fin T.length := fun q => + if h : q.val < d then ⟨q.val, by omega⟩ else ⟨q.val + 2, by omega⟩ + have rV_val (q : Fin (T.length - 2 + 1)) : + (rV q).val = if q.val < m then q.val else q.val + 2 := by + by_cases h : q.val < m <;> simp [rV, h] + have rE_val (q : Fin (T.length - 2)) : + (rE q).val = if q.val < d then q.val else q.val + 2 := by + by_cases h : q.val < d <;> simp [rE, h] + have rV_inj : Function.Injective rV := by + intro q z hqz + by_cases hq : q.val < m <;> by_cases hz : z.val < m + all_goals + have hv := congrArg Fin.val hqz + rw [rV_val, rV_val] at hv + simp [hq, hz] at hv + apply Fin.ext + omega + have rE_inj : Function.Injective rE := by + intro q z hqz + by_cases hq : q.val < d <;> by_cases hz : z.val < d + all_goals + have hv := congrArg Fin.val hqz + rw [rE_val, rE_val] at hv + simp [hq, hz] at hv + apply Fin.ext + omega + have hm : m + 1 ≤ T.length := by dsimp [m]; omega + have hd : d + 1 < T.length := by dsimp [d]; omega + have hfirst : rE ⟨0, by omega⟩ = ⟨0, T.positive⟩ := by + apply Fin.ext + rw [rE_val] + have : (0 : ℕ) < d := by dsimp [d]; omega + simp [this] + let nv : Fin (T.length - 2 + 1) → V := fun q => T.vertex (rV q) + let ne : Fin (T.length - 2) → E := fun q => T.edge (rE q) + have nv_inj : Function.Injective nv := by + intro q z hqz + apply rV_inj + exact T.vertex_injective hqz + have ne_inj : Function.Injective ne := by + intro q z hqz + apply rE_inj + exact T.edge_injective hqz + have hatt := @helper_hatt_115 V E inferInstance inferInstance inferInstance G k e0 phi T C i hi hp + hl hn rV_val rE_val hd + let S : TreeSequence G e0 := + { length := T.length - 2 + positive := by omega + vertex := nv + edge := ne + vertex_injective := nv_inj + edge_injective := ne_inj + first_edge := by + have he : rE ⟨0, by omega⟩ = ⟨0, T.positive⟩ := hfirst + dsimp [ne] + rw [he] + exact T.first_edge + attaches := hatt } + refine ⟨S, ?_⟩ + dsimp [S] + have edge_class_global := @helper_edge_class_global_229 V E inferInstance inferInstance + inferInstance G k e0 phi T C i hi hp hl hn rE_val hm hd hfirst nv_inj ne_inj hatt + refine ⟨?_, by omega, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact @helper_branch_298 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C i hi hp hl hn rV_val hm hfirst nv_inj ne_inj hatt + · refine ⟨rV, ?_, ?_, ?_⟩ + · intro q; rfl + · intro q hq + rw [rV_val] + simp [show q.val < m by simpa [m] using hq] + · intro q hq + rw [rV_val] + simp [show ¬ q.val < m by simpa [m] using hq] + · refine ⟨rE, ?_, ?_, ?_⟩ + · intro q; rfl + · intro q hq + rw [rE_val] + simp [show q.val < d by simpa [d] using hq] + · intro q hq + rw [rE_val] + simp [show ¬ q.val < d by simpa [d] using hq] + · intro a + refine ⟨⟨a.val, by omega⟩, rfl, ?_⟩ + dsimp [nv] + have hr : rV ⟨a.val, by omega⟩ = ⟨a.val, by omega⟩ := by + apply Fin.ext; rw [rV_val]; simp [show a.val < m by dsimp [m]; omega] + rw [hr, C.base_vertex_position] + · intro a + refine ⟨⟨a.val, by omega⟩, rfl, ?_⟩ + dsimp [ne] + have hr : rE ⟨a.val, by omega⟩ = ⟨a.val, by omega⟩ := by + apply Fin.ext; rw [rE_val]; simp [show a.val < d by dsimp [d]; omega] + rw [hr, C.base_edge_position] + · exact @helper_branch_381 V E inferInstance inferInstance inferInstance G k e0 phi T C i hi hp + hl hn rV_val rE_val hm hd + · have edge_class := @helper_edge_class_455 V E inferInstance inferInstance inferInstance G k e0 + phi + T C i hi hp hl hn rE_val hm hd hfirst nv_inj ne_inj hatt + intro q + exact edge_class q + · intro q + exact ⟨rE q, rfl⟩ + · exact @helper_branch_529 V E inferInstance inferInstance inferInstance G k e0 phi T C i hi hp + hl hn hd hfirst nv_inj ne_inj hatt edge_class_global +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSingleBoundaryCrossing.lean b/LeanPool/GoldbergSeymour/ScheideSingleBoundaryCrossing.lean new file mode 100644 index 0000000000..1c86a46a56 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSingleBoundaryCrossing.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideReplacementFamilyExists +public import LeanPool.GoldbergSeymour.ScheideOriginalDefectiveConfinement +public import LeanPool.GoldbergSeymour.ScheideOriginalNondefectiveConfinement +public import LeanPool.GoldbergSeymour.ScheideReplacementConfinement + +public import LeanPool.GoldbergSeymour.ScheideTwoColorLastExitPath + +/-! +# Scheide Single Boundary Crossing + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideSingleBoundaryCrossing {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) : + ∀ alpha : Fin k, + (∀ v ∈ ScheideEnlargedVertexSet R, alpha ∈ PresentColors G phi v) → + ∃! f : E, f ∈ BoundaryEdges G (ScheideEnlargedVertexSet R) ∧ + Sum.inr f ∈ TwoColorComponent G phi D.alpha0 alpha + (Sum.inl (C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩)) := by + classical + intro alpha hpresent + let L : ScheideLastExitPath G k e0 phi T C D R alpha := + Classical.choice + (ScheideTwoColorLastExitPath G k e0 phi T C D R alpha hpresent) + refine ⟨L.crossing, ⟨L.crossingBoundary, L.crossingComponent⟩, ?_⟩ + intro f hf + by_cases hlast : L.lastInside ∈ TreeSequenceVertexSet T + · by_cases hdef : alpha ∈ DefectiveColors G phi (TreeSequenceVertexSet T) + · exact (ScheideOriginalDefectiveConfinement G k e0 phi T C D R + alpha L hlast hdef).2.2.2 f hf + · exact (ScheideOriginalNondefectiveConfinement G k e0 phi T C D R + alpha L hlast hdef).2 f hf + · obtain ⟨d, _, _, _, _, _, _, hunique⟩ := + ScheideReplacementConfinement G k e0 phi T C D R alpha L hlast + exact hunique f hf + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSmallHeightElementary.lean b/LeanPool/GoldbergSeymour/ScheideSmallHeightElementary.lean new file mode 100644 index 0000000000..15adf87f62 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSmallHeightElementary.lean @@ -0,0 +1,1353 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.Critical +public import LeanPool.GoldbergSeymour.Elementary +public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.GlobalMaximumTripleExists +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideBalancedExists +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd +public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound +public import LeanPool.GoldbergSeymour.ScheideLargeHeightElementary +public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationPreserves +public import LeanPool.GoldbergSeymour.TashkinovOrder +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TrunkRotation +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Small Height Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_300.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (_ e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T), + BalancedGlobalMaximumTriple N → + N.height = (3 : ℕ) → + ∀ (hlength : (6 : ℕ) ≤ T.length), + let v3 : Fin (T.length + (1 : ℕ)) := (⟨(3 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let v4 : Fin (T.length + (1 : ℕ)) := (⟨(4 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), by omega⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), by omega⟩ : Fin T.length); + ∀ (w : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k), + phi (T.edge r2) = some gamma → + gamma ∈ + MissingColors G phi (T.vertex (⟨(↑w : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ)))) → + phi (T.edge r3) = some gamma → + ∀ (a2 : Fin ((↑r2 : ℕ) + (1 : ℕ))), + let a2' : Fin (T.length + (1 : ℕ)) := + a2.castLT (Nat.lt_trans a2.isLt (Nat.succ_lt_succ r2.isLt)); + (↑a2' : ℕ) < (3 : ℕ) → + Incident G (T.vertex v3) (T.edge r2) → + Incident G (T.vertex a2') (T.edge r2) → + (↑a2' : ℕ) ≠ (↑w : ℕ) → + (gamma = N.alpha → (↑w : ℕ) = (0 : ℕ)) → + (gamma = N.beta → (↑w : ℕ) = (1 : ℕ)) → + gamma ≠ N.alpha → + gamma ≠ N.beta → + ∀ (a3 : Fin ((↑r3 : ℕ) + (1 : ℕ))), + let a3' : Fin (T.length + (1 : ℕ)) := + a3.castLT (Nat.lt_trans a3.isLt (Nat.succ_lt_succ r3.isLt)); + (↑a3' : ℕ) < (4 : ℕ) → + Incident G (T.vertex v4) (T.edge r3) → + Incident G (T.vertex a3') (T.edge r3) → + (↑a3' : ℕ) ≠ (3 : ℕ) → + (↑a3' : ℕ) < (3 : ℕ) → + (↑a3' : ℕ) ≠ (↑w : ℕ) → + (↑a2' : ℕ) ≠ (↑a3' : ℕ) → + (↑w : ℕ) = (0 : ℕ) → + ∃ (e : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e) (M : + NormalGlobalMaximumTriple G k e psi S) (hSlen : (6 : ℕ) ≤ S.length), + BalancedGlobalMaximumTriple M ∧ + M.height = (3 : ℕ) ∧ + gamma ∈ + MissingColors G psi + (S.vertex (⟨(0 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) ∧ + psi (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) = some gamma ∧ + psi (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length)) = some gamma ∧ + Incident G (S.vertex (⟨(3 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) ∧ + Incident G (S.vertex (⟨(4 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length)) ∧ + (Incident G (S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) ∧ + Incident G (S.vertex (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length)) ∨ + Incident G (S.vertex (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) ∧ + Incident G (S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length))) := by + classical + intro V E _ _ _ G k e0 e0 phi T N hbalanced hNheight hlength v3 v4 r2 r3 w gamma he2gamma + hwgamma' he3gamma a2 a2' ha2val he2inc_new he2inc_attach ha2_ne_w hw_eq_zero_of_alpha + hw_eq_one_of_beta hgamma_alpha hgamma_beta a3 a3' ha3val he3inc_new he3inc_attach + ha3_ne_three ha3trunk ha3_ne_w ha23_ne hw0 + have hpairs : (a2'.val = 1 ∧ a3'.val = 2) ∨ + (a2'.val = 2 ∧ a3'.val = 1) := by omega + refine ⟨e0, phi, T, N, hlength, hbalanced, hNheight, ?_, + he2gamma, he3gamma, he2inc_new, he3inc_new, ?_⟩ + · have hv : T.vertex ⟨0, by omega⟩ = T.vertex ⟨w.val, by omega⟩ := by + apply congrArg T.vertex + apply Fin.ext + simpa using hw0.symm + rw [hv] + exact hwgamma' + · rcases hpairs with h | h + · left + constructor + · have hv : T.vertex ⟨1, by omega⟩ = T.vertex a2' := by + apply congrArg T.vertex + apply Fin.ext + simpa using h.1.symm + simpa [hv] using he2inc_attach + · have hv : T.vertex ⟨2, by omega⟩ = T.vertex a3' := by + apply congrArg T.vertex + apply Fin.ext + simpa using h.2.symm + simpa [hv] using he3inc_attach + · right + constructor + · have hv : T.vertex ⟨2, by omega⟩ = T.vertex a2' := by + apply congrArg T.vertex + apply Fin.ext + simpa using h.1.symm + simpa [hv] using he2inc_attach + · have hv : T.vertex ⟨1, by omega⟩ = T.vertex a3' := by + apply congrArg T.vertex + apply Fin.ext + simpa using h.2.symm + simpa [hv] using he3inc_attach + +private theorem helper_hback_432.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (3 : ℕ)) + (hlength : (6 : ℕ) ≤ T.length), + let r2 : Fin T.length := (⟨(2 : ℕ), + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + by omega + ⟩ : Fin T.length); + ∀ (w : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k) (hw_bound : (↑w : ℕ) < (3 : ℕ)), ( + ∀ (i : Fin N.height), (1 : ℕ) ≤ (↑i : ℕ) → phi (NormalCycleEdge N i) = if Odd (↑i : ℕ) then + some N.alpha else some N.beta) → + ∀ (_ : Fin ((↑r2 : ℕ) + (1 : ℕ))), gamma ≠ N.alpha → gamma ≠ N.beta → + ∀ (_ : Fin ((↑r3 : ℕ) + (1 : ℕ))) (hwpos : (1 : ℕ) ≤ (↑w : ℕ)), + let j : Fin N.height := (⟨(↑w : ℕ), + by omega + ⟩ : Fin N.height); + ∀ (e1 : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e1) (M : + NormalGlobalMaximumTriple G k e1 psi S), (1 : ℕ) ≤ (↑j : ℕ) → e1 = NormalCycleEdge N j → + psi e1 = none → ( + ∀ (i : Fin (↑j : ℕ)), psi (NormalCycleEdge N (Fin.castLE ((Nat.le_of_lt (j).isLt)) i)) = phi + (NormalCycleEdge N (⟨(↑i : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin N.height))) → ( + ∀ (f : E), ( + ∀ (i : Fin ((↑j : ℕ) + (1 : ℕ))), f ≠ NormalCycleEdge N (Fin.castLE ((Nat.succ_le_iff.mpr + (j).isLt)) i)) → psi f = phi f) → ( + ∃ (pred : Fin N.height), (↑pred : ℕ) = ((↑j : ℕ) + N.height - (1 : ℕ)) % N.height ∧ + M.closingEdge = NormalCycleEdge N pred) → + ∀ (f : E), psi f = some gamma → phi f = some gamma := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hlength r2 r3 w gamma hw_bound hcycle_colors a2 + hgamma_alpha hgamma_beta a3 hwpos j e1 psi S M _ _ _ hshift hfixed hclosing f hf + by_cases hfj : f = NormalCycleEdge N j + · subst f + simp_all + by_cases hs : ∃ i : Fin j.val, + f = NormalCycleEdge N (Fin.castLE (Nat.le_of_lt j.isLt) i) + · obtain ⟨i, hi⟩ := hs + have hqpos : 1 ≤ i.val + 1 := by omega + let q : Fin N.height := ⟨i.val + 1, by + have hi' := i.isLt + have hj' := j.isLt + omega⟩ + have hc := hcycle_colors q hqpos + have hpsi : psi f = phi (NormalCycleEdge N q) := by + rw [hi] + simpa [q] using hshift i + rw [hpsi] at hf + by_cases hodd : Odd q.val + · rw [ite_eq_left hodd] at hc + exact False.elim (hgamma_alpha + (Option.some.inj (hc.symm.trans hf)).symm) + · rw [ite_eq_right hodd] at hc + exact False.elim (hgamma_beta + (Option.some.inj (hc.symm.trans hf)).symm) + · have hfix : psi f = phi f := hfixed f (by + intro i + by_cases hilast : i.val = j.val + · intro heq + apply hfj + rw [heq] + apply congrArg (NormalCycleEdge N) + apply Fin.ext + simpa [j] using hilast + · intro heq + apply hs + let t : Fin j.val := ⟨i.val, by omega⟩ + refine ⟨t, ?_⟩ + rw [heq] + apply congrArg (NormalCycleEdge N) + apply Fin.ext + rfl) + exact hfix ▸ hf + +private theorem helper_htailFixed_522.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (_ e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (3 + : ℕ)) (hlength : (6 : ℕ) ≤ T.length), + let r2 : Fin T.length := (⟨(2 : ℕ), + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + by omega + ⟩ : Fin T.length); + ∀ (w : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k) (hw_bound : (↑w : ℕ) < (3 : ℕ)), ( + ∀ (i : Fin N.height), (1 : ℕ) ≤ (↑i : ℕ) → phi (NormalCycleEdge N i) = if Odd (↑i : ℕ) then + some N.alpha else some N.beta) → + ∀ (_ : Fin ((↑r2 : ℕ) + (1 : ℕ))), gamma ≠ N.alpha → gamma ≠ N.beta → + ∀ (_ : Fin ((↑r3 : ℕ) + (1 : ℕ))) (hwpos : (1 : ℕ) ≤ (↑w : ℕ)), + let j : Fin N.height := (⟨(↑w : ℕ), + by omega + ⟩ : Fin N.height); + ∀ (e1 : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e1) (M : + NormalGlobalMaximumTriple G k e1 psi S), ( + ∀ (f : E), ( + ∀ (i : Fin ((↑j : ℕ) + (1 : ℕ))), f ≠ NormalCycleEdge N (Fin.castLE ((Nat.succ_le_iff.mpr + (j).isLt)) i)) → psi f = phi f) → S.length = T.length → ( + ∃ (pred : Fin N.height), (↑pred : ℕ) = ((↑j : ℕ) + N.height - (1 : ℕ)) % N.height ∧ + M.closingEdge = NormalCycleEdge N pred) → + ∀ (_ _ _ : Fin N.height) (_ _ : Fin (T.length + (1 : ℕ))) (_ _ : Fin T.length) (f : E), phi f + = some gamma → psi f = phi f := by + classical + intro V E _ _ _ G k e0 e0 phi T N hNheight hlength r2 r3 w gamma hw_bound hcycle_colors a2 + hgamma_alpha hgamma_beta a3 hwpos j e1 psi S M hfixed hSlength hclosing iw0 iw1 iw2 ov3 ov4 + oe2 oe3 f hf + apply hfixed + intro i heq + have hi0 : i.val = 0 ∨ 1 ≤ i.val := by omega + rcases hi0 with hi0 | hipos + · have hzero : NormalCycleEdge N + (Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i) = e0 := by + simp [NormalCycleEdge, hi0] + have hnone : phi (NormalCycleEdge N + (Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i)) = none := by + rw [hzero] + exact N.global.1.2.2.2.2.1 + rw [heq] at hf + rw [hnone] at hf + simp at hf + · let q : Fin N.height := + Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i + have hc := hcycle_colors q (by simpa [q] using hipos) + rw [heq] at hf + change phi (NormalCycleEdge N q) = some gamma at hf + by_cases hodd : Odd q.val + · rw [ite_eq_left hodd] at hc + exact hgamma_alpha (Option.some.inj (hc.symm.trans hf)).symm + · rw [ite_eq_right hodd] at hc + exact hgamma_beta (Option.some.inj (hc.symm.trans hf)).symm + +private theorem helper_hattach_581.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (3 : ℕ)) + (hlength : (6 : ℕ) ≤ T.length), + let r2 : Fin T.length := (⟨(2 : ℕ), by omega⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), by omega⟩ : Fin T.length); + ∀ (w : Fin ((↑r2 : ℕ) + (1 : ℕ))) (hw_bound : (↑w : ℕ) < (3 : ℕ)) + (a2 : Fin ((↑r2 : ℕ) + (1 : ℕ))), + let a2' : Fin (T.length + (1 : ℕ)) := + a2.castLT (Nat.lt_trans a2.isLt (Nat.succ_lt_succ r2.isLt)); + Incident G (T.vertex a2') (T.edge r2) → + ∀ (a3 : Fin ((↑r3 : ℕ) + (1 : ℕ))), + let a3' : Fin (T.length + (1 : ℕ)) := + a3.castLT (Nat.lt_trans a3.isLt (Nat.succ_lt_succ r3.isLt)); + Incident G (T.vertex a3') (T.edge r3) → + ∀ (hwpos : (1 : ℕ) ≤ (↑w : ℕ)), + let j : Fin N.height := (⟨(↑w : ℕ), by omega⟩ : Fin N.height); + ∀ (e1 : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e1) + (M : NormalGlobalMaximumTriple G k e1 psi S), + (1 : ℕ) ≤ (↑j : ℕ) → + e1 = NormalCycleEdge N j → + psi e1 = none → + ∀ (hSlength : S.length = T.length) + (hclosing : + ∃ (pred : Fin N.height), + (↑pred : ℕ) = ((↑j : ℕ) + N.height - (1 : ℕ)) % N.height ∧ + M.closingEdge = NormalCycleEdge N pred), + let s1 : Fin (S.length + (1 : ℕ)) := (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let s2 : Fin (S.length + (1 : ℕ)) := (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let t2 : Fin S.length := (⟨(2 : ℕ), by omega⟩ : Fin S.length); + let t3 : Fin S.length := (⟨(3 : ℕ), by omega⟩ : Fin S.length); + ∀ (iw1 : Fin N.height), + S.vertex s1 = T.vertex (Fin.castLE N.height_upper iw1) → + ∀ (iw2 : Fin N.height), + S.vertex s2 = T.vertex (Fin.castLE N.height_upper iw2) → + S.edge t2 = T.edge r2 → + S.edge t3 = T.edge r3 → + (↑a2' : ℕ) = (↑iw1 : ℕ) ∧ (↑a3' : ℕ) = (↑iw2 : ℕ) ∨ + (↑a2' : ℕ) = (↑iw2 : ℕ) ∧ (↑a3' : ℕ) = (↑iw1 : ℕ) → + Incident G (S.vertex s1) (S.edge t2) ∧ Incident G (S.vertex s2) (S.edge t3) ∨ + Incident G (S.vertex s2) (S.edge t2) ∧ Incident G (S.vertex s1) (S.edge t3) := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hlength r2 r3 w hw_bound a2 a2' he2inc_attach a3 a3' + he3inc_attach hwpos j e1 psi S M _ _ _ hSlength hclosing s1 s2 t2 t3 iw1 hs1 iw2 hs2 ht2old + ht3old hpairs + rcases hpairs with h | h + · left + constructor + · rw [ht2old, hs1] + have hv : T.vertex (Fin.castLE N.height_upper iw1) = T.vertex a2' := by + apply congrArg T.vertex + apply Fin.ext + simpa using h.1.symm + rw [hv] + exact he2inc_attach + · rw [ht3old, hs2] + have hv : T.vertex (Fin.castLE N.height_upper iw2) = T.vertex a3' := by + apply congrArg T.vertex + apply Fin.ext + simpa using h.2.symm + rw [hv] + exact he3inc_attach + · right + constructor + · rw [ht2old, hs2] + have hv : T.vertex (Fin.castLE N.height_upper iw2) = T.vertex a2' := by + apply congrArg T.vertex + apply Fin.ext + simpa using h.1.symm + rw [hv] + exact he2inc_attach + · rw [ht3old, hs1] + have hv : T.vertex (Fin.castLE N.height_upper iw1) = T.vertex a3' := by + apply congrArg T.vertex + apply Fin.ext + simpa using h.2.symm + rw [hv] + exact he3inc_attach + +private theorem helper_hgammaOldPsi_662.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (3 : ℕ)) + (hlength : (6 : ℕ) ≤ T.length), + let r2 : Fin T.length := (⟨(2 : ℕ), by omega⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), by omega⟩ : Fin T.length); + ∀ (w : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k) (hw_bound : (↑w : ℕ) < (3 : ℕ)), + gamma ∈ + MissingColors G phi (T.vertex (⟨(↑w : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ)))) → + ∀ (_ : Fin ((↑r2 : ℕ) + (1 : ℕ))) (_ : Fin ((↑r3 : ℕ) + (1 : ℕ))) + (hwpos : (1 : ℕ) ≤ (↑w : ℕ)), + let j : Fin N.height := (⟨(↑w : ℕ), by omega⟩ : Fin N.height); + ∀ (e1 : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e1) + (M : NormalGlobalMaximumTriple G k e1 psi S) (hSlength : S.length = T.length) + (hclosing : + ∃ (pred : Fin N.height), + (↑pred : ℕ) = ((↑j : ℕ) + N.height - (1 : ℕ)) % N.height ∧ + M.closingEdge = NormalCycleEdge N pred), + (∀ (f : E), psi f = some gamma → phi f = some gamma) → + gamma ∈ MissingColors G psi (T.vertex (⟨(↑w : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hlength r2 r3 w gamma hw_bound hwgamma' a2 a3 hwpos j + e1 psi S M hSlength hclosing hback + have hnot : gamma ∉ PresentColors G psi + (T.vertex ⟨w.val, by omega⟩) := by + intro hp + obtain ⟨f, hinc, hf⟩ := by simpa [PresentColors] using hp + have hpold : gamma ∈ PresentColors G phi + (T.vertex ⟨w.val, by omega⟩) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hinc, hback f hf⟩ + have hnold : gamma ∉ PresentColors G phi + (T.vertex ⟨w.val, by omega⟩) := by + simpa [MissingColors] using hwgamma' + exact hnold hpold + simpa [MissingColors] using hnot + +private theorem helper_hpairs_718.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (3 : ℕ)) + (hlength : (6 : ℕ) ≤ T.length), + let r2 : Fin T.length := (⟨(2 : ℕ), + by omega + ⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), + by omega + ⟩ : Fin T.length); + ∀ (w : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k) (hw_bound : (↑w : ℕ) < (3 : ℕ)) (a2 : Fin + ((↑r2 : ℕ) + (1 : ℕ))), + let a2' : Fin (T.length + (1 : ℕ)) := a2.castLT (Nat.lt_trans a2.isLt (Nat.succ_lt_succ + r2.isLt)); (↑a2' : ℕ) < (3 : ℕ) → (↑a2' : ℕ) ≠ (↑w : ℕ) → (gamma = N.alpha → (↑w : ℕ) = (0 + : ℕ)) → (gamma = N.beta → (↑w : ℕ) = (1 : ℕ)) → gamma ≠ N.alpha → gamma ≠ N.beta → + ∀ (a3 : Fin ((↑r3 : ℕ) + (1 : ℕ))), + let a3' : Fin (T.length + (1 : ℕ)) := a3.castLT (Nat.lt_trans a3.isLt (Nat.succ_lt_succ + r3.isLt)); (↑a3' : ℕ) < (4 : ℕ) → (↑a3' : ℕ) ≠ (3 : ℕ) → (↑a3' : ℕ) < (3 : ℕ) → (↑a3' : ℕ) + ≠ (↑w : ℕ) → (↑a2' : ℕ) ≠ (↑a3' : ℕ) → ¬(↑w : ℕ) = (0 : ℕ) → + ∀ (hwpos : (1 : ℕ) ≤ (↑w : ℕ)), + let j : Fin N.height := (⟨(↑w : ℕ), + by omega + ⟩ : Fin N.height); + ∀ (e1 : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e1) (M : + NormalGlobalMaximumTriple G k e1 psi S) (hSlength : S.length = T.length) (hclosing : + ∃ (pred : Fin N.height), (↑pred : ℕ) = ((↑j : ℕ) + N.height - (1 : ℕ)) % N.height ∧ + M.closingEdge = NormalCycleEdge N pred), + let s1 : Fin (S.length + (1 : ℕ)) := (⟨(1 : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + let s2 : Fin (S.length + (1 : ℕ)) := (⟨(2 : ℕ), + by omega + ⟩ : Fin (S.length + (1 : ℕ))); + ∀ (_ iw1 : Fin N.height), (↑iw1 : ℕ) = ((↑j : ℕ) + (↑s1 : ℕ)) % N.height → + ∀ (iw2 : Fin N.height), (↑iw2 : ℕ) = ((↑j : ℕ) + (↑s2 : ℕ)) % N.height → + ∀ (_ _ : Fin (T.length + (1 : ℕ))) (_ _ : Fin T.length), (↑w : ℕ) = (1 : ℕ) ∨ (↑w : ℕ) = (2 : + ℕ) → (↑a2' : ℕ) = (↑iw1 : ℕ) ∧ (↑a3' : ℕ) = (↑iw2 : ℕ) ∨ (↑a2' : ℕ) = (↑iw2 : ℕ) ∧ (↑a3' : + ℕ) = (↑iw1 : ℕ) := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hlength r2 r3 w gamma hw_bound a2 a2' ha2val ha2_ne_w + hw_eq_zero_of_alpha hw_eq_one_of_beta hgamma_alpha hgamma_beta a3 a3' ha3val ha3_ne_three + ha3trunk ha3_ne_w ha23_ne hw0 hwpos j e1 psi S M hSlength hclosing s1 s2 iw0 iw1 hiw1 iw2 + hiw2 ov3 ov4 oe2 oe3 hwcases + rcases hwcases with hw1 | hw2 + · have hi1 : iw1.val = 2 := by + have hi := hiw1 + simp only [hw1, Nat.reduceAdd, hNheight, Nat.mod_succ, j, s1] at hi + exact hi + have hi2 : iw2.val = 0 := by + have hi := hiw2 + simp only [hw1, Nat.reduceAdd, hNheight, Nat.mod_self, j, s2] at hi + exact hi + omega + · have hi1 : iw1.val = 0 := by + have hi := hiw1 + simp only [hw2, Nat.reduceAdd, hNheight, Nat.mod_self, j, s1] at hi + exact hi + have hi2 : iw2.val = 1 := by + have hi := hiw2 + simp only [hw2, Nat.reduceAdd, hNheight, Nat.reduceMod, j, s2] at hi + exact hi + omega + +private theorem helper_branch_335.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (_ e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T), + BalancedGlobalMaximumTriple N → + N.height = (3 : ℕ) → + let _ : DecidableEq V := Classical.decEq V; + ∀ (hlength : (6 : ℕ) ≤ T.length), + let v3 : Fin (T.length + (1 : ℕ)) := (⟨(3 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let v4 : Fin (T.length + (1 : ℕ)) := (⟨(4 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), by omega⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), by omega⟩ : Fin T.length); + ∀ (w : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k), + phi (T.edge r2) = some gamma → + (↑w : ℕ) < (3 : ℕ) → + gamma ∈ + MissingColors G phi (T.vertex (⟨(↑w : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ)))) → + phi (T.edge r3) = some gamma → + (∀ (i : Fin N.height), + (1 : ℕ) ≤ (↑i : ℕ) → + phi (NormalCycleEdge N i) = if Odd (↑i : ℕ) then some N.alpha else some N.beta) → + ∀ (a2 : Fin ((↑r2 : ℕ) + (1 : ℕ))), + let a2' : Fin (T.length + (1 : ℕ)) := + a2.castLT (Nat.lt_trans a2.isLt (Nat.succ_lt_succ r2.isLt)); + (↑a2' : ℕ) < (3 : ℕ) → + Incident G (T.vertex v3) (T.edge r2) → + Incident G (T.vertex a2') (T.edge r2) → + (↑a2' : ℕ) ≠ (↑w : ℕ) → + (gamma = N.alpha → (↑w : ℕ) = (0 : ℕ)) → + (gamma = N.beta → (↑w : ℕ) = (1 : ℕ)) → + gamma ≠ N.alpha → + gamma ≠ N.beta → + ∀ (a3 : Fin ((↑r3 : ℕ) + (1 : ℕ))), + let a3' : Fin (T.length + (1 : ℕ)) := + a3.castLT (Nat.lt_trans a3.isLt (Nat.succ_lt_succ r3.isLt)); + (↑a3' : ℕ) < (4 : ℕ) → + Incident G (T.vertex v4) (T.edge r3) → + Incident G (T.vertex a3') (T.edge r3) → + (↑a3' : ℕ) ≠ (3 : ℕ) → + (↑a3' : ℕ) < (3 : ℕ) → + (↑a3' : ℕ) ≠ (↑w : ℕ) → + (↑a2' : ℕ) ≠ (↑a3' : ℕ) → + ¬(↑w : ℕ) = (0 : ℕ) → + ∃ (e : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e) (M : + NormalGlobalMaximumTriple G k e psi S) (hSlen : (6 : ℕ) ≤ S.length), + BalancedGlobalMaximumTriple M ∧ + M.height = (3 : ℕ) ∧ + gamma ∈ + MissingColors G psi + (S.vertex (⟨(0 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) ∧ + psi (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) = some gamma ∧ + psi (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length)) = some gamma ∧ + Incident G (S.vertex (⟨(3 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) ∧ + Incident G (S.vertex (⟨(4 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length)) ∧ + (Incident G (S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) ∧ + Incident G (S.vertex (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length)) ∨ + Incident G (S.vertex (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) ∧ + Incident G (S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length))) := by + classical + intro V E _ _ _ G k e0 e0 phi T N hbalanced hNheight this hlength v3 v4 r2 r3 w gamma he2gamma + hw_bound hwgamma' he3gamma hcycle_colors a2 a2' ha2val he2inc_new he2inc_attach ha2_ne_w + hw_eq_zero_of_alpha hw_eq_one_of_beta hgamma_alpha hgamma_beta a3 a3' ha3val he3inc_new + he3inc_attach ha3_ne_three ha3trunk ha3_ne_w ha23_ne hw0 + have hwpos : 1 ≤ w.val := by omega + let j : Fin N.height := ⟨w.val, by omega⟩ + obtain ⟨e1, psi, S, M, hrot, hbalM⟩ := + ScheideTrunkRotationPreserves G k e0 phi T N hbalanced j (by + simpa [j] using hwpos) + rcases hrot with ⟨_, _, _, hshift, hfixed, hSlength, hMheight0, + hvertexSet, htrunkVertices, htailVertices, htrunkEdges, + htailEdges, hclosing⟩ + have hMheight : M.height = 3 := hMheight0.trans hNheight + have hSlen : 6 ≤ S.length := by omega + have hback : ∀ f : E, psi f = some gamma → phi f = some gamma := by + exact @helper_hback_432 V E inferInstance inferInstance inferInstance G k e0 phi T N hNheight + hlength w gamma hw_bound hcycle_colors a2 hgamma_alpha hgamma_beta a3 hwpos e1 psi S M + (by assumption) (by assumption) (by assumption) hshift hfixed hclosing + have hgammaOldPsi := @helper_hgammaOldPsi_662 V E inferInstance inferInstance inferInstance G k e0 + phi T N hNheight hlength w gamma hw_bound hwgamma' a2 a3 hwpos e1 psi S M hSlength hclosing + hback + let s0 : Fin (S.length + 1) := ⟨0, by omega⟩ + let s1 : Fin (S.length + 1) := ⟨1, by omega⟩ + let s2 : Fin (S.length + 1) := ⟨2, by omega⟩ + let s3 : Fin (S.length + 1) := ⟨3, by omega⟩ + let s4 : Fin (S.length + 1) := ⟨4, by omega⟩ + let t2 : Fin S.length := ⟨2, by omega⟩ + let t3 : Fin S.length := ⟨3, by omega⟩ + obtain ⟨iw0, hiw0, hs0⟩ := htrunkVertices s0 (by simp [s0, hNheight]) + obtain ⟨iw1, hiw1, hs1⟩ := htrunkVertices s1 (by simp [s1, hNheight]) + obtain ⟨iw2, hiw2, hs2⟩ := htrunkVertices s2 (by simp [s2, hNheight]) + obtain ⟨ov3, hov3, hs3⟩ := htailVertices s3 (by simp [s3, hNheight]) + obtain ⟨ov4, hov4, hs4⟩ := htailVertices s4 (by simp [s4, hNheight]) + obtain ⟨oe2, hoe2, ht2⟩ := htailEdges t2 (by simp [t2, hNheight]) + obtain ⟨oe3, hoe3, ht3⟩ := htailEdges t3 (by simp [t3, hNheight]) + have hs0old : S.vertex s0 = T.vertex ⟨w.val, by omega⟩ := by + rw [hs0] + apply congrArg T.vertex + apply Fin.ext + have hjval : j.val = w.val := rfl + have : iw0.val = w.val := by + have hi := hiw0 + simp only [add_zero, hNheight, Nat.mod_eq_of_lt hw_bound, s0, j] at hi + exact hi + exact this + have hov3eq : ov3 = v3 := by apply Fin.ext; simpa [s3, v3] using hov3 + have hov4eq : ov4 = v4 := by apply Fin.ext; simpa [s4, v4] using hov4 + have hoe2eq : oe2 = r2 := by apply Fin.ext; simpa [t2, r2] using hoe2 + have hoe3eq : oe3 = r3 := by apply Fin.ext; simpa [t3, r3] using hoe3 + have ht2old : S.edge t2 = T.edge r2 := by simpa [hoe2eq] using ht2 + have ht3old : S.edge t3 = T.edge r3 := by simpa [hoe3eq] using ht3 + have hs3old : S.vertex s3 = T.vertex v3 := by simpa [hov3eq] using hs3 + have hs4old : S.vertex s4 = T.vertex v4 := by simpa [hov4eq] using hs4 + have htailFixed := @helper_htailFixed_522 V E inferInstance inferInstance inferInstance G k e0 e0 + phi T N hNheight hlength w gamma hw_bound hcycle_colors a2 hgamma_alpha hgamma_beta a3 hwpos + e1 psi S M hfixed hSlength hclosing iw0 iw1 iw2 ov3 ov4 oe2 oe3 + have ht2color : psi (S.edge t2) = some gamma := by + rw [ht2old, htailFixed (T.edge r2) he2gamma] + exact he2gamma + have ht3color : psi (S.edge t3) = some gamma := by + rw [ht3old, htailFixed (T.edge r3) he3gamma] + exact he3gamma + have hwcases : w.val = 1 ∨ w.val = 2 := by omega + have hpairs := @helper_hpairs_718 V E inferInstance inferInstance inferInstance G k e0 phi T N + hNheight hlength w gamma hw_bound a2 ha2val ha2_ne_w hw_eq_zero_of_alpha hw_eq_one_of_beta + hgamma_alpha hgamma_beta a3 ha3val ha3_ne_three ha3trunk ha3_ne_w ha23_ne hw0 hwpos e1 psi S M + hSlength hclosing iw0 iw1 hiw1 iw2 hiw2 ov3 ov4 oe2 oe3 hwcases + have hout2 : Incident G (S.vertex s3) (S.edge t2) := by + rw [hs3old, ht2old] + exact he2inc_new + have hout3 : Incident G (S.vertex s4) (S.edge t3) := by + rw [hs4old, ht3old] + exact he3inc_new + have hattach : + (Incident G (S.vertex s1) (S.edge t2) ∧ + Incident G (S.vertex s2) (S.edge t3)) ∨ + (Incident G (S.vertex s2) (S.edge t2) ∧ + Incident G (S.vertex s1) (S.edge t3)) := by + exact @helper_hattach_581 V E inferInstance inferInstance inferInstance G k e0 phi T N + hNheight hlength w hw_bound a2 he2inc_attach a3 he3inc_attach hwpos e1 psi S M + (by assumption) (by assumption) (by assumption) hSlength hclosing iw1 hs1 iw2 hs2 ht2old + ht3old hpairs + refine ⟨e1, psi, S, M, hSlen, hbalM, hMheight, ?_, + ht2color, ht3color, hout2, hout3, hattach⟩ + rw [hs0old] + exact hgammaOldPsi + +private theorem helper_hgamma_alpha_773.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (3 : ℕ)) + (hlength : (6 : ℕ) ≤ T.length), + let v1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let v2 : Fin (T.length + (1 : ℕ)) := (⟨(2 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), by omega⟩ : Fin T.length); + ∀ (w : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k), + phi (T.edge r2) = some gamma → + let c1 : Fin N.height := (⟨(1 : ℕ), by omega⟩ : Fin N.height); + phi (NormalCycleEdge N c1) = some N.alpha → + G.ends (NormalCycleEdge N c1) = s(T.vertex v1, T.vertex v2) → + IsProperEdgeColoring G phi → + ∀ (a2 : Fin ((↑r2 : ℕ) + (1 : ℕ))), + let a2' : Fin (T.length + (1 : ℕ)) := + a2.castLT (Nat.lt_trans a2.isLt (Nat.succ_lt_succ r2.isLt)); + (↑a2' : ℕ) < (3 : ℕ) → + Incident G (T.vertex a2') (T.edge r2) → + (↑a2' : ℕ) ≠ (↑w : ℕ) → + (gamma = N.alpha → (↑w : ℕ) = (0 : ℕ)) → + (gamma = N.beta → (↑w : ℕ) = (1 : ℕ)) → + T.edge r2 ≠ NormalCycleEdge N c1 → + gamma ≠ N.alpha := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hlength v1 v2 r2 w gamma he2gamma c1 hc1color hc1ends + hproper a2 a2' ha2val he2inc_attach ha2_ne_w hw_eq_zero_of_alpha hw_eq_one_of_beta + he2_ne_c1 hga + have hw0 := hw_eq_zero_of_alpha hga + have ha : a2'.val = 1 ∨ a2'.val = 2 := by omega + have hinc : Incident G (T.vertex a2') (NormalCycleEdge N c1) := by + rw [Incident, hc1ends] + rcases ha with ha | ha + · have hv : T.vertex a2' = T.vertex v1 := by + apply congrArg T.vertex + apply Fin.ext + simpa [v1] using ha + rw [hv] + simp + · have hv : T.vertex a2' = T.vertex v2 := by + apply congrArg T.vertex + apply Fin.ext + simpa [v2] using ha + rw [hv] + simp + have hadj : AdjacentEdges G (T.edge r2) (NormalCycleEdge N c1) := + ⟨T.vertex a2', he2inc_attach, hinc⟩ + exact (hproper he2_ne_c1 hadj he2gamma) (by simpa [hga] using hc1color) + +private theorem helper_hgamma_beta_795.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (3 : ℕ)) + (hlength : (6 : ℕ) ≤ T.length), + let v0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let v2 : Fin (T.length + (1 : ℕ)) := (⟨(2 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), + by omega + ⟩ : Fin T.length); + ∀ (w : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k), phi (T.edge r2) = some gamma → + let c2 : Fin N.height := (⟨(2 : ℕ), + by omega + ⟩ : Fin N.height); phi (NormalCycleEdge N c2) = some N.beta → G.ends (NormalCycleEdge N c2) = + s(T.vertex v2, T.vertex v0) → IsProperEdgeColoring G phi → + ∀ (a2 : Fin ((↑r2 : ℕ) + (1 : ℕ))), + let a2' : Fin (T.length + (1 : ℕ)) := a2.castLT (Nat.lt_trans a2.isLt (Nat.succ_lt_succ + r2.isLt)); (↑a2' : ℕ) < (3 : ℕ) → Incident G (T.vertex a2') (T.edge r2) → (↑a2' : ℕ) ≠ (↑w + : ℕ) → (gamma = N.alpha → (↑w : ℕ) = (0 : ℕ)) → (gamma = N.beta → (↑w : ℕ) = (1 : ℕ)) → + T.edge r2 ≠ NormalCycleEdge N c2 → gamma ≠ N.alpha → gamma ≠ N.beta := by + classical + intro V E _ _ _ G k e0 phi T N hNheight hlength v0 v2 r2 w gamma he2gamma c2 hc2color hc2ends + hproper a2 a2' ha2val he2inc_attach ha2_ne_w hw_eq_zero_of_alpha hw_eq_one_of_beta + he2_ne_c2 hgamma_alpha hgb + have hw1 := hw_eq_one_of_beta hgb + have ha : a2'.val = 0 ∨ a2'.val = 2 := by omega + have hinc : Incident G (T.vertex a2') (NormalCycleEdge N c2) := by + rw [Incident, hc2ends] + rcases ha with ha | ha + · have hv : T.vertex a2' = T.vertex v0 := by + apply congrArg T.vertex + apply Fin.ext + simpa [v0] using ha + rw [hv] + simp + · have hv : T.vertex a2' = T.vertex v2 := by + apply congrArg T.vertex + apply Fin.ext + simpa [v2] using ha + rw [hv] + simp + have hadj : AdjacentEdges G (T.edge r2) (NormalCycleEdge N c2) := + ⟨T.vertex a2', he2inc_attach, hinc⟩ + exact (hproper he2_ne_c2 hadj he2gamma) (by simpa [hgb] using hc2color) + +private theorem helper_hZsub_1237.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T), + let this : DecidableEq V := Classical.decEq V; + ∀ (hlength : (6 : ℕ) ≤ T.length), + let r2 : Fin T.length := (⟨(2 : ℕ), by omega⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), by omega⟩ : Fin T.length); + ∀ (_ : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k) (_ : Fin ((↑r2 : ℕ) + (1 : ℕ))) + (_ : Fin ((↑r3 : ℕ) + (1 : ℕ))) (e : E) (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) + (hSlen : (6 : ℕ) ≤ S.length) (hMheight : M.height = (3 : ℕ)), + let s0 : Fin (S.length + (1 : ℕ)) := (⟨(0 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let s1 : Fin (S.length + (1 : ℕ)) := (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let s2 : Fin (S.length + (1 : ℕ)) := (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let s3 : Fin (S.length + (1 : ℕ)) := (⟨(3 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let s4 : Fin (S.length + (1 : ℕ)) := (⟨(4 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let t2 : Fin S.length := (⟨(2 : ℕ), by omega⟩ : Fin S.length); + let t3 : Fin S.length := (⟨(3 : ℕ), by omega⟩ : Fin S.length); + let d2 : Fin M.height := (⟨(2 : ℕ), by omega⟩ : Fin M.height); + let q : E := NormalCycleEdge M d2; + ∀ + (p : + (TwoColorIncidenceGraph G psi gamma M.beta).Walk + (Sum.inl + (S.vertex (⟨(0 : ℕ), Nat.zero_lt_succ S.length⟩ : Fin (S.length + (1 : ℕ))))) + (Sum.inl + (S.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ S.positive⟩ : Fin (S.length + (1 : ℕ)))))), + Sum.inl (S.vertex s0) ∈ p.support → + Sum.inl (S.vertex s1) ∈ p.support → + Sum.inl (S.vertex s2) ∈ p.support → + Sum.inl (S.vertex s3) ∈ p.support → + Sum.inl (S.vertex s4) ∈ p.support → + Sum.inr q ∈ p.support → + Sum.inr (S.edge t2) ∈ p.support → + Sum.inr (S.edge t3) ∈ p.support → + let Z : Finset (V ⊕ E) := + {Sum.inl (S.vertex s0), Sum.inl (S.vertex s1), Sum.inl (S.vertex s2), + Sum.inl (S.vertex s3), Sum.inl (S.vertex s4), Sum.inr q, Sum.inr (S.edge t2), + Sum.inr (S.edge t3)}; + Z ⊆ p.support.toFinset := by + classical + intro V E _ _ _ G k e0 phi T N this hlength r2 r3 w gamma a2 a3 e psi S M hSlen hMheight s0 s1 + s2 s3 s4 t2 t3 d2 q p hs0support hs1support hs2support hs3support hs4support hqsupport + he2support he3support Z z hz + simp only [Z, Finset.mem_insert, Finset.mem_singleton] at hz + simp only [List.mem_toFinset] + rcases hz with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl + · exact hs0support + · exact hs1support + · exact hs2support + · exact hs3support + · exact hs4support + · exact hqsupport + · exact he2support + · exact he3support + +private theorem helper_continuation_1212.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (_ : E), + ScheideGraphHeight G = (3 : ℕ) → + ∀ (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T), + let _ : DecidableEq V := Classical.decEq V; + ∀ (hlength : (6 : ℕ) ≤ T.length), + let r2 : Fin T.length := (⟨(2 : ℕ), by omega⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), by omega⟩ : Fin T.length); + ∀ (_ : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k) (_ : Fin ((↑r2 : ℕ) + (1 : ℕ))) + (_ : Fin ((↑r3 : ℕ) + (1 : ℕ))) (e : E) (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) + (hSlen : (6 : ℕ) ≤ S.length) (hMheight : M.height = (3 : ℕ)), + let s0 : Fin (S.length + (1 : ℕ)) := (⟨(0 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let s1 : Fin (S.length + (1 : ℕ)) := (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let s2 : Fin (S.length + (1 : ℕ)) := (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let s3 : Fin (S.length + (1 : ℕ)) := (⟨(3 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let s4 : Fin (S.length + (1 : ℕ)) := (⟨(4 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))); + let t2 : Fin S.length := (⟨(2 : ℕ), by omega⟩ : Fin S.length); + let t3 : Fin S.length := (⟨(3 : ℕ), by omega⟩ : Fin S.length); + gamma ≠ M.beta → + let d2 : Fin M.height := (⟨(2 : ℕ), by omega⟩ : Fin M.height); + let q : E := NormalCycleEdge M d2; + psi q = some M.beta → + psi (S.edge t2) = some gamma → + psi (S.edge t3) = some gamma → + Incident G (S.vertex s3) (S.edge t2) → + Incident G (S.vertex s4) (S.edge t3) → + Incident G (S.vertex s1) (S.edge t2) ∧ Incident G (S.vertex s2) (S.edge t3) ∨ + Incident G (S.vertex s2) (S.edge t2) ∧ Incident G (S.vertex s1) (S.edge t3) → + ∀ + (p : + (TwoColorIncidenceGraph G psi gamma M.beta).Walk + (Sum.inl + (S.vertex (⟨(0 : ℕ), Nat.zero_lt_succ S.length⟩ : Fin (S.length + (1 : ℕ))))) + (Sum.inl + (S.vertex + (⟨(1 : ℕ), Nat.succ_lt_succ S.positive⟩ : Fin (S.length + (1 : ℕ)))))), + p.IsPath → + {x : V ⊕ E | x ∈ p.support} = + TwoColorComponent G psi gamma M.beta + (Sum.inl + (S.vertex (⟨(0 : ℕ), Nat.zero_lt_succ S.length⟩ : Fin (S.length + (1 : ℕ))))) → + (4 : ℕ) ∣ p.length → + p.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi gamma M.beta; + let C : Set (V ⊕ E) := TwoColorComponent G psi gamma M.beta (Sum.inl (S.vertex s0)); + Sum.inl (S.vertex s0) ∈ C → + (∀ {x y : V ⊕ E}, x ∈ C → H.Adj x y → y ∈ C) → + Sum.inr q ∈ C → + Sum.inl (S.vertex s2) ∈ C → + Sum.inl (S.vertex s1) ∈ C → + (∀ (i : Fin (S.length + (1 : ℕ))), + Sum.inl (S.vertex i) ∈ C → + Incident G (S.vertex i) (S.edge t2) → Sum.inr (S.edge t2) ∈ C) → + False := by + classical + intro V E _ _ _ G k e0 hheight e0 phi T N this hlength r2 r3 w gamma a2 a3 e psi S M hSlen + hMheight s0 s1 s2 s3 s4 t2 t3 hgamma_betaM d2 q hqcolor htail2' htail3' hout2' hout3' + hattach' p hp hsupport hdiv hbound H C hrootC hcomp_step hqC hs2C hs1C hedge2_from + have hedge3_from (i : Fin (S.length + 1)) + (hi : Sum.inl (S.vertex i) ∈ C) + (hinc : Incident G (S.vertex i) (S.edge t3)) : + Sum.inr (S.edge t3) ∈ C := by + apply hcomp_step hi + simpa [H, TwoColorIncidenceGraph] using + (show Incident G (S.vertex i) (S.edge t3) ∧ + (psi (S.edge t3) = some gamma ∨ psi (S.edge t3) = some M.beta) from + ⟨hinc, Or.inl htail3'⟩) + have he2C : Sum.inr (S.edge t2) ∈ C := by + rcases hattach' with h | h + · exact hedge2_from s1 hs1C h.1 + · exact hedge2_from s2 hs2C h.1 + have he3C : Sum.inr (S.edge t3) ∈ C := by + rcases hattach' with h | h + · exact hedge3_from s2 hs2C h.2 + · exact hedge3_from s1 hs1C h.2 + have hadje23 : H.Adj (Sum.inr (S.edge t2)) (Sum.inl (S.vertex s3)) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G (S.vertex s3) (S.edge t2) ∧ + (psi (S.edge t2) = some gamma ∨ psi (S.edge t2) = some M.beta) from + ⟨hout2', Or.inl htail2'⟩) + have hadje34 : H.Adj (Sum.inr (S.edge t3)) (Sum.inl (S.vertex s4)) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G (S.vertex s4) (S.edge t3) ∧ + (psi (S.edge t3) = some gamma ∨ psi (S.edge t3) = some M.beta) from + ⟨hout3', Or.inl htail3'⟩) + have hs3C : Sum.inl (S.vertex s3) ∈ C := hcomp_step he2C hadje23 + have hs4C : Sum.inl (S.vertex s4) ∈ C := hcomp_step he3C hadje34 + have hC_support {z : Sum V E} (hz : z ∈ C) : z ∈ p.support := by + have hc : z ∈ TwoColorComponent G psi gamma M.beta + (Sum.inl (S.vertex ⟨0, by omega⟩)) := by + simpa [C, s0] using hz + exact (Set.ext_iff.mp hsupport z).mpr hc + have hs0support : Sum.inl (S.vertex s0) ∈ p.support := hC_support hrootC + have hs1support : Sum.inl (S.vertex s1) ∈ p.support := hC_support hs1C + have hs2support : Sum.inl (S.vertex s2) ∈ p.support := hC_support hs2C + have hs3support : Sum.inl (S.vertex s3) ∈ p.support := hC_support hs3C + have hs4support : Sum.inl (S.vertex s4) ∈ p.support := hC_support hs4C + have hqsupport : Sum.inr q ∈ p.support := hC_support hqC + have he2support : Sum.inr (S.edge t2) ∈ p.support := hC_support he2C + have he3support : Sum.inr (S.edge t3) ∈ p.support := hC_support he3C + have hq_ne_e2 : q ≠ S.edge t2 := by + intro heq + rw [heq, htail2'] at hqcolor + exact hgamma_betaM (Option.some.inj hqcolor) + have hq_ne_e3 : q ≠ S.edge t3 := by + intro heq + rw [heq, htail3'] at hqcolor + exact hgamma_betaM (Option.some.inj hqcolor) + have he23 : S.edge t2 ≠ S.edge t3 := by + intro heq + have hi := S.edge_injective heq + have := congrArg Fin.val hi + simp [t2, t3] at this + let Z : Finset (Sum V E) := + {Sum.inl (S.vertex s0), Sum.inl (S.vertex s1), + Sum.inl (S.vertex s2), Sum.inl (S.vertex s3), + Sum.inl (S.vertex s4), Sum.inr q, + Sum.inr (S.edge t2), Sum.inr (S.edge t3)} + have hZcard : Z.card = 8 := by + simp [Z, S.vertex_injective.eq_iff, hq_ne_e2, hq_ne_e3, he23, + s0, s1, s2, s3, s4, t2, t3] + have hZsub := @helper_hZsub_1237 V E inferInstance inferInstance inferInstance G k e0 phi T N + hlength w gamma a2 a3 e psi S M hSlen hMheight p hs0support hs1support hs2support hs3support + hs4support hqsupport he2support he3support + have hseven : 7 ≤ p.length := by + have hc := Finset.card_le_card hZsub + rw [hZcard, List.toFinset_card_of_nodup hp.support_nodup, + p.length_support] at hc + omega + have height : 8 ≤ p.length := by + rcases hdiv with ⟨d, hd⟩ + omega + have hfive : 5 ≤ p.length / 2 + 1 := by omega + omega + +private theorem helper_continuation_1208.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (_ : E), + ScheideGraphHeight G = (3 : ℕ) → + ∀ (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (_ : NormalGlobalMaximumTriple G k e0 phi T), + let _ : DecidableEq V := Classical.decEq V; + ∀ (hlength : (6 : ℕ) ≤ T.length), + let r2 : Fin T.length := (⟨(2 : ℕ), by omega⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), by omega⟩ : Fin T.length); + ∀ (_ : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k) (_ : Fin ((↑r2 : ℕ) + (1 : ℕ))) + (_ : Fin ((↑r3 : ℕ) + (1 : ℕ))) (e : E) (psi : PartialEdgeColoring E k) + (S : TreeSequence G e) (M : NormalGlobalMaximumTriple G k e psi S) + (hSlen : (6 : ℕ) ≤ S.length), + BalancedGlobalMaximumTriple M → + M.height = (3 : ℕ) → + gamma ∈ + MissingColors G psi (S.vertex (⟨(0 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) → + psi (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) = some gamma → + psi (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length)) = some gamma → + Incident G (S.vertex (⟨(3 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) → + Incident G (S.vertex (⟨(4 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length)) → + Incident G (S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) ∧ + Incident G (S.vertex (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length)) ∨ + Incident G (S.vertex (⟨(2 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(2 : ℕ), by omega⟩ : Fin S.length)) ∧ + Incident G (S.vertex (⟨(1 : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ)))) + (S.edge (⟨(3 : ℕ), by omega⟩ : Fin S.length)) → + False := by + classical + intro V E _ _ _ G k e0 hheight e0 phi T N this hlength r2 r3 w gamma a2 a3 e psi S M hSlen + hbalM hMheight hgamma0 htail2 htail3 hout2 hout3 hattach + let s0 : Fin (S.length + 1) := ⟨0, by omega⟩ + let s1 : Fin (S.length + 1) := ⟨1, by omega⟩ + let s2 : Fin (S.length + 1) := ⟨2, by omega⟩ + let s3 : Fin (S.length + 1) := ⟨3, by omega⟩ + let s4 : Fin (S.length + 1) := ⟨4, by omega⟩ + let t2 : Fin S.length := ⟨2, by omega⟩ + let t3 : Fin S.length := ⟨3, by omega⟩ + have hgamma0' : gamma ∈ MissingColors G psi (S.vertex s0) := by + simpa [s0] using hgamma0 + have hbeta1 : M.beta ∈ MissingColors G psi (S.vertex s1) := by + simpa [s1] using M.beta_missing + have helemS : ColoredVertexSetElementary G psi (TreeSequenceVertexSet S) := + (ScheideGlobalMaximumOrder G k e psi S M.global).2.2.2.1 + have hmemS (i : Fin (S.length + 1)) : + S.vertex i ∈ TreeSequenceVertexSet S := by + simp [TreeSequenceVertexSet] + have hgamma_betaM : gamma ≠ M.beta := by + intro heq + have hne : S.vertex s0 ≠ S.vertex s1 := by + intro hv + have hi := S.vertex_injective hv + have := congrArg Fin.val hi + simp [s0, s1] at this + have hd := helemS (hmemS s0) (hmemS s1) hne + exact (Finset.disjoint_left.mp hd) hgamma0' (by simpa [heq] using hbeta1) + have hcycleM := ScheideTrunkRotationCycle G k e psi S M hbalM + have hcycleMends := hcycleM.2.2.2.1 + have hcycleMcolors := hcycleM.2.2.2.2 + let d2 : Fin M.height := ⟨2, by omega⟩ + let q : E := NormalCycleEdge M d2 + have hqcolor : psi q = some M.beta := by + have hnotodd : ¬ Odd (2 : ℕ) := by + rintro ⟨x, hx⟩ + omega + simpa [q, d2, hnotodd] using hcycleMcolors d2 (by simp [d2]) + have hqends : G.ends q = s(S.vertex s2, S.vertex s0) := by + simpa [q, d2, s2, s0, hMheight] using hcycleMends d2 + have hqinc0 : Incident G (S.vertex s0) q := by + rw [Incident, hqends] + simp + have hqinc2 : Incident G (S.vertex s2) q := by + rw [Incident, hqends] + simp + have htail2' : psi (S.edge t2) = some gamma := by simpa [t2] using htail2 + have htail3' : psi (S.edge t3) = some gamma := by simpa [t3] using htail3 + have hout2' : Incident G (S.vertex s3) (S.edge t2) := by + simpa [s3, t2] using hout2 + have hout3' : Incident G (S.vertex s4) (S.edge t3) := by + simpa [s4, t3] using hout3 + have hattach' : + (Incident G (S.vertex s1) (S.edge t2) ∧ + Incident G (S.vertex s2) (S.edge t3)) ∨ + (Incident G (S.vertex s2) (S.edge t2) ∧ + Incident G (S.vertex s1) (S.edge t3)) := by + simpa [s1, s2, t2, t3] using hattach + obtain ⟨p, hp, hsupport, hdiv, hvertices, hbound⟩ := + ScheideKempePathHeightBound G k e psi S M.global gamma M.beta + hgamma0' hbeta1 + let H := TwoColorIncidenceGraph G psi gamma M.beta + let C := TwoColorComponent G psi gamma M.beta (Sum.inl (S.vertex s0)) + have hrootC : Sum.inl (S.vertex s0) ∈ C := by + change H.connectedComponentMk (Sum.inl (S.vertex s0)) = + H.connectedComponentMk (Sum.inl (S.vertex s0)) + rfl + have hcomp_step {x y : Sum V E} (hx : x ∈ C) (hxy : H.Adj x y) : y ∈ C := by + change H.connectedComponentMk x = H.connectedComponentMk (Sum.inl (S.vertex s0)) at hx + change H.connectedComponentMk y = H.connectedComponentMk (Sum.inl (S.vertex s0)) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hxy).symm.trans hx + have hadj0q : H.Adj (Sum.inl (S.vertex s0)) (Sum.inr q) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G (S.vertex s0) q ∧ + (psi q = some gamma ∨ psi q = some M.beta) from + ⟨hqinc0, Or.inr hqcolor⟩) + have hqC : Sum.inr q ∈ C := hcomp_step hrootC hadj0q + have hadjq2 : H.Adj (Sum.inr q) (Sum.inl (S.vertex s2)) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G (S.vertex s2) q ∧ + (psi q = some gamma ∨ psi q = some M.beta) from + ⟨hqinc2, Or.inr hqcolor⟩) + have hs2C : Sum.inl (S.vertex s2) ∈ C := hcomp_step hqC hadjq2 + have hs1C : Sum.inl (S.vertex s1) ∈ C := by + have hsupp : Sum.inl (S.vertex s1) ∈ p.support := by + have hm := p.getVert_mem_support p.length + rw [p.getVert_length] at hm + simpa [s1] using hm + have hc : Sum.inl (S.vertex s1) ∈ + TwoColorComponent G psi gamma M.beta + (Sum.inl (S.vertex ⟨0, by omega⟩)) := by + rw [← hsupport] + exact hsupp + simpa [C, s0] using hc + have hedge2_from (i : Fin (S.length + 1)) + (hi : Sum.inl (S.vertex i) ∈ C) + (hinc : Incident G (S.vertex i) (S.edge t2)) : + Sum.inr (S.edge t2) ∈ C := by + apply hcomp_step hi + simpa [H, TwoColorIncidenceGraph] using + (show Incident G (S.vertex i) (S.edge t2) ∧ + (psi (S.edge t2) = some gamma ∨ psi (S.edge t2) = some M.beta) from + ⟨hinc, Or.inl htail2'⟩) + exact @helper_continuation_1212 V E inferInstance inferInstance inferInstance G k e0 hheight e0 + phi T N hlength w gamma a2 a3 e psi S M hSlen hMheight hgamma_betaM hqcolor htail2' htail3' + hout2' hout3' hattach' p hp hsupport hdiv hbound hrootC hcomp_step hqC hs2C hs1C hedge2_from +private theorem helper_continuation_1136.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (_ : E), + ScheideGraphHeight G = (3 : ℕ) → + ∀ (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T), + BalancedGlobalMaximumTriple N → + ∀ (hNheight : N.height = (3 : ℕ)), + let _ : DecidableEq V := Classical.decEq V; + ∀ (hlength : (6 : ℕ) ≤ T.length), + let v0 : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let v1 : Fin (T.length + (1 : ℕ)) := (⟨(1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let v2 : Fin (T.length + (1 : ℕ)) := (⟨(2 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let v3 : Fin (T.length + (1 : ℕ)) := (⟨(3 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let _ : Fin (T.length + (1 : ℕ)) := (⟨(4 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), by omega⟩ : Fin T.length); + let r3 : Fin T.length := (⟨(3 : ℕ), by omega⟩ : Fin T.length); + ∀ (w : Fin ((↑r2 : ℕ) + (1 : ℕ))) (gamma : Fin k), + phi (T.edge r2) = some gamma → + (↑w : ℕ) < (3 : ℕ) → + gamma ∈ + MissingColors G phi (T.vertex (⟨(↑w : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ)))) → + phi (T.edge r3) = some gamma → + (∀ (i : Fin N.height), + (1 : ℕ) ≤ (↑i : ℕ) → + phi (NormalCycleEdge N i) = if Odd (↑i : ℕ) then some N.alpha else some N.beta) → + let c1 : Fin N.height := (⟨(1 : ℕ), by omega⟩ : Fin N.height); + let c2 : Fin N.height := (⟨(2 : ℕ), by omega⟩ : Fin N.height); + phi (NormalCycleEdge N c1) = some N.alpha → + phi (NormalCycleEdge N c2) = some N.beta → + G.ends (NormalCycleEdge N c1) = s(T.vertex v1, T.vertex v2) → + G.ends (NormalCycleEdge N c2) = s(T.vertex v2, T.vertex v0) → + IsProperEdgeColoring G phi → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) → + (∀ (i : Fin (T.length + (1 : ℕ))), T.vertex i ∈ TreeSequenceVertexSet T) → + (∀ {c : Fin k} {i : Fin (T.length + (1 : ℕ))}, + c ∈ MissingColors G phi (T.vertex i) → + ∀ {f : E}, Incident G (T.vertex i) f → phi f ≠ some c) → + ∀ (a2 : Fin ((↑r2 : ℕ) + (1 : ℕ))), + let a2' : Fin (T.length + (1 : ℕ)) := + a2.castLT (Nat.lt_trans a2.isLt (Nat.succ_lt_succ r2.isLt)); + (↑a2' : ℕ) < (3 : ℕ) → + G.ends (T.edge r2) = s(T.vertex v3, T.vertex a2') → + Incident G (T.vertex v3) (T.edge r2) → + Incident G (T.vertex a2') (T.edge r2) → + (↑a2' : ℕ) ≠ (↑w : ℕ) → + False := by + classical + intro V E _ _ _ G k e0 hheight e0 phi T N hbalanced hNheight this hlength v0 v1 v2 v3 v4 r2 r3 + w gamma he2gamma hw_bound hwgamma' he3gamma hcycle_colors c1 c2 hc1color hc2color hc1ends + hc2ends hproper helem hvertex_mem hmissing_absent a2 a2' ha2val ha2ends' he2inc_new + he2inc_attach ha2_ne_w + have hw_eq_zero_of_alpha (hga : gamma = N.alpha) : w.val = 0 := by + by_contra hw0 + have hne : T.vertex ⟨w.val, by omega⟩ ≠ T.vertex v0 := by + intro hv + have hi := T.vertex_injective hv + apply hw0 + simpa [v0] using congrArg Fin.val hi + have hd := helem (hvertex_mem ⟨w.val, by omega⟩) (hvertex_mem v0) hne + exact (Finset.disjoint_left.mp hd) hwgamma' (by simpa [hga, v0] using N.alpha_missing) + have hw_eq_one_of_beta (hgb : gamma = N.beta) : w.val = 1 := by + by_contra hw1 + have hne : T.vertex ⟨w.val, by omega⟩ ≠ T.vertex v1 := by + intro hv + have hi := T.vertex_injective hv + apply hw1 + simpa [v1] using congrArg Fin.val hi + have hd := helem (hvertex_mem ⟨w.val, by omega⟩) (hvertex_mem v1) hne + exact (Finset.disjoint_left.mp hd) hwgamma' (by simpa [hgb, v1] using N.beta_missing) + have he2_ne_c1 : T.edge r2 ≠ NormalCycleEdge N c1 := by + intro heq + have hpairs : s(T.vertex v3, T.vertex a2') = s(T.vertex v1, T.vertex v2) := by + rw [← ha2ends', ← hc1ends, heq] + rcases Sym2.eq_iff.mp hpairs with h | h + · have hi := T.vertex_injective h.1 + have := congrArg Fin.val hi + simp [v3, v1] at this + · have hi := T.vertex_injective h.1 + have := congrArg Fin.val hi + simp [v3, v2] at this + have he2_ne_c2 : T.edge r2 ≠ NormalCycleEdge N c2 := by + intro heq + have hpairs : s(T.vertex v3, T.vertex a2') = s(T.vertex v2, T.vertex v0) := by + rw [← ha2ends', ← hc2ends, heq] + rcases Sym2.eq_iff.mp hpairs with h | h + · have hi := T.vertex_injective h.1 + have := congrArg Fin.val hi + simp [v3, v2] at this + · have hi := T.vertex_injective h.1 + have := congrArg Fin.val hi + simp [v3, v0] at this + have hgamma_alpha := @helper_hgamma_alpha_773 V E inferInstance inferInstance inferInstance G k e0 + phi T N hNheight hlength w gamma he2gamma hc1color hc1ends hproper a2 ha2val he2inc_attach + ha2_ne_w hw_eq_zero_of_alpha hw_eq_one_of_beta he2_ne_c1 + have hgamma_beta := @helper_hgamma_beta_795 V E inferInstance inferInstance inferInstance G k e0 + phi T N hNheight hlength w gamma he2gamma hc2color hc2ends hproper a2 ha2val he2inc_attach + ha2_ne_w hw_eq_zero_of_alpha hw_eq_one_of_beta he2_ne_c2 hgamma_alpha + obtain ⟨a3, ha3ends⟩ := T.attaches r3 + let a3' : Fin (T.length + 1) := + Fin.castLT a3 (Nat.lt_trans a3.isLt (Nat.succ_lt_succ r3.isLt)) + have ha3val : a3'.val < 4 := by simp [a3', r3] + have ha3ends' : G.ends (T.edge r3) = s(T.vertex v4, T.vertex a3') := by + simpa [r3, v4, a3'] using ha3ends + have he3inc_new : Incident G (T.vertex v4) (T.edge r3) := by + rw [Incident, ha3ends'] + simp + have he3inc_attach : Incident G (T.vertex a3') (T.edge r3) := by + rw [Incident, ha3ends'] + simp + have he23_ne : T.edge r2 ≠ T.edge r3 := by + intro heq + have hi := T.edge_injective heq + have := congrArg Fin.val hi + simp [r2, r3] at this + have ha3_ne_three : a3'.val ≠ 3 := by + intro ha + have hv : T.vertex a3' = T.vertex v3 := by + apply congrArg T.vertex + apply Fin.ext + simpa [v3] using ha + have hadj : AdjacentEdges G (T.edge r2) (T.edge r3) := + ⟨T.vertex v3, he2inc_new, hv ▸ he3inc_attach⟩ + exact (hproper he23_ne hadj he2gamma) he3gamma + have ha3trunk : a3'.val < 3 := by omega + have ha3_ne_w : a3'.val ≠ w.val := by + intro haw + have hv : T.vertex a3' = T.vertex ⟨w.val, by omega⟩ := by + apply congrArg T.vertex + apply Fin.ext + exact haw + exact hmissing_absent hwgamma' (hv ▸ he3inc_attach) he3gamma + have ha23_ne : a2'.val ≠ a3'.val := by + intro ha + have hv : T.vertex a2' = T.vertex a3' := by + apply congrArg T.vertex + apply Fin.ext + exact ha + have hadj : AdjacentEdges G (T.edge r2) (T.edge r3) := + ⟨T.vertex a2', he2inc_attach, hv ▸ he3inc_attach⟩ + exact (hproper he23_ne hadj he2gamma) he3gamma + obtain ⟨e, psi, S, M, hSlen, hbalM, hMheight, hgamma0, + htail2, htail3, hout2, hout3, hattach⟩ : + ∃ (e : E) (psi : PartialEdgeColoring E k) (S : TreeSequence G e) + (M : NormalGlobalMaximumTriple G k e psi S) (hSlen : 6 ≤ S.length), + BalancedGlobalMaximumTriple M ∧ M.height = 3 ∧ + gamma ∈ MissingColors G psi + (S.vertex ⟨0, by omega⟩) ∧ + psi (S.edge ⟨2, by omega⟩) = some gamma ∧ + psi (S.edge ⟨3, by omega⟩) = some gamma ∧ + Incident G (S.vertex ⟨3, by omega⟩) (S.edge ⟨2, by omega⟩) ∧ + Incident G (S.vertex ⟨4, by omega⟩) (S.edge ⟨3, by omega⟩) ∧ + ((Incident G (S.vertex ⟨1, by omega⟩) (S.edge ⟨2, by omega⟩) ∧ + Incident G (S.vertex ⟨2, by omega⟩) (S.edge ⟨3, by omega⟩)) ∨ + (Incident G (S.vertex ⟨2, by omega⟩) (S.edge ⟨2, by omega⟩) ∧ + Incident G (S.vertex ⟨1, by omega⟩) (S.edge ⟨3, by omega⟩))) := by + by_cases hw0 : w.val = 0 + · exact @helper_branch_300 V E inferInstance inferInstance inferInstance G k e0 e0 phi T N + hbalanced hNheight hlength w gamma he2gamma hwgamma' he3gamma a2 ha2val he2inc_new + he2inc_attach ha2_ne_w hw_eq_zero_of_alpha hw_eq_one_of_beta hgamma_alpha hgamma_beta a3 + ha3val he3inc_new he3inc_attach ha3_ne_three ha3trunk ha3_ne_w ha23_ne hw0 + · exact @helper_branch_335 V E inferInstance inferInstance inferInstance G k e0 e0 phi T N + hbalanced hNheight hlength w gamma he2gamma hw_bound hwgamma' he3gamma hcycle_colors a2 + ha2val he2inc_new he2inc_attach ha2_ne_w hw_eq_zero_of_alpha hw_eq_one_of_beta + hgamma_alpha hgamma_beta a3 ha3val he3inc_new he3inc_attach ha3_ne_three ha3trunk + ha3_ne_w ha23_ne hw0 + exact @helper_continuation_1208 V E inferInstance inferInstance inferInstance G k e0 hheight e0 + phi T N hlength w gamma a2 a3 e psi S M hSlen hbalM hMheight hgamma0 htail2 htail3 hout2 + hout3 hattach +theorem ScheideSmallHeightElementary {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) + (hcritical : Critical G) (hindex : ChromaticIndex G = k + 1) + (hdegree : MaximumDegree G + 1 ≤ k) + (hnoisolated : ∀ v : V, ∃ e : E, Incident G v e) + (hsmall : ScheideGraphHeight G < 5) : + Elementary G := by + classical + obtain ⟨e0, phi0, T0, hglobal0⟩ := + GlobalMaximumTripleExists G k hcritical hindex hdegree + have hheight : ScheideGraphHeight G = 3 := by + have hodd := ScheideGraphHeightOdd G k e0 phi0 T0 hglobal0 + rcases hodd.2 with ⟨m, hm⟩ + omega + obtain ⟨e0, phi, T, N, hbalanced⟩ := + ScheideBalancedExists G k e0 phi0 T0 hglobal0 + have hNheight : N.height = 3 := hbalanced.1.trans hheight + let : DecidableEq V := Classical.decEq V + by_contra hnon + have horder : 7 ≤ TashkinovOrder G := by + have hnlt : ¬ TashkinovOrder G - 4 < ScheideGraphHeight G := by + intro hlt + exact hnon (ScheideLargeHeightElementary G k hcritical hindex hdegree + hnoisolated hlt) + omega + have hcard : (TreeSequenceVertexSet T).card = T.length + 1 := by + unfold TreeSequenceVertexSet + rw [Finset.card_image_of_injective Finset.univ T.vertex_injective] + simp + have hlength : 6 ≤ T.length := by + have hmax := N.global.2.2 + omega + let v0 : Fin (T.length + 1) := ⟨0, by omega⟩ + let v1 : Fin (T.length + 1) := ⟨1, by omega⟩ + let v2 : Fin (T.length + 1) := ⟨2, by omega⟩ + let v3 : Fin (T.length + 1) := ⟨3, by omega⟩ + let v4 : Fin (T.length + 1) := ⟨4, by omega⟩ + let r1 : Fin T.length := ⟨1, by omega⟩ + let r2 : Fin T.length := ⟨2, by omega⟩ + let r3 : Fin T.length := ⟨3, by omega⟩ + have htail : phi (T.edge r2) = phi (T.edge r3) := by + simpa [r2, r3] using hbalanced.2 2 (by omega) (by omega) + obtain ⟨w, gamma, he2gamma, hwgamma⟩ := N.global.2.1 r2 (by simp [r2]) + have hw_bound : w.val < 3 := w.isLt + have hwgamma' : gamma ∈ MissingColors G phi + (T.vertex ⟨w.val, by omega⟩) := by + have hidx : Fin.castLT w + (Nat.lt_trans w.isLt (Nat.succ_lt_succ r2.isLt)) = + (⟨w.val, by omega⟩ : Fin (T.length + 1)) := Fin.ext rfl + rw [← hidx] + exact hwgamma + have he3gamma : phi (T.edge r3) = some gamma := by + rw [← htail] + exact he2gamma + have hcycle := ScheideTrunkRotationCycle G k e0 phi T N hbalanced + have hcycle_ends := hcycle.2.2.2.1 + have hcycle_colors := hcycle.2.2.2.2 + let c1 : Fin N.height := ⟨1, by omega⟩ + let c2 : Fin N.height := ⟨2, by omega⟩ + have hc1color : phi (NormalCycleEdge N c1) = some N.alpha := by + simpa [c1] using hcycle_colors c1 (by simp [c1]) + have hc2color : phi (NormalCycleEdge N c2) = some N.beta := by + have hnotodd : ¬ Odd (2 : ℕ) := by + rintro ⟨x, hx⟩ + omega + simpa [c2, hnotodd] using hcycle_colors c2 (by simp [c2]) + have hc1ends : G.ends (NormalCycleEdge N c1) = + s(T.vertex v1, T.vertex v2) := by + simpa [c1, v1, v2, hNheight] using hcycle_ends c1 + have hc2ends : G.ends (NormalCycleEdge N c2) = + s(T.vertex v2, T.vertex v0) := by + simpa [c2, v2, v0, hNheight] using hcycle_ends c2 + have hproper : IsProperEdgeColoring G phi := N.global.1.2.2.2.1 + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := + (ScheideGlobalMaximumOrder G k e0 phi T N.global).2.2.2.1 + have hvertex_mem (i : Fin (T.length + 1)) : + T.vertex i ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet] + have hmissing_absent {c : Fin k} {i : Fin (T.length + 1)} + (hm : c ∈ MissingColors G phi (T.vertex i)) {f : E} + (hinc : Incident G (T.vertex i) f) : phi f ≠ some c := by + intro hfc + have hp : c ∈ PresentColors G phi (T.vertex i) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hinc, hfc⟩ + have hnp : c ∉ PresentColors G phi (T.vertex i) := by + simpa [MissingColors] using hm + exact hnp hp + obtain ⟨a2, ha2ends⟩ := T.attaches r2 + let a2' : Fin (T.length + 1) := + Fin.castLT a2 (Nat.lt_trans a2.isLt (Nat.succ_lt_succ r2.isLt)) + have ha2val : a2'.val < 3 := by simp [a2', r2] + have ha2ends' : G.ends (T.edge r2) = s(T.vertex v3, T.vertex a2') := by + simpa [r2, v3, a2'] using ha2ends + have he2inc_new : Incident G (T.vertex v3) (T.edge r2) := by + rw [Incident, ha2ends'] + simp + have he2inc_attach : Incident G (T.vertex a2') (T.edge r2) := by + rw [Incident, ha2ends'] + simp + have ha2_ne_w : a2'.val ≠ w.val := by + intro haw + have hv : T.vertex a2' = T.vertex ⟨w.val, by omega⟩ := by + apply congrArg T.vertex + apply Fin.ext + exact haw + exact hmissing_absent hwgamma' (hv ▸ he2inc_attach) he2gamma + exact @helper_continuation_1136 V E inferInstance inferInstance inferInstance G k e0 hheight e0 + phi T N hbalanced hNheight hlength w gamma he2gamma hw_bound hwgamma' he3gamma + hcycle_colors hc1color hc2color hc1ends hc2ends hproper helem hvertex_mem hmissing_absent + a2 ha2val ha2ends' he2inc_new he2inc_attach ha2_ne_w +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralConfiguration.lean b/LeanPool/GoldbergSeymour/ScheideStructuralConfiguration.lean new file mode 100644 index 0000000000..6acd1cb650 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideStructuralConfiguration.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple + +public import LeanPool.GoldbergSeymour.ScheideExitVertices + +/-! +# Scheide Structural Configuration + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- The base and paired blocks of a global maximum tree, with their colors, positions and exit +coverage. +-/ +structure ScheideStructuralConfiguration {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) where + /-- The number of base vertices in the structural decomposition. -/ + p : ℕ + /-- The number of paired structural blocks. -/ + s : ℕ + p_ge_two : 2 ≤ p + /-- The auxiliary color or color family used by this configuration. -/ + gamma : Fin s → Fin k + gamma_injective : Function.Injective gamma + /-- The ordered base vertices. -/ + y : Fin p → V + /-- The ordered edges between the base vertices. -/ + baseEdge : Fin (p - 1) → E + /-- The two vertices in each structural block. -/ + blockVertex : Fin s → Fin 2 → V + /-- The two edges in each structural block. -/ + blockEdge : Fin s → Fin 2 → E + length_eq : T.length + 1 = p + 2 * s + base_vertex_position : ∀ i : Fin p, T.vertex ⟨i.val, by omega⟩ = y i + block_vertex_position : + ∀ (i : Fin s) (j : Fin 2), T.vertex ⟨p + 2 * i.val + j.val, by omega⟩ = blockVertex i j + base_edge_position : ∀ i : Fin (p - 1), T.edge ⟨i.val, by omega⟩ = baseEdge i + block_edge_position : + ∀ (i : Fin s) (j : Fin 2), T.edge ⟨p - 1 + 2 * i.val + j.val, by omega⟩ = blockEdge i j + block_attaches_to_base : + ∀ (i : Fin s) (j : Fin 2), ∃ q : Fin p, G.ends (blockEdge i j) = s(y q, blockVertex i j) + block_color : ∀ (i : Fin s) (j : Fin 2), phi (blockEdge i j) = some (gamma i) + block_color_missing_on_base : ∀ i : Fin s, ∃ q : Fin p, gamma i ∈ MissingColors G phi (y q) + initial_nonfirst_avoids_blocks : + ∀ i : Fin (p - 1), 1 ≤ i.val → ∀ c : Fin k, phi (baseEdge i) = some c → ∀ r : Fin s, c ≠ gamma r + exit_covered : ∀ v ∈ ScheideExitVertices T phi, ∃ i : Fin s, gamma i ∈ MissingColors G phi v + no_isolated : ∀ v : V, ∃ e : E, Incident G v e + globally_maximum : GlobalMaximumTriple G k e0 phi T + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralExitsInBase.lean b/LeanPool/GoldbergSeymour/ScheideStructuralExitsInBase.lean new file mode 100644 index 0000000000..391f13dfa0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideStructuralExitsInBase.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideExitNoFree +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors + +/-! +# Scheide Structural Exits In Base + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideStructuralExitsInBase {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) : + ScheideExitVertices T phi ⊆ Finset.univ.image C.y := by + intro v hv + have hstructure := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have helementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := + hstructure.2.2.2.1 + have hvertex : v ∈ TreeSequenceVertexSet T := by + let : DecidablePred (fun w : V => ScheideExitVertex T phi w) := Classical.decPred _ + have hexit : ScheideExitVertex T phi v := (Finset.mem_filter.mp hv).2 + rcases hexit with ⟨u, color, defect, hu, hmiss, hdefect, z, path, hpath, + index, hindex, hvertex, hafter⟩ + exact hvertex + have base_in_tree : ∀ index : Fin C.p, + C.y index ∈ TreeSequenceVertexSet T := by + intro index + have hlength := C.length_eq + have witness := + (@Finset.mem_image (Fin (T.length + 1)) V (Classical.decEq V)).mpr + (⟨⟨index.val, by omega⟩, Finset.mem_univ _, C.base_vertex_position index⟩ : + ∃ a ∈ (Finset.univ : Finset (Fin (T.length + 1))), T.vertex a = C.y index) + simpa only [TreeSequenceVertexSet] using witness + obtain ⟨index, hcolor⟩ := C.exit_covered v hv + obtain ⟨base, hbase⟩ := C.block_color_missing_on_base index + have hne : v = C.y base := by + by_contra hne + have hdisjoint := helementary hvertex (by + exact base_in_tree base) hne + exact (Finset.disjoint_left.mp hdisjoint) hcolor hbase + have witness : v ∈ Finset.univ.image C.y := + (@Finset.mem_image (Fin C.p) V (inferInstance : DecidableEq V)).mpr + ⟨base, Finset.mem_univ _, hne.symm⟩ + exact witness + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralInternalPair.lean b/LeanPool/GoldbergSeymour/ScheideStructuralInternalPair.lean new file mode 100644 index 0000000000..8d6955041c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideStructuralInternalPair.lean @@ -0,0 +1,2245 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideExitNoFree +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors + +/-! +# Scheide Structural Internal Pair + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_nv_injective_206.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmLast : m + (1 : ℕ) ≤ T.length), + u0 ≠ u1 → + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + Function.Injective rix → + let nv : Fin (T.length + (1 : ℕ)) → V := fun (q : Fin (T.length + (1 : ℕ))) ↦ + if hq : (↑q : ℕ) < T.length - (1 : ℕ) then + T.vertex (rix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (1 : ℕ)))) + else if (↑q : ℕ) = T.length - (1 : ℕ) then u0 else u1; + nv + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))) = + u0 → + nv + (⟨T.length, + Decidable.byContradiction fun (a : ¬T.length < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + u1 → + (∀ (q : Fin (T.length - (1 : ℕ))), T.vertex (rix q) ≠ u0) → + (∀ (q : Fin (T.length - (1 : ℕ))), T.vertex (rix q) ≠ u1) → + Function.Injective nv := by + classical + intro V E _ _ _ G k e0 phi T C i u0 u1 hlength hlenThree m hmLast hu01 rix rix_injective nv + nv_penultimate nv_last retained_ne_u0 retained_ne_u1 q r hqr + by_cases hq : q.val < T.length - 1 + · by_cases hr : r.val < T.length - 1 + · let q' : Fin (T.length - 1) := ⟨q.val, hq⟩ + let r' : Fin (T.length - 1) := ⟨r.val, hr⟩ + have hv : T.vertex (rix q') = T.vertex (rix r') := by + simpa [nv, hq, hr, q', r'] using hqr + have hi := rix_injective (T.vertex_injective hv) + apply Fin.ext + simpa [q', r'] using congrArg Fin.val hi + · have hrval : r.val = T.length - 1 ∨ r.val = T.length := by omega + rcases hrval with hrval | hrval + · have hre : r = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + have hqeq : q = ⟨q.val, by omega⟩ := rfl + rw [hre, nv_penultimate] at hqr + have hnq : nv q = T.vertex (rix ⟨q.val, hq⟩) := by + simp [nv, hq] + exact False.elim (retained_ne_u0 ⟨q.val, hq⟩ (hnq ▸ hqr)) + · have hre : r = ⟨T.length, by omega⟩ := Fin.ext (by omega) + rw [hre, nv_last] at hqr + have hnq : nv q = T.vertex (rix ⟨q.val, hq⟩) := by + simp [nv, hq] + exact False.elim (retained_ne_u1 ⟨q.val, hq⟩ (hnq ▸ hqr)) + · by_cases hr : r.val < T.length - 1 + · have hqval : q.val = T.length - 1 ∨ q.val = T.length := by omega + rcases hqval with hqval | hqval + · have hqe : q = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + rw [hqe, nv_penultimate] at hqr + have hnr : nv r = T.vertex (rix ⟨r.val, hr⟩) := by + simp [nv, hr] + exact False.elim (retained_ne_u0 ⟨r.val, hr⟩ (hnr ▸ hqr.symm)) + · have hqe : q = ⟨T.length, by omega⟩ := Fin.ext (by omega) + rw [hqe, nv_last] at hqr + have hnr : nv r = T.vertex (rix ⟨r.val, hr⟩) := by + simp [nv, hr] + exact False.elim (retained_ne_u1 ⟨r.val, hr⟩ (hnr ▸ hqr.symm)) + · have hqval : q.val = T.length - 1 ∨ q.val = T.length := by omega + have hrval : r.val = T.length - 1 ∨ r.val = T.length := by omega + rcases hqval with hqval | hqval <;> rcases hrval with hrval | hrval + · apply Fin.ext; omega + · exfalso + have hqe : q = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + have hre : r = ⟨T.length, by omega⟩ := Fin.ext (by omega) + exact hu01 (by simpa [hqe, hre, nv_penultimate, nv_last] using hqr) + · exfalso + have hqe : q = ⟨T.length, by omega⟩ := Fin.ext (by omega) + have hre : r = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + exact hu01 (by simpa [hqe, hre, nv_penultimate, nv_last] using hqr.symm) + · apply Fin.ext; omega + +private theorem helper_retained_vertex_index_257.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let X : Finset V := TreeSequenceVertexSet T; + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + (2 : ℕ) ≤ m → + ∀ (hmLast : m + (1 : ℕ) ≤ T.length), + T.vertex + (⟨m, Decidable.byContradiction fun (a : ¬m < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) = + u0 → + T.vertex + (⟨m + (1 : ℕ), + Decidable.byContradiction fun (a : ¬m + (1 : ℕ) < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + u1 → + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + (∀ (q : Fin (T.length - (1 : ℕ))), + (↑(rix q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + let nv : Fin (T.length + (1 : ℕ)) → V := fun (q : Fin (T.length + (1 : ℕ))) ↦ + if hq : (↑q : ℕ) < T.length - (1 : ℕ) then + T.vertex (rix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (1 : ℕ)))) + else if (↑q : ℕ) = T.length - (1 : ℕ) then u0 else u1; + (∀ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + T.vertex (rix q)) → + ∀ {w : V}, + w ∈ X → + w ≠ u0 → + w ≠ u1 → + ∃ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) = + w := by + classical + intro V E _ _ _ G k e0 phi T C i u0 u1 X hlength hlenThree m hmTwo hmLast hu0pos hu1pos rix + rix_val nv nv_retained w hwX' hwu0 hwu1 + have hw : w ∈ TreeSequenceVertexSet T := by simpa only [X] using hwX' + have hw' : ∃ t : Fin (T.length + 1), T.vertex t = w := by + simpa [TreeSequenceVertexSet] using hw + obtain ⟨t, ht⟩ := hw' + have htm : t.val ≠ m := by + intro hval + have he : t = ⟨m, by omega⟩ := Fin.ext (by omega) + exact hwu0 (by simpa [he, hu0pos] using ht.symm) + have htm1 : t.val ≠ m + 1 := by + intro hval + have he : t = ⟨m + 1, by omega⟩ := Fin.ext (by omega) + exact hwu1 (by simpa [he, hu1pos] using ht.symm) + by_cases hbefore : t.val < m + · let q : Fin (T.length - 1) := ⟨t.val, by omega⟩ + refine ⟨q, ?_⟩ + have hrix : rix q = t := by + apply Fin.ext + simp [rix_val, q, hbefore] + simpa [nv_retained, hrix] using ht + · have hafter : m + 2 ≤ t.val := by omega + let q : Fin (T.length - 1) := ⟨t.val - 2, by omega⟩ + refine ⟨q, ?_⟩ + have hqnot : ¬ q.val < m := by dsimp [q]; omega + have hrix : rix q = t := by + apply Fin.ext + rw [rix_val] + simp only [ite_eq_right hqnot] + dsimp [q] + omega + simpa [nv_retained, hrix] using ht + +private theorem helper_later_indices_313.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + (2 : ℕ) ≤ C.p → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (_ : m + (1 : ℕ) ≤ T.length), + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + (∀ (q : Fin (T.length - (1 : ℕ))), + (↑(rix q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + ∀ (q : Fin (T.length - (2 : ℕ))), + m - (1 : ℕ) ≤ (↑q : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑i : ℕ) < (↑r : ℕ) ∧ + (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ) ∧ + (↑(rix + (⟨(↑q : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬(↑q : ℕ) + (1 : ℕ) < T.length - (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length - (1 : ℕ)))) : + ℕ) = + C.p + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ) := by + classical + intro V E _ _ _ G k e0 phi T C i hpTwo hlength hlenThree m hmTwo hmLast rix rix_val eix eix_val + q hq + let d := q.val + 2 - (C.p - 1) + let rn := d / 2 + let jn := d % 2 + have hqLt := q.isLt + have hqTwo : q.val + 2 < T.length := by omega + have hbase : C.p - 1 ≤ q.val + 2 := by dsimp [m] at hq; omega + have hd : q.val + 2 = C.p - 1 + d := by dsimp [d]; omega + have hdecomp : d = 2 * rn + jn := by + dsimp [rn, jn] + omega + have hjn : jn < 2 := by + dsimp [jn] + omega + have hrn : rn < C.s := by + dsimp [rn, d] + omega + let r : Fin C.s := ⟨rn, hrn⟩ + let j : Fin 2 := ⟨jn, hjn⟩ + refine ⟨r, j, ?_, ?_, ?_⟩ + · dsimp [r, rn, d] + omega + · rw [eix_val] + have hnot : ¬ q.val < m - 1 := by omega + simp only [ite_eq_right hnot] + dsimp [r, j] + omega + · rw [rix_val] + have hnot : ¬ q.val + 1 < m := by omega + simp only [ite_eq_right hnot] + dsimp [r, j] + omega + +private theorem helper_retained_not_incident_383.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + (↑i : ℕ) < C.s → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (_ : m + (1 : ℕ) ≤ T.length), + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + m - (1 : ℕ) ≤ (↑q : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑i : ℕ) < (↑r : ℕ) ∧ + (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ) ∧ + (↑(rix + (⟨(↑q : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬(↑q : ℕ) + (1 : ℕ) < T.length - (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length - (1 : ℕ)))) : + ℕ) = + C.p + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ)) → + (∀ (j0 : Fin (2 : ℕ)) (q : Fin (T.length + (1 : ℕ))), + (↑q : ℕ) < m → C.blockVertex i j0 ≠ T.vertex q) → + ∀ (q : Fin (T.length - (2 : ℕ))) (j0 : Fin (2 : ℕ)), + ¬Incident G (C.blockVertex i j0) (T.edge (eix q)) := by + classical + intro V E _ _ _ G k e0 phi T C i hiLt hlength hlenThree m hmTwo hmLast rix eix eix_val + later_indices block_vertex_ne_before q j0 hinc + by_cases hq : q.val < m - 1 + · have heval : (eix q).val = q.val := by simp [eix_val, hq] + obtain ⟨a, ha⟩ := T.attaches (eix q) + rw [Incident, ha] at hinc + simp only [Sym2.mem_iff] at hinc + rcases hinc with hnew | hold + · exact block_vertex_ne_before j0 (eix q).succ (by + dsimp + omega) hnew + · exact block_vertex_ne_before j0 + (Fin.castLT a (Nat.lt_trans a.isLt + (Nat.succ_lt_succ (eix q).isLt))) (by + dsimp + omega) hold + · have hq' : m - 1 ≤ q.val := by omega + obtain ⟨r, j, hri, heix, _⟩ := later_indices q hq' + have hedge : T.edge (eix q) = C.blockEdge r j := by + calc + T.edge (eix q) = + T.edge ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply congrArg T.edge + apply Fin.ext + exact heix + _ = C.blockEdge r j := C.block_edge_position r j + obtain ⟨b, hb⟩ := C.block_attaches_to_base r j + rw [hedge, Incident, hb] at hinc + simp only [Sym2.mem_iff] at hinc + rcases hinc with hbase | hblock + · have hpos := C.block_vertex_position i j0 + have hbpos := C.base_vertex_position b + have hv : T.vertex ⟨C.p + 2 * i.val + j0.val, by omega⟩ = + T.vertex ⟨b.val, by omega⟩ := hpos.trans (hbase.trans hbpos.symm) + have heq := congrArg Fin.val (T.vertex_injective hv) + simp at heq + omega + · have hpos := C.block_vertex_position i j0 + have hrpos := C.block_vertex_position r j + have hv : T.vertex ⟨C.p + 2 * i.val + j0.val, by omega⟩ = + T.vertex ⟨C.p + 2 * r.val + j.val, by omega⟩ := + hpos.trans (hblock.trans hrpos.symm) + have heq := congrArg Fin.val (T.vertex_injective hv) + simp at heq + omega + +private theorem helper_ne_injective_450.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (a0 : E), + Incident G u0 a0 → + ∀ (a1 : E), + Incident G u1 a1 → + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + Function.Injective eix → + (∀ (q : Fin (T.length - (2 : ℕ))) (j0 : Fin (2 : ℕ)), + ¬Incident G (C.blockVertex i j0) (T.edge (eix q))) → + a0 ≠ a1 → + let ne : Fin T.length → E := fun (q : Fin T.length) ↦ + if hq : (↑q : ℕ) < T.length - (2 : ℕ) then + T.edge (eix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (2 : ℕ)))) + else if (↑q : ℕ) = T.length - (2 : ℕ) then a0 else a1; + ne + (⟨T.length - (2 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a0 → + ne + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a1 → + Function.Injective ne := by + classical + intro V E _ _ _ G k e0 phi T C i u0 u1 hlength hlenThree m hmTwo a0 ha0Inc a1 ha1Inc eix + eix_injective retained_not_incident ha01 ne ne_penultimate ne_last q r hqr + by_cases hq : q.val < T.length - 2 + · by_cases hr : r.val < T.length - 2 + · let q' : Fin (T.length - 2) := ⟨q.val, hq⟩ + let r' : Fin (T.length - 2) := ⟨r.val, hr⟩ + have he : T.edge (eix q') = T.edge (eix r') := by + simpa [ne, hq, hr, q', r'] using hqr + have hi := eix_injective (T.edge_injective he) + apply Fin.ext + simpa [q', r'] using congrArg Fin.val hi + · have hrval : r.val = T.length - 2 ∨ r.val = T.length - 1 := by omega + rcases hrval with hrval | hrval + · have hre : r = ⟨T.length - 2, by omega⟩ := Fin.ext (by omega) + rw [hre, ne_penultimate] at hqr + have hnq : ne q = T.edge (eix ⟨q.val, hq⟩) := by + simp [ne, hq] + have heq : T.edge (eix ⟨q.val, hq⟩) = a0 := hnq ▸ hqr + exact False.elim (retained_not_incident ⟨q.val, hq⟩ (0 : Fin 2) + (by simpa [heq] using ha0Inc)) + · have hre : r = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + rw [hre, ne_last] at hqr + have hnq : ne q = T.edge (eix ⟨q.val, hq⟩) := by + simp [ne, hq] + have heq : T.edge (eix ⟨q.val, hq⟩) = a1 := hnq ▸ hqr + exact False.elim (retained_not_incident ⟨q.val, hq⟩ (1 : Fin 2) + (by simpa [heq] using ha1Inc)) + · by_cases hr : r.val < T.length - 2 + · have hqval : q.val = T.length - 2 ∨ q.val = T.length - 1 := by omega + rcases hqval with hqval | hqval + · have hqe : q = ⟨T.length - 2, by omega⟩ := Fin.ext (by omega) + rw [hqe, ne_penultimate] at hqr + have hnr : ne r = T.edge (eix ⟨r.val, hr⟩) := by + simp [ne, hr] + have heq : T.edge (eix ⟨r.val, hr⟩) = a0 := hnr ▸ hqr.symm + exact False.elim (retained_not_incident ⟨r.val, hr⟩ (0 : Fin 2) + (by simpa [heq] using ha0Inc)) + · have hqe : q = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + rw [hqe, ne_last] at hqr + have hnr : ne r = T.edge (eix ⟨r.val, hr⟩) := by + simp [ne, hr] + have heq : T.edge (eix ⟨r.val, hr⟩) = a1 := hnr ▸ hqr.symm + exact False.elim (retained_not_incident ⟨r.val, hr⟩ (1 : Fin 2) + (by simpa [heq] using ha1Inc)) + · have hqval : q.val = T.length - 2 ∨ q.val = T.length - 1 := by omega + have hrval : r.val = T.length - 2 ∨ r.val = T.length - 1 := by omega + rcases hqval with hqval | hqval <;> rcases hrval with hrval | hrval + · apply Fin.ext; omega + · exfalso + have hqe : q = ⟨T.length - 2, by omega⟩ := Fin.ext (by omega) + have hre : r = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + exact ha01 (by simpa [hqe, hre, ne_penultimate, ne_last] using hqr) + · exfalso + have hqe : q = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + have hre : r = ⟨T.length - 2, by omega⟩ := Fin.ext (by omega) + exact ha01 (by simpa [hqe, hre, ne_penultimate, ne_last] using hqr.symm) + · apply Fin.ext; omega + +private theorem helper_branch_593.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + (2 : ℕ) ≤ C.p → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (a0 a1 : E), + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + (∀ (q : Fin (T.length - (1 : ℕ))), + (↑(rix q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + let nv : Fin (T.length + (1 : ℕ)) → V := fun (q : Fin (T.length + (1 : ℕ))) ↦ + if hq : (↑q : ℕ) < T.length - (1 : ℕ) then + T.vertex (rix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (1 : ℕ)))) + else if (↑q : ℕ) = T.length - (1 : ℕ) then u0 else u1; + (∀ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + T.vertex (rix q)) → + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + m - (1 : ℕ) ≤ (↑q : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑i : ℕ) < (↑r : ℕ) ∧ + (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ) ∧ + (↑(rix + (⟨(↑q : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬(↑q : ℕ) + (1 : ℕ) < T.length - (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length - (1 : ℕ)))) : + ℕ) = + C.p + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ)) → + let ne : Fin T.length → E := fun (q : Fin T.length) ↦ + if hq : (↑q : ℕ) < T.length - (2 : ℕ) then + T.edge (eix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (2 : ℕ)))) + else if (↑q : ℕ) = T.length - (2 : ℕ) then a0 else a1; + (∀ (q : Fin (T.length - (2 : ℕ))), + ne + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) = + T.edge (eix q)) → + ∀ (q : Fin T.length), + (↑q : ℕ) < T.length - (2 : ℕ) → + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)))) := by + classical + intro V E _ _ _ G k e0 phi T C i u0 u1 hpTwo hlength hlenThree m hmTwo a0 a1 rix rix_val nv + nv_retained eix eix_val later_indices ne ne_retained q hret + let qr : Fin (T.length - 2) := ⟨q.val, hret⟩ + by_cases hbefore : q.val < m - 1 + · have heixval : (eix qr).val = q.val := by + rw [eix_val] + simp [qr, hbefore] + obtain ⟨a, ha⟩ := T.attaches (eix qr) + let a' : Fin (q.val + 1) := ⟨a.val, by omega⟩ + refine ⟨a', ?_⟩ + have hne : ne q = T.edge (eix qr) := by + simpa [qr] using ne_retained qr + have hnew : nv q.succ = T.vertex (eix qr).succ := by + have hqsucc : q.val + 1 < T.length - 1 := by omega + have hrix : rix ⟨q.val + 1, hqsucc⟩ = (eix qr).succ := by + apply Fin.ext + rw [rix_val] + have hm' : q.val + 1 < m := by omega + simp only [ite_eq_left hm'] + dsimp + omega + have hsuc : q.succ = ⟨q.val + 1, by omega⟩ := Fin.ext rfl + rw [hsuc] + calc + nv ⟨q.val + 1, by omega⟩ = + T.vertex (rix ⟨q.val + 1, hqsucc⟩) := + nv_retained ⟨q.val + 1, hqsucc⟩ + _ = T.vertex (eix qr).succ := congrArg T.vertex hrix + have hold : + nv (Fin.castLT a' + (Nat.lt_trans a'.isLt (Nat.succ_lt_succ q.isLt))) = + T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ (eix qr).isLt))) := by + have haval : a.val < m := by omega + have haNewLt : a'.val < T.length - 1 := by omega + have hcast : + Fin.castLT a' + (Nat.lt_trans a'.isLt (Nat.succ_lt_succ q.isLt)) = + ⟨a'.val, by omega⟩ := Fin.ext rfl + rw [hcast] + calc + nv ⟨a'.val, by omega⟩ = + T.vertex (rix ⟨a'.val, haNewLt⟩) := + nv_retained ⟨a'.val, haNewLt⟩ + _ = T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ (eix qr).isLt))) := by + apply congrArg T.vertex + apply Fin.ext + rw [rix_val] + have ha'val : a'.val < m := by dsimp [a']; exact haval + simp only [ite_eq_left ha'val] + rfl + rw [hne, hnew, hold] + exact ha + · have hafter : m - 1 ≤ q.val := by omega + obtain ⟨r, j, hri, heixval, hrixval⟩ := later_indices qr hafter + obtain ⟨b, hb⟩ := C.block_attaches_to_base r j + let b' : Fin (q.val + 1) := ⟨b.val, by dsimp [m] at hafter; omega⟩ + refine ⟨b', ?_⟩ + have hedge : ne q = C.blockEdge r j := by + rw [show ne q = T.edge (eix qr) by simpa [qr] using ne_retained qr] + calc + T.edge (eix qr) = + T.edge ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply congrArg T.edge + apply Fin.ext + exact heixval + _ = C.blockEdge r j := C.block_edge_position r j + have hnew : nv q.succ = C.blockVertex r j := by + have hqsucc : q.val + 1 < T.length - 1 := by omega + have hrix : rix ⟨q.val + 1, hqsucc⟩ = + ⟨C.p + 2 * r.val + j.val, by omega⟩ := Fin.ext hrixval + have hsuc : q.succ = ⟨q.val + 1, by omega⟩ := Fin.ext rfl + rw [hsuc] + calc + nv ⟨q.val + 1, by omega⟩ = + T.vertex (rix ⟨q.val + 1, hqsucc⟩) := + nv_retained ⟨q.val + 1, hqsucc⟩ + _ = T.vertex ⟨C.p + 2 * r.val + j.val, by omega⟩ := by rw [hrix] + _ = C.blockVertex r j := C.block_vertex_position r j + have hold : + nv (Fin.castLT b' + (Nat.lt_trans b'.isLt (Nat.succ_lt_succ q.isLt))) = C.y b := by + have hbval : b.val < m := by dsimp [m]; omega + have hbNewLt : b'.val < T.length - 1 := by omega + have hcast : + Fin.castLT b' + (Nat.lt_trans b'.isLt (Nat.succ_lt_succ q.isLt)) = + ⟨b'.val, by omega⟩ := Fin.ext rfl + rw [hcast] + have hrix : rix ⟨b'.val, by omega⟩ = + ⟨b.val, by omega⟩ := by + apply Fin.ext + rw [rix_val] + have hb'val : b'.val < m := by dsimp [b']; exact hbval + simp only [ite_eq_left hb'val] + rfl + calc + nv ⟨b'.val, by omega⟩ = + T.vertex (rix ⟨b'.val, hbNewLt⟩) := + nv_retained ⟨b'.val, hbNewLt⟩ + _ = T.vertex ⟨b.val, by omega⟩ := by rw [hrix] + _ = C.y b := C.base_vertex_position b + rw [hedge, hnew, hold] + exact hb.trans Sym2.eq_swap + +private theorem helper_branch_696.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let X : Finset V := TreeSequenceVertexSet T; + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (a0 a1 : E) (w0 : V), + G.ends a0 = s(u0, w0) → + ∀ (w1 : V), + G.ends a1 = s(u1, w1) → + w0 ≠ u0 → + w1 ≠ u1 → + w0 ∈ X → + w1 ∈ X → + ¬w0 = u1 → + w1 ≠ u0 → + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let nv : Fin (T.length + (1 : ℕ)) → V := fun (q : Fin (T.length + (1 : ℕ))) ↦ + if hq : (↑q : ℕ) < T.length - (1 : ℕ) then + T.vertex (rix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (1 : ℕ)))) + else if (↑q : ℕ) = T.length - (1 : ℕ) then u0 else u1; + nv + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))) = + u0 → + nv + (⟨T.length, + Decidable.byContradiction fun (a : ¬T.length < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + u1 → + (∀ {w : V}, + w ∈ X → + w ≠ u0 → + w ≠ u1 → + ∃ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))) = + w) → + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let ne : Fin T.length → E := fun (q : Fin T.length) ↦ + if hq : (↑q : ℕ) < T.length - (2 : ℕ) then + T.edge (eix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (2 : ℕ)))) + else if (↑q : ℕ) = T.length - (2 : ℕ) then a0 else a1; + ne + (⟨T.length - (2 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a0 → + ne + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a1 → + ∀ (q : Fin T.length), + ¬(↑q : ℕ) < T.length - (2 : ℕ) → + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)))) := by + classical + intro V E _ _ _ G k e0 phi T C i u0 u1 X hlength hlenThree m hmTwo a0 a1 w0 ha0Ends w1 ha1Ends + hw0ne hw1ne hw0X hw1X hw0u1 hw1u0 rix nv nv_penultimate nv_last retained_vertex_index eix + ne ne_penultimate ne_last q hret + have hlast : q.val = T.length - 2 ∨ q.val = T.length - 1 := by omega + rcases hlast with hq | hq + · obtain ⟨a, ha⟩ := retained_vertex_index hw0X hw0ne hw0u1 + let a' : Fin (q.val + 1) := ⟨a.val, by omega⟩ + refine ⟨a', ?_⟩ + have hqe : q = ⟨T.length - 2, by omega⟩ := Fin.ext (by omega) + have haCast : + (Fin.castLT a' + (Nat.lt_trans a'.isLt (Nat.succ_lt_succ q.isLt))) = + ⟨a.val, by omega⟩ := Fin.ext rfl + have hedge : ne q = a0 := (congrArg ne hqe).trans ne_penultimate + have hsuc : q.succ = ⟨T.length - 1, by omega⟩ := by + apply Fin.ext + change q.val + 1 = T.length - 1 + omega + have hnew : nv q.succ = u0 := by rw [hsuc]; exact nv_penultimate + have hold : nv (Fin.castLT a' + (Nat.lt_trans a'.isLt (Nat.succ_lt_succ q.isLt))) = w0 := by + rw [haCast] + exact ha + rw [hedge, hnew, hold] + exact ha0Ends + · obtain ⟨a, ha⟩ := retained_vertex_index hw1X hw1u0 hw1ne + let a' : Fin (q.val + 1) := ⟨a.val, by omega⟩ + refine ⟨a', ?_⟩ + have hqe : q = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + have haCast : + (Fin.castLT a' + (Nat.lt_trans a'.isLt (Nat.succ_lt_succ q.isLt))) = + ⟨a.val, by omega⟩ := Fin.ext rfl + have hedge : ne q = a1 := (congrArg ne hqe).trans ne_last + have hsuc : q.succ = ⟨T.length, by omega⟩ := by + apply Fin.ext + change q.val + 1 = T.length + omega + have hnew : nv q.succ = u1 := by rw [hsuc]; exact nv_last + have hold : nv (Fin.castLT a' + (Nat.lt_trans a'.isLt (Nat.succ_lt_succ q.isLt))) = w1 := by + rw [haCast] + exact ha + rw [hedge, hnew, hold] + exact ha1Ends + +private theorem helper_hattaches_522.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let X : Finset V := TreeSequenceVertexSet T; + (2 : ℕ) ≤ C.p → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (_ : m + (1 : ℕ) ≤ T.length) (a0 a1 : E) (w0 : V), + G.ends a0 = s(u0, w0) → + ∀ (w1 : V), + G.ends a1 = s(u1, w1) → + w0 ≠ u0 → + w1 ≠ u1 → + w0 ∈ X → + w1 ∈ X → + ¬w0 = u1 → + w1 ≠ u0 → + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + (∀ (q : Fin (T.length - (1 : ℕ))), + (↑(rix q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + let nv : Fin (T.length + (1 : ℕ)) → V := fun (q : Fin (T.length + (1 : ℕ))) ↦ + if hq : (↑q : ℕ) < T.length - (1 : ℕ) then + T.vertex (rix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (1 : ℕ)))) + else if (↑q : ℕ) = T.length - (1 : ℕ) then u0 else u1; + (∀ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + T.vertex (rix q)) → + nv + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))) = + u0 → + nv + (⟨T.length, + Decidable.byContradiction fun (a : ¬T.length < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + u1 → + (∀ {w : V}, + w ∈ X → + w ≠ u0 → + w ≠ u1 → + ∃ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))) = + w) → + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + m - (1 : ℕ) ≤ (↑q : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑i : ℕ) < (↑r : ℕ) ∧ + (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ) ∧ + (↑(rix + (⟨(↑q : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬(↑q : ℕ) + (1 : ℕ) < T.length - (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length - (1 : ℕ)))) : + ℕ) = + C.p + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ)) → + let ne : Fin T.length → E := fun (q : Fin T.length) ↦ + if hq : (↑q : ℕ) < T.length - (2 : ℕ) then + T.edge (eix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (2 : ℕ)))) + else if (↑q : ℕ) = T.length - (2 : ℕ) then a0 else a1; + (∀ (q : Fin (T.length - (2 : ℕ))), + ne + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) = + T.edge (eix q)) → + ne + (⟨T.length - (2 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a0 → + ne + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a1 → + ∀ (q : Fin T.length), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)))) := by + classical + intro V E _ _ _ G k e0 phi T C i u0 u1 X hpTwo hlength hlenThree m hmTwo hmLast a0 a1 w0 + ha0Ends w1 ha1Ends hw0ne hw1ne hw0X hw1X hw0u1 hw1u0 rix rix_val nv nv_retained + nv_penultimate nv_last retained_vertex_index eix eix_val later_indices ne ne_retained + ne_penultimate ne_last q + by_cases hret : q.val < T.length - 2 + · exact @helper_branch_593 V E inferInstance inferInstance inferInstance G k e0 phi T C i hpTwo + hlength hlenThree hmTwo a0 a1 rix_val nv_retained eix_val later_indices ne_retained q hret + · exact @helper_branch_696 V E inferInstance inferInstance inferInstance G k e0 phi T C i + hlength hlenThree hmTwo a0 a1 w0 ha0Ends w1 ha1Ends hw0ne hw1ne hw0X hw1X hw0u1 hw1u0 + nv_penultimate nv_last retained_vertex_index ne_penultimate ne_last q hret +private theorem helper_branch_862.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + (2 : ℕ) ≤ C.p → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (a0 a1 : E), + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + (∀ (q : Fin (T.length - (1 : ℕ))), + (↑(rix q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + let nv : Fin (T.length + (1 : ℕ)) → V := fun (q : Fin (T.length + (1 : ℕ))) ↦ + if hq : (↑q : ℕ) < T.length - (1 : ℕ) then + T.vertex (rix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (1 : ℕ)))) + else if (↑q : ℕ) = T.length - (1 : ℕ) then u0 else u1; + (∀ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + T.vertex (rix q)) → + ∀ (nv_injective : Function.Injective nv), + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + m - (1 : ℕ) ≤ (↑q : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑i : ℕ) < (↑r : ℕ) ∧ + (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ) ∧ + (↑(rix + (⟨(↑q : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬(↑q : ℕ) + (1 : ℕ) < T.length - (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length - (1 : ℕ)))) : + ℕ) = + C.p + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ)) → + let ne : Fin T.length → E := fun (q : Fin T.length) ↦ + if hq : (↑q : ℕ) < T.length - (2 : ℕ) then + T.edge (eix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (2 : ℕ)))) + else if (↑q : ℕ) = T.length - (2 : ℕ) then a0 else a1; + (∀ (q : Fin (T.length - (2 : ℕ))), + ne + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) = + T.edge (eix q)) → + ∀ (ne_injective : Function.Injective ne) + (hfirst : ne (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = e0) + (hattaches : + ∀ (q : Fin T.length), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), + let T' : TreeSequence G e0 := + { length := T.length, positive := T.positive, vertex := nv, edge := ne, + vertex_injective := nv_injective, edge_injective := ne_injective, + first_edge := hfirst, attaches := hattaches : TreeSequence G e0 }; + ∀ (q : Fin T'.length), + (1 : ℕ) ≤ (↑q : ℕ) → + (↑q : ℕ) < T.length → + (↑q : ℕ) < T.length - (2 : ℕ) → + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))) (c : Fin k), + phi (ne q) = some c ∧ + c ∈ + MissingColors G phi (nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)))) := by + classical + intro V E _ _ _ G k e0 phi T C i u0 u1 hpTwo hlength hlenThree m hmTwo a0 a1 rix rix_val nv + nv_retained nv_injective eix eix_val later_indices ne ne_retained ne_injective hfirst + hattaches T' q hqpos hqLt hret + let qr : Fin (T.length - 2) := ⟨q.val, hret⟩ + by_cases hbefore : q.val < m - 1 + · have heixval : (eix qr).val = q.val := by + rw [eix_val] + simp [qr, hbefore] + obtain ⟨a, c, hc, hm⟩ := C.globally_maximum.2.1 (eix qr) (by omega) + let a' : Fin (q.val + 1) := ⟨a.val, by omega⟩ + refine ⟨a', c, ?_, ?_⟩ + · rw [show ne q = T.edge (eix qr) by simpa [qr] using ne_retained qr] + exact hc + · have haval : a.val < m := by omega + have haNewLt : a'.val < T.length - 1 := by omega + have hcast : + Fin.castLT a' + (Nat.lt_trans a'.isLt (Nat.succ_lt_succ q.isLt)) = + ⟨a'.val, by omega⟩ := Fin.ext rfl + rw [hcast] + have hrix : rix ⟨a'.val, haNewLt⟩ = + Fin.castLT a + (Nat.lt_trans a.isLt + (Nat.succ_lt_succ (eix qr).isLt)) := by + apply Fin.ext + rw [rix_val] + have ha'val : a'.val < m := by dsimp [a']; exact haval + simp only [ite_eq_left ha'val] + rfl + have hnv : nv ⟨a'.val, by omega⟩ = + T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt + (Nat.succ_lt_succ (eix qr).isLt))) := by + calc + nv ⟨a'.val, by omega⟩ = + T.vertex (rix ⟨a'.val, haNewLt⟩) := + nv_retained ⟨a'.val, haNewLt⟩ + _ = _ := congrArg T.vertex hrix + rw [hnv] + exact hm + · have hafter : m - 1 ≤ q.val := by omega + obtain ⟨r, j, hri, heixval, _⟩ := later_indices qr hafter + obtain ⟨b, hb⟩ := C.block_color_missing_on_base r + let b' : Fin (q.val + 1) := ⟨b.val, by dsimp [m] at hafter; omega⟩ + refine ⟨b', C.gamma r, ?_, ?_⟩ + · rw [show ne q = T.edge (eix qr) by simpa [qr] using ne_retained qr] + have hedge : T.edge (eix qr) = C.blockEdge r j := by + calc + T.edge (eix qr) = + T.edge ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply congrArg T.edge + apply Fin.ext + exact heixval + _ = C.blockEdge r j := C.block_edge_position r j + rw [hedge] + exact C.block_color r j + · have hbval : b.val < m := by dsimp [m]; omega + have hbNewLt : b'.val < T.length - 1 := by omega + have hcast : + Fin.castLT b' + (Nat.lt_trans b'.isLt (Nat.succ_lt_succ q.isLt)) = + ⟨b'.val, by omega⟩ := Fin.ext rfl + have hrix : rix ⟨b'.val, hbNewLt⟩ = ⟨b.val, by omega⟩ := by + apply Fin.ext + rw [rix_val] + have hb'val : b'.val < m := by dsimp [b']; exact hbval + simp only [ite_eq_left hb'val] + rfl + have hnv : nv (Fin.castLT b' + (Nat.lt_trans b'.isLt (Nat.succ_lt_succ q.isLt))) = C.y b := by + rw [hcast] + calc + nv ⟨b'.val, by omega⟩ = + T.vertex (rix ⟨b'.val, hbNewLt⟩) := + nv_retained ⟨b'.val, hbNewLt⟩ + _ = T.vertex ⟨b.val, by omega⟩ := by rw [hrix] + _ = C.y b := C.base_vertex_position b + rw [hnv] + exact hb + +private theorem helper_htash_685.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (alpha : Fin k) (z : V), + alpha ∈ MissingColors G phi z → + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let X : Finset V := TreeSequenceVertexSet T; + z ∈ X → + (2 : ℕ) ≤ C.p → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (_ : m + (1 : ℕ) ≤ T.length), + z ≠ u0 → + z ≠ u1 → + ∀ (a0 : E), + phi a0 = some alpha → + ∀ (a1 : E), + phi a1 = some alpha → + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + (∀ (q : Fin (T.length - (1 : ℕ))), + (↑(rix q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + let nv : Fin (T.length + (1 : ℕ)) → V := fun (q : Fin (T.length + (1 : ℕ))) ↦ + if hq : (↑q : ℕ) < T.length - (1 : ℕ) then + T.vertex (rix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (1 : ℕ)))) + else if (↑q : ℕ) = T.length - (1 : ℕ) then u0 else u1; + (∀ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + T.vertex (rix q)) → + ∀ (nv_injective : Function.Injective nv), + (∀ {w : V}, + w ∈ X → + w ≠ u0 → + w ≠ u1 → + ∃ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))) = + w) → + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + m - (1 : ℕ) ≤ (↑q : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑i : ℕ) < (↑r : ℕ) ∧ + (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ) ∧ + (↑(rix + (⟨(↑q : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬(↑q : ℕ) + (1 : ℕ) < T.length - (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length - (1 : ℕ)))) : + ℕ) = + C.p + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ)) → + let ne : Fin T.length → E := fun (q : Fin T.length) ↦ + if hq : (↑q : ℕ) < T.length - (2 : ℕ) then + T.edge (eix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (2 : ℕ)))) + else if (↑q : ℕ) = T.length - (2 : ℕ) then a0 else a1; + (∀ (q : Fin (T.length - (2 : ℕ))), + ne + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) = + T.edge (eix q)) → + ne + (⟨T.length - (2 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a0 → + ne + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a1 → + ∀ (ne_injective : Function.Injective ne) + (hfirst : ne (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = e0) + (hattaches : + ∀ (q : Fin T.length), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), + let T' : TreeSequence G e0 := + { length := T.length, positive := T.positive, vertex := nv, edge := ne, + vertex_injective := nv_injective, edge_injective := ne_injective, + first_edge := hfirst, attaches := hattaches : TreeSequence G e0 }; + TashkinovTree G e0 phi T' := by + classical + intro V E _ _ _ G k e0 phi T C i alpha z hzMissing u0 u1 X hzX hpTwo hlength hlenThree m hmTwo + hmLast hzu0 hzu1 a0 ha0Color a1 ha1Color rix rix_val nv nv_retained nv_injective + retained_vertex_index eix eix_val later_indices ne ne_retained ne_penultimate ne_last + ne_injective hfirst hattaches T' q hqpos + have hqLt : q.val < T.length := by simp [T'] + change ∃ a : Fin (q.val + 1), ∃ c : Fin k, + phi (ne q) = some c ∧ + c ∈ MissingColors G phi + (nv (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)))) + by_cases hret : q.val < T.length - 2 + · exact @helper_branch_862 V E inferInstance inferInstance inferInstance G k e0 phi T C i hpTwo + hlength hlenThree hmTwo a0 a1 rix_val nv_retained nv_injective eix_val later_indices + ne_retained ne_injective hfirst hattaches q hqpos hqLt hret + · have hlast : q.val = T.length - 2 ∨ q.val = T.length - 1 := by omega + obtain ⟨a, ha⟩ := retained_vertex_index hzX hzu0 hzu1 + let a' : Fin (q.val + 1) := ⟨a.val, by rcases hlast with h | h <;> omega⟩ + refine ⟨a', alpha, ?_, ?_⟩ + · rcases hlast with hq | hq + · have hqe : q = ⟨T.length - 2, by omega⟩ := Fin.ext (by omega) + exact (congrArg (fun e => phi e) ((congrArg ne hqe).trans ne_penultimate)).trans + ha0Color + · have hqe : q = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + exact (congrArg (fun e => phi e) ((congrArg ne hqe).trans ne_last)).trans + ha1Color + · have hcast : + Fin.castLT a' + (Nat.lt_trans a'.isLt (Nat.succ_lt_succ q.isLt)) = + ⟨a.val, by omega⟩ := Fin.ext rfl + rw [hcast, ha] + exact hzMissing + +private theorem helper_hvertexSet_788.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let X : Finset V := TreeSequenceVertexSet T; + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (_ : m + (1 : ℕ) ≤ T.length), + u0 ∈ X → + u1 ∈ X → + ∀ (a0 a1 : E), + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let nv : Fin (T.length + (1 : ℕ)) → V := fun (q : Fin (T.length + (1 : ℕ))) ↦ + if hq : (↑q : ℕ) < T.length - (1 : ℕ) then + T.vertex (rix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (1 : ℕ)))) + else if (↑q : ℕ) = T.length - (1 : ℕ) then u0 else u1; + (∀ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + T.vertex (rix q)) → + nv + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))) = + u0 → + nv + (⟨T.length, + Decidable.byContradiction fun (a : ¬T.length < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + u1 → + ∀ (nv_injective : Function.Injective nv), + (∀ {w : V}, + w ∈ X → + w ≠ u0 → + w ≠ u1 → + ∃ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))) = + w) → + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let ne : Fin T.length → E := fun (q : Fin T.length) ↦ + if hq : (↑q : ℕ) < T.length - (2 : ℕ) then + T.edge (eix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (2 : ℕ)))) + else if (↑q : ℕ) = T.length - (2 : ℕ) then a0 else a1; + ∀ (ne_injective : Function.Injective ne) + (hfirst : ne (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = e0) + (hattaches : + ∀ (q : Fin T.length), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), + let T' : TreeSequence G e0 := + { length := T.length, positive := T.positive, vertex := nv, edge := ne, + vertex_injective := nv_injective, edge_injective := ne_injective, + first_edge := hfirst, attaches := hattaches : TreeSequence G e0 }; + TreeSequenceVertexSet T' = X := by + classical + intro V E _ _ _ G k e0 phi T C i u0 u1 X hlength hlenThree m hmTwo hmLast hu0X hu1X a0 a1 rix + nv nv_retained nv_penultimate nv_last nv_injective retained_vertex_index eix ne + ne_injective hfirst hattaches T' + ext w + constructor + · intro hw + have hw' : ∃ q : Fin (T.length + 1), nv q = w := by + simpa [TreeSequenceVertexSet, T'] using hw + obtain ⟨q, hq⟩ := hw' + by_cases hret : q.val < T.length - 1 + · let qr : Fin (T.length - 1) := ⟨q.val, hret⟩ + have hnv : nv q = T.vertex (rix qr) := by + have he : q = ⟨qr.val, by omega⟩ := Fin.ext rfl + rw [he] + exact nv_retained qr + rw [hnv] at hq + rw [← hq] + simp [X, TreeSequenceVertexSet] + · have hlast : q.val = T.length - 1 ∨ q.val = T.length := by omega + rcases hlast with hlast | hlast + · have he : q = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + have : w = u0 := by simpa [he, nv_penultimate] using hq.symm + simpa [this] using hu0X + · have he : q = ⟨T.length, by omega⟩ := Fin.ext (by omega) + have : w = u1 := by simpa [he, nv_last] using hq.symm + simpa [this] using hu1X + · intro hw + by_cases hwu0 : w = u0 + · subst w + have hw' : ∃ q : Fin (T.length + 1), nv q = u0 := + ⟨⟨T.length - 1, by omega⟩, nv_penultimate⟩ + simpa [TreeSequenceVertexSet, T'] using hw' + · by_cases hwu1 : w = u1 + · subst w + have hw' : ∃ q : Fin (T.length + 1), nv q = u1 := + ⟨⟨T.length, by omega⟩, nv_last⟩ + simpa [TreeSequenceVertexSet, T'] using hw' + · obtain ⟨q, hq⟩ := retained_vertex_index hw hwu0 hwu1 + have hw' : ∃ r : Fin (T.length + 1), nv r = w := + ⟨⟨q.val, by omega⟩, hq⟩ + simpa [TreeSequenceVertexSet, T'] using hw' + +private theorem helper_hgammaUnused_842.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (alpha : Fin k), + alpha ≠ C.gamma i → + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (_ : m + (1 : ℕ) ≤ T.length) (a0 : E), + phi a0 = some alpha → + ∀ (a1 : E), + phi a1 = some alpha → + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let nv : Fin (T.length + (1 : ℕ)) → V := fun (q : Fin (T.length + (1 : ℕ))) ↦ + if hq : (↑q : ℕ) < T.length - (1 : ℕ) then + T.vertex (rix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (1 : ℕ)))) + else if (↑q : ℕ) = T.length - (1 : ℕ) then u0 else u1; + ∀ (nv_injective : Function.Injective nv), + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + m - (1 : ℕ) ≤ (↑q : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑i : ℕ) < (↑r : ℕ) ∧ + (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ) ∧ + (↑(rix + (⟨(↑q : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬(↑q : ℕ) + (1 : ℕ) < T.length - (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length - (1 : ℕ)))) : + ℕ) = + C.p + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + C.p - (1 : ℕ) ≤ (↑q : ℕ) → + (↑q : ℕ) < m - (1 : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑r : ℕ) < (↑i : ℕ) ∧ + (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ)) → + let ne : Fin T.length → E := fun (q : Fin T.length) ↦ + if hq : (↑q : ℕ) < T.length - (2 : ℕ) then + T.edge (eix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (2 : ℕ)))) + else if (↑q : ℕ) = T.length - (2 : ℕ) then a0 else a1; + (∀ (q : Fin (T.length - (2 : ℕ))), + ne + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) = + T.edge (eix q)) → + ne + (⟨T.length - (2 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a0 → + ne + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a1 → + ∀ (ne_injective : Function.Injective ne) + (hfirst : ne (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = e0) + (hattaches : + ∀ (q : Fin T.length), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), + let T' : TreeSequence G e0 := + { length := T.length, positive := T.positive, vertex := nv, edge := ne, + vertex_injective := nv_injective, edge_injective := ne_injective, + first_edge := hfirst, attaches := hattaches : TreeSequence G e0 }; + C.gamma i ∉ TreeUsedColors phi T' := by + classical + intro V E _ _ _ G k e0 phi T C i alpha hAlphaGamma u0 u1 hlength hlenThree m hmTwo hmLast a0 + ha0Color a1 ha1Color rix nv nv_injective eix eix_val later_indices early_block_indices ne + ne_retained ne_penultimate ne_last ne_injective hfirst hattaches T' hused + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hused + obtain ⟨q, hqpos, hqcolor⟩ := hused + have hqLt : q.val < T.length := by simp [T'] + have hqcolor' : phi (ne q) = some (C.gamma i) := by + simpa [T'] using hqcolor + by_cases hret : q.val < T.length - 2 + · let qr : Fin (T.length - 2) := ⟨q.val, hret⟩ + have hne : ne q = T.edge (eix qr) := by + simpa [qr] using ne_retained qr + by_cases hbefore : q.val < m - 1 + · by_cases hbase : q.val < C.p - 1 + · let b : Fin (C.p - 1) := ⟨q.val, hbase⟩ + have heix : eix qr = ⟨q.val, by omega⟩ := by + apply Fin.ext + rw [eix_val] + simp [qr, hbefore] + have hedge : T.edge (eix qr) = C.baseEdge b := by + rw [heix] + simpa [b] using C.base_edge_position b + have hc : phi (C.baseEdge b) = some (C.gamma i) := by + simpa [hne, hedge] using hqcolor' + exact (C.initial_nonfirst_avoids_blocks b (by dsimp [b]; omega) + (C.gamma i) hc i) rfl + · have hbase' : C.p - 1 ≤ q.val := by omega + obtain ⟨r, j, hri, heixval⟩ := + early_block_indices qr hbase' hbefore + have hedge : T.edge (eix qr) = C.blockEdge r j := by + calc + T.edge (eix qr) = + T.edge ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply congrArg T.edge + apply Fin.ext + exact heixval + _ = C.blockEdge r j := C.block_edge_position r j + have hcolors : C.gamma r = C.gamma i := by + exact Option.some.inj ((C.block_color r j).symm.trans + (by simpa [hne, hedge] using hqcolor')) + have hriEq := C.gamma_injective hcolors + have hv := congrArg Fin.val hriEq + omega + · have hafter : m - 1 ≤ q.val := by omega + obtain ⟨r, j, hri, heixval, _⟩ := later_indices qr hafter + have hedge : T.edge (eix qr) = C.blockEdge r j := by + calc + T.edge (eix qr) = + T.edge ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply congrArg T.edge + apply Fin.ext + exact heixval + _ = C.blockEdge r j := C.block_edge_position r j + have hcolors : C.gamma r = C.gamma i := by + exact Option.some.inj ((C.block_color r j).symm.trans + (by simpa [hne, hedge] using hqcolor')) + have hriEq := C.gamma_injective hcolors + have hv := congrArg Fin.val hriEq + omega + · have hlast : q.val = T.length - 2 ∨ q.val = T.length - 1 := by omega + rcases hlast with hq | hq + · have hqe : q = ⟨T.length - 2, by omega⟩ := Fin.ext (by omega) + have hc : phi a0 = some (C.gamma i) := by + simpa [hqe, ne_penultimate] using hqcolor' + exact hAlphaGamma (Option.some.inj (ha0Color.symm.trans hc)) + · have hqe : q = ⟨T.length - 1, by omega⟩ := Fin.ext (by omega) + have hc : phi a1 = some (C.gamma i) := by + simpa [hqe, ne_last] using hqcolor' + exact hAlphaGamma (Option.some.inj (ha1Color.symm.trans hc)) + +private theorem helper_early_block_indices_1415.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s), + (2 : ℕ) ≤ C.p → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m), + m + (1 : ℕ) ≤ T.length → + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + ∀ (q : Fin (T.length - (2 : ℕ))), + C.p - (1 : ℕ) ≤ (↑q : ℕ) → + (↑q : ℕ) < m - (1 : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑r : ℕ) < (↑i : ℕ) ∧ (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ) := by + classical + intro V E _ _ _ G k e0 phi T C i hpTwo hlength hlenThree m hmTwo hmLast eix eix_val q hbase hq + let d := q.val - (C.p - 1) + let rn := d / 2 + let jn := d % 2 + have hqLt := q.isLt + have hd : q.val = C.p - 1 + d := by dsimp [d]; omega + have hdecomp : d = 2 * rn + jn := by + dsimp [rn, jn] + omega + have hjn : jn < 2 := by dsimp [jn]; omega + have hrn : rn < C.s := by dsimp [rn, d]; omega + let r : Fin C.s := ⟨rn, hrn⟩ + let j : Fin 2 := ⟨jn, hjn⟩ + refine ⟨r, j, ?_, ?_⟩ + · dsimp [r, rn, d, m] at * + omega + · rw [eix_val] + simp only [ite_eq_left hq] + dsimp [r, j] + omega + +private theorem helper_hw1u0_1593.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (alpha : Fin k), + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + IsProperEdgeColoring G phi → + u0 ≠ u1 → + ∀ (a0 : E), + Incident G u0 a0 → + phi a0 = some alpha → + ∀ (a1 : E), + phi a1 = some alpha → + ∀ (w0 : V), + G.ends a0 = s(u0, w0) → + ∀ (w1 : V), + G.ends a1 = s(u1, w1) → + ¬w0 = u1 → + w1 ≠ u0 := by + classical + intro V E _ _ _ G k e0 phi T C i alpha u0 u1 hproper hu01 a0 ha0Inc ha0Color a1 ha1Color w0 + ha0Ends w1 ha1Ends hw0u1 h + have ha01 : a0 ≠ a1 := by + intro he + have : s(u0, w0) = s(u1, u0) := by + rw [← ha0Ends, he, ha1Ends, h] + have hw0 : w0 = u1 := by + have hm := Sym2.eq_iff.mp this + rcases hm with hsame | hswap + · exact False.elim (hu01 hsame.1) + · exact hswap.2 + exact hw0u1 hw0 + exact hproper ha01 ⟨u0, ha0Inc, by simp [Incident, ha1Ends, h]⟩ + ha0Color ha1Color + +private theorem helper_eix_injective_1675.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) + (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m), + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + Function.Injective eix := by + classical + intro V E _ _ _ G k e0 phi T C i hlength hlenThree m hmTwo eix eix_val q r hqr + have hqLt := q.isLt + have hrLt := r.isLt + by_cases hqm : q.val < m - 1 <;> + by_cases hrm : r.val < m - 1 + all_goals + have hv := congrArg Fin.val hqr + rw [eix_val, eix_val] at hv + simp [hqm, hrm] at hv + apply Fin.ext + omega + +private theorem helper_hfirst_1733.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) + (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (a0 a1 : E), + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + let ne : Fin T.length → E := fun (q : Fin T.length) ↦ + if hq : (↑q : ℕ) < T.length - (2 : ℕ) then + T.edge (eix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (2 : ℕ)))) + else if (↑q : ℕ) = T.length - (2 : ℕ) then a0 else a1; + (∀ (q : Fin (T.length - (2 : ℕ))), + ne + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) = + T.edge (eix q)) → + ne (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = e0 := by + classical + intro V E _ _ _ G k e0 phi T C i hlength hlenThree m hmTwo a0 a1 eix eix_val ne ne_retained + have hret : (0 : ℕ) < T.length - 2 := by omega + let q : Fin (T.length - 2) := ⟨0, hret⟩ + have heix : eix q = ⟨0, T.positive⟩ := by + apply Fin.ext + rw [eix_val] + have hm : (0 : ℕ) < m - 1 := by omega + simp [q, hm] + calc + ne ⟨0, T.positive⟩ = T.edge (eix q) := by + simpa [q] using ne_retained q + _ = T.edge ⟨0, T.positive⟩ := by rw [heix] + _ = e0 := T.first_edge + +private theorem helper_continuation_1778.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (alpha : Fin k), + alpha ≠ C.gamma i → + ∀ (z : V), + alpha ∈ MissingColors G phi z → + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let X : Finset V := TreeSequenceVertexSet T; + z ∈ X → + (2 : ℕ) ≤ C.p → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + ∀ (hmTwo : (2 : ℕ) ≤ m) (_ : m + (1 : ℕ) ≤ T.length), + u0 ∈ X → + u1 ∈ X → + z ≠ u0 → + z ≠ u1 → + ∀ (a0 : E), + phi a0 = some alpha → + ∀ (a1 : E), + phi a1 = some alpha → + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + (∀ (q : Fin (T.length - (1 : ℕ))), + (↑(rix q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + let nv : Fin (T.length + (1 : ℕ)) → V := fun (q : Fin (T.length + (1 : ℕ))) ↦ + if hq : (↑q : ℕ) < T.length - (1 : ℕ) then + T.vertex (rix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (1 : ℕ)))) + else if (↑q : ℕ) = T.length - (1 : ℕ) then u0 else u1; + (∀ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + T.vertex (rix q)) → + nv + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))) = + u0 → + nv + (⟨T.length, + Decidable.byContradiction fun (a : ¬T.length < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + u1 → + Function.Injective nv → + (∀ {w : V}, + w ∈ X → + w ≠ u0 → + w ≠ u1 → + ∃ (q : Fin (T.length - (1 : ℕ))), + nv + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))) = + w) → + let eix : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) ↦ + if _ : (↑q : ℕ) < m - (1 : ℕ) then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(eix q) : ℕ) = if (↑q : ℕ) < m - (1 : ℕ) then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + m - (1 : ℕ) ≤ (↑q : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑i : ℕ) < (↑r : ℕ) ∧ + (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ) ∧ + (↑(rix + (⟨(↑q : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬(↑q : ℕ) + (1 : ℕ) < T.length - (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length - (1 : ℕ)))) : + ℕ) = + C.p + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ)) → + (∀ (q : Fin (T.length - (2 : ℕ))), + C.p - (1 : ℕ) ≤ (↑q : ℕ) → + (↑q : ℕ) < m - (1 : ℕ) → + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + (↑r : ℕ) < (↑i : ℕ) ∧ + (↑(eix q) : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑r : ℕ) + (↑j : ℕ)) → + let ne : Fin T.length → E := fun (q : Fin T.length) ↦ + if hq : (↑q : ℕ) < T.length - (2 : ℕ) then + T.edge (eix (⟨(↑q : ℕ), hq⟩ : Fin (T.length - (2 : ℕ)))) + else if (↑q : ℕ) = T.length - (2 : ℕ) then a0 else a1; + (∀ (q : Fin (T.length - (2 : ℕ))), + ne + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length) = + T.edge (eix q)) → + ne + (⟨T.length - (2 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a0 → + ne + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by + omega⟩ : + Fin T.length) = + a1 → + Function.Injective ne → + ne (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = e0 → + (∀ (q : Fin T.length), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))) → + False := by + classical + intro V E _ _ _ G k e0 phi T C i alpha hAlphaGamma z hzMissing u0 u1 X hzX hpTwo hlength + hlenThree m hmTwo hmLast hu0X hu1X hzu0 hzu1 a0 ha0Color a1 ha1Color rix rix_val nv + nv_retained nv_penultimate nv_last nv_injective retained_vertex_index eix eix_val + later_indices early_block_indices ne ne_retained ne_penultimate ne_last ne_injective hfirst + hattaches + let T' : TreeSequence G e0 := + { length := T.length + positive := T.positive + vertex := nv + edge := ne + vertex_injective := nv_injective + edge_injective := ne_injective + first_edge := hfirst + attaches := hattaches } + have htash : TashkinovTree G e0 phi T' := by + exact @helper_htash_685 V E inferInstance inferInstance inferInstance G k e0 phi T C i alpha + z hzMissing hzX hpTwo hlength hlenThree hmTwo hmLast hzu0 hzu1 a0 ha0Color a1 ha1Color + rix_val nv_retained nv_injective retained_vertex_index eix_val later_indices ne_retained + ne_penultimate ne_last ne_injective hfirst hattaches + have hvertexSet : TreeSequenceVertexSet T' = X := by + exact @helper_hvertexSet_788 V E inferInstance inferInstance inferInstance G k e0 phi T C i + hlength hlenThree hmTwo hmLast hu0X hu1X a0 a1 nv_retained nv_penultimate nv_last + nv_injective retained_vertex_index ne_injective hfirst hattaches + have hglobal' : GlobalMaximumTriple G k e0 phi T' := by + refine ⟨C.globally_maximum.1, htash, ?_⟩ + rw [hvertexSet] + exact C.globally_maximum.2.2 + obtain ⟨bGamma, hbGamma⟩ := C.block_color_missing_on_base i + have hyGammaX : C.y bGamma ∈ X := by + rw [← C.base_vertex_position bGamma] + simp [X, TreeSequenceVertexSet] + have hgammaMissing : C.gamma i ∈ TreeMissingColors phi T' := by + simp only [TreeMissingColors, Finset.mem_biUnion] + refine ⟨C.y bGamma, ?_, hbGamma⟩ + rw [hvertexSet] + exact hyGammaX + have hgammaUnused : C.gamma i ∉ TreeUsedColors phi T' := by + exact @helper_hgammaUnused_842 V E inferInstance inferInstance inferInstance G k e0 phi T C i + alpha hAlphaGamma hlength hlenThree hmTwo hmLast a0 ha0Color a1 ha1Color nv_injective + eix_val later_indices early_block_indices ne_retained ne_penultimate ne_last ne_injective + hfirst hattaches + have hgammaFree : C.gamma i ∈ TreeFreeColors phi T' := by + exact Finset.mem_sdiff.mpr ⟨hgammaMissing, hgammaUnused⟩ + have hexitPred (v : V) : + ScheideExitVertex T' phi v ↔ ScheideExitVertex T phi v := by + simp only [ScheideExitVertex, ScheideDefectiveChainPath, hvertexSet] + rfl + have hexits : ScheideExitVertices T' phi = ScheideExitVertices T phi := by + ext v + simp only [ScheideExitVertices, Finset.mem_filter, Finset.mem_univ, + true_and] + exact hexitPred v + obtain ⟨vExit, hvExit, hvGamma⟩ := C.every_block_color_at_exit i + have hvExit' : vExit ∈ ScheideExitVertices T' phi := by + rw [hexits] + exact hvExit + have hdisjoint := ScheideExitNoFree G k e0 phi T' hglobal' vExit hvExit' + exact (Finset.disjoint_left.mp hdisjoint) hvGamma hgammaFree + +private theorem helper_continuation_1719.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (alpha : Fin k), + alpha ≠ C.gamma i → + ∀ (z : V), + alpha ∈ MissingColors G phi z → + let u0 : V := C.blockVertex i (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex i (1 : Fin (2 : ℕ)); + let X : Finset V := TreeSequenceVertexSet T; + z ∈ X → + (↑i : ℕ) < C.s → + (2 : ℕ) ≤ C.p → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) (hlenThree : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + (2 : ℕ) ≤ m → + ∀ (hmLast : m + (1 : ℕ) ≤ T.length), + T.vertex + (⟨m, Decidable.byContradiction fun (a : ¬m < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) = + u0 → + T.vertex + (⟨m + (1 : ℕ), + Decidable.byContradiction fun (a : ¬m + (1 : ℕ) < T.length + (1 : ℕ)) ↦ by + omega⟩ : + Fin (T.length + (1 : ℕ))) = + u1 → + u0 ∈ X → + u1 ∈ X → + u0 ≠ u1 → + z ≠ u0 → + z ≠ u1 → + ∀ (a0 : E), + Incident G u0 a0 → + phi a0 = some alpha → + ∀ (a1 : E), + Incident G u1 a1 → + phi a1 = some alpha → + ∀ (w0 : V), + G.ends a0 = s(u0, w0) → + ∀ (w1 : V), + G.ends a1 = s(u1, w1) → + w0 ≠ u0 → + w1 ≠ u1 → + w0 ∈ X → + w1 ∈ X → + ¬w0 = u1 → + w1 ≠ u0 → + let rix : Fin (T.length - (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (1 : ℕ))) ↦ + if hqm : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ by omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega⟩ : + Fin (T.length + (1 : ℕ))); + (∀ (q : Fin (T.length - (1 : ℕ))), + (↑(rix q) : ℕ) = if (↑q : ℕ) < m then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + Function.Injective rix → + False := by + classical + intro V E _ _ _ G k e0 phi T C i alpha hAlphaGamma z hzMissing u0 u1 X hzX hiLt hpTwo hlength + hlenThree m hmTwo hmLast hu0pos hu1pos hu0X hu1X hu01 hzu0 hzu1 a0 ha0Inc ha0Color a1 + ha1Inc ha1Color w0 ha0Ends w1 ha1Ends hw0ne hw1ne hw0X hw1X hw0u1 hw1u0 rix rix_val + rix_injective + have rix_avoids (q : Fin (T.length - 1)) : + (rix q).val ≠ m ∧ (rix q).val ≠ m + 1 := by + have hqLt := q.isLt + rw [rix_val] + split <;> omega + let nv : Fin (T.length + 1) → V := fun q => + if hq : q.val < T.length - 1 then + T.vertex (rix ⟨q.val, hq⟩) + else if q.val = T.length - 1 then u0 else u1 + have nv_retained (q : Fin (T.length - 1)) : + nv ⟨q.val, by omega⟩ = T.vertex (rix q) := by + simp [nv] + have nv_penultimate : nv ⟨T.length - 1, by omega⟩ = u0 := by + simp [nv] + have nv_last : nv ⟨T.length, by omega⟩ = u1 := by + simp [nv, show ¬ T.length < T.length - 1 by omega, + show T.length ≠ T.length - 1 by omega] + have retained_ne_u0 (q : Fin (T.length - 1)) : + T.vertex (rix q) ≠ u0 := by + intro h + have hv : T.vertex (rix q) = T.vertex ⟨m, by omega⟩ := + h.trans hu0pos.symm + exact (rix_avoids q).1 (congrArg Fin.val (T.vertex_injective hv)) + have retained_ne_u1 (q : Fin (T.length - 1)) : + T.vertex (rix q) ≠ u1 := by + intro h + have hv : T.vertex (rix q) = T.vertex ⟨m + 1, by omega⟩ := + h.trans hu1pos.symm + exact (rix_avoids q).2 (congrArg Fin.val (T.vertex_injective hv)) + have nv_injective : Function.Injective nv := by + exact @helper_nv_injective_206 V E inferInstance inferInstance inferInstance G k e0 phi T C i + hlength hlenThree hmLast hu01 rix_injective nv_penultimate nv_last retained_ne_u0 + retained_ne_u1 + have retained_vertex_index {w : V} (hwX' : w ∈ X) + (hwu0 : w ≠ u0) (hwu1 : w ≠ u1) : + ∃ q : Fin (T.length - 1), + nv ⟨q.val, by omega⟩ = w := by + exact @helper_retained_vertex_index_257 V E inferInstance inferInstance inferInstance G k e0 + phi T C i hlength hlenThree hmTwo hmLast hu0pos hu1pos rix_val nv_retained w hwX' hwu0 hwu1 + let eix : Fin (T.length - 2) → Fin T.length := fun q => + if hqm : q.val < m - 1 then ⟨q.val, by omega⟩ + else ⟨q.val + 2, by omega⟩ + have eix_val (q : Fin (T.length - 2)) : + (eix q).val = if q.val < m - 1 then q.val else q.val + 2 := by + by_cases hqm : q.val < m - 1 + · simp [eix, hqm] + · simp [eix, hqm] + have eix_injective : Function.Injective eix := by + exact @helper_eix_injective_1675 V E inferInstance inferInstance inferInstance G k e0 phi T C + i hlength hlenThree hmTwo eix_val + have later_indices (q : Fin (T.length - 2)) (hq : m - 1 ≤ q.val) : + ∃ (r : Fin C.s) (j : Fin 2), i.val < r.val ∧ + (eix q).val = C.p - 1 + 2 * r.val + j.val ∧ + (rix ⟨q.val + 1, by omega⟩).val = C.p + 2 * r.val + j.val := by + exact @helper_later_indices_313 V E inferInstance inferInstance inferInstance G k e0 phi T C + i hpTwo hlength hlenThree hmTwo hmLast rix_val eix_val q hq + have early_block_indices (q : Fin (T.length - 2)) + (hbase : C.p - 1 ≤ q.val) (hq : q.val < m - 1) : + ∃ (r : Fin C.s) (j : Fin 2), r.val < i.val ∧ + (eix q).val = C.p - 1 + 2 * r.val + j.val := by + exact @helper_early_block_indices_1415 V E inferInstance inferInstance inferInstance G k e0 + phi T C i hpTwo hlength hlenThree hmTwo hmLast eix_val q hbase hq + have block_vertex_ne_before (j0 : Fin 2) (q : Fin (T.length + 1)) + (hq : q.val < m) : C.blockVertex i j0 ≠ T.vertex q := by + intro h + have hp := C.block_vertex_position i j0 + have hv : T.vertex ⟨C.p + 2 * i.val + j0.val, by omega⟩ = + T.vertex q := hp.trans h + have hiq := congrArg Fin.val (T.vertex_injective hv) + simp at hiq + dsimp [m] at hq + omega + have retained_not_incident (q : Fin (T.length - 2)) (j0 : Fin 2) : + ¬ Incident G (C.blockVertex i j0) (T.edge (eix q)) := by + exact @helper_retained_not_incident_383 V E inferInstance inferInstance inferInstance G k e0 + phi T C i hiLt hlength hlenThree hmTwo hmLast eix_val later_indices + block_vertex_ne_before q j0 + have ha01 : a0 ≠ a1 := by + intro h + have he : s(u0, w0) = s(u1, w1) := by + rw [← ha0Ends, h, ha1Ends] + rcases Sym2.eq_iff.mp he with hsame | hswap + · exact hu01 hsame.1 + · exact hw1u0 hswap.1.symm + let ne : Fin T.length → E := fun q => + if hq : q.val < T.length - 2 then + T.edge (eix ⟨q.val, hq⟩) + else if q.val = T.length - 2 then a0 else a1 + have ne_retained (q : Fin (T.length - 2)) : + ne ⟨q.val, by omega⟩ = T.edge (eix q) := by + simp [ne] + have ne_penultimate : ne ⟨T.length - 2, by omega⟩ = a0 := by + simp [ne] + have ne_last : ne ⟨T.length - 1, by omega⟩ = a1 := by + simp [ne, show ¬ T.length - 1 < T.length - 2 by omega, + show T.length - 1 ≠ T.length - 2 by omega] + have ne_injective : Function.Injective ne := by + exact @helper_ne_injective_450 V E inferInstance inferInstance inferInstance G k e0 phi T C i + hlength hlenThree hmTwo a0 ha0Inc a1 ha1Inc eix_injective retained_not_incident ha01 + ne_penultimate ne_last + have hfirst : ne ⟨0, T.positive⟩ = e0 := by + exact @helper_hfirst_1733 V E inferInstance inferInstance inferInstance G k e0 phi T C i + hlength hlenThree hmTwo a0 a1 eix_val ne_retained + have hattaches : ∀ q : Fin T.length, ∃ a : Fin (q.val + 1), + G.ends (ne q) = + s(nv q.succ, + nv (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)))) := by + exact @helper_hattaches_522 V E inferInstance inferInstance inferInstance G k e0 phi T C i + hpTwo hlength hlenThree hmTwo hmLast a0 a1 w0 ha0Ends w1 ha1Ends hw0ne hw1ne hw0X hw1X + hw0u1 hw1u0 rix_val nv_retained nv_penultimate nv_last retained_vertex_index eix_val + later_indices ne_retained ne_penultimate ne_last + exact @helper_continuation_1778 V E inferInstance inferInstance inferInstance G k e0 phi T C i + alpha hAlphaGamma z hzMissing hzX hpTwo hlength hlenThree hmTwo hmLast hu0X hu1X hzu0 hzu1 + a0 ha0Color a1 ha1Color rix_val nv_retained nv_penultimate nv_last nv_injective + retained_vertex_index eix_val later_indices early_block_indices ne_retained ne_penultimate + ne_last ne_injective hfirst hattaches +theorem ScheideStructuralInternalPair {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) : + ∀ (i : Fin C.s) (alpha : Fin k), + alpha ≠ C.gamma i → + (∃ z ∈ TreeSequenceVertexSet T \ {C.blockVertex i 0, C.blockVertex i 1}, + alpha ∈ MissingColors G phi z) → + ∃ f : E, + phi f = some alpha ∧ G.ends f = s(C.blockVertex i 0, C.blockVertex i 1) := by + classical + intro i alpha hAlphaGamma hmissing + rcases hmissing with ⟨z, hzZ, hzMissing⟩ + let u0 := C.blockVertex i 0 + let u1 := C.blockVertex i 1 + let X := TreeSequenceVertexSet T + have hzX : z ∈ X := (Finset.mem_sdiff.mp hzZ).1 + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have helem : ColoredVertexSetElementary G phi X := horder.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi X := horder.2.2.2.2 + have hproper : IsProperEdgeColoring G phi := C.globally_maximum.1.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := C.globally_maximum.1.2.2.2.2 + have hiLt : i.val < C.s := i.isLt + have hiS : 1 ≤ C.s := + Nat.succ_le_iff.mpr (Nat.zero_lt_of_lt hiLt) + have hpTwo : 2 ≤ C.p := C.p_ge_two + have hlength : T.length + 1 = C.p + 2 * C.s := C.length_eq + have hlenThree : 3 ≤ T.length := by omega + let m := C.p + 2 * i.val + have hmTwo : 2 ≤ m := by dsimp [m]; omega + have hmLast : m + 1 ≤ T.length := by dsimp [m]; omega + have hu0pos : T.vertex ⟨m, by omega⟩ = u0 := by + simpa [m, u0] using C.block_vertex_position i (0 : Fin 2) + have hu1pos : T.vertex ⟨m + 1, by omega⟩ = u1 := by + simpa [m, u1] using C.block_vertex_position i (1 : Fin 2) + have hu0X : u0 ∈ X := by + rw [← hu0pos] + simp [X, TreeSequenceVertexSet] + have hu1X : u1 ∈ X := by + rw [← hu1pos] + simp [X, TreeSequenceVertexSet] + have hu01 : u0 ≠ u1 := by + intro h + let q0 : Fin (T.length + 1) := ⟨m, by omega⟩ + let q1 : Fin (T.length + 1) := ⟨m + 1, by omega⟩ + have hv : T.vertex q0 = T.vertex q1 := by + simpa [q0, q1] using hu0pos.trans (h.trans hu1pos.symm) + have hi := T.vertex_injective hv + have hiv := congrArg Fin.val hi + simp [q0, q1] at hiv + have hzu0 : z ≠ u0 := by + have hn := (Finset.mem_sdiff.mp hzZ).2 + simpa [u0, u1] using fun h => hn (by simp [h]) + have hzu1 : z ≠ u1 := by + have hn := (Finset.mem_sdiff.mp hzZ).2 + simpa [u0, u1] using fun h => hn (by simp [h]) + have alpha_present (u : V) (huX : u ∈ X) (hzu : z ≠ u) : + alpha ∈ PresentColors G phi u := by + have hnot : alpha ∉ MissingColors G phi u := by + intro huMissing + exact (Finset.disjoint_left.mp (helem hzX huX hzu)) hzMissing huMissing + simpa [MissingColors] using hnot + obtain ⟨a0, ha0Inc, ha0Color⟩ := by + simpa [PresentColors] using alpha_present u0 hu0X hzu0 + obtain ⟨a1, ha1Inc, ha1Color⟩ := by + simpa [PresentColors] using alpha_present u1 hu1X hzu1 + obtain ⟨w0, ha0Ends⟩ := Sym2.mem_iff_exists.mp ha0Inc + obtain ⟨w1, ha1Ends⟩ := Sym2.mem_iff_exists.mp ha1Inc + have hw0ne : w0 ≠ u0 := by + intro h + exact G.loopless a0 u0 (by simpa [h] using ha0Ends) + have hw1ne : w1 ≠ u1 := by + intro h + exact G.loopless a1 u1 (by simpa [h] using ha1Ends) + have other_end_in_X (a : E) (u w : V) (huX : u ∈ X) + (haEnds : G.ends a = s(u, w)) (haColor : phi a = some alpha) : w ∈ X := by + by_contra hwX + have haBoundary : a ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, huX, w, hwX, haEnds⟩ + exact hclosed haBoundary hzX haColor hzMissing + have hw0X : w0 ∈ X := other_end_in_X a0 u0 w0 hu0X ha0Ends ha0Color + have hw1X : w1 ∈ X := other_end_in_X a1 u1 w1 hu1X ha1Ends ha1Color + by_cases hw0u1 : w0 = u1 + · exact ⟨a0, ha0Color, by simpa [u0, u1, hw0u1] using ha0Ends⟩ + exfalso + have hw0Z : w0 ∈ X \ {u0, u1} := by + simp only [Finset.mem_sdiff, Finset.mem_insert, Finset.mem_singleton] + exact ⟨hw0X, not_or_intro hw0ne hw0u1⟩ + have hw1u0 : w1 ≠ u0 := by + exact @helper_hw1u0_1593 V E inferInstance inferInstance inferInstance G k e0 phi T C i alpha + hproper hu01 a0 ha0Inc ha0Color a1 ha1Color w0 ha0Ends w1 ha1Ends hw0u1 + have hw1Z : w1 ∈ X \ {u0, u1} := by + simp only [Finset.mem_sdiff, Finset.mem_insert, Finset.mem_singleton] + exact ⟨hw1X, not_or_intro hw1u0 hw1ne⟩ + let rix : Fin (T.length - 1) → Fin (T.length + 1) := fun q => + if hqm : q.val < m then ⟨q.val, by omega⟩ + else ⟨q.val + 2, by omega⟩ + have rix_val (q : Fin (T.length - 1)) : + (rix q).val = if q.val < m then q.val else q.val + 2 := by + by_cases hqm : q.val < m + · simp [rix, hqm] + · simp [rix, hqm] + have rix_injective : Function.Injective rix := by + intro q r hqr + have hqLt := q.isLt + have hrLt := r.isLt + by_cases hqm : q.val < m <;> by_cases hrm : r.val < m + all_goals + have hv := congrArg Fin.val hqr + rw [rix_val, rix_val] at hv + simp [hqm, hrm] at hv + apply Fin.ext + omega + exact @helper_continuation_1719 V E inferInstance inferInstance inferInstance G k e0 phi T C i + alpha hAlphaGamma z hzMissing hzX hiLt hpTwo hlength hlenThree hmTwo hmLast hu0pos hu1pos + hu0X hu1X hu01 hzu0 hzu1 a0 ha0Inc ha0Color a1 ha1Inc ha1Color w0 ha0Ends w1 ha1Ends hw0ne + hw1ne hw0X hw1X hw0u1 hw1u0 rix_val rix_injective +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralLemma.lean b/LeanPool/GoldbergSeymour/ScheideStructuralLemma.lean new file mode 100644 index 0000000000..9cd0883c96 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideStructuralLemma.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetupExists +public import LeanPool.GoldbergSeymour.ScheideEnlargedElementary +public import LeanPool.GoldbergSeymour.ScheideEnlargedStronglyClosed +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts +public import LeanPool.GoldbergSeymour.ScheideReplacementFamilyExists +public import LeanPool.GoldbergSeymour.ScheideStructuralReduction +public import LeanPool.GoldbergSeymour.CriticalGraphElementaryWitness + +/-! +# Scheide Structural Lemma + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideStructuralLemma {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) : + Elementary G := by + classical + obtain ⟨T', R, hset, hy, hblocks⟩ := + ScheideStructuralReduction G k e0 phi T C + have htriple : KTriple G k e0 phi := R.globally_maximum.1 + have hproper : IsProperEdgeColoring G phi := htriple.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := htriple.2.2.2.2 + have hindex : ChromaticIndex G = k + 1 := htriple.2.1 + have hdegree : MaximumDegree G + 1 ≤ k := htriple.2.2.1 + have hends : ∀ v, v ∈ G.ends e0 → v ∈ TreeSequenceVertexSet T' := by + intro v hv + have hatt := T'.attaches (⟨0, T'.positive⟩ : Fin T'.length) + obtain ⟨i, hi⟩ := hatt + have hi0 : i = ⟨0, Nat.zero_lt_succ _⟩ := by + apply Fin.ext + exact Nat.eq_zero_of_le_zero (Nat.le_of_lt_succ i.isLt) + subst i + have hmem' : T'.vertex ⟨0, Nat.zero_lt_succ _⟩ ∈ + G.ends (T'.edge ⟨0, T'.positive⟩) := by + have hzero : (⟨0, Nat.zero_lt_succ _⟩ : Fin (T'.length + 1)) = + Fin.castLT (⟨0, Nat.zero_lt_succ _⟩ : Fin (0 + 1)) (by omega) := by + apply Fin.ext + rfl + rw [hi] + simp [hzero] + have hmem : T'.vertex ⟨0, Nat.zero_lt_succ _⟩ ∈ G.ends e0 := by + simpa [T'.first_edge] using hmem' + have hvertices : ∀ w, w ∈ G.ends e0 → w ∈ TreeSequenceVertexSet T' := by + intro w hw + have hw' := hw + rw [← T'.first_edge, hi] at hw' + rcases (by simpa using hw') with hw' | hw' + · simp [TreeSequenceVertexSet, hw'] + · simp [TreeSequenceVertexSet, hw'] + exact hvertices v hv + have hzero_mem : T'.vertex ⟨0, Nat.zero_lt_succ _⟩ ∈ + TreeSequenceVertexSet T' := by + simp [TreeSequenceVertexSet] + have hcritical : Critical G := htriple.1 + have hnoisolated : ∀ v : V, ∃ e : E, Incident G v e := C.no_isolated + have graph := egraph2 G k hcritical hindex hdegree hnoisolated + have finish : ∀ (X : Finset V), + ColoredVertexSetElementary G phi X → + ColoredVertexSetStronglyClosed G phi X → + (∀ v, v ∈ G.ends e0 → v ∈ X) → Elementary G := by + intro X he hs hend + apply graph.1.mpr + apply graph.2.1.mpr + apply graph.2.2.mpr + exact ⟨e0, phi, X, hproper, hone, hend, he, hs⟩ + by_cases hdef : DefectiveColors G phi (TreeSequenceVertexSet T') = ∅ + · have hclosed := (ScheideGlobalMaximumBoundaryFacts G k e0 phi T' + R.globally_maximum).1 hdef + have horder := ScheideGlobalMaximumOrder G k e0 phi T' R.globally_maximum + apply finish (TreeSequenceVertexSet T') horder.2.2.2.1 hclosed hends + · obtain ⟨D⟩ := ScheideDefectiveSetupExists G k e0 phi T' R hdef + obtain ⟨family⟩ := ScheideReplacementFamilyExists G k e0 phi T' R D + have henlarged : ColoredVertexSetElementary G phi + (ScheideEnlargedVertexSet family) := + ScheideEnlargedElementary (G := G) (k := k) (e0 := e0) (phi := phi) + (T := T') (C := R) (D := D) family + have hstrong : ColoredVertexSetStronglyClosed G phi + (ScheideEnlargedVertexSet family) := + ScheideEnlargedStronglyClosed (G := G) (k := k) (e0 := e0) (phi := phi) + (T := T') (C := R) (D := D) family + have hcontain : TreeSequenceVertexSet T' ⊆ ScheideEnlargedVertexSet family := by + intro v hv + exact Finset.mem_union_left _ hv + have hend : ∀ v, v ∈ G.ends e0 → v ∈ ScheideEnlargedVertexSet family := by + intro v hv + exact hcontain (hends v hv) + exact finish (ScheideEnlargedVertexSet family) henlarged hstrong hend + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean b/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean new file mode 100644 index 0000000000..8763a1ca0a --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean @@ -0,0 +1,2447 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralReorderingData +public import LeanPool.GoldbergSeymour.ScheideStructuralSelectionData +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Structural Reduced Assembly + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch504Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), + let newP : ℕ := C.p + (2 : ℕ) * D.absorbedCount; + let newS : ℕ := D.retainedCount; + let newVertex : Fin newP → V := fun (q : Fin newP) => + T'.vertex + (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < newP := q.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a + (1 : ℕ)) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by omega)⟩ : + Fin (T'.length + (1 : ℕ))); + let newGamma : Fin newS → Fin k := fun (t : Fin newS) => C.gamma (D.retained t); + let newBlockVertex : Fin newS → Fin (2 : ℕ) → V := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + T'.vertex + (⟨C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < newS := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a + (1 : ℕ)) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : + ¬C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) => + by omega)⟩ : + Fin (T'.length + (1 : ℕ))); + let newBaseEdge : Fin (newP - (1 : ℕ)) → E := fun (q : Fin (newP - (1 : ℕ))) => + T'.edge + (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < newP - (1 : ℕ) := q.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega)⟩ : + Fin T'.length); + let newBlockEdge : Fin newS → Fin (2 : ℕ) → E := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + T'.edge + (⟨C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < newS := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : + ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length) => + by omega)⟩ : + Fin T'.length); + ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ (q : Fin C.p), C.y q = v), + let assembled : ScheideReducedConfiguration G k e0 phi T' := + { + p := newP, s := newS, + p_ge_two := + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + id + (Decidable.byContradiction fun (a : ¬(2 : ℕ) ≤ C.p + (2 : ℕ) * D.absorbedCount) => by omega), + gamma := newGamma, + gamma_injective := fun ⦃a b : Fin newS⦄ (hab : newGamma a = newGamma b) => + D.retained_injective (C.gamma_injective hab), + y := newVertex, baseEdge := newBaseEdge, blockVertex := newBlockVertex, + blockEdge := newBlockEdge, + length_eq := + id + (have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + _a + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : ¬T.length + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) => + by omega)), + base_vertex_position := fun (q : Fin newP) => + Eq.refl + (T'.vertex + (⟨(↑q : ℕ), + (by + have := (q).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin (T'.length + (1 : ℕ)))), + block_vertex_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + Eq.refl + (T'.vertex + (⟨newP + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + (by + have := (t).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin (T'.length + (1 : ℕ)))), + base_edge_position := fun (q : Fin (newP - (1 : ℕ))) => + Eq.refl + (T'.edge + (⟨(↑q : ℕ), + (by + have := (q).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length)), + block_edge_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + id + (congrArg T'.edge + (Fin.ext + (id + (have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + Decidable.byContradiction + fun + (a : + ¬C.p + (2 : ℕ) * D.absorbedCount - (1 : ℕ) + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) = + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ)) => + by omega)))), + block_attaches_to_base := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + have h : + ∃ (q : Fin C.p), + G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j) := + C.block_attaches_to_base (D.retained t) j; + Exists.casesOn h + fun (q : Fin C.p) + (hq : G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j)) => + let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); + Exists.intro qnew + (Eq.mpr + (id + (congrArg (fun (_a : E) => G.ends _a = s(newVertex qnew, newBlockVertex t j)) + (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := + id (Q.retained_edge_position t j); + this))) + (Eq.mpr + (id + (congrArg + (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(_a, newBlockVertex t j)) + (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); + this))) + (Eq.mpr + (id + (congrArg (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(C.y q, _a)) + (have this : newBlockVertex t j = C.blockVertex (D.retained t) j := + id (Q.retained_vertex_position t j); + this))) + hq))), + block_color := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + Eq.mpr + (id + (congrArg (fun (_a : E) => phi _a = some (newGamma t)) + (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := + id (Q.retained_edge_position t j); + this))) + (C.block_color (D.retained t) j), + block_color_missing_on_base := fun (t : Fin newS) => + let v : V := (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V); + have hv : v ∈ ScheideExitVertices T phi := + ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property; + Exists.casesOn (oldExitBase v hv) fun (q : Fin C.p) (hq : C.y q = v) => + let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); + Exists.intro qnew + (Eq.mpr + (id + (congrArg (fun (_a : Fin k) => _a ∈ MissingColors G phi (newVertex qnew)) + (have this : newGamma t = C.gamma (D.retained t) := Eq.refl (newGamma t); + this))) + (Eq.mpr + (id + (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) + (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); + this))) + (Eq.mpr + (id (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) hq)) + (D.retained_missing t)))), + initial_nonfirst_avoids_blocks := + fun (q : Fin (newP - (1 : ℕ))) (hq : (1 : ℕ) ≤ (↑q : ℕ)) (c : Fin k) + (hc : phi (newBaseEdge q) = some c) (r : Fin newS) => + let split : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount) := + (⟨(↑q : ℕ), by omega⟩ : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)); + have core : + ∀ (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), + (1 : ℕ) ≤ (↑n : ℕ) → + ∀ (d : Fin k), + phi + (T'.edge + (⟨(↑n : ℕ), + have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d → + ∀ (r : Fin D.retainedCount), d ≠ C.gamma (D.retained r) := + fun (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) (hn : (1 : ℕ) ≤ (↑n : ℕ)) + (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑n : ℕ), + have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + Fin.addCases (motive := fun (x : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) => + (1 : ℕ) ≤ (↑x : ℕ) → + ∀ (x_2 : Fin k), + phi + (T'.edge + (⟨(↑x : ℕ), + have hn : (↑x : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := x.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑x : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑x : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some x_2 → + ∀ (x : Fin D.retainedCount), x_2 ≠ C.gamma (D.retained x)) + (fun (u : Fin (C.p - (1 : ℕ))) + (hn : (1 : ℕ) ≤ (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ)) (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ), + have hn : + (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.castAdd ((2 : ℕ) * D.absorbedCount) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < T.length) => by + omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + have hold : + T'.edge + (⟨(↑u : ℕ), + (by + have := (u).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length) = + C.baseEdge u := + Q.base_edge_position u; + id + (fun (hn : (1 : ℕ) ≤ (↑u : ℕ)) => + C.initial_nonfirst_avoids_blocks u hn d + (Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hold))) hdedge) + (D.retained rr)) + hn) + (fun (u : Fin ((2 : ℕ) * D.absorbedCount)) + (hn : (1 : ℕ) ≤ (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ)) (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ), + have hn : + (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + let paired : Fin (D.absorbedCount * (2 : ℕ)) := + Fin.cast (Nat.mul_comm (2 : ℕ) D.absorbedCount) u; + let h : Fin D.absorbedCount := paired.divNat; + let j : Fin (2 : ℕ) := paired.modNat; + have huv : (↑u : ℕ) = (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) := + id + (Decidable.byContradiction + fun (a : ¬(↑u : ℕ) = (2 : ℕ) * ((↑u : ℕ) / (2 : ℕ)) + (↑u : ℕ) % (2 : ℕ)) => by omega); + have hedge : + T'.edge + (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), + (by + have := (h).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length) = + C.blockEdge + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j := + Q.absorbed_edge_position h j; + have hblock : + phi + (C.blockEdge + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j) = + some d := + Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hedge))) + (Eq.mpr + (id + (congrFun' + (congrArg Eq + (congrArg phi + (congrArg T'.edge + (Fin.mk.congr_simp (C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ)) + (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) + (Nat.add_assoc (C.p - (1 : ℕ)) ((2 : ℕ) * (↑h : ℕ)) (↑j : ℕ)) + ((by + have := (h).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + omega)))))) + (some d))) + (Eq.mp + (congrFun' + (congrArg Eq + (congrArg phi + (congrArg T'.edge + (Fin.mk.congr_simp (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) + (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) + (congrArg (HAdd.hAdd (C.p - (1 : ℕ))) huv) + (have hn : + (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)))))) + (some d)) + hdedge)); + have hcolor : + phi + (C.blockEdge + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j) = + some + (C.gamma + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s)) := + C.block_color + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j; + have heq : + d = + C.gamma + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) := + Eq.mp + (Option.some.injEq d + (C.gamma + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s))) + (Eq.symm (Eq.mp (congrArg (fun (_a : Option (Fin k)) => _a = some d) hcolor) hblock)); + fun (hbad : d = C.gamma (D.retained rr)) => + ((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h).property + (Exists.intro rr + (C.gamma_injective + (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) (Eq.symm heq))) + (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) hbad)) + (Eq.refl (C.gamma (D.retained rr)))))))) + n hn d hdedge rr; + core split hq c (id hc) r, + exit_covered := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => + Exists.casesOn + (Equiv.surjective D.exitEquiv + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) + fun (t : Fin D.retainedCount) + (ht : + (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) => + have htv : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := + congrArg Subtype.val ht; + Exists.intro t + (Eq.mpr (id (congrArg (fun (_a : V) => newGamma t ∈ MissingColors G phi _a) (Eq.symm htv))) + (D.retained_missing t)), + no_isolated := C.no_isolated, + globally_maximum := + (⟨C.globally_maximum.left, + (⟨Q.tashkinov, + Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = TashkinovOrder G) Q.vertex_set_eq)) + C.globally_maximum.right.right⟩ : + TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G)⟩ : + KTriple G k e0 phi ∧ + TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G), + exit_card_eq := + Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = newS) Q.exit_set_eq)) + (Eq.symm D.exit_count_eq), + exit_exactly_one := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => + Exists.casesOn + (Equiv.surjective D.exitEquiv + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) + fun (t : Fin D.retainedCount) + (ht : + (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) => + have htv : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := + congrArg Subtype.val ht; + Exists.intro t + (⟨Eq.mpr + (id + (congrArg + (fun (_a : V) => (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi _a) t) + (Eq.symm htv))) + (D.retained_missing t), + fun (t' : Fin newS) (hm : newGamma t' ∈ MissingColors G phi v) => + D.selected_unique t t' + (Eq.mp (congrArg (fun (_a : V) => newGamma t' ∈ MissingColors G phi _a) (Eq.symm htv)) + hm)⟩ : + (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) t ∧ + ∀ (y : Fin newS), (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) y → y = t), + every_block_color_at_exit := fun (t : Fin newS) => + Exists.intro (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) + (⟨Eq.mpr + (id + (congrArg + (fun (_a : Finset V) => + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ _a) + Q.exit_set_eq)) + ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property, + D.retained_missing t⟩ : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ + ScheideExitVertices T' phi ∧ + newGamma t ∈ + MissingColors G phi + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V)) : + ScheideReducedConfiguration G k e0 phi T' }; + ∀ (i : Fin C.s), + (∃! h : Fin D.absorbedCount, + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) h) : + Fin C.s) = + i) → + (∃ (r : Fin assembled.s), + C.gamma i = assembled.gamma r ∧ + ∀ (j : Fin (2 : ℕ)), + C.blockVertex i j = assembled.blockVertex r j ∧ + C.blockEdge i j = assembled.blockEdge r j) ∨ + ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image assembled.y Finset.univ + +private abbrev helperBranch516Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), + let newP : ℕ := C.p + (2 : ℕ) * D.absorbedCount; + let newS : ℕ := D.retainedCount; + let newVertex : Fin newP → V := fun (q : Fin newP) => + T'.vertex + (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < newP := q.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a + (1 : ℕ)) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by omega)⟩ : + Fin (T'.length + (1 : ℕ))); + let newGamma : Fin newS → Fin k := fun (t : Fin newS) => C.gamma (D.retained t); + let newBlockVertex : Fin newS → Fin (2 : ℕ) → V := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + T'.vertex + (⟨C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < newS := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a + (1 : ℕ)) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : + ¬C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) => + by omega)⟩ : + Fin (T'.length + (1 : ℕ))); + let newBaseEdge : Fin (newP - (1 : ℕ)) → E := fun (q : Fin (newP - (1 : ℕ))) => + T'.edge + (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < newP - (1 : ℕ) := q.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega)⟩ : + Fin T'.length); + let newBlockEdge : Fin newS → Fin (2 : ℕ) → E := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + T'.edge + (⟨C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < newS := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : + ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length) => + by omega)⟩ : + Fin T'.length); + ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ (q : Fin C.p), C.y q = v), + let assembled : ScheideReducedConfiguration G k e0 phi T' := + { + p := newP, s := newS, + p_ge_two := + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + id + (Decidable.byContradiction fun (a : ¬(2 : ℕ) ≤ C.p + (2 : ℕ) * D.absorbedCount) => by omega), + gamma := newGamma, + gamma_injective := fun ⦃a b : Fin newS⦄ (hab : newGamma a = newGamma b) => + D.retained_injective (C.gamma_injective hab), + y := newVertex, baseEdge := newBaseEdge, blockVertex := newBlockVertex, + blockEdge := newBlockEdge, + length_eq := + id + (have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + _a + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : ¬T.length + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) => + by omega)), + base_vertex_position := fun (q : Fin newP) => + Eq.refl + (T'.vertex + (⟨(↑q : ℕ), + (by + have := (q).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin (T'.length + (1 : ℕ)))), + block_vertex_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + Eq.refl + (T'.vertex + (⟨newP + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + (by + have := (t).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin (T'.length + (1 : ℕ)))), + base_edge_position := fun (q : Fin (newP - (1 : ℕ))) => + Eq.refl + (T'.edge + (⟨(↑q : ℕ), + (by + have := (q).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length)), + block_edge_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + id + (congrArg T'.edge + (Fin.ext + (id + (have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + Decidable.byContradiction + fun + (a : + ¬C.p + (2 : ℕ) * D.absorbedCount - (1 : ℕ) + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) = + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ)) => + by omega)))), + block_attaches_to_base := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + have h : + ∃ (q : Fin C.p), + G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j) := + C.block_attaches_to_base (D.retained t) j; + Exists.casesOn h + fun (q : Fin C.p) + (hq : G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j)) => + let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); + Exists.intro qnew + (Eq.mpr + (id + (congrArg (fun (_a : E) => G.ends _a = s(newVertex qnew, newBlockVertex t j)) + (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := + id (Q.retained_edge_position t j); + this))) + (Eq.mpr + (id + (congrArg + (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(_a, newBlockVertex t j)) + (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); + this))) + (Eq.mpr + (id + (congrArg (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(C.y q, _a)) + (have this : newBlockVertex t j = C.blockVertex (D.retained t) j := + id (Q.retained_vertex_position t j); + this))) + hq))), + block_color := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + Eq.mpr + (id + (congrArg (fun (_a : E) => phi _a = some (newGamma t)) + (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := + id (Q.retained_edge_position t j); + this))) + (C.block_color (D.retained t) j), + block_color_missing_on_base := fun (t : Fin newS) => + let v : V := (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V); + have hv : v ∈ ScheideExitVertices T phi := + ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property; + Exists.casesOn (oldExitBase v hv) fun (q : Fin C.p) (hq : C.y q = v) => + let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); + Exists.intro qnew + (Eq.mpr + (id + (congrArg (fun (_a : Fin k) => _a ∈ MissingColors G phi (newVertex qnew)) + (have this : newGamma t = C.gamma (D.retained t) := Eq.refl (newGamma t); + this))) + (Eq.mpr + (id + (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) + (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); + this))) + (Eq.mpr + (id (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) hq)) + (D.retained_missing t)))), + initial_nonfirst_avoids_blocks := + fun (q : Fin (newP - (1 : ℕ))) (hq : (1 : ℕ) ≤ (↑q : ℕ)) (c : Fin k) + (hc : phi (newBaseEdge q) = some c) (r : Fin newS) => + let split : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount) := + (⟨(↑q : ℕ), by omega⟩ : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)); + have core : + ∀ (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), + (1 : ℕ) ≤ (↑n : ℕ) → + ∀ (d : Fin k), + phi + (T'.edge + (⟨(↑n : ℕ), + have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d → + ∀ (r : Fin D.retainedCount), d ≠ C.gamma (D.retained r) := + fun (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) (hn : (1 : ℕ) ≤ (↑n : ℕ)) + (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑n : ℕ), + have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + Fin.addCases (motive := fun (x : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) => + (1 : ℕ) ≤ (↑x : ℕ) → + ∀ (x_2 : Fin k), + phi + (T'.edge + (⟨(↑x : ℕ), + have hn : (↑x : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := x.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑x : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑x : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some x_2 → + ∀ (x : Fin D.retainedCount), x_2 ≠ C.gamma (D.retained x)) + (fun (u : Fin (C.p - (1 : ℕ))) + (hn : (1 : ℕ) ≤ (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ)) (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ), + have hn : + (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.castAdd ((2 : ℕ) * D.absorbedCount) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < T.length) => by + omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + have hold : + T'.edge + (⟨(↑u : ℕ), + (by + have := (u).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length) = + C.baseEdge u := + Q.base_edge_position u; + id + (fun (hn : (1 : ℕ) ≤ (↑u : ℕ)) => + C.initial_nonfirst_avoids_blocks u hn d + (Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hold))) hdedge) + (D.retained rr)) + hn) + (fun (u : Fin ((2 : ℕ) * D.absorbedCount)) + (hn : (1 : ℕ) ≤ (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ)) (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ), + have hn : + (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + let paired : Fin (D.absorbedCount * (2 : ℕ)) := + Fin.cast (Nat.mul_comm (2 : ℕ) D.absorbedCount) u; + let h : Fin D.absorbedCount := paired.divNat; + let j : Fin (2 : ℕ) := paired.modNat; + have huv : (↑u : ℕ) = (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) := + id + (Decidable.byContradiction + fun (a : ¬(↑u : ℕ) = (2 : ℕ) * ((↑u : ℕ) / (2 : ℕ)) + (↑u : ℕ) % (2 : ℕ)) => by omega); + have hedge : + T'.edge + (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), + (by + have := (h).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length) = + C.blockEdge + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j := + Q.absorbed_edge_position h j; + have hblock : + phi + (C.blockEdge + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j) = + some d := + Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hedge))) + (Eq.mpr + (id + (congrFun' + (congrArg Eq + (congrArg phi + (congrArg T'.edge + (Fin.mk.congr_simp (C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ)) + (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) + (Nat.add_assoc (C.p - (1 : ℕ)) ((2 : ℕ) * (↑h : ℕ)) (↑j : ℕ)) + ((by + have := (h).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + omega)))))) + (some d))) + (Eq.mp + (congrFun' + (congrArg Eq + (congrArg phi + (congrArg T'.edge + (Fin.mk.congr_simp (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) + (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) + (congrArg (HAdd.hAdd (C.p - (1 : ℕ))) huv) + (have hn : + (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)))))) + (some d)) + hdedge)); + have hcolor : + phi + (C.blockEdge + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j) = + some + (C.gamma + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s)) := + C.block_color + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j; + have heq : + d = + C.gamma + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) := + Eq.mp + (Option.some.injEq d + (C.gamma + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s))) + (Eq.symm (Eq.mp (congrArg (fun (_a : Option (Fin k)) => _a = some d) hcolor) hblock)); + fun (hbad : d = C.gamma (D.retained rr)) => + ((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h).property + (Exists.intro rr + (C.gamma_injective + (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) (Eq.symm heq))) + (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) hbad)) + (Eq.refl (C.gamma (D.retained rr)))))))) + n hn d hdedge rr; + core split hq c (id hc) r, + exit_covered := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => + Exists.casesOn + (Equiv.surjective D.exitEquiv + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) + fun (t : Fin D.retainedCount) + (ht : + (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) => + have htv : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := + congrArg Subtype.val ht; + Exists.intro t + (Eq.mpr (id (congrArg (fun (_a : V) => newGamma t ∈ MissingColors G phi _a) (Eq.symm htv))) + (D.retained_missing t)), + no_isolated := C.no_isolated, + globally_maximum := + (⟨C.globally_maximum.left, + (⟨Q.tashkinov, + Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = TashkinovOrder G) Q.vertex_set_eq)) + C.globally_maximum.right.right⟩ : + TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G)⟩ : + KTriple G k e0 phi ∧ + TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G), + exit_card_eq := + Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = newS) Q.exit_set_eq)) + (Eq.symm D.exit_count_eq), + exit_exactly_one := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => + Exists.casesOn + (Equiv.surjective D.exitEquiv + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) + fun (t : Fin D.retainedCount) + (ht : + (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) => + have htv : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := + congrArg Subtype.val ht; + Exists.intro t + (⟨Eq.mpr + (id + (congrArg + (fun (_a : V) => (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi _a) t) + (Eq.symm htv))) + (D.retained_missing t), + fun (t' : Fin newS) (hm : newGamma t' ∈ MissingColors G phi v) => + D.selected_unique t t' + (Eq.mp (congrArg (fun (_a : V) => newGamma t' ∈ MissingColors G phi _a) (Eq.symm htv)) + hm)⟩ : + (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) t ∧ + ∀ (y : Fin newS), (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) y → y = t), + every_block_color_at_exit := fun (t : Fin newS) => + Exists.intro (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) + (⟨Eq.mpr + (id + (congrArg + (fun (_a : Finset V) => + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ _a) + Q.exit_set_eq)) + ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property, + D.retained_missing t⟩ : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ + ScheideExitVertices T' phi ∧ + newGamma t ∈ + MissingColors G phi + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V)) : + ScheideReducedConfiguration G k e0 phi T' }; + ∀ (i : Fin C.s), + (∃! t : Fin D.retainedCount, D.retained t = i) → + (∃ (r : Fin assembled.s), + C.gamma i = assembled.gamma r ∧ + ∀ (j : Fin (2 : ℕ)), + C.blockVertex i j = assembled.blockVertex r j ∧ + C.blockEdge i j = assembled.blockEdge r j) ∨ + ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image assembled.y Finset.univ + +private abbrev helperBranch513Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), + let newP : ℕ := C.p + (2 : ℕ) * D.absorbedCount; + let newS : ℕ := D.retainedCount; + let newVertex : Fin newP → V := fun (q : Fin newP) => + T'.vertex + (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < newP := q.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a + (1 : ℕ)) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by omega)⟩ : + Fin (T'.length + (1 : ℕ))); + let newGamma : Fin newS → Fin k := fun (t : Fin newS) => C.gamma (D.retained t); + let newBlockVertex : Fin newS → Fin (2 : ℕ) → V := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + T'.vertex + (⟨C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < newS := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a + (1 : ℕ)) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : + ¬C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) => + by omega)⟩ : + Fin (T'.length + (1 : ℕ))); + let newBaseEdge : Fin (newP - (1 : ℕ)) → E := fun (q : Fin (newP - (1 : ℕ))) => + T'.edge + (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < newP - (1 : ℕ) := q.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega)⟩ : + Fin T'.length); + let newBlockEdge : Fin newS → Fin (2 : ℕ) → E := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + T'.edge + (⟨C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < newS := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : + ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length) => + by omega)⟩ : + Fin T'.length); + ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ (q : Fin C.p), C.y q = v), + let assembled : ScheideReducedConfiguration G k e0 phi T' := + { + p := newP, s := newS, + p_ge_two := + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + id + (Decidable.byContradiction fun (a : ¬(2 : ℕ) ≤ C.p + (2 : ℕ) * D.absorbedCount) => by omega), + gamma := newGamma, + gamma_injective := fun ⦃a b : Fin newS⦄ (hab : newGamma a = newGamma b) => + D.retained_injective (C.gamma_injective hab), + y := newVertex, baseEdge := newBaseEdge, blockVertex := newBlockVertex, + blockEdge := newBlockEdge, + length_eq := + id + (have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + _a + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : ¬T.length + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) => + by omega)), + base_vertex_position := fun (q : Fin newP) => + Eq.refl + (T'.vertex + (⟨(↑q : ℕ), + (by + have := (q).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin (T'.length + (1 : ℕ)))), + block_vertex_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + Eq.refl + (T'.vertex + (⟨newP + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + (by + have := (t).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin (T'.length + (1 : ℕ)))), + base_edge_position := fun (q : Fin (newP - (1 : ℕ))) => + Eq.refl + (T'.edge + (⟨(↑q : ℕ), + (by + have := (q).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length)), + block_edge_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + id + (congrArg T'.edge + (Fin.ext + (id + (have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + Decidable.byContradiction + fun + (a : + ¬C.p + (2 : ℕ) * D.absorbedCount - (1 : ℕ) + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) = + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ)) => + by omega)))), + block_attaches_to_base := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + have h : + ∃ (q : Fin C.p), + G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j) := + C.block_attaches_to_base (D.retained t) j; + Exists.casesOn h + fun (q : Fin C.p) + (hq : G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j)) => + let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); + Exists.intro qnew + (Eq.mpr + (id + (congrArg (fun (_a : E) => G.ends _a = s(newVertex qnew, newBlockVertex t j)) + (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := + id (Q.retained_edge_position t j); + this))) + (Eq.mpr + (id + (congrArg + (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(_a, newBlockVertex t j)) + (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); + this))) + (Eq.mpr + (id + (congrArg (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(C.y q, _a)) + (have this : newBlockVertex t j = C.blockVertex (D.retained t) j := + id (Q.retained_vertex_position t j); + this))) + hq))), + block_color := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + Eq.mpr + (id + (congrArg (fun (_a : E) => phi _a = some (newGamma t)) + (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := + id (Q.retained_edge_position t j); + this))) + (C.block_color (D.retained t) j), + block_color_missing_on_base := fun (t : Fin newS) => + let v : V := (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V); + have hv : v ∈ ScheideExitVertices T phi := + ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property; + Exists.casesOn (oldExitBase v hv) fun (q : Fin C.p) (hq : C.y q = v) => + let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); + Exists.intro qnew + (Eq.mpr + (id + (congrArg (fun (_a : Fin k) => _a ∈ MissingColors G phi (newVertex qnew)) + (have this : newGamma t = C.gamma (D.retained t) := Eq.refl (newGamma t); + this))) + (Eq.mpr + (id + (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) + (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); + this))) + (Eq.mpr + (id (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) hq)) + (D.retained_missing t)))), + initial_nonfirst_avoids_blocks := + fun (q : Fin (newP - (1 : ℕ))) (hq : (1 : ℕ) ≤ (↑q : ℕ)) (c : Fin k) + (hc : phi (newBaseEdge q) = some c) (r : Fin newS) => + let split : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount) := + (⟨(↑q : ℕ), by omega⟩ : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)); + have core : + ∀ (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), + (1 : ℕ) ≤ (↑n : ℕ) → + ∀ (d : Fin k), + phi + (T'.edge + (⟨(↑n : ℕ), + have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d → + ∀ (r : Fin D.retainedCount), d ≠ C.gamma (D.retained r) := + fun (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) (hn : (1 : ℕ) ≤ (↑n : ℕ)) + (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑n : ℕ), + have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + Fin.addCases (motive := fun (x : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) => + (1 : ℕ) ≤ (↑x : ℕ) → + ∀ (x_2 : Fin k), + phi + (T'.edge + (⟨(↑x : ℕ), + have hn : (↑x : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := x.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑x : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑x : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some x_2 → + ∀ (x : Fin D.retainedCount), x_2 ≠ C.gamma (D.retained x)) + (fun (u : Fin (C.p - (1 : ℕ))) + (hn : (1 : ℕ) ≤ (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ)) (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ), + have hn : + (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.castAdd ((2 : ℕ) * D.absorbedCount) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < T.length) => by + omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + have hold : + T'.edge + (⟨(↑u : ℕ), + (by + have := (u).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length) = + C.baseEdge u := + Q.base_edge_position u; + id + (fun (hn : (1 : ℕ) ≤ (↑u : ℕ)) => + C.initial_nonfirst_avoids_blocks u hn d + (Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hold))) hdedge) + (D.retained rr)) + hn) + (fun (u : Fin ((2 : ℕ) * D.absorbedCount)) + (hn : (1 : ℕ) ≤ (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ)) (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ), + have hn : + (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + let paired : Fin (D.absorbedCount * (2 : ℕ)) := + Fin.cast (Nat.mul_comm (2 : ℕ) D.absorbedCount) u; + let h : Fin D.absorbedCount := paired.divNat; + let j : Fin (2 : ℕ) := paired.modNat; + have huv : (↑u : ℕ) = (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) := + id + (Decidable.byContradiction + fun (a : ¬(↑u : ℕ) = (2 : ℕ) * ((↑u : ℕ) / (2 : ℕ)) + (↑u : ℕ) % (2 : ℕ)) => by omega); + have hedge : + T'.edge + (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), + (by + have := (h).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length) = + C.blockEdge + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j := + Q.absorbed_edge_position h j; + have hblock : + phi + (C.blockEdge + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j) = + some d := + Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hedge))) + (Eq.mpr + (id + (congrFun' + (congrArg Eq + (congrArg phi + (congrArg T'.edge + (Fin.mk.congr_simp (C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ)) + (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) + (Nat.add_assoc (C.p - (1 : ℕ)) ((2 : ℕ) * (↑h : ℕ)) (↑j : ℕ)) + ((by + have := (h).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + omega)))))) + (some d))) + (Eq.mp + (congrFun' + (congrArg Eq + (congrArg phi + (congrArg T'.edge + (Fin.mk.congr_simp (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) + (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) + (congrArg (HAdd.hAdd (C.p - (1 : ℕ))) huv) + (have hn : + (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)))))) + (some d)) + hdedge)); + have hcolor : + phi + (C.blockEdge + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j) = + some + (C.gamma + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s)) := + C.block_color + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j; + have heq : + d = + C.gamma + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) := + Eq.mp + (Option.some.injEq d + (C.gamma + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s))) + (Eq.symm (Eq.mp (congrArg (fun (_a : Option (Fin k)) => _a = some d) hcolor) hblock)); + fun (hbad : d = C.gamma (D.retained rr)) => + ((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h).property + (Exists.intro rr + (C.gamma_injective + (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) (Eq.symm heq))) + (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) hbad)) + (Eq.refl (C.gamma (D.retained rr)))))))) + n hn d hdedge rr; + core split hq c (id hc) r, + exit_covered := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => + Exists.casesOn + (Equiv.surjective D.exitEquiv + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) + fun (t : Fin D.retainedCount) + (ht : + (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) => + have htv : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := + congrArg Subtype.val ht; + Exists.intro t + (Eq.mpr (id (congrArg (fun (_a : V) => newGamma t ∈ MissingColors G phi _a) (Eq.symm htv))) + (D.retained_missing t)), + no_isolated := C.no_isolated, + globally_maximum := + (⟨C.globally_maximum.left, + (⟨Q.tashkinov, + Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = TashkinovOrder G) Q.vertex_set_eq)) + C.globally_maximum.right.right⟩ : + TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G)⟩ : + KTriple G k e0 phi ∧ + TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G), + exit_card_eq := + Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = newS) Q.exit_set_eq)) + (Eq.symm D.exit_count_eq), + exit_exactly_one := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => + Exists.casesOn + (Equiv.surjective D.exitEquiv + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) + fun (t : Fin D.retainedCount) + (ht : + (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) => + have htv : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := + congrArg Subtype.val ht; + Exists.intro t + (⟨Eq.mpr + (id + (congrArg + (fun (_a : V) => (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi _a) t) + (Eq.symm htv))) + (D.retained_missing t), + fun (t' : Fin newS) (hm : newGamma t' ∈ MissingColors G phi v) => + D.selected_unique t t' + (Eq.mp (congrArg (fun (_a : V) => newGamma t' ∈ MissingColors G phi _a) (Eq.symm htv)) + hm)⟩ : + (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) t ∧ + ∀ (y : Fin newS), (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) y → y = t), + every_block_color_at_exit := fun (t : Fin newS) => + Exists.intro (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) + (⟨Eq.mpr + (id + (congrArg + (fun (_a : Finset V) => + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ _a) + Q.exit_set_eq)) + ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property, + D.retained_missing t⟩ : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ + ScheideExitVertices T' phi ∧ + newGamma t ∈ + MissingColors G phi + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V)) : + ScheideReducedConfiguration G k e0 phi T' }; + ∀ (i : Fin C.s), + (∃ (r : Fin assembled.s), + C.gamma i = assembled.gamma r ∧ + ∀ (j : Fin (2 : ℕ)), + C.blockVertex i j = assembled.blockVertex r j ∧ C.blockEdge i j = assembled.blockEdge r j) ∨ + ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image assembled.y Finset.univ + +private abbrev helperContinuation263Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), + let newP : ℕ := C.p + (2 : ℕ) * D.absorbedCount; + let newS : ℕ := D.retainedCount; + let newVertex : Fin newP → V := fun (q : Fin newP) => + T'.vertex + (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < newP := q.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a + (1 : ℕ)) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by omega)⟩ : + Fin (T'.length + (1 : ℕ))); + let newGamma : Fin newS → Fin k := fun (t : Fin newS) => C.gamma (D.retained t); + let newBlockVertex : Fin newS → Fin (2 : ℕ) → V := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + T'.vertex + (⟨C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < newS := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a + (1 : ℕ)) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : + ¬C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) => + by omega)⟩ : + Fin (T'.length + (1 : ℕ))); + let newBaseEdge : Fin (newP - (1 : ℕ)) → E := fun (q : Fin (newP - (1 : ℕ))) => + T'.edge + (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < newP - (1 : ℕ) := q.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega)⟩ : + Fin T'.length); + let newBlockEdge : Fin newS → Fin (2 : ℕ) → E := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + T'.edge + (⟨C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < newS := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : + ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length) => + by omega)⟩ : + Fin T'.length); + ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ (q : Fin C.p), C.y q = v), + let assembled : ScheideReducedConfiguration G k e0 phi T' := + { + p := newP, s := newS, + p_ge_two := + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + id + (Decidable.byContradiction fun (a : ¬(2 : ℕ) ≤ C.p + (2 : ℕ) * D.absorbedCount) => by omega), + gamma := newGamma, + gamma_injective := fun ⦃a b : Fin newS⦄ (hab : newGamma a = newGamma b) => + D.retained_injective (C.gamma_injective hab), + y := newVertex, baseEdge := newBaseEdge, blockVertex := newBlockVertex, + blockEdge := newBlockEdge, + length_eq := + id + (have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => + _a + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) + Q.length_eq)) + (Decidable.byContradiction + fun + (a : ¬T.length + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) => + by omega)), + base_vertex_position := fun (q : Fin newP) => + Eq.refl + (T'.vertex + (⟨(↑q : ℕ), + (by + have := (q).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin (T'.length + (1 : ℕ)))), + block_vertex_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + Eq.refl + (T'.vertex + (⟨newP + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + (by + have := (t).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin (T'.length + (1 : ℕ)))), + base_edge_position := fun (q : Fin (newP - (1 : ℕ))) => + Eq.refl + (T'.edge + (⟨(↑q : ℕ), + (by + have := (q).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length)), + block_edge_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + id + (congrArg T'.edge + (Fin.ext + (id + (have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + Decidable.byContradiction + fun + (a : + ¬C.p + (2 : ℕ) * D.absorbedCount - (1 : ℕ) + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) = + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ)) => + by omega)))), + block_attaches_to_base := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + have h : + ∃ (q : Fin C.p), + G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j) := + C.block_attaches_to_base (D.retained t) j; + Exists.casesOn h + fun (q : Fin C.p) + (hq : G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j)) => + let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); + Exists.intro qnew + (Eq.mpr + (id + (congrArg (fun (_a : E) => G.ends _a = s(newVertex qnew, newBlockVertex t j)) + (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := + id (Q.retained_edge_position t j); + this))) + (Eq.mpr + (id + (congrArg + (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(_a, newBlockVertex t j)) + (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); + this))) + (Eq.mpr + (id + (congrArg (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(C.y q, _a)) + (have this : newBlockVertex t j = C.blockVertex (D.retained t) j := + id (Q.retained_vertex_position t j); + this))) + hq))), + block_color := fun (t : Fin newS) (j : Fin (2 : ℕ)) => + Eq.mpr + (id + (congrArg (fun (_a : E) => phi _a = some (newGamma t)) + (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := + id (Q.retained_edge_position t j); + this))) + (C.block_color (D.retained t) j), + block_color_missing_on_base := fun (t : Fin newS) => + let v : V := (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V); + have hv : v ∈ ScheideExitVertices T phi := + ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property; + Exists.casesOn (oldExitBase v hv) fun (q : Fin C.p) (hq : C.y q = v) => + let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); + Exists.intro qnew + (Eq.mpr + (id + (congrArg (fun (_a : Fin k) => _a ∈ MissingColors G phi (newVertex qnew)) + (have this : newGamma t = C.gamma (D.retained t) := Eq.refl (newGamma t); + this))) + (Eq.mpr + (id + (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) + (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); + this))) + (Eq.mpr + (id (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) hq)) + (D.retained_missing t)))), + initial_nonfirst_avoids_blocks := + fun (q : Fin (newP - (1 : ℕ))) (hq : (1 : ℕ) ≤ (↑q : ℕ)) (c : Fin k) + (hc : phi (newBaseEdge q) = some c) (r : Fin newS) => + let split : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount) := + (⟨(↑q : ℕ), by omega⟩ : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)); + have core : + ∀ (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), + (1 : ℕ) ≤ (↑n : ℕ) → + ∀ (d : Fin k), + phi + (T'.edge + (⟨(↑n : ℕ), + have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d → + ∀ (r : Fin D.retainedCount), d ≠ C.gamma (D.retained r) := + fun (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) (hn : (1 : ℕ) ≤ (↑n : ℕ)) + (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑n : ℕ), + have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + Fin.addCases (motive := fun (x : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) => + (1 : ℕ) ≤ (↑x : ℕ) → + ∀ (x_2 : Fin k), + phi + (T'.edge + (⟨(↑x : ℕ), + have hn : (↑x : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := x.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑x : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑x : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some x_2 → + ∀ (x : Fin D.retainedCount), x_2 ≠ C.gamma (D.retained x)) + (fun (u : Fin (C.p - (1 : ℕ))) + (hn : (1 : ℕ) ≤ (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ)) (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ), + have hn : + (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.castAdd ((2 : ℕ) * D.absorbedCount) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg + (fun (_a : ℕ) => (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < T.length) => by + omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + have hold : + T'.edge + (⟨(↑u : ℕ), + (by + have := (u).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length) = + C.baseEdge u := + Q.base_edge_position u; + id + (fun (hn : (1 : ℕ) ≤ (↑u : ℕ)) => + C.initial_nonfirst_avoids_blocks u hn d + (Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hold))) hdedge) + (D.retained rr)) + hn) + (fun (u : Fin ((2 : ℕ) * D.absorbedCount)) + (hn : (1 : ℕ) ≤ (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ)) (d : Fin k) + (hdedge : + phi + (T'.edge + (⟨(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ), + have hn : + (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d) + (rr : Fin D.retainedCount) => + let paired : Fin (D.absorbedCount * (2 : ℕ)) := + Fin.cast (Nat.mul_comm (2 : ℕ) D.absorbedCount) u; + let h : Fin D.absorbedCount := paired.divNat; + let j : Fin (2 : ℕ) := paired.modNat; + have huv : (↑u : ℕ) = (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) := + id + (Decidable.byContradiction + fun (a : ¬(↑u : ℕ) = (2 : ℕ) * ((↑u : ℕ) / (2 : ℕ)) + (↑u : ℕ) % (2 : ℕ)) => by omega); + have hedge : + T'.edge + (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), + (by + have := (h).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + dsimp only [newP, newS] at * + omega)⟩ : + Fin T'.length) = + C.blockEdge + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j := + Q.absorbed_edge_position h j; + have hblock : + phi + (C.blockEdge + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j) = + some d := + Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hedge))) + (Eq.mpr + (id + (congrFun' + (congrArg Eq + (congrArg phi + (congrArg T'.edge + (Fin.mk.congr_simp (C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ)) + (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) + (Nat.add_assoc (C.p - (1 : ℕ)) ((2 : ℕ) * (↑h : ℕ)) (↑j : ℕ)) + ((by + have := (h).isLt + have := (j).isLt + have := C.length_eq + have := D.count_eq + have := Q.length_eq + have := C.p_ge_two + omega)))))) + (some d))) + (Eq.mp + (congrFun' + (congrArg Eq + (congrArg phi + (congrArg T'.edge + (Fin.mk.congr_simp (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) + (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) + (congrArg (HAdd.hAdd (C.p - (1 : ℕ))) huv) + (have hn : + (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < + C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := + (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr + (id + (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) + Q.length_eq)) + (Decidable.byContradiction + fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)))))) + (some d)) + hdedge)); + have hcolor : + phi + (C.blockEdge + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j) = + some + (C.gamma + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s)) := + C.block_color + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) + j; + have heq : + d = + C.gamma + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s) := + Eq.mp + (Option.some.injEq d + (C.gamma + (↑((D.absorbedEquiv : + Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h) : + Fin C.s))) + (Eq.symm (Eq.mp (congrArg (fun (_a : Option (Fin k)) => _a = some d) hcolor) hblock)); + fun (hbad : d = C.gamma (D.retained rr)) => + ((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) + h).property + (Exists.intro rr + (C.gamma_injective + (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) (Eq.symm heq))) + (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) hbad)) + (Eq.refl (C.gamma (D.retained rr)))))))) + n hn d hdedge rr; + core split hq c (id hc) r, + exit_covered := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => + Exists.casesOn + (Equiv.surjective D.exitEquiv + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) + fun (t : Fin D.retainedCount) + (ht : + (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) => + have htv : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := + congrArg Subtype.val ht; + Exists.intro t + (Eq.mpr (id (congrArg (fun (_a : V) => newGamma t ∈ MissingColors G phi _a) (Eq.symm htv))) + (D.retained_missing t)), + no_isolated := C.no_isolated, + globally_maximum := + (⟨C.globally_maximum.left, + (⟨Q.tashkinov, + Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = TashkinovOrder G) Q.vertex_set_eq)) + C.globally_maximum.right.right⟩ : + TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G)⟩ : + KTriple G k e0 phi ∧ + TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G), + exit_card_eq := + Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = newS) Q.exit_set_eq)) + (Eq.symm D.exit_count_eq), + exit_exactly_one := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => + Exists.casesOn + (Equiv.surjective D.exitEquiv + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) + fun (t : Fin D.retainedCount) + (ht : + (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = + (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : + ↥(ScheideExitVertices T phi))) => + have htv : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := + congrArg Subtype.val ht; + Exists.intro t + (⟨Eq.mpr + (id + (congrArg + (fun (_a : V) => (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi _a) t) + (Eq.symm htv))) + (D.retained_missing t), + fun (t' : Fin newS) (hm : newGamma t' ∈ MissingColors G phi v) => + D.selected_unique t t' + (Eq.mp (congrArg (fun (_a : V) => newGamma t' ∈ MissingColors G phi _a) (Eq.symm htv)) + hm)⟩ : + (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) t ∧ + ∀ (y : Fin newS), (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) y → y = t), + every_block_color_at_exit := fun (t : Fin newS) => + Exists.intro (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) + (⟨Eq.mpr + (id + (congrArg + (fun (_a : Finset V) => + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ _a) + Q.exit_set_eq)) + ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property, + D.retained_missing t⟩ : + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ + ScheideExitVertices T' phi ∧ + newGamma t ∈ + MissingColors G phi + (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V)) : + ScheideReducedConfiguration G k e0 phi T' }; + ∃ (R : ScheideReducedConfiguration G k e0 phi T'), + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + (∀ (q : Fin C.p), C.y q ∈ Finset.image R.y Finset.univ) ∧ + ∀ (i : Fin C.s), + (∃ (r : Fin R.s), + C.gamma i = R.gamma r ∧ + ∀ (j : Fin (2 : ℕ)), + C.blockVertex i j = R.blockVertex r j ∧ C.blockEdge i j = R.blockEdge r j) ∨ + ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image R.y Finset.univ + +private theorem helper_branch_504.{u_1, u_2} : + helperBranch504Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D T' Q newP newS newVertex newGamma newBlockVertex newBaseEdge + newBlockEdge oldExitBase assembled i ha + obtain ⟨h, hi, _⟩ := ha + right + intro j + simp only [Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨⟨C.p + 2 * h.val + j.val, ?_⟩, ?_⟩ + · change C.p + 2 * h.val + j.val < C.p + 2 * D.absorbedCount + have hh := h.isLt + have hj := j.isLt + omega + · dsimp [assembled, newVertex] + rw [Q.absorbed_vertex_position h j] + rw [hi] + +private theorem helper_branch_516.{u_1, u_2} : + helperBranch516Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D T' Q newP newS newVertex newGamma newBlockVertex newBaseEdge + newBlockEdge oldExitBase assembled i hr + obtain ⟨t, ht, _⟩ := hr + left + refine ⟨t, ?_, ?_⟩ + · dsimp [assembled, newGamma] + rw [ht] + · intro j + constructor + · dsimp [assembled, newBlockVertex] + rw [← ht] + exact (Q.retained_vertex_position t j).symm + · dsimp [assembled, newBlockEdge] + rw [← ht] + exact (Q.retained_edge_position t j).symm + +private theorem helper_branch_513.{u_1, u_2} : + helperBranch513Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D T' Q newP newS newVertex newGamma newBlockVertex newBaseEdge + newBlockEdge oldExitBase assembled i + rcases D.partition i with ha | hr + · exact @helper_branch_504 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D T' Q oldExitBase i ha + · exact @helper_branch_516 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D T' Q oldExitBase i hr +private theorem helper_continuation_263.{u_1, u_2} : + helperContinuation263Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D T' Q newP newS newVertex newGamma newBlockVertex newBaseEdge + newBlockEdge oldExitBase assembled + refine ⟨assembled, Q.vertex_set_eq, ?_, ?_⟩ + · intro q + simp only [Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨⟨q.val, ?_⟩, ?_⟩ + · have hq := q.isLt + change q.val < C.p + 2 * D.absorbedCount + omega + · dsimp [assembled, newVertex] + exact Q.base_vertex_position q + · exact @helper_branch_513 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D T' Q oldExitBase +private theorem helper_oldExitBase_593.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T), + ∀ v ∈ ScheideExitVertices T phi, + ∃ (q : Fin C.p), + C.y q = v := by + classical + intro V E _ _ _ G k e0 phi T C v hv + have hstructure := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have helementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := + hstructure.2.2.2.1 + have hvertex : v ∈ TreeSequenceVertexSet T := by + let : DecidablePred (fun w : V => ScheideExitVertex T phi w) := Classical.decPred _ + rcases (Finset.mem_filter.mp hv).2 with ⟨u, color, defect, hu, hmiss, hdefect, + z, path, hpath, index, hindex, hvertex, hafter⟩ + exact hvertex + have baseInTree : ∀ q : Fin C.p, C.y q ∈ TreeSequenceVertexSet T := by + intro q + have hlength := C.length_eq + have witness := + (@Finset.mem_image (Fin (T.length + 1)) V (Classical.decEq V)).mpr + (⟨⟨q.val, by omega⟩, Finset.mem_univ _, C.base_vertex_position q⟩ : + ∃ a ∈ (Finset.univ : Finset (Fin (T.length + 1))), T.vertex a = C.y q) + simpa only [TreeSequenceVertexSet] using witness + obtain ⟨colorIndex, hcolor⟩ := C.exit_covered v hv + obtain ⟨base, hbase⟩ := C.block_color_missing_on_base colorIndex + have hne : v = C.y base := by + by_contra hne + have hdisjoint := helementary hvertex (baseInTree base) hne + exact (Finset.disjoint_left.mp hdisjoint) hcolor hbase + exact ⟨base, hne.symm⟩ + +private theorem helper_core_699.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), + let newP : ℕ := C.p + (2 : ℕ) * D.absorbedCount; + ∀ (_ : Fin (newP - (1 : ℕ))) (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), + (1 : ℕ) ≤ (↑n : ℕ) → + ∀ (d : Fin k), + phi + (T'.edge + (⟨(↑n : ℕ), + have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d → + ∀ (r : Fin D.retainedCount), + d ≠ C.gamma (D.retained r) := by + classical + intro V E _ _ _ _ G k e0 phi T C D T' Q newP q n hn d hdedge rr + refine Fin.addCases ?_ ?_ n hn d hdedge rr + · intro u hn d hdedge rr + have hold := Q.base_edge_position u + change 1 ≤ u.val at hn + apply C.initial_nonfirst_avoids_blocks u hn d (by + rw [← hold] + exact hdedge) (D.retained rr) + · intro u hn d hdedge rr + let paired : Fin (D.absorbedCount * 2) := + Fin.cast (Nat.mul_comm 2 D.absorbedCount) u + let h := paired.divNat + let j := paired.modNat + have huv : u.val = 2 * h.val + j.val := by + dsimp [h, j, paired, Fin.divNat, Fin.modNat] + omega + have hedge := Q.absorbed_edge_position h j + have hblock : phi (C.blockEdge (D.absorbedEquiv h).1 j) = some d := by + rw [← hedge] + simpa [huv, Nat.add_assoc] using hdedge + have hcolor := C.block_color (D.absorbedEquiv h).1 j + have heq : d = C.gamma (D.absorbedEquiv h).1 := by + rw [hcolor] at hblock + simpa using hblock.symm + intro hbad + apply (D.absorbedEquiv h).2 + refine ⟨rr, ?_⟩ + apply C.gamma_injective + rw [← heq, hbad] + +theorem ScheideStructuralReducedAssembly {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) + (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T') : + ∃ R : ScheideReducedConfiguration G k e0 phi T', + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + (∀ q : Fin C.p, C.y q ∈ Finset.univ.image R.y) ∧ + (∀ i : Fin C.s, + (∃ r : Fin R.s, + C.gamma i = R.gamma r ∧ + ∀ j : Fin 2, + C.blockVertex i j = R.blockVertex r j ∧ + C.blockEdge i j = R.blockEdge r j) ∨ + ∀ j : Fin 2, C.blockVertex i j ∈ Finset.univ.image R.y) := by + let newP := C.p + 2 * D.absorbedCount + let newS := D.retainedCount + let newVertex : Fin newP → V := fun q => + T'.vertex ⟨q.val, by + have hq := q.isLt + have hc := C.length_eq + have hd := D.count_eq + rw [Q.length_eq] + omega⟩ + let newGamma : Fin newS → Fin k := fun t => C.gamma (D.retained t) + let newBlockVertex : Fin newS → Fin 2 → V := fun t j => + T'.vertex ⟨C.p + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + rw [Q.length_eq] + omega⟩ + let newBaseEdge : Fin (newP - 1) → E := fun q => + T'.edge ⟨q.val, by + have hq := q.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + rw [Q.length_eq] + omega⟩ + let newBlockEdge : Fin newS → Fin 2 → E := fun t j => + T'.edge ⟨C.p - 1 + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + rw [Q.length_eq] + omega⟩ + have oldExitBase := @helper_oldExitBase_593 V E inferInstance inferInstance inferInstance G k e0 + phi T C + let assembled : ScheideReducedConfiguration G k e0 phi T' := { + p := newP, + s := newS, + p_ge_two := by have hp := C.p_ge_two; dsimp [newP]; omega, + gamma := newGamma, + gamma_injective := by + intro a b hab + apply D.retained_injective + apply C.gamma_injective + exact hab, + y := newVertex, + baseEdge := newBaseEdge, + blockVertex := newBlockVertex, + blockEdge := newBlockEdge, + length_eq := by + dsimp [newP, newS] + have hc := C.length_eq + have hd := D.count_eq + rw [Q.length_eq] + omega, + base_vertex_position := by + intro q + rfl, + block_vertex_position := by + intro t j + rfl, + base_edge_position := by + intro q + rfl, + block_edge_position := by + intro t j + dsimp [newBlockEdge, newP] + apply congrArg T'.edge + apply Fin.ext + change C.p + 2 * D.absorbedCount - 1 + 2 * t.val + j.val = + C.p - 1 + 2 * D.absorbedCount + 2 * t.val + j.val + have hp := C.p_ge_two + omega, + block_attaches_to_base := by + intro t j + have h := C.block_attaches_to_base (D.retained t) j + obtain ⟨q, hq⟩ := h + let qnew : Fin newP := ⟨q.val, by + dsimp [newP] + omega⟩ + refine ⟨qnew, ?_⟩ + rw [show newBlockEdge t j = C.blockEdge (D.retained t) j by + dsimp [newBlockEdge] + exact Q.retained_edge_position t j] + rw [show newVertex qnew = C.y q by + dsimp [newVertex] + exact Q.base_vertex_position q] + rw [show newBlockVertex t j = C.blockVertex (D.retained t) j by + dsimp [newBlockVertex] + exact Q.retained_vertex_position t j] + exact hq, + block_color := by + intro t j + rw [show newBlockEdge t j = C.blockEdge (D.retained t) j by + dsimp [newBlockEdge] + exact Q.retained_edge_position t j] + exact C.block_color (D.retained t) j, + block_color_missing_on_base := by + intro t + let v := (D.exitEquiv t).1 + have hv : v ∈ ScheideExitVertices T phi := (D.exitEquiv t).2 + obtain ⟨q, hq⟩ := oldExitBase v hv + let qnew : Fin newP := ⟨q.val, by dsimp [newP]; omega⟩ + refine ⟨qnew, ?_⟩ + rw [show newGamma t = C.gamma (D.retained t) by rfl] + rw [show newVertex qnew = C.y q by + dsimp [newVertex] + exact Q.base_vertex_position q] + rw [hq] + exact D.retained_missing t, + initial_nonfirst_avoids_blocks := by + intro q hq c hc r + let split : Fin ((C.p - 1) + 2 * D.absorbedCount) := ⟨q.val, by + dsimp [newP] at q ⊢ + omega⟩ + have core := @helper_core_699 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D T' Q q + apply core split (by exact hq) c + · simpa [split, newBaseEdge] using hc + exit_covered := by + intro v hv + rw [Q.exit_set_eq] at hv + obtain ⟨t, ht⟩ := (D.exitEquiv.surjective ⟨v, hv⟩) + have htv : (D.exitEquiv t).1 = v := congrArg Subtype.val ht + refine ⟨t, ?_⟩ + rw [← htv] + exact D.retained_missing t, + no_isolated := C.no_isolated, + globally_maximum := by + refine ⟨C.globally_maximum.1, Q.tashkinov, ?_⟩ + rw [Q.vertex_set_eq] + exact C.globally_maximum.2.2, + exit_card_eq := by + rw [Q.exit_set_eq] + exact D.exit_count_eq.symm, + exit_exactly_one := by + intro v hv + rw [Q.exit_set_eq] at hv + obtain ⟨t, ht⟩ := D.exitEquiv.surjective ⟨v, hv⟩ + have htv : (D.exitEquiv t).1 = v := congrArg Subtype.val ht + refine ⟨t, ?_, ?_⟩ + · rw [← htv] + exact D.retained_missing t + · intro t' hm + apply D.selected_unique t t' + rw [← htv] at hm + exact hm, + every_block_color_at_exit := by + intro t + refine ⟨(D.exitEquiv t).1, ?_, ?_⟩ + · rw [Q.exit_set_eq] + exact (D.exitEquiv t).2 + · exact D.retained_missing t + } + exact @helper_continuation_263 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D T' Q oldExitBase +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralReduction.lean b/LeanPool/GoldbergSeymour/ScheideStructuralReduction.lean new file mode 100644 index 0000000000..34a54c9306 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideStructuralReduction.lean @@ -0,0 +1,46 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideStructuralReducedAssembly +public import LeanPool.GoldbergSeymour.ScheideStructuralReordering + +public import LeanPool.GoldbergSeymour.ScheideStructuralSelection + +/-! +# Scheide Structural Reduction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideStructuralReduction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) : + ∃ (T' : TreeSequence G e0) + (R : ScheideReducedConfiguration G k e0 phi T'), + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + (∀ q : Fin C.p, C.y q ∈ Finset.univ.image R.y) ∧ + (∀ i : Fin C.s, + (∃ r : Fin R.s, C.gamma i = R.gamma r ∧ + ∀ j : Fin 2, C.blockVertex i j = R.blockVertex r j ∧ + C.blockEdge i j = R.blockEdge r j) ∨ + ∀ j : Fin 2, C.blockVertex i j ∈ Finset.univ.image R.y) := by + classical + obtain ⟨D⟩ := ScheideStructuralSelection G k e0 phi T C + obtain ⟨T', ⟨Q⟩⟩ := ScheideStructuralReordering G k e0 phi T C D + exact ⟨T', ScheideStructuralReducedAssembly G k e0 phi T C D T' Q⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralReordering.lean b/LeanPool/GoldbergSeymour/ScheideStructuralReordering.lean new file mode 100644 index 0000000000..64524c2145 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideStructuralReordering.lean @@ -0,0 +1,1270 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Logic.Equiv.Fin.Basic + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralReorderingData +public import LeanPool.GoldbergSeymour.ScheideStructuralSelectionData +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Structural Reordering + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev structuralSumFin (m n : ℕ) : Fin m ⊕ Fin n ≃ Fin (m + n) := + finSumFinEquiv + +private abbrev structuralPairFin (m : ℕ) : Fin m × Fin 2 ≃ Fin (m * 2) := + { toFun := fun x => + ⟨x.1.val * 2 + x.2.val, by + have hi := x.1.isLt + have hj := x.2.isLt + omega⟩ + invFun := fun x => (x.divNat, x.modNat) + left_inv := by + intro x + apply Prod.ext <;> apply Fin.ext + · simp [Fin.divNat] + omega + · simp [Fin.modNat] + omega + right_inv := by + intro x + apply Fin.ext + simp [Fin.divNat, Fin.modNat] + omega } + +private abbrev helperContinuation521Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideStructuralConfiguration G k e0 phi T) (D : + ScheideStructuralSelectionData G k e0 phi T C), + let blockIndex : Fin D.absorbedCount ⊕ Fin D.retainedCount → Fin C.s := Sum.elim (fun (h : Fin + D.absorbedCount) ↦ (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s)) D.retained; + ∀ (blockIndex_bijective : Function.Bijective blockIndex), + let sumFin : (m n : ℕ) → Fin m ⊕ Fin n ≃ Fin (m + n) := structuralSumFin; + let pairFin : (m : ℕ) → Fin m × Fin (2 : ℕ) ≃ Fin (m * (2 : ℕ)) := structuralPairFin; + let blockOrder : Fin (D.absorbedCount + D.retainedCount) ≃ Fin C.s := (sumFin D.absorbedCount + D.retainedCount).symm.trans (Equiv.ofBijective blockIndex blockIndex_bijective); + let reorderCore : (b : ℕ) → Fin (b + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) ≃ Fin (b + + C.s * (2 : ℕ)) := fun (b : ℕ) ↦ ((sumFin b ((D.absorbedCount + D.retainedCount) * (2 : + ℕ))).symm.trans ((Equiv.refl (Fin b)).sumCongr ((pairFin (D.absorbedCount + + D.retainedCount)).symm.trans ((blockOrder.prodCongr (Equiv.refl (Fin (2 : ℕ)))).trans + (pairFin C.s))))).trans (sumFin b (C.s * (2 : ℕ))); + ∀ (vertexNewSize : T.length + (1 : ℕ) = C.p + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) + (vertexOldSize : T.length + (1 : ℕ) = C.p + C.s * (2 : ℕ)) (edgeNewSize : T.length = C.p - + (1 : ℕ) + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) (edgeOldSize : T.length = C.p - + (1 : ℕ) + C.s * (2 : ℕ)), + let vertexOrder : Equiv.Perm (Fin (T.length + (1 : ℕ))) := (finCongr vertexNewSize).trans + ((reorderCore C.p).trans (finCongr vertexOldSize).symm); + let edgeOrder : Equiv.Perm (Fin T.length) := (finCongr edgeNewSize).trans ((reorderCore (C.p - + (1 : ℕ))).trans (finCongr edgeOldSize).symm); + ∀ (edge_cases : + ∀ (x : Fin T.length), ( + ∃ (q : Fin (C.p - (1 : ℕ))), (↑x : ℕ) = (↑q : ℕ)) ∨ ( + ∃ (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), (↑x : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + + (↑j : ℕ)) ∨ + ∃ (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), (↑x : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * + D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ)), + let newVertex : Fin (T.length + (1 : ℕ)) → V := fun (i : Fin (T.length + (1 : ℕ))) ↦ T.vertex + ((vertexOrder : (a : Fin (T.length + (1 : ℕ))) → Fin (T.length + (1 : ℕ))) i); + let newEdge : Fin T.length → E := fun (i : Fin T.length) ↦ T.edge ((edgeOrder : (a : Fin + T.length) → Fin T.length) i); + ∀ (newVertex_base : + ∀ (x : Fin (T.length + (1 : ℕ))) (hx : (↑x : ℕ) < C.p), newVertex x = T.vertex x) + (newEdge_base : + ∀ (x : Fin T.length) (hx : (↑x : ℕ) < C.p - (1 : ℕ)), newEdge x = T.edge x) + (newVertex_absorbed : + ∀ (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), newVertex (⟨C.p + (2 : ℕ) * (↑h : ℕ) + (↑j : + ℕ), + have hh : (↑h : ℕ) < D.absorbedCount := h.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; Decidable.byContradiction fun + (a : ¬C.p + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = C.blockVertex (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) + → { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) j) (newVertex_retained : + ∀ (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), newVertex (⟨C.p + (2 : ℕ) * D.absorbedCount + + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < D.retainedCount := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; Decidable.byContradiction fun + (a : ¬C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length + (1 : + ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = C.blockVertex (D.retained t) j) (newEdge_absorbed : + ∀ (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), newEdge (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + + (↑j : ℕ), + have hh : (↑h : ℕ) < D.absorbedCount := h.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; Decidable.byContradiction fun + (a : ¬C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length) = C.blockEdge (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) j) (newEdge_retained : + ∀ (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), newEdge (⟨C.p - (1 : ℕ) + (2 : ℕ) * + D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < D.retainedCount := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; Decidable.byContradiction fun + (a : ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < + T.length) ↦ + by omega + ⟩ : Fin T.length) = C.blockEdge (D.retained t) j) (newVertex_base_position : + ∀ (q : Fin C.p), newVertex (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < C.p := q.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = C.y q) (newEdge_base_position : + ∀ (q : Fin (C.p - (1 : ℕ))), newEdge (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < C.p - (1 : ℕ) := q.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬(↑q : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length) = C.baseEdge q) (newAttaches : + ∀ (x : Fin T.length), + ∃ (i : Fin ((↑x : ℕ) + (1 : ℕ))), G.ends (newEdge x) = s(newVertex x.succ, newVertex (i.castLT + (Nat.lt_trans i.isLt (Nat.succ_lt_succ x.isLt))))), + ∃ (T' : TreeSequence G e0), Nonempty (ScheideStructuralReorderingData G k e0 phi T C D T') + +private abbrev helperContinuation503Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideStructuralConfiguration G k e0 phi T) (D : + ScheideStructuralSelectionData G k e0 phi T C), + let blockIndex : Fin D.absorbedCount ⊕ Fin D.retainedCount → Fin C.s := Sum.elim (fun (h : Fin + D.absorbedCount) ↦ (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s)) D.retained; + ∀ (blockIndex_bijective : Function.Bijective blockIndex), + let sumFin : (m n : ℕ) → Fin m ⊕ Fin n ≃ Fin (m + n) := structuralSumFin; + let pairFin : (m : ℕ) → Fin m × Fin (2 : ℕ) ≃ Fin (m * (2 : ℕ)) := structuralPairFin; + let blockOrder : Fin (D.absorbedCount + D.retainedCount) ≃ Fin C.s := (sumFin D.absorbedCount + D.retainedCount).symm.trans (Equiv.ofBijective blockIndex blockIndex_bijective); + let reorderCore : (b : ℕ) → Fin (b + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) ≃ Fin (b + + C.s * (2 : ℕ)) := fun (b : ℕ) ↦ ((sumFin b ((D.absorbedCount + D.retainedCount) * (2 : + ℕ))).symm.trans ((Equiv.refl (Fin b)).sumCongr ((pairFin (D.absorbedCount + + D.retainedCount)).symm.trans ((blockOrder.prodCongr (Equiv.refl (Fin (2 : ℕ)))).trans + (pairFin C.s))))).trans (sumFin b (C.s * (2 : ℕ))); + ∀ (vertexNewSize : T.length + (1 : ℕ) = C.p + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) + (vertexOldSize : T.length + (1 : ℕ) = C.p + C.s * (2 : ℕ)) (edgeNewSize : T.length = C.p - + (1 : ℕ) + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) (edgeOldSize : T.length = C.p - + (1 : ℕ) + C.s * (2 : ℕ)), + let vertexOrder : Equiv.Perm (Fin (T.length + (1 : ℕ))) := (finCongr vertexNewSize).trans + ((reorderCore C.p).trans (finCongr vertexOldSize).symm); + let edgeOrder : Equiv.Perm (Fin T.length) := (finCongr edgeNewSize).trans ((reorderCore (C.p - + (1 : ℕ))).trans (finCongr edgeOldSize).symm); + ∀ (vertexOrder_base : + ∀ (q : Fin C.p), (vertexOrder : (a : Fin (T.length + (1 : ℕ))) → Fin (T.length + (1 : ℕ))) + (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < C.p := q.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < C.p := q.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) (vertexOrder_absorbed : + ∀ (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), (vertexOrder : (a : Fin (T.length + (1 : ℕ))) → + Fin (T.length + (1 : ℕ))) (⟨C.p + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), + have hh : (↑h : ℕ) < D.absorbedCount := h.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = (⟨C.p + (2 : ℕ) * (↑(↑((D.absorbedEquiv : (a : Fin + D.absorbedCount) → { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) + (↑j : + ℕ), + have hh : (↑(↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) < C.s := + (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s).isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) (vertexOrder_retained : + ∀ (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), (vertexOrder : (a : Fin (T.length + (1 : ℕ))) → + Fin (T.length + (1 : ℕ))) (⟨C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : + ℕ), + have ht : (↑t : ℕ) < D.retainedCount := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = (⟨C.p + (2 : ℕ) * (↑(D.retained t) : ℕ) + (↑j : ℕ), + have ht : (↑(D.retained t) : ℕ) < C.s := (D.retained t).isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) (edgeOrder_base : + ∀ (q : Fin (C.p - (1 : ℕ))), (edgeOrder : (a : Fin T.length) → Fin T.length) (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < C.p - (1 : ℕ) := q.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬(↑q : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length) = (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < C.p - (1 : ℕ) := q.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬(↑q : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length)) (edgeOrder_absorbed : + ∀ (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), (edgeOrder : (a : Fin T.length) → Fin T.length) + (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), + have hh : (↑h : ℕ) < D.absorbedCount := h.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; Decidable.byContradiction fun + (a : ¬C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length) = (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑(↑((D.absorbedEquiv : (a : Fin + D.absorbedCount) → { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) + (↑j : + ℕ), + have hh : (↑(↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) < C.s := + (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s).isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬C.p - (1 : ℕ) + (2 : ℕ) * (↑(↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) + (↑j : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length)) (edgeOrder_retained : + ∀ (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), (edgeOrder : (a : Fin T.length) → Fin T.length) + (⟨C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < D.retainedCount := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; Decidable.byContradiction fun + (a : ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < + T.length) ↦ + by omega + ⟩ : Fin T.length) = (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.retained t) : ℕ) + (↑j : ℕ), + have ht : (↑(D.retained t) : ℕ) < C.s := (D.retained t).isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.retained t) : ℕ) + (↑j : ℕ) < T.length) ↦ + by + omega + ⟩ : Fin T.length)) (edge_cases : + ∀ (x : Fin T.length), ( + ∃ (q : Fin (C.p - (1 : ℕ))), (↑x : ℕ) = (↑q : ℕ)) ∨ ( + ∃ (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), (↑x : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + + (↑j : ℕ)) ∨ + ∃ (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), (↑x : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * + D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ)), + ∃ (T' : TreeSequence G e0), Nonempty (ScheideStructuralReorderingData G k e0 phi T C D T') + +private abbrev helperContinuation309Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideStructuralConfiguration G k e0 phi T) (D : + ScheideStructuralSelectionData G k e0 phi T C), + let blockIndex : Fin D.absorbedCount ⊕ Fin D.retainedCount → Fin C.s := Sum.elim (fun (h : Fin + D.absorbedCount) ↦ (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s)) D.retained; + ∀ (blockIndex_bijective : Function.Bijective blockIndex), + let sumFin : (m n : ℕ) → Fin m ⊕ Fin n ≃ Fin (m + n) := structuralSumFin; + let pairFin : (m : ℕ) → Fin m × Fin (2 : ℕ) ≃ Fin (m * (2 : ℕ)) := structuralPairFin; + let blockOrder : Fin (D.absorbedCount + D.retainedCount) ≃ Fin C.s := (sumFin D.absorbedCount + D.retainedCount).symm.trans (Equiv.ofBijective blockIndex blockIndex_bijective); + let reorderCore : (b : ℕ) → Fin (b + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) ≃ Fin (b + + C.s * (2 : ℕ)) := fun (b : ℕ) ↦ ((sumFin b ((D.absorbedCount + D.retainedCount) * (2 : + ℕ))).symm.trans ((Equiv.refl (Fin b)).sumCongr ((pairFin (D.absorbedCount + + D.retainedCount)).symm.trans ((blockOrder.prodCongr (Equiv.refl (Fin (2 : ℕ)))).trans + (pairFin C.s))))).trans (sumFin b (C.s * (2 : ℕ))); + ∀ (reorderCore_base : + ∀ (b : ℕ) (q : Fin b), (reorderCore b : (a : Fin (b + (D.absorbedCount + D.retainedCount) * (2 + : ℕ))) → Fin (b + C.s * (2 : ℕ))) ((sumFin b ((D.absorbedCount + D.retainedCount) * (2 : + ℕ)) : (a : Fin b ⊕ Fin ((D.absorbedCount + D.retainedCount) * (2 : ℕ))) → Fin (b + + (D.absorbedCount + D.retainedCount) * (2 : ℕ))) (Sum.inl q)) = (sumFin b (C.s * (2 : ℕ)) : + (a : Fin b ⊕ Fin (C.s * (2 : ℕ))) → Fin (b + C.s * (2 : ℕ))) (Sum.inl q)) + (reorderCore_absorbed : + ∀ (b : ℕ) (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), (reorderCore b : (a : Fin (b + + (D.absorbedCount + D.retainedCount) * (2 : ℕ))) → Fin (b + C.s * (2 : ℕ))) ((sumFin b + ((D.absorbedCount + D.retainedCount) * (2 : ℕ)) : (a : Fin b ⊕ Fin ((D.absorbedCount + + D.retainedCount) * (2 : ℕ))) → Fin (b + (D.absorbedCount + D.retainedCount) * (2 : ℕ))) + (Sum.inr ((pairFin (D.absorbedCount + D.retainedCount) : (a : Fin (D.absorbedCount + + D.retainedCount) × Fin (2 : ℕ)) → Fin ((D.absorbedCount + D.retainedCount) * (2 : ℕ))) + ((sumFin D.absorbedCount D.retainedCount : (a : Fin D.absorbedCount ⊕ Fin D.retainedCount) + → Fin (D.absorbedCount + D.retainedCount)) (Sum.inl h), j)))) = (sumFin b (C.s * (2 : ℕ)) + : (a : Fin b ⊕ Fin (C.s * (2 : ℕ))) → Fin (b + C.s * (2 : ℕ))) (Sum.inr ((pairFin C.s : (a + : Fin C.s × Fin (2 : ℕ)) → Fin (C.s * (2 : ℕ))) ((↑((D.absorbedEquiv : (a : Fin + D.absorbedCount) → { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s), j)))) + (reorderCore_retained : + ∀ (b : ℕ) (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), (reorderCore b : (a : Fin (b + + (D.absorbedCount + D.retainedCount) * (2 : ℕ))) → Fin (b + C.s * (2 : ℕ))) ((sumFin b + ((D.absorbedCount + D.retainedCount) * (2 : ℕ)) : (a : Fin b ⊕ Fin ((D.absorbedCount + + D.retainedCount) * (2 : ℕ))) → Fin (b + (D.absorbedCount + D.retainedCount) * (2 : ℕ))) + (Sum.inr ((pairFin (D.absorbedCount + D.retainedCount) : (a : Fin (D.absorbedCount + + D.retainedCount) × Fin (2 : ℕ)) → Fin ((D.absorbedCount + D.retainedCount) * (2 : ℕ))) + ((sumFin D.absorbedCount D.retainedCount : (a : Fin D.absorbedCount ⊕ Fin D.retainedCount) + → Fin (D.absorbedCount + D.retainedCount)) (Sum.inr t), j)))) = (sumFin b (C.s * (2 : ℕ)) + : (a : Fin b ⊕ Fin (C.s * (2 : ℕ))) → Fin (b + C.s * (2 : ℕ))) (Sum.inr ((pairFin C.s : (a + : Fin C.s × Fin (2 : ℕ)) → Fin (C.s * (2 : ℕ))) (D.retained t, j)))) (vertexNewSize : + T.length + (1 : ℕ) = C.p + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) (vertexOldSize : + T.length + (1 : ℕ) = C.p + C.s * (2 : ℕ)) (edgeNewSize : T.length = C.p - (1 : ℕ) + + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) (edgeOldSize : T.length = C.p - (1 : ℕ) + + C.s * (2 : ℕ)), + let vertexOrder : Equiv.Perm (Fin (T.length + (1 : ℕ))) := (finCongr vertexNewSize).trans + ((reorderCore C.p).trans (finCongr vertexOldSize).symm); + let edgeOrder : Equiv.Perm (Fin T.length) := (finCongr edgeNewSize).trans ((reorderCore (C.p - + (1 : ℕ))).trans (finCongr edgeOldSize).symm); + ∀ (vertexOrder_base : + ∀ (q : Fin C.p), (vertexOrder : (a : Fin (T.length + (1 : ℕ))) → Fin (T.length + (1 : ℕ))) + (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < C.p := q.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = (⟨(↑q : ℕ), + have hq : (↑q : ℕ) < C.p := q.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) (vertexOrder_absorbed : + ∀ (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), (vertexOrder : (a : Fin (T.length + (1 : ℕ))) → + Fin (T.length + (1 : ℕ))) (⟨C.p + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), + have hh : (↑h : ℕ) < D.absorbedCount := h.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; Decidable.byContradiction fun + (a : ¬C.p + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = (⟨C.p + (2 : ℕ) * (↑(↑((D.absorbedEquiv : (a : Fin + D.absorbedCount) → { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) + (↑j : + ℕ), + have hh : (↑(↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) < C.s := + (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s).isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬C.p + (2 : ℕ) * (↑(↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) + (↑j : ℕ) < T.length + (1 + : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) (vertexOrder_retained : + ∀ (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), (vertexOrder : (a : Fin (T.length + (1 : ℕ))) → + Fin (T.length + (1 : ℕ))) (⟨C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : + ℕ), + have ht : (↑t : ℕ) < D.retainedCount := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; Decidable.byContradiction fun + (a : ¬C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length + (1 : + ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = (⟨C.p + (2 : ℕ) * (↑(D.retained t) : ℕ) + (↑j : ℕ), + have ht : (↑(D.retained t) : ℕ) < C.s := (D.retained t).isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬C.p + (2 : ℕ) * (↑(D.retained t) : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) ↦ + by + omega + ⟩ : Fin (T.length + (1 : ℕ)))), + ∃ (T' : TreeSequence G e0), Nonempty (ScheideStructuralReorderingData G k e0 phi T C D T') + +private theorem helper_blockIndex_injective_45.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideStructuralConfiguration G k e0 phi T) (D : + ScheideStructuralSelectionData G k e0 phi T C), + let blockIndex : Fin D.absorbedCount ⊕ Fin D.retainedCount → Fin C.s := Sum.elim (fun (h : Fin + D.absorbedCount) ↦ (↑((D.absorbedEquiv : Fin D.absorbedCount → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s)) D.retained; Function.Injective + blockIndex := by + classical + intro V E _ _ _ _ G k e0 phi T C D blockIndex x y hxy + cases x with + | inl h => + cases y with + | inl h' => + congr 1 + apply D.absorbedEquiv.injective + apply Subtype.ext + exact hxy + | inr t => + exfalso + exact (D.absorbedEquiv h).2 ⟨t, hxy.symm⟩ + | inr t => + cases y with + | inl h => + exfalso + exact (D.absorbedEquiv h).2 ⟨t, hxy⟩ + | inr t' => + congr 1 + exact D.retained_injective hxy + +private theorem helper_blockIndex_surjective_84.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideStructuralConfiguration G k e0 phi T) (D : + ScheideStructuralSelectionData G k e0 phi T C), + let blockIndex : Fin D.absorbedCount ⊕ Fin D.retainedCount → Fin C.s := Sum.elim (fun (h : Fin + D.absorbedCount) ↦ (↑((D.absorbedEquiv : Fin D.absorbedCount → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s)) D.retained; + Function.Surjective blockIndex := by + classical + intro V E _ _ _ _ G k e0 phi T C D blockIndex i + rcases D.partition i with h | h + · obtain ⟨a, ha, -⟩ := h + exact ⟨Sum.inl a, ha⟩ + · obtain ⟨r, hr, -⟩ := h + exact ⟨Sum.inr r, hr⟩ + +private theorem helper_continuation_521.{u_1, u_2} : + helperContinuation521Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D blockIndex blockIndex_bijective sumFin pairFin blockOrder + reorderCore vertexNewSize vertexOldSize edgeNewSize edgeOldSize vertexOrder edgeOrder + edge_cases newVertex newEdge newVertex_base newEdge_base newVertex_absorbed + newVertex_retained newEdge_absorbed newEdge_retained newVertex_base_position + newEdge_base_position newAttaches + let T' : TreeSequence G e0 := + { length := T.length + positive := T.positive + vertex := newVertex + edge := newEdge + vertex_injective := T.vertex_injective.comp vertexOrder.injective + edge_injective := T.edge_injective.comp edgeOrder.injective + first_edge := by + rw [newEdge_base _ (by have hp := C.p_ge_two; simp; omega)] + exact T.first_edge + attaches := newAttaches } + have newTashkinov : TashkinovTree G e0 phi T' := by + intro x hxnonzero + change ∃ i : Fin (x.val + 1), ∃ c : Fin k, + phi (newEdge x) = some c ∧ + c ∈ MissingColors G phi + (newVertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ x.isLt)))) + rcases edge_cases x with ⟨q, hx⟩ | ⟨h, j, hx⟩ | ⟨t, j, hx⟩ + · obtain ⟨i, c, hc, hm⟩ := C.globally_maximum.2.1 x hxnonzero + refine ⟨i, c, ?_, ?_⟩ + · rw [newEdge_base x (by omega)] + exact hc + · rw [newVertex_base _ (by + have hp := C.p_ge_two + simp + omega)] + exact hm + · obtain ⟨q, hmissing⟩ := + C.block_color_missing_on_base (D.absorbedEquiv h).1 + let i : Fin (x.val + 1) := ⟨q.val, by have hq := q.isLt; omega⟩ + refine ⟨i, C.gamma (D.absorbedEquiv h).1, ?_, ?_⟩ + · have hxeq : x = ⟨C.p - 1 + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + omega⟩ := Fin.ext hx + rw [hxeq, newEdge_absorbed] + exact C.block_color (D.absorbedEquiv h).1 j + · rw [newVertex_base _ (by have hq := q.isLt; simp [i])] + have hindex : (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ x.isLt))) = + ⟨q.val, by have hq := q.isLt; have hc := C.length_eq; omega⟩ := + Fin.ext rfl + rw [hindex, C.base_vertex_position] + exact hmissing + · obtain ⟨q, hmissing⟩ := + C.block_color_missing_on_base (D.retained t) + let i : Fin (x.val + 1) := ⟨q.val, by have hq := q.isLt; omega⟩ + refine ⟨i, C.gamma (D.retained t), ?_, ?_⟩ + · have hxeq : x = + ⟨C.p - 1 + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + omega⟩ := Fin.ext hx + rw [hxeq, newEdge_retained] + exact C.block_color (D.retained t) j + · rw [newVertex_base _ (by have hq := q.isLt; simp [i])] + have hindex : (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ x.isLt))) = + ⟨q.val, by have hq := q.isLt; have hc := C.length_eq; omega⟩ := + Fin.ext rfl + rw [hindex, C.base_vertex_position] + exact hmissing + have vertexSetEq : TreeSequenceVertexSet T' = TreeSequenceVertexSet T := by + ext v + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + constructor + · rintro ⟨i, hi⟩ + exact ⟨vertexOrder i, by simpa [T', newVertex] using hi⟩ + · rintro ⟨i, hi⟩ + refine ⟨vertexOrder.symm i, ?_⟩ + simpa [T', newVertex] using hi + refine ⟨T', ⟨?_⟩⟩ + refine + { length_eq := rfl + base_vertex_position := ?_ + absorbed_vertex_position := ?_ + retained_vertex_position := ?_ + base_edge_position := ?_ + absorbed_edge_position := ?_ + retained_edge_position := ?_ + tashkinov := newTashkinov + vertex_set_eq := vertexSetEq + exit_set_eq := ?_ } + · intro q + simpa [T'] using newVertex_base_position q + · intro h j + simpa [T'] using newVertex_absorbed h j + · intro t j + simpa [T'] using newVertex_retained t j + · intro q + simpa [T'] using newEdge_base_position q + · intro h j + simpa [T'] using newEdge_absorbed h j + · intro t j + simpa [T'] using newEdge_retained t j + · classical + unfold ScheideExitVertices + apply Finset.filter_congr + intro v hv + simp only [ScheideExitVertex, ScheideDefectiveChainPath, vertexSetEq] + +private theorem helper_continuation_503.{u_1, u_2} : + helperContinuation503Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D blockIndex blockIndex_bijective sumFin pairFin blockOrder + reorderCore vertexNewSize vertexOldSize edgeNewSize edgeOldSize vertexOrder edgeOrder + vertexOrder_base vertexOrder_absorbed vertexOrder_retained edgeOrder_base + edgeOrder_absorbed edgeOrder_retained edge_cases + let newVertex : Fin (T.length + 1) → V := fun i => T.vertex (vertexOrder i) + let newEdge : Fin T.length → E := fun i => T.edge (edgeOrder i) + have newVertex_base (x : Fin (T.length + 1)) (hx : x.val < C.p) : + newVertex x = T.vertex x := by + let q : Fin C.p := ⟨x.val, hx⟩ + have horder := vertexOrder_base q + have hqx : (⟨q.val, by + have hq := q.isLt + have hc := C.length_eq + omega⟩ : Fin (T.length + 1)) = x := Fin.ext rfl + simpa [newVertex, hqx] using congrArg T.vertex horder + have newEdge_base (x : Fin T.length) (hx : x.val < C.p - 1) : + newEdge x = T.edge x := by + let q : Fin (C.p - 1) := ⟨x.val, hx⟩ + have horder := edgeOrder_base q + have hqx : (⟨q.val, by + have hq := q.isLt + have hp := C.p_ge_two + have hc := C.length_eq + omega⟩ : Fin T.length) = x := Fin.ext rfl + simpa [newEdge, hqx] using congrArg T.edge horder + have newVertex_absorbed (h : Fin D.absorbedCount) (j : Fin 2) : + newVertex ⟨C.p + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + omega⟩ = C.blockVertex (D.absorbedEquiv h).1 j := by + change T.vertex (vertexOrder _) = _ + rw [vertexOrder_absorbed] + exact C.block_vertex_position (D.absorbedEquiv h).1 j + have newVertex_retained (t : Fin D.retainedCount) (j : Fin 2) : + newVertex + ⟨C.p + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + omega⟩ = C.blockVertex (D.retained t) j := by + change T.vertex (vertexOrder _) = _ + rw [vertexOrder_retained] + exact C.block_vertex_position (D.retained t) j + have newEdge_absorbed (h : Fin D.absorbedCount) (j : Fin 2) : + newEdge ⟨C.p - 1 + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + omega⟩ = C.blockEdge (D.absorbedEquiv h).1 j := by + change T.edge (edgeOrder _) = _ + rw [edgeOrder_absorbed] + exact C.block_edge_position (D.absorbedEquiv h).1 j + have newEdge_retained (t : Fin D.retainedCount) (j : Fin 2) : + newEdge + ⟨C.p - 1 + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + omega⟩ = C.blockEdge (D.retained t) j := by + change T.edge (edgeOrder _) = _ + rw [edgeOrder_retained] + exact C.block_edge_position (D.retained t) j + have newVertex_base_position (q : Fin C.p) : + newVertex ⟨q.val, by + have hq := q.isLt + have hc := C.length_eq + omega⟩ = C.y q := by + change T.vertex (vertexOrder _) = _ + rw [vertexOrder_base] + exact C.base_vertex_position q + have newEdge_base_position (q : Fin (C.p - 1)) : + newEdge ⟨q.val, by + have hq := q.isLt + have hp := C.p_ge_two + have hc := C.length_eq + omega⟩ = C.baseEdge q := by + change T.edge (edgeOrder _) = _ + rw [edgeOrder_base] + exact C.base_edge_position q + have newAttaches : + ∀ x : Fin T.length, + ∃ i : Fin (x.val + 1), G.ends (newEdge x) = s(newVertex x.succ, newVertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ x.isLt)))) := by + intro x + rcases edge_cases x with ⟨q, hx⟩ | ⟨h, j, hx⟩ | ⟨t, j, hx⟩ + · obtain ⟨i, hi⟩ := T.attaches x + refine ⟨i, ?_⟩ + have hp := C.p_ge_two + rw [newEdge_base x (by omega)] + rw [newVertex_base x.succ (by simp; omega)] + rw [newVertex_base + (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ x.isLt))) + (by simp; omega)] + exact hi + · have hxeq : x = ⟨C.p - 1 + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + omega⟩ := Fin.ext hx + obtain ⟨q, hends⟩ := C.block_attaches_to_base + (D.absorbedEquiv h).1 j + let i : Fin (x.val + 1) := + ⟨q.val, by have hq := q.isLt; omega⟩ + refine ⟨i, ?_⟩ + have hedge : newEdge x = C.blockEdge (D.absorbedEquiv h).1 j := by + rw [hxeq, newEdge_absorbed] + rw [hedge] + have hsucc : x.succ = + ⟨C.p + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + omega⟩ := Fin.ext (by simp; omega) + rw [hsucc, newVertex_absorbed] + rw [newVertex_base _ (by have hq := q.isLt; simp [i])] + have hindex : (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ x.isLt))) = + ⟨q.val, by have hq := q.isLt; have hc := C.length_eq; omega⟩ := + Fin.ext rfl + rw [hindex, C.base_vertex_position] + exact hends.trans Sym2.eq_swap + · have hxeq : x = + ⟨C.p - 1 + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + omega⟩ := Fin.ext hx + obtain ⟨q, hends⟩ := C.block_attaches_to_base (D.retained t) j + let i : Fin (x.val + 1) := ⟨q.val, by have hq := q.isLt; omega⟩ + refine ⟨i, ?_⟩ + have hedge : newEdge x = C.blockEdge (D.retained t) j := by + rw [hxeq, newEdge_retained] + rw [hedge] + have hsucc : x.succ = + ⟨C.p + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + omega⟩ := Fin.ext (by simp; omega) + rw [hsucc, newVertex_retained] + rw [newVertex_base _ (by have hq := q.isLt; simp [i])] + have hindex : (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ x.isLt))) = + ⟨q.val, by have hq := q.isLt; have hc := C.length_eq; omega⟩ := + Fin.ext rfl + rw [hindex, C.base_vertex_position] + exact hends.trans Sym2.eq_swap + exact @helper_continuation_521 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@blockIndex_bijective) + (@vertexNewSize) (@vertexOldSize) (@edgeNewSize) (@edgeOldSize) (@edge_cases) + (@newVertex_base) (@newEdge_base) (@newVertex_absorbed) (@newVertex_retained) + (@newEdge_absorbed) (@newEdge_retained) (@newVertex_base_position) (@newEdge_base_position) + (@newAttaches) +private theorem helper_edgeOrder_absorbed_972.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideStructuralConfiguration G k e0 phi T) (D : + ScheideStructuralSelectionData G k e0 phi T C), + let blockIndex : Fin D.absorbedCount ⊕ Fin D.retainedCount → Fin C.s := Sum.elim (fun (h : Fin + D.absorbedCount) ↦ (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s)) D.retained; + ∀ (blockIndex_bijective : Function.Bijective blockIndex), + let sumFin : (m n : ℕ) → Fin m ⊕ Fin n ≃ Fin (m + n) := structuralSumFin; + let pairFin : (m : ℕ) → Fin m × Fin (2 : ℕ) ≃ Fin (m * (2 : ℕ)) := structuralPairFin; + let blockOrder : Fin (D.absorbedCount + D.retainedCount) ≃ Fin C.s := (sumFin D.absorbedCount + D.retainedCount).symm.trans (Equiv.ofBijective blockIndex blockIndex_bijective); + let reorderCore : (b : ℕ) → Fin (b + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) ≃ Fin (b + + C.s * (2 : ℕ)) := fun (b : ℕ) ↦ ((sumFin b ((D.absorbedCount + D.retainedCount) * (2 : + ℕ))).symm.trans ((Equiv.refl (Fin b)).sumCongr ((pairFin (D.absorbedCount + + D.retainedCount)).symm.trans ((blockOrder.prodCongr (Equiv.refl (Fin (2 : ℕ)))).trans + (pairFin C.s))))).trans (sumFin b (C.s * (2 : ℕ))); + ∀ (_ : + ∀ (b : ℕ) (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), (reorderCore b : (a : Fin (b + + (D.absorbedCount + D.retainedCount) * (2 : ℕ))) → Fin (b + C.s * (2 : ℕ))) ((sumFin b + ((D.absorbedCount + D.retainedCount) * (2 : ℕ)) : (a : Fin b ⊕ Fin ((D.absorbedCount + + D.retainedCount) * (2 : ℕ))) → Fin (b + (D.absorbedCount + D.retainedCount) * (2 : ℕ))) + (Sum.inr ((pairFin (D.absorbedCount + D.retainedCount) : (a : Fin (D.absorbedCount + + D.retainedCount) × Fin (2 : ℕ)) → Fin ((D.absorbedCount + D.retainedCount) * (2 : ℕ))) + ((sumFin D.absorbedCount D.retainedCount : (a : Fin D.absorbedCount ⊕ Fin D.retainedCount) + → Fin (D.absorbedCount + D.retainedCount)) (Sum.inl h), j)))) = (sumFin b (C.s * (2 : ℕ)) + : (a : Fin b ⊕ Fin (C.s * (2 : ℕ))) → Fin (b + C.s * (2 : ℕ))) (Sum.inr ((pairFin C.s : (a + : Fin C.s × Fin (2 : ℕ)) → Fin (C.s * (2 : ℕ))) ((↑((D.absorbedEquiv : (a : Fin + D.absorbedCount) → { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s), j)))) + (vertexNewSize : T.length + (1 : ℕ) = C.p + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) + (vertexOldSize : T.length + (1 : ℕ) = C.p + C.s * (2 : ℕ)) (edgeNewSize : T.length = C.p - + (1 : ℕ) + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) (edgeOldSize : T.length = C.p - + (1 : ℕ) + C.s * (2 : ℕ)), + let edgeOrder : Equiv.Perm (Fin T.length) := (finCongr edgeNewSize).trans ((reorderCore (C.p - + (1 : ℕ))).trans (finCongr edgeOldSize).symm); + ∀ (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), (edgeOrder : (a : Fin T.length) → Fin T.length) + (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), + have hh : (↑h : ℕ) < D.absorbedCount := h.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have _ : (2 : ℕ) ≤ C.p := C.p_ge_two; + have _ : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have _ : C.s = D.absorbedCount + D.retainedCount := D.count_eq; Decidable.byContradiction fun + (a : ¬C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) < T.length) ↦ + by + omega + ⟩ : Fin T.length) = (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑(↑((D.absorbedEquiv : (a : Fin + D.absorbedCount) → { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) + (↑j : + ℕ), + have hh : (↑(↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) < C.s := + (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s).isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have _ : (2 : ℕ) ≤ C.p := C.p_ge_two; + have _ : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬C.p - (1 : ℕ) + (2 : ℕ) * (↑(↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s) : ℕ) + (↑j : ℕ) < T.length) ↦ + by + omega + ⟩ : Fin T.length) := by + classical + intro V E _ _ _ _ G k e0 phi T C D blockIndex blockIndex_bijective sumFin pairFin blockOrder + reorderCore reorderCore_absorbed vertexNewSize vertexOldSize edgeNewSize edgeOldSize + edgeOrder h j + apply Fin.ext + simp only [edgeOrder, Equiv.trans_apply] + have hinput : (⟨C.p - 1 + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + omega⟩ : Fin ((C.p - 1) + + (D.absorbedCount + D.retainedCount) * 2)) = + sumFin (C.p - 1) ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inr (pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inl h), j))) := by + apply Fin.ext + simp [sumFin, pairFin] + omega + have hcast : (finCongr edgeNewSize) + ⟨C.p - 1 + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + omega⟩ = + sumFin (C.p - 1) ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inr (pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inl h), j))) := by + exact hinput + rw [hcast, reorderCore_absorbed] + simp [sumFin, pairFin] + omega + +private theorem helper_edgeOrder_retained_1017.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideStructuralConfiguration G k e0 phi T) (D : + ScheideStructuralSelectionData G k e0 phi T C), + let blockIndex : Fin D.absorbedCount ⊕ Fin D.retainedCount → Fin C.s := Sum.elim (fun (h : Fin + D.absorbedCount) ↦ (↑((D.absorbedEquiv : (a : Fin D.absorbedCount) → + { i : Fin C.s // i ∉ Set.range D.retained }) h) : Fin C.s)) D.retained; + ∀ (blockIndex_bijective : Function.Bijective blockIndex), + let sumFin : (m n : ℕ) → Fin m ⊕ Fin n ≃ Fin (m + n) := structuralSumFin; + let pairFin : (m : ℕ) → Fin m × Fin (2 : ℕ) ≃ Fin (m * (2 : ℕ)) := structuralPairFin; + let blockOrder : Fin (D.absorbedCount + D.retainedCount) ≃ Fin C.s := (sumFin D.absorbedCount + D.retainedCount).symm.trans (Equiv.ofBijective blockIndex blockIndex_bijective); + let reorderCore : (b : ℕ) → Fin (b + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) ≃ Fin (b + + C.s * (2 : ℕ)) := fun (b : ℕ) ↦ ((sumFin b ((D.absorbedCount + D.retainedCount) * (2 : + ℕ))).symm.trans ((Equiv.refl (Fin b)).sumCongr ((pairFin (D.absorbedCount + + D.retainedCount)).symm.trans ((blockOrder.prodCongr (Equiv.refl (Fin (2 : ℕ)))).trans + (pairFin C.s))))).trans (sumFin b (C.s * (2 : ℕ))); + ∀ (_ : + ∀ (b : ℕ) (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), (reorderCore b : (a : Fin (b + + (D.absorbedCount + D.retainedCount) * (2 : ℕ))) → Fin (b + C.s * (2 : ℕ))) ((sumFin b + ((D.absorbedCount + D.retainedCount) * (2 : ℕ)) : (a : Fin b ⊕ Fin ((D.absorbedCount + + D.retainedCount) * (2 : ℕ))) → Fin (b + (D.absorbedCount + D.retainedCount) * (2 : ℕ))) + (Sum.inr ((pairFin (D.absorbedCount + D.retainedCount) : (a : Fin (D.absorbedCount + + D.retainedCount) × Fin (2 : ℕ)) → Fin ((D.absorbedCount + D.retainedCount) * (2 : ℕ))) + ((sumFin D.absorbedCount D.retainedCount : (a : Fin D.absorbedCount ⊕ Fin D.retainedCount) + → Fin (D.absorbedCount + D.retainedCount)) (Sum.inr t), j)))) = (sumFin b (C.s * (2 : ℕ)) + : (a : Fin b ⊕ Fin (C.s * (2 : ℕ))) → Fin (b + C.s * (2 : ℕ))) (Sum.inr ((pairFin C.s : (a + : Fin C.s × Fin (2 : ℕ)) → Fin (C.s * (2 : ℕ))) (D.retained t, j)))) (vertexNewSize : + T.length + (1 : ℕ) = C.p + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) (vertexOldSize : + T.length + (1 : ℕ) = C.p + C.s * (2 : ℕ)) (edgeNewSize : T.length = C.p - (1 : ℕ) + + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) (edgeOldSize : T.length = C.p - (1 : ℕ) + + C.s * (2 : ℕ)), + let edgeOrder : Equiv.Perm (Fin T.length) := (finCongr edgeNewSize).trans ((reorderCore (C.p - + (1 : ℕ))).trans (finCongr edgeOldSize).symm); + ∀ (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), (edgeOrder : (a : Fin T.length) → Fin T.length) + (⟨C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), + have ht : (↑t : ℕ) < D.retainedCount := t.isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have _ : (2 : ℕ) ≤ C.p := C.p_ge_two; + have _ : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have _ : C.s = D.absorbedCount + D.retainedCount := D.count_eq; Decidable.byContradiction fun + (a : ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < + T.length) ↦ + by + omega + ⟩ : Fin T.length) = (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.retained t) : ℕ) + (↑j : ℕ), + have ht : (↑(D.retained t) : ℕ) < C.s := (D.retained t).isLt; + have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; + have _ : (2 : ℕ) ≤ C.p := C.p_ge_two; + have _ : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; Decidable.byContradiction + fun (a : ¬C.p - (1 : ℕ) + (2 : ℕ) * (↑(D.retained t) : ℕ) + (↑j : ℕ) < T.length) ↦ + by + omega + ⟩ : Fin T.length) := by + classical + intro V E _ _ _ _ G k e0 phi T C D blockIndex blockIndex_bijective sumFin pairFin blockOrder + reorderCore reorderCore_retained vertexNewSize vertexOldSize edgeNewSize edgeOldSize + edgeOrder t j + apply Fin.ext + simp only [edgeOrder, Equiv.trans_apply] + have hinput : + (⟨C.p - 1 + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + omega⟩ : Fin ((C.p - 1) + + (D.absorbedCount + D.retainedCount) * 2)) = + sumFin (C.p - 1) ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inr (pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inr t), j))) := by + apply Fin.ext + simp [sumFin, pairFin] + omega + have hcast : (finCongr edgeNewSize) + ⟨C.p - 1 + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + omega⟩ = + sumFin (C.p - 1) ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inr (pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inr t), j))) := by + exact hinput + rw [hcast, reorderCore_retained] + simp [sumFin, pairFin] + omega + +private theorem helper_edge_cases_1064.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideStructuralConfiguration G k e0 phi T) (D : + ScheideStructuralSelectionData G k e0 phi T C), + let _ : (m n : ℕ) → Fin m ⊕ Fin n ≃ Fin (m + n) := structuralSumFin; + let _ : (m : ℕ) → Fin m × Fin (2 : ℕ) ≃ Fin (m * (2 : ℕ)) := structuralPairFin; + ∀ (_ : T.length + (1 : ℕ) = C.p + (D.absorbedCount + D.retainedCount) * (2 : ℕ)) (_ : T.length + + (1 : ℕ) = C.p + C.s * (2 : ℕ)) (_ : T.length = C.p - (1 : ℕ) + (D.absorbedCount + + D.retainedCount) * (2 : ℕ)) (x : Fin T.length), ( + ∃ (q : Fin (C.p - (1 : ℕ))), (↑x : ℕ) = (↑q : ℕ)) ∨ ( + ∃ (h : Fin D.absorbedCount) (j : Fin (2 : ℕ)), (↑x : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + + (↑j : ℕ)) ∨ + ∃ (t : Fin D.retainedCount) (j : Fin (2 : ℕ)), (↑x : ℕ) = C.p - (1 : ℕ) + (2 : ℕ) * + D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) := by + classical + intro V E _ _ _ _ G k e0 phi T C D sumFin pairFin vertexNewSize vertexOldSize edgeNewSize x + let xn := finCongr edgeNewSize x + generalize hout : + (sumFin (C.p - 1) ((D.absorbedCount + D.retainedCount) * 2)).symm xn = + outer + cases outer with + | inl q => + left + refine ⟨q, ?_⟩ + have heq : xn = + sumFin (C.p - 1) ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inl q) := by + rw [← hout] + exact (sumFin (C.p - 1) + ((D.absorbedCount + D.retainedCount) * 2)).apply_symm_apply xn |>.symm + exact congrArg Fin.val heq + | inr z => + right + generalize hpair : + (pairFin (D.absorbedCount + D.retainedCount)).symm z = ij + obtain ⟨i, j⟩ := ij + generalize hslot : + (sumFin D.absorbedCount D.retainedCount).symm i = slot + cases slot with + | inl h => + left + refine ⟨h, j, ?_⟩ + have hi : i = sumFin D.absorbedCount D.retainedCount + (Sum.inl h) := by + rw [← hslot] + exact (sumFin D.absorbedCount + D.retainedCount).apply_symm_apply i |>.symm + have hz : z = pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inl h), j) := by + calc + z = pairFin (D.absorbedCount + D.retainedCount) (i, j) := by + rw [← hpair] + exact (pairFin + (D.absorbedCount + D.retainedCount)).apply_symm_apply z |>.symm + _ = _ := by rw [hi] + have hx : xn = + sumFin (C.p - 1) + ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inr (pairFin + (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount + (Sum.inl h), j))) := by + calc + xn = sumFin (C.p - 1) + ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inr z) := by + rw [← hout] + exact (sumFin (C.p - 1) + ((D.absorbedCount + D.retainedCount) * 2)).apply_symm_apply xn |>.symm + _ = _ := by rw [hz] + have hv := congrArg Fin.val hx + simp [xn, sumFin, pairFin] at hv + omega + | inr t => + right + refine ⟨t, j, ?_⟩ + have hi : i = sumFin D.absorbedCount D.retainedCount + (Sum.inr t) := by + rw [← hslot] + exact (sumFin D.absorbedCount + D.retainedCount).apply_symm_apply i |>.symm + have hz : z = pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inr t), j) := by + calc + z = pairFin (D.absorbedCount + D.retainedCount) (i, j) := by + rw [← hpair] + exact (pairFin + (D.absorbedCount + D.retainedCount)).apply_symm_apply z |>.symm + _ = _ := by rw [hi] + have hx : xn = + sumFin (C.p - 1) + ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inr (pairFin + (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount + (Sum.inr t), j))) := by + calc + xn = sumFin (C.p - 1) + ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inr z) := by + rw [← hout] + exact (sumFin (C.p - 1) + ((D.absorbedCount + D.retainedCount) * 2)).apply_symm_apply xn |>.symm + _ = _ := by rw [hz] + have hv := congrArg Fin.val hx + simp [xn, sumFin, pairFin] at hv + omega + +private theorem helper_continuation_309.{u_1, u_2} : + helperContinuation309Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D blockIndex blockIndex_bijective sumFin pairFin blockOrder + reorderCore reorderCore_base reorderCore_absorbed reorderCore_retained vertexNewSize + vertexOldSize edgeNewSize edgeOldSize vertexOrder edgeOrder vertexOrder_base + vertexOrder_absorbed vertexOrder_retained + have edgeOrder_base (q : Fin (C.p - 1)) : + edgeOrder ⟨q.val, by + have hq := q.isLt + have hp := C.p_ge_two + have hc := C.length_eq + omega⟩ = ⟨q.val, by + have hq := q.isLt + have hp := C.p_ge_two + have hc := C.length_eq + omega⟩ := by + apply Fin.ext + change ((reorderCore (C.p - 1)) + (sumFin (C.p - 1) ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inl q))).val = q.val + rw [reorderCore_base] + rfl + have edgeOrder_absorbed := @helper_edgeOrder_absorbed_972 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@blockIndex_bijective) + (@reorderCore_absorbed) (@vertexNewSize) (@vertexOldSize) (@edgeNewSize) (@edgeOldSize) + have edgeOrder_retained := @helper_edgeOrder_retained_1017 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@blockIndex_bijective) + (@reorderCore_retained) (@vertexNewSize) (@vertexOldSize) (@edgeNewSize) (@edgeOldSize) + have edge_cases := @helper_edge_cases_1064 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@vertexNewSize) (@vertexOldSize) + (@edgeNewSize) + exact @helper_continuation_503 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@blockIndex_bijective) + (@vertexNewSize) (@vertexOldSize) (@edgeNewSize) (@edgeOldSize) (@vertexOrder_base) + (@vertexOrder_absorbed) (@vertexOrder_retained) (@edgeOrder_base) (@edgeOrder_absorbed) + (@edgeOrder_retained) (@edge_cases) +theorem ScheideStructuralReordering {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) : + ∃ T' : TreeSequence G e0, + Nonempty (ScheideStructuralReorderingData G k e0 phi T C D T') := by + let blockIndex : Fin D.absorbedCount ⊕ Fin D.retainedCount → Fin C.s := + Sum.elim (fun h => (D.absorbedEquiv h).1) D.retained + have blockIndex_injective : Function.Injective blockIndex := by + apply helper_blockIndex_injective_45 + have blockIndex_surjective : Function.Surjective blockIndex := by + apply helper_blockIndex_surjective_84 + have blockIndex_bijective : Function.Bijective blockIndex := + ⟨blockIndex_injective, blockIndex_surjective⟩ + let sumFin := structuralSumFin + let pairFin := structuralPairFin + let blockOrder : Fin (D.absorbedCount + D.retainedCount) ≃ Fin C.s := + (sumFin D.absorbedCount D.retainedCount).symm.trans + (Equiv.ofBijective blockIndex blockIndex_bijective) + have blockOrder_absorbed (h : Fin D.absorbedCount) : + blockOrder (sumFin D.absorbedCount D.retainedCount (Sum.inl h)) = + (D.absorbedEquiv h).1 := by + simp only [blockOrder, Equiv.trans_apply] + rw [(sumFin D.absorbedCount D.retainedCount).symm_apply_apply] + exact (Equiv.ofBijective_apply blockIndex blockIndex_bijective _).trans rfl + have blockOrder_retained (t : Fin D.retainedCount) : + blockOrder (sumFin D.absorbedCount D.retainedCount (Sum.inr t)) = + D.retained t := by + simp only [blockOrder, Equiv.trans_apply] + rw [(sumFin D.absorbedCount D.retainedCount).symm_apply_apply] + exact (Equiv.ofBijective_apply blockIndex blockIndex_bijective _).trans rfl + let reorderCore (b : ℕ) : + Fin (b + (D.absorbedCount + D.retainedCount) * 2) ≃ + Fin (b + C.s * 2) := + (sumFin b ((D.absorbedCount + D.retainedCount) * 2)).symm |>.trans + (Equiv.sumCongr (Equiv.refl (Fin b)) + ((pairFin (D.absorbedCount + D.retainedCount)).symm |>.trans + ((Equiv.prodCongr blockOrder (Equiv.refl (Fin 2))).trans + (pairFin C.s)))) |>.trans + (sumFin b (C.s * 2)) + have reorderCore_base (b : ℕ) (q : Fin b) : + reorderCore b + (sumFin b ((D.absorbedCount + D.retainedCount) * 2) (Sum.inl q)) = + sumFin b (C.s * 2) (Sum.inl q) := by + simp [reorderCore] + have reorderCore_absorbed (b : ℕ) (h : Fin D.absorbedCount) + (j : Fin 2) : + reorderCore b + (sumFin b ((D.absorbedCount + D.retainedCount) * 2) (Sum.inr + (pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inl h), j)))) = + sumFin b (C.s * 2) (Sum.inr + (pairFin C.s ((D.absorbedEquiv h).1, j))) := by + simp [reorderCore, blockOrder_absorbed] + have reorderCore_retained (b : ℕ) (t : Fin D.retainedCount) + (j : Fin 2) : + reorderCore b + (sumFin b ((D.absorbedCount + D.retainedCount) * 2) (Sum.inr + (pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inr t), j)))) = + sumFin b (C.s * 2) (Sum.inr + (pairFin C.s (D.retained t, j))) := by + simp [reorderCore, blockOrder_retained] + have vertexNewSize : + T.length + 1 = C.p + (D.absorbedCount + D.retainedCount) * 2 := by + have hc := C.length_eq + have hd := D.count_eq + omega + have vertexOldSize : T.length + 1 = C.p + C.s * 2 := by + have hc := C.length_eq + omega + have edgeNewSize : + T.length = (C.p - 1) + (D.absorbedCount + D.retainedCount) * 2 := by + have hc := C.length_eq + have hd := D.count_eq + have hp := C.p_ge_two + omega + have edgeOldSize : T.length = (C.p - 1) + C.s * 2 := by + have hc := C.length_eq + have hp := C.p_ge_two + omega + let vertexOrder : Equiv.Perm (Fin (T.length + 1)) := + (finCongr vertexNewSize).trans + ((reorderCore C.p).trans (finCongr vertexOldSize).symm) + let edgeOrder : Equiv.Perm (Fin T.length) := + (finCongr edgeNewSize).trans + ((reorderCore (C.p - 1)).trans (finCongr edgeOldSize).symm) + have vertexOrder_base (q : Fin C.p) : + vertexOrder ⟨q.val, by + have hq := q.isLt + have hc := C.length_eq + omega⟩ = ⟨q.val, by + have hq := q.isLt + have hc := C.length_eq + omega⟩ := by + apply Fin.ext + change ((reorderCore C.p) + (sumFin C.p ((D.absorbedCount + D.retainedCount) * 2) + (Sum.inl q))).val = q.val + rw [reorderCore_base] + rfl + have vertexOrder_absorbed (h : Fin D.absorbedCount) (j : Fin 2) : + vertexOrder ⟨C.p + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + omega⟩ = + ⟨C.p + 2 * (D.absorbedEquiv h).1.val + j.val, by + have hh := (D.absorbedEquiv h).1.isLt + have hj := j.isLt + have hc := C.length_eq + omega⟩ := by + apply Fin.ext + simp only [vertexOrder, Equiv.trans_apply] + have hinput : (⟨C.p + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + omega⟩ : Fin (C.p + (D.absorbedCount + D.retainedCount) * 2)) = + sumFin C.p ((D.absorbedCount + D.retainedCount) * 2) (Sum.inr + (pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inl h), j))) := by + apply Fin.ext + simp [sumFin, pairFin] + omega + have hcast : (finCongr vertexNewSize) ⟨C.p + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + omega⟩ = + sumFin C.p ((D.absorbedCount + D.retainedCount) * 2) (Sum.inr + (pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inl h), j))) := by + exact hinput + rw [hcast, reorderCore_absorbed] + simp [sumFin, pairFin] + omega + have vertexOrder_retained (t : Fin D.retainedCount) (j : Fin 2) : + vertexOrder ⟨C.p + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + omega⟩ = + ⟨C.p + 2 * (D.retained t).val + j.val, by + have ht := (D.retained t).isLt + have hj := j.isLt + have hc := C.length_eq + omega⟩ := by + apply Fin.ext + simp only [vertexOrder, Equiv.trans_apply] + have hinput : (⟨C.p + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + omega⟩ : Fin (C.p + (D.absorbedCount + D.retainedCount) * 2)) = + sumFin C.p ((D.absorbedCount + D.retainedCount) * 2) (Sum.inr + (pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inr t), j))) := by + apply Fin.ext + simp [sumFin, pairFin] + omega + have hcast : (finCongr vertexNewSize) + ⟨C.p + 2 * D.absorbedCount + 2 * t.val + j.val, by + have ht := t.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + omega⟩ = + sumFin C.p ((D.absorbedCount + D.retainedCount) * 2) (Sum.inr + (pairFin (D.absorbedCount + D.retainedCount) + (sumFin D.absorbedCount D.retainedCount (Sum.inr t), j))) := by + exact hinput + rw [hcast, reorderCore_retained] + simp [sumFin, pairFin] + omega + exact @helper_continuation_309 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@blockIndex_bijective) + (@reorderCore_base) (@reorderCore_absorbed) (@reorderCore_retained) (@vertexNewSize) + (@vertexOldSize) (@edgeNewSize) (@edgeOldSize) (@vertexOrder_base) (@vertexOrder_absorbed) + (@vertexOrder_retained) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralReorderingData.lean b/LeanPool/GoldbergSeymour/ScheideStructuralReorderingData.lean new file mode 100644 index 0000000000..05b93f4f2d --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideStructuralReorderingData.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideStructuralSelectionData + +/-! +# Scheide Structural Reordering Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- +Position and set-equality certificates for reordering absorbed and retained structural blocks. -/ +structure ScheideStructuralReorderingData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) where + length_eq : T'.length = T.length + base_vertex_position : + ∀ q : Fin C.p, + T'.vertex + ⟨q.val, by + have hq := q.isLt + have hc := C.length_eq + rw [length_eq] + omega⟩ = + C.y q + absorbed_vertex_position : + ∀ (h : Fin D.absorbedCount) (j : Fin 2), + T'.vertex + ⟨C.p + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + rw [length_eq] + omega⟩ = + C.blockVertex (D.absorbedEquiv h).1 j + retained_vertex_position : + ∀ (t : Fin D.retainedCount) (j : Fin 2), + T'.vertex + ⟨C.p + 2 * D.absorbedCount + 2 * t.val + j.val, + by + have ht := t.isLt + have hj := j.isLt + have hc := C.length_eq + have hd := D.count_eq + rw [length_eq] + omega⟩ = + C.blockVertex (D.retained t) j + base_edge_position : + ∀ q : Fin (C.p - 1), + T'.edge + ⟨q.val, by + have hq := q.isLt + have hp := C.p_ge_two + have hc := C.length_eq + rw [length_eq] + omega⟩ = + C.baseEdge q + absorbed_edge_position : + ∀ (h : Fin D.absorbedCount) (j : Fin 2), + T'.edge + ⟨C.p - 1 + 2 * h.val + j.val, by + have hh := h.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + rw [length_eq] + omega⟩ = + C.blockEdge (D.absorbedEquiv h).1 j + retained_edge_position : + ∀ (t : Fin D.retainedCount) (j : Fin 2), + T'.edge + ⟨C.p - 1 + 2 * D.absorbedCount + 2 * t.val + j.val, + by + have ht := t.isLt + have hj := j.isLt + have hp := C.p_ge_two + have hc := C.length_eq + have hd := D.count_eq + rw [length_eq] + omega⟩ = + C.blockEdge (D.retained t) j + tashkinov : TashkinovTree G e0 phi T' + vertex_set_eq : TreeSequenceVertexSet T' = TreeSequenceVertexSet T + exit_set_eq : ScheideExitVertices T' phi = ScheideExitVertices T phi + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralSelection.lean b/LeanPool/GoldbergSeymour/ScheideStructuralSelection.lean new file mode 100644 index 0000000000..3bcd241ee3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideStructuralSelection.lean @@ -0,0 +1,156 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder + +public import LeanPool.GoldbergSeymour.ScheideStructuralSelectionData + +/-! +# Scheide Structural Selection + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideStructuralSelection {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) : + Nonempty (ScheideStructuralSelectionData G k e0 phi T C) := by + classical + let X : Finset V := TreeSequenceVertexSet T + have hElementary : ColoredVertexSetElementary G phi X := by + dsimp [X] + exact (ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).2.2.2.1 + have hBaseMem (q : Fin C.p) : C.y q ∈ X := by + rw [← C.base_vertex_position q] + simp only [X, TreeSequenceVertexSet, Finset.mem_image] + have hlength := C.length_eq + have hp : C.p ≤ T.length + 1 := by omega + exact ⟨⟨q.val, q.isLt.trans_le hp⟩, Finset.mem_univ _, rfl⟩ + have hOldColorUnique (i : Fin C.s) : + ∃! v : {v : V // v ∈ X}, + C.gamma i ∈ MissingColors G phi v.1 := by + rcases C.block_color_missing_on_base i with ⟨q, hmissing⟩ + refine ⟨⟨C.y q, hBaseMem q⟩, hmissing, ?_⟩ + intro v hv + apply Subtype.ext + by_contra hne + exact (Finset.disjoint_left.mp + (hElementary v.property (hBaseMem q) hne)) hv hmissing + have hSameOldColor (i : Fin C.s) {u v : V} + (hu : u ∈ X) (hv : v ∈ X) + (hmu : C.gamma i ∈ MissingColors G phi u) + (hmv : C.gamma i ∈ MissingColors G phi v) : u = v := by + rcases hOldColorUnique i with ⟨w, hw, hunique⟩ + have eu : (⟨u, hu⟩ : {x : V // x ∈ X}) = w := hunique _ hmu + have ev : (⟨v, hv⟩ : {x : V // x ∈ X}) = w := hunique _ hmv + exact congrArg Subtype.val (eu.trans ev.symm) + have hExitMem (v : {v : V // v ∈ ScheideExitVertices T phi}) : + v.1 ∈ X := by + have hexit : ScheideExitVertex T phi v.1 := by + simpa [ScheideExitVertices] using v.property + rcases hexit with + ⟨u, gamma, delta, hu, hgamma, hdelta, z, P, hP, i, hi, hv, hlast⟩ + exact hv + let chosen : {v : V // v ∈ ScheideExitVertices T phi} → Fin C.s := + fun v => Classical.choose (C.exit_covered v.1 v.2) + have hChosenMissing (v : {v : V // v ∈ ScheideExitVertices T phi}) : + C.gamma (chosen v) ∈ MissingColors G phi v.1 := by + exact Classical.choose_spec (C.exit_covered v.1 v.2) + have hChosenInjective : Function.Injective chosen := by + intro v w heq + apply Subtype.ext + apply hSameOldColor (chosen v) (hExitMem v) (hExitMem w) + · exact hChosenMissing v + · rw [heq] + exact hChosenMissing w + let retainedCount := (ScheideExitVertices T phi).card + let exitEquiv : Fin retainedCount ≃ + {v : V // v ∈ ScheideExitVertices T phi} := + (Finset.equivFin (ScheideExitVertices T phi)).symm + let retained : Fin retainedCount → Fin C.s := fun t => chosen (exitEquiv t) + have hRetainedInjective : Function.Injective retained := + hChosenInjective.comp exitEquiv.injective + have hRetainedMissing (t : Fin retainedCount) : + C.gamma (retained t) ∈ MissingColors G phi (exitEquiv t).1 := by + exact hChosenMissing (exitEquiv t) + have hSelectedUnique (t t' : Fin retainedCount) + (hmissing : C.gamma (retained t') ∈ + MissingColors G phi (exitEquiv t).1) : t' = t := by + apply exitEquiv.injective + apply Subtype.ext + exact (hSameOldColor (retained t') (hExitMem (exitEquiv t)) + (hExitMem (exitEquiv t')) hmissing (hRetainedMissing t')).symm + let absorbedCount := Fintype.card + {i : Fin C.s // i ∉ Set.range retained} + let absorbedEquiv : Fin absorbedCount ≃ + {i : Fin C.s // i ∉ Set.range retained} := + (Fintype.equivFin {i : Fin C.s // i ∉ Set.range retained}).symm + have hRangeCard : Fintype.card {i : Fin C.s // i ∈ Set.range retained} = + retainedCount := by + simpa only [Fintype.card_fin] using + Fintype.card_congr (Equiv.ofInjective retained hRetainedInjective).symm + have hTotal : + Fintype.card {i : Fin C.s // i ∈ Set.range retained} + + Fintype.card {i : Fin C.s // i ∉ Set.range retained} = C.s := by + have hnotCard : Fintype.card {i : Fin C.s // i ∉ Set.range retained} = + Fintype.card ↥((Set.range retained)ᶜ) := by + apply Fintype.card_congr + exact ⟨(fun i => ⟨i.1, i.2⟩), (fun i => ⟨i.1, i.2⟩), + (fun _ => rfl), (fun _ => rfl)⟩ + have hrangeCard : Fintype.card {i : Fin C.s // i ∈ Set.range retained} = + Fintype.card (Set.range retained) := by + apply Fintype.card_congr + exact ⟨(fun i => ⟨i.1, i.2⟩), (fun i => ⟨i.1, i.2⟩), + (fun _ => rfl), (fun _ => rfl)⟩ + rw [hrangeCard, hnotCard] + simpa only [Fintype.card_sum, Fintype.card_fin] using + Fintype.card_congr (Equiv.Set.sumCompl (Set.range retained)) + have hCount : C.s = absorbedCount + retainedCount := by + dsimp [absorbedCount] + omega + have hPartition (i : Fin C.s) : + (∃! h : Fin absorbedCount, (absorbedEquiv h).1 = i) ∨ + (∃! t : Fin retainedCount, retained t = i) := by + by_cases hi : i ∈ Set.range retained + · right + rcases hi with ⟨t, ht⟩ + refine ⟨t, ht, ?_⟩ + intro t' ht' + apply hRetainedInjective + exact ht'.trans ht.symm + · left + obtain ⟨h, hh⟩ := absorbedEquiv.surjective ⟨i, hi⟩ + refine ⟨h, congrArg Subtype.val hh, ?_⟩ + intro h' hh' + apply absorbedEquiv.injective + apply Subtype.ext + exact hh'.trans (congrArg Subtype.val hh).symm + exact ⟨{ + absorbedCount := absorbedCount + retainedCount := retainedCount + exitEquiv := exitEquiv + retained := retained + retained_injective := hRetainedInjective + retained_missing := hRetainedMissing + selected_unique := hSelectedUnique + absorbedEquiv := absorbedEquiv + count_eq := hCount + exit_count_eq := rfl + partition := hPartition + }⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralSelectionData.lean b/LeanPool/GoldbergSeymour/ScheideStructuralSelectionData.lean new file mode 100644 index 0000000000..662acf88e4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideStructuralSelectionData.lean @@ -0,0 +1,51 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration + +/-! +# Scheide Structural Selection Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A partition of structural blocks into absorbed blocks and blocks selected by exit vertices. -/ +structure ScheideStructuralSelectionData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (C : ScheideStructuralConfiguration G k e0 phi T) where + /-- The number of blocks absorbed into the reordered base. -/ + absorbedCount : ℕ + /-- The number of blocks retained as paired blocks. -/ + retainedCount : ℕ + /-- The enumeration of exit vertices by the retained-block indices. -/ + exitEquiv : Fin retainedCount ≃ { v : V // v ∈ ScheideExitVertices T phi } + /-- The original block index selected for each retained block. -/ + retained : Fin retainedCount → Fin C.s + retained_injective : Function.Injective retained + retained_missing : + ∀ t : Fin retainedCount, C.gamma (retained t) ∈ MissingColors G phi (exitEquiv t).1 + selected_unique : + ∀ (t t' : Fin retainedCount), + C.gamma (retained t') ∈ MissingColors G phi (exitEquiv t).1 → t' = t + /-- The enumeration of original blocks not selected as retained blocks. -/ + absorbedEquiv : Fin absorbedCount ≃ { i : Fin C.s // i ∉ Set.range retained } + count_eq : C.s = absorbedCount + retainedCount + exit_count_eq : retainedCount = (ScheideExitVertices T phi).card + partition : + ∀ i : Fin C.s, + (∃! h : Fin absorbedCount, (absorbedEquiv h).1 = i) ∨ + (∃! t : Fin retainedCount, retained t = i) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricDefectiveInternal.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricDefectiveInternal.lean new file mode 100644 index 0000000000..fad645332e --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricDefectiveInternal.lean @@ -0,0 +1,252 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists +public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideExitNoFree +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementInternalMissing +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair +public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalBoundaryAvoidance +public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalFreePath +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryAvoidance +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryConfiguration +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementFreePath +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Symmetric Defective Internal + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem ScheideSymmetricDefectiveInternal {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + (∃ f : E, + phi f = some d.1 ∧ + G.ends f = + s(C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1)) ∧ + ∃ f : E, phi f = some (C.gamma (D.gammaIndex d)) ∧ G.ends f = s(R.u1, R.u2) := by + classical + let X := TreeSequenceVertexSet T + let ug0 := C.blockVertex (D.gammaIndex d) 0 + let ug1 := C.blockVertex (D.gammaIndex d) 1 + let Z := X \ {ug0, ug1} + obtain ⟨beta, v, z, p, hvZ, hbetaMissing, hbetaFree, hbetaGamma, hp⟩ := + ScheideSymmetricOriginalFreePath G k e0 phi T C D d R + have hOriginalAvoid := + ScheideSymmetricOriginalBoundaryAvoidance G k e0 phi T C D d R + beta v z p (by simpa [X, Z, ug0, ug1] using hvZ) + hbetaMissing hbetaFree hbetaGamma hp + have hBoundaryAvoid : + ∀ f : E, f ∈ BoundaryColorEdges G phi X d.1 → + ∀ j : Fin 2, ¬ Incident G (C.blockVertex (D.gammaIndex d) j) f := by + simpa only [X] using hOriginalAvoid.2 + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hclosed : ColoredVertexSetClosed G phi X := by + change ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) + exact horder.2.2.2.2 + have hug0X : ug0 ∈ X := by + change C.blockVertex (D.gammaIndex d) 0 ∈ TreeSequenceVertexSet T + rw [← C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)] + simp [TreeSequenceVertexSet] + have hdcard : 2 ≤ (BoundaryColorEdges G phi X d.1).card := by + have hd := (Finset.mem_filter.mp d.2).2 + simpa only [DefectiveColor, X] using hd + have hdnonempty : (BoundaryColorEdges G phi X d.1).Nonempty := + Finset.card_pos.mp (lt_of_lt_of_le Nat.zero_lt_two hdcard) + obtain ⟨b, hb⟩ := hdnonempty + have hbBoundary : b ∈ BoundaryEdges G X := + (Finset.mem_filter.mp hb).1 + have hbColor : phi b = some d.1 := + (Finset.mem_filter.mp hb).2 + have hdeltaNotMissing : d.1 ∉ MissingColors G phi ug0 := + hclosed hbBoundary hug0X hbColor + have hdeltaPresent : d.1 ∈ PresentColors G phi ug0 := by + simpa [MissingColors] using hdeltaNotMissing + obtain ⟨fDelta, hfDeltaIncident, hfDeltaColor⟩ : + ∃ f : E, Incident G ug0 f ∧ phi f = some d.1 := by + simpa [PresentColors] using hdeltaPresent + obtain ⟨wDelta, hfDeltaEnds⟩ := Sym2.mem_iff_exists.mp hfDeltaIncident + have hwDeltaNe : wDelta ≠ ug0 := by + intro heq + exact G.loopless fDelta ug0 (by simpa [heq] using hfDeltaEnds) + have hwDeltaX : wDelta ∈ X := by + by_contra hw + have hfBoundary : fDelta ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨ug0, hug0X, wDelta, hw, hfDeltaEnds⟩ + have hfColorBoundary : fDelta ∈ BoundaryColorEdges G phi X d.1 := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hfBoundary, hfDeltaColor⟩ + exact (hBoundaryAvoid fDelta hfColorBoundary (0 : Fin 2)) + (by simpa only [ug0] using hfDeltaIncident) + have hwDeltaNotZ : wDelta ∉ Z := by + intro hwZ + have hnocross := ScheideDefectiveNoCross G k e0 phi T C D d + fDelta hfDeltaColor + apply hnocross + refine ⟨ug0, ?_, hfDeltaIncident, wDelta, ?_, ?_⟩ + · simp [ug0] + · simpa [X, Z, ug0, ug1] using hwZ + · simp [Incident, hfDeltaEnds] + have hwDeltaPair : wDelta ∈ ({ug0, ug1} : Finset V) := by + by_contra hwPair + exact hwDeltaNotZ (by simp [Z, hwDeltaX, hwPair]) + have hwDeltaEq : wDelta = ug1 := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hwDeltaPair + rcases hwDeltaPair with heq | heq + · exact False.elim (hwDeltaNe heq) + · exact heq + have hfirst : ∃ f : E, phi f = some d.1 ∧ + G.ends f = s(C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1) := by + refine ⟨fDelta, hfDeltaColor, ?_⟩ + simpa [ug0, ug1, hwDeltaEq] using hfDeltaEnds + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let XD := TreeSequenceVertexSet R.replacementTree + obtain ⟨betaD, vD, zD, pD, hvDZ, hbetaDMissing, hbetaDOldMissing, + hbetaDFree, hbetaDDelta, hbetaDGamma, hpD⟩ := + ScheideSymmetricReplacementFreePath G k e0 phi T C D d R + have hReplacementAvoid := + ScheideSymmetricReplacementBoundaryAvoidance G k e0 phi T C D d R + betaD vD zD pD + (by simpa [gamma, phiD, X, Z, ug0, ug1] using hvDZ) + (by simpa [gamma, phiD] using hbetaDMissing) + hbetaDOldMissing + (by simpa [gamma, phiD] using hbetaDFree) + hbetaDDelta (by simpa [gamma] using hbetaDGamma) + (by simpa [gamma, phiD] using hpD) + have hReplacementConfig := + ScheideSymmetricReplacementBoundaryConfiguration G k e0 phi T C D d R + have hgammaDefective : gamma ∈ DefectiveColors G phiD XD := by + simpa [gamma, phiD, XD, X, Z, ug0, ug1] using hReplacementConfig.1 + have hReplacementMaximum := ScheideReplacementMaximum G k e0 phi T C D d R + have hReplacementOrder := ScheideGlobalMaximumOrder G k e0 phiD + R.replacementTree (by simpa [gamma, phiD] using hReplacementMaximum.2.2) + have hDClosed : ColoredVertexSetClosed G phiD XD := by + change ColoredVertexSetClosed G phiD + (TreeSequenceVertexSet R.replacementTree) + exact hReplacementOrder.2.2.2.2 + have hu1XD : R.u1 ∈ XD := by + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] + simp + have hgammaCard : 2 ≤ (BoundaryColorEdges G phiD XD gamma).card := by + have hg := (Finset.mem_filter.mp hgammaDefective).2 + simpa only [DefectiveColor] using hg + have hgammaNonempty : (BoundaryColorEdges G phiD XD gamma).Nonempty := + Finset.card_pos.mp (lt_of_lt_of_le Nat.zero_lt_two hgammaCard) + obtain ⟨bD, hbD⟩ := hgammaNonempty + have hbDBoundary : bD ∈ BoundaryEdges G XD := + (Finset.mem_filter.mp hbD).1 + have hbDColor : phiD bD = some gamma := + (Finset.mem_filter.mp hbD).2 + have hgammaNotMissing : gamma ∉ MissingColors G phiD R.u1 := + hDClosed hbDBoundary hu1XD hbDColor + have hgammaPresent : gamma ∈ PresentColors G phiD R.u1 := by + simpa [MissingColors] using hgammaNotMissing + obtain ⟨fGamma, hfGammaIncident, hfGammaColor⟩ : + ∃ f : E, Incident G R.u1 f ∧ phiD f = some gamma := by + simpa [PresentColors] using hgammaPresent + obtain ⟨wGamma, hfGammaEnds⟩ := Sym2.mem_iff_exists.mp hfGammaIncident + have hwGammaNe : wGamma ≠ R.u1 := by + intro heq + exact G.loopless fGamma R.u1 (by simpa [heq] using hfGammaEnds) + have hNoGammaBoundaryAtPair : + ∀ f : E, f ∈ BoundaryColorEdges G phiD XD gamma → + ¬ Incident G R.u1 f ∧ ¬ Incident G R.u2 f := by + simpa only [gamma, phiD, XD] using hReplacementAvoid.2.1 + have hwGammaXD : wGamma ∈ XD := by + by_contra hw + have hfBoundary : fGamma ∈ BoundaryEdges G XD := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨R.u1, hu1XD, wGamma, hw, hfGammaEnds⟩ + have hfColorBoundary : fGamma ∈ BoundaryColorEdges G phiD XD gamma := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨hfBoundary, hfGammaColor⟩ + exact (hNoGammaBoundaryAtPair fGamma hfColorBoundary).1 hfGammaIncident + have hwGammaNotZ : wGamma ∉ Z := by + intro hwZ + have hnocross := hReplacementAvoid.2.2 fGamma + (by simpa [gamma, phiD] using hfGammaColor) + (Or.inl hfGammaIncident) wGamma + (by simpa [X, Z, ug0, ug1] using hwZ) + exact hnocross (by simp [Incident, hfGammaEnds]) + have hwGammaInUnion : wGamma ∈ Z ∪ {R.u1, R.u2} := by + have hw := hwGammaXD + rw [show XD = TreeSequenceVertexSet R.replacementTree by rfl, + R.replacement_vertices] at hw + simpa [X, Z, ug0, ug1] using hw + have hwGammaPair : wGamma ∈ ({R.u1, R.u2} : Finset V) := by + simpa [hwGammaNotZ] using hwGammaInUnion + have hwGammaEq : wGamma = R.u2 := by + simp only [Finset.mem_insert, Finset.mem_singleton] at hwGammaPair + rcases hwGammaPair with heq | heq + · exact False.elim (hwGammaNe heq) + · exact heq + have hfGammaOriginal : phi fGamma = some gamma := by + have hfixed := ScheideReplacementPairFixed G k e0 phi T C D d R + fGamma (Or.inl hfGammaIncident) + change TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d)) fGamma = + some (C.gamma (D.gammaIndex d)) at hfGammaColor + rw [hfixed] at hfGammaColor + simpa [gamma] using hfGammaColor + refine ⟨hfirst, fGamma, ?_, ?_⟩ + · simpa [gamma] using hfGammaOriginal + · simpa [hwGammaEq] using hfGammaEnds + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricMissingInternal.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricMissingInternal.lean new file mode 100644 index 0000000000..92c03a28b8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricMissingInternal.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDeletedMissingReplacementInternal +public import LeanPool.GoldbergSeymour.ScheideReplacementMissingDeletedInternal + +/-! +# Scheide Symmetric Missing Internal + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem ScheideSymmetricMissingInternal {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + (∀ alpha : Fin k, + (alpha ∈ MissingColors G phi R.u1 ∨ alpha ∈ MissingColors G phi R.u2) → + ∃ f : E, phi f = some alpha ∧ + G.ends f = s(C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1)) ∧ + ∀ alpha : Fin k, + (alpha ∈ MissingColors G phi (C.blockVertex (D.gammaIndex d) 0) ∨ + alpha ∈ MissingColors G phi (C.blockVertex (D.gammaIndex d) 1)) → + ∃ f : E, phi f = some alpha ∧ G.ends f = s(R.u1, R.u2) := by + exact ⟨ScheideReplacementMissingDeletedInternal G k e0 phi T C D d R, + ScheideDeletedMissingReplacementInternal G k e0 phi T C D d R⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalBoundaryAvoidance.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalBoundaryAvoidance.lean new file mode 100644 index 0000000000..4f07158816 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalBoundaryAvoidance.lean @@ -0,0 +1,992 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair +public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalPathOrder +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Symmetric Original Boundary Avoidance + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hxOutside_165.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + (∀ (j : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) j ∈ U) → + (∀ (f : E), + phi f = some beta → + ∀ (j : Fin (2 : ℕ)), + Incident G (C.blockVertex (D.gammaIndex d) j) f → ∀ w ∈ Z, ¬Incident G w f) → + ∀ (_ _ _ _ _ _ _ : Fin (p.length + (1 : ℕ))), + let blockIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + ∃ (a : Fin (2 : ℕ)), + p.getVert (↑r : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) a)}; + ∀ (hblockIndices : blockIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := blockIndices.min' hblockIndices; + ∀ (jt : Fin (2 : ℕ)), + p.getVert (↑t : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) jt) → + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + (↑r : ℕ) < (↑t : ℕ) ∧ ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + ∀ w ∈ Z, + (∀ r ∈ zIndices, (↑r : ℕ) ≤ (↑qz : ℕ)) → + let qe : Fin (p.length + (1 : ℕ)) := + (⟨(↑qz : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + ∀ (hqet : (↑qe : ℕ) < (↑t : ℕ)) (f : E), + Incident G w f → + phi f = some (↑d : Fin k) ∨ phi f = some beta → + let qx : Fin (p.length + (1 : ℕ)) := + (⟨(↑qe : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qe : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + ∀ (x : V), + p.getVert (↑qx : ℕ) = Sum.inl x → + Incident G x f → + (↑qx : ℕ) ≤ (↑t : ℕ) → + x ∉ X := by + classical + intro V E _ _ _ _ G k e0 phi T C D d beta v z p X U Z hblockU no_beta_cross i0 i1 i2 i3 i4 qv + qf blockIndices hblockIndices t jt htNode zIndices hzIndices qz hqzt w hwZ hqzMax qe hqet f + hwf hfColors qx x hqxNode hxf hqxle hxX + by_cases hxU : x ∈ U + · obtain (hfd | hfbeta) := hfColors + · have hnocross := ScheideDefectiveNoCross G k e0 phi T C D d f hfd + apply hnocross + obtain (hx0 | hx1) : x = C.blockVertex (D.gammaIndex d) 0 ∨ + x = C.blockVertex (D.gammaIndex d) 1 := by + simpa [U] using hxU + · exact ⟨x, by simp [hx0], hxf, w, hwZ, hwf⟩ + · exact ⟨x, by simp [hx1], hxf, w, hwZ, hwf⟩ + · obtain (hx0 | hx1) : x = C.blockVertex (D.gammaIndex d) 0 ∨ + x = C.blockVertex (D.gammaIndex d) 1 := by + simpa [U] using hxU + · exact no_beta_cross f hfbeta 0 (by simpa [hx0] using hxf) w hwZ hwf + · exact no_beta_cross f hfbeta 1 (by simpa [hx1] using hxf) w hwZ hwf + · have hxZ : x ∈ Z := by exact Finset.mem_sdiff.mpr ⟨hxX, hxU⟩ + have hqxne : qx.val ≠ t.val := by + intro heq + have hxBlock : x = C.blockVertex (D.gammaIndex d) jt := by + rw [heq, htNode] at hqxNode + exact Sum.inl.inj hqxNode.symm + exact hxU (hxBlock ▸ hblockU jt) + have hqxt : qx.val < t.val := by omega + have hqxMem : qx ∈ zIndices := by + simp only [zIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨hqxt, x, hxZ, hqxNode⟩ + have := hqzMax qx hqxMem + dsimp [qx, qe] at this + omega + +private theorem helper_hreturn_one_242.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi (↑d : Fin k) beta; + (∀ (j : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) j ∈ U) → + ∀ (h : E) (i0 i1 i2 i3 i4 qv qf : Fin (p.length + (1 : ℕ))), + (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) → + (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) → + (↑i3 : ℕ) = (↑i2 : ℕ) + (1 : ℕ) → + (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) → + (↑i4 : ℕ) < (↑qv : ℕ) → + (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → + p.IsPath → + (∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let blockIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + ∃ (a : Fin (2 : ℕ)), + p.getVert (↑r : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) a)}; + ∀ (hblockIndices : blockIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := blockIndices.min' hblockIndices; + ∀ (jt : Fin (2 : ℕ)), + p.getVert (↑t : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) jt) → + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + (↑r : ℕ) < (↑t : ℕ) ∧ ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + (∀ r ∈ zIndices, (↑r : ℕ) ≤ (↑qz : ℕ)) → + let qe : Fin (p.length + (1 : ℕ)) := + (⟨(↑qz : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + (↑qe : ℕ) < (↑t : ℕ) → + ∀ (f : E), + p.getVert (↑qe : ℕ) = Sum.inr f → + (∀ u ∉ X, ∀ (a : Fin (2 : ℕ)), u ≠ C.blockVertex (D.gammaIndex d) a) → + p.getVert (↑i0 : ℕ) = Sum.inr R.f1 → + p.getVert (↑i1 : ℕ) = Sum.inl R.u1 → + p.getVert (↑i2 : ℕ) = Sum.inr h → + p.getVert (↑i3 : ℕ) = Sum.inl R.u2 → + p.getVert (↑i4 : ℕ) = Sum.inr R.f2 → + f = R.f1 → + False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p X U Z H hblockU h i0 i1 i2 i3 i4 qv qf hi01 + hi12 hi23 hi34 hi4qv hqfv hpath fin_le blockIndices hblockIndices t jt htNode zIndices + hzIndices qz hqzt hqzMax qe hqet f hqeNode hblockOutsideNe ha0 ha1 ha2 ha3 ha4 hf + have hqe0 : qe.val = i0.val := by + have hvEq : p.getVert qe.val = p.getVert i0.val := by + rw [hqeNode, hf, ha0] + exact hpath.getVert_injOn + (by simpa using fin_le qe) (by simpa using fin_le i0) hvEq + have hi1ne : t.val ≠ i1.val := by + intro heq + have he : C.blockVertex (D.gammaIndex d) jt = R.u1 := by + apply Sum.inl.inj + rw [← htNode, heq, ha1] + exact hblockOutsideNe R.u1 R.u1_outside jt he.symm + have hi2ne : t.val ≠ i2.val := by + intro heq + have : (Sum.inl (C.blockVertex (D.gammaIndex d) jt) : Sum V E) = Sum.inr h := by + rw [← htNode, heq, ha2] + simp at this + have hi3ne : t.val ≠ i3.val := by + intro heq + have he : C.blockVertex (D.gammaIndex d) jt = R.u2 := by + apply Sum.inl.inj + rw [← htNode, heq, ha3] + exact hblockOutsideNe R.u2 R.u2_outside jt he.symm + have hi4ne : t.val ≠ i4.val := by + intro heq + have : (Sum.inl (C.blockVertex (D.gammaIndex d) jt) : Sum V E) = Sum.inr R.f2 := by + rw [← htNode, heq, ha4] + simp at this + have hi4t : i4.val < t.val := by omega + let ir : Fin (p.length + 1) := ⟨i4.val + 1, by omega⟩ + have hretAdj := p.adj_getVert_succ (i := i4.val) (by omega) + have hret : p.getVert ir.val = Sum.inl R.v2 := by + cases hn : p.getVert ir.val with + | inr e => + have hadj : H.Adj (Sum.inr R.f2) (Sum.inr e) := by + simpa [H, ir, ha4, hn] using hretAdj + simp [H, TwoColorIncidenceGraph] at hadj + | inl y => + have hyInc : Incident G y R.f2 := by + have hadj : H.Adj (Sum.inr R.f2) (Sum.inl y) := by + simpa [H, ir, ha4, hn] using hretAdj + have hpair : Incident G y R.f2 ∧ + (phi R.f2 = some d.1 ∨ phi R.f2 = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hadj + exact hpair.1 + have hyEnds : y = R.v2 ∨ y = R.u2 := by + simpa [Incident, R.f2_ends] using hyInc + rcases hyEnds with hy | hy + · simp [hy] + · have hrepeat : p.getVert ir.val = p.getVert i3.val := by + rw [hn, hy, ha3] + have hind := hpath.getVert_injOn + (by simpa using fin_le ir) (by simpa using fin_le i3) hrepeat + dsimp [ir] at hind + omega + have hv2Z : R.v2 ∈ Z := by simpa [X, U, Z] using R.v2_in_remainder + have hirt : ir.val < t.val := by + have hirle : ir.val ≤ t.val := by dsimp [ir]; omega + have hirne : ir.val ≠ t.val := by + intro heq + have hv2Block : R.v2 = C.blockVertex (D.gammaIndex d) jt := by + apply Sum.inl.inj + rw [← hret, heq, htNode] + exact (Finset.mem_sdiff.mp hv2Z).2 (hv2Block ▸ hblockU jt) + omega + have hirMem : ir ∈ zIndices := by + simp only [zIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨hirt, R.v2, hv2Z, hret⟩ + have hmax := hqzMax ir hirMem + dsimp [ir, qe] at hmax hqe0 + omega + +private theorem helper_hreturn_two_319.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi (↑d : Fin k) beta; + (∀ (j : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) j ∈ U) → + ∀ (h : E) (i0 i1 i2 i3 i4 qv qf : Fin (p.length + (1 : ℕ))), + (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) → + (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) → + (↑i3 : ℕ) = (↑i2 : ℕ) + (1 : ℕ) → + (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) → + (↑i4 : ℕ) < (↑qv : ℕ) → + (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → + p.IsPath → + (∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let blockIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + ∃ (a : Fin (2 : ℕ)), + p.getVert (↑r : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) a)}; + ∀ (hblockIndices : blockIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := blockIndices.min' hblockIndices; + ∀ (jt : Fin (2 : ℕ)), + p.getVert (↑t : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) jt) → + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + (↑r : ℕ) < (↑t : ℕ) ∧ ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + (∀ r ∈ zIndices, (↑r : ℕ) ≤ (↑qz : ℕ)) → + let qe : Fin (p.length + (1 : ℕ)) := + (⟨(↑qz : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + (↑qe : ℕ) < (↑t : ℕ) → + ∀ (f : E), + p.getVert (↑qe : ℕ) = Sum.inr f → + (∀ u ∉ X, ∀ (a : Fin (2 : ℕ)), u ≠ C.blockVertex (D.gammaIndex d) a) → + p.getVert (↑i0 : ℕ) = Sum.inr R.f2 → + p.getVert (↑i1 : ℕ) = Sum.inl R.u2 → + p.getVert (↑i2 : ℕ) = Sum.inr h → + p.getVert (↑i3 : ℕ) = Sum.inl R.u1 → + p.getVert (↑i4 : ℕ) = Sum.inr R.f1 → + f = R.f2 → + False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p X U Z H hblockU h i0 i1 i2 i3 i4 qv qf hi01 + hi12 hi23 hi34 hi4qv hqfv hpath fin_le blockIndices hblockIndices t jt htNode zIndices + hzIndices qz hqzt hqzMax qe hqet f hqeNode hblockOutsideNe ha0 ha1 ha2 ha3 ha4 hf + have hqe0 : qe.val = i0.val := by + have hvEq : p.getVert qe.val = p.getVert i0.val := by + rw [hqeNode, hf, ha0] + exact hpath.getVert_injOn + (by simpa using fin_le qe) (by simpa using fin_le i0) hvEq + have hi1ne : t.val ≠ i1.val := by + intro heq + have he : C.blockVertex (D.gammaIndex d) jt = R.u2 := by + apply Sum.inl.inj + rw [← htNode, heq, ha1] + exact hblockOutsideNe R.u2 R.u2_outside jt he.symm + have hi2ne : t.val ≠ i2.val := by + intro heq + have : (Sum.inl (C.blockVertex (D.gammaIndex d) jt) : Sum V E) = Sum.inr h := by + rw [← htNode, heq, ha2] + simp at this + have hi3ne : t.val ≠ i3.val := by + intro heq + have he : C.blockVertex (D.gammaIndex d) jt = R.u1 := by + apply Sum.inl.inj + rw [← htNode, heq, ha3] + exact hblockOutsideNe R.u1 R.u1_outside jt he.symm + have hi4ne : t.val ≠ i4.val := by + intro heq + have : (Sum.inl (C.blockVertex (D.gammaIndex d) jt) : Sum V E) = Sum.inr R.f1 := by + rw [← htNode, heq, ha4] + simp at this + have hi4t : i4.val < t.val := by omega + let ir : Fin (p.length + 1) := ⟨i4.val + 1, by omega⟩ + have hretAdj := p.adj_getVert_succ (i := i4.val) (by omega) + have hret : p.getVert ir.val = Sum.inl R.v1 := by + cases hn : p.getVert ir.val with + | inr e => + have hadj : H.Adj (Sum.inr R.f1) (Sum.inr e) := by + simpa [H, ir, ha4, hn] using hretAdj + simp [H, TwoColorIncidenceGraph] at hadj + | inl y => + have hyInc : Incident G y R.f1 := by + have hadj : H.Adj (Sum.inr R.f1) (Sum.inl y) := by + simpa [H, ir, ha4, hn] using hretAdj + have hpair : Incident G y R.f1 ∧ + (phi R.f1 = some d.1 ∨ phi R.f1 = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hadj + exact hpair.1 + have hyEnds : y = R.v1 ∨ y = R.u1 := by + simpa [Incident, R.f1_ends] using hyInc + rcases hyEnds with hy | hy + · simp [hy] + · have hrepeat : p.getVert ir.val = p.getVert i3.val := by + rw [hn, hy, ha3] + have hind := hpath.getVert_injOn + (by simpa using fin_le ir) (by simpa using fin_le i3) hrepeat + dsimp [ir] at hind + omega + have hv1Z : R.v1 ∈ Z := by simpa [X, U, Z] using R.v1_in_remainder + have hirt : ir.val < t.val := by + have hirle : ir.val ≤ t.val := by dsimp [ir]; omega + have hirne : ir.val ≠ t.val := by + intro heq + have hv1Block : R.v1 = C.blockVertex (D.gammaIndex d) jt := by + apply Sum.inl.inj + rw [← hret, heq, htNode] + exact (Finset.mem_sdiff.mp hv1Z).2 (hv1Block ▸ hblockU jt) + omega + have hirMem : ir ∈ zIndices := by + simp only [zIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨hirt, R.v1, hv1Z, hret⟩ + have hmax := hqzMax ir hirMem + dsimp [ir, qe] at hmax hqe0 + omega + +private theorem helper_hfdelta_489.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + beta ∈ MissingColors G phi v → + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + v ∈ X → + ColoredVertexSetClosed G phi X → + ∀ (_ _ _ _ _ _ _ : Fin (p.length + (1 : ℕ))), + p.IsPath → + (∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let blockIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + ∃ (a : Fin (2 : ℕ)), + p.getVert (↑r : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) a)}; + ∀ (hblockIndices : blockIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := blockIndices.min' hblockIndices; + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + (↑r : ℕ) < (↑t : ℕ) ∧ ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + ∀ w ∈ Z, + p.getVert (↑qz : ℕ) = Sum.inl w → + let qe : Fin (p.length + (1 : ℕ)) := + (⟨(↑qz : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + ∀ (hqet : (↑qe : ℕ) < (↑t : ℕ)) (f : E), + Incident G w f → + phi f = some (↑d : Fin k) ∨ phi f = some beta → + let qx : Fin (p.length + (1 : ℕ)) := + (⟨(↑qe : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qe : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + ∀ (x : V), + p.getVert (↑qx : ℕ) = Sum.inl x → + Incident G x f → + x ∉ X → + phi f = some (↑d : Fin k) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d beta v z p hbeta X U Z hvX hclosed i0 i1 i2 i3 i4 qv qf + hpath fin_le blockIndices hblockIndices t zIndices hzIndices qz hqzt w hwZ hqw qe hqet f + hwf hfColors qx x hqxNode hxf hxOutside + rcases hfColors with hfd | hfbeta + · exact hfd + · have hfBoundary : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨w, (Finset.mem_sdiff.mp hwZ).1, x, hxOutside, ?_⟩ + obtain ⟨a, ha⟩ := Sym2.mem_iff_exists.mp hwf + have hxw : x ≠ w := by + intro hxw + have hnodes : p.getVert qx.val = p.getVert qz.val := by + rw [hqxNode, hxw, hqw] + have hinds := hpath.getVert_injOn + (by simpa using fin_le qx) (by simpa using fin_le qz) hnodes + dsimp [qx, qe] at hinds + omega + have hmem : x = w ∨ x = a := by + simpa [Incident, ha] using hxf + have hxa : x = a := hmem.resolve_left hxw + simpa [hxa] using ha + exact False.elim (hclosed hfBoundary hvX hfbeta hbeta) + +private theorem helper_hfEnds_509.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + ∀ (_ _ _ _ _ _ _ : Fin (p.length + (1 : ℕ))), + p.IsPath → + (∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let blockIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + ∃ (a : Fin (2 : ℕ)), + p.getVert (↑r : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) a)}; + ∀ (hblockIndices : blockIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := blockIndices.min' hblockIndices; + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + (↑r : ℕ) < (↑t : ℕ) ∧ ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)) (w : V), + p.getVert (↑qz : ℕ) = Sum.inl w → + let qe : Fin (p.length + (1 : ℕ)) := + (⟨(↑qz : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + ∀ (hqet : (↑qe : ℕ) < (↑t : ℕ)) (f : E), + Incident G w f → + let qx : Fin (p.length + (1 : ℕ)) := + (⟨(↑qe : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qe : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + ∀ (x : V), + p.getVert (↑qx : ℕ) = Sum.inl x → + Incident G x f → + G.ends f = s(w, x) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d beta v z p X U Z i0 i1 i2 i3 i4 qv qf hpath fin_le + blockIndices hblockIndices t zIndices hzIndices qz hqzt w hqw qe hqet f hwf qx x hqxNode hxf + obtain ⟨a, ha⟩ := Sym2.mem_iff_exists.mp hwf + have hxw : x ≠ w := by + intro hxw + have hnodes : p.getVert qx.val = p.getVert qz.val := by + rw [hqxNode, hxw, hqw] + have hinds := hpath.getVert_injOn + (by simpa using fin_le qx) (by simpa using fin_le qz) hnodes + dsimp [qx, qe] at hinds + omega + have hmem : x = w ∨ x = a := by + simpa [Incident, ha] using hxf + have hxa : x = a := hmem.resolve_left hxw + simpa [hxa] using ha + +private theorem helper_branch_563.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + ∀ (h : E) (i0 i1 i2 i3 i4 _ _ : Fin (p.length + (1 : ℕ))), + (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) → + p.getVert (↑i0 : ℕ) = Sum.inr R.f1 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u2 ∧ p.getVert (↑i4 : ℕ) = Sum.inr R.f2 ∨ + p.getVert (↑i0 : ℕ) = Sum.inr R.f2 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u1 ∧ p.getVert (↑i4 : ℕ) = Sum.inr R.f1 → + p.IsPath → + (∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let blockIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + ∃ (a : Fin (2 : ℕ)), + p.getVert (↑r : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) a)}; + ∀ (hblockIndices : blockIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := blockIndices.min' hblockIndices; + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + (↑r : ℕ) < (↑t : ℕ) ∧ ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + ∀ w ∈ Z, + p.getVert (↑qz : ℕ) = Sum.inl w → + let qe : Fin (p.length + (1 : ℕ)) := + (⟨(↑qz : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + (↑qe : ℕ) < (↑t : ℕ) → + ∀ (f : E), + p.getVert (↑qe : ℕ) = Sum.inr f → + (p.getVert (↑i0 : ℕ) = Sum.inr R.f1 → + p.getVert (↑i1 : ℕ) = Sum.inl R.u1 → + p.getVert (↑i2 : ℕ) = Sum.inr h → + p.getVert (↑i3 : ℕ) = Sum.inl R.u2 → + p.getVert (↑i4 : ℕ) = Sum.inr R.f2 → f = R.f1 → False) → + f = R.f1 → + False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p X U Z h i0 i1 i2 i3 i4 qv qf hi34 horient + hpath fin_le blockIndices hblockIndices t zIndices hzIndices qz hqzt w hwZ hqw qe hqet f + hqeNode hreturn_one hf1 + rcases horient with hfirst | hsecond + · exact hreturn_one hfirst.1 hfirst.2.1 hfirst.2.2.1 + hfirst.2.2.2.1 hfirst.2.2.2.2 hf1 + · have hqei4 : qe.val = i4.val := by + have hvEq : p.getVert qe.val = p.getVert i4.val := by + rw [hqeNode, hf1, hsecond.2.2.2.2] + exact hpath.getVert_injOn + (by simpa using fin_le qe) (by simpa using fin_le i4) hvEq + have hqzi3 : qz.val = i3.val := by + dsimp [qe] at hqei4 + omega + have hwEq : w = R.u1 := by + apply Sum.inl.inj + rw [← hqw, hqzi3, hsecond.2.2.2.1] + exact R.u1_outside (by simpa [X, hwEq] using + (Finset.mem_sdiff.mp hwZ).1) + +private theorem helper_branch_579.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + ∀ (h : E) (i0 i1 i2 i3 i4 _ _ : Fin (p.length + (1 : ℕ))), + (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) → + p.getVert (↑i0 : ℕ) = Sum.inr R.f1 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u2 ∧ p.getVert (↑i4 : ℕ) = Sum.inr R.f2 ∨ + p.getVert (↑i0 : ℕ) = Sum.inr R.f2 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u1 ∧ p.getVert (↑i4 : ℕ) = Sum.inr R.f1 → + p.IsPath → + (∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let blockIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + ∃ (a : Fin (2 : ℕ)), + p.getVert (↑r : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) a)}; + ∀ (hblockIndices : blockIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := blockIndices.min' hblockIndices; + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | + (↑r : ℕ) < (↑t : ℕ) ∧ ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + ∀ w ∈ Z, + p.getVert (↑qz : ℕ) = Sum.inl w → + let qe : Fin (p.length + (1 : ℕ)) := + (⟨(↑qz : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + (↑qe : ℕ) < (↑t : ℕ) → + ∀ (f : E), + p.getVert (↑qe : ℕ) = Sum.inr f → + (p.getVert (↑i0 : ℕ) = Sum.inr R.f2 → + p.getVert (↑i1 : ℕ) = Sum.inl R.u2 → + p.getVert (↑i2 : ℕ) = Sum.inr h → + p.getVert (↑i3 : ℕ) = Sum.inl R.u1 → + p.getVert (↑i4 : ℕ) = Sum.inr R.f1 → f = R.f2 → False) → + f = R.f2 → + False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p X U Z h i0 i1 i2 i3 i4 qv qf hi34 horient + hpath fin_le blockIndices hblockIndices t zIndices hzIndices qz hqzt w hwZ hqw qe hqet f + hqeNode hreturn_two hf2 + rcases horient with hfirst | hsecond + · have hqei4 : qe.val = i4.val := by + have hvEq : p.getVert qe.val = p.getVert i4.val := by + rw [hqeNode, hf2, hfirst.2.2.2.2] + exact hpath.getVert_injOn + (by simpa using fin_le qe) (by simpa using fin_le i4) hvEq + have hqzi3 : qz.val = i3.val := by + dsimp [qe] at hqei4 + omega + have hwEq : w = R.u2 := by + apply Sum.inl.inj + rw [← hqw, hqzi3, hfirst.2.2.2.1] + exact R.u2_outside (by simpa [X, hwEq] using + (Finset.mem_sdiff.mp hwZ).1) + · exact hreturn_two hsecond.1 hsecond.2.1 hsecond.2.2.1 + hsecond.2.2.2.1 hsecond.2.2.2.2 hf2 + +private theorem helper_havoid_126.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + beta ∈ MissingColors G phi v → + let X : Finset V := TreeSequenceVertexSet T; + let U : Finset V := + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let Z : Finset V := X \ U; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi (↑d : Fin k) beta; + v ∈ Z → + v ∈ X → + ColoredVertexSetClosed G phi X → + (∀ (j : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) j ∈ X) → + (∀ (j : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) j ∈ U) → + (∀ (f : E), + phi f = some beta → + ∀ (j : Fin (2 : ℕ)), + Incident G (C.blockVertex (D.gammaIndex d) j) f → ∀ w ∈ Z, ¬Incident G w f) → + ∀ (h : E) (i0 i1 i2 i3 i4 qv qf : Fin (p.length + (1 : ℕ))), + (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) → + (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) → + (↑i3 : ℕ) = (↑i2 : ℕ) + (1 : ℕ) → + (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) → + p.getVert (↑i0 : ℕ) = Sum.inr R.f1 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u2 ∧ p.getVert (↑i4 : ℕ) = Sum.inr R.f2 ∨ + p.getVert (↑i0 : ℕ) = Sum.inr R.f2 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u1 ∧ p.getVert (↑i4 : ℕ) = Sum.inr R.f1 → + (↑i4 : ℕ) < (↑qv : ℕ) → + (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → + p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) → + (∀ (r : Fin (p.length + (1 : ℕ))), + (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet T) → + p.IsPath → + (∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + ∀ (j : Fin (2 : ℕ)), + Sum.inl (C.blockVertex (D.gammaIndex d) j) ∉ p.support := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p hbeta X U Z H hvZ hvX hclosed hblockX hblockU + no_beta_cross h i0 i1 i2 i3 i4 qv qf hi01 hi12 hi23 hi34 horient hi4qv hqfv hqfNode hafter + hpath fin_le j hjSupport + let blockIndices : Finset (Fin (p.length + 1)) := + Finset.univ.filter fun r => ∃ a : Fin 2, + p.getVert r.val = Sum.inl (C.blockVertex (D.gammaIndex d) a) + have hblockIndices : blockIndices.Nonempty := by + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hjSupport + refine ⟨⟨n, by omega⟩, ?_⟩ + simp only [blockIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨j, hn⟩ + let t : Fin (p.length + 1) := blockIndices.min' hblockIndices + have htMem : t ∈ blockIndices := Finset.min'_mem blockIndices hblockIndices + obtain ⟨jt, htNode⟩ : ∃ a : Fin 2, + p.getVert t.val = Sum.inl (C.blockVertex (D.gammaIndex d) a) := by + simpa only [blockIndices, Finset.mem_filter, Finset.mem_univ, true_and] + using htMem + have htMinimal : ∀ r : Fin (p.length + 1), r ∈ blockIndices → t.val ≤ r.val := by + intro r hr + exact_mod_cast Finset.min'_le blockIndices r hr + have htPos : 0 < t.val := by + by_contra hn + have ht0 : t.val = 0 := by omega + have hvBlock : v = C.blockVertex (D.gammaIndex d) jt := by + rw [ht0, p.getVert_zero] at htNode + exact Sum.inl.inj htNode + have hvNotU := (Finset.mem_sdiff.mp hvZ).2 + apply hvNotU + simpa [hvBlock] using hblockU jt + let zIndices : Finset (Fin (p.length + 1)) := + Finset.univ.filter fun r => r.val < t.val ∧ + ∃ w ∈ Z, p.getVert r.val = Sum.inl w + have hzIndices : zIndices.Nonempty := by + refine ⟨⟨0, by omega⟩, ?_⟩ + simp only [zIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨htPos, v, hvZ, p.getVert_zero⟩ + let qz : Fin (p.length + 1) := zIndices.max' hzIndices + have hqzMem : qz ∈ zIndices := Finset.max'_mem zIndices hzIndices + obtain ⟨hqzt, w, hwZ, hqw⟩ : qz.val < t.val ∧ + ∃ w ∈ Z, p.getVert qz.val = Sum.inl w := by + simpa only [zIndices, Finset.mem_filter, Finset.mem_univ, true_and] + using hqzMem + have hqzMax : ∀ r : Fin (p.length + 1), r ∈ zIndices → r.val ≤ qz.val := by + intro r hr + exact_mod_cast Finset.le_max' zIndices r hr + let qe : Fin (p.length + 1) := ⟨qz.val + 1, by omega⟩ + have hqzAdj := p.adj_getVert_succ (i := qz.val) (by omega : qz.val < p.length) + have hqzAdj' : H.Adj (Sum.inl w) (p.getVert qe.val) := by + simpa [H, qe, hqw] using hqzAdj + have hqet : qe.val < t.val := by + have hne : qe.val ≠ t.val := by + intro heq + have hadj : H.Adj (Sum.inl w) + (Sum.inl (C.blockVertex (D.gammaIndex d) jt)) := by + simpa [heq, htNode] using hqzAdj' + simp [H, TwoColorIncidenceGraph] at hadj + change qz.val + 1 ≠ t.val at hne + change qz.val + 1 < t.val + omega + obtain ⟨f, hqeNode, hwf, hfColors⟩ : ∃ f : E, + p.getVert qe.val = Sum.inr f ∧ Incident G w f ∧ + (phi f = some d.1 ∨ phi f = some beta) := by + cases hn : p.getVert qe.val with + | inl a => + exfalso + have hadj : H.Adj (Sum.inl w) (Sum.inl a) := by + simpa [hn] using hqzAdj' + simp [H, TwoColorIncidenceGraph] at hadj + | inr e => + refine ⟨e, rfl, ?_⟩ + rw [hn] at hqzAdj' + simpa [H, TwoColorIncidenceGraph] using hqzAdj' + let qx : Fin (p.length + 1) := ⟨qe.val + 1, by omega⟩ + have hqeAdj := p.adj_getVert_succ (i := qe.val) (by omega : qe.val < p.length) + have hqeAdj' : H.Adj (Sum.inr f) (p.getVert qx.val) := by + simpa [H, qx, hqeNode] using hqeAdj + obtain ⟨x, hqxNode, hxf⟩ : ∃ x : V, + p.getVert qx.val = Sum.inl x ∧ Incident G x f := by + cases hn : p.getVert qx.val with + | inl a => + refine ⟨a, rfl, ?_⟩ + have hadj : H.Adj (Sum.inr f) (Sum.inl a) := by + simpa [hn] using hqeAdj' + have hpair : Incident G a f ∧ + (phi f = some d.1 ∨ phi f = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hadj + exact hpair.1 + | inr e => + exfalso + have hadj : H.Adj (Sum.inr f) (Sum.inr e) := by + simpa [hn] using hqeAdj' + simp [H, TwoColorIncidenceGraph] at hadj + have hqxle : qx.val ≤ t.val := by dsimp [qx]; omega + have hxOutside := @helper_hxOutside_165 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d beta v z p hblockU no_beta_cross i0 i1 i2 i3 i4 qv qf + hblockIndices jt htNode hzIndices hqzt w hwZ hqzMax hqet f hwf hfColors x hqxNode hxf hqxle + have hfdelta := @helper_hfdelta_489 V E inferInstance inferInstance inferInstance inferInstance G + k e0 phi T C D d beta v z p hbeta hvX hclosed i0 i1 i2 i3 i4 qv qf hpath fin_le hblockIndices + hzIndices hqzt w hwZ hqw hqet f hwf hfColors x hqxNode hxf hxOutside + have hfEnds := @helper_hfEnds_509 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d beta v z p i0 i1 i2 i3 i4 qv qf hpath fin_le hblockIndices hzIndices hqzt w hqw + hqet f hwf x hqxNode hxf + have hfBoundaryZ : f ∈ BoundaryColorEdges G phi Z d.1 := by + simp only [BoundaryColorEdges, Finset.mem_filter] + refine ⟨?_, hfdelta⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwZ, x, fun hxZ => hxOutside (Finset.mem_sdiff.mp hxZ).1, hfEnds⟩ + have hfThree : f = D.f0 d ∨ f = R.f1 ∨ f = R.f2 := by + apply (R.exact_three f).mp + exact ⟨by simpa [X, U, Z] using hfBoundaryZ, + ⟨x, by simpa [X] using hxOutside, hxf⟩⟩ + have hblockOutsideNe : ∀ (u : V), u ∉ X → ∀ a : Fin 2, + u ≠ C.blockVertex (D.gammaIndex d) a := by + intro u hu a hua + exact hu (hua ▸ hblockX a) + have hreturn_one := @helper_hreturn_one_242 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R beta v z p hblockU h i0 i1 i2 i3 i4 qv qf hi01 hi12 hi23 + hi34 hi4qv hqfv hpath fin_le hblockIndices jt htNode hzIndices hqzt hqzMax hqet f hqeNode + hblockOutsideNe + have hreturn_two := @helper_hreturn_two_319 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R beta v z p hblockU h i0 i1 i2 i3 i4 qv qf hi01 hi12 hi23 + hi34 hi4qv hqfv hpath fin_le hblockIndices jt htNode hzIndices hqzt hqzMax hqet f hqeNode + hblockOutsideNe + rcases hfThree with hf0 | hf1 | hf2 + · have hqeqf : qe.val = qf.val := by + have hvEq : p.getVert qe.val = p.getVert qf.val := by + rw [hqeNode, hf0, hqfNode] + exact hpath.getVert_injOn + (by simpa using fin_le qe) (by simpa using fin_le qf) hvEq + have hqvt : qv.val < t.val := by + dsimp [qe] at hqeqf + omega + exact (hafter t hqvt (C.blockVertex (D.gammaIndex d) jt) htNode) + (hblockX jt) + · exact @helper_branch_563 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R beta v z p h i0 i1 i2 i3 i4 qv qf hi34 horient hpath fin_le hblockIndices + hzIndices hqzt w hwZ hqw hqet f hqeNode hreturn_one hf1 + · exact @helper_branch_579 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R beta v z p h i0 i1 i2 i3 i4 qv qf hi34 horient hpath fin_le hblockIndices + hzIndices hqzt w hwZ hqw hqet f hqeNode hreturn_two hf2 +theorem ScheideSymmetricOriginalBoundaryAvoidance {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + ∀ (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi d.1 beta).Walk (Sum.inl v) (Sum.inl z)), + v ∈ + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} → + beta ∈ MissingColors G phi v → + beta ∈ TreeFreeColors phi T → + beta ≠ C.gamma (D.gammaIndex d) → + ScheideDefectiveChainPath T phi d.1 beta v z p → + (∀ j : Fin 2, Sum.inl (C.blockVertex (D.gammaIndex d) j) ∉ p.support) ∧ + ∀ f : E, + f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) d.1 → + ∀ j : Fin 2, ¬Incident G (C.blockVertex (D.gammaIndex d) j) f := by + classical + intro beta v z p hv hbeta hfree hbetaGamma hp + let X := TreeSequenceVertexSet T + let U := ({C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} : Finset V) + let Z := X \ U + let H := TwoColorIncidenceGraph G phi d.1 beta + have hvZ : v ∈ Z := by simpa [X, U, Z] using hv + have hvX : v ∈ X := (Finset.mem_sdiff.mp hvZ).1 + have hglobal : GlobalMaximumTriple G k e0 phi T := C.globally_maximum + have htriple : KTriple G k e0 phi := hglobal.1 + have hproper : IsProperEdgeColoring G phi := htriple.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi X := by + change ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) + exact (ScheideGlobalMaximumOrder G k e0 phi T hglobal).2.2.2.2 + have hblockX : ∀ j : Fin 2, + C.blockVertex (D.gammaIndex d) j ∈ X := by + intro j + change C.blockVertex (D.gammaIndex d) j ∈ TreeSequenceVertexSet T + rw [← C.block_vertex_position (D.gammaIndex d) j] + simp [TreeSequenceVertexSet] + have hblockU : ∀ j : Fin 2, + C.blockVertex (D.gammaIndex d) j ∈ U := by + intro j + have hjval : j.val = 0 ∨ j.val = 1 := by omega + rcases hjval with hjval | hjval + · have hj : j = (0 : Fin 2) := Fin.ext hjval + subst j + simp [U] + · have hj : j = (1 : Fin 2) := Fin.ext hjval + subst j + simp [U] + obtain ⟨b, hbColor, hbEnds⟩ := + ScheideStructuralInternalPair G k e0 phi T C (D.gammaIndex d) beta + hbetaGamma ⟨v, hv, hbeta⟩ + have hbIncident : ∀ j : Fin 2, + Incident G (C.blockVertex (D.gammaIndex d) j) b := by + intro j + have hjval : j.val = 0 ∨ j.val = 1 := by omega + rcases hjval with hjval | hjval + · have hj : j = (0 : Fin 2) := Fin.ext hjval + subst j + simp [Incident, hbEnds] + · have hj : j = (1 : Fin 2) := Fin.ext hjval + subst j + simp [Incident, hbEnds] + have beta_incident_unique : ∀ (j : Fin 2) (f : E), + Incident G (C.blockVertex (D.gammaIndex d) j) f → + phi f = some beta → f = b := by + intro j f hjf hfColor + by_contra hfb + exact (hproper hfb + ⟨C.blockVertex (D.gammaIndex d) j, hjf, hbIncident j⟩ + hfColor) hbColor + have no_beta_cross : ∀ (f : E), phi f = some beta → + ∀ j : Fin 2, Incident G (C.blockVertex (D.gammaIndex d) j) f → + ∀ w ∈ Z, ¬ Incident G w f := by + intro f hfColor j hjf w hwZ hwf + have hfb : f = b := beta_incident_unique j f hjf hfColor + subst f + have hwU : w ∈ U := by + change w ∈ ({C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} : Finset V) + simpa [Incident, hbEnds] using hwf + exact (Finset.mem_sdiff.mp hwZ).2 hwU + obtain ⟨h, i0, i1, i2, i3, i4, qv, qf, + hhColor, hhEnds, hi01, hi12, hi23, hi34, horient, + hi4qv, hqfv, hqvNode, hqfNode, hafter⟩ := + ScheideSymmetricOriginalPathOrder G k e0 phi T C D d R + beta v z p hv hbeta hfree hbetaGamma hp + have hpath : p.IsPath := hp.2.1 + have fin_le (r : Fin (p.length + 1)) : r.val ≤ p.length := by + have := r.isLt + omega + have havoid := @helper_havoid_126 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R beta v z p hbeta hvZ hvX hclosed hblockX hblockU no_beta_cross h i0 i1 i2 i3 + i4 qv qf hi01 hi12 hi23 hi34 horient hi4qv hqfv hqfNode hafter hpath fin_le + refine ⟨havoid, ?_⟩ + intro f hfBoundary j hjf + have hfSupport : Sum.inr f ∈ p.support := + ((ScheideDefectiveChainBoundaryEdges G k e0 phi T hglobal + d.1 beta d.2 hfree v hvX hbeta z p hp) f).mp hfBoundary |>.2 + have hfColor : phi f = some d.1 := (Finset.mem_filter.mp hfBoundary).2 + have hadj : H.Adj + (Sum.inl (C.blockVertex (D.gammaIndex d) j)) (Sum.inr f) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G (C.blockVertex (D.gammaIndex d) j) f ∧ + (phi f = some d.1 ∨ phi f = some beta) from + ⟨hjf, Or.inl hfColor⟩) + have hfComponent : H.connectedComponentMk (Sum.inr f) = + H.connectedComponentMk (Sum.inl v) := by + change Sum.inr f ∈ TwoColorComponent G phi d.1 beta (Sum.inl v) + rw [← hp.2.2.2] + exact hfSupport + have hjComponent : H.connectedComponentMk + (Sum.inl (C.blockVertex (D.gammaIndex d) j)) = + H.connectedComponentMk (Sum.inl v) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans + hfComponent + apply havoid j + have hjComp : Sum.inl (C.blockVertex (D.gammaIndex d) j) ∈ + TwoColorComponent G phi d.1 beta (Sum.inl v) := hjComponent + rw [← hp.2.2.2] at hjComp + exact hjComp + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalFreePath.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalFreePath.lean new file mode 100644 index 0000000000..6c31a215fb --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalFreePath.lean @@ -0,0 +1,461 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeUsedColors + +/-! +# Scheide Symmetric Original Free Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hendsAvoidU_108.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let this : DecidableEq V := Classical.decEq V; + let X : Finset V := TreeSequenceVertexSet T; + let r : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex r (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex r (1 : Fin (2 : ℕ)); + let U : Finset V := { u0, u1 }; + let ends0 : Finset V := (G.ends e0).toFinset; + ∀ (hr : (↑r : ℕ) < C.s), (2 : ℕ) ≤ C.p → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s), + let m : ℕ := C.p + (2 : ℕ) * (↑r : ℕ); T.vertex (⟨m, Decidable.byContradiction fun (a : ¬m < + T.length + (1 : ℕ)) => + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = u0 → T.vertex (⟨m + (1 : ℕ), Decidable.byContradiction fun (a + : ¬m + (1 : ℕ) < T.length + (1 : ℕ)) => + by + omega + ⟩ : Fin (T.length + (1 : ℕ))) = u1 → X.card = C.p + (2 : ℕ) * C.s → + ∀ v ∈ ends0, v ∉ U := by + classical + intro V E _ _ _ G k e0 phi T C D d this X r u0 u1 U ends0 hr hp hlength m hm0 hm1 hXcard v hv hU + have hv' : v ∈ G.ends e0 := Sym2.mem_toFinset.mp hv + rw [← T.first_edge] at hv' + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + rw [hi, Sym2.mem_iff] at hv' + simp only [U, Finset.mem_insert, Finset.mem_singleton] at hU + rcases hv' with hv' | hv' <;> rcases hU with hu | hu <;> subst v + · have heq : T.vertex ⟨1, by omega⟩ = T.vertex ⟨m, by omega⟩ := by + simpa using hu.trans hm0.symm + have hi' := T.vertex_injective heq + have := congrArg Fin.val hi' + simp at this + omega + · have heq : T.vertex ⟨1, by omega⟩ = T.vertex ⟨m + 1, by omega⟩ := by + simpa using hu.trans hm1.symm + have hi' := T.vertex_injective heq + have := congrArg Fin.val hi' + simp at this + omega + · have hi_lt : i.val < 1 := by simp + have hii : i.val = 0 := by omega + have heq : T.vertex (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ (show (0 : Nat) < T.length by omega)))) = + T.vertex ⟨m, by omega⟩ := by + simpa using hu.trans hm0.symm + have hi' := T.vertex_injective heq + have := congrArg Fin.val hi' + simp [] at this + dsimp [m] at this + omega + · have hi_lt : i.val < 1 := by simp + have hii : i.val = 0 := by omega + have heq : T.vertex (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ (show (0 : Nat) < T.length by omega)))) = + T.vertex ⟨m + 1, by omega⟩ := by + simpa using hu.trans hm1.symm + have hi' := T.vertex_injective heq + have := congrArg Fin.val hi' + simp [] at this + +private theorem helper_hmissing_201.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let _ : DecidableEq V := Classical.decEq V; + let X : Finset V := TreeSequenceVertexSet T; + let r : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex r (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex r (1 : Fin (2 : ℕ)); + let U : Finset V := { u0, u1 }; + let Z : Finset V := X \ U; + let ends0 : Finset V := (G.ends e0).toFinset; Z.card = C.p + (2 : ℕ) * C.s - (2 : ℕ) → + ∀ (hendsSubZ : ends0 ⊆ Z), ends0.card = (2 : ℕ) → ((↑Z : Set V).PairwiseDisjoint fun (v : V) + => MissingColors G phi v) → + ∀ (hnonempty : + ∀ v ∈ Z, (MissingColors G phi v).Nonempty), + let firstColor : (v : V) → v ∈ Z → Fin k := fun (v : V) (hv : v ∈ Z) => Classical.choose + (hnonempty v hv); ( + ∀ (v : V) (hv : v ∈ Z), firstColor v hv ∈ MissingColors G phi v) → + ∀ (hsecond : + ∀ (v : V) (hv : v ∈ ends0), ((MissingColors G phi v).erase (firstColor v (hendsSubZ + hv))).Nonempty), + let extraColor : (v : V) → v ∈ ends0 → Fin k := fun (v : V) (hv : v ∈ ends0) => + Classical.choose (hsecond v hv); ( + ∀ (v : V) (hv : v ∈ ends0), extraColor v hv ∈ (MissingColors G phi v).erase (firstColor v + (hendsSubZ hv))) → + let M : Finset (Fin k) := Z.biUnion fun (v : V) => MissingColors G phi v; Z.card + (2 : ℕ) ≤ + M.card := by + classical + intro V E _ _ _ G k e0 phi T C D d this X r u0 u1 U Z ends0 hZcard hendsSubZ hendsCard hdisj + hnonempty firstColor firstMem hsecond extraColor extraMem M + let domain := Sum {v : V // v ∈ Z} {v : V // v ∈ ends0} + let color : domain → Fin k := fun q => match q with + | Sum.inl v => firstColor v.1 v.2 + | Sum.inr v => extraColor v.1 v.2 + have hmap : ∀ q : domain, color q ∈ M := by + intro q + rcases q with q | q + · apply Finset.mem_biUnion.mpr + exact ⟨q.1, q.2, firstMem q.1 q.2⟩ + · apply Finset.mem_biUnion.mpr + exact ⟨q.1, hendsSubZ q.2, + Finset.mem_erase.mp (extraMem q.1 q.2) |>.2⟩ + have hinj : Function.Injective color := by + intro a b hab + rcases a with a | a <;> rcases b with b | b + · have huv : a.1 = b.1 := by + by_contra hn + have hd := hdisj a.2 b.2 hn + have hc : firstColor a.1 a.2 = firstColor b.1 b.2 := by + simpa [color] using hab + exact (Finset.disjoint_left.mp hd) (firstMem a.1 a.2) + (by simpa only [hc] using firstMem b.1 b.2) + cases Subtype.ext huv + rfl + · have huv : a.1 = b.1 := by + by_contra hn + have hd := hdisj a.2 (hendsSubZ b.2) hn + have hc : firstColor a.1 a.2 = extraColor b.1 b.2 := by + simpa [color] using hab + exact (Finset.disjoint_left.mp hd) (firstMem a.1 a.2) + (by simpa only [hc] using Finset.mem_erase.mp (extraMem b.1 b.2) |>.2) + have he := Finset.mem_erase.mp (extraMem b.1 b.2) + exact False.elim (he.1 (by simpa [color, huv] using hab.symm)) + · have huv : a.1 = b.1 := by + by_contra hn + have hd := hdisj (hendsSubZ a.2) b.2 hn + have hc : extraColor a.1 a.2 = firstColor b.1 b.2 := by + simpa [color] using hab + exact (Finset.disjoint_left.mp hd) + (Finset.mem_erase.mp (extraMem a.1 a.2) |>.2) + (by simpa only [hc] using firstMem b.1 b.2) + have he := Finset.mem_erase.mp (extraMem a.1 a.2) + exact False.elim (he.1 (by simpa [color, huv] using hab)) + · have huv : a.1 = b.1 := by + by_contra hn + have hd := hdisj (hendsSubZ a.2) (hendsSubZ b.2) hn + have hc : extraColor a.1 a.2 = extraColor b.1 b.2 := by + simpa [color] using hab + exact (Finset.disjoint_left.mp hd) + (Finset.mem_erase.mp (extraMem a.1 a.2) |>.2) + (by simpa only [hc] using Finset.mem_erase.mp (extraMem b.1 b.2) |>.2) + cases Subtype.ext huv + rfl + let A : Finset domain := + Z.attach.map ⟨Sum.inl, Sum.inl_injective⟩ ∪ + ends0.attach.map ⟨Sum.inr, Sum.inr_injective⟩ + have hAdisj : Disjoint + (Z.attach.map ⟨Sum.inl, Sum.inl_injective⟩) + (ends0.attach.map ⟨Sum.inr, Sum.inr_injective⟩) := by + rw [Finset.disjoint_left] + intro q hq1 hq2 + rw [Finset.mem_map] at hq1 hq2 + rcases hq1 with ⟨a, ha, rfl⟩ + rcases hq2 with ⟨b, hb, h⟩ + cases h + have hAcard : A.card = Z.card + 2 := by + dsimp [A] + rw [Finset.card_union_of_disjoint hAdisj] + simp [hendsCard] + have hle : A.card ≤ M.card := by + apply Finset.card_le_card_of_injOn color + · intro q hq + exact hmap q + · exact hinj.injOn + omega + +private theorem helper_husedSub_301.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let X : Finset V := TreeSequenceVertexSet T; + let r : Fin C.s := D.gammaIndex d; + ∀ (hr : (↑r : ℕ) < C.s) (hp : (2 : ℕ) ≤ C.p) (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * + C.s) (hXcard : X.card = C.p + (2 : ℕ) * C.s) (htree : TashkinovTree G e0 phi T), + let baseIndex : Fin (C.p - (2 : ℕ)) → Fin T.length := fun (q : Fin (C.p - (2 : ℕ))) => (⟨(↑q : + ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (1 : ℕ) < T.length) => + by omega + ⟩ : Fin T.length); + ∀ (hbaseIndexPos : + ∀ (q : Fin (C.p - (2 : ℕ))), (1 : ℕ) ≤ (↑(baseIndex q) : ℕ)), + let baseColor : Fin (C.p - (2 : ℕ)) → Fin k := fun (q : Fin (C.p - (2 : ℕ))) => + Classical.choose (Exists.choose_spec (htree (baseIndex q) (hbaseIndexPos q))); ( + ∀ (q : Fin (C.p - (2 : ℕ))), phi (T.edge (baseIndex q)) = some (baseColor q)) → + let baseColors : Finset (Fin k) := Finset.image baseColor Finset.univ; + let blockColors : Finset (Fin k) := Finset.image C.gamma Finset.univ; blockColors.card = C.s → + TreeUsedColors phi T ⊆ baseColors ∪ blockColors := by + classical + intro V E _ _ _ G k e0 phi T C D d X r hr hp hlength hXcard htree baseIndex hbaseIndexPos + baseColor hbaseColorSpec baseColors blockColors hblockCard c hc + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc + rcases hc with ⟨j, hj, hc⟩ + by_cases hjBase : j.val < C.p - 1 + · apply Finset.mem_union_left + let q : Fin (C.p - 2) := ⟨j.val - 1, by omega⟩ + have hqj : baseIndex q = j := by + apply Fin.ext + simp [baseIndex, q] + omega + have hcol : baseColor q = c := by + apply Option.some.inj + exact (hbaseColorSpec q).symm.trans (by simpa [hqj] using hc) + exact Finset.mem_image.mpr ⟨q, Finset.mem_univ q, hcol⟩ + · apply Finset.mem_union_right + let n := j.val - (C.p - 1) + have hn : n < 2 * C.s := by + dsimp [n] + omega + let q : Fin C.s := ⟨n / 2, by omega⟩ + let t : Fin 2 := ⟨n % 2, Nat.mod_lt _ (by omega)⟩ + have hjpos : j.val = C.p - 1 + 2 * q.val + t.val := by + dsimp [q, t, n] + have hdiv := Nat.mod_add_div (j.val - (C.p - 1)) 2 + omega + have hedge : T.edge j = C.blockEdge q t := by + have hpos := C.block_edge_position q t + rw [← hpos] + congr 1 + exact Fin.ext hjpos + have hcol : C.gamma q = c := by + apply Option.some.inj + exact (C.block_color q t).symm.trans (by simpa [hedge] using hc) + exact Finset.mem_image.mpr ⟨q, Finset.mem_univ q, hcol⟩ + +theorem ScheideSymmetricOriginalFreePath {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (_ : ScheideReplacementData G k e0 phi T C D d) : + ∃ (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G phi d.1 beta).Walk (Sum.inl v) (Sum.inl z)), + v ∈ + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} ∧ + beta ∈ MissingColors G phi v ∧ + beta ∈ TreeFreeColors phi T ∧ + beta ≠ C.gamma (D.gammaIndex d) ∧ ScheideDefectiveChainPath T phi d.1 beta v z p := by + classical + let := Classical.decEq V + let X := TreeSequenceVertexSet T + let r := D.gammaIndex d + let u0 := C.blockVertex r 0 + let u1 := C.blockVertex r 1 + let U : Finset V := {u0, u1} + let Z := X \ U + let ends0 := (G.ends e0).toFinset + have hr : r.val < C.s := r.isLt + have hs : 1 ≤ C.s := by omega + have hp : 2 ≤ C.p := C.p_ge_two + have hlength : T.length + 1 = C.p + 2 * C.s := C.length_eq + let m := C.p + 2 * r.val + have hm0 : T.vertex ⟨m, by omega⟩ = u0 := by + simpa [m, u0, r] using C.block_vertex_position r (0 : Fin 2) + have hm1 : T.vertex ⟨m + 1, by omega⟩ = u1 := by + simpa [m, u1, r] using C.block_vertex_position r (1 : Fin 2) + have hu0X : u0 ∈ X := by + rw [← hm0] + simp [X, TreeSequenceVertexSet] + have hu1X : u1 ∈ X := by + rw [← hm1] + simp [X, TreeSequenceVertexSet] + have hu01 : u0 ≠ u1 := by + intro h + have hv : T.vertex ⟨m, by omega⟩ = T.vertex ⟨m + 1, by omega⟩ := + hm0.trans (h.trans hm1.symm) + have hi := T.vertex_injective hv + have hiv := congrArg Fin.val hi + simp at hiv + have hUsub : U ⊆ X := by + intro v hv + simp only [U, Finset.mem_insert, Finset.mem_singleton] at hv + rcases hv with rfl | rfl + · exact hu0X + · exact hu1X + have hUcard : U.card = 2 := by + simp [U, hu01] + have hXcard : X.card = C.p + 2 * C.s := by + have himage : X.card = T.length + 1 := by + dsimp [X, TreeSequenceVertexSet] + rw [Finset.card_image_iff.mpr (by + intro a ha b hb hab + exact T.vertex_injective hab)] + simp + omega + have hZcard : Z.card = C.p + 2 * C.s - 2 := by + dsimp [Z] + rw [Finset.card_sdiff_of_subset hUsub, hXcard, hUcard] + have hendsSubX : ends0 ⊆ X := by + intro v hv + have hv' : v ∈ G.ends e0 := Sym2.mem_toFinset.mp hv + rw [← T.first_edge] at hv' + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + rw [hi, Sym2.mem_iff] at hv' + rcases hv' with hv | hv <;> subst v <;> + simp [X, TreeSequenceVertexSet] + have hendsAvoidU : ∀ v ∈ ends0, v ∉ U := by + exact @helper_hendsAvoidU_108 V E inferInstance inferInstance inferInstance G k e0 phi T C D + d hr hp hlength hm0 hm1 hXcard + have hendsSubZ : ends0 ⊆ Z := by + intro v hv + exact Finset.mem_sdiff.mpr ⟨hendsSubX hv, hendsAvoidU v hv⟩ + have hendsCard : ends0.card = 2 := by + have hn : ¬ (G.ends e0).IsDiag := by + intro hd + induction he : G.ends e0 using Sym2.inductionOn with + | _ a b => + rw [he] at hd + rw [Sym2.mk_isDiag_iff] at hd + apply G.loopless e0 a + rw [he, hd] + exact Sym2.card_toFinset_of_not_isDiag _ hn + have hendsInc : ∀ v ∈ ends0, Incident G v e0 := by + intro v hv + exact Sym2.mem_toFinset.mp hv + have hglobal : GlobalMaximumTriple G k e0 phi T := C.globally_maximum + have horder := ScheideGlobalMaximumOrder G k e0 phi T hglobal + have helem : ColoredVertexSetElementary G phi X := horder.2.2.2.1 + have hcounts := ScheideGlobalMaximumMissingCounts G k e0 phi T hglobal + have hdisj : (Z : Set V).PairwiseDisjoint (fun v => MissingColors G phi v) := by + intro a ha b hb hab + exact helem (Finset.mem_sdiff.mp ha).1 (Finset.mem_sdiff.mp hb).1 hab + have hnonempty : ∀ v ∈ Z, (MissingColors G phi v).Nonempty := by + intro v hv + apply Finset.card_pos.mp + have hvX := (Finset.mem_sdiff.mp hv).1 + by_cases hi : Incident G v e0 + · have hh := (hcounts v hvX).1 hi |>.2 + omega + · have hh := (hcounts v hvX).2 hi |>.2 + omega + let firstColor : (v : V) → v ∈ Z → Fin k := fun v hv => + Classical.choose (hnonempty v hv) + have firstMem : ∀ (v : V) (hv : v ∈ Z), + firstColor v hv ∈ MissingColors G phi v := by + intro v hv + exact Classical.choose_spec (hnonempty v hv) + have hsecond : ∀ (v : V) (hv : v ∈ ends0), + ((MissingColors G phi v).erase (firstColor v (hendsSubZ hv))).Nonempty := by + intro v hv + apply Finset.card_pos.mp + rw [Finset.card_erase_of_mem (firstMem v (hendsSubZ hv))] + have hh := (hcounts v (hendsSubX hv)).1 (hendsInc v hv) |>.2 + omega + let extraColor : (v : V) → v ∈ ends0 → Fin k := fun v hv => + Classical.choose (hsecond v hv) + have extraMem : ∀ (v : V) (hv : v ∈ ends0), + extraColor v hv ∈ + (MissingColors G phi v).erase (firstColor v (hendsSubZ hv)) := by + intro v hv + exact Classical.choose_spec (hsecond v hv) + let M := Z.biUnion fun v => MissingColors G phi v + have hmissing : Z.card + 2 ≤ M.card := by + exact @helper_hmissing_201 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + hZcard hendsSubZ hendsCard hdisj hnonempty firstMem hsecond extraMem + have hmissingBound : C.p + 2 * C.s ≤ M.card := by + omega + have htree : TashkinovTree G e0 phi T := hglobal.2.1 + let baseIndex : Fin (C.p - 2) → Fin T.length := fun q => ⟨q.val + 1, by omega⟩ + have hbaseIndexPos : ∀ q : Fin (C.p - 2), 1 ≤ (baseIndex q).val := by + intro q + simp [baseIndex] + let baseColor : Fin (C.p - 2) → Fin k := fun q => + Classical.choose (htree (baseIndex q) (hbaseIndexPos q) |>.choose_spec) + have hbaseColorSpec : ∀ q : Fin (C.p - 2), + phi (T.edge (baseIndex q)) = some (baseColor q) := by + intro q + exact (Classical.choose_spec (htree (baseIndex q) (hbaseIndexPos q) |>.choose_spec)).1 + let baseColors := (Finset.univ : Finset (Fin (C.p - 2))).image baseColor + let blockColors := (Finset.univ : Finset (Fin C.s)).image C.gamma + have hbaseCard : baseColors.card ≤ C.p - 2 := by + exact (Finset.card_image_le.trans_eq (by + simp : (Finset.univ : Finset (Fin (C.p - 2))).card = C.p - 2)) + have hblockCard : blockColors.card = C.s := by + dsimp [blockColors] + rw [Finset.card_image_iff.mpr (by + intro a ha b hb hab + exact C.gamma_injective hab)] + simp + have husedSub : TreeUsedColors phi T ⊆ baseColors ∪ blockColors := by + exact @helper_husedSub_301 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + hr hp hlength hXcard htree hbaseIndexPos hbaseColorSpec hblockCard + have hused : (TreeUsedColors phi T).card ≤ C.p - 2 + C.s := by + refine (Finset.card_le_card husedSub).trans ?_ + calc + (baseColors ∪ blockColors).card ≤ baseColors.card + blockColors.card := + Finset.card_union_le _ _ + _ ≤ (C.p - 2) + C.s := by omega + have hstrict : (TreeUsedColors phi T).card < M.card := by + omega + have hnsub : ¬ M ⊆ TreeUsedColors phi T := by + intro hsub + have := Finset.card_le_card hsub + omega + rw [Finset.not_subset] at hnsub + obtain ⟨beta, hbetaM, hbetaUnused⟩ := hnsub + obtain ⟨v, hvZ, hbetaMissing⟩ := Finset.mem_biUnion.mp hbetaM + have hvX : v ∈ X := (Finset.mem_sdiff.mp hvZ).1 + have hbetaTreeMissing : beta ∈ TreeMissingColors phi T := by + exact Finset.mem_biUnion.mpr ⟨v, hvX, hbetaMissing⟩ + have hbetaFree : beta ∈ TreeFreeColors phi T := by + exact Finset.mem_sdiff.mpr ⟨hbetaTreeMissing, hbetaUnused⟩ + have hgammaUsed : C.gamma r ∈ TreeUsedColors phi T := by + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + let j : Fin T.length := ⟨C.p - 1 + 2 * r.val, by omega⟩ + refine ⟨j, by simp [j]; omega, ?_⟩ + rw [show T.edge j = C.blockEdge r (0 : Fin 2) by + simpa [j] using C.block_edge_position r (0 : Fin 2)] + exact C.block_color r 0 + have hbetaGamma : beta ≠ C.gamma r := by + intro h + exact hbetaUnused (h ▸ hgammaUsed) + obtain ⟨z, path, hpath⟩ := ScheideDefectiveChainPathExists + G k e0 phi T hglobal d.1 beta d.2 hbetaFree v hvX hbetaMissing + refine ⟨beta, v, z, path, ?_, hbetaMissing, hbetaFree, ?_, hpath⟩ + · simpa [Z, X, U, u0, u1, r] using hvZ + · simpa [r] using hbetaGamma + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalPathOrder.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalPathOrder.lean new file mode 100644 index 0000000000..f0648c23f7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalPathOrder.lean @@ -0,0 +1,989 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementInternalMissing +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalFreePath +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo + +/-! +# Scheide Symmetric Original Path Order + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_forwardAdjacent_201.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi (↑d : Fin k) beta; + IsProperEdgeColoring G phi → + p.IsPath → + (0 : ℕ) < p.length → + (∀ (x : V ⊕ E), H.Adj (Sum.inl v) x → x = p.getVert (1 : ℕ)) → + ∀ (i j : ℕ), + i ≤ p.length → + j ≤ p.length → + i < j → + H.Adj (p.getVert i) (p.getVert j) → + i + (1 : ℕ) = j := by + classical + intro V E _ _ G k e0 phi T d beta v z p H hproper hpath hlength startNeighborUnique i j hi hj + hijlt hij + by_contra hnot + have hgap : i + 1 < j := by omega + by_cases hi0 : i = 0 + · subst i + have heq := startNeighborUnique (p.getVert j) (by simpa using hij) + have hinj := hpath.getVert_injOn (by omega : 1 ≤ p.length) hj heq.symm + omega + · have hipos : 0 < i := Nat.pos_of_ne_zero hi0 + have hprev := p.adj_getVert_succ (i := i - 1) (by omega) + have hnext := p.adj_getVert_succ (i := i) (by omega) + have hprev' : H.Adj (p.getVert i) (p.getVert (i - 1)) := by + have hieq : i - 1 + 1 = i := by omega + simpa [H, hieq] using hprev.symm + have hnext' : H.Adj (p.getVert i) (p.getVert (i + 1)) := by + simpa [H] using hnext + have hprevNext : p.getVert (i - 1) ≠ p.getVert (i + 1) := by + intro heq + have hindex := hpath.getVert_injOn + (by omega : i - 1 ≤ p.length) (by omega : i + 1 ≤ p.length) heq + omega + have hprevJ : p.getVert (i - 1) ≠ p.getVert j := by + intro heq + have hindex := hpath.getVert_injOn (by omega : i - 1 ≤ p.length) hj heq + omega + have hnextJ : p.getVert (i + 1) ≠ p.getVert j := by + intro heq + have hindex := hpath.getVert_injOn (by omega : i + 1 ≤ p.length) hj heq + omega + let S : Finset (Sum V E) := + {p.getVert (i - 1), p.getVert (i + 1), p.getVert j} + have hScard : S.card = 3 := by + simp [S, hprevNext, hprevJ, hnextJ] + have hSsub : ∀ x ∈ S, x ∈ H.neighborSet (p.getVert i) := by + intro x hx + simp only [S, Finset.mem_insert, Finset.mem_singleton] at hx + rcases hx with rfl | rfl | rfl + · simpa only [SimpleGraph.mem_neighborSet] using hprev' + · simpa only [SimpleGraph.mem_neighborSet] using hnext' + · simpa only [SimpleGraph.mem_neighborSet] using hij + let inclusion : {x // x ∈ S} → H.neighborSet (p.getVert i) := + fun x => ⟨x.1, hSsub x.1 x.2⟩ + have hinclusion : Function.Injective inclusion := by + intro x y hxy + apply Subtype.ext + exact congrArg (fun z : H.neighborSet (p.getVert i) => z.1) hxy + let : Fintype (H.neighborSet (p.getVert i)) := Fintype.ofFinite _ + have hcard := Fintype.card_le_of_injective inclusion hinclusion + rw [Fintype.card_coe, hScard, + SimpleGraph.card_neighborSet_eq_degree] at hcard + have hdegree := TwoColorIncidenceDegreeAtMostTwo G phi d.1 beta hproper + (p.getVert i) + have hdegree' : H.degree (p.getVert i) ≤ 2 := by + simpa only [H] using hdegree + omega + +private theorem helper_branch_436.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + let X : Finset V := TreeSequenceVertexSet T; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi (↑d : Fin k) beta; + ∀ (h : E), + phi h = some beta → + G.ends h = s(R.u1, R.u2) → + p.IsPath → + ∀ (j0 : ℕ), + p.getVert j0 = Sum.inr R.f1 → + j0 ≤ p.length → + ∀ (j1 : ℕ), + p.getVert j1 = Sum.inl R.u1 → + ∀ (j2 : ℕ), + p.getVert j2 = Sum.inr h → + ∀ (j3 : ℕ), + p.getVert j3 = Sum.inl R.u2 → + ∀ (j4 : ℕ), + p.getVert j4 = Sum.inr R.f2 → + j4 ≤ p.length → + let insideIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | ∃ w ∈ X, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (insideNonempty : insideIndices.Nonempty), + let qv : Fin (p.length + (1 : ℕ)) := insideIndices.max' insideNonempty; + ∀ w ∈ X, + p.getVert (↑qv : ℕ) = Sum.inl w → + (∀ (r : Fin (p.length + (1 : ℕ))), + (↑qv : ℕ) < (↑r : ℕ) → ∀ (a : V), p.getVert (↑r : ℕ) = Sum.inl a → a ∉ X) → + ∀ (hqvlt : (↑qv : ℕ) < p.length), + let qf : Fin (p.length + (1 : ℕ)) := + (⟨(↑qv : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qv : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → + ∀ (f : E), + p.getVert (↑qf : ℕ) = Sum.inr f → + Incident G w f → + (↑qf : ℕ) < p.length → + f = D.f0 d ∨ f = R.f1 ∨ f = R.f2 → + j1 = j0 + (1 : ℕ) ∧ j2 = j1 + (1 : ℕ) ∧ j3 = j2 + (1 : ℕ) ∧ j4 = j3 + (1 : ℕ) → + ∃ (h : E) (i0 : Fin (p.length + (1 : ℕ))) (i1 : Fin (p.length + (1 : ℕ))) (i2 : + Fin (p.length + (1 : ℕ))) (i3 : Fin (p.length + (1 : ℕ))) (i4 : + Fin (p.length + (1 : ℕ))) (qv : Fin (p.length + (1 : ℕ))) (qf : + Fin (p.length + (1 : ℕ))), + phi h = some beta ∧ + G.ends h = s(R.u1, R.u2) ∧ + (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) ∧ + (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) ∧ + (↑i3 : ℕ) = (↑i2 : ℕ) + (1 : ℕ) ∧ + (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) ∧ + (p.getVert (↑i0 : ℕ) = Sum.inr R.f1 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i4 : ℕ) = Sum.inr R.f2 ∨ + p.getVert (↑i0 : ℕ) = Sum.inr R.f2 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i4 : ℕ) = Sum.inr R.f1) ∧ + (↑i4 : ℕ) < (↑qv : ℕ) ∧ + (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) ∧ + p.getVert (↑qv : ℕ) = Sum.inl (D.v0 d) ∧ + p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) ∧ + ∀ (r : Fin (p.length + (1 : ℕ))), + (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), + p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet T := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p X H h hhcolor hhends hpath j0 hj0 hj0le j1 + hj1 j2 hj2 j3 hj3 j4 hj4 hj4le insideIndices insideNonempty qv w hwX hqvw hafter hqvlt qf + hqfval f hqff hwf hqflt hfThree horient + rcases horient with ⟨hj01, hj12, hj23, hj34⟩ + let i0 : Fin (p.length + 1) := ⟨j0, by omega⟩ + let i1 : Fin (p.length + 1) := ⟨j1, by omega⟩ + let i2 : Fin (p.length + 1) := ⟨j2, by omega⟩ + let i3 : Fin (p.length + 1) := ⟨j3, by omega⟩ + let i4 : Fin (p.length + 1) := ⟨j4, by omega⟩ + have hi4lt : i4.val < p.length := by + by_contra hn + have heq : i4.val = p.length := by omega + have := hj4 + rw [← show i4.val = j4 by rfl, heq, p.getVert_length] at this + simp at this + let ir : Fin (p.length + 1) := ⟨i4.val + 1, by omega⟩ + have hretAdj := p.adj_getVert_succ (i := i4.val) hi4lt + have hret : p.getVert ir.val = Sum.inl R.v2 := by + have hprev : p.getVert (i4.val - 1) = Sum.inl R.u2 := by + have heq : i4.val - 1 = j3 := by simp [i4]; omega + simpa [heq] using hj3 + cases hcase : p.getVert ir.val with + | inr e => + rw [show p.getVert i4.val = Sum.inr R.f2 by simpa [i4] using hj4, + hcase] at hretAdj + simp [TwoColorIncidenceGraph] at hretAdj + | inl y => + have hinc : Incident G y R.f2 := by + rw [show p.getVert i4.val = Sum.inr R.f2 by simpa [i4] using hj4, + hcase] at hretAdj + have hretAdj' : Incident G y R.f2 ∧ + (phi R.f2 = some d.1 ∨ phi R.f2 = some beta) := by + simpa [H, ir, TwoColorIncidenceGraph] using hretAdj + exact hretAdj'.1 + have hy : y = R.v2 ∨ y = R.u2 := by + simpa [Incident, R.f2_ends] using hinc + rcases hy with rfl | rfl + · simp + · exfalso + have hinj := hpath.getVert_injOn (by omega : i4.val - 1 ≤ p.length) + (by omega : ir.val ≤ p.length) + (hprev.trans hcase.symm) + have hne : i4.val - 1 ≠ ir.val := by simp [ir] + exact hne hinj + have hirMem : ir ∈ insideIndices := by + simp only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨R.v2, (Finset.mem_sdiff.mp R.v2_in_remainder).1, hret⟩ + have hirle := Finset.le_max' insideIndices ir hirMem + have hi4qv : i4.val < qv.val := by + change ir.val ≤ qv.val at hirle + simp [ir] at hirle + omega + have hfn1 : f ≠ R.f1 := by + intro heq + have hverts : p.getVert qf.val = p.getVert i0.val := by + rw [hqff, heq] + simpa [i0] using hj0.symm + have hind := hpath.getVert_injOn (by omega : qf.val ≤ p.length) + (by omega : i0.val ≤ p.length) hverts + simp [qf, i0, i4] at hind hi4qv + omega + have hfn2 : f ≠ R.f2 := by + intro heq + have hverts : p.getVert qf.val = p.getVert i4.val := by + rw [hqff, heq] + simpa [i4] using hj4.symm + have hind := hpath.getVert_injOn (by omega : qf.val ≤ p.length) + (by omega : i4.val ≤ p.length) hverts + simp [qf] at hind + omega + have hf0 : f = D.f0 d := hfThree.resolve_right (by + rintro (heq | heq) + · exact hfn1 heq + · exact hfn2 heq) + have hwv0 : w = D.v0 d := by + have hwinc : Incident G w (D.f0 d) := hf0 ▸ hwf + have hwcase : w = D.v0 d ∨ w = D.u0 d := by + simpa [Incident, D.f0_ends] using hwinc + exact hwcase.resolve_right (fun hwu => D.u0_outside d (hwu ▸ hwX)) + refine ⟨h, i0, i1, i2, i3, i4, qv, qf, hhcolor, hhends, + by simpa [i0, i1] using hj01, + by simpa [i1, i2] using hj12, + by simpa [i2, i3] using hj23, + by simpa [i3, i4] using hj34, ?_, hi4qv, hqfval, ?_, ?_, ?_⟩ + · left + exact ⟨by simpa [i0] using hj0, by simpa [i1] using hj1, + by simpa [i2] using hj2, by simpa [i3] using hj3, + by simpa [i4] using hj4⟩ + · simpa [hwv0] using hqvw + · simpa [hf0] using hqff + · simpa [X] using hafter + +private theorem helper_branch_524.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + let X : Finset V := TreeSequenceVertexSet T; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi (↑d : Fin k) beta; + ∀ (h : E), + phi h = some beta → + G.ends h = s(R.u1, R.u2) → + p.IsPath → + ∀ (j0 : ℕ), + p.getVert j0 = Sum.inr R.f1 → + j0 ≤ p.length → + ∀ (j1 : ℕ), + p.getVert j1 = Sum.inl R.u1 → + ∀ (j2 : ℕ), + p.getVert j2 = Sum.inr h → + ∀ (j3 : ℕ), + p.getVert j3 = Sum.inl R.u2 → + ∀ (j4 : ℕ), + p.getVert j4 = Sum.inr R.f2 → + j4 ≤ p.length → + let insideIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | ∃ w ∈ X, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (insideNonempty : insideIndices.Nonempty), + let qv : Fin (p.length + (1 : ℕ)) := insideIndices.max' insideNonempty; + ∀ w ∈ X, + p.getVert (↑qv : ℕ) = Sum.inl w → + (∀ (r : Fin (p.length + (1 : ℕ))), + (↑qv : ℕ) < (↑r : ℕ) → ∀ (a : V), p.getVert (↑r : ℕ) = Sum.inl a → a ∉ X) → + ∀ (hqvlt : (↑qv : ℕ) < p.length), + let qf : Fin (p.length + (1 : ℕ)) := + (⟨(↑qv : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qv : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → + ∀ (f : E), + p.getVert (↑qf : ℕ) = Sum.inr f → + Incident G w f → + (↑qf : ℕ) < p.length → + f = D.f0 d ∨ f = R.f1 ∨ f = R.f2 → + j3 = j4 + (1 : ℕ) ∧ j2 = j3 + (1 : ℕ) ∧ j1 = j2 + (1 : ℕ) ∧ j0 = j1 + (1 : ℕ) → + ∃ (h : E) (i0 : Fin (p.length + (1 : ℕ))) (i1 : Fin (p.length + (1 : ℕ))) (i2 : + Fin (p.length + (1 : ℕ))) (i3 : Fin (p.length + (1 : ℕ))) (i4 : + Fin (p.length + (1 : ℕ))) (qv : Fin (p.length + (1 : ℕ))) (qf : + Fin (p.length + (1 : ℕ))), + phi h = some beta ∧ + G.ends h = s(R.u1, R.u2) ∧ + (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) ∧ + (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) ∧ + (↑i3 : ℕ) = (↑i2 : ℕ) + (1 : ℕ) ∧ + (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) ∧ + (p.getVert (↑i0 : ℕ) = Sum.inr R.f1 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i4 : ℕ) = Sum.inr R.f2 ∨ + p.getVert (↑i0 : ℕ) = Sum.inr R.f2 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i4 : ℕ) = Sum.inr R.f1) ∧ + (↑i4 : ℕ) < (↑qv : ℕ) ∧ + (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) ∧ + p.getVert (↑qv : ℕ) = Sum.inl (D.v0 d) ∧ + p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) ∧ + ∀ (r : Fin (p.length + (1 : ℕ))), + (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), + p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet T := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p X H h hhcolor hhends hpath j0 hj0 hj0le j1 + hj1 j2 hj2 j3 hj3 j4 hj4 hj4le insideIndices insideNonempty qv w hwX hqvw hafter hqvlt qf + hqfval f hqff hwf hqflt hfThree horient + rcases horient with ⟨hj43, hj32, hj21, hj10⟩ + let i0 : Fin (p.length + 1) := ⟨j4, by omega⟩ + let i1 : Fin (p.length + 1) := ⟨j3, by omega⟩ + let i2 : Fin (p.length + 1) := ⟨j2, by omega⟩ + let i3 : Fin (p.length + 1) := ⟨j1, by omega⟩ + let i4 : Fin (p.length + 1) := ⟨j0, by omega⟩ + have hi4lt : i4.val < p.length := by + by_contra hn + have heq : i4.val = p.length := by omega + have := hj0 + rw [← show i4.val = j0 by rfl, heq, p.getVert_length] at this + simp at this + let ir : Fin (p.length + 1) := ⟨i4.val + 1, by omega⟩ + have hretAdj := p.adj_getVert_succ (i := i4.val) hi4lt + have hret : p.getVert ir.val = Sum.inl R.v1 := by + have hprev : p.getVert (i4.val - 1) = Sum.inl R.u1 := by + have heq : i4.val - 1 = j1 := by simp [i4]; omega + simpa [heq] using hj1 + cases hcase : p.getVert ir.val with + | inr e => + rw [show p.getVert i4.val = Sum.inr R.f1 by simpa [i4] using hj0, + hcase] at hretAdj + simp [TwoColorIncidenceGraph] at hretAdj + | inl y => + have hinc : Incident G y R.f1 := by + rw [show p.getVert i4.val = Sum.inr R.f1 by simpa [i4] using hj0, + hcase] at hretAdj + have hretAdj' : Incident G y R.f1 ∧ + (phi R.f1 = some d.1 ∨ phi R.f1 = some beta) := by + simpa [H, ir, TwoColorIncidenceGraph] using hretAdj + exact hretAdj'.1 + have hy : y = R.v1 ∨ y = R.u1 := by + simpa [Incident, R.f1_ends] using hinc + rcases hy with rfl | rfl + · simp + · exfalso + have hinj := hpath.getVert_injOn (by omega : i4.val - 1 ≤ p.length) + (by omega : ir.val ≤ p.length) + (hprev.trans hcase.symm) + have hne : i4.val - 1 ≠ ir.val := by simp [ir] + exact hne hinj + have hirMem : ir ∈ insideIndices := by + simp only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨R.v1, (Finset.mem_sdiff.mp R.v1_in_remainder).1, hret⟩ + have hirle := Finset.le_max' insideIndices ir hirMem + have hi4qv : i4.val < qv.val := by + change ir.val ≤ qv.val at hirle + simp [ir] at hirle + omega + have hfn1 : f ≠ R.f1 := by + intro heq + have hverts : p.getVert qf.val = p.getVert i4.val := by + rw [hqff, heq] + simpa [i4] using hj0.symm + have hind := hpath.getVert_injOn (by omega : qf.val ≤ p.length) + (by omega : i4.val ≤ p.length) hverts + simp [qf] at hind + omega + have hfn2 : f ≠ R.f2 := by + intro heq + have hverts : p.getVert qf.val = p.getVert i0.val := by + rw [hqff, heq] + simpa [i0] using hj4.symm + have hind := hpath.getVert_injOn (by omega : qf.val ≤ p.length) + (by omega : i0.val ≤ p.length) hverts + simp [qf, i0, i4] at hind hi4qv + omega + have hf0 : f = D.f0 d := hfThree.resolve_right (by + rintro (heq | heq) + · exact hfn1 heq + · exact hfn2 heq) + have hwv0 : w = D.v0 d := by + have hwinc : Incident G w (D.f0 d) := hf0 ▸ hwf + have hwcase : w = D.v0 d ∨ w = D.u0 d := by + simpa [Incident, D.f0_ends] using hwinc + exact hwcase.resolve_right (fun hwu => D.u0_outside d (hwu ▸ hwX)) + refine ⟨h, i0, i1, i2, i3, i4, qv, qf, hhcolor, hhends, + by simpa [i0, i1] using hj43, + by simpa [i1, i2] using hj32, + by simpa [i2, i3] using hj21, + by simpa [i3, i4] using hj10, ?_, hi4qv, hqfval, ?_, ?_, ?_⟩ + · right + exact ⟨by simpa [i0] using hj4, by simpa [i1] using hj3, + by simpa [i2] using hj2, by simpa [i3] using hj1, + by simpa [i4] using hj0⟩ + · simpa [hwv0] using hqvw + · simpa [hf0] using hqff + · simpa [X] using hafter + +private theorem helper_startNeighborUnique_582.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi (↑d : Fin k) beta; + IsProperEdgeColoring G phi → + (0 : ℕ) < p.length → + (∀ (e : E), Incident G v e → phi e ≠ some beta) → + ∀ (x : V ⊕ E), + H.Adj (Sum.inl v) x → + x = p.getVert (1 : ℕ) := by + classical + intro V E _ _ G k e0 phi T d beta v z p H hproper hlength hbetaAbsent x hx + have hfirst := p.adj_getVert_succ (i := 0) hlength + rw [p.getVert_zero] at hfirst + cases hxcase : x with + | inl w => + rw [hxcase] at hx + simp [H, TwoColorIncidenceGraph] at hx + | inr e => + rw [hxcase] at hx + rcases (by simpa [H, TwoColorIncidenceGraph] using hx) with ⟨hve, hec⟩ + have hedelta : phi e = some d.1 := + hec.resolve_right (hbetaAbsent e hve) + cases hnext : p.getVert 1 with + | inl w => + rw [hnext] at hfirst + simp [TwoColorIncidenceGraph] at hfirst + | inr f => + rw [hnext] at hfirst + rcases (by simpa [H, TwoColorIncidenceGraph] using hfirst) with + ⟨hvf, hfc⟩ + have hfdelta : phi f = some d.1 := + hfc.resolve_right (hbetaAbsent f hvf) + have hef : e = f := by + by_contra hne + exact (hproper hne ⟨v, hve, hvf⟩ hedelta) hfdelta + simp [hef] + +private theorem helper_continuation_644.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + beta ∈ MissingColors G phi v → + ScheideDefectiveChainPath T phi (↑d : Fin k) beta v z p → + let X : Finset V := TreeSequenceVertexSet T; + let _ : Finset V := + X \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi (↑d : Fin k) beta; + v ∈ X → + ColoredVertexSetClosed G phi X → + ∀ (h : E), + phi h = some beta → + G.ends h = s(R.u1, R.u2) → + p.IsPath → + ∀ (j0 : ℕ), + p.getVert j0 = Sum.inr R.f1 → + j0 ≤ p.length → + ∀ (j1 : ℕ), + p.getVert j1 = Sum.inl R.u1 → + ∀ (j2 : ℕ), + p.getVert j2 = Sum.inr h → + ∀ (j3 : ℕ), + p.getVert j3 = Sum.inl R.u2 → + ∀ (j4 : ℕ), + p.getVert j4 = Sum.inr R.f2 → + j4 ≤ p.length → + j1 = j0 + (1 : ℕ) ∧ j2 = j1 + (1 : ℕ) ∧ j3 = j2 + (1 : ℕ) ∧ j4 = j3 + (1 : ℕ) ∨ + j3 = j4 + (1 : ℕ) ∧ j2 = j3 + (1 : ℕ) ∧ j1 = j2 + (1 : ℕ) ∧ j0 = j1 + (1 : ℕ) → + let insideIndices : Finset (Fin (p.length + (1 : ℕ))) := + {r : Fin (p.length + (1 : ℕ)) | ∃ w ∈ X, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (insideNonempty : insideIndices.Nonempty), + let qv : Fin (p.length + (1 : ℕ)) := insideIndices.max' insideNonempty; + ∀ w ∈ X, + p.getVert (↑qv : ℕ) = Sum.inl w → + (∀ (r : Fin (p.length + (1 : ℕ))), + (↑qv : ℕ) < (↑r : ℕ) → ∀ (a : V), p.getVert (↑r : ℕ) = Sum.inl a → a ∉ X) → + ∀ (hqvlt : (↑qv : ℕ) < p.length), + let qf : Fin (p.length + (1 : ℕ)) := + (⟨(↑qv : ℕ) + (1 : ℕ), + Decidable.byContradiction fun (a : ¬(↑qv : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega⟩ : + Fin (p.length + (1 : ℕ))); + (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → + H.Adj (Sum.inl w) (p.getVert (↑qf : ℕ)) → + ∃ (h : E) (i0 : Fin (p.length + (1 : ℕ))) (i1 : Fin (p.length + (1 : ℕ))) (i2 : + Fin (p.length + (1 : ℕ))) (i3 : Fin (p.length + (1 : ℕ))) (i4 : + Fin (p.length + (1 : ℕ))) (qv : Fin (p.length + (1 : ℕ))) (qf : + Fin (p.length + (1 : ℕ))), + phi h = some beta ∧ + G.ends h = s(R.u1, R.u2) ∧ + (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) ∧ + (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) ∧ + (↑i3 : ℕ) = (↑i2 : ℕ) + (1 : ℕ) ∧ + (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) ∧ + (p.getVert (↑i0 : ℕ) = Sum.inr R.f1 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i4 : ℕ) = Sum.inr R.f2 ∨ + p.getVert (↑i0 : ℕ) = Sum.inr R.f2 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i4 : ℕ) = Sum.inr R.f1) ∧ + (↑i4 : ℕ) < (↑qv : ℕ) ∧ + (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) ∧ + p.getVert (↑qv : ℕ) = Sum.inl (D.v0 d) ∧ + p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) ∧ + ∀ (r : Fin (p.length + (1 : ℕ))), + (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), + p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet T := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p hbeta hp X Z H hvX hclosed h hhcolor hhends + hpath j0 hj0 hj0le j1 hj1 j2 hj2 j3 hj3 j4 hj4 hj4le horientation insideIndices + insideNonempty qv w hwX hqvw hafter hqvlt qf hqfval hqadj' + obtain ⟨f, hqff, hwf, hfcolor⟩ : ∃ f : E, + p.getVert qf.val = Sum.inr f ∧ Incident G w f ∧ + (phi f = some d.1 ∨ phi f = some beta) := by + cases hnext : p.getVert qf.val with + | inl a => + exfalso + rw [hnext] at hqadj' + simp [H, TwoColorIncidenceGraph] at hqadj' + | inr f => + refine ⟨f, rfl, ?_⟩ + rw [hnext] at hqadj' + simpa [H, TwoColorIncidenceGraph] using hqadj' + have hqflt : qf.val < p.length := by + by_contra hn + have heq : qf.val = p.length := by omega + have := hqff + rw [heq, p.getVert_length] at this + simp at this + let qx : Fin (p.length + 1) := ⟨qf.val + 1, by omega⟩ + have hfxadj := p.adj_getVert_succ (i := qf.val) hqflt + rw [hqff] at hfxadj + have hfxadj' : H.Adj (Sum.inr f) (p.getVert qx.val) := by + simpa [H, qx] using hfxadj + obtain ⟨x, hqxx, hxf⟩ : ∃ x : V, + p.getVert qx.val = Sum.inl x ∧ Incident G x f := by + cases hnext : p.getVert qx.val with + | inl a => + refine ⟨a, rfl, ?_⟩ + rw [hnext] at hfxadj' + have hfxadj'' : Incident G a f ∧ + (phi f = some d.1 ∨ phi f = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hfxadj' + exact hfxadj''.1 + | inr e => + exfalso + rw [hnext] at hfxadj' + simp [H, TwoColorIncidenceGraph] at hfxadj' + have hxX : x ∉ X := hafter qx (by dsimp [qx, qf]; omega) x hqxx + have hwne : w ≠ x := by + intro heq + exact hxX (heq ▸ hwX) + have hfends : G.ends f = s(w, x) := + (Sym2.mem_and_mem_iff hwne).mp ⟨hwf, hxf⟩ + have hfBoundary : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwX, x, hxX, hfends⟩ + have hfdelta : phi f = some d.1 := by + rcases hfcolor with hfd | hfb + · exact hfd + · exact False.elim ((hclosed (f := f) (c := beta) (v := v) + hfBoundary hvX hfb) hbeta) + have hwExit : ScheideExitVertex T phi w := by + exact ⟨v, beta, d.1, hvX, hbeta, d.2, z, p, hp, qv, hqvw, hwX, + by simpa [X] using hafter⟩ + have hwExits : w ∈ ScheideExitVertices T phi := by + simp only [ScheideExitVertices, Finset.mem_filter, Finset.mem_univ, true_and] + exact hwExit + have hwBase := ScheideStructuralExitsInBase G k e0 phi T C hwExits + obtain ⟨a, ha, hay⟩ := Finset.mem_image.mp hwBase + have baseBlockNe : ∀ j : Fin 2, + C.y a ≠ C.blockVertex (D.gammaIndex d) j := by + intro j heq + have hindices := T.vertex_injective + ((C.base_vertex_position a).trans + (heq.trans (C.block_vertex_position (D.gammaIndex d) j).symm)) + have hvals : a.val = C.p + 2 * (D.gammaIndex d).val + j.val := by + simpa using congrArg Fin.val hindices + have hap := a.isLt + omega + have hwZ : w ∈ Z := by + apply Finset.mem_sdiff.mpr + refine ⟨hwX, ?_⟩ + simp only [Finset.mem_insert, Finset.mem_singleton] + rintro (hw0 | hw1) + · exact baseBlockNe 0 (hay.trans hw0) + · exact baseBlockNe 1 (hay.trans hw1) + have hfColorBoundaryZ : f ∈ BoundaryColorEdges G phi Z d.1 := by + simp only [BoundaryColorEdges, Finset.mem_filter] + refine ⟨?_, hfdelta⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwZ, x, fun hxZ => hxX (Finset.mem_sdiff.mp hxZ).1, hfends⟩ + have hfThree : f = D.f0 d ∨ f = R.f1 ∨ f = R.f2 := by + apply (R.exact_three f).mp + refine ⟨by simpa [Z, X] using hfColorBoundaryZ, ?_⟩ + exact ⟨x, by simpa [X] using hxX, hxf⟩ + rcases horientation with horient | horient + · exact @helper_branch_436 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R beta v z p h hhcolor hhends hpath j0 hj0 hj0le j1 hj1 j2 hj2 j3 hj3 j4 hj4 + hj4le insideNonempty w hwX hqvw hafter hqvlt hqfval f hqff hwf hqflt hfThree horient + · exact @helper_branch_524 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R beta v z p h hhcolor hhends hpath j0 hj0 hj0le j1 hj1 j2 hj2 j3 hj3 j4 hj4 + hj4le insideNonempty w hwX hqvw hafter hqvlt hqfval f hqff hwf hqflt hfThree horient + +private theorem helper_continuation_622.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi (↑d : Fin k) beta).Walk (Sum.inl v) (Sum.inl z)), + beta ∈ MissingColors G phi v → + ScheideDefectiveChainPath T phi (↑d : Fin k) beta v z p → + let X : Finset V := TreeSequenceVertexSet T; + let _ : Finset V := + X \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi (↑d : Fin k) beta; + v ∈ X → + IsProperEdgeColoring G phi → + ColoredVertexSetClosed G phi X → + (↑d : Fin k) ≠ beta → + ∀ (h : E), + phi h = some beta → + G.ends h = s(R.u1, R.u2) → + Sum.inr R.f1 ∈ p.support → + Sum.inr R.f2 ∈ p.support → + H.Adj (Sum.inr R.f1) (Sum.inl R.u1) → + H.Adj (Sum.inl R.u1) (Sum.inr h) → + H.Adj (Sum.inr h) (Sum.inl R.u2) → + H.Adj (Sum.inl R.u2) (Sum.inr R.f2) → + Sum.inl R.u1 ∈ p.support → + Sum.inr h ∈ p.support → + Sum.inl R.u2 ∈ p.support → + p.IsPath → + (0 : ℕ) < p.length → + (∀ (e : E), Incident G v e → phi e ≠ some beta) → + ∃ (h : E) (i0 : Fin (p.length + (1 : ℕ))) (i1 : Fin (p.length + (1 : ℕ))) (i2 : + Fin (p.length + (1 : ℕ))) (i3 : Fin (p.length + (1 : ℕ))) (i4 : + Fin (p.length + (1 : ℕ))) (qv : Fin (p.length + (1 : ℕ))) (qf : + Fin (p.length + (1 : ℕ))), + phi h = some beta ∧ + G.ends h = s(R.u1, R.u2) ∧ + (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) ∧ + (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) ∧ + (↑i3 : ℕ) = (↑i2 : ℕ) + (1 : ℕ) ∧ + (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) ∧ + (p.getVert (↑i0 : ℕ) = Sum.inr R.f1 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i4 : ℕ) = Sum.inr R.f2 ∨ + p.getVert (↑i0 : ℕ) = Sum.inr R.f2 ∧ + p.getVert (↑i1 : ℕ) = Sum.inl R.u2 ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl R.u1 ∧ + p.getVert (↑i4 : ℕ) = Sum.inr R.f1) ∧ + (↑i4 : ℕ) < (↑qv : ℕ) ∧ + (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) ∧ + p.getVert (↑qv : ℕ) = Sum.inl (D.v0 d) ∧ + p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) ∧ + ∀ (r : Fin (p.length + (1 : ℕ))), + (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), + p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet T := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p hbeta hp X Z H hvX hproper hclosed hdeltaBeta + h hhcolor hhends hf1Support hf2Support hf1u1 hu1h hhu2 hu2f2 hu1Support hhSupport + hu2Support hpath hlength hbetaAbsent + have startNeighborUnique := @helper_startNeighborUnique_582 V E inferInstance inferInstance G k e0 + phi T d beta v z p hproper hlength hbetaAbsent + have forwardAdjacent := @helper_forwardAdjacent_201 V E inferInstance inferInstance G k e0 phi T d + beta v z p hproper hpath hlength startNeighborUnique + have adjacentIndices : ∀ i j : ℕ, i ≤ p.length → j ≤ p.length → + H.Adj (p.getVert i) (p.getVert j) → + i + 1 = j ∨ j + 1 = i := by + intro i j hi hj hij + have hijne : i ≠ j := by + intro heq + subst j + exact H.irrefl hij + rcases lt_or_gt_of_ne hijne with hijlt | hjilt + · exact Or.inl (forwardAdjacent i j hi hj hijlt hij) + · exact Or.inr (forwardAdjacent j i hj hi hjilt hij.symm) + obtain ⟨j0, hj0, hj0le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf1Support + obtain ⟨j1, hj1, hj1le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hu1Support + obtain ⟨j2, hj2, hj2le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hhSupport + obtain ⟨j3, hj3, hj3le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hu2Support + obtain ⟨j4, hj4, hj4le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf2Support + have ha01 := adjacentIndices j0 j1 hj0le hj1le (by simpa [H, hj0, hj1] using hf1u1) + have ha12 := adjacentIndices j1 j2 hj1le hj2le (by simpa [H, hj1, hj2] using hu1h) + have ha23 := adjacentIndices j2 j3 hj2le hj3le (by simpa [H, hj2, hj3] using hhu2) + have ha34 := adjacentIndices j3 j4 hj3le hj4le (by simpa [H, hj3, hj4] using hu2f2) + have hf1h : R.f1 ≠ h := by + intro heq + have hc := R.f1_color.symm.trans (heq ▸ hhcolor) + exact hdeltaBeta (Option.some.inj hc) + have hhf2 : h ≠ R.f2 := by + intro heq + have hc := hhcolor.symm.trans (heq ▸ R.f2_color) + exact hdeltaBeta (Option.some.inj hc).symm + have hu1u2 : R.u1 ≠ R.u2 := by + intro heq + apply G.loopless h R.u1 + simpa [heq] using hhends + have hj02 : j0 ≠ j2 := by + intro heq + apply hf1h + apply Sum.inr.inj + exact hj0.symm.trans (by simpa [heq] using hj2) + have hj13 : j1 ≠ j3 := by + intro heq + apply hu1u2 + apply Sum.inl.inj + exact hj1.symm.trans (by simpa [heq] using hj3) + have hj24 : j2 ≠ j4 := by + intro heq + apply hhf2 + apply Sum.inr.inj + exact hj2.symm.trans (by simpa [heq] using hj4) + have horientation : + (j1 = j0 + 1 ∧ j2 = j1 + 1 ∧ j3 = j2 + 1 ∧ j4 = j3 + 1) ∨ + (j3 = j4 + 1 ∧ j2 = j3 + 1 ∧ j1 = j2 + 1 ∧ j0 = j1 + 1) := by + rcases ha01 with h01 | h10 <;> + rcases ha12 with h12 | h21 <;> + rcases ha23 with h23 | h32 <;> + rcases ha34 with h34 | h43 <;> omega + let insideIndices : Finset (Fin (p.length + 1)) := + Finset.univ.filter fun r => + ∃ w ∈ X, p.getVert r.val = Sum.inl w + have insideNonempty : insideIndices.Nonempty := by + refine ⟨⟨0, by omega⟩, ?_⟩ + simp only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hvX, p.getVert_zero⟩ + let qv : Fin (p.length + 1) := insideIndices.max' insideNonempty + have hqvMem : qv ∈ insideIndices := Finset.max'_mem insideIndices insideNonempty + obtain ⟨w, hwX, hqvw⟩ := by + simpa only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + using hqvMem + have hafter : ∀ r : Fin (p.length + 1), qv.val < r.val → + ∀ a : V, p.getVert r.val = Sum.inl a → a ∉ X := by + intro r hqr a hra haX + have hrmem : r ∈ insideIndices := by + simp only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨a, haX, hra⟩ + have hrle := Finset.le_max' insideIndices r hrmem + exact (not_le_of_gt hqr) hrle + have hqvlt : qv.val < p.length := by + by_contra hn + have heq : qv.val = p.length := by omega + have hwz : w = z := by + apply Sum.inl.inj + rw [← hqvw, heq, p.getVert_length] + exact hp.2.2.1 (hwz ▸ hwX) + let qf : Fin (p.length + 1) := ⟨qv.val + 1, by omega⟩ + have hqfval : qf.val = qv.val + 1 := rfl + have hqadj := p.adj_getVert_succ (i := qv.val) hqvlt + rw [hqvw] at hqadj + have hqadj' : H.Adj (Sum.inl w) (p.getVert qf.val) := by + simpa [H, qf] using hqadj + exact @helper_continuation_644 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R beta v z p hbeta hp hvX hclosed h hhcolor hhends hpath j0 hj0 hj0le j1 hj1 + j2 hj2 j3 hj3 j4 hj4 hj4le horientation insideNonempty w hwX hqvw hafter hqvlt hqfval hqadj' +theorem ScheideSymmetricOriginalPathOrder {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + ∀ (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phi d.1 beta).Walk (Sum.inl v) (Sum.inl z)), + v ∈ + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} → + beta ∈ MissingColors G phi v → + beta ∈ TreeFreeColors phi T → + beta ≠ C.gamma (D.gammaIndex d) → + ScheideDefectiveChainPath T phi d.1 beta v z p → + ∃ (h : E) (i0 i1 i2 i3 i4 qv qf : Fin (p.length + 1)), + phi h = some beta ∧ + G.ends h = s(R.u1, R.u2) ∧ + i1.val = i0.val + 1 ∧ + i2.val = i1.val + 1 ∧ + i3.val = i2.val + 1 ∧ + i4.val = i3.val + 1 ∧ + ((p.getVert i0.val = Sum.inr R.f1 ∧ + p.getVert i1.val = Sum.inl R.u1 ∧ + p.getVert i2.val = Sum.inr h ∧ + p.getVert i3.val = Sum.inl R.u2 ∧ + p.getVert i4.val = Sum.inr R.f2) ∨ + (p.getVert i0.val = Sum.inr R.f2 ∧ + p.getVert i1.val = Sum.inl R.u2 ∧ + p.getVert i2.val = Sum.inr h ∧ + p.getVert i3.val = Sum.inl R.u1 ∧ + p.getVert i4.val = Sum.inr R.f1)) ∧ + i4.val < qv.val ∧ + qf.val = qv.val + 1 ∧ + p.getVert qv.val = Sum.inl (D.v0 d) ∧ + p.getVert qf.val = Sum.inr (D.f0 d) ∧ + ∀ r : Fin (p.length + 1), + qv.val < r.val → + ∀ w : V, + p.getVert r.val = Sum.inl w → w ∉ TreeSequenceVertexSet T := by + classical + intro beta v z p hv hbeta hfree hbetaGamma hp + let X := TreeSequenceVertexSet T + let Z := X \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} + let H := TwoColorIncidenceGraph G phi d.1 beta + have hvZ : v ∈ Z := by simpa [Z, X] using hv + have hvX : v ∈ X := (Finset.mem_sdiff.mp hvZ).1 + have hproper : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have hclosed : ColoredVertexSetClosed G phi X := by + intro f c u hf hu hc + exact (ScheideGlobalMaximumOrder G k e0 phi T + C.globally_maximum).2.2.2.2 (f := f) (c := c) (v := u) + (by simpa only [X] using hf) (by simpa only [X] using hu) hc + have hf1Boundary : R.f1 ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨R.v1, (Finset.mem_sdiff.mp R.v1_in_remainder).1, + R.u1, R.u1_outside, R.f1_ends⟩ + have hf2Boundary : R.f2 ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨R.v2, (Finset.mem_sdiff.mp R.v2_in_remainder).1, + R.u2, R.u2_outside, R.f2_ends⟩ + have hdeltaBeta : d.1 ≠ beta := by + intro hdb + have hn := hclosed (f := R.f1) (c := d.1) (v := v) + hf1Boundary hvX R.f1_color + exact hn (hdb ▸ hbeta) + obtain ⟨h, hhcolor, hhends⟩ := + ScheideReplacementInternalMissing G k e0 phi T C D d R beta + hbetaGamma ⟨v, hv, hbeta⟩ + have hf1ColorBoundary : + R.f1 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) d.1 := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨by simpa [X] using hf1Boundary, R.f1_color⟩ + have hf2ColorBoundary : + R.f2 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) d.1 := by + simp only [BoundaryColorEdges, Finset.mem_filter] + exact ⟨by simpa [X] using hf2Boundary, R.f2_color⟩ + have hchain := ScheideDefectiveChainBoundaryEdges G k e0 phi T + C.globally_maximum d.1 beta d.2 hfree v hvX hbeta z p hp + have hf1Support : Sum.inr R.f1 ∈ p.support := + (hchain R.f1).mp hf1ColorBoundary |>.2 + have hf2Support : Sum.inr R.f2 ∈ p.support := + (hchain R.f2).mp hf2ColorBoundary |>.2 + have hf1u1 : H.Adj (Sum.inr R.f1) (Sum.inl R.u1) := by + simp [H, TwoColorIncidenceGraph, Incident, R.f1_ends, R.f1_color] + have hu1h : H.Adj (Sum.inl R.u1) (Sum.inr h) := by + simp [H, TwoColorIncidenceGraph, Incident, hhends, hhcolor] + have hhu2 : H.Adj (Sum.inr h) (Sum.inl R.u2) := by + simp [H, TwoColorIncidenceGraph, Incident, hhends, hhcolor] + have hu2f2 : H.Adj (Sum.inl R.u2) (Sum.inr R.f2) := by + simp [H, TwoColorIncidenceGraph, Incident, R.f2_ends, R.f2_color] + have hf1Component : + H.connectedComponentMk (Sum.inr R.f1) = + H.connectedComponentMk (Sum.inl v) := by + change Sum.inr R.f1 ∈ TwoColorComponent G phi d.1 beta (Sum.inl v) + rw [← hp.2.2.2] + exact hf1Support + have hu1Component : + H.connectedComponentMk (Sum.inl R.u1) = + H.connectedComponentMk (Sum.inl v) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hf1u1).symm.trans + hf1Component + have hhComponent : + H.connectedComponentMk (Sum.inr h) = + H.connectedComponentMk (Sum.inl v) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hu1h).symm.trans + hu1Component + have hu2Component : + H.connectedComponentMk (Sum.inl R.u2) = + H.connectedComponentMk (Sum.inl v) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hhu2).symm.trans + hhComponent + have componentSupport : ∀ x : Sum V E, + H.connectedComponentMk x = H.connectedComponentMk (Sum.inl v) → + x ∈ p.support := by + intro x hx + have hx' : x ∈ TwoColorComponent G phi d.1 beta (Sum.inl v) := hx + rw [← hp.2.2.2] at hx' + exact hx' + have hu1Support : Sum.inl R.u1 ∈ p.support := + componentSupport _ hu1Component + have hhSupport : Sum.inr h ∈ p.support := + componentSupport _ hhComponent + have hu2Support : Sum.inl R.u2 ∈ p.support := + componentSupport _ hu2Component + have hpath : p.IsPath := hp.2.1 + have hlength : 0 < p.length := by + by_contra hn + have hzero : p.length = 0 := by omega + have hvz : (Sum.inl v : Sum V E) = Sum.inl z := + SimpleGraph.Walk.eq_of_length_eq_zero hzero + exact hp.2.2.1 (Sum.inl.inj hvz ▸ hvX) + have hbetaAbsent : ∀ e : E, Incident G v e → phi e ≠ some beta := by + intro e hve heb + have hnot : beta ∉ PresentColors G phi v := (Finset.mem_sdiff.mp hbeta).2 + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hve, heb⟩ + exact @helper_continuation_622 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R beta v z p hbeta hp hvX hproper hclosed hdeltaBeta h hhcolor hhends + hf1Support hf2Support hf1u1 hu1h hhu2 hu2f2 hu1Support hhSupport hu2Support hpath hlength + hbetaAbsent +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryAvoidance.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryAvoidance.lean new file mode 100644 index 0000000000..397a002c65 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryAvoidance.lean @@ -0,0 +1,1170 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReplacementInternalMissing +public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryConfiguration +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementPathOrder + +/-! +# Scheide Symmetric Replacement Boundary Avoidance + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperHavoidU249Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : (TwoColorIncidenceGraph G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), beta ∈ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v + → + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet R.replacementTree; + let U : Finset V := { R.u1, R.u2 }; + let Z : Finset V := TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; v ∈ Z → X = Z ∪ U → Z + ⊆ X → v ∈ X → ColoredVertexSetClosed G phiD X → ( + ∀ {w : V}, w ∈ U → w = R.u1 ∨ w = R.u2) → ( + ∀ (f : E), phiD f = some gamma → Incident G R.u1 f ∨ Incident G R.u2 f → + ∀ w ∈ Z, ¬Incident G w f) → ( + ∀ (f : E), phiD f = some beta → + ∀ u ∈ U, Incident G u f → + ∀ w ∈ Z, ¬Incident G w f) → + ∀ (h : E) (i0 i1 i2 i3 i4 qv qf : Fin (p.length + (1 : ℕ))), (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) → + (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) → (↑i3 : ℕ) = (↑i2 : ℕ) + (1 : ℕ) → (↑i4 : ℕ) = (↑i3 : ℕ) + + (1 : ℕ) → p.getVert (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ∧ p.getVert (↑i1 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ + p.getVert (↑i2 : ℕ) = Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge + (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∨ p.getVert (↑i0 : ℕ) = Sum.inr (C.blockEdge + (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) = Sum.inl (C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = Sum.inr h ∧ p.getVert (↑i3 : + ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i4 : ℕ) = + Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → (↑i4 : ℕ) < (↑qv : ℕ) → (↑qf : + ℕ) = (↑qv : ℕ) + (1 : ℕ) → p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet R.replacementTree) → + p.IsPath → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → ( + ∀ (f : E), (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)) f = some (C.gamma (D.gammaIndex d)) ∧ + ∃ v ∈ TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}, + ∃ w ∉ TreeSequenceVertexSet R.replacementTree, G.ends f = s(v, w)) ↔ f = D.f0 d ∨ f = + C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) ∨ f = C.blockEdge (D.gammaIndex d) (1 : Fin + (2 : ℕ))) → ( + ∀ (j : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) j ∉ U) → ( + ∀ (q : Fin C.p), C.y q ∈ Z) → ( + ∀ {w : V}, w ∈ Z → w ∉ U) → + ∀ u ∈ U, Sum.inl u ∉ p.support + +private theorem helper_no_gamma_cross_96.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let Z : Finset V := TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + ∀ (f : E), phiD f = some gamma → Incident G R.u1 f ∨ Incident G R.u2 f → + ∀ w ∈ Z, ¬Incident G w f := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD Z f hfcolor hfu w hwZ hfw + have hfix := ScheideReplacementPairFixed G k e0 phi T C D d R f hfu + have holdColor : phi f = some gamma := by + simpa [phiD, gamma] using hfix.symm.trans hfcolor + have hwT : w ∈ TreeSequenceVertexSet T := (Finset.mem_sdiff.mp hwZ).1 + have hout : (if Incident G R.u1 f then R.u1 else R.u2) ∉ + TreeSequenceVertexSet T := by + split + · exact R.u1_outside + · exact R.u2_outside + have hfo : Incident G (if Incident G R.u1 f then R.u1 else R.u2) f := by + split + · assumption + · exact hfu.resolve_left (by assumption) + have hne : w ≠ (if Incident G R.u1 f then R.u1 else R.u2) := by + intro heq + exact hout (heq ▸ hwT) + have ends_eq_of_mem : ∀ {q : Sym2 V} {a b : V}, + a ∈ q → b ∈ q → a ≠ b → q = s(a, b) := by + intro q a b ha hb hab + induction q using Sym2.inductionOn with + | _ x y => + simp only [Sym2.mem_iff] at ha hb + rcases ha with rfl | rfl <;> rcases hb with rfl | rfl + <;> simp_all [] + have hfBoundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwT, _, hout, + ends_eq_of_mem (by simpa [Incident] using hfw) + (by simpa [Incident] using hfo) hne⟩ + have holdClosed : ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T) := + (ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum).2.2.2.2 + exact (holdClosed hfBoundary + ((D.v0_is_exit d |> fun hexit => + (ScheideDefectiveSetup.replacement_path_full D d).1)) + holdColor) (D.gamma_missing_at_v0 d) + +private theorem helper_hxOutside_244.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet R.replacementTree; + let U : Finset V := { R.u1, R.u2 }; + let Z : Finset V := TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; X = Z ∪ U → ( + ∀ {w : V}, w ∈ U → w = R.u1 ∨ w = R.u2) → ( + ∀ (f : E), phiD f = some gamma → Incident G R.u1 f ∨ Incident G R.u2 f → + ∀ w ∈ Z, ¬Incident G w f) → ( + ∀ (f : E), phiD f = some beta → + ∀ u ∈ U, Incident G u f → + ∀ w ∈ Z, ¬Incident G w f) → + ∀ (_ _ _ _ _ _ _ : Fin (p.length + (1 : ℕ))), ( + ∀ {w : V}, w ∈ Z → w ∉ U) → + let pairIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | + ∃ a ∈ U, p.getVert (↑r : ℕ) = Sum.inl a}; + ∀ (hpairIndices : pairIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := pairIndices.min' hpairIndices; + ∀ ut ∈ U, p.getVert (↑t : ℕ) = Sum.inl ut → + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | (↑r : ℕ) < + (↑t : ℕ) ∧ + ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + ∀ w ∈ Z, ( + ∀ r ∈ zIndices, (↑r : ℕ) ≤ (↑qz : ℕ)) → + let qe : Fin (p.length + (1 : ℕ)) := (⟨(↑qz : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); + ∀ (hqet : (↑qe : ℕ) < (↑t : ℕ)) (f : E), Incident G w f → phiD f = some gamma ∨ phiD f = some + beta → + let qx : Fin (p.length + (1 : ℕ)) := (⟨(↑qe : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qe : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); + ∀ (x : V), p.getVert (↑qx : ℕ) = Sum.inl x → Incident G x f → (↑qx : ℕ) ≤ (↑t : ℕ) → x ∉ X := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p gamma phiD X U Z hXeq u_mem_cases + no_gamma_cross no_beta_cross i0 i1 i2 i3 i4 qv qf hZU pairIndices hpairIndices t ut hutU + htNode zIndices hzIndices qz hqzt w hwZ hqzMax qe hqet f hwf hfColors qx x hqxNode hxf + hqxle hxX + rw [hXeq] at hxX + rcases Finset.mem_union.mp hxX with hxZ | hxU + · have hqxne : qx.val ≠ t.val := by + intro heq + have hxut : x = ut := by + rw [heq, htNode] at hqxNode + exact Sum.inl.inj hqxNode.symm + exact hZU hxZ (hxut ▸ hutU) + have hqxt : qx.val < t.val := by omega + have hqxMem : qx ∈ zIndices := by + simp only [zIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨hqxt, x, hxZ, hqxNode⟩ + have := hqzMax qx hqxMem + dsimp [qx, qe] at this + omega + · rcases hfColors with hfgamma | hfbeta + · rcases u_mem_cases hxU with hx1 | hx2 + · exact no_gamma_cross f hfgamma (Or.inl (hx1.symm ▸ hxf)) + w hwZ hwf + · exact no_gamma_cross f hfgamma (Or.inr (hx2.symm ▸ hxf)) + w hwZ hwf + · exact no_beta_cross f hfbeta x hxU hxf w hwZ hwf + +private theorem helper_hfGamma_268.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + beta ∈ MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin + k) (Sum.inl (D.v0 d))) v → + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet R.replacementTree; + let U : Finset V := { R.u1, R.u2 }; + let Z : Finset V := TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; Z ⊆ X → v ∈ X → + ColoredVertexSetClosed G phiD X → + ∀ (_ _ _ _ _ _ _ : Fin (p.length + (1 : ℕ))), p.IsPath → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let pairIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | + ∃ a ∈ U, p.getVert (↑r : ℕ) = Sum.inl a}; + ∀ (hpairIndices : pairIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := pairIndices.min' hpairIndices; + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | (↑r : ℕ) < + (↑t : ℕ) ∧ + ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + ∀ w ∈ Z, p.getVert (↑qz : ℕ) = Sum.inl w → + let qe : Fin (p.length + (1 : ℕ)) := (⟨(↑qz : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); + ∀ (hqet : (↑qe : ℕ) < (↑t : ℕ)) (f : E), Incident G w f → phiD f = some gamma ∨ phiD f = some + beta → + let qx : Fin (p.length + (1 : ℕ)) := (⟨(↑qe : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qe : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); + ∀ (x : V), p.getVert (↑qx : ℕ) = Sum.inl x → Incident G x f → x ∉ X → phiD f = some gamma := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p hbetaD gamma phiD X U Z hZsubX hvX hclosed i0 + i1 i2 i3 i4 qv qf hpath fin_le pairIndices hpairIndices t zIndices hzIndices qz hqzt w hwZ + hqw qe hqet f hwf hfColors qx x hqxNode hxf hxOutside + rcases hfColors with hfgamma | hfbeta + · exact hfgamma + · have hfBoundary : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + refine ⟨w, hZsubX hwZ, x, hxOutside, ?_⟩ + obtain ⟨a, ha⟩ := Sym2.mem_iff_exists.mp hwf + have hxw : x ≠ w := by + intro hxw + have hnodes : p.getVert qx.val = p.getVert qz.val := by + rw [hqxNode, hxw, hqw] + have hinds := hpath.getVert_injOn + (by simpa using fin_le qx) (by simpa using fin_le qz) hnodes + dsimp [qx, qe] at hinds + omega + have hmem : x = w ∨ x = a := by + simpa [Incident, ha] using hxf + have hxa : x = a := hmem.resolve_left hxw + simpa [hxa] using ha + exact False.elim (hclosed hfBoundary hvX hfbeta hbetaD) + +private theorem helper_hreturn_forward_310.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let U : Finset V := { R.u1, R.u2 }; + let Z : Finset V := TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; + ∀ (h : E) (i0 i1 i2 i3 i4 qv qf : Fin (p.length + (1 : ℕ))), (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) → + (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) → (↑i3 : ℕ) = (↑i2 : ℕ) + (1 : ℕ) → (↑i4 : ℕ) = (↑i3 : ℕ) + + (1 : ℕ) → (↑i4 : ℕ) < (↑qv : ℕ) → (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → p.IsPath → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → ( + ∀ (j : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) j ∉ U) → ( + ∀ (q : Fin C.p), C.y q ∈ Z) → ( + ∀ {w : V}, w ∈ Z → w ∉ U) → + let pairIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | + ∃ a ∈ U, p.getVert (↑r : ℕ) = Sum.inl a}; + ∀ (hpairIndices : pairIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := pairIndices.min' hpairIndices; + ∀ ut ∈ U, p.getVert (↑t : ℕ) = Sum.inl ut → + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | (↑r : ℕ) < + (↑t : ℕ) ∧ + ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), ( + ∀ r ∈ zIndices, (↑r : ℕ) ≤ (↑qz : ℕ)) → + let qe : Fin (p.length + (1 : ℕ)) := (⟨(↑qz : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); (↑qe : ℕ) < (↑t : ℕ) → + ∀ (f : E), p.getVert (↑qe : ℕ) = Sum.inr f → + ∀ (a1 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = s(C.y a1, + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → p.getVert (↑i0 : ℕ) = Sum.inr + (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → p.getVert (↑i1 : ℕ) = Sum.inl + (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → p.getVert (↑i2 : ℕ) = Sum.inr h → + p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) → f = + C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p gamma phiD U Z H h i0 i1 i2 i3 i4 qv qf hi01 + hi12 hi23 hi34 hi4qv hqfv hpath fin_le hblockNotU hbaseZ hZU pairIndices hpairIndices t ut + hutU htNode zIndices hzIndices qz hqzt hqzMax qe hqet f hqeNode a1 ha1ends ha0 ha1 ha2 ha3 + ha4 hf + have hqe0 : qe.val = i0.val := by + have hvEq : p.getVert qe.val = p.getVert i0.val := by + rw [hqeNode, hf, ha0] + exact hpath.getVert_injOn + (by simpa using fin_le qe) (by simpa using fin_le i0) hvEq + have hi1ne : t.val ≠ i1.val := by + intro heq + have he : ut = C.blockVertex (D.gammaIndex d) 0 := by + apply Sum.inl.inj + rw [← htNode, heq, ha1] + exact hblockNotU 0 (he.symm ▸ hutU) + have hi2ne : t.val ≠ i2.val := by + intro heq + have : (Sum.inl ut : Sum V E) = Sum.inr h := by + rw [← htNode, heq, ha2] + simp at this + have hi3ne : t.val ≠ i3.val := by + intro heq + have he : ut = C.blockVertex (D.gammaIndex d) 1 := by + apply Sum.inl.inj + rw [← htNode, heq, ha3] + exact hblockNotU 1 (he.symm ▸ hutU) + have hi4ne : t.val ≠ i4.val := by + intro heq + have : (Sum.inl ut : Sum V E) = + Sum.inr (C.blockEdge (D.gammaIndex d) 1) := by + rw [← htNode, heq, ha4] + simp at this + have hi4t : i4.val < t.val := by + dsimp [qe] at hqe0 hqet + omega + let ir : Fin (p.length + 1) := ⟨i4.val + 1, by omega⟩ + have hretAdj := p.adj_getVert_succ (i := i4.val) (by omega) + have hret : p.getVert ir.val = Sum.inl (C.y a1) := by + cases hn : p.getVert ir.val with + | inr e => + have hadj : H.Adj + (Sum.inr (C.blockEdge (D.gammaIndex d) 1)) + (Sum.inr e) := by + simpa [H, ir, ha4, hn] using hretAdj + simp [H, TwoColorIncidenceGraph] at hadj + | inl y => + have hyInc : Incident G y + (C.blockEdge (D.gammaIndex d) 1) := by + have hadj : H.Adj + (Sum.inr (C.blockEdge (D.gammaIndex d) 1)) + (Sum.inl y) := by + simpa [H, ir, ha4, hn] using hretAdj + have hpair : Incident G y + (C.blockEdge (D.gammaIndex d) 1) ∧ + (phiD (C.blockEdge (D.gammaIndex d) 1) = some gamma ∨ + phiD (C.blockEdge (D.gammaIndex d) 1) = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hadj + exact hpair.1 + have hyEnds : y = C.y a1 ∨ + y = C.blockVertex (D.gammaIndex d) 1 := by + simpa [Incident, ha1ends] using hyInc + rcases hyEnds with hy | hy + · simp [hy] + · have hrepeat : p.getVert ir.val = p.getVert i3.val := by + rw [hn, hy, ha3] + have hind := hpath.getVert_injOn + (by simpa using fin_le ir) (by simpa using fin_le i3) hrepeat + dsimp [ir] at hind + omega + have hirle : ir.val ≤ t.val := by dsimp [ir]; omega + have hirne : ir.val ≠ t.val := by + intro heq + have he : C.y a1 = ut := by + apply Sum.inl.inj + rw [← hret, heq, htNode] + exact hZU (hbaseZ a1) (he ▸ hutU) + have hirt : ir.val < t.val := by omega + have hirMem : ir ∈ zIndices := by + simp only [zIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨hirt, C.y a1, hbaseZ a1, hret⟩ + have hmax := hqzMax ir hirMem + dsimp [ir, qe] at hmax hqe0 + omega + +private theorem helper_hreturn_reverse_400.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let U : Finset V := { R.u1, R.u2 }; + let Z : Finset V := TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; + ∀ (h : E) (i0 i1 i2 i3 i4 qv qf : Fin (p.length + (1 : ℕ))), (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) → + (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) → (↑i3 : ℕ) = (↑i2 : ℕ) + (1 : ℕ) → (↑i4 : ℕ) = (↑i3 : ℕ) + + (1 : ℕ) → (↑i4 : ℕ) < (↑qv : ℕ) → (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → p.IsPath → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → ( + ∀ (j : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) j ∉ U) → ( + ∀ (q : Fin C.p), C.y q ∈ Z) → ( + ∀ {w : V}, w ∈ Z → w ∉ U) → + let pairIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | + ∃ a ∈ U, p.getVert (↑r : ℕ) = Sum.inl a}; + ∀ (hpairIndices : pairIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := pairIndices.min' hpairIndices; + ∀ ut ∈ U, p.getVert (↑t : ℕ) = Sum.inl ut → + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | (↑r : ℕ) < + (↑t : ℕ) ∧ + ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), ( + ∀ r ∈ zIndices, (↑r : ℕ) ≤ (↑qz : ℕ)) → + let qe : Fin (p.length + (1 : ℕ)) := (⟨(↑qz : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); (↑qe : ℕ) < (↑t : ℕ) → + ∀ (f : E), p.getVert (↑qe : ℕ) = Sum.inr f → + ∀ (a0 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = s(C.y a0, + C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → p.getVert (↑i0 : ℕ) = Sum.inr + (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) → p.getVert (↑i1 : ℕ) = Sum.inl + (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → p.getVert (↑i2 : ℕ) = Sum.inr h → + p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → f = + C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ)) → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p gamma phiD U Z H h i0 i1 i2 i3 i4 qv qf hi01 + hi12 hi23 hi34 hi4qv hqfv hpath fin_le hblockNotU hbaseZ hZU pairIndices hpairIndices t ut + hutU htNode zIndices hzIndices qz hqzt hqzMax qe hqet f hqeNode a0 ha0ends ha0 ha1 ha2 ha3 + ha4 hf + have hqe0 : qe.val = i0.val := by + have hvEq : p.getVert qe.val = p.getVert i0.val := by + rw [hqeNode, hf, ha0] + exact hpath.getVert_injOn + (by simpa using fin_le qe) (by simpa using fin_le i0) hvEq + have hi1ne : t.val ≠ i1.val := by + intro heq + have he : ut = C.blockVertex (D.gammaIndex d) 1 := by + apply Sum.inl.inj + rw [← htNode, heq, ha1] + exact hblockNotU 1 (he.symm ▸ hutU) + have hi2ne : t.val ≠ i2.val := by + intro heq + have : (Sum.inl ut : Sum V E) = Sum.inr h := by + rw [← htNode, heq, ha2] + simp at this + have hi3ne : t.val ≠ i3.val := by + intro heq + have he : ut = C.blockVertex (D.gammaIndex d) 0 := by + apply Sum.inl.inj + rw [← htNode, heq, ha3] + exact hblockNotU 0 (he.symm ▸ hutU) + have hi4ne : t.val ≠ i4.val := by + intro heq + have : (Sum.inl ut : Sum V E) = + Sum.inr (C.blockEdge (D.gammaIndex d) 0) := by + rw [← htNode, heq, ha4] + simp at this + have hi4t : i4.val < t.val := by + dsimp [qe] at hqe0 hqet + omega + let ir : Fin (p.length + 1) := ⟨i4.val + 1, by omega⟩ + have hretAdj := p.adj_getVert_succ (i := i4.val) (by omega) + have hret : p.getVert ir.val = Sum.inl (C.y a0) := by + cases hn : p.getVert ir.val with + | inr e => + have hadj : H.Adj + (Sum.inr (C.blockEdge (D.gammaIndex d) 0)) + (Sum.inr e) := by + simpa [H, ir, ha4, hn] using hretAdj + simp [H, TwoColorIncidenceGraph] at hadj + | inl y => + have hyInc : Incident G y + (C.blockEdge (D.gammaIndex d) 0) := by + have hadj : H.Adj + (Sum.inr (C.blockEdge (D.gammaIndex d) 0)) + (Sum.inl y) := by + simpa [H, ir, ha4, hn] using hretAdj + have hpair : Incident G y + (C.blockEdge (D.gammaIndex d) 0) ∧ + (phiD (C.blockEdge (D.gammaIndex d) 0) = some gamma ∨ + phiD (C.blockEdge (D.gammaIndex d) 0) = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hadj + exact hpair.1 + have hyEnds : y = C.y a0 ∨ + y = C.blockVertex (D.gammaIndex d) 0 := by + simpa [Incident, ha0ends] using hyInc + rcases hyEnds with hy | hy + · simp [hy] + · have hrepeat : p.getVert ir.val = p.getVert i3.val := by + rw [hn, hy, ha3] + have hind := hpath.getVert_injOn + (by simpa using fin_le ir) (by simpa using fin_le i3) hrepeat + dsimp [ir] at hind + omega + have hirle : ir.val ≤ t.val := by dsimp [ir]; omega + have hirne : ir.val ≠ t.val := by + intro heq + have he : C.y a0 = ut := by + apply Sum.inl.inj + rw [← hret, heq, htNode] + exact hZU (hbaseZ a0) (he ▸ hutU) + have hirt : ir.val < t.val := by omega + have hirMem : ir ∈ zIndices := by + simp only [zIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨hirt, C.y a0, hbaseZ a0, hret⟩ + have hmax := hqzMax ir hirMem + dsimp [ir, qe] at hmax hqe0 + omega + +private theorem helper_hfEnds_693.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let U : Finset V := { R.u1, R.u2 }; + let Z : Finset V := TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + ∀ (_ _ _ _ _ _ _ : Fin (p.length + (1 : ℕ))), p.IsPath → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let pairIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | + ∃ a ∈ U, p.getVert (↑r : ℕ) = Sum.inl a}; + ∀ (hpairIndices : pairIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := pairIndices.min' hpairIndices; + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | (↑r : ℕ) < + (↑t : ℕ) ∧ + ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)) (w : V), p.getVert (↑qz : ℕ) = Sum.inl w → + let qe : Fin (p.length + (1 : ℕ)) := (⟨(↑qz : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); + ∀ (hqet : (↑qe : ℕ) < (↑t : ℕ)) (f : E), Incident G w f → + let qx : Fin (p.length + (1 : ℕ)) := (⟨(↑qe : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qe : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); + ∀ (x : V), p.getVert (↑qx : ℕ) = Sum.inl x → Incident G x f → G.ends f = s(w, x) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p U Z i0 i1 i2 i3 i4 qv qf hpath fin_le + pairIndices hpairIndices t zIndices hzIndices qz hqzt w hqw qe hqet f hwf qx x hqxNode hxf + obtain ⟨a, ha⟩ := Sym2.mem_iff_exists.mp hwf + have hxw : x ≠ w := by + intro hxw + have hnodes : p.getVert qx.val = p.getVert qz.val := by + rw [hqxNode, hxw, hqw] + have hinds := hpath.getVert_injOn + (by simpa using fin_le qx) (by simpa using fin_le qz) hnodes + dsimp [qx, qe] at hinds + omega + have hmem : x = w ∨ x = a := by + simpa [Incident, ha] using hxf + have hxa : x = a := hmem.resolve_left hxw + simpa [hxa] using ha + +private theorem helper_branch_739.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let X : Finset V := TreeSequenceVertexSet R.replacementTree; + let U : Finset V := { R.u1, R.u2 }; + let Z : Finset V := TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; X = Z ∪ U → + ∀ (_ _ _ _ _ qv qf : Fin (p.length + (1 : ℕ))), (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → p.getVert + (↑qf : ℕ) = Sum.inr (D.f0 d) → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet R.replacementTree) → + p.IsPath → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let pairIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | + ∃ a ∈ U, p.getVert (↑r : ℕ) = Sum.inl a}; + ∀ (hpairIndices : pairIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := pairIndices.min' hpairIndices; + ∀ ut ∈ U, p.getVert (↑t : ℕ) = Sum.inl ut → + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | (↑r : ℕ) < + (↑t : ℕ) ∧ + ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + let qe : Fin (p.length + (1 : ℕ)) := (⟨(↑qz : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); (↑qe : ℕ) < (↑t : ℕ) → + ∀ (f : E), p.getVert (↑qe : ℕ) = Sum.inr f → f = D.f0 d → False := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p X U Z hXeq i0 i1 i2 i3 i4 qv qf hqfv hqfNode + hafter hpath fin_le pairIndices hpairIndices t ut hutU htNode zIndices hzIndices qz hqzt qe + hqet f hqeNode hf0 + have hqeqf : qe.val = qf.val := by + have hvEq : p.getVert qe.val = p.getVert qf.val := by + rw [hqeNode, hf0, hqfNode] + exact hpath.getVert_injOn + (by simpa using fin_le qe) (by simpa using fin_le qf) hvEq + have hqvt : qv.val < t.val := by + dsimp [qe] at hqeqf + omega + have hutX : ut ∈ X := by + rw [hXeq] + exact Finset.mem_union_right _ hutU + exact (hafter t hqvt ut htNode) (by simpa [X] using hutX) + +private theorem helper_branch_751.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let U : Finset V := { R.u1, R.u2 }; + let Z : Finset V := TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + ∀ (h : E) (i0 i1 i2 i3 i4 _ _ : Fin (p.length + (1 : ℕ))), (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) → + p.getVert (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert + (↑i1 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : + ℕ) = Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 + : ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∨ + p.getVert (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert + (↑i1 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : + ℕ) = Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 + : ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + p.IsPath → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let pairIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | + ∃ a ∈ U, p.getVert (↑r : ℕ) = Sum.inl a}; + ∀ (hpairIndices : pairIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := pairIndices.min' hpairIndices; + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | (↑r : ℕ) < + (↑t : ℕ) ∧ + ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + ∀ w ∈ Z, p.getVert (↑qz : ℕ) = Sum.inl w → + let qe : Fin (p.length + (1 : ℕ)) := (⟨(↑qz : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); (↑qe : ℕ) < (↑t : ℕ) → + ∀ (f : E), p.getVert (↑qe : ℕ) = Sum.inr f → (p.getVert (↑i0 : ℕ) = Sum.inr (C.blockEdge + (D.gammaIndex d) (0 : Fin (2 : ℕ))) → p.getVert (↑i1 : ℕ) = Sum.inl (C.blockVertex + (D.gammaIndex d) (0 : Fin (2 : ℕ))) → p.getVert (↑i2 : ℕ) = Sum.inr h → p.getVert (↑i3 : + ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → p.getVert (↑i4 : ℕ) = + Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) → f = C.blockEdge (D.gammaIndex + d) (0 : Fin (2 : ℕ)) → False) → f = C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) → False + := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p U Z h i0 i1 i2 i3 i4 qv qf hi34 horient hpath + fin_le pairIndices hpairIndices t zIndices hzIndices qz hqzt w hwZ hqw qe hqet f hqeNode + hreturn_forward hfBlock0 + rcases horient with hforward | hreverse + · exact hreturn_forward hforward.1 hforward.2.1 hforward.2.2.1 + hforward.2.2.2.1 hforward.2.2.2.2 hfBlock0 + · have hqei4 : qe.val = i4.val := by + have hvEq : p.getVert qe.val = p.getVert i4.val := by + rw [hqeNode, hfBlock0, hreverse.2.2.2.2] + exact hpath.getVert_injOn + (by simpa using fin_le qe) (by simpa using fin_le i4) hvEq + have hqzi3 : qz.val = i3.val := by + dsimp [qe] at hqei4 + omega + have hwEq : w = C.blockVertex (D.gammaIndex d) 0 := by + apply Sum.inl.inj + rw [← hqw, hqzi3, hreverse.2.2.2.1] + exact (Finset.mem_sdiff.mp hwZ).2 (by simp [hwEq]) + +private theorem helper_branch_766.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let U : Finset V := { R.u1, R.u2 }; + let Z : Finset V := TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + ∀ (h : E) (i0 i1 i2 i3 i4 _ _ : Fin (p.length + (1 : ℕ))), (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) → + p.getVert (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert + (↑i1 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : + ℕ) = Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 + : ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∨ + p.getVert (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert + (↑i1 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : + ℕ) = Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 + : ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + p.IsPath → ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑r : ℕ) ≤ p.length) → + let pairIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | + ∃ a ∈ U, p.getVert (↑r : ℕ) = Sum.inl a}; + ∀ (hpairIndices : pairIndices.Nonempty), + let t : Fin (p.length + (1 : ℕ)) := pairIndices.min' hpairIndices; + let zIndices : Finset (Fin (p.length + (1 : ℕ))) := {r : Fin (p.length + (1 : ℕ)) | (↑r : ℕ) < + (↑t : ℕ) ∧ + ∃ w ∈ Z, p.getVert (↑r : ℕ) = Sum.inl w}; + ∀ (hzIndices : zIndices.Nonempty), + let qz : Fin (p.length + (1 : ℕ)) := zIndices.max' hzIndices; + ∀ (hqzt : (↑qz : ℕ) < (↑t : ℕ)), + ∀ w ∈ Z, p.getVert (↑qz : ℕ) = Sum.inl w → + let qe : Fin (p.length + (1 : ℕ)) := (⟨(↑qz : ℕ) + (1 : ℕ), Decidable.byContradiction fun (a : + ¬(↑qz : ℕ) + (1 : ℕ) < p.length + (1 : ℕ)) => + by omega + ⟩ : Fin (p.length + (1 : ℕ))); (↑qe : ℕ) < (↑t : ℕ) → + ∀ (f : E), p.getVert (↑qe : ℕ) = Sum.inr f → (p.getVert (↑i0 : ℕ) = Sum.inr (C.blockEdge + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → p.getVert (↑i1 : ℕ) = Sum.inl (C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → p.getVert (↑i2 : ℕ) = Sum.inr h → p.getVert (↑i3 : + ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → p.getVert (↑i4 : ℕ) = + Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → f = C.blockEdge (D.gammaIndex + d) (1 : Fin (2 : ℕ)) → False) → f = C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ)) → False + := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p U Z h i0 i1 i2 i3 i4 qv qf hi34 horient hpath + fin_le pairIndices hpairIndices t zIndices hzIndices qz hqzt w hwZ hqw qe hqet f hqeNode + hreturn_reverse hfBlock1 + rcases horient with hforward | hreverse + · have hqei4 : qe.val = i4.val := by + have hvEq : p.getVert qe.val = p.getVert i4.val := by + rw [hqeNode, hfBlock1, hforward.2.2.2.2] + exact hpath.getVert_injOn + (by simpa using fin_le qe) (by simpa using fin_le i4) hvEq + have hqzi3 : qz.val = i3.val := by + dsimp [qe] at hqei4 + omega + have hwEq : w = C.blockVertex (D.gammaIndex d) 1 := by + apply Sum.inl.inj + rw [← hqw, hqzi3, hforward.2.2.2.1] + exact (Finset.mem_sdiff.mp hwZ).2 (by simp [hwEq]) + · exact hreturn_reverse hreverse.1 hreverse.2.1 hreverse.2.2.1 + hreverse.2.2.2.1 hreverse.2.2.2.2 hfBlock1 + +private theorem helper_havoidU_249.{u_1, u_2} : + helperHavoidU249Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p hbetaD gamma phiD X U Z H hvZ hXeq hZsubX hvX + hclosed u_mem_cases no_gamma_cross no_beta_cross h i0 i1 i2 i3 i4 qv qf hi01 hi12 hi23 hi34 + horient hi4qv hqfv hqfNode hafter hpath fin_le hexact hblockNotU hbaseZ hZU u huU huSupport + let pairIndices : Finset (Fin (p.length + 1)) := + Finset.univ.filter fun r => ∃ a ∈ U, p.getVert r.val = Sum.inl a + have hpairIndices : pairIndices.Nonempty := by + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp huSupport + refine ⟨⟨n, by omega⟩, ?_⟩ + simp only [pairIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, huU, hn⟩ + let t : Fin (p.length + 1) := pairIndices.min' hpairIndices + have htMem : t ∈ pairIndices := Finset.min'_mem pairIndices hpairIndices + obtain ⟨ut, hutU, htNode⟩ : ∃ a ∈ U, + p.getVert t.val = Sum.inl a := by + simpa only [pairIndices, Finset.mem_filter, Finset.mem_univ, true_and] + using htMem + have htPos : 0 < t.val := by + by_contra hn + have ht0 : t.val = 0 := by omega + have hvut : v = ut := by + rw [ht0, p.getVert_zero] at htNode + exact Sum.inl.inj htNode + exact hZU hvZ (hvut ▸ hutU) + let zIndices : Finset (Fin (p.length + 1)) := + Finset.univ.filter fun r => r.val < t.val ∧ + ∃ w ∈ Z, p.getVert r.val = Sum.inl w + have hzIndices : zIndices.Nonempty := by + refine ⟨⟨0, by omega⟩, ?_⟩ + simp only [zIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨htPos, v, hvZ, p.getVert_zero⟩ + let qz : Fin (p.length + 1) := zIndices.max' hzIndices + have hqzMem : qz ∈ zIndices := Finset.max'_mem zIndices hzIndices + obtain ⟨hqzt, w, hwZ, hqw⟩ : qz.val < t.val ∧ + ∃ w ∈ Z, p.getVert qz.val = Sum.inl w := by + simpa only [zIndices, Finset.mem_filter, Finset.mem_univ, true_and] + using hqzMem + have hqzMax : ∀ r : Fin (p.length + 1), r ∈ zIndices → + r.val ≤ qz.val := by + intro r hr + exact_mod_cast Finset.le_max' zIndices r hr + let qe : Fin (p.length + 1) := ⟨qz.val + 1, by omega⟩ + have hqzAdj := p.adj_getVert_succ (i := qz.val) + (by omega : qz.val < p.length) + have hqzAdj' : H.Adj (Sum.inl w) (p.getVert qe.val) := by + simpa [H, qe, hqw] using hqzAdj + have hqet : qe.val < t.val := by + have hne : qe.val ≠ t.val := by + intro heq + have hadj : H.Adj (Sum.inl w) (Sum.inl ut) := by + simpa [heq, htNode] using hqzAdj' + simp [H, TwoColorIncidenceGraph] at hadj + change qz.val + 1 ≠ t.val at hne + change qz.val + 1 < t.val + omega + obtain ⟨f, hqeNode, hwf, hfColors⟩ : ∃ f : E, + p.getVert qe.val = Sum.inr f ∧ Incident G w f ∧ + (phiD f = some gamma ∨ phiD f = some beta) := by + cases hn : p.getVert qe.val with + | inl a => + exfalso + have hadj : H.Adj (Sum.inl w) (Sum.inl a) := by + simpa [hn] using hqzAdj' + simp [H, TwoColorIncidenceGraph] at hadj + | inr e => + refine ⟨e, rfl, ?_⟩ + rw [hn] at hqzAdj' + simpa [H, TwoColorIncidenceGraph] using hqzAdj' + let qx : Fin (p.length + 1) := ⟨qe.val + 1, by omega⟩ + have hqeAdj := p.adj_getVert_succ (i := qe.val) + (by omega : qe.val < p.length) + have hqeAdj' : H.Adj (Sum.inr f) (p.getVert qx.val) := by + simpa [H, qx, hqeNode] using hqeAdj + obtain ⟨x, hqxNode, hxf⟩ : ∃ x : V, + p.getVert qx.val = Sum.inl x ∧ Incident G x f := by + cases hn : p.getVert qx.val with + | inl a => + refine ⟨a, rfl, ?_⟩ + have hadj : H.Adj (Sum.inr f) (Sum.inl a) := by + simpa [hn] using hqeAdj' + have hpair : Incident G a f ∧ + (phiD f = some gamma ∨ phiD f = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hadj + exact hpair.1 + | inr e => + exfalso + have hadj : H.Adj (Sum.inr f) (Sum.inr e) := by + simpa [hn] using hqeAdj' + simp [H, TwoColorIncidenceGraph] at hadj + have hqxle : qx.val ≤ t.val := by dsimp [qx]; omega + have hxOutside := @helper_hxOutside_244 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R beta v z p hXeq u_mem_cases no_gamma_cross no_beta_cross i0 + i1 i2 i3 i4 qv qf hZU hpairIndices ut hutU htNode hzIndices hqzt w hwZ hqzMax hqet f hwf + hfColors x hqxNode hxf hqxle + have hfGamma := @helper_hfGamma_268 V E inferInstance inferInstance inferInstance inferInstance G + k e0 phi T C D d R beta v z p hbetaD hZsubX hvX hclosed i0 i1 i2 i3 i4 qv qf hpath fin_le + hpairIndices hzIndices hqzt w hwZ hqw hqet f hwf hfColors x hqxNode hxf hxOutside + have hfEnds := @helper_hfEnds_693 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R beta v z p i0 i1 i2 i3 i4 qv qf hpath fin_le hpairIndices hzIndices hqzt w + hqw hqet f hwf x hqxNode hxf + have hfThree : f = D.f0 d ∨ + f = C.blockEdge (D.gammaIndex d) 0 ∨ + f = C.blockEdge (D.gammaIndex d) 1 := by + apply (hexact f).mp + exact ⟨hfGamma, w, hwZ, x, hxOutside, hfEnds⟩ + obtain ⟨a0, ha0ends⟩ := C.block_attaches_to_base (D.gammaIndex d) 0 + obtain ⟨a1, ha1ends⟩ := C.block_attaches_to_base (D.gammaIndex d) 1 + have hreturn_forward := @helper_hreturn_forward_310 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R beta v z p h i0 i1 i2 i3 i4 qv qf hi01 hi12 hi23 hi34 hi4qv + hqfv hpath fin_le hblockNotU hbaseZ hZU hpairIndices ut hutU htNode hzIndices hqzt hqzMax hqet + f hqeNode a1 ha1ends + have hreturn_reverse := @helper_hreturn_reverse_400 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R beta v z p h i0 i1 i2 i3 i4 qv qf hi01 hi12 hi23 hi34 hi4qv + hqfv hpath fin_le hblockNotU hbaseZ hZU hpairIndices ut hutU htNode hzIndices hqzt hqzMax hqet + f hqeNode a0 ha0ends + rcases hfThree with hf0 | hfBlock0 | hfBlock1 + · exact @helper_branch_739 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R beta v z p hXeq i0 i1 i2 i3 i4 qv qf hqfv hqfNode hafter hpath fin_le + hpairIndices ut hutU htNode hzIndices hqzt hqet f hqeNode hf0 + · exact @helper_branch_751 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R beta v z p h i0 i1 i2 i3 i4 qv qf hi34 horient hpath fin_le hpairIndices + hzIndices hqzt w hwZ hqw hqet f hqeNode hreturn_forward hfBlock0 + · exact @helper_branch_766 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R beta v z p h i0 i1 i2 i3 i4 qv qf hi34 horient hpath fin_le hpairIndices + hzIndices hqzt w hwZ hqw hqet f hqeNode hreturn_reverse hfBlock1 +private theorem helper_branch_630.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : (TwoColorIncidenceGraph G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), beta ∈ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v + → beta ∈ TreeFreeColors (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin + k) (Sum.inl (D.v0 d))) R.replacementTree → ScheideDefectiveChainPath R.replacementTree + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (C.gamma (D.gammaIndex d)) beta v z p → + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet R.replacementTree; + let U : Finset V := { R.u1, R.u2 }; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; v ∈ X → + GlobalMaximumTriple G k e0 phiD R.replacementTree → R.u1 ∈ U → R.u2 ∈ U → C.gamma + (D.gammaIndex d) ∈ DefectiveColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (TreeSequenceVertexSet R.replacementTree) → Sum.inl + R.u1 ∉ p.support → Sum.inl R.u2 ∉ p.support → + ∀ f ∈ BoundaryColorEdges G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin + k) (Sum.inl (D.v0 d))) (TreeSequenceVertexSet R.replacementTree) (C.gamma (D.gammaIndex + d)), ¬Incident G R.u1 f ∧ ¬Incident G R.u2 f := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p hbetaD hbetaFree hp gamma phiD X U H hvX + hglobal hu1U hu2U hgammaDef hu1Avoid hu2Avoid f hfBoundary + have hfSupport : Sum.inr f ∈ p.support := + ((ScheideDefectiveChainBoundaryEdges G k e0 phiD + R.replacementTree hglobal gamma beta + (by simpa [gamma, phiD, X] using hgammaDef) hbetaFree v + (by simpa [X] using hvX) (by simpa [phiD] using hbetaD) + z p (by simpa [gamma, phiD] using hp)) f).mp + (by simpa [gamma, phiD, X] using hfBoundary) |>.2 + have hfColor : phiD f = some gamma := by + have := (Finset.mem_filter.mp + (show f ∈ BoundaryColorEdges G phiD X gamma by + simpa [gamma, phiD, X] using hfBoundary)).2 + exact this + have avoid_incident (u : V) (huU : u ∈ U) + (huAvoid : Sum.inl u ∉ p.support) : ¬ Incident G u f := by + intro huf + have hadj : H.Adj (Sum.inl u) (Sum.inr f) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G u f ∧ + (phiD f = some gamma ∨ phiD f = some beta) from + ⟨huf, Or.inl hfColor⟩) + have hfComponent : H.connectedComponentMk (Sum.inr f) = + H.connectedComponentMk (Sum.inl v) := by + change Sum.inr f ∈ TwoColorComponent G phiD gamma beta (Sum.inl v) + rw [← hp.2.2.2] + exact hfSupport + have huComponent : H.connectedComponentMk (Sum.inl u) = + H.connectedComponentMk (Sum.inl v) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans hfComponent + apply huAvoid + have huComp : Sum.inl u ∈ + TwoColorComponent G phiD gamma beta (Sum.inl v) := huComponent + rw [← hp.2.2.2] at huComp + exact huComp + exact ⟨avoid_incident R.u1 hu1U hu1Avoid, + avoid_incident R.u2 hu2U hu2Avoid⟩ + +theorem ScheideSymmetricReplacementBoundaryAvoidance {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let Z := + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} + ∀ (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phiD gamma beta).Walk (Sum.inl v) (Sum.inl z)), + v ∈ Z → + beta ∈ MissingColors G phiD v → + beta ∈ MissingColors G phi v → + beta ∈ TreeFreeColors phiD R.replacementTree → + beta ≠ d.1 → + beta ≠ gamma → + ScheideDefectiveChainPath R.replacementTree phiD gamma beta v z p → + (Sum.inl R.u1 ∉ p.support ∧ Sum.inl R.u2 ∉ p.support) ∧ + (∀ f : E, + f ∈ BoundaryColorEdges G phiD (TreeSequenceVertexSet R.replacementTree) gamma → + ¬Incident G R.u1 f ∧ ¬Incident G R.u2 f) ∧ + ∀ f : E, + phiD f = some gamma → + (Incident G R.u1 f ∨ Incident G R.u2 f) → ∀ w ∈ Z, ¬Incident G w f := by + classical + dsimp only + intro beta v z p hv hbetaD hbetaOld hbetaFree hbetaDelta hbetaGamma hp + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let X := TreeSequenceVertexSet R.replacementTree + let U := ({R.u1, R.u2} : Finset V) + let Z := TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} + let H := TwoColorIncidenceGraph G phiD gamma beta + have hvZ : v ∈ Z := by simpa [Z] using hv + have hXeq : X = Z ∪ U := by + simpa [X, Z, U] using R.replacement_vertices + have hZsubX : Z ⊆ X := by + intro w hw + rw [hXeq] + exact Finset.mem_union_left _ hw + have hvX : v ∈ X := hZsubX hvZ + have hu1X : R.u1 ∈ X := by + rw [hXeq] + simp [U] + have hu2X : R.u2 ∈ X := by + rw [hXeq] + simp [U] + have hmaximum := ScheideReplacementMaximum G k e0 phi T C D d R + dsimp [gamma, phiD] at hmaximum + have hproper : IsProperEdgeColoring G phiD := hmaximum.1 + have hglobal : GlobalMaximumTriple G k e0 phiD R.replacementTree := + hmaximum.2.2 + have hclosed : ColoredVertexSetClosed G phiD X := by + change ColoredVertexSetClosed G phiD + (TreeSequenceVertexSet R.replacementTree) + exact (ScheideGlobalMaximumOrder G k e0 phiD R.replacementTree hglobal).2.2.2.2 + have hu1U : R.u1 ∈ U := by simp [U] + have hu2U : R.u2 ∈ U := by simp [U] + have u_mem_cases : ∀ {w : V}, w ∈ U → w = R.u1 ∨ w = R.u2 := by + intro w hw + simpa [U] using hw + have no_gamma_cross := @helper_no_gamma_cross_96 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R + obtain ⟨b, hbOldColor, hbEnds⟩ := + ScheideReplacementInternalMissing G k e0 phi T C D d R beta + (by simpa [gamma] using hbetaGamma) ⟨v, hv, hbetaOld⟩ + have hbIncident1 : Incident G R.u1 b := by + change R.u1 ∈ G.ends b + rw [hbEnds] + simp + have hbIncident2 : Incident G R.u2 b := by + change R.u2 ∈ G.ends b + rw [hbEnds] + simp + have hbColor : phiD b = some beta := by + have hfix := ScheideReplacementPairFixed G k e0 phi T C D d R b + (Or.inl hbIncident1) + simpa [phiD] using hfix.trans hbOldColor + have beta_incident_unique : ∀ (u : V), u ∈ U → ∀ f : E, + Incident G u f → phiD f = some beta → f = b := by + intro u hu f huf hfColor + rcases u_mem_cases hu with rfl | rfl + · by_contra hfb + exact (hproper hfb ⟨R.u1, huf, hbIncident1⟩ hfColor) hbColor + · by_contra hfb + exact (hproper hfb ⟨R.u2, huf, hbIncident2⟩ hfColor) hbColor + have no_beta_cross : ∀ f : E, phiD f = some beta → + ∀ u ∈ U, Incident G u f → ∀ w ∈ Z, ¬ Incident G w f := by + intro f hfColor u huU huf w hwZ hwf + have hfb : f = b := beta_incident_unique u huU f huf hfColor + subst f + have hwU : w ∈ U := by + change w ∈ ({R.u1, R.u2} : Finset V) + simpa [Incident, hbEnds] using hwf + have hwT : w ∈ TreeSequenceVertexSet T := + (Finset.mem_sdiff.mp hwZ).1 + rcases u_mem_cases hwU with hw1 | hw2 + · exact R.u1_outside (hw1 ▸ hwT) + · exact R.u2_outside (hw2 ▸ hwT) + obtain ⟨h, i0, i1, i2, i3, i4, qv, qf, + hhColor, hhEnds, hi01, hi12, hi23, hi34, horient, + hi4qv, hqfv, hqvNode, hqfNode, hafter, hu1NotExit, hu2NotExit⟩ := + ScheideSymmetricReplacementPathOrder G k e0 phi T C D d R + beta v z p hv hbetaD hbetaOld hbetaFree hbetaDelta hbetaGamma hp + have hpath : p.IsPath := hp.2.1 + have fin_le (r : Fin (p.length + 1)) : r.val ≤ p.length := by + have := r.isLt + omega + have hconfig := + ScheideSymmetricReplacementBoundaryConfiguration G k e0 phi T C D d R + dsimp [gamma, phiD, X, Z] at hconfig + rcases hconfig with + ⟨hgammaDef, hf0Color, hb0Color, hb1Color, hf0ne0, hf0ne1, + hb01ne, hexact⟩ + have hblockOld : ∀ j : Fin 2, + C.blockVertex (D.gammaIndex d) j ∈ TreeSequenceVertexSet T := by + intro j + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨C.p + 2 * (D.gammaIndex d).val + j.val, by + rw [C.length_eq] + omega⟩, C.block_vertex_position _ _⟩ + have hblockNotU : ∀ j : Fin 2, + C.blockVertex (D.gammaIndex d) j ∉ U := by + intro j hj + rcases u_mem_cases hj with hj1 | hj2 + · exact R.u1_outside (hj1.symm ▸ hblockOld j) + · exact R.u2_outside (hj2.symm ▸ hblockOld j) + have hblockNotX : ∀ j : Fin 2, + C.blockVertex (D.gammaIndex d) j ∉ X := by + intro j hj + rw [hXeq] at hj + rcases Finset.mem_union.mp hj with hjZ | hjU + · exact (Finset.mem_sdiff.mp hjZ).2 (by + have hjval : j.val = 0 ∨ j.val = 1 := by omega + rcases hjval with hjval | hjval + · have heq : j = (0 : Fin 2) := Fin.ext hjval + subst j + simp + · have heq : j = (1 : Fin 2) := Fin.ext hjval + subst j + simp) + · exact hblockNotU j hjU + have hbaseZ : ∀ q : Fin C.p, C.y q ∈ Z := by + intro q + simp only [Z, Finset.mem_sdiff] + constructor + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨q.val, by rw [C.length_eq]; omega⟩, + C.base_vertex_position q⟩ + · simp only [Finset.mem_insert, Finset.mem_singleton] + intro he + rcases he with he | he + · have hi := T.vertex_injective + ((C.base_vertex_position q).trans + (he.trans (C.block_vertex_position (D.gammaIndex d) 0).symm)) + have hv := congrArg Fin.val hi + have hq := q.isLt + have hpC := C.p_ge_two + change q.val = C.p + 2 * (D.gammaIndex d).val at hv + omega + · have hi := T.vertex_injective + ((C.base_vertex_position q).trans + (he.trans (C.block_vertex_position (D.gammaIndex d) 1).symm)) + have hv := congrArg Fin.val hi + have hq := q.isLt + have hpC := C.p_ge_two + change q.val = C.p + 2 * (D.gammaIndex d).val + 1 at hv + omega + have hZU : ∀ {w : V}, w ∈ Z → w ∉ U := by + intro w hwZ hwU + have hwT := (Finset.mem_sdiff.mp hwZ).1 + rcases u_mem_cases hwU with hw1 | hw2 + · exact R.u1_outside (hw1 ▸ hwT) + · exact R.u2_outside (hw2 ▸ hwT) + have havoidU := @helper_havoidU_249 V E inferInstance inferInstance inferInstance inferInstance G + k e0 phi T C D d R beta v z p hbetaD hvZ hXeq hZsubX hvX hclosed u_mem_cases no_gamma_cross + no_beta_cross h i0 i1 i2 i3 i4 qv qf hi01 hi12 hi23 hi34 horient hi4qv hqfv hqfNode hafter + hpath fin_le hexact hblockNotU hbaseZ hZU + have hu1Avoid : Sum.inl R.u1 ∉ p.support := havoidU R.u1 hu1U + have hu2Avoid : Sum.inl R.u2 ∉ p.support := havoidU R.u2 hu2U + refine ⟨⟨hu1Avoid, hu2Avoid⟩, ?_, ?_⟩ + · exact @helper_branch_630 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R beta v z p hbetaD hbetaFree hp hvX hglobal hu1U hu2U hgammaDef hu1Avoid hu2Avoid + · intro f hfColor hfu w hwZ + exact no_gamma_cross f (by simpa [phiD, gamma] using hfColor) hfu w + (by simpa [Z] using hwZ) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryConfiguration.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryConfiguration.lean new file mode 100644 index 0000000000..5cd6b29fcb --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryConfiguration.lean @@ -0,0 +1,614 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Scheide Symmetric Replacement Boundary Configuration + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_hbaseZ_165.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let Z : Finset V := + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + ∀ (q : Fin C.p), + C.y q ∈ Z := by + classical + intro V E _ _ _ _ G k e0 phi T C D d Z q + simp only [Z, Finset.mem_sdiff] + constructor + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨q.val, by rw [C.length_eq]; omega⟩, + C.base_vertex_position q⟩ + · simp only [Finset.mem_insert, Finset.mem_singleton] + intro he + rcases he with he | he + · have hi := T.vertex_injective + ((C.base_vertex_position q).trans + (he.trans (C.block_vertex_position (D.gammaIndex d) 0).symm)) + have hv := congrArg Fin.val hi + have hc := C.length_eq + have hq := q.isLt + have hp := C.p_ge_two + have hg := (D.gammaIndex d).isLt + change q.val = C.p + 2 * (D.gammaIndex d).val at hv + omega + · have hi := T.vertex_injective + ((C.base_vertex_position q).trans + (he.trans (C.block_vertex_position (D.gammaIndex d) 1).symm)) + have hv := congrArg Fin.val hi + have hc := C.length_eq + have hq := q.isLt + have hp := C.p_ge_two + have hg := (D.gammaIndex d).isLt + change q.val = C.p + 2 * (D.gammaIndex d).val + 1 at hv + omega + +private theorem helper_branch_348.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + TreeSequenceVertexSet R.replacementTree = + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ + { R.u1, R.u2 } → + phi (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = some (C.gamma (D.gammaIndex d)) → + phi (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = some (C.gamma (D.gammaIndex d)) → + (∃ (q : Fin C.p), + G.ends (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = + s(C.y q, C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)))) → + (∃ (q : Fin C.p), + G.ends (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = + s(C.y q, C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)))) → + (∀ (f : E), + (∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → + ¬f = D.f0 d → + TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) f = + phi f) → + IsProperEdgeColoring G phi → + (∀ f ∈ BoundaryEdges G (TreeSequenceVertexSet T), phi f = some gamma → False) → + ∀ (f : E), + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) + f = + some (C.gamma (D.gammaIndex d)) ∧ + ∃ + v ∈ + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}, + ∃ w ∉ TreeSequenceVertexSet R.replacementTree, G.ends f = s(v, w)) → + f = D.f0 d ∨ + f = C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) ∨ + f = C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ)) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma hrep hblock0 hblock1 hf1ends hf2ends hfix hproper0 + hnoext f + rintro ⟨hfc, v, hv, w, hw, he⟩ + by_cases hff : f = D.f0 d + · exact Or.inl hff + have hfo : phi f = some gamma := (hfix f + ⟨v, (Finset.mem_sdiff.mp hv).1, by + change v ∈ G.ends f + rw [he] + exact Sym2.mem_mk_left _ _⟩ hff).symm.trans hfc + have hwT : w ∈ TreeSequenceVertexSet T := by + by_contra hwt + apply hnoext f + · simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨v, (Finset.mem_sdiff.mp hv).1, w, hwt, he⟩ + · exact hfo + have hwr : w ∉ TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} := by + intro hwr + apply hw + rw [hrep] + exact Finset.mem_union.mpr (Or.inl hwr) + have hwb : w = C.blockVertex (D.gammaIndex d) 0 ∨ + w = C.blockVertex (D.gammaIndex d) 1 := by + by_contra hn + apply hwr + exact Finset.mem_sdiff.mpr ⟨hwT, by simpa using hn⟩ + rcases hwb with rfl | rfl + · apply Or.inr (Or.inl ?_) + by_contra hne + have hadj : AdjacentEdges G f (C.blockEdge (D.gammaIndex d) 0) := by + refine ⟨C.blockVertex (D.gammaIndex d) 0, ?_, ?_⟩ + · change C.blockVertex (D.gammaIndex d) 0 ∈ G.ends f + rw [he] + exact Sym2.mem_mk_right _ _ + · obtain ⟨q, hq⟩ := hf1ends + change C.blockVertex (D.gammaIndex d) 0 ∈ + G.ends (C.blockEdge (D.gammaIndex d) 0) + rw [hq] + exact Sym2.mem_mk_right _ _ + exact (hproper0 hne hadj hfo) hblock0 + · apply Or.inr (Or.inr ?_) + by_contra hne + have hadj : AdjacentEdges G f (C.blockEdge (D.gammaIndex d) 1) := by + refine ⟨C.blockVertex (D.gammaIndex d) 1, ?_, ?_⟩ + · change C.blockVertex (D.gammaIndex d) 1 ∈ G.ends f + rw [he] + exact Sym2.mem_mk_right _ _ + · obtain ⟨q, hq⟩ := hf2ends + change C.blockVertex (D.gammaIndex d) 1 ∈ + G.ends (C.blockEdge (D.gammaIndex d) 1) + rw [hq] + exact Sym2.mem_mk_right _ _ + exact (hproper0 hne hadj hfo) hblock1 + +private theorem helper_hne0_225.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + G.ends (D.f0 d) = s(D.v0 d, D.u0 d) → + (∃ (q : Fin C.p), + G.ends (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = + s(C.y q, C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)))) → + D.f0 d ≠ C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) := by + classical + intro V E _ _ _ G k e0 phi T C D d hf0ends hf1ends he + have hu : D.u0 d ∈ G.ends (C.blockEdge (D.gammaIndex d) 0) := by + rw [← he, hf0ends] + exact Sym2.mem_mk_right _ _ + obtain ⟨q, hq⟩ := hf1ends + rw [hq] at hu + have hcases : D.u0 d = C.y q ∨ + D.u0 d = C.blockVertex (D.gammaIndex d) 0 := by + simpa using hu + rcases hcases with hcase | hcase + · apply D.u0_outside d + rw [hcase] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨q.val, by rw [C.length_eq]; omega⟩, + C.base_vertex_position q⟩ + · exact (D.u0_outside d) (hcase ▸ by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨C.p + 2 * (D.gammaIndex d).val, by + rw [C.length_eq]; omega⟩, + C.block_vertex_position (D.gammaIndex d) (0 : Fin 2)⟩) + +private theorem helper_hne1_248.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + G.ends (D.f0 d) = s(D.v0 d, D.u0 d) → + (∃ (q : Fin C.p), + G.ends (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = + s(C.y q, C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)))) → + D.f0 d ≠ C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ)) := by + classical + intro V E _ _ _ G k e0 phi T C D d hf0ends hf2ends he + have hu : D.u0 d ∈ G.ends (C.blockEdge (D.gammaIndex d) 1) := by + rw [← he, hf0ends] + exact Sym2.mem_mk_right _ _ + obtain ⟨q, hq⟩ := hf2ends + rw [hq] at hu + have hcases : D.u0 d = C.y q ∨ + D.u0 d = C.blockVertex (D.gammaIndex d) 1 := by + simpa using hu + rcases hcases with hcase | hcase + · exact (D.u0_outside d) (hcase ▸ by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨q.val, by rw [C.length_eq]; omega⟩, + C.base_vertex_position q⟩) + · exact (D.u0_outside d) (hcase ▸ by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨C.p + 2 * (D.gammaIndex d).val + 1, by + rw [C.length_eq]; omega⟩, + C.block_vertex_position (D.gammaIndex d) (1 : Fin 2)⟩) + +private theorem helper_hne12_270.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) ≠ + C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ)) := by + classical + intro V E _ _ _ G k e0 phi T C D d he + have hpos := C.block_edge_position (D.gammaIndex d) 0 + have hpos2 := C.block_edge_position (D.gammaIndex d) 1 + have hi : (⟨C.p - 1 + 2 * (D.gammaIndex d).val, by + have hc := C.length_eq + have hp := C.p_ge_two + have hq := (D.gammaIndex d).isLt + omega⟩ : Fin T.length) = + ⟨C.p - 1 + 2 * (D.gammaIndex d).val + 1, by + have hc := C.length_eq + have hp := C.p_ge_two + have hq := (D.gammaIndex d).isLt + omega⟩ := by + apply T.edge_injective + exact hpos.trans (he.trans hpos2.symm) + have hv := congrArg Fin.val hi + have hzero : (0 : Nat) < 1 := by omega + change C.p - 1 + 2 * (D.gammaIndex d).val = + C.p - 1 + 2 * (D.gammaIndex d).val + 1 at hv + omega + +private theorem helper_hu0_416.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d), + let Xd : Finset V := TreeSequenceVertexSet R.replacementTree; + TreeSequenceVertexSet R.replacementTree = + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ + { R.u1, R.u2 } → + IsProperEdgeColoring G phi → + D.u0 d ∉ Xd := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R Xd hrep hproper0 + change D.u0 d ∉ TreeSequenceVertexSet R.replacementTree + rw [hrep] + intro hu + rcases Finset.mem_union.mp hu with hr | hu + · exact D.u0_outside d (Finset.mem_sdiff.mp hr).1 + · simp only [Finset.mem_insert, Finset.mem_singleton] at hu + rcases hu with hu | hu + · have hadj : AdjacentEdges G (D.f0 d) R.f1 := by + refine ⟨D.u0 d, ?_, ?_⟩ + · change D.u0 d ∈ G.ends (D.f0 d) + rw [D.f0_ends] + exact Sym2.mem_mk_right _ _ + · have hi : R.u1 ∈ G.ends R.f1 := by + rw [R.f1_ends] + exact Sym2.mem_mk_right _ _ + exact hu ▸ hi + have hbad := hproper0 R.f0_ne_f1 hadj (D.f0_color d) + exact hbad R.f1_color + · have hadj : AdjacentEdges G (D.f0 d) R.f2 := by + refine ⟨D.u0 d, ?_, ?_⟩ + · change D.u0 d ∈ G.ends (D.f0 d) + rw [D.f0_ends] + exact Sym2.mem_mk_right _ _ + · have hi : R.u2 ∈ G.ends R.f2 := by + rw [R.f2_ends] + exact Sym2.mem_mk_right _ _ + exact hu ▸ hi + have hbad := hproper0 R.f0_ne_f2 hadj (D.f0_color d) + exact hbad R.f2_color + +private theorem helper_branch_458.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) + (R : ScheideReplacementData G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := + TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl (D.v0 d)); + let Xd : Finset V := TreeSequenceVertexSet R.replacementTree; + let Z : Finset V := + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}; + TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) + (D.f0 d) = + some (C.gamma (D.gammaIndex d)) → + TreeSequenceVertexSet R.replacementTree = + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∪ + { R.u1, R.u2 } → + (∃ (q : Fin C.p), + G.ends (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = + s(C.y q, C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)))) → + (∃ (q : Fin C.p), + G.ends (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = + s(C.y q, C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)))) → + (∀ (j : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) j ∈ TreeSequenceVertexSet T) → + (∀ (q : Fin C.p), C.y q ∈ Z) → + phiD (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = some gamma → + phiD (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = some gamma → + D.v0 d ∈ Z → + D.u0 d ∉ Xd → + ∀ (f : E), + f = D.f0 d ∨ + f = C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) ∨ + f = C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ)) → + TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) + f = + some (C.gamma (D.gammaIndex d)) ∧ + ∃ + v ∈ + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))}, + ∃ w ∉ TreeSequenceVertexSet R.replacementTree, G.ends f = s(v, w) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD Xd Z hf0c hrep hf1ends hf2ends htreeBlock + hbaseZ hblockc0 hblockc1 hv0Z hu0 f hf + rcases hf with rfl | rfl | rfl + · exact ⟨hf0c, D.v0 d, hv0Z, D.u0 d, hu0, D.f0_ends d⟩ + · exact ⟨hblockc0, by + obtain ⟨q, hq⟩ := hf1ends + refine ⟨C.y q, ?_, C.blockVertex (D.gammaIndex d) 0, ?_, hq⟩ + · exact hbaseZ q + · rw [hrep] + intro hb + rcases Finset.mem_union.mp hb with hr | hu + · exact (Finset.mem_sdiff.mp hr).2 (by simp) + · simp only [Finset.mem_insert, Finset.mem_singleton] at hu + rcases hu with hu | hu + · exact R.u1_outside (hu ▸ htreeBlock 0) + · exact R.u2_outside (hu ▸ htreeBlock 0)⟩ + · exact ⟨hblockc1, by + obtain ⟨q, hq⟩ := hf2ends + refine ⟨C.y q, ?_, C.blockVertex (D.gammaIndex d) 1, ?_, hq⟩ + · exact hbaseZ q + · rw [hrep] + intro hb + rcases Finset.mem_union.mp hb with hr | hu + · exact (Finset.mem_sdiff.mp hr).2 (by simp) + · simp only [Finset.mem_insert, Finset.mem_singleton] at hu + rcases hu with hu | hu + · exact R.u1_outside (hu ▸ htreeBlock 1) + · exact R.u2_outside (hu ▸ htreeBlock 1)⟩ + +theorem ScheideSymmetricReplacementBoundaryConfiguration {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let Xd := TreeSequenceVertexSet R.replacementTree + let Z := + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} + gamma ∈ DefectiveColors G phiD Xd ∧ + phiD (D.f0 d) = some gamma ∧ + phiD (C.blockEdge (D.gammaIndex d) 0) = some gamma ∧ + phiD (C.blockEdge (D.gammaIndex d) 1) = some gamma ∧ + D.f0 d ≠ C.blockEdge (D.gammaIndex d) 0 ∧ + D.f0 d ≠ C.blockEdge (D.gammaIndex d) 1 ∧ + C.blockEdge (D.gammaIndex d) 0 ≠ C.blockEdge (D.gammaIndex d) 1 ∧ + ∀ f : E, + (phiD f = some gamma ∧ ∃ v ∈ Z, ∃ w ∉ Xd, G.ends f = s(v, w)) ↔ + f = D.f0 d ∨ + f = C.blockEdge (D.gammaIndex d) 0 ∨ + f = C.blockEdge (D.gammaIndex d) 1 := by + classical + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let Xd := TreeSequenceVertexSet R.replacementTree + let Z := TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} + have hmax := ScheideReplacementMaximum G k e0 phi T C D d R + dsimp [gamma, phiD, Xd, Z] at hmax ⊢ + have hproper : IsProperEdgeColoring G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) d.1 + (Sum.inl (D.v0 d))) := hmax.1 + have horder := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) := + horder.2.2.2.2 + have hsw := ScheideDefectiveSwitchEffect G k e0 phi T C D d + dsimp at hsw + have hf0c := hsw.2.2.1 + have hrep := R.replacement_vertices + have hblock0 := C.block_color (D.gammaIndex d) 0 + have hblock1 := C.block_color (D.gammaIndex d) 1 + have hf0ends := D.f0_ends d + have hf1ends := C.block_attaches_to_base (D.gammaIndex d) 0 + have hf2ends := C.block_attaches_to_base (D.gammaIndex d) 1 + have hfix := hsw.2.2.2.2.1 + have hne0 := @helper_hne0_225 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + hf0ends hf1ends + have hne1 := @helper_hne1_248 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + hf0ends hf2ends + have hne12 := @helper_hne12_270 V E inferInstance inferInstance inferInstance G k e0 phi T C D d + have htreeY : ∀ q : Fin C.p, C.y q ∈ TreeSequenceVertexSet T := by + intro q + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨q.val, by rw [C.length_eq]; omega⟩, + C.base_vertex_position q⟩ + have htreeBlock : ∀ j : Fin 2, + C.blockVertex (D.gammaIndex d) j ∈ TreeSequenceVertexSet T := by + intro j + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨C.p + 2 * (D.gammaIndex d).val + j.val, by + rw [C.length_eq]; omega⟩, C.block_vertex_position _ _⟩ + have hbaseZ := @helper_hbaseZ_165 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d + have hblockmem0 : C.blockEdge (D.gammaIndex d) 0 ∈ + BoundaryEdges G Xd := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + obtain ⟨q, hq⟩ := hf1ends + have hy : C.y q ∈ Xd := by + change C.y q ∈ TreeSequenceVertexSet R.replacementTree + rw [hrep] + exact Finset.mem_union.mpr (Or.inl (Finset.mem_sdiff.mpr + ⟨htreeY q, (Finset.mem_sdiff.mp (hbaseZ q)).2⟩)) + refine ⟨C.y q, hy, C.blockVertex (D.gammaIndex d) 0, ?_, hq⟩ + change C.blockVertex (D.gammaIndex d) 0 ∉ + TreeSequenceVertexSet R.replacementTree + rw [hrep] + intro hb + rcases Finset.mem_union.mp hb with hr | hu + · exact (Finset.mem_sdiff.mp hr).2 (by simp) + · simp only [Finset.mem_insert, Finset.mem_singleton] at hu + rcases hu with hu | hu + · exact R.u1_outside (hu ▸ htreeBlock 0) + · exact R.u2_outside (hu ▸ htreeBlock 0) + have hblockmem1 : C.blockEdge (D.gammaIndex d) 1 ∈ + BoundaryEdges G Xd := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + obtain ⟨q, hq⟩ := hf2ends + have hy : C.y q ∈ Xd := by + change C.y q ∈ TreeSequenceVertexSet R.replacementTree + rw [hrep] + exact Finset.mem_union.mpr (Or.inl (Finset.mem_sdiff.mpr + ⟨htreeY q, (Finset.mem_sdiff.mp (hbaseZ q)).2⟩)) + refine ⟨C.y q, hy, C.blockVertex (D.gammaIndex d) 1, ?_, hq⟩ + change C.blockVertex (D.gammaIndex d) 1 ∉ + TreeSequenceVertexSet R.replacementTree + rw [hrep] + intro hb + rcases Finset.mem_union.mp hb with hr | hu + · exact (Finset.mem_sdiff.mp hr).2 (by simp) + · simp only [Finset.mem_insert, Finset.mem_singleton] at hu + rcases hu with hu | hu + · exact R.u1_outside (hu ▸ htreeBlock 1) + · exact R.u2_outside (hu ▸ htreeBlock 1) + have hblockc0 : phiD (C.blockEdge (D.gammaIndex d) 0) = some gamma := by + obtain ⟨q, hq⟩ := hf1ends + have hi : ∃ v ∈ TreeSequenceVertexSet T, + Incident G v (C.blockEdge (D.gammaIndex d) 0) := by + refine ⟨C.y q, ?_, ?_⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨q.val, by rw [C.length_eq]; omega⟩, + C.base_vertex_position q⟩ + · change C.y q ∈ G.ends (C.blockEdge (D.gammaIndex d) 0) + rw [hq] + exact Sym2.mem_mk_left _ _ + simpa [gamma] using (hfix _ hi hne0.symm).trans hblock0 + have hblockc1 : phiD (C.blockEdge (D.gammaIndex d) 1) = some gamma := by + obtain ⟨q, hq⟩ := hf2ends + have hi : ∃ v ∈ TreeSequenceVertexSet T, + Incident G v (C.blockEdge (D.gammaIndex d) 1) := by + refine ⟨C.y q, ?_, ?_⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨q.val, by rw [C.length_eq]; omega⟩, + C.base_vertex_position q⟩ + · change C.y q ∈ G.ends (C.blockEdge (D.gammaIndex d) 1) + rw [hq] + exact Sym2.mem_mk_left _ _ + simpa [gamma] using (hfix _ hi hne1.symm).trans hblock1 + have hb0 : C.blockEdge (D.gammaIndex d) 0 ∈ + BoundaryColorEdges G phiD Xd gamma := by + exact Finset.mem_filter.mpr ⟨hblockmem0, hblockc0⟩ + have hb1 : C.blockEdge (D.gammaIndex d) 1 ∈ + BoundaryColorEdges G phiD Xd gamma := by + exact Finset.mem_filter.mpr ⟨hblockmem1, hblockc1⟩ + have hcard : 2 ≤ (BoundaryColorEdges G phiD Xd gamma).card := by + have hs : ({C.blockEdge (D.gammaIndex d) 0, + C.blockEdge (D.gammaIndex d) 1} : Finset E) ⊆ + BoundaryColorEdges G phiD Xd gamma := by + intro e he + simp only [Finset.mem_insert, Finset.mem_singleton] at he + rcases he with rfl | rfl + · exact hb0 + · exact hb1 + have hc := Finset.card_le_card hs + simpa [hne12] using hc + refine ⟨?_, hf0c, hblockc0, hblockc1, hne0, hne1, hne12, ?_⟩ + · simp only [DefectiveColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact hcard + have hproper0 : IsProperEdgeColoring G phi := + C.globally_maximum.1.2.2.2.1 + have helem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T) := horder.2.2.2.1 + have hnoext : ∀ f : E, f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → + phi f = some gamma → False := by + intro f hf hc + obtain ⟨v, hv, w, hw, he⟩ := by + simpa [BoundaryEdges] using hf + have hv0T : D.v0 d ∈ TreeSequenceVertexSet T := by + have hx := ScheideStructuralExitsInBase G k e0 phi T C + (D.v0_is_exit d) + rcases Finset.mem_image.mp hx with ⟨q, hq, hv⟩ + exact hv ▸ htreeY q + have hnot : gamma ∉ MissingColors G phi (D.v0 d) := + hclosed hf hv0T hc + exact hnot (D.gamma_missing_at_v0 d) + have hv0Z : D.v0 d ∈ Z := by + have hx := ScheideStructuralExitsInBase G k e0 phi T C + (D.v0_is_exit d) + rcases Finset.mem_image.mp hx with ⟨q, hq, hv⟩ + rw [← hv] + exact hbaseZ q + have hu0 := @helper_hu0_416 V E inferInstance inferInstance inferInstance inferInstance G k e0 phi + T C D d R hrep hproper0 + have hf0mem : D.f0 d ∈ BoundaryEdges G Xd := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + have hv0Xd : D.v0 d ∈ Xd := by + change D.v0 d ∈ TreeSequenceVertexSet R.replacementTree + rw [hrep] + exact Finset.mem_union.mpr (Or.inl hv0Z) + refine ⟨D.v0 d, hv0Xd, D.u0 d, hu0, D.f0_ends d⟩ + have hf0col : D.f0 d ∈ BoundaryColorEdges G phiD Xd gamma := by + exact Finset.mem_filter.mpr ⟨hf0mem, hf0c⟩ + intro f + constructor + · exact @helper_branch_348 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R hrep hblock0 hblock1 hf1ends hf2ends hfix hproper0 hnoext f + · exact @helper_branch_458 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R hf0c hrep hf1ends hf2ends htreeBlock hbaseZ hblockc0 hblockc1 hv0Z hu0 f +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementFreePath.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementFreePath.lean new file mode 100644 index 0000000000..83881629be --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementFreePath.lean @@ -0,0 +1,836 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.DefectiveColors +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryConfiguration +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors + +/-! +# Scheide Symmetric Replacement Free Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation495Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let Xd : Finset V := TreeSequenceVertexSet R.replacementTree; + let r : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex r (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex r (1 : Fin (2 : ℕ)); + let U : Finset V := { u0, u1 }; + let Z : Finset V := X \ U; + let ends0 : Finset V := (G.ends e0).toFinset; (↑r : ℕ) < C.s → (1 : ℕ) ≤ C.s → (2 : ℕ) ≤ C.p → + T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s → R.replacementTree.length = T.length → X.card = + C.p + (2 : ℕ) * C.s → Z.card = C.p + (2 : ℕ) * C.s - (2 : ℕ) → Z ⊆ Xd → ends0 ⊆ Z → ends0 + ⊆ Xd → ends0.card = (2 : ℕ) → ( + ∀ v ∈ ends0, Incident G v e0) → GlobalMaximumTriple G k e0 phiD R.replacementTree → + ColoredVertexSetClosed G phiD Xd → ( + ∀ v ∈ TreeSequenceVertexSet R.replacementTree, (Incident G v e0 → (MissingColors G phiD + v).card = k - Degree G v + (1 : ℕ) ∧ (2 : ℕ) ≤ (MissingColors G phiD v).card) ∧ (¬Incident + G v e0 → (MissingColors G phiD v).card = k - Degree G v ∧ (1 : ℕ) ≤ (MissingColors G phiD + v).card)) → ((↑Z : Set V).PairwiseDisjoint fun (v : V) => MissingColors G phiD v) → ( + ∀ v ∈ Z, (MissingColors G phiD v).Nonempty) → + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + ∃ (beta : Fin k) (v : V) (z : V) (p : (TwoColorIncidenceGraph G phiD gamma beta).Walk (Sum.inl + v) (Sum.inl z)), v ∈ TreeSequenceVertexSet T \ {C.blockVertex (D.gammaIndex d) (0 : Fin (2 + : ℕ)), C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} ∧ beta ∈ MissingColors G phiD v ∧ + beta ∈ MissingColors G phi v ∧ beta ∈ TreeFreeColors phiD R.replacementTree ∧ beta ≠ (↑d : + Fin k) ∧ beta ≠ gamma ∧ ScheideDefectiveChainPath R.replacementTree phiD gamma beta v z p + +private theorem helper_hendsAvoidU_129.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d), + let X : Finset V := TreeSequenceVertexSet T; + let r : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex r (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex r (1 : Fin (2 : ℕ)); + let U : Finset V := { u0, u1 }; + let ends0 : Finset V := (G.ends e0).toFinset; + ∀ (hr : (↑r : ℕ) < C.s), (2 : ℕ) ≤ C.p → + ∀ (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s), R.replacementTree.length = T.length → + let m : ℕ := C.p + (2 : ℕ) * (↑r : ℕ); T.vertex (⟨m, + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = u0 → T.vertex (⟨m + (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))) = u1 → X.card = C.p + (2 : ℕ) * C.s → + ∀ v ∈ ends0, v ∉ U := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R X r u0 u1 U ends0 hr hp hlength hreplacementLength m hm0 + hm1 hXcard v hv hU + have hv' : v ∈ G.ends e0 := Sym2.mem_toFinset.mp hv + rw [← T.first_edge] at hv' + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + rw [hi, Sym2.mem_iff] at hv' + simp only [U, Finset.mem_insert, Finset.mem_singleton] at hU + rcases hv' with hv' | hv' <;> rcases hU with hu | hu <;> subst v + · have heq : T.vertex ⟨1, by omega⟩ = T.vertex ⟨m, by omega⟩ := by + simpa using hu.trans hm0.symm + have hi' := T.vertex_injective heq + have := congrArg Fin.val hi' + simp at this + omega + · have heq : T.vertex ⟨1, by omega⟩ = T.vertex ⟨m + 1, by omega⟩ := by + simpa using hu.trans hm1.symm + have hi' := T.vertex_injective heq + have := congrArg Fin.val hi' + simp at this + omega + · have hi_lt : i.val < 1 := by simp + have hii : i.val = 0 := by omega + have heq : T.vertex (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ (show (0 : Nat) < T.length by omega)))) = + T.vertex ⟨m, by omega⟩ := by + simpa using hu.trans hm0.symm + have hi' := T.vertex_injective heq + have := congrArg Fin.val hi' + simp [] at this + dsimp [m] at this + omega + · have hi_lt : i.val < 1 := by simp + have hii : i.val = 0 := by omega + have heq : T.vertex (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ (show (0 : Nat) < T.length by omega)))) = + T.vertex ⟨m + 1, by omega⟩ := by + simpa using hu.trans hm1.symm + have hi' := T.vertex_injective heq + have := congrArg Fin.val hi' + simp [] at this + +private theorem helper_hmissing_227.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (_ : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let r : Fin C.s := D.gammaIndex d; + let u0 : V := C.blockVertex r (0 : Fin (2 : ℕ)); + let u1 : V := C.blockVertex r (1 : Fin (2 : ℕ)); + let U : Finset V := { u0, u1 }; + let Z : Finset V := X \ U; + let ends0 : Finset V := (G.ends e0).toFinset; Z.card = C.p + (2 : ℕ) * C.s - (2 : ℕ) → + ∀ (hendsSubZ : ends0 ⊆ Z), ends0.card = (2 : ℕ) → ((↑Z : Set V).PairwiseDisjoint fun (v : V) + => MissingColors G phiD v) → + ∀ (hnonempty : + ∀ v ∈ Z, (MissingColors G phiD v).Nonempty), + let firstColor : (v : V) → v ∈ Z → Fin k := fun (v : V) (hv : v ∈ Z) => Classical.choose + (hnonempty v hv); ( + ∀ (v : V) (hv : v ∈ Z), firstColor v hv ∈ MissingColors G phiD v) → + ∀ (hsecond : + ∀ (v : V) (hv : v ∈ ends0), ((MissingColors G phiD v).erase (firstColor v (hendsSubZ + hv))).Nonempty), + let extraColor : (v : V) → v ∈ ends0 → Fin k := fun (v : V) (hv : v ∈ ends0) => + Classical.choose (hsecond v hv); ( + ∀ (v : V) (hv : v ∈ ends0), extraColor v hv ∈ (MissingColors G phiD v).erase (firstColor v + (hendsSubZ hv))) → + let M : Finset (Fin k) := Z.biUnion fun (v : V) => MissingColors G phiD v; Z.card + (2 : ℕ) ≤ + M.card := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD X r u0 u1 U Z ends0 hZcard hendsSubZ + hendsCard hdisj hnonempty firstColor firstMem hsecond extraColor extraMem M + let domain := Sum {v : V // v ∈ Z} {v : V // v ∈ ends0} + let color : domain → Fin k := fun q => match q with + | Sum.inl v => firstColor v.1 v.2 + | Sum.inr v => extraColor v.1 v.2 + have hmap : ∀ q : domain, color q ∈ M := by + intro q + rcases q with q | q + · apply Finset.mem_biUnion.mpr + exact ⟨q.1, q.2, firstMem q.1 q.2⟩ + · apply Finset.mem_biUnion.mpr + exact ⟨q.1, hendsSubZ q.2, + Finset.mem_erase.mp (extraMem q.1 q.2) |>.2⟩ + have hinj : Function.Injective color := by + intro a b hab + rcases a with a | a <;> rcases b with b | b + · have huv : a.1 = b.1 := by + by_contra hn + have hd := hdisj a.2 b.2 hn + have hc : firstColor a.1 a.2 = firstColor b.1 b.2 := by + simpa [color] using hab + exact (Finset.disjoint_left.mp hd) (firstMem a.1 a.2) + (by simpa only [hc] using firstMem b.1 b.2) + cases Subtype.ext huv + rfl + · have huv : a.1 = b.1 := by + by_contra hn + have hd := hdisj a.2 (hendsSubZ b.2) hn + have hc : firstColor a.1 a.2 = extraColor b.1 b.2 := by + simpa [color] using hab + exact (Finset.disjoint_left.mp hd) (firstMem a.1 a.2) + (by simpa only [hc] using Finset.mem_erase.mp (extraMem b.1 b.2) |>.2) + have he := Finset.mem_erase.mp (extraMem b.1 b.2) + exact False.elim (he.1 (by simpa [color, huv] using hab.symm)) + · have huv : a.1 = b.1 := by + by_contra hn + have hd := hdisj (hendsSubZ a.2) b.2 hn + have hc : extraColor a.1 a.2 = firstColor b.1 b.2 := by + simpa [color] using hab + exact (Finset.disjoint_left.mp hd) + (Finset.mem_erase.mp (extraMem a.1 a.2) |>.2) + (by simpa only [hc] using firstMem b.1 b.2) + have he := Finset.mem_erase.mp (extraMem a.1 a.2) + exact False.elim (he.1 (by simpa [color, huv] using hab)) + · have huv : a.1 = b.1 := by + by_contra hn + have hd := hdisj (hendsSubZ a.2) (hendsSubZ b.2) hn + have hc : extraColor a.1 a.2 = extraColor b.1 b.2 := by + simpa [color] using hab + exact (Finset.disjoint_left.mp hd) + (Finset.mem_erase.mp (extraMem a.1 a.2) |>.2) + (by simpa only [hc] using Finset.mem_erase.mp (extraMem b.1 b.2) |>.2) + cases Subtype.ext huv + rfl + let A : Finset domain := + Z.attach.map ⟨Sum.inl, Sum.inl_injective⟩ ∪ + ends0.attach.map ⟨Sum.inr, Sum.inr_injective⟩ + have hAdisj : Disjoint + (Z.attach.map ⟨Sum.inl, Sum.inl_injective⟩) + (ends0.attach.map ⟨Sum.inr, Sum.inr_injective⟩) := by + rw [Finset.disjoint_left] + intro q hq1 hq2 + rw [Finset.mem_map] at hq1 hq2 + rcases hq1 with ⟨a, ha, rfl⟩ + rcases hq2 with ⟨b, hb, h⟩ + cases h + have hAcard : A.card = Z.card + 2 := by + dsimp [A] + rw [Finset.card_union_of_disjoint hAdisj] + simp [hendsCard] + have hle : A.card ≤ M.card := by + apply Finset.card_le_card_of_injOn color + · intro q hq + exact hmap q + · exact hinj.injOn + omega + +private theorem helper_husedSub_369.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let r : Fin C.s := D.gammaIndex d; + ∀ (hr : (↑r : ℕ) < C.s), (1 : ℕ) ≤ C.s → + ∀ (hp : (2 : ℕ) ≤ C.p) (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) + (hreplacementLength : R.replacementTree.length = T.length) (hXcard : X.card = C.p + (2 : + ℕ) * C.s) (htreeD : TashkinovTree G e0 phiD R.replacementTree), + let baseIndex : Fin (C.p - (2 : ℕ)) → Fin R.replacementTree.length := fun (q : Fin (C.p - (2 : + ℕ))) => (⟨(↑q : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin R.replacementTree.length); + ∀ (hbaseIndexPos : + ∀ (q : Fin (C.p - (2 : ℕ))), (1 : ℕ) ≤ (↑(baseIndex q) : ℕ)), + let baseColor : Fin (C.p - (2 : ℕ)) → Fin k := fun (q : Fin (C.p - (2 : ℕ))) => + Classical.choose (Exists.choose_spec (htreeD (baseIndex q) (hbaseIndexPos q))); ( + ∀ (q : Fin (C.p - (2 : ℕ))), phiD (R.replacementTree.edge (baseIndex q)) = some (baseColor q)) + → + let baseColors : Finset (Fin k) := Finset.image baseColor Finset.univ; + let allBlockColors : Finset (Fin k) := Finset.image C.gamma Finset.univ; + let retainedBlockColors : Finset (Fin k) := allBlockColors.erase gamma; allBlockColors.card = + C.s → ( + ∀ (q : ℕ) (hq : q < T.length), (1 : ℕ) ≤ q → phiD (T.edge (⟨q, hq⟩ : Fin T.length)) = phi + (T.edge (⟨q, hq⟩ : Fin T.length))) → phiD R.f1 = some (↑d : Fin k) → phiD R.f2 = some (↑d + : Fin k) → TreeUsedColors phiD R.replacementTree ⊆ baseColors ∪ (retainedBlockColors ∪ + {(↑d : Fin k)}) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD X r hr hs hp hlength hreplacementLength + hXcard htreeD baseIndex hbaseIndexPos baseColor hbaseColorSpec baseColors allBlockColors + retainedBlockColors hallBlockCard originalEdgeFixed hf1D hf2D c hc + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc + rcases hc with ⟨j, hj, hc⟩ + by_cases hjBase : j.val < C.p - 1 + · apply Finset.mem_union_left + let q : Fin (C.p - 2) := ⟨j.val - 1, by omega⟩ + have hqj : baseIndex q = j := by + apply Fin.ext + simp [baseIndex, q] + omega + have hcol : baseColor q = c := by + apply Option.some.inj + exact (hbaseColorSpec q).symm.trans (by simpa [hqj] using hc) + exact Finset.mem_image.mpr ⟨q, Finset.mem_univ q, hcol⟩ + · apply Finset.mem_union_right + by_cases hbefore : j.val < C.p - 1 + 2 * r.val + · apply Finset.mem_union_left + let n := j.val - (C.p - 1) + let q : Fin C.s := ⟨n / 2, by omega⟩ + let t : Fin 2 := ⟨n % 2, Nat.mod_lt _ (by omega)⟩ + have hjpos : j.val = C.p - 1 + 2 * q.val + t.val := by + dsimp [q, t, n] + have hdiv := Nat.mod_add_div (j.val - (C.p - 1)) 2 + omega + have hqr : q ≠ r := by + intro h + have hval := congrArg Fin.val h + dsimp [q, n] at hval + omega + have hedgeOld : T.edge ⟨j.val, by omega⟩ = C.blockEdge q t := by + calc + T.edge ⟨j.val, by omega⟩ = + T.edge ⟨C.p - 1 + 2 * q.val + t.val, by omega⟩ := by + congr 1 + exact Fin.ext hjpos + _ = C.blockEdge q t := C.block_edge_position q t + have hedgeRep : R.replacementTree.edge j = T.edge ⟨j.val, by omega⟩ := by + exact R.retained_edges_before j.val hbefore (by omega) + have hcolorD : phiD (R.replacementTree.edge j) = some (C.gamma q) := by + rw [hedgeRep, originalEdgeFixed j.val (by omega) (by omega), hedgeOld] + exact C.block_color q t + have hcol : C.gamma q = c := + Option.some.inj (hcolorD.symm.trans hc) + have hneGamma : C.gamma q ≠ gamma := by + intro h + apply hqr + apply C.gamma_injective + simpa [gamma, r] using h + have hcGamma : c ≠ gamma := fun h => hneGamma (hcol.trans h) + exact Finset.mem_erase.mpr ⟨hcGamma, + Finset.mem_image.mpr ⟨q, Finset.mem_univ q, hcol⟩⟩ + · by_cases hafter : j.val + 2 < T.length + · apply Finset.mem_union_left + let n := j.val + 2 - (C.p - 1) + let q : Fin C.s := ⟨n / 2, by omega⟩ + let t : Fin 2 := ⟨n % 2, Nat.mod_lt _ (by omega)⟩ + have hjpos : j.val + 2 = C.p - 1 + 2 * q.val + t.val := by + dsimp [q, t, n] + have hdiv := Nat.mod_add_div (j.val + 2 - (C.p - 1)) 2 + omega + have hqr : q ≠ r := by + intro h + have hval := congrArg Fin.val h + dsimp [q, n] at hval + omega + have hedgeOld : T.edge ⟨j.val + 2, hafter⟩ = C.blockEdge q t := by + calc + T.edge ⟨j.val + 2, hafter⟩ = + T.edge ⟨C.p - 1 + 2 * q.val + t.val, by omega⟩ := by + congr 1 + exact Fin.ext hjpos + _ = C.blockEdge q t := C.block_edge_position q t + have hedgeRep : R.replacementTree.edge j = + T.edge ⟨j.val + 2, hafter⟩ := by + exact R.retained_edges_after j.val (by omega) hafter + have hcolorD : phiD (R.replacementTree.edge j) = some (C.gamma q) := by + rw [hedgeRep, originalEdgeFixed (j.val + 2) hafter (by omega), hedgeOld] + exact C.block_color q t + have hcol : C.gamma q = c := + Option.some.inj (hcolorD.symm.trans hc) + have hneGamma : C.gamma q ≠ gamma := by + intro h + apply hqr + apply C.gamma_injective + simpa [gamma, r] using h + have hcGamma : c ≠ gamma := fun h => hneGamma (hcol.trans h) + exact Finset.mem_erase.mpr ⟨hcGamma, + Finset.mem_image.mpr ⟨q, Finset.mem_univ q, hcol⟩⟩ + · apply Finset.mem_union_right + have hjlast : j.val = T.length - 2 ∨ j.val = T.length - 1 := by + omega + rcases hjlast with hjlast | hjlast + · have hedge : R.replacementTree.edge j = R.f1 := by + calc + R.replacementTree.edge j = + R.replacementTree.edge ⟨T.length - 2, by + rw [hreplacementLength] + omega⟩ := by + congr 1 + exact Fin.ext hjlast + _ = R.f1 := R.replacement_last_edges.1 + have hdc : d.1 = c := Option.some.inj ((hedge ▸ hf1D).symm.trans hc) + simp [hdc] + · have hedge : R.replacementTree.edge j = R.f2 := by + calc + R.replacementTree.edge j = + R.replacementTree.edge ⟨T.length - 1, by + rw [hreplacementLength] + omega⟩ := by + congr 1 + exact Fin.ext hjlast + _ = R.f2 := R.replacement_last_edges.2 + have hdc : d.1 = c := Option.some.inj ((hedge ▸ hf2D).symm.trans hc) + simp [hdc] + +private theorem helper_originalEdgeFixed_487.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let r : Fin C.s := D.gammaIndex d; + ∀ (hr : (↑r : ℕ) < C.s) (hp : (2 : ℕ) ≤ C.p) (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * + C.s) (hreplacementLength : R.replacementTree.length = T.length) (hXcard : X.card = C.p + + (2 : ℕ) * C.s), TashkinovTree G e0 phiD R.replacementTree → + let baseIndex : Fin (C.p - (2 : ℕ)) → Fin R.replacementTree.length := fun (q : Fin (C.p - (2 : + ℕ))) => (⟨(↑q : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin R.replacementTree.length); ( + ∀ (q : Fin (C.p - (2 : ℕ))), (1 : ℕ) ≤ (↑(baseIndex q) : ℕ)) → (↑d : Fin k) ∉ TreeUsedColors + phi T → (IsProperEdgeColoring G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) + (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ IsOneEdgeUncolored (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) e0 ∧ TwoColorComponentSwap G + phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) (D.f0 d) = some (C.gamma + (D.gammaIndex d)) ∧ MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (D.v0 d) = insert (↑d : Fin k) ((MissingColors G phi + (D.v0 d)).erase (C.gamma (D.gammaIndex d))) ∧ ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → ¬f = D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, ¬v = D.v0 d → MissingColors G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) ∧ + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) → + ∀ (q : ℕ) (hq : q < T.length), (1 : ℕ) ≤ q → phiD (T.edge (⟨q, hq⟩ : Fin T.length)) = phi + (T.edge (⟨q, hq⟩ : Fin T.length)) := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD X r hr hp hlength hreplacementLength hXcard + htreeD baseIndex hbaseIndexPos hdeltaUnusedOriginal heffect q hq hqpos + apply heffect.2.2.2.2.1 + · obtain ⟨i, hi⟩ := T.attaches ⟨q, hq⟩ + refine ⟨T.vertex ⟨q + 1, by omega⟩, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · change T.vertex ⟨q + 1, by omega⟩ ∈ G.ends (T.edge ⟨q, hq⟩) + rw [hi] + simp + · intro heq + apply hdeltaUnusedOriginal + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨⟨q, hq⟩, hqpos, by simpa [heq] using D.f0_color d⟩ + +private theorem helper_hused_518.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let r : Fin C.s := D.gammaIndex d; + ∀ (hr : (↑r : ℕ) < C.s), (1 : ℕ) ≤ C.s → + ∀ (hp : (2 : ℕ) ≤ C.p) (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) + (hreplacementLength : R.replacementTree.length = T.length) (hXcard : X.card = C.p + (2 : + ℕ) * C.s) (htreeD : TashkinovTree G e0 phiD R.replacementTree), + let baseIndex : Fin (C.p - (2 : ℕ)) → Fin R.replacementTree.length := fun (q : Fin (C.p - (2 : + ℕ))) => (⟨(↑q : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin R.replacementTree.length); + ∀ (hbaseIndexPos : + ∀ (q : Fin (C.p - (2 : ℕ))), (1 : ℕ) ≤ (↑(baseIndex q) : ℕ)), + let baseColor : Fin (C.p - (2 : ℕ)) → Fin k := fun (q : Fin (C.p - (2 : ℕ))) => + Classical.choose (Exists.choose_spec (htreeD (baseIndex q) (hbaseIndexPos q))); + let baseColors : Finset (Fin k) := Finset.image baseColor Finset.univ; + let allBlockColors : Finset (Fin k) := Finset.image C.gamma Finset.univ; + let retainedBlockColors : Finset (Fin k) := allBlockColors.erase gamma; baseColors.card ≤ C.p + - (2 : ℕ) → allBlockColors.card = C.s → retainedBlockColors.card = C.s - (1 : ℕ) → + TreeUsedColors phiD R.replacementTree ⊆ baseColors ∪ (retainedBlockColors ∪ + {(↑d : Fin k)}) → (TreeUsedColors phiD R.replacementTree).card ≤ C.p - (2 : ℕ) + C.s := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD X r hr hs hp hlength hreplacementLength + hXcard htreeD baseIndex hbaseIndexPos baseColor baseColors allBlockColors + retainedBlockColors hbaseCard hallBlockCard hretainedBlockCard husedSub + refine (Finset.card_le_card husedSub).trans ?_ + calc + (baseColors ∪ (retainedBlockColors ∪ {d.1})).card ≤ + baseColors.card + (retainedBlockColors ∪ {d.1}).card := + Finset.card_union_le _ _ + _ ≤ baseColors.card + (retainedBlockColors.card + ({d.1} : Finset (Fin k)).card) := + Nat.add_le_add_left (Finset.card_union_le _ _) _ + _ ≤ (C.p - 2) + ((C.s - 1) + 1) := by + rw [hretainedBlockCard] + simp only [Finset.card_singleton] + omega + _ = C.p - 2 + C.s := by omega + +private theorem helper_hdeltaUsed_546.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let r : Fin C.s := D.gammaIndex d; + ∀ (hr : (↑r : ℕ) < C.s), (1 : ℕ) ≤ C.s → + ∀ (hp : (2 : ℕ) ≤ C.p) (hlength : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) + (hreplacementLength : R.replacementTree.length = T.length) (hXcard : X.card = C.p + (2 : + ℕ) * C.s), TashkinovTree G e0 phiD R.replacementTree → + let baseIndex : Fin (C.p - (2 : ℕ)) → Fin R.replacementTree.length := fun (q : Fin (C.p - (2 : + ℕ))) => (⟨(↑q : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin R.replacementTree.length); ( + ∀ (q : Fin (C.p - (2 : ℕ))), (1 : ℕ) ≤ (↑(baseIndex q) : ℕ)) → + let allBlockColors : Finset (Fin k) := Finset.image C.gamma Finset.univ; allBlockColors.card = + C.s → phiD R.f2 = some (↑d : Fin k) → (↑d : Fin k) ∈ TreeUsedColors phiD R.replacementTree + := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD X r hr hs hp hlength hreplacementLength + hXcard htreeD baseIndex hbaseIndexPos allBlockColors hallBlockCard hf2D + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + let j : Fin R.replacementTree.length := ⟨T.length - 1, by + rw [hreplacementLength] + omega⟩ + refine ⟨j, by simp [j]; omega, ?_⟩ + have hedge : R.replacementTree.edge j = R.f2 := by + calc + R.replacementTree.edge j = + R.replacementTree.edge ⟨T.length - 1, by + rw [hreplacementLength] + omega⟩ := by + congr 1 + _ = R.f2 := R.replacement_last_edges.2 + simpa [hedge] using hf2D + +private theorem helper_continuation_495.{u_1, u_2} : + helperContinuation495Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R gamma phiD X Xd r u0 u1 U Z ends0 hr hs hp hlength + hreplacementLength hXcard hZcard hZsubXd hendsSubZ hendsSubXd hendsCard hendsInc hglobalD + hclosedD hcounts hdisj hnonempty + let firstColor : (v : V) → v ∈ Z → Fin k := fun v hv => + Classical.choose (hnonempty v hv) + have firstMem : ∀ (v : V) (hv : v ∈ Z), + firstColor v hv ∈ MissingColors G phiD v := by + intro v hv + exact Classical.choose_spec (hnonempty v hv) + have hsecond : ∀ (v : V) (hv : v ∈ ends0), + ((MissingColors G phiD v).erase (firstColor v (hendsSubZ hv))).Nonempty := by + intro v hv + apply Finset.card_pos.mp + rw [Finset.card_erase_of_mem (firstMem v (hendsSubZ hv))] + have hh := (hcounts v (hendsSubXd hv)).1 (hendsInc v hv) |>.2 + omega + let extraColor : (v : V) → v ∈ ends0 → Fin k := fun v hv => + Classical.choose (hsecond v hv) + have extraMem : ∀ (v : V) (hv : v ∈ ends0), + extraColor v hv ∈ + (MissingColors G phiD v).erase (firstColor v (hendsSubZ hv)) := by + intro v hv + exact Classical.choose_spec (hsecond v hv) + let M := Z.biUnion fun v => MissingColors G phiD v + have hmissing : Z.card + 2 ≤ M.card := by + exact @helper_hmissing_227 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R hZcard hendsSubZ hendsCard hdisj hnonempty firstMem hsecond extraMem + have hmissingBound : C.p + 2 * C.s ≤ M.card := by + omega + have htreeD : TashkinovTree G e0 phiD R.replacementTree := hglobalD.2.1 + let baseIndex : Fin (C.p - 2) → Fin R.replacementTree.length := + fun q => ⟨q.val + 1, by omega⟩ + have hbaseIndexPos : ∀ q : Fin (C.p - 2), 1 ≤ (baseIndex q).val := by + intro q + simp [baseIndex] + let baseColor : Fin (C.p - 2) → Fin k := fun q => + Classical.choose (htreeD (baseIndex q) (hbaseIndexPos q) |>.choose_spec) + have hbaseColorSpec : ∀ q : Fin (C.p - 2), + phiD (R.replacementTree.edge (baseIndex q)) = some (baseColor q) := by + intro q + exact (Classical.choose_spec + (htreeD (baseIndex q) (hbaseIndexPos q) |>.choose_spec)).1 + let baseColors := (Finset.univ : Finset (Fin (C.p - 2))).image baseColor + let allBlockColors := (Finset.univ : Finset (Fin C.s)).image C.gamma + let retainedBlockColors := allBlockColors.erase gamma + have hbaseCard : baseColors.card ≤ C.p - 2 := by + exact Finset.card_image_le.trans_eq (by simp) + have hallBlockCard : allBlockColors.card = C.s := by + dsimp [allBlockColors] + rw [Finset.card_image_iff.mpr (by + intro a ha b hb hab + exact C.gamma_injective hab)] + simp + have hgammaAll : gamma ∈ allBlockColors := by + apply Finset.mem_image.mpr + exact ⟨r, Finset.mem_univ r, by simp [gamma, r]⟩ + have hretainedBlockCard : retainedBlockColors.card = C.s - 1 := by + dsimp [retainedBlockColors] + rw [Finset.card_erase_of_mem hgammaAll, hallBlockCard] + have hglobal : GlobalMaximumTriple G k e0 phi T := C.globally_maximum + have hdeltaUnusedOriginal : d.1 ∉ TreeUsedColors phi T := by + have hu := (ScheideGlobalMaximumUnused G k e0 phi T hglobal).1 + exact fun hd => (Finset.disjoint_left.mp hu) d.2 hd + have heffect := ScheideDefectiveSwitchEffect G k e0 phi T C D d + dsimp [phiD, gamma] at heffect + have originalEdgeFixed : ∀ (q : ℕ) (hq : q < T.length), 1 ≤ q → + phiD (T.edge ⟨q, hq⟩) = phi (T.edge ⟨q, hq⟩) := by + exact @helper_originalEdgeFixed_487 V E inferInstance inferInstance inferInstance + inferInstance G k e0 phi T C D d R hr hp hlength hreplacementLength hXcard htreeD + hbaseIndexPos hdeltaUnusedOriginal heffect + have hf1D : phiD R.f1 = some d.1 := by + have hf := ScheideReplacementPairFixed G k e0 phi T C D d R R.f1 + (Or.inl (by + change R.u1 ∈ G.ends R.f1 + rw [R.f1_ends] + simp [])) + simpa [phiD, gamma] using hf.trans R.f1_color + have hf2D : phiD R.f2 = some d.1 := by + have hf := ScheideReplacementPairFixed G k e0 phi T C D d R R.f2 + (Or.inr (by + change R.u2 ∈ G.ends R.f2 + rw [R.f2_ends] + simp [])) + simpa [phiD, gamma] using hf.trans R.f2_color + have husedSub : TreeUsedColors phiD R.replacementTree ⊆ + baseColors ∪ (retainedBlockColors ∪ {d.1}) := by + exact @helper_husedSub_369 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R hr hs hp hlength hreplacementLength hXcard htreeD hbaseIndexPos + hbaseColorSpec hallBlockCard originalEdgeFixed hf1D hf2D + have hused : (TreeUsedColors phiD R.replacementTree).card ≤ C.p - 2 + C.s := by + exact @helper_hused_518 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D d R hr hs hp hlength hreplacementLength hXcard htreeD hbaseIndexPos hbaseCard + hallBlockCard hretainedBlockCard husedSub + have hstrict : (TreeUsedColors phiD R.replacementTree).card < M.card := by + omega + have hnsub : ¬ M ⊆ TreeUsedColors phiD R.replacementTree := by + intro hsub + have hcard := Finset.card_le_card hsub + omega + rw [Finset.not_subset] at hnsub + obtain ⟨beta, hbetaM, hbetaUnused⟩ := hnsub + obtain ⟨v, hvZ, hbetaMissing⟩ := Finset.mem_biUnion.mp hbetaM + have hvX : v ∈ X := (Finset.mem_sdiff.mp hvZ).1 + have hvXd : v ∈ Xd := hZsubXd hvZ + have hbetaTreeMissing : beta ∈ TreeMissingColors phiD R.replacementTree := by + exact Finset.mem_biUnion.mpr ⟨v, hvXd, hbetaMissing⟩ + have hbetaFree : beta ∈ TreeFreeColors phiD R.replacementTree := by + exact Finset.mem_sdiff.mpr ⟨hbetaTreeMissing, hbetaUnused⟩ + have hdeltaUsed : d.1 ∈ TreeUsedColors phiD R.replacementTree := by + exact @helper_hdeltaUsed_546 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R hr hs hp hlength hreplacementLength hXcard htreeD hbaseIndexPos + hallBlockCard hf2D + have hbetaDelta : beta ≠ d.1 := by + intro h + exact hbetaUnused (h ▸ hdeltaUsed) + have hboundary := + ScheideSymmetricReplacementBoundaryConfiguration G k e0 phi T C D d R + dsimp [gamma, phiD] at hboundary + have hgammaDef : gamma ∈ DefectiveColors G phiD Xd := by + simpa [gamma, phiD, Xd] using hboundary.1 + have hgammaCard : 2 ≤ (BoundaryColorEdges G phiD Xd gamma).card := by + change gamma ∈ Finset.univ.filter + (fun alpha => DefectiveColor G phiD Xd alpha) at hgammaDef + exact (Finset.mem_filter.mp hgammaDef).2 + obtain ⟨fgamma, hfgamma⟩ := Finset.card_pos.mp (by omega : + 0 < (BoundaryColorEdges G phiD Xd gamma).card) + have hfgammaBoundary : fgamma ∈ BoundaryEdges G Xd := + (Finset.mem_filter.mp hfgamma).1 + have hfgammaColor : phiD fgamma = some gamma := + (Finset.mem_filter.mp hfgamma).2 + have hgammaNotMissing : gamma ∉ MissingColors G phiD v := + hclosedD hfgammaBoundary hvXd hfgammaColor + have hbetaGamma : beta ≠ gamma := by + intro h + exact hgammaNotMissing (h ▸ hbetaMissing) + have hbetaOldMissing : beta ∈ MissingColors G phi v := by + by_cases hv0 : v = D.v0 d + · subst v + have hb := hbetaMissing + rw [heffect.2.2.2.1] at hb + simp only [Finset.mem_insert, Finset.mem_erase] at hb + rcases hb with hb | hb + · exact False.elim (hbetaDelta hb) + · exact hb.2 + · rw [heffect.2.2.2.2.2.1 v hvX hv0] at hbetaMissing + exact hbetaMissing + obtain ⟨z, path, hpath⟩ := ScheideDefectiveChainPathExists + G k e0 phiD R.replacementTree hglobalD gamma beta hgammaDef + hbetaFree v hvXd hbetaMissing + refine ⟨beta, v, z, path, ?_, hbetaMissing, hbetaOldMissing, + hbetaFree, hbetaDelta, hbetaGamma, hpath⟩ + simpa [Z, X, U, u0, u1, r] using hvZ + +theorem ScheideSymmetricReplacementFreePath {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + ∃ (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G phiD gamma beta).Walk (Sum.inl v) (Sum.inl z)), + v ∈ + TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, C.blockVertex (D.gammaIndex d) 1} ∧ + beta ∈ MissingColors G phiD v ∧ + beta ∈ MissingColors G phi v ∧ + beta ∈ TreeFreeColors phiD R.replacementTree ∧ + beta ≠ d.1 ∧ + beta ≠ gamma ∧ + ScheideDefectiveChainPath R.replacementTree phiD gamma beta v z p := by + classical + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let X := TreeSequenceVertexSet T + let Xd := TreeSequenceVertexSet R.replacementTree + let r := D.gammaIndex d + let u0 := C.blockVertex r 0 + let u1 := C.blockVertex r 1 + let U : Finset V := {u0, u1} + let Z := X \ U + let ends0 := (G.ends e0).toFinset + have hr : r.val < C.s := r.isLt + have hs : 1 <= C.s := by omega + have hp : 2 <= C.p := C.p_ge_two + have hlength : T.length + 1 = C.p + 2 * C.s := C.length_eq + have hreplacementLength : R.replacementTree.length = T.length := + R.replacement_length + let m := C.p + 2 * r.val + have hm0 : T.vertex ⟨m, by omega⟩ = u0 := by + simpa [m, u0, r] using C.block_vertex_position r (0 : Fin 2) + have hm1 : T.vertex ⟨m + 1, by omega⟩ = u1 := by + simpa [m, u1, r] using C.block_vertex_position r (1 : Fin 2) + have hu0X : u0 ∈ X := by + rw [← hm0] + simp [X, TreeSequenceVertexSet] + have hu1X : u1 ∈ X := by + rw [← hm1] + simp [X, TreeSequenceVertexSet] + have hu01 : u0 ≠ u1 := by + intro h + have hv : T.vertex ⟨m, by omega⟩ = T.vertex ⟨m + 1, by omega⟩ := + hm0.trans (h.trans hm1.symm) + have hi := T.vertex_injective hv + have hiv := congrArg Fin.val hi + simp at hiv + have hUsub : U ⊆ X := by + intro v hv + simp only [U, Finset.mem_insert, Finset.mem_singleton] at hv + rcases hv with rfl | rfl + · exact hu0X + · exact hu1X + have hUcard : U.card = 2 := by + simp [U, hu01] + have hXcard : X.card = C.p + 2 * C.s := by + have himage : X.card = T.length + 1 := by + simp [X, TreeSequenceVertexSet, Finset.card_image_of_injective, + T.vertex_injective] + omega + have hZcard : Z.card = C.p + 2 * C.s - 2 := by + dsimp [Z] + rw [Finset.card_sdiff_of_subset hUsub, hXcard, hUcard] + have hZsubXd : Z ⊆ Xd := by + intro v hv + have hv' : v ∈ X \ U := by simpa [Z, X, U] using hv + change v ∈ TreeSequenceVertexSet R.replacementTree + rw [R.replacement_vertices] + exact Finset.mem_union_left _ hv' + have hendsSubX : ends0 ⊆ X := by + intro v hv + have hv' : v ∈ G.ends e0 := Sym2.mem_toFinset.mp hv + rw [← T.first_edge] at hv' + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + rw [hi, Sym2.mem_iff] at hv' + rcases hv' with hv | hv <;> subst v <;> + simp [X, TreeSequenceVertexSet] + have hendsAvoidU : ∀ v ∈ ends0, v ∉ U := by + exact @helper_hendsAvoidU_129 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R hr hp hlength hreplacementLength hm0 hm1 hXcard + have hendsSubZ : ends0 ⊆ Z := by + intro v hv + exact Finset.mem_sdiff.mpr ⟨hendsSubX hv, hendsAvoidU v hv⟩ + have hendsSubXd : ends0 ⊆ Xd := fun _ hv => hZsubXd (hendsSubZ hv) + have hendsCard : ends0.card = 2 := by + have hn : ¬ (G.ends e0).IsDiag := by + intro hd + induction he : G.ends e0 using Sym2.inductionOn with + | _ a b => + rw [he] at hd + rw [Sym2.mk_isDiag_iff] at hd + apply G.loopless e0 a + rw [he, hd] + exact Sym2.card_toFinset_of_not_isDiag _ hn + have hendsInc : ∀ v ∈ ends0, Incident G v e0 := by + intro v hv + exact Sym2.mem_toFinset.mp hv + have hmaximum := ScheideReplacementMaximum G k e0 phi T C D d R + dsimp [phiD, gamma] at hmaximum + have hglobalD : GlobalMaximumTriple G k e0 phiD R.replacementTree := + hmaximum.2.2 + have horderD := ScheideGlobalMaximumOrder G k e0 phiD R.replacementTree hglobalD + have helemD : ColoredVertexSetElementary G phiD Xd := horderD.2.2.2.1 + have hclosedD : ColoredVertexSetClosed G phiD Xd := horderD.2.2.2.2 + have hcounts := ScheideGlobalMaximumMissingCounts + G k e0 phiD R.replacementTree hglobalD + have hdisj : (Z : Set V).PairwiseDisjoint (fun v => MissingColors G phiD v) := by + intro a ha b hb hab + exact helemD (hZsubXd ha) (hZsubXd hb) hab + have hnonempty : ∀ v ∈ Z, (MissingColors G phiD v).Nonempty := by + intro v hv + apply Finset.card_pos.mp + by_cases hi : Incident G v e0 + · have hh := (hcounts v (hZsubXd hv)).1 hi |>.2 + omega + · have hh := (hcounts v (hZsubXd hv)).2 hi |>.2 + omega + exact @helper_continuation_495 V E inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D d R hr hs hp hlength hreplacementLength hXcard hZcard hZsubXd hendsSubZ + hendsSubXd hendsCard hendsInc hglobalD hclosedD hcounts hdisj hnonempty +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementPathOrder.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementPathOrder.lean new file mode 100644 index 0000000000..d88fe42fd3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementPathOrder.lean @@ -0,0 +1,1508 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ScheideExitNoFree +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges +public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect +public import LeanPool.GoldbergSeymour.ScheideExitVertex +public import LeanPool.GoldbergSeymour.ScheideExitVertices +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused +public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum +public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed +public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryConfiguration +public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementFreePath +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Symmetric Replacement Path Order + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation264Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : (TwoColorIncidenceGraph G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), v ∈ TreeSequenceVertexSet + T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V) → beta ∈ + MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) v → beta ≠ C.gamma (D.gammaIndex d) → ScheideDefectiveChainPath + R.replacementTree (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta v z p → + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let Xd : Finset V := TreeSequenceVertexSet R.replacementTree; + let Z : Finset V := X \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; Z ⊆ Xd → v ∈ Xd → + IsProperEdgeColoring G phiD → GlobalMaximumTriple G k e0 phiD R.replacementTree → + ColoredVertexSetElementary G phiD Xd → ColoredVertexSetClosed G phiD Xd → C.gamma + (D.gammaIndex d) ∈ DefectiveColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (TreeSequenceVertexSet R.replacementTree) → + TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) + (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = some (C.gamma (D.gammaIndex d)) → + TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) + (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = some (C.gamma (D.gammaIndex d)) → ( + ∀ (f : E), (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)) f = some (C.gamma (D.gammaIndex d)) ∧ + ∃ v ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V), + ∃ w ∉ TreeSequenceVertexSet R.replacementTree, G.ends f = s(v, w)) ↔ f = D.f0 d ∨ f = + C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) ∨ f = C.blockEdge (D.gammaIndex d) (1 : Fin + (2 : ℕ))) → TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = some (C.gamma (D.gammaIndex + d)) → Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∈ p.support → Sum.inr + (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∈ p.support → + ∀ (h : E), G.ends h = s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → (IsProperEdgeColoring G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ IsOneEdgeUncolored + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + e0 ∧ TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)) (D.f0 d) = some (C.gamma (D.gammaIndex d)) ∧ MissingColors G (TwoColorComponentSwap G + phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (D.v0 d) = (insert (↑d : + Fin k) ((MissingColors G phi (D.v0 d)).erase (C.gamma (D.gammaIndex d))) : Finset (Fin k)) + ∧ ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → ¬f = D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, ¬v = D.v0 d → MissingColors G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) ∧ + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) → phiD h = some beta → + ∀ (a0 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = s(C.y a0, + C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + ∀ (a1 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = s(C.y a1, + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → H.Adj (Sum.inr (C.blockEdge + (D.gammaIndex d) (0 : Fin (2 : ℕ)))) (Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 + : ℕ)))) → H.Adj (Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)))) (Sum.inr h) → + H.Adj (Sum.inr h) (Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)))) → H.Adj + (Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ)))) (Sum.inr (C.blockEdge + (D.gammaIndex d) (1 : Fin (2 : ℕ)))) → Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 + : ℕ))) ∈ p.support → Sum.inr h ∈ p.support → Sum.inl (C.blockVertex (D.gammaIndex d) (1 : + Fin (2 : ℕ))) ∈ p.support → p.IsPath → (0 : ℕ) < p.length → ( + ∀ (x : V ⊕ E), H.Adj (Sum.inl v) x → x = p.getVert (1 : ℕ)) → + ∃ (h : E) (i0 : Fin (p.length + (1 : ℕ))) (i1 : Fin (p.length + (1 : ℕ))) (i2 : Fin (p.length + + (1 : ℕ))) (i3 : Fin (p.length + (1 : ℕ))) (i4 : Fin (p.length + (1 : ℕ))) (qv : Fin + (p.length + (1 : ℕ))) (qf : Fin (p.length + (1 : ℕ))), TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) h = some beta ∧ G.ends h = + s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) (1 : + Fin (2 : ℕ))) ∧ (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) ∧ (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) ∧ (↑i3 : + ℕ) = (↑i2 : ℕ) + (1 : ℕ) ∧ (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) ∧ (p.getVert (↑i0 : ℕ) = + Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) = Sum.inl + (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ + p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∨ p.getVert + (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) + = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = + Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)))) ∧ + (↑i4 : ℕ) < (↑qv : ℕ) ∧ (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) ∧ p.getVert (↑qv : ℕ) = Sum.inl + (D.v0 d) ∧ p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) ∧ ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet R.replacementTree) ∧ + R.u1 ∉ ScheideExitVertices R.replacementTree (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ R.u2 ∉ ScheideExitVertices + R.replacementTree (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) + +private abbrev helperContinuation462Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : (TwoColorIncidenceGraph G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), v ∈ TreeSequenceVertexSet + T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V) → beta ∈ + MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) v → ScheideDefectiveChainPath R.replacementTree (TwoColorComponentSwap + G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex + d)) beta v z p → + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let Xd : Finset V := TreeSequenceVertexSet R.replacementTree; + let Z : Finset V := X \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; Z ⊆ Xd → v ∈ Xd → + GlobalMaximumTriple G k e0 phiD R.replacementTree → ColoredVertexSetElementary G phiD Xd → + ColoredVertexSetClosed G phiD Xd → C.gamma (D.gammaIndex d) ∈ DefectiveColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (TreeSequenceVertexSet R.replacementTree) → ( + ∀ (f : E), (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)) f = some (C.gamma (D.gammaIndex d)) ∧ + ∃ v ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V), + ∃ w ∉ TreeSequenceVertexSet R.replacementTree, G.ends f = s(v, w)) ↔ f = D.f0 d ∨ f = + C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) ∨ f = C.blockEdge (D.gammaIndex d) (1 : Fin + (2 : ℕ))) → TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = some (C.gamma (D.gammaIndex + d)) → + ∀ (h : E), G.ends h = s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → (IsProperEdgeColoring G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ IsOneEdgeUncolored + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + e0 ∧ TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)) (D.f0 d) = some (C.gamma (D.gammaIndex d)) ∧ MissingColors G (TwoColorComponentSwap G + phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (D.v0 d) = (insert (↑d : + Fin k) ((MissingColors G phi (D.v0 d)).erase (C.gamma (D.gammaIndex d))) : Finset (Fin k)) + ∧ ( + ∀ (f : E), ( + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f) → ¬f = D.f0 d → TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) f = phi f) ∧ ( + ∀ v ∈ TreeSequenceVertexSet T, ¬v = D.v0 d → MissingColors G (TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) ∧ + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) → MissingColors G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex + d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v = MissingColors G phi v) → phiD h = some beta → + ∀ (a0 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = s(C.y a0, + C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + ∀ (a1 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = s(C.y a1, + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → p.IsPath → (0 : ℕ) < p.length → + ∀ (j0 : ℕ), p.getVert j0 = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → j0 ≤ + p.length → + ∀ (j1 : ℕ), p.getVert j1 = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + ∀ (j2 : ℕ), p.getVert j2 = Sum.inr h → + ∀ (j3 : ℕ), p.getVert j3 = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + ∀ (j4 : ℕ), p.getVert j4 = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) → j4 ≤ + p.length → j1 = j0 + (1 : ℕ) ∧ j2 = j1 + (1 : ℕ) ∧ j3 = j2 + (1 : ℕ) ∧ j4 = j3 + (1 : ℕ) ∨ + j3 = j4 + (1 : ℕ) ∧ j2 = j3 + (1 : ℕ) ∧ j1 = j2 + (1 : ℕ) ∧ j0 = j1 + (1 : ℕ) → ( + ∀ (q : Fin C.p), C.y q ∈ TreeSequenceVertexSet T) → (2 : ℕ) ≤ C.p → T.length + (1 : ℕ) = C.p + + (2 : ℕ) * C.s → R.replacementTree.length = T.length → (↑(D.gammaIndex d) : ℕ) < C.s → ( + ∀ (q : Fin C.p), C.y q ∈ Z) → + ∃ (h : E) (i0 : Fin (p.length + (1 : ℕ))) (i1 : Fin (p.length + (1 : ℕ))) (i2 : Fin (p.length + + (1 : ℕ))) (i3 : Fin (p.length + (1 : ℕ))) (i4 : Fin (p.length + (1 : ℕ))) (qv : Fin + (p.length + (1 : ℕ))) (qf : Fin (p.length + (1 : ℕ))), TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) h = some beta ∧ G.ends h = + s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) (1 : + Fin (2 : ℕ))) ∧ (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) ∧ (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) ∧ (↑i3 : + ℕ) = (↑i2 : ℕ) + (1 : ℕ) ∧ (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) ∧ (p.getVert (↑i0 : ℕ) = + Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) = Sum.inl + (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ + p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∨ p.getVert + (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) + = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = + Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)))) ∧ + (↑i4 : ℕ) < (↑qv : ℕ) ∧ (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) ∧ p.getVert (↑qv : ℕ) = Sum.inl + (D.v0 d) ∧ p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) ∧ ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet R.replacementTree) ∧ + R.u1 ∉ ScheideExitVertices R.replacementTree (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ R.u2 ∉ ScheideExitVertices + R.replacementTree (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) + +private abbrev helperContinuation790Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (R : ScheideReplacementData + G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : (TwoColorIncidenceGraph G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), beta ∈ MissingColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) v + → ScheideDefectiveChainPath R.replacementTree (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta v z p → + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let Xd : Finset V := TreeSequenceVertexSet R.replacementTree; + let Z : Finset V := X \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; Z ⊆ Xd → v ∈ Xd → + GlobalMaximumTriple G k e0 phiD R.replacementTree → ColoredVertexSetElementary G phiD Xd → + ColoredVertexSetClosed G phiD Xd → C.gamma (D.gammaIndex d) ∈ DefectiveColors G + (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) + (TreeSequenceVertexSet R.replacementTree) → ( + ∀ (f : E), (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)) f = some (C.gamma (D.gammaIndex d)) ∧ + ∃ v ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V), + ∃ w ∉ TreeSequenceVertexSet R.replacementTree, G.ends f = s(v, w)) ↔ f = D.f0 d ∨ f = + C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) ∨ f = C.blockEdge (D.gammaIndex d) (1 : Fin + (2 : ℕ))) → TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl + (D.v0 d)) (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = some (C.gamma (D.gammaIndex + d)) → + ∀ (h : E), G.ends h = s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → phiD h = some beta → + ∀ (a0 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = s(C.y a0, + C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + ∀ (a1 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = s(C.y a1, + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → p.IsPath → (0 : ℕ) < p.length → + ∀ (j0 : ℕ), p.getVert j0 = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → j0 ≤ + p.length → + ∀ (j1 : ℕ), p.getVert j1 = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + ∀ (j2 : ℕ), p.getVert j2 = Sum.inr h → + ∀ (j3 : ℕ), p.getVert j3 = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + ∀ (j4 : ℕ), p.getVert j4 = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) → j4 ≤ + p.length → j1 = j0 + (1 : ℕ) ∧ j2 = j1 + (1 : ℕ) ∧ j3 = j2 + (1 : ℕ) ∧ j4 = j3 + (1 : ℕ) ∨ + j3 = j4 + (1 : ℕ) ∧ j2 = j3 + (1 : ℕ) ∧ j1 = j2 + (1 : ℕ) ∧ j0 = j1 + (1 : ℕ) → ( + ∀ (q : Fin C.p), C.y q ∈ Z) → ( + ∀ c ∈ TreeUsedColors phiD R.replacementTree, + ∃ y ∈ Z, c ∈ MissingColors G phiD y) → + ∃ (h : E) (i0 : Fin (p.length + (1 : ℕ))) (i1 : Fin (p.length + (1 : ℕ))) (i2 : Fin (p.length + + (1 : ℕ))) (i3 : Fin (p.length + (1 : ℕ))) (i4 : Fin (p.length + (1 : ℕ))) (qv : Fin + (p.length + (1 : ℕ))) (qf : Fin (p.length + (1 : ℕ))), TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) h = some beta ∧ G.ends h = + s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) (1 : + Fin (2 : ℕ))) ∧ (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) ∧ (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) ∧ (↑i3 : + ℕ) = (↑i2 : ℕ) + (1 : ℕ) ∧ (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) ∧ (p.getVert (↑i0 : ℕ) = + Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) = Sum.inl + (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ + p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∨ p.getVert + (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) + = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = + Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)))) ∧ + (↑i4 : ℕ) < (↑qv : ℕ) ∧ (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) ∧ p.getVert (↑qv : ℕ) = Sum.inl + (D.v0 d) ∧ p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) ∧ ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet R.replacementTree) ∧ + R.u1 ∉ ScheideExitVertices R.replacementTree (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ R.u2 ∉ ScheideExitVertices + R.replacementTree (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) + +private abbrev helperBranch1139Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let Xd : Finset V := TreeSequenceVertexSet R.replacementTree; + let Z : Finset V := X \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; Z ⊆ Xd → + ∀ (h : E), G.ends h = s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → phiD h = some beta → + ∀ (a1 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = s(C.y a1, + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → p.IsPath → + ∀ (j0 : ℕ), p.getVert j0 = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → j0 ≤ + p.length → + ∀ (j1 : ℕ), p.getVert j1 = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + ∀ (j2 : ℕ), p.getVert j2 = Sum.inr h → + ∀ (j3 : ℕ), p.getVert j3 = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + ∀ (j4 : ℕ), p.getVert j4 = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) → j4 ≤ + p.length → ( + ∀ (q : Fin C.p), C.y q ∈ Z) → R.u1 ∉ ScheideExitVertices R.replacementTree phiD → R.u2 ∉ + ScheideExitVertices R.replacementTree phiD → + let insideIndices : Finset (Fin (p.length + (1 : ℕ))) := ({q : Fin (p.length + (1 : ℕ)) | + ∃ w ∈ Xd, p.getVert (↑q : ℕ) = Sum.inl w} : Finset (Fin (p.length + (1 : ℕ)))); + ∀ (insideNonempty : insideIndices.Nonempty), + let qv : Fin (p.length + (1 : ℕ)) := insideIndices.max' insideNonempty; + ∀ w ∈ Xd, p.getVert (↑qv : ℕ) = Sum.inl w → ( + ∀ (q : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑q : ℕ) → + ∀ (a : V), p.getVert (↑q : ℕ) = Sum.inl a → a ∉ Xd) → + ∀ (hqvlt : (↑qv : ℕ) < p.length), + let qf : Fin (p.length + (1 : ℕ)) := (⟨(↑qv : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (p.length + (1 : ℕ))); (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → + ∀ (f : E), p.getVert (↑qf : ℕ) = Sum.inr f → Incident G w f → (↑qf : ℕ) < p.length → f = D.f0 + d ∨ f = C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) ∨ f = C.blockEdge (D.gammaIndex d) + (1 : Fin (2 : ℕ)) → TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d)) (D.f0 d) = some (C.gamma (D.gammaIndex d)) → D.u0 d ∉ Xd → j1 = j0 + (1 + : ℕ) ∧ j2 = j1 + (1 : ℕ) ∧ j3 = j2 + (1 : ℕ) ∧ j4 = j3 + (1 : ℕ) → + ∃ (h : E) (i0 : Fin (p.length + (1 : ℕ))) (i1 : Fin (p.length + (1 : ℕ))) (i2 : Fin (p.length + + (1 : ℕ))) (i3 : Fin (p.length + (1 : ℕ))) (i4 : Fin (p.length + (1 : ℕ))) (qv : Fin + (p.length + (1 : ℕ))) (qf : Fin (p.length + (1 : ℕ))), TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) h = some beta ∧ G.ends h = + s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) (1 : + Fin (2 : ℕ))) ∧ (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) ∧ (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) ∧ (↑i3 : + ℕ) = (↑i2 : ℕ) + (1 : ℕ) ∧ (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) ∧ (p.getVert (↑i0 : ℕ) = + Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) = Sum.inl + (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ + p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∨ p.getVert + (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) + = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = + Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)))) ∧ + (↑i4 : ℕ) < (↑qv : ℕ) ∧ (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) ∧ p.getVert (↑qv : ℕ) = Sum.inl + (D.v0 d) ∧ p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) ∧ ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet R.replacementTree) ∧ + R.u1 ∉ ScheideExitVertices R.replacementTree (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ R.u2 ∉ ScheideExitVertices + R.replacementTree (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) + +private abbrev helperBranch1227Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let Xd : Finset V := TreeSequenceVertexSet R.replacementTree; + let Z : Finset V := X \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; Z ⊆ Xd → + ∀ (h : E), G.ends h = s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → phiD h = some beta → + ∀ (a0 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = s(C.y a0, + C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → p.IsPath → + ∀ (j0 : ℕ), p.getVert j0 = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → j0 ≤ + p.length → + ∀ (j1 : ℕ), p.getVert j1 = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + ∀ (j2 : ℕ), p.getVert j2 = Sum.inr h → + ∀ (j3 : ℕ), p.getVert j3 = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + ∀ (j4 : ℕ), p.getVert j4 = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) → j4 ≤ + p.length → ( + ∀ (q : Fin C.p), C.y q ∈ Z) → R.u1 ∉ ScheideExitVertices R.replacementTree phiD → R.u2 ∉ + ScheideExitVertices R.replacementTree phiD → + let insideIndices : Finset (Fin (p.length + (1 : ℕ))) := ({q : Fin (p.length + (1 : ℕ)) | + ∃ w ∈ Xd, p.getVert (↑q : ℕ) = Sum.inl w} : Finset (Fin (p.length + (1 : ℕ)))); + ∀ (insideNonempty : insideIndices.Nonempty), + let qv : Fin (p.length + (1 : ℕ)) := insideIndices.max' insideNonempty; + ∀ w ∈ Xd, p.getVert (↑qv : ℕ) = Sum.inl w → ( + ∀ (q : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑q : ℕ) → + ∀ (a : V), p.getVert (↑q : ℕ) = Sum.inl a → a ∉ Xd) → + ∀ (hqvlt : (↑qv : ℕ) < p.length), + let qf : Fin (p.length + (1 : ℕ)) := (⟨(↑qv : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (p.length + (1 : ℕ))); (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → + ∀ (f : E), p.getVert (↑qf : ℕ) = Sum.inr f → Incident G w f → (↑qf : ℕ) < p.length → f = D.f0 + d ∨ f = C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) ∨ f = C.blockEdge (D.gammaIndex d) + (1 : Fin (2 : ℕ)) → D.u0 d ∉ Xd → j3 = j4 + (1 : ℕ) ∧ j2 = j3 + (1 : ℕ) ∧ j1 = j2 + (1 : + ℕ) ∧ j0 = j1 + (1 : ℕ) → + ∃ (h : E) (i0 : Fin (p.length + (1 : ℕ))) (i1 : Fin (p.length + (1 : ℕ))) (i2 : Fin (p.length + + (1 : ℕ))) (i3 : Fin (p.length + (1 : ℕ))) (i4 : Fin (p.length + (1 : ℕ))) (qv : Fin + (p.length + (1 : ℕ))) (qf : Fin (p.length + (1 : ℕ))), TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) h = some beta ∧ G.ends h = + s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) (1 : + Fin (2 : ℕ))) ∧ (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) ∧ (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) ∧ (↑i3 : + ℕ) = (↑i2 : ℕ) + (1 : ℕ) ∧ (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) ∧ (p.getVert (↑i0 : ℕ) = + Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) = Sum.inl + (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ + p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∨ p.getVert + (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) + = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = + Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)))) ∧ + (↑i4 : ℕ) < (↑qv : ℕ) ∧ (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) ∧ p.getVert (↑qv : ℕ) = Sum.inl + (D.v0 d) ∧ p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) ∧ ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet R.replacementTree) ∧ + R.u1 ∉ ScheideExitVertices R.replacementTree (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ R.u2 ∉ ScheideExitVertices + R.replacementTree (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) + +private abbrev helperContinuation981Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : + ScheideDefectiveSetup G k e0 phi T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet + T))) (R : ScheideReplacementData G k e0 phi T C D d) (beta : Fin k) (v z : V) (p : + (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let X : Finset V := TreeSequenceVertexSet T; + let Xd : Finset V := TreeSequenceVertexSet R.replacementTree; + let Z : Finset V := X \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; Z ⊆ Xd → ( + ∀ (f : E), (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 + d)) f = some (C.gamma (D.gammaIndex d)) ∧ + ∃ v ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) + ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V), + ∃ w ∉ TreeSequenceVertexSet R.replacementTree, G.ends f = s(v, w)) ↔ f = D.f0 d ∨ f = + C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)) ∨ f = C.blockEdge (D.gammaIndex d) (1 : Fin + (2 : ℕ))) → + ∀ (h : E), G.ends h = s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex + (D.gammaIndex d) (1 : Fin (2 : ℕ))) → phiD h = some beta → + ∀ (a0 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) = s(C.y a0, + C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + ∀ (a1 : Fin C.p), G.ends (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) = s(C.y a1, + C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → p.IsPath → + ∀ (j0 : ℕ), p.getVert j0 = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) → j0 ≤ + p.length → + ∀ (j1 : ℕ), p.getVert j1 = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) → + ∀ (j2 : ℕ), p.getVert j2 = Sum.inr h → + ∀ (j3 : ℕ), p.getVert j3 = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) → + ∀ (j4 : ℕ), p.getVert j4 = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) → j4 ≤ + p.length → j1 = j0 + (1 : ℕ) ∧ j2 = j1 + (1 : ℕ) ∧ j3 = j2 + (1 : ℕ) ∧ j4 = j3 + (1 : ℕ) ∨ + j3 = j4 + (1 : ℕ) ∧ j2 = j3 + (1 : ℕ) ∧ j1 = j2 + (1 : ℕ) ∧ j0 = j1 + (1 : ℕ) → ( + ∀ (q : Fin C.p), C.y q ∈ Z) → R.u1 ∉ ScheideExitVertices R.replacementTree phiD → R.u2 ∉ + ScheideExitVertices R.replacementTree phiD → + let insideIndices : Finset (Fin (p.length + (1 : ℕ))) := ({q : Fin (p.length + (1 : ℕ)) | + ∃ w ∈ Xd, p.getVert (↑q : ℕ) = Sum.inl w} : Finset (Fin (p.length + (1 : ℕ)))); + ∀ (insideNonempty : insideIndices.Nonempty), + let qv : Fin (p.length + (1 : ℕ)) := insideIndices.max' insideNonempty; + ∀ w ∈ Xd, p.getVert (↑qv : ℕ) = Sum.inl w → ( + ∀ (q : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑q : ℕ) → + ∀ (a : V), p.getVert (↑q : ℕ) = Sum.inl a → a ∉ Xd) → + ∀ (hqvlt : (↑qv : ℕ) < p.length), + let qf : Fin (p.length + (1 : ℕ)) := (⟨(↑qv : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (p.length + (1 : ℕ))); (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) → + ∀ (f : E), p.getVert (↑qf : ℕ) = Sum.inr f → Incident G w f → (↑qf : ℕ) < p.length → + ∀ x ∉ Xd, G.ends f = s(w, x) → phiD f = some gamma → w ∈ Z → + ∃ (h : E) (i0 : Fin (p.length + (1 : ℕ))) (i1 : Fin (p.length + (1 : ℕ))) (i2 : Fin (p.length + + (1 : ℕ))) (i3 : Fin (p.length + (1 : ℕ))) (i4 : Fin (p.length + (1 : ℕ))) (qv : Fin + (p.length + (1 : ℕ))) (qf : Fin (p.length + (1 : ℕ))), TwoColorComponentSwap G phi + (C.gamma (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d)) h = some beta ∧ G.ends h = + s(C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ)), C.blockVertex (D.gammaIndex d) (1 : + Fin (2 : ℕ))) ∧ (↑i1 : ℕ) = (↑i0 : ℕ) + (1 : ℕ) ∧ (↑i2 : ℕ) = (↑i1 : ℕ) + (1 : ℕ) ∧ (↑i3 : + ℕ) = (↑i2 : ℕ) + (1 : ℕ) ∧ (↑i4 : ℕ) = (↑i3 : ℕ) + (1 : ℕ) ∧ (p.getVert (↑i0 : ℕ) = + Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) = Sum.inl + (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = Sum.inr h ∧ + p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ + p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∨ p.getVert + (↑i0 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i1 : ℕ) + = Sum.inl (C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))) ∧ p.getVert (↑i2 : ℕ) = + Sum.inr h ∧ p.getVert (↑i3 : ℕ) = Sum.inl (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : + ℕ))) ∧ p.getVert (↑i4 : ℕ) = Sum.inr (C.blockEdge (D.gammaIndex d) (0 : Fin (2 : ℕ)))) ∧ + (↑i4 : ℕ) < (↑qv : ℕ) ∧ (↑qf : ℕ) = (↑qv : ℕ) + (1 : ℕ) ∧ p.getVert (↑qv : ℕ) = Sum.inl + (D.v0 d) ∧ p.getVert (↑qf : ℕ) = Sum.inr (D.f0 d) ∧ ( + ∀ (r : Fin (p.length + (1 : ℕ))), (↑qv : ℕ) < (↑r : ℕ) → + ∀ (w : V), p.getVert (↑r : ℕ) = Sum.inl w → w ∉ TreeSequenceVertexSet R.replacementTree) ∧ + R.u1 ∉ ScheideExitVertices R.replacementTree (TwoColorComponentSwap G phi (C.gamma + (D.gammaIndex d)) (↑d : Fin k) (Sum.inl (D.v0 d))) ∧ R.u2 ∉ ScheideExitVertices + R.replacementTree (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : Fin k) + (Sum.inl (D.v0 d))) + +private theorem helper_branch_1139.{u_1, u_2} : + helperBranch1139Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p gamma phiD X Xd Z H hZsubXd h hhends hhColor + a1 ha1ends hpath j0 hj0 hj0le j1 hj1 j2 hj2 j3 hj3 j4 hj4 hj4le hbaseZ hu1NotExit + hu2NotExit insideIndices insideNonempty qv w hwXd hqvw hafter hqvlt qf hqfval f hqff hwf + hqflt hfThree _ hu0out horient + rcases horient with ⟨hj01, hj12, hj23, hj34⟩ + let i0 : Fin (p.length + 1) := ⟨j0, by omega⟩ + let i1 : Fin (p.length + 1) := ⟨j1, by omega⟩ + let i2 : Fin (p.length + 1) := ⟨j2, by omega⟩ + let i3 : Fin (p.length + 1) := ⟨j3, by omega⟩ + let i4 : Fin (p.length + 1) := ⟨j4, by omega⟩ + have hi4lt : i4.val < p.length := by + by_contra hn + have heq : i4.val = p.length := by omega + have hh := hj4 + rw [← show i4.val = j4 by rfl, heq, p.getVert_length] at hh + simp at hh + let ir : Fin (p.length + 1) := ⟨i4.val + 1, by omega⟩ + have hretAdj := p.adj_getVert_succ (i := i4.val) hi4lt + have hret : p.getVert ir.val = Sum.inl (C.y a1) := by + have hprev : p.getVert (i4.val - 1) = + Sum.inl (C.blockVertex (D.gammaIndex d) 1) := by + have heq : i4.val - 1 = j3 := by simp [i4]; omega + simpa [heq] using hj3 + cases hcase : p.getVert ir.val with + | inr e => + rw [show p.getVert i4.val = Sum.inr (C.blockEdge (D.gammaIndex d) 1) by + simpa [i4] using hj4, hcase] at hretAdj + simp [TwoColorIncidenceGraph] at hretAdj + | inl y => + have hinc : Incident G y (C.blockEdge (D.gammaIndex d) 1) := by + rw [show p.getVert i4.val = Sum.inr (C.blockEdge (D.gammaIndex d) 1) by + simpa [i4] using hj4, hcase] at hretAdj + have hadjData : Incident G y (C.blockEdge (D.gammaIndex d) 1) ∧ + (phiD (C.blockEdge (D.gammaIndex d) 1) = some gamma ∨ + phiD (C.blockEdge (D.gammaIndex d) 1) = some beta) := by + simpa [H, ir, TwoColorIncidenceGraph] using hretAdj + exact hadjData.1 + have hy : y = C.y a1 ∨ y = C.blockVertex (D.gammaIndex d) 1 := by + simpa [Incident, ha1ends] using hinc + rcases hy with rfl | rfl + · simp + · exfalso + have hinj := hpath.getVert_injOn (by omega : i4.val - 1 ≤ p.length) + (by omega : ir.val ≤ p.length) (hprev.trans hcase.symm) + have hne : i4.val - 1 ≠ ir.val := by simp [ir] + exact hne hinj + have hirMem : ir ∈ insideIndices := by + simp only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨C.y a1, hZsubXd (hbaseZ a1), hret⟩ + have hirle := Finset.le_max' insideIndices ir hirMem + have hi4qv : i4.val < qv.val := by + change ir.val ≤ qv.val at hirle + simp [ir] at hirle + omega + have hfn0 : f ≠ C.blockEdge (D.gammaIndex d) 0 := by + intro heq + have hverts : p.getVert qf.val = p.getVert i0.val := by + rw [hqff, heq] + simpa [i0] using hj0.symm + have hind := hpath.getVert_injOn (by omega : qf.val ≤ p.length) + (by omega : i0.val ≤ p.length) hverts + simp [qf, i0, i4] at hind hi4qv + omega + have hfn1 : f ≠ C.blockEdge (D.gammaIndex d) 1 := by + intro heq + have hverts : p.getVert qf.val = p.getVert i4.val := by + rw [hqff, heq] + simpa [i4] using hj4.symm + have hind := hpath.getVert_injOn (by omega : qf.val ≤ p.length) + (by omega : i4.val ≤ p.length) hverts + simp [qf] at hind + omega + have hf0 : f = D.f0 d := hfThree.resolve_right (by + rintro (heq | heq) + · exact hfn0 heq + · exact hfn1 heq) + have hwv0 : w = D.v0 d := by + have hwinc : Incident G w (D.f0 d) := hf0 ▸ hwf + have hwcase : w = D.v0 d ∨ w = D.u0 d := by + simpa [Incident, D.f0_ends] using hwinc + exact hwcase.resolve_right (fun heq => hu0out (heq ▸ hwXd)) + refine ⟨h, i0, i1, i2, i3, i4, qv, qf, hhColor, hhends, + by simpa [i0, i1] using hj01, by simpa [i1, i2] using hj12, + by simpa [i2, i3] using hj23, by simpa [i3, i4] using hj34, + ?_, hi4qv, hqfval, ?_, ?_, ?_, hu1NotExit, hu2NotExit⟩ + · left + exact ⟨by simpa [i0] using hj0, by simpa [i1] using hj1, + by simpa [i2] using hj2, by simpa [i3] using hj3, + by simpa [i4] using hj4⟩ + · simpa [hwv0] using hqvw + · simpa [hf0] using hqff + · simpa [Xd] using hafter + +private theorem helper_branch_1227.{u_1, u_2} : + helperBranch1227Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p gamma phiD X Xd Z H hZsubXd h hhends hhColor + a0 ha0ends hpath j0 hj0 hj0le j1 hj1 j2 hj2 j3 hj3 j4 hj4 hj4le hbaseZ hu1NotExit + hu2NotExit insideIndices insideNonempty qv w hwXd hqvw hafter hqvlt qf hqfval f hqff hwf + hqflt hfThree hu0out horient + rcases horient with ⟨hj43, hj32, hj21, hj10⟩ + let i0 : Fin (p.length + 1) := ⟨j4, by omega⟩ + let i1 : Fin (p.length + 1) := ⟨j3, by omega⟩ + let i2 : Fin (p.length + 1) := ⟨j2, by omega⟩ + let i3 : Fin (p.length + 1) := ⟨j1, by omega⟩ + let i4 : Fin (p.length + 1) := ⟨j0, by omega⟩ + have hi4lt : i4.val < p.length := by + by_contra hn + have heq : i4.val = p.length := by omega + have hh := hj0 + rw [← show i4.val = j0 by rfl, heq, p.getVert_length] at hh + simp at hh + let ir : Fin (p.length + 1) := ⟨i4.val + 1, by omega⟩ + have hretAdj := p.adj_getVert_succ (i := i4.val) hi4lt + have hret : p.getVert ir.val = Sum.inl (C.y a0) := by + have hprev : p.getVert (i4.val - 1) = + Sum.inl (C.blockVertex (D.gammaIndex d) 0) := by + have heq : i4.val - 1 = j1 := by simp [i4]; omega + simpa [heq] using hj1 + cases hcase : p.getVert ir.val with + | inr e => + rw [show p.getVert i4.val = Sum.inr (C.blockEdge (D.gammaIndex d) 0) by + simpa [i4] using hj0, hcase] at hretAdj + simp [TwoColorIncidenceGraph] at hretAdj + | inl y => + have hinc : Incident G y (C.blockEdge (D.gammaIndex d) 0) := by + rw [show p.getVert i4.val = Sum.inr (C.blockEdge (D.gammaIndex d) 0) by + simpa [i4] using hj0, hcase] at hretAdj + have hadjData : Incident G y (C.blockEdge (D.gammaIndex d) 0) ∧ + (phiD (C.blockEdge (D.gammaIndex d) 0) = some gamma ∨ + phiD (C.blockEdge (D.gammaIndex d) 0) = some beta) := by + simpa [H, ir, TwoColorIncidenceGraph] using hretAdj + exact hadjData.1 + have hy : y = C.y a0 ∨ y = C.blockVertex (D.gammaIndex d) 0 := by + simpa [Incident, ha0ends] using hinc + rcases hy with rfl | rfl + · simp + · exfalso + have hinj := hpath.getVert_injOn (by omega : i4.val - 1 ≤ p.length) + (by omega : ir.val ≤ p.length) (hprev.trans hcase.symm) + have hne : i4.val - 1 ≠ ir.val := by simp [ir] + exact hne hinj + have hirMem : ir ∈ insideIndices := by + simp only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨C.y a0, hZsubXd (hbaseZ a0), hret⟩ + have hirle := Finset.le_max' insideIndices ir hirMem + have hi4qv : i4.val < qv.val := by + change ir.val ≤ qv.val at hirle + simp [ir] at hirle + omega + have hfn0 : f ≠ C.blockEdge (D.gammaIndex d) 0 := by + intro heq + have hverts : p.getVert qf.val = p.getVert i4.val := by + rw [hqff, heq] + simpa [i4] using hj0.symm + have hind := hpath.getVert_injOn (by omega : qf.val ≤ p.length) + (by omega : i4.val ≤ p.length) hverts + simp [qf] at hind + omega + have hfn1 : f ≠ C.blockEdge (D.gammaIndex d) 1 := by + intro heq + have hverts : p.getVert qf.val = p.getVert i0.val := by + rw [hqff, heq] + simpa [i0] using hj4.symm + have hind := hpath.getVert_injOn (by omega : qf.val ≤ p.length) + (by omega : i0.val ≤ p.length) hverts + simp [qf, i0, i4] at hind hi4qv + omega + have hf0 : f = D.f0 d := hfThree.resolve_right (by + rintro (heq | heq) + · exact hfn0 heq + · exact hfn1 heq) + have hwv0 : w = D.v0 d := by + have hwinc : Incident G w (D.f0 d) := hf0 ▸ hwf + have hwcase : w = D.v0 d ∨ w = D.u0 d := by + simpa [Incident, D.f0_ends] using hwinc + exact hwcase.resolve_right (fun heq => hu0out (heq ▸ hwXd)) + refine ⟨h, i0, i1, i2, i3, i4, qv, qf, hhColor, hhends, + by simpa [i0, i1] using hj43, by simpa [i1, i2] using hj32, + by simpa [i2, i3] using hj21, by simpa [i3, i4] using hj10, + ?_, hi4qv, hqfval, ?_, ?_, ?_, hu1NotExit, hu2NotExit⟩ + · right + exact ⟨by simpa [i0] using hj4, by simpa [i1] using hj3, + by simpa [i2] using hj2, by simpa [i3] using hj1, + by simpa [i4] using hj0⟩ + · simpa [hwv0] using hqvw + · simpa [hf0] using hqff + · simpa [Xd] using hafter + +private theorem helper_continuation_981.{u_1, u_2} : + helperContinuation981Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p gamma phiD X Xd Z H hZsubXd hexact h hhends + hhColor a0 ha0ends a1 ha1ends hpath j0 hj0 hj0le j1 hj1 j2 hj2 j3 hj3 j4 hj4 hj4le + horientation hbaseZ hu1NotExit hu2NotExit insideIndices insideNonempty qv w hwXd hqvw + hafter hqvlt qf hqfval f hqff hwf hqflt x hxXd hfends hfGamma hwZ + have hfThree : f = D.f0 d ∨ f = C.blockEdge (D.gammaIndex d) 0 ∨ + f = C.blockEdge (D.gammaIndex d) 1 := by + apply (hexact f).mp + exact ⟨by simpa [phiD, gamma] using hfGamma, w, by simpa [Z, X] using hwZ, + x, by simpa [Xd] using hxXd, hfends⟩ + have hf0Data := (hexact (D.f0 d)).2 (Or.inl rfl) + obtain ⟨_, av, havZ, bv, hbvo, habends⟩ := hf0Data + have havX : av ∈ X := by + exact (Finset.mem_sdiff.mp havZ).1 + have havInc : Incident G av (D.f0 d) := by + change av ∈ G.ends (D.f0 d) + rw [habends] + simp + have hav0 : av = D.v0 d := by + have hc : av = D.v0 d ∨ av = D.u0 d := by + simpa [Incident, D.f0_ends] using havInc + exact hc.resolve_right (fun heq => D.u0_outside d (heq ▸ by simpa [X] using havX)) + have hbvInc : Incident G bv (D.f0 d) := by + change bv ∈ G.ends (D.f0 d) + rw [habends] + simp + have hv0Xd : D.v0 d ∈ Xd := hZsubXd (by simpa [hav0, Z, X] using havZ) + have hbvu0 : bv = D.u0 d := by + have hc : bv = D.v0 d ∨ bv = D.u0 d := by + simpa [Incident, D.f0_ends] using hbvInc + exact hc.resolve_left (fun heq => hbvo (by simpa [heq, Xd] using hv0Xd)) + have hu0out : D.u0 d ∉ Xd := by simpa [hbvu0, Xd] using hbvo + rcases horientation with horient | horient + · exact @helper_branch_1139 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@beta) (@v) (@z) (@p) (@hZsubXd) (@h) + (@hhends) (@hhColor) (@a1) (@ha1ends) (@hpath) (@j0) (@hj0) (@hj0le) (@j1) (@hj1) (@j2) + (@hj2) (@j3) (@hj3) (@j4) (@hj4) (@hj4le) (@hbaseZ) (@hu1NotExit) (@hu2NotExit) + (@insideNonempty) (@w) (@hwXd) (@hqvw) (@hafter) (@hqvlt) (@hqfval) (@f) (@hqff) (@hwf) + (@hqflt) (@hfThree) (by assumption) (@hu0out) (@horient) + · exact @helper_branch_1227 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@beta) (@v) (@z) (@p) (@hZsubXd) (@h) + (@hhends) (@hhColor) (@a0) (@ha0ends) (@hpath) (@j0) (@hj0) (@hj0le) (@j1) (@hj1) (@j2) + (@hj2) (@j3) (@hj3) (@j4) (@hj4) (@hj4le) (@hbaseZ) (@hu1NotExit) (@hu2NotExit) + (@insideNonempty) (@w) (@hwXd) (@hqvw) (@hafter) (@hqvlt) (@hqfval) (@f) (@hqff) (@hwf) + (@hqflt) (@hfThree) (@hu0out) (@horient) +private theorem helper_continuation_790.{u_1, u_2} : + helperContinuation790Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p hbetaD hp gamma phiD X Xd Z H hZsubXd hvXd + hglobalD helemD hclosedD hgammaDef hexact _ h hhends hhColor a0 ha0ends a1 ha1ends hpath + hlength j0 hj0 hj0le j1 hj1 j2 hj2 j3 hj3 j4 hj4 hj4le horientation hbaseZ husedWitnessZ + have hu1Xd : R.u1 ∈ Xd := by + change R.u1 ∈ TreeSequenceVertexSet R.replacementTree + rw [R.replacement_vertices] + simp + have hu2Xd : R.u2 ∈ Xd := by + change R.u2 ∈ TreeSequenceVertexSet R.replacementTree + rw [R.replacement_vertices] + simp + have pairHasFree : ∀ u : V, u ∈ Xd → u ∉ Z → + ∃ c, c ∈ MissingColors G phiD u ∧ + c ∈ TreeFreeColors phiD R.replacementTree := by + intro u huXd huZ + have hcount := ScheideGlobalMaximumMissingCounts G k e0 phiD + R.replacementTree hglobalD u huXd + have hnonempty : (MissingColors G phiD u).Nonempty := by + apply Finset.card_pos.mp + by_cases hi : Incident G u e0 + · have hc := (hcount.1 hi).2 + omega + · have hc := (hcount.2 hi).2 + omega + obtain ⟨c, hcMissing⟩ := hnonempty + have hcUnused : c ∉ TreeUsedColors phiD R.replacementTree := by + intro hcUsed + obtain ⟨y, hyZ, hyMissing⟩ := husedWitnessZ c hcUsed + have hyu : y ≠ u := by + intro heq + exact huZ (heq ▸ hyZ) + exact (Finset.disjoint_left.mp (helemD (hZsubXd hyZ) huXd hyu)) + hyMissing hcMissing + refine ⟨c, hcMissing, ?_⟩ + apply Finset.mem_sdiff.mpr + refine ⟨?_, hcUnused⟩ + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨u, huXd, hcMissing⟩ + have hu1NotZ : R.u1 ∉ Z := by + intro hu + have hu' : R.u1 ∈ X \ {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} := by simpa only [Z] using hu + exact R.u1_outside (by simpa [X] using (Finset.mem_sdiff.mp hu').1) + have hu2NotZ : R.u2 ∉ Z := by + intro hu + have hu' : R.u2 ∈ X \ {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} := by simpa only [Z] using hu + exact R.u2_outside (by simpa [X] using (Finset.mem_sdiff.mp hu').1) + obtain ⟨c1, hc1Missing, hc1Free⟩ := pairHasFree R.u1 hu1Xd hu1NotZ + obtain ⟨c2, hc2Missing, hc2Free⟩ := pairHasFree R.u2 hu2Xd hu2NotZ + have hu1NotExit : R.u1 ∉ ScheideExitVertices R.replacementTree phiD := by + intro hu + have hd := ScheideExitNoFree G k e0 phiD R.replacementTree hglobalD R.u1 hu + exact (Finset.disjoint_left.mp hd) hc1Missing hc1Free + have hu2NotExit : R.u2 ∉ ScheideExitVertices R.replacementTree phiD := by + intro hu + have hd := ScheideExitNoFree G k e0 phiD R.replacementTree hglobalD R.u2 hu + exact (Finset.disjoint_left.mp hd) hc2Missing hc2Free + let insideIndices : Finset (Fin (p.length + 1)) := + Finset.univ.filter fun q => ∃ w ∈ Xd, p.getVert q.val = Sum.inl w + have insideNonempty : insideIndices.Nonempty := by + refine ⟨⟨0, by omega⟩, ?_⟩ + simp only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hvXd, p.getVert_zero⟩ + let qv : Fin (p.length + 1) := insideIndices.max' insideNonempty + have hqvMem : qv ∈ insideIndices := Finset.max'_mem insideIndices insideNonempty + obtain ⟨w, hwXd, hqvw⟩ := by + simpa only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + using hqvMem + have hafter : ∀ q : Fin (p.length + 1), qv.val < q.val → + ∀ a : V, p.getVert q.val = Sum.inl a → a ∉ Xd := by + intro q hq a hqa haXd + have hqmem : q ∈ insideIndices := by + simp only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨a, haXd, hqa⟩ + exact (not_le_of_gt hq) (Finset.le_max' insideIndices q hqmem) + have hqvlt : qv.val < p.length := by + by_contra hn + have heq : qv.val = p.length := by omega + have hwz : w = z := by + apply Sum.inl.inj + rw [← hqvw, heq, p.getVert_length] + exact hp.2.2.1 (hwz ▸ hwXd) + let qf : Fin (p.length + 1) := ⟨qv.val + 1, by omega⟩ + have hqfval : qf.val = qv.val + 1 := rfl + have hqadj := p.adj_getVert_succ (i := qv.val) hqvlt + rw [hqvw] at hqadj + have hqadj' : H.Adj (Sum.inl w) (p.getVert qf.val) := by + simpa [H, qf] using hqadj + obtain ⟨f, hqff, hwf, hfcolor⟩ : ∃ f : E, + p.getVert qf.val = Sum.inr f ∧ Incident G w f ∧ + (phiD f = some gamma ∨ phiD f = some beta) := by + cases hnext : p.getVert qf.val with + | inl a => + exfalso + rw [hnext] at hqadj' + simp [H, TwoColorIncidenceGraph] at hqadj' + | inr f => + refine ⟨f, rfl, ?_⟩ + rw [hnext] at hqadj' + simpa [H, TwoColorIncidenceGraph] using hqadj' + have hqflt : qf.val < p.length := by + by_contra hn + have heq : qf.val = p.length := by omega + have hh := hqff + rw [heq, p.getVert_length] at hh + simp at hh + let qx : Fin (p.length + 1) := ⟨qf.val + 1, by omega⟩ + have hfxadj := p.adj_getVert_succ (i := qf.val) hqflt + rw [hqff] at hfxadj + have hfxadj' : H.Adj (Sum.inr f) (p.getVert qx.val) := by + simpa [H, qx] using hfxadj + obtain ⟨x, hqxx, hxf⟩ : ∃ x : V, + p.getVert qx.val = Sum.inl x ∧ Incident G x f := by + cases hnext : p.getVert qx.val with + | inl a => + refine ⟨a, rfl, ?_⟩ + rw [hnext] at hfxadj' + have hadjData : Incident G a f ∧ + (phiD f = some gamma ∨ phiD f = some beta) := by + simpa [H, TwoColorIncidenceGraph] using hfxadj' + exact hadjData.1 + | inr e => + exfalso + rw [hnext] at hfxadj' + simp [H, TwoColorIncidenceGraph] at hfxadj' + have hxXd : x ∉ Xd := hafter qx (by dsimp [qx, qf]; omega) x hqxx + have hwne : w ≠ x := fun heq => hxXd (heq ▸ hwXd) + have hfends : G.ends f = s(w, x) := + (Sym2.mem_and_mem_iff hwne).mp ⟨hwf, hxf⟩ + have hfBoundary : f ∈ BoundaryEdges G Xd := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwXd, x, hxXd, hfends⟩ + have hfGamma : phiD f = some gamma := by + rcases hfcolor with hfg | hfb + · exact hfg + · exact False.elim ((hclosedD hfBoundary hvXd hfb) hbetaD) + have hwExit : ScheideExitVertex R.replacementTree phiD w := by + exact ⟨v, beta, gamma, hvXd, hbetaD, + by simpa [gamma, phiD, Xd] using hgammaDef, z, p, + by simpa [gamma, phiD] using hp, qv, hqvw, hwXd, hafter⟩ + have hwExits : w ∈ ScheideExitVertices R.replacementTree phiD := by + simp only [ScheideExitVertices, Finset.mem_filter, Finset.mem_univ, true_and] + exact hwExit + have hwZ : w ∈ Z := by + have hu := hwXd + change w ∈ TreeSequenceVertexSet R.replacementTree at hu + rw [R.replacement_vertices] at hu + rcases Finset.mem_union.mp hu with hz | hu + · simpa [Z, X] using hz + · simp only [Finset.mem_insert, Finset.mem_singleton] at hu + rcases hu with rfl | rfl + · exact False.elim (hu1NotExit hwExits) + · exact False.elim (hu2NotExit hwExits) + exact @helper_continuation_981 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@beta) (@v) (@z) (@p) + (@hZsubXd) (@hexact) (@h) (@hhends) (@hhColor) (@a0) (@ha0ends) (@a1) (@ha1ends) (@hpath) + (@j0) (@hj0) (@hj0le) (@j1) (@hj1) (@j2) (@hj2) (@j3) (@hj3) (@j4) (@hj4) (@hj4le) + (@horientation) (@hbaseZ) (@hu1NotExit) (@hu2NotExit) (@insideNonempty) (@w) (@hwXd) + (@hqvw) (@hafter) (@hqvlt) (@hqfval) (@f) (@hqff) (@hwf) (@hqflt) (@x) (@hxXd) (@hfends) + (@hfGamma) (@hwZ) +private theorem helper_continuation_462.{u_1, u_2} : + helperContinuation462Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p hv hbetaD hp gamma phiD X Xd Z H hZsubXd hvXd + hglobalD helemD hclosedD hgammaDef hexact _ h hhends heffect hhColor a0 ha0ends a1 ha1ends + hpath hlength j0 hj0 hj0le j1 hj1 j2 hj2 j3 hj3 j4 hj4 hj4le horientation htreeY hpTwo + hlengthT hlengthD hrLt hbaseZ + have hdeltaUnusedOriginal : d.1 ∉ TreeUsedColors phi T := by + have hu := (ScheideGlobalMaximumUnused G k e0 phi T C.globally_maximum).1 + exact fun hd => (Finset.disjoint_left.mp hu) d.2 hd + have originalEdgeFixed : ∀ (q : ℕ) (hq : q < T.length), 1 ≤ q → + phiD (T.edge ⟨q, hq⟩) = phi (T.edge ⟨q, hq⟩) := by + intro q hq hqpos + apply heffect.2.2.2.2.1 + · obtain ⟨i, hi⟩ := T.attaches ⟨q, hq⟩ + refine ⟨T.vertex ⟨q + 1, by omega⟩, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · change T.vertex ⟨q + 1, by omega⟩ ∈ G.ends (T.edge ⟨q, hq⟩) + rw [hi] + simp + · intro heq + apply hdeltaUnusedOriginal + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨⟨q, hq⟩, hqpos, by simpa [heq] using D.f0_color d⟩ + have hf1D : phiD R.f1 = some d.1 := by + have hf := ScheideReplacementPairFixed G k e0 phi T C D d R R.f1 + (Or.inl (by + change R.u1 ∈ G.ends R.f1 + rw [R.f1_ends] + simp [])) + simpa [phiD, gamma] using hf.trans R.f1_color + have hf2D : phiD R.f2 = some d.1 := by + have hf := ScheideReplacementPairFixed G k e0 phi T C D d R R.f2 + (Or.inr (by + change R.u2 ∈ G.ends R.f2 + rw [R.f2_ends] + simp [])) + simpa [phiD, gamma] using hf.trans R.f2_color + have husedWitnessZ : ∀ c : Fin k, + c ∈ TreeUsedColors phiD R.replacementTree → + ∃ y ∈ Z, c ∈ MissingColors G phiD y := by + intro c hc + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc + rcases hc with ⟨j, hj, hc⟩ + by_cases hjBase : j.val < C.p - 1 + · obtain ⟨i, c0, hcolor0, hmiss0⟩ := hglobalD.2.1 j hj + have hc0 : c0 = c := Option.some.inj (hcolor0.symm.trans hc) + let q : Fin C.p := ⟨i.val, by omega⟩ + have hvrep := R.retained_vertices_before i.val (by omega) + (by rw [C.length_eq]; omega) + have hidx : Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) = + (⟨i.val, by omega⟩ : Fin (R.replacementTree.length + 1)) := Fin.ext rfl + have holdidx : (⟨i.val, by omega⟩ : Fin (T.length + 1)) = + (⟨q.val, by rw [C.length_eq]; omega⟩ : Fin (T.length + 1)) := Fin.ext rfl + refine ⟨C.y q, hbaseZ q, ?_⟩ + rw [hidx, hvrep, holdidx, C.base_vertex_position q] at hmiss0 + simpa [hc0] using hmiss0 + · by_cases hbefore : j.val < C.p - 1 + 2 * (D.gammaIndex d).val + · let n := j.val - (C.p - 1) + let q : Fin C.s := ⟨n / 2, by omega⟩ + let t : Fin 2 := ⟨n % 2, Nat.mod_lt _ (by omega)⟩ + have hjpos : j.val = C.p - 1 + 2 * q.val + t.val := by + dsimp [q, t, n] + have hdiv := Nat.mod_add_div (j.val - (C.p - 1)) 2 + omega + have hqr : q ≠ D.gammaIndex d := by + intro hqeq + have hv := congrArg Fin.val hqeq + dsimp [q, n] at hv + omega + have hedgeOld : T.edge ⟨j.val, by omega⟩ = C.blockEdge q t := by + calc + T.edge ⟨j.val, by omega⟩ = + T.edge ⟨C.p - 1 + 2 * q.val + t.val, by omega⟩ := by + congr 1 + exact Fin.ext hjpos + _ = C.blockEdge q t := C.block_edge_position q t + have hedgeRep : R.replacementTree.edge j = T.edge ⟨j.val, by omega⟩ := + R.retained_edges_before j.val hbefore (by omega) + have hcolorD : phiD (R.replacementTree.edge j) = some (C.gamma q) := by + rw [hedgeRep, originalEdgeFixed j.val (by omega) (by omega), hedgeOld] + exact C.block_color q t + have hcol : C.gamma q = c := Option.some.inj (hcolorD.symm.trans hc) + obtain ⟨a, haMissing⟩ := C.block_color_missing_on_base q + have hneGamma : C.gamma q ≠ gamma := by + intro heq + apply hqr + apply C.gamma_injective + simpa [gamma] using heq + have haMissingD : C.gamma q ∈ MissingColors G phiD (C.y a) := by + by_cases ha0 : C.y a = D.v0 d + · rw [ha0, heffect.2.2.2.1] + exact Finset.mem_insert_of_mem (Finset.mem_erase.mpr ⟨hneGamma, by + simpa [ha0] using haMissing⟩) + · rw [heffect.2.2.2.2.2.1 (C.y a) (htreeY a) ha0] + exact haMissing + exact ⟨C.y a, hbaseZ a, by simpa [hcol] using haMissingD⟩ + · by_cases hafter : j.val + 2 < T.length + · let n := j.val + 2 - (C.p - 1) + let q : Fin C.s := ⟨n / 2, by omega⟩ + let t : Fin 2 := ⟨n % 2, Nat.mod_lt _ (by omega)⟩ + have hjpos : j.val + 2 = C.p - 1 + 2 * q.val + t.val := by + dsimp [q, t, n] + have hdiv := Nat.mod_add_div (j.val + 2 - (C.p - 1)) 2 + omega + have hqr : q ≠ D.gammaIndex d := by + intro hqeq + have hv := congrArg Fin.val hqeq + dsimp [q, n] at hv + omega + have hedgeOld : T.edge ⟨j.val + 2, hafter⟩ = C.blockEdge q t := by + calc + T.edge ⟨j.val + 2, hafter⟩ = + T.edge ⟨C.p - 1 + 2 * q.val + t.val, by omega⟩ := by + congr 1 + exact Fin.ext hjpos + _ = C.blockEdge q t := C.block_edge_position q t + have hedgeRep : R.replacementTree.edge j = T.edge ⟨j.val + 2, hafter⟩ := + R.retained_edges_after j.val (by omega) hafter + have hcolorD : phiD (R.replacementTree.edge j) = some (C.gamma q) := by + rw [hedgeRep, originalEdgeFixed (j.val + 2) hafter (by omega), hedgeOld] + exact C.block_color q t + have hcol : C.gamma q = c := Option.some.inj (hcolorD.symm.trans hc) + obtain ⟨a, haMissing⟩ := C.block_color_missing_on_base q + have hneGamma : C.gamma q ≠ gamma := by + intro heq + apply hqr + apply C.gamma_injective + simpa [gamma] using heq + have haMissingD : C.gamma q ∈ MissingColors G phiD (C.y a) := by + by_cases ha0 : C.y a = D.v0 d + · rw [ha0, heffect.2.2.2.1] + exact Finset.mem_insert_of_mem (Finset.mem_erase.mpr ⟨hneGamma, by + simpa [ha0] using haMissing⟩) + · rw [heffect.2.2.2.2.2.1 (C.y a) (htreeY a) ha0] + exact haMissing + exact ⟨C.y a, hbaseZ a, by simpa [hcol] using haMissingD⟩ + · have hjlast : j.val = T.length - 2 ∨ j.val = T.length - 1 := by + have hl := R.replacement_length + omega + have hdc : d.1 = c := by + rcases hjlast with hjlast | hjlast + · have hedge : R.replacementTree.edge j = R.f1 := by + calc + R.replacementTree.edge j = + R.replacementTree.edge ⟨T.length - 2, by + rw [R.replacement_length]; omega⟩ := by + congr 1 + exact Fin.ext hjlast + _ = R.f1 := R.replacement_last_edges.1 + exact Option.some.inj ((hedge ▸ hf1D).symm.trans hc) + · have hedge : R.replacementTree.edge j = R.f2 := by + calc + R.replacementTree.edge j = + R.replacementTree.edge ⟨T.length - 1, by + rw [R.replacement_length]; omega⟩ := by + congr 1 + exact Fin.ext hjlast + _ = R.f2 := R.replacement_last_edges.2 + exact Option.some.inj ((hedge ▸ hf2D).symm.trans hc) + obtain ⟨a, ha, hv0a⟩ := Finset.mem_image.mp + (ScheideStructuralExitsInBase G k e0 phi T C (D.v0_is_exit d)) + have hv0Z : D.v0 d ∈ Z := hv0a ▸ hbaseZ a + refine ⟨D.v0 d, hv0Z, ?_⟩ + rw [← hdc, heffect.2.2.2.1] + simp + exact @helper_continuation_790 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@beta) (@v) (@z) (@p) + (@hbetaD) (@hp) (@hZsubXd) (@hvXd) (@hglobalD) (@helemD) (@hclosedD) (@hgammaDef) (@hexact) + (by assumption) (@h) (@hhends) (@hhColor) (@a0) (@ha0ends) (@a1) (@ha1ends) (@hpath) + (@hlength) (@j0) (@hj0) (@hj0le) (@j1) (@hj1) (@j2) (@hj2) (@j3) (@hj3) (@j4) (@hj4) + (@hj4le) (@horientation) (@hbaseZ) (@husedWitnessZ) +private theorem helper_continuation_264.{u_1, u_2} : + helperContinuation264Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R beta v z p hv hbetaD hbetaGamma hp gamma phiD X Xd Z H + hZsubXd hvXd hproper hglobalD helemD hclosedD hgammaDef hb0Color hb1Color hexact _ + hb0Support hb1Support h hhends heffect hhColor a0 ha0ends a1 ha1ends hb0u0 hu0h hhu1 hu1b1 + hu0Support hhSupport hu1Support hpath hlength startNeighborUnique + have forwardAdjacent : ∀ i j : ℕ, i ≤ p.length → j ≤ p.length → + i < j → H.Adj (p.getVert i) (p.getVert j) → i + 1 = j := by + intro i j hi hj hijlt hij + by_contra hnot + have hgap : i + 1 < j := by omega + by_cases hi0 : i = 0 + · subst i + have heq := startNeighborUnique (p.getVert j) (by simpa using hij) + have hinj := hpath.getVert_injOn (by omega : 1 ≤ p.length) hj heq.symm + omega + · have hprev := p.adj_getVert_succ (i := i - 1) (by omega) + have hnext := p.adj_getVert_succ (i := i) (by omega) + have hprev' : H.Adj (p.getVert i) (p.getVert (i - 1)) := by + have hieq : i - 1 + 1 = i := by omega + simpa [H, hieq] using hprev.symm + have hnext' : H.Adj (p.getVert i) (p.getVert (i + 1)) := by + simpa [H] using hnext + have hprevNext : p.getVert (i - 1) ≠ p.getVert (i + 1) := by + intro heq + have hindex := hpath.getVert_injOn + (by omega : i - 1 ≤ p.length) (by omega : i + 1 ≤ p.length) heq + omega + have hprevJ : p.getVert (i - 1) ≠ p.getVert j := by + intro heq + have hindex := hpath.getVert_injOn (by omega : i - 1 ≤ p.length) hj heq + omega + have hnextJ : p.getVert (i + 1) ≠ p.getVert j := by + intro heq + have hindex := hpath.getVert_injOn (by omega : i + 1 ≤ p.length) hj heq + omega + let S : Finset (Sum V E) := + {p.getVert (i - 1), p.getVert (i + 1), p.getVert j} + have hScard : S.card = 3 := by + simp [S, hprevNext, hprevJ, hnextJ] + have hSsub : ∀ x ∈ S, x ∈ H.neighborSet (p.getVert i) := by + intro x hx + simp only [S, Finset.mem_insert, Finset.mem_singleton] at hx + rcases hx with rfl | rfl | rfl + · simpa only [SimpleGraph.mem_neighborSet] using hprev' + · simpa only [SimpleGraph.mem_neighborSet] using hnext' + · simpa only [SimpleGraph.mem_neighborSet] using hij + let inclusion : {x // x ∈ S} → H.neighborSet (p.getVert i) := + fun x => ⟨x.1, hSsub x.1 x.2⟩ + have hinclusion : Function.Injective inclusion := by + intro x y hxy + apply Subtype.ext + exact congrArg (fun q : H.neighborSet (p.getVert i) => q.1) hxy + let : Fintype (H.neighborSet (p.getVert i)) := Fintype.ofFinite _ + have hcard := Fintype.card_le_of_injective inclusion hinclusion + rw [Fintype.card_coe, hScard, SimpleGraph.card_neighborSet_eq_degree] at hcard + have hdegree := TwoColorIncidenceDegreeAtMostTwo G phiD gamma beta hproper + (p.getVert i) + have hdegree' : H.degree (p.getVert i) ≤ 2 := by + simpa only [H] using hdegree + omega + have adjacentIndices : ∀ i j : ℕ, i ≤ p.length → j ≤ p.length → + H.Adj (p.getVert i) (p.getVert j) → + i + 1 = j ∨ j + 1 = i := by + intro i j hi hj hij + have hijne : i ≠ j := by + intro heq + subst j + exact H.irrefl hij + rcases lt_or_gt_of_ne hijne with hijlt | hjilt + · exact Or.inl (forwardAdjacent i j hi hj hijlt hij) + · exact Or.inr (forwardAdjacent j i hj hi hjilt hij.symm) + obtain ⟨j0, hj0, hj0le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hb0Support + obtain ⟨j1, hj1, hj1le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hu0Support + obtain ⟨j2, hj2, hj2le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hhSupport + obtain ⟨j3, hj3, hj3le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hu1Support + obtain ⟨j4, hj4, hj4le⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hb1Support + have ha01 := adjacentIndices j0 j1 hj0le hj1le + (by simpa [H, hj0, hj1] using hb0u0) + have ha12 := adjacentIndices j1 j2 hj1le hj2le + (by simpa [H, hj1, hj2] using hu0h) + have ha23 := adjacentIndices j2 j3 hj2le hj3le + (by simpa [H, hj2, hj3] using hhu1) + have ha34 := adjacentIndices j3 j4 hj3le hj4le + (by simpa [H, hj3, hj4] using hu1b1) + have hb0ColorD : phiD (C.blockEdge (D.gammaIndex d) 0) = some gamma := by + simpa [gamma, phiD] using hb0Color + have hb1ColorD : phiD (C.blockEdge (D.gammaIndex d) 1) = some gamma := by + simpa [gamma, phiD] using hb1Color + have hb0h : C.blockEdge (D.gammaIndex d) 0 ≠ h := by + intro heq + have hc : gamma = beta := Option.some.inj + (hb0ColorD.symm.trans (heq ▸ hhColor)) + exact hbetaGamma hc.symm + have hhb1 : h ≠ C.blockEdge (D.gammaIndex d) 1 := by + intro heq + have hc : beta = gamma := Option.some.inj + (hhColor.symm.trans (heq ▸ hb1ColorD)) + exact hbetaGamma hc + have hu0u1 : C.blockVertex (D.gammaIndex d) 0 ≠ + C.blockVertex (D.gammaIndex d) 1 := by + intro heq + apply G.loopless h (C.blockVertex (D.gammaIndex d) 0) + simpa [heq] using hhends + have hj02 : j0 ≠ j2 := by + intro heq + apply hb0h + apply Sum.inr.inj + exact hj0.symm.trans (by simpa [heq] using hj2) + have hj13 : j1 ≠ j3 := by + intro heq + apply hu0u1 + apply Sum.inl.inj + exact hj1.symm.trans (by simpa [heq] using hj3) + have hj24 : j2 ≠ j4 := by + intro heq + apply hhb1 + apply Sum.inr.inj + exact hj2.symm.trans (by simpa [heq] using hj4) + have horientation : + (j1 = j0 + 1 ∧ j2 = j1 + 1 ∧ j3 = j2 + 1 ∧ j4 = j3 + 1) ∨ + (j3 = j4 + 1 ∧ j2 = j3 + 1 ∧ j1 = j2 + 1 ∧ j0 = j1 + 1) := by + rcases ha01 with h01 | h10 <;> + rcases ha12 with h12 | h21 <;> + rcases ha23 with h23 | h32 <;> + rcases ha34 with h34 | h43 <;> omega + have htreeY : ∀ q : Fin C.p, C.y q ∈ TreeSequenceVertexSet T := by + intro q + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨q.val, by rw [C.length_eq]; omega⟩, C.base_vertex_position q⟩ + have hpTwo : 2 ≤ C.p := C.p_ge_two + have hlengthT : T.length + 1 = C.p + 2 * C.s := C.length_eq + have hlengthD : R.replacementTree.length = T.length := R.replacement_length + have hrLt : (D.gammaIndex d).val < C.s := (D.gammaIndex d).isLt + have hbaseZ : ∀ q : Fin C.p, C.y q ∈ Z := by + intro q + apply Finset.mem_sdiff.mpr + refine ⟨by simpa [X] using htreeY q, ?_⟩ + simp only [Finset.mem_insert, Finset.mem_singleton] + rintro (he | he) + · have hi := T.vertex_injective + ((C.base_vertex_position q).trans + (he.trans (C.block_vertex_position (D.gammaIndex d) 0).symm)) + have hv := congrArg Fin.val hi + have hq := q.isLt + change q.val = C.p + 2 * (D.gammaIndex d).val at hv + omega + · have hi := T.vertex_injective + ((C.base_vertex_position q).trans + (he.trans (C.block_vertex_position (D.gammaIndex d) 1).symm)) + have hv := congrArg Fin.val hi + have hq := q.isLt + change q.val = C.p + 2 * (D.gammaIndex d).val + 1 at hv + omega + exact @helper_continuation_462 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@beta) (@v) (@z) (@p) (@hv) + (@hbetaD) (@hp) (@hZsubXd) (@hvXd) (@hglobalD) (@helemD) (@hclosedD) (@hgammaDef) (@hexact) + (by assumption) (@h) (@hhends) (@heffect) (@hhColor) (@a0) (@ha0ends) (@a1) (@ha1ends) + (@hpath) (@hlength) (@j0) (@hj0) (@hj0le) (@j1) (@hj1) (@j2) (@hj2) (@j3) (@hj3) (@j4) + (@hj4) (@hj4le) (@horientation) (@htreeY) (@hpTwo) (@hlengthT) (@hlengthD) (@hrLt) (@hbaseZ) +private theorem helper_startNeighborUnique_2406.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (beta : Fin k) (v z : V) (p + : (TwoColorIncidenceGraph G (TwoColorComponentSwap G phi (C.gamma (D.gammaIndex d)) (↑d : + Fin k) (Sum.inl (D.v0 d))) (C.gamma (D.gammaIndex d)) beta).Walk (Sum.inl v) (Sum.inl z)), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phiD gamma beta; + ∀ (_ : IsProperEdgeColoring G phiD) (_ : (0 : ℕ) < p.length) (_ : + ∀ (e : E), Incident G v e → phiD e ≠ some beta) (x : V ⊕ E), H.Adj (Sum.inl v) x → x = + p.getVert (1 : ℕ) := by + classical + intro V E _ _ _ G k e0 phi T C D d beta v z p gamma phiD H hproper hlength hbetaAbsent x hx + have hfirst := p.adj_getVert_succ (i := 0) hlength + rw [p.getVert_zero] at hfirst + cases hxcase : x with + | inl w => + rw [hxcase] at hx + simp [H, TwoColorIncidenceGraph] at hx + | inr e => + rw [hxcase] at hx + rcases (by simpa [H, TwoColorIncidenceGraph] using hx) with ⟨hve, hec⟩ + have hegamma : phiD e = some gamma := + hec.resolve_right (hbetaAbsent e hve) + cases hnext : p.getVert 1 with + | inl w => + rw [hnext] at hfirst + simp [TwoColorIncidenceGraph] at hfirst + | inr f => + rw [hnext] at hfirst + rcases (by simpa [H, TwoColorIncidenceGraph] using hfirst) with + ⟨hvf, hfc⟩ + have hfgamma : phiD f = some gamma := + hfc.resolve_right (hbetaAbsent f hvf) + have hef : e = f := by + by_contra hne + exact (hproper hne ⟨v, hve, hvf⟩ hegamma) hfgamma + simp [hef] + +theorem ScheideSymmetricReplacementPathOrder {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (d : {delta // delta ∈ DefectiveColors G phi (TreeSequenceVertexSet T)}) + (R : ScheideReplacementData G k e0 phi T C D d) : + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + ∀ (beta : Fin k) (v z : V) + (p : (TwoColorIncidenceGraph G phiD gamma beta).Walk + (Sum.inl v) (Sum.inl z)), + v ∈ TreeSequenceVertexSet T \ + {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} → + beta ∈ MissingColors G phiD v → beta ∈ MissingColors G phi v → + beta ∈ TreeFreeColors phiD R.replacementTree → + beta ≠ d.1 → beta ≠ gamma → + ScheideDefectiveChainPath R.replacementTree phiD gamma beta v z p → + ∃ (h : E) (i0 i1 i2 i3 i4 qv qf : Fin (p.length + 1)), + phiD h = some beta ∧ + G.ends h = s(C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1) ∧ + i1.val = i0.val + 1 ∧ i2.val = i1.val + 1 ∧ + i3.val = i2.val + 1 ∧ i4.val = i3.val + 1 ∧ + ((p.getVert i0.val = Sum.inr (C.blockEdge (D.gammaIndex d) 0) ∧ + p.getVert i1.val = Sum.inl (C.blockVertex (D.gammaIndex d) 0) ∧ + p.getVert i2.val = Sum.inr h ∧ + p.getVert i3.val = Sum.inl (C.blockVertex (D.gammaIndex d) 1) ∧ + p.getVert i4.val = Sum.inr (C.blockEdge (D.gammaIndex d) 1)) ∨ + (p.getVert i0.val = Sum.inr (C.blockEdge (D.gammaIndex d) 1) ∧ + p.getVert i1.val = Sum.inl (C.blockVertex (D.gammaIndex d) 1) ∧ + p.getVert i2.val = Sum.inr h ∧ + p.getVert i3.val = Sum.inl (C.blockVertex (D.gammaIndex d) 0) ∧ + p.getVert i4.val = Sum.inr (C.blockEdge (D.gammaIndex d) 0))) ∧ + i4.val < qv.val ∧ qf.val = qv.val + 1 ∧ + p.getVert qv.val = Sum.inl (D.v0 d) ∧ + p.getVert qf.val = Sum.inr (D.f0 d) ∧ + (∀ r : Fin (p.length + 1), qv.val < r.val → + ∀ w : V, p.getVert r.val = Sum.inl w → + w ∉ TreeSequenceVertexSet R.replacementTree) ∧ + R.u1 ∉ ScheideExitVertices R.replacementTree phiD ∧ + R.u2 ∉ ScheideExitVertices R.replacementTree phiD := by + classical + dsimp only + intro beta v z p hv hbetaD hbetaOld hbetaFree hbetaDelta hbetaGamma hp + let gamma := C.gamma (D.gammaIndex d) + let phiD := TwoColorComponentSwap G phi gamma d.1 (Sum.inl (D.v0 d)) + let X := TreeSequenceVertexSet T + let Xd := TreeSequenceVertexSet R.replacementTree + let Z := X \ {C.blockVertex (D.gammaIndex d) 0, + C.blockVertex (D.gammaIndex d) 1} + let H := TwoColorIncidenceGraph G phiD gamma beta + have hvZ : v ∈ Z := by simpa [Z, X] using hv + have hZsubXd : Z ⊆ Xd := by + intro a ha + change a ∈ TreeSequenceVertexSet R.replacementTree + rw [R.replacement_vertices] + exact Finset.mem_union_left _ (by simpa [Z, X] using ha) + have hvXd : v ∈ Xd := hZsubXd hvZ + have hmaximum := ScheideReplacementMaximum G k e0 phi T C D d R + dsimp [gamma, phiD] at hmaximum + have hproper : IsProperEdgeColoring G phiD := hmaximum.1 + have hglobalD : GlobalMaximumTriple G k e0 phiD R.replacementTree := + hmaximum.2.2 + have horderD := ScheideGlobalMaximumOrder G k e0 phiD R.replacementTree hglobalD + have helemD : ColoredVertexSetElementary G phiD Xd := horderD.2.2.2.1 + have hclosedD : ColoredVertexSetClosed G phiD Xd := horderD.2.2.2.2 + have hconfig := + ScheideSymmetricReplacementBoundaryConfiguration G k e0 phi T C D d R + dsimp [gamma, phiD, Xd, Z, X] at hconfig + rcases hconfig with + ⟨hgammaDef, hf0Color, hb0Color, hb1Color, hf0ne0, hf0ne1, + hb01ne, hexact⟩ + have hb0Data := (hexact (C.blockEdge (D.gammaIndex d) 0)).2 + (Or.inr (Or.inl rfl)) + obtain ⟨_, b0in, hb0inZ, b0out, hb0out, hb0ends⟩ := hb0Data + have hb1Data := (hexact (C.blockEdge (D.gammaIndex d) 1)).2 + (Or.inr (Or.inr rfl)) + obtain ⟨_, b1in, hb1inZ, b1out, hb1out, hb1ends⟩ := hb1Data + have hb0Boundary : C.blockEdge (D.gammaIndex d) 0 ∈ BoundaryEdges G Xd := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨b0in, hZsubXd (by simpa [Z, X] using hb0inZ), b0out, + by simpa [Xd] using hb0out, hb0ends⟩ + have hb1Boundary : C.blockEdge (D.gammaIndex d) 1 ∈ BoundaryEdges G Xd := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨b1in, hZsubXd (by simpa [Z, X] using hb1inZ), b1out, + by simpa [Xd] using hb1out, hb1ends⟩ + have hb0ColorBoundary : C.blockEdge (D.gammaIndex d) 0 ∈ + BoundaryColorEdges G phiD Xd gamma := + Finset.mem_filter.mpr ⟨hb0Boundary, by simpa [phiD, gamma] using hb0Color⟩ + have hb1ColorBoundary : C.blockEdge (D.gammaIndex d) 1 ∈ + BoundaryColorEdges G phiD Xd gamma := + Finset.mem_filter.mpr ⟨hb1Boundary, by simpa [phiD, gamma] using hb1Color⟩ + have hchain := ScheideDefectiveChainBoundaryEdges G k e0 phiD + R.replacementTree hglobalD gamma beta + (by simpa [gamma, phiD, Xd] using hgammaDef) hbetaFree v hvXd + (by simpa [phiD] using hbetaD) z p (by simpa [gamma, phiD] using hp) + have hb0Support : Sum.inr (C.blockEdge (D.gammaIndex d) 0) ∈ p.support := + (hchain (C.blockEdge (D.gammaIndex d) 0)).mp hb0ColorBoundary |>.2 + have hb1Support : Sum.inr (C.blockEdge (D.gammaIndex d) 1) ∈ p.support := + (hchain (C.blockEdge (D.gammaIndex d) 1)).mp hb1ColorBoundary |>.2 + obtain ⟨h, hhOldColor, hhends⟩ := ScheideStructuralInternalPair + G k e0 phi T C (D.gammaIndex d) beta + (by simpa [gamma] using hbetaGamma) ⟨v, hv, hbetaOld⟩ + have hhne0 : h ≠ D.f0 d := by + intro heq + have hc : beta = d.1 := Option.some.inj + (hhOldColor.symm.trans (heq ▸ D.f0_color d)) + exact hbetaDelta hc + have hblock0X : C.blockVertex (D.gammaIndex d) 0 ∈ X := by + simp only [X, TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨⟨C.p + 2 * (D.gammaIndex d).val, by rw [C.length_eq]; omega⟩, + C.block_vertex_position (D.gammaIndex d) 0⟩ + have hhIncident : ∃ a ∈ TreeSequenceVertexSet T, Incident G a h := by + refine ⟨C.blockVertex (D.gammaIndex d) 0, by simpa [X] using hblock0X, ?_⟩ + change C.blockVertex (D.gammaIndex d) 0 ∈ G.ends h + rw [hhends] + simp + have heffect := ScheideDefectiveSwitchEffect G k e0 phi T C D d + dsimp [gamma, phiD] at heffect + have hhColor : phiD h = some beta := by + exact (heffect.2.2.2.2.1 h hhIncident hhne0).trans hhOldColor + obtain ⟨a0, ha0ends⟩ := C.block_attaches_to_base (D.gammaIndex d) 0 + obtain ⟨a1, ha1ends⟩ := C.block_attaches_to_base (D.gammaIndex d) 1 + have hb0u0 : H.Adj (Sum.inr (C.blockEdge (D.gammaIndex d) 0)) + (Sum.inl (C.blockVertex (D.gammaIndex d) 0)) := by + simp [H, TwoColorIncidenceGraph, Incident, ha0ends, hb0Color, phiD, gamma] + have hu0h : H.Adj (Sum.inl (C.blockVertex (D.gammaIndex d) 0)) + (Sum.inr h) := by + simp [H, TwoColorIncidenceGraph, Incident, hhends, hhColor] + have hhu1 : H.Adj (Sum.inr h) + (Sum.inl (C.blockVertex (D.gammaIndex d) 1)) := by + simp [H, TwoColorIncidenceGraph, Incident, hhends, hhColor] + have hu1b1 : H.Adj (Sum.inl (C.blockVertex (D.gammaIndex d) 1)) + (Sum.inr (C.blockEdge (D.gammaIndex d) 1)) := by + simp [H, TwoColorIncidenceGraph, Incident, ha1ends, hb1Color, phiD, gamma] + have hb0Component : H.connectedComponentMk + (Sum.inr (C.blockEdge (D.gammaIndex d) 0)) = + H.connectedComponentMk (Sum.inl v) := by + change Sum.inr (C.blockEdge (D.gammaIndex d) 0) ∈ + TwoColorComponent G phiD gamma beta (Sum.inl v) + rw [← hp.2.2.2] + exact hb0Support + have hu0Component : H.connectedComponentMk + (Sum.inl (C.blockVertex (D.gammaIndex d) 0)) = + H.connectedComponentMk (Sum.inl v) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hb0u0).symm.trans + hb0Component + have hhComponent : H.connectedComponentMk (Sum.inr h) = + H.connectedComponentMk (Sum.inl v) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hu0h).symm.trans + hu0Component + have hu1Component : H.connectedComponentMk + (Sum.inl (C.blockVertex (D.gammaIndex d) 1)) = + H.connectedComponentMk (Sum.inl v) := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hhu1).symm.trans + hhComponent + have componentSupport : + ∀ x : Sum V E, H.connectedComponentMk x = H.connectedComponentMk (Sum.inl v) → x ∈ p.support + := by + intro x hx + have hx' : x ∈ TwoColorComponent G phiD gamma beta (Sum.inl v) := hx + rw [← hp.2.2.2] at hx' + exact hx' + have hu0Support := componentSupport _ hu0Component + have hhSupport := componentSupport _ hhComponent + have hu1Support := componentSupport _ hu1Component + have hpath : p.IsPath := hp.2.1 + have hlength : 0 < p.length := by + by_contra hn + have hzero : p.length = 0 := by omega + have hvz : (Sum.inl v : Sum V E) = Sum.inl z := + SimpleGraph.Walk.eq_of_length_eq_zero hzero + exact hp.2.2.1 (Sum.inl.inj hvz ▸ hvXd) + have hbetaAbsent : ∀ e : E, Incident G v e → phiD e ≠ some beta := by + intro e hve heb + have hnot : beta ∉ PresentColors G phiD v := + (Finset.mem_sdiff.mp hbetaD).2 + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hve, heb⟩ + have startNeighborUnique := @helper_startNeighborUnique_2406 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@beta) (@v) (@z) (@p) (@hproper) + (@hlength) (@hbetaAbsent) + exact @helper_continuation_264 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@d) (@R) (@beta) (@v) (@z) (@p) (@hv) + (@hbetaD) (@hbetaGamma) (@hp) (@hZsubXd) (@hvXd) (@hproper) (@hglobalD) (@helemD) + (@hclosedD) (@hgammaDef) (@hb0Color) (@hb1Color) (@hexact) (by assumption) (@hb0Support) + (@hb1Support) (@h) (@hhends) (@heffect) (@hhColor) (@a0) (@ha0ends) (@a1) (@ha1ends) + (@hb0u0) (@hu0h) (@hhu1) (@hu1b1) (@hu0Support) (@hhSupport) (@hu1Support) (@hpath) + (@hlength) (@startNeighborUnique) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideTrunkRotationColoring.lean b/LeanPool/GoldbergSeymour/ScheideTrunkRotationColoring.lean new file mode 100644 index 0000000000..fc1b672e6b --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideTrunkRotationColoring.lean @@ -0,0 +1,856 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalCycleEdge +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Scheide Trunk Rotation Coloring + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hshift_adj_205.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (hp3 : (3 : ℕ) ≤ + N.height), + let F : Fin N.height → E := NormalCycleEdge N; + let Y : Fin N.height → V := fun (i : Fin N.height) => T.vertex (Fin.castLE N.height_upper i); + let nxt : Fin N.height → Fin N.height := fun (i : Fin N.height) => (⟨((↑i : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑i : ℕ) + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(0 : ℕ) < + N.height) => + by omega + )⟩ : Fin N.height); Function.Injective Y → ( + ∀ (i : Fin N.height) (v : V), Incident G v (F i) ↔ v = Y i ∨ v = Y (nxt i)) → ( + ∀ (i : Fin N.height), (↑i : ℕ) + (1 : ℕ) < N.height → (↑(nxt i) : ℕ) = (↑i : ℕ) + (1 : ℕ)) → + ∀ (i t : Fin (↑j : ℕ)), i ≠ t → AdjacentEdges G (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) (F + (Fin.castLE (Nat.le_of_lt j.isLt) t)) → (↑i : ℕ) + (1 : ℕ) = (↑t : ℕ) ∨ (↑t : ℕ) + (1 : ℕ) + = (↑i : ℕ) := by + classical + intro V E _ _ _ G k e0 phi T N j hp3 F Y nxt hYinj hinc hnxt_val i t hit had + obtain ⟨v, hvi, hvt⟩ := had + rcases (hinc (Fin.castLE (Nat.le_of_lt j.isLt) i) v).mp hvi with + hil | hir + · rcases (hinc (Fin.castLE (Nat.le_of_lt j.isLt) t) v).mp hvt with + htl | htr + · have he := hYinj (hil.symm.trans htl) + have hv := congrArg Fin.val he + exfalso + apply hit + apply Fin.ext + simpa using hv + · have he := hYinj (hil.symm.trans htr) + have hv := congrArg Fin.val he + rw [hnxt_val _ (by simp; omega)] at hv + right + simpa using hv.symm + · rcases (hinc (Fin.castLE (Nat.le_of_lt j.isLt) t) v).mp hvt with + htl | htr + · have he := hYinj (hir.symm.trans htl) + have hv := congrArg Fin.val he + rw [hnxt_val _ (by simp; omega)] at hv + left + simpa using hv + · have he := hYinj (hir.symm.trans htr) + have hv := congrArg Fin.val he + rw [hnxt_val _ (by simp; omega), hnxt_val _ (by simp; omega)] at hv + exfalso + apply hit + apply Fin.ext + have hv' : i.val + 1 = t.val + 1 := by simpa using hv + omega + +private theorem helper_hno_mixed_241.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (hp3 : (3 : ℕ) ≤ + N.height), + let F : Fin N.height → E := NormalCycleEdge N; + let Y : Fin N.height → V := fun (i : Fin N.height) => T.vertex (Fin.castLE N.height_upper i); + let nxt : Fin N.height → Fin N.height := fun (i : Fin N.height) => (⟨((↑i : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑i : ℕ) + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(0 : ℕ) < + N.height) => + by omega + )⟩ : Fin N.height); ( + ∀ (i : Fin N.height) (v : V), Incident G v (F i) ↔ v = Y i ∨ v = Y (nxt i)) → ( + ∀ (i : Fin N.height), (↑i : ℕ) + (1 : ℕ) < N.height → (↑(nxt i) : ℕ) = (↑i : ℕ) + (1 : ℕ)) → + let psi : PartialEdgeColoring E k := fun (f : E) => if f = F j then none else if h : + ∃ (i : Fin (↑j : ℕ)), f = F (Fin.castLE (Nat.le_of_lt j.isLt) i) then phi (F + (⟨(↑(Classical.choose h) : ℕ) + (1 : ℕ), + have hi : (↑(Classical.choose h) : ℕ) < (↑j : ℕ) := (Classical.choose h).isLt; + Decidable.byContradiction fun (a : ¬(↑(Classical.choose h) : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height)) else phi f; ( + ∀ (i : Fin (↑j : ℕ)), psi (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) = phi (F (⟨(↑i : ℕ) + (1 : + ℕ), Decidable.byContradiction fun (a : ¬(↑i : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height))) → IsProperEdgeColoring G phi → ( + ∀ (q : Fin N.height), (1 : ℕ) ≤ (↑q : ℕ) → phi (F q) = if Odd (↑q : ℕ) then some N.alpha else + some N.beta) → + let z : Fin N.height := (⟨(0 : ℕ), Decidable.byContradiction fun (a : ¬(0 : ℕ) < N.height) => + by omega + ⟩ : Fin N.height); + let o : Fin N.height := (⟨(1 : ℕ), Decidable.byContradiction fun (a : ¬(1 : ℕ) < N.height) => + by omega + ⟩ : Fin N.height); ( + ∀ (f : E), Incident G (Y z) f → phi f ≠ some N.alpha) → ( + ∀ (f : E), Incident G (Y o) f → phi f ≠ some N.beta) → + ∀ (i : Fin (↑j : ℕ)) (f : E), f ≠ F j → (¬ + ∃ (t : Fin (↑j : ℕ)), f = F (Fin.castLE (Nat.le_of_lt j.isLt) t)) → AdjacentEdges G (F + (Fin.castLE (Nat.le_of_lt j.isLt) i)) f → + ∀ (c : Fin k), psi (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) = some c → phi f ≠ some c := by + classical + intro V E _ _ _ G k e0 phi T N j hp3 F Y nxt hinc hnxt_val psi hpsi_shift holdProper hcolors' z + o halpha_absent hbeta_absent i f hfj hfs had c hci + have hisucc : i.val + 1 < N.height := by + have hi := i.isLt + have hjlt := j.isLt + omega + let succ : Fin N.height := ⟨i.val + 1, hisucc⟩ + have hcarrier : phi (F succ) = some c := by + rw [← hpsi_shift i] + simpa [succ] using hci + have hf_succ : f ≠ F succ := by + intro he + by_cases heq : i.val + 1 = j.val + · apply hfj + rw [he] + apply congrArg F + apply Fin.ext + exact heq + · apply hfs + let t : Fin j.val := ⟨i.val + 1, by omega⟩ + refine ⟨t, ?_⟩ + rw [he] + apply congrArg F + apply Fin.ext + rfl + obtain ⟨v, hvi, hvf⟩ := had + rcases (hinc (Fin.castLE (Nat.le_of_lt j.isLt) i) v).mp hvi with + hleft | hright + · by_cases hi0 : i.val = 0 + · have hcol : c = N.alpha := by + have hc := hcolors' succ (by simp [succ]) + rw [ite_eq_left (by simp [succ, hi0])] at hc + rw [hcarrier] at hc + simpa using hc + intro hfc + apply halpha_absent f + · rw [hleft] at hvf + have hindex : Fin.castLE (Nat.le_of_lt j.isLt) i = z := by + apply Fin.ext + simp [z, hi0] + rwa [hindex] at hvf + simpa [hcol] using hfc + · by_cases hi1 : i.val = 1 + · have hcol : c = N.beta := by + have hc := hcolors' succ (by simp [succ]) + rw [ite_eq_right (by simp [succ, hi1] : ¬ Odd succ.val)] at hc + rw [hcarrier] at hc + simpa using hc + intro hfc + apply hbeta_absent f + · rw [hleft] at hvf + have hindex : Fin.castLE (Nat.le_of_lt j.isLt) i = o := by + apply Fin.ext + simp [o, hi1] + rwa [hindex] at hvf + simpa [hcol] using hfc + · let prev : Fin N.height := ⟨i.val - 1, by omega⟩ + have hprev_color : phi (F prev) = some c := by + have hp := hcolors' prev (by simp [prev]; omega) + have hs := hcolors' succ (by simp [succ]) + have hodd : Odd (i.val - 1) ↔ Odd (i.val + 1) := by + have heq : i.val + 1 = (i.val - 1) + 2 := by omega + rw [Nat.odd_iff, Nat.odd_iff] + omega + rw [hcarrier] at hs + by_cases ho : Odd (i.val - 1) + · rw [ite_eq_left ho] at hp + rw [ite_eq_left (hodd.mp ho)] at hs + simpa using hp.trans hs.symm + · rw [ite_eq_right ho] at hp + rw [ite_eq_right (mt hodd.mpr ho)] at hs + simpa using hp.trans hs.symm + have hf_prev : f ≠ F prev := by + intro he + apply hfs + let t : Fin j.val := ⟨i.val - 1, by omega⟩ + refine ⟨t, ?_⟩ + rw [he] + apply congrArg F + apply Fin.ext + rfl + have hadprev : AdjacentEdges G (F prev) f := by + refine ⟨Y (Fin.castLE (Nat.le_of_lt j.isLt) i), ?_, ?_⟩ + · apply (hinc prev _).2 + right + apply congrArg Y + apply Fin.ext + rw [hnxt_val prev (by simp [prev]; omega)] + simp [prev] + omega + · simpa [hleft] using hvf + exact holdProper hf_prev.symm hadprev hprev_color + · have hadold : AdjacentEdges G (F succ) f := by + refine ⟨v, ?_, hvf⟩ + apply (hinc succ v).2 + left + rw [hright] + apply congrArg Y + apply Fin.ext + rw [hnxt_val _ (by simp; omega)] + simp [succ] + exact holdProper hf_succ.symm hadold hcarrier + +private theorem helper_hproperPsi_350.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height), + let F : Fin N.height → E := NormalCycleEdge N; Function.Injective F → ( + ∀ (i : Fin N.height) (hi : (↑i : ℕ) + (1 : ℕ) < N.height), AdjacentEdges G (F i) (F (⟨(↑i : ℕ) + + (1 : ℕ), hi⟩ : Fin N.height))) → + let psi : PartialEdgeColoring E k := fun (f : E) => if f = F j then none else if h : + ∃ (i : Fin (↑j : ℕ)), f = F (Fin.castLE (Nat.le_of_lt j.isLt) i) then phi (F + (⟨(↑(Classical.choose h) : ℕ) + (1 : ℕ), + have hi : (↑(Classical.choose h) : ℕ) < (↑j : ℕ) := (Classical.choose h).isLt; + Decidable.byContradiction fun (a : ¬(↑(Classical.choose h) : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height)) else phi f; psi (F j) = none → ( + ∀ (i : Fin (↑j : ℕ)), psi (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) = phi (F (⟨(↑i : ℕ) + (1 : + ℕ), Decidable.byContradiction fun (a : ¬(↑i : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height))) → IsProperEdgeColoring G phi → ( + ∀ (i t : Fin (↑j : ℕ)), i ≠ t → AdjacentEdges G (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) (F + (Fin.castLE (Nat.le_of_lt j.isLt) t)) → (↑i : ℕ) + (1 : ℕ) = (↑t : ℕ) ∨ (↑t : ℕ) + (1 : ℕ) + = (↑i : ℕ)) → ( + ∀ (i : Fin (↑j : ℕ)) (f : E), f ≠ F j → (¬ + ∃ (t : Fin (↑j : ℕ)), f = F (Fin.castLE (Nat.le_of_lt j.isLt) t)) → AdjacentEdges G (F + (Fin.castLE (Nat.le_of_lt j.isLt) i)) f → + ∀ (c : Fin k), psi (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) = some c → phi f ≠ some c) → + IsProperEdgeColoring G psi := by + classical + intro V E _ _ _ G k e0 phi T N j F hFinj' hadj_succ psi hpsi_j hpsi_shift holdProper hshift_adj + hno_mixed e f c hef had hce + by_cases hej : e = F j + · rw [hej, hpsi_j] at hce + simp at hce + by_cases hfej : f = F j + · rw [hfej, hpsi_j] + simp + by_cases hes : ∃ i : Fin j.val, + e = F (Fin.castLE (Nat.le_of_lt j.isLt) i) + · obtain ⟨i, rfl⟩ := hes + by_cases hfs : ∃ t : Fin j.val, + f = F (Fin.castLE (Nat.le_of_lt j.isLt) t) + · obtain ⟨t, rfl⟩ := hfs + have hit : i ≠ t := by + intro he + subst t + exact hef rfl + have hind := hshift_adj i t hit had + rw [hpsi_shift i] at hce + rw [hpsi_shift t] + rcases hind with hit | hti + · let qi : Fin N.height := ⟨i.val + 1, by omega⟩ + let qt : Fin N.height := ⟨t.val + 1, by omega⟩ + have hqne : F qi ≠ F qt := by + intro he + have hh := hFinj' he + have hv := congrArg Fin.val hh + simp [qi, qt, hit] at hv + have hqadj : AdjacentEdges G (F qi) (F qt) := by + have ha := hadj_succ qi (by simp [qi]; omega) + simpa [qi, qt, hit] using ha + exact holdProper hqne hqadj hce + · let qt : Fin N.height := ⟨t.val + 1, by omega⟩ + let qi : Fin N.height := ⟨i.val + 1, by omega⟩ + have hqne : F qi ≠ F qt := by + intro he + have hh := hFinj' he + have hv := congrArg Fin.val hh + simp [qi, qt, hti] at hv + have hqadj : AdjacentEdges G (F qi) (F qt) := by + have ha := hadj_succ qt (by simp [qt]; omega) + rcases ha with ⟨v, hv1, hv2⟩ + exact ⟨v, by simpa [qt, qi, hti] using hv2, + by simpa [qt, qi, hti] using hv1⟩ + exact holdProper hqne hqadj hce + · rw [show psi f = phi f by simp [psi, hfej, hfs]] + exact hno_mixed i f hfej hfs had c (by simpa using hce) + · have hpse : psi e = phi e := by simp [psi, hej, hes] + by_cases hfs : ∃ t : Fin j.val, + f = F (Fin.castLE (Nat.le_of_lt j.isLt) t) + · obtain ⟨t, rfl⟩ := hfs + intro hcf + obtain ⟨v, hve, hvt⟩ := had + have hno := hno_mixed t e hej hes + ⟨v, hvt, hve⟩ c hcf + exact hno (by simpa [hpse] using hce) + · rw [show psi f = phi f by simp [psi, hfej, hfs]] + exact holdProper hef had (by simpa [hpse] using hce) + +private theorem helper_hmissingA_443.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height), (1 : ℕ) ≤ (↑j : ℕ) + → + ∀ (hp3 : (3 : ℕ) ≤ N.height), + let F : Fin N.height → E := NormalCycleEdge N; + let Y : Fin N.height → V := fun (i : Fin N.height) => T.vertex (Fin.castLE N.height_upper i); + let nxt : Fin N.height → Fin N.height := fun (i : Fin N.height) => (⟨((↑i : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑i : ℕ) + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(0 : ℕ) < + N.height) => + by omega + )⟩ : Fin N.height); Function.Injective Y → ( + ∀ (i : Fin N.height) (v : V), Incident G v (F i) ↔ v = Y i ∨ v = Y (nxt i)) → ( + ∀ (i : Fin N.height), (↑i : ℕ) + (1 : ℕ) < N.height → (↑(nxt i) : ℕ) = (↑i : ℕ) + (1 : ℕ)) → + let A : Fin k := if Odd (↑j : ℕ) then N.beta else N.alpha; + let B : Fin k := if Odd (↑j : ℕ) then N.alpha else N.beta; A ≠ B → + let psi : PartialEdgeColoring E k := fun (f : E) => if f = F j then none else if h : + ∃ (i : Fin (↑j : ℕ)), f = F (Fin.castLE (Nat.le_of_lt j.isLt) i) then phi (F + (⟨(↑(Classical.choose h) : ℕ) + (1 : ℕ), + have hi : (↑(Classical.choose h) : ℕ) < (↑j : ℕ) := (Classical.choose h).isLt; + Decidable.byContradiction fun (a : ¬(↑(Classical.choose h) : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height)) else phi f; psi (F j) = none → ( + ∀ (i : Fin (↑j : ℕ)), psi (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) = phi (F (⟨(↑i : ℕ) + (1 : + ℕ), Decidable.byContradiction fun (a : ¬(↑i : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height))) → IsProperEdgeColoring G phi → ( + ∀ (q : Fin N.height), (1 : ℕ) ≤ (↑q : ℕ) → phi (F q) = if Odd (↑q : ℕ) then some N.alpha else + some N.beta) → + let o : Fin N.height := (⟨(1 : ℕ), Decidable.byContradiction fun (a : ¬(1 : ℕ) < N.height) => + by omega + ⟩ : Fin N.height); ( + ∀ (f : E), Incident G (Y o) f → phi f ≠ some N.beta) → phi (F j) = some B → A ∈ MissingColors + G psi (Y j) := by + classical + intro V E _ _ _ G k e0 phi T N j hj hp3 F Y nxt hYinj hinc hnxt_val A B hAB psi hpsi_j + hpsi_shift holdProper hcolors' o hbeta_absent hphi_j + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_exists, not_and] + intro f hfinc + by_cases hfj : f = F j + · rw [hfj, hpsi_j] + simp + by_cases hfs : ∃ t : Fin j.val, + f = F (Fin.castLE (Nat.le_of_lt j.isLt) t) + · obtain ⟨t, rfl⟩ := hfs + have htinc := hfinc + rcases (hinc (Fin.castLE (Nat.le_of_lt j.isLt) t) (Y j)).mp htinc with + hleft | hright + · have he := hYinj hleft + have hv := congrArg Fin.val he + simp at hv + omega + · have he := hYinj hright + have hv := congrArg Fin.val he + rw [hnxt_val _ (by simp; omega)] at hv + have htj : t.val + 1 = j.val := by simpa using hv.symm + rw [hpsi_shift t] + have hindex : (⟨t.val + 1, by omega⟩ : Fin N.height) = j := by + apply Fin.ext + exact htj + rw [hindex, hphi_j] + intro heq + exact hAB (Option.some.inj heq).symm + · have hpsif : psi f = phi f := by simp [psi, hfj, hfs] + by_cases hj1 : j.val = 1 + · have hA : A = N.beta := by + have hjodd : Odd j.val := by simp [hj1] + simp [A, hjodd] + rw [hpsif] + intro hfc + apply hbeta_absent f + · have hindex : j = o := by + apply Fin.ext + simpa [o] using hj1 + simpa [hindex] using hfinc + simpa [hA] using hfc + · have hj2 : 2 ≤ j.val := by omega + let prev : Fin N.height := ⟨j.val - 1, by omega⟩ + have hprevA : phi (F prev) = some A := by + have hc := hcolors' prev (by simp [prev]; omega) + have hpar : Odd (j.val - 1) ↔ ¬ Odd j.val := by + rw [Nat.odd_iff, Nat.not_odd_iff] + omega + by_cases ho : Odd j.val + · rw [ite_eq_right (fun hp => hpar.mp hp ho)] at hc + simpa [A, ho] using hc + · rw [ite_eq_left (hpar.mpr ho)] at hc + simpa [A, ho] using hc + have hfprev : f ≠ F prev := by + intro he + apply hfs + let t : Fin j.val := ⟨j.val - 1, by omega⟩ + refine ⟨t, ?_⟩ + rw [he] + apply congrArg F + apply Fin.ext + rfl + have hprevinc : Incident G (Y j) (F prev) := by + apply (hinc prev _).2 + right + apply congrArg Y + apply Fin.ext + rw [hnxt_val prev (by simp [prev]; omega)] + simp [prev] + omega + rw [hpsif] + exact holdProper hfprev.symm ⟨Y j, hprevinc, hfinc⟩ hprevA + +private theorem helper_hmissingB_515.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (hp3 : (3 : ℕ) ≤ + N.height), Odd N.height → + let F : Fin N.height → E := NormalCycleEdge N; + let Y : Fin N.height → V := fun (i : Fin N.height) => T.vertex (Fin.castLE N.height_upper i); + let nxt : Fin N.height → Fin N.height := fun (i : Fin N.height) => (⟨((↑i : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑i : ℕ) + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(0 : ℕ) < + N.height) => + by omega + )⟩ : Fin N.height); Function.Injective Y → ( + ∀ (i : Fin N.height) (v : V), Incident G v (F i) ↔ v = Y i ∨ v = Y (nxt i)) → ( + ∀ (i : Fin N.height), (↑i : ℕ) + (1 : ℕ) < N.height → (↑(nxt i) : ℕ) = (↑i : ℕ) + (1 : ℕ)) → + N.alpha ≠ N.beta → + let B : Fin k := if Odd (↑j : ℕ) then N.alpha else N.beta; + let psi : PartialEdgeColoring E k := fun (f : E) => if f = F j then none else if h : + ∃ (i : Fin (↑j : ℕ)), f = F (Fin.castLE (Nat.le_of_lt j.isLt) i) then phi (F + (⟨(↑(Classical.choose h) : ℕ) + (1 : ℕ), + have hi : (↑(Classical.choose h) : ℕ) < (↑j : ℕ) := (Classical.choose h).isLt; + Decidable.byContradiction fun (a : ¬(↑(Classical.choose h) : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height)) else phi f; psi (F j) = none → ( + ∀ (i : Fin (↑j : ℕ)), psi (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) = phi (F (⟨(↑i : ℕ) + (1 : + ℕ), Decidable.byContradiction fun (a : ¬(↑i : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height))) → IsProperEdgeColoring G phi → ( + ∀ (q : Fin N.height), (1 : ℕ) ≤ (↑q : ℕ) → phi (F q) = if Odd (↑q : ℕ) then some N.alpha else + some N.beta) → phi (F j) = some B → B ∈ MissingColors G psi (Y (nxt j)) := by + classical + intro V E _ _ _ G k e0 phi T N j hp3 hpodd F Y nxt hYinj hinc hnxt_val hab B psi hpsi_j + hpsi_shift holdProper hcolors' hphi_j + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_exists, not_and] + intro f hfinc + by_cases hfj : f = F j + · rw [hfj, hpsi_j] + simp + by_cases hfs : ∃ t : Fin j.val, + f = F (Fin.castLE (Nat.le_of_lt j.isLt) t) + · obtain ⟨t, rfl⟩ := hfs + rcases (hinc (Fin.castLE (Nat.le_of_lt j.isLt) t) (Y (nxt j))).mp hfinc with + hleft | hright + · have he := hYinj hleft + have hv := congrArg Fin.val he + by_cases hjlast : j.val + 1 = N.height + · have ht0 : t.val = 0 := by simpa [nxt, hjlast] using hv.symm + have hjEven : ¬ Odd j.val := by + have hpj : Odd (j.val + 1) := by simpa [hjlast] using hpodd + exact (Nat.odd_add_one.mp hpj) + have hc := hcolors' ⟨1, by omega⟩ (by simp) + rw [hpsi_shift t] + have hindex : (⟨t.val + 1, by omega⟩ : Fin N.height) = + ⟨1, by omega⟩ := by + apply Fin.ext + simp [ht0] + rw [hindex] + rw [hc] + simpa [B, hjEven] using hab + · rw [hnxt_val j (by omega)] at hv + simp at hv + omega + · have he := hYinj hright + have htbound : t.val + 1 < N.height := by + have ht := t.isLt + have hjlt := j.isLt + omega + have hv : (j.val + 1) % N.height = t.val + 1 := by + have hv' := congrArg Fin.val he + simpa [nxt, Nat.mod_eq_of_lt htbound] using hv' + by_cases hjlast : j.val + 1 = N.height + · simp [hjlast] at hv + · rw [Nat.mod_eq_of_lt (by omega)] at hv + omega + · have hpsif : psi f = phi f := by simp [psi, hfj, hfs] + have hjinc : Incident G (Y (nxt j)) (F j) := by + apply (hinc j _).2 + exact Or.inr rfl + rw [hpsif] + exact holdProper (Ne.symm hfj) ⟨Y (nxt j), hjinc, hfinc⟩ hphi_j + +private theorem helper_hpsi_shift_646.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height), + let F : Fin N.height → E := NormalCycleEdge N; Function.Injective F → + let psi : PartialEdgeColoring E k := fun (f : E) => if f = F j then none else if h : + ∃ (i : Fin (↑j : ℕ)), f = F (Fin.castLE (Nat.le_of_lt j.isLt) i) then phi (F + (⟨(↑(Classical.choose h) : ℕ) + (1 : ℕ), + have hi : (↑(Classical.choose h) : ℕ) < (↑j : ℕ) := (Classical.choose h).isLt; + Decidable.byContradiction fun (a : ¬(↑(Classical.choose h) : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height)) else phi f; + ∀ (i : Fin (↑j : ℕ)), psi (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) = phi (F (⟨(↑i : ℕ) + (1 : + ℕ), Decidable.byContradiction fun (a : ¬(↑i : ℕ) + (1 : ℕ) < N.height) => ( + by first | omega + )⟩ : Fin N.height)) := by + classical + intro V E _ _ _ G k e0 phi T N j F hFinj' psi i + have hne : F (Fin.castLE (Nat.le_of_lt j.isLt) i) ≠ F j := by + intro he + have hh := hFinj' he + have hv := congrArg Fin.val hh + simp at hv + omega + have hex : ∃ t : Fin j.val, + F (Fin.castLE (Nat.le_of_lt j.isLt) i) = + F (Fin.castLE (Nat.le_of_lt j.isLt) t) := ⟨i, rfl⟩ + rw [show psi (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) = + (if F (Fin.castLE (Nat.le_of_lt j.isLt) i) = F j then none + else if h : ∃ t : Fin j.val, + F (Fin.castLE (Nat.le_of_lt j.isLt) i) = + F (Fin.castLE (Nat.le_of_lt j.isLt) t) then + phi (F ⟨(Classical.choose h).val + 1, by + have ht := (Classical.choose h).isLt + omega⟩) + else phi (F (Fin.castLE (Nat.le_of_lt j.isLt) i))) by rfl] + rw [ite_eq_right hne, dite_eq_left hex] + apply congrArg phi + apply congrArg F + apply Fin.ext + have hspec := Classical.choose_spec hex + have hind := hFinj' hspec + simpa using congrArg Fin.val hind.symm + +private theorem helper_honePsi_734.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height), (1 : ℕ) ≤ (↑j : ℕ) + → + ∀ (hp3 : (3 : ℕ) ≤ N.height), + let F : Fin N.height → E := NormalCycleEdge N; F (⟨(0 : ℕ), Decidable.byContradiction fun (a : + ¬(0 : ℕ) < N.height) => + by omega + ⟩ : Fin N.height) = e0 → + let psi : PartialEdgeColoring E k := fun (f : E) => if f = F j then none else if h : + ∃ (i : Fin (↑j : ℕ)), f = F (Fin.castLE (Nat.le_of_lt j.isLt) i) then phi (F + (⟨(↑(Classical.choose h) : ℕ) + (1 : ℕ), + have hi : (↑(Classical.choose h) : ℕ) < (↑j : ℕ) := (Classical.choose h).isLt; + Decidable.byContradiction fun (a : ¬(↑(Classical.choose h) : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height)) else phi f; psi (F j) = none → ( + ∀ (i : Fin (↑j : ℕ)), psi (F (Fin.castLE (Nat.le_of_lt j.isLt) i)) = phi (F (⟨(↑i : ℕ) + (1 : + ℕ), Decidable.byContradiction fun (a : ¬(↑i : ℕ) + (1 : ℕ) < N.height) => ( + by first | omega + )⟩ : Fin N.height))) → IsOneEdgeUncolored phi e0 → ( + ∀ (q : Fin N.height), (1 : ℕ) ≤ (↑q : ℕ) → phi (F q) = if Odd (↑q : ℕ) then some N.alpha else + some N.beta) → IsOneEdgeUncolored psi (F j) := by + classical + intro V E _ _ _ G k e0 phi T N j hj hp3 F hFzero psi hpsi_j hpsi_shift holdOne hcolors' + refine ⟨hpsi_j, ?_⟩ + intro f hfj + by_cases hfs : ∃ i : Fin j.val, + f = F (Fin.castLE (Nat.le_of_lt j.isLt) i) + · obtain ⟨i, rfl⟩ := hfs + have hisucc : i.val + 1 < N.height := by + have hi := i.isLt + have hjlt := j.isLt + omega + have hc := hcolors' ⟨i.val + 1, hisucc⟩ (by simp) + rw [hpsi_shift i] + by_cases ho : Odd (i.val + 1) + · exact ⟨N.alpha, by simpa [ho] using hc⟩ + · exact ⟨N.beta, by simpa [ho] using hc⟩ + · have hf0 : f ≠ e0 := by + intro he + apply hfs + let i : Fin j.val := ⟨0, by omega⟩ + refine ⟨i, ?_⟩ + calc + f = e0 := he + _ = F ⟨0, by omega⟩ := hFzero.symm + _ = F (Fin.castLE (Nat.le_of_lt j.isLt) i) := by + apply congrArg F + apply Fin.ext + rfl + obtain ⟨c, hc⟩ := holdOne.2 f hf0 + exact ⟨c, by simpa [psi, hfj, hfs] using hc⟩ + +private theorem helper_htail_772.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (hp3 : (3 : ℕ) ≤ + N.height), + let F : Fin N.height → E := NormalCycleEdge N; + let Y : Fin N.height → V := fun (i : Fin N.height) => T.vertex (Fin.castLE N.height_upper i); + let nxt : Fin N.height → Fin N.height := fun (i : Fin N.height) => (⟨((↑i : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑i : ℕ) + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(0 : ℕ) < + N.height) => + by omega + )⟩ : Fin N.height); ( + ∀ (i : Fin N.height), G.ends (F i) = s(Y i, Y (nxt i))) → + let psi : PartialEdgeColoring E k := fun (f : E) => if f = F j then none else if h : + ∃ (i : Fin (↑j : ℕ)), f = F (Fin.castLE (Nat.le_of_lt j.isLt) i) then phi (F + (⟨(↑(Classical.choose h) : ℕ) + (1 : ℕ), + have hi : (↑(Classical.choose h) : ℕ) < (↑j : ℕ) := (Classical.choose h).isLt; + Decidable.byContradiction fun (a : ¬(↑(Classical.choose h) : ℕ) + (1 : ℕ) < N.height) => + by + omega + ⟩ : Fin N.height)) else phi f; ( + ∀ (f : E), ( + ∀ (i : Fin ((↑j : ℕ) + (1 : ℕ))), f ≠ F (Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i)) → psi f = + phi f) → + ∀ (r : Fin T.length), N.height - (1 : ℕ) ≤ (↑r : ℕ) → psi (T.edge r) = phi (T.edge r) := by + classical + intro V E _ _ _ G k e0 phi T N j hp3 F Y nxt hends' psi hpsi_fixed r hr + apply hpsi_fixed + intro i he + let q : Fin N.height := + Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i + obtain ⟨a, ha⟩ := T.attaches r + have hpairs : + s(T.vertex r.succ, + T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt)))) = + s(Y q, Y (nxt q)) := by + rw [← ha, he] + exact hends' q + rcases Sym2.eq_iff.mp hpairs with hd | hs + · have hv := T.vertex_injective hd.1 + have hval := congrArg Fin.val hv + change r.val + 1 = q.val at hval + have hq : q.val < N.height := q.isLt + omega + · have hv := T.vertex_injective hs.1 + have hval := congrArg Fin.val hv + change r.val + 1 = (Fin.castLE N.height_upper (nxt q)).val at hval + have hq : (nxt q).val < N.height := (nxt q).isLt + simp at hval + omega + +theorem ScheideTrunkRotationColoring {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hbalanced : BalancedGlobalMaximumTriple N) + (j : Fin N.height) (hj : 1 ≤ j.val) : + ∃ (psi : PartialEdgeColoring E k) (A B : Fin k), + A ≠ B ∧ + A = (if Odd j.val then N.beta else N.alpha) ∧ + B = (if Odd j.val then N.alpha else N.beta) ∧ + IsProperEdgeColoring G psi ∧ + IsOneEdgeUncolored psi (NormalCycleEdge N j) ∧ + A ∈ MissingColors G psi (T.vertex (Fin.castLE N.height_upper j)) ∧ + B ∈ + MissingColors G psi + (T.vertex + (Fin.castLE N.height_upper + ⟨(j.val + 1) % N.height, by + exact + Nat.mod_lt _ + (by + have hp := N.height_lower + omega)⟩)) ∧ + (∀ i : Fin j.val, + psi (NormalCycleEdge N (Fin.castLE (Nat.le_of_lt j.isLt) i)) = + phi + (NormalCycleEdge N + ⟨i.val + 1, by + have hi := i.isLt + have _ := j.isLt + omega⟩)) ∧ + (∀ f : E, + (∀ i : Fin (j.val + 1), + f ≠ + NormalCycleEdge N + (Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i)) → + psi f = phi f) ∧ + ∀ r : Fin T.length, + N.height - 1 ≤ r.val → psi (T.edge r) = phi (T.edge r) := by + classical + obtain ⟨hp3, hpodd, hFinj, hends, hcolors⟩ := + ScheideTrunkRotationCycle G k e0 phi T N hbalanced + let F : Fin N.height → E := NormalCycleEdge N + let Y : Fin N.height → V := fun i => + T.vertex (Fin.castLE N.height_upper i) + let nxt : Fin N.height → Fin N.height := fun i => + ⟨(i.val + 1) % N.height, Nat.mod_lt _ (by omega)⟩ + have hFinj' : Function.Injective F := by + simpa [F] using hFinj + have hYinj : Function.Injective Y := by + intro a b hab + apply Fin.ext + have hcast := T.vertex_injective hab + simpa using congrArg Fin.val hcast + have hends' (i : Fin N.height) : + G.ends (F i) = s(Y i, Y (nxt i)) := by + simpa [F, Y, nxt] using hends i + have hinc (i : Fin N.height) (v : V) : + Incident G v (F i) ↔ v = Y i ∨ v = Y (nxt i) := by + rw [Incident, hends' i] + simp + have hnxt_val (i : Fin N.height) (hi : i.val + 1 < N.height) : + (nxt i).val = i.val + 1 := by + simp [nxt, Nat.mod_eq_of_lt hi] + have hadj_succ (i : Fin N.height) (hi : i.val + 1 < N.height) : + AdjacentEdges G (F i) + (F ⟨i.val + 1, hi⟩) := by + refine ⟨Y ⟨i.val + 1, hi⟩, ?_, ?_⟩ + · apply (hinc i _).2 + right + apply congrArg Y + apply Fin.ext + exact (hnxt_val i hi).symm + · apply (hinc ⟨i.val + 1, hi⟩ _).2 + exact Or.inl rfl + have hFzero : F ⟨0, by omega⟩ = e0 := by + simp [F, NormalCycleEdge] + have hab : N.alpha ≠ N.beta := by + intro heq + let one : Fin N.height := ⟨1, by omega⟩ + have hone : phi (F one) = some N.alpha := by + simpa [F, one] using hcolors one (by simp [one]) + have hi : Incident G (Y one) (F one) := by + apply (hinc one _).2 + exact Or.inl rfl + have hpresent : N.beta ∈ PresentColors G phi (Y one) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨F one, hi, by simpa [heq] using hone⟩ + have hmissing : N.beta ∉ PresentColors G phi (Y one) := by + simpa [MissingColors, Y, one] using N.beta_missing + exact hmissing hpresent + let A : Fin k := if Odd j.val then N.beta else N.alpha + let B : Fin k := if Odd j.val then N.alpha else N.beta + have hAB : A ≠ B := by + by_cases ho : Odd j.val + · simpa [A, B, ho] using hab.symm + · simpa [A, B, ho] using hab + let psi : PartialEdgeColoring E k := fun f => + if f = F j then none + else if h : ∃ i : Fin j.val, + f = F (Fin.castLE (Nat.le_of_lt j.isLt) i) then + phi (F ⟨(Classical.choose h).val + 1, by + have hi := (Classical.choose h).isLt + omega⟩) + else phi f + have hpsi_j : psi (F j) = none := by + simp [psi] + have hpsi_shift := @helper_hpsi_shift_646 V E inferInstance inferInstance inferInstance G k e0 phi + T N j hFinj' + have hpsi_fixed (f : E) + (hf : ∀ i : Fin (j.val + 1), + f ≠ F (Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i)) : + psi f = phi f := by + have hfj : f ≠ F j := by + let q : Fin (j.val + 1) := ⟨j.val, Nat.lt_succ_self _⟩ + simpa [q] using hf q + have hs : ¬ ∃ i : Fin j.val, + f = F (Fin.castLE (Nat.le_of_lt j.isLt) i) := by + rintro ⟨i, hi⟩ + let q : Fin (j.val + 1) := ⟨i.val, by omega⟩ + apply hf q + refine hi.trans ?_ + apply congrArg F + apply Fin.ext + rfl + simp [psi, hfj, hs] + have holdProper : IsProperEdgeColoring G phi := N.global.1.2.2.2.1 + have holdOne : IsOneEdgeUncolored phi e0 := N.global.1.2.2.2.2 + have hcolors' (q : Fin N.height) (hq : 1 ≤ q.val) : + phi (F q) = if Odd q.val then some N.alpha else some N.beta := by + simpa [F] using hcolors q hq + let z : Fin N.height := ⟨0, by omega⟩ + let o : Fin N.height := ⟨1, by omega⟩ + have halpha_absent (f : E) (hf : Incident G (Y z) f) : + phi f ≠ some N.alpha := by + intro hfc + have hpresent : N.alpha ∈ PresentColors G phi (Y z) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hf, hfc⟩ + have hmissing : N.alpha ∉ PresentColors G phi (Y z) := by + simpa [MissingColors, Y, z] using N.alpha_missing + exact hmissing hpresent + have hbeta_absent (f : E) (hf : Incident G (Y o) f) : + phi f ≠ some N.beta := by + intro hfc + have hpresent : N.beta ∈ PresentColors G phi (Y o) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hf, hfc⟩ + have hmissing : N.beta ∉ PresentColors G phi (Y o) := by + simpa [MissingColors, Y, o] using N.beta_missing + exact hmissing hpresent + have hshift_adj := @helper_hshift_adj_205 V E inferInstance inferInstance inferInstance G k e0 phi + T N j hp3 hYinj hinc hnxt_val + have hno_mixed := @helper_hno_mixed_241 V E inferInstance inferInstance inferInstance G k e0 phi T + N j hp3 hinc hnxt_val hpsi_shift holdProper hcolors' halpha_absent hbeta_absent + have hproperPsi := @helper_hproperPsi_350 V E inferInstance inferInstance inferInstance G k e0 phi + T N j hFinj' hadj_succ hpsi_j hpsi_shift holdProper hshift_adj hno_mixed + have honePsi := @helper_honePsi_734 V E inferInstance inferInstance inferInstance G k e0 phi T N j + hj hp3 hFzero hpsi_j hpsi_shift holdOne hcolors' + have hphi_j : phi (F j) = some B := by + have hc := hcolors' j hj + by_cases ho : Odd j.val + · simpa [B, ho] using hc + · simpa [B, ho] using hc + have hmissingA := @helper_hmissingA_443 V E inferInstance inferInstance inferInstance G k e0 phi T + N j hj hp3 hYinj hinc hnxt_val hAB hpsi_j hpsi_shift holdProper hcolors' hbeta_absent hphi_j + have hmissingB := @helper_hmissingB_515 V E inferInstance inferInstance inferInstance G k e0 phi T + N j hp3 hpodd hYinj hinc hnxt_val hab hpsi_j hpsi_shift holdProper hcolors' hphi_j + have htail := @helper_htail_772 V E inferInstance inferInstance inferInstance G k e0 phi T N j hp3 + hends' hpsi_fixed + refine ⟨psi, A, B, hAB, rfl, rfl, hproperPsi, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · simpa [F] using honePsi + · simpa [Y] using hmissingA + · simpa [Y, nxt] using hmissingB + · intro i + simpa [F] using hpsi_shift i + · intro f hf + apply hpsi_fixed f + simpa [F] using hf + · exact htail + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideTrunkRotationCycle.lean b/LeanPool/GoldbergSeymour/ScheideTrunkRotationCycle.lean new file mode 100644 index 0000000000..566fe23237 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideTrunkRotationCycle.lean @@ -0,0 +1,373 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalCycleEdge +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd +public import LeanPool.GoldbergSeymour.ScheideGraphHeight +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Trunk Rotation Cycle + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_hends_75.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hheight : (3 : ℕ) ≤ N.height ∧ Odd + N.height), ( + ∀ (i : Fin N.height), (↑i : ℕ) = (0 : ℕ) → NormalCycleEdge N i = e0) → ( + ∀ (i : Fin N.height), (↑i : ℕ) + (1 : ℕ) = N.height → NormalCycleEdge N i = N.closingEdge) → ( + ∀ (i : Fin N.height), (1 : ℕ) ≤ (↑i : ℕ) → + ∀ (hbefore : (↑i : ℕ) + (1 : ℕ) < N.height), NormalCycleEdge N i = T.edge (⟨(↑i : ℕ), + have hu : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a : + ¬(↑i : ℕ) < T.length) => + by omega + ⟩ : Fin T.length)) → + ∀ (i : Fin N.height), G.ends (NormalCycleEdge N i) = s(T.vertex (Fin.castLE N.height_upper i), + T.vertex (Fin.castLE N.height_upper (⟨((↑i : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt ((↑i : + ℕ) + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(0 : ℕ) < N.height) => + by omega + )⟩ : Fin N.height))) := by + classical + intro V E _ _ _ G k e0 phi T N hheight hcycle_zero hcycle_last hcycle_internal i + by_cases hz : i.val = 0 + · let z : Fin T.length := ⟨0, T.positive⟩ + obtain ⟨a, ha⟩ := T.attaches z + calc + G.ends (NormalCycleEdge N i) = G.ends e0 := + congrArg G.ends (hcycle_zero i hz) + _ = G.ends (T.edge z) := + congrArg G.ends T.first_edge.symm + _ = s(T.vertex z.succ, + T.vertex (Fin.castLT a (Nat.lt_trans a.isLt + (Nat.succ_lt_succ z.isLt)))) := ha + _ = s(T.vertex (Fin.castLE N.height_upper i), + T.vertex (Fin.castLE N.height_upper + ⟨(i.val + 1) % N.height, Nat.mod_lt _ (by omega)⟩)) := by + apply Sym2.eq_iff.mpr + right + constructor + · apply congrArg T.vertex + apply Fin.ext + simp [z, hz, Nat.mod_eq_of_lt (by omega : 1 < N.height)] + · apply congrArg T.vertex + apply Fin.ext + simp [z, hz] + · by_cases hl : i.val + 1 = N.height + · calc + G.ends (NormalCycleEdge N i) = G.ends N.closingEdge := + congrArg G.ends (hcycle_last i hl) + _ = s(T.vertex N.lastIndex, + T.vertex ⟨0, Nat.zero_lt_succ T.length⟩) := N.closing_ends + _ = s(T.vertex (Fin.castLE N.height_upper i), + T.vertex (Fin.castLE N.height_upper + ⟨(i.val + 1) % N.height, Nat.mod_lt _ (by omega)⟩)) := by + apply Sym2.eq_iff.mpr + left + constructor + · apply congrArg T.vertex + apply Fin.ext + change N.lastIndex.val = i.val + have hlastIndex := N.lastIndex_height + omega + · apply congrArg T.vertex + apply Fin.ext + simp [hl] + · have hbefore : i.val + 1 < N.height := by omega + let r : Fin T.length := ⟨i.val, by + have hu := N.height_upper + omega⟩ + calc + G.ends (NormalCycleEdge N i) = G.ends (T.edge r) := by + exact congrArg G.ends (hcycle_internal i (by omega) hbefore) + _ = s(T.vertex ⟨r.val, Nat.lt_succ_of_lt r.isLt⟩, + T.vertex r.succ) := + N.trunk_edge_ends r (by simp [r]; omega) (by simp [r]; omega) + _ = s(T.vertex (Fin.castLE N.height_upper i), + T.vertex (Fin.castLE N.height_upper + ⟨(i.val + 1) % N.height, Nat.mod_lt _ (by omega)⟩)) := by + apply Sym2.eq_iff.mpr + left + constructor + · apply congrArg T.vertex + apply Fin.ext + simp [r] + · apply congrArg T.vertex + apply Fin.ext + change i.val + 1 = (i.val + 1) % N.height + rw [Nat.mod_eq_of_lt hbefore] + +private theorem helper_hinjective_193.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hheight : (3 : ℕ) ≤ N.height ∧ Odd + N.height), ( + ∀ (i : Fin N.height), (↑i : ℕ) = (0 : ℕ) → NormalCycleEdge N i = e0) → ( + ∀ (i : Fin N.height), G.ends (NormalCycleEdge N i) = s(T.vertex (Fin.castLE N.height_upper i), + T.vertex (Fin.castLE N.height_upper (⟨((↑i : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt ((↑i : + ℕ) + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(0 : ℕ) < N.height) => + by + omega + )⟩ : Fin N.height)))) → ( + ∀ (i : Fin N.height), (1 : ℕ) ≤ (↑i : ℕ) → phi (NormalCycleEdge N i) = some N.alpha ∨ phi + (NormalCycleEdge N i) = some N.beta) → Function.Injective (NormalCycleEdge N) := by + classical + intro V E _ _ _ G k e0 phi T N hheight hcycle_zero hends hpositive_color i j hij + by_cases iz : i.val = 0 + · by_cases jz : j.val = 0 + · apply Fin.ext + omega + · have hi0 : phi (NormalCycleEdge N i) = none := + (congrArg phi (hcycle_zero i iz)).trans N.global.1.2.2.2.2.1 + rcases hpositive_color j (by omega) with hj | hj + · rw [← hij, hi0] at hj + simp at hj + · rw [← hij, hi0] at hj + simp at hj + · by_cases jz : j.val = 0 + · have hj0 : phi (NormalCycleEdge N j) = none := + (congrArg phi (hcycle_zero j jz)).trans N.global.1.2.2.2.2.1 + rcases hpositive_color i (by omega) with hi | hi + · rw [hij, hj0] at hi + simp at hi + · rw [hij, hj0] at hi + simp at hi + · have hpairs := congrArg (fun e => G.ends e) hij + rw [hends i, hends j] at hpairs + rcases Sym2.eq_iff.mp hpairs with hd | hs + · have hfirst : i.val = j.val := by + have hv := T.vertex_injective hd.1 + simpa using congrArg Fin.val hv + exact Fin.ext hfirst + · have hi_next : (i.val + 1) % N.height = j.val := by + have hv := T.vertex_injective hs.2 + simpa using congrArg Fin.val hv + have hj_next : (j.val + 1) % N.height = i.val := by + have hv := T.vertex_injective hs.1 + simpa using (congrArg Fin.val hv).symm + by_cases il : i.val + 1 = N.height + · have : j.val = 0 := by simpa [il] using hi_next.symm + exact (jz this).elim + · by_cases jl : j.val + 1 = N.height + · have : i.val = 0 := by simpa [jl] using hj_next.symm + exact (iz this).elim + · rw [Nat.mod_eq_of_lt (by omega)] at hi_next + rw [Nat.mod_eq_of_lt (by omega)] at hj_next + omega + +private theorem helper_hcolors_261.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hheight : (3 : ℕ) ≤ N.height ∧ Odd + N.height), ( + ∀ (i : Fin N.height), G.ends (NormalCycleEdge N i) = s(T.vertex (Fin.castLE N.height_upper i), + T.vertex (Fin.castLE N.height_upper (⟨((↑i : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt ((↑i : + ℕ) + (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(0 : ℕ) < N.height) => + by + omega + )⟩ : Fin N.height)))) → ( + ∀ (i : Fin N.height), (1 : ℕ) ≤ (↑i : ℕ) → phi (NormalCycleEdge N i) = some N.alpha ∨ phi + (NormalCycleEdge N i) = some N.beta) → Function.Injective (NormalCycleEdge N) → + let one : Fin N.height := (⟨(1 : ℕ), Decidable.byContradiction fun (a : ¬(1 : ℕ) < N.height) + => + by omega + ⟩ : Fin N.height); phi (NormalCycleEdge N one) = some N.alpha → + ∀ (n : ℕ) (hnlt : n < N.height), (1 : ℕ) ≤ n → phi (NormalCycleEdge N (⟨n, hnlt⟩ : Fin + N.height)) = if Odd n then some N.alpha else some N.beta := by + classical + intro V E _ _ _ G k e0 phi T N hheight hends hpositive_color hinjective one hone n + induction n using Nat.strong_induction_on with + | h n ih => + intro hnlt hnpos + by_cases hn : n = 1 + · subst n + simpa [one] using hone + · have hprevpos : 1 ≤ n - 1 := by omega + have hprevlt : n - 1 < N.height := by omega + have hprev := ih (n - 1) (by omega) hprevlt hprevpos + have hcur := hpositive_color ⟨n, hnlt⟩ hnpos + have hne : NormalCycleEdge N ⟨n - 1, hprevlt⟩ ≠ + NormalCycleEdge N ⟨n, hnlt⟩ := by + intro heq + have hh := hinjective heq + have hv := congrArg Fin.val hh + simp at hv + omega + have hadj : AdjacentEdges G + (NormalCycleEdge N ⟨n - 1, hprevlt⟩) + (NormalCycleEdge N ⟨n, hnlt⟩) := by + refine ⟨T.vertex (Fin.castLE N.height_upper ⟨n, hnlt⟩), ?_, ?_⟩ + · rw [Incident, hends] + have hmod : (n - 1 + 1) % N.height = n := by + rw [Nat.sub_add_cancel hnpos, Nat.mod_eq_of_lt hnlt] + simp [hmod] + · rw [Incident, hends] + simp + have hproper := N.global.1.2.2.2.1 + by_cases hodd : Odd n + · have hpreveven : ¬ Odd (n - 1) := by + have hn_eq : n - 1 + 1 = n := Nat.sub_add_cancel hnpos + exact Nat.odd_add_one.mp (by simpa [hn_eq] using hodd) + rw [ite_eq_right hpreveven] at hprev + rw [ite_eq_left hodd] + exact hcur.resolve_right (hproper hne hadj hprev) + · have hprevodd : Odd (n - 1) := by + by_contra hprev + apply hodd + have hn_eq : n - 1 + 1 = n := Nat.sub_add_cancel hnpos + rw [← hn_eq] + exact Nat.odd_add_one.mpr hprev + rw [ite_eq_left hprevodd] at hprev + rw [ite_eq_right hodd] + exact hcur.resolve_left (hproper hne hadj hprev) + +theorem ScheideTrunkRotationCycle {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hbalanced : BalancedGlobalMaximumTriple N) : + 3 ≤ N.height ∧ + Odd N.height ∧ + Function.Injective (NormalCycleEdge N) ∧ + (∀ i : Fin N.height, + G.ends (NormalCycleEdge N i) = + s(T.vertex (Fin.castLE N.height_upper i), + T.vertex + (Fin.castLE N.height_upper + ⟨(i.val + 1) % N.height, by + exact + Nat.mod_lt _ + (by + have hp := N.height_lower + omega)⟩))) ∧ + ∀ i : Fin N.height, + 1 ≤ i.val → + phi (NormalCycleEdge N i) = if Odd i.val then some N.alpha else some N.beta := by + classical + have hheight : 3 ≤ N.height ∧ Odd N.height := by + rw [hbalanced.1] + exact ScheideGraphHeightOdd G k e0 phi T N.global + have hcycle_zero (i : Fin N.height) (hi : i.val = 0) : + NormalCycleEdge N i = e0 := by + simp [NormalCycleEdge, hi] + have hcycle_last (i : Fin N.height) (hi : i.val + 1 = N.height) : + NormalCycleEdge N i = N.closingEdge := by + have hne : i.val ≠ 0 := by omega + simp [NormalCycleEdge, hne, hi] + have hcycle_internal (i : Fin N.height) (hpos : 1 ≤ i.val) + (hbefore : i.val + 1 < N.height) : + NormalCycleEdge N i = T.edge ⟨i.val, by + have hu := N.height_upper + omega⟩ := by + have hne : i.val ≠ 0 := by omega + have hnlast : i.val + 1 ≠ N.height := by omega + simp [NormalCycleEdge, hne, hnlast] + have hends := @helper_hends_75 V E inferInstance inferInstance inferInstance G k e0 phi T N + hheight hcycle_zero hcycle_last hcycle_internal + have hpositive_support : ∀ i : Fin N.height, 1 ≤ i.val → + Sum.inr (NormalCycleEdge N i) ∈ N.closingPath.support := by + intro i hi + apply (N.closingPath_edges _).2 + by_cases hl : i.val + 1 = N.height + · left + exact hcycle_last i hl + · right + have hb : i.val + 1 < N.height := by omega + let r : Fin T.length := ⟨i.val, by + have hu := N.height_upper + omega⟩ + refine ⟨r, by simpa [r], by simp [r]; omega, ?_⟩ + exact hcycle_internal i hi hb + have hpositive_color : ∀ i : Fin N.height, 1 ≤ i.val → + phi (NormalCycleEdge N i) = some N.alpha ∨ + phi (NormalCycleEdge N i) = some N.beta := by + intro i hi + have hmem := hpositive_support i hi + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hmem + have hn0 : n ≠ 0 := by + intro hn0 + subst n + rw [N.closingPath.getVert_zero] at hn + simp at hn + have hnlt : n < N.closingPath.length := by + by_contra hnot + have heq : n = N.closingPath.length := by omega + subst n + rw [N.closingPath.getVert_length] at hn + simp at hn + have hadj := N.closingPath.adj_getVert_succ (i := n - 1) (by omega) + have hnext : n - 1 + 1 = n := by omega + rw [hnext, hn] at hadj + cases hp : N.closingPath.getVert (n - 1) with + | inl v => + rw [hp] at hadj + have hinfo : Incident G v (NormalCycleEdge N i) ∧ + (phi (NormalCycleEdge N i) = some N.alpha ∨ + phi (NormalCycleEdge N i) = some N.beta) := by + simpa [TwoColorIncidenceGraph] using hadj + exact hinfo.2 + | inr f => + rw [hp] at hadj + simp [TwoColorIncidenceGraph] at hadj + have hinjective := @helper_hinjective_193 V E inferInstance inferInstance inferInstance G k e0 phi + T N hheight hcycle_zero hends hpositive_color + have hthree : 3 ≤ N.height := hheight.1 + let one : Fin N.height := ⟨1, by omega⟩ + have hone : phi (NormalCycleEdge N one) = some N.alpha := by + have hc := hpositive_color one (by simp [one]) + apply hc.resolve_right + intro hb + have hinc : Incident G + (T.vertex (Fin.castLE N.height_upper one)) + (NormalCycleEdge N one) := by + rw [Incident, hends] + simp + have hp : N.beta ∈ PresentColors G phi + (T.vertex (Fin.castLE N.height_upper one)) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨NormalCycleEdge N one, hinc, hb⟩ + have hm : N.beta ∉ PresentColors G phi + (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩) := by + simpa [MissingColors] using N.beta_missing + apply hm + rw [show T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩ = + T.vertex (Fin.castLE N.height_upper one) by + apply congrArg T.vertex + apply Fin.ext + simp [one]] + exact hp + have hcolors := @helper_hcolors_261 V E inferInstance inferInstance inferInstance G k e0 phi T N + hheight hends hpositive_color hinjective hone + exact ⟨hheight.1, hheight.2, hinjective, hends, + fun i hi => hcolors i.val i.isLt hi⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideTrunkRotationNormal.lean b/LeanPool/GoldbergSeymour/ScheideTrunkRotationNormal.lean new file mode 100644 index 0000000000..beab21f709 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideTrunkRotationNormal.lean @@ -0,0 +1,1167 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalCycleEdge +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Trunk Rotation Normal + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hrho_injective_88.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) + (_ : TreeSequence G (NormalCycleEdge N j)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + Function.Injective rho := by + classical + intro V E _ _ _ G k e0 phi T N j A B T' rho a b hab + have hmod (r : Fin N.height) : + (j.val + r.val) % N.height = + if j.val + r.val < N.height then + j.val + r.val + else + j.val + r.val - N.height := by + by_cases hr : j.val + r.val < N.height + · simp [hr, Nat.mod_eq_of_lt hr] + · rw [ite_eq_right hr, Nat.mod_eq_sub_mod (by omega)] + rw [Nat.mod_eq_of_lt] + omega + have hv := congrArg Fin.val hab + change (j.val + a.val) % N.height = + (j.val + b.val) % N.height at hv + rw [hmod a, hmod b] at hv + by_cases ha : j.val + a.val < N.height <;> + by_cases hb : j.val + b.val < N.height <;> + simp [ha, hb] at hv <;> + apply Fin.ext <;> omega + +private theorem helper_hrot_vertex_133.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (T' : TreeSequence G + (NormalCycleEdge N j)), ( + ∀ (r : Fin (T'.length + (1 : ℕ))), (↑r : ℕ) < N.height → + ∃ (i : Fin N.height), (↑i : ℕ) = ((↑j : ℕ) + (↑r : ℕ)) % N.height ∧ T'.vertex r = T.vertex + (Fin.castLE N.height_upper i)) → + ∀ (hnew_upper : N.height ≤ T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + ∀ (r : Fin N.height), T'.vertex (Fin.castLE hnew_upper r) = T.vertex (Fin.castLE + N.height_upper (rho r)) := by + classical + intro V E _ _ _ G k e0 phi T N j T' hvertex hnew_upper rho r + obtain ⟨i, hi, hv⟩ := hvertex (Fin.castLE hnew_upper r) (by + simp) + rw [hv] + apply congrArg T.vertex + apply congrArg (Fin.castLE N.height_upper) + apply Fin.ext + change i.val = (j.val + r.val) % N.height + simpa using hi + +private theorem helper_hpair_colors_150.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : Fin k), (A = + if Odd (↑j : ℕ) then N.beta else N.alpha) → (B = if Odd (↑j : ℕ) then N.alpha else N.beta) + → ( + ∀ (i : Fin N.height), (1 : ℕ) ≤ (↑i : ℕ) → phi (NormalCycleEdge N i) = if Odd (↑i : ℕ) then + some N.alpha else some N.beta) → + ∀ (q : Fin N.height), (1 : ℕ) ≤ (↑q : ℕ) → phi (NormalCycleEdge N q) = some A ∨ phi + (NormalCycleEdge N q) = some B := by + classical + intro V E _ _ _ G k e0 phi T N j A B hA hB hcycle_colors q hq + have hc := hcycle_colors q hq + by_cases ho : Odd j.val + · have hAe : A = N.beta := by simpa [ho] using hA + have hBe : B = N.alpha := by simpa [ho] using hB + by_cases hqo : Odd q.val + · right + rw [hBe] + simpa [hqo] using hc + · left + rw [hAe] + simpa [hqo] using hc + · have hAe : A = N.alpha := by simpa [ho] using hA + have hBe : B = N.beta := by simpa [ho] using hB + by_cases hqo : Odd q.val + · left + rw [hAe] + simpa [hqo] using hc + · right + rw [hBe] + simpa [hqo] using hc + +private theorem helper_hrot_color_173.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height), (1 : + ℕ) ≤ (↑j : ℕ) → + ∀ (A B : Fin k), ( + ∀ (i : Fin (↑j : ℕ)), psi (NormalCycleEdge N (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) = phi (NormalCycleEdge N (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin N.height))) → ( + ∀ (f : E), ( + ∀ (i : Fin ((↑j : ℕ) + (1 : ℕ))), f ≠ NormalCycleEdge N (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → psi f = phi f) → + ∀ (_ : TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height), Function.Injective + (NormalCycleEdge N) → + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; Function.Injective + rho → rho (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin N.height) = j → ( + ∀ (q : Fin N.height), (1 : ℕ) ≤ (↑q : ℕ) → phi (NormalCycleEdge N q) = some A ∨ phi + (NormalCycleEdge N q) = some B) → + ∀ (r : Fin N.height), (1 : ℕ) ≤ (↑r : ℕ) → psi (NormalCycleEdge N (rho r)) = some A ∨ psi + (NormalCycleEdge N (rho r)) = some B := by + classical + intro V E _ _ _ G k e0 phi psi T N j hj A B hshift hfixed T' hp3 hcycle_injective rho + hrho_injective hrho_zero hpair_colors r hr + have hne : rho r ≠ j := by + intro heq + have hz := hrho_injective (heq.trans hrho_zero.symm) + have hv := congrArg Fin.val hz + simp at hv + omega + by_cases hq : (rho r).val < j.val + · let a : Fin j.val := ⟨(rho r).val, hq⟩ + have hs := hshift a + have hc := hpair_colors + ⟨a.val + 1, by + have hjlt := j.isLt + simp [a] at * + omega⟩ (by simp [a]) + have ha : Fin.castLE (Nat.le_of_lt j.isLt) a = rho r := by + apply Fin.ext + rfl + rw [ha] at hs + rw [hs] + simpa [a] using hc + · have hgt : j.val < (rho r).val := by + have hn : (rho r).val ≠ j.val := by + intro hn + apply hne + apply Fin.ext + exact hn + omega + have hf : psi (NormalCycleEdge N (rho r)) = + phi (NormalCycleEdge N (rho r)) := by + apply hfixed + intro a heq + have hi := hcycle_injective heq + have hv := congrArg Fin.val hi + simp at hv + omega + rw [hf] + exact hpair_colors (rho r) (by omega) + +private theorem helper_htrunk_edge_eq_213.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) (T' : + TreeSequence G (NormalCycleEdge N j)), ( + ∀ (r : Fin T'.length), (↑r : ℕ) + (1 : ℕ) < N.height → + ∃ (i : Fin N.height), (↑i : ℕ) = ((↑j : ℕ) + (↑r : ℕ)) % N.height ∧ T'.edge r = + NormalCycleEdge N i) → + ∀ (_ : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + ∀ (r : Fin T'.length) (hr : (↑r : ℕ) + (1 : ℕ) < N.height), T'.edge r = NormalCycleEdge N (rho + (⟨(↑r : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive T' + omega + ⟩ : Fin N.height)) := by + classical + intro V E _ _ _ G k e0 phi T N j A B T' hedge hp3 rho r hr + obtain ⟨i, hi, he⟩ := hedge r hr + rw [he] + apply congrArg (NormalCycleEdge N) + apply Fin.ext + change i.val = (j.val + r.val) % N.height + exact hi + +private theorem helper_hpred_before_230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height), (1 : ℕ) ≤ (↑j : ℕ) + → + ∀ (_ _ : Fin k) (_ : TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; rho (⟨(0 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin N.height) = j → + let last : Fin N.height := (⟨N.height - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin N.height); + let pred : Fin N.height := rho last; (↑pred : ℕ) = ((↑j : ℕ) + N.height - (1 : ℕ)) % N.height + → (↑pred : ℕ) = (↑j : ℕ) - (1 : ℕ) := by + classical + intro V E _ _ _ G k e0 phi T N j hj A B T' hp3 rho hrho_zero last pred hpred_val + rw [hpred_val] + have heq : j.val + N.height - 1 = (j.val - 1) + N.height := by + omega + rw [heq, Nat.add_mod_right, Nat.mod_eq_of_lt] + omega + +private theorem helper_hchain_398.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : + Fin k) (T' : TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height) (hnew_upper + : N.height ≤ T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; ( + ∀ (r : Fin N.height), G.ends (NormalCycleEdge N (rho r)) = s(T'.vertex (Fin.castLE hnew_upper + r), T'.vertex (Fin.castLE hnew_upper (⟨((↑r : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt ((↑r : + ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height)))) → ( + ∀ (r : Fin N.height), (1 : ℕ) ≤ (↑r : ℕ) → psi (NormalCycleEdge N (rho r)) = some A ∨ psi + (NormalCycleEdge N (rho r)) = some B) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi A B; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); ( + ∀ (n : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ))), (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) → + pathNode n = Sum.inl (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height)))) → ( + ∀ (n : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ))), (↑n : ℕ) % (2 : ℕ) ≠ (0 : ℕ) → + pathNode n = Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height)))) → + let nodes : List (V ⊕ E) := List.ofFn pathNode; List.IsChain H.Adj nodes := by + classical + intro V E _ _ _ G k e0 phi psi T N j A B T' hp3 hnew_upper rho hrot_ends hrot_color H pathNode + hnode_even hnode_odd nodes + rw [List.isChain_iff_getElem] + intro i hi + rw [List.length_ofFn] at hi + rw [List.getElem_ofFn, List.getElem_ofFn] + by_cases he : i % 2 = 0 + · have ho : (i + 1) % 2 ≠ 0 := by omega + rw [hnode_even _ he, hnode_odd _ ho] + let r : Fin N.height := ⟨i / 2 + 1, by omega⟩ + have hidx : (i / 2 + 1) % N.height = r.val := + Nat.mod_eq_of_lt r.isLt + have hedgeidx : (i + 1 + 1) / 2 = r.val := by + dsimp [r] + omega + change H.Adj + (Sum.inl (T'.vertex (Fin.castLE hnew_upper + ⟨(i / 2 + 1) % N.height, _⟩))) + (Sum.inr (NormalCycleEdge N + (rho ⟨(i + 1 + 1) / 2, _⟩))) + rw [show (⟨(i / 2 + 1) % N.height, _⟩ : Fin N.height) = r by + apply Fin.ext + exact hidx, + show (⟨(i + 1 + 1) / 2, _⟩ : Fin N.height) = r by + apply Fin.ext + exact hedgeidx] + change Incident G (T'.vertex (Fin.castLE hnew_upper r)) + (NormalCycleEdge N (rho r)) ∧ + (psi (NormalCycleEdge N (rho r)) = some A ∨ + psi (NormalCycleEdge N (rho r)) = some B) + constructor + · rw [Incident, hrot_ends] + simp + · exact hrot_color r (by simp [r]) + · have ho : i % 2 = 1 := by omega + have he' : (i + 1) % 2 = 0 := by omega + rw [hnode_odd _ he, hnode_even _ he'] + let r : Fin N.height := ⟨(i + 1) / 2, by omega⟩ + have hedgeidx : (i + 1) / 2 = r.val := rfl + have hvertexidx : ((i + 1) / 2 + 1) % N.height = + (r.val + 1) % N.height := by rfl + change H.Adj + (Sum.inr (NormalCycleEdge N + (rho ⟨(i + 1) / 2, _⟩))) + (Sum.inl (T'.vertex (Fin.castLE hnew_upper + ⟨((i + 1) / 2 + 1) % N.height, _⟩))) + rw [show (⟨(i + 1) / 2, _⟩ : Fin N.height) = r by + apply Fin.ext + exact hedgeidx, + show (⟨((i + 1) / 2 + 1) % N.height, _⟩ : Fin N.height) = + ⟨(r.val + 1) % N.height, Nat.mod_lt _ (by omega)⟩ by + apply Fin.ext + exact hvertexidx] + change Incident G + (T'.vertex (Fin.castLE hnew_upper + ⟨(r.val + 1) % N.height, Nat.mod_lt _ (by omega)⟩)) + (NormalCycleEdge N (rho r)) ∧ + (psi (NormalCycleEdge N (rho r)) = some A ∨ + psi (NormalCycleEdge N (rho r)) = some B) + constructor + · rw [Incident, hrot_ends] + simp + · exact hrot_color r (by simp [r]; omega) + +private theorem helper_hnode_injective_505.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : + Fin k) (T' : TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height), + Function.Injective (NormalCycleEdge N) → + ∀ (hnew_upper : N.height ≤ T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; Function.Injective + rho → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi A B; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); ( + ∀ (n : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ))), (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) → + pathNode n = Sum.inl (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height)))) → ( + ∀ (n : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ))), (↑n : ℕ) % (2 : ℕ) ≠ (0 : ℕ) → + pathNode n = Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height)))) → + let nodes : List (V ⊕ E) := List.ofFn pathNode; List.IsChain H.Adj nodes → + ∀ (hnodes_nonempty : nodes ≠ []), nodes.head hnodes_nonempty = Sum.inl (T'.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T'.positive⟩ : Fin (T'.length + (1 : ℕ)))) → nodes.getLast + hnodes_nonempty = Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin + (T'.length + (1 : ℕ)))) → Function.Injective pathNode := by + classical + intro V E _ _ _ G k e0 phi psi T N j A B T' hp3 hcycle_injective hnew_upper rho hrho_injective + H pathNode hnode_even hnode_odd nodes hchain hnodes_nonempty hstart hend a b hab + by_cases ha : a.val % 2 = 0 + · by_cases hb : b.val % 2 = 0 + · rw [hnode_even a ha, hnode_even b hb] at hab + have hv := T'.vertex_injective (Sum.inl.inj hab) + have hvv := congrArg Fin.val + (Fin.castLE_injective hnew_upper hv) + change (a.val / 2 + 1) % N.height = + (b.val / 2 + 1) % N.height at hvv + have hdiv : a.val / 2 = b.val / 2 := by + by_cases hal : a.val / 2 + 1 < N.height + · by_cases hbl : b.val / 2 + 1 < N.height + · rw [Nat.mod_eq_of_lt hal, Nat.mod_eq_of_lt hbl] at hvv + omega + · have hbeq : b.val / 2 + 1 = N.height := by omega + rw [hbeq, Nat.mod_self, Nat.mod_eq_of_lt hal] at hvv + omega + · by_cases hbl : b.val / 2 + 1 < N.height + · have haeq : a.val / 2 + 1 = N.height := by omega + rw [haeq, Nat.mod_self, Nat.mod_eq_of_lt hbl] at hvv + omega + · have haeq : a.val / 2 + 1 = N.height := by omega + have hbeq : b.val / 2 + 1 = N.height := by omega + omega + apply Fin.ext + omega + · rw [hnode_even a ha, hnode_odd b hb] at hab + simp at hab + · by_cases hb : b.val % 2 = 0 + · rw [hnode_odd a ha, hnode_even b hb] at hab + simp at hab + · rw [hnode_odd a ha, hnode_odd b hb] at hab + have hc := hcycle_injective (Sum.inr.inj hab) + have hr := hrho_injective hc + have hv := congrArg Fin.val hr + simp at hv + apply Fin.ext + omega + +private theorem helper_hvertex_support_547.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : + Fin k) (T' : TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height) (hnew_upper + : N.height ≤ T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi A B; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); ( + ∀ (n : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ))), (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) → + pathNode n = Sum.inl (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height)))) → ( + ∀ (n : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ))), (↑n : ℕ) % (2 : ℕ) ≠ (0 : ℕ) → + pathNode n = Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height)))) → + let nodes : List (V ⊕ E) := List.ofFn pathNode; + ∀ (hchain : List.IsChain H.Adj nodes) (hnodes_nonempty : nodes ≠ []), + let rawPath : H.Walk (nodes.head hnodes_nonempty) (nodes.getLast hnodes_nonempty) := + SimpleGraph.Walk.ofSupport nodes hnodes_nonempty hchain; + ∀ (hstart : nodes.head hnodes_nonempty = Sum.inl (T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ + T'.positive⟩ : Fin (T'.length + (1 : ℕ))))) (hend : nodes.getLast hnodes_nonempty = + Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin (T'.length + (1 : ℕ))))), + let closingPath : H.Walk (Sum.inl (T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T'.positive⟩ : Fin + (T'.length + (1 : ℕ))))) (Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin + (T'.length + (1 : ℕ))))) := rawPath.copy hstart hend; closingPath.support = nodes → + closingPath.length = (2 : ℕ) * (N.height - (1 : ℕ)) → + ∀ (v : V), Sum.inl v ∈ closingPath.support ↔ + ∃ (i : Fin N.height), v = T'.vertex (Fin.castLE hnew_upper i) := by + classical + intro V E _ _ _ G k e0 phi psi T N j A B T' hp3 hnew_upper rho H pathNode hnode_even hnode_odd + nodes hchain hnodes_nonempty rawPath hstart hend closingPath hpath_support hpath_length v + rw [hpath_support] + change Sum.inl v ∈ List.ofFn pathNode ↔ _ + rw [List.mem_ofFn] + constructor + · rintro ⟨n, hn⟩ + by_cases he : n.val % 2 = 0 + · rw [hnode_even n he] at hn + exact ⟨⟨(n.val / 2 + 1) % N.height, + Nat.mod_lt _ (by omega)⟩, (Sum.inl.inj hn).symm⟩ + · rw [hnode_odd n he] at hn + simp at hn + · rintro ⟨i, rfl⟩ + by_cases hi : i.val = 0 + · let n : Fin (2 * (N.height - 1) + 1) := + ⟨2 * (N.height - 1), by omega⟩ + refine ⟨n, ?_⟩ + rw [hnode_even n (by simp [n])] + congr 2 + apply Fin.ext + simp only [Fin.castLE_mk, Fin.val_castLE] + have hh : N.height - 1 + 1 = N.height := by omega + have hdiv : n.val / 2 = N.height - 1 := by dsimp [n]; omega + rw [hdiv, hh, Nat.mod_self, hi] + · let n : Fin (2 * (N.height - 1) + 1) := + ⟨2 * (i.val - 1), by omega⟩ + refine ⟨n, ?_⟩ + rw [hnode_even n (by simp [n])] + congr 2 + apply Fin.ext + simp only [Fin.castLE_mk, Fin.val_castLE] + have hieq : i.val - 1 + 1 = i.val := by omega + have hdiv : n.val / 2 = i.val - 1 := by dsimp [n]; omega + rw [hdiv, hieq, Nat.mod_eq_of_lt i.isLt] + +private theorem helper_hedge_support_585.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : + Fin k) (T' : TreeSequence G (NormalCycleEdge N j)), T'.length = T.length → + ∀ (hp3 : (3 : ℕ) ≤ N.height) (hnew_upper : N.height ≤ T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; ( + ∀ (r : Fin T'.length) (hr : (↑r : ℕ) + (1 : ℕ) < N.height), T'.edge r = NormalCycleEdge N (rho + (⟨(↑r : ℕ), + by + omega + ⟩ : Fin N.height))) → + let last : Fin N.height := (⟨N.height - (1 : ℕ), + by + omega + ⟩ : Fin N.height); + let pred : Fin N.height := rho last; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi A B; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); ( + ∀ (n : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ))), (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) → + pathNode n = Sum.inl (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height)))) → ( + ∀ (n : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ))), (↑n : ℕ) % (2 : ℕ) ≠ (0 : ℕ) → + pathNode n = Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height)))) → + let nodes : List (V ⊕ E) := List.ofFn pathNode; + ∀ (hchain : List.IsChain H.Adj nodes) (hnodes_nonempty : nodes ≠ []), + let rawPath : H.Walk (nodes.head hnodes_nonempty) (nodes.getLast hnodes_nonempty) := + SimpleGraph.Walk.ofSupport nodes hnodes_nonempty hchain; + ∀ (hstart : nodes.head hnodes_nonempty = Sum.inl (T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ + T'.positive⟩ : Fin (T'.length + (1 : ℕ))))) (hend : nodes.getLast hnodes_nonempty = + Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin (T'.length + (1 : ℕ))))), + let closingPath : H.Walk (Sum.inl (T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T'.positive⟩ : Fin + (T'.length + (1 : ℕ))))) (Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin + (T'.length + (1 : ℕ))))) := rawPath.copy hstart hend; closingPath.support = nodes → + closingPath.length = (2 : ℕ) * (N.height - (1 : ℕ)) → + ∀ (f : E), Sum.inr f ∈ closingPath.support ↔ f = NormalCycleEdge N pred ∨ + ∃ (r : Fin T'.length), (1 : ℕ) ≤ (↑r : ℕ) ∧ (↑r : ℕ) + (2 : ℕ) ≤ N.height ∧ f = T'.edge r := by + classical + intro V E _ _ _ G k e0 phi psi T N j A B T' hlength hp3 hnew_upper rho htrunk_edge_eq last pred + H pathNode hnode_even hnode_odd nodes hchain hnodes_nonempty rawPath hstart hend + closingPath hpath_support hpath_length f + rw [hpath_support] + change Sum.inr f ∈ List.ofFn pathNode ↔ _ + rw [List.mem_ofFn] + constructor + · rintro ⟨n, hn⟩ + by_cases he : n.val % 2 = 0 + · rw [hnode_even n he] at hn + simp at hn + · rw [hnode_odd n he] at hn + let r : Fin N.height := ⟨(n.val + 1) / 2, by omega⟩ + have hrpos : 1 ≤ r.val := by + dsimp [r] + omega + by_cases hlast : r.val + 1 = N.height + · left + have hr : r = last := by + apply Fin.ext + simp [last] + omega + simpa [pred, r, hr] using (Sum.inr.inj hn).symm + · right + have hrbefore : r.val + 1 < N.height := by omega + let rt : Fin T'.length := ⟨r.val, by + have hu := hnew_upper + omega⟩ + refine ⟨rt, by simpa [rt] using hrpos, by simp [rt]; omega, ?_⟩ + have heq := htrunk_edge_eq rt (by simp [rt]; omega) + have hrr : (⟨rt.val, by + simp [rt]⟩ : Fin N.height) = r := by + apply Fin.ext + rfl + rw [heq, hrr] + exact (Sum.inr.inj hn).symm + · rintro (hclose | ⟨r, hrpos, hrbound, rfl⟩) + · let n : Fin (2 * (N.height - 1) + 1) := + ⟨2 * (N.height - 1) - 1, by omega⟩ + refine ⟨n, ?_⟩ + rw [hnode_odd n (by simp [n]; omega)] + rw [hclose] + congr 2 + apply congrArg rho + apply Fin.ext + simp [n, last] + omega + · let n : Fin (2 * (N.height - 1) + 1) := + ⟨2 * r.val - 1, by omega⟩ + refine ⟨n, ?_⟩ + rw [hnode_odd n (by simp [n]; omega)] + have heq := htrunk_edge_eq r (by omega) + rw [heq] + congr 2 + apply congrArg rho + apply Fin.ext + simp [n] + omega + +private theorem helper_hrho_succ_860.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) (_ : + TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + ∀ (r : Fin N.height), rho (⟨((↑r : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt ((↑r : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height) = (⟨((↑(rho r) : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt ((↑(rho r) : ℕ) + (1 + : ℕ)) ( + by + omega + )⟩ : Fin N.height) := by + classical + intro V E _ _ _ G k e0 phi T N j A B T' hp3 rho r + apply Fin.ext + change (j.val + ((r.val + 1) % N.height)) % N.height = + (((j.val + r.val) % N.height) + 1) % N.height + calc + (j.val + ((r.val + 1) % N.height)) % N.height = + ((j.val % N.height) + (((r.val + 1) % N.height) % N.height)) % + N.height := Nat.add_mod _ _ _ + _ = ((j.val % N.height) + ((r.val + 1) % N.height)) % + N.height := by + rw [Nat.mod_eq_of_lt (Nat.mod_lt _ (by omega))] + _ = (j.val + (r.val + 1)) % N.height := + (Nat.add_mod _ _ _).symm + _ = ((j.val + r.val) + 1) % N.height := by congr 1 + _ = (((j.val + r.val) % N.height) + (1 % N.height)) % + N.height := Nat.add_mod (j.val + r.val) 1 N.height + _ = (((j.val + r.val) % N.height) + 1) % N.height := by + rw [Nat.mod_eq_of_lt (by omega : 1 < N.height)] + +private theorem helper_hstart_936.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) (T' : + TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height) (hnew_upper : N.height ≤ + T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); ( + ∀ (n : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ))), (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) → + pathNode n = Sum.inl (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height)))) → + let nodes : List (V ⊕ E) := List.ofFn pathNode; + ∀ (hnodes_nonempty : nodes ≠ []), nodes.head hnodes_nonempty = Sum.inl (T'.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T'.positive⟩ : Fin (T'.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 phi T N j A B T' hp3 hnew_upper rho pathNode hnode_even nodes + hnodes_nonempty + change (List.ofFn pathNode).head _ = _ + rw [List.head_ofFn, hnode_even] + · congr 2 + apply Fin.ext + simpa using (Nat.mod_eq_of_lt (by omega : 1 < N.height)) + · simp + +private theorem helper_hend_944.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) (T' : + TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height) (hnew_upper : N.height ≤ + T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); ( + ∀ (n : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ))), (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) → + pathNode n = Sum.inl (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % + N.height, Nat.mod_lt ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height)))) → + let nodes : List (V ⊕ E) := List.ofFn pathNode; + ∀ (hnodes_nonempty : nodes ≠ []), nodes.getLast hnodes_nonempty = Sum.inl (T'.vertex (⟨(0 : + ℕ), Nat.zero_lt_succ T'.length⟩ : Fin (T'.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 phi T N j A B T' hp3 hnew_upper rho pathNode hnode_even nodes + hnodes_nonempty + change (List.ofFn pathNode).getLast _ = _ + rw [List.getLast_ofFn_succ, hnode_even] + · congr 2 + apply Fin.ext + change ((2 * (N.height - 1)) / 2 + 1) % N.height = 0 + have hh : N.height - 1 + 1 = N.height := by omega + rw [Nat.mul_div_right (N.height - 1) (by omega : 0 < 2), hh, + Nat.mod_self] + · change (2 * (N.height - 1)) % 2 = 0 + omega + +private theorem helper_hpath_support_960.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : + Fin k) (T' : TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height) (hnew_upper + : N.height ≤ T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi A B; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); + let nodes : List (V ⊕ E) := List.ofFn pathNode; + ∀ (hchain : List.IsChain H.Adj nodes) (hnodes_nonempty : nodes ≠ []), + let rawPath : H.Walk (nodes.head hnodes_nonempty) (nodes.getLast hnodes_nonempty) := + SimpleGraph.Walk.ofSupport nodes hnodes_nonempty hchain; + ∀ (hstart : nodes.head hnodes_nonempty = Sum.inl (T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ + T'.positive⟩ : Fin (T'.length + (1 : ℕ))))) (hend : nodes.getLast hnodes_nonempty = + Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin (T'.length + (1 : ℕ))))), + let closingPath : H.Walk (Sum.inl (T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T'.positive⟩ : Fin + (T'.length + (1 : ℕ))))) (Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin + (T'.length + (1 : ℕ))))) := rawPath.copy hstart hend; closingPath.support = nodes := by + classical + intro V E _ _ _ G k e0 phi psi T N j A B T' hp3 hnew_upper rho H pathNode nodes hchain + hnodes_nonempty rawPath hstart hend closingPath + calc + closingPath.support = rawPath.support := by + simpa only [closingPath] using + SimpleGraph.Walk.support_copy rawPath hstart hend + _ = nodes := by + simpa only [rawPath] using + SimpleGraph.Walk.support_ofSupport hnodes_nonempty hchain + +private theorem helper_hpath_length_968.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : + Fin k) (T' : TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height) (hnew_upper + : N.height ≤ T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi A B; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); + let nodes : List (V ⊕ E) := List.ofFn pathNode; + ∀ (hchain : List.IsChain H.Adj nodes) (hnodes_nonempty : nodes ≠ []), + let rawPath : H.Walk (nodes.head hnodes_nonempty) (nodes.getLast hnodes_nonempty) := + SimpleGraph.Walk.ofSupport nodes hnodes_nonempty hchain; + ∀ (hstart : nodes.head hnodes_nonempty = Sum.inl (T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ + T'.positive⟩ : Fin (T'.length + (1 : ℕ))))) (hend : nodes.getLast hnodes_nonempty = + Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin (T'.length + (1 : ℕ))))), + let closingPath : H.Walk (Sum.inl (T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T'.positive⟩ : Fin + (T'.length + (1 : ℕ))))) (Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin + (T'.length + (1 : ℕ))))) := rawPath.copy hstart hend; closingPath.length = (2 : ℕ) * + (N.height - (1 : ℕ)) := by + classical + intro V E _ _ _ G k e0 phi psi T N j A B T' hp3 hnew_upper rho H pathNode nodes hchain + hnodes_nonempty rawPath hstart hend closingPath + calc + closingPath.length = rawPath.length := by + simpa only [closingPath] using + SimpleGraph.Walk.length_copy rawPath hstart hend + _ = nodes.length - 1 := by + simpa only [rawPath] using + SimpleGraph.Walk.length_ofSupport hnodes_nonempty hchain + _ = 2 * (N.height - 1) := by + simp [nodes] + +private theorem helper_hclosing_ends_995.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : + Fin k) (T' : TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height) (hnew_upper + : N.height ≤ T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; ( + ∀ (r : Fin N.height), G.ends (NormalCycleEdge N (rho r)) = s(T'.vertex (Fin.castLE hnew_upper + r), T'.vertex (Fin.castLE hnew_upper (⟨((↑r : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt ((↑r : + ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height)))) → + let last : Fin N.height := (⟨N.height - (1 : ℕ), + by + omega + ⟩ : Fin N.height); + let pred : Fin N.height := rho last; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi A B; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); + let nodes : List (V ⊕ E) := List.ofFn pathNode; List.IsChain H.Adj nodes → + ∀ (hnodes_nonempty : nodes ≠ []), nodes.head hnodes_nonempty = Sum.inl (T'.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T'.positive⟩ : Fin (T'.length + (1 : ℕ)))) → nodes.getLast + hnodes_nonempty = Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin + (T'.length + (1 : ℕ)))) → + let lastIndex : Fin (T'.length + (1 : ℕ)) := Fin.castLE hnew_upper last; G.ends + (NormalCycleEdge N pred) = s(T'.vertex lastIndex, T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ + T'.length⟩ : Fin (T'.length + (1 : ℕ)))) := by + classical + intro V E _ _ _ G k e0 phi psi T N j A B T' hp3 hnew_upper rho hrot_ends last pred H pathNode + nodes hchain hnodes_nonempty hstart hend lastIndex + rw [show pred = rho last by rfl, hrot_ends] + apply Sym2.eq_iff.mpr + left + constructor + · rfl + · apply congrArg T'.vertex + apply Fin.ext + change (N.height - 1 + 1) % N.height = 0 + have hh : N.height - 1 + 1 = N.height := by omega + rw [hh, Nat.mod_self] + +private theorem helper_htrunk_ends_1008.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : + Fin k) (T' : TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height) (hnew_upper + : N.height ≤ T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; ( + ∀ (r : Fin N.height), G.ends (NormalCycleEdge N (rho r)) = s(T'.vertex (Fin.castLE hnew_upper + r), T'.vertex (Fin.castLE hnew_upper (⟨((↑r : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt ((↑r : + ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height)))) → ( + ∀ (r : Fin T'.length) (hr : (↑r : ℕ) + (1 : ℕ) < N.height), T'.edge r = NormalCycleEdge N (rho + (⟨(↑r : ℕ), + by + omega + ⟩ : Fin N.height))) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi A B; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); + let nodes : List (V ⊕ E) := List.ofFn pathNode; List.IsChain H.Adj nodes → + ∀ (hnodes_nonempty : nodes ≠ []), nodes.head hnodes_nonempty = Sum.inl (T'.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T'.positive⟩ : Fin (T'.length + (1 : ℕ)))) → nodes.getLast + hnodes_nonempty = Sum.inl (T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin + (T'.length + (1 : ℕ)))) → + ∀ (r : Fin T'.length), (1 : ℕ) ≤ (↑r : ℕ) → (↑r : ℕ) + (2 : ℕ) ≤ N.height → G.ends (T'.edge r) + = s(T'.vertex (⟨(↑r : ℕ), Nat.lt_succ_of_lt r.isLt⟩ : Fin (T'.length + (1 : ℕ))), + T'.vertex r.succ) := by + classical + intro V E _ _ _ G k e0 phi psi T N j A B T' hp3 hnew_upper rho hrot_ends htrunk_edge_eq H + pathNode nodes hchain hnodes_nonempty hstart hend r hrpos hrbound + have hrbefore : r.val + 1 < N.height := by omega + rw [htrunk_edge_eq r hrbefore, + hrot_ends ⟨r.val, by omega⟩] + apply Sym2.eq_iff.mpr + left + constructor + · apply congrArg T'.vertex + apply Fin.ext + rfl + · apply congrArg T'.vertex + apply Fin.ext + change (r.val + 1) % N.height = r.val + 1 + exact Nat.mod_eq_of_lt (by omega) + +private theorem helper_hnew_one_1032.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) (T : + TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : + Fin k) (T' : TreeSequence G (NormalCycleEdge N j)) (hp3 : (3 : ℕ) ≤ N.height) (hnew_upper + : N.height ≤ T'.length + (1 : ℕ)), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; ( + ∀ (r : Fin N.height), T'.vertex (Fin.castLE hnew_upper r) = T.vertex (Fin.castLE + N.height_upper (rho r))) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G psi A B; + let pathNode : Fin ((2 : ℕ) * (N.height - (1 : ℕ)) + (1 : ℕ)) → V ⊕ E := fun (n : Fin ((2 : ℕ) + * (N.height - (1 : ℕ)) + (1 : ℕ))) ↦ if _ : (↑n : ℕ) % (2 : ℕ) = (0 : ℕ) then Sum.inl + (T'.vertex (Fin.castLE hnew_upper (⟨((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt + ((↑n : ℕ) / (2 : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height))) else Sum.inr (NormalCycleEdge N (rho (⟨((↑n : ℕ) + (1 : ℕ)) / (2 : ℕ), + by + omega + ⟩ : Fin N.height))); + let nodes : List (V ⊕ E) := List.ofFn pathNode; + ∀ (_ : List.IsChain H.Adj nodes) (hnodes_nonempty : nodes ≠ []) (_ : nodes.head + hnodes_nonempty = Sum.inl (T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T'.positive⟩ : Fin + (T'.length + (1 : ℕ))))) (_ : nodes.getLast hnodes_nonempty = Sum.inl (T'.vertex (⟨(0 : + ℕ), Nat.zero_lt_succ T'.length⟩ : Fin (T'.length + (1 : ℕ))))), T'.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T'.positive⟩ : Fin (T'.length + (1 : ℕ))) = T.vertex (Fin.castLE + N.height_upper (⟨((↑j : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt ((↑j : ℕ) + (1 : ℕ)) ( + by + omega + )⟩ : Fin N.height)) := by + classical + intro V E _ _ _ G k e0 phi psi T N j A B T' hp3 hnew_upper rho hrot_vertex H pathNode nodes + hchain hnodes_nonempty hstart hend + rw [show (⟨1, Nat.succ_lt_succ T'.positive⟩ : Fin (T'.length + 1)) = + Fin.castLE hnew_upper (⟨1, by omega⟩ : Fin N.height) by rfl, + hrot_vertex] + apply congrArg T.vertex + apply congrArg (Fin.castLE N.height_upper) + apply Fin.ext + rfl + +theorem ScheideTrunkRotationNormal {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi psi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hbalanced : BalancedGlobalMaximumTriple N) + (j : Fin N.height) (hj : 1 ≤ j.val) (A B : Fin k) + (_ : A ≠ B) + (hA : A = (if Odd j.val then N.beta else N.alpha)) + (hB : B = (if Odd j.val then N.alpha else N.beta)) + (hshift : ∀ i : Fin j.val, + psi (NormalCycleEdge N + (Fin.castLE (Nat.le_of_lt j.isLt) i)) = + phi (NormalCycleEdge N + ⟨i.val + 1, by + have hi := i.isLt + have _ := j.isLt + omega⟩)) + (hfixed : ∀ f : E, + (∀ i : Fin (j.val + 1), + f ≠ NormalCycleEdge N + (Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i)) → + psi f = phi f) + (T' : TreeSequence G (NormalCycleEdge N j)) + (hglobal : GlobalMaximumTriple G k (NormalCycleEdge N j) psi T') + (hmissA : A ∈ MissingColors G psi + (T.vertex (Fin.castLE N.height_upper j))) + (hmissB : B ∈ MissingColors G psi + (T.vertex (Fin.castLE N.height_upper + ⟨(j.val + 1) % N.height, by + exact Nat.mod_lt _ (by + have hp := N.height_lower + omega)⟩))) + (hlength : T'.length = T.length) + (hvertex : ∀ r : Fin (T'.length + 1), r.val < N.height → + ∃ i : Fin N.height, + i.val = (j.val + r.val) % N.height ∧ + T'.vertex r = T.vertex (Fin.castLE N.height_upper i)) + (hedge : ∀ r : Fin T'.length, r.val + 1 < N.height → + ∃ i : Fin N.height, + i.val = (j.val + r.val) % N.height ∧ + T'.edge r = NormalCycleEdge N i) : + ∃ N' : NormalGlobalMaximumTriple G k (NormalCycleEdge N j) psi T', + N'.height = N.height ∧ + N'.alpha = A ∧ N'.beta = B ∧ + ∃ pred : Fin N.height, + pred.val = (j.val + N.height - 1) % N.height ∧ + N'.closingEdge = NormalCycleEdge N pred := by + classical + obtain ⟨hp3, _hpodd, hcycle_injective, hcycle_ends, hcycle_colors⟩ := + ScheideTrunkRotationCycle G k e0 phi T N hbalanced + have hnew_upper : N.height ≤ T'.length + 1 := by + rw [hlength] + exact N.height_upper + let rho : Fin N.height → Fin N.height := fun r => j + r + have hrho_val (r : Fin N.height) : + (rho r).val = (j.val + r.val) % N.height := by + rfl + have hrho_injective : Function.Injective rho := by + apply helper_hrho_injective_88 <;> assumption + have hrho_zero : rho ⟨0, by omega⟩ = j := by + apply Fin.ext + change (j.val + 0) % N.height = j.val + simpa using Nat.mod_eq_of_lt j.isLt + have hrho_succ (r : Fin N.height) : + rho ⟨(r.val + 1) % N.height, Nat.mod_lt _ (by omega)⟩ = + ⟨((rho r).val + 1) % N.height, Nat.mod_lt _ (by omega)⟩ := by + apply helper_hrho_succ_860 <;> assumption + have hrot_vertex (r : Fin N.height) : + T'.vertex (Fin.castLE hnew_upper r) = + T.vertex (Fin.castLE N.height_upper (rho r)) := by + apply helper_hrot_vertex_133; assumption + have hrot_ends (r : Fin N.height) : + G.ends (NormalCycleEdge N (rho r)) = + s(T'.vertex (Fin.castLE hnew_upper r), + T'.vertex (Fin.castLE hnew_upper + ⟨(r.val + 1) % N.height, Nat.mod_lt _ (by omega)⟩)) := by + rw [hcycle_ends, hrot_vertex, hrot_vertex, hrho_succ] + have hpair_colors (q : Fin N.height) (hq : 1 ≤ q.val) : + phi (NormalCycleEdge N q) = some A ∨ + phi (NormalCycleEdge N q) = some B := by + apply helper_hpair_colors_150 <;> assumption + have hrot_color (r : Fin N.height) (hr : 1 ≤ r.val) : + psi (NormalCycleEdge N (rho r)) = some A ∨ + psi (NormalCycleEdge N (rho r)) = some B := by + apply helper_hrot_color_173 <;> assumption + have htrunk_edge_eq (r : Fin T'.length) + (hr : r.val + 1 < N.height) : + T'.edge r = NormalCycleEdge N + (rho ⟨r.val, by omega⟩) := by + apply helper_htrunk_edge_eq_213 <;> assumption + let last : Fin N.height := ⟨N.height - 1, by omega⟩ + let pred : Fin N.height := rho last + have hpred_val : pred.val = + (j.val + N.height - 1) % N.height := by + change (j.val + (N.height - 1)) % N.height = _ + congr 1 + omega + have hpred_before : pred.val = j.val - 1 := by + apply helper_hpred_before_230 <;> assumption + let H := TwoColorIncidenceGraph G psi A B + let pathNode : Fin (2 * (N.height - 1) + 1) → Sum V E := fun n => + if he : n.val % 2 = 0 then + Sum.inl (T'.vertex (Fin.castLE hnew_upper + ⟨(n.val / 2 + 1) % N.height, Nat.mod_lt _ (by omega)⟩)) + else + Sum.inr (NormalCycleEdge N + (rho ⟨(n.val + 1) / 2, by omega⟩)) + have hnode_even (n : Fin (2 * (N.height - 1) + 1)) + (hn : n.val % 2 = 0) : + pathNode n = Sum.inl (T'.vertex (Fin.castLE hnew_upper + ⟨(n.val / 2 + 1) % N.height, Nat.mod_lt _ (by omega)⟩)) := by + simp [pathNode, hn] + have hnode_odd (n : Fin (2 * (N.height - 1) + 1)) + (hn : n.val % 2 ≠ 0) : + pathNode n = Sum.inr (NormalCycleEdge N + (rho ⟨(n.val + 1) / 2, by omega⟩)) := by + simp [pathNode, hn] + let nodes : List (Sum V E) := List.ofFn pathNode + have hchain : nodes.IsChain H.Adj := by + apply helper_hchain_398 <;> assumption + have hnodes_nonempty : nodes ≠ [] := by + simp [nodes] + let rawPath := SimpleGraph.Walk.ofSupport nodes hnodes_nonempty hchain + have hstart : nodes.head hnodes_nonempty = + Sum.inl (T'.vertex ⟨1, Nat.succ_lt_succ T'.positive⟩) := by + apply helper_hstart_936 <;> assumption + have hend : nodes.getLast hnodes_nonempty = + Sum.inl (T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩) := by + apply helper_hend_944 <;> assumption + let closingPath : H.Walk + (Sum.inl (T'.vertex ⟨1, Nat.succ_lt_succ T'.positive⟩)) + (Sum.inl (T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩)) := + rawPath.copy hstart hend + have hpath_support : closingPath.support = nodes := by + apply helper_hpath_support_960; assumption + have hpath_length : closingPath.length = 2 * (N.height - 1) := by + apply helper_hpath_length_968; assumption + have hnode_injective : Function.Injective pathNode := by + apply helper_hnode_injective_505 <;> assumption + have hpath_isPath : closingPath.IsPath := by + rw [SimpleGraph.Walk.isPath_def, hpath_support] + exact List.nodup_ofFn.mpr hnode_injective + have hvertex_support : + ∀ v : V, Sum.inl v ∈ closingPath.support ↔ + ∃ i : Fin N.height, v = T'.vertex (Fin.castLE hnew_upper i) := by + apply helper_hvertex_support_547 <;> assumption + have hedge_support : + ∀ f : E, Sum.inr f ∈ closingPath.support ↔ f = NormalCycleEdge N pred ∨ + ∃ r : Fin T'.length, 1 ≤ r.val ∧ r.val + 2 ≤ N.height ∧ f = T'.edge r := by + apply helper_hedge_support_585 <;> assumption + let lastIndex : Fin (T'.length + 1) := Fin.castLE hnew_upper last + have hclosing_ends : G.ends (NormalCycleEdge N pred) = + s(T'.vertex lastIndex, + T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩) := by + apply helper_hclosing_ends_995 <;> assumption + have htrunk_ends : + ∀ r : Fin T'.length, 1 ≤ r.val → r.val + 2 ≤ N.height → G.ends (T'.edge r) = s(T'.vertex + ⟨r.val, Nat.lt_succ_of_lt r.isLt⟩, T'.vertex r.succ) := by + apply helper_htrunk_ends_1008 <;> assumption + have hnew_zero : T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩ = + T.vertex (Fin.castLE N.height_upper j) := by + rw [show (⟨0, Nat.zero_lt_succ T'.length⟩ : Fin (T'.length + 1)) = + Fin.castLE hnew_upper (⟨0, by omega⟩ : Fin N.height) by rfl, + hrot_vertex, hrho_zero] + have hnew_one : T'.vertex ⟨1, Nat.succ_lt_succ T'.positive⟩ = + T.vertex (Fin.castLE N.height_upper + ⟨(j.val + 1) % N.height, Nat.mod_lt _ (by omega)⟩) := by + apply helper_hnew_one_1032 <;> assumption + let N' : NormalGlobalMaximumTriple G k (NormalCycleEdge N j) psi T' := + { global := hglobal + height := N.height + height_lower := by omega + height_upper := hnew_upper + alpha := A + beta := B + alpha_missing := by + rw [hnew_zero] + exact hmissA + beta_missing := by + rw [hnew_one] + exact hmissB + closingEdge := NormalCycleEdge N pred + lastIndex := lastIndex + lastIndex_height := by + change (N.height - 1) + 1 = N.height + omega + closing_ends := hclosing_ends + closingPath := closingPath + closingPath_isPath := hpath_isPath + closingPath_length := hpath_length + closingPath_vertices := hvertex_support + closingPath_edges := hedge_support + trunk_edge_ends := htrunk_ends } + refine ⟨N', rfl, rfl, rfl, pred, hpred_val, rfl⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideTrunkRotationPreserves.lean b/LeanPool/GoldbergSeymour/ScheideTrunkRotationPreserves.lean new file mode 100644 index 0000000000..1fbdf6d013 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideTrunkRotationPreserves.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalCycleEdge +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationNormal +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TrunkRotation +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Scheide Trunk Rotation Preserves + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ScheideTrunkRotationPreserves {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hbalanced : BalancedGlobalMaximumTriple N) + (j : Fin N.height) (hj : 1 ≤ j.val) : + ∃ (e1 : E) (psi : PartialEdgeColoring E k) (T' : TreeSequence G e1) (N' : + NormalGlobalMaximumTriple G k e1 psi T'), + TrunkRotation N j e1 psi T' N' ∧ BalancedGlobalMaximumTriple N' := by + classical + obtain ⟨psi, A, B, hAB, hA, hB, hproper, hone, hmissA, hmissB, + hshift, hfixed, htailColor⟩ := + ScheideTrunkRotationColoring G k e0 phi T N hbalanced j hj + obtain ⟨T', hglobal, hlength, hvertices, htrunkVertices, + htailVertices, htrunkEdges, htailEdges⟩ := + ScheideTrunkRotationTree G k e0 phi psi T N hbalanced j hj A B hAB + hA hB hproper hone hmissA hmissB hshift hfixed + obtain ⟨N', hheight, halpha, hbeta, pred, hpred, hclosing⟩ := + ScheideTrunkRotationNormal G k e0 phi psi T N hbalanced j hj A B + hAB hA hB hshift hfixed T' hglobal hmissA hmissB hlength + htrunkVertices htrunkEdges + refine ⟨NormalCycleEdge N j, psi, T', N', ?_, ?_⟩ + · exact ⟨hj, rfl, hone.1, hshift, hfixed, hlength, hheight, + hvertices, htrunkVertices, htailVertices, htrunkEdges, + htailEdges, pred, hpred, hclosing⟩ + · constructor + · rw [hheight] + exact hbalanced.1 + · intro q hlow hupp + have hlow' : N.height < 2 * q := by + rw [hheight] at hlow + exact hlow + have hupp' : 2 * q < T.length + 1 := by + rw [hlength] at hupp + exact hupp + let r1 : Fin T'.length := ⟨2 * q - 2, by omega⟩ + let r2 : Fin T'.length := ⟨2 * q - 1, by omega⟩ + have hr1 : N.height - 1 ≤ r1.val := by + dsimp [r1] + omega + have hr2 : N.height - 1 ≤ r2.val := by + dsimp [r2] + omega + obtain ⟨s1, hs1val, hs1edge⟩ := htailEdges r1 hr1 + obtain ⟨s2, hs2val, hs2edge⟩ := htailEdges r2 hr2 + have hs1tail : N.height - 1 ≤ s1.val := by omega + have hs2tail : N.height - 1 ≤ s2.val := by omega + have hs1eq : s1 = (⟨2 * q - 2, by omega⟩ : Fin T.length) := by + apply Fin.ext + simpa [r1] using hs1val + have hs2eq : s2 = (⟨2 * q - 1, by omega⟩ : Fin T.length) := by + apply Fin.ext + simpa [r2] using hs2val + change psi (T'.edge r1) = psi (T'.edge r2) + calc + psi (T'.edge r1) = psi (T.edge s1) := congrArg psi hs1edge + _ = phi (T.edge s1) := htailColor s1 hs1tail + _ = phi (T.edge s2) := by + rw [hs1eq, hs2eq] + exact hbalanced.2 q hlow' hupp' + _ = psi (T.edge s2) := (htailColor s2 hs2tail).symm + _ = psi (T'.edge r2) := congrArg psi hs2edge.symm + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideTrunkRotationTree.lean b/LeanPool/GoldbergSeymour/ScheideTrunkRotationTree.lean new file mode 100644 index 0000000000..c6ce8756a7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideTrunkRotationTree.lean @@ -0,0 +1,1267 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.NormalCycleEdge +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring +public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Scheide Trunk Rotation Tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hrho_injective_91.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + Function.Injective rho := by + classical + intro V E _ _ _ G k e0 phi T N j A B rho a b hab + have hmod (r : Fin N.height) : + (j.val + r.val) % N.height = + if j.val + r.val < N.height then + j.val + r.val + else + j.val + r.val - N.height := by + by_cases hr : j.val + r.val < N.height + · simp [hr, Nat.mod_eq_of_lt hr] + · rw [ite_eq_right hr, Nat.mod_eq_sub_mod (by omega)] + rw [Nat.mod_eq_of_lt] + omega + have hv := congrArg Fin.val hab + change (j.val + a.val) % N.height = + (j.val + b.val) % N.height at hv + rw [hmod a, hmod b] at hv + by_cases ha : j.val + a.val < N.height <;> + by_cases hb : j.val + b.val < N.height <;> + simp [ha, hb] at hv <;> + apply Fin.ext <;> omega + +private theorem helper_hvertex_injective_155.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k), + (3 : ℕ) ≤ N.height → + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + Function.Injective rho → + let newVertex : Fin (T.length + (1 : ℕ)) → V := fun (r : Fin (T.length + (1 : ℕ))) ↦ + if hr : (↑r : ℕ) < N.height then + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height))) + else T.vertex r; + (∀ (r : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) < N.height), + newVertex r = + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height)))) → + (∀ (r : Fin (T.length + (1 : ℕ))), N.height ≤ (↑r : ℕ) → newVertex r = T.vertex r) → + Function.Injective newVertex := by + classical + intro V E _ _ _ G k e0 phi T N j A B hp3 rho hrho_injective newVertex hvertex_prefix + hvertex_tail a b hab + by_cases ha : a.val < N.height + · by_cases hb : b.val < N.height + · rw [hvertex_prefix a ha, hvertex_prefix b hb] at hab + have hc := T.vertex_injective hab + have hr := hrho_injective (Fin.castLE_injective N.height_upper hc) + apply Fin.ext + have hv := congrArg (fun q : Fin N.height => q.val) hr + simpa using hv + · rw [hvertex_prefix a ha, + hvertex_tail b (by omega)] at hab + have hc := congrArg Fin.val (T.vertex_injective hab) + have hlt := (rho ⟨a.val, ha⟩).isLt + simp at hc + omega + · by_cases hb : b.val < N.height + · rw [hvertex_tail a (by omega), + hvertex_prefix b hb] at hab + have hc := congrArg Fin.val (T.vertex_injective hab) + have hlt := (rho ⟨b.val, hb⟩).isLt + simp at hc + omega + · rw [hvertex_tail a (by omega), + hvertex_tail b (by omega)] at hab + exact T.vertex_injective hab + +private theorem helper_hedge_injective_197.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) + (_ : (3 : ℕ) ≤ N.height), + Function.Injective (NormalCycleEdge N) → + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + Function.Injective rho → + let newEdge : Fin T.length → E := fun (r : Fin T.length) ↦ + if hr : (↑r : ℕ) + (1 : ℕ) < N.height then + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height)) + else T.edge r; + (∀ (r : Fin T.length) (hr : (↑r : ℕ) + (1 : ℕ) < N.height), + newEdge r = + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height))) → + (∀ (r : Fin T.length), N.height - (1 : ℕ) ≤ (↑r : ℕ) → newEdge r = T.edge r) → + (∀ (i : Fin N.height) (r : Fin T.length), + N.height - (1 : ℕ) ≤ (↑r : ℕ) → NormalCycleEdge N i ≠ T.edge r) → + Function.Injective newEdge := by + classical + intro V E _ _ _ G k e0 phi T N j A B hp3 hcycle_injective rho hrho_injective newEdge + hedge_prefix hedge_tail hcycle_tail_ne a b hab + by_cases ha : a.val + 1 < N.height + · by_cases hb : b.val + 1 < N.height + · rw [hedge_prefix a ha, hedge_prefix b hb] at hab + have hc := hcycle_injective hab + have hr := hrho_injective hc + apply Fin.ext + have hv := congrArg (fun q : Fin N.height => q.val) hr + simpa using hv + · rw [hedge_prefix a ha, hedge_tail b (by omega)] at hab + exfalso + exact (hcycle_tail_ne _ b (by omega)) hab + · by_cases hb : b.val + 1 < N.height + · rw [hedge_tail a (by omega), hedge_prefix b hb] at hab + exfalso + exact (hcycle_tail_ne _ a (by omega)) hab.symm + · rw [hedge_tail a (by omega), hedge_tail b (by omega)] at hab + exact T.edge_injective hab + +private theorem helper_htransport_index_221.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k), + (3 : ℕ) ≤ N.height → + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + Function.Surjective rho → + let newVertex : Fin (T.length + (1 : ℕ)) → V := fun (r : Fin (T.length + (1 : ℕ))) ↦ + if hr : (↑r : ℕ) < N.height then + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height))) + else T.vertex r; + (∀ (r : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) < N.height), + newVertex r = + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height)))) → + (∀ (r : Fin (T.length + (1 : ℕ))), N.height ≤ (↑r : ℕ) → newVertex r = T.vertex r) → + ∀ (r : Fin T.length), + N.height - (1 : ℕ) ≤ (↑r : ℕ) → + ∀ (a : Fin ((↑r : ℕ) + (1 : ℕ))), + ∃ (b : Fin ((↑r : ℕ) + (1 : ℕ))), + newVertex + (b.castLT + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)) = + T.vertex + (a.castLT + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)) := by + classical + intro V E _ _ _ G k e0 phi T N j A B hp3 rho hrho_surjective newVertex hvertex_prefix + hvertex_tail r hr a + by_cases ha : a.val < N.height + · obtain ⟨q, hq⟩ := hrho_surjective ⟨a.val, ha⟩ + let b : Fin (r.val + 1) := ⟨q.val, by + have hq_lt := q.isLt + omega⟩ + refine ⟨b, ?_⟩ + rw [hvertex_prefix _ (by simp [b])] + apply congrArg T.vertex + apply Fin.ext + have hv := congrArg Fin.val hq + simpa [b] using hv + · let b : Fin (r.val + 1) := ⟨a.val, a.isLt⟩ + refine ⟨b, ?_⟩ + rw [hvertex_tail _ (by simpa [b] using (show N.height ≤ a.val by omega))] + +private theorem helper_hnew_zero_282.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) + (hp3 : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + rho + (⟨(0 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height) = + j → + let newVertex : Fin (T.length + (1 : ℕ)) → V := fun (r : Fin (T.length + (1 : ℕ))) ↦ + if hr : (↑r : ℕ) < N.height then + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height))) + else T.vertex r; + let newEdge : Fin T.length → E := fun (r : Fin T.length) ↦ + if hr : (↑r : ℕ) + (1 : ℕ) < N.height then + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height)) + else T.edge r; + (∀ (r : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) < N.height), + newVertex r = + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height)))) → + ∀ (hvertex_injective : Function.Injective newVertex) + (hedge_injective : Function.Injective newEdge) + (hfirst_edge : newEdge (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = NormalCycleEdge N j) + (hattaches : + ∀ (r : Fin T.length), + ∃ (a : Fin ((↑r : ℕ) + (1 : ℕ))), + G.ends (newEdge r) = + s(newVertex r.succ, + newVertex + (a.castLT + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))), + let T' : TreeSequence G (NormalCycleEdge N j) := + { length := T.length, positive := T.positive, vertex := newVertex, edge := newEdge, + vertex_injective := hvertex_injective, edge_injective := hedge_injective, + first_edge := hfirst_edge, attaches := hattaches : + TreeSequence G (NormalCycleEdge N j) }; + T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin (T'.length + (1 : ℕ))) = + T.vertex (Fin.castLE N.height_upper j) := by + classical + intro V E _ _ _ G k e0 phi T N j A B hp3 rho hrho_zero newVertex newEdge hvertex_prefix + hvertex_injective hedge_injective hfirst_edge hattaches T' + change newVertex ⟨0, Nat.zero_lt_succ T.length⟩ = _ + rw [hvertex_prefix _ (by + change 0 < N.height + omega)] + exact congrArg (fun q => T.vertex (Fin.castLE N.height_upper q)) hrho_zero + +private theorem helper_hcycle_color_pair_306.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (A B : Fin k), + (∀ (i : Fin N.height), + (1 : ℕ) ≤ (↑i : ℕ) → + phi (NormalCycleEdge N i) = if Odd (↑i : ℕ) then some N.alpha else some N.beta) → + (insert N.alpha ({ N.beta } : Finset (Fin k)) : Finset (Fin k)) = + (insert A ({ B } : Finset (Fin k)) : Finset (Fin k)) → + ∀ (q : Fin N.height), + (1 : ℕ) ≤ (↑q : ℕ) → + phi (NormalCycleEdge N q) = some A ∨ phi (NormalCycleEdge N q) = some B := by + classical + intro V E _ _ _ G k e0 phi T N A B hcycle_colors hpair_colors q hq + have hc := hcycle_colors q hq + have halpha : N.alpha = A ∨ N.alpha = B := by + have hm : N.alpha ∈ ({N.alpha, N.beta} : Finset (Fin k)) := by simp + rw [hpair_colors] at hm + simpa using hm + have hbeta : N.beta = A ∨ N.beta = B := by + have hm : N.beta ∈ ({N.alpha, N.beta} : Finset (Fin k)) := by simp + rw [hpair_colors] at hm + simpa using hm + by_cases ho : Odd q.val + · rw [ite_eq_left ho] at hc + rcases halpha with ha | ha + · left + simpa [ha] using hc + · right + simpa [ha] using hc + · rw [ite_eq_right ho] at hc + rcases hbeta with hb | hb + · left + simpa [hb] using hc + · right + simpa [hb] using hc + +private theorem helper_htrunk_color_331.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi psi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height), + (1 : ℕ) ≤ (↑j : ℕ) → + ∀ (A B : Fin k), + (∀ (i : Fin (↑j : ℕ)), + psi + (NormalCycleEdge N + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i)) = + phi + (NormalCycleEdge N + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height))) → + (∀ (f : E), + (∀ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + f ≠ + NormalCycleEdge N + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i)) → + psi f = phi f) → + ∀ (hp3 : (3 : ℕ) ≤ N.height), + Function.Injective (NormalCycleEdge N) → + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + Function.Injective rho → + rho + (⟨(0 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height) = + j → + let newEdge : Fin T.length → E := fun (r : Fin T.length) ↦ + if hr : (↑r : ℕ) + (1 : ℕ) < N.height then + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height)) + else T.edge r; + (∀ (r : Fin T.length) (hr : (↑r : ℕ) + (1 : ℕ) < N.height), + newEdge r = + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height))) → + (∀ (q : Fin N.height), + (1 : ℕ) ≤ (↑q : ℕ) → + phi (NormalCycleEdge N q) = some A ∨ phi (NormalCycleEdge N q) = some B) → + ∀ (r : Fin T.length), + (1 : ℕ) ≤ (↑r : ℕ) → + (↑r : ℕ) + (1 : ℕ) < N.height → + psi (newEdge r) = some A ∨ psi (newEdge r) = some B := by + classical + intro V E _ _ _ G k e0 phi psi T N j hj A B hshift hfixed hp3 hcycle_injective rho + hrho_injective hrho_zero newEdge hedge_prefix hcycle_color_pair r hrpos hr + let q : Fin N.height := rho ⟨r.val, by omega⟩ + rw [hedge_prefix r hr] + change psi (NormalCycleEdge N q) = some A ∨ + psi (NormalCycleEdge N q) = some B + have hqj : q ≠ j := by + intro heq + have hz := hrho_injective (heq.trans hrho_zero.symm) + have hv := congrArg Fin.val hz + simp at hv + omega + by_cases hq : q.val < j.val + · let a : Fin j.val := ⟨q.val, hq⟩ + have hs := hshift a + have hc := hcycle_color_pair + ⟨a.val + 1, by + have hjlt := j.isLt + simp [a] at * + omega⟩ (by simp [a]) + have hqa : Fin.castLE (Nat.le_of_lt j.isLt) a = q := by + apply Fin.ext + rfl + rw [hqa] at hs + rw [hs] + simpa [a] using hc + · have hqgt : j.val < q.val := by + have hn : q.val ≠ j.val := by + intro hn + apply hqj + apply Fin.ext + exact hn + omega + have hf : psi (NormalCycleEdge N q) = phi (NormalCycleEdge N q) := by + apply hfixed + intro a heq + have hi := hcycle_injective heq + have hv := congrArg Fin.val hi + simp at hv + omega + rw [hf] + exact hcycle_color_pair q (by omega) + +private theorem helper_hmissing_preserved_374.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi psi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (A B : Fin k), + IsOneEdgeUncolored psi (NormalCycleEdge N j) → + (∀ (i : Fin (↑j : ℕ)), + psi + (NormalCycleEdge N + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i)) = + phi + (NormalCycleEdge N + (⟨(↑i : ℕ) + (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height))) → + (∀ (f : E), + (∀ (i : Fin ((↑j : ℕ) + (1 : ℕ))), + f ≠ + NormalCycleEdge N + (Fin.castLE + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + i)) → + psi f = phi f) → + ∀ (hp3 : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + rho + (⟨(0 : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height) = + j → + (∀ (q : Fin N.height), + (1 : ℕ) ≤ (↑q : ℕ) → + phi (NormalCycleEdge N q) = some A ∨ phi (NormalCycleEdge N q) = some B) → + ∀ (v : V) (c : Fin k), + c ≠ A → + c ≠ B → + c ∈ MissingColors G phi v → + c ∈ MissingColors G psi v := by + classical + intro V E _ _ _ G k e0 phi psi T N j A B hone hshift hfixed hp3 rho hrho_zero hcycle_color_pair + v c hcA hcB hc + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, + true_and] at hc ⊢ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + obtain ⟨f, hfv, hfc⟩ := hpresent + by_cases hspecial : ∃ q : Fin (j.val + 1), + f = NormalCycleEdge N + (Fin.castLE (Nat.succ_le_iff.mpr j.isLt) q) + · obtain ⟨q, hq⟩ := hspecial + by_cases hlast : q.val = j.val + · have hqj : Fin.castLE (Nat.succ_le_iff.mpr j.isLt) q = j := by + apply Fin.ext + exact hlast + rw [hq, hqj, hone.1] at hfc + simp at hfc + · let a : Fin j.val := ⟨q.val, by omega⟩ + have hqa : Fin.castLE (Nat.le_of_lt j.isLt) a = + Fin.castLE (Nat.succ_le_iff.mpr j.isLt) q := by + apply Fin.ext + rfl + have hs := hshift a + rw [hq, ← hqa, hs] at hfc + have hpair := hcycle_color_pair + ⟨a.val + 1, by + have hjlt := j.isLt + simp [a] at * + omega⟩ (by simp [a]) + rcases hpair with hpair | hpair + · rw [hpair] at hfc + exact hcA (Option.some.inj hfc.symm) + · rw [hpair] at hfc + exact hcB (Option.some.inj hfc.symm) + · have hfix : psi f = phi f := by + apply hfixed + intro q heq + exact hspecial ⟨q, heq⟩ + apply hc + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hfv, hfix.symm.trans hfc⟩ + +private theorem helper_hvertex_set_477.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) + (_ : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + Function.Surjective rho → + let newVertex : Fin (T.length + (1 : ℕ)) → V := fun (r : Fin (T.length + (1 : ℕ))) ↦ + if hr : (↑r : ℕ) < N.height then + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height))) + else T.vertex r; + let newEdge : Fin T.length → E := fun (r : Fin T.length) ↦ + if hr : (↑r : ℕ) + (1 : ℕ) < N.height then + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height)) + else T.edge r; + (∀ (r : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) < N.height), + newVertex r = + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height)))) → + (∀ (r : Fin (T.length + (1 : ℕ))), N.height ≤ (↑r : ℕ) → newVertex r = T.vertex r) → + ∀ (hvertex_injective : Function.Injective newVertex) + (hedge_injective : Function.Injective newEdge) + (hfirst_edge : newEdge (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = NormalCycleEdge N j) + (hattaches : + ∀ (r : Fin T.length), + ∃ (a : Fin ((↑r : ℕ) + (1 : ℕ))), + G.ends (newEdge r) = + s(newVertex r.succ, + newVertex + (a.castLT + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))), + let T' : TreeSequence G (NormalCycleEdge N j) := + { length := T.length, positive := T.positive, vertex := newVertex, edge := newEdge, + vertex_injective := hvertex_injective, edge_injective := hedge_injective, + first_edge := hfirst_edge, attaches := hattaches : + TreeSequence G (NormalCycleEdge N j) }; + TreeSequenceVertexSet T' = TreeSequenceVertexSet T := by + classical + intro V E _ _ _ G k e0 phi T N j A B hp3 rho hrho_surjective newVertex newEdge hvertex_prefix + hvertex_tail hvertex_injective hedge_injective hfirst_edge hattaches T' + apply Finset.ext + intro v + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + constructor + · rintro ⟨a, rfl⟩ + change ∃ b : Fin (T.length + 1), T.vertex b = newVertex a + by_cases ha : a.val < N.height + · refine ⟨Fin.castLE N.height_upper (rho ⟨a.val, ha⟩), ?_⟩ + exact (hvertex_prefix a ha).symm + · refine ⟨a, ?_⟩ + exact (hvertex_tail a (by omega)).symm + · rintro ⟨a, rfl⟩ + change ∃ b : Fin (T.length + 1), newVertex b = T.vertex a + by_cases ha : a.val < N.height + · obtain ⟨q, hq⟩ := hrho_surjective ⟨a.val, ha⟩ + let b : Fin (T.length + 1) := + ⟨q.val, Nat.lt_of_lt_of_le q.isLt N.height_upper⟩ + refine ⟨b, ?_⟩ + rw [hvertex_prefix b (by simp [b])] + apply congrArg T.vertex + apply Fin.ext + have hv := congrArg Fin.val hq + simpa [b] using hv + · refine ⟨a, hvertex_tail a (by omega)⟩ + +private theorem helper_branch_510.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) + (_ : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + (∀ (r : Fin N.height), (↑(rho r) : ℕ) = ((↑j : ℕ) + (↑r : ℕ)) % N.height) → + let newVertex : Fin (T.length + (1 : ℕ)) → V := fun (r : Fin (T.length + (1 : ℕ))) ↦ + if hr : (↑r : ℕ) < N.height then + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height))) + else T.vertex r; + let newEdge : Fin T.length → E := fun (r : Fin T.length) ↦ + if hr : (↑r : ℕ) + (1 : ℕ) < N.height then + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height)) + else T.edge r; + (∀ (r : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) < N.height), + newVertex r = + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height)))) → + ∀ (hvertex_injective : Function.Injective newVertex) + (hedge_injective : Function.Injective newEdge) + (hfirst_edge : newEdge (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = NormalCycleEdge N j) + (hattaches : + ∀ (r : Fin T.length), + ∃ (a : Fin ((↑r : ℕ) + (1 : ℕ))), + G.ends (newEdge r) = + s(newVertex r.succ, + newVertex + (a.castLT + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))), + let T' : TreeSequence G (NormalCycleEdge N j) := + { length := T.length, positive := T.positive, vertex := newVertex, edge := newEdge, + vertex_injective := hvertex_injective, edge_injective := hedge_injective, + first_edge := hfirst_edge, attaches := hattaches : + TreeSequence G (NormalCycleEdge N j) }; + ∀ (r : Fin (T'.length + (1 : ℕ))), + (↑r : ℕ) < N.height → + ∃ (i : Fin N.height), + (↑i : ℕ) = ((↑j : ℕ) + (↑r : ℕ)) % N.height ∧ + T'.vertex r = T.vertex (Fin.castLE N.height_upper i) := by + classical + intro V E _ _ _ G k e0 phi T N j A B hp3 rho hrho_val newVertex newEdge hvertex_prefix + hvertex_injective hedge_injective hfirst_edge hattaches T' r hr + let i : Fin N.height := rho ⟨r.val, hr⟩ + refine ⟨i, ?_, ?_⟩ + · exact hrho_val ⟨r.val, hr⟩ + · change newVertex r = _ + rw [hvertex_prefix r hr] + +private theorem helper_branch_520.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) + (_ : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + (∀ (r : Fin N.height), (↑(rho r) : ℕ) = ((↑j : ℕ) + (↑r : ℕ)) % N.height) → + let newVertex : Fin (T.length + (1 : ℕ)) → V := fun (r : Fin (T.length + (1 : ℕ))) ↦ + if hr : (↑r : ℕ) < N.height then + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height))) + else T.vertex r; + let newEdge : Fin T.length → E := fun (r : Fin T.length) ↦ + if hr : (↑r : ℕ) + (1 : ℕ) < N.height then + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height)) + else T.edge r; + (∀ (r : Fin T.length) (hr : (↑r : ℕ) + (1 : ℕ) < N.height), + newEdge r = + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height))) → + ∀ (hvertex_injective : Function.Injective newVertex) + (hedge_injective : Function.Injective newEdge) + (hfirst_edge : newEdge (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = NormalCycleEdge N j) + (hattaches : + ∀ (r : Fin T.length), + ∃ (a : Fin ((↑r : ℕ) + (1 : ℕ))), + G.ends (newEdge r) = + s(newVertex r.succ, + newVertex + (a.castLT + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))), + let T' : TreeSequence G (NormalCycleEdge N j) := + { length := T.length, positive := T.positive, vertex := newVertex, edge := newEdge, + vertex_injective := hvertex_injective, edge_injective := hedge_injective, + first_edge := hfirst_edge, attaches := hattaches : + TreeSequence G (NormalCycleEdge N j) }; + ∀ (r : Fin T'.length), + (↑r : ℕ) + (1 : ℕ) < N.height → + ∃ (i : Fin N.height), + (↑i : ℕ) = ((↑j : ℕ) + (↑r : ℕ)) % N.height ∧ + T'.edge r = NormalCycleEdge N i := by + classical + intro V E _ _ _ G k e0 phi T N j A B hp3 rho hrho_val newVertex newEdge hedge_prefix + hvertex_injective hedge_injective hfirst_edge hattaches T' r hr + let i : Fin N.height := rho ⟨r.val, by omega⟩ + refine ⟨i, ?_, ?_⟩ + · exact hrho_val ⟨r.val, by omega⟩ + · change newEdge r = _ + rw [hedge_prefix r hr] + +private theorem helper_branch_526.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) + (_ : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + let newVertex : Fin (T.length + (1 : ℕ)) → V := fun (r : Fin (T.length + (1 : ℕ))) ↦ + if hr : (↑r : ℕ) < N.height then + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height))) + else T.vertex r; + let newEdge : Fin T.length → E := fun (r : Fin T.length) ↦ + if hr : (↑r : ℕ) + (1 : ℕ) < N.height then + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin N.height)) + else T.edge r; + (∀ (r : Fin T.length), N.height - (1 : ℕ) ≤ (↑r : ℕ) → newEdge r = T.edge r) → + ∀ (hvertex_injective : Function.Injective newVertex) + (hedge_injective : Function.Injective newEdge) + (hfirst_edge : newEdge (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = NormalCycleEdge N j) + (hattaches : + ∀ (r : Fin T.length), + ∃ (a : Fin ((↑r : ℕ) + (1 : ℕ))), + G.ends (newEdge r) = + s(newVertex r.succ, + newVertex + (a.castLT + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))), + let T' : TreeSequence G (NormalCycleEdge N j) := + { length := T.length, positive := T.positive, vertex := newVertex, edge := newEdge, + vertex_injective := hvertex_injective, edge_injective := hedge_injective, + first_edge := hfirst_edge, attaches := hattaches : + TreeSequence G (NormalCycleEdge N j) }; + ∀ (r : Fin T'.length), + N.height - (1 : ℕ) ≤ (↑r : ℕ) → + ∃ (s : Fin T.length), + (↑s : ℕ) = (↑r : ℕ) ∧ + T'.edge r = T.edge s := by + classical + intro V E _ _ _ G k e0 phi T N j A B hp3 rho newVertex newEdge hedge_tail hvertex_injective + hedge_injective hfirst_edge hattaches T' r hr + refine ⟨⟨r.val, by simp [T']⟩, rfl, ?_⟩ + change newEdge r = _ + exact hedge_tail r hr + +private theorem helper_hrho_succ_760.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) + (hp3 : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + ∀ (r : Fin N.height) (hr : (↑r : ℕ) + (1 : ℕ) < N.height), + rho (⟨(↑r : ℕ) + (1 : ℕ), hr⟩ : Fin N.height) = + (⟨((↑(rho r) : ℕ) + (1 : ℕ)) % N.height, + Nat.mod_lt ((↑(rho r) : ℕ) + (1 : ℕ)) + (by + omega)⟩ : + Fin N.height) := by + classical + intro V E _ _ _ G k e0 phi T N j A B hp3 rho r hr + apply Fin.ext + change (j.val + (r.val + 1)) % N.height = + (((j.val + r.val) % N.height) + 1) % N.height + calc + (j.val + (r.val + 1)) % N.height = + ((j.val + r.val) + 1) % N.height := by congr 1 + _ = (((j.val + r.val) % N.height) + (1 % N.height)) % + N.height := Nat.add_mod (j.val + r.val) 1 N.height + _ = (((j.val + r.val) % N.height) + 1) % N.height := by + rw [Nat.mod_eq_of_lt (by omega : 1 < N.height)] + +private theorem helper_hnew_one_874.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (_ _ : Fin k) + (hp3 : (3 : ℕ) ≤ N.height), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + (∀ (r : Fin N.height), (↑(rho r) : ℕ) = ((↑j : ℕ) + (↑r : ℕ)) % N.height) → + let newVertex : Fin (T.length + (1 : ℕ)) → V := fun (r : Fin (T.length + (1 : ℕ))) ↦ + if hr : (↑r : ℕ) < N.height then + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height))) + else T.vertex r; + let newEdge : Fin T.length → E := fun (r : Fin T.length) ↦ + if hr : (↑r : ℕ) + (1 : ℕ) < N.height then + NormalCycleEdge N + (rho + (⟨(↑r : ℕ), by + omega⟩ : + Fin N.height)) + else T.edge r; + (∀ (r : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) < N.height), + newVertex r = + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height)))) → + ∀ (hvertex_injective : Function.Injective newVertex) + (hedge_injective : Function.Injective newEdge) + (hfirst_edge : newEdge (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = NormalCycleEdge N j) + (hattaches : + ∀ (r : Fin T.length), + ∃ (a : Fin ((↑r : ℕ) + (1 : ℕ))), + G.ends (newEdge r) = + s(newVertex r.succ, + newVertex (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt))))), + let T' : TreeSequence G (NormalCycleEdge N j) := + { length := T.length, positive := T.positive, vertex := newVertex, edge := newEdge, + vertex_injective := hvertex_injective, edge_injective := hedge_injective, + first_edge := hfirst_edge, attaches := hattaches : + TreeSequence G (NormalCycleEdge N j) }; + T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T'.positive⟩ : Fin (T'.length + (1 : ℕ))) = + T.vertex + (Fin.castLE N.height_upper + (⟨((↑j : ℕ) + (1 : ℕ)) % N.height, + Nat.mod_lt ((↑j : ℕ) + (1 : ℕ)) + (by + omega)⟩ : + Fin N.height)) := by + classical + intro V E _ _ _ G k e0 phi T N j A B hp3 rho hrho_val newVertex newEdge hvertex_prefix + hvertex_injective hedge_injective hfirst_edge hattaches T' + change newVertex ⟨1, Nat.succ_lt_succ T.positive⟩ = _ + rw [hvertex_prefix _ (by + change 1 < N.height + omega)] + apply congrArg T.vertex + apply Fin.ext + exact hrho_val ⟨1, by omega⟩ + +private abbrev helperContinuation1037Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi psi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) + (hj : (1 : ℕ) ≤ (↑j : ℕ)) (A B : Fin k) (_ : IsProperEdgeColoring G psi) + (_ : IsOneEdgeUncolored psi (NormalCycleEdge N j)) + (_ : A ∈ MissingColors G psi (T.vertex (Fin.castLE N.height_upper j))) + (_ : + B ∈ + MissingColors G psi + (T.vertex + (Fin.castLE N.height_upper + (⟨((↑j : ℕ) + (1 : ℕ)) % N.height, by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.NormalGlobalMaximumTriple.height_upper N + have := Fin.isLt j + all_goals + first + | omega + | exact Nat.mod_lt _ (by omega))⟩ : + Fin N.height)))) + (_ : + ∀ (i : Fin (↑j : ℕ)), + psi (NormalCycleEdge N (Fin.castLE (Nat.le_of_lt j.isLt) i)) = + phi (NormalCycleEdge N (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin N.height))) + (_ : + ∀ (f : E), + (∀ (i : Fin ((↑j : ℕ) + (1 : ℕ))), f ≠ NormalCycleEdge N (Fin.castLE (by omega) i)) → + psi f = phi f) + (hp3 : (3 : ℕ) ≤ N.height) (_ : Function.Injective (NormalCycleEdge N)) + (_ : + ∀ (i : Fin N.height), + (1 : ℕ) ≤ (↑i : ℕ) → + phi (NormalCycleEdge N i) = if Odd (↑i : ℕ) then some N.alpha else some N.beta), + let rho : Fin N.height → Fin N.height := fun (r : Fin N.height) ↦ j + r; + ∀ (_ : ∀ (r : Fin N.height), (↑(rho r) : ℕ) = ((↑j : ℕ) + (↑r : ℕ)) % N.height) + (_ : Function.Injective rho) (_ : Function.Surjective rho) + (_ : rho (⟨(0 : ℕ), by omega⟩ : Fin N.height) = j), + let newVertex : Fin (T.length + (1 : ℕ)) → V := fun (r : Fin (T.length + (1 : ℕ))) ↦ + if hr : (↑r : ℕ) < N.height then + T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height))) + else T.vertex r; + let newEdge : Fin T.length → E := fun (r : Fin T.length) ↦ + if hr : (↑r : ℕ) + (1 : ℕ) < N.height then + NormalCycleEdge N (rho (⟨(↑r : ℕ), by omega⟩ : Fin N.height)) + else T.edge r; + ∀ + (_ : + ∀ (r : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) < N.height), + newVertex r = T.vertex (Fin.castLE N.height_upper (rho (⟨(↑r : ℕ), hr⟩ : Fin N.height)))) + (_ : ∀ (r : Fin (T.length + (1 : ℕ))) (_ : N.height ≤ (↑r : ℕ)), newVertex r = T.vertex r) + (_ : + ∀ (r : Fin T.length) (hr : (↑r : ℕ) + (1 : ℕ) < N.height), + newEdge r = NormalCycleEdge N (rho (⟨(↑r : ℕ), by omega⟩ : Fin N.height))) + (_ : ∀ (r : Fin T.length) (_ : N.height - (1 : ℕ) ≤ (↑r : ℕ)), newEdge r = T.edge r) + (hvertex_injective : Function.Injective newVertex) + (_ : + ∀ (i : Fin N.height) (r : Fin T.length) (_ : N.height - (1 : ℕ) ≤ (↑r : ℕ)), + NormalCycleEdge N i ≠ T.edge r) + (hedge_injective : Function.Injective newEdge) + (hfirst_edge : newEdge (⟨(0 : ℕ), T.positive⟩ : Fin T.length) = NormalCycleEdge N j) + (_ : + ∀ (r : Fin T.length) (_ : N.height - (1 : ℕ) ≤ (↑r : ℕ)) (a : Fin ((↑r : ℕ) + (1 : ℕ))), + ∃ (b : Fin ((↑r : ℕ) + (1 : ℕ))), + newVertex (b.castLT (Nat.lt_trans b.isLt (Nat.succ_lt_succ r.isLt))) = + T.vertex (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt)))) + (hattaches : + ∀ (r : Fin T.length), + ∃ (a : Fin ((↑r : ℕ) + (1 : ℕ))), + G.ends (newEdge r) = + s(newVertex r.succ, newVertex (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt))))), + let T' : TreeSequence G (NormalCycleEdge N j) := + { + length := T.length, positive := T.positive, vertex := newVertex, edge := newEdge, + vertex_injective := hvertex_injective, edge_injective := hedge_injective, + first_edge := hfirst_edge, attaches := hattaches : TreeSequence G (NormalCycleEdge N j) }; + ∀ + (_ : + T'.vertex (⟨(0 : ℕ), Nat.zero_lt_succ T'.length⟩ : Fin (T'.length + (1 : ℕ))) = + T.vertex (Fin.castLE N.height_upper j)) + (_ : + T'.vertex (⟨(1 : ℕ), Nat.succ_lt_succ T'.positive⟩ : Fin (T'.length + (1 : ℕ))) = + T.vertex + (Fin.castLE N.height_upper + (⟨((↑j : ℕ) + (1 : ℕ)) % N.height, Nat.mod_lt ((↑j : ℕ) + (1 : ℕ)) (by omega)⟩ : + Fin N.height))) + (_ : + (insert N.alpha ({ N.beta } : Finset (Fin k)) : Finset (Fin k)) = + (insert A ({ B } : Finset (Fin k)) : Finset (Fin k))), + ∃ (T' : TreeSequence G (NormalCycleEdge N j)), + GlobalMaximumTriple G k (NormalCycleEdge N j) psi T' ∧ + T'.length = T.length ∧ + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + (∀ (r : Fin (T'.length + (1 : ℕ))), + (↑r : ℕ) < N.height → + ∃ (i : Fin N.height), + (↑i : ℕ) = ((↑j : ℕ) + (↑r : ℕ)) % N.height ∧ + T'.vertex r = T.vertex (Fin.castLE N.height_upper i)) ∧ + (∀ (r : Fin (T'.length + (1 : ℕ))), + N.height ≤ (↑r : ℕ) → + ∃ (s : Fin (T.length + (1 : ℕ))), (↑s : ℕ) = (↑r : ℕ) ∧ T'.vertex r = T.vertex s) ∧ + (∀ (r : Fin T'.length), + (↑r : ℕ) + (1 : ℕ) < N.height → + ∃ (i : Fin N.height), + (↑i : ℕ) = ((↑j : ℕ) + (↑r : ℕ)) % N.height ∧ T'.edge r = NormalCycleEdge N i) ∧ + ∀ (r : Fin T'.length), + N.height - (1 : ℕ) ≤ (↑r : ℕ) → + ∃ (s : Fin T.length), (↑s : ℕ) = (↑r : ℕ) ∧ T'.edge r = T.edge s + +private theorem helper_continuation_1037.{u_1, u_2} : + helperContinuation1037Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi psi T N j hj A B hproper hone hmissA hmissB hshift hfixed hp3 + hcycle_injective hcycle_colors rho hrho_val hrho_injective hrho_surjective hrho_zero + newVertex newEdge hvertex_prefix hvertex_tail hedge_prefix hedge_tail hvertex_injective + hcycle_tail_ne hedge_injective hfirst_edge htransport_index hattaches T' hnew_zero hnew_one + hpair_colors + have hcycle_color_pair (q : Fin N.height) (hq : 1 ≤ q.val) : + phi (NormalCycleEdge N q) = some A ∨ + phi (NormalCycleEdge N q) = some B := by + exact @helper_hcycle_color_pair_306 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@A) (@B) (@hcycle_colors) (@hpair_colors) (@q) (@hq) + have htrunk_color (r : Fin T.length) (hrpos : 1 ≤ r.val) + (hr : r.val + 1 < N.height) : + psi (newEdge r) = some A ∨ psi (newEdge r) = some B := by + exact @helper_htrunk_color_331 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@psi) (@T) (@N) (@j) (@hj) (@A) (@B) (@hshift) (@hfixed) (@hp3) + (@hcycle_injective) (@hrho_injective) (@hrho_zero) (@hedge_prefix) (@hcycle_color_pair) + (@r) (@hrpos) (@hr) + have hmissing_preserved (v : V) (c : Fin k) + (hcA : c ≠ A) (hcB : c ≠ B) + (hc : c ∈ MissingColors G phi v) : + c ∈ MissingColors G psi v := by + exact @helper_hmissing_preserved_374 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@psi) (@T) (@N) (@j) (@A) (@B) (@hone) (@hshift) (@hfixed) (@hp3) + (@hrho_zero) (@hcycle_color_pair) (@v) (@c) (@hcA) (@hcB) (@hc) + have htashkinov : TashkinovTree G (NormalCycleEdge N j) psi T' := by + intro r hrpos + change ∃ a : Fin (r.val + 1), ∃ c : Fin k, + psi (newEdge r) = some c ∧ + c ∈ MissingColors G psi + (newVertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt)))) + by_cases hr : r.val + 1 < N.height + · rcases htrunk_color r hrpos hr with hc | hc + · let a : Fin (r.val + 1) := ⟨0, by omega⟩ + refine ⟨a, A, hc, ?_⟩ + change A ∈ MissingColors G psi + (newVertex ⟨0, Nat.zero_lt_succ T.length⟩) + rw [show newVertex ⟨0, Nat.zero_lt_succ T.length⟩ = + T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩ by rfl, + hnew_zero] + exact hmissA + · let a : Fin (r.val + 1) := ⟨1, by omega⟩ + refine ⟨a, B, hc, ?_⟩ + change B ∈ MissingColors G psi + (newVertex ⟨1, Nat.succ_lt_succ T.positive⟩) + rw [show newVertex ⟨1, Nat.succ_lt_succ T.positive⟩ = + T'.vertex ⟨1, Nat.succ_lt_succ T'.positive⟩ by rfl, + hnew_one] + exact hmissB + · obtain ⟨a, c, hc, hcmiss⟩ := N.global.2.1 r hrpos + have htail : N.height - 1 ≤ r.val := by omega + have hfix : psi (T.edge r) = phi (T.edge r) := by + apply hfixed + intro q heq + exact (hcycle_tail_ne _ r htail) heq.symm + have hcnew : psi (newEdge r) = some c := by + rw [hedge_tail r htail, hfix] + exact hc + by_cases hcA : c = A + · let b : Fin (r.val + 1) := ⟨0, by omega⟩ + refine ⟨b, c, hcnew, ?_⟩ + subst c + change A ∈ MissingColors G psi + (newVertex ⟨0, Nat.zero_lt_succ T.length⟩) + rw [show newVertex ⟨0, Nat.zero_lt_succ T.length⟩ = + T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩ by rfl, + hnew_zero] + exact hmissA + · by_cases hcB : c = B + · let b : Fin (r.val + 1) := ⟨1, by omega⟩ + refine ⟨b, c, hcnew, ?_⟩ + subst c + change B ∈ MissingColors G psi + (newVertex ⟨1, Nat.succ_lt_succ T.positive⟩) + rw [show newVertex ⟨1, Nat.succ_lt_succ T.positive⟩ = + T'.vertex ⟨1, Nat.succ_lt_succ T'.positive⟩ by rfl, + hnew_one] + exact hmissB + · obtain ⟨b, hb⟩ := htransport_index r htail a + refine ⟨b, c, hcnew, ?_⟩ + rw [hb] + exact hmissing_preserved _ c hcA hcB hcmiss + have hvertex_set : TreeSequenceVertexSet T' = TreeSequenceVertexSet T := by + exact @helper_hvertex_set_477 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@j) (@A) (@B) (@hp3) (@hrho_surjective) (@hvertex_prefix) + (@hvertex_tail) (@hvertex_injective) (@hedge_injective) (@hfirst_edge) (@hattaches) + have hglobal : + GlobalMaximumTriple G k (NormalCycleEdge N j) psi T' := by + refine ⟨⟨N.global.1.1, N.global.1.2.1, + N.global.1.2.2.1, hproper, hone⟩, htashkinov, ?_⟩ + rw [hvertex_set] + exact N.global.2.2 + refine ⟨T', hglobal, rfl, hvertex_set, ?_, ?_, ?_, ?_⟩ + · exact @helper_branch_510 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@j) (@A) (@B) (@hp3) (@hrho_val) (@hvertex_prefix) (@hvertex_injective) + (@hedge_injective) (@hfirst_edge) (@hattaches) + · intro r hr + refine ⟨⟨r.val, by simpa [T'] using r.isLt⟩, rfl, ?_⟩ + change newVertex r = _ + exact hvertex_tail r hr + · exact @helper_branch_520 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@j) (@A) (@B) (@hp3) (@hrho_val) (@hedge_prefix) (@hvertex_injective) + (@hedge_injective) (@hfirst_edge) (@hattaches) + · exact @helper_branch_526 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@N) (@j) (@A) (@B) (@hp3) (@hedge_tail) (@hvertex_injective) + (@hedge_injective) (@hfirst_edge) (@hattaches) + +theorem ScheideTrunkRotationTree {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi psi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (N : NormalGlobalMaximumTriple G k e0 phi T) + (hbalanced : BalancedGlobalMaximumTriple N) + (j : Fin N.height) (hj : 1 ≤ j.val) (A B : Fin k) + (_ : A ≠ B) + (hA : A = (if Odd j.val then N.beta else N.alpha)) + (hB : B = (if Odd j.val then N.alpha else N.beta)) + (hproper : IsProperEdgeColoring G psi) + (hone : IsOneEdgeUncolored psi (NormalCycleEdge N j)) + (hmissA : A ∈ MissingColors G psi + (T.vertex (Fin.castLE N.height_upper j))) + (hmissB : B ∈ MissingColors G psi + (T.vertex (Fin.castLE N.height_upper + ⟨(j.val + 1) % N.height, by + exact Nat.mod_lt _ (by + have hp := N.height_lower + omega)⟩))) + (hshift : ∀ i : Fin j.val, + psi (NormalCycleEdge N + (Fin.castLE (Nat.le_of_lt j.isLt) i)) = + phi (NormalCycleEdge N + ⟨i.val + 1, by + have hi := i.isLt + have _ := j.isLt + omega⟩)) + (hfixed : ∀ f : E, + (∀ i : Fin (j.val + 1), + f ≠ NormalCycleEdge N + (Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i)) → + psi f = phi f) : + ∃ T' : TreeSequence G (NormalCycleEdge N j), + GlobalMaximumTriple G k (NormalCycleEdge N j) psi T' ∧ + T'.length = T.length ∧ + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + (∀ r : Fin (T'.length + 1), r.val < N.height → + ∃ i : Fin N.height, + i.val = (j.val + r.val) % N.height ∧ + T'.vertex r = T.vertex (Fin.castLE N.height_upper i)) ∧ + (∀ r : Fin (T'.length + 1), N.height ≤ r.val → + ∃ s : Fin (T.length + 1), + s.val = r.val ∧ T'.vertex r = T.vertex s) ∧ + (∀ r : Fin T'.length, r.val + 1 < N.height → + ∃ i : Fin N.height, + i.val = (j.val + r.val) % N.height ∧ + T'.edge r = NormalCycleEdge N i) ∧ + ∀ r : Fin T'.length, N.height - 1 ≤ r.val → + ∃ s : Fin T.length, + s.val = r.val ∧ T'.edge r = T.edge s := by + classical + obtain ⟨hp3, _hpodd, hcycle_injective, hcycle_ends, hcycle_colors⟩ := + ScheideTrunkRotationCycle G k e0 phi T N hbalanced + let rho : Fin N.height → Fin N.height := fun r => j + r + have hrho_val (r : Fin N.height) : + (rho r).val = (j.val + r.val) % N.height := by + rfl + have hrho_injective : Function.Injective rho := by + exact @helper_hrho_injective_91 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@j) (@A) (@B) + have hrho_surjective : Function.Surjective rho := + Finite.injective_iff_surjective.mp hrho_injective + have hrho_zero : rho ⟨0, by omega⟩ = j := by + apply Fin.ext + change (j.val + 0) % N.height = j.val + simpa using Nat.mod_eq_of_lt j.isLt + have hrho_succ (r : Fin N.height) (hr : r.val + 1 < N.height) : + rho ⟨r.val + 1, hr⟩ = + ⟨((rho r).val + 1) % N.height, Nat.mod_lt _ (by omega)⟩ := by + exact @helper_hrho_succ_760 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@j) (@A) (@B) (@hp3) (@r) (@hr) + let newVertex : Fin (T.length + 1) → V := fun r => + if hr : r.val < N.height then + T.vertex (Fin.castLE N.height_upper (rho ⟨r.val, hr⟩)) + else + T.vertex r + let newEdge : Fin T.length → E := fun r => + if hr : r.val + 1 < N.height then + NormalCycleEdge N (rho ⟨r.val, by omega⟩) + else + T.edge r + have hvertex_prefix (r : Fin (T.length + 1)) (hr : r.val < N.height) : + newVertex r = + T.vertex (Fin.castLE N.height_upper (rho ⟨r.val, hr⟩)) := by + simp [newVertex, hr] + have hvertex_tail (r : Fin (T.length + 1)) (hr : N.height ≤ r.val) : + newVertex r = T.vertex r := by + simp [newVertex, show ¬ r.val < N.height by omega] + have hedge_prefix (r : Fin T.length) (hr : r.val + 1 < N.height) : + newEdge r = NormalCycleEdge N (rho ⟨r.val, by omega⟩) := by + simp [newEdge, hr] + have hedge_tail (r : Fin T.length) (hr : N.height - 1 ≤ r.val) : + newEdge r = T.edge r := by + have hnot : ¬ r.val + 1 < N.height := by omega + simp [newEdge, hnot] + have hvertex_injective : Function.Injective newVertex := by + exact @helper_hvertex_injective_155 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@j) (@A) (@B) (@hp3) (@hrho_injective) (@hvertex_prefix) + (@hvertex_tail) + have hcycle_tail_ne (i : Fin N.height) (r : Fin T.length) + (hr : N.height - 1 ≤ r.val) : + NormalCycleEdge N i ≠ T.edge r := by + intro heq + obtain ⟨a, ha⟩ := T.attaches r + have hpairs := congrArg (fun e => G.ends e) heq + rw [hcycle_ends i, ha] at hpairs + rcases Sym2.eq_iff.mp hpairs with hd | hs + · have hv := congrArg Fin.val (T.vertex_injective hd.1) + have hi := i.isLt + simp at hv + omega + · have hv := congrArg Fin.val (T.vertex_injective hs.2) + have hn := Nat.mod_lt (i.val + 1) (by omega : 0 < N.height) + simp at hv + omega + have hedge_injective : Function.Injective newEdge := by + exact @helper_hedge_injective_197 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@j) (@A) (@B) (@hp3) (@hcycle_injective) (@hrho_injective) + (@hedge_prefix) (@hedge_tail) (@hcycle_tail_ne) + have hfirst_edge : newEdge ⟨0, T.positive⟩ = NormalCycleEdge N j := by + rw [hedge_prefix _ (by + change 0 + 1 < N.height + omega)] + exact congrArg (NormalCycleEdge N) hrho_zero + have htransport_index (r : Fin T.length) + (hr : N.height - 1 ≤ r.val) (a : Fin (r.val + 1)) : + ∃ b : Fin (r.val + 1), + newVertex (Fin.castLT b + (Nat.lt_trans b.isLt (Nat.succ_lt_succ r.isLt))) = + T.vertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt))) := by + exact @helper_htransport_index_221 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@T) (@N) (@j) (@A) (@B) (@hp3) (@hrho_surjective) (@hvertex_prefix) + (@hvertex_tail) (@r) (@hr) (@a) + have hattaches : ∀ r : Fin T.length, ∃ a : Fin (r.val + 1), + G.ends (newEdge r) = + s(newVertex r.succ, + newVertex (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt)))) := by + intro r + by_cases hr : r.val + 1 < N.height + · let a : Fin (r.val + 1) := ⟨r.val, Nat.lt_succ_self _⟩ + refine ⟨a, ?_⟩ + rw [hedge_prefix r hr, hcycle_ends, + hvertex_prefix r.succ (by simpa using hr), + hvertex_prefix (Fin.castLT a + (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt))) (by + simp [a] + omega)] + apply Sym2.eq_iff.mpr + right + constructor + · apply congrArg T.vertex + apply Fin.ext + rfl + · apply congrArg T.vertex + apply Fin.ext + have hs := hrho_succ ⟨r.val, by omega⟩ hr + have hv := congrArg (fun q : Fin N.height => q.val) hs.symm + simpa using hv + · obtain ⟨a, ha⟩ := T.attaches r + obtain ⟨b, hb⟩ := htransport_index r (by omega) a + refine ⟨b, ?_⟩ + rw [hedge_tail r (by omega), ha, + hvertex_tail r.succ (by simp; omega), hb] + let T' : TreeSequence G (NormalCycleEdge N j) := + { length := T.length + positive := T.positive + vertex := newVertex + edge := newEdge + vertex_injective := hvertex_injective + edge_injective := hedge_injective + first_edge := hfirst_edge + attaches := hattaches } + have hnew_zero : + T'.vertex ⟨0, Nat.zero_lt_succ T'.length⟩ = + T.vertex (Fin.castLE N.height_upper j) := by + exact @helper_hnew_zero_282 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@j) (@A) (@B) (@hp3) (@hrho_zero) (@hvertex_prefix) + (@hvertex_injective) (@hedge_injective) (@hfirst_edge) (@hattaches) + have hnew_one : + T'.vertex ⟨1, Nat.succ_lt_succ T'.positive⟩ = + T.vertex (Fin.castLE N.height_upper + ⟨(j.val + 1) % N.height, Nat.mod_lt _ (by omega)⟩) := by + exact @helper_hnew_one_874 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@N) (@j) (@A) (@B) (@hp3) (@hrho_val) (@hvertex_prefix) + (@hvertex_injective) (@hedge_injective) (@hfirst_edge) (@hattaches) + have hpair_colors : + ({N.alpha, N.beta} : Finset (Fin k)) = {A, B} := by + by_cases ho : Odd j.val + · simp [hA, hB, ho, Finset.pair_comm] + · simp [hA, hB, ho] + exact @helper_continuation_1037 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@psi) (@T) (@N) (@j) (@hj) (@A) (@B) (@hproper) (@hone) (@hmissA) (@hmissB) + (@hshift) (@hfixed) (@hp3) (@hcycle_injective) (@hcycle_colors) (@hrho_val) + (@hrho_injective) (@hrho_surjective) (@hrho_zero) (@hvertex_prefix) (@hvertex_tail) + (@hedge_prefix) (@hedge_tail) (@hvertex_injective) (@hcycle_tail_ne) (@hedge_injective) + (@hfirst_edge) (@htransport_index) (@hattaches) (@hnew_zero) (@hnew_one) (@hpair_colors) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ScheideTwoColorLastExitPath.lean b/LeanPool/GoldbergSeymour/ScheideTwoColorLastExitPath.lean new file mode 100644 index 0000000000..129feb932e --- /dev/null +++ b/LeanPool/GoldbergSeymour/ScheideTwoColorLastExitPath.lean @@ -0,0 +1,606 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GlobalMaximumTriple +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.ScheideEnlargedClosed +public import LeanPool.GoldbergSeymour.ScheideEnlargedElementary +public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet +public import LeanPool.GoldbergSeymour.ScheideLastExitPath +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration +public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo + +/-! +# Scheide Two Color Last Exit Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_continuation_207.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k), + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let X : Finset V := ScheideEnlargedVertexSet R; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi D.alpha0 alpha; + ∀ (_ : y0 ∈ X) (terminal : V) (p : H.Walk (Sum.inl y0) (Sum.inl terminal)) (_ : p.IsPath) (_ : + {z : V ⊕ E | z ∈ p.support} = TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0)) (_ : + terminal ∉ X), + let insideIndices : Finset (Fin (p.length + (1 : ℕ))) := ({i : Fin (p.length + (1 : ℕ)) | + ∃ v ∈ X, p.getVert (↑i : ℕ) = Sum.inl v} : Finset (Fin (p.length + (1 : ℕ)))); + ∀ (hinsideNonempty : insideIndices.Nonempty), + let lastIndex : Fin (p.length + (1 : ℕ)) := insideIndices.max' hinsideNonempty; + ∀ (lastInside : V) (_ : lastInside ∈ X) (_ : p.getVert (↑lastIndex : ℕ) = Sum.inl lastInside) + (_ : + ∀ (j : Fin (p.length + (1 : ℕ))), (↑lastIndex : ℕ) < (↑j : ℕ) → + ∀ (v : V), p.getVert (↑j : ℕ) = Sum.inl v → v ∉ X) (_ : (↑lastIndex : ℕ) < p.length), Nonempty + (ScheideLastExitPath G k e0 phi T C D R alpha) := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha y0 X H hy0X terminal p hp hps hterminalOutside + insideIndices hinsideNonempty lastIndex lastInside hlastInsideX hlastInsideAt hafter hlastLt + let crossingIndex : Fin (p.length + 1) := + ⟨lastIndex.val + 1, by omega⟩ + have hcrossingAdj := p.adj_getVert_succ hlastLt + rw [hlastInsideAt] at hcrossingAdj + obtain ⟨crossing, hcrossingAt, hlastIncident, hcrossingColors⟩ : + ∃ crossing : E, + p.getVert crossingIndex.val = Sum.inr crossing ∧ + Incident G lastInside crossing ∧ + (phi crossing = some D.alpha0 ∨ phi crossing = some alpha) := by + cases hnext : p.getVert crossingIndex.val with + | inl v => + exfalso + rw [hnext] at hcrossingAdj + have hbad : H.Adj (Sum.inl lastInside) (Sum.inl v) := by + simpa [crossingIndex] using hcrossingAdj + simp [H, TwoColorIncidenceGraph] at hbad + | inr crossing => + rw [hnext] at hcrossingAdj + refine ⟨crossing, rfl, ?_⟩ + have hdata : H.Adj (Sum.inl lastInside) (Sum.inr crossing) := by + simpa [crossingIndex] using hcrossingAdj + simpa [H, TwoColorIncidenceGraph] using hdata + have hcrossingLt : crossingIndex.val < p.length := by + by_contra hn + have heq : crossingIndex.val = p.length := by omega + have hbad := hcrossingAt + rw [heq, p.getVert_length] at hbad + exact Sum.inl_ne_inr hbad + let outsideIndex : Fin (p.length + 1) := + ⟨crossingIndex.val + 1, by omega⟩ + have houtsideAdj := p.adj_getVert_succ hcrossingLt + rw [hcrossingAt] at houtsideAdj + obtain ⟨firstOutside, hfirstOutsideAt, hfirstIncident⟩ : + ∃ firstOutside : V, + p.getVert outsideIndex.val = Sum.inl firstOutside ∧ + Incident G firstOutside crossing := by + cases hnext : p.getVert outsideIndex.val with + | inl v => + rw [hnext] at houtsideAdj + refine ⟨v, rfl, ?_⟩ + have hdata : H.Adj (Sum.inr crossing) (Sum.inl v) := by + simpa [outsideIndex] using houtsideAdj + have hdata' : Incident G v crossing ∧ + (phi crossing = some D.alpha0 ∨ phi crossing = some alpha) := by + simpa [H, TwoColorIncidenceGraph] using hdata + exact hdata'.1 + | inr e => + exfalso + rw [hnext] at houtsideAdj + have hbad : H.Adj (Sum.inr crossing) (Sum.inr e) := by + simpa [outsideIndex] using houtsideAdj + simp [H, TwoColorIncidenceGraph] at hbad + have hfirstOutsideX : firstOutside ∉ X := by + apply hafter outsideIndex + · dsimp [outsideIndex, crossingIndex] + omega + · exact hfirstOutsideAt + have hverticesNe : lastInside ≠ firstOutside := by + intro heq + exact hfirstOutsideX (heq ▸ hlastInsideX) + have hcrossingEnds : G.ends crossing = s(lastInside, firstOutside) := + (Sym2.mem_and_mem_iff hverticesNe).mp + ⟨hlastIncident, hfirstIncident⟩ + have hcrossingBoundary : crossing ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨lastInside, hlastInsideX, firstOutside, + hfirstOutsideX, hcrossingEnds⟩ + have hcrossingColor : phi crossing = some alpha := by + rcases hcrossingColors with h0 | ha + · have hclosed : ColoredVertexSetClosed G phi X := by + unfold ColoredVertexSetClosed + intro f c v hf hv hfc + exact ScheideEnlargedClosed G k e0 phi T C D R + (by simpa [X] using hf) (by simpa [X] using hv) hfc + exact False.elim + ((hclosed hcrossingBoundary hy0X h0) D.alpha0_missing_at_y0) + · exact ha + have hcrossingComponent : Sum.inr crossing ∈ + TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0) := by + rw [← hps] + rw [← hcrossingAt] + exact p.getVert_mem_support crossingIndex.val + refine ⟨{ + terminal := terminal + lastInside := lastInside + firstOutside := firstOutside + crossing := crossing + path := p + lastIndex := lastIndex + pathSimple := hp + pathSpans := hps + terminalOutside := hterminalOutside + lastInsideAt := hlastInsideAt + lastInsideMem := hlastInsideX + followingVertex := by + change lastIndex.val + 2 ≤ p.length + dsimp [crossingIndex] at hcrossingLt + omega + crossingAt := by + simpa [crossingIndex] using hcrossingAt + firstOutsideAt := by + simpa [outsideIndex, crossingIndex] using hfirstOutsideAt + firstOutsideNotMem := hfirstOutsideX + afterLastOutside := hafter + crossingBoundary := hcrossingBoundary + crossingColor := hcrossingColor + crossingComponent := hcrossingComponent + }⟩ + +private theorem helper_continuation_273.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (R : (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) → + ScheideReplacementData G k e0 phi T C D d) (alpha : Fin k) (_ : + ∀ v ∈ ScheideEnlargedVertexSet R, alpha ∈ PresentColors G phi v), + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let X : Finset V := ScheideEnlargedVertexSet R; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi D.alpha0 alpha; + ∀ (_ : y0 ∈ X) (_ : D.alpha0 ≠ alpha) (terminalNode : V ⊕ E) (p : H.Walk (Sum.inl y0) + terminalNode) (_ : p.IsPath) (_ : {z : V ⊕ E | z ∈ p.support} = TwoColorComponent G phi + D.alpha0 alpha (Sum.inl y0)) (_ : (0 : ℕ) < p.length) (_ : terminalNode ≠ Sum.inl y0) (_ : + ∀ (z : V ⊕ E), H.Adj terminalNode z → z = p.getVert (p.length - (1 : ℕ))), Nonempty + (ScheideLastExitPath G k e0 phi T C D R alpha) := by + classical + intro V E _ _ _ _ G k e0 phi T C D R alpha hpresent y0 X H hy0X halphaNe terminalNode p hp hps + hpPositive hterminalNe hterminalOnlyPrev + have hterminalPrevAdj : H.Adj terminalNode + (p.getVert (p.length - 1)) := by + have hadj := p.adj_getVert_succ + (show p.length - 1 < p.length by omega) + rw [show p.length - 1 + 1 = p.length by omega, + p.getVert_length] at hadj + exact hadj.symm + have hterminalDegree : @SimpleGraph.degree _ H terminalNode + (Fintype.ofFinite _) = 1 := by + apply (@SimpleGraph.degree_eq_one_iff_existsUnique_adj _ H terminalNode + (Fintype.ofFinite _)).mpr + exact ⟨p.getVert (p.length - 1), hterminalPrevAdj, + hterminalOnlyPrev⟩ + obtain ⟨terminal, hterminal⟩ : ∃ terminal : V, + terminalNode = Sum.inl terminal := by + cases hnode : terminalNode with + | inl terminal => exact ⟨terminal, rfl⟩ + | inr e => + have hlastAdj : H.Adj (Sum.inr e) + (p.getVert (p.length - 1)) := by + simpa [hnode] using hterminalPrevAdj + have heColor : phi e = some D.alpha0 ∨ phi e = some alpha := by + cases hprev : p.getVert (p.length - 1) with + | inl v => + rw [hprev] at hlastAdj + have hdata : Incident G v e ∧ + (phi e = some D.alpha0 ∨ phi e = some alpha) := by + simpa [H, TwoColorIncidenceGraph] using hlastAdj + exact hdata.2 + | inr f => + rw [hprev] at hlastAdj + simp [H, TwoColorIncidenceGraph] at hlastAdj + let v1 := (Quot.out (G.ends e)).1 + let v2 := (Quot.out (G.ends e)).2 + have hends : s(v1, v2) = G.ends e := Quot.out_eq _ + have hv1 : Incident G v1 e := by + change v1 ∈ G.ends e + rw [← hends] + simp [v1, v2] + have hv2 : Incident G v2 e := by + change v2 ∈ G.ends e + rw [← hends] + simp [v1, v2] + have hvne : v1 ≠ v2 := by + intro heq + apply G.loopless e v1 + rw [← hends, heq] + have hadj1 : H.Adj (Sum.inr e) (Sum.inl v1) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v1 e ∧ + (phi e = some D.alpha0 ∨ phi e = some alpha) from + ⟨hv1, heColor⟩) + have hadj2 : H.Adj (Sum.inr e) (Sum.inl v2) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v2 e ∧ + (phi e = some D.alpha0 ∨ phi e = some alpha) from + ⟨hv2, heColor⟩) + have hdegreeTwo : 2 ≤ @SimpleGraph.degree _ H (Sum.inr e) + (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let endpoints : Finset (Sum V E) := {Sum.inl v1, Sum.inl v2} + have hsub : endpoints ⊆ @SimpleGraph.neighborFinset (Sum V E) H + (Sum.inr e) (Fintype.ofFinite _) := by + intro z hz + simp only [endpoints, Finset.mem_insert, + Finset.mem_singleton] at hz + rcases hz with rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hadj1 + · simpa [SimpleGraph.mem_neighborFinset] using hadj2 + have hcard : 2 ≤ endpoints.card := by simp [endpoints, hvne] + exact hcard.trans (Finset.card_le_card hsub) + have hdegreeOne : @SimpleGraph.degree _ H (Sum.inr e) + (Fintype.ofFinite _) = 1 := by + rw [hnode] at hterminalDegree + exact hterminalDegree + omega + subst terminalNode + have hy0NeTerminal : y0 ≠ terminal := by + intro heq + apply hterminalNe + simp [heq] + have hterminalOutside : terminal ∉ X := by + intro hterminalX + have hterminalPresent : alpha ∈ PresentColors G phi terminal := + hpresent terminal hterminalX + obtain ⟨et, het, hetColor⟩ : ∃ et : E, + Incident G terminal et ∧ phi et = some alpha := by + simpa [PresentColors] using hterminalPresent + have hetAdj : H.Adj (Sum.inl terminal) (Sum.inr et) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G terminal et ∧ + (phi et = some D.alpha0 ∨ phi et = some alpha) from + ⟨het, Or.inr hetColor⟩) + have hterminalUnique := + (@SimpleGraph.degree_eq_one_iff_existsUnique_adj _ H + (Sum.inl terminal) (Fintype.ofFinite _)).mp hterminalDegree + have halpha0TerminalNotPresent : + D.alpha0 ∉ PresentColors G phi terminal := by + intro hpresent0 + obtain ⟨e0, he0, he0Color⟩ : ∃ e0' : E, + Incident G terminal e0' ∧ phi e0' = some D.alpha0 := by + simpa [PresentColors] using hpresent0 + have he0Adj : H.Adj (Sum.inl terminal) (Sum.inr e0) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G terminal e0 ∧ + (phi e0 = some D.alpha0 ∨ phi e0 = some alpha) from + ⟨he0, Or.inl he0Color⟩) + have heq : (Sum.inr et : Sum V E) = Sum.inr e0 := + hterminalUnique.unique hetAdj he0Adj + have hete0 : et = e0 := Sum.inr.inj heq + have hcolors : (D.alpha0 : Fin k) = alpha := by + exact Option.some.inj (he0Color.symm.trans (hete0 ▸ hetColor)) + exact halphaNe hcolors + have halpha0TerminalMissing : D.alpha0 ∈ + MissingColors G phi terminal := by + simpa [MissingColors] using halpha0TerminalNotPresent + have hdisjoint := ScheideEnlargedElementary G k e0 phi T C D R + hy0X hterminalX hy0NeTerminal + exact (Finset.disjoint_left.mp hdisjoint) + D.alpha0_missing_at_y0 halpha0TerminalMissing + let insideIndices : Finset (Fin (p.length + 1)) := + Finset.univ.filter fun i => ∃ v ∈ X, p.getVert i.val = Sum.inl v + have hinsideNonempty : insideIndices.Nonempty := by + refine ⟨⟨0, by omega⟩, ?_⟩ + simp only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨y0, hy0X, p.getVert_zero⟩ + let lastIndex : Fin (p.length + 1) := + insideIndices.max' hinsideNonempty + have hlastMem : lastIndex ∈ insideIndices := + Finset.max'_mem insideIndices hinsideNonempty + obtain ⟨lastInside, hlastInsideX, hlastInsideAt⟩ := by + simpa only [insideIndices, Finset.mem_filter, Finset.mem_univ, true_and] + using hlastMem + have hafter : ∀ j : Fin (p.length + 1), lastIndex.val < j.val → + ∀ v : V, p.getVert j.val = Sum.inl v → v ∉ X := by + intro j hj v hjv hvX + have hjMem : j ∈ insideIndices := by + simp only [insideIndices, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨v, hvX, hjv⟩ + exact (not_le_of_gt hj) (Finset.le_max' insideIndices j hjMem) + have hlastLt : lastIndex.val < p.length := by + by_contra hn + have heq : lastIndex.val = p.length := by omega + have hvEq : lastInside = terminal := by + apply Sum.inl.inj + rw [← hlastInsideAt, heq, p.getVert_length] + exact hterminalOutside (hvEq ▸ hlastInsideX) + exact @helper_continuation_207 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@alpha) (@hy0X) (@terminal) (@p) + (@hp) (@hps) (@hterminalOutside) (@hinsideNonempty) (@lastInside) (@hlastInsideX) + (@hlastInsideAt) (@hafter) (@hlastLt) +private theorem helper_hterminalOnlyPrev_470.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (alpha : Fin k), + let y0 : V := C.y (⟨(0 : ℕ), lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ : Fin C.p); + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi D.alpha0 alpha; + ∀ (_ : IsProperEdgeColoring G phi) (_ : @SimpleGraph.degree (Sum V E) H (@Sum.inl V E y0) + (@Fintype.ofFinite (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) H (@Sum.inl V + E y0))) (@Subtype.finite (Sum V E) (@Finite.instSum V E (@Finite.of_fintype V inst) + (@Finite.of_fintype E inst_1)) (@Membership.mem (Sum V E) (Set (Sum V E)) + (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) H (@Sum.inl V E + y0))))) = (1 : ℕ)) (terminalNode : V ⊕ E) (p : H.Walk (Sum.inl y0) terminalNode) (_ : + p.IsPath) (_ : {z : V ⊕ E | z ∈ p.support} = TwoColorComponent G phi D.alpha0 alpha + (Sum.inl y0)) (_ : (0 : ℕ) < p.length) (_ : terminalNode ≠ Sum.inl y0) (z : V ⊕ E), H.Adj + terminalNode z → z = p.getVert (p.length - (1 : ℕ)) := by + classical + intro V E _ _ _ G k e0 phi T C D alpha y0 H hproper hy0Degree terminalNode p hp hps hpPositive + hterminalNe z hz + have hterminalComponent : terminalNode ∈ + TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0) := by + have hm : terminalNode ∈ {z | z ∈ p.support} := by + change terminalNode ∈ p.support + simpa only [p.getVert_length] using p.getVert_mem_support p.length + rw [hps] at hm + exact hm + have hzComponent : z ∈ + TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0) := by + have hterminalMk := + (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mp + hterminalComponent + apply (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hz).symm.trans hterminalMk + have hzSupport : z ∈ p.support := by + change z ∈ {z | z ∈ p.support} + rw [hps] + exact hzComponent + obtain ⟨j, hj, hjle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hzSupport + have hjne : j ≠ p.length := by + intro heq + have hzterminal : z = terminalNode := by + rw [← hj, heq, p.getVert_length] + exact hz.ne hzterminal.symm + have hjlt : j < p.length := Nat.lt_of_le_of_ne hjle hjne + by_cases hjpenultimate : j + 1 = p.length + · calc + z = p.getVert j := hj.symm + _ = p.getVert (p.length - 1) := by congr 1; omega + by_cases hjzero : j = 0 + · by_cases hlengthOne : p.length = 1 + · rw [← hj, hjzero, hlengthOne] + · have hfirstAdj : H.Adj (Sum.inl y0) (p.getVert 1) := by + simpa only [p.getVert_zero] using + p.adj_getVert_succ (by omega : 0 < p.length) + have hrootTerminalAdj : H.Adj (Sum.inl y0) terminalNode := by + have hz' := hz.symm + rw [← hj, hjzero, p.getVert_zero] at hz' + exact hz' + have hunique := (@SimpleGraph.degree_eq_one_iff_existsUnique_adj _ H + (Sum.inl y0) (Fintype.ofFinite _)).mp hy0Degree + have heq := hunique.unique hfirstAdj hrootTerminalAdj + have hne : p.getVert 1 ≠ terminalNode := by + intro hh + have hidx := hp.getVert_injOn (by omega : 1 ≤ p.length) + (le_rfl : p.length ≤ p.length) + (hh.trans p.getVert_length.symm) + omega + exact (hne heq).elim + · have hjpos : 0 < j := Nat.pos_of_ne_zero hjzero + have hleft := p.adj_getVert_succ (show j - 1 < p.length by omega) + rw [show j - 1 + 1 = j by omega] at hleft + have hright := p.adj_getVert_succ hjlt + have hthree : 3 ≤ @SimpleGraph.degree _ H (p.getVert j) + (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset (Sum V E) := + {terminalNode, p.getVert (j - 1), p.getVert (j + 1)} + have hs : s ⊆ @SimpleGraph.neighborFinset (Sum V E) H + (p.getVert j) (Fintype.ofFinite _) := by + intro w hw + simp only [s, Finset.mem_insert, Finset.mem_singleton] at hw + rcases hw with rfl | rfl | rfl + · have hz' := hz.symm + rw [← hj] at hz' + simpa [SimpleGraph.mem_neighborFinset] using hz' + · simpa [SimpleGraph.mem_neighborFinset] using hleft.symm + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hterminalNotNeighbors : terminalNode ∉ + ({p.getVert (j - 1), p.getVert (j + 1)} : Finset (Sum V E)) := by + simp only [Finset.mem_insert, Finset.mem_singleton] + intro hh + rcases hh with hh | hh + · have hidx := hp.getVert_injOn + (show j - 1 ≤ p.length by omega) + (le_rfl : p.length ≤ p.length) + (hh.symm.trans p.getVert_length.symm) + omega + · have hidx := hp.getVert_injOn + (show j + 1 ≤ p.length by omega) + (le_rfl : p.length ≤ p.length) + (hh.symm.trans p.getVert_length.symm) + exact hjpenultimate hidx + have hneighborsNe : p.getVert (j - 1) ≠ p.getVert (j + 1) := by + intro hh + have hidx := hp.getVert_injOn + (show j - 1 ≤ p.length by omega) + (show j + 1 ≤ p.length by omega) hh + omega + have hcard : s.card = 3 := by + simp [s, hterminalNotNeighbors, hneighborsNe] + calc + 3 = s.card := hcard.symm + _ ≤ _ := Finset.card_le_card hs + have hdegree : @SimpleGraph.degree _ H (p.getVert j) + (Fintype.ofFinite _) ≤ 2 := by + simpa [H] using TwoColorIncidenceDegreeAtMostTwo G phi D.alpha0 + alpha hproper (p.getVert j) + omega + +theorem ScheideTwoColorLastExitPath {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) + (D : ScheideDefectiveSetup G k e0 phi T C) + (R : ∀ d : {delta // delta ∈ DefectiveColors G phi + (TreeSequenceVertexSet T)}, ScheideReplacementData G k e0 phi T C D d) + (alpha : Fin k) + (hpresent : ∀ v ∈ ScheideEnlargedVertexSet R, + alpha ∈ PresentColors G phi v) : + Nonempty (ScheideLastExitPath G k e0 phi T C D R alpha) := by + classical + let y0 : V := C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + let X : Finset V := ScheideEnlargedVertexSet R + let H := TwoColorIncidenceGraph G phi D.alpha0 alpha + have hproper : IsProperEdgeColoring G phi := C.globally_maximum.1.2.2.2.1 + have hy0T : y0 ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨⟨0, by omega⟩, ?_⟩ + change T.vertex ⟨0, by omega⟩ = + C.y ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + exact C.base_vertex_position + ⟨0, lt_of_lt_of_le Nat.zero_lt_two C.p_ge_two⟩ + have hy0X : y0 ∈ X := by + exact Finset.mem_union_left _ hy0T + have halphaPresent : alpha ∈ PresentColors G phi y0 := + hpresent y0 hy0X + have halpha0NotPresent : D.alpha0 ∉ PresentColors G phi y0 := by + simpa [MissingColors] using D.alpha0_missing_at_y0 + have halphaNe : D.alpha0 ≠ alpha := by + intro h + exact halpha0NotPresent (h ▸ halphaPresent) + obtain ⟨ea, hea, heaColor⟩ : ∃ ea : E, + Incident G y0 ea ∧ phi ea = some alpha := by + simpa [PresentColors] using halphaPresent + have heaAdj : H.Adj (Sum.inl y0) (Sum.inr ea) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G y0 ea ∧ + (phi ea = some D.alpha0 ∨ phi ea = some alpha) from + ⟨hea, Or.inr heaColor⟩) + have hy0Degree : @SimpleGraph.degree _ H (Sum.inl y0) + (Fintype.ofFinite _) = 1 := by + apply (@SimpleGraph.degree_eq_one_iff_existsUnique_adj _ H + (Sum.inl y0) (Fintype.ofFinite _)).mpr + refine ⟨Sum.inr ea, heaAdj, ?_⟩ + intro z hz + cases z with + | inl v => + simp [H, TwoColorIncidenceGraph] at hz + | inr f => + have hf : Incident G y0 f ∧ + (phi f = some D.alpha0 ∨ phi f = some alpha) := by + simpa [H, TwoColorIncidenceGraph] using hz + have hfColor : phi f = some alpha := by + rcases hf.2 with hf0 | hfa + · exfalso + apply halpha0NotPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hf.1, hf0⟩ + · exact hfa + have hfeq : f = ea := by + by_contra hne + exact (hproper hne ⟨y0, hf.1, hea⟩ hfColor) heaColor + exact congrArg Sum.inr hfeq + obtain ⟨a, b, q, hq, hqs⟩ := + TwoColorComponentSpanningPath G phi D.alpha0 alpha hproper + (Sum.inl y0) + have hy0Component : Sum.inl y0 ∈ + TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0) := by + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + have hy0Support : Sum.inl y0 ∈ q.support := by + change Sum.inl y0 ∈ {z | z ∈ q.support} + rw [hqs] + exact hy0Component + have hy0Leaf : H.neighborSet (Sum.inl y0) |>.Subsingleton := by + let : Fintype (H.neighborSet (Sum.inl y0)) := Fintype.ofFinite _ + intro z hz w hw + have hc : Fintype.card (H.neighborSet (Sum.inl y0)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hy0Degree.le + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hc ⟨z, hz⟩ ⟨w, hw⟩) + have hy0End : (Sum.inl y0 : Sum V E) = a ∨ Sum.inl y0 = b := by + by_contra hn + push Not at hn + exact (hq.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hy0Leaf) hy0Support + obtain ⟨terminalNode, p, hp, hps⟩ : + ∃ (w : Sum V E) (p : H.Walk (Sum.inl y0) w), + p.IsPath ∧ {z | z ∈ p.support} = + TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0) := by + rcases hy0End with ha | hb + · subst a + exact ⟨b, q, hq, hqs⟩ + · subst b + refine ⟨a, q.reverse, hq.reverse, ?_⟩ + ext z + rw [SimpleGraph.Walk.support_reverse] + simpa using Set.ext_iff.mp hqs z + have heaComponent : Sum.inr ea ∈ + TwoColorComponent G phi D.alpha0 alpha (Sum.inl y0) := by + apply (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (by simpa [H] using heaAdj)).symm + have hpPositive : 0 < p.length := by + by_contra hn + have hzero : p.length = 0 := Nat.eq_zero_of_not_pos hn + have heaSupport : Sum.inr ea ∈ p.support := by + change Sum.inr ea ∈ {z | z ∈ p.support} + rw [hps] + exact heaComponent + obtain ⟨j, hj, hjle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp heaSupport + have hjzero : j = 0 := by omega + have : (Sum.inr ea : Sum V E) = Sum.inl y0 := by + rw [← hj, hjzero, p.getVert_zero] + exact Sum.inr_ne_inl this + have hterminalNe : terminalNode ≠ Sum.inl y0 := by + intro h + have hverts : p.getVert 0 = p.getVert p.length := by + rw [p.getVert_zero, p.getVert_length, h] + have hidx := hp.getVert_injOn (by omega : 0 ≤ p.length) + (le_rfl : p.length ≤ p.length) hverts + omega + have hterminalOnlyPrev := @helper_hterminalOnlyPrev_470 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@alpha) (@hproper) + (@hy0Degree) (@terminalNode) (@p) (@hp) (@hps) (@hpPositive) (@hterminalNe) + exact @helper_continuation_273 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@C) (@D) (@R) (@alpha) (@hpresent) (@hy0X) + (@halphaNe) (@terminalNode) (@p) (@hp) (@hps) (@hpPositive) (@hterminalNe) + (@hterminalOnlyPrev) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/SimpleExtensionSeedStoredColor.lean b/LeanPool/GoldbergSeymour/SimpleExtensionSeedStoredColor.lean new file mode 100644 index 0000000000..5b49318fbd --- /dev/null +++ b/LeanPool/GoldbergSeymour/SimpleExtensionSeedStoredColor.lean @@ -0,0 +1,152 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Simple Extension Seed Stored Color + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem SimpleExtensionSeedStoredColor {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) + (j : Fin (rounds + 1)) + (hstep : TashkinovSeriesStep G k rounds e0 input data j) + (hkind : data.kind j = some TashkinovExtensionKind.SE) + (f : E) (hedges : data.connectingEdges j = {f}) + (beta : Fin k) (hcolor : data.coloring j f = some beta) : + beta ∈ TashkinovStoredColors data j := by + classical + generalize hj : j = j' at hstep hkind hedges hcolor ⊢ + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + rw [initialKind] at hkind + simp at hkind + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hf : f = choice.edge := by + have hm : f ∈ data.connectingEdges i.succ := by + rw [hedges] + simp + rw [currentEdges] at hm + simpa using hm + subst f + have hbeta : beta = choice.color := by + rw [currentColoring] at hcolor + exact Option.some.inj (hcolor.symm.trans choice.edgeColor) + have hv : choice.vertex ∈ + TreeSequenceVertexSet (data.tree i.succ.castSucc) := + choice.vertexDefective.1 + have hpresentCurrent : choice.color ∈ + PresentColors G choice.selected choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨choice.edge, choice.edgeIncident, choice.edgeColor⟩ + have hnotCurrent : choice.color ∉ + MissingColors G choice.selected choice.vertex := by + simp [MissingColors, hpresentCurrent] + have hnotPrevious : choice.color ∉ + MissingColors G (data.coloring i.castSucc) choice.vertex := by + rw [← choice.selectedStable.2 choice.vertex hv] + exact hnotCurrent + have hnotTreeCurrent : choice.color ∉ + TreeMissingColors choice.selected (data.tree i.succ.castSucc) := by + intro hmissing + simp only [TreeMissingColors, Finset.mem_biUnion] at hmissing + rcases hmissing with ⟨w, hw, hwmissing⟩ + have hwPrevious : choice.color ∈ + MissingColors G (data.coloring i.castSucc) w := by + rw [← choice.selectedStable.2 w hw] + exact hwmissing + have hpresentPrevious : choice.color ∈ + PresentColors G (data.coloring i.castSucc) choice.vertex := by + by_contra hpresent + have : choice.color ∈ + MissingColors G (data.coloring i.castSucc) choice.vertex := by + simp [MissingColors, hpresent] + exact hnotPrevious this + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresentPrevious + rcases hpresentPrevious with ⟨g, hgIncident, hgColor⟩ + have hgTree : TreeIncidentEdge (data.tree i.succ.castSucc) g := + ⟨choice.vertex, hv, hgIncident⟩ + have hgFixed : choice.selected g = + data.coloring i.castSucc g := by + apply choice.selectedStable.1 g hgTree + refine ⟨choice.color, ?_, hgColor⟩ + simp only [Finset.mem_union] + left + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨w, hw, hwPrevious⟩ + have hsame : g = choice.edge := by + by_contra hne + exact (choice.selectedProper hne + ⟨choice.vertex, hgIncident, choice.edgeIncident⟩ + (hgFixed.trans hgColor)) choice.edgeColor + subst g + have hboundary : choice.edge ∈ BoundaryEdges G + (TreeSequenceVertexSet (data.tree i.succ.castSucc)) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨choice.vertex, hv, choice.otherEndpoint, + choice.otherOutside, choice.edgeEnds⟩ + exact (previousClosed hboundary hw hgColor) hwPrevious + have hnotTreeBeta : beta ∉ TreeMissingColors + (data.coloring i.succ) (data.tree i.succ.castSucc) := by + simpa [currentColoring, hbeta] using hnotTreeCurrent + unfold TashkinovStoredColors + simp only [Fin.val_succ, Nat.succ_ne_zero, ↓reduceIte, + Finset.mem_sdiff, Finset.mem_biUnion, Finset.mem_univ, true_and] + refine ⟨⟨i.succ, ?_⟩, hnotTreeBeta⟩ + simp [Fin.val_succ, currentStored, hbeta] + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + rw [currentKind] at hkind + simp at hkind + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [currentKind] at hkind + simp at hkind + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/SplitSwapData.lean b/LeanPool/GoldbergSeymour/SplitSwapData.lean new file mode 100644 index 0000000000..d2d68daf40 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SplitSwapData.lean @@ -0,0 +1,139 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix + +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable + +/-! +# P2880_T1_Split Swap Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The component-swap, missing-color, invariant-prefix and suffix-route certificates for a +hierarchy split. +-/ +structure P2880_T1_SplitSwapData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k) where + swapped : + sigma = TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length))) + distinct : alpha ≠ beta + path : TwoColorPathComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length))) + splitOutside : + ∀ v ∈ TreeSequenceVertexSet (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1)), + Sum.inl v ∉ TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length))) + twoBeforeInSplit : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 2)) + (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1)) + splitInFull : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1)) T + splitAboveStar : + let H := P.counterexample.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let X := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1) + TreeSequenceInitialSegment A X ∧ A.length < X.length + splitInPenultimate : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1)) + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1)) + coreInSplit : + TreeSequenceInitialSegment P.replacementBase.core + (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1)) + penultimateElementary : + ColoredVertexSetElementary G P.coloring + (TreeSequenceVertexSet + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1))) + proper : IsProperEdgeColoring G sigma + oneEdgeUncolored : IsOneEdgeUncolored sigma e0 + invariant : + TreeColoringInvariant (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1)) + P.coloring sigma + incidentFixed : + ∀ v ∈ TreeSequenceVertexSet (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1)), + ∀ f : E, Incident G v f → sigma f = P.coloring f + fixedOnSplit : + ∀ r : Fin T.length, + r.val < (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1)).length → + sigma (T.edge r) = P.coloring (T.edge r) + fixedThroughJ : + let H := P.counterexample.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let j := HierarchyPathNumber C.hierarchy + ∀ r : Fin T.length, + A.length ≤ r.val → r.val < A.length + j → sigma (T.edge r) = P.coloring (T.edge r) + missingTwoBefore : + let B := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 2) + alpha ∈ TreeMissingColors sigma B ∧ beta ∈ TreeMissingColors sigma B + missingOnSplit : + let X := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1) + alpha ∈ TreeMissingColors sigma X ∧ beta ∈ TreeMissingColors sigma X + oldMissingOnPenultimate : + let B := HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1) + alpha ∈ TreeMissingColors P.coloring B ∧ beta ∈ TreeMissingColors P.coloring B + missingTerminal : beta ∈ MissingColors G sigma (T.vertex (Fin.last T.length)) + penultimateMissing : + ∀ + v ∈ + TreeSequenceVertexSet + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1)), + MissingColors G sigma v = MissingColors G P.coloring v + storedFirst : + let H := P.counterexample.hierarchy + let q := Fin.last H.dividerCount + ∀ eta ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition P.coloring T eta + gammaCutoff : + let H := P.counterexample.hierarchy + let q := Fin.last H.dividerCount + let X := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1) + ∀ eta ∈ HierarchyStoredColorsAt H q, + (alpha ∈ P.counterexample.good.gamma q eta ∨ beta ∈ P.counterexample.good.gamma q eta) → + (HierarchyFirstMissingPosition P.coloring T eta).val ≤ X.length + separatedAlpha : + Disjoint (TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length)))) + (TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)))) + separatedBeta : + Disjoint (TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length)))) + (TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)))) + prefixRoute : + let m := P.corresponding.replacementETT + let n := Fin.last m.rounds + let Tn := m.series.data.tree n.castSucc + let X := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1) + (m.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X) ∨ + ((m.series.data.kind n = some TashkinovExtensionKind.SE ∨ + m.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + m.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X) + oldSuffix : + TashkinovAugmentationSequence P.coloring + (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1)) T + newSuffix : + TashkinovAugmentationSequence sigma + (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - 1)) T + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean b/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean new file mode 100644 index 0000000000..9e09b57c1a --- /dev/null +++ b/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean @@ -0,0 +1,2329 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.SplitSwapData +public import LeanPool.GoldbergSeymour.ElementaryPrefixSwap +public import LeanPool.GoldbergSeymour.HierarchyMeasures +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint + +/-! +# P2880_T1_Common Preparation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_branch_51.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let _ : Set (V ⊕ E) := TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last + T.length))); + ∀ (_ : alpha ≠ beta) (e : E) (_ : e ≠ e0), + ∃ (c : Fin k), TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last + T.length))) e = some c := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta K hne f hf + obtain ⟨c, hc⟩ := P.minimumContext.oneEdgeUncolored.2 f hf + by_cases ha : c = alpha + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨beta, by simp [TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨alpha, by simp [TwoColorComponentSwap, K, hK, hc]⟩ + · by_cases hb : c = beta + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨alpha, by simp [TwoColorComponentSwap, K, hK, hc, hne.symm]⟩ + · exact ⟨beta, by simp [TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨c, by + simp [TwoColorComponentSwap, ha, hb, hc]⟩ + +private theorem helper_hsigmaOne_150.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let _ : Set (V ⊕ E) := TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last + T.length))); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : alpha ≠ beta), IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta K sigma hne + dsimp [sigma] + refine ⟨?_, ?_⟩ + · simp [TwoColorComponentSwap, P.minimumContext.oneEdgeUncolored.1] + · apply helper_branch_51; assumption +private theorem helper_branch_75.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0} (hSU : S.length ≤ U.length) (hSWl : S.length ≤ W.length) + (_ : + (∀ (i : Fin (S.length + (1 : ℕ))), + W.vertex (Fin.castLE (by omega) i) = S.vertex i)) + (hUWl : U.length ≤ W.length) + (_ : + (∀ (i : Fin (U.length + (1 : ℕ))), + W.vertex (Fin.castLE (by omega) i) = U.vertex i)) + (i : Fin (S.length + (1 : ℕ))), U.vertex (Fin.castLE (by omega) i) = S.vertex i := by + classical + intro V E G e0 S U W hSU hSWl hSWv hUWl hUWv i + calc + U.vertex (Fin.castLE (Nat.succ_le_succ hSU) i) = + W.vertex (Fin.castLE (Nat.succ_le_succ hUWl) + (Fin.castLE (Nat.succ_le_succ hSU) i)) := + (hUWv _).symm + _ = W.vertex (Fin.castLE (Nat.succ_le_succ hSWl) i) := by congr 1 + _ = S.vertex i := hSWv i + +private theorem helper_commonPrefix_190.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) + (_ : TreeSequenceInitialSegment U W) (_ : S.length ≤ U.length), + TreeSequenceInitialSegment S U := by + classical + intro V E G e0 S U W hSW hUW hSU + rcases hSW with ⟨hSWl, hSWv, hSWe⟩ + rcases hUW with ⟨hUWl, hUWv, hUWe⟩ + refine ⟨hSU, ?_, ?_⟩ + · apply helper_branch_75 <;> assumption + · intro i + calc + U.edge (Fin.castLE hSU i) = W.edge (Fin.castLE hUWl (Fin.castLE hSU i)) := + (hUWe _).symm + _ = W.edge (Fin.castLE hSWl i) := by congr 1 + _ = S.edge i := hSWe i + +private theorem helper_branch_110.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : H.dividerCount = (0 : ℕ)), TreeSequenceInitialSegment P.replacementBase.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A hz + have hAeq : A = P.replacementBase.core := by + obtain hq0 | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · change HierarchyStarredStage H q = P.replacementBase.core + rw [hq0] + rfl + · have hcount : H.dividerCount ≠ 0 := by + intro h + have hv := congrArg Fin.val hi + simp [q, h] at hv + exact False.elim (hcount hz) + rw [hAeq] + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + +private theorem helper_branch_122.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ( + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : + TreeSequenceInitialSegment U W), TreeSequenceInitialSegment S W)) (_ : ( + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))))) (_ : ¬H.dividerCount = (0 : ℕ)), + TreeSequenceInitialSegment P.replacementBase.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A prefixTrans stageSegment hz + have hstarStage : A = H.stage ⟨H.dividerCount, by omega⟩ := by + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hcount : H.dividerCount = 0 := by + have hv := congrArg Fin.val hzero + simp [q] at hv + omega + exact False.elim (hz hcount) + · change HierarchyStarredStage H q = H.stage ⟨H.dividerCount, by omega⟩ + rw [hi] + unfold HierarchyStarredStage + simp only [Fin.cases_succ] + congr 1 + apply Fin.ext + simpa [q] using (congrArg Fin.val hi).symm + rw [hstarStage] + have hfirst : TreeSequenceInitialSegment P.replacementBase.core + (H.stage ⟨1, by omega⟩) := H.coreInsideFirst + have hrest := stageSegment 1 (H.dividerCount - 1) (by omega) + convert prefixTrans hfirst hrest using 1; + apply congrArg H.stage; apply Fin.ext; simp; omega + +private theorem helper_coreA_303.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : ( + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : + TreeSequenceInitialSegment U W), TreeSequenceInitialSegment S W)) (_ : ( + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), TreeSequenceInitialSegment (H.stage + (⟨a, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (H.stage (⟨a + d, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))))), TreeSequenceInitialSegment P.replacementBase.core A + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A prefixTrans stageSegment + by_cases hz : H.dividerCount = 0 + · apply helper_branch_110; assumption + · apply helper_branch_122 <;> assumption +private theorem helper_hlenBX_410.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) + (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + X.length = B.length + (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper j B X + change min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 1)) T.length = + min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 2)) T.length + 1 + have hj : j < T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length := by + change j < HierarchyFullTailLength C at hpathUpper + simpa [HierarchyFullTailLength] using hpathUpper + have hlow : (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + j ≤ T.length := by omega + simp [Nat.min_eq_left (by omega : + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 1) ≤ T.length), + Nat.min_eq_left (by omega : + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 2) ≤ T.length)] + omega + +private theorem helper_firstPositionBoundOnT_530.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (_ : alpha ≠ beta) (_ : TreeSequenceInitialSegment B T) {rho : PartialEdgeColoring E k} + {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), (↑(HierarchyFirstMissingPosition rho T + eta) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B hne hB_T rho eta hm + unfold TreeMissingColors at hm + rcases Finset.mem_biUnion.mp hm with ⟨v, hv, hmiss⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv + rcases hv with ⟨i, rfl⟩ + let it : Fin (T.length + 1) := Fin.castLE + (Nat.succ_le_succ hB_T.1) i + have hmissT : eta ∈ MissingColors G rho (T.vertex it) := by + rw [hB_T.2.1 i] + exact hmiss + have hne : (Finset.univ : Finset (Fin (T.length + 1))).filter + (fun r => eta ∈ MissingColors G rho (T.vertex r)) |>.Nonempty := by + exact ⟨it, by simp [hmissT]⟩ + unfold HierarchyFirstMissingPosition + dsimp only + rw [dite_eq_left hne] + have hle := Finset.min'_le + ((Finset.univ : Finset (Fin (T.length + 1))).filter + (fun r => eta ∈ MissingColors G rho (T.vertex r))) it + (by simp [hmissT]) + exact le_trans hle (by simp [it]; omega) + +private theorem helper_firstPositionEqualOnTail_554.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) (_ : ( + ∀ (eta : Fin k), HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition + P.coloring B eta)) (_ : ( + ∀ {rho : PartialEdgeColoring E k} {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), + (↑(HierarchyFirstMissingPosition rho T eta) : ℕ) ≤ B.length)), + ∀ eta ∈ TreeMissingColors P.coloring B, HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition P.coloring T eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_T hB_missingEq + firstPositionOnB firstPositionBoundOnT eta hm + have hmSigma : eta ∈ TreeMissingColors sigma B := by + simp only [TreeMissingColors, Finset.mem_biUnion] at hm ⊢ + rcases hm with ⟨v, hv, hmiss⟩ + exact ⟨v, hv, by rw [hB_missingEq v hv]; exact hmiss⟩ + have hcutSigma := HierarchyFirstMissingPositionPrefixCutoff + sigma B T hB_T eta B.length le_rfl + have hcutPhi := HierarchyFirstMissingPositionPrefixCutoff + P.coloring B T hB_T eta B.length le_rfl + have htrunc : + min (HierarchyFirstMissingPosition sigma T eta).val B.length = + min (HierarchyFirstMissingPosition P.coloring T eta).val + B.length := by + calc + _ = min (HierarchyFirstMissingPosition sigma B eta).val + B.length := hcutSigma.symm + _ = min (HierarchyFirstMissingPosition P.coloring B eta).val + B.length := by rw [firstPositionOnB eta] + _ = _ := hcutPhi + have hboundSigma := firstPositionBoundOnT hmSigma + have hboundPhi := firstPositionBoundOnT hm + apply Fin.ext + rw [min_eq_left hboundSigma, min_eq_left hboundPhi] at htrunc + exact htrunc + +private theorem helper_branch_303.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ (_ : beta ∉ (HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion (P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount))) (_ : TreeSequenceInitialSegment B X), + ∀ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∨ beta ∈ P.counterexample.good.gamma q + eta → + ∀ eta₀ ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), alpha ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta₀ → (↑(HierarchyFirstMissingPosition + P.coloring T eta₀) : ℕ) ≤ (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (2 + : ℕ))).length → (↑(HierarchyFirstMissingPosition P.coloring T eta) : ℕ) ≤ X.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j B X D hBetaNotGamma + hprefixB_X eta hD hgamma eta₀ hD₀ howner hcut + have hβNotGamma := hBetaNotGamma + rcases hgamma with hα | hβ + · have heq : eta = eta₀ := by + by_contra hneEta + have hdisjoint := P.counterexample.good.disjointPairs + q eta eta₀ hD hD₀ hneEta + exact Finset.disjoint_left.mp hdisjoint hα howner + subst eta + exact le_trans hcut hprefixB_X.1 + · exact (hβNotGamma (Finset.mem_biUnion.mpr ⟨eta, hD, hβ⟩)).elim + +private theorem helper_hgammaCutoff_610.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ (_ : ((alpha ∉ (HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion (P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount)) ∪ (TreeSequenceVertexSet P.replacementBase.core + \ TreeSequenceVertexSet (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + P.coloring v) ∨ + ∃ eta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), alpha ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring + T eta) : ℕ) ≤ (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (2 : + ℕ))).length)) (_ : beta ∉ (HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion (P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount))) (_ : TreeSequenceInitialSegment B X), + ∀ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∨ beta ∈ P.counterexample.good.gamma q + eta → (↑(HierarchyFirstMissingPosition P.coloring T eta) : ℕ) ≤ X.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j B X D hAlphaChoice + hBetaNotGamma hprefixB_X eta hD hgamma + rcases hAlphaChoice with houtside | ⟨eta₀, hD₀, howner, hcut⟩ + · rcases hgamma with hα | hβ + · exact (houtside (Finset.mem_union_left _ + (Finset.mem_biUnion.mpr ⟨eta, hD, hα⟩))).elim + · exact (hBetaNotGamma + (Finset.mem_biUnion.mpr ⟨eta, hD, hβ⟩)).elim + · apply helper_branch_303 <;> assumption +private theorem helper_hseparated_657.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let K : Set (V ⊕ E) := TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last + T.length))); + ∀ (_ : ( + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ K)) (_ : TreeSequenceInitialSegment B T) (_ : + TreeSequenceInitialSegment B X) (_ : X.length = B.length + (1 : ℕ)) (_ : ( + ∀ {rho : PartialEdgeColoring E k} {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), + (↑(HierarchyFirstMissingPosition rho T eta) : ℕ) ≤ B.length)) (_ : X.length = A.length + + (j - (1 : ℕ))), + ∀ c ∈ TreeMissingColors P.coloring B, Disjoint K (TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T c)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j A B X K hsplitAvoid hB_T + hprefixB_X hlenBX firstPositionBoundOnT hXlen c hc + let p := HierarchyFirstMissingPosition P.coloring T c + have hp : p.val ≤ B.length := firstPositionBoundOnT hc + let ib : Fin (B.length + 1) := ⟨p.val, by omega⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hB_T.1) ib = p := Fin.ext rfl + have hvB : T.vertex p ∈ TreeSequenceVertexSet B := by + rw [← hcast, hB_T.2.1 ib] + simp [TreeSequenceVertexSet] + have hvX := TreeSequenceInitialSegmentVertexSetSubset hprefixB_X hvB + apply Set.disjoint_left.mpr + intro x hx hy + apply hsplitAvoid (T.vertex p) hvX + change (TwoColorIncidenceGraph G P.coloring alpha beta).connectedComponentMk x = + (TwoColorIncidenceGraph G P.coloring alpha beta).connectedComponentMk + (Sum.inl (T.vertex (Fin.last T.length))) at hx + change (TwoColorIncidenceGraph G P.coloring alpha beta).connectedComponentMk x = + (TwoColorIncidenceGraph G P.coloring alpha beta).connectedComponentMk + (Sum.inl (T.vertex p)) at hy + exact hy.symm.trans hx + +private theorem helper_hpath_458.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (_ : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) (_ : alpha ≠ + beta), TwoColorPathComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last + T.length))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hAlphaTerminal hne + refine ⟨hne, Sum.inl (T.vertex (Fin.last T.length)), rfl, ?_⟩ + have hd := MissingColorIncidenceEndpoint G P.coloring alpha beta hne + P.minimumContext.proper (T.vertex (Fin.last T.length)) hAlphaTerminal + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx y hy + change (TwoColorIncidenceGraph G P.coloring alpha beta).Adj + (Sum.inl (T.vertex (Fin.last T.length))) x at hx + change (TwoColorIncidenceGraph G P.coloring alpha beta).Adj + (Sum.inl (T.vertex (Fin.last T.length))) y at hy + exact Finset.card_le_one.mp hd x + (by simpa only [SimpleGraph.mem_neighborFinset] using hx) y + (by simpa only [SimpleGraph.mem_neighborFinset] using hy) + +private theorem helper_hstarToTOriginal_485.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + TreeSequenceInitialSegment + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C + let H₀ := C.hierarchy + let q₀ : Fin (H₀.dividerCount + 1) := Fin.last H₀.dividerCount + have starStep : TreeSequenceInitialSegment + (HierarchyStarredStage H₀ q₀) (H₀.stage q₀.succ) := by + refine Fin.cases ?_ (fun i => ?_) q₀ + · exact H₀.coreInsideFirst + · exact H₀.nested i.succ + have hlast : q₀.succ = Fin.last (H₀.dividerCount + 1) := by + apply Fin.ext + rfl + simpa [H₀, q₀, hlast, H₀.terminalStage] using starStep + +private theorem helper_hprefixA_B_507.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : (2 : ℕ) ≤ + HierarchyPathNumber C.hierarchy), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A) (_ : + TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)) T), TreeSequenceInitialSegment A B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower H q j A B hstar hstarToTOriginal + dsimp only [B, HierarchyFullTailPrefix] + rw [← hstar] + have hlen : + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 2)) T.length := by + have hj : 2 ≤ j := by dsimp [j]; exact hpathLower + exact Nat.le_min.mpr ⟨by omega, hstarToTOriginal.1⟩ + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact hstarToTOriginal.2.1 i + · intro i + exact hstarToTOriginal.2.2 i + +private theorem helper_hB_T_530.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (_ : ( + ∀ (S : TreeSequence G e0) (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmS : m ≤ S.length), + TreeSequenceInitialSegment (TreeSequencePrefix S m hm hmS) S)), TreeSequenceInitialSegment + B T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C j B prefixOfT + dsimp [B, HierarchyFullTailPrefix] + apply prefixOfT T _ ?_ (Nat.min_le_right _ _) + apply Nat.le_min.mpr + constructor + · have hA := (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).positive + omega + · exact T.positive + +private theorem helper_hX_T_539.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (_ : ( + ∀ (S : TreeSequence G e0) (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmS : m ≤ S.length), + TreeSequenceInitialSegment (TreeSequencePrefix S m hm hmS) S)), TreeSequenceInitialSegment + X T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C j X prefixOfT + dsimp [X, HierarchyFullTailPrefix] + apply prefixOfT T _ ?_ (Nat.min_le_right _ _) + apply Nat.le_min.mpr + constructor + · have hA := (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).positive + omega + · exact T.positive + +private theorem helper_hY_T_548.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : (2 : + ℕ) ≤ HierarchyPathNumber C.hierarchy), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + ∀ (_ : ( + ∀ (S : TreeSequence G e0) (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmS : m ≤ S.length), + TreeSequenceInitialSegment (TreeSequencePrefix S m hm hmS) S)), TreeSequenceInitialSegment + Y T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hpathLower j Y prefixOfT + dsimp [Y, HierarchyFullTailPrefix] + apply prefixOfT T _ ?_ (Nat.min_le_right _ _) + apply Nat.le_min.mpr + constructor + · have hA := (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).positive + omega + · exact T.positive + +private theorem helper_stageSegment_583.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + ∀ + (_ : + (∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) + (_ : TreeSequenceInitialSegment U W), TreeSequenceInitialSegment S W)) + (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H prefixTrans a d + induction d with + | zero => intro _; exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + | succ d ih => + intro hbound + have hp := ih (by omega) + have hn := H.nested ⟨a + d, by omega⟩ + have hn' : TreeSequenceInitialSegment + (H.stage ⟨a + d, by omega⟩) + (H.stage ⟨a + (d + 1), by omega⟩) := by + simpa [Nat.add_assoc] using hn + exact prefixTrans hp hn' + +private theorem helper_hX_Z_634.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : (2 : ℕ) ≤ + HierarchyPathNumber C.hierarchy) (_ : HierarchyPathNumber C.hierarchy < + HierarchyFullTailLength C), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (_ : ( + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : + TreeSequenceInitialSegment U W) (_ : S.length ≤ U.length), TreeSequenceInitialSegment S + U)) (_ : TreeSequenceInitialSegment X T), + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : TreeSequenceInitialSegment Z T), TreeSequenceInitialSegment X Z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper j X commonPrefix + hX_T Z hZ_T + apply commonPrefix hX_T hZ_T + change min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 1)) T.length ≤ + min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + + (T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length - 1)) T.length + have hu : j < T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length := hpathUpper + exact min_le_min (by omega) le_rfl + +private theorem helper_hAXstrict_676.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) + (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A), + A.length < X.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper H q j A X hstar + rw [← hstar] + change (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length < + min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 1)) T.length + have hj : j < T.length - + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length := by + change j < HierarchyFullTailLength C at hpathUpper + simpa [HierarchyFullTailLength] using hpathUpper + exact Nat.lt_min.mpr ⟨by omega, by omega⟩ + +private theorem helper_seedPrefixX_688.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : + TreeSequenceInitialSegment U W) (_ : S.length ≤ U.length), TreeSequenceInitialSegment S + U)) (_ : TreeSequenceInitialSegment A B) (_ : TreeSequenceInitialSegment X T) (_ : + TreeSequenceInitialSegment B X) (_ : ( + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : + TreeSequenceInitialSegment U W), TreeSequenceInitialSegment S W)) (_ : + TreeSequenceInitialSegment Tn A) (_ : X.length = B.length + (1 : ℕ)) (_ : A.length < + X.length) {f : E} {seed : TreeSequence G e0} (_ : TreeSequenceAdjoinEdge Tn f seed) (_ : + TashkinovAugmentationSequence P.coloring seed T), TreeSequenceInitialSegment seed X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q j A B X n Tn commonPrefix hprefixA_B + hX_T hprefixB_X prefixTrans hTnA hlenBX hAXstrict f seed hadjoin hroute + have hseedT := TashkinovAugmentationSequenceInitialSegment + P.coloring seed T hroute + have hlen : seed.length ≤ X.length := by + rw [hadjoin.1] + have hAX := prefixTrans hprefixA_B hprefixB_X + have hTnA_len := hTnA.1 + have hAXstrict' := hAXstrict + omega + exact commonPrefix hseedT hX_T hlen + +private theorem helper_routeToX_714.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : TreeSequenceInitialSegment X T) (_ : TreeSequenceInitialSegment Tn X) (_ : ( + have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data + n; P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence P.coloring Tn T ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TreeIncidentEdge Tn f ∧ ( + ∃ c ∈ TreeMissingColors P.coloring Tn ∪ Dn, P.coloring f = some c) ∧ + TashkinovAugmentationSequence P.coloring seed T)) (_ : ( + ∀ {f : E} {seed : TreeSequence G e0} (_ : TreeSequenceAdjoinEdge Tn f seed) (_ : + TashkinovAugmentationSequence P.coloring seed T), TreeSequenceInitialSegment seed X)) (_ : + ( + ∀ {S : TreeSequence G e0} (_ : TashkinovAugmentationSequence P.coloring S X), + TashkinovAugmentationSequence sigma S X)), P.corresponding.replacementETT.series.data.kind + n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence sigma Tn X ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j X n Tn sigma hX_T hTnX + terminalRoute seedPrefixX switchedRoute + rcases terminalRoute with ⟨hPE, hroute⟩ | + ⟨hNonPE, f, seed, hconnecting, hadjoin, _, _, hroute⟩ + · exact Or.inl ⟨hPE, + switchedRoute (TashkinovAugmentationSequenceRestrict P.coloring Tn X T + hroute hTnX hX_T)⟩ + · rcases hNonPE with hs | hr + · exact Or.inr ⟨Or.inl hs, f, seed, hconnecting, hadjoin, + switchedRoute (TashkinovAugmentationSequenceRestrict P.coloring seed X T + hroute (seedPrefixX hadjoin hroute) + hX_T)⟩ + · exact Or.inr ⟨Or.inr hr, f, seed, hconnecting, hadjoin, + switchedRoute (TashkinovAugmentationSequenceRestrict P.coloring seed X T + hroute (seedPrefixX hadjoin hroute) + hX_T)⟩ + +private theorem helper_firstPositionOnB_760.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) (eta : + Fin k), HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition + P.coloring B eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_missingEq eta + let cs : Finset (Fin (B.length + 1)) := Finset.univ.filter + fun i => eta ∈ MissingColors G sigma (B.vertex i) + let cp : Finset (Fin (B.length + 1)) := Finset.univ.filter + fun i => eta ∈ MissingColors G P.coloring (B.vertex i) + have hsets : cs = cp := by + ext i + simp only [cs, cp, Finset.mem_filter, Finset.mem_univ, true_and] + have hv : B.vertex i ∈ TreeSequenceVertexSet B := by + simp [TreeSequenceVertexSet] + rw [hB_missingEq (B.vertex i) hv] + unfold HierarchyFirstMissingPosition + change (if h : cs.Nonempty then cs.min' h else Fin.last B.length) = + (if h : cp.Nonempty then cp.min' h else Fin.last B.length) + rw [hsets] + +private theorem helper_firstPositionGloballyEqual_786.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : alpha ≠ beta) (eta : Fin k) (_ : eta ≠ alpha) (_ : eta ≠ beta), + HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition P.coloring T eta + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma hne eta hα hβ + let cs : Finset (Fin (T.length + 1)) := Finset.univ.filter + fun i => eta ∈ MissingColors G sigma (T.vertex i) + let cp : Finset (Fin (T.length + 1)) := Finset.univ.filter + fun i => eta ∈ MissingColors G P.coloring (T.vertex i) + have hsets : cs = cp := by + ext i + simp only [cs, cp, Finset.mem_filter, Finset.mem_univ, true_and] + exact (TwoColorComponentSwapMissingBehavior G P.coloring alpha beta hne + P.minimumContext.proper (Sum.inl (T.vertex (Fin.last T.length)))).2.2.2 + (T.vertex i) eta hα hβ + unfold HierarchyFirstMissingPosition + change (if h : cs.Nonempty then cs.min' h else Fin.last T.length) = + (if h : cp.Nonempty then cp.min' h else Fin.last T.length) + rw [hsets] + +private theorem helper_hstoredFirst_804.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (HierarchyPathNumber + C.hierarchy - (2 : ℕ)))) (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix + C (HierarchyPathNumber C.hierarchy - (2 : ℕ)))) (_ : ( + ∀ eta ∈ TreeMissingColors P.coloring B, HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition P.coloring T eta)) (_ : ( + ∀ (eta : Fin k) (_ : eta ≠ alpha) (_ : eta ≠ beta), HierarchyFirstMissingPosition sigma T eta + = HierarchyFirstMissingPosition P.coloring T eta)), + ∀ eta ∈ D, HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition + P.coloring T eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j B D sigma hAlphaB hBetaB + firstPositionEqualOnTail firstPositionGloballyEqual eta hD + by_cases hα : eta = alpha + · subst eta + exact firstPositionEqualOnTail alpha hAlphaB + · by_cases hβ : eta = beta + · subst eta + exact firstPositionEqualOnTail beta hBetaB + · exact firstPositionGloballyEqual eta hα hβ + +private theorem helper_fixedUntilSplitEnd_822.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : TreeSequenceInitialSegment X T) (_ : ( + ∀ v ∈ TreeSequenceVertexSet X, + ∀ (f : E), Incident G v f → TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex + (Fin.last T.length))) f = P.coloring f)) (_ : X.length = B.length + (1 : ℕ)) (r : Fin + T.length) (_ : (↑r : ℕ) ≤ X.length), sigma (T.edge r) = P.coloring (T.edge r) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B X sigma hX_T + hincidentFixed hlenBX r hr + obtain ⟨i, hi⟩ := T.attaches r + let ix : Fin (X.length + 1) := ⟨i.val, by omega⟩ + let it : Fin (T.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ r.isLt)) + have hcast : Fin.castLE (Nat.succ_le_succ hX_T.1) ix = it := Fin.ext rfl + have hv : T.vertex it = X.vertex ix := by + rw [← hcast] + exact hX_T.2.1 ix + apply hincidentFixed (T.vertex it) + (by rw [hv]; simp [TreeSequenceVertexSet]) (T.edge r) + change T.vertex it ∈ G.ends (T.edge r) + rw [hi] + exact Sym2.mem_mk_right _ _ + +private theorem helper_hXlen_837.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) + (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A), + X.length = A.length + (j - (1 : ℕ)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper H q j A X hstar + rw [← hstar] + change min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 1)) T.length = + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + + (j - 1) + have hu : j < T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length := hpathUpper + omega + +private theorem helper_htailP_1034.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A), + HierarchyFullTailLength P.counterexample = HierarchyFullTailLength C := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A hstar + change T.length - A.length = + T.length - (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + rw [← hstar] + +private theorem helper_hprefixP_1039.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A) + (i : ℕ), HierarchyFullTailPrefix P.counterexample i = HierarchyFullTailPrefix C i := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A hstar i + have hs : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) := hstar + unfold HierarchyFullTailPrefix + dsimp only + simp only [← hs] + +private theorem helper_hZeq_1049.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : + HierarchyFullTailLength P.counterexample = HierarchyFullTailLength C) (_ : ( + ∀ (i : ℕ), HierarchyFullTailPrefix P.counterexample i = HierarchyFullTailPrefix C i)), + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 : + ℕ)) = Z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P htailP hprefixP Z + rw [htailP, hprefixP] + +private theorem helper_hX_Z_1054.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : (2 : ℕ) ≤ + HierarchyPathNumber C.hierarchy) (_ : HierarchyPathNumber C.hierarchy < + HierarchyFullTailLength C), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (_ : ( + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : + TreeSequenceInitialSegment U W) (_ : S.length ≤ U.length), TreeSequenceInitialSegment S + U)) (_ : TreeSequenceInitialSegment X T), + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : TreeSequenceInitialSegment Z T), TreeSequenceInitialSegment X Z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper j X commonPrefix + hX_T Z hZ_T + apply helper_hX_Z_634 <;> assumption +private theorem helper_hZElementary_1056.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 + : ℕ)) = Z), ColoredVertexSetElementary G P.coloring (TreeSequenceVertexSet Z) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P Z hZeq + rw [← hZeq] + exact HierarchyCounterexamplePenultimateElementary G k e0 + P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT P.replacementBase P.counterexample + P.minimumContext.proper P.minimumContext.oneEdgeUncolored + P.minimumContext.lowerRung P.minimumContext.fewerDividers + P.minimumContext.lexicographicMinimality P.minimumContext.largeMissingSet + +private theorem helper_hB_missingEq_1068.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let K : Set (V ⊕ E) := TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last + T.length))); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : alpha ≠ beta) (_ : ( + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ K)) (_ : TreeSequenceInitialSegment B X), + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B X K sigma hne hsplitAvoid + hprefixB_X v hv + have hvX : v ∈ TreeSequenceVertexSet X := + TreeSequenceInitialSegmentVertexSetSubset hprefixB_X hv + have hbehavior := TwoColorComponentSwapMissingBehavior G P.coloring + alpha beta hne P.minimumContext.proper + (Sum.inl (T.vertex (Fin.last T.length))) + exact hbehavior.1 v (hsplitAvoid v hvX) + +private theorem helper_hfixedX_1077.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : ( + ∀ v ∈ TreeSequenceVertexSet X, + ∀ (f : E), Incident G v f → TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex + (Fin.last T.length))) f = P.coloring f)) (t : Fin X.length), sigma (X.edge t) = P.coloring + (X.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j X sigma hincidentFixed t + obtain ⟨i, hi⟩ := X.attaches t + apply hincidentFixed (X.vertex t.succ) (by simp [TreeSequenceVertexSet]) + (X.edge t) + change X.vertex t.succ ∈ G.ends (X.edge t) + rw [hi] + exact Sym2.mem_mk_left _ _ + +private theorem helper_hlenBX_1085.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) + (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + X.length = B.length + (1 : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper j B X + apply helper_hlenBX_410 <;> assumption +private theorem helper_hAXstrict_1087.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) + (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A), + A.length < X.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper H q j A X hstar + apply helper_hAXstrict_676 <;> assumption +private theorem helper_seedPrefixX_1089.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + ∀ (_ : ( + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : + TreeSequenceInitialSegment U W) (_ : S.length ≤ U.length), TreeSequenceInitialSegment S + U)) (_ : TreeSequenceInitialSegment A B) (_ : TreeSequenceInitialSegment X T) (_ : + TreeSequenceInitialSegment B X) (_ : ( + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : + TreeSequenceInitialSegment U W), TreeSequenceInitialSegment S W)) (_ : + TreeSequenceInitialSegment Tn A) (_ : X.length = B.length + (1 : ℕ)) (_ : A.length < + X.length) {f : E} {seed : TreeSequence G e0} (_ : TreeSequenceAdjoinEdge Tn f seed) (_ : + TashkinovAugmentationSequence P.coloring seed T), TreeSequenceInitialSegment seed X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q j A B X n Tn commonPrefix hprefixA_B + hX_T hprefixB_X prefixTrans hTnA hlenBX hAXstrict f seed hadjoin hroute + apply helper_seedPrefixX_688 <;> assumption +private theorem helper_switchedRoute_1094.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : TreeSequenceInitialSegment B X) (_ : ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) (_ : ( + ∀ (t : Fin X.length), sigma (X.edge t) = P.coloring (X.edge t))) (_ : X.length = B.length + (1 + : ℕ)) {S : TreeSequence G e0} (_ : TashkinovAugmentationSequence P.coloring S X), + TashkinovAugmentationSequence sigma S X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B X sigma hprefixB_X + hB_missingEq hfixedX hlenBX S hroute + exact TashkinovAugmentationSequenceColoringTransport + P.coloring sigma S B X hroute hprefixB_X hlenBX + (by intro t _; exact hfixedX t) hB_missingEq + +private theorem helper_oldSuffix_1100.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + ∀ (_ : TreeSequenceInitialSegment X T) (_ : TreeSequenceInitialSegment Tn X) (_ : ( + have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data + n; P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence P.coloring Tn T ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TreeIncidentEdge Tn f ∧ ( + ∃ c ∈ TreeMissingColors P.coloring Tn ∪ Dn, P.coloring f = some c) ∧ + TashkinovAugmentationSequence P.coloring seed T)) (_ : ( + ∀ {f : E} {seed : TreeSequence G e0} (_ : TreeSequenceAdjoinEdge Tn f seed) (_ : + TashkinovAugmentationSequence P.coloring seed T), TreeSequenceInitialSegment seed X)), + TashkinovAugmentationSequence P.coloring X T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P j X n Tn hX_T hTnX terminalRoute seedPrefixX + rcases terminalRoute with ⟨_, hroute⟩ | + ⟨_, f, seed, _, hadjoin, _, _, hroute⟩ + · exact TashkinovAugmentationSequenceSuffix P.coloring Tn X T hroute + hTnX hX_T + · exact TashkinovAugmentationSequenceSuffix P.coloring seed X T hroute + (seedPrefixX hadjoin hroute) hX_T + +private theorem helper_routeToX_1107.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : TreeSequenceInitialSegment X T) (_ : TreeSequenceInitialSegment Tn X) (_ : ( + have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data + n; P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence P.coloring Tn T ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TreeIncidentEdge Tn f ∧ ( + ∃ c ∈ TreeMissingColors P.coloring Tn ∪ Dn, P.coloring f = some c) ∧ + TashkinovAugmentationSequence P.coloring seed T)) (_ : ( + ∀ {f : E} {seed : TreeSequence G e0} (_ : TreeSequenceAdjoinEdge Tn f seed) (_ : + TashkinovAugmentationSequence P.coloring seed T), TreeSequenceInitialSegment seed X)) (_ : + ( + ∀ {S : TreeSequence G e0} (_ : TashkinovAugmentationSequence P.coloring S X), + TashkinovAugmentationSequence sigma S X)), P.corresponding.replacementETT.series.data.kind + n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence sigma Tn X ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j X n Tn sigma hX_T hTnX + terminalRoute seedPrefixX switchedRoute + apply helper_routeToX_714 <;> assumption +private theorem helper_hAlphaMissingX_1120.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (HierarchyPathNumber + C.hierarchy - (2 : ℕ)))) (_ : TreeSequenceInitialSegment B X) (_ : ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)), alpha + ∈ TreeMissingColors sigma X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B X sigma hAlphaB hprefixB_X + hB_missingEq + unfold TreeMissingColors at hAlphaB ⊢ + rcases Finset.mem_biUnion.mp hAlphaB with ⟨v, hv, hmiss⟩ + refine Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset hprefixB_X hv, ?_⟩ + rw [hB_missingEq v hv] + exact hmiss + +private theorem helper_hBetaMissingX_1127.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (HierarchyPathNumber + C.hierarchy - (2 : ℕ)))) (_ : TreeSequenceInitialSegment B X) (_ : ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)), beta + ∈ TreeMissingColors sigma X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B X sigma hBetaB hprefixB_X + hB_missingEq + unfold TreeMissingColors at hBetaB ⊢ + rcases Finset.mem_biUnion.mp hBetaB with ⟨v, hv, hmiss⟩ + refine Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset hprefixB_X hv, ?_⟩ + rw [hB_missingEq v hv] + exact hmiss + +private theorem helper_firstPositionOnB_1140.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) (eta : + Fin k), HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition + P.coloring B eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_missingEq eta + apply helper_firstPositionOnB_760; assumption +private theorem helper_firstPositionBoundOnT_1144.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (_ : alpha ≠ beta) (_ : TreeSequenceInitialSegment B T) {rho : PartialEdgeColoring E k} + {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), (↑(HierarchyFirstMissingPosition rho T + eta) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B hne hB_T rho eta hm + apply helper_firstPositionBoundOnT_530 <;> assumption +private theorem helper_firstPositionEqualOnTail_1148.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) (_ : ( + ∀ (eta : Fin k), HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition + P.coloring B eta)) (_ : ( + ∀ {rho : PartialEdgeColoring E k} {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), + (↑(HierarchyFirstMissingPosition rho T eta) : ℕ) ≤ B.length)), + ∀ eta ∈ TreeMissingColors P.coloring B, HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition P.coloring T eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_T hB_missingEq + firstPositionOnB firstPositionBoundOnT eta hm + exact @helper_firstPositionEqualOnTail_554 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hB_T) (@hB_missingEq) (@firstPositionOnB) (@firstPositionBoundOnT) (@eta) (@hm) + +private theorem helper_firstPositionGloballyEqual_1153.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : alpha ≠ beta) (eta : Fin k) (_ : eta ≠ alpha) (_ : eta ≠ beta), + HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition P.coloring T eta + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma hne eta hα hβ + apply helper_firstPositionGloballyEqual_786 <;> assumption +private theorem helper_hstoredFirst_1158.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (HierarchyPathNumber + C.hierarchy - (2 : ℕ)))) (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix + C (HierarchyPathNumber C.hierarchy - (2 : ℕ)))) (_ : ( + ∀ eta ∈ TreeMissingColors P.coloring B, HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition P.coloring T eta)) (_ : ( + ∀ (eta : Fin k) (_ : eta ≠ alpha) (_ : eta ≠ beta), HierarchyFirstMissingPosition sigma T eta + = HierarchyFirstMissingPosition P.coloring T eta)), + ∀ eta ∈ D, HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition + P.coloring T eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j B D sigma hAlphaB hBetaB + firstPositionEqualOnTail firstPositionGloballyEqual + exact @helper_hstoredFirst_804 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hAlphaB) (@hBetaB) (@firstPositionEqualOnTail) (@firstPositionGloballyEqual) + +private theorem helper_hgammaCutoff_1162.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ (_ : ((alpha ∉ (HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion (P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount)) ∪ (TreeSequenceVertexSet P.replacementBase.core + \ TreeSequenceVertexSet (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + P.coloring v) ∨ + ∃ eta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), alpha ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring + T eta) : ℕ) ≤ (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (2 : + ℕ))).length)) (_ : beta ∉ (HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount)).biUnion (P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount))) (_ : TreeSequenceInitialSegment B X), + ∀ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∨ beta ∈ P.counterexample.good.gamma q + eta → (↑(HierarchyFirstMissingPosition P.coloring T eta) : ℕ) ≤ X.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j B X D hAlphaChoice + hBetaNotGamma hprefixB_X + exact @helper_hgammaCutoff_610 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hAlphaChoice) (@hBetaNotGamma) (@hprefixB_X) + +private theorem helper_fixedUntilSplitEnd_1169.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : TreeSequenceInitialSegment X T) (_ : ( + ∀ v ∈ TreeSequenceVertexSet X, + ∀ (f : E), Incident G v f → TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex + (Fin.last T.length))) f = P.coloring f)) (_ : X.length = B.length + (1 : ℕ)) (r : Fin + T.length) (_ : (↑r : ℕ) ≤ X.length), sigma (T.edge r) = P.coloring (T.edge r) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B X sigma hX_T + hincidentFixed hlenBX r hr + exact @helper_fixedUntilSplitEnd_822 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hX_T) (@hincidentFixed) (@hlenBX) (@r) (@hr) + +private theorem helper_hXlen_1172.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) + (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A), + X.length = A.length + (j - (1 : ℕ)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper H q j A X hstar + exact @helper_hXlen_837 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hpathLower) (@hpathUpper) + (@hstar) + +private theorem helper_hseparated_1174.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let K : Set (V ⊕ E) := TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last + T.length))); + ∀ (_ : ( + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ K)) (_ : TreeSequenceInitialSegment B T) (_ : + TreeSequenceInitialSegment B X) (_ : X.length = B.length + (1 : ℕ)) (_ : ( + ∀ {rho : PartialEdgeColoring E k} {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), + (↑(HierarchyFirstMissingPosition rho T eta) : ℕ) ≤ B.length)) (_ : X.length = A.length + + (j - (1 : ℕ))), + ∀ c ∈ TreeMissingColors P.coloring B, Disjoint K (TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T c)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j A B X K hsplitAvoid hB_T + hprefixB_X hlenBX firstPositionBoundOnT hXlen c hc + exact @helper_hseparated_657 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@hsplitAvoid) (@hB_T) (@hprefixB_X) (@hlenBX) (@firstPositionBoundOnT) (@hXlen) (@c) (@hc) + +private theorem helper_missingOnB_1178.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) + {c : Fin k} (_ : c ∈ TreeMissingColors P.coloring B), c ∈ TreeMissingColors sigma B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_missingEq c hc + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [hB_missingEq v hv]; exact hm⟩ + +private theorem helper_oldMissingOnZ_1182.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + ∀ (_ : TreeSequenceInitialSegment B X), + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : TreeSequenceInitialSegment X Z) {c : Fin k} (_ : c ∈ TreeMissingColors P.coloring B), c + ∈ TreeMissingColors P.coloring Z := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P j B X hprefixB_X Z hX_Z c hc + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hX_Z + (TreeSequenceInitialSegmentVertexSetSubset hprefixB_X hv), hm⟩ + +private theorem helper_branch_1216.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 + : ℕ)) = Z) (_ : TreeSequenceInitialSegment X Z), TreeSequenceInitialSegment + (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : ℕ))) + (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 : + ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P j X Z hZeq hX_Z + rw [hZeq] + exact hX_Z + +private theorem helper_branch_1218.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 + : ℕ)) = Z) (_ : ColoredVertexSetElementary G P.coloring (TreeSequenceVertexSet Z)), + ColoredVertexSetElementary G P.coloring (TreeSequenceVertexSet (HierarchyFullTailPrefix + P.counterexample (HierarchyFullTailLength P.counterexample - (1 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P Z hZeq hZElementary + rw [hZeq] + exact hZElementary + +private theorem helper_branch_1220.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : TreeSequenceInitialSegment X Z) (_ : ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G (TwoColorComponentSwap G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length)))) v = MissingColors G P.coloring v)) (_ : ( + ∀ (t : Fin X.length), sigma (X.edge t) = P.coloring (X.edge t))), TreeColoringInvariant + (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : ℕ))) P.coloring + (TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length)))) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j X sigma Z hX_Z hpenMissing + hfixedX + refine ⟨fun r _ => hfixedX r, ?_⟩ + intro v hv + exact hpenMissing v (TreeSequenceInitialSegmentVertexSetSubset hX_Z hv) + +private theorem helper_branch_1223.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : ( + ∀ (r : Fin T.length) (_ : (↑r : ℕ) ≤ X.length), sigma (T.edge r) = P.coloring (T.edge r))) (_ + : X.length = A.length + (j - (1 : ℕ))), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let j : ℕ := HierarchyPathNumber C.hierarchy; + ∀ (r : Fin T.length) (_ : A.length ≤ (↑r : ℕ)) (_ : (↑r : ℕ) < A.length + j), + TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length))) + (T.edge r) = P.coloring (T.edge r) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hpathLower H q j A X sigma + fixedUntilSplitEnd hXlen + dsimp only + intro r _ hr + apply fixedUntilSplitEnd r + rw [hXlen] + change r.val < A.length + j at hr + have hj : 2 ≤ j := hpathLower + omega + +private theorem helper_branch_1230.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let j : ℕ := HierarchyPathNumber C.hierarchy; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + ∀ (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (HierarchyPathNumber + C.hierarchy - (2 : ℕ)))) (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix + C (HierarchyPathNumber C.hierarchy - (2 : ℕ)))), + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 + : ℕ)) = Z) (_ : ( + ∀ {c : Fin k} (_ : c ∈ TreeMissingColors P.coloring B), c ∈ TreeMissingColors P.coloring Z)), + let B : TreeSequence G e0 := HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength + P.counterexample - (1 : ℕ)); alpha ∈ TreeMissingColors P.coloring B ∧ beta ∈ + TreeMissingColors P.coloring B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B hAlphaB hBetaB Z hZeq + oldMissingOnZ + rw [hZeq] + exact ⟨oldMissingOnZ hAlphaB, oldMissingOnZ hBetaB⟩ + +private theorem helper_branch_1232.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (_ : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) (_ : alpha ≠ + beta), beta ∈ MissingColors G (TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length)))) (T.vertex (Fin.last T.length)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hAlphaTerminal hne + exact (TwoColorComponentSwapMissingBehavior G P.coloring alpha beta hne + P.minimumContext.proper (Sum.inl (T.vertex (Fin.last T.length)))).2.1 + (T.vertex (Fin.last T.length)) rfl hAlphaTerminal + +private theorem helper_branch_1235.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 + : ℕ)) = Z) (_ : ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G (TwoColorComponentSwap G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length)))) v = MissingColors G P.coloring v)), + ∀ v ∈ TreeSequenceVertexSet (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength + P.counterexample - (1 : ℕ))), MissingColors G (TwoColorComponentSwap G P.coloring alpha + beta (Sum.inl (T.vertex (Fin.last T.length)))) v = MissingColors G P.coloring v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta Z hZeq hpenMissing + rw [hZeq] + exact hpenMissing + +private abbrev helperContinuation2539Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let j : ℕ := HierarchyPathNumber C.hierarchy; + ∀ (_ : (2 : ℕ) ≤ j) (_ : j < HierarchyFullTailLength C), + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let _ : Finset (Fin k) := HierarchyStoredColorsAt H q; + let K : Set (V ⊕ E) := TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last + T.length))); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))); + ∀ (_ : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) (_ : alpha ∈ + TreeMissingColors P.coloring B) (_ : (alpha ∉ (HierarchyStoredColorsAt + P.counterexample.hierarchy q).biUnion (P.counterexample.good.gamma q) ∪ + (TreeSequenceVertexSet P.replacementBase.core \ TreeSequenceVertexSet Tn).biUnion fun (v : + V) ↦ MissingColors G P.coloring v) ∨ + ∃ eta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy q, alpha ∈ + P.counterexample.good.gamma q eta ∧ (↑(HierarchyFirstMissingPosition P.coloring T eta) : + ℕ) ≤ B.length) (_ : beta ∈ TreeMissingColors P.coloring B) (_ : beta ∉ + (HierarchyStoredColorsAt P.counterexample.hierarchy q).biUnion + (P.counterexample.good.gamma q)) (_ : alpha ≠ beta) (_ : TwoColorPathComponent G + P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length)))) (_ : sigma = sigma) (_ : + IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (_ : + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ K) (_ : HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A) (_ : TreeSequenceInitialSegment A B) (_ : + TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment X T) (_ : + TreeSequenceInitialSegment B X) (_ : + ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W + → TreeSequenceInitialSegment S W) (_ : TreeSequenceInitialSegment P.replacementBase.core + A), + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + ∀ (_ : HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 + : ℕ)) = Z) (_ : TreeSequenceInitialSegment X Z) (_ : ColoredVertexSetElementary G + P.coloring (TreeSequenceVertexSet Z)) (_ : + ∀ v ∈ TreeSequenceVertexSet X, + ∀ (f : E), Incident G v f → TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex + (Fin.last T.length))) f = P.coloring f) (_ : + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G (TwoColorComponentSwap G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length)))) v = MissingColors G P.coloring v) (_ : + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v) (_ : + ∀ (t : Fin X.length), sigma (X.edge t) = P.coloring (X.edge t)) (_ : X.length = B.length + (1 + : ℕ)) (_ : A.length < X.length) (_ : TashkinovAugmentationSequence P.coloring X T) (_ : + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X) (_ : alpha + ∈ TreeMissingColors sigma X ∧ beta ∈ TreeMissingColors sigma X) (_ : + TashkinovAugmentationSequence sigma X T) (_ : + ∀ {rho : PartialEdgeColoring E k} {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), + (↑(HierarchyFirstMissingPosition rho T eta) : ℕ) ≤ B.length) (_ : + ∀ (eta : Fin k) (_ : eta ∈ TreeMissingColors P.coloring B), HierarchyFirstMissingPosition + sigma T eta = HierarchyFirstMissingPosition P.coloring T eta), Nonempty + (P2880_T1_SplitSwapData G k e0 input T phi ett base C ctx P alpha beta sigma) + +private theorem helper_continuation_2539.{u_1, u_2} : + helperContinuation2539Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j hpathLower hpathUpper A + B X n Tn D K sigma hAlphaTerminal hAlphaB hAlphaChoice hBetaB hBetaNotGamma hne hpath + hsigma hsigmaProper hsigmaOne hsplitAvoid hstar hprefixA_B hB_T hX_T hprefixB_X prefixTrans + coreA Z hZeq hX_Z hZElementary hincidentFixed hpenMissing hB_missingEq hfixedX hlenBX + hAXstrict oldSuffix routeToX hsplitMissing switchedSuffix firstPositionBoundOnT + firstPositionEqualOnTail + with_reducible_and_instances + have firstPositionGloballyEqual := @helper_firstPositionGloballyEqual_1153 (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hne) + have hstoredFirst := @helper_hstoredFirst_1158 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@hAlphaB) (@hBetaB) (@firstPositionEqualOnTail) + (@firstPositionGloballyEqual) + have hgammaCutoff := @helper_hgammaCutoff_1162 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@hAlphaChoice) (@hBetaNotGamma) (@hprefixB_X) + have hAX : TreeSequenceInitialSegment A X := + prefixTrans hprefixA_B hprefixB_X + have fixedUntilSplitEnd := @helper_fixedUntilSplitEnd_1169 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@hX_T) (@hincidentFixed) (@hlenBX) + have hXlen := @helper_hXlen_1172 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hpathLower) (@hpathUpper) (@hstar) + have hseparated := @helper_hseparated_1174 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hsplitAvoid) (@hB_T) (@hprefixB_X) (@hlenBX) (@firstPositionBoundOnT) (@hXlen) + have missingOnB := @helper_missingOnB_1178 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hB_missingEq) + have oldMissingOnZ := @helper_oldMissingOnZ_1182 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@hprefixB_X) (@hX_Z) + refine ⟨{ + swapped := hsigma + distinct := hne + path := hpath + splitOutside := hsplitAvoid + twoBeforeInSplit := hprefixB_X + splitInFull := hX_T + splitAboveStar := ⟨hAX, hAXstrict⟩ + splitInPenultimate := ?_ + coreInSplit := prefixTrans coreA hAX + penultimateElementary := ?_ + proper := hsigmaProper + oneEdgeUncolored := hsigmaOne + invariant := ?_ + incidentFixed := hincidentFixed + fixedOnSplit := fun r hr => fixedUntilSplitEnd r (Nat.le_of_lt hr) + fixedThroughJ := ?_ + missingTwoBefore := ⟨missingOnB hAlphaB, missingOnB hBetaB⟩ + missingOnSplit := hsplitMissing + oldMissingOnPenultimate := ?_ + missingTerminal := ?_ + penultimateMissing := ?_ + storedFirst := hstoredFirst + gammaCutoff := hgammaCutoff + separatedAlpha := hseparated alpha hAlphaB + separatedBeta := hseparated beta hBetaB + prefixRoute := routeToX + oldSuffix := oldSuffix + newSuffix := switchedSuffix }⟩ + · exact @helper_branch_1216 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hZeq) (@hX_Z) + · exact @helper_branch_1218 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hZeq) (@hZElementary) + · exact @helper_branch_1220 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@hX_Z) (@hpenMissing) (@hfixedX) + · exact @helper_branch_1223 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@hpathLower) (@fixedUntilSplitEnd) (@hXlen) + · exact @helper_branch_1230 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@hAlphaB) (@hBetaB) (@hZeq) (@oldMissingOnZ) + · exact @helper_branch_1232 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@hAlphaTerminal) (@hne) + · exact @helper_branch_1235 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@hZeq) (@hpenMissing) + +private theorem helper_continuation_1137.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) (_ : HierarchyPathNumber C.hierarchy < + HierarchyFullTailLength C) (_ : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last + T.length))) (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C + (HierarchyPathNumber C.hierarchy - (2 : ℕ)))) (_ : ((alpha ∉ (HierarchyStoredColorsAt + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount)) ∪ + (TreeSequenceVertexSet P.replacementBase.core \ TreeSequenceVertexSet + (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G + P.coloring v) ∨ + ∃ eta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount), alpha ∈ P.counterexample.good.gamma (Fin.last + P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring + T eta) : ℕ) ≤ (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (2 : + ℕ))).length)) (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C + (HierarchyPathNumber C.hierarchy - (2 : ℕ)))) (_ : beta ∉ (HierarchyStoredColorsAt + P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount)).biUnion + (P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount))) (_ : + alpha ≠ beta) (_ : TwoColorPathComponent G P.coloring alpha beta (Sum.inl (T.vertex + (Fin.last T.length)))) (_ : (TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))) : PartialEdgeColoring E k) = TwoColorComponentSwap G + P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length)))) (_ : IsProperEdgeColoring + G (TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length))) + : PartialEdgeColoring E k)) (_ : IsOneEdgeUncolored (TwoColorComponentSwap G P.coloring + alpha beta (Sum.inl (T.vertex (Fin.last T.length))) : PartialEdgeColoring E k) e0) (_ : ( + ∀ v ∈ TreeSequenceVertexSet (HierarchyFullTailPrefix C ((HierarchyPathNumber C.hierarchy : ℕ) + - (1 : ℕ)) : TreeSequence G e0), Sum.inl v ∉ (TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) : Set (V ⊕ E)))) (_ : HierarchyStarredStage + C.hierarchy (Fin.last C.hierarchy.dividerCount) = (HierarchyStarredStage + (P.counterexample.hierarchy : TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase) (Fin.last (P.counterexample.hierarchy : TashkinovHierarchy + P.corresponding.replacementETT P.replacementBase).dividerCount : Fin + ((P.counterexample.hierarchy : TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase).dividerCount + (1 : ℕ))) : TreeSequence G e0)) (_ : ( + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : + TreeSequenceInitialSegment U W) (_ : S.length ≤ U.length), TreeSequenceInitialSegment S + U)) (_ : TreeSequenceInitialSegment (HierarchyStarredStage (P.counterexample.hierarchy : + TashkinovHierarchy P.corresponding.replacementETT P.replacementBase) (Fin.last + (P.counterexample.hierarchy : TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase).dividerCount : Fin ((P.counterexample.hierarchy : TashkinovHierarchy + P.corresponding.replacementETT P.replacementBase).dividerCount + (1 : ℕ))) : TreeSequence + G e0) (HierarchyFullTailPrefix C ((HierarchyPathNumber C.hierarchy : ℕ) - (2 : ℕ)) : + TreeSequence G e0)) (_ : TreeSequenceInitialSegment (HierarchyFullTailPrefix C + ((HierarchyPathNumber C.hierarchy : ℕ) - (2 : ℕ)) : TreeSequence G e0) T) (_ : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C ((HierarchyPathNumber C.hierarchy : + ℕ) - (1 : ℕ)) : TreeSequence G e0) T) (_ : TreeSequenceInitialSegment + (HierarchyFullTailPrefix C ((HierarchyPathNumber C.hierarchy : ℕ) - (2 : ℕ)) : + TreeSequence G e0) (HierarchyFullTailPrefix C ((HierarchyPathNumber C.hierarchy : ℕ) - (1 + : ℕ)) : TreeSequence G e0)) (_ : ( + ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : + TreeSequenceInitialSegment U W), TreeSequenceInitialSegment S W)) (_ : + TreeSequenceInitialSegment P.replacementBase.core (HierarchyStarredStage + (P.counterexample.hierarchy : TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase) (Fin.last (P.counterexample.hierarchy : TashkinovHierarchy + P.corresponding.replacementETT P.replacementBase).dividerCount : Fin + ((P.counterexample.hierarchy : TashkinovHierarchy P.corresponding.replacementETT + P.replacementBase).dividerCount + (1 : ℕ))) : TreeSequence G e0)) (_ : + TreeSequenceInitialSegment (P.corresponding.replacementETT.series.data.tree (Fin.last + P.corresponding.replacementETT.rounds : Fin (P.corresponding.replacementETT.rounds + (1 : + ℕ))).castSucc : TreeSequence G e0) P.replacementBase.core), Nonempty + (P2880_T1_SplitSwapData G k e0 input T phi ett base C ctx P alpha beta + (TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last T.length))))) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta hpathLower hpathUpper + set H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + P.counterexample.hierarchy + set q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount + set j : ℕ := HierarchyPathNumber C.hierarchy + set A : TreeSequence G e0 := HierarchyStarredStage H q + set B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)) + set X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)) + set n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + P.corresponding.replacementETT.rounds + set Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc + let D : Finset (Fin k) := + HierarchyStoredColorsAt H q + set K : Set (V ⊕ E) := TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last + T.length))) + set sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl + (T.vertex (Fin.last T.length))) + intro hAlphaTerminal hAlphaB hAlphaChoice hBetaB hBetaNotGamma hne hpath hsigma hsigmaProper + hsigmaOne hsplitAvoid hstar commonPrefix hprefixA_B hB_T hX_T hprefixB_X prefixTrans coreA + hTnCore + -- Keep the hierarchy computations folded while assembling their established properties. + with_reducible_and_instances + have hTnA : TreeSequenceInitialSegment Tn A := prefixTrans hTnCore coreA + have hTnX : TreeSequenceInitialSegment Tn X := + prefixTrans hTnA (prefixTrans hprefixA_B hprefixB_X) + have terminalRoute := P2813_T1_TerminalRoute G k e0 + P.corresponding.replacementInput T P.coloring + P.corresponding.replacementETT + have htailP := @helper_htailP_1034 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hstar) + have hprefixP := @helper_hprefixP_1039 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hstar) + let Z := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + have hZeq := @helper_hZeq_1049 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@htailP) (@hprefixP) + have hZ_T : TreeSequenceInitialSegment Z T := by + unfold TreeSequenceInitialSegment Z HierarchyFullTailPrefix TreeSequencePrefix + exact ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hX_Z := @helper_hX_Z_1054 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hpathLower) + (@hpathUpper) (@commonPrefix) (@hX_T) (@hZ_T) + have hZElementary := @helper_hZElementary_1056 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@hZeq) + obtain ⟨hincidentFixed, hpenMissing⟩ := P2880_T1_ElementaryPrefixSwap G P.coloring + alpha beta hne P.minimumContext.proper B X Z hprefixB_X hX_Z hZElementary + hAlphaB hBetaB (Sum.inl (T.vertex (Fin.last T.length))) hsplitAvoid + have hB_missingEq := @helper_hB_missingEq_1068 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@hne) (@hsplitAvoid) (@hprefixB_X) + have hfixedX := @helper_hfixedX_1077 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hincidentFixed) + have hlenBX := @helper_hlenBX_1085 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hpathLower) (@hpathUpper) + have hAXstrict := @helper_hAXstrict_1087 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hpathLower) (@hpathUpper) (@hstar) + have seedPrefixX := @helper_seedPrefixX_1089 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@commonPrefix) (@hprefixA_B) (@hX_T) (@hprefixB_X) (@prefixTrans) (@hTnA) (@hlenBX) + (@hAXstrict) + have switchedRoute := @helper_switchedRoute_1094 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@hprefixB_X) (@hB_missingEq) (@hfixedX) (@hlenBX) + have oldSuffix := @helper_oldSuffix_1100 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hX_T) + (@hTnX) (@terminalRoute) (@seedPrefixX) + have routeToX := @helper_routeToX_1107 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hX_T) (@hTnX) (@terminalRoute) (@seedPrefixX) (@switchedRoute) + have hAlphaMissingX := @helper_hAlphaMissingX_1120 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@hAlphaB) (@hprefixB_X) (@hB_missingEq) + have hBetaMissingX := @helper_hBetaMissingX_1127 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@hBetaB) (@hprefixB_X) (@hB_missingEq) + have hsplitMissing : alpha ∈ TreeMissingColors sigma X ∧ + beta ∈ TreeMissingColors sigma X := ⟨hAlphaMissingX, hBetaMissingX⟩ + have switchedSuffix : TashkinovAugmentationSequence sigma X T := + TashkinovAugmentationSequenceComponentSwap G k e0 P.coloring alpha beta + hne (Sum.inl (T.vertex (Fin.last T.length))) X T oldSuffix + hsplitMissing.1 hsplitMissing.2 + have firstPositionOnB := @helper_firstPositionOnB_1140 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@hB_missingEq) + have firstPositionBoundOnT := @helper_firstPositionBoundOnT_1144 (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hne) (@hB_T) + have firstPositionEqualOnTail := @helper_firstPositionEqualOnTail_1148 (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hB_T) (@hB_missingEq) (@firstPositionOnB) + (@firstPositionBoundOnT) + exact @helper_continuation_2539 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@beta) (@hpathLower) (@hpathUpper) (@hAlphaTerminal) (@hAlphaB) (@hAlphaChoice) + (@hBetaB) (@hBetaNotGamma) (@hne) (@hpath) (@hsigma) (@hsigmaProper) (@hsigmaOne) + (@hsplitAvoid) (@hstar) (@hprefixA_B) (@hB_T) (@hX_T) (@hprefixB_X) (@prefixTrans) + (@coreA) (@hZeq) (@hX_Z) (@hZElementary) (@hincidentFixed) (@hpenMissing) (@hB_missingEq) + (@hfixedX) (@hlenBX) (@hAXstrict) (@oldSuffix) (@routeToX) (@hsplitMissing) + (@switchedSuffix) (@firstPositionBoundOnT) (@firstPositionEqualOnTail) +theorem P2880_T1_CommonPreparation + {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation + G k e0 input T phi ett base C ctx) + (alpha beta : Fin k) + (hpathLower : 2 ≤ HierarchyPathNumber C.hierarchy) + (hpathUpper : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C) + (halpha : + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let j := HierarchyPathNumber C.hierarchy + let B := HierarchyFullTailPrefix C (j - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + alpha ∈ MissingColors G P.coloring + (T.vertex (Fin.last T.length)) ∧ + alpha ∈ TreeMissingColors P.coloring B ∧ + (alpha ∉ Gamma ∪ baseExtraMissing ∨ + ∃ eta : Fin k, eta ∈ D ∧ + alpha ∈ P.counterexample.good.gamma q eta ∧ + (HierarchyFirstMissingPosition P.coloring T eta).val ≤ + B.length)) + (hbeta : + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let j := HierarchyPathNumber C.hierarchy + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (j - 2) + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let baseExtraMissing := + ((TreeSequenceVertexSet P.replacementBase.core \ + TreeSequenceVertexSet Tn).biUnion + fun v => MissingColors G P.coloring v) + let tailUsedThroughJ := + (Finset.univ : Finset (Fin k)).filter fun c => + ∃ r : Fin T.length, + A.length ≤ r.val ∧ r.val < A.length + j ∧ + P.coloring (T.edge r) = some c + beta ≠ alpha ∧ + beta ∈ TreeMissingColors P.coloring B ∧ + beta ∉ Gamma ∧ beta ∉ tailUsedThroughJ ∧ + (beta ∉ baseExtraMissing ∪ D ∨ + beta ∈ D ∧ + Disjoint (P.counterexample.good.gamma q beta ∪ {beta}) + tailUsedThroughJ)) + (hcomponentDisjoint : + let j := HierarchyPathNumber C.hierarchy + let X := HierarchyFullTailPrefix C (j - 1) + let Q := TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) + ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ Q) : + Nonempty (P2880_T1_SplitSwapData G k e0 input T phi ett base C ctx P + alpha beta (TwoColorComponentSwap G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length))))) := by + classical + let H := P.counterexample.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let j := HierarchyPathNumber C.hierarchy + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (j - 2) + let X := HierarchyFullTailPrefix C (j - 1) + let Y := HierarchyFullTailPrefix C j + let n : Fin (P.corresponding.replacementETT.rounds + 1) := + Fin.last P.corresponding.replacementETT.rounds + let Tn := P.corresponding.replacementETT.series.data.tree n.castSucc + let D := HierarchyStoredColorsAt H q + let Gamma := D.biUnion (P.counterexample.good.gamma q) + let K := TwoColorComponent G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) + let sigma := TwoColorComponentSwap G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) + rcases halpha with ⟨hAlphaTerminal, hAlphaB, hAlphaChoice⟩ + rcases hbeta with ⟨hBetaNe, hBetaB, hBetaNotGamma, hBetaNotUsed, hBetaChoice⟩ + have hne : alpha ≠ beta := by + intro he + exact hBetaNe he.symm + have hpath := @helper_hpath_458 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) + (@hAlphaTerminal) (@hne) + have hsigma : sigma = TwoColorComponentSwap G P.coloring alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) := rfl + have hsigmaProper : IsProperEdgeColoring G sigma := by + dsimp [sigma] + exact TwoColorComponentSwapProper G P.coloring alpha beta hne + P.minimumContext.proper _ + have hsigmaOne := @helper_hsigmaOne_150 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hne) + have hsplitAvoid : ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ K := by + simpa only [X, K] using hcomponentDisjoint + have hstar : HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A := + (P2752_T2_HierarchyMeasures C.hierarchy P.counterexample.hierarchy P.sameGood.1).1 + have hstarToTOriginal := @helper_hstarToTOriginal_485 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + have hA_T : TreeSequenceInitialSegment A T := by + rw [← hstar] + exact hstarToTOriginal + have commonPrefix := @helper_commonPrefix_190 (@V) (@E) (@G) (@e0) + have hprefixA_B := @helper_hprefixA_B_507 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@hpathLower) (@hstar) (@hstarToTOriginal) + have prefixOfT (S : TreeSequence G e0) (m : ℕ) + (hm : 1 ≤ m) (hmS : m ≤ S.length) : + TreeSequenceInitialSegment (TreeSequencePrefix S m hm hmS) S := by + refine ⟨hmS, ?_, ?_⟩ + · intro i + simp [TreeSequencePrefix] + · intro i + simp [TreeSequencePrefix] + have hB_T := @helper_hB_T_530 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@prefixOfT) + have hX_T := @helper_hX_T_539 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@prefixOfT) + have hY_T := @helper_hY_T_548 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hpathLower) (@prefixOfT) + have hprefixB_X : TreeSequenceInitialSegment B X := by + apply commonPrefix hB_T hX_T + change min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 2)) T.length ≤ + min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 1)) T.length + have hj : 2 ≤ j := by dsimp [j]; exact hpathLower + exact min_le_min (by omega) le_rfl + have hprefixX_Y : TreeSequenceInitialSegment X Y := by + apply commonPrefix hX_T hY_T + change min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + (j - 1)) T.length ≤ + min ((HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length + j) T.length + exact min_le_min (by omega) le_rfl + have prefixTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + rcases hSU with ⟨hSUl, hSUv, hSUe⟩ + rcases hUW with ⟨hUWl, hUWv, hUWe⟩ + refine ⟨hSUl.trans hUWl, ?_, ?_⟩ + · intro i + exact (hUWv (Fin.castLE (Nat.succ_le_succ hSUl) i)).trans (hSUv i) + · intro i + exact (hUWe (Fin.castLE hSUl i)).trans (hSUe i) + have stageSegment := @helper_stageSegment_583 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@prefixTrans) + have coreA := @helper_coreA_303 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@prefixTrans) + (@stageSegment) + have hTnCore : TreeSequenceInitialSegment Tn P.replacementBase.core := by + by_cases hpe : P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨u⟩⟩ := P.replacementBase.parallel hpe + simpa [Tn, n] using u.leftSegment + · rw [P.replacementBase.nonparallel hpe] + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + exact @helper_continuation_1137 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) + (@beta) (@hpathLower) (@hpathUpper) (@hAlphaTerminal) (@hAlphaB) (@hAlphaChoice) (@hBetaB) + (@hBetaNotGamma) (@hne) (@hpath) (@hsigma) (@hsigmaProper) (@hsigmaOne) (@hsplitAvoid) + (@hstar) (@commonPrefix) (@hprefixA_B) (@hB_T) (@hX_T) (@hprefixB_X) (@prefixTrans) + (@coreA) (@hTnCore) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableChange.lean b/LeanPool/GoldbergSeymour/StableChange.lean new file mode 100644 index 0000000000..c31a6e6a6f --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChange.lean @@ -0,0 +1,204 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableChangeCaseThree + +/-! +# Stable Change + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem StableChange {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty) + (z : Sum V E) (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hcase : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let Dnq := HierarchyStoredColorsAt H q + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + let vb := T.vertex (HierarchyFirstMissingPosition phi T beta) + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + (0 < H.dividerCount ∧ + alpha ∈ TreeMissingColors phi Tnq ∧ + TwoColorPathComponent G phi alpha beta z ∧ + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) ∨ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + (alpha ∈ TreeMissingColors phi A ∧ + alpha ∉ Dn ∧ beta ∉ Dn)) ∧ + TwoColorPathComponent G phi alpha beta z ∧ + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) ∨ + ((∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u va) ∧ + TreeVertexOrder T va vb ∧ + alpha ∉ Dnq ∧ beta ∉ Dnq ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + ia.val ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c))) : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dnq := HierarchyStoredColorsAt H q + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + (HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + (A = Tn ∨ + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, + MaximumProperty ettA) ∧ + (∀ hq : 0 < H.dividerCount, + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, + ∃ baseA : HierarchyBase ettA sigma, + ∃ K : TashkinovHierarchy ettA baseA, + ∃ goodA : GoodHierarchy K, + MaximumProperty ettA ∧ + ∃ hcount : K.dividerCount + 1 = H.dividerCount, + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ j : Fin (K.dividerCount + 2), + K.stage j = H.stage ⟨j.val, by omega⟩) ∧ + (∀ j : Fin (K.dividerCount + 1), + let jH : Fin (H.dividerCount + 1) := + ⟨j.val, by omega⟩ + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt H jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq + (Dnq.biUnion + (C.good.gamma ⟨C.hierarchy.dividerCount - 1, + by omega⟩)))) ∧ + (((∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u + (T.vertex (HierarchyFirstMissingPosition phi T alpha))) ∧ + TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ Dnq ∧ beta ∉ Dnq ∧ + alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + ia.val ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c)) → + ∃ corrT : CorrespondingExtendedTashkinovTree + G k e0 ett sigma T, + MaximumProperty corrT.replacementETT ∧ + ∃ baseT : HierarchyBase corrT.replacementETT sigma, + ∃ K : TashkinovHierarchy corrT.replacementETT baseT, + ∃ goodT : GoodHierarchy K, + SameGoodHierarchy C.good goodT) := by + dsimp only at hcase ⊢ + constructor + · rcases hcase with h1 | h2 | h3 + · have hresult := StableChangeCasesOneTwo G k e0 input T phi ett base C + hproper hone hlower hfewer hminimal hprefixElementary hlarge alpha + beta hne hmissingPrefix z h1.2.2.1 sigma hsigma + (Or.inl ⟨h1.1, h1.2.1⟩) h1.2.2.2 + refine ⟨hresult.1, hresult.2.1, hresult.2.2.1, ?_⟩ + intro hq + rcases hresult.2.2.2 hq with + ⟨inputA, ettA, baseA, K, goodA, hmax, _hkind, ⟨hcount, hrest⟩⟩ + exact ⟨inputA, ettA, baseA, K, goodA, hmax, hcount, hrest⟩ + · have hresult := StableChangeCasesOneTwo G k e0 input T phi ett base C + hproper hone hlower hfewer hminimal hprefixElementary hlarge alpha + beta hne hmissingPrefix z h2.2.2.1 sigma hsigma + (Or.inr ⟨h2.1, h2.2.1⟩) h2.2.2.2 + refine ⟨hresult.1, hresult.2.1, hresult.2.2.1, ?_⟩ + intro hq + rcases hresult.2.2.2 hq with + ⟨inputA, ettA, baseA, K, goodA, hmax, _hkind, ⟨hcount, hrest⟩⟩ + exact ⟨inputA, ettA, baseA, K, goodA, hmax, hcount, hrest⟩ + · have hresult := StableChangeCaseThree G k e0 input T phi ett base C + hproper hone hlower hfewer hminimal hprefixElementary hlarge + alpha beta hne hmissingPrefix z sigma hsigma h3.1 h3.2.1 + ⟨h3.2.2.1, h3.2.2.2.1⟩ h3.2.2.2.2 + exact ⟨hresult.1, hresult.2.1, hresult.2.2.1, + hresult.2.2.2.1⟩ + · intro h3 + have hresult := StableChangeCaseThree G k e0 input T phi ett base C + hproper hone hlower hfewer hminimal hprefixElementary hlarge alpha beta + hne hmissingPrefix z sigma hsigma h3.1 h3.2.1 + ⟨h3.2.2.1, h3.2.2.2.1⟩ h3.2.2.2.2 + exact hresult.2.2.2.2 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree.lean new file mode 100644 index 0000000000..cf450e7d49 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree.lean @@ -0,0 +1,309 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix + +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation5 + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Stable Change Case Three + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open StableChangeCaseThreePreparation + +theorem StableChangeCaseThree {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)))) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + alpha ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) ∧ + beta ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1))) + (z : Sum V E) (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hAprecedes : ∀ u ∈ TreeSequenceVertexSet + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)), + TreeVertexOrder T u (T.vertex (HierarchyFirstMissingPosition phi T alpha))) + (hordered : TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta))) + (hnotStored : + alpha ∉ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) ∧ + beta ∉ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount)) + (hunused : alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, + (HierarchyFirstMissingPosition phi T alpha).val ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition phi T beta).val ∧ + phi (T.edge t) = some c)) : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dnq := HierarchyStoredColorsAt H q + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + (A = Tn ∨ + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, + MaximumProperty ettA) ∧ + (∀ hq : 0 < H.dividerCount, + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, + ∃ baseA : HierarchyBase ettA sigma, + ∃ K : TashkinovHierarchy ettA baseA, + ∃ goodA : GoodHierarchy K, + MaximumProperty ettA ∧ + ∃ hcount : K.dividerCount + 1 = H.dividerCount, + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ j : Fin (K.dividerCount + 2), + K.stage j = H.stage ⟨j.val, by omega⟩) ∧ + (∀ j : Fin (K.dividerCount + 1), + let jH : Fin (H.dividerCount + 1) := + ⟨j.val, by omega⟩ + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt H jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq + (Dnq.biUnion + (C.good.gamma ⟨C.hierarchy.dividerCount - 1, + by omega⟩))) ∧ + (∃ corrT : CorrespondingExtendedTashkinovTree + G k e0 ett sigma T, + MaximumProperty corrT.replacementETT ∧ + ∃ baseT : HierarchyBase corrT.replacementETT sigma, + ∃ K : TashkinovHierarchy corrT.replacementETT baseT, + ∃ goodT : GoodHierarchy K, + SameGoodHierarchy C.good goodT) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let ia := HierarchyFirstMissingPosition phi T alpha + let ib := HierarchyFirstMissingPosition phi T beta + let va := T.vertex ia + let vb := T.vertex ib + let ell := T.length - A.length + let Y := TreeSequencePrefix T (min (A.length + (ell - 1)) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) (Nat.min_le_right _ _) + have segRefl (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + apply helper_segTrans_511 <;> assumption + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + apply helper_commonPrefix_520 <;> assumption + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + induction d with + | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + have equalTrees {S U : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) (hlen : S.length = U.length) : S = U := by + apply helper_equalTrees_536 <;> assumption + have stageToT (j : Fin (H.dividerCount + 2)) : + TreeSequenceInitialSegment (H.stage j) T := by + apply helper_stageToT_552; assumption + have lastZero (hz : H.dividerCount = 0) : A = base.core := by + simp [A, q, HierarchyStarredStage, hz, Fin.last] + have lastPositive (hz : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + apply helper_lastPositive_561; assumption + have coreToA : TreeSequenceInitialSegment base.core A := by + apply helper_coreToA_572 <;> assumption + have TnToCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (base.parallel hp).2.2).leftSegment + · rw [base.nonparallel hp]; exact segRefl _ + have TnToA := segTrans TnToCore coreToA + have AToT : TreeSequenceInitialSegment A T := by + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) + · rw [lastPositive hz]; exact stageToT _ + have ordinaryToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + apply helper_ordinaryToA_589 <;> assumption + have starredToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + exact Fin.cases coreToA (fun i => ordinaryToA i.succ) j + have YToT : TreeSequenceInitialSegment Y T := + ⟨Nat.min_le_right _ _, (by intro i; rfl), (by intro i; rfl)⟩ + have hmissingY : alpha ∈ TreeMissingColors phi Y ∧ beta ∈ TreeMissingColors phi Y := + hmissingPrefix + have hElementaryY : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) := + hprefixElementary + have firstMissing (c : Fin k) (hc : c ∈ TreeMissingColors phi Y) : + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (HierarchyFirstMissingPosition phi T c).val ≤ Y.length := by + apply helper_firstMissing_607 <;> assumption + have firstLe (c : Fin k) (i : Fin (T.length + 1)) + (hc : c ∈ MissingColors G phi (T.vertex i)) : + (HierarchyFirstMissingPosition phi T c).val ≤ i.val := by + apply helper_firstLe_627; assumption + have ha := firstMissing alpha hmissingY.1 + have hb := firstMissing beta hmissingY.2 + have habIndex : ia.val < ib.val := by + obtain ⟨i, j, hi, hj, hij⟩ := hordered + have hei := T.vertex_injective hi + have hej := T.vertex_injective hj + simpa [ia, ib, hei, hej] using hij + have hout : va ∉ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A := by + apply helper_hout_642 <;> assumption + have outsideIndex (i : Fin (T.length + 1)) + (hi : T.vertex i ∉ TreeSequenceVertexSet A) : A.length < i.val := by + apply helper_outsideIndex_658 <;> assumption + have hAia := outsideIndex ia hout.1 + have hAib := outsideIndex ib hout.2 + have AToY : TreeSequenceInitialSegment A Y := commonPrefix AToT YToT (by omega) + have vertexY (i : Fin (T.length + 1)) (hi : i.val ≤ Y.length) : + T.vertex i ∈ TreeSequenceVertexSet Y := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have haY : va ∈ TreeSequenceVertexSet Y := vertexY ia ha.2 + have hbY : vb ∈ TreeSequenceVertexSet Y := vertexY ib hb.2 + have missingNotA (c : Fin k) (i : Fin (T.length + 1)) + (hmi : c ∈ MissingColors G phi (T.vertex i)) + (hiy : T.vertex i ∈ TreeSequenceVertexSet Y) + (hia : T.vertex i ∉ TreeSequenceVertexSet A) : c ∉ TreeMissingColors phi A := by + apply helper_missingNotA_674 <;> assumption + have halphaA : alpha ∉ TreeMissingColors phi A := missingNotA alpha ia ha.1 haY hout.1 + have hbetaA : beta ∉ TreeMissingColors phi A := missingNotA beta ib hb.1 hbY hout.2 + have missingSubset {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U) : + TreeMissingColors phi S ⊆ TreeMissingColors phi U := by + intro c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hSU hv, hcv⟩ + have hDn : alpha ∉ Dn ∧ beta ∉ Dn := by + apply helper_hDn_690 <;> assumption + have notControlled (c : Fin k) (hc : c = alpha ∨ c = beta) : + c ∉ TreeMissingColors phi Tn ∪ Dn := by + intro hm + rcases Finset.mem_union.mp hm with hm | hm + · rcases hc with rfl | rfl + · exact halphaA (missingSubset TnToA hm) + · exact hbetaA (missingSubset TnToA hm) + · rcases hc with rfl | rfl + · exact hDn.1 hm + · exact hDn.2 hm + have storedOrMissing (c : Fin k) (hc : c ∈ ett.series.data.stored n) : + c ∈ TreeMissingColors phi Tn ∪ Dn := by + apply helper_storedOrMissing_706 <;> assumption + -- The route includes the actual connecting seed, not merely a vertex-set extension. + have terminalRoute : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed T ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta) := by + apply helper_terminalRoute_392 <;> assumption + have treeControlled (t : Fin Tn.length) : + phi (Tn.edge t) ≠ some alpha ∧ phi (Tn.edge t) ≠ some beta := by + apply helper_treeControlled_729 <;> assumption + have augmentationControlled (S : TreeSequence G e0) + (hseq : TashkinovAugmentationSequence phi S T) (t : Fin T.length) + (ht : S.length ≤ t.val) (htb : t.val < ib.val) : + phi (T.edge t) ≠ some alpha ∧ phi (T.edge t) ≠ some beta := by + apply helper_augmentationControlled_748 <;> assumption + have prefixControlled (t : Fin T.length) (htb : t.val < ib.val) : + phi (T.edge t) ≠ some alpha ∧ phi (T.edge t) ≠ some beta := by + apply helper_prefixControlled_781 <;> assumption + have horderedUnused : + (alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A) → + TreeVertexOrder T va vb ∧ alpha ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ t.val < ib.val ∧ + phi (T.edge t) = some c) := by + apply helper_horderedUnused_800 <;> assumption + apply helper_continuation_3662 <;> assumption +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean new file mode 100644 index 0000000000..3cc29f554b --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean @@ -0,0 +1,2274 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# StableChangeCaseThree: supporting constructions, part 1 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.StableChangeCaseThreePreparation + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperPrefixMaximum1187Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → S.length ≤ U.length → TreeSequenceInitialSegment S U) → + (∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S U → S.length = U.length → S = U) → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + A.length < (↑ib : ℕ) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed T ∧ phi f ≠ some alpha ∧ phi f ≠ some beta) → + ModColoring ett sigma → + (∀ (S U : TreeSequence G e0), + TashkinovAugmentationSequence phi S U → + TreeSequenceInitialSegment U T → + U.length ≤ (↑ib : ℕ) → TashkinovAugmentationSequence sigma S U) → + A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA A sigma), MaximumProperty ettA + +theorem helper_terminalRoute_392.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) + (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + (∀ (c : Fin k), c = alpha ∨ c = beta → c ∉ TreeMissingColors phi Tn ∪ Dn) → + (∀ c ∈ ett.series.data.stored n, c ∈ TreeMissingColors phi Tn ∪ Dn) → + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed T ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta n Tn Dn commonPrefix notControlled + storedOrMissing + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => have hv := congrArg Fin.val hi; simp [n] at hv; have := C.positive; omega + | SE j _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedT : TreeSequenceInitialSegment seed T := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + ett.belowFinal (by + have hl := adjoin.1; rw [hj] at hl + change seed.length = Tn.length + 1 at hl + have hs := ett.strictAbovePenultimate + change Tn.length < T.length at hs + omega) + have hcol : phi choice.edge = some choice.color := by + have hg : phi = choice.selected := by + simpa only [← hj, coloring, n] using ett.generatingColoring + simpa only [hg] using choice.edgeColor + have hc : choice.color ∈ ett.series.data.stored n := by rw [← hj, stored]; simp + have hnot (c : Fin k) (he : c = alpha ∨ c = beta) : phi choice.edge ≠ some c := by + intro hc' + have heq := Option.some.inj (hcol.symm.trans hc') + exact notControlled c he (heq ▸ storedOrMissing choice.color hc) + exact Or.inr ⟨Or.inl (by simpa [hj] using kind), choice.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + TashkinovAugmentationSequenceRestrict phi seed T _ hroute hseedT ett.belowFinal, + hnot alpha (Or.inl rfl), hnot beta (Or.inr rfl)⟩ + | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + refine Or.inl ⟨by simpa [hj] using kind, ?_⟩ + apply TashkinovAugmentationSequenceRestrict phi Tn T _ _ ett.abovePenultimate ett.belowFinal + simpa [Tn, hj, hlast, ← ett.generatingColoring, n] using closure.1 + | RE j _ _ _ _ available coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedT : TreeSequenceInitialSegment seed T := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + ett.belowFinal (by + have hl := adjoin.1; rw [hj] at hl + change seed.length = Tn.length + 1 at hl + have hs := ett.strictAbovePenultimate + change Tn.length < T.length at hs + omega) + have hcol : phi available.edge = some available.gamma ∨ + phi available.edge = some available.delta := by + have hg : phi = ett.series.data.coloring j.castSucc := by + simpa only [← hj, coloring, n] using ett.generatingColoring + simp only [hg] + have hadj := available.returnPath.adj_snd + (SimpleGraph.Walk.not_nil_of_ne (by intro he; cases he)) + cases hh : available.returnPath.snd with + | inl v => + have hc : (TwoColorIncidenceGraph G (ett.series.data.coloring j.castSucc) + available.gamma available.delta).Adj (Sum.inr available.edge) (Sum.inl v) := + hh ▸ hadj + exact hc.2 + | inr f => + have hc : (TwoColorIncidenceGraph G (ett.series.data.coloring j.castSucc) + available.gamma available.delta).Adj (Sum.inr available.edge) (Sum.inr f) := + hh ▸ hadj + exact False.elim hc + have hcontrol : ∃ c, phi available.edge = some c ∧ + c ∈ TreeMissingColors phi Tn ∪ Dn := by + rcases hcol with h | h + · exact ⟨available.gamma, h, storedOrMissing _ (by rw [← hj, stored]; simp)⟩ + · exact ⟨available.delta, h, storedOrMissing _ (by rw [← hj, stored]; simp)⟩ + have hnot (c : Fin k) (he : c = alpha ∨ c = beta) : phi available.edge ≠ some c := by + intro hc' + obtain ⟨d, hd, hdmem⟩ := hcontrol + have heq := Option.some.inj (hd.symm.trans hc') + exact notControlled c he (heq ▸ hdmem) + exact Or.inr ⟨Or.inr (by simpa [hj] using kind), available.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + TashkinovAugmentationSequenceRestrict phi seed T _ hroute hseedT ett.belowFinal, + hnot alpha (Or.inl rfl), hnot beta (Or.inr rfl)⟩ + +theorem helper_missingA_629.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + ∀ (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + alpha ∉ TreeMissingColors phi A → + beta ∉ TreeMissingColors phi A → + (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta z; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta z; + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → + (∀ (v : V) (c : Fin k), + c ≠ alpha → c ≠ beta → (c ∈ MissingColors G sigma v ↔ c ∈ MissingColors G phi v)) → + ∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne z sigma hsigma H q A halphaA + hbetaA behavior missingUnaffected v hv + by_cases hvQ : Sum.inl v ∈ TwoColorComponent G phi alpha beta z + · have han : alpha ∉ MissingColors G phi v := fun hc => + halphaA (Finset.mem_biUnion.mpr ⟨v, hv, hc⟩) + have hbn : beta ∉ MissingColors G phi v := fun hc => + hbetaA (Finset.mem_biUnion.mpr ⟨v, hv, hc⟩) + have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by + simpa [MissingColors, PresentColors] using han + have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by + simpa [MissingColors, PresentColors] using hbn + obtain ⟨fa, hfa, hfca⟩ := hpa + obtain ⟨fb, hfb, hfcb⟩ := hpb + have edgeOfVertex {f : E} (hf : Incident G v f) + (hc : phi f = some alpha ∨ phi f = some beta) : + Sum.inr f ∈ TwoColorComponent G phi alpha beta z := by + have hadj : (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inr f) (Sum.inl v) := + ⟨hf, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hvQ + have hnewa : sigma fb = some alpha := by + rw [hsigma] + simp [TwoColorComponentSwap, edgeOfVertex hfb (Or.inr hfcb), hfcb, hne.symm] + have hnewb : sigma fa = some beta := by + rw [hsigma] + simp [TwoColorComponentSwap, edgeOfVertex hfa (Or.inl hfca), hfca] + have hana : alpha ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fb, hfb, hnewa⟩ + have hbnb : beta ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fa, hfa, hnewb⟩ + ext c + by_cases hca : c = alpha + · subst c; simp [hana, han] + · by_cases hcb : c = beta + · subst c; simp [hbnb, hbn] + · exact missingUnaffected v c hca hcb + · rw [hsigma] + exact behavior.1 v hvQ + +theorem helper_corrData_806.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha _ : Fin k) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ell : ℕ := T.length - A.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + TreeSequenceInitialSegment Tn A → + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma H q A n Tn Dn ell Y TnToA ha + treeMissingEq corr + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have hs : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases hs + let a : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have ha : a.succ = Fin.last ett.rounds := by + apply Fin.ext + change ett.rounds - 1 + 1 = ett.rounds + have := ett.roundsPositive + omega + have ht : replacementSeries.data.tree (Fin.last ett.rounds).castSucc = Tn := by + change replacementSeries.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc + rw [← ha] + exact ladderTreesAgree a + have hm : TreeMissingColors (replacementSeries.data.coloring (Fin.last ett.rounds)) + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi Tn := by + rw [← finalGeneratingColoring, ht] + exact treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) + have hmOld : TreeMissingColors (ett.series.data.coloring (Fin.last ett.rounds)) + (ett.series.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi Tn := by + rw [← ett.generatingColoring] + refine ⟨ht, extensionKindsAgree (Fin.last ett.rounds), ?_⟩ + change TashkinovStoredColors replacementSeries.data (Fin.last ett.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) + simp only [TashkinovStoredColors, storedColorsAgree, hm, hmOld] + +theorem helper_fullBase_847.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (beta : Fin k) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ell : ℕ := T.length - A.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi sigma) → + ModColoring ett sigma → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed T) → + (∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corr.replacementETT ∧ + ∃ (baseT : HierarchyBase corr.replacementETT sigma), + baseT.core = base.core ∧ + baseT.closure = base.closure := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower beta sigma H q A n Tn Dn + ell Y hb sigmaProper sigmaOne combined hmod sigmaRoute corrData + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · have hb : TashkinovAugmentationSequence sigma Tn T := by + rcases sigmaRoute with ⟨_, hseq⟩ | ⟨hk, rest⟩ + · exact hseq + · rcases hk with hk | hk <;> rw [hp] at hk <;> cases hk + obtain ⟨corr, hMP, baseT, K0, hsame⟩ := HierarchySplitter G k e0 input T phi sigma + ett C.maximum C.positive hlower base H hp hproper hone sigmaProper sigmaOne (combined hp) hb + exact ⟨corr, hMP, baseT, hsame.1.symm, (hsame.2.2.2.2.2 hp).symm⟩ + · obtain ⟨corr⟩ := hmod.2.2 T ett.abovePenultimate ett.strictAbovePenultimate sigmaRoute + have hd := corrData corr + let pos : Fin ((corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc).length + 1) := + Fin.cast (congrArg (fun W : TreeSequence G e0 => W.length + 1) hd.1.symm) + base.supportPosition + let baseT : HierarchyBase corr.replacementETT sigma := { + core := base.core + closure := base.closure + supportPosition := pos + supportPositive := by simpa [pos] using base.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only + intro hPE + exact False.elim (hp (hd.2.1.symm.trans hPE)) + nonparallel := by + dsimp only + intro _ + exact (base.nonparallel hp).trans hd.1.symm } + exact ⟨corr, MaximumPropertyTransport G k e0 ett sigma hmod T corr C.maximum, + baseT, rfl, rfl⟩ + +theorem helper_segTrans_511.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W := by + classical + intro V E G e0 S U W hSU hUW + refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + +theorem helper_commonPrefix_520.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U := by + classical + intro V E G e0 S U W hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +theorem helper_equalTrees_536.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → S.length = U.length → S = U := by + classical + intro V E G e0 S U hSU hlen + cases S with + | mk ls ps vs es vis eis fs aas => + cases U with + | mk lu pu vu eu viu eiu fu aau => + simp only at hlen + subst lu + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.1 i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.2 i).symm + +theorem helper_stageToT_552.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (H.stage j) T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H stageSegment j + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) + simpa [he, H.terminalStage] using hs + +theorem helper_lastPositive_561.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hz + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm + +theorem helper_coreToA_572.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment base.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A segRefl segTrans stageSegment lastZero + lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz]; exact segRefl _ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + +theorem helper_ordinaryToA_589.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment Tn A → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n Tn stageSegment lastPositive TnToA j + by_cases hz : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) + rw [hj, H.baseStage]; exact TnToA + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + rw [lastPositive hz] + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> + simp only [Fin.val_castSucc]; omega + +theorem helper_firstMissing_607.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + TreeSequenceInitialSegment Y T → + ∀ c ∈ TreeMissingColors phi Y, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell Y YToT c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let it := Fin.castLE (Nat.succ_le_succ YToT.1) i + have hci : c ∈ MissingColors G phi (T.vertex it) := by + rw [YToT.2.1 i, hi]; exact hcv + let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) + have hit : it ∈ candidates := by simp [candidates, hci] + have hnon : candidates.Nonempty := ⟨it, hit⟩ + have hmem := Finset.min'_mem candidates hnon + have hle := Finset.min'_le candidates it hit + refine ⟨?_, ?_⟩ + · simpa [HierarchyFirstMissingPosition, candidates, hnon] using + (Finset.mem_filter.mp hmem).2 + · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt + have hval : (candidates.min' hnon).val ≤ it.val := hle + simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv + +theorem helper_firstLe_627.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ G k e0 T phi c i hc + let _ := Fintype.ofFinite V + let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) + have hi : i ∈ candidates := by simp [candidates, hc] + have hn : candidates.Nonempty := ⟨i, hi⟩ + simpa [HierarchyFirstMissingPosition, candidates, hn] using + (Finset.min'_le candidates i hi) + +theorem helper_hout_642.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + ∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u va) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + (↑ia : ℕ) < (↑ib : ℕ) → + va ∉ TreeSequenceVertexSet A ∧ + vb ∉ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hAprecedes H q A ia ib va vb habIndex + constructor + · intro hv + obtain ⟨i, j, hi, hj, hij⟩ := hAprecedes va hv + have he := T.vertex_injective (hi.trans hj.symm) + have hv := congrArg Fin.val he + omega + · intro hv + obtain ⟨i, j, hi, hj, hij⟩ := hAprecedes vb hv + have hei := T.vertex_injective hi + have hej := T.vertex_injective hj + have hvi := congrArg Fin.val hei + have hvj := congrArg Fin.val hej + change i.val = ib.val at hvi + change j.val = ia.val at hvj + omega + +theorem helper_outsideIndex_658.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ _ : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + ∀ (i : Fin (T.length + (1 : ℕ))), + T.vertex i ∉ TreeSequenceVertexSet A → + A.length < (↑i : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A AToT i hi + by_contra h + have hle : i.val ≤ A.length := by omega + apply hi + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ + +theorem helper_missingNotA_674.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + TreeSequenceInitialSegment A Y → + ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ell Y hElementaryY AToY c + i hmi hiy hia hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) + exact (Finset.disjoint_left.mp + (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi + +theorem helper_hDn_690.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + alpha ∉ Dnq ∧ beta ∉ Dnq) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + alpha ∉ TreeMissingColors phi A → + beta ∉ TreeMissingColors phi A → + alpha ∉ Dn ∧ + beta ∉ Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hnotStored H q A n Dn halphaA hbetaA + constructor + · intro hc + exact hnotStored.1 (Finset.mem_sdiff.mpr ⟨hc, halphaA⟩) + · intro hc + exact hnotStored.2 (Finset.mem_sdiff.mpr ⟨hc, hbetaA⟩) + +theorem helper_storedOrMissing_706.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) + (_ _ : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ c ∈ ett.series.data.stored n, + c ∈ TreeMissingColors phi Tn ∪ Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta n Tn Dn c hc + by_cases hm : c ∈ TreeMissingColors phi Tn + · exact Finset.mem_union_left _ hm + · apply Finset.mem_union_right + unfold Dn TashkinovStoredColors + have hn : n.val ≠ 0 := by dsimp [n]; have := C.positive; omega + simp only [ite_eq_right hn] + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · exact Finset.mem_biUnion.mpr ⟨n, Finset.mem_univ _, by simp [hc]⟩ + · have hg : ett.series.data.coloring n = phi := ett.generatingColoring.symm + simpa only [hg, Tn] using hm + +theorem helper_treeControlled_729.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base), + IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (∀ (c : Fin k), c = alpha ∨ c = beta → c ∉ TreeMissingColors phi Tn ∪ Dn) → + ∀ (t : Fin Tn.length), + phi (Tn.edge t) ≠ some alpha ∧ + phi (Tn.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta n Tn Dn notControlled t + by_cases ht : t.val = 0 + · have he : Tn.edge t = e0 := by + rw [show t = ⟨0, Tn.positive⟩ from Fin.ext ht]; exact Tn.first_edge + simp [he, hone.1] + · let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have hused (c : Fin k) (hc : phi (Tn.edge t) = some c) : + c ∈ TreeMissingColors phi Tn ∪ Dn := by + have hu : c ∈ TreeUsedColors (ett.series.data.coloring j.succ) + (ett.series.data.tree j.succ.castSucc) := by + simp only [hj, ← ett.generatingColoring, n] + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨t, by omega, hc⟩ + simpa [hj, ← ett.generatingColoring, Tn, Dn, n] using + (HkuTreeColorsControlled G k ett.rounds e0 input ett.series j).2.1 hu + exact ⟨fun hc => notControlled alpha (Or.inl rfl) (hused alpha hc), + fun hc => notControlled beta (Or.inr rfl) (hused beta hc)⟩ + +theorem helper_augmentationControlled_748.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) + (alpha beta : Fin k), + (let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (↑ia : ℕ) ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))) → + let _ : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ (↑i : ℕ)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S T → + ∀ (t : Fin T.length), + S.length ≤ (↑t : ℕ) → + (↑t : ℕ) < (↑ib : ℕ) → + phi (T.edge t) ≠ some alpha ∧ + phi (T.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hunused ia ib firstLe S hseq t ht htb + have hstep := (TashkinovAugmentationSequencePosition phi S T hseq t ht).1 + obtain ⟨hl, hinit, c, hcol, hm⟩ := hstep + have hcolT : phi (T.edge t) = some c := by + convert hcol using 1; congr 2 + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨iv, hiv⟩ := hv + let ivT : Fin (T.length + 1) := ⟨iv.val, by + have := iv.isLt; change iv.val < t.val + 1 at this; omega⟩ + have hcvT : c ∈ MissingColors G phi (T.vertex ivT) := by + have he : (TreeSequencePrefix T t.val (le_trans S.positive ht) + (Nat.le_of_lt t.isLt)).vertex iv = T.vertex ivT := rfl + rw [← he, hiv]; exact hcv + have hiv : ivT.val ≤ t.val := Nat.le_of_lt_succ iv.isLt + have hnotAlpha : c ≠ alpha := by + intro he; subst c + by_cases hta : t.val < ia.val + · have hle := firstLe alpha ivT hcvT + change ia.val ≤ ivT.val at hle + omega + · apply hunused + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, by omega, htb, hcolT⟩ + have hnotBeta : c ≠ beta := by + intro he; subst c + have hle := firstLe beta ivT hcvT + change ib.val ≤ ivT.val at hle + omega + exact ⟨fun he => hnotAlpha (Option.some.inj (hcolT.symm.trans he)), + fun he => hnotBeta (Option.some.inj (hcolT.symm.trans he))⟩ + +theorem helper_prefixControlled_781.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) + (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed T ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta) → + (∀ (t : Fin Tn.length), phi (Tn.edge t) ≠ some alpha ∧ phi (Tn.edge t) ≠ some beta) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S T → + ∀ (t : Fin T.length), + S.length ≤ (↑t : ℕ) → + (↑t : ℕ) < (↑ib : ℕ) → + phi (T.edge t) ≠ some alpha ∧ phi (T.edge t) ≠ some beta) → + ∀ (t : Fin T.length), + (↑t : ℕ) < (↑ib : ℕ) → + phi (T.edge t) ≠ some alpha ∧ + phi (T.edge t) ≠ some beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta n Tn ib terminalRoute treeControlled + augmentationControlled t htb + by_cases htn : t.val < Tn.length + · let tn : Fin Tn.length := ⟨t.val, htn⟩ + have he : Fin.castLE ett.abovePenultimate.1 tn = t := Fin.ext rfl + rw [← he, ett.abovePenultimate.2.2 tn] + exact treeControlled tn + · rcases terminalRoute with ⟨hkind, hseq⟩ | ⟨hkind, f, seed, hedges, hseed, hseq, hfa, hfb⟩ + · exact augmentationControlled Tn hseq t (by omega) htb + · by_cases htseed : t.val < seed.length + · have ht : t.val = Tn.length := by have := hseed.1; omega + have hs := TashkinovAugmentationSequenceInitialSegment phi seed T hseq + let ts : Fin seed.length := ⟨t.val, htseed⟩ + have he : Fin.castLE hs.1 ts = t := Fin.ext rfl + rw [← he, hs.2.2 ts] + have hlast : ts = Fin.cast hseed.1.symm (Fin.last Tn.length) := Fin.ext ht + rw [hlast, hseed.2.2] + exact ⟨hfa, hfb⟩ + · exact augmentationControlled seed hseq t (by omega) htb + +theorem helper_horderedUnused_800.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + (let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + TreeVertexOrder T va vb) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + (∀ (t : Fin T.length), + (↑t : ℕ) < (↑ib : ℕ) → phi (T.edge t) ≠ some alpha ∧ phi (T.edge t) ≠ some beta) → + alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A → + TreeVertexOrder T va vb ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hordered H q A ia ib va vb + prefixControlled _ + refine ⟨hordered, ?_⟩ + intro hc + obtain ⟨_, t, hlo, hhi, hcol⟩ := Finset.mem_filter.mp hc + exact (prefixControlled t hhi).1 hcol + +theorem helper_unaffected_835.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), + alpha ≠ beta → + ∀ (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) + T.length) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + ∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne z sigma hsigma H q A ell Y ha hb + f c hca hcb + rw [hsigma] + by_cases hf : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · by_cases ha : phi f = some alpha + · simp [TwoColorComponentSwap, hf, ha, hca.symm, hcb.symm] + · by_cases hb : phi f = some beta + · simp [TwoColorComponentSwap, hf, hb, hne.symm, hca.symm, hcb.symm] + · simp [TwoColorComponentSwap, hf, ha, hb] + · simp [TwoColorComponentSwap, hf] + +theorem helper_sigmaOne_852.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta hne z sigma hsigma H q A ell Y + ha hb unaffected + refine ⟨?_, ?_⟩ + · rw [hsigma]; simp [TwoColorComponentSwap, hone.1] + · intro f hf + obtain ⟨c, hc⟩ := hone.2 f hf + by_cases ha : c = alpha + · subst c + by_cases hQ : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · exact ⟨beta, by rw [hsigma]; simp [TwoColorComponentSwap, hQ, hc]⟩ + · exact ⟨alpha, by rw [hsigma]; simp [TwoColorComponentSwap, hQ, hc]⟩ + · by_cases hb : c = beta + · subst c + by_cases hQ : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · exact ⟨alpha, by rw [hsigma]; simp [TwoColorComponentSwap, hQ, hc, hne.symm]⟩ + · exact ⟨beta, by rw [hsigma]; simp [TwoColorComponentSwap, hQ, hc]⟩ + · exact ⟨c, (unaffected f c ha hb).mpr hc⟩ + +theorem helper_stable_876.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + alpha ∉ TreeMissingColors phi A → + beta ∉ TreeMissingColors phi A → + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (D : Finset (Fin k)), + alpha ∉ D ∧ beta ∉ D → + StableColoring S D phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma H q A halphaA hbetaA + unaffected missingA S hS D hD + refine ⟨?_, fun v hv => missingA v (hS hv)⟩ + intro f hf hcontrol + obtain ⟨c, hc, hcol⟩ := hcontrol + have hnot (d : Fin k) (hdA : d ∉ TreeMissingColors phi A) (hdD : d ∉ D) : c ≠ d := by + intro he; subst c + rcases Finset.mem_union.mp hc with hm | hm + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + exact hdA (Finset.mem_biUnion.mpr ⟨v, hS hv, hcv⟩) + · exact hdD hm + exact ((unaffected f c (hnot alpha halphaA hD.1) + (hnot beta hbetaA hD.2)).mpr hcol).trans hcol.symm + +theorem helper_closureInsideA_893.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + TreeSequenceInitialSegment base.core A → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n coreToA hPE + have ordered := Classical.choice (base.parallel hPE).2.2 + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [ordered.vertexSet] + exact Finset.mem_union_right _ hv + +theorem helper_invariant_903.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + TreeSequenceInitialSegment A T → + (↑ia : ℕ) < (↑ib : ℕ) → + A.length < (↑ia : ℕ) → + (∀ (t : Fin T.length), + (↑t : ℕ) < (↑ib : ℕ) → phi (T.edge t) ≠ some alpha ∧ phi (T.edge t) ≠ some beta) → + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + TreeColoringInvariant S phi sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma H q A ia ib segTrans AToT + habIndex hAia prefixControlled fixedValue missingA S hSA + refine ⟨?_, fun v hv => missingA v (TreeSequenceInitialSegmentVertexSetSubset hSA hv)⟩ + intro t ht + have hST := segTrans hSA AToT + have hc := prefixControlled (Fin.castLE hST.1 t) (by + have := t.isLt; have := hSA.1; simp only [Fin.val_castLE]; omega) + rw [hST.2.2 t] at hc + exact fixedValue _ hc.1 hc.2 + +theorem helper_weak_912.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + StableColoring Tn Dn phi sigma → + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi sigma) → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → TreeColoringInvariant S phi sigma) → + HierarchyWeaklyStable H q sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn Dn ordinaryToA stableTn + combined invariant + have bs : (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma else StableColoring Tn Dn phi sigma) := by + split + · rename_i hp; exact combined hp + · exact stableTn + have allWeak (j : Fin (H.dividerCount + 1)) : HierarchyWeaklyStable H j sigma := by + refine Fin.cases bs (fun i => ⟨bs, invariant _ (ordinaryToA i.succ)⟩) j + exact allWeak q + +theorem helper_together_938.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (z : V ⊕ E), + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + TwoColorComponent G phi alpha beta (Sum.inl va) = TwoColorComponent G phi alpha beta + (Sum.inl vb) → + (Sum.inl va ∈ TwoColorComponent G phi alpha beta z ↔ Sum.inl vb ∈ TwoColorComponent G phi + alpha beta z) := by + classical + intro V E _ _ G k e0 T phi alpha beta z ia ib va vb sameComponent + let _ := Fintype.ofFinite V + have hab : Sum.inl va ∈ TwoColorComponent G phi alpha beta (Sum.inl vb) := by + rw [← sameComponent]; exact rfl + change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk (Sum.inl va) = + (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk (Sum.inl vb) at hab + change (_ = _) ↔ (_ = _) + rw [hab] + +theorem helper_bothMissingB_946.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + ∀ (hAib : A.length < (↑ib : ℕ)), + (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta z; + have phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta z; + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + va ∈ TreeSequenceVertexSet B → + vb ∈ TreeSequenceVertexSet B → + (Sum.inl va ∈ TwoColorComponent G phi alpha beta z ↔ + Sum.inl vb ∈ TwoColorComponent G phi alpha beta z) → + alpha ∈ TreeMissingColors sigma B ∧ + beta ∈ TreeMissingColors sigma B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta z sigma hsigma H q A ia ib va vb ell + Y ha hb hAib behavior B haB hbB together + by_cases hva : Sum.inl va ∈ TwoColorComponent G phi alpha beta z + · have hvb := together.mp hva + constructor + · exact Finset.mem_biUnion.mpr ⟨vb, hbB, by + rw [hsigma]; exact behavior.2.2.1 vb hvb hb.1⟩ + · exact Finset.mem_biUnion.mpr ⟨va, haB, by + rw [hsigma]; exact behavior.2.1 va hva ha.1⟩ + · have hvb : Sum.inl vb ∉ TwoColorComponent G phi alpha beta z := fun h => hva (together.mpr h) + constructor + · exact Finset.mem_biUnion.mpr ⟨va, haB, by rw [hsigma, behavior.1 va hva]; exact ha.1⟩ + · exact Finset.mem_biUnion.mpr ⟨vb, hbB, by rw [hsigma, behavior.1 vb hvb]; exact hb.1⟩ + +theorem helper_transportBefore_958.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (t : Fin T.length), + (↑t : ℕ) < (↑ib : ℕ) → phi (T.edge t) ≠ some alpha ∧ phi (T.edge t) ≠ some beta) → + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + (∀ (v : V) (c : Fin k), + c ≠ alpha → c ≠ beta → (c ∈ MissingColors G sigma v ↔ c ∈ MissingColors G phi v)) → + ∀ (S U : TreeSequence G e0), + TashkinovAugmentationSequence phi S U → + TreeSequenceInitialSegment U T → + U.length ≤ (↑ib : ℕ) → + TashkinovAugmentationSequence sigma S U := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma ib segTrans prefixControlled + unaffected missingUnaffected S U hseq hUT hU + unfold TashkinovAugmentationSequence at hseq ⊢ + induction hseq with + | refl => exact Relation.ReflTransGen.refl + | @tail U W hSU hUW ih => + have hlen := hUW.1 + have hinit := hUW.2.1 + obtain ⟨c, hcol, hm⟩ := hUW.2.2 + let t := Fin.cast hlen.symm (Fin.last U.length) + let tt := Fin.castLE hUT.1 t + have hct := prefixControlled tt (by + change U.length < ib.val; have := hU; omega) + rw [hUT.2.2 t] at hct + have hca : c ≠ alpha := by intro he; subst c; exact hct.1 hcol + have hcb : c ≠ beta := by intro he; subst c; exact hct.2 hcol + have hm' : c ∈ TreeMissingColors sigma U := by + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + exact Finset.mem_biUnion.mpr ⟨v, hv, (missingUnaffected v c hca hcb).mpr hcv⟩ + exact Relation.ReflTransGen.tail (ih (segTrans hinit hUT) (by omega)) + ⟨hlen, hinit, c, (unaffected _ c hca hcb).mpr hcol, hm'⟩ + +theorem helper_transportRoute_981.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + ∀ (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment B T → + alpha ∈ TreeMissingColors sigma B ∧ beta ∈ TreeMissingColors sigma B → + (∀ (S U : TreeSequence G e0), + TashkinovAugmentationSequence phi S U → + TreeSequenceInitialSegment U T → + U.length ≤ (↑ib : ℕ) → TashkinovAugmentationSequence sigma S U) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S T → + TreeSequenceInitialSegment S B → + TashkinovAugmentationSequence sigma S T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne z sigma hsigma H q A ib hAib B + BToT bothMissingB transportBefore S hseq hSB + have hpre := TashkinovAugmentationSequenceRestrict phi S B T hseq hSB BToT + have hsuf := TashkinovAugmentationSequenceSuffix phi S B T hseq hSB BToT + have hpreSigma := transportBefore S B hpre BToT le_rfl + have hsufSigma : TashkinovAugmentationSequence sigma B T := by + rw [hsigma] at bothMissingB ⊢ + exact TashkinovAugmentationSequenceComponentSwap G k e0 phi alpha beta hne z + B T hsuf bothMissingB.1 bothMissingB.2 + exact hpreSigma.trans hsufSigma + +theorem helper_sigmaRoute_993.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + TreeSequenceInitialSegment Tn A → + (↑ia : ℕ) < (↑ib : ℕ) → + A.length < (↑ia : ℕ) → + ∀ (hAib : A.length < (↑ib : ℕ)), + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed T ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A B → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S T → + TreeSequenceInitialSegment S B → TashkinovAugmentationSequence sigma S T) → + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma H q A n Tn ia ib segTrans + commonPrefix TnToA habIndex hAia hAib terminalRoute B BToT AToB transportRoute + rcases terminalRoute with ⟨hp, hseq⟩ | ⟨hp, f, seed, hedges, hseed, hseq, hfa, hfb⟩ + · exact Or.inl ⟨hp, transportRoute Tn hseq (segTrans TnToA AToB)⟩ + · have hseedB : TreeSequenceInitialSegment seed B := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hseq) BToT + (by have := hseed.1; have := TnToA.1; change _ ≤ ib.val; omega) + exact Or.inr ⟨hp, f, seed, hedges, hseed, transportRoute seed hseq hseedB⟩ + +theorem helper_stageMissingEq_1044.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [inst_2 : DecidableEq V] [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + TreeSequenceInitialSegment Tn A → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + @Eq.mpr + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 + G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G + k e0 input T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 + input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi + base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 + input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@id + (@Eq Prop + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k + e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett + phi base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k + e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega))))) + (@congrArg (@TreeSequence V E G e0) Prop + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 + G k e0 input T phi ett sigma T corrT) + sigma baseT) + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett + phi base) + (fun (_a : @TreeSequence V E G e0) ↦ + @TreeSequenceInitialSegment V E G e0 _a + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G + k e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + hcoreT)) + (@TashkinovHierarchy.coreInsideFirst V E inst inst_1 inst_2 inst_3 G k e0 input + T phi phi ett base H) : + TashkinovHierarchy corrT.replacementETT baseT }; + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn Dn TnToA ordinaryToA + treeMissingEq corrT baseT hcoreT terminalData K j + refine Fin.cases ?_ (fun a => ?_) j + · change TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + rw [terminalData.1] + exact treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) + · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA a.succ)) + +theorem helper_firstEq_1065.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), + (∀ (v : V) (c : Fin k), + c ≠ alpha → c ≠ beta → (c ∈ MissingColors G sigma v ↔ c ∈ MissingColors G phi v)) → + ∀ (c : Fin k), + c ≠ alpha → + c ≠ beta → + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition phi T c := by + classical + intro V E _ _ G k e0 T phi alpha beta sigma missingUnaffected c hca hcb + let _ := Fintype.ofFinite V + have hsets : + (Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G sigma (T.vertex j)) = + (Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G phi (T.vertex j)) := by + ext j + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact missingUnaffected _ c hca hcb + unfold HierarchyFirstMissingPosition + rw [hsets] + +theorem helper_segmentTransfer_1077.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [inst_2 : DecidableEq V] [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + @Eq.mpr + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 + G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G + k e0 input T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 + input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi + base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 + input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@id + (@Eq Prop + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k + e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett + phi base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k + e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega))))) + (@congrArg (@TreeSequence V E G e0) Prop + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 + G k e0 input T phi ett sigma T corrT) + sigma baseT) + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett + phi base) + (fun (_a : @TreeSequence V E G e0) ↦ + @TreeSequenceInitialSegment V E G e0 _a + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G + k e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + hcoreT)) + (@TashkinovHierarchy.coreInsideFirst V E inst inst_1 inst_2 inst_3 G k e0 input + T phi phi ett base H) : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, eta ≠ alpha ∧ eta ≠ beta) → + (∀ (c : Fin k), + c ≠ alpha → + c ≠ beta → + HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition phi T c) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, + ∀ (c : Fin k), + c ≠ alpha → + c ≠ beta → + c ∈ HierarchySegmentColors K j eta → + c ∈ HierarchySegmentColors H j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma H n Tn Dn unaffected corrT + baseT hcoreT terminalData K starredEq ownerNot firstEq j eta heta c hca hcb hc + unfold HierarchySegmentColors at hc ⊢ + dsimp only at hc ⊢ + rw [starredEq j, firstEq eta (ownerNot j eta heta).1 (ownerNot j eta heta).2] at hc + obtain ⟨_, t, hlo, hhi, hcol⟩ := Finset.mem_filter.mp hc + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, hhi, + (unaffected _ c hca hcb).mp hcol⟩ + +theorem helper_minusEq_1094.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + alpha ∉ TreeMissingColors phi A → + beta ∉ TreeMissingColors phi A → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (∀ (S : TreeSequence G e0) (c : Fin k), + c ≠ alpha → + c ≠ beta → + BoundaryColorEdges G sigma (TreeSequenceVertexSet S) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet S) c) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma S R ↔ TreeColorSetMinusClosed G phi S R := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma H q A halphaA hbetaA + treeMissingEq boundaryEq S hS R + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [treeMissingEq S hS] + have hnot (c : Fin k) (hc : c ∈ TreeMissingColors phi S) : c ≠ alpha ∧ c ≠ beta := by + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hm := Finset.mem_biUnion.mpr ⟨v, hS hv, hcv⟩ + exact ⟨fun he => halphaA (he ▸ hm), fun he => hbetaA (he ▸ hm)⟩ + constructor <;> intro h c hc + · have hh := h c hc + rw [boundaryEq S c (hnot c (Finset.mem_sdiff.mp hc).1).1 + (hnot c (Finset.mem_sdiff.mp hc).1).2] at hh + exact hh + · rw [boundaryEq S c (hnot c (Finset.mem_sdiff.mp hc).1).1 + (hnot c (Finset.mem_sdiff.mp hc).1).2] + exact h c hc + +theorem helper_branch_1161.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [inst_2 : DecidableEq V] [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + TreeSequenceInitialSegment base.core A → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + @Eq.mpr + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 + G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G + k e0 input T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 + input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi + base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 + input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@id + (@Eq Prop + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k + e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett + phi base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k + e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega))))) + (@congrArg (@TreeSequence V E G e0) Prop + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 + G k e0 input T phi ett sigma T corrT) + sigma baseT) + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett + phi base) + (fun (_a : @TreeSequence V E G e0) ↦ + @TreeSequenceInitialSegment V E G e0 _a + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G + k e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + hcoreT)) + (@TashkinovHierarchy.coreInsideFirst V E inst inst_1 inst_2 inst_3 G k e0 input + T phi phi ett base H) : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma S R ↔ TreeColorSetMinusClosed G phi S R) → + ¬TreeColorSetMinusClosed G phi base.core + ((HierarchyStoredColorsAt C.hierarchy + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))) → + ¬TreeColorSetMinusClosed G sigma baseT.core + ((HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (K.dividerCount + (1 : ℕ))))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn Dn coreToA corrT baseT hcoreT + terminalData K storedEq minusEq hnot + change ¬ TreeColorSetMinusClosed G sigma baseT.core + ((HierarchyStoredColorsAt K 0).biUnion (C.good.gamma 0)) + rw [hcoreT, storedEq 0, + minusEq base.core (TreeSequenceInitialSegmentVertexSetSubset coreToA)] + exact hnot + +theorem helper_branch_1166.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] + [inst_2 : DecidableEq V] [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + TreeSequenceInitialSegment Tn A → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core), + baseT.closure = base.closure → + ∀ + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + @Eq.mpr + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 + G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G + k e0 input T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 + input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi + base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 + input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@id + (@Eq Prop + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k + e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett + phi base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k + e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega))))) + (@congrArg (@TreeSequence V E G e0) Prop + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 + inst_3 G k e0 input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 + G k e0 input T phi ett sigma T corrT) + sigma baseT) + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett + phi base) + (fun (_a : @TreeSequence V E G e0) ↦ + @TreeSequenceInitialSegment V E G e0 _a + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G + k e0 input T phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + hcoreT)) + (@TashkinovHierarchy.coreInsideFirst V E inst inst_1 inst_2 inst_3 G k e0 input + T phi phi ett base H) : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + (4 : ℕ) ≤ + ((TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors phi base.closure : + Finset (Fin k)) \ + (HierarchyStoredColorsAt C.hierarchy + (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card → + (4 : ℕ) ≤ + ((TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseT.closure : + Finset (Fin k)) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (K.dividerCount + (1 : ℕ))))).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn Dn TnToA treeMissingEq + closureInsideA corrT baseT hcoreT hclosureT terminalData K storedEq hpOld hcard + change 4 ≤ ((TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseT.closure) \ + (HierarchyStoredColorsAt K 0).biUnion (C.good.gamma 0)).card + rw [terminalData.1, hclosureT, storedEq 0, + treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA), + treeMissingEq base.closure (closureInsideA hpOld)] + exact hcard + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch1953Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → S.length ≤ U.length → TreeSequenceInitialSegment S U) → + (∀ {S U : TreeSequence G e0}, TreeSequenceInitialSegment S U → S.length = U.length → S = U) → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + A.length < (↑ib : ℕ) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed T ∧ phi f ≠ some alpha ∧ phi f ≠ some beta) → + ModColoring ett sigma → + (∀ (S U : TreeSequence G e0), + TashkinovAugmentationSequence phi S U → + TreeSequenceInitialSegment U T → + U.length ≤ (↑ib : ℕ) → TashkinovAugmentationSequence sigma S U) → + ¬A = Tn → + A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA A sigma), MaximumProperty ettA + +theorem helper_branch_1953.{u_1, u_2} : + helperBranch1953Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma H q A n Tn ib commonPrefix + equalTrees TnToA AToT hAib terminalRoute hmod transportBefore he + have hstrict : Tn.length < A.length := by + have hle := TnToA.1 + by_contra h + have hlen : Tn.length = A.length := by omega + exact he (equalTrees TnToA hlen).symm + have routeA : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn A) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed A) := by + rcases terminalRoute with ⟨hp, hseq⟩ | ⟨hp, f, seed, hedges, hseed, hseq, hfa, hfb⟩ + · have hpre := TashkinovAugmentationSequenceRestrict phi Tn A T hseq TnToA AToT + exact Or.inl ⟨hp, transportBefore Tn A hpre AToT (le_of_lt hAib)⟩ + · have hseedA : TreeSequenceInitialSegment seed A := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hseq) AToT + (by have := hseed.1; omega) + have hpre := TashkinovAugmentationSequenceRestrict phi seed A T hseq hseedA AToT + exact Or.inr ⟨hp, f, seed, hedges, hseed, transportBefore seed A hpre AToT (le_of_lt hAib)⟩ + obtain ⟨corrA⟩ := hmod.2.2 A TnToA hstrict routeA + exact Or.inr ⟨corrA.replacementInput, corrA.replacementETT, + MaximumPropertyTransport G k e0 ett sigma hmod A corrA C.maximum⟩ + +end GoldbergSeymour.StableChangeCaseThreePreparation + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation2.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation2.lean new file mode 100644 index 0000000000..7e6aad8f22 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation2.lean @@ -0,0 +1,300 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation1 + +/-! +# StableChangeCaseThree: supporting constructions, part 2 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.StableChangeCaseThreePreparation + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperUniqueRefresh2220Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (terminalData : + corrT.replacementETT.series.data.tree (Fin.last corrT.replacementETT.rounds).castSucc = Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { + dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + @Eq.mpr + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 + input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 input + T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett base + H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (have this : + @LE.le Nat instLENat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@TreeSequence.length V E G e0 T) := + @TreeSequence.positive V E G e0 T; + @Decidable.byContradiction + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))) + (Nat.decLt (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))) + fun + (a : + Not + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))) ↦ + by omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett base + H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (have this : + @LE.le Nat instLENat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@TreeSequence.length V E G e0 T) := + @TreeSequence.positive V E G e0 T; + @Decidable.byContradiction + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))) + (Nat.decLt (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))) + fun + (a : + Not + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))) ↦ + by omega)))) + (@id + (@Eq Prop + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 + input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 + input T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett + base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (have this : + @LE.le Nat instLENat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@TreeSequence.length V E G e0 T) := + @TreeSequence.positive V E G e0 T; + @Decidable.byContradiction + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))) + (Nat.decLt (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))) + fun + (a : + Not + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))) ↦ + by omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett + base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (have this : + @LE.le Nat instLENat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@TreeSequence.length V E G e0 T) := + @TreeSequence.positive V E G e0 T; + @Decidable.byContradiction + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))) + (Nat.decLt (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))) + fun + (a : + Not + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))) ↦ + by omega))))) + (@congrArg (@TreeSequence V E G e0) Prop + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 + input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 input + T phi ett sigma T corrT) + sigma baseT) + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi base) + (fun (_a : @TreeSequence V E G e0) ↦ + @TreeSequenceInitialSegment V E G e0 _a + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett + base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (have this : + @LE.le Nat instLENat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@TreeSequence.length V E G e0 T) := + @TreeSequence.positive V E G e0 T; + @Decidable.byContradiction + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))) + (Nat.decLt (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2))))) + fun + (a : + Not + (@LT.lt Nat instLTNat (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T + phi phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))))) ↦ + by omega)))) + hcoreT)) + (@TashkinovHierarchy.coreInsideFirst V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) → + ∀ (i : Fin K.dividerCount), + ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + (C.good.gamma i.succ eta ⊆ + (TreeSequenceVertexSet (K.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, + theta ≠ eta → C.good.gamma i.succ theta = C.good.gamma i.castSucc theta + +theorem helper_uniqueRefresh_2220.{u_1, u_2} : + helperUniqueRefresh2220Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn Dn ordinaryToA missingA corrT + baseT hcoreT terminalData K starredEq storedEq a + have hnew : + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H a.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H a.castSucc)).biUnion + fun v => MissingColors G phi v) := by + apply Finset.biUnion_congr rfl + intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA a.succ) + (Finset.mem_sdiff.mp hv).1) + change ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K a.succ ∧ + C.good.gamma a.succ eta ⊆ + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K a.castSucc)).biUnion + fun v => MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K a.succ, theta ≠ eta → + C.good.gamma a.succ theta = C.good.gamma a.castSucc theta + rw [starredEq a.castSucc, hnew] + simp only [storedEq] + exact C.good.uniqueRefresh a + +end GoldbergSeymour.StableChangeCaseThreePreparation + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation3.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation3.lean new file mode 100644 index 0000000000..e0f1b0a5a4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation3.lean @@ -0,0 +1,661 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation2 + +/-! +# StableChangeCaseThree: supporting constructions, part 3 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.StableChangeCaseThreePreparation + +/-- Typed data construction shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperGoodT2426.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [inst : Fintype V] → + [inst_1 : Fintype E] → + [inst_2 : DecidableEq V] → + [inst_3 : DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (alpha beta : Fin k) → + alpha ≠ beta → + (sigma : PartialEdgeColoring E k) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := + ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := + TashkinovStoredColors ett.series.data n; + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) + A) → + (∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = + MissingColors G phi v) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ + TreeSequenceVertexSet A → + TreeMissingColors sigma S = + TreeMissingColors phi S) → + (ett.series.data.kind n = + some TashkinovExtensionKind.PE → + TreeSequenceVertexSet base.closure ⊆ + TreeSequenceVertexSet A) → + (corrT : + CorrespondingExtendedTashkinovTree G k e0 + ett sigma T) → + (baseT : + HierarchyBase corrT.replacementETT + sigma) → + (hcoreT : baseT.core = base.core) → + baseT.closure = base.closure → + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last + corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind + (Fin.last + corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors + corrT.replacementETT.series.data + (Fin.last + corrT.replacementETT.rounds) = + Dn) → + let K : + TashkinovHierarchy + corrT.replacementETT baseT := + { dividerCount := H.dividerCount, + stage := H.stage, + baseStage := + Eq.trans H.baseStage + (Eq.symm terminalData.left), + terminalStage := + H.terminalStage, + nested := H.nested, + strict := H.strict, + dividerPosition := + H.dividerPosition, + dividerPositive := + H.dividerPositive, + dividerIncreasing := + H.dividerIncreasing, + dividerStage := H.dividerStage, + coreInsideFirst := + @Eq.mpr + (@TreeSequenceInitialSegment + V E G e0 + (@HierarchyBase.core V E + inst inst_1 inst_2 + inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput + V E inst inst_1 inst_3 + G k e0 input T phi ett + sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT + V E inst inst_1 inst_3 + G k e0 input T phi ett + sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage + V E inst inst_1 inst_2 + inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat + Nat + (@instHAdd Nat + instAddNat) + (@TashkinovHierarchy.dividerCount + V E inst inst_1 + inst_2 inst_3 G k + e0 input T phi phi + ett base H) + (@OfNat.ofNat Nat + (nat_lit 2) + (instOfNatNat + (nat_lit 2)))) + (@OfNat.ofNat Nat + (nat_lit 1) + (instOfNatNat + (nat_lit 1))) + (by + have := + GoldbergSeymour.TreeSequence.positive + T + omega)))) + (@TreeSequenceInitialSegment + V E G e0 + (@HierarchyBase.core V E + inst inst_1 inst_2 + inst_3 G k e0 input T + phi ett phi base) + (@TashkinovHierarchy.stage + V E inst inst_1 inst_2 + inst_3 G k e0 input T + phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat + Nat + (@instHAdd Nat + instAddNat) + (@TashkinovHierarchy.dividerCount + V E inst inst_1 + inst_2 inst_3 G k + e0 input T phi phi + ett base H) + (@OfNat.ofNat Nat + (nat_lit 2) + (instOfNatNat + (nat_lit 2)))) + (@OfNat.ofNat Nat + (nat_lit 1) + (instOfNatNat + (nat_lit 1))) + (by + have := + GoldbergSeymour.TreeSequence.positive + T + omega)))) + (@id + (@Eq Prop + (@TreeSequenceInitialSegment + V E G e0 + (@HierarchyBase.core V + E inst inst_1 inst_2 + inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput + V E inst inst_1 + inst_3 G k e0 + input T phi ett + sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT + V E inst inst_1 + inst_3 G k e0 + input T phi ett + sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage + V E inst inst_1 + inst_2 inst_3 G k e0 + input T phi phi ett + base H + (@Fin.mk + (@HAdd.hAdd Nat + Nat Nat + (@instHAdd Nat + instAddNat) + (@TashkinovHierarchy.dividerCount + V E inst + inst_1 inst_2 + inst_3 G k e0 + input T phi + phi ett base + H) + (@OfNat.ofNat + Nat + (nat_lit 2) + (instOfNatNat + (nat_lit + 2)))) + (@OfNat.ofNat Nat + (nat_lit 1) + (instOfNatNat + (nat_lit 1))) + (by + have := + GoldbergSeymour.TreeSequence.positive + T + omega)))) + (@TreeSequenceInitialSegment + V E G e0 + (@HierarchyBase.core V + E inst inst_1 inst_2 + inst_3 G k e0 input + T phi ett phi base) + (@TashkinovHierarchy.stage + V E inst inst_1 + inst_2 inst_3 G k e0 + input T phi phi ett + base H + (@Fin.mk + (@HAdd.hAdd Nat + Nat Nat + (@instHAdd Nat + instAddNat) + (@TashkinovHierarchy.dividerCount + V E inst + inst_1 inst_2 + inst_3 G k e0 + input T phi + phi ett base + H) + (@OfNat.ofNat + Nat + (nat_lit 2) + (instOfNatNat + (nat_lit + 2)))) + (@OfNat.ofNat Nat + (nat_lit 1) + (instOfNatNat + (nat_lit 1))) + (by + have := + GoldbergSeymour.TreeSequence.positive + T + omega))))) + (@congrArg + (@TreeSequence V E G e0) + Prop + (@HierarchyBase.core V E + inst inst_1 inst_2 + inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput + V E inst inst_1 + inst_3 G k e0 input + T phi ett sigma T + corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT + V E inst inst_1 + inst_3 G k e0 input + T phi ett sigma T + corrT) + sigma baseT) + (@HierarchyBase.core V E + inst inst_1 inst_2 + inst_3 G k e0 input T + phi ett phi base) + (fun + (_a : + @TreeSequence V E + G e0) ↦ + @TreeSequenceInitialSegment + V E G e0 _a + (@TashkinovHierarchy.stage + V E inst inst_1 + inst_2 inst_3 G k + e0 input T phi phi + ett base H + (@Fin.mk + (@HAdd.hAdd Nat + Nat Nat + (@instHAdd Nat + instAddNat) + (@TashkinovHierarchy.dividerCount + V E inst + inst_1 + inst_2 + inst_3 G k + e0 input T + phi phi ett + base H) + (@OfNat.ofNat + Nat + (nat_lit 2) + (instOfNatNat + (nat_lit + 2)))) + (@OfNat.ofNat + Nat + (nat_lit 1) + (instOfNatNat + (nat_lit + 1))) + (by + have := + GoldbergSeymour.TreeSequence.positive + T + omega)))) + hcoreT)) + (@TashkinovHierarchy.coreInsideFirst + V E inst inst_1 inst_2 + inst_3 G k e0 input T phi + phi ett base H) : + TashkinovHierarchy + corrT.replacementETT baseT }; + (∀ + (j : + Fin + (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = + HierarchyStarredStage H j) → + (∀ + (j : + Fin + (H.dividerCount + + (1 : ℕ))), + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt H + j) → + (∀ + (j : + Fin + (H.dividerCount + + (1 : ℕ))), + HierarchyStageMissingColors + K j = + HierarchyStageMissingColors + H j) → + (∀ + (j : + Fin + (H.dividerCount + + (1 : ℕ))), + ∀ + eta ∈ + HierarchyStoredColorsAt + H j, + ∀ + c ∈ + C.good.gamma j eta, + c ≠ alpha ∧ + c ≠ beta) → + (∀ + (j : + Fin + (H.dividerCount + + (1 : ℕ))), + ∀ + eta ∈ + HierarchyStoredColorsAt + H j, + ∀ (c : Fin k), + c ≠ alpha → + c ≠ beta → + c ∈ + HierarchySegmentColors + K j eta → + c ∈ + HierarchySegmentColors + H j eta) → + (∀ + (S : + TreeSequence G e0), + TreeSequenceVertexSet + S ⊆ + TreeSequenceVertexSet + A → + ∀ + (R : + Finset (Fin k)), + TreeColorSetMinusClosed + G sigma S R ↔ + TreeColorSetMinusClosed + G phi S R) → + GoodHierarchy K := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne sigma H q A n Tn Dn coreToA + TnToA ordinaryToA missingA treeMissingEq closureInsideA corrT baseT hcoreT hclosureT + terminalData K starredEq storedEq stageMissingEq gammaNot segmentTransfer minusEq + exact { + gamma := C.good.gamma + twoColors := by + intro j eta heta + exact C.good.twoColors j eta (by rw [storedEq j] at heta; exact heta) + avoidance := by + intro j eta heta c hc + have ho : eta ∈ HierarchyStoredColorsAt H j := by rw [← storedEq j]; exact heta + have old := C.good.avoidance j eta ho hc + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · rw [stageMissingEq j]; exact (Finset.mem_sdiff.mp old).1 + · intro hseg + exact (Finset.mem_sdiff.mp old).2 + (segmentTransfer j eta ho c (gammaNot j eta ho c hc).1 (gammaNot j eta ho c hc).2 hseg) + disjointPairs := by + intro j eta theta heta htheta hne + exact C.good.disjointPairs j eta theta + (by rw [storedEq j] at heta; exact heta) + (by rw [storedEq j] at htheta; exact htheta) hne + uniqueRefresh := by + exact @helper_uniqueRefresh_2220 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@sigma) + (@ordinaryToA) (@missingA) (@corrT) (@baseT) (@hcoreT) (@terminalData) (@starredEq) + (@storedEq) + parallelBase := by + dsimp only + intro hp + have hpOld : ett.series.data.kind n = some TashkinovExtensionKind.PE := + terminalData.2.1.symm.trans hp + obtain ⟨hnot, hcard⟩ := C.good.parallelBase hpOld + constructor + · exact @helper_branch_1161 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@sigma) + (@coreToA) (@corrT) (@baseT) (@hcoreT) (@terminalData) (@storedEq) (@minusEq) (@hnot) + · exact @helper_branch_1166 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@sigma) + (@TnToA) (@treeMissingEq) (@closureInsideA) (@corrT) (@baseT) (@hcoreT) (@hclosureT) + (@terminalData) (@storedEq) (@hpOld) (@hcard) + minusClosed := by + intro a + change TreeColorSetMinusClosed G sigma (H.stage a.succ.castSucc) + ((HierarchyStoredColorsAt K a.succ).biUnion (C.good.gamma a.castSucc)) + rw [storedEq a.succ, minusEq _ (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA + a.succ))] + exact C.good.minusClosed a } + +theorem helper_prefixMaximum_1187.{u_1, u_2} : + helperPrefixMaximum1187Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma H q A n Tn ib commonPrefix + equalTrees TnToA AToT hAib terminalRoute hmod transportBefore + by_cases he : A = Tn + · exact Or.inl he + · exact @helper_branch_1953 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@sigma) + (@commonPrefix) (@equalTrees) (@TnToA) (@AToT) (@hAib) (@terminalRoute) (@hmod) + (@transportBefore) (@he) +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperSame2713Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) (hne : alpha ≠ beta) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (coreToA : TreeSequenceInitialSegment base.core A) (TnToA : TreeSequenceInitialSegment Tn A) + (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) + (missingA : ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) + (treeMissingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) + (closureInsideA : + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A) + (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (hclosureT : baseT.closure = base.closure) + (terminalData : + corrT.replacementETT.series.data.tree (Fin.last corrT.replacementETT.rounds).castSucc = Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { + dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + @Eq.mpr + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 input + T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 input T + phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@id + (@Eq Prop + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 + input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 input + T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett base + H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett base + H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega))))) + (@congrArg (@TreeSequence V E G e0) Prop + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 input + T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 input T + phi ett sigma T corrT) + sigma baseT) + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi base) + (fun (_a : @TreeSequence V E G e0) ↦ + @TreeSequenceInitialSegment V E G e0 _a + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett base + H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) + hcoreT)) + (@TashkinovHierarchy.coreInsideFirst V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) : + TashkinovHierarchy corrT.replacementETT baseT }; + ∀ + (starredEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), HierarchyStarredStage K j = HierarchyStarredStage H j) + (storedEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) + (stageMissingEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j) + (gammaNot : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, ∀ c ∈ C.good.gamma j eta, c ≠ alpha ∧ c ≠ beta) + (segmentTransfer : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, + ∀ (c : Fin k), + c ≠ alpha → + c ≠ beta → c ∈ HierarchySegmentColors K j eta → c ∈ HierarchySegmentColors H j eta) + (minusEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma S R ↔ TreeColorSetMinusClosed G phi S R), + let goodT : GoodHierarchy K := + helperGoodT2426 G k e0 input T phi ett base C alpha beta hne sigma coreToA TnToA ordinaryToA + missingA treeMissingEq closureInsideA corrT baseT hcoreT hclosureT terminalData starredEq + storedEq stageMissingEq gammaNot segmentTransfer minusEq; + SameGoodHierarchy C.good goodT + +theorem helper_same_2713.{u_1, u_2} : + helperSame2713Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne sigma H q A n Tn Dn coreToA + TnToA ordinaryToA missingA treeMissingEq closureInsideA corrT baseT hcoreT hclosureT + terminalData K starredEq storedEq stageMissingEq gammaNot segmentTransfer minusEq goodT + refine ⟨?_, rfl, ?_⟩ + · refine ⟨hcoreT.symm, rfl, HEq.rfl, HEq.rfl, ?_, fun _ => hclosureT.symm⟩ + exact ⟨fun hp => terminalData.2.1.trans hp, fun hp => terminalData.2.1.symm.trans hp⟩ + · intro j + exact ⟨(storedEq j).symm, fun _ _ => rfl⟩ + +end GoldbergSeymour.StableChangeCaseThreePreparation + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation4.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation4.lean new file mode 100644 index 0000000000..50e876af9a --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation4.lean @@ -0,0 +1,380 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation3 + +/-! +# StableChangeCaseThree: supporting constructions, part 4 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.StableChangeCaseThreePreparation + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperPositivePackage2874Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq V] + [inst_3 : DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) (hne : alpha ≠ beta) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (coreToA : TreeSequenceInitialSegment base.core A) (TnToA : TreeSequenceInitialSegment Tn A) + (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) + (missingA : ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) + (treeMissingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) + (closureInsideA : + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A) + (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT → + ∀ (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (hclosureT : baseT.closure = base.closure) + (terminalData : + corrT.replacementETT.series.data.tree (Fin.last corrT.replacementETT.rounds).castSucc = Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { + dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + @Eq.mpr + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 + input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 input + T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett base + H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) (by omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett base + H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) (by omega)))) + (@id + (@Eq Prop + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 + input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 + input T phi ett sigma T corrT) + sigma baseT) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett + base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) (by omega)))) + (@TreeSequenceInitialSegment V E G e0 + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi base) + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett + base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) (by omega))))) + (@congrArg (@TreeSequence V E G e0) Prop + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_3 G k e0 + input T phi ett sigma T corrT) + T sigma + (@CorrespondingExtendedTashkinovTree.replacementETT V E inst inst_1 inst_3 G k e0 input + T phi ett sigma T corrT) + sigma baseT) + (@HierarchyBase.core V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett phi base) + (fun (_a : @TreeSequence V E G e0) ↦ + @TreeSequenceInitialSegment V E G e0 _a + (@TashkinovHierarchy.stage V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi ett + base H + (@Fin.mk + (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@TashkinovHierarchy.dividerCount V E inst inst_1 inst_2 inst_3 G k e0 input T phi + phi ett base H) + (@OfNat.ofNat Nat (nat_lit 2) (instOfNatNat (nat_lit 2)))) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1))) (by omega)))) + hcoreT)) + (@TashkinovHierarchy.coreInsideFirst V E inst inst_1 inst_2 inst_3 G k e0 input T phi phi + ett base H) : + TashkinovHierarchy corrT.replacementETT baseT }; + ∀ + (starredEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) + (storedEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) + (stageMissingEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j) + (gammaNot : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, ∀ c ∈ C.good.gamma j eta, c ≠ alpha ∧ c ≠ beta) + (segmentTransfer : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, + ∀ (c : Fin k), + c ≠ alpha → + c ≠ beta → c ∈ HierarchySegmentColors K j eta → c ∈ HierarchySegmentColors H j eta) + (minusEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + ∀ (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma S R ↔ TreeColorSetMinusClosed G phi S R), + let goodT : GoodHierarchy K := + helperGoodT2426 G k e0 input T phi ett base C alpha beta hne sigma coreToA TnToA ordinaryToA + missingA treeMissingEq closureInsideA corrT baseT hcoreT hclosureT terminalData starredEq + storedEq stageMissingEq gammaNot segmentTransfer minusEq; + (0 : ℕ) < C.hierarchy.dividerCount → + (1 : ℕ) ≤ (↑q : ℕ) → + ∀ (U : TreeSequence G e0), + U = H.stage q.castSucc → + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA U sigma) + (baseA : HierarchyBase ettA sigma) (KA : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy KA), + MaximumProperty ettA ∧ + ∃ (hcount : KA.dividerCount + (1 : ℕ) = H.dividerCount), + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ (j : Fin (KA.dividerCount + (2 : ℕ))), + KA.stage j = H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ + (∀ (j : Fin (KA.dividerCount + (1 : ℕ))), + let jH : Fin (H.dividerCount + (1 : ℕ)) := + (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (1 : ℕ))); + HierarchyStoredColorsAt KA j = HierarchyStoredColorsAt H jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt KA j, goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma + (H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + ((HierarchyStoredColorsAt H q).biUnion + (C.good.gamma + (⟨H.dividerCount - (1 : ℕ), + Nat.lt_succ_of_le (Nat.sub_le H.dividerCount (1 : ℕ))⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ))))) + +theorem helper_positivePackage_2874.{u_1, u_2} : + helperPositivePackage2874Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne sigma H q A n Tn Dn coreToA + TnToA ordinaryToA missingA treeMissingEq closureInsideA corrT hmaximumT baseT hcoreT + hclosureT terminalData K starredEq storedEq stageMissingEq gammaNot segmentTransfer minusEq + goodT hq hqK U hU + subst U + obtain ⟨ettA, hMPA, hrA, hsA, baseA, hcoreA, hclosureA, hsupportA, + KA, hcount, hstages, hdividers, goodA, hgammaA, hminusA⟩ := + GoodHierarchyPrefixRepackage G k e0 corrT.replacementInput T sigma sigma + corrT.replacementETT hmaximumT baseT K goodT q hqK + refine ⟨corrT.replacementInput, ettA, baseA, KA, goodA, hMPA, ?_⟩ + have hcount' : KA.dividerCount + 1 = H.dividerCount := by + change KA.dividerCount = H.dividerCount - 1 at hcount + change 0 < H.dividerCount at hq + omega + refine ⟨hcount', hcoreA.trans hcoreT, hclosureA.trans hclosureT, ?_, ?_, ?_⟩ + · intro j + let jp : Fin (q.val + 1) := ⟨j.val, by dsimp [q]; have := j.isLt; omega⟩ + have he : Fin.cast (by omega) jp = j := Fin.ext rfl + simpa only [he] using hstages jp + · intro j + let jp : Fin q.val := ⟨j.val, by dsimp [q]; have := j.isLt; omega⟩ + have he : Fin.cast (by omega) jp = j := Fin.ext rfl + have hg := hgammaA jp + simp only [he] at hg + refine ⟨hg.1.trans (storedEq _), ?_⟩ + intro eta heta + exact hg.2 eta + · have he : (Fin.last H.dividerCount).castSucc = + (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := Fin.ext rfl + simpa [K, goodT, storedEq, q, he] using hminusA + +theorem helper_sameComponent_3526.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : alpha ≠ beta) + (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + alpha ∈ TreeMissingColors phi Ty ∧ beta ∈ TreeMissingColors phi Ty) + (z : V ⊕ E) (sigma : PartialEdgeColoring E k) + (_ : sigma = TwoColorComponentSwap G phi alpha beta z) + (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + ∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u va) + (_ : + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + TreeVertexOrder T va vb) + (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + alpha ∉ Dnq ∧ beta ∉ Dnq) + (_ : + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (↑ia : ℕ) ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + ∀ (_ : alpha ∈ TreeMissingColors phi Y ∧ beta ∈ TreeMissingColors phi Y) + (_ : + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length) + (_ : (↑ia : ℕ) < (↑ib : ℕ)) + (_ : va ∉ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A) + (_ : A.length < (↑ia : ℕ)) (_ : va ∈ TreeSequenceVertexSet Y) + (_ : alpha ∉ TreeMissingColors phi A) (_ : alpha ∉ Dn ∧ beta ∉ Dn) + (_ : ∀ (c : Fin k) (_ : c = alpha ∨ c = beta), c ∉ TreeMissingColors phi Tn ∪ Dn) + (_ : + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence phi seed T ∧ + phi f ≠ some alpha ∧ phi f ≠ some beta) + (_ : + ∀ (t : Fin Tn.length), phi (Tn.edge t) ≠ some alpha ∧ phi (Tn.edge t) ≠ some beta) + (_ : + ∀ (S : TreeSequence G e0) (_ : TashkinovAugmentationSequence phi S T) + (t : Fin T.length) (_ : S.length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < (↑ib : ℕ)), + phi (T.edge t) ≠ some alpha ∧ phi (T.edge t) ≠ some beta) + (_ : + ∀ (t : Fin T.length) (_ : (↑t : ℕ) < (↑ib : ℕ)), + phi (T.edge t) ≠ some alpha ∧ phi (T.edge t) ≠ some beta) + (_ : + alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A → + TreeVertexOrder T va vb ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))) + (_ : + let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have _ : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + have sameComponent : Prop := + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (alpha ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent)), + TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne hmissingPrefix z sigma hsigma + hAprecedes hordered hnotStored hunused H q A n Tn Dn ia ib va vb ell Y hmissingY ha + habIndex hout hAia haY halphaA hDn notControlled terminalRoute treeControlled + augmentationControlled prefixControlled horderedUnused hchange + by_cases hz : H.dividerCount = 0 + · apply hchange.2 + refine ⟨hz, Or.inr ?_⟩ + apply Finset.disjoint_left.mpr + intro c hc hd + rcases Finset.mem_insert.mp hc with rfl | hc + · exact hDn.1 hd + · have he := Finset.mem_singleton.mp hc; subst c; exact hDn.2 hd + · apply hchange.1 + refine ⟨by change 0 < H.dividerCount; omega, Or.inr ?_⟩ + apply Finset.disjoint_left.mpr + intro c hc hd + rcases Finset.mem_insert.mp hc with rfl | hc + · exact hnotStored.1 hd + · have he := Finset.mem_singleton.mp hc; subst c; exact hnotStored.2 hd + +end GoldbergSeymour.StableChangeCaseThreePreparation + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation5.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation5.lean new file mode 100644 index 0000000000..1a18aa608b --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation5.lean @@ -0,0 +1,536 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation4 + +/-! +# StableChangeCaseThree: supporting constructions, part 5 + +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +This module separates dependent data constructors from their supporting proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.StableChangeCaseThreePreparation + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation3662Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (hproper : + IsProperEdgeColoring G phi) (hone : IsOneEdgeUncolored phi e0) (hlower : + LowerRoundInductionHypothesis G k e0 ett.rounds) (hfewer : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating'), other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') (a : + GoodHierarchy K), K.dividerCount < C.hierarchy.dividerCount → ColoredVertexSetElementary G + generating' (TreeSequenceVertexSet T')) (hminimal : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) (hprefixElementary : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) (Nat.min_le_right + (A.length + (ell - (1 : ℕ))) T.length); ColoredVertexSetElementary G phi + (TreeSequenceVertexSet Ty)) (hlarge : + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; (2 : ℕ) * ett.rounds + (11 : ℕ) + ≤ (TreeMissingColors phi Tn).card) (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) (Nat.min_le_right + (A.length + (ell - (1 : ℕ))) T.length); alpha ∈ TreeMissingColors phi Ty ∧ beta ∈ + TreeMissingColors phi Ty) (z : V ⊕ E) (sigma : PartialEdgeColoring E k) (hsigma : sigma = + TwoColorComponentSwap G phi alpha beta z) (hAprecedes : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + ∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u va) (hordered : + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + let vb : V := T.vertex (HierarchyFirstMissingPosition phi T beta); TreeVertexOrder T va vb) + (hnotStored : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; alpha ∉ Dnq ∧ beta ∉ Dnq) (hunused : + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; alpha ∉ ({c : + Fin k | + ∃ (t : Fin T.length), (↑ia : ℕ) ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let Y : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + ( + have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ + min (A.length + (ell - (1 : ℕ))) T.length) ↦ + by + omega + ) (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + ∀ (segTrans : + ∀ {S U W : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U) (hUW : + TreeSequenceInitialSegment U W), TreeSequenceInitialSegment S W) (commonPrefix : + ∀ {S U W : TreeSequence G e0} (hSW : TreeSequenceInitialSegment S W) (hUW : + TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length), TreeSequenceInitialSegment S + U) (equalTrees : + ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U) (hlen : S.length = + U.length), S = U) (lastPositive : + ∀ (hz : H.dividerCount ≠ (0 : ℕ)), A = H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (coreToA : TreeSequenceInitialSegment base.core A) (TnToA + : TreeSequenceInitialSegment Tn A) (AToT : TreeSequenceInitialSegment A T) (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) + (starredToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H j) + A) (hmissingY : alpha ∈ TreeMissingColors phi Y ∧ beta ∈ TreeMissingColors phi Y) (ha : + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length) (hb : beta ∈ MissingColors + G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length) (habIndex : (↑ia : ℕ) < (↑ib + : ℕ)) (hout : va ∉ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A) (hAia : + A.length < (↑ia : ℕ)) (hAib : A.length < (↑ib : ℕ)) (haY : va ∈ TreeSequenceVertexSet Y) + (halphaA : alpha ∉ TreeMissingColors phi A) (hbetaA : beta ∉ TreeMissingColors phi A) + (missingSubset : + ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U), TreeMissingColors phi S ⊆ + TreeMissingColors phi U) (hDn : alpha ∉ Dn ∧ beta ∉ Dn) (notControlled : + ∀ (c : Fin k) (hc : c = alpha ∨ c = beta), c ∉ TreeMissingColors phi Tn ∪ Dn) (terminalRoute : + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn T ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed T ∧ phi f ≠ some + alpha ∧ phi f ≠ some beta) (treeControlled : + ∀ (t : Fin Tn.length), phi (Tn.edge t) ≠ some alpha ∧ phi (Tn.edge t) ≠ some beta) + (augmentationControlled : + ∀ (S : TreeSequence G e0) (hseq : TashkinovAugmentationSequence phi S T) (t : Fin T.length) + (ht : S.length ≤ (↑t : ℕ)) (htb : (↑t : ℕ) < (↑ib : ℕ)), phi (T.edge t) ≠ some alpha ∧ phi + (T.edge t) ≠ some beta) (prefixControlled : + ∀ (t : Fin T.length) (htb : (↑t : ℕ) < (↑ib : ℕ)), phi (T.edge t) ≠ some alpha ∧ phi (T.edge + t) ≠ some beta) (horderedUnused : alpha ∉ TreeMissingColors phi A ∨ beta ∉ + TreeMissingColors phi A → TreeVertexOrder T va vb ∧ alpha ∉ ({c : Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : + Finset (Fin k))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma), + MaximumProperty ettA) ∧ ( + ∀ (hq : (0 : ℕ) < H.dividerCount), + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), MaximumProperty ettA ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = base.core ∧ baseA.closure + = base.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + let jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq (Dnq.biUnion (C.good.gamma (⟨C.hierarchy.dividerCount + - (1 : ℕ), + by omega + ⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) ∧ + ∃ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), MaximumProperty + corrT.replacementETT ∧ + ∃ (baseT : HierarchyBase corrT.replacementETT sigma) (K : TashkinovHierarchy + corrT.replacementETT baseT) (goodT : GoodHierarchy K), SameGoodHierarchy C.good goodT + +private abbrev helperContinuation370Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta + : Fin k) (hne : alpha ≠ beta) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (commonPrefix : + ∀ {S U W : TreeSequence G e0} (hSW : TreeSequenceInitialSegment S W) (hUW : + TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length), TreeSequenceInitialSegment S + U) (equalTrees : + ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U) (hlen : S.length = + U.length), S = U) (lastPositive : + ∀ (hz : H.dividerCount ≠ (0 : ℕ)), A = H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) (coreToA : TreeSequenceInitialSegment base.core A) (TnToA + : TreeSequenceInitialSegment Tn A) (AToT : TreeSequenceInitialSegment A T) (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) + (starredToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H j) + A) (hAib : A.length < (↑ib : ℕ)) (halphaA : alpha ∉ TreeMissingColors phi A) (hbetaA : + beta ∉ TreeMissingColors phi A) (missingSubset : + ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U), TreeMissingColors phi S ⊆ + TreeMissingColors phi U) (hDn : alpha ∉ Dn ∧ beta ∉ Dn) (terminalRoute : + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + phi Tn T ∨ (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed T ∧ phi f ≠ some + alpha ∧ phi f ≠ some beta) (unaffected : + ∀ (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta), sigma f = some c ↔ phi f = some c) + (missingUnaffected : + ∀ (v : V) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta), c ∈ MissingColors G sigma v ↔ c ∈ + MissingColors G phi v) (missingA : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet A), MissingColors G sigma v = MissingColors G phi v) + (treeMissingEq : + ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A), + TreeMissingColors sigma S = TreeMissingColors phi S) (closureInsideA : + ∀ (hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE), TreeSequenceVertexSet + base.closure ⊆ TreeSequenceVertexSet A) (weak : HierarchyWeaklyStable H q sigma) (hmod : + ModColoring ett sigma) (transportBefore : + ∀ (S U : TreeSequence G e0) (hseq : TashkinovAugmentationSequence phi S U) (hUT : + TreeSequenceInitialSegment U T) (hU : U.length ≤ (↑ib : ℕ)), TashkinovAugmentationSequence + sigma S U) (corrData : + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ TashkinovStoredColors corr.replacementETT.series.data (Fin.last + corr.replacementETT.rounds) = Dn) (fullBase : + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), MaximumProperty + corr.replacementETT ∧ + ∃ (baseT : HierarchyBase corr.replacementETT sigma), baseT.core = base.core ∧ baseT.closure = + base.closure), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma), + MaximumProperty ettA) ∧ ( + ∀ (hq : (0 : ℕ) < H.dividerCount), + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), MaximumProperty ettA ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = base.core ∧ baseA.closure + = base.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq (Dnq.biUnion (C.good.gamma (⟨C.hierarchy.dividerCount + - (1 : ℕ), + by omega + ⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) ∧ + ∃ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), MaximumProperty + corrT.replacementETT ∧ + ∃ (baseT : HierarchyBase corrT.replacementETT sigma) (K : TashkinovHierarchy + corrT.replacementETT baseT) (goodT : GoodHierarchy K), SameGoodHierarchy C.good goodT + +private theorem helper_continuation_370.{u_1, u_2} : + helperContinuation370Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne sigma H q A n Tn Dn ib + commonPrefix equalTrees lastPositive coreToA TnToA AToT ordinaryToA starredToA hAib halphaA + hbetaA missingSubset hDn terminalRoute unaffected missingUnaffected missingA treeMissingEq + closureInsideA weak hmod transportBefore corrData fullBase + obtain ⟨corrT, hmaximumT, baseT, hcoreT, hclosureT⟩ := fullBase + have terminalData := corrData corrT + let K : TashkinovHierarchy corrT.replacementETT baseT := { + dividerCount := H.dividerCount + stage := H.stage + baseStage := H.baseStage.trans terminalData.1.symm + terminalStage := H.terminalStage + nested := H.nested + strict := H.strict + dividerPosition := H.dividerPosition + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := H.dividerStage + coreInsideFirst := by rw [hcoreT]; exact H.coreInsideFirst } + have starredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage H j := by + exact Fin.cases hcoreT (fun _ => rfl) j + have storedEq (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j := by + unfold HierarchyStoredColorsAt + dsimp only + rw [terminalData.2.2, starredEq j, + treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starredToA j))] + have stageMissingEq (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j := by + exact @helper_stageMissingEq_1044 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@sigma) (@TnToA) + (@ordinaryToA) (@treeMissingEq) (@corrT) (@baseT) (@hcoreT) (@terminalData) (@j) + have stageMissingInside (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors H j ⊆ TreeMissingColors phi A := by + exact Fin.cases (missingSubset TnToA) (fun a => missingSubset (ordinaryToA a.succ)) j + have ownerNot (j : Fin (H.dividerCount + 1)) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt H j) : eta ≠ alpha ∧ eta ≠ beta := by + have hd : eta ∈ Dn := (Finset.mem_sdiff.mp heta).1 + exact ⟨fun he => hDn.1 (he ▸ hd), fun he => hDn.2 (he ▸ hd)⟩ + have gammaNot (j : Fin (H.dividerCount + 1)) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt H j) (c : Fin k) + (hc : c ∈ C.good.gamma j eta) : c ≠ alpha ∧ c ≠ beta := by + have hm := stageMissingInside j (Finset.mem_sdiff.mp (C.good.avoidance j eta heta hc)).1 + exact ⟨fun he => halphaA (he ▸ hm), fun he => hbetaA (he ▸ hm)⟩ + have firstEq (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition phi T c := by + exact @helper_firstEq_1065 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) (@phi) + (@alpha) (@beta) (@sigma) (@missingUnaffected) (@c) (@hca) (@hcb) + have segmentTransfer (j : Fin (H.dividerCount + 1)) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt H j) (c : Fin k) + (hca : c ≠ alpha) (hcb : c ≠ beta) + (hc : c ∈ HierarchySegmentColors K j eta) : + c ∈ HierarchySegmentColors H j eta := by + exact @helper_segmentTransfer_1077 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@sigma) (@unaffected) (@corrT) (@baseT) (@hcoreT) (@terminalData) (@starredEq) + (@ownerNot) (@firstEq) (@j) (@eta) (@heta) (@c) (@hca) (@hcb) (@hc) + have boundaryEq (S : TreeSequence G e0) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + BoundaryColorEdges G sigma (TreeSequenceVertexSet S) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet S) c := by + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + rw [unaffected f c hca hcb] + have minusEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) (R : Finset (Fin k)) : + TreeColorSetMinusClosed G sigma S R ↔ TreeColorSetMinusClosed G phi S R := by + exact @helper_minusEq_1094 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@sigma) + (@halphaA) (@hbetaA) (@treeMissingEq) (@boundaryEq) (@S) (@hS) (@R) + let goodT : GoodHierarchy K := by + exact @helperGoodT2426 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@sigma) + (@coreToA) (@TnToA) (@ordinaryToA) (@missingA) (@treeMissingEq) (@closureInsideA) + (@corrT) (@baseT) (@hcoreT) (@hclosureT) (@terminalData) (@starredEq) (@storedEq) + (@stageMissingEq) (@gammaNot) (@segmentTransfer) (@minusEq) + have same : SameGoodHierarchy C.good goodT := by + exact @helper_same_2713 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@sigma) + (@coreToA) (@TnToA) (@ordinaryToA) (@missingA) (@treeMissingEq) (@closureInsideA) + (@corrT) (@baseT) (@hcoreT) (@hclosureT) (@terminalData) (@starredEq) (@storedEq) + (@stageMissingEq) (@gammaNot) (@segmentTransfer) (@minusEq) + have prefixMaximum : A = Tn ∨ + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, MaximumProperty ettA := by + exact @helper_prefixMaximum_1187 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@sigma) (@commonPrefix) (@equalTrees) (@TnToA) (@AToT) (@hAib) (@terminalRoute) (@hmod) + (@transportBefore) + refine ⟨weak, hmod, prefixMaximum, ?_, corrT, hmaximumT, baseT, K, goodT, same⟩ + intro hq + have hqK : 1 ≤ q.val := by change 0 < H.dividerCount at hq; dsimp [q]; omega + have hqpos : H.dividerCount ≠ 0 := by change 0 < H.dividerCount at hq; omega + have hA : A = H.stage q.castSucc := by + rw [lastPositive hqpos] + rfl + exact @helper_positivePackage_2874 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@sigma) (@coreToA) (@TnToA) (@ordinaryToA) (@missingA) (@treeMissingEq) + (@closureInsideA) (@corrT) (@hmaximumT) (@baseT) (@hcoreT) (@hclosureT) (@terminalData) + (@starredEq) (@storedEq) (@stageMissingEq) (@gammaNot) (@segmentTransfer) (@minusEq) (@hq) + (@hqK) (@A) (@hA) + +theorem helper_continuation_3662.{u_1, u_2} : + helperContinuation3662Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal + hprefixElementary hlarge alpha beta hne hmissingPrefix z sigma hsigma hAprecedes hordered + hnotStored hunused H q A n Tn Dn ia ib va vb ell Y segTrans commonPrefix equalTrees + lastPositive coreToA TnToA AToT ordinaryToA starredToA hmissingY ha hb habIndex hout hAia + hAib haY halphaA hbetaA missingSubset hDn notControlled terminalRoute treeControlled + augmentationControlled prefixControlled horderedUnused + have hchange := ChangeLemmaBothOutside G k e0 input T phi ett base C hproper hone + hlower hfewer hminimal hprefixElementary hlarge alpha beta hne hmissingPrefix + horderedUnused hout + have sameComponent : TwoColorComponent G phi alpha beta (Sum.inl va) = + TwoColorComponent G phi alpha beta (Sum.inl vb) := by + exact @helper_sameComponent_3526 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@hmissingPrefix) (@z) (@sigma) (@hsigma) (@hAprecedes) (@hordered) (@hnotStored) + (@hunused) (@hmissingY) (@ha) (@habIndex) (@hout) (@hAia) (@haY) (@halphaA) (@hDn) + (@notControlled) (@terminalRoute) (@treeControlled) (@augmentationControlled) + (@prefixControlled) (@horderedUnused) (@hchange) + have behavior := TwoColorComponentSwapMissingBehavior G phi alpha beta hne hproper z + have fixedValue (f : E) (ha : phi f ≠ some alpha) (hb : phi f ≠ some beta) : + sigma f = phi f := by + rw [hsigma] + simp [TwoColorComponentSwap, ha, hb] + have unaffected (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + sigma f = some c ↔ phi f = some c := by + exact @helper_unaffected_835 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@z) (@sigma) (@hsigma) (@ha) (@hb) (@f) (@c) (@hca) (@hcb) + have missingUnaffected (v : V) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + c ∈ MissingColors G sigma v ↔ c ∈ MissingColors G phi v := by + rw [hsigma] + exact behavior.2.2.2 v c hca hcb + have sigmaProper : IsProperEdgeColoring G sigma := by + rw [hsigma] + exact TwoColorComponentSwapProper G phi alpha beta hne hproper z + have sigmaOne : IsOneEdgeUncolored sigma e0 := by + exact @helper_sigmaOne_852 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hone) (@alpha) (@beta) (@hne) + (@z) (@sigma) (@hsigma) (@ha) (@hb) (@unaffected) + have missingA (v : V) (hv : v ∈ TreeSequenceVertexSet A) : + MissingColors G sigma v = MissingColors G phi v := by + exact @helper_missingA_629 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C alpha beta hne z sigma hsigma halphaA hbetaA behavior + missingUnaffected v hv + have treeMissingEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) : + TreeMissingColors sigma S = TreeMissingColors phi S := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => missingA v (hS hv)) + have stable (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) + (D : Finset (Fin k)) (hD : alpha ∉ D ∧ beta ∉ D) : + StableColoring S D phi sigma := by + exact @helper_stable_876 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@sigma) + (@halphaA) (@hbetaA) (@unaffected) (@missingA) (@S) (@hS) (@D) (@hD) + have stableTn : StableColoring Tn Dn phi sigma := + stable Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) Dn hDn + have closureInsideA (hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A := by + exact @helper_closureInsideA_893 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@coreToA) (@hPE) + have combined (hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + CombinedStableColoring Tn base.closure Dn phi sigma := + ⟨stableTn, stable base.closure (closureInsideA hPE) ∅ (by simp)⟩ + have invariant (S : TreeSequence G e0) (hSA : TreeSequenceInitialSegment S A) : + TreeColoringInvariant S phi sigma := by + exact @helper_invariant_903 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@sigma) + (@segTrans) (@AToT) (@habIndex) (@hAia) (@prefixControlled) (@fixedValue) (@missingA) + (@S) (@hSA) + have weak : HierarchyWeaklyStable H q sigma := by + exact @helper_weak_912 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@sigma) (@ordinaryToA) (@stableTn) + (@combined) (@invariant) + have stableLadder : StableColoring Tn Dn (ett.series.data.coloring n) sigma := by + rw [show ett.series.data.coloring n = phi from ett.generatingColoring.symm] + exact stableTn + have hmod : ModColoring ett sigma := Td G k e0 input T phi ett C.maximum + C.positive hlower sigma sigmaProper sigmaOne stableLadder + -- Before b every augmentation color is unaffected. Beyond b both colors remain missing. + let B := TreeSequencePrefix T ib.val (by have := A.positive; omega) + (Nat.le_of_lt_succ ib.isLt) + have BToT : TreeSequenceInitialSegment B T := + ⟨Nat.le_of_lt_succ ib.isLt, (by intro i; rfl), (by intro i; rfl)⟩ + have AToB : TreeSequenceInitialSegment A B := commonPrefix AToT BToT (le_of_lt hAib) + have vertexB (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : + T.vertex i ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, rfl⟩ + have haB : va ∈ TreeSequenceVertexSet B := vertexB ia (le_of_lt habIndex) + have hbB : vb ∈ TreeSequenceVertexSet B := vertexB ib le_rfl + have together : (Sum.inl va ∈ TwoColorComponent G phi alpha beta z) ↔ + (Sum.inl vb ∈ TwoColorComponent G phi alpha beta z) := by + exact @helper_together_938 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) (@phi) + (@alpha) (@beta) (@z) (@sameComponent) + have bothMissingB : alpha ∈ TreeMissingColors sigma B ∧ beta ∈ TreeMissingColors sigma B := by + exact @helper_bothMissingB_946 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@z) (@sigma) (@hsigma) (@ha) (@hb) (@hAib) (@behavior) (@haB) (@hbB) (@together) + have transportBefore (S U : TreeSequence G e0) + (hseq : TashkinovAugmentationSequence phi S U) + (hUT : TreeSequenceInitialSegment U T) (hU : U.length ≤ ib.val) : + TashkinovAugmentationSequence sigma S U := by + exact @helper_transportBefore_958 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@sigma) (@segTrans) (@prefixControlled) (@unaffected) (@missingUnaffected) (@S) (@U) + (@hseq) (@hUT) (@hU) + have transportRoute (S : TreeSequence G e0) + (hseq : TashkinovAugmentationSequence phi S T) + (hSB : TreeSequenceInitialSegment S B) : + TashkinovAugmentationSequence sigma S T := by + exact @helper_transportRoute_981 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@z) (@sigma) (@hsigma) (@hAib) (@BToT) (@bothMissingB) (@transportBefore) (@S) + (@hseq) (@hSB) + have sigmaRoute : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed T) := by + exact @helper_sigmaRoute_993 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@sigma) (@segTrans) (@commonPrefix) (@TnToA) (@habIndex) (@hAia) (@hAib) + (@terminalRoute) (@BToT) (@AToB) (@transportRoute) + have corrData (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) : + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = Dn := by + exact @helper_corrData_806 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C alpha beta sigma TnToA ha treeMissingEq corr + have fullBase : + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T, + MaximumProperty corr.replacementETT ∧ + ∃ baseT : HierarchyBase corr.replacementETT sigma, + baseT.core = base.core ∧ baseT.closure = base.closure := by + exact @helper_fullBase_847 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C hproper hone hlower beta sigma hb sigmaProper sigmaOne combined + hmod sigmaRoute corrData + exact @helper_continuation_370 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) + (@hne) (@sigma) (@commonPrefix) (@equalTrees) (@lastPositive) (@coreToA) (@TnToA) (@AToT) + (@ordinaryToA) (@starredToA) (@hAib) (@halphaA) (@hbetaA) (@missingSubset) (@hDn) + (@terminalRoute) (@unaffected) (@missingUnaffected) (@missingA) (@treeMissingEq) + (@closureInsideA) (@weak) (@hmod) (@transportBefore) (@corrData) (@fullBase) +end GoldbergSeymour.StableChangeCaseThreePreparation + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean new file mode 100644 index 0000000000..327a062de0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean @@ -0,0 +1,1512 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.BaseControl +public import LeanPool.GoldbergSeymour.DisplayedEdges +public import LeanPool.GoldbergSeymour.RecoloredPrefixReconstruction +public import LeanPool.GoldbergSeymour.RetainedHierarchy +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Stable Change Cases One Two + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperCaseContinuation868Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hprefixElementary : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (alpha beta : Fin k) (hne : alpha ≠ beta) (z : V ⊕ E) (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (hsproper : IsProperEdgeColoring G sigma) (hsone : IsOneEdgeUncolored sigma e0) + (houtside : + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))) (c : Fin k), + c = alpha ∨ c = beta → + c ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy r) → + TreeColorSetClosed G phi (HierarchyStarredStage C.hierarchy r) ({ c } : Finset (Fin k)) → + OutsideKempeRecoloring (HierarchyStarredStage C.hierarchy r) phi sigma alpha beta) + (preStepElementary : + let i : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + Fin ett.rounds); + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet Tn)) + (hfixed : ∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) + (hmissing : ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) + (hq : (0 : ℕ) < H.dividerCount), + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ + (trans : + ∀ {U W Z : TreeSequence G e0} (hUW : TreeSequenceInitialSegment U W) + (hWZ : TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z) + (hA : A = H.stage q.castSucc) + (coreToStar : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j)) + (coreA : TreeSequenceInitialSegment base.core A) + (ett0 : ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi) + (base0 : HierarchyBase ett0 phi) (H0 : TashkinovHierarchy ett0 base0), + let ettP : ExtendedTashkinovTree G k e0 input A phi := + { + rounds := ett0.rounds, roundsPositive := ett0.roundsPositive, series := ett0.series, + abovePenultimate := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment + (ett0.series.data.tree (⟨ett0.rounds, by omega⟩ : Fin (ett0.rounds + (2 : ℕ)))) _a) + hA))) ▸ + ett0.abovePenultimate), + strictAbovePenultimate := by rw [hA]; exact ett0.strictAbovePenultimate, + belowFinal := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment _a + (ett0.series.data.tree (Fin.last (ett0.rounds + (1 : ℕ))))) + hA))) ▸ + ett0.belowFinal), + generatingColoring := ett0.generatingColoring : ExtendedTashkinovTree G k e0 input A phi }; + let baseP : HierarchyBase ettP phi := + { + core := base0.core, closure := base0.closure, supportPosition := base0.supportPosition, + supportPositive := base0.supportPositive, + terminalMissingColors := base0.terminalMissingColors, parallel := base0.parallel, + nonparallel := base0.nonparallel : HierarchyBase ettP phi }; + ∀ (hcoreP : baseP.core = base.core), + let dividerP : (i : Fin H0.dividerCount) → Fin (A.length + (1 : ℕ)) := + fun (i : Fin H0.dividerCount) ↦ + (⟨(↑(H0.dividerPosition i) : ℕ), by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.HierarchyCounterexample.positive C + have := Fin.isLt q + have := Fin.isLt i + have := coreA.1 + have := congrArg GoldbergSeymour.TreeSequence.length hA + have := congrArg GoldbergSeymour.TreeSequence.length hcoreP + have := GoldbergSeymour.TreeSequence.positive (H.stage q.castSucc) + have := GoldbergSeymour.TreeSequence.positive A + try dsimp only [H] at * + try dsimp only [q] at * + try dsimp only [A] at * + try dsimp only [GoldbergSeymour.TreeSequencePrefix] at * + all_goals omega)⟩ : + Fin (A.length + (1 : ℕ))); + let HP : TashkinovHierarchy ettP baseP := + { + dividerCount := H0.dividerCount, stage := H0.stage, baseStage := H0.baseStage, + terminalStage := Eq.trans H0.terminalStage (Eq.symm hA), nested := H0.nested, + strict := H0.strict, dividerPosition := dividerP, dividerPositive := H0.dividerPositive, + dividerIncreasing := H0.dividerIncreasing, + dividerStage := fun (i : Fin H0.dividerCount) ↦ + ((Eq.symm + (id + (congrArg + (Eq (H0.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (H0.dividerCount + (2 : ℕ))))) + (TreeSequencePrefix.congr_simp A (H.stage q.castSucc) hA (↑(dividerP i) : ℕ) + (↑(H0.dividerPosition i) : ℕ) + (by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.HierarchyCounterexample.positive C + have := Fin.isLt q + have := Fin.isLt i + have := coreA.1 + have := congrArg GoldbergSeymour.TreeSequence.length hA + have := congrArg GoldbergSeymour.TreeSequence.length hcoreP + have := GoldbergSeymour.TreeSequence.positive (H.stage q.castSucc) + try dsimp only [H] at *)) + (H0.dividerPositive i) (Nat.le_of_lt_succ (dividerP i).isLt))))) ▸ + H0.dividerStage i), + coreInsideFirst := H0.coreInsideFirst : TashkinovHierarchy ettP baseP }; + ∀ (hc : HP.dividerCount + (1 : ℕ) = H.dividerCount) + (pStage : + ∀ (j : Fin (HP.dividerCount + (2 : ℕ))), + HP.stage j = + H.stage + (⟨(↑j : ℕ), + have this : (↑j : ℕ) < HP.dividerCount + (2 : ℕ) := j.isLt; + Decidable.byContradiction fun (a : ¬(↑j : ℕ) < H.dividerCount + (2 : ℕ)) ↦ by omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (pTree : ettP.series.data.tree (Fin.last ettP.rounds).castSucc = Tn) + (fullBase : + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma), + MaximumProperty ettA ∧ + ettA.series.data.tree (Fin.last ettA.rounds).castSucc = Tn ∧ + ettA.series.data.kind (Fin.last ettA.rounds) = ett.series.data.kind n ∧ + TashkinovStoredColors ettA.series.data (Fin.last ettA.rounds) = Dn ∧ + ∃ (baseA : HierarchyBase ettA sigma), + baseA.core = base.core ∧ baseA.closure = base.closure), + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), + MaximumProperty ettA ∧ + ettA.series.data.kind (Fin.last ettA.rounds) = ett.series.data.kind (Fin.last ett.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = C.hierarchy.dividerCount), + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ (j : Fin (K.dividerCount + (2 : ℕ))), + K.stage j = + C.hierarchy.stage + (⟨(↑j : ℕ), by omega⟩ : Fin (C.hierarchy.dividerCount + (2 : ℕ)))) ∧ + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt C.hierarchy + (⟨(↑j : ℕ), by omega⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ))) ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = + C.good.gamma (⟨(↑j : ℕ), by omega⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ))) + eta) ∧ + TreeColorSetMinusClosed G sigma + (C.hierarchy.stage + (⟨C.hierarchy.dividerCount, by omega⟩ : Fin (C.hierarchy.dividerCount + (2 : ℕ)))) + ((HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount)).biUnion + (C.good.gamma + (⟨C.hierarchy.dividerCount - (1 : ℕ), by omega⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ))))) + +private abbrev helperCaseContinuation1156Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hprefixElementary : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + alpha ∈ TreeMissingColors phi Ty ∧ beta ∈ TreeMissingColors phi Ty) + (z : V ⊕ E) (hpath : TwoColorPathComponent G phi alpha beta z) (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hcase : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (0 : ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors phi Tnq ∨ + H.dividerCount = (0 : ℕ) ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ alpha ∈ TreeMissingColors phi A ∧ alpha ∉ Dn ∧ beta ∉ Dn)) + (hdisjoint : + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (hsproper : IsProperEdgeColoring G sigma) (hsone : IsOneEdgeUncolored sigma e0) + (houtside : + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))) (c : Fin k), + c = alpha ∨ c = beta → + c ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy r) → + TreeColorSetClosed G phi (HierarchyStarredStage C.hierarchy r) ({ c } : Finset (Fin k)) → + OutsideKempeRecoloring (HierarchyStarredStage C.hierarchy r) phi sigma alpha beta) + (preStepElementary : + let i : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + Fin ett.rounds); + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet Tn)) + (hfixed : ∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) + (hmissing : ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) + (hq : (0 : ℕ) < H.dividerCount), + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ + (hstable : + if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) + (trans : + ∀ {U W Z : TreeSequence G e0} (hUW : TreeSequenceInitialSegment U W) + (hWZ : TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z) + (hA : A = H.stage q.castSucc) (hAT : TreeSequenceInitialSegment A T) + (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))) (hj : (↑j : ℕ) ≤ H.dividerCount), + TreeSequenceInitialSegment (H.stage j) A) + (coreToStar : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j)) + (coreA : TreeSequenceInitialSegment base.core A) (TnA : TreeSequenceInitialSegment Tn A) + (treeMissingEq : + ∀ (U : TreeSequence G e0) (hUA : TreeSequenceInitialSegment U A), + TreeMissingColors sigma U = TreeMissingColors phi U) + (ett0 : ExtendedTashkinovTree G k e0 input (H.stage q.castSucc) phi) + (base0 : HierarchyBase ett0 phi) (H0 : TashkinovHierarchy ett0 base0), + let ettP : ExtendedTashkinovTree G k e0 input A phi := + { + rounds := ett0.rounds, roundsPositive := ett0.roundsPositive, series := ett0.series, + abovePenultimate := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment + (ett0.series.data.tree (⟨ett0.rounds, by omega⟩ : Fin (ett0.rounds + (2 : ℕ)))) _a) + hA))) ▸ + ett0.abovePenultimate), + strictAbovePenultimate := by rw [hA]; exact ett0.strictAbovePenultimate, + belowFinal := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment _a + (ett0.series.data.tree (Fin.last (ett0.rounds + (1 : ℕ))))) + hA))) ▸ + ett0.belowFinal), + generatingColoring := ett0.generatingColoring : ExtendedTashkinovTree G k e0 input A phi }; + ∀ (hMPp : MaximumProperty ettP) (hrp : ettP.rounds = ett.rounds), + let baseP : HierarchyBase ettP phi := + { + core := base0.core, closure := base0.closure, supportPosition := base0.supportPosition, + supportPositive := base0.supportPositive, + terminalMissingColors := base0.terminalMissingColors, parallel := base0.parallel, + nonparallel := base0.nonparallel : HierarchyBase ettP phi }; + ∀ (hcoreP : baseP.core = base.core) (hclosureP : baseP.closure = base.closure), + let dividerP : (i : Fin H0.dividerCount) → Fin (A.length + (1 : ℕ)) := + fun (i : Fin H0.dividerCount) ↦ + (⟨(↑(H0.dividerPosition i) : ℕ), by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + have := GoldbergSeymour.HierarchyCounterexample.positive C + have := Fin.isLt q + have := Fin.isLt i + have := hAT.1 + have := coreA.1 + have := TnA.1 + have := congrArg GoldbergSeymour.TreeSequence.length hA + have := congrArg GoldbergSeymour.TreeSequence.length hcoreP + have := congrArg GoldbergSeymour.TreeSequence.length hclosureP + have := GoldbergSeymour.TreeSequence.positive (H.stage q.castSucc) + have := GoldbergSeymour.TreeSequence.positive A + try dsimp only [H] at * + try dsimp only [q] at * + try dsimp only [A] at * + try dsimp only [GoldbergSeymour.TreeSequencePrefix] at * + all_goals omega)⟩ : + Fin (A.length + (1 : ℕ))); + let HP : TashkinovHierarchy ettP baseP := + { + dividerCount := H0.dividerCount, stage := H0.stage, baseStage := H0.baseStage, + terminalStage := Eq.trans H0.terminalStage (Eq.symm hA), nested := H0.nested, + strict := H0.strict, dividerPosition := dividerP, dividerPositive := H0.dividerPositive, + dividerIncreasing := H0.dividerIncreasing, + dividerStage := fun (i : Fin H0.dividerCount) ↦ + ((Eq.symm + (id + (congrArg + (Eq (H0.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (H0.dividerCount + (2 : ℕ))))) + (TreeSequencePrefix.congr_simp A (H.stage q.castSucc) hA (↑(dividerP i) : ℕ) + (↑(H0.dividerPosition i) : ℕ) + (by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.HierarchyCounterexample.positive C + have := Fin.isLt q + have := Fin.isLt i + have := hAT.1 + have := coreA.1 + have := TnA.1 + have := congrArg GoldbergSeymour.TreeSequence.length hA + have := congrArg GoldbergSeymour.TreeSequence.length hcoreP + have := congrArg GoldbergSeymour.TreeSequence.length hclosureP + have := GoldbergSeymour.TreeSequence.positive (H.stage q.castSucc) + try dsimp only [H] at *)) + (H0.dividerPositive i) (Nat.le_of_lt_succ (dividerP i).isLt))))) ▸ + H0.dividerStage i), + coreInsideFirst := H0.coreInsideFirst : TashkinovHierarchy ettP baseP }; + ∀ (hc : HP.dividerCount + (1 : ℕ) = H.dividerCount) + (pStage : + ∀ (j : Fin (HP.dividerCount + (2 : ℕ))), + HP.stage j = + H.stage + (⟨(↑j : ℕ), + have this : (↑j : ℕ) < HP.dividerCount + (2 : ℕ) := j.isLt; + Decidable.byContradiction fun (a : ¬(↑j : ℕ) < H.dividerCount + (2 : ℕ)) ↦ by omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (pTree : ettP.series.data.tree (Fin.last ettP.rounds).castSucc = Tn) + (pKind : ettP.series.data.kind (Fin.last ettP.rounds) = ett.series.data.kind n) + (pStored : TashkinovStoredColors ettP.series.data (Fin.last ettP.rounds) = Dn), + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), + MaximumProperty ettA ∧ + ettA.series.data.kind (Fin.last ettA.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = C.hierarchy.dividerCount), + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ (j : Fin (K.dividerCount + (2 : ℕ))), + K.stage j = + C.hierarchy.stage + (⟨(↑j : ℕ), by omega⟩ : Fin (C.hierarchy.dividerCount + (2 : ℕ)))) ∧ + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt C.hierarchy + (⟨(↑j : ℕ), by omega⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ))) ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = + C.good.gamma (⟨(↑j : ℕ), by omega⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ))) + eta) ∧ + TreeColorSetMinusClosed G sigma + (C.hierarchy.stage + (⟨C.hierarchy.dividerCount, by omega⟩ : Fin (C.hierarchy.dividerCount + (2 : ℕ)))) + ((HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount)).biUnion + (C.good.gamma + (⟨C.hierarchy.dividerCount - (1 : ℕ), by omega⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ))))) + +private abbrev helperCaseContinuation1561Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hprefixElementary : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let ell : ℕ := T.length - A.length; + let Ty : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (le_min (le_trans A.positive (Nat.le_add_right _ _)) T.positive) + (Nat.min_le_right (A.length + (ell - (1 : ℕ))) T.length); + alpha ∈ TreeMissingColors phi Ty ∧ beta ∈ TreeMissingColors phi Ty) + (z : V ⊕ E) (hpath : TwoColorPathComponent G phi alpha beta z) (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hcase : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (0 : ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors phi Tnq ∨ + H.dividerCount = (0 : ℕ) ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ alpha ∈ TreeMissingColors phi A ∧ alpha ∉ Dn ∧ beta ∉ Dn)) + (hdisjoint : + let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ (hsproper : IsProperEdgeColoring G sigma) (hsone : IsOneEdgeUncolored sigma e0) + (houtside : + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))) (c : Fin k), + c = alpha ∨ c = beta → + c ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy r) → + TreeColorSetClosed G phi (HierarchyStarredStage C.hierarchy r) ({ c } : Finset (Fin k)) → + OutsideKempeRecoloring (HierarchyStarredStage C.hierarchy r) phi sigma alpha beta) + (preStepElementary : + let i : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + Fin ett.rounds); + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet Tn)) + (hfixed : ∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) + (hmissing : ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) + (hq : (0 : ℕ) < H.dividerCount), + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ + (hstable : + if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) + (trans : + ∀ {U W Z : TreeSequence G e0} (hUW : TreeSequenceInitialSegment U W) + (hWZ : TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z) + (hA : A = H.stage q.castSucc) (hAT : TreeSequenceInitialSegment A T) + (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))) (hj : (↑j : ℕ) ≤ H.dividerCount), + TreeSequenceInitialSegment (H.stage j) A) + (coreToStar : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j)) + (coreA : TreeSequenceInitialSegment base.core A) + (TnCore : TreeSequenceInitialSegment Tn base.core), + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), + MaximumProperty ettA ∧ + ettA.series.data.kind (Fin.last ettA.rounds) = ett.series.data.kind (Fin.last ett.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = C.hierarchy.dividerCount), + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ (j : Fin (K.dividerCount + (2 : ℕ))), + K.stage j = + C.hierarchy.stage (⟨(↑j : ℕ), by omega⟩ : Fin (C.hierarchy.dividerCount + (2 : ℕ)))) ∧ + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt C.hierarchy + (⟨(↑j : ℕ), by omega⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ))) ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = + C.good.gamma (⟨(↑j : ℕ), by omega⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ))) + eta) ∧ + TreeColorSetMinusClosed G sigma + (C.hierarchy.stage + (⟨C.hierarchy.dividerCount, by omega⟩ : Fin (C.hierarchy.dividerCount + (2 : ℕ)))) + ((HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount)).biUnion + (C.good.gamma + (⟨C.hierarchy.dividerCount - (1 : ℕ), by omega⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ))))) + +private theorem helper_corrData_414.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (∀ {U W Z : TreeSequence G e0}, + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment W Z → TreeSequenceInitialSegment U Z) → + TreeSequenceInitialSegment Tn A → + (∀ (U : TreeSequence G e0), + TreeSequenceInitialSegment U A → + TreeMissingColors sigma U = TreeMissingColors phi U) → + ∀ {input0 : PartialEdgeColoring E k} {T0 : TreeSequence G e0} + (old : ExtendedTashkinovTree G k e0 input0 T0 phi), + old.series.data.tree (Fin.last old.rounds).castSucc = Tn → + old.series.data.kind (Fin.last old.rounds) = ett.series.data.kind n → + TashkinovStoredColors old.series.data (Fin.last old.rounds) = Dn → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 old sigma A), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn Dn trans TnA treeMissingEq + input0 T0 old holdTree holdKind holdStored corr + clear * - old holdTree holdKind holdStored treeMissingEq TnA + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have hs : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases hs + let a : Fin old.rounds := ⟨old.rounds - 1, by have := old.roundsPositive; omega⟩ + have ha : a.succ = Fin.last old.rounds := by + apply Fin.ext + change old.rounds - 1 + 1 = old.rounds + have := old.roundsPositive + omega + have ht : replacementSeries.data.tree (Fin.last old.rounds).castSucc = Tn := by + rw [← ha] + have hold := holdTree + rw [← ha] at hold + exact (ladderTreesAgree a).trans hold + have hm : TreeMissingColors (replacementSeries.data.coloring (Fin.last old.rounds)) + (replacementSeries.data.tree (Fin.last old.rounds).castSucc) = + TreeMissingColors phi Tn := by + rw [← finalGeneratingColoring, ht] + exact treeMissingEq Tn TnA + have hmOld : TreeMissingColors (old.series.data.coloring (Fin.last old.rounds)) + (old.series.data.tree (Fin.last old.rounds).castSucc) = + TreeMissingColors phi Tn := by + rw [← old.generatingColoring, holdTree] + refine ⟨ht, (extensionKindsAgree (Fin.last old.rounds)).trans holdKind, ?_⟩ + rw [← holdStored] + change TashkinovStoredColors replacementSeries.data (Fin.last old.rounds) = + TashkinovStoredColors old.series.data (Fin.last old.rounds) + simp only [TashkinovStoredColors, storedColorsAgree, hm, hmOld] + +private theorem helper_branch_267.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ {u : V}, + ett.rounds = (1 : ℕ) → + u ∈ TreeSequenceVertexSet Tn → + ∀ {v : V}, + v ∈ TreeSequenceVertexSet Tn → + u ≠ v → + Disjoint + (MissingColors G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds).castSucc) + u) + (MissingColors G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds).castSucc) + v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C n Tn _ hn + have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = 0 := + Fin.ext (by simp [hn]) + have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn]) + dsimp only [Tn] + rw [hcolor, htree] + exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + +private theorem helper_branch_274.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base') (_ : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) + (hminimal : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hlarge : + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card), + let _ : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C := + { proper := hproper, oneEdgeUncolored := hone, + lowerRung := + fun {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} ↦ + hlower, + fewerDividers := + fun {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} ↦ + hfewer, + lexicographicMinimality := + fun {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} ↦ + hminimal, + largeMissingSet := hlarge : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C }; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ {u : V}, + ¬ett.rounds = (1 : ℕ) → + u ∈ TreeSequenceVertexSet Tn → + ∀ {v : V}, + v ∈ TreeSequenceVertexSet Tn → + u ≠ v → + Disjoint + (MissingColors G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds).castSucc) + u) + (MissingColors G + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds).castSucc) + v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge ctx + n Tn _ hn + have hmore : 1 < ett.rounds := by have := C.positive; omega + obtain ⟨predecessor, hr, hmaximum, _, _⟩ := + CertifiedETTPredecessor G k e0 input T phi ett C.maximum hmore + have htree : n.castSucc = (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext rfl + dsimp only [Tn] + rw [htree] + exact (ctx.lowerRung predecessor (by omega) (by omega) hmaximum).1 + +private theorem helper_hweak_291.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (if ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE then + CombinedStableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi + sigma + else + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma) → + (∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + HierarchyWeaklyStable H q sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A hbase hfixed hmissing + cases hq : q using Fin.cases with + | zero => + exact hbase + | succ i => + have hA : A = H.stage i.succ.castSucc := by + dsimp only [A] + rw [hq] + rfl + refine ⟨hbase, ?_⟩ + have he : ∀ t : Fin (H.stage i.succ.castSucc).length, + sigma ((H.stage i.succ.castSucc).edge t) = + phi ((H.stage i.succ.castSucc).edge t) := by + exact hA ▸ hfixed + have hm : ∀ v ∈ TreeSequenceVertexSet (H.stage i.succ.castSucc), + MissingColors G sigma v = MissingColors G phi v := by + simpa only [hA] using hmissing + exact ⟨fun t _ => he t, hm⟩ + +private theorem helper_trans_321.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {U W Z : TreeSequence G e0}, + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment W Z → + TreeSequenceInitialSegment U Z := by + classical + intro V E G e0 U W Z hUW hWZ + refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ + · intro j + exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) j)).trans + (hUW.2.1 j) + · intro j + exact (hWZ.2.2 (Fin.castLE hUW.1 j)).trans (hUW.2.2 j) + +private theorem helper_stageChain_332.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ {U W Z : TreeSequence G e0}, + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment W Z → TreeSequenceInitialSegment U Z) → + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) + (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H trans j + induction j with + | zero => + intro hj i hi + have hi0 : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have heq' : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) + (H.nested ⟨j, by omega⟩) + +private theorem helper_starPositive_351.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (0 : ℕ) < (↑j : ℕ) → + HierarchyStarredStage H j = H.stage j.castSucc := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H j hj + have hn : j ≠ 0 := by + intro h + have := congrArg Fin.val h + simp only [Fin.val_zero] at this + omega + rw [← Fin.succ_pred j hn] + rfl + +private theorem helper_coreToStar_371.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ {U W Z : TreeSequence G e0}, + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment W Z → TreeSequenceInitialSegment U Z) → + (∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) + (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (0 : ℕ) < (↑j : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H trans stageChain starPositive j + clear * - H trans stageChain starPositive + by_cases hj : j = 0 + · subst j + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · have hjp : 0 < j.val := by + have hne : j.val ≠ 0 := fun hh => hj (Fin.ext hh) + omega + rw [starPositive j hjp] + exact trans H.coreInsideFirst + (stageChain j.val (by omega) ⟨1, by omega⟩ (by simp; omega)) + +private theorem helper_starToA_383.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (0 : ℕ) < (↑j : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), + (↑j : ℕ) ≤ H.dividerCount → TreeSequenceInitialSegment (H.stage j) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j)) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A starPositive ordinaryToA + coreToStar j + by_cases hj : j = 0 + · subst j + exact coreToStar q + · rw [starPositive j (by + have hne : j.val ≠ 0 := fun hh => hj (Fin.ext hh) + omega)] + exact ordinaryToA j.castSucc (by have := j.isLt; simp only [Fin.val_castSucc]; omega) + +private theorem helper_preStepElementary_574.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) + (_ : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base') (_ : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) + (_ : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬HierarchyCounterexampleLess (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (_ : + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let i : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge n Tn + dsimp only + by_cases hn : ett.rounds = 1 + · apply helper_branch_267 <;> assumption + · apply helper_branch_274 <;> assumption +private theorem helper_caseContinuation_868.{u_1, u_2} : + helperCaseContinuation868Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hprefixElementary alpha beta hne z + sigma hsigma ctx H q A n Tn hsproper hsone houtside preStepElementary hfixed hmissing hq Dn + trans hA coreToStar coreA ett0 base0 H0 ettP baseP hcoreP dividerP HP hc pStage pTree fullBase + obtain ⟨inputA, ettA, hMPa, htreeA, hkindA, hstoredA, baseA, hcoreA, hclosureA⟩ := fullBase + let K : TashkinovHierarchy ettA baseA := + { dividerCount := HP.dividerCount + stage := HP.stage + baseStage := HP.baseStage.trans (pTree.trans htreeA.symm) + terminalStage := HP.terminalStage + nested := HP.nested + strict := HP.strict + dividerPosition := HP.dividerPosition + dividerPositive := HP.dividerPositive + dividerIncreasing := HP.dividerIncreasing + dividerStage := HP.dividerStage + coreInsideFirst := by + rw [hcoreA, ← hcoreP] + exact HP.coreInsideFirst } + have hcount : K.dividerCount + 1 = H.dividerCount := hc + have stageEq (j : Fin (K.dividerCount + 2)) : + K.stage j = H.stage ⟨j.val, by have := j.isLt; omega⟩ := pStage j + let R0 := (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0) + have hPEWitness (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + ∃ c : Fin k, c ∈ TreeMissingColors phi base.core \ R0 ∧ + ∃ f : E, f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet base.core) c ∧ + sigma f = phi f := by + have hold := (C.good.parallelBase hp).1 + have witness : ∃ c : Fin k, c ∈ TreeMissingColors phi base.core \ R0 ∧ + ∃ f : E, f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet base.core) c := by + by_contra hn + apply hold + intro c hc + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + exact hn ⟨c, hc, f, hf⟩ + obtain ⟨c, hc, f, hf⟩ := witness + have hcm := (Finset.mem_sdiff.mp hc).1 + have hcn := (Finset.mem_sdiff.mp hc).2 + have hb : f ∈ BoundaryEdges G (TreeSequenceVertexSet base.core) ∧ phi f = some c := + Finset.mem_filter.mp hf + have hincident : TreeIncidentEdge base.core f := by + have hends : ∃ u ∈ TreeSequenceVertexSet base.core, + ∃ v ∉ TreeSequenceVertexSet base.core, G.ends f = Sym2.mk u v := by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] using hb.1 + obtain ⟨u, hu, v, hv, he⟩ := hends + refine ⟨u, hu, ?_⟩ + rw [Incident, he] + exact Sym2.mem_mk_left _ _ + have hvalue : sigma f = phi f := by + by_cases haffected : c = alpha ∨ c = beta + · by_cases hex : ∃ j : Fin (H.dividerCount + 1), + TreeColorSetClosed G phi (HierarchyStarredStage H j) {c} + · obtain ⟨j, hj⟩ := hex + have hmj : c ∈ TreeMissingColors phi (HierarchyStarredStage H j) := by + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hcm + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset (coreToStar j) hv, hcv⟩ + have hout := houtside j c haffected hmj hj + apply (OutsideKempeRecoloringStable G e0 (HierarchyStarredStage H j) ∅ + phi sigma alpha beta ctx.proper ctx.oneEdgeUncolored hout).2.2.2.2 + obtain ⟨u, hu, huf⟩ := hincident + exact ⟨u, TreeSequenceInitialSegmentVertexSetSubset (coreToStar j) hu, huf⟩ + · have hmA : c ∈ TreeMissingColors phi A := by + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hcm + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset coreA hv, hcv⟩ + have hh := (rutcor G k e0 input T phi ett base H C.good hq + hprefixElementary preStepElementary c hmA).2 + (fun j hj => hex ⟨j, hj⟩) + have hreserved := (hh.1 (⟨0, hq⟩ : Fin H.dividerCount)).2 + exact False.elim (hcn hreserved) + · have hca : c ≠ alpha := fun h => haffected (Or.inl h) + have hcb : c ≠ beta := fun h => haffected (Or.inr h) + rw [hsigma] + simp only [TwoColorComponentSwap, hb.2, Option.some.injEq, hca, hcb, + ite_false, ite_self] + exact ⟨c, hc, f, hf, hvalue⟩ + obtain ⟨goodA, hgamma, hclosed⟩ := P2813_T1_RetainedHierarchy + G k e0 input T phi ett base H C.good hq alpha beta hne z sigma hsigma + hproper hone hsproper hsone inputA ettA baseA K htreeA hkindA hstoredA + hcount hcoreA hclosureA stageEq hfixed hmissing houtside hPEWitness + refine ⟨inputA, ettA, baseA, K, goodA, hMPa, hkindA, hcount, + hcoreA, hclosureA, stageEq, ?_, hclosed⟩ + intro j + exact ⟨(hgamma j).1, fun eta _ => (hgamma j).2 eta⟩ + +private theorem helper_caseContinuation_1156.{u_1, u_2} : + helperCaseContinuation1156Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hprefixElementary alpha beta hne + hmissingPrefix z hpath sigma hsigma hcase hdisjoint ctx H q A n Tn hsproper hsone houtside + preStepElementary hfixed hmissing hq Dn hstable trans hA hAT ordinaryToA coreToStar coreA + TnA treeMissingEq ett0 base0 H0 ettP hMPp hrp baseP hcoreP hclosureP dividerP HP hc pStage + pTree pKind pStored + have corrData {input0 : PartialEdgeColoring E k} {T0 : TreeSequence G e0} + (old : ExtendedTashkinovTree G k e0 input0 T0 phi) + (holdTree : old.series.data.tree (Fin.last old.rounds).castSucc = Tn) + (holdKind : old.series.data.kind (Fin.last old.rounds) = ett.series.data.kind n) + (holdStored : TashkinovStoredColors old.series.data (Fin.last old.rounds) = Dn) + (corr : CorrespondingExtendedTashkinovTree G k e0 old sigma A) : + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = Dn := by + apply helper_corrData_414 <;> assumption + have fullBase : + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, + MaximumProperty ettA ∧ + ettA.series.data.tree (Fin.last ettA.rounds).castSucc = Tn ∧ + ettA.series.data.kind (Fin.last ettA.rounds) = ett.series.data.kind n ∧ + TashkinovStoredColors ettA.series.data (Fin.last ettA.rounds) = Dn ∧ + ∃ baseA : HierarchyBase ettA sigma, + baseA.core = base.core ∧ baseA.closure = base.closure := by + clear * - hstable hmissing hsproper hsone hfixed treeMissingEq TnA hAT trans + hMPp hrp pTree pKind pStored baseP HP hcoreP hclosureP corrData ordinaryToA hq ctx + hprefixElementary hcase hmissingPrefix hpath hdisjoint hsigma + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · have hcombined : CombinedStableColoring Tn base.closure Dn phi sigma := by + simpa only [hp, ite_true] using hstable + have hroute : TashkinovAugmentationSequence sigma Tn A := by + rcases P2813_T1_TerminalRoute G k e0 input T phi ett with + ⟨_, hseq⟩ | ⟨hk, rest⟩ + · have hpre := TashkinovAugmentationSequenceRestrict phi Tn A T hseq TnA hAT + unfold TashkinovAugmentationSequence at hpre ⊢ + have transport : ∀ U, Relation.ReflTransGen (TashkinovAugmentation phi) Tn U → + TreeSequenceInitialSegment U A → + Relation.ReflTransGen (TashkinovAugmentation sigma) Tn U := by + intro U hseq + induction hseq with + | refl => intro _; exact Relation.ReflTransGen.refl + | @tail U W hTU hUW ih => + intro hWA + obtain ⟨hlen, hseg, c, hcolor, hcm⟩ := hUW + have hUA := trans hseg hWA + have hcmSigma : c ∈ TreeMissingColors sigma U := by + rw [treeMissingEq U hUA] + exact hcm + let t : Fin W.length := Fin.cast hlen.symm (Fin.last U.length) + have he : sigma (W.edge t) = phi (W.edge t) := by + rw [← hWA.2.2 t] + exact hfixed _ + exact Relation.ReflTransGen.tail (ih hUA) + ⟨hlen, hseg, c, he.trans hcolor, hcmSigma⟩ + exact transport A hpre ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · rcases hk with hk | hk <;> rw [hp] at hk <;> cases hk + have hcombinedP : CombinedStableColoring + (ettP.series.data.tree (Fin.last ettP.rounds).castSucc) baseP.closure + (TashkinovStoredColors ettP.series.data (Fin.last ettP.rounds)) phi sigma := by + rw [pTree, pStored, hclosureP] + exact hcombined + obtain ⟨corr, hMP, baseA, K0, hsame⟩ := HierarchySplitter G k e0 input A phi sigma + ettP hMPp (by rw [hrp]; exact C.positive) + (by + intro input' T' generating' lower hpos hless hmax + rw [hrp] at hless + exact ctx.lowerRung lower hpos hless hmax) + baseP HP (pKind.trans hp) ctx.proper ctx.oneEdgeUncolored hsproper hsone hcombinedP + (by rw [pTree]; exact hroute) + have hd := corrData ettP pTree pKind pStored corr + exact ⟨corr.replacementInput, corr.replacementETT, hMP, hd.1, hd.2.1, hd.2.2, + baseA, hsame.1.symm.trans hcoreP, + (hsame.2.2.2.2.2 (pKind.trans hp)).symm.trans hclosureP⟩ + · have hh := P2813_T1_PrefixReconstruction G k e0 input T phi ett base C ctx sigma + hsproper hsone hstable hfixed hmissing + rcases hh.2 with he | ⟨corr, hMP⟩ + · have hstrict : (H.stage (0 : Fin (H.dividerCount + 2))).length < + (H.stage ⟨1, by omega⟩).length := H.strict 0 + have hle := ordinaryToA ⟨1, by omega⟩ (by simp; omega) + rw [H.baseStage] at hstrict + have hlen := congrArg TreeSequence.length he + change A.length = Tn.length at hlen + have : Tn.length < (H.stage ⟨1, by omega⟩).length := hstrict + exact False.elim ((Nat.ne_of_lt (lt_of_lt_of_le this hle.1)) hlen.symm) + · have hd := corrData ett rfl rfl rfl corr + let pos : Fin ((corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc).length + 1) := + Fin.cast (congrArg (fun W : TreeSequence G e0 => W.length + 1) hd.1.symm) + base.supportPosition + let baseA : HierarchyBase corr.replacementETT sigma := + { core := base.core + closure := base.closure + supportPosition := pos + supportPositive := by simpa only [pos, Fin.val_cast] using base.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only + intro hPE + exact False.elim (hp (hd.2.1.symm.trans hPE)) + nonparallel := by + dsimp only + intro _ + exact (base.nonparallel hp).trans hd.1.symm } + exact ⟨corr.replacementInput, corr.replacementETT, hMP, hd.1, hd.2.1, hd.2.2, + baseA, rfl, rfl⟩ + exact @helper_caseContinuation_868 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hprefixElementary) (@alpha) (@beta) (@hne) (@z) (@sigma) (@hsigma) (@ctx) (@hsproper) + (@hsone) (@houtside) (@preStepElementary) (@hfixed) (@hmissing) (@hq) (@trans) (@hA) + (@coreToStar) (@coreA) (@ett0) (@base0) (@H0) (@hcoreP) (@hc) (@pStage) (@pTree) (@fullBase) + +private theorem helper_caseContinuation_1561.{u_1, u_2} : + helperCaseContinuation1561Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hprefixElementary alpha beta hne + hmissingPrefix z hpath sigma hsigma hcase hdisjoint ctx H q A n Tn hsproper hsone houtside + preStepElementary hfixed hmissing hq Dn hstable trans hA hAT ordinaryToA coreToStar coreA + TnCore + have TnA := trans TnCore coreA + have treeMissingEq (U : TreeSequence G e0) + (hUA : TreeSequenceInitialSegment U A) : + TreeMissingColors sigma U = TreeMissingColors phi U := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl + (fun v hv => hmissing v (TreeSequenceInitialSegmentVertexSetSubset hUA hv)) + have prefixPackage := GoodHierarchyPrefixRepackage G k e0 input T phi phi ett + C.maximum base H C.good q (by change 1 ≤ H.dividerCount; omega) + obtain ⟨ett0, hMP0, hr0, hs0, base0, hcore0, hclosure0, hsupport0, + H0, hcount0, hstage0, hdivider0, good0, hgamma0, hclosed0⟩ := prefixPackage + let ettP : ExtendedTashkinovTree G k e0 input A phi := + { rounds := ett0.rounds + roundsPositive := ett0.roundsPositive + series := ett0.series + abovePenultimate := by rw [hA]; exact ett0.abovePenultimate + strictAbovePenultimate := by rw [hA]; exact ett0.strictAbovePenultimate + belowFinal := by rw [hA]; exact ett0.belowFinal + generatingColoring := ett0.generatingColoring } + have hMPp : MaximumProperty ettP := hMP0 + have hrp : ettP.rounds = ett.rounds := hr0 + have hsp : HEq ettP.series ett.series := hs0 + let baseP : HierarchyBase ettP phi := + { core := base0.core + closure := base0.closure + supportPosition := base0.supportPosition + supportPositive := base0.supportPositive + terminalMissingColors := base0.terminalMissingColors + parallel := base0.parallel + nonparallel := base0.nonparallel } + have hcoreP : baseP.core = base.core := hcore0 + have hclosureP : baseP.closure = base.closure := hclosure0 + let dividerP (i : Fin H0.dividerCount) : Fin (A.length + 1) := + ⟨(H0.dividerPosition i).val, by rw [hA]; exact (H0.dividerPosition i).isLt⟩ + let HP : TashkinovHierarchy ettP baseP := + { dividerCount := H0.dividerCount + stage := H0.stage + baseStage := H0.baseStage + terminalStage := H0.terminalStage.trans hA.symm + nested := H0.nested + strict := H0.strict + dividerPosition := dividerP + dividerPositive := H0.dividerPositive + dividerIncreasing := H0.dividerIncreasing + dividerStage := by + intro i + simpa only [dividerP, hA] using H0.dividerStage i + coreInsideFirst := H0.coreInsideFirst } + have hc : HP.dividerCount + 1 = H.dividerCount := by + clear * - hcount0 hq + have hh : HP.dividerCount = H.dividerCount - 1 := hcount0 + omega + have pStage (j : Fin (HP.dividerCount + 2)) : + HP.stage j = H.stage ⟨j.val, by have := j.isLt; omega⟩ := by + clear * - hc hstage0 + have hh := hstage0 (⟨j.val, by have := j.isLt; change j.val < H.dividerCount + 1; omega⟩) + simpa only [Fin.cast, Fin.val_mk, Fin.eta] using hh + have pTree : ettP.series.data.tree (Fin.last ettP.rounds).castSucc = Tn := by + change ett0.series.data.tree (Fin.last ett0.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc + clear * - hr0 hs0 + cases ett0 + cases ett + dsimp only at hr0 hs0 ⊢ + cases hr0 + rw [eq_of_heq hs0] + have pKind : ettP.series.data.kind (Fin.last ettP.rounds) = ett.series.data.kind n := by + change ett0.series.data.kind (Fin.last ett0.rounds) = ett.series.data.kind (Fin.last + ett.rounds) + clear * - hr0 hs0 + cases ett0 + cases ett + dsimp only at hr0 hs0 ⊢ + cases hr0 + rw [eq_of_heq hs0] + have pStored : TashkinovStoredColors ettP.series.data (Fin.last ettP.rounds) = Dn := by + change TashkinovStoredColors ett0.series.data (Fin.last ett0.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) + clear * - hr0 hs0 + cases ett0 + cases ett + dsimp only at hr0 hs0 ⊢ + cases hr0 + rw [eq_of_heq hs0] + exact @helper_caseContinuation_1156 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hprefixElementary) (@alpha) (@beta) (@hne) (@hmissingPrefix) (@z) (@hpath) (@sigma) + (@hsigma) (@hcase) (@hdisjoint) (@ctx) (@hsproper) (@hsone) (@houtside) + (@preStepElementary) (@hfixed) (@hmissing) (@hq) (@hstable) (@trans) (@hA) (@hAT) + (@ordinaryToA) (@coreToStar) (@coreA) (@TnA) (@treeMissingEq) (@ett0) (@base0) (@H0) + (@hMPp) (@hrp) (@hcoreP) (@hclosureP) (@hc) (@pStage) (@pTree) (@pKind) (@pStored) + +theorem StableChangeCasesOneTwo {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hminimal : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + {other : ExtendedTashkinovTree G k e0 input' T' generating'} + {base' : HierarchyBase other generating'} + (C' : HierarchyCounterexample base'), + other.rounds = ett.rounds → + C'.hierarchy.dividerCount = C.hierarchy.dividerCount → + ¬ HierarchyCounterexampleLess + (HierarchyCounterexampleMeasure C') + (HierarchyCounterexampleMeasure C)) + (hprefixElementary : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Ty)) + (hlarge : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + 2 * ett.rounds + 11 ≤ (TreeMissingColors phi Tn).card) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let ell := T.length - A.length + let Ty := TreeSequencePrefix T + (min (A.length + (ell - 1)) T.length) + (by have hA := A.positive; have hT := T.positive; omega) + (Nat.min_le_right _ _) + alpha ∈ TreeMissingColors phi Ty ∧ + beta ∈ TreeMissingColors phi Ty) + (z : Sum V E) (hpath : TwoColorPathComponent G phi alpha beta z) + (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hcase : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + (0 < H.dividerCount ∧ alpha ∈ TreeMissingColors phi Tnq) ∨ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + (alpha ∈ TreeMissingColors phi A ∧ + alpha ∉ Dn ∧ beta ∉ Dn)))) + (hdisjoint : + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dnq := HierarchyStoredColorsAt H q + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + (A = Tn ∨ + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, + MaximumProperty ettA) ∧ + (∀ hq : 0 < H.dividerCount, + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, + ∃ baseA : HierarchyBase ettA sigma, + ∃ K : TashkinovHierarchy ettA baseA, + ∃ goodA : GoodHierarchy K, + MaximumProperty ettA ∧ + ettA.series.data.kind (Fin.last ettA.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + ∃ hcount : K.dividerCount + 1 = H.dividerCount, + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ j : Fin (K.dividerCount + 2), + K.stage j = H.stage ⟨j.val, by omega⟩) ∧ + (∀ j : Fin (K.dividerCount + 1), + let jH : Fin (H.dividerCount + 1) := + ⟨j.val, by omega⟩ + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt H jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq + (Dnq.biUnion + (C.good.gamma ⟨C.hierarchy.dividerCount - 1, + by omega⟩))) := by + classical + let ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C := { + proper := hproper + oneEdgeUncolored := hone + lowerRung := hlower + fewerDividers := hfewer + lexicographicMinimality := hminimal + largeMissingSet := hlarge } + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + have controls := P2813_T1_BaseControl G k e0 input T phi ett base C ctx + hprefixElementary alpha beta hne hmissingPrefix z hpath sigma hsigma hcase hdisjoint + rcases controls with ⟨hbase, hmissing, hsproper, hsone, houtside⟩ + have preStepElementary : + let i : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn) := by + apply helper_preStepElementary_574 <;> assumption + have hfixed := P2813_T1_DisplayedEdges G k e0 input T phi ett base H C.good + hproper hone preStepElementary hprefixElementary alpha beta z sigma hsigma hsone + hbase houtside + have rebuilt := P2813_T1_PrefixReconstruction G k e0 input T phi ett base C ctx + sigma hsproper hsone hbase hfixed hmissing + change (∀ t : Fin A.length, sigma (A.edge t) = phi (A.edge t)) at hfixed + change (∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) at hmissing + have hweak := helper_hweak_291 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@sigma) + (@hbase) (@hfixed) (@hmissing) + refine ⟨hweak, rebuilt.1, ?_, ?_⟩ + · rcases rebuilt.2 with he | ⟨corr, hMP⟩ + · exact Or.inl he + · exact Or.inr ⟨corr.replacementInput, corr.replacementETT, hMP⟩ + · dsimp only + intro hq + change 0 < H.dividerCount at hq + let Dn := TashkinovStoredColors ett.series.data n + have hstable := hbase + change (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) at hstable + have trans {U W Z : TreeSequence G e0} + (hUW : TreeSequenceInitialSegment U W) + (hWZ : TreeSequenceInitialSegment W Z) : + TreeSequenceInitialSegment U Z := by + exact helper_trans_321 (@G) (@e0) (@hUW) (@hWZ) + have stageChain : ∀ (j : ℕ) (hj : j < H.dividerCount + 2) + (i : Fin (H.dividerCount + 2)), i.val ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage ⟨j, hj⟩) := by + apply helper_stageChain_332; assumption + have starPositive := helper_starPositive_351 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) + have hA : A = H.stage q.castSucc := starPositive q hq + have hAT : TreeSequenceInitialSegment A T := by + rw [hA] + have hh := H.nested q + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa only [hlast, H.terminalStage] using hh + have ordinaryToA (j : Fin (H.dividerCount + 2)) (hj : j.val ≤ H.dividerCount) : + TreeSequenceInitialSegment (H.stage j) A := by + rw [hA] + exact stageChain H.dividerCount (by omega) j hj + have coreToStar (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j) := by + apply helper_coreToStar_371 <;> assumption + have starToA := helper_starToA_383 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@alpha) (@beta) (@hne) (@starPositive) (@ordinaryToA) (@coreToStar) + have coreA : TreeSequenceInitialSegment base.core A := coreToStar q + have TnCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (base.parallel hp).2.2.some.leftSegment + · rw [base.nonparallel hp] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + exact @helper_caseContinuation_1561 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) + (@hprefixElementary) (@alpha) (@beta) (@hne) (@hmissingPrefix) (@z) (@hpath) (@sigma) + (@hsigma) (@hcase) (@hdisjoint) (@ctx) (@hsproper) (@hsone) (@houtside) + (@preStepElementary) (@hfixed) (@hmissing) (@hq) (@hstable) (@trans) (@hA) (@hAT) + (@ordinaryToA) (@coreToStar) (@coreA) (@TnCore) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean new file mode 100644 index 0000000000..fce18f169a --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean @@ -0,0 +1,1643 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.BaseControl +public import LeanPool.GoldbergSeymour.DisplayedEdges +public import LeanPool.GoldbergSeymour.RecoloredPrefixReconstruction +public import LeanPool.GoldbergSeymour.MinusClosedTransport +public import LeanPool.GoldbergSeymour.PrefixSegmentTransport +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition + +/-! +# Stable Change Cases One Two Full Tail + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperPositivePackage887Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (alpha beta : Fin k) + (hne : alpha ≠ beta) (z : V ⊕ E) (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ + (outside : + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))) (c : Fin k), + c = alpha ∨ c = beta → + c ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy r) → + TreeColorSetClosed G phi (HierarchyStarredStage C.hierarchy r) { c } → + OutsideKempeRecoloring (HierarchyStarredStage C.hierarchy r) phi sigma alpha beta) + (missingA : ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) + (TnToA : TreeSequenceInitialSegment Tn A) + (ordinaryToA : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) A) + (treeMissingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → TreeMissingColors sigma S = TreeMissingColors phi S) + (combined : + ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi sigma) + (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT → + ∀ (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (hclosureT : baseT.closure = base.closure) + (terminalData : + corrT.replacementETT.series.data.tree (Fin.last corrT.replacementETT.rounds).castSucc = Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { + dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + ∀ + (starredEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) + (storedEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) + (stageMissingEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j) + (segmentEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, + HierarchySegmentColors K j eta = HierarchySegmentColors H j eta) + (parallelNotClosed : + ett.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma base.core + ((HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))))), + let goodT : GoodHierarchy K := + { + gamma := C.good.gamma, + twoColors := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) => + C.good.twoColors j eta + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) => eta ∈ _a) (storedEq j)) heta), + avoidance := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) ⦃c : Fin k⦄ (hc : c ∈ C.good.gamma j eta) => + have ho : eta ∈ HierarchyStoredColorsAt H j := + Eq.mpr (id (congrArg (fun (_a : Finset (Fin k)) => eta ∈ _a) (Eq.symm (storedEq j)))) + heta; + Eq.mpr + (id + (congrArg (fun (_a : Finset (Fin k)) => c ∈ _a \ HierarchySegmentColors K j eta) + (stageMissingEq j))) + (Eq.mpr + (id + (congrArg (fun (_a : Finset (Fin k)) => c ∈ HierarchyStageMissingColors H j \ _a) + (segmentEq j eta ho))) + (C.good.avoidance j eta ho hc)), + disjointPairs := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta theta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt K j) (htheta : theta ∈ HierarchyStoredColorsAt K j) + (hne : eta ≠ theta) => + C.good.disjointPairs j eta theta + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) => eta ∈ _a) (storedEq j)) heta) + (Eq.mp (congrArg (fun (_a : Finset (Fin k)) => theta ∈ _a) (storedEq j)) htheta) hne, + uniqueRefresh := fun (i : Fin K.dividerCount) => + have hnew : + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun (v : V) => MissingColors G sigma v) = + (TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun (v : V) => MissingColors G phi v := + Finset.biUnion_congr rfl + fun (v : V) + (hv : + v ∈ + TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)) => + missingA v + (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA i.succ) + (Finset.mem_sdiff.mp hv).left); + id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + (C.good.gamma i.succ eta ⊆ + (TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet _a).biUnion + fun (v : V) => MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, + theta ≠ eta → C.good.gamma i.succ theta = C.good.gamma i.castSucc theta) + (starredEq i.castSucc))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) => + ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + C.good.gamma i.succ eta ⊆ _a ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, + theta ≠ eta → C.good.gamma i.succ theta = C.good.gamma i.castSucc theta) + hnew)) + (Eq.mpr + (id + (congrArg ExistsUnique + (funext fun (eta : Fin k) => + congr + (congrArg And + (congrFun' + (congrArg Membership.mem + ((fun (j : Fin (H.dividerCount + (1 : ℕ))) => storedEq j) i.succ)) + eta)) + (congrArg + (And + (C.good.gamma i.succ eta ⊆ + (TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun (v : V) => MissingColors G phi v)) + (forall_congr fun (theta : Fin k) => + implies_congr + (congrFun' + (congrArg Membership.mem + ((fun (j : Fin (H.dividerCount + (1 : ℕ))) => storedEq j) i.succ)) + theta) + (Eq.refl + (theta ≠ eta → + C.good.gamma i.succ theta = C.good.gamma i.castSucc theta))))))) + (C.good.uniqueRefresh i)))), + parallelBase := + id + fun + (hp : + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + some TashkinovExtensionKind.PE) => + have hpOld : ett.series.data.kind n = some TashkinovExtensionKind.PE := + Eq.trans (Eq.symm terminalData.right.left) hp; + (⟨id + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + ¬TreeColorSetMinusClosed G sigma _a + ((HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) + hcoreT)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) => + ¬TreeColorSetMinusClosed G sigma base.core + (_a.biUnion (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) + (storedEq (0 : Fin (H.dividerCount + (1 : ℕ)))))) + (parallelNotClosed hpOld))), + id + (have closureMissing : + TreeMissingColors sigma base.closure = TreeMissingColors phi base.closure := + id (Finset.biUnion_congr rfl (combined hpOld).right.right); + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + (4 : ℕ) ≤ + ((TreeMissingColors sigma _a ∩ TreeMissingColors sigma baseT.closure) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) + terminalData.left)) + (Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma _a) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) + hclosureT)) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) => + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma base.closure) \ + _a.biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) + (storedEq (0 : Fin (H.dividerCount + (1 : ℕ)))))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) => + (4 : ℕ) ≤ + ((_a ∩ TreeMissingColors sigma base.closure) \ + (HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) + (treeMissingEq Tn TnToA))) + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) => + (4 : ℕ) ≤ + ((TreeMissingColors phi Tn ∩ _a) \ + (HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card) + closureMissing)) + (C.good.parallelBase hpOld).right)))))⟩ : + ¬TreeColorSetMinusClosed G sigma baseT.core + ((HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (K.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseT.closure) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (K.dividerCount + (1 : ℕ))))).card), + minusClosed := fun (i : Fin K.dividerCount) => + id + (Eq.mpr + (id + (congrArg + (fun (_a : Finset (Fin k)) => + TreeColorSetMinusClosed G sigma (H.stage i.succ.castSucc) + (_a.biUnion (C.good.gamma i.castSucc))) + (storedEq i.succ))) + (P2813_T1_MinusClosedTransport G k e0 (C.hierarchy.stage i.succ.castSucc) phi sigma + alpha beta hne z hsigma ctx.proper ctx.oneEdgeUncolored + ((HierarchyStoredColorsAt C.hierarchy i.succ).biUnion (C.good.gamma i.castSucc)) + (C.good.minusClosed i) + (fun (v : V) (hv : v ∈ TreeSequenceVertexSet (C.hierarchy.stage i.succ.castSucc)) => + missingA v (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA i.succ) hv)) + (outside i.succ))) : + GoodHierarchy K }; + (0 : ℕ) < C.hierarchy.dividerCount → + (1 : ℕ) ≤ (↑q : ℕ) → + ∀ (U : TreeSequence G e0), + U = H.stage q.castSucc → + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA U sigma) + (baseA : HierarchyBase ettA sigma) (KA : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy KA), + MaximumProperty ettA ∧ + ∃ (hcount : KA.dividerCount + (1 : ℕ) = H.dividerCount), + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ (j : Fin (KA.dividerCount + (2 : ℕ))), + KA.stage j = H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ + (∀ (j : Fin (KA.dividerCount + (1 : ℕ))), + let jH : Fin (H.dividerCount + (1 : ℕ)) := + (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (1 : ℕ))); + HierarchyStoredColorsAt KA j = HierarchyStoredColorsAt H jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt KA j, goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma + (H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + ((HierarchyStoredColorsAt H q).biUnion + (C.good.gamma + (⟨H.dividerCount - (1 : ℕ), + Nat.lt_succ_of_le (Nat.sub_le H.dividerCount (1 : ℕ))⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ))))) + +private abbrev helperContinuation1171Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (2 : ℕ) ≤ T.length - A.length → + (∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))) (c : Fin k), + c = alpha ∨ c = beta → + c ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy r) → + TreeColorSetClosed G phi (HierarchyStarredStage C.hierarchy r) { c } → + OutsideKempeRecoloring (HierarchyStarredStage C.hierarchy r) phi sigma alpha beta) → + ModColoring ett sigma → + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∨ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 ett sigma + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount))), + MaximumProperty corr.replacementETT) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + (∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → S.length = U.length → S = U) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → A = H.stage q.castSucc) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn base.core → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + HierarchyWeaklyStable H q sigma → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi sigma) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT → + ∀ (baseT : HierarchyBase corrT.replacementETT sigma) + (hcoreT : baseT.core = base.core), + baseT.closure = base.closure → + ∀ + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind + (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { + dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, + strict := H.strict, dividerPosition := H.dividerPosition, + dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, + dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + TreeSequenceInitialSegment _a + (H.stage + (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = + HierarchyStageMissingColors H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, + HierarchySegmentColors K j eta = + HierarchySegmentColors H j eta) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA A sigma), + MaximumProperty ettA) ∧ + ((0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA A sigma) (baseA : + HierarchyBase ettA sigma) (K : + TashkinovHierarchy ettA baseA) (goodA : GoodHierarchy K), + MaximumProperty ettA ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ (j : Fin (K.dividerCount + (2 : ℕ))), + K.stage j = + H.stage + (⟨(↑j : ℕ), by omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∧ + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + let jH : Fin (H.dividerCount + (1 : ℕ)) := + (⟨(↑j : ℕ), by omega⟩ : + Fin (H.dividerCount + (1 : ℕ))); + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt H jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq + (Dnq.biUnion + (C.good.gamma + (⟨C.hierarchy.dividerCount - (1 : ℕ), by + omega⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) ∧ + ∃ (corrT : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT ∧ + ∃ (baseT : HierarchyBase corrT.replacementETT sigma) (K : + TashkinovHierarchy corrT.replacementETT baseT) (goodT : + GoodHierarchy K), SameGoodHierarchy C.good goodT + +private abbrev helperContinuation1123Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + (∀ + v ∈ + TreeSequenceVertexSet (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ))), + MissingColors G sigma v = MissingColors G phi v) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ eta ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition phi T eta) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + (if ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE then + CombinedStableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma + else + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma) → + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))) (c : Fin k), + c = alpha ∨ c = beta → + c ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy r) → + TreeColorSetClosed G phi (HierarchyStarredStage C.hierarchy r) { c } → + OutsideKempeRecoloring (HierarchyStarredStage C.hierarchy r) phi sigma alpha + beta) → + ModColoring ett sigma → + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∨ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 ett sigma + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount))), + MaximumProperty corr.replacementETT) → + (∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → sigma (T.edge t) = phi (T.edge t)) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + (∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → S.length = U.length → S = U) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (H.stage j) T) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → A = H.stage q.castSucc) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn base.core → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA A sigma), + MaximumProperty ettA) ∧ + ((0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA A sigma) (baseA : + HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) + (goodA : GoodHierarchy K), + MaximumProperty ettA ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ (j : Fin (K.dividerCount + (2 : ℕ))), + K.stage j = + H.stage + (⟨(↑j : ℕ), by omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∧ + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + let jH : Fin (H.dividerCount + (1 : ℕ)) := + (⟨(↑j : ℕ), by omega⟩ : + Fin (H.dividerCount + (1 : ℕ))); + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt H jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq + (Dnq.biUnion + (C.good.gamma + (⟨C.hierarchy.dividerCount - (1 : ℕ), by omega⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) ∧ + ∃ (corrT : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT ∧ + ∃ (baseT : HierarchyBase corrT.replacementETT sigma) (K : + TashkinovHierarchy corrT.replacementETT baseT) (goodT : + GoodHierarchy K), SameGoodHierarchy C.good goodT + +private theorem helper_corrData_383.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + TreeSequenceInitialSegment Tn A → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn Dn TnToA treeMissingEq corr + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have hs : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases hs + let a : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have ha : a.succ = Fin.last ett.rounds := by + apply Fin.ext + change ett.rounds - 1 + 1 = ett.rounds + have := ett.roundsPositive + omega + have ht : replacementSeries.data.tree (Fin.last ett.rounds).castSucc = Tn := by + change replacementSeries.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc + rw [← ha] + exact ladderTreesAgree a + have hm : TreeMissingColors (replacementSeries.data.coloring (Fin.last ett.rounds)) + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) = TreeMissingColors phi Tn + := by + rw [← finalGeneratingColoring, ht] + exact treeMissingEq Tn TnToA + have hmOld : TreeMissingColors (ett.series.data.coloring (Fin.last ett.rounds)) + (ett.series.data.tree (Fin.last ett.rounds).castSucc) = TreeMissingColors phi Tn := by + rw [← ett.generatingColoring] + refine ⟨ht, extensionKindsAgree (Fin.last ett.rounds), ?_⟩ + change TashkinovStoredColors replacementSeries.data (Fin.last ett.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) + simp only [TashkinovStoredColors, storedColorsAgree, hm, hmOld] + +private theorem helper_fullBase_422.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (sigma : PartialEdgeColoring E k), + let _ : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + ModColoring ett sigma → + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi sigma) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed T) → + (∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corr.replacementETT ∧ + ∃ (baseT : HierarchyBase corr.replacementETT sigma), + baseT.core = base.core ∧ baseT.closure = base.closure := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx sigma H n Tn Dn sigmaProper sigmaOne hmod + combined sigmaRoute corrData + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · have hb : TashkinovAugmentationSequence sigma Tn T := by + rcases sigmaRoute with ⟨_, hseq⟩ | ⟨hk, rest⟩ + · exact hseq + · rcases hk with hk | hk <;> rw [hp] at hk <;> cases hk + obtain ⟨corr, hMP, baseT, K0, hsame⟩ := HierarchySplitter G k e0 input T phi sigma + ett C.maximum C.positive ctx.lowerRung base H hp ctx.proper ctx.oneEdgeUncolored + sigmaProper sigmaOne (combined hp) hb + exact ⟨corr, hMP, baseT, hsame.1.symm, (hsame.2.2.2.2.2 hp).symm⟩ + · obtain ⟨corr⟩ := hmod.2.2 T ett.abovePenultimate ett.strictAbovePenultimate sigmaRoute + have hd := corrData corr + let pos : Fin ((corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc).length + 1) := + Fin.cast (congrArg (fun W : TreeSequence G e0 => W.length + 1) hd.1.symm) + base.supportPosition + let baseT : HierarchyBase corr.replacementETT sigma := { + core := base.core + closure := base.closure + supportPosition := pos + supportPositive := by simpa [pos] using base.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only + intro hPE + exact False.elim (hp (hd.2.1.symm.trans hPE)) + nonparallel := by + dsimp only + intro _ + exact (base.nonparallel hp).trans hd.1.symm } + exact ⟨corr, MaximumPropertyTransport G k e0 ett sigma hmod T corr C.maximum, + baseT, rfl, rfl⟩ + +private theorem helper_segmentEq_489.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ eta ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, + HierarchySegmentColors K j eta = HierarchySegmentColors H j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma hstoredFirst H q A n Tn Dn fixedA + missingA stageToT AToT ordinaryToA fixedT corrT baseT hcoreT terminalData K starredEq j eta + heta + by_cases hj : j.val < H.dividerCount + · have hjA : TreeSequenceInitialSegment (H.stage j.succ) A := by + let js : Fin (H.dividerCount + 1) := ⟨j.val + 1, by omega⟩ + have he : js.castSucc = j.succ := Fin.ext rfl + simpa only [he] using ordinaryToA js + have hcut := HierarchyFirstMissingPositionPrefixCutoff sigma A T AToT eta + (H.stage j.succ).length hjA.1 + have hseg := P2813_T1_PrefixSegmentTransport phi sigma (H.stage j.succ) A T + hjA AToT fixedA missingA eta (HierarchyStarredStage H j).length + unfold HierarchySegmentColors + dsimp only + rw [starredEq j, ← hcut] + exact hseg + · have he : j = q := Fin.ext (by simp [q]; have := j.isLt; omega) + subst j + unfold HierarchySegmentColors + dsimp only + rw [starredEq q, hstoredFirst eta heta] + apply Finset.filter_congr + intro c _ + constructor <;> rintro ⟨t, hlo, hhi, hc⟩ <;> refine ⟨t, hlo, hhi, ?_⟩ + · change sigma ((H.stage q.succ).edge t) = some c at hc + have hf : sigma ((H.stage q.succ).edge t) = phi ((H.stage q.succ).edge t) := by + rw [← (stageToT q.succ).2.2 t] + exact fixedT _ + exact hf.symm.trans hc + · have hf : sigma ((H.stage q.succ).edge t) = phi ((H.stage q.succ).edge t) := by + rw [← (stageToT q.succ).2.2 t] + exact fixedT _ + exact hf.trans hc + +private theorem helper_parallelNotClosed_549.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + (∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → S.length = U.length → S = U) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn base.core → + TreeSequenceInitialSegment A T → + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + base.core.length < + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))).length → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma base.core + ((HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn segTrans commonPrefix + equalTrees stageToT coreToA TnToCore AToT fixedT treeMissingEq coreStrict hp + have hseq : TashkinovAugmentationSequence phi Tn T := by + rcases P2813_T1_TerminalRoute G k e0 input T phi ett with + ⟨_, hseq⟩ | ⟨hk, rest⟩ + · exact hseq + · rcases hk with hk | hk <;> rw [hp] at hk <;> cases hk + have coreToT := segTrans coreToA AToT + have suffix := TashkinovAugmentationSequenceSuffix phi Tn base.core T + hseq TnToCore coreToT + let t : Fin T.length := ⟨base.core.length, by + have := (stageToT ⟨1, by omega⟩).1 + omega⟩ + let S := TreeSequencePrefix T t.val base.core.positive (Nat.le_of_lt t.isLt) + let U := TreeSequencePrefix T (t.val + 1) (by have := base.core.positive; omega) + (Nat.succ_le_of_lt t.isLt) + have hS : S = base.core := by + apply (equalTrees (commonPrefix coreToT + (show TreeSequenceInitialSegment S T from + ⟨Nat.le_of_lt t.isLt, fun _ => rfl, fun _ => rfl⟩) le_rfl) rfl).symm + have aug := (TashkinovAugmentationSequencePosition phi base.core T suffix t le_rfl).1 + change TashkinovAugmentation phi S U at aug + obtain ⟨hlen, hSU, c, hcol, hcm⟩ := aug + have hcolT : phi (T.edge t) = some c := by + have he : U.edge (Fin.cast hlen.symm (Fin.last S.length)) = T.edge t := by + change T.edge _ = T.edge t + apply congrArg T.edge + apply Fin.ext + rfl + rw [← he] + exact hcol + have hcmCore : c ∈ TreeMissingColors phi base.core := hS ▸ hcm + have hcSigma : c ∈ TreeMissingColors sigma base.core := by + rw [treeMissingEq base.core coreToA]; exact hcmCore + have hreserved : c ∉ (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0) := by + intro hc + obtain ⟨eta, heta, hcg⟩ := Finset.mem_biUnion.mp hc + have hn : eta ∉ TreeMissingColors phi base.core := (Finset.mem_sdiff.mp heta).2 + have hfirst : base.core.length < (HierarchyFirstMissingPosition phi T eta).val := by + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + eta ∈ MissingColors G phi (T.vertex j) + unfold HierarchyFirstMissingPosition + change base.core.length < (if h : candidates.Nonempty then candidates.min' h + else Fin.last T.length).val + split + · rename_i hnon + by_contra hh + have hle : (candidates.min' hnon).val ≤ base.core.length := by omega + let j : Fin (base.core.length + 1) := ⟨(candidates.min' hnon).val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ coreToT.1) j = candidates.min' hnon := Fin.ext rfl + have hm := (Finset.mem_filter.mp (Finset.min'_mem candidates hnon)).2 + apply hn + refine Finset.mem_biUnion.mpr ⟨base.core.vertex j, ?_, ?_⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + · rw [← coreToT.2.1 j, he]; exact hm + · exact t.isLt + have hseg : c ∈ HierarchySegmentColors H 0 eta := by + let r : Fin (H.stage (0 : Fin (H.dividerCount + 1)).succ).length := + ⟨base.core.length, coreStrict⟩ + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, r, le_rfl, Nat.lt_min.mpr ⟨hfirst, coreStrict⟩, ?_⟩ + have he : Fin.castLE (stageToT (0 : Fin (H.dividerCount + 1)).succ).1 r = t := Fin.ext rfl + rw [← (stageToT (0 : Fin (H.dividerCount + 1)).succ).2.2 r, he] + exact hcolT + exact (Finset.mem_sdiff.mp (C.good.avoidance 0 eta heta hcg)).2 hseg + have hboundary : T.edge t ∈ BoundaryEdges G (TreeSequenceVertexSet base.core) := by + clear * - T t base coreToT + obtain ⟨i, hi⟩ := T.attaches t + let old : Fin (base.core.length + 1) := ⟨i.val, i.isLt⟩ + let it : Fin (T.length + 1) := Fin.castLE (Nat.succ_le_succ coreToT.1) old + have hOld : T.vertex it = base.core.vertex old := coreToT.2.1 old + have hNew : T.vertex t.succ ∉ TreeSequenceVertexSet base.core := by + intro hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨j, hj⟩ := hv + have he := T.vertex_injective (hj.symm.trans (coreToT.2.1 j).symm) + have hval := congrArg Fin.val he + have := j.isLt + change base.core.length + 1 = j.val at hval + omega + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨T.vertex it, ?_, T.vertex t.succ, hNew, ?_⟩ + · rw [hOld] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨old, rfl⟩ + · have he : Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ t.isLt)) = it := Fin.ext rfl + rw [hi, he] + exact Sym2.eq_swap + intro hclosed + have hf : T.edge t ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet base.core) c := + Finset.mem_filter.mpr ⟨hboundary, (fixedT t).trans hcolT⟩ + rw [hclosed c (Finset.mem_sdiff.mpr ⟨hcSigma, hreserved⟩)] at hf + exact Finset.notMem_empty _ hf + +private theorem helper_coreStrict_772.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (2 : ℕ) ≤ T.length - A.length → + (∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → S.length = U.length → S = U) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + base.core.length < + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))).length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A htwo equalTrees lastZero + by_cases hz : H.dividerCount = 0 + · have he : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp [hz]) + rw [he, H.terminalStage] + change 2 ≤ T.length - A.length at htwo + rw [lastZero hz] at htwo + omega + · by_contra hnot + have hlen : base.core.length = (H.stage ⟨1, by omega⟩).length := by + have := H.coreInsideFirst.1 + omega + have he := equalTrees H.coreInsideFirst hlen + let i : Fin H.dividerCount := ⟨0, by omega⟩ + obtain ⟨eta, ⟨heta, hgamma, _⟩, _⟩ := C.good.uniqueRefresh i + have hstage : H.stage i.succ.castSucc = base.core := by + exact he.symm + have hstar : HierarchyStarredStage H i.castSucc = base.core := rfl + rw [hstage, hstar, Finset.sdiff_self, Finset.biUnion_empty] at hgamma + have hempty : C.good.gamma i.succ eta = ∅ := Finset.subset_empty.mp hgamma + have hcard := C.good.twoColors i.succ eta heta + rw [hempty, Finset.card_empty] at hcard + omega + +private theorem helper_positivePackage_887.{u_1, u_2} : + helperPositivePackage887Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha beta hne z sigma hsigma H q A n Tn Dn + outside missingA TnToA ordinaryToA treeMissingEq combined corrT hmaximumT baseT hcoreT + hclosureT terminalData K starredEq storedEq stageMissingEq segmentEq parallelNotClosed + goodT hq hqK U hU + subst U + obtain ⟨ettA, hMPA, hrA, hsA, baseA, hcoreA, hclosureA, hsupportA, + KA, hcount, hstages, hdividers, goodA, hgammaA, hminusA⟩ := + GoodHierarchyPrefixRepackage G k e0 corrT.replacementInput T sigma sigma + corrT.replacementETT hmaximumT baseT K goodT q hqK + refine ⟨corrT.replacementInput, ettA, baseA, KA, goodA, hMPA, ?_⟩ + have hcount' : KA.dividerCount + 1 = H.dividerCount := by + change KA.dividerCount = H.dividerCount - 1 at hcount + change 0 < H.dividerCount at hq + omega + refine ⟨hcount', hcoreA.trans hcoreT, hclosureA.trans hclosureT, ?_, ?_, ?_⟩ + · intro j + let jp : Fin (q.val + 1) := ⟨j.val, by dsimp [q]; have := j.isLt; omega⟩ + have he : Fin.cast (by omega) jp = j := Fin.ext rfl + simpa only [he] using hstages jp + · intro j + let jp : Fin q.val := ⟨j.val, by dsimp [q]; have := j.isLt; omega⟩ + have he : Fin.cast (by omega) jp = j := Fin.ext rfl + have hg := hgammaA jp + simp only [he] at hg + refine ⟨hg.1.trans (storedEq _), ?_⟩ + intro eta heta + exact hg.2 eta + · have he : (Fin.last H.dividerCount).castSucc = + (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := Fin.ext rfl + simpa [K, goodT, storedEq, q, he] using hminusA + +private theorem helper_preStepElementary_896.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let i : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by have this : (0 : ℕ) < ett.rounds := C.positive; omega⟩ : + Fin ett.rounds); + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx n Tn + dsimp only + by_cases hn : ett.rounds = 1 + · have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = 0 := + Fin.ext (by simp [hn]) + have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn]) + dsimp only [Tn] + rw [hcolor, htree] + exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + · have hmore : 1 < ett.rounds := by have := C.positive; omega + obtain ⟨predecessor, hr, hmaximum, _, _⟩ := + CertifiedETTPredecessor G k e0 input T phi ett C.maximum hmore + have htree : n.castSucc = (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext rfl + dsimp only [Tn] + rw [htree] + exact (ctx.lowerRung predecessor (by omega) (by omega) hmaximum).1 + +private theorem helper_equalTrees_948.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + S.length = U.length → + S = U := by + classical + intro V E G e0 S U hSU hlen + cases S with + | mk ls ps vs es vis eis fs aas => + cases U with + | mk lu pu vu eu viu eiu fu aau => + simp only at hlen + subst lu + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.1 i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.2 i).symm + +private theorem helper_ordinaryToA_1012.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount ≠ (0 : ℕ) → A = H.stage q.castSucc) → + TreeSequenceInitialSegment Tn A → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n Tn stageSegment lastPositive TnToA j + by_cases hj : j.val = 0 + · have he : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext hj + rw [he, H.baseStage]; exact TnToA + · have hz : H.dividerCount ≠ 0 := by have := j.isLt; omega + rw [lastPositive hz] + have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = q.castSucc := Fin.ext (by simp [q]; omega) + rw [he] at hs + convert hs using 1 + apply congrArg H.stage + apply Fin.ext + rfl + +private theorem helper_sigmaRoute_1064.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (sigma : PartialEdgeColoring E k), + (∀ + v ∈ + TreeSequenceVertexSet + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ))), + MissingColors G sigma v = MissingColors G phi v) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (if ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE then + CombinedStableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi + sigma + else + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma) → + TreeSequenceInitialSegment B T → + T.length = B.length + (1 : ℕ) → + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma hpenultimateMissing n Tn Dn B hbase BToT + hBlen fixedT + rcases P2813_T1_TerminalRoute G k e0 input T phi ett with + ⟨hp, hseq⟩ | ⟨hp, f, seed, hedges, hseed, hincident, hcontrol, hseq⟩ + · exact Or.inl ⟨hp, TashkinovAugmentationSequenceColoringTransport phi sigma + Tn B T hseq BToT hBlen (fun t _ => fixedT t) hpenultimateMissing⟩ + · obtain ⟨c, hc, hcol⟩ := hcontrol + have seedFixed : sigma f = phi f := by + have hs : StableColoring Tn Dn phi sigma := by + change (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma else StableColoring Tn Dn phi + sigma) at hbase + split at hbase + · exact hbase.1 + · exact hbase + exact hs.1 f hincident ⟨c, hc, hcol⟩ + exact Or.inr ⟨hp, f, seed, hedges, hseed, + TashkinovAugmentationSequenceColoringTransport phi sigma seed B T + hseq BToT hBlen (fun t _ => fixedT t) hpenultimateMissing⟩ + +private theorem helper_continuation_1171.{u_1, u_2} : + helperContinuation1171Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha beta hne z sigma hsigma H q A n Tn Dn + htwo outside hmod prefixPresentation missingA segTrans commonPrefix equalTrees stageToT + lastZero lastPositive coreToA TnToCore TnToA AToT ordinaryToA fixedT weak treeMissingEq + combined corrT hmaximumT baseT hcoreT hclosureT terminalData K starredEq storedEq + stageMissingEq segmentEq + have coreStrict := @helper_coreStrict_772 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C htwo equalTrees lastZero + have parallelNotClosed := @helper_parallelNotClosed_549 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C sigma segTrans commonPrefix + equalTrees stageToT coreToA TnToCore AToT fixedT treeMissingEq coreStrict + let goodT : GoodHierarchy K := { + gamma := C.good.gamma + twoColors := by + intro j eta heta + exact C.good.twoColors j eta (by rw [storedEq j] at heta; exact heta) + avoidance := by + intro j eta heta c hc + have ho : eta ∈ HierarchyStoredColorsAt H j := by rw [← storedEq j]; exact heta + rw [stageMissingEq j, segmentEq j eta ho] + exact C.good.avoidance j eta ho hc + disjointPairs := by + intro j eta theta heta htheta hne + exact C.good.disjointPairs j eta theta + (by rw [storedEq j] at heta; exact heta) + (by rw [storedEq j] at htheta; exact htheta) hne + uniqueRefresh := by + intro i + have hnew : + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun v => MissingColors G phi v) := by + apply Finset.biUnion_congr rfl + intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA i.succ) + (Finset.mem_sdiff.mp hv).1) + change ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + C.good.gamma i.succ eta ⊆ + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K i.castSucc)).biUnion + fun v => MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, theta ≠ eta → + C.good.gamma i.succ theta = C.good.gamma i.castSucc theta + rw [starredEq i.castSucc, hnew] + simp only [storedEq] + exact C.good.uniqueRefresh i + parallelBase := by + dsimp only + intro hp + have hpOld : ett.series.data.kind n = some TashkinovExtensionKind.PE := + terminalData.2.1.symm.trans hp + constructor + · change ¬ TreeColorSetMinusClosed G sigma baseT.core + ((HierarchyStoredColorsAt K 0).biUnion (C.good.gamma 0)) + rw [hcoreT, storedEq 0] + exact parallelNotClosed hpOld + · change 4 ≤ ((TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseT.closure) \ + (HierarchyStoredColorsAt K 0).biUnion (C.good.gamma 0)).card + have closureMissing : TreeMissingColors sigma base.closure = + TreeMissingColors phi base.closure := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (combined hpOld).2.2 + rw [terminalData.1, hclosureT, storedEq 0, treeMissingEq Tn TnToA, closureMissing] + exact (C.good.parallelBase hpOld).2 + minusClosed := by + intro i + change TreeColorSetMinusClosed G sigma (H.stage i.succ.castSucc) + ((HierarchyStoredColorsAt K i.succ).biUnion (C.good.gamma i.castSucc)) + rw [storedEq i.succ] + apply P2813_T1_MinusClosedTransport G k e0 _ phi sigma alpha beta hne z hsigma + ctx.proper ctx.oneEdgeUncolored _ (C.good.minusClosed i) + · intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA i.succ) hv) + · exact outside i.succ } + have same : SameGoodHierarchy C.good goodT := by + refine ⟨?_, rfl, ?_⟩ + · refine ⟨hcoreT.symm, rfl, HEq.rfl, HEq.rfl, ?_, fun _ => hclosureT.symm⟩ + exact ⟨fun hp => terminalData.2.1.trans hp, fun hp => terminalData.2.1.symm.trans hp⟩ + · intro j + exact ⟨(storedEq j).symm, fun _ _ => rfl⟩ + have prefixMaximum : A = Tn ∨ + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, MaximumProperty ettA := by + rcases prefixPresentation with he | ⟨corrA, hMPA⟩ + · exact Or.inl he + · exact Or.inr ⟨corrA.replacementInput, corrA.replacementETT, hMPA⟩ + refine ⟨weak, hmod, prefixMaximum, ?_, corrT, hmaximumT, baseT, K, goodT, same⟩ + intro hq + have hqK : 1 ≤ q.val := by change 0 < H.dividerCount at hq; dsimp [q]; omega + have hqpos : H.dividerCount ≠ 0 := by change 0 < H.dividerCount at hq; omega + have hA : A = H.stage q.castSucc := lastPositive hqpos + have positivePackage := @helper_positivePackage_887 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C ctx alpha beta hne z sigma hsigma outside missingA + TnToA ordinaryToA treeMissingEq combined corrT hmaximumT baseT hcoreT hclosureT terminalData + starredEq storedEq stageMissingEq segmentEq parallelNotClosed hq hqK + exact positivePackage A hA + +private theorem helper_continuation_1123.{u_1, u_2} : + helperContinuation1123Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha beta hne z sigma hsigma + hpenultimateMissing hstoredFirst H q A n Tn Dn B htwo hbase sigmaProper sigmaOne outside + hmod prefixPresentation fixedA missingA htailEdges segTrans commonPrefix equalTrees + stageSegment stageToT lastZero lastPositive coreToA TnToCore TnToA AToT + have ordinaryToA := @helper_ordinaryToA_1012 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C stageSegment lastPositive TnToA + have starredToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := by + exact Fin.cases coreToA (fun i => ordinaryToA i.succ) j + have BToT : TreeSequenceInitialSegment B T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hBlen : T.length = B.length + 1 := by + change 2 ≤ T.length - A.length at htwo + change T.length = min (A.length + ((T.length - A.length) - 1)) T.length + 1 + have := AToT.1 + omega + have fixedT (t : Fin T.length) : sigma (T.edge t) = phi (T.edge t) := by + by_cases ht : t.val < A.length + · let ta : Fin A.length := ⟨t.val, ht⟩ + have he : Fin.castLE AToT.1 ta = t := Fin.ext rfl + rw [← he, AToT.2.2 ta] + exact fixedA ta + · exact htailEdges t (by omega) + have weak : HierarchyWeaklyStable H q sigma := by + have allWeak (j : Fin (H.dividerCount + 1)) : HierarchyWeaklyStable H j sigma := by + refine Fin.cases hbase (fun i => ⟨hbase, ?_⟩) j + refine ⟨?_, ?_⟩ + · intro t _ + rw [← (ordinaryToA i.succ).2.2 t] + exact fixedA _ + · intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA i.succ) hv) + exact allWeak q + have treeMissingEq (S : TreeSequence G e0) (hSA : TreeSequenceInitialSegment S A) : + TreeMissingColors sigma S = TreeMissingColors phi S := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => + missingA v (TreeSequenceInitialSegmentVertexSetSubset hSA hv)) + have combined (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + CombinedStableColoring Tn base.closure Dn phi sigma := by + change (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma else + StableColoring Tn Dn phi sigma) at hbase + simpa only [hp, ite_true] using hbase + have sigmaRoute := @helper_sigmaRoute_1064 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C sigma hpenultimateMissing hbase BToT hBlen fixedT + have corrData := @helper_corrData_383 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C sigma TnToA treeMissingEq + have fullBase := @helper_fullBase_422 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C ctx sigma sigmaProper sigmaOne hmod combined sigmaRoute corrData + obtain ⟨corrT, hmaximumT, baseT, hcoreT, hclosureT⟩ := fullBase + have terminalData := corrData corrT + let K : TashkinovHierarchy corrT.replacementETT baseT := { + dividerCount := H.dividerCount + stage := H.stage + baseStage := H.baseStage.trans terminalData.1.symm + terminalStage := H.terminalStage + nested := H.nested + strict := H.strict + dividerPosition := H.dividerPosition + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := H.dividerStage + coreInsideFirst := by rw [hcoreT]; exact H.coreInsideFirst } + have starredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage H j := + Fin.cases hcoreT (fun _ => rfl) j + have storedEq (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j := by + unfold HierarchyStoredColorsAt + dsimp only + rw [terminalData.2.2, starredEq j, treeMissingEq _ (starredToA j)] + have stageMissingEq (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j := by + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + rw [terminalData.1] + exact treeMissingEq Tn TnToA + · exact treeMissingEq _ (ordinaryToA i.succ) + have segmentEq := @helper_segmentEq_489 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C sigma hstoredFirst fixedA missingA stageToT AToT + ordinaryToA fixedT corrT baseT hcoreT terminalData starredEq + -- The first refresh prevents the core from being the whole first stage. + exact @helper_continuation_1171 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx alpha beta hne z sigma hsigma htwo outside hmod + prefixPresentation missingA segTrans commonPrefix equalTrees stageToT lastZero lastPositive + coreToA TnToCore TnToA AToT ordinaryToA fixedT weak treeMissingEq combined corrT hmaximumT + baseT hcoreT hclosureT terminalData starredEq storedEq stageMissingEq segmentEq +theorem StableChangeCasesOneTwoFullTail {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + alpha ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) ∧ + beta ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1))) + (z : Sum V E) (hpath : TwoColorPathComponent G phi alpha beta z) + (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hcase : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + (0 < H.dividerCount ∧ alpha ∈ TreeMissingColors phi Tnq) ∨ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + (alpha ∈ TreeMissingColors phi A ∧ + alpha ∉ Dn ∧ beta ∉ Dn)))) + (hdisjoint : + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) + (htailEdges : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + ∀ t : Fin T.length, A.length ≤ t.val → + sigma (T.edge t) = phi (T.edge t)) + (hpenultimateMissing : + ∀ v, v ∈ TreeSequenceVertexSet + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) → + MissingColors G sigma v = MissingColors G phi v) + (hstoredFirst : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + ∀ eta, eta ∈ HierarchyStoredColorsAt H q → + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta) : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dnq := HierarchyStoredColorsAt H q + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + (A = Tn ∨ + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, MaximumProperty ettA) ∧ + (∀ hq : 0 < H.dividerCount, + ∃ inputA : PartialEdgeColoring E k, + ∃ ettA : ExtendedTashkinovTree G k e0 inputA A sigma, + ∃ baseA : HierarchyBase ettA sigma, + ∃ K : TashkinovHierarchy ettA baseA, + ∃ goodA : GoodHierarchy K, + MaximumProperty ettA ∧ + ∃ hcount : K.dividerCount + 1 = H.dividerCount, + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ j : Fin (K.dividerCount + 2), + K.stage j = H.stage ⟨j.val, by omega⟩) ∧ + (∀ j : Fin (K.dividerCount + 1), + let jH : Fin (H.dividerCount + 1) := ⟨j.val, by omega⟩ + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt H jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq + (Dnq.biUnion + (C.good.gamma + ⟨C.hierarchy.dividerCount - 1, by omega⟩))) ∧ + (∃ corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T, + MaximumProperty corrT.replacementETT ∧ + ∃ baseT : HierarchyBase corrT.replacementETT sigma, + ∃ K : TashkinovHierarchy corrT.replacementETT baseT, + ∃ goodT : GoodHierarchy K, SameGoodHierarchy C.good goodT) := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + let B := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi + ett base C ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have htwo : 2 ≤ T.length - A.length := + HierarchyCounterexampleTailAtLeastTwo G k e0 input T phi + ett base C ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + obtain ⟨hbase, missingA, sigmaProper, sigmaOne, outside⟩ := + P2813_T1_BaseControl G k e0 input T phi ett base C ctx helem + alpha beta hne hmissingPrefix z hpath sigma hsigma hcase hdisjoint + have preStepElementary := @helper_preStepElementary_896 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C ctx + have fixedA := P2813_T1_DisplayedEdges G k e0 input T phi ett base H C.good + ctx.proper ctx.oneEdgeUncolored preStepElementary helem alpha beta z sigma hsigma + sigmaOne hbase outside + obtain ⟨hmod, prefixPresentation⟩ := P2813_T1_PrefixReconstruction + G k e0 input T phi ett base C ctx sigma sigmaProper sigmaOne hbase fixedA missingA + change (∀ t : Fin A.length, sigma (A.edge t) = phi (A.edge t)) at fixedA + change (∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) at missingA + change (∀ t : Fin T.length, A.length ≤ t.val → + sigma (T.edge t) = phi (T.edge t)) at htailEdges + have segRefl (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + clear * - hSU hUW + refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) (hUW : TreeSequenceInitialSegment U W) + (hlen : S.length ≤ U.length) : TreeSequenceInitialSegment S U := by + clear * - hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + have equalTrees := @helper_equalTrees_948 V E G e0 + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + clear * - H a d hbound segRefl segTrans + induction d with + | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + have stageToT (j : Fin (H.dividerCount + 2)) : + TreeSequenceInitialSegment (H.stage j) T := by + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by have := j.isLt; simp only [Fin.val_last]; omega) + simpa [he, H.terminalStage] using hs + have lastZero (hz : H.dividerCount = 0) : A = base.core := by + have hq : q = 0 := Fin.ext (by simpa [q] using hz) + simp only [A, hq, HierarchyStarredStage] + rfl + have lastPositive (hz : H.dividerCount ≠ 0) : A = H.stage q.castSucc := by + have hq : q ≠ 0 := by + intro he + have := congrArg Fin.val he + simp only [q, Fin.val_last, Fin.val_zero] at this + exact hz this + dsimp only [A] + rw [← Fin.succ_pred q hq] + rfl + have coreToA : TreeSequenceInitialSegment base.core A := by + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz]; exact segRefl _ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : (⟨1 + (H.dividerCount - 1), by omega⟩ : + Fin (H.dividerCount + 2)) = q.castSucc := Fin.ext (by simp [q]; omega) + rw [he] at hs + exact segTrans H.coreInsideFirst hs + have TnToCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (base.parallel hp).2.2.some.leftSegment + · rw [base.nonparallel hp]; exact segRefl _ + have TnToA := segTrans TnToCore coreToA + have AToT : TreeSequenceInitialSegment A T := by + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segTrans H.coreInsideFirst (stageToT _) + · rw [lastPositive hz]; exact stageToT _ + exact @helper_continuation_1123 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx alpha beta hne z sigma hsigma hpenultimateMissing + hstoredFirst htwo hbase sigmaProper sigmaOne outside hmod prefixPresentation fixedA + missingA htailEdges segTrans commonPrefix equalTrees stageSegment stageToT lastZero + lastPositive coreToA TnToCore TnToA AToT +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean new file mode 100644 index 0000000000..5df997c912 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean @@ -0,0 +1,1236 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.BaseControl +public import LeanPool.GoldbergSeymour.DisplayedEdges +public import LeanPool.GoldbergSeymour.MinusClosedTransport +public import LeanPool.GoldbergSeymour.PrefixSegmentTransport +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Stable Change Cases One Two Split Tail + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation777Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + ∀ (X : TreeSequence G e0), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → sigma (T.edge t) = phi (T.edge t)) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X) → + TashkinovAugmentationSequence phi X T → + alpha ∈ TreeMissingColors sigma X ∧ beta ∈ TreeMissingColors sigma X → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ eta ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ eta ∈ HierarchyStoredColorsAt H q, + alpha ∈ C.good.gamma q eta ∨ beta ∈ C.good.gamma q eta → + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) ≤ X.length) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (if ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE then + CombinedStableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi + sigma + else + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma) → + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))) (c : Fin k), + c = alpha ∨ c = beta → + c ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy r) → + TreeColorSetClosed G phi (HierarchyStarredStage C.hierarchy r) { c } → + OutsideKempeRecoloring (HierarchyStarredStage C.hierarchy r) phi sigma alpha + beta) → + HierarchyWeaklyStable C.hierarchy (Fin.last C.hierarchy.dividerCount) sigma → + ModColoring ett sigma → + ((0 : ℕ) < C.hierarchy.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) + sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) + (goodA : GoodHierarchy K), + MaximumProperty ettA ∧ + ettA.series.data.kind (Fin.last ettA.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = C.hierarchy.dividerCount), + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ (j : Fin (K.dividerCount + (2 : ℕ))), + K.stage j = + C.hierarchy.stage + (⟨(↑j : ℕ), by omega⟩ : + Fin (C.hierarchy.dividerCount + (2 : ℕ)))) ∧ + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + (⟨(↑j : ℕ), by omega⟩ : Fin (C.hierarchy.dividerCount + (1 : ℕ))); + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt C.hierarchy jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma + (C.hierarchy.stage + (⟨C.hierarchy.dividerCount, by omega⟩ : + Fin (C.hierarchy.dividerCount + (2 : ℕ)))) + ((HierarchyStoredColorsAt C.hierarchy + (Fin.last C.hierarchy.dividerCount)).biUnion + (C.good.gamma + (⟨C.hierarchy.dividerCount - (1 : ℕ), by omega⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) → + TreeSequenceInitialSegment A X → + A.length < X.length → + (∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) → + (∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) → + (∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → S.length = U.length → S = U) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment Tn A → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + TreeSequenceInitialSegment X T → + TreeSequenceInitialSegment A T → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + ∃ (corrT : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT ∧ + ∃ (baseT : HierarchyBase corrT.replacementETT sigma) (K : + TashkinovHierarchy corrT.replacementETT baseT) (goodT : + GoodHierarchy K), SameGoodHierarchy C.good goodT + +private theorem helper_corrData_311.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k) (_ : TreeSequence G e0), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + TreeSequenceInitialSegment Tn A → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma X H q A n Tn Dn TnToA treeMissingEq corr + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have hs : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases hs + let a : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have ha : a.succ = Fin.last ett.rounds := by + apply Fin.ext + change ett.rounds - 1 + 1 = ett.rounds + have := ett.roundsPositive + omega + have ht : replacementSeries.data.tree (Fin.last ett.rounds).castSucc = Tn := by + change replacementSeries.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc + rw [← ha] + exact ladderTreesAgree a + have hm : TreeMissingColors (replacementSeries.data.coloring (Fin.last ett.rounds)) + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi Tn := by + rw [← finalGeneratingColoring, ht] + exact treeMissingEq Tn TnToA + have hmOld : TreeMissingColors (ett.series.data.coloring (Fin.last ett.rounds)) + (ett.series.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi Tn := by + rw [← ett.generatingColoring] + refine ⟨ht, extensionKindsAgree (Fin.last ett.rounds), ?_⟩ + change TashkinovStoredColors replacementSeries.data (Fin.last ett.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) + simp only [TashkinovStoredColors, storedColorsAgree, hm, hmOld] + +private theorem helper_fullBase_358.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (sigma : PartialEdgeColoring E k), + let _ : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + ModColoring ett sigma → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed T) → + (∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi sigma) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corr.replacementETT ∧ + ∃ (baseT : HierarchyBase corr.replacementETT sigma), + baseT.core = base.core ∧ baseT.closure = base.closure := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx sigma H n Tn Dn hsproper hsone hmod + fullRoute corrData combined + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · have hb : TashkinovAugmentationSequence sigma Tn T := by + rcases fullRoute with ⟨_, hseq⟩ | ⟨hk, rest⟩ + · exact hseq + · rcases hk with hk | hk <;> rw [hp] at hk <;> cases hk + obtain ⟨corr, hMP, baseT, K0, hsame⟩ := HierarchySplitter G k e0 input T phi sigma + ett C.maximum C.positive ctx.lowerRung base H hp ctx.proper ctx.oneEdgeUncolored + hsproper hsone (combined hp) hb + exact ⟨corr, hMP, baseT, hsame.1.symm, (hsame.2.2.2.2.2 hp).symm⟩ + · obtain ⟨corr⟩ := hmod.2.2 T ett.abovePenultimate ett.strictAbovePenultimate fullRoute + have hd := corrData corr + let pos : Fin ((corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc).length + 1) := + Fin.cast (congrArg (fun W : TreeSequence G e0 => W.length + 1) hd.1.symm) + base.supportPosition + let baseT : HierarchyBase corr.replacementETT sigma := { + core := base.core + closure := base.closure + supportPosition := pos + supportPositive := by simpa [pos] using base.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only + intro hPE + exact False.elim (hp (hd.2.1.symm.trans hPE)) + nonparallel := by + dsimp only + intro _ + exact (base.nonparallel hp).trans hd.1.symm } + exact ⟨corr, MaximumPropertyTransport G k e0 ett sigma hmod T corr C.maximum, + baseT, rfl, rfl⟩ + +private theorem helper_coreNotClosed_479.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k) (X : TreeSequence G e0), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → sigma (T.edge t) = phi (T.edge t)) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed X) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ((0 : ℕ) < C.hierarchy.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : + ExtendedTashkinovTree G k e0 inputA + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), + MaximumProperty ettA ∧ + ettA.series.data.kind (Fin.last ettA.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = C.hierarchy.dividerCount), + baseA.core = base.core ∧ + baseA.closure = base.closure ∧ + (∀ (j : Fin (K.dividerCount + (2 : ℕ))), + K.stage j = + C.hierarchy.stage + (⟨(↑j : ℕ), by omega⟩ : + Fin (C.hierarchy.dividerCount + (2 : ℕ)))) ∧ + (∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (C.hierarchy.dividerCount + (1 : ℕ)) := + (⟨(↑j : ℕ), by omega⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ))); + HierarchyStoredColorsAt K j = + HierarchyStoredColorsAt C.hierarchy jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, + goodA.gamma j eta = C.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma + (C.hierarchy.stage + (⟨C.hierarchy.dividerCount, by omega⟩ : + Fin (C.hierarchy.dividerCount + (2 : ℕ)))) + ((HierarchyStoredColorsAt C.hierarchy + (Fin.last C.hierarchy.dividerCount)).biUnion + (C.good.gamma + (⟨C.hierarchy.dividerCount - (1 : ℕ), by omega⟩ : + Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) → + TreeSequenceInitialSegment A X → + A.length < X.length → + (∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → S.length = U.length → S = U) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment X T → + TreeSequenceInitialSegment A T → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma base.core + ((HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma X hfixedPrefix hrouteX H q A n Tn + hretained hAX hAXstrict equalTrees lastZero TnToA hXT hAT hp + by_cases hz : H.dividerCount = 0 + · have hroute : TashkinovAugmentationSequence sigma Tn X := by + rcases hrouteX with ⟨_, hseq⟩ | ⟨hk, rest⟩ + · exact hseq + · rcases hk with hk | hk <;> rw [hp] at hk <;> cases hk + let tX : Fin X.length := ⟨A.length, hAXstrict⟩ + let Z := TreeSequencePrefix X A.length A.positive hAX.1 + have hAZ : TreeSequenceInitialSegment A Z := + ⟨le_rfl, hAX.2.1, hAX.2.2⟩ + have hAZeq : A = Z := equalTrees hAZ rfl + have hposition := TashkinovAugmentationSequencePosition sigma Tn X hroute tX TnToA.1 + obtain ⟨c, hcol, hcm⟩ := hposition.1.2.2 + have hcmA : c ∈ TreeMissingColors sigma A := by + rw [hAZeq] + exact hcm + have hcolX : sigma (X.edge tX) = some c := by + rw [← hposition.2] + have hidx : Fin.cast hposition.1.1.symm + (Fin.last (TreeSequencePrefix X tX.val + (le_trans Tn.positive TnToA.1) (Nat.le_of_lt tX.isLt)).length) = + Fin.last tX.val := Fin.ext rfl + simpa only [hidx] using hcol + let tT : Fin T.length := Fin.castLE hXT.1 tX + have hcolT : sigma (T.edge tT) = some c := by + rw [show T.edge tT = X.edge tX from hXT.2.2 tX] + exact hcolX + have hcolOld : phi (T.edge tT) = some c := + (hfixedPrefix tT le_rfl hAXstrict).symm.trans hcolT + have firstAfter (eta : Fin k) (heta : eta ∉ TreeMissingColors phi A) : + A.length < (HierarchyFirstMissingPosition phi T eta).val := by + clear * - eta heta hAT hAXstrict hXT + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + eta ∈ MissingColors G phi (T.vertex j) + have hfirst : HierarchyFirstMissingPosition phi T eta = + if h : candidates.Nonempty then candidates.min' h else Fin.last T.length := rfl + rw [hfirst] + by_cases hnon : candidates.Nonempty + · rw [dite_eq_left hnon] + have hmem := (Finset.mem_filter.mp (Finset.min'_mem candidates hnon)).2 + by_contra hle + have hv : (candidates.min' hnon).val ≤ A.length := by omega + let a : Fin (A.length + 1) := ⟨(candidates.min' hnon).val, by omega⟩ + have ha : Fin.castLE (Nat.succ_le_succ hAT.1) a = + candidates.min' hnon := Fin.ext rfl + rw [← ha, hAT.2.1 a] at hmem + apply heta + refine Finset.mem_biUnion.mpr ⟨A.vertex a, ?_, hmem⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨a, rfl⟩ + · rw [dite_eq_right hnon] + simp only [Fin.val_last] + have := hXT.1 + omega + have hcUnreserved : c ∉ (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0) := by + intro hcReserved + obtain ⟨eta, heta, hcGamma⟩ := Finset.mem_biUnion.mp hcReserved + have hetaNot : eta ∉ TreeMissingColors phi A := by + rw [lastZero hz] + exact (Finset.mem_sdiff.mp heta).2 + have hpAfter := firstAfter eta hetaNot + have hnextLast : (0 : Fin (H.dividerCount + 1)).succ = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp [hz]) + have hseg : c ∈ HierarchySegmentColors H 0 eta := by + unfold HierarchySegmentColors + dsimp only + rw [hnextLast, H.terminalStage] + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, tT, ?_, ?_, hcolOld⟩ + · change base.core.length ≤ tT.val + rw [← lastZero hz] + exact le_rfl + · have ht := tT.isLt + change A.length < min (HierarchyFirstMissingPosition phi T eta).val T.length + omega + exact (Finset.mem_sdiff.mp (C.good.avoidance 0 eta heta hcGamma)).2 hseg + obtain ⟨i, hi⟩ := T.attaches tT + let old : Fin (T.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ tT.isLt)) + have holdIn : T.vertex old ∈ TreeSequenceVertexSet A := by + let a : Fin (A.length + 1) := ⟨i.val, by simpa [tT, tX] using i.isLt⟩ + have ha : Fin.castLE (Nat.succ_le_succ hAT.1) a = old := Fin.ext rfl + rw [← ha, hAT.2.1 a] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨a, rfl⟩ + have hnewOut : T.vertex tT.succ ∉ TreeSequenceVertexSet A := by + intro hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨a, ha⟩ := hv + have he := T.vertex_injective ((hAT.2.1 a).trans ha) + have hev := congrArg Fin.val he + have := a.isLt + change a.val = A.length + 1 at hev + omega + have hboundary : T.edge tT ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet A) c := by + clear * - hi holdIn hnewOut hcolT + simp only [BoundaryColorEdges, BoundaryEdges, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨⟨T.vertex old, holdIn, T.vertex tT.succ, hnewOut, + hi.trans Sym2.eq_swap⟩, hcolT⟩ + rw [lastZero hz] at hcmA hboundary + intro hclosed + have hcMissing : c ∈ TreeMissingColors sigma base.core \ + (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0) := + Finset.mem_sdiff.mpr ⟨hcmA, hcUnreserved⟩ + rw [hclosed c hcMissing] at hboundary + exact Finset.notMem_empty _ hboundary + · obtain ⟨inputA, ettA, baseA, KA, goodA, hMPA, hkindA, + hcountA, hcoreA, hclosureA, hstagesA, hgammaA, hminusA⟩ := + hretained (by change 0 < H.dividerCount; omega) + have hpA : ettA.series.data.kind (Fin.last ettA.rounds) = + some TashkinovExtensionKind.PE := hkindA.trans hp + have hnot := (goodA.parallelBase hpA).1 + have hzindex : (⟨(0 : Fin (KA.dividerCount + 1)).val, by simp⟩ : + Fin (H.dividerCount + 1)) = 0 := Fin.ext rfl + have hzero := hgammaA 0 + dsimp only at hzero + rw [hzindex] at hzero + have hunion : (HierarchyStoredColorsAt KA 0).biUnion (goodA.gamma 0) = + (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0) := by + apply Finset.biUnion_congr hzero.1 + intro eta heta + exact hzero.2 eta heta + rw [hcoreA, hunion] at hnot + exact hnot + +private theorem helper_terminalTransfer_696.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k) (X : TreeSequence G e0), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → sigma (T.edge t) = phi (T.edge t)) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ eta ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ eta ∈ HierarchyStoredColorsAt H q, + alpha ∈ C.good.gamma q eta ∨ beta ∈ C.good.gamma q eta → + (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) ≤ X.length) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + ∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∈ HierarchySegmentColors K q eta → + c ∈ HierarchySegmentColors H q eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma X hfixedPrefix hstoredFirst + hgammaCutoff H q n Tn Dn corrT baseT hcoreT terminalData K starredEq unaffected eta c heta + hc hseg + unfold HierarchySegmentColors at hseg ⊢ + dsimp only at hseg ⊢ + have hlast : H.stage q.succ = T := by + have hi : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + rw [hi, H.terminalStage] + rw [starredEq q, hlast, hstoredFirst eta heta] at hseg + rw [hlast] + obtain ⟨_, t, hlo, hhi, hcol⟩ := Finset.mem_filter.mp hseg + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, hhi, ?_⟩ + by_cases hca : c = alpha + · subst c + have hcut := hgammaCutoff eta heta (Or.inl hc) + have htX : t.val < X.length := by + have := Nat.lt_of_lt_of_le hhi (Nat.min_le_left _ _) + omega + exact (hfixedPrefix t hlo htX).symm.trans hcol + · by_cases hcb : c = beta + · subst c + have hcut := hgammaCutoff eta heta (Or.inr hc) + have htX : t.val < X.length := by + have := Nat.lt_of_lt_of_le hhi (Nat.min_le_left _ _) + omega + exact (hfixedPrefix t hlo htX).symm.trans hcol + · exact (unaffected _ c hca hcb).mp hcol + +private theorem helper_preStepElementary_566.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (_ : TreeSequence G e0), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let i : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by have this : (0 : ℕ) < ett.rounds := C.positive; omega⟩ : + Fin ett.rounds); + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx X n Tn + dsimp only + by_cases hn : ett.rounds = 1 + · have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = 0 := + Fin.ext (by simp [hn]) + have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn]) + dsimp only [Tn] + rw [hcolor, htree] + exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + · have hmore : 1 < ett.rounds := by have := C.positive; omega + obtain ⟨predecessor, hr, hmaximum, _, _⟩ := + CertifiedETTPredecessor G k e0 input T phi ett C.maximum hmore + have htree : n.castSucc = (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext rfl + dsimp only [Tn] + rw [htree] + exact (ctx.lowerRung predecessor (by omega) (by omega) hmaximum).1 + +private theorem helper_equalTrees_615.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + S.length = U.length → + S = U := by + classical + intro V E G e0 S U hSU hlen + cases S with + | mk ls ps vs es vis eis fs aas => + cases U with + | mk lu pu vu eu viu eiu fu aau => + simp only at hlen + subst lu + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.1 i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.2 i).symm + +private theorem helper_branch_846.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + TreeSequenceInitialSegment Tn A → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi sigma) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core), + baseT.closure = base.closure → + ∀ + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + (4 : ℕ) ≤ + ((TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseT.closure) \ + (HierarchyStoredColorsAt K (0 : Fin (K.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (K.dividerCount + (1 : ℕ))))).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn Dn TnToA treeMissingEq + combined corrT baseT hcoreT hclosureT terminalData K storedEq hpOld + change 4 ≤ ((TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseT.closure) \ + (HierarchyStoredColorsAt K 0).biUnion (C.good.gamma 0)).card + have hclosureMissing : TreeMissingColors sigma base.closure = + TreeMissingColors phi base.closure := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (combined hpOld).2.2 + rw [terminalData.1, hclosureT, storedEq 0, treeMissingEq Tn TnToA, + hclosureMissing] + exact (C.good.parallelBase hpOld).2 + +private theorem helper_continuation_810.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + ∀ (_ : TreeSequence G e0), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))) (c : Fin k), + c = alpha ∨ c = beta → + c ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy r) → + TreeColorSetClosed G phi (HierarchyStarredStage C.hierarchy r) { c } → + OutsideKempeRecoloring (HierarchyStarredStage C.hierarchy r) phi sigma alpha + beta) → + HierarchyWeaklyStable C.hierarchy (Fin.last C.hierarchy.dividerCount) sigma → + ModColoring ett sigma → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + TreeSequenceInitialSegment Tn A → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi sigma) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT → + ∀ (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core), + baseT.closure = base.closure → + ∀ + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j) → + (∀ (i : Fin H.dividerCount) (eta : Fin k), + HierarchySegmentColors K i.castSucc eta = HierarchySegmentColors H i.castSucc eta) → + (∀ (eta c : Fin k), + eta ∈ HierarchyStoredColorsAt H q → + c ∈ C.good.gamma q eta → + c ∈ HierarchySegmentColors K q eta → c ∈ HierarchySegmentColors H q eta) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma base.core + ((HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ)))))) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + ∃ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT ∧ + ∃ (baseT : HierarchyBase corrT.replacementETT sigma) (K : + TashkinovHierarchy corrT.replacementETT baseT) (goodT : GoodHierarchy K), + SameGoodHierarchy C.good goodT := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha beta hne z sigma hsigma X H q A n Tn + Dn houtside hweak hmod hmissingA TnToA ordinaryToA starredToA treeMissingEq combined corrT + hmaximumT baseT hcoreT hclosureT terminalData K starredEq storedEq stageMissingEq + internalSegmentEq terminalTransfer coreNotClosed + let goodT : GoodHierarchy K := { + gamma := C.good.gamma + twoColors := by + intro j eta heta + exact C.good.twoColors j eta (by rw [storedEq j] at heta; exact heta) + avoidance := by + intro j eta heta c hc + have hjbound : j.val < H.dividerCount + 1 := j.isLt + have ho : eta ∈ HierarchyStoredColorsAt H j := by rw [← storedEq j]; exact heta + have old := C.good.avoidance j eta ho hc + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · rw [stageMissingEq j]; exact (Finset.mem_sdiff.mp old).1 + · intro hseg + by_cases hj : j.val < H.dividerCount + · let i : Fin H.dividerCount := ⟨j.val, hj⟩ + have hi : i.castSucc = j := Fin.ext rfl + rw [← hi, internalSegmentEq i eta, hi] at hseg + exact (Finset.mem_sdiff.mp old).2 hseg + · have hjlast : j = q := Fin.ext (by dsimp [q]; omega) + subst j + exact (Finset.mem_sdiff.mp old).2 (terminalTransfer eta c ho hc hseg) + disjointPairs := by + intro j eta theta heta htheta hne + exact C.good.disjointPairs j eta theta + (by rw [storedEq j] at heta; exact heta) + (by rw [storedEq j] at htheta; exact htheta) hne + uniqueRefresh := by + intro a + have hnew : + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H a.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H a.castSucc)).biUnion + fun v => MissingColors G phi v) := by + apply Finset.biUnion_congr rfl + intro v hv + exact hmissingA v (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA a.succ) + (Finset.mem_sdiff.mp hv).1) + change ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K a.succ ∧ + C.good.gamma a.succ eta ⊆ + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K a.castSucc)).biUnion + fun v => MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K a.succ, theta ≠ eta → + C.good.gamma a.succ theta = C.good.gamma a.castSucc theta + rw [starredEq a.castSucc, hnew] + simp only [storedEq] + exact C.good.uniqueRefresh a + parallelBase := by + dsimp only + intro hp + have hpOld : ett.series.data.kind n = some TashkinovExtensionKind.PE := + terminalData.2.1.symm.trans hp + constructor + · change ¬ TreeColorSetMinusClosed G sigma baseT.core + ((HierarchyStoredColorsAt K 0).biUnion (C.good.gamma 0)) + rw [hcoreT, storedEq 0] + exact coreNotClosed hpOld + · exact @helper_branch_846 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C sigma TnToA treeMissingEq combined corrT baseT hcoreT + hclosureT terminalData storedEq hpOld + minusClosed := by + intro a + change TreeColorSetMinusClosed G sigma (H.stage a.succ.castSucc) + ((HierarchyStoredColorsAt K a.succ).biUnion (C.good.gamma a.castSucc)) + rw [storedEq a.succ] + have hs : HierarchyStarredStage H a.succ = H.stage a.succ.castSucc := rfl + rw [← hs] + apply P2813_T1_MinusClosedTransport G k e0 _ phi sigma alpha beta hne z hsigma + ctx.proper ctx.oneEdgeUncolored _ + · rw [hs]; exact C.good.minusClosed a + · intro v hv + exact hmissingA v (TreeSequenceInitialSegmentVertexSetSubset (starredToA a.succ) hv) + · exact houtside a.succ } + have same : SameGoodHierarchy C.good goodT := by + refine ⟨?_, rfl, ?_⟩ + · refine ⟨hcoreT.symm, rfl, HEq.rfl, HEq.rfl, ?_, fun _ => hclosureT.symm⟩ + exact ⟨fun hp => terminalData.2.1.trans hp, fun hp => terminalData.2.1.symm.trans hp⟩ + · intro j + exact ⟨(storedEq j).symm, fun _ _ => rfl⟩ + exact ⟨hweak, hmod, corrT, hmaximumT, baseT, K, goodT, same⟩ + +private theorem helper_continuation_777.{u_1, u_2} : + helperContinuation777Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha beta hne z sigma hsigma X + hfixedPrefix hrouteX hsuffix hsplitMissing hstoredFirst hgammaCutoff H q A n Tn Dn hbase + hsproper hsone houtside hweak hmod hretained hAX hAXstrict hfixedA hmissingA equalTrees + lastZero TnToA ordinaryToA starredToA hXT hAT treeMissingEq + have hsuffixSigma : TashkinovAugmentationSequence sigma X T := by + rw [hsigma] at hsplitMissing ⊢ + exact TashkinovAugmentationSequenceComponentSwap G k e0 phi alpha beta hne z + X T hsuffix hsplitMissing.1 hsplitMissing.2 + have fullRoute : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed T) := by + rcases hrouteX with ⟨hp, hseq⟩ | ⟨hp, f, seed, hedges, hseed, hseq⟩ + · exact Or.inl ⟨hp, hseq.trans hsuffixSigma⟩ + · exact Or.inr ⟨hp, f, seed, hedges, hseed, hseq.trans hsuffixSigma⟩ + have corrData := @helper_corrData_311 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C sigma X TnToA treeMissingEq + have combined (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + CombinedStableColoring Tn base.closure Dn phi sigma := by + change (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) at hbase + simpa only [hp, ite_true] using hbase + have fullBase := @helper_fullBase_358 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C ctx sigma hsproper hsone hmod fullRoute corrData combined + obtain ⟨corrT, hmaximumT, baseT, hcoreT, hclosureT⟩ := fullBase + have terminalData := corrData corrT + let K : TashkinovHierarchy corrT.replacementETT baseT := { + dividerCount := H.dividerCount + stage := H.stage + baseStage := H.baseStage.trans terminalData.1.symm + terminalStage := H.terminalStage + nested := H.nested + strict := H.strict + dividerPosition := H.dividerPosition + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := H.dividerStage + coreInsideFirst := by rw [hcoreT]; exact H.coreInsideFirst } + have starredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage H j := + Fin.cases hcoreT (fun _ => rfl) j + have storedEq (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j := by + unfold HierarchyStoredColorsAt + dsimp only + rw [terminalData.2.2, starredEq j, treeMissingEq _ (starredToA j)] + have stageMissingEq (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j := by + refine Fin.cases ?_ (fun a => ?_) j + · change TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + rw [terminalData.1] + exact treeMissingEq Tn TnToA + · exact treeMissingEq _ (ordinaryToA a.succ) + have unaffected (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + sigma f = some c ↔ phi f = some c := by + clear * - G phi sigma alpha beta hne z hsigma f c hca hcb + rw [hsigma] + by_cases hf : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · by_cases ha : phi f = some alpha + · simp [TwoColorComponentSwap, hf, ha, hca.symm, hcb.symm] + · by_cases hb : phi f = some beta + · simp [TwoColorComponentSwap, hf, hb, hne.symm, hca.symm, hcb.symm] + · simp [TwoColorComponentSwap, hf, ha, hb] + · simp [TwoColorComponentSwap, hf] + have internalSegmentEq (i : Fin H.dividerCount) (eta : Fin k) : + HierarchySegmentColors K i.castSucc eta = + HierarchySegmentColors H i.castSucc eta := by + have hnext := ordinaryToA i.succ + have hcut := HierarchyFirstMissingPositionPrefixCutoff sigma A T hAT eta + (H.stage i.castSucc.succ).length (by simpa using hnext.1) + have htransport := P2813_T1_PrefixSegmentTransport phi sigma + (H.stage i.castSucc.succ) A T (by simpa using hnext) hAT hfixedA hmissingA + eta (HierarchyStarredStage H i.castSucc).length + unfold HierarchySegmentColors + dsimp only + rw [starredEq i.castSucc, ← hcut] + exact htransport + -- Affected Gamma colors can occur in this range only before X. + have terminalTransfer := @helper_terminalTransfer_696 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C alpha beta sigma X hfixedPrefix + hstoredFirst hgammaCutoff corrT baseT hcoreT terminalData starredEq unaffected + have coreNotClosed := @helper_coreNotClosed_479 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C sigma X hfixedPrefix hrouteX hretained hAX + hAXstrict equalTrees lastZero TnToA hXT hAT + exact @helper_continuation_810 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx alpha beta hne z sigma hsigma X houtside hweak hmod hmissingA + TnToA ordinaryToA starredToA treeMissingEq combined corrT hmaximumT baseT hcoreT hclosureT + terminalData starredEq storedEq stageMissingEq internalSegmentEq terminalTransfer + coreNotClosed +theorem StableChangeCasesOneTwoSplitTail {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + alpha ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) ∧ + beta ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1))) + (z : Sum V E) (hpath : TwoColorPathComponent G phi alpha beta z) + (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hcase : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + (0 < H.dividerCount ∧ alpha ∈ TreeMissingColors phi Tnq) ∨ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + (alpha ∈ TreeMissingColors phi A ∧ + alpha ∉ Dn ∧ beta ∉ Dn)))) + (hdisjoint : + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) + (X : TreeSequence G e0) + (hAX : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + TreeSequenceInitialSegment A X) + (hAXstrict : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + A.length < X.length) + (hXB : TreeSequenceInitialSegment X + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1))) + (hfixedPrefix : + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + sigma (T.edge t) = phi (T.edge t)) + (hrouteX : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed X)) + (hsuffix : TashkinovAugmentationSequence phi X T) + (hsplitMissing : alpha ∈ TreeMissingColors sigma X ∧ + beta ∈ TreeMissingColors sigma X) + (hpenultimateMissing : + ∀ v, v ∈ TreeSequenceVertexSet + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) → + MissingColors G sigma v = MissingColors G phi v) + (hstoredFirst : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + ∀ eta, eta ∈ HierarchyStoredColorsAt H q → + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta) + (hgammaCutoff : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + ∀ eta, eta ∈ HierarchyStoredColorsAt H q → + (alpha ∈ C.good.gamma q eta ∨ beta ∈ C.good.gamma q eta) → + (HierarchyFirstMissingPosition phi T eta).val ≤ X.length) : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + ∃ corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T, + MaximumProperty corrT.replacementETT ∧ + ∃ baseT : HierarchyBase corrT.replacementETT sigma, + ∃ K : TashkinovHierarchy corrT.replacementETT baseT, + ∃ goodT : GoodHierarchy K, SameGoodHierarchy C.good goodT := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let B := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + have hB : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 input T phi + ett base C ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have controls := P2813_T1_BaseControl G k e0 input T phi ett base C ctx + hB alpha beta hne hmissingPrefix z hpath sigma hsigma hcase hdisjoint + obtain ⟨hbase, _, hsproper, hsone, houtside⟩ := controls + have preStepElementary := @helper_preStepElementary_566 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C ctx X + have hfixedA := P2813_T1_DisplayedEdges G k e0 input T phi ett base H C.good + ctx.proper ctx.oneEdgeUncolored preStepElementary hB alpha beta z sigma hsigma + hsone hbase houtside + have changed := StableChangeCasesOneTwo G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality hB ctx.largeMissingSet alpha beta hne + hmissingPrefix z hpath sigma hsigma hcase hdisjoint + obtain ⟨hweak, hmod, _, hretained⟩ := changed + change TreeSequenceInitialSegment A X at hAX + change A.length < X.length at hAXstrict + change TreeSequenceInitialSegment X B at hXB + change (∀ t : Fin A.length, sigma (A.edge t) = phi (A.edge t)) at hfixedA + have hmissingA : ∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v := by + intro v hv + exact hpenultimateMissing v (TreeSequenceInitialSegmentVertexSetSubset hXB + (TreeSequenceInitialSegmentVertexSetSubset hAX hv)) + have segRefl (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : TreeSequenceInitialSegment S W := by + refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + have equalTrees := @helper_equalTrees_615 V E G e0 + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + induction d with + | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + have lastZero (hz : H.dividerCount = 0) : A = base.core := by + simp [A, q, HierarchyStarredStage, hz, Fin.last] + have lastPositive (hz : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm + have coreToA : TreeSequenceInitialSegment base.core A := by + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz]; exact segRefl _ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + have TnToCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (base.parallel hp).2.2).leftSegment + · rw [base.nonparallel hp]; exact segRefl _ + have TnToA := segTrans TnToCore coreToA + have ordinaryToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + by_cases hz : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) + rw [hj, H.baseStage]; exact TnToA + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + rw [lastPositive hz] + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> + simp only [Fin.val_castSucc]; omega + have starredToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := + Fin.cases coreToA (fun i => ordinaryToA i.succ) j + have hXT : TreeSequenceInitialSegment X T := + TashkinovAugmentationSequenceInitialSegment phi X T hsuffix + have hAT := segTrans hAX hXT + have treeMissingEq (S : TreeSequence G e0) (hSA : TreeSequenceInitialSegment S A) : + TreeMissingColors sigma S = TreeMissingColors phi S := by + unfold TreeMissingColors + exact Finset.biUnion_congr rfl + (fun v hv => hmissingA v (TreeSequenceInitialSegmentVertexSetSubset hSA hv)) + -- Transport the suffix route without fixing its individual edge colors. + exact @helper_continuation_777 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx alpha beta hne z sigma hsigma X hfixedPrefix hrouteX hsuffix + hsplitMissing hstoredFirst hgammaCutoff hbase hsproper hsone houtside hweak hmod hretained + hAX hAXstrict hfixedA hmissingA equalTrees lastZero TnToA ordinaryToA starredToA hXT hAT + treeMissingEq +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean new file mode 100644 index 0000000000..8e2bf95604 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean @@ -0,0 +1,1300 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.BaseControl +public import LeanPool.GoldbergSeymour.DisplayedEdges +public import LeanPool.GoldbergSeymour.RecoloredPrefixReconstruction +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.MinusClosedTransport +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix + +/-! +# Stable Change Cases One Two Starred Tail + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation835Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + alpha ∈ + TreeMissingColors phi (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ))) ∧ + beta ∈ + TreeMissingColors phi (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ))) → + ∀ (z : V ⊕ E), + TwoColorPathComponent G phi alpha beta z → + ∀ (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (0 : ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors phi Tnq ∨ + H.dividerCount = (0 : ℕ) ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + alpha ∈ TreeMissingColors phi A ∧ alpha ∉ Dn ∧ beta ∉ Dn)) → + (let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ eta ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)))) → + (∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))) (c : Fin k), + c = alpha ∨ c = beta → + c ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy r) → + TreeColorSetClosed G phi (HierarchyStarredStage C.hierarchy r) { c } → + OutsideKempeRecoloring (HierarchyStarredStage C.hierarchy r) phi sigma alpha + beta) → + ModColoring ett sigma → + (∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + alpha ∈ TreeMissingColors sigma A ∧ beta ∈ TreeMissingColors sigma A → + alpha ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∧ + beta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) → + HierarchyWeaklyStable H q sigma → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT → + ∀ (baseT : HierarchyBase corrT.replacementETT sigma) + (hcoreT : baseT.core = base.core), + baseT.closure = base.closure → + ∀ + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind + (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { + dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, + strict := H.strict, dividerPosition := H.dividerPosition, + dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, + dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (H.stage + (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors K j = + HierarchyStageMissingColors H j) → + (∀ (f : E) (c : Fin k), + c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + ∃ (corrT : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT ∧ + ∃ (baseT : HierarchyBase corrT.replacementETT sigma) (K : + TashkinovHierarchy corrT.replacementETT baseT) (goodT : + GoodHierarchy K), SameGoodHierarchy C.good goodT + +private theorem helper_corrData_362.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + TreeSequenceInitialSegment Tn A → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn Dn TnToA treeMissingEq corr + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive replacementData above strict below generating => + cases rungAgreement + have hs : replacementData = replacementSeries := eq_of_heq seriesPresentation + cases hs + let a : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ + have ha : a.succ = Fin.last ett.rounds := Fin.ext (by + change ett.rounds - 1 + 1 = ett.rounds + have := ett.roundsPositive + omega) + have ht : replacementSeries.data.tree (Fin.last ett.rounds).castSucc = Tn := by + change replacementSeries.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc + rw [← ha] + exact ladderTreesAgree a + have hm : TreeMissingColors (replacementSeries.data.coloring (Fin.last ett.rounds)) + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi Tn := by + rw [← finalGeneratingColoring, ht] + exact treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) + have hmOld : TreeMissingColors (ett.series.data.coloring (Fin.last ett.rounds)) + (ett.series.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi Tn := by rw [← ett.generatingColoring] + refine ⟨ht, extensionKindsAgree (Fin.last ett.rounds), ?_⟩ + change TashkinovStoredColors replacementSeries.data (Fin.last ett.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) + simp only [TashkinovStoredColors, storedColorsAgree, hm, hmOld] + +private theorem helper_fullBase_401.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (sigma : PartialEdgeColoring E k), + let _ : TashkinovHierarchy ett base := C.hierarchy; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + ModColoring ett sigma → + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + CombinedStableColoring Tn base.closure Dn phi sigma) → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed T) → + (∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + Tn ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corr.replacementETT ∧ + ∃ (baseT : HierarchyBase corr.replacementETT sigma), + baseT.core = base.core ∧ baseT.closure = base.closure := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx sigma H n Tn Dn hsproper hsone hmod + combined sigmaRoute corrData + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · have hb : TashkinovAugmentationSequence sigma Tn T := by + rcases sigmaRoute with ⟨_, hseq⟩ | ⟨hk, rest⟩ + · exact hseq + · rcases hk with hk | hk <;> rw [hp] at hk <;> cases hk + obtain ⟨corr, hMP, baseT, K0, hsame⟩ := HierarchySplitter G k e0 input T phi sigma + ett C.maximum C.positive ctx.lowerRung base H hp ctx.proper ctx.oneEdgeUncolored + hsproper hsone (combined hp) hb + exact ⟨corr, hMP, baseT, hsame.1.symm, (hsame.2.2.2.2.2 hp).symm⟩ + · obtain ⟨corr⟩ := hmod.2.2 T ett.abovePenultimate ett.strictAbovePenultimate sigmaRoute + have hd := corrData corr + let pos : Fin ((corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc).length + 1) := + Fin.cast (congrArg (fun W : TreeSequence G e0 => W.length + 1) hd.1.symm) + base.supportPosition + let baseT : HierarchyBase corr.replacementETT sigma := { + core := base.core + closure := base.closure + supportPosition := pos + supportPositive := by simpa [pos] using base.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only + intro hPE + exact False.elim (hp (hd.2.1.symm.trans hPE)) + nonparallel := by + dsimp only + intro _ + exact (base.nonparallel hp).trans hd.1.symm } + exact ⟨corr, MaximumPropertyTransport G k e0 ett sigma hmod T corr C.maximum, + baseT, rfl, rfl⟩ + +private theorem helper_parallelGood_530.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + alpha ∈ + TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ))) ∧ + beta ∈ + TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ))) → + ∀ (z : V ⊕ E), + TwoColorPathComponent G phi alpha beta z → + ∀ (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (0 : ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors phi Tnq ∨ + H.dividerCount = (0 : ℕ) ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + alpha ∈ TreeMissingColors phi A ∧ alpha ∉ Dn ∧ beta ∉ Dn)) → + (let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)))) → + alpha ∈ TreeMissingColors sigma A ∧ beta ∈ TreeMissingColors sigma A → + alpha ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∧ + beta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma base.core + ((HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma base.closure) \ + (HierarchyStoredColorsAt H (0 : Fin (H.dividerCount + (1 : ℕ)))).biUnion + (C.good.gamma (0 : Fin (C.hierarchy.dividerCount + (1 : ℕ))))).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha beta hne hmissingPrefix z hpath sigma + hsigma hcase hdisjoint H q A n Tn helem hstarMissing hgammaOutside lastZero coreToA TnToA + treeMissingEq unaffected hp + by_cases hz : H.dividerCount = 0 + · obtain ⟨hnot, hcard⟩ := C.good.parallelBase hp + constructor + · intro hclosed + apply hnot + intro c hc + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨hb, hcol⟩ := Finset.mem_filter.mp hf + have hm : c ∈ TreeMissingColors sigma base.core := by + rw [treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset coreToA)] + exact (Finset.mem_sdiff.mp hc).1 + have hq0 : q = 0 := Fin.ext (by simpa [q] using hz) + have ha : alpha ∈ TreeMissingColors sigma base.core := + lastZero hz ▸ hstarMissing.1 + have hbeta : beta ∈ TreeMissingColors sigma base.core := + lastZero hz ▸ hstarMissing.2 + have hga : alpha ∉ (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0) := by + simpa only [hq0] using hgammaOutside.1 + have hgb : beta ∉ (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0) := by + simpa only [hq0] using hgammaOutside.2 + by_cases hfa : c = alpha + · subst c + by_cases hfz : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · have hs : sigma f = some beta := by + simp [hsigma, TwoColorComponentSwap, hfz, hcol] + have hh := hclosed beta (Finset.mem_sdiff.mpr ⟨hbeta, hgb⟩) + have hmem : f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet base.core) beta := + Finset.mem_filter.mpr ⟨hb, hs⟩ + rw [hh] at hmem + exact Finset.notMem_empty f hmem + · have hs : sigma f = some alpha := by + simp [hsigma, TwoColorComponentSwap, hfz, hcol] + have hh := hclosed alpha (Finset.mem_sdiff.mpr ⟨ha, hga⟩) + have hmem : f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet base.core) alpha := + Finset.mem_filter.mpr ⟨hb, hs⟩ + rw [hh] at hmem + exact Finset.notMem_empty f hmem + · by_cases hfb : c = beta + · subst c + by_cases hfz : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · have hs : sigma f = some alpha := by + simp [hsigma, TwoColorComponentSwap, hfz, hcol, hne.symm] + have hh := hclosed alpha (Finset.mem_sdiff.mpr ⟨ha, hga⟩) + have hmem : f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet base.core) alpha := + Finset.mem_filter.mpr ⟨hb, hs⟩ + rw [hh] at hmem + exact Finset.notMem_empty f hmem + · have hs : sigma f = some beta := by + simp [hsigma, TwoColorComponentSwap, hfz, hcol] + have hh := hclosed beta (Finset.mem_sdiff.mpr ⟨hbeta, hgb⟩) + have hmem : f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet base.core) beta := + Finset.mem_filter.mpr ⟨hb, hs⟩ + rw [hh] at hmem + exact Finset.notMem_empty f hmem + · have hh := hclosed c (Finset.mem_sdiff.mpr ⟨hm, (Finset.mem_sdiff.mp hc).2⟩) + have hmem : f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet base.core) c := + Finset.mem_filter.mpr ⟨hb, (unaffected f c hfa hfb).mpr hcol⟩ + rw [hh] at hmem + exact Finset.notMem_empty f hmem + · have hclosure : TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet A := by + obtain ⟨u⟩ := (base.parallel hp).2.2 + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [u.vertexSet] + exact Finset.mem_union_right _ hv + rw [treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA), + treeMissingEq base.closure hclosure] + exact hcard + · have hpos : 0 < H.dividerCount := Nat.pos_of_ne_zero hz + obtain ⟨inputA, ettA, baseA, KA, goodA, _, hkind, hcount, + hcoreA, hclosureA, hstageA, hstoredA, _⟩ := + (StableChangeCasesOneTwo G k e0 input T phi ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality helem ctx.largeMissingSet alpha beta hne + hmissingPrefix z hpath sigma hsigma hcase hdisjoint).2.2.2 hpos + have htreeA : ettA.series.data.tree (Fin.last ettA.rounds).castSucc = Tn := by + rw [← KA.baseStage, hstageA 0] + have hi : (⟨(0 : Fin (KA.dividerCount + 2)).val, + by simp only [Fin.val_zero]; omega⟩ : + Fin (C.hierarchy.dividerCount + 2)) = 0 := Fin.ext (by simp) + rw [hi] + exact H.baseStage + have hs0 := hstoredA 0 + have hi0 : (⟨(0 : Fin (KA.dividerCount + 1)).val, + by simp only [Fin.val_zero]; omega⟩ : + Fin (H.dividerCount + 1)) = 0 := Fin.ext (by simp) + have hgamma : (HierarchyStoredColorsAt KA 0).biUnion (goodA.gamma 0) = + (HierarchyStoredColorsAt H 0).biUnion (C.good.gamma 0) := by + have hs : HierarchyStoredColorsAt KA 0 = HierarchyStoredColorsAt H 0 := by + simpa only [hi0] using hs0.1 + apply Finset.biUnion_congr hs + intro eta heta + simpa only [hi0] using hs0.2 eta heta + have hg := goodA.parallelBase (hkind.trans hp) + rw [hcoreA, hclosureA, htreeA, hgamma] at hg + exact hg + +private theorem helper_segmentEq_708.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma A eta = + HierarchyFirstMissingPosition phi A eta) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) < H.dividerCount → + ∀ (eta : Fin k), + HierarchySegmentColors K j eta = HierarchySegmentColors H j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A n Tn Dn hfixed AToT ordinaryToA + corrT baseT hcoreT terminalData K starredEq firstEqA j hj eta + let i : Fin (H.dividerCount + 1) := ⟨j.val + 1, by omega⟩ + have hi : i.castSucc = j.succ := Fin.ext rfl + have hUA : TreeSequenceInitialSegment (H.stage j.succ) A := by + rw [← hi] + exact ordinaryToA i + have cut : min (HierarchyFirstMissingPosition sigma T eta).val (H.stage j.succ).length = + min (HierarchyFirstMissingPosition phi T eta).val (H.stage j.succ).length := by + rw [← HierarchyFirstMissingPositionPrefixCutoff sigma A T AToT eta _ hUA.1, + firstEqA eta, HierarchyFirstMissingPositionPrefixCutoff phi A T AToT eta _ hUA.1] + unfold HierarchySegmentColors + dsimp only + rw [starredEq j, cut] + apply Finset.filter_congr + intro c _ + constructor <;> rintro ⟨r, hlo, hhi, hcol⟩ <;> refine ⟨r, hlo, hhi, ?_⟩ + · have he : sigma ((H.stage j.succ).edge r) = phi ((H.stage j.succ).edge r) := by + rw [← hUA.2.2 r]; exact hfixed _ + exact he.symm.trans hcol + · have he : sigma ((H.stage j.succ).edge r) = phi ((H.stage j.succ).edge r) := by + rw [← hUA.2.2 r]; exact hfixed _ + exact he.trans hcol + +private theorem helper_preStepElementary_508.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let i : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by have this : (0 : ℕ) < ett.rounds := C.positive; omega⟩ : + Fin ett.rounds); + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx n Tn + dsimp only + by_cases hn : ett.rounds = 1 + · have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = 0 := + Fin.ext (by simp [hn]) + have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn]) + dsimp only [Tn] + rw [hcolor, htree] + exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + · have hmore : 1 < ett.rounds := by have := C.positive; omega + obtain ⟨predecessor, hr, hmaximum, _, _⟩ := + CertifiedETTPredecessor G k e0 input T phi ett C.maximum hmore + have htree : n.castSucc = (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext rfl + dsimp only [Tn] + rw [htree] + exact (ctx.lowerRung predecessor (by omega) (by omega) hmaximum).1 + +private theorem helper_weak_543.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (if ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE then + CombinedStableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi + sigma + else + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma) → + (∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + HierarchyWeaklyStable H q sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A hbase hfixed hmissing + cases hq : q using Fin.cases with + | zero => exact hbase + | succ i => + have hA : A = H.stage i.succ.castSucc := by + dsimp only [A] + rw [hq] + rfl + refine ⟨hbase, ?_⟩ + have he : ∀ t : Fin (H.stage i.succ.castSucc).length, + sigma ((H.stage i.succ.castSucc).edge t) = + phi ((H.stage i.succ.castSucc).edge t) := hA ▸ hfixed + have hm : ∀ v ∈ TreeSequenceVertexSet (H.stage i.succ.castSucc), + MissingColors G sigma v = MissingColors G phi v := by + simpa only [hA] using hmissing + exact ⟨fun t _ => he t, hm⟩ + +private theorem helper_transportPrefix_652.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (sigma : PartialEdgeColoring E k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (S X : TreeSequence G e0), + TashkinovAugmentationSequence phi S X → + TreeSequenceInitialSegment X A → + TashkinovAugmentationSequence sigma S X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C sigma H q A hfixed segTrans treeMissingEq S X hseq + unfold TashkinovAugmentationSequence at hseq ⊢ + induction hseq with + | refl => intro _; exact Relation.ReflTransGen.refl + | @tail U W hSU hUW ih => + intro hWA + obtain ⟨hlen, hseg, c, hcolor, hcm⟩ := hUW + have hUA := segTrans hseg hWA + have hcSigma : c ∈ TreeMissingColors sigma U := by + rw [treeMissingEq U (TreeSequenceInitialSegmentVertexSetSubset hUA)] + exact hcm + let t : Fin W.length := Fin.cast hlen.symm (Fin.last U.length) + have he : sigma (W.edge t) = phi (W.edge t) := by + rw [← hWA.2.2 t] + exact hfixed _ + exact Relation.ReflTransGen.tail (ih hUA) + ⟨hlen, hseg, c, he.trans hcolor, hcSigma⟩ + +private theorem helper_sigmaRoute_683.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + alpha ≠ beta → + ∀ (z : V ⊕ E) (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + alpha ∈ TreeMissingColors sigma A ∧ beta ∈ TreeMissingColors sigma A → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ {S U : TreeSequence G e0} (psi : PartialEdgeColoring E k), + TreeSequenceInitialSegment S U → + TreeMissingColors psi S ⊆ TreeMissingColors psi U) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S T → + TreeSequenceInitialSegment S A → TashkinovAugmentationSequence sigma S T) → + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne z sigma hsigma H q A n Tn + hstarMissing commonPrefix TnToA AToT missingSubset transportSuffix + rcases P2813_T1_TerminalRoute G k e0 input T phi ett with + ⟨hp, hseq⟩ | ⟨hp, f, seed, hedges, hseed, _, _, hseq⟩ + · exact Or.inl ⟨hp, transportSuffix Tn hseq TnToA⟩ + · refine Or.inr ⟨hp, f, seed, hedges, hseed, ?_⟩ + by_cases hlen : seed.length ≤ A.length + · exact transportSuffix seed hseq + (commonPrefix (TashkinovAugmentationSequenceInitialSegment phi seed T hseq) + AToT hlen) + · have hAS : TreeSequenceInitialSegment A seed := + commonPrefix AToT (TashkinovAugmentationSequenceInitialSegment phi seed T hseq) + (by omega) + rw [hsigma] at hstarMissing ⊢ + exact TashkinovAugmentationSequenceComponentSwap G k e0 phi alpha beta hne z + seed T hseq (missingSubset _ hAS hstarMissing.1) + (missingSubset _ hAS hstarMissing.2) + +private theorem helper_terminalAvoid_779.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (sigma : PartialEdgeColoring E k), + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ eta ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + alpha ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∧ + beta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) → + ∀ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) + (baseT : HierarchyBase corrT.replacementETT sigma) (hcoreT : baseT.core = base.core) + (terminalData : + corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc = + Tn ∧ + corrT.replacementETT.series.data.kind (Fin.last corrT.replacementETT.rounds) = + ett.series.data.kind n ∧ + TashkinovStoredColors corrT.replacementETT.series.data + (Fin.last corrT.replacementETT.rounds) = + Dn), + let K : TashkinovHierarchy corrT.replacementETT baseT := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm terminalData.left), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (H.stage (⟨(1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcoreT)) + H.coreInsideFirst : + TashkinovHierarchy corrT.replacementETT baseT }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + ∀ eta ∈ HierarchyStoredColorsAt H q, + ∀ c ∈ C.good.gamma q eta, + c ∈ HierarchySegmentColors K q eta → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta sigma hstoredFirst H q n Tn Dn + hgammaOutside corrT baseT hcoreT terminalData K starredEq unaffected eta heta c hc hseg + have hgamma : c ∈ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := + Finset.mem_biUnion.mpr ⟨eta, heta, hc⟩ + have hca : c ≠ alpha := fun he => hgammaOutside.1 (he ▸ hgamma) + have hcb : c ≠ beta := fun he => hgammaOutside.2 (he ▸ hgamma) + unfold HierarchySegmentColors at hseg + dsimp only at hseg + rw [starredEq q, hstoredFirst eta heta] at hseg + obtain ⟨_, r, hlo, hhi, hcol⟩ := Finset.mem_filter.mp hseg + have hold : c ∈ HierarchySegmentColors H q eta := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, r, hlo, hhi, + (unaffected _ c hca hcb).mp hcol⟩ + exact (Finset.mem_sdiff.mp (C.good.avoidance q eta heta hc)).2 hold + +private theorem helper_continuation_835.{u_1, u_2} : + helperContinuation835Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha beta hne hmissingPrefix z hpath sigma + hsigma hcase hdisjoint hstoredFirst H q A n Tn Dn helem houtside hmod hfixed hmissing + hstarMissing hgammaOutside weak lastZero coreToA TnToA AToT ordinaryToA starredToA + treeMissingEq corrT hmaximumT baseT hcoreT hclosureT terminalData K starredEq storedEq + stageMissingEq unaffected + have firstEqA (eta : Fin k) : + HierarchyFirstMissingPosition sigma A eta = HierarchyFirstMissingPosition phi A eta := by + have hc : (Finset.univ.filter fun j : Fin (A.length + 1) => + eta ∈ MissingColors G sigma (A.vertex j)) = + (Finset.univ.filter fun j : Fin (A.length + 1) => + eta ∈ MissingColors G phi (A.vertex j)) := by + apply Finset.filter_congr + intro j _ + rw [hmissing _ (by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩)] + unfold HierarchyFirstMissingPosition + rw [hc] + have segmentEq := @helper_segmentEq_708 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C sigma hfixed AToT ordinaryToA corrT baseT hcoreT + terminalData starredEq firstEqA + have terminalAvoid := @helper_terminalAvoid_779 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C alpha beta sigma hstoredFirst hgammaOutside corrT + baseT hcoreT terminalData starredEq unaffected + have parallelGood := @helper_parallelGood_530 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C ctx alpha beta hne hmissingPrefix z hpath sigma + hsigma hcase hdisjoint helem hstarMissing hgammaOutside lastZero coreToA TnToA treeMissingEq + unaffected + let goodT : GoodHierarchy K := { + gamma := C.good.gamma + twoColors := by + intro j eta heta + exact C.good.twoColors j eta (by rw [storedEq j] at heta; exact heta) + avoidance := by + intro j eta heta c hc + have ho : eta ∈ HierarchyStoredColorsAt H j := by rw [← storedEq j]; exact heta + have old := C.good.avoidance j eta ho hc + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · rw [stageMissingEq j]; exact (Finset.mem_sdiff.mp old).1 + · intro hseg + by_cases hj : j.val < H.dividerCount + · rw [segmentEq j hj eta] at hseg + exact (Finset.mem_sdiff.mp old).2 hseg + · have hjq : j = q := Fin.ext (by + have hjlt : j.val < H.dividerCount + 1 := j.isLt + dsimp [q] + omega) + subst j + exact terminalAvoid eta ho c hc hseg + disjointPairs := by + intro j eta theta heta htheta hne + exact C.good.disjointPairs j eta theta + (by rw [storedEq j] at heta; exact heta) + (by rw [storedEq j] at htheta; exact htheta) hne + uniqueRefresh := by + intro a + have hnew : + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H a.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H a.castSucc)).biUnion + fun v => MissingColors G phi v) := by + apply Finset.biUnion_congr rfl + intro v hv + exact hmissing v (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA a.succ) + (Finset.mem_sdiff.mp hv).1) + change ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt K a.succ ∧ + C.good.gamma a.succ eta ⊆ + ((TreeSequenceVertexSet (H.stage a.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K a.castSucc)).biUnion + fun v => MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K a.succ, theta ≠ eta → + C.good.gamma a.succ theta = C.good.gamma a.castSucc theta + rw [starredEq a.castSucc, hnew] + simp only [storedEq] + exact C.good.uniqueRefresh a + parallelBase := by + dsimp only + intro hp + have hpOld := terminalData.2.1.symm.trans hp + change ¬ TreeColorSetMinusClosed G sigma baseT.core + ((HierarchyStoredColorsAt K 0).biUnion (C.good.gamma 0)) ∧ + 4 ≤ ((TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseT.closure) \ + (HierarchyStoredColorsAt K 0).biUnion (C.good.gamma 0)).card + rw [hcoreT, hclosureT, terminalData.1, storedEq 0] + exact parallelGood hpOld + minusClosed := by + intro a + change TreeColorSetMinusClosed G sigma (H.stage a.succ.castSucc) + ((HierarchyStoredColorsAt K a.succ).biUnion (C.good.gamma a.castSucc)) + rw [storedEq a.succ] + have hstar : HierarchyStarredStage H a.succ = H.stage a.succ.castSucc := rfl + rw [← hstar] + exact P2813_T1_MinusClosedTransport G k e0 _ phi sigma alpha beta hne z hsigma + ctx.proper ctx.oneEdgeUncolored _ (C.good.minusClosed a) + (fun v hv => hmissing v (TreeSequenceInitialSegmentVertexSetSubset + (starredToA a.succ) hv)) (houtside a.succ) } + have same : SameGoodHierarchy C.good goodT := by + refine ⟨?_, rfl, ?_⟩ + · refine ⟨hcoreT.symm, rfl, HEq.rfl, HEq.rfl, ?_, fun _ => hclosureT.symm⟩ + exact ⟨fun hp => terminalData.2.1.trans hp, fun hp => terminalData.2.1.symm.trans hp⟩ + · intro j + exact ⟨(storedEq j).symm, fun _ _ => rfl⟩ + exact ⟨weak, hmod, corrT, hmaximumT, baseT, K, goodT, same⟩ + +private theorem helper_continuation_817.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + alpha ∈ + TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ))) ∧ + beta ∈ + TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ))) → + ∀ (z : V ⊕ E), + TwoColorPathComponent G phi alpha beta z → + ∀ (sigma : PartialEdgeColoring E k), + sigma = TwoColorComponentSwap G phi alpha beta z → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Tnq : TreeSequence G e0 := + H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + (0 : ℕ) < H.dividerCount ∧ alpha ∈ TreeMissingColors phi Tnq ∨ + H.dividerCount = (0 : ℕ) ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + alpha ∈ TreeMissingColors phi A ∧ alpha ∉ Dn ∧ beta ∉ Dn)) → + (let va : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) → + (let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ∀ eta ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)))) → + (if ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE then + CombinedStableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + base.closure (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi + sigma + else + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma) → + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))) (c : Fin k), + c = alpha ∨ c = beta → + c ∈ TreeMissingColors phi (HierarchyStarredStage C.hierarchy r) → + TreeColorSetClosed G phi (HierarchyStarredStage C.hierarchy r) { c } → + OutsideKempeRecoloring (HierarchyStarredStage C.hierarchy r) phi sigma alpha + beta) → + ModColoring ett sigma → + (∀ (t : Fin A.length), sigma (A.edge t) = phi (A.edge t)) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + alpha ∈ TreeMissingColors sigma A ∧ beta ∈ TreeMissingColors sigma A → + alpha ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∧ + beta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) → + HierarchyWeaklyStable H q sigma → + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment base.core A → + TreeSequenceInitialSegment Tn A → + TreeSequenceInitialSegment A T → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + ∃ (corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + MaximumProperty corrT.replacementETT ∧ + ∃ (baseT : HierarchyBase corrT.replacementETT sigma) (K : + TashkinovHierarchy corrT.replacementETT baseT) (goodT : GoodHierarchy K), + SameGoodHierarchy C.good goodT := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx alpha beta hne hmissingPrefix z hpath sigma + hsigma hcase hdisjoint hstoredFirst H q A n Tn Dn helem hbase hsproper hsone houtside hmod + hfixed hmissing hstarMissing hgammaOutside weak segRefl segTrans commonPrefix lastZero + coreToA TnToA AToT ordinaryToA + have starredToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) A := + Fin.cases coreToA (fun i => ordinaryToA i.succ) j + have combined (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + CombinedStableColoring Tn base.closure Dn phi sigma := by + change (if ett.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn base.closure Dn phi sigma + else StableColoring Tn Dn phi sigma) at hbase + simpa only [ite_eq_left hp] using hbase + have treeMissingEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A) : + TreeMissingColors sigma S = TreeMissingColors phi S := + Finset.biUnion_congr rfl (fun v hv => hmissing v (hS hv)) + have missingSubset {S U : TreeSequence G e0} (psi : PartialEdgeColoring E k) + (hSU : TreeSequenceInitialSegment S U) : + TreeMissingColors psi S ⊆ TreeMissingColors psi U := by + intro c hc + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hSU hv, hvc⟩ + have transportPrefix := @helper_transportPrefix_652 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C sigma hfixed segTrans treeMissingEq + have transportSuffix (S : TreeSequence G e0) + (hseq : TashkinovAugmentationSequence phi S T) + (hSA : TreeSequenceInitialSegment S A) : + TashkinovAugmentationSequence sigma S T := by + have hpre := TashkinovAugmentationSequenceRestrict phi S A T hseq hSA AToT + have htail := TashkinovAugmentationSequenceSuffix phi S A T hseq hSA AToT + have ht : TashkinovAugmentationSequence sigma A T := by + rw [hsigma] at hstarMissing ⊢ + exact TashkinovAugmentationSequenceComponentSwap G k e0 phi alpha beta hne z + A T htail hstarMissing.1 hstarMissing.2 + exact (transportPrefix S A hpre (segRefl A)).trans ht + have sigmaRoute := @helper_sigmaRoute_683 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C alpha beta hne z sigma hsigma hstarMissing + commonPrefix TnToA AToT missingSubset transportSuffix + have corrData := @helper_corrData_362 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C sigma TnToA treeMissingEq + have fullBase := @helper_fullBase_401 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C ctx sigma hsproper hsone hmod combined sigmaRoute corrData + obtain ⟨corrT, hmaximumT, baseT, hcoreT, hclosureT⟩ := fullBase + have terminalData := corrData corrT + let K : TashkinovHierarchy corrT.replacementETT baseT := { + dividerCount := H.dividerCount + stage := H.stage + baseStage := H.baseStage.trans terminalData.1.symm + terminalStage := H.terminalStage + nested := H.nested + strict := H.strict + dividerPosition := H.dividerPosition + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := H.dividerStage + coreInsideFirst := by rw [hcoreT]; exact H.coreInsideFirst } + have starredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage H j := + Fin.cases hcoreT (fun _ => rfl) j + have storedEq (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j := by + unfold HierarchyStoredColorsAt + dsimp only + rw [terminalData.2.2, starredEq j, + treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starredToA j))] + have stageMissingEq (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j := by + refine Fin.cases ?_ (fun a => ?_) j + · change TreeMissingColors sigma + (corrT.replacementETT.series.data.tree + (Fin.last corrT.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + rw [terminalData.1] + exact treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) + · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (ordinaryToA a.succ)) + have unaffected (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + sigma f = some c ↔ phi f = some c := by + rw [hsigma] + by_cases hf : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · by_cases ha : phi f = some alpha + · simp [TwoColorComponentSwap, hf, ha, hca.symm, hcb.symm] + · by_cases hb : phi f = some beta + · simp [TwoColorComponentSwap, hf, hb, hne.symm, hca.symm, hcb.symm] + · simp [TwoColorComponentSwap, hf, ha, hb] + · simp [TwoColorComponentSwap, hf] + exact @helper_continuation_835 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx alpha beta hne hmissingPrefix z hpath sigma hsigma hcase + hdisjoint hstoredFirst helem houtside hmod hfixed hmissing hstarMissing hgammaOutside weak + lastZero coreToA TnToA AToT ordinaryToA starredToA treeMissingEq corrT hmaximumT baseT + hcoreT hclosureT terminalData starredEq storedEq stageMissingEq unaffected +theorem StableChangeCasesOneTwoStarredTail {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hmissingPrefix : + alpha ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) ∧ + beta ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1))) + (z : Sum V E) (hpath : TwoColorPathComponent G phi alpha beta z) + (sigma : PartialEdgeColoring E k) + (hsigma : sigma = TwoColorComponentSwap G phi alpha beta z) + (hcase : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let A := HierarchyStarredStage H q + let Tnq := H.stage ⟨H.dividerCount, by omega⟩ + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + (0 < H.dividerCount ∧ alpha ∈ TreeMissingColors phi Tnq) ∨ + (H.dividerCount = 0 ∧ + (alpha ∈ TreeMissingColors phi Tn ∨ + (alpha ∈ TreeMissingColors phi A ∧ + alpha ∉ Dn ∧ beta ∉ Dn)))) + (hdisjoint : + let va := T.vertex (HierarchyFirstMissingPosition phi T alpha) + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta (Sum.inl va))) + (hstarMissing : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + alpha ∈ TreeMissingColors sigma A ∧ + beta ∈ TreeMissingColors sigma A) + (hgammaOutside : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let Gamma := (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) + alpha ∉ Gamma ∧ beta ∉ Gamma) + (_ : + ∀ v, v ∈ TreeSequenceVertexSet + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) → + MissingColors G sigma v = MissingColors G phi v) + (hstoredFirst : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + ∀ eta, eta ∈ HierarchyStoredColorsAt H q → + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta) : + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + HierarchyWeaklyStable H q sigma ∧ + ModColoring ett sigma ∧ + ∃ corrT : CorrespondingExtendedTashkinovTree G k e0 ett sigma T, + MaximumProperty corrT.replacementETT ∧ + ∃ baseT : HierarchyBase corrT.replacementETT sigma, + ∃ K : TashkinovHierarchy corrT.replacementETT baseT, + ∃ goodT : GoodHierarchy K, SameGoodHierarchy C.good goodT := by + classical + let H := C.hierarchy + let q : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + have helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1))) := + HierarchyCounterexamplePenultimateElementary G k e0 input T phi + ett base C ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have controls := P2813_T1_BaseControl G k e0 input T phi ett base C ctx + helem alpha beta hne hmissingPrefix z hpath sigma hsigma hcase hdisjoint + rcases controls with ⟨hbase, hmissing, hsproper, hsone, houtside⟩ + have preStepElementary := @helper_preStepElementary_508 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C ctx + have hfixed := P2813_T1_DisplayedEdges G k e0 input T phi ett base H C.good + ctx.proper ctx.oneEdgeUncolored preStepElementary helem alpha beta z sigma hsigma + hsone hbase houtside + have rebuilt := P2813_T1_PrefixReconstruction G k e0 input T phi ett base C ctx + sigma hsproper hsone hbase hfixed hmissing + have hmod : ModColoring ett sigma := rebuilt.1 + change (∀ t : Fin A.length, sigma (A.edge t) = phi (A.edge t)) at hfixed + change (∀ v ∈ TreeSequenceVertexSet A, + MissingColors G sigma v = MissingColors G phi v) at hmissing + change alpha ∈ TreeMissingColors sigma A ∧ beta ∈ TreeMissingColors sigma A + at hstarMissing + change alpha ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) ∧ + beta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) at hgammaOutside + have weak := @helper_weak_543 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C sigma hbase hfixed hmissing + have segRefl (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + induction d with + | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + have stageToT (j : Fin (H.dividerCount + 2)) : + TreeSequenceInitialSegment (H.stage j) T := by + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) + simpa [he, H.terminalStage] using hs + have lastZero (hz : H.dividerCount = 0) : A = base.core := by + simp [A, q, HierarchyStarredStage, hz, Fin.last] + have lastPositive (hz : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm + have coreToA : TreeSequenceInitialSegment base.core A := by + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz]; exact segRefl _ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + have TnToCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (base.parallel hp).2.2).leftSegment + · rw [base.nonparallel hp]; exact segRefl _ + have TnToA := segTrans TnToCore coreToA + have AToT : TreeSequenceInitialSegment A T := by + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) + · rw [lastPositive hz]; exact stageToT _ + have ordinaryToA (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + by_cases hz : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) + rw [hj, H.baseStage]; exact TnToA + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + rw [lastPositive hz] + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> + simp only [Fin.val_castSucc]; omega + exact @helper_continuation_817 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx alpha beta hne hmissingPrefix z hpath sigma hsigma hcase + hdisjoint hstoredFirst helem hbase hsproper hsone houtside hmod hfixed hmissing + hstarMissing hgammaOutside weak segRefl segTrans commonPrefix lastZero coreToA TnToA AToT + ordinaryToA +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableColoring.lean b/LeanPool/GoldbergSeymour/StableColoring.lean new file mode 100644 index 0000000000..d5475e96c6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableColoring.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors + +/-! +# Stable Coloring + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Preservation of relevant incident-edge colors and every missing-color set on the tree. -/ +def StableColoring {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (T : TreeSequence G e0) (C : Finset (Fin k)) (phi pi : PartialEdgeColoring E k) : Prop := + (∀ f, TreeIncidentEdge T f → (∃ c ∈ TreeMissingColors phi T ∪ C, phi f = some c) → pi f = phi f) ∧ + ∀ v ∈ TreeSequenceVertexSet T, MissingColors G pi v = MissingColors G phi v + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableColoringBeforeVertex.lean b/LeanPool/GoldbergSeymour/StableColoringBeforeVertex.lean new file mode 100644 index 0000000000..1de5c98eb1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableColoringBeforeVertex.lean @@ -0,0 +1,37 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColors + +public import LeanPool.GoldbergSeymour.TreeVerticesBefore + +/-! +# Stable Coloring Before Vertex + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Stability restricted to tree vertices preceding the given vertex. -/ +def StableColoringBeforeVertex {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} (T : TreeSequence G e0) (v : V) (hv : v ∈ TreeSequenceVertexSet T) + (C : Finset (Fin k)) (phi pi : PartialEdgeColoring E k) : Prop := + (∀ f, + (∃ w ∈ TreeVerticesBefore T v hv, Incident G w f) → + (∃ c ∈ ((TreeVerticesBefore T v hv).biUnion fun w => MissingColors G phi w) ∪ C, + phi f = some c) → + pi f = phi f) ∧ + ∀ w ∈ TreeVerticesBefore T v hv, MissingColors G pi w = MissingColors G phi w + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableColoringEquivalence.lean b/LeanPool/GoldbergSeymour/StableColoringEquivalence.lean new file mode 100644 index 0000000000..6d48efc102 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableColoringEquivalence.lean @@ -0,0 +1,125 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion + +/-! +# sc2 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem sc2 {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) {k : ℕ} + (e0 : E) (T : TreeSequence G e0) (C : Finset (Fin k)) : + Equivalence + (fun phi pi : + { psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0 } => + StableColoring T C phi.1 pi.1) := by + classical + let _ := Fintype.ofFinite V + constructor + · intro a + unfold StableColoring + constructor + · intro f hf h + rfl + · intro v hv + rfl + · intro a b hab + have hmiss : ∀ v, v ∈ TreeSequenceVertexSet T → + MissingColors G b.1 v = MissingColors G a.1 v := by + intro v hv + exact hab.2 v hv + have htree : TreeMissingColors b.1 T = TreeMissingColors a.1 T := by + ext c + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by rw [← hmiss v hv]; exact hc⟩ + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, by rw [hmiss v hv]; exact hc⟩ + apply (sc1 G e0 T C b.1 a.1 b.2.1 b.2.2 a.2.1 a.2.2).2 + intro f hf h + have hcrit := (sc1 G e0 T C a.1 b.1 a.2.1 a.2.2 b.2.1 b.2.2).mp hab + rw [htree] at h + rcases h with hb | ha + · exact (hcrit f hf (Or.inr hb)).symm + · exact (hcrit f hf (Or.inl ha)).symm + · intro a b c hab hbc + have hmissAB : ∀ v, v ∈ TreeSequenceVertexSet T → + MissingColors G b.1 v = MissingColors G a.1 v := by + intro v hv + exact hab.2 v hv + have hmissBC : ∀ v, v ∈ TreeSequenceVertexSet T → + MissingColors G c.1 v = MissingColors G b.1 v := by + intro v hv + exact hbc.2 v hv + have htreeAB : TreeMissingColors b.1 T = TreeMissingColors a.1 T := by + ext x + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hx⟩ + exact ⟨v, hv, by rw [← hmissAB v hv]; exact hx⟩ + · rintro ⟨v, hv, hx⟩ + exact ⟨v, hv, by rw [hmissAB v hv]; exact hx⟩ + have htreeBC : TreeMissingColors c.1 T = TreeMissingColors b.1 T := by + ext x + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hx⟩ + exact ⟨v, hv, by rw [← hmissBC v hv]; exact hx⟩ + · rintro ⟨v, hv, hx⟩ + exact ⟨v, hv, by rw [hmissBC v hv]; exact hx⟩ + apply (sc1 G e0 T C a.1 c.1 a.2.1 a.2.2 c.2.1 c.2.2).2 + have hcritAB := (sc1 G e0 T C a.1 b.1 a.2.1 a.2.2 b.2.1 b.2.2).mp hab + have hcritBC := (sc1 G e0 T C b.1 c.1 b.2.1 b.2.2 c.2.1 c.2.2).mp hbc + intro f hf h + rcases h with ha | hc + · have habf : b.1 f = a.1 f := by + apply hcritAB f hf + left + exact ha + have hbcf : c.1 f = b.1 f := by + apply hcritBC f hf + left + rcases ha with ⟨color, hcolor, haf⟩ + refine ⟨color, ?_, ?_⟩ + · rw [htreeAB] + exact hcolor + · rw [habf] + exact haf + exact hbcf.trans habf + · have hbcf : c.1 f = b.1 f := by + apply hcritBC f hf + right + have hcB := hc + rw [← htreeAB] at hcB + exact hcB + have habf : b.1 f = a.1 f := by + apply hcritAB f hf + right + rcases hc with ⟨color, hcolor, hcf⟩ + refine ⟨color, hcolor, ?_⟩ + rw [← hbcf] + exact hcf + exact hbcf.trans habf + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableColoringExitExtension.lean b/LeanPool/GoldbergSeymour/StableColoringExitExtension.lean new file mode 100644 index 0000000000..28da137afe --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableColoringExitExtension.lean @@ -0,0 +1,518 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# LEM_extable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_ends_eq_of_mem_61.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ), + MaximumDegree G + (1 : ℕ) ≤ k → + ∀ {z : Sym2 V} {x y : V}, x ∈ z → y ∈ z → x ≠ y → z = s(x, y) := by + classical + intro V E _ _ G k _ z x y hx hy hxy + induction z using Sym2.inductionOn with + | _ a b => + simp only [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> simp_all [] + +private theorem helper_hbetat_71.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (delta : Fin k) (pi : PartialEdgeColoring E k), StableColoring T (insert delta C : Finset + (Fin k)) phi pi → + ∀ beta ∈ TreeMissingColors pi T, beta ∈ TreeMissingColors phi T := by + classical + intro V E _ _ G k e0 T C phi delta pi hstable beta hbetat + let _ := Fintype.ofFinite V + have hv : ∃ w ∈ TreeSequenceVertexSet T, beta ∈ MissingColors G pi w := by + unfold TreeMissingColors at hbetat + simpa only [Finset.mem_biUnion] using hbetat + obtain ⟨w, hw, hbw⟩ := hv + rw [hstable.2 w hw] at hbw + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + exact ⟨w, hw, hbw⟩ + +private theorem helper_tree_boundary_91.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0), MaximumDegree G + (1 : ℕ) ≤ k → ( + ∀ {z : Sym2 V} {x y : V}, x ∈ z → y ∈ z → x ≠ y → z = s(x, y)) → + ∀ {e g : E}, TreeIncidentEdge T e → ¬TreeIncidentEdge T g → AdjacentEdges G e g → e ∈ + BoundaryEdges G (TreeSequenceVertexSet T) := by + classical + intro V E _ _ G k e0 T _ ends_eq_of_mem e g he hg hadj + obtain ⟨x, hx, hxe⟩ := he + obtain ⟨w, hwe, hwg⟩ := hadj + have hwout : w ∉ TreeSequenceVertexSet T := by + intro hw + exact hg ⟨w, hw, hwg⟩ + have hxy : x ≠ w := by + intro h + exact hwout (h ▸ hx) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + change ∃ a ∈ TreeSequenceVertexSet T, ∃ b ∉ TreeSequenceVertexSet T, + G.ends e = s(a, b) + refine ⟨x, hx, w, hwout, ?_⟩ + exact ends_eq_of_mem hxe hwe hxy + +private theorem helper_swap_injective_111 : + open scoped Classical in + ∀ (k : ℕ) (alpha beta : Fin k), + Function.Injective fun (q : Option (Fin k)) ↦ + if q = some alpha then some beta else if q = some beta then some alpha else q := by + classical + intro k alpha beta q r h + cases q <;> cases r + · rfl + · rename_i val + by_cases ha : val = alpha + · simp [ha] at h + · by_cases hb : val = beta + · have hab : beta ≠ alpha := by + intro hab + exact ha (hb.trans hab) + simp [hb, hab] at h + · simp [ha, hb] at h + · rename_i val + by_cases ha : val = alpha + · simp [ha] at h + · by_cases hb : val = beta + · have hab : beta ≠ alpha := by + intro hab + exact ha (hb.trans hab) + simp [hb, hab] at h + · simp [ha, hb] at h + · simp only [Option.some.injEq] at h ⊢ + rename_i a b + by_cases qa : a = alpha <;> by_cases qb : a = beta <;> + by_cases ra : b = alpha <;> by_cases rb : b = beta <;> simp_all + +private theorem helper_branch_141.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (delta alpha : Fin k) (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → + ∀ (beta : Fin k), ( + ∀ (f : E), TreeIncidentEdge T f → (( + ∃ c ∈ TreeMissingColors phi T ∪ (insert delta C : Finset (Fin k)), phi f = some c) ∨ + ∃ c ∈ TreeMissingColors phi T ∪ (insert delta C : Finset (Fin k)), pi f = some c) → pi f = phi + f) → alpha ∈ TreeMissingColors phi T → beta ∈ TreeMissingColors phi T → ( + ∀ {g : E}, g ∈ BoundaryEdges G (TreeSequenceVertexSet T) → ¬phi g = some alpha) → ( + ∀ {g : E}, g ∈ BoundaryEdges G (TreeSequenceVertexSet T) → ¬phi g = some beta) → + let sigma : PartialEdgeColoring E k := OutsideTreeColorSwap T pi alpha beta; ( + ∀ {e g : E}, TreeIncidentEdge T e → ¬TreeIncidentEdge T g → AdjacentEdges G e g → e ∈ + BoundaryEdges G (TreeSequenceVertexSet T)) → ( + ∀ {e : E}, TreeIncidentEdge T e → sigma e = pi e) → + ∀ ⦃e g : E⦄ ⦃c : Fin k⦄, e ≠ g → AdjacentEdges G e g → sigma e = some c → TreeIncidentEdge T e + → sigma g ≠ some c := by + classical + intro V E _ _ G k e0 T C phi delta alpha pi hpi beta hcriterion halphat hbetat' halphaClosed + hbetaClosed sigma tree_boundary tree_fixed e g c hne hadj hec he + by_cases hg : TreeIncidentEdge T g + · intro hsg + apply hpi hne hadj + · simpa [tree_fixed he] using hec + · simpa [tree_fixed hg] using hsg + · have hb := tree_boundary he hg hadj + have hna : pi e ≠ some alpha := by + intro hpa + have hfix := hcriterion e he (Or.inr ⟨alpha, Finset.mem_union_left _ halphat, hpa⟩) + exact halphaClosed hb (hfix ▸ hpa) + have hnb : pi e ≠ some beta := by + intro hpb + have hfix := hcriterion e he (Or.inr ⟨beta, Finset.mem_union_left _ hbetat', hpb⟩) + exact hbetaClosed hb (hfix ▸ hpb) + have hca : c ≠ alpha := by + intro h + exact hna (h ▸ (by simpa [tree_fixed he] using hec)) + have hcb : c ≠ beta := by + intro h + exact hnb (h ▸ (by simpa [tree_fixed he] using hec)) + have hpe : pi e = some c := by simpa [tree_fixed he] using hec + intro hsg + have hpg : pi g = some c := by + by_cases ga : pi g = some alpha + · have hs : some beta = some c := by + simpa [sigma, OutsideTreeColorSwap, hg, ga] using hsg + exact False.elim (hcb (Option.some.inj hs).symm) + · by_cases gb : pi g = some beta + · have hs : some alpha = some c := by + have hab : alpha ≠ beta := by + intro h + exact ga (h ▸ gb) + simpa [sigma, OutsideTreeColorSwap, hg, ga, gb, hab, hab.symm] using hsg + exact False.elim (hca (Option.some.inj hs).symm) + · simpa [sigma, OutsideTreeColorSwap, hg, ga, gb] using hsg + exact hpi hne hadj hpe hpg + +private theorem helper_branch_177.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 f : E) (T : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (u + v : V) (delta : Fin k), IsOneEdgeUncolored phi e0 → ColoredVertexSetClosed G phi + (TreeSequenceVertexSet T) → f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → u ∉ + TreeSequenceVertexSet T → v ∈ TreeSequenceVertexSet T → + ∀ (alpha : Fin k) (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → StableColoring T (insert delta C : Finset (Fin k)) phi pi → + ∀ beta ∈ TreeMissingColors pi T, ( + ∀ (f : E), TreeIncidentEdge T f → (( + ∃ c ∈ TreeMissingColors phi T ∪ (insert delta C : Finset (Fin k)), phi f = some c) ∨ + ∃ c ∈ TreeMissingColors phi T ∪ (insert delta C : Finset (Fin k)), pi f = some c) → pi f = phi + f) → alpha ∈ TreeMissingColors phi T → beta ∈ TreeMissingColors phi T → ( + ∀ {g : E}, g ∈ BoundaryEdges G (TreeSequenceVertexSet T) → ¬phi g = some alpha) → ( + ∀ {g : E}, g ∈ BoundaryEdges G (TreeSequenceVertexSet T) → ¬phi g = some beta) → + let sigma : PartialEdgeColoring E k := OutsideTreeColorSwap T pi alpha beta; ( + ∀ {e g : E}, TreeIncidentEdge T e → ¬TreeIncidentEdge T g → AdjacentEdges G e g → e ∈ + BoundaryEdges G (TreeSequenceVertexSet T)) → ( + ∀ {e : E}, TreeIncidentEdge T e → sigma e = pi e) → (Function.Injective fun (q : Option (Fin + k)) ↦ if q = some alpha then some beta else if q = some beta then some alpha else q) → + ∀ ⦃e g : E⦄ ⦃c : Fin k⦄, e ≠ g → AdjacentEdges G e g → sigma e = some c → ¬TreeIncidentEdge T + e → sigma g ≠ some c := by + classical + intro V E _ _ G k e0 f T C phi u v delta honePhi hclosed hfboundary huout hvin alpha pi hpi + honepi hstable beta hbetat hcriterion halphat hbetat' halphaClosed hbetaClosed sigma + tree_boundary tree_fixed swap_injective e g c hne hadj hec he + by_cases hg : TreeIncidentEdge T g + · obtain ⟨w, hwe, hwg⟩ := hadj + have hb := tree_boundary hg he ⟨w, hwg, hwe⟩ + have hna : pi g ≠ some alpha := by + intro hpa + have hfix := hcriterion g hg (Or.inr ⟨alpha, Finset.mem_union_left _ halphat, hpa⟩) + exact halphaClosed hb (hfix ▸ hpa) + have hnb : pi g ≠ some beta := by + intro hpb + have hfix := hcriterion g hg (Or.inr ⟨beta, Finset.mem_union_left _ hbetat', hpb⟩) + exact hbetaClosed hb (hfix ▸ hpb) + have hsg : sigma g ≠ some c := by + intro h + have hpg : pi g = some c := by simpa [tree_fixed hg] using h + have hca : c ≠ alpha := by + intro hc + exact hna (hc ▸ hpg) + have hcb : c ≠ beta := by + intro hc + exact hnb (hc ▸ hpg) + have hpe' : pi e = some c := by + by_cases hea : pi e = some alpha + · exfalso + have : some beta = some c := by + simpa [sigma, OutsideTreeColorSwap, he, hea] using hec + exact hcb (Option.some.inj this).symm + · by_cases heb : pi e = some beta + · exfalso + have : some alpha = some c := by + have hab : alpha ≠ beta := by + intro h + exact hea (h ▸ heb) + simpa [sigma, OutsideTreeColorSwap, he, hea, heb, hab, hab.symm] using hec + exact hca (Option.some.inj this).symm + · simpa [sigma, OutsideTreeColorSwap, he, hea, heb] using hec + exact (hpi hne.symm ⟨w, hwg, hwe⟩ hpg hpe') + exact hsg + · intro hsg + have hsame : sigma e = sigma g := hec.trans hsg.symm + have hpi_eq : pi e = pi g := by + apply swap_injective + simpa [sigma, OutsideTreeColorSwap, he, hg] using hsame + have he0 : TreeIncidentEdge T e0 := by + have hatt := T.attaches (⟨0, T.positive⟩ : Fin T.length) + obtain ⟨i, hi⟩ := hatt + have hi0 : i = ⟨0, Nat.zero_lt_succ _⟩ := by + apply Fin.ext + exact Nat.eq_zero_of_le_zero (Nat.le_of_lt_succ i.isLt) + subst i + have hvertex : T.vertex ⟨0, Nat.zero_lt_succ _⟩ ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet] + refine ⟨T.vertex ⟨0, Nat.zero_lt_succ _⟩, hvertex, ?_⟩ + have hzero : (⟨0, Nat.zero_lt_succ _⟩ : Fin (T.length + 1)) = + Fin.castLT (⟨0, Nat.zero_lt_succ _⟩ : Fin (0 + 1)) (by omega) := by + apply Fin.ext + rfl + change T.vertex ⟨0, Nat.zero_lt_succ _⟩ ∈ G.ends e0 + have hmem : T.vertex ⟨0, Nat.zero_lt_succ _⟩ ∈ G.ends (T.edge ⟨0, T.positive⟩) := by + simp [hi, hzero] + simpa [T.first_edge] using hmem + have he_ne : e ≠ e0 := by + intro heq + exact he (heq ▸ he0) + obtain ⟨d, hpd⟩ := honepi.2 e he_ne + exact (hpi hne hadj hpd) (hpi_eq ▸ hpd) + +private theorem helper_branch_242.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) (alpha : Fin k) + (pi : PartialEdgeColoring E k), + IsOneEdgeUncolored pi e0 → + ∀ (beta : Fin k), + let sigma : PartialEdgeColoring E k := OutsideTreeColorSwap T pi alpha beta; + IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ G k e0 T alpha pi honepi beta sigma + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + unfold IsOneEdgeUncolored + constructor + · have he0 : TreeIncidentEdge T e0 := by + have hatt := T.attaches (⟨0, T.positive⟩ : Fin T.length) + obtain ⟨i, hi⟩ := hatt + have hi0 : i = ⟨0, Nat.zero_lt_succ _⟩ := by + apply Fin.ext + exact Nat.eq_zero_of_le_zero (Nat.le_of_lt_succ i.isLt) + subst i + have hvertex : T.vertex ⟨0, Nat.zero_lt_succ _⟩ ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet] + refine ⟨T.vertex ⟨0, Nat.zero_lt_succ _⟩, hvertex, ?_⟩ + have hmem : T.vertex ⟨0, Nat.zero_lt_succ _⟩ ∈ G.ends (T.edge ⟨0, T.positive⟩) := by + have hzero : (⟨0, Nat.zero_lt_succ _⟩ : Fin (T.length + 1)) = + Fin.castLT (⟨0, Nat.zero_lt_succ _⟩ : Fin (0 + 1)) + (by omega) := by + apply Fin.ext + rfl + simp [hi, hzero] + change T.vertex ⟨0, Nat.zero_lt_succ _⟩ ∈ G.ends e0 + simpa [T.first_edge] using hmem + simpa [sigma, OutsideTreeColorSwap, he0] using honepi.1 + · intro e hne + obtain ⟨c, hc⟩ := honepi.2 e hne + by_cases he : TreeIncidentEdge T e + · exact ⟨c, by simpa [sigma, OutsideTreeColorSwap, he] using hc⟩ + · by_cases hca : pi e = some alpha + · exact ⟨beta, by simp [sigma, OutsideTreeColorSwap, he, hca]⟩ + · by_cases hcb : pi e = some beta + · exact ⟨alpha, by simp [sigma, OutsideTreeColorSwap, he, hcb]⟩ + · exact ⟨c, by simpa [sigma, OutsideTreeColorSwap, he, hca, hcb] using hc⟩ + +private theorem helper_branch_273.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (delta alpha : Fin k) + (pi : PartialEdgeColoring E k), + StableColoring T (insert delta C : Finset (Fin k)) phi pi → + ∀ (beta : Fin k), + let sigma : PartialEdgeColoring E k := OutsideTreeColorSwap T pi alpha beta; + (∀ {e : E}, TreeIncidentEdge T e → sigma e = pi e) → + StableColoring T (insert delta C : Finset (Fin k)) phi sigma := by + classical + intro V E _ _ G k e0 T C phi delta alpha pi hstable beta sigma tree_fixed + let _ := Fintype.ofFinite V + unfold StableColoring + constructor + · intro e he hc + rw [tree_fixed he] + exact hstable.1 e he hc + · intro w hw + have hm : MissingColors G sigma w = MissingColors G pi w := by + classical + unfold MissingColors PresentColors + congr 1 + ext c + constructor + · intro hc + obtain ⟨_, ⟨e, he, hce⟩⟩ := (Finset.mem_filter.mp hc) + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, ⟨e, he, by simpa [tree_fixed ⟨w, hw, + he⟩] using hce⟩⟩ + · intro hc + obtain ⟨_, ⟨e, he, hce⟩⟩ := (Finset.mem_filter.mp hc) + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, ⟨e, he, by simpa [tree_fixed ⟨w, hw, + he⟩] using hce⟩⟩ + exact hm.trans (hstable.2 w hw) + +theorem LEM_extable {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) + (e0 f : E) (T : TreeSequence G e0) (C : Finset (Fin k)) + (phi : PartialEdgeColoring E k) (u v : V) (delta : Fin k) + (_ : MaximumDegree G + 1 ≤ k) + (hproperPhi : IsProperEdgeColoring G phi) + (honePhi : IsOneEdgeUncolored phi e0) + (hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T)) + (hfboundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet T)) + (hfends : G.ends f = s(u, v)) + (huout : u ∉ TreeSequenceVertexSet T) + (hvin : v ∈ TreeSequenceVertexSet T) + (hfcolor : phi f = some delta) + (hexists : ∃ pi : PartialEdgeColoring E k, + IsProperEdgeColoring G pi ∧ IsOneEdgeUncolored pi e0 ∧ + StableColoring T (insert delta C) phi pi ∧ + ∃ beta, beta ∈ MissingColors G pi u ∧ beta ∈ TreeMissingColors pi T) : + ∀ alpha, alpha ∈ MissingColors G phi v → + ∃ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 + ∧ StableColoring T (insert delta C) phi sigma ∧ TreeExit T sigma alpha delta v := by + classical + exact (by + intro alpha halpha + obtain ⟨pi, hpi, honepi, hstable, beta, hbetau, hbetat⟩ := hexists + have hcriterion := (sc1 G e0 T (insert delta C) phi pi hproperPhi honePhi hpi honepi).mp hstable + have ends_eq_of_mem : ∀ {z : Sym2 V} {x y : V}, x ∈ z → y ∈ z → x ≠ y → z = s(x, y) := by + exact @helper_ends_eq_of_mem_61 (@V) (@E) inferInstance inferInstance (@G) (@k) (by assumption) + have halphat : alpha ∈ TreeMissingColors phi T := by + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + exact ⟨v, hvin, halpha⟩ + have hbetat' : beta ∈ TreeMissingColors phi T := by + exact @helper_hbetat_71 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) (@C) + (@phi) (@delta) (@pi) (@hstable) (@beta) (@hbetat) + have halphaClosed : ∀ {g}, g ∈ BoundaryEdges G (TreeSequenceVertexSet T) → + ¬ phi g = some alpha := by + intro g hgb hgc + obtain ⟨w, hw, haw⟩ := Finset.mem_biUnion.mp halphat + exact (hclosed hgb hw hgc) haw + have hbetaClosed : ∀ {g}, g ∈ BoundaryEdges G (TreeSequenceVertexSet T) → + ¬ phi g = some beta := by + intro g hgb hgc + obtain ⟨w, hw, hbw⟩ := Finset.mem_biUnion.mp hbetat' + exact (hclosed hgb hw hgc) hbw + let sigma := OutsideTreeColorSwap T pi alpha beta + have tree_boundary : ∀ {e g : E}, TreeIncidentEdge T e → + ¬ TreeIncidentEdge T g → AdjacentEdges G e g → + e ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + exact @helper_tree_boundary_91 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + (by assumption) (@ends_eq_of_mem) + have tree_fixed : ∀ {e : E}, TreeIncidentEdge T e → sigma e = pi e := by + intro e he + simp [sigma, OutsideTreeColorSwap, he] + have swap_injective := @helper_swap_injective_111 (@k) (@alpha) (@beta) + refine ⟨sigma, ?_, ?_, ?_, ?_⟩ + · intro e g c hne hadj hec + by_cases he : TreeIncidentEdge T e + · exact @helper_branch_141 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) (@C) + (@phi) (@delta) (@alpha) (@pi) (@hpi) (@beta) (@hcriterion) (@halphat) (@hbetat') + (@halphaClosed) (@hbetaClosed) (@tree_boundary) (@tree_fixed) (@e) (@g) (@c) (@hne) + (@hadj) (@hec) (@he) + · exact @helper_branch_177 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@f) (@T) + (@C) (@phi) (@u) (@v) (@delta) (@honePhi) (@hclosed) (@hfboundary) (@huout) (@hvin) + (@alpha) (@pi) (@hpi) (@honepi) (@hstable) (@beta) (@hbetat) (@hcriterion) (@halphat) + (@hbetat') (@halphaClosed) (@hbetaClosed) (@tree_boundary) (@tree_fixed) + (@swap_injective) (@e) (@g) (@c) (@hne) (@hadj) (@hec) (@he) + · exact @helper_branch_242 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) (@alpha) + (@pi) (@honepi) (@beta) + · exact @helper_branch_273 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) (@C) + (@phi) (@delta) (@alpha) (@pi) (@hstable) (@beta) (@tree_fixed) + · unfold TreeExit + have hfincident : TreeIncidentEdge T f := by + refine ⟨v, hvin, ?_⟩ + change v ∈ G.ends f + rw [hfends] + simp + have hpif : pi f = some delta := by + have hfix := hcriterion f hfincident + (Or.inl ⟨delta, Finset.mem_union_right _ (Finset.mem_insert_self _ _), hfcolor⟩) + exact hfix.trans hfcolor + have hsf : sigma f = some delta := by + rw [tree_fixed hfincident, hpif] + have huf : Incident G u f := by + change u ∈ G.ends f + rw [hfends] + simp + have hvf : Incident G v f := by + change v ∈ G.ends f + rw [hfends] + simp + let p := SimpleGraph.Walk.cons + (show (TwoColorIncidenceGraph G sigma alpha delta).Adj (Sum.inl u) (Sum.inr f) from by + exact ⟨huf, Or.inr hsf⟩) + (SimpleGraph.Walk.cons + (show (TwoColorIncidenceGraph G sigma alpha delta).Adj (Sum.inr f) (Sum.inl v) from by + exact ⟨hvf, Or.inr hsf⟩) + SimpleGraph.Walk.nil) + refine ⟨u, p, ?_⟩ + unfold TreeExitPath + have halphau : alpha ∈ MissingColors G sigma u := by + classical + change alpha ∈ Finset.univ \ PresentColors G sigma u + rw [Finset.mem_sdiff] + constructor + · exact Finset.mem_univ _ + · intro hpresent + unfold PresentColors at hpresent + obtain ⟨_, ⟨e, he, hse⟩⟩ := Finset.mem_filter.mp hpresent + by_cases ht : TreeIncidentEdge T e + · obtain ⟨x, hx, hxe⟩ := ht + have htree : TreeIncidentEdge T e := ⟨x, hx, hxe⟩ + have hxu : x ≠ u := by + intro h + exact huout (h ▸ hx) + have hb : e ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + unfold BoundaryEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hx, u, huout, ends_eq_of_mem hxe he hxu⟩ + have hpi_e : pi e = some alpha := by + simpa [tree_fixed ⟨x, hx, hxe⟩] using hse + have hfix := hcriterion e htree + (Or.inr ⟨alpha, Finset.mem_union_left _ halphat, hpi_e⟩) + exact halphaClosed hb (hfix ▸ hpi_e) + · have hbetanot : beta ∉ PresentColors G pi u := by + exact (Finset.mem_sdiff.mp (show beta ∈ Finset.univ \ PresentColors G pi u from + hbetau)).2 + by_cases ha : pi e = some alpha + · have : pi e = some beta := by + by_cases hab : alpha = beta + · simpa [hab] using ha + · exfalso + have hbad : some beta = some alpha := by + simpa [sigma, OutsideTreeColorSwap, ht, ha, hab] using hse + exact hab (Option.some.inj hbad).symm + exact hbetanot (by + unfold PresentColors + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, ⟨e, he, this⟩⟩) + · by_cases hb : pi e = some beta + · exact hbetanot (by + unfold PresentColors + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, ⟨e, he, hb⟩⟩) + · simp [sigma, OutsideTreeColorSwap, ht, ha, hb] at hse + have hunotv : u ≠ v := by + intro huv + apply huout + simpa [huv] using hvin + have hpath : p.IsPath := by + dsimp [p] + apply SimpleGraph.Walk.IsPath.cons + · apply SimpleGraph.Walk.IsPath.cons + · simp + · simp + · simp [hunotv] + refine ⟨hpath, ?_, huout, hvin, Or.inl halphau, ?_⟩ + · simp [p] + · intro w hw + simp only [SimpleGraph.Walk.support_cons, SimpleGraph.Walk.support_nil, List.mem_cons, + Sum.inl.injEq, + reduceCtorEq, List.not_mem_nil, or_false, false_or, or_iff_right_iff_imp, p] + intro hwu + exact (huout (hwu ▸ hw)).elim + ) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableColoringFullCertificate.lean b/LeanPool/GoldbergSeymour/StableColoringFullCertificate.lean new file mode 100644 index 0000000000..add2910e41 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableColoringFullCertificate.lean @@ -0,0 +1,136 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyPrefixData +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport + +/-! +# P2752_T2_Full Certificate + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2752_T2_FullCertificate {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (Bplus : TreeSequence G e0) (F : HierarchyPrefixData C Bplus sigma) + (hfixed : ∀ t : Fin T.length, sigma (T.edge t) = phi (T.edge t)) + (hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma) : + ∃ corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T, + MaximumProperty corr.replacementETT := by + classical + let n := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Tout := ett.series.data.tree (Fin.last (ett.rounds + 1)) + have hNT : TreeSequenceInitialSegment Tn T := by + convert ett.abovePenultimate using 1 + congr 1 + have hstrict : Tn.length < T.length := by + convert ett.strictAbovePenultimate using 1 + congr 1 + have transport (S : TreeSequence G e0) + (hs : TreeSequenceInitialSegment S T) + (hr : TashkinovAugmentationSequence phi S Tout) : + TashkinovAugmentationSequence sigma S T := by + have hshort := TashkinovAugmentationSequenceRestrict phi S T Tout hr hs ett.belowFinal + exact TashkinovAugmentationSequenceColoringTransport phi sigma S Bplus T + hshort F.belowFull F.penultimateLength + (fun t _ => hfixed t) F.invariant.2 + have seedBelow (S : TreeSequence G e0) + (hseed : S.length = Tn.length + 1) + (hr : TashkinovAugmentationSequence phi S Tout) : + TreeSequenceInitialSegment S T := by + have hSO := TashkinovAugmentationSequenceInitialSegment phi S Tout hr + have hTO := ett.belowFinal + have hlen : S.length ≤ T.length := by omega + refine ⟨hlen, ?_, ?_⟩ + · intro i + rw [← hTO.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)] + convert hSO.2.1 i using 1 + congr 1 + · intro i + rw [← hTO.2.2 (Fin.castLE hlen i)] + convert hSO.2.2 i using 1 + congr 1 + have eligible : + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn T) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence sigma seed T) := by + have step := ett.series.certified n + generalize heq : n = target at step + cases step with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + have hn : ett.rounds = 0 := congrArg Fin.val heq + have hp := ett.roundsPositive + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i.succ = n := heq.symm + have hr : TashkinovAugmentationSequence phi adjoined Tout := by + simpa [Tout, hi, n, ← ett.generatingColoring] using closedExtension.1 + have hs : TreeSequenceAdjoinEdge Tn choice.edge adjoined := by + simpa [Tn, hi] using adjoinedExactly + exact Or.inr ⟨Or.inl (by simpa [hi] using currentKind), choice.edge, + adjoined, by simpa [hi] using currentEdges, hs, + transport adjoined (seedBelow adjoined hs.1 hr) hr⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + have hi : i.succ = n := heq.symm + have hr : TashkinovAugmentationSequence phi Tn Tout := by + simpa [Tn, Tout, hi, n, ← ett.generatingColoring] using closedExtension.1 + exact Or.inl ⟨by simpa [hi] using currentKind, transport Tn hNT hr⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have hi : i.succ = n := heq.symm + have hr : TashkinovAugmentationSequence phi adjoined Tout := by + simpa [Tout, hi, n, ← ett.generatingColoring] using closedExtension.1 + have hs : TreeSequenceAdjoinEdge Tn available.edge adjoined := by + simpa [Tn, hi] using adjoinedExactly + exact Or.inr ⟨Or.inr (by simpa [hi] using currentKind), available.edge, + adjoined, by simpa [hi] using currentEdges, hs, + transport adjoined (seedBelow adjoined hs.1 hr) hr⟩ + have hmod := Td G k e0 input T phi ett C.maximum C.positive + ctx.lowerRung sigma F.proper F.oneUncolored + (by simpa [← ett.generatingColoring] using hstable) + obtain ⟨corr⟩ := hmod.2.2 T hNT hstrict eligible + exact ⟨corr, MaximumPropertyTransport G k e0 ett sigma hmod T corr C.maximum⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableColoringIncidentEdgeCriterion.lean b/LeanPool/GoldbergSeymour/StableColoringIncidentEdgeCriterion.lean new file mode 100644 index 0000000000..8b4204a983 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableColoringIncidentEdgeCriterion.lean @@ -0,0 +1,163 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring + +public import LeanPool.GoldbergSeymour.StableColoring + +/-! +# sc1 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem sc1 {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) {k : ℕ} + (e0 : E) (T : TreeSequence G e0) (C : Finset (Fin k)) + (phi pi : PartialEdgeColoring E k) + (hproperPhi : IsProperEdgeColoring G phi) + (honePhi : IsOneEdgeUncolored phi e0) + (hproperPi : IsProperEdgeColoring G pi) + (honePi : IsOneEdgeUncolored pi e0) : + StableColoring T C phi pi ↔ + ∀ f, TreeIncidentEdge T f → + ((∃ c ∈ TreeMissingColors phi T ∪ C, phi f = some c) ∨ + (∃ c ∈ TreeMissingColors phi T ∪ C, pi f = some c)) → + pi f = phi f := by + classical + let _ := Fintype.ofFinite V + unfold StableColoring + have colored_iff : ∀ (ψ : PartialEdgeColoring E k), + IsOneEdgeUncolored ψ e0 → ∀ v e, + (Incident G v e ∧ ∃ c, ψ e = some c) ↔ Incident G v e ∧ e ≠ e0 := by + intro ψ hone v e + constructor + · rintro ⟨hv, c, hc⟩ + refine ⟨hv, ?_⟩ + intro he + subst e + rw [hone.1] at hc + cases hc + · rintro ⟨hv, he⟩ + obtain ⟨c, hc⟩ := hone.2 e he + exact ⟨hv, c, hc⟩ + have present_card : ∀ (ψ : PartialEdgeColoring E k), + IsProperEdgeColoring G ψ → ∀ v, + (PresentColors G ψ v).card = + (Finset.univ.filter fun e => Incident G v e ∧ ∃ c, ψ e = some c).card := by + intro ψ hproper v + let colored := Finset.univ.filter fun e => Incident G v e ∧ ∃ c, ψ e = some c + let chooseColor : (e : E) → e ∈ colored → Fin k := + fun e he => Classical.choose (Finset.mem_filter.mp he).2.2 + have choose_spec : ∀ (e : E) (he : e ∈ colored), + ψ e = some (chooseColor e he) := by + intro e he + exact Classical.choose_spec (Finset.mem_filter.mp he).2.2 + symm + apply (Finset.card_bij chooseColor) + · intro e he + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, (Finset.mem_filter.mp he).2.1, choose_spec e he⟩ + · intro e₁ h₁ e₂ h₂ heq + by_contra hne + have hi₁ := (Finset.mem_filter.mp h₁).2.1 + have hi₂ := (Finset.mem_filter.mp h₂).2.1 + have ha : AdjacentEdges G e₁ e₂ := ⟨v, hi₁, hi₂⟩ + have hp := hproper hne ha (choose_spec e₁ h₁) + exact hp (by simpa [heq] using choose_spec e₂ h₂) + · intro c hc + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc + obtain ⟨e, he, hce⟩ := hc + have hecol : e ∈ colored := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and, colored] + exact ⟨he, c, hce⟩ + refine ⟨e, hecol, ?_⟩ + exact Option.some.inj ((choose_spec e hecol).symm.trans hce) + have same_colored : ∀ v, + (Finset.univ.filter fun e => Incident G v e ∧ ∃ c, phi e = some c) = + (Finset.univ.filter fun e => Incident G v e ∧ ∃ c, pi e = some c) := by + intro v + ext e + simp only [Finset.mem_filter] + rw [colored_iff phi honePhi v e, colored_iff pi honePi v e] + have same_present_card : ∀ v, (PresentColors G phi v).card = + (PresentColors G pi v).card := by + intro v + rw [present_card phi hproperPhi v, present_card pi hproperPi v, + same_colored v] + have same_missing_card : ∀ v, (MissingColors G phi v).card = + (MissingColors G pi v).card := by + intro v + simp [MissingColors, Finset.card_sdiff, same_present_card v] + constructor + · intro hstable f hf hor + rcases hor with hphi | hpi + · exact hstable.1 f hf hphi + · obtain ⟨c, hcmem, hfc⟩ := hpi + rcases hf with ⟨v, hv, hfv⟩ + have hpresentPi : c ∈ PresentColors G pi v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hfv, hfc⟩ + have hpresentPhi : c ∈ PresentColors G phi v := by + have hmissPi : c ∉ MissingColors G pi v := by + simpa [MissingColors] using hpresentPi + have hmissPhi : c ∉ MissingColors G phi v := by + rw [← hstable.2 v hv] + exact hmissPi + simpa [MissingColors] using hmissPhi + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpresentPhi + obtain ⟨g, hgv, hgc⟩ := hpresentPhi + by_cases heq : phi f = some c + · exact hstable.1 f ⟨v, hv, hfv⟩ ⟨c, hcmem, heq⟩ + · have hneq : g ≠ f := by + intro hgf + subst g + exact heq hgc + have hadj : AdjacentEdges G g f := ⟨v, hgv, hfv⟩ + have hgcPi : pi g = some c := + (hstable.1 g ⟨v, hv, hgv⟩ ⟨c, hcmem, hgc⟩).trans hgc + have hp := hproperPi hneq hadj hgcPi + exact False.elim (hp hfc) + · intro hcond + constructor + · intro f hf hphi + exact hcond f hf (Or.inl hphi) + · intro v hv + have hmissing : MissingColors G phi v = MissingColors G pi v := by + apply Finset.eq_of_subset_of_card_le + · intro c hc + by_contra hnot + have hcp : c ∈ PresentColors G pi v := by + simpa [MissingColors] using hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hcp + obtain ⟨f, hf, hfc⟩ := hcp + have htf : TreeIncidentEdge T f := ⟨v, hv, hf⟩ + have hmem : c ∈ TreeMissingColors phi T ∪ C := by + have : c ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, by simpa [MissingColors] using hc⟩ + exact Finset.mem_union_left _ this + have heq := hcond f htf (Or.inr ⟨c, hmem, hfc⟩) + have hpnot : c ∉ PresentColors G phi v := by + simpa [MissingColors] using hc + apply hpnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hf, heq.symm.trans hfc⟩ + · simp [same_missing_card v] + exact hmissing.symm + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StableSeriesCycleComponentTransport.lean b/LeanPool/GoldbergSeymour/StableSeriesCycleComponentTransport.lean new file mode 100644 index 0000000000..895a20b92a --- /dev/null +++ b/LeanPool/GoldbergSeymour/StableSeriesCycleComponentTransport.lean @@ -0,0 +1,1237 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Stable Series Cycle Component Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hpairControl_97.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t epsilon terminal : Fin rounds) (gamma + delta : Fin k), series.data.kind t.succ = some TashkinovExtensionKind.PE → + series.data.gamma t.succ = some gamma → series.data.delta t.succ = some delta → + ∀ (_ : PartialEdgeColoring E k) (z : V ⊕ E), TwoColorComponentCycle G (series.data.coloring + t.succ) gamma delta z → ( + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G (series.data.coloring t.succ) gamma delta z → w ∈ + TreeSequenceVertexSet (series.data.tree epsilon.succ.castSucc)) → + let _ : PartialEdgeColoring E k := series.data.coloring t.succ; + let _ : PartialEdgeColoring E k := series.data.coloring terminal.succ; ( + ∀ (q : Fin rounds), + ∀ c ∈ series.data.stored q.succ, c ∈ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors series.data q.succ) → + ∀ (c : Fin k), c = gamma ∨ c = delta → c ∈ TreeMissingColors (series.data.coloring t.succ) + (series.data.tree t.succ.castSucc) ∪ TashkinovStoredColors series.data t.succ := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon terminal gamma delta htKind htGamma + htDelta sigma z hcycle hcontained oldColoring terminalColoring currentStoredControl c hc + have cert := series.certified t.succ + generalize hslot : t.succ = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero t hslot).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = t := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + rw [currentKind] at htKind + simp at htKind + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = t := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + have hgamma : actualGamma = gamma := + Option.some.inj (currentGamma.symm.trans htGamma) + have hdelta : choice.color = delta := + Option.some.inj (currentDelta.symm.trans htDelta) + apply currentStoredControl t c + rw [currentStored] + rcases hc with rfl | rfl + · simp [hgamma] + · simp [hdelta] + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = t := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + rw [currentKind] at htKind + simp at htKind + +private theorem helper_controlPrevious_161.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t _ terminal : Fin rounds), + ∀ c ∈ TreeMissingColors (series.data.coloring t.succ) (series.data.tree t.succ.castSucc) ∪ + TashkinovStoredColors series.data t.succ, + ∀ (n : ℕ), (↑t : ℕ) + (1 : ℕ) ≤ n → n ≤ (↑terminal : ℕ) → + ∀ (q : Fin rounds), (↑q : ℕ) = n → c ∈ TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors series.data q.castSucc := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon terminal c hc n htn + induction n, htn using Nat.le_induction with + | base => + intro hn q hq + have hcolor : q.castSucc = t.succ := by + apply Fin.ext + simp only [Fin.val_castSucc, Fin.val_succ] + omega + have htree : q.succ.castSucc = t.succ.succ := by + apply Fin.ext + simp only [Fin.val_castSucc, Fin.val_succ] + omega + simpa [hcolor, htree] using + (HkuMissingStoredMonotone G k rounds e0 input series t).2 hc + | succ n hn ih => + intro hnterminal q hq + let r : Fin rounds := ⟨n, by omega⟩ + have hold := ih (by omega) r rfl + have hcurrent := + (HkuMissingStoredMonotone G k rounds e0 input series r).1 hold + have hnext := + (HkuMissingStoredMonotone G k rounds e0 input series r).2 hcurrent + have hcolor : q.castSucc = r.succ := by + apply Fin.ext + simp [r, hq] + have htree : q.succ.castSucc = r.succ.succ := by + apply Fin.ext + simp [r, hq] + simpa [hcolor, htree] using hnext + +private theorem helper_reColoring_228.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds e0 input) + (_ _ _ r : Fin rounds), + series.data.kind r.succ = some TashkinovExtensionKind.RE → + series.data.coloring r.succ = series.data.coloring r.castSucc := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon terminal r hr + have cert := series.certified r.succ + generalize hslot : r.succ = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero r hslot).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = r := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + rw [currentKind] at hr + simp at hr + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = r := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + rw [currentKind] at hr + simp at hr + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = r := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + simpa [hslot] using currentColoring + +private theorem helper_stepSegment_310.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds e0 input) + (_ _ _ r : Fin rounds), + TreeSequenceInitialSegment (series.data.tree r.succ.castSucc) + (series.data.tree r.succ.succ) := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon terminal r + have cert := series.certified r.succ + generalize hslot : r.succ = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero r hslot).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = r := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + simpa [hslot] using orderedExtension + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = r := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + simpa [hslot] using orderedExtension + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = r := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + simpa [hslot] using orderedExtension + +private theorem helper_hterminalData_392.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds e0 input) + (_ _ terminal : Fin rounds), + series.data.kind terminal.succ = some TashkinovExtensionKind.PE → + let terminalColoring : PartialEdgeColoring E k := series.data.coloring terminal.succ; + IsProperEdgeColoring G terminalColoring ∧ IsOneEdgeUncolored terminalColoring e0 := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon terminal hterminalKind terminalColoring + have cert := series.certified terminal.succ + generalize hslot : terminal.succ = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero terminal hslot).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = terminal := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + rw [currentKind] at hterminalKind + simp at hterminalKind + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = terminal := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + exact ⟨by simpa [terminalColoring] using currentProper, + by simpa [terminalColoring] using currentOneUncolored⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = terminal := by + apply Fin.ext + have := congrArg Fin.val hslot + simp only [Fin.val_succ] at this + omega + subst i + rw [currentKind] at hterminalKind + simp at hterminalKind + +private theorem helper_terminalClosed_552.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t terminal : Fin rounds) (gamma delta : + Fin k) (z : V ⊕ E), + let oldColoring : PartialEdgeColoring E k := series.data.coloring t.succ; + let terminalColoring : PartialEdgeColoring E k := series.data.coloring terminal.succ; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G oldColoring gamma delta; + let terminalGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G terminalColoring gamma + delta; + let _ : Set (V ⊕ E) := TwoColorComponent G oldColoring gamma delta z; IsProperEdgeColoring G + terminalColoring → + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta), ( + ∀ (x : V ⊕ E), x ∈ cycle.walk.support ↔ x ∈ TwoColorComponent G (series.data.coloring t.succ) + gamma delta z) → ( + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → oldColoring f = some gamma ∨ oldColoring f = some + delta) → ( + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → terminalColoring f = oldColoring f) → + ∀ {a b : V ⊕ E}, a ∈ cycle.walk.support → terminalGraph.Adj a b → b ∈ cycle.walk.support := by + classical + intro V E _ _ _ G k rounds e0 input series t terminal gamma delta z oldColoring + terminalColoring oldGraph terminalGraph oldComponent hterminalProper cycle hfull + edgeOldActive edgeSeriesPreserved a b ha hab + cases a with + | inl v => + cases b with + | inl w => simp [terminalGraph, TwoColorIncidenceGraph] at hab + | inr f => + have hfData : Incident G v f ∧ + (terminalColoring f = some gamma ∨ + terminalColoring f = some delta) := by + simpa [terminalGraph, TwoColorIncidenceGraph] using hab + let rotated := cycle.walk.rotate (Sum.inl v) ha + have hrotated : rotated.IsCycle := cycle.isCycle.rotate ha + have hfirst : oldGraph.Adj (Sum.inl v) rotated.snd := by + simpa [oldGraph] using rotated.adj_snd hrotated.not_nil + have hlast : oldGraph.Adj (Sum.inl v) rotated.penultimate := by + simpa [oldGraph] using + (rotated.adj_penultimate hrotated.not_nil).symm + cases hfirstNode : rotated.snd with + | inl u => + rw [hfirstNode] at hfirst + simp [oldGraph, TwoColorIncidenceGraph] at hfirst + | inr e1 => + rw [hfirstNode] at hfirst + cases hlastNode : rotated.penultimate with + | inl u => + rw [hlastNode] at hlast + simp [oldGraph, TwoColorIncidenceGraph] at hlast + | inr e2 => + rw [hlastNode] at hlast + have he1Data : Incident G v e1 ∧ + (oldColoring e1 = some gamma ∨ + oldColoring e1 = some delta) := by + simpa [oldGraph, TwoColorIncidenceGraph] using hfirst + have he2Data : Incident G v e2 ∧ + (oldColoring e2 = some gamma ∨ + oldColoring e2 = some delta) := by + simpa [oldGraph, TwoColorIncidenceGraph] using hlast + have hvComponent : Sum.inl v ∈ oldComponent := + (hfull (Sum.inl v)).1 ha + have he1Component : Sum.inr e1 ∈ oldComponent := by + change oldGraph.connectedComponentMk (Sum.inr e1) = + oldGraph.connectedComponentMk z + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hfirst).symm.trans hvComponent + have he2Component : Sum.inr e2 ∈ oldComponent := by + change oldGraph.connectedComponentMk (Sum.inr e2) = + oldGraph.connectedComponentMk z + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hlast).symm.trans hvComponent + have he1Support := (hfull (Sum.inr e1)).2 he1Component + have he2Support := (hfull (Sum.inr e2)).2 he2Component + have he1Terminal : terminalColoring e1 = oldColoring e1 := + edgeSeriesPreserved e1 he1Support + have he2Terminal : terminalColoring e2 = oldColoring e2 := + edgeSeriesPreserved e2 he2Support + have he1Active : terminalColoring e1 = some gamma ∨ + terminalColoring e1 = some delta := by + rw [he1Terminal] + exact he1Data.2 + have he2Active : terminalColoring e2 = some gamma ∨ + terminalColoring e2 = some delta := by + rw [he2Terminal] + exact he2Data.2 + have he12 : e1 ≠ e2 := by + intro heq + apply hrotated.snd_ne_penultimate + rw [hfirstNode, hlastNode, heq] + have hmatch : f = e1 ∨ f = e2 := by + rcases hfData.2 with hfg | hfd + · rcases he1Active with he1g | he1d + · left + by_contra hne + exact (hterminalProper hne + ⟨v, hfData.1, he1Data.1⟩ hfg) he1g + · have he2g : terminalColoring e2 = some gamma := + he2Active.resolve_right (by + intro he2d + exact (hterminalProper he12 + ⟨v, he1Data.1, he2Data.1⟩ he1d) he2d) + right + by_contra hne + exact (hterminalProper hne + ⟨v, hfData.1, he2Data.1⟩ hfg) he2g + · rcases he1Active with he1g | he1d + · have he2d : terminalColoring e2 = some delta := + he2Active.resolve_left (by + intro he2g + exact (hterminalProper he12 + ⟨v, he1Data.1, he2Data.1⟩ he1g) he2g) + right + by_contra hne + exact (hterminalProper hne + ⟨v, hfData.1, he2Data.1⟩ hfd) he2d + · left + by_contra hne + exact (hterminalProper hne + ⟨v, hfData.1, he1Data.1⟩ hfd) he1d + rcases hmatch with rfl | rfl + · exact he1Support + · exact he2Support + | inr e => + cases b with + | inl v => + have hdata : Incident G v e ∧ + (terminalColoring e = some gamma ∨ + terminalColoring e = some delta) := by + simpa [terminalGraph, TwoColorIncidenceGraph] using hab + have heActive := edgeOldActive e ha + have hadjOld : oldGraph.Adj (Sum.inr e) (Sum.inl v) := by + simpa [oldGraph, TwoColorIncidenceGraph] using ⟨hdata.1, heActive⟩ + have heComponent : Sum.inr e ∈ oldComponent := + (hfull (Sum.inr e)).1 ha + have hvComponent : Sum.inl v ∈ oldComponent := by + change oldGraph.connectedComponentMk (Sum.inl v) = + oldGraph.connectedComponentMk z + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadjOld).symm.trans heComponent + exact (hfull (Sum.inl v)).2 hvComponent + | inr f => simp [terminalGraph, TwoColorIncidenceGraph] at hab + +private theorem helper_sigmaClosed_817.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t terminal : Fin rounds) (gamma delta : + Fin k) (sigma : PartialEdgeColoring E k), + let terminalColoring : PartialEdgeColoring E k := series.data.coloring terminal.succ; + let terminalTree : TreeSequence G e0 := series.data.tree terminal.succ.castSucc; + let terminalStored : Finset (Fin k) := TashkinovStoredColors series.data terminal.succ; + let terminalGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G terminalColoring gamma + delta; + let sigmaGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigma gamma delta; + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta), ( + ∀ {a b : V ⊕ E}, a ∈ cycle.walk.support → terminalGraph.Adj a b → b ∈ cycle.walk.support) → + gamma ∈ TreeMissingColors sigma terminalTree ∪ terminalStored → delta ∈ TreeMissingColors + sigma terminalTree ∪ terminalStored → StableColoring terminalTree terminalStored sigma + terminalColoring → ( + ∀ (v : V), Sum.inl v ∈ cycle.walk.support → v ∈ TreeSequenceVertexSet terminalTree) → ( + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → sigma f = terminalColoring f) → + ∀ {a b : V ⊕ E}, a ∈ cycle.walk.support → sigmaGraph.Adj a b → b ∈ cycle.walk.support := by + classical + intro V E _ _ _ G k rounds e0 input series t terminal gamma delta sigma terminalColoring + terminalTree terminalStored terminalGraph sigmaGraph cycle terminalClosed hgammaSigma + hdeltaSigma hsigmaReverse cycleVertexTerminalTree edgeSigmaPreserved a b ha hab + cases a with + | inl v => + cases b with + | inl w => simp [sigmaGraph, TwoColorIncidenceGraph] at hab + | inr f => + have hdata : Incident G v f ∧ + (sigma f = some gamma ∨ sigma f = some delta) := by + simpa [sigmaGraph, TwoColorIncidenceGraph] using hab + have hvTree := cycleVertexTerminalTree v ha + rcases hdata.2 with hgamma | hdelta + · have hreverse := hsigmaReverse.1 f + ⟨v, hvTree, hdata.1⟩ + ⟨gamma, hgammaSigma, hgamma⟩ + apply terminalClosed ha + simpa [terminalGraph, TwoColorIncidenceGraph, hreverse, hgamma] + using hdata.1 + · have hreverse := hsigmaReverse.1 f + ⟨v, hvTree, hdata.1⟩ + ⟨delta, hdeltaSigma, hdelta⟩ + apply terminalClosed ha + simpa [terminalGraph, TwoColorIncidenceGraph, hreverse, hdelta] + using hdata.1 + | inr e => + cases b with + | inl v => + have hdata : Incident G v e ∧ + (sigma e = some gamma ∨ sigma e = some delta) := by + simpa [sigmaGraph, TwoColorIncidenceGraph] using hab + have hsigma := edgeSigmaPreserved e ha + apply terminalClosed ha + simpa [terminalGraph, TwoColorIncidenceGraph, ← hsigma] using hdata + | inr f => simp [sigmaGraph, TwoColorIncidenceGraph] at hab + +private theorem helper_coloringAlong_644.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t epsilon _ : Fin rounds), ( + ∀ (r : Fin rounds), (↑t : ℕ) < (↑r : ℕ) → (↑r : ℕ) < (↑epsilon : ℕ) → series.data.kind r.succ + = some TashkinovExtensionKind.RE) → + let oldColoring : PartialEdgeColoring E k := series.data.coloring t.succ; ( + ∀ (r : Fin rounds), series.data.kind r.succ = some TashkinovExtensionKind.RE → + series.data.coloring r.succ = series.data.coloring r.castSucc) → + ∀ (n : ℕ), (↑t : ℕ) + (1 : ℕ) ≤ n → n ≤ (↑epsilon : ℕ) → + ∀ (q : Fin (rounds + (1 : ℕ))), (↑q : ℕ) = n → series.data.coloring q = oldColoring := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon terminal hintervening oldColoring + reColoring n htn + induction n, htn using Nat.le_induction with + | base => + intro hn q hq + have hqeq : q = t.succ := by + apply Fin.ext + simp only [Fin.val_succ] + omega + simp [oldColoring, hqeq] + | succ n hn ih => + intro hnepsilon q hq + have hnlt : n < epsilon.val := by omega + have hnt : t.val < n := by omega + let r : Fin rounds := ⟨n, by omega⟩ + have hrKind := hintervening r (by simpa [r]) (by simpa [r]) + have hrColor := reColoring r hrKind + have hqeq : q = r.succ := by + apply Fin.ext + simp [r, hq] + calc + series.data.coloring q = series.data.coloring r.succ := by rw [hqeq] + _ = series.data.coloring r.castSucc := hrColor + _ = oldColoring := ih (by omega) r.castSucc rfl + +private theorem helper_vertexToTerminal_689.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (_ epsilon terminal : Fin rounds), + (↑epsilon : ℕ) ≤ (↑terminal : ℕ) → + let epsilonTree : TreeSequence G e0 := series.data.tree epsilon.succ.castSucc; + let terminalTree : TreeSequence G e0 := series.data.tree terminal.succ.castSucc; ( + ∀ (r : Fin rounds), TreeSequenceInitialSegment (series.data.tree r.succ.castSucc) + (series.data.tree r.succ.succ)) → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → TreeSequenceVertexSet epsilonTree ⊆ TreeSequenceVertexSet + terminalTree := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon terminal hepsilonTerminal epsilonTree + terminalTree stepSegment vertexTransfer v hv + have carry : ∀ n : ℕ, epsilon.val ≤ n → n ≤ terminal.val → + ∀ q : Fin rounds, q.val = n → + v ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc) := by + intro n hen + induction n, hen using Nat.le_induction with + | base => + intro hn q hq + have hqeq : q = epsilon := by apply Fin.ext; omega + simpa [epsilonTree, hqeq] using hv + | succ n hn ih => + intro hnterminal q hq + let r : Fin rounds := ⟨n, by omega⟩ + have hold := ih (by omega) r rfl + have hnext := vertexTransfer (stepSegment r) hold + have htree : q.succ.castSucc = r.succ.succ := by + apply Fin.ext + simp [r, hq] + simpa [htree] using hnext + simpa [terminalTree] using carry terminal.val hepsilonTerminal le_rfl terminal rfl + +private theorem helper_edgeSeriesPreserved_763.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t epsilon terminal : Fin rounds) (gamma + delta : Fin k), (↑epsilon : ℕ) ≤ (↑terminal : ℕ) → + let oldColoring : PartialEdgeColoring E k := series.data.coloring t.succ; + let terminalColoring : PartialEdgeColoring E k := series.data.coloring terminal.succ; + let epsilonTree : TreeSequence G e0 := series.data.tree epsilon.succ.castSucc; gamma ∈ + TreeMissingColors (series.data.coloring epsilon.castSucc) epsilonTree ∪ + TashkinovStoredColors series.data epsilon.castSucc → delta ∈ TreeMissingColors + (series.data.coloring epsilon.castSucc) epsilonTree ∪ TashkinovStoredColors series.data + epsilon.castSucc → series.data.coloring epsilon.castSucc = oldColoring → + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta), ( + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → oldColoring f = some gamma ∨ oldColoring f = some + delta) → ( + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → TreeIncidentEdge epsilonTree f) → ( + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → f ∈ InternalEdges G (TreeSequenceVertexSet + epsilonTree)) → + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → terminalColoring f = oldColoring f := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon terminal gamma delta hepsilonTerminal + oldColoring terminalColoring epsilonTree hgammaEpsilon hdeltaEpsilon hepsilonColoring cycle + edgeOldActive edgeIncidentEpsilon edgeInternalEpsilon f hf + have hfIncident := edgeIncidentEpsilon f hf + have hfInternal := edgeInternalEpsilon f hf + rcases edgeOldActive f hf with hgamma | hdelta + · have hepsilonGamma : series.data.coloring epsilon.castSucc f = + some gamma := by + rw [hepsilonColoring] + exact hgamma + have h := (SameColorSeriesPreserved G k rounds e0 input series + epsilon terminal hepsilonTerminal f gamma hfIncident hepsilonGamma + hgammaEpsilon).2 hfInternal + have hterminal : terminalColoring f = + series.data.coloring epsilon.castSucc f := by + simpa [terminalColoring] using h + exact hterminal.trans (congrFun hepsilonColoring f) + · have hepsilonDelta : series.data.coloring epsilon.castSucc f = + some delta := by + rw [hepsilonColoring] + exact hdelta + have h := (SameColorSeriesPreserved G k rounds e0 input series + epsilon terminal hepsilonTerminal f delta hfIncident hepsilonDelta + hdeltaEpsilon).2 hfInternal + have hterminal : terminalColoring f = + series.data.coloring epsilon.castSucc f := by + simpa [terminalColoring] using h + exact hterminal.trans (congrFun hepsilonColoring f) + +private theorem helper_terminalEdgeTransfer_791.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds e0 input) + (t terminal : Fin rounds) (gamma delta : Fin k), + let oldColoring : PartialEdgeColoring E k := series.data.coloring t.succ; + let terminalColoring : PartialEdgeColoring E k := series.data.coloring terminal.succ; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G oldColoring gamma delta; + let terminalGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G terminalColoring gamma delta; + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta), + (∀ (f : E), Sum.inr f ∈ cycle.walk.support → terminalColoring f = oldColoring f) → + ∀ edge ∈ cycle.walk.edges, + edge ∈ terminalGraph.edgeSet := by + classical + intro V E _ _ _ G k rounds e0 input series t terminal gamma delta oldColoring terminalColoring + oldGraph terminalGraph cycle edgeSeriesPreserved edge hedge + induction edge using Sym2.inductionOn with + | _ a b => + have haSupport := cycle.walk.fst_mem_support_of_mem_edges hedge + have hbSupport := cycle.walk.snd_mem_support_of_mem_edges hedge + have habOld : oldGraph.Adj a b := by + simpa [oldGraph] using cycle.walk.edges_subset_edgeSet hedge + cases a with + | inl v => + cases b with + | inl w => simp [oldGraph, TwoColorIncidenceGraph] at habOld + | inr f => + have hdata : Incident G v f ∧ + (oldColoring f = some gamma ∨ oldColoring f = some delta) := by + simpa [oldGraph, TwoColorIncidenceGraph] using habOld + have hcolor := edgeSeriesPreserved f hbSupport + simpa [terminalGraph, TwoColorIncidenceGraph, hcolor] using hdata + | inr f => + cases b with + | inl v => + have hdata : Incident G v f ∧ + (oldColoring f = some gamma ∨ oldColoring f = some delta) := by + simpa [oldGraph, TwoColorIncidenceGraph] using habOld + have hcolor := edgeSeriesPreserved f haSupport + simpa [terminalGraph, TwoColorIncidenceGraph, hcolor] using hdata + | inr g => simp [oldGraph, TwoColorIncidenceGraph] at habOld + +private theorem helper_sigmaEdgeTransfer_936.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds e0 input) + (t terminal : Fin rounds) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k), + let oldColoring : PartialEdgeColoring E k := series.data.coloring t.succ; + let terminalColoring : PartialEdgeColoring E k := series.data.coloring terminal.succ; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G oldColoring gamma delta; + let sigmaGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigma gamma delta; + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta), + (∀ (f : E), Sum.inr f ∈ cycle.walk.support → terminalColoring f = oldColoring f) → + (∀ (f : E), Sum.inr f ∈ cycle.walk.support → sigma f = terminalColoring f) → + ∀ edge ∈ cycle.walk.edges, + edge ∈ sigmaGraph.edgeSet := by + classical + intro V E _ _ _ G k rounds e0 input series t terminal gamma delta sigma oldColoring + terminalColoring oldGraph sigmaGraph cycle edgeSeriesPreserved edgeSigmaPreserved edge hedge + induction edge using Sym2.inductionOn with + | _ a b => + have haSupport := cycle.walk.fst_mem_support_of_mem_edges hedge + have hbSupport := cycle.walk.snd_mem_support_of_mem_edges hedge + have habOld : oldGraph.Adj a b := by + simpa [oldGraph] using cycle.walk.edges_subset_edgeSet hedge + cases a with + | inl v => + cases b with + | inl w => simp [oldGraph, TwoColorIncidenceGraph] at habOld + | inr f => + have hdata : Incident G v f ∧ + (oldColoring f = some gamma ∨ oldColoring f = some delta) := by + simpa [oldGraph, TwoColorIncidenceGraph] using habOld + have hseries := edgeSeriesPreserved f hbSupport + have hsigma := edgeSigmaPreserved f hbSupport + simpa [sigmaGraph, TwoColorIncidenceGraph, hsigma, hseries] using hdata + | inr f => + cases b with + | inl v => + have hdata : Incident G v f ∧ + (oldColoring f = some gamma ∨ oldColoring f = some delta) := by + simpa [oldGraph, TwoColorIncidenceGraph] using habOld + have hseries := edgeSeriesPreserved f haSupport + have hsigma := edgeSigmaPreserved f haSupport + simpa [sigmaGraph, TwoColorIncidenceGraph, hsigma, hseries] using hdata + | inr g => simp [oldGraph, TwoColorIncidenceGraph] at habOld + +private theorem helper_currentStoredControl_788.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds), + ∀ c ∈ series.data.stored q.succ, c ∈ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors series.data q.succ := by + classical + intro V E _ _ _ G k rounds e0 input series q c hc + by_cases hm : c ∈ TreeMissingColors (series.data.coloring q.succ) + (series.data.tree q.succ.castSucc) + · exact Finset.mem_union.mpr (Or.inl hm) + · apply Finset.mem_union.mpr + right + unfold TashkinovStoredColors + simp only [Fin.val_succ, Nat.add_eq_zero_iff, one_ne_zero, and_false, ↓reduceIte, + Fin.castSucc_succ, + Finset.mem_sdiff, Finset.mem_biUnion, Finset.mem_univ, true_and] + refine ⟨⟨q.succ, ?_⟩, ?_⟩ + · simpa using hc + · simpa using hm + +private theorem helper_edgeIncidentEpsilon_899.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t epsilon : Fin rounds) (gamma delta : Fin + k) (z : V ⊕ E), ( + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G (series.data.coloring t.succ) gamma delta z → w ∈ + TreeSequenceVertexSet (series.data.tree epsilon.succ.castSucc)) → + let oldColoring : PartialEdgeColoring E k := series.data.coloring t.succ; + let epsilonTree : TreeSequence G e0 := series.data.tree epsilon.succ.castSucc; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G oldColoring gamma delta; + let _ : Set (V ⊕ E) := TwoColorComponent G oldColoring gamma delta z; + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta), ( + ∀ (x : V ⊕ E), x ∈ cycle.walk.support ↔ x ∈ TwoColorComponent G (series.data.coloring t.succ) + gamma delta z) → + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → TreeIncidentEdge epsilonTree f := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon gamma delta z hcontained oldColoring + epsilonTree oldGraph oldComponent cycle hfull f hf + obtain ⟨node, hnode, hadj⟩ := + SimpleGraph.adj_of_mem_walk_support cycle.walk cycle.isCycle.not_nil hf + cases node with + | inl v => + have hdata : Incident G v f ∧ + (oldColoring f = some gamma ∨ oldColoring f = some delta) := by + simpa [oldGraph, oldColoring, TwoColorIncidenceGraph] using hadj + have hvComponent : Sum.inl v ∈ oldComponent := + (hfull (Sum.inl v)).1 hnode + exact ⟨v, hcontained v (by simpa [oldComponent, oldColoring] using hvComponent), + hdata.1⟩ + | inr e => + simp [TwoColorIncidenceGraph] at hadj + +private theorem helper_edgeInternalEpsilon_915.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t epsilon : Fin rounds) (gamma delta : Fin + k) (z : V ⊕ E), ( + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G (series.data.coloring t.succ) gamma delta z → w ∈ + TreeSequenceVertexSet (series.data.tree epsilon.succ.castSucc)) → + let oldColoring : PartialEdgeColoring E k := series.data.coloring t.succ; + let epsilonTree : TreeSequence G e0 := series.data.tree epsilon.succ.castSucc; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G oldColoring gamma delta; + let _ : Set (V ⊕ E) := TwoColorComponent G oldColoring gamma delta z; + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta), ( + ∀ (x : V ⊕ E), x ∈ cycle.walk.support ↔ x ∈ TwoColorComponent G (series.data.coloring t.succ) + gamma delta z) → ( + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → oldColoring f = some gamma ∨ oldColoring f = some + delta) → + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → f ∈ InternalEdges G (TreeSequenceVertexSet + epsilonTree) := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon gamma delta z hcontained oldColoring + epsilonTree oldGraph oldComponent cycle hfull edgeOldActive f hf + have hfActive := edgeOldActive f hf + simp only [InternalEdges, Finset.mem_filter, Finset.mem_univ, true_and] + intro v hvf + have hadj : oldGraph.Adj (Sum.inl v) (Sum.inr f) := by + simpa [oldGraph, oldColoring, TwoColorIncidenceGraph] using ⟨hvf, hfActive⟩ + have hfComponent : Sum.inr f ∈ oldComponent := (hfull (Sum.inr f)).1 hf + have hvComponent : Sum.inl v ∈ oldComponent := by + change oldGraph.connectedComponentMk (Sum.inl v) = + oldGraph.connectedComponentMk z + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans hfComponent + exact hcontained v (by simpa [oldComponent, oldColoring] using hvComponent) + +private theorem helper_terminalComponentSubset_946.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t terminal : Fin rounds) (gamma delta : + Fin k) (z : V ⊕ E), + let terminalColoring : PartialEdgeColoring E k := series.data.coloring terminal.succ; + let terminalGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G terminalColoring gamma + delta; + let terminalComponent : Set (V ⊕ E) := TwoColorComponent G terminalColoring gamma delta z; + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta), ( + ∀ {a b : V ⊕ E}, a ∈ cycle.walk.support → terminalGraph.Adj a b → b ∈ cycle.walk.support) → z + ∈ cycle.walk.support → terminalComponent ⊆ {x : V ⊕ E | x ∈ cycle.walk.support} := by + classical + intro V E _ _ _ G k rounds e0 input series t terminal gamma delta z terminalColoring + terminalGraph terminalComponent cycle terminalClosed hzSupport x hx + change terminalGraph.connectedComponentMk x = + terminalGraph.connectedComponentMk z at hx + obtain ⟨walk⟩ := SimpleGraph.ConnectedComponent.exact hx.symm + have propagate : ∀ {a b : Sum V E}, terminalGraph.Walk a b → + a ∈ cycle.walk.support → b ∈ cycle.walk.support := by + intro a b walk ha + induction walk with + | nil => exact ha + | @cons a c b hac rest ih => exact ih (terminalClosed ha hac) + exact propagate walk hzSupport + +private theorem helper_terminalSupportComponent_960.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t terminal : Fin rounds) (gamma delta : + Fin k) (z : V ⊕ E), + let terminalColoring : PartialEdgeColoring E k := series.data.coloring terminal.succ; + let terminalGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G terminalColoring gamma + delta; + let terminalComponent : Set (V ⊕ E) := TwoColorComponent G terminalColoring gamma delta z; + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta) (terminalEdgeTransfer : + ∀ edge ∈ cycle.walk.edges, edge ∈ terminalGraph.edgeSet), + let _ : terminalGraph.Walk cycle.base cycle.base := cycle.walk.transfer terminalGraph + terminalEdgeTransfer; z ∈ cycle.walk.support → + ∀ x ∈ cycle.walk.support, x ∈ terminalComponent := by + classical + intro V E _ _ _ G k rounds e0 input series t terminal gamma delta z terminalColoring + terminalGraph terminalComponent cycle terminalEdgeTransfer terminalWalk hzSupport x hx + have hxWalk : x ∈ terminalWalk.support := by + simpa [terminalWalk] using hx + have hzWalk : z ∈ terminalWalk.support := by + simpa [terminalWalk] using hzSupport + have supportComponent : ∀ y : Sum V E, y ∈ terminalWalk.support → + terminalGraph.connectedComponentMk y = + terminalGraph.connectedComponentMk cycle.base := by + intro y hy + obtain ⟨i, hi, hiLe⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hy + rw [← hi] + exact (SimpleGraph.ConnectedComponent.sound + (terminalWalk.take i).reachable).symm + change terminalGraph.connectedComponentMk x = + terminalGraph.connectedComponentMk z + exact (supportComponent x hxWalk).trans (supportComponent z hzWalk).symm + +private theorem helper_terminalTreeMissingEq_985.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds e0 input) + (terminal : Fin rounds) (sigma : PartialEdgeColoring E k), + StableColoring (series.data.tree terminal.succ.castSucc) + (TashkinovStoredColors series.data terminal.succ) + (series.data.coloring terminal.succ) sigma → + let terminalColoring : PartialEdgeColoring E k := series.data.coloring terminal.succ; + let terminalTree : TreeSequence G e0 := series.data.tree terminal.succ.castSucc; + TreeMissingColors sigma terminalTree = TreeMissingColors terminalColoring terminalTree := by + classical + intro V E _ _ _ G k rounds e0 input series terminal sigma hsigmaStable terminalColoring + terminalTree + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hvc⟩ + exact ⟨v, hv, by + rw [hsigmaStable.2 v (by simpa [terminalTree] using hv)] at hvc + simpa [terminalColoring] using hvc⟩ + · rintro ⟨v, hv, hvc⟩ + exact ⟨v, hv, by + rw [← hsigmaStable.2 v (by simpa [terminalTree] using hv)] at hvc + simpa [terminalColoring] using hvc⟩ + +private theorem helper_sigmaSupportComponent_1076.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds e0 input) + (t : Fin rounds) (gamma delta : Fin k) (sigma : PartialEdgeColoring E k) (z : V ⊕ E), + let sigmaGraph : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigma gamma delta; + let sigmaComponent : Set (V ⊕ E) := TwoColorComponent G sigma gamma delta z; + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta), + z ∈ cycle.walk.support → + ∀ (sigmaEdgeTransfer : ∀ edge ∈ cycle.walk.edges, edge ∈ sigmaGraph.edgeSet), + let _ : sigmaGraph.Walk cycle.base cycle.base := + cycle.walk.transfer sigmaGraph sigmaEdgeTransfer; + ∀ x ∈ cycle.walk.support, + x ∈ sigmaComponent := by + classical + intro V E _ _ _ G k rounds e0 input series t gamma delta sigma z sigmaGraph sigmaComponent + cycle hzSupport sigmaEdgeTransfer sigmaWalk x hx + have hxWalk : x ∈ sigmaWalk.support := by + simpa [sigmaWalk] using hx + have hzWalk : z ∈ sigmaWalk.support := by + simpa [sigmaWalk] using hzSupport + have supportComponent : ∀ y : Sum V E, y ∈ sigmaWalk.support → + sigmaGraph.connectedComponentMk y = + sigmaGraph.connectedComponentMk cycle.base := by + intro y hy + obtain ⟨i, hi, hiLe⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hy + rw [← hi] + exact (SimpleGraph.ConnectedComponent.sound + (sigmaWalk.take i).reachable).symm + change sigmaGraph.connectedComponentMk x = sigmaGraph.connectedComponentMk z + exact (supportComponent x hxWalk).trans (supportComponent z hzWalk).symm + +private theorem helper_continuation_1088.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) (t epsilon terminal : Fin rounds) (gamma + delta : Fin k), (↑epsilon : ℕ) ≤ (↑terminal : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (series.data.tree terminal.succ.castSucc) (TashkinovStoredColors + series.data terminal.succ) (series.data.coloring terminal.succ) sigma → + ∀ (z : V ⊕ E), ( + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G (series.data.coloring t.succ) gamma delta z → w ∈ + TreeSequenceVertexSet (series.data.tree epsilon.succ.castSucc)) → + let oldColoring : PartialEdgeColoring E k := series.data.coloring t.succ; + let terminalColoring : PartialEdgeColoring E k := series.data.coloring terminal.succ; + let epsilonTree : TreeSequence G e0 := series.data.tree epsilon.succ.castSucc; + let terminalTree : TreeSequence G e0 := series.data.tree terminal.succ.castSucc; + let terminalStored : Finset (Fin k) := TashkinovStoredColors series.data terminal.succ; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G terminalColoring gamma delta; + let _ : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigma gamma delta; + let _ : Set (V ⊕ E) := TwoColorComponent G oldColoring gamma delta z; + let _ : Set (V ⊕ E) := TwoColorComponent G terminalColoring gamma delta z; + let _ : Set (V ⊕ E) := TwoColorComponent G sigma gamma delta z; gamma ∈ TreeMissingColors + (series.data.coloring epsilon.castSucc) epsilonTree ∪ TashkinovStoredColors series.data + epsilon.castSucc → delta ∈ TreeMissingColors (series.data.coloring epsilon.castSucc) + epsilonTree ∪ TashkinovStoredColors series.data epsilon.castSucc → gamma ∈ + TreeMissingColors terminalColoring terminalTree ∪ terminalStored → delta ∈ + TreeMissingColors terminalColoring terminalTree ∪ terminalStored → series.data.coloring + epsilon.castSucc = oldColoring → TreeSequenceVertexSet epsilonTree ⊆ TreeSequenceVertexSet + terminalTree → IsProperEdgeColoring G terminalColoring → IsOneEdgeUncolored + terminalColoring e0 → + ∀ (cycle : TwoColorCycle G (series.data.coloring t.succ) gamma delta), ( + ∀ (x : V ⊕ E), x ∈ cycle.walk.support ↔ x ∈ TwoColorComponent G (series.data.coloring t.succ) + gamma delta z) → ( + ∀ (f : E), Sum.inr f ∈ cycle.walk.support → oldColoring f = some gamma ∨ oldColoring f = some + delta) → TwoColorComponent G sigma gamma delta z = TwoColorComponent G + (series.data.coloring t.succ) gamma delta z ∧ TwoColorComponentCycle G sigma gamma delta z + := by + classical + intro V E _ _ _ G k rounds e0 input series t epsilon terminal gamma delta hepsilonTerminal + sigma hsigmaProper hsigmaOne hsigmaStable z hcontained oldColoring terminalColoring + epsilonTree terminalTree terminalStored terminalGraph sigmaGraph oldComponent + terminalComponent sigmaComponent hgammaEpsilon hdeltaEpsilon hgammaTerminal hdeltaTerminal + hepsilonColoring vertexToTerminal hterminalProper hterminalOne cycle hfull edgeOldActive + have edgeIncidentEpsilon := @helper_edgeIncidentEpsilon_899 V E inferInstance inferInstance + inferInstance G k rounds e0 input series t epsilon gamma delta z hcontained cycle hfull + have edgeInternalEpsilon := @helper_edgeInternalEpsilon_915 V E inferInstance inferInstance + inferInstance G k rounds e0 input series t epsilon gamma delta z hcontained cycle hfull + edgeOldActive + have edgeSeriesPreserved := @helper_edgeSeriesPreserved_763 V E inferInstance inferInstance + inferInstance G k rounds e0 input series t epsilon terminal gamma delta hepsilonTerminal + hgammaEpsilon hdeltaEpsilon hepsilonColoring cycle edgeOldActive edgeIncidentEpsilon + edgeInternalEpsilon + have terminalEdgeTransfer := @helper_terminalEdgeTransfer_791 V E inferInstance inferInstance + inferInstance G k rounds e0 input series t terminal gamma delta cycle edgeSeriesPreserved + let terminalWalk := cycle.walk.transfer terminalGraph terminalEdgeTransfer + have hterminalCycle : terminalWalk.IsCycle := + cycle.isCycle.transfer terminalEdgeTransfer + have terminalClosed := @helper_terminalClosed_552 V E inferInstance inferInstance inferInstance G + k rounds e0 input series t terminal gamma delta z hterminalProper cycle hfull edgeOldActive + edgeSeriesPreserved + have hzSupport : z ∈ cycle.walk.support := (hfull z).2 (by rfl) + have terminalComponentSubset := @helper_terminalComponentSubset_946 V E inferInstance + inferInstance inferInstance G k rounds e0 input series t terminal gamma delta z cycle + terminalClosed hzSupport + have terminalSupportComponent := @helper_terminalSupportComponent_960 V E inferInstance + inferInstance inferInstance G k rounds e0 input series t terminal gamma delta z cycle + terminalEdgeTransfer hzSupport + have hterminalFull : ∀ x : Sum V E, + x ∈ cycle.walk.support ↔ x ∈ terminalComponent := by + intro x + exact ⟨terminalSupportComponent x, terminalComponentSubset (a := x)⟩ + have terminalTreeMissingEq := @helper_terminalTreeMissingEq_985 V E inferInstance inferInstance + inferInstance G k rounds e0 input series terminal sigma hsigmaStable + have hgammaSigma : gamma ∈ + TreeMissingColors sigma terminalTree ∪ terminalStored := by + rw [terminalTreeMissingEq] + exact hgammaTerminal + have hdeltaSigma : delta ∈ + TreeMissingColors sigma terminalTree ∪ terminalStored := by + rw [terminalTreeMissingEq] + exact hdeltaTerminal + let terminalSubtype : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨terminalColoring, hterminalProper, hterminalOne⟩ + let sigmaSubtype : {psi : PartialEdgeColoring E k // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨sigma, hsigmaProper, hsigmaOne⟩ + have hsigmaReverse : StableColoring terminalTree terminalStored + sigma terminalColoring := by + have hforward : StableColoring terminalTree terminalStored + terminalColoring sigma := by + simpa [terminalTree, terminalStored, terminalColoring] using hsigmaStable + have hforwardSubtype : StableColoring terminalTree terminalStored + terminalSubtype.1 sigmaSubtype.1 := by + simpa [terminalSubtype, sigmaSubtype] using hforward + have hreverseSubtype := + (sc2 G e0 terminalTree terminalStored).symm hforwardSubtype + simpa [terminalSubtype, sigmaSubtype] using hreverseSubtype + have cycleVertexTerminalTree (v : V) + (hv : Sum.inl v ∈ cycle.walk.support) : + v ∈ TreeSequenceVertexSet terminalTree := by + apply vertexToTerminal + apply hcontained v + exact (hfull (Sum.inl v)).1 hv + have edgeIncidentTerminal (f : E) + (hf : Sum.inr f ∈ cycle.walk.support) : + TreeIncidentEdge terminalTree f := by + rcases edgeIncidentEpsilon f hf with ⟨v, hv, hvf⟩ + exact ⟨v, vertexToTerminal hv, hvf⟩ + have edgeSigmaPreserved (f : E) + (hf : Sum.inr f ∈ cycle.walk.support) : + sigma f = terminalColoring f := by + have hfIncident := edgeIncidentTerminal f hf + have hfSeries := edgeSeriesPreserved f hf + rcases edgeOldActive f hf with hgamma | hdelta + · apply hsigmaStable.1 f (by simpa [terminalTree] using hfIncident) + exact ⟨gamma, by simpa [terminalColoring, terminalTree, terminalStored] + using hgammaTerminal, hfSeries.trans hgamma⟩ + · apply hsigmaStable.1 f (by simpa [terminalTree] using hfIncident) + exact ⟨delta, by simpa [terminalColoring, terminalTree, terminalStored] + using hdeltaTerminal, hfSeries.trans hdelta⟩ + have sigmaEdgeTransfer := @helper_sigmaEdgeTransfer_936 V E inferInstance inferInstance + inferInstance G k rounds e0 input series t terminal gamma delta sigma cycle + edgeSeriesPreserved edgeSigmaPreserved + let sigmaWalk := cycle.walk.transfer sigmaGraph sigmaEdgeTransfer + have hsigmaCycle : sigmaWalk.IsCycle := cycle.isCycle.transfer sigmaEdgeTransfer + have sigmaClosed := @helper_sigmaClosed_817 V E inferInstance inferInstance inferInstance G k + rounds e0 input series t terminal gamma delta sigma cycle terminalClosed hgammaSigma + hdeltaSigma hsigmaReverse cycleVertexTerminalTree edgeSigmaPreserved + have sigmaComponentSubset : sigmaComponent ⊆ + {x | x ∈ cycle.walk.support} := by + intro x hx + change sigmaGraph.connectedComponentMk x = sigmaGraph.connectedComponentMk z at hx + obtain ⟨walk⟩ := SimpleGraph.ConnectedComponent.exact hx.symm + have propagate : ∀ {a b : Sum V E}, sigmaGraph.Walk a b → + a ∈ cycle.walk.support → b ∈ cycle.walk.support := by + intro a b walk ha + induction walk with + | nil => exact ha + | @cons a c b hac rest ih => exact ih (sigmaClosed ha hac) + exact propagate walk hzSupport + have sigmaSupportComponent := @helper_sigmaSupportComponent_1076 V E inferInstance inferInstance + inferInstance G k rounds e0 input series t gamma delta sigma z cycle hzSupport + sigmaEdgeTransfer + have hsigmaFull : ∀ x : Sum V E, + x ∈ cycle.walk.support ↔ x ∈ sigmaComponent := by + intro x + exact ⟨sigmaSupportComponent x, sigmaComponentSubset (a := x)⟩ + have hcomponent : sigmaComponent = oldComponent := by + ext x + exact (hsigmaFull x).symm.trans (hfull x) + refine ⟨by simpa [sigmaComponent, oldComponent, oldColoring] using hcomponent, ?_⟩ + refine ⟨⟨cycle.base, sigmaWalk, hsigmaCycle⟩, ?_⟩ + intro x + change x ∈ sigmaWalk.support ↔ x ∈ TwoColorComponent G sigma gamma delta z + rw [SimpleGraph.Walk.support_transfer] + simpa [sigmaComponent] using hsigmaFull x + +theorem StableSeriesCycleComponentTransport {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds e0 input) + (t epsilon terminal : Fin rounds) (gamma delta : Fin k) + (htEpsilon : t.val < epsilon.val) + (hepsilonTerminal : epsilon.val ≤ terminal.val) + (htKind : series.data.kind t.succ = + some TashkinovExtensionKind.PE) + (htGamma : series.data.gamma t.succ = some gamma) + (htDelta : series.data.delta t.succ = some delta) + (hintervening : ∀ r : Fin rounds, + t.val < r.val → r.val < epsilon.val → + series.data.kind r.succ = some TashkinovExtensionKind.RE) + (hterminalKind : series.data.kind terminal.succ = + some TashkinovExtensionKind.PE) + (sigma : PartialEdgeColoring E k) + (hsigmaProper : IsProperEdgeColoring G sigma) + (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : StableColoring + (series.data.tree terminal.succ.castSucc) + (TashkinovStoredColors series.data terminal.succ) + (series.data.coloring terminal.succ) sigma) + (z : Sum V E) + (hcycle : TwoColorComponentCycle G + (series.data.coloring t.succ) gamma delta z) + (hcontained : ∀ w : V, + Sum.inl w ∈ TwoColorComponent G + (series.data.coloring t.succ) gamma delta z → + w ∈ TreeSequenceVertexSet + (series.data.tree epsilon.succ.castSucc)) : + TwoColorComponent G sigma gamma delta z = + TwoColorComponent G (series.data.coloring t.succ) gamma delta z ∧ + TwoColorComponentCycle G sigma gamma delta z := by + classical + let oldColoring := series.data.coloring t.succ + let terminalColoring := series.data.coloring terminal.succ + let epsilonTree := series.data.tree epsilon.succ.castSucc + let terminalTree := series.data.tree terminal.succ.castSucc + let terminalStored := TashkinovStoredColors series.data terminal.succ + let oldGraph := TwoColorIncidenceGraph G oldColoring gamma delta + let terminalGraph := TwoColorIncidenceGraph G terminalColoring gamma delta + let sigmaGraph := TwoColorIncidenceGraph G sigma gamma delta + let oldComponent := TwoColorComponent G oldColoring gamma delta z + let terminalComponent := TwoColorComponent G terminalColoring gamma delta z + let sigmaComponent := TwoColorComponent G sigma gamma delta z + have currentStoredControl := @helper_currentStoredControl_788 V E inferInstance inferInstance + inferInstance G k rounds e0 input series + have hpairControl := @helper_hpairControl_97 V E inferInstance inferInstance inferInstance G k + rounds e0 input series t epsilon terminal gamma delta htKind htGamma htDelta sigma z hcycle + hcontained currentStoredControl + have hgammaStart := hpairControl gamma (Or.inl rfl) + have hdeltaStart := hpairControl delta (Or.inr rfl) + have controlPrevious := @helper_controlPrevious_161 V E inferInstance inferInstance inferInstance + G k rounds e0 input series t epsilon terminal + have htTerminal : t.val < terminal.val := by omega + have hgammaEpsilon : gamma ∈ + TreeMissingColors (series.data.coloring epsilon.castSucc) epsilonTree ∪ + TashkinovStoredColors series.data epsilon.castSucc := by + simpa [epsilonTree] using + controlPrevious gamma hgammaStart epsilon.val (by omega) + hepsilonTerminal epsilon rfl + have hdeltaEpsilon : delta ∈ + TreeMissingColors (series.data.coloring epsilon.castSucc) epsilonTree ∪ + TashkinovStoredColors series.data epsilon.castSucc := by + simpa [epsilonTree] using + controlPrevious delta hdeltaStart epsilon.val (by omega) + hepsilonTerminal epsilon rfl + have hgammaTerminalPrevious := + controlPrevious gamma hgammaStart terminal.val (by omega) le_rfl terminal rfl + have hdeltaTerminalPrevious := + controlPrevious delta hdeltaStart terminal.val (by omega) le_rfl terminal rfl + have hgammaTerminal : gamma ∈ + TreeMissingColors terminalColoring terminalTree ∪ terminalStored := by + simpa [terminalColoring, terminalTree, terminalStored] using + (HkuMissingStoredMonotone G k rounds e0 input series terminal).1 + hgammaTerminalPrevious + have hdeltaTerminal : delta ∈ + TreeMissingColors terminalColoring terminalTree ∪ terminalStored := by + simpa [terminalColoring, terminalTree, terminalStored] using + (HkuMissingStoredMonotone G k rounds e0 input series terminal).1 + hdeltaTerminalPrevious + have reColoring := @helper_reColoring_228 V E inferInstance inferInstance inferInstance G k rounds + e0 input series t epsilon terminal + have coloringAlong := @helper_coloringAlong_644 V E inferInstance inferInstance inferInstance G k + rounds e0 input series t epsilon terminal hintervening reColoring + have hepsilonColoring : + series.data.coloring epsilon.castSucc = oldColoring := + coloringAlong epsilon.val (by omega) le_rfl epsilon.castSucc rfl + have stepSegment := @helper_stepSegment_310 V E inferInstance inferInstance inferInstance G k + rounds e0 input series t epsilon terminal + have vertexTransfer {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + rcases hv with ⟨i, -, rfl⟩ + rcases hAB with ⟨hlen, hvertices, hedges⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, ?_⟩ + exact hvertices i + have vertexToTerminal := @helper_vertexToTerminal_689 V E inferInstance inferInstance + inferInstance G k rounds e0 input series t epsilon terminal hepsilonTerminal stepSegment + vertexTransfer + have hterminalData := @helper_hterminalData_392 V E inferInstance inferInstance inferInstance G k + rounds e0 input series t epsilon terminal hterminalKind + rcases hterminalData with ⟨hterminalProper, hterminalOne⟩ + rcases hcycle with ⟨cycle, hfull⟩ + have edgeOldActive (f : E) (hf : Sum.inr f ∈ cycle.walk.support) : + oldColoring f = some gamma ∨ oldColoring f = some delta := by + obtain ⟨node, -, hadj⟩ := + SimpleGraph.adj_of_mem_walk_support cycle.walk cycle.isCycle.not_nil hf + cases node with + | inl v => + have hdata : Incident G v f ∧ + (oldColoring f = some gamma ∨ oldColoring f = some delta) := by + simpa [oldGraph, oldColoring, TwoColorIncidenceGraph] using hadj + exact hdata.2 + | inr e => + simp [TwoColorIncidenceGraph] at hadj + exact @helper_continuation_1088 V E inferInstance inferInstance inferInstance G k + rounds e0 input series t epsilon terminal gamma delta hepsilonTerminal sigma hsigmaProper + hsigmaOne hsigmaStable z hcontained hgammaEpsilon hdeltaEpsilon hgammaTerminal + hdeltaTerminal hepsilonColoring vertexToTerminal hterminalProper hterminalOne cycle hfull + edgeOldActive +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StarredPrefixPreparation.lean b/LeanPool/GoldbergSeymour/StarredPrefixPreparation.lean new file mode 100644 index 0000000000..e1b1a90aa8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StarredPrefixPreparation.lean @@ -0,0 +1,1690 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ElementaryClosedMissingColorOdd +public import LeanPool.GoldbergSeymour.GoodHierarchyElementaryLarge +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PredecessorElementary +public import LeanPool.GoldbergSeymour.TechnicalInductionContext +public import LeanPool.GoldbergSeymour.TechnicalCurrentLadderMissingBoundLarge +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +public import LeanPool.GoldbergSeymour.LowerRoundProperties + +/-! +# P2940_T1_Starred Prefix Preparation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_htermMissing_298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = corrU.replacementETT.rounds → + MaximumProperty current → + ((∀ (q : Fin current.rounds) (v : V), + current.series.data.kind q.succ = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') + (j : Fin (current.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex current v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (current.series.data.tree q.succ.castSucc) + (TashkinovStoredColors current.series.data q.succ) + (current.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal + (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma ∧ + ((0 : ℕ) < (↑j : ℕ) → + StableColoring (current.series.data.tree j.castSucc) + (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin current.rounds) (vq vr : V), + q ≠ r → + vq ≠ vr → + current.series.data.kind q.succ = some TashkinovExtensionKind.PE → + current.series.data.kind r.succ = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex q.succ = some vq → + current.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') + (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex current vq hvq = + ETTFirstAppearanceIndex current vr hvr → + Disjoint (current.series.data.stored q.succ) + (current.series.data.stored r.succ)) ∧ + (let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc; + ∀ (v : V) (gamma delta : Fin k), + current.series.data.kind terminal = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex terminal = some v → + current.series.data.gamma terminal = some gamma → + current.series.data.delta terminal = some delta → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma → + ∀ w ∈ TreeSequenceVertexSet Tterminal, + Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ + w = v) ∧ + (let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc; + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma → + ∀ (delta : Fin k), + DefectiveColor G sigma (TreeSequenceVertexSet Tterminal) delta → + ∀ (v : V), + BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tterminal) delta v → + (∃ (w : V), + BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tterminal) delta w ∧ + TreeVertexOrder Tterminal w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') + (q : Fin current.rounds) (vi : V), + current.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ + current.series.data.kind q.succ = + some TashkinovExtensionKind.SE → + current.series.data.chosenVertex q.succ = some vi → + ETTFirstAppearanceIndex current v hvFinal ≤ + (↑q : ℕ) + (1 : ℕ) → + v = vi ∨ TreeVertexOrder T' v vi) ∧ + let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc; + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma → + ModColoring current sigma) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have hn : (1 : ℕ) ≤ ett.rounds := ett.roundsPositive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) + (corrU.replacementSeries.data.coloring q.succ) → + ett.series.data.kind (Fin.last ett.rounds) ≠ some TashkinovExtensionKind.PE → + ∀ v ∈ TreeSequenceVertexSet Tn, + MissingColors G phi v = MissingColors G (ett.series.data.coloring q.castSucc) v := by + classical + intro V E _ _ _ G k e0 input T phi ett U corrU hcurrent q hqterminal Tn htermStable hnonPE v hv + have hv' : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + simpa [Tn, hqterminal] using hv + have hmiss := htermStable.2 v hv' + have hmissPhi : MissingColors G phi v = + MissingColors G (ett.series.data.coloring (Fin.last ett.rounds)) v := by + simpa only [hqterminal, ← corrU.finalGeneratingColoring] using hmiss + generalize htarget : q.succ = target + have hstep := ett.series.certified target + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + have hcurrent : ett.series.data.coloring (Fin.last ett.rounds) = + choice.selected := by + simpa only [hqterminal] using currentColoring + rw [hcurrent] at hmissPhi + have hvq : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + simpa [Tn, hqterminal] using hv + exact hmissPhi.trans (choice.selectedStable.2 v hvq) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + have hk : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := by + simpa only [hqterminal] using currentKind + exact False.elim (hnonPE hk) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + have hcurrent : ett.series.data.coloring (Fin.last ett.rounds) = + ett.series.data.coloring q.castSucc := by + simpa only [hqterminal] using currentColoring + rw [hcurrent] at hmissPhi + exact hmissPhi + +private theorem helper_branch_424.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (U : TreeSequence G e0) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corrU.replacementETT phi), + baseU.core = base.core → + ∀ (H : TashkinovHierarchy corrU.replacementETT baseU), + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H lastH; + corrU.replacementETT.series.data.kind (Fin.last corrU.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet U) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have hn : (1 : ℕ) ≤ ett.rounds := ett.roundsPositive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet Tn) → + (ett.series.data.kind (Fin.last ett.rounds) ≠ some TashkinovExtensionKind.PE → + ∀ v ∈ TreeSequenceVertexSet Tn, + MissingColors G phi v = MissingColors G (ett.series.data.coloring q.castSucc) v) → + ∀ {u : V}, + u ∈ TreeSequenceVertexSet A → + ∀ {v : V}, + v ∈ TreeSequenceVertexSet A → + u ≠ v → + H.dividerCount = (0 : ℕ) → + Disjoint (MissingColors G phi u) (MissingColors G phi v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base U corrU baseU hcore H lastH A hkindReplacement + hUelem q Tn hpreElem htermMissing u hu v hv huv hd + have hstar : A = baseU.core := by + dsimp [A, HierarchyStarredStage] + have hl : lastH = (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [lastH, hd] + rw [hl] + rfl + by_cases hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · have hPEU : corrU.replacementETT.series.data.kind + (Fin.last corrU.replacementETT.rounds) = + some TashkinovExtensionKind.PE := by + rw [hkindReplacement] + exact hPE + have hcoreU : TreeSequenceInitialSegment baseU.core U := by + have h := H.coreInsideFirst + have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [hd] + rw [hi, H.terminalStage] at h + exact h + have hcoreSubset := TreeSequenceInitialSegmentVertexSetSubset hcoreU + rw [hstar] at hu hv + exact hUelem (hcoreSubset hu) (hcoreSubset hv) huv + · have hcoreOrig : base.core = Tn := base.nonparallel hPE + have hAeq : A = Tn := hstar.trans (hcore.trans hcoreOrig) + have hmissEq := htermMissing hPE + rw [hAeq] at hu hv + have hmu := hmissEq u hu + have hmv := hmissEq v hv + simpa only [hmu, hmv] using hpreElem hu hv huv + +private theorem helper_branch_456.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + (11 : ℕ) ≤ TashkinovOrder G → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = ett.rounds → + MaximumProperty current → + ∀ (base' : HierarchyBase current generating') + (K : TashkinovHierarchy current base') (_ : GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + (2 : ℕ) * current.rounds + (11 : ℕ) ≤ + (TreeMissingColors generating' Tn).card) → + ∀ (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + MaximumProperty corrU.replacementETT → + ∀ (baseU : HierarchyBase corrU.replacementETT phi) + (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : GoodHierarchy H), + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H lastH; + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + (0 : ℕ) < lower.rounds → + lower.rounds < corrU.replacementETT.rounds → + MaximumProperty lower → (open scoped Classical in LowerRoundProperties lower)) → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = corrU.replacementETT.rounds → + MaximumProperty current → + ((∀ (q : Fin current.rounds) (v : V), + current.series.data.kind q.succ = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') + (j : Fin (current.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex current v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (current.series.data.tree q.succ.castSucc) + (TashkinovStoredColors current.series.data q.succ) + (current.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal + (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma ∧ + ((0 : ℕ) < (↑j : ℕ) → + StableColoring (current.series.data.tree j.castSucc) + (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin current.rounds) (vq vr : V), + q ≠ r → + vq ≠ vr → + current.series.data.kind q.succ = some TashkinovExtensionKind.PE → + current.series.data.kind r.succ = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex q.succ = some vq → + current.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') + (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex current vq hvq = + ETTFirstAppearanceIndex current vr hvr → + Disjoint (current.series.data.stored q.succ) + (current.series.data.stored r.succ)) ∧ + (let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc; + ∀ (v : V) (gamma delta : Fin k), + current.series.data.kind terminal = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex terminal = some v → + current.series.data.gamma terminal = some gamma → + current.series.data.delta terminal = some delta → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma → + ∀ w ∈ TreeSequenceVertexSet Tterminal, + Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ + w = v) ∧ + (let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc; + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma → + ∀ (delta : Fin k), + DefectiveColor G sigma (TreeSequenceVertexSet Tterminal) delta → + ∀ (v : V), + BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tterminal) delta v → + (∃ (w : V), + BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tterminal) delta w ∧ + TreeVertexOrder Tterminal w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') + (q : Fin current.rounds) (vi : V), + current.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ + current.series.data.kind q.succ = + some TashkinovExtensionKind.SE → + current.series.data.chosenVertex q.succ = some vi → + ETTFirstAppearanceIndex current v hvFinal ≤ + (↑q : ℕ) + (1 : ℕ) → + v = vi ∨ TreeVertexOrder T' v vi) ∧ + let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc; + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma → + ModColoring current sigma) → + ∀ {u : V}, + u ∈ TreeSequenceVertexSet A → + ∀ {v : V}, + v ∈ TreeSequenceVertexSet A → + u ≠ v → + ¬H.dividerCount = (0 : ℕ) → + Disjoint (MissingColors G phi u) (MissingColors G phi v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hlargeOrder hmissingBound U corrU hMPU baseU H good + lastH A hlower hcurrent u hu v hv huv hd + let r : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + have hr : 1 ≤ r.val := by + dsimp [r] + have hdpos : 0 < H.dividerCount := Nat.pos_of_ne_zero hd + omega + have hstarPositive : A = H.stage r.castSucc := by + have starPositive : ∀ j : Fin (H.dividerCount + 1), 0 < j.val → + HierarchyStarredStage H j = H.stage j.castSucc := by + intro j + refine Fin.cases ?_ ?_ j + · intro hj0 + simp at hj0 + · intro i hi + rfl + have hs := starPositive r (by omega) + simpa [A, r] using hs + obtain ⟨ep, epMP, epRound, epSeries, bp, bpCore, bpClosure, + bpSupport, HP, hpCount, hpStages, hpDividers, gp, hpData, + hminusPrefix⟩ := + GoodHierarchyPrefixRepackage G k e0 corrU.replacementInput U phi phi + corrU.replacementETT hMPU baseU H good r hr + have hlowerP := fun {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating') + (hpositive : 0 < lower.rounds) (hround : lower.rounds < ep.rounds) + (hmaximum : MaximumProperty lower) => by + have hround' : lower.rounds < corrU.replacementETT.rounds := by + simpa [epRound] using hround + exact hlower lower hpositive hround' hmaximum + have hcurrentP := fun {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (hround : current.rounds = ep.rounds) + (hmaximum : MaximumProperty current) => + hcurrent current (hround.trans epRound) hmaximum + have hboundP := fun {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (hround : current.rounds = ep.rounds) + (hmaximum : MaximumProperty current) + (bp' : HierarchyBase current generating') + (K : TashkinovHierarchy current bp') (gK : GoodHierarchy K) => by + have hround' : current.rounds = ett.rounds := + hround.trans (epRound.trans corrU.rungAgreement) + exact hmissingBound current hround' hmaximum bp' K gK + have hprefixElem : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (H.stage r.castSucc)) := by + exact GoodHierarchyElementaryLarge G k e0 corrU.replacementInput + (H.stage r.castSucc) phi ep epMP bp HP gp hlowerP hcurrentP + hlargeOrder hboundP + have hu' : u ∈ TreeSequenceVertexSet (H.stage r.castSucc) := by + simpa [hstarPositive] using hu + have hv' : v ∈ TreeSequenceVertexSet (H.stage r.castSucc) := by + simpa [hstarPositive] using hv + exact hprefixElem hu' hv' huv + +private theorem helper_helemA_372.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi), + (11 : ℕ) ≤ TashkinovOrder G → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = ett.rounds → + MaximumProperty current → + ∀ (base' : HierarchyBase current generating') + (K : TashkinovHierarchy current base') (_ : GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + (2 : ℕ) * current.rounds + (11 : ℕ) ≤ + (TreeMissingColors generating' Tn).card) → + ∀ (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + MaximumProperty corrU.replacementETT → + ∀ (baseU : HierarchyBase corrU.replacementETT phi), + baseU.core = base.core → + ∀ (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : GoodHierarchy H), + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H lastH; + corrU.replacementETT.series.data.kind (Fin.last corrU.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + (0 : ℕ) < lower.rounds → + lower.rounds < corrU.replacementETT.rounds → + MaximumProperty lower → (open scoped Classical in LowerRoundProperties lower)) → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = corrU.replacementETT.rounds → + MaximumProperty current → + ((∀ (q : Fin current.rounds) (v : V), + current.series.data.kind q.succ = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex q.succ = some v → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') + (j : Fin (current.rounds + (1 : ℕ))), + ETTFirstAppearanceIndex current v hvFinal = (↑j : ℕ) + (1 : ℕ) → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (current.series.data.tree q.succ.castSucc) + (TashkinovStoredColors current.series.data q.succ) + (current.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T' v hvFinal + (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma ∧ + ((0 : ℕ) < (↑j : ℕ) → + StableColoring (current.series.data.tree j.castSucc) + (TashkinovStoredColors current.series.data j) + (current.series.data.coloring j) sigma)) ∧ + ∀ (q r : Fin current.rounds) (vq vr : V), + q ≠ r → + vq ≠ vr → + current.series.data.kind q.succ = some TashkinovExtensionKind.PE → + current.series.data.kind r.succ = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex q.succ = some vq → + current.series.data.chosenVertex r.succ = some vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T') + (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex current vq hvq = + ETTFirstAppearanceIndex current vr hvr → + Disjoint (current.series.data.stored q.succ) + (current.series.data.stored r.succ)) ∧ + (let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc; + ∀ (v : V) (gamma delta : Fin k), + current.series.data.kind terminal = some TashkinovExtensionKind.PE → + current.series.data.chosenVertex terminal = some v → + current.series.data.gamma terminal = some gamma → + current.series.data.delta terminal = some delta → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma → + ∀ w ∈ TreeSequenceVertexSet Tterminal, + Sum.inl w ∈ + TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ + w = v) ∧ + (let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc; + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma → + ∀ (delta : Fin k), + DefectiveColor G sigma (TreeSequenceVertexSet Tterminal) delta → + ∀ (v : V), + BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tterminal) delta v → + (∃ (w : V), + BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tterminal) delta w ∧ + TreeVertexOrder Tterminal w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T') + (q : Fin current.rounds) (vi : V), + current.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ + current.series.data.kind q.succ = + some TashkinovExtensionKind.SE → + current.series.data.chosenVertex q.succ = some vi → + ETTFirstAppearanceIndex current v hvFinal ≤ + (↑q : ℕ) + (1 : ℕ) → + v = vi ∨ TreeVertexOrder T' v vi) ∧ + let terminal : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tterminal : TreeSequence G e0 := + current.series.data.tree terminal.castSucc; + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tterminal + (TashkinovStoredColors current.series.data terminal) + (current.series.data.coloring terminal) sigma → + ModColoring current sigma) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet U) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have hn : (1 : ℕ) ≤ ett.rounds := ett.roundsPositive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet Tn) → + (ett.series.data.kind (Fin.last ett.rounds) ≠ some TashkinovExtensionKind.PE → + ∀ v ∈ TreeSequenceVertexSet Tn, + MissingColors G phi v = MissingColors G (ett.series.data.coloring q.castSucc) v) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base hlargeOrder hmissingBound U corrU hMPU baseU + hcore H good lastH A hkindReplacement hlower hcurrent hUelem q Tn hpreElem htermMissing + unfold ColoredVertexSetElementary + intro u hu v hv huv + by_cases hd : H.dividerCount = 0 + · exact @helper_branch_424 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base U corrU baseU hcore H hkindReplacement hUelem hpreElem htermMissing u + hu v hv huv hd + · exact @helper_branch_456 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett hlargeOrder hmissingBound U corrU hMPU baseU H good hlower hcurrent u hu v + hv huv hd +private theorem helper_hAU_497.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (U : TreeSequence G e0) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corrU.replacementETT phi), + baseU.core = base.core → + ∀ (H : TashkinovHierarchy corrU.replacementETT baseU), + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H lastH; + (∀ {m n : ℕ} {psi : PartialEdgeColoring E k} (s : TashkinovSeries G k m e0 psi) + (t : TashkinovSeries G k n e0 psi) (h : m = n), + s ≍ t → + ∀ (j : Fin (m + (2 : ℕ))), + s.data.tree j = + t.data.tree (Fin.cast (congrArg (fun (a : ℕ) ↦ a + (2 : ℕ)) h) j)) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have hn : (1 : ℕ) ≤ ett.rounds := ett.roundsPositive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + let _ : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, + Decidable.byContradiction fun (a_1 : ¬a < H.dividerCount + (2 : ℕ)) ↦ by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, + Decidable.byContradiction fun (a_1 : ¬a + d < H.dividerCount + (2 : ℕ)) ↦ by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + TreeSequenceInitialSegment A U := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base U corrU baseU hcore H lastH A treeOfSeriesEq q + hqterminal Tn stageSegment + by_cases hd : H.dividerCount = 0 + · have hstar : A = baseU.core := by + dsimp [A, HierarchyStarredStage] + have hl : lastH = (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [lastH, hd] + rw [hl] + rfl + by_cases hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · have hcoreU : TreeSequenceInitialSegment baseU.core U := by + have h := H.coreInsideFirst + have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [hd] + rw [hi, H.terminalStage] at h + exact h + simpa [hstar] using hcoreU + · have hcoreOrig : base.core = Tn := base.nonparallel hPE + have hAeq : A = Tn := hstar.trans (hcore.trans hcoreOrig) + have hTnU : TreeSequenceInitialSegment Tn U := by + have htree := treeOfSeriesEq corrU.replacementETT.series + corrU.replacementSeries corrU.rungAgreement + corrU.seriesPresentation + (Fin.last corrU.replacementETT.rounds).castSucc + have hidx : Fin.cast (congrArg (fun n => n + 2) + corrU.rungAgreement) + ((Fin.last corrU.replacementETT.rounds).castSucc) = + q.succ.castSucc := by + apply Fin.ext + simp [q] + have hn := ett.roundsPositive + omega + rw [hidx] at htree + have hrepLadder : + corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc = Tn := by + calc + _ = corrU.replacementSeries.data.tree q.succ.castSucc := htree + _ = ett.series.data.tree q.succ.castSucc := corrU.ladderTreesAgree q + _ = Tn := by simp [Tn, hqterminal] + have habove := corrU.replacementETT.abovePenultimate + have haboveIdx : + (⟨corrU.replacementETT.rounds, by omega⟩ : + Fin (corrU.replacementETT.rounds + 2)) = + (Fin.last corrU.replacementETT.rounds).castSucc := by + apply Fin.ext + rfl + rw [haboveIdx, hrepLadder] at habove + exact habove + simpa [hAeq] using hTnU + · let r : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + have hstarPositive : A = H.stage r.castSucc := by + have starPositive : ∀ j : Fin (H.dividerCount + 1), 0 < j.val → + HierarchyStarredStage H j = H.stage j.castSucc := by + intro j + refine Fin.cases ?_ ?_ j + · intro hj + simp at hj + · intro i hj + rfl + simpa [A, r] using starPositive r (by + dsimp [r] + have : 0 < H.dividerCount := Nat.pos_of_ne_zero hd + exact this) + have hseg := stageSegment H.dividerCount 1 (by omega) + have hlast : (⟨H.dividerCount + 1, by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + rfl + have hseg' : TreeSequenceInitialSegment (H.stage r.castSucc) U := by + have hridx : r.castSucc = (⟨H.dividerCount, by omega⟩ : + Fin (H.dividerCount + 2)) := by + apply Fin.ext + rfl + have hend : (⟨H.dividerCount + 1, by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := hlast + have hAstage : H.stage r.castSucc = + H.stage ⟨H.dividerCount, by omega⟩ := by + rw [hridx] + have hUstage : H.stage ⟨H.dividerCount + 1, by omega⟩ = U := by + rw [hend, H.terminalStage] + rw [hUstage] at hseg + simpa [hAstage] using hseg + simpa [hstarPositive] using hseg' + +private theorem helper_hstrictA_584.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (U : TreeSequence G e0) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corrU.replacementETT phi), + baseU.core = base.core → + ∀ (H : TashkinovHierarchy corrU.replacementETT baseU), + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.core.length < U.length) ∧ + (¬ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < U.length) → + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H lastH; + let _ : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + A.length < U.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base U corrU baseU hcore H hstrict lastH A Tn + by_cases hd : H.dividerCount = 0 + · have hstar : A = baseU.core := by + dsimp [A, HierarchyStarredStage] + have hl : lastH = (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [lastH, hd] + rw [hl] + rfl + by_cases hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · have h := hstrict.1 hPE + rw [hstar, hcore] + exact h + · have hcoreOrig : base.core = Tn := base.nonparallel hPE + have hAeq : A = Tn := hstar.trans (hcore.trans hcoreOrig) + have h := hstrict.2 hPE + simpa [hAeq] using h + · let r : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + have hs := H.strict r + have hstarPositive : A = H.stage r.castSucc := by + have starPositive : ∀ j : Fin (H.dividerCount + 1), 0 < j.val → + HierarchyStarredStage H j = H.stage j.castSucc := by + intro j + refine Fin.cases ?_ ?_ j + · intro hj + simp at hj + · intro i hj + rfl + simpa [A, r] using starPositive r (by + dsimp [r] + have : 0 < H.dividerCount := Nat.pos_of_ne_zero hd + exact this) + have hend : r.succ = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [r] + have hnext : H.stage r.succ = U := by + rw [hend] + exact H.terminalStage + simpa [hstarPositive, hnext] using hs + +private theorem helper_branch_733.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + TechnicalInductionContext G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi), + MaximumDegree G + (1 : ℕ) ≤ k → + ∀ (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + MaximumProperty corrU.replacementETT → + ∀ (baseU : HierarchyBase corrU.replacementETT phi), + baseU.core = base.core → + ∀ (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : GoodHierarchy H), + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H lastH; + corrU.replacementETT.series.data.coloring (Fin.last corrU.replacementETT.rounds) = phi → + corrU.replacementETT.series.data.kind (Fin.last corrU.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) → + IsProperEdgeColoring G phi → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have hn : (1 : ℕ) ≤ ett.rounds := ett.roundsPositive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet Tn) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) → + H.dividerCount = (0 : ℕ) → + Odd (TreeSequenceVertexSet A).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx base hdegree U corrU hMPU baseU hcore H good lastH + A hfinalColor hkindReplacement hproper q hqterminal Tn hpreElem helemA hd + have hstar : A = baseU.core := by + dsimp [A, HierarchyStarredStage] + have hl : lastH = (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [lastH, hd] + rw [hl] + rfl + by_cases hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · have hPEU : corrU.replacementETT.series.data.kind + (Fin.last corrU.replacementETT.rounds) = + some TashkinovExtensionKind.PE := by + rw [hkindReplacement] + exact hPE + let ctxU : TechnicalInductionContext G k e0 + corrU.replacementETT.rounds := + corrU.rungAgreement.symm ▸ ctx + have hcommon : TreeColorSetClosed G phi baseU.core + (TreeMissingColors phi + (corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc) ∩ + TreeMissingColors phi baseU.closure) := + ParallelCommonMissingClosed G k e0 corrU.replacementInput U phi phi + corrU.replacementETT corrU.replacementETT.roundsPositive baseU + hfinalColor.symm hPEU + (P2634_T1_PredecessorElementary G k e0 corrU.replacementInput U + phi corrU.replacementETT ctxU hMPU) + let Tnu : TreeSequence G e0 := + corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc + let Rzero : Finset (Fin k) := + (HierarchyStoredColorsAt H 0).biUnion (good.gamma 0) + have hfour : 4 ≤ + ((TreeMissingColors phi Tnu ∩ TreeMissingColors phi baseU.closure) + \ Rzero).card := by + simpa [Tnu, Rzero] using (good.parallelBase hPEU).2 + obtain ⟨alpha, halpha⟩ := Finset.card_pos.mp (by omega : + 0 < ((TreeMissingColors phi Tnu ∩ + TreeMissingColors phi baseU.closure) \ Rzero).card) + have hparts := Finset.mem_sdiff.mp halpha + have hcommonMem := Finset.mem_inter.mp hparts.1 + have hmissingCore : alpha ∈ TreeMissingColors phi baseU.core := by + unfold TreeMissingColors + obtain ⟨ou⟩ := (baseU.parallel hPEU).2.2 + rw [ou.vertexSet] + obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hcommonMem.1 + exact Finset.mem_biUnion.mpr + ⟨v, Finset.mem_union_left _ hv, hmiss⟩ + have hclosedCore := hcommon alpha (Finset.mem_inter.mpr hcommonMem) + have hmissingA : alpha ∈ TreeMissingColors phi A := by + simpa [hstar] using hmissingCore + have hclosedA : TreeColorSetClosed G phi A {alpha} := by + intro c hc + have hca : c = alpha := Finset.mem_singleton.mp hc + subst c + simpa [hstar] using hclosedCore + exact ElementaryClosedMissingColorOdd G k e0 phi A alpha + hproper helemA hmissingA hclosedA + · have hcoreOrig : base.core = Tn := base.nonparallel hPE + have hAeq : A = Tn := hstar.trans (hcore.trans hcoreOrig) + have hprevFacts : + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) ∧ + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet Tn) := by + generalize htarget : q.succ = target + cases ett.series.certified target with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + have htree : ett.series.data.tree q.succ.castSucc = Tn := by + rw [hqterminal] + exact ⟨previousProper, by rw [← htree]; exact previousClosed⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + have hk : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE := by + simpa [hqterminal] using currentKind + exact (hPE hk).elim + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + have htree : ett.series.data.tree q.succ.castSucc = Tn := by + rw [hqterminal] + exact ⟨previousProper, by rw [← htree]; exact previousClosed⟩ + have hvertex : (TreeSequenceVertexSet Tn).Nonempty := by + refine ⟨Tn.vertex 0, ?_⟩ + simp [TreeSequenceVertexSet] + obtain ⟨v, hv⟩ := hvertex + obtain ⟨alpha, hmiss⟩ := + MissingColorsNonemptyOfMaximumDegree G + (ett.series.data.coloring q.castSucc) hdegree v + have hclosedAlpha : TreeColorSetClosed G + (ett.series.data.coloring q.castSucc) Tn {alpha} := by + intro c hc + have hca : c = alpha := Finset.mem_singleton.mp hc + subst c + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + have hfc : f ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) ∧ + (ett.series.data.coloring q.castSucc) f = some alpha := by + simpa [BoundaryColorEdges] using hf + exact (hprevFacts.2 hfc.1 hv hfc.2) hmiss + have hmissTree : alpha ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) Tn := + Finset.mem_biUnion.mpr ⟨v, hv, hmiss⟩ + have hodd := ElementaryClosedMissingColorOdd G k e0 + (ett.series.data.coloring q.castSucc) Tn alpha hprevFacts.1 + hpreElem hmissTree hclosedAlpha + simpa [hAeq] using hodd + +private theorem helper_branch_873.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = ett.rounds → + MaximumProperty current → + ∀ (base' : HierarchyBase current generating') + (K : TashkinovHierarchy current base') (_ : GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + (2 : ℕ) * current.rounds + (11 : ℕ) ≤ + (TreeMissingColors generating' Tn).card) → + ∀ (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + MaximumProperty corrU.replacementETT → + ∀ (baseU : HierarchyBase corrU.replacementETT phi) + (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : GoodHierarchy H), + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H lastH; + IsProperEdgeColoring G phi → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) → + ¬H.dividerCount = (0 : ℕ) → + Odd (TreeSequenceVertexSet A).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hmissingBound U corrU hMPU baseU H good lastH A + hproper helemA hd + let r : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + have hstarPositive : A = H.stage r.castSucc := by + have starPositive : ∀ j : Fin (H.dividerCount + 1), 0 < j.val → + HierarchyStarredStage H j = H.stage j.castSucc := by + intro j + refine Fin.cases ?_ ?_ j + · intro hj + simp at hj + · intro i hj + rfl + simpa [A, r] using starPositive r (by + dsimp [r] + have : 0 < H.dividerCount := Nat.pos_of_ne_zero hd + exact this) + obtain ⟨ep, epMP, epRound, epSeries, bp, bpCore, bpClosure, + bpSupport, HP, hpCount, hpStages, hpDividers, gp, hpData, + hminusPrefix⟩ := + GoodHierarchyPrefixRepackage G k e0 corrU.replacementInput U phi phi + corrU.replacementETT hMPU baseU H good r (by + dsimp [r] + omega) + let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + let R : Finset (Fin k) := + (HierarchyStoredColorsAt H r).biUnion (good.gamma i.castSucc) + have hir : i.succ = r := by + apply Fin.ext + simp [i, r] + omega + have hDsubset : HierarchyStoredColorsAt H r ⊆ + HierarchyStoredColorsAt H i.castSucc := by + rw [← hir] + exact HierarchyStoredColorsAntitone H i + have hDcard : (HierarchyStoredColorsAt H r).card ≤ ett.rounds := by + have h := HierarchyStoredColorsCardinality H r + rw [← corrU.rungAgreement] + exact h + have hRcard : R.card ≤ 2 * ett.rounds := by + calc + R.card ≤ ∑ eta ∈ HierarchyStoredColorsAt H r, + (good.gamma i.castSucc eta).card := Finset.card_biUnion_le + _ = 2 * (HierarchyStoredColorsAt H r).card := by + calc + (∑ eta ∈ HierarchyStoredColorsAt H r, + (good.gamma i.castSucc eta).card) = + ∑ eta ∈ HierarchyStoredColorsAt H r, 2 := by + apply Finset.sum_congr rfl + intro eta heta + exact good.twoColors i.castSucc eta (hDsubset heta) + _ = 2 * (HierarchyStoredColorsAt H r).card := by + simp [Nat.mul_comm] + _ ≤ 2 * ett.rounds := Nat.mul_le_mul_left 2 hDcard + have hlargeL := hmissingBound ep + (epRound.trans corrU.rungAgreement) epMP bp HP gp + have hprefixSegment : TreeSequenceInitialSegment + (ep.series.data.tree (Fin.last ep.rounds).castSucc) A := by + have hidx : (Fin.last ep.rounds).castSucc = + (⟨ep.rounds, by omega⟩ : Fin (ep.rounds + 2)) := by + apply Fin.ext + rfl + rw [hidx, hstarPositive] + exact ep.abovePenultimate + have hmissSubset : + TreeMissingColors phi + (ep.series.data.tree (Fin.last ep.rounds).castSucc) ⊆ + TreeMissingColors phi A := by + intro c hc + unfold TreeMissingColors at hc ⊢ + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hprefixSegment hv, hcv⟩ + have hlargeA : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi A).card := by + have hlargeL' : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ep.series.data.tree (Fin.last ep.rounds).castSucc)).card := by + rw [← corrU.rungAgreement, ← epRound] + exact hlargeL + exact le_trans hlargeL' (Finset.card_le_card hmissSubset) + have hInter : + (TreeMissingColors phi A ∩ R).card ≤ R.card := + Finset.card_le_card Finset.inter_subset_right + have hInterBound : (TreeMissingColors phi A ∩ R).card ≤ + 2 * ett.rounds := le_trans hInter hRcard + have hInterBound' : (R ∩ TreeMissingColors phi A).card ≤ + 2 * ett.rounds := by + simpa [Finset.inter_comm] using hInterBound + have hdiff : 11 ≤ (TreeMissingColors phi A \ R).card := by + rw [Finset.card_sdiff] + omega + obtain ⟨alpha, halpha⟩ := Finset.card_pos.mp (by omega : + 0 < (TreeMissingColors phi A \ R).card) + have hmissingA : alpha ∈ TreeMissingColors phi A := + (Finset.mem_sdiff.mp halpha).1 + have hiGamma : (⟨r.val - 1, by omega⟩ : Fin (H.dividerCount + 1)) = + i.castSucc := by + apply Fin.ext + simp [r, i] + have hminusA : TreeColorSetMinusClosed G phi A R := by + simpa [R, hstarPositive, hiGamma] using hminusPrefix + have hclosedAlpha : TreeColorSetClosed G phi A {alpha} := by + intro c hc + have hca : c = alpha := Finset.mem_singleton.mp hc + subst c + exact hminusA alpha halpha + exact ElementaryClosedMissingColorOdd G k e0 phi A alpha + hproper helemA hmissingA hclosedAlpha + +private theorem helper_hoddA_624.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + TechnicalInductionContext G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi), + MaximumDegree G + (1 : ℕ) ≤ k → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = ett.rounds → + MaximumProperty current → + ∀ (base' : HierarchyBase current generating') + (K : TashkinovHierarchy current base') (_ : GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + (2 : ℕ) * current.rounds + (11 : ℕ) ≤ + (TreeMissingColors generating' Tn).card) → + ∀ (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + MaximumProperty corrU.replacementETT → + ∀ (baseU : HierarchyBase corrU.replacementETT phi), + baseU.core = base.core → + ∀ (H : TashkinovHierarchy corrU.replacementETT baseU) (_ : GoodHierarchy H), + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H lastH; + corrU.replacementETT.series.data.coloring (Fin.last corrU.replacementETT.rounds) = phi → + corrU.replacementETT.series.data.kind (Fin.last corrU.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) → + IsProperEdgeColoring G phi → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have hn : (1 : ℕ) ≤ ett.rounds := ett.roundsPositive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ColoredVertexSetElementary G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet Tn) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) → + Odd (TreeSequenceVertexSet A).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx base hdegree hmissingBound U corrU hMPU baseU + hcore H good lastH A hfinalColor hkindReplacement hproper q hqterminal Tn hpreElem helemA + by_cases hd : H.dividerCount = 0 + · exact @helper_branch_733 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett ctx base hdegree U corrU hMPU baseU hcore H good hfinalColor + hkindReplacement hproper hqterminal hpreElem helemA hd + · exact @helper_branch_873 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett hmissingBound U corrU hMPU baseU H good hproper helemA hd +private theorem helper_hkindReplacement_1362.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + (∀ {m n : ℕ} {psi : PartialEdgeColoring E k} (s : TashkinovSeries G k m e0 psi) + (t : TashkinovSeries G k n e0 psi) (h : m = n), + s ≍ t → + ∀ (j : Fin (m + (1 : ℕ))), + s.data.kind j = t.data.kind (Fin.cast (congrArg Nat.succ h) j)) → + corrU.replacementETT.series.data.kind (Fin.last corrU.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) := by + classical + intro V E _ _ _ G k e0 input T phi ett U corrU kindOfSeriesEq + calc + corrU.replacementETT.series.data.kind + (Fin.last corrU.replacementETT.rounds) = + corrU.replacementSeries.data.kind (Fin.last ett.rounds) := + kindOfSeriesEq corrU.replacementETT.series corrU.replacementSeries + corrU.rungAgreement corrU.seriesPresentation + (Fin.last corrU.replacementETT.rounds) |>.trans (by + congr 1 + apply Fin.ext + simp) + _ = ett.series.data.kind (Fin.last ett.rounds) := + corrU.extensionKindsAgree (Fin.last ett.rounds) + +private theorem helper_stageSegment_1552.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corrU.replacementETT phi) + (H : TashkinovHierarchy corrU.replacementETT baseU), + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = corrU.replacementETT.rounds → + MaximumProperty current → + ∀ (x : HierarchyBase current generating') (x_1 : TashkinovHierarchy current x) + (_ : GoodHierarchy x_1), + (2 : ℕ) * current.rounds + (11 : ℕ) ≤ + (TreeMissingColors generating' + (current.series.data.tree (Fin.last current.rounds).castSucc)).card) → + (∀ (X : TreeSequence G e0), TreeSequenceInitialSegment X X) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, + Decidable.byContradiction fun (a_1 : ¬a < H.dividerCount + (2 : ℕ)) ↦ by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, + Decidable.byContradiction fun (a_1 : ¬a + d < H.dividerCount + (2 : ℕ)) ↦ by + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett U corrU baseU H hbound segmentRefl segmentTrans a d + induction d with + | zero => + intro hbound + simpa using segmentRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + intro hbound + have hprev := ih (by omega) + have hnext := H.nested ⟨a + d, by omega⟩ + have hnext' : TreeSequenceInitialSegment + (H.stage ⟨a + d, by omega⟩) + (H.stage ⟨a + (d + 1), by omega⟩) := by + simpa [Nat.add_assoc] using hnext + exact segmentTrans hprev hnext' + +private theorem helper_hRplus_1583.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corrU.replacementETT phi) + (H : TashkinovHierarchy corrU.replacementETT baseU) (good : GoodHierarchy H), + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let Dplus : Finset (Fin k) := HierarchyTerminalStoredColors H; + Dplus ⊆ HierarchyStoredColorsAt H lastH → + (HierarchyStoredColorsAt H lastH).card ≤ ett.rounds → + let Rplus : Finset (Fin k) := Dplus.biUnion (good.gamma lastH); + Rplus.card ≤ (2 : ℕ) * ett.rounds := by + classical + intro V E _ _ _ _ G k e0 input T phi ett U corrU baseU H good lastH Dplus hDsubset hDcard Rplus + calc + Rplus.card ≤ ∑ eta ∈ Dplus, (good.gamma lastH eta).card := + Finset.card_biUnion_le + _ = 2 * Dplus.card := by + calc + (∑ eta ∈ Dplus, (good.gamma lastH eta).card) = + ∑ eta ∈ Dplus, 2 := by + apply Finset.sum_congr rfl + intro eta heta + exact good.twoColors lastH eta (hDsubset heta) + _ = 2 * Dplus.card := by simp [Nat.mul_comm] + _ ≤ 2 * ett.rounds := Nat.mul_le_mul_left 2 + (le_trans (Finset.card_le_card hDsubset) hDcard) + +private theorem helper_continuation_1569.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + TechnicalInductionContext G k e0 ett.rounds → + MaximumProperty ett → + ∀ (base : HierarchyBase ett phi), + MaximumDegree G + (1 : ℕ) ≤ k → + (11 : ℕ) ≤ TashkinovOrder G → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = ett.rounds → + MaximumProperty current → + ∀ (base' : HierarchyBase current generating') + (K : TashkinovHierarchy current base') (_ : GoodHierarchy K), + let n : Fin (current.rounds + (1 : ℕ)) := Fin.last current.rounds; + let Tn : TreeSequence G e0 := current.series.data.tree n.castSucc; + (2 : ℕ) * current.rounds + (11 : ℕ) ≤ + (TreeMissingColors generating' Tn).card) → + ∀ (U : TreeSequence G e0) (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U), + MaximumProperty corrU.replacementETT → + ∀ (baseU : HierarchyBase corrU.replacementETT phi), + baseU.core = base.core → + ∀ (H : TashkinovHierarchy corrU.replacementETT baseU) (good : GoodHierarchy H), + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + base.core.length < U.length) ∧ + (¬ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < U.length) → + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let _ : TreeSequence G e0 := HierarchyStarredStage H lastH; + let _ : Finset (Fin k) := HierarchyTerminalStoredColors H; + (∀ {m n : ℕ} {psi : PartialEdgeColoring E k} (s : TashkinovSeries G k m e0 psi) + (t : TashkinovSeries G k n e0 psi) (h : m = n), + s ≍ t → + ∀ (j : Fin (m + (2 : ℕ))), + s.data.tree j = + t.data.tree (Fin.cast (congrArg (fun (a : ℕ) ↦ a + (2 : ℕ)) h) j)) → + corrU.replacementETT.series.data.coloring (Fin.last corrU.replacementETT.rounds) = phi → + corrU.replacementETT.series.data.kind (Fin.last corrU.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) → + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + (0 : ℕ) < lower.rounds → + lower.rounds < corrU.replacementETT.rounds → + MaximumProperty lower → (open scoped Classical in LowerRoundProperties lower)) → + let lastH : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H lastH; + IsProperEdgeColoring G phi ∧ + IsOneEdgeUncolored phi e0 ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) ∧ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet U) ∧ + TreeSequenceInitialSegment A U ∧ + A.length < U.length ∧ + Odd (TreeSequenceVertexSet A).card ∧ + ((HierarchyTerminalStoredColors H).biUnion (good.gamma lastH)).card < + (TreeMissingColors phi U).card := by + classical + intro V E _ _ _ _ G k e0 input T phi ett ctx hMP base hdegree hlargeOrder hmissingBound U corrU + hMPU baseU hcore H good hstrict lastH A Dplus treeOfSeriesEq hfinalColor hkindReplacement + hproper hone hlower + have hcurrent := fun {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (hround : current.rounds = corrU.replacementETT.rounds) + (hmaximum : MaximumProperty current) => + And.intro + (ctx.currentThree current (hround.trans corrU.rungAgreement) hmaximum) + (And.intro + (ctx.currentFour current (hround.trans corrU.rungAgreement) hmaximum) + (And.intro + (ctx.currentFive current (hround.trans corrU.rungAgreement) hmaximum) + (ctx.currentSix current (hround.trans corrU.rungAgreement) hmaximum))) + have hbound := fun {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (hround : current.rounds = corrU.replacementETT.rounds) + (hmaximum : MaximumProperty current) + (_ : HierarchyBase current generating') + (_ : TashkinovHierarchy current ‹HierarchyBase current generating'›) + (_ : GoodHierarchy ‹TashkinovHierarchy current + ‹HierarchyBase current generating'››) => by + have hround' : current.rounds = ett.rounds := hround.trans corrU.rungAgreement + let currentCtx : TechnicalInductionContext G k e0 current.rounds := + hround'.symm ▸ ctx + exact TechnicalCurrentLadderMissingBoundLarge G k e0 input' T' + generating' current hmaximum currentCtx hdegree hlargeOrder + have hUelem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet U) := + GoodHierarchyElementaryLarge G k e0 corrU.replacementInput U phi + corrU.replacementETT hMPU baseU H good hlower hcurrent hlargeOrder hbound + let q : Fin ett.rounds := ⟨ett.rounds - 1, by + have hn := ett.roundsPositive + omega⟩ + have hqterminal : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + have hn := ett.roundsPositive + omega + let Tn : TreeSequence G e0 := + ett.series.data.tree (Fin.last ett.rounds).castSucc + have hpreElem : ColoredVertexSetElementary G + (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet Tn) := by + intro u hu v hv huv + exact P2634_T1_PredecessorElementary G k e0 input T phi ett ctx hMP + (u := u) hu hv huv + have htermStable := corrU.replacementStable q + have htermMissing := @helper_htermMissing_298 V E inferInstance inferInstance inferInstance G k e0 + input T phi ett U corrU hcurrent hqterminal htermStable + have helemA := @helper_helemA_372 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base hlargeOrder hmissingBound U corrU hMPU baseU hcore H good + hkindReplacement hlower hcurrent hUelem hpreElem htermMissing + have segmentRefl (X : TreeSequence G e0) : TreeSequenceInitialSegment X X := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + rcases hXY with ⟨hxy, hvxy, hexy⟩ + rcases hYZ with ⟨hyz, hvyz, heyz⟩ + refine ⟨le_trans hxy hyz, ?_, ?_⟩ + · intro i + have hmid := hvyz (Fin.castLE (Nat.succ_le_succ hxy) i) + simpa using hmid.trans (hvxy i) + · intro i + have hmid := heyz (Fin.castLE hxy i) + simpa using hmid.trans (hexy i) + have stageSegment := @helper_stageSegment_1552 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett U corrU baseU H hbound segmentRefl segmentTrans + have hAU := @helper_hAU_497 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base U corrU baseU hcore H treeOfSeriesEq hqterminal stageSegment + have hstrictA := @helper_hstrictA_584 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base U corrU baseU hcore H hstrict + have hoddA := @helper_hoddA_624 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett ctx base hdegree hmissingBound U corrU hMPU baseU hcore H good hfinalColor + hkindReplacement hproper hqterminal hpreElem helemA + have hDsubset : Dplus ⊆ HierarchyStoredColorsAt H lastH := + (HierarchyTerminalStoredColorsSubsetLast H).1 + have hDcard : (HierarchyStoredColorsAt H lastH).card ≤ ett.rounds := by + have h := HierarchyStoredColorsCardinality H lastH + rw [← corrU.rungAgreement] + exact h + let Rplus : Finset (Fin k) := Dplus.biUnion (good.gamma lastH) + have hRplus := @helper_hRplus_1583 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett U corrU baseU H good hDsubset hDcard + have hlargeFinal := hmissingBound corrU.replacementETT + corrU.rungAgreement hMPU baseU H good + have hlastIntoU : TreeSequenceInitialSegment + (corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc) U := + corrU.replacementETT.abovePenultimate + have hmissingIntoU : TreeMissingColors phi + (corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc) ⊆ + TreeMissingColors phi U := by + intro c hc + unfold TreeMissingColors at hc ⊢ + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hlastIntoU hv, hcv⟩ + have hlargeU : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi U).card := by + have hlargeFinal' : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc)).card := by + rw [← corrU.rungAgreement] + exact hlargeFinal + exact le_trans hlargeFinal' (Finset.card_le_card hmissingIntoU) + refine ⟨hproper, hone, helemA, hUelem, hAU, hstrictA, hoddA, ?_⟩ + calc + (Dplus.biUnion (good.gamma lastH)).card ≤ 2 * ett.rounds := by + simpa [Rplus] using hRplus + _ < (TreeMissingColors phi U).card := by omega + +theorem P2940_T1_StarredPrefixPreparation + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (ctx : TechnicalInductionContext G k e0 ett.rounds) + (hMP : MaximumProperty ett) (base : HierarchyBase ett phi) + (hdegree : MaximumDegree G + 1 <= k) + (hlargeOrder : 11 <= TashkinovOrder G) + (hmissingBound : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating'), + current.rounds = ett.rounds -> MaximumProperty current -> + forall (base' : HierarchyBase current generating') + (K : TashkinovHierarchy current base'), GoodHierarchy K -> + let n : Fin (current.rounds + 1) := Fin.last current.rounds + let Tn := current.series.data.tree n.castSucc + 2 * current.rounds + 11 <= (TreeMissingColors generating' Tn).card) + (U : TreeSequence G e0) + (corrU : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (hMPU : MaximumProperty corrU.replacementETT) + (baseU : HierarchyBase corrU.replacementETT phi) + (hcore : baseU.core = base.core) + (H : TashkinovHierarchy corrU.replacementETT baseU) + (good : GoodHierarchy H) + (hstrict : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE -> base.core.length < U.length) /\ + (Not (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) -> + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < U.length)) : + let lastH : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A := HierarchyStarredStage H lastH + IsProperEdgeColoring G phi /\ IsOneEdgeUncolored phi e0 /\ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) /\ + ColoredVertexSetElementary G phi (TreeSequenceVertexSet U) /\ + TreeSequenceInitialSegment A U /\ A.length < U.length /\ + Odd (TreeSequenceVertexSet A).card /\ + ((HierarchyTerminalStoredColors H).biUnion (good.gamma lastH)).card < + (TreeMissingColors phi U).card := by + classical + let lastH : Fin (H.dividerCount + 1) := Fin.last H.dividerCount + let A : TreeSequence G e0 := HierarchyStarredStage H lastH + let Dplus := HierarchyTerminalStoredColors H + have treeOfSeriesEq {m n : ℕ} {psi : PartialEdgeColoring E k} + (s : TashkinovSeries G k m e0 psi) + (t : TashkinovSeries G k n e0 psi) + (h : m = n) (hs : HEq s t) (j : Fin (m + 2)) : + s.data.tree j = t.data.tree (Fin.cast (congrArg (fun a => a + 2) h) j) := by + cases h + cases hs + rfl + have coloringOfSeriesEq {m n : ℕ} {psi : PartialEdgeColoring E k} + (s : TashkinovSeries G k m e0 psi) + (t : TashkinovSeries G k n e0 psi) + (h : m = n) (hs : HEq s t) (j : Fin (m + 1)) : + s.data.coloring j = t.data.coloring (Fin.cast (congrArg Nat.succ h) j) := by + cases h + cases hs + rfl + have kindOfSeriesEq {m n : ℕ} {psi : PartialEdgeColoring E k} + (s : TashkinovSeries G k m e0 psi) + (t : TashkinovSeries G k n e0 psi) + (h : m = n) (hs : HEq s t) (j : Fin (m + 1)) : + s.data.kind j = t.data.kind (Fin.cast (congrArg Nat.succ h) j) := by + cases h + cases hs + rfl + have hfinalColor : + corrU.replacementETT.series.data.coloring + (Fin.last corrU.replacementETT.rounds) = phi := by + have hc := coloringOfSeriesEq corrU.replacementETT.series + corrU.replacementSeries corrU.rungAgreement corrU.seriesPresentation + (Fin.last corrU.replacementETT.rounds) + have hi : Fin.cast (congrArg Nat.succ corrU.rungAgreement) + (Fin.last corrU.replacementETT.rounds) = Fin.last ett.rounds := by + apply Fin.ext + simp + rw [hi] at hc + exact hc.trans corrU.finalGeneratingColoring.symm + have hcolorOriginal : + corrU.replacementETT.series.data.coloring + (Fin.last corrU.replacementETT.rounds) = + corrU.replacementSeries.data.coloring (Fin.last ett.rounds) := by + exact coloringOfSeriesEq corrU.replacementETT.series + corrU.replacementSeries corrU.rungAgreement corrU.seriesPresentation + (Fin.last corrU.replacementETT.rounds) |>.trans (by + congr 1 + apply Fin.ext + simp) + have hkindReplacement := @helper_hkindReplacement_1362 V E inferInstance inferInstance + inferInstance G k e0 input T phi ett U corrU kindOfSeriesEq + have hproper : IsProperEdgeColoring G phi := by + rw [← hfinalColor] + rw [hcolorOriginal] + exact corrU.replacementProper (Fin.last ett.rounds) + have hone : IsOneEdgeUncolored phi e0 := by + rw [← hfinalColor] + rw [hcolorOriginal] + exact corrU.replacementOneUncolored (Fin.last ett.rounds) + have hlower : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < lower.rounds -> lower.rounds < corrU.replacementETT.rounds -> + MaximumProperty lower -> + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T') ∧ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tnext := lower.series.data.tree (Fin.last (lower.rounds + 1)) + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tnext (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma -> + forall alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma Tnext ∨ + beta ∈ TreeMissingColors sigma Tnext) -> + TreeInterchangeable G Tnext sigma alpha beta) ∧ + ((forall (q : Fin lower.rounds) (v : V), + lower.series.data.kind q.succ = some TashkinovExtensionKind.PE -> + lower.series.data.chosenVertex q.succ = some v -> + forall hvFinal : v ∈ TreeSequenceVertexSet T', + forall j : Fin (lower.rounds + 1), + ETTFirstAppearanceIndex lower v hvFinal = j.val + 1 -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring (lower.series.data.tree q.succ.castSucc) + (TashkinovStoredColors lower.series.data q.succ) + (lower.series.data.coloring q.succ) sigma -> + StableColoringBeforeVertex T' v hvFinal + (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma ∧ + (0 < j.val -> StableColoring (lower.series.data.tree j.castSucc) + (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma)) ∧ + forall (q r : Fin lower.rounds) (vq vr : V), + q ≠ r -> vq ≠ vr -> + lower.series.data.kind q.succ = some TashkinovExtensionKind.PE -> + lower.series.data.kind r.succ = some TashkinovExtensionKind.PE -> + lower.series.data.chosenVertex q.succ = some vq -> + lower.series.data.chosenVertex r.succ = some vr -> + forall (hvq : vq ∈ TreeSequenceVertexSet T') + (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex lower vq hvq = + ETTFirstAppearanceIndex lower vr hvr -> + Disjoint (lower.series.data.stored q.succ) + (lower.series.data.stored r.succ)) ∧ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn := lower.series.data.tree n.castSucc + forall (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE -> + lower.series.data.chosenVertex n = some v -> + lower.series.data.gamma n = some gamma -> + lower.series.data.delta n = some delta -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma -> + forall w, w ∈ TreeSequenceVertexSet Tn -> + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ + w = v)) ∧ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn := lower.series.data.tree n.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma -> + forall delta : Fin k, + DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta -> + forall v : V, + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tn) delta v -> + (exists w, BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tn) delta w ∧ TreeVertexOrder Tn w v) -> + forall (hvFinal : v ∈ TreeSequenceVertexSet T') + (q : Fin lower.rounds) (vi : V), + (lower.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ + lower.series.data.kind q.succ = + some TashkinovExtensionKind.SE) -> + lower.series.data.chosenVertex q.succ = some vi -> + ETTFirstAppearanceIndex lower v hvFinal ≤ q.val + 1 -> + v = vi ∨ TreeVertexOrder T' v vi) ∧ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn := lower.series.data.tree n.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tn (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma -> + ModColoring lower sigma) := by + intro input' T' generating' lower hpositive hround hmaximum + have hround' : lower.rounds < ett.rounds := by + simpa [corrU.rungAgreement] using hround + exact ⟨ctx.lowerOne lower hpositive hround' hmaximum, + ctx.lowerTwo lower hpositive hround' hmaximum, + ctx.lowerThree lower hpositive hround' hmaximum, + ctx.lowerFour lower hpositive hround' hmaximum, + ctx.lowerFive lower hpositive hround' hmaximum, + ctx.lowerSix lower hpositive hround' hmaximum⟩ + exact @helper_continuation_1569 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett ctx hMP base hdegree hlargeOrder hmissingBound U corrU hMPU baseU hcore + H good hstrict treeOfSeriesEq hfinalColor hkindReplacement hproper hone hlower +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseOneInsidePositiveDivider.lean b/LeanPool/GoldbergSeymour/Step1CaseOneInsidePositiveDivider.lean new file mode 100644 index 0000000000..8fe5ce9cfb --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseOneInsidePositiveDivider.lean @@ -0,0 +1,191 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint + +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone + +public import LeanPool.GoldbergSeymour.ParallelInterchangeability + +public import LeanPool.GoldbergSeymour.OutsideExitTransport +public import LeanPool.GoldbergSeymour.PositivePrefixPresentation + +/-! +# Step1Case One Inside Positive Divider + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1CaseOneInsidePositiveDivider {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (_ : H.dividerCount < q) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (_ : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (_ : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (_ : beta ∈ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hpaths : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (ha : a₁ ≠ a₂) (_ : b₁ ≠ b₂) + (horder : TreeVertexOrder T b₁ b₂) + (f₁ f₂ : E) + (_ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : Incident G b₁ f₁) (_ : Incident G b₂ f₂) + (_ : Sum.inr f₁ ∈ P₁.support) + (_ : Sum.inr f₂ ∈ P₂.support) + (hinside : b₂ ∈ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (theta : Fin k) (hthetaAlpha : theta ≠ alpha) + (hthetaBeta : theta ≠ beta) + (hthetaMissing : theta ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hthetaClosedStar : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {theta}) + (hthetaClosed : TreeColorSetClosed G phi T {theta}) + (hnoSmaller : + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount < H.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' {a} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → False) + (hdividerPositive : 0 < H.dividerCount) : False := by + classical + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + have starPositive : ∀ j : Fin (H.dividerCount + 1), 0 < j.val → + HierarchyStarredStage H j = H.stage j.castSucc := by + intro j + refine Fin.cases ?_ ?_ j + · intro hj + simp at hj + · intro i hj + rfl + let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hstar : A = H.stage ⟨i.val + 1, by omega⟩ := by + rw [show A = H.stage (Fin.last H.dividerCount).castSucc from + starPositive _ (by simpa using hdividerPositive)] + congr 1 + apply Fin.ext + dsimp [i] + omega + have hAT : TreeSequenceInitialSegment A T := by + rw [hstar, H.dividerStage i] + exact ⟨_, fun j => rfl, fun j => rfl⟩ + have hA : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T := + TreeSequenceInitialSegmentVertexSetSubset hAT + have hb₁A : b₁ ∈ TreeSequenceVertexSet A := by + as_aux_lemma => + obtain ⟨r, s, hr, hs, hrs⟩ := horder + obtain ⟨t, ht⟩ : ∃ t : Fin (A.length + 1), A.vertex t = b₂ := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + using hinside + have hst : s = Fin.castLE (Nat.succ_le_succ hAT.1) t := + T.vertex_injective (hs.trans ((hAT.2.1 t).trans ht).symm) + have hrA : r.val < A.length + 1 := by + have htlt := t.isLt + have hval := congrArg Fin.val hst + simp only [Fin.val_castLE] at hval + omega + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨⟨r.val, hrA⟩, ?_⟩ + exact (hAT.2.1 ⟨r.val, hrA⟩).symm.trans hr + obtain ⟨sigma, recolor, proper, one, subsetData, outsideMissing, exitTransport⟩ := + P2716_T1_OutsideExitTransport G T phi alpha theta beta hthetaAlpha.symm + hne hthetaBeta hproper hone hclosed hthetaClosed + obtain ⟨Q₁, hQ₁, support₁, length₁⟩ := + exitTransport A hA a₁ b₁ P₁ hP₁ hb₁A + obtain ⟨Q₂, hQ₂, support₂, length₂⟩ := + exitTransport A hA a₂ b₂ P₂ hP₂ hinside + obtain ⟨corr, mp, basePrefix, K, goodPrefix, count, large, minus⟩ := + P2716_T1_PositivePrefixPresentation G k e0 input T phi sigma ett hMP + hpositive hproper hone hlower base H good hlarge alpha theta recolor hdividerPositive + have ladderInside : TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ⊆ TreeSequenceVertexSet T := + TreeSequenceInitialSegmentVertexSetSubset ett.abovePenultimate + have ladderStable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma := + (subsetData _ ladderInside).1 _ + have thetaMissing : theta ∈ TreeMissingColors sigma A := by + rw [(subsetData A hA).2.1] + exact hthetaMissing + have thetaClosed : TreeColorSetClosed G sigma A {theta} := + (subsetData A hA).2.2 theta hthetaClosedStar + have supports : ∀ x, x ∈ Q₁.support → x ∉ Q₂.support := by + rw [support₁, support₂] + exact hpaths + exact hnoSmaller sigma A corr proper one ladderStable mp basePrefix K goodPrefix + (by omega) large minus theta beta hthetaBeta thetaMissing thetaClosed + a₁ b₁ a₂ b₂ Q₁ Q₂ hQ₁ hQ₂ supports ha + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseOneInsideStar.lean b/LeanPool/GoldbergSeymour/Step1CaseOneInsideStar.lean new file mode 100644 index 0000000000..0860745f4e --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseOneInsideStar.lean @@ -0,0 +1,208 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.Step1CaseOneInsidePositiveDivider +public import LeanPool.GoldbergSeymour.Step1CaseOneInsideZeroNonPE +public import LeanPool.GoldbergSeymour.Step1CaseOneInsideZeroPE + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Step1Case One Inside Star + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1CaseOneInsideStar {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (hdivider : H.dividerCount < q) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (hterminal : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (hElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (halpha : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (hbeta : beta ∈ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hpaths : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (ha : a₁ ≠ a₂) (hb : b₁ ≠ b₂) + (horder : TreeVertexOrder T b₁ b₂) + (f₁ f₂ : E) + (hf₁ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₂ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hif₁ : Incident G b₁ f₁) (hif₂ : Incident G b₂ f₂) + (hPf₁ : Sum.inr f₁ ∈ P₁.support) + (hPf₂ : Sum.inr f₂ ∈ P₂.support) + (hinside : b₂ ∈ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (theta : Fin k) (hthetaAlpha : theta ≠ alpha) + (hthetaBeta : theta ≠ beta) + (hthetaMissing : theta ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hthetaClosedStar : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {theta}) + (hthetaClosed : TreeColorSetClosed G phi T {theta}) + (hnoSmaller : + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount < H.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' {a} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → False) : + False := by + by_cases hpositiveDivider : 0 < H.dividerCount + · exact Step1CaseOneInsidePositiveDivider G k e0 input T phi ett hMP hpositive hproper hone + hlower base H good q hdivider hfewer hlarge hterminal hElementary alpha beta halpha hclosed + hne hbeta a₁ b₁ a₂ b₂ P₁ P₂ hP₁ hP₂ hpaths ha hb horder f₁ f₂ hf₁ hf₂ hif₁ hif₂ hPf₁ hPf₂ + hinside theta hthetaAlpha hthetaBeta hthetaMissing hthetaClosedStar hthetaClosed hnoSmaller + hpositiveDivider + · have hzeroDivider : H.dividerCount = 0 := Nat.eq_zero_of_not_pos hpositiveDivider + by_cases hpe : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · exact Step1CaseOneInsideZeroPE G k e0 input T phi ett hMP hpositive hproper hone hlower + base H good q hdivider hfewer hlarge hterminal hElementary alpha beta halpha hclosed hne + hbeta a₁ b₁ a₂ b₂ P₁ P₂ hP₁ hP₂ hpaths ha hb horder f₁ f₂ hf₁ hf₂ hif₁ hif₂ hPf₁ hPf₂ + hinside theta hthetaAlpha hthetaBeta hthetaMissing hthetaClosedStar hthetaClosed + hnoSmaller hzeroDivider hpe + · exact Step1CaseOneInsideZeroNonPE G k e0 input T phi ett hMP hpositive hproper hone hlower + base H good q hdivider hfewer hlarge hterminal hElementary alpha beta halpha hclosed hne + hbeta a₁ b₁ a₂ b₂ P₁ P₂ hP₁ hP₂ hpaths ha hb horder f₁ f₂ hf₁ hf₂ hif₁ hif₂ hPf₁ hPf₂ + hinside theta hthetaAlpha hthetaBeta hthetaMissing hthetaClosedStar hthetaClosed + hnoSmaller hzeroDivider hpe + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroNonPE.lean b/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroNonPE.lean new file mode 100644 index 0000000000..58c6970eda --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroNonPE.lean @@ -0,0 +1,218 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.OutsideExitTransport + +public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchorNonPE + +/-! +# Step1Case One Inside Zero Non PE + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1CaseOneInsideZeroNonPE {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (_ : H.dividerCount < q) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (_ : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (_ : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (_ : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (_ : beta ∈ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hpaths : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (ha : a₁ ≠ a₂) (_ : b₁ ≠ b₂) + (horder : TreeVertexOrder T b₁ b₂) + (f₁ f₂ : E) + (_ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : Incident G b₁ f₁) (_ : Incident G b₂ f₂) + (_ : Sum.inr f₁ ∈ P₁.support) + (_ : Sum.inr f₂ ∈ P₂.support) + (hinside : b₂ ∈ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (theta : Fin k) (hthetaAlpha : theta ≠ alpha) + (hthetaBeta : theta ≠ beta) + (hthetaMissing : theta ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hthetaClosedStar : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {theta}) + (hthetaClosed : TreeColorSetClosed G phi T {theta}) + (_ : + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount < H.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' {a} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → False) + (hdividerZero : H.dividerCount = 0) + (hnonPE : ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE) : False := by + classical + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + have hstar : A = base.core := by + have hlast : Fin.last H.dividerCount = + (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [hdividerZero] + change HierarchyStarredStage H (Fin.last H.dividerCount) = base.core + rw [hlast] + rfl + have hprefix : TreeSequenceInitialSegment A T := by + rw [hstar, base.nonparallel hnonPE] + exact ett.abovePenultimate + have hsub : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T := + TreeSequenceInitialSegmentVertexSetSubset hprefix + have hb₁A : b₁ ∈ TreeSequenceVertexSet A := by + obtain ⟨hlen, hvertices, _⟩ := hprefix + obtain ⟨i, j, hi, hj, hij⟩ := horder + obtain ⟨t, ht⟩ : ∃ t : Fin (A.length + 1), A.vertex t = b₂ := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] using hinside + have hjcast : j = Fin.castLE (Nat.succ_le_succ hlen) t := + T.vertex_injective (hj.trans ((hvertices t).trans ht).symm) + have hiBound : i.val < A.length + 1 := by + have hjval := congrArg Fin.val hjcast + simp only [Fin.val_castLE] at hjval + omega + let iA : Fin (A.length + 1) := ⟨i.val, hiBound⟩ + have hiCast : Fin.castLE (Nat.succ_le_succ hlen) iA = i := by + apply Fin.ext + rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨iA, ?_⟩ + calc + A.vertex iA = T.vertex (Fin.castLE (Nat.succ_le_succ hlen) iA) := + (hvertices iA).symm + _ = T.vertex i := by rw [hiCast] + _ = b₁ := hi + obtain ⟨sigma, hrecolor, hproperSigma, honeSigma, hsubset, _, hexits⟩ := + P2716_T1_OutsideExitTransport G T phi alpha theta beta hthetaAlpha.symm + hne hthetaBeta hproper hone hclosed hthetaClosed + obtain ⟨Q₁, hQ₁, hsupport₁, _⟩ := + hexits A hsub a₁ b₁ P₁ hP₁ hb₁A + obtain ⟨Q₂, hQ₂, hsupport₂, _⟩ := + hexits A hsub a₂ b₂ P₂ hP₂ hinside + have hQpaths : ∀ x, x ∈ Q₁.support → x ∉ Q₂.support := by + simpa only [hsupport₁, hsupport₂] using hpaths + obtain ⟨_, _, _, _, corr, hMPsigma, baseSigma, K, goodSigma, hsame, _⟩ := + HierarchyLEMStable G k e0 input T phi sigma ett hMP hpositive hlower + base H good hproper hone alpha theta hrecolor + obtain ⟨hcores, hcounts, _, _, _, _⟩ := hsame.1 + have hKzero : K.dividerCount = 0 := hcounts.symm.trans hdividerZero + have hKstar : HierarchyStarredStage K (Fin.last K.dividerCount) = A := by + have hlast : Fin.last K.dividerCount = + (0 : Fin (K.dividerCount + 1)) := by + apply Fin.ext + simp [hKzero] + rw [hlast] + exact hcores.symm.trans hstar.symm + have hmissingSigma : theta ∈ TreeMissingColors sigma + (HierarchyStarredStage K (Fin.last K.dividerCount)) := by + rw [hKstar, (hsubset A hsub).2.1] + exact hthetaMissing + have hclosedSigma : TreeColorSetClosed G sigma + (HierarchyStarredStage K (Fin.last K.dividerCount)) {theta} := by + rw [hKstar] + exact (hsubset A hsub).2.2 theta hthetaClosedStar + have lastKindAgreement : + ∀ {m n : ℕ} (S₁ : TashkinovSeries G k m e0 corr.replacementInput) (S₂ : TashkinovSeries G k n + e0 corr.replacementInput), m = n → HEq S₁ S₂ → S₁.data.kind (Fin.last m) = S₂.data.kind + (Fin.last n) := by + intro m n S₁ S₂ hmn hseries + cases hmn + cases hseries + rfl + have hkind : corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) := + (lastKindAgreement corr.replacementETT.series corr.replacementSeries + corr.rungAgreement corr.seriesPresentation).trans + (corr.extensionKindsAgree (Fin.last ett.rounds)) + have hnonSigma : corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) ≠ + some TashkinovExtensionKind.PE := by + rw [hkind] + exact hnonPE + exact Step1ZeroDividerAnchorNonPE G k e0 corr.replacementInput T sigma + corr.replacementETT hMPsigma + (by simpa only [corr.rungAgreement] using hpositive) + hproperSigma honeSigma + (fun lower hp hlt hmp => hlower lower hp + (by simpa only [corr.rungAgreement] using hlt) hmp) + baseSigma K hKzero theta beta hthetaBeta hmissingSigma hclosedSigma + a₁ b₁ a₂ b₂ Q₁ Q₂ + (by simpa only [hKstar] using hQ₁) + (by simpa only [hKstar] using hQ₂) hQpaths ha hnonSigma + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroPE.lean b/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroPE.lean new file mode 100644 index 0000000000..d71c0ff91a --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroPE.lean @@ -0,0 +1,594 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchorPE + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Step1Case One Inside Zero PE + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_continuation_368.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + MaximumProperty ett → + (0 : ℕ) < ett.rounds → + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) + (_ : GoodHierarchy H) (alpha beta : Fin k) (a₁ b₁ a₂ b₂ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl b₂)), + TreeExitPath T phi alpha beta a₁ b₁ P₁ → + TreeExitPath T phi alpha beta a₂ b₂ P₂ → + (∀ x ∈ P₁.support, x ∉ P₂.support) → + a₁ ≠ a₂ → + ∀ (theta : Fin k), + theta ≠ alpha → + theta ≠ beta → + theta ∈ TreeMissingColors phi (HierarchyStarredStage H (Fin.last H.dividerCount)) → + TreeColorSetClosed G phi (HierarchyStarredStage H (Fin.last H.dividerCount)) + ({ theta } : Finset (Fin k)) → + (∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount < H.dividerCount → + (2 : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), + a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' ({ a } : Finset (Fin k)) → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : + (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₁) + (Sum.inl v₁)) + (Q₂ : + (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₂) + (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x ∈ Q₁.support, x ∉ Q₂.support) → + u₁ ≠ u₂ → False) → + H.dividerCount = (0 : ℕ) → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + A = base.core → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → + b₂ ∈ TreeSequenceVertexSet A → + b₁ ∈ TreeSequenceVertexSet A → + let roots : Finset (V ⊕ E) := + ({z : V ⊕ E | + match z with + | Sum.inl v => v ∉ TreeSequenceVertexSet T + | Sum.inr _ => False} : + Finset (V ⊕ E)); + let selected : E → Prop := fun (f : E) ↦ + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha theta z; + let nu : PartialEdgeColoring E k := fun (f : E) ↦ + if selected f then + if phi f = some alpha then some theta + else if phi f = some theta then some alpha else phi f + else phi f; + OutsideKempeRecoloring T phi nu alpha theta → + (IsProperEdgeColoring G nu ∧ + IsOneEdgeUncolored nu e0 ∧ + StableColoring T ∅ phi nu ∧ + TreeColoringInvariant T phi nu ∧ + ∀ (f : E), TreeIncidentEdge T f → nu f = phi f) → + (∀ (f : E), TreeIncidentEdge T f → nu f = phi f) → + (∀ u ∉ TreeSequenceVertexSet T, + ∀ (f : E), Incident G u f → phi f = some alpha ∨ phi f = some theta → selected f) → + (∀ (f : E), nu f = some beta ↔ phi f = some beta) → + (∀ (u v : V) + (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath T phi alpha beta u v P → + ∀ (f : E), + Sum.inr f ∈ P.support → ∃ w ∉ TreeSequenceVertexSet T, Incident G w f) → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hproper hone hlower base H good alpha + beta a₁ b₁ a₂ b₂ P₁ P₂ hP₁ hP₂ hpaths ha theta hthetaAlpha hthetaBeta hthetaMissing + hthetaClosedStar _ hdividerZero hPE A hstar hsub hb2A hb1A roots selected nu hrecolor + hdetail hfixed selectedOutside betaFixed pathEdgeOutside + have transportExit : ∀ (u v : V) + (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath T phi alpha beta u v P → v ∈ TreeSequenceVertexSet A → + ∃ Q : (TwoColorIncidenceGraph G nu theta beta).Walk (Sum.inl u) (Sum.inl v), + TreeExitPath A nu theta beta u v Q ∧ Q.support = P.support := by + intro u v P hExit hvA + have colors : ∀ f, Sum.inr f ∈ P.support → + (phi f = some alpha ∨ phi f = some beta) → + nu f = some theta ∨ nu f = some beta := by + intro f hf hc + rcases hc with ha | hb + · obtain ⟨w, hw, hwf⟩ := pathEdgeOutside u v P hExit f hf + have hs := selectedOutside w hw f hwf (Or.inl ha) + exact Or.inl (by simp [nu, hs, ha]) + · exact Or.inr ((betaFixed f).mpr hb) + have hedges : ∀ z, z ∈ P.edges → + z ∈ (TwoColorIncidenceGraph G nu theta beta).edgeSet := by + intro z hz + induction z using Sym2.inductionOn with + | _ x y => + have hadj := (SimpleGraph.mem_edgeSet _).mp (P.edges_subset_edgeSet hz) + have hx := P.fst_mem_support_of_mem_edges hz + have hy := P.snd_mem_support_of_mem_edges hz + apply (SimpleGraph.mem_edgeSet _).mpr + cases x with + | inl w => + cases y with + | inl z => exact False.elim hadj + | inr f => exact ⟨hadj.1, colors f hy hadj.2⟩ + | inr f => + cases y with + | inr g => exact False.elim hadj + | inl w => exact ⟨hadj.1, colors f hx hadj.2⟩ + let Q := P.transfer (TwoColorIncidenceGraph G nu theta beta) hedges + have hmissing : theta ∈ MissingColors G nu u ∨ beta ∈ MissingColors G nu u := by + rcases hExit.2.2.2.2.1 with ha | hb + · left + have hn : ∀ f, Incident G u f → phi f ≠ some alpha := by + simpa [MissingColors, PresentColors] using ha + have hn' : ∀ f, Incident G u f → nu f ≠ some theta := by + intro f huf hnf + have hna := hn f huf + by_cases hs : selected f + · by_cases ht : phi f = some theta + · have hnalpha : nu f = some alpha := by simp [nu, hs, ht] + exact hthetaAlpha (Option.some.inj (hnf.symm.trans hnalpha)) + · exact ht (by simp [nu, hs, hna, ht] at hnf) + · have ht : phi f = some theta := by simpa [nu, hs] using hnf + exact hs (selectedOutside u hExit.2.2.1 f huf (Or.inr ht)) + simpa [MissingColors, PresentColors] using hn' + · right + have hn : ∀ f, Incident G u f → phi f ≠ some beta := by + simpa [MissingColors, PresentColors] using hb + have hn' : ∀ f, Incident G u f → nu f ≠ some beta := by + intro f huf hnf + exact hn f huf ((betaFixed f).mp hnf) + simpa [MissingColors, PresentColors] using hn' + refine ⟨Q, ?_, by simp [Q]⟩ + refine ⟨hExit.1.transfer hedges, by simpa [Q] using hExit.2.1, + (fun hu => hExit.2.2.1 (hsub hu)), hvA, hmissing, ?_⟩ + intro w hw + simpa [Q] using hExit.2.2.2.2.2 w (hsub hw) + obtain ⟨Q₁, hQ₁, hQ₁Support⟩ := transportExit a₁ b₁ P₁ hP₁ hb1A + obtain ⟨Q₂, hQ₂, hQ₂Support⟩ := transportExit a₂ b₂ P₂ hP₂ hb2A + have hQpaths : ∀ z, z ∈ Q₁.support → z ∉ Q₂.support := by + simpa only [hQ₁Support, hQ₂Support] using hpaths + obtain ⟨_, _, _, _, corr, hMPnu, baseNu, K, goodNu, hsame, _⟩ := + HierarchyLEMStable G k e0 input T phi nu ett hMP hpositive hlower + base H good hproper hone alpha theta hrecolor + rcases hsame.1 with ⟨hcore, hcount, _, _, hkind, _⟩ + have hKzero : K.dividerCount = 0 := hcount.symm.trans hdividerZero + have hstarNu : HierarchyStarredStage K (Fin.last K.dividerCount) = A := by + have hz : Fin.last K.dividerCount = (0 : Fin (K.dividerCount + 1)) := by + apply Fin.ext + simp [hKzero] + rw [hz] + change baseNu.core = A + exact hcore.symm.trans hstar.symm + have hmissingA : TreeMissingColors nu A = TreeMissingColors phi A := by + unfold TreeMissingColors + apply Finset.biUnion_congr rfl + intro v hv + exact hdetail.2.2.1.2 v (hsub hv) + have hthetaMissingNu : theta ∈ TreeMissingColors nu A := by + rw [hmissingA] + exact hthetaMissing + have hthetaClosedNu : TreeColorSetClosed G nu A {theta} := by + intro c hc + have hclosedOld := hthetaClosedStar c hc + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨hfBoundary, hfColor⟩ := Finset.mem_filter.mp hf + obtain ⟨u, hu, v, hv, hends⟩ := by + simpa [BoundaryEdges] using hfBoundary + have hinc : TreeIncidentEdge T f := + ⟨u, hsub hu, by simp [Incident, hends]⟩ + have hfOld : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet A) c := + Finset.mem_filter.mpr ⟨hfBoundary, (hfixed f hinc).symm.trans hfColor⟩ + rw [hclosedOld] at hfOld + exact Finset.notMem_empty _ hfOld + apply Step1ZeroDividerAnchorPE G k e0 corr.replacementInput T nu + corr.replacementETT hMPnu (by rw [corr.rungAgreement]; exact hpositive) + hdetail.1 hdetail.2.1 + (by + intro input' T' generating' lower hp hlt hm + apply hlower lower hp _ hm + rw [← corr.rungAgreement] + exact hlt) + baseNu K hKzero theta beta hthetaBeta + (by simpa only [hstarNu] using hthetaMissingNu) + (by simpa only [hstarNu] using hthetaClosedNu) + a₁ b₁ a₂ b₂ Q₁ Q₂ + (by simpa only [hstarNu] using hQ₁) + (by simpa only [hstarNu] using hQ₂) hQpaths ha + (hkind.mp hPE) + +lemma Step1CaseOneInsideZeroPE {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (_ : H.dividerCount < q) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (_ : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (_ : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (_ : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (_ : beta ∈ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hpaths : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (ha : a₁ ≠ a₂) (_ : b₁ ≠ b₂) + (horder : TreeVertexOrder T b₁ b₂) + (f₁ f₂ : E) + (_ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : Incident G b₁ f₁) (_ : Incident G b₂ f₂) + (_ : Sum.inr f₁ ∈ P₁.support) + (_ : Sum.inr f₂ ∈ P₂.support) + (hinside : b₂ ∈ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (theta : Fin k) (hthetaAlpha : theta ≠ alpha) + (hthetaBeta : theta ≠ beta) + (hthetaMissing : theta ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hthetaClosedStar : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {theta}) + (hthetaClosed : TreeColorSetClosed G phi T {theta}) + (_ : + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount < H.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' {a} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → False) + (hdividerZero : H.dividerCount = 0) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) : + False := by + classical + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + have hstar : A = base.core := by + have hz : Fin.last H.dividerCount = (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [hdividerZero] + simp only [A, hz, HierarchyStarredStage, Fin.cases_zero] + have hcoreT : TreeSequenceInitialSegment base.core T := by + have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [hdividerZero] + simpa only [hi, H.terminalStage] using H.coreInsideFirst + have initialVertices : ∀ {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet U := by + intro S U hSU v hv + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + obtain ⟨i, _, rfl⟩ := hv + obtain ⟨hlen, hverts, _⟩ := hSU + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, hverts i⟩ + have hAT : TreeSequenceInitialSegment A T := by simpa [hstar] using hcoreT + have hsub := initialVertices hAT + have hb2A : b₂ ∈ TreeSequenceVertexSet A := hinside + have hb1A : b₁ ∈ TreeSequenceVertexSet A := by + obtain ⟨r, s, hr, hs, hrs⟩ := horder + have hb2 := hb2A + unfold TreeSequenceVertexSet at hb2 + simp only [Finset.mem_image] at hb2 + obtain ⟨t, _, ht⟩ := hb2 + obtain ⟨hlen, hverts, _⟩ := hAT + have hts : Fin.castLE (Nat.succ_le_succ hlen) t = s := + T.vertex_injective (((hverts t).trans ht).trans hs.symm) + have hrlt : r.val < A.length + 1 := by + have hvals := congrArg Fin.val hts + simp only [Fin.val_castLE] at hvals + omega + let i : Fin (A.length + 1) := ⟨r.val, hrlt⟩ + have hir : Fin.castLE (Nat.succ_le_succ hlen) i = r := by + apply Fin.ext + rfl + unfold TreeSequenceVertexSet + simp only [Finset.mem_image] + refine ⟨i, Finset.mem_univ _, ?_⟩ + exact (hverts i).symm.trans (hir ▸ hr) + have noBoundary : ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → + phi f ≠ some alpha ∧ phi f ≠ some theta := by + intro f hf + constructor + · intro hc + have hm : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha := + Finset.mem_filter.mpr ⟨hf, hc⟩ + rw [hclosed alpha (by simp)] at hm + exact Finset.notMem_empty _ hm + · intro hc + have hm : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) theta := + Finset.mem_filter.mpr ⟨hf, hc⟩ + rw [hthetaClosed theta (by simp)] at hm + exact Finset.notMem_empty _ hm + have boundaryOutside : ∀ {v : V} {f : E}, + v ∉ TreeSequenceVertexSet T → Incident G v f → TreeIncidentEdge T f → + f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + intro v f hv hvf ⟨w, hw, hwf⟩ + have hwv : w ≠ v := by rintro rfl; exact hv hw + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hw, v, hv, (Sym2.mem_and_mem_iff hwv).mp ⟨hwf, hvf⟩⟩ + let J := TwoColorIncidenceGraph G phi alpha theta + let Outside : Set (Sum V E) := {z | match z with + | Sum.inl v => v ∉ TreeSequenceVertexSet T + | Sum.inr f => ¬ TreeIncidentEdge T f} + have outsideStep : ∀ z, z ∈ Outside → ∀ w, J.Adj z w → w ∈ Outside := by + intro z hz w hzw + cases z with + | inl v => + cases w with + | inl w => exact False.elim hzw + | inr f => + intro hf + have hn := noBoundary (boundaryOutside hz hzw.1 hf) + exact hzw.2.elim hn.1 hn.2 + | inr f => + cases w with + | inr g => exact False.elim hzw + | inl v => exact fun hv => hz ⟨v, hv, hzw.1⟩ + let roots : Finset (Sum V E) := Finset.univ.filter fun z => + match z with + | Sum.inl v => v ∉ TreeSequenceVertexSet T + | Sum.inr _ => False + have hout : ∀ z ∈ roots, ∀ v : V, + Sum.inl v ∈ TwoColorComponent G phi alpha theta z → + v ∉ TreeSequenceVertexSet T := by + intro z hz v hv + have hzOutside : z ∈ Outside := by + cases z with + | inl vertex => + simpa only [roots, Outside, Finset.mem_filter, Finset.mem_univ, true_and, + Set.mem_ofPred_eq] using hz + | inr edge => simp [roots] at hz + have hr : J.Reachable z (Sum.inl v) := by + change J.connectedComponentMk (Sum.inl v) = J.connectedComponentMk z at hv + exact (SimpleGraph.ConnectedComponent.eq.mp hv).symm + exact hr.mem_subgraphVerts + (H := (⊤ : J.Subgraph).induce Outside) + (fun z hz w hzw => ⟨hz, outsideStep z hz w hzw, hzw⟩) hzOutside + let selected : E → Prop := fun f => ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha theta z + let nu : PartialEdgeColoring E k := fun f => + if selected f then + if phi f = some alpha then some theta + else if phi f = some theta then some alpha + else phi f + else phi f + have hrecolor : OutsideKempeRecoloring T phi nu alpha theta := + ⟨hthetaAlpha.symm, roots, hout, fun _ => rfl⟩ + have hdetail := OutsideKempeRecoloringStable G e0 T ∅ phi nu alpha theta + hproper hone hrecolor + have hfixed : ∀ f, TreeIncidentEdge T f → nu f = phi f := hdetail.2.2.2.2 + have selectedOutside : ∀ (u : V), u ∉ TreeSequenceVertexSet T → ∀ (f : E), + Incident G u f → (phi f = some alpha ∨ phi f = some theta) → selected f := by + intro u hu f huf hc + refine ⟨Sum.inl u, by simp [roots, hu], ?_⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show J.Adj (Sum.inl u) (Sum.inr f) from ⟨huf, hc⟩)).symm + have betaFixed : ∀ f, nu f = some beta ↔ phi f = some beta := by + intro f + by_cases hsel : selected f + · by_cases ha : phi f = some alpha + · simp [nu, hsel, ha, hne, hthetaBeta] + · by_cases ht : phi f = some theta + · simp [nu, hsel, ht, hne, hthetaBeta, hthetaAlpha] + · simp [nu, hsel, ha, ht] + · simp [nu, hsel] + have pathEdgeOutside : ∀ (u v : V) + (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath T phi alpha beta u v P → + ∀ f, Sum.inr f ∈ P.support → + ∃ w : V, w ∉ TreeSequenceVertexSet T ∧ Incident G w f := by + intro u v P hExit f hf + obtain ⟨m, hm, hmle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hmpos : 0 < m := by + by_contra h + have hmzero : m = 0 := by omega + rw [hmzero] at hm + simp at hm + have hmlt : m < P.length := by + by_contra h + have hmlast : m = P.length := by omega + rw [hmlast] at hm + simp at hm + have hprev := P.adj_getVert_succ (i := m - 1) (by omega) + rw [show m - 1 + 1 = m by omega, hm] at hprev + obtain ⟨w, hw⟩ : ∃ w : V, P.getVert (m - 1) = Sum.inl w := by + cases hnode : P.getVert (m - 1) with + | inl w => exact ⟨w, rfl⟩ + | inr e => rw [hnode] at hprev; exact False.elim hprev + have hnext := P.adj_getVert_succ (i := m) hmlt + rw [hm] at hnext + obtain ⟨z, hz⟩ : ∃ z : V, P.getVert (m + 1) = Sum.inl z := by + cases hnode : P.getVert (m + 1) with + | inl z => exact ⟨z, rfl⟩ + | inr e => rw [hnode] at hnext; exact False.elim hnext + rw [hw] at hprev + rw [hz] at hnext + have hwP : Sum.inl w ∈ P.support := by + rw [← hw] + exact P.getVert_mem_support _ + have hzP : Sum.inl z ∈ P.support := by + rw [← hz] + exact P.getVert_mem_support _ + by_cases hwT : w ∈ TreeSequenceVertexSet T + · by_cases hzT : z ∈ TreeSequenceVertexSet T + · have hwv := (hExit.2.2.2.2.2 w hwT).mp hwP + have hzv := (hExit.2.2.2.2.2 z hzT).mp hzP + have hverts : P.getVert (m - 1) = P.getVert (m + 1) := by + rw [hw, hz, hwv, hzv] + have hi := hExit.1.getVert_injOn + (show m - 1 ≤ P.length by omega) (show m + 1 ≤ P.length by omega) hverts + omega + · exact ⟨z, hzT, hnext.1⟩ + · exact ⟨w, hwT, hprev.1⟩ + exact @helper_continuation_368 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hMP) (@hpositive) (@hproper) + (@hone) (@hlower) (@base) (@H) (@good) (@alpha) (@beta) (@a₁) (@b₁) (@a₂) (@b₂) (@P₁) (@P₂) + (@hP₁) (@hP₂) (@hpaths) (@ha) (@theta) (@hthetaAlpha) (@hthetaBeta) (@hthetaMissing) + (@hthetaClosedStar) (by assumption) (@hdividerZero) (@hPE) (@hstar) (@hsub) (@hb2A) (@hb1A) + (@hrecolor) (@hdetail) (@hfixed) (@selectedOutside) (@betaFixed) (@pathEdgeOutside) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseOneOutsideStar.lean b/LeanPool/GoldbergSeymour/Step1CaseOneOutsideStar.lean new file mode 100644 index 0000000000..2afec4e0c6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseOneOutsideStar.lean @@ -0,0 +1,1681 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.OutsideExitTransport +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast +public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Step1Case One Outside Star + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_terminalRoute_259.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + (0 : ℕ) < ett.rounds → + ∀ (_ : ℕ) (beta : Fin k) (b₂ : V) (gamma : Fin k) (sigma : PartialEdgeColoring E k) + (i₁ i₂ : Fin (T.length + (1 : ℕ))) (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) + (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)) (hsT : (↑i₂ : ℕ) ≤ T.length), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos + (Decidable.byContradiction fun (a : ¬(↑i₂ : ℕ) - (1 : ℕ) ≤ T.length) ↦ by omega); + let C : TreeSequence G e0 := + TreeSequencePrefix T (↑i₂ : ℕ) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑i₂ : ℕ)) ↦ by omega) hsT; + TreeSequenceInitialSegment C T → + let mu : PartialEdgeColoring E k := + TwoColorComponentSwap G sigma gamma beta (Sum.inl b₂); + (∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + C.length = Bminus.length + (1 : ℕ) → + TreeSequenceInitialSegment Bminus C → + TreeSequenceInitialSegment Tn C → + Tn.length < C.length → + (∀ (j : Fin C.length), mu (C.edge j) = phi (C.edge j)) → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu Tn C ∨ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence mu seed C := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive q beta b₂ gamma sigma i₁ i₂ hiorder hspos hsT + Bminus C hCT mu hmissingFixed segTrans commonPrefix Tn hlenC hBtoC TnToC TnStrictC fixedC + have hCF := segTrans hCT ett.belowFinal + have transport (S : TreeSequence G e0) + (hSF : TashkinovAugmentationSequence phi S + (ett.series.data.tree (Fin.last (ett.rounds + 1)))) + (hSC : TreeSequenceInitialSegment S C) : + TashkinovAugmentationSequence mu S C := by + exact TashkinovAugmentationSequenceColoringTransport phi mu S Bminus C + (TashkinovAugmentationSequenceRestrict phi S C _ hSF hSC hCF) + hBtoC hlenC (fun j _ => fixedC j) hmissingFixed + have step := ett.series.certified (Fin.last ett.rounds) + generalize hi : Fin.last ett.rounds = i at step + cases step with + | initial => have hv := congrArg Fin.val hi; simp at hv; omega + | SE q _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hq : q.succ = Fin.last ett.rounds := hi.symm + have hlast : q.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by + have hv := congrArg Fin.val hq + simp only [Fin.val_succ, Fin.val_last] at hv ⊢ + omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hq, hlast, ← ett.generatingColoring] using closure.1 + have hseedC : TreeSequenceInitialSegment seed C := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + hCF (by + obtain ⟨ha, _, _⟩ := adjoin + rw [hq] at ha + change seed.length = Tn.length + 1 at ha + omega) + refine Or.inr ⟨Or.inl (by simpa [hq] using kind), choice.edge, seed, + by simpa [hq] using edges, by simpa [Tn, hq] using adjoin, + transport seed hroute hseedC⟩ + | PE q _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + have hq : q.succ = Fin.last ett.rounds := hi.symm + have hlast : q.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by + have hv := congrArg Fin.val hq + simp only [Fin.val_succ, Fin.val_last] at hv ⊢ + omega) + refine Or.inl ⟨by simpa [hq] using kind, transport Tn ?_ TnToC⟩ + simpa [Tn, hq, hlast, ← ett.generatingColoring] using closure.1 + | RE q _ _ _ _ available coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hq : q.succ = Fin.last ett.rounds := hi.symm + have hlast : q.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by + have hv := congrArg Fin.val hq + simp only [Fin.val_succ, Fin.val_last] at hv ⊢ + omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hq, hlast, ← ett.generatingColoring] using closure.1 + have hseedC : TreeSequenceInitialSegment seed C := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + hCF (by + obtain ⟨ha, _, _⟩ := adjoin + rw [hq] at ha + change seed.length = Tn.length + 1 at ha + omega) + refine Or.inr ⟨Or.inr (by simpa [hq] using kind), available.edge, seed, + by simpa [hq] using edges, by simpa [Tn, hq] using adjoin, + transport seed hroute hseedC⟩ + +private theorem helper_chosenAgree_381.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (hpositive : (0 : ℕ) < ett.rounds) (i₁ i₂ : Fin (T.length + (1 : ℕ))) + (_ : (↑i₁ : ℕ) < (↑i₂ : ℕ)) (_ : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)) + (_ : (↑i₂ : ℕ) ≤ T.length), + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + (∀ {r : ℕ} {inp : PartialEdgeColoring E k} (s : TashkinovSeries G k r e0 inp) + (q : Fin r), + s.data.kind q.succ = some TashkinovExtensionKind.PE → + ∃ (v : V) (u : V) (f : E), + s.data.chosenVertex q.succ = some v ∧ + s.data.connectingEdges q.succ = ({ f } : Finset E) ∧ + v ∈ TreeSequenceVertexSet (s.data.tree q.succ.castSucc) ∧ + u ∉ TreeSequenceVertexSet (s.data.tree q.succ.castSucc) ∧ + G.ends f = s(v, u)) → + ∀ (newInput : PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k ett.rounds e0 newInput), + (∀ (i : Fin (ett.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = ett.series.data.connectingEdges i) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + newSeries.data.tree (Fin.last ett.rounds).castSucc = Tn → + newSeries.data.kind (Fin.last ett.rounds) = ett.series.data.kind (Fin.last ett.rounds) → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + newSeries.data.chosenVertex (Fin.last ett.rounds) = + ett.series.data.chosenVertex (Fin.last ett.rounds) := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive i₁ i₂ hiorder hspos hsT Tn peSupport newInput + newSeries hedges q hq htree hkind hp + obtain ⟨v, u, f, hv, hf, hvin, huout, hends⟩ := + peSupport ett.series q (by simpa [hq] using hp) + obtain ⟨v', u', f', hv', hf', hvin', huout', hends'⟩ := + peSupport newSeries q (by simpa [hq] using hkind.trans hp) + have hedge : f' = f := by + have hh := hedges q.succ + rw [hf', hf] at hh + simpa using hh + have hvEq : v' = v := by + rcases Sym2.eq_iff.mp (hends'.symm.trans (hedge ▸ hends)) with h | h + · exact h.1 + · have hin : v ∈ TreeSequenceVertexSet (newSeries.data.tree q.succ.castSucc) := by + simpa [hq, htree, Tn] using hvin + exact False.elim (huout' (h.2 ▸ hin)) + simpa [hq] using hv'.trans ((congrArg some hvEq).trans hv.symm) + +private theorem helper_closureVertices_400.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (i₁ i₂ : Fin (T.length + (1 : ℕ))) + (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos + (by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt i₂ + have := GoldbergSeymour.TreeSequence.positive T + omega); + TreeSequenceInitialSegment base.core Bminus → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet Bminus := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base i₁ i₂ hiorder hspos Bminus coreToB hp + obtain ⟨_, _, ⟨u⟩⟩ := base.parallel hp + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToB + rw [u.vertexSet] + exact Finset.mem_union_right _ hv + +private theorem helper_divBound_489.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + (0 : ℕ) < ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (beta : Fin k) + (b₂ : V) (gamma : Fin k) (sigma : PartialEdgeColoring E k) + (i₁ i₂ : Fin (T.length + (1 : ℕ))) (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) + (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)) (hsT : (↑i₂ : ℕ) ≤ T.length), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos + (by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt i₂ + have := GoldbergSeymour.TreeSequence.positive T + omega); + let C : TreeSequence G e0 := + TreeSequencePrefix T (↑i₂ : ℕ) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt i₂ + have := GoldbergSeymour.TreeSequence.positive T + omega) + hsT; + let mu : PartialEdgeColoring E k := + TwoColorComponentSwap G sigma gamma beta (Sum.inl b₂); + TreeSequenceInitialSegment Bminus C → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) Bminus) → + ∀ (newInput : PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k ett.rounds e0 newInput) (rp : (1 : ℕ) ≤ ett.1) + (above : + TreeSequenceInitialSegment + (newSeries.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) C) + (strict : + (newSeries.data.tree + (⟨ett.1, by + have := above.1 + omega⟩ : + Fin (ett.1 + (2 : ℕ)))).length < + C.length) + (below : + TreeSequenceInitialSegment C (newSeries.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (gen : mu = newSeries.data.coloring (Fin.last ett.1)), + { rounds := ett.1, roundsPositive := rp, series := newSeries, abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }.series ≍ + newSeries → + ∀ (i : Fin H.dividerCount), + (↑(H.dividerPosition i) : ℕ) ≤ C.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H beta b₂ gamma sigma i₁ i₂ hiorder + hspos hsT Bminus C mu hBtoC stageToB newInput newSeries rp above strict below gen hs i + have hl := congrArg TreeSequence.length (H.dividerStage i) + change (H.stage ⟨i.val + 1, by omega⟩).length = (H.dividerPosition i).val at hl + have hs := stageToB i.succ + rw [← hl] + exact le_trans hs.1 hBtoC.1 + +private theorem helper_cutoffEq_570.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + (0 : ℕ) < ett.rounds → + ∀ (beta : Fin k) (b₂ : V) (gamma : Fin k) (sigma : PartialEdgeColoring E k) + (i₁ i₂ : Fin (T.length + (1 : ℕ))) (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) + (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)) (hsT : (↑i₂ : ℕ) ≤ T.length), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos + (by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt i₂ + have := GoldbergSeymour.TreeSequence.positive T + omega); + let C : TreeSequence G e0 := + TreeSequencePrefix T (↑i₂ : ℕ) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt i₂ + have := GoldbergSeymour.TreeSequence.positive T + omega) + hsT; + let mu : PartialEdgeColoring E k := + TwoColorComponentSwap G sigma gamma beta (Sum.inl b₂); + (∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) → + C.length = Bminus.length + (1 : ℕ) → + TreeSequenceInitialSegment Bminus C → + (∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) → + ∀ (newInput : PartialEdgeColoring E k) + (_ : TashkinovSeries G k ett.rounds e0 newInput) (eta : Fin k), + (↑(HierarchyFirstMissingPosition mu C eta) : ℕ) = + (↑(HierarchyFirstMissingPosition phi C eta) : ℕ) := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive beta b₂ gamma sigma i₁ i₂ hiorder hspos hsT + Bminus C mu hmissingFixed hlenC hBtoC vertexMem newInput newSeries eta + have h (i : Fin (C.length + 1)) (hi : i.val < C.length) : + eta ∈ MissingColors G mu (C.vertex i) ↔ + eta ∈ MissingColors G phi (C.vertex i) := by + let ib : Fin (Bminus.length + 1) := ⟨i.val, by omega⟩ + have hv : C.vertex i = Bminus.vertex ib := hBtoC.2.1 ib + rw [hv, hmissingFixed _ (vertexMem _ _)] + let dm : Finset (Fin (C.length + 1)) := + Finset.univ.filter fun i => eta ∈ MissingColors G mu (C.vertex i) + let dp : Finset (Fin (C.length + 1)) := + Finset.univ.filter fun i => eta ∈ MissingColors G phi (C.vertex i) + change (if h : dm.Nonempty then dm.min' h else Fin.last C.length).val = + (if h : dp.Nonempty then dp.min' h else Fin.last C.length).val + by_cases hm : dm.Nonempty + · rw [dite_eq_left hm] + by_cases hp : dp.Nonempty + · rw [dite_eq_left hp] + apply Nat.le_antisymm + · by_cases hj : (dp.min' hp).val < C.length + · have hi : dp.min' hp ∈ dm := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, (h _ hj).mpr + ((Finset.mem_filter.mp (Finset.min'_mem dp hp)).2)⟩ + exact Finset.min'_le dm _ hi + · have := (dm.min' hm).isLt; omega + · by_cases hj : (dm.min' hm).val < C.length + · have hi : dm.min' hm ∈ dp := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, (h _ hj).mp + ((Finset.mem_filter.mp (Finset.min'_mem dm hm)).2)⟩ + exact Finset.min'_le dp _ hi + · have := (dp.min' hp).isLt; omega + · rw [dite_eq_right hp] + have hb : ¬(dm.min' hm).val < C.length := by + intro hj + apply hp + exact ⟨dm.min' hm, Finset.mem_filter.mpr + ⟨Finset.mem_univ _, (h _ hj).mp + ((Finset.mem_filter.mp (Finset.min'_mem dm hm)).2)⟩⟩ + have := (dm.min' hm).isLt + simp only [Fin.val_last]; omega + · rw [dite_eq_right hm] + by_cases hp : dp.Nonempty + · rw [dite_eq_left hp] + have hb : ¬(dp.min' hp).val < C.length := by + intro hj + apply hm + exact ⟨dp.min' hp, Finset.mem_filter.mpr + ⟨Finset.mem_univ _, (h _ hj).mpr + ((Finset.mem_filter.mp (Finset.min'_mem dp hp)).2)⟩⟩ + have := (dp.min' hp).isLt + simp only [Fin.val_last]; omega + · rw [dite_eq_right hp] + +private theorem helper_boundaryFixed_658.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (beta : Fin k) (b₂ : V) (gamma : Fin k) + (sigma : PartialEdgeColoring E k) (i₁ i₂ : Fin (T.length + (1 : ℕ))) + (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos + (by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt i₂ + have := GoldbergSeymour.TreeSequence.positive T + omega); + let mu : PartialEdgeColoring E k := + TwoColorComponentSwap G sigma gamma beta (Sum.inl b₂); + (∀ (f : E), TreeIncidentEdge Bminus f → mu f = phi f) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus → + ∀ e ∈ BoundaryEdges G (TreeSequenceVertexSet S), + mu e = phi e := by + classical + intro V E _ _ G k e0 T phi beta b₂ gamma sigma i₁ i₂ hiorder hspos Bminus mu hfixed S hS e he + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at he + obtain ⟨v, hv, w, hw, hends⟩ := he + apply hfixed + refine ⟨v, hS hv, ?_⟩ + change v ∈ G.ends e + rw [hends]; exact Sym2.mem_mk_left _ _ + +private theorem helper_minusEq_668.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (beta : Fin k) (b₂ : V) (gamma : Fin k) + (sigma : PartialEdgeColoring E k) (i₁ i₂ : Fin (T.length + (1 : ℕ))) + (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos + (by + have := GoldbergSeymour.TreeSequence.positive T + have := Fin.isLt i₂ + have := GoldbergSeymour.TreeSequence.positive T + omega); + let mu : PartialEdgeColoring E k := + TwoColorComponentSwap G sigma gamma beta (Sum.inl b₂); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus → + TreeMissingColors mu S = TreeMissingColors phi S) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus → + ∀ e ∈ BoundaryEdges G (TreeSequenceVertexSet S), mu e = phi e) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus → + ∀ (D : Finset (Fin k)), + TreeColorSetMinusClosed G mu S D ↔ TreeColorSetMinusClosed G phi S D := by + classical + intro V E _ _ G k e0 T phi beta b₂ gamma sigma i₁ i₂ hiorder hspos Bminus mu missingEq + boundaryFixed S hS D + have hb (c : Fin k) : BoundaryColorEdges G mu (TreeSequenceVertexSet S) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet S) c := by + ext e + simp only [BoundaryColorEdges, Finset.mem_filter] + exact and_congr_right (fun he => by rw [boundaryFixed S hS e he]) + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [missingEq S hS] + simp only [hb] + +private theorem helper_closureMu_658.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (beta : Fin k) (b₂ : V) (gamma : Fin k) + (sigma : PartialEdgeColoring E k) (i₁ i₂ : Fin (T.length + (1 : ℕ))) + (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos + (by + omega); + let mu : PartialEdgeColoring E k := + TwoColorComponentSwap G sigma gamma beta (Sum.inl b₂); + (∀ (f : E), TreeIncidentEdge Bminus f → mu f = phi f) → + (∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) → + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + (∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) → + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet Bminus) → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + TashkinovClosure mu + (TreeSequencePrefix Tn (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) + base.closure := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base beta b₂ gamma sigma i₁ i₂ hiorder hspos Bminus mu + hfixed hmissingFixed Tn vertexMem closureVertices hp + have hc := (base.parallel hp).2.1 + have sub := closureVertices hp + have transport {S : TreeSequence G e0} + (route : TashkinovAugmentationSequence phi S base.closure) : + TashkinovAugmentationSequence mu S base.closure := by + unfold TashkinovAugmentationSequence at route ⊢ + induction route using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head S U step tail ih => + have hUR := TashkinovAugmentationSequenceInitialSegment phi U base.closure tail + have hUV := TreeSequenceInitialSegmentVertexSetSubset hUR + obtain ⟨hlen, hSU, c, hcolor, hmiss⟩ := step + refine Relation.ReflTransGen.head ⟨hlen, hSU, c, ?_, ?_⟩ ih + · let j : Fin U.length := Fin.cast hlen.symm (Fin.last S.length) + obtain ⟨i, hi⟩ := U.attaches j + have hiB : TreeIncidentEdge Bminus (U.edge j) := by + refine ⟨U.vertex j.succ, sub (hUV (vertexMem _ _)), ?_⟩ + change U.vertex j.succ ∈ G.ends (U.edge j) + rw [hi]; exact Sym2.mem_mk_left _ _ + exact (hfixed (U.edge j) hiB).trans hcolor + · unfold TreeMissingColors at hmiss ⊢ + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hmiss + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [hmissingFixed v + (sub (hUV (TreeSequenceInitialSegmentVertexSetSubset hSU hv)))] + exact hvc + refine ⟨transport hc.1, ?_⟩ + intro e c v he hv hcolor hmiss + have hb := he + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hb + obtain ⟨u, hu, w, hw, hends⟩ := hb + have hiB : TreeIncidentEdge Bminus e := by + refine ⟨u, sub hu, ?_⟩ + change u ∈ G.ends e + rw [hends]; exact Sym2.mem_mk_left _ _ + apply hc.2 he hv ((hfixed e hiB).symm.trans hcolor) + rw [← hmissingFixed v (sub hv)] + exact hmiss + +private theorem helper_strict_833.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (_ : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (i₁ i₂ : Fin (T.length + (1 : ℕ))) + (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)) + (hsT : (↑i₂ : ℕ) ≤ T.length), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos (by omega); + let C : TreeSequence G e0 := TreeSequencePrefix T (↑i₂ : ℕ) (by omega) hsT; + ∀ (_ : Bminus.length < C.length) + (_ : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) Bminus) + (newInput : PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k ett.rounds e0 newInput) + (_ : + (newSeries.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + C.length), + let stageC : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then C else H.stage j; + ∀ + (_ : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑j : ℕ) ≤ H.dividerCount), + stageC j = H.stage j) + (_ : stageC (Fin.last (H.dividerCount + (1 : ℕ))) = C) + (j : Fin (H.dividerCount + (1 : ℕ))), + (stageC j.castSucc).length < (stageC j.succ).length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H i₁ i₂ hiorder hspos hsT Bminus C + hBCstrict stageToB newInput newSeries strict stageC stageOld stageLast j + rw [stageOld j.castSucc (by have := j.isLt; simp; omega)] + by_cases hj : j.val = H.dividerCount + · have he : j.succ = Fin.last (H.dividerCount + 1) := Fin.ext (by simp; omega) + rw [he, stageLast] + exact lt_of_le_of_lt (stageToB j).1 hBCstrict + · rw [stageOld j.succ (by simp; have := j.isLt; omega)] + exact H.strict j + +private theorem helper_nested_879.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (_ : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (i₁ i₂ : Fin (T.length + (1 : ℕ))) + (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)) + (hsT : (↑i₂ : ℕ) ≤ T.length), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos (by omega); + let C : TreeSequence G e0 := TreeSequencePrefix T (↑i₂ : ℕ) (by omega) hsT; + ∀ + (_ : + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) + (_ : TreeSequenceInitialSegment Bminus C) + (_ : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) Bminus) + (newInput : PartialEdgeColoring E k) (_ : TashkinovSeries G k ett.rounds e0 newInput), + let stageC : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then C else H.stage j; + ∀ + (_ : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑j : ℕ) ≤ H.dividerCount), + stageC j = H.stage j) + (_ : stageC (Fin.last (H.dividerCount + (1 : ℕ))) = C) + (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (stageC j.castSucc) (stageC j.succ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H i₁ i₂ hiorder hspos hsT Bminus C + segTrans hBtoC stageToB newInput newSeries stageC stageOld stageLast j + rw [stageOld j.castSucc (by have := j.isLt; simp; omega)] + by_cases hj : j.val = H.dividerCount + · have he : j.succ = Fin.last (H.dividerCount + 1) := Fin.ext (by simp; omega) + rw [he, stageLast] + exact segTrans (stageToB j) hBtoC + · rw [stageOld j.succ (by simp; have := j.isLt; omega)] + exact H.nested j + +private theorem helper_dividerStage_937.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (_ : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (i₁ i₂ : Fin (T.length + (1 : ℕ))) + (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) (_ : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)) + (hsT : (↑i₂ : ℕ) ≤ T.length), + let C : TreeSequence G e0 := TreeSequencePrefix T (↑i₂ : ℕ) (by omega) hsT; + ∀ (newInput : PartialEdgeColoring E k) (_ : TashkinovSeries G k ett.rounds e0 newInput), + let stageC : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then C else H.stage j; + ∀ + (_ : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑j : ℕ) ≤ H.dividerCount), + stageC j = H.stage j) + (divBound : ∀ (i : Fin H.dividerCount), (↑(H.dividerPosition i) : ℕ) ≤ C.length) + (i : Fin H.dividerCount), + stageC (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) = + TreeSequencePrefix C + (↑(⟨(↑(H.dividerPosition i) : ℕ), Nat.lt_succ_of_le (divBound i)⟩ : + Fin (C.length + (1 : ℕ))) : + ℕ) + (H.dividerPositive i) + (Nat.le_of_lt_succ + (⟨(↑(H.dividerPosition i) : ℕ), Nat.lt_succ_of_le (divBound i)⟩ : + Fin (C.length + (1 : ℕ))).isLt) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H i₁ i₂ hiorder hspos hsT C newInput + newSeries stageC stageOld divBound i + rw [stageOld ⟨i.val + 1, by omega⟩ + (by change i.val + 1 ≤ H.dividerCount; omega), H.dividerStage i] + rw [TreeSequencePrefix, TreeSequencePrefix] + congr 1 + +private theorem hierarchySegmentColorsMono + {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input input' phi mu generating generating' : PartialEdgeColoring E k} + {T C : TreeSequence G e0} + {ett : ExtendedTashkinovTree G k e0 input T generating} + {ett' : ExtendedTashkinovTree G k e0 input' C generating'} + {base : HierarchyBase ett phi} {base' : HierarchyBase ett' mu} + (H : TashkinovHierarchy ett base) (K : TashkinovHierarchy ett' base') + (j : Fin (H.dividerCount + 1)) (j' : Fin (K.dividerCount + 1)) (eta : Fin k) + (hstar : HierarchyStarredStage K j' = HierarchyStarredStage H j) + (hUW : TreeSequenceInitialSegment (K.stage j'.succ) (H.stage j.succ)) + (hUC : TreeSequenceInitialSegment (K.stage j'.succ) C) + (hCT : TreeSequenceInitialSegment C T) + (hfirst : (HierarchyFirstMissingPosition mu C eta).val = + (HierarchyFirstMissingPosition phi C eta).val) + (hfixed : ∀ r : Fin C.length, mu (C.edge r) = phi (C.edge r)) : + HierarchySegmentColors K j' eta ⊆ HierarchySegmentColors H j eta := by + classical + have hcut : min (HierarchyFirstMissingPosition mu C eta).val + (K.stage j'.succ).length = + min (HierarchyFirstMissingPosition phi T eta).val (K.stage j'.succ).length := by + rw [hfirst] + exact HierarchyFirstMissingPositionPrefixCutoff phi C T hCT eta _ hUC.1 + intro c hc + simp only [HierarchySegmentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc ⊢ + obtain ⟨r, hlo, hhi, hcol⟩ := hc + refine ⟨Fin.castLE hUW.1 r, ?_, ?_, ?_⟩ + · simpa only [hstar, Fin.val_castLE] using hlo + · have hr : r.val < (HierarchyFirstMissingPosition phi T eta).val := by + rw [hcut] at hhi + exact lt_of_lt_of_le hhi (Nat.min_le_left _ _) + exact lt_min hr (Fin.castLE hUW.1 r).isLt + · rw [hUW.2.2 r] + have hf := hfixed (Fin.castLE hUC.1 r) + rw [hUC.2.2 r] at hf + exact hf.symm.trans hcol + +private theorem treeSequenceVertexCast {V E : Type*} {G : LooplessMultigraph V E} + {e0 : E} {S U : TreeSequence G e0} (h : S = U) (i : Fin (S.length + 1)) : + U.vertex (Fin.cast (congrArg (fun R : TreeSequence G e0 => R.length + 1) h) i) = + S.vertex i := by + cases h + rfl + +private abbrev helperBranch366Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi), + (0 : ℕ) < ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (_ : GoodHierarchy H) (_ : ℕ) + (alpha beta : Fin k), + alpha ≠ beta → + ∀ (b₂ : V) (gamma : Fin k) (sigma : PartialEdgeColoring E k) + (i₁ i₂ : Fin (T.length + (1 : ℕ))) (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) + (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)) (hsT : (↑i₂ : ℕ) ≤ T.length), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos + (Decidable.byContradiction fun (a : ¬(↑i₂ : ℕ) - (1 : ℕ) ≤ T.length) ↦ by omega); + let C : TreeSequence G e0 := + TreeSequencePrefix T (↑i₂ : ℕ) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑i₂ : ℕ)) ↦ by omega) hsT; + TreeSequenceInitialSegment C T → + Bminus.length < C.length → + let mu : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta (Sum.inl b₂); + (∀ (f : E), TreeIncidentEdge Bminus f → mu f = phi f) → + (∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) → + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + TreeSequenceInitialSegment base.core Bminus → + TreeSequenceInitialSegment Tn Bminus → + C.length = Bminus.length + (1 : ℕ) → + TreeSequenceInitialSegment Bminus C → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) Bminus) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) Bminus) → + (∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) → + (∀ (j : Fin C.length), mu (C.edge j) = phi (C.edge j)) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus → + TreeMissingColors mu S = TreeMissingColors phi S) → + (∀ {r : ℕ} {inp : PartialEdgeColoring E k} (s : TashkinovSeries G k r e0 inp) + (q : Fin r), + s.data.kind q.succ = some TashkinovExtensionKind.PE → + ∃ (v : V) (u : V) (f : E), + s.data.chosenVertex q.succ = some v ∧ + s.data.connectingEdges q.succ = { f } ∧ + v ∈ TreeSequenceVertexSet (s.data.tree q.succ.castSucc) ∧ + u ∉ TreeSequenceVertexSet (s.data.tree q.succ.castSucc) ∧ + G.ends f = s(v, u)) → + ∀ (newInput : PartialEdgeColoring E k) + (newSeries : TashkinovSeries G k ett.rounds e0 newInput) + (hgen : mu = newSeries.data.coloring (Fin.last ett.rounds)) + (htrees : + ∀ (i : Fin ett.rounds), + newSeries.data.tree i.succ.castSucc = + ett.series.data.tree i.succ.castSucc) + (hstored : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + newSeries.data.stored i = ett.series.data.stored i) + (hedges : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = ett.series.data.connectingEdges i) + (hkinds : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + newSeries.data.kind i = ett.series.data.kind i) + (hproper : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (newSeries.data.coloring i)) + (hone : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (newSeries.data.coloring i) e0) + (hstableSeries : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) + (ett.series.data.coloring i.succ) (newSeries.data.coloring i.succ)) + (r : ℕ) (rp : (1 : ℕ) ≤ r) (series : TashkinovSeries G k r e0 newInput) + (above : + TreeSequenceInitialSegment + (series.data.tree (⟨r, by omega⟩ : Fin (r + (2 : ℕ)))) C) + (strict : + (series.data.tree (⟨r, by omega⟩ : Fin (r + (2 : ℕ)))).length < C.length) + (below : + TreeSequenceInitialSegment C (series.data.tree (Fin.last (r + (1 : ℕ))))) + (gen : mu = series.data.coloring (Fin.last r)) + (hr : + { rounds := r, roundsPositive := rp, series := series, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }.rounds = + ett.rounds) + (hs : + { rounds := r, roundsPositive := rp, series := series, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }.series ≍ + newSeries), + MaximumProperty + { replacementInput := newInput, replacementSeries := newSeries, + replacementETT := + { + rounds := r, roundsPositive := rp, series := series, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }, + rungAgreement := hr, seriesPresentation := hs, + finalGeneratingColoring := hgen, ladderTreesAgree := htrees, + storedColorsAgree := hstored, connectingEdgesAgree := hedges, + extensionKindsAgree := hkinds, replacementProper := hproper, + replacementOneUncolored := hone, replacementStable := hstableSeries : + CorrespondingExtendedTashkinovTree G k e0 ett mu C }.replacementETT → + ∃ (baseC : + HierarchyBase + { replacementInput := newInput, replacementSeries := newSeries, + replacementETT := + { + rounds := r, roundsPositive := rp, series := series, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }, + rungAgreement := hr, seriesPresentation := hs, + finalGeneratingColoring := hgen, ladderTreesAgree := htrees, + storedColorsAgree := hstored, connectingEdgesAgree := hedges, + extensionKindsAgree := hkinds, replacementProper := hproper, + replacementOneUncolored := hone, replacementStable := hstableSeries : + CorrespondingExtendedTashkinovTree G k e0 ett mu C }.replacementETT + mu) + (KC : + TashkinovHierarchy + { replacementInput := newInput, replacementSeries := newSeries, + replacementETT := + { + rounds := r, roundsPositive := rp, series := series, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }, + rungAgreement := hr, seriesPresentation := hs, + finalGeneratingColoring := hgen, ladderTreesAgree := htrees, + storedColorsAgree := hstored, connectingEdgesAgree := hedges, + extensionKindsAgree := hkinds, replacementProper := hproper, + replacementOneUncolored := hone, replacementStable := hstableSeries : + CorrespondingExtendedTashkinovTree G k e0 ett mu C }.replacementETT + baseC) + (_goodC : GoodHierarchy KC), + MaximumProperty + { replacementInput := newInput, replacementSeries := newSeries, + replacementETT := + { + rounds := r, roundsPositive := rp, series := series, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }, + rungAgreement := hr, seriesPresentation := hs, + finalGeneratingColoring := hgen, ladderTreesAgree := htrees, + storedColorsAgree := hstored, connectingEdgesAgree := hedges, + extensionKindsAgree := hkinds, replacementProper := hproper, + replacementOneUncolored := hone, replacementStable := hstableSeries : + CorrespondingExtendedTashkinovTree G k e0 ett mu C }.replacementETT ∧ + KC.dividerCount = H.dividerCount + +private theorem helper_branch_366.{u_1, u_2} : + helperBranch366Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H good q alpha beta hne b₂ gamma sigma + i₁ i₂ hiorder hspos hsT Bminus C hCT hBCstrict mu hfixed hmissingFixed segRefl segTrans Tn + coreToB TnToB hlenC hBtoC stageToB starredToB vertexMem fixedC missingEq peSupport newInput + newSeries hgen htrees hstored hedges hkinds hproper hone hstableSeries r rp series above + strict below gen hr hs hMPC + cases hr + cases (show series = newSeries from eq_of_heq hs) + let rep : ExtendedTashkinovTree G k e0 newInput C mu := + ⟨ett.rounds, rp, newSeries, above, strict, below, gen⟩ + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hq : q.succ = Fin.last ett.rounds := Fin.ext (by simp [q]; omega) + have htree : newSeries.data.tree (Fin.last ett.rounds).castSucc = Tn := by + simpa only [hq, Tn] using htrees q + have hkind := hkinds (Fin.last ett.rounds) + have chosenAgree := + helper_chosenAgree_381 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) (@i₁) (@i₂) + (@hiorder) (@hspos) (@hsT) (@peSupport) (@newInput) (@newSeries) (@hedges) (@hq) (@htree) + (@hkind) + have closureVertices := + helper_closureVertices_400 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@i₁) (@i₂) + (@hiorder) (@hspos) (@coreToB) + -- The closure need not be an ordered prefix of the core. + have closureMu := + helper_closureMu_658 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@beta) (@b₂) + (@gamma) (@sigma) (@i₁) (@i₂) (@hiorder) (@hspos) (@hfixed) (@hmissingFixed) (@vertexMem) + (@closureVertices) + let pos : Fin ((newSeries.data.tree (Fin.last ett.rounds).castSucc).length + 1) := + Fin.cast (congrArg (fun S : TreeSequence G e0 => S.length + 1) htree.symm) + base.supportPosition + let baseC : HierarchyBase rep mu := + { core := base.core + closure := base.closure + supportPosition := pos + supportPositive := by simpa [pos] using base.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only [rep] + intro hp + have hpOld := hkind.symm.trans hp + obtain ⟨hv, hc, hu⟩ := base.parallel hpOld + refine ⟨?_, ?_, ?_⟩ + · rw [chosenAgree hpOld] + rw [treeSequenceVertexCast htree.symm base.supportPosition] + exact hv + · simpa [pos, htree] using closureMu hpOld + · simpa [htree] using hu + nonparallel := by + dsimp only [rep] + intro hp + exact (base.nonparallel (fun h => hp (hkind.trans h))).trans htree.symm } + refine ⟨baseC, ?_⟩ + let stageC : Fin (H.dividerCount + 2) → TreeSequence G e0 := + fun j => if j.val = H.dividerCount + 1 then C else H.stage j + have stageOld (j : Fin (H.dividerCount + 2)) (hj : j.val ≤ H.dividerCount) : + stageC j = H.stage j := by + exact ite_eq_right (show j.val ≠ H.dividerCount + 1 by omega) + have stageLast : stageC (Fin.last (H.dividerCount + 1)) = C := by + simp only [stageC, Fin.val_last, ite_true] + have divBound := + helper_divBound_489 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) (@base) (@H) + (@beta) (@b₂) (@gamma) (@sigma) (@i₁) (@i₂) (@hiorder) (@hspos) (@hsT) (@hBtoC) + (@stageToB) (@newInput) (@newSeries) (@rp) (@above) (@strict) (@below) (@gen) (@hs) + let KC : TashkinovHierarchy rep baseC := + { dividerCount := H.dividerCount + stage := stageC + baseStage := by + rw [stageOld 0 (by simp), H.baseStage] + exact htree.symm + terminalStage := stageLast + nested := by + exact helper_nested_879 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) (@base) + (@H) (@i₁) (@i₂) (@hiorder) (@hspos) (@hsT) (@segTrans) (@hBtoC) (@stageToB) + (@newInput) (@newSeries) (@stageOld) (@stageLast) + strict := by + exact helper_strict_833 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) (@base) + (@H) (@i₁) (@i₂) (@hiorder) (@hspos) (@hsT) (@hBCstrict) (@stageToB) (@newInput) + (@newSeries) (@strict) (@stageOld) (@stageLast) + dividerPosition := fun i => ⟨(H.dividerPosition i).val, Nat.lt_succ_of_le (divBound i)⟩ + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := by + exact helper_dividerStage_937 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) + (@base) (@H) (@i₁) (@i₂) (@hiorder) (@hspos) (@hsT) (@newInput) (@newSeries) + (@stageOld) (@divBound) + coreInsideFirst := by + by_cases hd : H.dividerCount = 0 + · have he : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp; omega) + rw [he, stageLast] + exact segTrans coreToB hBtoC + · rw [stageOld ⟨1, by omega⟩ (by change 1 ≤ H.dividerCount; omega)] + exact H.coreInsideFirst } + have ordinaryEq (j : Fin (H.dividerCount + 1)) : + KC.stage j.castSucc = H.stage j.castSucc := + stageOld j.castSucc (Nat.le_of_lt_succ j.isLt) + have starredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage KC j = HierarchyStarredStage H j := by + refine Fin.cases rfl (fun i => ordinaryEq i.succ) j + have terminalMissing : TreeMissingColors mu Tn = TreeMissingColors phi Tn := + missingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToB) + have storedEq : TashkinovStoredColors newSeries.data (Fin.last ett.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + unfold TashkinovStoredColors + simp only [hstored, ← hgen, ← ett.generatingColoring, htree, terminalMissing] + rfl + have indexedStoredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt KC j = HierarchyStoredColorsAt H j := by + change TashkinovStoredColors newSeries.data (Fin.last ett.rounds) \ + TreeMissingColors mu (HierarchyStarredStage KC j) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) \ + TreeMissingColors phi (HierarchyStarredStage H j) + rw [storedEq, starredEq, missingEq _ + (TreeSequenceInitialSegmentVertexSetSubset (starredToB j))] + have stageMissingEq (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors KC j = HierarchyStageMissingColors H j := by + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors mu (newSeries.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi Tn + rw [htree, terminalMissing] + · change TreeMissingColors mu (KC.stage i.succ.castSucc) = + TreeMissingColors phi (H.stage i.succ.castSucc) + rw [ordinaryEq] + exact missingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageToB i.succ)) + refine ⟨KC, ?_⟩ + -- Changing missingness only at the final position leaves the capped cutoff unchanged. + have cutoffEq := + helper_cutoffEq_570 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) (@beta) (@b₂) + (@gamma) (@sigma) (@i₁) (@i₂) (@hiorder) (@hspos) (@hsT) (@hmissingFixed) (@hlenC) + (@hBtoC) (@vertexMem) (@newInput) (@newSeries) + have nextPrefix (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (KC.stage j.succ) (H.stage j.succ) ∧ + TreeSequenceInitialSegment (KC.stage j.succ) C := by + change TreeSequenceInitialSegment (stageC j.succ) (H.stage j.succ) ∧ + TreeSequenceInitialSegment (stageC j.succ) C + by_cases hj : j.val = H.dividerCount + · have he : j.succ = Fin.last (H.dividerCount + 1) := Fin.ext (by simp; omega) + rw [he, stageLast, H.terminalStage] + exact ⟨hCT, segRefl C⟩ + · rw [stageOld j.succ (by simp; have := j.isLt; omega)] + exact ⟨segRefl _, segTrans (stageToB ⟨j.val + 1, by omega⟩) hBtoC⟩ + have segmentSubset (j : Fin (H.dividerCount + 1)) (eta : Fin k) : + HierarchySegmentColors KC j eta ⊆ HierarchySegmentColors H j eta := by + exact hierarchySegmentColorsMono H KC j j eta (starredEq j) + (nextPrefix j).1 (nextPrefix j).2 hCT (cutoffEq eta) fixedC + have boundaryFixed := + helper_boundaryFixed_658 (@G) (@k) (@e0) (@T) (@phi) (@beta) (@b₂) (@gamma) (@sigma) (@i₁) + (@i₂) (@hiorder) (@hspos) (@hfixed) + have minusEq := + helper_minusEq_668 (@G) (@k) (@e0) (@T) (@phi) (@beta) (@b₂) (@gamma) (@sigma) (@i₁) (@i₂) + (@hiorder) (@hspos) (@missingEq) (@boundaryFixed) + have refreshEq (i : Fin H.dividerCount) : + ((TreeSequenceVertexSet (KC.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage KC i.castSucc)).biUnion + fun v => MissingColors G mu v) = + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun v => MissingColors G phi v) := by + rw [ordinaryEq, starredEq] + apply Finset.biUnion_congr rfl + intro v hv + exact hmissingFixed v (TreeSequenceInitialSegmentVertexSetSubset + (stageToB i.succ) (Finset.mem_sdiff.mp hv).1) + let goodC : GoodHierarchy KC := + { gamma := good.gamma + twoColors := by + intro j eta he + exact good.twoColors j eta (indexedStoredEq j ▸ he) + avoidance := by + intro j eta he c hc + have hav := good.avoidance j eta (indexedStoredEq j ▸ he) hc + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · rw [stageMissingEq]; exact (Finset.mem_sdiff.mp hav).1 + · intro hs + exact (Finset.mem_sdiff.mp hav).2 (segmentSubset j eta hs) + disjointPairs := by + intro j eta theta he ht hne + exact good.disjointPairs j eta theta (indexedStoredEq j ▸ he) + (indexedStoredEq j ▸ ht) hne + uniqueRefresh := by + intro i + simpa only [indexedStoredEq, refreshEq] using good.uniqueRefresh i + parallelBase := by + dsimp only + intro hp + have hpOld := hkind.symm.trans hp + have hold := good.parallelBase hpOld + change ¬TreeColorSetMinusClosed G mu base.core + ((HierarchyStoredColorsAt KC 0).biUnion (good.gamma 0)) ∧ + 4 ≤ ((TreeMissingColors mu (newSeries.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors mu base.closure) \ + (HierarchyStoredColorsAt KC 0).biUnion (good.gamma 0)).card + rw [indexedStoredEq, minusEq _ (TreeSequenceInitialSegmentVertexSetSubset coreToB), + htree, terminalMissing, missingEq _ (closureVertices hpOld)] + exact hold + minusClosed := by + intro i + rw [ordinaryEq, indexedStoredEq, + minusEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageToB i.succ))] + exact good.minusClosed i } + exact ⟨goodC, hMPC, rfl⟩ + +private theorem helper_rebuild_367.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + MaximumProperty ett → + (0 : ℕ) < ett.rounds → + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) + (_ : GoodHierarchy H) (_ : ℕ) (alpha beta : Fin k), + alpha ≠ beta → + ∀ (b₂ : V), + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (gamma : Fin k) (sigma : PartialEdgeColoring E k) (i₁ i₂ : Fin (T.length + (1 : ℕ))) + (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)) + (hsT : (↑i₂ : ℕ) ≤ T.length), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos + (Decidable.byContradiction fun (a : ¬(↑i₂ : ℕ) - (1 : ℕ) ≤ T.length) ↦ by omega); + let C : TreeSequence G e0 := + TreeSequencePrefix T (↑i₂ : ℕ) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑i₂ : ℕ)) ↦ by omega) hsT; + TreeSequenceInitialSegment A Bminus → + TreeSequenceInitialSegment C T → + Bminus.length < C.length → + (∃ (g : E), TreeSequenceAdjoinEdge Bminus g C) → + let mu : PartialEdgeColoring E k := + TwoColorComponentSwap G sigma gamma beta (Sum.inl b₂); + IsProperEdgeColoring G mu → + IsOneEdgeUncolored mu e0 → + (∀ (f : E), TreeIncidentEdge Bminus f → mu f = phi f) → + (∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) → + ∃ (corrC : CorrespondingExtendedTashkinovTree G k e0 ett mu C) (baseC : + HierarchyBase corrC.replacementETT mu) (KC : + TashkinovHierarchy corrC.replacementETT baseC) (_goodC : GoodHierarchy KC), + MaximumProperty corrC.replacementETT ∧ + KC.dividerCount = H.dividerCount := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hproper hone hlower base H good q alpha + beta hne b₂ A gamma sigma i₁ i₂ hiorder hspos hsT Bminus C hAB hCT hBCstrict hBCadjoin mu + hproperMu honeMu hfixed hmissingFixed + classical + have segRefl (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans + (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans + (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + have stageSegment : ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1), + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + intro a d + induction d with + | zero => intro h; exact segRefl _ + | succ d ih => + intro h + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + have lastZero (h : H.dividerCount = 0) : A = base.core := by + simp [A, HierarchyStarredStage, h, Fin.last] + have lastPositive (h : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + unfold A HierarchyStarredStage + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) + · exact False.elim (h (by simpa using congrArg Fin.val hz)) + · rw [hi, Fin.cases_succ] + congr 1 + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + have coreToA : TreeSequenceInitialSegment base.core A := by + by_cases h : H.dividerCount = 0 + · rw [lastZero h]; exact segRefl _ + · rw [lastPositive h] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + have hs' : TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) + (H.stage ⟨H.dividerCount, by omega⟩) := by simpa only [he] using hs + exact segTrans H.coreInsideFirst hs' + have TnToCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨u⟩⟩ := base.parallel hp + exact u.leftSegment + · rw [base.nonparallel hp]; exact segRefl _ + have coreToB := segTrans coreToA hAB + have TnToB := segTrans TnToCore coreToB + obtain ⟨g, hattach⟩ := hBCadjoin + obtain ⟨hlenC, hBtoC, hg⟩ := hattach + have TnToC := segTrans TnToB hBtoC + have TnStrictC : Tn.length < C.length := lt_of_le_of_lt TnToB.1 hBCstrict + have stageToB (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) Bminus := by + by_cases h : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := + Fin.ext (by have := j.isLt; simp only [Fin.val_castSucc, Fin.val_zero]; omega) + rw [hj, H.baseStage] + exact TnToB + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + have he : j.val + (H.dividerCount - j.val) = H.dividerCount := by omega + have hs' : TreeSequenceInitialSegment (H.stage j.castSucc) + (H.stage ⟨H.dividerCount, by omega⟩) := by + convert hs using 1 + · apply congrArg H.stage; apply Fin.ext; rfl + · apply congrArg H.stage; apply Fin.ext; exact he.symm + exact segTrans hs' (by rw [← lastPositive h]; exact hAB) + have starredToB (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) Bminus := by + refine Fin.cases coreToB (fun i => ?_) j + exact stageToB i.succ + have vertexMem (S : TreeSequence G e0) (i : Fin (S.length + 1)) : + S.vertex i ∈ TreeSequenceVertexSet S := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, rfl⟩ + have fixedC (j : Fin C.length) : mu (C.edge j) = phi (C.edge j) := by + obtain ⟨i, hi⟩ := C.attaches j + let ib : Fin (Bminus.length + 1) := ⟨i.val, by have := i.isLt; have := j.isLt; omega⟩ + have hv : C.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) = Bminus.vertex ib := by + exact hBtoC.2.1 ib + apply hfixed + refine ⟨Bminus.vertex ib, vertexMem _ _, ?_⟩ + change Bminus.vertex ib ∈ G.ends (C.edge j) + rw [hi, hv] + exact Sym2.mem_mk_right _ _ + have missingEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus) : + TreeMissingColors mu S = TreeMissingColors phi S := by + unfold TreeMissingColors + apply Finset.biUnion_congr rfl + intro v hv + exact hmissingFixed v (hS hv) + have hstable : StableColoring Tn + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi mu := by + constructor + · intro f ⟨v, hv, hvf⟩ _ + exact hfixed f ⟨v, TreeSequenceInitialSegmentVertexSetSubset TnToB hv, hvf⟩ + · intro v hv + exact hmissingFixed v (TreeSequenceInitialSegmentVertexSetSubset TnToB hv) + have hmod : ModColoring ett mu := + Td G k e0 input T phi ett hMP hpositive hlower mu hproperMu honeMu + (by simpa [ett.generatingColoring] using hstable) + have terminalRoute := + @helper_terminalRoute_259 V E inferInstance inferInstance inferInstance G k e0 input T + phi ett hpositive q beta b₂ gamma sigma i₁ i₂ hiorder hspos hsT hCT hmissingFixed + segTrans commonPrefix hlenC hBtoC TnToC TnStrictC fixedC + obtain ⟨corrC⟩ := hmod.2.2 C TnToC TnStrictC terminalRoute + have hMPC := MaximumPropertyTransport G k e0 ett mu hmod C corrC hMP + refine ⟨corrC, ?_⟩ + have peSupport {r : ℕ} {inp : PartialEdgeColoring E k} + (s : TashkinovSeries G k r e0 inp) (q : Fin r) + (hp : s.data.kind q.succ = some TashkinovExtensionKind.PE) : + ∃ v u f, s.data.chosenVertex q.succ = some v ∧ + s.data.connectingEdges q.succ = {f} ∧ + v ∈ TreeSequenceVertexSet (s.data.tree q.succ.castSucc) ∧ + u ∉ TreeSequenceVertexSet (s.data.tree q.succ.castSucc) ∧ + G.ends f = s(v, u) := by + have step := s.certified q.succ + generalize hi : q.succ = i at step + cases step with + | initial _ _ _ _ _ kind => + rw [hi, kind] at hp; cases hp + | SE j _ _ _ _ _ choice _ coloring stored edges kind => + rw [hi, kind] at hp; cases hp + | RE j _ _ _ _ available coloring stored edges kind => + rw [hi, kind] at hp; cases hp + | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + simpa only [hi] using + (show ∃ v u f, s.data.chosenVertex j.succ = some v ∧ + s.data.connectingEdges j.succ = {f} ∧ + v ∈ TreeSequenceVertexSet (s.data.tree j.succ.castSucc) ∧ + u ∉ TreeSequenceVertexSet (s.data.tree j.succ.castSucc) ∧ + G.ends f = s(v, u) from + ⟨choice.vertex, choice.otherEndpoint, choice.edge, vertex, edges, + choice.vertexDefective.1, choice.otherOutside, choice.edgeEnds⟩) + rcases corrC with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproper, hone, hstableSeries⟩ + cases newETT with + | mk r rp series above strict below gen => + exact @helper_branch_366 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett hpositive base H good q alpha beta hne b₂ gamma sigma i₁ i₂ hiorder + hspos hsT hCT hBCstrict hfixed hmissingFixed segRefl segTrans coreToB TnToB hlenC hBtoC + stageToB starredToB vertexMem fixedC missingEq peSupport newInput newSeries hgen htrees + hstored hedges hkinds hproper hone hstableSeries r rp series above strict below gen hr + hs hMPC +private theorem helper_continuation_1138.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + MaximumProperty ett → + (0 : ℕ) < ett.rounds → + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) + (_ : GoodHierarchy H) (q : ℕ), + H.dividerCount < q → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K), + K.dividerCount < q → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (a₂ b₂ : V), + b₂ ∉ TreeSequenceVertexSet (HierarchyStarredStage H (Fin.last H.dividerCount)) → + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + beta ∈ TreeMissingColors phi A → + ∀ (gamma : Fin k), + gamma ≠ beta → + ∀ (sigma : PartialEdgeColoring E k) + (Q₂ : (TwoColorIncidenceGraph G sigma gamma beta).Walk (Sum.inl a₂) (Sum.inl b₂)), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (f : E), TreeIncidentEdge T f → sigma f = phi f) → + TreeExitPath T sigma gamma beta a₂ b₂ Q₂ → + gamma ∈ MissingColors G sigma b₂ → + ∀ (i₁ i₂ : Fin (T.length + (1 : ℕ))) (hiorder : (↑i₁ : ℕ) < (↑i₂ : ℕ)) + (hspos : (1 : ℕ) ≤ (↑i₂ : ℕ) - (1 : ℕ)) (hsT : (↑i₂ : ℕ) ≤ T.length), + let Bminus : TreeSequence G e0 := + TreeSequencePrefix T ((↑i₂ : ℕ) - (1 : ℕ)) hspos + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let C : TreeSequence G e0 := + TreeSequencePrefix T (↑i₂ : ℕ) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + hsT; + TreeSequenceInitialSegment A Bminus → + TreeSequenceInitialSegment Bminus C → + TreeSequenceInitialSegment C T → + TreeSequenceInitialSegment Bminus T → + Bminus.length < C.length → + C.vertex (Fin.last C.length) = b₂ → + b₂ ∉ TreeSequenceVertexSet Bminus → + (∃ (g : E), TreeSequenceAdjoinEdge Bminus g C) → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hproper hone hlower base H good q + hdivider hfewer alpha beta hne a₂ b₂ houtside A betaA gamma hgb sigma Q₂ hsproper hsone + sigma_fixed hQ₂ hgSigma i₁ i₂ hiorder hspos hsT Bminus C hAB hBC hCT hBT hBCstrict hbC + hbNotB hBCadjoin + let K₂ := TwoColorComponent G sigma gamma beta (Sum.inl b₂) + have hKtree : ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ K₂ ↔ v = b₂ := + TreeExitComponentMeetsTreeOnlyAtExit T sigma gamma beta b₂ hsproper hgSigma + ⟨a₂, Q₂, hQ₂⟩ + let mu := TwoColorComponentSwap G sigma gamma beta (Sum.inl b₂) + have hproperMu : IsProperEdgeColoring G mu := + TwoColorComponentSwapProper G sigma gamma beta hgb hsproper _ + have honeMu : IsOneEdgeUncolored mu e0 := by + constructor + · simp [mu, TwoColorComponentSwap, hsone.1] + · intro f hfe + obtain ⟨c, hc⟩ := hsone.2 f hfe + by_cases hf : Sum.inr f ∈ K₂ + · by_cases ha : sigma f = some gamma + · exact ⟨beta, by simp [mu, TwoColorComponentSwap, K₂, hf, ha]⟩ + · by_cases hb : sigma f = some beta + · exact ⟨gamma, by simp [mu, TwoColorComponentSwap, K₂, hf, hb, hgb.symm]⟩ + · refine ⟨c, ?_⟩ + change (if Sum.inr f ∈ K₂ then + if sigma f = some gamma then some beta + else if sigma f = some beta then some gamma else sigma f + else sigma f) = some c + rw [ite_eq_left hf, ite_eq_right ha, ite_eq_right hb] + exact hc + · exact ⟨c, by simp [mu, TwoColorComponentSwap, K₂, hf, hc]⟩ + have hfixed : ∀ f, TreeIncidentEdge Bminus f → mu f = phi f := by + intro f hf + obtain ⟨v, hv, hvf⟩ := hf + have hvT := TreeSequenceInitialSegmentVertexSetSubset hBT hv + have hvK : Sum.inl v ∉ K₂ := by + intro h + exact hbNotB ((hKtree v hvT).mp h ▸ hv) + have unchanged : mu f = sigma f := by + by_cases heK : Sum.inr f ∈ K₂ + · have noColor : ¬ (sigma f = some gamma ∨ sigma f = some beta) := by + intro hc + have ha : (TwoColorIncidenceGraph G sigma gamma beta).Adj + (Sum.inl v) (Sum.inr f) := ⟨hvf, hc⟩ + exact hvK ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj ha).trans heK) + push Not at noColor + simp [mu, TwoColorComponentSwap, K₂, heK, noColor.1, noColor.2] + · simp [mu, TwoColorComponentSwap, K₂, heK] + exact unchanged.trans (sigma_fixed f ⟨v, hvT, hvf⟩) + have hmissingFixed : ∀ v ∈ TreeSequenceVertexSet Bminus, + MissingColors G mu v = MissingColors G phi v := by + intro v hv + ext c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + have same : (∃ f, Incident G v f ∧ mu f = some c) ↔ + (∃ f, Incident G v f ∧ phi f = some c) := by + constructor <;> rintro ⟨f, hf, hc⟩ + · exact ⟨f, hf, (hfixed f ⟨v, hv, hf⟩).symm.trans hc⟩ + · exact ⟨f, hf, (hfixed f ⟨v, hv, hf⟩).trans hc⟩ + exact not_congr same + have hbMissing : beta ∈ MissingColors G mu b₂ := + (TwoColorComponentSwapMissingBehavior G sigma gamma beta hgb hsproper + (Sum.inl b₂)).2.1 b₂ (show Sum.inl b₂ ∈ K₂ from rfl) hgSigma + have rebuild := + @helper_rebuild_367 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett hMP hpositive hproper hone hlower base H good q alpha beta hne b₂ gamma + sigma i₁ i₂ hiorder hspos hsT hAB hCT hBCstrict hBCadjoin hproperMu honeMu hfixed + hmissingFixed + obtain ⟨corrC, baseC, KC, goodC, hMPC, hdiv⟩ := rebuild + have elementaryC : ColoredVertexSetElementary G mu (TreeSequenceVertexSet C) := + hfewer corrC.replacementETT corrC.rungAgreement hMPC baseC KC goodC + (by rw [hdiv]; exact hdivider) + obtain ⟨v, hvA, hbv⟩ := Finset.mem_biUnion.mp betaA + have hvB := TreeSequenceInitialSegmentVertexSetSubset hAB hvA + have hvC := TreeSequenceInitialSegmentVertexSetSubset hBC hvB + have hbCmem : b₂ ∈ TreeSequenceVertexSet C := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last C.length, hbC⟩ + have hvb : v ≠ b₂ := by intro h; exact houtside (h ▸ hvA) + have hbvMu : beta ∈ MissingColors G mu v := by + rw [hmissingFixed v hvB] + exact hbv + exact (Finset.disjoint_left.mp (elementaryC hvC hbCmem hvb)) hbvMu hbMissing + +lemma Step1CaseOneOutsideStar {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (hdivider : H.dividerCount < q) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (_ : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (hterminal : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (hElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (hbeta : beta ∈ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (_ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (_ : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (_ : a₁ ≠ a₂) (_ : b₁ ≠ b₂) + (horder : TreeVertexOrder T b₁ b₂) + (f₁ f₂ : E) + (_ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₂ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : Incident G b₁ f₁) (hif₂ : Incident G b₂ f₂) + (_ : Sum.inr f₁ ∈ P₁.support) + (_ : Sum.inr f₂ ∈ P₂.support) + (houtside : b₂ ∉ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) : False := by + classical + have segment_trans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : TreeSequenceInitialSegment S W := by + refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + have stage_segment : ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1), + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + intro a d + induction d with + | zero => intro h; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ d ih => + intro h + exact segment_trans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + have hAT : TreeSequenceInitialSegment A T := by + by_cases hz : H.dividerCount = 0 + · have hl : Fin.last H.dividerCount = (0 : Fin (H.dividerCount + 1)) := + Fin.ext (by simp [hz]) + have ht : (1 : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp [hz]) + simpa [A, hl, HierarchyStarredStage, ht, H.terminalStage] using H.coreInsideFirst + · have hs : A = H.stage ⟨H.dividerCount, by omega⟩ := by + unfold A HierarchyStarredStage + obtain hz' | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) + · exact False.elim (hz (by simpa using congrArg Fin.val hz')) + · rw [hi, Fin.cases_succ] + congr 1 + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + have hh := stage_segment H.dividerCount 1 (by omega) + have ht : (⟨H.dividerCount + 1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa only [← hs, ht, H.terminalStage] using hh + have hbT : b₂ ∈ TreeSequenceVertexSet T := hP₂.2.2.2.1 + have betaReserved : beta ∈ (HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)) := by + by_contra hn + have hempty := hterminal beta (Finset.mem_sdiff.mpr ⟨hbeta, hn⟩) + rw [hempty] at hf₂ + exact Finset.notMem_empty _ hf₂ + have betaA : beta ∈ TreeMissingColors phi A := by + obtain ⟨eta, he, hbe⟩ := Finset.mem_biUnion.mp betaReserved + exact (GoodHierarchyReservedDisjoint good (Fin.last H.dividerCount)).1 eta + ((HierarchyTerminalStoredColorsSubsetLast H).1 he) hbe + have hdegree : MaximumDegree G + 1 ≤ k := by + have hinit := ett.series.certified 0 + cases hinit with + | initial triple => exact triple.2.2.1 + obtain ⟨gamma, hgamma⟩ := MissingColorsNonemptyOfMaximumDegree G phi hdegree b₂ + have hgb : gamma ≠ beta := by + intro h + have hn : gamma ∉ PresentColors G phi b₂ := by simpa [MissingColors] using hgamma + apply hn + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f₂, hif₂, h.symm ▸ (Finset.mem_filter.mp hf₂).2⟩ + have hgReserved : gamma ∉ (HierarchyStoredColorsAt H + (Fin.last H.dividerCount)).biUnion (good.gamma (Fin.last H.dividerCount)) := by + intro hg + obtain ⟨eta, heta, hge⟩ := Finset.mem_biUnion.mp hg + have hgm := (GoodHierarchyReservedDisjoint good (Fin.last H.dividerCount)).1 + eta heta hge + obtain ⟨v, hvA, hgv⟩ := Finset.mem_biUnion.mp hgm + have hvT := TreeSequenceInitialSegmentVertexSetSubset hAT hvA + have hvb : v ≠ b₂ := by intro h; exact houtside (h ▸ hvA) + exact (Finset.disjoint_left.mp (hElementary hvT hbT hvb)) hgv hgamma + have hgTerminal : gamma ∉ (HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)) := by + intro hg + obtain ⟨eta, heta, hge⟩ := Finset.mem_biUnion.mp hg + exact hgReserved (Finset.mem_biUnion.mpr ⟨eta, + (HierarchyTerminalStoredColorsSubsetLast H).1 heta, hge⟩) + have hgClosed : TreeColorSetClosed G phi T {gamma} := by + intro c hc + have he : c = gamma := Finset.mem_singleton.mp hc + subst c + apply hterminal gamma + exact Finset.mem_sdiff.mpr ⟨Finset.mem_biUnion.mpr ⟨b₂, hbT, hgamma⟩, hgTerminal⟩ + have first : ∃ (sigma : PartialEdgeColoring E k) + (Q₂ : (TwoColorIncidenceGraph G sigma gamma beta).Walk (Sum.inl a₂) (Sum.inl b₂)), + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ + (∀ f, TreeIncidentEdge T f → sigma f = phi f) ∧ + (∀ v ∈ TreeSequenceVertexSet T, MissingColors G sigma v = MissingColors G phi v) ∧ + TreeExitPath T sigma gamma beta a₂ b₂ Q₂ := by + by_cases hag : alpha = gamma + · subst gamma + exact ⟨phi, P₂, hproper, hone, fun _ _ => rfl, fun _ _ => rfl, hP₂⟩ + · obtain ⟨sigma, hrec, hsproper, hsone, hsub, hout, hcopy⟩ := + P2716_T1_OutsideExitTransport G T phi alpha gamma beta hag hne hgb + hproper hone hclosed hgClosed + obtain ⟨Q₂, hQ₂, _, _⟩ := hcopy T (fun _ h => h) a₂ b₂ P₂ hP₂ hbT + obtain ⟨_, _, hs, _, fixed⟩ := OutsideKempeRecoloringStable G e0 T ∅ + phi sigma alpha gamma hproper hone hrec + exact ⟨sigma, Q₂, hsproper, hsone, fixed, hs.2, hQ₂⟩ + obtain ⟨sigma, Q₂, hsproper, hsone, sigma_fixed, sigma_missing, hQ₂⟩ := first + have hgSigma : gamma ∈ MissingColors G sigma b₂ := by + rw [sigma_missing b₂ hbT] + exact hgamma + obtain ⟨i₁, i₂, hi₁, hi₂, hiorder⟩ := horder + have hAs : A.length < i₂.val := by + by_contra h + have hiA : i₂.val ≤ A.length := by omega + let r : Fin (A.length + 1) := ⟨i₂.val, by omega⟩ + have hr : Fin.castLE (Nat.succ_le_succ hAT.1) r = i₂ := Fin.ext rfl + have hv : A.vertex r = b₂ := + (hAT.2.1 r).symm.trans (by simpa only [hr] using hi₂) + apply houtside + change b₂ ∈ TreeSequenceVertexSet A + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨r, hv⟩ + have hspos : 1 ≤ i₂.val - 1 := by have := A.positive; omega + have hsT : i₂.val ≤ T.length := Nat.le_of_lt_succ i₂.isLt + let Bminus := TreeSequencePrefix T (i₂.val - 1) hspos (by omega) + let C := TreeSequencePrefix T i₂.val (by omega) hsT + have hAB : TreeSequenceInitialSegment A Bminus := by + refine ⟨by simpa [Bminus, TreeSequencePrefix] using (show A.length ≤ i₂.val - 1 by omega), + ?_, ?_⟩ + · intro i + change T.vertex (Fin.castLE _ (Fin.castLE _ i)) = A.vertex i + exact hAT.2.1 i + · intro i + change T.edge (Fin.castLE _ (Fin.castLE _ i)) = A.edge i + exact hAT.2.2 i + have hBC : TreeSequenceInitialSegment Bminus C := by + refine ⟨by simp [Bminus, C, TreeSequencePrefix], ?_, ?_⟩ + · intro i; rfl + · intro i; rfl + have hCT : TreeSequenceInitialSegment C T := ⟨hsT, fun _ => rfl, fun _ => rfl⟩ + have hBT := segment_trans hBC hCT + have hBCstrict : Bminus.length < C.length := by + simp only [Bminus, C, TreeSequencePrefix] + omega + have hbC : C.vertex (Fin.last C.length) = b₂ := by + change T.vertex ⟨i₂.val, _⟩ = b₂ + exact hi₂ + have hbNotB : b₂ ∉ TreeSequenceVertexSet Bminus := by + intro hb + obtain ⟨r, hr⟩ := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hb + have heq := T.vertex_injective ((hBT.2.1 r).trans (hr.trans hi₂.symm)) + have hv := congrArg Fin.val heq + have hrl := r.isLt + change r.val < i₂.val - 1 + 1 at hrl + simp only [Fin.val_castLE] at hv + omega + have hBCadjoin : ∃ g, TreeSequenceAdjoinEdge Bminus g C := by + have hlen : C.length = Bminus.length + 1 := by + simp only [Bminus, C, TreeSequencePrefix] + omega + exact ⟨C.edge (Fin.cast hlen.symm (Fin.last Bminus.length)), hlen, hBC, rfl⟩ + exact helper_continuation_1138 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hMP) (@hpositive) + (@hproper) (@hone) (@hlower) (@base) (@H) (@good) (@q) (@hdivider) (@hfewer) (@alpha) + (@beta) (@hne) (@a₂) (@b₂) (@houtside) (@betaA) (@gamma) (@hgb) (@sigma) (@Q₂) (@hsproper) + (@hsone) (@sigma_fixed) (@hQ₂) (@hgSigma) (@i₁) (@i₂) (@hiorder) (@hspos) (@hsT) (@hAB) + (@hBC) (@hCT) (@hBT) (@hBCstrict) (@hbC) (@hbNotB) (@hBCadjoin) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoInsidePositiveDivider.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoInsidePositiveDivider.lean new file mode 100644 index 0000000000..10e0cd2729 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoInsidePositiveDivider.lean @@ -0,0 +1,771 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Step1Case Two Inside Positive Divider + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_continuation_355.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), (0 : ℕ) < ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : GoodHierarchy H), + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi (ett.series.data.tree (Fin.last + ett.rounds).castSucc)).card → + ∀ (alpha beta : Fin k) (a₁ b₁ a₂ b₂ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl + a₂) (Sum.inl b₂)), ( + ∀ x ∈ P₁.support, x ∉ P₂.support) → a₁ ≠ a₂ → + ∀ (theta : Fin k), theta ≠ beta → ( + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) (corr : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi + sigma → MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT base') (good' : GoodHierarchy K), K.dividerCount < H.dividerCount → (2 + : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ (TreeMissingColors sigma + (corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc)).card → TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → a ∈ TreeMissingColors sigma T' → TreeColorSetClosed G sigma T' ({ a } + : Finset (Fin k)) → + ∀ (u₁ v₁ u₂ v₂ : V) (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₂) (Sum.inl v₂)), TreeExitPath + T' sigma a b u₁ v₁ Q₁ → TreeExitPath T' sigma a b u₂ v₂ Q₂ → ( + ∀ x ∈ Q₁.support, x ∉ Q₂.support) → u₁ ≠ u₂ → False) → (0 : ℕ) < H.dividerCount → + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); A = H.stage + (Fin.last H.dividerCount).castSucc → + let nu : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha theta; + IsProperEdgeColoring G nu → IsOneEdgeUncolored nu e0 → + ∀ (Q₁ : (TwoColorIncidenceGraph G nu theta beta).Walk (Sum.inl a₁) (Sum.inl b₁)), TreeExitPath + A nu theta beta a₁ b₁ Q₁ → Q₁.support = P₁.support → + ∀ (Q₂ : (TwoColorIncidenceGraph G nu theta beta).Walk (Sum.inl a₂) (Sum.inl b₂)), TreeExitPath + A nu theta beta a₂ b₂ Q₂ → Q₂.support = P₂.support → TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ⊆ TreeSequenceVertexSet T → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi nu → ( + ∀ {B : TreeSequence G e0}, TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet T → + TreeMissingColors nu B = TreeMissingColors phi B) → theta ∈ TreeMissingColors nu A → + TreeColorSetClosed G nu A ({ theta } : Finset (Fin k)) → + ∀ (corrNu : CorrespondingExtendedTashkinovTree G k e0 ett nu T), MaximumProperty + corrNu.replacementETT → + ∀ (baseNu : HierarchyBase corrNu.replacementETT nu) (HNu : TashkinovHierarchy + corrNu.replacementETT baseNu) (goodNu : GoodHierarchy HNu), SameGoodHierarchy good goodNu + → H.dividerCount = HNu.dividerCount → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H good hlarge alpha beta a₁ b₁ a₂ b₂ P₁ + P₂ hpaths₁₂ ha₁₂ theta hthetaBeta hnoSmaller hdividerPositive A hAstage nu hnuProper hnuOne + Q₁ hQ₁ hsQ₁ Q₂ hQ₂ hsQ₂ ladderSub hstableLadder treeMissingFixed hthetaNu hthetaClosedNu + corrNu hMPNu baseNu HNu goodNu hsame hcount + have hstage : HEq H.stage HNu.stage := hsame.1.2.2.1 + have sameStage (i : Fin (H.dividerCount + 2)) : + H.stage i = HNu.stage (Fin.cast (congrArg (fun d => d + 2) hcount) i) := by + have stageEq {d d' : ℕ} (hc : d = d') + (f : Fin (d + 2) → TreeSequence G e0) + (g : Fin (d' + 2) → TreeSequence G e0) (he : HEq f g) + (j : Fin (d + 2)) : f j = g (Fin.cast (congrArg (fun d => d + 2) hc) j) := by + cases hc + cases he + rfl + exact stageEq hcount H.stage HNu.stage hstage i + let r : Fin (HNu.dividerCount + 1) := Fin.last HNu.dividerCount + have hr : 1 ≤ r.val := by simp [r]; omega + have hANu : A = HNu.stage r.castSucc := by + rw [hAstage, sameStage] + apply congrArg HNu.stage + apply Fin.ext + simp [r] + obtain ⟨ettPrefix, hMPPrefix, hroundPrefix, hseriesPrefix, basePrefix, + hcorePrefix, hclosurePrefix, hsupportPrefix, K, hcountPrefix, hstagesPrefix, + hdividersPrefix, goodPrefix, hcolorsPrefix, hminusPrefix⟩ := + GoodHierarchyPrefixRepackage G k e0 corrNu.replacementInput T nu nu + corrNu.replacementETT hMPNu baseNu HNu goodNu r hr + let corrPrefix : CorrespondingExtendedTashkinovTree G k e0 ett nu + (HNu.stage r.castSucc) := + { replacementInput := corrNu.replacementInput + replacementSeries := corrNu.replacementSeries + replacementETT := ettPrefix + rungAgreement := hroundPrefix.trans corrNu.rungAgreement + seriesPresentation := hseriesPrefix.trans corrNu.seriesPresentation + finalGeneratingColoring := corrNu.finalGeneratingColoring + ladderTreesAgree := corrNu.ladderTreesAgree + storedColorsAgree := corrNu.storedColorsAgree + connectingEdgesAgree := corrNu.connectingEdgesAgree + extensionKindsAgree := corrNu.extensionKindsAgree + replacementProper := corrNu.replacementProper + replacementOneUncolored := corrNu.replacementOneUncolored + replacementStable := corrNu.replacementStable } + have seriesTree {m n : ℕ} {p : PartialEdgeColoring E k} + (s : TashkinovSeries G k m e0 p) (s' : TashkinovSeries G k n e0 p) + (he : m = n) (hs : HEq s s') (i : Fin (m + 2)) : + s.data.tree i = s'.data.tree (Fin.cast (congrArg (fun d => d + 2) he) i) := by + cases he + cases hs + rfl + have lastTree {B : TreeSequence G e0} + (c : CorrespondingExtendedTashkinovTree G k e0 ett nu B) : + c.replacementETT.series.data.tree (Fin.last c.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rw [seriesTree c.replacementETT.series c.replacementSeries c.rungAgreement + c.seriesPresentation] + convert c.ladderTreesAgree ⟨ett.rounds - 1, by omega⟩ using 1 + · congr 1 + apply Fin.ext + simp + have he := c.rungAgreement + omega + · congr 1 + apply Fin.ext + simp + omega + have hlargePrefix : 2 * corrPrefix.replacementETT.rounds + 11 ≤ + (TreeMissingColors nu (corrPrefix.replacementETT.series.data.tree + (Fin.last corrPrefix.replacementETT.rounds).castSucc)).card := by + have hm : TreeMissingColors nu + (ett.series.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc) := + treeMissingFixed ladderSub + rw [lastTree corrPrefix, hm, corrPrefix.rungAgreement] + exact hlarge + have lastStored {m n : ℕ} {p : PartialEdgeColoring E k} + (s : TashkinovSeries G k m e0 p) (s' : TashkinovSeries G k n e0 p) + (he : m = n) (hs : HEq s s') : + TashkinovStoredColors s.data (Fin.last m) = + TashkinovStoredColors s'.data (Fin.last n) := by + cases he + cases hs + rfl + have hstoredPrefix : HierarchyTerminalStoredColors K = HierarchyStoredColorsAt HNu r := by + have hstar : HierarchyStarredStage HNu r = HNu.stage r.castSucc := by + let i : Fin HNu.dividerCount := ⟨HNu.dividerCount - 1, by omega⟩ + have hi : i.succ = r := by apply Fin.ext; simp [i, r]; omega + rw [← hi] + simp [HierarchyStarredStage] + change TashkinovStoredColors ettPrefix.series.data (Fin.last ettPrefix.rounds) \ + TreeMissingColors nu (HNu.stage r.castSucc) = + TashkinovStoredColors corrNu.replacementETT.series.data + (Fin.last corrNu.replacementETT.rounds) \ + TreeMissingColors nu (HierarchyStarredStage HNu r) + rw [lastStored ettPrefix.series corrNu.replacementETT.series hroundPrefix hseriesPrefix, + hstar] + have hgammaPrefix : goodPrefix.gamma (Fin.last K.dividerCount) = + goodNu.gamma ⟨r.val - 1, by omega⟩ := by + let j : Fin r.val := ⟨r.val - 1, by omega⟩ + have hc := (hcolorsPrefix j).2 + have hi : (Fin.cast (by omega) j : + Fin (K.dividerCount + 1)) = Fin.last K.dividerCount := by + apply Fin.ext + exact hcountPrefix.symm + funext eta + simpa [hi, j] using hc eta + have hterminalPrefix : TreeColorSetMinusClosed G nu (HNu.stage r.castSucc) + ((HierarchyTerminalStoredColors K).biUnion + (goodPrefix.gamma (Fin.last K.dividerCount))) := by + rw [hstoredPrefix, hgammaPrefix] + exact hminusPrefix + have hsmall : K.dividerCount < H.dividerCount := by + have hc := hcountPrefix + simp [r] at hc + omega + have hmissingPrefix : theta ∈ TreeMissingColors nu (HNu.stage r.castSucc) := by + rw [← hANu] + exact hthetaNu + have hclosedPrefix : TreeColorSetClosed G nu (HNu.stage r.castSucc) {theta} := by + rw [← hANu] + exact hthetaClosedNu + have hQ₁Prefix : TreeExitPath (HNu.stage r.castSucc) nu theta beta a₁ b₁ Q₁ := by + rw [← hANu] + exact hQ₁ + have hQ₂Prefix : TreeExitPath (HNu.stage r.castSucc) nu theta beta a₂ b₂ Q₂ := by + rw [← hANu] + exact hQ₂ + exact hnoSmaller nu (HNu.stage r.castSucc) corrPrefix hnuProper hnuOne + hstableLadder hMPPrefix basePrefix K goodPrefix hsmall hlargePrefix + hterminalPrefix theta beta hthetaBeta hmissingPrefix hclosedPrefix + a₁ b₁ a₂ b₂ Q₁ Q₂ hQ₁Prefix hQ₂Prefix + (by simpa [hsQ₁, hsQ₂] using hpaths₁₂) ha₁₂ + +private theorem helper_continuation_361.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), MaximumProperty ett → (0 : ℕ) < ett.rounds → IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (_ : GoodHierarchy H) (_ : + ℕ), (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi (ett.series.data.tree + (Fin.last ett.rounds).castSucc)).card → + ∀ (alpha beta : Fin k), alpha ≠ beta → + ∀ (a₁ b₁ a₂ b₂ a₃ b₃ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl + b₂)) (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₃) (Sum.inl b₃)), + TreeExitPath T phi alpha beta a₁ b₁ P₁ → TreeExitPath T phi alpha beta a₂ b₂ P₂ → + TreeExitPath T phi alpha beta a₃ b₃ P₃ → ( + ∀ x ∈ P₁.support, x ∉ P₂.support) → a₁ ≠ a₂ → + ∀ (f₃ : E), Sum.inr f₃ ∈ P₃.support → b₃ ∈ TreeSequenceVertexSet (HierarchyStarredStage H + (Fin.last H.dividerCount)) → + ∀ (theta : Fin k), theta ≠ beta → theta ∈ TreeMissingColors phi (HierarchyStarredStage H + (Fin.last H.dividerCount)) → TreeColorSetClosed G phi (HierarchyStarredStage H (Fin.last + H.dividerCount)) ({ theta } : Finset (Fin k)) → ( + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) (corr : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi + sigma → MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT base') (good' : GoodHierarchy K), K.dividerCount < H.dividerCount → (2 + : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ (TreeMissingColors sigma + (corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc)).card → TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → a ∈ TreeMissingColors sigma T' → TreeColorSetClosed G sigma T' ({ a } + : Finset (Fin k)) → + ∀ (u₁ v₁ u₂ v₂ : V) (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₂) (Sum.inl v₂)), TreeExitPath + T' sigma a b u₁ v₁ Q₁ → TreeExitPath T' sigma a b u₂ v₂ Q₂ → ( + ∀ x ∈ Q₁.support, x ∉ Q₂.support) → u₁ ≠ u₂ → False) → (0 : ℕ) < H.dividerCount → + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); A = H.stage + (Fin.last H.dividerCount).castSucc → TreeSequenceInitialSegment A T → ( + ∀ {B C : TreeSequence G e0}, TreeSequenceInitialSegment B C → TreeSequenceVertexSet B ⊆ + TreeSequenceVertexSet C) → TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → + ∀ (_ _ _ : Fin (T.length + (1 : ℕ))) (_ : Fin (A.length + (1 : ℕ))), b₁ ∈ + TreeSequenceVertexSet A → b₂ ∈ TreeSequenceVertexSet A → ( + ∀ {f : E} {v w : V}, v ∈ TreeSequenceVertexSet T → w ∉ TreeSequenceVertexSet T → Incident G v + f → Incident G w f → f ∈ BoundaryEdges G (TreeSequenceVertexSet T)) → ( + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → phi f ≠ some alpha ∧ phi f ≠ some + theta) → + let nu : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha theta; + OutsideKempeRecoloring T phi nu alpha theta → IsProperEdgeColoring G nu → + IsOneEdgeUncolored nu e0 → StableColoring T (TashkinovStoredColors ett.series.data + (Fin.last ett.rounds)) phi nu → ( + ∀ (f : E), TreeIncidentEdge T f → nu f = phi f) → ( + ∀ {u : V}, u ∉ TreeSequenceVertexSet T → alpha ∈ MissingColors G phi u ∨ beta ∈ MissingColors + G phi u → theta ∈ MissingColors G nu u ∨ beta ∈ MissingColors G nu u) → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hproper hone hlower base H good q hlarge + alpha beta hne a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ hP₁ hP₂ hP₃ hpaths₁₂ ha₁₂ f₃ _ hinside theta + hthetaBeta hthetaMissing hthetaClosedStar hnoSmaller hdividerPositive A hAstage hAT + segmentSubset hsub i₁ i₂ j₃ t₃ hb₁A hb₂A boundaryOfCrossing noBoundary nu hrecolor + hnuProper hnuOne hnuStable hfixed remoteMissing + have incidentVertexSupport {u v : V} + {p : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)} + {f : E} {x : V} (hp : p.IsPath) (hf : Sum.inr f ∈ p.support) + (hxf : Incident G x f) : Sum.inl x ∈ p.support := by + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hnpos : 0 < n := by + by_contra h + have hnzero : n = 0 := by omega + rw [hnzero] at hn + simp at hn + have hnlt : n < p.length := by + by_contra h + have hneq : n = p.length := by omega + rw [hneq] at hn + simp at hn + have hprev := p.adj_getVert_succ (i := n - 1) (by omega) + have hnext := p.adj_getVert_succ (i := n) hnlt + rw [show n - 1 + 1 = n by omega, hn] at hprev + rw [hn] at hnext + cases hpreveq : p.getVert (n - 1) with + | inr g => rw [hpreveq] at hprev; exact False.elim hprev + | inl y => + rw [hpreveq] at hprev + cases hnexteq : p.getVert (n + 1) with + | inr g => rw [hnexteq] at hnext; exact False.elim hnext + | inl z => + rw [hnexteq] at hnext + have hyz : y ≠ z := by + intro hyz + have hverts : p.getVert (n - 1) = p.getVert (n + 1) := by + rw [hpreveq, hnexteq, hyz] + have hidx := hp.getVert_injOn + (show n - 1 ≤ p.length by omega) + (show n + 1 ≤ p.length by omega) hverts + omega + have hends : G.ends f = s(y, z) := + (Sym2.mem_and_mem_iff hyz).mp ⟨hprev.1, hnext.1⟩ + have hx : x = y ∨ x = z := by simpa [Incident, hends] using hxf + rcases hx with rfl | rfl + · rw [← hpreveq]; exact p.getVert_mem_support _ + · rw [← hnexteq]; exact p.getVert_mem_support _ + have pathBoundary {u v : V} + (p : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)) + (hp : TreeExitPath T phi alpha beta u v p) {f : E} + (hf : Sum.inr f ∈ p.support) (ht : TreeIncidentEdge T f) : + f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + obtain ⟨x, hx, hxf⟩ := ht + have unique : ∀ y, Incident G y f → y ∈ TreeSequenceVertexSet T → y = v := by + intro y hyf hy + exact (hp.2.2.2.2.2 y hy).mp (incidentVertexSupport hp.1 hf hyf) + obtain ⟨y, z, he⟩ : ∃ y z, G.ends f = s(y, z) := by + generalize G.ends f = s + induction s using Sym2.inductionOn with + | _ y z => exact ⟨y, z, rfl⟩ + have hyf : Incident G y f := by simp [Incident, he] + have hzf : Incident G z f := by simp [Incident, he] + have hyz : y ≠ z := by intro h; exact G.loopless f z (by simpa [h] using he) + have hxends : x = y ∨ x = z := by simpa [Incident, he] using hxf + rcases hxends with rfl | rfl + · apply boundaryOfCrossing hx _ hyf hzf + intro hz + exact hyz ((unique x hyf hx).trans (unique z hzf hz).symm) + · apply boundaryOfCrossing hx _ hzf hyf + intro hy + exact hyz ((unique y hyf hy).trans (unique x hzf hx).symm) + have transferExit {u v : V} + (p : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)) + (hp : TreeExitPath T phi alpha beta u v p) (hv : v ∈ TreeSequenceVertexSet A) : + ∃ Q : (TwoColorIncidenceGraph G nu theta beta).Walk (Sum.inl u) (Sum.inl v), + TreeExitPath A nu theta beta u v Q ∧ Q.support = p.support := by + have preserve {w : V} {f : E} (hf : Sum.inr f ∈ p.support) + (hadj : (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl w) (Sum.inr f)) : + (TwoColorIncidenceGraph G nu theta beta).Adj (Sum.inl w) (Sum.inr f) := by + refine ⟨hadj.1, ?_⟩ + by_cases ht : TreeIncidentEdge T f + · have hnot := (noBoundary (pathBoundary p hp hf ht)).1 + exact Or.inr ((hfixed f ht).trans (hadj.2.resolve_left hnot)) + · rcases hadj.2 with ha | hb + · exact Or.inl (by simp [nu, OutsideTreeColorSwap, ht, ha]) + · exact Or.inr (by simp [nu, OutsideTreeColorSwap, ht, hb, + hne.symm, hthetaBeta.symm]) + have hedges : ∀ z, z ∈ p.edges → + z ∈ (TwoColorIncidenceGraph G nu theta beta).edgeSet := by + intro z hz + induction z using Sym2.inductionOn with + | _ x y => + have hadj := (SimpleGraph.mem_edgeSet _).mp (p.edges_subset_edgeSet hz) + have hx := p.fst_mem_support_of_mem_edges hz + have hy := p.snd_mem_support_of_mem_edges hz + apply (SimpleGraph.mem_edgeSet _).mpr + cases x <;> cases y + · exact hadj.elim + · exact preserve hy hadj + · exact (preserve hx hadj.symm).symm + · exact hadj.elim + let Q := p.transfer (TwoColorIncidenceGraph G nu theta beta) hedges + refine ⟨Q, ⟨hp.1.transfer hedges, ?_, ?_, hv, + remoteMissing hp.2.2.1 hp.2.2.2.2.1, ?_⟩, by simp [Q]⟩ + · simpa [Q] using hp.2.1 + · intro hu; exact hp.2.2.1 (hsub hu) + · intro w hw + simpa [Q] using hp.2.2.2.2.2 w (hsub hw) + obtain ⟨Q₁, hQ₁, hsQ₁⟩ := transferExit P₁ hP₁ hb₁A + obtain ⟨Q₂, hQ₂, hsQ₂⟩ := transferExit P₂ hP₂ hb₂A + obtain ⟨Q₃, hQ₃, hsQ₃⟩ := transferExit P₃ hP₃ hinside + have ladderSub : TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc) ⊆ + TreeSequenceVertexSet T := segmentSubset ett.abovePenultimate + have hstableLadder : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi nu := by + constructor + · intro f hf hc + obtain ⟨v, hv, hvf⟩ := hf + exact hfixed f ⟨v, ladderSub hv, hvf⟩ + · intro v hv + exact hnuStable.2 v (ladderSub hv) + have treeMissingFixed {B : TreeSequence G e0} + (hB : TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet T) : + TreeMissingColors nu B = TreeMissingColors phi B := by + apply Finset.biUnion_congr rfl + intro v hv + exact hnuStable.2 v (hB hv) + have hthetaNu : theta ∈ TreeMissingColors nu A := by + rw [treeMissingFixed hsub] + exact hthetaMissing + have hthetaClosedNu : TreeColorSetClosed G nu A {theta} := by + intro c hc + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + have hfb : f ∈ BoundaryEdges G (TreeSequenceVertexSet A) := + (Finset.mem_filter.mp hf).1 + have hfc : nu f = some c := (Finset.mem_filter.mp hf).2 + have hcross : ∃ v ∈ TreeSequenceVertexSet A, + ∃ w ∉ TreeSequenceVertexSet A, G.ends f = s(v, w) := + by simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] using hfb + obtain ⟨v, hv, w, hw, he⟩ := hcross + have hvf : Incident G v f := by simp [Incident, he] + have hold : phi f = some c := (hfixed f ⟨v, hsub hv, hvf⟩).symm.trans hfc + have hm : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet A) c := + Finset.mem_filter.mpr ⟨hfb, hold⟩ + rw [hthetaClosedStar c hc] at hm + simp at hm + obtain ⟨_, _, _, _, corrNu, hMPNu, baseNu, HNu, goodNu, hsame, hterminalNu⟩ := + HierarchyLEMStable G k e0 input T phi nu ett hMP hpositive hlower base H good + hproper hone alpha theta hrecolor + have hcount : H.dividerCount = HNu.dividerCount := hsame.1.2.1 + exact @helper_continuation_355 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) (@base) (@H) (@good) + (@hlarge) (@alpha) (@beta) (@a₁) (@b₁) (@a₂) (@b₂) (@P₁) (@P₂) (@hpaths₁₂) (@ha₁₂) (@theta) + (@hthetaBeta) (@hnoSmaller) (@hdividerPositive) (@hAstage) (@hnuProper) (@hnuOne) (@Q₁) + (@hQ₁) (@hsQ₁) (@Q₂) (@hQ₂) (@hsQ₂) (@ladderSub) (@hstableLadder) (@treeMissingFixed) + (@hthetaNu) (@hthetaClosedNu) (@corrNu) (@hMPNu) (@baseNu) (@HNu) (@goodNu) (@hsame) (@hcount) +lemma Step1CaseTwoInsidePositiveDivider {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (_ : H.dividerCount < q) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (_ : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (_ : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (_ : beta ∉ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ a₃ b₃ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₃) (Sum.inl b₃)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hP₃ : TreeExitPath T phi alpha beta a₃ b₃ P₃) + (hpaths₁₂ : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (_ : ∀ x, x ∈ P₁.support → x ∉ P₃.support) + (_ : ∀ x, x ∈ P₂.support → x ∉ P₃.support) + (ha₁₂ : a₁ ≠ a₂) (_ : a₁ ≠ a₃) (_ : a₂ ≠ a₃) + (_ : b₁ ≠ b₂) (_ : b₁ ≠ b₃) (_ : b₂ ≠ b₃) + (horder₁₂ : TreeVertexOrder T b₁ b₂) + (horder₂₃ : TreeVertexOrder T b₂ b₃) + (f₁ f₂ f₃ : E) + (_ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : f₃ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : Incident G b₁ f₁) (_ : Incident G b₂ f₂) + (_ : Incident G b₃ f₃) + (_ : Sum.inr f₁ ∈ P₁.support) + (_ : Sum.inr f₂ ∈ P₂.support) + (_ : Sum.inr f₃ ∈ P₃.support) + (hinside : b₃ ∈ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (theta : Fin k) (hthetaAlpha : theta ≠ alpha) + (hthetaBeta : theta ≠ beta) + (hthetaMissing : theta ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hthetaClosedStar : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {theta}) + (hthetaClosed : TreeColorSetClosed G phi T {theta}) + (hnoSmaller : + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount < H.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' {a} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → False) + (hdividerPositive : 0 < H.dividerCount) : False := by + classical + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + have hAstage : A = H.stage (Fin.last H.dividerCount).castSucc := by + let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hi : i.succ = Fin.last H.dividerCount := by + apply Fin.ext + simp [i] + omega + dsimp [A] + rw [← hi] + simp [HierarchyStarredStage] + have hAT : TreeSequenceInitialSegment A T := by + let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hi : (Fin.last H.dividerCount).castSucc = + (⟨i.val + 1, by omega⟩ : Fin (H.dividerCount + 2)) := by + apply Fin.ext + simp [i] + omega + rw [hAstage] + rw [hi, H.dividerStage i] + exact ⟨Nat.le_of_lt_succ (H.dividerPosition i).isLt, + by intro j; rfl, by intro j; rfl⟩ + have segmentSubset {B C : TreeSequence G e0} + (hs : TreeSequenceInitialSegment B C) : + TreeSequenceVertexSet B ⊆ TreeSequenceVertexSet C := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨i, rfl⟩ := hv + exact ⟨Fin.castLE (Nat.succ_le_succ hs.1) i, hs.2.1 i⟩ + have hsub := segmentSubset hAT + obtain ⟨i₁, i₂, hi₁, hi₂, hi₁₂⟩ := horder₁₂ + obtain ⟨j₂, j₃, hj₂, hj₃, hj₂₃⟩ := horder₂₃ + have hj₂eq : j₂ = i₂ := T.vertex_injective (hj₂.trans hi₂.symm) + subst j₂ + obtain ⟨t₃, ht₃⟩ : ∃ t : Fin (A.length + 1), A.vertex t = b₃ := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] using hinside + have ht₃eq : Fin.castLE (Nat.succ_le_succ hAT.1) t₃ = j₃ := + T.vertex_injective ((hAT.2.1 t₃).trans (ht₃.trans hj₃.symm)) + have hj₃bound : j₃.val ≤ A.length := by + rw [← ht₃eq] + exact Nat.le_of_lt_succ t₃.isLt + have hb₁A : b₁ ∈ TreeSequenceVertexSet A := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + let t : Fin (A.length + 1) := ⟨i₁.val, by omega⟩ + refine ⟨t, ?_⟩ + have ht : Fin.castLE (Nat.succ_le_succ hAT.1) t = i₁ := Fin.ext rfl + exact (hAT.2.1 t).symm.trans (ht ▸ hi₁) + have hb₂A : b₂ ∈ TreeSequenceVertexSet A := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + let t : Fin (A.length + 1) := ⟨i₂.val, by omega⟩ + refine ⟨t, ?_⟩ + have ht : Fin.castLE (Nat.succ_le_succ hAT.1) t = i₂ := Fin.ext rfl + exact (hAT.2.1 t).symm.trans (ht ▸ hi₂) + have boundaryOfCrossing {f : E} {v w : V} + (hv : v ∈ TreeSequenceVertexSet T) (hw : w ∉ TreeSequenceVertexSet T) + (hvf : Incident G v f) (hwf : Incident G w f) : + f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + have hvw : v ≠ w := by intro h; exact hw (h ▸ hv) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hv, w, hw, (Sym2.mem_and_mem_iff hvw).mp ⟨hvf, hwf⟩⟩ + have noBoundary {f : E} (hf : f ∈ BoundaryEdges G (TreeSequenceVertexSet T)) : + phi f ≠ some alpha ∧ phi f ≠ some theta := by + constructor + · intro hc + have hm : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha := by + simp [BoundaryColorEdges, hf, hc] + rw [hclosed alpha (by simp)] at hm + simp at hm + · intro hc + have hm : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) theta := by + simp [BoundaryColorEdges, hf, hc] + rw [hthetaClosed theta (by simp)] at hm + simp at hm + let Outside : Sum V E → Prop + | Sum.inl v => v ∉ TreeSequenceVertexSet T + | Sum.inr f => ¬ TreeIncidentEdge T f + have outsideStep {x y : Sum V E} + (hxy : (TwoColorIncidenceGraph G phi alpha theta).Adj x y) + (hx : Outside x) : Outside y := by + cases x with + | inl v => + cases y with + | inl w => exact False.elim hxy + | inr f => + rintro ⟨w, hw, hwf⟩ + have hf := boundaryOfCrossing hw hx hwf hxy.1 + rcases hxy.2 with ha | ht + · exact (noBoundary hf).1 ha + · exact (noBoundary hf).2 ht + | inr f => + cases y with + | inr g => exact False.elim hxy + | inl v => intro hv; exact hx ⟨v, hv, hxy.1⟩ + have outsideComponent {z x : Sum V E} (hz : Outside z) + (hx : x ∈ TwoColorComponent G phi alpha theta z) : Outside x := by + have hr : (TwoColorIncidenceGraph G phi alpha theta).Reachable z x := by + apply SimpleGraph.ConnectedComponent.exact + change (TwoColorIncidenceGraph G phi alpha theta).connectedComponentMk x = + (TwoColorIncidenceGraph G phi alpha theta).connectedComponentMk z at hx + exact hx.symm + clear hx + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + induction hr with + | refl => exact hz + | tail hr hlast ih => exact outsideStep hlast ih + let roots : Finset (Sum V E) := Finset.univ.filter Outside + have selected {f : E} : + (∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha theta z) ↔ + ¬ TreeIncidentEdge T f := by + constructor + · rintro ⟨z, hz, hf⟩ + exact outsideComponent (Finset.mem_filter.mp hz).2 hf + · intro hf + refine ⟨Sum.inr f, by simp [roots, Outside, hf], ?_⟩ + change (TwoColorIncidenceGraph G phi alpha theta).connectedComponentMk + (Sum.inr f) = (TwoColorIncidenceGraph G phi alpha theta).connectedComponentMk + (Sum.inr f) + rfl + let nu := OutsideTreeColorSwap T phi alpha theta + have hrecolor : OutsideKempeRecoloring T phi nu alpha theta := by + refine ⟨hthetaAlpha.symm, roots, ?_, ?_⟩ + · intro z hz v hv + exact outsideComponent (Finset.mem_filter.mp hz).2 hv + · intro f + by_cases hf : TreeIncidentEdge T f <;> + simp [nu, OutsideTreeColorSwap, selected, hf] + obtain ⟨hnuProper, hnuOne, hnuStable, hnuInvariant, hfixed⟩ := + OutsideKempeRecoloringStable G e0 T + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi nu alpha theta hproper hone hrecolor + have missingIff (p : PartialEdgeColoring E k) (v : V) (c : Fin k) : + c ∈ MissingColors G p v ↔ ∀ f, Incident G v f → p f ≠ some c := by + simp [MissingColors, PresentColors] + have remoteMissing {u : V} (hu : u ∉ TreeSequenceVertexSet T) + (hm : alpha ∈ MissingColors G phi u ∨ beta ∈ MissingColors G phi u) : + theta ∈ MissingColors G nu u ∨ beta ∈ MissingColors G nu u := by + rcases hm with hm | hm + · left + apply (missingIff nu u theta).mpr + intro f huf hnew + by_cases ht : TreeIncidentEdge T f + · obtain ⟨v, hv, hvf⟩ := ht + exact (noBoundary (boundaryOfCrossing hv hu hvf huf)).2 + ((hfixed f ⟨v, hv, hvf⟩).symm.trans hnew) + · have hfa := (missingIff phi u alpha).mp hm f huf + by_cases hft : phi f = some theta + · have heq : alpha = theta := by + simpa [nu, OutsideTreeColorSwap, ht, hfa, hft, hthetaAlpha] using hnew + exact hthetaAlpha heq.symm + · exact hft (by simp [nu, OutsideTreeColorSwap, ht, hfa, hft] at hnew) + · right + apply (missingIff nu u beta).mpr + intro f huf hnew + apply (missingIff phi u beta).mp hm f huf + by_cases ht : TreeIncidentEdge T f + · exact (hfixed f ht).symm.trans hnew + · by_cases hfa : phi f = some alpha + · have heq : theta = beta := by + simpa [nu, OutsideTreeColorSwap, ht, hfa] using hnew + exact False.elim (hthetaBeta heq) + · by_cases hft : phi f = some theta + · have heq : alpha = beta := by + simpa [nu, OutsideTreeColorSwap, ht, hfa, hft, hthetaAlpha] using hnew + exact False.elim (hne heq) + · simpa [nu, OutsideTreeColorSwap, ht, hfa, hft] using hnew + exact @helper_continuation_361 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hMP) (@hpositive) (@hproper) + (@hone) (@hlower) (@base) (@H) (@good) (@q) (@hlarge) (@alpha) (@beta) (@hne) (@a₁) (@b₁) + (@a₂) (@b₂) (@a₃) (@b₃) (@P₁) (@P₂) (@P₃) (@hP₁) (@hP₂) (@hP₃) (@hpaths₁₂) (@ha₁₂) (@f₃) + (by assumption) (@hinside) (@theta) (@hthetaBeta) (@hthetaMissing) (@hthetaClosedStar) + (@hnoSmaller) (@hdividerPositive) (@hAstage) (@hAT) (@segmentSubset) (@hsub) (@i₁) (@i₂) + (@j₃) (@t₃) (@hb₁A) (@hb₂A) (@boundaryOfCrossing) (@noBoundary) (@hrecolor) (@hnuProper) + (@hnuOne) (@hnuStable) (@hfixed) (@remoteMissing) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoInsideStar.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoInsideStar.lean new file mode 100644 index 0000000000..f18f58e21f --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoInsideStar.lean @@ -0,0 +1,153 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Step1CaseTwoInsidePositiveDivider +public import LeanPool.GoldbergSeymour.Step1CaseTwoInsideZeroNonPE +public import LeanPool.GoldbergSeymour.Step1CaseTwoInsideZeroPE + +/-! +# Step1Case Two Inside Star + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1CaseTwoInsideStar {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (hdivider : H.dividerCount < q) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (hterminal : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (hElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (halpha : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (hbeta : beta ∉ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ a₃ b₃ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₃) (Sum.inl b₃)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hP₃ : TreeExitPath T phi alpha beta a₃ b₃ P₃) + (hpaths₁₂ : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (hpaths₁₃ : ∀ x, x ∈ P₁.support → x ∉ P₃.support) + (hpaths₂₃ : ∀ x, x ∈ P₂.support → x ∉ P₃.support) + (ha₁₂ : a₁ ≠ a₂) (ha₁₃ : a₁ ≠ a₃) (ha₂₃ : a₂ ≠ a₃) + (hb₁₂ : b₁ ≠ b₂) (hb₁₃ : b₁ ≠ b₃) (hb₂₃ : b₂ ≠ b₃) + (horder₁₂ : TreeVertexOrder T b₁ b₂) + (horder₂₃ : TreeVertexOrder T b₂ b₃) + (f₁ f₂ f₃ : E) + (hf₁ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₂ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₃ : f₃ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hif₁ : Incident G b₁ f₁) (hif₂ : Incident G b₂ f₂) + (hif₃ : Incident G b₃ f₃) + (hPf₁ : Sum.inr f₁ ∈ P₁.support) + (hPf₂ : Sum.inr f₂ ∈ P₂.support) + (hPf₃ : Sum.inr f₃ ∈ P₃.support) + (hinside : b₃ ∈ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (theta : Fin k) (hthetaAlpha : theta ≠ alpha) + (hthetaBeta : theta ≠ beta) + (hthetaMissing : theta ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hthetaClosedStar : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {theta}) + (hthetaClosed : TreeColorSetClosed G phi T {theta}) + (hnoSmaller : + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount < H.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' {a} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → False) : False := by + by_cases hpos : 0 < H.dividerCount + · exact Step1CaseTwoInsidePositiveDivider G k e0 input T phi ett hMP hpositive + hproper hone hlower base H good q hdivider hfewer hlarge hterminal + hElementary alpha beta halpha hclosed hne hbeta a₁ b₁ a₂ b₂ a₃ b₃ + P₁ P₂ P₃ hP₁ hP₂ hP₃ hpaths₁₂ hpaths₁₃ hpaths₂₃ ha₁₂ ha₁₃ ha₂₃ + hb₁₂ hb₁₃ hb₂₃ horder₁₂ horder₂₃ f₁ f₂ f₃ hf₁ hf₂ hf₃ hif₁ hif₂ + hif₃ hPf₁ hPf₂ hPf₃ hinside theta hthetaAlpha hthetaBeta + hthetaMissing hthetaClosedStar hthetaClosed hnoSmaller hpos + · have hzero : H.dividerCount = 0 := Nat.eq_zero_of_not_pos hpos + by_cases hpe : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · exact Step1CaseTwoInsideZeroPE G k e0 input T phi ett hMP hpositive + hproper hone hlower base H good q hdivider hfewer hlarge hterminal + hElementary alpha beta halpha hclosed hne hbeta a₁ b₁ a₂ b₂ a₃ b₃ + P₁ P₂ P₃ hP₁ hP₂ hP₃ hpaths₁₂ hpaths₁₃ hpaths₂₃ ha₁₂ ha₁₃ ha₂₃ + hb₁₂ hb₁₃ hb₂₃ horder₁₂ horder₂₃ f₁ f₂ f₃ hf₁ hf₂ hf₃ hif₁ hif₂ + hif₃ hPf₁ hPf₂ hPf₃ hinside theta hthetaAlpha hthetaBeta + hthetaMissing hthetaClosedStar hthetaClosed hnoSmaller hzero hpe + · exact Step1CaseTwoInsideZeroNonPE G k e0 input T phi ett hMP hpositive + hproper hone hlower base H good q hdivider hfewer hlarge hterminal + hElementary alpha beta halpha hclosed hne hbeta a₁ b₁ a₂ b₂ a₃ b₃ + P₁ P₂ P₃ hP₁ hP₂ hP₃ hpaths₁₂ hpaths₁₃ hpaths₂₃ ha₁₂ ha₁₃ ha₂₃ + hb₁₂ hb₁₃ hb₂₃ horder₁₂ horder₂₃ f₁ f₂ f₃ hf₁ hf₂ hf₃ hif₁ hif₂ + hif₃ hPf₁ hPf₂ hPf₃ hinside theta hthetaAlpha hthetaBeta + hthetaMissing hthetaClosedStar hthetaClosed hnoSmaller hzero hpe + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroNonPE.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroNonPE.lean new file mode 100644 index 0000000000..f9d018a148 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroNonPE.lean @@ -0,0 +1,1185 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Step1Case Two Inside Zero Non PE + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation992Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) (q + : ℕ), H.dividerCount < q → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating'), other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') (a : + GoodHierarchy K), K.dividerCount < q → ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) → (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card → TreeColorSetMinusClosed G + phi T ((HierarchyTerminalStoredColors H).biUnion (good.gamma (Fin.last H.dividerCount))) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) → + ∀ (alpha beta : Fin k), alpha ∈ TreeMissingColors phi T → TreeColorSetClosed G phi T { alpha } + → alpha ≠ beta → beta ∉ TreeMissingColors phi T → + ∀ (a₁ b₁ a₂ b₂ a₃ b₃ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl + b₂)) (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₃) (Sum.inl b₃)), + TreeExitPath T phi alpha beta a₁ b₁ P₁ → TreeExitPath T phi alpha beta a₂ b₂ P₂ → + TreeExitPath T phi alpha beta a₃ b₃ P₃ → ( + ∀ x ∈ P₁.support, x ∉ P₂.support) → ( + ∀ x ∈ P₁.support, x ∉ P₃.support) → ( + ∀ x ∈ P₂.support, x ∉ P₃.support) → a₁ ≠ a₂ → a₁ ≠ a₃ → a₂ ≠ a₃ → b₁ ≠ b₂ → b₁ ≠ b₃ → b₂ ≠ b₃ + → + ∀ (f₁ f₂ f₃ : E), f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → f₂ ∈ + BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → f₃ ∈ BoundaryColorEdges G phi + (TreeSequenceVertexSet T) beta → Incident G b₁ f₁ → Incident G b₂ f₂ → Incident G b₃ f₃ → + Sum.inr f₁ ∈ P₁.support → Sum.inr f₂ ∈ P₂.support → Sum.inr f₃ ∈ P₃.support → + ∀ (theta : Fin k), theta ≠ alpha → theta ≠ beta → theta ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) → TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) { theta } → TreeColorSetClosed G phi T + { theta } → ( + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) (corr : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi + sigma → MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT base') (good' : GoodHierarchy K), K.dividerCount < H.dividerCount → (2 + : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ (TreeMissingColors sigma + (corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc)).card → TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → a ∈ TreeMissingColors sigma T' → TreeColorSetClosed G sigma T' { a } + → + ∀ (u₁ v₁ u₂ v₂ : V) (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₂) (Sum.inl v₂)), TreeExitPath + T' sigma a b u₁ v₁ Q₁ → TreeExitPath T' sigma a b u₂ v₂ Q₂ → ( + ∀ x ∈ Q₁.support, x ∉ Q₂.support) → u₁ ≠ u₂ → False) → ett.series.data.kind (Fin.last + ett.rounds) ≠ some TashkinovExtensionKind.PE → + let r : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); r.succ = Fin.last ett.rounds → + let N : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + let D : Finset (Fin k) := TashkinovStoredColors ett.series.data r.castSucc; + let previous : PartialEdgeColoring E k := ett.series.data.coloring r.castSucc; + ett.series.data.coloring r.succ = phi → HierarchyStarredStage H (Fin.last H.dividerCount) + = N → TreeSequenceVertexSet N ⊆ TreeSequenceVertexSet T → b₃ ∈ TreeSequenceVertexSet N → + b₂ ∈ TreeSequenceVertexSet N → b₁ ∈ TreeSequenceVertexSet N → ( + ∀ (S : TreeSequence G e0) (C : Finset (Fin k)) (psi : PartialEdgeColoring E k) (a c : Fin k), + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → TreeColorSetClosed G psi S { a } + → TreeColorSetClosed G psi S { c } → IsProperEdgeColoring G (OutsideTreeColorSwap S psi a + c) ∧ IsOneEdgeUncolored (OutsideTreeColorSwap S psi a c) e0 ∧ StableColoring S C psi + (OutsideTreeColorSwap S psi a c) ∧ + ∀ (f : E), TreeIncidentEdge S f → OutsideTreeColorSwap S psi a c f = psi f) → ( + ∀ (S U : TreeSequence G e0) (psi : PartialEdgeColoring E k) (a c d : Fin k), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet U → a ≠ d → c ≠ d → TreeColorSetClosed G + psi U { a } → TreeColorSetClosed G psi U { c } → + ∀ {u v : V} (P : (TwoColorIncidenceGraph G psi a d).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath U psi a d u v P → v ∈ TreeSequenceVertexSet S → + ∃ (Q : (TwoColorIncidenceGraph G (OutsideTreeColorSwap U psi a c) c d).Walk (Sum.inl u) + (Sum.inl v)), TreeExitPath S (OutsideTreeColorSwap U psi a c) c d u v Q ∧ Q.support = + P.support) → + let nu : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha theta; + IsProperEdgeColoring G (OutsideTreeColorSwap T phi alpha theta) → IsOneEdgeUncolored + (OutsideTreeColorSwap T phi alpha theta) e0 → ( + ∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi alpha theta f = phi f) → + StableColoring N D phi nu → False + +private theorem helper_outside_recolor_267.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E), ( + ∀ {S : TreeSequence G e0} {f : E} {v w : V}, v ∈ TreeSequenceVertexSet S → w ∉ + TreeSequenceVertexSet S → Incident G v f → Incident G w f → f ∈ BoundaryEdges G + (TreeSequenceVertexSet S)) → ( + ∀ {S : TreeSequence G e0} {psi : PartialEdgeColoring E k} {d : Fin k}, TreeColorSetClosed G + psi S { d } → + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet S) → psi f ≠ some d) → + ∀ (S : TreeSequence G e0) (psi : PartialEdgeColoring E k) (a c : Fin k), a ≠ c → + TreeColorSetClosed G psi S { a } → TreeColorSetClosed G psi S { c } → + OutsideKempeRecoloring S psi (OutsideTreeColorSwap S psi a c) a c := by + classical + intro V E _ _ G k e0 boundary_crossing no_boundary S psi a c hac hca hcc + let J := TwoColorIncidenceGraph G psi a c + let Outside : Sum V E → Prop + | Sum.inl v => v ∉ TreeSequenceVertexSet S + | Sum.inr f => ¬ TreeIncidentEdge S f + have step {z z' : Sum V E} (hzz' : J.Adj z z') (hz : Outside z) : Outside z' := by + cases z with + | inl v => + cases z' with + | inl w => simp [J, TwoColorIncidenceGraph] at hzz' + | inr f => + obtain ⟨hinc, hcol⟩ := hzz' + intro hf + obtain ⟨w, hw, hwf⟩ := hf + have hb := boundary_crossing hw hz hwf hinc + exact hcol.elim (no_boundary hca hb) (no_boundary hcc hb) + | inr f => + cases z' with + | inl v => exact fun hv => hz ⟨v, hv, hzz'.1⟩ + | inr g => simp [J, TwoColorIncidenceGraph] at hzz' + have component_outside : ∀ (u : V), u ∉ TreeSequenceVertexSet S → + ∀ z, z ∈ TwoColorComponent G psi a c (Sum.inl u) → Outside z := by + intro u hu z hz + have hreach : J.Reachable (Sum.inl u) z := by + apply SimpleGraph.ConnectedComponent.exact + change J.connectedComponentMk z = J.connectedComponentMk (Sum.inl u) at hz + exact hz.symm + clear hz + rw [SimpleGraph.reachable_iff_reflTransGen] at hreach + induction hreach with + | refl => exact hu + | tail hreach hlast ih => exact step hlast ih + let roots : Finset (Sum V E) := + (Finset.univ.filter fun v : V => v ∉ TreeSequenceVertexSet S).image Sum.inl + have selected {f : E} (hcol : psi f = some a ∨ psi f = some c) : + (∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G psi a c z) ↔ + ¬ TreeIncidentEdge S f := by + constructor + · rintro ⟨z, hz, hf⟩ + obtain ⟨u, hu, rfl⟩ := Finset.mem_image.mp hz + exact component_outside u (Finset.mem_filter.mp hu).2 (Sum.inr f) hf + · intro hf + induction he : G.ends f using Sym2.inductionOn with + | _ u v => + have hinc : Incident G u f := by simp [Incident, he] + have hu : u ∉ TreeSequenceVertexSet S := fun hu => hf ⟨u, hu, hinc⟩ + refine ⟨Sum.inl u, Finset.mem_image.mpr ⟨u, by simp [hu], rfl⟩, ?_⟩ + exact (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show J.Adj (Sum.inl u) (Sum.inr f) from ⟨hinc, hcol⟩)).symm + refine ⟨hac, roots, ?_, ?_⟩ + · intro z hz v hv + obtain ⟨u, hu, rfl⟩ := Finset.mem_image.mp hz + exact component_outside u (Finset.mem_filter.mp hu).2 (Sum.inl v) hv + · intro f + by_cases ha : psi f = some a + · have hs := selected (Or.inl ha) + by_cases ht : TreeIncidentEdge S f <;> + simp [OutsideTreeColorSwap, ht, ha, hs] + · by_cases hc : psi f = some c + · have hs := selected (Or.inr hc) + by_cases ht : TreeIncidentEdge S f <;> + simp [OutsideTreeColorSwap, ht, hc, hs] + · simp [OutsideTreeColorSwap, ha, hc] + +private theorem helper_path_boundary_354.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), (0 : ℕ) < ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) (q + : ℕ), H.dividerCount < q → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating'), other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') (_ : + GoodHierarchy K), K.dividerCount < q → ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) → TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion (good.gamma (Fin.last H.dividerCount))) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) → + ∀ (alpha beta : Fin k), alpha ∈ TreeMissingColors phi T → beta ∉ TreeMissingColors phi T → + ∀ (a₁ b₁ a₂ b₂ a₃ b₃ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl + b₂)) (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₃) (Sum.inl b₃)), b₁ ≠ + b₂ → b₁ ≠ b₃ → b₂ ≠ b₃ → + ∀ (f₁ f₂ f₃ : E), f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → f₂ ∈ + BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → Incident G b₁ f₁ → Incident G b₂ + f₂ → Sum.inr f₁ ∈ P₁.support → Sum.inr f₂ ∈ P₂.support → Sum.inr f₃ ∈ P₃.support → + ∀ (theta : Fin k), theta ≠ alpha → theta ∈ TreeMissingColors phi (HierarchyStarredStage H + (Fin.last H.dividerCount)) → ( + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) (corr : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi + sigma → MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT base') (good' : GoodHierarchy K), K.dividerCount < H.dividerCount → (2 + : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ (TreeMissingColors sigma + (corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc)).card → TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → a ∈ TreeMissingColors sigma T' → TreeColorSetClosed G sigma T' { a } + → + ∀ (u₁ v₁ u₂ v₂ : V) (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₂) (Sum.inl v₂)), TreeExitPath + T' sigma a b u₁ v₁ Q₁ → TreeExitPath T' sigma a b u₂ v₂ Q₂ → ( + ∀ x ∈ Q₁.support, x ∉ Q₂.support) → u₁ ≠ u₂ → False) → ( + ∀ {S : TreeSequence G e0} {f : E} {v w : V}, v ∈ TreeSequenceVertexSet S → w ∉ + TreeSequenceVertexSet S → Incident G v f → Incident G w f → f ∈ BoundaryEdges G + (TreeSequenceVertexSet S)) → + ∀ {S : TreeSequence G e0} {psi : PartialEdgeColoring E k} {a d : Fin k} {u v : V} (P : + (TwoColorIncidenceGraph G psi a d).Walk (Sum.inl u) (Sum.inl v)), TreeExitPath S psi a d u + v P → + ∀ {f : E}, Sum.inr f ∈ P.support → TreeIncidentEdge S f → f ∈ BoundaryEdges G + (TreeSequenceVertexSet S) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H good q _ _ _ _ alpha beta _ _ a₁ b₁ + a₂ b₂ a₃ b₃ P₁ P₂ P₃ _ _ _ f₁ f₂ f₃ _ _ _ _ _ _ _ theta _ _ _ boundary_crossing S psi a d u + v P he f hf hftree + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hnpos : 0 < n := by + by_contra h + have hz : n = 0 := by omega + rw [hz] at hn + simp at hn + have hnlt : n < P.length := by + by_contra h + have hz : n = P.length := by omega + rw [hz] at hn + simp at hn + have hprev := P.adj_getVert_succ (i := n - 1) (by omega) + have hnext := P.adj_getVert_succ (i := n) hnlt + have hnsub : n - 1 + 1 = n := by omega + rw [hnsub, hn] at hprev + rw [hn] at hnext + cases hy : P.getVert (n - 1) with + | inr g => rw [hy] at hprev; simp [TwoColorIncidenceGraph] at hprev + | inl y => + rw [hy] at hprev + cases hz : P.getVert (n + 1) with + | inr g => rw [hz] at hnext; simp [TwoColorIncidenceGraph] at hnext + | inl z => + rw [hz] at hnext + have hyz : y ≠ z := by + intro hyz + have heq : P.getVert (n - 1) = P.getVert (n + 1) := by rw [hy, hz, hyz] + have hi := he.1.getVert_injOn (show n - 1 ≤ P.length by omega) + (show n + 1 ≤ P.length by omega) heq + omega + have hyS : Sum.inl y ∈ P.support := by rw [← hy]; exact P.getVert_mem_support _ + have hzS : Sum.inl z ∈ P.support := by rw [← hz]; exact P.getVert_mem_support _ + have hends : G.ends f = Sym2.mk y z := + (Sym2.mem_and_mem_iff hyz).mp ⟨hprev.1, hnext.1⟩ + obtain ⟨x, hx, hxf⟩ := hftree + have hxy : x = y ∨ x = z := by simpa [Incident, hends] using hxf + rcases hxy with hxy | hxz + · subst x + refine boundary_crossing hx ?_ hprev.1 hnext.1 + intro hzT + exact hyz (((he.2.2.2.2.2 y hx).mp hyS).trans + ((he.2.2.2.2.2 z hzT).mp hzS).symm) + · subst x + refine boundary_crossing hx ?_ hnext.1 hprev.1 + intro hyT + exact hyz (((he.2.2.2.2.2 y hyT).mp hyS).trans + ((he.2.2.2.2.2 z hx).mp hzS).symm) + +private theorem helper_transfer_exit_407.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H) (q : ℕ), H.dividerCount < q → ( + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' + generating'), other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') (_ : + GoodHierarchy K), K.dividerCount < q → ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) → TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion (good.gamma (Fin.last H.dividerCount))) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) → + ∀ (alpha beta : Fin k), alpha ∈ TreeMissingColors phi T → beta ∉ TreeMissingColors phi T → + ∀ (a₁ b₁ a₂ b₂ a₃ b₃ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl + b₂)) (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₃) (Sum.inl b₃)), b₁ ≠ + b₂ → b₁ ≠ b₃ → b₂ ≠ b₃ → + ∀ (f₁ f₂ f₃ : E), f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → f₂ ∈ + BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → Incident G b₁ f₁ → Incident G b₂ + f₂ → Sum.inr f₁ ∈ P₁.support → Sum.inr f₂ ∈ P₂.support → Sum.inr f₃ ∈ P₃.support → + ∀ (theta : Fin k), theta ≠ alpha → theta ∈ TreeMissingColors phi (HierarchyStarredStage H + (Fin.last H.dividerCount)) → ( + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) (corr : + CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi + sigma → MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy + corr.replacementETT base') (good' : GoodHierarchy K), K.dividerCount < H.dividerCount → (2 + : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ (TreeMissingColors sigma + (corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc)).card → TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → a ∈ TreeMissingColors sigma T' → TreeColorSetClosed G sigma T' { a } + → + ∀ (u₁ v₁ u₂ v₂ : V) (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₂) (Sum.inl v₂)), TreeExitPath + T' sigma a b u₁ v₁ Q₁ → TreeExitPath T' sigma a b u₂ v₂ Q₂ → ( + ∀ x ∈ Q₁.support, x ∉ Q₂.support) → u₁ ≠ u₂ → False) → ( + ∀ {S : TreeSequence G e0} {f : E} {v w : V}, v ∈ TreeSequenceVertexSet S → w ∉ + TreeSequenceVertexSet S → Incident G v f → Incident G w f → f ∈ BoundaryEdges G + (TreeSequenceVertexSet S)) → ( + ∀ {S : TreeSequence G e0} {psi : PartialEdgeColoring E k} {d : Fin k}, TreeColorSetClosed G + psi S { d } → + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet S) → psi f ≠ some d) → ( + ∀ {S : TreeSequence G e0} {psi : PartialEdgeColoring E k} {a d : Fin k} {u v : V} (P : + (TwoColorIncidenceGraph G psi a d).Walk (Sum.inl u) (Sum.inl v)), TreeExitPath S psi a d u + v P → + ∀ {f : E}, Sum.inr f ∈ P.support → TreeIncidentEdge S f → f ∈ BoundaryEdges G + (TreeSequenceVertexSet S)) → + ∀ (S U : TreeSequence G e0) (psi : PartialEdgeColoring E k) (a c d : Fin k), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet U → a ≠ d → c ≠ d → TreeColorSetClosed G + psi U { a } → TreeColorSetClosed G psi U { c } → + ∀ {u v : V} (P : (TwoColorIncidenceGraph G psi a d).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath U psi a d u v P → v ∈ TreeSequenceVertexSet S → + ∃ (Q : (TwoColorIncidenceGraph G (OutsideTreeColorSwap U psi a c) c d).Walk (Sum.inl u) + (Sum.inl v)), TreeExitPath S (OutsideTreeColorSwap U psi a c) c d u v Q ∧ Q.support = + P.support := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good q _ _ _ _ alpha beta _ _ a₁ b₁ a₂ b₂ a₃ b₃ + P₁ P₂ P₃ _ _ _ f₁ f₂ f₃ _ _ _ _ _ _ _ theta _ _ _ boundary_crossing no_boundary + path_boundary S U psi a c d hSU had hcd ha hc u v P he hv + let mu := OutsideTreeColorSwap U psi a c + have fixed {f : E} (hf : TreeIncidentEdge U f) : mu f = psi f := by + simp [mu, OutsideTreeColorSwap, hf] + have outside_color (f : E) (hf : ¬ TreeIncidentEdge U f) : + (mu f = some c → psi f = some a) ∧ + (mu f = some d ↔ psi f = some d) := by + constructor + · intro hmc + by_cases hfa : psi f = some a + · exact hfa + · by_cases hfc : psi f = some c + · have hca : c ≠ a := by + intro heq + exact hfa (hfc.trans (congrArg some heq)) + have hac : a = c := by + apply Option.some.inj + simpa [mu, OutsideTreeColorSwap, hf, hfa, hfc, hca] using hmc + exact hfc.trans (congrArg some hac.symm) + · have hfc' : psi f = some c := by + simp [mu, OutsideTreeColorSwap, hf, hfa, hfc] at hmc + exact (hfc hfc').elim + · by_cases hfa : psi f = some a + · simp [mu, OutsideTreeColorSwap, hf, hfa, had, hcd] + · by_cases hfc : psi f = some c + · have hca : c ≠ a := by + intro heq + exact hfa (hfc.trans (congrArg some heq)) + simp [mu, OutsideTreeColorSwap, hf, hfc, hca, had, hcd] + · simp [mu, OutsideTreeColorSwap, hf, hfa, hfc] + have remote_missing : c ∈ MissingColors G mu u ∨ d ∈ MissingColors G mu u := by + rcases he.2.2.2.2.1 with hua | hud + · left + have hnot : a ∉ PresentColors G psi u := by simpa [MissingColors] using hua + change c ∈ Finset.univ \ PresentColors G mu u + refine Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, ?_⟩ + intro hpres + obtain ⟨f, hinc, hfc⟩ : ∃ f, Incident G u f ∧ mu f = some c := by + simpa [PresentColors] using hpres + by_cases hf : TreeIncidentEdge U f + · obtain ⟨w, hw, hwf⟩ := hf + exact no_boundary hc (boundary_crossing hw he.2.2.1 hwf hinc) + ((fixed ⟨w, hw, hwf⟩).symm.trans hfc) + · apply hnot + simpa [PresentColors] using (show ∃ f, Incident G u f ∧ psi f = some a from + ⟨f, hinc, (outside_color f hf).1 hfc⟩) + · right + have hnot : d ∉ PresentColors G psi u := by simpa [MissingColors] using hud + change d ∈ Finset.univ \ PresentColors G mu u + refine Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, ?_⟩ + intro hpres + obtain ⟨f, hinc, hfd⟩ : ∃ f, Incident G u f ∧ mu f = some d := by + simpa [PresentColors] using hpres + have hfd' : psi f = some d := by + by_cases hf : TreeIncidentEdge U f + · exact (fixed hf).symm.trans hfd + · exact (outside_color f hf).2.mp hfd + apply hnot + simpa [PresentColors] using (show ∃ f, Incident G u f ∧ psi f = some d from + ⟨f, hinc, hfd'⟩) + have preserve : ∀ {v : V} {f : E}, Sum.inr f ∈ P.support → + (TwoColorIncidenceGraph G psi a d).Adj (Sum.inl v) (Sum.inr f) → + (TwoColorIncidenceGraph G mu c d).Adj (Sum.inl v) (Sum.inr f) := by + intro w f hf hadj + refine ⟨hadj.1, ?_⟩ + by_cases ht : TreeIncidentEdge U f + · have hfd := hadj.2.resolve_left (no_boundary ha (path_boundary P he hf ht)) + exact Or.inr ((fixed ht).trans hfd) + · rcases hadj.2 with hfa | hfd + · exact Or.inl (by simp [mu, OutsideTreeColorSwap, ht, hfa]) + · exact Or.inr ((outside_color f ht).2.mpr hfd) + have hedges : ∀ z, z ∈ P.edges → z ∈ (TwoColorIncidenceGraph G mu c d).edgeSet := by + intro z hz + induction z using Sym2.inductionOn with + | _ x y => + have hadj := (SimpleGraph.mem_edgeSet _).mp (P.edges_subset_edgeSet hz) + have hx := P.fst_mem_support_of_mem_edges hz + have hy := P.snd_mem_support_of_mem_edges hz + apply (SimpleGraph.mem_edgeSet _).mpr + cases x with + | inl w => + cases y with + | inl w' => simp [TwoColorIncidenceGraph] at hadj + | inr f => exact preserve hy hadj + | inr f => + cases y with + | inl w => exact (preserve hx hadj.symm).symm + | inr g => simp [TwoColorIncidenceGraph] at hadj + let Q := P.transfer (TwoColorIncidenceGraph G mu c d) hedges + have hlength : Q.length = P.length := P.length_transfer hedges + have hsupport : Q.support = P.support := P.support_transfer hedges + refine ⟨Q, ⟨he.1.transfer hedges, ?_, ?_, hv, remote_missing, ?_⟩, ?_⟩ + · change 2 ≤ Q.length + rw [hlength] + exact he.2.1 + · exact fun hu => he.2.2.1 (hSU hu) + · intro w hw + change Sum.inl w ∈ Q.support ↔ w = v + rw [hsupport] + exact he.2.2.2.2.2 w (hSU hw) + · exact hsupport + +private theorem helper_terminal_534.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett phi) (_ : + TashkinovHierarchy ett base) (_ : ℕ), ett.series.data.kind (Fin.last ett.rounds) ≠ some + TashkinovExtensionKind.PE → + let r : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); r.succ = Fin.last ett.rounds → + let N : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + let D : Finset (Fin k) := TashkinovStoredColors ett.series.data r.castSucc; + let previous : PartialEdgeColoring E k := ett.series.data.coloring r.castSucc; + ett.series.data.coloring r.succ = phi → IsProperEdgeColoring G previous ∧ + IsOneEdgeUncolored previous e0 ∧ ColoredVertexSetClosed G previous (TreeSequenceVertexSet + N) ∧ StableColoring N D previous phi := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H q hnonPE r hr N D previous hcolor + have cert := ett.series.certified r.succ + generalize hslot : r.succ = slot at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero r hslot).elim + | SE i previousProper previousOne previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternative currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = r := by + apply Fin.ext + have h := congrArg Fin.val hslot + simp only [Fin.val_succ] at h + omega + subst i + have hselected : choice.selected = phi := currentColoring.symm.trans hcolor + refine ⟨previousProper, previousOne, previousClosed, ?_⟩ + rw [← hselected] + exact choice.selectedStable + | RE i previousProper previousOne previousClosed previousNotStronglyClosed available + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = r := by + apply Fin.ext + have h := congrArg Fin.val hslot + simp only [Fin.val_succ] at h + omega + subst i + have he : previous = phi := currentColoring.symm.trans hcolor + refine ⟨previousProper, previousOne, previousClosed, ?_⟩ + rw [he] + exact ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ + | PE i previousProper previousOne previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternativeFails gamma gammaRule secondStable secondStableProper + secondStableOne secondStableRelation exitWitness currentColoring currentProper + currentOne currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension => + have hi : i = r := by + apply Fin.ext + have h := congrArg Fin.val hslot + simp only [Fin.val_succ] at h + omega + subst i + exact (hnonPE (by simpa only [hr] using currentKind)).elim + +private theorem helper_hinter_674.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base) (_ : ℕ) (alpha beta theta : + Fin k), + let r : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + let N : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + let D : Finset (Fin k) := TashkinovStoredColors ett.series.data r.castSucc; + let previous : PartialEdgeColoring E k := ett.series.data.coloring r.castSucc; + let nu : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha theta; + ∀ (c : Fin k), + let rho : PartialEdgeColoring E k := OutsideTreeColorSwap N nu theta c; IsProperEdgeColoring G + (OutsideTreeColorSwap N nu theta c) → IsOneEdgeUncolored (OutsideTreeColorSwap N nu theta + c) e0 → c ∈ TreeMissingColors rho N → StableColoring N D previous rho → + TreeInterchangeable G N rho c beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hlower base H q alpha beta theta r N D + previous nu c rho hrhoProper hrhoOne hcRho hstablePrevious + by_cases hn : ett.rounds = 1 + · have hi : r.succ.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp [r, hn] + have hz : r.castSucc = (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + simp [r, hn] + have hb := (TechnicalTheoremBase G k ett.rounds e0 input ett.series).2 + dsimp only at hb + have hs : StableColoring (ett.series.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors ett.series.data 0) (ett.series.data.coloring 0) rho := by + simpa only [N, D, previous, hi, hz] using hstablePrevious + simpa only [N, hi] using hb rho hrhoProper hrhoOne hs c beta + (Or.inl (by simpa only [N, hi] using hcRho)) + · have hn' : 1 < ett.rounds := by omega + obtain ⟨lower, hlr, hlMP, htrees, hdata⟩ := + CertifiedETTPredecessor G k e0 input T phi ett hMP hn' + let lt : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hcast : Fin.castLE (by omega) lt = r.castSucc := by + apply Fin.ext + simp [lt, r, hlr] + have ht : lower.series.data.tree (Fin.last (lower.rounds + 1)) = N := by + rw [htrees] + congr 1 + apply Fin.ext + simp [hlr, r] + obtain ⟨hco, _, _, _, _, _, _, _, hst, _⟩ := hdata lt + have hs : StableColoring (lower.series.data.tree (Fin.last (lower.rounds + 1))) + (TashkinovStoredColors lower.series.data lt) (lower.series.data.coloring lt) rho := by + rw [ht, hco, hst, hcast] + exact hstablePrevious + have hh := (hlower lower (by omega) (by omega) hlMP).2.1 + dsimp only at hh + simpa only [ht] using hh rho hrhoProper hrhoOne hs c beta + (Or.inl (by simpa only [ht] using hcRho)) + +private theorem helper_earlier_inside_802.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett phi) (_ : + TashkinovHierarchy ett base) (_ : ℕ), + let r : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + let N : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; TreeSequenceInitialSegment + N T → + ∀ {u v : V}, TreeVertexOrder T u v → v ∈ TreeSequenceVertexSet N → u ∈ TreeSequenceVertexSet N + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H q r N hprefix u v huv hv + obtain ⟨hlen, hvertices, _⟩ := hprefix + obtain ⟨i, j, hi, hj, hij⟩ := huv + obtain ⟨t, ht⟩ : ∃ t, N.vertex t = v := by + simpa [TreeSequenceVertexSet] using hv + have hjt : j = Fin.castLE (Nat.succ_le_succ hlen) t := + T.vertex_injective (hj.trans ((hvertices t).trans ht).symm) + have hil : i.val < N.length + 1 := by + have htlt := t.isLt + rw [hjt] at hij + simp only [Fin.val_castLE] at hij + omega + let s : Fin (N.length + 1) := ⟨i.val, hil⟩ + have hsi : Fin.castLE (Nat.succ_le_succ hlen) s = i := by + apply Fin.ext + rfl + have hs : N.vertex s = u := by + rw [← hvertices s, hsi] + exact hi + simpa [TreeSequenceVertexSet] using (show ∃ s, N.vertex s = u from ⟨s, hs⟩) + +private theorem helper_leaf_1000.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (hpositive : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett phi) + (_ : TashkinovHierarchy ett base) (_ : ℕ) (alpha beta theta : Fin k), + let r : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + let N : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + let nu : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha theta; + ∀ (c : Fin k), + let rho : PartialEdgeColoring E k := OutsideTreeColorSwap N nu theta c; + IsProperEdgeColoring G (OutsideTreeColorSwap N nu theta c) → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho c beta; + ∀ (v : V), + c ∈ MissingColors G rho v ∨ beta ∈ MissingColors G rho v → + (J.neighborSet (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H q alpha beta theta r N nu c rho + hrhoProper J v hm z hz w hw + cases z with + | inl y => simp [J, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz + | inr e => + cases w with + | inl y => simp [J, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw + | inr f => + have he : Incident G v e ∧ (rho e = some c ∨ rho e = some beta) := by + simpa [J, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] using hz + have hf : Incident G v f ∧ (rho f = some c ∨ rho f = some beta) := by + simpa [J, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] using hw + apply congrArg Sum.inr + by_contra hef + have absent (d : Fin k) (hd : d ∈ MissingColors G rho v) : + ∀ e, Incident G v e → rho e ≠ some d := by + intro e he hco + have hn : d ∉ PresentColors G rho v := by simpa [MissingColors] using hd + exact hn (by simpa [PresentColors] using + (show ∃ f, Incident G v f ∧ rho f = some d from ⟨e, he, hco⟩)) + rcases hm with hm | hm + · exact (hrhoProper hef ⟨v, he.1, hf.1⟩ + (he.2.resolve_left (absent c hm e he.1))) + (hf.2.resolve_left (absent c hm f hf.1)) + · exact (hrhoProper hef ⟨v, he.1, hf.1⟩ + (he.2.resolve_right (absent beta hm e he.1))) + (hf.2.resolve_right (absent beta hm f hf.1)) + +private theorem helper_hthetaClosedN_1001.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (hpositive : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (_ : ℕ) (alpha theta : Fin k), + TreeColorSetClosed G phi (HierarchyStarredStage H (Fin.last H.dividerCount)) { theta } → + let r : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + let N : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; + HierarchyStarredStage H (Fin.last H.dividerCount) = N → + TreeSequenceVertexSet N ⊆ TreeSequenceVertexSet T → + let nu : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha theta; + (∀ (f : E), TreeIncidentEdge T f → OutsideTreeColorSwap T phi alpha theta f = phi f) → + TreeColorSetClosed G nu N { theta } := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H q alpha theta hthetaClosedStar r N + hstar hsub nu hnuFixed d hd + have hold : TreeColorSetClosed G phi N {theta} := by + simpa only [hstar] using hthetaClosedStar + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨hb, hfd⟩ := Finset.mem_filter.mp hf + obtain ⟨v, hv, w, hw, he⟩ : ∃ v ∈ TreeSequenceVertexSet N, + ∃ w ∉ TreeSequenceVertexSet N, G.ends f = Sym2.mk v w := by + simpa [BoundaryEdges] using hb + have hfixed := hnuFixed f ⟨v, hsub hv, by simp [Incident, he]⟩ + have hm : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet N) d := + Finset.mem_filter.mpr ⟨hb, hfixed.symm.trans hfd⟩ + rw [hold d hd] at hm + simp at hm + +private theorem helper_continuation_1341.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (alpha beta : Fin k) (a₁ b₁ a₂ b₂ a₃ b₃ : + V), a₁ ≠ a₂ → a₁ ≠ a₃ → a₂ ≠ a₃ → + ∀ (theta : Fin k), + let r : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + let N : TreeSequence G e0 := ett.series.data.tree r.succ.castSucc; b₃ ∈ TreeSequenceVertexSet + N → b₂ ∈ TreeSequenceVertexSet N → b₁ ∈ TreeSequenceVertexSet N → + let nu : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha theta; + ∀ (c : Fin k), + ∀ x ∈ TreeSequenceVertexSet N, c ≠ beta → beta ∈ PresentColors G nu x → + let rho : PartialEdgeColoring E k := OutsideTreeColorSwap N nu theta c; IsProperEdgeColoring G + (OutsideTreeColorSwap N nu theta c) → ( + ∀ (f : E), TreeIncidentEdge N f → OutsideTreeColorSwap N nu theta c f = nu f) → + ∀ (_ : (TwoColorIncidenceGraph G (OutsideTreeColorSwap N nu theta c) c beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (_ : (TwoColorIncidenceGraph G (OutsideTreeColorSwap N nu theta c) c + beta).Walk (Sum.inl a₂) (Sum.inl b₂)) (_ : (TwoColorIncidenceGraph G (OutsideTreeColorSwap + N nu theta c) c beta).Walk (Sum.inl a₃) (Sum.inl b₃)), TreeInterchangeable G N rho c beta + → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho c beta; (J.neighborSet (Sum.inl + x)).Subsingleton → (J.neighborSet (Sum.inl a₁)).Subsingleton → (J.neighborSet (Sum.inl + a₂)).Subsingleton → (J.neighborSet (Sum.inl a₃)).Subsingleton → False := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive alpha beta a₁ b₁ a₂ b₂ a₃ b₃ ha₁₂ ha₁₃ ha₂₃ + theta r N hb3 hb2 hb1 nu c x hx hcb hbetaNu rho hrhoProper hrhoFixed L1 L2 L3 hinter J lx + l1 l2 l3 + have x_neighbor : ∃ z, J.Adj (Sum.inl x) z := by + obtain ⟨f, hinc, hf⟩ : ∃ f, Incident G x f ∧ nu f = some beta := by + simpa [PresentColors] using hbetaNu + exact ⟨Sum.inr f, hinc, Or.inr ((hrhoFixed f ⟨x, hx, hinc⟩).trans hf)⟩ + have self (v : V) : Sum.inl v ∈ TwoColorComponent G rho c beta (Sum.inl v) := + (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr rfl + have px : TwoColorPathComponent G rho c beta (Sum.inl x) := + ⟨hcb, Sum.inl x, self x, lx⟩ + have p1 : TwoColorPathComponent G rho c beta (Sum.inl a₁) := + ⟨hcb, Sum.inl a₁, self _, l1⟩ + have p2 : TwoColorPathComponent G rho c beta (Sum.inl a₂) := + ⟨hcb, Sum.inl a₂, self _, l2⟩ + have p3 : TwoColorPathComponent G rho c beta (Sum.inl a₃) := + ⟨hcb, Sum.inl a₃, self _, l3⟩ + have meet1 : Sum.inl b₁ ∈ TwoColorComponent G rho c beta (Sum.inl a₁) := + (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr + (SimpleGraph.ConnectedComponent.eq.mpr L1.reachable.symm) + have meet2 : Sum.inl b₂ ∈ TwoColorComponent G rho c beta (Sum.inl a₂) := + (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr + (SimpleGraph.ConnectedComponent.eq.mpr L2.reachable.symm) + have meet3 : Sum.inl b₃ ∈ TwoColorComponent G rho c beta (Sum.inl a₃) := + (SimpleGraph.ConnectedComponent.mem_supp_iff _ _).mpr + (SimpleGraph.ConnectedComponent.eq.mpr L3.reachable.symm) + have eq1 := hinter (Sum.inl x) (Sum.inl a₁) px p1 ⟨x, hx, self x⟩ ⟨b₁, hb1, meet1⟩ + have eq2 := hinter (Sum.inl x) (Sum.inl a₂) px p2 ⟨x, hx, self x⟩ ⟨b₂, hb2, meet2⟩ + have eq3 := hinter (Sum.inl x) (Sum.inl a₃) px p3 ⟨x, hx, self x⟩ ⟨b₃, hb3, meet3⟩ + obtain ⟨u, v, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G rho c beta hrhoProper (Sum.inl x) + have endpoint (w : V) (hw : Sum.inl w ∈ TwoColorComponent G rho c beta (Sum.inl x)) + (hl : Set.Subsingleton (J.neighborSet (Sum.inl w))) : + Sum.inl w = u ∨ Sum.inl w = v := by + by_contra hn + push Not at hn + apply hp.isTrail.notMem_support_of_subsingleton_neighborSet hn.1 hn.2 hl + change Sum.inl w ∈ {z | z ∈ p.support} + rw [hsupport] + exact hw + have e1 := endpoint a₁ (by rw [eq1]; exact self _) l1 + have e2 := endpoint a₂ (by rw [eq2]; exact self _) l2 + have e3 := endpoint a₃ (by rw [eq3]; exact self _) l3 + have ha12 : (Sum.inl a₁ : Sum V E) ≠ Sum.inl a₂ := by simpa using ha₁₂ + have ha13 : (Sum.inl a₁ : Sum V E) ≠ Sum.inl a₃ := by simpa using ha₁₃ + have ha23 : (Sum.inl a₂ : Sum V E) ≠ Sum.inl a₃ := by simpa using ha₂₃ + rcases e1 with e1 | e1 + · rcases e2 with e2 | e2 + · exact ha12 (e1.trans e2.symm) + · rcases e3 with e3 | e3 + · exact ha13 (e1.trans e3.symm) + · exact ha23 (e2.trans e3.symm) + · rcases e2 with e2 | e2 + · rcases e3 with e3 | e3 + · exact ha23 (e2.trans e3.symm) + · exact ha13 (e1.trans e3.symm) + · exact ha12 (e1.trans e2.symm) + +private theorem helper_continuation_992.{u_1, u_2} : + helperContinuation992Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hproper hone hlower base H good q _ _ + hlarge _ _ alpha beta _ hclosed hne _ a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ hP₁ hP₂ hP₃ hpaths₁₂ + hpaths₁₃ hpaths₂₃ ha₁₂ ha₁₃ ha₂₃ _ _ _ f₁ f₂ f₃ _ _ hf₃ _ _ hif₃ _ _ _ theta _ hthetaBeta _ + hthetaClosedStar hthetaClosed _ hnonPE r hr N D previous hcolor hstar hsub hb3 hb2 hb1 + stable_outside transfer_exit nu hnuProper hnuOne hnuFixed hnuStableN + obtain ⟨Q1, hQ1, hsQ1⟩ := transfer_exit N T phi alpha theta beta hsub hne + hthetaBeta hclosed hthetaClosed P₁ hP₁ hb1 + obtain ⟨Q2, hQ2, hsQ2⟩ := transfer_exit N T phi alpha theta beta hsub hne + hthetaBeta hclosed hthetaClosed P₂ hP₂ hb2 + obtain ⟨Q3, hQ3, hsQ3⟩ := transfer_exit N T phi alpha theta beta hsub hne + hthetaBeta hclosed hthetaClosed P₃ hP₃ hb3 + -- Read the actual terminal certificate to obtain the previous control set. + have terminal := @helper_terminal_534 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett hpositive base H q hnonPE hr hcolor + have hnuPrevious : StableColoring N D previous nu := + (sc2 G e0 N D).trans (x := ⟨previous, terminal.1, terminal.2.1⟩) + (y := ⟨phi, hproper, hone⟩) (z := ⟨nu, hnuProper, hnuOne⟩) + terminal.2.2.2 hnuStableN + have hreverse : StableColoring N D nu previous := + (sc2 G e0 N D).symm (x := ⟨previous, terminal.1, terminal.2.1⟩) + (y := ⟨nu, hnuProper, hnuOne⟩) hnuPrevious + have hnuClosed : ColoredVertexSetClosed G nu (TreeSequenceVertexSet N) := by + intro f d v hf hv hfd hmissing + obtain ⟨w, hw, z, hz, he⟩ : ∃ w ∈ TreeSequenceVertexSet N, + ∃ z ∉ TreeSequenceVertexSet N, G.ends f = Sym2.mk w z := by + simpa [BoundaryEdges] using hf + have hinc : TreeIncidentEdge N f := ⟨w, hw, by simp [Incident, he]⟩ + have hd : d ∈ TreeMissingColors nu N := Finset.mem_biUnion.mpr ⟨v, hv, hmissing⟩ + have hprevious : previous f = some d := + (hreverse.1 f hinc ⟨d, Finset.mem_union_left _ hd, hfd⟩).trans hfd + exact (terminal.2.2.1 hf hv hprevious) (by rw [hreverse.2 v hv]; exact hmissing) + have missing_closed : ∀ d ∈ TreeMissingColors nu N, TreeColorSetClosed G nu N {d} := by + intro d hd a ha + have had : a = d := Finset.mem_singleton.mp ha + subst a + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hd + obtain ⟨hb, hfd⟩ := Finset.mem_filter.mp hf + exact (hnuClosed hb hv hfd) hm + have hlargeN : 2 * ett.rounds + 11 ≤ (TreeMissingColors phi N).card := by + simpa only [N, hr] using hlarge + obtain ⟨c, hc⟩ := Finset.card_pos.mp (show 0 < (TreeMissingColors phi N).card by omega) + obtain ⟨x, hx, hcx⟩ := Finset.mem_biUnion.mp hc + have hcxNu : c ∈ MissingColors G nu x := by rw [hnuStableN.2 x hx]; exact hcx + have hcNu : c ∈ TreeMissingColors nu N := Finset.mem_biUnion.mpr ⟨x, hx, hcxNu⟩ + have hcClosed := missing_closed c hcNu + have hthetaClosedN := @helper_hthetaClosedN_1001 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett hpositive base H q alpha theta hthetaClosedStar hstar + hsub hnuFixed + have hf3N : f₃ ∈ BoundaryColorEdges G nu (TreeSequenceVertexSet N) beta := by + obtain ⟨hb, hfc⟩ := Finset.mem_filter.mp hf₃ + obtain ⟨v, hv, w, hw, he⟩ : ∃ v ∈ TreeSequenceVertexSet T, + ∃ w ∉ TreeSequenceVertexSet T, G.ends f₃ = Sym2.mk v w := by + simpa [BoundaryEdges] using hb + have hbends : b₃ = v ∨ b₃ = w := by simpa [Incident, he] using hif₃ + have hbv := hbends.resolve_right (fun h => hw (h ▸ hsub hb3)) + refine Finset.mem_filter.mpr ⟨?_, (hnuFixed f₃ ⟨b₃, hsub hb3, hif₃⟩).trans hfc⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨b₃, hb3, w, fun h => hw (hsub h), by rw [hbv]; exact he⟩ + have hcb : c ≠ beta := by + intro he + have hm := hf3N + rw [← he, hcClosed c (Finset.mem_singleton_self c)] at hm + simp at hm + have hbetaNu : beta ∈ PresentColors G nu x := by + by_contra h + have hm : beta ∈ MissingColors G nu x := by simpa [MissingColors] using h + have hc' := missing_closed beta (Finset.mem_biUnion.mpr ⟨x, hx, hm⟩) + have hf := hf3N + rw [hc' beta (Finset.mem_singleton_self beta)] at hf + simp at hf + let rho := OutsideTreeColorSwap N nu theta c + obtain ⟨hrhoProper, hrhoOne, hrhoStable, hrhoFixed⟩ := + stable_outside N D nu theta c hnuProper hnuOne hthetaClosedN hcClosed + obtain ⟨L1, hL1, hsL1⟩ := transfer_exit N N nu theta c beta (fun _ h => h) + hthetaBeta hcb hthetaClosedN hcClosed Q1 hQ1 hb1 + obtain ⟨L2, hL2, hsL2⟩ := transfer_exit N N nu theta c beta (fun _ h => h) + hthetaBeta hcb hthetaClosedN hcClosed Q2 hQ2 hb2 + obtain ⟨L3, hL3, hsL3⟩ := transfer_exit N N nu theta c beta (fun _ h => h) + hthetaBeta hcb hthetaClosedN hcClosed Q3 hQ3 hb3 + have hdisjoint12 : ∀ z, z ∈ L1.support → z ∉ L2.support := by + simpa only [hsL1, hsL2, hsQ1, hsQ2] using hpaths₁₂ + have hdisjoint13 : ∀ z, z ∈ L1.support → z ∉ L3.support := by + simpa only [hsL1, hsL3, hsQ1, hsQ3] using hpaths₁₃ + have hdisjoint23 : ∀ z, z ∈ L2.support → z ∉ L3.support := by + simpa only [hsL2, hsL3, hsQ2, hsQ3] using hpaths₂₃ + have hcxRho : c ∈ MissingColors G rho x := by rw [hrhoStable.2 x hx]; exact hcxNu + have hcRho : c ∈ TreeMissingColors rho N := Finset.mem_biUnion.mpr ⟨x, hx, hcxRho⟩ + have hstablePrevious : StableColoring N D previous rho := + (sc2 G e0 N D).trans (x := ⟨previous, terminal.1, terminal.2.1⟩) + (y := ⟨nu, hnuProper, hnuOne⟩) (z := ⟨rho, hrhoProper, hrhoOne⟩) + hnuPrevious hrhoStable + have hinter := @helper_hinter_674 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett hMP hpositive hlower base H q alpha beta theta c hrhoProper hrhoOne hcRho + hstablePrevious + -- Missing colors give degree at most one; the retained beta edge makes x a leaf. + let J := TwoColorIncidenceGraph G rho c beta + have leaf := @helper_leaf_1000 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett hpositive base H q alpha beta theta c hrhoProper + have lx := leaf x (Or.inl hcxRho) + have l1 := leaf a₁ hL1.2.2.2.2.1 + have l2 := leaf a₂ hL2.2.2.2.2.1 + have l3 := leaf a₃ hL3.2.2.2.2.1 + exact @helper_continuation_1341 V E inferInstance inferInstance inferInstance G k e0 input T + phi ett hpositive alpha beta a₁ b₁ a₂ b₂ a₃ b₃ ha₁₂ ha₁₃ ha₂₃ theta hb3 hb2 hb1 c x hx hcb + hbetaNu hrhoProper hrhoFixed L1 L2 L3 hinter lx l1 l2 l3 +lemma Step1CaseTwoInsideZeroNonPE {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (_ : H.dividerCount < q) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (_ : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (_ : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (_ : beta ∉ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ a₃ b₃ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₃) (Sum.inl b₃)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hP₃ : TreeExitPath T phi alpha beta a₃ b₃ P₃) + (hpaths₁₂ : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (hpaths₁₃ : ∀ x, x ∈ P₁.support → x ∉ P₃.support) + (hpaths₂₃ : ∀ x, x ∈ P₂.support → x ∉ P₃.support) + (ha₁₂ : a₁ ≠ a₂) (ha₁₃ : a₁ ≠ a₃) (ha₂₃ : a₂ ≠ a₃) + (_ : b₁ ≠ b₂) (_ : b₁ ≠ b₃) (_ : b₂ ≠ b₃) + (horder₁₂ : TreeVertexOrder T b₁ b₂) + (horder₂₃ : TreeVertexOrder T b₂ b₃) + (f₁ f₂ f₃ : E) + (_ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₃ : f₃ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : Incident G b₁ f₁) (_ : Incident G b₂ f₂) + (hif₃ : Incident G b₃ f₃) + (_ : Sum.inr f₁ ∈ P₁.support) + (_ : Sum.inr f₂ ∈ P₂.support) + (_ : Sum.inr f₃ ∈ P₃.support) + (hinside : b₃ ∈ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (theta : Fin k) (_ : theta ≠ alpha) + (hthetaBeta : theta ≠ beta) + (_ : theta ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hthetaClosedStar : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {theta}) + (hthetaClosed : TreeColorSetClosed G phi T {theta}) + (_ : + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount < H.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' {a} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → False) + (hdividerZero : H.dividerCount = 0) + (hnonPE : ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE) : + False := by + classical + let r : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hr : r.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [r] + omega + let N := ett.series.data.tree r.succ.castSucc + let D := TashkinovStoredColors ett.series.data r.castSucc + let previous := ett.series.data.coloring r.castSucc + have hcolor : ett.series.data.coloring r.succ = phi := by + rw [hr] + exact ett.generatingColoring.symm + have hstar : HierarchyStarredStage H (Fin.last H.dividerCount) = N := by + have hz : Fin.last H.dividerCount = (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [hdividerZero] + rw [hz] + change base.core = N + simpa only [N, hr] using base.nonparallel hnonPE + have hprefix : TreeSequenceInitialSegment N T := by + convert ett.abovePenultimate using 1 + change ett.series.data.tree r.succ.castSucc = _ + congr 1 + apply Fin.ext + simp [r] + omega + have hsub : TreeSequenceVertexSet N ⊆ TreeSequenceVertexSet T := + TreeSequenceInitialSegmentVertexSetSubset hprefix + have earlier_inside := @helper_earlier_inside_802 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett hpositive base H q hprefix + have hb3 : b₃ ∈ TreeSequenceVertexSet N := by simpa only [hstar] using hinside + have hb2 := earlier_inside horder₂₃ hb3 + have hb1 := earlier_inside horder₁₂ hb2 + have boundary_crossing : ∀ {S : TreeSequence G e0} {f : E} {v w : V}, + v ∈ TreeSequenceVertexSet S → w ∉ TreeSequenceVertexSet S → + Incident G v f → Incident G w f → + f ∈ BoundaryEdges G (TreeSequenceVertexSet S) := by + intro S f v w hv hw hvf hwf + have hvw : v ≠ w := by intro he; exact hw (he ▸ hv) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hv, w, hw, (Sym2.mem_and_mem_iff hvw).mp ⟨hvf, hwf⟩⟩ + have no_boundary : ∀ {S : TreeSequence G e0} {psi : PartialEdgeColoring E k} + {d : Fin k}, TreeColorSetClosed G psi S {d} → + ∀ {f}, f ∈ BoundaryEdges G (TreeSequenceVertexSet S) → psi f ≠ some d := by + intro S psi d hc f hf hfd + have hm : f ∈ BoundaryColorEdges G psi (TreeSequenceVertexSet S) d := + Finset.mem_filter.mpr ⟨hf, hfd⟩ + rw [hc d (Finset.mem_singleton_self d)] at hm + simp at hm + -- The pointwise outside swap is an exchange of full outside components. + have outside_recolor := @helper_outside_recolor_267 V E inferInstance inferInstance + G k e0 boundary_crossing no_boundary + have stable_outside : + ∀ (S : TreeSequence G e0) (C : Finset (Fin k)) (psi : PartialEdgeColoring E k) (a c : Fin k), + IsProperEdgeColoring G psi → IsOneEdgeUncolored psi e0 → TreeColorSetClosed G psi S {a} → + TreeColorSetClosed G psi S {c} → IsProperEdgeColoring G (OutsideTreeColorSwap S psi a c) ∧ + IsOneEdgeUncolored (OutsideTreeColorSwap S psi a c) e0 ∧ StableColoring S C psi + (OutsideTreeColorSwap S psi a c) ∧ + ∀ f, TreeIncidentEdge S f → OutsideTreeColorSwap S psi a c f = psi f := by + intro S C psi a c hp ho ha hc + by_cases hac : a = c + · have he : OutsideTreeColorSwap S psi a c = psi := by + funext f + by_cases ht : TreeIncidentEdge S f <;> by_cases hf : psi f = some c <;> + simp [OutsideTreeColorSwap, ht, hac, hf] + rw [he] + exact ⟨hp, ho, ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩, fun _ _ => rfl⟩ + · obtain ⟨hp', ho', hs, _, hf⟩ := OutsideKempeRecoloringStable G e0 S C psi + (OutsideTreeColorSwap S psi a c) a c hp ho (outside_recolor S psi a c hac ha hc) + exact ⟨hp', ho', hs, hf⟩ + have path_boundary : ∀ {S : TreeSequence G e0} {psi : PartialEdgeColoring E k} + {a d : Fin k} {u v : V} + (P : (TwoColorIncidenceGraph G psi a d).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath S psi a d u v P → ∀ {f}, Sum.inr f ∈ P.support → + TreeIncidentEdge S f → f ∈ BoundaryEdges G (TreeSequenceVertexSet S) := by + exact @helper_path_boundary_354 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett hpositive base H good q (by assumption) (by assumption) + (by assumption) (by assumption) alpha beta (by assumption) (by assumption) a₁ b₁ a₂ b₂ a₃ + b₃ P₁ P₂ P₃ (by assumption) (by assumption) (by assumption) f₁ f₂ f₃ (by assumption) + (by assumption) (by assumption) (by assumption) (by assumption) (by assumption) + (by assumption) theta (by assumption) (by assumption) (by assumption) boundary_crossing + have transfer_exit : + ∀ (S U : TreeSequence G e0) (psi : PartialEdgeColoring E k) (a c d : Fin k), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet U → a ≠ d → c ≠ d → TreeColorSetClosed G + psi U {a} → TreeColorSetClosed G psi U {c} → + ∀ {u v : V} (P : (TwoColorIncidenceGraph G psi a d).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath U psi a d u v P → v ∈ TreeSequenceVertexSet S → + ∃ Q : (TwoColorIncidenceGraph G (OutsideTreeColorSwap U psi a c) c d).Walk (Sum.inl u) + (Sum.inl v), TreeExitPath S (OutsideTreeColorSwap U psi a c) c d u v Q ∧ Q.support = + P.support := by + exact @helper_transfer_exit_407 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base H good q (by assumption) (by assumption) (by assumption) + (by assumption) alpha beta (by assumption) (by assumption) a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ + (by assumption) (by assumption) (by assumption) f₁ f₂ f₃ (by assumption) (by assumption) + (by assumption) (by assumption) (by assumption) (by assumption) (by assumption) theta + (by assumption) (by assumption) (by assumption) boundary_crossing no_boundary path_boundary + let nu := OutsideTreeColorSwap T phi alpha theta + obtain ⟨hnuProper, hnuOne, hnuStable, hnuFixed⟩ := + stable_outside T D phi alpha theta hproper hone hclosed hthetaClosed + have hnuStableN : StableColoring N D phi nu := + ⟨fun f hf _ => by + obtain ⟨v, hv, hinc⟩ := hf + exact hnuFixed f ⟨v, hsub hv, hinc⟩, + fun v hv => hnuStable.2 v (hsub hv)⟩ + exact @helper_continuation_992 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett hMP hpositive hproper hone hlower base H good q (by assumption) + (by assumption) hlarge (by assumption) (by assumption) alpha beta (by assumption) hclosed + hne (by assumption) a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ hP₁ hP₂ hP₃ hpaths₁₂ hpaths₁₃ hpaths₂₃ ha₁₂ + ha₁₃ ha₂₃ (by assumption) (by assumption) (by assumption) f₁ f₂ f₃ (by assumption) + (by assumption) hf₃ (by assumption) (by assumption) hif₃ (by assumption) (by assumption) + (by assumption) theta (by assumption) hthetaBeta (by assumption) hthetaClosedStar + hthetaClosed (by assumption) hnonPE hr hcolor hstar hsub hb3 hb2 hb1 stable_outside + transfer_exit hnuProper hnuOne hnuFixed hnuStableN +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroPE.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroPE.lean new file mode 100644 index 0000000000..71cce30030 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroPE.lean @@ -0,0 +1,584 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchorPE +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Step1Case Two Inside Zero PE + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_continuation_382.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + MaximumProperty ett → + (0 : ℕ) < ett.rounds → + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) + (_ : GoodHierarchy H) (alpha beta : Fin k) (a₁ b₁ a₂ b₂ a₃ b₃ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl b₂)) + (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₃) (Sum.inl b₃)), + TreeExitPath T phi alpha beta a₁ b₁ P₁ → + TreeExitPath T phi alpha beta a₂ b₂ P₂ → + TreeExitPath T phi alpha beta a₃ b₃ P₃ → + (∀ x ∈ P₂.support, x ∉ P₃.support) → + a₂ ≠ a₃ → + ∀ (theta : Fin k), + theta ≠ beta → + theta ∈ TreeMissingColors phi (HierarchyStarredStage H (Fin.last H.dividerCount)) → + TreeColorSetClosed G phi (HierarchyStarredStage H (Fin.last H.dividerCount)) + ({ theta } : Finset (Fin k)) → + (∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount < H.dividerCount → + (2 : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), + a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' ({ a } : Finset (Fin k)) → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : + (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₁) + (Sum.inl v₁)) + (Q₂ : + (TwoColorIncidenceGraph G sigma a b).Walk (Sum.inl u₂) + (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x ∈ Q₁.support, x ∉ Q₂.support) → + u₁ ≠ u₂ → False) → + H.dividerCount = (0 : ℕ) → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + A = base.core → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet T → + b₃ ∈ TreeSequenceVertexSet A → + b₂ ∈ TreeSequenceVertexSet A → + b₁ ∈ TreeSequenceVertexSet A → + let roots : Finset (V ⊕ E) := + ({z : V ⊕ E | + match z with + | Sum.inl v => v ∉ TreeSequenceVertexSet T + | Sum.inr _ => False} : + Finset (V ⊕ E)); + let selected : E → Prop := fun (f : E) ↦ + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha theta z; + let nu : PartialEdgeColoring E k := fun (f : E) ↦ + if selected f then + if phi f = some alpha then some theta + else if phi f = some theta then some alpha else phi f + else phi f; + OutsideKempeRecoloring T phi nu alpha theta → + (∀ u ∉ TreeSequenceVertexSet T, + ∀ (f : E), Incident G u f → phi f = some alpha ∨ phi f = some theta → selected f) → + (∀ (f : E), nu f = some beta ↔ phi f = some beta) → + (∀ u ∉ TreeSequenceVertexSet T, + alpha ∈ MissingColors G phi u ∨ beta ∈ MissingColors G phi u → + theta ∈ MissingColors G nu u ∨ beta ∈ MissingColors G nu u) → + (∀ (u v : V) + (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath T phi alpha beta u v P → + ∀ (f : E), + Sum.inr f ∈ P.support → ∃ w ∉ TreeSequenceVertexSet T, Incident G w f) → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hproper hone hlower base H good alpha + beta a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ hP₁ hP₂ hP₃ hpaths₂₃ ha₂₃ theta hthetaBeta hthetaMissing + hthetaClosedStar _ hdividerZero hPE A hAcore hAsub hb₃A hb₂A hb₁A roots selected nu + hrecolor selectedOfOutside betaFixed remoteMissing pathEdgeOutside + have transferExit : ∀ (u v : V) + (P : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl u) (Sum.inl v)), + TreeExitPath T phi alpha beta u v P → v ∈ TreeSequenceVertexSet A → + ∃ Q : (TwoColorIncidenceGraph G nu theta beta).Walk + (Sum.inl u) (Sum.inl v), + TreeExitPath A nu theta beta u v Q ∧ Q.support = P.support := by + intro u v P hExit hvA + have colors : ∀ f, Sum.inr f ∈ P.support → + (phi f = some alpha ∨ phi f = some beta) → + nu f = some theta ∨ nu f = some beta := by + intro f hf hc + rcases hc with ha | hb + · obtain ⟨w, hwT, hwf⟩ := pathEdgeOutside u v P hExit f hf + have hs := selectedOfOutside w hwT f hwf (Or.inl ha) + exact Or.inl (by simp [nu, hs, ha]) + · exact Or.inr ((betaFixed f).mpr hb) + have edges : ∀ z, z ∈ P.edges → z ∈ (TwoColorIncidenceGraph G nu theta beta).edgeSet := by + intro z hz + induction z using Sym2.inductionOn with + | _ x y => + have hadj := (SimpleGraph.mem_edgeSet _).mp (P.edges_subset_edgeSet hz) + have hx := P.fst_mem_support_of_mem_edges hz + have hy := P.snd_mem_support_of_mem_edges hz + apply (SimpleGraph.mem_edgeSet _).mpr + cases x with + | inl w => + cases y with + | inl z => exact False.elim hadj + | inr f => exact ⟨hadj.1, colors f hy hadj.2⟩ + | inr f => + cases y with + | inr g => exact False.elim hadj + | inl w => exact ⟨hadj.1, colors f hx hadj.2⟩ + let Q := P.transfer (TwoColorIncidenceGraph G nu theta beta) edges + refine ⟨Q, ?_, by simp [Q]⟩ + refine ⟨hExit.1.transfer edges, by simpa [Q] using hExit.2.1, + fun huA => hExit.2.2.1 (hAsub huA), hvA, + remoteMissing u hExit.2.2.1 hExit.2.2.2.2.1, ?_⟩ + intro w hw + simpa [Q] using hExit.2.2.2.2.2 w (hAsub hw) + obtain ⟨Q₁, hQ₁, hs₁⟩ := transferExit a₁ b₁ P₁ hP₁ hb₁A + obtain ⟨Q₂, hQ₂, hs₂⟩ := transferExit a₂ b₂ P₂ hP₂ hb₂A + obtain ⟨Q₃, hQ₃, hs₃⟩ := transferExit a₃ b₃ P₃ hP₃ hb₃A + obtain ⟨hnuProper, hnuOne, hnuStable, hnuInvariant, + corr, hnuMP, baseNu, K, goodNu, hsame, _⟩ := + HierarchyLEMStable G k e0 input T phi nu ett hMP hpositive hlower + base H good hproper hone alpha theta hrecolor + have hfixed := (OutsideKempeRecoloringStable G e0 T ∅ phi nu alpha theta + hproper hone hrecolor).2.2.2.2 + rcases hsame.1 with ⟨hcore, hcount, _, _, hkind, _⟩ + have hKzero : K.dividerCount = 0 := hcount.symm.trans hdividerZero + have hKlast : Fin.last K.dividerCount = (0 : Fin (K.dividerCount + 1)) := + Fin.ext (by simp [hKzero]) + have hKcore : HierarchyStarredStage K (Fin.last K.dividerCount) = A := by + rw [hKlast] + change baseNu.core = A + exact hcore.symm.trans hAcore.symm + have hthetaNu : theta ∈ TreeMissingColors nu A := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hthetaMissing + apply Finset.mem_biUnion.mpr + refine ⟨v, hv, ?_⟩ + rw [hnuInvariant.2 v (hAsub hv)] + exact hm + have hthetaNuClosed : TreeColorSetClosed G nu A {theta} := by + intro c hc + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + have hboundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet A) ∧ + nu f = some c := by simpa [BoundaryColorEdges] using hf + obtain ⟨u, hu, v, hv, he⟩ := by + simpa [BoundaryEdges] using hboundary.1 + have huf : Incident G u f := by simp [Incident, he] + have hold : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet A) c := by + apply Finset.mem_filter.mpr + exact ⟨hboundary.1, (hfixed f ⟨u, hAsub hu, huf⟩).symm.trans hboundary.2⟩ + rw [hthetaClosedStar c hc] at hold + exact Finset.notMem_empty _ hold + -- The closed PE anchor performs the second exchange on this transported base. + apply Step1ZeroDividerAnchorPE G k e0 corr.replacementInput T nu + corr.replacementETT hnuMP (by simpa [corr.rungAgreement] using hpositive) + hnuProper hnuOne (fun lower hp hr hm => + hlower lower hp (by simpa [corr.rungAgreement] using hr) hm) + baseNu K hKzero theta beta hthetaBeta + (by simpa only [hKcore] using hthetaNu) + (by simpa only [hKcore] using hthetaNuClosed) + a₂ b₂ a₃ b₃ Q₂ Q₃ + (by simpa only [hKcore] using hQ₂) + (by simpa only [hKcore] using hQ₃) + (fun z hz => by rw [hs₂] at hz; rw [hs₃]; exact hpaths₂₃ z hz) + ha₂₃ (hkind.mp hPE) + +lemma Step1CaseTwoInsideZeroPE {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (_ : H.dividerCount < q) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (_ : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (_ : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (_ : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (_ : beta ∉ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ a₃ b₃ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₃) (Sum.inl b₃)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hP₃ : TreeExitPath T phi alpha beta a₃ b₃ P₃) + (_ : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (_ : ∀ x, x ∈ P₁.support → x ∉ P₃.support) + (hpaths₂₃ : ∀ x, x ∈ P₂.support → x ∉ P₃.support) + (_ : a₁ ≠ a₂) (_ : a₁ ≠ a₃) (ha₂₃ : a₂ ≠ a₃) + (_ : b₁ ≠ b₂) (_ : b₁ ≠ b₃) (_ : b₂ ≠ b₃) + (horder₁₂ : TreeVertexOrder T b₁ b₂) + (horder₂₃ : TreeVertexOrder T b₂ b₃) + (f₁ f₂ f₃ : E) + (_ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : f₃ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : Incident G b₁ f₁) (_ : Incident G b₂ f₂) + (_ : Incident G b₃ f₃) + (_ : Sum.inr f₁ ∈ P₁.support) + (_ : Sum.inr f₂ ∈ P₂.support) + (_ : Sum.inr f₃ ∈ P₃.support) + (hinside : b₃ ∈ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (theta : Fin k) (hthetaAlpha : theta ≠ alpha) + (hthetaBeta : theta ≠ beta) + (hthetaMissing : theta ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hthetaClosedStar : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {theta}) + (hthetaClosed : TreeColorSetClosed G phi T {theta}) + (_ : + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount < H.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' {a} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → False) + (hdividerZero : H.dividerCount = 0) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) : + False := by + classical + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + have hlast : Fin.last H.dividerCount = (0 : Fin (H.dividerCount + 1)) := + Fin.ext (by simp [hdividerZero]) + have hAcore : A = base.core := by + simp [A, hlast, HierarchyStarredStage] + have hfirst : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp [hdividerZero]) + have hAT : TreeSequenceInitialSegment A T := by + simpa only [hAcore, hfirst, H.terminalStage] using H.coreInsideFirst + have hAsub := TreeSequenceInitialSegmentVertexSetSubset hAT + have beforeInside : ∀ {u v : V}, TreeVertexOrder T u v → + v ∈ TreeSequenceVertexSet A → u ∈ TreeSequenceVertexSet A := by + intro u v huv hv + obtain ⟨i, j, hi, hj, hij⟩ := huv + obtain ⟨r, hr⟩ := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] using hv + have hrj : Fin.castLE (Nat.succ_le_succ hAT.1) r = j := + T.vertex_injective ((hAT.2.1 r).trans (hr.trans hj.symm)) + have hval : r.val = j.val := congrArg Fin.val hrj + let s : Fin (A.length + 1) := ⟨i.val, by have := r.isLt; omega⟩ + have hsi : Fin.castLE (Nat.succ_le_succ hAT.1) s = i := Fin.ext rfl + unfold TreeSequenceVertexSet + simp only [Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨s, (hAT.2.1 s).symm.trans (hsi ▸ hi)⟩ + have hb₃A : b₃ ∈ TreeSequenceVertexSet A := hinside + have hb₂A := beforeInside horder₂₃ hb₃A + have hb₁A := beforeInside horder₁₂ hb₂A + have noBoundary : ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → + phi f ≠ some alpha ∧ phi f ≠ some theta := by + intro f hf + constructor + · intro hc + have hm : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha := + Finset.mem_filter.mpr ⟨hf, hc⟩ + rw [hclosed alpha (by simp)] at hm + exact Finset.notMem_empty _ hm + · intro hc + have hm : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) theta := + Finset.mem_filter.mpr ⟨hf, hc⟩ + rw [hthetaClosed theta (by simp)] at hm + exact Finset.notMem_empty _ hm + have boundaryOfOutside : ∀ {v : V} {f : E}, + v ∉ TreeSequenceVertexSet T → Incident G v f → TreeIncidentEdge T f → + f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + intro v f hv hvf ⟨w, hw, hwf⟩ + have hwv : w ≠ v := by intro h; exact hv (h ▸ hw) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hw, v, hv, (Sym2.mem_and_mem_iff hwv).mp ⟨hwf, hvf⟩⟩ + let J := TwoColorIncidenceGraph G phi alpha theta + let S : Set (Sum V E) := {z | match z with + | Sum.inl v => v ∉ TreeSequenceVertexSet T + | Sum.inr f => ¬ TreeIncidentEdge T f} + have outsideStep : ∀ z, z ∈ S → ∀ w, J.Adj z w → w ∈ S := by + intro z hz w hzw + cases z with + | inl v => + cases w with + | inl u => exact False.elim hzw + | inr f => + intro hfT + have hb := noBoundary (boundaryOfOutside hz hzw.1 hfT) + exact hzw.2.elim hb.1 hb.2 + | inr f => + cases w with + | inr g => exact False.elim hzw + | inl v => exact fun hv => hz ⟨v, hv, hzw.1⟩ + let roots : Finset (Sum V E) := Finset.univ.filter fun z => + match z with + | Sum.inl v => v ∉ TreeSequenceVertexSet T + | Sum.inr _ => False + let selected : E → Prop := fun f => + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha theta z + let nu : PartialEdgeColoring E k := fun f => + if selected f then + if phi f = some alpha then some theta + else if phi f = some theta then some alpha else phi f + else phi f + have outsideComponents : ∀ z ∈ roots, ∀ v : V, + Sum.inl v ∈ TwoColorComponent G phi alpha theta z → + v ∉ TreeSequenceVertexSet T := by + intro z hz v hv + have hzS : z ∈ S := by + cases z with + | inl vertex => + simpa only [roots, S, Finset.mem_filter, Finset.mem_univ, true_and, Set.mem_ofPred_eq] + using hz + | inr edge => simp [roots] at hz + have hr : J.Reachable z (Sum.inl v) := by + change J.connectedComponentMk (Sum.inl v) = J.connectedComponentMk z at hv + exact (SimpleGraph.ConnectedComponent.eq.mp hv).symm + exact hr.mem_subgraphVerts + (H := (⊤ : J.Subgraph).induce S) + (fun x hx y hxy => ⟨hx, outsideStep x hx y hxy, hxy⟩) hzS + have hrecolor : OutsideKempeRecoloring T phi nu alpha theta := + ⟨hthetaAlpha.symm, roots, outsideComponents, fun _ => rfl⟩ + have selectedOfOutside : ∀ (u : V), u ∉ TreeSequenceVertexSet T → + ∀ (f : E), Incident G u f → + (phi f = some alpha ∨ phi f = some theta) → selected f := by + intro u hu f huf hcolor + refine ⟨Sum.inl u, by simp [roots, hu], ?_⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show J.Adj (Sum.inl u) (Sum.inr f) from ⟨huf, hcolor⟩)).symm + have betaFixed : ∀ f : E, nu f = some beta ↔ phi f = some beta := by + intro f + by_cases hs : selected f <;> by_cases ha : phi f = some alpha <;> + by_cases ht : phi f = some theta <;> + simp [nu, hs, ha, ht, hne, hthetaBeta, hthetaAlpha] + have thetaPreimage : ∀ (u : V), u ∉ TreeSequenceVertexSet T → + ∀ (f : E), Incident G u f → + (nu f = some theta ↔ phi f = some alpha) := by + intro u hu f huf + by_cases ha : phi f = some alpha + · have hs := selectedOfOutside u hu f huf (Or.inl ha) + simp [nu, hs, ha] + · by_cases ht : phi f = some theta + · have hs := selectedOfOutside u hu f huf (Or.inr ht) + simp [nu, hs, ht, hthetaAlpha.symm] + · by_cases hs : selected f <;> simp [nu, hs, ha, ht] + have missingIff : ∀ (p : PartialEdgeColoring E k) (v : V) (c : Fin k), + c ∈ MissingColors G p v ↔ ∀ f, Incident G v f → p f ≠ some c := by + intro p v c + simp [MissingColors, PresentColors] + have remoteMissing : ∀ u, u ∉ TreeSequenceVertexSet T → + (alpha ∈ MissingColors G phi u ∨ beta ∈ MissingColors G phi u) → + theta ∈ MissingColors G nu u ∨ beta ∈ MissingColors G nu u := by + intro u hu hm + rcases hm with hm | hm + · left + apply (missingIff nu u theta).mpr + intro f huf hf + exact (missingIff phi u alpha).mp hm f huf + ((thetaPreimage u hu f huf).mp hf) + · right + apply (missingIff nu u beta).mpr + intro f huf hf + exact (missingIff phi u beta).mp hm f huf ((betaFixed f).mp hf) + have pathEdgeOutside : ∀ (u v : V) + (P : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl u) (Sum.inl v)), + TreeExitPath T phi alpha beta u v P → + ∀ f : E, Sum.inr f ∈ P.support → + ∃ w : V, w ∉ TreeSequenceVertexSet T ∧ Incident G w f := by + intro u v P hExit f hf + obtain ⟨m, hm, hmle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hmpos : 0 < m := by + by_contra h + have hmzero : m = 0 := by omega + rw [hmzero] at hm + simp at hm + have hmlt : m < P.length := by + by_contra h + have hmlast : m = P.length := by omega + rw [hmlast] at hm + simp at hm + have hprev := P.adj_getVert_succ (i := m - 1) (by omega) + rw [show m - 1 + 1 = m by omega, hm] at hprev + obtain ⟨w, hwPrev⟩ : ∃ w : V, P.getVert (m - 1) = Sum.inl w := by + cases hnode : P.getVert (m - 1) with + | inl w => exact ⟨w, rfl⟩ + | inr e => rw [hnode] at hprev; exact False.elim hprev + have hnext := P.adj_getVert_succ (i := m) hmlt + rw [hm] at hnext + obtain ⟨z, hzNext⟩ : ∃ z : V, P.getVert (m + 1) = Sum.inl z := by + cases hnode : P.getVert (m + 1) with + | inl z => exact ⟨z, rfl⟩ + | inr e => rw [hnode] at hnext; exact False.elim hnext + rw [hwPrev] at hprev + rw [hzNext] at hnext + by_cases hwT : w ∈ TreeSequenceVertexSet T + · by_cases hzT : z ∈ TreeSequenceVertexSet T + · have hwv : w = v := (hExit.2.2.2.2.2 w hwT).mp (by + rw [← hwPrev]; exact P.getVert_mem_support _) + have hzv : z = v := (hExit.2.2.2.2.2 z hzT).mp (by + rw [← hzNext]; exact P.getVert_mem_support _) + have heq : P.getVert (m - 1) = P.getVert (m + 1) := by + rw [hwPrev, hzNext, hwv, hzv] + have hindices := hExit.1.getVert_injOn + (show m - 1 ≤ P.length by omega) (show m + 1 ≤ P.length by omega) heq + omega + · exact ⟨z, hzT, hnext.1⟩ + · exact ⟨w, hwT, hprev.1⟩ + exact @helper_continuation_382 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hMP) (@hpositive) (@hproper) + (@hone) (@hlower) (@base) (@H) (@good) (@alpha) (@beta) (@a₁) (@b₁) (@a₂) (@b₂) (@a₃) (@b₃) + (@P₁) (@P₂) (@P₃) (@hP₁) (@hP₂) (@hP₃) (@hpaths₂₃) (@ha₂₃) (@theta) (@hthetaBeta) + (@hthetaMissing) (@hthetaClosedStar) (by assumption) (@hdividerZero) (@hPE) (@hAcore) + (@hAsub) (@hb₃A) (@hb₂A) (@hb₁A) (@hrecolor) (@selectedOfOutside) (@betaFixed) + (@remoteMissing) (@pathEdgeOutside) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixHierarchy.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixHierarchy.lean new file mode 100644 index 0000000000..c2ba1550a8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixHierarchy.lean @@ -0,0 +1,1996 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +public import LeanPool.GoldbergSeymour.LowerRoundProperties + +/-! +# Step1Case Two Outside Prefix Hierarchy + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private noncomputable abbrev helperRep474.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (mu : PartialEdgeColoring E k) → + (C : TreeSequence G e0) → + (newInput : PartialEdgeColoring E k) → + (newSeries : TashkinovSeries G k ett.rounds e0 newInput) → + (1 : ℕ) ≤ ett.1 → + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) + C → + (newSeries.data.tree + (⟨ett.1, by omega⟩ : + Fin (ett.1 + (2 : ℕ)))).length < + C.length → + TreeSequenceInitialSegment C + (newSeries.data.tree (Fin.last (ett.1 + (1 : ℕ)))) → + mu = newSeries.data.coloring (Fin.last ett.1) → + ExtendedTashkinovTree G k e0 newInput C mu := by + classical + intro V E _ _ _ G k e0 input T phi ett mu C newInput newSeries rp above strict below gen + exact ⟨ett.rounds, rp, newSeries, above, strict, below, gen⟩ + +private noncomputable abbrev helperBaseC598.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (mu : PartialEdgeColoring E k) → + (C : TreeSequence G e0) → + let Tn : TreeSequence G e0 := + ett.series.data.tree (Fin.last ett.rounds).castSucc; + (newInput : PartialEdgeColoring E k) → + (newSeries : TashkinovSeries G k ett.rounds e0 newInput) → + (rp : (1 : ℕ) ≤ ett.1) → + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) + C) → + (strict : + (newSeries.data.tree + (⟨ett.1, by omega⟩ : + Fin (ett.1 + (2 : ℕ)))).length < + C.length) → + (below : + TreeSequenceInitialSegment C + (newSeries.data.tree + (Fin.last (ett.1 + (1 : ℕ))))) → + (gen : + mu = + newSeries.data.coloring (Fin.last ett.1)) → + let rep : + ExtendedTashkinovTree G k e0 newInput C mu := + helperRep474 G k e0 input T phi ett mu C + newInput newSeries rp above strict below + gen; + (htree : + newSeries.data.tree + (Fin.last ett.rounds).castSucc = + Tn) → + newSeries.data.kind (Fin.last ett.rounds) = + ett.series.data.kind + (Fin.last ett.rounds) → + (ett.series.data.kind + (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + newSeries.data.chosenVertex + (Fin.last ett.rounds) = + ett.series.data.chosenVertex + (Fin.last ett.rounds)) → + (ett.series.data.kind + (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE → + TashkinovClosure mu + (TreeSequencePrefix Tn + (↑base.supportPosition : ℕ) + base.supportPositive + (Nat.le_of_lt_succ + base.supportPosition.isLt)) + base.closure) → + let _ : + Fin + ((newSeries.data.tree + (Fin.last + ett.rounds).castSucc).length + + (1 : ℕ)) := + Fin.cast + (congrArg + (fun S : TreeSequence G e0 => + S.length + 1) + htree.symm) + base.supportPosition; + HierarchyBase rep mu := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base mu C Tn newInput newSeries rp above strict below + gen rep htree hkind chosenAgree closureMu pos + exact { + core := base.core + closure := base.closure + supportPosition := pos + supportPositive := by simpa [pos] using base.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only [rep] + intro hp + have hpOld := hkind.symm.trans hp + obtain ⟨hv, hc, hu⟩ := base.parallel hpOld + refine ⟨?_, ?_, ?_⟩ + · rw [chosenAgree hpOld] + have hvertex : (newSeries.data.tree (Fin.last ett.rounds).castSucc).vertex pos = + Tn.vertex base.supportPosition := by + dsimp [pos] + generalize ht : newSeries.data.tree (Fin.last ett.rounds).castSucc = S at htree ⊢ + cases htree + rfl + rw [hvertex]; exact hv + · simpa [pos, htree] using closureMu hpOld + · simpa [htree] using hu + nonparallel := by + dsimp only [rep] + intro hp + exact (base.nonparallel (fun h => hp (hkind.trans h))).trans htree.symm } + +private noncomputable abbrev helperKC712.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (0 : ℕ) < ett.rounds → + (base : HierarchyBase ett phi) → + (H : TashkinovHierarchy ett base) → + (mu : PartialEdgeColoring E k) → + (Bminus C : TreeSequence G e0) → + Bminus.length < C.length → + TreeSequenceInitialSegment C T → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + let Tn : TreeSequence G e0 := + ett.series.data.tree + (Fin.last ett.rounds).castSucc; + TreeSequenceInitialSegment base.core Bminus → + TreeSequenceInitialSegment Bminus C → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment + (H.stage j.castSucc) Bminus) → + (newInput : PartialEdgeColoring E k) → + (newSeries : + TashkinovSeries G k ett.rounds e0 + newInput) → + (rp : (1 : ℕ) ≤ ett.1) → + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨ett.1, by omega⟩ : + Fin (ett.1 + (2 : ℕ)))) + C) → + (strict : + (newSeries.data.tree + (⟨ett.1, by omega⟩ : + Fin + (ett.1 + + (2 : ℕ)))).length < + C.length) → + (below : + TreeSequenceInitialSegment C + (newSeries.data.tree + (Fin.last + (ett.1 + (1 : ℕ))))) → + (gen : + mu = + newSeries.data.coloring + (Fin.last ett.1)) → + let rep : + ExtendedTashkinovTree G k e0 + newInput C mu := + helperRep474 G k e0 input T + phi ett mu C newInput + newSeries rp above strict + below gen; + (htree : + newSeries.data.tree + (Fin.last + ett.rounds).castSucc = + Tn) → + (hkind : + newSeries.data.kind + (Fin.last + ett.rounds) = + ett.series.data.kind + (Fin.last + ett.rounds)) → + (chosenAgree : + ett.series.data.kind + (Fin.last + ett.rounds) = + some + TashkinovExtensionKind.PE → + newSeries.data.chosenVertex + (Fin.last + ett.rounds) = + ett.series.data.chosenVertex + (Fin.last + ett.rounds)) → + (closureMu : + ett.series.data.kind + (Fin.last + ett.rounds) = + some + TashkinovExtensionKind.PE → + TashkinovClosure mu + (TreeSequencePrefix + Tn + (↑base.supportPosition : + ℕ) + base.supportPositive + (Nat.le_of_lt_succ + base.supportPosition.isLt)) + base.closure) → + let baseC : + HierarchyBase rep + mu := + helperBaseC598 G k e0 + input T phi ett base + mu C newInput + newSeries rp above + strict below gen + htree hkind + chosenAgree + closureMu; + let stageC : + Fin + (H.dividerCount + + (2 : ℕ)) → + TreeSequence G e0 := + fun + (j : + Fin + (H.dividerCount + + (2 : ℕ))) ↦ + if + (↑j : ℕ) = + H.dividerCount + + (1 : ℕ) then + C + else H.stage j; + (∀ + (j : + Fin + (H.dividerCount + + (2 : ℕ))), + (↑j : ℕ) ≤ + H.dividerCount → + stageC j = + H.stage j) → + stageC + (Fin.last + (H.dividerCount + + (1 : ℕ))) = + C → + (∀ + (i : + Fin + H.dividerCount), + (↑(H.dividerPosition + i) : + ℕ) ≤ + C.length) → + TashkinovHierarchy + rep baseC := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H mu Bminus C hBCstrict hCT segTrans Tn + coreToB hBtoC stageToB newInput newSeries rp above strict below gen rep htree hkind + chosenAgree closureMu baseC stageC stageOld stageLast divBound + exact { + dividerCount := H.dividerCount + stage := stageC + baseStage := by + rw [stageOld 0 (by simp), H.baseStage] + exact htree.symm + terminalStage := stageLast + nested := by + intro j + rw [stageOld j.castSucc (by have := j.isLt; simp; omega)] + by_cases hj : j.val = H.dividerCount + · have he : j.succ = Fin.last (H.dividerCount + 1) := Fin.ext (by simp; omega) + rw [he, stageLast] + exact segTrans (stageToB j) hBtoC + · rw [stageOld j.succ (by simp; have := j.isLt; omega)] + exact H.nested j + strict := by + intro j + rw [stageOld j.castSucc (by have := j.isLt; simp; omega)] + by_cases hj : j.val = H.dividerCount + · have he : j.succ = Fin.last (H.dividerCount + 1) := Fin.ext (by simp; omega) + rw [he, stageLast] + exact lt_of_le_of_lt (stageToB j).1 hBCstrict + · rw [stageOld j.succ (by simp; have := j.isLt; omega)] + exact H.strict j + dividerPosition := fun i => ⟨(H.dividerPosition i).val, Nat.lt_succ_of_le (divBound i)⟩ + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := by + intro i + rw [stageOld ⟨i.val + 1, by omega⟩ + (by change i.val + 1 ≤ H.dividerCount; omega), H.dividerStage i] + rw [TreeSequencePrefix, TreeSequencePrefix] + congr 1 + · funext x + exact hCT.2.1 (Fin.castLE (Nat.succ_le_succ (divBound i)) x) + · funext x + exact hCT.2.2 (Fin.castLE (divBound i) x) + coreInsideFirst := by + by_cases hd : H.dividerCount = 0 + · have he : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp; omega) + rw [he, stageLast] + exact segTrans coreToB hBtoC + · rw [stageOld ⟨1, by omega⟩ (by change 1 ≤ H.dividerCount; omega)] + exact H.coreInsideFirst } + +private noncomputable abbrev helperGoodC1021.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (hpositive : (0 : ℕ) < ett.rounds) → + (base : HierarchyBase ett phi) → + (H : TashkinovHierarchy ett base) → + GoodHierarchy H → + Fin k → + (mu : PartialEdgeColoring E k) → + (Bminus C : TreeSequence G e0) → + (hBCstrict : Bminus.length < C.length) → + (hCT : TreeSequenceInitialSegment C T) → + (segTrans : + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W) → + let Tn : TreeSequence G e0 := + ett.series.data.tree + (Fin.last ett.rounds).castSucc; + (coreToB : + TreeSequenceInitialSegment base.core + Bminus) → + (hBtoC : + TreeSequenceInitialSegment Bminus C) → + (stageToB : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment + (H.stage j.castSucc) Bminus) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ + TreeSequenceVertexSet Bminus → + TreeMissingColors mu S = + TreeMissingColors phi S) → + (newInput : PartialEdgeColoring E k) → + (newSeries : + TashkinovSeries G k ett.rounds e0 + newInput) → + (rp : (1 : ℕ) ≤ ett.1) → + (above : + TreeSequenceInitialSegment + (newSeries.data.tree + (⟨ett.1, by omega⟩ : + Fin (ett.1 + (2 : ℕ)))) + C) → + (strict : + (newSeries.data.tree + (⟨ett.1, by omega⟩ : + Fin + (ett.1 + + (2 : + ℕ)))).length < + C.length) → + (below : + TreeSequenceInitialSegment + C + (newSeries.data.tree + (Fin.last + (ett.1 + + (1 : ℕ))))) → + (gen : + mu = + newSeries.data.coloring + (Fin.last ett.1)) → + { rounds := ett.1, + roundsPositive := + rp, + series := + newSeries, + abovePenultimate := + above, + strictAbovePenultimate := + strict, + belowFinal := + below, + generatingColoring := + gen : + ExtendedTashkinovTree + G k e0 newInput + C mu }.series ≍ + newSeries → + let rep : + ExtendedTashkinovTree + G k e0 newInput C + mu := + helperRep474 G k e0 + input T phi ett mu C + newInput newSeries + rp above strict + below gen; + (htree : + newSeries.data.tree + (Fin.last + ett.rounds).castSucc = + Tn) → + (hkind : + newSeries.data.kind + (Fin.last + ett.rounds) = + ett.series.data.kind + (Fin.last + ett.rounds)) → + (chosenAgree : + ett.series.data.kind + (Fin.last + ett.rounds) = + some + TashkinovExtensionKind.PE → + newSeries.data.chosenVertex + (Fin.last + ett.rounds) = + ett.series.data.chosenVertex + (Fin.last + ett.rounds)) → + (ett.series.data.kind + (Fin.last + ett.rounds) = + some + TashkinovExtensionKind.PE → + TreeSequenceVertexSet + base.closure ⊆ + TreeSequenceVertexSet + Bminus) → + (closureMu : + ett.series.data.kind + (Fin.last + ett.rounds) = + some + TashkinovExtensionKind.PE → + TashkinovClosure + mu + (TreeSequencePrefix + Tn + (↑base.supportPosition : + ℕ) + base.supportPositive + (Nat.le_of_lt_succ + base.supportPosition.isLt)) + base.closure) → + let baseC : + HierarchyBase + rep mu := + helperBaseC598 + G k e0 + input T + phi ett + base mu C + newInput + newSeries + rp above + strict + below gen + htree + hkind + chosenAgree + closureMu; + let stageC : + Fin + (H.dividerCount + + (2 : + ℕ)) → + TreeSequence + G e0 := + fun + (j : + Fin + (H.dividerCount + + (2 : + ℕ))) ↦ + if + (↑j : + ℕ) = + H.dividerCount + + (1 : + ℕ) then + C + else + H.stage j; + (stageOld : + ∀ + (j : + Fin + (H.dividerCount + + (2 : + ℕ))), + (↑j : + ℕ) ≤ + H.dividerCount → + stageC + j = + H.stage + j) → + (stageLast : + stageC + (Fin.last + (H.dividerCount + + (1 : + ℕ))) = + C) → + (divBound : + ∀ + (i : + Fin + H.dividerCount), + (↑(H.dividerPosition + i) : + ℕ) ≤ + C.length) → + let KC : + TashkinovHierarchy + rep + baseC := + helperKC712 + G k + e0 + input + T + phi + ett + hpositive + base + H mu + Bminus + C + hBCstrict + hCT + segTrans + coreToB + hBtoC + stageToB + newInput + newSeries + rp + above + strict + below + gen + htree + hkind + chosenAgree + closureMu + stageOld + stageLast + divBound; + (∀ + (j : + Fin + (H.dividerCount + + (1 : + ℕ))), + KC.stage + j.castSucc = + H.stage + j.castSucc) → + TreeMissingColors + mu + Tn = + TreeMissingColors + phi + Tn → + (∀ + (j : + Fin + (H.dividerCount + + (1 : + ℕ))), + HierarchyStoredColorsAt + KC + j = + HierarchyStoredColorsAt + H + j) → + (∀ + (j : + Fin + (H.dividerCount + + (1 : + ℕ))), + HierarchyStageMissingColors + KC + j = + HierarchyStageMissingColors + H + j) → + (∀ + (j : + Fin + (H.dividerCount + + (1 : + ℕ))) + (eta : + Fin + k), + HierarchySegmentColors + KC + j + eta ⊆ + HierarchySegmentColors + H + j + eta) → + (∀ + (S : + TreeSequence + G + e0), + TreeSequenceVertexSet + S ⊆ + TreeSequenceVertexSet + Bminus → + ∀ + (D : + Finset + (Fin + k)), + TreeColorSetMinusClosed + G + mu + S + D ↔ + TreeColorSetMinusClosed + G + phi + S + D) → + (∀ + (i : + Fin + H.dividerCount), + ((TreeSequenceVertexSet + (KC.stage + i.succ.castSucc) \ + TreeSequenceVertexSet + (HierarchyStarredStage + KC + i.castSucc)).biUnion + fun + (v : + V) ↦ + MissingColors + G + mu + v) = + (TreeSequenceVertexSet + (H.stage + i.succ.castSucc) \ + TreeSequenceVertexSet + (HierarchyStarredStage + H + i.castSucc)).biUnion + fun + (v : + V) ↦ + MissingColors + G + phi + v) → + GoodHierarchy + KC := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H good gamma mu Bminus C hBCstrict hCT + segTrans Tn coreToB hBtoC stageToB missingEq newInput newSeries rp above strict below gen + hs rep htree hkind chosenAgree closureVertices closureMu baseC stageC stageOld stageLast + divBound KC ordinaryEq terminalMissing indexedStoredEq stageMissingEq segmentSubset minusEq + refreshEq + exact { + gamma := good.gamma + twoColors := by + intro j eta he + exact good.twoColors j eta (indexedStoredEq j ▸ he) + avoidance := by + intro j eta he c hc + have hav := good.avoidance j eta (indexedStoredEq j ▸ he) hc + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · rw [stageMissingEq]; exact (Finset.mem_sdiff.mp hav).1 + · intro hs + exact (Finset.mem_sdiff.mp hav).2 (segmentSubset j eta hs) + disjointPairs := by + intro j eta theta he ht hne + exact good.disjointPairs j eta theta (indexedStoredEq j ▸ he) + (indexedStoredEq j ▸ ht) hne + uniqueRefresh := by + intro i + simpa only [indexedStoredEq, refreshEq] using good.uniqueRefresh i + parallelBase := by + dsimp only + intro hp + have hpOld := hkind.symm.trans hp + have hold := good.parallelBase hpOld + change ¬TreeColorSetMinusClosed G mu base.core + ((HierarchyStoredColorsAt KC 0).biUnion (good.gamma 0)) ∧ + 4 ≤ ((TreeMissingColors mu (newSeries.data.tree (Fin.last ett.rounds).castSucc) ∩ + TreeMissingColors mu base.closure) \ + (HierarchyStoredColorsAt KC 0).biUnion (good.gamma 0)).card + rw [indexedStoredEq, minusEq _ (TreeSequenceInitialSegmentVertexSetSubset coreToB), + htree, terminalMissing, missingEq _ (closureVertices hpOld)] + exact hold + minusClosed := by + intro i + rw [ordinaryEq, indexedStoredEq, + minusEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageToB i.succ))] + exact good.minusClosed i } + +private abbrev helperContinuation906Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi), + MaximumProperty ett → + (0 : ℕ) < ett.rounds → + ∀ (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : GoodHierarchy H), + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ + (TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card → + ∀ (beta gamma : Fin k), + beta ∉ TreeMissingColors phi T → + ∀ (mu : PartialEdgeColoring E k) (Bminus C : TreeSequence G e0), + (∀ (e : E), TreeIncidentEdge Bminus e → mu e = phi e) → + (∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) → + gamma ∉ + (HierarchyStoredColorsAt H (Fin.last H.dividerCount)).biUnion + (good.gamma (Fin.last H.dividerCount)) → + Bminus.length < C.length → + TreeSequenceInitialSegment C T → + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + TreeSequenceInitialSegment base.core Bminus → + TreeSequenceInitialSegment Tn Bminus → + C.length = Bminus.length + (1 : ℕ) → + TreeSequenceInitialSegment Bminus C → + TreeSequenceInitialSegment Tn C → + Tn.length < C.length → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) Bminus) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) Bminus) → + (∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) → + (∀ (j : Fin C.length), mu (C.edge j) = phi (C.edge j)) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus → + TreeMissingColors mu S = TreeMissingColors phi S) → + ModColoring ett mu → + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu Tn C ∨ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = + ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence mu seed C) → + ∃ (corrC : CorrespondingExtendedTashkinovTree G k e0 ett mu C) (baseC + : HierarchyBase corrC.replacementETT mu) (KC : + TashkinovHierarchy corrC.replacementETT baseC) (goodC : + GoodHierarchy KC), + ModColoring ett mu ∧ + MaximumProperty corrC.replacementETT ∧ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu + (ett.series.data.tree (Fin.last ett.rounds).castSucc) C ∨ + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = + ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f + seed ∧ + TashkinovAugmentationSequence mu seed C) ∧ + KC.dividerCount = H.dividerCount ∧ + (2 : ℕ) * corrC.replacementETT.rounds + (11 : ℕ) ≤ + (TreeMissingColors mu + (corrC.replacementETT.series.data.tree + (Fin.last corrC.replacementETT.rounds).castSucc)).card ∧ + gamma ∉ + (HierarchyStoredColorsAt KC + (Fin.last KC.dividerCount)).biUnion + (goodC.gamma (Fin.last KC.dividerCount)) ∧ + beta ∉ + (HierarchyStoredColorsAt KC + (Fin.last KC.dividerCount)).biUnion + (goodC.gamma (Fin.last KC.dividerCount)) + +private abbrev helperSegmentSubset970Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (hpositive : (0 : ℕ) < ett.rounds) + (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (mu : PartialEdgeColoring E k) + (Bminus C : TreeSequence G e0) (hBCstrict : Bminus.length < C.length) + (hCT : TreeSequenceInitialSegment C T) + (segTrans : + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W), + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ∀ (coreToB : TreeSequenceInitialSegment base.core Bminus) + (hBtoC : TreeSequenceInitialSegment Bminus C) + (stageToB : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) Bminus), + (∀ (j : Fin C.length), mu (C.edge j) = phi (C.edge j)) → + ∀ (newInput : PartialEdgeColoring E k) (newSeries : TashkinovSeries G k ett.rounds e0 newInput) + (rp : (1 : ℕ) ≤ ett.1) + (above : + TreeSequenceInitialSegment (newSeries.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) + C) + (strict : (newSeries.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < C.length) + (below : TreeSequenceInitialSegment C (newSeries.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (gen : mu = newSeries.data.coloring (Fin.last ett.1)), + let rep : ExtendedTashkinovTree G k e0 newInput C mu := + helperRep474 G k e0 input T phi ett mu C newInput newSeries rp above strict below gen; + ∀ (htree : newSeries.data.tree (Fin.last ett.rounds).castSucc = Tn) + (hkind : + newSeries.data.kind (Fin.last ett.rounds) = ett.series.data.kind (Fin.last ett.rounds)) + (chosenAgree : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + newSeries.data.chosenVertex (Fin.last ett.rounds) = + ett.series.data.chosenVertex (Fin.last ett.rounds)) + (closureMu : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + TashkinovClosure mu + (TreeSequencePrefix Tn (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) + base.closure), + let baseC : HierarchyBase rep mu := + helperBaseC598 G k e0 input T phi ett base mu C newInput newSeries rp above strict below gen + htree hkind chosenAgree closureMu; + let stageC : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then C else H.stage j; + ∀ + (stageOld : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), (↑j : ℕ) ≤ H.dividerCount → stageC j = H.stage j) + (stageLast : stageC (Fin.last (H.dividerCount + (1 : ℕ))) = C) + (divBound : ∀ (i : Fin H.dividerCount), (↑(H.dividerPosition i) : ℕ) ≤ C.length), + let KC : TashkinovHierarchy rep baseC := + helperKC712 G k e0 input T phi ett hpositive base H mu Bminus C hBCstrict hCT segTrans + coreToB hBtoC stageToB newInput newSeries rp above strict below gen htree hkind + chosenAgree closureMu stageOld stageLast divBound; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage KC j = HierarchyStarredStage H j) → + (∀ (eta : Fin k), + (↑(HierarchyFirstMissingPosition mu C eta) : ℕ) = + (↑(HierarchyFirstMissingPosition phi C eta) : ℕ)) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (KC.stage j.succ) (H.stage j.succ) ∧ + TreeSequenceInitialSegment (KC.stage j.succ) C) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors KC j eta ⊆ HierarchySegmentColors H j eta + +private abbrev helperCaseContinuation955Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (hpositive : (0 : ℕ) < ett.rounds) + (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (hlarge : + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ + (TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (beta gamma : Fin k) (hbeta : beta ∉ TreeMissingColors phi T) (mu : PartialEdgeColoring E k) + (Bminus C : TreeSequence G e0) (hfixed : ∀ (e : E), TreeIncidentEdge Bminus e → mu e = phi e) + (hmissingFixed : + ∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) + (hgammaReserved : + gamma ∉ + (HierarchyStoredColorsAt H (Fin.last H.dividerCount)).biUnion + (good.gamma (Fin.last H.dividerCount))) + (hBCstrict : Bminus.length < C.length) (hCT : TreeSequenceInitialSegment C T) + (segRefl : ∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) + (segTrans : + ∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W), + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ∀ (coreToB : TreeSequenceInitialSegment base.core Bminus) + (hlenC : C.length = Bminus.length + (1 : ℕ)) (hBtoC : TreeSequenceInitialSegment Bminus C) + (stageToB : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage j.castSucc) Bminus) + (starredToB : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) Bminus) + (vertexMem : + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), S.vertex i ∈ TreeSequenceVertexSet S) + (fixedC : ∀ (j : Fin C.length), mu (C.edge j) = phi (C.edge j)) + (missingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus → + TreeMissingColors mu S = TreeMissingColors phi S) + (hmod : ModColoring ett mu) + (terminalRoute : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu Tn C ∨ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence mu seed C) + (newInput : PartialEdgeColoring E k) (newSeries : TashkinovSeries G k ett.rounds e0 newInput) + (hgen : mu = newSeries.data.coloring (Fin.last ett.rounds)) + (htrees : + ∀ (i : Fin ett.rounds), + newSeries.data.tree i.succ.castSucc = ett.series.data.tree i.succ.castSucc) + (hstored : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), newSeries.data.stored i = ett.series.data.stored i) + (hedges : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), + newSeries.data.connectingEdges i = ett.series.data.connectingEdges i) + (hkinds : ∀ (i : Fin (ett.rounds + (1 : ℕ))), newSeries.data.kind i = ett.series.data.kind i) + (hproper : + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (newSeries.data.coloring i)) + (hone : ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (newSeries.data.coloring i) e0) + (hstableSeries : + ∀ (i : Fin ett.rounds), + StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (newSeries.data.coloring i.succ)) + (rp : (1 : ℕ) ≤ ett.1) + (above : + TreeSequenceInitialSegment (newSeries.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) C) + (strict : (newSeries.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < C.length) + (below : TreeSequenceInitialSegment C (newSeries.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (gen : mu = newSeries.data.coloring (Fin.last ett.1)) + (hs : + { rounds := ett.1, roundsPositive := rp, series := newSeries, abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }.series ≍ + newSeries) + (hMPC : + MaximumProperty + { replacementInput := newInput, replacementSeries := newSeries, + replacementETT := + { + rounds := ett.1, roundsPositive := rp, series := newSeries, abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }, + rungAgreement := by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive C + have := hCT.1 + have := coreToB.1 + have := hBtoC.1 + have := above.1 + have := below.1 + try dsimp only [GoldbergSeymour.TreeSequencePrefix] at *), + seriesPresentation := hs, finalGeneratingColoring := hgen, ladderTreesAgree := htrees, + storedColorsAgree := hstored, connectingEdgesAgree := hedges, extensionKindsAgree := hkinds, + replacementProper := hproper, replacementOneUncolored := hone, + replacementStable := hstableSeries : + CorrespondingExtendedTashkinovTree G k e0 ett mu C }.replacementETT), + let rep : ExtendedTashkinovTree G k e0 newInput C mu := + helperRep474 G k e0 input T phi ett mu C newInput newSeries rp above strict below gen; + ∀ (htree : newSeries.data.tree (Fin.last ett.rounds).castSucc = Tn) + (hkind : + newSeries.data.kind (Fin.last ett.rounds) = ett.series.data.kind (Fin.last ett.rounds)) + (chosenAgree : + ∀ (hp : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE), + newSeries.data.chosenVertex (Fin.last ett.rounds) = + ett.series.data.chosenVertex (Fin.last ett.rounds)) + (closureVertices : + ∀ (hp : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet Bminus) + (closureMu : + ∀ (hp : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE), + TashkinovClosure mu + (TreeSequencePrefix Tn (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) + base.closure), + let baseC : HierarchyBase rep mu := + helperBaseC598 G k e0 input T phi ett base mu C newInput newSeries rp above strict below gen + htree hkind chosenAgree closureMu; + let stageC : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then C else H.stage j; + ∀ + (stageOld : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))) (hj : (↑j : ℕ) ≤ H.dividerCount), + stageC j = H.stage j) + (stageLast : stageC (Fin.last (H.dividerCount + (1 : ℕ))) = C) + (divBound : ∀ (i : Fin H.dividerCount), (↑(H.dividerPosition i) : ℕ) ≤ C.length), + let KC : TashkinovHierarchy rep baseC := + helperKC712 G k e0 input T phi ett hpositive base H mu Bminus C hBCstrict hCT segTrans + coreToB hBtoC stageToB newInput newSeries rp above strict below gen htree hkind chosenAgree + closureMu stageOld stageLast divBound; + ∀ + (ordinaryEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), KC.stage j.castSucc = H.stage j.castSucc) + (starredEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage KC j = HierarchyStarredStage H j) + (terminalMissing : TreeMissingColors mu Tn = TreeMissingColors phi Tn) + (storedEq : + TashkinovStoredColors newSeries.data (Fin.last ett.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds)), + ∃ (KC : + TashkinovHierarchy + { replacementInput := newInput, replacementSeries := newSeries, + replacementETT := + { + rounds := ett.1, roundsPositive := rp, series := newSeries, abovePenultimate := above, + strictAbovePenultimate := strict, belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }, + rungAgreement := by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive C + have := hCT.1 + have := coreToB.1 + have := hBtoC.1 + have := above.1 + have := below.1 + have := congrArg GoldbergSeymour.TreeSequence.length htree + have := congrArg GoldbergSeymour.TreeSequence.length stageLast + try dsimp only [GoldbergSeymour.TreeSequencePrefix] at *), + seriesPresentation := hs, finalGeneratingColoring := hgen, ladderTreesAgree := htrees, + storedColorsAgree := hstored, connectingEdgesAgree := hedges, + extensionKindsAgree := hkinds, replacementProper := hproper, + replacementOneUncolored := hone, replacementStable := hstableSeries : + CorrespondingExtendedTashkinovTree G k e0 ett mu C }.replacementETT + baseC) + (goodC : GoodHierarchy KC), + ModColoring ett mu ∧ + MaximumProperty + { replacementInput := newInput, replacementSeries := newSeries, + replacementETT := + { + rounds := ett.1, roundsPositive := rp, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, belowFinal := below, + generatingColoring := gen : ExtendedTashkinovTree G k e0 newInput C mu }, + rungAgreement := by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive C + have := hCT.1 + have := coreToB.1 + have := hBtoC.1 + have := above.1 + have := below.1 + have := congrArg GoldbergSeymour.TreeSequence.length htree + have := congrArg GoldbergSeymour.TreeSequence.length stageLast + try dsimp only [GoldbergSeymour.TreeSequencePrefix] at *), + seriesPresentation := hs, finalGeneratingColoring := hgen, ladderTreesAgree := htrees, + storedColorsAgree := hstored, connectingEdgesAgree := hedges, + extensionKindsAgree := hkinds, replacementProper := hproper, + replacementOneUncolored := hone, replacementStable := hstableSeries : + CorrespondingExtendedTashkinovTree G k e0 ett mu C }.replacementETT ∧ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu (ett.series.data.tree (Fin.last ett.rounds).castSucc) + C ∨ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence mu seed C) ∧ + KC.dividerCount = H.dividerCount ∧ + (2 : ℕ) * + { replacementInput := newInput, replacementSeries := newSeries, + replacementETT := + { + rounds := ett.1, roundsPositive := rp, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }, + rungAgreement := by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive C + have := hCT.1 + have := coreToB.1 + have := hBtoC.1 + have := above.1 + have := below.1 + have := congrArg GoldbergSeymour.TreeSequence.length htree + have := congrArg GoldbergSeymour.TreeSequence.length stageLast + try dsimp only [GoldbergSeymour.TreeSequencePrefix] at *), + seriesPresentation := hs, finalGeneratingColoring := hgen, + ladderTreesAgree := htrees, storedColorsAgree := hstored, + connectingEdgesAgree := hedges, extensionKindsAgree := hkinds, + replacementProper := hproper, replacementOneUncolored := hone, + replacementStable := hstableSeries : + CorrespondingExtendedTashkinovTree G k e0 ett mu C }.replacementETT.rounds + + (11 : ℕ) ≤ + (TreeMissingColors mu + ({ replacementInput := newInput, replacementSeries := newSeries, + replacementETT := + { + rounds := ett.1, roundsPositive := rp, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }, + rungAgreement := by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive C + have := hCT.1 + have := coreToB.1 + have := hBtoC.1 + have := above.1 + have := below.1 + have := congrArg GoldbergSeymour.TreeSequence.length htree + have := congrArg GoldbergSeymour.TreeSequence.length stageLast + try dsimp only [GoldbergSeymour.TreeSequencePrefix] at *), + seriesPresentation := hs, finalGeneratingColoring := hgen, + ladderTreesAgree := htrees, storedColorsAgree := hstored, + connectingEdgesAgree := hedges, extensionKindsAgree := hkinds, + replacementProper := hproper, replacementOneUncolored := hone, + replacementStable := hstableSeries : + CorrespondingExtendedTashkinovTree G k e0 ett mu + C }.replacementETT.series.data.tree + (Fin.last + { replacementInput := newInput, replacementSeries := newSeries, + replacementETT := + { + rounds := ett.1, roundsPositive := rp, series := newSeries, + abovePenultimate := above, strictAbovePenultimate := strict, + belowFinal := below, generatingColoring := gen : + ExtendedTashkinovTree G k e0 newInput C mu }, + rungAgreement := by + first + | omega + | ( + have := GoldbergSeymour.TreeSequence.positive C + have := hCT.1 + have := coreToB.1 + have := hBtoC.1 + have := above.1 + have := below.1 + have := congrArg GoldbergSeymour.TreeSequence.length htree + have := congrArg GoldbergSeymour.TreeSequence.length stageLast + try dsimp only [GoldbergSeymour.TreeSequencePrefix] at *), + seriesPresentation := hs, finalGeneratingColoring := hgen, + ladderTreesAgree := htrees, storedColorsAgree := hstored, + connectingEdgesAgree := hedges, extensionKindsAgree := hkinds, + replacementProper := hproper, replacementOneUncolored := hone, + replacementStable := hstableSeries : + CorrespondingExtendedTashkinovTree G k e0 ett mu + C }.replacementETT.rounds).castSucc)).card ∧ + gamma ∉ + (HierarchyStoredColorsAt KC (Fin.last KC.dividerCount)).biUnion + (goodC.gamma (Fin.last KC.dividerCount)) ∧ + beta ∉ + (HierarchyStoredColorsAt KC (Fin.last KC.dividerCount)).biUnion + (goodC.gamma (Fin.last KC.dividerCount)) + +private theorem helper_peSupport_740.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (_ : Fin k) + {r : ℕ} {inp : PartialEdgeColoring E k} (s : TashkinovSeries G k r e0 inp) + (q : Fin r), + s.data.kind q.succ = some TashkinovExtensionKind.PE → + ∃ (v : V) (u : V) (f : E), + s.data.chosenVertex q.succ = some v ∧ + s.data.connectingEdges q.succ = ({ f } : Finset E) ∧ + v ∈ TreeSequenceVertexSet (s.data.tree q.succ.castSucc) ∧ + u ∉ TreeSequenceVertexSet (s.data.tree q.succ.castSucc) ∧ G.ends f = s(v, u) := by + classical + intro V E _ _ _ G k e0 gamma r inp s q hp + have step := s.certified q.succ + generalize hi : q.succ = i at step + cases step with + | initial _ _ _ _ _ kind => + rw [hi, kind] at hp; cases hp + | SE j _ _ _ _ _ choice _ coloring stored edges kind => + rw [hi, kind] at hp; cases hp + | RE j _ _ _ _ available coloring stored edges kind => + rw [hi, kind] at hp; cases hp + | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + simpa only [hi] using + (show ∃ v u f, s.data.chosenVertex j.succ = some v ∧ + s.data.connectingEdges j.succ = {f} ∧ + v ∈ TreeSequenceVertexSet (s.data.tree j.succ.castSucc) ∧ + u ∉ TreeSequenceVertexSet (s.data.tree j.succ.castSucc) ∧ + G.ends f = s(v, u) from + ⟨choice.vertex, choice.otherEndpoint, choice.edge, vertex, edges, + choice.vertexDefective.1, choice.otherOutside, choice.edgeEnds⟩) + +private theorem helper_closureMu_809.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (mu : PartialEdgeColoring E k) + (Bminus : TreeSequence G e0), + (∀ (e : E), TreeIncidentEdge Bminus e → mu e = phi e) → + (∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) → + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + (∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) → + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet Bminus) → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + TashkinovClosure mu + (TreeSequencePrefix Tn (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) + base.closure := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base mu Bminus hfixed hmissingFixed Tn vertexMem + closureVertices hp + have hc := (base.parallel hp).2.1 + have sub := closureVertices hp + have transport {S : TreeSequence G e0} + (route : TashkinovAugmentationSequence phi S base.closure) : + TashkinovAugmentationSequence mu S base.closure := by + unfold TashkinovAugmentationSequence at route ⊢ + induction route using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head S U step tail ih => + have hUR := TashkinovAugmentationSequenceInitialSegment phi U base.closure tail + have hUV := TreeSequenceInitialSegmentVertexSetSubset hUR + obtain ⟨hlen, hSU, c, hcolor, hmiss⟩ := step + refine Relation.ReflTransGen.head ⟨hlen, hSU, c, ?_, ?_⟩ ih + · let j : Fin U.length := Fin.cast hlen.symm (Fin.last S.length) + obtain ⟨i, hi⟩ := U.attaches j + have hiB : TreeIncidentEdge Bminus (U.edge j) := by + refine ⟨U.vertex j.succ, sub (hUV (vertexMem _ _)), ?_⟩ + change U.vertex j.succ ∈ G.ends (U.edge j) + rw [hi]; exact Sym2.mem_mk_left _ _ + exact (hfixed (U.edge j) hiB).trans hcolor + · unfold TreeMissingColors at hmiss ⊢ + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hmiss + refine Finset.mem_biUnion.mpr ⟨v, hv, ?_⟩ + rw [hmissingFixed v + (sub (hUV (TreeSequenceInitialSegmentVertexSetSubset hSU hv)))] + exact hvc + refine ⟨transport hc.1, ?_⟩ + intro e c v he hv hcolor hmiss + have hb := he + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hb + obtain ⟨u, hu, w, hw, hends⟩ := hb + have hiB : TreeIncidentEdge Bminus e := by + refine ⟨u, sub hu, ?_⟩ + change u ∈ G.ends e + rw [hends]; exact Sym2.mem_mk_left _ _ + apply hc.2 he hv ((hfixed e hiB).symm.trans hcolor) + rw [← hmissingFixed v (sub hv)] + exact hmiss + +private theorem helper_cutoffEq_906.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi), + (0 : ℕ) < ett.rounds → + ∀ (mu : PartialEdgeColoring E k) (Bminus C : TreeSequence G e0), + (∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) → + C.length = Bminus.length + (1 : ℕ) → + TreeSequenceInitialSegment Bminus C → + (∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) → + ∀ (newInput : PartialEdgeColoring E k) + (_ : TashkinovSeries G k ett.rounds e0 newInput) (eta : Fin k), + (↑(HierarchyFirstMissingPosition mu C eta) : ℕ) = + (↑(HierarchyFirstMissingPosition phi C eta) : ℕ) := by + classical + intro V E _ _ _ G k e0 input T phi ett hpositive mu Bminus C hmissingFixed hlenC hBtoC + vertexMem newInput newSeries eta + have h (i : Fin (C.length + 1)) (hi : i.val < C.length) : + eta ∈ MissingColors G mu (C.vertex i) ↔ + eta ∈ MissingColors G phi (C.vertex i) := by + let ib : Fin (Bminus.length + 1) := ⟨i.val, by omega⟩ + have hv : C.vertex i = Bminus.vertex ib := hBtoC.2.1 ib + rw [hv, hmissingFixed _ (vertexMem _ _)] + let dm : Finset (Fin (C.length + 1)) := + Finset.univ.filter fun i => eta ∈ MissingColors G mu (C.vertex i) + let dp : Finset (Fin (C.length + 1)) := + Finset.univ.filter fun i => eta ∈ MissingColors G phi (C.vertex i) + change (if h : dm.Nonempty then dm.min' h else Fin.last C.length).val = + (if h : dp.Nonempty then dp.min' h else Fin.last C.length).val + by_cases hm : dm.Nonempty + · rw [dite_eq_left hm] + by_cases hp : dp.Nonempty + · rw [dite_eq_left hp] + apply Nat.le_antisymm + · by_cases hj : (dp.min' hp).val < C.length + · have hi : dp.min' hp ∈ dm := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, (h _ hj).mpr + ((Finset.mem_filter.mp (Finset.min'_mem dp hp)).2)⟩ + exact Finset.min'_le dm _ hi + · have := (dm.min' hm).isLt; omega + · by_cases hj : (dm.min' hm).val < C.length + · have hi : dm.min' hm ∈ dp := Finset.mem_filter.mpr + ⟨Finset.mem_univ _, (h _ hj).mp + ((Finset.mem_filter.mp (Finset.min'_mem dm hm)).2)⟩ + exact Finset.min'_le dp _ hi + · have := (dp.min' hp).isLt; omega + · rw [dite_eq_right hp] + have hb : ¬(dm.min' hm).val < C.length := by + intro hj + apply hp + exact ⟨dm.min' hm, Finset.mem_filter.mpr + ⟨Finset.mem_univ _, (h _ hj).mp + ((Finset.mem_filter.mp (Finset.min'_mem dm hm)).2)⟩⟩ + have := (dm.min' hm).isLt + simp only [Fin.val_last]; omega + · rw [dite_eq_right hm] + by_cases hp : dp.Nonempty + · rw [dite_eq_left hp] + have hb : ¬(dp.min' hp).val < C.length := by + intro hj + apply hm + exact ⟨dp.min' hp, Finset.mem_filter.mpr + ⟨Finset.mem_univ _, (h _ hj).mpr + ((Finset.mem_filter.mp (Finset.min'_mem dp hp)).2)⟩⟩ + have := (dp.min' hp).isLt + simp only [Fin.val_last]; omega + · rw [dite_eq_right hp] + +private theorem helper_segmentSubset_970.{u_1, u_2} : + helperSegmentSubset970Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H mu Bminus C hBCstrict hCT segTrans Tn + coreToB hBtoC stageToB fixedC newInput newSeries rp above strict below gen rep htree hkind + chosenAgree closureMu baseC stageC stageOld stageLast divBound KC starredEq cutoffEq + nextPrefix j eta + have hUW := (nextPrefix j).1 + have hUC := (nextPrefix j).2 + have hcut : min (HierarchyFirstMissingPosition mu C eta).val + (KC.stage j.succ).length = + min (HierarchyFirstMissingPosition phi T eta).val + (KC.stage j.succ).length := by + rw [cutoffEq eta] + exact HierarchyFirstMissingPositionPrefixCutoff phi C T hCT eta _ hUC.1 + intro c hc + simp only [HierarchySegmentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hc ⊢ + obtain ⟨r, hlo, hhi, hcol⟩ := hc + refine ⟨Fin.castLE hUW.1 r, ?_, ?_, ?_⟩ + · simpa only [starredEq, Fin.val_castLE] using hlo + · have hr : r.val < (HierarchyFirstMissingPosition phi T eta).val := by + rw [hcut] at hhi + exact lt_of_lt_of_le hhi (Nat.min_le_left _ _) + exact lt_min hr (Fin.castLE hUW.1 r).isLt + · rw [hUW.2.2 r] + have hf := fixedC (Fin.castLE hUC.1 r) + rw [hUC.2.2 r] at hf + exact hf.symm.trans hcol + +private theorem helper_caseContinuation_955.{u_1, u_2} : + helperCaseContinuation955Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H good hlarge beta gamma hbeta mu + Bminus C hfixed hmissingFixed hgammaReserved hBCstrict hCT segRefl segTrans Tn coreToB + hlenC hBtoC stageToB starredToB vertexMem fixedC missingEq hmod terminalRoute newInput + newSeries hgen htrees hstored hedges hkinds hproper hone hstableSeries rp above strict + below gen hs hMPC rep htree hkind chosenAgree closureVertices closureMu baseC stageC + stageOld stageLast divBound KC ordinaryEq starredEq terminalMissing storedEq + have indexedStoredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt KC j = HierarchyStoredColorsAt H j := by + change TashkinovStoredColors newSeries.data (Fin.last ett.rounds) \ + TreeMissingColors mu (HierarchyStarredStage KC j) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) \ + TreeMissingColors phi (HierarchyStarredStage H j) + rw [storedEq, starredEq, missingEq _ + (TreeSequenceInitialSegmentVertexSetSubset (starredToB j))] + have stageMissingEq (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors KC j = HierarchyStageMissingColors H j := by + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors mu (newSeries.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors phi Tn + rw [htree, terminalMissing] + · change TreeMissingColors mu (KC.stage i.succ.castSucc) = + TreeMissingColors phi (H.stage i.succ.castSucc) + rw [ordinaryEq] + exact missingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageToB i.succ)) + refine ⟨KC, ?_⟩ + -- Changing missingness only at the final position leaves the capped cutoff unchanged. + have cutoffEq (eta : Fin k) : + (HierarchyFirstMissingPosition mu C eta).val = + (HierarchyFirstMissingPosition phi C eta).val := by + apply helper_cutoffEq_906 <;> assumption + have nextPrefix (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (KC.stage j.succ) (H.stage j.succ) ∧ + TreeSequenceInitialSegment (KC.stage j.succ) C := by + change TreeSequenceInitialSegment (stageC j.succ) (H.stage j.succ) ∧ + TreeSequenceInitialSegment (stageC j.succ) C + by_cases hj : j.val = H.dividerCount + · have he : j.succ = Fin.last (H.dividerCount + 1) := Fin.ext (by simp; omega) + rw [he, stageLast, H.terminalStage] + exact ⟨hCT, segRefl C⟩ + · rw [stageOld j.succ (by simp; have := j.isLt; omega)] + exact ⟨segRefl _, segTrans (stageToB ⟨j.val + 1, by omega⟩) hBtoC⟩ + have segmentSubset (j : Fin (H.dividerCount + 1)) (eta : Fin k) : + HierarchySegmentColors KC j eta ⊆ HierarchySegmentColors H j eta := by + apply helper_segmentSubset_970 <;> assumption + have boundaryFixed (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus) + (e : E) (he : e ∈ BoundaryEdges G (TreeSequenceVertexSet S)) : + mu e = phi e := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at he + obtain ⟨v, hv, w, hw, hends⟩ := he + apply hfixed + refine ⟨v, hS hv, ?_⟩ + change v ∈ G.ends e + rw [hends]; exact Sym2.mem_mk_left _ _ + have minusEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus) + (D : Finset (Fin k)) : + TreeColorSetMinusClosed G mu S D ↔ TreeColorSetMinusClosed G phi S D := by + have hb (c : Fin k) : BoundaryColorEdges G mu (TreeSequenceVertexSet S) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet S) c := by + ext e + simp only [BoundaryColorEdges, Finset.mem_filter] + exact and_congr_right (fun he => by rw [boundaryFixed S hS e he]) + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [missingEq S hS] + simp only [hb] + have refreshEq (i : Fin H.dividerCount) : + ((TreeSequenceVertexSet (KC.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage KC i.castSucc)).biUnion + fun v => MissingColors G mu v) = + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun v => MissingColors G phi v) := by + rw [ordinaryEq, starredEq] + apply Finset.biUnion_congr rfl + intro v hv + exact hmissingFixed v (TreeSequenceInitialSegmentVertexSetSubset + (stageToB i.succ) (Finset.mem_sdiff.mp hv).1) + let goodC := @helperGoodC1021 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) (@base) (@H) (@good) (@gamma) (@mu) + (@Bminus) (@C) (@hBCstrict) (@hCT) (@segTrans) (@coreToB) (@hBtoC) (@stageToB) (@missingEq) + (@newInput) (@newSeries) (@rp) (@above) (@strict) (@below) (@gen) (@hs) (@htree) (@hkind) + (@chosenAgree) (@closureVertices) (@closureMu) (@stageOld) (@stageLast) (@divBound) + (@ordinaryEq) (@terminalMissing) (@indexedStoredEq) (@stageMissingEq) (@segmentSubset) + (@minusEq) (@refreshEq) + refine ⟨goodC, hmod, hMPC, terminalRoute, rfl, ?_, ?_, ?_⟩ + · change 2 * ett.rounds + 11 ≤ + (TreeMissingColors mu (newSeries.data.tree (Fin.last ett.rounds).castSucc)).card + rw [htree, terminalMissing] + exact hlarge + · change gamma ∉ (HierarchyStoredColorsAt KC (Fin.last H.dividerCount)).biUnion + (good.gamma (Fin.last H.dividerCount)) + rw [indexedStoredEq] + exact hgammaReserved + · change beta ∉ (HierarchyStoredColorsAt KC (Fin.last H.dividerCount)).biUnion + (good.gamma (Fin.last H.dividerCount)) + rw [indexedStoredEq] + intro hb + obtain ⟨eta, he, hbe⟩ := Finset.mem_biUnion.mp hb + have hm := (GoodHierarchyReservedDisjoint good (Fin.last H.dividerCount)).1 eta he hbe + obtain ⟨v, hv, hbv⟩ := Finset.mem_biUnion.mp hm + apply hbeta + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset + (segTrans (segTrans (starredToB _) hBtoC) hCT) hv, hbv⟩ + +private theorem helper_continuation_906.{u_1, u_2} : + helperContinuation906Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive base H good hlarge beta gamma hbeta mu + Bminus C hfixed hmissingFixed hgammaReserved hBCstrict hCT segRefl segTrans Tn coreToB + TnToB hlenC hBtoC TnToC TnStrictC stageToB starredToB vertexMem fixedC missingEq hmod + terminalRoute + obtain ⟨corrC⟩ := hmod.2.2 C TnToC TnStrictC terminalRoute + have hMPC := MaximumPropertyTransport G k e0 ett mu hmod C corrC hMP + refine ⟨corrC, ?_⟩ + have peSupport {r : ℕ} {inp : PartialEdgeColoring E k} + (s : TashkinovSeries G k r e0 inp) (q : Fin r) + (hp : s.data.kind q.succ = some TashkinovExtensionKind.PE) : + ∃ v u f, s.data.chosenVertex q.succ = some v ∧ + s.data.connectingEdges q.succ = {f} ∧ + v ∈ TreeSequenceVertexSet (s.data.tree q.succ.castSucc) ∧ + u ∉ TreeSequenceVertexSet (s.data.tree q.succ.castSucc) ∧ + G.ends f = s(v, u) := by + apply helper_peSupport_740 <;> assumption + rcases corrC with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproper, hone, hstableSeries⟩ + cases newETT with + | mk r rp series above strict below gen => + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let rep := @helperRep474 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@mu) (@C) (@newInput) (@newSeries) (@rp) (@above) (@strict) + (@below) (@gen) + let q : Fin ett.rounds := ⟨ett.rounds - 1, by omega⟩ + have hq : q.succ = Fin.last ett.rounds := Fin.ext (by simp [q]; omega) + have htree : newSeries.data.tree (Fin.last ett.rounds).castSucc = Tn := by + simpa only [hq, Tn] using htrees q + have hkind := hkinds (Fin.last ett.rounds) + have chosenAgree (hp : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) : + newSeries.data.chosenVertex (Fin.last ett.rounds) = + ett.series.data.chosenVertex (Fin.last ett.rounds) := by + obtain ⟨v, u, f, hv, hf, hvin, huout, hends⟩ := + peSupport ett.series q (by simpa [hq] using hp) + obtain ⟨v', u', f', hv', hf', hvin', huout', hends'⟩ := + peSupport newSeries q (by simpa [hq] using hkind.trans hp) + have hedge : f' = f := by + have hh := hedges q.succ + rw [hf', hf] at hh + simpa using hh + have hvEq : v' = v := by + rcases Sym2.eq_iff.mp (hends'.symm.trans (hedge ▸ hends)) with h | h + · exact h.1 + · have hin : v ∈ TreeSequenceVertexSet (newSeries.data.tree q.succ.castSucc) := by + simpa [hq, htree, Tn] using hvin + exact False.elim (huout' (h.2 ▸ hin)) + simpa [hq] using hv'.trans ((congrArg some hvEq).trans hv.symm) + have closureVertices (hp : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet Bminus := by + obtain ⟨_, _, ⟨u⟩⟩ := base.parallel hp + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToB + rw [u.vertexSet] + exact Finset.mem_union_right _ hv + -- The closure need not be an ordered prefix of the core. + have closureMu (hp : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) : + TashkinovClosure mu + (TreeSequencePrefix Tn base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) base.closure := by + apply helper_closureMu_809 <;> assumption + let pos : Fin ((newSeries.data.tree (Fin.last ett.rounds).castSucc).length + 1) := + Fin.cast (congrArg (fun S : TreeSequence G e0 => S.length + 1) htree.symm) + base.supportPosition + let baseC := @helperBaseC598 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@mu) (@C) (@newInput) (@newSeries) + (@rp) (@above) (@strict) (@below) (@gen) (@htree) (@hkind) (@chosenAgree) (@closureMu) + refine ⟨baseC, ?_⟩ + let stageC : Fin (H.dividerCount + 2) → TreeSequence G e0 := + fun j => if j.val = H.dividerCount + 1 then C else H.stage j + have stageOld (j : Fin (H.dividerCount + 2)) (hj : j.val ≤ H.dividerCount) : + stageC j = H.stage j := by + exact ite_eq_right (show j.val ≠ H.dividerCount + 1 by omega) + have stageLast : stageC (Fin.last (H.dividerCount + 1)) = C := by + simp only [stageC, Fin.val_last, ite_true] + have divBound (i : Fin H.dividerCount) : (H.dividerPosition i).val ≤ C.length := by + have hl := congrArg TreeSequence.length (H.dividerStage i) + change (H.stage ⟨i.val + 1, by omega⟩).length = (H.dividerPosition i).val at hl + have hs := stageToB i.succ + rw [← hl] + exact le_trans hs.1 hBtoC.1 + let KC := @helperKC712 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) (@base) (@H) (@mu) (@Bminus) (@C) + (@hBCstrict) (@hCT) (@segTrans) (@coreToB) (@hBtoC) (@stageToB) (@newInput) (@newSeries) + (@rp) (@above) (@strict) (@below) (@gen) (@htree) (@hkind) (@chosenAgree) (@closureMu) + (@stageOld) (@stageLast) (@divBound) + have ordinaryEq (j : Fin (H.dividerCount + 1)) : + KC.stage j.castSucc = H.stage j.castSucc := + stageOld j.castSucc (Nat.le_of_lt_succ j.isLt) + have starredEq (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage KC j = HierarchyStarredStage H j := by + refine Fin.cases rfl (fun i => ordinaryEq i.succ) j + have terminalMissing : TreeMissingColors mu Tn = TreeMissingColors phi Tn := + missingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToB) + have storedEq : TashkinovStoredColors newSeries.data (Fin.last ett.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + unfold TashkinovStoredColors + simp only [hstored, ← hgen, ← ett.generatingColoring, htree, terminalMissing] + rfl + exact @helper_caseContinuation_955 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hpositive) (@base) (@H) + (@good) (@hlarge) (@beta) (@gamma) (@hbeta) (@mu) (@Bminus) (@C) (@hfixed) + (@hmissingFixed) (@hgammaReserved) (@hBCstrict) (@hCT) (@segRefl) (@segTrans) (@coreToB) + (@hlenC) (@hBtoC) (@stageToB) (@starredToB) (@vertexMem) (@fixedC) (@missingEq) (@hmod) + (@terminalRoute) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) + (@hkinds) (@hproper) (@hone) (@hstableSeries) (@rp) (@above) (@strict) (@below) (@gen) + (@hs) (@hMPC) (@htree) (@hkind) (@chosenAgree) (@closureVertices) (@closureMu) + (@stageOld) (@stageLast) (@divBound) (@ordinaryEq) (@starredEq) (@terminalMissing) + (@storedEq) +lemma Step1CaseTwoOutsidePrefixHierarchy {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hlower : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < lower.rounds → lower.rounds < ett.rounds → MaximumProperty lower → + (open scoped Classical in LowerRoundProperties lower)) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (_ : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (beta gamma : Fin k) (hbeta : beta ∉ TreeMissingColors phi T) + (mu : PartialEdgeColoring E k) + (_ : gamma ≠ beta) + (hproperMu : IsProperEdgeColoring G mu) + (honeMu : IsOneEdgeUncolored mu e0) + (hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi mu) + (Bminus C : TreeSequence G e0) + (hfixed : ∀ e, TreeIncidentEdge Bminus e → mu e = phi e) + (hmissingFixed : ∀ v, v ∈ TreeSequenceVertexSet Bminus → + MissingColors G mu v = MissingColors G phi v) + (_ : gamma ∈ MissingColors G phi + (C.vertex (Fin.last C.length))) + (_ : beta ∈ MissingColors G mu + (C.vertex (Fin.last C.length))) + (f₃ : E) (_ : Incident G (C.vertex (Fin.last C.length)) f₃) + (_ : mu f₃ = some gamma) + (_ : ∀ v, v ∈ TreeSequenceVertexSet C → ∀ eta, + eta ≠ gamma → eta ≠ beta → + (eta ∈ MissingColors G mu v ↔ eta ∈ MissingColors G phi v)) + (hgammaReserved : gamma ∉ (HierarchyStoredColorsAt H + (Fin.last H.dividerCount)).biUnion + (good.gamma (Fin.last H.dividerCount))) + (hAB : TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) Bminus) + (hBCstrict : Bminus.length < C.length) + (hCT : TreeSequenceInitialSegment C T) + (hBC : ∃ g, TreeSequenceAdjoinEdge Bminus g C) : + ∃ (corrC : CorrespondingExtendedTashkinovTree G k e0 ett mu C) + (baseC : HierarchyBase corrC.replacementETT mu) + (KC : TashkinovHierarchy corrC.replacementETT baseC) + (goodC : GoodHierarchy KC), + ModColoring ett mu ∧ + MaximumProperty corrC.replacementETT ∧ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu + (ett.series.data.tree (Fin.last ett.rounds).castSucc) C) ∨ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence mu seed C)) ∧ + KC.dividerCount = H.dividerCount ∧ + 2 * corrC.replacementETT.rounds + 11 ≤ + (TreeMissingColors mu + (corrC.replacementETT.series.data.tree + (Fin.last corrC.replacementETT.rounds).castSucc)).card ∧ + gamma ∉ (HierarchyStoredColorsAt KC + (Fin.last KC.dividerCount)).biUnion + (goodC.gamma (Fin.last KC.dividerCount)) ∧ + beta ∉ (HierarchyStoredColorsAt KC + (Fin.last KC.dividerCount)).biUnion + (goodC.gamma (Fin.last KC.dividerCount)) := by + classical + have segRefl (S : TreeSequence G e0) : TreeSequenceInitialSegment S S := + ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have segTrans {S U W : TreeSequence G e0} + (hSU : TreeSequenceInitialSegment S U) + (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := by + refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans + (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans + (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + have stageSegment : ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1), + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + intro a d + induction d with + | zero => intro h; exact segRefl _ + | succ d ih => + intro h + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + have lastZero (h : H.dividerCount = 0) : A = base.core := by + simp [A, HierarchyStarredStage, h, Fin.last] + have lastPositive (h : H.dividerCount ≠ 0) : + A = H.stage ⟨H.dividerCount, by omega⟩ := by + unfold A HierarchyStarredStage + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) + · exact False.elim (h (by simpa using congrArg Fin.val hz)) + · rw [hi, Fin.cases_succ] + congr 1 + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + have coreToA : TreeSequenceInitialSegment base.core A := by + by_cases h : H.dividerCount = 0 + · rw [lastZero h]; exact segRefl _ + · rw [lastPositive h] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + have hs' : TreeSequenceInitialSegment (H.stage ⟨1, by omega⟩) + (H.stage ⟨H.dividerCount, by omega⟩) := by simpa only [he] using hs + exact segTrans H.coreInsideFirst hs' + have TnToCore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨u⟩⟩ := base.parallel hp + exact u.leftSegment + · rw [base.nonparallel hp]; exact segRefl _ + have coreToB := segTrans coreToA hAB + have TnToB := segTrans TnToCore coreToB + obtain ⟨g, hattach⟩ := hBC + obtain ⟨hlenC, hBtoC, hg⟩ := hattach + have TnToC := segTrans TnToB hBtoC + have TnStrictC : Tn.length < C.length := lt_of_le_of_lt TnToB.1 hBCstrict + have stageToB (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) Bminus := by + by_cases h : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := + Fin.ext (by have := j.isLt; simp only [Fin.val_castSucc, Fin.val_zero]; omega) + rw [hj, H.baseStage] + exact TnToB + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + have he : j.val + (H.dividerCount - j.val) = H.dividerCount := by omega + have hs' : TreeSequenceInitialSegment (H.stage j.castSucc) + (H.stage ⟨H.dividerCount, by omega⟩) := by + convert hs using 1 + · apply congrArg H.stage; apply Fin.ext; rfl + · apply congrArg H.stage; apply Fin.ext; exact he.symm + exact segTrans hs' (by rw [← lastPositive h]; exact hAB) + have starredToB (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage H j) Bminus := by + refine Fin.cases coreToB (fun i => ?_) j + exact stageToB i.succ + have vertexMem (S : TreeSequence G e0) (i : Fin (S.length + 1)) : + S.vertex i ∈ TreeSequenceVertexSet S := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i, rfl⟩ + have fixedC (j : Fin C.length) : mu (C.edge j) = phi (C.edge j) := by + obtain ⟨i, hi⟩ := C.attaches j + let ib : Fin (Bminus.length + 1) := ⟨i.val, by have := i.isLt; have := j.isLt; omega⟩ + have hv : C.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) = Bminus.vertex ib := by + exact hBtoC.2.1 ib + apply hfixed + refine ⟨Bminus.vertex ib, vertexMem _ _, ?_⟩ + change Bminus.vertex ib ∈ G.ends (C.edge j) + rw [hi, hv] + exact Sym2.mem_mk_right _ _ + have missingEq (S : TreeSequence G e0) + (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet Bminus) : + TreeMissingColors mu S = TreeMissingColors phi S := by + unfold TreeMissingColors + apply Finset.biUnion_congr rfl + intro v hv + exact hmissingFixed v (hS hv) + have hmod : ModColoring ett mu := + Td G k e0 input T phi ett hMP hpositive hlower mu hproperMu honeMu + (by simpa [ett.generatingColoring] using hstable) + have terminalRoute : + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu Tn C) ∨ + ((ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovAugmentationSequence mu seed C) := by + have hCF := segTrans hCT ett.belowFinal + have transport (S : TreeSequence G e0) + (hSF : TashkinovAugmentationSequence phi S + (ett.series.data.tree (Fin.last (ett.rounds + 1)))) + (hSC : TreeSequenceInitialSegment S C) : + TashkinovAugmentationSequence mu S C := by + exact TashkinovAugmentationSequenceColoringTransport phi mu S Bminus C + (TashkinovAugmentationSequenceRestrict phi S C _ hSF hSC hCF) + hBtoC hlenC (fun j _ => fixedC j) hmissingFixed + have step := ett.series.certified (Fin.last ett.rounds) + generalize hi : Fin.last ett.rounds = i at step + cases step with + | initial => have hv := congrArg Fin.val hi; simp at hv; omega + | SE q _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hq : q.succ = Fin.last ett.rounds := hi.symm + have hlast : q.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by + have hv := congrArg Fin.val hq + simp only [Fin.val_succ, Fin.val_last] at hv ⊢ + omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hq, hlast, ← ett.generatingColoring] using closure.1 + have hseedC : TreeSequenceInitialSegment seed C := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + hCF (by + obtain ⟨ha, _, _⟩ := adjoin + rw [hq] at ha + change seed.length = Tn.length + 1 at ha + omega) + refine Or.inr ⟨Or.inl (by simpa [hq] using kind), choice.edge, seed, + by simpa [hq] using edges, by simpa [Tn, hq] using adjoin, + transport seed hroute hseedC⟩ + | PE q _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + have hq : q.succ = Fin.last ett.rounds := hi.symm + have hlast : q.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by + have hv := congrArg Fin.val hq + simp only [Fin.val_succ, Fin.val_last] at hv ⊢ + omega) + refine Or.inl ⟨by simpa [hq] using kind, transport Tn ?_ TnToC⟩ + simpa [Tn, hq, hlast, ← ett.generatingColoring] using closure.1 + | RE q _ _ _ _ available coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hq : q.succ = Fin.last ett.rounds := hi.symm + have hlast : q.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by + have hv := congrArg Fin.val hq + simp only [Fin.val_succ, Fin.val_last] at hv ⊢ + omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hq, hlast, ← ett.generatingColoring] using closure.1 + have hseedC : TreeSequenceInitialSegment seed C := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + hCF (by + obtain ⟨ha, _, _⟩ := adjoin + rw [hq] at ha + change seed.length = Tn.length + 1 at ha + omega) + refine Or.inr ⟨Or.inr (by simpa [hq] using kind), available.edge, seed, + by simpa [hq] using edges, by simpa [Tn, hq] using adjoin, + transport seed hroute hseedC⟩ + apply helper_continuation_906 <;> assumption +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixTwoEdges.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixTwoEdges.lean new file mode 100644 index 0000000000..e56cd08b24 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixTwoEdges.lean @@ -0,0 +1,250 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsidePrefixHierarchy +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsideRecoloredPrefix +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsideTwoEdgeExtension + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Step1Case Two Outside Prefix Two Edges + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1CaseTwoOutsidePrefixTwoEdges {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (_ : H.dividerCount < q) + (_ : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (hterminal : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (hElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (halpha : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (hbeta : beta ∉ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ a₃ b₃ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₃) (Sum.inl b₃)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hP₃ : TreeExitPath T phi alpha beta a₃ b₃ P₃) + (hpaths₁₂ : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (hpaths₁₃ : ∀ x, x ∈ P₁.support → x ∉ P₃.support) + (hpaths₂₃ : ∀ x, x ∈ P₂.support → x ∉ P₃.support) + (ha₁₂ : a₁ ≠ a₂) (ha₁₃ : a₁ ≠ a₃) (ha₂₃ : a₂ ≠ a₃) + (hb₁₂ : b₁ ≠ b₂) (hb₁₃ : b₁ ≠ b₃) (hb₂₃ : b₂ ≠ b₃) + (horder₁₂ : TreeVertexOrder T b₁ b₂) + (horder₂₃ : TreeVertexOrder T b₂ b₃) + (f₁ f₂ f₃ : E) + (hf₁ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₂ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₃ : f₃ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hif₁ : Incident G b₁ f₁) (hif₂ : Incident G b₂ f₂) + (hif₃ : Incident G b₃ f₃) + (hPf₁ : Sum.inr f₁ ∈ P₁.support) + (hPf₂ : Sum.inr f₂ ∈ P₂.support) + (hPf₃ : Sum.inr f₃ ∈ P₃.support) + (houtside : b₃ ∉ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) : + ∃ (gamma : Fin k) (mu : PartialEdgeColoring E k) (C J₁ J : TreeSequence G e0) (corrJ : + CorrespondingExtendedTashkinovTree G k e0 ett mu J) (baseJ : + HierarchyBase corrJ.replacementETT mu) (KJ : + TashkinovHierarchy corrJ.replacementETT baseJ) (goodJ : GoodHierarchy KJ) (R₁ : + (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₁) (Sum.inl b₁)) (R₂ : + (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₂) (Sum.inl b₂)) (R₃ : + (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₃) (Sum.inl b₃)), + gamma ≠ beta ∧ + IsProperEdgeColoring G mu ∧ + IsOneEdgeUncolored mu e0 ∧ + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi mu ∧ + ModColoring ett mu ∧ + MaximumProperty corrJ.replacementETT ∧ + KJ.dividerCount = H.dividerCount ∧ + 2 * corrJ.replacementETT.rounds + 11 ≤ + (TreeMissingColors mu + (corrJ.replacementETT.series.data.tree + (Fin.last corrJ.replacementETT.rounds).castSucc)).card ∧ + gamma ∉ + (HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount)).biUnion + (goodJ.gamma (Fin.last KJ.dividerCount)) ∧ + beta ∉ + (HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount)).biUnion + (goodJ.gamma (Fin.last KJ.dividerCount)) ∧ + beta ∈ MissingColors G mu b₃ ∧ + TreeExitPath T mu gamma beta a₁ b₁ R₁ ∧ + TreeExitPath T mu gamma beta a₂ b₂ R₂ ∧ + TreeExitPath T mu gamma beta a₃ b₃ R₃ ∧ + (∀ x, x ∈ R₁.support → x ∉ R₂.support) ∧ + (∀ x, x ∈ R₁.support → x ∉ R₃.support) ∧ + (∀ x, x ∈ R₂.support → x ∉ R₃.support) ∧ + R₁.support = P₁.support ∧ + R₂.support = P₂.support ∧ + R₃.support = P₃.support ∧ + R₁.length = P₁.length ∧ + R₂.length = P₂.length ∧ + R₃.length = P₃.length ∧ + TreeSequenceInitialSegment C T ∧ + C.vertex (Fin.last C.length) = b₃ ∧ + TreeSequenceAdjoinEdge C f₁ J₁ ∧ + TreeSequenceAdjoinEdge J₁ f₂ J ∧ + (∀ v, + Incident G v f₁ → + v ∈ + TreeSequenceVertexSet J) ∧ + (∀ v, + Incident G v f₂ → + v ∈ + TreeSequenceVertexSet + J) ∧ + b₁ ∈ TreeSequenceVertexSet J ∧ + b₂ ∈ + TreeSequenceVertexSet + J ∧ + b₃ ∈ + TreeSequenceVertexSet J := by + obtain ⟨gamma, mu, Bminus, C, R₁, R₂, R₃, hgamma, hproperMu, honeMu, + hstable, hfixed, hmissingFixed, hreserved, hgammaMissing, hbetaMissing, + hcolor, hotherMissing, hR₁, hR₂, hR₃, hd₁₂, hd₁₃, hd₂₃, hs₁, hs₂, hs₃, + hl₁, hl₂, hl₃, hAB, hBCstrict, hCT, hlast, hadjoin, hf₁mu, hf₂mu, + houtDistinct, hb₁C, hb₂C, hb₃C⟩ := + Step1CaseTwoOutsideRecoloredPrefix G k e0 input T phi ett hproper hone + base H good hterminal hElementary alpha beta halpha hclosed hne hbeta + a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ hP₁ hP₂ hP₃ hpaths₁₂ hpaths₁₃ + hpaths₂₃ ha₁₂ ha₁₃ ha₂₃ hb₁₂ hb₁₃ hb₂₃ horder₁₂ horder₂₃ f₁ f₂ f₃ + hf₁ hf₂ hf₃ hif₁ hif₂ hif₃ hPf₁ hPf₂ hPf₃ houtside + obtain ⟨corrC, baseC, KC, goodC, hmod, hMPC, heligible, hcount, hlargeC, + hgammaC, hbetaC⟩ := + Step1CaseTwoOutsidePrefixHierarchy G k e0 input T phi ett hMP hpositive + hlower base H good hlarge hElementary beta gamma hbeta mu hgamma + hproperMu honeMu hstable Bminus C hfixed hmissingFixed + (by simpa [hlast] using hgammaMissing) + (by simpa [hlast] using hbetaMissing) f₃ + (by simpa [hlast] using hif₃) hcolor hotherMissing + hreserved hAB hBCstrict hCT + hadjoin + obtain ⟨J₁, J, corrJ, baseJ, KJ, goodJ, hMPCJ, hcountJ, hlargeJ, + hgammaJ, hbetaJ, had₁, had₂, hf₁J, hf₂J, hb₁J, hb₂J, hb₃J⟩ := + Step1CaseTwoOutsideTwoEdgeExtension G k e0 input T phi mu ett hMP C + corrC baseC KC goodC hmod hMPC heligible hlargeC beta gamma hgammaC + hbetaC b₁ b₂ b₃ f₁ f₂ hbetaMissing hf₁mu hf₂mu hif₁ hif₂ + houtDistinct hb₁C hb₂C hb₃C + exact ⟨gamma, mu, C, J₁, J, corrJ, baseJ, KJ, goodJ, R₁, R₂, R₃, + hgamma, hproperMu, honeMu, hstable, hmod, hMPCJ, + hcountJ.trans hcount, hlargeJ, hgammaJ, hbetaJ, hbetaMissing, + hR₁, hR₂, hR₃, hd₁₂, hd₁₃, hd₂₃, hs₁, hs₂, hs₃, hl₁, hl₂, hl₃, + hCT, hlast, had₁, had₂, hf₁J, hf₂J, hb₁J, hb₂J, hb₃J⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRecoloredPrefix.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRecoloredPrefix.lean new file mode 100644 index 0000000000..97fc174bfc --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRecoloredPrefix.lean @@ -0,0 +1,1178 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# Step1Case Two Outside Recolored Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperContinuation386Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H) (alpha beta : Fin k), alpha ≠ beta → + ∀ (a₁ b₁ a₂ b₂ a₃ b₃ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl + b₂)) (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₃) (Sum.inl b₃)), + TreeExitPath T phi alpha beta a₁ b₁ P₁ → TreeExitPath T phi alpha beta a₂ b₂ P₂ → + TreeExitPath T phi alpha beta a₃ b₃ P₃ → ( + ∀ x ∈ P₁.support, x ∉ P₂.support) → ( + ∀ x ∈ P₁.support, x ∉ P₃.support) → ( + ∀ x ∈ P₂.support, x ∉ P₃.support) → TreeVertexOrder T b₁ b₂ → TreeVertexOrder T b₂ b₃ → + ∀ (f₁ f₂ f₃ : E), f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → f₂ ∈ + BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → f₃ ∈ BoundaryColorEdges G phi + (TreeSequenceVertexSet T) beta → Incident G b₁ f₁ → Incident G b₂ f₂ → Incident G b₃ f₃ → + Sum.inr f₁ ∈ P₁.support → Sum.inr f₂ ∈ P₂.support → Sum.inr f₃ ∈ P₃.support → b₃ ∉ + TreeSequenceVertexSet (HierarchyStarredStage H (Fin.last H.dividerCount)) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + TreeSequenceInitialSegment Tn A → TreeSequenceInitialSegment A T → + ∀ gamma ∈ MissingColors G phi b₃, b₃ ∈ TreeSequenceVertexSet T → gamma ≠ beta → gamma ∉ + (HierarchyStoredColorsAt H (Fin.last H.dividerCount)).biUnion (good.gamma (Fin.last + H.dividerCount)) → ( + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → phi f ≠ some alpha ∧ phi f ≠ some + gamma) → ( + ∀ {z : Sym2 V} {x y : V}, x ∈ z → y ∈ z → x ≠ y → z = s(x, y)) → ( + ∀ {v : V} {f : E}, v ∉ TreeSequenceVertexSet T → Incident G v f → TreeIncidentEdge T f → f ∈ + BoundaryEdges G (TreeSequenceVertexSet T)) → + let sigma : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha gamma; ( + ∀ (f : E), TreeIncidentEdge T f → sigma f = phi f) → IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 → + ∃ (gamma : Fin k) (mu : PartialEdgeColoring E k) (Bminus : TreeSequence G e0) (C : + TreeSequence G e0) (R₁ : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (R₂ : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₂) (Sum.inl + b₂)) (R₃ : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₃) (Sum.inl b₃)), gamma + ≠ beta ∧ IsProperEdgeColoring G mu ∧ IsOneEdgeUncolored mu e0 ∧ StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) phi mu ∧ ( + ∀ (e : E), TreeIncidentEdge Bminus e → mu e = phi e) ∧ ( + ∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) ∧ gamma ∉ + (HierarchyStoredColorsAt H (Fin.last H.dividerCount)).biUnion (good.gamma (Fin.last + H.dividerCount)) ∧ gamma ∈ MissingColors G phi b₃ ∧ beta ∈ MissingColors G mu b₃ ∧ mu f₃ = + some gamma ∧ ( + ∀ v ∈ TreeSequenceVertexSet C, + ∀ (eta : Fin k), eta ≠ gamma → eta ≠ beta → (eta ∈ MissingColors G mu v ↔ eta ∈ MissingColors + G phi v)) ∧ TreeExitPath T mu gamma beta a₁ b₁ R₁ ∧ TreeExitPath T mu gamma beta a₂ b₂ R₂ + ∧ TreeExitPath T mu gamma beta a₃ b₃ R₃ ∧ ( + ∀ x ∈ R₁.support, x ∉ R₂.support) ∧ ( + ∀ x ∈ R₁.support, x ∉ R₃.support) ∧ ( + ∀ x ∈ R₂.support, x ∉ R₃.support) ∧ R₁.support = P₁.support ∧ R₂.support = P₂.support ∧ + R₃.support = P₃.support ∧ R₁.length = P₁.length ∧ R₂.length = P₂.length ∧ R₃.length = + P₃.length ∧ TreeSequenceInitialSegment (HierarchyStarredStage H (Fin.last H.dividerCount)) + Bminus ∧ Bminus.length < C.length ∧ TreeSequenceInitialSegment C T ∧ C.vertex (Fin.last + C.length) = b₃ ∧ ( + ∃ (g : E), TreeSequenceAdjoinEdge Bminus g C) ∧ f₁ ∈ BoundaryColorEdges G mu + (TreeSequenceVertexSet C) beta ∧ f₂ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet C) + beta ∧ ( + ∀ (u₁ u₂ : V), Incident G u₁ f₁ → u₁ ∉ TreeSequenceVertexSet C → Incident G u₂ f₂ → u₂ ∉ + TreeSequenceVertexSet C → u₁ ≠ u₂) ∧ b₁ ∈ TreeSequenceVertexSet C ∧ b₂ ∈ + TreeSequenceVertexSet C ∧ b₃ ∈ TreeSequenceVertexSet C + +private abbrev helperContinuation728Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H) (alpha beta : Fin k), alpha ≠ beta → + ∀ (a₁ b₁ a₂ b₂ a₃ b₃ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl + b₂)) (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₃) (Sum.inl b₃)), + TreeExitPath T phi alpha beta a₁ b₁ P₁ → TreeExitPath T phi alpha beta a₂ b₂ P₂ → ( + ∀ x ∈ P₁.support, x ∉ P₂.support) → ( + ∀ x ∈ P₁.support, x ∉ P₃.support) → ( + ∀ x ∈ P₂.support, x ∉ P₃.support) → + ∀ (f₁ f₂ f₃ : E), f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → f₂ ∈ + BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → f₃ ∈ BoundaryColorEdges G phi + (TreeSequenceVertexSet T) beta → Incident G b₁ f₁ → Incident G b₂ f₂ → Incident G b₃ f₃ → + Sum.inr f₁ ∈ P₁.support → Sum.inr f₂ ∈ P₂.support → Sum.inr f₃ ∈ P₃.support → + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + ∀ gamma ∈ MissingColors G phi b₃, b₃ ∈ TreeSequenceVertexSet T → gamma ≠ beta → gamma ∉ + (HierarchyStoredColorsAt H (Fin.last H.dividerCount)).biUnion (good.gamma (Fin.last + H.dividerCount)) → + let sigma : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha gamma; ( + ∀ (f : E), TreeIncidentEdge T f → sigma f = phi f) → IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 → ( + ∀ (W : TreeSequence G e0) (p q : PartialEdgeColoring E k), ( + ∀ (f : E), TreeIncidentEdge W f → q f = p f) → + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G q v = MissingColors G p v) → ( + ∀ v ∈ TreeSequenceVertexSet T, MissingColors G sigma v = MissingColors G phi v) → ( + ∀ {p : PartialEdgeColoring E k} {c d : Fin k} {u v : V} + {walk : (TwoColorIncidenceGraph G p c d).Walk (Sum.inl u) (Sum.inl v)} {f : E} {x : V}, + walk.IsPath → Sum.inr f ∈ walk.support → Incident G x f → Sum.inl x ∈ walk.support) → ( + ∀ {p q : PartialEdgeColoring E k} {c d c' d' : Fin k} {u v : V} (walk : + (TwoColorIncidenceGraph G p c d).Walk (Sum.inl u) (Sum.inl v)), TreeExitPath T p c d u v + walk → ( + ∀ {w : V} {f : E}, Sum.inr f ∈ walk.support → Incident G w f → p f = some c ∨ p f = some d → q + f = some c' ∨ q f = some d') → c' ∈ MissingColors G q u ∨ d' ∈ MissingColors G q u → + ∃ (out : (TwoColorIncidenceGraph G q c' d').Walk (Sum.inl u) (Sum.inl v)), TreeExitPath T q c' + d' u v out ∧ out.support = walk.support ∧ out.length = walk.length) → + ∀ (Q₁ : (TwoColorIncidenceGraph G sigma gamma beta).Walk (Sum.inl a₁) (Sum.inl b₁)), + TreeExitPath T sigma gamma beta a₁ b₁ Q₁ → Q₁.support = P₁.support → Q₁.length = P₁.length + → + ∀ (Q₂ : (TwoColorIncidenceGraph G sigma gamma beta).Walk (Sum.inl a₂) (Sum.inl b₂)), + TreeExitPath T sigma gamma beta a₂ b₂ Q₂ → Q₂.support = P₂.support → Q₂.length = P₂.length + → + ∀ (Q₃ : (TwoColorIncidenceGraph G sigma gamma beta).Walk (Sum.inl a₃) (Sum.inl b₃)), + TreeExitPath T sigma gamma beta a₃ b₃ Q₃ → Q₃.support = P₃.support → Q₃.length = P₃.length + → + ∀ (i₁ i₂ i₃ : Fin (T.length + (1 : ℕ))) (hAs : A.length < (↑i₃ : ℕ)) (hspos : (1 : ℕ) ≤ (↑i₃ : + ℕ) - (1 : ℕ)) (hsT : (↑i₃ : ℕ) ≤ T.length), + let Bminus : TreeSequence G e0 := TreeSequencePrefix T ((↑i₃ : ℕ) - (1 : ℕ)) hspos ( + by omega + ); + let C : TreeSequence G e0 := TreeSequencePrefix T (↑i₃ : ℕ) ( + by omega + ) hsT; TreeSequenceInitialSegment A Bminus → TreeSequenceInitialSegment C T → + TreeSequenceInitialSegment Bminus T → TreeSequenceInitialSegment Tn Bminus → Bminus.length + < C.length → C.vertex (Fin.last C.length) = b₃ → b₃ ∉ TreeSequenceVertexSet Bminus → b₁ ∈ + TreeSequenceVertexSet C → b₂ ∈ TreeSequenceVertexSet C → b₃ ∈ TreeSequenceVertexSet C → ( + ∃ (g : E), TreeSequenceAdjoinEdge Bminus g C) → + let J : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigma gamma beta; + let K : Set (V ⊕ E) := TwoColorComponent G sigma gamma beta (Sum.inl b₃); gamma ∈ + MissingColors G sigma b₃ → ( + ∀ x ∈ Q₃.support, + ∀ (y : V ⊕ E), J.Adj x y → y ∈ Q₃.support) → + ∃ (gamma : Fin k) (mu : PartialEdgeColoring E k) (Bminus : TreeSequence G e0) (C : + TreeSequence G e0) (R₁ : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (R₂ : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₂) (Sum.inl + b₂)) (R₃ : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₃) (Sum.inl b₃)), gamma + ≠ beta ∧ IsProperEdgeColoring G mu ∧ IsOneEdgeUncolored mu e0 ∧ StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) phi mu ∧ ( + ∀ (e : E), TreeIncidentEdge Bminus e → mu e = phi e) ∧ ( + ∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) ∧ gamma ∉ + (HierarchyStoredColorsAt H (Fin.last H.dividerCount)).biUnion (good.gamma (Fin.last + H.dividerCount)) ∧ gamma ∈ MissingColors G phi b₃ ∧ beta ∈ MissingColors G mu b₃ ∧ mu f₃ = + some gamma ∧ ( + ∀ v ∈ TreeSequenceVertexSet C, + ∀ (eta : Fin k), eta ≠ gamma → eta ≠ beta → (eta ∈ MissingColors G mu v ↔ eta ∈ MissingColors + G phi v)) ∧ TreeExitPath T mu gamma beta a₁ b₁ R₁ ∧ TreeExitPath T mu gamma beta a₂ b₂ R₂ + ∧ TreeExitPath T mu gamma beta a₃ b₃ R₃ ∧ ( + ∀ x ∈ R₁.support, x ∉ R₂.support) ∧ ( + ∀ x ∈ R₁.support, x ∉ R₃.support) ∧ ( + ∀ x ∈ R₂.support, x ∉ R₃.support) ∧ R₁.support = P₁.support ∧ R₂.support = P₂.support ∧ + R₃.support = P₃.support ∧ R₁.length = P₁.length ∧ R₂.length = P₂.length ∧ R₃.length = + P₃.length ∧ TreeSequenceInitialSegment (HierarchyStarredStage H (Fin.last H.dividerCount)) + Bminus ∧ Bminus.length < C.length ∧ TreeSequenceInitialSegment C T ∧ C.vertex (Fin.last + C.length) = b₃ ∧ ( + ∃ (g : E), TreeSequenceAdjoinEdge Bminus g C) ∧ f₁ ∈ BoundaryColorEdges G mu + (TreeSequenceVertexSet C) beta ∧ f₂ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet C) + beta ∧ ( + ∀ (u₁ u₂ : V), Incident G u₁ f₁ → u₁ ∉ TreeSequenceVertexSet C → Incident G u₂ f₂ → u₂ ∉ + TreeSequenceVertexSet C → u₁ ≠ u₂) ∧ b₁ ∈ TreeSequenceVertexSet C ∧ b₂ ∈ + TreeSequenceVertexSet C ∧ b₃ ∈ TreeSequenceVertexSet C + +private abbrev helperContinuation431Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (good : + GoodHierarchy H) (alpha beta : Fin k), alpha ≠ beta → + ∀ (a₁ b₁ a₂ b₂ a₃ b₃ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl + b₂)) (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₃) (Sum.inl b₃)), + TreeExitPath T phi alpha beta a₁ b₁ P₁ → TreeExitPath T phi alpha beta a₂ b₂ P₂ → + TreeExitPath T phi alpha beta a₃ b₃ P₃ → ( + ∀ x ∈ P₁.support, x ∉ P₂.support) → ( + ∀ x ∈ P₁.support, x ∉ P₃.support) → ( + ∀ x ∈ P₂.support, x ∉ P₃.support) → TreeVertexOrder T b₁ b₂ → TreeVertexOrder T b₂ b₃ → + ∀ (f₁ f₂ f₃ : E), f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → f₂ ∈ + BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta → f₃ ∈ BoundaryColorEdges G phi + (TreeSequenceVertexSet T) beta → Incident G b₁ f₁ → Incident G b₂ f₂ → Incident G b₃ f₃ → + Sum.inr f₁ ∈ P₁.support → Sum.inr f₂ ∈ P₂.support → Sum.inr f₃ ∈ P₃.support → b₃ ∉ + TreeSequenceVertexSet (HierarchyStarredStage H (Fin.last H.dividerCount)) → ( + ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C + → TreeSequenceInitialSegment A C) → + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + TreeSequenceInitialSegment Tn A → TreeSequenceInitialSegment A T → + ∀ gamma ∈ MissingColors G phi b₃, b₃ ∈ TreeSequenceVertexSet T → gamma ≠ beta → gamma ∉ + (HierarchyStoredColorsAt H (Fin.last H.dividerCount)).biUnion (good.gamma (Fin.last + H.dividerCount)) → ( + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → phi f ≠ some alpha ∧ phi f ≠ some + gamma) → + let sigma : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha gamma; ( + ∀ (f : E), TreeIncidentEdge T f → sigma f = phi f) → IsProperEdgeColoring G sigma ∧ + IsOneEdgeUncolored sigma e0 → ( + ∀ (W : TreeSequence G e0) (p q : PartialEdgeColoring E k), ( + ∀ (f : E), TreeIncidentEdge W f → q f = p f) → + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G q v = MissingColors G p v) → ( + ∀ v ∈ TreeSequenceVertexSet T, MissingColors G sigma v = MissingColors G phi v) → ( + ∀ (p : PartialEdgeColoring E k) (v : V) (c : Fin k), c ∈ MissingColors G p v ↔ + ∀ (f : E), Incident G v f → p f ≠ some c) → ( + ∀ {p : PartialEdgeColoring E k} {c d : Fin k} {u v : V} + {walk : (TwoColorIncidenceGraph G p c d).Walk (Sum.inl u) (Sum.inl v)} {f : E} {x : V}, + walk.IsPath → Sum.inr f ∈ walk.support → Incident G x f → Sum.inl x ∈ walk.support) → ( + ∀ {u v : V} {walk : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)}, + TreeExitPath T phi alpha beta u v walk → + ∀ {f : E}, Sum.inr f ∈ walk.support → TreeIncidentEdge T f → f ∈ BoundaryEdges G + (TreeSequenceVertexSet T)) → ( + ∀ {p q : PartialEdgeColoring E k} {c d c' d' : Fin k} {u v : V} (walk : + (TwoColorIncidenceGraph G p c d).Walk (Sum.inl u) (Sum.inl v)), TreeExitPath T p c d u v + walk → ( + ∀ {w : V} {f : E}, Sum.inr f ∈ walk.support → Incident G w f → p f = some c ∨ p f = some d → q + f = some c' ∨ q f = some d') → c' ∈ MissingColors G q u ∨ d' ∈ MissingColors G q u → + ∃ (out : (TwoColorIncidenceGraph G q c' d').Walk (Sum.inl u) (Sum.inl v)), TreeExitPath T q c' + d' u v out ∧ out.support = walk.support ∧ out.length = walk.length) → ( + ∀ u ∉ TreeSequenceVertexSet T, alpha ∈ MissingColors G phi u ∨ beta ∈ MissingColors G phi u → + gamma ∈ MissingColors G sigma u ∨ beta ∈ MissingColors G sigma u) → + ∃ (gamma : Fin k) (mu : PartialEdgeColoring E k) (Bminus : TreeSequence G e0) (C : + TreeSequence G e0) (R₁ : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₁) + (Sum.inl b₁)) (R₂ : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₂) (Sum.inl + b₂)) (R₃ : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a₃) (Sum.inl b₃)), gamma + ≠ beta ∧ IsProperEdgeColoring G mu ∧ IsOneEdgeUncolored mu e0 ∧ StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) phi mu ∧ ( + ∀ (e : E), TreeIncidentEdge Bminus e → mu e = phi e) ∧ ( + ∀ v ∈ TreeSequenceVertexSet Bminus, MissingColors G mu v = MissingColors G phi v) ∧ gamma ∉ + (HierarchyStoredColorsAt H (Fin.last H.dividerCount)).biUnion (good.gamma (Fin.last + H.dividerCount)) ∧ gamma ∈ MissingColors G phi b₃ ∧ beta ∈ MissingColors G mu b₃ ∧ mu f₃ = + some gamma ∧ ( + ∀ v ∈ TreeSequenceVertexSet C, + ∀ (eta : Fin k), eta ≠ gamma → eta ≠ beta → (eta ∈ MissingColors G mu v ↔ eta ∈ MissingColors + G phi v)) ∧ TreeExitPath T mu gamma beta a₁ b₁ R₁ ∧ TreeExitPath T mu gamma beta a₂ b₂ R₂ + ∧ TreeExitPath T mu gamma beta a₃ b₃ R₃ ∧ ( + ∀ x ∈ R₁.support, x ∉ R₂.support) ∧ ( + ∀ x ∈ R₁.support, x ∉ R₃.support) ∧ ( + ∀ x ∈ R₂.support, x ∉ R₃.support) ∧ R₁.support = P₁.support ∧ R₂.support = P₂.support ∧ + R₃.support = P₃.support ∧ R₁.length = P₁.length ∧ R₂.length = P₂.length ∧ R₃.length = + P₃.length ∧ TreeSequenceInitialSegment (HierarchyStarredStage H (Fin.last H.dividerCount)) + Bminus ∧ Bminus.length < C.length ∧ TreeSequenceInitialSegment C T ∧ C.vertex (Fin.last + C.length) = b₃ ∧ ( + ∃ (g : E), TreeSequenceAdjoinEdge Bminus g C) ∧ f₁ ∈ BoundaryColorEdges G mu + (TreeSequenceVertexSet C) beta ∧ f₂ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet C) + beta ∧ ( + ∀ (u₁ u₂ : V), Incident G u₁ f₁ → u₁ ∉ TreeSequenceVertexSet C → Incident G u₂ f₂ → u₂ ∉ + TreeSequenceVertexSet C → u₁ ≠ u₂) ∧ b₁ ∈ TreeSequenceVertexSet C ∧ b₂ ∈ + TreeSequenceVertexSet C ∧ b₃ ∈ TreeSequenceVertexSet C + +private theorem helper_continuation_728.{u_1, u_2} : + helperContinuation728Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good alpha beta hne a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ + hP₁ hP₂ hpaths₁₂ hpaths₁₃ hpaths₂₃ f₁ f₂ f₃ hf₁ hf₂ hf₃ hif₁ hif₂ hif₃ hPf₁ hPf₂ hPf₃ A Tn + gamma hgamma hbT hgb hgReserved sigma sigma_fixed sigma_properties missing_of_fixed + sigma_missing incident_vertex_mem_support transfer_exit Q₁ hQ₁ hQs₁ hQl₁ Q₂ hQ₂ hQs₂ hQl₂ + Q₃ hQ₃ hQs₃ hQl₃ i₁ i₂ i₃ hAs hspos hsT Bminus C hAB hCT hBT hTnB hBClen hbC hbNotB hb₁C + hb₂C hb₃C hadjoin J K hgSigma support_closed + have hspan : ∀ x, x ∈ K ↔ x ∈ Q₃.support := by + intro x + constructor + · intro hx + have reach : J.Reachable (Sum.inl b₃) x := by + change J.connectedComponentMk x = J.connectedComponentMk (Sum.inl b₃) at hx + exact (SimpleGraph.ConnectedComponent.eq.mp hx).symm + exact reach.mem_subgraphVerts + (H := (⊤ : J.Subgraph).induce {z | z ∈ Q₃.support}) + (fun z hz y hzy => ⟨hz, support_closed z hz y hzy, hzy⟩) + (by simp) + · intro hx + obtain ⟨i, hi, _⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp + (show x ∈ Q₃.reverse.support by simpa using hx) + change J.connectedComponentMk x = J.connectedComponentMk (Sum.inl b₃) + rw [← hi] + exact (SimpleGraph.ConnectedComponent.sound (Q₃.reverse.take i).reachable).symm + have hKtree : ∀ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ K ↔ v = b₃ := by + intro v hv + exact (hspan (Sum.inl v)).trans (hQ₃.2.2.2.2.2 v hv) + have hKedge : ∀ f, TreeIncidentEdge Bminus f → Sum.inr f ∉ K := by + intro f ⟨v, hv, hvf⟩ hf + have hvs := incident_vertex_mem_support hQ₃.1 ((hspan _).mp hf) hvf + have hvT := TreeSequenceInitialSegmentVertexSetSubset hBT hv + have heq := (hQ₃.2.2.2.2.2 v hvT).mp hvs + exact hbNotB (heq ▸ hv) + let mu := TwoColorComponentSwap G sigma gamma beta (Sum.inl b₃) + have mu_proper : IsProperEdgeColoring G mu := + TwoColorComponentSwapProper G sigma gamma beta hgb sigma_properties.1 _ + have mu_one : IsOneEdgeUncolored mu e0 := by + constructor + · simp [mu, TwoColorComponentSwap, sigma_properties.2.1] + · intro f hfe + obtain ⟨c, hc⟩ := sigma_properties.2.2 f hfe + by_cases hf : Sum.inr f ∈ K + · by_cases ha : sigma f = some gamma + · exact ⟨beta, by simp [mu, TwoColorComponentSwap, K, hf, ha]⟩ + · by_cases hb : sigma f = some beta + · exact ⟨gamma, by simp [mu, TwoColorComponentSwap, K, hf, hb, hgb.symm]⟩ + · refine ⟨c, ?_⟩ + change (if Sum.inr f ∈ K then + if sigma f = some gamma then some beta + else if sigma f = some beta then some gamma else sigma f + else sigma f) = some c + rw [ite_eq_left hf, ite_eq_right ha, ite_eq_right hb] + exact hc + · exact ⟨c, by simp [mu, TwoColorComponentSwap, K, hf, hc]⟩ + have mu_fixed : ∀ f, TreeIncidentEdge Bminus f → mu f = phi f := by + intro f hf + have hnot := hKedge f hf + have hfT : TreeIncidentEdge T f := by + obtain ⟨v, hv, hvf⟩ := hf + exact ⟨v, TreeSequenceInitialSegmentVertexSetSubset hBT hv, hvf⟩ + simpa [mu, TwoColorComponentSwap, K, hnot] using sigma_fixed f hfT + have mu_missing := missing_of_fixed Bminus phi mu mu_fixed + have mu_stable : StableColoring Tn + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi mu := by + constructor + · intro f ⟨v, hv, hvf⟩ _ + exact mu_fixed f ⟨v, TreeSequenceInitialSegmentVertexSetSubset hTnB hv, hvf⟩ + · intro v hv + exact mu_missing v (TreeSequenceInitialSegmentVertexSetSubset hTnB hv) + have swap_missing := TwoColorComponentSwapMissingBehavior G sigma gamma beta hgb + sigma_properties.1 (Sum.inl b₃) + have hbMissing : beta ∈ MissingColors G mu b₃ := + swap_missing.2.1 b₃ (show Sum.inl b₃ ∈ K from rfl) hgSigma + have hsf₃ : sigma f₃ = some beta := + (sigma_fixed f₃ ⟨b₃, hbT, hif₃⟩).trans (Finset.mem_filter.mp hf₃).2 + have hmf₃ : mu f₃ = some gamma := by + have hfK : Sum.inr f₃ ∈ K := (hspan _).mpr (by simpa [hQs₃] using hPf₃) + simp [mu, TwoColorComponentSwap, K, hfK, hsf₃, hgb.symm] + have missing_other : ∀ v ∈ TreeSequenceVertexSet C, ∀ eta, + eta ≠ gamma → eta ≠ beta → + (eta ∈ MissingColors G mu v ↔ eta ∈ MissingColors G phi v) := by + intro v hv eta heg heb + have hother := swap_missing.2.2.2 v eta heg heb + simpa only [sigma_missing v (TreeSequenceInitialSegmentVertexSetSubset hCT hv)] using hother + have second_transfer : + ∀ {u v : V} (walk : J.Walk (Sum.inl u) (Sum.inl v)), TreeExitPath T sigma gamma beta u v walk + → + ∃ out : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl u) (Sum.inl v), TreeExitPath T + mu gamma beta u v out ∧ out.support = walk.support ∧ out.length = walk.length := by + intro u v walk hexit + have hm : gamma ∈ MissingColors G mu u ∨ beta ∈ MissingColors G mu u := by + by_cases hu : Sum.inl u ∈ K + · rcases hexit.2.2.2.2.1 with hg | hb + · exact Or.inr (swap_missing.2.1 u hu hg) + · exact Or.inl (swap_missing.2.2.1 u hu hb) + · have hmiss : MissingColors G mu u = MissingColors G sigma u := swap_missing.1 u hu + rw [hmiss] + exact hexit.2.2.2.2.1 + apply transfer_exit walk hexit _ hm + intro w f _ _ hc + by_cases hf : Sum.inr f ∈ K + · rcases hc with hg | hb + · exact Or.inr (by simp [mu, TwoColorComponentSwap, K, hf, hg]) + · exact Or.inl (by simp [mu, TwoColorComponentSwap, K, hf, hb, hgb.symm]) + · simpa [mu, TwoColorComponentSwap, K, hf] using hc + obtain ⟨R₁, hR₁, hRs₁, hRl₁⟩ := second_transfer Q₁ hQ₁ + obtain ⟨R₂, hR₂, hRs₂, hRl₂⟩ := second_transfer Q₂ hQ₂ + obtain ⟨R₃, hR₃, hRs₃, hRl₃⟩ := second_transfer Q₃ hQ₃ + have sigma_beta : ∀ f, phi f = some beta → sigma f = some beta := by + intro f hf + by_cases ht : TreeIncidentEdge T f + · exact (sigma_fixed f ht).trans hf + · simp [sigma, OutsideTreeColorSwap, ht, hf, hne.symm, hgb.symm] + have hf₁K : Sum.inr f₁ ∉ K := by + intro hfK + have hfP₃ : Sum.inr f₁ ∈ P₃.support := by + simpa only [hQs₃] using (hspan _).mp hfK + exact hpaths₁₃ _ hPf₁ hfP₃ + have hf₂K : Sum.inr f₂ ∉ K := by + intro hfK + have hfP₃ : Sum.inr f₂ ∈ P₃.support := by + simpa only [hQs₃] using (hspan _).mp hfK + exact hpaths₂₃ _ hPf₂ hfP₃ + have boundary_C : ∀ {f : E} {b : V}, + f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → Incident G b f → + b ∈ TreeSequenceVertexSet C → f ∈ BoundaryEdges G (TreeSequenceVertexSet C) := by + intro f b hf hbf hb + obtain ⟨x, hx, y, hy, he⟩ := by simpa [BoundaryEdges] using hf + have hbx : b = x := by + have hbxy : b = x ∨ b = y := by simpa [Incident, he] using hbf + rcases hbxy with h | h + · exact h + · exact False.elim (hy (h ▸ TreeSequenceInitialSegmentVertexSetSubset hCT hb)) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨b, hb, y, fun hyC => hy (TreeSequenceInitialSegmentVertexSetSubset hCT hyC), + by simpa only [hbx] using he⟩ + have hf₁C : f₁ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet C) beta := by + refine Finset.mem_filter.mpr ⟨boundary_C (Finset.mem_filter.mp hf₁).1 hif₁ hb₁C, ?_⟩ + have hc := sigma_beta f₁ (Finset.mem_filter.mp hf₁).2 + simpa [mu, TwoColorComponentSwap, K, hf₁K] using hc + have hf₂C : f₂ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet C) beta := by + refine Finset.mem_filter.mpr ⟨boundary_C (Finset.mem_filter.mp hf₂).1 hif₂ hb₂C, ?_⟩ + have hc := sigma_beta f₂ (Finset.mem_filter.mp hf₂).2 + simpa [mu, TwoColorComponentSwap, K, hf₂K] using hc + have hendpoints : ∀ u₁ u₂, Incident G u₁ f₁ → u₁ ∉ TreeSequenceVertexSet C → + Incident G u₂ f₂ → u₂ ∉ TreeSequenceVertexSet C → u₁ ≠ u₂ := by + intro u₁ u₂ hu₁ _ hu₂ _ heq + have hs₁ := incident_vertex_mem_support hP₁.1 hPf₁ hu₁ + have hs₂ := incident_vertex_mem_support hP₂.1 hPf₂ hu₂ + exact hpaths₁₂ _ hs₁ (heq ▸ hs₂) + refine ⟨gamma, mu, Bminus, C, R₁, R₂, R₃, hgb, mu_proper, mu_one, + mu_stable, mu_fixed, mu_missing, hgReserved, hgamma, hbMissing, hmf₃, + missing_other, hR₁, hR₂, hR₃, ?_, ?_, ?_, + hRs₁.trans hQs₁, hRs₂.trans hQs₂, hRs₃.trans hQs₃, + hRl₁.trans hQl₁, hRl₂.trans hQl₂, hRl₃.trans hQl₃, + hAB, hBClen, hCT, hbC, hadjoin, hf₁C, hf₂C, hendpoints, hb₁C, hb₂C, hb₃C⟩ + · simpa only [hRs₁, hRs₂, hQs₁, hQs₂] using hpaths₁₂ + · simpa only [hRs₁, hRs₃, hQs₁, hQs₃] using hpaths₁₃ + · simpa only [hRs₂, hRs₃, hQs₂, hQs₃] using hpaths₂₃ + +private theorem helper_continuation_431.{u_1, u_2} : + helperContinuation431Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good alpha beta hne a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ + hP₁ hP₂ hP₃ hpaths₁₂ hpaths₁₃ hpaths₂₃ horder₁₂ horder₂₃ f₁ f₂ f₃ hf₁ hf₂ hf₃ hif₁ hif₂ + hif₃ hPf₁ hPf₂ hPf₃ houtside segment_trans A Tn hTnA hAT gamma hgamma hbT hgb hgReserved + no_boundary sigma sigma_fixed sigma_properties missing_of_fixed sigma_missing missing_iff + incident_vertex_mem_support path_boundary transfer_exit sigma_remote_missing + have first_transfer : + ∀ {u v : V} (walk : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath T phi alpha beta u v walk → + ∃ out : (TwoColorIncidenceGraph G sigma gamma beta).Walk (Sum.inl u) (Sum.inl v), TreeExitPath + T sigma gamma beta u v out ∧ out.support = walk.support ∧ out.length = walk.length := by + intro u v walk hexit + apply transfer_exit walk hexit _ + (sigma_remote_missing u hexit.2.2.1 hexit.2.2.2.2.1) + intro w f hf hwf hc + rcases hc with ha | hb + · have ht : ¬ TreeIncidentEdge T f := fun ht => + (no_boundary (path_boundary hexit hf ht)).1 ha + exact Or.inl (by simp [sigma, OutsideTreeColorSwap, ht, ha]) + · by_cases ht : TreeIncidentEdge T f + · exact Or.inr ((sigma_fixed f ht).trans hb) + · exact Or.inr (by simp [sigma, OutsideTreeColorSwap, ht, hb, hne.symm, hgb.symm]) + obtain ⟨Q₁, hQ₁, hQs₁, hQl₁⟩ := first_transfer P₁ hP₁ + obtain ⟨Q₂, hQ₂, hQs₂, hQl₂⟩ := first_transfer P₂ hP₂ + obtain ⟨Q₃, hQ₃, hQs₃, hQl₃⟩ := first_transfer P₃ hP₃ + obtain ⟨i₁, i₂, hi₁, hi₂, hi₁₂⟩ := horder₁₂ + obtain ⟨j₂, i₃, hj₂, hi₃, hi₂₃⟩ := horder₂₃ + have hj : j₂ = i₂ := T.vertex_injective (hj₂.trans hi₂.symm) + subst j₂ + have hAs : A.length < i₃.val := by + by_contra h + have hiA : i₃.val ≤ A.length := by omega + let r : Fin (A.length + 1) := ⟨i₃.val, by omega⟩ + have hr : Fin.castLE (Nat.succ_le_succ hAT.1) r = i₃ := Fin.ext rfl + have hv : A.vertex r = b₃ := by rw [← hAT.2.1 r, hr, hi₃] + apply houtside + change b₃ ∈ TreeSequenceVertexSet A + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨r, hv⟩ + have hspos : 1 ≤ i₃.val - 1 := by have := A.positive; omega + have hsT : i₃.val ≤ T.length := Nat.le_of_lt_succ i₃.isLt + let Bminus := TreeSequencePrefix T (i₃.val - 1) hspos (by omega) + let C := TreeSequencePrefix T i₃.val (by omega) hsT + have hAB : TreeSequenceInitialSegment A Bminus := by + refine ⟨by simpa [Bminus, TreeSequencePrefix] using (show A.length ≤ i₃.val - 1 by omega), + ?_, ?_⟩ + · intro i + change T.vertex (Fin.castLE _ (Fin.castLE _ i)) = A.vertex i + exact hAT.2.1 i + · intro i + change T.edge (Fin.castLE _ (Fin.castLE _ i)) = A.edge i + exact hAT.2.2 i + have hBC : TreeSequenceInitialSegment Bminus C := by + refine ⟨by simp [Bminus, C, TreeSequencePrefix], ?_, ?_⟩ + · intro i; rfl + · intro i; rfl + have hCT : TreeSequenceInitialSegment C T := ⟨hsT, fun _ => rfl, fun _ => rfl⟩ + have hBT := segment_trans hBC hCT + have hTnB := segment_trans hTnA hAB + have hBClen : Bminus.length < C.length := by + simp only [Bminus, C, TreeSequencePrefix] + omega + have hbC : C.vertex (Fin.last C.length) = b₃ := by + change T.vertex ⟨i₃.val, _⟩ = b₃ + exact hi₃ + have hbNotB : b₃ ∉ TreeSequenceVertexSet Bminus := by + intro hb + obtain ⟨r, hr⟩ := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hb + have heq := T.vertex_injective ((hBT.2.1 r).trans (hr.trans hi₃.symm)) + have hv := congrArg Fin.val heq + have hrl := r.isLt + change r.val < i₃.val - 1 + 1 at hrl + simp only [Fin.val_castLE] at hv + omega + have hb₁C : b₁ ∈ TreeSequenceVertexSet C := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i₁.val, by change i₁.val < i₃.val + 1; omega⟩, hi₁⟩ + have hb₂C : b₂ ∈ TreeSequenceVertexSet C := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i₂.val, by change i₂.val < i₃.val + 1; omega⟩, hi₂⟩ + have hb₃C : b₃ ∈ TreeSequenceVertexSet C := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last C.length, hbC⟩ + have hadjoin : ∃ g, TreeSequenceAdjoinEdge Bminus g C := by + have hlen : C.length = Bminus.length + 1 := by + simp only [Bminus, C, TreeSequencePrefix] + omega + exact ⟨C.edge (Fin.cast hlen.symm (Fin.last Bminus.length)), hlen, hBC, rfl⟩ + let J := TwoColorIncidenceGraph G sigma gamma beta + let K := TwoColorComponent G sigma gamma beta (Sum.inl b₃) + have hgSigma : gamma ∈ MissingColors G sigma b₃ := by + rw [sigma_missing b₃ hbT] + exact hgamma + have leaf : ∀ v, gamma ∈ MissingColors G sigma v ∨ beta ∈ MissingColors G sigma v → + (J.neighborSet (Sum.inl v)).Subsingleton := by + intro v hm x hx y hy + cases x with + | inl w => exact False.elim hx + | inr e => + cases y with + | inl w => exact False.elim hy + | inr f => + have he : Incident G v e ∧ (sigma e = some gamma ∨ sigma e = some beta) := hx + have hf : Incident G v f ∧ (sigma f = some gamma ∨ sigma f = some beta) := hy + have hsame : e = f := by + by_contra hef + rcases hm with hm | hm + · have hec := he.2.resolve_left ((missing_iff sigma v gamma).mp hm e he.1) + have hfc := hf.2.resolve_left ((missing_iff sigma v gamma).mp hm f hf.1) + exact sigma_properties.1 hef ⟨v, he.1, hf.1⟩ hec hfc + · have hec := he.2.resolve_right ((missing_iff sigma v beta).mp hm e he.1) + have hfc := hf.2.resolve_right ((missing_iff sigma v beta).mp hm f hf.1) + exact sigma_properties.1 hef ⟨v, he.1, hf.1⟩ hec hfc + exact congrArg Sum.inr hsame + have support_closed : ∀ x, x ∈ Q₃.support → ∀ y, J.Adj x y → y ∈ Q₃.support := by + intro x hx y hxy + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hx + by_cases hn0 : n = 0 + · subst n + have hx0 : x = Sum.inl a₃ := by simpa using hn.symm + have ha : J.Adj (Sum.inl a₃) (Q₃.getVert 1) := by + simpa using Q₃.adj_getVert_succ (i := 0) (by have := hQ₃.2.1; omega) + have heq : y = Q₃.getVert 1 := (leaf a₃ hQ₃.2.2.2.2.1) + (by simpa [hx0] using hxy) ha + rw [heq] + exact Q₃.getVert_mem_support _ + by_cases hlast : n = Q₃.length + · have hx1 : x = Sum.inl b₃ := by + rw [← hn, hQ₃.1.getVert_eq_end_iff hnle] + exact hlast + have ha : J.Adj (Sum.inl b₃) (Q₃.getVert (Q₃.length - 1)) := by + simpa [show Q₃.length - 1 + 1 = Q₃.length by have := hQ₃.2.1; omega] using + (Q₃.adj_getVert_succ (show Q₃.length - 1 < Q₃.length by + have := hQ₃.2.1; omega)).symm + have heq : y = Q₃.getVert (Q₃.length - 1) := (leaf b₃ (Or.inl hgSigma)) + (by simpa [hx1] using hxy) ha + rw [heq] + exact Q₃.getVert_mem_support _ + have hl : J.Adj (Q₃.getVert n) (Q₃.getVert (n - 1)) := by + rw [← show n - 1 + 1 = n by omega] + exact (Q₃.adj_getVert_succ (by omega)).symm + have hr := Q₃.adj_getVert_succ (show n < Q₃.length by omega) + by_contra hyout + rw [← hn] at hxy + have hnl : Q₃.getVert (n - 1) ≠ y := by + intro h + exact hyout (h ▸ Q₃.getVert_mem_support (n - 1)) + have hnr : Q₃.getVert (n + 1) ≠ y := by + intro h + exact hyout (h ▸ Q₃.getVert_mem_support (n + 1)) + have hnp : Q₃.getVert (n - 1) ≠ Q₃.getVert (n + 1) := by + intro h + have hi := hQ₃.1.getVert_injOn + (show n - 1 ≤ Q₃.length by omega) (show n + 1 ≤ Q₃.length by omega) h + omega + let : Fintype (J.neighborSet (Q₃.getVert n)) := Fintype.ofFinite _ + have three : 3 ≤ J.degree (Q₃.getVert n) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset _ := {y, Q₃.getVert (n - 1), Q₃.getVert (n + 1)} + have hs : s ⊆ J.neighborFinset (Q₃.getVert n) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hxy + · simpa [SimpleGraph.mem_neighborFinset] using hl + · simpa [SimpleGraph.mem_neighborFinset] using hr + have hc : 3 ≤ s.card := by + simp [s, hnp, hnl.symm, hnr.symm] + exact hc.trans (Finset.card_le_card hs) + have upper : J.degree (Q₃.getVert n) ≤ 2 := + TwoColorIncidenceDegreeAtMostTwo G sigma gamma beta sigma_properties.1 _ + omega + exact @helper_continuation_728 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@good) (@alpha) + (@beta) (@hne) (@a₁) (@b₁) (@a₂) (@b₂) (@a₃) (@b₃) (@P₁) (@P₂) (@P₃) (@hP₁) (@hP₂) + (@hpaths₁₂) (@hpaths₁₃) (@hpaths₂₃) (@f₁) (@f₂) (@f₃) (@hf₁) (@hf₂) (@hf₃) (@hif₁) (@hif₂) + (@hif₃) (@hPf₁) (@hPf₂) (@hPf₃) (@gamma) (@hgamma) (@hbT) (@hgb) (@hgReserved) + (@sigma_fixed) (@sigma_properties) (@missing_of_fixed) (@sigma_missing) + (@incident_vertex_mem_support) (@transfer_exit) (@Q₁) (@hQ₁) (@hQs₁) (@hQl₁) (@Q₂) (@hQ₂) + (@hQs₂) (@hQl₂) (@Q₃) (@hQ₃) (@hQs₃) (@hQl₃) (@i₁) (@i₂) (@i₃) (@hAs) (@hspos) (@hsT) + (@hAB) (@hCT) (@hBT) (@hTnB) (@hBClen) (@hbC) (@hbNotB) (@hb₁C) (@hb₂C) (@hb₃C) (@hadjoin) + (@hgSigma) (@support_closed) +private theorem helper_continuation_386.{u_1, u_2} : + helperContinuation386Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H good alpha beta hne a₁ b₁ a₂ b₂ a₃ b₃ P₁ P₂ P₃ + hP₁ hP₂ hP₃ hpaths₁₂ hpaths₁₃ hpaths₂₃ horder₁₂ horder₂₃ f₁ f₂ f₃ hf₁ hf₂ hf₃ hif₁ hif₂ + hif₃ hPf₁ hPf₂ hPf₃ houtside segment_trans A Tn hTnA hAT gamma hgamma hbT hgb hgReserved + no_boundary ends_eq_of_mem boundary_of_outside sigma sigma_fixed sigma_properties + have missing_of_fixed : ∀ (W : TreeSequence G e0) + (p q : PartialEdgeColoring E k), + (∀ f, TreeIncidentEdge W f → q f = p f) → + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G q v = MissingColors G p v := by + intro W p q hfixed v hv + unfold MissingColors PresentColors + congr 1 + ext c + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + constructor <;> rintro ⟨f, hvf, hfc⟩ + · exact ⟨f, hvf, (hfixed f ⟨v, hv, hvf⟩).symm.trans hfc⟩ + · exact ⟨f, hvf, (hfixed f ⟨v, hv, hvf⟩).trans hfc⟩ + have sigma_missing := missing_of_fixed T phi sigma sigma_fixed + have missing_iff : ∀ (p : PartialEdgeColoring E k) (v : V) (c : Fin k), + c ∈ MissingColors G p v ↔ ∀ f, Incident G v f → p f ≠ some c := by + intro p v c + simp [MissingColors, PresentColors] + have incident_vertex_mem_support : + ∀ {p : PartialEdgeColoring E k} {c d : Fin k} {u v : V} + {walk : (TwoColorIncidenceGraph G p c d).Walk (Sum.inl u) (Sum.inl v)} + {f : E} {x : V}, walk.IsPath → Sum.inr f ∈ walk.support → + Incident G x f → Sum.inl x ∈ walk.support := by + intro p c d u v walk f x hp hf hxf + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hnpos : 0 < n := by + by_contra h + have hnzero : n = 0 := by omega + rw [hnzero] at hn + simp at hn + have hnlt : n < walk.length := by + by_contra h + have hneq : n = walk.length := by omega + rw [hneq] at hn + simp at hn + have hprev := walk.adj_getVert_succ (i := n - 1) (by omega) + have hnext := walk.adj_getVert_succ (i := n) hnlt + rw [show n - 1 + 1 = n by omega, hn] at hprev + rw [hn] at hnext + cases hpreveq : walk.getVert (n - 1) with + | inr g => + rw [hpreveq] at hprev + simp [TwoColorIncidenceGraph] at hprev + | inl y => + rw [hpreveq] at hprev + cases hnexteq : walk.getVert (n + 1) with + | inr g => + rw [hnexteq] at hnext + simp [TwoColorIncidenceGraph] at hnext + | inl z => + rw [hnexteq] at hnext + have hyz : y ≠ z := by + intro hyz + have hverts : walk.getVert (n - 1) = walk.getVert (n + 1) := by + rw [hpreveq, hnexteq, hyz] + have hidx := hp.getVert_injOn + (show n - 1 ≤ walk.length by omega) + (show n + 1 ≤ walk.length by omega) hverts + omega + have hends : G.ends f = s(y, z) := ends_eq_of_mem hprev.1 hnext.1 hyz + rw [Incident, hends] at hxf + have hx : x = y ∨ x = z := by simpa using hxf + rcases hx with rfl | rfl + · rw [← hpreveq] + exact walk.getVert_mem_support _ + · rw [← hnexteq] + exact walk.getVert_mem_support _ + have path_boundary : ∀ {u v : V} + {walk : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)}, + TreeExitPath T phi alpha beta u v walk → ∀ {f : E}, + Sum.inr f ∈ walk.support → TreeIncidentEdge T f → + f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + intro u v walk hexit f hf ⟨x, hx, hxf⟩ + have unique : ∀ y, Incident G y f → y ∈ TreeSequenceVertexSet T → y = v := by + intro y hyf hy + exact (hexit.2.2.2.2.2 y hy).mp (incident_vertex_mem_support hexit.1 hf hyf) + obtain ⟨y, z, he⟩ : ∃ y z, G.ends f = s(y, z) := by + generalize G.ends f = s + induction s using Sym2.inductionOn with + | _ y z => exact ⟨y, z, rfl⟩ + have hyf : Incident G y f := by simp [Incident, he] + have hzf : Incident G z f := by simp [Incident, he] + have hyz : y ≠ z := by intro h; exact G.loopless f z (by simpa [h] using he) + have hxends : x = y ∨ x = z := by simpa [Incident, he] using hxf + rcases hxends with rfl | rfl + · apply boundary_of_outside (v := z) (f := f) _ hzf ⟨x, hx, hyf⟩ + intro hz + exact hyz ((unique x hyf hx).trans (unique z hzf hz).symm) + · apply boundary_of_outside (v := y) (f := f) _ hyf ⟨x, hx, hzf⟩ + intro hy + exact hyz ((unique y hyf hy).trans (unique x hzf hx).symm) + have transfer_exit : + ∀ {p q : PartialEdgeColoring E k} {c d c' d' : Fin k} {u v : V} (walk : + (TwoColorIncidenceGraph G p c d).Walk (Sum.inl u) (Sum.inl v)), TreeExitPath T p c d u v + walk → ( + ∀ {w : V} {f : E}, Sum.inr f ∈ walk.support → Incident G w f → (p f = some c ∨ p f = some d) → + q f = some c' ∨ q f = some d') → (c' ∈ MissingColors G q u ∨ d' ∈ MissingColors G q u) → + ∃ out : (TwoColorIncidenceGraph G q c' d').Walk (Sum.inl u) (Sum.inl v), TreeExitPath T q c' + d' u v out ∧ out.support = walk.support ∧ out.length = walk.length := by + intro p q c d c' d' u v walk hexit hcolor hmissing + have hedges : ∀ z, z ∈ walk.edges → z ∈ (TwoColorIncidenceGraph G q c' d').edgeSet := by + intro z hz + induction z using Sym2.inductionOn with + | _ x y => + have hadj := (SimpleGraph.mem_edgeSet _).mp (walk.edges_subset_edgeSet hz) + have hx := walk.fst_mem_support_of_mem_edges hz + have hy := walk.snd_mem_support_of_mem_edges hz + apply (SimpleGraph.mem_edgeSet _).mpr + cases x with + | inl w => + cases y with + | inl v => exact False.elim hadj + | inr f => exact ⟨hadj.1, hcolor hy hadj.1 hadj.2⟩ + | inr f => + cases y with + | inr g => exact False.elim hadj + | inl w => exact ⟨hadj.1, hcolor hx hadj.1 hadj.2⟩ + let out := walk.transfer (TwoColorIncidenceGraph G q c' d') hedges + refine ⟨out, ?_, by simp [out], by simp [out]⟩ + refine ⟨hexit.1.transfer hedges, by simpa [out] using hexit.2.1, + hexit.2.2.1, hexit.2.2.2.1, hmissing, ?_⟩ + intro w hw + simpa [out] using hexit.2.2.2.2.2 w hw + have sigma_remote_missing : ∀ u, u ∉ TreeSequenceVertexSet T → + (alpha ∈ MissingColors G phi u ∨ beta ∈ MissingColors G phi u) → + gamma ∈ MissingColors G sigma u ∨ beta ∈ MissingColors G sigma u := by + intro u hu hm + rcases hm with hm | hm + · left + apply (missing_iff sigma u gamma).mpr + intro f huf hsf + by_cases ht : TreeIncidentEdge T f + · exact (no_boundary (boundary_of_outside hu huf ht)).2 + ((sigma_fixed f ht).symm.trans hsf) + · have hnot : phi f ≠ some alpha := (missing_iff phi u alpha).mp hm f huf + by_cases hg : phi f = some gamma + · have hag : alpha ≠ gamma := by intro h; exact hnot (by simpa [h] using hg) + have hbad : alpha = gamma := by + simpa [sigma, OutsideTreeColorSwap, ht, hnot, hg, hag.symm] using hsf + exact hag hbad + · have hbad : phi f = some gamma := by + simp [sigma, OutsideTreeColorSwap, ht, hnot, hg] at hsf + exact hg hbad + · right + apply (missing_iff sigma u beta).mpr + intro f huf hsf + have hnot := (missing_iff phi u beta).mp hm f huf + by_cases ht : TreeIncidentEdge T f + · exact hnot ((sigma_fixed f ht).symm.trans hsf) + · by_cases ha : phi f = some alpha + · exact hgb (by simpa [sigma, OutsideTreeColorSwap, ht, ha] using hsf) + · by_cases hg : phi f = some gamma + · have hag : gamma ≠ alpha := by intro h; exact ha (by simpa [h] using hg) + exact hne (by simpa [sigma, OutsideTreeColorSwap, ht, ha, hg, hag] using hsf) + · exact hnot (by simpa [sigma, OutsideTreeColorSwap, ht, ha, hg] using hsf) + exact @helper_continuation_431 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@good) (@alpha) + (@beta) (@hne) (@a₁) (@b₁) (@a₂) (@b₂) (@a₃) (@b₃) (@P₁) (@P₂) (@P₃) (@hP₁) (@hP₂) (@hP₃) + (@hpaths₁₂) (@hpaths₁₃) (@hpaths₂₃) (@horder₁₂) (@horder₂₃) (@f₁) (@f₂) (@f₃) (@hf₁) (@hf₂) + (@hf₃) (@hif₁) (@hif₂) (@hif₃) (@hPf₁) (@hPf₂) (@hPf₃) (@houtside) (@segment_trans) (@hTnA) + (@hAT) (@gamma) (@hgamma) (@hbT) (@hgb) (@hgReserved) (@no_boundary) (@sigma_fixed) + (@sigma_properties) (@missing_of_fixed) (@sigma_missing) (@missing_iff) + (@incident_vertex_mem_support) (@path_boundary) (@transfer_exit) (@sigma_remote_missing) +private theorem helper_sigma_properties_1696.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → + ∀ (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base) (alpha gamma : Fin k), ( + ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → phi f ≠ some alpha ∧ phi f ≠ some + gamma) → ( + ∀ {v : V} {f : E}, v ∉ TreeSequenceVertexSet T → Incident G v f → TreeIncidentEdge T f → f ∈ + BoundaryEdges G (TreeSequenceVertexSet T)) → + let sigma : PartialEdgeColoring E k := OutsideTreeColorSwap T phi alpha gamma; + IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hproper hone base H alpha gamma no_boundary + boundary_of_outside sigma + by_cases hag : alpha = gamma + · have hs : sigma = phi := by + funext f + by_cases ht : TreeIncidentEdge T f + · simp [sigma, OutsideTreeColorSwap, ht] + · by_cases ha : phi f = some alpha <;> + simp [sigma, OutsideTreeColorSwap, ht, ← hag, ha] + simpa only [hs] using And.intro hproper hone + · let J := TwoColorIncidenceGraph G phi alpha gamma + let S : Set (Sum V E) := {z | match z with + | Sum.inl v => v ∉ TreeSequenceVertexSet T + | Sum.inr f => ¬ TreeIncidentEdge T f} + have hstep : ∀ x, x ∈ S → ∀ y, J.Adj x y → y ∈ S := by + intro x hx y hxy + cases x with + | inl v => + cases y with + | inl w => exact False.elim hxy + | inr f => + intro ht + have hb := no_boundary (boundary_of_outside hx hxy.1 ht) + exact hxy.2.elim hb.1 hb.2 + | inr f => + cases y with + | inr g => exact False.elim hxy + | inl v => exact fun hv => hx ⟨v, hv, hxy.1⟩ + let roots : Finset (Sum V E) := Finset.univ.filter fun z => + match z with + | Sum.inl v => v ∉ TreeSequenceVertexSet T + | Sum.inr _ => False + have hout : ∀ z ∈ roots, ∀ v : V, + Sum.inl v ∈ TwoColorComponent G phi alpha gamma z → + v ∉ TreeSequenceVertexSet T := by + intro z hz v hv + have hzS : z ∈ S := by + cases z with + | inl w => simpa [roots, S] using hz + | inr f => exact False.elim (by simpa [roots] using hz) + have hr : J.Reachable z (Sum.inl v) := by + change J.connectedComponentMk (Sum.inl v) = J.connectedComponentMk z at hv + exact (SimpleGraph.ConnectedComponent.eq.mp hv).symm + exact hr.mem_subgraphVerts + (H := (⊤ : J.Subgraph).induce S) + (fun x hx y hxy => ⟨hx, hstep x hx y hxy, hxy⟩) hzS + have selected : ∀ {f : E}, ¬ TreeIncidentEdge T f → + (phi f = some alpha ∨ phi f = some gamma) → + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha gamma z := by + intro f ht hc + obtain ⟨v, hv⟩ : ∃ v, Incident G v f := by + change ∃ v, v ∈ G.ends f + generalize G.ends f = z + induction z using Sym2.inductionOn with + | _ x y => exact ⟨x, by simp⟩ + have hvout : v ∉ TreeSequenceVertexSet T := fun h => ht ⟨v, h, hv⟩ + refine ⟨Sum.inl v, by simp [roots, hvout], ?_⟩ + have hadj : J.Adj (Sum.inl v) (Sum.inr f) := ⟨hv, hc⟩ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).symm + have selected_not_tree : ∀ {f : E}, + (∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha gamma z) → + (phi f = some alpha ∨ phi f = some gamma) → ¬ TreeIncidentEdge T f := by + intro f ⟨z, hz, hzf⟩ hc ⟨v, hv, hvf⟩ + have hadj : J.Adj (Sum.inl v) (Sum.inr f) := ⟨hvf, hc⟩ + have hvc : Sum.inl v ∈ TwoColorComponent G phi alpha gamma z := + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hzf + exact hout z hz v hvc hv + have hrec : OutsideKempeRecoloring T phi sigma alpha gamma := by + refine ⟨hag, roots, hout, ?_⟩ + intro f + by_cases ht : TreeIncidentEdge T f + · by_cases hr : ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha gamma z + · have ha : phi f ≠ some alpha := fun ha => + selected_not_tree hr (Or.inl ha) ht + have hg : phi f ≠ some gamma := fun hg => + selected_not_tree hr (Or.inr hg) ht + simp [sigma, OutsideTreeColorSwap, ht, hr, ha, hg] + · simp [sigma, OutsideTreeColorSwap, ht, hr] + · by_cases hr : ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha gamma z + · simp [sigma, OutsideTreeColorSwap, ht, hr] + · have ha : phi f ≠ some alpha := fun ha => hr (selected ht (Or.inl ha)) + have hg : phi f ≠ some gamma := fun hg => hr (selected ht (Or.inr hg)) + simp [sigma, OutsideTreeColorSwap, ht, hr, ha, hg] + have hs := OutsideKempeRecoloringStable G e0 T ∅ phi sigma alpha gamma + hproper hone hrec + exact ⟨hs.1, hs.2.1⟩ + +lemma Step1CaseTwoOutsideRecoloredPrefix {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (hterminal : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (hElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (hbeta : beta ∉ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ a₃ b₃ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₃) (Sum.inl b₃)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hP₃ : TreeExitPath T phi alpha beta a₃ b₃ P₃) + (hpaths₁₂ : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (hpaths₁₃ : ∀ x, x ∈ P₁.support → x ∉ P₃.support) + (hpaths₂₃ : ∀ x, x ∈ P₂.support → x ∉ P₃.support) + (_ : a₁ ≠ a₂) (_ : a₁ ≠ a₃) (_ : a₂ ≠ a₃) + (_ : b₁ ≠ b₂) (_ : b₁ ≠ b₃) (_ : b₂ ≠ b₃) + (horder₁₂ : TreeVertexOrder T b₁ b₂) + (horder₂₃ : TreeVertexOrder T b₂ b₃) + (f₁ f₂ f₃ : E) + (hf₁ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₂ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₃ : f₃ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hif₁ : Incident G b₁ f₁) (hif₂ : Incident G b₂ f₂) + (hif₃ : Incident G b₃ f₃) + (hPf₁ : Sum.inr f₁ ∈ P₁.support) + (hPf₂ : Sum.inr f₂ ∈ P₂.support) + (hPf₃ : Sum.inr f₃ ∈ P₃.support) + (houtside : b₃ ∉ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) : + ∃ (gamma : Fin k) (mu : PartialEdgeColoring E k) + (Bminus C : TreeSequence G e0) + (R₁ : (TwoColorIncidenceGraph G mu gamma beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (R₂ : (TwoColorIncidenceGraph G mu gamma beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (R₃ : (TwoColorIncidenceGraph G mu gamma beta).Walk + (Sum.inl a₃) (Sum.inl b₃)), + gamma ≠ beta ∧ + IsProperEdgeColoring G mu ∧ IsOneEdgeUncolored mu e0 ∧ + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi mu ∧ + (∀ e, TreeIncidentEdge Bminus e → mu e = phi e) ∧ + (∀ v, v ∈ TreeSequenceVertexSet Bminus → + MissingColors G mu v = MissingColors G phi v) ∧ + gamma ∉ (HierarchyStoredColorsAt H + (Fin.last H.dividerCount)).biUnion + (good.gamma (Fin.last H.dividerCount)) ∧ + gamma ∈ MissingColors G phi b₃ ∧ + beta ∈ MissingColors G mu b₃ ∧ + mu f₃ = some gamma ∧ + (∀ v, v ∈ TreeSequenceVertexSet C → ∀ eta, + eta ≠ gamma → eta ≠ beta → + (eta ∈ MissingColors G mu v ↔ eta ∈ MissingColors G phi v)) ∧ + TreeExitPath T mu gamma beta a₁ b₁ R₁ ∧ + TreeExitPath T mu gamma beta a₂ b₂ R₂ ∧ + TreeExitPath T mu gamma beta a₃ b₃ R₃ ∧ + (∀ x, x ∈ R₁.support → x ∉ R₂.support) ∧ + (∀ x, x ∈ R₁.support → x ∉ R₃.support) ∧ + (∀ x, x ∈ R₂.support → x ∉ R₃.support) ∧ + R₁.support = P₁.support ∧ R₂.support = P₂.support ∧ + R₃.support = P₃.support ∧ + R₁.length = P₁.length ∧ R₂.length = P₂.length ∧ + R₃.length = P₃.length ∧ + TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) Bminus ∧ + Bminus.length < C.length ∧ TreeSequenceInitialSegment C T ∧ + C.vertex (Fin.last C.length) = b₃ ∧ + (∃ g, TreeSequenceAdjoinEdge Bminus g C) ∧ + f₁ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet C) beta ∧ + f₂ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet C) beta ∧ + (∀ u₁ u₂, Incident G u₁ f₁ → + u₁ ∉ TreeSequenceVertexSet C → Incident G u₂ f₂ → + u₂ ∉ TreeSequenceVertexSet C → u₁ ≠ u₂) ∧ + b₁ ∈ TreeSequenceVertexSet C ∧ + b₂ ∈ TreeSequenceVertexSet C ∧ + b₃ ∈ TreeSequenceVertexSet C := by + classical + have segment_trans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + refine ⟨hAB.1.trans hBC.1, ?_, ?_⟩ + · intro i + exact (hBC.2.1 (Fin.castLE (Nat.succ_le_succ hAB.1) i)).trans + (hAB.2.1 i) + · intro i + exact (hBC.2.2 (Fin.castLE hAB.1 i)).trans (hAB.2.2 i) + have stage_segment : ∀ (i j : Fin (H.dividerCount + 2)), i ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage j) := by + intro i j hij + have aux : ∀ n (hn : n < H.dividerCount + 2), i.val ≤ n → + TreeSequenceInitialSegment (H.stage i) (H.stage ⟨n, hn⟩) := by + intro n + induction n with + | zero => + intro hn hi + have heq : i = ⟨0, hn⟩ := by + apply Fin.ext + change i.val = 0 + omega + rw [heq] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ n ih => + intro hn hi + by_cases heq : i.val = n + 1 + · have heq' : i = ⟨n + 1, hn⟩ := Fin.ext heq + rw [heq'] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact segment_trans (ih (by omega) (by omega)) + (H.nested ⟨n, by omega⟩) + exact aux j.val j.isLt hij + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let Tn := ett.series.data.tree (Fin.last ett.rounds).castSucc + have hTncore : TreeSequenceInitialSegment Tn base.core := by + by_cases hp : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨u⟩⟩ := base.parallel hp + exact u.leftSegment + · rw [base.nonparallel hp] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have hTnA : TreeSequenceInitialSegment Tn A := by + by_cases hz : H.dividerCount = 0 + · have hl : Fin.last H.dividerCount = (0 : Fin (H.dividerCount + 1)) := + Fin.ext (by simp [hz]) + simpa [A, hl, HierarchyStarredStage] using hTncore + · let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hl : Fin.last H.dividerCount = i.succ := Fin.ext (by simp [i]; omega) + have hs : A = H.stage i.succ.castSucc := by + simp [A, hl, HierarchyStarredStage] + have hh := stage_segment (0 : Fin (H.dividerCount + 2)) + i.succ.castSucc (by simp) + simpa only [H.baseStage, ← hs] using hh + have hAT : TreeSequenceInitialSegment A T := by + by_cases hz : H.dividerCount = 0 + · have hl : Fin.last H.dividerCount = (0 : Fin (H.dividerCount + 1)) := + Fin.ext (by simp [hz]) + have ht : (1 : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := Fin.ext (by simp [hz]) + simpa [A, hl, HierarchyStarredStage, ht, H.terminalStage] using H.coreInsideFirst + · let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have hl : Fin.last H.dividerCount = i.succ := Fin.ext (by simp [i]; omega) + have hs : A = H.stage i.succ.castSucc := by + simp [A, hl, HierarchyStarredStage] + have hh := stage_segment i.succ.castSucc (Fin.last (H.dividerCount + 1)) + (by change i.val + 1 ≤ H.dividerCount + 1; omega) + simpa only [H.terminalStage, ← hs] using hh + have hdegree : MaximumDegree G + 1 ≤ k := by + have hinit := ett.series.certified 0 + cases hinit with + | initial triple => exact triple.2.2.1 + obtain ⟨gamma, hgamma⟩ := MissingColorsNonemptyOfMaximumDegree G phi hdegree b₃ + have hbT : b₃ ∈ TreeSequenceVertexSet T := hP₃.2.2.2.1 + have hgT : gamma ∈ TreeMissingColors phi T := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨b₃, hbT, hgamma⟩ + have hgb : gamma ≠ beta := by + intro h + exact hbeta (h ▸ hgT) + have hgReserved : gamma ∉ (HierarchyStoredColorsAt H + (Fin.last H.dividerCount)).biUnion (good.gamma (Fin.last H.dividerCount)) := by + intro hg + obtain ⟨eta, heta, hge⟩ := Finset.mem_biUnion.mp hg + have hgm := (GoodHierarchyReservedDisjoint good (Fin.last H.dividerCount)).1 + eta heta hge + obtain ⟨v, hvA, hgv⟩ := Finset.mem_biUnion.mp hgm + have hvT := TreeSequenceInitialSegmentVertexSetSubset hAT hvA + have hvb : v ≠ b₃ := by + intro h + exact houtside (h ▸ hvA) + exact (Finset.disjoint_left.mp (hElementary hvT hbT hvb)) hgv hgamma + have hgTerminal : gamma ∉ (HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)) := by + intro hg + obtain ⟨eta, heta, hge⟩ := Finset.mem_biUnion.mp hg + exact hgReserved (Finset.mem_biUnion.mpr ⟨eta, + (HierarchyTerminalStoredColorsSubsetLast H).1 heta, hge⟩) + have no_boundary : ∀ {f : E}, f ∈ BoundaryEdges G (TreeSequenceVertexSet T) → + phi f ≠ some alpha ∧ phi f ≠ some gamma := by + intro f hf + constructor + · intro hc + have hm : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha := + Finset.mem_filter.mpr ⟨hf, hc⟩ + rw [hclosed alpha (by simp)] at hm + exact Finset.notMem_empty _ hm + · intro hc + have hm : f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) gamma := + Finset.mem_filter.mpr ⟨hf, hc⟩ + rw [hterminal gamma (Finset.mem_sdiff.mpr ⟨hgT, hgTerminal⟩)] at hm + exact Finset.notMem_empty _ hm + have ends_eq_of_mem : ∀ {z : Sym2 V} {x y : V}, + x ∈ z → y ∈ z → x ≠ y → z = s(x, y) := by + intro z x y hx hy hxy + induction z using Sym2.inductionOn with + | _ a b => + simp only [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> + simp_all [] + have boundary_of_outside : ∀ {v : V} {f : E}, + v ∉ TreeSequenceVertexSet T → Incident G v f → TreeIncidentEdge T f → + f ∈ BoundaryEdges G (TreeSequenceVertexSet T) := by + intro v f hv hvf ⟨w, hw, hwf⟩ + have hwv : w ≠ v := by intro h; exact hv (h ▸ hw) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hw, v, hv, ends_eq_of_mem hwf hvf hwv⟩ + let sigma := OutsideTreeColorSwap T phi alpha gamma + have sigma_fixed : ∀ f, TreeIncidentEdge T f → sigma f = phi f := by + intro f hf + simp [sigma, OutsideTreeColorSwap, hf] + have sigma_properties := @helper_sigma_properties_1696 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hproper) (@hone) + (@base) (@H) (@alpha) (@gamma) (@no_boundary) (@boundary_of_outside) + exact @helper_continuation_386 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@good) (@alpha) + (@beta) (@hne) (@a₁) (@b₁) (@a₂) (@b₂) (@a₃) (@b₃) (@P₁) (@P₂) (@P₃) (@hP₁) (@hP₂) (@hP₃) + (@hpaths₁₂) (@hpaths₁₃) (@hpaths₂₃) (@horder₁₂) (@horder₂₃) (@f₁) (@f₂) (@f₃) (@hf₁) (@hf₂) + (@hf₃) (@hif₁) (@hif₂) (@hif₃) (@hPf₁) (@hPf₂) (@hPf₃) (@houtside) (@segment_trans) (@hTnA) + (@hAT) (@gamma) (@hgamma) (@hbT) (@hgb) (@hgReserved) (@no_boundary) (@ends_eq_of_mem) + (@boundary_of_outside) (@sigma_fixed) (@sigma_properties) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRestrictedAugmentation.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRestrictedAugmentation.lean new file mode 100644 index 0000000000..d94f2b1dd0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRestrictedAugmentation.lean @@ -0,0 +1,364 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedAugmentation +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.ElementaryEndpointExclusion +public import LeanPool.GoldbergSeymour.FirstEntryClipping +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Step1Case Two Outside Restricted Augmentation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1CaseTwoOutsideRestrictedAugmentation {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (_ : IsProperEdgeColoring G phi) + (_ : IsOneEdgeUncolored phi e0) + (_ : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (hdivider : H.dividerCount < q) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (_ : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (_ : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (_ : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (_ : alpha ∈ TreeMissingColors phi T) + (_ : TreeColorSetClosed G phi T {alpha}) + (_ : alpha ≠ beta) (_ : beta ∉ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ a₃ b₃ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₃) (Sum.inl b₃)) + (_ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (_ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (_ : TreeExitPath T phi alpha beta a₃ b₃ P₃) + (_ : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (_ : ∀ x, x ∈ P₁.support → x ∉ P₃.support) + (_ : ∀ x, x ∈ P₂.support → x ∉ P₃.support) + (ha₁₂ : a₁ ≠ a₂) (ha₁₃ : a₁ ≠ a₃) (ha₂₃ : a₂ ≠ a₃) + (_ : b₁ ≠ b₂) (_ : b₁ ≠ b₃) (_ : b₂ ≠ b₃) + (_ : TreeVertexOrder T b₁ b₂) + (_ : TreeVertexOrder T b₂ b₃) + (f₁ f₂ f₃ : E) + (_ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : f₃ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (_ : Incident G b₁ f₁) (_ : Incident G b₂ f₂) + (_ : Incident G b₃ f₃) + (hPf₁ : Sum.inr f₁ ∈ P₁.support) + (_ : Sum.inr f₂ ∈ P₂.support) + (_ : Sum.inr f₃ ∈ P₃.support) + (_ : b₃ ∉ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hnoBetter : + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount = H.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' {a} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → + (b ∈ TreeMissingColors sigma T' ∨ + (b ∉ TreeMissingColors sigma T' ∧ + ∃ (u₃ v₃ : V) + (Q₃ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₃) (Sum.inl v₃)), + TreeExitPath T' sigma a b u₃ v₃ Q₃ ∧ + (∀ x, x ∈ Q₁.support → x ∉ Q₃.support) ∧ + (∀ x, x ∈ Q₂.support → x ∉ Q₃.support) ∧ + u₁ ≠ u₃ ∧ u₂ ≠ u₃ ∧ + Q₁.length + Q₂.length + Q₃.length < + P₁.length + P₂.length + P₃.length)) → + False) + (hseed : + ∃ (gamma : Fin k) (mu : PartialEdgeColoring E k) + (C J₁ J : TreeSequence G e0) + (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett mu J) + (baseJ : HierarchyBase corrJ.replacementETT mu) + (KJ : TashkinovHierarchy corrJ.replacementETT baseJ) + (goodJ : GoodHierarchy KJ) + (R₁ : (TwoColorIncidenceGraph G mu gamma beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (R₂ : (TwoColorIncidenceGraph G mu gamma beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (R₃ : (TwoColorIncidenceGraph G mu gamma beta).Walk + (Sum.inl a₃) (Sum.inl b₃)), + gamma ≠ beta ∧ + IsProperEdgeColoring G mu ∧ IsOneEdgeUncolored mu e0 ∧ + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi mu ∧ + ModColoring ett mu ∧ + MaximumProperty corrJ.replacementETT ∧ + KJ.dividerCount = H.dividerCount ∧ + 2 * corrJ.replacementETT.rounds + 11 ≤ + (TreeMissingColors mu + (corrJ.replacementETT.series.data.tree + (Fin.last corrJ.replacementETT.rounds).castSucc)).card ∧ + gamma ∉ (HierarchyStoredColorsAt KJ + (Fin.last KJ.dividerCount)).biUnion + (goodJ.gamma (Fin.last KJ.dividerCount)) ∧ + beta ∉ (HierarchyStoredColorsAt KJ + (Fin.last KJ.dividerCount)).biUnion + (goodJ.gamma (Fin.last KJ.dividerCount)) ∧ + beta ∈ MissingColors G mu b₃ ∧ + TreeExitPath T mu gamma beta a₁ b₁ R₁ ∧ + TreeExitPath T mu gamma beta a₂ b₂ R₂ ∧ + TreeExitPath T mu gamma beta a₃ b₃ R₃ ∧ + (∀ x, x ∈ R₁.support → x ∉ R₂.support) ∧ + (∀ x, x ∈ R₁.support → x ∉ R₃.support) ∧ + (∀ x, x ∈ R₂.support → x ∉ R₃.support) ∧ + R₁.support = P₁.support ∧ R₂.support = P₂.support ∧ + R₃.support = P₃.support ∧ + R₁.length = P₁.length ∧ R₂.length = P₂.length ∧ + R₃.length = P₃.length ∧ + TreeSequenceInitialSegment C T ∧ + C.vertex (Fin.last C.length) = b₃ ∧ + TreeSequenceAdjoinEdge C f₁ J₁ ∧ + TreeSequenceAdjoinEdge J₁ f₂ J ∧ + (∀ v, Incident G v f₁ → v ∈ TreeSequenceVertexSet J) ∧ + (∀ v, Incident G v f₂ → v ∈ TreeSequenceVertexSet J) ∧ + b₁ ∈ TreeSequenceVertexSet J ∧ + b₂ ∈ TreeSequenceVertexSet J ∧ + b₃ ∈ TreeSequenceVertexSet J) : + False := by + classical + rcases hseed with ⟨gamma, mu, C, J₁, J, corrJ, baseJ, KJ, goodJ, + R₁, R₂, R₃, hgammaBeta, hproperMu, honeMu, hstableMu, hmodMu, + hMPJ, hcountJ, hlargeJ, hgammaAvoid, hbetaAvoid, hbetaB₃, + hR₁, hR₂, hR₃, hdisR₁₂, hdisR₁₃, hdisR₂₃, + hsuppR₁, hsuppR₂, hsuppR₃, hlenR₁, hlenR₂, hlenR₃, + hCT, hlastC, hCedge₁, hJedge₂, hf₁ends, hf₂ends, + hb₁J, hb₂J, hb₃J⟩ + obtain ⟨m, chain, U, hfirst, hlast, hsteps, hlengths, hsegments, + hvertices, hsequence, havoid, hmaximal, corrU, hMPU, baseU, + hcore, hclosure, hsupport, KU, hcount, hstages, hdividers, + goodU, hgamma, hstored, hminus⟩ := + GoodHierarchyRestrictedAugmentation G k e0 input T phi mu ett hmodMu + hMP J corrJ baseJ KJ goodJ + have hJU : TreeSequenceInitialSegment J U := by + rw [← hfirst, ← hlast] + exact hsegments 0 (Fin.last m) (by simp) + have hJUvertices := TreeSequenceInitialSegmentVertexSetSubset hJU + have hb₁U := hJUvertices hb₁J + have hb₂U := hJUvertices hb₂J + have hb₃U := hJUvertices hb₃J + have hbetaU : beta ∈ TreeMissingColors mu U := + Finset.mem_biUnion.mpr ⟨b₃, hb₃U, hbetaB₃⟩ + have hcountU : KU.dividerCount = H.dividerCount := hcount.trans hcountJ + have hKUlt : KU.dividerCount < q := by rw [hcountU]; exact hdivider + have hElementaryU : ColoredVertexSetElementary G mu + (TreeSequenceVertexSet U) := + hfewer corrU.replacementETT corrU.rungAgreement hMPU baseU KU goodU hKUlt + have hlastIndex : Fin.cast (congrArg (fun n : ℕ => n + 1) hcount) + (Fin.last KU.dividerCount) = Fin.last KJ.dividerCount := by + apply Fin.ext + simp + have avoidTransport (c : Fin k) + (hc : c ∉ (HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount)).biUnion + (goodJ.gamma (Fin.last KJ.dividerCount))) : + c ∉ (HierarchyTerminalStoredColors KU).biUnion + (goodU.gamma (Fin.last KU.dividerCount)) := by + intro h + obtain ⟨eta, heta, hcEta⟩ := Finset.mem_biUnion.mp h + apply hc + refine Finset.mem_biUnion.mpr ⟨eta, hstored heta, ?_⟩ + rw [hgamma (Fin.last KU.dividerCount) eta, hlastIndex] at hcEta + exact hcEta + have hgammaAvoidU := avoidTransport gamma hgammaAvoid + have hbetaAvoidU := avoidTransport beta hbetaAvoid + have closedColor (c : Fin k) (hc : c ∈ TreeMissingColors mu U) + (havoidC : c ∉ (HierarchyTerminalStoredColors KU).biUnion + (goodU.gamma (Fin.last KU.dividerCount))) : + TreeColorSetClosed G mu U {c} := by + intro d hd + have hdc : d = c := by simpa using hd + subst d + exact hminus c (Finset.mem_sdiff.mpr ⟨hc, havoidC⟩) + have hbetaClosedU := closedColor beta hbetaU hbetaAvoidU + obtain ⟨ha₁U, ha₂U, ha₃U⟩ := + P2716_T2_ElementaryEndpointExclusion G mu T U gamma beta + a₁ b₁ a₂ b₂ a₃ b₃ R₁ R₂ R₃ hR₁ hR₂ hR₃ ha₁₂ + hb₁U hb₂U hb₃U hElementaryU hbetaB₃ hbetaClosedU + (fun hc => closedColor gamma hc hgammaAvoidU) + obtain ⟨v₁, L₁, hL₁, hsL₁, hlL₁, hstrictL₁⟩ := + P2716_T2_FirstEntryClipping G mu U gamma beta a₁ b₁ R₁ hR₁.1 + hR₁.2.2.2.2.1 ha₁U hb₁U + obtain ⟨v₂, L₂, hL₂, hsL₂, hlL₂, hstrictL₂⟩ := + P2716_T2_FirstEntryClipping G mu U gamma beta a₂ b₂ R₂ hR₂.1 + hR₂.2.2.2.2.1 ha₂U hb₂U + obtain ⟨v₃, L₃, hL₃, hsL₃, hlL₃, hstrictL₃⟩ := + P2716_T2_FirstEntryClipping G mu U gamma beta a₃ b₃ R₃ hR₃.1 + hR₃.2.2.2.2.1 ha₃U hb₃U + have hf₁R : Sum.inr f₁ ∈ R₁.support := by rw [hsuppR₁]; exact hPf₁ + have hl₁strict : L₁.length < R₁.length := + hstrictL₁ f₁ hf₁R (fun v hv => hJUvertices (hf₁ends v hv)) + have htotal : L₁.length + L₂.length + L₃.length < + P₁.length + P₂.length + P₃.length := by omega + -- Normalize the dependent presentation of the final ladder tree. + have terminalTreeEq {W : TreeSequence G e0} + (corr : CorrespondingExtendedTashkinovTree G k e0 ett mu W) : + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds e0 + corr.replacementInput := + cast (congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) + corr.rungAgreement.symm) corr.replacementSeries + have castTree {a b : ℕ} (h : a = b) + (s : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 2)) : + (cast (congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) h) + s).data.tree i = s.data.tree (Fin.cast (congrArg (fun n => n + 2) h.symm) i) := by + cases h + rfl + have hseries : corr.replacementETT.series = replacementSeries := by + exact ((cast_eq_iff_heq + (e := congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) + corr.rungAgreement.symm) + (a := corr.replacementSeries) (a' := corr.replacementETT.series)).2 + corr.seriesPresentation.symm).symm + let terminalIndex : Fin corr.replacementETT.rounds := + Fin.cast corr.rungAgreement.symm + ⟨ett.rounds - 1, by have hp := ett.roundsPositive; omega⟩ + have htree : corr.replacementETT.series.data.tree terminalIndex.succ.castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rw [hseries] + calc + replacementSeries.data.tree terminalIndex.succ.castSucc = + corr.replacementSeries.data.tree + (Fin.cast (congrArg (fun n => n + 2) corr.rungAgreement) + terminalIndex.succ.castSucc) := by + simpa [replacementSeries] using + (castTree corr.rungAgreement.symm corr.replacementSeries + terminalIndex.succ.castSucc) + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + convert corr.ladderTreesAgree (Fin.cast corr.rungAgreement terminalIndex) using 1 + · congr 1 + · congr 1 + apply Fin.ext + have hp := ett.roundsPositive + simp [terminalIndex, Nat.sub_add_cancel hp] + have hi : (Fin.last corr.replacementETT.rounds).castSucc = + terminalIndex.succ.castSucc := by + apply Fin.ext + have hp := ett.roundsPositive + simp only [Fin.val_castSucc, Fin.val_last, Fin.cast_mk, Fin.succ_mk, Nat.sub_add_cancel hp, + Fin.castSucc_mk, + terminalIndex] + exact corr.rungAgreement + rw [hi] + exact htree + have hlargeU : 2 * corrU.replacementETT.rounds + 11 ≤ + (TreeMissingColors mu (corrU.replacementETT.series.data.tree + (Fin.last corrU.replacementETT.rounds).castSucc)).card := by + rw [terminalTreeEq corrU, corrU.rungAgreement] + rw [terminalTreeEq corrJ, corrJ.rungAgreement] at hlargeJ + exact hlargeJ + -- Reorder the colors without changing any exact support or walk length. + have hflip : TwoColorIncidenceGraph G mu gamma beta ≤ + TwoColorIncidenceGraph G mu beta gamma := by + intro x y hxy + simpa only [TwoColorIncidenceGraph, or_comm] using hxy + have flipExit {a v : V} + (L : (TwoColorIncidenceGraph G mu gamma beta).Walk (Sum.inl a) (Sum.inl v)) + (hL : TreeExitPath U mu gamma beta a v L) : + TreeExitPath U mu beta gamma a v (L.mapLe hflip) := by + rcases hL with ⟨hpath, hlen, ha, hv, hmissing, honly⟩ + refine ⟨hpath.mapLe hflip, ?_, ha, hv, hmissing.symm, ?_⟩ + · simpa only [SimpleGraph.Walk.length_mapLe] using hlen + · simpa only [SimpleGraph.Walk.support_mapLe_eq_support] using honly + let Q₁ := L₁.mapLe hflip + let Q₂ := L₂.mapLe hflip + let Q₃ := L₃.mapLe hflip + have hQ₁ := flipExit L₁ hL₁ + have hQ₂ := flipExit L₂ hL₂ + have hQ₃ := flipExit L₃ hL₃ + have hdQ₁₂ : ∀ x, x ∈ Q₁.support → x ∉ Q₂.support := by + simpa only [Q₁, Q₂, SimpleGraph.Walk.support_mapLe_eq_support] using + (fun x hx hy => hdisR₁₂ x (hsL₁ x hx) (hsL₂ x hy)) + have hdQ₁₃ : ∀ x, x ∈ Q₁.support → x ∉ Q₃.support := by + simpa only [Q₁, Q₃, SimpleGraph.Walk.support_mapLe_eq_support] using + (fun x hx hy => hdisR₁₃ x (hsL₁ x hx) (hsL₃ x hy)) + have hdQ₂₃ : ∀ x, x ∈ Q₂.support → x ∉ Q₃.support := by + simpa only [Q₂, Q₃, SimpleGraph.Walk.support_mapLe_eq_support] using + (fun x hx hy => hdisR₂₃ x (hsL₂ x hx) (hsL₃ x hy)) + apply hnoBetter mu U corrU hproperMu honeMu hstableMu hMPU + baseU KU goodU hcountU hlargeU hminus beta gamma hgammaBeta.symm + hbetaU hbetaClosedU a₁ v₁ a₂ v₂ Q₁ Q₂ hQ₁ hQ₂ hdQ₁₂ ha₁₂ + by_cases hgammaU : gamma ∈ TreeMissingColors mu U + · exact Or.inl hgammaU + · right + refine ⟨hgammaU, a₃, v₃, Q₃, hQ₃, hdQ₁₃, hdQ₂₃, ha₁₃, ha₂₃, ?_⟩ + simpa only [Q₁, Q₂, Q₃, SimpleGraph.Walk.length_mapLe] using htotal + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideStar.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideStar.lean new file mode 100644 index 0000000000..176967cffd --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideStar.lean @@ -0,0 +1,165 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsidePrefixTwoEdges +public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsideRestrictedAugmentation + +/-! +# Step1Case Two Outside Star + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1CaseTwoOutsideStar {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (q : ℕ) (hdivider : H.dividerCount < q) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < q → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (hterminal : TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors H).biUnion + (good.gamma (Fin.last H.dividerCount)))) + (hElementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet T)) + (alpha beta : Fin k) (halpha : alpha ∈ TreeMissingColors phi T) + (hclosed : TreeColorSetClosed G phi T {alpha}) + (hne : alpha ≠ beta) (hbeta : beta ∉ TreeMissingColors phi T) + (a₁ b₁ a₂ b₂ a₃ b₃ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (P₃ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₃) (Sum.inl b₃)) + (hP₁ : TreeExitPath T phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath T phi alpha beta a₂ b₂ P₂) + (hP₃ : TreeExitPath T phi alpha beta a₃ b₃ P₃) + (hpaths₁₂ : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (hpaths₁₃ : ∀ x, x ∈ P₁.support → x ∉ P₃.support) + (hpaths₂₃ : ∀ x, x ∈ P₂.support → x ∉ P₃.support) + (ha₁₂ : a₁ ≠ a₂) (ha₁₃ : a₁ ≠ a₃) (ha₂₃ : a₂ ≠ a₃) + (hb₁₂ : b₁ ≠ b₂) (hb₁₃ : b₁ ≠ b₃) (hb₂₃ : b₂ ≠ b₃) + (horder₁₂ : TreeVertexOrder T b₁ b₂) + (horder₂₃ : TreeVertexOrder T b₂ b₃) + (f₁ f₂ f₃ : E) + (hf₁ : f₁ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₂ : f₂ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hf₃ : f₃ ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) beta) + (hif₁ : Incident G b₁ f₁) (hif₂ : Incident G b₂ f₂) + (hif₃ : Incident G b₃ f₃) + (hPf₁ : Sum.inr f₁ ∈ P₁.support) + (hPf₂ : Sum.inr f₂ ∈ P₂.support) + (hPf₃ : Sum.inr f₃ ∈ P₃.support) + (houtside : b₃ ∉ TreeSequenceVertexSet + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hnoBetter : + ∀ (sigma : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T'), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + phi sigma → + MaximumProperty corr.replacementETT → + ∀ (base' : HierarchyBase corr.replacementETT sigma) + (K : TashkinovHierarchy corr.replacementETT base') + (good' : GoodHierarchy K), + K.dividerCount = H.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) → + ∀ (a b : Fin k), a ≠ b → + a ∈ TreeMissingColors sigma T' → + TreeColorSetClosed G sigma T' {a} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath T' sigma a b u₁ v₁ Q₁ → + TreeExitPath T' sigma a b u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → + (b ∈ TreeMissingColors sigma T' ∨ + (b ∉ TreeMissingColors sigma T' ∧ + ∃ (u₃ v₃ : V) + (Q₃ : (TwoColorIncidenceGraph G sigma a b).Walk + (Sum.inl u₃) (Sum.inl v₃)), + TreeExitPath T' sigma a b u₃ v₃ Q₃ ∧ + (∀ x, x ∈ Q₁.support → x ∉ Q₃.support) ∧ + (∀ x, x ∈ Q₂.support → x ∉ Q₃.support) ∧ + u₁ ≠ u₃ ∧ u₂ ≠ u₃ ∧ + Q₁.length + Q₂.length + Q₃.length < + P₁.length + P₂.length + P₃.length)) → + False) : False := by + apply Step1CaseTwoOutsideRestrictedAugmentation + G k e0 input T phi + ett hMP hpositive hproper + hone hlower base H good + q hdivider hfewer hlarge + hterminal hElementary alpha + beta halpha hclosed hne + hbeta a₁ b₁ a₂ b₂ + a₃ b₃ P₁ P₂ P₃ + hP₁ hP₂ hP₃ hpaths₁₂ + hpaths₁₃ hpaths₂₃ ha₁₂ + ha₁₃ ha₂₃ hb₁₂ hb₁₃ + hb₂₃ horder₁₂ horder₂₃ + f₁ f₂ f₃ hf₁ hf₂ + hf₃ hif₁ hif₂ hif₃ + hPf₁ hPf₂ hPf₃ houtside + hnoBetter + (Step1CaseTwoOutsidePrefixTwoEdges + G k e0 input T phi + ett hMP hpositive hproper + hone hlower base H good + q hdivider hfewer hlarge + hterminal hElementary alpha + beta halpha hclosed hne + hbeta a₁ b₁ a₂ b₂ + a₃ b₃ P₁ P₂ P₃ + hP₁ hP₂ hP₃ hpaths₁₂ + hpaths₁₃ hpaths₂₃ ha₁₂ + ha₁₃ ha₂₃ hb₁₂ hb₁₃ + hb₂₃ horder₁₂ horder₂₃ + f₁ f₂ f₃ hf₁ hf₂ + hf₃ hif₁ hif₂ hif₃ + hPf₁ hPf₂ hPf₃ houtside) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean new file mode 100644 index 0000000000..b0e2ed386c --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean @@ -0,0 +1,519 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.BoundaryMissingColorAugmentation +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport +public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerReconstruction +public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerTransport +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.RestrictedAugmentationCorrespondingEndpoint +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Step1Case Two Outside Two Edge Extension + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_adjoin_vertex_set_147.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) (e0 : E) (A B : + TreeSequence G e0) (f : E) (x y : V), G.ends f = s(x, y) → y ∉ TreeSequenceVertexSet A → + TreeSequenceAdjoinEdge A f B → TreeSequenceVertexSet B = (insert y (TreeSequenceVertexSet + A) : Finset V) := by + classical + intro V E _ G e0 A B f x y hxy hyA hAB + rcases hAB with ⟨hlen, hinit, hlast⟩ + rcases hinit with ⟨hle, hvertices, hedges⟩ + have holdSubset : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨q, hq⟩ := hv + refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ + rw [hvertices] + exact hq + have hyB : y ∈ TreeSequenceVertexSet B := by + let j : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨a, ha⟩ := B.attaches j + have hyEnds : y ∈ G.ends (B.edge j) := by + rw [hlast, hxy] + simp + rw [ha] at hyEnds + rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨j.succ, hynew.symm⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt)), + hyold.symm⟩ + have hinsert : insert y (TreeSequenceVertexSet A) ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [Finset.mem_insert] at hv + rcases hv with rfl | hv + · exact hyB + · exact holdSubset hv + have hAcard : (TreeSequenceVertexSet A).card = A.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + A.vertex_injective] + have hBcard : (TreeSequenceVertexSet B).card = B.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + B.vertex_injective] + have hcard : (TreeSequenceVertexSet B).card ≤ + (insert y (TreeSequenceVertexSet A)).card := by + rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] + exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm + +private theorem helper_havoid_232.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi mu : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (C : TreeSequence G e0) (corrC : CorrespondingExtendedTashkinovTree G k e0 + ett mu C) (baseC : HierarchyBase corrC.replacementETT mu) (KC : TashkinovHierarchy + corrC.replacementETT baseC) (goodC : GoodHierarchy KC) (beta _ : Fin k), beta ∉ + (HierarchyStoredColorsAt KC (Fin.last KC.dividerCount)).biUnion (goodC.gamma (Fin.last + KC.dividerCount)) → + ∀ (f₁ f₂ : E), f₁ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet C) beta → f₂ ∈ + BoundaryColorEdges G mu (TreeSequenceVertexSet C) beta → + ∀ (J₁ : TreeSequence G e0), TreeSequenceAdjoinEdge C f₁ J₁ → + ∀ (J : TreeSequence G e0), TreeSequenceAdjoinEdge J₁ f₂ J → TashkinovAugmentationSequence mu C + J → + ∀ (corrJ : CorrespondingExtendedTashkinovTree G k e0 ett mu J) (baseJ : HierarchyBase + corrJ.replacementETT mu) (_ : TashkinovHierarchy corrJ.replacementETT baseJ), + ∀ eta ∈ HierarchyStoredColorsAt KC (Fin.last KC.dividerCount), Disjoint (goodC.gamma (Fin.last + KC.dividerCount) eta) ({c : Fin k | + ∃ (r : Fin J.length), (HierarchyStarredStage KC (Fin.last KC.dividerCount)).length ≤ (↑r : ℕ) + ∧ (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition mu J eta) : ℕ) J.length ∧ mu (J.edge r) + = some c} : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 input T phi mu ett C corrC baseC KC goodC beta gamma hbetaReserved f₁ + f₂ hf₁ hf₂ J₁ had₁ J had₂ hJU corrJ baseJ KJ eta heta + apply Finset.disjoint_left.mpr + intro c hcG hcSeg + rcases (Finset.mem_filter.mp hcSeg).2 with ⟨r, hlo, hhi, hcol⟩ + have hprefix : TreeSequenceInitialSegment C J := + TashkinovAugmentationSequenceInitialSegment mu C J hJU + have hcut := HierarchyFirstMissingPositionPrefixCutoff mu C J hprefix eta + C.length le_rfl + by_cases hsmall : r.val < C.length + · let q : Fin C.length := ⟨r.val, hsmall⟩ + have hqlo : (HierarchyStarredStage KC (Fin.last KC.dividerCount)).length ≤ q.val := by + simpa [q] using hlo + have hqhi : q.val < min (HierarchyFirstMissingPosition mu C eta).val C.length := by + have hpJ : r.val < (HierarchyFirstMissingPosition mu J eta).val := by omega + rw [hcut] + exact (lt_min_iff).2 ⟨hpJ, hsmall⟩ + have hqcol : mu (C.edge q) = some c := by + have hedge := hprefix.2.2 q + rw [← hedge] + simpa [q] using hcol + have hCseg : c ∈ HierarchySegmentColors KC (Fin.last KC.dividerCount) eta := by + unfold HierarchySegmentColors + have hterm : KC.stage (Fin.last KC.dividerCount).succ = C := by + convert KC.terminalStage using 1 + apply congrArg KC.stage + apply Fin.ext + simp + rw [hterm] + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, hqlo, hqhi, hqcol⟩ + have havo := goodC.avoidance (Fin.last KC.dividerCount) eta heta hcG + exact (Finset.mem_sdiff.mp havo).2 hCseg + · have hlen₁ := had₁.1 + have hlen₂ := had₂.1 + have hlenJ : J.length = C.length + 2 := by omega + have hr : r.val = C.length ∨ r.val = C.length + 1 := by omega + rcases hr with hr | hr + · have he : J.edge r = f₁ := by + have hlast := had₁.2.2 + let j₁ : Fin J₁.length := Fin.cast hlen₁.symm (Fin.last C.length) + have hlastJ : J.edge + (Fin.castLE (by omega) j₁) = f₁ := by + have hinit₂ := had₂.2.1 + calc + J.edge (Fin.castLE (by omega) j₁) = J₁.edge j₁ := hinit₂.2.2 j₁ + _ = f₁ := hlast + have hridx : r = Fin.castLE (by omega) + j₁ := by + apply Fin.ext + exact hr.trans (by simp [j₁]) + rw [hridx] + exact hlastJ + rw [he] at hcol + have hcolor : mu f₁ = some beta := (Finset.mem_filter.mp hf₁).2 + have hcb : c = beta := Option.some.inj (hcol.symm.trans hcolor) + subst c + have hbad : beta ∈ (HierarchyStoredColorsAt KC + (Fin.last KC.dividerCount)).biUnion + (goodC.gamma (Fin.last KC.dividerCount)) := + Finset.mem_biUnion.mpr ⟨eta, heta, hcG⟩ + exact hbetaReserved hbad + · have he : J.edge r = f₂ := by + have hlast := had₂.2.2 + have hlastJ : J.edge (Fin.cast hlen₂.symm (Fin.last J₁.length)) = f₂ := hlast + have hridx : r = Fin.cast hlen₂.symm (Fin.last J₁.length) := by + apply Fin.ext + rw [hr] + simp only [Fin.val_cast, Fin.val_last] + exact hlen₁.symm + rw [hridx] + exact hlastJ + rw [he] at hcol + have hcolor : mu f₂ = some beta := (Finset.mem_filter.mp hf₂).2 + have hcb : c = beta := Option.some.inj (hcol.symm.trans hcolor) + subst c + have hbad : beta ∈ (HierarchyStoredColorsAt KC + (Fin.last KC.dividerCount)).biUnion + (goodC.gamma (Fin.last KC.dividerCount)) := + Finset.mem_biUnion.mpr ⟨eta, heta, hcG⟩ + exact hbetaReserved hbad + +private theorem helper_terminalTreeEq_322.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi mu : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (C : TreeSequence G e0) (corrC : CorrespondingExtendedTashkinovTree G k e0 + ett mu C) (baseC : HierarchyBase corrC.replacementETT mu) (_ : TashkinovHierarchy + corrC.replacementETT baseC) (J : TreeSequence G e0) (corrJ : + CorrespondingExtendedTashkinovTree G k e0 ett mu J) (baseJ : HierarchyBase + corrJ.replacementETT mu) (_ : TashkinovHierarchy corrJ.replacementETT baseJ) + {U : TreeSequence G e0} (corr : CorrespondingExtendedTashkinovTree G k e0 ett mu U), + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + classical + intro V E _ _ _ _ G k e0 input T phi mu ett C corrC baseC KC J corrJ baseJ KJ U corr + let replacementSeries : TashkinovSeries G k corr.replacementETT.rounds e0 + corr.replacementInput := + cast (congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) + corr.rungAgreement.symm) corr.replacementSeries + have castTree {a b : ℕ} (h : a = b) + (s : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 2)) : + (cast (congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) h) + s).data.tree i = s.data.tree (Fin.cast (congrArg (fun n => n + 2) h.symm) i) := by + cases h + rfl + have hseries : corr.replacementETT.series = replacementSeries := by + exact ((cast_eq_iff_heq + (e := congrArg (fun n => TashkinovSeries G k n e0 corr.replacementInput) + corr.rungAgreement.symm) + (a := corr.replacementSeries) (a' := corr.replacementETT.series)).2 + corr.seriesPresentation.symm).symm + let terminalIndex : Fin corr.replacementETT.rounds := + Fin.cast corr.rungAgreement.symm + ⟨ett.rounds - 1, by have hp := ett.roundsPositive; omega⟩ + have htree : corr.replacementETT.series.data.tree terminalIndex.succ.castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rw [hseries] + calc + replacementSeries.data.tree terminalIndex.succ.castSucc = + corr.replacementSeries.data.tree + (Fin.cast (congrArg (fun n => n + 2) corr.rungAgreement) + terminalIndex.succ.castSucc) := + by simpa [replacementSeries] using + (castTree corr.rungAgreement.symm corr.replacementSeries + terminalIndex.succ.castSucc) + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + convert corr.ladderTreesAgree (Fin.cast corr.rungAgreement terminalIndex) using 1 + · congr 1 + · congr 1 + apply Fin.ext + have hp := ett.roundsPositive + simp [terminalIndex, Nat.sub_add_cancel hp] + have hi : (Fin.last corr.replacementETT.rounds).castSucc = + terminalIndex.succ.castSucc := by + apply Fin.ext + have hp := ett.roundsPositive + simp only [Fin.val_castSucc, Fin.val_last, Fin.cast_mk, Fin.succ_mk, Nat.sub_add_cancel hp, + Fin.castSucc_mk, + terminalIndex] + exact corr.rungAgreement + rw [hi] + exact htree + +lemma Step1CaseTwoOutsideTwoEdgeExtension {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi mu : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) + (C : TreeSequence G e0) + (corrC : CorrespondingExtendedTashkinovTree G k e0 ett mu C) + (baseC : HierarchyBase corrC.replacementETT mu) + (KC : TashkinovHierarchy corrC.replacementETT baseC) + (goodC : GoodHierarchy KC) + (hmod : ModColoring ett mu) + (_ : MaximumProperty corrC.replacementETT) + (_ : + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence mu + (ett.series.data.tree (Fin.last ett.rounds).castSucc) C) ∨ + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = {f} ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence mu seed C)) + (hlargeC : 2 * corrC.replacementETT.rounds + 11 ≤ + (TreeMissingColors mu + (corrC.replacementETT.series.data.tree + (Fin.last corrC.replacementETT.rounds).castSucc)).card) + (beta gamma : Fin k) + (hgammaReserved : gamma ∉ (HierarchyStoredColorsAt KC + (Fin.last KC.dividerCount)).biUnion + (goodC.gamma (Fin.last KC.dividerCount))) + (hbetaReserved : beta ∉ (HierarchyStoredColorsAt KC + (Fin.last KC.dividerCount)).biUnion + (goodC.gamma (Fin.last KC.dividerCount))) + (b₁ b₂ b₃ : V) (f₁ f₂ : E) + (hbetaMissing : beta ∈ MissingColors G mu b₃) + (hf₁ : f₁ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet C) beta) + (hf₂ : f₂ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet C) beta) + (_ : Incident G b₁ f₁) (_ : Incident G b₂ f₂) + (houtsideDistinct : ∀ u₁ u₂, Incident G u₁ f₁ → + u₁ ∉ TreeSequenceVertexSet C → Incident G u₂ f₂ → + u₂ ∉ TreeSequenceVertexSet C → u₁ ≠ u₂) + (hb₁ : b₁ ∈ TreeSequenceVertexSet C) + (hb₂ : b₂ ∈ TreeSequenceVertexSet C) + (hb₃ : b₃ ∈ TreeSequenceVertexSet C) : + ∃ (J₁ J : TreeSequence G e0) (corrJ : + CorrespondingExtendedTashkinovTree G k e0 ett mu J) (baseJ : + HierarchyBase corrJ.replacementETT mu) (KJ : + TashkinovHierarchy corrJ.replacementETT baseJ) (goodJ : GoodHierarchy KJ), + MaximumProperty corrJ.replacementETT ∧ + KJ.dividerCount = KC.dividerCount ∧ + 2 * corrJ.replacementETT.rounds + 11 ≤ + (TreeMissingColors mu + (corrJ.replacementETT.series.data.tree + (Fin.last corrJ.replacementETT.rounds).castSucc)).card ∧ + gamma ∉ + (HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount)).biUnion + (goodJ.gamma (Fin.last KJ.dividerCount)) ∧ + beta ∉ + (HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount)).biUnion + (goodJ.gamma (Fin.last KJ.dividerCount)) ∧ + TreeSequenceAdjoinEdge C f₁ J₁ ∧ + TreeSequenceAdjoinEdge J₁ f₂ J ∧ + (∀ v, Incident G v f₁ → v ∈ TreeSequenceVertexSet J) ∧ + (∀ v, Incident G v f₂ → v ∈ TreeSequenceVertexSet J) ∧ + b₁ ∈ TreeSequenceVertexSet J ∧ + b₂ ∈ TreeSequenceVertexSet J ∧ b₃ ∈ TreeSequenceVertexSet J := by + classical + have hb3missing : beta ∈ TreeMissingColors mu C := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨b₃, hb₃, hbetaMissing⟩ + obtain ⟨J₁, had₁, haug₁, _⟩ := + BoundaryMissingColorAugmentation G k e0 mu C beta f₁ hf₁ hb3missing + have hends₁ : ∃ x y, x ∈ TreeSequenceVertexSet C ∧ + y ∉ TreeSequenceVertexSet C ∧ G.ends f₁ = s(x, y) := by + simp only [BoundaryColorEdges, BoundaryEdges, Finset.mem_filter, + Finset.mem_univ, true_and] at hf₁ + rcases hf₁.1 with ⟨x, hx, y, hy, hxy⟩ + refine ⟨x, y, hx, hy, ?_⟩ + simpa using hxy + obtain ⟨x₁, y₁, hx₁, hy₁, hxy₁⟩ := hends₁ + have adjoin_vertex_set (A B : TreeSequence G e0) (f : E) (x y : V) + (hxy : G.ends f = s(x, y)) (hxA : x ∈ TreeSequenceVertexSet A) + (hyA : y ∉ TreeSequenceVertexSet A) + (hAB : TreeSequenceAdjoinEdge A f B) : + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by + exact @helper_adjoin_vertex_set_147 (@V) (@E) inferInstance (@G) (@e0) (@A) (@B) (@f) (@x) + (@y) (@hxy) (@hyA) (@hAB) + have hJ1vertices : TreeSequenceVertexSet J₁ = + insert y₁ (TreeSequenceVertexSet C) := + adjoin_vertex_set C J₁ f₁ x₁ y₁ hxy₁ hx₁ hy₁ had₁ + have hboundary₂ : f₂ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet J₁) beta := by + simp only [BoundaryColorEdges, BoundaryEdges, Finset.mem_filter, + Finset.mem_univ, true_and] at hf₂ ⊢ + rcases hf₂.1 with ⟨x₂, hx₂, y₂, hy₂, hxy₂⟩ + have hy₂J₁ : y₂ ∉ TreeSequenceVertexSet J₁ := by + rw [hJ1vertices] + simp only [Finset.mem_insert, not_or] + refine ⟨?_, hy₂⟩ + intro heq + apply (houtsideDistinct y₁ y₂ (by + change y₁ ∈ G.ends f₁ + rw [hxy₁] + simp) hy₁ (by + change y₂ ∈ G.ends f₂ + rw [hxy₂] + simp) hy₂) heq.symm + refine ⟨?_, hf₂.2⟩ + exact ⟨x₂, (by rw [hJ1vertices]; exact Finset.mem_insert_of_mem hx₂), + y₂, hy₂J₁, hxy₂⟩ + have hb3missingJ₁ : beta ∈ TreeMissingColors mu J₁ := by + simp only [TreeMissingColors, Finset.mem_biUnion] + rw [hJ1vertices] + exact ⟨b₃, Finset.mem_insert_of_mem hb₃, hbetaMissing⟩ + obtain ⟨J, had₂, haug₂, _⟩ := + BoundaryMissingColorAugmentation G k e0 mu J₁ beta f₂ hboundary₂ hb3missingJ₁ + have hJU : TashkinovAugmentationSequence mu C J := by + exact Relation.ReflTransGen.head haug₁ (Relation.ReflTransGen.single haug₂) + obtain ⟨corrJ, hMPCJ⟩ := + RestrictedAugmentationCorrespondingEndpoint G k e0 input T phi mu ett + hmod hMP C J corrC hJU + obtain ⟨baseJ, hcore, hclosure, hsupport⟩ := + GoodHierarchyCommonOriginalBaseTransport G k e0 input T phi mu ett C J + corrC baseC corrJ + obtain ⟨KJ, hcount, hstages, hdividers⟩ := + GoodHierarchySameDividerReconstruction G k e0 input T phi mu ett C J + corrC baseC KC corrJ baseJ hcore hJU + have havoid := @helper_havoid_232 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@mu) (@ett) (@C) (@corrC) (@baseC) (@KC) + (@goodC) (@beta) (@gamma) (@hbetaReserved) (@f₁) (@f₂) (@hf₁) (@hf₂) (@J₁) (@had₁) (@J) + (@had₂) (@hJU) (@corrJ) (@baseJ) (@KJ) + obtain ⟨goodJ, hgamma⟩ := + GoodHierarchySameDividerTransport G k e0 input T phi mu ett C J corrC baseC + KC goodC corrJ baseJ hcore hclosure KJ hcount hstages hJU havoid + have terminalTreeEq := @helper_terminalTreeEq_322 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@mu) (@ett) (@C) (@corrC) + (@baseC) (@KC) (@J) (@corrJ) (@baseJ) (@KJ) + have hlargeJ : 2 * corrJ.replacementETT.rounds + 11 ≤ + (TreeMissingColors mu (corrJ.replacementETT.series.data.tree + (Fin.last corrJ.replacementETT.rounds).castSucc)).card := by + calc + 2 * corrJ.replacementETT.rounds + 11 = + 2 * corrC.replacementETT.rounds + 11 := by + rw [corrJ.rungAgreement, corrC.rungAgreement] + _ ≤ (TreeMissingColors mu (corrC.replacementETT.series.data.tree + (Fin.last corrC.replacementETT.rounds).castSucc)).card := hlargeC + _ = (TreeMissingColors mu (corrJ.replacementETT.series.data.tree + (Fin.last corrJ.replacementETT.rounds).castSucc)).card := by + rw [terminalTreeEq corrC, terminalTreeEq corrJ] + have hstoredLast : HierarchyStoredColorsAt KJ (Fin.last KJ.dividerCount) = + HierarchyStoredColorsAt KC (Fin.last KC.dividerCount) := by + have h := (hstages (Fin.last KJ.dividerCount)).2.2.1 + simpa using h + have hgammaLast : ∀ eta : Fin k, + goodJ.gamma (Fin.last KJ.dividerCount) eta = + goodC.gamma (Fin.last KC.dividerCount) eta := by + intro eta + simpa using hgamma (Fin.last KJ.dividerCount) eta + have hbetaJ : beta ∉ (HierarchyStoredColorsAt KJ + (Fin.last KJ.dividerCount)).biUnion (goodJ.gamma (Fin.last KJ.dividerCount)) := by + intro hc + rcases Finset.mem_biUnion.mp hc with ⟨eta, heta, hgammaEta⟩ + apply hbetaReserved + apply Finset.mem_biUnion.mpr + refine ⟨eta, hstoredLast ▸ heta, ?_⟩ + simpa only [hgammaLast eta] using hgammaEta + have hgammaJ : gamma ∉ (HierarchyStoredColorsAt KJ + (Fin.last KJ.dividerCount)).biUnion (goodJ.gamma (Fin.last KJ.dividerCount)) := by + intro hc + rcases Finset.mem_biUnion.mp hc with ⟨eta, heta, hgammaEta⟩ + apply hgammaReserved + apply Finset.mem_biUnion.mpr + refine ⟨eta, hstoredLast ▸ heta, ?_⟩ + simpa only [hgammaLast eta] using hgammaEta + have hprefixCJ : TreeSequenceInitialSegment C J := + TashkinovAugmentationSequenceInitialSegment mu C J hJU + have hsubsetCJ : TreeSequenceVertexSet C ⊆ TreeSequenceVertexSet J := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨i, rfl⟩ := hv + refine ⟨Fin.castLE (Nat.succ_le_succ hprefixCJ.1) i, ?_⟩ + exact hprefixCJ.2.1 i + have hends₂ : ∃ x₂ y₂, x₂ ∈ TreeSequenceVertexSet C ∧ + y₂ ∉ TreeSequenceVertexSet C ∧ G.ends f₂ = s(x₂, y₂) := by + simp only [BoundaryColorEdges, BoundaryEdges, Finset.mem_filter, + Finset.mem_univ, true_and] at hf₂ + rcases hf₂.1 with ⟨x, hx, y, hy, hxy⟩ + refine ⟨x, y, hx, hy, ?_⟩ + simpa using hxy + obtain ⟨x₂, y₂, hx₂, hy₂, hxy₂⟩ := hends₂ + have hy₂J₁ : y₂ ∉ TreeSequenceVertexSet J₁ := by + rw [hJ1vertices] + simp only [Finset.mem_insert, not_or] + refine ⟨?_, hy₂⟩ + intro heq + exact (houtsideDistinct y₁ y₂ (by + change y₁ ∈ G.ends f₁ + rw [hxy₁] + simp) hy₁ (by + change y₂ ∈ G.ends f₂ + rw [hxy₂] + simp) hy₂) heq.symm + have hJvertices : TreeSequenceVertexSet J = + insert y₂ (TreeSequenceVertexSet J₁) := + adjoin_vertex_set J₁ J f₂ x₂ y₂ hxy₂ + (by rw [hJ1vertices]; exact Finset.mem_insert_of_mem hx₂) hy₂J₁ had₂ + have hf₁J : ∀ v, Incident G v f₁ → v ∈ TreeSequenceVertexSet J := by + intro v hv + have hv' : v ∈ G.ends f₁ := hv + rw [hxy₁] at hv' + rcases (by simpa only [Sym2.mem_iff] using hv') with h | h + · subst v + simp [hJvertices, hJ1vertices, hx₁] + · rw [hJvertices, hJ1vertices] + subst v + simp + have hf₂J : ∀ v, Incident G v f₂ → v ∈ TreeSequenceVertexSet J := by + intro v hv + have hv' : v ∈ G.ends f₂ := hv + rw [hxy₂] at hv' + rcases (by simpa only [Sym2.mem_iff] using hv') with h | h + · subst v + rw [hJvertices] + exact Finset.mem_insert_of_mem + (by rw [hJ1vertices]; exact Finset.mem_insert_of_mem hx₂) + · rw [hJvertices] + subst v + simp + exact ⟨J₁, J, corrJ, baseJ, KJ, goodJ, hMPCJ, hcount, hlargeJ, + hgammaJ, hbetaJ, had₁, had₂, hf₁J, hf₂J, + hsubsetCJ hb₁, hsubsetCJ hb₂, hsubsetCJ hb₃⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegGlobalMinimum.lean b/LeanPool/GoldbergSeymour/Step1ExitLegGlobalMinimum.lean new file mode 100644 index 0000000000..1d1fdafea4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ExitLegGlobalMinimum.lean @@ -0,0 +1,256 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchor +public import LeanPool.GoldbergSeymour.Step1ExitLegMinimumExists +public import LeanPool.GoldbergSeymour.Step1ExitLegPrecoloringElementary +public import LeanPool.GoldbergSeymour.Step1ExitLegPresentationExists +public import LeanPool.GoldbergSeymour.Step1ExitLegThetaPositive +public import LeanPool.GoldbergSeymour.Step1ExitLegThetaZeroNonparallel +public import LeanPool.GoldbergSeymour.Step1ExitLegThetaZeroParallel + +/-! +# Step1Exit Leg Global Minimum + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1ExitLegGlobalMinimum {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (_ : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < H.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (i : Fin H.dividerCount) (alpha beta : Fin k) + (halpha : alpha ∈ + TreeMissingColors phi (H.stage i.succ.castSucc)) + (hne : alpha ≠ beta) + (hclosed : TreeColorSetClosed G phi + (H.stage i.succ.castSucc) {alpha}) + (hnot : ¬ TreeInterchangeable G + (H.stage i.succ.castSucc) phi alpha beta) : + ∃ (input' : PartialEdgeColoring E k) (T' : TreeSequence G e0) + (psi : PartialEdgeColoring E k) + (other : ExtendedTashkinovTree G k e0 input' T' psi) + (base' : HierarchyBase other psi) + (K : TashkinovHierarchy other base') (good' : GoodHierarchy K), + other.rounds = ett.rounds ∧ MaximumProperty other ∧ + K.dividerCount < H.dividerCount ∧ + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0 ∧ + 2 * other.rounds + 11 ≤ + (TreeMissingColors psi + (other.series.data.tree (Fin.last other.rounds).castSucc)).card ∧ + TreeColorSetMinusClosed G psi T' + ((HierarchyTerminalStoredColors K).biUnion + (good'.gamma (Fin.last K.dividerCount))) ∧ + ColoredVertexSetElementary G psi (TreeSequenceVertexSet T') ∧ + ∃ (a b theta : Fin k) + (a₁ b₁ a₂ b₂ : V) + (P₁ : (TwoColorIncidenceGraph G psi a b).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G psi a b).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (f₁ f₂ : E), + a ≠ b ∧ a ∈ TreeMissingColors psi T' ∧ + TreeColorSetClosed G psi T' {a} ∧ + TreeExitPath T' psi a b a₁ b₁ P₁ ∧ + TreeExitPath T' psi a b a₂ b₂ P₂ ∧ + (∀ x, x ∈ P₁.support → x ∉ P₂.support) ∧ + a₁ ≠ a₂ ∧ b₁ ≠ b₂ ∧ TreeVertexOrder T' b₁ b₂ ∧ + f₁ ∈ BoundaryColorEdges G psi (TreeSequenceVertexSet T') b ∧ + f₂ ∈ BoundaryColorEdges G psi (TreeSequenceVertexSet T') b ∧ + Incident G b₁ f₁ ∧ Incident G b₂ f₂ ∧ + Sum.inr f₁ ∈ P₁.support ∧ Sum.inr f₂ ∈ P₂.support ∧ + theta ≠ a ∧ theta ≠ b ∧ + theta ∈ TreeMissingColors psi + (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ + TreeColorSetClosed G psi + (HierarchyStarredStage K (Fin.last K.dividerCount)) {theta} ∧ + TreeColorSetClosed G psi T' {theta} ∧ + (∀ (sigma : PartialEdgeColoring E k) (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 other sigma U), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (other.series.data.tree (Fin.last other.rounds).castSucc) + (TashkinovStoredColors other.series.data + (Fin.last other.rounds)) psi sigma → + MaximumProperty corr.replacementETT → + ∀ (baseU : HierarchyBase corr.replacementETT sigma) + (L : TashkinovHierarchy corr.replacementETT baseU) + (goodU : GoodHierarchy L), + L.dividerCount < K.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors L).biUnion + (goodU.gamma (Fin.last L.dividerCount))) → + ∀ (c d : Fin k), c ≠ d → + c ∈ TreeMissingColors sigma U → + TreeColorSetClosed G sigma U {c} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma c d).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma c d).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath U sigma c d u₁ v₁ Q₁ → + TreeExitPath U sigma c d u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → False) ∧ + (b ∈ TreeMissingColors psi T' ∨ + (b ∉ TreeMissingColors psi T' ∧ + ∃ (a₃ b₃ : V) + (P₃ : (TwoColorIncidenceGraph G psi a b).Walk + (Sum.inl a₃) (Sum.inl b₃)) (f₃ : E), + TreeExitPath T' psi a b a₃ b₃ P₃ ∧ + (∀ x, x ∈ P₁.support → x ∉ P₃.support) ∧ + (∀ x, x ∈ P₂.support → x ∉ P₃.support) ∧ + a₁ ≠ a₃ ∧ a₂ ≠ a₃ ∧ + b₁ ≠ b₃ ∧ b₂ ≠ b₃ ∧ + TreeVertexOrder T' b₂ b₃ ∧ + f₃ ∈ BoundaryColorEdges G psi + (TreeSequenceVertexSet T') b ∧ + Incident G b₃ f₃ ∧ Sum.inr f₃ ∈ P₃.support ∧ + (∀ (sigma : PartialEdgeColoring E k) + (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree + G k e0 other sigma U), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring + (other.series.data.tree + (Fin.last other.rounds).castSucc) + (TashkinovStoredColors other.series.data + (Fin.last other.rounds)) psi sigma → + MaximumProperty corr.replacementETT → + ∀ (baseU : HierarchyBase corr.replacementETT sigma) + (L : TashkinovHierarchy corr.replacementETT baseU) + (goodU : GoodHierarchy L), + L.dividerCount = K.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors L).biUnion + (goodU.gamma (Fin.last L.dividerCount))) → + ∀ (c d : Fin k), c ≠ d → + c ∈ TreeMissingColors sigma U → + TreeColorSetClosed G sigma U {c} → + ∀ (u₁ v₁ u₂ v₂ : V) + (Q₁ : (TwoColorIncidenceGraph G sigma c d).Walk + (Sum.inl u₁) (Sum.inl v₁)) + (Q₂ : (TwoColorIncidenceGraph G sigma c d).Walk + (Sum.inl u₂) (Sum.inl v₂)), + TreeExitPath U sigma c d u₁ v₁ Q₁ → + TreeExitPath U sigma c d u₂ v₂ Q₂ → + (∀ x, x ∈ Q₁.support → x ∉ Q₂.support) → + u₁ ≠ u₂ → + (d ∈ TreeMissingColors sigma U ∨ + (d ∉ TreeMissingColors sigma U ∧ + ∃ (u₃ v₃ : V) + (Q₃ : (TwoColorIncidenceGraph G sigma c d).Walk + (Sum.inl u₃) (Sum.inl v₃)), + TreeExitPath U sigma c d u₃ v₃ Q₃ ∧ + (∀ x, x ∈ Q₁.support → x ∉ Q₃.support) ∧ + (∀ x, x ∈ Q₂.support → x ∉ Q₃.support) ∧ + u₁ ≠ u₃ ∧ u₂ ≠ u₃ ∧ + Q₁.length + Q₂.length + Q₃.length < + P₁.length + P₂.length + P₃.length)) → + False))) := by + have hfamily : Nonempty + (Step1ExitLegPresentation G k e0 ett.rounds H.dividerCount) := + Step1ExitLegPresentationExists G k e0 input T phi ett hMP hproper hone + base H good hfewer hlarge i alpha beta halpha hne hclosed hnot + have hallElementary : ∀ P : + Step1ExitLegPresentation G k e0 ett.rounds H.dividerCount, + ColoredVertexSetElementary G P.phi (TreeSequenceVertexSet P.T) := by + intro P + exact hfewer P.ett P.rounds_eq P.maximum P.base P.hierarchy P.good + P.divider_lt + obtain ⟨M⟩ := Step1ExitLegMinimumExists G k e0 ett.rounds + H.dividerCount hfamily hallElementary + have hlowerElementary : + ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' + generating'), 0 < lower.rounds → lower.rounds < M.selected.ett.rounds → MaximumProperty + lower → ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T') := by + intro input' T' generating' lower hlowerPositive hlowerRounds hlowerMP + have hlowerRounds' : lower.rounds < ett.rounds := by + simpa only [M.selected.rounds_eq] using hlowerRounds + have hpack := hlower lower hlowerPositive hlowerRounds' hlowerMP + intro u hu v hv huv + exact hpack.1 hu hv huv + have htheta : ∃ theta : Fin k, + theta ≠ M.selected.a ∧ theta ≠ M.selected.b ∧ + theta ∈ TreeMissingColors M.selected.phi + (HierarchyStarredStage M.selected.hierarchy + (Fin.last M.selected.hierarchy.dividerCount)) ∧ + TreeColorSetClosed G M.selected.phi + (HierarchyStarredStage M.selected.hierarchy + (Fin.last M.selected.hierarchy.dividerCount)) {theta} ∧ + TreeColorSetClosed G M.selected.phi M.selected.T {theta} := by + by_cases hzero : M.selected.hierarchy.dividerCount = 0 + · by_cases hparallel : + M.selected.ett.series.data.kind + (Fin.last M.selected.ett.rounds) = + some TashkinovExtensionKind.PE + · exact Step1ExitLegThetaZeroParallel G k e0 ett.rounds + H.dividerCount M.selected hzero hparallel + (Step1ExitLegPrecoloringElementary G k e0 ett.rounds + H.dividerCount M.selected hlowerElementary) + · exact Step1ExitLegThetaZeroNonparallel G k e0 ett.rounds + H.dividerCount M.selected hzero hparallel + · exact Step1ExitLegThetaPositive G k e0 ett.rounds H.dividerCount M + (Nat.pos_of_ne_zero hzero) + obtain ⟨theta, hthetaA, hthetaB, hthetaMissing, hthetaStarClosed, + hthetaTerminalClosed⟩ := htheta + refine ⟨M.selected.input, M.selected.T, M.selected.phi, M.selected.ett, + M.selected.base, M.selected.hierarchy, M.selected.good, + M.selected.rounds_eq, M.selected.maximum, M.selected.divider_lt, + M.selected.proper, M.selected.oneUncolored, M.selected.large, + M.selected.terminalMinusClosed, M.elementary, M.selected.a, + M.selected.b, theta, M.selected.a1, M.selected.b1, M.selected.a2, + M.selected.b2, M.selected.P1, M.selected.P2, M.selected.f1, + M.selected.f2, M.selected.a_ne_b, M.selected.aMissing, + M.selected.aClosed, M.selected.exit1, M.selected.exit2, + M.selected.disjoint12, M.selected.outsideDistinct, + M.selected.treeDistinct, M.selected.treeOrder, M.selected.boundary1, + M.selected.boundary2, M.selected.incident1, M.selected.incident2, + M.selected.support1, M.selected.support2, hthetaA, hthetaB, + hthetaMissing, hthetaStarClosed, hthetaTerminalClosed, + M.primaryMinimal, M.secondary⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegMinimum.lean b/LeanPool/GoldbergSeymour/Step1ExitLegMinimum.lean new file mode 100644 index 0000000000..c05872b03c --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ExitLegMinimum.lean @@ -0,0 +1,152 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree + +public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation + +/-! +# Step1Exit Leg Minimum + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A selected elementary exit-leg presentation with primary and secondary minimality conditions. -/ +structure Step1ExitLegMinimum {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) where + /-- The presentation selected by the minimality conditions. -/ + selected : Step1ExitLegPresentation G k e0 n q + elementary : ColoredVertexSetElementary G selected.phi (TreeSequenceVertexSet selected.T) + primaryMinimal : + ∀ (sigma : PartialEdgeColoring E k) (U : TreeSequence G e0) (corr : + CorrespondingExtendedTashkinovTree G k e0 selected.ett sigma U), IsProperEdgeColoring G + sigma → IsOneEdgeUncolored sigma e0 → StableColoring (selected.ett.series.data.tree + (Fin.last selected.ett.rounds).castSucc) (TashkinovStoredColors selected.ett.series.data + (Fin.last selected.ett.rounds)) selected.phi sigma → MaximumProperty corr.replacementETT → + ∀ (baseU : HierarchyBase corr.replacementETT sigma) (L : TashkinovHierarchy + corr.replacementETT baseU) (goodU : GoodHierarchy L), L.dividerCount < + selected.hierarchy.dividerCount → 2 * corr.replacementETT.rounds + 11 ≤ (TreeMissingColors + sigma (corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc)).card → TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors L).biUnion (goodU.gamma (Fin.last L.dividerCount))) → + ∀ (c d : Fin k), c ≠ d → c ∈ TreeMissingColors sigma U → TreeColorSetClosed G sigma U { c } → + ∀ (u1 v1 u2 v2 : V) (Q1 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u1) (Sum.inl v1)) + (Q2 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u2) (Sum.inl v2)), TreeExitPath U + sigma c d u1 v1 Q1 → TreeExitPath U sigma c d u2 v2 Q2 → ( + ∀ x, x ∈ Q1.support → x ∉ Q2.support) → u1 ≠ u2 → False + secondary : + selected.b ∈ TreeMissingColors selected.phi selected.T ∨ + (selected.b ∉ TreeMissingColors selected.phi selected.T ∧ + ∃ (a3 b3 : V) (P3 : + (TwoColorIncidenceGraph G selected.phi selected.a selected.b).Walk (Sum.inl a3) + (Sum.inl b3)) + (f3 : E), + TreeExitPath selected.T selected.phi selected.a selected.b a3 b3 P3 ∧ + ( + ∀ x, + x ∈ selected.P1.support → + x ∉ P3.support) ∧ + ( + ∀ x, + x ∈ selected.P2.support → + x ∉ P3.support) ∧ + selected.a1 ≠ a3 ∧ + selected.a2 ≠ a3 ∧ + selected.b1 ≠ b3 ∧ + selected.b2 ≠ b3 ∧ + TreeVertexOrder selected.T selected.b2 b3 ∧ + f3 ∈ + BoundaryColorEdges G selected.phi (TreeSequenceVertexSet selected.T) + selected.b ∧ + Incident G b3 f3 ∧ + Sum.inr f3 ∈ P3.support ∧ + ( + ∀ (sigma : PartialEdgeColoring E k) (U : TreeSequence G e0) + (corr : + CorrespondingExtendedTashkinovTree G k e0 selected.ett sigma U), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring + (selected.ett.series.data.tree + (Fin.last selected.ett.rounds).castSucc) + (TashkinovStoredColors selected.ett.series.data + (Fin.last selected.ett.rounds)) + selected.phi sigma → + MaximumProperty corr.replacementETT → + ∀ (baseU : HierarchyBase corr.replacementETT sigma) + (L : TashkinovHierarchy corr.replacementETT baseU) + (goodU : GoodHierarchy L), + L.dividerCount = selected.hierarchy.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last + corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors L).biUnion + (goodU.gamma (Fin.last L.dividerCount))) → + ∀ (c d : Fin k), + c ≠ d → + c ∈ TreeMissingColors sigma U → + TreeColorSetClosed G sigma U { c } → + ∀ (u1 v1 u2 v2 : V) + (Q1 : + (TwoColorIncidenceGraph G sigma c + d).Walk + (Sum.inl u1) (Sum.inl v1)) + (Q2 : + (TwoColorIncidenceGraph G sigma c + d).Walk + (Sum.inl u2) (Sum.inl v2)), + TreeExitPath U sigma c d u1 v1 Q1 → + TreeExitPath U sigma c d u2 v2 Q2 → + ( + ∀ x, + x ∈ Q1.support → + x ∉ Q2.support) → + u1 ≠ u2 → + (d ∈ TreeMissingColors sigma U ∨ + (d ∉ + TreeMissingColors sigma + U ∧ + ∃ (u3 v3 : V) (Q3 : + (TwoColorIncidenceGraph + G sigma c d).Walk + (Sum.inl u3) + (Sum.inl v3)), + TreeExitPath U sigma c d + u3 v3 Q3 ∧ + ( + ∀ x, + x ∈ Q1.support → + x ∉ + Q3.support) ∧ + ( + ∀ x, + x ∈ Q2.support → + x ∉ + Q3.support) ∧ + u1 ≠ u3 ∧ + u2 ≠ u3 ∧ + Q1.length + + Q2.length + + Q3.length < + selected.P1.length + + selected.P2.length + + P3.length)) → + False)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegMinimumExists.lean b/LeanPool/GoldbergSeymour/Step1ExitLegMinimumExists.lean new file mode 100644 index 0000000000..db97f89087 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ExitLegMinimumExists.lean @@ -0,0 +1,1077 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ElementaryClosedExitPairExtendsTriple +public import LeanPool.GoldbergSeymour.Step1ExitLegMinimum +public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder + +/-! +# Step1Exit Leg Minimum Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_primaryFor_128.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ), + let DividerRealized : ℕ → Prop := fun (m : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = m; + ∀ (hDividerRealized : + ∃ (m : ℕ), DividerRealized m), + let d0 : ℕ := Nat.find hDividerRealized; DividerRealized d0 → ( + ∀ {P : Step1ExitLegPresentation G k e0 n q}, d0 ≤ P.hierarchy.dividerCount) → + let ThirdPackage : (P : Step1ExitLegPresentation G k e0 n q) → (a3 b3 : V) → + (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3) → E → Prop := fun + (P : Step1ExitLegPresentation G k e0 n q) (a3 b3 : V) (P3 : (TwoColorIncidenceGraph G + P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3)) (f3 : E) => TreeExitPath P.T P.phi P.a P.b + a3 b3 P3 ∧ ( + ∀ x ∈ P.P1.support, x ∉ P3.support) ∧ ( + ∀ x ∈ P.P2.support, x ∉ P3.support) ∧ P.a1 ≠ a3 ∧ P.a2 ≠ a3 ∧ P.b1 ≠ b3 ∧ P.b2 ≠ b3 ∧ f3 ∈ + BoundaryColorEdges G P.phi (TreeSequenceVertexSet P.T) P.b ∧ Incident G b3 f3 ∧ Sum.inr f3 + ∈ P3.support; + let SecondaryRealized : ℕ → Prop := fun (s : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = d0 ∧ (s = (0 : ℕ) ∧ + P.b ∈ TreeMissingColors P.phi P.T ∨ P.b ∉ TreeMissingColors P.phi P.T ∧ + ∃ (a3 : V) (b3 : V) (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl + b3)) (f3 : E), ThirdPackage P a3 b3 P3 f3 ∧ s = (1 : ℕ) + P.P1.length + P.P2.length + + P3.length); + ∀ (hSecondaryRealized : + ∃ (s : ℕ), SecondaryRealized s), + let s0 : ℕ := Nat.find hSecondaryRealized; SecondaryRealized s0 → + let PrimaryMinimal : Step1ExitLegPresentation G k e0 n q → Prop := fun (S : + Step1ExitLegPresentation G k e0 n q) => + ∀ (sigma : PartialEdgeColoring E k) (U : TreeSequence G e0) (corr : + CorrespondingExtendedTashkinovTree G k e0 S.ett sigma U), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → StableColoring (S.ett.series.data.tree (Fin.last + S.ett.rounds).castSucc) (TashkinovStoredColors S.ett.series.data (Fin.last S.ett.rounds)) + S.phi sigma → MaximumProperty corr.replacementETT → + ∀ (baseU : HierarchyBase corr.replacementETT sigma) (L : TashkinovHierarchy + corr.replacementETT baseU) (goodU : GoodHierarchy L), L.dividerCount < + S.hierarchy.dividerCount → (2 : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ + (TreeMissingColors sigma (corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc)).card → TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors L).biUnion (goodU.gamma (Fin.last L.dividerCount))) → + ∀ (c d : Fin k), c ≠ d → c ∈ TreeMissingColors sigma U → TreeColorSetClosed G sigma U { c } → + ∀ (u1 v1 u2 v2 : V) (Q1 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u1) (Sum.inl v1)) + (Q2 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u2) (Sum.inl v2)), TreeExitPath U + sigma c d u1 v1 Q1 → TreeExitPath U sigma c d u2 v2 Q2 → ( + ∀ x ∈ Q1.support, x ∉ Q2.support) → u1 ≠ u2 → False; + ∀ (S : Step1ExitLegPresentation G k e0 n q), S.hierarchy.dividerCount = d0 → PrimaryMinimal S + := by + classical + intro V E _ _ _ _ G k e0 n q DividerRealized hDividerRealized d0 hd0_spec hd0_min ThirdPackage + SecondaryRealized hSecondaryRealized s0 hs0_spec PrimaryMinimal S hSdiv + dsimp only [PrimaryMinimal] + intro sigma U corr hproper hone _hstable hmaximum baseU L goodU + hdiv hlarge hminus c d hcne hcmissing hcclosed u1 v1 u2 v2 Q1 Q2 + hQ1 hQ2 hdisjoint hu12 + obtain ⟨f1, hf1, hif1, hsf1⟩ := + ClosedColorExitPathBoundaryEdge G U sigma c d hcclosed u1 v1 Q1 hQ1 + obtain ⟨f2, hf2, hif2, hsf2⟩ := + ClosedColorExitPathBoundaryEdge G U sigma c d hcclosed u2 v2 Q2 hQ2 + have hv12 : v1 ≠ v2 := by + intro hv + apply hdisjoint (Sum.inl v1) Q1.end_mem_support + simp [hv] + have hv1mem : v1 ∈ TreeSequenceVertexSet U := hQ1.2.2.2.1 + have hv2mem : v2 ∈ TreeSequenceVertexSet U := hQ2.2.2.2.1 + have hv1pos : ∃ i : Fin (U.length + 1), U.vertex i = v1 := by + simpa [TreeSequenceVertexSet] using hv1mem + have hv2pos : ∃ i : Fin (U.length + 1), U.vertex i = v2 := by + simpa [TreeSequenceVertexSet] using hv2mem + obtain ⟨i1, hi1⟩ := hv1pos + obtain ⟨i2, hi2⟩ := hv2pos + have hi12 : i1 ≠ i2 := by + intro h + apply hv12 + exact hi1.symm.trans ((congrArg U.vertex h).trans hi2) + have hrounds : corr.replacementETT.rounds = n := + corr.rungAgreement.trans S.rounds_eq + have hdividerLtQ : L.dividerCount < q := by + exact lt_trans hdiv S.divider_lt + have hreverse : ∀ x, x ∈ Q2.support → x ∉ Q1.support := by + intro x hx2 hx1 + exact hdisjoint x hx1 hx2 + by_cases horder : i1.val < i2.val + · let R : Step1ExitLegPresentation G k e0 n q := + { input := corr.replacementInput + T := U + phi := sigma + ett := corr.replacementETT + base := baseU + hierarchy := L + good := goodU + rounds_eq := hrounds + maximum := hmaximum + divider_lt := hdividerLtQ + proper := hproper + oneUncolored := hone + large := hlarge + terminalMinusClosed := hminus + a := c + b := d + a_ne_b := hcne + aMissing := hcmissing + aClosed := hcclosed + a1 := u1 + b1 := v1 + a2 := u2 + b2 := v2 + P1 := Q1 + P2 := Q2 + exit1 := hQ1 + exit2 := hQ2 + disjoint12 := hdisjoint + outsideDistinct := hu12 + treeDistinct := hv12 + treeOrder := ⟨i1, i2, hi1, hi2, horder⟩ + f1 := f1 + f2 := f2 + boundary1 := hf1 + boundary2 := hf2 + incident1 := hif1 + incident2 := hif2 + support1 := hsf1 + support2 := hsf2 } + have hmin := hd0_min (P := R) + dsimp only [R] at hmin + omega + · have horder' : i2.val < i1.val := by omega + let R : Step1ExitLegPresentation G k e0 n q := + { input := corr.replacementInput + T := U + phi := sigma + ett := corr.replacementETT + base := baseU + hierarchy := L + good := goodU + rounds_eq := hrounds + maximum := hmaximum + divider_lt := hdividerLtQ + proper := hproper + oneUncolored := hone + large := hlarge + terminalMinusClosed := hminus + a := c + b := d + a_ne_b := hcne + aMissing := hcmissing + aClosed := hcclosed + a1 := u2 + b1 := v2 + a2 := u1 + b2 := v1 + P1 := Q2 + P2 := Q1 + exit1 := hQ2 + exit2 := hQ1 + disjoint12 := hreverse + outsideDistinct := hu12.symm + treeDistinct := hv12.symm + treeOrder := ⟨i2, i1, hi2, hi1, horder'⟩ + f1 := f2 + f2 := f1 + boundary1 := hf2 + boundary2 := hf1 + incident1 := hif2 + incident2 := hif1 + support1 := hsf2 + support2 := hsf1 } + have hmin := hd0_min (P := R) + dsimp only [R] at hmin + omega + +private theorem helper_branch_332.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ), + let DividerRealized : ℕ → Prop := fun (m : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = m; + ∀ (hDividerRealized : + ∃ (m : ℕ), DividerRealized m), + let d0 : ℕ := Nat.find hDividerRealized; DividerRealized d0 → + let ThirdPackage : (P : Step1ExitLegPresentation G k e0 n q) → (a3 b3 : V) → + (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3) → E → Prop := fun + (P : Step1ExitLegPresentation G k e0 n q) (a3 b3 : V) (P3 : (TwoColorIncidenceGraph G + P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3)) (f3 : E) => TreeExitPath P.T P.phi P.a P.b + a3 b3 P3 ∧ ( + ∀ x ∈ P.P1.support, x ∉ P3.support) ∧ ( + ∀ x ∈ P.P2.support, x ∉ P3.support) ∧ P.a1 ≠ a3 ∧ P.a2 ≠ a3 ∧ P.b1 ≠ b3 ∧ P.b2 ≠ b3 ∧ f3 ∈ + BoundaryColorEdges G P.phi (TreeSequenceVertexSet P.T) P.b ∧ Incident G b3 f3 ∧ Sum.inr f3 + ∈ P3.support; + let SecondaryRealized : ℕ → Prop := fun (s : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = d0 ∧ (s = (0 : ℕ) ∧ + P.b ∈ TreeMissingColors P.phi P.T ∨ P.b ∉ TreeMissingColors P.phi P.T ∧ + ∃ (a3 : V) (b3 : V) (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl + b3)) (f3 : E), ThirdPackage P a3 b3 P3 f3 ∧ s = (1 : ℕ) + P.P1.length + P.P2.length + + P3.length); + ∀ (hSecondaryRealized : + ∃ (s : ℕ), SecondaryRealized s), + let s0 : ℕ := Nat.find hSecondaryRealized; SecondaryRealized s0 → ( + ∀ {s : ℕ}, SecondaryRealized s → s0 ≤ s) → + ∀ (S : Step1ExitLegPresentation G k e0 n q), S.hierarchy.dividerCount = d0 → + ∀ {a3 b3 : V} (P3 : (TwoColorIncidenceGraph G S.phi S.a S.b).Walk (Sum.inl a3) (Sum.inl b3)), + s0 = (1 : ℕ) + S.P1.length + S.P2.length + P3.length → + ∀ (sigma : PartialEdgeColoring E k) (U : TreeSequence G e0) (corr : + CorrespondingExtendedTashkinovTree G k e0 S.ett sigma U), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → MaximumProperty corr.replacementETT → + ∀ (baseU : HierarchyBase corr.replacementETT sigma) (L : TashkinovHierarchy + corr.replacementETT baseU) (goodU : GoodHierarchy L), L.dividerCount = + S.hierarchy.dividerCount → (2 : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ + (TreeMissingColors sigma (corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc)).card → TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors L).biUnion (goodU.gamma (Fin.last L.dividerCount))) → + ∀ (c d : Fin k), c ≠ d → c ∈ TreeMissingColors sigma U → TreeColorSetClosed G sigma U { c } → + ∀ (u1 v1 u2 v2 : V) (Q1 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u1) (Sum.inl v1)) + (Q2 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u2) (Sum.inl v2)), TreeExitPath U + sigma c d u1 v1 Q1 → TreeExitPath U sigma c d u2 v2 Q2 → ( + ∀ x ∈ Q1.support, x ∉ Q2.support) → u1 ≠ u2 → (d ∈ TreeMissingColors sigma U ∨ d ∉ + TreeMissingColors sigma U ∧ + ∃ (u3 : V) (v3 : V) (Q3 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u3) (Sum.inl + v3)), TreeExitPath U sigma c d u3 v3 Q3 ∧ ( + ∀ x ∈ Q1.support, x ∉ Q3.support) ∧ ( + ∀ x ∈ Q2.support, x ∉ Q3.support) ∧ u1 ≠ u3 ∧ u2 ≠ u3 ∧ Q1.length + Q2.length + Q3.length < + S.P1.length + S.P2.length + P3.length) → + ∀ f1 ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet U) d, Incident G v1 f1 → Sum.inr f1 ∈ + Q1.support → + ∀ f2 ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet U) d, Incident G v2 f2 → Sum.inr f2 ∈ + Q2.support → v1 ≠ v2 → + ∀ (i1 : Fin (U.length + (1 : ℕ))), U.vertex i1 = v1 → + ∀ (i2 : Fin (U.length + (1 : ℕ))), U.vertex i2 = v2 → corr.replacementETT.rounds = n → + L.dividerCount < q → (↑i1 : ℕ) < (↑i2 : ℕ) → False := by + classical + intro V E _ _ _ _ G k e0 n q DividerRealized hDividerRealized d0 hd0_spec ThirdPackage + SecondaryRealized hSecondaryRealized s0 hs0_spec hs0_min S hSdiv a3 b3 P3 hvalue sigma U + corr hproper hone hmaximum baseU L goodU hdiv hlarge hminus c d hcne hcmissing hcclosed u1 + v1 u2 v2 Q1 Q2 hQ1 hQ2 hdisjoint hu12 hshorter f1 hf1 hif1 hsf1 f2 hf2 hif2 hsf2 hv12 i1 + hi1 i2 hi2 hrounds hdividerLtQ horder + let R : Step1ExitLegPresentation G k e0 n q := + { input := corr.replacementInput + T := U + phi := sigma + ett := corr.replacementETT + base := baseU + hierarchy := L + good := goodU + rounds_eq := hrounds + maximum := hmaximum + divider_lt := hdividerLtQ + proper := hproper + oneUncolored := hone + large := hlarge + terminalMinusClosed := hminus + a := c + b := d + a_ne_b := hcne + aMissing := hcmissing + aClosed := hcclosed + a1 := u1 + b1 := v1 + a2 := u2 + b2 := v2 + P1 := Q1 + P2 := Q2 + exit1 := hQ1 + exit2 := hQ2 + disjoint12 := hdisjoint + outsideDistinct := hu12 + treeDistinct := hv12 + treeOrder := ⟨i1, i2, hi1, hi2, horder⟩ + f1 := f1 + f2 := f2 + boundary1 := hf1 + boundary2 := hf2 + incident1 := hif1 + incident2 := hif2 + support1 := hsf1 + support2 := hsf2 } + have hRdiv : R.hierarchy.dividerCount = d0 := by + dsimp only [R] + exact hdiv.trans hSdiv + rcases hshorter with hdmissing | ⟨hdpresent, u3, v3, Q3, hQ3, + h13, h23, hu13, hu23, hlength⟩ + · have hreal : SecondaryRealized 0 := by + refine ⟨R, hRdiv, Or.inl ⟨rfl, ?_⟩⟩ + simpa [R] using hdmissing + have hmin := hs0_min hreal + omega + · obtain ⟨f3, hf3, hif3, hsf3⟩ := + ClosedColorExitPathBoundaryEdge G U sigma c d hcclosed + u3 v3 Q3 hQ3 + have hv13 : v1 ≠ v3 := by + intro hv + apply h13 (Sum.inl v1) Q1.end_mem_support + simp [hv] + have hv23 : v2 ≠ v3 := by + intro hv + apply h23 (Sum.inl v2) Q2.end_mem_support + simp [hv] + have hreal : SecondaryRealized + (1 + Q1.length + Q2.length + Q3.length) := by + refine ⟨R, hRdiv, Or.inr ⟨?_, u3, v3, Q3, f3, ?_, ?_⟩⟩ + · simpa [R] using hdpresent + · exact ⟨hQ3, h13, h23, hu13, hu23, hv13, hv23, + hf3, hif3, hsf3⟩ + · rfl + have hmin := hs0_min hreal + omega + +private theorem helper_branch_402.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ), + let DividerRealized : ℕ → Prop := fun (m : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = m; + ∀ (hDividerRealized : + ∃ (m : ℕ), DividerRealized m), + let d0 : ℕ := Nat.find hDividerRealized; DividerRealized d0 → + let ThirdPackage : (P : Step1ExitLegPresentation G k e0 n q) → (a3 b3 : V) → + (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3) → E → Prop := fun + (P : Step1ExitLegPresentation G k e0 n q) (a3 b3 : V) (P3 : (TwoColorIncidenceGraph G + P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3)) (f3 : E) => TreeExitPath P.T P.phi P.a P.b + a3 b3 P3 ∧ ( + ∀ x ∈ P.P1.support, x ∉ P3.support) ∧ ( + ∀ x ∈ P.P2.support, x ∉ P3.support) ∧ P.a1 ≠ a3 ∧ P.a2 ≠ a3 ∧ P.b1 ≠ b3 ∧ P.b2 ≠ b3 ∧ f3 ∈ + BoundaryColorEdges G P.phi (TreeSequenceVertexSet P.T) P.b ∧ Incident G b3 f3 ∧ Sum.inr f3 + ∈ P3.support; + let SecondaryRealized : ℕ → Prop := fun (s : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = d0 ∧ (s = (0 : ℕ) ∧ + P.b ∈ TreeMissingColors P.phi P.T ∨ P.b ∉ TreeMissingColors P.phi P.T ∧ + ∃ (a3 : V) (b3 : V) (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl + b3)) (f3 : E), ThirdPackage P a3 b3 P3 f3 ∧ s = (1 : ℕ) + P.P1.length + P.P2.length + + P3.length); + ∀ (hSecondaryRealized : + ∃ (s : ℕ), SecondaryRealized s), + let s0 : ℕ := Nat.find hSecondaryRealized; SecondaryRealized s0 → ( + ∀ {s : ℕ}, SecondaryRealized s → s0 ≤ s) → + ∀ (S : Step1ExitLegPresentation G k e0 n q), S.hierarchy.dividerCount = d0 → + ∀ {a3 b3 : V} (P3 : (TwoColorIncidenceGraph G S.phi S.a S.b).Walk (Sum.inl a3) (Sum.inl b3)), + s0 = (1 : ℕ) + S.P1.length + S.P2.length + P3.length → + ∀ (sigma : PartialEdgeColoring E k) (U : TreeSequence G e0) (corr : + CorrespondingExtendedTashkinovTree G k e0 S.ett sigma U), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → MaximumProperty corr.replacementETT → + ∀ (baseU : HierarchyBase corr.replacementETT sigma) (L : TashkinovHierarchy + corr.replacementETT baseU) (goodU : GoodHierarchy L), L.dividerCount = + S.hierarchy.dividerCount → (2 : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ + (TreeMissingColors sigma (corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc)).card → TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors L).biUnion (goodU.gamma (Fin.last L.dividerCount))) → + ∀ (c d : Fin k), c ≠ d → c ∈ TreeMissingColors sigma U → TreeColorSetClosed G sigma U { c } → + ∀ (u1 v1 u2 v2 : V) (Q1 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u1) (Sum.inl v1)) + (Q2 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u2) (Sum.inl v2)), TreeExitPath U + sigma c d u1 v1 Q1 → TreeExitPath U sigma c d u2 v2 Q2 → u1 ≠ u2 → (d ∈ TreeMissingColors + sigma U ∨ d ∉ TreeMissingColors sigma U ∧ + ∃ (u3 : V) (v3 : V) (Q3 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u3) (Sum.inl + v3)), TreeExitPath U sigma c d u3 v3 Q3 ∧ ( + ∀ x ∈ Q1.support, x ∉ Q3.support) ∧ ( + ∀ x ∈ Q2.support, x ∉ Q3.support) ∧ u1 ≠ u3 ∧ u2 ≠ u3 ∧ Q1.length + Q2.length + Q3.length < + S.P1.length + S.P2.length + P3.length) → + ∀ f1 ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet U) d, Incident G v1 f1 → Sum.inr f1 ∈ + Q1.support → + ∀ f2 ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet U) d, Incident G v2 f2 → Sum.inr f2 ∈ + Q2.support → v1 ≠ v2 → + ∀ (i1 : Fin (U.length + (1 : ℕ))), U.vertex i1 = v1 → + ∀ (i2 : Fin (U.length + (1 : ℕ))), U.vertex i2 = v2 → i1 ≠ i2 → corr.replacementETT.rounds = n + → L.dividerCount < q → ( + ∀ x ∈ Q2.support, x ∉ Q1.support) → ¬(↑i1 : ℕ) < (↑i2 : ℕ) → False := by + classical + intro V E _ _ _ _ G k e0 n q DividerRealized hDividerRealized d0 hd0_spec ThirdPackage + SecondaryRealized hSecondaryRealized s0 hs0_spec hs0_min S hSdiv a3 b3 P3 hvalue sigma U + corr hproper hone hmaximum baseU L goodU hdiv hlarge hminus c d hcne hcmissing hcclosed u1 + v1 u2 v2 Q1 Q2 hQ1 hQ2 hu12 hshorter f1 hf1 hif1 hsf1 f2 hf2 hif2 hsf2 hv12 i1 hi1 i2 hi2 + hi12 hrounds hdividerLtQ hreverse horder + have horder' : i2.val < i1.val := by omega + let R : Step1ExitLegPresentation G k e0 n q := + { input := corr.replacementInput + T := U + phi := sigma + ett := corr.replacementETT + base := baseU + hierarchy := L + good := goodU + rounds_eq := hrounds + maximum := hmaximum + divider_lt := hdividerLtQ + proper := hproper + oneUncolored := hone + large := hlarge + terminalMinusClosed := hminus + a := c + b := d + a_ne_b := hcne + aMissing := hcmissing + aClosed := hcclosed + a1 := u2 + b1 := v2 + a2 := u1 + b2 := v1 + P1 := Q2 + P2 := Q1 + exit1 := hQ2 + exit2 := hQ1 + disjoint12 := hreverse + outsideDistinct := hu12.symm + treeDistinct := hv12.symm + treeOrder := ⟨i2, i1, hi2, hi1, horder'⟩ + f1 := f2 + f2 := f1 + boundary1 := hf2 + boundary2 := hf1 + incident1 := hif2 + incident2 := hif1 + support1 := hsf2 + support2 := hsf1 } + have hRdiv : R.hierarchy.dividerCount = d0 := by + dsimp only [R] + exact hdiv.trans hSdiv + rcases hshorter with hdmissing | ⟨hdpresent, u3, v3, Q3, hQ3, + h13, h23, hu13, hu23, hlength⟩ + · have hreal : SecondaryRealized 0 := by + refine ⟨R, hRdiv, Or.inl ⟨rfl, ?_⟩⟩ + simpa [R] using hdmissing + have hmin := hs0_min hreal + omega + · obtain ⟨f3, hf3, hif3, hsf3⟩ := + ClosedColorExitPathBoundaryEdge G U sigma c d hcclosed + u3 v3 Q3 hQ3 + have hv13 : v1 ≠ v3 := by + intro hv + apply h13 (Sum.inl v1) Q1.end_mem_support + simp [hv] + have hv23 : v2 ≠ v3 := by + intro hv + apply h23 (Sum.inl v2) Q2.end_mem_support + simp [hv] + have hreal : SecondaryRealized + (1 + Q1.length + Q2.length + Q3.length) := by + refine ⟨R, hRdiv, Or.inr ⟨?_, u3, v3, Q3, f3, ?_, ?_⟩⟩ + · simpa [R] using hdpresent + · exact ⟨hQ3, h23, h13, hu23, hu13, hv23, hv13, + hf3, hif3, hsf3⟩ + · dsimp only [R] + omega + have hmin := hs0_min hreal + omega + +private theorem helper_secondaryFor_298.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ), + let DividerRealized : ℕ → Prop := fun (m : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = m; + ∀ (hDividerRealized : + ∃ (m : ℕ), DividerRealized m), + let d0 : ℕ := Nat.find hDividerRealized; DividerRealized d0 → + let ThirdPackage : (P : Step1ExitLegPresentation G k e0 n q) → (a3 b3 : V) → + (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3) → E → Prop := fun + (P : Step1ExitLegPresentation G k e0 n q) (a3 b3 : V) (P3 : (TwoColorIncidenceGraph G + P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3)) (f3 : E) => TreeExitPath P.T P.phi P.a P.b + a3 b3 P3 ∧ ( + ∀ x ∈ P.P1.support, x ∉ P3.support) ∧ ( + ∀ x ∈ P.P2.support, x ∉ P3.support) ∧ P.a1 ≠ a3 ∧ P.a2 ≠ a3 ∧ P.b1 ≠ b3 ∧ P.b2 ≠ b3 ∧ f3 ∈ + BoundaryColorEdges G P.phi (TreeSequenceVertexSet P.T) P.b ∧ Incident G b3 f3 ∧ Sum.inr f3 + ∈ P3.support; + let SecondaryRealized : ℕ → Prop := fun (s : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = d0 ∧ (s = (0 : ℕ) ∧ + P.b ∈ TreeMissingColors P.phi P.T ∨ P.b ∉ TreeMissingColors P.phi P.T ∧ + ∃ (a3 : V) (b3 : V) (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl + b3)) (f3 : E), ThirdPackage P a3 b3 P3 f3 ∧ s = (1 : ℕ) + P.P1.length + P.P2.length + + P3.length); + ∀ (hSecondaryRealized : + ∃ (s : ℕ), SecondaryRealized s), + let s0 : ℕ := Nat.find hSecondaryRealized; SecondaryRealized s0 → ( + ∀ {s : ℕ}, SecondaryRealized s → s0 ≤ s) → + let SecondaryMinimal : (S : Step1ExitLegPresentation G k e0 n q) → {a3 b3 : V} → + (TwoColorIncidenceGraph G S.phi S.a S.b).Walk (Sum.inl a3) (Sum.inl b3) → Prop := fun (S : + Step1ExitLegPresentation G k e0 n q) {a3 b3 : V} (P3 : (TwoColorIncidenceGraph G S.phi S.a + S.b).Walk (Sum.inl a3) (Sum.inl b3)) => + ∀ (sigma : PartialEdgeColoring E k) (U : TreeSequence G e0) (corr : + CorrespondingExtendedTashkinovTree G k e0 S.ett sigma U), IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → StableColoring (S.ett.series.data.tree (Fin.last + S.ett.rounds).castSucc) (TashkinovStoredColors S.ett.series.data (Fin.last S.ett.rounds)) + S.phi sigma → MaximumProperty corr.replacementETT → + ∀ (baseU : HierarchyBase corr.replacementETT sigma) (L : TashkinovHierarchy + corr.replacementETT baseU) (goodU : GoodHierarchy L), L.dividerCount = + S.hierarchy.dividerCount → (2 : ℕ) * corr.replacementETT.rounds + (11 : ℕ) ≤ + (TreeMissingColors sigma (corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc)).card → TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors L).biUnion (goodU.gamma (Fin.last L.dividerCount))) → + ∀ (c d : Fin k), c ≠ d → c ∈ TreeMissingColors sigma U → TreeColorSetClosed G sigma U { c } → + ∀ (u1 v1 u2 v2 : V) (Q1 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u1) (Sum.inl v1)) + (Q2 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u2) (Sum.inl v2)), TreeExitPath U + sigma c d u1 v1 Q1 → TreeExitPath U sigma c d u2 v2 Q2 → ( + ∀ x ∈ Q1.support, x ∉ Q2.support) → u1 ≠ u2 → (d ∈ TreeMissingColors sigma U ∨ d ∉ + TreeMissingColors sigma U ∧ + ∃ (u3 : V) (v3 : V) (Q3 : (TwoColorIncidenceGraph G sigma c d).Walk (Sum.inl u3) (Sum.inl + v3)), TreeExitPath U sigma c d u3 v3 Q3 ∧ ( + ∀ x ∈ Q1.support, x ∉ Q3.support) ∧ ( + ∀ x ∈ Q2.support, x ∉ Q3.support) ∧ u1 ≠ u3 ∧ u2 ≠ u3 ∧ Q1.length + Q2.length + Q3.length < + S.P1.length + S.P2.length + P3.length) → False; + ∀ (S : Step1ExitLegPresentation G k e0 n q), S.hierarchy.dividerCount = d0 → + ∀ {a3 b3 : V} (P3 : (TwoColorIncidenceGraph G S.phi S.a S.b).Walk (Sum.inl a3) (Sum.inl b3)), + s0 = (1 : ℕ) + S.P1.length + S.P2.length + P3.length → SecondaryMinimal S P3 := by + classical + intro V E _ _ _ _ G k e0 n q DividerRealized hDividerRealized d0 hd0_spec ThirdPackage + SecondaryRealized hSecondaryRealized s0 hs0_spec hs0_min SecondaryMinimal S hSdiv a3 b3 P3 + hvalue + dsimp only [SecondaryMinimal] + intro sigma U corr hproper hone _hstable hmaximum baseU L goodU + hdiv hlarge hminus c d hcne hcmissing hcclosed u1 v1 u2 v2 Q1 Q2 + hQ1 hQ2 hdisjoint hu12 hshorter + obtain ⟨f1, hf1, hif1, hsf1⟩ := + ClosedColorExitPathBoundaryEdge G U sigma c d hcclosed u1 v1 Q1 hQ1 + obtain ⟨f2, hf2, hif2, hsf2⟩ := + ClosedColorExitPathBoundaryEdge G U sigma c d hcclosed u2 v2 Q2 hQ2 + have hv12 : v1 ≠ v2 := by + intro hv + apply hdisjoint (Sum.inl v1) Q1.end_mem_support + simp [hv] + have hv1mem : v1 ∈ TreeSequenceVertexSet U := hQ1.2.2.2.1 + have hv2mem : v2 ∈ TreeSequenceVertexSet U := hQ2.2.2.2.1 + have hv1pos : ∃ i : Fin (U.length + 1), U.vertex i = v1 := by + simpa [TreeSequenceVertexSet] using hv1mem + have hv2pos : ∃ i : Fin (U.length + 1), U.vertex i = v2 := by + simpa [TreeSequenceVertexSet] using hv2mem + obtain ⟨i1, hi1⟩ := hv1pos + obtain ⟨i2, hi2⟩ := hv2pos + have hi12 : i1 ≠ i2 := by + intro h + apply hv12 + exact hi1.symm.trans ((congrArg U.vertex h).trans hi2) + have hrounds : corr.replacementETT.rounds = n := + corr.rungAgreement.trans S.rounds_eq + have hdividerLtQ : L.dividerCount < q := by + rw [hdiv] + exact S.divider_lt + have hreverse : ∀ x, x ∈ Q2.support → x ∉ Q1.support := by + intro x hx2 hx1 + exact hdisjoint x hx1 hx2 + by_cases horder : i1.val < i2.val + · exact @helper_branch_332 V E inferInstance inferInstance inferInstance inferInstance G k e0 n + q hDividerRealized hd0_spec hSecondaryRealized hs0_spec hs0_min S hSdiv a3 b3 P3 hvalue + sigma U corr hproper hone hmaximum baseU L goodU hdiv hlarge hminus c d hcne hcmissing + hcclosed u1 v1 u2 v2 Q1 Q2 hQ1 hQ2 hdisjoint hu12 hshorter f1 hf1 hif1 hsf1 f2 hf2 hif2 + hsf2 hv12 i1 hi1 i2 hi2 hrounds hdividerLtQ horder + · exact @helper_branch_402 V E inferInstance inferInstance inferInstance inferInstance G k e0 n + q hDividerRealized hd0_spec hSecondaryRealized hs0_spec hs0_min S hSdiv a3 b3 P3 hvalue + sigma U corr hproper hone hmaximum baseU L goodU hdiv hlarge hminus c d hcne hcmissing + hcclosed u1 v1 u2 v2 Q1 Q2 hQ1 hQ2 hu12 hshorter f1 hf1 hif1 hsf1 f2 hf2 hif2 hsf2 hv12 i1 + hi1 i2 hi2 hi12 hrounds hdividerLtQ hreverse horder +private theorem helper_branch_574.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ), + let DividerRealized : ℕ → Prop := fun (m : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = m; + ∀ (hDividerRealized : + ∃ (m : ℕ), DividerRealized m), + let d0 : ℕ := Nat.find hDividerRealized; DividerRealized d0 → + let ThirdPackage : (P : Step1ExitLegPresentation G k e0 n q) → (a3 b3 : V) → + (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3) → E → Prop := fun + (P : Step1ExitLegPresentation G k e0 n q) (a3 b3 : V) (P3 : (TwoColorIncidenceGraph G + P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3)) (f3 : E) => TreeExitPath P.T P.phi P.a P.b + a3 b3 P3 ∧ ( + ∀ x ∈ P.P1.support, x ∉ P3.support) ∧ ( + ∀ x ∈ P.P2.support, x ∉ P3.support) ∧ P.a1 ≠ a3 ∧ P.a2 ≠ a3 ∧ P.b1 ≠ b3 ∧ P.b2 ≠ b3 ∧ f3 ∈ + BoundaryColorEdges G P.phi (TreeSequenceVertexSet P.T) P.b ∧ Incident G b3 f3 ∧ Sum.inr f3 + ∈ P3.support; + let SecondaryRealized : ℕ → Prop := fun (s : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = d0 ∧ (s = (0 : ℕ) ∧ + P.b ∈ TreeMissingColors P.phi P.T ∨ P.b ∉ TreeMissingColors P.phi P.T ∧ + ∃ (a3 : V) (b3 : V) (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl + b3)) (f3 : E), ThirdPackage P a3 b3 P3 f3 ∧ s = (1 : ℕ) + P.P1.length + P.P2.length + + P3.length); + ∀ (hSecondaryRealized : + ∃ (s : ℕ), SecondaryRealized s), + let s0 : ℕ := Nat.find hSecondaryRealized; ( + ∀ (S : Step1ExitLegPresentation G k e0 n q), S.hierarchy.dividerCount = d0 → + ∀ {a3 b3 : V} (P3 : (TwoColorIncidenceGraph G S.phi S.a S.b).Walk (Sum.inl a3) (Sum.inl b3)) + (f3 : E), S.b ∉ TreeMissingColors S.phi S.T → TreeExitPath S.T S.phi S.a S.b a3 b3 P3 → ( + ∀ x ∈ S.P1.support, x ∉ P3.support) → ( + ∀ x ∈ S.P2.support, x ∉ P3.support) → S.a1 ≠ a3 → S.a2 ≠ a3 → S.b1 ≠ b3 → S.b2 ≠ b3 → + TreeVertexOrder S.T S.b2 b3 → f3 ∈ BoundaryColorEdges G S.phi (TreeSequenceVertexSet S.T) + S.b → Incident G b3 f3 → Sum.inr f3 ∈ P3.support → s0 = (1 : ℕ) + S.P1.length + + S.P2.length + P3.length → Nonempty (Step1ExitLegMinimum G k e0 n q)) → + ∀ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = d0 → P.b ∉ + TreeMissingColors P.phi P.T → + ∀ (a3 b3 : V) (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3)) + (f3 : E), s0 = (1 : ℕ) + P.P1.length + P.P2.length + P3.length → TreeExitPath P.T P.phi + P.a P.b a3 b3 P3 → P.a1 ≠ a3 → P.a2 ≠ a3 → P.b1 ≠ b3 → P.b2 ≠ b3 → f3 ∈ BoundaryColorEdges + G P.phi (TreeSequenceVertexSet P.T) P.b → Incident G b3 f3 → Sum.inr f3 ∈ P3.support → ( + ∀ x ∈ P3.support, x ∉ P.P1.support) → ( + ∀ x ∈ P3.support, x ∉ P.P2.support) → + ∀ (i1 : Fin (P.T.length + (1 : ℕ))), P.T.vertex i1 = P.b1 → + ∀ (i2 : Fin (P.T.length + (1 : ℕ))), P.T.vertex i2 = P.b2 → + ∀ (i3 : Fin (P.T.length + (1 : ℕ))), P.T.vertex i3 = b3 → + ∀ (_ _ : Fin (P.T.length + (1 : ℕ))), (↑i1 : ℕ) < (↑i2 : ℕ) → (↑i3 : ℕ) < (↑i1 : ℕ) → Nonempty + (Step1ExitLegMinimum G k e0 n q) := by + classical + intro V E _ _ _ _ G k e0 n q DividerRealized hDividerRealized d0 hd0_spec ThirdPackage + SecondaryRealized hSecondaryRealized s0 finishPositive P hPdiv hbnot a3 b3 P3 f3 hvalue hP3 + ha13 ha23 hb13 hb23 hf3 hif3 hsf3 h31 h32 i1 hi1 i2 hi2 i3 hi3 j1 j2 hi12 hi31 + let S : Step1ExitLegPresentation G k e0 n q := + { input := P.input + T := P.T + phi := P.phi + ett := P.ett + base := P.base + hierarchy := P.hierarchy + good := P.good + rounds_eq := P.rounds_eq + maximum := P.maximum + divider_lt := P.divider_lt + proper := P.proper + oneUncolored := P.oneUncolored + large := P.large + terminalMinusClosed := P.terminalMinusClosed + a := P.a + b := P.b + a_ne_b := P.a_ne_b + aMissing := P.aMissing + aClosed := P.aClosed + a1 := a3 + b1 := b3 + a2 := P.a1 + b2 := P.b1 + P1 := P3 + P2 := P.P1 + exit1 := hP3 + exit2 := P.exit1 + disjoint12 := h31 + outsideDistinct := ha13.symm + treeDistinct := hb13.symm + treeOrder := ⟨i3, i1, hi3, hi1, hi31⟩ + f1 := f3 + f2 := P.f1 + boundary1 := hf3 + boundary2 := P.boundary1 + incident1 := hif3 + incident2 := P.incident1 + support1 := hsf3 + support2 := P.support1 } + apply finishPositive S (by simpa [S] using hPdiv) + P.P2 P.f2 + · simpa [S] using hbnot + · exact P.exit2 + · exact h32 + · exact P.disjoint12 + · exact ha23.symm + · exact P.outsideDistinct + · exact hb23.symm + · exact P.treeDistinct + · exact ⟨i1, i2, hi1, hi2, hi12⟩ + · exact P.boundary2 + · exact P.incident2 + · exact P.support2 + · dsimp only [S] + omega + +private theorem helper_branch_630.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ), + let DividerRealized : ℕ → Prop := fun (m : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = m; + ∀ (hDividerRealized : + ∃ (m : ℕ), DividerRealized m), + let d0 : ℕ := Nat.find hDividerRealized; DividerRealized d0 → + let ThirdPackage : (P : Step1ExitLegPresentation G k e0 n q) → (a3 b3 : V) → + (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3) → E → Prop := fun + (P : Step1ExitLegPresentation G k e0 n q) (a3 b3 : V) (P3 : (TwoColorIncidenceGraph G + P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3)) (f3 : E) => TreeExitPath P.T P.phi P.a P.b + a3 b3 P3 ∧ ( + ∀ x ∈ P.P1.support, x ∉ P3.support) ∧ ( + ∀ x ∈ P.P2.support, x ∉ P3.support) ∧ P.a1 ≠ a3 ∧ P.a2 ≠ a3 ∧ P.b1 ≠ b3 ∧ P.b2 ≠ b3 ∧ f3 ∈ + BoundaryColorEdges G P.phi (TreeSequenceVertexSet P.T) P.b ∧ Incident G b3 f3 ∧ Sum.inr f3 + ∈ P3.support; + let SecondaryRealized : ℕ → Prop := fun (s : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = d0 ∧ (s = (0 : ℕ) ∧ + P.b ∈ TreeMissingColors P.phi P.T ∨ P.b ∉ TreeMissingColors P.phi P.T ∧ + ∃ (a3 : V) (b3 : V) (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl + b3)) (f3 : E), ThirdPackage P a3 b3 P3 f3 ∧ s = (1 : ℕ) + P.P1.length + P.P2.length + + P3.length); + ∀ (hSecondaryRealized : + ∃ (s : ℕ), SecondaryRealized s), + let s0 : ℕ := Nat.find hSecondaryRealized; ( + ∀ (S : Step1ExitLegPresentation G k e0 n q), S.hierarchy.dividerCount = d0 → + ∀ {a3 b3 : V} (P3 : (TwoColorIncidenceGraph G S.phi S.a S.b).Walk (Sum.inl a3) (Sum.inl b3)) + (f3 : E), S.b ∉ TreeMissingColors S.phi S.T → TreeExitPath S.T S.phi S.a S.b a3 b3 P3 → ( + ∀ x ∈ S.P1.support, x ∉ P3.support) → ( + ∀ x ∈ S.P2.support, x ∉ P3.support) → S.a1 ≠ a3 → S.a2 ≠ a3 → S.b1 ≠ b3 → S.b2 ≠ b3 → + TreeVertexOrder S.T S.b2 b3 → f3 ∈ BoundaryColorEdges G S.phi (TreeSequenceVertexSet S.T) + S.b → Incident G b3 f3 → Sum.inr f3 ∈ P3.support → s0 = (1 : ℕ) + S.P1.length + + S.P2.length + P3.length → Nonempty (Step1ExitLegMinimum G k e0 n q)) → + ∀ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = d0 → P.b ∉ + TreeMissingColors P.phi P.T → + ∀ (a3 b3 : V) (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3)) + (f3 : E), s0 = (1 : ℕ) + P.P1.length + P.P2.length + P3.length → TreeExitPath P.T P.phi + P.a P.b a3 b3 P3 → ( + ∀ x ∈ P.P1.support, x ∉ P3.support) → ( + ∀ x ∈ P.P2.support, x ∉ P3.support) → P.a1 ≠ a3 → P.a2 ≠ a3 → P.b1 ≠ b3 → P.b2 ≠ b3 → f3 ∈ + BoundaryColorEdges G P.phi (TreeSequenceVertexSet P.T) P.b → Incident G b3 f3 → Sum.inr f3 + ∈ P3.support → ( + ∀ x ∈ P3.support, x ∉ P.P2.support) → + ∀ (i1 : Fin (P.T.length + (1 : ℕ))), P.T.vertex i1 = P.b1 → + ∀ (i2 : Fin (P.T.length + (1 : ℕ))), P.T.vertex i2 = P.b2 → + ∀ (i3 : Fin (P.T.length + (1 : ℕ))), P.T.vertex i3 = b3 → + ∀ (j1 j2 : Fin (P.T.length + (1 : ℕ))), (↑j1 : ℕ) < (↑j2 : ℕ) → i1 = j1 → i2 = j2 → (↑i3 : ℕ) + ≠ (↑i1 : ℕ) → (↑i3 : ℕ) ≠ (↑i2 : ℕ) → ¬(↑i3 : ℕ) < (↑i1 : ℕ) → Nonempty + (Step1ExitLegMinimum G k e0 n q) := by + classical + intro V E _ _ _ _ G k e0 n q DividerRealized hDividerRealized d0 hd0_spec ThirdPackage + SecondaryRealized hSecondaryRealized s0 finishPositive P hPdiv hbnot a3 b3 P3 f3 hvalue hP3 + h13 h23 ha13 ha23 hb13 hb23 hf3 hif3 hsf3 h32 i1 hi1 i2 hi2 i3 hi3 j1 j2 hj12 hi1j1 hi2j2 + hi31ne hi32ne hi31 + have hi13 : i1.val < i3.val := by omega + by_cases hi32 : i3.val < i2.val + · let S : Step1ExitLegPresentation G k e0 n q := + { input := P.input + T := P.T + phi := P.phi + ett := P.ett + base := P.base + hierarchy := P.hierarchy + good := P.good + rounds_eq := P.rounds_eq + maximum := P.maximum + divider_lt := P.divider_lt + proper := P.proper + oneUncolored := P.oneUncolored + large := P.large + terminalMinusClosed := P.terminalMinusClosed + a := P.a + b := P.b + a_ne_b := P.a_ne_b + aMissing := P.aMissing + aClosed := P.aClosed + a1 := P.a1 + b1 := P.b1 + a2 := a3 + b2 := b3 + P1 := P.P1 + P2 := P3 + exit1 := P.exit1 + exit2 := hP3 + disjoint12 := h13 + outsideDistinct := ha13 + treeDistinct := hb13 + treeOrder := ⟨i1, i3, hi1, hi3, hi13⟩ + f1 := P.f1 + f2 := f3 + boundary1 := P.boundary1 + boundary2 := hf3 + incident1 := P.incident1 + incident2 := hif3 + support1 := P.support1 + support2 := hsf3 } + apply finishPositive S (by simpa [S] using hPdiv) + P.P2 P.f2 + · simpa [S] using hbnot + · exact P.exit2 + · exact P.disjoint12 + · exact h32 + · exact P.outsideDistinct + · exact ha23.symm + · exact P.treeDistinct + · exact hb23.symm + · exact ⟨i3, i2, hi3, hi2, hi32⟩ + · exact P.boundary2 + · exact P.incident2 + · exact P.support2 + · dsimp only [S] + omega + · have hi23 : i2.val < i3.val := by omega + exact finishPositive P hPdiv P3 f3 hbnot hP3 h13 h23 + ha13 ha23 hb13 hb23 ⟨i2, i3, hi2, hi3, hi23⟩ + hf3 hif3 hsf3 hvalue + +private theorem helper_branch_514.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ), + let DividerRealized : ℕ → Prop := fun (m : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = m; + ∀ (hDividerRealized : + ∃ (m : ℕ), DividerRealized m), + let d0 : ℕ := Nat.find hDividerRealized; DividerRealized d0 → + let ThirdPackage : (P : Step1ExitLegPresentation G k e0 n q) → (a3 b3 : V) → + (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3) → E → Prop := fun + (P : Step1ExitLegPresentation G k e0 n q) (a3 b3 : V) (P3 : (TwoColorIncidenceGraph G + P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl b3)) (f3 : E) => TreeExitPath P.T P.phi P.a P.b + a3 b3 P3 ∧ ( + ∀ x ∈ P.P1.support, x ∉ P3.support) ∧ ( + ∀ x ∈ P.P2.support, x ∉ P3.support) ∧ P.a1 ≠ a3 ∧ P.a2 ≠ a3 ∧ P.b1 ≠ b3 ∧ P.b2 ≠ b3 ∧ f3 ∈ + BoundaryColorEdges G P.phi (TreeSequenceVertexSet P.T) P.b ∧ Incident G b3 f3 ∧ Sum.inr f3 + ∈ P3.support; + let SecondaryRealized : ℕ → Prop := fun (s : ℕ) => + ∃ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = d0 ∧ (s = (0 : ℕ) ∧ + P.b ∈ TreeMissingColors P.phi P.T ∨ P.b ∉ TreeMissingColors P.phi P.T ∧ + ∃ (a3 : V) (b3 : V) (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl + b3)) (f3 : E), ThirdPackage P a3 b3 P3 f3 ∧ s = (1 : ℕ) + P.P1.length + P.P2.length + + P3.length); + ∀ (hSecondaryRealized : + ∃ (s : ℕ), SecondaryRealized s), + let s0 : ℕ := Nat.find hSecondaryRealized; ( + ∀ (S : Step1ExitLegPresentation G k e0 n q), S.hierarchy.dividerCount = d0 → + ∀ {a3 b3 : V} (P3 : (TwoColorIncidenceGraph G S.phi S.a S.b).Walk (Sum.inl a3) (Sum.inl b3)) + (f3 : E), S.b ∉ TreeMissingColors S.phi S.T → TreeExitPath S.T S.phi S.a S.b a3 b3 P3 → ( + ∀ x ∈ S.P1.support, x ∉ P3.support) → ( + ∀ x ∈ S.P2.support, x ∉ P3.support) → S.a1 ≠ a3 → S.a2 ≠ a3 → S.b1 ≠ b3 → S.b2 ≠ b3 → + TreeVertexOrder S.T S.b2 b3 → f3 ∈ BoundaryColorEdges G S.phi (TreeSequenceVertexSet S.T) + S.b → Incident G b3 f3 → Sum.inr f3 ∈ P3.support → s0 = (1 : ℕ) + S.P1.length + + S.P2.length + P3.length → Nonempty (Step1ExitLegMinimum G k e0 n q)) → + ∀ (P : Step1ExitLegPresentation G k e0 n q), P.hierarchy.dividerCount = d0 → (P.b ∉ + TreeMissingColors P.phi P.T ∧ + ∃ (a3 : V) (b3 : V) (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk (Sum.inl a3) (Sum.inl + b3)) (f3 : E), ThirdPackage P a3 b3 P3 f3 ∧ s0 = (1 : ℕ) + P.P1.length + P.P2.length + + P3.length) → Nonempty (Step1ExitLegMinimum G k e0 n q) := by + classical + intro V E _ _ _ _ G k e0 n q DividerRealized hDividerRealized d0 hd0_spec ThirdPackage + SecondaryRealized hSecondaryRealized s0 finishPositive P hPdiv hpositive + rcases hpositive with ⟨hbnot, a3, b3, P3, f3, hthird, hvalue⟩ + dsimp only [ThirdPackage] at hthird + rcases hthird with ⟨hP3, h13, h23, ha13, ha23, hb13, hb23, + hf3, hif3, hsf3⟩ + have h31 : ∀ x, x ∈ P3.support → x ∉ P.P1.support := by + intro x hx3 hx1 + exact h13 x hx1 hx3 + have h32 : ∀ x, x ∈ P3.support → x ∉ P.P2.support := by + intro x hx3 hx2 + exact h23 x hx2 hx3 + have h21 : ∀ x, x ∈ P.P2.support → x ∉ P.P1.support := by + intro x hx2 hx1 + exact P.disjoint12 x hx1 hx2 + have hb1mem : P.b1 ∈ TreeSequenceVertexSet P.T := P.exit1.2.2.2.1 + have hb2mem : P.b2 ∈ TreeSequenceVertexSet P.T := P.exit2.2.2.2.1 + have hb3mem : b3 ∈ TreeSequenceVertexSet P.T := hP3.2.2.2.1 + have hb1pos : ∃ i : Fin (P.T.length + 1), P.T.vertex i = P.b1 := by + simpa [TreeSequenceVertexSet] using hb1mem + have hb2pos : ∃ i : Fin (P.T.length + 1), P.T.vertex i = P.b2 := by + simpa [TreeSequenceVertexSet] using hb2mem + have hb3pos : ∃ i : Fin (P.T.length + 1), P.T.vertex i = b3 := by + simpa [TreeSequenceVertexSet] using hb3mem + obtain ⟨i1, hi1⟩ := hb1pos + obtain ⟨i2, hi2⟩ := hb2pos + obtain ⟨i3, hi3⟩ := hb3pos + rcases P.treeOrder with ⟨j1, j2, hj1, hj2, hj12⟩ + have hi1j1 : i1 = j1 := + P.T.vertex_injective (hi1.trans hj1.symm) + have hi2j2 : i2 = j2 := + P.T.vertex_injective (hi2.trans hj2.symm) + have hi12 : i1.val < i2.val := by omega + have hi31ne : i3.val ≠ i1.val := by + intro h + have heq : i3 = i1 := Fin.ext h + apply hb13 + exact hi1.symm.trans ((congrArg P.T.vertex heq.symm).trans hi3) + have hi32ne : i3.val ≠ i2.val := by + intro h + have heq : i3 = i2 := Fin.ext h + apply hb23 + exact hi2.symm.trans ((congrArg P.T.vertex heq.symm).trans hi3) + by_cases hi31 : i3.val < i1.val + · exact @helper_branch_574 V E inferInstance inferInstance inferInstance inferInstance G k e0 n + q hDividerRealized hd0_spec hSecondaryRealized finishPositive P hPdiv hbnot a3 b3 P3 f3 + hvalue hP3 ha13 ha23 hb13 hb23 hf3 hif3 hsf3 h31 h32 i1 hi1 i2 hi2 i3 hi3 j1 j2 hi12 hi31 + · exact @helper_branch_630 V E inferInstance inferInstance inferInstance inferInstance G k e0 n + q hDividerRealized hd0_spec hSecondaryRealized finishPositive P hPdiv hbnot a3 b3 P3 f3 + hvalue hP3 h13 h23 ha13 ha23 hb13 hb23 hf3 hif3 hsf3 h32 i1 hi1 i2 hi2 i3 hi3 j1 j2 hj12 + hi1j1 hi2j2 hi31ne hi32ne hi31 +theorem Step1ExitLegMinimumExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) + (hfamily : Nonempty (Step1ExitLegPresentation G k e0 n q)) + (helementary : ∀ P : Step1ExitLegPresentation G k e0 n q, + ColoredVertexSetElementary G P.phi (TreeSequenceVertexSet P.T)) : + Nonempty (Step1ExitLegMinimum G k e0 n q) := by + classical + let DividerRealized (m : ℕ) : Prop := + ∃ P : Step1ExitLegPresentation G k e0 n q, + P.hierarchy.dividerCount = m + have hDividerRealized : ∃ m, DividerRealized m := by + rcases hfamily with ⟨P⟩ + exact ⟨P.hierarchy.dividerCount, P, rfl⟩ + let d0 := Nat.find hDividerRealized + have hd0_spec : DividerRealized d0 := Nat.find_spec hDividerRealized + have hd0_min {P : Step1ExitLegPresentation G k e0 n q} : + d0 ≤ P.hierarchy.dividerCount := by + exact Nat.find_min' hDividerRealized ⟨P, rfl⟩ + let ThirdPackage (P : Step1ExitLegPresentation G k e0 n q) + (a3 b3 : V) + (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk + (Sum.inl a3) (Sum.inl b3)) + (f3 : E) : Prop := + TreeExitPath P.T P.phi P.a P.b a3 b3 P3 ∧ + (∀ x, x ∈ P.P1.support → x ∉ P3.support) ∧ + (∀ x, x ∈ P.P2.support → x ∉ P3.support) ∧ + P.a1 ≠ a3 ∧ P.a2 ≠ a3 ∧ + P.b1 ≠ b3 ∧ P.b2 ≠ b3 ∧ + f3 ∈ BoundaryColorEdges G P.phi + (TreeSequenceVertexSet P.T) P.b ∧ + Incident G b3 f3 ∧ Sum.inr f3 ∈ P3.support + let SecondaryRealized (s : ℕ) : Prop := + ∃ P : Step1ExitLegPresentation G k e0 n q, + P.hierarchy.dividerCount = d0 ∧ + ((s = 0 ∧ P.b ∈ TreeMissingColors P.phi P.T) ∨ + (P.b ∉ TreeMissingColors P.phi P.T ∧ + ∃ (a3 b3 : V) + (P3 : (TwoColorIncidenceGraph G P.phi P.a P.b).Walk + (Sum.inl a3) (Sum.inl b3)) + (f3 : E), + ThirdPackage P a3 b3 P3 f3 ∧ + s = 1 + P.P1.length + P.P2.length + P3.length)) + have hSecondaryRealized : ∃ s, SecondaryRealized s := by + rcases hd0_spec with ⟨P, hPdiv⟩ + by_cases hb : P.b ∈ TreeMissingColors P.phi P.T + · exact ⟨0, P, hPdiv, Or.inl ⟨rfl, hb⟩⟩ + · obtain ⟨a3, b3, P3, f3, hP3, h13, h23, ha31, ha32, hb31, + hb32, hf3, hif3, hsf3⟩ := + ElementaryClosedExitPairExtendsTriple G P.T P.phi P.proper + (helementary P) P.a P.b P.a_ne_b P.aMissing P.aClosed hb + P.a1 P.b1 P.a2 P.b2 P.P1 P.P2 P.exit1 P.exit2 + P.disjoint12 P.outsideDistinct P.treeDistinct + refine ⟨1 + P.P1.length + P.P2.length + P3.length, P, hPdiv, + Or.inr ⟨hb, a3, b3, P3, f3, ?_, rfl⟩⟩ + exact ⟨hP3, h13, h23, ha31.symm, ha32.symm, hb31.symm, + hb32.symm, hf3, hif3, hsf3⟩ + let s0 := Nat.find hSecondaryRealized + have hs0_spec : SecondaryRealized s0 := Nat.find_spec hSecondaryRealized + have hs0_min {s : ℕ} (hs : SecondaryRealized s) : s0 ≤ s := + Nat.find_min' hSecondaryRealized hs + let PrimaryMinimal (S : Step1ExitLegPresentation G k e0 n q) : Prop := + ∀ (sigma : PartialEdgeColoring E k) (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 S.ett sigma U), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (S.ett.series.data.tree (Fin.last S.ett.rounds).castSucc) + (TashkinovStoredColors S.ett.series.data (Fin.last S.ett.rounds)) + S.phi sigma → + MaximumProperty corr.replacementETT → + ∀ (baseU : HierarchyBase corr.replacementETT sigma) + (L : TashkinovHierarchy corr.replacementETT baseU) + (goodU : GoodHierarchy L), + L.dividerCount < S.hierarchy.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors L).biUnion + (goodU.gamma (Fin.last L.dividerCount))) → + ∀ (c d : Fin k), c ≠ d → + c ∈ TreeMissingColors sigma U → + TreeColorSetClosed G sigma U {c} → + ∀ (u1 v1 u2 v2 : V) + (Q1 : (TwoColorIncidenceGraph G sigma c d).Walk + (Sum.inl u1) (Sum.inl v1)) + (Q2 : (TwoColorIncidenceGraph G sigma c d).Walk + (Sum.inl u2) (Sum.inl v2)), + TreeExitPath U sigma c d u1 v1 Q1 → + TreeExitPath U sigma c d u2 v2 Q2 → + (∀ x, x ∈ Q1.support → x ∉ Q2.support) → + u1 ≠ u2 → False + have primaryFor := @helper_primaryFor_128 V E inferInstance inferInstance inferInstance + inferInstance G k e0 n q hDividerRealized hd0_spec hd0_min hSecondaryRealized hs0_spec + let SecondaryMinimal (S : Step1ExitLegPresentation G k e0 n q) + {a3 b3 : V} + (P3 : (TwoColorIncidenceGraph G S.phi S.a S.b).Walk + (Sum.inl a3) (Sum.inl b3)) : Prop := + ∀ (sigma : PartialEdgeColoring E k) (U : TreeSequence G e0) + (corr : CorrespondingExtendedTashkinovTree G k e0 S.ett sigma U), + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring + (S.ett.series.data.tree (Fin.last S.ett.rounds).castSucc) + (TashkinovStoredColors S.ett.series.data (Fin.last S.ett.rounds)) + S.phi sigma → + MaximumProperty corr.replacementETT → + ∀ (baseU : HierarchyBase corr.replacementETT sigma) + (L : TashkinovHierarchy corr.replacementETT baseU) + (goodU : GoodHierarchy L), + L.dividerCount = S.hierarchy.dividerCount → + 2 * corr.replacementETT.rounds + 11 ≤ + (TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc)).card → + TreeColorSetMinusClosed G sigma U + ((HierarchyTerminalStoredColors L).biUnion + (goodU.gamma (Fin.last L.dividerCount))) → + ∀ (c d : Fin k), c ≠ d → + c ∈ TreeMissingColors sigma U → + TreeColorSetClosed G sigma U {c} → + ∀ (u1 v1 u2 v2 : V) + (Q1 : (TwoColorIncidenceGraph G sigma c d).Walk + (Sum.inl u1) (Sum.inl v1)) + (Q2 : (TwoColorIncidenceGraph G sigma c d).Walk + (Sum.inl u2) (Sum.inl v2)), + TreeExitPath U sigma c d u1 v1 Q1 → + TreeExitPath U sigma c d u2 v2 Q2 → + (∀ x, x ∈ Q1.support → x ∉ Q2.support) → + u1 ≠ u2 → + (d ∈ TreeMissingColors sigma U ∨ + (d ∉ TreeMissingColors sigma U ∧ + ∃ (u3 v3 : V) + (Q3 : (TwoColorIncidenceGraph G sigma c d).Walk + (Sum.inl u3) (Sum.inl v3)), + TreeExitPath U sigma c d u3 v3 Q3 ∧ + (∀ x, x ∈ Q1.support → x ∉ Q3.support) ∧ + (∀ x, x ∈ Q2.support → x ∉ Q3.support) ∧ + u1 ≠ u3 ∧ u2 ≠ u3 ∧ + Q1.length + Q2.length + Q3.length < + S.P1.length + S.P2.length + P3.length)) → + False + have secondaryFor := @helper_secondaryFor_298 V E inferInstance inferInstance inferInstance + inferInstance G k e0 n q hDividerRealized hd0_spec hSecondaryRealized hs0_spec hs0_min + have finishPositive (S : Step1ExitLegPresentation G k e0 n q) + (hSdiv : S.hierarchy.dividerCount = d0) + {a3 b3 : V} + (P3 : (TwoColorIncidenceGraph G S.phi S.a S.b).Walk + (Sum.inl a3) (Sum.inl b3)) + (f3 : E) + (hbnot : S.b ∉ TreeMissingColors S.phi S.T) + (hP3 : TreeExitPath S.T S.phi S.a S.b a3 b3 P3) + (h13 : ∀ x, x ∈ S.P1.support → x ∉ P3.support) + (h23 : ∀ x, x ∈ S.P2.support → x ∉ P3.support) + (ha13 : S.a1 ≠ a3) (ha23 : S.a2 ≠ a3) + (hb13 : S.b1 ≠ b3) (hb23 : S.b2 ≠ b3) + (horder : TreeVertexOrder S.T S.b2 b3) + (hf3 : f3 ∈ BoundaryColorEdges G S.phi + (TreeSequenceVertexSet S.T) S.b) + (hif3 : Incident G b3 f3) (hsf3 : Sum.inr f3 ∈ P3.support) + (hvalue : s0 = 1 + S.P1.length + S.P2.length + P3.length) : + Nonempty (Step1ExitLegMinimum G k e0 n q) := by + refine ⟨{ + selected := S + elementary := helementary S + primaryMinimal := primaryFor S hSdiv + secondary := Or.inr ⟨hbnot, a3, b3, P3, f3, hP3, h13, h23, + ha13, ha23, hb13, hb23, horder, hf3, hif3, hsf3, + secondaryFor S hSdiv P3 hvalue⟩ }⟩ + rcases hs0_spec with ⟨P, hPdiv, hzero | hpositive⟩ + · refine ⟨{ + selected := P + elementary := helementary P + primaryMinimal := primaryFor P hPdiv + secondary := Or.inl ?_ }⟩ + exact hzero.2 + · exact @helper_branch_514 V E inferInstance inferInstance inferInstance inferInstance G k e0 n + q hDividerRealized hd0_spec hSecondaryRealized finishPositive P hPdiv hpositive +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegPrecoloringElementary.lean b/LeanPool/GoldbergSeymour/Step1ExitLegPrecoloringElementary.lean new file mode 100644 index 0000000000..4bea3515fb --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ExitLegPrecoloringElementary.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor + +public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase + +/-! +# Step1Exit Leg Precoloring Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1ExitLegPrecoloringElementary {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) + (P : Step1ExitLegPresentation G k e0 n q) + (hlowerElementary : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < lower.rounds → lower.rounds < P.ett.rounds → + MaximumProperty lower → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) : + let r : Fin P.ett.rounds := ⟨P.ett.rounds - 1, by + have h := P.ett.roundsPositive + omega⟩ + ColoredVertexSetElementary G + (P.ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet + (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc)) := by + dsimp + by_cases hrounds : P.ett.rounds = 1 + · have hcolor : + (⟨P.ett.rounds - 1, by omega⟩ : Fin (P.ett.rounds + 1)) = 0 := by + apply Fin.ext + simp [hrounds] + have htree : + (Fin.castSucc (Fin.last P.ett.rounds) : Fin (P.ett.rounds + 2)) = + ⟨1, by omega⟩ := by + apply Fin.ext + simp [hrounds] + rw [hcolor, htree] + exact (TechnicalTheoremBase G k P.ett.rounds e0 P.input + P.ett.series).1 + · have hmore : 1 < P.ett.rounds := by + have hpositive := P.ett.roundsPositive + omega + obtain ⟨predecessor, hr, hmaximum, _, _⟩ := + CertifiedETTPredecessor G k e0 P.input P.T P.phi P.ett + P.maximum hmore + have hpositive : 0 < predecessor.rounds := by + rw [hr] + omega + have hlower : predecessor.rounds < P.ett.rounds := by + rw [hr] + omega + have htree : + (Fin.castSucc (Fin.last P.ett.rounds) : Fin (P.ett.rounds + 2)) = + ⟨P.ett.rounds, by omega⟩ := by + apply Fin.ext + rfl + rw [htree] + exact hlowerElementary predecessor hpositive hlower hmaximum + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegPresentation.lean b/LeanPool/GoldbergSeymour/Step1ExitLegPresentation.lean new file mode 100644 index 0000000000..15a993063f --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ExitLegPresentation.lean @@ -0,0 +1,93 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GoodHierarchy + +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors + +public import LeanPool.GoldbergSeymour.MaximumProperty + +/-! +# Step1Exit Leg Presentation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A good hierarchy together with two disjoint ordered exit paths and their boundary edges. -/ +structure Step1ExitLegPresentation {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) where + /-- The initial partial coloring of the extension series. -/ + input : PartialEdgeColoring E k + /-- The underlying ordered tree. -/ + T : TreeSequence G e0 + /-- The generating partial coloring. -/ + phi : PartialEdgeColoring E k + /-- The extended Tashkinov tree underlying the presentation. -/ + ett : ExtendedTashkinovTree G k e0 input T phi + /-- The hierarchy base, or base node when recording a cycle. -/ + base : HierarchyBase ett phi + /-- The hierarchy carried by this presentation. -/ + hierarchy : TashkinovHierarchy ett base + /-- The auxiliary color pairs and their good-hierarchy certificates. -/ + good : GoodHierarchy hierarchy + rounds_eq : ett.rounds = n + maximum : MaximumProperty ett + divider_lt : hierarchy.dividerCount < q + proper : IsProperEdgeColoring G phi + oneUncolored : IsOneEdgeUncolored phi e0 + large : + 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card + terminalMinusClosed : + TreeColorSetMinusClosed G phi T + ((HierarchyTerminalStoredColors hierarchy).biUnion + (good.gamma (Fin.last hierarchy.dividerCount))) + /-- The first color of the two-color exit configuration. -/ + a : Fin k + /-- The second color of the two-color exit configuration. -/ + b : Fin k + a_ne_b : a ≠ b + aMissing : a ∈ TreeMissingColors phi T + aClosed : TreeColorSetClosed G phi T { a } + /-- The outside endpoint of the first exit path. -/ + a1 : V + /-- The inside endpoint of the first exit path. -/ + b1 : V + /-- The outside endpoint of the second exit path. -/ + a2 : V + /-- The inside endpoint of the second exit path. -/ + b2 : V + /-- The first two-color exit walk. -/ + P1 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a1) (Sum.inl b1) + /-- The second two-color exit walk. -/ + P2 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a2) (Sum.inl b2) + exit1 : TreeExitPath T phi a b a1 b1 P1 + exit2 : TreeExitPath T phi a b a2 b2 P2 + disjoint12 : ∀ x, x ∈ P1.support → x ∉ P2.support + outsideDistinct : a1 ≠ a2 + treeDistinct : b1 ≠ b2 + treeOrder : TreeVertexOrder T b1 b2 + /-- The first selected boundary edge. -/ + f1 : E + /-- The second selected boundary edge. -/ + f2 : E + boundary1 : f1 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b + boundary2 : f2 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b + incident1 : Incident G b1 f1 + incident2 : Incident G b2 f2 + support1 : Sum.inr f1 ∈ P1.support + support2 : Sum.inr f2 ∈ P2.support + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegPresentationExists.lean b/LeanPool/GoldbergSeymour/Step1ExitLegPresentationExists.lean new file mode 100644 index 0000000000..0cfc154d3c --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ExitLegPresentationExists.lean @@ -0,0 +1,261 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ElementaryClosedNoninterchangeableExitPair +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeVertexOrder + +/-! +# Step1Exit Leg Presentation Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_orderOr_95.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (H : TashkinovHierarchy ett base) (i : Fin + H.dividerCount) (alpha beta : Fin k), + let r : Fin (H.dividerCount + (1 : ℕ)) := i.succ; + ∀ (a1 b1 a2 b2 : V) (P1 : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a1) (Sum.inl + b1)) (P2 : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a2) (Sum.inl b2)), + TreeExitPath (H.stage r.castSucc) phi alpha beta a1 b1 P1 → TreeExitPath (H.stage + r.castSucc) phi alpha beta a2 b2 P2 → b1 ≠ b2 → TreeVertexOrder (H.stage r.castSucc) b1 b2 + ∨ TreeVertexOrder (H.stage r.castSucc) b2 b1 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base H i alpha beta r a1 b1 a2 b2 P1 P2 exit1 exit2 + treeDistinct + simp only [TreeExitPath] at exit1 exit2 + have hmem1 := exit1.2.2.2.1 + have hmem2 := exit2.2.2.2.1 + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hmem1 hmem2 + rcases hmem1 with ⟨x, hxb1⟩ + rcases hmem2 with ⟨y, hyb2⟩ + have hxy : x ≠ y := by + intro hxy + apply treeDistinct + rw [← hxb1, ← hyb2, hxy] + rcases lt_or_gt_of_ne hxy with hlt | hgt + · left + exact ⟨x, y, hxb1, hyb2, hlt⟩ + · right + exact ⟨y, x, hyb2, hxb1, hgt⟩ + +theorem Step1ExitLegPresentationExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) + (hfewer : ∀ {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → MaximumProperty other → + ∀ (base' : HierarchyBase other generating') + (K : TashkinovHierarchy other base'), + GoodHierarchy K → K.dividerCount < H.dividerCount → + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T')) + (hlarge : 2 * ett.rounds + 11 ≤ + (TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card) + (i : Fin H.dividerCount) (alpha beta : Fin k) + (halpha : alpha ∈ TreeMissingColors phi (H.stage i.succ.castSucc)) + (hne : alpha ≠ beta) + (hclosed : TreeColorSetClosed G phi + (H.stage i.succ.castSucc) {alpha}) + (hnot : ¬ TreeInterchangeable G + (H.stage i.succ.castSucc) phi alpha beta) : + Nonempty (Step1ExitLegPresentation G k e0 ett.rounds H.dividerCount) := by + let r : Fin (H.dividerCount + 1) := i.succ + have hr : 1 ≤ r.val := by + dsimp [r] + omega + obtain ⟨ettPrefix, mpPrefix, roundsPrefix, seriesPrefix, basePrefix, + corePrefix, closurePrefix, positionPrefix, HP, countPrefix, stagesPrefix, + dividersPrefix, goodPrefix, gammaPrefix, terminalPrefix⟩ := + GoodHierarchyPrefixRepackage G k e0 input T phi phi ett hMP base H good r hr + have fewer : HP.dividerCount < H.dividerCount := by + rw [countPrefix] + omega + have elementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (H.stage r.castSucc)) := by + exact hfewer ettPrefix roundsPrefix mpPrefix basePrefix HP goodPrefix fewer + have pair := ElementaryClosedNoninterchangeableExitPair G + (H.stage r.castSucc) phi hproper elementary alpha beta hne halpha hclosed hnot + rcases pair with ⟨a1, b1, a2, b2, P1, P2, f1, f2, + exit1, exit2, disjoint12, outsideDistinct, treeDistinct, + boundary1, boundary2, incident1, incident2, support1, support2⟩ + have largePrefix : 2 * ettPrefix.rounds + 11 ≤ + (TreeMissingColors phi + (ettPrefix.series.data.tree (Fin.last ettPrefix.rounds).castSucc)).card := by + let oldPackage : Sigma (fun n : ℕ => + TashkinovSeries G k n e0 input) := ⟨ett.rounds, ett.series⟩ + let newPackage : Sigma (fun n : ℕ => + TashkinovSeries G k n e0 input) := + ⟨ettPrefix.rounds, ettPrefix.series⟩ + have packageEq : oldPackage = newPackage := by + exact Sigma.ext roundsPrefix.symm seriesPrefix.symm + have transferred : + 2 * newPackage.1 + 11 ≤ + (TreeMissingColors phi + (newPackage.2.data.tree (Fin.last newPackage.1).castSucc)).card := by + rw [← packageEq] + exact hlarge + simpa [oldPackage, newPackage] using transferred + have terminalPrefixClosed : TreeColorSetMinusClosed G phi (H.stage r.castSucc) + ((HierarchyTerminalStoredColors HP).biUnion + (goodPrefix.gamma (Fin.last HP.dividerCount))) := by + have rawStoredEq : + (TashkinovStoredColors ettPrefix.series.data + (Fin.last ettPrefix.rounds) \ + TreeMissingColors phi (H.stage r.castSucc)) = + (TashkinovStoredColors ett.series.data + (Fin.last ett.rounds) \ + TreeMissingColors phi (H.stage r.castSucc)) := by + let oldPackage : Sigma (fun n : ℕ => + TashkinovSeries G k n e0 input) := ⟨ett.rounds, ett.series⟩ + let newPackage : Sigma (fun n : ℕ => + TashkinovSeries G k n e0 input) := + ⟨ettPrefix.rounds, ettPrefix.series⟩ + have hraw := congrArg (fun z => + (TashkinovStoredColors z.2.data (Fin.last z.1) \ + TreeMissingColors phi (H.stage r.castSucc))) + (show oldPackage = newPackage from + Sigma.ext roundsPrefix.symm seriesPrefix.symm) + simpa [oldPackage, newPackage] using hraw.symm + have terminalStoredEq : HierarchyTerminalStoredColors HP = + HierarchyStoredColorsAt H r := by + have hstar : HierarchyStarredStage H r = H.stage r.castSucc := by + dsimp [HierarchyStarredStage, r] + simpa [HierarchyTerminalStoredColors, HierarchyStoredColorsAt, + hstar] using rawStoredEq + have lastGammaEq : goodPrefix.gamma (Fin.last HP.dividerCount) = + good.gamma ⟨r.val - 1, by omega⟩ := by + have hcount : HP.dividerCount + 1 = r.val := by omega + have hidx : Fin.last HP.dividerCount = + Fin.cast hcount.symm ⟨r.val - 1, by omega⟩ := by + apply Fin.ext + simp [countPrefix] + funext eta + have hg := (gammaPrefix ⟨r.val - 1, by omega⟩).2 eta + rw [hidx] + exact hg + rw [terminalStoredEq, lastGammaEq] + exact terminalPrefix + have orderOr : TreeVertexOrder (H.stage r.castSucc) b1 b2 ∨ + TreeVertexOrder (H.stage r.castSucc) b2 b1 := by + apply helper_orderOr_95 <;> assumption + rcases orderOr with orderForward | orderReverse + · refine ⟨{ + input := input + T := H.stage r.castSucc + phi := phi + ett := ettPrefix + base := basePrefix + hierarchy := HP + good := goodPrefix + rounds_eq := roundsPrefix + maximum := mpPrefix + divider_lt := fewer + proper := hproper + oneUncolored := hone + large := largePrefix + terminalMinusClosed := terminalPrefixClosed + a := alpha + b := beta + a_ne_b := hne + aMissing := halpha + aClosed := hclosed + a1 := a1 + b1 := b1 + a2 := a2 + b2 := b2 + P1 := P1 + P2 := P2 + exit1 := exit1 + exit2 := exit2 + disjoint12 := disjoint12 + outsideDistinct := outsideDistinct + treeDistinct := treeDistinct + treeOrder := orderForward + f1 := f1 + f2 := f2 + boundary1 := boundary1 + boundary2 := boundary2 + incident1 := incident1 + incident2 := incident2 + support1 := support1 + support2 := support2 + }⟩ + · refine ⟨{ + input := input + T := H.stage r.castSucc + phi := phi + ett := ettPrefix + base := basePrefix + hierarchy := HP + good := goodPrefix + rounds_eq := roundsPrefix + maximum := mpPrefix + divider_lt := fewer + proper := hproper + oneUncolored := hone + large := largePrefix + terminalMinusClosed := terminalPrefixClosed + a := alpha + b := beta + a_ne_b := hne + aMissing := halpha + aClosed := hclosed + a1 := a2 + b1 := b2 + a2 := a1 + b2 := b1 + P1 := P2 + P2 := P1 + exit1 := exit2 + exit2 := exit1 + disjoint12 := by + intro x hx hbad + exact (disjoint12 x hbad) hx + outsideDistinct := outsideDistinct.symm + treeDistinct := treeDistinct.symm + treeOrder := orderReverse + f1 := f2 + f2 := f1 + boundary1 := boundary2 + boundary2 := boundary1 + incident1 := incident2 + incident2 := incident1 + support1 := support2 + support2 := support1 + }⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegThetaPositive.lean b/LeanPool/GoldbergSeymour/Step1ExitLegThetaPositive.lean new file mode 100644 index 0000000000..0163a3d4bb --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ExitLegThetaPositive.lean @@ -0,0 +1,509 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.Step1ExitLegMinimum +public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment + +/-! +# Step1Exit Leg Theta Positive + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_old_to_prev_274.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) (M : Step1ExitLegMinimum G k e0 n q), + (0 : ℕ) < M.selected.hierarchy.dividerCount → + let H : TashkinovHierarchy M.selected.ett M.selected.base := M.selected.hierarchy; + let d : ℕ := H.dividerCount; + ∀ (hd : (1 : ℕ) ≤ d), + let i : Fin H.dividerCount := (⟨H.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin H.dividerCount); HierarchyStarredStage H (Fin.last d) = H.stage i.succ.castSucc → + TreeSequenceInitialSegment (H.stage i.castSucc.castSucc) (H.stage i.succ.castSucc) → + TreeSequenceInitialSegment (HierarchyStarredStage H i.castSucc) (H.stage i.succ.castSucc) + → TreeSequenceInitialSegment (M.selected.ett.series.data.tree (Fin.last + M.selected.ett.rounds).castSucc) (H.stage i.castSucc.castSucc) → + TreeSequenceInitialSegment (H.stage i.succ.castSucc) M.selected.T → + let stored : Finset (Fin k) := HierarchyStoredColorsAt H i.succ; + let excluded : Finset (Fin k) := stored.biUnion (M.selected.good.gamma i.castSucc); + stored.card ≤ M.selected.ett.rounds → stored ⊆ HierarchyStoredColorsAt H i.castSucc → + excluded.card ≤ (2 : ℕ) * M.selected.ett.rounds → + let forbidden : Finset (Fin k) := { M.selected.a, M.selected.b } ∪ excluded; forbidden.card ≤ + (2 : ℕ) + (2 : ℕ) * M.selected.ett.rounds → + let trunk : TreeSequence G e0 := M.selected.ett.series.data.tree (Fin.last + M.selected.ett.rounds).castSucc; + ∀ theta ∈ TreeMissingColors M.selected.phi trunk \ forbidden, theta ∉ forbidden → theta ∉ + excluded → HierarchyTerminalStoredColors H ⊆ stored → TreeSequenceInitialSegment (H.stage + i.castSucc.castSucc) (HierarchyStarredStage H i.castSucc) := by + classical + intro V E _ _ _ _ G k e0 n q M hpositive H d hd i star_eq old_to_star prev_to_star base_to_old + star_to_terminal stored excluded stored_card stored_old excluded_card forbidden + forbidden_card trunk theta htheta theta_forbidden theta_old terminal_subset + by_cases hone : H.dividerCount = 1 + · have hiz : i = Fin.mk 0 (by omega) := by + apply Fin.ext + simp [i, hone] + subst i + simp only [hone, tsub_self, Fin.castSucc_mk, Fin.zero_eta, Fin.castSucc_zero, + HierarchyStarredStage, + Fin.castSucc_succ, Fin.cases_zero] + rw [H.baseStage] + by_cases hkind : M.selected.ett.series.data.kind + (Fin.last M.selected.ett.rounds) = + some TashkinovExtensionKind.PE + · rcases M.selected.base.parallel hkind with + ⟨_, _, ⟨hunite⟩⟩ + exact hunite.leftSegment + · have hcore := M.selected.base.nonparallel hkind + rw [hcore] + exact ⟨Nat.le_refl _, (fun _ => rfl), (fun _ => rfl)⟩ + · have hiz : i.castSucc ≠ 0 := by + intro hz + have : H.dividerCount = 1 := by + have hi := i.isLt + simp [i] at hz + omega + exact hone this + have hstar : HierarchyStarredStage H i.castSucc = + H.stage i.castSucc.castSucc := by + unfold HierarchyStarredStage + generalize hj : i.castSucc = j + have hjz : j ≠ 0 := by + intro hz + exact hiz (hj.trans hz) + cases j using Fin.cases with + | zero => exact False.elim (hjz rfl) + | succ l => congr 1 + rw [hstar] + exact ⟨Nat.le_refl _, by simp, by simp⟩ + +private theorem helper_branch_326.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) (M : Step1ExitLegMinimum G k e0 n q), + let H : TashkinovHierarchy M.selected.ett M.selected.base := M.selected.hierarchy; + let d : ℕ := H.dividerCount; + ∀ (hd : (1 : ℕ) ≤ d), ( + ∀ {S R W : TreeSequence G e0}, TreeSequenceInitialSegment S R → TreeSequenceInitialSegment R W + → TreeSequenceInitialSegment S W) → + let i : Fin H.dividerCount := (⟨H.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin H.dividerCount); TreeSequenceInitialSegment (H.stage i.castSucc.castSucc) (H.stage + i.succ.castSucc) → TreeSequenceInitialSegment (M.selected.ett.series.data.tree (Fin.last + M.selected.ett.rounds).castSucc) (H.stage i.castSucc.castSucc) → + TreeSequenceInitialSegment (H.stage i.succ.castSucc) M.selected.T → + let stored : Finset (Fin k) := HierarchyStoredColorsAt H i.succ; + let excluded : Finset (Fin k) := stored.biUnion (M.selected.good.gamma i.castSucc); + let trunk : TreeSequence G e0 := M.selected.ett.series.data.tree (Fin.last + M.selected.ett.rounds).castSucc; + ∀ theta ∈ TreeMissingColors M.selected.phi trunk, theta ∉ excluded → + HierarchyTerminalStoredColors H ⊆ stored → ( + ∀ {A B : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → TreeSequenceInitialSegment (H.stage i.castSucc.castSucc) + (HierarchyStarredStage H i.castSucc) → + ∀ (refreshed : Fin k), (M.selected.good.gamma i.succ refreshed ⊆ (TreeSequenceVertexSet + (M.selected.hierarchy.stage i.succ.castSucc) \ TreeSequenceVertexSet + (HierarchyStarredStage M.selected.hierarchy i.castSucc)).biUnion fun (v : V) => + MissingColors G M.selected.phi v) → ( + ∀ theta ∈ HierarchyStoredColorsAt M.selected.hierarchy i.succ, theta ≠ refreshed → + M.selected.good.gamma i.succ theta = M.selected.good.gamma i.castSucc theta) → theta ∉ + (HierarchyTerminalStoredColors M.selected.hierarchy).biUnion (M.selected.good.gamma + (Fin.last M.selected.hierarchy.dividerCount)) := by + classical + intro V E _ _ _ _ G k e0 n q M H d hd segment_trans i old_to_star base_to_old star_to_terminal + stored excluded trunk theta theta_trunk theta_old terminal_subset vertex_subset old_to_prev + refreshed refreshed_sub unchanged hbad + rcases Finset.mem_biUnion.mp hbad with ⟨eta, heta, hgamma⟩ + have hstored : eta ∈ stored := terminal_subset heta + have level_eq : i.succ = Fin.last H.dividerCount := by + apply Fin.ext + simp [i] + omega + rw [← level_eq] at hgamma + by_cases heq : eta = refreshed + · subst eta + rcases Finset.mem_biUnion.mp (refreshed_sub hgamma) with ⟨v, hv, hvtheta⟩ + rcases Finset.mem_sdiff.mp hv with ⟨hvA, hvold⟩ + rcases Finset.mem_biUnion.mp theta_trunk with ⟨u, hu, hutheta⟩ + have hnot : u ≠ v := by + intro huv + subst v + exact hvold (by + apply vertex_subset old_to_prev + apply vertex_subset base_to_old + exact hu) + have old_to_terminal := + segment_trans (segment_trans base_to_old old_to_star) star_to_terminal + have hdj : Disjoint (MissingColors G M.selected.phi u) + (MissingColors G M.selected.phi v) := + M.elementary (vertex_subset old_to_terminal hu) + (vertex_subset star_to_terminal hvA) hnot + exact Finset.disjoint_left.1 hdj hutheta hvtheta + · have he := unchanged eta hstored heq + apply theta_old + apply Finset.mem_biUnion.mpr + exact ⟨eta, hstored, he ▸ hgamma⟩ + +private theorem helper_segment_trans_208.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) (_ : Step1ExitLegMinimum G k e0 n q) + {S R W : TreeSequence G e0}, TreeSequenceInitialSegment S R → TreeSequenceInitialSegment R + W → TreeSequenceInitialSegment S W := by + classical + intro V E _ _ _ _ G k e0 n q M S R W hSR hRW + rcases hSR with ⟨u, hfirst⟩ + rcases hfirst with ⟨hu, he⟩ + rcases hRW with ⟨v, hsecond⟩ + rcases hsecond with ⟨hv, hw⟩ + have htotal : S.length ≤ W.length := by omega + refine ⟨htotal, ?_, ?_⟩ + · intro z + have hz := hu z + have hz' := hv (Fin.castLE (Nat.succ_le_succ u) z) + calc + W.vertex (Fin.castLE (Nat.succ_le_succ htotal) z) = + W.vertex (Fin.castLE (Nat.succ_le_succ v) + (Fin.castLE (Nat.succ_le_succ u) z)) := by + congr 1 + _ = R.vertex (Fin.castLE (Nat.succ_le_succ u) z) := hz' + _ = S.vertex z := hz + · intro z + have hz := hw (Fin.castLE u z) + calc + W.edge (Fin.castLE htotal z) = + W.edge (Fin.castLE v (Fin.castLE u z)) := by + congr 1 + _ = R.edge (Fin.castLE u z) := hz + _ = S.edge z := he z + +private theorem helper_prev_to_star_264.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) (M : Step1ExitLegMinimum G k e0 n q), + (0 : ℕ) < M.selected.hierarchy.dividerCount → + let H : TashkinovHierarchy M.selected.ett M.selected.base := M.selected.hierarchy; + let d : ℕ := H.dividerCount; + ∀ (hd : (1 : ℕ) ≤ d), + let i : Fin H.dividerCount := (⟨H.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin H.dividerCount); HierarchyStarredStage H (Fin.last d) = H.stage i.succ.castSucc → + TreeSequenceInitialSegment (H.stage i.castSucc.castSucc) (H.stage i.succ.castSucc) → + TreeSequenceInitialSegment (HierarchyStarredStage H i.castSucc) (H.stage i.succ.castSucc) + := by + classical + intro V E _ _ _ _ G k e0 n q M hpositive H d hd i star_eq old_to_star + by_cases hdone : H.dividerCount = 1 + · have hiz : i = Fin.mk 0 (by omega) := by + apply Fin.ext + simp [i, hdone] + subst i + simpa [HierarchyStarredStage, hdone] using H.coreInsideFirst + · have hiz : i.castSucc ≠ 0 := by + intro hz + have : H.dividerCount = 1 := by + have hi := i.isLt + simp [i] at hz + omega + exact hdone this + have hstar : HierarchyStarredStage H i.castSucc = + H.stage i.castSucc.castSucc := by + unfold HierarchyStarredStage + generalize hj : i.castSucc = j + have hjz : j ≠ 0 := by + intro hz + apply hiz + exact hj.trans hz + cases j using Fin.cases with + | zero => exact False.elim (hjz rfl) + | succ l => + congr 1 + rw [hstar] + exact H.nested i.castSucc + +private theorem helper_continuation_446.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) (M : Step1ExitLegMinimum G k e0 n q), + (0 : ℕ) < M.selected.hierarchy.dividerCount → ( + ∀ (S R : TreeSequence G e0), TreeSequenceInitialSegment S R → TreeMissingColors M.selected.phi + S ⊆ TreeMissingColors M.selected.phi R) → + let H : TashkinovHierarchy M.selected.ett M.selected.base := M.selected.hierarchy; + let d : ℕ := H.dividerCount; + ∀ (hd : (1 : ℕ) ≤ d), ( + ∀ {S R W : TreeSequence G e0}, TreeSequenceInitialSegment S R → TreeSequenceInitialSegment R W + → TreeSequenceInitialSegment S W) → + let i : Fin H.dividerCount := (⟨H.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin H.dividerCount); HierarchyStarredStage H (Fin.last d) = H.stage i.succ.castSucc → + TreeSequenceInitialSegment (H.stage i.castSucc.castSucc) (H.stage i.succ.castSucc) → + TreeSequenceInitialSegment (HierarchyStarredStage H i.castSucc) (H.stage i.succ.castSucc) + → TreeSequenceInitialSegment (M.selected.ett.series.data.tree (Fin.last + M.selected.ett.rounds).castSucc) (H.stage i.castSucc.castSucc) → + TreeSequenceInitialSegment (H.stage i.succ.castSucc) M.selected.T → + let stored : Finset (Fin k) := HierarchyStoredColorsAt H i.succ; + let excluded : Finset (Fin k) := stored.biUnion (M.selected.good.gamma i.castSucc); + stored.card ≤ M.selected.ett.rounds → stored ⊆ HierarchyStoredColorsAt H i.castSucc → + excluded.card ≤ (2 : ℕ) * M.selected.ett.rounds → + let forbidden : Finset (Fin k) := (insert M.selected.a ({ M.selected.b } : Finset (Fin k)) : + Finset (Fin k)) ∪ excluded; forbidden.card ≤ (2 : ℕ) + (2 : ℕ) * M.selected.ett.rounds → + let trunk : TreeSequence G e0 := M.selected.ett.series.data.tree (Fin.last + M.selected.ett.rounds).castSucc; + ∀ theta ∈ TreeMissingColors M.selected.phi trunk \ forbidden, theta ∈ TreeMissingColors + M.selected.phi trunk → theta ∉ forbidden → theta ≠ M.selected.a → theta ≠ M.selected.b → + theta ∉ excluded → theta ∈ TreeMissingColors M.selected.phi (HierarchyStarredStage H + (Fin.last d)) → TreeColorSetClosed G M.selected.phi (HierarchyStarredStage H (Fin.last d)) + ({ theta } : Finset (Fin k)) → + ∃ (theta : Fin k), theta ≠ M.selected.a ∧ theta ≠ M.selected.b ∧ theta ∈ TreeMissingColors + M.selected.phi (HierarchyStarredStage M.selected.hierarchy (Fin.last + M.selected.hierarchy.dividerCount)) ∧ TreeColorSetClosed G M.selected.phi + (HierarchyStarredStage M.selected.hierarchy (Fin.last M.selected.hierarchy.dividerCount)) + ({ theta } : Finset (Fin k)) ∧ TreeColorSetClosed G M.selected.phi M.selected.T ({ theta } + : Finset (Fin k)) := by + classical + intro V E _ _ _ _ G k e0 n q M hpositive missing_mono H d hd segment_trans i star_eq + old_to_star prev_to_star base_to_old star_to_terminal stored excluded stored_card + stored_old excluded_card forbidden forbidden_card trunk theta htheta theta_trunk + theta_forbidden theta_a theta_b theta_old theta_star theta_closed_star + have terminal_subset : HierarchyTerminalStoredColors H ⊆ stored := by + intro eta heta + simp only [HierarchyTerminalStoredColors, Finset.mem_sdiff] at heta + dsimp [stored] + simp only [HierarchyStoredColorsAt, Finset.mem_sdiff] + refine ⟨heta.1, ?_⟩ + intro hm + apply heta.2 + apply missing_mono (HierarchyStarredStage H i.succ) M.selected.T + star_to_terminal + exact hm + have vertex_subset : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B h v hv + rcases h with ⟨hlen, heq, hedge⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + rcases hv with ⟨j, rfl⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) j, heq j⟩ + have old_to_prev := @helper_old_to_prev_274 V E inferInstance inferInstance inferInstance + inferInstance G k e0 n q M hpositive hd star_eq old_to_star prev_to_star base_to_old + star_to_terminal stored_card stored_old excluded_card forbidden_card theta htheta + theta_forbidden theta_old terminal_subset + obtain ⟨refreshed, refreshed_data, refreshed_unique⟩ := + M.selected.good.uniqueRefresh i + rcases refreshed_data with ⟨refreshed_mem, refreshed_sub, unchanged⟩ + refine ⟨theta, theta_a, theta_b, theta_star, theta_closed_star, ?_⟩ + unfold TreeColorSetClosed + intro alpha halpha + have ha : alpha = theta := Finset.mem_singleton.mp halpha + subst alpha + apply M.selected.terminalMinusClosed theta + simp only [Finset.mem_sdiff] + refine ⟨?_, ?_⟩ + · apply missing_mono (H.stage i.succ.castSucc) M.selected.T + star_to_terminal + rw [← star_eq] + exact theta_star + · exact @helper_branch_326 V E inferInstance inferInstance inferInstance inferInstance G k e0 n + q M hd segment_trans old_to_star base_to_old star_to_terminal theta theta_trunk theta_old + terminal_subset vertex_subset old_to_prev refreshed refreshed_sub unchanged + +lemma Step1ExitLegThetaPositive {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) + (M : Step1ExitLegMinimum G k e0 n q) + (hpositive : 0 < M.selected.hierarchy.dividerCount) : + ∃ theta : Fin k, + theta ≠ M.selected.a ∧ + theta ≠ M.selected.b ∧ + theta ∈ + TreeMissingColors M.selected.phi + (HierarchyStarredStage M.selected.hierarchy + (Fin.last M.selected.hierarchy.dividerCount)) ∧ + TreeColorSetClosed G M.selected.phi + (HierarchyStarredStage M.selected.hierarchy + (Fin.last M.selected.hierarchy.dividerCount)) + { theta } ∧ + TreeColorSetClosed G M.selected.phi M.selected.T { theta } := by + classical + have missing_mono : + ∀ (S R : TreeSequence G e0), TreeSequenceInitialSegment S R → TreeMissingColors M.selected.phi + S ⊆ TreeMissingColors M.selected.phi R := by + intro S R h c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨v, hv, hcv⟩ + rcases h with ⟨hlen, heq, hedge⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + rcases hv with ⟨i, rfl⟩ + refine ⟨R.vertex (Fin.castLE (Nat.succ_le_succ hlen) i), ?_, ?_⟩ + · exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, rfl⟩ + · simpa [heq i] using hcv + let H := M.selected.hierarchy + let d := H.dividerCount + have hd : 1 ≤ d := by + dsimp [d] + exact Nat.one_le_iff_ne_zero.mpr (Nat.ne_of_gt hpositive) + have segment_trans := @helper_segment_trans_208 V E inferInstance inferInstance inferInstance + inferInstance G k e0 n q M + have stage_chain : ∀ (r : ℕ) (hr : r ≤ d + 1), + TreeSequenceInitialSegment (H.stage 0) + (H.stage ⟨r, by omega⟩) := by + intro r hr + induction r with + | zero => exact ⟨Nat.le_refl _, by simp, by simp⟩ + | succ r ih => + change r + 1 ≤ H.dividerCount + 1 at hr + change TreeSequenceInitialSegment (H.stage 0) + (H.stage ⟨r + 1, by omega⟩) + exact segment_trans (ih (by omega)) + (H.nested ⟨r, by omega⟩) + let i : Fin H.dividerCount := ⟨H.dividerCount - 1, by omega⟩ + have last_split : Fin.last H.dividerCount = + (Fin.cast (by omega) (Fin.last (H.dividerCount - 1))).succ := by + apply Fin.ext + change H.dividerCount = (H.dividerCount - 1) + 1 + omega + have star_eq : HierarchyStarredStage H (Fin.last d) = + H.stage i.succ.castSucc := by + dsimp [d] + unfold HierarchyStarredStage + rw [last_split] + simp only [Fin.cases_succ] + congr 1 + have old_to_star : TreeSequenceInitialSegment (H.stage i.castSucc.castSucc) + (H.stage i.succ.castSucc) := by + convert H.nested i.castSucc using 1; congr 1 + have prev_to_star := @helper_prev_to_star_264 V E inferInstance inferInstance inferInstance + inferInstance G k e0 n q M hpositive hd star_eq old_to_star + have base_to_old : TreeSequenceInitialSegment + (M.selected.ett.series.data.tree + (Fin.last M.selected.ett.rounds).castSucc) (H.stage i.castSucc.castSucc) := by + rw [← H.baseStage] + exact stage_chain (d - 1) (by omega) + have star_to_terminal : TreeSequenceInitialSegment + (H.stage i.succ.castSucc) M.selected.T := by + have hend : H.stage (Fin.last (H.dividerCount + 1)) = M.selected.T := + H.terminalStage + have hindex : i.succ.succ = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [i] + omega + have hn := H.nested i.succ + convert hn using 1 + · calc + M.selected.T = H.stage (Fin.last (H.dividerCount + 1)) := hend.symm + _ = H.stage i.succ.succ := congrArg H.stage hindex.symm + let stored : Finset (Fin k) := + HierarchyStoredColorsAt H i.succ + let excluded : Finset (Fin k) := + stored.biUnion (M.selected.good.gamma i.castSucc) + have stored_card : stored.card ≤ M.selected.ett.rounds := by + simpa [stored] using HierarchyStoredColorsCardinality H i.succ + have stored_old : stored ⊆ HierarchyStoredColorsAt H i.castSucc := by + intro eta heta + simp only [stored, HierarchyStoredColorsAt, Finset.mem_sdiff] at heta ⊢ + exact ⟨heta.1, fun hm => heta.2 (missing_mono + (HierarchyStarredStage H i.castSucc) (H.stage i.succ.castSucc) + prev_to_star hm)⟩ + have excluded_card : excluded.card ≤ 2 * M.selected.ett.rounds := by + calc + excluded.card ≤ Finset.sum stored (fun eta => + (M.selected.good.gamma i.castSucc eta).card) := + Finset.card_biUnion_le + _ = Finset.sum stored (fun _ => 2) := by + apply Finset.sum_congr rfl + intro eta heta + exact M.selected.good.twoColors i.castSucc eta (stored_old heta) + _ = 2 * stored.card := by simp [Nat.mul_comm] + _ ≤ 2 * M.selected.ett.rounds := Nat.mul_le_mul_left 2 stored_card + let forbidden : Finset (Fin k) := {M.selected.a, M.selected.b} ∪ excluded + have forbidden_card : forbidden.card ≤ 2 + 2 * M.selected.ett.rounds := by + have hu := Finset.card_union_le ({M.selected.a, M.selected.b} : Finset (Fin k)) excluded + have hp : ({M.selected.a, M.selected.b} : Finset (Fin k)).card ≤ 2 := + Finset.card_le_two + dsimp [forbidden] at * + omega + let trunk := M.selected.ett.series.data.tree + (Fin.last M.selected.ett.rounds).castSucc + have trunk_large : 2 * M.selected.ett.rounds + 11 ≤ (TreeMissingColors M.selected.phi + trunk).card := by + simpa [trunk, H] using M.selected.large + have choice_nonempty : (TreeMissingColors M.selected.phi trunk \ forbidden).Nonempty := by + by_contra hn + have he : TreeMissingColors M.selected.phi trunk \ forbidden = ∅ := + Finset.not_nonempty_iff_eq_empty.mp hn + have hs : TreeMissingColors M.selected.phi trunk ⊆ forbidden := by + intro c hc + by_contra hcf + have : c ∈ TreeMissingColors M.selected.phi trunk \ forbidden := + Finset.mem_sdiff.mpr ⟨hc, hcf⟩ + rw [he] at this + simp at this + have hc := Finset.card_le_card hs + omega + obtain ⟨theta, htheta⟩ := choice_nonempty + have theta_trunk : theta ∈ TreeMissingColors M.selected.phi trunk := + Finset.mem_sdiff.mp htheta |>.1 + have theta_forbidden : theta ∉ forbidden := + Finset.mem_sdiff.mp htheta |>.2 + have theta_a : theta ≠ M.selected.a := by + intro h + apply theta_forbidden + simp [forbidden, h] + have theta_b : theta ≠ M.selected.b := by + intro h + apply theta_forbidden + simp [forbidden, h] + have theta_old : theta ∉ excluded := by + intro h + apply theta_forbidden + exact Finset.mem_union_right _ h + have theta_star : theta ∈ TreeMissingColors M.selected.phi + (HierarchyStarredStage H (Fin.last d)) := by + rw [star_eq] + apply missing_mono (H.stage i.castSucc.castSucc) + (H.stage i.succ.castSucc) old_to_star + apply missing_mono trunk (H.stage i.castSucc.castSucc) + base_to_old + exact theta_trunk + have theta_closed_star : TreeColorSetClosed G M.selected.phi + (HierarchyStarredStage H (Fin.last d)) {theta} := by + rw [star_eq] + have hm := M.selected.good.minusClosed i + unfold TreeColorSetMinusClosed at hm + rw [star_eq] at theta_star + intro alpha halpha + have ha : alpha = theta := Finset.mem_singleton.mp halpha + subst alpha + apply hm theta + simp only [Finset.mem_sdiff] + exact ⟨theta_star, by simpa [excluded, stored] using theta_old⟩ + exact @helper_continuation_446 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@n) (@q) (@M) (@hpositive) (@missing_mono) (@hd) + (@segment_trans) (@star_eq) (@old_to_star) (@prev_to_star) (@base_to_old) + (@star_to_terminal) (@stored_card) (@stored_old) (@excluded_card) (@forbidden_card) + (@theta) (@htheta) (@theta_trunk) (@theta_forbidden) (@theta_a) (@theta_b) (@theta_old) + (@theta_star) (@theta_closed_star) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroNonparallel.lean b/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroNonparallel.lean new file mode 100644 index 0000000000..2ccc32f991 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroNonparallel.lean @@ -0,0 +1,476 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +/-! +# Step1Exit Leg Theta Zero Nonparallel + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_finish_62.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) (P : Step1ExitLegPresentation G k e0 n + q), P.hierarchy.dividerCount = (0 : ℕ) → P.ett.series.data.kind (Fin.last P.ett.rounds) ≠ + some TashkinovExtensionKind.PE → (1 : ℕ) ≤ P.ett.rounds → ( + ∀ c ∈ TreeMissingColors P.phi (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc), + TreeColorSetClosed G P.phi (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc) + { c }) → + ∃ (theta : Fin k), theta ≠ P.a ∧ theta ≠ P.b ∧ theta ∈ TreeMissingColors P.phi + (HierarchyStarredStage P.hierarchy (Fin.last P.hierarchy.dividerCount)) ∧ + TreeColorSetClosed G P.phi (HierarchyStarredStage P.hierarchy (Fin.last + P.hierarchy.dividerCount)) { theta } ∧ TreeColorSetClosed G P.phi P.T { theta } := by + classical + intro V E _ _ _ _ G k e0 n q P hzero hnonparallel hr hclosed + have hcore : P.base.core = + P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc := + P.base.nonparallel hnonparallel + have hstage : HierarchyStarredStage P.hierarchy + (Fin.last P.hierarchy.dividerCount) = P.base.core := by + have hz : Fin.last P.hierarchy.dividerCount = 0 := by + apply Fin.ext + simp [hzero] + rw [hz] + rfl + have hfinal : ∀ c ∈ TreeMissingColors P.phi + (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc), + TreeColorSetClosed G P.phi + (HierarchyStarredStage P.hierarchy + (Fin.last P.hierarchy.dividerCount)) {c} := by + intro c hc + rw [hstage, hcore] + exact hclosed c hc + have hT : TreeSequenceInitialSegment + (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc) P.T := by + convert P.ett.abovePenultimate using 1 + apply congrArg P.ett.series.data.tree + apply Fin.ext + simp + have hmiss : ∀ c ∈ TreeMissingColors P.phi + (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc), + c ∈ TreeMissingColors P.phi P.T := by + intro c hc + unfold TreeMissingColors at hc ⊢ + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + apply Finset.mem_biUnion.mpr + have hv' : v ∈ TreeSequenceVertexSet P.T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + obtain ⟨x, hx⟩ := hv + rcases hT with ⟨hlen, hvertices, hedges⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) x, ?_⟩ + exact (hvertices x).trans hx + exact ⟨v, hv', hvc⟩ + have hD : (HierarchyStoredColorsAt P.hierarchy 0).card ≤ P.ett.rounds := + HierarchyStoredColorsCardinality P.hierarchy 0 + let M := TreeMissingColors P.phi + (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc) + let D := (HierarchyStoredColorsAt P.hierarchy 0).biUnion + (P.good.gamma 0) + have hsub : D ⊆ M := by + intro c hc + obtain ⟨eta, heta, hgc⟩ := Finset.mem_biUnion.mp hc + have hav := P.good.avoidance 0 eta heta hgc + exact (Finset.mem_sdiff.mp hav).1 + have hDcard : D.card ≤ 2 * P.ett.rounds := by + calc + D.card ≤ ∑ eta ∈ HierarchyStoredColorsAt P.hierarchy 0, + (P.good.gamma 0 eta).card := Finset.card_biUnion_le + _ = 2 * (HierarchyStoredColorsAt P.hierarchy 0).card := by + rw [Finset.sum_congr rfl (fun eta heta => P.good.twoColors 0 eta heta)] + simp [Nat.mul_comm] + _ ≤ 2 * P.ett.rounds := Nat.mul_le_mul_left 2 hD + have hUcard : (D ∪ {P.a, P.b}).card ≤ 2 * P.ett.rounds + 2 := by + calc + (D ∪ {P.a, P.b}).card ≤ D.card + ({P.a, P.b} : Finset (Fin k)).card := + Finset.card_union_le D {P.a, P.b} + _ ≤ 2 * P.ett.rounds + 2 := by simp [P.a_ne_b]; omega + have hlarge : 2 * P.ett.rounds + 11 ≤ M.card := by + simpa [M] using P.large + have hnonempty : (M \ (D ∪ {P.a, P.b})).Nonempty := by + apply Finset.card_pos.mp + rw [Finset.card_sdiff] + have hiu : (M ∩ (D ∪ {P.a, P.b})).card ≤ + (D ∪ {P.a, P.b}).card := Finset.card_le_card Finset.inter_subset_right + have hiu' : ((D ∪ {P.a, P.b}) ∩ M).card ≤ + (D ∪ {P.a, P.b}).card := by + simpa [Finset.inter_comm] using hiu + omega + obtain ⟨theta, htheta⟩ := hnonempty + have hthetaM : theta ∈ M := (Finset.mem_sdiff.mp htheta).1 + have hthetaAvoid : theta ∉ D := by + intro ht + exact (Finset.mem_sdiff.mp htheta).2 (Finset.mem_union_left _ ht) + have hthetaA : theta ≠ P.a := by + intro he + exact (Finset.mem_sdiff.mp htheta).2 (Finset.mem_union_right _ (by simp [he])) + have hthetaB : theta ≠ P.b := by + intro he + exact (Finset.mem_sdiff.mp htheta).2 (Finset.mem_union_right _ (by simp [he])) + have htermD : (HierarchyTerminalStoredColors P.hierarchy).biUnion + (P.good.gamma (Fin.last P.hierarchy.dividerCount)) ⊆ D := by + intro c hc + obtain ⟨eta, heta, hgc⟩ := Finset.mem_biUnion.mp hc + have heta' := heta + change eta ∈ TashkinovStoredColors P.ett.series.data (Fin.last P.ett.rounds) \ + TreeMissingColors P.phi P.T at heta' + apply Finset.mem_biUnion.mpr + refine ⟨eta, ?_, ?_⟩ + · have hetaParts := Finset.mem_sdiff.mp heta' + refine Finset.mem_sdiff.mpr ⟨hetaParts.1, ?_⟩ + exact fun hxm => hetaParts.2 (hmiss eta (by + simpa [hstage, hcore, HierarchyStarredStage] using hxm)) + · have hz : Fin.last P.hierarchy.dividerCount = 0 := by + apply Fin.ext + simp [hzero] + simpa [hz] using hgc + have hthetaTerm : theta ∈ TreeMissingColors P.phi P.T := hmiss theta hthetaM + have htermClosed : TreeColorSetClosed G P.phi P.T {theta} := by + unfold TreeColorSetClosed + intro c hc + have hct : c = theta := Finset.mem_singleton.mp hc + subst c + apply P.terminalMinusClosed + · exact Finset.mem_sdiff.mpr ⟨hthetaTerm, fun hd => hthetaAvoid (htermD hd) + ⟩ + have hthetaStage : theta ∈ TreeMissingColors P.phi + (HierarchyStarredStage P.hierarchy + (Fin.last P.hierarchy.dividerCount)) := by + rw [hstage, hcore] + exact hthetaM + exact ⟨theta, hthetaA, hthetaB, hthetaStage, + hfinal theta hthetaM, htermClosed⟩ + +private theorem helper_branch_197.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) (P : Step1ExitLegPresentation G k e0 + n q), P.ett.series.data.kind (Fin.last P.ett.rounds) ≠ some TashkinovExtensionKind.PE → + ∀ (hr : (1 : ℕ) ≤ P.ett.rounds), + let i : Fin P.ett.rounds := (⟨P.ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬P.ett.rounds - (1 : ℕ) < P.ett.rounds) => + by + omega + ⟩ : Fin P.ett.rounds); i.succ = Fin.last P.ett.rounds → (( + ∀ c ∈ TreeMissingColors P.phi (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc), + TreeColorSetClosed G P.phi (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc) + { c }) → + ∃ (theta : Fin k), theta ≠ P.a ∧ theta ≠ P.b ∧ theta ∈ TreeMissingColors P.phi + (HierarchyStarredStage P.hierarchy (Fin.last P.hierarchy.dividerCount)) ∧ + TreeColorSetClosed G P.phi (HierarchyStarredStage P.hierarchy (Fin.last + P.hierarchy.dividerCount)) { theta } ∧ TreeColorSetClosed G P.phi P.T { theta }) → + ∀ (ci : Fin P.ett.rounds), IsProperEdgeColoring G (P.ett.series.data.coloring ci.castSucc) → + IsOneEdgeUncolored (P.ett.series.data.coloring ci.castSucc) e0 → ColoredVertexSetClosed G + (P.ett.series.data.coloring ci.castSucc) (TreeSequenceVertexSet (P.ett.series.data.tree + ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (P.ett.series.data.coloring + ci.castSucc) (TreeSequenceVertexSet (P.ett.series.data.tree ci.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate P.ett.series.data ci.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (P.ett.series.data.tree ci.succ.castSucc) + (TashkinovStoredColors P.ett.series.data ci.castSucc) (P.ett.series.data.coloring + ci.castSucc)), ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (P.ett.series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors P.ett.series.data ci.castSucc)) choice.selected pi → Disjoint + (MissingColors G pi choice.otherEndpoint) (TreeMissingColors pi (P.ett.series.data.tree + ci.succ.castSucc))) → P.ett.series.data.coloring ci.succ = choice.selected → + P.ett.series.data.stored ci.succ = { choice.color } → P.ett.series.data.connectingEdges + ci.succ = { choice.edge } → P.ett.series.data.kind ci.succ = some + TashkinovExtensionKind.SE → P.ett.series.data.chosenVertex ci.succ = some choice.vertex → + P.ett.series.data.outsideVertex ci.succ = some choice.otherEndpoint → + P.ett.series.data.delta ci.succ = some choice.color → P.ett.series.data.gamma ci.succ = + none → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (P.ett.series.data.tree + ci.succ.castSucc) choice.edge adjoined → TashkinovClosure (P.ett.series.data.coloring + ci.succ) adjoined (P.ett.series.data.tree ci.succ.succ) → TreeSequenceInitialSegment + (P.ett.series.data.tree ci.succ.castSucc) (P.ett.series.data.tree ci.succ.succ) → + (P.ett.series.data.tree ci.succ.castSucc).length < (P.ett.series.data.tree + ci.succ.succ).length → i.succ = ci.succ → + ∃ (theta : Fin k), theta ≠ P.a ∧ theta ≠ P.b ∧ theta ∈ TreeMissingColors P.phi + (HierarchyStarredStage P.hierarchy (Fin.last P.hierarchy.dividerCount)) ∧ + TreeColorSetClosed G P.phi (HierarchyStarredStage P.hierarchy (Fin.last + P.hierarchy.dividerCount)) { theta } ∧ TreeColorSetClosed G P.phi P.T { theta } := by + classical + intro V E _ _ _ _ G k e0 n q P hnonparallel hr i hi finish ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternative currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension hs + have hci : ci = i := by + apply Fin.ext + have hv := congrArg Fin.val hs + simp at hv + omega + subst ci + have hkind : P.ett.series.data.kind (Fin.last P.ett.rounds) ≠ + some TashkinovExtensionKind.PE := hnonparallel + have htree : P.ett.series.data.tree i.succ.castSucc = + P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc := by rw [hi] + have hclosed : ∀ c ∈ TreeMissingColors P.phi + (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc), + TreeColorSetClosed G P.phi + (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc) {c} := by + intro c hc + unfold TreeColorSetClosed + intro d hd + have hdc : d = c := Finset.mem_singleton.mp hd + subst d + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + have hf' : f ∈ BoundaryEdges G + (TreeSequenceVertexSet (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc)) ∧ + P.phi f = some c := by simpa [BoundaryColorEdges] using hf + have hfb : f ∈ BoundaryEdges G + (TreeSequenceVertexSet (P.ett.series.data.tree i.succ.castSucc)) := by + rw [htree] + exact hf'.1 + have hfu : ∃ u ∈ TreeSequenceVertexSet + (P.ett.series.data.tree i.succ.castSucc), ∃ v ∉ + TreeSequenceVertexSet (P.ett.series.data.tree i.succ.castSucc), + G.ends f = s(u, v) := by simpa [BoundaryEdges] using hfb + obtain ⟨u, hu, v, hv, huv⟩ := hfu + have hcPrior := hc + rw [← htree] at hcPrior + obtain ⟨w, hw, hwm⟩ := Finset.mem_biUnion.mp + (by simpa [TreeMissingColors] using hcPrior) + have hstable := choice.selectedStable + let left : {psi : _ // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨P.ett.series.data.coloring i.castSucc, previousProper, previousOneUncolored⟩ + let right : {psi : _ // + IsProperEdgeColoring G psi ∧ IsOneEdgeUncolored psi e0} := + ⟨choice.selected, choice.selectedProper, choice.selectedOneUncolored⟩ + have hstableRev : StableColoring + (P.ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors P.ett.series.data i.castSucc) + choice.selected (P.ett.series.data.coloring i.castSucc) := by + have hab : StableColoring + (P.ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors P.ett.series.data i.castSucc) + left.1 right.1 := by simpa [left, right] using hstable + have hba := (sc2 G e0 (P.ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors P.ett.series.data i.castSucc)).symm hab + simpa [left, right] using hba + have htreeIncident : TreeIncidentEdge + (P.ett.series.data.tree i.succ.castSucc) f := by + refine ⟨u, hu, ?_⟩ + unfold Incident + rw [huv] + exact Sym2.mem_iff.mpr (Or.inl rfl) + have hselectedColor : choice.selected f = some c := by + rw [← currentColoring, hi, ← P.ett.generatingColoring] + exact hf'.2 + have hmissingSelected : c ∈ TreeMissingColors choice.selected + (P.ett.series.data.tree i.succ.castSucc) := by + unfold TreeMissingColors + obtain ⟨w, hw, hwm⟩ := Finset.mem_biUnion.mp + (by simpa [TreeMissingColors] using hcPrior) + apply Finset.mem_biUnion.mpr + refine ⟨w, hw, ?_⟩ + rw [P.ett.generatingColoring, ← hi, currentColoring] at hwm + exact hwm + have hmissingSelectedAt : c ∈ MissingColors G choice.selected w := by + rw [P.ett.generatingColoring, ← hi, currentColoring] at hwm + exact hwm + have hmissingPiAt : c ∈ MissingColors G + (P.ett.series.data.coloring i.castSucc) w := by + exact (hstable.2 w hw).symm ▸ hmissingSelectedAt + have hmissingPi : c ∈ TreeMissingColors + (P.ett.series.data.coloring i.castSucc) + (P.ett.series.data.tree i.succ.castSucc) := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨w, hw, hmissingPiAt⟩ + have hpiColor : (P.ett.series.data.coloring i.castSucc) f = some c := by + exact (hstableRev.1 f htreeIncident + ⟨c, Finset.mem_union_left _ hmissingSelected, hselectedColor⟩).trans + hselectedColor + have hcf := previousClosed hfb hw hpiColor + have hcm : c ∈ MissingColors G (P.ett.series.data.coloring i.castSucc) w := by + exact hmissingPiAt + exact hcf hcm + exact finish hclosed + +private theorem helper_branch_301.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) (P : Step1ExitLegPresentation G k e0 + n q) (hr : (1 : ℕ) ≤ P.ett.rounds), + let i : Fin P.ett.rounds := (⟨P.ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬P.ett.rounds - (1 : ℕ) < P.ett.rounds) => + by + omega + ⟩ : Fin P.ett.rounds); i.succ = Fin.last P.ett.rounds → (( + ∀ c ∈ TreeMissingColors P.phi (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc), + TreeColorSetClosed G P.phi (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc) + { c }) → + ∃ (theta : Fin k), theta ≠ P.a ∧ theta ≠ P.b ∧ theta ∈ TreeMissingColors P.phi + (HierarchyStarredStage P.hierarchy (Fin.last P.hierarchy.dividerCount)) ∧ + TreeColorSetClosed G P.phi (HierarchyStarredStage P.hierarchy (Fin.last + P.hierarchy.dividerCount)) { theta } ∧ TreeColorSetClosed G P.phi P.T { theta }) → + ∀ (ci : Fin P.ett.rounds), IsProperEdgeColoring G (P.ett.series.data.coloring ci.castSucc) → + IsOneEdgeUncolored (P.ett.series.data.coloring ci.castSucc) e0 → ColoredVertexSetClosed G + (P.ett.series.data.coloring ci.castSucc) (TreeSequenceVertexSet (P.ett.series.data.tree + ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (P.ett.series.data.coloring + ci.castSucc) (TreeSequenceVertexSet (P.ett.series.data.tree ci.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate P.ett.series.data ci.castSucc), + P.ett.series.data.coloring ci.succ = P.ett.series.data.coloring ci.castSucc → + P.ett.series.data.stored ci.succ = { available.delta, available.gamma } → + P.ett.series.data.connectingEdges ci.succ = { available.edge } → P.ett.series.data.kind + ci.succ = some TashkinovExtensionKind.RE → P.ett.series.data.chosenVertex ci.succ = some + available.insideEndpoint → P.ett.series.data.outsideVertex ci.succ = some + available.outsideEndpoint → P.ett.series.data.delta ci.succ = some available.delta → + P.ett.series.data.gamma ci.succ = some available.gamma → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (P.ett.series.data.tree + ci.succ.castSucc) available.edge adjoined → TashkinovClosure (P.ett.series.data.coloring + ci.succ) adjoined (P.ett.series.data.tree ci.succ.succ) → TreeSequenceInitialSegment + (P.ett.series.data.tree ci.succ.castSucc) (P.ett.series.data.tree ci.succ.succ) → + (P.ett.series.data.tree ci.succ.castSucc).length < (P.ett.series.data.tree + ci.succ.succ).length → i.succ = ci.succ → + ∃ (theta : Fin k), theta ≠ P.a ∧ theta ≠ P.b ∧ theta ∈ TreeMissingColors P.phi + (HierarchyStarredStage P.hierarchy (Fin.last P.hierarchy.dividerCount)) ∧ + TreeColorSetClosed G P.phi (HierarchyStarredStage P.hierarchy (Fin.last + P.hierarchy.dividerCount)) { theta } ∧ TreeColorSetClosed G P.phi P.T { theta } := by + classical + intro V E _ _ _ _ G k e0 n q P hr i hi finish ci previousProper previousOneUncolored + previousClosed previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension hs + have hci : ci = i := by + apply Fin.ext + have hv := congrArg Fin.val hs + simp at hv + omega + subst ci + have htree : P.ett.series.data.tree i.succ.castSucc = + P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc := by rw [hi] + have hclosed : ∀ c ∈ TreeMissingColors P.phi + (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc), + TreeColorSetClosed G P.phi + (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc) {c} := by + intro c hc + unfold TreeColorSetClosed + intro d hd + have hdc : d = c := Finset.mem_singleton.mp hd + subst d + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + have hf' : f ∈ BoundaryEdges G + (TreeSequenceVertexSet (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc)) ∧ + P.phi f = some c := by simpa [BoundaryColorEdges] using hf + have hfb : f ∈ BoundaryEdges G + (TreeSequenceVertexSet (P.ett.series.data.tree i.succ.castSucc)) := by + rw [htree] + exact hf'.1 + have hfu : ∃ u ∈ TreeSequenceVertexSet + (P.ett.series.data.tree i.succ.castSucc), ∃ v ∉ + TreeSequenceVertexSet (P.ett.series.data.tree i.succ.castSucc), + G.ends f = s(u, v) := by simpa [BoundaryEdges] using hfb + obtain ⟨u, hu, v, hv, huv⟩ := hfu + obtain ⟨w, hw, hwm⟩ := Finset.mem_biUnion.mp + (by simpa [TreeMissingColors] using (show c ∈ + TreeMissingColors P.phi + (P.ett.series.data.tree i.succ.castSucc) by + rw [htree] + exact hc)) + have hcm : c ∈ MissingColors G + (P.ett.series.data.coloring i.castSucc) w := by + rw [P.ett.generatingColoring, ← hi, currentColoring] at hwm + exact hwm + have hcol : (P.ett.series.data.coloring i.castSucc) f = some c := by + rw [← currentColoring, hi, ← P.ett.generatingColoring] + exact hf'.2 + exact (previousClosed hfb hw hcol) hcm + exact finish hclosed + +lemma Step1ExitLegThetaZeroNonparallel {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) + (P : Step1ExitLegPresentation G k e0 n q) + (hzero : P.hierarchy.dividerCount = 0) + (hnonparallel : P.ett.series.data.kind (Fin.last P.ett.rounds) ≠ + some TashkinovExtensionKind.PE) : + ∃ theta : Fin k, + theta ≠ P.a ∧ + theta ≠ P.b ∧ + theta ∈ + TreeMissingColors P.phi + (HierarchyStarredStage P.hierarchy (Fin.last P.hierarchy.dividerCount)) ∧ + TreeColorSetClosed G P.phi + (HierarchyStarredStage P.hierarchy (Fin.last P.hierarchy.dividerCount)) + { theta } ∧ + TreeColorSetClosed G P.phi P.T { theta } := by + classical + have hr := P.ett.roundsPositive + let i : Fin P.ett.rounds := ⟨P.ett.rounds - 1, by omega⟩ + have hi : i.succ = Fin.last P.ett.rounds := by + ext + simp [i] + omega + have finish := @helper_finish_62 V E inferInstance inferInstance inferInstance inferInstance G k + e0 n q P hzero hnonparallel hr + have hcert := P.ett.series.certified i.succ + generalize hs : i.succ = slot at hcert + cases hcert with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero i hs).elim + | SE ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_197 V E inferInstance inferInstance inferInstance inferInstance G k e0 + n q P hnonparallel hr hi finish ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative currentColoring + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension strictExtension hs + | PE ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension => + have hkind := currentKind + have hci : ci = i := by + apply Fin.ext + have hv := congrArg Fin.val hs + simp at hv + omega + subst ci + rw [hi] at hkind + exact (hnonparallel hkind).elim + | RE ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed available + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_301 V E inferInstance inferInstance inferInstance inferInstance G k e0 + n q P hr hi finish ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension hs +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroParallel.lean b/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroParallel.lean new file mode 100644 index 0000000000..3d6a915281 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroParallel.lean @@ -0,0 +1,204 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality + +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation + +/-! +# Step1Exit Leg Theta Zero Parallel + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1ExitLegThetaZeroParallel {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (n q : ℕ) + (P : Step1ExitLegPresentation G k e0 n q) + (hzero : P.hierarchy.dividerCount = 0) + (hparallel : P.ett.series.data.kind (Fin.last P.ett.rounds) = + some TashkinovExtensionKind.PE) + (hpre : + let r : Fin P.ett.rounds := ⟨P.ett.rounds - 1, by + have h := P.ett.roundsPositive + omega⟩ + ColoredVertexSetElementary G + (P.ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet + (P.ett.series.data.tree (Fin.last P.ett.rounds).castSucc))) : + ∃ theta : Fin k, + theta ≠ P.a ∧ theta ≠ P.b ∧ + theta ∈ TreeMissingColors P.phi + (HierarchyStarredStage P.hierarchy + (Fin.last P.hierarchy.dividerCount)) ∧ + TreeColorSetClosed G P.phi + (HierarchyStarredStage P.hierarchy + (Fin.last P.hierarchy.dividerCount)) {theta} ∧ + TreeColorSetClosed G P.phi P.T {theta} := by + classical + have hrounds : 0 < P.ett.rounds := Nat.lt_of_lt_of_le Nat.zero_lt_one P.ett.roundsPositive + have hbase := P.good.parallelBase + dsimp at hbase + have hbound := hbase hparallel |>.2 + let n : Fin (P.ett.rounds + 1) := Fin.last P.ett.rounds + let X : TreeSequence G e0 := P.ett.series.data.tree n.castSucc + let S : Finset (Fin k) := + (TreeMissingColors P.phi X ∩ TreeMissingColors P.phi P.base.closure) \ + ((HierarchyStoredColorsAt P.hierarchy 0).biUnion (P.good.gamma 0)) + have hScard : 4 ≤ S.card := by simpa [S, X, n] using hbound + have hnotall : ∃ theta ∈ S, theta ≠ P.a ∧ theta ≠ P.b := by + by_contra h + push Not at h + have hsub : S ⊆ ({P.a, P.b} : Finset (Fin k)) := by + intro theta htheta + simp only [Finset.mem_insert, Finset.mem_singleton] + by_cases hta : theta = P.a + · exact Or.inl hta + · exact Or.inr ((h theta htheta) hta) + have hcard : S.card ≤ 2 := by + calc + S.card ≤ ({P.a, P.b} : Finset (Fin k)).card := Finset.card_le_card hsub + _ ≤ 2 := by simp [P.a_ne_b] + omega + obtain ⟨theta, hthetaS, hthetaA, hthetaB⟩ := hnotall + change theta ∈ + (TreeMissingColors P.phi X ∩ TreeMissingColors P.phi P.base.closure) \ + ((HierarchyStoredColorsAt P.hierarchy 0).biUnion (P.good.gamma 0)) at hthetaS + have hthetaSplit := hthetaS + simp only [Finset.mem_sdiff, Finset.mem_inter] at hthetaSplit + have hthetaMissingX : theta ∈ TreeMissingColors P.phi X := hthetaSplit.1.1 + have hthetaMissingClosure : theta ∈ TreeMissingColors P.phi P.base.closure := + hthetaSplit.1.2 + have hthetaNotInitialStored : theta ∉ + (HierarchyStoredColorsAt P.hierarchy 0).biUnion (P.good.gamma 0) := + hthetaSplit.2 + have hphi : P.phi = P.ett.series.data.coloring (Fin.last P.ett.rounds) := + P.ett.generatingColoring + have hcommon := ParallelCommonMissingClosed G k e0 P.input P.T P.phi P.phi + P.ett hrounds P.base hphi hparallel hpre + have hcore : TreeColorSetClosed G P.phi P.base.core + (TreeMissingColors P.phi X ∩ TreeMissingColors P.phi P.base.closure) := by + simpa [X, n] using hcommon + have hordered : Nonempty (OrderedTreeUnion X P.base.closure P.base.core) := by + simpa [X, n] using (P.base.parallel hparallel).2.2 + obtain ⟨ordered⟩ := hordered + have hcoreSet : TreeSequenceVertexSet P.base.core = + TreeSequenceVertexSet X ∪ TreeSequenceVertexSet P.base.closure := + ordered.vertexSet + have hXsub : TreeSequenceVertexSet X ⊆ TreeSequenceVertexSet P.base.core := by + rw [hcoreSet] + exact Finset.subset_union_left + have hmissingCore : TreeMissingColors P.phi X ⊆ + TreeMissingColors P.phi P.base.core := by + intro c hc + unfold TreeMissingColors at hc ⊢ + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + apply Finset.mem_biUnion.mpr + exact ⟨v, hXsub hv, hvc⟩ + have hthetaCore : theta ∈ TreeMissingColors P.phi P.base.core := + hmissingCore hthetaMissingX + have hstar : HierarchyStarredStage P.hierarchy + (Fin.last P.hierarchy.dividerCount) = P.base.core := by + have hlast : Fin.last P.hierarchy.dividerCount = + (⟨0, by omega⟩ : Fin (P.hierarchy.dividerCount + 1)) := by + apply Fin.ext + simp [hzero] + rw [hlast] + rfl + have hthetaStar : theta ∈ TreeMissingColors P.phi + (HierarchyStarredStage P.hierarchy (Fin.last P.hierarchy.dividerCount)) := by + simpa [hstar] using hthetaCore + have hclosedStar : TreeColorSetClosed G P.phi + (HierarchyStarredStage P.hierarchy (Fin.last P.hierarchy.dividerCount)) {theta} := by + rw [hstar] + unfold TreeColorSetClosed at hcore ⊢ + intro c hc + apply hcore c + have hct : c = theta := Finset.mem_singleton.mp hc + subst c + exact Finset.mem_inter.mpr ⟨hthetaMissingX, hthetaMissingClosure⟩ + refine ⟨theta, hthetaA, hthetaB, hthetaStar, hclosedStar, ?_⟩ + have initialSubset : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hab x hx + unfold TreeSequenceVertexSet at hx ⊢ + simp only [Finset.mem_image] at hx ⊢ + obtain ⟨i, hi, rfl⟩ := hx + obtain ⟨hlen, hvertices, hedges⟩ := hab + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, ?_⟩ + exact hvertices i + have hXterm : TreeSequenceVertexSet X ⊆ TreeSequenceVertexSet P.T := by + apply initialSubset + have hidx : (⟨P.ett.rounds, by omega⟩ : Fin (P.ett.rounds + 2)) = + (Fin.last P.ett.rounds).castSucc := by apply Fin.ext; rfl + simpa [X, n, hidx] using P.ett.abovePenultimate + have hthetaTerminal : theta ∈ TreeMissingColors P.phi P.T := by + unfold TreeMissingColors at hthetaMissingX ⊢ + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hthetaMissingX + apply Finset.mem_biUnion.mpr + exact ⟨v, hXterm hv, hvc⟩ + have hterm := P.terminalMinusClosed + unfold TreeColorSetMinusClosed at hterm + have hterminalStored : (HierarchyTerminalStoredColors P.hierarchy).biUnion + (P.good.gamma (Fin.last P.hierarchy.dividerCount)) ⊆ + (HierarchyStoredColorsAt P.hierarchy 0).biUnion (P.good.gamma 0) := by + have hcoreTerm : TreeSequenceVertexSet P.base.core ⊆ + TreeSequenceVertexSet P.T := by + apply initialSubset + have hstage : P.hierarchy.stage + (⟨1, by omega⟩ : Fin (P.hierarchy.dividerCount + 2)) = P.T := by + have hidx : (⟨1, by omega⟩ : Fin (P.hierarchy.dividerCount + 2)) = + Fin.last (P.hierarchy.dividerCount + 1) := by + apply Fin.ext + simp [hzero] + exact congrArg P.hierarchy.stage hidx |>.trans P.hierarchy.terminalStage + have hinside := P.hierarchy.coreInsideFirst + rw [hstage] at hinside + exact hinside + have hmissingCoreTerm : TreeMissingColors P.phi P.base.core ⊆ + TreeMissingColors P.phi P.T := by + intro c hc + unfold TreeMissingColors at hc ⊢ + obtain ⟨v, hv, hvc⟩ := Finset.mem_biUnion.mp hc + apply Finset.mem_biUnion.mpr + exact ⟨v, hcoreTerm hv, hvc⟩ + intro c hc + simp only [HierarchyTerminalStoredColors, HierarchyStoredColorsAt] at hc ⊢ + simp only [Finset.mem_biUnion] at hc ⊢ + obtain ⟨x, hx, hcx⟩ := hc + refine ⟨x, ?_, ?_⟩ + · simp only [Finset.mem_sdiff] at hx ⊢ + exact ⟨hx.1, fun hmiss => hx.2 (hmissingCoreTerm hmiss)⟩ + · have hlast : Fin.last P.hierarchy.dividerCount = + (⟨0, by omega⟩ : Fin (P.hierarchy.dividerCount + 1)) := by + apply Fin.ext + simp [hzero] + simpa [hlast] using hcx + have hthetaNotStored : theta ∉ + (HierarchyTerminalStoredColors P.hierarchy).biUnion + (P.good.gamma (Fin.last P.hierarchy.dividerCount)) := by + intro ht + apply hthetaSplit.2 + exact hterminalStored ht + unfold TreeColorSetClosed at hterm ⊢ + intro c hc + apply hterm c + simp only [Finset.mem_singleton] at hc + subst c + exact Finset.mem_sdiff.mpr ⟨hthetaTerminal, hthetaNotStored⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchor.lean b/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchor.lean new file mode 100644 index 0000000000..1f5cbb3cf1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchor.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchorNonPE +public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchorPE + +/-! +# Step1Zero Divider Anchor + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma Step1ZeroDividerAnchor {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) + (hdividerZero : H.dividerCount = 0) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (halpha : alpha ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hclosed : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {alpha}) + (a₁ b₁ a₂ b₂ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (hP₁ : TreeExitPath + (HierarchyStarredStage H (Fin.last H.dividerCount)) + phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath + (HierarchyStarredStage H (Fin.last H.dividerCount)) + phi alpha beta a₂ b₂ P₂) + (hpaths : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (ha : a₁ ≠ a₂) : False := by + by_cases hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · exact Step1ZeroDividerAnchorPE G k e0 input T phi ett hMP hpositive + hproper hone hlower base H hdividerZero alpha beta hne halpha hclosed + a₁ b₁ a₂ b₂ P₁ P₂ hP₁ hP₂ hpaths ha hPE + · exact Step1ZeroDividerAnchorNonPE G k e0 input T phi ett hMP hpositive + hproper hone hlower base H hdividerZero alpha beta hne halpha hclosed + a₁ b₁ a₂ b₂ P₁ P₂ hP₁ hP₂ hpaths ha hPE + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorNonPE.lean b/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorNonPE.lean new file mode 100644 index 0000000000..bc65b36ee9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorNonPE.lean @@ -0,0 +1,1184 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyOutsideKempeStable +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Step1Zero Divider Anchor Non PE + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hterminal_148.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett phi) (_ : + TashkinovHierarchy ett base), ett.series.data.kind (Fin.last ett.rounds) ≠ some + TashkinovExtensionKind.PE → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let p : Fin (ett.rounds + (1 : ℕ)) := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a + : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dp : Finset (Fin k) := TashkinovStoredColors ett.series.data p; phi = + ett.series.data.coloring n → IsProperEdgeColoring G (ett.series.data.coloring p) ∧ + IsOneEdgeUncolored (ett.series.data.coloring p) e0 ∧ ColoredVertexSetClosed G + (ett.series.data.coloring p) (TreeSequenceVertexSet Tn) ∧ StableColoring Tn Dp + (ett.series.data.coloring p) phi := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H hnonPE n p Tn Dp hphi + as_aux_lemma => + have hstep := ett.series.certified n + generalize targetEq : n = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hn : n ≠ 0 := by simp [n]; omega + exact (hn targetEq).elim + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hp : ett.series.data.kind n = + some TashkinovExtensionKind.PE := by + rw [targetEq] + exact currentKind + exact (hnonPE (by simpa [n] using hp)).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i.succ = n := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + have hip : i.castSucc = p := by + apply Fin.ext + simp only [Fin.val_castSucc, n, p] at hi ⊢ + have hv := congrArg Fin.val hi + simp at hv + omega + have htree : ett.series.data.tree i.succ.castSucc = Tn := by + simp [Tn, hi] + refine ⟨?_, ?_, ?_, ?_⟩ + · simpa [hip] using previousProper + · simpa [hip] using previousOneUncolored + · rw [← htree, ← hip] + exact previousClosed + · have hselected : choice.selected = phi := + currentColoring.symm.trans + ((congrArg ett.series.data.coloring hi).trans hphi.symm) + have hs : StableColoring Tn Dp + (ett.series.data.coloring p) choice.selected := by + simpa only [Dp, htree, hip] using choice.selectedStable + exact Eq.mp + (congrArg (fun q => StableColoring Tn Dp + (ett.series.data.coloring p) q) hselected) hs + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i.succ = n := by + apply Fin.ext + have hv := congrArg Fin.val targetEq + simp at hv + omega + have hip : i.castSucc = p := by + apply Fin.ext + have hv := congrArg Fin.val hi + simp [p, n] at hv ⊢ + omega + have htree : ett.series.data.tree i.succ.castSucc = Tn := by + simp [Tn, hi] + have hcol : ett.series.data.coloring p = phi := by + exact (congrArg ett.series.data.coloring hip.symm).trans + (currentColoring.symm.trans + ((congrArg ett.series.data.coloring hi).trans hphi.symm)) + refine ⟨?_, ?_, ?_, ?_⟩ + · simpa [hip] using previousProper + · simpa [hip] using previousOneUncolored + · rw [← htree, ← hip] + exact previousClosed + · have hs : StableColoring Tn Dp + (ett.series.data.coloring p) (ett.series.data.coloring p) := + (sc2 G e0 Tn Dp).refl + ⟨ett.series.data.coloring p, by simpa [hip] using previousProper, + by simpa [hip] using previousOneUncolored⟩ + exact Eq.mp + (congrArg (fun q => StableColoring Tn Dp + (ett.series.data.coloring p) q) hcol) hs + +private theorem helper_finalInterchange_379.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let p : Fin (ett.rounds + (1 : ℕ)) := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a + : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dp : Finset (Fin k) := TashkinovStoredColors ett.series.data p; IsProperEdgeColoring G + (ett.series.data.coloring p) ∧ IsOneEdgeUncolored (ett.series.data.coloring p) e0 ∧ + ColoredVertexSetClosed G (ett.series.data.coloring p) (TreeSequenceVertexSet Tn) ∧ + StableColoring Tn Dp (ett.series.data.coloring p) phi → TreeMissingColors phi Tn = + TreeMissingColors (ett.series.data.coloring p) Tn → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn Dp phi sigma → + ∀ (a b : Fin k), a ∈ TreeMissingColors sigma Tn ∨ b ∈ TreeMissingColors sigma Tn → + TreeInterchangeable G Tn sigma a b := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hlower base H n p Tn Dp hterminal + treeMissingEq sigma hsProper hsOne hsStable a b hmissing + have hsComposed : StableColoring Tn Dp + (ett.series.data.coloring p) sigma := by + constructor + · intro f hf hcolor + obtain ⟨d, hd, hdf⟩ := hcolor + have hdPhi : d ∈ TreeMissingColors phi Tn ∪ Dp := by + rcases Finset.mem_union.mp hd with hdMissing | hdControl + · exact Finset.mem_union_left _ (by + rw [treeMissingEq] + exact hdMissing) + · exact Finset.mem_union_right _ hdControl + have hphiFixed : phi f = ett.series.data.coloring p f := by + exact hterminal.2.2.2.1 f hf ⟨d, hd, hdf⟩ + have hsigmaFixed : sigma f = phi f := by + apply hsStable.1 f hf + exact ⟨d, hdPhi, hphiFixed.trans hdf⟩ + exact hsigmaFixed.trans hphiFixed + · intro v hv + exact (hsStable.2 v hv).trans (hterminal.2.2.2.2 v hv) + by_cases honeRound : ett.rounds = 1 + · have htech := TechnicalTheoremBase G k ett.rounds e0 input ett.series + have hidx1 : (⟨1, by omega⟩ : Fin (ett.rounds + 2)) = + n.castSucc := by + apply Fin.ext + simp [n, honeRound] + have hT1 : ett.series.data.tree ⟨1, by omega⟩ = Tn := by + rw [hidx1] + have hs0 : StableColoring + (ett.series.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors ett.series.data 0) + (ett.series.data.coloring 0) sigma := by + rw [hT1] + simpa [p, Dp, honeRound] using hsComposed + have hm0 : a ∈ TreeMissingColors sigma + (ett.series.data.tree ⟨1, by omega⟩) ∨ + b ∈ TreeMissingColors sigma + (ett.series.data.tree ⟨1, by omega⟩) := by + rw [hT1] + exact hmissing + have hinter := htech.2 sigma hsProper hsOne hs0 a b hm0 + rw [hT1] at hinter + exact hinter + · have hgt : 1 < ett.rounds := by omega + obtain ⟨pred, predRound, predMP, predTrees, predData⟩ := + CertifiedETTPredecessor G k e0 input T phi ett hMP hgt + have low := (hlower pred (by omega) (by omega) predMP).2.1 + have hpredNext : pred.series.data.tree + (Fin.last (pred.rounds + 1)) = Tn := by + have hh := predTrees (Fin.last (pred.rounds + 1)) + have hidx : Fin.castLE (by omega) (Fin.last (pred.rounds + 1)) = + n.castSucc := by + apply Fin.ext + simp [predRound, n] + omega + simpa [Tn] using hh.trans (congrArg ett.series.data.tree hidx) + have hpredColor : pred.series.data.coloring (Fin.last pred.rounds) = + ett.series.data.coloring p := by + have hh := (predData (Fin.last pred.rounds)).1 + have hidx : Fin.castLE (by omega) (Fin.last pred.rounds) = p := by + apply Fin.ext + simp [predRound, p] + rw [hidx] at hh + exact hh + have hpredStored : TashkinovStoredColors pred.series.data + (Fin.last pred.rounds) = Dp := by + have hh := (predData (Fin.last pred.rounds)).2.2.2.2.2.2.2.2.1 + have hidx : Fin.castLE (by omega) (Fin.last pred.rounds) = p := by + apply Fin.ext + simp [predRound, p] + rw [hidx] at hh + simpa [Dp] using hh + have hsPred : StableColoring + (pred.series.data.tree (Fin.last (pred.rounds + 1))) + (TashkinovStoredColors pred.series.data (Fin.last pred.rounds)) + (pred.series.data.coloring (Fin.last pred.rounds)) sigma := by + rw [hpredNext, hpredStored, hpredColor] + exact hsComposed + have hmPred : a ∈ TreeMissingColors sigma + (pred.series.data.tree (Fin.last (pred.rounds + 1))) ∨ + b ∈ TreeMissingColors sigma + (pred.series.data.tree (Fin.last (pred.rounds + 1))) := by + rw [hpredNext] + exact hmissing + have hinter := low sigma hsProper hsOne hsPred a b hmPred + rw [hpredNext] at hinter + exact hinter + +private theorem helper_finish_473.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds) (base : HierarchyBase ett phi) (_ : + TashkinovHierarchy ett base) (beta : Fin k) (a₁ b₁ a₂ b₂ : V), a₁ ≠ a₂ → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let p : Fin (ett.rounds + (1 : ℕ)) := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a + : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dp : Finset (Fin k) := TashkinovStoredColors ett.series.data p; + let x : V := Tn.vertex (0 : Fin (Tn.length + (1 : ℕ))); x ∈ TreeSequenceVertexSet Tn → + ∀ c ∈ MissingColors G phi x, c ≠ beta → ( + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn Dp phi sigma → + ∀ (a b : Fin k), a ∈ TreeMissingColors sigma Tn ∨ b ∈ TreeMissingColors sigma Tn → + TreeInterchangeable G Tn sigma a b) → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn Dp phi sigma → c ∈ TreeMissingColors sigma Tn → + ∀ (Q₁ : (TwoColorIncidenceGraph G sigma c beta).Walk (Sum.inl a₁) (Sum.inl b₁)) (Q₂ : + (TwoColorIncidenceGraph G sigma c beta).Walk (Sum.inl a₂) (Sum.inl b₂)), TreeExitPath Tn + sigma c beta a₁ b₁ Q₁ → TreeExitPath Tn sigma c beta a₂ b₂ Q₂ → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive base H beta a₁ b₁ a₂ b₂ ha n p Tn Dp x hxT c + hcxMissing hcNeBeta finalInterchange sigma hsProper hsOne hsStable hcMissing Q₁ Q₂ hQ₁ hQ₂ + let graph := TwoColorIncidenceGraph G sigma c beta + have missingLeaf : ∀ (v : V), + (c ∈ MissingColors G sigma v ∨ beta ∈ MissingColors G sigma v) → + Set.Subsingleton (graph.neighborSet (Sum.inl v)) := by + intro v hmissing z hz w hw + cases hzv : z with + | inl u => + rw [hzv] at hz + simp [graph, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz + | inr e => + cases hwv : w with + | inl u => + rw [hwv] at hw + simp [graph, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw + | inr f => + rw [hzv] at hz + rw [hwv] at hw + have he : Incident G v e ∧ + (sigma e = some c ∨ sigma e = some beta) := by + simpa [graph, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hz + have hf : Incident G v f ∧ + (sigma f = some c ∨ sigma f = some beta) := by + simpa [graph, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hw + apply congrArg Sum.inr + by_contra hef + rcases hmissing with hcm | hbm + · have hnc : c ∉ PresentColors G sigma v := by + simpa [MissingColors] using hcm + have hec : sigma e = some beta := he.2.resolve_left (by + intro hec + apply hnc + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ sigma q = some c from + ⟨e, he.1, hec⟩)) + have hfc : sigma f = some beta := hf.2.resolve_left (by + intro hfc + apply hnc + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ sigma q = some c from + ⟨f, hf.1, hfc⟩)) + exact (hsProper hef ⟨v, he.1, hf.1⟩ hec) hfc + · have hnb : beta ∉ PresentColors G sigma v := by + simpa [MissingColors] using hbm + have heb : sigma e = some c := he.2.resolve_right (by + intro heb + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ sigma q = some beta from + ⟨e, he.1, heb⟩)) + have hfb : sigma f = some c := hf.2.resolve_right (by + intro hfb + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ sigma q = some beta from + ⟨f, hf.1, hfb⟩)) + exact (hsProper hef ⟨v, he.1, hf.1⟩ heb) hfb + have hcxSigma : c ∈ MissingColors G sigma x := by + rw [hsStable.2 x hxT] + exact hcxMissing + have hxLeaf : Set.Subsingleton (graph.neighborSet (Sum.inl x)) := + missingLeaf x (Or.inl hcxSigma) + have ha₁Leaf : Set.Subsingleton (graph.neighborSet (Sum.inl a₁)) := + missingLeaf a₁ hQ₁.2.2.2.2.1 + have ha₂Leaf : Set.Subsingleton (graph.neighborSet (Sum.inl a₂)) := + missingLeaf a₂ hQ₂.2.2.2.2.1 + have hpathX : TwoColorPathComponent G sigma c beta (Sum.inl x) := + ⟨hcNeBeta, Sum.inl x, rfl, hxLeaf⟩ + have hpath₁ : TwoColorPathComponent G sigma c beta (Sum.inl a₁) := + ⟨hcNeBeta, Sum.inl a₁, rfl, ha₁Leaf⟩ + have hpath₂ : TwoColorPathComponent G sigma c beta (Sum.inl a₂) := + ⟨hcNeBeta, Sum.inl a₂, rfl, ha₂Leaf⟩ + have hmeetX : ∃ v ∈ TreeSequenceVertexSet Tn, + Sum.inl v ∈ TwoColorComponent G sigma c beta (Sum.inl x) := + ⟨x, hxT, rfl⟩ + have hmeet₁ : ∃ v ∈ TreeSequenceVertexSet Tn, + Sum.inl v ∈ TwoColorComponent G sigma c beta (Sum.inl a₁) := by + refine ⟨b₁, hQ₁.2.2.2.1, ?_⟩ + change graph.connectedComponentMk (Sum.inl b₁) = + graph.connectedComponentMk (Sum.inl a₁) + exact (SimpleGraph.ConnectedComponent.sound Q₁.reachable).symm + have hmeet₂ : ∃ v ∈ TreeSequenceVertexSet Tn, + Sum.inl v ∈ TwoColorComponent G sigma c beta (Sum.inl a₂) := by + refine ⟨b₂, hQ₂.2.2.2.1, ?_⟩ + change graph.connectedComponentMk (Sum.inl b₂) = + graph.connectedComponentMk (Sum.inl a₂) + exact (SimpleGraph.ConnectedComponent.sound Q₂.reachable).symm + have ha₁x : a₁ ≠ x := by + intro h + exact hQ₁.2.2.1 (h ▸ hxT) + have ha₂x : a₂ ≠ x := by + intro h + exact hQ₂.2.2.1 (h ▸ hxT) + have hdistinct : + TwoColorComponent G sigma c beta (Sum.inl x) ≠ + TwoColorComponent G sigma c beta (Sum.inl a₁) ∨ + TwoColorComponent G sigma c beta (Sum.inl x) ≠ + TwoColorComponent G sigma c beta (Sum.inl a₂) := by + by_contra hnot + push Not at hnot + obtain ⟨u, v, R, hRpath, hRsupport⟩ := + TwoColorComponentSpanningPath G sigma c beta hsProper (Sum.inl x) + have hxR : Sum.inl x ∈ R.support := by + change Sum.inl x ∈ {z | z ∈ R.support} + rw [hRsupport] + rfl + have ha₁R : Sum.inl a₁ ∈ R.support := by + change Sum.inl a₁ ∈ {z | z ∈ R.support} + rw [hRsupport, hnot.1] + rfl + have ha₂R : Sum.inl a₂ ∈ R.support := by + change Sum.inl a₂ ∈ {z | z ∈ R.support} + rw [hRsupport, hnot.2] + rfl + have endpointOfLeaf : + ∀ (z : Sum V E), Set.Subsingleton (graph.neighborSet z) → z ∈ R.support → z = u ∨ z = v := by + intro z hzLeaf hzR + by_contra hzEnds + push Not at hzEnds + exact (hRpath.isTrail.notMem_support_of_subsingleton_neighborSet + hzEnds.1 hzEnds.2 hzLeaf) hzR + have hxEnds := endpointOfLeaf (Sum.inl x) hxLeaf hxR + have ha₁Ends := endpointOfLeaf (Sum.inl a₁) ha₁Leaf ha₁R + have ha₂Ends := endpointOfLeaf (Sum.inl a₂) ha₂Leaf ha₂R + rcases hxEnds with hxu | hxv <;> + rcases ha₁Ends with h₁u | h₁v <;> + rcases ha₂Ends with h₂u | h₂v + · exact ha₁x (Sum.inl.inj (h₁u.trans hxu.symm)) + · exact ha₁x (Sum.inl.inj (h₁u.trans hxu.symm)) + · exact ha₂x (Sum.inl.inj (h₂u.trans hxu.symm)) + · exact ha (Sum.inl.inj (h₁v.trans h₂v.symm)) + · exact ha (Sum.inl.inj (h₁u.trans h₂u.symm)) + · exact ha₂x (Sum.inl.inj (h₂v.trans hxv.symm)) + · exact ha₁x (Sum.inl.inj (h₁v.trans hxv.symm)) + · exact ha₁x (Sum.inl.inj (h₁v.trans hxv.symm)) + have hinter := finalInterchange sigma hsProper hsOne hsStable c beta + (Or.inl hcMissing) + rcases hdistinct with hneComp | hneComp + · exact hneComp (hinter (Sum.inl x) (Sum.inl a₁) + hpathX hpath₁ hmeetX hmeet₁) + · exact hneComp (hinter (Sum.inl x) (Sum.inl a₂) + hpathX hpath₂ hmeetX hmeet₂) + +private theorem helper_componentOutside_548.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (alpha : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet Tn; TreeColorSetClosed G phi Tn { alpha } → + ∀ (c : Fin k), TreeColorSetClosed G phi Tn { c } → + ∀ u ∉ X, + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phi alpha c (Sum.inl u) → v ∉ X := by + classical + intro V E _ _ _ G k e0 input T phi ett alpha n Tn X halphaClosed c hcClosed u hu v hvComponent hv + let graph := TwoColorIncidenceGraph G phi alpha c + change graph.connectedComponentMk (Sum.inl v) = + graph.connectedComponentMk (Sum.inl u) at hvComponent + have reach : graph.Reachable (Sum.inl u) (Sum.inl v) := + (SimpleGraph.ConnectedComponent.eq.mp hvComponent).symm + apply reach.elim + intro P + let S : Set (Sum V E) := {y | match y with + | Sum.inl q => q ∈ X + | Sum.inr f => ∀ q, Incident G q f → q ∈ X} + have hSv : Sum.inl v ∈ S := by simpa [S] using hv + have hSu : Sum.inl u ∉ S := by simpa [S] using hu + obtain ⟨d, hd, hds, hdt⟩ := + P.reverse.exists_boundary_dart S hSv hSu + have hadj := d.adj + have hfirst : ∃ q : V, d.toProd.1 = Sum.inl q ∧ q ∈ X := by + cases h : d.toProd.1 with + | inl q => + rw [h] at hds + exact ⟨q, rfl, by simpa [S] using hds⟩ + | inr f => + exfalso + cases h2 : d.toProd.2 with + | inl r => + rw [h, h2] at hadj + change Incident G r f ∧ + (phi f = some alpha ∨ phi f = some c) at hadj + rw [h] at hds + have hall : ∀ q, Incident G q f → q ∈ X := by + simpa [S] using hds + have hrnot : r ∉ X := by + intro hr + apply hdt + simpa [S, h2] using hr + exact hrnot (hall r hadj.1) + | inr e => + rw [h, h2] at hadj + exact hadj.elim + obtain ⟨q, hq, hqX⟩ := hfirst + have hsecond : ∃ f : E, d.toProd.2 = Sum.inr f := by + cases h : d.toProd.2 with + | inl r => + rw [hq, h] at hadj + exact False.elim hadj + | inr f => exact ⟨f, rfl⟩ + obtain ⟨f, hf⟩ := hsecond + have hfadj : graph.Adj (Sum.inl q) (Sum.inr f) := by + rw [hq, hf] at hadj + exact hadj + have hfdata : Incident G q f ∧ + (phi f = some alpha ∨ phi f = some c) := by + simpa [graph, TwoColorIncidenceGraph] using hfadj + have hnotall : ¬ ∀ r, Incident G r f → r ∈ X := by + intro hall + apply hdt + simpa [S, hf, hall] + obtain ⟨r, hrf, hrX⟩ : ∃ r, Incident G r f ∧ r ∉ X := by + push Not at hnotall + exact hnotall + have hqr : q ≠ r := by + intro h + exact hrX (h ▸ hqX) + have hend : G.ends f = Sym2.mk q r := + (Sym2.mem_and_mem_iff hqr).mp ⟨hfdata.1, hrf⟩ + have hfb : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, hqX, r, hrX, hend⟩ + rcases hfdata.2 with hfa | hfc + · have hfalpha : f ∈ BoundaryColorEdges G phi X alpha := by + simp [BoundaryColorEdges, hfb, hfa] + have hempty := halphaClosed alpha (by simp) + rw [show X = TreeSequenceVertexSet Tn by rfl] at hfalpha + rw [hempty] at hfalpha + simp at hfalpha + · have hfcolor : f ∈ BoundaryColorEdges G phi X c := by + simp [BoundaryColorEdges, hfb, hfc] + have hempty := hcClosed c (by simp) + rw [show X = TreeSequenceVertexSet Tn by rfl] at hfcolor + rw [hempty] at hfcolor + simp at hfcolor + +private theorem helper_pathEdgeOutside_695.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet Tn; + ∀ (u v : V) (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath Tn phi alpha beta u v P → + ∀ (f : E), Sum.inr f ∈ P.support → + ∃ (w : V), Sum.inl w ∈ P.support ∧ w ∉ X ∧ Incident G w f := by + classical + intro V E _ _ _ G k e0 input T phi ett alpha beta n Tn X u v P hExit f hfSupport + rcases hExit with ⟨hPath, hLength, huX, hvX, hMissing, honly⟩ + obtain ⟨m, hm, hmle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hfSupport + have hmpos : 0 < m := by + by_contra h + have hmzero : m = 0 := by omega + rw [hmzero] at hm + simp at hm + have hmlt : m < P.length := by + by_contra h + have hmlast : m = P.length := by omega + rw [hmlast] at hm + simp at hm + have hprev := P.adj_getVert_succ (i := m - 1) (by omega) + rw [show m - 1 + 1 = m by omega, hm] at hprev + obtain ⟨w, hwPrev⟩ : ∃ w : V, P.getVert (m - 1) = Sum.inl w := by + cases hnode : P.getVert (m - 1) with + | inl w => exact ⟨w, rfl⟩ + | inr e => + rw [hnode] at hprev + simp [TwoColorIncidenceGraph] at hprev + have hnext := P.adj_getVert_succ (i := m) hmlt + rw [hm] at hnext + obtain ⟨z, hzNext⟩ : ∃ z : V, P.getVert (m + 1) = Sum.inl z := by + cases hnode : P.getVert (m + 1) with + | inl z => exact ⟨z, rfl⟩ + | inr e => + rw [hnode] at hnext + simp [TwoColorIncidenceGraph] at hnext + have hwIncident : Incident G w f := by + rw [hwPrev] at hprev + simpa [TwoColorIncidenceGraph] using hprev.1 + have hzIncident : Incident G z f := by + rw [hzNext] at hnext + simpa [TwoColorIncidenceGraph] using hnext.1 + have hwSupport : Sum.inl w ∈ P.support := by + rw [← hwPrev] + exact P.getVert_mem_support (m - 1) + have hzSupport : Sum.inl z ∈ P.support := by + rw [← hzNext] + exact P.getVert_mem_support (m + 1) + by_cases hwX : w ∈ X + · by_cases hzX : z ∈ X + · have hwv : w = v := + (honly w (by simpa [X] using hwX)).mp hwSupport + have hzv : z = v := + (honly z (by simpa [X] using hzX)).mp hzSupport + have hverts : P.getVert (m - 1) = P.getVert (m + 1) := by + rw [hwPrev, hzNext, hwv, hzv] + have hindices := hPath.getVert_injOn + (show m - 1 ≤ P.length by omega) + (show m + 1 ≤ P.length by omega) hverts + omega + · exact ⟨z, hzSupport, hzX, hzIncident⟩ + · exact ⟨w, hwSupport, hwX, hwIncident⟩ + +private theorem helper_transportExit_758.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (alpha beta : Fin k), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet Tn; + ∀ (c : Fin k), ¬alpha = c → + let roots : Finset (V ⊕ E) := + {z : V ⊕ E | match z with | Sum.inl u => u ∉ X | Sum.inr _ => False}; + let rho : PartialEdgeColoring E k := fun (f : E) ↦ if + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha c z then if phi f = some alpha then + some c else if phi f = some c then some alpha else phi f else phi f; + let selected : E → Prop := fun (f : E) ↦ + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha c z; ( + ∀ (f : E), rho f = some beta ↔ phi f = some beta) → ( + ∀ u ∉ X, + ∀ (f : E), Incident G u f → phi f = some alpha ∨ phi f = some c → selected f) → ( + ∀ (u v : V) (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath Tn phi alpha beta u v P → + ∀ (f : E), Sum.inr f ∈ P.support → + ∃ (w : V), Sum.inl w ∈ P.support ∧ w ∉ X ∧ Incident G w f) → + ∀ (u v : V) (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath Tn phi alpha beta u v P → + ∃ (Q : (TwoColorIncidenceGraph G rho c beta).Walk (Sum.inl u) (Sum.inl v)), TreeExitPath Tn + rho c beta u v Q ∧ Q.support = P.support := by + classical + intro V E _ _ _ G k e0 input T phi ett alpha beta n Tn X c hac roots rho selected hbetaFixed + selectedOfOutside pathEdgeOutside u v P hExit + have selectedAlphaEdge : ∀ f : E, Sum.inr f ∈ P.support → + phi f = some alpha → selected f := by + intro f hfP hfa + obtain ⟨w, hwP, hwX, hwf⟩ := pathEdgeOutside u v P hExit f hfP + exact selectedOfOutside w hwX f hwf (Or.inl hfa) + have adjacencyTransport : + ∀ (z w : Sum V E), z ∈ P.support → w ∈ P.support → (TwoColorIncidenceGraph G phi alpha + beta).Adj z w → (TwoColorIncidenceGraph G rho c beta).Adj z w := by + intro z w hzP hwP hadj + cases z with + | inl z => + cases w with + | inl w => exact False.elim hadj + | inr f => + rcases hadj with ⟨hzf, hcolor⟩ + refine ⟨hzf, ?_⟩ + rcases hcolor with hfa | hfb + · left + have hsel := selectedAlphaEdge f hwP hfa + change ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + simp only [rho] + rw [ite_eq_left hsel, ite_eq_left hfa] + · right + exact (hbetaFixed f).2 hfb + | inr f => + cases w with + | inl w => + rcases hadj with ⟨hwf, hcolor⟩ + refine ⟨hwf, ?_⟩ + rcases hcolor with hfa | hfb + · left + have hsel := selectedAlphaEdge f hzP hfa + change ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + simp only [rho] + rw [ite_eq_left hsel, ite_eq_left hfa] + · right + exact (hbetaFixed f).2 hfb + | inr e => exact False.elim hadj + have rebuild : ∀ {s t : Sum V E} + (R : (TwoColorIncidenceGraph G phi alpha beta).Walk s t), + (∀ z, z ∈ R.support → z ∈ P.support) → + ∃ Q : (TwoColorIncidenceGraph G rho c beta).Walk s t, + Q.support = R.support ∧ Q.length = R.length := by + intro s t R + induction R with + | nil => + intro hsub + exact ⟨.nil, rfl, rfl⟩ + | @cons s w t hsw R ih => + intro hsub + have hsP : s ∈ P.support := hsub s (by simp) + have hwP : w ∈ P.support := hsub w (by simp) + obtain ⟨Q, hQsupport, hQlength⟩ := ih (by + intro z hz + exact hsub z (by simp [hz])) + have hsw' := adjacencyTransport s w hsP hwP hsw + refine ⟨.cons hsw' Q, ?_, ?_⟩ + · simp [hQsupport] + · simp [hQlength] + obtain ⟨Q, hQsupport, hQlength⟩ := rebuild P (by + intro z hz + exact hz) + have hQpath : Q.IsPath := by + apply SimpleGraph.Walk.IsPath.mk' + rw [hQsupport] + exact hExit.1.support_nodup + have hmissing : c ∈ MissingColors G rho u ∨ + beta ∈ MissingColors G rho u := by + rcases hExit.2.2.2.2.1 with halphaMissing | hbetaMissing + · left + have huX : u ∉ X := by simpa [X] using hExit.2.2.1 + have hnotAlpha : alpha ∉ PresentColors G phi u := by + simpa [MissingColors] using halphaMissing + have hnotC : c ∉ PresentColors G rho u := by + intro hcPresent + obtain ⟨f, huf, hrhof⟩ := by + simpa [PresentColors] using hcPresent + by_cases hsel : selected f + · change ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + by_cases hfa : phi f = some alpha + · apply hnotAlpha + simpa [PresentColors] using + (show ∃ q, Incident G u q ∧ phi q = some alpha from + ⟨f, huf, hfa⟩) + · by_cases hfc : phi f = some c + · have hrhoAlpha : rho f = some alpha := by + simp only [rho] + rw [ite_eq_left hsel, ite_eq_right hfa, ite_eq_left hfc] + have : some alpha = some c := hrhoAlpha.symm.trans hrhof + exact hac (Option.some.inj this) + · have hrhoOld : rho f = phi f := by + simp only [rho] + rw [ite_eq_left hsel, ite_eq_right hfa, ite_eq_right hfc] + exact hfc (hrhoOld.symm.trans hrhof) + · change ¬ ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + have hfc : phi f = some c := by + have hrhoOld : rho f = phi f := by + simp only [rho] + rw [ite_eq_right hsel] + exact hrhoOld.symm.trans hrhof + have hchosen := selectedOfOutside u huX f huf (Or.inr hfc) + exact hsel hchosen + simpa [MissingColors] using hnotC + · right + have hnotBeta : beta ∉ PresentColors G phi u := by + simpa [MissingColors] using hbetaMissing + have hnotBetaRho : beta ∉ PresentColors G rho u := by + intro hbPresent + obtain ⟨f, huf, hrf⟩ := by + simpa [PresentColors] using hbPresent + apply hnotBeta + simpa [PresentColors] using + (show ∃ q, Incident G u q ∧ phi q = some beta from + ⟨f, huf, (hbetaFixed f).1 hrf⟩) + simpa [MissingColors] using hnotBetaRho + refine ⟨Q, ?_, hQsupport⟩ + refine ⟨hQpath, ?_, hExit.2.2.1, hExit.2.2.2.1, hmissing, ?_⟩ + · rw [hQlength] + exact hExit.2.1 + · intro w hw + rw [hQsupport] + exact hExit.2.2.2.2.2 w hw + +private theorem helper_branch_639.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (hpositive : (0 : ℕ) < ett.rounds), IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + ∀ (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base) (alpha beta : Fin k), alpha + ≠ beta → + ∀ (a₁ b₁ a₂ b₂ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) (Sum.inl + b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl b₂)), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let p : Fin (ett.rounds + (1 : ℕ)) := (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a + : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset V := TreeSequenceVertexSet Tn; + let Dp : Finset (Fin k) := TashkinovStoredColors ett.series.data p; TreeExitPath Tn phi alpha + beta a₁ b₁ P₁ → TreeExitPath Tn phi alpha beta a₂ b₂ P₂ → TreeColorSetClosed G phi Tn + { alpha } → + let x : V := Tn.vertex (0 : Fin (Tn.length + (1 : ℕ))); x ∈ TreeSequenceVertexSet Tn → + ∀ c ∈ MissingColors G phi x, TreeColorSetClosed G phi Tn { c } → c ≠ beta → ( + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring Tn Dp phi sigma → c ∈ TreeMissingColors sigma Tn → + ∀ (Q₁ : (TwoColorIncidenceGraph G sigma c beta).Walk (Sum.inl a₁) (Sum.inl b₁)) (Q₂ : + (TwoColorIncidenceGraph G sigma c beta).Walk (Sum.inl a₂) (Sum.inl b₂)), TreeExitPath Tn + sigma c beta a₁ b₁ Q₁ → TreeExitPath Tn sigma c beta a₂ b₂ Q₂ → False) → ¬alpha = c → + False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hpositive hproper hone base H alpha beta hne a₁ b₁ a₂ + b₂ P₁ P₂ n p Tn X Dp hP1 hP2 halphaClosed x hxT c hcxMissing hcClosed hcNeBeta finish hac + have componentOutside := @helper_componentOutside_548 V E inferInstance inferInstance + inferInstance G k e0 input T phi ett alpha halphaClosed c hcClosed + let roots : Finset (Sum V E) := Finset.univ.filter fun z => + match z with + | Sum.inl u => u ∉ X + | Sum.inr _ => False + let rho : PartialEdgeColoring E k := fun f => + if ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z then + if phi f = some alpha then some c + else if phi f = some c then some alpha + else phi f + else phi f + have hrecolor : OutsideKempeRecoloring Tn phi rho alpha c := by + unfold OutsideKempeRecoloring + refine ⟨hac, roots, ?_, ?_⟩ + · intro z hz v hvComponent + simp only [roots, Finset.mem_filter, Finset.mem_univ, true_and] at hz + cases z with + | inl u => + exact componentOutside u hz v hvComponent + | inr f => + exact False.elim hz + · intro f + rfl + have hstable := OutsideKempeRecoloringStable G e0 Tn Dp + phi rho alpha c hproper hone hrecolor + have hrhoProper : IsProperEdgeColoring G rho := hstable.1 + have hrhoOne : IsOneEdgeUncolored rho e0 := hstable.2.1 + have hrhoStable : StableColoring Tn Dp phi rho := hstable.2.2.1 + let selected : E → Prop := fun f => ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z + have hbetaFixed : ∀ f : E, + rho f = some beta ↔ phi f = some beta := by + intro f + by_cases hsel : selected f + · change ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + simp only [rho] + rw [ite_eq_left hsel] + by_cases hfa : phi f = some alpha + · rw [ite_eq_left hfa, hfa] + simp [hcNeBeta, hne] + · rw [ite_eq_right hfa] + by_cases hfc : phi f = some c + · rw [ite_eq_left hfc, hfc] + simp [hne, hcNeBeta] + · rw [ite_eq_right hfc] + · change ¬ ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + simp only [rho] + rw [ite_eq_right hsel] + have selectedOfOutside : ∀ (u : V), u ∉ X → ∀ (f : E), + Incident G u f → + (phi f = some alpha ∨ phi f = some c) → selected f := by + intro u hu f huf hfcolor + refine ⟨Sum.inl u, ?_, ?_⟩ + · simp [roots, hu] + · change (TwoColorIncidenceGraph G phi alpha c).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G phi alpha c).connectedComponentMk + (Sum.inl u) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha c).Adj + (Sum.inl u) (Sum.inr f) from ⟨huf, hfcolor⟩)).symm + have pathEdgeOutside := @helper_pathEdgeOutside_695 V E inferInstance inferInstance inferInstance + G k e0 input T phi ett alpha beta + have transportExit := @helper_transportExit_758 V E inferInstance inferInstance inferInstance G k + e0 input T phi ett alpha beta c hac hbetaFixed selectedOfOutside pathEdgeOutside + obtain ⟨Q₁, hQ₁, hQ₁Support⟩ := transportExit a₁ b₁ P₁ hP1 + obtain ⟨Q₂, hQ₂, hQ₂Support⟩ := transportExit a₂ b₂ P₂ hP2 + have hcMissingRho : c ∈ TreeMissingColors rho Tn := by + unfold TreeMissingColors + refine Finset.mem_biUnion.mpr ⟨x, hxT, ?_⟩ + rw [hrhoStable.2 x hxT] + exact hcxMissing + exact finish rho hrhoProper hrhoOne hrhoStable hcMissingRho + Q₁ Q₂ hQ₁ hQ₂ + +private theorem helper_continuation_1146.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (_ : + IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (_ : + LowerRoundInductionHypothesis G k e0 ett.rounds) (base : HierarchyBase ett phi) (H : + TashkinovHierarchy ett base) (alpha beta : Fin k) (_ : alpha ≠ beta) (_ : alpha ∈ + TreeMissingColors phi (HierarchyStarredStage H (Fin.last H.dividerCount))) (_ : + TreeColorSetClosed G phi (HierarchyStarredStage H (Fin.last H.dividerCount)) ({ alpha } : + Finset (Fin k))) (a₁ b₁ a₂ b₂ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl + a₂) (Sum.inl b₂)) (_ : TreeExitPath (HierarchyStarredStage H (Fin.last H.dividerCount)) + phi alpha beta a₁ b₁ P₁) (_ : TreeExitPath (HierarchyStarredStage H (Fin.last + H.dividerCount)) phi alpha beta a₂ b₂ P₂) (_ : + ∀ x ∈ P₁.support, x ∉ P₂.support) (_ : a₁ ≠ a₂), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let p : Fin (ett.rounds + (1 : ℕ)) := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))); + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dp : Finset (Fin k) := TashkinovStoredColors ett.series.data p; + ∀ (_ : IsProperEdgeColoring G (ett.series.data.coloring p) ∧ IsOneEdgeUncolored + (ett.series.data.coloring p) e0 ∧ ColoredVertexSetClosed G (ett.series.data.coloring p) + (TreeSequenceVertexSet Tn) ∧ StableColoring Tn Dp (ett.series.data.coloring p) phi) (_ : + ∀ d ∈ TreeMissingColors phi Tn, BoundaryColorEdges G phi (TreeSequenceVertexSet Tn) d = ∅) (_ + : TreeExitPath Tn phi alpha beta a₁ b₁ P₁) (_ : TreeExitPath Tn phi alpha beta a₂ b₂ P₂) + (_ : alpha ∈ TreeMissingColors phi Tn) (_ : TreeColorSetClosed G phi Tn ({ alpha } : + Finset (Fin k))) (f₁ : E) (_ : Sum.inr f₁ ∈ P₁.support) (f₂ : E) (_ : Sum.inr f₂ ∈ + P₂.support) (_ : beta ∉ TreeMissingColors phi Tn), + let x : V := Tn.vertex (0 : Fin (Tn.length + (1 : ℕ))); + ∀ (_ : x ∈ TreeSequenceVertexSet Tn) (_ : MaximumDegree G + (1 : ℕ) ≤ k) (_ : (PresentColors G + phi x).card ≤ Degree G x), False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hproper hone hlower base H alpha beta + hne halpha hclosed a₁ b₁ a₂ b₂ P₁ P₂ hP₁ hP₂ hpaths ha n p Tn Dp hterminal missingClosed + hP1 hP2 halphaT halphaClosed f₁ hf₁Support f₂ hf₂Support hbetaNotMissing x hxT degreeBound + presentBound + have degreeAt : Degree G x ≤ MaximumDegree G := by + unfold MaximumDegree + exact Finset.le_max' _ _ (Finset.mem_insert.mpr (Or.inr + (Finset.mem_image.mpr ⟨x, by simp⟩))) + have missingAtX : (MissingColors G phi x).Nonempty := by + by_contra hempty + have hmissingEmpty : MissingColors G phi x = ∅ := + Finset.not_nonempty_iff_eq_empty.mp hempty + have hall : PresentColors G phi x = Finset.univ := by + apply Finset.eq_univ_of_forall + intro d + by_contra hd + have hm : d ∈ MissingColors G phi x := by + simp [MissingColors, hd] + rw [hmissingEmpty] at hm + exact Finset.notMem_empty d hm + have hk : k ≤ Degree G x := by + have := presentBound + simpa [hall] using this + omega + obtain ⟨c, hcxMissing⟩ := missingAtX + have hcT : c ∈ TreeMissingColors phi Tn := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨x, hxT, hcxMissing⟩ + have hcClosed : TreeColorSetClosed G phi Tn {c} := by + unfold TreeColorSetClosed + intro d hd + have hdc : d = c := Finset.mem_singleton.mp hd + subst d + exact missingClosed c hcT + have hbetaPresent : beta ∈ PresentColors G phi x := by + by_contra hb + apply hbetaNotMissing + unfold TreeMissingColors + refine Finset.mem_biUnion.mpr ⟨x, hxT, ?_⟩ + simpa [MissingColors] using hb + have hcNeBeta : c ≠ beta := by + intro hcb + subst c + have hnot : beta ∉ PresentColors G phi x := by + simpa [MissingColors] using hcxMissing + exact hnot hbetaPresent + have treeMissingEq : TreeMissingColors phi Tn = + TreeMissingColors (ett.series.data.coloring p) Tn := by + ext d + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hd⟩ + refine ⟨v, hv, ?_⟩ + rw [← hterminal.2.2.2.2 v hv] + exact hd + · rintro ⟨v, hv, hd⟩ + refine ⟨v, hv, ?_⟩ + rw [hterminal.2.2.2.2 v hv] + exact hd + have finalInterchange := @helper_finalInterchange_379 V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett hMP hpositive hlower base H hterminal + treeMissingEq + have finish := @helper_finish_473 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett hpositive base H beta a₁ b₁ a₂ b₂ ha hxT c hcxMissing hcNeBeta + finalInterchange + by_cases hac : alpha = c + · subst alpha + have hsRefl : StableColoring Tn Dp phi phi := by + constructor + · intro f hf hcolor + rfl + · intro v hv + rfl + exact finish phi hproper hone hsRefl hcT P₁ P₂ hP1 hP2 + · exact @helper_branch_639 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett hpositive hproper hone base H alpha beta hne a₁ b₁ a₂ b₂ P₁ P₂ hP1 hP2 + halphaClosed hxT c hcxMissing hcClosed hcNeBeta finish hac + +lemma Step1ZeroDividerAnchorNonPE {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) + (hdividerZero : H.dividerCount = 0) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (halpha : alpha ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hclosed : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {alpha}) + (a₁ b₁ a₂ b₂ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (hP₁ : TreeExitPath + (HierarchyStarredStage H (Fin.last H.dividerCount)) + phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath + (HierarchyStarredStage H (Fin.last H.dividerCount)) + phi alpha beta a₂ b₂ P₂) + (hpaths : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (ha : a₁ ≠ a₂) + (hnonPE : ett.series.data.kind (Fin.last ett.rounds) ≠ + some TashkinovExtensionKind.PE) : False := by + classical + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let p : Fin (ett.rounds + 1) := ⟨ett.rounds - 1, by omega⟩ + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + let X : Finset V := TreeSequenceVertexSet Tn + let Dp : Finset (Fin k) := TashkinovStoredColors ett.series.data p + have hphi : phi = ett.series.data.coloring n := by + simpa [n] using ett.generatingColoring + have hstar : HierarchyStarredStage H (Fin.last H.dividerCount) = + base.core := by + have hlast : Fin.last H.dividerCount = + (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [hdividerZero] + rw [hlast] + rfl + have hcore : base.core = Tn := by + simpa [n, Tn] using base.nonparallel hnonPE + have hterminal := @helper_hterminal_148 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett hpositive base H hnonPE hphi + have missingClosed : ∀ d : Fin k, + d ∈ TreeMissingColors phi Tn → + BoundaryColorEdges G phi (TreeSequenceVertexSet Tn) d = ∅ := by + intro d hd + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + have hfData : f ∈ BoundaryEdges G (TreeSequenceVertexSet Tn) ∧ + phi f = some d := by + simpa [BoundaryColorEdges] using hf + obtain ⟨y, hyT, hyd⟩ := Finset.mem_biUnion.mp hd + have hfIncident : TreeIncidentEdge Tn f := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hfData + obtain ⟨u, huT, v, hvT, huv⟩ := hfData.1 + refine ⟨u, huT, ?_⟩ + unfold Incident + rw [huv] + exact Sym2.mem_mk_left _ _ + have hydPrev : d ∈ MissingColors G (ett.series.data.coloring p) y := by + rw [← hterminal.2.2.2.2 y hyT] + exact hyd + have hdPrev : d ∈ TreeMissingColors (ett.series.data.coloring p) Tn := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨y, hyT, hydPrev⟩ + have hfFixed : phi f = ett.series.data.coloring p f := by + apply (sc1 G e0 Tn Dp (ett.series.data.coloring p) phi + hterminal.1 hterminal.2.1 hproper hone).mp + hterminal.2.2.2 f hfIncident + exact Or.inr ⟨d, Finset.mem_union_left _ hdPrev, hfData.2⟩ + exact (hterminal.2.2.1 hfData.1 hyT + (hfFixed.symm.trans hfData.2)) hydPrev + have hP1 : TreeExitPath Tn phi alpha beta a₁ b₁ P₁ := by + simpa [hstar, hcore] using hP₁ + have hP2 : TreeExitPath Tn phi alpha beta a₂ b₂ P₂ := by + simpa [hstar, hcore] using hP₂ + have halphaT : alpha ∈ TreeMissingColors phi Tn := by + simpa [hstar, hcore] using halpha + have halphaClosed : TreeColorSetClosed G phi Tn {alpha} := by + simpa [hstar, hcore] using hclosed + obtain ⟨f₁, hf₁Boundary, hf₁Incident, hf₁Support⟩ := + ClosedColorExitPathBoundaryEdge G Tn phi alpha beta halphaClosed + a₁ b₁ P₁ hP1 + obtain ⟨f₂, hf₂Boundary, hf₂Incident, hf₂Support⟩ := + ClosedColorExitPathBoundaryEdge G Tn phi alpha beta halphaClosed + a₂ b₂ P₂ hP2 + have hbetaNotMissing : beta ∉ TreeMissingColors phi Tn := by + intro hbeta + have hempty := missingClosed beta hbeta + rw [hempty] at hf₁Boundary + simp at hf₁Boundary + let x : V := Tn.vertex 0 + have hxT : x ∈ TreeSequenceVertexSet Tn := by + simp [x, TreeSequenceVertexSet] + have degreeBound : MaximumDegree G + 1 ≤ k := by + have step := ett.series.certified 0 + cases step with + | initial triple => exact triple.2.2.1 + have presentBound : (PresentColors G phi x).card ≤ Degree G x := by + have chooseEdge (d : {d : Fin k // d ∈ PresentColors G phi x}) : + ∃ f, Incident G x f ∧ phi f = some d.1 := by + simpa [PresentColors] using d.property + let select : {d : Fin k // d ∈ PresentColors G phi x} → + {f : E // Incident G x f} := fun d => + ⟨Classical.choose (chooseEdge d), + (Classical.choose_spec (chooseEdge d)).1⟩ + have selectColor : ∀ d, phi (select d).1 = some d.1 := by + intro d + exact (Classical.choose_spec (chooseEdge d)).2 + have selectInjective : Function.Injective select := by + intro d e hde + apply Subtype.ext + apply Option.some.inj + calc + some (d : Fin k) = phi (select d).1 := (selectColor d).symm + _ = phi (select e).1 := by rw [hde] + _ = some (e : Fin k) := selectColor e + let : Fintype {d : Fin k // d ∈ PresentColors G phi x} := + Fintype.ofFinite _ + have hcard := Fintype.card_le_of_injective select selectInjective + change (PresentColors G phi x).card ≤ + (Finset.univ.filter (fun f => Incident G x f)).card + simpa [Fintype.card_subtype] using hcard + exact @helper_continuation_1146 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@hMP) (@hpositive) (@hproper) + (@hone) (@hlower) (@base) (@H) (@alpha) (@beta) (@hne) (@halpha) (@hclosed) (@a₁) (@b₁) + (@a₂) (@b₂) (@P₁) (@P₂) (@hP₁) (@hP₂) (@hpaths) (@ha) (@hterminal) (@missingClosed) (@hP1) + (@hP2) (@halphaT) (@halphaClosed) (@f₁) (@hf₁Support) (@f₂) (@hf₂Support) + (@hbetaNotMissing) (@hxT) (@degreeBound) (@presentBound) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorPE.lean b/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorPE.lean new file mode 100644 index 0000000000..1daf585c46 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorPE.lean @@ -0,0 +1,1172 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage +public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.HierarchyOutsideKempeStable +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring +public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable +public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.SameHierarchyStages +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.ParallelInterchangeability +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Step1Zero Divider Anchor PE + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_exitBoundary_285.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (alpha beta : Fin k), + let X : Finset V := TreeSequenceVertexSet base.core; TreeColorSetClosed G phi base.core + { alpha } → + ∀ (u v : V) (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath base.core phi alpha beta u v P → + ∃ f ∈ BoundaryColorEdges G phi X beta, Incident G v f ∧ Sum.inr f ∈ P.support := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base alpha beta X halphaClosed u v P hP + rcases hP with ⟨_, _, huX, hvX, _, honly⟩ + let graph := TwoColorIncidenceGraph G phi alpha beta + let S : Set (Sum V E) := {y | match y with + | Sum.inl q => q ∈ X + | Sum.inr f => ∀ q, Incident G q f → q ∈ X} + have hSv : Sum.inl v ∈ S := by + simpa [S, X] using hvX + have hSu : Sum.inl u ∉ S := by + simpa [S, X] using huX + obtain ⟨d, hd, hds, hdt⟩ := + P.reverse.exists_boundary_dart S hSv hSu + have hadj := d.adj + have hdmem : d.toProd.1 ∈ P.reverse.support := + P.reverse.dart_fst_mem_support_of_mem_darts hd + have hdtmem : d.toProd.2 ∈ P.reverse.support := + P.reverse.dart_snd_mem_support_of_mem_darts hd + have hfirst : ∃ q : V, d.toProd.1 = Sum.inl q ∧ q ∈ X := by + cases h : d.toProd.1 with + | inl q => + rw [h] at hds + exact ⟨q, rfl, by simpa [S] using hds⟩ + | inr f => + exfalso + cases h2 : d.toProd.2 with + | inl r => + rw [h, h2] at hadj + change Incident G r f ∧ + (phi f = some alpha ∨ phi f = some beta) at hadj + rw [h] at hds + have hall : ∀ q, Incident G q f → q ∈ X := by + simpa [S] using hds + have hrnot : r ∉ X := by + intro hr + apply hdt + simpa [S, h2] using hr + exact hrnot (hall r hadj.1) + | inr e => + rw [h, h2] at hadj + exact hadj.elim + obtain ⟨q, hq, hqX⟩ := hfirst + have hsecond : ∃ f : E, d.toProd.2 = Sum.inr f := by + cases h : d.toProd.2 with + | inl r => + rw [hq, h] at hadj + exact False.elim hadj + | inr f => exact ⟨f, rfl⟩ + obtain ⟨f, hf⟩ := hsecond + have hfadj : graph.Adj (Sum.inl q) (Sum.inr f) := by + rw [hq, hf] at hadj + exact hadj + have hfdata : Incident G q f ∧ + (phi f = some alpha ∨ phi f = some beta) := by + simpa [graph, TwoColorIncidenceGraph] using hfadj + have hnotall : ¬ ∀ r, Incident G r f → r ∈ X := by + intro hall + apply hdt + simpa [S, hf, hall] + obtain ⟨r, hrf, hrX⟩ : ∃ r, Incident G r f ∧ r ∉ X := by + push Not at hnotall + exact hnotall + have hqr : q ≠ r := by + intro h + exact hrX (h ▸ hqX) + have hend : G.ends f = Sym2.mk q r := + (Sym2.mem_and_mem_iff hqr).mp ⟨hfdata.1, hrf⟩ + have hfb : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, hqX, r, hrX, hend⟩ + have hfcolor : phi f = some beta := by + rcases hfdata.2 with hfa | hfbeta + · have hfalpha : f ∈ BoundaryColorEdges G phi X alpha := by + simp [BoundaryColorEdges, hfb, hfa] + have hempty := halphaClosed alpha (by simp) + rw [hempty] at hfalpha + simp at hfalpha + · exact hfbeta + have hqP : Sum.inl q ∈ P.support := by + have hqrev : Sum.inl q ∈ P.reverse.support := by + rw [← hq] + exact hdmem + simpa [SimpleGraph.Walk.support_reverse] using hqrev + have hqv : q = v := (honly q (by simpa [X] using hqX)).mp hqP + have hfP : Sum.inr f ∈ P.support := by + have hfrev : Sum.inr f ∈ P.reverse.support := by + rw [← hf] + exact hdtmem + simpa [SimpleGraph.Walk.support_reverse] using hfrev + subst q + exact ⟨f, by simp [BoundaryColorEdges, hfb, hfcolor], hfdata.1, hfP⟩ + +private theorem helper_finish_411.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), MaximumProperty ett → (0 : ℕ) < ett.rounds → LowerRoundInductionHypothesis G + k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (beta : Fin k) (a₁ b₁ a₂ b₂ : V), a₁ ≠ a₂ → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet base.core; + let x : V := Tn.vertex base.supportPosition; x ∈ TreeSequenceVertexSet Tn → x ∈ + TreeSequenceVertexSet base.closure → x ∈ X → + ∀ c ∈ MissingColors G phi x, c ≠ beta → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → CombinedStableColoring Tn base.closure (TashkinovStoredColors ett.series.data n) phi + sigma → c ∈ TreeMissingColors sigma base.core → TreeColorSetClosed G sigma base.core { c } + → + ∀ (Q₁ : (TwoColorIncidenceGraph G sigma c beta).Walk (Sum.inl a₁) (Sum.inl b₁)) (Q₂ : + (TwoColorIncidenceGraph G sigma c beta).Walk (Sum.inl a₂) (Sum.inl b₂)), TreeExitPath + base.core sigma c beta a₁ b₁ Q₁ → TreeExitPath base.core sigma c beta a₂ b₂ Q₂ → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hlower base beta a₁ b₁ a₂ b₂ ha hPE n Tn + X x hxT hxR hxX c hcxMissing hcNeBeta sigma hsProper hsOne hsCombined hcMissingCore + hcClosedCore Q₁ Q₂ hQ₁ hQ₂ + let graph := TwoColorIncidenceGraph G sigma c beta + have missingLeaf : ∀ (v : V), + (c ∈ MissingColors G sigma v ∨ beta ∈ MissingColors G sigma v) → + Set.Subsingleton (graph.neighborSet (Sum.inl v)) := by + intro v hmissing z hz w hw + cases hzv : z with + | inl u => + rw [hzv] at hz + simp [graph, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz + | inr e => + cases hwv : w with + | inl u => + rw [hwv] at hw + simp [graph, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw + | inr f => + rw [hzv] at hz + rw [hwv] at hw + have he : Incident G v e ∧ + (sigma e = some c ∨ sigma e = some beta) := by + simpa [graph, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hz + have hf : Incident G v f ∧ + (sigma f = some c ∨ sigma f = some beta) := by + simpa [graph, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hw + apply congrArg Sum.inr + by_contra hef + rcases hmissing with hcm | hbm + · have hnc : c ∉ PresentColors G sigma v := by + simpa [MissingColors] using hcm + have hec : sigma e = some beta := he.2.resolve_left (by + intro hec + apply hnc + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ sigma q = some c from + ⟨e, he.1, hec⟩)) + have hfc : sigma f = some beta := hf.2.resolve_left (by + intro hfc + apply hnc + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ sigma q = some c from + ⟨f, hf.1, hfc⟩)) + exact (hsProper hef ⟨v, he.1, hf.1⟩ hec) hfc + · have hnb : beta ∉ PresentColors G sigma v := by + simpa [MissingColors] using hbm + have heb : sigma e = some c := he.2.resolve_right (by + intro heb + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ sigma q = some beta from + ⟨e, he.1, heb⟩)) + have hfb : sigma f = some c := hf.2.resolve_right (by + intro hfb + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ sigma q = some beta from + ⟨f, hf.1, hfb⟩)) + exact (hsProper hef ⟨v, he.1, hf.1⟩ heb) hfb + have hcxSigma : c ∈ MissingColors G sigma x := by + rw [hsCombined.1.2 x hxT] + exact hcxMissing + have hxLeaf : Set.Subsingleton (graph.neighborSet (Sum.inl x)) := + missingLeaf x (Or.inl hcxSigma) + have ha₁Leaf : Set.Subsingleton (graph.neighborSet (Sum.inl a₁)) := + missingLeaf a₁ hQ₁.2.2.2.2.1 + have ha₂Leaf : Set.Subsingleton (graph.neighborSet (Sum.inl a₂)) := + missingLeaf a₂ hQ₂.2.2.2.2.1 + have hpathX : TwoColorPathComponent G sigma c beta (Sum.inl x) := + ⟨hcNeBeta, Sum.inl x, rfl, hxLeaf⟩ + have hpath₁ : TwoColorPathComponent G sigma c beta (Sum.inl a₁) := + ⟨hcNeBeta, Sum.inl a₁, rfl, ha₁Leaf⟩ + have hpath₂ : TwoColorPathComponent G sigma c beta (Sum.inl a₂) := + ⟨hcNeBeta, Sum.inl a₂, rfl, ha₂Leaf⟩ + have hmeetX : ∃ v ∈ TreeSequenceVertexSet base.core, + Sum.inl v ∈ TwoColorComponent G sigma c beta (Sum.inl x) := + ⟨x, by simpa [X] using hxX, rfl⟩ + have hmeet₁ : ∃ v ∈ TreeSequenceVertexSet base.core, + Sum.inl v ∈ TwoColorComponent G sigma c beta (Sum.inl a₁) := by + refine ⟨b₁, hQ₁.2.2.2.1, ?_⟩ + change graph.connectedComponentMk (Sum.inl b₁) = + graph.connectedComponentMk (Sum.inl a₁) + exact (SimpleGraph.ConnectedComponent.sound Q₁.reachable).symm + have hmeet₂ : ∃ v ∈ TreeSequenceVertexSet base.core, + Sum.inl v ∈ TwoColorComponent G sigma c beta (Sum.inl a₂) := by + refine ⟨b₂, hQ₂.2.2.2.1, ?_⟩ + change graph.connectedComponentMk (Sum.inl b₂) = + graph.connectedComponentMk (Sum.inl a₂) + exact (SimpleGraph.ConnectedComponent.sound Q₂.reachable).symm + have ha₁x : a₁ ≠ x := by + intro h + exact hQ₁.2.2.1 (h ▸ (by simpa [X] using hxX)) + have ha₂x : a₂ ≠ x := by + intro h + exact hQ₂.2.2.1 (h ▸ (by simpa [X] using hxX)) + have hdistinct : + TwoColorComponent G sigma c beta (Sum.inl x) ≠ + TwoColorComponent G sigma c beta (Sum.inl a₁) ∨ + TwoColorComponent G sigma c beta (Sum.inl x) ≠ + TwoColorComponent G sigma c beta (Sum.inl a₂) := by + by_contra hnot + push Not at hnot + obtain ⟨u, v, R, hRpath, hRsupport⟩ := + TwoColorComponentSpanningPath G sigma c beta hsProper (Sum.inl x) + have hxR : Sum.inl x ∈ R.support := by + change Sum.inl x ∈ {z | z ∈ R.support} + rw [hRsupport] + rfl + have ha₁R : Sum.inl a₁ ∈ R.support := by + change Sum.inl a₁ ∈ {z | z ∈ R.support} + rw [hRsupport, hnot.1] + rfl + have ha₂R : Sum.inl a₂ ∈ R.support := by + change Sum.inl a₂ ∈ {z | z ∈ R.support} + rw [hRsupport, hnot.2] + rfl + have endpointOfLeaf : + ∀ (z : Sum V E), Set.Subsingleton (graph.neighborSet z) → z ∈ R.support → z = u ∨ z = v := by + intro z hzLeaf hzR + by_contra hzEnds + push Not at hzEnds + exact (hRpath.isTrail.notMem_support_of_subsingleton_neighborSet + hzEnds.1 hzEnds.2 hzLeaf) hzR + have hxEnds := endpointOfLeaf (Sum.inl x) hxLeaf hxR + have ha₁Ends := endpointOfLeaf (Sum.inl a₁) ha₁Leaf ha₁R + have ha₂Ends := endpointOfLeaf (Sum.inl a₂) ha₂Leaf ha₂R + rcases hxEnds with hxu | hxv <;> + rcases ha₁Ends with h₁u | h₁v <;> + rcases ha₂Ends with h₂u | h₂v + · exact ha₁x (Sum.inl.inj (h₁u.trans hxu.symm)) + · exact ha₁x (Sum.inl.inj (h₁u.trans hxu.symm)) + · exact ha₂x (Sum.inl.inj (h₂u.trans hxu.symm)) + · exact ha (Sum.inl.inj (h₁v.trans h₂v.symm)) + · exact ha (Sum.inl.inj (h₁u.trans h₂u.symm)) + · exact ha₂x (Sum.inl.inj (h₂v.trans hxv.symm)) + · exact ha₁x (Sum.inl.inj (h₁v.trans hxv.symm)) + · exact ha₁x (Sum.inl.inj (h₁v.trans hxv.symm)) + have hinter := (interchange G k e0 input T phi sigma ett hMP hpositive + hlower hPE base hsProper hsOne hsCombined c beta).2.2.1 + hcMissingCore hcClosedCore + rcases hdistinct with hneComp | hneComp + · exact hneComp (hinter (Sum.inl x) (Sum.inl a₁) + hpathX hpath₁ hmeetX hmeet₁) + · exact hneComp (hinter (Sum.inl x) (Sum.inl a₂) + hpathX hpath₂ hmeetX hmeet₂) + +private theorem helper_componentOutside_422.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet base.core; + ∀ (c : Fin k), TreeColorSetClosed G phi base.core { c } → TreeColorSetClosed G phi base.core + { alpha } → + ∀ u ∉ X, + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phi alpha c (Sum.inl u) → v ∉ X := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base alpha X c hcClosed halphaClosed u hu v + hvComponent hv + let graph := TwoColorIncidenceGraph G phi alpha c + change graph.connectedComponentMk (Sum.inl v) = + graph.connectedComponentMk (Sum.inl u) at hvComponent + have reach : graph.Reachable (Sum.inl u) (Sum.inl v) := + (SimpleGraph.ConnectedComponent.eq.mp hvComponent).symm + apply reach.elim + intro P + let S : Set (Sum V E) := {y | match y with + | Sum.inl q => q ∈ X + | Sum.inr f => ∀ q, Incident G q f → q ∈ X} + have hSv : Sum.inl v ∈ S := by simpa [S] using hv + have hSu : Sum.inl u ∉ S := by simpa [S] using hu + obtain ⟨d, hd, hds, hdt⟩ := + P.reverse.exists_boundary_dart S hSv hSu + have hadj := d.adj + have hfirst : ∃ q : V, d.toProd.1 = Sum.inl q ∧ q ∈ X := by + cases h : d.toProd.1 with + | inl q => + rw [h] at hds + exact ⟨q, rfl, by simpa [S] using hds⟩ + | inr f => + exfalso + cases h2 : d.toProd.2 with + | inl r => + rw [h, h2] at hadj + change Incident G r f ∧ + (phi f = some alpha ∨ phi f = some c) at hadj + rw [h] at hds + have hall : ∀ q, Incident G q f → q ∈ X := by + simpa [S] using hds + have hrnot : r ∉ X := by + intro hr + apply hdt + simpa [S, h2] using hr + exact hrnot (hall r hadj.1) + | inr e => + rw [h, h2] at hadj + exact hadj.elim + obtain ⟨q, hq, hqX⟩ := hfirst + have hsecond : ∃ f : E, d.toProd.2 = Sum.inr f := by + cases h : d.toProd.2 with + | inl r => + rw [hq, h] at hadj + exact False.elim hadj + | inr f => exact ⟨f, rfl⟩ + obtain ⟨f, hf⟩ := hsecond + have hfadj : graph.Adj (Sum.inl q) (Sum.inr f) := by + rw [hq, hf] at hadj + exact hadj + have hfdata : Incident G q f ∧ + (phi f = some alpha ∨ phi f = some c) := by + simpa [graph, TwoColorIncidenceGraph] using hfadj + have hnotall : ¬ ∀ r, Incident G r f → r ∈ X := by + intro hall + apply hdt + simpa [S, hf, hall] + obtain ⟨r, hrf, hrX⟩ : ∃ r, Incident G r f ∧ r ∉ X := by + push Not at hnotall + exact hnotall + have hqr : q ≠ r := by + intro h + exact hrX (h ▸ hqX) + have hend : G.ends f = Sym2.mk q r := + (Sym2.mem_and_mem_iff hqr).mp ⟨hfdata.1, hrf⟩ + have hfb : f ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨q, hqX, r, hrX, hend⟩ + rcases hfdata.2 with hfa | hfc + · have hfalpha : f ∈ BoundaryColorEdges G phi X alpha := by + simp [BoundaryColorEdges, hfb, hfa] + have hempty := halphaClosed alpha (by simp) + rw [hempty] at hfalpha + simp at hfalpha + · have hfcolor : f ∈ BoundaryColorEdges G phi X c := by + simp [BoundaryColorEdges, hfb, hfc] + have hempty := hcClosed c (by simp) + rw [hempty] at hfcolor + simp at hfcolor + +private theorem helper_pathEdgeOutside_590.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (alpha beta : Fin k), + let X : Finset V := TreeSequenceVertexSet base.core; + ∀ (u v : V) (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath base.core phi alpha beta u v P → + ∀ (f : E), Sum.inr f ∈ P.support → + ∃ (w : V), Sum.inl w ∈ P.support ∧ w ∉ X ∧ Incident G w f := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base alpha beta X u v P hExit f hfSupport + rcases hExit with ⟨hPath, hLength, huX, hvX, hMissing, honly⟩ + obtain ⟨m, hm, hmle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hfSupport + have hmpos : 0 < m := by + by_contra h + have hmzero : m = 0 := by omega + rw [hmzero] at hm + simp at hm + have hmlt : m < P.length := by + by_contra h + have hmlast : m = P.length := by omega + rw [hmlast] at hm + simp at hm + have hprev := P.adj_getVert_succ (i := m - 1) (by omega) + rw [show m - 1 + 1 = m by omega, hm] at hprev + obtain ⟨w, hwPrev⟩ : ∃ w : V, P.getVert (m - 1) = Sum.inl w := by + cases hnode : P.getVert (m - 1) with + | inl w => exact ⟨w, rfl⟩ + | inr e => + rw [hnode] at hprev + simp [TwoColorIncidenceGraph] at hprev + have hnext := P.adj_getVert_succ (i := m) hmlt + rw [hm] at hnext + obtain ⟨z, hzNext⟩ : ∃ z : V, P.getVert (m + 1) = Sum.inl z := by + cases hnode : P.getVert (m + 1) with + | inl z => exact ⟨z, rfl⟩ + | inr e => + rw [hnode] at hnext + simp [TwoColorIncidenceGraph] at hnext + have hwIncident : Incident G w f := by + rw [hwPrev] at hprev + simpa [TwoColorIncidenceGraph] using hprev.1 + have hzIncident : Incident G z f := by + rw [hzNext] at hnext + simpa [TwoColorIncidenceGraph] using hnext.1 + have hwSupport : Sum.inl w ∈ P.support := by + rw [← hwPrev] + exact P.getVert_mem_support (m - 1) + have hzSupport : Sum.inl z ∈ P.support := by + rw [← hzNext] + exact P.getVert_mem_support (m + 1) + by_cases hwX : w ∈ X + · by_cases hzX : z ∈ X + · have hwv : w = v := + (honly w (by simpa [X] using hwX)).mp hwSupport + have hzv : z = v := + (honly z (by simpa [X] using hzX)).mp hzSupport + have hverts : P.getVert (m - 1) = P.getVert (m + 1) := by + rw [hwPrev, hzNext, hwv, hzv] + have hindices := hPath.getVert_injOn + (show m - 1 ≤ P.length by omega) + (show m + 1 ≤ P.length by omega) hverts + omega + · exact ⟨z, hzSupport, hzX, hzIncident⟩ + · exact ⟨w, hwSupport, hwX, hwIncident⟩ + +private theorem helper_transportExit_653.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (alpha beta : Fin k), + let X : Finset V := TreeSequenceVertexSet base.core; + ∀ (c : Fin k), ¬alpha = c → + let roots : Finset (V ⊕ E) := + {z : V ⊕ E | match z with | Sum.inl u => u ∉ X | Sum.inr _ => False}; + let rho : PartialEdgeColoring E k := fun (f : E) ↦ if + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha c z then if phi f = some alpha then + some c else if phi f = some c then some alpha else phi f else phi f; + let selected : E → Prop := fun (f : E) ↦ + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha c z; ( + ∀ (f : E), rho f = some beta ↔ phi f = some beta) → ( + ∀ u ∉ X, + ∀ (f : E), Incident G u f → phi f = some alpha ∨ phi f = some c → selected f) → ( + ∀ (u v : V) (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath base.core phi alpha beta u v P → + ∀ (f : E), Sum.inr f ∈ P.support → + ∃ (w : V), Sum.inl w ∈ P.support ∧ w ∉ X ∧ Incident G w f) → + ∀ (u v : V) (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath base.core phi alpha beta u v P → + ∃ (Q : (TwoColorIncidenceGraph G rho c beta).Walk (Sum.inl u) (Sum.inl v)), TreeExitPath + base.core rho c beta u v Q ∧ Q.support = P.support := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base alpha beta X c hac roots rho selected hbetaFixed + selectedOfOutside pathEdgeOutside u v P hExit + have selectedAlphaEdge : ∀ f : E, Sum.inr f ∈ P.support → + phi f = some alpha → selected f := by + intro f hfP hfa + obtain ⟨w, hwP, hwX, hwf⟩ := pathEdgeOutside u v P hExit f hfP + exact selectedOfOutside w hwX f hwf (Or.inl hfa) + have adjacencyTransport : + ∀ (z w : Sum V E), z ∈ P.support → w ∈ P.support → (TwoColorIncidenceGraph G phi alpha + beta).Adj z w → (TwoColorIncidenceGraph G rho c beta).Adj z w := by + intro z w hzP hwP hadj + cases z with + | inl z => + cases w with + | inl w => exact False.elim hadj + | inr f => + rcases hadj with ⟨hzf, hcolor⟩ + refine ⟨hzf, ?_⟩ + rcases hcolor with hfa | hfb + · left + have hsel := selectedAlphaEdge f hwP hfa + change ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + simp only [rho] + rw [ite_eq_left hsel, ite_eq_left hfa] + · right + exact (hbetaFixed f).2 hfb + | inr f => + cases w with + | inl w => + rcases hadj with ⟨hwf, hcolor⟩ + refine ⟨hwf, ?_⟩ + rcases hcolor with hfa | hfb + · left + have hsel := selectedAlphaEdge f hzP hfa + change ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + simp only [rho] + rw [ite_eq_left hsel, ite_eq_left hfa] + · right + exact (hbetaFixed f).2 hfb + | inr e => exact False.elim hadj + have rebuild : ∀ {s t : Sum V E} + (R : (TwoColorIncidenceGraph G phi alpha beta).Walk s t), + (∀ z, z ∈ R.support → z ∈ P.support) → + ∃ Q : (TwoColorIncidenceGraph G rho c beta).Walk s t, + Q.support = R.support ∧ Q.length = R.length := by + intro s t R + induction R with + | nil => + intro hsub + exact ⟨.nil, rfl, rfl⟩ + | @cons s w t hsw R ih => + intro hsub + have hsP : s ∈ P.support := hsub s (by simp) + have hwP : w ∈ P.support := hsub w (by simp) + obtain ⟨Q, hQsupport, hQlength⟩ := ih (by + intro z hz + exact hsub z (by simp [hz])) + have hsw' := adjacencyTransport s w hsP hwP hsw + refine ⟨.cons hsw' Q, ?_, ?_⟩ + · simp [hQsupport] + · simp [hQlength] + obtain ⟨Q, hQsupport, hQlength⟩ := rebuild P (by + intro z hz + exact hz) + have hQpath : Q.IsPath := by + apply SimpleGraph.Walk.IsPath.mk' + rw [hQsupport] + exact hExit.1.support_nodup + have hmissing : c ∈ MissingColors G rho u ∨ + beta ∈ MissingColors G rho u := by + rcases hExit.2.2.2.2.1 with halphaMissing | hbetaMissing + · left + have huX : u ∉ X := by simpa [X] using hExit.2.2.1 + have hnotAlpha : alpha ∉ PresentColors G phi u := by + simpa [MissingColors] using halphaMissing + have hnotC : c ∉ PresentColors G rho u := by + intro hcPresent + obtain ⟨f, huf, hrhof⟩ := by + simpa [PresentColors] using hcPresent + by_cases hsel : selected f + · change ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + by_cases hfa : phi f = some alpha + · apply hnotAlpha + simpa [PresentColors] using + (show ∃ q, Incident G u q ∧ phi q = some alpha from + ⟨f, huf, hfa⟩) + · by_cases hfc : phi f = some c + · have hrhoAlpha : rho f = some alpha := by + simp only [rho] + rw [ite_eq_left hsel, ite_eq_right hfa, ite_eq_left hfc] + have : some alpha = some c := hrhoAlpha.symm.trans hrhof + exact hac (Option.some.inj this) + · have hrhoOld : rho f = phi f := by + simp only [rho] + rw [ite_eq_left hsel, ite_eq_right hfa, ite_eq_right hfc] + exact hfc (hrhoOld.symm.trans hrhof) + · change ¬ ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + have hfc : phi f = some c := by + have hrhoOld : rho f = phi f := by + simp only [rho] + rw [ite_eq_right hsel] + exact hrhoOld.symm.trans hrhof + have hchosen := selectedOfOutside u huX f huf (Or.inr hfc) + exact hsel hchosen + simpa [MissingColors] using hnotC + · right + have hnotBeta : beta ∉ PresentColors G phi u := by + simpa [MissingColors] using hbetaMissing + have hnotBetaRho : beta ∉ PresentColors G rho u := by + intro hbPresent + obtain ⟨f, huf, hrf⟩ := by + simpa [PresentColors] using hbPresent + apply hnotBeta + simpa [PresentColors] using + (show ∃ q, Incident G u q ∧ phi q = some beta from + ⟨f, huf, (hbetaFixed f).1 hrf⟩) + simpa [MissingColors] using hnotBetaRho + refine ⟨Q, ?_, hQsupport⟩ + refine ⟨hQpath, ?_, hExit.2.2.1, hExit.2.2.2.1, hmissing, ?_⟩ + · rw [hQlength] + exact hExit.2.1 + · intro w hw + rw [hQsupport] + exact hExit.2.2.2.2.2 w hw + +private theorem helper_hcClosedRho_796.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (alpha : Fin k), + let X : Finset V := TreeSequenceVertexSet base.core; + ∀ (c : Fin k), TreeColorSetClosed G phi base.core { c } → + let roots : Finset (V ⊕ E) := + {z : V ⊕ E | match z with | Sum.inl u => u ∉ X | Sum.inr _ => False}; + let rho : PartialEdgeColoring E k := fun (f : E) ↦ if + ∃ z ∈ roots, Sum.inr f ∈ TwoColorComponent G phi alpha c z then if phi f = some alpha then + some c else if phi f = some c then some alpha else phi f else phi f; (IsProperEdgeColoring + G rho ∧ IsOneEdgeUncolored rho e0 ∧ StableColoring base.core ∅ phi rho ∧ + TreeColoringInvariant base.core phi rho ∧ + ∀ (f : E), TreeIncidentEdge base.core f → rho f = phi f) → TreeColorSetClosed G rho base.core + { c } := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base alpha X c hcClosed roots rho hstableCore + unfold TreeColorSetClosed + intro d hd + have hdc : d = c := Finset.mem_singleton.mp hd + subst d + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + have hfBoundary : f ∈ BoundaryEdges G X ∧ rho f = some c := by + simpa [BoundaryColorEdges] using hf + have hfIncident : TreeIncidentEdge base.core f := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hfBoundary + obtain ⟨u, huX, v, hvX, hends⟩ := hfBoundary.1 + exact ⟨u, by simpa [X] using huX, by + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _⟩ + have hfixed := hstableCore.2.2.2.2 f hfIncident + have hfOld : f ∈ BoundaryColorEdges G phi X c := by + have hcolor : phi f = some c := by + rw [← hfixed] + exact hfBoundary.2 + simp [BoundaryColorEdges, hfBoundary.1, hcolor] + have hempty := hcClosed c (by simp) + rw [hempty] at hfOld + simp at hfOld + +private theorem helper_branch_588.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → + ∀ (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base) (alpha beta : Fin k), alpha + ≠ beta → + ∀ (a₁ b₁ a₂ b₂ : V) (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₁) (Sum.inl + b₁)) (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl a₂) (Sum.inl b₂)), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let X : Finset V := TreeSequenceVertexSet base.core; + let x : V := Tn.vertex base.supportPosition; x ∈ TreeSequenceVertexSet Tn → X = + TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet base.closure → x ∈ X → + ∀ c ∈ MissingColors G phi x, TreeColorSetClosed G phi base.core { c } → TreeColorSetClosed G + phi base.core { alpha } → TreeExitPath base.core phi alpha beta a₁ b₁ P₁ → TreeExitPath + base.core phi alpha beta a₂ b₂ P₂ → c ≠ beta → ( + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → CombinedStableColoring Tn base.closure (TashkinovStoredColors ett.series.data n) phi + sigma → c ∈ TreeMissingColors sigma base.core → TreeColorSetClosed G sigma base.core { c } + → + ∀ (Q₁ : (TwoColorIncidenceGraph G sigma c beta).Walk (Sum.inl a₁) (Sum.inl b₁)) (Q₂ : + (TwoColorIncidenceGraph G sigma c beta).Walk (Sum.inl a₂) (Sum.inl b₂)), TreeExitPath + base.core sigma c beta a₁ b₁ Q₁ → TreeExitPath base.core sigma c beta a₂ b₂ Q₂ → False) → + ¬alpha = c → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hproper hone base H alpha beta hne a₁ b₁ a₂ b₂ P₁ P₂ n + Tn X x hxT hcoreVertices hxX c hcxMissing hcClosed halphaClosed hP1 hP2 hcNeBeta finish hac + have componentOutside : ∀ (u : V), u ∉ X → ∀ (v : V), + Sum.inl v ∈ TwoColorComponent G phi alpha c (Sum.inl u) → + v ∉ X := by + exact @helper_componentOutside_422 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base alpha c hcClosed halphaClosed + let roots : Finset (Sum V E) := Finset.univ.filter fun z => + match z with + | Sum.inl u => u ∉ X + | Sum.inr _ => False + let rho : PartialEdgeColoring E k := fun f => + if ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z then + if phi f = some alpha then some c + else if phi f = some c then some alpha + else phi f + else phi f + have hrecolorCore : OutsideKempeRecoloring base.core phi rho alpha c := by + unfold OutsideKempeRecoloring + refine ⟨hac, roots, ?_, ?_⟩ + · intro z hz v hvComponent + simp only [roots, Finset.mem_filter, Finset.mem_univ, true_and] at hz + cases z with + | inl u => + exact componentOutside u hz v hvComponent + | inr f => + exact False.elim hz + · intro f + rfl + have hTsubset : TreeSequenceVertexSet Tn ⊆ X := by + rw [hcoreVertices] + exact Finset.subset_union_left + have hRsubset : TreeSequenceVertexSet base.closure ⊆ X := by + rw [hcoreVertices] + exact Finset.subset_union_right + have restrictRecolor : ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ X → + OutsideKempeRecoloring S phi rho alpha c := by + intro S hsub + rcases hrecolorCore with ⟨hneac, roots', hout, hformula⟩ + refine ⟨hneac, roots', ?_, hformula⟩ + intro z hz v hvComponent hvS + exact hout z hz v hvComponent (hsub hvS) + have hrecolorT := restrictRecolor Tn hTsubset + have hrecolorR := restrictRecolor base.closure hRsubset + have hstableCore := OutsideKempeRecoloringStable G e0 base.core ∅ + phi rho alpha c hproper hone hrecolorCore + have hstableT := OutsideKempeRecoloringStable G e0 Tn + (TashkinovStoredColors ett.series.data n) + phi rho alpha c hproper hone hrecolorT + have hstableR := OutsideKempeRecoloringStable G e0 base.closure ∅ + phi rho alpha c hproper hone hrecolorR + have hrhoProper : IsProperEdgeColoring G rho := hstableCore.1 + have hrhoOne : IsOneEdgeUncolored rho e0 := hstableCore.2.1 + have hrhoCombined : CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data n) phi rho := by + exact ⟨hstableT.2.2.1, hstableR.2.2.1⟩ + let selected : E → Prop := fun f => ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z + have hbetaFixed : ∀ f : E, + rho f = some beta ↔ phi f = some beta := by + intro f + by_cases hsel : selected f + · change ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + simp only [rho] + rw [ite_eq_left hsel] + by_cases hfa : phi f = some alpha + · rw [ite_eq_left hfa, hfa] + simp [hcNeBeta, hne] + · rw [ite_eq_right hfa] + by_cases hfc : phi f = some c + · rw [ite_eq_left hfc, hfc] + simp [hne, hcNeBeta] + · rw [ite_eq_right hfc] + · change ¬ ∃ z ∈ roots, + Sum.inr f ∈ TwoColorComponent G phi alpha c z at hsel + simp only [rho] + rw [ite_eq_right hsel] + have selectedOfOutside : ∀ (u : V), u ∉ X → ∀ (f : E), + Incident G u f → + (phi f = some alpha ∨ phi f = some c) → selected f := by + intro u hu f huf hfcolor + refine ⟨Sum.inl u, ?_, ?_⟩ + · simp [roots, hu] + · change (TwoColorIncidenceGraph G phi alpha c).connectedComponentMk + (Sum.inr f) = + (TwoColorIncidenceGraph G phi alpha c).connectedComponentMk + (Sum.inl u) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha c).Adj + (Sum.inl u) (Sum.inr f) from ⟨huf, hfcolor⟩)).symm + have pathEdgeOutside : + ∀ (u v : V) (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath base.core phi alpha beta u v P → + ∀ f : E, Sum.inr f ∈ P.support → + ∃ w : V, Sum.inl w ∈ P.support ∧ w ∉ X ∧ Incident G w f := by + exact @helper_pathEdgeOutside_590 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base alpha beta + have transportExit : + ∀ (u v : V) (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath base.core phi alpha beta u v P → + ∃ Q : (TwoColorIncidenceGraph G rho c beta).Walk (Sum.inl u) (Sum.inl v), TreeExitPath + base.core rho c beta u v Q ∧ Q.support = P.support := by + exact @helper_transportExit_653 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base alpha beta c hac hbetaFixed selectedOfOutside pathEdgeOutside + obtain ⟨Q₁, hQ₁, hQ₁Support⟩ := transportExit a₁ b₁ P₁ hP1 + obtain ⟨Q₂, hQ₂, hQ₂Support⟩ := transportExit a₂ b₂ P₂ hP2 + have hcMissingRho : c ∈ TreeMissingColors rho base.core := by + unfold TreeMissingColors + refine Finset.mem_biUnion.mpr ⟨x, by simpa [X] using hxX, ?_⟩ + rw [hstableT.2.2.1.2 x hxT] + exact hcxMissing + have hcClosedRho : TreeColorSetClosed G rho base.core {c} := by + exact @helper_hcClosedRho_796 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base alpha c hcClosed hstableCore + exact finish rho hrhoProper hrhoOne hrhoCombined hcMissingRho hcClosedRho + Q₁ Q₂ hQ₁ hQ₂ + +private theorem helper_presentBound_921.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let x : V := Tn.vertex base.supportPosition; (PresentColors G phi x).card ≤ Degree G x := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base n Tn x + have chooseEdge (d : {d : Fin k // d ∈ PresentColors G phi x}) : + ∃ f, Incident G x f ∧ phi f = some d.1 := by + simpa [PresentColors] using d.property + let select : {d : Fin k // d ∈ PresentColors G phi x} → + {f : E // Incident G x f} := fun d => + ⟨Classical.choose (chooseEdge d), + (Classical.choose_spec (chooseEdge d)).1⟩ + have selectColor : ∀ d, phi (select d).1 = some d.1 := by + intro d + exact (Classical.choose_spec (chooseEdge d)).2 + have selectInjective : Function.Injective select := by + intro d e hde + apply Subtype.ext + apply Option.some.inj + calc + some (d : Fin k) = phi (select d).1 := (selectColor d).symm + _ = phi (select e).1 := by rw [hde] + _ = some (e : Fin k) := selectColor e + let : Fintype {d : Fin k // d ∈ PresentColors G phi x} := + Fintype.ofFinite _ + have hcard := Fintype.card_le_of_injective select selectInjective + change (PresentColors G phi x).card ≤ + (Finset.univ.filter (fun f => Incident G x f)).card + simpa [Fintype.card_subtype] using hcard + +private theorem helper_hlowerElem_973.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (base : HierarchyBase ett phi) (_ : TashkinovHierarchy ett base), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; ColoredVertexSetElementary G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), Decidable.byContradiction fun (a : + ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ)))) (TreeSequenceVertexSet Tn) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett hMP hpositive hlower base H n Tn + by_cases honeRound : ett.rounds = 1 + · have htech := TechnicalTheoremBase G k ett.rounds e0 input ett.series + have hTn : Tn = ett.series.data.tree ⟨1, by omega⟩ := by + apply congrArg (fun i : Fin (ett.rounds + 2) => ett.series.data.tree i) + apply Fin.ext + simp [n, honeRound] + have hcol : (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) = 0 := by + apply Fin.ext + simp [honeRound] + rw [hTn, hcol] + exact htech.1 + · have hgt : 1 < ett.rounds := by omega + obtain ⟨pred, hpredRound, hpredMP, htrees, hdata⟩ := + CertifiedETTPredecessor G k e0 input T phi ett hMP hgt + have hpredElem := hlower pred (by omega) (by omega) hpredMP + have hp : ColoredVertexSetElementary G + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) + (TreeSequenceVertexSet + (ett.series.data.tree ⟨ett.rounds, by omega⟩)) := hpredElem.1 + have heq : (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + rfl + rw [heq] at hp + simpa [Tn, n] using hp + +lemma Step1ZeroDividerAnchorPE {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (hMP : MaximumProperty ett) (hpositive : 0 < ett.rounds) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) + (hdividerZero : H.dividerCount = 0) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (halpha : alpha ∈ TreeMissingColors phi + (HierarchyStarredStage H (Fin.last H.dividerCount))) + (hclosed : TreeColorSetClosed G phi + (HierarchyStarredStage H (Fin.last H.dividerCount)) {alpha}) + (a₁ b₁ a₂ b₂ : V) + (P₁ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₁) (Sum.inl b₁)) + (P₂ : (TwoColorIncidenceGraph G phi alpha beta).Walk + (Sum.inl a₂) (Sum.inl b₂)) + (hP₁ : TreeExitPath + (HierarchyStarredStage H (Fin.last H.dividerCount)) + phi alpha beta a₁ b₁ P₁) + (hP₂ : TreeExitPath + (HierarchyStarredStage H (Fin.last H.dividerCount)) + phi alpha beta a₂ b₂ P₂) + (hpaths : ∀ x, x ∈ P₁.support → x ∉ P₂.support) + (ha : a₁ ≠ a₂) + (hPE : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) : + False := by + classical + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + let X : Finset V := TreeSequenceVertexSet base.core + have hphi : phi = ett.series.data.coloring n := by + simpa [n] using ett.generatingColoring + have hstar : HierarchyStarredStage H (Fin.last H.dividerCount) = + base.core := by + have hlast : Fin.last H.dividerCount = + (0 : Fin (H.dividerCount + 1)) := by + apply Fin.ext + simp [hdividerZero] + rw [hlast] + rfl + have hparallel := base.parallel hPE + rcases hparallel with ⟨hsupport, hclosure, hunion⟩ + obtain ⟨unionCert⟩ := hunion + let x : V := Tn.vertex base.supportPosition + have hxT : x ∈ TreeSequenceVertexSet Tn := by + simp [x, TreeSequenceVertexSet] + have initialVertices : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hab y hy + unfold TreeSequenceVertexSet at hy ⊢ + simp only [Finset.mem_image] at hy ⊢ + obtain ⟨i, hi, rfl⟩ := hy + obtain ⟨hlen, hvertices, hedges⟩ := hab + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, ?_⟩ + exact hvertices i + have augmentationVertices : ∀ {A B : TreeSequence G e0}, + TashkinovAugmentationSequence phi A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hab + unfold TashkinovAugmentationSequence at hab + induction hab using Relation.ReflTransGen.head_induction_on with + | refl => exact Finset.Subset.rfl + | @head A B hstep htail ih => + intro y hy + apply ih + exact initialVertices hstep.2.1 hy + have hxPrefix : x ∈ TreeSequenceVertexSet + (TreeSequencePrefix Tn base.supportPosition.val base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) := by + unfold TreeSequenceVertexSet + simp only [Finset.mem_image] + let i : Fin (base.supportPosition.val + 1) := + ⟨base.supportPosition.val, Nat.lt_succ_self _⟩ + refine ⟨i, Finset.mem_univ _, ?_⟩ + simp [TreeSequencePrefix, i, x] + have hxR : x ∈ TreeSequenceVertexSet base.closure := by + exact augmentationVertices hclosure.1 hxPrefix + have hcoreVertices : X = + TreeSequenceVertexSet Tn ∪ TreeSequenceVertexSet base.closure := by + simpa [X, Tn, n] using unionCert.vertexSet + have hxX : x ∈ X := by + rw [hcoreVertices] + exact Finset.mem_union_left _ hxT + have degreeBound : MaximumDegree G + 1 ≤ k := by + have step := ett.series.certified 0 + cases step with + | initial triple => exact triple.2.2.1 + have presentBound : (PresentColors G phi x).card ≤ Degree G x := by + exact @helper_presentBound_921 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base + have degreeAt : Degree G x ≤ MaximumDegree G := by + unfold MaximumDegree + exact Finset.le_max' _ _ (Finset.mem_insert.mpr (Or.inr + (Finset.mem_image.mpr ⟨x, by simp⟩))) + have missingAtX : (MissingColors G phi x).Nonempty := by + by_contra hempty + have hmissingEmpty : MissingColors G phi x = ∅ := + Finset.not_nonempty_iff_eq_empty.mp hempty + have hall : PresentColors G phi x = Finset.univ := by + apply Finset.eq_univ_of_forall + intro d + by_contra hd + have hm : d ∈ MissingColors G phi x := by + simp [MissingColors, hd] + rw [hmissingEmpty] at hm + exact Finset.notMem_empty d hm + have hk : k ≤ Degree G x := by + have := presentBound + simpa [hall] using this + omega + obtain ⟨c, hcxMissing⟩ := missingAtX + have hcT : c ∈ TreeMissingColors phi Tn := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨x, hxT, hcxMissing⟩ + have hcR : c ∈ TreeMissingColors phi base.closure := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨x, hxR, hcxMissing⟩ + have hlowerElem : ColoredVertexSetElementary G + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) + (TreeSequenceVertexSet Tn) := by + exact @helper_hlowerElem_973 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett hMP hpositive hlower base H + have hcommon := ParallelCommonMissingClosed G k e0 input T phi phi ett + hpositive base hphi hPE hlowerElem + have hcClosed : TreeColorSetClosed G phi base.core {c} := by + unfold TreeColorSetClosed at hcommon ⊢ + intro d hd + have hdc : d = c := Finset.mem_singleton.mp hd + subst d + exact hcommon c (Finset.mem_inter.mpr ⟨hcT, hcR⟩) + have halphaClosed : TreeColorSetClosed G phi base.core {alpha} := by + simpa [hstar] using hclosed + have hP1 : TreeExitPath base.core phi alpha beta a₁ b₁ P₁ := by + simpa [hstar] using hP₁ + have hP2 : TreeExitPath base.core phi alpha beta a₂ b₂ P₂ := by + simpa [hstar] using hP₂ + have exitBoundary : + ∀ (u v : V) (P : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath base.core phi alpha beta u v P → + ∃ f : E, f ∈ BoundaryColorEdges G phi X beta ∧ Incident G v f ∧ Sum.inr f ∈ P.support := by + exact @helper_exitBoundary_285 V E inferInstance inferInstance inferInstance inferInstance G + k e0 input T phi ett base alpha beta halphaClosed + obtain ⟨f₁, hf₁Boundary, hf₁Incident, hf₁Support⟩ := + exitBoundary a₁ b₁ P₁ hP1 + obtain ⟨f₂, hf₂Boundary, hf₂Incident, hf₂Support⟩ := + exitBoundary a₂ b₂ P₂ hP2 + have hbetaPresent : beta ∈ PresentColors G phi x := by + have hbetaNotMissing : beta ∉ MissingColors G phi x := by + intro hbetaMissing + have hbetaT : beta ∈ TreeMissingColors phi Tn := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨x, hxT, hbetaMissing⟩ + have hbetaR : beta ∈ TreeMissingColors phi base.closure := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨x, hxR, hbetaMissing⟩ + have hbetaClosed : TreeColorSetClosed G phi base.core {beta} := by + unfold TreeColorSetClosed at hcommon ⊢ + intro d hd + have hdb : d = beta := Finset.mem_singleton.mp hd + subst d + exact hcommon beta (Finset.mem_inter.mpr ⟨hbetaT, hbetaR⟩) + have hempty := hbetaClosed beta (by simp) + rw [hempty] at hf₁Boundary + simp at hf₁Boundary + simpa [MissingColors] using hbetaNotMissing + have hcNeBeta : c ≠ beta := by + intro hcb + subst c + have hnot : beta ∉ PresentColors G phi x := by + simpa [MissingColors] using hcxMissing + exact hnot hbetaPresent + have finish : + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → CombinedStableColoring Tn base.closure (TashkinovStoredColors ett.series.data n) phi + sigma → c ∈ TreeMissingColors sigma base.core → TreeColorSetClosed G sigma base.core {c} → + ∀ (Q₁ : (TwoColorIncidenceGraph G sigma c beta).Walk (Sum.inl a₁) (Sum.inl b₁)) (Q₂ : + (TwoColorIncidenceGraph G sigma c beta).Walk (Sum.inl a₂) (Sum.inl b₂)), TreeExitPath + base.core sigma c beta a₁ b₁ Q₁ → TreeExitPath base.core sigma c beta a₂ b₂ Q₂ → False := by + exact @helper_finish_411 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett hMP hpositive hlower base beta a₁ b₁ a₂ b₂ ha hPE hxT hxR hxX c + hcxMissing hcNeBeta + by_cases hac : alpha = c + · subst alpha + have stableRefl : ∀ (S : TreeSequence G e0) (C : Finset (Fin k)), + StableColoring S C phi phi := by + intro S C + constructor + · intro f hf hcolor + rfl + · intro v hv + rfl + have hcombined : CombinedStableColoring Tn base.closure + (TashkinovStoredColors ett.series.data n) phi phi := + ⟨stableRefl Tn _, stableRefl base.closure ∅⟩ + have hcMissingCore : c ∈ TreeMissingColors phi base.core := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr + ⟨x, by simpa [X] using hxX, hcxMissing⟩ + exact finish phi hproper hone hcombined hcMissingCore hcClosed P₁ P₂ hP1 hP2 + · exact @helper_branch_588 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett hproper hone base H alpha beta hne a₁ b₁ a₂ b₂ P₁ P₂ hxT hcoreVertices hxX + c hcxMissing hcClosed halphaClosed hP1 hP2 hcNeBeta finish hac +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StrongInterchangeabilityKempePreserved.lean b/LeanPool/GoldbergSeymour/StrongInterchangeabilityKempePreserved.lean new file mode 100644 index 0000000000..00ee96aca9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StrongInterchangeabilityKempePreserved.lean @@ -0,0 +1,554 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapDisjointPairGraph +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapPreservesDisjointComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.TwoColorPathComponentNotCycle + +/-! +# Strong Interchangeability Kempe Preserved + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_stepSegment_97.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating), + let slotTree : Fin ett.rounds → TreeSequence G e0 := fun (q : Fin ett.rounds) => + ett.series.data.tree q.succ.castSucc; + ∀ (q : Fin ett.rounds) (hq : (↑q : ℕ) + (1 : ℕ) < ett.rounds), + TreeSequenceInitialSegment (slotTree q) + (slotTree (⟨(↑q : ℕ) + (1 : ℕ), hq⟩ : Fin ett.rounds)) := by + classical + intro V E _ _ _ G k e0 input T generating ett slotTree q hq + have cert := ett.series.certified q.succ + generalize hi : q.succ = j at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + simp_all + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hiq : i = q := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + have hcurrent : q.castSucc.succ = q.succ.castSucc := by + apply Fin.ext + rfl + have hnext : q.succ.succ = + (⟨q.val + 1, hq⟩ : Fin ett.rounds).succ.castSucc := by + apply Fin.ext + rfl + change TreeSequenceInitialSegment + (ett.series.data.tree q.succ.castSucc) + (ett.series.data.tree + (⟨q.val + 1, hq⟩ : Fin ett.rounds).succ.castSucc) + rw [← hcurrent, ← hnext] + exact orderedExtension + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hiq : i = q := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + have hcurrent : q.castSucc.succ = q.succ.castSucc := by + apply Fin.ext + rfl + have hnext : q.succ.succ = + (⟨q.val + 1, hq⟩ : Fin ett.rounds).succ.castSucc := by + apply Fin.ext + rfl + change TreeSequenceInitialSegment + (ett.series.data.tree q.succ.castSucc) + (ett.series.data.tree + (⟨q.val + 1, hq⟩ : Fin ett.rounds).succ.castSucc) + rw [← hcurrent, ← hnext] + exact orderedExtension + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hiq : i = q := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + have hcurrent : q.castSucc.succ = q.succ.castSucc := by + apply Fin.ext + rfl + have hnext : q.succ.succ = + (⟨q.val + 1, hq⟩ : Fin ett.rounds).succ.castSucc := by + apply Fin.ext + rfl + change TreeSequenceInitialSegment + (ett.series.data.tree q.succ.castSucc) + (ett.series.data.tree + (⟨q.val + 1, hq⟩ : Fin ett.rounds).succ.castSucc) + rw [← hcurrent, ← hnext] + exact orderedExtension + +private theorem helper_finishActive_227.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (t : Fin ett.rounds) (vs vt : V) (gammaS + deltaS gammaT deltaT : Fin k) (phi : PartialEdgeColoring E k) (z : V ⊕ E), + TwoColorNontrivialPathComponent G phi gammaT deltaT z → + let phiStar : PartialEdgeColoring E k := TwoColorComponentSwap G phi gammaT deltaT z; + let K : Set (V ⊕ E) := TwoColorComponent G phi gammaT deltaT z; + ∀ (r : Fin ett.rounds) (v : V), TwoColorComponentCycle G phi gammaS deltaS (Sum.inl v) → + Sum.inl vs ∉ TwoColorComponent G phi gammaS deltaS (Sum.inl v) → ( + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G phi gammaS deltaS (Sum.inl v) → w ∈ + TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) → vs = vt → + ∀ (rt : Fin ett.rounds), ( + ∀ v ∈ TreeSequenceVertexSet (ett.series.data.tree t.succ.castSucc), v ≠ vt → + TwoColorComponentCycle G phi gammaT deltaT (Sum.inl v) ∧ Sum.inl vt ∉ TwoColorComponent G + phi gammaT deltaT (Sum.inl v) ∧ + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G phi gammaT deltaT (Sum.inl v) → w ∈ + TreeSequenceVertexSet (ett.series.data.tree rt.succ.castSucc)) → + let slotTree : Fin ett.rounds → TreeSequence G e0 := fun (q : Fin ett.rounds) => + ett.series.data.tree q.succ.castSucc; TreeSequenceVertexSet (slotTree r) ⊆ + TreeSequenceVertexSet (slotTree t) → ( + ∀ (e : E), Sum.inr e ∈ K → phi e = some gammaT ∨ phi e = some deltaT) → TwoColorComponentCycle + G phiStar gammaS deltaS (Sum.inl v) ∧ Sum.inl vs ∉ TwoColorComponent G phiStar gammaS + deltaS (Sum.inl v) ∧ + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G phiStar gammaS deltaS (Sum.inl v) → w ∈ + TreeSequenceVertexSet (slotTree r) := by + classical + intro V E _ _ _ G k e0 input T generating ett t vs vt gammaS deltaS gammaT deltaT phi z hpath + phiStar K r v hcycle havoid hcontained hsupportEq rt htComponents slotTree hvertexSubset + hactive + have hvertexDisjoint : + ∀ y : V, Sum.inl y ∈ TwoColorComponent G phi gammaS deltaS (Sum.inl v) → Sum.inl y ∈ K → False + := by + intro y hyC hyK + have hyR := hcontained y hyC + have hyT : y ∈ TreeSequenceVertexSet (slotTree t) := + hvertexSubset (by simpa [slotTree] using hyR) + have hyEq : y = vt := by + by_contra hyne + obtain ⟨hyCycle, -, -⟩ := htComponents y + (by simpa [slotTree] using hyT) hyne + rcases hpath.1 with ⟨hne, leaf, hleafK, hleaf⟩ + have hleafY : leaf ∈ + TwoColorComponent G phi gammaT deltaT (Sum.inl y) := by + change (TwoColorIncidenceGraph G phi gammaT deltaT).connectedComponentMk + leaf = + (TwoColorIncidenceGraph G phi gammaT deltaT).connectedComponentMk + (Sum.inl y) + change (TwoColorIncidenceGraph G phi gammaT deltaT).connectedComponentMk + leaf = + (TwoColorIncidenceGraph G phi gammaT deltaT).connectedComponentMk z at hleafK + change (TwoColorIncidenceGraph G phi gammaT deltaT).connectedComponentMk + (Sum.inl y) = + (TwoColorIncidenceGraph G phi gammaT deltaT).connectedComponentMk z at hyK + exact hleafK.trans hyK.symm + have hpathY : TwoColorPathComponent G phi gammaT deltaT (Sum.inl y) := + ⟨hne, leaf, hleafY, hleaf⟩ + exact (TwoColorPathComponentNotCycle G phi gammaT deltaT + (Sum.inl y) hpathY) hyCycle + subst y + exact havoid (by simpa [hsupportEq] using hyC) + have hdisjoint : Disjoint + (TwoColorComponent G phi gammaS deltaS (Sum.inl v)) K := by + apply Set.disjoint_left.mpr + intro node hnC hnK + cases node with + | inl y => exact hvertexDisjoint y hnC hnK + | inr e => + rcases hcycle with ⟨cycle, hfull⟩ + have heSupport : Sum.inr e ∈ cycle.walk.support := + (hfull (Sum.inr e)).2 hnC + obtain ⟨node, -, hnodeEdge⟩ := + SimpleGraph.adj_of_mem_walk_support cycle.walk + cycle.isCycle.not_nil heSupport + cases node with + | inl y => + have hsAdj : (TwoColorIncidenceGraph G phi gammaS deltaS).Adj + (Sum.inl y) (Sum.inr e) := hnodeEdge.symm + have hsData : Incident G y e ∧ + (phi e = some gammaS ∨ phi e = some deltaS) := by + simpa [TwoColorIncidenceGraph] using hsAdj + have htAdj : (TwoColorIncidenceGraph G phi gammaT deltaT).Adj + (Sum.inl y) (Sum.inr e) := by + simpa [TwoColorIncidenceGraph] using ⟨hsData.1, hactive e hnK⟩ + have hyC : Sum.inl y ∈ + TwoColorComponent G phi gammaS deltaS (Sum.inl v) := by + change (TwoColorIncidenceGraph G phi gammaS deltaS).connectedComponentMk + (Sum.inl y) = + (TwoColorIncidenceGraph G phi gammaS deltaS).connectedComponentMk + (Sum.inl v) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hsAdj).trans hnC + have hyK : Sum.inl y ∈ K := by + change (TwoColorIncidenceGraph G phi gammaT deltaT).connectedComponentMk + (Sum.inl y) = + (TwoColorIncidenceGraph G phi gammaT deltaT).connectedComponentMk z + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + htAdj).trans hnK + exact hvertexDisjoint y hyC hyK + | inr f => simp [TwoColorIncidenceGraph] at hnodeEdge + have hcomponent := TwoColorComponentSwapPreservesDisjointComponent G phi + gammaS deltaS gammaT deltaT z (Sum.inl v) hactive hdisjoint + refine ⟨?_, ?_, ?_⟩ + · rcases hcycle with ⟨cycle, hfull⟩ + let Hstar := TwoColorIncidenceGraph G phiStar gammaS deltaS + have hedgeTransfer : ∀ edge, edge ∈ cycle.walk.edges → + edge ∈ Hstar.edgeSet := by + intro edge hedge + induction edge using Sym2.inductionOn with + | _ a b => + have haSupport := cycle.walk.fst_mem_support_of_mem_edges hedge + have hbSupport := cycle.walk.snd_mem_support_of_mem_edges hedge + have haC := (hfull a).1 haSupport + have hbC := (hfull b).1 hbSupport + have habOld : (TwoColorIncidenceGraph G phi gammaS deltaS).Adj a b := by + simpa using cycle.walk.edges_subset_edgeSet hedge + cases a with + | inl y => + cases b with + | inl w => simp [TwoColorIncidenceGraph] at habOld + | inr e => + have heNotK : Sum.inr e ∉ K := by + intro heK + exact Set.disjoint_left.mp hdisjoint hbC heK + simpa [Hstar, phiStar, TwoColorIncidenceGraph, + TwoColorComponentSwap, K, heNotK] using habOld + | inr e => + cases b with + | inl y => + have heNotK : Sum.inr e ∉ K := by + intro heK + exact Set.disjoint_left.mp hdisjoint haC heK + simpa [Hstar, phiStar, TwoColorIncidenceGraph, + TwoColorComponentSwap, K, heNotK] using habOld + | inr f => simp [TwoColorIncidenceGraph] at habOld + let newWalk := cycle.walk.transfer Hstar hedgeTransfer + refine ⟨⟨cycle.base, newWalk, cycle.isCycle.transfer hedgeTransfer⟩, ?_⟩ + intro node + rw [SimpleGraph.Walk.support_transfer] + have hn : node ∈ + TwoColorComponent G phiStar gammaS deltaS (Sum.inl v) ↔ + node ∈ TwoColorComponent G phi gammaS deltaS (Sum.inl v) := by + simpa [phiStar] using Set.ext_iff.mp hcomponent node + exact (hfull node).trans hn.symm + · simpa [phiStar] using (Set.ext_iff.mp hcomponent (Sum.inl vs)).not.mpr havoid + · intro w hw + apply hcontained w + have hn := Set.ext_iff.mp hcomponent (Sum.inl w) + exact hn.mp (by simpa [phiStar] using hw) + +private theorem helper_branch_358.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (vs : V) (gammaS deltaS gammaT deltaT : + Fin k) (phi : PartialEdgeColoring E k) (z : V ⊕ E), + let phiStar : PartialEdgeColoring E k := TwoColorComponentSwap G phi gammaT deltaT z; + let K : Set (V ⊕ E) := TwoColorComponent G phi gammaT deltaT z; + ∀ (r : Fin ett.rounds) (v : V), TwoColorComponentCycle G phi gammaS deltaS (Sum.inl v) → + Sum.inl vs ∉ TwoColorComponent G phi gammaS deltaS (Sum.inl v) → ( + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G phi gammaS deltaS (Sum.inl v) → w ∈ + TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) → + let slotTree : Fin ett.rounds → TreeSequence G e0 := fun (q : Fin ett.rounds) => + ett.series.data.tree q.succ.castSucc; (( + ∀ (e : E), Sum.inr e = z → phi e = some gammaT ∨ phi e = some deltaT) → + ∀ (e : E), Sum.inr e ∈ K → phi e = some gammaT ∨ phi e = some deltaT) → (( + ∀ (e : E), Sum.inr e ∈ K → phi e = some gammaT ∨ phi e = some deltaT) → TwoColorComponentCycle + G phiStar gammaS deltaS (Sum.inl v) ∧ Sum.inl vs ∉ TwoColorComponent G phiStar gammaS + deltaS (Sum.inl v) ∧ + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G phiStar gammaS deltaS (Sum.inl v) → w ∈ + TreeSequenceVertexSet (slotTree r)) → + ∀ (f : E), z = Sum.inr f → TwoColorComponentCycle G (TwoColorComponentSwap G phi gammaT deltaT + (Sum.inr f)) gammaS deltaS (Sum.inl v) ∧ Sum.inl vs ∉ TwoColorComponent G + (TwoColorComponentSwap G phi gammaT deltaT (Sum.inr f)) gammaS deltaS (Sum.inl v) ∧ + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G (TwoColorComponentSwap G phi gammaT deltaT (Sum.inr + f)) gammaS deltaS (Sum.inl v) → w ∈ TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett vs gammaS deltaS gammaT deltaT phi z phiStar K r + v hcycle havoid hcontained slotTree hrootActive finishActive f hz + by_cases hfActive : phi f = some gammaT ∨ phi f = some deltaT + · have hresult := finishActive (hrootActive (by + intro e he + have hef : e = f := Sum.inr.inj (he.trans hz) + simpa [hef] using hfActive)) + simpa [phiStar, slotTree, hz] using hresult + · have hfGamma : phi f ≠ some gammaT := fun h => hfActive (Or.inl h) + have hfDelta : phi f ≠ some deltaT := fun h => hfActive (Or.inr h) + have hrootEmpty : + (TwoColorIncidenceGraph G phi gammaT deltaT).neighborSet (Sum.inr f) = ∅ := by + ext node + cases node <;> simp [TwoColorIncidenceGraph, hfGamma, hfDelta] + have hphiEq : phiStar = phi := by + funext e + by_cases heK : Sum.inr e ∈ K + · have hreach : (TwoColorIncidenceGraph G phi gammaT deltaT).Reachable + (Sum.inr e) (Sum.inr f) := by + simpa [K, hz] using SimpleGraph.ConnectedComponent.exact heK + have hnodeEq : (Sum.inr e : Sum V E) = Sum.inr f := by + by_contra hne + exact (SimpleGraph.not_reachable_of_neighborSet_right_eq_empty + hne hrootEmpty) hreach + have hef : e = f := Sum.inr.inj hnodeEq + subst e + simp [phiStar, TwoColorComponentSwap, K, heK, hfGamma, hfDelta] + · simp [phiStar, TwoColorComponentSwap, K, heK] + have hresult : + TwoColorComponentCycle G phiStar gammaS deltaS (Sum.inl v) ∧ + Sum.inl vs ∉ TwoColorComponent G phiStar gammaS deltaS (Sum.inl v) ∧ + ∀ w : V, + Sum.inl w ∈ TwoColorComponent G phiStar gammaS deltaS (Sum.inl v) → + w ∈ TreeSequenceVertexSet (slotTree r) := by + rw [hphiEq] + simpa [slotTree] using ⟨hcycle, havoid, hcontained⟩ + simpa [phiStar, slotTree, hz] using hresult + +private theorem helper_branch_124.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : + ExtendedTashkinovTree G k e0 input T generating) (s t : Fin ett.rounds) (vs vt : V) + (gammaS deltaS gammaT deltaT : Fin k) (phi : PartialEdgeColoring E k) (z : V ⊕ E), vs ≠ vt + ∨ (↑s : ℕ) < (↑t : ℕ) → TwoColorNontrivialPathComponent G phi gammaT deltaT z → + ETTStrongInterchangeable ett t vt phi gammaT deltaT → + let _ : PartialEdgeColoring E k := TwoColorComponentSwap G phi gammaT deltaT z; + let _ : Set (V ⊕ E) := TwoColorComponent G phi gammaT deltaT z; + ∀ (r : Fin ett.rounds), ( + ∀ (q : Fin ett.rounds), (↑s : ℕ) < (↑q : ℕ) → (↑q : ℕ) < (↑r : ℕ) → ett.series.data.kind + q.succ = some TashkinovExtensionKind.RE) → + ∀ (v : V), TwoColorComponentCycle G phi gammaS deltaS (Sum.inl v) → Sum.inl vs ∉ + TwoColorComponent G phi gammaS deltaS (Sum.inl v) → ( + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G phi gammaS deltaS (Sum.inl v) → w ∈ + TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) → ¬vs ≠ vt → + TwoColorComponentCycle G (TwoColorComponentSwap G phi gammaT deltaT z) gammaS deltaS + (Sum.inl v) ∧ Sum.inl vs ∉ TwoColorComponent G (TwoColorComponentSwap G phi gammaT deltaT + z) gammaS deltaS (Sum.inl v) ∧ + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G (TwoColorComponentSwap G phi gammaT deltaT z) + gammaS deltaS (Sum.inl v) → w ∈ TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett s t vs vt gammaS deltaS gammaT deltaT phi z + hrelative hpath htSI phiStar K r hbetween v hcycle havoid hcontained hsupports + have hst : s.val < t.val := hrelative.resolve_left hsupports + have hsupportEq : vs = vt := not_ne_iff.mp hsupports + rcases htSI with + ⟨_, hkindT, _, rt, _, _, _, htComponents⟩ + have hrt : r.val ≤ t.val := by + by_contra hnot + have htBefore : t.val < r.val := by omega + have htRE := hbetween t hst htBefore + rw [hkindT] at htRE + simp at htRE + let slotTree (q : Fin ett.rounds) : TreeSequence G e0 := + ett.series.data.tree q.succ.castSucc + have segmentTrans {A B C : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C) : + TreeSequenceInitialSegment A C := by + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨le_trans hab hbc, ?_, ?_⟩ + · intro i + exact (hvbc (Fin.castLE (Nat.succ_le_succ hab) i)).trans (hvab i) + · intro i + exact (hebc (Fin.castLE hab i)).trans (heab i) + have stepSegment := @helper_stepSegment_97 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett + have chainFrom : ∀ d : ℕ, (hd : r.val + d ≤ t.val) → + TreeSequenceInitialSegment (slotTree r) + (slotTree ⟨r.val + d, lt_of_le_of_lt hd t.isLt⟩) := by + intro d hd + induction d with + | zero => + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + | succ d ih => + have hprev := ih (by omega) + let q : Fin ett.rounds := ⟨r.val + d, by omega⟩ + have hqbound : q.val + 1 < ett.rounds := by + dsimp [q] + omega + have hstep := stepSegment q hqbound + have htarget : (⟨q.val + 1, hqbound⟩ : Fin ett.rounds) = + ⟨r.val + Nat.succ d, lt_of_le_of_lt hd t.isLt⟩ := by + apply Fin.ext + dsimp [q] + omega + rw [← htarget] + exact segmentTrans hprev hstep + have hrtSegment : TreeSequenceInitialSegment (slotTree r) (slotTree t) := by + have hval : r.val + (t.val - r.val) = t.val := Nat.add_sub_of_le hrt + have hd : r.val + (t.val - r.val) ≤ t.val := by omega + let qEnd : Fin ett.rounds := + ⟨r.val + (t.val - r.val), lt_of_le_of_lt hd t.isLt⟩ + have hchain := chainFrom (t.val - r.val) hd + have hindex : qEnd = t := by + apply Fin.ext + exact hval + change TreeSequenceInitialSegment (slotTree r) (slotTree qEnd) at hchain + rw [hindex] at hchain + exact hchain + have hvertexSubset : TreeSequenceVertexSet (slotTree r) ⊆ + TreeSequenceVertexSet (slotTree t) := + TreeSequenceInitialSegmentVertexSetSubset hrtSegment + have hrootActive : (∀ e : E, Sum.inr e = z → + phi e = some gammaT ∨ phi e = some deltaT) → + ∀ e : E, Sum.inr e ∈ K → + phi e = some gammaT ∨ phi e = some deltaT := by + intro hroot e heK + by_cases hez : Sum.inr e = z + · exact hroot e hez + · have hreach : (TwoColorIncidenceGraph G phi gammaT deltaT).Reachable + (Sum.inr e) z := + SimpleGraph.ConnectedComponent.exact heK + have heSupport := SimpleGraph.mem_support_of_reachable hez hreach + rw [SimpleGraph.mem_support] at heSupport + obtain ⟨y, hey⟩ := heSupport + cases y with + | inl y => simpa [TwoColorIncidenceGraph] using hey.2 + | inr f => simp [TwoColorIncidenceGraph] at hey + have finishActive := @helper_finishActive_227 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett t vs vt gammaS deltaS gammaT deltaT phi z hpath r v hcycle havoid + hcontained hsupportEq rt htComponents hvertexSubset + cases hz : z with + | inl u => + have hresult := finishActive + (hrootActive (by intro e he; simp [hz] at he)) + simpa [phiStar, slotTree, hz] using hresult + | inr f => + exact @helper_branch_358 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett vs gammaS deltaS gammaT deltaT phi z r v hcycle havoid + hcontained hrootActive finishActive f hz +theorem StrongInterchangeabilityKempePreserved {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) + (s t : Fin ett.rounds) (vs vt : V) + (gammaS deltaS gammaT deltaT : Fin k) + (phi : PartialEdgeColoring E k) (z : Sum V E) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (_ : ett.series.data.gamma s.succ = some gammaS) + (_ : ett.series.data.delta s.succ = some deltaS) + (_ : ett.series.data.gamma t.succ = some gammaT) + (_ : ett.series.data.delta t.succ = some deltaT) + (hrelative : vs ≠ vt ∨ s.val < t.val) + (hdifferentColors : vs ≠ vt → + Disjoint ({gammaS, deltaS} : Finset (Fin k)) {gammaT, deltaT}) + (hpath : TwoColorNontrivialPathComponent G phi gammaT deltaT z) + (htSI : ETTStrongInterchangeable ett t vt phi gammaT deltaT) + (hsSI : ETTStrongInterchangeable ett s vs phi gammaS deltaS) : + let phiStar := TwoColorComponentSwap G phi gammaT deltaT z + IsProperEdgeColoring G phiStar ∧ IsOneEdgeUncolored phiStar e0 ∧ + ETTStrongInterchangeable ett s vs phiStar gammaS deltaS := by + classical + dsimp + let phiStar := TwoColorComponentSwap G phi gammaT deltaT z + let K := TwoColorComponent G phi gammaT deltaT z + have hneT : gammaT ≠ deltaT := hpath.1.1 + have hproperStar : IsProperEdgeColoring G phiStar := by + simpa [phiStar] using + TwoColorComponentSwapProper G phi gammaT deltaT hneT hproper z + have honeStar : IsOneEdgeUncolored phiStar e0 := by + constructor + · simp [phiStar, TwoColorComponentSwap, hone.1] + · intro e he0 + obtain ⟨c, hc⟩ := hone.2 e he0 + by_cases heK : Sum.inr e ∈ K + · by_cases heGamma : phi e = some gammaT + · exact ⟨deltaT, by + simp [phiStar, TwoColorComponentSwap, K, heK, heGamma]⟩ + · by_cases heDelta : phi e = some deltaT + · exact ⟨gammaT, by + simp [phiStar, TwoColorComponentSwap, K, heK, heDelta]⟩ + · exact ⟨c, by + simpa [phiStar, TwoColorComponentSwap, K, heK, heGamma, heDelta] + using hc⟩ + · exact ⟨c, by + simpa [phiStar, TwoColorComponentSwap, K, heK] using hc⟩ + refine ⟨hproperStar, honeStar, ?_⟩ + rcases hsSI with + ⟨hneS, hkindS, hvertexS, r, hsr, hrNotRE, hbetween, hsComponents⟩ + refine ⟨hneS, hkindS, hvertexS, r, hsr, hrNotRE, hbetween, ?_⟩ + intro v hvTs hvSupport + obtain ⟨hcycle, havoid, hcontained⟩ := hsComponents v hvTs hvSupport + by_cases hsupports : vs ≠ vt + · have hgraph := TwoColorComponentSwapDisjointPairGraph G phi + gammaS deltaS gammaT deltaT z (hdifferentColors hsupports) + have hcomponent : TwoColorComponent G phiStar gammaS deltaS (Sum.inl v) = + TwoColorComponent G phi gammaS deltaS (Sum.inl v) := by + unfold TwoColorComponent + simp only [phiStar] + rw [hgraph] + refine ⟨?_, ?_, ?_⟩ + · rcases hcycle with ⟨cycle, hfull⟩ + let Hstar := TwoColorIncidenceGraph G phiStar gammaS deltaS + have hedgeTransfer : ∀ edge, edge ∈ cycle.walk.edges → + edge ∈ Hstar.edgeSet := by + intro edge hedge + have hold := cycle.walk.edges_subset_edgeSet hedge + simpa [Hstar, phiStar, hgraph] using hold + let newWalk := cycle.walk.transfer Hstar hedgeTransfer + refine ⟨⟨cycle.base, newWalk, cycle.isCycle.transfer hedgeTransfer⟩, ?_⟩ + intro node + rw [SimpleGraph.Walk.support_transfer] + have hn := Set.ext_iff.mp hcomponent node + exact (hfull node).trans hn.symm + · rw [hcomponent] + exact havoid + · intro w hw + apply hcontained w + rw [← hcomponent] + exact hw + · exact @helper_branch_124 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett s t vs vt gammaS deltaS gammaT deltaT phi z hrelative hpath htSI r + hbetween v hcycle havoid hcontained hsupports +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/StronglyClosedWitnessElementary.lean b/LeanPool/GoldbergSeymour/StronglyClosedWitnessElementary.lean new file mode 100644 index 0000000000..116cc9c0b4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/StronglyClosedWitnessElementary.lean @@ -0,0 +1,1035 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ChromaticIndex +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.Density +public import LeanPool.GoldbergSeymour.DensityCeil +public import LeanPool.GoldbergSeymour.DensityLowerBound +public import LeanPool.GoldbergSeymour.DensityValue +public import LeanPool.GoldbergSeymour.Elementary +public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors + +/-! +# Strongly Closed Witness Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_missingPairs_le_67.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k) (X : Finset V), ColoredVertexSetElementary G phi X → + let allVC : Finset (V × Fin k) := X.product Finset.univ; + let missingPairs : Finset (V × Fin k) := ({p ∈ allVC | p.2 ∈ MissingColors G phi p.1} : Finset + (V × Fin k)); + let missingUnion : Finset (Fin k) := ({c : Fin k | + ∃ v ∈ X, c ∈ MissingColors G phi v} : Finset (Fin k)); missingPairs.card ≤ missingUnion.card + := by + classical + intro V E _ _ G k phi X helementary allVC missingPairs missingUnion + let _ := Fintype.ofFinite V + apply Finset.card_le_card_of_injOn (fun p : V × Fin k => p.2) + · intro p hp + have hpm := (Finset.mem_filter.mp hp).2 + have hpall := (Finset.mem_filter.mp hp).1 + have hpX := (Finset.mem_product.mp hpall).1 + simp only [Finset.coe_filter, Finset.mem_univ, true_and, Set.mem_ofPred_eq, missingUnion] + exact ⟨p.1, hpX, hpm⟩ + · intro a ha b hb hab + have haall := (Finset.mem_filter.mp ha).1 + have hball := (Finset.mem_filter.mp hb).1 + have haX := (Finset.mem_product.mp haall).1 + have hbX := (Finset.mem_product.mp hball).1 + have ham := (Finset.mem_filter.mp ha).2 + have hbm := (Finset.mem_filter.mp hb).2 + have hv : a.1 = b.1 := by + by_contra hv + have hd := helementary haX hbX hv + have hab' : a.2 = b.2 := hab + rw [← hab'] at hbm + exact (Finset.disjoint_left.mp hd) ham hbm + apply Prod.ext + · exact hv + · exact hab + +private theorem helper_incidences_le_present_158.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] (G : LooplessMultigraph + V E) (k : ℕ) (phi : PartialEdgeColoring E k) (X : Finset V), IsProperEdgeColoring G phi → + ∀ (alpha : Fin k), + let allVC : Finset (V × Fin k) := X.product Finset.univ; + let presentPairs : Finset (V × Fin k) := ({p ∈ allVC | p.2 ∈ PresentColors G phi p.1} : Finset + (V × Fin k)); + let incidences : Finset (E × V) := ({p ∈ Finset.univ.product X | Incident G p.2 p.1 ∧ + ∃ (c : Fin k), phi p.1 = some c} : Finset (E × V)); + ∀ (incidence_witness : + ∀ p ∈ incidences, + ∃ (c : Fin k), phi p.1 = some c), + let incidenceColor : E × V → Fin k := fun (p : E × V) ↦ if hp : p ∈ incidences then + Classical.choose (incidence_witness p hp) else alpha; ( + ∀ p ∈ incidences, phi p.1 = some (incidenceColor p)) → incidences.card ≤ presentPairs.card := by + classical + intro V E _ _ _ G k phi X hproper alpha allVC presentPairs incidences incidence_witness + incidenceColor incidenceColor_spec + let _ := Fintype.ofFinite V + apply Finset.card_le_card_of_injOn + (fun p : E × V => (p.2, incidenceColor p)) + · intro p hp + have hpbase := (Finset.mem_filter.mp hp).1 + have hpX := (Finset.mem_product.mp hpbase).2 + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_product.mpr ⟨hpX, Finset.mem_univ _⟩, ?_⟩ + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨p.1, (Finset.mem_filter.mp hp).2.1, incidenceColor_spec p hp⟩ + · intro a ha b hb hab + have hv : a.2 = b.2 := congrArg Prod.fst hab + have hc : incidenceColor a = incidenceColor b := congrArg Prod.snd hab + have he : a.1 = b.1 := by + by_contra he + have hadj : AdjacentEdges G a.1 b.1 := + ⟨a.2, (Finset.mem_filter.mp ha).2.1, + hv ▸ (Finset.mem_filter.mp hb).2.1⟩ + have hh := hproper he hadj (incidenceColor_spec a ha) + exact hh (by rw [incidenceColor_spec b hb, hc]) + exact Prod.ext he hv + +private theorem helper_incidences_split_223.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V), + IsOneEdgeUncolored phi e0 → + let incidences : Finset (E × V) := ({p ∈ Finset.univ.product X | Incident G p.2 p.1 ∧ + ∃ (c : Fin k), phi p.1 = some c} : Finset (E × V)); + let internalColored : Finset E := (InternalEdges G X).erase e0; + let boundary : Finset E := BoundaryEdges G X; + let internalInc : Finset (E × V) := ({p ∈ incidences | p.1 ∈ internalColored} : Finset (E × + V)); + let boundaryInc : Finset (E × V) := ({p ∈ incidences | p.1 ∈ boundary} : Finset (E × V)); ( + ∀ {e : E} {v : V}, v ∈ X → Incident G v e → e ∈ InternalEdges G X ∨ e ∈ BoundaryEdges G X) → + internalInc ∪ boundaryInc = incidences := by + classical + intro V E _ _ _ G k e0 phi X hone incidences internalColored boundary internalInc boundaryInc + edge_classification + ext p + constructor + · intro hp + rcases Finset.mem_union.mp hp with hp | hp + · exact (Finset.mem_filter.mp hp).1 + · exact (Finset.mem_filter.mp hp).1 + · intro hp + have hpbase := (Finset.mem_filter.mp hp).1 + have hpX := (Finset.mem_product.mp hpbase).2 + have hpinc := (Finset.mem_filter.mp hp).2.1 + rcases edge_classification hpX hpinc with hi | hb + · have hne : p.1 ≠ e0 := by + intro heq + obtain ⟨c, hc⟩ := (Finset.mem_filter.mp hp).2.2 + have hc0 : phi p.1 = none := by rw [heq]; exact hone.1 + rw [hc0] at hc + cases hc + exact Finset.mem_union.mpr (Or.inl + (Finset.mem_filter.mpr ⟨hp, Finset.mem_erase.mpr ⟨hne, hi⟩⟩)) + · exact Finset.mem_union.mpr (Or.inr (Finset.mem_filter.mpr ⟨hp, hb⟩)) + +private theorem helper_edgeInc_insert_256.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) + (X : Finset V), + let edgeInc : Finset E → Finset (E × V) := fun (s : Finset E) ↦ + ({p ∈ s.product X | Incident G p.2 p.1} : Finset (E × V)); + ∀ (e : E) (s : Finset E), + edgeInc (insert e s : Finset E) = edgeInc ({ e } : Finset E) ∪ edgeInc s := by + classical + intro V E _ G X edgeInc e s + ext p + constructor + · intro hp + have hpProd := (Finset.mem_filter.mp hp).1 + have hpInc := (Finset.mem_filter.mp hp).2 + have hpe := (Finset.mem_product.mp hpProd).1 + have hpX := (Finset.mem_product.mp hpProd).2 + rcases Finset.mem_insert.mp hpe with he | hs + · apply Finset.mem_union.mpr + exact Or.inl (Finset.mem_filter.mpr + ⟨Finset.mem_product.mpr ⟨Finset.mem_singleton.mpr he, hpX⟩, hpInc⟩) + · apply Finset.mem_union.mpr + exact Or.inr (Finset.mem_filter.mpr + ⟨Finset.mem_product.mpr ⟨hs, hpX⟩, hpInc⟩) + · intro hp + rcases Finset.mem_union.mp hp with hp | hp + · have hpProd := (Finset.mem_filter.mp hp).1 + have hpInc := (Finset.mem_filter.mp hp).2 + exact Finset.mem_filter.mpr ⟨Finset.mem_product.mpr + ⟨Finset.mem_insert.mpr (Or.inl + (Finset.mem_singleton.mp (Finset.mem_product.mp hpProd).1)), + (Finset.mem_product.mp hpProd).2⟩, hpInc⟩ + · have hpProd := (Finset.mem_filter.mp hp).1 + have hpInc := (Finset.mem_filter.mp hp).2 + exact Finset.mem_filter.mpr ⟨Finset.mem_product.mpr + ⟨Finset.mem_insert_of_mem (Finset.mem_product.mp hpProd).1, + (Finset.mem_product.mp hpProd).2⟩, hpInc⟩ + +private theorem helper_edgeInc_single_internal_286.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] (G : LooplessMultigraph V E) (X : Finset V), + let edgeInc : Finset E → Finset (E × V) := fun (s : Finset E) ↦ + ({p ∈ s.product X | Incident G p.2 p.1} : Finset (E × V)); + ∀ e ∈ InternalEdges G X, + edgeInc ({ e } : Finset E) = ({ e } : Finset E).product (G.ends e).toFinset := by + classical + intro V E _ _ _ G X edgeInc e he + unfold InternalEdges at he + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at he + ext p + constructor + · intro hp + have hpProd := (Finset.mem_filter.mp hp).1 + have hpinc := (Finset.mem_filter.mp hp).2 + have hpe := Finset.mem_singleton.mp (Finset.mem_product.mp hpProd).1 + apply Finset.mem_product.mpr + exact ⟨Finset.mem_singleton.mpr hpe, + Sym2.mem_toFinset.mpr (hpe ▸ hpinc)⟩ + · intro hp + have hpe := Finset.mem_singleton.mp (Finset.mem_product.mp hp).1 + have hpend := (Finset.mem_product.mp hp).2 + have hpinc : Incident G p.2 p.1 := by + rw [hpe] + exact Sym2.mem_toFinset.mp hpend + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_product.mpr ⟨Finset.mem_singleton.mpr hpe, ?_⟩, hpinc⟩ + exact he p.2 (Sym2.mem_toFinset.mp hpend) + +private theorem helper_internal_edgeInc_card_309.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] (G : + LooplessMultigraph V E) (k : ℕ) (_ : E) (_ : PartialEdgeColoring E k) (X : Finset V), ( + ∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ)) → + ∀ (_ : V), + let edgeInc : Finset E → Finset (E × V) := fun (s : Finset E) ↦ + ({p ∈ s.product X | Incident G p.2 p.1} : Finset (E × V)); ( + ∀ (e : E) (s : Finset E), edgeInc (insert e s : Finset E) = edgeInc ({ e } : Finset E) ∪ + edgeInc s) → ( + ∀ e ∈ InternalEdges G X, edgeInc ({ e } : Finset E) = ({ e } : Finset E).product (G.ends + e).toFinset) → + ∀ s ⊆ InternalEdges G X, (edgeInc s).card = (2 : ℕ) * s.card := by + classical + intro V E _ _ _ G k e0 phi X endpoint_card x edgeInc edgeInc_insert edgeInc_single_internal s hs + induction s using Finset.induction_on with + | empty => simp [edgeInc] + | @insert e s hes ih => + rw [edgeInc_insert] + have hd : Disjoint (edgeInc {e}) (edgeInc s) := by + rw [Finset.disjoint_left] + intro p hpe hps + have hpe' := (Finset.mem_filter.mp hpe).1 + have hps' := (Finset.mem_filter.mp hps).1 + have heq : p.1 = e := Finset.mem_singleton.mp (Finset.mem_product.mp hpe').1 + have hmem : p.1 ∈ s := (Finset.mem_product.mp hps').1 + exact hes (heq ▸ hmem) + rw [Finset.card_union_of_disjoint hd] + have heI : e ∈ InternalEdges G X := hs (Finset.mem_insert_self e s) + rw [edgeInc_single_internal e heI] + have hprod : (({e} : Finset E).product (G.ends e).toFinset).card = 2 := by + calc + _ = ({e} : Finset E).card * (G.ends e).toFinset.card := + Finset.card_product _ _ + _ = 2 := by rw [endpoint_card]; simp + rw [hprod] + rw [ih (fun z hz => hs (Finset.mem_insert_of_mem hz)), + Finset.card_insert_of_notMem hes] + omega + +private theorem helper_boundary_edgeInc_card_399.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] (G : + LooplessMultigraph V E) (k : ℕ) (_ : E) (_ : PartialEdgeColoring E k) (X : Finset V) (_ : + V), + let boundary : Finset E := BoundaryEdges G X; + let edgeInc : Finset E → Finset (E × V) := fun (s : Finset E) ↦ + ({p ∈ s.product X | Incident G p.2 p.1} : Finset (E × V)); ( + ∀ (e : E) (s : Finset E), edgeInc (insert e s : Finset E) = edgeInc ({ e } : Finset E) ∪ + edgeInc s) → ( + ∀ e ∈ boundary, ({v ∈ X | Incident G v e} : Finset V).card = (1 : ℕ)) → ( + ∀ (e : E), edgeInc ({ e } : Finset E) = ({ e } : Finset E).product ({v ∈ X | Incident G v e} : + Finset V)) → + ∀ s ⊆ boundary, (edgeInc s).card = s.card := by + classical + intro V E _ _ _ G k e0 phi X x boundary edgeInc edgeInc_insert boundary_fiber_card + edgeInc_single_boundary s hs + induction s using Finset.induction_on with + | empty => simp [edgeInc] + | @insert e s hes ih => + rw [edgeInc_insert] + have hd : Disjoint (edgeInc {e}) (edgeInc s) := by + rw [Finset.disjoint_left] + intro p hpe hps + have hpe' := (Finset.mem_filter.mp hpe).1 + have hps' := (Finset.mem_filter.mp hps).1 + have heq : p.1 = e := Finset.mem_singleton.mp (Finset.mem_product.mp hpe').1 + have hmem : p.1 ∈ s := (Finset.mem_product.mp hps').1 + exact hes (heq ▸ hmem) + rw [Finset.card_union_of_disjoint hd] + have heB : e ∈ boundary := hs (Finset.mem_insert_self e s) + rw [edgeInc_single_boundary e] + have hprod : (({e} : Finset E).product + (X.filter (fun v => Incident G v e))).card = 1 := by + calc + _ = ({e} : Finset E).card * + (X.filter (fun v => Incident G v e)).card := Finset.card_product _ _ + _ = 1 := by rw [boundary_fiber_card e heB]; simp + rw [hprod] + rw [ih (fun z hz => hs (Finset.mem_insert_of_mem hz)), + Finset.card_insert_of_notMem hes] + omega + +private theorem helper_presentPairs_le_inc_363.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] (G : LooplessMultigraph + V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V), + let allVC : Finset (V × Fin k) := X.product Finset.univ; + let presentPairs : Finset (V × Fin k) := ({p ∈ allVC | p.2 ∈ PresentColors G phi p.1} : Finset + (V × Fin k)); + let incidences : Finset (E × V) := ({p ∈ Finset.univ.product X | Incident G p.2 p.1 ∧ + ∃ (c : Fin k), phi p.1 = some c} : Finset (E × V)); + ∀ (present_witness : + ∀ p ∈ presentPairs, + ∃ (e : E), Incident G p.1 e ∧ phi e = some p.2), + let presentEdge : V × Fin k → E := fun (p : V × Fin k) ↦ if hp : p ∈ presentPairs then + Classical.choose (present_witness p hp) else e0; ( + ∀ p ∈ presentPairs, Incident G p.1 (presentEdge p) ∧ phi (presentEdge p) = some p.2) → + presentPairs.card ≤ incidences.card := by + classical + intro V E _ _ _ G k e0 phi X allVC presentPairs incidences present_witness presentEdge + presentEdge_spec + let _ := Fintype.ofFinite V + apply Finset.card_le_card_of_injOn + (fun p : V × Fin k => (presentEdge p, p.1)) + · intro p hp + have hpall := (Finset.mem_filter.mp hp).1 + have hpX := (Finset.mem_product.mp hpall).1 + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_product.mpr ⟨Finset.mem_univ _, hpX⟩, + (presentEdge_spec p hp).1, p.2, (presentEdge_spec p hp).2⟩ + · intro a ha b hb hab + have hv : a.1 = b.1 := congrArg (fun p : E × V => p.2) hab + have he : presentEdge a = presentEdge b := congrArg Prod.fst hab + have hc : a.2 = b.2 := by + apply Option.some.inj + calc + some a.2 = phi (presentEdge a) := (presentEdge_spec a ha).2.symm + _ = phi (presentEdge b) := by rw [he] + _ = some b.2 := (presentEdge_spec b hb).2 + exact Prod.ext hv hc + +private theorem helper_edge_classification_411.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (X : + Finset V) {e : E} {v : V}, v ∈ X → Incident G v e → e ∈ InternalEdges G X ∨ e ∈ + BoundaryEdges G X := by + classical + intro V E _ _ G X e v hvX hve + by_cases hall : ∀ z, Incident G z e → z ∈ X + · left + unfold InternalEdges + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hall + · right + push Not at hall + obtain ⟨z, hze, hzX⟩ := hall + obtain ⟨w, heq⟩ := Sym2.mem_iff_exists.mp hze + have hvpair : v = z ∨ v = w := by + have : v ∈ s(z, w) := by rw [← heq]; exact hve + simpa using this + have hvw : v = w := hvpair.resolve_left (fun hvz => hzX (hvz ▸ hvX)) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨v, hvX, z, hzX, by simpa [hvw] using heq.trans Sym2.eq_swap⟩ + +private theorem helper_internalInc_eq_461.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V), IsOneEdgeUncolored phi e0 → + let incidences : Finset (E × V) := ({p ∈ Finset.univ.product X | Incident G p.2 p.1 ∧ + ∃ (c : Fin k), phi p.1 = some c} : Finset (E × V)); + let internalColored : Finset E := (InternalEdges G X).erase e0; + let internalInc : Finset (E × V) := ({p ∈ incidences | p.1 ∈ internalColored} : Finset (E × + V)); + let edgeInc : Finset E → Finset (E × V) := fun (s : Finset E) ↦ + ({p ∈ s.product X | Incident G p.2 p.1} : Finset (E × V)); internalInc = edgeInc + internalColored := by + classical + intro V E _ _ G k e0 phi X hone incidences internalColored internalInc edgeInc + ext p + constructor + · intro hp + have hpi := (Finset.mem_filter.mp hp).1 + have hpe := (Finset.mem_filter.mp hp).2 + have hpbase := (Finset.mem_filter.mp hpi).1 + exact Finset.mem_filter.mpr + ⟨Finset.mem_product.mpr ⟨hpe, (Finset.mem_product.mp hpbase).2⟩, + (Finset.mem_filter.mp hpi).2.1⟩ + · intro hp + have hpbase := (Finset.mem_filter.mp hp).1 + have hpe := (Finset.mem_product.mp hpbase).1 + have hpX := (Finset.mem_product.mp hpbase).2 + have hpinc := (Finset.mem_filter.mp hp).2 + have hne : p.1 ≠ e0 := (Finset.mem_erase.mp hpe).1 + obtain ⟨c, hc⟩ := hone.2 p.1 hne + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_filter.mpr + ⟨Finset.mem_product.mpr ⟨Finset.mem_univ _, hpX⟩, hpinc, c, hc⟩, hpe⟩ + +private theorem helper_boundary_fiber_card_489.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (X : Finset V), + let boundary : Finset E := BoundaryEdges G X; + ∀ e ∈ boundary, + ({v ∈ X | Incident G v e} : Finset V).card = (1 : ℕ) := by + classical + intro V E _ _ G X boundary e he + obtain ⟨u, hu, v, hv, huv⟩ := by + simpa [boundary, BoundaryEdges] using he + have hs : X.filter (fun z => Incident G z e) = {u} := by + ext z + simp only [Finset.mem_filter, Finset.mem_singleton, Incident, + huv, Sym2.mem_iff] + constructor + · rintro ⟨hz, rfl | hzu⟩ + · exact rfl + · exact False.elim (hv (hzu ▸ hz)) + · intro hzu + subst z + exact ⟨hu, Or.inl rfl⟩ + rw [hs] + simp + +private theorem helper_edgeInc_single_boundary_507.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (X : Finset V), + let edgeInc : Finset E → Finset (E × V) := fun (s : Finset E) ↦ + ({p ∈ s.product X | Incident G p.2 p.1} : Finset (E × V)); + ∀ (e : E), + edgeInc ({ e } : Finset E) = + ({ e } : Finset E).product ({v ∈ X | Incident G v e} : Finset V) := by + classical + intro V E G X edgeInc e + ext p + constructor + · intro hp + have hpProd := (Finset.mem_filter.mp hp).1 + have hpinc := (Finset.mem_filter.mp hp).2 + have hpe := Finset.mem_singleton.mp (Finset.mem_product.mp hpProd).1 + exact Finset.mem_product.mpr ⟨Finset.mem_singleton.mpr hpe, + Finset.mem_filter.mpr ⟨(Finset.mem_product.mp hpProd).2, hpe ▸ hpinc⟩⟩ + · intro hp + have hpe := Finset.mem_singleton.mp (Finset.mem_product.mp hp).1 + have hpv := Finset.mem_filter.mp (Finset.mem_product.mp hp).2 + exact Finset.mem_filter.mpr ⟨Finset.mem_product.mpr + ⟨Finset.mem_singleton.mpr hpe, hpv.1⟩, hpe.symm ▸ hpv.2⟩ + +private theorem helper_boundaryInc_eq_527.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V), IsOneEdgeUncolored phi e0 → + let incidences : Finset (E × V) := ({p ∈ Finset.univ.product X | Incident G p.2 p.1 ∧ + ∃ (c : Fin k), phi p.1 = some c} : Finset (E × V)); ( + ∀ e ∈ BoundaryEdges G X, e ≠ e0) → + let boundary : Finset E := BoundaryEdges G X; + let boundaryInc : Finset (E × V) := ({p ∈ incidences | p.1 ∈ boundary} : Finset (E × V)); + let edgeInc : Finset E → Finset (E × V) := fun (s : Finset E) ↦ + ({p ∈ s.product X | Incident G p.2 p.1} : Finset (E × V)); boundaryInc = edgeInc boundary + := by + classical + intro V E _ _ G k e0 phi X hone incidences boundary_ne_e0 boundary boundaryInc edgeInc + ext p + constructor + · intro hp + have hpi := (Finset.mem_filter.mp hp).1 + have hpe := (Finset.mem_filter.mp hp).2 + have hpbase := (Finset.mem_filter.mp hpi).1 + exact Finset.mem_filter.mpr + ⟨Finset.mem_product.mpr ⟨hpe, (Finset.mem_product.mp hpbase).2⟩, + (Finset.mem_filter.mp hpi).2.1⟩ + · intro hp + have hpbase := (Finset.mem_filter.mp hp).1 + have hpe := (Finset.mem_product.mp hpbase).1 + have hpX := (Finset.mem_product.mp hpbase).2 + have hpinc := (Finset.mem_filter.mp hp).2 + have hne : p.1 ≠ e0 := boundary_ne_e0 p.1 (by simpa [boundary] using hpe) + obtain ⟨c, hc⟩ := hone.2 p.1 hne + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_filter.mpr + ⟨Finset.mem_product.mpr ⟨Finset.mem_univ _, hpX⟩, hpinc, c, hc⟩, hpe⟩ + +private theorem helper_continuation_596.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] (G : + LooplessMultigraph V E) (k : ℕ), ChromaticIndex G = k + (1 : ℕ) → + ∀ (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V), IsOneEdgeUncolored phi e0 → + ColoredVertexSetStronglyClosed G phi X → ( + ∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ)) → + ∀ (x : V) (_ : Fin k), + let Y : Finset V := X.erase x; X.card = Y.card + (1 : ℕ) → Odd X.card → (3 : ℕ) ≤ X.card → + let allVC : Finset (V × Fin k) := X.product Finset.univ; + let missingPairs : Finset (V × Fin k) := ({p ∈ allVC | p.2 ∈ MissingColors G phi p.1} : Finset + (V × Fin k)); + let presentPairs : Finset (V × Fin k) := ({p ∈ allVC | p.2 ∈ PresentColors G phi p.1} : Finset + (V × Fin k)); + let missingUnion : Finset (Fin k) := ({c : Fin k | + ∃ v ∈ X, c ∈ MissingColors G phi v} : Finset (Fin k)); missingPairs.card ≤ missingUnion.card → + missingUnion.card ≤ missingPairs.card → missingUnion.card + presentPairs.card = X.card * k + → + let incidences : Finset (E × V) := ({p ∈ Finset.univ.product X | Incident G p.2 p.1 ∧ + ∃ (c : Fin k), phi p.1 = some c} : Finset (E × V)); presentPairs.card ≤ incidences.card → + incidences.card ≤ presentPairs.card → missingUnion.card + incidences.card = X.card * k → + e0 ∈ InternalEdges G X → ( + ∀ e ∈ BoundaryEdges G X, e ≠ e0) → + let internalColored : Finset E := (InternalEdges G X).erase e0; + let boundary : Finset E := BoundaryEdges G X; + let internalInc : Finset (E × V) := ({p ∈ incidences | p.1 ∈ internalColored} : Finset (E × + V)); + let boundaryInc : Finset (E × V) := ({p ∈ incidences | p.1 ∈ boundary} : Finset (E × V)); + incidences.card = internalInc.card + boundaryInc.card → + let _ : Finset E → Finset (E × V) := fun (s : Finset E) ↦ + ({p ∈ s.product X | Incident G p.2 p.1} : Finset (E × V)); Elementary G := by + classical + intro V E _ _ _ G k hindex e0 phi X hone hstrong endpoint_card x alpha Y hXcard hXodd hXthree + allVC missingPairs presentPairs missingUnion missingPairs_le missingUnion_le + pairs_card_identity incidences presentPairs_le_inc incidences_le_present + incidence_color_identity e0_internal boundary_ne_e0 internalColored boundary internalInc + boundaryInc incidence_edge_identity edgeInc + have edgeInc_insert : ∀ (e : E) (s : Finset E), + edgeInc (insert e s) = edgeInc {e} ∪ edgeInc s := by + exact @helper_edgeInc_insert_256 (@V) (@E) inferInstance (@G) (@X) + have edgeInc_single_internal : ∀ e, e ∈ InternalEdges G X → + edgeInc {e} = ({e} : Finset E).product (G.ends e).toFinset := by + exact @helper_edgeInc_single_internal_286 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@X) + have internal_edgeInc_card : ∀ s : Finset E, s ⊆ InternalEdges G X → + (edgeInc s).card = 2 * s.card := by + exact @helper_internal_edgeInc_card_309 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@X) (@endpoint_card) (@x) (@edgeInc_insert) + (@edgeInc_single_internal) + have internalInc_eq : internalInc = edgeInc internalColored := by + exact @helper_internalInc_eq_461 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) + (@X) (@hone) + have internalInc_card : internalInc.card = + 2 * ((InternalEdges G X).card - 1) := by + rw [internalInc_eq, internal_edgeInc_card internalColored] + · have hc := Finset.card_erase_of_mem e0_internal + dsimp [internalColored] + omega + · intro e he + exact (Finset.mem_erase.mp he).2 + have boundary_fiber_card : ∀ e, e ∈ boundary → + (X.filter (fun v => Incident G v e)).card = 1 := by + exact @helper_boundary_fiber_card_489 (@V) (@E) inferInstance inferInstance (@G) (@X) + have edgeInc_single_boundary : + ∀ e, edgeInc {e} = ({e} : Finset E).product (X.filter (fun v => Incident G v e)) := by + exact @helper_edgeInc_single_boundary_507 (@V) (@E) (@G) (@X) + have boundary_edgeInc_card : ∀ s : Finset E, s ⊆ boundary → + (edgeInc s).card = s.card := by + exact @helper_boundary_edgeInc_card_399 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@X) (@x) (@edgeInc_insert) (@boundary_fiber_card) + (@edgeInc_single_boundary) + have boundaryInc_eq : boundaryInc = edgeInc boundary := by + exact @helper_boundaryInc_eq_527 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) + (@X) (@hone) (@boundary_ne_e0) + have boundaryInc_card : boundaryInc.card = boundary.card := by + rw [boundaryInc_eq, boundary_edgeInc_card boundary (by intro e he; exact he)] + have edge_incidence_count : incidences.card = + 2 * ((InternalEdges G X).card - 1) + boundary.card := by + rw [incidence_edge_identity, internalInc_card, boundaryInc_card] + have boundary_color_witness : ∀ e, e ∈ boundary → ∃ c, phi e = some c := by + intro e he + exact hone.2 e (boundary_ne_e0 e (by simpa [boundary] using he)) + let boundaryColor (e : E) : Fin k := + if he : e ∈ boundary then Classical.choose (boundary_color_witness e he) else alpha + have boundaryColor_spec : ∀ e, e ∈ boundary → phi e = some (boundaryColor e) := by + intro e he + simp only [boundaryColor, dite_eq_left he] + exact Classical.choose_spec (boundary_color_witness e he) + let availableColors := (Finset.univ : Finset (Fin k)) \ missingUnion + have boundary_maps_available : ∀ e, e ∈ boundary → + boundaryColor e ∈ availableColors := by + intro e he + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro hm + obtain ⟨v, hvX, hvm⟩ := by simpa [missingUnion] using hm + exact (hstrong.1 (by simpa [boundary] using he) hvX + (boundaryColor_spec e he)) hvm + have boundaryColor_inj : Set.InjOn boundaryColor (boundary : Set E) := by + intro e he f hf hef + by_contra hne + have hh := hstrong.2 (by simpa [boundary] using he) + (by simpa [boundary] using hf) hne (boundaryColor_spec e he) + exact hh (by rw [boundaryColor_spec f hf, hef]) + have boundary_le_available : boundary.card ≤ availableColors.card := + Finset.card_le_card_of_injOn boundaryColor boundary_maps_available boundaryColor_inj + have available_card : availableColors.card = k - missingUnion.card := by + simp [availableColors, Finset.card_sdiff] + have boundary_missing_bound : boundary.card + missingUnion.card ≤ k := by + rw [available_card] at boundary_le_available + have hmle : missingUnion.card ≤ k := by + simpa using Finset.card_le_card (Finset.subset_univ missingUnion) + omega + have full_count : missingUnion.card + + (2 * ((InternalEdges G X).card - 1) + boundary.card) = X.card * k := by + rw [← edge_incidence_count] + exact incidence_color_identity + have hXsplit : X.card = (X.card - 1) + 1 := by omega + have hmul : X.card * k = (X.card - 1) * k + k := by + calc + X.card * k = ((X.card - 1) + 1) * k := by rw [← hXsplit] + _ = (X.card - 1) * k + k := by simp [Nat.add_mul] + have density_nat_le : (X.card - 1) * k ≤ + 2 * ((InternalEdges G X).card - 1) := by + omega + have internal_pos : 1 ≤ (InternalEdges G X).card := + Finset.card_pos.mpr ⟨e0, e0_internal⟩ + have density_nat_strict : k * (X.card - 1) < + 2 * (InternalEdges G X).card := by + rw [Nat.mul_comm] + omega + have denominator_pos : (0 : ℚ) < (X.card - 1 : ℚ) := by + have hx : (1 : ℚ) < (X.card : ℚ) := by exact_mod_cast (show 1 < X.card by omega) + exact sub_pos.mpr hx + have sub_cast : (X.card - 1 : ℚ) = (↑(X.card - 1) : ℚ) := by + rw [Nat.cast_sub (by omega)] + norm_num + have witness_density : (k : ℚ) < DensityValue G X := by + unfold DensityValue + apply (lt_div_iff₀ denominator_pos).2 + rw [sub_cast] + exact_mod_cast density_nat_strict + have X_eligible : EligibleOddSet X := ⟨hXthree, hXodd⟩ + have density_ge_witness : DensityValue G X ≤ Density G := by + unfold Density + dsimp + apply Finset.le_max' + apply Finset.mem_insert.mpr + right + apply Finset.mem_image.mpr + refine ⟨X, ?_, rfl⟩ + exact Finset.mem_filter.mpr ⟨Finset.mem_powerset.mpr (Finset.subset_univ X), + X_eligible⟩ + have density_gt : (k : ℚ) < Density G := witness_density.trans_le density_ge_witness + have ceil_ge : k + 1 ≤ DensityCeil G := by + unfold DensityCeil + have hceilQ : (k : ℚ) < (⌈Density G⌉₊ : ℚ) := + density_gt.trans_le (Nat.le_ceil (Density G)) + have hceilN : k < ⌈Density G⌉₊ := by exact_mod_cast hceilQ + omega + have ceil_le : DensityCeil G ≤ k + 1 := by + rw [← hindex] + exact DensityLowerBound G + unfold Elementary + omega + +private theorem helper_continuation_170.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] (G : + LooplessMultigraph V E) (k : ℕ), ChromaticIndex G = k + (1 : ℕ) → + ∀ (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V), IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → ( + ∀ v ∈ G.ends e0, v ∈ X) → ColoredVertexSetElementary G phi X → ColoredVertexSetStronglyClosed + G phi X → ( + ∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ)) → + ∀ (x : V) (_ : Fin k), + let Y : Finset V := X.erase x; X.card = Y.card + (1 : ℕ) → Odd X.card → (3 : ℕ) ≤ X.card → + let allVC : Finset (V × Fin k) := X.product Finset.univ; + let missingPairs : Finset (V × Fin k) := ({p ∈ allVC | p.2 ∈ MissingColors G phi p.1} : Finset + (V × Fin k)); + let presentPairs : Finset (V × Fin k) := ({p ∈ allVC | p.2 ∈ PresentColors G phi p.1} : Finset + (V × Fin k)); + let _ : Finset (Fin k) := ({c : Fin k | + ∃ v ∈ X, c ∈ MissingColors G phi v} : Finset (Fin k)); missingPairs ∪ presentPairs = allVC → + Disjoint missingPairs presentPairs → Elementary G := by + classical + intro V E _ _ _ G k hindex e0 phi X hproper hone hends helementary hstrong endpoint_card x + alpha Y hXcard hXodd hXthree allVC missingPairs presentPairs missingUnion allVC_split + allVC_disjoint + have allVC_card : allVC.card = X.card * k := by + simp [allVC, Finset.card_product] + have missingPairs_le : missingPairs.card ≤ missingUnion.card := by + exact @helper_missingPairs_le_67 (@V) (@E) inferInstance inferInstance (@G) (@k) (@phi) (@X) + (@helementary) + have missing_witness : ∀ c, c ∈ missingUnion → + ∃ v, v ∈ X ∧ c ∈ MissingColors G phi v := by + intro c hc + simpa [missingUnion] using hc + let missingVertex (c : Fin k) : V := + if hc : c ∈ missingUnion then Classical.choose (missing_witness c hc) else x + have missingVertex_spec : ∀ c, c ∈ missingUnion → + missingVertex c ∈ X ∧ c ∈ MissingColors G phi (missingVertex c) := by + intro c hc + simp only [missingVertex, dite_eq_left hc] + exact Classical.choose_spec (missing_witness c hc) + have missingUnion_le : missingUnion.card ≤ missingPairs.card := by + apply Finset.card_le_card_of_injOn (fun c : Fin k => (missingVertex c, c)) + · intro c hc + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_product.mpr ⟨(missingVertex_spec c hc).1, Finset.mem_univ _⟩, + (missingVertex_spec c hc).2⟩ + · intro a ha b hb hab + exact congrArg Prod.snd hab + have missingPairs_card : missingPairs.card = missingUnion.card := + Nat.le_antisymm missingPairs_le missingUnion_le + have pairs_card_identity : missingUnion.card + presentPairs.card = X.card * k := by + rw [← missingPairs_card, ← Finset.card_union_of_disjoint allVC_disjoint, + allVC_split, allVC_card] + let incidences := ((Finset.univ : Finset E).product X).filter + (fun p => Incident G p.2 p.1 ∧ ∃ c, phi p.1 = some c) + have present_witness : ∀ p, p ∈ presentPairs → + ∃ e, Incident G p.1 e ∧ phi e = some p.2 := by + intro p hp + have hc := (Finset.mem_filter.mp hp).2 + simpa [PresentColors] using hc + let presentEdge (p : V × Fin k) : E := + if hp : p ∈ presentPairs then Classical.choose (present_witness p hp) else e0 + have presentEdge_spec : ∀ p, p ∈ presentPairs → + Incident G p.1 (presentEdge p) ∧ phi (presentEdge p) = some p.2 := by + intro p hp + simp only [presentEdge, dite_eq_left hp] + exact Classical.choose_spec (present_witness p hp) + have presentPairs_le_inc : presentPairs.card ≤ incidences.card := by + exact @helper_presentPairs_le_inc_363 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@X) (@present_witness) (@presentEdge_spec) + have incidence_witness : ∀ p, p ∈ incidences → ∃ c, phi p.1 = some c := by + intro p hp + exact (Finset.mem_filter.mp hp).2.2 + let incidenceColor (p : E × V) : Fin k := + if hp : p ∈ incidences then Classical.choose (incidence_witness p hp) else alpha + have incidenceColor_spec : ∀ p, p ∈ incidences → + phi p.1 = some (incidenceColor p) := by + intro p hp + simp only [incidenceColor, dite_eq_left hp] + exact Classical.choose_spec (incidence_witness p hp) + have incidences_le_present : incidences.card ≤ presentPairs.card := by + exact @helper_incidences_le_present_158 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@phi) (@X) (@hproper) (@alpha) (@incidence_witness) (@incidenceColor_spec) + have presentPairs_card : presentPairs.card = incidences.card := + Nat.le_antisymm presentPairs_le_inc incidences_le_present + have incidence_color_identity : missingUnion.card + incidences.card = X.card * k := by + simpa [presentPairs_card] using pairs_card_identity + have e0_internal : e0 ∈ InternalEdges G X := by + simp only [InternalEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact hends + have boundary_ne_e0 : ∀ e, e ∈ BoundaryEdges G X → e ≠ e0 := by + intro e he heq + subst e + obtain ⟨u, huX, v, hvX, huv⟩ := by + simpa [BoundaryEdges] using he + exact hvX (hends v (by rw [huv]; simp)) + let internalColored := (InternalEdges G X).erase e0 + let boundary := BoundaryEdges G X + let internalInc := incidences.filter (fun p => p.1 ∈ internalColored) + let boundaryInc := incidences.filter (fun p => p.1 ∈ boundary) + have edge_classification : ∀ {e v}, v ∈ X → Incident G v e → + e ∈ InternalEdges G X ∨ e ∈ BoundaryEdges G X := by + exact @helper_edge_classification_411 (@V) (@E) inferInstance inferInstance (@G) (@X) + have internal_boundary_disjoint : + Disjoint (InternalEdges G X) (BoundaryEdges G X) := by + rw [Finset.disjoint_left] + intro e hi hb + obtain ⟨u, huX, v, hvX, huv⟩ := by + simpa [BoundaryEdges] using hb + unfold InternalEdges at hi + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hi + exact hvX (hi v (by change v ∈ G.ends e; rw [huv]; simp)) + have incidences_split : internalInc ∪ boundaryInc = incidences := by + exact @helper_incidences_split_223 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@phi) (@X) (@hone) (@edge_classification) + have incidences_disjoint : Disjoint internalInc boundaryInc := by + rw [Finset.disjoint_left] + intro p hi hb + have hei : p.1 ∈ InternalEdges G X := + (Finset.mem_erase.mp (Finset.mem_filter.mp hi).2).2 + have heb : p.1 ∈ BoundaryEdges G X := (Finset.mem_filter.mp hb).2 + exact (Finset.disjoint_left.mp internal_boundary_disjoint) hei heb + have incidence_edge_identity : + incidences.card = internalInc.card + boundaryInc.card := by + rw [← Finset.card_union_of_disjoint incidences_disjoint, incidences_split] + let edgeInc (s : Finset E) := (s.product X).filter + (fun p => Incident G p.2 p.1) + exact @helper_continuation_596 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@hindex) (@e0) (@phi) (@X) (@hone) (@hstrong) (@endpoint_card) (@x) (@alpha) (@hXcard) + (@hXodd) (@hXthree) (@missingPairs_le) (@missingUnion_le) (@pairs_card_identity) + (@presentPairs_le_inc) (@incidences_le_present) (@incidence_color_identity) (@e0_internal) + (@boundary_ne_e0) (@incidence_edge_identity) +private theorem helper_continuation_156.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] (G : + LooplessMultigraph V E) (k : ℕ), ChromaticIndex G = k + (1 : ℕ) → + ∀ (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V), IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → ( + ∀ v ∈ G.ends e0, v ∈ X) → ColoredVertexSetElementary G phi X → ColoredVertexSetStronglyClosed + G phi X → ( + ∀ (e : E), (G.ends e).toFinset.card = (2 : ℕ)) → + ∀ (x y : V), x ≠ y → (G.ends e0).toFinset = { x, y } → Incident G x e0 → Incident G y e0 → x ∈ + X → y ∈ X → + ∀ alpha ∈ MissingColors G phi x, + let Y : Finset V := X.erase x; + let alphaEdges : Finset E := {e : E | phi e = some alpha}; ( + ∀ v ∈ Y, alpha ∈ PresentColors G phi v) → ( + ∀ v ∈ Y, + ∃! e : E, e ∈ alphaEdges ∧ Incident G v e) → ( + ∀ e ∈ alphaEdges, ¬Incident G x e) → ( + ∀ e ∈ alphaEdges, + ∀ v ∈ X, Incident G v e → + ∀ (z : V), Incident G z e → z ∈ X) → Elementary G := by + classical + intro V E _ _ _ G k hindex e0 phi X hproper hone hends helementary hstrong endpoint_card x y + hxy hxyends hxend hyend hxX hyX alpha halpha Y alphaEdges y_present alpha_inc no_alpha_at_x + alpha_internal + let goodAlpha := alphaEdges.filter (fun e => ∀ v, Incident G v e → v ∈ X) + have goodAlpha_spec : ∀ e, e ∈ goodAlpha ↔ + e ∈ alphaEdges ∧ ∀ v, Incident G v e → v ∈ X := by + intro e + simp [goodAlpha] + have goodAlpha_disjoint : ∀ {e}, e ∈ goodAlpha → ∀ {f}, f ∈ goodAlpha → + e ≠ f → Disjoint (G.ends e).toFinset (G.ends f).toFinset := by + intro e he f hf hef + rw [Finset.disjoint_left] + intro v hev hvf + have hce := (goodAlpha_spec e).mp he |>.1 + have hcf := (goodAlpha_spec f).mp hf |>.1 + exact (hproper hef ⟨v, Sym2.mem_toFinset.mp hev, Sym2.mem_toFinset.mp hvf⟩ + (Finset.mem_filter.mp hce).2) (Finset.mem_filter.mp hcf).2 + have goodAlpha_union_card : + (goodAlpha.biUnion fun e => (G.ends e).toFinset).card = 2 * goodAlpha.card := by + have aux : ∀ s : Finset E, s ⊆ goodAlpha → + (s.biUnion fun e => (G.ends e).toFinset).card = 2 * s.card := by + intro s hs + induction s using Finset.induction_on with + | empty => simp + | @insert e s hes ih => + rw [Finset.biUnion_insert] + have hd : Disjoint (G.ends e).toFinset + (s.biUnion fun f => (G.ends f).toFinset) := by + rw [Finset.disjoint_left] + intro v hev hvs + obtain ⟨f, hf, hvf⟩ := Finset.mem_biUnion.mp hvs + have hh := goodAlpha_disjoint (hs (Finset.mem_insert_self e s)) + (hs (Finset.mem_insert_of_mem hf)) (by + intro heq + exact hes (by simpa [heq] using hf)) + exact (Finset.disjoint_left.mp hh) hev hvf + rw [Finset.card_union_of_disjoint hd, endpoint_card] + rw [ih (fun z hz => hs (Finset.mem_insert_of_mem hz))] + rw [Finset.card_insert_of_notMem hes] + omega + exact aux goodAlpha (by intro e he; exact he) + have goodAlpha_union_eq : goodAlpha.biUnion (fun e => (G.ends e).toFinset) = Y := by + ext v + constructor + · intro hv + obtain ⟨e, he, hev⟩ := Finset.mem_biUnion.mp hv + have hvX := (goodAlpha_spec e |>.mp he).2 v (Sym2.mem_toFinset.mp hev) + have hvx : v ≠ x := by + intro hvx + exact no_alpha_at_x e (goodAlpha_spec e |>.mp he).1 + (hvx ▸ Sym2.mem_toFinset.mp hev) + exact Finset.mem_erase.mpr ⟨hvx, hvX⟩ + · intro hv + obtain ⟨e, he, hve⟩ := alpha_inc v hv + have hg : e ∈ goodAlpha := goodAlpha_spec e |>.mpr ⟨he.1, + alpha_internal e he.1 v (Finset.mem_erase.mp hv).2 he.2⟩ + exact Finset.mem_biUnion.mpr ⟨e, hg, Sym2.mem_toFinset.mpr he.2⟩ + have hYeven : Even Y.card := by + refine ⟨goodAlpha.card, ?_⟩ + rw [← goodAlpha_union_eq, goodAlpha_union_card] + omega + have hXcard : X.card = Y.card + 1 := by + have hh := Finset.card_erase_of_mem hxX + simp [Y] at hh ⊢ + have hpos : 0 < X.card := Finset.card_pos.mpr ⟨x, hxX⟩ + omega + have hXodd : Odd X.card := by + rw [hXcard] + rcases hYeven with ⟨q, hq⟩ + exact ⟨q, by omega⟩ + have hXthree : 3 ≤ X.card := by + have htwo : 2 ≤ X.card := by + have hsub : ({x, y} : Finset V) ⊆ X := by + intro v hv + simp only [Finset.mem_insert, Finset.mem_singleton] at hv + rcases hv with rfl | rfl + · exact hxX + · exact hyX + have hc := Finset.card_le_card hsub + simpa [hxy] using hc + rcases hXodd with ⟨q, hq⟩ + omega + let allVC : Finset (V × Fin k) := X.product Finset.univ + let missingPairs := allVC.filter (fun p => p.2 ∈ MissingColors G phi p.1) + let presentPairs := allVC.filter (fun p => p.2 ∈ PresentColors G phi p.1) + let missingUnion := (Finset.univ : Finset (Fin k)).filter + (fun c => ∃ v ∈ X, c ∈ MissingColors G phi v) + have allVC_split : missingPairs ∪ presentPairs = allVC := by + ext p + simp only [missingPairs, presentPairs, Finset.mem_union, Finset.mem_filter] + constructor + · rintro (⟨hp, _⟩ | ⟨hp, _⟩) <;> exact hp + · intro hp + by_cases hc : p.2 ∈ PresentColors G phi p.1 + · exact Or.inr ⟨hp, hc⟩ + · exact Or.inl ⟨hp, by simp [MissingColors, hc]⟩ + have allVC_disjoint : Disjoint missingPairs presentPairs := by + rw [Finset.disjoint_left] + intro p hm hp + have hm' := (Finset.mem_filter.mp hm).2 + have hp' := (Finset.mem_filter.mp hp).2 + exact (Finset.mem_sdiff.mp hm').2 hp' + exact @helper_continuation_170 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@hindex) (@e0) (@phi) (@X) (@hproper) (@hone) (@hends) (@helementary) (@hstrong) + (@endpoint_card) (@x) (@alpha) (@hXcard) (@hXodd) (@hXthree) (@allVC_split) (@allVC_disjoint) +theorem StronglyClosedWitnessElementary {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) + (hindex : ChromaticIndex G = k + 1) + (hdegree : MaximumDegree G + 1 ≤ k) + (e0 : E) (phi : PartialEdgeColoring E k) (X : Finset V) + (hproper : IsProperEdgeColoring G phi) + (hone : IsOneEdgeUncolored phi e0) + (hends : ∀ v, v ∈ G.ends e0 → v ∈ X) + (helementary : ColoredVertexSetElementary G phi X) + (hstrong : ColoredVertexSetStronglyClosed G phi X) : + Elementary G := by + classical + have endpoint_card : ∀ e : E, (G.ends e).toFinset.card = 2 := by + intro e + apply Sym2.card_toFinset_of_not_isDiag + intro hd + exact G.loopless e ((G.ends e).diagElem hd) (Sym2.diag_diagElem hd).symm + obtain ⟨x, y, hxy, hxyends⟩ := Finset.card_eq_two.mp (endpoint_card e0) + have hxend : Incident G x e0 := by + change x ∈ G.ends e0 + apply Sym2.mem_toFinset.mp + rw [hxyends] + simp + have hyend : Incident G y e0 := by + change y ∈ G.ends e0 + apply Sym2.mem_toFinset.mp + rw [hxyends] + simp + have hxX : x ∈ X := hends x hxend + have hyX : y ∈ X := hends y hyend + have hdeg : ∀ v : V, Degree G v ≤ MaximumDegree G := by + intro v + unfold MaximumDegree + exact Finset.le_max' _ _ (Finset.mem_insert.mpr (Or.inr + (Finset.mem_image.mpr ⟨v, by simp⟩))) + have present_le_degree : ∀ v : V, (PresentColors G phi v).card ≤ Degree G v := by + intro v + have chooseData (c : {c : Fin k // c ∈ PresentColors G phi v}) : + ∃ e, Incident G v e ∧ phi e = some c.1 := by + simpa [PresentColors] using c.property + let choices : {c : Fin k // c ∈ PresentColors G phi v} → + {e : E // Incident G v e} := fun c => + ⟨Classical.choose (chooseData c), (Classical.choose_spec (chooseData c)).1⟩ + have choice_spec : ∀ c : {c : Fin k // c ∈ PresentColors G phi v}, + phi (choices c).1 = some c.1 := by + intro c + exact (Classical.choose_spec (chooseData c)).2 + have inj : Function.Injective choices := by + intro a b hab + apply Subtype.ext + apply Option.some.inj + calc + some (a : Fin k) = phi (choices a).1 := (choice_spec a).symm + _ = phi (choices b).1 := by rw [hab] + _ = some (b : Fin k) := choice_spec b + let : Fintype {c : Fin k // c ∈ PresentColors G phi v} := Fintype.ofFinite _ + have hc := Fintype.card_le_of_injective choices inj + change (PresentColors G phi v).card ≤ + (Finset.univ.filter (fun e => Incident G v e)).card + simpa [Fintype.card_subtype, Degree] using hc + have missing_exists : ∀ v : V, (MissingColors G phi v).Nonempty := by + intro v + by_contra hn + have hempty : MissingColors G phi v = ∅ := Finset.not_nonempty_iff_eq_empty.mp hn + have hall : PresentColors G phi v = Finset.univ := by + apply Finset.eq_univ_of_forall + intro c + by_contra hc + have hm : c ∈ MissingColors G phi v := by simp [MissingColors, hc] + exact (by simp [hempty] at hm) + have hk : k ≤ Degree G v := by + simpa [hall] using present_le_degree v + have : MaximumDegree G + 1 ≤ MaximumDegree G := + hdegree.trans (hk.trans (hdeg v)) + omega + obtain ⟨alpha, halpha⟩ := missing_exists x + let Y := X.erase x + let alphaEdges := (Finset.univ : Finset E).filter (fun e => phi e = some alpha) + have y_present : ∀ v, v ∈ Y → alpha ∈ PresentColors G phi v := by + intro v hv + have hvX : v ∈ X := (Finset.mem_erase.mp hv).2 + have hvne : v ≠ x := (Finset.mem_erase.mp hv).1 + have hdis := helementary hxX hvX hvne.symm + have : alpha ∉ MissingColors G phi v := by + intro hm + exact (Finset.disjoint_left.mp hdis) halpha hm + simpa [MissingColors] using this + have alpha_inc : ∀ v, v ∈ Y → ∃! e, e ∈ alphaEdges ∧ Incident G v e := by + intro v hv + obtain ⟨e, he, hve⟩ := by simpa [PresentColors] using y_present v hv + refine ⟨e, ?_, ?_⟩ + · exact ⟨by simpa [alphaEdges] using hve, he⟩ + · intro f hf + by_contra hef + exact (hproper (fun h => hef h.symm) ⟨v, he, hf.2⟩ hve) + (Finset.mem_filter.mp hf.1).2 + have no_alpha_at_x : ∀ e, e ∈ alphaEdges → ¬ Incident G x e := by + intro e he hxe + have hp : alpha ∈ PresentColors G phi x := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hxe, (Finset.mem_filter.mp he).2⟩ + exact (Finset.mem_sdiff.mp halpha).2 hp + have alpha_internal : ∀ e, e ∈ alphaEdges → ∀ v, v ∈ X → Incident G v e → + ∀ z, Incident G z e → z ∈ X := by + intro e he v hvX hve z hze + by_contra hz + obtain ⟨w, hw⟩ := Sym2.mem_iff_exists.mp hze + have hzw : G.ends e = s(z, w) := hw + have hvpair : v = z ∨ v = w := by + have : v ∈ s(z, w) := by rw [← hzw]; exact hve + simpa using this + have hwX : w ∈ X := by + rcases hvpair with hvz | hvw + · exact False.elim (hz (hvz ▸ hvX)) + · exact hvw ▸ hvX + have hb : e ∈ BoundaryEdges G X := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨w, hwX, z, hz, hzw.trans Sym2.eq_swap⟩ + exact (hstrong.1 hb hxX (Finset.mem_filter.mp he).2) halpha + exact @helper_continuation_156 V E inferInstance inferInstance inferInstance G k + hindex e0 phi X hproper hone hends helementary hstrong endpoint_card x y hxy hxyends hxend + hyend hxX hyX alpha halpha y_present alpha_inc no_alpha_at_x alpha_internal +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/SupportingPEColorChain.lean b/LeanPool/GoldbergSeymour/SupportingPEColorChain.lean new file mode 100644 index 0000000000..3f8ea5c0f0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SupportingPEColorChain.lean @@ -0,0 +1,179 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Supporting PEColor Chain + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem SupportingPEColorChain {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds p : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (u : V) + (_ : u ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) + (indices : Fin (p + 1) → Fin rounds) + (hincreasing : ∀ a b, a.val < b.val → + (indices a).val < (indices b).val) + (henumerates : ∀ j : Fin rounds, + (j.val ≤ q.val ∧ + series.data.kind j.succ = some TashkinovExtensionKind.PE ∧ + series.data.chosenVertex j.succ = some u) ↔ + ∃ a : Fin (p + 1), indices a = j) : + ∀ a : Fin p, + series.data.gamma (indices a.succ).succ = series.data.delta (indices a.castSucc).succ := by + classical + intro a + have leftKind := (henumerates (indices a.castSucc)).2 ⟨a.castSucc, rfl⟩ + have rightKind := (henumerates (indices a.succ)).2 ⟨a.succ, rfl⟩ + have a_cast_value : a.castSucc.val = a.val := rfl + have a_succ_value : a.succ.val = a.val + 1 := rfl + have index_cast_value : (indices a.succ).castSucc.val = + (indices a.succ).val := rfl + have index_succ_value : (indices a.succ).succ.val = + (indices a.succ).val + 1 := rfl + have left_succ_value : (indices a.castSucc).succ.val = + (indices a.castSucc).val + 1 := rfl + generalize target_eq : (indices a.succ).succ = target + have cert := series.certified target + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact ((Fin.succ_ne_zero (indices a.succ)) (by omega)).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have target_values := congrArg Fin.val target_eq + simp at target_values + have ci_eq : ci = indices a.succ := by apply Fin.ext; omega + subst ci + rw [currentKind] at rightKind + simp at rightKind + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have target_values := congrArg Fin.val target_eq + simp at target_values + have ci_eq : ci = indices a.succ := by apply Fin.ext; omega + subst ci + rw [currentKind] at rightKind + simp at rightKind + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have target_values := congrArg Fin.val target_eq + simp at target_values + have ci_eq : ci = indices a.succ := by apply Fin.ext; omega + subst ci + have vertex_eq : choice.vertex = u := by + apply Option.some.inj + exact currentVertex.symm.trans rightKind.2.2 + rcases gammaRule with ⟨_, history⟩ + rcases history with history | history + · rcases history with ⟨h, hpos, hle, hkind, hvertex, hdelta, hmax⟩ + have hne : h ≠ 0 := by + intro hzero + subst h + simp at hpos + let predecessor : Fin rounds := h.pred hne + have predecessor_succ : predecessor.succ = h := Fin.succ_pred h hne + have predecessor_values := congrArg Fin.val predecessor_succ + simp at predecessor_values + have hright_bound : (indices a.succ).val ≤ q.val := rightKind.1 + have hd_bound : predecessor.val ≤ q.val := by omega + have hd_kind : series.data.kind predecessor.succ = + some TashkinovExtensionKind.PE := by + rw [predecessor_succ] + exact hkind + have hd_vertex : series.data.chosenVertex predecessor.succ = some u := by + rw [predecessor_succ] + simpa [vertex_eq] using hvertex + have hd_enum := (henumerates predecessor).1 + ⟨hd_bound, hd_kind, hd_vertex⟩ + rcases hd_enum with ⟨t, ht⟩ + have hpredecessor_lt : predecessor.val < (indices a.succ).val := by + omega + have hleft_succ_le : (indices a.castSucc).val + 1 ≤ h.val := by + have consecutive : (indices a.castSucc).val + 1 ≤ + (indices a.succ).val := by + have increasing := hincreasing a.castSucc a.succ (by omega) + omega + have hmax_value := hmax (indices a.castSucc).succ + (by rw [left_succ_value]; omega) + (by simpa [index_cast_value] using consecutive) + leftKind.2.1 (by simpa [vertex_eq] using leftKind.2.2) + simpa using hmax_value + have hleft_le : (indices a.castSucc).val ≤ predecessor.val := by + omega + have ht_le : t.val ≤ a.val := by + by_contra not_le + have t_gt : a.val < t.val := Nat.lt_of_not_ge not_le + by_cases same : t = a.succ + · subst t + rw [ht] at hpredecessor_lt + omega + · have order : a.succ.val < t.val := by + have weak : a.succ.val ≤ t.val := by omega + have different : a.succ.val ≠ t.val := by + intro equal + apply same + apply Fin.ext + omega + exact lt_of_le_of_ne weak different + have order_indices := hincreasing a.succ t order + rw [ht] at order_indices + omega + have ha_le_t : a.val ≤ t.val := by + by_contra not_le + have t_lt : t.val < a.val := Nat.lt_of_not_ge not_le + have order : t.val < a.castSucc.val := by omega + have order_indices := hincreasing t a.castSucc order + rw [ht] at order_indices + omega + have t_eq : t = a.castSucc := by + apply Fin.ext + omega + have predecessor_eq : predecessor = indices a.castSucc := by + rw [← ht, t_eq] + have h_eq : h = (indices a.castSucc).succ := by + rw [← predecessor_succ, predecessor_eq] + rw [h_eq] at hdelta + rw [currentGamma] + exact hdelta.symm + · exfalso + apply history (indices a.castSucc).succ + · exact Nat.succ_pos _ + · have increasing := hincreasing a.castSucc a.succ (by omega) + simpa [index_cast_value] using (show (indices a.castSucc).val + 1 ≤ + (indices a.succ).val by omega) + · exact leftKind.2.1 + · simpa [vertex_eq] using leftKind.2.2 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/SupportingPEMissingTransport.lean b/LeanPool/GoldbergSeymour/SupportingPEMissingTransport.lean new file mode 100644 index 0000000000..2f3acb59e0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SupportingPEMissingTransport.lean @@ -0,0 +1,680 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.SupportingPEColorChain +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap + +/-! +# Supporting PEMissing Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_swap_step_57.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (v : V), IsProperEdgeColoring G phi → + alpha ∈ MissingColors G phi v → beta ∉ MissingColors G phi v → MissingColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v = MissingColors G phi v \ { alpha } + ∪ { beta } ∧ MissingColors G phi v = MissingColors G (TwoColorComponentSwap G phi alpha + beta (Sum.inl v)) v \ { beta } ∪ { alpha } := by + classical + intro V E _ _ G k phi alpha beta v hproper hamiss hbmiss + let _ := Fintype.ofFinite V + have hpres : beta ∈ PresentColors G phi v := by + simpa [MissingColors] using hbmiss + have hneq : alpha ≠ beta := by + intro heq + have hnot : alpha ∉ MissingColors G phi v := by + simpa [heq] using hbmiss + exact hnot hamiss + have edge_mem : ∀ e, Incident G v e → + (phi e = some alpha ∨ phi e = some beta) → + Sum.inr e ∈ TwoColorComponent G phi alpha beta (Sum.inl v) := by + intro e hev hec + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, hev, hec] + have present_step : ∀ c, c ∈ PresentColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ↔ + c = alpha ∨ (c ≠ beta ∧ c ∈ PresentColors G phi v) := by + intro c + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + constructor + · rintro ⟨e, hev, hec⟩ + by_cases hcomp : Sum.inr e ∈ TwoColorComponent G phi alpha beta (Sum.inl v) + · by_cases hae : phi e = some alpha + · exfalso + have hnot : alpha ∉ MissingColors G phi v := by + simpa [MissingColors, PresentColors] using (show alpha ∈ PresentColors G phi v from + by simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hev, hae⟩) + exact hnot hamiss + · by_cases hbe : phi e = some beta + · have value := hec + simp [TwoColorComponentSwap, hcomp, hbe, hneq.symm] at value + exact Or.inl value.symm + · right + have value := hec + simp only [TwoColorComponentSwap, hcomp, ↓reduceIte, hae, hbe] at value + refine ⟨?_, ⟨e, hev, value⟩⟩ + intro heq + exact hbe (by simpa [heq] using value) + · right + have value := hec + simp only [TwoColorComponentSwap, hcomp, ↓reduceIte] at value + by_cases hbe : phi e = some beta + · exact (hcomp (edge_mem e hev (Or.inr hbe))).elim + · refine ⟨?_, ⟨e, hev, value⟩⟩ + intro heq + apply hbe + simpa [heq] using value + · rintro (rfl | ⟨hcβ, ⟨e, hev, hec⟩⟩) + · obtain ⟨e, hev, heβ⟩ := by + simpa [PresentColors] using hpres + refine ⟨e, hev, ?_⟩ + simp [TwoColorComponentSwap, edge_mem e hev (Or.inr heβ), heβ] + · refine ⟨e, hev, ?_⟩ + by_cases hae : phi e = some alpha + · have hnot : alpha ∉ MissingColors G phi v := by + simpa [MissingColors, PresentColors] using (show alpha ∈ PresentColors G phi v from + by simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hev, hae⟩) + exact False.elim (hnot hamiss) + · by_cases hbe : phi e = some beta + · exact False.elim (hcβ (Option.some.inj (hec.symm.trans hbe))) + · simp only [TwoColorComponentSwap, hae, ↓reduceIte, hbe, ite_self] + exact hec + have forward_step : MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v = + (MissingColors G phi v \ {alpha}) ∪ {beta} := by + ext c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_union, + Finset.mem_singleton, Finset.mem_univ, true_and] + rw [present_step] + by_cases hca : c = alpha <;> by_cases hcb : c = beta <;> simp [hca, hcb, hneq, hneq.symm] + have reverse_step : MissingColors G phi v = + (MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v \ {beta}) ∪ {alpha} + := by + rw [forward_step] + ext c + by_cases hca : c = alpha <;> by_cases hcb : c = beta <;> + simp [hca, hcb, hamiss, hbmiss, hneq, hneq.symm] + exact ⟨forward_step, reverse_step⟩ + +private theorem helper_pe_step_143.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (u : V), ( + ∀ (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (v : V), IsProperEdgeColoring G phi → + alpha ∈ MissingColors G phi v → beta ∉ MissingColors G phi v → MissingColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v = MissingColors G phi v \ { alpha } + ∪ { beta } ∧ MissingColors G phi v = MissingColors G (TwoColorComponentSwap G phi alpha + beta (Sum.inl v)) v \ { beta } ∪ { alpha }) → + ∀ (i : Fin rounds) (d g : Fin k), series.data.kind i.succ = some TashkinovExtensionKind.PE → + series.data.chosenVertex i.succ = some u → series.data.delta i.succ = some d → + series.data.gamma i.succ = some g → MissingColors G (series.data.coloring i.castSucc) u = + MissingColors G (series.data.coloring i.succ) u \ { d } ∪ { g } ∧ MissingColors G + (series.data.coloring i.succ) u = MissingColors G (series.data.coloring i.castSucc) u \ + { g } ∪ { d } := by + classical + intro V E _ _ _ G k rounds e0 input series u swap_step i d g hi hv hd hg + generalize target_eq : i.succ = target + have certificate := series.certified target + cases certificate with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma => + exact (Fin.succ_ne_zero i target_eq).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hci : ci = i := by + apply Fin.ext + have value := congrArg Fin.val target_eq + simp at value + omega + subst ci + rw [currentKind] at hi + simp at hi + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hci : ci = i := by + apply Fin.ext + have value := congrArg Fin.val target_eq + simp at value + omega + subst ci + rw [currentKind] at hi + simp at hi + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hci : ci = i := by + apply Fin.ext + have := congrArg Fin.val target_eq + simp at this + omega + subst ci + have vertex_eq : choice.vertex = u := by + apply Option.some.inj + exact currentVertex.symm.trans hv + have hs := secondStableRelation.2 choice.vertex choice.vertexDefective.1 + have hsel := choice.selectedStable.2 choice.vertex choice.vertexDefective.1 + have hgamma : gamma ∈ MissingColors G secondStable choice.vertex := by + rw [hs] + exact gammaRule.1 + have hdelta_present : choice.color ∉ MissingColors G secondStable choice.vertex := by + have hedge : TreeIncidentEdge (series.data.tree i.succ.castSucc) choice.edge := + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + have hstable := secondStableRelation.1 choice.edge hedge + ⟨choice.color, Finset.mem_union_right _ (Finset.mem_insert_self _ _), choice.edgeColor⟩ + have hcol : secondStable choice.edge = some choice.color := + hstable.trans choice.edgeColor + intro hm + have hp : choice.color ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, hcol⟩ + have hnot : choice.color ∉ MissingColors G secondStable choice.vertex := by + simpa [MissingColors] using hp + exact hnot hm + have hswap := swap_step secondStable gamma choice.color choice.vertex + secondStableProper hgamma hdelta_present + have hs_u : MissingColors G secondStable u = + MissingColors G choice.selected u := by simpa [vertex_eq] using hs + have hsel_u : MissingColors G choice.selected u = + MissingColors G (series.data.coloring i.castSucc) u := by simpa [vertex_eq] using hsel + have hswap_one : MissingColors G + (TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) u = + (MissingColors G secondStable u \ {gamma}) ∪ {choice.color} := by + simpa [vertex_eq] using hswap.1 + have hswap_two : MissingColors G secondStable u = + (MissingColors G + (TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) u \ + {choice.color}) ∪ {gamma} := by + simpa [vertex_eq] using hswap.2 + have hmain : MissingColors G (series.data.coloring i.castSucc) u = + (MissingColors G (series.data.coloring i.succ) u \ {choice.color}) ∪ {gamma} := by + calc + MissingColors G (series.data.coloring i.castSucc) u = + MissingColors G choice.selected u := hsel_u.symm + _ = MissingColors G secondStable u := hs_u.symm + _ = (MissingColors G + (TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) u \ + {choice.color}) ∪ {gamma} := hswap_two + _ = (MissingColors G (series.data.coloring i.succ) u \ {choice.color}) ∪ {gamma} := by rw + [← currentColoring] + have hrev : MissingColors G (series.data.coloring i.succ) u = + (MissingColors G (series.data.coloring i.castSucc) u \ {gamma}) ∪ {choice.color} := by + calc + MissingColors G (series.data.coloring i.succ) u = + MissingColors G + (TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) u + := by rw [currentColoring] + _ = (MissingColors G secondStable u \ {gamma}) ∪ {choice.color} := hswap_one + _ = (MissingColors G choice.selected u \ {gamma}) ∪ {choice.color} := by rw [hs_u] + _ = (MissingColors G (series.data.coloring i.castSucc) u \ {gamma}) ∪ {choice.color} := + by rw [hsel_u] + have delta_eq : d = choice.color := Option.some.inj (hd.symm.trans currentDelta) + have gamma_eq : g = gamma := Option.some.inj (hg.symm.trans currentGamma) + exact ⟨by simpa [delta_eq, gamma_eq] using hmain, + by simpa [delta_eq, gamma_eq] using hrev⟩ + +private theorem helper_support_tree_256.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (u : V) (i : Fin rounds), series.data.kind i.succ = + some TashkinovExtensionKind.PE → series.data.chosenVertex i.succ = some u → u ∈ + TreeSequenceVertexSet (series.data.tree i.succ.castSucc) := by + classical + intro V E _ _ _ G k rounds e0 input series u i hi hv + generalize target_eq : i.succ = target + have certificate := series.certified target + cases certificate with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero i target_eq).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hci : ci = i := by + apply Fin.ext + have value := congrArg Fin.val target_eq + simp at value + omega + subst ci + rw [currentKind] at hi + simp at hi + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hci : ci = i := by + apply Fin.ext + have value := congrArg Fin.val target_eq + simp at value + omega + subst ci + rw [currentKind] at hi + simp at hi + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma + closedExtension orderedExtension strictExtension => + have hci : ci = i := by + apply Fin.ext + have value := congrArg Fin.val target_eq + simp at value + omega + subst ci + have veq : choice.vertex = u := Option.some.inj (currentVertex.symm.trans hv) + simpa [veq] using choice.vertexDefective.1 + +private theorem helper_next_segment_317.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = + i.succ → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree + i.succ.succ) := by + classical + intro V E _ _ _ G k rounds e0 input series j i hj + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero i hj.symm).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have value := congrArg Fin.val hj + simp at value + have ci_eq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have value := congrArg Fin.val hj + simp at value + have ci_eq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have value := congrArg Fin.val hj + simp at value + have ci_eq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + +private theorem helper_bridge_357.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds p : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (u : V) (indices : Fin (p + + (1 : ℕ)) → Fin rounds), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) → + ( + ∀ (j : Fin rounds), (↑j : ℕ) ≤ (↑q : ℕ) ∧ series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.chosenVertex j.succ = some u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = j) → ( + ∀ (i : Fin rounds), series.data.kind i.succ = some TashkinovExtensionKind.PE → + series.data.chosenVertex i.succ = some u → u ∈ TreeSequenceVertexSet (series.data.tree + i.succ.castSucc)) → ( + ∀ (T T' : TreeSequence G e0), TreeSequenceInitialSegment T T' → + ∀ x ∈ TreeSequenceVertexSet T, x ∈ TreeSequenceVertexSet T') → ( + ∀ (j : Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment + (series.data.tree i.succ.castSucc) (series.data.tree i.succ.succ)) → + ∀ (a : Fin p), MissingColors G (series.data.coloring (indices a.castSucc).succ) u = + MissingColors G (series.data.coloring (indices a.succ).castSucc) u := by + classical + intro V E _ _ _ G k rounds p e0 input series q u indices hincreasing henumerates support_tree + vertex_transfer next_segment a + have inc := hincreasing a.castSucc a.succ (by simp) + let left : Fin rounds := ⟨(indices a.castSucc).val + 1, by omega⟩ + let right : Fin rounds := ⟨(indices a.succ).val - 1, by omega⟩ + have hleft := (henumerates (indices a.castSucc)).2 ⟨a.castSucc, rfl⟩ + have htree := support_tree (indices a.castSucc) hleft.2.1 hleft.2.2 + have hright := (henumerates (indices a.succ)).2 ⟨a.succ, rfl⟩ + have hno : ∀ j : Fin rounds, left.val ≤ j.val → j.val ≤ right.val → + ¬ (series.data.kind j.succ = some TashkinovExtensionKind.PE ∧ + series.data.chosenVertex j.succ = some u) := by + intro j hj1 hj2 hpe + have hr : right.val ≤ (indices a.succ).val := by simp [right] + have jq : j.val ≤ q.val := by omega + obtain ⟨b, hb⟩ := (henumerates j).1 ⟨jq, hpe⟩ + have hbval : (indices b).val = j.val := congrArg Fin.val hb + have hj1' : (indices a.castSucc).val + 1 ≤ j.val := by + simpa [left] using hj1 + have hj2' : j.val ≤ (indices a.succ).val - 1 := by + simpa [right] using hj2 + have hba : a.val < b.val := by + by_contra hn + have ble : b.val ≤ a.val := Nat.le_of_not_gt hn + have bne : b ≠ a.castSucc := by + intro beq + have := hbval + subst b + omega + have bstr : b.val < a.castSucc.val := lt_of_le_of_ne ble (by + intro heq + apply bne + apply Fin.ext + exact heq) + have hi := hincreasing b a.castSucc bstr + omega + have hbs : b.val < a.succ.val := by + by_contra hn + have ble : a.succ.val ≤ b.val := Nat.le_of_not_gt hn + have bne : b ≠ a.succ := by + intro beq + have := hbval + subst b + omega + have bstr : a.succ.val < b.val := lt_of_le_of_ne ble (by + intro heq + apply bne + apply Fin.ext + exact heq.symm) + have hi := hincreasing a.succ b bstr + omega + have aval : a.succ.val = a.val + 1 := rfl + have acval : a.castSucc.val = a.val := rfl + omega + have htree' : u ∈ TreeSequenceVertexSet (series.data.tree left.succ.castSucc) := by + have transferred := vertex_transfer _ _ + (next_segment (indices a.castSucc).succ (indices a.castSucc) rfl) u htree + have indexeq : left.succ.castSucc = (indices a.castSucc).succ.succ := by + apply Fin.ext + change left.val + 1 = (indices a.castSucc).val + 2 + have leftval : left.val = (indices a.castSucc).val + 1 := rfl + rw [leftval] + rw [indexeq] + exact transferred + by_cases hcon : (indices a.succ).val = (indices a.castSucc).val + 1 + · have indexeq : (indices a.castSucc).succ = (indices a.succ).castSucc := by + apply Fin.ext + simp + omega + rw [indexeq] + · have hgap : left.val ≤ right.val := by + have incval := inc + simp [left, right] at hcon ⊢ + omega + have hrq : right.val ≤ q.val := by + have hq := hright.1 + simp [right] at hq ⊢ + omega + have right_eq : right.succ = (indices a.succ).castSucc := by + apply Fin.ext + simp [right] + omega + have bridgeValue := HkuUnsupportedVertexColors G k rounds e0 input series right + left u hgap htree' hno + rw [right_eq] at bridgeValue + have left_eq : left.castSucc = (indices a.castSucc).succ := by + apply Fin.ext + simp [left] + rw [left_eq] at bridgeValue + exact bridgeValue + +private theorem helper_pe_data_480.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) + (i : Fin rounds), + series.data.kind i.succ = some TashkinovExtensionKind.PE → + ∃ (d : Fin k) (g : Fin k), + series.data.delta i.succ = some d ∧ series.data.gamma i.succ = some g := by + classical + intro V E _ _ _ G k rounds e0 input series i hi + generalize target_eq : i.succ = target + have cert := series.certified target + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => exact (Fin.succ_ne_zero i target_eq).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have value := congrArg Fin.val target_eq + simp at value + have ci_eq : ci = i := by apply Fin.ext; omega + subst ci + rw [currentKind] at hi + simp at hi + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have value := congrArg Fin.val target_eq + simp at value + have ci_eq : ci = i := by apply Fin.ext; omega + subst ci + rw [currentKind] at hi + simp at hi + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have value := congrArg Fin.val target_eq + simp at value + have ci_eq : ci = i := by apply Fin.ext; omega + subst ci + rw [currentDelta, currentGamma] + exact ⟨choice.color, gamma, rfl, rfl⟩ + +theorem SupportingPEMissingTransport {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds p : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (u : V) + (hu : u ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) + (indices : Fin (p + 1) → Fin rounds) + (hincreasing : ∀ a b, a.val < b.val → + (indices a).val < (indices b).val) + (henumerates : ∀ j : Fin rounds, + (j.val ≤ q.val ∧ + series.data.kind j.succ = some TashkinovExtensionKind.PE ∧ + series.data.chosenVertex j.succ = some u) ↔ + ∃ a : Fin (p + 1), indices a = j) + (gammaFirst deltaLast : Fin k) + (hgammaFirst : series.data.gamma (indices 0).succ = some gammaFirst) + (hdeltaLast : series.data.delta (indices (Fin.last p)).succ = some deltaLast) : + MissingColors G (series.data.coloring (indices 0).castSucc) u = + (MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u \ + { deltaLast }) ∪ + { gammaFirst } ∧ + MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u = + (MissingColors G (series.data.coloring (indices 0).castSucc) u \ { gammaFirst }) ∪ + { deltaLast } := by + classical + have swap_step := @helper_swap_step_57 V E inferInstance inferInstance G k + have pe_step := @helper_pe_step_143 V E inferInstance inferInstance inferInstance G k rounds e0 + input series u swap_step + have support_tree := @helper_support_tree_256 V E inferInstance inferInstance inferInstance G k + rounds e0 input series u + have vertex_transfer : ∀ (T T' : TreeSequence G e0), + TreeSequenceInitialSegment T T' → ∀ x, x ∈ TreeSequenceVertexSet T → + x ∈ TreeSequenceVertexSet T' := by + intro T T' hseg x hx + unfold TreeSequenceVertexSet at hx ⊢ + simp only [Finset.mem_image] at hx ⊢ + obtain ⟨i, hi, rfl⟩ := hx + rcases hseg with ⟨hlen, hvertex, hedge⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, by simpa using hvertex i⟩ + have next_segment := @helper_next_segment_317 V E inferInstance inferInstance inferInstance G k + rounds e0 input series + have bridge := @helper_bridge_357 V E inferInstance inferInstance inferInstance G k rounds p e0 + input series q u indices hincreasing henumerates support_tree vertex_transfer next_segment + have set_transport : ∀ (x y : Finset (Fin k)) (g d : Fin k), + x = (y \ {d}) ∪ {g} → y = (x \ {g}) ∪ {d} → + x \ {g} = y \ {d} := by + intro x y g d hxy hyx + by_cases hgd : g = d + · subst d + ext c + by_cases hcg : c = g <;> rw [hxy] <;> simp [hcg] + have gy : g ∉ y := by + intro hgy + have hgx : g ∈ x := by rw [hxy]; simp [hgy] + rw [hyx] at hgy + have cases : g = d ∨ (g ∈ x ∧ g ≠ g) := by simpa using hgy + cases cases with + | inl h => exact hgd h + | inr h => exact h.2 rfl + have dx : d ∉ x := by + intro hdx + rw [hxy] at hdx + have hdg : d = g := by simpa using hdx + exact hgd hdg.symm + ext c + by_cases hcg : c = g + · subst c + rw [hxy] + simp [hgd, gy] + · by_cases hcd : c = d + · subst c + rw [hxy] + simp [] + · rw [hxy] + simp [hcg, hcd] + have pe_data := @helper_pe_data_480 V E inferInstance inferInstance inferInstance G k rounds e0 + input series + have residual : ∀ (a : Fin (p + 1)) (d g : Fin k), + series.data.delta (indices a).succ = some d → + series.data.gamma (indices a).succ = some g → + MissingColors G (series.data.coloring (indices a).castSucc) u \ {g} = + MissingColors G (series.data.coloring (indices 0).castSucc) u \ {gammaFirst} := by + intro a + induction a using Fin.induction with + | zero => + intro d g hd hg + have gd : g = gammaFirst := Option.some.inj (hg.symm.trans hgammaFirst) + subst g + rfl + | succ a ih => + intro d g hd hg + obtain ⟨d0, g0, hd0, hg0⟩ := pe_data (indices a.castSucc) + ((henumerates (indices a.castSucc)).2 ⟨a.castSucc, rfl⟩).2.1 + have ih0 := ih d0 g0 hd0 hg0 + have rel := set_transport _ _ g0 d0 + (pe_step _ d0 g0 ((henumerates (indices a.castSucc)).2 ⟨a.castSucc, rfl⟩).2.1 + ((henumerates (indices a.castSucc)).2 ⟨a.castSucc, rfl⟩).2.2 hd0 hg0).1 + (pe_step _ d0 g0 ((henumerates (indices a.castSucc)).2 ⟨a.castSucc, rfl⟩).2.1 + ((henumerates (indices a.castSucc)).2 ⟨a.castSucc, rfl⟩).2.2 hd0 hg0).2 + have chain := SupportingPEColorChain G k rounds p e0 input series q u hu + indices hincreasing henumerates a + have br := bridge a + rw [chain] at hg + have hgg : g = d0 := Option.some.inj (hg.symm.trans hd0) + rw [hgg, ← br, ← rel, ih0] + obtain ⟨dlast, glast, hdl, hgl⟩ := pe_data (indices (Fin.last p)) + ((henumerates (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.1 + have hres := residual (Fin.last p) dlast glast hdl hgl + have hdl' : dlast = deltaLast := Option.some.inj (hdl.symm.trans hdeltaLast) + subst dlast + have lastRel := set_transport _ _ glast deltaLast + (pe_step _ deltaLast glast + ((henumerates (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.1 + ((henumerates (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.2 hdeltaLast hgl).1 + (pe_step _ deltaLast glast + ((henumerates (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.1 + ((henumerates (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.2 hdeltaLast hgl).2 + have core : MissingColors G (series.data.coloring (indices 0).castSucc) u \ {gammaFirst} = + MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u \ {deltaLast} := + hres.symm.trans lastRel + obtain ⟨d0, g0, hd0, hg0⟩ := pe_data (indices 0) + ((henumerates (indices 0)).2 ⟨0, rfl⟩).2.1 + have hg0' : g0 = gammaFirst := Option.some.inj (hg0.symm.trans hgammaFirst) + subst g0 + have firstStep := pe_step (indices 0) d0 gammaFirst + ((henumerates (indices 0)).2 ⟨0, rfl⟩).2.1 + ((henumerates (indices 0)).2 ⟨0, rfl⟩).2.2 hd0 hgammaFirst + have firstMem : gammaFirst ∈ + MissingColors G (series.data.coloring (indices 0).castSucc) u := by + rw [firstStep.1] + simp + have lastStep := pe_step (indices (Fin.last p)) deltaLast glast + ((henumerates (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.1 + ((henumerates (indices (Fin.last p))).2 ⟨Fin.last p, rfl⟩).2.2 hdeltaLast hgl + have lastMem : deltaLast ∈ + MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u := by + rw [lastStep.2] + simp + have firstDecomp : MissingColors G (series.data.coloring (indices 0).castSucc) u = + (MissingColors G (series.data.coloring (indices 0).castSucc) u \ {gammaFirst}) ∪ + {gammaFirst} := by + ext c + simp [firstMem] + have lastDecomp : MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u = + (MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u \ {deltaLast}) ∪ + {deltaLast} := by + ext c + simp [lastMem] + constructor + · calc + MissingColors G (series.data.coloring (indices 0).castSucc) u = + (MissingColors G (series.data.coloring (indices 0).castSucc) u \ {gammaFirst}) ∪ + {gammaFirst} := firstDecomp + _ = (MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u \ {deltaLast}) ∪ + {gammaFirst} := by rw [core] + · calc + MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u = + (MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u \ {deltaLast}) ∪ + {deltaLast} := lastDecomp + _ = (MissingColors G (series.data.coloring (indices 0).castSucc) u \ {gammaFirst}) ∪ + {deltaLast} := by rw [core] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean b/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean new file mode 100644 index 0000000000..6a444db3fc --- /dev/null +++ b/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean @@ -0,0 +1,887 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.SupportingPEColorChain +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap + +/-! +# Supporting PEStored Intersection + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_pe_step_55.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = + i.succ → + ∀ (v : V) (gamma delta : Fin k), series.data.kind j = some TashkinovExtensionKind.PE → + series.data.chosenVertex j = some v → series.data.delta j = some delta → series.data.gamma + j = some gamma → v ∈ TreeSequenceVertexSet (series.data.tree i.succ.castSucc) → + MissingColors G (series.data.coloring i.castSucc) v \ { gamma } = MissingColors G + (series.data.coloring i.succ) v \ { delta } ∧ gamma ∉ MissingColors G + (series.data.coloring i.succ) v ∧ delta ∈ MissingColors G (series.data.coloring i.succ) v + := by + classical + intro V E _ _ _ G k rounds e0 input series j i hj v gamma delta hkind hvertex hdelta hgamma hv + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + rw [initialKind] at hkind + simp at hkind + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentKind] at hkind + simp at hkind + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [currentKind] at hkind + simp at hkind + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hci : ci = i := by + apply Fin.ext + have := congrArg Fin.val hj + simp at this ⊢ + omega + subst ci + have hvchoice : choice.vertex = v := by + have := hvertex + rw [currentVertex] at this + simpa using Option.some.inj this + subst v + have hdelta' : choice.color = delta := by + rw [currentDelta] at hdelta + simpa using Option.some.inj hdelta + have hgamma' : actualGamma = gamma := by + rw [currentGamma] at hgamma + simpa using Option.some.inj hgamma + subst delta + subst gamma + have hmiss : actualGamma ∈ MissingColors G secondStable choice.vertex := by + exact (secondStableRelation.2 choice.vertex choice.vertexDefective.1).symm ▸ gammaRule.1 + have hedge : secondStable choice.edge = some choice.color := by + exact (secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, And.intro (by simp) choice.edgeColor⟩).trans choice.edgeColor + have hneq : actualGamma ≠ choice.color := by + intro heq + have hm' : actualGamma ∈ (Finset.univ : Finset (Fin k)) \ PresentColors G secondStable + choice.vertex := hmiss + apply (Finset.mem_sdiff.mp hm').2 + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, by simpa [heq] using hedge⟩ + have component_edge : ∀ e, Incident G choice.vertex e → + secondStable e = some actualGamma ∨ secondStable e = some choice.color → + Sum.inr e ∈ TwoColorComponent G secondStable actualGamma choice.color + (Sum.inl choice.vertex) := by + intro e he hc + change (TwoColorIncidenceGraph G secondStable actualGamma choice.color).connectedComponentMk + (Sum.inr e) = _ + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, he, hc] + have gamma_no : ∀ e, Incident G choice.vertex e → + secondStable e ≠ some actualGamma := by + intro e he hec + have hm' : actualGamma ∈ (Finset.univ : Finset (Fin k)) \ PresentColors G secondStable + choice.vertex := hmiss + apply (Finset.mem_sdiff.mp hm').2 + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, he, hec⟩ + have swap_gamma_no : actualGamma ∉ MissingColors G + (TwoColorComponentSwap G secondStable actualGamma choice.color + (Sum.inl choice.vertex)) choice.vertex := by + intro hm + have hm' : actualGamma ∈ (Finset.univ : Finset (Fin k)) \ PresentColors G + (TwoColorComponentSwap G secondStable actualGamma choice.color + (Sum.inl choice.vertex)) choice.vertex := hm + apply (Finset.mem_sdiff.mp hm').2 + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨choice.edge, choice.edgeIncident, ?_⟩ + rw [TwoColorComponentSwap] + simp [component_edge choice.edge choice.edgeIncident (Or.inr hedge), hedge] + have swap_delta_yes : choice.color ∈ MissingColors G + (TwoColorComponentSwap G secondStable actualGamma choice.color + (Sum.inl choice.vertex)) choice.vertex := by + apply Finset.mem_sdiff.mpr + refine ⟨by simp, ?_⟩ + intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp + obtain ⟨e, he, hec⟩ := hp + rw [TwoColorComponentSwap] at hec + by_cases hcomp : Sum.inr e ∈ TwoColorComponent G secondStable actualGamma + choice.color (Sum.inl choice.vertex) + · simp [hcomp] at hec + by_cases hgc : secondStable e = some actualGamma + · exact (gamma_no e he hgc).elim + · by_cases hdc : secondStable e = some choice.color + · simp [hdc, hneq] at hec + exact hneq hec.symm + · simp [hgc, hdc] at hec + · simp only [Fin.castSucc_succ, hcomp, ↓reduceIte] at hec + exact hcomp (component_edge e he (Or.inr hec)) + have present_other : + ∀ c, c ≠ actualGamma → c ≠ choice.color → (c ∈ PresentColors G secondStable choice.vertex ↔ c + ∈ PresentColors G (TwoColorComponentSwap G secondStable actualGamma choice.color (Sum.inl + choice.vertex)) choice.vertex) := by + intro c hcg hcd + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + constructor <;> rintro ⟨e, he, hec⟩ <;> refine ⟨e, he, ?_⟩ + · rw [TwoColorComponentSwap] + by_cases hcomp : Sum.inr e ∈ TwoColorComponent G secondStable actualGamma + choice.color (Sum.inl choice.vertex) + · simp [hcomp, hec, hcg, hcd] + · simp only [Fin.castSucc_succ, hcomp, ↓reduceIte] + exact hec + · rw [TwoColorComponentSwap] at hec + by_cases hcomp : Sum.inr e ∈ TwoColorComponent G secondStable actualGamma + choice.color (Sum.inl choice.vertex) + · simp only [Fin.castSucc_succ, hcomp, ↓reduceIte] at hec + by_cases ha : secondStable e = some actualGamma + · simp [ha] at hec + exact (hcd hec.symm).elim + · by_cases hb : secondStable e = some choice.color + · simp [hb, hneq.symm] at hec + exact (hcg hec.symm).elim + · simp only [ha, ↓reduceIte, hb] at hec + exact hec + · simp only [Fin.castSucc_succ, hcomp, ↓reduceIte] at hec + exact hec + have missing_other : + ∀ c, c ≠ actualGamma → c ≠ choice.color → (c ∈ MissingColors G secondStable choice.vertex ↔ c + ∈ MissingColors G (TwoColorComponentSwap G secondStable actualGamma choice.color (Sum.inl + choice.vertex)) choice.vertex) := by + intro c hcg hcd + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + exact not_congr (present_other c hcg hcd) + refine ⟨?_, ?_, ?_⟩ + · ext c + simp only [Finset.mem_sdiff] + have hstable : MissingColors G (series.data.coloring i.castSucc) choice.vertex = + MissingColors G secondStable choice.vertex := + (choice.selectedStable.2 choice.vertex hv).symm.trans + (secondStableRelation.2 choice.vertex hv).symm + rw [hstable, currentColoring] + simp only [Finset.mem_singleton] + by_cases hcg : c = actualGamma + · subst c + simp [hmiss, swap_gamma_no] + by_cases hcd : c = choice.color + · subst c + have delta_no : choice.color ∉ MissingColors G secondStable choice.vertex := by + intro hm + have hm' : choice.color ∈ (Finset.univ : Finset (Fin k)) \ PresentColors G secondStable + choice.vertex := hm + apply (Finset.mem_sdiff.mp hm').2 + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, hedge⟩ + simp [delta_no, swap_delta_yes] + simpa [hcg, hcd] using (missing_other c hcg hcd) + · rw [currentColoring] + exact swap_gamma_no + · rw [currentColoring] + exact swap_delta_yes + +private theorem helper_support_tree_236.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (u : V) (j : Fin (rounds + (1 : ℕ))), + series.data.kind j = some TashkinovExtensionKind.PE → series.data.chosenVertex j = some u + → u ∈ TreeSequenceVertexSet (series.data.tree j.castSucc) := by + classical + intro V E _ _ _ G k rounds e0 input series u j hk hvj + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + rw [initialKind] at hk + simp at hk + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + rw [currentKind] at hk + simp at hk + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + rw [currentKind] at hk + simp at hk + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + actualGamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + rw [currentKind] at hk + have hv : choice.vertex = u := by + rw [currentVertex] at hvj + simpa using Option.some.inj hvj + simpa [hv] using choice.vertexDefective.1 + +private theorem helper_hlocal_273.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds p : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (u : V) (indices : Fin (p + + (1 : ℕ)) → Fin rounds), ( + ∀ (j : Fin rounds), (↑j : ℕ) ≤ (↑q : ℕ) ∧ series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.chosenVertex j.succ = some u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = j) → ( + ∀ (j : Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = i.succ → + ∀ (v : V) (gamma delta : Fin k), series.data.kind j = some TashkinovExtensionKind.PE → + series.data.chosenVertex j = some v → series.data.delta j = some delta → series.data.gamma + j = some gamma → v ∈ TreeSequenceVertexSet (series.data.tree i.succ.castSucc) → + MissingColors G (series.data.coloring i.castSucc) v \ { gamma } = MissingColors G + (series.data.coloring i.succ) v \ { delta } ∧ gamma ∉ MissingColors G + (series.data.coloring i.succ) v ∧ delta ∈ MissingColors G (series.data.coloring i.succ) v) + → ( + ∀ (j : Fin (rounds + (1 : ℕ))), series.data.kind j = some TashkinovExtensionKind.PE → + series.data.chosenVertex j = some u → u ∈ TreeSequenceVertexSet (series.data.tree + j.castSucc)) → + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (gamma : Fin k), series.data.gamma (indices a).succ = some gamma ∧ + ∃ (delta : Fin k), series.data.delta (indices a).succ = some delta ∧ MissingColors G + (series.data.coloring (indices a).castSucc) u \ { gamma } = MissingColors G + (series.data.coloring (indices a).succ) u \ { delta } ∧ gamma ∉ MissingColors G + (series.data.coloring (indices a).succ) u ∧ delta ∈ MissingColors G (series.data.coloring + (indices a).succ) u ∧ series.data.stored (indices a).succ = { delta, gamma } := by + classical + intro V E _ _ _ G k rounds p e0 input series q u indices henumerates pe_step support_tree + have pe_data : ∀ (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ → + series.data.kind j = some TashkinovExtensionKind.PE → + ∃ gamma delta, series.data.gamma j = some gamma ∧ + series.data.delta j = some delta ∧ series.data.stored j = {delta, gamma} := by + intro j i hj hk + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + rw [initialKind] at hk + simp at hk + | SE ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension => + rw [currentKind] at hk + simp at hk + | RE ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed + available currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + rw [currentKind] at hk + simp at hk + | PE ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails actualGamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + have hci : ci = i := by + apply Fin.ext + have hh := congrArg Fin.val hj + simp at hh ⊢ + omega + subst ci + exact ⟨actualGamma, choice.color, currentGamma, currentDelta, currentStored⟩ + intro a + have he := (henumerates (indices a)).mpr ⟨a, rfl⟩ + have ht := support_tree (indices a).succ he.2.1 he.2.2 + obtain ⟨gamma, delta, hg, hd, hstored⟩ := pe_data ((indices a).succ) (indices a) rfl he.2.1 + have hp := pe_step (indices a).succ (indices a) rfl u gamma delta + he.2.1 he.2.2 hd hg ht + refine ⟨gamma, hg, delta, hd, ?_, ?_, ?_, ?_⟩ + · exact hp.1 + · exact hp.2.1 + · exact hp.2.2 + · exact hstored + +private theorem helper_next_segment_336.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = + i.succ → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree + i.succ.succ) := by + classical + intro V E _ _ _ G k rounds e0 input series j i hj + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero i) hj.symm |>.elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + +private theorem helper_hgap_377.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds p : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (u : V) (indices : Fin (p + + (1 : ℕ)) → Fin rounds), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) → + ( + ∀ (j : Fin rounds), (↑j : ℕ) ≤ (↑q : ℕ) ∧ series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.chosenVertex j.succ = some u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = j) → ( + ∀ (j : Fin (rounds + (1 : ℕ))), series.data.kind j = some TashkinovExtensionKind.PE → + series.data.chosenVertex j = some u → u ∈ TreeSequenceVertexSet (series.data.tree + j.castSucc)) → ( + ∀ (T T' : TreeSequence G e0), TreeSequenceInitialSegment T T' → + ∀ x ∈ TreeSequenceVertexSet T, x ∈ TreeSequenceVertexSet T') → ( + ∀ (j : Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment + (series.data.tree i.succ.castSucc) (series.data.tree i.succ.succ)) → + ∀ (a : Fin p), MissingColors G (series.data.coloring (indices a.castSucc).succ) u = + MissingColors G (series.data.coloring (indices a.succ).castSucc) u := by + classical + intro V E _ _ _ G k rounds p e0 input series q u indices hincreasing henumerates support_tree + transfer_tree next_segment a + let pp : Fin rounds := ⟨(indices a.castSucc).val + 1, by + have hinc := hincreasing a.castSucc a.succ (by simp) + omega⟩ + let qq : Fin rounds := ⟨(indices a.succ).val - 1, by + have := (indices a.succ).isLt + omega⟩ + by_cases hcon : (indices a.succ).val = (indices a.castSucc).val + 1 + · have heq : qq = indices a.castSucc := by + apply Fin.ext + simp [qq] + omega + have hsame : (indices a.succ).castSucc = (indices a.castSucc).succ := by + apply Fin.ext + simp + omega + rw [hsame] + have hlt : (indices a.castSucc).val + 1 ≤ (indices a.succ).val - 1 := by + have hinc := hincreasing a.castSucc a.succ (by simp) + omega + have hs := (henumerates (indices a.castSucc)).mpr ⟨a.castSucc, rfl⟩ + have hn := (henumerates (indices a.succ)).mpr ⟨a.succ, rfl⟩ + have hnpos : 0 < (indices a.succ).val := by + have := (indices a.succ).isLt + omega + have hpq : pp.val ≤ qq.val := by + simp [pp, qq] + omega + have hh := HkuUnsupportedVertexColors G k rounds e0 input series qq pp u hpq + (by + have ht := support_tree (indices a.castSucc).succ hs.2.1 hs.2.2 + have hseg := next_segment (indices a.castSucc).succ + (indices a.castSucc) rfl + have heq : pp.succ.castSucc = (indices a.castSucc).succ.succ := by + apply Fin.ext + simp [pp] + rw [heq] + exact transfer_tree _ _ hseg u ht) + (by + intro j hj1 hj2 hj + have hjq : j.val ≤ q.val := by + have hnextq := hn.1 + simp [qq] at hj2 + omega + obtain ⟨b, hb⟩ := (henumerates j).mp ⟨hjq, hj.1, hj.2⟩ + have hbv := congrArg Fin.val hb + rw [← hbv] at hj1 hj2 + change (indices a.castSucc).val + 1 ≤ (indices b).val at hj1 + change (indices b).val ≤ (indices a.succ).val - 1 at hj2 + have hleft : (indices a.castSucc).val + 1 ≤ (indices b).val := hj1 + have hright : (indices b).val + 1 ≤ (indices a.succ).val := by + omega + have hcast : a.castSucc.val = a.val := rfl + have hsucc : a.succ.val = a.val + 1 := rfl + by_cases hba : b.val ≤ a.val + · by_cases hltb : b.val < a.val + · have hh := hincreasing b a.castSucc hltb + have hprev : (indices a.castSucc).val < (indices b).val := by omega + omega + · have hbeqval : b.val = a.val := by omega + have hbeq : b = a.castSucc := Fin.ext (by exact hbeqval) + rw [hbeq] at hleft + omega + · have hbigval : a.val + 1 ≤ b.val := by omega + have hstrict : a.val + 1 < b.val := by + by_contra hnot + have heq : b.val = a.val + 1 := by omega + have hbnext : b = a.succ := Fin.ext heq + rw [hbnext] at hright + omega + have hbig : a.succ.val ≤ b.val := by + rw [hsucc] + exact hstrict.le + have hstrictFin : a.succ.val < b.val := by + rw [hsucc] + exact hstrict + have hh := hincreasing a.succ b hstrictFin + have hnext : (indices b).val < (indices a.succ).val := by omega + omega) + have hpp : pp.castSucc = (indices a.castSucc).succ := by + apply Fin.ext + simp [pp] + have hqq : qq.succ = (indices a.succ).castSucc := by + apply Fin.ext + simp [qq] + omega + rw [hpp, hqq] at hh + exact hh + +private theorem helper_residual_transport_478.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds p : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds), + ∀ u ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), + ∀ (indices : Fin (p + (1 : ℕ)) → Fin rounds), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) → + ( + ∀ (j : Fin rounds), (↑j : ℕ) ≤ (↑q : ℕ) ∧ series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.chosenVertex j.succ = some u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = j) → + ∀ (deltaLast : Fin k), series.data.delta (indices (Fin.last p)).succ = some deltaLast → ( + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (gamma : Fin k), series.data.gamma (indices a).succ = some gamma ∧ + ∃ (delta : Fin k), series.data.delta (indices a).succ = some delta ∧ MissingColors G + (series.data.coloring (indices a).castSucc) u \ { gamma } = MissingColors G + (series.data.coloring (indices a).succ) u \ { delta } ∧ gamma ∉ MissingColors G + (series.data.coloring (indices a).succ) u ∧ delta ∈ MissingColors G (series.data.coloring + (indices a).succ) u ∧ series.data.stored (indices a).succ = { delta, gamma }) → ( + ∀ (a : Fin p), MissingColors G (series.data.coloring (indices a.castSucc).succ) u = + MissingColors G (series.data.coloring (indices a.succ).castSucc) u) → + ∀ (gammaLast : Fin k), series.data.gamma (indices (Fin.last p)).succ = some gammaLast → + ∀ (a b : Fin (p + (1 : ℕ))) (ga da : Fin k), (↑a : ℕ) ≤ (↑b : ℕ) → (↑a : ℕ) < (↑b : ℕ) → + series.data.gamma (indices a).succ = some ga → series.data.delta (indices a).succ = some + da → MissingColors G (series.data.coloring (indices a).castSucc) u \ { ga } = + MissingColors G (series.data.coloring (indices a).succ) u \ { da } → MissingColors G + (series.data.coloring (indices b).castSucc) u \ { gammaLast } = MissingColors G + (series.data.coloring (indices b).succ) u \ { deltaLast } → b = Fin.last p → MissingColors + G (series.data.coloring (indices a).castSucc) u \ { ga } = MissingColors G + (series.data.coloring (indices b).castSucc) u \ { gammaLast } := by + classical + intro V E _ _ _ G k rounds p e0 input series q u hu indices hincreasing henumerates deltaLast + hdeltaLast hlocal hgap gammaLast hgammaLast a b + induction hdist : b.val - a.val using Nat.strong_induction_on generalizing a b with + | h n ih => + intro ga da hab hstrict hga hda hleft hright hbLast + by_cases heq : a.val = b.val + · have hfalse : a.val < a.val := by omega + exact (Nat.lt_irrefl _ hfalse).elim + · have halt : a.val + 1 ≤ b.val := by omega + let mid : Fin (p + 1) := ⟨a.val + 1, by omega⟩ + obtain ⟨gm, hgm, dm, hdm, hmid, _, _, _⟩ := hlocal mid + have hstep : MissingColors G (series.data.coloring (indices a).castSucc) u \ {ga} = + MissingColors G (series.data.coloring (indices mid).castSucc) u \ {gm} := by + have hgap' := hgap ⟨a.val, by omega⟩ + have haeq : (⟨a.val, by omega⟩ : Fin p).castSucc = a := by rfl + have hmeq : mid.castSucc = ⟨a.val + 1, by omega⟩ := by rfl + have hgap'' : MissingColors G (series.data.coloring (indices a).succ) u = + MissingColors G (series.data.coloring (indices mid).castSucc) u := by + simpa [haeq, hmeq] using hgap' + have hbridge := congrArg (fun s : Finset (Fin k) => s \ {gm}) hgap'' + have hchain := SupportingPEColorChain G k rounds p e0 input series q u + hu indices hincreasing henumerates ⟨a.val, by omega⟩ + have hidx1 : (⟨a.val, by omega⟩ : Fin p).succ = mid := by + apply Fin.ext + rfl + have hidx0 : (⟨a.val, by omega⟩ : Fin p).castSucc = a := by + apply Fin.ext + rfl + rw [hidx1, hidx0] at hchain + have heqdm : gm = da := by + rw [hgm, hda] at hchain + exact Option.some.inj hchain + rw [← heqdm] at hleft + exact hleft.trans hbridge + have hmidval : mid.val = a.val + 1 := by rfl + have hdistlt : b.val - mid.val < b.val - a.val := by + dsimp [mid] + omega + have hmidle : mid.val ≤ b.val := by + dsimp [mid] + omega + have hdistn : b.val - mid.val < n := by omega + have habmid : mid.val ≤ b.val := hmidle + have hrest : MissingColors G (series.data.coloring (indices mid).castSucc) u \ {gm} = + MissingColors G (series.data.coloring (indices b).castSucc) u \ {gammaLast} := by + by_cases hmb : mid.val = b.val + · have hbe : mid = b := Fin.ext hmb + have hml : mid = Fin.last p := hbe.trans hbLast + have heqgm : gm = gammaLast := by + rw [← hml] at hgammaLast + exact Option.some.inj (hgm.symm.trans hgammaLast) + have hdm' : dm = deltaLast := by + rw [← hml] at hdeltaLast + exact Option.some.inj (hdm.symm.trans hdeltaLast) + rw [heqgm, hdm'] at hmid + rw [← hbe] at hright + rw [heqgm, ← hbe] + · have hstrictmid' : mid.val < b.val := by omega + have hrest' := ih (b.val - mid.val) hdistn mid b (by rfl) + gm dm habmid hstrictmid' hgm hdm hmid hright hbLast + exact hrest' + exact hstep.trans hrest + +private theorem helper_hfinal_571.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds p : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (u : V) (indices : Fin (p + + (1 : ℕ)) → Fin rounds), ( + ∀ (a b : Fin (p + (1 : ℕ))), (↑a : ℕ) < (↑b : ℕ) → (↑(indices a) : ℕ) < (↑(indices b) : ℕ)) → + ( + ∀ (j : Fin rounds), (↑j : ℕ) ≤ (↑q : ℕ) ∧ series.data.kind j.succ = some + TashkinovExtensionKind.PE ∧ series.data.chosenVertex j.succ = some u ↔ + ∃ (a : Fin (p + (1 : ℕ))), indices a = j) → ( + ∀ (j : Fin (rounds + (1 : ℕ))), series.data.kind j = some TashkinovExtensionKind.PE → + series.data.chosenVertex j = some u → u ∈ TreeSequenceVertexSet (series.data.tree + j.castSucc)) → ( + ∀ (T T' : TreeSequence G e0), TreeSequenceInitialSegment T T' → + ∀ x ∈ TreeSequenceVertexSet T, x ∈ TreeSequenceVertexSet T') → ( + ∀ (j : Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment + (series.data.tree i.succ.castSucc) (series.data.tree i.succ.succ)) → MissingColors G + (series.data.coloring q.succ) u = MissingColors G (series.data.coloring (indices (Fin.last + p)).succ) u := by + classical + intro V E _ _ _ G k rounds p e0 input series q u indices hincreasing henumerates support_tree + transfer_tree next_segment + by_cases heq : (indices (Fin.last p)).val = q.val + · have he : indices (Fin.last p) = q := Fin.ext heq + rw [he] + · have hlastq := (henumerates (indices (Fin.last p))).mpr + ⟨Fin.last p, rfl⟩ |>.1 + have hlastlt : (indices (Fin.last p)).val < q.val := by + omega + have hpf_lt : (indices (Fin.last p)).val + 1 < rounds := by + omega + let pf : Fin rounds := ⟨(indices (Fin.last p)).val + 1, hpf_lt⟩ + have hpfq : pf.val ≤ q.val := by + dsimp [pf] + omega + have hseg := next_segment (indices (Fin.last p)).succ + (indices (Fin.last p)) rfl + have htree : u ∈ TreeSequenceVertexSet + (series.data.tree (pf.succ.castSucc)) := by + have hlastData := (henumerates (indices (Fin.last p))).mpr + ⟨Fin.last p, rfl⟩ + have ht := support_tree (indices (Fin.last p)).succ + hlastData.2.1 hlastData.2.2 + have he : pf.succ.castSucc = + (indices (Fin.last p)).succ.succ := by + apply Fin.ext + simp [pf] + rw [he] + exact transfer_tree _ _ hseg u ht + have hno : ∀ j : Fin rounds, pf.val ≤ j.val → j.val ≤ q.val → + ¬ (series.data.kind j.succ = some TashkinovExtensionKind.PE ∧ + series.data.chosenVertex j.succ = some u) := by + intro j hjp hjq hj + obtain ⟨b, hb⟩ := (henumerates j).mp ⟨hjq, hj.1, hj.2⟩ + have hbv := congrArg Fin.val hb + have hlastval : (Fin.last p).val = p := rfl + have hba : b.val ≤ p := by + by_contra hn + have hbl : p + 1 ≤ b.val := by omega + have hi := hincreasing (Fin.last p) b (by omega) + omega + have hidx : (indices b).val ≤ (indices (Fin.last p)).val := by + by_cases he : b.val = p + · have be : b = Fin.last p := Fin.ext (by omega) + rw [be] + · have hbl : b.val < p := by omega + have hi := hincreasing b (Fin.last p) hbl + omega + have hlow : pf.val ≤ (indices b).val := by + exact hjp.trans hbv.symm.le + dsimp [pf] at hlow + omega + have hh := HkuUnsupportedVertexColors G k rounds e0 input series q pf u + hpfq htree hno + have he : pf.castSucc = (indices (Fin.last p)).succ := by + apply Fin.ext + simp [pf] + rw [he] at hh + exact hh.symm + +private theorem helper_hsubset_630.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds p : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (u : V) (indices : Fin (p + (1 : ℕ)) → Fin + rounds) (deltaLast : Fin k), series.data.delta (indices (Fin.last p)).succ = some + deltaLast → ( + ∀ (a : Fin (p + (1 : ℕ))), + ∃ (gamma : Fin k), series.data.gamma (indices a).succ = some gamma ∧ + ∃ (delta : Fin k), series.data.delta (indices a).succ = some delta ∧ MissingColors G + (series.data.coloring (indices a).castSucc) u \ { gamma } = MissingColors G + (series.data.coloring (indices a).succ) u \ { delta } ∧ gamma ∉ MissingColors G + (series.data.coloring (indices a).succ) u ∧ delta ∈ MissingColors G (series.data.coloring + (indices a).succ) u ∧ series.data.stored (indices a).succ = { delta, gamma }) → + ∀ (gammaLast : Fin k), series.data.gamma (indices (Fin.last p)).succ = some gammaLast → + gammaLast ∉ MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u → + MissingColors G (series.data.coloring (indices (Fin.last p)).castSucc) u \ { gammaLast } = + MissingColors G (series.data.coloring (indices (Fin.last p)).succ) u \ { deltaLast } → ( + ∀ (a b : Fin (p + (1 : ℕ))) (ga da : Fin k), (↑a : ℕ) ≤ (↑b : ℕ) → (↑a : ℕ) < (↑b : ℕ) → + series.data.gamma (indices a).succ = some ga → series.data.delta (indices a).succ = some + da → MissingColors G (series.data.coloring (indices a).castSucc) u \ { ga } = + MissingColors G (series.data.coloring (indices a).succ) u \ { da } → MissingColors G + (series.data.coloring (indices b).castSucc) u \ { gammaLast } = MissingColors G + (series.data.coloring (indices b).succ) u \ { deltaLast } → b = Fin.last p → MissingColors + G (series.data.coloring (indices a).castSucc) u \ { ga } = MissingColors G + (series.data.coloring (indices b).castSucc) u \ { gammaLast }) → + ∀ (a : Fin (p + (1 : ℕ))), + ∀ c ∈ series.data.stored (indices a).succ, c ∈ MissingColors G (series.data.coloring (indices + (Fin.last p)).succ) u → c = deltaLast := by + classical + intro V E _ _ _ G k rounds p e0 input series u indices deltaLast hdeltaLast hlocal gammaLast + hgammaLast hgnLast hresLast residual_transport a c hc hm + obtain ⟨ga, hga, da, hda, hres, hgn, hdin, hstored⟩ := hlocal a + have ha_lt := a.isLt + have hp_last : (Fin.last p).val = p := rfl + rw [hstored] at hc + simp only [Finset.mem_insert, Finset.mem_singleton] at hc + have hcommon : MissingColors G + (series.data.coloring (indices a).castSucc) u \ {ga} = + MissingColors G + (series.data.coloring (indices (Fin.last p)).castSucc) u \ {gammaLast} := by + by_cases ha : a.val = p + · have ha_lt := a.isLt + have hae : a = Fin.last p := Fin.ext (by omega) + subst a + have ega : ga = gammaLast := Option.some.inj (hga.symm.trans hgammaLast) + have eda : da = deltaLast := Option.some.inj (hda.symm.trans hdeltaLast) + subst ga + subst da + exact hres.trans hresLast.symm + · apply residual_transport a (Fin.last p) ga da + (by omega) (by omega) hga hda hres hresLast rfl + rcases hc with hdc | hgc + · subst c + by_cases heq : da = deltaLast + · exact heq + · by_cases hga' : da = gammaLast + · have hn : da ∉ MissingColors G + (series.data.coloring (indices (Fin.last p)).succ) u := by + simpa [hga'] using hgnLast + exact (hn hm).elim + · have hlastmem : da ∈ MissingColors G + (series.data.coloring (indices (Fin.last p)).castSucc) u \ {gammaLast} := by + rw [hresLast] + exact Finset.mem_sdiff.mpr ⟨hm, by simpa using heq⟩ + have hamem : da ∈ MissingColors G + (series.data.coloring (indices a).castSucc) u \ {ga} := by + rw [hcommon] + exact hlastmem + have hbmem : da ∈ MissingColors G + (series.data.coloring (indices a).succ) u \ {da} := by + rw [hres] at hamem + exact hamem + exact False.elim ((Finset.mem_sdiff.mp hbmem).2 + (Finset.mem_singleton.mpr rfl)) + · subst c + by_cases heq : ga = deltaLast + · exact heq + · by_cases hga' : ga = gammaLast + · have hn : ga ∉ MissingColors G + (series.data.coloring (indices (Fin.last p)).succ) u := by + simpa [hga'] using hgnLast + exact (hn hm).elim + · have hlastmem : ga ∈ MissingColors G + (series.data.coloring (indices (Fin.last p)).castSucc) u \ {gammaLast} := by + rw [hresLast] + exact Finset.mem_sdiff.mpr ⟨hm, by simpa using heq⟩ + have hamem : ga ∈ MissingColors G + (series.data.coloring (indices a).castSucc) u \ {ga} := by + rw [hcommon] + exact hlastmem + exact False.elim ((Finset.mem_sdiff.mp hamem).2 + (Finset.mem_singleton.mpr rfl)) + +theorem SupportingPEStoredIntersection {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds p : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (u : V) + (hu : u ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc)) + (indices : Fin (p + 1) → Fin rounds) + (hincreasing : ∀ a b, a.val < b.val → + (indices a).val < (indices b).val) + (henumerates : ∀ j : Fin rounds, + (j.val ≤ q.val ∧ + series.data.kind j.succ = some TashkinovExtensionKind.PE ∧ + series.data.chosenVertex j.succ = some u) ↔ + ∃ a : Fin (p + 1), indices a = j) + (deltaLast : Fin k) + (hdeltaLast : series.data.delta (indices (Fin.last p)).succ = some deltaLast) : + let storedPairs := Finset.univ.biUnion fun a : Fin (p + 1) => + series.data.stored (indices a).succ + MissingColors G (series.data.coloring q.succ) u ∩ storedPairs = {deltaLast} ∧ + MissingColors G + (series.data.coloring (indices (Fin.last p)).succ) u ∩ storedPairs = + {deltaLast} := by + classical + dsimp + have pe_step := @helper_pe_step_55 V E inferInstance inferInstance inferInstance G k rounds e0 + input series + have support_tree := @helper_support_tree_236 V E inferInstance inferInstance inferInstance G k + rounds e0 input series u + have hlocal := @helper_hlocal_273 V E inferInstance inferInstance inferInstance G k rounds p e0 + input series q u indices henumerates pe_step support_tree + have transfer_tree : ∀ (T T' : TreeSequence G e0), + TreeSequenceInitialSegment T T' → ∀ x, x ∈ TreeSequenceVertexSet T → + x ∈ TreeSequenceVertexSet T' := by + intro T T' h x hx + unfold TreeSequenceVertexSet at hx ⊢ + simp only [Finset.mem_image] at hx ⊢ + obtain ⟨i, hi, rfl⟩ := hx + rcases h with ⟨hlen, hvertex, hedge⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, by simpa using hvertex i⟩ + have next_segment := @helper_next_segment_336 V E inferInstance inferInstance inferInstance G k + rounds e0 input series + have hgap := @helper_hgap_377 V E inferInstance inferInstance inferInstance G k rounds p e0 input + series q u indices hincreasing henumerates support_tree transfer_tree next_segment + have hlast : ∃ gamma : Fin k, + series.data.gamma (indices (Fin.last p)).succ = some gamma := by + obtain ⟨gamma, hg, delta, hd, hstep, hstored⟩ := hlocal (Fin.last p) + exact ⟨gamma, hg⟩ + obtain ⟨gammaLast, hgammaLast, deltaLast', hdeltaLast', hresLast, hgnLast, hdLast, + hstoredLast⟩ := + hlocal (Fin.last p) + have hdeltaEq : deltaLast' = deltaLast := by + exact Option.some.inj (hdeltaLast'.symm.trans hdeltaLast) + subst deltaLast' + have residual_transport := @helper_residual_transport_478 V E inferInstance inferInstance + inferInstance G k rounds p e0 input series q u hu indices hincreasing henumerates deltaLast + hdeltaLast hlocal hgap gammaLast hgammaLast + have residual_last : + ∀ a : Fin (p + 1), + ∀ ga da : Fin k, series.data.gamma (indices a).succ = some ga → series.data.delta (indices + a).succ = some da → MissingColors G (series.data.coloring (indices a).castSucc) u \ {ga} = + MissingColors G (series.data.coloring (indices a).succ) u \ {da} → ga = gammaLast → da = + deltaLast → MissingColors G (series.data.coloring (indices a).castSucc) u \ {ga} = + MissingColors G (series.data.coloring (indices (Fin.last p)).castSucc) u \ {gammaLast} + := by + intro a ga da hga hda hdata ega eda + subst ga + subst da + have ha_lt := a.isLt + have hp_last : (Fin.last p).val = p := rfl + by_cases ha : a.val = p + · have hae : a = Fin.last p := Fin.ext (by omega) + subst a + exact hdata.trans hresLast.symm + · apply residual_transport a (Fin.last p) gammaLast deltaLast + (by omega) (by omega) hga hda hdata hresLast rfl + have hfinal := @helper_hfinal_571 V E inferInstance inferInstance inferInstance G k rounds p e0 + input series q u indices hincreasing henumerates support_tree transfer_tree next_segment + have hsubset := @helper_hsubset_630 V E inferInstance inferInstance inferInstance G k rounds p e0 + input series u indices deltaLast hdeltaLast hlocal gammaLast hgammaLast hgnLast hresLast + residual_transport + constructor + · ext c + constructor + · intro hc + rcases Finset.mem_inter.mp hc with ⟨hm, hc⟩ + have hm' : c ∈ MissingColors G + (series.data.coloring (indices (Fin.last p)).succ) u := by + rw [← hfinal] + exact hm + simp only [Finset.mem_biUnion, Finset.mem_univ, true_and] at hc + obtain ⟨a, ha⟩ := hc + have heq := hsubset a c ha hm' + simp [heq] + · intro hc + have heq : c = deltaLast := by simpa using hc + subst c + apply Finset.mem_inter.mpr + refine ⟨?_, ?_⟩ + · rw [hfinal] + exact hdLast + apply Finset.mem_biUnion.mpr + refine ⟨Fin.last p, by simp, ?_⟩ + rw [hstoredLast] + simp + · ext c + constructor + · intro hc + rcases Finset.mem_inter.mp hc with ⟨hm, hc⟩ + simp only [Finset.mem_biUnion, Finset.mem_univ, true_and] at hc + obtain ⟨a, ha⟩ := hc + have heq := hsubset a c ha hm + simp [heq] + · intro hc + have heq : c = deltaLast := by simpa using hc + subst c + apply Finset.mem_inter.mpr + refine ⟨hdLast, ?_⟩ + apply Finset.mem_biUnion.mpr + refine ⟨Fin.last p, by simp, ?_⟩ + rw [hstoredLast] + simp + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTree.lean b/LeanPool/GoldbergSeymour/TashTree.lean new file mode 100644 index 0000000000..8a00c4fb80 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTree.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPairExists +public import LeanPool.GoldbergSeymour.TashTreeNoMinimumBadPair + +/-! +# Tash Tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTree {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (htriple : KTriple G k e0 phi) (hT : TashkinovTree G e0 phi T) : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := by + by_contra hbad + obtain ⟨psi, S, hmin⟩ := + TashTreeMinimumBadPairExists G k e0 phi T htriple hT hbad + exact TashTreeNoMinimumBadPair G k e0 psi S hmin + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeBadPair.lean b/LeanPool/GoldbergSeymour/TashTreeBadPair.lean new file mode 100644 index 0000000000..ef7d045684 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeBadPair.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tash Tree Bad Pair + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A critical coloring triple with a non-elementary Tashkinov tree. -/ +def TashTreeBadPair {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) : Prop := + KTriple G k e0 phi ∧ + TashkinovTree G e0 phi T ∧ ¬ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeCaseNoRepeatedOnPath.lean b/LeanPool/GoldbergSeymour/TashTreeCaseNoRepeatedOnPath.lean new file mode 100644 index 0000000000..0e2a73ac67 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeCaseNoRepeatedOnPath.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeEarlyBetaNormalization +public import LeanPool.GoldbergSeymour.TashTreeGammaEpsilonSetup +public import LeanPool.GoldbergSeymour.TashTreeNoRepeatedDisjointReduction +public import LeanPool.GoldbergSeymour.TashTreeNoRepeatedIntersectionShortening + +/-! +# Tash Tree Case No Repeated On Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeCaseNoRepeatedOnPath {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hbefore : TashTreePathIndex G T < T.length) + (hnone : ¬ ∃ alpha : Fin k, ∃ i : Fin (T.length + 1), + TashTreePathIndex G T ≤ i.val ∧ i.val < T.length ∧ + alpha ∈ MissingColors G phi (T.vertex i) ∧ + alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length))) : False := by + rcases TashTreeEarlyBetaNormalization G k e0 phi T hmin hq hbefore hnone with + ⟨phi', beta, i, hmin', hi, hbeta, hbetaLast, hnone'⟩ + let q : Fin (T.length + 1) := + ⟨TashTreePathIndex G T, Nat.lt_succ_of_lt hbefore⟩ + have hsetup : + ∃ (gamma epsilon : Fin k) (m : Fin (T.length + 1)), + gamma ≠ beta ∧ epsilon ≠ gamma ∧ + gamma ∈ MissingColors G phi' (T.vertex q) ∧ + epsilon ∈ MissingColors G phi' (T.vertex m) ∧ + TreeColorUnusedThrough phi' T gamma q ∧ + TreeColorUnusedThrough phi' T epsilon q ∧ + m.val + 2 ≤ TashTreePathIndex G T := by + simpa [q] using + (TashTreeGammaEpsilonSetup G k e0 phi' T hmin' hq hbefore + hnone' beta hbetaLast) + rcases hsetup with + ⟨gamma, epsilon, m, hgb, heg, hgamma, hepsilon, + hgammaUnused, hepsilonUnused, hm⟩ + by_cases hepsilonLast : epsilon ∈ + MissingColors G phi' (T.vertex (Fin.last T.length)) + · exact TashTreeControlledRepeatedSuffixContradiction + G k e0 phi' T hmin' hq hbefore m q + (by change m.val < TashTreePathIndex G T; omega) + (by change TashTreePathIndex G T < T.length; exact hbefore) + (by change TashTreePathIndex G T ≤ TashTreePathIndex G T; exact le_rfl) + epsilon gamma heg hepsilon hgamma + hepsilonUnused hgammaUnused hepsilonLast + · have heb : epsilon ≠ beta := by + intro h + apply hepsilonLast + simpa [h] using hbetaLast + by_cases hmeets : ∃ s : Fin (T.length + 1), + s.val + 1 ≤ TashTreePathIndex G T ∧ + Sum.inl (T.vertex s) ∈ + TwoColorComponent G phi' epsilon beta + (Sum.inl (T.vertex (Fin.last T.length))) + · exact TashTreeNoRepeatedIntersectionShortening + G k e0 phi' T hmin' hq hbefore beta epsilon heb i m hi hm + hbeta hbetaLast hepsilon hmeets + · exact TashTreeNoRepeatedDisjointReduction + G k e0 phi' T hmin' hq hbefore beta gamma epsilon hgb heg heb + i m hi hm hbeta hbetaLast hepsilon hgamma hgammaUnused + hepsilonUnused (by + intro s hs hmem + exact hmeets ⟨s, hs, hmem⟩) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeCasePathIndexLast.lean b/LeanPool/GoldbergSeymour/TashTreeCasePathIndexLast.lean new file mode 100644 index 0000000000..ef3040a544 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeCasePathIndexLast.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPathIndex + +public import LeanPool.GoldbergSeymour.TashTreeLastIndexDeletion +public import LeanPool.GoldbergSeymour.TashTreeLastIndexFirstNormalForm +public import LeanPool.GoldbergSeymour.TashTreeLastIndexSecondNormalForm +public import LeanPool.GoldbergSeymour.TashTreeLastIndexThirdNormalForm + +/-! +# Tash Tree Case Path Index Last + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeCasePathIndexLast {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hlast : TashTreePathIndex G T = T.length) : False := by + obtain ⟨phi₁, beta₁, j₁, hmin₁, hj₁, hbeta₁j, hbeta₁last, + hbeta₁unused⟩ := + TashTreeLastIndexFirstNormalForm G k e0 phi T hmin hq hlast + obtain ⟨phi₂, gamma, r, p, hr, hp, hmin₂, hrgamma, hpgamma⟩ := + TashTreeLastIndexSecondNormalForm G k e0 phi₁ T hmin₁ hq hlast + beta₁ j₁ hj₁ hbeta₁j hbeta₁last hbeta₁unused + obtain ⟨phi₃, beta₃, j₃, hmin₃, hrgamma₃, hpgamma₃, hj₃, + hbeta₃j, hbeta₃last⟩ := + TashTreeLastIndexThirdNormalForm G k e0 phi₂ T hmin₂ hq hlast + gamma r p hr hp hrgamma hpgamma + obtain ⟨P, S, s, hPlength, hPT, hSlength, hPS, hs, hsedge, + hsvertex, hbadS, hrankS⟩ := + TashTreeLastIndexDeletion G k e0 phi₃ T hmin₃ hq hlast + gamma beta₃ r p j₃ hr hp hj₃ hrgamma₃ hpgamma₃ + hbeta₃j hbeta₃last + exact (hmin₃.2 hbadS) hrankS + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeCaseRepeatedOnPath.lean b/LeanPool/GoldbergSeymour/TashTreeCaseRepeatedOnPath.lean new file mode 100644 index 0000000000..84ec53c15e --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeCaseRepeatedOnPath.lean @@ -0,0 +1,56 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeSuffixIterate +public import LeanPool.GoldbergSeymour.TashTreeSuffixTerminalReplacement + +/-! +# Tash Tree Case Repeated On Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeCaseRepeatedOnPath {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hbefore : TashTreePathIndex G T < T.length) + (hrepeat : ∃ alpha : Fin k, ∃ i : Fin (T.length + 1), + TashTreePathIndex G T ≤ i.val ∧ i.val < T.length ∧ + alpha ∈ MissingColors G phi (T.vertex i) ∧ + alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length))) : False := by + rcases hrepeat with ⟨beta, i, hiSuffix, hiLength, hi, hlast⟩ + let i' : Fin T.length := Fin.castLT i hiLength + have hiCast : i'.castSucc = i := by + apply Fin.ext + rfl + have hi' : beta ∈ MissingColors G phi (T.vertex i'.castSucc) := by + rw [hiCast] + exact hi + have hiSuffix' : TashTreePathIndex G T ≤ i'.val := by + simpa [i'] using hiSuffix + obtain ⟨psi, p, hp, hpSuffix, hminPsi, hprev, hlastPsi⟩ := + TashTreeSuffixIterate G k e0 phi T hmin beta i' hiSuffix' hi' hlast + have hlen : 2 ≤ T.length := by + omega + obtain ⟨_hpos, _hle, _delta, _j, _psiStar, _hdelta, _hjlt, + _hmissing, _hformula, hbad, hrank⟩ := + TashTreeSuffixTerminalReplacement G k e0 psi T hminPsi hlen beta p + hpSuffix hp hprev hlastPsi + exact (hminPsi.2 hbad) hrank + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeControlledInterchange.lean b/LeanPool/GoldbergSeymour/TashTreeControlledInterchange.lean new file mode 100644 index 0000000000..34ad7c990d --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeControlledInterchange.lean @@ -0,0 +1,256 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreePathIndex +public import LeanPool.GoldbergSeymour.TashTreeProperInitialSegmentRankLess +public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary +public import LeanPool.GoldbergSeymour.TashTreeRankLess +public import LeanPool.GoldbergSeymour.TashTreeSuffixPath +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TashkinovTreeComponentSwapWitnessTransport +public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapNonElementary +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Tash Tree Controlled Interchange + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeControlledInterchange {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (i j : Fin (T.length + 1)) (hij : i.val < j.val) + (hj : j.val < T.length) (alpha beta : Fin k) (hne : alpha ≠ beta) + (ha : alpha ∈ MissingColors G phi (T.vertex i)) + (hb : beta ∈ MissingColors G phi (T.vertex j)) + (hau : TreeColorUnusedThrough phi T alpha j) + (hbu : TreeColorUnusedThrough phi T beta j) : + let phi' := TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex j)) + TwoColorPathComponent G phi alpha beta (Sum.inl (T.vertex j)) ∧ + Sum.inl (T.vertex i) ∈ + TwoColorComponent G phi alpha beta (Sum.inl (T.vertex j)) ∧ + Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex i))) ∧ + Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex j))) ∧ + beta ∈ MissingColors G phi' (T.vertex i) ∧ + alpha ∈ MissingColors G phi' (T.vertex j) ∧ + (∀ r : Fin T.length, 1 ≤ r.val → r.val < j.val → + phi' (T.edge r) = phi (T.edge r)) ∧ + (∀ r : Fin T.length, j.val ≤ r.val → + ∀ w : Fin (r.val + 1), ∀ c : Fin k, + phi (T.edge r) = some c → + c ∈ MissingColors G phi + (T.vertex (Fin.castLT w + (Nat.lt_trans w.isLt (Nat.succ_lt_succ r.isLt)))) → + ∃ w' : Fin (r.val + 1), ∃ c' : Fin k, + phi' (T.edge r) = some c' ∧ + c' ∈ MissingColors G phi' + (T.vertex (Fin.castLT w' + (Nat.lt_trans w'.isLt (Nat.succ_lt_succ r.isLt))))) ∧ + TashTreeMinimumBadPair G k e0 phi' T := by + classical + dsimp only + let C := TwoColorComponent G phi alpha beta (Sum.inl (T.vertex j)) + let phi' := TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex j)) + rcases hmin with ⟨hbad, hminimal⟩ + rcases hbad with ⟨htriple, hTash, hnotElementary⟩ + rcases htriple with ⟨hcritical, hchromatic, hdegree, hproper, hone⟩ + have hvjC : Sum.inl (T.vertex j) ∈ C := by + change Sum.inl (T.vertex j) ∈ + ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl (T.vertex j))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have hvertex_ne : T.vertex i ≠ T.vertex j := by + intro h + exact (Fin.ne_of_lt hij) (T.vertex_injective h) + have incidence_subsingleton_alpha : + ∀ v : V, alpha ∈ MissingColors G phi v → + Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet (Sum.inl v)) := by + intro v hv + let : Fintype + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet (Sum.inl v)) := + Fintype.ofFinite _ + have hdeg := MissingColorIncidenceEndpoint G phi alpha beta hne hproper v hv + have hcard : + ((TwoColorIncidenceGraph G phi alpha beta).neighborFinset + (Sum.inl v)).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hdeg + intro x hx y hy + exact (Finset.card_le_one.mp hcard) x + (by simpa [SimpleGraph.mem_neighborFinset] using hx) y + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + have hiSub : Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex i))) := incidence_subsingleton_alpha _ ha + have hjSub : Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex j))) := by + let : Fintype + ((TwoColorIncidenceGraph G phi beta alpha).neighborSet + (Sum.inl (T.vertex j))) := Fintype.ofFinite _ + have hdeg := MissingColorIncidenceEndpoint G phi beta alpha hne.symm + hproper (T.vertex j) hb + have hcard : + ((TwoColorIncidenceGraph G phi beta alpha).neighborFinset + (Sum.inl (T.vertex j))).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hdeg + intro x hx y hy + have hx' : x ∈ (TwoColorIncidenceGraph G phi beta alpha).neighborFinset + (Sum.inl (T.vertex j)) := by + apply (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi beta alpha) (Sum.inl (T.vertex j)) x).2 + cases x with + | inl x => simp [TwoColorIncidenceGraph] at hx + | inr x => simpa [TwoColorIncidenceGraph, or_comm] using hx + have hy' : y ∈ (TwoColorIncidenceGraph G phi beta alpha).neighborFinset + (Sum.inl (T.vertex j)) := by + apply (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi beta alpha) (Sum.inl (T.vertex j)) y).2 + cases y with + | inl y => simp [TwoColorIncidenceGraph] at hy + | inr y => simpa [TwoColorIncidenceGraph, or_comm] using hy + exact (Finset.card_le_one.mp hcard) x hx' y hy' + have hpath : TwoColorPathComponent G phi alpha beta + (Sum.inl (T.vertex j)) := by + exact ⟨hne, Sum.inl (T.vertex j), hvjC, hjSub⟩ + have hmissing := TwoColorComponentSwapMissingBehavior G phi alpha beta hne + hproper (Sum.inl (T.vertex j)) + dsimp only at hmissing + have hproper' : IsProperEdgeColoring G phi' := by + exact TwoColorComponentSwapProper G phi alpha beta hne hproper + (Sum.inl (T.vertex j)) + have hone' : IsOneEdgeUncolored phi' e0 := by + constructor + · simp [phi', TwoColorComponentSwap, hone.1] + · intro e he + obtain ⟨c, hc⟩ := hone.2 e he + by_cases hm : Sum.inr e ∈ C + · by_cases hca : c = alpha + · refine ⟨beta, ?_⟩ + simp [phi', C, TwoColorComponentSwap, hm, hc, hca] + · by_cases hcb : c = beta + · refine ⟨alpha, ?_⟩ + simp [phi', C, TwoColorComponentSwap, hm, hc, hcb] + · refine ⟨c, ?_⟩ + simp [phi', C, TwoColorComponentSwap, hm, hc, hca, hcb] + · exact ⟨c, by simpa [phi', C, TwoColorComponentSwap, hm] using hc⟩ + have htriple' : KTriple G k e0 phi' := + ⟨hcritical, hchromatic, hdegree, hproper', hone'⟩ + have htransport := TashkinovTreeComponentSwapWitnessTransport + G k e0 phi T hproper hTash i j hij alpha beta hne ha hb hau hbu + dsimp only at htransport + have hiC : Sum.inl (T.vertex i) ∈ C := by + by_contra hiC + have hji : 1 ≤ j.val := by omega + have hjle : j.val ≤ T.length := Nat.le_of_lt hj + let P := TreeSequencePrefix T j.val hji hjle + have hPprefix : TreeSequenceInitialSegment P T := by + refine ⟨hjle, ?_, ?_⟩ + · intro r + rfl + · intro r + rfl + have hPlength : P.length = j.val := rfl + have hPTash : TashkinovTree G e0 phi' P := + htransport.2.1 P hPprefix hPlength + have hiMissing : alpha ∈ MissingColors G phi' (T.vertex i) := by + rw [hmissing.1 (T.vertex i) hiC] + exact ha + have hjMissing : alpha ∈ MissingColors G phi' (T.vertex j) := + hmissing.2.2.1 (T.vertex j) hvjC hb + have hiP : T.vertex i ∈ TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + let ip : Fin (P.length + 1) := ⟨i.val, by + change i.val < j.val + 1 + omega⟩ + refine ⟨ip, Finset.mem_univ _, ?_⟩ + apply congrArg T.vertex + apply Fin.ext + rfl + have hjP : T.vertex j ∈ TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + let jp : Fin (P.length + 1) := ⟨j.val, by + change j.val < j.val + 1 + omega⟩ + refine ⟨jp, Finset.mem_univ _, ?_⟩ + apply congrArg T.vertex + apply Fin.ext + rfl + have hnotP : ¬ ColoredVertexSetElementary G phi' + (TreeSequenceVertexSet P) := by + intro hPelem + have hd := hPelem hiP hjP hvertex_ne + exact (Finset.disjoint_left.mp hd) hiMissing hjMissing + have hbadP : TashTreeBadPair G k e0 phi' P := + ⟨htriple', hPTash, hnotP⟩ + have hproperP : P.length < T.length := by + change j.val < T.length + exact hj + have hrank : TashTreeRankLess G P T := + TashTreeProperInitialSegmentRankLess G P T hPprefix hproperP + exact (hminimal hbadP) hrank + have hiMissing' : beta ∈ MissingColors G phi' (T.vertex i) := + hmissing.2.1 (T.vertex i) hiC ha + have hjMissing' : alpha ∈ MissingColors G phi' (T.vertex j) := + hmissing.2.2.1 (T.vertex j) hvjC hb + have hearly := htransport.1 + have hlater := (htransport.2.2 hiC).1 + have hTash' := (htransport.2.2 hiC).2 + have hiT : T.vertex i ∈ TreeSequenceVertexSet T := by + rw [TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩ + have hjT : T.vertex j ∈ TreeSequenceVertexSet T := by + rw [TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨j, Finset.mem_univ _, rfl⟩ + have hnotElementary' : ¬ ColoredVertexSetElementary G phi' + (TreeSequenceVertexSet T) := by + exact TwoColorComponentSwapNonElementary G phi alpha beta hne hproper + (Sum.inl (T.vertex j)) (TreeSequenceVertexSet T) + (T.vertex i) (T.vertex j) hiT hjT hvertex_ne hiC hvjC ha hb + hnotElementary + have hminimum' : TashTreeMinimumBadPair G k e0 phi' T := by + exact ⟨⟨htriple', hTash', hnotElementary'⟩, hminimal⟩ + exact ⟨hpath, hiC, hiSub, hjSub, hiMissing', hjMissing', hearly, + hlater, hminimum'⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeControlledRepeatedSuffixContradiction.lean b/LeanPool/GoldbergSeymour/TashTreeControlledRepeatedSuffixContradiction.lean new file mode 100644 index 0000000000..936cc32de8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeControlledRepeatedSuffixContradiction.lean @@ -0,0 +1,138 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeCaseRepeatedOnPath + +/-! +# Tash Tree Controlled Repeated Suffix Contradiction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeControlledRepeatedSuffixContradiction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hbefore : TashTreePathIndex G T < T.length) + (i j : Fin (T.length + 1)) (hij : i.val < j.val) + (hj : j.val < T.length) (hpath : TashTreePathIndex G T ≤ j.val) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (ha : alpha ∈ MissingColors G phi (T.vertex i)) + (hb : beta ∈ MissingColors G phi (T.vertex j)) + (hau : TreeColorUnusedThrough phi T alpha j) + (hbu : TreeColorUnusedThrough phi T beta j) + (hlast : alpha ∈ + MissingColors G phi (T.vertex (Fin.last T.length))) : False := by + classical + have hproper : IsProperEdgeColoring G phi := hmin.1.1.2.2.2.1 + have hswap := TashTreeControlledInterchange G k e0 phi T hmin i j hij hj + alpha beta hne ha hb hau hbu + dsimp only at hswap + let phi' := TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex j)) + rcases hswap with + ⟨hcomponentPath, hiComponent, hiSub, hjSub, _hbetaI, halphaJ, + _hearly, _hlater, hmin'⟩ + have hlastOutside : Sum.inl (T.vertex (Fin.last T.length)) ∉ + TwoColorComponent G phi alpha beta (Sum.inl (T.vertex j)) := by + intro hlastComponent + obtain ⟨a, b, path, hpathSimple, hsupport⟩ := + TwoColorComponentSpanningPath G phi alpha beta hproper + (Sum.inl (T.vertex j)) + have support_of_component {x : Sum V E} (hx : x ∈ + TwoColorComponent G phi alpha beta (Sum.inl (T.vertex j))) : + x ∈ path.support := by + change x ∈ {y | y ∈ path.support} + rw [hsupport] + exact hx + have endpoint_of_subsingleton {x : Sum V E} (hx : x ∈ + TwoColorComponent G phi alpha beta (Sum.inl (T.vertex j))) + (hxSub : Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet x)) : + x = a ∨ x = b := by + by_contra hend + push Not at hend + exact (hpathSimple.isTrail.notMem_support_of_subsingleton_neighborSet + hend.1 hend.2 hxSub) (support_of_component hx) + have hjComponent : Sum.inl (T.vertex j) ∈ + TwoColorComponent G phi alpha beta (Sum.inl (T.vertex j)) := by + change Sum.inl (T.vertex j) ∈ + ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl (T.vertex j))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have hlastSub : Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))) := by + let : Fintype + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))) := Fintype.ofFinite _ + have hdegree := MissingColorIncidenceEndpoint G phi alpha beta hne hproper + (T.vertex (Fin.last T.length)) hlast + have hcard : + ((TwoColorIncidenceGraph G phi alpha beta).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length)))).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hdegree + intro x hx y hy + exact (Finset.card_le_one.mp hcard) x + (by simpa [SimpleGraph.mem_neighborFinset] using hx) y + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + have hiEnd := endpoint_of_subsingleton hiComponent hiSub + have hjEnd := endpoint_of_subsingleton hjComponent hjSub + have hlastEnd := endpoint_of_subsingleton hlastComponent hlastSub + have hi_ne_j : (Sum.inl (T.vertex i) : Sum V E) ≠ + Sum.inl (T.vertex j) := by + intro heq + have hv : T.vertex i = T.vertex j := by simpa using heq + exact (Fin.ne_of_lt hij) (T.vertex_injective hv) + have hi_ne_last : (Sum.inl (T.vertex i) : Sum V E) ≠ + Sum.inl (T.vertex (Fin.last T.length)) := by + intro heq + have hv : T.vertex i = T.vertex (Fin.last T.length) := by simpa using heq + have hindices := congrArg Fin.val (T.vertex_injective hv) + have hiLast : i.val = T.length := by simpa using hindices + omega + have hj_ne_last : (Sum.inl (T.vertex j) : Sum V E) ≠ + Sum.inl (T.vertex (Fin.last T.length)) := by + intro heq + have hv : T.vertex j = T.vertex (Fin.last T.length) := by simpa using heq + have hindices := congrArg Fin.val (T.vertex_injective hv) + have hjLast : j.val = T.length := by simpa using hindices + omega + have endpoint_is_i_or_j {x : Sum V E} (hx : x = a ∨ x = b) : + x = Sum.inl (T.vertex i) ∨ x = Sum.inl (T.vertex j) := by + rcases hiEnd with hiA | hiB <;> rcases hjEnd with hjA | hjB + · exact False.elim (hi_ne_j (hiA.trans hjA.symm)) + · rcases hx with hxA | hxB + · exact Or.inl (hxA.trans hiA.symm) + · exact Or.inr (hxB.trans hjB.symm) + · rcases hx with hxA | hxB + · exact Or.inr (hxA.trans hjA.symm) + · exact Or.inl (hxB.trans hiB.symm) + · exact False.elim (hi_ne_j (hiB.trans hjB.symm)) + rcases endpoint_is_i_or_j hlastEnd with hlastI | hlastJ + · exact hi_ne_last hlastI.symm + · exact hj_ne_last hlastJ.symm + have hlast' : alpha ∈ MissingColors G phi' + (T.vertex (Fin.last T.length)) := by + have hmissing := TwoColorComponentSwapMissingBehavior G phi alpha beta hne + hproper (Sum.inl (T.vertex j)) + dsimp only at hmissing + exact (hmissing.1 _ hlastOutside) ▸ hlast + exact TashTreeCaseRepeatedOnPath G k e0 phi' T hmin' hq hbefore + ⟨alpha, j, hpath, hj, halphaJ, hlast'⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeDisjointComponentNormalization.lean b/LeanPool/GoldbergSeymour/TashTreeDisjointComponentNormalization.lean new file mode 100644 index 0000000000..27dd419c4c --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeDisjointComponentNormalization.lean @@ -0,0 +1,161 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair + +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper + +/-! +# Tash Tree Disjoint Component Normalization + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeDisjointComponentNormalization {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (p a b : Fin (T.length + 1)) (hp : p.val < T.length) + (hap : a.val ≤ p.val) (hbp : b.val ≤ p.val) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (ha : alpha ∈ MissingColors G phi (T.vertex a)) + (hb : beta ∈ MissingColors G phi (T.vertex b)) + (hlast : beta ∈ MissingColors G phi (T.vertex (Fin.last T.length))) + (hvertices : ∀ q : Fin (T.length + 1), q.val ≤ p.val → + Sum.inl (T.vertex q) ∉ + TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length)))) + (hedges : ∀ r : Fin T.length, r.val < p.val → + Sum.inr (T.edge r) ∉ + TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length)))) : + let phi' := TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) + TashTreeMinimumBadPair G k e0 phi' T ∧ + (∀ r : Fin T.length, r.val < p.val → + phi' (T.edge r) = phi (T.edge r)) ∧ + alpha ∈ MissingColors G phi' (T.vertex a) ∧ + alpha ∈ MissingColors G phi' (T.vertex (Fin.last T.length)) := by + classical + dsimp only + let z : Sum V E := Sum.inl (T.vertex (Fin.last T.length)) + let C := TwoColorComponent G phi alpha beta z + let phi' := TwoColorComponentSwap G phi alpha beta z + rcases hmin with ⟨hbad, hminimal⟩ + rcases hbad with ⟨htriple, hTash, hnotElementary⟩ + rcases htriple with ⟨hcritical, hchromatic, hdegree, hproper, hone⟩ + have hbehavior := + TwoColorComponentSwapMissingBehavior G phi alpha beta hne hproper z + dsimp only at hbehavior + have hroot : Sum.inl (T.vertex (Fin.last T.length)) ∈ C := by + change z ∈ ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk z).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have haOutside : Sum.inl (T.vertex a) ∉ C := hvertices a hap + have hbOutside : Sum.inl (T.vertex b) ∉ C := hvertices b hbp + have ha' : alpha ∈ MissingColors G phi' (T.vertex a) := by + rw [hbehavior.1 _ haOutside] + exact ha + have hb' : beta ∈ MissingColors G phi' (T.vertex b) := by + rw [hbehavior.1 _ hbOutside] + exact hb + have hlast' : alpha ∈ + MissingColors G phi' (T.vertex (Fin.last T.length)) := + hbehavior.2.2.1 _ hroot hlast + have hfixed : ∀ r : Fin T.length, r.val < p.val → + phi' (T.edge r) = phi (T.edge r) := by + intro r hr + have hrOutside : Sum.inr (T.edge r) ∉ C := hedges r hr + simp [phi', TwoColorComponentSwap, C, hrOutside] + have hTash' : TashkinovTree G e0 phi' T := by + intro r hr + obtain ⟨w, c, he, hm⟩ := hTash r hr + by_cases hrp : r.val < p.val + · let q : Fin (T.length + 1) := + Fin.castLT w (Nat.lt_trans w.isLt (Nat.succ_lt_succ r.isLt)) + have hqp : q.val ≤ p.val := by + dsimp [q] + omega + have hqOutside : Sum.inl (T.vertex q) ∉ C := hvertices q hqp + refine ⟨w, c, (hfixed r hrp).trans he, ?_⟩ + change c ∈ MissingColors G phi' (T.vertex q) + rw [hbehavior.1 _ hqOutside] + exact hm + · have hpr : p.val ≤ r.val := by omega + have har : a.val ≤ r.val := le_trans hap hpr + have hbr : b.val ≤ r.val := le_trans hbp hpr + let wa : Fin (r.val + 1) := ⟨a.val, Nat.lt_succ_of_le har⟩ + let wb : Fin (r.val + 1) := ⟨b.val, Nat.lt_succ_of_le hbr⟩ + by_cases hca : c = alpha + · by_cases heC : Sum.inr (T.edge r) ∈ C + · refine ⟨wb, beta, ?_, ?_⟩ + · simp [phi', C, TwoColorComponentSwap, heC, he, hca] + · simpa [wb] using hb' + · refine ⟨wa, alpha, ?_, ?_⟩ + · simp [phi', C, TwoColorComponentSwap, heC, he, hca] + · simpa [wa] using ha' + · by_cases hcb : c = beta + · by_cases heC : Sum.inr (T.edge r) ∈ C + · refine ⟨wa, alpha, ?_, ?_⟩ + · simp [phi', C, TwoColorComponentSwap, heC, he, hcb] + · simpa [wa] using ha' + · refine ⟨wb, beta, ?_, ?_⟩ + · simp [phi', C, TwoColorComponentSwap, heC, he, hcb] + · simpa [wb] using hb' + · refine ⟨w, c, ?_, (hbehavior.2.2.2 _ c hca hcb).2 hm⟩ + by_cases heC : Sum.inr (T.edge r) ∈ C <;> + simp [phi', C, TwoColorComponentSwap, heC, he, hca, hcb] + have hproper' : IsProperEdgeColoring G phi' := by + exact TwoColorComponentSwapProper G phi alpha beta hne hproper z + have hone' : IsOneEdgeUncolored phi' e0 := by + constructor + · simp [phi', TwoColorComponentSwap, hone.1] + · intro e he0 + obtain ⟨c, hc⟩ := hone.2 e he0 + by_cases heC : Sum.inr e ∈ C + · by_cases hca : c = alpha + · refine ⟨beta, ?_⟩ + simp [phi', C, TwoColorComponentSwap, heC, hc, hca] + · by_cases hcb : c = beta + · refine ⟨alpha, ?_⟩ + simp [phi', C, TwoColorComponentSwap, heC, hc, hcb] + · refine ⟨c, ?_⟩ + simp [phi', C, TwoColorComponentSwap, heC, hc, hca, hcb] + · exact ⟨c, by simpa [phi', C, TwoColorComponentSwap, heC] using hc⟩ + have htriple' : KTriple G k e0 phi' := + ⟨hcritical, hchromatic, hdegree, hproper', hone'⟩ + have haT : T.vertex a ∈ TreeSequenceVertexSet T := by + rw [TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨a, Finset.mem_univ _, rfl⟩ + have hlastT : T.vertex (Fin.last T.length) ∈ TreeSequenceVertexSet T := by + rw [TreeSequenceVertexSet] + exact Finset.mem_image.mpr + ⟨Fin.last T.length, Finset.mem_univ _, rfl⟩ + have hvertex_ne : T.vertex a ≠ T.vertex (Fin.last T.length) := by + intro hav + have hai := congrArg Fin.val (T.vertex_injective hav) + simp only [Fin.val_last] at hai + omega + have hnotElementary' : ¬ ColoredVertexSetElementary G phi' + (TreeSequenceVertexSet T) := by + intro helem + have hdisjoint := helem haT hlastT hvertex_ne + exact (Finset.disjoint_left.mp hdisjoint) ha' hlast' + have hminimum' : TashTreeMinimumBadPair G k e0 phi' T := + ⟨⟨htriple', hTash', hnotElementary'⟩, hminimal⟩ + exact ⟨hminimum', hfixed, ha', hlast'⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeEarlyBetaNormalization.lean b/LeanPool/GoldbergSeymour/TashTreeEarlyBetaNormalization.lean new file mode 100644 index 0000000000..1ea1f2a162 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeEarlyBetaNormalization.lean @@ -0,0 +1,766 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange +public import LeanPool.GoldbergSeymour.TashTreeFourUnusedColors +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Tash Tree Early Beta Normalization + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hnone_387.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hbefore : TashTreePathIndex G T < T.length), (¬ + ∃ (alpha : Fin k) (i : Fin (T.length + (1 : ℕ))), TashTreePathIndex G T ≤ (↑i : ℕ) ∧ (↑i : ℕ) + < T.length ∧ alpha ∈ MissingColors G phi (T.vertex i) ∧ alpha ∈ MissingColors G phi + (T.vertex (Fin.last T.length))) → + ∀ (beta : Fin k) (j : Fin (T.length + (1 : ℕ))), T.vertex j ∈ TreeSequenceVertexSet T → + ∀ (i : Fin (T.length + (1 : ℕ))) (hiBefore : (↑i : ℕ) < TashTreePathIndex G T) (hiearly : ¬(↑i + : ℕ) + (2 : ℕ) ≤ TashTreePathIndex G T) (hiEq : (↑i : ℕ) = TashTreePathIndex G T - (1 : + ℕ)), + let rnew : Fin T.length := (⟨TashTreePathIndex G T - (2 : ℕ), Decidable.byContradiction fun (a + : ¬TashTreePathIndex G T - (2 : ℕ) < T.length) => + by omega + ⟩ : Fin T.length); + let d : Fin k := (phi (T.edge rnew)).getD beta; + ∀ (alpha : Fin k), alpha ≠ beta → alpha ≠ d → + ∀ (m : Fin (T.length + (1 : ℕ))), (↑m : ℕ) ≤ TashTreePathIndex G T - (2 : ℕ) → + let pen : Fin (T.length + (1 : ℕ)) := (⟨TashTreePathIndex G T - (1 : ℕ), + Decidable.byContradiction fun (a : ¬TashTreePathIndex G T - (1 : ℕ) < T.length + (1 : ℕ)) + => + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let B : TreeSequence G e0 := TreeSequencePrefix T (TashTreePathIndex G T - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ TashTreePathIndex G T - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬TashTreePathIndex G T - (1 : ℕ) ≤ T.length) => + by omega + ); B.length = TashTreePathIndex G T - (1 : ℕ) → + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl + (T.vertex pen)); + let C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl (T.vertex pen)); + ∀ (a b : V ⊕ E), ( + ∀ {x : V ⊕ E}, x ∈ C → ((TwoColorIncidenceGraph G phi alpha beta).neighborSet x).Subsingleton + → x = a ∨ x = b) → ( + ∀ {x : V ⊕ E}, x = a ∨ x = b → x = Sum.inl (T.vertex m) ∨ x = Sum.inl (T.vertex pen)) → + Sum.inl (T.vertex (Fin.last T.length)) ∉ C → (( + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi alpha beta (Sum.inl (T.vertex pen)) → + MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex pen))) v = + MissingColors G phi v) ∧ ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phi alpha beta (Sum.inl (T.vertex pen)) → alpha ∈ + MissingColors G phi v → beta ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex pen))) v) ∧ ( + ∀ (v : V), Sum.inl v ∈ TwoColorComponent G phi alpha beta (Sum.inl (T.vertex pen)) → beta ∈ + MissingColors G phi v → alpha ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex pen))) v) ∧ + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G (TwoColorComponentSwap G + phi alpha beta (Sum.inl (T.vertex pen))) v ↔ c ∈ MissingColors G phi v)) → + TwoColorIncidenceGraph G phi' alpha beta = TwoColorIncidenceGraph G phi alpha beta → + IsProperEdgeColoring G phi' → ¬ + ∃ (c : Fin k) (s : Fin (T.length + (1 : ℕ))), TashTreePathIndex G T ≤ (↑s : ℕ) ∧ (↑s : ℕ) < + T.length ∧ c ∈ MissingColors G phi' (T.vertex s) ∧ c ∈ MissingColors G phi' (T.vertex + (Fin.last T.length)) := by + classical + intro V E _ _ G k e0 phi T hq hbefore hnone beta j hv i hiBefore hiearly hiEq rnew d alpha hab had + m hm pen B hBlength phi' C a b endpoint_of_subsingleton endpoint_is_m_or_pen hlastOutside + hbehavior hgraph hproper' + let _ := Fintype.ofFinite V + rintro ⟨c, s, hqs, hsLength, hcs, hcLast⟩ + have hcLastOld : c ∈ + MissingColors G phi (T.vertex (Fin.last T.length)) := by + rw [← hbehavior.1 _ hlastOutside] + exact hcLast + by_cases hsOutside : Sum.inl (T.vertex s) ∉ C + · have hcsOld : c ∈ MissingColors G phi (T.vertex s) := by + rw [← hbehavior.1 _ hsOutside] + exact hcs + exact hnone ⟨c, s, hqs, hsLength, hcsOld, hcLastOld⟩ + · have hsComponent : Sum.inl (T.vertex s) ∈ C := + not_not.mp hsOutside + by_cases hca : c = alpha + · subst c + have hsSubNew : Set.Subsingleton + ((TwoColorIncidenceGraph G phi' alpha beta).neighborSet + (Sum.inl (T.vertex s))) := by + let : Fintype + ((TwoColorIncidenceGraph G phi' alpha beta).neighborSet + (Sum.inl (T.vertex s))) := Fintype.ofFinite _ + have hdegree := MissingColorIncidenceEndpoint G phi' alpha beta hab + hproper' (T.vertex s) hcs + have hcard : + ((TwoColorIncidenceGraph G phi' alpha beta).neighborFinset + (Sum.inl (T.vertex s))).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hdegree + intro x hx y hy + exact (Finset.card_le_one.mp hcard) x + (by simpa [SimpleGraph.mem_neighborFinset] using hx) y + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + have hsSubOld : Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex s))) := by + rw [← hgraph] + exact hsSubNew + rcases endpoint_is_m_or_pen + (endpoint_of_subsingleton hsComponent hsSubOld) with hsM | hsPen + · have hv : T.vertex s = T.vertex m := by simpa using hsM + have hindices := congrArg Fin.val (T.vertex_injective hv) + omega + · have hv : T.vertex s = T.vertex pen := by simpa using hsPen + have hindices := congrArg Fin.val (T.vertex_injective hv) + dsimp [pen] at hindices + omega + · by_cases hcb : c = beta + · subst c + have hsSubNew : Set.Subsingleton + ((TwoColorIncidenceGraph G phi' alpha beta).neighborSet + (Sum.inl (T.vertex s))) := by + let : Fintype + ((TwoColorIncidenceGraph G phi' beta alpha).neighborSet + (Sum.inl (T.vertex s))) := Fintype.ofFinite _ + have hdegree := MissingColorIncidenceEndpoint G phi' beta alpha + hab.symm hproper' (T.vertex s) hcs + have hcard : + ((TwoColorIncidenceGraph G phi' beta alpha).neighborFinset + (Sum.inl (T.vertex s))).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hdegree + intro x hx y hy + have hx' : x ∈ + (TwoColorIncidenceGraph G phi' beta alpha).neighborFinset + (Sum.inl (T.vertex s)) := by + apply (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi' beta alpha) + (Sum.inl (T.vertex s)) x).2 + simpa [TwoColorIncidenceGraph, or_comm] using hx + have hy' : y ∈ + (TwoColorIncidenceGraph G phi' beta alpha).neighborFinset + (Sum.inl (T.vertex s)) := by + apply (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi' beta alpha) + (Sum.inl (T.vertex s)) y).2 + simpa [TwoColorIncidenceGraph, or_comm] using hy + exact (Finset.card_le_one.mp hcard) x hx' y hy' + have hsSubOld : Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex s))) := by + rw [← hgraph] + exact hsSubNew + rcases endpoint_is_m_or_pen + (endpoint_of_subsingleton hsComponent hsSubOld) with hsM | hsPen + · have hv : T.vertex s = T.vertex m := by simpa using hsM + have hindices := congrArg Fin.val (T.vertex_injective hv) + omega + · have hv : T.vertex s = T.vertex pen := by simpa using hsPen + have hindices := congrArg Fin.val (T.vertex_injective hv) + dsimp [pen] at hindices + omega + · have hcsOld : c ∈ MissingColors G phi (T.vertex s) := + (hbehavior.2.2.2 (T.vertex s) c hca hcb).mp hcs + exact hnone ⟨c, s, hqs, hsLength, hcsOld, hcLastOld⟩ + +private theorem helper_halphaUnused_358.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hbefore : TashTreePathIndex G T < T.length) (beta : Fin k) (i : + Fin (T.length + (1 : ℕ))) (hiBefore : (↑i : ℕ) < TashTreePathIndex G T) (hiearly : ¬(↑i : + ℕ) + (2 : ℕ) ≤ TashTreePathIndex G T) (hiEq : (↑i : ℕ) = TashTreePathIndex G T - (1 : ℕ)), + let A : TreeSequence G e0 := TreeSequencePrefix T (TashTreePathIndex G T - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ TashTreePathIndex G T - (2 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬TashTreePathIndex G T - (2 : ℕ) ≤ T.length) => + by omega + ); A.length = TashTreePathIndex G T - (2 : ℕ) → + let rnew : Fin T.length := (⟨TashTreePathIndex G T - (2 : ℕ), Decidable.byContradiction fun (a + : ¬TashTreePathIndex G T - (2 : ℕ) < T.length) => + by omega + ⟩ : Fin T.length); + let d : Fin k := (phi (T.edge rnew)).getD beta; + ∀ alpha ∈ TreeFreeColors phi A, alpha ≠ beta → alpha ≠ d → + ∀ (_ : Fin (T.length + (1 : ℕ))), + let pen : Fin (T.length + (1 : ℕ)) := (⟨TashTreePathIndex G T - (1 : ℕ), + Decidable.byContradiction fun (a : ¬TashTreePathIndex G T - (1 : ℕ) < T.length + (1 : ℕ)) + => + by omega + ⟩ : Fin (T.length + (1 : ℕ))); TreeColorUnusedThrough phi T alpha pen := by + classical + intro V E _ _ G k e0 phi T hq hbefore beta i hiBefore hiearly hiEq A hAlength rnew d alpha + halphaFree hab had m pen r hrPositive hrBefore hrAlpha + let _ := Fintype.ofFinite V + by_cases hrnew : r.val = TashTreePathIndex G T - 2 + · have hre : r = rnew := by + apply Fin.ext + simpa [rnew] using hrnew + rw [hre] at hrAlpha + apply had + simp [d, hrAlpha] + · have hrlt : r.val < TashTreePathIndex G T - 2 := by + dsimp [pen] at hrBefore + omega + have hnotUsed : alpha ∉ TreeUsedColors phi A := + (Finset.mem_sdiff.mp (by simpa [TreeFreeColors] using halphaFree)).2 + apply hnotUsed + rw [TreeUsedColors] + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ⟨⟨r.val, by rw [hAlength]; omega⟩, + hrPositive, ?_⟩⟩ + change phi (T.edge r) = some alpha + exact hrAlpha + +private theorem helper_hbetaUnused_395.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hbefore : TashTreePathIndex G T < T.length), TashkinovTree G e0 + phi T → + ∀ (beta : Fin k) (j : Fin (T.length + (1 : ℕ))), T.vertex j ∈ TreeSequenceVertexSet T → + ∀ (i : Fin (T.length + (1 : ℕ))) (hiBefore : (↑i : ℕ) < TashTreePathIndex G T) (hiearly : ¬(↑i + : ℕ) + (2 : ℕ) ≤ TashTreePathIndex G T) (hiEq : (↑i : ℕ) = TashTreePathIndex G T - (1 : + ℕ)) (_ : Fin (T.length + (1 : ℕ))), + let pen : Fin (T.length + (1 : ℕ)) := (⟨TashTreePathIndex G T - (1 : ℕ), + Decidable.byContradiction fun (a : ¬TashTreePathIndex G T - (1 : ℕ) < T.length + (1 : ℕ)) + => + by omega + ⟩ : Fin (T.length + (1 : ℕ))); beta ∈ MissingColors G phi (T.vertex pen) → + let B : TreeSequence G e0 := TreeSequencePrefix T (TashTreePathIndex G T - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ TashTreePathIndex G T - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬TashTreePathIndex G T - (1 : ℕ) ≤ T.length) => + by omega + ); B.length = TashTreePathIndex G T - (1 : ℕ) → ColoredVertexSetElementary G phi + (TreeSequenceVertexSet B) → T.vertex pen ∈ TreeSequenceVertexSet B → + TreeColorUnusedThrough phi T beta pen := by + classical + intro V E _ _ G k e0 phi T hq hbefore hTash beta j hv i hiBefore hiearly hiEq m pen hbetaPen B + hBlength hBelem hpenB r hrPositive hrBefore hrBeta + let _ := Fintype.ofFinite V + rcases hTash r hrPositive with ⟨w, c, hc, hw⟩ + have hcbeta : c = beta := Option.some.inj (hc.symm.trans hrBeta) + subst c + let wt : Fin (T.length + 1) := + Fin.castLT w (Nat.lt_trans w.isLt (Nat.succ_lt_succ r.isLt)) + have hwB : T.vertex wt ∈ TreeSequenceVertexSet B := by + rw [TreeSequenceVertexSet] + let wp : Fin (B.length + 1) := ⟨w.val, by + rw [hBlength] + dsimp [pen] at hrBefore + omega⟩ + refine Finset.mem_image.mpr ⟨wp, Finset.mem_univ _, ?_⟩ + apply congrArg T.vertex + apply Fin.ext + rfl + have hwne : T.vertex wt ≠ T.vertex pen := by + intro hv + have hindices := congrArg Fin.val (T.vertex_injective hv) + dsimp [wt, pen] at hindices + dsimp [pen] at hrBefore + omega + have hd := hBelem hwB hpenB hwne + exact (Finset.disjoint_left.mp hd) hw hbetaPen + +private theorem helper_hlastSub_476.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0), IsProperEdgeColoring G + phi → + ∀ beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)), + ∀ (alpha : Fin k), alpha ≠ beta → ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))).Subsingleton := by + classical + intro V E _ _ G k e0 phi T hproper beta hbetaLast alpha hab + let _ := Fintype.ofFinite V + let : Fintype + ((TwoColorIncidenceGraph G phi beta alpha).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))) := Fintype.ofFinite _ + have hdegree := MissingColorIncidenceEndpoint G phi beta alpha hab.symm + hproper (T.vertex (Fin.last T.length)) hbetaLast + have hcard : + ((TwoColorIncidenceGraph G phi beta alpha).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length)))).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hdegree + intro x hx y hy + have hx' : x ∈ + (TwoColorIncidenceGraph G phi beta alpha).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length))) := by + apply (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi beta alpha) + (Sum.inl (T.vertex (Fin.last T.length))) x).2 + simpa [TwoColorIncidenceGraph, or_comm] using hx + have hy' : y ∈ + (TwoColorIncidenceGraph G phi beta alpha).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length))) := by + apply (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi beta alpha) + (Sum.inl (T.vertex (Fin.last T.length))) y).2 + simpa [TwoColorIncidenceGraph, or_comm] using hy + exact (Finset.card_le_one.mp hcard) x hx' y hy' + +private theorem helper_hgraph_526.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (_ : (2 : ℕ) < + TashTreePathIndex G T) (hbefore : TashTreePathIndex G T < T.length) (beta : Fin k) (i : + Fin (T.length + (1 : ℕ))) (hiBefore : (↑i : ℕ) < TashTreePathIndex G T) (hiearly : ¬(↑i : + ℕ) + (2 : ℕ) ≤ TashTreePathIndex G T) (hiEq : (↑i : ℕ) = TashTreePathIndex G T - (1 : ℕ)) + (alpha : Fin k), alpha ≠ beta → + ∀ (_ : Fin (T.length + (1 : ℕ))), + let pen : Fin (T.length + (1 : ℕ)) := (⟨TashTreePathIndex G T - (1 : ℕ), + Decidable.byContradiction fun (a : ¬TashTreePathIndex G T - (1 : ℕ) < T.length + (1 : ℕ)) + => + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let phi' : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl + (T.vertex pen)); + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl (T.vertex pen)); + TwoColorIncidenceGraph G phi' alpha beta = TwoColorIncidenceGraph G phi alpha beta := by + classical + intro V E _ _ G k e0 phi T hq hbefore beta i hiBefore hiearly hiEq alpha hab m pen phi' C + let := Fintype.ofFinite V + let := Fintype.ofFinite E + apply SimpleGraph.ext + funext x y + cases x with + | inl v => + cases y with + | inl w => simp [TwoColorIncidenceGraph] + | inr e => + simp only [TwoColorIncidenceGraph] + by_cases he : Sum.inr e ∈ C + · by_cases ha : phi e = some alpha + · simp [phi', TwoColorComponentSwap, C, he, ha, hab] + · by_cases hb : phi e = some beta + · simp [phi', TwoColorComponentSwap, C, he, hb, hab] + · simp [phi', TwoColorComponentSwap, C, he, ha, hb] + · simp [phi', TwoColorComponentSwap, C, he] + | inr e => + cases y with + | inl v => + simp only [TwoColorIncidenceGraph] + by_cases he : Sum.inr e ∈ C + · by_cases ha : phi e = some alpha + · simp [phi', TwoColorComponentSwap, C, he, ha, hab] + · by_cases hb : phi e = some beta + · simp [phi', TwoColorComponentSwap, C, he, hb, hab] + · simp [phi', TwoColorComponentSwap, C, he, ha, hb] + · simp [phi', TwoColorComponentSwap, C, he] + | inr f => simp [TwoColorIncidenceGraph] + +private theorem helper_hbetaLast_454.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hbefore : TashTreePathIndex G T < T.length), + let P : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); P.length = T.length - (1 : ℕ) → ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) + → + ∀ (beta : Fin k) (i : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex i) → + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → T.vertex i ≠ + T.vertex j → beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)) := by + classical + intro V E _ _ G k e0 phi T hq hbefore P hPlength hPelem beta i hbu j hbv huv + let _ := Fintype.ofFinite V + have hil : i.val ≤ T.length := Nat.le_of_lt_succ i.isLt + have hjl : j.val ≤ T.length := Nat.le_of_lt_succ j.isLt + by_cases hi : i.val = T.length + · have hi' : i = Fin.last T.length := Fin.ext (by simpa using hi) + simpa [hi'] using hbu + · by_cases hj : j.val = T.length + · have hj' : j = Fin.last T.length := Fin.ext (by simpa using hj) + simpa [hj'] using hbv + · exfalso + have hiP : T.vertex i ∈ TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + let ip : Fin (P.length + 1) := ⟨i.val, by rw [hPlength]; omega⟩ + exact Finset.mem_image.mpr ⟨ip, Finset.mem_univ _, rfl⟩ + have hjP : T.vertex j ∈ TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + let jp : Fin (P.length + 1) := ⟨j.val, by rw [hPlength]; omega⟩ + exact Finset.mem_image.mpr ⟨jp, Finset.mem_univ _, rfl⟩ + have hd := hPelem hiP hjP huv + exact (Finset.disjoint_left.mp hd) hbu hbv + +private theorem helper_halphaMissing_519.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hbefore : TashTreePathIndex G T < T.length) (beta : Fin k) (i : + Fin (T.length + (1 : ℕ))) (hiBefore : (↑i : ℕ) < TashTreePathIndex G T) (hiearly : ¬(↑i : + ℕ) + (2 : ℕ) ≤ TashTreePathIndex G T) (hiEq : (↑i : ℕ) = TashTreePathIndex G T - (1 : ℕ)), + let A : TreeSequence G e0 := TreeSequencePrefix T (TashTreePathIndex G T - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ TashTreePathIndex G T - (2 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬TashTreePathIndex G T - (2 : ℕ) ≤ T.length) => ( + by first | omega + )); A.length = TashTreePathIndex G T - (2 : ℕ) → + let rnew : Fin T.length := (⟨TashTreePathIndex G T - (2 : ℕ), Decidable.byContradiction fun (a + : ¬TashTreePathIndex G T - (2 : ℕ) < T.length) => + by omega + ⟩ : Fin T.length); + let d : Fin k := (phi (T.edge rnew)).getD beta; + ∀ alpha ∈ TreeFreeColors phi A, alpha ≠ beta → alpha ≠ d → + ∃ (m : Fin (T.length + (1 : ℕ))), (↑m : ℕ) ≤ TashTreePathIndex G T - (2 : ℕ) ∧ alpha ∈ + MissingColors G phi (T.vertex m) := by + classical + intro V E _ _ G k e0 phi T hq hbefore beta i hiBefore hiearly hiEq A hAlength rnew d alpha + halphaFree hab had + let _ := Fintype.ofFinite V + have hm : alpha ∈ TreeMissingColors phi A := + (Finset.mem_sdiff.mp (by simpa [TreeFreeColors] using halphaFree)).1 + rw [TreeMissingColors] at hm + rcases Finset.mem_biUnion.mp hm with ⟨x, hx, hxm⟩ + rw [TreeSequenceVertexSet] at hx + rcases Finset.mem_image.mp hx with ⟨m, -, rfl⟩ + let mt : Fin (T.length + 1) := + Fin.castLE (by rw [hAlength]; omega) m + refine ⟨mt, ?_, ?_⟩ + · dsimp [mt] + rw [hAlength] at m + omega + · simpa [mt, A, TreeSequencePrefix] using hxm + +private theorem helper_hlastOutside_622.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hbefore : TashTreePathIndex G T < T.length) (beta : Fin k) (j : + Fin (T.length + (1 : ℕ))), T.vertex j ∈ TreeSequenceVertexSet T → + ∀ (i : Fin (T.length + (1 : ℕ))) (hiBefore : (↑i : ℕ) < TashTreePathIndex G T) (hiearly : ¬(↑i + : ℕ) + (2 : ℕ) ≤ TashTreePathIndex G T) (hiEq : (↑i : ℕ) = TashTreePathIndex G T - (1 : + ℕ)) (alpha : Fin k) (m : Fin (T.length + (1 : ℕ))), + let pen : Fin (T.length + (1 : ℕ)) := (⟨TashTreePathIndex G T - (1 : ℕ), + Decidable.byContradiction fun (a : ¬TashTreePathIndex G T - (1 : ℕ) < T.length + (1 : ℕ)) + => + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let B : TreeSequence G e0 := TreeSequencePrefix T (TashTreePathIndex G T - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ TashTreePathIndex G T - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬TashTreePathIndex G T - (1 : ℕ) ≤ T.length) => + by omega + ); B.length = TashTreePathIndex G T - (1 : ℕ) → (↑m : ℕ) < (↑pen : ℕ) → (↑pen : ℕ) < T.length + → + let C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl (T.vertex pen)); + ∀ (a b : V ⊕ E), ( + ∀ {x : V ⊕ E}, x ∈ C → ((TwoColorIncidenceGraph G phi alpha beta).neighborSet x).Subsingleton + → x = a ∨ x = b) → ( + ∀ {x : V ⊕ E}, x = a ∨ x = b → x = Sum.inl (T.vertex m) ∨ x = Sum.inl (T.vertex pen)) → + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet (Sum.inl (T.vertex (Fin.last + T.length)))).Subsingleton → Sum.inl (T.vertex (Fin.last T.length)) ∉ C := by + classical + intro V E _ _ G k e0 phi T hq hbefore beta j hv i hiBefore hiearly hiEq alpha m pen B hBlength + hmpen hpenLength C a b endpoint_of_subsingleton endpoint_is_m_or_pen hlastSub hlastComponent + let := Fintype.ofFinite V + let := Fintype.ofFinite E + have hlastEnd := endpoint_of_subsingleton hlastComponent hlastSub + rcases endpoint_is_m_or_pen hlastEnd with hlastM | hlastPen + · have hv : T.vertex m = T.vertex (Fin.last T.length) := by + simpa using hlastM.symm + have hindices := congrArg Fin.val (T.vertex_injective hv) + dsimp at hindices + omega + · have hv : T.vertex pen = T.vertex (Fin.last T.length) := by + simpa using hlastPen.symm + have hindices := congrArg Fin.val (T.vertex_injective hv) + dsimp [pen] at hindices + omega + +private theorem helper_continuation_699.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), TashTreeMinimumBadPair G k e0 phi T → + ∀ (hq : (2 : ℕ) < TashTreePathIndex G T) (hbefore : TashTreePathIndex G T < T.length), (¬ + ∃ (alpha : Fin k) (i : Fin (T.length + (1 : ℕ))), TashTreePathIndex G T ≤ (↑i : ℕ) ∧ (↑i : ℕ) + < T.length ∧ alpha ∈ MissingColors G phi (T.vertex i) ∧ alpha ∈ MissingColors G phi + (T.vertex (Fin.last T.length))) → IsProperEdgeColoring G phi → TashkinovTree G e0 phi T → + ∀ (beta : Fin k) (j : Fin (T.length + (1 : ℕ))), T.vertex j ∈ TreeSequenceVertexSet T → beta ∈ + MissingColors G phi (T.vertex (Fin.last T.length)) → + ∀ (i : Fin (T.length + (1 : ℕ))) (hiBefore : (↑i : ℕ) < TashTreePathIndex G T) (hiearly : ¬(↑i + : ℕ) + (2 : ℕ) ≤ TashTreePathIndex G T) (hiEq : (↑i : ℕ) = TashTreePathIndex G T - (1 : + ℕ)), + let rnew : Fin T.length := (⟨TashTreePathIndex G T - (2 : ℕ), + by omega + ⟩ : Fin T.length); + let d : Fin k := (phi (T.edge rnew)).getD beta; + ∀ (alpha : Fin k), alpha ≠ beta → alpha ≠ d → + ∀ (m : Fin (T.length + (1 : ℕ))), (↑m : ℕ) ≤ TashTreePathIndex G T - (2 : ℕ) → alpha ∈ + MissingColors G phi (T.vertex m) → + let pen : Fin (T.length + (1 : ℕ)) := (⟨TashTreePathIndex G T - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); beta ∈ MissingColors G phi (T.vertex pen) → + TreeColorUnusedThrough phi T alpha pen → + let _ : TreeSequence G e0 := TreeSequencePrefix T (TashTreePathIndex G T - (1 : ℕ)) ( + by omega + ) ( + by omega + ); + ∃ (phi' : PartialEdgeColoring E k) (beta : Fin k) (i : Fin (T.length + (1 : ℕ))), + TashTreeMinimumBadPair G k e0 phi' T ∧ (↑i : ℕ) + (2 : ℕ) ≤ TashTreePathIndex G T ∧ beta ∈ + MissingColors G phi' (T.vertex i) ∧ beta ∈ MissingColors G phi' (T.vertex (Fin.last + T.length)) ∧ ¬ + ∃ (alpha : Fin k) (s : Fin (T.length + (1 : ℕ))), TashTreePathIndex G T ≤ (↑s : ℕ) ∧ (↑s : ℕ) + < T.length ∧ alpha ∈ MissingColors G phi' (T.vertex s) ∧ alpha ∈ MissingColors G phi' + (T.vertex (Fin.last T.length)) := by + classical + intro V E _ _ _ G k e0 phi T hmin hq hbefore hnone hproper hTash beta j hv hbetaLast i hiBefore + hiearly hiEq rnew d alpha hab had m hm halphaM pen hbetaPen halphaUnused B + have hBlength : B.length = TashTreePathIndex G T - 1 := rfl + have hBelem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) := by + apply TashTreeProperPrefixElementary G k e0 phi T B hmin + · refine ⟨by rw [hBlength]; omega, ?_, ?_⟩ + · intro r + rfl + · intro r + rfl + · rw [hBlength] + omega + have hpenB : T.vertex pen ∈ TreeSequenceVertexSet B := by + rw [TreeSequenceVertexSet] + let p : Fin (B.length + 1) := ⟨pen.val, by rw [hBlength]; simp [pen]⟩ + exact Finset.mem_image.mpr ⟨p, Finset.mem_univ _, rfl⟩ + have hbetaUnused := @helper_hbetaUnused_395 V E inferInstance inferInstance G k e0 phi T hq + hbefore hTash beta j hv i hiBefore hiearly hiEq m hbetaPen hBlength hBelem hpenB + have hmpen : m.val < pen.val := by + dsimp [pen] + omega + have hpenLength : pen.val < T.length := by + dsimp [pen] + omega + have hswap := TashTreeControlledInterchange G k e0 phi T hmin + m pen hmpen hpenLength alpha beta hab halphaM hbetaPen + halphaUnused hbetaUnused + dsimp only at hswap + let phi' := TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex pen)) + rcases hswap with + ⟨_hcomponentPath, hmComponent, hmSub, hpenSub, hbetaM, + _halphaPen, _hearly, _hlater, hmin'⟩ + let C := TwoColorComponent G phi alpha beta (Sum.inl (T.vertex pen)) + obtain ⟨a, b, path, hpathSimple, hsupport⟩ := + TwoColorComponentSpanningPath G phi alpha beta hproper + (Sum.inl (T.vertex pen)) + have support_of_component {x : Sum V E} (hx : x ∈ C) : + x ∈ path.support := by + change x ∈ {y | y ∈ path.support} + rw [hsupport] + exact hx + have endpoint_of_subsingleton {x : Sum V E} (hx : x ∈ C) + (hxSub : Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet x)) : + x = a ∨ x = b := by + by_contra hend + push Not at hend + exact (hpathSimple.isTrail.notMem_support_of_subsingleton_neighborSet + hend.1 hend.2 hxSub) (support_of_component hx) + have hpenComponent : Sum.inl (T.vertex pen) ∈ C := by + change Sum.inl (T.vertex pen) ∈ + ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl (T.vertex pen))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have hmEnd := endpoint_of_subsingleton hmComponent hmSub + have hpenEnd := endpoint_of_subsingleton hpenComponent hpenSub + have hm_ne_pen : (Sum.inl (T.vertex m) : Sum V E) ≠ + Sum.inl (T.vertex pen) := by + intro heq + have hv : T.vertex m = T.vertex pen := by simpa using heq + exact (Fin.ne_of_lt (by exact hmpen)) (T.vertex_injective hv) + have endpoint_is_m_or_pen {x : Sum V E} (hx : x = a ∨ x = b) : + x = Sum.inl (T.vertex m) ∨ x = Sum.inl (T.vertex pen) := by + rcases hmEnd with hmA | hmB <;> rcases hpenEnd with hpA | hpB + · exact False.elim (hm_ne_pen (hmA.trans hpA.symm)) + · rcases hx with hxA | hxB + · exact Or.inl (hxA.trans hmA.symm) + · exact Or.inr (hxB.trans hpB.symm) + · rcases hx with hxA | hxB + · exact Or.inr (hxA.trans hpA.symm) + · exact Or.inl (hxB.trans hmB.symm) + · exact False.elim (hm_ne_pen (hmB.trans hpB.symm)) + have hlastSub := @helper_hlastSub_476 V E inferInstance inferInstance G k e0 phi T hproper beta + hbetaLast alpha hab + have hlastOutside := @helper_hlastOutside_622 V E inferInstance inferInstance G k e0 phi T hq + hbefore beta j hv i hiBefore hiearly hiEq alpha m hBlength hmpen hpenLength a b + endpoint_of_subsingleton endpoint_is_m_or_pen hlastSub + have hbehavior := TwoColorComponentSwapMissingBehavior G phi alpha beta hab + hproper (Sum.inl (T.vertex pen)) + dsimp only at hbehavior + have hbetaLast' : beta ∈ + MissingColors G phi' (T.vertex (Fin.last T.length)) := by + rw [hbehavior.1 _ hlastOutside] + exact hbetaLast + have hgraph := @helper_hgraph_526 V E inferInstance inferInstance G k e0 phi T hq hbefore beta i + hiBefore hiearly hiEq alpha hab m + have hproper' : IsProperEdgeColoring G phi' := hmin'.1.1.2.2.2.1 + have hnone' : ¬ ∃ c : Fin k, ∃ s : Fin (T.length + 1), + TashTreePathIndex G T ≤ s.val ∧ s.val < T.length ∧ + c ∈ MissingColors G phi' (T.vertex s) ∧ + c ∈ MissingColors G phi' + (T.vertex (Fin.last T.length)) := by + exact @helper_hnone_387 V E inferInstance inferInstance G k e0 phi T hq hbefore + hnone beta j hv i hiBefore hiearly hiEq alpha hab had m hm hBlength a b + endpoint_of_subsingleton endpoint_is_m_or_pen hlastOutside hbehavior hgraph hproper' + refine ⟨phi', beta, m, hmin', ?_, hbetaM, hbetaLast', hnone'⟩ + omega + +theorem TashTreeEarlyBetaNormalization {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hbefore : TashTreePathIndex G T < T.length) + (hnone : ¬ ∃ alpha : Fin k, ∃ i : Fin (T.length + 1), + TashTreePathIndex G T ≤ i.val ∧ i.val < T.length ∧ + alpha ∈ MissingColors G phi (T.vertex i) ∧ + alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length))) : + ∃ (phi' : PartialEdgeColoring E k) (beta : Fin k) (i : Fin (T.length + 1)), + TashTreeMinimumBadPair G k e0 phi' T ∧ + i.val + 2 ≤ TashTreePathIndex G T ∧ + beta ∈ MissingColors G phi' (T.vertex i) ∧ + beta ∈ MissingColors G phi' (T.vertex (Fin.last T.length)) ∧ + ¬∃ alpha : Fin k, + ∃ s : Fin (T.length + 1), + TashTreePathIndex G T ≤ s.val ∧ + s.val < T.length ∧ + alpha ∈ MissingColors G phi' (T.vertex s) ∧ + alpha ∈ MissingColors G phi' (T.vertex (Fin.last T.length)) := by + classical + have hproper : IsProperEdgeColoring G phi := hmin.1.1.2.2.2.1 + have hTash : TashkinovTree G e0 phi T := hmin.1.2.1 + have hnotElementary : + ¬ ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := + hmin.1.2.2 + let P : TreeSequence G e0 := + TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + have hPlength : P.length = T.length - 1 := rfl + have hPelem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) := by + apply TashTreeProperPrefixElementary G k e0 phi T P hmin + · refine ⟨by rw [hPlength]; omega, ?_, ?_⟩ + · intro r + rfl + · intro r + rfl + · rw [hPlength] + omega + have hcommon : ∃ u ∈ TreeSequenceVertexSet T, + ∃ v ∈ TreeSequenceVertexSet T, u ≠ v ∧ + ∃ beta, beta ∈ MissingColors G phi u ∧ + beta ∈ MissingColors G phi v := by + by_contra hneg + push Not at hneg + apply hnotElementary + intro u hu v hv huv + rw [Finset.disjoint_left] + intro beta hbu hbv + exact hneg u hu v hv huv beta hbu hbv + rcases hcommon with ⟨u, hu, v, hv, huv, beta, hbu, hbv⟩ + have huindex : ∃ i : Fin (T.length + 1), T.vertex i = u := by + simpa [TreeSequenceVertexSet] using hu + have hvindex : ∃ i : Fin (T.length + 1), T.vertex i = v := by + simpa [TreeSequenceVertexSet] using hv + rcases huindex with ⟨i, rfl⟩ + rcases hvindex with ⟨j, rfl⟩ + have hbetaLast := @helper_hbetaLast_454 V E inferInstance inferInstance G k e0 phi T hq hbefore + hPlength hPelem beta i hbu j hbv huv + have hbetaIndex : ∃ i : Fin (T.length + 1), i.val < T.length ∧ + beta ∈ MissingColors G phi (T.vertex i) := by + by_cases hi : i.val < T.length + · exact ⟨i, hi, hbu⟩ + · have hjlt : j.val < T.length := by + have hjle : j.val ≤ T.length := Nat.le_of_lt_succ j.isLt + have hjne : j.val ≠ T.length := by + intro hjlast + have hiLast : i.val = T.length := by omega + have hij : i = j := Fin.ext (by simp [hiLast, hjlast]) + exact huv (congrArg T.vertex hij) + exact Nat.lt_of_le_of_ne hjle hjne + exact ⟨j, hjlt, hbv⟩ + rcases hbetaIndex with ⟨i, hiLength, hbetaI⟩ + have hiBefore : i.val < TashTreePathIndex G T := by + by_contra hi + have hqi : TashTreePathIndex G T ≤ i.val := Nat.le_of_not_gt hi + exact hnone ⟨beta, i, hqi, hiLength, hbetaI, hbetaLast⟩ + by_cases hiearly : i.val + 2 ≤ TashTreePathIndex G T + · exact ⟨phi, beta, i, hmin, hiearly, hbetaI, hbetaLast, hnone⟩ + have hiEq : i.val = TashTreePathIndex G T - 1 := by omega + let A : TreeSequence G e0 := + TreeSequencePrefix T (TashTreePathIndex G T - 2) (by omega) (by omega) + have hAlength : A.length = TashTreePathIndex G T - 2 := rfl + have hfour : 4 ≤ (TreeFreeColors phi A).card := by + simpa [A] using TashTreeFourUnusedColors G k e0 phi T hmin + (TashTreePathIndex G T - 2) (by omega) (by omega) + let rnew : Fin T.length := + ⟨TashTreePathIndex G T - 2, by omega⟩ + let d : Fin k := (phi (T.edge rnew)).getD beta + have hfree : ∃ alpha : Fin k, alpha ∈ TreeFreeColors phi A ∧ + alpha ≠ beta ∧ alpha ≠ d := by + by_contra! hn + have hs : TreeFreeColors phi A ⊆ ({beta, d} : Finset (Fin k)) := by + intro c hc + by_cases hcb : c = beta + · simp [hcb] + · simp [hn c hc hcb] + have hc := Finset.card_le_card hs + have hpair : ({beta, d} : Finset (Fin k)).card ≤ 2 := + Finset.card_insert_le _ _ + omega + rcases hfree with ⟨alpha, halphaFree, hab, had⟩ + have halphaMissing := @helper_halphaMissing_519 V E inferInstance inferInstance G k e0 phi T hq + hbefore beta i hiBefore hiearly hiEq hAlength alpha halphaFree hab had + rcases halphaMissing with ⟨m, hm, halphaM⟩ + let pen : Fin (T.length + 1) := + ⟨TashTreePathIndex G T - 1, by omega⟩ + have hbetaPen : beta ∈ MissingColors G phi (T.vertex pen) := by + have hip : i = pen := by + apply Fin.ext + simpa [pen] using hiEq + simpa [hip] using hbetaI + have halphaUnused := @helper_halphaUnused_358 V E inferInstance inferInstance G k e0 phi T hq + hbefore beta i hiBefore hiearly hiEq hAlength alpha halphaFree hab had m + let B : TreeSequence G e0 := + TreeSequencePrefix T (TashTreePathIndex G T - 1) (by omega) (by omega) + exact @helper_continuation_699 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@phi) (@T) (@hmin) (@hq) (@hbefore) (@hnone) (@hproper) (@hTash) (@beta) (@j) (@hv) + (@hbetaLast) (@i) (@hiBefore) (@hiearly) (@hiEq) (@alpha) (@hab) (@had) (@m) (@hm) + (@halphaM) (@hbetaPen) (@halphaUnused) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeFourUnusedColors.lean b/LeanPool/GoldbergSeymour/TashTreeFourUnusedColors.lean new file mode 100644 index 0000000000..0bf24c1a21 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeFourUnusedColors.lean @@ -0,0 +1,359 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors + +/-! +# Tash Tree Four Unused Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_continuation_174.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (q : ℕ) (hq : (1 : ℕ) ≤ + q) (hqt : q < T.length), + let P : TreeSequence G e0 := TreeSequencePrefix T q hq (Nat.le_of_lt hqt); P.length = q → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) → MaximumDegree G + (1 : ℕ) ≤ k + → + ∀ (hkpos : (0 : ℕ) < k), ( + ∀ (v : V), Degree G v ≤ MaximumDegree G) → Incident G (T.vertex (⟨(0 : ℕ), Nat.zero_lt_succ + T.length⟩ : Fin (T.length + (1 : ℕ)))) e0 → Incident G (T.vertex (⟨(1 : ℕ), + Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))) e0 → + let fallback : Fin k := (⟨(0 : ℕ), hkpos⟩ : Fin k); + let _ : E → Fin k := fun (e : E) ↦ (phi e).getD fallback; + let incidentEdges : V → Finset E := fun (v : V) ↦ ({e : E | Incident G v e} : Finset E); ( + ∀ (v : V), (incidentEdges v).card = Degree G v) → ( + ∀ (v : V), (MissingColors G phi v).card = k - (PresentColors G phi v).card) → ( + ∀ (v : V), (1 : ℕ) ≤ (MissingColors G phi v).card) → ( + ∀ (v : V), Incident G v e0 → (PresentColors G phi v).card ≤ Degree G v - (1 : ℕ)) → (4 : ℕ) ≤ + (TreeFreeColors phi (TreeSequencePrefix T q hq (Nat.le_of_lt hqt))).card := by + classical + intro V E _ _ G k e0 phi T q hq hqt P hP_length hElementary hk hkpos hDegreeMax he0Incident0 + he0Incident1 fallback colorOf incidentEdges hIncidentCard hMissingCard hMissingOne + hEndpointPresent + have hMissingTwo (v : V) (he0v : Incident G v e0) : + 2 ≤ (MissingColors G phi v).card := by + rw [hMissingCard] + have hp := hEndpointPresent v he0v + have hd := hDegreeMax v + have hdpos : 1 ≤ Degree G v := by + rw [← hIncidentCard] + exact Finset.card_pos.mpr ⟨e0, by simpa [incidentEdges] using he0v⟩ + omega + have hMissingTwo0 : + 2 ≤ (MissingColors G phi (P.vertex ⟨0, Nat.zero_lt_succ _⟩)).card := by + apply hMissingTwo + convert he0Incident0 using 1; apply congrArg T.vertex; apply Fin.ext; rfl + have hMissingTwo1 : + 2 ≤ (MissingColors G phi (P.vertex ⟨1, Nat.succ_lt_succ hq⟩)).card := by + apply hMissingTwo + convert he0Incident1 using 1; apply congrArg T.vertex; apply Fin.ext; rfl + let i0 : Fin (P.length + 1) := ⟨0, Nat.zero_lt_succ _⟩ + let i1 : Fin (P.length + 1) := ⟨1, Nat.succ_lt_succ P.positive⟩ + have hi01 : i0 ≠ i1 := by + intro h + have := congrArg Fin.val h + simp [i0, i1] at this + have hMissingNonempty (i : Fin (P.length + 1)) : + (MissingColors G phi (P.vertex i)).Nonempty := + Finset.card_pos.mp (lt_of_lt_of_le Nat.zero_lt_one (hMissingOne (P.vertex i))) + let missingChoice : Fin (P.length + 1) → Fin k := fun i => + Classical.choose (hMissingNonempty i) + have hMissingChoice (i : Fin (P.length + 1)) : + missingChoice i ∈ MissingColors G phi (P.vertex i) := + Classical.choose_spec (hMissingNonempty i) + have hPVertexMem (i : Fin (P.length + 1)) : + P.vertex i ∈ TreeSequenceVertexSet P := by + simp [TreeSequenceVertexSet] + have hMissingChoiceInjective : Function.Injective missingChoice := by + intro i j hij + by_contra hne + have hvne : P.vertex i ≠ P.vertex j := by + intro hv + exact hne (P.vertex_injective hv) + have hdisjoint := hElementary (hPVertexMem i) (hPVertexMem j) hvne + apply Finset.disjoint_left.mp hdisjoint (hMissingChoice i) + rw [hij] + exact hMissingChoice j + let chosen : Finset (Fin k) := Finset.univ.image missingChoice + have hChosenCard : chosen.card = q + 1 := by + rw [show chosen.card = Finset.univ.card by + exact Finset.card_image_iff.mpr hMissingChoiceInjective.injOn] + simp [hP_length] + have hChosenSubset : chosen ⊆ TreeMissingColors phi P := by + intro c hc + rcases Finset.mem_image.mp hc with ⟨i, -, rfl⟩ + exact Finset.mem_biUnion.mpr + ⟨P.vertex i, hPVertexMem i, hMissingChoice i⟩ + have hMissingTwoI0 : + 2 ≤ (MissingColors G phi (P.vertex i0)).card := by + simpa [i0, P] using hMissingTwo0 + have hMissingTwoI1 : + 2 ≤ (MissingColors G phi (P.vertex i1)).card := by + simpa [i1, P] using hMissingTwo1 + have hExtraNonempty (i : Fin (P.length + 1)) + (htwo : 2 ≤ (MissingColors G phi (P.vertex i)).card) : + ((MissingColors G phi (P.vertex i)).erase (missingChoice i)).Nonempty := by + apply Finset.card_pos.mp + rw [Finset.card_erase_of_mem (hMissingChoice i)] + omega + let extra0 : Fin k := Classical.choose (hExtraNonempty i0 hMissingTwoI0) + let extra1 : Fin k := Classical.choose (hExtraNonempty i1 hMissingTwoI1) + have hExtra0Erase : + extra0 ∈ (MissingColors G phi (P.vertex i0)).erase (missingChoice i0) := + Classical.choose_spec (hExtraNonempty i0 hMissingTwoI0) + have hExtra1Erase : + extra1 ∈ (MissingColors G phi (P.vertex i1)).erase (missingChoice i1) := + Classical.choose_spec (hExtraNonempty i1 hMissingTwoI1) + have hExtra0Missing : extra0 ∈ MissingColors G phi (P.vertex i0) := + (Finset.mem_erase.mp hExtra0Erase).2 + have hExtra1Missing : extra1 ∈ MissingColors G phi (P.vertex i1) := + (Finset.mem_erase.mp hExtra1Erase).2 + have hExtra0ChoiceNe : extra0 ≠ missingChoice i0 := + (Finset.mem_erase.mp hExtra0Erase).1 + have hExtra1ChoiceNe : extra1 ≠ missingChoice i1 := + (Finset.mem_erase.mp hExtra1Erase).1 + have hExtra0NotChosen : extra0 ∉ chosen := by + intro hextra + rcases Finset.mem_image.mp hextra with ⟨j, -, hj⟩ + by_cases hj0 : j = i0 + · subst j + exact hExtra0ChoiceNe hj.symm + · have hvne : P.vertex i0 ≠ P.vertex j := by + intro hv + exact hj0 (P.vertex_injective hv).symm + have hdisjoint := hElementary (hPVertexMem i0) (hPVertexMem j) hvne + apply Finset.disjoint_left.mp hdisjoint hExtra0Missing + rw [← hj] + exact hMissingChoice j + have hExtra1NotChosen : extra1 ∉ chosen := by + intro hextra + rcases Finset.mem_image.mp hextra with ⟨j, -, hj⟩ + by_cases hj1 : j = i1 + · subst j + exact hExtra1ChoiceNe hj.symm + · have hvne : P.vertex i1 ≠ P.vertex j := by + intro hv + exact hj1 (P.vertex_injective hv).symm + have hdisjoint := hElementary (hPVertexMem i1) (hPVertexMem j) hvne + apply Finset.disjoint_left.mp hdisjoint hExtra1Missing + rw [← hj] + exact hMissingChoice j + have hExtrasNe : extra0 ≠ extra1 := by + have hvne : P.vertex i0 ≠ P.vertex i1 := by + intro hv + exact hi01 (P.vertex_injective hv) + have hdisjoint := hElementary (hPVertexMem i0) (hPVertexMem i1) hvne + intro h + apply Finset.disjoint_left.mp hdisjoint hExtra0Missing + rw [h] + exact hExtra1Missing + let selected : Finset (Fin k) := insert extra0 (insert extra1 chosen) + have hSelectedCard : selected.card = q + 3 := by + rw [show selected.card = (insert extra1 chosen).card + 1 by + exact Finset.card_insert_of_notMem (by + simp [hExtra0NotChosen, hExtrasNe])] + rw [Finset.card_insert_of_notMem hExtra1NotChosen, hChosenCard] + have hSelectedSubset : selected ⊆ TreeMissingColors phi P := by + intro c hc + simp only [selected, Finset.mem_insert] at hc + rcases hc with rfl | rfl | hc + · exact Finset.mem_biUnion.mpr + ⟨P.vertex i0, hPVertexMem i0, hExtra0Missing⟩ + · exact Finset.mem_biUnion.mpr + ⟨P.vertex i1, hPVertexMem i1, hExtra1Missing⟩ + · exact hChosenSubset hc + have hTreeMissingCard : q + 3 ≤ (TreeMissingColors phi P).card := by + rw [← hSelectedCard] + exact Finset.card_le_card hSelectedSubset + let eligible : Finset (Fin P.length) := + Finset.univ.filter fun j => 1 ≤ j.val + have hUsedSubset : TreeUsedColors phi P ⊆ + eligible.image (fun j => colorOf (P.edge j)) := by + intro c hc + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc + rcases hc with ⟨j, hj, hphi⟩ + apply Finset.mem_image.mpr + refine ⟨j, ?_, ?_⟩ + · simpa [eligible] using hj + · simp [colorOf, hphi] + have hEligibleCard : eligible.card = q - 1 := by + have heligible : + eligible = Finset.univ.erase (⟨0, P.positive⟩ : Fin P.length) := by + ext j + simp [eligible, Fin.ext_iff] + omega + rw [heligible, Finset.card_erase_of_mem (by simp), Finset.card_univ] + simp [hP_length] + have hTreeUsedCard : (TreeUsedColors phi P).card ≤ q - 1 := by + refine (Finset.card_le_card hUsedSubset).trans ?_ + refine (Finset.card_image_le).trans_eq hEligibleCard + change 4 ≤ (TreeFreeColors phi P).card + unfold TreeFreeColors + have hsdiff := Finset.le_card_sdiff + (TreeUsedColors phi P) (TreeMissingColors phi P) + by_cases hqOne : q = 1 + · omega + · have hqTwo : 2 ≤ q := by omega + omega + +theorem TashTreeFourUnusedColors {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (q : ℕ) (hq : 1 ≤ q) (hqt : q < T.length) : + 4 ≤ (TreeFreeColors phi (TreeSequencePrefix T q hq (Nat.le_of_lt hqt))).card := by + classical + let P : TreeSequence G e0 := + TreeSequencePrefix T q hq (Nat.le_of_lt hqt) + have hP_length : P.length = q := rfl + have hprefix : TreeSequenceInitialSegment P T := by + refine ⟨Nat.le_of_lt hqt, ?_, ?_⟩ + · intro i + rfl + · intro j + rfl + have hproperPrefix : P.length < T.length := by + simpa [hP_length] using hqt + have hElementary : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) := + TashTreeProperPrefixElementary G k e0 phi T P hmin hprefix hproperPrefix + rcases hmin.1.1 with ⟨_, _, hk, hProper, hOne⟩ + have hkpos : 0 < k := by omega + have hDegreeMax (v : V) : Degree G v ≤ MaximumDegree G := by + unfold MaximumDegree + apply Finset.le_max' + simp + have hfirstEnds : + G.ends e0 = Sym2.mk (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩) + (T.vertex ⟨0, Nat.zero_lt_succ _⟩) := by + rcases T.attaches ⟨0, T.positive⟩ with ⟨i, hi⟩ + have hi0 : i = ⟨0, Nat.zero_lt_one⟩ := Fin.eq_zero i + subst i + rw [T.first_edge] at hi + simpa only [Fin.succ, Fin.castLT] using hi + have he0Incident0 : + Incident G (T.vertex ⟨0, Nat.zero_lt_succ _⟩) e0 := by + rw [Incident, hfirstEnds] + simp + have he0Incident1 : + Incident G (T.vertex ⟨1, Nat.succ_lt_succ T.positive⟩) e0 := by + rw [Incident, hfirstEnds] + simp + let fallback : Fin k := ⟨0, hkpos⟩ + let colorOf : E → Fin k := fun e => (phi e).getD fallback + let coloredIncident : V → Finset E := fun v => + Finset.univ.filter fun e => Incident G v e ∧ ∃ c, phi e = some c + let incidentEdges : V → Finset E := fun v => + Finset.univ.filter fun e => Incident G v e + have hPresentImage (v : V) : + PresentColors G phi v = (coloredIncident v).image colorOf := by + ext c + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and, + Finset.mem_image, coloredIncident] + constructor + · rintro ⟨e, hie, hphi⟩ + refine ⟨e, ?_, ?_⟩ + · exact ⟨hie, c, hphi⟩ + · simp [colorOf, hphi] + · rintro ⟨e, ⟨hie, d, hphi⟩, heq⟩ + have hdc : d = c := by + simpa [colorOf, hphi] using heq + subst d + exact ⟨e, hie, hphi⟩ + have hColorInjective (v : V) : + Set.InjOn colorOf (coloredIncident v : Set E) := by + intro e he f hf hcolors + simp only [coloredIncident, Finset.mem_coe, Finset.mem_filter, Finset.mem_univ, + true_and] at he hf + rcases he with ⟨hie, c, hce⟩ + rcases hf with ⟨hif, d, hdf⟩ + have hcd : c = d := by + have hce' : colorOf e = c := by simp [colorOf, hce] + have hdf' : colorOf f = d := by simp [colorOf, hdf] + rw [hce', hdf'] at hcolors + exact hcolors + subst d + by_contra hef + exact (hProper hef ⟨v, hie, hif⟩ hce) hdf + have hPresentCard (v : V) : + (PresentColors G phi v).card = (coloredIncident v).card := by + rw [hPresentImage] + exact Finset.card_image_iff.mpr (hColorInjective v) + have hColoredSubsetIncident (v : V) : + coloredIncident v ⊆ incidentEdges v := by + intro e he + simp only [coloredIncident, incidentEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at he ⊢ + exact he.1 + have hIncidentCard (v : V) : (incidentEdges v).card = Degree G v := by + rfl + have hPresentDegree (v : V) : + (PresentColors G phi v).card ≤ Degree G v := by + rw [hPresentCard, ← hIncidentCard] + exact Finset.card_le_card (hColoredSubsetIncident v) + have hMissingCard (v : V) : + (MissingColors G phi v).card = k - (PresentColors G phi v).card := by + unfold MissingColors + rw [Finset.card_sdiff_of_subset (Finset.subset_univ _)] + simp + have hMissingOne (v : V) : 1 ≤ (MissingColors G phi v).card := by + rw [hMissingCard] + have hp := hPresentDegree v + have hd := hDegreeMax v + omega + have hEndpointPresent (v : V) (he0v : Incident G v e0) : + (PresentColors G phi v).card ≤ Degree G v - 1 := by + rw [hPresentCard, ← hIncidentCard] + have hsubset : coloredIncident v ⊆ (incidentEdges v).erase e0 := by + intro e he + simp only [Finset.mem_erase] + have heparts : Incident G v e ∧ ∃ c, phi e = some c := by + simpa [coloredIncident] using he + refine ⟨?_, ?_⟩ + · intro heq + subst e + rcases heparts.2 with ⟨c, hc⟩ + simp [hOne.1] at hc + · simpa [incidentEdges] using heparts.1 + refine (Finset.card_le_card hsubset).trans_eq ?_ + rw [Finset.card_erase_of_mem] + simpa [incidentEdges] using he0v + exact @helper_continuation_174 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) + (@T) (@q) (@hq) (@hqt) (@hP_length) (@hElementary) (@hk) (@hkpos) (@hDegreeMax) + (@he0Incident0) (@he0Incident1) (@hIncidentCard) (@hMissingCard) (@hMissingOne) + (@hEndpointPresent) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeGammaEpsilonSetup.lean b/LeanPool/GoldbergSeymour/TashTreeGammaEpsilonSetup.lean new file mode 100644 index 0000000000..544e23d04c --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeGammaEpsilonSetup.lean @@ -0,0 +1,224 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeFourUnusedColors +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeUsedColors + +/-! +# Tash Tree Gamma Epsilon Setup + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeGammaEpsilonSetup {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hbefore : TashTreePathIndex G T < T.length) + (hnone : ¬ ∃ alpha : Fin k, ∃ i : Fin (T.length + 1), + TashTreePathIndex G T ≤ i.val ∧ i.val < T.length ∧ + alpha ∈ MissingColors G phi (T.vertex i) ∧ + alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length))) + (beta : Fin k) + (hbeta : beta ∈ + MissingColors G phi (T.vertex (Fin.last T.length))) : + let q : Fin (T.length + 1) := ⟨TashTreePathIndex G T, Nat.lt_succ_of_lt hbefore⟩ + ∃ (gamma epsilon : Fin k) (m : Fin (T.length + 1)), + gamma ≠ beta ∧ + epsilon ≠ gamma ∧ + gamma ∈ MissingColors G phi (T.vertex q) ∧ + epsilon ∈ MissingColors G phi (T.vertex m) ∧ + TreeColorUnusedThrough phi T gamma q ∧ + TreeColorUnusedThrough phi T epsilon q ∧ m.val + 2 ≤ TashTreePathIndex G T := by + classical + dsimp only + let qn := TashTreePathIndex G T + let q : Fin (T.length + 1) := ⟨qn, Nat.lt_succ_of_lt hbefore⟩ + have hbad := hmin.1 + have htriple := hbad.1 + have htash := hbad.2.1 + have hdegree : MaximumDegree G + 1 ≤ k := htriple.2.2.1 + obtain ⟨gamma, hgamma⟩ := + MissingColorsNonemptyOfMaximumDegree G phi hdegree (T.vertex q) + have hgammaUnused : TreeColorUnusedThrough phi T gamma q := by + intro r hr1 hrq hcolor + obtain ⟨w, c, hc, hw⟩ := htash r hr1 + have hcg : c = gamma := by + rw [hcolor] at hc + exact Option.some.inj hc.symm + subst c + let P : TreeSequence G e0 := + TreeSequencePrefix T qn (by omega) (Nat.le_of_lt hbefore) + have hPprefix : TreeSequenceInitialSegment P T := by + refine ⟨Nat.le_of_lt hbefore, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have hPelem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) := + TashTreeProperPrefixElementary G k e0 phi T P hmin hPprefix (by + change qn < T.length + exact hbefore) + have hwqval : w.val < qn := by + change r.val < qn at hrq + omega + let wp : Fin (P.length + 1) := + ⟨w.val, by change w.val < qn + 1; omega⟩ + let qp : Fin (P.length + 1) := Fin.last qn + have hwp : P.vertex wp = T.vertex + (Fin.castLT w (Nat.lt_trans w.isLt (Nat.succ_lt_succ r.isLt))) := by + apply congrArg T.vertex + apply Fin.ext + rfl + have hqp : P.vertex qp = T.vertex q := by + apply congrArg T.vertex + apply Fin.ext + rfl + have hwmem : P.vertex wp ∈ TreeSequenceVertexSet P := by + simp [TreeSequenceVertexSet] + have hqmem : P.vertex qp ∈ TreeSequenceVertexSet P := by + simp [TreeSequenceVertexSet] + have hwq : P.vertex wp ≠ P.vertex qp := by + intro heq + have hi := P.vertex_injective heq + have hiv := congrArg Fin.val hi + change w.val = qn at hiv + omega + have hdisj := hPelem hwmem hqmem hwq + exact Finset.disjoint_left.mp hdisj (by simpa [hwp] using hw) (by + simpa [hqp] using hgamma) + have hgammaBeta : gamma ≠ beta := by + intro hgb + apply hnone + refine ⟨beta, q, ?_, ?_, ?_, hbeta⟩ + · exact le_rfl + · exact hbefore + · simpa [hgb] using hgamma + let p := qn - 2 + have hp1 : 1 ≤ p := by omega + have hpT : p < T.length := by omega + let P : TreeSequence G e0 := + TreeSequencePrefix T p hp1 (Nat.le_of_lt hpT) + have hfreeCard : 4 ≤ (TreeFreeColors phi P).card := by + simpa [P] using TashTreeFourUnusedColors G k e0 phi T hmin p hp1 hpT + let r1 : Fin T.length := ⟨qn - 2, by omega⟩ + let r2 : Fin T.length := ⟨qn - 1, by omega⟩ + let c1 : Fin k := (phi (T.edge r1)).getD gamma + let c2 : Fin k := (phi (T.edge r2)).getD gamma + let remaining := ((TreeFreeColors phi P).erase gamma).erase c1 |>.erase c2 + have hremaining : remaining.Nonempty := by + rw [Finset.nonempty_iff_ne_empty] + intro hempty + have hcard0 : remaining.card = 0 := by simp [hempty] + have herase1 : (TreeFreeColors phi P).card - 1 ≤ + ((TreeFreeColors phi P).erase gamma).card := + Finset.pred_card_le_card_erase + have herase2 : ((TreeFreeColors phi P).erase gamma).card - 1 ≤ + (((TreeFreeColors phi P).erase gamma).erase c1).card := + Finset.pred_card_le_card_erase + have herase3 : + (((TreeFreeColors phi P).erase gamma).erase c1).card - 1 ≤ + remaining.card := by + simpa [remaining] using + (Finset.pred_card_le_card_erase (s := + ((TreeFreeColors phi P).erase gamma).erase c1) (a := c2)) + omega + obtain ⟨epsilon, hepsilonRemaining⟩ := hremaining + have hepsilonParts := Finset.mem_erase.mp hepsilonRemaining + have hepsilonC2 : epsilon ≠ c2 := hepsilonParts.1 + have hepsilonParts' := Finset.mem_erase.mp hepsilonParts.2 + have hepsilonC1 : epsilon ≠ c1 := hepsilonParts'.1 + have hepsilonParts'' := Finset.mem_erase.mp hepsilonParts'.2 + have hepsilonGamma : epsilon ≠ gamma := hepsilonParts''.1 + have hepsilonFree : epsilon ∈ TreeFreeColors phi P := hepsilonParts''.2 + have hepsilonEdge1 : phi (T.edge r1) ≠ some epsilon := by + intro heq + apply hepsilonC1 + simp [c1, heq] + have hepsilonEdge2 : phi (T.edge r2) ≠ some epsilon := by + intro heq + apply hepsilonC2 + simp [c2, heq] + have hepsilonMissingTree : epsilon ∈ TreeMissingColors phi P := by + exact (Finset.mem_sdiff.mp hepsilonFree).1 + rw [TreeMissingColors] at hepsilonMissingTree + obtain ⟨v, hvP, hepsilonV⟩ := Finset.mem_biUnion.mp hepsilonMissingTree + rw [TreeSequenceVertexSet] at hvP + obtain ⟨mp, -, hv⟩ := Finset.mem_image.mp hvP + let m : Fin (T.length + 1) := + Fin.castLE (Nat.succ_le_succ (Nat.le_of_lt hpT)) mp + have hPm : P.vertex mp = T.vertex m := by rfl + have hepsilonM : epsilon ∈ MissingColors G phi (T.vertex m) := by + rw [← hPm, hv] + exact hepsilonV + have hm : m.val + 2 ≤ qn := by + change mp.val + 2 ≤ qn + have hmplt : mp.val < P.length + 1 := mp.isLt + change mp.val < p + 1 at hmplt + omega + have hepsilonUnused : TreeColorUnusedThrough phi T epsilon q := by + intro r hr1 hrq + by_cases hrold : r.val < p + · have hepsilonNotUsed : epsilon ∉ TreeUsedColors phi P := + (Finset.mem_sdiff.mp hepsilonFree).2 + intro hcolor + apply hepsilonNotUsed + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + let rp : Fin P.length := ⟨r.val, by change r.val < p; exact hrold⟩ + refine ⟨rp, hr1, ?_⟩ + change phi (T.edge (Fin.castLE (Nat.le_of_lt hpT) rp)) = some epsilon + have hindex : Fin.castLE (Nat.le_of_lt hpT) rp = r := by + apply Fin.ext + rfl + rw [hindex] + exact hcolor + · have hrCases : r.val = qn - 2 ∨ r.val = qn - 1 := by + change r.val < qn at hrq + change ¬ r.val < qn - 2 at hrold + omega + rcases hrCases with hr | hr + · have hindex : r = r1 := by + apply Fin.ext + change r.val = qn - 2 + exact hr + rw [hindex] + exact hepsilonEdge1 + · have hindex : r = r2 := by + apply Fin.ext + change r.val = qn - 1 + exact hr + rw [hindex] + exact hepsilonEdge2 + refine ⟨gamma, epsilon, m, hgammaBeta, hepsilonGamma, ?_, + hepsilonM, ?_, hepsilonUnused, hm⟩ + · simpa [q] using hgamma + · simpa [q] using hgammaUnused + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeLastIndexDeletion.lean b/LeanPool/GoldbergSeymour/TashTreeLastIndexDeletion.lean new file mode 100644 index 0000000000..cb43daefb2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeLastIndexDeletion.lean @@ -0,0 +1,489 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreePathIndex +public import LeanPool.GoldbergSeymour.TashTreeRankLess +public import LeanPool.GoldbergSeymour.TashTreeSuffixPath +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tash Tree Last Index Deletion + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hattachLast_95.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (T : TreeSequence G e0), + (2 : ℕ) < TashTreePathIndex G T → + TashTreePathIndex G T = T.length → + ∀ (r : Fin T.length) (p _ : Fin (T.length + (1 : ℕ))) + (hr : (↑r : ℕ) + (1 : ℕ) = T.length) (hp : (↑p : ℕ) + (1 : ℕ) = T.length) + (hrval : (↑r : ℕ) = T.length - (1 : ℕ)) + (hrlast : r = (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length)), + ∃ (i : Fin (T.length - (1 : ℕ))), + G.ends (T.edge (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length)) = + s(T.vertex (Fin.last T.length), T.vertex (i.castLT (by omega))) := by + classical + intro V E G e0 T hq hlast r p j hr hp hrval hrlast + rcases T.attaches ⟨T.length - 1, by omega⟩ with ⟨i, hi⟩ + have hineq : i.val ≠ T.length - 1 := by + intro heq + have heqi : i = ⟨T.length - 1, by omega⟩ := Fin.ext heq + have hbad : TashTreeSuffixPath G T (T.length - 1) := by + refine ⟨by omega, by omega, ?_⟩ + intro t ht + have htval : t.val = T.length - 1 := by omega + have hteq : t = ⟨T.length - 1, by omega⟩ := Fin.ext htval + rw [hteq] + have hi' := hi + rw [heqi] at hi' + rw [hi'] + apply Sym2.eq_iff.mpr + right + constructor <;> rfl + have hle : TashTreePathIndex G T ≤ T.length - 1 := by + unfold TashTreePathIndex + exact Nat.find_min' _ hbad + omega + have hilt : i.val < T.length - 1 := by omega + refine ⟨⟨i.val, hilt⟩, ?_⟩ + rw [hi] + apply Sym2.eq_iff.mpr + left + constructor + · apply congrArg T.vertex + apply Fin.ext + exact Nat.sub_add_cancel (by omega) + · apply congrArg T.vertex + apply Fin.ext + rfl + +private theorem helper_vertex_injective_159.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) + (r : Fin T.length) (p _ : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) + (1 : ℕ) = T.length) + (hp : (↑p : ℕ) + (1 : ℕ) = T.length) (hrval : (↑r : ℕ) = T.length - (1 : ℕ)) (hrlast : r = + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length)), + let svertex : Fin (T.length - (1 : ℕ) + (1 : ℕ)) → V := fun (i : Fin (T.length - (1 : ℕ) + (1 + : ℕ))) ↦ if hi : (↑i : ℕ) < T.length - (1 : ℕ) then T.vertex (⟨(↑i : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (T.length + (1 : ℕ))) else T.vertex (Fin.last T.length); Function.Injective svertex + := by + classical + intro V E G e0 T r p j hr hp hrval hrlast svertex a b hab + by_cases ha : a.val < T.length - 1 + · by_cases hb : b.val < T.length - 1 + · apply Fin.ext + simpa using congrArg Fin.val (T.vertex_injective (by simpa [svertex, ha, hb] using hab)) + · have hbv : svertex b = T.vertex (Fin.last T.length) := by simp [svertex, hb] + have hav : svertex a = T.vertex ⟨a.val, by omega⟩ := by simp [svertex, ha] + have heq : T.vertex ⟨a.val, by omega⟩ = T.vertex (Fin.last T.length) := by + simpa [hav, hbv] using hab + have hv := T.vertex_injective heq + have hval : a.val = T.length := by simpa using congrArg Fin.val hv + omega + · by_cases hb : b.val < T.length - 1 + · have hav : svertex a = T.vertex (Fin.last T.length) := by simp [svertex, ha] + have hbv : svertex b = T.vertex ⟨b.val, by omega⟩ := by simp [svertex, hb] + have heq : T.vertex (Fin.last T.length) = T.vertex ⟨b.val, by omega⟩ := by + simpa [hav, hbv] using hab + have hv := T.vertex_injective heq + have hval : T.length = b.val := by simpa using congrArg Fin.val hv + omega + · apply Fin.ext + omega + +private theorem helper_edge_injective_182.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0), + (2 : ℕ) < TashTreePathIndex G T → TashTreePathIndex G T = T.length → + ∀ (r : Fin T.length) (p _ : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) + (1 : ℕ) = T.length) (hp + : (↑p : ℕ) + (1 : ℕ) = T.length) (hrval : (↑r : ℕ) = T.length - (1 : ℕ)) (hrlast : r = + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length)), + let sedge : Fin (T.length - (1 : ℕ)) → E := fun (i : Fin (T.length - (1 : ℕ))) ↦ if _ : (↑i : + ℕ) < T.length - (2 : ℕ) then T.edge (⟨(↑i : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length) else T.edge (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin T.length); Function.Injective sedge := by + classical + intro V E G e0 T hq hlast r p j hr hp hrval hrlast sedge a b hab + by_cases ha : a.val < T.length - 2 + · by_cases hb : b.val < T.length - 2 + · apply Fin.ext + simpa using congrArg Fin.val (T.edge_injective (by simpa [sedge, ha, hb] using hab)) + · have hbe : sedge b = T.edge ⟨T.length - 1, by omega⟩ := by simp [sedge, hb] + have hae : sedge a = T.edge ⟨a.val, by omega⟩ := by simp [sedge, ha] + have heq : T.edge ⟨a.val, by omega⟩ = T.edge ⟨T.length - 1, by omega⟩ := by + simpa [hae, hbe] using hab + have hv := T.edge_injective heq + have hval : a.val = T.length - 1 := by simpa using congrArg Fin.val hv + omega + · by_cases hb : b.val < T.length - 2 + · have hae : sedge a = T.edge ⟨T.length - 1, by omega⟩ := by simp [sedge, ha] + have hbe : sedge b = T.edge ⟨b.val, by omega⟩ := by simp [sedge, hb] + have heq : T.edge ⟨T.length - 1, by omega⟩ = T.edge ⟨b.val, by omega⟩ := by + simpa [hae, hbe] using hab + have hv := T.edge_injective heq + have hval : T.length - 1 = b.val := by simpa using congrArg Fin.val hv + omega + · apply Fin.ext + omega + +private noncomputable abbrev helperS253.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + (G : LooplessMultigraph V E) → + (e0 : E) → + (T : TreeSequence G e0) → + (2 : ℕ) < TashTreePathIndex G T → + TashTreePathIndex G T = T.length → + (r : Fin T.length) → + (p j : Fin (T.length + (1 : ℕ))) → + (hr : (↑r : ℕ) + (1 : ℕ) = T.length) → + (hp : (↑p : ℕ) + (1 : ℕ) = T.length) → + (↑j : ℕ) + (2 : ℕ) ≤ T.length → + (hrval : (↑r : ℕ) = T.length - (1 : ℕ)) → + (hrlast : + r = + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length)) → + (∃ (i : Fin (T.length - (1 : ℕ))), + G.ends + (T.edge + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length)) = + s(T.vertex (Fin.last T.length), + T.vertex + (i.castLT + (by + have := GoldbergSeymour.TreeSequence.positive T + omega)))) → + let _ : Fin (T.length - (1 : ℕ) + (1 : ℕ)) → V := + fun (i : Fin (T.length - (1 : ℕ) + (1 : ℕ))) ↦ + if hi : (↑i : ℕ) < T.length - (1 : ℕ) then + T.vertex + (⟨(↑i : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (T.length + (1 : ℕ))) + else T.vertex (Fin.last T.length); + let _ : Fin (T.length - (1 : ℕ)) → E := + fun (i : Fin (T.length - (1 : ℕ))) ↦ + if _ : (↑i : ℕ) < T.length - (2 : ℕ) then + T.edge + (⟨(↑i : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length) + else + T.edge + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin T.length); + TreeSequence G e0 := by + classical + intro V E G e0 T hq hlast r p j hr hp hj hrval hrlast hattachLast svertex sedge + exact { + length := T.length - 1 + positive := by omega + vertex := svertex + edge := sedge + vertex_injective := by + exact @helper_vertex_injective_159 (@V) (@E) (@G) (@e0) (@T) (@r) (@p) (@j) (@hr) (@hp) + (@hrval) (@hrlast) + edge_injective := by + exact @helper_edge_injective_182 (@V) (@E) (@G) (@e0) (@T) (@hq) (@hlast) (@r) (@p) (@j) + (@hr) (@hp) (@hrval) (@hrlast) + first_edge := by + have hh : 0 < T.length - 2 := by omega + simp [sedge, hh, T.first_edge] + attaches := by + intro j + by_cases hj : j.val < T.length - 2 + · let jj : Fin T.length := ⟨j.val, by omega⟩ + rcases T.attaches jj with ⟨i, hi⟩ + let ii : Fin (j.val + 1) := ⟨i.val, by simp [jj]⟩ + refine ⟨ii, ?_⟩ + have hjv : j.val + 1 < T.length - 1 := by omega + have hiiv : ii.val < T.length - 1 := by dsimp [ii]; omega + have hjj : jj = ⟨j.val, by omega⟩ := rfl + simp only [sedge, dite_eq_left hj] + change G.ends (T.edge ⟨j.val, by omega⟩) = _ + rw [show svertex j.succ = T.vertex jj.succ by + simp [svertex, hjv]; congr 1] + rw [show svertex (Fin.castLT ii (by omega)) = T.vertex (i.castLT (by omega)) by + simp [svertex, hiiv]; congr 1] + rw [hi] + · rcases hattachLast with ⟨i, hi⟩ + let ii : Fin (j.val + 1) := ⟨i.val, by omega⟩ + refine ⟨ii, ?_⟩ + have hjv : j.val + 1 = T.length - 1 := by omega + have hiiv : ii.val < T.length - 1 := by dsimp [ii]; omega + rw [show sedge j = T.edge ⟨T.length - 1, by omega⟩ by simp [sedge, hj]] + rw [show svertex j.succ = T.vertex (Fin.last T.length) by + simp [svertex, hjv]] + rw [show svertex (Fin.castLT ii (by omega)) = T.vertex (i.castLT (by omega)) by + simp [svertex, hiiv]; congr 1] + exact hi } + +theorem TashTreeLastIndexDeletion {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hlast : TashTreePathIndex G T = T.length) + (gamma beta : Fin k) (r : Fin T.length) (p j : Fin (T.length + 1)) + (hr : r.val + 1 = T.length) (hp : p.val + 1 = T.length) + (hj : j.val + 2 ≤ T.length) + (hrgamma : phi (T.edge r) = some gamma) + (hpgamma : gamma ∈ PresentColors G phi (T.vertex p)) + (hbj : beta ∈ MissingColors G phi (T.vertex j)) + (hblast : beta ∈ MissingColors G phi (T.vertex (Fin.last T.length))) : + ∃ (P S : TreeSequence G e0) (s : Fin S.length), + P.length + 2 = T.length ∧ + TreeSequenceInitialSegment P T ∧ + S.length = P.length + 1 ∧ + TreeSequenceInitialSegment P S ∧ + s.val + 1 = S.length ∧ + S.edge s = T.edge r ∧ + S.vertex (Fin.last S.length) = T.vertex (Fin.last T.length) ∧ + TashTreeBadPair G k e0 phi S ∧ + TashTreeRankLess G S T := by + classical + open scoped Sym2 in + have hlen : 3 ≤ T.length := by omega + have hqspec : TashTreeSuffixPath G T (TashTreePathIndex G T) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + have hindex : TashTreePathIndex G T = T.length := hlast + have hnotlast : ∀ i : Fin T.length, i.val ≠ T.length - 1 → + i.val < T.length - 1 := by + intro i hi + omega + have hrval : r.val = T.length - 1 := by omega + have hrlast : r = ⟨T.length - 1, by omega⟩ := Fin.ext hrval + let P : TreeSequence G e0 := by + exact { + length := T.length - 2 + positive := by omega + vertex := fun i => T.vertex ⟨i.val, by omega⟩ + edge := fun i => T.edge ⟨i.val, by omega⟩ + vertex_injective := by + intro a b hab + apply Fin.ext + simpa using congrArg Fin.val (T.vertex_injective hab) + edge_injective := by + intro a b hab + apply Fin.ext + simpa using congrArg Fin.val (T.edge_injective hab) + first_edge := by + rw [T.first_edge] + attaches := by + intro j + let jj : Fin T.length := ⟨j.val, by omega⟩ + rcases T.attaches jj with ⟨i, hi⟩ + let ii : Fin (j.val + 1) := ⟨i.val, by simp [jj]⟩ + refine ⟨ii, ?_⟩ + rw [hi] + apply congrArg₂ Sym2.mk + · congr 1 + · congr 1 } + have hattachLast := @helper_hattachLast_95 (@V) (@E) (@G) (@e0) (@T) (@hq) (@hlast) (@r) (@p) (@j) + (@hr) (@hp) (@hrval) (@hrlast) + let svertex : Fin (T.length - 1 + 1) → V := fun i => + if hi : i.val < T.length - 1 then T.vertex ⟨i.val, by omega⟩ + else T.vertex (Fin.last T.length) + let sedge : Fin (T.length - 1) → E := fun i => + if hi : i.val < T.length - 2 then T.edge ⟨i.val, by omega⟩ + else T.edge ⟨T.length - 1, by omega⟩ + let S := @helperS253 (@V) (@E) (@G) (@e0) (@T) (@hq) (@hlast) (@r) (@p) (@j) (@hr) (@hp) (@hj) + (@hrval) (@hrlast) (@hattachLast) + have hPprefix : TreeSequenceInitialSegment P T := by + refine ⟨by dsimp [P]; omega, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have hPSegment : TreeSequenceInitialSegment P S := by + refine ⟨by dsimp [P, S]; omega, ?_, ?_⟩ + · intro i + dsimp [P, S, svertex, sedge] + have hi' : i.val < P.length + 1 := i.isLt + have hi : i.val < T.length - 1 := by + dsimp [P] at hi' + omega + simp [hi] + · intro i + dsimp [P, S, svertex, sedge] + have hi' : i.val < P.length := i.isLt + have hi : i.val < T.length - 2 := by + dsimp [P] at hi' + omega + simp [hi] + have hTashS : TashkinovTree G e0 phi S := by + intro q hqpos + by_cases hqold : q.val < T.length - 2 + · have hT := hmin.1.2.1 ⟨q.val, by omega⟩ hqpos + rcases hT with ⟨i, c, hc, hm⟩ + let u : Fin (q.val + 1) := ⟨i.val, by simp⟩ + refine ⟨u, c, ?_, ?_⟩ + · have heq : sedge q = T.edge ⟨q.val, by omega⟩ := by simp [sedge, hqold] + change phi (sedge q) = some c + rw [heq] + simpa using hc + · have hiq : i.val < q.val + 1 := i.isLt + have hiold : q.val < T.length - 2 := hqold + have hi : i.val < T.length - 1 := by omega + have hvi : S.vertex (Fin.castLT u (by omega)) = + T.vertex (i.castLT (by omega)) := by + dsimp [S, u] + simp only [hi, ↓reduceDIte] + apply congrArg T.vertex + apply Fin.ext + rfl + change c ∈ MissingColors G phi + (S.vertex (Fin.castLT u (by omega))) + rw [hvi] + exact hm + · have hqb : q.val < T.length - 1 := by + have hh := q.isLt + dsimp [S] at hh + exact hh + have hqval : q.val = T.length - 2 := by omega + have hT := hmin.1.2.1 ⟨T.length - 1, by omega⟩ (by omega) + rcases hT with ⟨i, c, hc, hm⟩ + have hcg : c = gamma := by + apply Option.some.inj + exact hc.symm.trans (hrlast ▸ hrgamma) + subst c + have hilast : i.val ≠ T.length - 1 := by + intro hi + have hii : T.vertex (Fin.castLT i (by omega)) = T.vertex p := by + apply congrArg T.vertex + apply Fin.ext + have := hi + have hpval : p.val = T.length - 1 := by omega + simpa [hpval] using this + have hmiss : gamma ∉ PresentColors G phi (T.vertex p) := by + rw [← hii] + simpa [MissingColors] using hm + exact hmiss (hii ▸ hpgamma) + let u : Fin (q.val + 1) := ⟨i.val, by omega⟩ + refine ⟨u, gamma, ?_, ?_⟩ + · have heq : sedge q = T.edge ⟨T.length - 1, by omega⟩ := by + simp [sedge, hqval] + change phi (sedge q) = some gamma + rw [heq] + exact hc + · have hiil : i.val < T.length - 1 := by omega + have hvi : S.vertex (Fin.castLT u (by omega)) = + T.vertex (i.castLT (by omega)) := by + dsimp [S, u] + simp only [hiil, ↓reduceDIte] + apply congrArg T.vertex + apply Fin.ext + rfl + change gamma ∈ MissingColors G phi + (S.vertex (Fin.castLT u (by omega))) + rw [hvi] + exact hm + have hnotElem : ¬ ColoredVertexSetElementary G phi (TreeSequenceVertexSet S) := by + intro he + have hjmem : T.vertex ⟨j.val, by omega⟩ ∈ TreeSequenceVertexSet S := by + rw [TreeSequenceVertexSet] + have hjS : j.val < S.length + 1 := by + dsimp [S] + omega + refine Finset.mem_image.mpr ⟨⟨j.val, hjS⟩, Finset.mem_univ _, ?_⟩ + have hvj : svertex ⟨j.val, by omega⟩ = T.vertex ⟨j.val, by omega⟩ := by + simp [svertex, show j.val < T.length - 1 by omega] + exact hvj + have hlmem : T.vertex (Fin.last T.length) ∈ TreeSequenceVertexSet S := by + rw [TreeSequenceVertexSet] + have hlastS : T.length - 1 < S.length + 1 := by + dsimp [S] + omega + refine Finset.mem_image.mpr ⟨⟨T.length - 1, hlastS⟩, Finset.mem_univ _, ?_⟩ + simp [S] + have hvne : T.vertex ⟨j.val, by omega⟩ ≠ T.vertex (Fin.last T.length) := by + intro hh + have hv := T.vertex_injective hh + have hval : j.val = T.length := by + simpa using congrArg Fin.val hv + omega + have hd := he hjmem hlmem hvne + rw [Finset.disjoint_left] at hd + exact hd (by simpa using hbj) (by simpa using hblast) + have hbadS : TashTreeBadPair G k e0 phi S := + ⟨hmin.1.1, hTashS, hnotElem⟩ + have hindexS : TashTreePathIndex G S ≤ S.length := by + have hs := (show TashTreeSuffixPath G S (TashTreePathIndex G S) by + unfold TashTreePathIndex + exact Nat.find_spec _) + exact hs.2.1 + have hrank : TashTreeRankLess G S T := by + left + rw [hlast] + have hslt : S.length < T.length := by dsimp [S]; omega + exact lt_of_le_of_lt hindexS hslt + have hsindex : T.length - 2 < S.length := by + dsimp [S] + omega + refine ⟨P, S, ⟨T.length - 2, hsindex⟩, ?_⟩ + refine ⟨by dsimp [P]; omega, hPprefix, by dsimp [P, S]; omega, + hPSegment, ?_, ?_, ?_, hbadS, hrank⟩ + · dsimp [S] + omega + · simp [S, hrlast] + · simp [S] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeLastIndexFirstNormalForm.lean b/LeanPool/GoldbergSeymour/TashTreeLastIndexFirstNormalForm.lean new file mode 100644 index 0000000000..ceeb8f032b --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeLastIndexFirstNormalForm.lean @@ -0,0 +1,776 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange +public import LeanPool.GoldbergSeymour.TashTreeDisjointComponentNormalization +public import LeanPool.GoldbergSeymour.TashTreeFourUnusedColors +public import LeanPool.GoldbergSeymour.TashTreeLastIndexIntersectionShortening +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreePathIndex +public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary +public import LeanPool.GoldbergSeymour.TashTreeSuffixPath +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# Tash Tree Last Index First Normal Form + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hedges_224.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 + : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0), (2 : ℕ) < TashTreePathIndex + G T → TashTreePathIndex G T = T.length → + ∀ (beta : Fin k) (_ _ : Fin (T.length + (1 : ℕ))) (alpha : Fin k) (_ : Fin (T.length + (1 : + ℕ))), + let C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl (T.vertex (Fin.last + T.length))); ( + ∀ (q : Fin (T.length + (1 : ℕ))), (↑q : ℕ) ≤ T.length - (2 : ℕ) → Sum.inl (T.vertex q) ∉ C) → + ∀ (r : Fin T.length), (↑r : ℕ) < T.length - (2 : ℕ) → Sum.inr (T.edge r) ∉ C := by + classical + intro V E _ _ G k e0 phi T hq hlast beta i j alpha m C hvertices r hr heC + let := Fintype.ofFinite V + let := Fintype.ofFinite E + rcases T.attaches r with ⟨i, hi⟩ + let q : Fin (T.length + 1) := ⟨i.val, by omega⟩ + have hinc : Incident G (T.vertex q) (T.edge r) := by + have hqeq : q = Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ r.isLt)) := Fin.ext (by rfl) + rw [hqeq] + rw [Incident, hi] + simp + by_cases hcol : phi (T.edge r) = some alpha ∨ + phi (T.edge r) = some beta + · have hvC : Sum.inl (T.vertex q) ∈ C := by + change Sum.inl (T.vertex q) ∈ + ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl (T.vertex (Fin.last T.length)))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have hadj : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inl (T.vertex q)) (Sum.inr (T.edge r)) := by + simp [TwoColorIncidenceGraph, hinc, hcol, q] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans heC + exact hvertices q (by dsimp [q]; omega) hvC + · let H := TwoColorIncidenceGraph G phi alpha beta + have hno : ∀ x, H.Reachable (Sum.inr (T.edge r)) x → + x = Sum.inr (T.edge r) := by + intro x hx + rw [H.reachable_iff_reflTransGen] at hx + induction hx with + | refl => rfl + | tail h ha ih => + subst ih + rename_i c + cases c <;> simp [H, TwoColorIncidenceGraph, hcol] at ha + have hrch : H.Reachable (Sum.inr (T.edge r)) + (Sum.inl (T.vertex (Fin.last T.length))) := by + apply SimpleGraph.ConnectedComponent.eq.mp + exact heC + have heq := hno _ hrch + cases heq + +private theorem helper_branch_294.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length) (beta : Fin k) (_ : Fin + (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)) → + ∀ (_ : Fin (T.length + (1 : ℕ))), + let r₁ : Fin T.length := (⟨T.length - (2 : ℕ), + by omega + ⟩ : Fin T.length); + let r₂ : Fin T.length := (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin T.length); + let d₁ : Fin k := (phi (T.edge r₁)).getD beta; + let d₂ : Fin k := (phi (T.edge r₂)).getD beta; + ∀ (alpha : Fin k), alpha ≠ beta → alpha ≠ d₁ → alpha ≠ d₂ → + ∀ (_ : Fin (T.length + (1 : ℕ))), + let C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl (T.vertex (Fin.last + T.length))); ( + ∀ (q : Fin (T.length + (1 : ℕ))), (↑q : ℕ) ≤ T.length - (2 : ℕ) → Sum.inl (T.vertex q) ∉ C) → + ∀ (r : Fin T.length), (1 : ℕ) ≤ (↑r : ℕ) → TwoColorComponentSwap G phi alpha beta (Sum.inl + (T.vertex (Fin.last T.length))) (T.edge r) = some alpha → ¬(↑r : ℕ) < T.length - (2 : ℕ) → + False := by + classical + intro V E _ _ G k e0 phi T hq hlast beta i hbetaLast j r₁ r₂ d₁ d₂ alpha hab had₁ had₂ m C + hvertices r hr he hsmall + let _ := Fintype.ofFinite V + have hrlarge : T.length - 2 ≤ r.val := by omega + by_cases hrone : r.val = T.length - 2 + · have hre : r = r₁ := Fin.ext (by simpa [r₁] using hrone) + subst r + have hphiAlpha : phi (T.edge r₁) ≠ some alpha := by + intro hh + apply had₁ + simp [d₁, hh] + have hout : Sum.inr (T.edge r₁) ∉ C := by + rcases T.attaches r₁ with ⟨i, hi⟩ + let q : Fin (T.length + 1) := ⟨i.val, by omega⟩ + have hinc : Incident G (T.vertex q) (T.edge r₁) := by + have hqeq : q = Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ r₁.isLt)) := Fin.ext (by rfl) + rw [hqeq, Incident, hi] + simp + by_cases hcol : phi (T.edge r₁) = some alpha ∨ + phi (T.edge r₁) = some beta + · intro hec + have hvC : Sum.inl (T.vertex q) ∈ C := by + change Sum.inl (T.vertex q) ∈ + ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl (T.vertex (Fin.last T.length)))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have hadj : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inl (T.vertex q)) (Sum.inr (T.edge r₁)) := by + simp [TwoColorIncidenceGraph, hinc, hcol, q] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans hec + exact hvertices q (by dsimp [q]; omega) hvC + · intro hec + let H := TwoColorIncidenceGraph G phi alpha beta + have hno : ∀ x, H.Reachable (Sum.inr (T.edge r₁)) x → + x = Sum.inr (T.edge r₁) := by + intro x hx + rw [H.reachable_iff_reflTransGen] at hx + induction hx with + | refl => rfl + | tail h ha ih => + subst ih + rename_i c + cases c <;> simp [H, TwoColorIncidenceGraph, hcol] at ha + have hrch : H.Reachable (Sum.inr (T.edge r₁)) + (Sum.inl (T.vertex (Fin.last T.length))) := by + apply SimpleGraph.ConnectedComponent.eq.mp + exact hec + have heq := hno _ hrch + cases heq + by_cases hc : Sum.inr (T.edge r₁) ∈ C + · exact hout hc + · simp only [TwoColorComponentSwap, hc, ↓reduceIte, C] at he + exact hphiAlpha he + · have hrlt : r.val < T.length := r.isLt + have hre : r = r₂ := by + apply Fin.ext + have hrge : T.length - 2 ≤ r.val := hrlarge + have hrstrict : T.length - 2 < r.val := + Nat.lt_of_le_of_ne hrge (Ne.symm hrone) + dsimp [r₂] + omega + subst r + have hphiAlpha : phi (T.edge r₂) ≠ some alpha := by + intro hh + apply had₂ + simp [d₂, hh] + have hphiBeta : phi (T.edge r₂) ≠ some beta := by + intro hh + rcases T.attaches r₂ with ⟨i, hi⟩ + have hs : r₂.succ = Fin.last T.length := by + apply Fin.ext + dsimp [r₂] + omega + have hinc : Incident G (T.vertex (Fin.last T.length)) (T.edge r₂) := by + rw [Incident, hi] + simp [hs] + have hp : beta ∉ PresentColors G phi (T.vertex (Fin.last T.length)) := by + simpa [MissingColors] using hbetaLast + apply hp + rw [PresentColors] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, T.edge r₂, hinc, hh⟩ + by_cases hc : Sum.inr (T.edge r₂) ∈ C + · simp [C, TwoColorComponentSwap, hc, hphiAlpha, hphiBeta] at he + · simp only [TwoColorComponentSwap, hc, ↓reduceIte, C] at he + exact hphiAlpha he + +private theorem helper_hlastOutside_444.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), TashTreeMinimumBadPair G k e0 phi T → + ∀ (hq : (2 : ℕ) < TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length) (beta : + Fin k) (j_1 : Fin (T.length + (1 : ℕ))), T.vertex j_1 ∈ TreeSequenceVertexSet T → beta ∈ + MissingColors G phi (T.vertex (Fin.last T.length)) → + ∀ (j : Fin (T.length + (1 : ℕ))) (hj : (↑j : ℕ) < T.length), + let r₁ : Fin T.length := (⟨T.length - (2 : ℕ), + by omega + ⟩ : Fin T.length); + let r₂ : Fin T.length := (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin T.length); + let d₁ : Fin k := (phi (T.edge r₁)).getD beta; + let d₂ : Fin k := (phi (T.edge r₂)).getD beta; + ∀ (alpha : Fin k), alpha ≠ beta → alpha ≠ d₁ → alpha ≠ d₂ → + ∀ (m : Fin (T.length + (1 : ℕ))), (↑m : ℕ) ≤ T.length - (2 : ℕ) → + ∀ (hj2 : ¬(↑j : ℕ) + (2 : ℕ) ≤ T.length) (hjlast : (↑j : ℕ) = T.length - (1 : ℕ)), + let pen : Fin (T.length + (1 : ℕ)) := (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))); (↑m : ℕ) < (↑pen : ℕ) → TwoColorPathComponent G phi alpha beta + (Sum.inl (T.vertex pen)) ∧ Sum.inl (T.vertex (⟨(↑m : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) ∈ TwoColorComponent G phi alpha beta (Sum.inl (T.vertex pen)) ∧ + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet (Sum.inl (T.vertex (⟨(↑m : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))).Subsingleton ∧ ((TwoColorIncidenceGraph G phi alpha + beta).neighborSet (Sum.inl (T.vertex pen))).Subsingleton ∧ beta ∈ MissingColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex pen))) (T.vertex (⟨(↑m : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) ∧ alpha ∈ MissingColors G (TwoColorComponentSwap G phi alpha + beta (Sum.inl (T.vertex pen))) (T.vertex pen) ∧ ( + ∀ (r : Fin T.length), (1 : ℕ) ≤ (↑r : ℕ) → (↑r : ℕ) < (↑pen : ℕ) → TwoColorComponentSwap G phi + alpha beta (Sum.inl (T.vertex pen)) (T.edge r) = phi (T.edge r)) ∧ ( + ∀ (r : Fin T.length), (↑pen : ℕ) ≤ (↑r : ℕ) → + ∀ (w : Fin ((↑r : ℕ) + (1 : ℕ))) (c : Fin k), phi (T.edge r) = some c → c ∈ MissingColors G + phi (T.vertex (w.castLT ( + by omega + ))) → + ∃ (w' : Fin ((↑r : ℕ) + (1 : ℕ))) (c' : Fin k), TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex pen)) (T.edge r) = some c' ∧ c' ∈ MissingColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex pen))) (T.vertex (w'.castLT ( + by omega + )))) ∧ TashTreeMinimumBadPair G k e0 (TwoColorComponentSwap G phi alpha beta (Sum.inl + (T.vertex pen))) T → Sum.inl (T.vertex (Fin.last T.length)) ∉ TwoColorComponent G phi + alpha beta (Sum.inl (T.vertex pen)) := by + classical + intro V E _ _ _ G k e0 phi T hmin hq hlast beta _ hv hbetaLast j hj r₁ r₂ d₁ d₂ alpha hab had₁ + had₂ m hm hj2 hjlast pen hm_lt_pen hswap hin + obtain ⟨a, b, path, hpath, hsupport⟩ := + TwoColorComponentSpanningPath G phi alpha beta + hmin.1.1.2.2.2.1 (Sum.inl (T.vertex pen)) + have hsupp {x : Sum V E} (hx : x ∈ + TwoColorComponent G phi alpha beta (Sum.inl (T.vertex pen))) : + x ∈ path.support := by + change x ∈ {y | y ∈ path.support} + rw [hsupport] + exact hx + have hend {x : Sum V E} (hx : x ∈ + TwoColorComponent G phi alpha beta (Sum.inl (T.vertex pen))) + (hd : Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet x)) : + x = a ∨ x = b := by + by_contra hn + push Not at hn + exact (hpath.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hd) (hsupp hx) + have hdeg : Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))) := by + let : Fintype ((TwoColorIncidenceGraph G phi beta alpha).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))) := Fintype.ofFinite _ + have hd := MissingColorIncidenceEndpoint G phi beta alpha hab.symm + hmin.1.1.2.2.2.1 (T.vertex (Fin.last T.length)) hbetaLast + intro x hx y hy + have hx' := (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi beta alpha) + (Sum.inl (T.vertex (Fin.last T.length))) x).2 + (by simpa [TwoColorIncidenceGraph, or_comm] using hx) + have hy' := (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi beta alpha) + (Sum.inl (T.vertex (Fin.last T.length))) y).2 + (by simpa [TwoColorIncidenceGraph, or_comm] using hy) + exact (Finset.card_le_one.mp (by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hd)) x hx' y hy' + have hmEnd := hend hswap.2.1 hswap.2.2.1 + have hpEnd := hend (by + change Sum.inl (T.vertex pen) ∈ + ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl (T.vertex pen))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff]) hswap.2.2.2.1 + have hmLast : (Sum.inl (T.vertex ⟨m.val, by omega⟩) : Sum V E) ≠ + Sum.inl (T.vertex (Fin.last T.length)) := by + intro hh + have hv : T.vertex ⟨m.val, by omega⟩ = T.vertex (Fin.last T.length) := by + simpa using hh + have hvv := congrArg Fin.val (T.vertex_injective hv) + dsimp at hvv + have hmval : m.val ≤ T.length - 2 := hm + have hmindex : (⟨m.val, by omega⟩ : Fin (T.length + 1)).val = m.val := rfl + have hmlast : (Fin.last T.length).val = T.length := rfl + omega + have hpLast : (Sum.inl (T.vertex pen) : Sum V E) ≠ + Sum.inl (T.vertex (Fin.last T.length)) := by + intro hh + have hv : T.vertex pen = T.vertex (Fin.last T.length) := by simpa using hh + have hvv := congrArg Fin.val (T.vertex_injective hv) + dsimp [pen] at hvv + omega + have hmPen : (Sum.inl (T.vertex ⟨m.val, by omega⟩) : Sum V E) ≠ + Sum.inl (T.vertex pen) := by + intro hh + have hv : T.vertex ⟨m.val, by omega⟩ = T.vertex pen := by simpa using hh + have hvv := congrArg Fin.val (T.vertex_injective hv) + dsimp [pen] at hvv + omega + have endpoint {x : Sum V E} (hx : x = a ∨ x = b) : + x = Sum.inl (T.vertex ⟨m.val, by omega⟩) ∨ + x = Sum.inl (T.vertex pen) := by + rcases hmEnd with hma | hmb <;> rcases hpEnd with hpa | hpb + · exact False.elim (hmPen (hma.trans hpa.symm)) + · rcases hx with hxa | hxb + · exact Or.inl (hxa.trans hma.symm) + · exact Or.inr (hxb.trans hpb.symm) + · rcases hx with hxa | hxb + · exact Or.inr (hxa.trans hpa.symm) + · exact Or.inl (hxb.trans hmb.symm) + · exact False.elim (hmPen (hmb.trans hpb.symm)) + rcases endpoint (hend hin hdeg) with hml | hpl + · exact hmLast hml.symm + · exact hpLast hpl.symm + +private theorem helper_hbetaLast_421.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length), + let P1 : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by omega + ) ( + by omega + ); P1.length = T.length - (1 : ℕ) → ColoredVertexSetElementary G phi (TreeSequenceVertexSet + P1) → + ∀ (beta : Fin k) (i : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex i) → + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → T.vertex i ≠ + T.vertex j → beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)) := by + classical + intro V E _ _ G k e0 phi T hq hlast P1 hP1len hP1elem beta i hbu j hbv huv + let _ := Fintype.ofFinite V + have hil : i.val ≤ T.length := Nat.le_of_lt_succ i.isLt + have hjl : j.val ≤ T.length := Nat.le_of_lt_succ j.isLt + by_cases hi : i.val = T.length + · have hi' : i = Fin.last T.length := Fin.ext (by simpa using hi) + simpa [hi'] using hbu + · by_cases hj : j.val = T.length + · have hj' : j = Fin.last T.length := Fin.ext (by simpa using hj) + simpa [hj'] using hbv + · exfalso + have hiP1 : T.vertex i ∈ TreeSequenceVertexSet P1 := by + rw [TreeSequenceVertexSet] + let ip : Fin (P1.length + 1) := ⟨i.val, by rw [hP1len]; omega⟩ + refine Finset.mem_image.mpr ⟨ip, Finset.mem_univ _, ?_⟩ + rfl + have hjP1 : T.vertex j ∈ TreeSequenceVertexSet P1 := by + rw [TreeSequenceVertexSet] + let jp : Fin (P1.length + 1) := ⟨j.val, by rw [hP1len]; omega⟩ + refine Finset.mem_image.mpr ⟨jp, Finset.mem_univ _, ?_⟩ + rfl + have hd := hP1elem hiP1 hjP1 huv + exact (Finset.disjoint_left.mp hd) hbu hbv + +private theorem helper_branch_495.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), TashTreeMinimumBadPair G k e0 phi T → + ∀ (hq : (2 : ℕ) < TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length), + let P : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) ( + by omega + ) ( + by omega + ); P.length = T.length - (2 : ℕ) → + ∀ (beta : Fin k) (_ : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex + (Fin.last T.length)) → + ∀ (j : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex j) → + let r₁ : Fin T.length := (⟨T.length - (2 : ℕ), + by omega + ⟩ : Fin T.length); + let r₂ : Fin T.length := (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin T.length); + let d₁ : Fin k := (phi (T.edge r₁)).getD beta; + let d₂ : Fin k := (phi (T.edge r₂)).getD beta; + ∀ alpha ∈ TreeFreeColors phi P, alpha ≠ beta → alpha ≠ d₁ → alpha ≠ d₂ → + ∀ (m : Fin (T.length + (1 : ℕ))), (↑m : ℕ) ≤ T.length - (2 : ℕ) → alpha ∈ MissingColors G phi + (T.vertex m) → (↑j : ℕ) + (2 : ℕ) ≤ T.length → + ∃ (phi₁ : PartialEdgeColoring E k) (beta : Fin k) (j : Fin (T.length + (1 : ℕ))), + TashTreeMinimumBadPair G k e0 phi₁ T ∧ (↑j : ℕ) + (2 : ℕ) ≤ T.length ∧ beta ∈ + MissingColors G phi₁ (T.vertex j) ∧ beta ∈ MissingColors G phi₁ (T.vertex (Fin.last + T.length)) ∧ beta ∉ TreeUsedColors phi₁ T := by + classical + intro V E _ _ _ G k e0 phi T hmin hq hlast P hPlen beta i hbetaLast j hbj r₁ r₂ d₁ d₂ alpha + halphaFree hab had₁ had₂ m hm ham hj2 + have hbetaTree : beta ∈ TreeMissingColors phi P := by + rw [TreeMissingColors] + apply Finset.mem_biUnion.mpr + refine ⟨T.vertex j, ?_, hbj⟩ + rw [TreeSequenceVertexSet] + let jp : Fin (P.length + 1) := ⟨j.val, by rw [hPlen]; omega⟩ + exact Finset.mem_image.mpr ⟨jp, Finset.mem_univ _, rfl⟩ + have hprefix : TreeSequenceInitialSegment P T := by + refine ⟨by rw [hPlen]; omega, ?_, ?_⟩ + · intro x + rfl + · intro x + rfl + have hlastOutside : T.vertex (Fin.last T.length) ∉ TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + intro hh + rcases Finset.mem_image.mp hh with ⟨x, -, hx⟩ + have hxv : x.val ≤ T.length - 2 := by rw [hPlen] at x; omega + have heq : x.val = T.length := by + apply T.vertex_injective at hx + simpa [Fin.castLE] using congrArg Fin.val hx + omega + let C := TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) + have hvertices : ∀ q : Fin (T.length + 1), q.val ≤ T.length - 2 → + Sum.inl (T.vertex q) ∉ C := by + intro q hqv hqC + have hmeet : ∃ u ∈ TreeSequenceVertexSet P, + Sum.inl u ∈ TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length))) := by + refine ⟨T.vertex q, ?_, ?_⟩ + · rw [TreeSequenceVertexSet] + let qq : Fin (P.length + 1) := ⟨q.val, by rw [hPlen]; omega⟩ + exact Finset.mem_image.mpr ⟨qq, Finset.mem_univ _, rfl⟩ + · exact hqC + have hAlphaTree : alpha ∈ TreeMissingColors phi P := by + rw [TreeFreeColors] at halphaFree + exact (Finset.mem_sdiff.mp halphaFree).1 + have hfalse := TashTreeLastIndexIntersectionShortening G k e0 phi T P + hmin hlast hprefix (by rw [hPlen]; omega) alpha beta hab + hAlphaTree hbetaTree hbetaLast + hlastOutside hmeet + exact hfalse.elim + have hedges := @helper_hedges_224 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) + (@T) (@hq) (@hlast) (@beta) (@i) (@j) (@alpha) (@m) (@hvertices) + let p : Fin (T.length + 1) := ⟨T.length - 2, by omega⟩ + have hnorm := TashTreeDisjointComponentNormalization G k e0 phi T hmin + p m j (by dsimp [p]; omega) (by dsimp [p]; exact hm) + (by dsimp [p]; omega) alpha beta hab ham hbj hbetaLast hvertices hedges + dsimp only at hnorm + refine ⟨TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length))), alpha, m, ?_, ?_, ?_, ?_, ?_⟩ + · exact hnorm.1 + · omega + · exact hnorm.2.2.1 + · exact hnorm.2.2.2 + · intro hused + rw [TreeUsedColors] at hused + rcases Finset.mem_filter.mp hused with ⟨-, ⟨r, hr, he⟩⟩ + by_cases hsmall : r.val < T.length - 2 + · have hfix := hnorm.2.1 r hsmall + have hnot : phi (T.edge r) ≠ some alpha := by + intro heq + have hnotP : alpha ∉ TreeUsedColors phi P := + (Finset.mem_sdiff.mp (by simpa [TreeFreeColors] using halphaFree)).2 + apply hnotP + rw [TreeUsedColors] + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + refine ⟨⟨r.val, by rw [hPlen]; omega⟩, ?_, ?_⟩ + · omega + · change phi (T.edge r) = some alpha + exact heq + exact hnot (hfix ▸ he) + · exact @helper_branch_294 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + (@hq) (@hlast) (@beta) (@i) (@hbetaLast) (@j) (@alpha) (@hab) (@had₁) (@had₂) (@m) + (@hvertices) (@r) (@hr) (@he) (@hsmall) + +private theorem helper_branch_571.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), TashTreeMinimumBadPair G k e0 phi T → + ∀ (hq : (2 : ℕ) < TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length), + let P : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) ( + by omega + ) ( + by omega + ); P.length = T.length - (2 : ℕ) → + let P1 : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by omega + ) ( + by omega + ); P1.length = T.length - (1 : ℕ) → ColoredVertexSetElementary G phi (TreeSequenceVertexSet + P1) → + ∀ (beta : Fin k) (_ j_1 : Fin (T.length + (1 : ℕ))), T.vertex j_1 ∈ TreeSequenceVertexSet T → + beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)) → + ∀ (j : Fin (T.length + (1 : ℕ))), (↑j : ℕ) < T.length → beta ∈ MissingColors G phi (T.vertex + j) → + let r₁ : Fin T.length := (⟨T.length - (2 : ℕ), + by omega + ⟩ : Fin T.length); + let r₂ : Fin T.length := (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin T.length); + let d₁ : Fin k := (phi (T.edge r₁)).getD beta; + let d₂ : Fin k := (phi (T.edge r₂)).getD beta; + ∀ alpha ∈ TreeFreeColors phi P, alpha ≠ beta → alpha ≠ d₁ → alpha ≠ d₂ → + ∀ (m : Fin (T.length + (1 : ℕ))), (↑m : ℕ) ≤ T.length - (2 : ℕ) → alpha ∈ MissingColors G phi + (T.vertex m) → ¬(↑j : ℕ) + (2 : ℕ) ≤ T.length → + ∃ (phi₁ : PartialEdgeColoring E k) (beta : Fin k) (j : Fin (T.length + (1 : ℕ))), + TashTreeMinimumBadPair G k e0 phi₁ T ∧ (↑j : ℕ) + (2 : ℕ) ≤ T.length ∧ beta ∈ + MissingColors G phi₁ (T.vertex j) ∧ beta ∈ MissingColors G phi₁ (T.vertex (Fin.last + T.length)) ∧ beta ∉ TreeUsedColors phi₁ T := by + classical + intro V E _ _ _ G k e0 phi T hmin hq hlast P hPlen P1 hP1len hP1elem beta i _ hv hbetaLast j hj + hbj r₁ r₂ d₁ d₂ alpha halphaFree hab had₁ had₂ m hm ham hj2 + have hjlast : j.val = T.length - 1 := by omega + let pen : Fin (T.length + 1) := ⟨T.length - 1, by omega⟩ + have hbjpen : beta ∈ MissingColors G phi (T.vertex pen) := by + have hjEq : j = pen := by + apply Fin.ext + dsimp [pen] + exact hjlast + rw [← hjEq] + exact hbj + have hbetaUnused : TreeColorUnusedThrough phi T beta pen := by + intro s hs1 hslt hcolor + rcases hmin.1.2.1 s hs1 with ⟨i, c, hc, hmiss⟩ + have hcb : beta = c := by simpa [hcolor] using hc + subst c + have hsmem : T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ s.isLt))) ∈ + TreeSequenceVertexSet P1 := by + rw [TreeSequenceVertexSet] + refine Finset.mem_image.mpr ⟨⟨i.val, by rw [hP1len]; omega⟩, + Finset.mem_univ _, ?_⟩ + rfl + have hpmem : T.vertex pen ∈ TreeSequenceVertexSet P1 := by + rw [TreeSequenceVertexSet] + refine Finset.mem_image.mpr ⟨⟨T.length - 1, by rw [hP1len]; omega⟩, + Finset.mem_univ _, rfl⟩ + have hne : T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ s.isLt))) ≠ T.vertex pen := by + intro heq + have hv := T.vertex_injective heq + have hvv := congrArg Fin.val hv + dsimp [pen] at hvv + have his : i.val ≤ s.val := Nat.le_of_lt_succ i.isLt + have hiVal : (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ s.isLt))).val = i.val := rfl + omega + exact (Finset.disjoint_left.mp (hP1elem hsmem hpmem hne)) hmiss hbjpen + have halphaUnused : TreeColorUnusedThrough phi T alpha pen := by + intro s hs1 hslt hcolor + have hslt' : s.val < T.length - 1 := by simpa [pen] using hslt + by_cases hs : s.val = T.length - 2 + · have heq : s = r₁ := by + apply Fin.ext + dsimp [r₁] + exact hs + rw [heq] at hcolor + exact had₁ (by simp [d₁, hcolor]) + · have hslt2 : s.val < T.length - 2 := by omega + have hnotP : alpha ∉ TreeUsedColors phi P := + (Finset.mem_sdiff.mp (by simpa [TreeFreeColors] using halphaFree)).2 + apply hnotP + rw [TreeUsedColors] + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ⟨⟨s.val, by rw [hPlen]; omega⟩, ?_, ?_⟩⟩ + · exact hs1 + · change phi (T.edge s) = some alpha + exact hcolor + have hm_lt_pen : m.val < pen.val := by + dsimp [pen] + omega + have hswap := TashTreeControlledInterchange G k e0 phi T hmin + ⟨m, by omega⟩ pen hm_lt_pen (by dsimp [pen]; omega) + alpha beta hab ham hbjpen halphaUnused hbetaUnused + dsimp only at hswap + let phi' := TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex pen)) + have hmin' : TashTreeMinimumBadPair G k e0 phi' T := hswap.2.2.2.2.2.2.2.2 + have hlastOutside := @helper_hlastOutside_444 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@phi) (@T) (@hmin) (@hq) (@hlast) (@beta) _ (@hv) (@hbetaLast) (@j) (@hj) + (@alpha) (@hab) (@had₁) (@had₂) (@m) (@hm) (@hj2) (@hjlast) (@hm_lt_pen) (@hswap) + have hbetaLast' : beta ∈ MissingColors G phi' + (T.vertex (Fin.last T.length)) := by + have hm := TwoColorComponentSwapMissingBehavior G phi alpha beta hab + hmin.1.1.2.2.2.1 (Sum.inl (T.vertex pen)) + dsimp only at hm + exact (hm.1 _ hlastOutside) ▸ hbetaLast + have hpenAlpha : phi (T.edge r₂) ≠ some alpha := by + intro hh + apply had₂ + simp [d₂, hh] + have hpenBeta : phi (T.edge r₂) ≠ some beta := by + intro hh + rcases T.attaches r₂ with ⟨i, hi⟩ + have hs : r₂.succ = Fin.last T.length := by + apply Fin.ext + dsimp [r₂] + omega + have hinc : Incident G (T.vertex (Fin.last T.length)) (T.edge r₂) := by + rw [Incident, hi] + simp [hs] + have hp : beta ∉ PresentColors G phi (T.vertex (Fin.last T.length)) := by + simpa [MissingColors] using hbetaLast + apply hp + rw [PresentColors] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, T.edge r₂, hinc, hh⟩ + refine ⟨phi', beta, m, hmin', by omega, hswap.2.2.2.2.1, hbetaLast', ?_⟩ + intro hused + rw [TreeUsedColors] at hused + rcases Finset.mem_filter.mp hused with ⟨-, ⟨s, hs1, he⟩⟩ + have hslt : s.val < T.length - 1 := by + by_contra hn + have hsval : s.val = T.length - 1 := by omega + have hsEq : s = r₂ := by + apply Fin.ext + dsimp [r₂] + exact hsval + rw [hsEq] at he + have hold : phi (T.edge r₂) = some beta := by + simp [phi', TwoColorComponentSwap, hpenAlpha, hpenBeta] at he + exact hpenBeta hold + have hfix := hswap.2.2.2.2.2.2.1 s hs1 hslt + exact (by + change TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex pen)) + (T.edge s) = some beta at he + rw [hfix] at he + have : phi (T.edge s) = some beta := he + exact hbetaUnused s hs1 hslt this) + +theorem TashTreeLastIndexFirstNormalForm {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hlast : TashTreePathIndex G T = T.length) : + ∃ (phi₁ : PartialEdgeColoring E k) (beta : Fin k) (j : Fin (T.length + 1)), + TashTreeMinimumBadPair G k e0 phi₁ T ∧ + j.val + 2 ≤ T.length ∧ + beta ∈ MissingColors G phi₁ (T.vertex j) ∧ + beta ∈ MissingColors G phi₁ (T.vertex (Fin.last T.length)) ∧ + beta ∉ TreeUsedColors phi₁ T := by + classical + have hlen : 3 ≤ T.length := by + have hi : TashTreePathIndex G T ≤ T.length := by + rw [hlast] + omega + let P : TreeSequence G e0 := + TreeSequencePrefix T (T.length - 2) (by omega) (by omega) + have hPlen : P.length = T.length - 2 := rfl + have hPelem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) := by + apply TashTreeProperPrefixElementary G k e0 phi T P hmin + · refine ⟨by rw [hPlen]; omega, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + · rw [hPlen] + omega + have hfour : 4 ≤ (TreeFreeColors phi P).card := by + simpa [P] using TashTreeFourUnusedColors G k e0 phi T hmin + (T.length - 2) (by omega) (by omega) + let P1 : TreeSequence G e0 := + TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + have hP1len : P1.length = T.length - 1 := rfl + have hP1elem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet P1) := by + apply TashTreeProperPrefixElementary G k e0 phi T P1 hmin + · refine ⟨by rw [hP1len]; omega, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + · rw [hP1len] + omega + have hbad : ¬ ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := hmin.1.2.2 + have hcommon : ∃ u ∈ TreeSequenceVertexSet T, ∃ v ∈ TreeSequenceVertexSet T, + u ≠ v ∧ ∃ c, c ∈ MissingColors G phi u ∧ c ∈ MissingColors G phi v := by + by_contra hneg + push Not at hneg + apply hbad + intro u hu v hv huv + rw [Finset.disjoint_left] + intro c hcu hcv + exact hneg u hu v hv huv c hcu hcv + rcases hcommon with ⟨u, hu, v, hv, huv, beta, hbu, hbv⟩ + have huindex : ∃ i : Fin (T.length + 1), T.vertex i = u := by + simpa [TreeSequenceVertexSet] using hu + have hvindex : ∃ i : Fin (T.length + 1), T.vertex i = v := by + simpa [TreeSequenceVertexSet] using hv + rcases huindex with ⟨i, rfl⟩ + rcases hvindex with ⟨j, rfl⟩ + have hbetaLast := @helper_hbetaLast_421 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@hq) (@hlast) (@hP1len) (@hP1elem) (@beta) (@i) (@hbu) (@j) (@hbv) (@huv) + have hbetaIndex : ∃ j : Fin (T.length + 1), j.val < T.length ∧ + beta ∈ MissingColors G phi (T.vertex j) := by + by_cases hi : i.val < T.length + · exact ⟨i, hi, hbu⟩ + · have hjlt : j.val < T.length := by + have hjle : j.val ≤ T.length := Nat.le_of_lt_succ j.isLt + have hjne : j.val ≠ T.length := by + intro hjlast + have hiLast : i.val = T.length := by omega + have hij : i = j := Fin.ext (by simp [hjlast, hiLast]) + exact huv (congrArg T.vertex hij) + exact Nat.lt_of_le_of_ne hjle hjne + exact ⟨j, hjlt, hbv⟩ + rcases hbetaIndex with ⟨j, hj, hbj⟩ + let r₁ : Fin T.length := ⟨T.length - 2, by omega⟩ + let r₂ : Fin T.length := ⟨T.length - 1, by omega⟩ + let d₁ : Fin k := (phi (T.edge r₁)).getD beta + let d₂ : Fin k := (phi (T.edge r₂)).getD beta + have hfree : ∃ alpha : Fin k, alpha ∈ TreeFreeColors phi P ∧ + alpha ≠ beta ∧ alpha ≠ d₁ ∧ alpha ≠ d₂ := by + by_contra! hn + have hs : TreeFreeColors phi P ⊆ ({beta, d₁, d₂} : Finset (Fin k)) := by + intro c hc + by_cases hcb : c = beta + · simp [hcb] + by_cases hd1 : c = d₁ + · simp [hd1] + simp [hn c hc hcb hd1] + have hc : (TreeFreeColors phi P).card ≤ 3 := by + have hh := Finset.card_le_card hs + calc + _ ≤ ({beta, d₁, d₂} : Finset (Fin k)).card := hh + _ ≤ 3 := Finset.card_le_three + omega + rcases hfree with ⟨alpha, halphaFree, hab, had₁, had₂⟩ + have halphaMissing : ∃ m : Fin (T.length + 1), m.val ≤ T.length - 2 ∧ + alpha ∈ MissingColors G phi (T.vertex m) := by + rw [TreeFreeColors] at halphaFree + have hm : alpha ∈ TreeMissingColors phi P := (Finset.mem_sdiff.mp halphaFree).1 + rw [TreeMissingColors] at hm + rcases Finset.mem_biUnion.mp hm with ⟨x, hx, hxm⟩ + rw [TreeSequenceVertexSet] at hx + rcases Finset.mem_image.mp hx with ⟨m, -, rfl⟩ + let mt : Fin (T.length + 1) := + Fin.castLE (by rw [hPlen]; omega) m + refine ⟨mt, ?_, ?_⟩ + · dsimp [mt] + rw [hPlen] at m + omega + · simpa [mt, P, TreeSequencePrefix] using hxm + rcases halphaMissing with ⟨m, hm, ham⟩ + by_cases hj2 : j.val + 2 ≤ T.length + · exact @helper_branch_495 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@hmin) (@hq) (@hlast) (@hPlen) (@beta) (@i) (@hbetaLast) (@j) (@hbj) (@alpha) + (@halphaFree) (@hab) (@had₁) (@had₂) (@m) (@hm) (@ham) (@hj2) + · exact @helper_branch_571 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@phi) (@T) (@hmin) (@hq) (@hlast) (@hPlen) (@hP1len) (@hP1elem) (@beta) (@i) _ (@hv) + (@hbetaLast) (@j) (@hj) (@hbj) (@alpha) (@halphaFree) (@hab) (@had₁) (@had₂) (@m) (@hm) + (@ham) (@hj2) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeLastIndexIntersectionShortening.lean b/LeanPool/GoldbergSeymour/TashTreeLastIndexIntersectionShortening.lean new file mode 100644 index 0000000000..f47303b35a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeLastIndexIntersectionShortening.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree + +public import LeanPool.GoldbergSeymour.TwoColorComponentTashkinovSplice + +/-! +# Tash Tree Last Index Intersection Shortening + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeLastIndexIntersectionShortening {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T S : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hlast : TashTreePathIndex G T = T.length) + (hST : TreeSequenceInitialSegment S T) + (hlen : S.length + 2 = T.length) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (halpha : alpha ∈ TreeMissingColors phi S) + (hbeta : beta ∈ TreeMissingColors phi S) + (hlastbeta : beta ∈ + MissingColors G phi (T.vertex (Fin.last T.length))) + (hlastOutside : T.vertex (Fin.last T.length) ∉ TreeSequenceVertexSet S) + (hmeets : ∃ u ∈ TreeSequenceVertexSet S, + Sum.inl u ∈ TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex (Fin.last T.length)))) : False := by + classical + have hSTdata := hST + rcases hSTdata with ⟨hSTlen, hSTvertices, hSTedges⟩ + have hTashS : TashkinovTree G e0 phi S := by + intro j hj + rcases hmin.1.2.1 (Fin.castLE hSTlen j) hj with + ⟨i, c, hcolor, hmissing⟩ + refine ⟨i, c, ?_, ?_⟩ + · rw [hSTedges j] at hcolor + exact hcolor + · have hindex : + Fin.castLE (Nat.succ_le_succ hSTlen) + (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) = + Fin.castLT i + (Nat.lt_trans i.isLt + (Nat.succ_lt_succ (Fin.castLE hSTlen j).isLt)) := by + apply Fin.ext + rfl + rw [← hSTvertices, hindex] + exact hmissing + have hproper : IsProperEdgeColoring G phi := hmin.1.1.2.2.2.1 + obtain ⟨u, S', hu, _huComponent, hSS', hlength, haugment, + hlastVertex, hsplice⟩ := + TwoColorComponentTashkinovSplice G phi S alpha beta + (T.vertex (Fin.last T.length)) hproper hne halpha hbeta + hlastOutside hmeets + have hTashS' : TashkinovTree G e0 phi S' := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 phi S S' + hTashS haugment + have hSS'data := hSS' + rcases hSS'data with ⟨hSSlen, hSSvertices, hSSedges⟩ + have hnotElementary : + ¬ ColoredVertexSetElementary G phi (TreeSequenceVertexSet S') := by + intro helementary + rw [TreeMissingColors] at hbeta + rcases Finset.mem_biUnion.mp hbeta with ⟨v, hvS, hvbeta⟩ + have hvS' : v ∈ TreeSequenceVertexSet S' := by + rw [TreeSequenceVertexSet] at hvS ⊢ + rcases Finset.mem_image.mp hvS with ⟨j, hj, rfl⟩ + refine Finset.mem_image.mpr + ⟨Fin.castLE (Nat.succ_le_succ hSSlen) j, Finset.mem_univ _, ?_⟩ + exact hSSvertices j + have hyS' : T.vertex (Fin.last T.length) ∈ + TreeSequenceVertexSet S' := by + rw [← hlastVertex, TreeSequenceVertexSet] + exact Finset.mem_image.mpr + ⟨Fin.last S'.length, Finset.mem_univ _, rfl⟩ + have hvne : v ≠ T.vertex (Fin.last T.length) := by + intro hv + apply hlastOutside + rwa [← hv] + have hdisjoint := helementary hvS' hyS' hvne + exact (Finset.disjoint_left.mp hdisjoint) hvbeta hlastbeta + have hbadS' : TashTreeBadPair G k e0 phi S' := + ⟨hmin.1.1, hTashS', hnotElementary⟩ + have hsuffix : TashTreeSuffixPath G S' (S.length + 1) := by + refine ⟨by omega, by omega, ?_⟩ + intro r hr + have hrbase : S.length ≤ r.val := by omega + have hrne : r.val ≠ S.length := by omega + simpa [hrne] using (hsplice r hrbase).2.2.2.2 + have hindexLe : TashTreePathIndex G S' ≤ S.length + 1 := by + unfold TashTreePathIndex + exact Nat.find_min' _ hsuffix + have hrank : TashTreeRankLess G S' T := by + left + rw [hlast] + omega + exact (hmin.2 hbadS') hrank + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeLastIndexSecondNormalForm.lean b/LeanPool/GoldbergSeymour/TashTreeLastIndexSecondNormalForm.lean new file mode 100644 index 0000000000..1c4ed3f377 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeLastIndexSecondNormalForm.lean @@ -0,0 +1,424 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreePathIndex +public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Tash Tree Last Index Second Normal Form + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hgamma_unused_110.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (hq : (2 : ℕ) < TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length) (_ + : Fin (T.length + (1 : ℕ))), TashTreeBadPair G k e0 phi T → + let r : Fin T.length := (⟨T.length - (1 : ℕ), Decidable.byContradiction fun (a : ¬T.length - + (1 : ℕ) < T.length) => + by omega + ⟩ : Fin T.length); + let p : Fin (T.length + (1 : ℕ)) := (⟨T.length - (1 : ℕ), Decidable.byContradiction fun (a : + ¬T.length - (1 : ℕ) < T.length + (1 : ℕ)) => + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); + ∀ (hr : (↑r : ℕ) + (1 : ℕ) = T.length), + ∀ gamma ∈ MissingColors G phi (T.vertex p), + let P : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); P.length = T.length - (1 : ℕ) → ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) + → TreeColorUnusedThrough phi T gamma p := by + classical + intro V E _ _ _ G k e0 phi T hq hlast j hbad r p hr gamma hgamma_missing P hPlength + hPelementary s hs1 hsp hscolor + rcases hbad.2.1 s hs1 with ⟨i, c, hc, hm⟩ + have hcg : c = gamma := by + exact Option.some.inj (hc.symm.trans hscolor) + subst c + have hilt : i.val < T.length - 1 := by + have hiq : i.val ≤ s.val := Nat.le_of_lt_succ i.isLt + have hslt : s.val < T.length - 1 := by simpa [p] using hsp + omega + have himem : T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ s.isLt))) ∈ + TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + refine ⟨⟨i.val, by rw [hPlength]; omega⟩, Finset.mem_univ _, ?_⟩ + rfl + have hpmem : T.vertex p ∈ TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + refine Finset.mem_image.mpr ⟨⟨T.length - 1, by rw [hPlength]; omega⟩, + Finset.mem_univ _, ?_⟩ + rfl + have hne : T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ s.isLt))) ≠ T.vertex p := by + intro he + have hv := T.vertex_injective he + dsimp [p] at hv + have hiq : i.val < T.length - 1 := hilt + have hcast : (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ s.isLt))).val = i.val := rfl + omega + have hd := hPelementary himem hpmem hne + exact (Finset.disjoint_left.mp hd) hm hgamma_missing + +private theorem helper_branch_158.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length) (beta : Fin k) (j : Fin + (T.length + (1 : ℕ))), (↑j : ℕ) + (2 : ℕ) ≤ T.length → beta ∈ MissingColors G phi + (T.vertex (Fin.last T.length)) → IsProperEdgeColoring G phi → + let r : Fin T.length := (⟨T.length - (1 : ℕ), Decidable.byContradiction fun (a : ¬T.length - + (1 : ℕ) < T.length) => + by omega + ⟩ : Fin T.length); + let p : Fin (T.length + (1 : ℕ)) := (⟨T.length - (1 : ℕ), Decidable.byContradiction fun (a : + ¬T.length - (1 : ℕ) < T.length + (1 : ℕ)) => + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); (↑r : ℕ) + (1 : ℕ) = T.length → + ∀ (gamma : Fin k), phi (T.edge r) = some gamma → Incident G (T.vertex (Fin.last T.length)) + (T.edge r) → beta ≠ gamma → TwoColorPathComponent G phi beta gamma (Sum.inl (T.vertex p)) + → Sum.inl (T.vertex j) ∈ TwoColorComponent G phi beta gamma (Sum.inl (T.vertex p)) → + ((TwoColorIncidenceGraph G phi beta gamma).neighborSet (Sum.inl (T.vertex + j))).Subsingleton → ((TwoColorIncidenceGraph G phi beta gamma).neighborSet (Sum.inl + (T.vertex p))).Subsingleton → TwoColorComponentSwap G phi beta gamma (Sum.inl (T.vertex + p)) (T.edge r) = some gamma := by + classical + intro V E _ _ G k e0 phi T hq hlast beta j hj hblast hproper r p hr gamma hgamma hlastincident + hbeta_gamma hpath hjC hiSub hpSub + let _ := Fintype.ofFinite V + have houtside : Sum.inr (T.edge r) ∉ + TwoColorComponent G phi beta gamma (Sum.inl (T.vertex p)) := by + by_contra hin + obtain ⟨a, b, path, hpath, hsupport⟩ := + TwoColorComponentSpanningPath G phi beta gamma hproper + (Sum.inl (T.vertex p)) + have support_of_component {x : Sum V E} (hx : x ∈ + TwoColorComponent G phi beta gamma (Sum.inl (T.vertex p))) : + x ∈ path.support := by + change x ∈ {y | y ∈ path.support} + rw [hsupport] + exact hx + have endpoint_of_subsingleton {x : Sum V E} (hx : x ∈ + TwoColorComponent G phi beta gamma (Sum.inl (T.vertex p))) + (hxSub : Set.Subsingleton + ((TwoColorIncidenceGraph G phi beta gamma).neighborSet x)) : + x = a ∨ x = b := by + by_contra hend + push Not at hend + exact (hpath.isTrail.notMem_support_of_subsingleton_neighborSet + hend.1 hend.2 hxSub) (support_of_component hx) + have hpC : Sum.inl (T.vertex p) ∈ + TwoColorComponent G phi beta gamma (Sum.inl (T.vertex p)) := by + change Sum.inl (T.vertex p) ∈ + ((TwoColorIncidenceGraph G phi beta gamma).connectedComponentMk + (Sum.inl (T.vertex p))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have hmEnd := endpoint_of_subsingleton hjC hiSub + have hpEnd := endpoint_of_subsingleton + hpC hpSub + have hlastC : Sum.inl (T.vertex (Fin.last T.length)) ∈ + TwoColorComponent G phi beta gamma (Sum.inl (T.vertex p)) := by + have hadj : (TwoColorIncidenceGraph G phi beta gamma).Adj + (Sum.inl (T.vertex (Fin.last T.length))) (Sum.inr (T.edge r)) := by + simp [TwoColorIncidenceGraph, hlastincident, hgamma] + have heq := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj + change Sum.inl (T.vertex (Fin.last T.length)) ∈ + ((TwoColorIncidenceGraph G phi beta gamma).connectedComponentMk + (Sum.inl (T.vertex p))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have hin' := hin + change Sum.inr (T.edge r) ∈ + ((TwoColorIncidenceGraph G phi beta gamma).connectedComponentMk + (Sum.inl (T.vertex p))).supp at hin' + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] at hin' + exact heq.trans hin' + have hlSub : Set.Subsingleton + ((TwoColorIncidenceGraph G phi beta gamma).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))) := by + let : Fintype + ((TwoColorIncidenceGraph G phi beta gamma).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))) := Fintype.ofFinite _ + have hd := MissingColorIncidenceEndpoint G phi beta gamma + hbeta_gamma hproper (T.vertex (Fin.last T.length)) hblast + intro x hx y hy + have hx' : x ∈ (TwoColorIncidenceGraph G phi beta gamma).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length))) := by + apply (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi beta gamma) + (Sum.inl (T.vertex (Fin.last T.length))) x).2 + simpa [TwoColorIncidenceGraph, or_comm] using hx + have hy' : y ∈ (TwoColorIncidenceGraph G phi beta gamma).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length))) := by + apply (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi beta gamma) + (Sum.inl (T.vertex (Fin.last T.length))) y).2 + simpa [TwoColorIncidenceGraph, or_comm] using hy + have hc : ((TwoColorIncidenceGraph G phi beta gamma).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length)))).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hd + exact (Finset.card_le_one.mp hc) x hx' y hy' + have hlEnd := endpoint_of_subsingleton hlastC hlSub + have hm_ne_last : (Sum.inl (T.vertex p) : Sum V E) ≠ + Sum.inl (T.vertex (Fin.last T.length)) := by + intro he + have hv : T.vertex p = T.vertex (Fin.last T.length) := by simpa using he + have hh := congrArg Fin.val (T.vertex_injective hv) + dsimp [p] at hh + omega + have hp_ne_last : (Sum.inl (T.vertex p) : Sum V E) ≠ + Sum.inl (T.vertex (Fin.last T.length)) := hm_ne_last + have hj_ne_last : (Sum.inl (T.vertex j) : Sum V E) ≠ + Sum.inl (T.vertex (Fin.last T.length)) := by + intro he + have hv : T.vertex j = T.vertex (Fin.last T.length) := by simpa using he + have hh := congrArg Fin.val (T.vertex_injective hv) + dsimp [p] at hh + omega + have hm_ne_p : (Sum.inl (T.vertex j) : Sum V E) ≠ + Sum.inl (T.vertex p) := by + intro he + have hv : T.vertex j = T.vertex p := by simpa using he + have hh := congrArg Fin.val (T.vertex_injective hv) + dsimp [p] at hh + omega + rcases hmEnd with hmA | hmB <;> rcases hpEnd with hpA | hpB + · exact hm_ne_p (hmA.trans hpA.symm) + · rcases hlEnd with hlA | hlB + · exact hj_ne_last (hmA.trans hlA.symm) + · exact hp_ne_last (hpB.trans hlB.symm) + · rcases hlEnd with hlA | hlB + · exact hp_ne_last (hpA.trans hlA.symm) + · exact hj_ne_last (hmB.trans hlB.symm) + · exact hm_ne_p (hmB.trans hpB.symm) + simp [TwoColorComponentSwap, houtside, hgamma] + +private theorem helper_branch_265.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length) (beta : Fin k) (j : Fin + (T.length + (1 : ℕ))), (↑j : ℕ) + (2 : ℕ) ≤ T.length → IsProperEdgeColoring G phi → + let r : Fin T.length := (⟨T.length - (1 : ℕ), Decidable.byContradiction fun (a : ¬T.length - + (1 : ℕ) < T.length) => + by omega + ⟩ : Fin T.length); + let p : Fin (T.length + (1 : ℕ)) := (⟨T.length - (1 : ℕ), Decidable.byContradiction fun (a : + ¬T.length - (1 : ℕ) < T.length + (1 : ℕ)) => + by + omega + ⟩ : Fin (T.length + (1 : ℕ))); (↑r : ℕ) + (1 : ℕ) = T.length → + ∀ (gamma : Fin k), beta ≠ gamma → gamma ∈ MissingColors G phi (T.vertex p) → Sum.inl (T.vertex + j) ∈ TwoColorComponent G phi beta gamma (Sum.inl (T.vertex p)) → ((TwoColorIncidenceGraph + G phi beta gamma).neighborSet (Sum.inl (T.vertex j))).Subsingleton → + ((TwoColorIncidenceGraph G phi beta gamma).neighborSet (Sum.inl (T.vertex + p))).Subsingleton → gamma ∈ PresentColors G (TwoColorComponentSwap G phi beta gamma + (Sum.inl (T.vertex p))) (T.vertex p) := by + classical + intro V E _ _ G k e0 phi T hq hlast beta j hj hproper r p hr gamma hbeta_gamma hgamma_missing hjC + hiSub hpSub + let _ := Fintype.ofFinite V + have hpC : Sum.inl (T.vertex p) ∈ + TwoColorComponent G phi beta gamma (Sum.inl (T.vertex p)) := by + change Sum.inl (T.vertex p) ∈ + ((TwoColorIncidenceGraph G phi beta gamma).connectedComponentMk + (Sum.inl (T.vertex p))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + obtain ⟨a, b, path, pathIsPath, pathSupport⟩ := + TwoColorComponentSpanningPath G phi beta gamma hproper + (Sum.inl (T.vertex p)) + have endpoint_of_subsingleton {x : Sum V E} (hx : x ∈ + TwoColorComponent G phi beta gamma (Sum.inl (T.vertex p))) + (hxSub : Set.Subsingleton + ((TwoColorIncidenceGraph G phi beta gamma).neighborSet x)) : + x = a ∨ x = b := by + by_contra hend + push Not at hend + have hsupp : x ∈ path.support := by + change x ∈ {y | y ∈ path.support} + rw [pathSupport] + exact hx + exact (pathIsPath.isTrail.notMem_support_of_subsingleton_neighborSet + hend.1 hend.2 hxSub) hsupp + have hpEnd := endpoint_of_subsingleton hpC hpSub + have hjEnd := endpoint_of_subsingleton hjC hiSub + have hj_ne_p : (Sum.inl (T.vertex j) : Sum V E) ≠ + Sum.inl (T.vertex p) := by + intro he + have hv : T.vertex j = T.vertex p := by simpa using he + have hh := congrArg Fin.val (T.vertex_injective hv) + dsimp [p] at hh + omega + have hab : a ≠ b := by + intro hab + rcases hpEnd with hpa | hpb + · rcases hjEnd with hja | hjb + · exact hj_ne_p (hja.trans hpa.symm) + · exact hj_ne_p ((hjb.trans hab.symm).trans hpa.symm) + · rcases hjEnd with hja | hjb + · exact hj_ne_p ((hja.trans hab).trans hpb.symm) + · exact hj_ne_p (hjb.trans hpb.symm) + have hnon : ¬ path.Nil := SimpleGraph.Walk.not_nil_of_ne hab + have hadj : ∃ x : Sum V E, + (TwoColorIncidenceGraph G phi beta gamma).Adj + (Sum.inl (T.vertex p)) x := by + rcases hpEnd with hpa | hpb + · refine ⟨path.snd, ?_⟩ + simpa [hpa] using path.adj_snd hnon + · refine ⟨path.penultimate, ?_⟩ + simpa [hpb] using (path.adj_penultimate hnon).symm + obtain ⟨x, hx⟩ := hadj + cases x with + | inl v => simp [TwoColorIncidenceGraph] at hx + | inr e => + have he : Incident G (T.vertex p) e ∧ + (phi e = some beta ∨ phi e = some gamma) := by + simpa [TwoColorIncidenceGraph] using hx + have hnotgamma : gamma ∉ PresentColors G phi (T.vertex p) := by + simpa [MissingColors] using hgamma_missing + have hebeta : phi e = some beta := by + rcases he.2 with heb | heg + · exact heb + · exfalso + apply hnotgamma + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, he.1, heg⟩ + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨e, he.1, ?_⟩ + have hCedge : Sum.inr e ∈ + TwoColorComponent G phi beta gamma (Sum.inl (T.vertex p)) := by + change Sum.inr e ∈ + ((TwoColorIncidenceGraph G phi beta gamma).connectedComponentMk + (Sum.inl (T.vertex p))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hx).symm + simp [TwoColorComponentSwap, hCedge, hebeta] + +theorem TashTreeLastIndexSecondNormalForm {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hlast : TashTreePathIndex G T = T.length) + (beta : Fin k) (j : Fin (T.length + 1)) + (hj : j.val + 2 ≤ T.length) + (hbj : beta ∈ MissingColors G phi (T.vertex j)) + (hblast : beta ∈ MissingColors G phi (T.vertex (Fin.last T.length))) + (hbunused : beta ∉ TreeUsedColors phi T) : + ∃ (phi₂ : PartialEdgeColoring E k) (gamma : Fin k) (r : Fin T.length) (p : + Fin (T.length + 1)), + r.val + 1 = T.length ∧ + p.val + 1 = T.length ∧ + TashTreeMinimumBadPair G k e0 phi₂ T ∧ + phi₂ (T.edge r) = some gamma ∧ gamma ∈ PresentColors G phi₂ (T.vertex p) := by + classical + have hlen : 3 ≤ T.length := by omega + have hbad := hmin.1 + have htriple := hbad.1 + have hproper := htriple.2.2.2.1 + have hone := htriple.2.2.2.2 + let r : Fin T.length := ⟨T.length - 1, by omega⟩ + let p : Fin (T.length + 1) := ⟨T.length - 1, by omega⟩ + have hr : r.val + 1 = T.length := by dsimp [r]; omega + have hp : p.val + 1 = T.length := by dsimp [p]; omega + have hlastedge_ne : T.edge r ≠ e0 := by + intro he + have hz : T.edge r = T.edge ⟨0, T.positive⟩ := by + rw [he, T.first_edge] + have hrz := T.edge_injective hz + dsimp [r] at hrz + have hrzero : r.val = 0 := congrArg Fin.val hrz + dsimp [r] at hrzero + omega + obtain ⟨gamma, hgamma⟩ := hone.2 (T.edge r) hlastedge_ne + have hlastincident : Incident G (T.vertex (Fin.last T.length)) (T.edge r) := by + obtain ⟨i, hi⟩ := T.attaches r + have hrs : r.succ = Fin.last T.length := by + apply Fin.ext + simpa using hr + rw [Incident, hi] + simp [hrs] + have hbeta_gamma : beta ≠ gamma := by + intro heq + have hnotpresent : beta ∉ PresentColors G phi + (T.vertex (Fin.last T.length)) := by + simpa [MissingColors] using hblast + apply hnotpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨T.edge r, hlastincident, by simpa [heq] using hgamma⟩ + by_cases hpres : gamma ∈ PresentColors G phi (T.vertex p) + · exact ⟨phi, gamma, r, p, hr, hp, hmin, hgamma, hpres⟩ + have hgamma_missing : gamma ∈ MissingColors G phi (T.vertex p) := by + rw [MissingColors] + simp only [Finset.mem_sdiff, Finset.mem_univ, true_and] + exact hpres + let P : TreeSequence G e0 := + TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + have hPlength : P.length = T.length - 1 := by rfl + have hPprefix : TreeSequenceInitialSegment P T := by + refine ⟨by rw [hPlength]; omega, ?_, ?_⟩ + · intro i; rfl + · intro i; rfl + have hPelementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet P) := by + apply TashTreeProperPrefixElementary G k e0 phi T P hmin hPprefix + change T.length - 1 < T.length + omega + have hgamma_unused := @helper_hgamma_unused_110 V E inferInstance inferInstance inferInstance G k + e0 phi T hq hlast j hbad hr gamma hgamma_missing hPlength hPelementary + have hcontrolled := TashTreeControlledInterchange G k e0 phi T hmin + j p (by dsimp [p]; omega) (by dsimp [p]; omega) + beta gamma hbeta_gamma hbj hgamma_missing + (by + intro s hs1 hsj heq + apply hbunused + rw [TreeUsedColors] + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨s, hs1, heq⟩) hgamma_unused + dsimp only at hcontrolled + rcases hcontrolled with ⟨hpath, hjC, hiSub, hpSub, hbeta', hgamma', hunchanged, + htransport, hmin'⟩ + refine ⟨TwoColorComponentSwap G phi beta gamma (Sum.inl (T.vertex p)), gamma, + r, p, hr, hp, hmin', ?_, ?_⟩ + · exact @helper_branch_158 V E inferInstance inferInstance G k e0 phi T hq hlast + beta j hj hblast hproper hr gamma hgamma hlastincident hbeta_gamma hpath hjC hiSub hpSub + · exact @helper_branch_265 V E inferInstance inferInstance G k e0 phi T hq hlast + beta j hj hproper hr gamma hbeta_gamma hgamma_missing hjC hiSub hpSub +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeLastIndexThirdNormalForm.lean b/LeanPool/GoldbergSeymour/TashTreeLastIndexThirdNormalForm.lean new file mode 100644 index 0000000000..c0b3e92b52 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeLastIndexThirdNormalForm.lean @@ -0,0 +1,823 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange +public import LeanPool.GoldbergSeymour.TashTreeFourUnusedColors +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreePathIndex +public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeFreeColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeUsedColors +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# Tash Tree Last Index Third Normal Form + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hbeta_pen_89.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (hq : (2 : ℕ) < + TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length) (r : Fin T.length) (p : + Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) + (1 : ℕ) = T.length) (hp : (↑p : ℕ) + (1 : ℕ) = + T.length) (hlastval : (↑r : ℕ) = T.length - (1 : ℕ)), + let P : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); P.length = T.length - (1 : ℕ) → TreeSequenceInitialSegment P T → ColoredVertexSetElementary + G phi (TreeSequenceVertexSet P) → + ∀ u ∈ TreeSequenceVertexSet T, + ∀ v ∈ TreeSequenceVertexSet T, u ≠ v → + ∀ beta ∈ MissingColors G phi u, beta ∈ MissingColors G phi v → ( + ∀ w ∈ TreeSequenceVertexSet T, w = T.vertex (Fin.last T.length) ∨ w ∈ TreeSequenceVertexSet P) + → ( + ∀ (i : Fin (T.length + (1 : ℕ))), beta ∈ MissingColors G phi (T.vertex i) → (↑i : ℕ) = + T.length - (1 : ℕ) ∨ (↑i : ℕ) = T.length) → beta ∈ MissingColors G phi (T.vertex + (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) := by + classical + intro V E _ _ G k e0 phi T hq hlast r p hr hp hlastval P hP_length hPprefix hPelementary u hu v hv + huv beta hbu hbv hlast_or_prefix hlast_index + let _ := Fintype.ofFinite V + rcases hlast_or_prefix u hu with huLast | huPrefix + · rcases hlast_or_prefix v hv with hvLast | hvPrefix + · exact (huv (huLast.trans hvLast.symm)).elim + · have hvindex : ∃ i : Fin (T.length + 1), + i.val = T.length - 1 ∧ T.vertex i = v := by + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at hvPrefix + obtain ⟨i, hi⟩ := hvPrefix + let ii : Fin (T.length + 1) := ⟨i.val, by omega⟩ + have hq := hPprefix.2.1 i + have heq : Fin.castLE (Nat.succ_le_succ hPprefix.1) i = ii := by + apply Fin.ext + rfl + rw [heq] at hq + have hidx := hlast_index ii (by + rw [hq, hi] + exact hbv) + rcases hidx with hidx | hidx + · exact ⟨ii, hidx, hq.trans hi⟩ + · have hiT : i.val < T.length := by + have hh := i.isLt + simp [hP_length] at hh + omega + have hii : ii.val = i.val := rfl + have hiiT : ii.val < T.length := by simpa [ii] using hiT + omega + obtain ⟨i, hi, hiv⟩ := hvindex + have hlastEq : T.vertex i = T.vertex ⟨T.length - 1, by omega⟩ := by + apply congrArg T.vertex + apply Fin.ext + simpa using hi + have hvlast : v = T.vertex ⟨T.length - 1, by omega⟩ := hiv.symm.trans hlastEq + simpa [hvlast] using hbv + · rcases hlast_or_prefix v hv with hvLast | hvPrefix + · have huindex : ∃ i : Fin (T.length + 1), + i.val = T.length - 1 ∧ T.vertex i = u := by + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] at huPrefix + obtain ⟨i, hi⟩ := huPrefix + let ii : Fin (T.length + 1) := ⟨i.val, by omega⟩ + have hq := hPprefix.2.1 i + have heq : Fin.castLE (Nat.succ_le_succ hPprefix.1) i = ii := by + apply Fin.ext + rfl + rw [heq] at hq + have hidx := hlast_index ii (by + rw [hq, hi] + exact hbu) + rcases hidx with hidx | hidx + · exact ⟨ii, hidx, hq.trans hi⟩ + · have hiT : i.val < T.length := by + have hh := i.isLt + simp [hP_length] at hh + omega + have hii : ii.val = i.val := rfl + have hiiT : ii.val < T.length := by simpa [ii] using hiT + omega + obtain ⟨i, hi, hiv⟩ := huindex + have hlastEq : T.vertex i = T.vertex ⟨T.length - 1, by omega⟩ := by + apply congrArg T.vertex + apply Fin.ext + simpa using hi + have hulast : u = T.vertex ⟨T.length - 1, by omega⟩ := hiv.symm.trans hlastEq + simpa [hulast] using hbu + · exact (Finset.disjoint_left.mp + (hPelementary huPrefix hvPrefix + (by intro he; exact huv (he ▸ rfl)))) hbu hbv |>.elim + +private theorem helper_hbeta_unused_158.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hq : (2 : ℕ) < TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length) + (r : Fin T.length) (p : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) + (1 : ℕ) = T.length) + (hp : (↑p : ℕ) + (1 : ℕ) = T.length) (hlastval : (↑r : ℕ) = T.length - (1 : ℕ)), + TashTreeBadPair G k e0 phi T → + let P : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => by omega); + P.length = T.length - (1 : ℕ) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) → + ∀ + beta ∈ + MissingColors G phi + (T.vertex (⟨T.length - (1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ)))), + TreeColorUnusedThrough phi T beta + (⟨T.length - (1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))) := by + classical + intro V E _ _ _ G k e0 phi T hq hlast r p hr hp hlastval hbad P hP_length hPelementary beta + hbeta_pen s hs1 hsj hcolor + rcases hbad.2.1 s hs1 with ⟨i, c, hc, hmiss⟩ + have hcb : beta = c := by simpa [hcolor] using hc + subst c + have hslt : s.val < T.length - 1 := by simpa using hsj + have his : i.val ≤ s.val := Nat.le_of_lt_succ i.isLt + have hilt : i.val < T.length - 1 := by omega + have hvne : T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ s.isLt))) ≠ + T.vertex ⟨T.length - 1, by omega⟩ := by + intro he + have he' := T.vertex_injective he + have hiVal := congrArg Fin.val he' + have hcast : (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ s.isLt))).val = i.val := rfl + have hcast : (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ s.isLt))).val = i.val := rfl + omega + have hd := hPelementary + (by rw [TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨ + ⟨i.val, by omega⟩, Finset.mem_univ _, by + apply congrArg T.vertex; apply Fin.ext; rfl⟩) + (by rw [TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨ + ⟨T.length - 1, by omega⟩, Finset.mem_univ _, rfl⟩) hvne + exact (Finset.disjoint_left.mp hd) hmiss hbeta_pen + +private theorem helper_halpha_unused_246.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (hq : (2 : ℕ) < TashTreePathIndex G T) + (hlast : TashTreePathIndex G T = T.length) (gamma : Fin k) (r : Fin T.length) + (p : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) + (1 : ℕ) = T.length) + (hp : (↑p : ℕ) + (1 : ℕ) = T.length), + phi (T.edge r) = some gamma → + ∀ (hlastval : (↑r : ℕ) = T.length - (1 : ℕ)), + let P : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => by omega); + ∀ (hP_length : P.length = T.length - (1 : ℕ)) (beta : Fin k), + let Q : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) => by omega); + let edgeColor : Fin k := + (phi (T.edge (⟨T.length - (2 : ℕ), by omega⟩ : Fin T.length))).getD beta; + ∀ (alpha : Fin k), + alpha ≠ gamma → + alpha ≠ edgeColor → + alpha ∈ TreeFreeColors phi Q → + ∀ (_ : Fin (Q.length + (1 : ℕ))), + TreeColorUnusedThrough phi T alpha + (⟨T.length - (1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))) := by + classical + intro V E _ _ G k e0 phi T hq hlast gamma r p hr hp hrgamma hlastval P hP_length beta Q edgeColor + alpha halpha_ne_gamma halpha_ne_edge halpha_free mi s hs1 hsj + let _ := Fintype.ofFinite V + by_cases hsLast : s.val = T.length - 1 + · intro heq + have hs_eq : s = ⟨T.length - 1, by omega⟩ := by + apply Fin.ext + exact hsLast + rw [hs_eq] at heq + have hr_eq : r = ⟨T.length - 1, by omega⟩ := by + apply Fin.ext + exact hlastval + rw [hr_eq] at hrgamma + have hh : some alpha = some gamma := heq.symm.trans hrgamma + exact halpha_ne_gamma (Option.some.inj hh) + · by_cases hsSecond : s.val = T.length - 2 + · intro heq + have hs_eq : s = ⟨T.length - 2, by omega⟩ := by + apply Fin.ext + exact hsSecond + rw [hs_eq] at heq + cases hval : phi (T.edge ⟨T.length - 2, by omega⟩) with + | none => simp [hval] at heq + | some c => + have hc : phi (T.edge ⟨T.length - 2, by omega⟩) = some c := hval + have : edgeColor = c := by simp [edgeColor, hc] + have hac : alpha = c := Option.some.inj (heq.symm.trans hc) + exact halpha_ne_edge (hac.trans this.symm) + · have hsQ : s.val < Q.length := by + have hQlen : Q.length = T.length - 2 := rfl + have hsle : s.val ≤ T.length - 2 := by omega + have hslt2 : s.val < T.length - 2 := by + by_contra hn + have he : s.val = T.length - 2 := by omega + exact hsSecond he + simpa only [hQlen] using hslt2 + have husedQ : alpha ∉ TreeUsedColors phi Q := + (Finset.mem_sdiff.mp halpha_free).2 + intro heq + apply husedQ + simp only [TreeUsedColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨⟨s.val, by omega⟩, hs1, by + simpa [Q, TreeSequencePrefix, Fin.castLE] using heq⟩ + +private theorem helper_hlSub_448.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0), IsProperEdgeColoring G + phi → + ∀ beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)), + ∀ (alpha : Fin k), alpha ≠ beta → ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))).Subsingleton := by + classical + intro V E _ _ G k e0 phi T hproper beta hbeta_last alpha halpha_ne_beta + let _ := Fintype.ofFinite V + let : Fintype + ((TwoColorIncidenceGraph G phi beta alpha).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))) := Fintype.ofFinite _ + have hd := MissingColorIncidenceEndpoint G phi beta alpha + halpha_ne_beta.symm hproper (T.vertex (Fin.last T.length)) hbeta_last + intro x hx y hy + have hx' : x ∈ (TwoColorIncidenceGraph G phi beta alpha).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length))) := by + apply (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi beta alpha) + (Sum.inl (T.vertex (Fin.last T.length))) x).2 + simpa [TwoColorIncidenceGraph, or_comm] using hx + have hy' : y ∈ (TwoColorIncidenceGraph G phi beta alpha).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length))) := by + apply (SimpleGraph.mem_neighborFinset + (TwoColorIncidenceGraph G phi beta alpha) + (Sum.inl (T.vertex (Fin.last T.length))) y).2 + simpa [TwoColorIncidenceGraph, or_comm] using hy + have hc : ((TwoColorIncidenceGraph G phi beta alpha).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length)))).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hd + exact (Finset.card_le_one.mp hc) x hx' y hy' + +private theorem helper_houtside_414.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (hq : (2 : ℕ) < TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length) (r + : Fin T.length) (p : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) + (1 : ℕ) = T.length) (hp : + (↑p : ℕ) + (1 : ℕ) = T.length) (hlastval : (↑r : ℕ) = T.length - (1 : ℕ)), + IsProperEdgeColoring G phi → + let P : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by first | omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by first | omega + )); + ∀ (hP_length : P.length = T.length - (1 : ℕ)), + ∀ v ∈ TreeSequenceVertexSet T, + ∀ beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)), + let Q : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => ( + by first | omega + )) (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) => ( + by first | omega + )); + ∀ (alpha : Fin k), alpha ≠ beta → + ∀ (mi : Fin (Q.length + (1 : ℕ))) (hmq : (↑mi : ℕ) + (2 : ℕ) ≤ T.length), + TwoColorPathComponent G phi alpha beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))))) ∧ Sum.inl (T.vertex (⟨(↑mi : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) ∈ TwoColorComponent G phi alpha beta (Sum.inl (T.vertex + (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))))) ∧ ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex (⟨(↑mi : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))).Subsingleton ∧ ((TwoColorIncidenceGraph G phi alpha + beta).neighborSet (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))).Subsingleton ∧ beta ∈ MissingColors G (TwoColorComponentSwap + G phi alpha beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))) (T.vertex (⟨(↑mi : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) ∧ alpha ∈ MissingColors G (TwoColorComponentSwap G phi alpha + beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))) (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) ∧ ( + ∀ (r_1 : Fin T.length), (1 : ℕ) ≤ (↑r_1 : ℕ) → (↑r_1 : ℕ) < T.length - (1 : ℕ) → + TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))))) (T.edge r_1) = phi (T.edge r_1)) ∧ ( + ∀ (r_1 : Fin T.length), T.length - (1 : ℕ) ≤ (↑r_1 : ℕ) → + ∀ (w : Fin ((↑r_1 : ℕ) + (1 : ℕ))) (c : Fin k), phi (T.edge r_1) = some c → c ∈ MissingColors + G phi (T.vertex (w.castLT (Nat.lt_trans w.isLt (Nat.succ_lt_succ r_1.isLt)))) → + ∃ (w' : Fin ((↑r_1 : ℕ) + (1 : ℕ))) (c' : Fin k), TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))))) (T.edge r_1) = some c' ∧ c' ∈ MissingColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))) (T.vertex (w'.castLT (Nat.lt_trans w'.isLt (Nat.succ_lt_succ + r_1.isLt))))) ∧ TashTreeMinimumBadPair G k e0 (TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))) T → Sum.inl (T.vertex (Fin.last T.length)) ∉ + TwoColorComponent G phi alpha beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))))) := by + classical + intro V E _ _ _ G k e0 phi T hq hlast r p hr hp hlastval hproper P hP_length v hv beta + hbeta_last Q alpha halpha_ne_beta mi hmq hswap + by_contra hin + obtain ⟨a, b, path, hpath, hsupport⟩ := + TwoColorComponentSpanningPath G phi alpha beta hproper + (Sum.inl (T.vertex ⟨T.length - 1, by omega⟩)) + have support_of_component {x : Sum V E} (hx : x ∈ + TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex ⟨T.length - 1, by omega⟩))) : + x ∈ path.support := by + change x ∈ {y | y ∈ path.support} + rw [hsupport] + exact hx + have endpoint_of_subsingleton {x : Sum V E} (hx : x ∈ + TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex ⟨T.length - 1, by omega⟩))) + (hxSub : Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet x)) : + x = a ∨ x = b := by + by_contra hend + push Not at hend + exact (hpath.isTrail.notMem_support_of_subsingleton_neighborSet + hend.1 hend.2 hxSub) (support_of_component hx) + have hmEnd := endpoint_of_subsingleton hswap.2.1 hswap.2.2.1 + have hpEnd := endpoint_of_subsingleton + (by change Sum.inl (T.vertex ⟨T.length - 1, by omega⟩) ∈ + TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex ⟨T.length - 1, by omega⟩)) + change Sum.inl (T.vertex ⟨T.length - 1, by omega⟩) ∈ + ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl (T.vertex ⟨T.length - 1, by omega⟩))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff]) + hswap.2.2.2.1 + have hlSub := @helper_hlSub_448 V E inferInstance inferInstance G k e0 phi T hproper beta + hbeta_last alpha halpha_ne_beta + have hlEnd := endpoint_of_subsingleton hin hlSub + have hm_ne_last : (Sum.inl (T.vertex ⟨mi.val, by omega⟩) : Sum V E) ≠ + Sum.inl (T.vertex (Fin.last T.length)) := by + intro he + have hv : T.vertex ⟨mi.val, by omega⟩ = + T.vertex (Fin.last T.length) := by simpa using he + have hh := congrArg Fin.val (T.vertex_injective hv) + have hmiVal : (⟨mi.val, by omega⟩ : Fin (T.length + 1)).val = mi.val := rfl + have hlastVal : (Fin.last T.length).val = T.length := rfl + omega + have hp_ne_last : (Sum.inl (T.vertex ⟨T.length - 1, by omega⟩) : Sum V E) ≠ + Sum.inl (T.vertex (Fin.last T.length)) := by + intro he + have hv : T.vertex ⟨T.length - 1, by omega⟩ = + T.vertex (Fin.last T.length) := by simpa using he + have hh := congrArg Fin.val (T.vertex_injective hv) + have hpenVal : (⟨T.length - 1, by omega⟩ : Fin (T.length + 1)).val = T.length - 1 := rfl + have hlastVal : (Fin.last T.length).val = T.length := rfl + omega + have hm_ne_pen : (Sum.inl (T.vertex ⟨mi.val, by omega⟩) : Sum V E) ≠ + Sum.inl (T.vertex ⟨T.length - 1, by omega⟩) := by + intro he + have hv : T.vertex ⟨mi.val, by omega⟩ = + T.vertex ⟨T.length - 1, by omega⟩ := by simpa using he + have hh := congrArg Fin.val (T.vertex_injective hv) + have hmiVal : (⟨mi.val, by omega⟩ : Fin (T.length + 1)).val = mi.val := rfl + have hpenVal : (⟨T.length - 1, by omega⟩ : Fin (T.length + 1)).val = T.length - 1 := rfl + omega + have endpoint_is_m_or_pen {x : Sum V E} (hx : x = a ∨ x = b) : + x = Sum.inl (T.vertex ⟨mi.val, by omega⟩) ∨ + x = Sum.inl (T.vertex ⟨T.length - 1, by omega⟩) := by + rcases hmEnd with hmA | hmB <;> rcases hpEnd with hpA | hpB + · exact False.elim (hm_ne_pen (hmA.trans hpA.symm)) + · rcases hx with hxa | hxb + · exact Or.inl (hxa.trans hmA.symm) + · exact Or.inr (hxb.trans hpB.symm) + · rcases hx with hxa | hxb + · exact Or.inr (hxa.trans hpA.symm) + · exact Or.inl (hxb.trans hmB.symm) + · exact False.elim (hm_ne_pen (hmB.trans hpB.symm)) + rcases endpoint_is_m_or_pen hlEnd with hml | hpl + · exact hm_ne_last hml.symm + · exact hp_ne_last hpl.symm + +private theorem helper_hbeta_last3_299.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (hq : (2 : ℕ) < TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length) (_ + : Fin k) (r : Fin T.length) (p : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) + (1 : ℕ) = + T.length) (hp : (↑p : ℕ) + (1 : ℕ) = T.length) (hlastval : (↑r : ℕ) = T.length - (1 : ℕ)), + IsProperEdgeColoring G phi → + let P : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); + ∀ (hP_length : P.length = T.length - (1 : ℕ)), + ∀ v ∈ TreeSequenceVertexSet T, + ∀ beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)), + let Q : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) => + by omega + ); + ∀ (alpha : Fin k), alpha ≠ beta → + ∀ (mi : Fin (Q.length + (1 : ℕ))) (hmq : (↑mi : ℕ) + (2 : ℕ) ≤ T.length), + TwoColorPathComponent G phi alpha beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))))) ∧ Sum.inl (T.vertex (⟨(↑mi : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) ∈ TwoColorComponent G phi alpha beta (Sum.inl (T.vertex + (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))))) ∧ ((TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl (T.vertex (⟨(↑mi : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))).Subsingleton ∧ ((TwoColorIncidenceGraph G phi alpha + beta).neighborSet (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))).Subsingleton ∧ beta ∈ MissingColors G (TwoColorComponentSwap + G phi alpha beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))) (T.vertex (⟨(↑mi : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) ∧ alpha ∈ MissingColors G (TwoColorComponentSwap G phi alpha + beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))) (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))) ∧ ( + ∀ (r_1 : Fin T.length), (1 : ℕ) ≤ (↑r_1 : ℕ) → (↑r_1 : ℕ) < T.length - (1 : ℕ) → + TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))))) (T.edge r_1) = phi (T.edge r_1)) ∧ ( + ∀ (r_1 : Fin T.length), T.length - (1 : ℕ) ≤ (↑r_1 : ℕ) → + ∀ (w : Fin ((↑r_1 : ℕ) + (1 : ℕ))) (c : Fin k), phi (T.edge r_1) = some c → c ∈ MissingColors + G phi (T.vertex (w.castLT (Nat.lt_trans w.isLt (Nat.succ_lt_succ r_1.isLt)))) → + ∃ (w' : Fin ((↑r_1 : ℕ) + (1 : ℕ))) (c' : Fin k), TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))))) (T.edge r_1) = some c' ∧ c' ∈ MissingColors G + (TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))) (T.vertex (w'.castLT (Nat.lt_trans w'.isLt (Nat.succ_lt_succ + r_1.isLt))))) ∧ TashTreeMinimumBadPair G k e0 (TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ)))))) T → + let phi3 : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl + (T.vertex (⟨T.length - (1 : ℕ), + by omega + ⟩ : Fin (T.length + (1 : ℕ))))); beta ∈ MissingColors G phi3 (T.vertex (Fin.last T.length)) + := by + classical + intro V E _ _ _ G k e0 phi T hq hlast gamma r p hr hp hlastval hproper P hP_length v hv beta + hbeta_last Q alpha halpha_ne_beta mi hmq hswap phi3 + have houtside := @helper_houtside_414 V E inferInstance inferInstance inferInstance G k e0 phi T + hq hlast r p hr hp hlastval hproper hP_length v hv beta hbeta_last alpha halpha_ne_beta mi hmq + hswap + have hmiss := TwoColorComponentSwapMissingBehavior G phi alpha beta + halpha_ne_beta hproper + (Sum.inl (T.vertex ⟨T.length - 1, by omega⟩)) + dsimp only at hmiss + exact (hmiss.1 _ houtside) ▸ hbeta_last + +private theorem helper_branch_437.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [ Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) (hq : (2 : ℕ) < TashTreePathIndex G T) + (hlast : TashTreePathIndex G T = T.length) (gamma : Fin k) (r : Fin T.length) + (p : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) + (1 : ℕ) = T.length) + (hp : (↑p : ℕ) + (1 : ℕ) = T.length), + gamma ∈ PresentColors G phi (T.vertex p) → + ∀ (hlastval : (↑r : ℕ) = T.length - (1 : ℕ)), + (↑p : ℕ) = T.length - (1 : ℕ) → + let P : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => by omega); + ∀ (hP_length : P.length = T.length - (1 : ℕ)) (beta : Fin k), + let Q : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) => by omega); + ∀ (alpha : Fin k), + alpha ≠ gamma → + ∀ (_ : Fin (Q.length + (1 : ℕ))), + let phi3 : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex (⟨T.length - (1 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))))); + beta ≠ gamma → + gamma ∈ PresentColors G phi3 (T.vertex p) := by + classical + intro V E _ _ G k e0 phi T hq hlast gamma r p hr hp hpgamma hlastval hpval P hP_length beta Q + alpha halpha_ne_gamma mi phi3 hbeta_ne_gamma + let _ := Fintype.ofFinite V + have hp_eq : p = ⟨T.length - 1, by omega⟩ := by + apply Fin.ext + exact hpval + have hpold : gamma ∈ PresentColors G phi + (T.vertex ⟨T.length - 1, by omega⟩) := by + rw [hp_eq] at hpgamma + exact hpgamma + rcases (by simpa [PresentColors] using hpold) with ⟨e, he, hc⟩ + rw [hp_eq] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, he, by + by_cases hm : Sum.inr e ∈ TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex ⟨T.length - 1, by omega⟩)) + · dsimp [phi3] + simp [TwoColorComponentSwap, hc, hm, Ne.symm halpha_ne_gamma, + Ne.symm hbeta_ne_gamma] + · dsimp [phi3] + simp [TwoColorComponentSwap, hc, hm]⟩ + +private theorem helper_branch_128.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), TashTreeMinimumBadPair G k e0 phi T → + ∀ (hq : (2 : ℕ) < TashTreePathIndex G T) (hlast : TashTreePathIndex G T = T.length) (gamma : + Fin k) (r : Fin T.length) (p : Fin (T.length + (1 : ℕ))) (hr : (↑r : ℕ) + (1 : ℕ) = + T.length) (hp : (↑p : ℕ) + (1 : ℕ) = T.length), phi (T.edge r) = some gamma → gamma ∈ + PresentColors G phi (T.vertex p) → + ∀ (hlastval : (↑r : ℕ) = T.length - (1 : ℕ)), (↑p : ℕ) = T.length - (1 : ℕ) → TashTreeBadPair + G k e0 phi T → IsProperEdgeColoring G phi → + let P : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); P.length = T.length - (1 : ℕ) → TreeSequenceInitialSegment P T → ColoredVertexSetElementary + G phi (TreeSequenceVertexSet P) → + ∀ u ∈ TreeSequenceVertexSet T, + ∀ v ∈ TreeSequenceVertexSet T, u ≠ v → + ∀ beta ∈ MissingColors G phi u, beta ∈ MissingColors G phi v → ( + ∀ w ∈ TreeSequenceVertexSet T, w = T.vertex (Fin.last T.length) ∨ w ∈ TreeSequenceVertexSet P) + → beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)) → (¬ + ∃ (j : Fin (T.length + (1 : ℕ))), (↑j : ℕ) + (2 : ℕ) ≤ T.length ∧ beta ∈ MissingColors G phi + (T.vertex j)) → + ∃ (phi₃ : PartialEdgeColoring E k) (beta : Fin k) (j : Fin (T.length + (1 : ℕ))), + TashTreeMinimumBadPair G k e0 phi₃ T ∧ phi₃ (T.edge r) = some gamma ∧ gamma ∈ + PresentColors G phi₃ (T.vertex p) ∧ (↑j : ℕ) + (2 : ℕ) ≤ T.length ∧ beta ∈ MissingColors G + phi₃ (T.vertex j) ∧ beta ∈ MissingColors G phi₃ (T.vertex (Fin.last T.length)) := by + classical + intro V E _ _ _ G k e0 phi T hmin hq hlast gamma r p hr hp hrgamma hpgamma hlastval hpval hbad + hproper P hP_length hPprefix hPelementary u hu v hv huv beta hbu hbv hlast_or_prefix + hbeta_last hsmall + have hlast_index : ∀ i : Fin (T.length + 1), + beta ∈ MissingColors G phi (T.vertex i) → + i.val = T.length - 1 ∨ i.val = T.length := by + intro i hi + by_cases he : i.val = T.length + · exact Or.inr he + · left + by_contra hne + exact hsmall ⟨i, by omega, hi⟩ + have hbeta_pen := @helper_hbeta_pen_89 V E inferInstance inferInstance G k e0 phi T hq hlast r p + hr hp hlastval hP_length hPprefix hPelementary u hu v hv huv beta hbu hbv hlast_or_prefix + hlast_index + have hbeta_unused := @helper_hbeta_unused_158 V E inferInstance inferInstance inferInstance G k e0 + phi T hq hlast r p hr hp hlastval hbad hP_length hPelementary beta hbeta_pen + have hfree4 : 4 ≤ (TreeFreeColors phi + (TreeSequencePrefix T (T.length - 2) (by omega) (by omega))).card := + TashTreeFourUnusedColors G k e0 phi T hmin (T.length - 2) (by omega) (by omega) + let Q := TreeSequencePrefix T (T.length - 2) (by omega) (by omega) + have hfree4' : 4 ≤ (TreeFreeColors phi Q).card := by simpa [Q] using hfree4 + let freeMinusBeta := (TreeFreeColors phi Q).erase beta + have hfreeMinus : 3 ≤ freeMinusBeta.card := by + have hc : (TreeFreeColors phi Q).card - 1 ≤ freeMinusBeta.card := by + simpa [freeMinusBeta] using + (Finset.pred_card_le_card_erase : + (TreeFreeColors phi Q).card - 1 ≤ freeMinusBeta.card) + omega + let freeMinusGamma := freeMinusBeta.erase gamma + have hfreeMinusGamma : 2 ≤ freeMinusGamma.card := by + have hc : freeMinusBeta.card - 1 ≤ freeMinusGamma.card := by + simpa [freeMinusGamma] using + (Finset.pred_card_le_card_erase : freeMinusBeta.card - 1 ≤ freeMinusGamma.card) + omega + let edgeColor := (phi (T.edge ⟨T.length - 2, by omega⟩)).getD beta + let freeFinal := freeMinusGamma.erase edgeColor + have hfreeFinal : 1 ≤ freeFinal.card := by + have hc : freeMinusGamma.card - 1 ≤ freeFinal.card := by + simpa [freeFinal] using + (Finset.pred_card_le_card_erase : freeMinusGamma.card - 1 ≤ freeFinal.card) + omega + obtain ⟨alpha, halpha⟩ := Finset.card_pos.mp hfreeFinal + have halpha_ne_gamma : alpha ≠ gamma := + (Finset.mem_erase.mp (Finset.mem_erase.mp halpha).2).1 + have halpha_ne_edge : alpha ≠ edgeColor := (Finset.mem_erase.mp halpha).1 + have halpha_ne_beta : alpha ≠ beta := by + exact (Finset.mem_erase.mp (Finset.mem_erase.mp + (Finset.mem_erase.mp halpha).2).2).1 + have halpha_free : alpha ∈ TreeFreeColors phi Q := + (Finset.mem_erase.mp (Finset.mem_erase.mp + (Finset.mem_erase.mp halpha).2).2).2 + have halpha_missing : alpha ∈ TreeMissingColors phi Q := by + exact (Finset.mem_sdiff.mp halpha_free).1 + obtain ⟨m, hmQ, hma⟩ := by + rw [TreeMissingColors] at halpha_missing + simpa only [Finset.mem_biUnion] using halpha_missing + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hmQ + obtain ⟨mi, hmi⟩ := hmQ + have hmq : mi.val + 2 ≤ T.length := by + have hm_lt : mi.val < Q.length + 1 := mi.isLt + have hQlen : Q.length = T.length - 2 := rfl + omega + have hmaT : alpha ∈ MissingColors G phi (T.vertex + ⟨mi.val, by omega⟩) := by + have hqv := hmi + simp [Q] at hqv + have hQle : Q.length ≤ T.length := by + change T.length - 2 ≤ T.length + omega + have hqv' : T.vertex ⟨mi.val, by omega⟩ = m := by + simpa [Q, TreeSequencePrefix, Fin.castLE, Fin.castLT] using hmi + rw [hqv'] + exact hma + have halpha_unused := @helper_halpha_unused_246 V E inferInstance inferInstance G k e0 phi T hq + hlast gamma r p hr hp hrgamma hlastval hP_length beta alpha halpha_ne_gamma halpha_ne_edge + halpha_free mi + have hmi_lt : mi.val < T.length - 1 := by omega + have hswap := TashTreeControlledInterchange G k e0 phi T hmin + ⟨mi.val, by omega⟩ + ⟨T.length - 1, by show T.length - 1 < T.length + 1; omega⟩ + hmi_lt (by change T.length - 1 < T.length; omega) + alpha beta (by exact halpha_ne_beta) hmaT hbeta_pen halpha_unused hbeta_unused + dsimp only at hswap + let phi3 := TwoColorComponentSwap G phi alpha beta + (Sum.inl (T.vertex ⟨T.length - 1, by omega⟩)) + have hmin3 := hswap.2.2.2.2.2.2.2.2 + have hbeta_last3 := @helper_hbeta_last3_299 V E inferInstance inferInstance inferInstance G k e0 + phi T hq hlast gamma r p hr hp hlastval hproper hP_length v hv beta hbeta_last alpha + halpha_ne_beta mi hmq hswap + have hbeta_ne_gamma : beta ≠ gamma := by + intro he + subst beta + obtain ⟨ii, hii⟩ := T.attaches r + have hrs : r.succ = Fin.last T.length := by + apply Fin.ext + simpa using hr + have hinc : Incident G (T.vertex (Fin.last T.length)) (T.edge r) := by + rw [Incident, hii] + simp [hrs] + have hnotpresent : gamma ∉ PresentColors G phi (T.vertex (Fin.last T.length)) := by + simpa [MissingColors] using hbeta_last + apply hnotpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨T.edge r, hinc, hrgamma⟩ + refine ⟨phi3, beta, ⟨mi.val, by omega⟩, hmin3, ?_, ?_, hmq, + hswap.2.2.2.2.1, hbeta_last3⟩ + · have hr_eq : r = ⟨T.length - 1, by omega⟩ := by + apply Fin.ext + exact hlastval + rw [hr_eq] at hrgamma ⊢ + by_cases hm : Sum.inr (T.edge ⟨T.length - 1, by omega⟩) ∈ + TwoColorComponent G phi alpha beta + (Sum.inl (T.vertex ⟨T.length - 1, by omega⟩)) + · simp [phi3, TwoColorComponentSwap, hm, hrgamma, + Ne.symm halpha_ne_gamma, Ne.symm hbeta_ne_gamma] + · simp [phi3, TwoColorComponentSwap, hm, hrgamma] + · exact @helper_branch_437 V E inferInstance inferInstance G k e0 phi T hq hlast gamma r p hr + hp hpgamma hlastval hpval hP_length beta alpha halpha_ne_gamma mi hbeta_ne_gamma +theorem TashTreeLastIndexThirdNormalForm {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hlast : TashTreePathIndex G T = T.length) + (gamma : Fin k) (r : Fin T.length) (p : Fin (T.length + 1)) + (hr : r.val + 1 = T.length) (hp : p.val + 1 = T.length) + (hrgamma : phi (T.edge r) = some gamma) + (hpgamma : gamma ∈ PresentColors G phi (T.vertex p)) : + ∃ (phi₃ : PartialEdgeColoring E k) (beta : Fin k) (j : Fin (T.length + 1)), + TashTreeMinimumBadPair G k e0 phi₃ T ∧ + phi₃ (T.edge r) = some gamma ∧ + gamma ∈ PresentColors G phi₃ (T.vertex p) ∧ + j.val + 2 ≤ T.length ∧ + beta ∈ MissingColors G phi₃ (T.vertex j) ∧ + beta ∈ MissingColors G phi₃ (T.vertex (Fin.last T.length)) := by + classical + have hlen : 3 ≤ T.length := by omega + have hlastval : r.val = T.length - 1 := by omega + have hpval : p.val = T.length - 1 := by omega + have hbad := hmin.1 + have hproper := hbad.1.2.2.2.1 + have hnot := hbad.2.2 + let P : TreeSequence G e0 := + TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + have hP_length : P.length = T.length - 1 := by rfl + have hPprefix : TreeSequenceInitialSegment P T := by + refine ⟨by rw [hP_length]; omega, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have hPelementary : ColoredVertexSetElementary G phi + (TreeSequenceVertexSet P) := by + apply TashTreeProperPrefixElementary G k e0 phi T P hmin hPprefix + change T.length - 1 < T.length + omega + have hlastmem : T.vertex (Fin.last T.length) ∈ + TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet] + have hprefixmem (i : Fin (T.length + 1)) : + T.vertex i ∈ TreeSequenceVertexSet T := by + simp [TreeSequenceVertexSet] + have hcommon : ∃ u : V, u ∈ TreeSequenceVertexSet T ∧ + ∃ v : V, v ∈ TreeSequenceVertexSet T ∧ u ≠ v ∧ + ∃ c : Fin k, c ∈ MissingColors G phi u ∧ + c ∈ MissingColors G phi v := by + simp only [ColoredVertexSetElementary, not_forall, not_forall, not_forall] at hnot + rcases hnot with ⟨u, hu, v, hv, huv, hd⟩ + rcases Finset.not_disjoint_iff.mp hd with ⟨beta, hbu, hbv⟩ + exact ⟨u, hu, v, hv, huv, beta, hbu, hbv⟩ + obtain ⟨u, hu, v, hv, huv, beta, hbu, hbv⟩ := hcommon + have hlast_or_prefix (w : V) (hw : w ∈ TreeSequenceVertexSet T) : + w = T.vertex (Fin.last T.length) ∨ w ∈ TreeSequenceVertexSet P := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hw ⊢ + obtain ⟨i, hi⟩ := hw + by_cases hival : i.val = T.length + · left + rw [← hi] + congr 1 + exact Fin.ext hival + · right + let q : Fin (P.length + 1) := ⟨i.val, by rw [hP_length]; omega⟩ + refine ⟨q, ?_⟩ + have hq := hPprefix.2.1 q + have hqi : Fin.castLE (Nat.succ_le_succ hPprefix.1) q = i := by + apply Fin.ext + rfl + rw [hqi] at hq + exact hq.symm.trans hi + have hbeta_last : beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)) := by + rcases hlast_or_prefix u hu with huLast | huPrefix + · simpa [huLast] using hbu + · rcases hlast_or_prefix v hv with hvLast | hvPrefix + · simpa [hvLast] using hbv + · have hd := hPelementary huPrefix hvPrefix + (by intro he; exact huv (he ▸ rfl)) + exact (Finset.disjoint_left.mp hd) hbu hbv |>.elim + by_cases hsmall : ∃ j : Fin (T.length + 1), + j.val + 2 ≤ T.length ∧ + beta ∈ MissingColors G phi (T.vertex j) + · obtain ⟨j, hj, hbeta_j⟩ := hsmall + refine ⟨phi, beta, j, hmin, ?_, hpgamma, hj, hbeta_j, hbeta_last⟩ + simpa [hlastval] using hrgamma + · exact @helper_branch_128 V E inferInstance inferInstance inferInstance G k e0 phi T hmin hq + hlast gamma r p hr hp hrgamma hpgamma hlastval hpval hbad hproper hP_length hPprefix + hPelementary u hu v hv huv beta hbu hbv hlast_or_prefix hbeta_last hsmall +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeMinimumBadLengthAtLeastTwo.lean b/LeanPool/GoldbergSeymour/TashTreeMinimumBadLengthAtLeastTwo.lean new file mode 100644 index 0000000000..0a919159ce --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeMinimumBadLengthAtLeastTwo.lean @@ -0,0 +1,156 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair + +/-! +# Tash Tree Minimum Bad Length At Least Two + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeMinimumBadLengthAtLeastTwo {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) : + 2 ≤ T.length := by + classical + by_contra htwo + have hpositive : 1 ≤ T.length := T.positive + have hlength : T.length = 1 := by omega + have hbad : TashTreeBadPair G k e0 phi T := hmin.1 + have htriple : KTriple G k e0 phi := hbad.1 + have hproper : IsProperEdgeColoring G phi := htriple.2.2.2.1 + have hone : IsOneEdgeUncolored phi e0 := htriple.2.2.2.2 + let i0 : Fin (T.length + 1) := ⟨0, by omega⟩ + let i1 : Fin (T.length + 1) := ⟨1, by omega⟩ + let y0 : V := T.vertex i0 + let y1 : V := T.vertex i1 + have hi01 : i0 ≠ i1 := by + intro h + have := congrArg Fin.val h + simp [i0, i1] at this + have hy01 : y0 ≠ y1 := by + intro h + exact hi01 (T.vertex_injective h) + have hy0mem : y0 ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i0, rfl⟩ + have hy1mem : y1 ∈ TreeSequenceVertexSet T := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨i1, rfl⟩ + have hvertex_cases : ∀ {v : V}, v ∈ TreeSequenceVertexSet T → v = y0 ∨ v = y1 := by + intro v hv + rw [TreeSequenceVertexSet] at hv + rcases Finset.mem_image.mp hv with ⟨i, -, rfl⟩ + by_cases hi : i.val = 0 + · left + apply congrArg T.vertex + apply Fin.ext + simpa [i0] using hi + · right + apply congrArg T.vertex + apply Fin.ext + change i.val = 1 + omega + have hnot : ¬ ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := hbad.2.2 + unfold ColoredVertexSetElementary at hnot + have hpairs : ∃ u, u ∈ TreeSequenceVertexSet T ∧ ∃ v, v ∈ TreeSequenceVertexSet T ∧ + u ≠ v ∧ ¬ Disjoint (MissingColors G phi u) (MissingColors G phi v) := by + by_contra hnone + apply hnot + intro u hu v hv huv + by_contra hdis + exact hnone ⟨u, hu, v, hv, huv, hdis⟩ + rcases hpairs with ⟨u, hu, v, hv, huv, hdis⟩ + rw [Finset.disjoint_left] at hdis + push Not at hdis + rcases hdis with ⟨eta, hetau, hetav⟩ + have heta0 : eta ∈ MissingColors G phi y0 := by + rcases hvertex_cases hu with rfl | rfl + · exact hetau + · rcases hvertex_cases hv with hv0 | hv1 + · simpa [hv0] using hetav + · exact False.elim (huv (hv1.symm)) + have heta1 : eta ∈ MissingColors G phi y1 := by + rcases hvertex_cases hu with hu0 | hu1 + · rcases hvertex_cases hv with hv0 | hv1 + · exact False.elim (huv (hu0.trans hv0.symm)) + · simpa [hv1] using hetav + · simpa [hu1] using hetau + have hends : G.ends e0 = s(y1, y0) := by + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + have hizero : i = 0 := Fin.eq_zero i + rw [← T.first_edge, hi, hizero] + congr 1 + have endpoint_of_incident : ∀ {v : V}, Incident G v e0 → v = y1 ∨ v = y0 := by + intro v hv + simpa only [Incident, hends, Sym2.mem_iff] using hv + have no_eta_of_incident {v : V} (hv : v = y0 ∨ v = y1) {e : E} + (hve : Incident G v e) : phi e ≠ some eta := by + intro he + have hpresent : eta ∈ PresentColors G phi v := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hve, he⟩ + rcases hv with rfl | rfl + · have : eta ∉ PresentColors G phi y0 := by + simpa [MissingColors] using heta0 + exact this hpresent + · have : eta ∉ PresentColors G phi y1 := by + simpa [MissingColors] using heta1 + exact this hpresent + let psi : PartialEdgeColoring E k := fun e => if e = e0 then some eta else phi e + have hfull : IsFullEdgeColoring psi := by + intro e + by_cases he : e = e0 + · exact ⟨eta, by simp [psi, he]⟩ + · obtain ⟨c, hc⟩ := hone.2 e he + exact ⟨c, by simpa [psi, he] using hc⟩ + have hproperPsi : IsProperEdgeColoring G psi := by + intro e f c hef hadj hec + rcases hadj with ⟨v, hve, hvf⟩ + by_cases he0 : e = e0 + · subst e + have hf0 : f ≠ e0 := by + intro h + exact hef h.symm + have hetac : eta = c := by simpa [psi] using hec + have hvends := endpoint_of_incident hve + have hnocolor : phi f ≠ some eta := + no_eta_of_incident (hvends.elim Or.inr Or.inl) hvf + rw [← hetac] + simpa [psi, hf0] using hnocolor + · have hphie : phi e = some c := by simpa [psi, he0] using hec + by_cases hf0 : f = e0 + · subst f + have hvends := endpoint_of_incident hvf + have hnocolor : phi e ≠ some eta := + no_eta_of_incident (hvends.elim Or.inr Or.inl) hve + have hcne : c ≠ eta := by + intro h + subst c + exact hnocolor hphie + simp only [psi, ite_eq_left] + intro h + exact hcne (Option.some.inj h.symm) + · simpa [psi, hf0] using hproper hef ⟨v, hve, hvf⟩ hphie + have hkcoloring : HasKEdgeColoring G k := ⟨psi, hproperPsi, hfull⟩ + have hchromatic : ChromaticIndex G ≤ k := by + exact Nat.find_min' (ColoringExists G) hkcoloring + rw [htriple.2.1] at hchromatic + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeMinimumBadPair.lean b/LeanPool/GoldbergSeymour/TashTreeMinimumBadPair.lean new file mode 100644 index 0000000000..6e1b20033a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeMinimumBadPair.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeRankLess + +/-! +# Tash Tree Minimum Bad Pair + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A bad pair minimal in path index and then tree length. -/ +def TashTreeMinimumBadPair {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) : Prop := + TashTreeBadPair G k e0 phi T ∧ + ∀ {psi : PartialEdgeColoring E k} {S : TreeSequence G e0}, + TashTreeBadPair G k e0 psi S → ¬TashTreeRankLess G S T + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeMinimumBadPairExists.lean b/LeanPool/GoldbergSeymour/TashTreeMinimumBadPairExists.lean new file mode 100644 index 0000000000..2583eddcbe --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeMinimumBadPairExists.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair + +/-! +# Tash Tree Minimum Bad Pair Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeMinimumBadPairExists {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (htriple : KTriple G k e0 phi) (hT : TashkinovTree G e0 phi T) + (hbad : ¬ ColoredVertexSetElementary G phi (TreeSequenceVertexSet T)) : + ∃ psi : PartialEdgeColoring E k, ∃ S : TreeSequence G e0, + TashTreeMinimumBadPair G k e0 psi S := by + classical + let candidate : ℕ → ℕ → Prop := fun a b => + ∃ (psi : PartialEdgeColoring E k) (S : TreeSequence G e0), + TashTreeBadPair G k e0 psi S ∧ + TashTreePathIndex G S = a ∧ S.length = b + have candidateExists : ∃ a b, candidate a b := by + exact ⟨TashTreePathIndex G T, T.length, phi, T, + ⟨htriple, hT, hbad⟩, rfl, rfl⟩ + have firstExists : ∃ a, ∃ b, candidate a b := candidateExists + let first : ℕ := Nat.find firstExists + have firstSpec : ∃ b, candidate first b := Nat.find_spec firstExists + let second : ℕ := Nat.find firstSpec + have secondSpec : candidate first second := Nat.find_spec firstSpec + obtain ⟨psi, S, hbadPair, hpath, hlength⟩ := secondSpec + refine ⟨psi, S, hbadPair, ?_⟩ + intro psi' S' hbadPair' + unfold TashTreeRankLess + rw [hpath, hlength] + intro hrank + rcases hrank with hfirst | ⟨heq, hsecond⟩ + · have firstWitness : ∃ b, candidate (TashTreePathIndex G S') b := by + exact ⟨S'.length, psi', S', hbadPair', rfl, rfl⟩ + have hminimal := Nat.find_min' firstExists firstWitness + omega + · have secondWitness : candidate first S'.length := by + exact ⟨psi', S', hbadPair', heq, rfl⟩ + have hminimal := Nat.find_min' firstSpec secondWitness + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeMinimumBadPathIndex.lean b/LeanPool/GoldbergSeymour/TashTreeMinimumBadPathIndex.lean new file mode 100644 index 0000000000..f32d44d402 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeMinimumBadPathIndex.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadLengthAtLeastTwo + +public import LeanPool.GoldbergSeymour.TashTreePathIndexTwoReplacement +public import LeanPool.GoldbergSeymour.TashTreeRhoOneIterate +public import LeanPool.GoldbergSeymour.TashTreeRhoOneRepeatedColor +public import LeanPool.GoldbergSeymour.TashTreeRhoOneTerminalReplacement + +/-! +# Tash Tree Minimum Bad Path Index + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeMinimumBadPathIndex {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) : + 2 < TashTreePathIndex G T := by + classical + have hlen : 2 ≤ T.length := + TashTreeMinimumBadLengthAtLeastTwo G k e0 phi T hmin + have hpath : TashTreeSuffixPath G T (TashTreePathIndex G T) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + have hpos : 1 ≤ TashTreePathIndex G T := hpath.1 + by_contra hnot + have hle : TashTreePathIndex G T ≤ 2 := by omega + have hcases : TashTreePathIndex G T = 1 ∨ + TashTreePathIndex G T = 2 := by + omega + rcases hcases with hq | hq + · obtain ⟨beta, i, hi, hlast⟩ := + TashTreeRhoOneRepeatedColor G k e0 phi T hmin hlen hq + obtain ⟨psi, p, hp, hminPsi, hprev, hlastPsi⟩ := + TashTreeRhoOneIterate G k e0 phi T hmin hq beta i hi hlast + obtain ⟨hpos, hprefix, delta, j, phiStar, hdelta, hj, + hjMissing, hphiStar, hbad, hrank⟩ := + TashTreeRhoOneTerminalReplacement G k e0 psi T hminPsi hlen hq + beta p hp hprev hlastPsi + exact (hminPsi.2 hbad) hrank + · obtain ⟨S, hdisplay, hbad, hrank⟩ := + TashTreePathIndexTwoReplacement G k e0 phi T hmin hlen hq + exact (hmin.2 hbad) hrank + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeNoMinimumBadPair.lean b/LeanPool/GoldbergSeymour/TashTreeNoMinimumBadPair.lean new file mode 100644 index 0000000000..1d5534800c --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeNoMinimumBadPair.lean @@ -0,0 +1,46 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeCaseNoRepeatedOnPath +public import LeanPool.GoldbergSeymour.TashTreeCasePathIndexLast + +/-! +# Tash Tree No Minimum Bad Pair + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeNoMinimumBadPair {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) : False := by + classical + have hq := TashTreeMinimumBadPathIndex G k e0 phi T hmin + have hspec : TashTreeSuffixPath G T (TashTreePathIndex G T) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + by_cases hlast : TashTreePathIndex G T = T.length + · exact TashTreeCasePathIndexLast G k e0 phi T hmin hq hlast + · have hbefore : TashTreePathIndex G T < T.length := + Nat.lt_of_le_of_ne hspec.2.1 hlast + by_cases hrepeat : ∃ alpha : Fin k, ∃ i : Fin (T.length + 1), + TashTreePathIndex G T ≤ i.val ∧ i.val < T.length ∧ + alpha ∈ MissingColors G phi (T.vertex i) ∧ + alpha ∈ MissingColors G phi (T.vertex (Fin.last T.length)) + · exact TashTreeCaseRepeatedOnPath G k e0 phi T hmin hq hbefore hrepeat + · exact TashTreeCaseNoRepeatedOnPath G k e0 phi T hmin hq hbefore hrepeat + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeNoRepeatedDisjointReduction.lean b/LeanPool/GoldbergSeymour/TashTreeNoRepeatedDisjointReduction.lean new file mode 100644 index 0000000000..ffaed86d14 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeNoRepeatedDisjointReduction.lean @@ -0,0 +1,204 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeControlledRepeatedSuffixContradiction +public import LeanPool.GoldbergSeymour.TashTreeDisjointComponentNormalization + +/-! +# Tash Tree No Repeated Disjoint Reduction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeNoRepeatedDisjointReduction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hbefore : TashTreePathIndex G T < T.length) + (beta gamma epsilon : Fin k) + (hge : gamma ≠ beta) (heg : epsilon ≠ gamma) (heb : epsilon ≠ beta) + (i m : Fin (T.length + 1)) + (hi : i.val + 2 ≤ TashTreePathIndex G T) + (hm : m.val + 2 ≤ TashTreePathIndex G T) + (hbeta : beta ∈ MissingColors G phi (T.vertex i)) + (hlast : beta ∈ + MissingColors G phi (T.vertex (Fin.last T.length))) + (hepsilon : epsilon ∈ MissingColors G phi (T.vertex m)) + (hgamma : gamma ∈ MissingColors G phi + (T.vertex ⟨TashTreePathIndex G T, Nat.lt_succ_of_lt hbefore⟩)) + (hgammaUnused : TreeColorUnusedThrough phi T gamma + ⟨TashTreePathIndex G T, Nat.lt_succ_of_lt hbefore⟩) + (hepsilonUnused : TreeColorUnusedThrough phi T epsilon + ⟨TashTreePathIndex G T, Nat.lt_succ_of_lt hbefore⟩) + (havoid : ∀ s : Fin (T.length + 1), + s.val + 1 ≤ TashTreePathIndex G T → + Sum.inl (T.vertex s) ∉ + TwoColorComponent G phi epsilon beta + (Sum.inl (T.vertex (Fin.last T.length)))) : False := by + classical + let qn := TashTreePathIndex G T + let q : Fin (T.length + 1) := ⟨qn, Nat.lt_succ_of_lt hbefore⟩ + let p : Fin (T.length + 1) := ⟨qn - 1, by omega⟩ + let pr : Fin T.length := ⟨qn - 1, by omega⟩ + have hmin0 := hmin + rcases hmin with ⟨hbad, hminimal⟩ + rcases hbad with ⟨htriple, htree, hnon⟩ + rcases htriple with ⟨hcritical, hchromatic, hdegree, hproper, hone⟩ + let z : Sum V E := Sum.inl (T.vertex (Fin.last T.length)) + let C := TwoColorComponent G phi epsilon beta z + have hvertices : ∀ s : Fin (T.length + 1), s.val ≤ p.val → + Sum.inl (T.vertex s) ∉ C := by + intro s hs + exact havoid s (by dsimp [p, qn] at *; omega) + have hedgeAvoid : ∀ r : Fin T.length, r.val < p.val → + Sum.inr (T.edge r) ∉ C := by + intro r hr heC + rcases T.attaches r with ⟨a, ha⟩ + let s : Fin (T.length + 1) := + ⟨a.val, by omega⟩ + have hinc : Incident G (T.vertex s) (T.edge r) := by + have hs : s = Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ r.isLt)) := + Fin.ext (by rfl) + rw [hs, Incident, ha] + simp + by_cases hcol : phi (T.edge r) = some epsilon ∨ + phi (T.edge r) = some beta + · have hsC : Sum.inl (T.vertex s) ∈ C := by + change Sum.inl (T.vertex s) ∈ + ((TwoColorIncidenceGraph G phi epsilon beta).connectedComponentMk z).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have hadj : (TwoColorIncidenceGraph G phi epsilon beta).Adj + (Sum.inl (T.vertex s)) (Sum.inr (T.edge r)) := by + simp [TwoColorIncidenceGraph, hinc, hcol] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans heC + apply hvertices s + · dsimp [s, p, pr, qn] + have ha_le : a.val ≤ r.val := Nat.le_of_lt_succ a.isLt + have hr' : r.val < qn - 1 := by simpa [p] using hr + omega + · exact hsC + · let H := TwoColorIncidenceGraph G phi epsilon beta + have hno : ∀ x, H.Reachable (Sum.inr (T.edge r)) x → + x = Sum.inr (T.edge r) := by + intro x hx + rw [H.reachable_iff_reflTransGen] at hx + induction hx with + | refl => rfl + | tail h ha ih => + subst ih + rename_i c + cases c <;> simp [H, TwoColorIncidenceGraph, hcol] at ha + have hrch : H.Reachable (Sum.inr (T.edge r)) z := by + apply SimpleGraph.ConnectedComponent.eq.mp + exact heC + have heq := hno _ hrch + have hz : Sum.inl (T.vertex (Fin.last T.length)) = + Sum.inr (T.edge r) := by simp [z] at heq + exact Sum.inl_ne_inr hz + have hcut : Sum.inr (T.edge pr) ∉ C := by + intro heC + rcases T.attaches pr with ⟨a, ha⟩ + let s : Fin (T.length + 1) := + ⟨a.val, by omega⟩ + have hinc : Incident G (T.vertex s) (T.edge pr) := by + have hs : s = Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ pr.isLt)) := + Fin.ext (by rfl) + rw [hs, Incident, ha] + simp + by_cases hcol : phi (T.edge pr) = some epsilon ∨ + phi (T.edge pr) = some beta + · have hsC : Sum.inl (T.vertex s) ∈ C := by + change Sum.inl (T.vertex s) ∈ + ((TwoColorIncidenceGraph G phi epsilon beta).connectedComponentMk z).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have hadj : (TwoColorIncidenceGraph G phi epsilon beta).Adj + (Sum.inl (T.vertex s)) (Sum.inr (T.edge pr)) := by + simp [TwoColorIncidenceGraph, hinc, hcol] + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans heC + exact hvertices s (by + dsimp [s, p, qn] + have ha_le : a.val ≤ pr.val := Nat.le_of_lt_succ a.isLt + omega) hsC + · let H := TwoColorIncidenceGraph G phi epsilon beta + have hno : ∀ x, H.Reachable (Sum.inr (T.edge pr)) x → + x = Sum.inr (T.edge pr) := by + intro x hx + rw [H.reachable_iff_reflTransGen] at hx + induction hx with + | refl => rfl + | tail h ha ih => + subst ih + rename_i c + cases c <;> simp [H, TwoColorIncidenceGraph, hcol] at ha + have hrch : H.Reachable (Sum.inr (T.edge pr)) z := by + apply SimpleGraph.ConnectedComponent.eq.mp + exact heC + have heq := hno _ hrch + have hz : Sum.inl (T.vertex (Fin.last T.length)) = + Sum.inr (T.edge pr) := by simp [z] at heq + exact Sum.inl_ne_inr hz + have hnorm := TashTreeDisjointComponentNormalization G k e0 phi T + hmin0 p m i + (by dsimp [p, qn]; omega) (by dsimp [p, qn]; omega) + (by dsimp [p, qn]; omega) epsilon beta heb hepsilon hbeta hlast + (by intro s hs; exact hvertices s hs) + (by intro r hr; exact hedgeAvoid r hr) + dsimp only at hnorm + rcases hnorm with ⟨hmin', hfixed, hepsilon', hlast'⟩ + have hcut' : TwoColorComponentSwap G phi epsilon beta z (T.edge pr) = + phi (T.edge pr) := by + simp [TwoColorComponentSwap, hcut, z, C] + have hepsilonUnused' : TreeColorUnusedThrough + (TwoColorComponentSwap G phi epsilon beta z) T epsilon q := by + intro r hr1 hrq + by_cases hsmall : r.val < p.val + · rw [hfixed r hsmall] + exact hepsilonUnused r hr1 hrq + · change r.val < qn at hrq + change ¬ r.val < qn - 1 at hsmall + have heq : r.val = pr.val := by dsimp [pr]; omega + have hrp : r = pr := Fin.ext heq + rw [hrp, hcut'] + have hh := hepsilonUnused r hr1 hrq + simpa [hrp] using hh + have hgammaUnused' : TreeColorUnusedThrough + (TwoColorComponentSwap G phi epsilon beta z) T gamma q := by + intro r hr1 hrq + by_cases hsmall : r.val < p.val + · rw [hfixed r hsmall] + exact hgammaUnused r hr1 hrq + · change r.val < qn at hrq + change ¬ r.val < qn - 1 at hsmall + have heq : r.val = pr.val := by dsimp [pr]; omega + have hrp : r = pr := Fin.ext heq + rw [hrp, hcut'] + have hh := hgammaUnused r hr1 hrq + simpa [hrp] using hh + have hgamma' : gamma ∈ MissingColors G + (TwoColorComponentSwap G phi epsilon beta z) (T.vertex q) := by + have hb := TwoColorComponentSwapMissingBehavior G phi epsilon beta heb hproper z + dsimp only at hb + exact (hb.2.2.2 (T.vertex q) gamma (by exact heg.symm) (by exact hge)).2 hgamma + apply TashTreeControlledRepeatedSuffixContradiction G k e0 + (TwoColorComponentSwap G phi epsilon beta z) T hmin' hq hbefore m q + (by dsimp [q, qn]; omega) (by exact hbefore) (by dsimp [q, qn]; omega) + epsilon gamma heg hepsilon' hgamma' hepsilonUnused' hgammaUnused' + exact hlast' + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeNoRepeatedIntersectionShortening.lean b/LeanPool/GoldbergSeymour/TashTreeNoRepeatedIntersectionShortening.lean new file mode 100644 index 0000000000..d23357e540 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeNoRepeatedIntersectionShortening.lean @@ -0,0 +1,329 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreePathIndex +public import LeanPool.GoldbergSeymour.TashTreeRankLess +public import LeanPool.GoldbergSeymour.TashTreeSuffixPath +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentTashkinovSplice + +/-! +# Tash Tree No Repeated Intersection Shortening + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem TashTreeNoRepeatedIntersectionShortening_branch_72.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), TashTreeMinimumBadPair G k e0 phi T → 2 < TashTreePathIndex G T → TashTreePathIndex + G T < T.length → + ∀ (beta epsilon : Fin k), epsilon ≠ beta → + ∀ (i m : Fin (T.length + 1)), ↑i + 2 ≤ TashTreePathIndex G T → ↑m + 2 ≤ TashTreePathIndex G T + → beta ∈ MissingColors G phi (T.vertex i) → beta ∈ MissingColors G phi (T.vertex (Fin.last + T.length)) → epsilon ∈ MissingColors G phi (T.vertex m) → ( + ∃ (s : Fin (T.length + 1)), ↑s + 1 ≤ TashTreePathIndex G T ∧ Sum.inl (T.vertex s) ∈ + TwoColorComponent G phi epsilon beta (Sum.inl (T.vertex (Fin.last T.length)))) → ( + ∀ (q : ℕ) (hq : 1 ≤ q) (hqT : q ≤ T.length), TashkinovTree G e0 phi (TreeSequencePrefix T q hq + hqT)) → IsProperEdgeColoring G phi → ( + ∃ (t : Fin (T.length + 1)), ↑t + 2 ≤ TashTreePathIndex G T ∧ Sum.inl (T.vertex t) ∈ + TwoColorComponent G phi epsilon beta (Sum.inl (T.vertex (Fin.last T.length)))) → False := by + classical + intro V E _ _ _ G k e0 phi T hmin hq hbefore beta epsilon hne i m hi hm hbeta hlast hepsilon + hmeets hTashPrefix hproper hsmall + let S := TreeSequencePrefix T (TashTreePathIndex G T - 2) (by omega) + (by omega) + rcases hsmall with ⟨s, hs, hsm⟩ + have hq3 : 3 ≤ TashTreePathIndex G T := by omega + have hqT : TashTreePathIndex G T - 2 ≤ T.length := by omega + have hSlen : S.length = TashTreePathIndex G T - 2 := rfl + have hiS : T.vertex i ∈ TreeSequenceVertexSet S := by + rw [TreeSequenceVertexSet] + refine Finset.mem_image.mpr ⟨Fin.castLT i (by omega), + Finset.mem_univ _, ?_⟩ + rfl + have hmS : T.vertex m ∈ TreeSequenceVertexSet S := by + rw [TreeSequenceVertexSet] + refine Finset.mem_image.mpr ⟨Fin.castLT m (by omega), + Finset.mem_univ _, ?_⟩ + rfl + have hlastOut : T.vertex (Fin.last T.length) ∉ TreeSequenceVertexSet S := by + intro hlastIn + rw [TreeSequenceVertexSet] at hlastIn + rcases Finset.mem_image.mp hlastIn with ⟨j, hj, heq⟩ + have hv : (Fin.castLE (Nat.succ_le_succ hqT) j : Fin (T.length + 1)) = + Fin.last T.length := by + apply T.vertex_injective + simpa [S, TreeSequencePrefix] using heq + have hvval := congrArg Fin.val hv + simp only [Fin.castLE, Fin.last] at hvval + omega + have hbetaS : beta ∈ TreeMissingColors phi S := by + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨T.vertex i, hiS, hbeta⟩ + have hepsilonS : epsilon ∈ TreeMissingColors phi S := by + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨T.vertex m, hmS, hepsilon⟩ + have hmeetS : ∃ u ∈ TreeSequenceVertexSet S, + Sum.inl u ∈ TwoColorComponent G phi epsilon beta + (Sum.inl (T.vertex (Fin.last T.length))) := by + refine ⟨T.vertex s, ?_, hsm⟩ + rw [TreeSequenceVertexSet] + refine Finset.mem_image.mpr ⟨Fin.castLT s (by omega), + Finset.mem_univ _, ?_⟩ + rfl + obtain ⟨u, S', hu, hucomp, hSS', hlength, haugment, hlastVertex, hsplice⟩ := + TwoColorComponentTashkinovSplice G phi S epsilon beta + (T.vertex (Fin.last T.length)) hproper hne hepsilonS hbetaS + hlastOut hmeetS + have hTashS : TashkinovTree G e0 phi S := hTashPrefix _ (by omega) (by omega) + have hTashS' := TashkinovAugmentationSequencePreservesTashkinovTree + G e0 phi S S' hTashS haugment + have hnotElementary : ¬ ColoredVertexSetElementary G phi + (TreeSequenceVertexSet S') := by + intro he + have hv' : T.vertex i ∈ TreeSequenceVertexSet S' := by + rw [TreeSequenceVertexSet] + let ii : Fin (S.length + 1) := Fin.castLT i (by omega) + refine Finset.mem_image.mpr ⟨Fin.castLE (Nat.succ_le_succ hSS'.1) ii, + Finset.mem_univ _, ?_⟩ + rw [hSS'.2.1] + rfl + have hy' : T.vertex (Fin.last T.length) ∈ TreeSequenceVertexSet S' := by + rw [← hlastVertex, TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨Fin.last S'.length, Finset.mem_univ _, rfl⟩ + have hvne : T.vertex i ≠ T.vertex (Fin.last T.length) := by + intro hvEq + have hvEq' := T.vertex_injective hvEq + have hvVal : i.val = T.length := by simpa using congrArg Fin.val hvEq' + omega + exact (Finset.disjoint_left.mp (he hv' hy' hvne)) hbeta hlast + have hbad : TashTreeBadPair G k e0 phi S' := ⟨hmin.1.1, hTashS', hnotElementary⟩ + have hsuffix : TashTreeSuffixPath G S' (TashTreePathIndex G T - 1) := by + refine ⟨by omega, by omega, ?_⟩ + intro r hr + have hrbase : S.length ≤ r.val := by omega + have hrne : r.val ≠ S.length := by omega + have hrne' : r.val ≠ TashTreePathIndex G T - 2 := by omega + simpa [hSlen, hrne'] using (hsplice r hrbase).2.2.2.2 + have hidx : TashTreePathIndex G S' ≤ TashTreePathIndex G T - 1 := by + unfold TashTreePathIndex + exact Nat.find_min' _ hsuffix + apply (hmin.2 hbad) + left + omega + +private theorem TashTreeNoRepeatedIntersectionShortening_branch_153.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), TashTreeMinimumBadPair G k e0 phi T → 2 < TashTreePathIndex G T → TashTreePathIndex + G T < T.length → + ∀ (beta epsilon : Fin k), epsilon ≠ beta → + ∀ (i m : Fin (T.length + 1)), ↑i + 2 ≤ TashTreePathIndex G T → ↑m + 2 ≤ TashTreePathIndex G T + → beta ∈ MissingColors G phi (T.vertex i) → beta ∈ MissingColors G phi (T.vertex (Fin.last + T.length)) → epsilon ∈ MissingColors G phi (T.vertex m) → ( + ∃ (s : Fin (T.length + 1)), ↑s + 1 ≤ TashTreePathIndex G T ∧ Sum.inl (T.vertex s) ∈ + TwoColorComponent G phi epsilon beta (Sum.inl (T.vertex (Fin.last T.length)))) → ( + ∀ (q : ℕ) (hq : 1 ≤ q) (hqT : q ≤ T.length), TashkinovTree G e0 phi (TreeSequencePrefix T q hq + hqT)) → IsProperEdgeColoring G phi → (¬ + ∃ (t : Fin (T.length + 1)), ↑t + 2 ≤ TashTreePathIndex G T ∧ Sum.inl (T.vertex t) ∈ + TwoColorComponent G phi epsilon beta (Sum.inl (T.vertex (Fin.last T.length)))) → False := by + classical + intro V E _ _ _ G k e0 phi T hmin hq hbefore beta epsilon hne i m hi hm hbeta hlast hepsilon + hmeets hTashPrefix hproper hsmall + rcases hmeets with ⟨s, hs, hsm⟩ + have havoid : + ∀ t : Fin (T.length + 1), t.val + 2 ≤ TashTreePathIndex G T → Sum.inl (T.vertex t) ∉ + TwoColorComponent G phi epsilon beta (Sum.inl (T.vertex (Fin.last T.length))) := by + intro t ht htc + apply hsmall + exact ⟨t, ht, htc⟩ + have hsLast : s.val + 1 = TashTreePathIndex G T := by + have hqone : TashTreePathIndex G T - 1 + 1 = TashTreePathIndex G T := by omega + have hsnot : ¬ s.val + 2 ≤ TashTreePathIndex G T := by + intro hh + exact havoid s hh hsm + omega + let S := TreeSequencePrefix T (TashTreePathIndex G T - 1) (by omega) (by omega) + have hq3 : 3 ≤ TashTreePathIndex G T := by omega + have hqT : TashTreePathIndex G T - 1 ≤ T.length := by omega + have hiBound : i.val < S.length + 1 := by change i.val < TashTreePathIndex G T - 1 + 1; omega + have hmBound : m.val < S.length + 1 := by change m.val < TashTreePathIndex G T - 1 + 1; omega + have hsBound : s.val < S.length + 1 := by change s.val < TashTreePathIndex G T - 1 + 1; omega + have hiS : T.vertex i ∈ TreeSequenceVertexSet S := by + rw [TreeSequenceVertexSet] + refine Finset.mem_image.mpr ⟨Fin.castLT i hiBound, + Finset.mem_univ _, ?_⟩ + rfl + have hmS : T.vertex m ∈ TreeSequenceVertexSet S := by + rw [TreeSequenceVertexSet] + refine Finset.mem_image.mpr ⟨Fin.castLT m hmBound, + Finset.mem_univ _, ?_⟩ + rfl + have hlastOut : T.vertex (Fin.last T.length) ∉ TreeSequenceVertexSet S := by + intro hlastIn + rw [TreeSequenceVertexSet] at hlastIn + rcases Finset.mem_image.mp hlastIn with ⟨j, hj, heq⟩ + have hv : (Fin.castLE (Nat.succ_le_succ hqT) j : Fin (T.length + 1)) = + Fin.last T.length := by + apply T.vertex_injective + simpa [S, TreeSequencePrefix] using heq + have hvval := congrArg Fin.val hv + simp only [Fin.castLE, Fin.last] at hvval + omega + have hbetaS : beta ∈ TreeMissingColors phi S := by + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨T.vertex i, hiS, hbeta⟩ + have hepsilonS : epsilon ∈ TreeMissingColors phi S := by + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨T.vertex m, hmS, hepsilon⟩ + have hmeetS : ∃ u ∈ TreeSequenceVertexSet S, + Sum.inl u ∈ TwoColorComponent G phi epsilon beta + (Sum.inl (T.vertex (Fin.last T.length))) := by + refine ⟨T.vertex s, ?_, hsm⟩ + rw [TreeSequenceVertexSet] + refine Finset.mem_image.mpr ⟨Fin.castLT s hsBound, + Finset.mem_univ _, ?_⟩ + rfl + obtain ⟨u, S', hu, hucomp, hSS', hlength, haugment, hlastVertex, hsplice⟩ := + TwoColorComponentTashkinovSplice G phi S epsilon beta + (T.vertex (Fin.last T.length)) hproper hne hepsilonS hbetaS + hlastOut hmeetS + have hTashS : TashkinovTree G e0 phi S := hTashPrefix _ (by omega) (by omega) + have hTashS' := TashkinovAugmentationSequencePreservesTashkinovTree + G e0 phi S S' hTashS haugment + have hbad : TashTreeBadPair G k e0 phi S' := by + refine ⟨hmin.1.1, hTashS', ?_⟩ + intro he + have hv' : T.vertex i ∈ TreeSequenceVertexSet S' := by + rw [TreeSequenceVertexSet] + let ii : Fin (S.length + 1) := Fin.castLT i (by omega) + refine Finset.mem_image.mpr ⟨Fin.castLE (Nat.succ_le_succ hSS'.1) ii, + Finset.mem_univ _, ?_⟩ + rw [hSS'.2.1] + rfl + have hy' : T.vertex (Fin.last T.length) ∈ TreeSequenceVertexSet S' := by + rw [← hlastVertex, TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨Fin.last S'.length, Finset.mem_univ _, rfl⟩ + have hvne : T.vertex i ≠ T.vertex (Fin.last T.length) := by + intro hvEq + have hvEq' := T.vertex_injective hvEq + have hvVal : i.val = T.length := by simpa using congrArg Fin.val hvEq' + omega + exact (Finset.disjoint_left.mp (he hv' hy' hvne)) hbeta hlast + have huLast : u = S.vertex (Fin.last S.length) := by + rw [TreeSequenceVertexSet] at hu + rcases Finset.mem_image.mp hu with ⟨j, hj, hjEq⟩ + by_contra hneLast + have hjne : j.val ≠ S.length := by + intro heq + apply hneLast + rw [← hjEq] + congr 1 + apply Fin.ext + exact heq + have hjbound : j.val + 2 ≤ TashTreePathIndex G T := by + have hjlt := j.isLt + change j.val < TashTreePathIndex G T - 1 + 1 at hjlt + have hqone : TashTreePathIndex G T - 1 + 1 = TashTreePathIndex G T := by omega + rw [← hqone] at hjlt + change j.val ≠ TashTreePathIndex G T - 1 at hjne + omega + apply havoid (Fin.castLT j (by omega)) hjbound + rw [← hjEq] at hucomp + simpa [S, TreeSequencePrefix, Fin.castLE, Fin.castLT] using hucomp + have hsuffix : TashTreeSuffixPath G S' (TashTreePathIndex G T - 1) := by + refine ⟨by omega, by omega, ?_⟩ + intro r hr + have hrbase : S.length ≤ r.val := by + change TashTreePathIndex G T - 1 ≤ r.val + exact hr + by_cases hrfirst : r.val = S.length + · have hrEq : r.castSucc = Fin.castLE (Nat.succ_le_succ hSS'.1) (Fin.last S.length) := by + apply Fin.ext + simp only [Fin.castSucc, Fin.castLE, Fin.last] + exact hrfirst + have hfirst := (hsplice r hrbase).2.2.2.2 + rw [hrfirst] at hfirst + have hvertex : S'.vertex r.castSucc = u := by + rw [hrEq, hSS'.2.1, huLast] + rw [hvertex] + simpa [hrfirst] using hfirst + · have hrne' : r.val ≠ TashTreePathIndex G T - 1 := by + intro heq + apply hrfirst + exact heq + simpa [hrne', hrfirst] using (hsplice r hrbase).2.2.2.2 + have hidx : TashTreePathIndex G S' ≤ TashTreePathIndex G T - 1 := by + unfold TashTreePathIndex + exact Nat.find_min' _ hsuffix + apply (hmin.2 hbad) + left + omega + +theorem TashTreeNoRepeatedIntersectionShortening {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : 2 < TashTreePathIndex G T) + (hbefore : TashTreePathIndex G T < T.length) + (beta epsilon : Fin k) (hne : epsilon ≠ beta) + (i m : Fin (T.length + 1)) + (hi : i.val + 2 ≤ TashTreePathIndex G T) + (hm : m.val + 2 ≤ TashTreePathIndex G T) + (hbeta : beta ∈ MissingColors G phi (T.vertex i)) + (hlast : beta ∈ + MissingColors G phi (T.vertex (Fin.last T.length))) + (hepsilon : epsilon ∈ MissingColors G phi (T.vertex m)) + (hmeets : ∃ s : Fin (T.length + 1), + s.val + 1 ≤ TashTreePathIndex G T ∧ + Sum.inl (T.vertex s) ∈ + TwoColorComponent G phi epsilon beta + (Sum.inl (T.vertex (Fin.last T.length)))) : + False := by + classical + have hTashPrefix : ∀ (q : ℕ) (hq : 1 ≤ q) (hqT : q ≤ T.length), + TashkinovTree G e0 phi (TreeSequencePrefix T q hq hqT) := by + intro q hq hqT j hj + rcases hmin.1.2.1 (Fin.castLE hqT j) hj with + ⟨r, c, hcolor, hmissing⟩ + refine ⟨r, c, ?_, ?_⟩ + · exact hcolor + · exact hmissing + have hproper : IsProperEdgeColoring G phi := hmin.1.1.2.2.2.1 + by_cases hsmall : ∃ t : Fin (T.length + 1), + t.val + 2 ≤ TashTreePathIndex G T ∧ + Sum.inl (T.vertex t) ∈ TwoColorComponent G phi epsilon beta + (Sum.inl (T.vertex (Fin.last T.length))) + · exact @TashTreeNoRepeatedIntersectionShortening_branch_72 V E inferInstance inferInstance + inferInstance G k e0 phi T hmin hq hbefore beta epsilon hne i m hi hm hbeta hlast hepsilon + hmeets hTashPrefix hproper hsmall + · exact @TashTreeNoRepeatedIntersectionShortening_branch_153 V E inferInstance inferInstance + inferInstance G k e0 phi T hmin hq hbefore beta epsilon hne i m hi hm hbeta hlast hepsilon + hmeets hTashPrefix hproper hsmall +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreePathIndex.lean b/LeanPool/GoldbergSeymour/TashTreePathIndex.lean new file mode 100644 index 0000000000..fbcccf0607 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreePathIndex.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Nat.Find + +public import LeanPool.GoldbergSeymour.TashTreeSuffixPath + +/-! +# Tash Tree Path Index + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The least positive position after which the remaining tree sequence is a path. -/ +noncomputable def TashTreePathIndex {V E : Type*} (G : LooplessMultigraph V E) {e0 : E} + (T : TreeSequence G e0) : ℕ := by + classical + exact Nat.find (show ∃ q, TashTreeSuffixPath G T q by + refine ⟨T.length, T.positive, le_rfl, ?_⟩ + intro i hi + exact (Nat.not_lt_of_ge hi i.isLt).elim) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreePathIndexTwoReplacement.lean b/LeanPool/GoldbergSeymour/TashTreePathIndexTwoReplacement.lean new file mode 100644 index 0000000000..446e8ddab1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreePathIndexTwoReplacement.lean @@ -0,0 +1,265 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreePathIndex +public import LeanPool.GoldbergSeymour.TashTreeRankLess +public import LeanPool.GoldbergSeymour.TashTreeSuffixPath +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tash Tree Path Index Two Replacement + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hedgeOne_67.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (T : TreeSequence G e0) (hlen : (2 : ℕ) ≤ T.length), + TashTreePathIndex G T = (2 : ℕ) → + let z : Fin (T.length + (1 : ℕ)) := (⟨(0 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))); + TashTreeSuffixPath G T (2 : ℕ) → + G.ends (T.edge (⟨(1 : ℕ), by omega⟩ : Fin T.length)) = + s(T.vertex (⟨(2 : ℕ), by omega⟩ : Fin (T.length + (1 : ℕ))), T.vertex z) := by + classical + intro V E G e0 T hlen hq z hsuffix2 + rcases T.attaches ⟨1, by omega⟩ with ⟨i, hi⟩ + by_cases hi0 : i.val = 0 + · rw [hi] + apply (Sym2.eq_iff).2 + left + constructor + · congr 1 + · congr 1 + apply Fin.ext + simpa [z] using hi0 + · have hilimit : i.val < 2 := by simp + have hi1 : i.val = 1 := by omega + have hbadEdge : + G.ends (T.edge ⟨1, by omega⟩) = + s(T.vertex ⟨1, by omega⟩, T.vertex ⟨2, by omega⟩) := by + rw [hi] + apply (Sym2.eq_iff).2 + right + constructor <;> congr 1; apply Fin.ext; simp [hi1] + have hsuffix1 : TashTreeSuffixPath G T 1 := by + refine ⟨by omega, by omega, ?_⟩ + intro j hj + by_cases hj1 : j.val = 1 + · have hjeq : j = ⟨1, by omega⟩ := Fin.ext hj1 + rw [hjeq] + exact hbadEdge + · exact hsuffix2.2.2 j (by omega) + have hle : TashTreePathIndex G T ≤ 1 := by + unfold TashTreePathIndex + exact Nat.find_min' _ hsuffix1 + omega + +theorem TashTreePathIndexTwoReplacement {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hlen : 2 ≤ T.length) (hq : TashTreePathIndex G T = 2) : + ∃ S : TreeSequence G e0, + (∃ hST : S.length = T.length, + (∀ r : Fin S.length, S.edge r = T.edge (Fin.cast hST r)) ∧ + S.vertex ⟨0, Nat.zero_lt_succ S.length⟩ = T.vertex ⟨1, by omega⟩ ∧ + S.vertex ⟨1, by omega⟩ = T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ ∧ + (∀ r : Fin (S.length + 1), + 2 ≤ r.val → + S.vertex r = T.vertex (Fin.cast (congrArg (fun n => n + 1) hST) r))) ∧ + TashTreeBadPair G k e0 phi S ∧ TashTreeRankLess G S T := by + classical + let z : Fin (T.length + 1) := ⟨0, by omega⟩ + let o : Fin (T.length + 1) := ⟨1, by omega⟩ + have hswapZ : Equiv.swap z o z = o := Equiv.swap_apply_left z o + have hswapO : Equiv.swap z o o = z := Equiv.swap_apply_right z o + have hswapLater (r : Fin (T.length + 1)) (hr : 2 ≤ r.val) : + Equiv.swap z o r = r := by + apply Equiv.swap_apply_of_ne_of_ne + · intro h + have hz : r.val = 0 := by simpa [z] using congrArg Fin.val h + omega + · intro h + have ho : r.val = 1 := by simpa [o] using congrArg Fin.val h + omega + have hspecT : TashTreeSuffixPath G T (TashTreePathIndex G T) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + have hsuffix2 : TashTreeSuffixPath G T 2 := by + simpa [hq] using hspecT + have hedgeOne := @helper_hedgeOne_67 (@V) (@E) (@G) (@e0) (@T) (@hlen) (@hq) (@hsuffix2) + let S : TreeSequence G e0 := + { length := T.length + positive := T.positive + vertex := fun r => T.vertex (Equiv.swap z o r) + edge := T.edge + vertex_injective := by + intro a b hab + exact (Equiv.swap z o).injective (T.vertex_injective hab) + edge_injective := T.edge_injective + first_edge := T.first_edge + attaches := by + intro j + by_cases hj0 : j.val = 0 + · have hj : j = ⟨0, T.positive⟩ := Fin.ext hj0 + rw [hj] + rcases T.attaches ⟨0, T.positive⟩ with ⟨i, hi⟩ + have hi0 : i = 0 := Fin.eq_zero i + subst i + refine ⟨0, ?_⟩ + rw [hi] + apply (Sym2.eq_iff).2 + right + constructor + · change T.vertex ⟨1, by omega⟩ = T.vertex (Equiv.swap z o z) + rw [hswapZ] + · change T.vertex z = T.vertex (Equiv.swap z o o) + rw [hswapO] + · by_cases hj1 : j.val = 1 + · have hj : j = ⟨1, by omega⟩ := Fin.ext hj1 + rw [hj] + refine ⟨⟨1, by omega⟩, ?_⟩ + rw [hedgeOne] + apply (Sym2.eq_iff).2 + left + constructor + · congr 1 + · change T.vertex z = T.vertex (Equiv.swap z o o) + rw [hswapO] + · refine ⟨⟨j.val, by omega⟩, ?_⟩ + rw [hsuffix2.2.2 j (by omega)] + apply (Sym2.eq_iff).2 + right + constructor + · congr 1 + rw [hswapLater] + · apply Fin.ext; rfl + change 2 ≤ j.val + omega + · congr 1 + rw [hswapLater] + change 2 ≤ j.val + 1 + omega } + have hlength : S.length = T.length := rfl + have hedge (r : Fin S.length) : S.edge r = T.edge (Fin.cast hlength r) := rfl + have hvertexZero : + S.vertex ⟨0, Nat.zero_lt_succ S.length⟩ = T.vertex ⟨1, by omega⟩ := by + change T.vertex (Equiv.swap z o z) = T.vertex o + rw [hswapZ] + have hvertexOne : + S.vertex ⟨1, by omega⟩ = T.vertex ⟨0, Nat.zero_lt_succ T.length⟩ := by + change T.vertex (Equiv.swap z o o) = T.vertex z + rw [hswapO] + have hvertexLater (r : Fin (S.length + 1)) (hr : 2 ≤ r.val) : + S.vertex r = T.vertex + (Fin.cast (congrArg (fun n => n + 1) hlength) r) := by + change T.vertex (Equiv.swap z o r) = T.vertex r + rw [hswapLater r hr] + have hTash : TashkinovTree G e0 phi S := by + intro j hj + rcases hmin.1.2.1 j hj with ⟨i, c, hcolor, hmissing⟩ + let old : Fin (T.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) + let new : Fin (T.length + 1) := Equiv.swap z o old + have hnewBound : new.val < j.val + 1 := by + simp only [new, Equiv.swap_apply_def] + split_ifs with hz ho + · simp [o] + omega + · simp [z] + · simp [old] + let i' : Fin (j.val + 1) := ⟨new.val, hnewBound⟩ + refine ⟨i', c, ?_, ?_⟩ + · exact hcolor + · have hv : S.vertex + (Fin.castLT i' (Nat.lt_trans i'.isLt (Nat.succ_lt_succ j.isLt))) = + T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) := by + have hcast : + Fin.castLT i' (Nat.lt_trans i'.isLt (Nat.succ_lt_succ j.isLt)) = new := by + apply Fin.ext + rfl + change T.vertex (Equiv.swap z o + (Fin.castLT i' (Nat.lt_trans i'.isLt + (Nat.succ_lt_succ j.isLt)))) = T.vertex old + rw [hcast] + apply congrArg T.vertex + exact Equiv.swap_apply_self z o old + rw [hv] + exact hmissing + have hvertexSet : TreeSequenceVertexSet S = TreeSequenceVertexSet T := by + apply Finset.ext + intro v + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + constructor + · rintro ⟨r, rfl⟩ + exact ⟨Equiv.swap z o r, rfl⟩ + · rintro ⟨r, rfl⟩ + refine ⟨Equiv.swap z o r, ?_⟩ + change T.vertex (Equiv.swap z o (Equiv.swap z o r)) = T.vertex r + rw [Equiv.swap_apply_self] + have hbadS : TashTreeBadPair G k e0 phi S := by + refine ⟨hmin.1.1, hTash, ?_⟩ + simpa [hvertexSet] using hmin.1.2.2 + have hsuffixS : TashTreeSuffixPath G S 1 := by + refine ⟨by omega, by simpa [S] using T.positive, ?_⟩ + intro j hj + by_cases hj1 : j.val = 1 + · change G.ends (T.edge j) = + s(T.vertex (Equiv.swap z o j.castSucc), + T.vertex (Equiv.swap z o j.succ)) + have hjeq : j = ⟨1, by omega⟩ := Fin.ext hj1 + rw [hjeq, hedgeOne] + apply (Sym2.eq_iff).2 + right + constructor + · congr 1 + · congr 1 + · have hj2 : 2 ≤ j.val := by omega + change G.ends (T.edge j) = + s(T.vertex (Equiv.swap z o j.castSucc), + T.vertex (Equiv.swap z o j.succ)) + rw [hsuffix2.2.2 j hj2] + congr 1 + · congr 1 + rw [hswapLater] + change 2 ≤ j.val + omega + · congr 1 + rw [hswapLater] + change 2 ≤ j.val + 1 + omega + have hindexSLe : TashTreePathIndex G S ≤ 1 := by + unfold TashTreePathIndex + exact Nat.find_min' _ hsuffixS + have hspecS : TashTreeSuffixPath G S (TashTreePathIndex G S) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + have hindexS : TashTreePathIndex G S = 1 := + Nat.le_antisymm hindexSLe hspecS.1 + refine ⟨S, ⟨hlength, hedge, hvertexZero, hvertexOne, hvertexLater⟩, + hbadS, ?_⟩ + left + rw [hindexS, hq] + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeProperInitialSegmentRankLess.lean b/LeanPool/GoldbergSeymour/TashTreeProperInitialSegmentRankLess.lean new file mode 100644 index 0000000000..28e558e730 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeProperInitialSegmentRankLess.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeRankLess + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment + +/-! +# Tash Tree Proper Initial Segment Rank Less + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeProperInitialSegmentRankLess {V E : Type*} + (G : LooplessMultigraph V E) {e0 : E} (S T : TreeSequence G e0) + (hprefix : TreeSequenceInitialSegment S T) + (hproper : S.length < T.length) : TashTreeRankLess G S T := by + classical + rcases hprefix with ⟨hlen, hvertex, hedge⟩ + have hspecS : TashTreeSuffixPath G S (TashTreePathIndex G S) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + have hspecT : TashTreeSuffixPath G T (TashTreePathIndex G T) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + let q := TashTreePathIndex G T + have hpathSBound : TashTreePathIndex G S ≤ S.length := hspecS.2.1 + by_cases hshort : S.length < q + · left + exact hpathSBound.trans_lt hshort + · have hqS : q ≤ S.length := Nat.le_of_not_gt hshort + have hsuffixS : TashTreeSuffixPath G S q := by + refine ⟨hspecT.1, hqS, ?_⟩ + intro i hi + rw [← hedge i, ← hvertex i.castSucc, ← hvertex i.succ] + exact hspecT.2.2 (Fin.castLE hlen i) hi + have hindexLe : TashTreePathIndex G S ≤ q := by + unfold TashTreePathIndex + exact Nat.find_min' _ hsuffixS + rcases hindexLe.eq_or_lt with heq | hlt + · right + exact ⟨heq, hproper⟩ + · left + exact hlt + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeProperPrefixElementary.lean b/LeanPool/GoldbergSeymour/TashTreeProperPrefixElementary.lean new file mode 100644 index 0000000000..3400032943 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeProperPrefixElementary.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment + +/-! +# Tash Tree Proper Prefix Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeProperPrefixElementary {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T S : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hprefix : TreeSequenceInitialSegment S T) (hproper : S.length < T.length) : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet S) := by + classical + rcases hmin with ⟨hbadT, hminimal⟩ + rcases hprefix with ⟨hlen, hvertex, hedge⟩ + rcases hbadT with ⟨htriple, hTashT, hnotElementaryT⟩ + have hTashS : TashkinovTree G e0 phi S := by + intro j hj + rcases hTashT (Fin.castLE hlen j) hj with ⟨i, c, hcolor, hmissing⟩ + refine ⟨i, c, ?_, ?_⟩ + · rw [← hedge j] + exact hcolor + · rw [← hvertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)))] + exact hmissing + have hspecS : TashTreeSuffixPath G S (TashTreePathIndex G S) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + have hspecT : TashTreeSuffixPath G T (TashTreePathIndex G T) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + have hrank : TashTreeRankLess G S T := by + let q := TashTreePathIndex G T + have hpathSBound : TashTreePathIndex G S ≤ S.length := hspecS.2.1 + by_cases hshort : S.length < q + · left + exact hpathSBound.trans_lt hshort + · have hqS : q ≤ S.length := Nat.le_of_not_gt hshort + have hsuffixS : TashTreeSuffixPath G S q := by + refine ⟨hspecT.1, hqS, ?_⟩ + intro i hi + rw [← hedge i, ← hvertex i.castSucc, ← hvertex i.succ] + exact hspecT.2.2 (Fin.castLE hlen i) hi + have hindexLe : TashTreePathIndex G S ≤ q := by + unfold TashTreePathIndex + exact Nat.find_min' _ hsuffixS + rcases hindexLe.eq_or_lt with heq | hlt + · right + exact ⟨heq, hproper⟩ + · left + exact hlt + by_contra hnotElementaryS + have hbadS : TashTreeBadPair G k e0 phi S := + ⟨htriple, hTashS, hnotElementaryS⟩ + exact (hminimal hbadS) hrank + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeRankLess.lean b/LeanPool/GoldbergSeymour/TashTreeRankLess.lean new file mode 100644 index 0000000000..3acaff0da8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeRankLess.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreePathIndex + +/-! +# Tash Tree Rank Less + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Lexicographic order by suffix-path index and then tree length. -/ +def TashTreeRankLess {V E : Type*} (G : LooplessMultigraph V E) {e0 : E} (S T : TreeSequence G e0) : + Prop := + TashTreePathIndex G S < TashTreePathIndex G T ∨ + (TashTreePathIndex G S = TashTreePathIndex G T ∧ S.length < T.length) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeRhoOneAdvance.lean b/LeanPool/GoldbergSeymour/TashTreeRhoOneAdvance.lean new file mode 100644 index 0000000000..6678095cc4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeRhoOneAdvance.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeSuffixAdvance + +/-! +# Tash Tree Rho One Advance + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeRhoOneAdvance {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : TashTreePathIndex G T = 1) (beta : Fin k) + (i : Fin T.length) (hiNext : i.val + 1 < T.length) + (hi : beta ∈ MissingColors G phi (T.vertex i.castSucc)) + (hlast : beta ∈ MissingColors G phi + (T.vertex (Fin.last T.length))) : + ∃ phi' : PartialEdgeColoring E k, + TashTreeMinimumBadPair G k e0 phi' T ∧ + beta ∈ MissingColors G phi' (T.vertex i.succ) ∧ + beta ∈ MissingColors G phi' + (T.vertex (Fin.last T.length)) := by + apply TashTreeSuffixAdvance G k e0 phi T hmin beta i + · by_cases hiZero : i.val = 0 + · exact Or.inl hiZero + · exact Or.inr (by omega) + · exact hiNext + · exact hi + · exact hlast + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeRhoOneIterate.lean b/LeanPool/GoldbergSeymour/TashTreeRhoOneIterate.lean new file mode 100644 index 0000000000..c364418334 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeRhoOneIterate.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeRhoOneAdvance + +/-! +# Tash Tree Rho One Iterate + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeRhoOneIterate {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hq : TashTreePathIndex G T = 1) (beta : Fin k) + (i : Fin T.length) + (hi : beta ∈ MissingColors G phi (T.vertex i.castSucc)) + (hlast : beta ∈ MissingColors G phi + (T.vertex (Fin.last T.length))) : + ∃ (psi : PartialEdgeColoring E k) (p : Fin T.length), + p.val + 1 = T.length ∧ + TashTreeMinimumBadPair G k e0 psi T ∧ + beta ∈ MissingColors G psi (T.vertex p.castSucc) ∧ + beta ∈ MissingColors G psi + (T.vertex (Fin.last T.length)) := by + have iterate : + ∀ (d : ℕ) (coloring : _) (j : Fin T.length), T.length - (j.val + 1) = d → + TashTreeMinimumBadPair G k e0 coloring T → beta ∈ MissingColors G coloring (T.vertex + j.castSucc) → beta ∈ MissingColors G coloring (T.vertex (Fin.last T.length)) → + ∃ (nextColoring : _) (p : Fin T.length), p.val + 1 = T.length ∧ TashTreeMinimumBadPair G k e0 + nextColoring T ∧ beta ∈ MissingColors G nextColoring (T.vertex p.castSucc) ∧ beta ∈ + MissingColors G nextColoring (T.vertex (Fin.last T.length)) := by + intro d + induction d using Nat.strong_induction_on with + | h d smaller => + intro coloring j hd hbad hj hlast' + by_cases hnext : j.val + 1 < T.length + · let nextIndex : Fin T.length := ⟨j.val + 1, hnext⟩ + obtain ⟨coloring', hbad', hj', hlast''⟩ := + TashTreeRhoOneAdvance G k e0 coloring T hbad hq beta j hnext hj hlast' + have hnextval : nextIndex.val = j.val + 1 := by + rfl + have hsmaller : T.length - (nextIndex.val + 1) < d := by + omega + have htransport : beta ∈ MissingColors G coloring' + (T.vertex nextIndex.castSucc) := by + simpa [nextIndex, Fin.succ] using hj' + exact smaller (T.length - (nextIndex.val + 1)) hsmaller coloring' nextIndex + rfl hbad' htransport hlast'' + · have hterminal : j.val + 1 = T.length := by + omega + refine ⟨coloring, j, hterminal, hbad, hj, hlast'⟩ + exact iterate (T.length - (i.val + 1)) phi i rfl hmin hi hlast + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeRhoOneRepeatedColor.lean b/LeanPool/GoldbergSeymour/TashTreeRhoOneRepeatedColor.lean new file mode 100644 index 0000000000..864ac8c263 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeRhoOneRepeatedColor.lean @@ -0,0 +1,143 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary + +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +/-! +# Tash Tree Rho One Repeated Color + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeRhoOneRepeatedColor {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hlen : 2 ≤ T.length) (_ : TashTreePathIndex G T = 1) : + ∃ beta : Fin k, ∃ i : Fin T.length, + beta ∈ MissingColors G phi (T.vertex i.castSucc) ∧ + beta ∈ MissingColors G phi (T.vertex (Fin.last T.length)) := by + classical + let q := T.length - 1 + have hqpos : 1 ≤ q := by omega + have hqle : q ≤ T.length := Nat.sub_le _ _ + let S := TreeSequencePrefix T q hqpos hqle + have hprefix : TreeSequenceInitialSegment S T := by + unfold TreeSequenceInitialSegment + refine ⟨?_, ?_, ?_⟩ + · change q ≤ T.length + exact hqle + · intro i + dsimp [S, TreeSequencePrefix] + · intro j + dsimp [S, TreeSequencePrefix] + have helemS : ColoredVertexSetElementary G phi (TreeSequenceVertexSet S) := + TashTreeProperPrefixElementary G k e0 phi T S hmin hprefix (by + change q < T.length + omega) + have hnot : ¬ ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := hmin.1.2.2 + unfold ColoredVertexSetElementary at hnot + have hbad : ∃ u, u ∈ TreeSequenceVertexSet T ∧ ∃ v, v ∈ TreeSequenceVertexSet T ∧ + u ≠ v ∧ ¬ Disjoint (MissingColors G phi u) (MissingColors G phi v) := by + by_contra hnone + apply hnot + intro u hu v hv huv + by_contra hdis + apply hnone + exact ⟨u, hu, v, hv, huv, hdis⟩ + rcases hbad with ⟨u, hu, v, hv, huv, hdis⟩ + have hbadDis := hdis + rw [Finset.disjoint_left] at hdis + push Not at hdis + rcases hdis with ⟨beta, hbu, hbv⟩ + have huindex : ∃ a : Fin (T.length + 1), T.vertex a = u := by + simpa [TreeSequenceVertexSet] using (Finset.mem_image.mp hu) + have hvindex : ∃ a : Fin (T.length + 1), T.vertex a = v := by + simpa [TreeSequenceVertexSet] using (Finset.mem_image.mp hv) + have outsideLast : ∀ {w : V} (a : Fin (T.length + 1)), + T.vertex a = w → w ∉ TreeSequenceVertexSet S → + a = Fin.last T.length := by + intro w a haw hwa + by_contra hneq + have hval : a.val ≠ T.length := by + intro hh + apply hneq + apply Fin.ext + exact hh + have halt : a.val < T.length := by + omega + apply hwa + rw [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + have hsmall : a.val < q + 1 := by omega + refine ⟨⟨a.val, hsmall⟩, Finset.mem_univ _, ?_⟩ + have hidx : Fin.castLE (Nat.succ_le_succ hqle) + ⟨a.val, hsmall⟩ = a := by + apply Fin.ext + rfl + dsimp [S, TreeSequencePrefix] + simpa [hidx] using haw + have prefixIndex : ∀ {w : V}, w ∈ TreeSequenceVertexSet S → + ∃ i : Fin T.length, T.vertex i.castSucc = w := by + intro w hw + rw [TreeSequenceVertexSet] at hw + rcases Finset.mem_image.mp hw with ⟨c, -, hc⟩ + have hcq : c.val < q + 1 := by + simpa [S, TreeSequencePrefix] using c.isLt + have hct : c.val < T.length := by + omega + let i : Fin T.length := ⟨c.val, hct⟩ + refine ⟨i, ?_⟩ + calc + T.vertex i.castSucc = S.vertex c := by + dsimp [S, TreeSequencePrefix] + congr 1 + _ = w := hc + by_cases hus : u ∈ TreeSequenceVertexSet S + · have hvs : v ∉ TreeSequenceVertexSet S := by + intro hmem + exact hbadDis (helemS hus hmem huv) + obtain ⟨i, hi⟩ := prefixIndex hus + obtain ⟨b, hb⟩ := hvindex + have hbLast : b = Fin.last T.length := outsideLast b hb hvs + refine ⟨beta, i, ?_, ?_⟩ + · rw [hi] + exact hbu + · rw [← hb, hbLast] at hbv + exact hbv + · have hvs : v ∈ TreeSequenceVertexSet S := by + by_contra hmem + obtain ⟨a, ha⟩ := huindex + obtain ⟨b, hb⟩ := hvindex + have haLast : a = Fin.last T.length := outsideLast a ha hus + have hbLast : b = Fin.last T.length := outsideLast b hb hmem + apply huv + calc + u = T.vertex a := ha.symm + _ = T.vertex b := by rw [haLast, hbLast] + _ = v := hb + obtain ⟨i, hi⟩ := prefixIndex hvs + obtain ⟨a, ha⟩ := huindex + have haLast : a = Fin.last T.length := outsideLast a ha hus + refine ⟨beta, i, ?_, ?_⟩ + · rw [hi] + exact hbv + · rw [← ha, haLast] at hbu + exact hbu + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeRhoOneTerminalReplacement.lean b/LeanPool/GoldbergSeymour/TashTreeRhoOneTerminalReplacement.lean new file mode 100644 index 0000000000..086021052b --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeRhoOneTerminalReplacement.lean @@ -0,0 +1,50 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeSuffixTerminalReplacement + +/-! +# Tash Tree Rho One Terminal Replacement + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeRhoOneTerminalReplacement {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hlen : 2 ≤ T.length) (hq : TashTreePathIndex G T = 1) + (beta : Fin k) (p : Fin T.length) (hp : p.val + 1 = T.length) + (hprev : beta ∈ MissingColors G phi (T.vertex p.castSucc)) + (hlast : beta ∈ MissingColors G phi + (T.vertex (Fin.last T.length))) : + ∃ (hpos : 1 ≤ p.val) (hle : p.val ≤ T.length) + (delta : Fin k) (j : Fin (p.val + 1)) + (phiStar : PartialEdgeColoring E k), + phi (T.edge p) = some delta ∧ + j.val < p.val ∧ + delta ∈ MissingColors G phi + (T.vertex (Fin.castLT j (by omega))) ∧ + phiStar = (fun e => if e = T.edge p then some beta else phi e) ∧ + TashTreeBadPair G k e0 phiStar + (TreeSequencePrefix T p.val hpos hle) ∧ + TashTreeRankLess G (TreeSequencePrefix T p.val hpos hle) T := by + have hbound : TashTreePathIndex G T ≤ p.val := by + omega + exact TashTreeSuffixTerminalReplacement G k e0 phi T hmin hlen beta p + hbound hp hprev hlast + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeSuffixAdvance.lean b/LeanPool/GoldbergSeymour/TashTreeSuffixAdvance.lean new file mode 100644 index 0000000000..4eaf731379 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeSuffixAdvance.lean @@ -0,0 +1,285 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreePathIndex +public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary +public import LeanPool.GoldbergSeymour.TashTreeSuffixPath +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# Tash Tree Suffix Advance + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem TashTreeSuffixAdvance_hbetaUnused_131.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (beta : Fin k) (i : Fin + T.length), (↑i : ℕ) = 0 ∨ TashTreePathIndex G T ≤ (↑i : ℕ) → beta ∈ MissingColors G phi + (T.vertex i.castSucc) → TashkinovTree G e0 phi T → + ∀ (hprefixPositive : 1 ≤ (↑i : ℕ) + 1) (hprefixLe : (↑i : ℕ) + 1 ≤ T.length), + let P := TreeSequencePrefix T ((↑i : ℕ) + 1) hprefixPositive hprefixLe; + ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) → T.vertex i.castSucc ∈ + TreeSequenceVertexSet P → TreeColorUnusedThrough phi T beta i.succ := by + classical + intro V E _ _ G k e0 phi T beta i hiSuffix hi hTash hprefixPositive hprefixLe P hPelem hiP + let _ := Fintype.ofFinite V + by_cases hiZero : i.val = 0 + · intro r hrPositive hrBefore + have hrBefore' : r.val < i.val + 1 := by + simpa only [Fin.val_succ] using hrBefore + omega + · have hiPositive : 1 ≤ i.val := by omega + have hiAtOrAfter : TashTreePathIndex G T ≤ i.val := + hiSuffix.resolve_left hiZero + have hpathAtIndex : + TashTreeSuffixPath G T (TashTreePathIndex G T) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + intro r hrPositive hrBefore hrbeta + have hrBefore' : r.val < i.val + 1 := by + simpa only [Fin.val_succ] using hrBefore + by_cases hrEarlier : r.val < i.val + · rcases hTash r hrPositive with ⟨w, c, hc, hw⟩ + have hcbeta : c = beta := Option.some.inj (hc.symm.trans hrbeta) + subst c + let wt : Fin (T.length + 1) := + Fin.castLT w (Nat.lt_trans w.isLt (Nat.succ_lt_succ r.isLt)) + have hwP : T.vertex wt ∈ TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + let wp : Fin (P.length + 1) := ⟨w.val, by + change w.val < i.val + 1 + 1 + omega⟩ + refine ⟨wp, Finset.mem_univ _, ?_⟩ + apply congrArg T.vertex + apply Fin.ext + rfl + have hwne : T.vertex wt ≠ T.vertex i.castSucc := by + intro hv + have hwt_lt : wt < i.castSucc := by + change w.val < i.val + omega + exact (Fin.ne_of_lt hwt_lt) (T.vertex_injective hv) + have hdisjoint := hPelem hwP hiP hwne + exact (Finset.disjoint_left.mp hdisjoint) hw hi + · have hri : r = i := by + apply Fin.ext + omega + subst r + have hends := hpathAtIndex.2.2 i hiAtOrAfter + have hincident : Incident G (T.vertex i.castSucc) (T.edge i) := by + change T.vertex i.castSucc ∈ G.ends (T.edge i) + rw [hends] + exact Sym2.mem_mk_left _ _ + have hnotPresent : beta ∉ PresentColors G phi (T.vertex i.castSucc) := by + simpa [MissingColors] using hi + exact hnotPresent (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨T.edge i, hincident, hrbeta⟩) + +theorem TashTreeSuffixAdvance {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (beta : Fin k) (i : Fin T.length) + (hiSuffix : i.val = 0 ∨ TashTreePathIndex G T ≤ i.val) + (hiNext : i.val + 1 < T.length) + (hi : beta ∈ MissingColors G phi (T.vertex i.castSucc)) + (hlast : beta ∈ MissingColors G phi + (T.vertex (Fin.last T.length))) : + ∃ phi' : PartialEdgeColoring E k, + TashTreeMinimumBadPair G k e0 phi' T ∧ + beta ∈ MissingColors G phi' (T.vertex i.succ) ∧ + beta ∈ MissingColors G phi' (T.vertex (Fin.last T.length)) := by + classical + have hdegree : MaximumDegree G + 1 ≤ k := hmin.1.1.2.2.1 + have hproper : IsProperEdgeColoring G phi := hmin.1.1.2.2.2.1 + have hTash : TashkinovTree G e0 phi T := hmin.1.2.1 + obtain ⟨gamma, hgamma⟩ := + MissingColorsNonemptyOfMaximumDegree G phi hdegree (T.vertex i.succ) + have hprefixPositive : 1 ≤ i.val + 1 := by omega + have hprefixLe : i.val + 1 ≤ T.length := Nat.le_of_lt hiNext + let P := TreeSequencePrefix T (i.val + 1) hprefixPositive hprefixLe + have hPprefix : TreeSequenceInitialSegment P T := by + refine ⟨hprefixLe, ?_, ?_⟩ + · intro r + rfl + · intro r + rfl + have hPproper : P.length < T.length := by + exact hiNext + have hPelem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet P) := + TashTreeProperPrefixElementary G k e0 phi T P hmin hPprefix hPproper + have hiP : T.vertex i.castSucc ∈ TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + let ip : Fin (P.length + 1) := ⟨i.val, by + change i.val < i.val + 1 + 1 + omega⟩ + refine ⟨ip, Finset.mem_univ _, ?_⟩ + apply congrArg T.vertex + apply Fin.ext + rfl + have hnextP : T.vertex i.succ ∈ TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + let jp : Fin (P.length + 1) := ⟨i.val + 1, by + change i.val + 1 < i.val + 1 + 1 + omega⟩ + refine ⟨jp, Finset.mem_univ _, ?_⟩ + apply congrArg T.vertex + apply Fin.ext + rfl + have hvertexNext : T.vertex i.castSucc ≠ T.vertex i.succ := by + intro hv + have hindex := congrArg Fin.val (T.vertex_injective hv) + simp at hindex + have hne : beta ≠ gamma := by + intro hbg + have hdisjoint := hPelem hiP hnextP hvertexNext + exact (Finset.disjoint_left.mp hdisjoint) (by simpa [hbg] using hi) hgamma + have hgammaUnused : TreeColorUnusedThrough phi T gamma i.succ := by + intro r hrPositive hrBefore hrgamma + have hrBefore' : r.val < i.val + 1 := by + simpa only [Fin.val_succ] using hrBefore + rcases hTash r hrPositive with ⟨w, c, hc, hw⟩ + have hcgamma : c = gamma := Option.some.inj (hc.symm.trans hrgamma) + subst c + let wt : Fin (T.length + 1) := + Fin.castLT w (Nat.lt_trans w.isLt (Nat.succ_lt_succ r.isLt)) + have hwP : T.vertex wt ∈ TreeSequenceVertexSet P := by + rw [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + let wp : Fin (P.length + 1) := ⟨w.val, by + change w.val < i.val + 1 + 1 + omega⟩ + refine ⟨wp, Finset.mem_univ _, ?_⟩ + apply congrArg T.vertex + apply Fin.ext + rfl + have hwne : T.vertex wt ≠ T.vertex i.succ := by + intro hv + have hwt_lt : wt < i.succ := by + change w.val < i.val + 1 + omega + exact (Fin.ne_of_lt hwt_lt) (T.vertex_injective hv) + have hdisjoint := hPelem hwP hnextP hwne + exact (Finset.disjoint_left.mp hdisjoint) hw hgamma + have hbetaUnused : TreeColorUnusedThrough phi T beta i.succ := by + exact @TashTreeSuffixAdvance_hbetaUnused_131 V E inferInstance inferInstance G k e0 phi T + beta i hiSuffix hi hTash hprefixPositive hprefixLe hPelem hiP + have hcontrolled := TashTreeControlledInterchange G k e0 phi T hmin + i.castSucc i.succ (show i.castSucc < i.succ from Fin.castSucc_lt_succ) + hiNext beta gamma hne hi hgamma hbetaUnused hgammaUnused + dsimp only at hcontrolled + rcases hcontrolled with + ⟨hpath, hiComponent, hiSubsingleton, hnextSubsingleton, + _hgammaAtI, hbetaAtNext, _hearly, _hlater, hminimum⟩ + let C := TwoColorComponent G phi beta gamma (Sum.inl (T.vertex i.succ)) + let phi' := TwoColorComponentSwap G phi beta gamma (Sum.inl (T.vertex i.succ)) + have hlastNeI : T.vertex (Fin.last T.length) ≠ T.vertex i.castSucc := by + intro hv + have hindex := congrArg Fin.val (T.vertex_injective hv) + simp at hindex + omega + have hlastNeNext : T.vertex (Fin.last T.length) ≠ T.vertex i.succ := by + intro hv + have hindex := congrArg Fin.val (T.vertex_injective hv) + simp at hindex + omega + have hlastSubsingleton : Set.Subsingleton + ((TwoColorIncidenceGraph G phi beta gamma).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))) := by + let : Fintype + ((TwoColorIncidenceGraph G phi beta gamma).neighborSet + (Sum.inl (T.vertex (Fin.last T.length)))) := Fintype.ofFinite _ + have hlastDegree := MissingColorIncidenceEndpoint G phi beta gamma hne + hproper (T.vertex (Fin.last T.length)) hlast + have hcard : + ((TwoColorIncidenceGraph G phi beta gamma).neighborFinset + (Sum.inl (T.vertex (Fin.last T.length)))).card ≤ 1 := by + rw [SimpleGraph.card_neighborFinset_eq_degree] + exact hlastDegree + intro x hx y hy + exact (Finset.card_le_one.mp hcard) x + (by simpa [SimpleGraph.mem_neighborFinset] using hx) y + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + obtain ⟨a, b, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G phi beta gamma hproper + (Sum.inl (T.vertex i.succ)) + have support_of_component {x : Sum V E} (hx : x ∈ C) : x ∈ p.support := by + change x ∈ {y | y ∈ p.support} + rw [hsupport] + exact hx + have endpoint_of_subsingleton {x : Sum V E} (hxC : x ∈ C) + (hxSub : Set.Subsingleton + ((TwoColorIncidenceGraph G phi beta gamma).neighborSet x)) : + x = a ∨ x = b := by + by_contra hend + push Not at hend + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hend.1 hend.2 hxSub) (support_of_component hxC) + have hnextComponent : Sum.inl (T.vertex i.succ) ∈ C := by + change Sum.inl (T.vertex i.succ) ∈ + ((TwoColorIncidenceGraph G phi beta gamma).connectedComponentMk + (Sum.inl (T.vertex i.succ))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + have hiEnd := endpoint_of_subsingleton hiComponent hiSubsingleton + have hnextEnd := endpoint_of_subsingleton hnextComponent hnextSubsingleton + have endpoint_is_i_or_next {x : Sum V E} (hx : x = a ∨ x = b) : + x = Sum.inl (T.vertex i.castSucc) ∨ x = Sum.inl (T.vertex i.succ) := by + rcases hiEnd with hia | hib + · rcases hnextEnd with hja | hjb + · exact False.elim (hvertexNext (Sum.inl.inj (hia.trans hja.symm))) + · rcases hx with hxa | hxb + · exact Or.inl (hxa.trans hia.symm) + · exact Or.inr (hxb.trans hjb.symm) + · rcases hnextEnd with hja | hjb + · rcases hx with hxa | hxb + · exact Or.inr (hxa.trans hja.symm) + · exact Or.inl (hxb.trans hib.symm) + · exact False.elim (hvertexNext (Sum.inl.inj (hib.trans hjb.symm))) + have hlastOutside : Sum.inl (T.vertex (Fin.last T.length)) ∉ C := by + intro hlastComponent + have hlastEnd := endpoint_of_subsingleton hlastComponent hlastSubsingleton + rcases endpoint_is_i_or_next hlastEnd with hli | hln + · exact hlastNeI (Sum.inl.inj hli) + · exact hlastNeNext (Sum.inl.inj hln) + have hbehavior := TwoColorComponentSwapMissingBehavior G phi beta gamma hne + hproper (Sum.inl (T.vertex i.succ)) + dsimp only at hbehavior + have hbetaAtLast : beta ∈ MissingColors G phi' + (T.vertex (Fin.last T.length)) := by + rw [hbehavior.1 _ hlastOutside] + exact hlast + exact ⟨phi', hminimum, hbetaAtNext, hbetaAtLast⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeSuffixIterate.lean b/LeanPool/GoldbergSeymour/TashTreeSuffixIterate.lean new file mode 100644 index 0000000000..8243598da4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeSuffixIterate.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashTreeSuffixAdvance + +/-! +# Tash Tree Suffix Iterate + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashTreeSuffixIterate {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (beta : Fin k) (i : Fin T.length) + (hiSuffix : TashTreePathIndex G T ≤ i.val) + (hi : beta ∈ MissingColors G phi (T.vertex i.castSucc)) + (hlast : beta ∈ MissingColors G phi + (T.vertex (Fin.last T.length))) : + ∃ (psi : PartialEdgeColoring E k) (p : Fin T.length), + p.val + 1 = T.length ∧ + TashTreePathIndex G T ≤ p.val ∧ + TashTreeMinimumBadPair G k e0 psi T ∧ + beta ∈ MissingColors G psi (T.vertex p.castSucc) ∧ + beta ∈ MissingColors G psi + (T.vertex (Fin.last T.length)) := by + have iterate : + ∀ (d : ℕ) (coloring : _) (j : Fin T.length), T.length - (j.val + 1) = d → TashTreePathIndex G + T ≤ j.val → TashTreeMinimumBadPair G k e0 coloring T → beta ∈ MissingColors G coloring + (T.vertex j.castSucc) → beta ∈ MissingColors G coloring (T.vertex (Fin.last T.length)) → + ∃ (nextColoring : _) (p : Fin T.length), p.val + 1 = T.length ∧ TashTreePathIndex G T ≤ p.val + ∧ TashTreeMinimumBadPair G k e0 nextColoring T ∧ beta ∈ MissingColors G nextColoring + (T.vertex p.castSucc) ∧ beta ∈ MissingColors G nextColoring (T.vertex (Fin.last T.length)) + := by + intro d + induction d using Nat.strong_induction_on with + | h d smaller => + intro coloring j hd hjSuffix hbad hj hlast' + by_cases hnext : j.val + 1 < T.length + · let nextIndex : Fin T.length := ⟨j.val + 1, hnext⟩ + obtain ⟨coloring', hbad', hj', hlast''⟩ := + TashTreeSuffixAdvance G k e0 coloring T hbad beta j + (Or.inr hjSuffix) hnext hj hlast' + have hnextval : nextIndex.val = j.val + 1 := by + rfl + have hsmaller : T.length - (nextIndex.val + 1) < d := by + omega + have hnextSuffix : TashTreePathIndex G T ≤ nextIndex.val := by + rw [hnextval] + omega + have htransport : beta ∈ MissingColors G coloring' + (T.vertex nextIndex.castSucc) := by + simpa [nextIndex, Fin.succ] using hj' + exact smaller (T.length - (nextIndex.val + 1)) hsmaller + coloring' nextIndex rfl hnextSuffix hbad' htransport hlast'' + · have hterminal : j.val + 1 = T.length := by + omega + refine ⟨coloring, j, hterminal, hjSuffix, hbad, hj, hlast'⟩ + exact iterate (T.length - (i.val + 1)) phi i rfl hiSuffix hmin hi hlast + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeSuffixPath.lean b/LeanPool/GoldbergSeymour/TashTreeSuffixPath.lean new file mode 100644 index 0000000000..2e99cd90ac --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeSuffixPath.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Tash Tree Suffix Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- After the specified positive position, each edge joins consecutive tree vertices. -/ +def TashTreeSuffixPath {V E : Type*} (G : LooplessMultigraph V E) {e0 : E} (T : TreeSequence G e0) + (q : ℕ) : Prop := + 1 ≤ q ∧ + q ≤ T.length ∧ + ∀ i : Fin T.length, q ≤ i.val → G.ends (T.edge i) = s(T.vertex i.castSucc, T.vertex i.succ) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashTreeSuffixTerminalReplacement.lean b/LeanPool/GoldbergSeymour/TashTreeSuffixTerminalReplacement.lean new file mode 100644 index 0000000000..cbbf379bdc --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashTreeSuffixTerminalReplacement.lean @@ -0,0 +1,386 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TashTreeBadPair +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair +public import LeanPool.GoldbergSeymour.TashTreePathIndex +public import LeanPool.GoldbergSeymour.TashTreeProperInitialSegmentRankLess +public import LeanPool.GoldbergSeymour.TashTreeRankLess +public import LeanPool.GoldbergSeymour.TashTreeSuffixPath +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tash Tree Suffix Terminal Replacement + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hproper_118.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), TashTreeMinimumBadPair G k e0 phi T → + ∀ (beta : Fin k) (p : Fin T.length), G.ends (T.edge p) = s(T.vertex p.castSucc, T.vertex + p.succ) → beta ∉ PresentColors G phi (T.vertex p.castSucc) → beta ∉ PresentColors G phi + (T.vertex p.succ) → + let phiStar : PartialEdgeColoring E k := fun (e : E) => if e = T.edge p then some beta else + phi e; IsProperEdgeColoring G phiStar := by + classical + intro V E _ _ _ G k e0 phi T hmin beta p hend hbetaPrev hbetaLast phiStar e f c hef hadj hec + by_cases hep : e = T.edge p + · subst e + simp only [phiStar, ite_eq_left rfl] at hec + have hcbeta : c = beta := Option.some.inj hec.symm + subst c + have hcf : f ≠ T.edge p := by + intro h + exact hef h.symm + have hnot : phi f ≠ some beta := by + rcases hadj with ⟨v, hve, hvf⟩ + unfold Incident at hve hvf + rw [hend] at hve + simp only [Sym2.mem_iff] at hve + rcases hve with hve | hve + · intro hf + apply hbetaPrev + rw [hve] at hvf + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hvf, hf⟩ + · intro hf + apply hbetaLast + rw [hve] at hvf + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hvf, hf⟩ + simpa [phiStar, hcf] using hnot + · have hphi : phi e = some c := by simpa [phiStar, hep] using hec + have hnotold : phi f ≠ some c := hmin.1.1.2.2.2.1 hef hadj hphi + by_cases hfp : f = T.edge p + · subst f + simp only [phiStar, ite_eq_left rfl] + intro heq + have hcbeta : c = beta := (Option.some.inj heq).symm + subst c + rcases hadj with ⟨v, hve, hvf⟩ + unfold Incident at hve hvf + rw [hend] at hvf + simp only [Sym2.mem_iff] at hvf + rcases hvf with hvf | hvf + · rw [hvf] at hve + exact hbetaPrev + (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hve, hphi⟩) + · rw [hvf] at hve + exact hbetaLast + (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hve, hphi⟩) + · simpa [phiStar, hfp] using hnotold + +private theorem helper_hTashS_213.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0), TashTreeMinimumBadPair G k e0 phi T → + ∀ (beta : Fin k) (p : Fin T.length) (hpone : (1 : ℕ) ≤ (↑p : ℕ)) (hple : (↑p : ℕ) ≤ T.length) + (_ : Fin ((↑p : ℕ) + (1 : ℕ))), + let phiStar : PartialEdgeColoring E k := fun (e : E) => if e = T.edge p then some beta else + phi e; ( + ∀ (a : Fin (T.length + (1 : ℕ))), (↑a : ℕ) < (↑p : ℕ) → + ∀ c ∈ MissingColors G phi (T.vertex a), c ∈ MissingColors G phiStar (T.vertex a)) → + let S : TreeSequence G e0 := TreeSequencePrefix T (↑p : ℕ) hpone hple; TashkinovTree G e0 + phiStar S := by + classical + intro V E _ _ _ G k e0 phi T hmin beta p hpone hple j phiStar missingPreserved S r hr + have hrlt : r.val < p.val := by + dsimp [S, TreeSequencePrefix] at r hr ⊢ + omega + have hT := hmin.1.2.1 (Fin.castLE hple r) (by + dsimp [S, TreeSequencePrefix] at hr + exact hr) + rcases hT with ⟨a, c, hcol, hmiss⟩ + refine ⟨a, c, ?_, ?_⟩ + · dsimp [S, TreeSequencePrefix] at hcol ⊢ + have hedge_ne : T.edge (Fin.castLE hple r) ≠ T.edge p := by + intro hh + have hi := T.edge_injective hh + have hv : (Fin.castLE hple r).val = p.val := congrArg Fin.val hi + have hrval : (Fin.castLE hple r).val = r.val := rfl + exact (Nat.ne_of_lt hrlt) (hrval ▸ hv) + simpa [phiStar, hedge_ne] using hcol + · have ha_lt : a.val < p.val := by + have hrval : (Fin.castLE hple r).val = r.val := rfl + have hrcast : (Fin.castLE hple r).val < p.val := hrval ▸ hrlt + have har : a.val ≤ (Fin.castLE hple r).val := Nat.le_of_lt_succ a.isLt + omega + have hrval : (Fin.castLE hple r).val = r.val := rfl + have hrcast : (Fin.castLE hple r).val < p.val := hrval ▸ hrlt + have haP : a.val < p.val + 1 := by + exact Nat.lt_trans a.isLt (Nat.succ_lt_succ hrcast) + let q : Fin (p.val + 1) := Fin.castLT a haP + let b : Fin (T.length + 1) := + Fin.castLE (Nat.succ_le_succ hple) q + have hb_lt : b.val < p.val := by + have hbval : b.val = a.val := rfl + rw [hbval] + omega + have hmissT : c ∈ MissingColors G phi (T.vertex b) := by + change c ∈ MissingColors G phi (T.vertex b) at hmiss + exact hmiss + have hmiss' := missingPreserved b hb_lt c hmissT + change c ∈ MissingColors G phiStar (S.vertex q) + dsimp [S, TreeSequencePrefix] + exact hmiss' + +private theorem helper_hnotElemS_281.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (beta : Fin k) (p : Fin T.length) (hp : (↑p : ℕ) + (1 : ℕ) = T.length) (hpone : (1 : + ℕ) ≤ (↑p : ℕ)) (hple : (↑p : ℕ) ≤ T.length) (delta : Fin k) (j : Fin ((↑p : ℕ) + (1 : ℕ))) + (hjlt : (↑j : ℕ) < (↑p : ℕ)), + let phiStar : PartialEdgeColoring E k := fun (e : E) => if e = T.edge p then some beta else + phi e; + let S : TreeSequence G e0 := TreeSequencePrefix T (↑p : ℕ) hpone hple; delta ∈ MissingColors G + phiStar (T.vertex (j.castLT (Decidable.byContradiction fun (a : ¬(↑j : ℕ) < T.length + (1 + : ℕ)) => + by + omega + ))) → delta ∈ MissingColors G phiStar (T.vertex p.castSucc) → ¬ColoredVertexSetElementary G + phiStar (TreeSequenceVertexSet S) := by + classical + intro V E _ _ _ G k e0 phi T beta p hp hpone hple delta j hjlt phiStar S hdeltaJ hdeltaP helem + let _ := Fintype.ofFinite V + let qj : Fin (p.val + 1) := Fin.castLT j j.isLt + let qlast : Fin (p.val + 1) := Fin.last p.val + have hmemj : T.vertex (Fin.castLE (Nat.succ_le_succ hple) qj) ∈ + TreeSequenceVertexSet S := by + rw [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + refine ⟨qj, Finset.mem_univ _, ?_⟩ + dsimp [S, TreeSequencePrefix] + have hmemlast : T.vertex (Fin.castLE (Nat.succ_le_succ hple) qlast) ∈ + TreeSequenceVertexSet S := by + rw [TreeSequenceVertexSet] + apply Finset.mem_image.mpr + refine ⟨qlast, Finset.mem_univ _, ?_⟩ + dsimp [S, TreeSequencePrefix] + have hnevertices : T.vertex (Fin.castLE (Nat.succ_le_succ hple) qj) ≠ + T.vertex (Fin.castLE (Nat.succ_le_succ hple) qlast) := by + intro heq + have hidx := T.vertex_injective heq + have hval := congrArg Fin.val hidx + have hqjlt : qj.val < p.val := by + change j.val < p.val + exact hjlt + have hqlast : qlast.val = p.val := by + change p.val = p.val + rfl + have heqval : qj.val = qlast.val := by simpa using hval + omega + have hdis := helem hmemj hmemlast hnevertices + rw [Finset.disjoint_left] at hdis + have hdeltaAj : delta ∈ MissingColors G phiStar + (T.vertex (Fin.castLE (Nat.succ_le_succ hple) qj)) := by + simpa [Fin.castLE, Fin.castLT, qj] using hdeltaJ + have hdeltaAlast : delta ∈ MissingColors G phiStar + (T.vertex (Fin.castLE (Nat.succ_le_succ hple) qlast)) := by + have hidx : Fin.castLE (Nat.succ_le_succ hple) qlast = p.castSucc := by + apply Fin.ext + change p.val = p.val + rfl + rw [hidx] + exact hdeltaP + exact hdis hdeltaAj hdeltaAlast + +theorem TashTreeSuffixTerminalReplacement {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hmin : TashTreeMinimumBadPair G k e0 phi T) + (hlen : 2 ≤ T.length) (beta : Fin k) (p : Fin T.length) + (hq : TashTreePathIndex G T ≤ p.val) + (hp : p.val + 1 = T.length) + (hprev : beta ∈ MissingColors G phi (T.vertex p.castSucc)) + (hlast : beta ∈ MissingColors G phi + (T.vertex (Fin.last T.length))) : + ∃ (hpos : 1 ≤ p.val) (hle : p.val ≤ T.length) (delta : Fin k) (j : Fin (p.val + 1)) + (phiStar : PartialEdgeColoring E k), + phi (T.edge p) = some delta ∧ + j.val < p.val ∧ + delta ∈ MissingColors G phi (T.vertex (Fin.castLT j (by omega))) ∧ + phiStar = (fun e => if e = T.edge p then some beta else phi e) ∧ + TashTreeBadPair G k e0 phiStar (TreeSequencePrefix T p.val hpos hle) ∧ + TashTreeRankLess G (TreeSequencePrefix T p.val hpos hle) T := by + classical + have hpone : 1 ≤ p.val := by omega + have hple : p.val ≤ T.length := p.isLt.le + have hsuffix : + TashTreeSuffixPath G T (TashTreePathIndex G T) := by + unfold TashTreePathIndex + exact Nat.find_spec _ + have hend : G.ends (T.edge p) = s(T.vertex p.castSucc, T.vertex p.succ) := by + exact hsuffix.2.2 p hq + have hedge0 : T.edge p ≠ e0 := by + intro he + have hfirst : T.edge ⟨0, T.positive⟩ = e0 := T.first_edge + have hzero : p = ⟨0, T.positive⟩ := + T.edge_injective (he.trans hfirst.symm) + have hval := congrArg Fin.val hzero + simp at hval + omega + have hdelta : ∃ delta : Fin k, phi (T.edge p) = some delta := by + rcases hmin.1.1.2.2.2.2 with hone + exact hone.2 (T.edge p) hedge0 + rcases hdelta with ⟨delta, hdelta⟩ + rcases hmin.1.2.1 p hpone with ⟨j, c, hcolor, hmissing⟩ + have hcdelta : c = delta := by + exact Option.some.inj (hcolor.symm.trans hdelta) + subst c + have hjlt : j.val < p.val := by + by_contra hj + have hjle : p.val ≤ j.val := Nat.le_of_not_gt hj + have hjeq : j.val = p.val := by omega + have hincident : Incident G (T.vertex (Fin.castLT j + (Nat.lt_trans j.isLt (Nat.succ_lt_succ p.isLt)))) (T.edge p) := by + unfold Incident + rw [show Fin.castLT j + (Nat.lt_trans j.isLt (Nat.succ_lt_succ p.isLt)) = p.castSucc by + apply Fin.ext + simp [hjeq]] + rw [hend] + simp + have hpresent : delta ∈ PresentColors G phi + (T.vertex (Fin.castLT j + (Nat.lt_trans j.isLt (Nat.succ_lt_succ p.isLt)))) := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨T.edge p, hincident, hdelta⟩ + have hnotpresent : delta ∉ PresentColors G phi + (T.vertex (Fin.castLT j + (Nat.lt_trans j.isLt (Nat.succ_lt_succ p.isLt)))) := by + simpa [MissingColors] using hmissing + exact hnotpresent hpresent + have hlastidx : p.succ = Fin.last T.length := by + apply Fin.ext + simp [hp] + have hbetaPrev : beta ∉ PresentColors G phi (T.vertex p.castSucc) := by + simpa [MissingColors] using hprev + have hbetaLast : beta ∉ PresentColors G phi (T.vertex p.succ) := by + rw [hlastidx] + simpa [MissingColors] using hlast + let phiStar : PartialEdgeColoring E k := + fun e => if e = T.edge p then some beta else phi e + have hproper := @helper_hproper_118 V E inferInstance inferInstance inferInstance G k e0 phi T + hmin beta p hend hbetaPrev hbetaLast + have honeStar : IsOneEdgeUncolored phiStar e0 := by + have hne : e0 ≠ T.edge p := Ne.symm hedge0 + constructor + · simp [phiStar, hne, hmin.1.1.2.2.2.2.1] + · intro e he + by_cases hep : e = T.edge p + · subst e + exact ⟨beta, by simp [phiStar]⟩ + · obtain ⟨c, hc⟩ := hmin.1.1.2.2.2.2.2 e he + exact ⟨c, by simpa [phiStar, hep] using hc⟩ + have missingPreserved : ∀ (a : Fin (T.length + 1)), a.val < p.val → + ∀ c, c ∈ MissingColors G phi (T.vertex a) → + c ∈ MissingColors G phiStar (T.vertex a) := by + intro a ha c hm + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] at hm ⊢ + intro hpresent + rcases (by simpa [PresentColors] using hpresent) with ⟨e, heinc, heval⟩ + by_cases hep : e = T.edge p + · subst e + unfold Incident at heinc + rw [hend] at heinc + simp only [Sym2.mem_iff] at heinc + rcases heinc with heinc | heinc + · have hidx : a = p.castSucc := T.vertex_injective heinc + have hval : a.val = p.val := congrArg Fin.val hidx + exact (Nat.lt_irrefl _ (hval ▸ ha)) + · have hidx : a = p.succ := T.vertex_injective heinc + have hval : a.val = p.val + 1 := by + simpa using congrArg Fin.val hidx + omega + · apply hm + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, heinc, by simpa [phiStar, hep] using heval⟩ + have hdeltaBeta : delta ≠ beta := by + intro heq + subst beta + apply hbetaPrev + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨T.edge p, by + unfold Incident + rw [hend] + simp, hdelta⟩ + let S := TreeSequencePrefix T p.val hpone hple + have hprefix : TreeSequenceInitialSegment S T := by + unfold TreeSequenceInitialSegment + refine ⟨hple, ?_, ?_⟩ + · intro a + dsimp [S, TreeSequencePrefix] + · intro a + dsimp [S, TreeSequencePrefix] + have hTashS := @helper_hTashS_213 V E inferInstance inferInstance inferInstance G k e0 phi T hmin + beta p hpone hple j missingPreserved + have hdeltaJ : delta ∈ MissingColors G phiStar + (T.vertex (Fin.castLT j (by omega))) := by + have hjm : (Fin.castLT j (by omega)).val < p.val := by + simpa using hjlt + exact missingPreserved _ hjm delta (by simpa using hmissing) + have hdeltaP : delta ∈ MissingColors G phiStar (T.vertex p.castSucc) := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + intro hpresent + rcases (by simpa [PresentColors] using hpresent) with ⟨e, heinc, heval⟩ + by_cases hep : e = T.edge p + · subst e + have hbadcolor : (some beta : Option (Fin k)) = some delta := by + simpa [phiStar] using heval + have : beta = delta := Option.some.inj hbadcolor + exact hdeltaBeta this.symm + · have hadj : AdjacentEdges G (T.edge p) e := by + refine ⟨T.vertex p.castSucc, ?_, heinc⟩ + unfold Incident + rw [hend] + simp + have hold : phi e ≠ some delta := + hmin.1.1.2.2.2.1 (Ne.symm hep) hadj hdelta + apply hold + simpa [phiStar, hep] using heval + rcases hmin.1.1 with ⟨hcritical, hchromatic, hdegree, _, _⟩ + have htripleStar : KTriple G k e0 phiStar := + ⟨hcritical, hchromatic, hdegree, hproper, honeStar⟩ + have hnotElemS := @helper_hnotElemS_281 V E inferInstance inferInstance inferInstance G k e0 phi T + beta p hp hpone hple delta j hjlt hdeltaJ hdeltaP + have hbadS : TashTreeBadPair G k e0 phiStar S := + ⟨htripleStar, hTashS, hnotElemS⟩ + have hproperPrefix : S.length < T.length := by + dsimp [S, TreeSequencePrefix] + omega + have hrank : TashTreeRankLess G S T := + TashTreeProperInitialSegmentRankLess G S T hprefix hproperPrefix + refine ⟨hpone, hple, delta, j, phiStar, hdelta, hjlt, hmissing, ?_, hbadS, hrank⟩ + rfl + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAlternatingSegmentAppend.lean b/LeanPool/GoldbergSeymour/TashkinovAlternatingSegmentAppend.lean new file mode 100644 index 0000000000..ef5e6c4cd1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAlternatingSegmentAppend.lean @@ -0,0 +1,739 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent + +/-! +# Tashkinov Alternating Segment Append + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_vMap_injective_121.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {e0 : E} (S : TreeSequence G e0) + (m : ℕ) + (pathVertex : Fin (m + (1 : ℕ)) → V), + Function.Injective pathVertex → + (∀ (i : Fin m), pathVertex i.succ ∉ TreeSequenceVertexSet S) → + let vMap : (t : ℕ) → t ≤ m → Fin (S.length + t + (1 : ℕ)) → V := + fun (t : ℕ) (ht : t ≤ m) (i : Fin (S.length + t + (1 : ℕ))) ↦ + if h : (↑i : ℕ) ≤ S.length then S.vertex (⟨(↑i : ℕ), by omega⟩ : Fin (S.length + (1 : + ℕ))) + else pathVertex (⟨(↑i : ℕ) - S.length, by omega⟩ : Fin (m + (1 : ℕ))); + ∀ (t : ℕ) (ht : t ≤ m), Function.Injective (vMap t ht) := by + classical + intro V E G e0 S m pathVertex hvertexInjective houtside vMap t ht a b hab + by_cases ha : a.val ≤ S.length + · by_cases hb : b.val ≤ S.length + · have hold : S.vertex ⟨a.val, by omega⟩ = + S.vertex ⟨b.val, by omega⟩ := by + simpa only [vMap, dite_eq_left ha, dite_eq_left hb] using hab + have := congrArg Fin.val (S.vertex_injective hold) + apply Fin.ext + simpa using this + · let ib : Fin m := ⟨b.val - S.length - 1, by omega⟩ + have hp : (⟨b.val - S.length, by omega⟩ : Fin (m + 1)) = ib.succ := by + apply Fin.ext + simp [ib] + omega + have hmem : S.vertex ⟨a.val, by omega⟩ ∈ TreeSequenceVertexSet S := by + simp [TreeSequenceVertexSet] + have hab' : S.vertex ⟨a.val, by omega⟩ = + pathVertex ⟨b.val - S.length, by omega⟩ := by + simpa only [vMap, dite_eq_left ha, dite_eq_right hb] using hab + apply False.elim + apply houtside ib + rw [← hp] + rw [← hab'] + exact hmem + · by_cases hb : b.val ≤ S.length + · let ia : Fin m := ⟨a.val - S.length - 1, by omega⟩ + have hp : (⟨a.val - S.length, by omega⟩ : Fin (m + 1)) = ia.succ := by + apply Fin.ext + simp [ia] + omega + have hmem : S.vertex ⟨b.val, by omega⟩ ∈ TreeSequenceVertexSet S := by + simp [TreeSequenceVertexSet] + have hab' : pathVertex ⟨a.val - S.length, by omega⟩ = + S.vertex ⟨b.val, by omega⟩ := by + simpa only [vMap, dite_eq_right ha, dite_eq_left hb] using hab + apply False.elim + apply houtside ia + rw [← hp] + rw [hab'] + exact hmem + · have hnew : pathVertex ⟨a.val - S.length, by omega⟩ = + pathVertex ⟨b.val - S.length, by omega⟩ := by + simpa only [vMap, dite_eq_right ha, dite_eq_right hb] using hab + have := congrArg Fin.val (hvertexInjective hnew) + apply Fin.ext + simp only [] at this ⊢ + omega + +private theorem helper_eMap_injective_186.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {e0 : E} (S : TreeSequence G e0) + (m : ℕ) + (pathEdge : Fin m → E), + Function.Injective pathEdge → + (∀ (i : Fin m) (j : Fin S.length), pathEdge i ≠ S.edge j) → + let eMap : (t : ℕ) → t ≤ m → Fin (S.length + t) → E := fun (t : ℕ) (ht : t ≤ m) (i : + Fin (S.length + t)) ↦ + if h : (↑i : ℕ) < S.length then S.edge (⟨(↑i : ℕ), h⟩ : Fin S.length) + else pathEdge (⟨(↑i : ℕ) - S.length, by omega⟩ : Fin m); + ∀ (t : ℕ) (ht : t ≤ m), Function.Injective (eMap t ht) := by + classical + intro V E G e0 S m pathEdge hedgeInjective hedgeFresh eMap t ht a b hab + by_cases ha : a.val < S.length + · by_cases hb : b.val < S.length + · have hold : S.edge ⟨a.val, ha⟩ = S.edge ⟨b.val, hb⟩ := by + simpa only [eMap, dite_eq_left ha, dite_eq_left hb] using hab + have := congrArg Fin.val (S.edge_injective hold) + apply Fin.ext + simpa using this + · have hfresh := hedgeFresh + (⟨b.val - S.length, by omega⟩ : Fin m) (⟨a.val, ha⟩ : Fin S.length) + exact False.elim (hfresh (by + simpa only [eMap, dite_eq_left ha, dite_eq_right hb] using hab.symm)) + · by_cases hb : b.val < S.length + · have hfresh := hedgeFresh + (⟨a.val - S.length, by omega⟩ : Fin m) (⟨b.val, hb⟩ : Fin S.length) + exact False.elim (hfresh (by + simpa only [eMap, dite_eq_right ha, dite_eq_left hb] using hab)) + · have hnew : pathEdge ⟨a.val - S.length, by omega⟩ = + pathEdge ⟨b.val - S.length, by omega⟩ := by + simpa only [eMap, dite_eq_right ha, dite_eq_right hb] using hab + have := congrArg Fin.val (hedgeInjective hnew) + apply Fin.ext + simp only [] at this ⊢ + omega + +private theorem helper_branch_247.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {e0 : E} (S : TreeSequence G e0) + (m : ℕ) + (pathVertex : Fin (m + (1 : ℕ)) → V) (pathEdge : Fin m → E), + let vMap : (t : ℕ) → t ≤ m → Fin (S.length + t + (1 : ℕ)) → V := + fun (t : ℕ) (ht : t ≤ m) (i : Fin (S.length + t + (1 : ℕ))) ↦ + if h : (↑i : ℕ) ≤ S.length then S.vertex (⟨(↑i : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))) + else pathVertex (⟨(↑i : ℕ) - S.length, by omega⟩ : Fin (m + (1 : ℕ))); + let eMap : (t : ℕ) → t ≤ m → Fin (S.length + t) → E := fun (t : ℕ) (ht : t ≤ m) (i : Fin + (S.length + t)) ↦ + if h : (↑i : ℕ) < S.length then S.edge (⟨(↑i : ℕ), h⟩ : Fin S.length) + else pathEdge (⟨(↑i : ℕ) - S.length, by omega⟩ : Fin m); + (∀ (t : ℕ) (ht : t ≤ m) (i : Fin (S.length + (1 : ℕ))), vMap t ht (Fin.castLE (by omega) i) + = S.vertex i) → + ∀ (t : ℕ) (ht : t ≤ m) (j : Fin (S.length + t)), + (↑j : ℕ) < S.length → + ∃ (i : Fin ((↑j : ℕ) + (1 : ℕ))), G.ends (eMap t ht j) = s(vMap t ht j.succ, vMap t + ht (i.castLT (by omega))) := by + classical + intro V E G e0 S m pathVertex pathEdge vMap eMap vMap_old t ht j hj + let jo : Fin S.length := ⟨j.val, hj⟩ + rcases S.attaches jo with ⟨i, hi⟩ + let ii : Fin (j.val + 1) := ⟨i.val, by simpa [jo] using i.isLt⟩ + refine ⟨ii, ?_⟩ + rw [show eMap t ht j = S.edge jo by + simp only [eMap, dite_eq_left hj]; congr] + rw [hi] + have hleV : S.length + 1 ≤ S.length + t + 1 := by omega + have hjEq : j.succ = Fin.castLE hleV jo.succ := by + apply Fin.ext + rfl + have hiEq : Fin.castLT ii (by omega) = Fin.castLE hleV + (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ jo.isLt))) := by + apply Fin.ext + rfl + rw [hjEq, vMap_old t ht, hiEq, vMap_old t ht] + +private theorem helper_vMap_new_244.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {e0 : E} (S : TreeSequence G e0) + (m : ℕ) (pathVertex : Fin (m + (1 : ℕ)) → V), + let vMap : (t : ℕ) → t ≤ m → Fin (S.length + t + (1 : ℕ)) → V := fun (t : ℕ) (ht : t ≤ m) (i : + Fin (S.length + t + (1 : ℕ))) ↦ if h : (↑i : ℕ) ≤ S.length then S.vertex (⟨(↑i : ℕ), + by + omega + ⟩ : Fin (S.length + (1 : ℕ))) else pathVertex (⟨(↑i : ℕ) - S.length, + by + omega + ⟩ : Fin (m + (1 : ℕ))); + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin t), vMap t ht (⟨S.length + (↑i : ℕ) + (1 : ℕ), + by + omega + ⟩ : Fin (S.length + t + (1 : ℕ))) = pathVertex (Fin.castLE (Nat.succ_le_succ ht) i.succ) := by + classical + intro V E G e0 S m pathVertex vMap t ht i + change (if h : S.length + i.val + 1 ≤ S.length then + S.vertex ⟨S.length + i.val + 1, by omega⟩ + else pathVertex ⟨S.length + i.val + 1 - S.length, by omega⟩) = _ + rw [dite_eq_right (by omega)] + congr + simp only [Fin.val_succ] + omega + +private theorem helper_eMap_new_254.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {e0 : E} (S : TreeSequence G e0) + (m : ℕ) (pathEdge : Fin m → E), + let eMap : (t : ℕ) → t ≤ m → Fin (S.length + t) → E := fun (t : ℕ) (ht : t ≤ m) (i : Fin + (S.length + t)) ↦ if h : (↑i : ℕ) < S.length then S.edge (⟨(↑i : ℕ), h⟩ : Fin S.length) + else pathEdge (⟨(↑i : ℕ) - S.length, + by + omega + ⟩ : Fin m); + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin t), eMap t ht (⟨S.length + (↑i : ℕ), + by + omega + ⟩ : Fin (S.length + t)) = pathEdge (Fin.castLE ht i) := by + classical + intro V E G e0 S m pathEdge eMap t ht i + change (if h : S.length + i.val < S.length then + S.edge ⟨S.length + i.val, h⟩ + else pathEdge ⟨S.length + i.val - S.length, by omega⟩) = _ + rw [dite_eq_right (by omega)] + congr + omega + +private abbrev helperFirstEdge354Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) {e0 : E} (S : TreeSequence G e0) + (m : ℕ) (pathEdge : Fin m → E), + let eMap : (t : ℕ) → (ht : t ≤ m) → Fin (S.length + t) → E := + fun (t : ℕ) (ht : t ≤ m) (i : Fin (S.length + t)) ↦ + if h : (↑i : ℕ) < S.length then S.edge (⟨(↑i : ℕ), h⟩ : Fin S.length) + else pathEdge (⟨(↑i : ℕ) - S.length, by omega⟩ : Fin m); + ∀ + (eMap_old : + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin S.length), eMap t ht (Fin.castLE (by omega) i) = S.edge i) + (t : ℕ) (ht : t ≤ m), + eMap t ht + (⟨(0 : ℕ), + have this : (1 : ℕ) ≤ S.length := S.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ S.length + t) ↦ by omega⟩ : + Fin (S.length + t)) = + e0 + +private theorem helper_first_edge_354.{u_1, u_2} : + helperFirstEdge354Conditions.{u_1, u_2} := by + classical + intro V E G e0 S m pathEdge eMap eMap_old t ht + have hzero : (⟨0, by have := S.positive; omega⟩ : Fin (S.length + t)) = + Fin.castLE (by omega) (⟨0, S.positive⟩ : Fin S.length) := by + apply Fin.ext + rfl + rw [hzero, eMap_old t ht] + exact S.first_edge + +private noncomputable abbrev helperExtend398.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + (G : LooplessMultigraph V E) → + {e0 : E} → + (S : TreeSequence G e0) → + (m : ℕ) → + (pathVertex : Fin (m + (1 : ℕ)) → V) → + (pathEdge : Fin m → E) → + (hends : + ∀ (i : Fin m), + G.ends (pathEdge i) = s(pathVertex i.castSucc, pathVertex i.succ)) → + let vMap : (t : ℕ) → (ht : t ≤ m) → Fin (S.length + t + (1 : ℕ)) → V := + fun (t : ℕ) (ht : t ≤ m) (i : Fin (S.length + t + (1 : ℕ))) ↦ + if h : (↑i : ℕ) ≤ S.length then + S.vertex (⟨(↑i : ℕ), by omega⟩ : Fin (S.length + (1 : ℕ))) + else pathVertex (⟨(↑i : ℕ) - S.length, by omega⟩ : Fin (m + (1 : ℕ))); + let eMap : (t : ℕ) → (ht : t ≤ m) → Fin (S.length + t) → E := + fun (t : ℕ) (ht : t ≤ m) (i : Fin (S.length + t)) ↦ + if h : (↑i : ℕ) < S.length then S.edge (⟨(↑i : ℕ), h⟩ : Fin S.length) + else pathEdge (⟨(↑i : ℕ) - S.length, by omega⟩ : Fin m); + (vMap_old : + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin (S.length + (1 : ℕ))), + vMap t ht (Fin.castLE (by omega) i) = S.vertex i) → + (eMap_old : + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin S.length), + eMap t ht (Fin.castLE (by omega) i) = S.edge i) → + (vMap_new : + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin t), + vMap t ht + (⟨S.length + (↑i : ℕ) + (1 : ℕ), by omega⟩ : + Fin (S.length + t + (1 : ℕ))) = + pathVertex (Fin.castLE (Nat.succ_le_succ ht) i.succ)) → + (eMap_new : + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin t), + eMap t ht + (⟨S.length + (↑i : ℕ), by omega⟩ : Fin (S.length + t)) = + pathEdge (Fin.castLE ht i)) → + (vMap_injective : + ∀ (t : ℕ) (ht : t ≤ m), Function.Injective (vMap t ht)) → + (eMap_injective : + ∀ (t : ℕ) (ht : t ≤ m), Function.Injective (eMap t ht)) → + (hstart_index : + ∃ (q : Fin (S.length + (1 : ℕ))), + S.vertex q = pathVertex (0 : Fin (m + (1 : ℕ)))) → + (t : ℕ) → (ht : t ≤ m) → TreeSequence G e0 := by + classical + intro V E G e0 S m pathVertex pathEdge hends vMap eMap vMap_old eMap_old vMap_new eMap_new + vMap_injective eMap_injective hstart_index t ht + exact { + length := S.length + t + positive := by have := S.positive; omega + vertex := vMap t ht + edge := eMap t ht + vertex_injective := vMap_injective t ht + edge_injective := eMap_injective t ht + first_edge := by + exact @helper_first_edge_354 (@V) (@E) (@G) (@e0) (@S) (@m) (@pathEdge) (@eMap_old) (@t) (@ht) + attaches := by + intro j + by_cases hj : j.val < S.length + · exact @helper_branch_247 (@V) (@E) (@G) (@e0) (@S) (@m) (@pathVertex) (@pathEdge) + (@vMap_old) (@t) (@ht) (@j) (@hj) + · let p : Fin t := ⟨j.val - S.length, by omega⟩ + have hjpos : S.length ≤ j.val := by omega + have hjform : j.val = S.length + p.val := by + simp [p] + omega + rw [show eMap t ht j = pathEdge (Fin.castLE ht p) by + rw [show j = (⟨S.length + p.val, by omega⟩ : Fin (S.length + t)) by + apply Fin.ext + exact hjform] + exact eMap_new t ht p] + rw [hends (Fin.castLE ht p)] + by_cases hp : p.val = 0 + · rcases hstart_index with ⟨q, hq⟩ + let ii : Fin (j.val + 1) := ⟨q.val, by omega⟩ + refine ⟨ii, ?_⟩ + have hjSuccEq : j.succ = + (⟨S.length + p.val + 1, by omega⟩ : Fin (S.length + t + 1)) := by + apply Fin.ext + simpa using congrArg Nat.succ hjform + have htarget : vMap t ht j.succ = + pathVertex (Fin.castLE ht p).succ := by + rw [hjSuccEq, vMap_new t ht p] + have hidx : Fin.castLE (Nat.succ_le_succ ht) p.succ = + (Fin.castLE ht p).succ := by + apply Fin.ext + rfl + rw [hidx] + have hleV : S.length + 1 ≤ S.length + t + 1 := by omega + have hiEq : Fin.castLT ii (by omega) = Fin.castLE hleV q := by + apply Fin.ext + rfl + have hatt : vMap t ht (Fin.castLT ii (by omega)) = + pathVertex (Fin.castLE ht p).castSucc := by + rw [hiEq, vMap_old t ht, hq] + have hidx : (0 : Fin (m + 1)) = (Fin.castLE ht p).castSucc := by + apply Fin.ext + simp [hp] + rw [hidx] + rw [htarget, hatt] + exact Sym2.eq_swap + · let pp : Fin t := ⟨p.val - 1, by omega⟩ + let ii : Fin (j.val + 1) := ⟨j.val, Nat.lt_succ_self _⟩ + refine ⟨ii, ?_⟩ + have hjSuccEq : j.succ = + (⟨S.length + p.val + 1, by omega⟩ : Fin (S.length + t + 1)) := by + apply Fin.ext + simpa using congrArg Nat.succ hjform + have htarget : vMap t ht j.succ = + pathVertex (Fin.castLE ht p).succ := by + rw [hjSuccEq, vMap_new t ht p] + have hidx : Fin.castLE (Nat.succ_le_succ ht) p.succ = + (Fin.castLE ht p).succ := by + apply Fin.ext + rfl + rw [hidx] + have hiEq : Fin.castLT ii (by omega) = + (⟨S.length + pp.val + 1, by omega⟩ : Fin (S.length + t + 1)) := by + apply Fin.ext + simp [ii, pp] + omega + have hatt : vMap t ht (Fin.castLT ii (by omega)) = + pathVertex (Fin.castLE ht p).castSucc := by + rw [hiEq, vMap_new t ht pp] + have hidx : Fin.castLE (Nat.succ_le_succ ht) pp.succ = + (Fin.castLE ht p).castSucc := by + apply Fin.ext + simp [pp] + omega + rw [hidx] + rw [htarget, hatt] + exact Sym2.eq_swap } + +private theorem helper_continuation_699.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) (alpha beta : Fin k) (y : + V) (m : ℕ) (_ : (1 : ℕ) ≤ m) (pathVertex : Fin (m + (1 : ℕ)) → V) (pathEdge : Fin m → E) + (_ : + ∀ (i : Fin m), pathVertex i.succ ∉ TreeSequenceVertexSet S) (_ : + ∀ (i : Fin (m + (1 : ℕ))), Sum.inl (pathVertex i) ∈ TwoColorComponent G phi alpha beta + (Sum.inl y)) (_ : + ∀ (i : Fin m), Sum.inr (pathEdge i) ∈ TwoColorComponent G phi alpha beta (Sum.inl y)) (_ : + ∀ (i : Fin m), phi (pathEdge i) = some alpha ∨ phi (pathEdge i) = some beta) (hends : + ∀ (i : Fin m), G.ends (pathEdge i) = s(pathVertex i.castSucc, pathVertex i.succ)), + let vMap : (t : ℕ) → (ht : t ≤ m) → Fin (S.length + t + (1 : ℕ)) → V := fun (t : ℕ) (ht : t ≤ + m) (i : Fin (S.length + t + (1 : ℕ))) ↦ if h : (↑i : ℕ) ≤ S.length then S.vertex (⟨(↑i : + ℕ), + by + omega + ⟩ : Fin (S.length + (1 : ℕ))) else pathVertex (⟨(↑i : ℕ) - S.length, + by + omega + ⟩ : Fin (m + (1 : ℕ))); + let eMap : (t : ℕ) → (ht : t ≤ m) → Fin (S.length + t) → E := fun (t : ℕ) (ht : t ≤ m) (i : + Fin (S.length + t)) ↦ if h : (↑i : ℕ) < S.length then S.edge (⟨(↑i : ℕ), h⟩ : Fin + S.length) else pathEdge (⟨(↑i : ℕ) - S.length, + by + omega + ⟩ : Fin m); + ∀ (vMap_old : + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin (S.length + (1 : ℕ))), vMap t ht (Fin.castLE ( + by + omega + ) i) = S.vertex i) (eMap_old : + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin S.length), eMap t ht (Fin.castLE ( + by + omega + ) i) = S.edge i) (vMap_new : + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin t), vMap t ht (⟨S.length + (↑i : ℕ) + (1 : ℕ), + by + omega + ⟩ : Fin (S.length + t + (1 : ℕ))) = pathVertex (Fin.castLE (Nat.succ_le_succ ht) i.succ)) + (eMap_new : + ∀ (t : ℕ) (ht : t ≤ m) (i : Fin t), eMap t ht (⟨S.length + (↑i : ℕ), + by + omega + ⟩ : Fin (S.length + t)) = pathEdge (Fin.castLE ht i)) (vMap_injective : + ∀ (t : ℕ) (ht : t ≤ m), Function.Injective (vMap t ht)) (eMap_injective : + ∀ (t : ℕ) (ht : t ≤ m), Function.Injective (eMap t ht)) (hstart_index : + ∃ (q : Fin (S.length + (1 : ℕ))), S.vertex q = pathVertex (0 : Fin (m + (1 : ℕ)))), + let extend : (t : ℕ) → (ht : t ≤ m) → TreeSequence G e0 := fun (t : ℕ) (ht : t ≤ m) ↦ + helperExtend398 G S m pathVertex pathEdge hends vMap_old eMap_old vMap_new eMap_new + vMap_injective eMap_injective hstart_index t ht; + ∀ (_ : + ∀ (t : ℕ) (ht : t ≤ m), TreeSequenceInitialSegment S (extend t ht)) (_ : + ∀ (t : ℕ) (_ : (1 : ℕ) ≤ t) (ht : t ≤ m), TashkinovAugmentationSequence phi S (extend t ht)), + let _ : TreeSequence G e0 := extend m le_rfl; + ∃ (S' : TreeSequence G e0), TreeSequenceInitialSegment S S' ∧ S'.length = S.length + m ∧ ( + ∀ (i : Fin m), + ∃ (r : Fin S'.length), (↑r : ℕ) = S.length + (↑i : ℕ) ∧ S'.edge r = pathEdge i ∧ S'.vertex + r.succ = pathVertex i.succ) ∧ S.length < S'.length ∧ TashkinovAugmentationSequence phi S + S' ∧ S'.vertex (Fin.last S'.length) = pathVertex (Fin.last m) ∧ + ∀ (r : Fin S'.length), S.length ≤ (↑r : ℕ) → S'.vertex r.succ ∉ TreeSequenceVertexSet S ∧ + Sum.inr (S'.edge r) ∈ TwoColorComponent G phi alpha beta (Sum.inl y) ∧ Sum.inl (S'.vertex + r.succ) ∈ TwoColorComponent G phi alpha beta (Sum.inl y) ∧ (phi (S'.edge r) = some alpha ∨ + phi (S'.edge r) = some beta) ∧ G.ends (S'.edge r) = if (↑r : ℕ) = S.length then + s(pathVertex (0 : Fin (m + (1 : ℕ))), S'.vertex r.succ) else s(S'.vertex r.castSucc, + S'.vertex r.succ) := by + classical + intro V E _ _ G k e0 phi S alpha beta y m hm pathVertex pathEdge houtside hvertexComponent + hedgeComponent hcolors hends vMap eMap vMap_old eMap_old vMap_new eMap_new vMap_injective + eMap_injective hstart_index extend initial_from_old augmentation_from_one S' + let _ := Fintype.ofFinite V + refine ⟨S', ?_⟩ + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact initial_from_old m le_rfl + · simp only [S', extend] + · intro i + let r : Fin S'.length := ⟨S.length + i.val, by + simp only [S', extend] + omega⟩ + refine ⟨r, by simp [r], ?_, ?_⟩ + · change eMap m le_rfl r = pathEdge i + have hr : r = (⟨S.length + i.val, by omega⟩ : Fin (S.length + m)) := by + apply Fin.ext + rfl + rw [hr, eMap_new m le_rfl i] + congr + · change vMap m le_rfl r.succ = pathVertex i.succ + have hr : r.succ = + (⟨S.length + i.val + 1, by omega⟩ : Fin (S.length + m + 1)) := by + apply Fin.ext + rfl + rw [hr, vMap_new m le_rfl i] + congr + · simp only [S', extend] + omega + · exact augmentation_from_one m hm le_rfl + · let i : Fin m := ⟨m - 1, by omega⟩ + change vMap m le_rfl (Fin.last (S.length + m)) = pathVertex (Fin.last m) + have hlast : Fin.last (S.length + m) = + (⟨S.length + i.val + 1, by omega⟩ : Fin (S.length + m + 1)) := by + apply Fin.ext + simp [i] + omega + rw [hlast, vMap_new m le_rfl i] + congr + apply Fin.ext + simp [i] + omega + · intro r hr + let i : Fin m := ⟨r.val - S.length, by + have hrlt := r.isLt + change r.val < S.length + m at hrlt + omega⟩ + have hrform : r.val = S.length + i.val := by + simp [i] + omega + have hedge : S'.edge r = pathEdge i := by + change eMap m le_rfl r = pathEdge i + rw [show r = (⟨S.length + i.val, by omega⟩ : Fin (S.length + m)) by + apply Fin.ext + exact hrform] + rw [eMap_new m le_rfl i] + congr + have hvertex : S'.vertex r.succ = pathVertex i.succ := by + change vMap m le_rfl r.succ = pathVertex i.succ + rw [show r.succ = + (⟨S.length + i.val + 1, by omega⟩ : Fin (S.length + m + 1)) by + apply Fin.ext + simpa using congrArg Nat.succ hrform] + rw [vMap_new m le_rfl i] + congr + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · rw [hvertex] + exact houtside i + · rw [hedge] + exact hedgeComponent i + · rw [hvertex] + exact hvertexComponent i.succ + · rw [hedge] + exact hcolors i + · rw [hedge, hends i] + by_cases hfirst : r.val = S.length + · rw [ite_eq_left hfirst, hvertex] + congr + apply Fin.ext + simp [i] + omega + · rw [ite_eq_right hfirst, hvertex] + have hprev : S'.vertex r.castSucc = pathVertex i.castSucc := by + change vMap m le_rfl r.castSucc = pathVertex i.castSucc + have hlarge : ¬r.val ≤ S.length := by omega + simp only [vMap, Fin.val_castSucc, dite_eq_right hlarge] + congr + rw [hprev] + +theorem TashkinovAlternatingSegmentAppend + {V E : Type*} + [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) + (alpha beta : Fin k) (y : V) + (m : Nat) (hm : 1 ≤ m) + (pathVertex : Fin (m + 1) → V) (pathEdge : Fin m → E) + (hvertexInjective : Function.Injective pathVertex) + (hedgeInjective : Function.Injective pathEdge) + (hstart : pathVertex 0 ∈ TreeSequenceVertexSet S) + (houtside : ∀ i : Fin m, + pathVertex i.succ ∉ TreeSequenceVertexSet S) + (hvertexComponent : ∀ i : Fin (m + 1), + Sum.inl (pathVertex i) ∈ + TwoColorComponent G phi alpha beta (Sum.inl y)) + (hedgeComponent : ∀ i : Fin m, + Sum.inr (pathEdge i) ∈ + TwoColorComponent G phi alpha beta (Sum.inl y)) + (hcolors : ∀ i : Fin m, + phi (pathEdge i) = some alpha ∨ + phi (pathEdge i) = some beta) + (hends : ∀ i : Fin m, + G.ends (pathEdge i) = + s(pathVertex i.castSucc, pathVertex i.succ)) + (hedgeFresh : ∀ i : Fin m, ∀ j : Fin S.length, + pathEdge i ≠ S.edge j) + (halpha : alpha ∈ TreeMissingColors phi S) + (hbeta : beta ∈ TreeMissingColors phi S) : + ∃ S' : TreeSequence G e0, + TreeSequenceInitialSegment S S' ∧ + S'.length = S.length + m ∧ + (∀ i : Fin m, ∃ r : Fin S'.length, + r.val = S.length + i.val ∧ + S'.edge r = pathEdge i ∧ + S'.vertex r.succ = pathVertex i.succ) ∧ + S.length < S'.length ∧ + TashkinovAugmentationSequence phi S S' ∧ + S'.vertex (Fin.last S'.length) = pathVertex (Fin.last m) ∧ + ∀ r : Fin S'.length, S.length ≤ r.val → + S'.vertex r.succ ∉ TreeSequenceVertexSet S ∧ + Sum.inr (S'.edge r) ∈ + TwoColorComponent G phi alpha beta (Sum.inl y) ∧ + Sum.inl (S'.vertex r.succ) ∈ + TwoColorComponent G phi alpha beta (Sum.inl y) ∧ + (phi (S'.edge r) = some alpha ∨ + phi (S'.edge r) = some beta) ∧ + G.ends (S'.edge r) = + if r.val = S.length then + s(pathVertex 0, S'.vertex r.succ) + else + s(S'.vertex r.castSucc, S'.vertex r.succ) := by + classical + let _ := Fintype.ofFinite V + let vMap (t : Nat) (ht : t ≤ m) : Fin (S.length + t + 1) → V := fun i => + if h : i.val ≤ S.length then + S.vertex ⟨i.val, by omega⟩ + else + pathVertex ⟨i.val - S.length, by omega⟩ + let eMap (t : Nat) (ht : t ≤ m) : Fin (S.length + t) → E := fun i => + if h : i.val < S.length then + S.edge ⟨i.val, h⟩ + else + pathEdge ⟨i.val - S.length, by omega⟩ + have vMap_old (t : Nat) (ht : t ≤ m) (i : Fin (S.length + 1)) : + vMap t ht (Fin.castLE (by omega) i) = S.vertex i := by + change (if h : i.val ≤ S.length then S.vertex ⟨i.val, by omega⟩ + else pathVertex ⟨i.val - S.length, by omega⟩) = S.vertex i + rw [dite_eq_left (by omega)] + have eMap_old (t : Nat) (ht : t ≤ m) (i : Fin S.length) : + eMap t ht (Fin.castLE (by omega) i) = S.edge i := by + change (if h : i.val < S.length then S.edge ⟨i.val, h⟩ + else pathEdge ⟨i.val - S.length, by omega⟩) = S.edge i + rw [dite_eq_left i.isLt] + have vMap_new := @helper_vMap_new_244 (@V) (@E) (@G) (@e0) (@S) (@m) (@pathVertex) + have eMap_new := @helper_eMap_new_254 (@V) (@E) (@G) (@e0) (@S) (@m) (@pathEdge) + have vMap_injective := @helper_vMap_injective_121 (@V) (@E) (@G) (@e0) (@S) (@m) (@pathVertex) + (@hvertexInjective) (@houtside) + have eMap_injective := @helper_eMap_injective_186 (@V) (@E) (@G) (@e0) (@S) (@m) (@pathEdge) + (@hedgeInjective) (@hedgeFresh) + have hstart_index : ∃ q : Fin (S.length + 1), S.vertex q = pathVertex 0 := by + simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] using hstart + let extend := @helperExtend398 (@V) (@E) (@G) (@e0) (@S) (@m) (@pathVertex) (@pathEdge) (@hends) + (@vMap_old) (@eMap_old) (@vMap_new) (@eMap_new) (@vMap_injective) (@eMap_injective) + (@hstart_index) + have extend_initial (a b : Nat) (ha : a ≤ m) (hb : b ≤ m) (hab : a ≤ b) : + TreeSequenceInitialSegment (extend a ha) (extend b hb) := by + refine ⟨by simp only [extend]; omega, ?_, ?_⟩ + · intro i + change Fin (S.length + a + 1) at i + have hleV : S.length + a + 1 ≤ S.length + b + 1 := by omega + change vMap b hb (Fin.castLE hleV i) = vMap a ha i + by_cases hi : i.val ≤ S.length + · have hi' : (Fin.castLE hleV i).val ≤ + S.length := hi + simp only [vMap, Fin.val_castLE, dite_eq_left hi', dite_eq_left hi] + · have hi' : ¬(Fin.castLE hleV i).val ≤ + S.length := hi + simp only [vMap, Fin.val_castLE, dite_eq_right hi', dite_eq_right hi] + · intro i + change Fin (S.length + a) at i + have hleE : S.length + a ≤ S.length + b := by omega + change eMap b hb (Fin.castLE hleE i) = eMap a ha i + by_cases hi : i.val < S.length + · have hi' : (Fin.castLE hleE i).val < + S.length := hi + simp only [eMap, Fin.val_castLE, dite_eq_left hi', dite_eq_left hi] + · have hi' : ¬(Fin.castLE hleE i).val < + S.length := hi + simp only [eMap, Fin.val_castLE, dite_eq_right hi', dite_eq_right hi] + have initial_from_old (t : Nat) (ht : t ≤ m) : + TreeSequenceInitialSegment S (extend t ht) := by + refine ⟨by simp only [extend]; omega, ?_, ?_⟩ + · intro i + change vMap t ht (Fin.castLE (by omega) i) = S.vertex i + exact vMap_old t ht i + · intro i + change eMap t ht (Fin.castLE (by omega) i) = S.edge i + exact eMap_old t ht i + have old_missing (t : Nat) (ht : t ≤ m) (c : Fin k) + (hc : c ∈ TreeMissingColors phi S) : + c ∈ TreeMissingColors phi (extend t ht) := by + rcases initial_from_old t ht with ⟨hlen0, hv0, he0⟩ + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨v, hvS, hcv⟩ + refine ⟨v, ?_, hcv⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image] at hvS ⊢ + rcases hvS with ⟨i, -, rfl⟩ + refine ⟨Fin.castLE (by simp only [extend]; omega) i, Finset.mem_univ _, ?_⟩ + exact hv0 i + have augmentation_step (t : Nat) (ht : t ≤ m) (hsucc : t + 1 ≤ m) : + TashkinovAugmentation phi (extend t ht) (extend (t + 1) hsucc) := by + have hlen : (extend (t + 1) hsucc).length = (extend t ht).length + 1 := by + simp only [extend] + omega + refine ⟨hlen, extend_initial t (t + 1) ht hsucc (by omega), ?_⟩ + let p : Fin m := ⟨t, by omega⟩ + have hedge : (extend (t + 1) hsucc).edge + (Fin.cast hlen.symm (Fin.last (extend t ht).length)) = pathEdge p := by + change eMap (t + 1) hsucc + (Fin.cast hlen.symm (Fin.last (S.length + t))) = pathEdge p + have hindex : Fin.cast hlen.symm (Fin.last (S.length + t)) = + (⟨S.length + t, by omega⟩ : Fin (S.length + (t + 1))) := by + apply Fin.ext + rfl + rw [hindex] + have hlocal : (⟨t, by omega⟩ : Fin (t + 1)) = + (⟨t, Nat.lt_succ_self t⟩ : Fin (t + 1)) := by rfl + rw [show eMap (t + 1) hsucc ⟨S.length + t, by omega⟩ = + pathEdge (Fin.castLE hsucc ⟨t, Nat.lt_succ_self t⟩) by + exact eMap_new (t + 1) hsucc ⟨t, Nat.lt_succ_self t⟩] + congr + rcases hcolors p with hp | hp + · exact ⟨alpha, (congrArg phi hedge).trans hp, + old_missing t ht alpha halpha⟩ + · exact ⟨beta, (congrArg phi hedge).trans hp, + old_missing t ht beta hbeta⟩ + have augmentation_first : + TashkinovAugmentation phi S (extend 1 (by omega)) := by + have hlen : (extend 1 (by omega)).length = S.length + 1 := by + simp only [extend] + refine ⟨hlen, initial_from_old 1 (by omega), ?_⟩ + let p : Fin m := ⟨0, hm⟩ + have hedge : (extend 1 (by omega)).edge + (Fin.cast hlen.symm (Fin.last S.length)) = pathEdge p := by + change eMap 1 (by omega) + (Fin.cast hlen.symm (Fin.last S.length)) = pathEdge p + have hindex : Fin.cast hlen.symm (Fin.last S.length) = + (⟨S.length, by omega⟩ : Fin (S.length + 1)) := by + apply Fin.ext + rfl + rw [hindex] + rw [show eMap 1 (by omega) ⟨S.length, by omega⟩ = + pathEdge (Fin.castLE (by omega) (0 : Fin 1)) by + exact eMap_new 1 (by omega) 0] + congr + rcases hcolors p with hp | hp + · exact ⟨alpha, (congrArg phi hedge).trans hp, halpha⟩ + · exact ⟨beta, (congrArg phi hedge).trans hp, hbeta⟩ + have augmentation_from_one (t : Nat) (htpos : 1 ≤ t) (ht : t ≤ m) : + TashkinovAugmentationSequence phi S (extend t ht) := by + induction t with + | zero => omega + | succ t ih => + by_cases htzero : t = 0 + · subst t + exact Relation.ReflTransGen.tail Relation.ReflTransGen.refl + augmentation_first + · have htpos' : 1 ≤ t := by omega + have ht' : t ≤ m := by omega + exact Relation.ReflTransGen.tail (ih htpos' ht') + (augmentation_step t ht' (by omega)) + let S' := extend m le_rfl + exact @helper_continuation_699 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) + (@S) (@alpha) (@beta) (@y) (@m) (@hm) (@pathVertex) (@pathEdge) (@houtside) + (@hvertexComponent) (@hedgeComponent) (@hcolors) (@hends) (@vMap_old) (@eMap_old) + (@vMap_new) (@eMap_new) (@vMap_injective) (@eMap_injective) (@hstart_index) + (@initial_from_old) (@augmentation_from_one) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentation.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentation.lean new file mode 100644 index 0000000000..2267b2cc8a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentation.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment + +/-! +# Tashkinov Augmentation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- One initial-segment tree extension whose new edge has a color missing on the original tree. -/ +def TashkinovAugmentation {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T T' : TreeSequence G e0) : Prop := + ∃ hlen : T'.length = T.length + 1, + TreeSequenceInitialSegment T T' ∧ + ∃ c : Fin k, + phi (T'.edge (Fin.cast hlen.symm (Fin.last T.length))) = some c ∧ c ∈ TreeMissingColors phi T + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequence.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequence.lean new file mode 100644 index 0000000000..7de077525a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequence.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentation + +/-! +# Tashkinov Augmentation Sequence + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The reflexive transitive closure of one-edge Tashkinov augmentations. -/ +def TashkinovAugmentationSequence {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} (phi : PartialEdgeColoring E k) (T T' : TreeSequence G e0) : Prop := + Relation.ReflTransGen (TashkinovAugmentation phi) T T' + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceColoringTransport.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceColoringTransport.lean new file mode 100644 index 0000000000..9fa3c9973e --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceColoringTransport.lean @@ -0,0 +1,149 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence + +/-! +# Tashkinov Augmentation Sequence Coloring Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovAugmentationSequenceColoringTransport + {V E : Type*} [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi sigma : PartialEdgeColoring E k) + (S B X : TreeSequence G e0) + (hsequence : TashkinovAugmentationSequence phi S X) + (hBX : TreeSequenceInitialSegment B X) + (hpenultimate : X.length = B.length + 1) + (hfixed : forall t : Fin X.length, S.length <= t.val -> + sigma (X.edge t) = phi (X.edge t)) + (hmissing : forall v, v ∈ TreeSequenceVertexSet B -> + MissingColors G sigma v = MissingColors G phi v) : + TashkinovAugmentationSequence sigma S X := by + classical + let _ := Fintype.ofFinite V + have initialSegmentRefl (A : TreeSequence G e0) : + TreeSequenceInitialSegment A A := by + refine ⟨Nat.le_refl _, ?_, ?_⟩ + · intro i + rfl + · intro i + rfl + have initialSegmentTrans {A C D : TreeSequence G e0} + (hAC : TreeSequenceInitialSegment A C) + (hCD : TreeSequenceInitialSegment C D) : + TreeSequenceInitialSegment A D := by + rcases hAC with ⟨hACLen, hACVertex, hACEdge⟩ + rcases hCD with ⟨hCDLen, hCDVertex, hCDEdge⟩ + refine ⟨Nat.le_trans hACLen hCDLen, ?_, ?_⟩ + · intro i + calc + D.vertex (Fin.castLE (Nat.succ_le_succ (Nat.le_trans hACLen hCDLen)) i) = + D.vertex (Fin.castLE (Nat.succ_le_succ hCDLen) + (Fin.castLE (Nat.succ_le_succ hACLen) i)) := by + congr 1 + _ = C.vertex (Fin.castLE (Nat.succ_le_succ hACLen) i) := + hCDVertex _ + _ = A.vertex i := hACVertex i + · intro i + calc + D.edge (Fin.castLE (Nat.le_trans hACLen hCDLen) i) = + D.edge (Fin.castLE hCDLen (Fin.castLE hACLen i)) := by + congr 1 + _ = C.edge (Fin.castLE hACLen i) := hCDEdge _ + _ = A.edge i := hACEdge i + have routeInitialSegment {A C : TreeSequence G e0} + (hroute : TashkinovAugmentationSequence phi A C) : + TreeSequenceInitialSegment A C := by + unfold TashkinovAugmentationSequence at hroute + induction hroute with + | refl => exact initialSegmentRefl A + | @tail C D hAC hCD ih => + exact initialSegmentTrans ih hCD.2.1 + have commonExtensionPrefix {A : TreeSequence G e0} + (hAX : TreeSequenceInitialSegment A X) + (hlen : A.length < X.length) : + TreeSequenceInitialSegment A B := by + rcases hAX with ⟨hAXLen, hAXVertex, hAXEdge⟩ + rcases hBX with ⟨hBXLen, hBXVertex, hBXEdge⟩ + have hABLen : A.length ≤ B.length := by omega + refine ⟨hABLen, ?_, ?_⟩ + · intro i + calc + B.vertex (Fin.castLE (Nat.succ_le_succ hABLen) i) = + X.vertex (Fin.castLE (Nat.succ_le_succ hBXLen) + (Fin.castLE (Nat.succ_le_succ hABLen) i)) := + (hBXVertex _).symm + _ = X.vertex (Fin.castLE (Nat.succ_le_succ hAXLen) i) := by + congr 1 + _ = A.vertex i := hAXVertex i + · intro i + calc + B.edge (Fin.castLE hABLen i) = + X.edge (Fin.castLE hBXLen (Fin.castLE hABLen i)) := + (hBXEdge _).symm + _ = X.edge (Fin.castLE hAXLen i) := by + congr 1 + _ = A.edge i := hAXEdge i + have transport (A : TreeSequence G e0) (hsource : S.length ≤ A.length) + (hroute : TashkinovAugmentationSequence phi A X) : + TashkinovAugmentationSequence sigma A X := by + unfold TashkinovAugmentationSequence at hroute ⊢ + revert hsource + refine Relation.ReflTransGen.head_induction_on hroute ?_ ?_ + · intro hsource + exact Relation.ReflTransGen.refl + · intro A C hstep htail ih hsource + rcases hstep with ⟨hlen, hAC, c, hcolor, hc⟩ + have hCX : TreeSequenceInitialSegment C X := by + exact routeInitialSegment htail + have hAX : TreeSequenceInitialSegment A X := + initialSegmentTrans hAC hCX + have hAlen : A.length < X.length := by + have hCXLen := hCX.1 + omega + have hAB : TreeSequenceInitialSegment A B := + commonExtensionPrefix hAX hAlen + have hcSigma : c ∈ TreeMissingColors sigma A := by + rw [TreeMissingColors] at hc ⊢ + rcases Finset.mem_biUnion.mp hc with ⟨v, hvA, hcv⟩ + have hvB : v ∈ TreeSequenceVertexSet B := by + rw [TreeSequenceVertexSet] at hvA ⊢ + rcases Finset.mem_image.mp hvA with ⟨j, _, hj⟩ + refine Finset.mem_image.mpr ⟨Fin.castLE (Nat.succ_le_succ hAB.1) j, + Finset.mem_univ _, ?_⟩ + rw [hAB.2.1 j] + exact hj + refine Finset.mem_biUnion.mpr ⟨v, hvA, ?_⟩ + rw [hmissing v hvB] + exact hcv + have haddedFixed : + sigma (C.edge (Fin.cast hlen.symm (Fin.last A.length))) = + phi (C.edge (Fin.cast hlen.symm (Fin.last A.length))) := by + let tC : Fin C.length := Fin.cast hlen.symm (Fin.last A.length) + let tX : Fin X.length := Fin.castLE hCX.1 tC + have htval : tX.val = A.length := rfl + have hfix := hfixed tX (by simpa [htval] using hsource) + have hedge : X.edge tX = C.edge tC := hCX.2.2 tC + simpa [tC, tX, hedge] using hfix + have hsourceC : S.length ≤ C.length := by omega + exact Relation.ReflTransGen.head + ⟨hlen, hAC, c, haddedFixed.trans hcolor, hcSigma⟩ + (ih hsourceC) + exact transport S (Nat.le_refl _) hsequence + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceComponentSwap.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceComponentSwap.lean new file mode 100644 index 0000000000..9b1418d318 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceComponentSwap.lean @@ -0,0 +1,144 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap + +/-! +# Tashkinov Augmentation Sequence Component Swap + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovAugmentationSequenceComponentSwap {V E : Type*} + [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (_ : alpha ≠ beta) (z : Sum V E) + (X Y : TreeSequence G e0) + (hsequence : TashkinovAugmentationSequence phi X Y) + (halpha : alpha ∈ TreeMissingColors + (TwoColorComponentSwap G phi alpha beta z) X) + (hbeta : beta ∈ TreeMissingColors + (TwoColorComponentSwap G phi alpha beta z) X) : + TashkinovAugmentationSequence (TwoColorComponentSwap G phi alpha beta z) X Y := by + classical + let _ := Fintype.ofFinite V + let sigma := TwoColorComponentSwap G phi alpha beta z + have vertexTransfer {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + rcases hv with ⟨i, hi⟩ + rcases hab with ⟨hlen, hvertices, hedges⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, ?_⟩ + exact (hvertices i).trans hi + have missingTransfer {c : Fin k} {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) + (hc : c ∈ TreeMissingColors sigma A) : + c ∈ TreeMissingColors sigma B := by + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨v, hv, hvc⟩ + exact ⟨v, vertexTransfer hab hv, hvc⟩ + have missingStable {c : Fin k} (hcα : c ≠ alpha) (hcβ : c ≠ beta) + {v : V} (hv : c ∈ MissingColors G phi v) : + c ∈ MissingColors G sigma v := by + unfold MissingColors at hv ⊢ + rw [Finset.mem_sdiff] at hv ⊢ + refine ⟨Finset.mem_univ _, ?_⟩ + intro hp + apply hv.2 + rw [PresentColors] + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + rw [PresentColors] at hp + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hp + rcases hp with ⟨e, he, hpe⟩ + refine ⟨e, he, ?_⟩ + change TwoColorComponentSwap G phi alpha beta z e = some c at hpe + unfold TwoColorComponentSwap at hpe + by_cases hcomp : Sum.inr e ∈ TwoColorComponent G phi alpha beta z + · simp only [ite_eq_left hcomp] at hpe + by_cases ha : phi e = some alpha + · simp only [ite_eq_left ha] at hpe + exact (hcβ (Option.some.inj hpe).symm).elim + · by_cases hb : phi e = some beta + · simp only [ite_eq_right ha, ite_eq_left hb] at hpe + exact (hcα (Option.some.inj hpe).symm).elim + · simp only [ite_eq_right ha, ite_eq_right hb] at hpe + exact hpe + · simpa [hcomp] using hpe + have stepTransfer {A B : TreeSequence G e0} + (hstep : TashkinovAugmentation phi A B) + (ha : alpha ∈ TreeMissingColors sigma A) + (hb : beta ∈ TreeMissingColors sigma A) : + TashkinovAugmentation sigma A B := by + rcases hstep with ⟨hlen, hinit, c, hedge, hc⟩ + refine ⟨hlen, hinit, ?_⟩ + have hcolor : phi (B.edge (Fin.cast hlen.symm (Fin.last A.length))) = some c := hedge + have hcases : c = alpha ∨ c = beta ∨ (c ≠ alpha ∧ c ≠ beta) := by + by_cases ha : c = alpha + · exact Or.inl ha + · by_cases hb : c = beta + · exact Or.inr (Or.inl hb) + · exact Or.inr (Or.inr ⟨ha, hb⟩) + rcases hcases with hca | hcb | ⟨hcα, hcβ⟩ + · subst c + by_cases hcomp : Sum.inr (B.edge (Fin.cast hlen.symm (Fin.last A.length))) ∈ + TwoColorComponent G phi alpha beta z + · refine ⟨beta, ?_, hb⟩ + simp [sigma, TwoColorComponentSwap, hcomp, hcolor] + · refine ⟨alpha, ?_, ha⟩ + simp [sigma, TwoColorComponentSwap, hcomp, hcolor] + · subst c + by_cases hcomp : Sum.inr (B.edge (Fin.cast hlen.symm (Fin.last A.length))) ∈ + TwoColorComponent G phi alpha beta z + · refine ⟨alpha, ?_, ha⟩ + simp [sigma, TwoColorComponentSwap, hcomp, hcolor] + · refine ⟨beta, ?_, hb⟩ + simp [sigma, TwoColorComponentSwap, hcomp, hcolor] + · refine ⟨c, ?_, ?_⟩ + · change sigma (B.edge (Fin.cast hlen.symm (Fin.last A.length))) = some c + by_cases hcomp : Sum.inr (B.edge (Fin.cast hlen.symm (Fin.last A.length))) ∈ + TwoColorComponent G phi alpha beta z + · simp [sigma, TwoColorComponentSwap, hcomp, hcolor, hcα, hcβ] + · simp [sigma, TwoColorComponentSwap, hcomp, hcolor] + · rw [TreeMissingColors] at hc + rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hvc⟩ + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, missingStable hcα hcβ hvc⟩ + have transport : + ∀ (A B : TreeSequence G e0), TashkinovAugmentationSequence phi A B → alpha ∈ TreeMissingColors + sigma A → beta ∈ TreeMissingColors sigma A → TashkinovAugmentationSequence sigma A B := by + intro A B hreach + unfold TashkinovAugmentationSequence at hreach ⊢ + induction hreach using Relation.ReflTransGen.head_induction_on with + | refl => + intro ha hb + exact Relation.ReflTransGen.refl + | head hstep htail ih => + intro ha hb + rcases hstep with ⟨hlen, hinit, c, hedge, hc⟩ + have hac := missingTransfer hinit ha + have hbc := missingTransfer hinit hb + exact Relation.ReflTransGen.head + (stepTransfer ⟨hlen, hinit, c, hedge, hc⟩ ha hb) (ih hac hbc) + exact transport X Y hsequence halpha hbeta + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean new file mode 100644 index 0000000000..6e3a364ddc --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean @@ -0,0 +1,57 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence + +/-! +# Tashkinov Augmentation Sequence Initial Segment + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovAugmentationSequenceInitialSegment + {V E : Type*} [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (A B : TreeSequence G e0) + (hAB : TashkinovAugmentationSequence phi A B) : + TreeSequenceInitialSegment A B := by + classical + let _ := Fintype.ofFinite V + unfold TashkinovAugmentationSequence at hAB + induction hAB with + | refl => + exact ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + | @tail B C hAB hBC ih => + rcases hBC with ⟨hlenEq, hsegBC, _⟩ + rcases ih with ⟨hlenAB, hvertexAB, hedgeAB⟩ + rcases hsegBC with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨Nat.le_trans hlenAB hlenBC, ?_, ?_⟩ + · intro i + calc + C.vertex (Fin.castLE + (Nat.succ_le_succ (Nat.le_trans hlenAB hlenBC)) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hlenBC) + (Fin.castLE (Nat.succ_le_succ hlenAB) i)) := by congr 1 + _ = B.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) i) := + hvertexBC _ + _ = A.vertex i := hvertexAB i + · intro i + calc + C.edge (Fin.castLE (Nat.le_trans hlenAB hlenBC) i) = + C.edge (Fin.castLE hlenBC (Fin.castLE hlenAB i)) := by congr 1 + _ = B.edge (Fin.castLE hlenAB i) := hedgeBC _ + _ = A.edge i := hedgeAB i + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePosition.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePosition.lean new file mode 100644 index 0000000000..ae053036e6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePosition.lean @@ -0,0 +1,150 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +/-! +# Tashkinov Augmentation Sequence Position + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovAugmentationSequencePosition + {V E : Type*} [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (A B : TreeSequence G e0) + (hAB : TashkinovAugmentationSequence phi A B) + (t : Fin B.length) (hAt : A.length ≤ t.val) : + let Bt := TreeSequencePrefix B t.val + (le_trans A.positive hAt) (Nat.le_of_lt t.isLt) + let Bt1 := TreeSequencePrefix B (t.val + 1) + (by omega) (Nat.succ_le_of_lt t.isLt) + TashkinovAugmentation phi Bt Bt1 ∧ + Bt1.edge (Fin.last t.val) = B.edge t := by + classical + let _ := Fintype.ofFinite V + dsimp only + let Bt := TreeSequencePrefix B t.val + (le_trans A.positive hAt) (Nat.le_of_lt t.isLt) + let Bt1 := TreeSequencePrefix B (t.val + 1) + (by omega) (Nat.succ_le_of_lt t.isLt) + have segmentRefl (X : TreeSequence G e0) : + TreeSequenceInitialSegment X X := + ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + have segmentTrans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + rcases hXY with ⟨hxy, hvxy, hexy⟩ + rcases hYZ with ⟨hyz, hvyz, heyz⟩ + refine ⟨le_trans hxy hyz, ?_, ?_⟩ + · intro i + have hmid := hvyz (Fin.castLE (Nat.succ_le_succ hxy) i) + simpa using hmid.trans (hvxy i) + · intro i + have hmid := heyz (Fin.castLE hxy i) + simpa using hmid.trans (hexy i) + have commonPrefix {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) + (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + rcases hXZ with ⟨hxz, hvxz, hexz⟩ + rcases hYZ with ⟨hyz, hvyz, heyz⟩ + refine ⟨hXY, ?_, ?_⟩ + · intro i + calc + Y.vertex (Fin.castLE (Nat.succ_le_succ hXY) i) = + Z.vertex (Fin.castLE (Nat.succ_le_succ hyz) + (Fin.castLE (Nat.succ_le_succ hXY) i)) := + (hvyz _).symm + _ = Z.vertex (Fin.castLE (Nat.succ_le_succ hxz) i) := by + congr 1 + _ = X.vertex i := hvxz i + · intro i + calc + Y.edge (Fin.castLE hXY i) = + Z.edge (Fin.castLE hyz (Fin.castLE hXY i)) := + (heyz _).symm + _ = Z.edge (Fin.castLE hxz i) := by + congr 1 + _ = X.edge i := hexz i + have equalTrees {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hlen : X.length = Y.length) : X = Y := by + cases X with + | mk lx px vx ex vix eix fx ax => + cases Y with + | mk ly py vy ey viy eiy fy ay => + simp only at hlen + subst ly + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hXY.2.1 i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hXY.2.2 i).symm + have hAinitialB := TashkinovAugmentationSequenceInitialSegment phi A B hAB + have hBtB : TreeSequenceInitialSegment Bt B := by + refine ⟨Nat.le_of_lt t.isLt, ?_, ?_⟩ + · intro i + simp [Bt, TreeSequencePrefix] + · intro i + simp [Bt, TreeSequencePrefix] + have hBt1B : TreeSequenceInitialSegment Bt1 B := by + refine ⟨Nat.succ_le_of_lt t.isLt, ?_, ?_⟩ + · intro i + simp [Bt1, TreeSequencePrefix] + · intro i + simp [Bt1, TreeSequencePrefix] + have hABt : TreeSequenceInitialSegment A Bt := + commonPrefix hAinitialB hBtB (by simpa [Bt, TreeSequencePrefix] using hAt) + have hBtBt1 : TreeSequenceInitialSegment Bt Bt1 := + commonPrefix hBtB hBt1B (by simp [Bt, Bt1, TreeSequencePrefix]) + have hABt1 : TreeSequenceInitialSegment A Bt1 := + segmentTrans hABt hBtBt1 + have hseqABt1 : TashkinovAugmentationSequence phi A Bt1 := + TashkinovAugmentationSequenceRestrict phi A Bt1 B hAB hABt1 hBt1B + have hseq : TashkinovAugmentationSequence phi Bt Bt1 := + TashkinovAugmentationSequenceSuffix phi A Bt Bt1 hseqABt1 hABt hBtBt1 + have oneStepOfLength {X Y : TreeSequence G e0} + (hseqXY : TashkinovAugmentationSequence phi X Y) + (hlenXY : Y.length = X.length + 1) : + TashkinovAugmentation phi X Y := by + unfold TashkinovAugmentationSequence at hseqXY + induction hseqXY with + | refl => omega + | @tail Z Y hXZ hZY ih => + have hprefix := + TashkinovAugmentationSequenceInitialSegment phi X Z hXZ + have hZlen : Z.length = X.length := by + rcases hZY with ⟨hlen, hsegment, hcolor⟩ + have hle := hprefix.1 + omega + have hXZeq : X = Z := equalTrees hprefix hZlen.symm + subst Z + exact hZY + have hstep : TashkinovAugmentation phi Bt Bt1 := + oneStepOfLength hseq (by simp [Bt, Bt1, TreeSequencePrefix]) + refine ⟨hstep, ?_⟩ + change B.edge _ = B.edge t + congr 1 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePreservesTashkinovTree.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePreservesTashkinovTree.lean new file mode 100644 index 0000000000..7f4cd91fe2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePreservesTashkinovTree.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence + +public import LeanPool.GoldbergSeymour.TashkinovTree + +/-! +# Tashkinov Augmentation Sequence Preserves Tashkinov Tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovAugmentationSequencePreservesTashkinovTree + {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) {k : ℕ} (e0 : E) + (phi : PartialEdgeColoring E k) (T T' : TreeSequence G e0) + (hT : TashkinovTree G e0 phi T) + (hseq : TashkinovAugmentationSequence phi T T') : + TashkinovTree G e0 phi T' := by + classical + let _ := Fintype.ofFinite V + unfold TashkinovAugmentationSequence at hseq + induction hseq using Relation.ReflTransGen.head_induction_on with + | refl => exact hT + | @head A B hstep hreach ih => + apply ih + rcases hstep with ⟨hlen, hinit, c, hedge, hc⟩ + rcases hinit with ⟨hle, hvertices, hedges⟩ + intro j hj + by_cases hold : j.val < A.length + · let jA : Fin A.length := ⟨j.val, hold⟩ + rcases hT jA hj with ⟨i, d, hcolor, hmissing⟩ + refine ⟨i, d, ?_, ?_⟩ + · have hjeq : Fin.castLE hle jA = j := Fin.ext rfl + rw [← hjeq, hedges] + exact hcolor + · let qA : Fin (A.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ jA.isLt)) + have hqeq : Fin.castLE (Nat.succ_le_succ hle) qA = + Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) := Fin.ext rfl + rw [← hqeq, hvertices] + exact hmissing + · have hjval : j.val = A.length := by omega + rw [TreeMissingColors] at hc + rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hcv⟩ + rw [TreeSequenceVertexSet] at hv + rcases Finset.mem_image.mp hv with ⟨q, _, hq⟩ + let i : Fin (j.val + 1) := ⟨q.val, by omega⟩ + refine ⟨i, c, ?_, ?_⟩ + · have hjlast : + j = Fin.cast hlen.symm (Fin.last A.length) := Fin.ext hjval + rw [hjlast] + exact hedge + · have hqeq : Fin.castLE (Nat.succ_le_succ hle) q = + Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) := Fin.ext rfl + rw [← hqeq, hvertices] + simpa only [hq] using hcv + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceRestrict.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceRestrict.lean new file mode 100644 index 0000000000..0193e1db55 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceRestrict.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence + +/-! +# Tashkinov Augmentation Sequence Restrict + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovAugmentationSequenceRestrict + {V E : Type*} [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (S B C : TreeSequence G e0) + (hSC : TashkinovAugmentationSequence phi S C) + (hSB : TreeSequenceInitialSegment S B) + (hBC : TreeSequenceInitialSegment B C) : + TashkinovAugmentationSequence phi S B := by + classical + let _ := Fintype.ofFinite V + have initialSegment_antisymm_length + {A D : TreeSequence G e0} + (hAD : TreeSequenceInitialSegment A D) + (hlen : A.length = D.length) : A = D := by + rcases hAD with ⟨hle, hvertex, hedge⟩ + cases A with + | mk la pa va ea via eia fea aa => + cases D with + | mk ld pd vd ed vid eid fed ad => + simp only at hlen + subst ld + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hvertex i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hedge i).symm + have initialSegment_of_common_extension + {A D F : TreeSequence G e0} + (hAF : TreeSequenceInitialSegment A F) + (hDF : TreeSequenceInitialSegment D F) + (hDA : D.length ≤ A.length) : + TreeSequenceInitialSegment D A := by + rcases hAF with ⟨hAlen, hAvertex, hAedge⟩ + rcases hDF with ⟨hDlen, hDvertex, hDedge⟩ + refine ⟨hDA, ?_, ?_⟩ + · intro i + calc + A.vertex (Fin.castLE (Nat.succ_le_succ hDA) i) = + F.vertex (Fin.castLE (Nat.succ_le_succ hAlen) + (Fin.castLE (Nat.succ_le_succ hDA) i)) := + (hAvertex (Fin.castLE (Nat.succ_le_succ hDA) i)).symm + _ = F.vertex (Fin.castLE (Nat.succ_le_succ hDlen) i) := by + congr 1 + _ = D.vertex i := hDvertex i + · intro i + calc + A.edge (Fin.castLE hDA i) = + F.edge (Fin.castLE hAlen (Fin.castLE hDA i)) := + (hAedge (Fin.castLE hDA i)).symm + _ = F.edge (Fin.castLE hDlen i) := by + congr 1 + _ = D.edge i := hDedge i + unfold TashkinovAugmentationSequence at hSC ⊢ + induction hSC generalizing B with + | refl => + have hlen : B.length = S.length := + Nat.le_antisymm hBC.1 hSB.1 + have hBS : B = S := + initialSegment_antisymm_length hBC hlen + subst B + exact Relation.ReflTransGen.refl + | @tail A C hSA hAC ih => + rcases hAC with ⟨hlen, hinitAC, hcolor⟩ + by_cases hBA : B.length ≤ A.length + · exact ih B hSB + (initialSegment_of_common_extension hinitAC hBC hBA) + · have hBlen : B.length = C.length := by + rcases hBC with ⟨hBCle, _, _⟩ + omega + have hBCeq : B = C := + initialSegment_antisymm_length hBC hBlen + subst B + exact Relation.ReflTransGen.tail hSA ⟨hlen, hinitAC, hcolor⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceStrictBoundaryWitness.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceStrictBoundaryWitness.lean new file mode 100644 index 0000000000..763f1222d6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceStrictBoundaryWitness.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence + +/-! +# Tashkinov Augmentation Sequence Strict Boundary Witness + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovAugmentationSequenceStrictBoundaryWitness + {V E : Type*} [Fintype V] [Fintype E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (A B : TreeSequence G e0) + (hAB : TashkinovAugmentationSequence phi A B) + (hstrict : A.length < B.length) : + ∃ c : Fin k, c ∈ TreeMissingColors phi A ∧ + (BoundaryColorEdges G phi (TreeSequenceVertexSet A) c).Nonempty := by + classical + unfold TashkinovAugmentationSequence at hAB + induction hAB using Relation.ReflTransGen.head_induction_on with + | refl => omega + | @head A C hAC hCB ih => + rcases hAC with ⟨hlen, hsegment, c, hcolor, hmissing⟩ + refine ⟨c, hmissing, ?_⟩ + let j : Fin C.length := Fin.cast hlen.symm (Fin.last A.length) + refine ⟨C.edge j, ?_⟩ + simp only [BoundaryColorEdges, Finset.mem_filter] + refine ⟨?_, hcolor⟩ + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + obtain ⟨i, hi⟩ := C.attaches j + let oldIndex : Fin (A.length + 1) := ⟨i.val, by + have hiLt := i.isLt + simp [j] at hiLt + omega⟩ + let cIndex : Fin (C.length + 1) := + Fin.castLE (Nat.succ_le_succ hsegment.1) oldIndex + have hOldVertex : C.vertex cIndex = A.vertex oldIndex := + hsegment.2.1 oldIndex + have hNewOutside : C.vertex j.succ ∉ TreeSequenceVertexSet A := by + intro hmem + rw [TreeSequenceVertexSet] at hmem + obtain ⟨a, -, ha⟩ := Finset.mem_image.mp hmem + have heq : C.vertex j.succ = + C.vertex (Fin.castLE (Nat.succ_le_succ hsegment.1) a) := + ha.symm.trans (hsegment.2.1 a).symm + have hindex := congrArg Fin.val (C.vertex_injective heq) + simp [j] at hindex + omega + refine ⟨C.vertex cIndex, ?_, C.vertex j.succ, hNewOutside, ?_⟩ + · rw [TreeSequenceVertexSet] + exact Finset.mem_image.mpr ⟨oldIndex, Finset.mem_univ _, hOldVertex.symm⟩ + · have hicast : + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)) = cIndex := by + apply Fin.ext + rfl + calc + G.ends (C.edge j) = + s(C.vertex j.succ, + C.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)))) := hi + _ = s(C.vertex j.succ, C.vertex cIndex) := by rw [hicast] + _ = s(C.vertex cIndex, C.vertex j.succ) := Sym2.eq_swap + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceSuffix.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceSuffix.lean new file mode 100644 index 0000000000..955d92b079 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceSuffix.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence + +/-! +# Tashkinov Augmentation Sequence Suffix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovAugmentationSequenceSuffix + {V E : Type*} [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (S B C : TreeSequence G e0) + (hSC : TashkinovAugmentationSequence phi S C) + (hSB : TreeSequenceInitialSegment S B) + (hBC : TreeSequenceInitialSegment B C) : + TashkinovAugmentationSequence phi B C := by + classical + let _ := Fintype.ofFinite V + have equalTrees {X Y : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hlen : X.length = Y.length) : X = Y := by + rcases hXY with ⟨hle, hv, he⟩ + cases X with + | mk lx px vx ex vix eix fx ax => + cases Y with + | mk ly py vy ey viy eiy fy ay => + simp only at hlen + subst ly + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hv i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (he i).symm + have commonPrefix {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) + (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + rcases hXZ with ⟨hxz, hvx, hex⟩ + rcases hYZ with ⟨hyz, hvy, hey⟩ + refine ⟨hXY, ?_, ?_⟩ + · intro i + calc + Y.vertex (Fin.castLE (Nat.succ_le_succ hXY) i) = + Z.vertex (Fin.castLE (Nat.succ_le_succ hyz) + (Fin.castLE (Nat.succ_le_succ hXY) i)) := (hvy _).symm + _ = Z.vertex (Fin.castLE (Nat.succ_le_succ hxz) i) := by congr 1 + _ = X.vertex i := hvx i + · intro i + calc + Y.edge (Fin.castLE hXY i) = + Z.edge (Fin.castLE hyz (Fin.castLE hXY i)) := (hey _).symm + _ = Z.edge (Fin.castLE hxz i) := by congr 1 + _ = X.edge i := hex i + unfold TashkinovAugmentationSequence at hSC ⊢ + induction hSC generalizing B with + | refl => + have hlen : B.length = S.length := Nat.le_antisymm hBC.1 hSB.1 + have hBS : B = S := equalTrees hBC hlen + subst B + exact Relation.ReflTransGen.refl + | @tail A C hSA hAC ih => + rcases hAC with ⟨hlen, hinitAC, hcolor⟩ + by_cases hBA : B.length ≤ A.length + · have hBC' : TreeSequenceInitialSegment B A := + commonPrefix hBC hinitAC hBA + exact Relation.ReflTransGen.tail + (ih B hSB hBC') ⟨hlen, hinitAC, hcolor⟩ + · have hBlen : B.length = C.length := by + rcases hBC with ⟨hBCle, _, _⟩ + omega + have hBCeq : B = C := equalTrees hBC hBlen + subst B + exact Relation.ReflTransGen.refl + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovClosure.lean b/LeanPool/GoldbergSeymour/TashkinovClosure.lean new file mode 100644 index 0000000000..121c461305 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovClosure.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence + +/-! +# Tashkinov Closure + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A tree reachable by augmentations whose vertex set is closed under the coloring. -/ +def TashkinovClosure {V E : Type*} [Fintype V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T T' : TreeSequence G e0) : Prop := + TashkinovAugmentationSequence phi T T' ∧ ColoredVertexSetClosed G phi (TreeSequenceVertexSet T') + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovClosureExists.lean b/LeanPool/GoldbergSeymour/TashkinovClosureExists.lean new file mode 100644 index 0000000000..23bad069c2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovClosureExists.lean @@ -0,0 +1,211 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Finset.Max + +public import LeanPool.GoldbergSeymour.TashkinovClosure + +/-! +# Tashkinov Closure Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovClosureExists {V E : Type*} [Fintype V] [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) : + ∃ T' : TreeSequence G e0, TashkinovClosure phi T T' := by + classical + have length_bound : ∀ S : TreeSequence G e0, S.length ≤ Fintype.card V := by + intro S + have h := Fintype.card_le_of_injective S.vertex S.vertex_injective + have h' : S.length + 1 ≤ Fintype.card V := by simpa using h + omega + let lengths : Finset ℕ := (Finset.range (Fintype.card V + 1)).filter + (fun n => ∃ S : TreeSequence G e0, + TashkinovAugmentationSequence phi T S ∧ S.length = n) + have lengths_nonempty : lengths.Nonempty := by + have hT : T.length ≤ Fintype.card V := length_bound T + refine ⟨T.length, ?_⟩ + simp only [lengths, Finset.mem_filter, Finset.mem_range] + exact ⟨Nat.lt_succ_of_le hT, ⟨T, Relation.ReflTransGen.refl, rfl⟩⟩ + let largest : ℕ := lengths.max' lengths_nonempty + have largest_mem : largest ∈ lengths := by + exact Finset.max'_mem lengths lengths_nonempty + obtain ⟨S, hreach, hlength⟩ := (Finset.mem_filter.mp largest_mem).2 + have hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet S) := by + by_contra hnot + unfold ColoredVertexSetClosed at hnot + push Not at hnot + obtain ⟨f, c, z, hf, hz, hfc, hcz⟩ := hnot + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf + obtain ⟨x, hx, y, hy, hxy⟩ := hf + have vertex_mem : ∀ i : Fin (S.length + 1), + S.vertex i ∈ TreeSequenceVertexSet S := by + intro i + simp [TreeSequenceVertexSet] + have edge_new : ∀ i : Fin S.length, f ≠ S.edge i := by + intro i he + obtain ⟨q, hq⟩ := S.attaches i + have hyend : y ∈ G.ends (S.edge i) := by + rw [← he, hxy] + exact Sym2.mem_iff.mpr (Or.inr rfl) + rw [hq] at hyend + rcases Sym2.mem_iff.mp hyend with hqv | hqv + · exact hy (by simpa [← hqv] using vertex_mem i.succ) + · exact hy (by simpa [← hqv] using vertex_mem (Fin.castLT q (by omega))) + let U : TreeSequence G e0 := + { length := S.length + 1 + positive := by omega + vertex := Fin.lastCases y (fun i => S.vertex i) + edge := Fin.lastCases f (fun i => S.edge i) + vertex_injective := by + intro i j + revert j + refine Fin.lastCases ?_ (fun i => ?_) i + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij + apply Fin.ext + rfl + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at hij + have heq : y = S.vertex j := by + exact hij + exact (hy (heq ▸ vertex_mem j)).elim + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_last] at hij + have heq : S.vertex i = y := by + exact hij + exact (hy (heq ▸ vertex_mem i)).elim + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_castSucc] at hij + exact congrArg Fin.castSucc (S.vertex_injective hij) + edge_injective := by + intro i j + revert j + refine Fin.lastCases ?_ (fun i => ?_) i + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij + apply Fin.ext + rfl + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at hij + exact False.elim (edge_new j hij) + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_last] at hij + exact False.elim (edge_new i hij.symm) + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_castSucc] at hij + exact congrArg Fin.castSucc (S.edge_injective hij) + first_edge := by + have hzero : (⟨0, Nat.succ_pos _⟩ : Fin (S.length + 1)) = + (⟨0, S.positive⟩ : Fin S.length).castSucc := by rfl + rw [hzero] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + exact S.first_edge + attaches := by + intro j + by_cases hj : j = Fin.last S.length + · subst j + obtain ⟨i, hi⟩ := by + simpa [TreeSequenceVertexSet] using hx + refine ⟨i, ?_⟩ + have hc : (Fin.castLT i (by omega) : Fin (S.length + 1 + 1)) = i.castSucc := by + apply Fin.ext + rfl + rw [hc] + simp only [Fin.lastCases_last, Fin.succ_last, Nat.succ_eq_add_one, + Fin.lastCases_castSucc] + rw [← hi] at hxy + rw [hxy] + exact (Sym2.eq_iff).2 (Or.inr ⟨rfl, rfl⟩) + · have hjle : j.val ≤ S.length := Nat.lt_succ_iff.mp j.isLt + have hjne : j.val ≠ S.length := by + intro he + apply hj + apply Fin.ext + simpa using he + have hj' : j.val < S.length := Nat.lt_of_le_of_ne hjle hjne + obtain ⟨i, hi⟩ := S.attaches (j.castPred hj) + have hjform : j = (j.castPred hj).castSucc := by + apply Fin.ext + rfl + have hji : (j.castPred hj).val + 1 ≤ j.val + 1 := by + rw [show (j.castPred hj).val = j.val by rfl] + refine ⟨Fin.castLE hji i, ?_⟩ + convert hi using 1 + · apply congrArg G.ends + conv_lhs => rw [hjform] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + · apply (Sym2.eq_iff).2 + left + constructor + · have hjs : j.succ = (j.castPred hj).succ.castSucc := by + apply Fin.ext + rfl + rw [hjs] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + · have ibound : i.val < S.length + 1 := by omega + have hq : + (Fin.castLE hji i).castLT (by omega) = + (i.castLT ibound).castSucc := by + apply Fin.ext + rfl + rw [hq] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] } + have hstep : TashkinovAugmentation phi S U := by + refine ⟨by simp [U], ?_, c, ?_, ?_⟩ + · refine ⟨Nat.le_succ _, ?_, ?_⟩ + · intro i + dsimp [U] + have hc : Fin.castLE (Nat.succ_le_succ (Nat.le_succ S.length)) i = i.castSucc := by + apply Fin.ext + rfl + rw [hc] + simp [Fin.lastCases, Fin.reverseInduction_castSucc] + · intro j + have hc : Fin.castLE (Nat.le_succ S.length) j = j.castSucc := by + apply Fin.ext + rfl + rw [hc] + simp [U, Fin.lastCases, Fin.reverseInduction_castSucc] + · simpa [U, Fin.lastCases] using hfc + · exact Finset.mem_biUnion.mpr ⟨z, hz, hcz⟩ + have hnew : TashkinovAugmentationSequence phi T U := hreach.tail hstep + have hUmem : largest + 1 ∈ lengths := by + apply Finset.mem_filter.mpr + constructor + · have hu := length_bound U + have hu' : S.length + 1 ≤ Fintype.card V := by simpa [U] using hu + simpa [hlength] using Nat.lt_succ_of_le hu' + · refine ⟨U, hnew, ?_⟩ + simp [U, hlength] + have hle := Finset.le_max' lengths (largest + 1) hUmem + omega + exact ⟨S, hreach, hclosed⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovClosureOfRouteAndAllMissingClosed.lean b/LeanPool/GoldbergSeymour/TashkinovClosureOfRouteAndAllMissingClosed.lean new file mode 100644 index 0000000000..06a7536b85 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovClosureOfRouteAndAllMissingClosed.lean @@ -0,0 +1,45 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TreeColorSetClosed + +/-! +# Tashkinov Closure Of Route And All Missing Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovClosureOfRouteAndAllMissingClosed + {V E : Type*} [Fintype V] [Fintype E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (S T : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence phi S T) + (hclosed : TreeColorSetClosed G phi T (TreeMissingColors phi T)) : + TashkinovClosure phi S T := by + refine ⟨hroute, ?_⟩ + intro f c v hf hv hfc hmissing + have hc : c ∈ TreeMissingColors phi T := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨v, hv, hmissing⟩ + have hempty := hclosed c hc + have hboundaryColor : + f ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) c := by + unfold BoundaryColorEdges + exact Finset.mem_filter.mpr ⟨hf, hfc⟩ + rw [hempty] at hboundaryColor + simp at hboundaryColor + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovClosureVertexSetUnique.lean b/LeanPool/GoldbergSeymour/TashkinovClosureVertexSetUnique.lean new file mode 100644 index 0000000000..91fe1bbc9a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovClosureVertexSetUnique.lean @@ -0,0 +1,130 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovClosure + +/-! +# Tashkinov Closure Vertex Set Unique + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovClosureVertexSetUnique {V E : Type*} + [Fintype V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (T T₁ T₂ : TreeSequence G e0) + (h₁ : TashkinovClosure phi T T₁) (h₂ : TashkinovClosure phi T T₂) : + TreeSequenceVertexSet T₁ = TreeSequenceVertexSet T₂ := by + classical + rcases h₁ with ⟨hseq₁, hclosed₁⟩ + rcases h₂ with ⟨hseq₂, hclosed₂⟩ + have initial_subset : ∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hinit v hv + obtain ⟨i, hi, hvi⟩ := Finset.mem_image.mp hv + obtain ⟨hlen, hvertices, hedges⟩ := hinit + apply Finset.mem_image.mpr + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, Finset.mem_univ _, ?_⟩ + show B.vertex (Fin.castLE (Nat.succ_le_succ hlen) i) = v + rw [hvertices i] + exact hvi + have base_subset : ∀ {C : TreeSequence G e0}, + Relation.ReflTransGen (TashkinovAugmentation phi) T C → + TreeSequenceVertexSet T ⊆ TreeSequenceVertexSet C := by + intro C hreach + induction hreach with + | refl => exact Finset.Subset.rfl + | tail hreach hab ih => + rename_i mid last + exact ih.trans (initial_subset hab.2.1) + have contain : + ∀ {C S : TreeSequence G e0}, Relation.ReflTransGen (TashkinovAugmentation phi) T C → + ColoredVertexSetClosed G phi (TreeSequenceVertexSet C) → Relation.ReflTransGen + (TashkinovAugmentation phi) T S → TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet C := by + intro C S hC hclosed hS + have start : TreeSequenceVertexSet T ⊆ TreeSequenceVertexSet C := + base_subset hC + induction hS with + | refl => exact start + | tail hreach hab ih => + rename_i mid last + have old_subset : TreeSequenceVertexSet mid ⊆ TreeSequenceVertexSet C := ih + obtain ⟨hlen, hinit, c, hcolor, hmissing⟩ := hab + rcases hinit with ⟨hbound, hvertices, hedges⟩ + have new_subset : TreeSequenceVertexSet last ⊆ TreeSequenceVertexSet C := by + intro v hv + obtain ⟨j, hj, hjv⟩ := Finset.mem_image.mp hv + by_cases hlast : j.val = last.length + · have hjlast : j = Fin.last _ := Fin.ext hlast + subst j + by_contra hout + obtain ⟨z, hzold, hzmiss⟩ := Finset.mem_biUnion.mp hmissing + have hzC : z ∈ TreeSequenceVertexSet C := old_subset hzold + obtain ⟨q, hq⟩ := last.attaches + (Fin.cast hlen.symm (Fin.last mid.length)) + let qnew : Fin (last.length + 1) := Fin.castLT q (by omega) + let qold : Fin (mid.length + 1) := Fin.castLT q (by omega) + have hqold : last.vertex qnew ∈ + TreeSequenceVertexSet C := by + apply old_subset + apply Finset.mem_image.mpr + refine ⟨qold, Finset.mem_univ _, ?_⟩ + rw [← hvertices qold] + apply congrArg last.vertex + apply Fin.ext + dsimp [qnew, qold] + have hnew : (Fin.cast hlen.symm (Fin.last mid.length)).succ = + (Fin.last last.length : Fin (last.length + 1)) := by + apply Fin.ext + simp [Fin.last] + omega + have hedge : G.ends (last.edge (Fin.cast hlen.symm (Fin.last mid.length))) = + Sym2.mk (last.vertex (Fin.cast hlen.symm (Fin.last mid.length)).succ) + (last.vertex qnew) := by + rw [hnew] + rw [hnew] at hq + simpa [qnew] using hq + have hboundary : last.edge (Fin.cast hlen.symm (Fin.last mid.length)) ∈ + BoundaryEdges G (TreeSequenceVertexSet C) := by + unfold BoundaryEdges + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩ + have hout' : last.vertex (Fin.last last.length) ∉ + TreeSequenceVertexSet C := by + rw [hjv] + exact hout + refine ⟨last.vertex qnew, hqold, + last.vertex (Fin.last last.length), hout', ?_⟩ + have hedge' := hedge + rw [hnew] at hedge' + exact hedge'.trans Sym2.eq_swap + exact (hclosed hboundary hzC hcolor) hzmiss + · apply old_subset + apply Finset.mem_image.mpr + let jold : Fin (mid.length + 1) := ⟨j.val, by omega⟩ + refine ⟨jold, Finset.mem_univ _, ?_⟩ + rw [← hvertices jold] + have hindices : Fin.castLE (Nat.succ_le_succ hbound) jold = j := by + apply Fin.ext + dsimp [jold] + rw [hindices] + exact hjv + exact new_subset + have first : TreeSequenceVertexSet T₁ ⊆ TreeSequenceVertexSet T₂ := + contain hseq₂ hclosed₂ hseq₁ + have second : TreeSequenceVertexSet T₂ ⊆ TreeSequenceVertexSet T₁ := + contain hseq₁ hclosed₁ hseq₂ + exact Finset.Subset.antisymm first second + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovExtensionKind.lean b/LeanPool/GoldbergSeymour/TashkinovExtensionKind.lean new file mode 100644 index 0000000000..cf39f1bb8c --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovExtensionKind.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Preamble + +/-! +# Tashkinov Extension Kind + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The series' three extension kinds: series extension, parallel extension and revisiting +extension. +-/ +inductive TashkinovExtensionKind : Type where + | SE : TashkinovExtensionKind + | PE : TashkinovExtensionKind + | RE : TashkinovExtensionKind + deriving DecidableEq + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovHierarchy.lean b/LeanPool/GoldbergSeymour/TashkinovHierarchy.lean new file mode 100644 index 0000000000..533d473a2a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovHierarchy.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyBase + +/-! +# Tashkinov Hierarchy + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A strictly nested sequence of stages with ordered divider positions above a hierarchy base. -/ +structure TashkinovHierarchy {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating phi : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) where + /-- The number of internal divider positions in the hierarchy. -/ + dividerCount : ℕ + /-- The ordered hierarchy stages, including the initial and final stages. -/ + stage : Fin (dividerCount + 2) → TreeSequence G e0 + baseStage : stage 0 = ett.series.data.tree (Fin.last ett.rounds).castSucc + terminalStage : stage (Fin.last (dividerCount + 1)) = T + nested : + ∀ j : Fin (dividerCount + 1), TreeSequenceInitialSegment (stage j.castSucc) (stage j.succ) + strict : ∀ j : Fin (dividerCount + 1), (stage j.castSucc).length < (stage j.succ).length + /-- The increasing tree-vertex position of each internal divider. -/ + dividerPosition : Fin dividerCount → Fin (T.length + 1) + dividerPositive : ∀ i, 1 ≤ (dividerPosition i).val + dividerIncreasing : ∀ i j, i.val < j.val → (dividerPosition i).val < (dividerPosition j).val + dividerStage : + ∀ i : Fin dividerCount, + stage ⟨i.val + 1, by omega⟩ = + TreeSequencePrefix T (dividerPosition i).val (dividerPositive i) + (Nat.le_of_lt_succ (dividerPosition i).isLt) + coreInsideFirst : TreeSequenceInitialSegment base.core (stage ⟨1, by omega⟩) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovOrder.lean b/LeanPool/GoldbergSeymour/TashkinovOrder.lean new file mode 100644 index 0000000000..07b7f39916 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovOrder.lean @@ -0,0 +1,39 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tashkinov Order + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The maximum vertex count of a Tashkinov tree in a critical coloring triple, including zero when +no triple exists. +-/ +noncomputable def TashkinovOrder {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) : ℕ := by + classical + let k := ChromaticIndex G - 1 + let orders := (Finset.range (Fintype.card V + 1)).filter fun n => + ∃ (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0), + KTriple G k e0 phi ∧ TashkinovTree G e0 phi T ∧ + (TreeSequenceVertexSet T).card = n + exact (insert 0 orders).max' (by simp) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovOrderBound.lean b/LeanPool/GoldbergSeymour/TashkinovOrderBound.lean new file mode 100644 index 0000000000..7958dd7c66 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovOrderBound.lean @@ -0,0 +1,39 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovOrder + +/-! +# Bounding a Tashkinov tree by the global order + +Extracted from the repeated maximum-membership arguments in the Trellis formalization. +-/ + +public section + +namespace GoldbergSeymour + +/-- Every Tashkinov tree for a critical colouring is bounded by the global Tashkinov order. -/ +theorem treeCard_le_tashkinovOrder {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (htriple : KTriple G k e0 phi) (htree : TashkinovTree G e0 phi T) : + (TreeSequenceVertexSet T).card ≤ TashkinovOrder G := by + classical + have hk : ChromaticIndex G - 1 = k := by + have hchi := htriple.2.1 + omega + subst k + unfold TashkinovOrder + dsimp only + refine Finset.le_max' _ _ (Finset.mem_insert_of_mem ?_) + refine Finset.mem_filter.mpr ⟨?_, e0, phi, T, htriple, htree, rfl⟩ + exact Finset.mem_range.mpr (Nat.lt_succ_of_le (Finset.card_le_univ _)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeries.lean b/LeanPool/GoldbergSeymour/TashkinovSeries.lean new file mode 100644 index 0000000000..ad05ab2cbc --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeries.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep + +/-! +# Tashkinov Series + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Extension-series data certified at every step by the initial or extension rules. -/ +structure TashkinovSeries {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) where + /-- The indexed data certified by the extension rules. -/ + data : TashkinovSeriesData G k rounds e0 + certified : ∀ i : Fin (rounds + 1), TashkinovSeriesStep G k rounds e0 input data i + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesAppend.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesAppend.lean new file mode 100644 index 0000000000..f4064363a4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesAppend.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStepAppend + +/-! +# Tashkinov Series Append + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovSeriesAppend {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) + (newTree : TreeSequence G e0) + (newColoring : PartialEdgeColoring E k) + (newStored : Finset (Fin k)) + (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) + (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)) + (lastCertified : TashkinovSeriesStep G k (rounds + 1) e0 input + (TashkinovSeriesDataAppend series.data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma) + (Fin.last (rounds + 1))) : + ∃ extended : TashkinovSeries G k (rounds + 1) e0 input, + extended.data = TashkinovSeriesDataAppend series.data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex + newOutsideVertex newDelta newGamma := by + let appended := TashkinovSeriesDataAppend series.data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma + let extended : TashkinovSeries G k (rounds + 1) e0 input := { + data := appended + certified := by + intro i + refine Fin.lastCases lastCertified ?_ i + intro oldIndex + exact TashkinovSeriesStepAppend G k rounds e0 input series.data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma + oldIndex (series.certified oldIndex) + } + exact ⟨extended, rfl⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesColoringProperties.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesColoringProperties.lean new file mode 100644 index 0000000000..f0b937bf9e --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesColoringProperties.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeries + +/-! +# Coloring properties of certified Tashkinov series + +Every stage is proper and leaves exactly the distinguished edge uncolored. +Derived from the certificates in Wesley Pegden's Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Every certified step preserves the two basic coloring properties. -/ +theorem TashkinovSeriesStep.coloringProperties {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {data : TashkinovSeriesData G k rounds e0} + {i : Fin (rounds + 1)} (step : TashkinovSeriesStep G k rounds e0 input data i) : + IsProperEdgeColoring G (data.coloring i) ∧ IsOneEdgeUncolored (data.coloring i) e0 := by + cases step with + | initial triple _ coloring _ _ _ _ _ _ _ _ => + rw [coloring] + exact triple.2.2.2 + | SE _ _ _ _ _ _ choice _ coloring _ _ _ _ _ _ _ _ _ _ _ _ => + rw [coloring] + exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ + | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ proper one _ _ _ _ _ _ _ _ _ _ => + exact ⟨proper, one⟩ + | RE _ proper one _ _ _ coloring _ _ _ _ _ _ _ _ _ _ _ _ => + rw [coloring] + exact ⟨proper, one⟩ + +/-- Every stage of a certified series is proper and has one uncolored edge. -/ +theorem TashkinovSeries.coloringProperties {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds e0 input) + (i : Fin (rounds + 1)) : + IsProperEdgeColoring G (series.data.coloring i) ∧ + IsOneEdgeUncolored (series.data.coloring i) e0 := + (series.certified i).coloringProperties + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesData.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesData.lean new file mode 100644 index 0000000000..15c9deedb2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesData.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.PartialEdgeColoring +public import LeanPool.GoldbergSeymour.TashkinovExtensionKind +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Tashkinov Series Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- +Trees, colorings, stored colors and optional extension witnesses indexed by their series stages. -/ +structure TashkinovSeriesData {V E : Type*} (G : LooplessMultigraph V E) (k rounds : ℕ) + (e0 : E) where + /-- The ordered tree or tree sequence recorded by this certificate. -/ + tree : Fin (rounds + 2) → TreeSequence G e0 + /-- The partial coloring or sequence of partial colorings recorded by this certificate. -/ + coloring : Fin (rounds + 1) → PartialEdgeColoring E k + /-- The color set stored at each extension stage. -/ + stored : Fin (rounds + 1) → Finset (Fin k) + /-- The finite set of connecting edges at each extension stage. -/ + connectingEdges : Fin (rounds + 1) → Finset E + /-- The optional extension kind at each stage, absent at the initial stage. -/ + kind : Fin (rounds + 1) → Option TashkinovExtensionKind + /-- The optional support vertex chosen at each extension stage. -/ + chosenVertex : Fin (rounds + 1) → Option V + /-- The optional outside endpoint chosen at each extension stage. -/ + outsideVertex : Fin (rounds + 1) → Option V + /-- The companion color used for the component swap at each stage. -/ + delta : Fin (rounds + 1) → Option (Fin k) + /-- The auxiliary color or color family used by this configuration. -/ + gamma : Fin (rounds + 1) → Option (Fin k) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesDataAppend.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesDataAppend.lean new file mode 100644 index 0000000000..a22ae8b387 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesDataAppend.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesData + +/-! +# Tashkinov Series Data Append + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Append one new tree, coloring and extension-witness entry to a series' data. -/ +def TashkinovSeriesDataAppend {V E : Type*} {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + (data : TashkinovSeriesData G k rounds e0) (newTree : TreeSequence G e0) + (newColoring : PartialEdgeColoring E k) (newStored : Finset (Fin k)) + (newConnectingEdges : Finset E) (newKind : Option TashkinovExtensionKind) + (newChosenVertex newOutsideVertex : Option V) (newDelta newGamma : Option (Fin k)) : + TashkinovSeriesData G k (rounds + 1) e0 := + { tree := Fin.lastCases newTree data.tree + coloring := Fin.lastCases newColoring data.coloring + stored := Fin.lastCases newStored data.stored + connectingEdges := Fin.lastCases newConnectingEdges data.connectingEdges + kind := Fin.lastCases newKind data.kind + chosenVertex := Fin.lastCases newChosenVertex data.chosenVertex + outsideVertex := Fin.lastCases newOutsideVertex data.outsideVertex + delta := Fin.lastCases newDelta data.delta + gamma := Fin.lastCases newGamma data.gamma } + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesDataPrefix.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesDataPrefix.lean new file mode 100644 index 0000000000..79906ba1d6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesDataPrefix.lean @@ -0,0 +1,38 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesData + +/-! +# Tashkinov Series Data Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Restrict every component of the series data to the specified initial number of rounds. -/ +def TashkinovSeriesDataPrefix {V E : Type*} {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + (m : ℕ) (hm : m ≤ rounds) (data : TashkinovSeriesData G k rounds e0) : + TashkinovSeriesData G k m e0 := + { tree := fun i => data.tree (Fin.castLE (by omega) i) + coloring := fun i => data.coloring (Fin.castLE (by omega) i) + stored := fun i => data.stored (Fin.castLE (by omega) i) + connectingEdges := fun i => data.connectingEdges (Fin.castLE (by omega) i) + kind := fun i => data.kind (Fin.castLE (by omega) i) + chosenVertex := fun i => data.chosenVertex (Fin.castLE (by omega) i) + outsideVertex := fun i => data.outsideVertex (Fin.castLE (by omega) i) + delta := fun i => data.delta (Fin.castLE (by omega) i) + gamma := fun i => data.gamma (Fin.castLE (by omega) i) } + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesFinalETTExists.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesFinalETTExists.lean new file mode 100644 index 0000000000..8dabc2dcbe --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesFinalETTExists.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +/-! +# Tashkinov Series Final ETTExists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovSeriesFinalETTExists + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : Nat) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) + (hrounds : 0 < rounds) : + exists ett : ExtendedTashkinovTree G k e0 input + (series.data.tree (Fin.last (rounds + 1))) + (series.data.coloring (Fin.last rounds)), + ett.rounds = rounds ∧ HEq ett.series series := by + classical + have stepFacts : + ∀ r : Fin rounds, TreeSequenceInitialSegment (series.data.tree r.succ.castSucc) + (series.data.tree r.succ.succ) ∧ (series.data.tree r.succ.castSucc).length < + (series.data.tree r.succ.succ).length := by + intro r + have fact := series.certified r.succ + generalize hi : r.succ = z at fact ⊢ + cases fact with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + simp_all + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hsame : i = r := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + simpa [hi] using ⟨orderedExtension, strictExtension⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hsame : i = r := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + simpa [hi] using ⟨orderedExtension, strictExtension⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hsame : i = r := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + simpa [hi] using ⟨orderedExtension, strictExtension⟩ + let r : Fin rounds := ⟨rounds - 1, by omega⟩ + have hpen : r.succ.castSucc = (⟨rounds, by omega⟩ : Fin (rounds + 2)) := by + apply Fin.ext + simp [r] + omega + have hfinal : r.succ.succ = Fin.last (rounds + 1) := by + apply Fin.ext + simp [r] + omega + have terminalOrdered : TreeSequenceInitialSegment + (series.data.tree ⟨rounds, by omega⟩) + (series.data.tree (Fin.last (rounds + 1))) := by + rw [← hpen, ← hfinal] + exact (stepFacts r).1 + have terminalStrict : + (series.data.tree ⟨rounds, by omega⟩).length < + (series.data.tree (Fin.last (rounds + 1))).length := by + rw [← hpen, ← hfinal] + exact (stepFacts r).2 + let ett : ExtendedTashkinovTree G k e0 input + (series.data.tree (Fin.last (rounds + 1))) + (series.data.coloring (Fin.last rounds)) := { + rounds := rounds + roundsPositive := hrounds + series := series + abovePenultimate := terminalOrdered + strictAbovePenultimate := terminalStrict + belowFinal := ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ + generatingColoring := rfl } + exact ⟨ett, rfl, HEq.rfl⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesPrefix.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesPrefix.lean new file mode 100644 index 0000000000..3c1a34ff77 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesPrefix.lean @@ -0,0 +1,45 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStepPrefix + +/-! +# Tashkinov Series Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovSeriesPrefix {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) + (m : ℕ) (hm : m ≤ rounds) : + ∃ restricted : TashkinovSeries G k m e0 input, + restricted.data = TashkinovSeriesDataPrefix m hm series.data ∧ + ∀ i : Fin (m + 1), HEq (restricted.certified i) + (series.certified (Fin.castLE (by omega) i)) := by + let restricted : TashkinovSeries G k m e0 input := { + data := TashkinovSeriesDataPrefix m hm series.data + certified := fun i => + (TashkinovSeriesStepPrefix input series.data m hm i + (series.certified (Fin.castLE (by omega) i))).choose + } + refine ⟨restricted, rfl, ?_⟩ + intro i + exact (TashkinovSeriesStepPrefix input series.data m hm i + (series.certified (Fin.castLE (by omega) i))).choose_spec + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesStep.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesStep.lean new file mode 100644 index 0000000000..63e9c027f2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesStep.lean @@ -0,0 +1,154 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap + +/-! +# Tashkinov Series Step + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The initial and extension rules certifying a stage of a Tashkinov series. -/ +inductive TashkinovSeriesStep {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) : Fin (rounds + 1) → Prop where + | + initial (triple : KTriple G k e0 input) (seedLength : (data.tree 0).length = 1) + (initialColoring : data.coloring 0 = input) (initialStored : data.stored 0 = ∅) + (initialEdges : data.connectingEdges 0 = ∅) (initialKind : data.kind 0 = none) + (initialVertex : data.chosenVertex 0 = none) (initialOutside : data.outsideVertex 0 = none) + (initialDelta : data.delta 0 = none) (initialGamma : data.gamma 0 = none) + (initialClosure : TashkinovClosure (data.coloring 0) (data.tree 0) (data.tree 1)) : + TashkinovSeriesStep G k rounds e0 input data 0 + | + SE (i : Fin rounds) (previousProper : IsProperEdgeColoring G (data.coloring i.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (data.coloring i.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate data i.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (data.tree i.succ.castSucc) + (TashkinovStoredColors data i.castSucc) (data.coloring i.castSucc)) + (seriesAlternative : + ∀ pi : PartialEdgeColoring E k, + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring (data.tree i.succ.castSucc) + (insert choice.color (TashkinovStoredColors data i.castSucc)) choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (data.tree i.succ.castSucc))) + (currentColoring : data.coloring i.succ = choice.selected) + (currentStored : data.stored i.succ = { choice.color }) + (currentEdges : data.connectingEdges i.succ = { choice.edge }) + (currentKind : data.kind i.succ = some TashkinovExtensionKind.SE) + (currentVertex : data.chosenVertex i.succ = some choice.vertex) + (currentOutside : data.outsideVertex i.succ = some choice.otherEndpoint) + (currentDelta : data.delta i.succ = some choice.color) (currentGamma : data.gamma i.succ = none) + (adjoined : TreeSequence G e0) + (adjoinedExactly : TreeSequenceAdjoinEdge (data.tree i.succ.castSucc) choice.edge adjoined) + (closedExtension : TashkinovClosure (data.coloring i.succ) adjoined (data.tree i.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (data.tree i.succ.castSucc) (data.tree i.succ.succ)) + (strictExtension : (data.tree i.succ.castSucc).length < (data.tree i.succ.succ).length) : + TashkinovSeriesStep G k rounds e0 input data i.succ + | + PE (i : Fin rounds) (previousProper : IsProperEdgeColoring G (data.coloring i.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (data.coloring i.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate data i.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (data.tree i.succ.castSucc) + (TashkinovStoredColors data i.castSucc) (data.coloring i.castSucc)) + (seriesAlternativeFails : + ∃ rho : PartialEdgeColoring E k, + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (data.tree i.succ.castSucc) + (insert choice.color (TashkinovStoredColors data i.castSucc)) choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (data.tree i.succ.castSucc))) + (gamma : Fin k) + (gammaRule : ParallelExtensionColor data i.castSucc choice.selected choice.vertex gamma) + (secondStable : PartialEdgeColoring E k) + (secondStableProper : IsProperEdgeColoring G secondStable) + (secondStableOneUncolored : IsOneEdgeUncolored secondStable e0) + (secondStableRelation : + StableColoring (data.tree i.succ.castSucc) + (insert choice.color (TashkinovStoredColors data i.castSucc)) choice.selected secondStable) + (exitWitness : + TreeExit (data.tree i.succ.castSucc) secondStable gamma choice.color choice.vertex) + (currentColoring : + data.coloring i.succ = + TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) + (currentProper : IsProperEdgeColoring G (data.coloring i.succ)) + (currentOneUncolored : IsOneEdgeUncolored (data.coloring i.succ) e0) + (currentStored : data.stored i.succ = { choice.color, gamma }) + (currentEdges : data.connectingEdges i.succ = { choice.edge }) + (currentKind : data.kind i.succ = some TashkinovExtensionKind.PE) + (currentVertex : data.chosenVertex i.succ = some choice.vertex) + (currentOutside : data.outsideVertex i.succ = some choice.otherEndpoint) + (currentDelta : data.delta i.succ = some choice.color) + (currentGamma : data.gamma i.succ = some gamma) + (closedExtension : + TashkinovClosure (data.coloring i.succ) (data.tree i.succ.castSucc) (data.tree i.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (data.tree i.succ.castSucc) (data.tree i.succ.succ)) + (strictExtension : (data.tree i.succ.castSucc).length < (data.tree i.succ.succ).length) : + TashkinovSeriesStep G k rounds e0 input data i.succ + | + RE (i : Fin rounds) (previousProper : IsProperEdgeColoring G (data.coloring i.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (data.coloring i.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc))) + (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc))) + (available : RevisitingExtensionCertificate data i.castSucc) + (currentColoring : data.coloring i.succ = data.coloring i.castSucc) + (currentStored : data.stored i.succ = { available.delta, available.gamma }) + (currentEdges : data.connectingEdges i.succ = { available.edge }) + (currentKind : data.kind i.succ = some TashkinovExtensionKind.RE) + (currentVertex : data.chosenVertex i.succ = some available.insideEndpoint) + (currentOutside : data.outsideVertex i.succ = some available.outsideEndpoint) + (currentDelta : data.delta i.succ = some available.delta) + (currentGamma : data.gamma i.succ = some available.gamma) (adjoined : TreeSequence G e0) + (adjoinedExactly : TreeSequenceAdjoinEdge (data.tree i.succ.castSucc) available.edge adjoined) + (closedExtension : TashkinovClosure (data.coloring i.succ) adjoined (data.tree i.succ.succ)) + (orderedExtension : + TreeSequenceInitialSegment (data.tree i.succ.castSucc) (data.tree i.succ.succ)) + (strictExtension : (data.tree i.succ.castSucc).length < (data.tree i.succ.succ).length) : + TashkinovSeriesStep G k rounds e0 input data i.succ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesStepAppend.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesStepAppend.lean new file mode 100644 index 0000000000..5b4af899b4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesStepAppend.lean @@ -0,0 +1,1459 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ParallelExtensionColorAppend +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificateAppend +public import LeanPool.GoldbergSeymour.TashkinovSeriesDataAppend +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColorsAppend + +/-! +# Tashkinov Series Step Append + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_lifted_223.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (data : + TashkinovSeriesData G k rounds e0) (newTree : TreeSequence G e0) (newColoring : + PartialEdgeColoring E k) (newStored : Finset (Fin k)) (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)), + ∀ (i : Fin rounds), IsProperEdgeColoring G (data.coloring i.castSucc) → IsOneEdgeUncolored + (data.coloring i.castSucc) e0 → ColoredVertexSetClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + (data.coloring i.castSucc) (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → + ∀ (_ : MaximumDefectiveChoice G e0 (data.tree i.succ.castSucc) (TashkinovStoredColors data + i.castSucc) (data.coloring i.castSucc)) (_ : TreeSequence G e0), + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).tree i.castSucc.succ.castSucc = data.tree i.succ.castSucc → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).coloring i.castSucc.castSucc = data.coloring i.castSucc → + ∀ (newChoice : MaximumDefectiveChoice G e0 ((TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.castSucc) + (TashkinovStoredColors (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.castSucc) + ((TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).coloring i.castSucc.castSucc)), ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring ((TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.castSucc) (insert + newChoice.color (TashkinovStoredColors (TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.castSucc)) newChoice.selected pi + → Disjoint (MissingColors G pi newChoice.otherEndpoint) (TreeMissingColors pi + ((TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).tree i.castSucc.succ.castSucc))) → (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).coloring i.castSucc.succ = + newChoice.selected → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).stored i.castSucc.succ = + { newChoice.color } → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).connectingEdges i.castSucc.succ = + { newChoice.edge } → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).kind i.castSucc.succ = some + TashkinovExtensionKind.SE → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).chosenVertex i.castSucc.succ = some + newChoice.vertex → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).outsideVertex i.castSucc.succ = some + newChoice.otherEndpoint → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).delta i.castSucc.succ = some + newChoice.color → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).gamma i.castSucc.succ = none → + ∀ (newAdjoined : TreeSequence G e0), TreeSequenceAdjoinEdge ((TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree + i.castSucc.succ.castSucc) newChoice.edge newAdjoined → TashkinovClosure + ((TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).coloring i.castSucc.succ) newAdjoined ((TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.succ) → + TreeSequenceInitialSegment ((TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.castSucc) + ((TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).tree i.castSucc.succ.succ) → ((TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree + i.castSucc.succ.castSucc).length < ((TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.succ).length → + ¬Nonempty (RevisitingExtensionCertificate (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.castSucc) → + TashkinovSeriesStep G k (rounds + (1 : ℕ)) e0 input (TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.succ := by + classical + intro V E _ _ _ G k rounds e0 input data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma + set appended : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0 := TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind + newChosenVertex + newOutsideVertex newDelta newGamma + intro i previousProper previousOneUncolored previousClosed previousNotStronglyClosed choice + adjoined previousTreeEq previousColoringEq newChoice newSeriesAlternative + newCurrentColoring newCurrentStored newCurrentEdges newCurrentKind newCurrentVertex + newCurrentOutside newCurrentDelta newCurrentGamma newAdjoined newAdjoinedExactly + newClosedExtension newOrderedExtension newStrictExtension newNoRevisiting + apply TashkinovSeriesStep.SE (i := i.castSucc) (choice := newChoice) + (adjoined := newAdjoined) + · rw [previousColoringEq] + exact previousProper + · rw [previousColoringEq] + exact previousOneUncolored + · rw [previousColoringEq, previousTreeEq] + exact previousClosed + · rw [previousColoringEq, previousTreeEq] + exact previousNotStronglyClosed + · exact newNoRevisiting + · exact newSeriesAlternative + · exact newCurrentColoring + · exact newCurrentStored + · exact newCurrentEdges + · exact newCurrentKind + · exact newCurrentVertex + · exact newCurrentOutside + · exact newCurrentDelta + · exact newCurrentGamma + · exact newAdjoinedExactly + · exact newClosedExtension + · exact newOrderedExtension + · exact newStrictExtension + +private theorem helper_continuation_310.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (data : + TashkinovSeriesData G k rounds e0) (newTree : TreeSequence G e0) (newColoring : + PartialEdgeColoring E k) (newStored : Finset (Fin k)) (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)), + ∀ (i : Fin rounds), IsProperEdgeColoring G (data.coloring i.castSucc) → IsOneEdgeUncolored + (data.coloring i.castSucc) e0 → ColoredVertexSetClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + (data.coloring i.castSucc) (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate data i.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (data.tree i.succ.castSucc) (TashkinovStoredColors + data i.castSucc) (data.coloring i.castSucc)), ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (data.tree i.succ.castSucc) (insert choice.color (TashkinovStoredColors + data i.castSucc) : Finset (Fin k)) choice.selected pi → Disjoint (MissingColors G pi + choice.otherEndpoint) (TreeMissingColors pi (data.tree i.succ.castSucc))) → data.coloring + i.succ = choice.selected → data.stored i.succ = ({ choice.color } : Finset (Fin k)) → + data.connectingEdges i.succ = ({ choice.edge } : Finset E) → data.kind i.succ = some + TashkinovExtensionKind.SE → data.chosenVertex i.succ = some choice.vertex → + data.outsideVertex i.succ = some choice.otherEndpoint → data.delta i.succ = some + choice.color → data.gamma i.succ = none → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (data.tree i.succ.castSucc) + choice.edge adjoined → TashkinovClosure (data.coloring i.succ) adjoined (data.tree + i.succ.succ) → TreeSequenceInitialSegment (data.tree i.succ.castSucc) (data.tree + i.succ.succ) → (data.tree i.succ.castSucc).length < (data.tree i.succ.succ).length → + i.castSucc.succ = i.succ.castSucc → (TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.castSucc = data.tree + i.succ.castSucc → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.succ = data.tree + i.succ.succ → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).coloring i.castSucc.castSucc = + data.coloring i.castSucc → TashkinovStoredColors (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.castSucc = + TashkinovStoredColors data i.castSucc → (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).coloring i.castSucc.succ = + data.coloring i.succ → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).stored i.castSucc.succ = data.stored i.succ + → (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).connectingEdges i.castSucc.succ = data.connectingEdges i.succ → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).kind i.castSucc.succ = data.kind i.succ → (TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).chosenVertex + i.castSucc.succ = data.chosenVertex i.succ → (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).outsideVertex i.castSucc.succ = + data.outsideVertex i.succ → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).delta i.castSucc.succ = data.delta i.succ → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).gamma i.castSucc.succ = data.gamma i.succ → TashkinovSeriesStep G k (rounds + (1 + : ℕ)) e0 input (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma) + i.succ.castSucc := by + classical + intro V E _ _ _ G k rounds e0 input data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma + set appended : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0 := TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind + newChosenVertex + newOutsideVertex newDelta newGamma + intro i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternative currentColoring currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension slotIndexEq previousTreeEq outputTreeEq + previousColoringEq storedColorsEq currentColoringEq currentStoredEq currentEdgesEq + currentKindEq currentVertexEq currentOutsideEq currentDeltaEq currentGammaEq + let Package : PartialEdgeColoring E k → PartialEdgeColoring E k → TreeSequence G e0 → + TreeSequence G e0 → Finset (Fin k) → Finset (Fin k) → Finset E → Option + TashkinovExtensionKind → Option V → Option V → Option (Fin k) → Option (Fin k) → Prop := + fun + (previousColor + currentColor : + PartialEdgeColoring E k) + (previousTree + outputTree : + TreeSequence G e0) + (storedColors + currentStoredValue : + Finset (Fin k)) + (currentEdgesValue + : Finset E) + (currentKindValue : + Option + TashkinovExtensionKind) + (currentVertexValue + currentOutsideValue : + Option V) + (currentDeltaValue + currentGammaValue : + Option (Fin k)) ↦ + ∃ (selectedChoice : + MaximumDefectiveChoice G e0 previousTree + storedColors + previousColor), + (∀ (pi : + PartialEdgeColoring E k), + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring previousTree + (insert + selectedChoice.color + storedColors : + Finset (Fin k)) + selectedChoice.selected pi → + Disjoint + (MissingColors G pi + selectedChoice.otherEndpoint) + (TreeMissingColors pi + previousTree)) ∧ + currentColor = + selectedChoice.selected ∧ + currentStoredValue = + ({selectedChoice.color} : + Finset + (Fin + k)) ∧ + currentEdgesValue = + ({selectedChoice.edge} : Finset E) ∧ + currentKindValue = + some + TashkinovExtensionKind.SE ∧ + currentVertexValue = + some + selectedChoice.vertex ∧ + currentOutsideValue = + some + selectedChoice.otherEndpoint ∧ + currentDeltaValue = + some selectedChoice.color ∧ + currentGammaValue = none ∧ + ∃ + (exactAdjoined : + TreeSequence G e0), + TreeSequenceAdjoinEdge + previousTree + selectedChoice.edge + exactAdjoined ∧ + TashkinovClosure + currentColor + exactAdjoined + outputTree ∧ + TreeSequenceInitialSegment + previousTree + outputTree ∧ + previousTree.length < + outputTree.length + have oldPackage : Package (data.coloring i.castSucc) (data.coloring i.succ) + (data.tree i.succ.castSucc) (data.tree i.succ.succ) + (TashkinovStoredColors data i.castSucc) (data.stored i.succ) + (data.connectingEdges i.succ) (data.kind i.succ) + (data.chosenVertex i.succ) (data.outsideVertex i.succ) + (data.delta i.succ) (data.gamma i.succ) := by + exact ⟨choice, seriesAlternative, currentColoring, currentStored, + currentEdges, currentKind, currentVertex, currentOutside, currentDelta, + currentGamma, adjoined, adjoinedExactly, closedExtension, + orderedExtension, strictExtension⟩ + have newPackage : Package (appended.coloring i.castSucc.castSucc) + (appended.coloring i.castSucc.succ) + (appended.tree i.castSucc.succ.castSucc) + (appended.tree i.castSucc.succ.succ) + (TashkinovStoredColors appended i.castSucc.castSucc) + (appended.stored i.castSucc.succ) + (appended.connectingEdges i.castSucc.succ) + (appended.kind i.castSucc.succ) + (appended.chosenVertex i.castSucc.succ) + (appended.outsideVertex i.castSucc.succ) + (appended.delta i.castSucc.succ) (appended.gamma i.castSucc.succ) := by + rw [previousColoringEq, currentColoringEq, previousTreeEq, outputTreeEq, + storedColorsEq, currentStoredEq, currentEdgesEq, currentKindEq, + currentVertexEq, currentOutsideEq, currentDeltaEq, currentGammaEq] + exact oldPackage + rcases newPackage with ⟨newChoice, newSeriesAlternative, + newCurrentColoring, newCurrentStored, newCurrentEdges, newCurrentKind, + newCurrentVertex, newCurrentOutside, newCurrentDelta, newCurrentGamma, + newAdjoined, newAdjoinedExactly, newClosedExtension, + newOrderedExtension, newStrictExtension⟩ + have newNoRevisiting : ¬ Nonempty + (RevisitingExtensionCertificate appended i.castSucc.castSucc) := by + rintro ⟨newCertificate⟩ + rcases (RevisitingExtensionCertificateAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma i.castSucc).1 newCertificate with ⟨oldCertificate, -⟩ + exact noRevisiting ⟨oldCertificate⟩ + have lifted := @helper_lifted_223 V E inferInstance inferInstance inferInstance G k rounds e0 + input data newTree newColoring newStored newConnectingEdges newKind newChosenVertex + newOutsideVertex newDelta newGamma i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed choice adjoined previousTreeEq previousColoringEq newChoice + newSeriesAlternative newCurrentColoring newCurrentStored newCurrentEdges newCurrentKind + newCurrentVertex newCurrentOutside newCurrentDelta newCurrentGamma newAdjoined + newAdjoinedExactly newClosedExtension newOrderedExtension newStrictExtension newNoRevisiting + rw [← slotIndexEq] + exact lifted + +private theorem helper_branch_92.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (data : + TashkinovSeriesData G k rounds e0) (newTree : TreeSequence G e0) (newColoring : + PartialEdgeColoring E k) (newStored : Finset (Fin k)) (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)), ( + ∀ (i : Fin (rounds + (2 : ℕ))), (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc = data.tree i) → ( + ∀ (i : Fin (rounds + (1 : ℕ))), (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).coloring i.castSucc = data.coloring i ∧ + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).stored i.castSucc = data.stored i ∧ (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).connectingEdges i.castSucc = + data.connectingEdges i ∧ (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).kind i.castSucc = data.kind i ∧ + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).chosenVertex i.castSucc = data.chosenVertex i ∧ (TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).outsideVertex + i.castSucc = data.outsideVertex i ∧ (TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).delta i.castSucc = data.delta i ∧ + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).gamma i.castSucc = data.gamma i) → + ∀ (i : Fin rounds), IsProperEdgeColoring G (data.coloring i.castSucc) → IsOneEdgeUncolored + (data.coloring i.castSucc) e0 → ColoredVertexSetClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + (data.coloring i.castSucc) (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate data i.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (data.tree i.succ.castSucc) (TashkinovStoredColors + data i.castSucc) (data.coloring i.castSucc)), ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (data.tree i.succ.castSucc) (insert choice.color (TashkinovStoredColors + data i.castSucc)) choice.selected pi → Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (data.tree i.succ.castSucc))) → data.coloring i.succ = + choice.selected → data.stored i.succ = { choice.color } → data.connectingEdges i.succ = + { choice.edge } → data.kind i.succ = some TashkinovExtensionKind.SE → data.chosenVertex + i.succ = some choice.vertex → data.outsideVertex i.succ = some choice.otherEndpoint → + data.delta i.succ = some choice.color → data.gamma i.succ = none → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (data.tree i.succ.castSucc) + choice.edge adjoined → TashkinovClosure (data.coloring i.succ) adjoined (data.tree + i.succ.succ) → TreeSequenceInitialSegment (data.tree i.succ.castSucc) (data.tree + i.succ.succ) → (data.tree i.succ.castSucc).length < (data.tree i.succ.succ).length → + TashkinovSeriesStep G k (rounds + (1 : ℕ)) e0 input (TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma) i.succ.castSucc := by + classical + intro V E _ _ _ G k rounds e0 input data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma + set appended : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0 := TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind + newChosenVertex + newOutsideVertex newDelta newGamma + intro treeOld slotsOld i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative currentColoring + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension strictExtension + have slotIndexEq : i.castSucc.succ = i.succ.castSucc := by ext; rfl + have previousTreeIndexEq : i.castSucc.succ.castSucc = + i.succ.castSucc.castSucc := by ext; rfl + have outputTreeIndexEq : i.castSucc.succ.succ = + i.succ.succ.castSucc := by ext; rfl + have previousTreeEq : appended.tree i.castSucc.succ.castSucc = + data.tree i.succ.castSucc := by + calc + appended.tree i.castSucc.succ.castSucc = + appended.tree i.succ.castSucc.castSucc := + congrArg appended.tree previousTreeIndexEq + _ = data.tree i.succ.castSucc := treeOld i.succ.castSucc + have outputTreeEq : appended.tree i.castSucc.succ.succ = + data.tree i.succ.succ := by + calc + appended.tree i.castSucc.succ.succ = + appended.tree i.succ.succ.castSucc := + congrArg appended.tree outputTreeIndexEq + _ = data.tree i.succ.succ := treeOld i.succ.succ + have previousColoringEq : appended.coloring i.castSucc.castSucc = + data.coloring i.castSucc := (slotsOld i.castSucc).1 + have storedColorsEq : TashkinovStoredColors appended i.castSucc.castSucc = + TashkinovStoredColors data i.castSucc := + TashkinovStoredColorsAppend data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma i.castSucc + have currentColoringEq : appended.coloring i.castSucc.succ = + data.coloring i.succ := by + calc + appended.coloring i.castSucc.succ = + appended.coloring i.succ.castSucc := + congrArg appended.coloring slotIndexEq + _ = data.coloring i.succ := (slotsOld i.succ).1 + have currentStoredEq : appended.stored i.castSucc.succ = + data.stored i.succ := by + calc + appended.stored i.castSucc.succ = appended.stored i.succ.castSucc := + congrArg appended.stored slotIndexEq + _ = data.stored i.succ := (slotsOld i.succ).2.1 + have currentEdgesEq : appended.connectingEdges i.castSucc.succ = + data.connectingEdges i.succ := by + calc + appended.connectingEdges i.castSucc.succ = + appended.connectingEdges i.succ.castSucc := + congrArg appended.connectingEdges slotIndexEq + _ = data.connectingEdges i.succ := (slotsOld i.succ).2.2.1 + have currentKindEq : appended.kind i.castSucc.succ = data.kind i.succ := by + calc + appended.kind i.castSucc.succ = appended.kind i.succ.castSucc := + congrArg appended.kind slotIndexEq + _ = data.kind i.succ := (slotsOld i.succ).2.2.2.1 + have currentVertexEq : appended.chosenVertex i.castSucc.succ = + data.chosenVertex i.succ := by + calc + appended.chosenVertex i.castSucc.succ = + appended.chosenVertex i.succ.castSucc := + congrArg appended.chosenVertex slotIndexEq + _ = data.chosenVertex i.succ := (slotsOld i.succ).2.2.2.2.1 + have currentOutsideEq : appended.outsideVertex i.castSucc.succ = + data.outsideVertex i.succ := by + calc + appended.outsideVertex i.castSucc.succ = + appended.outsideVertex i.succ.castSucc := + congrArg appended.outsideVertex slotIndexEq + _ = data.outsideVertex i.succ := (slotsOld i.succ).2.2.2.2.2.1 + have currentDeltaEq : appended.delta i.castSucc.succ = data.delta i.succ := by + calc + appended.delta i.castSucc.succ = appended.delta i.succ.castSucc := + congrArg appended.delta slotIndexEq + _ = data.delta i.succ := (slotsOld i.succ).2.2.2.2.2.2.1 + have currentGammaEq : appended.gamma i.castSucc.succ = data.gamma i.succ := by + calc + appended.gamma i.castSucc.succ = appended.gamma i.succ.castSucc := + congrArg appended.gamma slotIndexEq + _ = data.gamma i.succ := (slotsOld i.succ).2.2.2.2.2.2.2 + let Package (previousColor currentColor : PartialEdgeColoring E k) + (previousTree outputTree : TreeSequence G e0) + (storedColors currentStoredValue : Finset (Fin k)) + (currentEdgesValue : Finset E) + (currentKindValue : Option TashkinovExtensionKind) + (currentVertexValue currentOutsideValue : Option V) + (currentDeltaValue currentGammaValue : Option (Fin k)) : Prop := + ∃ selectedChoice : MaximumDefectiveChoice G e0 previousTree + storedColors previousColor, + (∀ pi : PartialEdgeColoring E k, + IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring previousTree (insert selectedChoice.color storedColors) + selectedChoice.selected pi → + Disjoint (MissingColors G pi selectedChoice.otherEndpoint) + (TreeMissingColors pi previousTree)) ∧ + currentColor = selectedChoice.selected ∧ + currentStoredValue = {selectedChoice.color} ∧ + currentEdgesValue = {selectedChoice.edge} ∧ + currentKindValue = some TashkinovExtensionKind.SE ∧ + currentVertexValue = some selectedChoice.vertex ∧ + currentOutsideValue = some selectedChoice.otherEndpoint ∧ + currentDeltaValue = some selectedChoice.color ∧ + currentGammaValue = none ∧ + ∃ exactAdjoined : TreeSequence G e0, + TreeSequenceAdjoinEdge previousTree selectedChoice.edge exactAdjoined ∧ + TashkinovClosure currentColor exactAdjoined outputTree ∧ + TreeSequenceInitialSegment previousTree outputTree ∧ + previousTree.length < outputTree.length + exact @helper_continuation_310 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@data) (@newTree) (@newColoring) (@newStored) + (@newConnectingEdges) (@newKind) (@newChosenVertex) (@newOutsideVertex) (@newDelta) + (@newGamma) (@i) (@previousProper) (@previousOneUncolored) (@previousClosed) + (@previousNotStronglyClosed) (@noRevisiting) (@choice) (@seriesAlternative) + (@currentColoring) (@currentStored) (@currentEdges) (@currentKind) (@currentVertex) + (@currentOutside) (@currentDelta) (@currentGamma) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@orderedExtension) (@strictExtension) (@slotIndexEq) (@previousTreeEq) + (@outputTreeEq) (@previousColoringEq) (@storedColorsEq) (@currentColoringEq) + (@currentStoredEq) (@currentEdgesEq) (@currentKindEq) (@currentVertexEq) + (@currentOutsideEq) (@currentDeltaEq) (@currentGammaEq) +private theorem helper_lifted_488.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (data : + TashkinovSeriesData G k rounds e0) (newTree : TreeSequence G e0) (newColoring : + PartialEdgeColoring E k) (newStored : Finset (Fin k)) (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)), + ∀ (i : Fin rounds), IsProperEdgeColoring G (data.coloring i.castSucc) → IsOneEdgeUncolored + (data.coloring i.castSucc) e0 → ColoredVertexSetClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + (data.coloring i.castSucc) (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → + ∀ (_ : MaximumDefectiveChoice G e0 (data.tree i.succ.castSucc) (TashkinovStoredColors data + i.castSucc) (data.coloring i.castSucc)) (_ : Fin k) (_ : PartialEdgeColoring E k), + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).tree i.castSucc.succ.castSucc = data.tree i.succ.castSucc → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).coloring i.castSucc.castSucc = data.coloring i.castSucc → + ∀ (newChoice : MaximumDefectiveChoice G e0 ((TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.castSucc) + (TashkinovStoredColors (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.castSucc) + ((TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).coloring i.castSucc.castSucc)), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring ((TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.castSucc) (insert + newChoice.color (TashkinovStoredColors (TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.castSucc)) newChoice.selected + rho ∧ ¬Disjoint (MissingColors G rho newChoice.otherEndpoint) (TreeMissingColors rho + ((TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).tree i.castSucc.succ.castSucc))) → + ∀ (newGammaValue : Fin k), (ParallelExtensionColor (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.castSucc : + PartialEdgeColoring E k → V → Fin k → Prop) newChoice.selected newChoice.vertex + newGammaValue → + ∀ (newSecondStable : PartialEdgeColoring E k), IsProperEdgeColoring G newSecondStable → + IsOneEdgeUncolored newSecondStable e0 → StableColoring ((TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree + i.castSucc.succ.castSucc) (insert newChoice.color (TashkinovStoredColors + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0) i.castSucc.castSucc)) newChoice.selected newSecondStable → TreeExit + ((TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).tree i.castSucc.succ.castSucc) newSecondStable newGammaValue newChoice.color + newChoice.vertex → (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).coloring i.castSucc.succ = + TwoColorComponentSwap G newSecondStable newGammaValue newChoice.color (Sum.inl + newChoice.vertex) → IsProperEdgeColoring G ((TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).coloring i.castSucc.succ) → + IsOneEdgeUncolored ((TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).coloring i.castSucc.succ) e0 → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).stored i.castSucc.succ = {newChoice.color, newGammaValue} → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).connectingEdges i.castSucc.succ = { newChoice.edge } → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).kind i.castSucc.succ = some TashkinovExtensionKind.PE → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).chosenVertex i.castSucc.succ = some newChoice.vertex → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).outsideVertex i.castSucc.succ = some newChoice.otherEndpoint → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).delta i.castSucc.succ = some newChoice.color → (TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).gamma i.castSucc.succ = + some newGammaValue → TashkinovClosure ((TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).coloring i.castSucc.succ) + ((TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).tree i.castSucc.succ.castSucc) ((TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.succ) → + TreeSequenceInitialSegment ((TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.castSucc) + ((TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).tree i.castSucc.succ.succ) → ((TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree + i.castSucc.succ.castSucc).length < ((TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc.succ.succ).length → + ¬Nonempty (RevisitingExtensionCertificate (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.castSucc) → + TashkinovSeriesStep G k (rounds + (1 : ℕ)) e0 input (TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.succ := by + classical + intro V E _ _ _ G k rounds e0 input data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma + set appended : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0 := TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind + newChosenVertex + newOutsideVertex newDelta newGamma + intro i previousProper previousOneUncolored previousClosed previousNotStronglyClosed choice + gamma secondStable previousTreeEq previousColoringEq + set newRule : PartialEdgeColoring E k → V → Fin k → Prop := ParallelExtensionColor + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : + ℕ)) e0) i.castSucc.castSucc + intro newChoice newSeriesAlternativeFails newGammaValue newGammaRule newSecondStable + newSecondStableProper newSecondStableOneUncolored newSecondStableRelation newExitWitness + newCurrentColoring newCurrentProper newCurrentOneUncolored newCurrentStored newCurrentEdges + newCurrentKind newCurrentVertex newCurrentOutside newCurrentDelta newCurrentGamma + newClosedExtension newOrderedExtension newStrictExtension newNoRevisiting + apply TashkinovSeriesStep.PE (i := i.castSucc) (choice := newChoice) + (gamma := newGammaValue) (secondStable := newSecondStable) + · rw [previousColoringEq] + exact previousProper + · rw [previousColoringEq] + exact previousOneUncolored + · rw [previousColoringEq, previousTreeEq] + exact previousClosed + · rw [previousColoringEq, previousTreeEq] + exact previousNotStronglyClosed + · exact newNoRevisiting + · exact newSeriesAlternativeFails + · exact newGammaRule + · exact newSecondStableProper + · exact newSecondStableOneUncolored + · exact newSecondStableRelation + · exact newExitWitness + · exact newCurrentColoring + · exact newCurrentProper + · exact newCurrentOneUncolored + · exact newCurrentStored + · exact newCurrentEdges + · exact newCurrentKind + · exact newCurrentVertex + · exact newCurrentOutside + · exact newCurrentDelta + · exact newCurrentGamma + · exact newClosedExtension + · exact newOrderedExtension + · exact newStrictExtension + +private theorem helper_continuation_615.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (data : + TashkinovSeriesData G k rounds e0) (newTree : TreeSequence G e0) (newColoring : + PartialEdgeColoring E k) (newStored : Finset (Fin k)) (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)), + ∀ (i : Fin rounds), IsProperEdgeColoring G (data.coloring i.castSucc) → IsOneEdgeUncolored + (data.coloring i.castSucc) e0 → ColoredVertexSetClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + (data.coloring i.castSucc) (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate data i.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (data.tree i.succ.castSucc) (TashkinovStoredColors + data i.castSucc) (data.coloring i.castSucc)), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (data.tree i.succ.castSucc) (insert choice.color (TashkinovStoredColors + data i.castSucc)) choice.selected rho ∧ ¬Disjoint (MissingColors G rho + choice.otherEndpoint) (TreeMissingColors rho (data.tree i.succ.castSucc))) → + ∀ (gamma : Fin k), ParallelExtensionColor data i.castSucc choice.selected choice.vertex gamma + → + ∀ (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + IsOneEdgeUncolored secondStable e0 → StableColoring (data.tree i.succ.castSucc) (insert + choice.color (TashkinovStoredColors data i.castSucc)) choice.selected secondStable → + TreeExit (data.tree i.succ.castSucc) secondStable gamma choice.color choice.vertex → + data.coloring i.succ = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex) → IsProperEdgeColoring G (data.coloring i.succ) → IsOneEdgeUncolored + (data.coloring i.succ) e0 → data.stored i.succ = { choice.color, gamma } → + data.connectingEdges i.succ = { choice.edge } → data.kind i.succ = some + TashkinovExtensionKind.PE → data.chosenVertex i.succ = some choice.vertex → + data.outsideVertex i.succ = some choice.otherEndpoint → data.delta i.succ = some + choice.color → data.gamma i.succ = some gamma → TashkinovClosure (data.coloring i.succ) + (data.tree i.succ.castSucc) (data.tree i.succ.succ) → TreeSequenceInitialSegment + (data.tree i.succ.castSucc) (data.tree i.succ.succ) → (data.tree i.succ.castSucc).length < + (data.tree i.succ.succ).length → i.castSucc.succ = i.succ.castSucc → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).tree i.castSucc.succ.castSucc = data.tree i.succ.castSucc → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).tree i.castSucc.succ.succ = data.tree i.succ.succ → (TashkinovSeriesDataAppend + data newTree newColoring newStored newConnectingEdges newKind newChosenVertex + newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) + e0).coloring i.castSucc.castSucc = data.coloring i.castSucc → TashkinovStoredColors + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0) i.castSucc.castSucc = TashkinovStoredColors data i.castSucc → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).coloring i.castSucc.succ = data.coloring i.succ → (TashkinovSeriesDataAppend + data newTree newColoring newStored newConnectingEdges newKind newChosenVertex + newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).stored + i.castSucc.succ = data.stored i.succ → (TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).connectingEdges i.castSucc.succ = + data.connectingEdges i.succ → (TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).kind i.castSucc.succ = data.kind i.succ → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).chosenVertex i.castSucc.succ = data.chosenVertex i.succ → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).outsideVertex i.castSucc.succ = data.outsideVertex i.succ → + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).delta i.castSucc.succ = data.delta i.succ → (TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).gamma i.castSucc.succ = + data.gamma i.succ → (ParallelExtensionColor (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0) i.castSucc.castSucc : + PartialEdgeColoring E k → V → Fin k → Prop) = (ParallelExtensionColor data i.castSucc : + PartialEdgeColoring E k → V → Fin k → Prop) → TashkinovSeriesStep G k (rounds + (1 : ℕ)) + e0 input (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma) i.succ.castSucc := by + classical + intro V E _ _ _ G k rounds e0 input data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma + set appended : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0 := TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind + newChosenVertex + newOutsideVertex newDelta newGamma + intro i previousProper previousOneUncolored previousClosed previousNotStronglyClosed + noRevisiting choice seriesAlternativeFails gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension slotIndexEq + previousTreeEq outputTreeEq previousColoringEq storedColorsEq currentColoringEq + currentStoredEq currentEdgesEq currentKindEq currentVertexEq currentOutsideEq + currentDeltaEq currentGammaEq + set oldRule : PartialEdgeColoring E k → V → Fin k → Prop := + ParallelExtensionColor data i.castSucc + set newRule : PartialEdgeColoring E k → V → Fin k → Prop := + ParallelExtensionColor + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + 1) e0) i.castSucc.castSucc + intro ruleEq + let Package : (PartialEdgeColoring E k → V → Fin k → Prop) → PartialEdgeColoring E k → + PartialEdgeColoring E k → TreeSequence G e0 → TreeSequence G e0 → Finset (Fin k) → Finset + (Fin k) → Finset E → Option TashkinovExtensionKind → Option V → Option V → Option (Fin k) → + Option (Fin k) → Prop := + fun + (rule : + PartialEdgeColoring E k → + V → Fin k → Prop) + (previousColor currentColor : + PartialEdgeColoring E k) + (previousTree outputTree : + TreeSequence G e0) + (storedColors + currentStoredValue : + Finset (Fin k)) + (currentEdgesValue : Finset E) + (currentKindValue : + Option + TashkinovExtensionKind) + (currentVertexValue + currentOutsideValue : + Option V) + (currentDeltaValue + currentGammaValue : + Option (Fin k)) => + ∃ + (selectedChoice : + MaximumDefectiveChoice G e0 + previousTree storedColors + previousColor), + (∃ + (rho : + PartialEdgeColoring E k), + IsProperEdgeColoring G + rho ∧ + IsOneEdgeUncolored rho + e0 ∧ + StableColoring + previousTree + (insert + selectedChoice.color + storedColors) + selectedChoice.selected + rho ∧ + ¬Disjoint + (MissingColors G + rho + selectedChoice.otherEndpoint) + (TreeMissingColors + rho + previousTree)) ∧ + ∃ + (selectedGamma : Fin k), + rule + selectedChoice.selected + selectedChoice.vertex + selectedGamma ∧ + ∃ (stableColoring : + PartialEdgeColoring E + k), + IsProperEdgeColoring G + stableColoring ∧ + IsOneEdgeUncolored + stableColoring + e0 ∧ + StableColoring + previousTree + (insert + selectedChoice.color + storedColors) + selectedChoice.selected + stableColoring ∧ + TreeExit + previousTree + stableColoring + selectedGamma + selectedChoice.color + selectedChoice.vertex ∧ + currentColor = + TwoColorComponentSwap + G + stableColoring + selectedGamma + selectedChoice.color + (Sum.inl + selectedChoice.vertex) ∧ + IsProperEdgeColoring + G + currentColor ∧ + IsOneEdgeUncolored + currentColor + e0 ∧ + currentStoredValue = + {selectedChoice.color, + selectedGamma} ∧ + currentEdgesValue = + {selectedChoice.edge} ∧ + currentKindValue = + some + TashkinovExtensionKind.PE ∧ + currentVertexValue = + some + selectedChoice.vertex ∧ + currentOutsideValue = + some + selectedChoice.otherEndpoint ∧ + currentDeltaValue = + some + selectedChoice.color ∧ + currentGammaValue = + some + selectedGamma ∧ + TashkinovClosure + currentColor + previousTree + outputTree ∧ + TreeSequenceInitialSegment + previousTree + outputTree ∧ + previousTree.length < + outputTree.length + have oldPackage : Package oldRule (data.coloring i.castSucc) + (data.coloring i.succ) (data.tree i.succ.castSucc) + (data.tree i.succ.succ) (TashkinovStoredColors data i.castSucc) + (data.stored i.succ) (data.connectingEdges i.succ) + (data.kind i.succ) (data.chosenVertex i.succ) + (data.outsideVertex i.succ) (data.delta i.succ) (data.gamma i.succ) := by + exact ⟨choice, seriesAlternativeFails, gamma, gammaRule, secondStable, + secondStableProper, secondStableOneUncolored, secondStableRelation, + exitWitness, currentColoring, currentProper, currentOneUncolored, + currentStored, currentEdges, currentKind, currentVertex, currentOutside, + currentDelta, currentGamma, closedExtension, orderedExtension, + strictExtension⟩ + have newPackage : Package newRule (appended.coloring i.castSucc.castSucc) + (appended.coloring i.castSucc.succ) + (appended.tree i.castSucc.succ.castSucc) + (appended.tree i.castSucc.succ.succ) + (TashkinovStoredColors appended i.castSucc.castSucc) + (appended.stored i.castSucc.succ) + (appended.connectingEdges i.castSucc.succ) + (appended.kind i.castSucc.succ) + (appended.chosenVertex i.castSucc.succ) + (appended.outsideVertex i.castSucc.succ) + (appended.delta i.castSucc.succ) (appended.gamma i.castSucc.succ) := by + rw [ruleEq, previousColoringEq, currentColoringEq, previousTreeEq, + outputTreeEq, storedColorsEq, currentStoredEq, currentEdgesEq, + currentKindEq, currentVertexEq, currentOutsideEq, currentDeltaEq, + currentGammaEq] + exact oldPackage + rcases newPackage with ⟨newChoice, newSeriesAlternativeFails, + newGammaValue, newGammaRule, newSecondStable, newSecondStableProper, + newSecondStableOneUncolored, newSecondStableRelation, newExitWitness, + newCurrentColoring, newCurrentProper, newCurrentOneUncolored, + newCurrentStored, newCurrentEdges, newCurrentKind, newCurrentVertex, + newCurrentOutside, newCurrentDelta, newCurrentGamma, newClosedExtension, + newOrderedExtension, newStrictExtension⟩ + have newNoRevisiting : ¬ Nonempty + (RevisitingExtensionCertificate appended i.castSucc.castSucc) := by + rintro ⟨newCertificate⟩ + rcases (RevisitingExtensionCertificateAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma i.castSucc).1 newCertificate with ⟨oldCertificate, -⟩ + exact noRevisiting ⟨oldCertificate⟩ + have lifted := @helper_lifted_488 V E inferInstance inferInstance inferInstance G k rounds e0 + input data newTree newColoring newStored newConnectingEdges newKind newChosenVertex + newOutsideVertex newDelta newGamma i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed choice gamma secondStable previousTreeEq previousColoringEq + newChoice newSeriesAlternativeFails newGammaValue newGammaRule newSecondStable + newSecondStableProper newSecondStableOneUncolored newSecondStableRelation newExitWitness + newCurrentColoring newCurrentProper newCurrentOneUncolored newCurrentStored newCurrentEdges + newCurrentKind newCurrentVertex newCurrentOutside newCurrentDelta newCurrentGamma + newClosedExtension newOrderedExtension newStrictExtension newNoRevisiting + rw [← slotIndexEq] + exact lifted + +private theorem helper_branch_265.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (data : + TashkinovSeriesData G k rounds e0) (newTree : TreeSequence G e0) (newColoring : + PartialEdgeColoring E k) (newStored : Finset (Fin k)) (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)), ( + ∀ (i : Fin (rounds + (2 : ℕ))), (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc = data.tree i) → ( + ∀ (i : Fin (rounds + (1 : ℕ))), (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).coloring i.castSucc = data.coloring i ∧ + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).stored i.castSucc = data.stored i ∧ (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).connectingEdges i.castSucc = + data.connectingEdges i ∧ (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).kind i.castSucc = data.kind i ∧ + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).chosenVertex i.castSucc = data.chosenVertex i ∧ (TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).outsideVertex + i.castSucc = data.outsideVertex i ∧ (TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).delta i.castSucc = data.delta i ∧ + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).gamma i.castSucc = data.gamma i) → + ∀ (i : Fin rounds), IsProperEdgeColoring G (data.coloring i.castSucc) → IsOneEdgeUncolored + (data.coloring i.castSucc) e0 → ColoredVertexSetClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + (data.coloring i.castSucc) (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate data i.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (data.tree i.succ.castSucc) (TashkinovStoredColors + data i.castSucc) (data.coloring i.castSucc)), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (data.tree i.succ.castSucc) (insert choice.color (TashkinovStoredColors + data i.castSucc)) choice.selected rho ∧ ¬Disjoint (MissingColors G rho + choice.otherEndpoint) (TreeMissingColors rho (data.tree i.succ.castSucc))) → + ∀ (gamma : Fin k), ParallelExtensionColor data i.castSucc choice.selected choice.vertex gamma + → + ∀ (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + IsOneEdgeUncolored secondStable e0 → StableColoring (data.tree i.succ.castSucc) (insert + choice.color (TashkinovStoredColors data i.castSucc)) choice.selected secondStable → + TreeExit (data.tree i.succ.castSucc) secondStable gamma choice.color choice.vertex → + data.coloring i.succ = TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl + choice.vertex) → IsProperEdgeColoring G (data.coloring i.succ) → IsOneEdgeUncolored + (data.coloring i.succ) e0 → data.stored i.succ = {choice.color, gamma} → + data.connectingEdges i.succ = { choice.edge } → data.kind i.succ = some + TashkinovExtensionKind.PE → data.chosenVertex i.succ = some choice.vertex → + data.outsideVertex i.succ = some choice.otherEndpoint → data.delta i.succ = some + choice.color → data.gamma i.succ = some gamma → TashkinovClosure (data.coloring i.succ) + (data.tree i.succ.castSucc) (data.tree i.succ.succ) → TreeSequenceInitialSegment + (data.tree i.succ.castSucc) (data.tree i.succ.succ) → (data.tree i.succ.castSucc).length < + (data.tree i.succ.succ).length → TashkinovSeriesStep G k (rounds + (1 : ℕ)) e0 input + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma) i.succ.castSucc := by + classical + intro V E _ _ _ G k rounds e0 input data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma + set appended : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0 := TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind + newChosenVertex + newOutsideVertex newDelta newGamma + intro treeOld slotsOld i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule + secondStable secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension + have slotIndexEq : i.castSucc.succ = i.succ.castSucc := by ext; rfl + have previousTreeIndexEq : i.castSucc.succ.castSucc = + i.succ.castSucc.castSucc := by ext; rfl + have outputTreeIndexEq : i.castSucc.succ.succ = + i.succ.succ.castSucc := by ext; rfl + have previousTreeEq : appended.tree i.castSucc.succ.castSucc = + data.tree i.succ.castSucc := by + calc + appended.tree i.castSucc.succ.castSucc = + appended.tree i.succ.castSucc.castSucc := + congrArg appended.tree previousTreeIndexEq + _ = data.tree i.succ.castSucc := treeOld i.succ.castSucc + have outputTreeEq : appended.tree i.castSucc.succ.succ = + data.tree i.succ.succ := by + calc + appended.tree i.castSucc.succ.succ = + appended.tree i.succ.succ.castSucc := + congrArg appended.tree outputTreeIndexEq + _ = data.tree i.succ.succ := treeOld i.succ.succ + have previousColoringEq : appended.coloring i.castSucc.castSucc = + data.coloring i.castSucc := (slotsOld i.castSucc).1 + have storedColorsEq : TashkinovStoredColors appended i.castSucc.castSucc = + TashkinovStoredColors data i.castSucc := + TashkinovStoredColorsAppend data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma i.castSucc + have currentColoringEq : appended.coloring i.castSucc.succ = + data.coloring i.succ := by + calc + appended.coloring i.castSucc.succ = + appended.coloring i.succ.castSucc := + congrArg appended.coloring slotIndexEq + _ = data.coloring i.succ := (slotsOld i.succ).1 + have currentStoredEq : appended.stored i.castSucc.succ = + data.stored i.succ := by + calc + appended.stored i.castSucc.succ = appended.stored i.succ.castSucc := + congrArg appended.stored slotIndexEq + _ = data.stored i.succ := (slotsOld i.succ).2.1 + have currentEdgesEq : appended.connectingEdges i.castSucc.succ = + data.connectingEdges i.succ := by + calc + appended.connectingEdges i.castSucc.succ = + appended.connectingEdges i.succ.castSucc := + congrArg appended.connectingEdges slotIndexEq + _ = data.connectingEdges i.succ := (slotsOld i.succ).2.2.1 + have currentKindEq : appended.kind i.castSucc.succ = data.kind i.succ := by + calc + appended.kind i.castSucc.succ = appended.kind i.succ.castSucc := + congrArg appended.kind slotIndexEq + _ = data.kind i.succ := (slotsOld i.succ).2.2.2.1 + have currentVertexEq : appended.chosenVertex i.castSucc.succ = + data.chosenVertex i.succ := by + calc + appended.chosenVertex i.castSucc.succ = + appended.chosenVertex i.succ.castSucc := + congrArg appended.chosenVertex slotIndexEq + _ = data.chosenVertex i.succ := (slotsOld i.succ).2.2.2.2.1 + have currentOutsideEq : appended.outsideVertex i.castSucc.succ = + data.outsideVertex i.succ := by + calc + appended.outsideVertex i.castSucc.succ = + appended.outsideVertex i.succ.castSucc := + congrArg appended.outsideVertex slotIndexEq + _ = data.outsideVertex i.succ := (slotsOld i.succ).2.2.2.2.2.1 + have currentDeltaEq : appended.delta i.castSucc.succ = data.delta i.succ := by + calc + appended.delta i.castSucc.succ = appended.delta i.succ.castSucc := + congrArg appended.delta slotIndexEq + _ = data.delta i.succ := (slotsOld i.succ).2.2.2.2.2.2.1 + have currentGammaEq : appended.gamma i.castSucc.succ = data.gamma i.succ := by + calc + appended.gamma i.castSucc.succ = appended.gamma i.succ.castSucc := + congrArg appended.gamma slotIndexEq + _ = data.gamma i.succ := (slotsOld i.succ).2.2.2.2.2.2.2 + let oldRule := fun selected v gamma => + ParallelExtensionColor data i.castSucc selected v gamma + let newRule := fun selected v gamma => + ParallelExtensionColor appended i.castSucc.castSucc selected v gamma + have ruleEq : newRule = oldRule := by + funext selected v gamma + apply propext + exact ParallelExtensionColorAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma i.castSucc selected v gamma + let Package (rule : PartialEdgeColoring E k → V → Fin k → Prop) + (previousColor currentColor : PartialEdgeColoring E k) + (previousTree outputTree : TreeSequence G e0) + (storedColors currentStoredValue : Finset (Fin k)) + (currentEdgesValue : Finset E) + (currentKindValue : Option TashkinovExtensionKind) + (currentVertexValue currentOutsideValue : Option V) + (currentDeltaValue currentGammaValue : Option (Fin k)) : Prop := + ∃ selectedChoice : MaximumDefectiveChoice G e0 previousTree + storedColors previousColor, + (∃ rho : PartialEdgeColoring E k, + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring previousTree (insert selectedChoice.color storedColors) + selectedChoice.selected rho ∧ + ¬ Disjoint (MissingColors G rho selectedChoice.otherEndpoint) + (TreeMissingColors rho previousTree)) ∧ + ∃ selectedGamma : Fin k, + rule selectedChoice.selected selectedChoice.vertex selectedGamma ∧ + ∃ stableColoring : PartialEdgeColoring E k, + IsProperEdgeColoring G stableColoring ∧ + IsOneEdgeUncolored stableColoring e0 ∧ + StableColoring previousTree (insert selectedChoice.color storedColors) + selectedChoice.selected stableColoring ∧ + TreeExit previousTree stableColoring selectedGamma + selectedChoice.color selectedChoice.vertex ∧ + currentColor = TwoColorComponentSwap G stableColoring selectedGamma + selectedChoice.color (Sum.inl selectedChoice.vertex) ∧ + IsProperEdgeColoring G currentColor ∧ + IsOneEdgeUncolored currentColor e0 ∧ + currentStoredValue = {selectedChoice.color, selectedGamma} ∧ + currentEdgesValue = {selectedChoice.edge} ∧ + currentKindValue = some TashkinovExtensionKind.PE ∧ + currentVertexValue = some selectedChoice.vertex ∧ + currentOutsideValue = some selectedChoice.otherEndpoint ∧ + currentDeltaValue = some selectedChoice.color ∧ + currentGammaValue = some selectedGamma ∧ + TashkinovClosure currentColor previousTree outputTree ∧ + TreeSequenceInitialSegment previousTree outputTree ∧ + previousTree.length < outputTree.length + exact @helper_continuation_615 V E inferInstance inferInstance inferInstance G k rounds e0 + input data newTree newColoring newStored newConnectingEdges newKind newChosenVertex + newOutsideVertex newDelta newGamma i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma gammaRule + secondStable secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension slotIndexEq previousTreeEq outputTreeEq previousColoringEq storedColorsEq + currentColoringEq currentStoredEq currentEdgesEq currentKindEq currentVertexEq + currentOutsideEq currentDeltaEq currentGammaEq ruleEq +private theorem helper_branch_472.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (data : + TashkinovSeriesData G k rounds e0) (newTree : TreeSequence G e0) (newColoring : + PartialEdgeColoring E k) (newStored : Finset (Fin k)) (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)), ( + ∀ (i : Fin (rounds + (2 : ℕ))), (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).tree i.castSucc = data.tree i) → ( + ∀ (i : Fin (rounds + (1 : ℕ))), (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).coloring i.castSucc = data.coloring i ∧ + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).stored i.castSucc = data.stored i ∧ (TashkinovSeriesDataAppend data newTree + newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta + newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).connectingEdges i.castSucc = + data.connectingEdges i ∧ (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).kind i.castSucc = data.kind i ∧ + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).chosenVertex i.castSucc = data.chosenVertex i ∧ (TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).outsideVertex + i.castSucc = data.outsideVertex i ∧ (TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma : + TashkinovSeriesData G k (rounds + (1 : ℕ)) e0).delta i.castSucc = data.delta i ∧ + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges newKind + newChosenVertex newOutsideVertex newDelta newGamma : TashkinovSeriesData G k (rounds + (1 + : ℕ)) e0).gamma i.castSucc = data.gamma i) → + ∀ (i : Fin rounds), IsProperEdgeColoring G (data.coloring i.castSucc) → IsOneEdgeUncolored + (data.coloring i.castSucc) e0 → ColoredVertexSetClosed G (data.coloring i.castSucc) + (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G + (data.coloring i.castSucc) (TreeSequenceVertexSet (data.tree i.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate data i.castSucc), data.coloring i.succ = + data.coloring i.castSucc → data.stored i.succ = { available.delta, available.gamma } → + data.connectingEdges i.succ = { available.edge } → data.kind i.succ = some + TashkinovExtensionKind.RE → data.chosenVertex i.succ = some available.insideEndpoint → + data.outsideVertex i.succ = some available.outsideEndpoint → data.delta i.succ = some + available.delta → data.gamma i.succ = some available.gamma → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (data.tree i.succ.castSucc) + available.edge adjoined → TashkinovClosure (data.coloring i.succ) adjoined (data.tree + i.succ.succ) → TreeSequenceInitialSegment (data.tree i.succ.castSucc) (data.tree + i.succ.succ) → (data.tree i.succ.castSucc).length < (data.tree i.succ.succ).length → + TashkinovSeriesStep G k (rounds + (1 : ℕ)) e0 input (TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma) i.succ.castSucc := by + classical + intro V E _ _ _ G k rounds e0 input data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma + set appended : TashkinovSeriesData G k (rounds + (1 : ℕ)) e0 := TashkinovSeriesDataAppend data + newTree newColoring newStored newConnectingEdges newKind + newChosenVertex + newOutsideVertex newDelta newGamma + intro treeOld slotsOld i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension + have slotIndexEq : i.castSucc.succ = i.succ.castSucc := by ext; rfl + have previousTreeIndexEq : i.castSucc.succ.castSucc = + i.succ.castSucc.castSucc := by ext; rfl + have outputTreeIndexEq : i.castSucc.succ.succ = + i.succ.succ.castSucc := by ext; rfl + have previousTreeEq : appended.tree i.castSucc.succ.castSucc = + data.tree i.succ.castSucc := by + calc + appended.tree i.castSucc.succ.castSucc = + appended.tree i.succ.castSucc.castSucc := + congrArg appended.tree previousTreeIndexEq + _ = data.tree i.succ.castSucc := treeOld i.succ.castSucc + have outputTreeEq : appended.tree i.castSucc.succ.succ = + data.tree i.succ.succ := by + calc + appended.tree i.castSucc.succ.succ = + appended.tree i.succ.succ.castSucc := + congrArg appended.tree outputTreeIndexEq + _ = data.tree i.succ.succ := treeOld i.succ.succ + have previousColoringEq : appended.coloring i.castSucc.castSucc = + data.coloring i.castSucc := (slotsOld i.castSucc).1 + have currentColoringEq : appended.coloring i.castSucc.succ = + data.coloring i.succ := by + calc + appended.coloring i.castSucc.succ = + appended.coloring i.succ.castSucc := + congrArg appended.coloring slotIndexEq + _ = data.coloring i.succ := (slotsOld i.succ).1 + have currentStoredEq : appended.stored i.castSucc.succ = + data.stored i.succ := by + calc + appended.stored i.castSucc.succ = appended.stored i.succ.castSucc := + congrArg appended.stored slotIndexEq + _ = data.stored i.succ := (slotsOld i.succ).2.1 + have currentEdgesEq : appended.connectingEdges i.castSucc.succ = + data.connectingEdges i.succ := by + calc + appended.connectingEdges i.castSucc.succ = + appended.connectingEdges i.succ.castSucc := + congrArg appended.connectingEdges slotIndexEq + _ = data.connectingEdges i.succ := (slotsOld i.succ).2.2.1 + have currentKindEq : appended.kind i.castSucc.succ = data.kind i.succ := by + calc + appended.kind i.castSucc.succ = appended.kind i.succ.castSucc := + congrArg appended.kind slotIndexEq + _ = data.kind i.succ := (slotsOld i.succ).2.2.2.1 + have currentVertexEq : appended.chosenVertex i.castSucc.succ = + data.chosenVertex i.succ := by + calc + appended.chosenVertex i.castSucc.succ = + appended.chosenVertex i.succ.castSucc := + congrArg appended.chosenVertex slotIndexEq + _ = data.chosenVertex i.succ := (slotsOld i.succ).2.2.2.2.1 + have currentOutsideEq : appended.outsideVertex i.castSucc.succ = + data.outsideVertex i.succ := by + calc + appended.outsideVertex i.castSucc.succ = + appended.outsideVertex i.succ.castSucc := + congrArg appended.outsideVertex slotIndexEq + _ = data.outsideVertex i.succ := (slotsOld i.succ).2.2.2.2.2.1 + have currentDeltaEq : appended.delta i.castSucc.succ = data.delta i.succ := by + calc + appended.delta i.castSucc.succ = appended.delta i.succ.castSucc := + congrArg appended.delta slotIndexEq + _ = data.delta i.succ := (slotsOld i.succ).2.2.2.2.2.2.1 + have currentGammaEq : appended.gamma i.castSucc.succ = data.gamma i.succ := by + calc + appended.gamma i.castSucc.succ = appended.gamma i.succ.castSucc := + congrArg appended.gamma slotIndexEq + _ = data.gamma i.succ := (slotsOld i.succ).2.2.2.2.2.2.2 + rcases (RevisitingExtensionCertificateAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma i.castSucc).2 available with + ⟨newAvailable, availableGamma, availableDelta, availableEdge, + availableInside, availableOutside⟩ + have lifted : TashkinovSeriesStep G k (rounds + 1) e0 input appended + i.castSucc.succ := by + apply TashkinovSeriesStep.RE (i := i.castSucc) + (available := newAvailable) (adjoined := adjoined) + · rw [previousColoringEq] + exact previousProper + · rw [previousColoringEq] + exact previousOneUncolored + · rw [previousColoringEq, previousTreeEq] + exact previousClosed + · rw [previousColoringEq, previousTreeEq] + exact previousNotStronglyClosed + · rw [currentColoringEq, previousColoringEq] + exact currentColoring + · rw [currentStoredEq, availableDelta, availableGamma] + exact currentStored + · rw [currentEdgesEq, availableEdge] + exact currentEdges + · rw [currentKindEq] + exact currentKind + · rw [currentVertexEq, availableInside] + exact currentVertex + · rw [currentOutsideEq, availableOutside] + exact currentOutside + · rw [currentDeltaEq, availableDelta] + exact currentDelta + · rw [currentGammaEq, availableGamma] + exact currentGamma + · rw [previousTreeEq, availableEdge] + exact adjoinedExactly + · rw [currentColoringEq, outputTreeEq] + exact closedExtension + · rw [previousTreeEq, outputTreeEq] + exact orderedExtension + · rw [previousTreeEq, outputTreeEq] + exact strictExtension + rw [← slotIndexEq] + exact lifted + +theorem TashkinovSeriesStepAppend {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) + (newTree : TreeSequence G e0) + (newColoring : PartialEdgeColoring E k) + (newStored : Finset (Fin k)) + (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) + (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)) + (j : Fin (rounds + 1)) + (step : TashkinovSeriesStep G k rounds e0 input data j) : + TashkinovSeriesStep G k (rounds + 1) e0 input + (TashkinovSeriesDataAppend data newTree newColoring newStored newConnectingEdges + newKind newChosenVertex newOutsideVertex newDelta newGamma) + j.castSucc := by + let appended := TashkinovSeriesDataAppend data newTree newColoring + newStored newConnectingEdges newKind newChosenVertex newOutsideVertex + newDelta newGamma + have treeOld : ∀ i : Fin (rounds + 2), + appended.tree i.castSucc = data.tree i := by + intro i + simp [appended, TashkinovSeriesDataAppend] + have slotsOld : + ∀ i : Fin (rounds + 1), appended.coloring i.castSucc = data.coloring i ∧ appended.stored + i.castSucc = data.stored i ∧ appended.connectingEdges i.castSucc = data.connectingEdges i + ∧ appended.kind i.castSucc = data.kind i ∧ appended.chosenVertex i.castSucc = + data.chosenVertex i ∧ appended.outsideVertex i.castSucc = data.outsideVertex i ∧ + appended.delta i.castSucc = data.delta i ∧ appended.gamma i.castSucc = data.gamma i := by + intro i + simp [appended, TashkinovSeriesDataAppend] + have treeZeroIndex : (0 : Fin ((rounds + 1) + 2)) = + (0 : Fin (rounds + 2)).castSucc := by ext; rfl + have treeOneIndex : (1 : Fin ((rounds + 1) + 2)) = + (1 : Fin (rounds + 2)).castSucc := by ext; rfl + have slotZeroIndex : (0 : Fin ((rounds + 1) + 1)) = + (0 : Fin (rounds + 1)).castSucc := by ext; rfl + cases step with + | initial triple seedLength initialColoring initialStored initialEdges initialKind + initialVertex initialOutside initialDelta initialGamma initialClosure => + apply TashkinovSeriesStep.initial triple + · rw [treeZeroIndex, treeOld] + exact seedLength + · rw [slotZeroIndex, (slotsOld 0).1] + exact initialColoring + · rw [slotZeroIndex, (slotsOld 0).2.1] + exact initialStored + · rw [slotZeroIndex, (slotsOld 0).2.2.1] + exact initialEdges + · rw [slotZeroIndex, (slotsOld 0).2.2.2.1] + exact initialKind + · rw [slotZeroIndex, (slotsOld 0).2.2.2.2.1] + exact initialVertex + · rw [slotZeroIndex, (slotsOld 0).2.2.2.2.2.1] + exact initialOutside + · rw [slotZeroIndex, (slotsOld 0).2.2.2.2.2.2.1] + exact initialDelta + · rw [slotZeroIndex, (slotsOld 0).2.2.2.2.2.2.2] + exact initialGamma + · rw [treeZeroIndex, treeOneIndex, treeOld, treeOld, + slotZeroIndex, (slotsOld 0).1] + exact initialClosure + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_92 V E inferInstance inferInstance inferInstance G k rounds e0 + input data newTree newColoring newStored newConnectingEdges newKind newChosenVertex + newOutsideVertex newDelta newGamma treeOld slotsOld i previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternative currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact @helper_branch_265 V E inferInstance inferInstance inferInstance G k rounds e0 + input data newTree newColoring newStored newConnectingEdges newKind newChosenVertex + newOutsideVertex newDelta newGamma treeOld slotsOld i previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness currentColoring + currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_472 V E inferInstance inferInstance inferInstance G k rounds e0 + input data newTree newColoring newStored newConnectingEdges newKind newChosenVertex + newOutsideVertex newDelta newGamma treeOld slotsOld i previousProper + previousOneUncolored previousClosed previousNotStronglyClosed available + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesStepPrefix.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesStepPrefix.lean new file mode 100644 index 0000000000..0cc05e38a7 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesStepPrefix.lean @@ -0,0 +1,1615 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesDataPrefix +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColorsPrefix + +/-! +# Tashkinov Series Step Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch286Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) (m : ℕ) (hm : m ≤ rounds) (triple : KTriple G k + e0 input) (seedLength : (data.tree (0 : Fin (rounds + (2 : ℕ)))).length = (1 : ℕ)) + (initialColoring : data.coloring (0 : Fin (rounds + (1 : ℕ))) = input) (initialStored : + data.stored (0 : Fin (rounds + (1 : ℕ))) = ∅) (initialEdges : data.connectingEdges (0 : + Fin (rounds + (1 : ℕ))) = ∅) (initialKind : data.kind (0 : Fin (rounds + (1 : ℕ))) = none) + (initialVertex : data.chosenVertex (0 : Fin (rounds + (1 : ℕ))) = none) (initialOutside : + data.outsideVertex (0 : Fin (rounds + (1 : ℕ))) = none) (initialDelta : data.delta (0 : + Fin (rounds + (1 : ℕ))) = none) (initialGamma : data.gamma (0 : Fin (rounds + (1 : ℕ))) = + none) (initialClosure : TashkinovClosure (data.coloring (0 : Fin (rounds + (1 : ℕ)))) + (data.tree (0 : Fin (rounds + (2 : ℕ)))) (data.tree (1 : Fin (rounds + (2 : ℕ))))) (hj : + (↑(0 : Fin (rounds + (1 : ℕ))) : ℕ) ≤ m), + ∃ (prefixCert : TashkinovSeriesStep G k m e0 input (TashkinovSeriesDataPrefix m hm data) + (⟨(↑(0 : Fin (rounds + (1 : ℕ))) : ℕ), + by omega + ⟩ : Fin (m + (1 : ℕ)))), prefixCert ≍ TashkinovSeriesStep.initial triple seedLength + initialColoring initialStored initialEdges initialKind initialVertex initialOutside + initialDelta initialGamma initialClosure + +private abbrev helperNoRevisiting362Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] {G : LooplessMultigraph V E} + {k rounds : ℕ} {e0 : E} (data : TashkinovSeriesData G k rounds e0) (m : ℕ) (hm : m ≤ + rounds) (idx : Fin rounds), ¬Nonempty (RevisitingExtensionCertificate data idx.castSucc) → + ∀ (_ : MaximumDefectiveChoice G e0 (data.tree idx.succ.castSucc) (TashkinovStoredColors data + idx.castSucc) (data.coloring idx.castSucc)) (_ : Fin k), (↑idx : ℕ) + (1 : ℕ) ≤ m → + ∀ (hidx : (↑idx : ℕ) < m), + let idx' : Fin m := (⟨(↑idx : ℕ), hidx⟩ : Fin m); (TashkinovSeriesDataPrefix m hm + data).coloring idx'.castSucc = data.coloring idx.castSucc → (TashkinovSeriesDataPrefix m + hm data).tree idx'.succ.castSucc = data.tree idx.succ.castSucc → + (TashkinovSeriesDataPrefix m hm data).tree idx'.castSucc.succ = data.tree + idx.castSucc.succ → TashkinovStoredColors (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc = TashkinovStoredColors data idx.castSucc → ¬Nonempty + (RevisitingExtensionCertificate (TashkinovSeriesDataPrefix m hm data) idx'.castSucc) + +private noncomputable abbrev helperCycle365.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + {G : LooplessMultigraph V E} → + {k rounds : ℕ} → + {e0 : E} → + (data : TashkinovSeriesData G k rounds e0) → + (m : ℕ) → + (hm : m ≤ rounds) → + (idx : Fin rounds) → + (available : RevisitingExtensionCertificate data idx.castSucc) → + (hidx : (↑idx : ℕ) < m) → + let idx' : Fin m := (⟨(↑idx : ℕ), hidx⟩ : Fin m); + (TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc = + data.coloring idx.castSucc → + TwoColorCycle G + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + available.gamma available.delta := by + classical + intro V E inst inst_1 G k rounds e0 data m hm idx available hidx idx' hprev + exact { + base := available.cycle.base, + walk := + @Eq.ndrec (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (fun (phi : PartialEdgeColoring E k) ↦ + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k rounds + e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k rounds + e0 data (@Fin.castSucc rounds idx) available)) + (@TwoColorCycle.base V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k rounds + e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k rounds + e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 G k rounds + e0 data (@Fin.castSucc rounds idx) available)) + (@TwoColorCycle.base V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k rounds + e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k rounds + e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 G k rounds + e0 data (@Fin.castSucc rounds idx) available))) + (@TwoColorCycle.walk V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k rounds e0 + data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k rounds e0 + data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 G k rounds e0 + data (@Fin.castSucc rounds idx) available)) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 m hm data) + (@Fin.castSucc m idx')) + (@Eq.symm (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 m hm data) + (@Fin.castSucc m idx')) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + hprev), + isCycle := + id + (Eq.casesOn (motive := + fun (a : PartialEdgeColoring E k) + (t : + (TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc = + a) ↦ + data.coloring idx.castSucc = a → + hprev ≍ t → + (@Eq.rec (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (fun (x : PartialEdgeColoring E k) + (x_1 : + @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + x) ↦ + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k x + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G + k rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G + k rounds e0 data (@Fin.castSucc rounds idx) + available)) + (@TwoColorCycle.base V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G + k rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G + k rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 G + k rounds e0 data (@Fin.castSucc rounds idx) + available)) + (@TwoColorCycle.base V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G + k rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G + k rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 G + k rounds e0 data (@Fin.castSucc rounds idx) + available))) + (@TwoColorCycle.walk V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available)) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 m + hm data) + (@Fin.castSucc m idx')) + (@Eq.symm (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 + m hm data) + (@Fin.castSucc m idx')) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + hprev)).IsCycle) + hprev + (fun + (h : + data.coloring idx.castSucc = + (TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + (h_1 : + hprev ≍ + Eq.refl + ((TashkinovSeriesDataPrefix m hm data).coloring + idx'.castSucc)) ↦ + @Eq.ndrec + (@Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 m hm + data) + (@Fin.castSucc m idx')) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx))) + (@Eq.refl (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 m hm + data) + (@Fin.castSucc m idx'))) + (fun + (hprev : + @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds + e0 m hm data) + (@Fin.castSucc m idx')) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx))) ↦ + @SimpleGraph.Walk.IsCycle (Sum V E) + (@TwoColorIncidenceGraph V E G k + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 + m hm data) + (@Fin.castSucc m idx')) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available)) + (@TwoColorCycle.base V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available)) + (@Eq.rec (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (fun (x : PartialEdgeColoring E k) + (x_1 : + @Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 + data (@Fin.castSucc rounds idx)) + x) ↦ + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k x + (@RevisitingExtensionCertificate.gamma V E inst inst_1 + G k rounds e0 data (@Fin.castSucc rounds idx) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 + G k rounds e0 data (@Fin.castSucc rounds idx) + available)) + (@TwoColorCycle.base V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 + G k rounds e0 data (@Fin.castSucc rounds idx) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 + G k rounds e0 data (@Fin.castSucc rounds idx) + available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 + G k rounds e0 data (@Fin.castSucc rounds idx) + available)) + (@TwoColorCycle.base V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 + G k rounds e0 data (@Fin.castSucc rounds idx) + available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 + G k rounds e0 data (@Fin.castSucc rounds idx) + available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 + G k rounds e0 data (@Fin.castSucc rounds idx) + available))) + (@TwoColorCycle.walk V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available)) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 + m hm data) + (@Fin.castSucc m idx')) + (@Eq.symm (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds + e0 m hm data) + (@Fin.castSucc m idx')) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + hprev))) + (@TwoColorCycle.isCycle V E G k + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx)) + (@RevisitingExtensionCertificate.gamma V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.cycle V E inst inst_1 G k + rounds e0 data (@Fin.castSucc rounds idx) available)) + hprev + (@Eq.symm + (@Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 m + hm data) + (@Fin.castSucc m idx')) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx))) + hprev + (@Eq.refl (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 m + hm data) + (@Fin.castSucc m idx'))) + (@eq_of_heq + (@Eq (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 + m hm data) + (@Fin.castSucc m idx')) + (@TashkinovSeriesData.coloring V E G k rounds e0 data + (@Fin.castSucc rounds idx))) + hprev + (@Eq.refl (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 + m hm data) + (@Fin.castSucc m idx'))) + h_1))) + (Eq.refl (data.coloring idx.castSucc)) (HEq.refl hprev)) : + TwoColorCycle G + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + available.gamma available.delta }; + +private noncomputable abbrev helperAvailable754.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [inst : Fintype V] → + [inst_1 : Fintype E] → + {G : LooplessMultigraph V E} → + {k rounds : ℕ} → + {e0 : E} → + (data : TashkinovSeriesData G k rounds e0) → + (m : ℕ) → + (hm : m ≤ rounds) → + (idx : Fin rounds) → + (available : RevisitingExtensionCertificate data idx.castSucc) → + (hidx : (↑idx : ℕ) < m) → + let idx' : Fin m := (⟨(↑idx : ℕ), hidx⟩ : Fin m); + (hprev : + (TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc = + data.coloring idx.castSucc) → + (TashkinovSeriesDataPrefix m hm data).tree idx'.castSucc.succ = + data.tree idx.castSucc.succ → + (haBound : (↑available.earlier : ℕ) < m + (1 : ℕ)) → + let earlier' : Fin (m + (1 : ℕ)) := + (⟨(↑available.earlier : ℕ), haBound⟩ : Fin (m + (1 : ℕ))); + (TashkinovSeriesDataPrefix m hm data).kind earlier' = + data.kind available.earlier → + (TashkinovSeriesDataPrefix m hm data).gamma earlier' = + data.gamma available.earlier → + (TashkinovSeriesDataPrefix m hm data).delta earlier' = + data.delta available.earlier → + (TashkinovSeriesDataPrefix m hm data).tree + earlier'.castSucc = + data.tree available.earlier.castSucc → + let _ : + TwoColorCycle G + ((TashkinovSeriesDataPrefix m hm data).coloring + idx'.castSucc) + available.gamma available.delta := by + exact + @helperCycle365 (@V) (@E) inferInstance + inferInstance (@G) (@k) (@rounds) (@e0) (@data) + (@m) (@hm) (@idx) (@available) (@hidx) (@hprev) + let _ : + (TwoColorIncidenceGraph G + ((TashkinovSeriesDataPrefix m hm + data).coloring + idx'.castSucc) + available.gamma available.delta).Walk + (Sum.inr available.edge) + (Sum.inl available.returnVertex) := + @Eq.ndrec (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k rounds e0 + data (@Fin.castSucc rounds idx)) + (fun (phi : PartialEdgeColoring E k) ↦ + @SimpleGraph.Walk (Sum V E) + (@TwoColorIncidenceGraph V E G k phi + (@RevisitingExtensionCertificate.gamma V E + inst inst_1 G k rounds e0 data + (@Fin.castSucc rounds idx) available) + (@RevisitingExtensionCertificate.delta V E + inst inst_1 G k rounds e0 data + (@Fin.castSucc rounds idx) available)) + (@Sum.inr V E + (@RevisitingExtensionCertificate.edge V E + inst inst_1 G k rounds e0 data + (@Fin.castSucc rounds idx) available)) + (@Sum.inl V E + (@RevisitingExtensionCertificate.returnVertex + V E inst inst_1 G k rounds e0 data + (@Fin.castSucc rounds idx) available))) + (@RevisitingExtensionCertificate.returnPath V E + inst inst_1 G k rounds e0 data + (@Fin.castSucc rounds idx) available) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 m + hm data) + (@Fin.castSucc m idx')) + (@Eq.symm (PartialEdgeColoring E k) + (@TashkinovSeriesData.coloring V E G k m e0 + (@TashkinovSeriesDataPrefix V E G k rounds e0 + m hm data) + (@Fin.castSucc m idx')) + (@TashkinovSeriesData.coloring V E G k rounds e0 + data (@Fin.castSucc rounds idx)) + hprev); + RevisitingExtensionCertificate + (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc := by + classical + intro V E _ _ G k rounds e0 data m hm idx available hidx idx' hprev htreeCurrent haBound + earlier' hkindEarlier hgammaEarlier hdeltaEarlier htreeEarlier cycle' returnPath' + exact { + earlier := earlier' + earlierPositive := by + simpa [earlier'] using available.earlierPositive + earlierAtMost := by + simpa [earlier', idx'] using available.earlierAtMost + earlierPE := by + simpa [hkindEarlier] using available.earlierPE + interveningRevisiting := by + intro j hjpos hjafter hjatMost + let j' : Fin (rounds + 1) := Fin.castLE (by omega) j + have hstep := available.interveningRevisiting j' + (by simpa [j'] using hjpos) + (by simpa [j', earlier'] using hjafter) + (by simpa [j', idx'] using hjatMost) + have hkindJ : (TashkinovSeriesDataPrefix m hm data).kind j = + data.kind j' := by rfl + simpa [hkindJ] using hstep + gamma := available.gamma + delta := available.delta + earlierGamma := by + simpa [hgammaEarlier] using available.earlierGamma + earlierDelta := by + simpa [hdeltaEarlier] using available.earlierDelta + cycle := cycle' + meetsEarlier := by + rcases available.meetsEarlier with ⟨v, hv, hc⟩ + refine ⟨v, ?_, ?_⟩ + · rwa [← htreeEarlier] at hv + · dsimp [cycle'] + cases hprev + exact hc + leavesCurrent := by + rcases available.leavesCurrent with ⟨v, hv, hc⟩ + refine ⟨v, ?_, ?_⟩ + · rwa [← htreeCurrent] at hv + · dsimp [cycle'] + cases hprev + exact hc + edge := available.edge + edgeOnCycle := by + dsimp [cycle'] + cases hprev + exact available.edgeOnCycle + edgeBoundary := by + simpa only [htreeCurrent] using available.edgeBoundary + insideEndpoint := available.insideEndpoint + outsideEndpoint := available.outsideEndpoint + insideInCurrent := by + simpa only [htreeCurrent] using available.insideInCurrent + outsideNotCurrent := by + simpa only [htreeCurrent] using available.outsideNotCurrent + edgeEnds := available.edgeEnds + returnVertex := available.returnVertex + returnInEarlier := by + simpa only [htreeEarlier] using available.returnInEarlier + returnPath := returnPath' + returnPathIsPath := by + dsimp [returnPath'] + cases hprev + exact available.returnPathIsPath + returnPathOnCycle := by + dsimp [returnPath', cycle'] + cases hprev + exact available.returnPathOnCycle + returnPathInternal := by + intro v hv + have hv' : Sum.inl v ∈ available.returnPath.support := by + dsimp [returnPath'] at hv + cases hprev + exact hv + simpa only [htreeCurrent] using available.returnPathInternal v hv' + } + +private abbrev helperPrefixCert1166Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) (m : ℕ) (hm : m ≤ rounds) (_ : Fin (m + (1 : + ℕ))) (idx : Fin rounds) (_ : IsProperEdgeColoring G (data.coloring idx.castSucc)) (_ : + IsOneEdgeUncolored (data.coloring idx.castSucc) e0) (_ : ColoredVertexSetClosed G + (data.coloring idx.castSucc) (TreeSequenceVertexSet (data.tree idx.succ.castSucc))) (_ : + ¬ColoredVertexSetStronglyClosed G (data.coloring idx.castSucc) (TreeSequenceVertexSet + (data.tree idx.succ.castSucc))) (choice : MaximumDefectiveChoice G e0 (data.tree + idx.succ.castSucc) (TashkinovStoredColors data idx.castSucc) (data.coloring idx.castSucc)) + (_ : + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (data.tree idx.succ.castSucc) (insert choice.color (TashkinovStoredColors + data idx.castSucc) : Finset (Fin k)) choice.selected rho ∧ ¬Disjoint (MissingColors G rho + choice.otherEndpoint) (TreeMissingColors rho (data.tree idx.succ.castSucc))) (gamma : Fin + k) (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G secondStable) (_ : + IsOneEdgeUncolored secondStable e0) (_ : StableColoring (data.tree idx.succ.castSucc) + (insert choice.color (TashkinovStoredColors data idx.castSucc) : Finset (Fin k)) + choice.selected secondStable) (_ : TreeExit (data.tree idx.succ.castSucc) secondStable + gamma choice.color choice.vertex) (_ : data.coloring idx.succ = TwoColorComponentSwap G + secondStable gamma choice.color (Sum.inl choice.vertex)) (_ : IsProperEdgeColoring G + (data.coloring idx.succ)) (_ : IsOneEdgeUncolored (data.coloring idx.succ) e0) (_ : + data.stored idx.succ = (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin + k))) (_ : data.connectingEdges idx.succ = ({ choice.edge } : Finset E)) (_ : data.kind + idx.succ = some TashkinovExtensionKind.PE) (_ : data.chosenVertex idx.succ = some + choice.vertex) (_ : data.outsideVertex idx.succ = some choice.otherEndpoint) (_ : + data.delta idx.succ = some choice.color) (_ : data.gamma idx.succ = some gamma) (_ : + TashkinovClosure (data.coloring idx.succ) (data.tree idx.succ.castSucc) (data.tree + idx.succ.succ)) (_ : TreeSequenceInitialSegment (data.tree idx.succ.castSucc) (data.tree + idx.succ.succ)) (_ : (data.tree idx.succ.castSucc).length < (data.tree + idx.succ.succ).length) (hidx : (↑idx : ℕ) < m), + let idx' : Fin m := (⟨(↑idx : ℕ), hidx⟩ : Fin m); + ∀ (hprev : (TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc = data.coloring + idx.castSucc) (htree : (TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc = + data.tree idx.succ.castSucc) (_ : (TashkinovSeriesDataPrefix m hm data).coloring idx'.succ + = data.coloring idx.succ) (_ : (TashkinovSeriesDataPrefix m hm data).stored idx'.succ = + data.stored idx.succ) (_ : (TashkinovSeriesDataPrefix m hm data).connectingEdges idx'.succ + = data.connectingEdges idx.succ) (_ : (TashkinovSeriesDataPrefix m hm data).kind idx'.succ + = data.kind idx.succ) (_ : (TashkinovSeriesDataPrefix m hm data).chosenVertex idx'.succ = + data.chosenVertex idx.succ) (_ : (TashkinovSeriesDataPrefix m hm data).outsideVertex + idx'.succ = data.outsideVertex idx.succ) (_ : (TashkinovSeriesDataPrefix m hm data).delta + idx'.succ = data.delta idx.succ) (_ : (TashkinovSeriesDataPrefix m hm data).gamma + idx'.succ = data.gamma idx.succ) (_ : (TashkinovSeriesDataPrefix m hm data).tree + idx'.succ.succ = data.tree idx.succ.succ) (hstored : TashkinovStoredColors + (TashkinovSeriesDataPrefix m hm data) idx'.castSucc = TashkinovStoredColors data + idx.castSucc), + let choice' : MaximumDefectiveChoice G e0 ((TashkinovSeriesDataPrefix m hm data).tree + idx'.succ.castSucc) (TashkinovStoredColors (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc) ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) := { + selected := choice.selected, selectedProper := choice.selectedProper, selectedOneUncolored + := choice.selectedOneUncolored, selectedStable := ((Eq.symm (id (congrArg (fun (_a : + TreeSequence G e0) ↦ StableColoring _a (TashkinovStoredColors (TashkinovSeriesDataPrefix m + hm data) idx'.castSucc) ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + choice.selected) htree))) ▸ ((Eq.symm (id (congrArg (fun (_a : Finset (Fin k)) ↦ + StableColoring (data.tree idx.succ.castSucc) _a ((TashkinovSeriesDataPrefix m hm + data).coloring idx'.castSucc) choice.selected) hstored))) ▸ ((Eq.symm (id (congrArg (fun + (_a : PartialEdgeColoring E k) ↦ StableColoring (data.tree idx.succ.castSucc) + (TashkinovStoredColors data idx.castSucc) _a choice.selected) hprev))) ▸ + choice.selectedStable))), vertex := choice.vertex, vertexDefective := ((Eq.symm (id + (congrArg (fun (_a : TreeSequence G e0) ↦ DefectiveVertex G choice.selected + (TreeSequenceVertexSet _a) choice.vertex) htree))) ▸ choice.vertexDefective), maximal := + ((Eq.symm (id (congrArg (fun (_a : TreeSequence G e0) ↦ + ∀ (pi : PartialEdgeColoring E k) (w : V), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 + → StableColoring _a (TashkinovStoredColors (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc) ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) pi → + DefectiveVertex G pi (TreeSequenceVertexSet _a) w → w = choice.vertex ∨ TreeVertexOrder _a + w choice.vertex) htree))) ▸ ((Eq.symm (id (congrArg (fun (_a : Finset (Fin k)) ↦ + ∀ (pi : PartialEdgeColoring E k) (w : V), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 + → StableColoring (data.tree idx.succ.castSucc) _a ((TashkinovSeriesDataPrefix m hm + data).coloring idx'.castSucc) pi → DefectiveVertex G pi (TreeSequenceVertexSet (data.tree + idx.succ.castSucc)) w → w = choice.vertex ∨ TreeVertexOrder (data.tree idx.succ.castSucc) + w choice.vertex) hstored))) ▸ ((Eq.symm (id (congrArg (fun (_a : PartialEdgeColoring E k) + ↦ + ∀ (pi : PartialEdgeColoring E k) (w : V), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 + → StableColoring (data.tree idx.succ.castSucc) (TashkinovStoredColors data idx.castSucc) + _a pi → DefectiveVertex G pi (TreeSequenceVertexSet (data.tree idx.succ.castSucc)) w → w = + choice.vertex ∨ TreeVertexOrder (data.tree idx.succ.castSucc) w choice.vertex) hprev))) ▸ + choice.maximal))), edge := choice.edge, edgeDefective := ((Eq.symm (id (congrArg (fun (_a + : TreeSequence G e0) ↦ DefectiveEdge G choice.selected (TreeSequenceVertexSet _a) + choice.edge) htree))) ▸ choice.edgeDefective), edgeIncident := choice.edgeIncident, + otherEndpoint := choice.otherEndpoint, otherOutside := ((Eq.symm (id (congrArg (fun (_a : + TreeSequence G e0) ↦ choice.otherEndpoint ∉ TreeSequenceVertexSet _a) htree))) ▸ + choice.otherOutside), edgeEnds := choice.edgeEnds, color := choice.color, edgeColor := + choice.edgeColor : MaximumDefectiveChoice G e0 ((TashkinovSeriesDataPrefix m hm data).tree + idx'.succ.castSucc) (TashkinovStoredColors (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc) ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) }; + ∀ (_ : ¬Nonempty (RevisitingExtensionCertificate (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc)) (_ : ParallelExtensionColor (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc choice'.selected choice'.vertex gamma), TashkinovSeriesStep G k m e0 input + (TashkinovSeriesDataPrefix m hm data) idx'.succ + +private theorem helper_noRevisiting_120.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] {G : LooplessMultigraph V E} + {k rounds : ℕ} {e0 : E} (data : TashkinovSeriesData G k rounds e0) (m : ℕ) (hm : m ≤ + rounds) (idx : Fin rounds), ¬Nonempty (RevisitingExtensionCertificate data idx.castSucc) → + ∀ (_ : MaximumDefectiveChoice G e0 (data.tree idx.succ.castSucc) (TashkinovStoredColors data + idx.castSucc) (data.coloring idx.castSucc)), (↑idx : ℕ) + (1 : ℕ) ≤ m → + ∀ (hidx : (↑idx : ℕ) < m), + let idx' : Fin m := (⟨(↑idx : ℕ), hidx⟩ : Fin m); (TashkinovSeriesDataPrefix m hm + data).coloring idx'.castSucc = data.coloring idx.castSucc → (TashkinovSeriesDataPrefix m + hm data).tree idx'.succ.castSucc = data.tree idx.succ.castSucc → + (TashkinovSeriesDataPrefix m hm data).tree idx'.castSucc.succ = data.tree + idx.castSucc.succ → TashkinovStoredColors (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc = TashkinovStoredColors data idx.castSucc → ¬Nonempty + (RevisitingExtensionCertificate (TashkinovSeriesDataPrefix m hm data) idx'.castSucc) := by + classical + intro V E _ _ G k rounds e0 data m hm idx noRevisiting choice hidxSucc hidx idx' hprev htree + htreeCurrent hstored + rintro ⟨r⟩ + apply noRevisiting + let earlier' : Fin (rounds + 1) := Fin.castLE (by omega) r.earlier + have hkindEarlier : (TashkinovSeriesDataPrefix m hm data).kind + r.earlier = data.kind earlier' := by rfl + have hgammaEarlier : (TashkinovSeriesDataPrefix m hm data).gamma + r.earlier = data.gamma earlier' := by rfl + have hdeltaEarlier : (TashkinovSeriesDataPrefix m hm data).delta + r.earlier = data.delta earlier' := by rfl + have htreeEarlier : (TashkinovSeriesDataPrefix m hm data).tree + r.earlier.castSucc = data.tree earlier'.castSucc := by rfl + let cycle' : TwoColorCycle G (data.coloring idx.castSucc) + r.gamma r.delta := { + base := r.cycle.base + walk := @Eq.ndrec (PartialEdgeColoring E k) + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + (fun phi => (TwoColorIncidenceGraph G phi r.gamma r.delta).Walk + r.cycle.base r.cycle.base) + r.cycle.walk (data.coloring idx.castSucc) hprev + isCycle := by + dsimp + cases hprev + exact r.cycle.isCycle + } + let returnPath' : (TwoColorIncidenceGraph G (data.coloring idx.castSucc) + r.gamma r.delta).Walk (Sum.inr r.edge) (Sum.inl r.returnVertex) := + @Eq.ndrec (PartialEdgeColoring E k) + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + (fun phi => (TwoColorIncidenceGraph G phi r.gamma r.delta).Walk + (Sum.inr r.edge) (Sum.inl r.returnVertex)) + r.returnPath (data.coloring idx.castSucc) hprev + refine ⟨{ + earlier := earlier' + earlierPositive := by simpa [earlier'] using r.earlierPositive + earlierAtMost := by simpa [earlier', idx'] using r.earlierAtMost + earlierPE := by + simpa [hkindEarlier] using r.earlierPE + interveningRevisiting := ?_ + gamma := r.gamma + delta := r.delta + earlierGamma := by + simpa [hgammaEarlier] using r.earlierGamma + earlierDelta := by + simpa [hdeltaEarlier] using r.earlierDelta + cycle := cycle' + meetsEarlier := by + rcases r.meetsEarlier with ⟨v, hv, hc⟩ + refine ⟨v, ?_, ?_⟩ + · rwa [htreeEarlier] at hv + · dsimp [cycle'] + cases hprev + exact hc + leavesCurrent := by + rcases r.leavesCurrent with ⟨v, hv, hc⟩ + refine ⟨v, ?_, ?_⟩ + · rwa [htreeCurrent] at hv + · dsimp [cycle'] + cases hprev + exact hc + edge := r.edge + edgeOnCycle := by + dsimp [cycle'] + cases hprev + exact r.edgeOnCycle + edgeBoundary := by + simpa only [htreeCurrent] using r.edgeBoundary + insideEndpoint := r.insideEndpoint + outsideEndpoint := r.outsideEndpoint + insideInCurrent := by + simpa only [htreeCurrent] using r.insideInCurrent + outsideNotCurrent := by + simpa only [htreeCurrent] using r.outsideNotCurrent + edgeEnds := r.edgeEnds + returnVertex := r.returnVertex + returnInEarlier := by + simpa [htreeEarlier] using r.returnInEarlier + returnPath := returnPath' + returnPathIsPath := by + dsimp [returnPath'] + cases hprev + exact r.returnPathIsPath + returnPathOnCycle := by + dsimp [returnPath', cycle'] + cases hprev + exact r.returnPathOnCycle + returnPathInternal := by + intro v hv + have hv' : Sum.inl v ∈ r.returnPath.support := by + dsimp [returnPath'] at hv + cases hprev + exact hv + simpa only [htreeCurrent] using r.returnPathInternal v hv' + }⟩ + intro j hjpos hjafter hjatMost + have hjle : j.val ≤ idx.val := by + simpa [idx'] using hjatMost + have hjm : j.val < m + 1 := by omega + let j' : Fin (m + 1) := ⟨j.val, hjm⟩ + have hstep := r.interveningRevisiting j' (by simpa [j'] using hjpos) + (by simpa [j', earlier'] using hjafter) + (by simpa [j', idx'] using hjatMost) + have hkindJ : (TashkinovSeriesDataPrefix m hm data).kind j' = + data.kind j := by rfl + simpa [hkindJ] using hstep + +private theorem helper_noRevisiting_362.{u_1, u_2} : + helperNoRevisiting362Conditions.{u_1, u_2} := by + classical + intro V E _ _ G k rounds e0 data m hm idx noRevisiting choice gamma hidxSucc hidx idx' hprev + htree htreeCurrent hstored + rintro ⟨r⟩ + apply noRevisiting + let earlier' : Fin (rounds + 1) := Fin.castLE (by omega) r.earlier + have hkindEarlier : (TashkinovSeriesDataPrefix m hm data).kind + r.earlier = data.kind earlier' := by rfl + have hgammaEarlier : (TashkinovSeriesDataPrefix m hm data).gamma + r.earlier = data.gamma earlier' := by rfl + have hdeltaEarlier : (TashkinovSeriesDataPrefix m hm data).delta + r.earlier = data.delta earlier' := by rfl + have htreeEarlier : (TashkinovSeriesDataPrefix m hm data).tree + r.earlier.castSucc = data.tree earlier'.castSucc := by rfl + let cycle' : TwoColorCycle G (data.coloring idx.castSucc) + r.gamma r.delta := { + base := r.cycle.base + walk := @Eq.ndrec (PartialEdgeColoring E k) + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + (fun phi => (TwoColorIncidenceGraph G phi r.gamma r.delta).Walk + r.cycle.base r.cycle.base) + r.cycle.walk (data.coloring idx.castSucc) hprev + isCycle := by + dsimp + cases hprev + exact r.cycle.isCycle + } + let returnPath' : (TwoColorIncidenceGraph G (data.coloring idx.castSucc) + r.gamma r.delta).Walk (Sum.inr r.edge) (Sum.inl r.returnVertex) := + @Eq.ndrec (PartialEdgeColoring E k) + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + (fun phi => (TwoColorIncidenceGraph G phi r.gamma r.delta).Walk + (Sum.inr r.edge) (Sum.inl r.returnVertex)) + r.returnPath (data.coloring idx.castSucc) hprev + refine ⟨{ + earlier := earlier' + earlierPositive := by simpa [earlier'] using r.earlierPositive + earlierAtMost := by simpa [earlier', idx'] using r.earlierAtMost + earlierPE := by simpa [hkindEarlier] using r.earlierPE + interveningRevisiting := ?_ + gamma := r.gamma + delta := r.delta + earlierGamma := by simpa [hgammaEarlier] using r.earlierGamma + earlierDelta := by simpa [hdeltaEarlier] using r.earlierDelta + cycle := cycle' + meetsEarlier := by + rcases r.meetsEarlier with ⟨v, hv, hc⟩ + refine ⟨v, ?_, ?_⟩ + · rwa [htreeEarlier] at hv + · dsimp [cycle'] + cases hprev + exact hc + leavesCurrent := by + rcases r.leavesCurrent with ⟨v, hv, hc⟩ + refine ⟨v, ?_, ?_⟩ + · rwa [htreeCurrent] at hv + · dsimp [cycle'] + cases hprev + exact hc + edge := r.edge + edgeOnCycle := by + dsimp [cycle'] + cases hprev + exact r.edgeOnCycle + edgeBoundary := by + simpa only [htreeCurrent] using r.edgeBoundary + insideEndpoint := r.insideEndpoint + outsideEndpoint := r.outsideEndpoint + insideInCurrent := by + simpa only [htreeCurrent] using r.insideInCurrent + outsideNotCurrent := by + simpa only [htreeCurrent] using r.outsideNotCurrent + edgeEnds := r.edgeEnds + returnVertex := r.returnVertex + returnInEarlier := by + simpa [htreeEarlier] using r.returnInEarlier + returnPath := returnPath' + returnPathIsPath := by + dsimp [returnPath'] + cases hprev + exact r.returnPathIsPath + returnPathOnCycle := by + dsimp [returnPath', cycle'] + cases hprev + exact r.returnPathOnCycle + returnPathInternal := by + intro v hv + have hv' : Sum.inl v ∈ r.returnPath.support := by + dsimp [returnPath'] at hv + cases hprev + exact hv + simpa only [htreeCurrent] using r.returnPathInternal v hv' + }⟩ + intro j hjpos hjafter hjatMost + have hjle : j.val ≤ idx.val := by simpa [idx'] using hjatMost + have hjm : j.val < m + 1 := by omega + let j' : Fin (m + 1) := ⟨j.val, hjm⟩ + have hstep := r.interveningRevisiting j' (by simpa [j'] using hjpos) + (by simpa [j', earlier'] using hjafter) + (by simpa [j', idx'] using hjatMost) + have hkindJ : (TashkinovSeriesDataPrefix m hm data).kind j' = + data.kind j := by rfl + simpa [hkindJ] using hstep + +private theorem helper_branch_286.{u_1, u_2} : + helperBranch286Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k rounds e0 input data m hm triple seedLength initialColoring initialStored + initialEdges initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure hj + refine ⟨TashkinovSeriesStep.initial triple ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_, + proof_irrel_heq _ _⟩ + · simpa [TashkinovSeriesDataPrefix] using seedLength + · simpa [TashkinovSeriesDataPrefix] using initialColoring + · simpa [TashkinovSeriesDataPrefix] using initialStored + · simpa [TashkinovSeriesDataPrefix] using initialEdges + · simpa [TashkinovSeriesDataPrefix] using initialKind + · simpa [TashkinovSeriesDataPrefix] using initialVertex + · simpa [TashkinovSeriesDataPrefix] using initialOutside + · simpa [TashkinovSeriesDataPrefix] using initialDelta + · simpa [TashkinovSeriesDataPrefix] using initialGamma + · simpa only [TashkinovSeriesDataPrefix, Fin.castLE_zero] + +private theorem helper_prefixCert_1176.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) (m : ℕ) (hm : m ≤ rounds) (_ : Fin (m + (1 : + ℕ))) (idx : Fin rounds), IsProperEdgeColoring G (data.coloring idx.castSucc) → + IsOneEdgeUncolored (data.coloring idx.castSucc) e0 → ColoredVertexSetClosed G + (data.coloring idx.castSucc) (TreeSequenceVertexSet (data.tree idx.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G (data.coloring idx.castSucc) (TreeSequenceVertexSet + (data.tree idx.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate data idx.castSucc), data.coloring idx.succ = + data.coloring idx.castSucc → data.stored idx.succ = (insert available.delta + ({ available.gamma } : Finset (Fin k)) : Finset (Fin k)) → data.connectingEdges idx.succ = + ({ available.edge } : Finset E) → data.kind idx.succ = some TashkinovExtensionKind.RE → + data.chosenVertex idx.succ = some available.insideEndpoint → data.outsideVertex idx.succ = + some available.outsideEndpoint → data.delta idx.succ = some available.delta → data.gamma + idx.succ = some available.gamma → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (data.tree idx.succ.castSucc) + available.edge adjoined → TashkinovClosure (data.coloring idx.succ) adjoined (data.tree + idx.succ.succ) → TreeSequenceInitialSegment (data.tree idx.succ.castSucc) (data.tree + idx.succ.succ) → (data.tree idx.succ.castSucc).length < (data.tree idx.succ.succ).length → + ∀ (hidx : (↑idx : ℕ) < m), + let idx' : Fin m := (⟨(↑idx : ℕ), hidx⟩ : Fin m); + ∀ (hprev : (TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc = data.coloring + idx.castSucc), (TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc = data.tree + idx.succ.castSucc → + ∀ (htreeCurrent : (TashkinovSeriesDataPrefix m hm data).tree idx'.castSucc.succ = data.tree + idx.castSucc.succ), (TashkinovSeriesDataPrefix m hm data).coloring idx'.succ = + data.coloring idx.succ → (TashkinovSeriesDataPrefix m hm data).stored idx'.succ = + data.stored idx.succ → (TashkinovSeriesDataPrefix m hm data).connectingEdges idx'.succ = + data.connectingEdges idx.succ → (TashkinovSeriesDataPrefix m hm data).kind idx'.succ = + data.kind idx.succ → (TashkinovSeriesDataPrefix m hm data).chosenVertex idx'.succ = + data.chosenVertex idx.succ → (TashkinovSeriesDataPrefix m hm data).outsideVertex idx'.succ + = data.outsideVertex idx.succ → (TashkinovSeriesDataPrefix m hm data).delta idx'.succ = + data.delta idx.succ → (TashkinovSeriesDataPrefix m hm data).gamma idx'.succ = data.gamma + idx.succ → (TashkinovSeriesDataPrefix m hm data).tree idx'.succ.succ = data.tree + idx.succ.succ → + ∀ (haBound : (↑available.earlier : ℕ) < m + (1 : ℕ)), + let earlier' : Fin (m + (1 : ℕ)) := (⟨(↑available.earlier : ℕ), haBound⟩ : Fin (m + (1 : ℕ))); + ∀ (hkindEarlier : (TashkinovSeriesDataPrefix m hm data).kind earlier' = data.kind + available.earlier) (hgammaEarlier : (TashkinovSeriesDataPrefix m hm data).gamma earlier' = + data.gamma available.earlier) (hdeltaEarlier : (TashkinovSeriesDataPrefix m hm data).delta + earlier' = data.delta available.earlier) (htreeEarlier : (TashkinovSeriesDataPrefix m hm + data).tree earlier'.castSucc = data.tree available.earlier.castSucc), + let _ : RevisitingExtensionCertificate (TashkinovSeriesDataPrefix m hm data) idx'.castSucc := + helperAvailable754 data m hm idx available hidx hprev htreeCurrent haBound hkindEarlier + hgammaEarlier hdeltaEarlier htreeEarlier; TashkinovSeriesStep G k m e0 input + (TashkinovSeriesDataPrefix m hm data) idx'.succ := by + classical + intro V E _ _ _ G k rounds e0 input data m hm i idx previousProper previousOneUncolored + previousClosed previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension hidx idx' hprev htree + htreeCurrent hcur hcurStored hcurEdges hcurKind hcurVertex hcurOutside hcurDelta hcurGamma + hnext haBound earlier' hkindEarlier hgammaEarlier hdeltaEarlier htreeEarlier available' + apply TashkinovSeriesStep.RE (input := input) (i := idx') (available := available') + (adjoined := adjoined) + · rw [hprev] + exact previousProper + · rw [hprev] + exact previousOneUncolored + · rw [hprev, htree] + exact previousClosed + · rw [hprev, htree] + exact previousNotStronglyClosed + · rw [hcur, hprev] + exact currentColoring + · change (TashkinovSeriesDataPrefix m hm data).stored idx'.succ = + {available.delta, available.gamma} + rw [hcurStored] + exact currentStored + · change (TashkinovSeriesDataPrefix m hm data).connectingEdges + idx'.succ = {available.edge} + rw [hcurEdges] + exact currentEdges + · rw [hcurKind] + exact currentKind + · change (TashkinovSeriesDataPrefix m hm data).chosenVertex + idx'.succ = some available.insideEndpoint + rw [hcurVertex] + exact currentVertex + · change (TashkinovSeriesDataPrefix m hm data).outsideVertex + idx'.succ = some available.outsideEndpoint + rw [hcurOutside] + exact currentOutside + · change (TashkinovSeriesDataPrefix m hm data).delta idx'.succ = + some available.delta + rw [hcurDelta] + exact currentDelta + · change (TashkinovSeriesDataPrefix m hm data).gamma idx'.succ = + some available.gamma + rw [hcurGamma] + exact currentGamma + · change TreeSequenceAdjoinEdge + ((TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc) + available.edge adjoined + rw [htree] + exact adjoinedExactly + · rw [hcur, hnext] + exact closedExtension + · rw [htree, hnext] + exact orderedExtension + · rw [htree, hnext] + exact strictExtension + +private theorem helper_prefixCert_1166.{u_1, u_2} : + helperPrefixCert1166Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k rounds e0 input data m hm i idx previousProper previousOneUncolored + previousClosed previousNotStronglyClosed choice seriesAlternativeFails gamma secondStable + secondStableProper secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension hidx idx' hprev htree hcur hcurStored hcurEdges hcurKind hcurVertex + hcurOutside hcurDelta hcurGamma hnext hstored choice' noRevisiting' gammaRule' + apply TashkinovSeriesStep.PE (input := input) (i := idx') (choice := choice') + (gamma := gamma) (secondStable := secondStable) + · rw [hprev] + exact previousProper + · rw [hprev] + exact previousOneUncolored + · rw [hprev, htree] + exact previousClosed + · rw [hprev, htree] + exact previousNotStronglyClosed + · exact noRevisiting' + · rcases seriesAlternativeFails with ⟨rho, hp, ho, hs, hd⟩ + refine ⟨rho, hp, ho, ?_, ?_⟩ + · change StableColoring + ((TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc) + (insert choice.color (TashkinovStoredColors + (TashkinovSeriesDataPrefix m hm data) idx'.castSucc)) + choice.selected rho + rw [htree, hstored] + exact hs + · change ¬ Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho + ((TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc)) + rw [htree] + exact hd + · exact gammaRule' + · exact secondStableProper + · exact secondStableOneUncolored + · change StableColoring + ((TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc) + (insert choice.color (TashkinovStoredColors + (TashkinovSeriesDataPrefix m hm data) idx'.castSucc)) + choice.selected secondStable + rw [htree, hstored] + exact secondStableRelation + · change TreeExit + ((TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc) + secondStable gamma choice.color choice.vertex + rw [htree] + exact exitWitness + · change (TashkinovSeriesDataPrefix m hm data).coloring idx'.succ = + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) + rw [hcur] + exact currentColoring + · rw [hcur] + exact currentProper + · rw [hcur] + exact currentOneUncolored + · change (TashkinovSeriesDataPrefix m hm data).stored idx'.succ = + {choice.color, gamma} + rw [hcurStored] + exact currentStored + · change (TashkinovSeriesDataPrefix m hm data).connectingEdges + idx'.succ = {choice.edge} + rw [hcurEdges] + exact currentEdges + · rw [hcurKind] + exact currentKind + · change (TashkinovSeriesDataPrefix m hm data).chosenVertex + idx'.succ = some choice.vertex + rw [hcurVertex] + exact currentVertex + · change (TashkinovSeriesDataPrefix m hm data).outsideVertex + idx'.succ = some choice.otherEndpoint + rw [hcurOutside] + exact currentOutside + · change (TashkinovSeriesDataPrefix m hm data).delta idx'.succ = + some choice.color + rw [hcurDelta] + exact currentDelta + · rw [hcurGamma] + exact currentGamma + · rw [hcur, htree, hnext] + exact closedExtension + · rw [htree, hnext] + exact orderedExtension + · rw [htree, hnext] + exact strictExtension + +private theorem helper_branch_1369.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) (m : ℕ) (hm : m ≤ rounds) (_ : Fin (m + (1 : + ℕ))) (idx : Fin rounds) (previousProper : IsProperEdgeColoring G (data.coloring + idx.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (data.coloring idx.castSucc) e0) + (previousClosed : ColoredVertexSetClosed G (data.coloring idx.castSucc) + (TreeSequenceVertexSet (data.tree idx.succ.castSucc))) (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (data.coloring idx.castSucc) (TreeSequenceVertexSet + (data.tree idx.succ.castSucc))) (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate + data idx.castSucc)) (choice : MaximumDefectiveChoice G e0 (data.tree idx.succ.castSucc) + (TashkinovStoredColors data idx.castSucc) (data.coloring idx.castSucc)) + (seriesAlternativeFails : + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (data.tree idx.succ.castSucc) (insert choice.color (TashkinovStoredColors + data idx.castSucc) : Finset (Fin k)) choice.selected rho ∧ ¬Disjoint (MissingColors G rho + choice.otherEndpoint) (TreeMissingColors rho (data.tree idx.succ.castSucc))) (gamma : Fin + k) (gammaRule : ParallelExtensionColor data idx.castSucc choice.selected choice.vertex + gamma) (secondStable : PartialEdgeColoring E k) (secondStableProper : IsProperEdgeColoring + G secondStable) (secondStableOneUncolored : IsOneEdgeUncolored secondStable e0) + (secondStableRelation : StableColoring (data.tree idx.succ.castSucc) (insert choice.color + (TashkinovStoredColors data idx.castSucc) : Finset (Fin k)) choice.selected secondStable) + (exitWitness : TreeExit (data.tree idx.succ.castSucc) secondStable gamma choice.color + choice.vertex) (currentColoring : data.coloring idx.succ = TwoColorComponentSwap G + secondStable gamma choice.color (Sum.inl choice.vertex)) (currentProper : + IsProperEdgeColoring G (data.coloring idx.succ)) (currentOneUncolored : IsOneEdgeUncolored + (data.coloring idx.succ) e0) (currentStored : data.stored idx.succ = (insert choice.color + ({ gamma } : Finset (Fin k)) : Finset (Fin k))) (currentEdges : data.connectingEdges + idx.succ = ({ choice.edge } : Finset E)) (currentKind : data.kind idx.succ = some + TashkinovExtensionKind.PE) (currentVertex : data.chosenVertex idx.succ = some + choice.vertex) (currentOutside : data.outsideVertex idx.succ = some choice.otherEndpoint) + (currentDelta : data.delta idx.succ = some choice.color) (currentGamma : data.gamma + idx.succ = some gamma) (closedExtension : TashkinovClosure (data.coloring idx.succ) + (data.tree idx.succ.castSucc) (data.tree idx.succ.succ)) (orderedExtension : + TreeSequenceInitialSegment (data.tree idx.succ.castSucc) (data.tree idx.succ.succ)) + (strictExtension : (data.tree idx.succ.castSucc).length < (data.tree + idx.succ.succ).length) (hj : (↑idx.succ : ℕ) ≤ m), + ∃ (prefixCert : TashkinovSeriesStep G k m e0 input (TashkinovSeriesDataPrefix m hm data) + (⟨(↑idx.succ : ℕ), + by + omega + ⟩ : Fin (m + (1 : ℕ)))), prefixCert ≍ TashkinovSeriesStep.PE (input := input) idx + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternativeFails gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension strictExtension := by + classical + intro V E _ _ _ G k rounds e0 input data m hm i idx previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma + gammaRule secondStable secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension hj + have hidxSucc : idx.val + 1 ≤ m := by simpa using hj + have hidx : idx.val < m := by omega + let idx' : Fin m := ⟨idx.val, hidx⟩ + have hprev : (TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc = + data.coloring idx.castSucc := by rfl + have htree : (TashkinovSeriesDataPrefix m hm data).tree + idx'.succ.castSucc = data.tree idx.succ.castSucc := by rfl + have htreeCurrent : (TashkinovSeriesDataPrefix m hm data).tree + idx'.castSucc.succ = data.tree idx.castSucc.succ := by rfl + have hcur : (TashkinovSeriesDataPrefix m hm data).coloring idx'.succ = + data.coloring idx.succ := by rfl + have hcurStored : (TashkinovSeriesDataPrefix m hm data).stored idx'.succ = + data.stored idx.succ := by rfl + have hcurEdges : (TashkinovSeriesDataPrefix m hm data).connectingEdges + idx'.succ = data.connectingEdges idx.succ := by rfl + have hcurKind : (TashkinovSeriesDataPrefix m hm data).kind idx'.succ = + data.kind idx.succ := by rfl + have hcurVertex : (TashkinovSeriesDataPrefix m hm data).chosenVertex + idx'.succ = data.chosenVertex idx.succ := by rfl + have hcurOutside : (TashkinovSeriesDataPrefix m hm data).outsideVertex + idx'.succ = data.outsideVertex idx.succ := by rfl + have hcurDelta : (TashkinovSeriesDataPrefix m hm data).delta idx'.succ = + data.delta idx.succ := by rfl + have hcurGamma : (TashkinovSeriesDataPrefix m hm data).gamma idx'.succ = + data.gamma idx.succ := by rfl + have hnext : (TashkinovSeriesDataPrefix m hm data).tree idx'.succ.succ = + data.tree idx.succ.succ := by rfl + have hstored : TashkinovStoredColors + (TashkinovSeriesDataPrefix m hm data) idx'.castSucc = + TashkinovStoredColors data idx.castSucc := by + exact TashkinovStoredColorsPrefix m hm data idx'.castSucc + let choice' : MaximumDefectiveChoice G e0 + ((TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc) + (TashkinovStoredColors (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc) + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) := by + exact { + selected := choice.selected + selectedProper := choice.selectedProper + selectedOneUncolored := choice.selectedOneUncolored + selectedStable := by + rw [htree, hstored, hprev] + exact choice.selectedStable + vertex := choice.vertex + vertexDefective := by + rw [htree] + exact choice.vertexDefective + maximal := by + rw [htree, hstored, hprev] + exact choice.maximal + edge := choice.edge + edgeDefective := by + rw [htree] + exact choice.edgeDefective + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := by + rw [htree] + exact choice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := choice.edgeColor + } + have noRevisiting' : ¬ Nonempty (RevisitingExtensionCertificate + (TashkinovSeriesDataPrefix m hm data) idx'.castSucc) := by + apply helper_noRevisiting_362 <;> assumption + have gammaRule' : ParallelExtensionColor + (TashkinovSeriesDataPrefix m hm data) idx'.castSucc + choice'.selected choice'.vertex gamma := by + change ParallelExtensionColor (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc choice.selected choice.vertex gamma + unfold ParallelExtensionColor at gammaRule ⊢ + refine ⟨gammaRule.1, ?_⟩ + rcases gammaRule.2 with existing | fresh + · left + rcases existing with + ⟨h, hpos, hatMost, hkind, hvertex, hdelta, hlatest⟩ + have hle : h.val ≤ idx.val := by simpa using hatMost + have hhm : h.val < m + 1 := by omega + let h' : Fin (m + 1) := ⟨h.val, hhm⟩ + refine ⟨h', by simpa [h'] using hpos, by simpa [h', idx'] using hatMost, + ?_, ?_, ?_, ?_⟩ + · simpa [h', TashkinovSeriesDataPrefix] using hkind + · simpa [h', TashkinovSeriesDataPrefix] using hvertex + · simpa [h', TashkinovSeriesDataPrefix] using hdelta + · intro j jpos jatMost jkind jvertex + let j' : Fin (rounds + 1) := Fin.castLE (by omega) j + have latest := hlatest j' (by simpa [j'] using jpos) + (by simpa [j', idx'] using jatMost) + (by simpa [j', TashkinovSeriesDataPrefix] using jkind) + (by simpa [j', TashkinovSeriesDataPrefix] using jvertex) + simpa [j', h'] using latest + · right + intro h hpos hatMost hkind hvertex + let h' : Fin (rounds + 1) := Fin.castLE (by omega) h + apply fresh h' (by simpa [h'] using hpos) + (by simpa [h', idx'] using hatMost) + · simpa [h', TashkinovSeriesDataPrefix] using hkind + · simpa [h', TashkinovSeriesDataPrefix] using hvertex + have prefixCert := @helper_prefixCert_1166 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@rounds) (@e0) (@input) (@data) (@m) (@hm) (@i) (@idx) (@previousProper) + (@previousOneUncolored) (@previousClosed) (@previousNotStronglyClosed) (@choice) + (@seriesAlternativeFails) (@gamma) (@secondStable) (@secondStableProper) + (@secondStableOneUncolored) (@secondStableRelation) (@exitWitness) (@currentColoring) + (@currentProper) (@currentOneUncolored) (@currentStored) (@currentEdges) (@currentKind) + (@currentVertex) (@currentOutside) (@currentDelta) (@currentGamma) (@closedExtension) + (@orderedExtension) (@strictExtension) (@hidx) (@hprev) (@htree) (@hcur) (@hcurStored) + (@hcurEdges) (@hcurKind) (@hcurVertex) (@hcurOutside) (@hcurDelta) (@hcurGamma) (@hnext) + (@hstored) (@noRevisiting') (@gammaRule') + have hresult : idx'.succ = + (⟨idx.succ.val, by omega⟩ : Fin (m + 1)) := by + apply Fin.ext + rfl + rw [← hresult] + exact ⟨prefixCert, proof_irrel_heq _ _⟩ + +private theorem helper_branch_1414.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) (m : ℕ) (hm : m ≤ rounds) (_ : Fin (m + (1 : + ℕ))) (idx : Fin rounds) (previousProper : IsProperEdgeColoring G (data.coloring + idx.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (data.coloring idx.castSucc) e0) + (previousClosed : ColoredVertexSetClosed G (data.coloring idx.castSucc) + (TreeSequenceVertexSet (data.tree idx.succ.castSucc))) (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (data.coloring idx.castSucc) (TreeSequenceVertexSet + (data.tree idx.succ.castSucc))) (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate + data idx.castSucc)) (choice : MaximumDefectiveChoice G e0 (data.tree idx.succ.castSucc) + (TashkinovStoredColors data idx.castSucc) (data.coloring idx.castSucc)) (seriesAlternative + : + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (data.tree idx.succ.castSucc) (insert choice.color (TashkinovStoredColors + data idx.castSucc) : Finset (Fin k)) choice.selected pi → Disjoint (MissingColors G pi + choice.otherEndpoint) (TreeMissingColors pi (data.tree idx.succ.castSucc))) + (currentColoring : data.coloring idx.succ = choice.selected) (currentStored : data.stored + idx.succ = ({ choice.color } : Finset (Fin k))) (currentEdges : data.connectingEdges + idx.succ = ({ choice.edge } : Finset E)) (currentKind : data.kind idx.succ = some + TashkinovExtensionKind.SE) (currentVertex : data.chosenVertex idx.succ = some + choice.vertex) (currentOutside : data.outsideVertex idx.succ = some choice.otherEndpoint) + (currentDelta : data.delta idx.succ = some choice.color) (currentGamma : data.gamma + idx.succ = none) (adjoined : TreeSequence G e0) (adjoinedExactly : TreeSequenceAdjoinEdge + (data.tree idx.succ.castSucc) choice.edge adjoined) (closedExtension : TashkinovClosure + (data.coloring idx.succ) adjoined (data.tree idx.succ.succ)) (orderedExtension : + TreeSequenceInitialSegment (data.tree idx.succ.castSucc) (data.tree idx.succ.succ)) + (strictExtension : (data.tree idx.succ.castSucc).length < (data.tree + idx.succ.succ).length) (hj : (↑idx.succ : ℕ) ≤ m), + ∃ (prefixCert : TashkinovSeriesStep G k m e0 input (TashkinovSeriesDataPrefix m hm data) + (⟨(↑idx.succ : ℕ), + by + omega + ⟩ : Fin (m + (1 : ℕ)))), prefixCert ≍ TashkinovSeriesStep.SE (input := input) idx + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternative currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension := by + classical + intro V E _ _ _ G k rounds e0 input data m hm i idx previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension hj + have hidxSucc : idx.val + 1 ≤ m := by simpa using hj + have hidx : idx.val < m := by omega + let idx' : Fin m := ⟨idx.val, hidx⟩ + have hprev : (TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc = + data.coloring idx.castSucc := by rfl + have htree : (TashkinovSeriesDataPrefix m hm data).tree + idx'.succ.castSucc = data.tree idx.succ.castSucc := by rfl + have htreeCurrent : (TashkinovSeriesDataPrefix m hm data).tree + idx'.castSucc.succ = data.tree idx.castSucc.succ := by rfl + have hcur : (TashkinovSeriesDataPrefix m hm data).coloring idx'.succ = + data.coloring idx.succ := by rfl + have hcurStored : (TashkinovSeriesDataPrefix m hm data).stored idx'.succ = + data.stored idx.succ := by rfl + have hcurEdges : (TashkinovSeriesDataPrefix m hm data).connectingEdges + idx'.succ = data.connectingEdges idx.succ := by rfl + have hcurKind : (TashkinovSeriesDataPrefix m hm data).kind idx'.succ = + data.kind idx.succ := by rfl + have hcurVertex : (TashkinovSeriesDataPrefix m hm data).chosenVertex + idx'.succ = data.chosenVertex idx.succ := by rfl + have hcurOutside : (TashkinovSeriesDataPrefix m hm data).outsideVertex + idx'.succ = data.outsideVertex idx.succ := by rfl + have hcurDelta : (TashkinovSeriesDataPrefix m hm data).delta idx'.succ = + data.delta idx.succ := by rfl + have hcurGamma : (TashkinovSeriesDataPrefix m hm data).gamma idx'.succ = + data.gamma idx.succ := by rfl + have hnext : (TashkinovSeriesDataPrefix m hm data).tree idx'.succ.succ = + data.tree idx.succ.succ := by rfl + have hstored : TashkinovStoredColors + (TashkinovSeriesDataPrefix m hm data) idx'.castSucc = + TashkinovStoredColors data idx.castSucc := by + exact TashkinovStoredColorsPrefix m hm data idx'.castSucc + let choice' : MaximumDefectiveChoice G e0 + ((TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc) + (TashkinovStoredColors (TashkinovSeriesDataPrefix m hm data) + idx'.castSucc) + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) := by + exact { + selected := choice.selected + selectedProper := choice.selectedProper + selectedOneUncolored := choice.selectedOneUncolored + selectedStable := by + rw [htree, hstored, hprev] + exact choice.selectedStable + vertex := choice.vertex + vertexDefective := by + rw [htree] + exact choice.vertexDefective + maximal := by + rw [htree, hstored, hprev] + exact choice.maximal + edge := choice.edge + edgeDefective := by + rw [htree] + exact choice.edgeDefective + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := by + rw [htree] + exact choice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := choice.edgeColor + } + have noRevisiting' : ¬ Nonempty (RevisitingExtensionCertificate + (TashkinovSeriesDataPrefix m hm data) idx'.castSucc) := by + apply helper_noRevisiting_120 <;> assumption + have prefixCert : TashkinovSeriesStep G k m e0 input + (TashkinovSeriesDataPrefix m hm data) idx'.succ := by + apply TashkinovSeriesStep.SE (input := input) (i := idx') (choice := choice') + (adjoined := adjoined) + · rw [hprev] + exact previousProper + · rw [hprev] + exact previousOneUncolored + · rw [hprev, htree] + exact previousClosed + · rw [hprev, htree] + exact previousNotStronglyClosed + · exact noRevisiting' + · intro pi hp ho hs + apply seriesAlternative pi hp ho + change StableColoring + ((TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc) + (insert choice.color (TashkinovStoredColors + (TashkinovSeriesDataPrefix m hm data) idx'.castSucc)) + choice.selected pi at hs + rw [htree, hstored] at hs + exact hs + · change (TashkinovSeriesDataPrefix m hm data).coloring idx'.succ = + choice.selected + rw [hcur] + exact currentColoring + · change (TashkinovSeriesDataPrefix m hm data).stored idx'.succ = + {choice.color} + rw [hcurStored] + exact currentStored + · change (TashkinovSeriesDataPrefix m hm data).connectingEdges + idx'.succ = {choice.edge} + rw [hcurEdges] + exact currentEdges + · rw [hcurKind] + exact currentKind + · change (TashkinovSeriesDataPrefix m hm data).chosenVertex + idx'.succ = some choice.vertex + rw [hcurVertex] + exact currentVertex + · change (TashkinovSeriesDataPrefix m hm data).outsideVertex + idx'.succ = some choice.otherEndpoint + rw [hcurOutside] + exact currentOutside + · change (TashkinovSeriesDataPrefix m hm data).delta idx'.succ = + some choice.color + rw [hcurDelta] + exact currentDelta + · rw [hcurGamma] + exact currentGamma + · change TreeSequenceAdjoinEdge + ((TashkinovSeriesDataPrefix m hm data).tree idx'.succ.castSucc) + choice.edge adjoined + rw [htree] + exact adjoinedExactly + · rw [hcur, hnext] + exact closedExtension + · rw [htree, hnext] + exact orderedExtension + · rw [htree, hnext] + exact strictExtension + have hresult : idx'.succ = + (⟨idx.succ.val, by omega⟩ : Fin (m + 1)) := by + apply Fin.ext + rfl + rw [← hresult] + exact ⟨prefixCert, proof_irrel_heq _ _⟩ + +private theorem helper_branch_1559.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) (m : ℕ) (hm : m ≤ rounds) (idx : Fin rounds) + (previousProper : IsProperEdgeColoring G (data.coloring idx.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (data.coloring idx.castSucc) e0) + (previousClosed : ColoredVertexSetClosed G (data.coloring idx.castSucc) + (TreeSequenceVertexSet (data.tree idx.succ.castSucc))) (previousNotStronglyClosed : + ¬ColoredVertexSetStronglyClosed G (data.coloring idx.castSucc) (TreeSequenceVertexSet + (data.tree idx.succ.castSucc))) (available : RevisitingExtensionCertificate data + idx.castSucc) (currentColoring : data.coloring idx.succ = data.coloring idx.castSucc) + (currentStored : data.stored idx.succ = (insert available.delta ({ available.gamma } : + Finset (Fin k)) : Finset (Fin k))) (currentEdges : data.connectingEdges idx.succ = + ({ available.edge } : Finset E)) (currentKind : data.kind idx.succ = some + TashkinovExtensionKind.RE) (currentVertex : data.chosenVertex idx.succ = some + available.insideEndpoint) (currentOutside : data.outsideVertex idx.succ = some + available.outsideEndpoint) (currentDelta : data.delta idx.succ = some available.delta) + (currentGamma : data.gamma idx.succ = some available.gamma) (adjoined : TreeSequence G e0) + (adjoinedExactly : TreeSequenceAdjoinEdge (data.tree idx.succ.castSucc) available.edge + adjoined) (closedExtension : TashkinovClosure (data.coloring idx.succ) adjoined (data.tree + idx.succ.succ)) (orderedExtension : TreeSequenceInitialSegment (data.tree + idx.succ.castSucc) (data.tree idx.succ.succ)) (strictExtension : (data.tree + idx.succ.castSucc).length < (data.tree idx.succ.succ).length) (hj : (↑idx.succ : ℕ) ≤ m), + ∃ (prefixCert : TashkinovSeriesStep G k m e0 input (TashkinovSeriesDataPrefix m hm data) + (⟨(↑idx.succ : ℕ), + by + omega + ⟩ : Fin (m + (1 : ℕ)))), prefixCert ≍ TashkinovSeriesStep.RE (input := input) idx + previousProper previousOneUncolored previousClosed previousNotStronglyClosed available + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension := by + classical + intro V E _ _ _ G k rounds e0 input data m hm idx previousProper previousOneUncolored + previousClosed previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta currentGamma adjoined + adjoinedExactly closedExtension orderedExtension strictExtension hj + have hidxSucc : idx.val + 1 ≤ m := by simpa using hj + have hidx : idx.val < m := by omega + let idx' : Fin m := ⟨idx.val, hidx⟩ + have hprev : (TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc = + data.coloring idx.castSucc := by rfl + have htree : (TashkinovSeriesDataPrefix m hm data).tree + idx'.succ.castSucc = data.tree idx.succ.castSucc := by rfl + have htreeCurrent : (TashkinovSeriesDataPrefix m hm data).tree + idx'.castSucc.succ = data.tree idx.castSucc.succ := by rfl + have hcur : (TashkinovSeriesDataPrefix m hm data).coloring idx'.succ = + data.coloring idx.succ := by rfl + have hcurStored : (TashkinovSeriesDataPrefix m hm data).stored idx'.succ = + data.stored idx.succ := by rfl + have hcurEdges : (TashkinovSeriesDataPrefix m hm data).connectingEdges + idx'.succ = data.connectingEdges idx.succ := by rfl + have hcurKind : (TashkinovSeriesDataPrefix m hm data).kind idx'.succ = + data.kind idx.succ := by rfl + have hcurVertex : (TashkinovSeriesDataPrefix m hm data).chosenVertex + idx'.succ = data.chosenVertex idx.succ := by rfl + have hcurOutside : (TashkinovSeriesDataPrefix m hm data).outsideVertex + idx'.succ = data.outsideVertex idx.succ := by rfl + have hcurDelta : (TashkinovSeriesDataPrefix m hm data).delta idx'.succ = + data.delta idx.succ := by rfl + have hcurGamma : (TashkinovSeriesDataPrefix m hm data).gamma idx'.succ = + data.gamma idx.succ := by rfl + have hnext : (TashkinovSeriesDataPrefix m hm data).tree idx'.succ.succ = + data.tree idx.succ.succ := by rfl + have haLe : available.earlier.val ≤ idx.val := by + simpa using available.earlierAtMost + have haBound : available.earlier.val < m + 1 := by omega + let earlier' : Fin (m + 1) := ⟨available.earlier.val, haBound⟩ + have hkindEarlier : (TashkinovSeriesDataPrefix m hm data).kind + earlier' = data.kind available.earlier := by rfl + have hgammaEarlier : (TashkinovSeriesDataPrefix m hm data).gamma + earlier' = data.gamma available.earlier := by rfl + have hdeltaEarlier : (TashkinovSeriesDataPrefix m hm data).delta + earlier' = data.delta available.earlier := by rfl + have htreeEarlier : (TashkinovSeriesDataPrefix m hm data).tree + earlier'.castSucc = data.tree available.earlier.castSucc := by rfl + let cycle' : TwoColorCycle G + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + available.gamma available.delta := { + base := available.cycle.base + walk := @Eq.ndrec (PartialEdgeColoring E k) + (data.coloring idx.castSucc) + (fun phi => (TwoColorIncidenceGraph G phi available.gamma + available.delta).Walk available.cycle.base available.cycle.base) + available.cycle.walk + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + hprev.symm + isCycle := by + dsimp + cases hprev + exact available.cycle.isCycle + } + let returnPath' : (TwoColorIncidenceGraph G + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + available.gamma available.delta).Walk (Sum.inr available.edge) + (Sum.inl available.returnVertex) := + @Eq.ndrec (PartialEdgeColoring E k) (data.coloring idx.castSucc) + (fun phi => (TwoColorIncidenceGraph G phi available.gamma + available.delta).Walk (Sum.inr available.edge) + (Sum.inl available.returnVertex)) + available.returnPath + ((TashkinovSeriesDataPrefix m hm data).coloring idx'.castSucc) + hprev.symm + let available' : RevisitingExtensionCertificate + (TashkinovSeriesDataPrefix m hm data) idx'.castSucc := by + exact @helperAvailable754 (@V) (@E) inferInstance inferInstance (@G) (@k) (@rounds) (@e0) + (@data) (@m) (@hm) (@idx) (@available) (@hidx) (@hprev) (@htreeCurrent) (@haBound) + (@hkindEarlier) (@hgammaEarlier) (@hdeltaEarlier) (@htreeEarlier) + have prefixCert : TashkinovSeriesStep G k m e0 input + (TashkinovSeriesDataPrefix m hm data) idx'.succ := by + apply helper_prefixCert_1176 <;> assumption + have hresult : idx'.succ = + (⟨idx.succ.val, by omega⟩ : Fin (m + 1)) := by + apply Fin.ext + rfl + rw [← hresult] + exact ⟨prefixCert, proof_irrel_heq _ _⟩ + +private theorem helper_aux_33.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) (m : ℕ) (hm : m ≤ rounds) (_ : Fin (m + (1 : + ℕ))) (j : Fin (rounds + (1 : ℕ))) (hj : (↑j : ℕ) ≤ m) (oldCert : TashkinovSeriesStep G k + rounds e0 input data j), + ∃ (prefixCert : TashkinovSeriesStep G k m e0 input (TashkinovSeriesDataPrefix m hm data) (⟨(↑j + : ℕ), Decidable.byContradiction fun (a : ¬(↑j : ℕ) < m + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (m + (1 : ℕ)))), prefixCert ≍ oldCert := by + classical + intro V E _ _ _ G k rounds e0 input data m hm i j hj oldCert + cases oldCert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + apply helper_branch_286 <;> assumption + | SE idx previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_1414 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@data) (@m) (@hm) (@i) (@idx) (@previousProper) + (@previousOneUncolored) (@previousClosed) (@previousNotStronglyClosed) + (@noRevisiting) (@choice) (@seriesAlternative) (@currentColoring) (@currentStored) + (@currentEdges) (@currentKind) (@currentVertex) (@currentOutside) (@currentDelta) + (@currentGamma) (@adjoined) (@adjoinedExactly) (@closedExtension) + (@orderedExtension) (@strictExtension) (@hj) + | PE idx previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact @helper_branch_1369 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@data) (@m) (@hm) (@i) (@idx) (@previousProper) + (@previousOneUncolored) (@previousClosed) (@previousNotStronglyClosed) + (@noRevisiting) (@choice) (@seriesAlternativeFails) (@gamma) (@gammaRule) + (@secondStable) (@secondStableProper) (@secondStableOneUncolored) + (@secondStableRelation) (@exitWitness) (@currentColoring) (@currentProper) + (@currentOneUncolored) (@currentStored) (@currentEdges) (@currentKind) + (@currentVertex) (@currentOutside) (@currentDelta) (@currentGamma) + (@closedExtension) (@orderedExtension) (@strictExtension) (@hj) + | RE idx previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_1559 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@rounds) (@e0) (@input) (@data) (@m) (@hm) (@idx) (@previousProper) + (@previousOneUncolored) (@previousClosed) (@previousNotStronglyClosed) (@available) + (@currentColoring) (@currentStored) (@currentEdges) (@currentKind) (@currentVertex) + (@currentOutside) (@currentDelta) (@currentGamma) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@orderedExtension) (@strictExtension) (@hj) +theorem TashkinovSeriesStepPrefix {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + (input : PartialEdgeColoring E k) + (data : TashkinovSeriesData G k rounds e0) + (m : ℕ) (hm : m ≤ rounds) (i : Fin (m + 1)) + (cert : TashkinovSeriesStep G k rounds e0 input data + (Fin.castLE (by omega) i)) : + ∃ prefixCert : TashkinovSeriesStep G k m e0 input + (TashkinovSeriesDataPrefix m hm data) i, + HEq prefixCert cert := by + have aux : ∀ (j : Fin (rounds + 1)) (hj : j.val ≤ m) + (oldCert : TashkinovSeriesStep G k rounds e0 input data j), + ∃ prefixCert : TashkinovSeriesStep G k m e0 input + (TashkinovSeriesDataPrefix m hm data) ⟨j.val, by omega⟩, + HEq prefixCert oldCert := by + apply helper_aux_33; assumption + let included : Fin (rounds + 1) := + Fin.castLE (Nat.add_le_add_right hm 1) i + have hibound : included.val ≤ m := by + exact Nat.le_of_lt_succ i.isLt + have hcertType : TashkinovSeriesStep G k rounds e0 input data included := by + exact cert + obtain ⟨prefixCert, hcert⟩ := aux included hibound hcertType + have hi : (⟨included.val, by omega⟩ : Fin (m + 1)) = i := by + apply Fin.ext + rfl + rw [hi] at prefixCert + exact ⟨prefixCert, hcert⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovStoredColors.lean b/LeanPool/GoldbergSeymour/TashkinovStoredColors.lean new file mode 100644 index 0000000000..052e7bda0a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovStoredColors.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesData +public import LeanPool.GoldbergSeymour.TreeMissingColors + +/-! +# Tashkinov Stored Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Accumulated stored colors up to a stage, excluding colors missing on its tree. -/ +noncomputable def TashkinovStoredColors {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} (data : TashkinovSeriesData G k rounds e0) + (i : Fin (rounds + 1)) : Finset (Fin k) := by + classical + exact if i.val = 0 then ∅ else + (Finset.univ.biUnion fun h : Fin (rounds + 1) => + if h.val ≤ i.val then data.stored h else ∅) \ + TreeMissingColors (data.coloring i) (data.tree i.castSucc) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovStoredColorsAppend.lean b/LeanPool/GoldbergSeymour/TashkinovStoredColorsAppend.lean new file mode 100644 index 0000000000..6954810ffa --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovStoredColorsAppend.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesDataAppend +public import LeanPool.GoldbergSeymour.TashkinovStoredColors + +/-! +# Tashkinov Stored Colors Append + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovStoredColorsAppend {V E : Type*} [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + (data : TashkinovSeriesData G k rounds e0) + (newTree : TreeSequence G e0) + (newColoring : PartialEdgeColoring E k) + (newStored : Finset (Fin k)) + (newConnectingEdges : Finset E) + (newKind : Option TashkinovExtensionKind) + (newChosenVertex newOutsideVertex : Option V) + (newDelta newGamma : Option (Fin k)) + (i : Fin (rounds + 1)) : + TashkinovStoredColors + (TashkinovSeriesDataAppend data newTree newColoring newStored + newConnectingEdges newKind newChosenVertex newOutsideVertex newDelta newGamma) + i.castSucc = TashkinovStoredColors data i := by + classical + let _ := Fintype.ofFinite V + unfold TashkinovStoredColors + simp only [Fin.val_castSucc] + split_ifs with hi + · rfl + · apply Finset.ext + intro c + rw [Finset.mem_sdiff, Finset.mem_sdiff] + constructor + · rintro ⟨hc, hmissing⟩ + rw [Finset.mem_biUnion] at hc + rcases hc with ⟨h, -, hc⟩ + have hle : h.val ≤ i.val := by + by_contra hn + simp [hn] at hc + simp only [hle, ↓reduceIte] at hc + let oldH : Fin (rounds + 1) := ⟨h.val, lt_of_le_of_lt hle i.isLt⟩ + have hEq : h = oldH.castSucc := by ext; rfl + have hcOld : c ∈ data.stored oldH := by + rw [hEq] at hc + simpa [TashkinovSeriesDataAppend] using hc + have oldHle : oldH.val ≤ i.val := hle + refine ⟨?_, ?_⟩ + · rw [Finset.mem_biUnion] + refine ⟨oldH, Finset.mem_univ _, ?_⟩ + simp only [ite_eq_left oldHle] + exact hcOld + · simpa [TashkinovSeriesDataAppend] using hmissing + · rintro ⟨hc, hmissing⟩ + rw [Finset.mem_biUnion] at hc + rcases hc with ⟨h, -, hc⟩ + have hle : h.val ≤ i.val := by + by_contra hn + simp [hn] at hc + simp [hle] at hc + have hleCast : h.castSucc.val ≤ i.val := hle + refine ⟨?_, ?_⟩ + · rw [Finset.mem_biUnion] + refine ⟨h.castSucc, Finset.mem_univ _, ?_⟩ + simp only [ite_eq_left hleCast] + simpa [TashkinovSeriesDataAppend] using hc + · simpa [TashkinovSeriesDataAppend] using hmissing + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovStoredColorsCardinality.lean b/LeanPool/GoldbergSeymour/TashkinovStoredColorsCardinality.lean new file mode 100644 index 0000000000..13ca3a634f --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovStoredColorsCardinality.lean @@ -0,0 +1,687 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Tashkinov Stored Colors Cardinality + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_priorVertices_70.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input), + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → + (∀ {A B : TreeSequence G e0} {phi : PartialEdgeColoring E k}, + TashkinovAugmentationSequence phi A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → + ∀ (q : Fin rounds), + ∀ v ∈ TreeSequenceVertexSet (series.data.tree q.castSucc.castSucc), + v ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc) := by + classical + intro V E _ _ _ G k rounds e0 input series vertexTransfer closureTransfer q v hv + have cert := series.certified q.castSucc + generalize hj : q.castSucc = j at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + have hval := congrArg Fin.val hj + have hq : q.val = 0 := by simpa using hval + have hidx : q.castSucc.castSucc = (0 : Fin (rounds + 2)) := by + apply Fin.ext + simp [hq] + have hnext : q.succ.castSucc = (1 : Fin (rounds + 2)) := by + apply Fin.ext + simp [hq] + have hv' : v ∈ TreeSequenceVertexSet (series.data.tree 0) := by + rw [hidx] at hv + exact hv + have h := closureTransfer initialClosure.1 hv' + simpa [hnext] using h + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hj + have hi : ci.succ = q.castSucc := by apply Fin.ext; simp at hvals ⊢; omega + have hs := vertexTransfer (by simpa [hi] using orderedExtension) hv + have heq : q.castSucc.succ = q.succ.castSucc := by apply Fin.ext; rfl + rw [heq] at hs + exact hs + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hj + have hi : ci.succ = q.castSucc := by apply Fin.ext; simp at hvals ⊢; omega + have hs := vertexTransfer (by simpa [hi] using orderedExtension) hv + have heq : q.castSucc.succ = q.succ.castSucc := by apply Fin.ext; rfl + rw [heq] at hs + exact hs + | RE ci previousProper previousUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hj + have hi : ci.succ = q.castSucc := by apply Fin.ext; simp at hvals ⊢; omega + have hs := vertexTransfer (by simpa [hi] using orderedExtension) hv + have heq : q.castSucc.succ = q.succ.castSucc := by apply Fin.ext; rfl + rw [heq] at hs + exact hs + +private theorem helper_branch_139.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), ( + ∀ (q : Fin rounds), + ∀ v ∈ TreeSequenceVertexSet (series.data.tree q.castSucc.castSucc), v ∈ TreeSequenceVertexSet + (series.data.tree q.succ.castSucc)) → ( + ∀ {r : Fin (rounds + (1 : ℕ))} {c : Fin k}, (↑r : ℕ) ≠ (0 : ℕ) → (c ∈ TashkinovStoredColors + series.data r ↔ ( + ∃ (h : Fin (rounds + (1 : ℕ))), (↑h : ℕ) ≤ (↑r : ℕ) ∧ c ∈ series.data.stored h) ∧ c ∉ + TreeMissingColors (series.data.coloring r) (series.data.tree r.castSucc))) → + series.data.stored (0 : Fin (rounds + (1 : ℕ))) = ∅ → + ∀ (q : Fin rounds), (TashkinovStoredColors series.data q.castSucc).card ≤ (↑q.castSucc : ℕ) → + ∀ (ci : Fin rounds), IsProperEdgeColoring G (series.data.coloring ci.castSucc) → + IsOneEdgeUncolored (series.data.coloring ci.castSucc) e0 → ColoredVertexSetClosed G + (series.data.coloring ci.castSucc) (TreeSequenceVertexSet (series.data.tree + ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate series.data ci.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree ci.succ.castSucc) + (TashkinovStoredColors series.data ci.castSucc) (series.data.coloring ci.castSucc)), ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data ci.castSucc)) choice.selected pi → Disjoint + (MissingColors G pi choice.otherEndpoint) (TreeMissingColors pi (series.data.tree + ci.succ.castSucc))) → series.data.coloring ci.succ = choice.selected → series.data.stored + ci.succ = { choice.color } → series.data.connectingEdges ci.succ = { choice.edge } → + series.data.kind ci.succ = some TashkinovExtensionKind.SE → series.data.chosenVertex + ci.succ = some choice.vertex → series.data.outsideVertex ci.succ = some + choice.otherEndpoint → series.data.delta ci.succ = some choice.color → series.data.gamma + ci.succ = none → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (series.data.tree ci.succ.castSucc) + choice.edge adjoined → TashkinovClosure (series.data.coloring ci.succ) adjoined + (series.data.tree ci.succ.succ) → TreeSequenceInitialSegment (series.data.tree + ci.succ.castSucc) (series.data.tree ci.succ.succ) → (series.data.tree + ci.succ.castSucc).length < (series.data.tree ci.succ.succ).length → q.succ = ci.succ → + (TashkinovStoredColors series.data ci.succ).card ≤ (↑ci.succ : ℕ) := by + classical + intro V E _ _ _ G k rounds e0 input series oldVertices storedMem storedZero q ih ci + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternative currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension hj + have hvals := congrArg Fin.val hj + have hci : ci = q := by + apply Fin.ext + have hqci : q.val + 1 = ci.val + 1 := by simpa using hvals + omega + subst ci + have hsub : TashkinovStoredColors series.data q.succ ⊆ + TashkinovStoredColors series.data q.castSucc ∪ {choice.color} := by + intro c hc + have hmem := (storedMem (r := q.succ) (by simp)).mp hc + rcases hmem with ⟨⟨h, hh, hm⟩, hnot⟩ + by_cases he : h.val = q.succ.val + · have heq : h = q.succ := by apply Fin.ext; exact he + rw [heq, currentStored] at hm + exact Finset.mem_union.mpr (Or.inr (by simpa using hm)) + · by_cases hz : q.val = 0 + · have hqone : q.succ.val = 1 := by simp [hz] + have hh0 : h = 0 := by + apply Fin.ext + have hle0 : h.val ≤ 1 := by simpa [hz] using hh + have hne1 : h.val ≠ 1 := by simpa [hz] using he + have hzero : h.val = 0 := by omega + exact hzero + subst h + rw [storedZero] at hm + simp at hm + · have hle : h.val ≤ q.val := by + change h.val ≤ q.val + 1 at hh; change h.val ≠ q.val + 1 at he + omega + have oldNot : c ∉ TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.castSucc.castSucc) := by + intro hold + apply hnot + simp only [TreeMissingColors, Finset.mem_biUnion] at hold ⊢ + rcases hold with ⟨v, hv, hcv⟩ + exact ⟨v, oldVertices q v hv, by simpa [currentColoring] using + ((choice.selectedStable.2 v (oldVertices q v hv)).symm ▸ hcv)⟩ + exact Finset.mem_union.mpr (Or.inl ((storedMem (r := q.castSucc) hz).mpr + ⟨⟨h, hle, hm⟩, oldNot⟩)) + calc + _ ≤ (TashkinovStoredColors series.data q.castSucc ∪ {choice.color}).card := + Finset.card_le_card hsub + _ ≤ (TashkinovStoredColors series.data q.castSucc).card + 1 := by + simpa using Finset.card_union_le (TashkinovStoredColors series.data q.castSucc) {choice.color} + _ ≤ q.val + 1 := by + have hiq := ih + simp at hiq + omega + +private theorem helper_branch_191.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), ( + ∀ (q : Fin rounds), TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree + q.castSucc.castSucc) ⊆ TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc)) → ( + ∀ {r : Fin (rounds + (1 : ℕ))} {c : Fin k}, (↑r : ℕ) ≠ (0 : ℕ) → (c ∈ TashkinovStoredColors + series.data r ↔ ( + ∃ (h : Fin (rounds + (1 : ℕ))), (↑h : ℕ) ≤ (↑r : ℕ) ∧ c ∈ series.data.stored h) ∧ c ∉ + TreeMissingColors (series.data.coloring r) (series.data.tree r.castSucc))) → + series.data.stored (0 : Fin (rounds + (1 : ℕ))) = ∅ → + ∀ (q : Fin rounds), (TashkinovStoredColors series.data q.castSucc).card ≤ (↑q.castSucc : ℕ) → + ∀ (ci : Fin rounds), IsProperEdgeColoring G (series.data.coloring ci.castSucc) → + IsOneEdgeUncolored (series.data.coloring ci.castSucc) e0 → ColoredVertexSetClosed G + (series.data.coloring ci.castSucc) (TreeSequenceVertexSet (series.data.tree + ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate series.data ci.castSucc), series.data.coloring + ci.succ = series.data.coloring ci.castSucc → series.data.stored ci.succ = + { available.delta, available.gamma } → series.data.connectingEdges ci.succ = + { available.edge } → series.data.kind ci.succ = some TashkinovExtensionKind.RE → + series.data.chosenVertex ci.succ = some available.insideEndpoint → + series.data.outsideVertex ci.succ = some available.outsideEndpoint → series.data.delta + ci.succ = some available.delta → series.data.gamma ci.succ = some available.gamma → + ∀ (adjoined : TreeSequence G e0), TreeSequenceAdjoinEdge (series.data.tree ci.succ.castSucc) + available.edge adjoined → TashkinovClosure (series.data.coloring ci.succ) adjoined + (series.data.tree ci.succ.succ) → TreeSequenceInitialSegment (series.data.tree + ci.succ.castSucc) (series.data.tree ci.succ.succ) → (series.data.tree + ci.succ.castSucc).length < (series.data.tree ci.succ.succ).length → q.succ = ci.succ → + (TashkinovStoredColors series.data ci.succ).card ≤ (↑ci.succ : ℕ) := by + classical + intro V E _ _ _ G k rounds e0 input series missingTransfer storedMem storedZero q ih ci + previousProper previousUncolored previousClosed previousNotStronglyClosed available + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension hj + have hvals := congrArg Fin.val hj + have hci : ci = q := by + apply Fin.ext + have hqci : q.val + 1 = ci.val + 1 := by simpa using hvals + omega + subst ci + have qpos : q.val ≠ 0 := by + have hp := available.earlierPositive + have hle : available.earlier.val ≤ q.val := by simpa using available.earlierAtMost + omega + have hsub : TashkinovStoredColors series.data q.succ ⊆ + TashkinovStoredColors series.data q.castSucc := by + intro c hc + have hmem := (storedMem (r := q.succ) (by simp)).mp hc + rcases hmem with ⟨⟨h, hh, hm⟩, hnot⟩ + by_cases he : h.val = q.succ.val + · have heq : h = q.succ := by apply Fin.ext; exact he + have oldNot : c ∉ TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.castSucc.castSucc) := by + intro hold + apply hnot + rw [currentColoring] + exact missingTransfer q hold + have earlierBound : available.earlier.val ≤ q.val := by + simpa using available.earlierAtMost + have earlierMem : c ∈ series.data.stored available.earlier := by + have hmPair : c = available.delta ∨ c = available.gamma := by + rw [heq, currentStored] at hm + simpa using hm + have ec := series.certified available.earlier + generalize hj : available.earlier = j at ec + cases ec with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + have hz : available.earlier.val = 0 := by simp [hj] + exact (Nat.ne_of_gt available.earlierPositive hz).elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting oldChoice seriesAlternative + oldColoring oldStored oldEdges oldKind oldVertex oldOutside oldDelta oldGamma + adjoined adjoinedExactly closedExtension orderedExtension strictExtension => + have hk : series.data.kind available.earlier = + some TashkinovExtensionKind.PE := available.earlierPE + rw [hj, oldKind] at hk + simp at hk + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting oldChoice seriesAlternativeFails + oldGammaPrev gammaRule oldStable oldStableProper oldStableOneUncolored + oldStableRelation exitWitness oldColoring oldProper oldOneUncolored oldStored + oldEdges oldKind oldVertex oldOutside oldDelta oldGamma closedExtension + orderedExtension strictExtension => + have hd : oldChoice.color = available.delta := by + apply Option.some.inj + calc + some oldChoice.color = series.data.delta ci.succ := oldDelta.symm + _ = series.data.delta available.earlier := by rw [hj] + _ = some available.delta := available.earlierDelta + have hg : oldGammaPrev = available.gamma := by + apply Option.some.inj + calc + some oldGammaPrev = series.data.gamma ci.succ := oldGamma.symm + _ = series.data.gamma available.earlier := by rw [hj] + _ = some available.gamma := available.earlierGamma + simpa [hj, oldStored, hd, hg] using hmPair + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed oldAvailable oldColoring oldStored oldEdges oldKind + oldVertex oldOutside oldDelta oldGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have hk : series.data.kind available.earlier = + some TashkinovExtensionKind.PE := available.earlierPE + rw [hj, oldKind] at hk + simp at hk + exact (storedMem (r := q.castSucc) qpos).mpr + ⟨⟨available.earlier, earlierBound, earlierMem⟩, oldNot⟩ + · by_cases hz : q.val = 0 + · have hqone : q.succ.val = 1 := by simp [hz] + have hh0 : h = 0 := by + apply Fin.ext + have hle0 : h.val ≤ 1 := by simpa [hz] using hh + have hne1 : h.val ≠ 1 := by simpa [hz] using he + exact Nat.lt_one_iff.mp (Nat.lt_of_le_of_ne hle0 hne1) + subst h + rw [storedZero] at hm + simp at hm + · have hle : h.val ≤ q.val := by + change h.val ≤ q.val + 1 at hh; change h.val ≠ q.val + 1 at he + omega + have oldNot : c ∉ TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.castSucc.castSucc) := by + intro hold + apply hnot + rw [currentColoring] + exact missingTransfer q hold + exact (storedMem (r := q.castSucc) hz).mpr + ⟨⟨h, hle, hm⟩, oldNot⟩ + have ih' : (TashkinovStoredColors series.data q.castSucc).card ≤ q.val := by + simpa using ih + have hcard := Finset.card_le_card hsub + change (TashkinovStoredColors series.data q.succ).card ≤ q.val + 1 + exact hcard.trans (by omega) + +private theorem helper_branch_295.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), ( + ∀ (q : Fin rounds), + ∀ v ∈ TreeSequenceVertexSet (series.data.tree q.castSucc.castSucc), v ∈ TreeSequenceVertexSet + (series.data.tree q.succ.castSucc)) → ( + ∀ {phi : PartialEdgeColoring E k} {a b : Fin k} {z : V ⊕ E} {v : V} {c : Fin k}, c ∈ + MissingColors G phi v → c ≠ a → c ≠ b → c ∈ MissingColors G (TwoColorComponentSwap G phi a + b z) v) → ( + ∀ {r : Fin (rounds + (1 : ℕ))} {c : Fin k}, (↑r : ℕ) ≠ (0 : ℕ) → (c ∈ TashkinovStoredColors + series.data r ↔ ( + ∃ (h : Fin (rounds + (1 : ℕ))), (↑h : ℕ) ≤ (↑r : ℕ) ∧ c ∈ series.data.stored h) ∧ c ∉ + TreeMissingColors (series.data.coloring r) (series.data.tree r.castSucc))) → + series.data.stored (0 : Fin (rounds + (1 : ℕ))) = ∅ → + ∀ (q : Fin rounds), (TashkinovStoredColors series.data q.castSucc).card ≤ (↑q.castSucc : ℕ) → + ∀ (ci : Fin rounds), IsProperEdgeColoring G (series.data.coloring ci.castSucc) → + IsOneEdgeUncolored (series.data.coloring ci.castSucc) e0 → ColoredVertexSetClosed G + (series.data.coloring ci.castSucc) (TreeSequenceVertexSet (series.data.tree + ci.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G (series.data.coloring ci.castSucc) + (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc)) → ¬Nonempty + (RevisitingExtensionCertificate series.data ci.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (series.data.tree ci.succ.castSucc) + (TashkinovStoredColors series.data ci.castSucc) (series.data.coloring ci.castSucc)), ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data ci.castSucc)) choice.selected rho ∧ ¬Disjoint + (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho (series.data.tree + ci.succ.castSucc))) → + ∀ (gamma : Fin k), ParallelExtensionColor series.data ci.castSucc choice.selected + choice.vertex gamma → + ∀ (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G secondStable → + StableColoring (series.data.tree ci.succ.castSucc) (insert choice.color + (TashkinovStoredColors series.data ci.castSucc)) choice.selected secondStable → TreeExit + (series.data.tree ci.succ.castSucc) secondStable gamma choice.color choice.vertex → + series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) → IsProperEdgeColoring G (series.data.coloring ci.succ) → + IsOneEdgeUncolored (series.data.coloring ci.succ) e0 → series.data.stored ci.succ = + {choice.color, gamma} → series.data.connectingEdges ci.succ = { choice.edge } → + series.data.kind ci.succ = some TashkinovExtensionKind.PE → series.data.chosenVertex + ci.succ = some choice.vertex → series.data.outsideVertex ci.succ = some + choice.otherEndpoint → series.data.delta ci.succ = some choice.color → series.data.gamma + ci.succ = some gamma → TashkinovClosure (series.data.coloring ci.succ) (series.data.tree + ci.succ.castSucc) (series.data.tree ci.succ.succ) → TreeSequenceInitialSegment + (series.data.tree ci.succ.castSucc) (series.data.tree ci.succ.succ) → (series.data.tree + ci.succ.castSucc).length < (series.data.tree ci.succ.succ).length → q.succ = ci.succ → + (TashkinovStoredColors series.data ci.succ).card ≤ (↑ci.succ : ℕ) := by + classical + intro V E _ _ _ G k rounds e0 input series oldVertices swapMissing storedMem storedZero q ih ci + previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting + choice seriesAlternativeFails gamma gammaRule secondStable secondStableProper + secondStableRelation exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension hj + have hvals := congrArg Fin.val hj + have hci : ci = q := by + apply Fin.ext + have hqci : q.val + 1 = ci.val + 1 := by simpa using hvals + omega + subst ci + have hsub : TashkinovStoredColors series.data q.succ ⊆ + TashkinovStoredColors series.data q.castSucc ∪ {choice.color, gamma} := by + intro c hc + have hmem := (storedMem (r := q.succ) (by simp)).mp hc + rcases hmem with ⟨⟨h, hh, hm⟩, hnot⟩ + by_cases he : h.val = q.succ.val + · have heq : h = q.succ := by apply Fin.ext; exact he + rw [heq, currentStored] at hm + exact Finset.mem_union.mpr (Or.inr (by simpa using hm)) + · by_cases hz : q.val = 0 + · have hqone : q.succ.val = 1 := by simp [hz] + have hh0 : h = 0 := by + apply Fin.ext + have hle0 : h.val ≤ 1 := by simpa [hz] using hh + have hne1 : h.val ≠ 1 := by simpa [hz] using he + exact Nat.lt_one_iff.mp (Nat.lt_of_le_of_ne hle0 hne1) + subst h + rw [storedZero] at hm + simp at hm + · have hle : h.val ≤ q.val := by + change h.val ≤ q.val + 1 at hh; change h.val ≠ q.val + 1 at he + omega + by_cases hc : c = choice.color + · exact Finset.mem_union.mpr (Or.inr (Finset.mem_insert.mpr (Or.inl hc))) + by_cases hg : c = gamma + · exact Finset.mem_union.mpr (Or.inr (by simp [hg])) + have oldNot : c ∉ TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.castSucc.castSucc) := + (by + intro hold + apply hnot + rw [currentColoring] + simp only [TreeMissingColors, Finset.mem_biUnion] at hold ⊢ + rcases hold with ⟨v, hv, hcv⟩ + have hv' := oldVertices q v hv + have hcv' : c ∈ MissingColors G secondStable v := by + rw [secondStableRelation.2 v hv', choice.selectedStable.2 v hv'] + exact hcv + exact ⟨v, oldVertices q v hv, + swapMissing (phi := secondStable) + (a := gamma) (b := choice.color) + (z := Sum.inl choice.vertex) (v := v) (c := c) + hcv' hg hc⟩) + exact Finset.mem_union.mpr (Or.inl ((storedMem (r := q.castSucc) hz).mpr + ⟨⟨h, hle, hm⟩, oldNot⟩)) + have hdelta : choice.color ∈ TreeMissingColors + (TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex)) (series.data.tree q.succ.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + refine ⟨choice.vertex, choice.vertexDefective.1, ?_⟩ + have hgamma : gamma ∈ MissingColors G secondStable choice.vertex := by + exact (secondStableRelation.2 choice.vertex choice.vertexDefective.1).symm ▸ gammaRule.1 + have hedge : secondStable choice.edge = some choice.color := by + exact (secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union_right _ (Finset.mem_insert_self _ _), + choice.edgeColor⟩).trans choice.edgeColor + have hneq : gamma ≠ choice.color := by + intro heq + apply (Finset.mem_sdiff.mp hgamma).2 + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, by simpa [heq] using hedge⟩ + have hm : choice.color ∈ MissingColors G + (TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex)) choice.vertex := by + unfold MissingColors + refine Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, ?_⟩ + intro hp + rw [PresentColors] at hp + rcases Finset.mem_filter.mp hp with ⟨_, e, heinc, hecol⟩ + unfold TwoColorComponentSwap at hecol + by_cases hk : Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex) + · simp only [ite_eq_left hk] at hecol + by_cases hg : secondStable e = some gamma + · simp only [ite_eq_left hg] at hecol + apply (Finset.mem_sdiff.mp hgamma).2 + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, heinc, hg⟩ + · simp only [ite_eq_right hg] at hecol + by_cases hc : secondStable e = some choice.color + · simp only [ite_eq_left hc] at hecol + exact hneq (Option.some.inj hecol) + · simp only [ite_eq_right hc] at hecol + exact hc hecol + · simp only [ite_eq_right hk] at hecol + have hbad : e = choice.edge := + (by + by_contra hne + exact (secondStableProper hne ⟨choice.vertex, heinc, choice.edgeIncident⟩ hecol + hedge).elim) + have edgeMember : Sum.inr choice.edge ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inr choice.edge) = + (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl choice.vertex) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj (by + simp [TwoColorIncidenceGraph, choice.edgeIncident, hedge])).symm + exact hk (by simpa [hbad] using edgeMember) + exact hm + have hsub' : TashkinovStoredColors series.data q.succ ⊆ + TashkinovStoredColors series.data q.castSucc ∪ {gamma} := by + intro c hc + have h := hsub hc + rcases Finset.mem_union.mp h with h | h + · exact Finset.mem_union.mpr (Or.inl h) + · rcases Finset.mem_insert.mp h with rfl | h + · have hmc := (storedMem (r := q.succ) (by simp)).mp hc + rw [currentColoring] at hmc + exact (hmc.2 hdelta).elim + · exact Finset.mem_union.mpr (Or.inr h) + calc + _ ≤ (TashkinovStoredColors series.data q.castSucc ∪ {gamma}).card := Finset.card_le_card hsub' + _ ≤ (TashkinovStoredColors series.data q.castSucc).card + 1 := by + simpa using Finset.card_union_le (TashkinovStoredColors series.data q.castSucc) {gamma} + _ ≤ q.val + 1 := by + simpa using Nat.add_le_add_right ih 1 + +private theorem helper_branch_189.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input), ( + ∀ (q : Fin rounds), + ∀ v ∈ TreeSequenceVertexSet (series.data.tree q.castSucc.castSucc), v ∈ TreeSequenceVertexSet + (series.data.tree q.succ.castSucc)) → ( + ∀ (q : Fin rounds), TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree + q.castSucc.castSucc) ⊆ TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc)) → ( + ∀ {phi : PartialEdgeColoring E k} {a b : Fin k} {z : V ⊕ E} {v : V} {c : Fin k}, c ∈ + MissingColors G phi v → c ≠ a → c ≠ b → c ∈ MissingColors G (TwoColorComponentSwap G phi a + b z) v) → ( + ∀ {r : Fin (rounds + (1 : ℕ))} {c : Fin k}, (↑r : ℕ) ≠ (0 : ℕ) → (c ∈ TashkinovStoredColors + series.data r ↔ ( + ∃ (h : Fin (rounds + (1 : ℕ))), (↑h : ℕ) ≤ (↑r : ℕ) ∧ c ∈ series.data.stored h) ∧ c ∉ + TreeMissingColors (series.data.coloring r) (series.data.tree r.castSucc))) → + series.data.stored (0 : Fin (rounds + (1 : ℕ))) = ∅ → + ∀ (q : Fin rounds), (TashkinovStoredColors series.data q.castSucc).card ≤ (↑q.castSucc : ℕ) → + (TashkinovStoredColors series.data q.succ).card ≤ (↑q.succ : ℕ) := by + classical + intro V E _ _ _ G k rounds e0 input series oldVertices missingTransfer swapMissing storedMem + storedZero q ih + have cert := series.certified q.succ + generalize hj : q.succ = j at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero q) hj |>.elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_139 V E inferInstance inferInstance inferInstance G k rounds e0 + input series oldVertices storedMem storedZero q ih ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternative currentColoring currentStored currentEdges currentKind + currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension hj + | RE ci previousProper previousUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_191 V E inferInstance inferInstance inferInstance G k rounds e0 + input series missingTransfer storedMem storedZero q ih ci previousProper + previousUncolored previousClosed previousNotStronglyClosed available + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension hj + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact @helper_branch_295 V E inferInstance inferInstance inferInstance G k rounds e0 + input series oldVertices swapMissing storedMem storedZero q ih ci previousProper + previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails gamma gammaRule secondStable secondStableProper + secondStableRelation exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension hj +theorem TashkinovStoredColorsCardinality {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) (i : Fin (rounds + 1)) : + (TashkinovStoredColors series.data i).card ≤ i.val := by + classical + have vertexTransfer {A B : TreeSequence G e0} + (hab : TreeSequenceInitialSegment A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + rcases hv with ⟨j, hj⟩ + rcases hab with ⟨hlen, hvertices, hedges⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) j, (hvertices j).trans hj⟩ + have augmentationTransfer {A B : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hab : TashkinovAugmentation phi A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + exact vertexTransfer hab.2.1 hv + have closureTransfer {A B : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hab : TashkinovAugmentationSequence phi A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + unfold TashkinovAugmentationSequence at hab + induction hab using Relation.ReflTransGen.head_induction_on with + | refl => exact hv + | head hstep htail ih => exact ih (augmentationTransfer hstep hv) + have priorVertices := @helper_priorVertices_70 V E inferInstance inferInstance inferInstance G k + rounds e0 input series vertexTransfer closureTransfer + have oldVertices : ∀ q : Fin rounds, ∀ v : V, + v ∈ TreeSequenceVertexSet (series.data.tree q.castSucc.castSucc) → + v ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc) := by + intro q v hv + exact priorVertices q v hv + have missingTransfer : + ∀ q : Fin rounds, TreeMissingColors (series.data.coloring q.castSucc) (series.data.tree + q.castSucc.castSucc) ⊆ TreeMissingColors (series.data.coloring q.castSucc) + (series.data.tree q.succ.castSucc) := by + intro q c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨v, hv, hvc⟩ + exact ⟨v, oldVertices q v hv, hvc⟩ + have swapMissing {phi : PartialEdgeColoring E k} {a b : Fin k} {z : Sum V E} + {v : V} {c : Fin k} (hc : c ∈ MissingColors G phi v) + (hca : c ≠ a) (hcb : c ≠ b) : + c ∈ MissingColors G (TwoColorComponentSwap G phi a b z) v := by + unfold MissingColors at hc ⊢ + rw [Finset.mem_sdiff] at hc ⊢ + refine ⟨Finset.mem_univ _, ?_⟩ + intro hp + rw [PresentColors] at hp + rcases Finset.mem_filter.mp hp with ⟨_, e, he, hec⟩ + apply hc.2 + rw [PresentColors] + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, he, ?_⟩ + unfold TwoColorComponentSwap at hec + by_cases hh : Sum.inr e ∈ TwoColorComponent G phi a b z + · simp only [ite_eq_left hh] at hec + by_cases ha : phi e = some a + · simp only [ite_eq_left ha] at hec + exact (hcb (Option.some.inj hec).symm).elim + · by_cases hb : phi e = some b + · simp only [ite_eq_right ha, ite_eq_left hb] at hec + exact (hca (Option.some.inj hec).symm).elim + · simp only [ite_eq_right ha, ite_eq_right hb] at hec + exact hec + · simpa [hh] using hec + have storedMem {r : Fin (rounds + 1)} {c : Fin k} (hr : r.val ≠ 0) : + c ∈ TashkinovStoredColors series.data r ↔ + (∃ h : Fin (rounds + 1), h.val ≤ r.val ∧ c ∈ series.data.stored h) ∧ + c ∉ TreeMissingColors (series.data.coloring r) (series.data.tree r.castSucc) := by + unfold TashkinovStoredColors + simp only [ite_eq_right hr, Finset.mem_sdiff, Finset.mem_biUnion, + Finset.mem_univ, true_and] + constructor + · rintro ⟨hu, hn⟩ + rcases hu with ⟨h, hh⟩ + by_cases hle : h.val ≤ r.val + · exact ⟨⟨h, hle, by simpa [hle] using hh⟩, hn⟩ + · simp [hle] at hh + · rintro ⟨⟨h, hle, hm⟩, hn⟩ + exact ⟨⟨h, by simpa [hle] using hm⟩, hn⟩ + have storedZero : series.data.stored 0 = ∅ := by + have z := series.certified (0 : Fin (rounds + 1)) + cases z with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + exact initialStored + induction i using Fin.induction with + | zero => simp [TashkinovStoredColors] + | succ q ih => + exact @helper_branch_189 V E inferInstance inferInstance inferInstance G k rounds e0 input + series oldVertices missingTransfer swapMissing storedMem storedZero q ih +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovStoredColorsPrefix.lean b/LeanPool/GoldbergSeymour/TashkinovStoredColorsPrefix.lean new file mode 100644 index 0000000000..bf23284b50 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovStoredColorsPrefix.lean @@ -0,0 +1,56 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeriesDataPrefix +public import LeanPool.GoldbergSeymour.TashkinovStoredColors + +/-! +# Tashkinov Stored Colors Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovStoredColorsPrefix {V E : Type*} [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k rounds : ℕ} {e0 : E} + (m : ℕ) (hm : m ≤ rounds) (data : TashkinovSeriesData G k rounds e0) + (i : Fin (m + 1)) : + TashkinovStoredColors (TashkinovSeriesDataPrefix m hm data) i = + TashkinovStoredColors data (Fin.castLE (by omega) i) := by + classical + let _ := Fintype.ofFinite V + unfold TashkinovStoredColors + simp only [TashkinovSeriesDataPrefix] + split <;> rename_i hz + · rw [ite_eq_left] + exact hz + · rw [ite_eq_right] + · congr 1 + ext c + simp only [Finset.mem_biUnion, Finset.mem_univ, true_and] + constructor + · rintro ⟨j, hj⟩ + by_cases hji : j.val ≤ i.val + · refine ⟨Fin.castLE (by omega) j, ?_⟩ + simpa [hji] using hj + · simp [hji] at hj + · rintro ⟨j, hj⟩ + by_cases hji : j.val ≤ i.val + · let j' : Fin (m + 1) := ⟨j.val, by omega⟩ + refine ⟨j', ?_⟩ + simpa [j', hji] using hj + · simp [hji] at hj + · exact hz + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovTree.lean b/LeanPool/GoldbergSeymour/TashkinovTree.lean new file mode 100644 index 0000000000..cf9d275c7d --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovTree.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Tashkinov Tree + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A tree sequence whose later edges have colors missing at an earlier tree vertex. -/ +def TashkinovTree {V E : Type*} [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) : Prop := + ∀ j : Fin T.length, 1 ≤ j.val → + ∃ i : Fin (j.val + 1), + ∃ c : Fin k, phi (T.edge j) = some c ∧ c ∈ MissingColors G phi (T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)))) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovTreeComponentSwapWitnessTransport.lean b/LeanPool/GoldbergSeymour/TashkinovTreeComponentSwapWitnessTransport.lean new file mode 100644 index 0000000000..a01d287450 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovTreeComponentSwapWitnessTransport.lean @@ -0,0 +1,178 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Tashkinov Tree Component Swap Witness Transport + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TashkinovTreeComponentSwapWitnessTransport {V E : Type*} + [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hproper : IsProperEdgeColoring G phi) + (hTash : TashkinovTree G e0 phi T) + (i j : Fin (T.length + 1)) (hij : i.val < j.val) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (ha : alpha ∈ MissingColors G phi (T.vertex i)) + (hb : beta ∈ MissingColors G phi (T.vertex j)) + (hau : TreeColorUnusedThrough phi T alpha j) + (hbu : TreeColorUnusedThrough phi T beta j) : + let C := TwoColorComponent G phi alpha beta (Sum.inl (T.vertex j)) + let phi' := TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex j)) + (∀ r : Fin T.length, 1 ≤ r.val → r.val < j.val → phi' (T.edge r) = phi (T.edge r)) ∧ + (∀ S : TreeSequence G e0, + TreeSequenceInitialSegment S T → S.length = j.val → TashkinovTree G e0 phi' S) ∧ + (Sum.inl (T.vertex i) ∈ C → + (∀ r : Fin T.length, + j.val ≤ r.val → + ∀ w : Fin (r.val + 1), + ∀ c : Fin k, + phi (T.edge r) = some c → + c ∈ + MissingColors G phi + (T.vertex + (Fin.castLT w + (Nat.lt_trans w.isLt (Nat.succ_lt_succ r.isLt)))) → + ∃ w' : Fin (r.val + 1), + ∃ c' : Fin k, + phi' (T.edge r) = some c' ∧ + c' ∈ + MissingColors G phi' + (T.vertex + (Fin.castLT w' + (Nat.lt_trans w'.isLt (Nat.succ_lt_succ r.isLt))))) ∧ + TashkinovTree G e0 phi' T) := by + classical + let _ := Fintype.ofFinite V + dsimp + let C := TwoColorComponent G phi alpha beta (Sum.inl (T.vertex j)) + let phi' := TwoColorComponentSwap G phi alpha beta (Sum.inl (T.vertex j)) + have hbehavior := TwoColorComponentSwapMissingBehavior G phi alpha beta hne hproper + (Sum.inl (T.vertex j)) + have hfixed : ∀ r : Fin T.length, 1 ≤ r.val → r.val < j.val → + phi' (T.edge r) = phi (T.edge r) := by + intro r hr hj + have ha' := hau r hr hj + have hb' := hbu r hr hj + simp [phi', TwoColorComponentSwap, ha', hb'] + refine ⟨hfixed, ?_, ?_⟩ + · intro S hS hlen + rcases hS with ⟨hbound, hvertices, hedges⟩ + intro r hr + have hrj : r.val < j.val := by simpa [hlen] using r.isLt + let rT : Fin T.length := Fin.castLE (by omega) (Fin.cast hlen r) + obtain ⟨q, c, hc, hcm⟩ := hTash rT (by simpa [rT] using hr) + have hrT : 1 ≤ rT.val := by simpa [rT] using hr + have hrTj : rT.val < j.val := by simpa [rT] using hrj + have hca : c ≠ alpha := by + intro hca + apply (hau rT hrT hrTj) + simp [hc, hca] + have hcb : c ≠ beta := by + intro hcb + apply (hbu rT hrT hrTj) + simp [hc, hcb] + let qS : Fin (r.val + 1) := Fin.cast (by simp [rT]) q + let qFull : Fin (S.length + 1) := Fin.castLE (by omega) qS + refine ⟨qS, c, ?_, ?_⟩ + · rw [← hedges r] + have hre : Fin.castLE hbound r = rT := by + apply Fin.ext + simp [rT] + rw [hre] + change phi' (T.edge rT) = some c + exact (hfixed rT hrT hrTj).trans hc + · have hvq := hvertices qFull + have hmissing : c ∈ MissingColors G phi' (T.vertex + (Fin.castLT q (Nat.lt_trans q.isLt (Nat.succ_lt_succ rT.isLt)))) := + (hbehavior.2.2.2 _ c hca hcb).2 hcm + simpa [qFull, qS, rT, hlen] using (hvq ▸ hmissing) + · intro hiC + have hia : beta ∈ MissingColors G phi' (T.vertex i) := + hbehavior.2.1 _ hiC ha + have hjb : alpha ∈ MissingColors G phi' (T.vertex j) := by + have hjC : Sum.inl (T.vertex j) ∈ C := by + change Sum.inl (T.vertex j) ∈ + ((TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl (T.vertex j))).supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + exact hbehavior.2.2.1 _ hjC hb + have transport : + ∀ (r : Fin T.length), j.val ≤ r.val → + ∀ w : Fin (r.val + 1), + ∀ c : Fin k, phi (T.edge r) = some c → c ∈ MissingColors G phi (T.vertex (Fin.castLT w + (Nat.lt_trans w.isLt (Nat.succ_lt_succ r.isLt)))) → + ∃ w' : Fin (r.val + 1), + ∃ c' : Fin k, phi' (T.edge r) = some c' ∧ c' ∈ MissingColors G phi' (T.vertex (Fin.castLT w' + (Nat.lt_trans w'.isLt (Nat.succ_lt_succ r.isLt)))) := by + intro r hr w c he hc + have hir : i.val ≤ r.val := le_trans (Nat.le_of_lt hij) hr + by_cases hca : c = alpha + · by_cases hm : Sum.inr (T.edge r) ∈ C + · refine ⟨⟨i.val, Nat.lt_succ_of_le hir⟩, beta, ?_, ?_⟩ + · simp [phi', C, TwoColorComponentSwap, hm, he, hca] + · simpa using hia + · refine ⟨⟨j.val, Nat.lt_succ_of_le hr⟩, alpha, ?_, ?_⟩ + · simp [phi', C, TwoColorComponentSwap, hm, he, hca] + · simpa using hjb + · by_cases hcb : c = beta + · by_cases hm : Sum.inr (T.edge r) ∈ C + · refine ⟨⟨j.val, Nat.lt_succ_of_le hr⟩, alpha, ?_, ?_⟩ + · simp [phi', C, TwoColorComponentSwap, hm, he, hcb] + · simpa using hjb + · refine ⟨⟨i.val, Nat.lt_succ_of_le hir⟩, beta, ?_, ?_⟩ + · simp [phi', C, TwoColorComponentSwap, hm, he, hcb] + · simpa using hia + · refine ⟨w, c, ?_, ?_⟩ + · by_cases hm : Sum.inr (T.edge r) ∈ C + · simp [phi', C, TwoColorComponentSwap, hm, he, hca, hcb] + · simp [phi', C, TwoColorComponentSwap, hm, he] + · by_cases hw : Sum.inl (T.vertex (Fin.castLT w + (Nat.lt_trans w.isLt (Nat.succ_lt_succ r.isLt)))) ∈ C + · exact (hbehavior.2.2.2 _ c hca hcb).2 hc + · rw [hbehavior.1 _ hw] + exact hc + refine ⟨transport, ?_⟩ + intro r hr + by_cases hjr : r.val < j.val + · obtain ⟨q, c, he, hm⟩ := hTash r hr + exact ⟨q, c, (show phi' (T.edge r) = some c from + (hfixed r (by omega) hjr).trans he), by + have hneac : c ≠ alpha := by + intro h + exact (hau r (by omega) hjr) (h ▸ he) + have hnebc : c ≠ beta := by + intro h + exact (hbu r (by omega) hjr) (h ▸ he) + exact (hbehavior.2.2.2 _ c hneac hnebc).2 hm⟩ + · have hrj : j.val ≤ r.val := by omega + obtain ⟨w, c, he, hm⟩ := hTash r (by omega) + exact transport r hrj w c he hm + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovTreeFromLengthOnePrefix.lean b/LeanPool/GoldbergSeymour/TashkinovTreeFromLengthOnePrefix.lean new file mode 100644 index 0000000000..51c4c88321 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovTreeFromLengthOnePrefix.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +/-! +# Tashkinov Tree From Length One Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +lemma TashkinovTreeFromLengthOnePrefix + {V E : Type*} [Finite V] [Fintype E] {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (htree : TashkinovTree G e0 phi T) : + TashkinovAugmentationSequence phi (TreeSequencePrefix T 1 (by omega) T.positive) T := by + classical + let _ := Fintype.ofFinite V + let pref (q : Nat) (hq : 1 <= q) (hqT : q <= T.length) := + TreeSequencePrefix T q hq hqT + have step : forall (q : Nat) (hq : 1 <= q) (hqT : q < T.length), + TashkinovAugmentation phi + (pref q hq (Nat.le_of_lt hqT)) + (pref (q + 1) (by omega) (by omega)) := by + intro q hq hqT + let A := pref q hq (Nat.le_of_lt hqT) + let B := pref (q + 1) (by omega) (by omega) + let j : Fin T.length := ⟨q, hqT⟩ + obtain ⟨i, c, hcolor, hmissing⟩ := htree j hq + have hlen : B.length = A.length + 1 := by + change q + 1 = q + 1 + rfl + refine ⟨hlen, ?_, c, ?_, ?_⟩ + · refine ⟨?_, ?_, ?_⟩ + · change q <= q + 1 + omega + · intro x + change T.vertex _ = T.vertex _ + congr 1 + · intro x + change T.edge _ = T.edge _ + congr 1 + · have hedge : + B.edge (Fin.cast hlen.symm (Fin.last A.length)) = T.edge j := by + change T.edge _ = T.edge _ + congr 1 + change phi (B.edge (Fin.cast hlen.symm (Fin.last A.length))) = some c + rw [hedge] + exact hcolor + · change c ∈ TreeMissingColors phi A + unfold TreeMissingColors + apply Finset.mem_biUnion.mpr + refine ⟨T.vertex (Fin.castLT i (Nat.lt_trans i.isLt + (Nat.succ_lt_succ hqT))), ?_, hmissing⟩ + rw [TreeSequenceVertexSet] + apply (@Finset.mem_image _ _ (Classical.decEq V)).mpr + refine ⟨i, Finset.mem_univ _, ?_⟩ + change T.vertex _ = T.vertex _ + congr 1 + have build : forall (q : Nat) (hq : 1 <= q) (hqT : q <= T.length), + TashkinovAugmentationSequence phi + (pref 1 (by omega) T.positive) (pref q hq hqT) := by + intro q + induction q with + | zero => intro hq; omega + | succ q ih => + intro hq hqT + by_cases hq0 : q = 0 + · subst q + exact Relation.ReflTransGen.refl + · have hqpos : 1 <= q := by omega + have hqle : q <= T.length := by omega + have hqlt : q < T.length := by omega + exact Relation.ReflTransGen.tail (ih hqpos hqle) + (step q hqpos hqlt) + have hfull := build T.length T.positive (le_refl T.length) + have prefixFull : pref T.length T.positive (le_refl T.length) = T := by + cases T + rfl + simpa [pref, prefixFull] using hfull + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Tchange.lean b/LeanPool/GoldbergSeymour/Tchange.lean new file mode 100644 index 0000000000..d06f9c48f1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/Tchange.lean @@ -0,0 +1,194 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ElementaryClosedExitPairExtendsTriple +public import LeanPool.GoldbergSeymour.ElementaryClosedNoninterchangeableExitPair + +public import LeanPool.GoldbergSeymour.TchangeKempeClosurePreparation +public import LeanPool.GoldbergSeymour.TchangeOutsideSwapPreparation +public import LeanPool.GoldbergSeymour.TchangeStrictShortening + +/-! +# Tchange + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem Tchange {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (htriple : KTriple G k e0 phi) + (hT : TashkinovTree G e0 phi T) + (hclosed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T)) + (alpha beta : Fin k) + (hmissing : alpha ∈ TreeMissingColors phi T ∨ + beta ∈ TreeMissingColors phi T) : + TreeInterchangeable G T phi alpha beta := by + classical + by_cases heq : alpha = beta + · subst beta + simp [TreeInterchangeable, TwoColorPathComponent] + by_contra hnot + have helementary : + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := + TashTree G k e0 phi T htriple hT + have graphSwap : + TwoColorIncidenceGraph G phi alpha beta = + TwoColorIncidenceGraph G phi beta alpha := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + have componentSwap (z : Sum V E) : + TwoColorComponent G phi alpha beta z = + TwoColorComponent G phi beta alpha z := by + unfold TwoColorComponent + rw [graphSwap] + have pathSwap (z : Sum V E) : + TwoColorPathComponent G phi alpha beta z ↔ + TwoColorPathComponent G phi beta alpha z := by + simp [TwoColorPathComponent, componentSwap, graphSwap, ne_comm] + have interchangeSwap : + TreeInterchangeable G T phi alpha beta ↔ + TreeInterchangeable G T phi beta alpha := by + constructor + · intro h z w hz hw hzT hwT + have hz' := (pathSwap z).mpr hz + have hw' := (pathSwap w).mpr hw + obtain ⟨vz, hvz, hzmem⟩ := hzT + obtain ⟨vw, hvw, hwmem⟩ := hwT + have hzT' : ∃ v ∈ TreeSequenceVertexSet T, + Sum.inl v ∈ TwoColorComponent G phi alpha beta z := + ⟨vz, hvz, by rw [componentSwap z]; exact hzmem⟩ + have hwT' : ∃ v ∈ TreeSequenceVertexSet T, + Sum.inl v ∈ TwoColorComponent G phi alpha beta w := + ⟨vw, hvw, by rw [componentSwap w]; exact hwmem⟩ + exact (componentSwap z).symm.trans + ((h z w hz' hw' hzT' hwT').trans (componentSwap w)) + · intro h z w hz hw hzT hwT + have hz' := (pathSwap z).mp hz + have hw' := (pathSwap w).mp hw + obtain ⟨vz, hvz, hzmem⟩ := hzT + obtain ⟨vw, hvw, hwmem⟩ := hwT + have hzT' : ∃ v ∈ TreeSequenceVertexSet T, + Sum.inl v ∈ TwoColorComponent G phi beta alpha z := + ⟨vz, hvz, by rw [← componentSwap z]; exact hzmem⟩ + have hwT' : ∃ v ∈ TreeSequenceVertexSet T, + Sum.inl v ∈ TwoColorComponent G phi beta alpha w := + ⟨vw, hvw, by rw [← componentSwap w]; exact hwmem⟩ + exact (componentSwap z).trans + ((h z w hz' hw' hzT' hwT').trans (componentSwap w).symm) + have boundaryEmpty (c : Fin k) (hc : c ∈ TreeMissingColors phi T) : + BoundaryColorEdges G phi (TreeSequenceVertexSet T) c = ∅ := by + apply Finset.eq_empty_iff_forall_notMem.mpr + intro f hf + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hc + have hdata := Finset.mem_filter.mp hf + exact (hclosed hdata.1 hv hdata.2) hvm + have buildCounterexample (a b : Fin k) (hab : a ≠ b) + (ha : a ∈ TreeMissingColors phi T) + (hn : ¬ TreeInterchangeable G T phi a b) : + Nonempty (TchangeCounterexample G k e0) := by + have haclosed : TreeColorSetClosed G phi T {a} := by + intro c hc + have hca : c = a := by simpa using hc + subst c + exact boundaryEmpty a ha + obtain ⟨a1, b1, a2, b2, P1, P2, f1, f2, hP1, hP2, + h12, ha12, hb12, hf1, hf2, hi1, hi2, hs1, hs2⟩ := + ElementaryClosedNoninterchangeableExitPair G T phi htriple.2.2.2.1 + helementary a b hab ha haclosed hn + have hb : b ∉ TreeMissingColors phi T := by + intro hb + have hempty := boundaryEmpty b hb + rw [hempty] at hf1 + simp at hf1 + obtain ⟨a3, b3, P3, f3, hP3, h13, h23, ha31, ha32, hb31, hb32, + hf3, hi3, hs3⟩ := + ElementaryClosedExitPairExtendsTriple G T phi htriple.2.2.2.1 + helementary a b hab ha haclosed hb a1 b1 a2 b2 P1 P2 hP1 hP2 + h12 ha12 hb12 + exact ⟨{ + phi := phi + T := T + a := a + b := b + colorsDistinct := hab + triple := htriple + tree := hT + closed := hclosed + aMissing := ha + bNotMissing := hb + a1 := a1 + b1 := b1 + a2 := a2 + b2 := b2 + a3 := a3 + b3 := b3 + P1 := P1 + P2 := P2 + P3 := P3 + exit1 := hP1 + exit2 := hP2 + exit3 := hP3 + disjoint12 := h12 + disjoint13 := h13 + disjoint23 := h23 + remote12 := ha12 + remote13 := ha31.symm + remote23 := ha32.symm + tree12 := hb12 + tree13 := hb31.symm + tree23 := hb32.symm + f1 := f1 + f2 := f2 + f3 := f3 + boundary1 := hf1 + boundary2 := hf2 + boundary3 := hf3 + incident1 := hi1 + incident2 := hi2 + incident3 := hi3 + support1 := hs1 + support2 := hs2 + support3 := hs3 }⟩ + have initial : Nonempty (TchangeCounterexample G k e0) := by + by_cases ha : alpha ∈ TreeMissingColors phi T + · exact buildCounterexample alpha beta heq ha hnot + · have hb : beta ∈ TreeMissingColors phi T := hmissing.resolve_left ha + have hnot' : ¬ TreeInterchangeable G T phi beta alpha := by + intro h + exact hnot (interchangeSwap.mpr h) + exact buildCounterexample beta alpha (fun h => heq h.symm) hb hnot' + have descend : ∀ C : TchangeCounterexample G k e0, + ∃ D : TchangeCounterexample G k e0, + TchangeCounterexampleMeasure D < TchangeCounterexampleMeasure C := by + intro C + obtain ⟨C1, _, _, _, hgamma, h13, h23, hmeasure⟩ := + TchangeOutsideSwapPreparation C + obtain ⟨K⟩ := TchangeKempeClosurePreparation C1 hgamma h13 h23 + obtain ⟨D, hshort⟩ := TchangeStrictShortening C1 K + exact ⟨D, by omega⟩ + obtain ⟨C0⟩ := initial + let P : Nat → Prop := fun n => ∃ C : TchangeCounterexample G k e0, + TchangeCounterexampleMeasure C = n + have hex : ∃ n, P n := + ⟨TchangeCounterexampleMeasure C0, C0, rfl⟩ + obtain ⟨Cmin, hmin⟩ := Nat.find_spec hex + obtain ⟨D, hshort⟩ := descend Cmin + have hleast : Nat.find hex ≤ TchangeCounterexampleMeasure D := + Nat.find_min' hex ⟨D, rfl⟩ + dsimp [P] at hmin + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TchangeCounterexample.lean b/LeanPool/GoldbergSeymour/TchangeCounterexample.lean new file mode 100644 index 0000000000..9006543e15 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TchangeCounterexample.lean @@ -0,0 +1,93 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed + +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeMissingColors + +/-! +# Tchange Counterexample + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A closed Tashkinov tree with three disjoint exit paths for a fixed pair of colors. -/ +structure TchangeCounterexample {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : Nat) (e0 : E) where + /-- The generating partial coloring. -/ + phi : PartialEdgeColoring E k + /-- The underlying ordered tree. -/ + T : TreeSequence G e0 + /-- The first color of the two-color exit configuration. -/ + a : Fin k + /-- The second color of the two-color exit configuration. -/ + b : Fin k + colorsDistinct : a ≠ b + triple : KTriple G k e0 phi + tree : TashkinovTree G e0 phi T + closed : ColoredVertexSetClosed G phi (TreeSequenceVertexSet T) + aMissing : a ∈ TreeMissingColors phi T + bNotMissing : b ∉ TreeMissingColors phi T + /-- The outside endpoint of the first exit path. -/ + a1 : V + /-- The inside endpoint of the first exit path. -/ + b1 : V + /-- The outside endpoint of the second exit path. -/ + a2 : V + /-- The inside endpoint of the second exit path. -/ + b2 : V + /-- The outside endpoint of the third exit path. -/ + a3 : V + /-- The inside endpoint of the third exit path. -/ + b3 : V + /-- The first two-color exit walk. -/ + P1 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a1) (Sum.inl b1) + /-- The second two-color exit walk. -/ + P2 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a2) (Sum.inl b2) + /-- The third two-color exit walk. -/ + P3 : (TwoColorIncidenceGraph G phi a b).Walk (Sum.inl a3) (Sum.inl b3) + exit1 : TreeExitPath T phi a b a1 b1 P1 + exit2 : TreeExitPath T phi a b a2 b2 P2 + exit3 : TreeExitPath T phi a b a3 b3 P3 + disjoint12 : ∀ x, x ∈ P1.support → x ∉ P2.support + disjoint13 : ∀ x, x ∈ P1.support → x ∉ P3.support + disjoint23 : ∀ x, x ∈ P2.support → x ∉ P3.support + remote12 : a1 ≠ a2 + remote13 : a1 ≠ a3 + remote23 : a2 ≠ a3 + tree12 : b1 ≠ b2 + tree13 : b1 ≠ b3 + tree23 : b2 ≠ b3 + /-- The first selected boundary edge. -/ + f1 : E + /-- The second selected boundary edge. -/ + f2 : E + /-- The third selected boundary edge. -/ + f3 : E + boundary1 : f1 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b + boundary2 : f2 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b + boundary3 : f3 ∈ BoundaryColorEdges G phi (TreeSequenceVertexSet T) b + incident1 : Incident G b1 f1 + incident2 : Incident G b2 f2 + incident3 : Incident G b3 f3 + support1 : Sum.inr f1 ∈ P1.support + support2 : Sum.inr f2 ∈ P2.support + support3 : Sum.inr f3 ∈ P3.support + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TchangeCounterexampleMeasure.lean b/LeanPool/GoldbergSeymour/TchangeCounterexampleMeasure.lean new file mode 100644 index 0000000000..62fe84ef78 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TchangeCounterexampleMeasure.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TchangeCounterexample + +/-! +# Tchange Counterexample Measure + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The sum of the three exit-path lengths in a color-change counterexample. -/ +def TchangeCounterexampleMeasure {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (C : TchangeCounterexample G k e0) : Nat := + C.P1.length + C.P2.length + C.P3.length + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TchangeKempeClosureData.lean b/LeanPool/GoldbergSeymour/TchangeKempeClosureData.lean new file mode 100644 index 0000000000..0ed5a0581c --- /dev/null +++ b/LeanPool/GoldbergSeymour/TchangeKempeClosureData.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TchangeCounterexample + +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap + +/-! +# Tchange Kempe Closure Data + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The swapped coloring, successive augmentations and transported exit paths used in the color- +change argument. +-/ +structure TchangeKempeClosureData {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (C : TchangeCounterexample G k e0) where + /-- The replacement coloring constrained by this certificate. -/ + sigma : PartialEdgeColoring E k + /-- The initial tree prefix before the component-swap augmentations. -/ + baseTree : TreeSequence G e0 + /-- The tree after the first augmentation. -/ + oneTree : TreeSequence G e0 + /-- The tree after the second augmentation. -/ + twoTree : TreeSequence G e0 + /-- The closed tree reached by the subsequent augmentation sequence. -/ + closedTree : TreeSequence G e0 + sigmaEq : sigma = TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3) + baseInitial : TreeSequenceInitialSegment baseTree C.T + baseLast : baseTree.vertex (Fin.last baseTree.length) = C.b3 + b1InBase : C.b1 ∈ TreeSequenceVertexSet baseTree + b2InBase : C.b2 ∈ TreeSequenceVertexSet baseTree + baseIsTree : TashkinovTree G e0 sigma baseTree + firstAugmentation : TashkinovAugmentation sigma baseTree oneTree + secondAugmentation : TashkinovAugmentation sigma oneTree twoTree + closureRoute : TashkinovClosure sigma twoTree closedTree + triple : KTriple G k e0 sigma + closureTree : TashkinovTree G e0 sigma closedTree + closureClosed : ColoredVertexSetClosed G sigma (TreeSequenceVertexSet closedTree) + closureElementary : ColoredVertexSetElementary G sigma (TreeSequenceVertexSet closedTree) + betaMissing : C.b ∈ MissingColors G sigma C.b3 + b1InClosure : C.b1 ∈ TreeSequenceVertexSet closedTree + b2InClosure : C.b2 ∈ TreeSequenceVertexSet closedTree + b3InClosure : C.b3 ∈ TreeSequenceVertexSet closedTree + a1Outside : C.a1 ∉ TreeSequenceVertexSet closedTree + a2Outside : C.a2 ∉ TreeSequenceVertexSet closedTree + a3Outside : C.a3 ∉ TreeSequenceVertexSet closedTree + f1EndsInside : ∀ v, Incident G v C.f1 → v ∈ TreeSequenceVertexSet closedTree + /-- The first two-color exit walk. -/ + Q1 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl C.b1) + /-- The second two-color exit walk. -/ + Q2 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a2) (Sum.inl C.b2) + /-- The third two-color exit walk. -/ + Q3 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a3) (Sum.inl C.b3) + exit1 : TreeExitPath C.T sigma C.a C.b C.a1 C.b1 Q1 + exit2 : TreeExitPath C.T sigma C.a C.b C.a2 C.b2 Q2 + exit3 : TreeExitPath C.T sigma C.a C.b C.a3 C.b3 Q3 + support1 : Q1.support = C.P1.support + support2 : Q2.support = C.P2.support + support3 : Q3.support = C.P3.support + length1 : Q1.length = C.P1.length + length2 : Q2.length = C.P2.length + length3 : Q3.length = C.P3.length + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TchangeKempeClosurePreparation.lean b/LeanPool/GoldbergSeymour/TchangeKempeClosurePreparation.lean new file mode 100644 index 0000000000..3ac0b73d96 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TchangeKempeClosurePreparation.lean @@ -0,0 +1,1045 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.TashTree +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TashkinovClosureExists +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TchangeKempeClosureData +public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeVertexOrder +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo + +/-! +# Tchange Kempe Closure Preparation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_graphEq_137.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let _ : Set (V ⊕ E) := TwoColorComponent G C.phi C.a C.b (Sum.inl C.b3); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + TwoColorIncidenceGraph G sigma C.a C.b = TwoColorIncidenceGraph G C.phi C.a C.b := by + classical + intro V E _ _ _ _ G k e0 C component sigma + ext x y + cases x with + | inl v => + cases y with + | inl w => simp [TwoColorIncidenceGraph] + | inr f => + simp only [TwoColorIncidenceGraph, sigma] + by_cases hf : Sum.inr f ∈ component + · by_cases hfa : C.phi f = some C.a + · simp [TwoColorComponentSwap, component, hf, hfa, + C.colorsDistinct, C.colorsDistinct.symm] + · by_cases hfb : C.phi f = some C.b + · simp [TwoColorComponentSwap, component, hf, hfb, + C.colorsDistinct, C.colorsDistinct.symm] + · simp [TwoColorComponentSwap, component, hf, hfa, hfb] + · simp [TwoColorComponentSwap, component, hf] + | inr f => + cases y with + | inl v => + simp only [TwoColorIncidenceGraph, sigma] + by_cases hf : Sum.inr f ∈ component + · by_cases hfa : C.phi f = some C.a + · simp [TwoColorComponentSwap, component, hf, hfa, + C.colorsDistinct, C.colorsDistinct.symm] + · by_cases hfb : C.phi f = some C.b + · simp [TwoColorComponentSwap, component, hf, hfb, + C.colorsDistinct, C.colorsDistinct.symm] + · simp [TwoColorComponentSwap, component, hf, hfa, hfb] + · simp [TwoColorComponentSwap, component, hf] + | inr g => simp [TwoColorIncidenceGraph] + +private theorem helper_fixedBefore_250.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let component : Set (V ⊕ E) := TwoColorComponent G C.phi C.a C.b (Sum.inl C.b3); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); ( + ∀ w ∈ TreeSequenceVertexSet C.T, Sum.inl w ∈ component ↔ w = C.b3) → + ∀ (_ : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl C.b1)) (_ : + (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a2) (Sum.inl C.b2)) (_ : + (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a3) (Sum.inl C.b3)) (_ i3 : Fin + (C.T.length + (1 : ℕ))), C.T.vertex i3 = C.b3 → + ∀ (_ : Fin (C.T.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) (hi3le : (↑i3 : ℕ) ≤ + C.T.length), + let baseTree : TreeSequence G e0 := TreeSequencePrefix C.T (↑i3 : ℕ) hi3pos hi3le; + baseTree.length = (↑i3 : ℕ) → ( + ∀ (r : Fin (C.T.length + (1 : ℕ))), C.T.vertex r ∈ TreeSequenceVertexSet C.T) → + ∀ (r : Fin C.T.length), (↑r : ℕ) < (↑i3 : ℕ) → sigma (C.T.edge r) = C.phi (C.T.edge r) := by + classical + intro V E _ _ _ _ G k e0 C component sigma hcomponentTree Q1 Q2 Q3 i1 i3 hi3 i2 hi3pos hi3le + baseTree hbaseLen fullVertexMem r hr3 + by_cases he : Sum.inr (C.T.edge r) ∈ component + · by_cases hea : C.phi (C.T.edge r) = some C.a + · obtain ⟨q, hq⟩ := C.T.attaches r + let qFull : Fin (C.T.length + 1) := + Fin.castLT q (Nat.lt_trans q.isLt (Nat.succ_lt_succ r.isLt)) + have hincident : Incident G (C.T.vertex qFull) (C.T.edge r) := by + rw [Incident, hq] + simp [qFull] + have hadj : (TwoColorIncidenceGraph G C.phi C.a C.b).Adj + (Sum.inl (C.T.vertex qFull)) (Sum.inr (C.T.edge r)) := by + exact ⟨hincident, Or.inl hea⟩ + have hqComponent : Sum.inl (C.T.vertex qFull) ∈ component := by + change (TwoColorIncidenceGraph G C.phi C.a C.b).connectedComponentMk + (Sum.inl (C.T.vertex qFull)) = + (TwoColorIncidenceGraph G C.phi C.a C.b).connectedComponentMk + (Sum.inl C.b3) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans he + have hqb3 := (hcomponentTree _ (fullVertexMem qFull)).mp hqComponent + have hqi3 : qFull = i3 := C.T.vertex_injective (hqb3.trans hi3.symm) + have : qFull.val < i3.val := by + dsimp [qFull] + omega + omega + · by_cases heb : C.phi (C.T.edge r) = some C.b + · obtain ⟨q, hq⟩ := C.T.attaches r + let qFull : Fin (C.T.length + 1) := + Fin.castLT q (Nat.lt_trans q.isLt (Nat.succ_lt_succ r.isLt)) + have hincident : Incident G (C.T.vertex qFull) (C.T.edge r) := by + rw [Incident, hq] + simp [qFull] + have hadj : (TwoColorIncidenceGraph G C.phi C.a C.b).Adj + (Sum.inl (C.T.vertex qFull)) (Sum.inr (C.T.edge r)) := by + exact ⟨hincident, Or.inr heb⟩ + have hqComponent : Sum.inl (C.T.vertex qFull) ∈ component := by + change (TwoColorIncidenceGraph G C.phi C.a C.b).connectedComponentMk + (Sum.inl (C.T.vertex qFull)) = + (TwoColorIncidenceGraph G C.phi C.a C.b).connectedComponentMk + (Sum.inl C.b3) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans he + have hqb3 := (hcomponentTree _ (fullVertexMem qFull)).mp hqComponent + have hqi3 : qFull = i3 := C.T.vertex_injective (hqb3.trans hi3.symm) + have : qFull.val < i3.val := by + dsimp [qFull] + omega + omega + · simp [sigma, TwoColorComponentSwap, component, he, hea, heb] + · simp [sigma, TwoColorComponentSwap, component, he] + +private theorem helper_hbaseTree_302.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let component : Set (V ⊕ E) := TwoColorComponent G C.phi C.a C.b (Sum.inl C.b3); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + IsProperEdgeColoring G C.phi → ( + ∀ w ∈ TreeSequenceVertexSet C.T, Sum.inl w ∈ component ↔ w = C.b3) → + ∀ (_ : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl C.b1)) (_ : + (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a2) (Sum.inl C.b2)) (_ : + (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a3) (Sum.inl C.b3)) (_ i3 : Fin + (C.T.length + (1 : ℕ))), C.T.vertex i3 = C.b3 → + ∀ (_ : Fin (C.T.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) (hi3le : (↑i3 : ℕ) ≤ + C.T.length), + let baseTree : TreeSequence G e0 := TreeSequencePrefix C.T (↑i3 : ℕ) hi3pos hi3le; + baseTree.length = (↑i3 : ℕ) → TreeSequenceInitialSegment baseTree C.T → ( + ∀ (r : Fin (C.T.length + (1 : ℕ))), C.T.vertex r ∈ TreeSequenceVertexSet C.T) → ( + ∀ (r : Fin C.T.length), (↑r : ℕ) < (↑i3 : ℕ) → sigma (C.T.edge r) = C.phi (C.T.edge r)) → + TashkinovTree G e0 sigma baseTree := by + classical + intro V E _ _ _ _ G k e0 C component sigma hproper hcomponentTree Q1 Q2 Q3 i1 i3 hi3 i2 hi3pos + hi3le baseTree hbaseLen hbaseInitial fullVertexMem fixedBefore r hr + let rFull : Fin C.T.length := ⟨r.val, by rw [hbaseLen] at r; omega⟩ + obtain ⟨q, c, hcolor, hmiss⟩ := C.tree rFull (by simpa [rFull] using hr) + let qFull : Fin (C.T.length + 1) := + Fin.castLT q (Nat.lt_trans q.isLt (Nat.succ_lt_succ rFull.isLt)) + have hrBefore : r.val < i3.val := by + rw [← hbaseLen] + exact r.isLt + have hqBefore : qFull.val < i3.val := by + have hrFull : rFull.val = r.val := rfl + have hq : q.val < r.val + 1 := by + calc + q.val < rFull.val + 1 := q.isLt + _ = r.val + 1 := by rw [hrFull] + change q.val < i3.val + omega + have hqOutside : Sum.inl (C.T.vertex qFull) ∉ component := by + intro hqComponent + have hqb3 := (hcomponentTree _ (fullVertexMem qFull)).mp hqComponent + have hqi3 : qFull = i3 := C.T.vertex_injective (hqb3.trans hi3.symm) + omega + have hmissSigma : c ∈ MissingColors G sigma (C.T.vertex qFull) := by + rw [(TwoColorComponentSwapMissingBehavior G C.phi C.a C.b + C.colorsDistinct hproper (Sum.inl C.b3)).1 _ hqOutside] + exact hmiss + let qBase : Fin (r.val + 1) := Fin.cast (by simp [rFull]) q + refine ⟨qBase, c, ?_, ?_⟩ + · have hedgeBase := hbaseInitial.2.2 r + have hrEq : Fin.castLE hbaseInitial.1 r = rFull := by + apply Fin.ext + rfl + rw [hrEq] at hedgeBase + rw [← hedgeBase] + exact (fixedBefore rFull (by dsimp [rFull]; rw [hbaseLen] at r; omega)).trans + hcolor + · have hvertexBase := hbaseInitial.2.1 + (Fin.castLT qBase + (Nat.lt_trans qBase.isLt (Nat.succ_lt_succ r.isLt))) + have hindex : Fin.castLE (Nat.succ_le_succ hbaseInitial.1) + (Fin.castLT qBase + (Nat.lt_trans qBase.isLt (Nat.succ_lt_succ r.isLt))) = qFull := by + apply Fin.ext + rfl + rw [hindex] at hvertexBase + simpa [hvertexBase] using hmissSigma + +private theorem helper_componentContained_600.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + ∀ (twoTree closedTree : TreeSequence G e0), TashkinovClosure sigma twoTree closedTree → ( + ∀ {f : E} {x y : V}, Incident G x f → Incident G y f → x ≠ y → G.ends f = s(x, y)) → + ∀ root ∈ TreeSequenceVertexSet closedTree, C.a ∈ TreeMissingColors sigma closedTree → C.b ∈ + TreeMissingColors sigma closedTree → + ∀ (w : V), Sum.inl w ∈ TwoColorComponent G sigma C.a C.b (Sum.inl root) → w ∈ + TreeSequenceVertexSet closedTree := by + classical + intro V E _ _ _ _ G k e0 C sigma twoTree closedTree hclosure endsEqOfIncidents root hroot + haTree hbTree + obtain ⟨wa, hwa, hwaMissing⟩ := by + simpa [TreeMissingColors] using haTree + obtain ⟨wb, hwb, hwbMissing⟩ := by + simpa [TreeMissingColors] using hbTree + let H := TwoColorIncidenceGraph G sigma C.a C.b + let insideNode : Sum V E → Prop := fun z => + match z with + | Sum.inl v => v ∈ TreeSequenceVertexSet closedTree + | Sum.inr f => ∀ v, Incident G v f → + v ∈ TreeSequenceVertexSet closedTree + have neighborClosed : ∀ x, insideNode x → ∀ y, H.Adj x y → + insideNode y := by + intro x hx y hxy + cases x with + | inl v => + cases y with + | inl w => simp [H, TwoColorIncidenceGraph] at hxy + | inr f => + have hdata : Incident G v f ∧ + (sigma f = some C.a ∨ sigma f = some C.b) := by + simpa [H, TwoColorIncidenceGraph] using hxy + intro w hwf + by_contra hw + have hvw : v ≠ w := by + intro hvw + exact hw (hvw ▸ hx) + have hfBoundary : f ∈ BoundaryEdges G + (TreeSequenceVertexSet closedTree) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨v, hx, w, hw, + endsEqOfIncidents hdata.1 hwf hvw⟩ + rcases hdata.2 with hfa | hfb + · exact (hclosure.2 hfBoundary hwa hfa) hwaMissing + · exact (hclosure.2 hfBoundary hwb hfb) hwbMissing + | inr f => + cases y with + | inl v => + have hinc : Incident G v f := by + have hdata : Incident G v f ∧ + (sigma f = some C.a ∨ sigma f = some C.b) := by + simpa [H, TwoColorIncidenceGraph] using hxy + exact hdata.1 + exact hx v hinc + | inr g => simp [H, TwoColorIncidenceGraph] at hxy + intro w hwComponent + have reach : H.Reachable (Sum.inl root) (Sum.inl w) := by + change H.connectedComponentMk (Sum.inl w) = + H.connectedComponentMk (Sum.inl root) at hwComponent + exact SimpleGraph.ConnectedComponent.exact hwComponent |>.symm + have hwInside : insideNode (Sum.inl w) := by + apply reach.mem_subgraphVerts + (H := (⊤ : H.Subgraph).induce {z | insideNode z}) + (fun x hx y hadj => + ⟨by simpa using hx, + neighborClosed x (by simpa using hx) y hadj, + hadj⟩) + (by simpa [insideNode] using hroot) + simpa [insideNode] using hwInside + +private theorem helper_oneVertexCases_629.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + ∀ (_ : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl C.b1)) (_ : + (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a2) (Sum.inl C.b2)) (_ : + (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a3) (Sum.inl C.b3)) (_ i3 _ : Fin + (C.T.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) (hi3le : (↑i3 : ℕ) ≤ C.T.length), + let baseTree : TreeSequence G e0 := TreeSequencePrefix C.T (↑i3 : ℕ) hi3pos hi3le; + ∀ (x1 : V) (oneTree : TreeSequence G e0), oneTree.length = baseTree.length + (1 : ℕ) → + TreeSequenceInitialSegment baseTree oneTree → + let new1 : V := oneTree.vertex (Fin.last oneTree.length); new1 = x1 → + ∀ {v : V}, v ∈ TreeSequenceVertexSet oneTree → v ∈ TreeSequenceVertexSet baseTree ∨ v = x1 := by + classical + intro V E _ _ _ _ G k e0 C sigma Q1 Q2 Q3 i1 i3 i2 hi3pos hi3le baseTree x1 oneTree hlen1 hseg1 + new1 hnew1 v hv + have hv' : v ∈ Finset.image oneTree.vertex Finset.univ := by + simpa [TreeSequenceVertexSet] using hv + obtain ⟨r, _, hr⟩ := Finset.mem_image.mp hv' + by_cases hold : r.val ≤ baseTree.length + · let q : Fin (baseTree.length + 1) := ⟨r.val, by omega⟩ + left + have hrq : r = Fin.castLE (Nat.succ_le_succ hseg1.1) q := by + apply Fin.ext + rfl + have hq : baseTree.vertex q = v := by + rw [← hseg1.2.1 q, ← hrq] + exact hr + simpa [TreeSequenceVertexSet] using + (Finset.mem_image.mpr ⟨q, Finset.mem_univ _, hq⟩) + · right + have hlast : r = Fin.last oneTree.length := by + apply Fin.ext + simp [hlen1] + omega + rw [hlast] at hr + exact hr.symm.trans hnew1 + +private theorem helper_remoteOutside_770.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + C.a ∈ MissingColors G sigma C.a1 ∨ C.b ∈ MissingColors G sigma C.a1 → C.a ∈ MissingColors + G sigma C.a2 ∨ C.b ∈ MissingColors G sigma C.a2 → + ∀ (closedTree : TreeSequence G e0), ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + closedTree) → ( + ∀ {a : V}, a ∈ TreeSequenceVertexSet closedTree → a ≠ C.b3 → C.b ∉ MissingColors G sigma a) → + (C.a ∈ TreeMissingColors sigma closedTree → C.a1 ∈ TreeSequenceVertexSet closedTree ∧ C.a2 + ∈ TreeSequenceVertexSet closedTree ∧ C.a3 ∈ TreeSequenceVertexSet closedTree) → + ∀ a ∉ TreeSequenceVertexSet C.T, C.a ∈ MissingColors G sigma a ∨ C.b ∈ MissingColors G sigma a + → a ∉ TreeSequenceVertexSet closedTree := by + classical + intro V E _ _ _ _ G k e0 C sigma hremote1 hremote2 closedTree hclosedElementary remoteNotB + allRemoteInside a haOld haremote haClosed + have hab3 : a ≠ C.b3 := by + intro h + exact haOld (h ▸ C.exit3.2.2.2.1) + have haMissing : C.a ∈ MissingColors G sigma a := + haremote.resolve_right (remoteNotB haClosed hab3) + have haTree : C.a ∈ TreeMissingColors sigma closedTree := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨a, haClosed, haMissing⟩ + obtain ⟨ha1, ha2, ha3⟩ := allRemoteInside haTree + have ha1b3 : C.a1 ≠ C.b3 := by + intro h + exact C.exit1.2.2.1 (h ▸ C.exit3.2.2.2.1) + have ha2b3 : C.a2 ≠ C.b3 := by + intro h + exact C.exit2.2.2.1 (h ▸ C.exit3.2.2.2.1) + have ha1Missing : C.a ∈ MissingColors G sigma C.a1 := + hremote1.resolve_right (remoteNotB ha1 ha1b3) + have ha2Missing : C.a ∈ MissingColors G sigma C.a2 := + hremote2.resolve_right (remoteNotB ha2 ha2b3) + exact (Finset.disjoint_left.mp + (hclosedElementary ha1 ha2 C.remote12) ha1Missing ha2Missing) + +private theorem helper_transferExit_476.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + TwoColorIncidenceGraph G sigma C.a C.b = TwoColorIncidenceGraph G C.phi C.a C.b → + ∀ {u v : V} (p : (TwoColorIncidenceGraph G C.phi C.a C.b).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath C.T C.phi C.a C.b u v p → C.a ∈ MissingColors G sigma u ∨ C.b ∈ MissingColors + G sigma u → + ∃ (q : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl u) (Sum.inl v)), TreeExitPath + C.T sigma C.a C.b u v q ∧ q.support = p.support ∧ q.length = p.length := by + classical + intro V E _ _ _ _ G k e0 C sigma graphEq u v p hexit hremote + have hedges : ∀ z, z ∈ p.edges → + z ∈ (TwoColorIncidenceGraph G sigma C.a C.b).edgeSet := by + intro z hz + rw [graphEq] + exact p.edges_subset_edgeSet hz + let q := p.transfer (TwoColorIncidenceGraph G sigma C.a C.b) hedges + refine ⟨q, ?_, ?_, ?_⟩ + · unfold TreeExitPath + refine ⟨hexit.1.transfer hedges, ?_, hexit.2.2.1, + hexit.2.2.2.1, hremote, ?_⟩ + · simpa [q] using hexit.2.1 + · intro w hw + simpa [q] using hexit.2.2.2.2.2 w hw + · simp [q] + · simp [q] + +private theorem helper_hsigmaOne_593.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let _ : Set (V ⊕ E) := TwoColorComponent G C.phi C.a C.b (Sum.inl C.b3); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 C component sigma + refine ⟨?_, ?_⟩ + · have he0 := C.triple.2.2.2.2.1 + by_cases he : Sum.inr e0 ∈ component + · simp [sigma, TwoColorComponentSwap, component, he, he0] + · simp [sigma, TwoColorComponentSwap, component, he, he0] + · intro f hf + obtain ⟨c, hc⟩ := C.triple.2.2.2.2.2 f hf + by_cases he : Sum.inr f ∈ component + · by_cases hca : c = C.a + · refine ⟨C.b, ?_⟩ + simp [sigma, TwoColorComponentSwap, component, he, hc, hca] + · by_cases hcb : c = C.b + · refine ⟨C.a, ?_⟩ + simp [sigma, TwoColorComponentSwap, component, he, hc, hcb, + C.colorsDistinct.symm] + · refine ⟨c, ?_⟩ + simp [sigma, TwoColorComponentSwap, component, he, hc, hca, hcb] + · exact ⟨c, by simpa [sigma, TwoColorComponentSwap, component, he] using hc⟩ + +private theorem helper_continuation_610.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + C.b ∈ MissingColors G sigma C.b3 → C.a ∈ MissingColors G sigma C.a1 ∨ C.b ∈ MissingColors + G sigma C.a1 → C.a ∈ MissingColors G sigma C.a2 ∨ C.b ∈ MissingColors G sigma C.a2 → C.a ∈ + MissingColors G sigma C.a3 ∨ C.b ∈ MissingColors G sigma C.a3 → + ∀ (Q1 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl C.b1)), + TreeExitPath C.T sigma C.a C.b C.a1 C.b1 Q1 → Q1.support = C.P1.support → Q1.length = + C.P1.length → + ∀ (Q2 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a2) (Sum.inl C.b2)), + TreeExitPath C.T sigma C.a C.b C.a2 C.b2 Q2 → Q2.support = C.P2.support → Q2.length = + C.P2.length → + ∀ (Q3 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a3) (Sum.inl C.b3)), + TreeExitPath C.T sigma C.a C.b C.a3 C.b3 Q3 → Q3.support = C.P3.support → Q3.length = + C.P3.length → + ∀ (i3 : Fin (C.T.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) (hi3le : (↑i3 : ℕ) ≤ + C.T.length), + let baseTree : TreeSequence G e0 := TreeSequencePrefix C.T (↑i3 : ℕ) hi3pos hi3le; + TreeSequenceInitialSegment baseTree C.T → baseTree.vertex (Fin.last baseTree.length) = + C.b3 → C.b1 ∈ TreeSequenceVertexSet baseTree → C.b2 ∈ TreeSequenceVertexSet baseTree → + TashkinovTree G e0 sigma baseTree → KTriple G k e0 sigma → + ∀ (oneTree twoTree : TreeSequence G e0), TashkinovAugmentation sigma baseTree oneTree → + TashkinovAugmentation sigma oneTree twoTree → + ∀ (closedTree : TreeSequence G e0), TashkinovClosure sigma twoTree closedTree → TashkinovTree + G e0 sigma closedTree → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + closedTree) → C.b1 ∈ TreeSequenceVertexSet closedTree → C.b2 ∈ TreeSequenceVertexSet + closedTree → C.b3 ∈ TreeSequenceVertexSet closedTree → ( + ∀ (v : V), Incident G v C.f1 → v ∈ TreeSequenceVertexSet closedTree) → ( + ∀ {a : V}, a ∈ TreeSequenceVertexSet closedTree → a ≠ C.b3 → C.b ∉ MissingColors G sigma a) → + (C.a ∈ TreeMissingColors sigma closedTree → C.a1 ∈ TreeSequenceVertexSet closedTree ∧ C.a2 + ∈ TreeSequenceVertexSet closedTree ∧ C.a3 ∈ TreeSequenceVertexSet closedTree) → Nonempty + (TchangeKempeClosureData C) := by + classical + intro V E _ _ _ _ G k e0 C sigma hbetaMissing hremote1 hremote2 hremote3 Q1 hQ1 hQ1support + hQ1length Q2 hQ2 hQ2support hQ2length Q3 hQ3 hQ3support hQ3length i3 hi3pos hi3le baseTree + hbaseInitial hbaseLast hb1Base hb2Base hbaseTree hsigmaTriple oneTree twoTree haug1 haug2 + closedTree hclosure hclosedTree hclosedElementary hb1Closed hb2Closed hb3Closed + hf1EndsClosed remoteNotB allRemoteInside + have remoteOutside := @helper_remoteOutside_770 V E inferInstance inferInstance inferInstance + inferInstance G k e0 C hremote1 hremote2 closedTree hclosedElementary remoteNotB + allRemoteInside + have ha1Outside : C.a1 ∉ TreeSequenceVertexSet closedTree := + remoteOutside C.a1 C.exit1.2.2.1 hremote1 + have ha2Outside : C.a2 ∉ TreeSequenceVertexSet closedTree := + remoteOutside C.a2 C.exit2.2.2.1 hremote2 + have ha3Outside : C.a3 ∉ TreeSequenceVertexSet closedTree := + remoteOutside C.a3 C.exit3.2.2.1 hremote3 + exact ⟨{ + sigma := sigma + baseTree := baseTree + oneTree := oneTree + twoTree := twoTree + closedTree := closedTree + sigmaEq := rfl + baseInitial := hbaseInitial + baseLast := hbaseLast + b1InBase := hb1Base + b2InBase := hb2Base + baseIsTree := hbaseTree + firstAugmentation := haug1 + secondAugmentation := haug2 + closureRoute := hclosure + triple := hsigmaTriple + closureTree := hclosedTree + closureClosed := hclosure.2 + closureElementary := hclosedElementary + betaMissing := hbetaMissing + b1InClosure := hb1Closed + b2InClosure := hb2Closed + b3InClosure := hb3Closed + a1Outside := ha1Outside + a2Outside := ha2Outside + a3Outside := ha3Outside + f1EndsInside := hf1EndsClosed + Q1 := Q1 + Q2 := Q2 + Q3 := Q3 + exit1 := hQ1 + exit2 := hQ2 + exit3 := hQ3 + support1 := hQ1support + support2 := hQ2support + support3 := hQ3support + length1 := hQ1length + length2 := hQ2length + length3 := hQ3length }⟩ + +private theorem helper_continuation_583.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + C.b ∈ MissingColors G sigma C.b3 → C.a ∈ MissingColors G sigma C.a1 ∨ C.b ∈ MissingColors + G sigma C.a1 → C.a ∈ MissingColors G sigma C.a2 ∨ C.b ∈ MissingColors G sigma C.a2 → C.a ∈ + MissingColors G sigma C.a3 ∨ C.b ∈ MissingColors G sigma C.a3 → + ∀ (Q1 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl C.b1)), + TreeExitPath C.T sigma C.a C.b C.a1 C.b1 Q1 → Q1.support = C.P1.support → Q1.length = + C.P1.length → + ∀ (Q2 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a2) (Sum.inl C.b2)), + TreeExitPath C.T sigma C.a C.b C.a2 C.b2 Q2 → Q2.support = C.P2.support → Q2.length = + C.P2.length → + ∀ (Q3 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a3) (Sum.inl C.b3)), + TreeExitPath C.T sigma C.a C.b C.a3 C.b3 Q3 → Q3.support = C.P3.support → Q3.length = + C.P3.length → + ∀ (i3 : Fin (C.T.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) (hi3le : (↑i3 : ℕ) ≤ + C.T.length), + let baseTree : TreeSequence G e0 := TreeSequencePrefix C.T (↑i3 : ℕ) hi3pos hi3le; + TreeSequenceInitialSegment baseTree C.T → baseTree.vertex (Fin.last baseTree.length) = + C.b3 → C.b1 ∈ TreeSequenceVertexSet baseTree → C.b2 ∈ TreeSequenceVertexSet baseTree → + TashkinovTree G e0 sigma baseTree → sigma C.f1 = some C.b → sigma C.f2 = some C.b → + KTriple G k e0 sigma → ( + ∀ (A B : TreeSequence G e0), TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → + ∀ x1 ∉ TreeSequenceVertexSet C.T, G.ends C.f1 = s(C.b1, x1) → + ∀ (x2 : V), Incident G x1 C.f1 → x1 ≠ x2 → x1 ∉ TreeSequenceVertexSet baseTree → + ∀ (oneTree : TreeSequence G e0) (hlen1 : oneTree.length = baseTree.length + (1 : ℕ)), + TreeSequenceInitialSegment baseTree oneTree → oneTree.edge (Fin.cast (( + by first | omega + )) (Fin.last baseTree.length)) = C.f1 → + let new1 : V := oneTree.vertex (Fin.last oneTree.length); new1 = x1 → ( + ∀ {v : V}, v ∈ TreeSequenceVertexSet oneTree → v ∈ TreeSequenceVertexSet baseTree ∨ v = x1) → + C.f2 ∈ BoundaryEdges G (TreeSequenceVertexSet oneTree) → Nonempty (TchangeKempeClosureData + C) := by + classical + intro V E _ _ _ _ G k e0 C sigma hbetaMissing hremote1 hremote2 hremote3 Q1 hQ1 hQ1support + hQ1length Q2 hQ2 hQ2support hQ2length Q3 hQ3 hQ3support hQ3length i3 hi3pos hi3le baseTree + hbaseInitial hbaseLast hb1Base hb2Base hbaseTree hf1Sigma hf2Sigma hsigmaTriple + initialVertexSubset x1 hx1 hends1 x2 hx1Incident hx12 hx1Base oneTree hlen1 hseg1 hedge1 + new1 hnew1 oneVertexCases hf2OneBoundary + obtain ⟨twoTree, hadjoin2⟩ := + TreeSequenceBoundaryEdgeAppendExists oneTree C.f2 hf2OneBoundary + obtain ⟨hlen2, hseg2, hedge2⟩ := hadjoin2 + have hb3Base : C.b3 ∈ TreeSequenceVertexSet baseTree := by + have : baseTree.vertex (Fin.last baseTree.length) ∈ + TreeSequenceVertexSet baseTree := by + simp [TreeSequenceVertexSet] + simpa [hbaseLast] using this + have hbetaBase : C.b ∈ TreeMissingColors sigma baseTree := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨C.b3, hb3Base, hbetaMissing⟩ + have haug1 : TashkinovAugmentation sigma baseTree oneTree := by + refine ⟨hlen1, hseg1, C.b, ?_, hbetaBase⟩ + rw [hedge1] + exact hf1Sigma + have hb3One : C.b3 ∈ TreeSequenceVertexSet oneTree := + initialVertexSubset baseTree oneTree hseg1 hb3Base + have hbetaOne : C.b ∈ TreeMissingColors sigma oneTree := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨C.b3, hb3One, hbetaMissing⟩ + have haug2 : TashkinovAugmentation sigma oneTree twoTree := by + refine ⟨hlen2, hseg2, C.b, ?_, hbetaOne⟩ + rw [hedge2] + exact hf2Sigma + have htwoSequence : TashkinovAugmentationSequence sigma baseTree twoTree := + Relation.ReflTransGen.tail (Relation.ReflTransGen.single haug1) haug2 + have htwoTree : TashkinovTree G e0 sigma twoTree := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 sigma + baseTree twoTree hbaseTree htwoSequence + obtain ⟨closedTree, hclosure⟩ := TashkinovClosureExists sigma twoTree + have hclosedTree : TashkinovTree G e0 sigma closedTree := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 sigma + twoTree closedTree htwoTree hclosure.1 + have hclosedElementary : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet closedTree) := + TashTree G k e0 sigma closedTree hsigmaTriple hclosedTree + have htwoInitial : TreeSequenceInitialSegment twoTree closedTree := + TashkinovAugmentationSequenceInitialSegment sigma twoTree closedTree hclosure.1 + have honeSubset : TreeSequenceVertexSet oneTree ⊆ + TreeSequenceVertexSet closedTree := + (initialVertexSubset oneTree twoTree hseg2).trans + (initialVertexSubset twoTree closedTree htwoInitial) + have hbaseSubset : TreeSequenceVertexSet baseTree ⊆ + TreeSequenceVertexSet closedTree := + (initialVertexSubset baseTree oneTree hseg1).trans honeSubset + have hb1Closed : C.b1 ∈ TreeSequenceVertexSet closedTree := + hbaseSubset hb1Base + have hb2Closed : C.b2 ∈ TreeSequenceVertexSet closedTree := + hbaseSubset hb2Base + have hb3Closed : C.b3 ∈ TreeSequenceVertexSet closedTree := + hbaseSubset hb3Base + have hx1One : x1 ∈ TreeSequenceVertexSet oneTree := by + have hnewMem : new1 ∈ TreeSequenceVertexSet oneTree := by + simp [new1, TreeSequenceVertexSet] + simpa [hnew1] using hnewMem + have hx1Closed : x1 ∈ TreeSequenceVertexSet closedTree := honeSubset hx1One + have hf1EndsClosed : ∀ v, Incident G v C.f1 → + v ∈ TreeSequenceVertexSet closedTree := by + intro v hv + have hvEnds : v = C.b1 ∨ v = x1 := by + rw [Incident, hends1] at hv + simpa using hv + rcases hvEnds with rfl | rfl + · exact hb1Closed + · exact hx1Closed + have endsEqOfIncidents : ∀ {f : E} {x y : V}, + Incident G x f → Incident G y f → x ≠ y → G.ends f = s(x, y) := by + intro f x y hx hy hxy + exact (Sym2.mem_and_mem_iff hxy).mp ⟨hx, hy⟩ + have componentContained := @helper_componentContained_600 V E inferInstance inferInstance + inferInstance inferInstance G k e0 C twoTree closedTree hclosure endsEqOfIncidents + have newComponentOfWalk {u v : V} + (p : (TwoColorIncidenceGraph G sigma C.a C.b).Walk + (Sum.inl u) (Sum.inl v)) : + Sum.inl u ∈ TwoColorComponent G sigma C.a C.b (Sum.inl v) := by + change (TwoColorIncidenceGraph G sigma C.a C.b).connectedComponentMk + (Sum.inl u) = + (TwoColorIncidenceGraph G sigma C.a C.b).connectedComponentMk + (Sum.inl v) + exact SimpleGraph.ConnectedComponent.sound ⟨p⟩ + have remoteNotB : + ∀ {a : V}, a ∈ TreeSequenceVertexSet closedTree → a ≠ C.b3 → C.b ∉ MissingColors G sigma a := by + intro a ha hab hbMissing + exact (Finset.disjoint_left.mp + (hclosedElementary ha hb3Closed hab) hbMissing hbetaMissing) + have allRemoteInside : + C.a ∈ TreeMissingColors sigma closedTree → + C.a1 ∈ TreeSequenceVertexSet closedTree ∧ + C.a2 ∈ TreeSequenceVertexSet closedTree ∧ + C.a3 ∈ TreeSequenceVertexSet closedTree := by + intro haTree + have hbTree : C.b ∈ TreeMissingColors sigma closedTree := by + unfold TreeMissingColors + exact Finset.mem_biUnion.mpr ⟨C.b3, hb3Closed, hbetaMissing⟩ + exact ⟨componentContained C.b1 hb1Closed haTree hbTree C.a1 + (newComponentOfWalk Q1), + componentContained C.b2 hb2Closed haTree hbTree C.a2 + (newComponentOfWalk Q2), + componentContained C.b3 hb3Closed haTree hbTree C.a3 + (newComponentOfWalk Q3)⟩ + exact @helper_continuation_610 V E inferInstance inferInstance inferInstance inferInstance G k + e0 C hbetaMissing hremote1 hremote2 hremote3 Q1 hQ1 hQ1support hQ1length Q2 hQ2 hQ2support + hQ2length Q3 hQ3 hQ3support hQ3length i3 hi3pos hi3le hbaseInitial hbaseLast hb1Base + hb2Base hbaseTree hsigmaTriple oneTree twoTree haug1 haug2 closedTree hclosure hclosedTree + hclosedElementary hb1Closed hb2Closed hb3Closed hf1EndsClosed remoteNotB allRemoteInside +private theorem helper_continuation_572.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + IsProperEdgeColoring G C.phi → C.b ∈ MissingColors G sigma C.b3 → C.a ∈ MissingColors G + sigma C.a1 ∨ C.b ∈ MissingColors G sigma C.a1 → C.a ∈ MissingColors G sigma C.a2 ∨ C.b ∈ + MissingColors G sigma C.a2 → C.a ∈ MissingColors G sigma C.a3 ∨ C.b ∈ MissingColors G + sigma C.a3 → + ∀ (Q1 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl C.b1)), + TreeExitPath C.T sigma C.a C.b C.a1 C.b1 Q1 → Q1.support = C.P1.support → Q1.length = + C.P1.length → + ∀ (Q2 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a2) (Sum.inl C.b2)), + TreeExitPath C.T sigma C.a C.b C.a2 C.b2 Q2 → Q2.support = C.P2.support → Q2.length = + C.P2.length → + ∀ (Q3 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a3) (Sum.inl C.b3)), + TreeExitPath C.T sigma C.a C.b C.a3 C.b3 Q3 → Q3.support = C.P3.support → Q3.length = + C.P3.length → + ∀ (_ i3 _ : Fin (C.T.length + (1 : ℕ))) (hi3pos : (1 : ℕ) ≤ (↑i3 : ℕ)) (hi3le : (↑i3 : ℕ) ≤ + C.T.length), + let baseTree : TreeSequence G e0 := TreeSequencePrefix C.T (↑i3 : ℕ) hi3pos hi3le; + TreeSequenceInitialSegment baseTree C.T → baseTree.vertex (Fin.last baseTree.length) = + C.b3 → C.b1 ∈ TreeSequenceVertexSet baseTree → C.b2 ∈ TreeSequenceVertexSet baseTree → + TashkinovTree G e0 sigma baseTree → C.f1 ∈ BoundaryEdges G (TreeSequenceVertexSet C.T) ∧ + C.phi C.f1 = some C.b → C.f2 ∈ BoundaryEdges G (TreeSequenceVertexSet C.T) ∧ C.phi C.f2 = + some C.b → sigma C.f1 = some C.b → sigma C.f2 = some C.b → KTriple G k e0 sigma → ( + ∀ (A B : TreeSequence G e0), TreeSequenceInitialSegment A B → TreeSequenceVertexSet A ⊆ + TreeSequenceVertexSet B) → Nonempty (TchangeKempeClosureData C) := by + classical + intro V E _ _ _ _ G k e0 C sigma hproper hbetaMissing hremote1 hremote2 hremote3 Q1 hQ1 + hQ1support hQ1length Q2 hQ2 hQ2support hQ2length Q3 hQ3 hQ3support hQ3length i1 i3 i2 + hi3pos hi3le baseTree hbaseInitial hbaseLast hb1Base hb2Base hbaseTree hf1Data hf2Data + hf1Sigma hf2Sigma hsigmaTriple initialVertexSubset + obtain ⟨u1, hu1, x1, hx1, hends1⟩ := by + simpa [BoundaryEdges] using hf1Data.1 + have hb1u1 : C.b1 = u1 := by + have hmem : C.b1 = u1 ∨ C.b1 = x1 := by + have hinc := C.incident1 + rw [Incident, hends1] at hinc + simpa using hinc + exact hmem.resolve_right (by + intro h + apply hx1 + rw [← h] + exact C.exit1.2.2.2.1) + subst u1 + obtain ⟨u2, hu2, x2, hx2, hends2⟩ := by + simpa [BoundaryEdges] using hf2Data.1 + have hb2u2 : C.b2 = u2 := by + have hmem : C.b2 = u2 ∨ C.b2 = x2 := by + have hinc := C.incident2 + rw [Incident, hends2] at hinc + simpa using hinc + exact hmem.resolve_right (by + intro h + apply hx2 + rw [← h] + exact C.exit2.2.2.2.1) + subst u2 + have hx1Incident : Incident G x1 C.f1 := by + rw [Incident, hends1] + simp + have hx2Incident : Incident G x2 C.f2 := by + rw [Incident, hends2] + simp + have hf12 : C.f1 ≠ C.f2 := by + intro hf + have hb2mem : C.b2 = C.b1 ∨ C.b2 = x1 := by + have : C.b2 ∈ s(C.b1, x1) := by + rw [← hends1, hf] + exact C.incident2 + simpa using this + rcases hb2mem with hb | hb + · exact C.tree12 hb.symm + · exact hx1 (hb ▸ C.exit2.2.2.2.1) + have hx12 : x1 ≠ x2 := by + intro hx + apply (hproper hf12 ⟨x1, hx1Incident, hx ▸ hx2Incident⟩ hf1Data.2) + exact hf2Data.2 + have hx1Base : x1 ∉ TreeSequenceVertexSet baseTree := by + intro hx + exact hx1 (initialVertexSubset baseTree C.T hbaseInitial hx) + have hf1BaseBoundary : C.f1 ∈ BoundaryEdges G + (TreeSequenceVertexSet baseTree) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨C.b1, hb1Base, x1, hx1Base, hends1⟩ + obtain ⟨oneTree, hadjoin1⟩ := + TreeSequenceBoundaryEdgeAppendExists baseTree C.f1 hf1BaseBoundary + obtain ⟨hlen1, hseg1, hedge1⟩ := hadjoin1 + let new1 := oneTree.vertex (Fin.last oneTree.length) + have hnew1Outside : new1 ∉ TreeSequenceVertexSet baseTree := by + intro hnew + have hnew' : new1 ∈ Finset.image baseTree.vertex Finset.univ := by + simpa [TreeSequenceVertexSet] using hnew + obtain ⟨r, _, hr⟩ := Finset.mem_image.mp hnew' + have hsame : oneTree.vertex (Fin.last oneTree.length) = + oneTree.vertex (Fin.castLE (Nat.succ_le_succ hseg1.1) r) := by + rw [hseg1.2.1 r, hr] + have hidx := congrArg Fin.val (oneTree.vertex_injective hsame) + simp [hlen1] at hidx + omega + have hnew1Incident : Incident G new1 C.f1 := by + let lastEdge : Fin oneTree.length := + Fin.cast hlen1.symm (Fin.last baseTree.length) + obtain ⟨q, hq⟩ := oneTree.attaches lastEdge + have hsucc : lastEdge.succ = Fin.last oneTree.length := by + apply Fin.ext + simp [lastEdge, hlen1] + rw [Incident, ← hedge1, hq, hsucc] + simp [new1] + have hnew1 : new1 = x1 := by + have hm : new1 = C.b1 ∨ new1 = x1 := by + rw [Incident, hends1] at hnew1Incident + simpa using hnew1Incident + exact hm.resolve_left (by + intro h + apply hnew1Outside + rw [h] + exact hb1Base) + have oneVertexCases := @helper_oneVertexCases_629 V E inferInstance inferInstance inferInstance + inferInstance G k e0 C Q1 Q2 Q3 i1 i3 i2 hi3pos hi3le x1 oneTree hlen1 hseg1 hnew1 + have hx2One : x2 ∉ TreeSequenceVertexSet oneTree := by + intro hx + rcases oneVertexCases hx with hxBase | hxeq + · exact hx2 (initialVertexSubset baseTree C.T hbaseInitial hxBase) + · exact hx12 hxeq.symm + have hb2One : C.b2 ∈ TreeSequenceVertexSet oneTree := + initialVertexSubset baseTree oneTree hseg1 hb2Base + have hf2OneBoundary : C.f2 ∈ BoundaryEdges G + (TreeSequenceVertexSet oneTree) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨C.b2, hb2One, x2, hx2One, hends2⟩ + exact @helper_continuation_583 V E inferInstance inferInstance inferInstance inferInstance G k + e0 C hbetaMissing hremote1 hremote2 hremote3 Q1 hQ1 hQ1support hQ1length Q2 hQ2 hQ2support + hQ2length Q3 hQ3 hQ3support hQ3length i3 hi3pos hi3le hbaseInitial hbaseLast hb1Base + hb2Base hbaseTree hf1Sigma hf2Sigma hsigmaTriple initialVertexSubset x1 hx1 hends1 x2 + hx1Incident hx12 hx1Base oneTree hlen1 hseg1 hedge1 hnew1 oneVertexCases hf2OneBoundary +private theorem helper_continuation_549.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0), + TreeVertexOrder C.T C.b1 C.b3 → TreeVertexOrder C.T C.b2 C.b3 → + let component : Set (V ⊕ E) := TwoColorComponent G C.phi C.a C.b (Sum.inl C.b3); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3); + IsProperEdgeColoring G C.phi → IsProperEdgeColoring G sigma → ( + ∀ w ∈ TreeSequenceVertexSet C.T, Sum.inl w ∈ component ↔ w = C.b3) → C.b ∈ MissingColors G + sigma C.b3 → C.a ∈ MissingColors G sigma C.a1 ∨ C.b ∈ MissingColors G sigma C.a1 → C.a ∈ + MissingColors G sigma C.a2 ∨ C.b ∈ MissingColors G sigma C.a2 → C.a ∈ MissingColors G + sigma C.a3 ∨ C.b ∈ MissingColors G sigma C.a3 → ( + ∀ {u v : V} (p : (TwoColorIncidenceGraph G C.phi C.a C.b).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath C.T C.phi C.a C.b u v p → C.a ∈ MissingColors G sigma u ∨ C.b ∈ MissingColors + G sigma u → + ∃ (q : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl u) (Sum.inl v)), TreeExitPath + C.T sigma C.a C.b u v q ∧ q.support = p.support ∧ q.length = p.length) → + ∀ (Q1 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl C.b1)), + TreeExitPath C.T sigma C.a C.b C.a1 C.b1 Q1 → Q1.support = C.P1.support → Q1.length = + C.P1.length → + ∀ (Q2 : (TwoColorIncidenceGraph G sigma C.a C.b).Walk (Sum.inl C.a2) (Sum.inl C.b2)), + TreeExitPath C.T sigma C.a C.b C.a2 C.b2 Q2 → Q2.support = C.P2.support → Q2.length = + C.P2.length → Nonempty (TchangeKempeClosureData C) := by + classical + intro V E _ _ _ _ G k e0 C h13 h23 component sigma hproper hsigmaProper hcomponentTree + hbetaMissing hremote1 hremote2 hremote3 transferExit Q1 hQ1 hQ1support hQ1length Q2 hQ2 + hQ2support hQ2length + obtain ⟨Q3, hQ3, hQ3support, hQ3length⟩ := + transferExit C.P3 C.exit3 hremote3 + obtain ⟨i1, i3, hi1, hi3, hi13⟩ := h13 + obtain ⟨i2, i3', hi2, hi3', hi23⟩ := h23 + have hi3eq : i3' = i3 := by + apply C.T.vertex_injective + rw [hi3', hi3] + subst i3' + have hi3pos : 1 ≤ i3.val := by omega + have hi3le : i3.val ≤ C.T.length := by omega + let baseTree := TreeSequencePrefix C.T i3.val hi3pos hi3le + have hbaseLen : baseTree.length = i3.val := by + simp [baseTree, TreeSequencePrefix] + have hbaseInitial : TreeSequenceInitialSegment baseTree C.T := by + refine ⟨hi3le, ?_, ?_⟩ + · intro i + simp [baseTree, TreeSequencePrefix] + · intro j + simp [baseTree, TreeSequencePrefix] + have hbaseLast : baseTree.vertex (Fin.last baseTree.length) = C.b3 := by + calc + baseTree.vertex (Fin.last baseTree.length) = + C.T.vertex (Fin.castLE (Nat.succ_le_succ hbaseInitial.1) + (Fin.last baseTree.length)) := (hbaseInitial.2.1 _).symm + _ = C.T.vertex i3 := by + congr 1 + _ = C.b3 := hi3 + have hb1Base : C.b1 ∈ TreeSequenceVertexSet baseTree := by + let r : Fin (baseTree.length + 1) := ⟨i1.val, by rw [hbaseLen]; omega⟩ + have hr : baseTree.vertex r = C.b1 := by calc + baseTree.vertex r = + C.T.vertex (Fin.castLE (Nat.succ_le_succ hbaseInitial.1) r) := + (hbaseInitial.2.1 r).symm + _ = C.T.vertex i1 := by + congr 1 + _ = C.b1 := hi1 + simpa [TreeSequenceVertexSet] using + (Finset.mem_image.mpr ⟨r, Finset.mem_univ _, hr⟩) + have hb2Base : C.b2 ∈ TreeSequenceVertexSet baseTree := by + let r : Fin (baseTree.length + 1) := ⟨i2.val, by rw [hbaseLen]; omega⟩ + have hr : baseTree.vertex r = C.b2 := by calc + baseTree.vertex r = + C.T.vertex (Fin.castLE (Nat.succ_le_succ hbaseInitial.1) r) := + (hbaseInitial.2.1 r).symm + _ = C.T.vertex i2 := by + congr 1 + _ = C.b2 := hi2 + simpa [TreeSequenceVertexSet] using + (Finset.mem_image.mpr ⟨r, Finset.mem_univ _, hr⟩) + have fullVertexMem (r : Fin (C.T.length + 1)) : + C.T.vertex r ∈ TreeSequenceVertexSet C.T := by + simp [TreeSequenceVertexSet] + have fixedBefore := @helper_fixedBefore_250 V E inferInstance inferInstance inferInstance + inferInstance G k e0 C hcomponentTree Q1 Q2 Q3 i1 i3 hi3 i2 hi3pos hi3le hbaseLen + fullVertexMem + have hbaseTree := @helper_hbaseTree_302 V E inferInstance inferInstance inferInstance + inferInstance G k e0 C hproper hcomponentTree Q1 Q2 Q3 i1 i3 hi3 i2 hi3pos hi3le hbaseLen + hbaseInitial fullVertexMem fixedBefore + have coloredIncidentOutside {w : V} {f : E} + (hw : w ∈ TreeSequenceVertexSet C.T) (hwb3 : w ≠ C.b3) + (hinc : Incident G w f) (hcolor : C.phi f = some C.b) : + Sum.inr f ∉ component := by + intro hfComponent + have hadj : (TwoColorIncidenceGraph G C.phi C.a C.b).Adj + (Sum.inl w) (Sum.inr f) := ⟨hinc, Or.inr hcolor⟩ + have hwComponent : Sum.inl w ∈ component := by + change (TwoColorIncidenceGraph G C.phi C.a C.b).connectedComponentMk + (Sum.inl w) = + (TwoColorIncidenceGraph G C.phi C.a C.b).connectedComponentMk + (Sum.inl C.b3) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans hfComponent + exact hwb3 ((hcomponentTree w hw).mp hwComponent) + have hf1Data : C.f1 ∈ BoundaryEdges G (TreeSequenceVertexSet C.T) ∧ + C.phi C.f1 = some C.b := by + simpa [BoundaryColorEdges] using C.boundary1 + have hf2Data : C.f2 ∈ BoundaryEdges G (TreeSequenceVertexSet C.T) ∧ + C.phi C.f2 = some C.b := by + simpa [BoundaryColorEdges] using C.boundary2 + have hf1OutsideComponent : Sum.inr C.f1 ∉ component := + coloredIncidentOutside C.exit1.2.2.2.1 C.tree13 C.incident1 hf1Data.2 + have hf2OutsideComponent : Sum.inr C.f2 ∉ component := + coloredIncidentOutside C.exit2.2.2.2.1 C.tree23 C.incident2 hf2Data.2 + have hf1Sigma : sigma C.f1 = some C.b := by + simpa [sigma, TwoColorComponentSwap, component, hf1OutsideComponent] using + hf1Data.2 + have hf2Sigma : sigma C.f2 = some C.b := by + simpa [sigma, TwoColorComponentSwap, component, hf2OutsideComponent] using + hf2Data.2 + have hsigmaOne := @helper_hsigmaOne_593 V E inferInstance inferInstance inferInstance + inferInstance G k e0 C + have hsigmaTriple : KTriple G k e0 sigma := + ⟨C.triple.1, C.triple.2.1, C.triple.2.2.1, hsigmaProper, hsigmaOne⟩ + have initialVertexSubset : ∀ (A B : TreeSequence G e0), + TreeSequenceInitialSegment A B → + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro A B hAB v hv + obtain ⟨r, _, hr⟩ := by + simpa [TreeSequenceVertexSet] using hv + have hmem : B.vertex (Fin.castLE (Nat.succ_le_succ hAB.1) r) ∈ + TreeSequenceVertexSet B := by + simp [TreeSequenceVertexSet] + simpa [hAB.2.1 r] using hmem + exact @helper_continuation_572 V E inferInstance inferInstance inferInstance inferInstance G k + e0 C hproper hbetaMissing hremote1 hremote2 hremote3 Q1 hQ1 hQ1support hQ1length Q2 hQ2 + hQ2support hQ2length Q3 hQ3 hQ3support hQ3length i1 i3 i2 hi3pos hi3le hbaseInitial + hbaseLast hb1Base hb2Base hbaseTree hf1Data hf2Data hf1Sigma hf2Sigma hsigmaTriple + initialVertexSubset +theorem TchangeKempeClosurePreparation {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (C : TchangeCounterexample G k e0) + (hmissing : C.a ∈ MissingColors G C.phi C.b3) + (h13 : TreeVertexOrder C.T C.b1 C.b3) + (h23 : TreeVertexOrder C.T C.b2 C.b3) : + Nonempty (TchangeKempeClosureData C) := by + classical + let component := TwoColorComponent G C.phi C.a C.b (Sum.inl C.b3) + let sigma := TwoColorComponentSwap G C.phi C.a C.b (Sum.inl C.b3) + have hproper : IsProperEdgeColoring G C.phi := C.triple.2.2.2.1 + have hsigmaProper : IsProperEdgeColoring G sigma := + TwoColorComponentSwapProper G C.phi C.a C.b C.colorsDistinct hproper _ + have hcomponentTree : ∀ w, w ∈ TreeSequenceVertexSet C.T → + (Sum.inl w ∈ component ↔ w = C.b3) := by + intro w hw + exact TreeExitComponentMeetsTreeOnlyAtExit C.T C.phi C.a C.b C.b3 + hproper hmissing ⟨C.a3, C.P3, C.exit3⟩ w hw + have hcomponentB3 : Sum.inl C.b3 ∈ component := by + rfl + have hbetaMissing : C.b ∈ MissingColors G sigma C.b3 := by + exact (TwoColorComponentSwapMissingBehavior G C.phi C.a C.b + C.colorsDistinct hproper (Sum.inl C.b3)).2.1 C.b3 hcomponentB3 hmissing + have componentOfWalk {u v : V} + (p : (TwoColorIncidenceGraph G C.phi C.a C.b).Walk + (Sum.inl u) (Sum.inl v)) : + Sum.inl u ∈ TwoColorComponent G C.phi C.a C.b (Sum.inl v) := by + change (TwoColorIncidenceGraph G C.phi C.a C.b).connectedComponentMk + (Sum.inl u) = + (TwoColorIncidenceGraph G C.phi C.a C.b).connectedComponentMk + (Sum.inl v) + exact SimpleGraph.ConnectedComponent.sound ⟨p⟩ + have hcomponentA3 : Sum.inl C.a3 ∈ component := by + exact componentOfWalk C.P3 + have disjointComponent1 : Disjoint + (TwoColorComponent G C.phi C.a C.b (Sum.inl C.b1)) component := by + rcases TwoColorComponentsDisjoint G C.phi C.a C.b + (Sum.inl C.b1) (Sum.inl C.b3) with heq | hdisjoint + · exfalso + have hb1Component : Sum.inl C.b1 ∈ component := by + change Sum.inl C.b1 ∈ + TwoColorComponent G C.phi C.a C.b (Sum.inl C.b3) + rw [← heq] + rfl + exact C.tree13 ((hcomponentTree C.b1 C.exit1.2.2.2.1).mp hb1Component) + · exact hdisjoint + have disjointComponent2 : Disjoint + (TwoColorComponent G C.phi C.a C.b (Sum.inl C.b2)) component := by + rcases TwoColorComponentsDisjoint G C.phi C.a C.b + (Sum.inl C.b2) (Sum.inl C.b3) with heq | hdisjoint + · exfalso + have hb2Component : Sum.inl C.b2 ∈ component := by + change Sum.inl C.b2 ∈ + TwoColorComponent G C.phi C.a C.b (Sum.inl C.b3) + rw [← heq] + rfl + exact C.tree23 ((hcomponentTree C.b2 C.exit2.2.2.2.1).mp hb2Component) + · exact hdisjoint + have hcomponentA1 : + Sum.inl C.a1 ∈ TwoColorComponent G C.phi C.a C.b (Sum.inl C.b1) := + componentOfWalk C.P1 + have hcomponentA2 : + Sum.inl C.a2 ∈ TwoColorComponent G C.phi C.a C.b (Sum.inl C.b2) := + componentOfWalk C.P2 + have ha1OutsideComponent : Sum.inl C.a1 ∉ component := by + exact Set.disjoint_left.mp disjointComponent1 hcomponentA1 + have ha2OutsideComponent : Sum.inl C.a2 ∉ component := by + exact Set.disjoint_left.mp disjointComponent2 hcomponentA2 + have hmissingA1 : + MissingColors G sigma C.a1 = MissingColors G C.phi C.a1 := by + exact (TwoColorComponentSwapMissingBehavior G C.phi C.a C.b + C.colorsDistinct hproper (Sum.inl C.b3)).1 C.a1 ha1OutsideComponent + have hmissingA2 : + MissingColors G sigma C.a2 = MissingColors G C.phi C.a2 := by + exact (TwoColorComponentSwapMissingBehavior G C.phi C.a C.b + C.colorsDistinct hproper (Sum.inl C.b3)).1 C.a2 ha2OutsideComponent + have hremote1 : C.a ∈ MissingColors G sigma C.a1 ∨ + C.b ∈ MissingColors G sigma C.a1 := by + simpa [hmissingA1] using C.exit1.2.2.2.2.1 + have hremote2 : C.a ∈ MissingColors G sigma C.a2 ∨ + C.b ∈ MissingColors G sigma C.a2 := by + simpa [hmissingA2] using C.exit2.2.2.2.2.1 + have hremote3 : C.a ∈ MissingColors G sigma C.a3 ∨ + C.b ∈ MissingColors G sigma C.a3 := by + rcases C.exit3.2.2.2.2.1 with ha | hb + · exact Or.inr + ((TwoColorComponentSwapMissingBehavior G C.phi C.a C.b + C.colorsDistinct hproper (Sum.inl C.b3)).2.1 C.a3 hcomponentA3 ha) + · exact Or.inl + ((TwoColorComponentSwapMissingBehavior G C.phi C.a C.b + C.colorsDistinct hproper (Sum.inl C.b3)).2.2.1 C.a3 hcomponentA3 hb) + have graphEq := @helper_graphEq_137 V E inferInstance inferInstance inferInstance inferInstance G + k e0 C + have transferExit := @helper_transferExit_476 V E inferInstance inferInstance inferInstance + inferInstance G k e0 C graphEq + obtain ⟨Q1, hQ1, hQ1support, hQ1length⟩ := + transferExit C.P1 C.exit1 hremote1 + obtain ⟨Q2, hQ2, hQ2support, hQ2length⟩ := + transferExit C.P2 C.exit2 hremote2 + exact @helper_continuation_549 V E inferInstance inferInstance inferInstance inferInstance G k + e0 C h13 h23 hproper hsigmaProper hcomponentTree hbetaMissing hremote1 hremote2 hremote3 + transferExit Q1 hQ1 hQ1support hQ1length Q2 hQ2 hQ2support hQ2length +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TchangeOutsideSwapPreparation.lean b/LeanPool/GoldbergSeymour/TchangeOutsideSwapPreparation.lean new file mode 100644 index 0000000000..f6c70ac9bd --- /dev/null +++ b/LeanPool/GoldbergSeymour/TchangeOutsideSwapPreparation.lean @@ -0,0 +1,688 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable +public import LeanPool.GoldbergSeymour.TchangeCounterexampleMeasure +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeVertexOrder + +/-! +# Tchange Outside Swap Preparation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_hnormalized_63.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0) (i1 : Fin + (C.T.length + (1 : ℕ))), C.T.vertex i1 = C.b1 → + ∀ (i2 : Fin (C.T.length + (1 : ℕ))), C.T.vertex i2 = C.b2 → + ∀ (i3 : Fin (C.T.length + (1 : ℕ))), C.T.vertex i3 = C.b3 → (↑i1 : ℕ) ≠ (↑i2 : ℕ) → (↑i1 : ℕ) + ≠ (↑i3 : ℕ) → (↑i2 : ℕ) ≠ (↑i3 : ℕ) → + ∃ (N : TchangeCounterexample G k e0), N.T = C.T ∧ N.phi = C.phi ∧ N.a = C.a ∧ N.b = C.b ∧ + TreeVertexOrder N.T N.b1 N.b3 ∧ TreeVertexOrder N.T N.b2 N.b3 ∧ + TchangeCounterexampleMeasure N = TchangeCounterexampleMeasure C := by + classical + intro V E _ _ _ _ G k e0 C i1 hi1 i2 hi2 i3 hi3 hi12 hi13 hi23 + by_cases h13 : i1.val < i3.val + · by_cases h23 : i2.val < i3.val + · exact ⟨C, rfl, rfl, rfl, rfl, + ⟨i1, i3, hi1, hi3, h13⟩, + ⟨i2, i3, hi2, hi3, h23⟩, rfl⟩ + · have h32 : i3.val < i2.val := by omega + let N : TchangeCounterexample G k e0 := { C with + a2 := C.a3 + b2 := C.b3 + a3 := C.a2 + b3 := C.b2 + P2 := C.P3 + P3 := C.P2 + exit2 := C.exit3 + exit3 := C.exit2 + disjoint12 := C.disjoint13 + disjoint13 := C.disjoint12 + disjoint23 := fun x hx h => C.disjoint23 x h hx + remote12 := C.remote13 + remote13 := C.remote12 + remote23 := C.remote23.symm + tree12 := C.tree13 + tree13 := C.tree12 + tree23 := C.tree23.symm + f2 := C.f3 + f3 := C.f2 + boundary2 := C.boundary3 + boundary3 := C.boundary2 + incident2 := C.incident3 + incident3 := C.incident2 + support2 := C.support3 + support3 := C.support2 } + refine ⟨N, rfl, rfl, rfl, rfl, ?_, ?_, ?_⟩ + · exact ⟨i1, i2, hi1, hi2, h13.trans h32⟩ + · exact ⟨i3, i2, hi3, hi2, h32⟩ + · simp [N, TchangeCounterexampleMeasure, Nat.add_comm, + Nat.add_left_comm, Nat.add_assoc] + · have h31 : i3.val < i1.val := by omega + by_cases h21 : i2.val < i1.val + · let N : TchangeCounterexample G k e0 := { C with + a1 := C.a2 + b1 := C.b2 + a2 := C.a3 + b2 := C.b3 + a3 := C.a1 + b3 := C.b1 + P1 := C.P2 + P2 := C.P3 + P3 := C.P1 + exit1 := C.exit2 + exit2 := C.exit3 + exit3 := C.exit1 + disjoint12 := C.disjoint23 + disjoint13 := fun x hx h => C.disjoint12 x h hx + disjoint23 := fun x hx h => C.disjoint13 x h hx + remote12 := C.remote23 + remote13 := C.remote12.symm + remote23 := C.remote13.symm + tree12 := C.tree23 + tree13 := C.tree12.symm + tree23 := C.tree13.symm + f1 := C.f2 + f2 := C.f3 + f3 := C.f1 + boundary1 := C.boundary2 + boundary2 := C.boundary3 + boundary3 := C.boundary1 + incident1 := C.incident2 + incident2 := C.incident3 + incident3 := C.incident1 + support1 := C.support2 + support2 := C.support3 + support3 := C.support1 } + refine ⟨N, rfl, rfl, rfl, rfl, ?_, ?_, ?_⟩ + · exact ⟨i2, i1, hi2, hi1, h21⟩ + · exact ⟨i3, i1, hi3, hi1, h31⟩ + · simp [N, TchangeCounterexampleMeasure, Nat.add_comm, + Nat.add_assoc] + · have h12 : i1.val < i2.val := by omega + have h32 : i3.val < i2.val := h31.trans h12 + let N : TchangeCounterexample G k e0 := { C with + a2 := C.a3 + b2 := C.b3 + a3 := C.a2 + b3 := C.b2 + P2 := C.P3 + P3 := C.P2 + exit2 := C.exit3 + exit3 := C.exit2 + disjoint12 := C.disjoint13 + disjoint13 := C.disjoint12 + disjoint23 := fun x hx h => C.disjoint23 x h hx + remote12 := C.remote13 + remote13 := C.remote12 + remote23 := C.remote23.symm + tree12 := C.tree13 + tree13 := C.tree12 + tree23 := C.tree23.symm + f2 := C.f3 + f3 := C.f2 + boundary2 := C.boundary3 + boundary3 := C.boundary2 + incident2 := C.incident3 + incident3 := C.incident2 + support2 := C.support3 + support3 := C.support2 } + refine ⟨N, rfl, rfl, rfl, rfl, ?_, ?_, ?_⟩ + · exact ⟨i1, i2, hi1, hi2, h12⟩ + · exact ⟨i3, i2, hi3, hi2, h32⟩ + · simp [N, TchangeCounterexampleMeasure, Nat.add_comm, + Nat.add_left_comm, Nat.add_assoc] + +private theorem helper_incident_vertex_mem_support_205.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (_ N : TchangeCounterexample G k e0), ( + ∀ {z : Sym2 V} {x y : V}, x ∈ z → y ∈ z → x ≠ y → z = s(x, y)) → + ∀ {u v : V} {p : (TwoColorIncidenceGraph G N.phi N.a N.b).Walk (Sum.inl u) (Sum.inl v)} + {f : E} {x : V}, p.IsPath → Sum.inr f ∈ p.support → Incident G x f → Sum.inl x ∈ p.support + := by + classical + intro V E _ _ _ _ G k e0 C N ends_eq_of_mem u v p f x hp hf hxf + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hnpos : 0 < n := by + by_contra h + have hnzero : n = 0 := by omega + rw [hnzero] at hn + simp at hn + have hnlt : n < p.length := by + by_contra h + have hneq : n = p.length := by omega + rw [hneq] at hn + simp at hn + have hprev := p.adj_getVert_succ (i := n - 1) (by omega) + have hnext := p.adj_getVert_succ (i := n) hnlt + have hnsub : n - 1 + 1 = n := by omega + rw [hnsub, hn] at hprev + rw [hn] at hnext + cases hpreveq : p.getVert (n - 1) with + | inr g => + rw [hpreveq] at hprev + simp [TwoColorIncidenceGraph] at hprev + | inl y => + rw [hpreveq] at hprev + cases hnexteq : p.getVert (n + 1) with + | inr g => + rw [hnexteq] at hnext + simp [TwoColorIncidenceGraph] at hnext + | inl z => + rw [hnexteq] at hnext + have hyf : Incident G y f := by + simpa [TwoColorIncidenceGraph] using hprev.1 + have hzf : Incident G z f := by + simpa [TwoColorIncidenceGraph] using hnext.1 + have hyz : y ≠ z := by + intro hyz + have hverts : p.getVert (n - 1) = p.getVert (n + 1) := by + rw [hpreveq, hnexteq, hyz] + have hleft : n - 1 ≤ p.length := by omega + have hright : n + 1 ≤ p.length := by omega + have hidx : n - 1 = n + 1 := + hp.getVert_injOn hleft hright hverts + omega + have hends : G.ends f = s(y, z) := + ends_eq_of_mem hyf hzf hyz + rw [Incident, hends] at hxf + have hx : x = y ∨ x = z := by simpa using hxf + rcases hx with rfl | rfl + · rw [← hpreveq] + exact p.getVert_mem_support (n - 1) + · rw [← hnexteq] + exact p.getVert_mem_support (n + 1) + +private theorem helper_path_tree_incident_boundary_263.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (_ N : + TchangeCounterexample G k e0), + (∀ {z : Sym2 V} {x y : V}, x ∈ z → y ∈ z → x ≠ y → z = s(x, y)) → + (∀ {u v : V} {p : (TwoColorIncidenceGraph G N.phi N.a N.b).Walk (Sum.inl u) (Sum.inl v)} + {f : E} {x : V}, + p.IsPath → Sum.inr f ∈ p.support → Incident G x f → Sum.inl x ∈ p.support) → + ∀ {u v : V} {p : (TwoColorIncidenceGraph G N.phi N.a N.b).Walk (Sum.inl u) (Sum.inl v)}, + TreeExitPath N.T N.phi N.a N.b u v p → + ∀ {f : E}, Sum.inr f ∈ p.support → TreeIncidentEdge N.T f → f ∈ BoundaryEdges G + (TreeSequenceVertexSet N.T) := by + classical + intro V E _ _ _ _ G k e0 C N ends_eq_of_mem incident_vertex_mem_support u v p hexit f hf hftree + obtain ⟨x, hxT, hxf⟩ := hftree + have hxSupport := incident_vertex_mem_support hexit.1 hf hxf + have hxv : x = v := (hexit.2.2.2.2.2 x hxT).mp hxSupport + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf + have hnpos : 0 < n := by + by_contra h + have hnzero : n = 0 := by omega + rw [hnzero] at hn + simp at hn + have hnlt : n < p.length := by + by_contra h + have hneq : n = p.length := by omega + rw [hneq] at hn + simp at hn + have hprev := p.adj_getVert_succ (i := n - 1) (by omega) + have hnext := p.adj_getVert_succ (i := n) hnlt + have hnsub : n - 1 + 1 = n := by omega + rw [hnsub, hn] at hprev + rw [hn] at hnext + cases hpreveq : p.getVert (n - 1) with + | inr g => + rw [hpreveq] at hprev + simp [TwoColorIncidenceGraph] at hprev + | inl y => + rw [hpreveq] at hprev + cases hnexteq : p.getVert (n + 1) with + | inr g => + rw [hnexteq] at hnext + simp [TwoColorIncidenceGraph] at hnext + | inl z => + rw [hnexteq] at hnext + have hyf : Incident G y f := by + simpa [TwoColorIncidenceGraph] using hprev.1 + have hzf : Incident G z f := by + simpa [TwoColorIncidenceGraph] using hnext.1 + have hyz : y ≠ z := by + intro hyz + have hverts : p.getVert (n - 1) = p.getVert (n + 1) := by + rw [hpreveq, hnexteq, hyz] + have hleft : n - 1 ≤ p.length := by omega + have hright : n + 1 ≤ p.length := by omega + have hidx : n - 1 = n + 1 := + hexit.1.getVert_injOn hleft hright hverts + omega + have chooseOutside : ∃ w : V, + Incident G w f ∧ w ∉ TreeSequenceVertexSet N.T ∧ x ≠ w := by + by_cases hxy : x = y + · refine ⟨z, hzf, ?_, ?_⟩ + · intro hzT + have hzv := (hexit.2.2.2.2.2 z hzT).mp (by + rw [← hnexteq] + exact p.getVert_mem_support (n + 1)) + exact hyz (hxy.symm.trans (hxv.trans hzv.symm)) + · intro hxz + exact hyz (hxy.symm.trans hxz) + · refine ⟨y, hyf, ?_, hxy⟩ + intro hyT + have hyv := (hexit.2.2.2.2.2 y hyT).mp (by + rw [← hpreveq] + exact p.getVert_mem_support (n - 1)) + exact hxy (hxv.trans hyv.symm) + obtain ⟨w, hwf, hwout, hxw⟩ := chooseOutside + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨x, hxT, w, hwout, ends_eq_of_mem hxf hwf hxw⟩ + +private theorem helper_swapped_remote_missing_384.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (N : TchangeCounterexample G k e0), + ∀ gamma ∈ MissingColors G N.phi N.b3, gamma ≠ N.b → ¬N.a = gamma → + let sigma : PartialEdgeColoring E k := OutsideTreeColorSwap N.T N.phi N.a gamma; ( + ∀ (f : E), TreeIncidentEdge N.T f → sigma f = N.phi f) → ( + ∀ {u : V} {f : E}, u ∉ TreeSequenceVertexSet N.T → Incident G u f → TreeIncidentEdge N.T f → f + ∈ BoundaryEdges G (TreeSequenceVertexSet N.T)) → + ∀ {u : V}, u ∉ TreeSequenceVertexSet N.T → N.a ∈ MissingColors G N.phi u ∨ N.b ∈ MissingColors + G N.phi u → gamma ∈ MissingColors G sigma u ∨ N.b ∈ MissingColors G sigma u := by + classical + intro V E _ _ _ _ G k e0 N gamma hgamma hgammaB hag sigma hfixed boundary_of_tree_incident_outside + u huout hmissing + rcases hmissing with haMissing | hbMissing + · left + have hnotA : N.a ∉ PresentColors G N.phi u := by + simpa [MissingColors] using haMissing + change gamma ∈ Finset.univ \ PresentColors G sigma u + rw [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + unfold PresentColors at hpresent + obtain ⟨_, ⟨f, huf, hsf⟩⟩ := Finset.mem_filter.mp hpresent + by_cases hftree : TreeIncidentEdge N.T f + · have hphif : N.phi f = some gamma := by + rw [← hfixed f hftree] + exact hsf + have hfboundary := boundary_of_tree_incident_outside huout huf hftree + exact (N.closed hfboundary N.exit3.2.2.2.1 hphif) hgamma + · by_cases hfa : N.phi f = some N.a + · exact hnotA (by + unfold PresentColors + exact Finset.mem_filter.mpr + ⟨Finset.mem_univ _, ⟨f, huf, hfa⟩⟩) + · by_cases hfg : N.phi f = some gamma + · have hbad : some N.a = some gamma := by + simp [sigma, OutsideTreeColorSwap, hftree, hfg, hag, Ne.symm hag] at hsf + exact hag (Option.some.inj hbad) + · have : N.phi f = some gamma := by + simp [sigma, OutsideTreeColorSwap, hftree, hfa, hfg] at hsf + exact hfg this + · right + have hnotB : N.b ∉ PresentColors G N.phi u := by + simpa [MissingColors] using hbMissing + change N.b ∈ Finset.univ \ PresentColors G sigma u + rw [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + unfold PresentColors at hpresent + obtain ⟨_, ⟨f, huf, hsf⟩⟩ := Finset.mem_filter.mp hpresent + have hphif : N.phi f = some N.b := by + by_cases hftree : TreeIncidentEdge N.T f + · rw [← hfixed f hftree] + exact hsf + · by_cases hfa : N.phi f = some N.a + · have hbad : some gamma = some N.b := by + simpa [sigma, OutsideTreeColorSwap, hftree, hfa, hag] using hsf + exact False.elim (hgammaB (Option.some.inj hbad)) + · by_cases hfg : N.phi f = some gamma + · have hbad : some N.a = some N.b := by + simpa [sigma, OutsideTreeColorSwap, hftree, hfa, hfg, hag, + Ne.symm hag] using hsf + exact False.elim (N.colorsDistinct (Option.some.inj hbad)) + · simpa [sigma, OutsideTreeColorSwap, hftree, hfa, hfg] using hsf + exact hnotB (by + unfold PresentColors + exact Finset.mem_filter.mpr + ⟨Finset.mem_univ _, ⟨f, huf, hphif⟩⟩) + +private theorem helper_transfer_exit_446.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (N : TchangeCounterexample G k e0) (gamma : + Fin k), gamma ≠ N.b → + let sigma : PartialEdgeColoring E k := OutsideTreeColorSwap N.T N.phi N.a gamma; ( + ∀ (f : E), TreeIncidentEdge N.T f → sigma f = N.phi f) → ( + ∀ {u v : V} {p : (TwoColorIncidenceGraph G N.phi N.a N.b).Walk (Sum.inl u) (Sum.inl v)}, + TreeExitPath N.T N.phi N.a N.b u v p → + ∀ {f : E}, Sum.inr f ∈ p.support → TreeIncidentEdge N.T f → f ∈ BoundaryEdges G + (TreeSequenceVertexSet N.T)) → ( + ∀ {u : V}, u ∉ TreeSequenceVertexSet N.T → N.a ∈ MissingColors G N.phi u ∨ N.b ∈ MissingColors + G N.phi u → gamma ∈ MissingColors G sigma u ∨ N.b ∈ MissingColors G sigma u) → + ∀ {u v : V} (p : (TwoColorIncidenceGraph G N.phi N.a N.b).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath N.T N.phi N.a N.b u v p → + ∃ (q : (TwoColorIncidenceGraph G sigma gamma N.b).Walk (Sum.inl u) (Sum.inl v)), TreeExitPath + N.T sigma gamma N.b u v q ∧ q.support = p.support ∧ q.length = p.length := by + classical + intro V E _ _ _ _ G k e0 N gamma hgammaB sigma hfixed path_tree_incident_boundary + swapped_remote_missing u v p hexit + have preserve_adj : + ∀ {w : V} {f : E}, Sum.inr f ∈ p.support → (TwoColorIncidenceGraph G N.phi N.a N.b).Adj + (Sum.inl w) (Sum.inr f) → (TwoColorIncidenceGraph G sigma gamma N.b).Adj (Sum.inl w) + (Sum.inr f) := by + intro w f hf hadj + have hold : Incident G w f ∧ + (N.phi f = some N.a ∨ N.phi f = some N.b) := by + simpa [TwoColorIncidenceGraph] using hadj + refine ⟨hold.1, ?_⟩ + by_cases hftree : TreeIncidentEdge N.T f + · have hfboundary := path_tree_incident_boundary hexit hf hftree + have hfNotA : N.phi f ≠ some N.a := by + intro hfa + have haTree := N.aMissing + obtain ⟨x, hx, hax⟩ := by + unfold TreeMissingColors at haTree + simpa only [Finset.mem_biUnion] using haTree + exact (N.closed hfboundary hx hfa) hax + have hfb : N.phi f = some N.b := hold.2.resolve_left hfNotA + exact Or.inr (by rw [hfixed f hftree, hfb]) + · rcases hold.2 with hfa | hfb + · exact Or.inl (by + simp [sigma, OutsideTreeColorSwap, hftree, hfa]) + · exact Or.inr (by + simp [sigma, OutsideTreeColorSwap, hftree, hfb, + N.colorsDistinct.symm, hgammaB.symm]) + have hedges : ∀ z, z ∈ p.edges → + z ∈ (TwoColorIncidenceGraph G sigma gamma N.b).edgeSet := by + intro z hz + induction z using Sym2.inductionOn with + | _ q r => + have hadj : (TwoColorIncidenceGraph G N.phi N.a N.b).Adj q r := + (SimpleGraph.mem_edgeSet _).mp (p.edges_subset_edgeSet hz) + have hq : q ∈ p.support := p.fst_mem_support_of_mem_edges hz + have hr : r ∈ p.support := p.snd_mem_support_of_mem_edges hz + apply (SimpleGraph.mem_edgeSet _).mpr + cases q with + | inl w => + cases r with + | inl x => simp [TwoColorIncidenceGraph] at hadj + | inr f => exact preserve_adj hr hadj + | inr f => + cases r with + | inl w => exact (preserve_adj hq hadj.symm).symm + | inr g => simp [TwoColorIncidenceGraph] at hadj + let q := p.transfer (TwoColorIncidenceGraph G sigma gamma N.b) hedges + refine ⟨q, ?_, ?_, ?_⟩ + · unfold TreeExitPath + refine ⟨hexit.1.transfer hedges, ?_, hexit.2.2.1, + hexit.2.2.2.1, ?_, ?_⟩ + · simpa [q] using hexit.2.1 + · exact swapped_remote_missing hexit.2.2.1 hexit.2.2.2.2.1 + · intro w hw + simpa [q] using hexit.2.2.2.2.2 w hw + · simp [q] + · simp [q] + +private theorem helper_branch_199.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C N : TchangeCounterexample G k e0), N.T = + C.T → N.phi = C.phi → N.a = C.a → N.b = C.b → TreeVertexOrder N.T N.b1 N.b3 → + TreeVertexOrder N.T N.b2 N.b3 → TchangeCounterexampleMeasure N = + TchangeCounterexampleMeasure C → + ∀ gamma ∈ MissingColors G N.phi N.b3, gamma ∈ TreeMissingColors N.phi N.T → gamma ≠ N.b → ¬N.a + = gamma → + ∃ (D : TchangeCounterexample G k e0), D.T = C.T ∧ D.b = C.b ∧ D.phi = OutsideTreeColorSwap C.T + C.phi C.a D.a ∧ D.a ∈ MissingColors G D.phi D.b3 ∧ TreeVertexOrder D.T D.b1 D.b3 ∧ + TreeVertexOrder D.T D.b2 D.b3 ∧ TchangeCounterexampleMeasure D = + TchangeCounterexampleMeasure C := by + classical + intro V E _ _ _ _ G k e0 C N hNT hNphi hNa hNb horder1 horder2 hmeasure gamma hgamma hgammaTree + hgammaB hag + let sigma := OutsideTreeColorSwap N.T N.phi N.a gamma + have hswap := OutsideTreeColorSwapStable N.T ∅ N.phi N.a gamma + N.triple.2.2.2.1 N.triple.2.2.2.2 N.closed N.aMissing hgammaTree hag + change IsProperEdgeColoring G sigma ∧ IsOneEdgeUncolored sigma e0 ∧ + StableColoring N.T ∅ N.phi sigma ∧ + ∀ f : E, TreeIncidentEdge N.T f → sigma f = N.phi f at hswap + obtain ⟨hsProper, hsOne, hstable, hfixed⟩ := hswap + have ends_eq_of_mem : ∀ {z : Sym2 V} {x y : V}, + x ∈ z → y ∈ z → x ≠ y → z = s(x, y) := by + intro z x y hx hy hxy + induction z using Sym2.inductionOn with + | _ a b => + simp only [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> + simp_all [] + have incident_vertex_mem_support := @helper_incident_vertex_mem_support_205 V E inferInstance + inferInstance inferInstance inferInstance G k e0 C N ends_eq_of_mem + have path_tree_incident_boundary := @helper_path_tree_incident_boundary_263 V E inferInstance + inferInstance inferInstance inferInstance G k e0 C N ends_eq_of_mem + incident_vertex_mem_support + have hsTriple : KTriple G k e0 sigma := + ⟨N.triple.1, N.triple.2.1, N.triple.2.2.1, hsProper, hsOne⟩ + have hsTree : TashkinovTree G e0 sigma N.T := by + intro j hj + obtain ⟨i, c, hc, hmissing⟩ := N.tree j hj + have hedgeTree : TreeIncidentEdge N.T (N.T.edge j) := by + obtain ⟨r, hr⟩ := N.T.attaches j + refine ⟨N.T.vertex j.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · rw [Incident, hr] + simp + refine ⟨i, c, ?_, ?_⟩ + · rw [hfixed _ hedgeTree] + exact hc + · have hv : N.T.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt))) ∈ + TreeSequenceVertexSet N.T := by + simp [TreeSequenceVertexSet] + rw [hstable.2 _ hv] + exact hmissing + have hsClosed : ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet N.T) := by + intro f c v hf hv hfc hc + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have hftree : TreeIncidentEdge N.T f := by + refine ⟨x, hx, ?_⟩ + rw [Incident, hends] + simp + have hphif : N.phi f = some c := by + rw [← hfixed f hftree] + exact hfc + have hcmissing : c ∈ MissingColors G N.phi v := by + rw [← hstable.2 v hv] + exact hc + exact (N.closed hf hv hphif) hcmissing + have boundary_of_tree_incident_outside : + ∀ {u : V} {f : E}, u ∉ TreeSequenceVertexSet N.T → Incident G u f → TreeIncidentEdge N.T f → f + ∈ BoundaryEdges G (TreeSequenceVertexSet N.T) := by + intro u f huout huf hftree + obtain ⟨x, hx, hxf⟩ := hftree + have hxu : x ≠ u := by + intro h + exact huout (h ▸ hx) + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨x, hx, u, huout, ends_eq_of_mem hxf huf hxu⟩ + have swapped_remote_missing := @helper_swapped_remote_missing_384 V E inferInstance inferInstance + inferInstance inferInstance G k e0 N gamma hgamma hgammaB hag hfixed + boundary_of_tree_incident_outside + have transfer_exit := @helper_transfer_exit_446 V E inferInstance inferInstance inferInstance + inferInstance G k e0 N gamma hgammaB hfixed path_tree_incident_boundary swapped_remote_missing + obtain ⟨Q1, hQ1, hQ1support, hQ1length⟩ := transfer_exit N.P1 N.exit1 + obtain ⟨Q2, hQ2, hQ2support, hQ2length⟩ := transfer_exit N.P2 N.exit2 + obtain ⟨Q3, hQ3, hQ3support, hQ3length⟩ := transfer_exit N.P3 N.exit3 + have boundary_preserved : ∀ {f : E}, + f ∈ BoundaryColorEdges G N.phi (TreeSequenceVertexSet N.T) N.b → + f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet N.T) N.b := by + intro f hf + obtain ⟨hfboundary, hfcolor⟩ := Finset.mem_filter.mp hf + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hfboundary + have hftree : TreeIncidentEdge N.T f := by + refine ⟨x, hx, ?_⟩ + rw [Incident, hends] + simp + apply Finset.mem_filter.mpr + exact ⟨hfboundary, (hfixed f hftree).trans hfcolor⟩ + let D : TchangeCounterexample G k e0 := { + phi := sigma + T := N.T + a := gamma + b := N.b + colorsDistinct := hgammaB + triple := hsTriple + tree := hsTree + closed := hsClosed + aMissing := by + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + exact ⟨N.b3, N.exit3.2.2.2.1, by + rw [hstable.2 N.b3 N.exit3.2.2.2.1] + exact hgamma⟩ + bNotMissing := by + intro hb + have hbNot := N.bNotMissing + unfold TreeMissingColors at hb hbNot + simp only [Finset.mem_biUnion] at hb hbNot + obtain ⟨v, hv, hbmiss⟩ := hb + apply hbNot + exact ⟨v, hv, by simpa [hstable.2 v hv] using hbmiss⟩ + a1 := N.a1 + b1 := N.b1 + a2 := N.a2 + b2 := N.b2 + a3 := N.a3 + b3 := N.b3 + P1 := Q1 + P2 := Q2 + P3 := Q3 + exit1 := hQ1 + exit2 := hQ2 + exit3 := hQ3 + disjoint12 := by + intro x hx1 hx2 + apply N.disjoint12 x + · simpa [hQ1support] using hx1 + · simpa [hQ2support] using hx2 + disjoint13 := by + intro x hx1 hx3 + apply N.disjoint13 x + · simpa [hQ1support] using hx1 + · simpa [hQ3support] using hx3 + disjoint23 := by + intro x hx2 hx3 + apply N.disjoint23 x + · simpa [hQ2support] using hx2 + · simpa [hQ3support] using hx3 + remote12 := N.remote12 + remote13 := N.remote13 + remote23 := N.remote23 + tree12 := N.tree12 + tree13 := N.tree13 + tree23 := N.tree23 + f1 := N.f1 + f2 := N.f2 + f3 := N.f3 + boundary1 := boundary_preserved N.boundary1 + boundary2 := boundary_preserved N.boundary2 + boundary3 := boundary_preserved N.boundary3 + incident1 := N.incident1 + incident2 := N.incident2 + incident3 := N.incident3 + support1 := by simpa [hQ1support] using N.support1 + support2 := by simpa [hQ2support] using N.support2 + support3 := by simpa [hQ3support] using N.support3 } + refine ⟨D, hNT, hNb, ?_, ?_, horder1, horder2, ?_⟩ + · rw [← hNT, ← hNphi, ← hNa] + · change gamma ∈ MissingColors G sigma N.b3 + rw [hstable.2 N.b3 N.exit3.2.2.2.1] + exact hgamma + · change Q1.length + Q2.length + Q3.length = + C.P1.length + C.P2.length + C.P3.length + rw [hQ1length, hQ2length, hQ3length] + simpa [TchangeCounterexampleMeasure] using hmeasure + +theorem TchangeOutsideSwapPreparation {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (C : TchangeCounterexample G k e0) : + ∃ D : TchangeCounterexample G k e0, + D.T = C.T ∧ D.b = C.b ∧ + D.phi = OutsideTreeColorSwap C.T C.phi C.a D.a ∧ + D.a ∈ MissingColors G D.phi D.b3 ∧ + TreeVertexOrder D.T D.b1 D.b3 ∧ + TreeVertexOrder D.T D.b2 D.b3 ∧ + TchangeCounterexampleMeasure D = TchangeCounterexampleMeasure C := by + classical + have hb1 : C.b1 ∈ TreeSequenceVertexSet C.T := C.exit1.2.2.2.1 + have hb2 : C.b2 ∈ TreeSequenceVertexSet C.T := C.exit2.2.2.2.1 + have hb3 : C.b3 ∈ TreeSequenceVertexSet C.T := C.exit3.2.2.2.1 + obtain ⟨i1, hi1⟩ : ∃ i, C.T.vertex i = C.b1 := by + simpa [TreeSequenceVertexSet] using hb1 + obtain ⟨i2, hi2⟩ : ∃ i, C.T.vertex i = C.b2 := by + simpa [TreeSequenceVertexSet] using hb2 + obtain ⟨i3, hi3⟩ : ∃ i, C.T.vertex i = C.b3 := by + simpa [TreeSequenceVertexSet] using hb3 + have hi12 : i1.val ≠ i2.val := by + intro h + apply C.tree12 + rw [← hi1, ← hi2, Fin.ext h] + have hi13 : i1.val ≠ i3.val := by + intro h + apply C.tree13 + rw [← hi1, ← hi3, Fin.ext h] + have hi23 : i2.val ≠ i3.val := by + intro h + apply C.tree23 + rw [← hi2, ← hi3, Fin.ext h] + have hnormalized := @helper_hnormalized_63 V E inferInstance inferInstance inferInstance + inferInstance G k e0 C i1 hi1 i2 hi2 i3 hi3 hi12 hi13 hi23 + obtain ⟨N, hNT, hNphi, hNa, hNb, horder1, horder2, hmeasure⟩ := hnormalized + obtain ⟨gamma, hgamma⟩ := MissingColorsNonemptyOfMaximumDegree G N.phi + N.triple.2.2.1 N.b3 + have hgammaTree : gamma ∈ TreeMissingColors N.phi N.T := by + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + exact ⟨N.b3, N.exit3.2.2.2.1, hgamma⟩ + have hgammaB : gamma ≠ N.b := by + intro h + exact N.bNotMissing (h ▸ hgammaTree) + by_cases hag : N.a = gamma + · have hswap : OutsideTreeColorSwap N.T N.phi N.a gamma = N.phi := by + funext f + by_cases ht : TreeIncidentEdge N.T f + · simp [OutsideTreeColorSwap, ht] + · simp only [OutsideTreeColorSwap, ht, ite_false, hag] + split <;> simp_all + refine ⟨N, hNT, hNb, ?_, ?_, horder1, horder2, hmeasure⟩ + · rw [← hNT, ← hNphi, ← hNa, hag] + simpa [hag] using hswap.symm + · simpa [hag] using hgamma + · exact @helper_branch_199 V E inferInstance inferInstance inferInstance inferInstance G k e0 C + N hNT hNphi hNa hNb horder1 horder2 hmeasure gamma hgamma hgammaTree hgammaB hag +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TchangeStrictShortening.lean b/LeanPool/GoldbergSeymour/TchangeStrictShortening.lean new file mode 100644 index 0000000000..d5ad89431b --- /dev/null +++ b/LeanPool/GoldbergSeymour/TchangeStrictShortening.lean @@ -0,0 +1,594 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TchangeCounterexampleMeasure +public import LeanPool.GoldbergSeymour.TchangeKempeClosureData +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph + +/-! +# Tchange Strict Shortening + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem helper_firstEntry_48.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0) + (D : TchangeKempeClosureData C), + let U : Finset V := TreeSequenceVertexSet D.closedTree; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G D.sigma C.a C.b; + ∀ (a b : V) (Q : H.Walk (Sum.inl a) (Sum.inl b)), + Q.IsPath → + C.a ∈ MissingColors G D.sigma a ∨ C.b ∈ MissingColors G D.sigma a → + a ∉ U → + b ∈ U → + ∃ (c : V) (_ : c ∈ U) (hcQ : Sum.inl c ∈ Q.support), + let L : H.Walk (Sum.inl a) (Sum.inl c) := Q.takeUntil (Sum.inl c) hcQ; + TreeExitPath D.closedTree D.sigma C.a C.b a c L ∧ + ∃ (g : E) (x : V), + Sum.inr g ∈ L.support ∧ + Incident G c g ∧ + Incident G x g ∧ + x ∉ U ∧ g ∈ BoundaryEdges G U ∧ (D.sigma g = some C.a ∨ D.sigma g = some C.b) := by + classical + intro V E _ _ _ _ G k e0 C D U H a b Q hQ hmissing haU hbU + let S : Finset (Sum V E) := U.image Sum.inl + obtain ⟨z, hzS, hzQ, hzfirst⟩ := + Q.exists_mem_support_forall_mem_support_imp_eq S (by + refine ⟨Sum.inl b, ?_⟩ + simp [S, hbU]) + obtain ⟨c, hcU, hcz⟩ : ∃ c, c ∈ U ∧ Sum.inl c = z := by + simpa [S] using hzS + subst z + let L := Q.takeUntil (Sum.inl c) hzQ + have hLc : ∀ w ∈ U, (Sum.inl w ∈ L.support ↔ w = c) := by + intro w hwU + constructor + · intro hwL + have heq := hzfirst (Sum.inl w) (by simp [S, hwU]) hwL + exact Sum.inl.inj heq + · rintro rfl + exact L.end_mem_support + have hac : a ≠ c := by + intro hac + apply haU + simpa [hac] using hcU + have hLpath : L.IsPath := hQ.takeUntil _ + have hLlen : 2 ≤ L.length := by + have hpos : 0 < L.length := by + apply Nat.pos_of_ne_zero + intro hn + have hnil : L.Nil := SimpleGraph.Walk.length_eq_zero_iff.mp hn + exact hac (Sum.inl.inj hnil.eq) + by_contra hnot + have hlen : L.length = 1 := by omega + have hadj := L.adj_getVert_succ (i := 0) (by omega) + have hend : L.getVert 1 = Sum.inl c := by + have := L.getVert_length + rwa [hlen] at this + rw [L.getVert_zero, hend] at hadj + simp [H, TwoColorIncidenceGraph] at hadj + have hExit : TreeExitPath D.closedTree D.sigma C.a C.b a c L := by + unfold TreeExitPath + refine ⟨hLpath, hLlen, haU, hcU, ?_, hLc⟩ + exact hmissing + have hlastAdj := L.adj_getVert_succ (i := L.length - 1) (by omega) + have hlastSucc : L.length - 1 + 1 = L.length := by omega + rw [hlastSucc, L.getVert_length] at hlastAdj + cases hlast : L.getVert (L.length - 1) with + | inl v => + rw [hlast] at hlastAdj + simp [H, TwoColorIncidenceGraph] at hlastAdj + | inr g => + rw [hlast] at hlastAdj + have hgc : Incident G c g ∧ + (D.sigma g = some C.a ∨ D.sigma g = some C.b) := by + simpa [H, TwoColorIncidenceGraph] using hlastAdj + have hprevAdj := L.adj_getVert_succ (i := L.length - 2) (by omega) + have hprevSucc : L.length - 2 + 1 = L.length - 1 := by omega + rw [hprevSucc, hlast] at hprevAdj + cases hprev : L.getVert (L.length - 2) with + | inr f => + rw [hprev] at hprevAdj + simp [H, TwoColorIncidenceGraph] at hprevAdj + | inl x => + rw [hprev] at hprevAdj + have hxg : Incident G x g := by + have hdata : Incident G x g ∧ + (D.sigma g = some C.a ∨ D.sigma g = some C.b) := by + simpa [H, TwoColorIncidenceGraph] using hprevAdj + exact hdata.1 + have hxout : x ∉ U := by + intro hxU + have hxc := (hLc x hxU).mp (by + rw [← hprev] + exact L.getVert_mem_support (L.length - 2)) + have heq : L.getVert (L.length - 2) = L.getVert L.length := by + rw [hprev, L.getVert_length, hxc] + have := hLpath.getVert_injOn (Nat.sub_le _ _) (by simp) heq + omega + have hcg : c ≠ x := by + intro hcx + exact hxout (hcx ▸ hcU) + have hends : G.ends g = s(c, x) := + (Sym2.mem_and_mem_iff hcg).mp ⟨hgc.1, hxg⟩ + have hboundary : g ∈ BoundaryEdges G U := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨c, hcU, x, hxout, hends⟩ + refine ⟨c, hcU, hzQ, hExit, g, x, ?_, hgc.1, hxg, + hxout, hboundary, hgc.2⟩ + rw [← hlast] + exact L.getVert_mem_support (L.length - 1) + +private theorem helper_hf1NotL_369.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0) + (D : TchangeKempeClosureData C), + let _ : Finset V := TreeSequenceVertexSet D.closedTree; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G D.sigma C.a C.b; + ∀ (c1 : V) (hc1Q : Sum.inl c1 ∈ D.Q1.support), + TreeExitPath D.closedTree D.sigma C.a C.b C.a1 c1 (D.Q1.takeUntil (Sum.inl c1) hc1Q) → + ∀ (c2 : V), + Sum.inl c2 ∈ D.Q2.support → + ∀ (c3 : V), + Sum.inl c3 ∈ D.Q3.support → + let L1 : (TwoColorIncidenceGraph G D.sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl c1) := + D.Q1.takeUntil (Sum.inl c1) hc1Q; + H = TwoColorIncidenceGraph G D.sigma C.b C.a → + Sum.inr C.f1 ∉ L1.support := by + classical + intro V E _ _ _ _ G k e0 C D U H c1 hc1Q hExit1 c2 hc2Q c3 hc3Q L1 hGraph hf1L + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hf1L + have hnpos : 0 < n := by + by_contra hnpos + have hnzero : n = 0 := by omega + rw [hnzero, L1.getVert_zero] at hn + simp at hn + have hnlt : n < L1.length := by + by_contra hnlt + have hneq : n = L1.length := by omega + rw [hneq, L1.getVert_length] at hn + simp at hn + have hprevAdj := L1.adj_getVert_succ (i := n - 1) (by omega) + have hprevSucc : n - 1 + 1 = n := by omega + rw [hprevSucc, hn] at hprevAdj + cases hprev : L1.getVert (n - 1) with + | inr f => + rw [hprev] at hprevAdj + simp [TwoColorIncidenceGraph] at hprevAdj + | inl x => + rw [hprev] at hprevAdj + have hxf1 : Incident G x C.f1 := by + have hdata : Incident G x C.f1 ∧ + (D.sigma C.f1 = some C.a ∨ D.sigma C.f1 = some C.b) := by + simpa [H, TwoColorIncidenceGraph] using hprevAdj + exact hdata.1 + have hxU : x ∈ U := D.f1EndsInside x hxf1 + have hxc : x = c1 := (hExit1.2.2.2.2.2 x hxU).mp (by + rw [← hprev] + exact L1.getVert_mem_support (n - 1)) + have heq : L1.getVert (n - 1) = L1.getVert L1.length := by + rw [hprev, L1.getVert_length, hxc] + have hpathL1 : L1.IsPath := hExit1.1 + have hindices := hpathL1.getVert_injOn + ((Nat.sub_le n 1).trans hnle) (by simp) heq + omega + +private theorem helper_continuation_388.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0) + (D : TchangeKempeClosureData C), + let U : Finset V := TreeSequenceVertexSet D.closedTree; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G D.sigma C.a C.b; + ∀ (c1 : V) (hc1Q : Sum.inl c1 ∈ D.Q1.support), + TreeExitPath D.closedTree D.sigma C.a C.b C.a1 c1 (D.Q1.takeUntil (Sum.inl c1) hc1Q) → + ∀ (g1 : E) (hg1L : Sum.inr g1 ∈ (D.Q1.takeUntil (Sum.inl c1) hc1Q).support) + (hg1c : Incident G c1 g1) (c2 : V) (hc2Q : Sum.inl c2 ∈ D.Q2.support) (g2 : E) + (hg2L : Sum.inr g2 ∈ (D.Q2.takeUntil (Sum.inl c2) hc2Q).support) + (hg2c : Incident G c2 g2) (c3 : V) (hc3Q : Sum.inl c3 ∈ D.Q3.support) (g3 : E) + (hg3L : Sum.inr g3 ∈ (D.Q3.takeUntil (Sum.inl c3) hc3Q).support) + (hg3c : Incident G c3 g3), + let L1 : (TwoColorIncidenceGraph G D.sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl c1) := + D.Q1.takeUntil (Sum.inl c1) hc1Q; + let L2 : (TwoColorIncidenceGraph G D.sigma C.a C.b).Walk (Sum.inl C.a2) (Sum.inl c2) := + D.Q2.takeUntil (Sum.inl c2) hc2Q; + let L3 : (TwoColorIncidenceGraph G D.sigma C.a C.b).Walk (Sum.inl C.a3) (Sum.inl c3) := + D.Q3.takeUntil (Sum.inl c3) hc3Q; + ∀ (hc12 : c1 ≠ c2) (hc13 : c1 ≠ c3) (hc23 : c2 ≠ c3) + (hbTree : C.b ∈ TreeMissingColors D.sigma D.closedTree) + (haNotTree : C.a ∉ TreeMissingColors D.sigma D.closedTree) + (hGraph : H = TwoColorIncidenceGraph G D.sigma C.b C.a), + let L1' : (TwoColorIncidenceGraph G D.sigma C.b C.a).Walk (Sum.inl C.a1) (Sum.inl c1) := + hGraph ▸ L1; + let L2' : (TwoColorIncidenceGraph G D.sigma C.b C.a).Walk (Sum.inl C.a2) (Sum.inl c2) := + hGraph ▸ L2; + let L3' : (TwoColorIncidenceGraph G D.sigma C.b C.a).Walk (Sum.inl C.a3) (Sum.inl c3) := + hGraph ▸ L3; + ∀ (hL1Support : L1'.support = L1.support) (hL2Support : L2'.support = L2.support) + (hL3Support : L3'.support = L3.support), + L1'.length = L1.length → + L2'.length = L2.length → + L3'.length = L3.length → + ∀ (hExit1' : TreeExitPath D.closedTree D.sigma C.b C.a C.a1 c1 L1') + (hExit2' : TreeExitPath D.closedTree D.sigma C.b C.a C.a2 c2 L2') + (hExit3' : TreeExitPath D.closedTree D.sigma C.b C.a C.a3 c3 L3') + (hdis12' : ∀ z ∈ L1'.support, z ∉ L2'.support) + (hdis13' : ∀ z ∈ L1'.support, z ∉ L3'.support) + (hdis23' : ∀ z ∈ L2'.support, z ∉ L3'.support) + (hg1BoundaryColor : g1 ∈ BoundaryColorEdges G D.sigma U C.a) + (hg2BoundaryColor : g2 ∈ BoundaryColorEdges G D.sigma U C.a) + (hg3BoundaryColor : g3 ∈ BoundaryColorEdges G D.sigma U C.a), + let _ : TchangeCounterexample G k e0 := + { phi := D.sigma, T := D.closedTree, a := C.b, b := C.a, + colorsDistinct := Ne.symm C.colorsDistinct, triple := D.triple, + tree := D.closureTree, closed := fun {_ : E} {_ : Fin k} {_ : V} => D.closureClosed, + aMissing := hbTree, bNotMissing := haNotTree, a1 := C.a1, b1 := c1, a2 := C.a2, + b2 := c2, a3 := C.a3, b3 := c3, P1 := L1', P2 := L2', P3 := L3', exit1 := hExit1', + exit2 := hExit2', exit3 := hExit3', disjoint12 := hdis12', disjoint13 := hdis13', + disjoint23 := hdis23', remote12 := C.remote12, remote13 := C.remote13, + remote23 := C.remote23, tree12 := hc12, tree13 := hc13, tree23 := hc23, f1 := g1, + f2 := g2, f3 := g3, boundary1 := hg1BoundaryColor, boundary2 := hg2BoundaryColor, + boundary3 := hg3BoundaryColor, incident1 := hg1c, incident2 := hg2c, + incident3 := hg3c, + support1 := + Eq.mpr (id (congrArg (fun (_a : List (V ⊕ E)) => Sum.inr g1 ∈ _a) hL1Support)) + hg1L, + support2 := + Eq.mpr (id (congrArg (fun (_a : List (V ⊕ E)) => Sum.inr g2 ∈ _a) hL2Support)) + hg2L, + support3 := + Eq.mpr (id (congrArg (fun (_a : List (V ⊕ E)) => Sum.inr g3 ∈ _a) hL3Support)) + hg3L : + TchangeCounterexample G k e0 }; + ∃ (C' : TchangeCounterexample G k e0), + TchangeCounterexampleMeasure C' < TchangeCounterexampleMeasure C := by + classical + intro V E _ _ _ _ G k e0 C D U H c1 hc1Q hExit1 g1 hg1L hg1c c2 hc2Q g2 hg2L hg2c c3 hc3Q g3 + hg3L hg3c L1 L2 L3 hc12 hc13 hc23 hbTree haNotTree hGraph L1' L2' L3' hL1Support hL2Support + hL3Support hL1Length hL2Length hL3Length hExit1' hExit2' hExit3' hdis12' hdis13' hdis23' + hg1BoundaryColor hg2BoundaryColor hg3BoundaryColor C' + have hf1Q : Sum.inr C.f1 ∈ D.Q1.support := by + rw [D.support1] + exact C.support1 + have hf1NotL := @helper_hf1NotL_369 V E inferInstance inferInstance inferInstance inferInstance G + k e0 C D c1 hc1Q hExit1 c2 hc2Q c3 hc3Q hGraph + have hlen1 : L1.length < D.Q1.length := by + have hle : L1.length ≤ D.Q1.length := by + exact D.Q1.length_takeUntil_le_length hc1Q + by_contra hnlt + have heqLen : L1.length = D.Q1.length := by omega + have hsupportEq : L1.support = D.Q1.support := by + apply (D.Q1.support_takeUntil_prefix_support hc1Q).eq_of_length + rw [L1.length_support, D.Q1.length_support, heqLen] + apply hf1NotL + rw [hsupportEq] + exact hf1Q + have hlen2 : L2.length ≤ D.Q2.length := + D.Q2.length_takeUntil_le_length hc2Q + have hlen3 : L3.length ≤ D.Q3.length := + D.Q3.length_takeUntil_le_length hc3Q + refine ⟨C', ?_⟩ + unfold TchangeCounterexampleMeasure + dsimp [C'] + rw [hL1Length, hL2Length, hL3Length, ← D.length1, ← D.length2, + ← D.length3] + omega + +private theorem helper_continuation_315.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (C : TchangeCounterexample G k e0) + (D : TchangeKempeClosureData C), + let U : Finset V := TreeSequenceVertexSet D.closedTree; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G D.sigma C.a C.b; + ∀ (c1 : V) (hc1Q : Sum.inl c1 ∈ D.Q1.support), + TreeExitPath D.closedTree D.sigma C.a C.b C.a1 c1 (D.Q1.takeUntil (Sum.inl c1) hc1Q) → + ∀ (g1 : E), + Sum.inr g1 ∈ (D.Q1.takeUntil (Sum.inl c1) hc1Q).support → + Incident G c1 g1 → + g1 ∈ BoundaryEdges G U → + ∀ (c2 : V) (hc2Q : Sum.inl c2 ∈ D.Q2.support), + TreeExitPath D.closedTree D.sigma C.a C.b C.a2 c2 (D.Q2.takeUntil (Sum.inl c2) hc2Q) → + ∀ (g2 : E), + Sum.inr g2 ∈ (D.Q2.takeUntil (Sum.inl c2) hc2Q).support → + Incident G c2 g2 → + g2 ∈ BoundaryEdges G U → + ∀ (c3 : V) (hc3Q : Sum.inl c3 ∈ D.Q3.support), + TreeExitPath D.closedTree D.sigma C.a C.b C.a3 c3 (D.Q3.takeUntil (Sum.inl c3) hc3Q) → + ∀ (g3 : E), + Sum.inr g3 ∈ (D.Q3.takeUntil (Sum.inl c3) hc3Q).support → + Incident G c3 g3 → + g3 ∈ BoundaryEdges G U → + let L1 : (TwoColorIncidenceGraph G D.sigma C.a C.b).Walk (Sum.inl C.a1) (Sum.inl c1) := + D.Q1.takeUntil (Sum.inl c1) hc1Q; + let L2 : (TwoColorIncidenceGraph G D.sigma C.a C.b).Walk (Sum.inl C.a2) (Sum.inl c2) := + D.Q2.takeUntil (Sum.inl c2) hc2Q; + let L3 : (TwoColorIncidenceGraph G D.sigma C.a C.b).Walk (Sum.inl C.a3) (Sum.inl c3) := + D.Q3.takeUntil (Sum.inl c3) hc3Q; + D.sigma g1 = some C.a → + D.sigma g2 = some C.a → + D.sigma g3 = some C.a → + (∀ z ∈ L1.support, z ∉ L2.support) → + (∀ z ∈ L1.support, z ∉ L3.support) → + (∀ z ∈ L2.support, z ∉ L3.support) → + c1 ≠ c2 → + c1 ≠ c3 → + c2 ≠ c3 → + C.b ∈ TreeMissingColors D.sigma D.closedTree → + C.a ∉ TreeMissingColors D.sigma D.closedTree → + H = TwoColorIncidenceGraph G D.sigma C.b C.a → + ∃ (C' : TchangeCounterexample G k e0), + TchangeCounterexampleMeasure C' < TchangeCounterexampleMeasure C := by + classical + intro V E _ _ _ _ G k e0 C D U H c1 hc1Q hExit1 g1 hg1L hg1c hg1Boundary c2 hc2Q hExit2 g2 hg2L + hg2c hg2Boundary c3 hc3Q hExit3 g3 hg3L hg3c hg3Boundary L1 L2 L3 hg1a hg2a hg3a hdis12 + hdis13 hdis23 hc12 hc13 hc23 hbTree haNotTree hGraph + have walkCastSupport {H1 H2 : SimpleGraph (Sum V E)} (h : H1 = H2) + {z w : Sum V E} (p : H1.Walk z w) : + (h ▸ p).support = p.support := by + subst H2 + rfl + have walkCastLength {H1 H2 : SimpleGraph (Sum V E)} (h : H1 = H2) + {z w : Sum V E} (p : H1.Walk z w) : + (h ▸ p).length = p.length := by + subst H2 + rfl + have walkCastPath {H1 H2 : SimpleGraph (Sum V E)} (h : H1 = H2) + {z w : Sum V E} (p : H1.Walk z w) (hp : p.IsPath) : + (h ▸ p).IsPath := by + subst H2 + exact hp + let L1' : (TwoColorIncidenceGraph G D.sigma C.b C.a).Walk + (Sum.inl C.a1) (Sum.inl c1) := hGraph ▸ L1 + let L2' : (TwoColorIncidenceGraph G D.sigma C.b C.a).Walk + (Sum.inl C.a2) (Sum.inl c2) := hGraph ▸ L2 + let L3' : (TwoColorIncidenceGraph G D.sigma C.b C.a).Walk + (Sum.inl C.a3) (Sum.inl c3) := hGraph ▸ L3 + have hL1Support : L1'.support = L1.support := by + exact walkCastSupport hGraph L1 + have hL2Support : L2'.support = L2.support := by + exact walkCastSupport hGraph L2 + have hL3Support : L3'.support = L3.support := by + exact walkCastSupport hGraph L3 + have hL1Length : L1'.length = L1.length := by + exact walkCastLength hGraph L1 + have hL2Length : L2'.length = L2.length := by + exact walkCastLength hGraph L2 + have hL3Length : L3'.length = L3.length := by + exact walkCastLength hGraph L3 + have hExit1' : TreeExitPath D.closedTree D.sigma C.b C.a C.a1 c1 L1' := by + unfold TreeExitPath at hExit1 ⊢ + refine ⟨?_, ?_, hExit1.2.2.1, hExit1.2.2.2.1, ?_, ?_⟩ + · exact walkCastPath hGraph L1 hExit1.1 + · rw [hL1Length] + exact hExit1.2.1 + · exact hExit1.2.2.2.2.1.symm + · intro w hw + rw [hL1Support] + exact hExit1.2.2.2.2.2 w hw + have hExit2' : TreeExitPath D.closedTree D.sigma C.b C.a C.a2 c2 L2' := by + unfold TreeExitPath at hExit2 ⊢ + refine ⟨?_, ?_, hExit2.2.2.1, hExit2.2.2.2.1, ?_, ?_⟩ + · exact walkCastPath hGraph L2 hExit2.1 + · rw [hL2Length] + exact hExit2.2.1 + · exact hExit2.2.2.2.2.1.symm + · intro w hw + rw [hL2Support] + exact hExit2.2.2.2.2.2 w hw + have hExit3' : TreeExitPath D.closedTree D.sigma C.b C.a C.a3 c3 L3' := by + unfold TreeExitPath at hExit3 ⊢ + refine ⟨?_, ?_, hExit3.2.2.1, hExit3.2.2.2.1, ?_, ?_⟩ + · exact walkCastPath hGraph L3 hExit3.1 + · rw [hL3Length] + exact hExit3.2.1 + · exact hExit3.2.2.2.2.1.symm + · intro w hw + rw [hL3Support] + exact hExit3.2.2.2.2.2 w hw + have hdis12' : ∀ z, z ∈ L1'.support → z ∉ L2'.support := by + intro z hz1 hz2 + rw [hL1Support] at hz1 + rw [hL2Support] at hz2 + exact hdis12 z hz1 hz2 + have hdis13' : ∀ z, z ∈ L1'.support → z ∉ L3'.support := by + intro z hz1 hz3 + rw [hL1Support] at hz1 + rw [hL3Support] at hz3 + exact hdis13 z hz1 hz3 + have hdis23' : ∀ z, z ∈ L2'.support → z ∉ L3'.support := by + intro z hz2 hz3 + rw [hL2Support] at hz2 + rw [hL3Support] at hz3 + exact hdis23 z hz2 hz3 + have hg1BoundaryColor : + g1 ∈ BoundaryColorEdges G D.sigma U C.a := by + simp [BoundaryColorEdges, hg1Boundary, hg1a] + have hg2BoundaryColor : + g2 ∈ BoundaryColorEdges G D.sigma U C.a := by + simp [BoundaryColorEdges, hg2Boundary, hg2a] + have hg3BoundaryColor : + g3 ∈ BoundaryColorEdges G D.sigma U C.a := by + simp [BoundaryColorEdges, hg3Boundary, hg3a] + let C' : TchangeCounterexample G k e0 := { + phi := D.sigma + T := D.closedTree + a := C.b + b := C.a + colorsDistinct := C.colorsDistinct.symm + triple := D.triple + tree := D.closureTree + closed := D.closureClosed + aMissing := hbTree + bNotMissing := haNotTree + a1 := C.a1 + b1 := c1 + a2 := C.a2 + b2 := c2 + a3 := C.a3 + b3 := c3 + P1 := L1' + P2 := L2' + P3 := L3' + exit1 := hExit1' + exit2 := hExit2' + exit3 := hExit3' + disjoint12 := hdis12' + disjoint13 := hdis13' + disjoint23 := hdis23' + remote12 := C.remote12 + remote13 := C.remote13 + remote23 := C.remote23 + tree12 := hc12 + tree13 := hc13 + tree23 := hc23 + f1 := g1 + f2 := g2 + f3 := g3 + boundary1 := hg1BoundaryColor + boundary2 := hg2BoundaryColor + boundary3 := hg3BoundaryColor + incident1 := hg1c + incident2 := hg2c + incident3 := hg3c + support1 := by rw [hL1Support]; exact hg1L + support2 := by rw [hL2Support]; exact hg2L + support3 := by rw [hL3Support]; exact hg3L } + exact @helper_continuation_388 V E inferInstance inferInstance inferInstance inferInstance G k + e0 C D c1 hc1Q hExit1 g1 hg1L hg1c c2 hc2Q g2 hg2L hg2c c3 hc3Q g3 hg3L hg3c hc12 hc13 hc23 + hbTree haNotTree hGraph hL1Support hL2Support hL3Support hL1Length hL2Length hL3Length + hExit1' hExit2' hExit3' hdis12' hdis13' hdis23' hg1BoundaryColor hg2BoundaryColor + hg3BoundaryColor +theorem TchangeStrictShortening {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (C : TchangeCounterexample G k e0) + (D : TchangeKempeClosureData C) : + ∃ C' : TchangeCounterexample G k e0, + TchangeCounterexampleMeasure C' < TchangeCounterexampleMeasure C := by + classical + let U := TreeSequenceVertexSet D.closedTree + let H := TwoColorIncidenceGraph G D.sigma C.a C.b + have firstEntry := @helper_firstEntry_48 V E inferInstance inferInstance inferInstance + inferInstance G k e0 C D + obtain ⟨c1, hc1U, hc1Q, hExit1, g1, x1, hg1L, hg1c, hg1x, + hx1out, hg1Boundary, hg1Color⟩ := + firstEntry C.a1 C.b1 D.Q1 D.exit1.1 D.exit1.2.2.2.2.1 + D.a1Outside D.b1InClosure + obtain ⟨c2, hc2U, hc2Q, hExit2, g2, x2, hg2L, hg2c, hg2x, + hx2out, hg2Boundary, hg2Color⟩ := + firstEntry C.a2 C.b2 D.Q2 D.exit2.1 D.exit2.2.2.2.2.1 + D.a2Outside D.b2InClosure + obtain ⟨c3, hc3U, hc3Q, hExit3, g3, x3, hg3L, hg3c, hg3x, + hx3out, hg3Boundary, hg3Color⟩ := + firstEntry C.a3 C.b3 D.Q3 D.exit3.1 D.exit3.2.2.2.2.1 + D.a3Outside D.b3InClosure + let L1 := D.Q1.takeUntil (Sum.inl c1) hc1Q + let L2 := D.Q2.takeUntil (Sum.inl c2) hc2Q + let L3 := D.Q3.takeUntil (Sum.inl c3) hc3Q + have hL1Q1 : L1.support ⊆ D.Q1.support := + D.Q1.support_takeUntil_subset_support hc1Q + have hL2Q2 : L2.support ⊆ D.Q2.support := + D.Q2.support_takeUntil_subset_support hc2Q + have hL3Q3 : L3.support ⊆ D.Q3.support := + D.Q3.support_takeUntil_subset_support hc3Q + have hg1a : D.sigma g1 = some C.a := by + apply hg1Color.resolve_right + intro hg1b + exact (D.closureClosed hg1Boundary D.b3InClosure hg1b) D.betaMissing + have hg2a : D.sigma g2 = some C.a := by + apply hg2Color.resolve_right + intro hg2b + exact (D.closureClosed hg2Boundary D.b3InClosure hg2b) D.betaMissing + have hg3a : D.sigma g3 = some C.a := by + apply hg3Color.resolve_right + intro hg3b + exact (D.closureClosed hg3Boundary D.b3InClosure hg3b) D.betaMissing + have hdis12 : ∀ z, z ∈ L1.support → z ∉ L2.support := by + intro z hz1 hz2 + exact C.disjoint12 z (by rw [← D.support1]; exact hL1Q1 hz1) + (by rw [← D.support2]; exact hL2Q2 hz2) + have hdis13 : ∀ z, z ∈ L1.support → z ∉ L3.support := by + intro z hz1 hz3 + exact C.disjoint13 z (by rw [← D.support1]; exact hL1Q1 hz1) + (by rw [← D.support3]; exact hL3Q3 hz3) + have hdis23 : ∀ z, z ∈ L2.support → z ∉ L3.support := by + intro z hz2 hz3 + exact C.disjoint23 z (by rw [← D.support2]; exact hL2Q2 hz2) + (by rw [← D.support3]; exact hL3Q3 hz3) + have hc12 : c1 ≠ c2 := by + intro hc + have hgne : g1 ≠ g2 := by + intro hge + subst g2 + exact hdis12 (Sum.inr g1) hg1L hg2L + exact D.triple.2.2.2.1 hgne ⟨c1, hg1c, hc ▸ hg2c⟩ hg1a + (by simpa using hg2a) + have hc13 : c1 ≠ c3 := by + intro hc + have hgne : g1 ≠ g3 := by + intro hge + subst g3 + exact hdis13 (Sum.inr g1) hg1L hg3L + exact D.triple.2.2.2.1 hgne ⟨c1, hg1c, hc ▸ hg3c⟩ hg1a + (by simpa using hg3a) + have hc23 : c2 ≠ c3 := by + intro hc + have hgne : g2 ≠ g3 := by + intro hge + subst g3 + exact hdis23 (Sum.inr g2) hg2L hg3L + exact D.triple.2.2.2.1 hgne ⟨c2, hg2c, hc ▸ hg3c⟩ hg2a + (by simpa using hg3a) + have hbTree : C.b ∈ TreeMissingColors D.sigma D.closedTree := by + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + exact ⟨C.b3, D.b3InClosure, D.betaMissing⟩ + have haNotTree : C.a ∉ TreeMissingColors D.sigma D.closedTree := by + intro haTree + unfold TreeMissingColors at haTree + simp only [Finset.mem_biUnion] at haTree + obtain ⟨v, hvU, hva⟩ := haTree + exact (D.closureClosed hg1Boundary hvU hg1a) hva + have hGraph : H = TwoColorIncidenceGraph G D.sigma C.b C.a := by + apply SimpleGraph.ext + funext z w + cases z <;> cases w <;> + simp [H, TwoColorIncidenceGraph, or_comm] + exact @helper_continuation_315 V E inferInstance inferInstance inferInstance inferInstance G k + e0 C D c1 hc1Q hExit1 g1 hg1L hg1c hg1Boundary c2 hc2Q hExit2 g2 hg2L hg2c hg2Boundary c3 + hc3Q hExit3 g3 hg3L hg3c hg3Boundary hg1a hg2a hg3a hdis12 hdis13 hdis23 hc12 hc13 hc23 + hbTree haNotTree hGraph +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Td.lean b/LeanPool/GoldbergSeymour/Td.lean new file mode 100644 index 0000000000..c648bca57a --- /dev/null +++ b/LeanPool/GoldbergSeymour/Td.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TdTerminalRERebuild +public import LeanPool.GoldbergSeymour.TdTerminalSEPERebuild + +/-! +# Td + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem Td {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring Tn + (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma → + ModColoring ett sigma := by + classical + dsimp + intro sigma hsigmaProper hsigmaOneUncolored hsigmaStable + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + have hkind : + ett.series.data.kind n = some TashkinovExtensionKind.RE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.PE := by + generalize hindex : n = index + cases ett.series.certified index with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hval := congrArg Fin.val hindex + dsimp [n] at hval + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + right + left + exact currentKind + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + right + right + exact currentKind + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + left + exact currentKind + rcases hkind with hRE | hSE | hPE + · exact TdTerminalRERebuild G k e0 input T generating ett hMP hpositive + hlower hRE sigma hsigmaProper hsigmaOneUncolored hsigmaStable + · exact TdTerminalSEPERebuild G k e0 input T generating ett hMP hpositive + hlower (Or.inl hSE) sigma hsigmaProper hsigmaOneUncolored hsigmaStable + · exact TdTerminalSEPERebuild G k e0 input T generating ett hMP hpositive + hlower (Or.inr hPE) sigma hsigmaProper hsigmaOneUncolored hsigmaStable + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TdEarlierPEWitnessIdentification.lean b/LeanPool/GoldbergSeymour/TdEarlierPEWitnessIdentification.lean new file mode 100644 index 0000000000..5153b1171e --- /dev/null +++ b/LeanPool/GoldbergSeymour/TdEarlierPEWitnessIdentification.lean @@ -0,0 +1,121 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MissingColors + +/-! +# Td Earlier PEWitness Identification + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TdEarlierPEWitnessIdentification {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (T : TreeSequence G e0) (C Cstar : Finset (Fin k)) + (phi phiStar : PartialEdgeColoring E k) + (choice : MaximumDefectiveChoice G e0 T C phi) + (choiceStar : MaximumDefectiveChoice G e0 T Cstar phiStar) + (gamma gammaStar : Fin k) + (post postStar : PartialEdgeColoring E k) + (hedges : ({choice.edge} : Finset E) = {choiceStar.edge}) + (hpairs : ({choice.color, gamma} : Finset (Fin k)) = + {choiceStar.color, gammaStar}) + (hmissing : MissingColors G post choice.vertex = + MissingColors G postStar choiceStar.vertex) + (hdelta : choice.color ∈ MissingColors G post choice.vertex) + (hgamma : gamma ∉ MissingColors G post choice.vertex) + (hdeltaStar : choiceStar.color ∈ + MissingColors G postStar choiceStar.vertex) + (hgammaStar : gammaStar ∉ + MissingColors G postStar choiceStar.vertex) : + choiceStar.edge = choice.edge ∧ + choiceStar.vertex = choice.vertex ∧ + choiceStar.otherEndpoint = choice.otherEndpoint ∧ + choiceStar.color = choice.color ∧ gammaStar = gamma := by + classical + have hedge : choiceStar.edge = choice.edge := by + apply Finset.mem_singleton.mp + rw [hedges] + exact Finset.mem_singleton_self _ + have hends : s(choice.vertex, choice.otherEndpoint) = + s(choiceStar.vertex, choiceStar.otherEndpoint) := by + calc + s(choice.vertex, choice.otherEndpoint) = G.ends choice.edge := + choice.edgeEnds.symm + _ = G.ends choiceStar.edge := congrArg G.ends hedge.symm + _ = s(choiceStar.vertex, choiceStar.otherEndpoint) := choiceStar.edgeEnds + have hvertex : choiceStar.vertex = choice.vertex := by + rcases (Sym2.eq_iff.mp hends) with hstraight | hcross + · exact hstraight.1.symm + · exfalso + have hin : choice.vertex ∈ TreeSequenceVertexSet T := + choice.vertexDefective.1 + have hout : choiceStar.otherEndpoint ∉ TreeSequenceVertexSet T := by + exact choiceStar.otherOutside + apply hout + exact hcross.1 ▸ hin + have hother : choiceStar.otherEndpoint = choice.otherEndpoint := by + rcases (Sym2.eq_iff.mp hends) with hstraight | hcross + · exact hstraight.2.symm + · exfalso + have hin : choiceStar.vertex ∈ TreeSequenceVertexSet T := by + exact choiceStar.vertexDefective.1 + have hout : choice.otherEndpoint ∉ TreeSequenceVertexSet T := + choice.otherOutside + apply hout + exact hcross.2 ▸ hin + have hmissing' : MissingColors G post choice.vertex = + MissingColors G postStar choiceStar.vertex := by + exact hmissing + have hcolor : choiceStar.color = choice.color := by + have hnot : choiceStar.color ≠ gamma := by + intro heq + apply hgamma + have hd : choiceStar.color ∈ MissingColors G post choice.vertex := + hmissing'.symm ▸ hdeltaStar + exact heq ▸ hd + have hcases : choice.color = choiceStar.color ∨ + choice.color = gammaStar := by + have hm : choice.color ∈ ({choiceStar.color, gammaStar} : Finset (Fin k)) := by + exact hpairs ▸ Finset.mem_insert.mpr (Or.inl rfl) + simpa only [Finset.mem_insert, Finset.mem_singleton] using hm + rcases hcases with hcase | hcase + · exact hcase.symm + · exfalso + apply hgammaStar + have hd : choice.color ∈ MissingColors G postStar choiceStar.vertex := + hmissing' ▸ hdelta + exact hcase.symm ▸ hd + have hgamma' : gammaStar = gamma := by + have hpair : ({choice.color, gamma} : Finset (Fin k)) = + {choiceStar.color, gammaStar} := hpairs + rw [hcolor] at hpair + have hmem : gammaStar ∈ ({choice.color, gamma} : Finset (Fin k)) := by + have hm : gammaStar ∈ ({choice.color, gammaStar} : Finset (Fin k)) := + Finset.mem_insert.mpr (Or.inr (Finset.mem_singleton_self _)) + exact hpair.symm ▸ hm + have hcases : gammaStar = choice.color ∨ gammaStar = gamma := by + simpa only [Finset.mem_insert, Finset.mem_singleton] using hmem + rcases hcases with h | h + · exfalso + apply hgammaStar + have hd : choice.color ∈ MissingColors G postStar choiceStar.vertex := + hmissing' ▸ hdelta + exact h.symm ▸ hd + · exact h + exact ⟨hedge, hvertex, hother, hcolor, hgamma'⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TdReplacementPrefixExact.lean b/LeanPool/GoldbergSeymour/TdReplacementPrefixExact.lean new file mode 100644 index 0000000000..891f6f8540 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TdReplacementPrefixExact.lean @@ -0,0 +1,1704 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Basic2 +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.CorrespondingTerminalClosureEq +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveEdge +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtensionBase +public import LeanPool.GoldbergSeymour.ExtensionRules +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovClosureExists +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.StableColoringEquivalence + +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Td Replacement Prefix Exact + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperBranch755Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) + (Decidable.byContradiction fun (a : ¬(0 : ℕ) < (1 : ℕ)) ↦ by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + q.castSucc = + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by + omega⟩ : + Fin (ett.rounds + (1 : ℕ))) → + ∀ (sigmaPrev : PartialEdgeColoring E k), + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev → + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → + (∀ {seed : TreeSequence G e0}, + TashkinovClosure (ett.series.data.coloring q.castSucc) seed + (ett.series.data.tree q.succ.castSucc) → + TashkinovClosure sigmaPrev seed (ett.series.data.tree q.succ.castSucc)) → + (1 : ℕ) < ett.rounds → + ∀ (hroundSub : ett.rounds - (1 : ℕ) + (1 : ℕ) = ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (⟨ett.rounds - (1 : ℕ) + (1 : ℕ), by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hfinalTree : + ett.series.data.tree + (⟨ett.rounds - (1 : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) + (1 : ℕ) < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (2 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let originalPrefix' : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ)))) := + { + rounds := originalPrefix.rounds, roundsPositive := originalPrefix.roundsPositive, + series := originalPrefix.series, + abovePenultimate := + Eq.mp + (congrArg + (TreeSequenceInitialSegment + (originalPrefix.series.data.tree + (⟨originalPrefix.rounds, by omega⟩ : Fin (originalPrefix.rounds + (2 : ℕ))))) + hfinalTree) + originalPrefix.abovePenultimate, + strictAbovePenultimate := + Eq.mp + (congrArg + (LT.lt + (originalPrefix.series.data.tree + (⟨originalPrefix.rounds, by omega⟩ : + Fin (originalPrefix.rounds + (2 : ℕ)))).length) + (congrArg TreeSequence.length hfinalTree)) + originalPrefix.strictAbovePenultimate, + belowFinal := + Eq.mp + (congrFun' (congrArg TreeSequenceInitialSegment hfinalTree) + (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))))) + originalPrefix.belowFinal, + generatingColoring := originalPrefix.generatingColoring : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ)))) }; + ∀ (hr' : originalPrefix'.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix' → + (∀ (i : Fin (originalPrefix'.rounds + (2 : ℕ))), + originalPrefix'.series.data.tree i = + ett.series.data.tree + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (2 : ℕ) ≤ ett.rounds + (2 : ℕ)) ↦ by omega) + i)) → + (∀ (i : Fin (originalPrefix'.rounds + (1 : ℕ))), + originalPrefix'.series.data.coloring i = + ett.series.data.coloring + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by + omega) + i) ∧ + originalPrefix'.series.data.stored i = + ett.series.data.stored + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by + omega) + i) ∧ + originalPrefix'.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by + omega) + i) ∧ + originalPrefix'.series.data.kind i = + ett.series.data.kind + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by + omega) + i) ∧ + originalPrefix'.series.data.chosenVertex i = + ett.series.data.chosenVertex + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by + omega) + i) ∧ + originalPrefix'.series.data.outsideVertex i = + ett.series.data.outsideVertex + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by + omega) + i) ∧ + originalPrefix'.series.data.delta i = + ett.series.data.delta + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + originalPrefix'.series.data.gamma i = + ett.series.data.gamma + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + TashkinovStoredColors originalPrefix'.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + originalPrefix'.series.certified i ≍ + ett.series.certified + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega) + i)) → + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix' sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree (Fin.last (originalPrefix'.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementSeries.data.coloring (Fin.last originalPrefix'.rounds) = + sigmaPrev ∧ + MaximumProperty corr.replacementETT + +private theorem helper_hpredecessor_156.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) + (Decidable.byContradiction fun (a : ¬(0 : ℕ) < (1 : ℕ)) ↦ by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) + sigma → + ∃ (sigmaPrev : PartialEdgeColoring E k), + IsProperEdgeColoring G sigmaPrev ∧ + IsOneEdgeUncolored sigmaPrev e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev ∧ + (ett.series.data.kind q.succ = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE → + sigmaPrev = sigma) ∧ + (ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∃ (v : V) (gamma : Fin k) (delta : Fin k), + ett.series.data.chosenVertex q.succ = some v ∧ + ett.series.data.gamma q.succ = some gamma ∧ + ett.series.data.delta q.succ = some delta ∧ + sigmaPrev = TwoColorComponentSwap G sigma gamma delta (Sum.inl v)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower sigma hsigmaProper hsigmaOne q + hqSucc hsigmaStableQ + have hstep := ett.series.certified q.succ + generalize htarget : q.succ = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q htarget).elim + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + have hstablePrev : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma := by + constructor + · intro f hf hcolor + rcases hcolor with ⟨c, hc, hfc⟩ + have hc' := + (HkuMissingStoredMonotone G k ett.rounds e0 input + ett.series q).1 hc + have hcopy := hsigmaStableQ.1 f hf + ⟨c, by simpa [currentColoring] using hc', by + simpa [currentColoring] using hfc⟩ + simpa [currentColoring] using hcopy + · intro v hv + simpa [currentColoring] using hsigmaStableQ.2 v hv + refine ⟨sigma, hsigmaProper, hsigmaOne, hstablePrev, ?_, ?_⟩ + · intro hkind + rfl + · intro hkind + rw [currentKind] at hkind + cases hkind + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + have hselectedSigma : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + choice.selected sigma := by + constructor + · intro f hf hcolor + rcases hcolor with ⟨c, hc, hfc⟩ + have hc' : c ∈ + TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.succ := by + rcases Finset.mem_union.mp hc with hc | hc + · exact Finset.mem_union_left _ (by + simpa [currentColoring] using hc) + · have hc'' := + (HkuMissingStoredMonotone G k ett.rounds e0 input + ett.series q).1 + (Finset.mem_union_right _ hc) + simpa [currentColoring] using hc'' + have hcopy := hsigmaStableQ.1 f hf + ⟨c, hc', by simpa [currentColoring] using hfc⟩ + simpa [currentColoring] using hcopy + · intro v hv + simpa [currentColoring] using hsigmaStableQ.2 v hv + have hstablePrev : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma := by + exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc)).trans + (x := ⟨ett.series.data.coloring q.castSucc, + ⟨previousProper, previousOneUncolored⟩⟩) + (y := ⟨choice.selected, + ⟨choice.selectedProper, choice.selectedOneUncolored⟩⟩) + (z := ⟨sigma, ⟨hsigmaProper, hsigmaOne⟩⟩) + choice.selectedStable hselectedSigma + refine ⟨sigma, hsigmaProper, hsigmaOne, hstablePrev, ?_, ?_⟩ + · intro hkind + rfl + · intro hkind + rw [currentKind] at hkind + cases hkind + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + have hcomponent := ExtensionBase G k e0 input T generating ett hMP + hpositive hlower choice.vertex gamma choice.color + (by simpa [hqSucc] using currentKind) + (by simpa [hqSucc] using currentVertex) + (by simpa [hqSucc] using currentGamma) + (by simpa [hqSucc] using currentDelta) sigma hsigmaProper + hsigmaOne (by simpa [hqSucc] using hsigmaStableQ) + obtain ⟨selected, secondStable', hselectedProper, hselectedOne, + hselectedStable, hsecondProper, hsecondOne, hsecondStable, + hcurrent, hundoneSecond, hundoneSelected, hundonePrev⟩ := + ParallelExtensionUndoStable G k ett.rounds e0 input ett.series q + choice.vertex gamma choice.color currentKind currentVertex + currentGamma currentDelta sigma hsigmaProper hsigmaOne + hsigmaStableQ choice.vertexDefective.1 + (by simpa [hqSucc] using hcomponent) + let sigmaPrev := + TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex) + have hne : gamma ≠ choice.color := by + intro heq + have hpresent : gamma ∈ PresentColors G choice.selected choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨choice.edge, choice.edgeIncident, by simpa [heq] using + choice.edgeColor⟩ + have hnot : gamma ∉ PresentColors G choice.selected choice.vertex := by + simpa [MissingColors] using gammaRule.1 + exact hnot hpresent + refine ⟨sigmaPrev, ?_, ?_, ?_, ?_, ?_⟩ + · exact TwoColorComponentSwapProper G sigma gamma choice.color hne + hsigmaProper (Sum.inl choice.vertex) + · unfold IsOneEdgeUncolored + constructor + · by_cases he : Sum.inr e0 ∈ + TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) + · simp [sigmaPrev, TwoColorComponentSwap, he, hsigmaOne.1] + · simp [sigmaPrev, TwoColorComponentSwap, he, hsigmaOne.1] + · intro e he0 + obtain ⟨c, hc⟩ := hsigmaOne.2 e he0 + by_cases he : Sum.inr e ∈ + TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) + · by_cases hcg : c = gamma + · exact ⟨choice.color, by + simp [sigmaPrev, TwoColorComponentSwap, he, hc, hcg]⟩ + · by_cases hcd : c = choice.color + · exact ⟨gamma, by + simp [sigmaPrev, TwoColorComponentSwap, he, hc, hcd, + hne.symm]⟩ + · exact ⟨c, by + simp [sigmaPrev, TwoColorComponentSwap, he, hc, hcg, hcd]⟩ + · exact ⟨c, by + simp [sigmaPrev, TwoColorComponentSwap, he, hc]⟩ + · exact hundonePrev + · intro hkind + rcases hkind with hkind | hkind <;> rw [currentKind] at hkind <;> + cases hkind + · intro hkind + exact ⟨choice.vertex, gamma, choice.color, currentVertex, + currentGamma, currentDelta, rfl⟩ + +private theorem helper_hreferenceGood_368.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) + (Decidable.byContradiction fun (a : ¬(0 : ℕ) < (1 : ℕ)) ↦ by omega)⟩ : + Fin ett.rounds); + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) ∧ + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q + have hstep := ett.series.certified q.succ + generalize htarget : q.succ = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero q htarget).elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + exact ⟨previousProper, previousOneUncolored⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + exact ⟨previousProper, previousOneUncolored⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv + omega + subst i + exact ⟨previousProper, previousOneUncolored⟩ + +private theorem helper_copyClosure_416.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) + (Decidable.byContradiction fun (a : ¬(0 : ℕ) < (1 : ℕ)) ↦ by omega)⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k), + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev → + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → + (∀ {A B : TreeSequence G e0} {phi : PartialEdgeColoring E k}, + TashkinovAugmentationSequence phi A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → + (∀ {A : TreeSequence G e0} (j : Fin A.length), TreeIncidentEdge A (A.edge j)) → + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) ∧ + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → + ∀ {seed : TreeSequence G e0}, + TashkinovClosure (ett.series.data.coloring q.castSucc) seed + (ett.series.data.tree q.succ.castSucc) → + TashkinovClosure sigmaPrev seed (ett.series.data.tree q.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevStable vertexSegment vertexReach displayedEdgeIncident + hreferenceGood seed hclosure + have hseq : TashkinovAugmentationSequence sigmaPrev seed + (ett.series.data.tree q.succ.castSucc) := by + have transport : ∀ {A : TreeSequence G e0}, + Relation.ReflTransGen + (TashkinovAugmentation + (ett.series.data.coloring q.castSucc)) A + (ett.series.data.tree q.succ.castSucc) → + Relation.ReflTransGen (TashkinovAugmentation sigmaPrev) A + (ett.series.data.tree q.succ.castSucc) := by + intro A holdSeq + induction holdSeq using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hstep htail ih => + refine Relation.ReflTransGen.head ?_ ih + rcases hstep with ⟨hlen, hsegment, c, hcolor, hmissing⟩ + refine ⟨hlen, hsegment, c, ?_, ?_⟩ + · let last : Fin B.length := + Fin.cast hlen.symm (Fin.last A.length) + have hincB := displayedEdgeIncident last + have hincFinal : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) (B.edge last) := by + rcases hincB with ⟨v, hv, hve⟩ + exact ⟨v, vertexReach htail hv, hve⟩ + have hcFinal : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] at hmissing ⊢ + rcases hmissing with ⟨v, hv, hvc⟩ + exact ⟨v, vertexReach htail (vertexSegment hsegment hv), hvc⟩ + have hcopy := hsigmaPrevStable.1 (B.edge last) hincFinal + ⟨c, Finset.mem_union_left _ hcFinal, hcolor⟩ + exact hcopy.trans hcolor + · simp only [TreeMissingColors, Finset.mem_biUnion] at hmissing ⊢ + rcases hmissing with ⟨v, hv, hvc⟩ + refine ⟨v, hv, ?_⟩ + rw [hsigmaPrevStable.2 v + (vertexReach htail (vertexSegment hsegment hv))] + exact hvc + exact transport hclosure.1 + refine ⟨hseq, ?_⟩ + intro f c v hf hv hfc hmissing + have hinc : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] at hf + rcases hf with ⟨u, hu, w, hw, he⟩ + refine ⟨u, hu, ?_⟩ + change u ∈ G.ends f + rw [he] + exact Sym2.mem_mk_left _ _ + have hmissingOld : c ∈ MissingColors G + (ett.series.data.coloring q.castSucc) v := by + rw [← hsigmaPrevStable.2 v hv] + exact hmissing + have htreeMissingOld : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, hmissingOld⟩ + have hedgeCriterion := + (sc1 G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev + hreferenceGood.1 hreferenceGood.2 hsigmaPrevProper + hsigmaPrevOne).mp hsigmaPrevStable + have hedgeEq := hedgeCriterion f hinc (Or.inr + ⟨c, Finset.mem_union_left _ htreeMissingOld, hfc⟩) + have hfcOld : ett.series.data.coloring q.castSucc f = some c := + hedgeEq.symm.trans hfc + exact (hclosure.2 hf hv hfcOld) hmissingOld + +private theorem helper_branch_508.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) + (Decidable.byContradiction fun (a : ¬(0 : ℕ) < (1 : ℕ)) ↦ by omega)⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k), + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + (∀ {seed : TreeSequence G e0}, + TashkinovClosure (ett.series.data.coloring q.castSucc) seed + (ett.series.data.tree q.succ.castSucc) → + TashkinovClosure sigmaPrev seed (ett.series.data.tree q.succ.castSucc)) → + ett.rounds = (1 : ℕ) → + (ett.rounds = (1 : ℕ) ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : + TashkinovSeries G k (0 : ℕ) e0 prefixInput), + zeroPrefix.data.tree (1 : Fin (2 : ℕ)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + zeroPrefix.data.coloring (0 : Fin (1 : ℕ)) = sigmaPrev) ∨ + (1 : ℕ) < ett.rounds ∧ + ∃ (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix ∧ + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (2 : ℕ) ≤ ett.rounds + (2 : ℕ)) ↦ + by omega) + i)) ∧ + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring + (Fin.castLE + (Decidable.byContradiction + fun + (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored + (Fin.castLE + (Decidable.byContradiction + fun + (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE + (Decidable.byContradiction + fun + (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ + ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind + (Fin.castLE + (Decidable.byContradiction + fun + (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ + ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE + (Decidable.byContradiction + fun + (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ + ett.rounds + (1 : ℕ)) ↦ + by omega) + i)) ∧ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = + sigmaPrev ∧ + MaximumProperty corr.replacementETT := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q sigmaPrev hsigmaPrevProper + hsigmaPrevOne copyClosure hroundOne + left + refine ⟨hroundOne, ?_⟩ + have hqZero : q.castSucc = (0 : Fin (ett.rounds + 1)) := by + apply Fin.ext + simp [q, hroundOne] + have hqTree : q.succ.castSucc = + (1 : Fin (ett.rounds + 2)) := by + apply Fin.ext + simp [q, hroundOne] + have hinitial := ett.series.certified (0 : Fin (ett.rounds + 1)) + generalize htarget : (0 : Fin (ett.rounds + 1)) = target at hinitial + cases hinitial with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + let zeroData : TashkinovSeriesData G k 0 e0 := + { tree := fun i => + ett.series.data.tree ⟨i.val, by omega⟩ + coloring := fun _ => sigmaPrev + stored := fun _ => ∅ + connectingEdges := fun _ => ∅ + kind := fun _ => none + chosenVertex := fun _ => none + outsideVertex := fun _ => none + delta := fun _ => none + gamma := fun _ => none } + have htriplePrev : KTriple G k e0 sigmaPrev := + ⟨triple.1, triple.2.1, triple.2.2.1, + hsigmaPrevProper, hsigmaPrevOne⟩ + have hclosurePrev : TashkinovClosure sigmaPrev + (zeroData.tree 0) (zeroData.tree 1) := by + have hcopy := copyClosure (seed := ett.series.data.tree 0) + (by simpa [hqZero, hqTree] using initialClosure) + simpa [zeroData, hqTree] using hcopy + let zeroPrefix : TashkinovSeries G k 0 e0 sigmaPrev := + { data := zeroData + certified := by + intro i + have hi : i = 0 := Fin.eq_zero i + subst i + exact TashkinovSeriesStep.initial htriplePrev + (by simpa [zeroData] using seedLength) rfl rfl rfl rfl + rfl rfl rfl rfl hclosurePrev } + refine ⟨sigmaPrev, zeroPrefix, ?_, ?_⟩ + · change ett.series.data.tree 1 = + ett.series.data.tree (Fin.last ett.rounds).castSucc + congr 1 + apply Fin.ext + simp [hroundOne] + · rfl + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact (Fin.succ_ne_zero i htarget.symm).elim + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + exact (Fin.succ_ne_zero i htarget.symm).elim + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact (Fin.succ_ne_zero i htarget.symm).elim + +private theorem helper_hstableRestricted_798.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) + (Decidable.byContradiction fun (a : ¬(0 : ℕ) < (1 : ℕ)) ↦ by omega)⟩ : + Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k), + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev → + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → + ∀ (hroundSub : ett.rounds - (1 : ℕ) + (1 : ℕ) = ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (⟨ett.rounds - (1 : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) + (1 : ℕ) < ett.rounds + (2 : ℕ)) ↦ by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ))))) + (hfinalTree : + ett.series.data.tree + (⟨ett.rounds - (1 : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) + (1 : ℕ) < ett.rounds + (2 : ℕ)) ↦ by + omega⟩ : + Fin (ett.rounds + (2 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let originalPrefix' : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ)))) := + { rounds := originalPrefix.rounds, roundsPositive := originalPrefix.roundsPositive, + series := originalPrefix.series, + abovePenultimate := + Eq.mp + (congrArg + (TreeSequenceInitialSegment + (originalPrefix.series.data.tree + (⟨originalPrefix.rounds, + Decidable.byContradiction + fun (a : ¬originalPrefix.rounds < originalPrefix.rounds + (2 : ℕ)) ↦ + by omega⟩ : + Fin (originalPrefix.rounds + (2 : ℕ))))) + hfinalTree) + originalPrefix.abovePenultimate, + strictAbovePenultimate := + Eq.mp + (congrArg + (LT.lt + (originalPrefix.series.data.tree + (⟨originalPrefix.rounds, + Decidable.byContradiction + fun + (a : ¬originalPrefix.rounds < originalPrefix.rounds + (2 : ℕ)) ↦ + by omega⟩ : + Fin (originalPrefix.rounds + (2 : ℕ)))).length) + (congrArg TreeSequence.length hfinalTree)) + originalPrefix.strictAbovePenultimate, + belowFinal := + Eq.mp + (congrFun' (congrArg TreeSequenceInitialSegment hfinalTree) + (originalPrefix.series.data.tree + (Fin.last (originalPrefix.rounds + (1 : ℕ))))) + originalPrefix.belowFinal, + generatingColoring := originalPrefix.generatingColoring : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ)))) }; + let rLast : Fin (originalPrefix'.rounds + (1 : ℕ)) := Fin.last originalPrefix'.rounds; + originalPrefix'.series.data.coloring rLast = ett.series.data.coloring q.castSucc → + TashkinovStoredColors originalPrefix'.series.data rLast = + TashkinovStoredColors ett.series.data q.castSucc → + ett.series.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree q.succ.castSucc → + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + ∀ {f : E}, TreeIncidentEdge A f → TreeIncidentEdge B f) → + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + ∀ {phi : PartialEdgeColoring E k}, + TreeMissingColors phi A ⊆ TreeMissingColors phi B) → + StableColoring (originalPrefix'.series.data.tree rLast.castSucc) + (TashkinovStoredColors originalPrefix'.series.data rLast) + (originalPrefix'.series.data.coloring rLast) sigmaPrev := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q sigmaPrev hsigmaPrevStable + vertexSegment hroundSub originalPrefix hfinalTree originalPrefix' rLast hlastColor + hlastStored hterminalTree incidentSegment missingSegment + constructor + · intro f hf hcolor + have hfFull : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + simpa only [hterminalTree] using + (incidentSegment originalPrefix'.abovePenultimate hf) + rcases hcolor with ⟨c, hc, hfc⟩ + have hcFull : c ∈ + TreeMissingColors (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.castSucc := by + rcases Finset.mem_union.mp hc with hc | hc + · apply Finset.mem_union_left + have hc' : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (originalPrefix'.series.data.tree rLast.castSucc) := by + simpa [hlastColor] using hc + simpa only [hterminalTree] using + (missingSegment originalPrefix'.abovePenultimate hc') + · apply Finset.mem_union_right + simpa [hlastStored] using hc + have hcopy := hsigmaPrevStable.1 f hfFull + ⟨c, hcFull, by simpa [hlastColor] using hfc⟩ + simpa [hlastColor] using hcopy + · intro v hv + have hvFull : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + simpa only [hterminalTree] using + (vertexSegment originalPrefix'.abovePenultimate hv) + have hcopy := hsigmaPrevStable.2 v hvFull + simpa [hlastColor] using hcopy + +private theorem helper_hseedPackage_853.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hpositive : (0 : ℕ) < ett.rounds), + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) + (Decidable.byContradiction fun (a : ¬(0 : ℕ) < (1 : ℕ)) ↦ by omega)⟩ : + Fin ett.rounds); + q.castSucc = + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ))) → + ∀ (sigmaPrev : PartialEdgeColoring E k), + (∀ {seed : TreeSequence G e0}, + TashkinovClosure (ett.series.data.coloring q.castSucc) seed + (ett.series.data.tree q.succ.castSucc) → + TashkinovClosure sigmaPrev seed (ett.series.data.tree q.succ.castSucc)) → + (1 : ℕ) < ett.rounds → + ∀ (hroundSub : ett.rounds - (1 : ℕ) + (1 : ℕ) = ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (⟨ett.rounds - (1 : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) + (1 : ℕ) < ett.rounds + (2 : ℕ)) ↦ by + omega⟩ : + Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hfinalTree : + ett.series.data.tree + (⟨ett.rounds - (1 : ℕ) + (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) + (1 : ℕ) < ett.rounds + (2 : ℕ)) ↦ by + omega⟩ : + Fin (ett.rounds + (2 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let originalPrefix' : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ)))) := + { rounds := originalPrefix.rounds, roundsPositive := originalPrefix.roundsPositive, + series := originalPrefix.series, + abovePenultimate := + Eq.mp + (congrArg + (TreeSequenceInitialSegment + (originalPrefix.series.data.tree + (⟨originalPrefix.rounds, + Decidable.byContradiction + fun (a : ¬originalPrefix.rounds < originalPrefix.rounds + (2 : ℕ)) ↦ + by omega⟩ : + Fin (originalPrefix.rounds + (2 : ℕ))))) + hfinalTree) + originalPrefix.abovePenultimate, + strictAbovePenultimate := + Eq.mp + (congrArg + (LT.lt + (originalPrefix.series.data.tree + (⟨originalPrefix.rounds, + Decidable.byContradiction + fun + (a : ¬originalPrefix.rounds < originalPrefix.rounds + (2 : ℕ)) ↦ + by omega⟩ : + Fin (originalPrefix.rounds + (2 : ℕ)))).length) + (congrArg TreeSequence.length hfinalTree)) + originalPrefix.strictAbovePenultimate, + belowFinal := + Eq.mp + (congrFun' (congrArg TreeSequenceInitialSegment hfinalTree) + (originalPrefix.series.data.tree + (Fin.last (originalPrefix.rounds + (1 : ℕ))))) + originalPrefix.belowFinal, + generatingColoring := originalPrefix.generatingColoring : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ)))) }; + ∀ (hr' : originalPrefix'.rounds = ett.rounds - (1 : ℕ)), + let rLast : Fin (originalPrefix'.rounds + (1 : ℕ)) := Fin.last originalPrefix'.rounds; + Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix'.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + rLast = + q.castSucc → + originalPrefix'.series.data.tree rLast.castSucc = + ett.series.data.tree q.castSucc.castSucc → + originalPrefix'.series.data.connectingEdges rLast = + ett.series.data.connectingEdges q.castSucc → + originalPrefix'.series.data.kind rLast = ett.series.data.kind q.castSucc → + ∃ (seed : TreeSequence G e0), + (originalPrefix'.series.data.kind rLast = some TashkinovExtensionKind.PE ∧ + seed = originalPrefix'.series.data.tree rLast.castSucc ∨ + (originalPrefix'.series.data.kind rLast = some TashkinovExtensionKind.SE ∨ + originalPrefix'.series.data.kind rLast = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E), + originalPrefix'.series.data.connectingEdges rLast = { f } ∧ + TreeSequenceAdjoinEdge (originalPrefix'.series.data.tree rLast.castSucc) f + seed) ∧ + TashkinovClosure sigmaPrev seed (ett.series.data.tree q.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q hqCast sigmaPrev copyClosure + hroundLarge hroundSub originalPrefix hr hfinalTree originalPrefix' hr' rLast hlastMap + hlastTree hlastEdges hlastKind + have hstep := ett.series.certified q.castSucc + generalize htarget : q.castSucc = target at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val htarget + simp [q] at hv + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hnext : i.succ.succ = q.succ.castSucc := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv ⊢ + omega + have hclosureOld : TashkinovClosure + (ett.series.data.coloring q.castSucc) adjoined + (ett.series.data.tree q.succ.castSucc) := by + simpa only [htarget, hnext] using closedExtension + refine ⟨adjoined, ?_, copyClosure hclosureOld⟩ + right + constructor + · left + exact hlastKind.trans (by simpa only [htarget] using currentKind) + · refine ⟨choice.edge, ?_, ?_⟩ + · exact hlastEdges.trans + (by simpa only [htarget] using currentEdges) + · simpa only [hlastTree, htarget] using adjoinedExactly + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice + seriesAlternativeFails gamma gammaRule secondStable + secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring currentProper currentOneUncolored + currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hnext : i.succ.succ = q.succ.castSucc := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv ⊢ + omega + have hclosureOld : TashkinovClosure + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.castSucc.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + simpa only [htarget, hnext] using closedExtension + refine ⟨ett.series.data.tree q.castSucc.castSucc, ?_, + copyClosure hclosureOld⟩ + left + refine ⟨hlastKind.trans + (by simpa only [htarget] using currentKind), ?_⟩ + exact hlastTree.symm + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have hnext : i.succ.succ = q.succ.castSucc := by + apply Fin.ext + have hv := congrArg Fin.val htarget + simp at hv ⊢ + omega + have hclosureOld : TashkinovClosure + (ett.series.data.coloring q.castSucc) adjoined + (ett.series.data.tree q.succ.castSucc) := by + simpa only [htarget, hnext] using closedExtension + refine ⟨adjoined, ?_, copyClosure hclosureOld⟩ + right + constructor + · right + exact hlastKind.trans (by simpa only [htarget] using currentKind) + · refine ⟨available.edge, ?_, ?_⟩ + · exact hlastEdges.trans + (by simpa only [htarget] using currentEdges) + · simpa only [hlastTree, htarget] using adjoinedExactly + +private theorem helper_branch_755.{u_1, u_2} : + helperBranch755Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive hlower q hqSucc hqCast sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStable vertexSegment copyClosure hroundLarge + hroundSub originalPrefix hr hfinalTree originalPrefix' hr' hprefixMP' hprefixTrees' + hprefixData' + let rLast : Fin (originalPrefix'.rounds + 1) := + Fin.last originalPrefix'.rounds + have hlastMap : Fin.castLE (by omega) rLast = q.castSucc := by + apply Fin.ext + simp [rLast, q, hr'] + have hlastColor : originalPrefix'.series.data.coloring rLast = + ett.series.data.coloring q.castSucc := by + simpa [hlastMap] using (hprefixData' rLast).1 + have hlastStored : + TashkinovStoredColors originalPrefix'.series.data rLast = + TashkinovStoredColors ett.series.data q.castSucc := by + simpa [hlastMap] using (hprefixData' rLast).2.2.2.2.2.2.2.2.1 + have hterminalTree : + ett.series.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree q.succ.castSucc := by + rw [hqSucc] + have incidentSegment {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) {f : E} + (hf : TreeIncidentEdge A f) : TreeIncidentEdge B f := by + rcases hf with ⟨v, hv, hve⟩ + exact ⟨v, vertexSegment hAB hv, hve⟩ + have missingSegment {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) + {phi : PartialEdgeColoring E k} : + TreeMissingColors phi A ⊆ TreeMissingColors phi B := by + intro c hc + simp only [TreeMissingColors, Finset.mem_biUnion] at hc ⊢ + rcases hc with ⟨v, hv, hvc⟩ + exact ⟨v, vertexSegment hAB hv, hvc⟩ + have hstableRestricted : StableColoring + (originalPrefix'.series.data.tree rLast.castSucc) + (TashkinovStoredColors originalPrefix'.series.data rLast) + (originalPrefix'.series.data.coloring rLast) sigmaPrev := by + exact @helper_hstableRestricted_798 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hpositive sigmaPrev hsigmaPrevStable vertexSegment hroundSub + originalPrefix hfinalTree hlastColor hlastStored hterminalTree incidentSegment + missingSegment + have hlowerPrefix := hlower originalPrefix' + (by rw [hr']; omega) (by rw [hr']; omega) hprefixMP' + have hmod : ModColoring originalPrefix' sigmaPrev := by + exact hlowerPrefix.2.2.2.2.2 sigmaPrev hsigmaPrevProper + hsigmaPrevOne hstableRestricted + have hlastTreeMap : Fin.castLE (by omega) rLast.castSucc = + q.castSucc.castSucc := by + apply Fin.ext + simp [rLast, q, hr'] + have hlastTree : + originalPrefix'.series.data.tree rLast.castSucc = + ett.series.data.tree q.castSucc.castSucc := by + simpa [hlastTreeMap] using hprefixTrees' rLast.castSucc + have hlastEdges : + originalPrefix'.series.data.connectingEdges rLast = + ett.series.data.connectingEdges q.castSucc := by + simpa [hlastMap] using (hprefixData' rLast).2.2.1 + have hlastKind : originalPrefix'.series.data.kind rLast = + ett.series.data.kind q.castSucc := by + simpa [hlastMap] using (hprefixData' rLast).2.2.2.1 + have hseedPackage : ∃ seed : TreeSequence G e0, + (((originalPrefix'.series.data.kind rLast = + some TashkinovExtensionKind.PE ∧ + seed = originalPrefix'.series.data.tree rLast.castSucc) ∨ + ((originalPrefix'.series.data.kind rLast = + some TashkinovExtensionKind.SE ∨ + originalPrefix'.series.data.kind rLast = + some TashkinovExtensionKind.RE) ∧ + ∃ f : E, + originalPrefix'.series.data.connectingEdges rLast = {f} ∧ + TreeSequenceAdjoinEdge + (originalPrefix'.series.data.tree rLast.castSucc) + f seed)) ∧ + TashkinovClosure sigmaPrev seed + (ett.series.data.tree q.succ.castSucc)) := by + exact @helper_hseedPackage_853 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive hqCast sigmaPrev copyClosure hroundLarge hroundSub + originalPrefix hr hfinalTree hr' hlastMap hlastTree hlastEdges hlastKind + rcases hseedPackage with ⟨seed, hseedRoute, hclosureQ⟩ + have hclosureFinal : TashkinovClosure sigmaPrev seed + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + simpa only [hterminalTree] using hclosureQ + have heligible : + ((originalPrefix'.series.data.kind rLast = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigmaPrev + (originalPrefix'.series.data.tree rLast.castSucc) + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) ∨ + ((originalPrefix'.series.data.kind rLast = + some TashkinovExtensionKind.SE ∨ + originalPrefix'.series.data.kind rLast = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed' : TreeSequence G e0), + originalPrefix'.series.data.connectingEdges rLast = {f} ∧ + TreeSequenceAdjoinEdge + (originalPrefix'.series.data.tree rLast.castSucc) f seed' ∧ + TashkinovAugmentationSequence sigmaPrev seed' + (ett.series.data.tree + (Fin.last ett.rounds).castSucc))) := by + rcases hseedRoute with hPE | hSER + · left + refine ⟨hPE.1, ?_⟩ + rw [← hPE.2] + exact hclosureFinal.1 + · right + rcases hSER with ⟨hkind, f, hedges, hadjoin⟩ + exact ⟨hkind, f, seed, hedges, hadjoin, hclosureFinal.1⟩ + have hcorrNonempty := hmod.2.2 + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + originalPrefix'.abovePenultimate + originalPrefix'.strictAbovePenultimate heligible + rcases hcorrNonempty with ⟨corr⟩ + have hfinalEq := CorrespondingTerminalClosureEq G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) + originalPrefix' sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc) seed corr + (by simpa [rLast] using hseedRoute) hclosureFinal + refine ⟨corr, ?_, corr.finalGeneratingColoring.symm, ?_⟩ + · simpa [rLast] using hfinalEq + · exact MaximumPropertyTransport G k e0 originalPrefix' + sigmaPrev hmod + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + corr hprefixMP' + +private theorem helper_branch_578.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) + (Decidable.byContradiction fun (a : ¬(0 : ℕ) < (1 : ℕ)) ↦ by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + q.castSucc = + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ))) → + ∀ (sigmaPrev : PartialEdgeColoring E k), + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev → + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → + (∀ {seed : TreeSequence G e0}, + TashkinovClosure (ett.series.data.coloring q.castSucc) seed + (ett.series.data.tree q.succ.castSucc) → + TashkinovClosure sigmaPrev seed (ett.series.data.tree q.succ.castSucc)) → + ¬ett.rounds = (1 : ℕ) → + (ett.rounds = (1 : ℕ) ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : + TashkinovSeries G k (0 : ℕ) e0 prefixInput), + zeroPrefix.data.tree (1 : Fin (2 : ℕ)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + zeroPrefix.data.coloring (0 : Fin (1 : ℕ)) = sigmaPrev) ∨ + (1 : ℕ) < ett.rounds ∧ + ∃ (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix ∧ + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree + (Fin.castLE + (Decidable.byContradiction + fun (a : ¬originalPrefix.rounds + (2 : ℕ) ≤ ett.rounds + (2 : ℕ)) ↦ + by omega) + i)) ∧ + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring + (Fin.castLE + (Decidable.byContradiction + fun + (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored + (Fin.castLE + (Decidable.byContradiction + fun + (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE + (Decidable.byContradiction + fun + (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ + ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind + (Fin.castLE + (Decidable.byContradiction + fun + (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ + ett.rounds + (1 : ℕ)) ↦ + by omega) + i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE + (Decidable.byContradiction + fun + (a : + ¬originalPrefix.rounds + (1 : ℕ) ≤ + ett.rounds + (1 : ℕ)) ↦ + by omega) + i)) ∧ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = + sigmaPrev ∧ + MaximumProperty corr.replacementETT := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower q hqSucc hqCast sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStable vertexSegment copyClosure hroundOne + right + have hroundLarge : 1 < ett.rounds := by omega + refine ⟨hroundLarge, ?_⟩ + have hroundSub : ett.rounds - 1 + 1 = ett.rounds := by omega + obtain ⟨originalPrefix, hr, hprefixMP, hprefixTrees, + hprefixData⟩ := (by + simpa only [hroundSub] using + (CertifiedETTRestriction G k e0 input T generating ett hMP + (ett.rounds - 1) (by omega) (by omega))) + have hfinalTree : ett.series.data.tree + ⟨ett.rounds - 1 + 1, by omega⟩ = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + congr 1 + apply Fin.ext + simp + omega + let originalPrefix' : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) := + { rounds := originalPrefix.rounds + roundsPositive := originalPrefix.roundsPositive + series := originalPrefix.series + abovePenultimate := by + simpa only [hfinalTree] using originalPrefix.abovePenultimate + strictAbovePenultimate := by + simpa only [hfinalTree] using originalPrefix.strictAbovePenultimate + belowFinal := by + simpa only [hfinalTree] using originalPrefix.belowFinal + generatingColoring := originalPrefix.generatingColoring } + have hr' : originalPrefix'.rounds = ett.rounds - 1 := hr + have hprefixMP' : MaximumProperty originalPrefix' := hprefixMP + have hprefixTrees' : ∀ i : Fin (originalPrefix'.rounds + 2), + originalPrefix'.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i) := hprefixTrees + have hprefixData' : ∀ i : Fin (originalPrefix'.rounds + 1), + originalPrefix'.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix'.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix'.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix'.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + originalPrefix'.series.data.chosenVertex i = + ett.series.data.chosenVertex (Fin.castLE (by omega) i) ∧ + originalPrefix'.series.data.outsideVertex i = + ett.series.data.outsideVertex (Fin.castLE (by omega) i) ∧ + originalPrefix'.series.data.delta i = + ett.series.data.delta (Fin.castLE (by omega) i) ∧ + originalPrefix'.series.data.gamma i = + ett.series.data.gamma (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix'.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i) ∧ + HEq (originalPrefix'.series.certified i) + (ett.series.certified (Fin.castLE (by omega) i)) := hprefixData + refine ⟨originalPrefix', hr', hprefixMP', hprefixTrees', ?_, ?_⟩ + · intro i + rcases hprefixData' i with + ⟨hc, hs, he, hk, hv, ho, hd, hg, hD, hcert⟩ + exact ⟨hc, hs, he, hk, hD⟩ + · exact @helper_branch_755 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T generating ett hpositive hlower hqSucc hqCast sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevStable vertexSegment copyClosure hroundLarge hroundSub + originalPrefix hr hfinalTree hr' hprefixMP' hprefixTrees' hprefixData' +private theorem helper_branch_497.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) + (Decidable.byContradiction fun (a : ¬(0 : ℕ) < (1 : ℕ)) ↦ by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + q.castSucc = + (⟨ett.rounds - (1 : ℕ), + Decidable.byContradiction + fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds + (1 : ℕ)) ↦ by omega⟩ : + Fin (ett.rounds + (1 : ℕ))) → + ∀ (sigmaPrev : PartialEdgeColoring E k), + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev → + (∀ {A B : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + ∀ {v : V}, v ∈ TreeSequenceVertexSet A → v ∈ TreeSequenceVertexSet B) → + (∀ {seed : TreeSequence G e0}, + TashkinovClosure (ett.series.data.coloring q.castSucc) seed + (ett.series.data.tree q.succ.castSucc) → + TashkinovClosure sigmaPrev seed (ett.series.data.tree q.succ.castSucc)) → + (ett.rounds = (1 : ℕ) ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : + TashkinovSeries G k (0 : ℕ) e0 prefixInput), + zeroPrefix.data.tree (1 : Fin (2 : ℕ)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + zeroPrefix.data.coloring (0 : Fin (1 : ℕ)) = sigmaPrev) ∨ + (1 : ℕ) < ett.rounds ∧ + ∃ (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix ∧ + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) ∧ + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i)) ∧ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = + sigmaPrev ∧ + MaximumProperty corr.replacementETT := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower q hqSucc hqCast sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStable vertexSegment copyClosure + by_cases hroundOne : ett.rounds = 1 + · exact @helper_branch_508 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive sigmaPrev hsigmaPrevProper hsigmaPrevOne copyClosure hroundOne + · exact @helper_branch_578 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hMP hpositive hlower hqSucc hqCast sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevStable vertexSegment copyClosure hroundOne +theorem TdReplacementPrefixExact {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + let p : Fin (ett.rounds + 1) := ⟨ett.rounds - 1, by omega⟩ + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn (TashkinovStoredColors ett.series.data n) (ett.series.data.coloring n) + sigma → + ∃ sigmaPrev : PartialEdgeColoring E k, + IsProperEdgeColoring G sigmaPrev ∧ + IsOneEdgeUncolored sigmaPrev e0 ∧ + StableColoring Tn (TashkinovStoredColors ett.series.data p) + (ett.series.data.coloring p) sigmaPrev ∧ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) → + sigmaPrev = sigma) ∧ + (ett.series.data.kind n = some TashkinovExtensionKind.PE → + ∃ (v : V) (gamma delta : Fin k), + ett.series.data.chosenVertex n = some v ∧ + ett.series.data.gamma n = some gamma ∧ + ett.series.data.delta n = some delta ∧ + sigmaPrev = TwoColorComponentSwap G sigma gamma delta (Sum.inl v)) ∧ + ((ett.rounds = 1 ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : + TashkinovSeries G k 0 e0 prefixInput), + zeroPrefix.data.tree (Fin.last 1) = Tn ∧ + zeroPrefix.data.coloring (Fin.last 0) = sigmaPrev) ∨ + (1 < ett.rounds ∧ + ∃ originalPrefix : + ExtendedTashkinovTree G k e0 input Tn (ett.series.data.coloring p), + ∃ hr : originalPrefix.rounds = ett.rounds - 1, + MaximumProperty originalPrefix ∧ + (∀ i : Fin (originalPrefix.rounds + 2), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) ∧ + (∀ i : Fin (originalPrefix.rounds + 1), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges + (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i)) ∧ + ∃ corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix + sigmaPrev Tn, + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1)) = + Tn ∧ + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigmaPrev ∧ + MaximumProperty corr.replacementETT)) := by + classical + dsimp + intro sigma hsigmaProper hsigmaOne hsigmaStable + let q : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ + have hqSucc : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + have hqCast : q.castSucc = + (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) := by + apply Fin.ext + rfl + have hsigmaStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma := by + simpa [hqSucc] using hsigmaStable + have hpredecessor : ∃ sigmaPrev : PartialEdgeColoring E k, + IsProperEdgeColoring G sigmaPrev ∧ + IsOneEdgeUncolored sigmaPrev e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev ∧ + ((ett.series.data.kind q.succ = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE) → + sigmaPrev = sigma) ∧ + (ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∃ (v : V) (gamma delta : Fin k), + ett.series.data.chosenVertex q.succ = some v ∧ + ett.series.data.gamma q.succ = some gamma ∧ + ett.series.data.delta q.succ = some delta ∧ + sigmaPrev = + TwoColorComponentSwap G sigma gamma delta (Sum.inl v)) := by + exact @helper_hpredecessor_156 V E inferInstance inferInstance inferInstance G + k e0 input T generating ett hMP hpositive hlower sigma hsigmaProper hsigmaOne hqSucc + hsigmaStableQ + obtain ⟨sigmaPrev, hsigmaPrevProper, hsigmaPrevOne, hsigmaPrevStable, + hsigmaPrevNonPE, hsigmaPrevPE⟩ := hpredecessor + have vertexSegment {A B : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + simp only [TreeSequenceVertexSet, Finset.mem_image] at hv ⊢ + rcases hv with ⟨i, hi, rfl⟩ + rcases hAB with ⟨hlen, hvertices, hedges⟩ + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, + Finset.mem_univ _, hvertices i⟩ + have vertexReach {A B : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hAB : TashkinovAugmentationSequence phi A B) {v : V} + (hv : v ∈ TreeSequenceVertexSet A) : + v ∈ TreeSequenceVertexSet B := by + unfold TashkinovAugmentationSequence at hAB + induction hAB using Relation.ReflTransGen.head_induction_on with + | refl => exact hv + | @head A B hstep htail ih => + exact ih (vertexSegment hstep.2.1 hv) + have displayedEdgeIncident {A : TreeSequence G e0} + (j : Fin A.length) : TreeIncidentEdge A (A.edge j) := by + rcases A.attaches j with ⟨i, hi⟩ + refine ⟨A.vertex j.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · change A.vertex j.succ ∈ G.ends (A.edge j) + rw [hi] + exact Sym2.mem_mk_left _ _ + have hreferenceGood : + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) ∧ + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 := by + exact @helper_hreferenceGood_368 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hpositive + have copyClosure {seed : TreeSequence G e0} + (hclosure : TashkinovClosure + (ett.series.data.coloring q.castSucc) seed + (ett.series.data.tree q.succ.castSucc)) : + TashkinovClosure sigmaPrev seed + (ett.series.data.tree q.succ.castSucc) := by + exact @helper_copyClosure_416 V E inferInstance inferInstance inferInstance G k + e0 input T generating ett hpositive sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStable vertexSegment vertexReach displayedEdgeIncident hreferenceGood seed + hclosure + refine ⟨sigmaPrev, hsigmaPrevProper, hsigmaPrevOne, ?_, ?_, ?_, ?_⟩ + · simpa [hqSucc, hqCast] using hsigmaPrevStable + · simpa [hqSucc] using hsigmaPrevNonPE + · simpa [hqSucc] using hsigmaPrevPE + · exact @helper_branch_497 V E inferInstance inferInstance inferInstance G k e0 + input T generating ett hMP hpositive hlower hqSucc hqCast sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevStable vertexSegment copyClosure +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TdTerminalRERebuild.lean b/LeanPool/GoldbergSeymour/TdTerminalRERebuild.lean new file mode 100644 index 0000000000..d33540092d --- /dev/null +++ b/LeanPool/GoldbergSeymour/TdTerminalRERebuild.lean @@ -0,0 +1,7908 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ + +module + +public import LeanPool.GoldbergSeymour.RevisitingTerminalStatements + +/-! +# Rebuilding a revisiting terminal extension + +Supporting material for the Goldberg–Seymour revisiting construction. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +-/ + +@[expose] public section + +namespace GoldbergSeymour.TerminalRebuild + +private abbrev revisitingFirstCrossingStatement.{u_1, u_2} : Prop := + open scoped Classical Sym2 in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : 0 < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + ∀ (fstar : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = { fstar } → + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar + seed → + ∀ (closureTree : TreeSequence G e0), + TashkinovClosure sigma seed closureTree → + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - 1, (by omega)⟩ : Fin ett.rounds); + q.succ = Fin.last ett.rounds → + q.castSucc = (⟨ett.rounds - 1, (by omega)⟩ : Fin (ett.rounds + 1)) → + ∀ (adjoined : TreeSequence G e0), + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + ett.series.data.stored q.succ = { available.delta, available.gamma } → + ett.series.data.connectingEdges q.succ = { available.edge } → + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE → + ∀ (hroundLarge : 1 < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - 1, (by omega)⟩ : Fin (ett.rounds + 1)))) + (hr : originalPrefix.rounds = ett.rounds - 1), + ( + ∀ (i : Fin (originalPrefix.rounds + 2)), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ((by omega)) i)) → + ( + ∀ (i : Fin (originalPrefix.rounds + 1)), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE ((by omega)) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE ((by omega)) i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc → + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigma → + MaximumProperty corr.replacementETT → + ∀ + (earlierPrefixBound : + (↑available.earlier : ℕ) < originalPrefix.rounds + 1), + let earlierPrefix : Fin (originalPrefix.rounds + 1) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : + Fin (originalPrefix.rounds + 1)); + Fin.castLE ((by omega)) earlierPrefix = available.earlier → + 0 < (↑earlierPrefix : ℕ) → + corr.replacementSeries.data.kind earlierPrefix = + some TashkinovExtensionKind.PE → + ∀ (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k), + available.earlier = oldi.succ → + ∀ (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma : Fin k), + corr.replacementSeries.data.delta newi.succ = + some newChoice.color → + corr.replacementSeries.data.gamma newi.succ = + some newGamma → + newi.succ = earlierPrefix → + ∀ + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + newi.succ.castSucc) + (TashkinovStoredColors ett.series.data + oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice htree.symm oldChoice; + ∀ + (holdColorCast : + oldChoiceOnNew.color = oldChoice.color), + s(oldChoiceOnNew.vertex, + oldChoiceOnNew.otherEndpoint) = + s(newChoice.vertex, newChoice.otherEndpoint) → + ∀ (holdColorNe : oldGamma ≠ oldChoice.color) + (hnewColorNe : newGamma ≠ newChoice.color) + (hidentifiedDelta : + newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) + (holdDeltaAvailable : + oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma), + newChoice.color = available.delta → + newGamma = available.gamma → + let replacementLast : + Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds; + Fin.castLE ((by omega)) replacementLast = + q.castSucc → + available.delta ∈ + MissingColors G sigma newChoice.vertex → + available.gamma ≠ available.delta → + newChoice.vertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) → + TwoColorNontrivialPathComponent G sigma + available.gamma available.delta + (Sum.inl newChoice.vertex) → + (∃ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma available.gamma + available.delta + (Sum.inl newChoice.vertex)) → + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + (ett.series.data.coloring q.castSucc) + sigma → + let sigmaReturnGraph : + SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma + available.gamma available.delta; + ∀ + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, + edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk + (Sum.inr available.edge) + (Sum.inl available.returnVertex) := + available.returnPath.transfer + sigmaReturnGraph returnEdgeTransfer; + sigmaReturnPath.IsPath → + ( + ∀ (z : V ⊕ E), + z ∈ sigmaReturnPath.support ↔ + z ∈ available.returnPath.support) → + Sum.inl available.returnVertex ∈ + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inr available.edge) → + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inr available.edge) → + available.returnVertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree + earlierPrefix.castSucc) → + available.returnVertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc) → + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inl newChoice.vertex) ≠ + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inr available.edge) → + (∃ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma + available.gamma + available.delta + (Sum.inr available.edge)) → + 0 < corr.replacementETT.rounds → + corr.replacementETT.rounds < + ett.rounds → + ( + ∀ + (C : + CorrespondingExtendedTashkinovTree + G k e0 originalPrefix sigma + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc)), + C.replacementETT.series.data.tree + (Fin.last + (C.replacementETT.rounds + + 1)) = + C.replacementSeries.data.tree + (Fin.last + (originalPrefix.rounds + + 1))) → + corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1)) = + corr.replacementSeries.data.tree + (Fin.last + (originalPrefix.rounds + + 1)) → + corr.replacementETT.series.data.coloring + (Fin.last + corr.replacementETT.rounds) = + sigma → + StableColoring + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) + (TashkinovStoredColors + corr.replacementETT.series.data + (Fin.last + corr.replacementETT.rounds)) + (corr.replacementETT.series.data.coloring + (Fin.last + corr.replacementETT.rounds)) + sigma → + corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1)) = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc → + available.delta ∈ + TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) → + LowerRoundProperties + corr.replacementETT → + TreeInterchangeable G + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) + sigma available.gamma + available.delta → + TreeInterchangeable G + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc) + sigma available.gamma + available.delta → + ∀ + (replacementCycle : + TwoColorCycle G + sigma + available.gamma + available.delta), + ( + ∀ (x : V ⊕ E), + x ∈ + replacementCycle.walk.support ↔ + x ∈ + TwoColorComponent + G sigma + available.gamma + available.delta + (Sum.inr + available.edge)) → + ColoredVertexSetClosed + G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc)) → + ColoredVertexSetClosed + G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc)) → + ( + have + replacementLast : + Fin + (originalPrefix.rounds + + 1) := + Fin.last + originalPrefix.rounds; + corr.replacementSeries.data.tree + replacementLast.succ = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc) → + q.castSucc.succ = + (Fin.last + ett.rounds).castSucc → + ett.series.data.tree + q.castSucc.succ = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc → + let + currentTree : + Finset V := + TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc); + ∀ + (hreturnCycle : + Sum.inl + available.returnVertex ∈ + replacementCycle.walk.support), + Sum.inl + available.outsideEndpoint ∈ + replacementCycle.walk.support → + available.returnVertex ∈ + currentTree → + available.outsideEndpoint ∉ + currentTree → + let + rootedCycle : + (TwoColorIncidenceGraph + G sigma + available.gamma + available.delta).Walk + (Sum.inl + available.returnVertex) + (Sum.inl + available.returnVertex) := + replacementCycle.walk.rotate + (Sum.inl + available.returnVertex) + hreturnCycle; + rootedCycle.IsCycle → + Sum.inl + available.outsideEndpoint ∈ + rootedCycle.support → + let + outsideIndices : + Finset + (Fin + (rootedCycle.length + + 1)) := + {i : + Fin + (rootedCycle.length + + 1) | + ∃ (v : + V), + rootedCycle.getVert + (↑i : + ℕ) = + Sum.inl + v ∧ + v ∉ + currentTree}; + ∀ + (outsideIndicesNonempty : + outsideIndices.Nonempty), + let + firstOutside : + Fin + (rootedCycle.length + + 1) := + outsideIndices.min' + outsideIndicesNonempty; + Nonempty + (CorrespondingExtendedTashkinovTree + G k e0 + ett + sigma + Tstar) + +private abbrev revisitingReturnCrossingStatement.{u_1, u_2} : Prop := + open scoped Classical Sym2 in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : 0 < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + ∀ (fstar : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = { fstar } → + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar + seed → + ∀ (closureTree : TreeSequence G e0), + TashkinovClosure sigma seed closureTree → + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - 1, (by omega)⟩ : Fin ett.rounds); + q.succ = Fin.last ett.rounds → + q.castSucc = (⟨ett.rounds - 1, (by omega)⟩ : Fin (ett.rounds + 1)) → + ∀ (adjoined : TreeSequence G e0), + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + ett.series.data.stored q.succ = { available.delta, available.gamma } → + ett.series.data.connectingEdges q.succ = { available.edge } → + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE → + ∀ (hroundLarge : 1 < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - 1, (by omega)⟩ : Fin (ett.rounds + 1)))) + (hr : originalPrefix.rounds = ett.rounds - 1), + ( + ∀ (i : Fin (originalPrefix.rounds + 2)), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ((by omega)) i)) → + ( + ∀ (i : Fin (originalPrefix.rounds + 1)), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE ((by omega)) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE ((by omega)) i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc → + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigma → + MaximumProperty corr.replacementETT → + ∀ + (earlierPrefixBound : + (↑available.earlier : ℕ) < originalPrefix.rounds + 1), + let earlierPrefix : Fin (originalPrefix.rounds + 1) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : + Fin (originalPrefix.rounds + 1)); + Fin.castLE ((by omega)) earlierPrefix = available.earlier → + 0 < (↑earlierPrefix : ℕ) → + corr.replacementSeries.data.kind earlierPrefix = + some TashkinovExtensionKind.PE → + ∀ (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k), + available.earlier = oldi.succ → + ∀ (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma : Fin k), + corr.replacementSeries.data.delta newi.succ = + some newChoice.color → + corr.replacementSeries.data.gamma newi.succ = + some newGamma → + newi.succ = earlierPrefix → + ∀ + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + newi.succ.castSucc) + (TashkinovStoredColors ett.series.data + oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice htree.symm oldChoice; + ∀ + (holdColorCast : + oldChoiceOnNew.color = oldChoice.color), + s(oldChoiceOnNew.vertex, + oldChoiceOnNew.otherEndpoint) = + s(newChoice.vertex, newChoice.otherEndpoint) → + ∀ (holdColorNe : oldGamma ≠ oldChoice.color) + (hnewColorNe : newGamma ≠ newChoice.color) + (hidentifiedDelta : + newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) + (holdDeltaAvailable : + oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma), + newChoice.color = available.delta → + newGamma = available.gamma → + let replacementLast : + Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds; + Fin.castLE ((by omega)) replacementLast = + q.castSucc → + available.delta ∈ + MissingColors G sigma newChoice.vertex → + available.gamma ≠ available.delta → + newChoice.vertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) → + TwoColorNontrivialPathComponent G sigma + available.gamma available.delta + (Sum.inl newChoice.vertex) → + (∃ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma available.gamma + available.delta + (Sum.inl newChoice.vertex)) → + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + (ett.series.data.coloring q.castSucc) + sigma → + let sigmaReturnGraph : + SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma + available.gamma available.delta; + ∀ + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, + edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk + (Sum.inr available.edge) + (Sum.inl available.returnVertex) := + available.returnPath.transfer + sigmaReturnGraph returnEdgeTransfer; + sigmaReturnPath.IsPath → + ( + ∀ (z : V ⊕ E), + z ∈ sigmaReturnPath.support ↔ + z ∈ available.returnPath.support) → + Sum.inl available.returnVertex ∈ + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inr available.edge) → + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inr available.edge) → + available.returnVertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree + earlierPrefix.castSucc) → + available.returnVertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc) → + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inl newChoice.vertex) ≠ + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inr available.edge) → + (∃ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma + available.gamma + available.delta + (Sum.inr available.edge)) → + 0 < corr.replacementETT.rounds → + corr.replacementETT.rounds < + ett.rounds → + ( + ∀ + (C : + CorrespondingExtendedTashkinovTree + G k e0 originalPrefix sigma + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc)), + C.replacementETT.series.data.tree + (Fin.last + (C.replacementETT.rounds + + 1)) = + C.replacementSeries.data.tree + (Fin.last + (originalPrefix.rounds + + 1))) → + corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1)) = + corr.replacementSeries.data.tree + (Fin.last + (originalPrefix.rounds + + 1)) → + corr.replacementETT.series.data.coloring + (Fin.last + corr.replacementETT.rounds) = + sigma → + StableColoring + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) + (TashkinovStoredColors + corr.replacementETT.series.data + (Fin.last + corr.replacementETT.rounds)) + (corr.replacementETT.series.data.coloring + (Fin.last + corr.replacementETT.rounds)) + sigma → + corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1)) = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc → + available.delta ∈ + TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) → + LowerRoundProperties + corr.replacementETT → + TreeInterchangeable G + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) + sigma available.gamma + available.delta → + TreeInterchangeable G + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc) + sigma available.gamma + available.delta → + ∀ + (replacementCycle : + TwoColorCycle G + sigma + available.gamma + available.delta), + ( + ∀ (x : V ⊕ E), + x ∈ + replacementCycle.walk.support ↔ + x ∈ + TwoColorComponent + G sigma + available.gamma + available.delta + (Sum.inr + available.edge)) → + ColoredVertexSetClosed + G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc)) → + ColoredVertexSetClosed + G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc)) → + ( + have + replacementLast : + Fin + (originalPrefix.rounds + + 1) := + Fin.last + originalPrefix.rounds; + corr.replacementSeries.data.tree + replacementLast.succ = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc) → + q.castSucc.succ = + (Fin.last + ett.rounds).castSucc → + ett.series.data.tree + q.castSucc.succ = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc → + let + currentTree : + Finset V := + TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc); + ∀ + (hreturnCycle : + Sum.inl + available.returnVertex ∈ + replacementCycle.walk.support), + Sum.inl + available.outsideEndpoint ∈ + replacementCycle.walk.support → + available.returnVertex ∈ + currentTree → + available.outsideEndpoint ∉ + currentTree → + let + rootedCycle : + (TwoColorIncidenceGraph + G sigma + available.gamma + available.delta).Walk + (Sum.inl + available.returnVertex) + (Sum.inl + available.returnVertex) := + replacementCycle.walk.rotate + (Sum.inl + available.returnVertex) + hreturnCycle; + rootedCycle.IsCycle → + Sum.inl + available.outsideEndpoint ∈ + rootedCycle.support → + let + outsideIndices : + Finset + (Fin + (rootedCycle.length + + 1)) := + {i : + Fin + (rootedCycle.length + + 1) | + ∃ (v : + V), + rootedCycle.getVert + (↑i : + ℕ) = + Sum.inl + v ∧ + v ∉ + currentTree}; + ∀ + (outsideIndicesNonempty : + outsideIndices.Nonempty), + let + firstOutside : + Fin + (rootedCycle.length + + 1) := + outsideIndices.min' + outsideIndicesNonempty; + ∀ + (outsideOne : + V), + rootedCycle.getVert + (↑(outsideIndices.min' + outsideIndicesNonempty) : + ℕ) = + Sum.inl + outsideOne → + outsideOne ∉ + currentTree → + ( + ∀ + (idx : + Fin + (rootedCycle.length + + 1)), + (↑idx : + ℕ) < + (↑firstOutside : + ℕ) → + ∀ + (v : + V), + rootedCycle.getVert + (↑idx : + ℕ) = + Sum.inl + v → + v ∈ + currentTree) → + 0 < + (↑firstOutside : + ℕ) → + (↑firstOutside : + ℕ) < + rootedCycle.length → + (↑firstOutside : + ℕ) ≠ + 1 → + 2 ≤ + (↑firstOutside : + ℕ) → + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1)) + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1 + + 1)) → + (↑firstOutside : + ℕ) - + 1 + + 1 = + (↑firstOutside : + ℕ) → + ∀ + (firstEdge : + E), + rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1) = + Sum.inr + firstEdge → + Incident + G + outsideOne + firstEdge → + sigma + firstEdge = + some + available.gamma ∨ + sigma + firstEdge = + some + available.delta → + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2)) + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2 + + 1)) → + (↑firstOutside : + ℕ) - + 2 + + 1 = + (↑firstOutside : + ℕ) - + 1 → + ∀ + (insideOne : + V), + rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2) = + Sum.inl + insideOne → + insideOne ∈ + currentTree → + Incident + G + insideOne + firstEdge → + ( + ∀ + {f : + E} + {a + b : + V}, + Incident + G + a + f → + Incident + G + b + f → + a ≠ + b → + G.ends + f = + s(a, + b)) → + insideOne ≠ + outsideOne → + G.ends + firstEdge = + s(insideOne, + outsideOne) → + firstEdge ∈ + BoundaryEdges + G + currentTree → + let + laterInsideIndices : + Finset + (Fin + (rootedCycle.length + + 1)) := + {idx : + Fin + (rootedCycle.length + + 1) | + (↑firstOutside : + ℕ) < + (↑idx : + ℕ) ∧ + ∃ + (v + : + V), + rootedCycle.getVert + (↑idx : + ℕ) = + Sum.inl + v ∧ + v ∈ + currentTree}; + ∀ + (laterInsideNonempty : + laterInsideIndices.Nonempty), + let + firstReturn : + Fin + (rootedCycle.length + + 1) := + laterInsideIndices.min' + laterInsideNonempty; + laterInsideIndices.min' + laterInsideNonempty ∈ + laterInsideIndices → + (↑firstOutside : + ℕ) < + (↑firstReturn : + ℕ) → + ∀ + (insideTwo : + V), + rootedCycle.getVert + (↑(laterInsideIndices.min' + laterInsideNonempty) : + ℕ) = + Sum.inl + insideTwo → + insideTwo ∈ + currentTree → + (↑firstReturn : + ℕ) ≠ + (↑firstOutside : + ℕ) + + 1 → + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev revisitingCertificateTransportStatement.{u_1, u_2} : Prop := + open scoped Classical Sym2 in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : 0 < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + ∀ (fstar : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = { fstar } → + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar + seed → + ∀ (closureTree : TreeSequence G e0), + TashkinovClosure sigma seed closureTree → + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - 1, (by omega)⟩ : Fin ett.rounds); + q.succ = Fin.last ett.rounds → + q.castSucc = (⟨ett.rounds - 1, (by omega)⟩ : Fin (ett.rounds + 1)) → + ∀ (adjoined : TreeSequence G e0), + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + ett.series.data.stored q.succ = { available.delta, available.gamma } → + ett.series.data.connectingEdges q.succ = { available.edge } → + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE → + ∀ (hroundLarge : 1 < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - 1, (by omega)⟩ : Fin (ett.rounds + 1)))) + (hr : originalPrefix.rounds = ett.rounds - 1), + ( + ∀ (i : Fin (originalPrefix.rounds + 2)), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ((by omega)) i)) → + ( + ∀ (i : Fin (originalPrefix.rounds + 1)), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE ((by omega)) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE ((by omega)) i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc → + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigma → + MaximumProperty corr.replacementETT → + ∀ + (earlierPrefixBound : + (↑available.earlier : ℕ) < originalPrefix.rounds + 1), + let earlierPrefix : Fin (originalPrefix.rounds + 1) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : + Fin (originalPrefix.rounds + 1)); + Fin.castLE ((by omega)) earlierPrefix = available.earlier → + 0 < (↑earlierPrefix : ℕ) → + corr.replacementSeries.data.kind earlierPrefix = + some TashkinovExtensionKind.PE → + ∀ (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k), + available.earlier = oldi.succ → + ∀ (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma : Fin k), + corr.replacementSeries.data.delta newi.succ = + some newChoice.color → + corr.replacementSeries.data.gamma newi.succ = + some newGamma → + newi.succ = earlierPrefix → + ∀ + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + newi.succ.castSucc) + (TashkinovStoredColors ett.series.data + oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice htree.symm oldChoice; + ∀ + (holdColorCast : + oldChoiceOnNew.color = oldChoice.color), + s(oldChoiceOnNew.vertex, + oldChoiceOnNew.otherEndpoint) = + s(newChoice.vertex, newChoice.otherEndpoint) → + ∀ (holdColorNe : oldGamma ≠ oldChoice.color) + (hnewColorNe : newGamma ≠ newChoice.color) + (hidentifiedDelta : + newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) + (holdDeltaAvailable : + oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma), + newChoice.color = available.delta → + newGamma = available.gamma → + let replacementLast : + Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds; + Fin.castLE ((by omega)) replacementLast = + q.castSucc → + available.delta ∈ + MissingColors G sigma newChoice.vertex → + available.gamma ≠ available.delta → + newChoice.vertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) → + TwoColorNontrivialPathComponent G sigma + available.gamma available.delta + (Sum.inl newChoice.vertex) → + (∃ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma available.gamma + available.delta + (Sum.inl newChoice.vertex)) → + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + (ett.series.data.coloring q.castSucc) + sigma → + let sigmaReturnGraph : + SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma + available.gamma available.delta; + ∀ + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, + edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk + (Sum.inr available.edge) + (Sum.inl available.returnVertex) := + available.returnPath.transfer + sigmaReturnGraph returnEdgeTransfer; + sigmaReturnPath.IsPath → + ( + ∀ (z : V ⊕ E), + z ∈ sigmaReturnPath.support ↔ + z ∈ available.returnPath.support) → + Sum.inl available.returnVertex ∈ + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inr available.edge) → + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inr available.edge) → + available.returnVertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree + earlierPrefix.castSucc) → + available.returnVertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc) → + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inl newChoice.vertex) ≠ + TwoColorComponent G sigma + available.gamma available.delta + (Sum.inr available.edge) → + (∃ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma + available.gamma + available.delta + (Sum.inr available.edge)) → + 0 < corr.replacementETT.rounds → + corr.replacementETT.rounds < + ett.rounds → + ( + ∀ + (C : + CorrespondingExtendedTashkinovTree + G k e0 originalPrefix sigma + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc)), + C.replacementETT.series.data.tree + (Fin.last + (C.replacementETT.rounds + + 1)) = + C.replacementSeries.data.tree + (Fin.last + (originalPrefix.rounds + + 1))) → + corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1)) = + corr.replacementSeries.data.tree + (Fin.last + (originalPrefix.rounds + + 1)) → + corr.replacementETT.series.data.coloring + (Fin.last + corr.replacementETT.rounds) = + sigma → + StableColoring + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) + (TashkinovStoredColors + corr.replacementETT.series.data + (Fin.last + corr.replacementETT.rounds)) + (corr.replacementETT.series.data.coloring + (Fin.last + corr.replacementETT.rounds)) + sigma → + corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1)) = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc → + available.delta ∈ + TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) → + LowerRoundProperties + corr.replacementETT → + TreeInterchangeable G + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) + sigma available.gamma + available.delta → + TreeInterchangeable G + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc) + sigma available.gamma + available.delta → + ∀ + (replacementCycle : + TwoColorCycle G + sigma + available.gamma + available.delta), + ( + ∀ (x : V ⊕ E), + x ∈ + replacementCycle.walk.support ↔ + x ∈ + TwoColorComponent + G sigma + available.gamma + available.delta + (Sum.inr + available.edge)) → + ColoredVertexSetClosed + G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc)) → + ColoredVertexSetClosed + G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc)) → + ( + have + replacementLast : + Fin + (originalPrefix.rounds + + 1) := + Fin.last + originalPrefix.rounds; + corr.replacementSeries.data.tree + replacementLast.succ = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc) → + q.castSucc.succ = + (Fin.last + ett.rounds).castSucc → + ett.series.data.tree + q.castSucc.succ = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc → + let + currentTree : + Finset V := + TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc); + ∀ + (hreturnCycle : + Sum.inl + available.returnVertex ∈ + replacementCycle.walk.support), + Sum.inl + available.outsideEndpoint ∈ + replacementCycle.walk.support → + available.returnVertex ∈ + currentTree → + available.outsideEndpoint ∉ + currentTree → + let + rootedCycle : + (TwoColorIncidenceGraph + G sigma + available.gamma + available.delta).Walk + (Sum.inl + available.returnVertex) + (Sum.inl + available.returnVertex) := + replacementCycle.walk.rotate + (Sum.inl + available.returnVertex) + hreturnCycle; + rootedCycle.IsCycle → + Sum.inl + available.outsideEndpoint ∈ + rootedCycle.support → + let + outsideIndices : + Finset + (Fin + (rootedCycle.length + + 1)) := + {i : + Fin + (rootedCycle.length + + 1) | + ∃ (v : + V), + rootedCycle.getVert + (↑i : + ℕ) = + Sum.inl + v ∧ + v ∉ + currentTree}; + ∀ + (outsideIndicesNonempty : + outsideIndices.Nonempty), + let + firstOutside : + Fin + (rootedCycle.length + + 1) := + outsideIndices.min' + outsideIndicesNonempty; + ∀ + (outsideOne : + V), + rootedCycle.getVert + (↑(outsideIndices.min' + outsideIndicesNonempty) : + ℕ) = + Sum.inl + outsideOne → + outsideOne ∉ + currentTree → + ( + ∀ + (idx : + Fin + (rootedCycle.length + + 1)), + (↑idx : + ℕ) < + (↑firstOutside : + ℕ) → + ∀ + (v : + V), + rootedCycle.getVert + (↑idx : + ℕ) = + Sum.inl + v → + v ∈ + currentTree) → + 0 < + (↑firstOutside : + ℕ) → + (↑firstOutside : + ℕ) < + rootedCycle.length → + (↑firstOutside : + ℕ) ≠ + 1 → + 2 ≤ + (↑firstOutside : + ℕ) → + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1)) + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1 + + 1)) → + (↑firstOutside : + ℕ) - + 1 + + 1 = + (↑firstOutside : + ℕ) → + ∀ + (firstEdge : + E), + rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1) = + Sum.inr + firstEdge → + Incident + G + outsideOne + firstEdge → + sigma + firstEdge = + some + available.gamma ∨ + sigma + firstEdge = + some + available.delta → + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2)) + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2 + + 1)) → + (↑firstOutside : + ℕ) - + 2 + + 1 = + (↑firstOutside : + ℕ) - + 1 → + ∀ + (insideOne : + V), + rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2) = + Sum.inl + insideOne → + insideOne ∈ + currentTree → + Incident + G + insideOne + firstEdge → + ( + ∀ + {f : + E} + {a + b : + V}, + Incident + G + a + f → + Incident + G + b + f → + a ≠ + b → + G.ends + f = + s(a, + b)) → + insideOne ≠ + outsideOne → + G.ends + firstEdge = + s(insideOne, + outsideOne) → + firstEdge ∈ + BoundaryEdges + G + currentTree → + let + laterInsideIndices : + Finset + (Fin + (rootedCycle.length + + 1)) := + {idx : + Fin + (rootedCycle.length + + 1) | + (↑firstOutside : + ℕ) < + (↑idx : + ℕ) ∧ + ∃ + (v + : + V), + rootedCycle.getVert + (↑idx : + ℕ) = + Sum.inl + v ∧ + v ∈ + currentTree}; + ∀ + (laterInsideNonempty : + laterInsideIndices.Nonempty), + let + firstReturn : + Fin + (rootedCycle.length + + 1) := + laterInsideIndices.min' + laterInsideNonempty; + laterInsideIndices.min' + laterInsideNonempty ∈ + laterInsideIndices → + (↑firstOutside : + ℕ) < + (↑firstReturn : + ℕ) → + ∀ + (insideTwo : + V), + rootedCycle.getVert + (↑(laterInsideIndices.min' + laterInsideNonempty) : + ℕ) = + Sum.inl + insideTwo → + insideTwo ∈ + currentTree → + (↑firstReturn : + ℕ) ≠ + (↑firstOutside : + ℕ) + + 1 → + (↑firstOutside : + ℕ) + + 2 ≤ + (↑firstReturn : + ℕ) → + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 1)) + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 1 + + 1)) → + (↑firstReturn : + ℕ) - + 1 + + 1 = + (↑firstReturn : + ℕ) → + ∀ + (secondEdge : + E), + rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 1) = + Sum.inr + secondEdge → + Incident + G + insideTwo + secondEdge → + sigma + secondEdge = + some + available.gamma ∨ + sigma + secondEdge = + some + available.delta → + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 2)) + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 2 + + 1)) → + (↑firstReturn : + ℕ) - + 2 + + 1 = + (↑firstReturn : + ℕ) - + 1 → + ∀ + (outsideTwo : + V), + rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 2) = + Sum.inl + outsideTwo → + outsideTwo ∉ + currentTree → + Incident + G + outsideTwo + secondEdge → + outsideTwo ≠ + insideTwo → + G.ends + secondEdge = + s(insideTwo, + outsideTwo) → + secondEdge ∈ + BoundaryEdges + G + currentTree → + firstEdge ≠ + secondEdge → + newChoice.vertex ∈ + currentTree → + sigma + firstEdge = + some + available.gamma → + sigma + secondEdge = + some + available.gamma → + ¬ColoredVertexSetStronglyClosed + G + sigma + currentTree → + corr.replacementSeries.data.coloring + replacementLast = + sigma → + let + castReturnWalk : + (phi + psi : + PartialEdgeColoring + E + k) → + phi = + psi → + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) → + (TwoColorIncidenceGraph + G + phi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) := + fun + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (P : + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) ↦ + Eq.ndrec + (motive := + fun + (psi : + PartialEdgeColoring + E + k) ↦ + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) → + (TwoColorIncidenceGraph + G + phi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) + (fun + (P : + (TwoColorIncidenceGraph + G + phi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) ↦ + P) + hphi + P; + ( + ∀ + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (P : + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)), + P.IsPath → + (castReturnWalk + phi + psi + hphi + P).IsPath) → + ( + ∀ + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (P : + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) + (z : + V ⊕ + E), + z ∈ + (castReturnWalk + phi + psi + hphi + P).support ↔ + z ∈ + P.support) → + let + castCycle : + (phi + psi : + PartialEdgeColoring + E + k) → + phi = + psi → + TwoColorCycle + G + psi + available.gamma + available.delta → + TwoColorCycle + G + phi + available.gamma + available.delta := + fun + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (C : + TwoColorCycle + G + psi + available.gamma + available.delta) ↦ + Eq.ndrec + (motive := + fun + (psi : + PartialEdgeColoring + E + k) ↦ + TwoColorCycle + G + psi + available.gamma + available.delta → + TwoColorCycle + G + phi + available.gamma + available.delta) + (fun + (C : + TwoColorCycle + G + phi + available.gamma + available.delta) ↦ + C) + hphi + C; + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev revisitingFinalSeriesStatement.{u_1, u_2} : Prop := + open scoped Classical Sym2 in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : 0 < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + ∀ (fstar : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = { fstar } → + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar + seed → + ∀ (closureTree : TreeSequence G e0), + TashkinovClosure sigma seed closureTree → + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - 1, (by omega)⟩ : Fin ett.rounds); + q.succ = Fin.last ett.rounds → + ∀ (hqCast : q.castSucc = (⟨ett.rounds - 1, (by omega)⟩ : Fin (ett.rounds + 1))) + (adjoined : TreeSequence G e0), + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + ett.series.data.stored q.succ = { available.delta, available.gamma } → + ett.series.data.connectingEdges q.succ = { available.edge } → + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE → + ∀ (hroundLarge : 1 < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - 1, (by omega)⟩ : Fin (ett.rounds + 1)))) + (hr : originalPrefix.rounds = ett.rounds - 1), + ( + ∀ (i : Fin (originalPrefix.rounds + 2)), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ((by omega)) i)) → + ∀ + (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + 1)), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE ((by omega)) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE ((by omega)) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc → + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigma → + MaximumProperty corr.replacementETT → + ∀ + (earlierPrefixBound : + (↑available.earlier : ℕ) < originalPrefix.rounds + 1), + let earlierPrefix : Fin (originalPrefix.rounds + 1) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : + Fin (originalPrefix.rounds + 1)); + ∀ + (hearlierMap : + Fin.castLE ((by omega)) earlierPrefix = available.earlier) + (hearlierPositive : 0 < (↑earlierPrefix : ℕ)) + (hreplacementEarlierKind : + corr.replacementSeries.data.kind earlierPrefix = + some TashkinovExtensionKind.PE) + (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k), + available.earlier = oldi.succ → + ∀ (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma : Fin k) + (newCurrentDelta : + corr.replacementSeries.data.delta newi.succ = + some newChoice.color) + (newCurrentGamma : + corr.replacementSeries.data.gamma newi.succ = some newGamma) + (hnewIndex : newi.succ = earlierPrefix) + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice htree.symm oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color), + s(oldChoiceOnNew.vertex, oldChoiceOnNew.otherEndpoint) = + s(newChoice.vertex, newChoice.otherEndpoint) → + ∀ (holdColorNe : oldGamma ≠ oldChoice.color) + (hnewColorNe : newGamma ≠ newChoice.color) + (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) + (hnewDeltaAvailable : newChoice.color = available.delta) + (hnewGammaAvailable : newGamma = available.gamma), + let replacementLast : Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds; + ∀ + (hreplacementLastMap : + Fin.castLE ((by omega)) replacementLast = q.castSucc), + available.delta ∈ MissingColors G sigma newChoice.vertex → + ∀ (hgammaDeltaNe : available.gamma ≠ available.delta), + newChoice.vertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) → + TwoColorNontrivialPathComponent G sigma available.gamma + available.delta (Sum.inl newChoice.vertex) → + (∃ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma available.gamma + available.delta (Sum.inl newChoice.vertex)) → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma → + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma available.gamma + available.delta; + ∀ + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, + edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk (Sum.inr available.edge) + (Sum.inl available.returnVertex) := + available.returnPath.transfer sigmaReturnGraph + returnEdgeTransfer; + ∀ (hsigmaReturnIsPath : sigmaReturnPath.IsPath) + (hsigmaReturnSupport : + ∀ (z : V ⊕ E), + z ∈ sigmaReturnPath.support ↔ + z ∈ available.returnPath.support), + Sum.inl available.returnVertex ∈ + TwoColorComponent G sigma available.gamma + available.delta (Sum.inr available.edge) → + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G sigma available.gamma + available.delta (Sum.inr available.edge) → + ∀ + (hreturnInNewEarlier : + available.returnVertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree + earlierPrefix.castSucc)), + available.returnVertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) → + TwoColorComponent G sigma available.gamma + available.delta (Sum.inl newChoice.vertex) ≠ + TwoColorComponent G sigma available.gamma + available.delta (Sum.inr available.edge) → + (∃ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma available.gamma + available.delta + (Sum.inr available.edge)) → + 0 < corr.replacementETT.rounds → + corr.replacementETT.rounds < ett.rounds → + ( + ∀ + (C : + CorrespondingExtendedTashkinovTree G k + e0 originalPrefix sigma + (ett.series.data.tree + (Fin.last ett.rounds).castSucc)), + C.replacementETT.series.data.tree + (Fin.last + (C.replacementETT.rounds + 1)) = + C.replacementSeries.data.tree + (Fin.last + (originalPrefix.rounds + 1))) → + corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + 1)) = + corr.replacementSeries.data.tree + (Fin.last + (originalPrefix.rounds + 1)) → + corr.replacementETT.series.data.coloring + (Fin.last + corr.replacementETT.rounds) = + sigma → + StableColoring + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + 1))) + (TashkinovStoredColors + corr.replacementETT.series.data + (Fin.last + corr.replacementETT.rounds)) + (corr.replacementETT.series.data.coloring + (Fin.last + corr.replacementETT.rounds)) + sigma → + corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + 1)) = + ett.series.data.tree + (Fin.last ett.rounds).castSucc → + available.delta ∈ + TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) → + LowerRoundProperties + corr.replacementETT → + TreeInterchangeable G + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) + sigma available.gamma + available.delta → + TreeInterchangeable G + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) + sigma available.gamma + available.delta → + ∀ + (replacementCycle : + TwoColorCycle G sigma + available.gamma + available.delta) + (hcycleFull : + ∀ (x : V ⊕ E), + x ∈ + replacementCycle.walk.support ↔ + x ∈ + TwoColorComponent G sigma + available.gamma + available.delta + (Sum.inr available.edge)), + ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc)) → + ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc)) → + ∀ + (hreplacementCurrentTree : + have replacementLast : + Fin + (originalPrefix.rounds + + 1) := + Fin.last + originalPrefix.rounds; + corr.replacementSeries.data.tree + replacementLast.succ = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc), + q.castSucc.succ = + (Fin.last + ett.rounds).castSucc → + ∀ + (havailableCurrentTree : + ett.series.data.tree + q.castSucc.succ = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc), + let currentTree : + Finset V := + TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc); + ∀ + (hreturnCycle : + Sum.inl + available.returnVertex ∈ + replacementCycle.walk.support) + (houtsideCycle : + Sum.inl + available.outsideEndpoint ∈ + replacementCycle.walk.support), + available.returnVertex ∈ + currentTree → + available.outsideEndpoint ∉ + currentTree → + let rootedCycle : + (TwoColorIncidenceGraph + G sigma + available.gamma + available.delta).Walk + (Sum.inl + available.returnVertex) + (Sum.inl + available.returnVertex) := + replacementCycle.walk.rotate + (Sum.inl + available.returnVertex) + hreturnCycle; + rootedCycle.IsCycle → + Sum.inl + available.outsideEndpoint ∈ + rootedCycle.support → + let outsideIndices : + Finset + (Fin + (rootedCycle.length + + 1)) := + {i : + Fin + (rootedCycle.length + + 1) | + ∃ (v : V), + rootedCycle.getVert + (↑i : ℕ) = + Sum.inl v ∧ + v ∉ currentTree}; + ∀ + (outsideIndicesNonempty : + outsideIndices.Nonempty), + let firstOutside : + Fin + (rootedCycle.length + + 1) := + outsideIndices.min' + outsideIndicesNonempty; + ∀ (outsideOne : V), + rootedCycle.getVert + (↑(outsideIndices.min' + outsideIndicesNonempty) : + ℕ) = + Sum.inl + outsideOne → + outsideOne ∉ + currentTree → + ( + ∀ + (idx : + Fin + (rootedCycle.length + + 1)), + (↑idx : ℕ) < + (↑firstOutside : + ℕ) → + ∀ (v : V), + rootedCycle.getVert + (↑idx : ℕ) = + Sum.inl v → + v ∈ + currentTree) → + 0 < + (↑firstOutside : + ℕ) → + (↑firstOutside : + ℕ) < + rootedCycle.length → + ∀ + (firstOutsideNotOne : + (↑firstOutside : + ℕ) ≠ + 1) + (firstOutsideAtLeastTwo : + 2 ≤ + (↑firstOutside : + ℕ)), + (TwoColorIncidenceGraph + G sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1)) + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1 + + 1)) → + ∀ + (firstCrossingIndex : + (↑firstOutside : + ℕ) - + 1 + + 1 = + (↑firstOutside : + ℕ)) + (firstEdge : + E), + rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1) = + Sum.inr + firstEdge → + Incident G + outsideOne + firstEdge → + sigma + firstEdge = + some + available.gamma ∨ + sigma + firstEdge = + some + available.delta → + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2)) + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2 + + 1)) → + ∀ + (beforeFirstCrossingIndex : + (↑firstOutside : + ℕ) - + 2 + + 1 = + (↑firstOutside : + ℕ) - + 1) + (insideOne : + V), + rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2) = + Sum.inl + insideOne → + insideOne ∈ + currentTree → + Incident + G + insideOne + firstEdge → + ( + ∀ + {f : + E} + {a + b : + V}, + Incident + G + a + f → + Incident + G + b + f → + a ≠ + b → + G.ends + f = + s(a, + b)) → + insideOne ≠ + outsideOne → + G.ends + firstEdge = + s(insideOne, + outsideOne) → + firstEdge ∈ + BoundaryEdges + G + currentTree → + let + laterInsideIndices : + Finset + (Fin + (rootedCycle.length + + 1)) := + {idx : + Fin + (rootedCycle.length + + 1) | + (↑firstOutside : + ℕ) < + (↑idx : + ℕ) ∧ + ∃ + (v + : + V), + rootedCycle.getVert + (↑idx : + ℕ) = + Sum.inl + v ∧ + v ∈ + currentTree}; + ∀ + (laterInsideNonempty : + laterInsideIndices.Nonempty), + let + firstReturn : + Fin + (rootedCycle.length + + 1) := + laterInsideIndices.min' + laterInsideNonempty; + laterInsideIndices.min' + laterInsideNonempty ∈ + laterInsideIndices → + (↑firstOutside : + ℕ) < + (↑firstReturn : + ℕ) → + ∀ + (insideTwo : + V), + rootedCycle.getVert + (↑(laterInsideIndices.min' + laterInsideNonempty) : + ℕ) = + Sum.inl + insideTwo → + insideTwo ∈ + currentTree → + ∀ + (hreturnNotNext : + (↑firstReturn : + ℕ) ≠ + (↑firstOutside : + ℕ) + + 1) + (hreturnGap : + (↑firstOutside : + ℕ) + + 2 ≤ + (↑firstReturn : + ℕ)), + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 1)) + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 1 + + 1)) → + ∀ + (returnCrossingIndex : + (↑firstReturn : + ℕ) - + 1 + + 1 = + (↑firstReturn : + ℕ)) + (secondEdge : + E), + rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 1) = + Sum.inr + secondEdge → + Incident + G + insideTwo + secondEdge → + sigma + secondEdge = + some + available.gamma ∨ + sigma + secondEdge = + some + available.delta → + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 2)) + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 2 + + 1)) → + ∀ + (beforeReturnCrossingIndex : + (↑firstReturn : + ℕ) - + 2 + + 1 = + (↑firstReturn : + ℕ) - + 1) + (outsideTwo : + V), + rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 2) = + Sum.inl + outsideTwo → + outsideTwo ∉ + currentTree → + Incident + G + outsideTwo + secondEdge → + outsideTwo ≠ + insideTwo → + G.ends + secondEdge = + s(insideTwo, + outsideTwo) → + secondEdge ∈ + BoundaryEdges + G + currentTree → + firstEdge ≠ + secondEdge → + newChoice.vertex ∈ + currentTree → + sigma + firstEdge = + some + available.gamma → + sigma + secondEdge = + some + available.gamma → + ¬ColoredVertexSetStronglyClosed + G + sigma + currentTree → + ∀ + (hreplacementColor : + corr.replacementSeries.data.coloring + replacementLast = + sigma), + let + castReturnWalk : + (phi + psi : + PartialEdgeColoring + E + k) → + phi = + psi → + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) → + (TwoColorIncidenceGraph + G + phi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) := + fun + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (P : + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) ↦ + Eq.ndrec + (motive := + fun + (psi : + PartialEdgeColoring + E + k) ↦ + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) → + (TwoColorIncidenceGraph + G + phi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) + (fun + (P : + (TwoColorIncidenceGraph + G + phi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) ↦ + P) + hphi + P; + ∀ + (castReturnWalkIsPath : + ∀ + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (P : + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)), + P.IsPath → + (castReturnWalk + phi + psi + hphi + P).IsPath) + (castReturnWalkSupport : + ∀ + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (P : + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) + (z : + V ⊕ + E), + z ∈ + (castReturnWalk + phi + psi + hphi + P).support ↔ + z ∈ + P.support), + let + castCycle : + (phi + psi : + PartialEdgeColoring + E + k) → + phi = + psi → + TwoColorCycle + G + psi + available.gamma + available.delta → + TwoColorCycle + G + phi + available.gamma + available.delta := + fun + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (C : + TwoColorCycle + G + psi + available.gamma + available.delta) ↦ + Eq.ndrec + (motive := + fun + (psi : + PartialEdgeColoring + E + k) ↦ + TwoColorCycle + G + psi + available.gamma + available.delta → + TwoColorCycle + G + phi + available.gamma + available.delta) + (fun + (C : + TwoColorCycle + G + phi + available.gamma + available.delta) ↦ + C) + hphi + C; + ∀ + (castCycleSupport : + ∀ + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (C : + TwoColorCycle + G + psi + available.gamma + available.delta) + (z : + V ⊕ + E), + z ∈ + (castCycle + phi + psi + hphi + C).walk.support ↔ + z ∈ + C.walk.support), + let + replacementCycleForPrefix : + TwoColorCycle + G + (corr.replacementSeries.data.coloring + replacementLast) + available.gamma + available.delta := + castCycle + (corr.replacementSeries.data.coloring + replacementLast) + sigma + hreplacementColor + replacementCycle; + let + replacementReturnPath : + (TwoColorIncidenceGraph + G + (corr.replacementSeries.data.coloring + replacementLast) + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) := + castReturnWalk + (corr.replacementSeries.data.coloring + replacementLast) + sigma + hreplacementColor + sigmaReturnPath; + ( + have + sigmaReturnPath : + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) := + available.returnPath.transfer + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta) + returnEdgeTransfer; + ∀ + z ∈ + sigmaReturnPath.support, + z ∈ + TwoColorComponent + G + sigma + available.gamma + available.delta + (Sum.inr + available.edge)) → + ∀ + (hsigmaPathOnCycle : + ∀ + z ∈ + sigmaReturnPath.support, + z ∈ + replacementCycle.walk.support), + let + replacementCertificate : + RevisitingExtensionCertificate + corr.replacementSeries.data + replacementLast := + { + earlier := + earlierPrefix, + earlierPositive := + hearlierPositive, + earlierAtMost := + Nat.le_of_lt_succ + earlierPrefix.isLt, + earlierPE := + hreplacementEarlierKind, + interveningRevisiting := + helper_interveningRevisiting_4368 + G + k + e0 + input + T + generating + ett + hpositive + sigma + Tstar + hqCast + available + hroundLarge + originalPrefix + hr + hprefixData + corr + earlierPrefixBound + hearlierMap + oldi + oldChoice + oldGamma + newi + newChoice + newGamma + htree + holdColorCast + holdColorNe + hnewColorNe + hidentifiedDelta + hidentifiedGamma + holdDeltaAvailable + holdGammaAvailable + hreplacementLastMap + hgammaDeltaNe + replacementCycle + hreturnCycle + outsideIndicesNonempty + firstOutsideNotOne + firstOutsideAtLeastTwo + firstCrossingIndex + beforeFirstCrossingIndex + laterInsideNonempty + hreturnNotNext + hreturnGap + returnCrossingIndex + beforeReturnCrossingIndex, + gamma := + available.gamma, + delta := + available.delta, + earlierGamma := + Eq.mpr + (id + (congrArg + (fun + (_a : + Fin + (originalPrefix.rounds + + 1)) ↦ + corr.replacementSeries.data.gamma + _a = + some + available.gamma) + (Eq.symm + hnewIndex))) + (Eq.mpr + (id + (congrArg + (fun + (_a : + Option + (Fin + k)) ↦ + _a = + some + available.gamma) + newCurrentGamma)) + (Eq.mpr + (id + (congrArg + (fun + (_a : + Fin + k) ↦ + some + _a = + some + available.gamma) + hnewGammaAvailable)) + (Eq.refl + (some + available.gamma)))), + earlierDelta := + Eq.mpr + (id + (congrArg + (fun + (_a : + Fin + (originalPrefix.rounds + + 1)) ↦ + corr.replacementSeries.data.delta + _a = + some + available.delta) + (Eq.symm + hnewIndex))) + (Eq.mpr + (id + (congrArg + (fun + (_a : + Option + (Fin + k)) ↦ + _a = + some + available.delta) + newCurrentDelta)) + (Eq.mpr + (id + (congrArg + (fun + (_a : + Fin + k) ↦ + some + _a = + some + available.delta) + hnewDeltaAvailable)) + (Eq.refl + (some + available.delta)))), + cycle := + replacementCycleForPrefix, + meetsEarlier := + Exists.intro + available.returnVertex + (⟨hreturnInNewEarlier, + (castCycleSupport + (corr.replacementSeries.data.coloring + replacementLast) + sigma + hreplacementColor + replacementCycle + (Sum.inl + available.returnVertex)).mpr + hreturnCycle⟩ : + available.returnVertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree + earlierPrefix.castSucc) ∧ + Sum.inl + available.returnVertex ∈ + replacementCycleForPrefix.walk.support), + leavesCurrent := + helper_leavesCurrent_4395 + G + k + e0 + input + T + generating + ett + hpositive + sigma + Tstar + available + hroundLarge + originalPrefix + corr + replacementCycle + hreplacementCurrentTree + havailableCurrentTree + houtsideCycle + hreplacementColor + castCycleSupport, + edge := + available.edge, + edgeOnCycle := + (castCycleSupport + (corr.replacementSeries.data.coloring + replacementLast) + sigma + hreplacementColor + replacementCycle + (Sum.inr + available.edge)).mpr + ((hcycleFull + (Sum.inr + available.edge)).mpr + rfl), + edgeBoundary := + Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.edge ∈ + BoundaryEdges + G + (TreeSequenceVertexSet + _a)) + hreplacementCurrentTree)) + (Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.edge ∈ + BoundaryEdges + G + (TreeSequenceVertexSet + _a)) + (Eq.symm + havailableCurrentTree))) + available.edgeBoundary), + insideEndpoint := + available.insideEndpoint, + outsideEndpoint := + available.outsideEndpoint, + insideInCurrent := + Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.insideEndpoint ∈ + TreeSequenceVertexSet + _a) + hreplacementCurrentTree)) + (Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.insideEndpoint ∈ + TreeSequenceVertexSet + _a) + (Eq.symm + havailableCurrentTree))) + available.insideInCurrent), + outsideNotCurrent := + Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.outsideEndpoint ∉ + TreeSequenceVertexSet + _a) + hreplacementCurrentTree)) + (Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.outsideEndpoint ∉ + TreeSequenceVertexSet + _a) + (Eq.symm + havailableCurrentTree))) + available.outsideNotCurrent), + edgeEnds := + available.edgeEnds, + returnVertex := + available.returnVertex, + returnInEarlier := + hreturnInNewEarlier, + returnPath := + replacementReturnPath, + returnPathIsPath := + castReturnWalkIsPath + (corr.replacementSeries.data.coloring + replacementLast) + sigma + hreplacementColor + sigmaReturnPath + hsigmaReturnIsPath, + returnPathOnCycle := + helper_returnPathOnCycle_4421 + G + k + e0 + input + T + generating + ett + hpositive + sigma + Tstar + available + hroundLarge + originalPrefix + corr + returnEdgeTransfer + replacementCycle + hreplacementColor + castReturnWalkSupport + castCycleSupport + hsigmaPathOnCycle, + returnPathInternal := + helper_returnPathInternal_4428 + G + k + e0 + input + T + generating + ett + hpositive + sigma + Tstar + available + hroundLarge + originalPrefix + corr + returnEdgeTransfer + hsigmaReturnSupport + hreplacementCurrentTree + havailableCurrentTree + hreplacementColor + castReturnWalkSupport : + RevisitingExtensionCertificate + corr.replacementSeries.data + replacementLast }; + fstar = + available.edge → + let + newStored : + Finset + (Fin + k) := + { + available.delta, + available.gamma }; + let + newEdges : + Finset + E := + { + available.edge }; + let + newKind : + Option + TashkinovExtensionKind := + some + TashkinovExtensionKind.RE; + let + newVertex : + Option + V := + some + available.insideEndpoint; + let + newOutside : + Option + V := + some + available.outsideEndpoint; + let + newDelta : + Option + (Fin + k) := + some + available.delta; + let + newGamma : + Option + (Fin + k) := + some + available.gamma; + let + appendedData : + TashkinovSeriesData + G + k + (originalPrefix.rounds + + 1) + e0 := + TashkinovSeriesDataAppend + corr.replacementSeries.data + closureTree + sigma + newStored + newEdges + newKind + newVertex + newOutside + newDelta + newGamma; + ∀ + (appendedCertificate : + RevisitingExtensionCertificate + (TashkinovSeriesDataAppend + corr.replacementSeries.data + closureTree + sigma + newStored + newEdges + newKind + newVertex + newOutside + newDelta + newGamma) + replacementLast.castSucc), + appendedCertificate.gamma = + replacementCertificate.gamma → + appendedCertificate.delta = + replacementCertificate.delta → + appendedCertificate.edge = + replacementCertificate.edge → + appendedCertificate.insideEndpoint = + replacementCertificate.insideEndpoint → + appendedCertificate.outsideEndpoint = + replacementCertificate.outsideEndpoint → + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc).length < + closureTree.length → + TashkinovSeriesStep + G + k + (originalPrefix.rounds + + 1) + e0 + corr.replacementInput + appendedData + (Fin.last + (originalPrefix.rounds + + 1)) → + ∀ + (extendedSeries : + TashkinovSeries + G + k + (originalPrefix.rounds + + 1) + e0 + corr.replacementInput), + extendedSeries.data = + TashkinovSeriesDataAppend + corr.replacementSeries.data + closureTree + sigma + newStored + newEdges + newKind + newVertex + newOutside + newDelta + newGamma → + Nonempty + (CorrespondingExtendedTashkinovTree + G + k + e0 + ett + sigma + Tstar) + +private abbrev revisitingSeriesAgreementStatement.{u_1, u_2} : Prop := + open scoped Classical Sym2 in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : 0 < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + ∀ (fstar : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = { fstar } → + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar + seed → + ∀ (closureTree : TreeSequence G e0), + TashkinovClosure sigma seed closureTree → + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - 1, (by omega)⟩ : Fin ett.rounds); + q.succ = Fin.last ett.rounds → + ∀ (hqCast : q.castSucc = (⟨ett.rounds - 1, (by omega)⟩ : Fin (ett.rounds + 1))) + (adjoined : TreeSequence G e0), + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ∀ (available : RevisitingExtensionCertificate ett.series.data q.castSucc), + ett.series.data.stored q.succ = { available.delta, available.gamma } → + ett.series.data.connectingEdges q.succ = { available.edge } → + ett.series.data.kind q.succ = some TashkinovExtensionKind.RE → + ∀ (hroundLarge : 1 < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - 1, (by omega)⟩ : Fin (ett.rounds + 1)))) + (hr : originalPrefix.rounds = ett.rounds - 1), + ( + ∀ (i : Fin (originalPrefix.rounds + 2)), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ((by omega)) i)) → + ∀ + (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + 1)), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE ((by omega)) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE ((by omega)) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE ((by omega)) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc → + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigma → + MaximumProperty corr.replacementETT → + ∀ + (earlierPrefixBound : + (↑available.earlier : ℕ) < originalPrefix.rounds + 1), + let earlierPrefix : Fin (originalPrefix.rounds + 1) := + (⟨(↑available.earlier : ℕ), earlierPrefixBound⟩ : + Fin (originalPrefix.rounds + 1)); + ∀ + (hearlierMap : + Fin.castLE ((by omega)) earlierPrefix = available.earlier) + (hearlierPositive : 0 < (↑earlierPrefix : ℕ)) + (hreplacementEarlierKind : + corr.replacementSeries.data.kind earlierPrefix = + some TashkinovExtensionKind.PE) + (oldi : Fin ett.rounds) + (oldChoice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc)) + (oldGamma : Fin k), + available.earlier = oldi.succ → + ∀ (newi : Fin originalPrefix.rounds) + (newChoice : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) + (newGamma : Fin k) + (newCurrentDelta : + corr.replacementSeries.data.delta newi.succ = + some newChoice.color) + (newCurrentGamma : + corr.replacementSeries.data.gamma newi.succ = some newGamma) + (hnewIndex : newi.succ = earlierPrefix) + (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc), + let oldChoiceOnNew : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice htree.symm oldChoice; + ∀ (holdColorCast : oldChoiceOnNew.color = oldChoice.color), + s(oldChoiceOnNew.vertex, oldChoiceOnNew.otherEndpoint) = + s(newChoice.vertex, newChoice.otherEndpoint) → + ∀ (holdColorNe : oldGamma ≠ oldChoice.color) + (hnewColorNe : newGamma ≠ newChoice.color) + (hidentifiedDelta : newChoice.color = oldChoiceOnNew.color) + (hidentifiedGamma : newGamma = oldGamma) + (holdDeltaAvailable : oldChoice.color = available.delta) + (holdGammaAvailable : oldGamma = available.gamma) + (hnewDeltaAvailable : newChoice.color = available.delta) + (hnewGammaAvailable : newGamma = available.gamma), + let replacementLast : Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds; + ∀ + (hreplacementLastMap : + Fin.castLE ((by omega)) replacementLast = q.castSucc), + available.delta ∈ MissingColors G sigma newChoice.vertex → + ∀ (hgammaDeltaNe : available.gamma ≠ available.delta), + newChoice.vertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) → + TwoColorNontrivialPathComponent G sigma available.gamma + available.delta (Sum.inl newChoice.vertex) → + (∃ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma available.gamma + available.delta (Sum.inl newChoice.vertex)) → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma → + let sigmaReturnGraph : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigma available.gamma + available.delta; + ∀ + (returnEdgeTransfer : + ∀ edge ∈ available.returnPath.edges, + edge ∈ sigmaReturnGraph.edgeSet), + let sigmaReturnPath : + sigmaReturnGraph.Walk (Sum.inr available.edge) + (Sum.inl available.returnVertex) := + available.returnPath.transfer sigmaReturnGraph + returnEdgeTransfer; + ∀ (hsigmaReturnIsPath : sigmaReturnPath.IsPath) + (hsigmaReturnSupport : + ∀ (z : V ⊕ E), + z ∈ sigmaReturnPath.support ↔ + z ∈ available.returnPath.support), + Sum.inl available.returnVertex ∈ + TwoColorComponent G sigma available.gamma + available.delta (Sum.inr available.edge) → + Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G sigma available.gamma + available.delta (Sum.inr available.edge) → + ∀ + (hreturnInNewEarlier : + available.returnVertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree + earlierPrefix.castSucc)), + available.returnVertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) → + TwoColorComponent G sigma available.gamma + available.delta (Sum.inl newChoice.vertex) ≠ + TwoColorComponent G sigma available.gamma + available.delta (Sum.inr available.edge) → + (∃ + v ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc), + Sum.inl v ∈ + TwoColorComponent G sigma available.gamma + available.delta + (Sum.inr available.edge)) → + 0 < corr.replacementETT.rounds → + corr.replacementETT.rounds < ett.rounds → + ( + ∀ + (C : + CorrespondingExtendedTashkinovTree G k + e0 originalPrefix sigma + (ett.series.data.tree + (Fin.last ett.rounds).castSucc)), + C.replacementETT.series.data.tree + (Fin.last + (C.replacementETT.rounds + 1)) = + C.replacementSeries.data.tree + (Fin.last + (originalPrefix.rounds + 1))) → + corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + 1)) = + corr.replacementSeries.data.tree + (Fin.last + (originalPrefix.rounds + 1)) → + corr.replacementETT.series.data.coloring + (Fin.last + corr.replacementETT.rounds) = + sigma → + StableColoring + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + 1))) + (TashkinovStoredColors + corr.replacementETT.series.data + (Fin.last + corr.replacementETT.rounds)) + (corr.replacementETT.series.data.coloring + (Fin.last + corr.replacementETT.rounds)) + sigma → + corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + 1)) = + ett.series.data.tree + (Fin.last ett.rounds).castSucc → + available.delta ∈ + TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) → + LowerRoundProperties + corr.replacementETT → + TreeInterchangeable G + (corr.replacementETT.series.data.tree + (Fin.last + (corr.replacementETT.rounds + + 1))) + sigma available.gamma + available.delta → + TreeInterchangeable G + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) + sigma available.gamma + available.delta → + ∀ + (replacementCycle : + TwoColorCycle G sigma + available.gamma + available.delta) + (hcycleFull : + ∀ (x : V ⊕ E), + x ∈ + replacementCycle.walk.support ↔ + x ∈ + TwoColorComponent G sigma + available.gamma + available.delta + (Sum.inr available.edge)), + ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc)) → + ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc)) → + ∀ + (hreplacementCurrentTree : + have replacementLast : + Fin + (originalPrefix.rounds + + 1) := + Fin.last + originalPrefix.rounds; + corr.replacementSeries.data.tree + replacementLast.succ = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc), + q.castSucc.succ = + (Fin.last + ett.rounds).castSucc → + ∀ + (havailableCurrentTree : + ett.series.data.tree + q.castSucc.succ = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc), + let currentTree : + Finset V := + TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc); + ∀ + (hreturnCycle : + Sum.inl + available.returnVertex ∈ + replacementCycle.walk.support) + (houtsideCycle : + Sum.inl + available.outsideEndpoint ∈ + replacementCycle.walk.support), + available.returnVertex ∈ + currentTree → + available.outsideEndpoint ∉ + currentTree → + let rootedCycle : + (TwoColorIncidenceGraph + G sigma + available.gamma + available.delta).Walk + (Sum.inl + available.returnVertex) + (Sum.inl + available.returnVertex) := + replacementCycle.walk.rotate + (Sum.inl + available.returnVertex) + hreturnCycle; + rootedCycle.IsCycle → + Sum.inl + available.outsideEndpoint ∈ + rootedCycle.support → + let outsideIndices : + Finset + (Fin + (rootedCycle.length + + 1)) := + {i : + Fin + (rootedCycle.length + + 1) | + ∃ (v : V), + rootedCycle.getVert + (↑i : ℕ) = + Sum.inl v ∧ + v ∉ currentTree}; + ∀ + (outsideIndicesNonempty : + outsideIndices.Nonempty), + let firstOutside : + Fin + (rootedCycle.length + + 1) := + outsideIndices.min' + outsideIndicesNonempty; + ∀ (outsideOne : V), + rootedCycle.getVert + (↑(outsideIndices.min' + outsideIndicesNonempty) : + ℕ) = + Sum.inl + outsideOne → + outsideOne ∉ + currentTree → + ( + ∀ + (idx : + Fin + (rootedCycle.length + + 1)), + (↑idx : ℕ) < + (↑firstOutside : + ℕ) → + ∀ (v : V), + rootedCycle.getVert + (↑idx : ℕ) = + Sum.inl v → + v ∈ + currentTree) → + 0 < + (↑firstOutside : + ℕ) → + (↑firstOutside : + ℕ) < + rootedCycle.length → + ∀ + (firstOutsideNotOne : + (↑firstOutside : + ℕ) ≠ + 1) + (firstOutsideAtLeastTwo : + 2 ≤ + (↑firstOutside : + ℕ)), + (TwoColorIncidenceGraph + G sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1)) + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1 + + 1)) → + ∀ + (firstCrossingIndex : + (↑firstOutside : + ℕ) - + 1 + + 1 = + (↑firstOutside : + ℕ)) + (firstEdge : + E), + rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 1) = + Sum.inr + firstEdge → + Incident G + outsideOne + firstEdge → + sigma + firstEdge = + some + available.gamma ∨ + sigma + firstEdge = + some + available.delta → + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2)) + (rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2 + + 1)) → + ∀ + (beforeFirstCrossingIndex : + (↑firstOutside : + ℕ) - + 2 + + 1 = + (↑firstOutside : + ℕ) - + 1) + (insideOne : + V), + rootedCycle.getVert + ((↑firstOutside : + ℕ) - + 2) = + Sum.inl + insideOne → + insideOne ∈ + currentTree → + Incident + G + insideOne + firstEdge → + ( + ∀ + {f : + E} + {a + b : + V}, + Incident + G + a + f → + Incident + G + b + f → + a ≠ + b → + G.ends + f = + s(a, + b)) → + insideOne ≠ + outsideOne → + G.ends + firstEdge = + s(insideOne, + outsideOne) → + firstEdge ∈ + BoundaryEdges + G + currentTree → + let + laterInsideIndices : + Finset + (Fin + (rootedCycle.length + + 1)) := + {idx : + Fin + (rootedCycle.length + + 1) | + (↑firstOutside : + ℕ) < + (↑idx : + ℕ) ∧ + ∃ + (v + : + V), + rootedCycle.getVert + (↑idx : + ℕ) = + Sum.inl + v ∧ + v ∈ + currentTree}; + ∀ + (laterInsideNonempty : + laterInsideIndices.Nonempty), + let + firstReturn : + Fin + (rootedCycle.length + + 1) := + laterInsideIndices.min' + laterInsideNonempty; + laterInsideIndices.min' + laterInsideNonempty ∈ + laterInsideIndices → + (↑firstOutside : + ℕ) < + (↑firstReturn : + ℕ) → + ∀ + (insideTwo : + V), + rootedCycle.getVert + (↑(laterInsideIndices.min' + laterInsideNonempty) : + ℕ) = + Sum.inl + insideTwo → + insideTwo ∈ + currentTree → + ∀ + (hreturnNotNext : + (↑firstReturn : + ℕ) ≠ + (↑firstOutside : + ℕ) + + 1) + (hreturnGap : + (↑firstOutside : + ℕ) + + 2 ≤ + (↑firstReturn : + ℕ)), + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 1)) + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 1 + + 1)) → + ∀ + (returnCrossingIndex : + (↑firstReturn : + ℕ) - + 1 + + 1 = + (↑firstReturn : + ℕ)) + (secondEdge : + E), + rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 1) = + Sum.inr + secondEdge → + Incident + G + insideTwo + secondEdge → + sigma + secondEdge = + some + available.gamma ∨ + sigma + secondEdge = + some + available.delta → + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Adj + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 2)) + (rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 2 + + 1)) → + ∀ + (beforeReturnCrossingIndex : + (↑firstReturn : + ℕ) - + 2 + + 1 = + (↑firstReturn : + ℕ) - + 1) + (outsideTwo : + V), + rootedCycle.getVert + ((↑firstReturn : + ℕ) - + 2) = + Sum.inl + outsideTwo → + outsideTwo ∉ + currentTree → + Incident + G + outsideTwo + secondEdge → + outsideTwo ≠ + insideTwo → + G.ends + secondEdge = + s(insideTwo, + outsideTwo) → + secondEdge ∈ + BoundaryEdges + G + currentTree → + firstEdge ≠ + secondEdge → + newChoice.vertex ∈ + currentTree → + sigma + firstEdge = + some + available.gamma → + sigma + secondEdge = + some + available.gamma → + ¬ColoredVertexSetStronglyClosed + G + sigma + currentTree → + ∀ + (hreplacementColor : + corr.replacementSeries.data.coloring + replacementLast = + sigma), + let + castReturnWalk : + (phi + psi : + PartialEdgeColoring + E + k) → + phi = + psi → + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) → + (TwoColorIncidenceGraph + G + phi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) := + fun + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (P : + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) ↦ + Eq.ndrec + (motive := + fun + (psi : + PartialEdgeColoring + E + k) ↦ + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) → + (TwoColorIncidenceGraph + G + phi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) + (fun + (P : + (TwoColorIncidenceGraph + G + phi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) ↦ + P) + hphi + P; + ∀ + (castReturnWalkIsPath : + ∀ + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (P : + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)), + P.IsPath → + (castReturnWalk + phi + psi + hphi + P).IsPath) + (castReturnWalkSupport : + ∀ + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (P : + (TwoColorIncidenceGraph + G + psi + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex)) + (z : + V ⊕ + E), + z ∈ + (castReturnWalk + phi + psi + hphi + P).support ↔ + z ∈ + P.support), + let + castCycle : + (phi + psi : + PartialEdgeColoring + E + k) → + phi = + psi → + TwoColorCycle + G + psi + available.gamma + available.delta → + TwoColorCycle + G + phi + available.gamma + available.delta := + fun + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (C : + TwoColorCycle + G + psi + available.gamma + available.delta) ↦ + Eq.ndrec + (motive := + fun + (psi : + PartialEdgeColoring + E + k) ↦ + TwoColorCycle + G + psi + available.gamma + available.delta → + TwoColorCycle + G + phi + available.gamma + available.delta) + (fun + (C : + TwoColorCycle + G + phi + available.gamma + available.delta) ↦ + C) + hphi + C; + ∀ + (castCycleSupport : + ∀ + (phi + psi : + PartialEdgeColoring + E + k) + (hphi : + phi = + psi) + (C : + TwoColorCycle + G + psi + available.gamma + available.delta) + (z : + V ⊕ + E), + z ∈ + (castCycle + phi + psi + hphi + C).walk.support ↔ + z ∈ + C.walk.support), + let + replacementCycleForPrefix : + TwoColorCycle + G + (corr.replacementSeries.data.coloring + replacementLast) + available.gamma + available.delta := + castCycle + (corr.replacementSeries.data.coloring + replacementLast) + sigma + hreplacementColor + replacementCycle; + let + replacementReturnPath : + (TwoColorIncidenceGraph + G + (corr.replacementSeries.data.coloring + replacementLast) + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) := + castReturnWalk + (corr.replacementSeries.data.coloring + replacementLast) + sigma + hreplacementColor + sigmaReturnPath; + ( + have + sigmaReturnPath : + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta).Walk + (Sum.inr + available.edge) + (Sum.inl + available.returnVertex) := + available.returnPath.transfer + (TwoColorIncidenceGraph + G + sigma + available.gamma + available.delta) + returnEdgeTransfer; + ∀ + z ∈ + sigmaReturnPath.support, + z ∈ + TwoColorComponent + G + sigma + available.gamma + available.delta + (Sum.inr + available.edge)) → + ∀ + (hsigmaPathOnCycle : + ∀ + z ∈ + sigmaReturnPath.support, + z ∈ + replacementCycle.walk.support), + let + replacementCertificate : + RevisitingExtensionCertificate + corr.replacementSeries.data + replacementLast := + { + earlier := + earlierPrefix, + earlierPositive := + hearlierPositive, + earlierAtMost := + Nat.le_of_lt_succ + earlierPrefix.isLt, + earlierPE := + hreplacementEarlierKind, + interveningRevisiting := + helper_interveningRevisiting_4368 + G + k + e0 + input + T + generating + ett + hpositive + sigma + Tstar + hqCast + available + hroundLarge + originalPrefix + hr + hprefixData + corr + earlierPrefixBound + hearlierMap + oldi + oldChoice + oldGamma + newi + newChoice + newGamma + htree + holdColorCast + holdColorNe + hnewColorNe + hidentifiedDelta + hidentifiedGamma + holdDeltaAvailable + holdGammaAvailable + hreplacementLastMap + hgammaDeltaNe + replacementCycle + hreturnCycle + outsideIndicesNonempty + firstOutsideNotOne + firstOutsideAtLeastTwo + firstCrossingIndex + beforeFirstCrossingIndex + laterInsideNonempty + hreturnNotNext + hreturnGap + returnCrossingIndex + beforeReturnCrossingIndex, + gamma := + available.gamma, + delta := + available.delta, + earlierGamma := + Eq.mpr + (id + (congrArg + (fun + (_a : + Fin + (originalPrefix.rounds + + 1)) ↦ + corr.replacementSeries.data.gamma + _a = + some + available.gamma) + (Eq.symm + hnewIndex))) + (Eq.mpr + (id + (congrArg + (fun + (_a : + Option + (Fin + k)) ↦ + _a = + some + available.gamma) + newCurrentGamma)) + (Eq.mpr + (id + (congrArg + (fun + (_a : + Fin + k) ↦ + some + _a = + some + available.gamma) + hnewGammaAvailable)) + (Eq.refl + (some + available.gamma)))), + earlierDelta := + Eq.mpr + (id + (congrArg + (fun + (_a : + Fin + (originalPrefix.rounds + + 1)) ↦ + corr.replacementSeries.data.delta + _a = + some + available.delta) + (Eq.symm + hnewIndex))) + (Eq.mpr + (id + (congrArg + (fun + (_a : + Option + (Fin + k)) ↦ + _a = + some + available.delta) + newCurrentDelta)) + (Eq.mpr + (id + (congrArg + (fun + (_a : + Fin + k) ↦ + some + _a = + some + available.delta) + hnewDeltaAvailable)) + (Eq.refl + (some + available.delta)))), + cycle := + replacementCycleForPrefix, + meetsEarlier := + Exists.intro + available.returnVertex + (⟨hreturnInNewEarlier, + (castCycleSupport + (corr.replacementSeries.data.coloring + replacementLast) + sigma + hreplacementColor + replacementCycle + (Sum.inl + available.returnVertex)).mpr + hreturnCycle⟩ : + available.returnVertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree + earlierPrefix.castSucc) ∧ + Sum.inl + available.returnVertex ∈ + replacementCycleForPrefix.walk.support), + leavesCurrent := + helper_leavesCurrent_4395 + G + k + e0 + input + T + generating + ett + hpositive + sigma + Tstar + available + hroundLarge + originalPrefix + corr + replacementCycle + hreplacementCurrentTree + havailableCurrentTree + houtsideCycle + hreplacementColor + castCycleSupport, + edge := + available.edge, + edgeOnCycle := + (castCycleSupport + (corr.replacementSeries.data.coloring + replacementLast) + sigma + hreplacementColor + replacementCycle + (Sum.inr + available.edge)).mpr + ((hcycleFull + (Sum.inr + available.edge)).mpr + rfl), + edgeBoundary := + Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.edge ∈ + BoundaryEdges + G + (TreeSequenceVertexSet + _a)) + hreplacementCurrentTree)) + (Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.edge ∈ + BoundaryEdges + G + (TreeSequenceVertexSet + _a)) + (Eq.symm + havailableCurrentTree))) + available.edgeBoundary), + insideEndpoint := + available.insideEndpoint, + outsideEndpoint := + available.outsideEndpoint, + insideInCurrent := + Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.insideEndpoint ∈ + TreeSequenceVertexSet + _a) + hreplacementCurrentTree)) + (Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.insideEndpoint ∈ + TreeSequenceVertexSet + _a) + (Eq.symm + havailableCurrentTree))) + available.insideInCurrent), + outsideNotCurrent := + Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.outsideEndpoint ∉ + TreeSequenceVertexSet + _a) + hreplacementCurrentTree)) + (Eq.mpr + (id + (congrArg + (fun + (_a : + TreeSequence + G + e0) ↦ + available.outsideEndpoint ∉ + TreeSequenceVertexSet + _a) + (Eq.symm + havailableCurrentTree))) + available.outsideNotCurrent), + edgeEnds := + available.edgeEnds, + returnVertex := + available.returnVertex, + returnInEarlier := + hreturnInNewEarlier, + returnPath := + replacementReturnPath, + returnPathIsPath := + castReturnWalkIsPath + (corr.replacementSeries.data.coloring + replacementLast) + sigma + hreplacementColor + sigmaReturnPath + hsigmaReturnIsPath, + returnPathOnCycle := + helper_returnPathOnCycle_4421 + G + k + e0 + input + T + generating + ett + hpositive + sigma + Tstar + available + hroundLarge + originalPrefix + corr + returnEdgeTransfer + replacementCycle + hreplacementColor + castReturnWalkSupport + castCycleSupport + hsigmaPathOnCycle, + returnPathInternal := + helper_returnPathInternal_4428 + G + k + e0 + input + T + generating + ett + hpositive + sigma + Tstar + available + hroundLarge + originalPrefix + corr + returnEdgeTransfer + hsigmaReturnSupport + hreplacementCurrentTree + havailableCurrentTree + hreplacementColor + castReturnWalkSupport : + RevisitingExtensionCertificate + corr.replacementSeries.data + replacementLast }; + fstar = + available.edge → + let + newStored : + Finset + (Fin + k) := + { + available.delta, + available.gamma }; + let + newEdges : + Finset + E := + { + available.edge }; + let + newKind : + Option + TashkinovExtensionKind := + some + TashkinovExtensionKind.RE; + let + newVertex : + Option + V := + some + available.insideEndpoint; + let + newOutside : + Option + V := + some + available.outsideEndpoint; + let + newDelta : + Option + (Fin + k) := + some + available.delta; + let + newGamma_1 : + Option + (Fin + k) := + some + available.gamma; + let + appendedData : + TashkinovSeriesData + G + k + (originalPrefix.rounds + + 1) + e0 := + TashkinovSeriesDataAppend + corr.replacementSeries.data + closureTree + sigma + newStored + newEdges + newKind + newVertex + newOutside + newDelta + newGamma_1; + ∀ + (appendedCertificate : + RevisitingExtensionCertificate + (TashkinovSeriesDataAppend + corr.replacementSeries.data + closureTree + sigma + newStored + newEdges + newKind + newVertex + newOutside + newDelta + newGamma_1) + replacementLast.castSucc), + appendedCertificate.gamma = + replacementCertificate.gamma → + appendedCertificate.delta = + replacementCertificate.delta → + appendedCertificate.edge = + replacementCertificate.edge → + appendedCertificate.insideEndpoint = + replacementCertificate.insideEndpoint → + appendedCertificate.outsideEndpoint = + replacementCertificate.outsideEndpoint → + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc).length < + closureTree.length → + TashkinovSeriesStep + G + k + (originalPrefix.rounds + + 1) + e0 + corr.replacementInput + appendedData + (Fin.last + (originalPrefix.rounds + + 1)) → + ∀ + (extendedSeries : + TashkinovSeries + G + k + (originalPrefix.rounds + + 1) + e0 + corr.replacementInput), + extendedSeries.data = + TashkinovSeriesDataAppend + corr.replacementSeries.data + closureTree + sigma + newStored + newEdges + newKind + newVertex + newOutside + newDelta + newGamma_1 → + ∀ + (hroundsEq : + originalPrefix.rounds + + 1 = + ett.rounds), + let + castSeries : + {a + b : + ℕ} → + a = + b → + TashkinovSeries + G + k + a + e0 + corr.replacementInput → + TashkinovSeries + G + k + b + e0 + corr.replacementInput := + fun + {a + b : + ℕ} + (h : + a = + b) + (S : + TashkinovSeries + G + k + a + e0 + corr.replacementInput) ↦ + h ▸ + S; + ( + ∀ + {a + b : + ℕ} + (h : + a = + b) + (S : + TashkinovSeries + G + k + a + e0 + corr.replacementInput) + (i : + Fin + (b + + 2)), + (castSeries + h + S).data.tree + i = + S.data.tree + (Fin.cast + (congrArg + (fun + (m : + ℕ) ↦ + m + + 2) + (Eq.symm + h)) + i)) → + ( + ∀ + {a + b : + ℕ} + (h : + a = + b) + (S : + TashkinovSeries + G + k + a + e0 + corr.replacementInput) + (i : + Fin + (b + + 1)), + (castSeries + h + S).data.coloring + i = + S.data.coloring + (Fin.cast + (congrArg + (fun + (m : + ℕ) ↦ + m + + 1) + (Eq.symm + h)) + i)) → + ( + ∀ + {a + b : + ℕ} + (h : + a = + b) + (S : + TashkinovSeries + G + k + a + e0 + corr.replacementInput) + (i : + Fin + (b + + 1)), + (castSeries + h + S).data.stored + i = + S.data.stored + (Fin.cast + (congrArg + (fun + (m : + ℕ) ↦ + m + + 1) + (Eq.symm + h)) + i)) → + ( + ∀ + {a + b : + ℕ} + (h : + a = + b) + (S : + TashkinovSeries + G + k + a + e0 + corr.replacementInput) + (i : + Fin + (b + + 1)), + (castSeries + h + S).data.connectingEdges + i = + S.data.connectingEdges + (Fin.cast + (congrArg + (fun + (m : + ℕ) ↦ + m + + 1) + (Eq.symm + h)) + i)) → + ( + ∀ + {a + b : + ℕ} + (h : + a = + b) + (S : + TashkinovSeries + G + k + a + e0 + corr.replacementInput) + (i : + Fin + (b + + 1)), + (castSeries + h + S).data.kind + i = + S.data.kind + (Fin.cast + (congrArg + (fun + (m : + ℕ) ↦ + m + + 1) + (Eq.symm + h)) + i)) → + let + finalSeries : + TashkinovSeries + G + k + ett.rounds + e0 + corr.replacementInput := + castSeries + hroundsEq + extendedSeries; + let + rawPenultimate : + Fin + (originalPrefix.rounds + + 3) := + Fin.cast + (congrArg + (fun + (m : + ℕ) ↦ + m + + 2) + (Eq.symm + hroundsEq)) + (⟨ett.rounds, + Decidable.byContradiction + fun + (a : + ¬ett.rounds < + ett.rounds + + 2) ↦ + (by + omega)⟩ : + Fin + (ett.rounds + + 2)); + rawPenultimate = + replacementLast.succ.castSucc → + finalSeries.data.tree + (⟨ett.rounds, + Decidable.byContradiction + fun + (a : + ¬ett.rounds < + ett.rounds + + 2) ↦ + (by + omega)⟩ : + Fin + (ett.rounds + + 2)) = + ett.series.data.tree + (Fin.last + ett.rounds).castSucc → + let + rawFinalTree : + Fin + (originalPrefix.rounds + + 3) := + Fin.cast + (congrArg + (fun + (m : + ℕ) ↦ + m + + 2) + (Eq.symm + hroundsEq)) + (Fin.last + (ett.rounds + + 1)); + rawFinalTree = + Fin.last + (originalPrefix.rounds + + 2) → + ((fun + {a + b : + ℕ} + (h : + a = + b) + (S : + TashkinovSeries + G + k + a + e0 + corr.replacementInput) ↦ + h ▸ + S) + hroundsEq + extendedSeries).data.tree + (Fin.last + (ett.rounds + + 1)) = + closureTree → + let + rawFinalColor : + Fin + (originalPrefix.rounds + + 2) := + Fin.cast + (congrArg + (fun + (m : + ℕ) ↦ + m + + 1) + (Eq.symm + hroundsEq)) + (Fin.last + ett.rounds); + rawFinalColor = + Fin.last + (originalPrefix.rounds + + 1) → + ((fun + {a + b : + ℕ} + (h : + a = + b) + (S : + TashkinovSeries + G + k + a + e0 + corr.replacementInput) ↦ + h ▸ + S) + hroundsEq + extendedSeries).data.coloring + (Fin.last + ett.rounds) = + sigma → + let + rawDataIndex : + Fin + (ett.rounds + + 1) → + Fin + (originalPrefix.rounds + + 2) := + fun + (i : + Fin + (ett.rounds + + 1)) ↦ + Fin.cast + (congrArg + (fun + (m : + ℕ) ↦ + m + + 1) + (Eq.symm + hroundsEq)) + i; + ( + ∀ + (i : + Fin + (ett.rounds + + 1)), + finalSeries.data.stored + i = + ett.series.data.stored + i ∧ + finalSeries.data.connectingEdges + i = + ett.series.data.connectingEdges + i ∧ + finalSeries.data.kind + i = + ett.series.data.kind + i) → + let + rawTreeIndex : + Fin + (ett.rounds + + 2) → + Fin + (originalPrefix.rounds + + 3) := + fun + (i : + Fin + (ett.rounds + + 2)) ↦ + Fin.cast + (congrArg + (fun + (m : + ℕ) ↦ + m + + 2) + (Eq.symm + hroundsEq)) + i; + Nonempty + (CorrespondingExtendedTashkinovTree + G + k + e0 + ett + sigma + Tstar) + +open scoped Sym2 + +theorem helper_lastStep_6001.{u_1, u_2} : + terminalLastStepStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne _ fstar + seed hadjoin closureTree hseedClosure hTnClosure q hqSucc hqCast adjoined previousProper + previousOneUncolored previousClosed available hroundLarge originalPrefix hr hprefixData corr + hcorrFinalTree earlierPrefixBound earlierPrefix hearlierMap hearlierPositive + hreplacementEarlierKind oldi oldChoice oldGamma holdTarget newi newChoice _ newCurrentDelta + newCurrentGamma hnewIndex htree oldChoiceOnNew holdColorCast hends holdColorNe hnewColorNe + hidentifiedDelta hidentifiedGamma holdDeltaAvailable holdGammaAvailable hnewDeltaAvailable + hnewGammaAvailable replacementLast hreplacementLastMap hgammaDeltaNe hsigmaPrevStableQ + sigmaReturnGraph returnEdgeTransfer sigmaReturnPath hsigmaReturnIsPath hsigmaReturnSupport + hreturnInNewEarlier replacementCycle hcycleFull hclosedFinal hreplacementCurrentTree + havailableCurrentTree currentTree hreturnCycle houtsideCycle rootedCycle outsideIndices + outsideIndicesNonempty firstOutside firstOutsideNotOne firstOutsideAtLeastTwo + firstCrossingIndex beforeFirstCrossingIndex laterInsideIndices laterInsideNonempty firstReturn + hreturnNotNext hreturnGap returnCrossingIndex beforeReturnCrossingIndex hnotStrongSigma + hreplacementColor castReturnWalk castReturnWalkIsPath castReturnWalkSupport castCycle + castCycleSupport replacementCycleForPrefix replacementReturnPath hsigmaPathOnCycle + replacementCertificate hfstar newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData appendedCertificate happGamma happDelta happEdge happInside happOutside + hstrictClosure + have hlast : replacementLast.succ = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [replacementLast] + have hclosedReplacement : ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet + (corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1)))) := by + rw [hcorrFinalTree] + exact hclosedFinal + rw [← hlast] + apply TashkinovSeriesStep.RE (i := replacementLast) + (available := appendedCertificate) (adjoined := seed) + · simpa [appendedData, TashkinovSeriesDataAppend, + hlast, replacementLast, hreplacementColor] using hsigmaProper + · simpa [appendedData, TashkinovSeriesDataAppend, + hlast, replacementLast, hreplacementColor] using hsigmaOne + · simp only [TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + rw [hreplacementColor, hlast] + intro f c v hf hv hsf hcm + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have htreeEq : TreeSequenceVertexSet + (corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1))) = + TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + rw [hcorrFinalTree, hqSucc] + have hxOld : x ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + rw [← htreeEq] + exact hx + have hyOld : y ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + rw [← htreeEq] + exact hy + have hfOld : f ∈ BoundaryEdges G + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) := by + simp only [BoundaryEdges, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨x, hxOld, y, hyOld, hends⟩ + have hvOld : v ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + rw [← htreeEq] + exact hv + have hxf : Incident G x f := by + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + have hmissingEq := hsigmaPrevStableQ.2 v hvOld + have hcTree : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hvOld, hmissingEq ▸ hcm⟩ + have hcriterion := (sc1 G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma + previousProper previousOneUncolored hsigmaProper + hsigmaOne).mp hsigmaPrevStableQ + have hcopy := hcriterion f ⟨x, hxOld, hxf⟩ + (Or.inr ⟨c, Finset.mem_union_left _ hcTree, hsf⟩) + have holdf : ett.series.data.coloring q.castSucc f = + some c := hcopy.symm.trans hsf + have hnotOld := previousClosed hfOld hvOld holdf + exact hnotOld (hmissingEq ▸ hcm) + · simpa [appendedData, TashkinovSeriesDataAppend, + hlast, replacementLast, hreplacementColor, + hcorrFinalTree, currentTree, hqSucc] using + hnotStrongSigma + · simp [TashkinovSeriesDataAppend, + hlast, replacementLast, hreplacementColor] + · simp [TashkinovSeriesDataAppend, newStored, + hlast, replacementCertificate, happDelta, happGamma] + · simp [TashkinovSeriesDataAppend, newEdges, + hlast, replacementCertificate, happEdge] + · simp [TashkinovSeriesDataAppend, hlast, newKind] + · simp [TashkinovSeriesDataAppend, newVertex, + hlast, replacementCertificate, happInside] + · simp [TashkinovSeriesDataAppend, newOutside, + hlast, replacementCertificate, happOutside] + · simp [TashkinovSeriesDataAppend, newDelta, + hlast, replacementCertificate, happDelta] + · simp [TashkinovSeriesDataAppend, newGamma, + hlast, replacementCertificate, happGamma] + · simpa [appendedData, TashkinovSeriesDataAppend, + hlast, replacementLast, hcorrFinalTree, hfstar, + replacementCertificate, happEdge] using hadjoin + · simpa [appendedData, TashkinovSeriesDataAppend, hlast] using + hseedClosure + · simpa [appendedData, TashkinovSeriesDataAppend, + hlast, replacementLast, hcorrFinalTree] using hTnClosure + · simpa [appendedData, TashkinovSeriesDataAppend, + hlast, replacementLast, hcorrFinalTree] using + hstrictClosure + +theorem helper_hfinalPenultimateTree_6172.{u_1, u_2} : + penultimateTreeStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqCast + available hroundLarge originalPrefix hr hprefixData corr earlierPrefixBound earlierPrefix + hearlierMap hearlierPositive hreplacementEarlierKind oldi oldChoice oldGamma holdTarget newi + newChoice _ newCurrentDelta newCurrentGamma hnewIndex htree oldChoiceOnNew holdColorCast + holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma holdDeltaAvailable + holdGammaAvailable hnewDeltaAvailable hnewGammaAvailable replacementLast hreplacementLastMap + hgammaDeltaNe sigmaReturnGraph returnEdgeTransfer sigmaReturnPath hsigmaReturnIsPath + hsigmaReturnSupport hreturnInNewEarlier replacementCycle hcycleFull hreplacementCurrentTree + havailableCurrentTree currentTree hreturnCycle houtsideCycle rootedCycle outsideIndices + outsideIndicesNonempty firstOutside firstOutsideNotOne firstOutsideAtLeastTwo + firstCrossingIndex beforeFirstCrossingIndex laterInsideIndices laterInsideNonempty firstReturn + hreturnNotNext hreturnGap returnCrossingIndex beforeReturnCrossingIndex hreplacementColor + castReturnWalk castReturnWalkIsPath castReturnWalkSupport castCycle castCycleSupport + hsigmaPathOnCycle newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData appendedCertificate extendedSeries hextendedData hroundsEq castSeries + castSeriesTree finalSeries rawPenultimate hrawPenultimate + calc + finalSeries.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + extendedSeries.data.tree rawPenultimate := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree rawPenultimate := by + rw [hextendedData] + _ = corr.replacementSeries.data.tree + replacementLast.succ := by + rw [hrawPenultimate] + simp only [appendedData, + TashkinovSeriesDataAppend] + exact Fin.lastCases_castSucc replacementLast.succ + _ = ett.series.data.tree + (Fin.last ett.rounds).castSucc := + hreplacementCurrentTree + +theorem helper_hseriesDataAgree_6220.{u_1, u_2} : + storedDataAgreementStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc hqCast + available currentStored currentEdges currentKind hroundLarge originalPrefix hr hprefixData + corr earlierPrefixBound earlierPrefix hearlierMap hearlierPositive hreplacementEarlierKind + oldi oldChoice oldGamma holdTarget newi newChoice _ newCurrentDelta newCurrentGamma hnewIndex + htree oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable hnewDeltaAvailable hnewGammaAvailable replacementLast + hreplacementLastMap hgammaDeltaNe sigmaReturnGraph returnEdgeTransfer sigmaReturnPath + hsigmaReturnIsPath hsigmaReturnSupport hreturnInNewEarlier replacementCycle hcycleFull + hreplacementCurrentTree havailableCurrentTree currentTree hreturnCycle houtsideCycle + rootedCycle outsideIndices outsideIndicesNonempty firstOutside firstOutsideNotOne + firstOutsideAtLeastTwo firstCrossingIndex beforeFirstCrossingIndex laterInsideIndices + laterInsideNonempty firstReturn hreturnNotNext hreturnGap returnCrossingIndex + beforeReturnCrossingIndex hreplacementColor castReturnWalk castReturnWalkIsPath + castReturnWalkSupport castCycle castCycleSupport hsigmaPathOnCycle newStored newEdges newKind + newVertex newOutside newDelta newGamma appendedData appendedCertificate extendedSeries + hextendedData hroundsEq castSeries castSeriesStored castSeriesEdges castSeriesKind finalSeries + rawDataIndex i + by_cases hi : i.val < ett.rounds + · let j : Fin (originalPrefix.rounds + 1) := + ⟨i.val, by rw [hroundsEq]; exact hi⟩ + have hraw : rawDataIndex i = j.castSucc := by + apply Fin.ext + rfl + have hmap : Fin.castLE (by omega) j = i := by + apply Fin.ext + rfl + constructor + · calc + finalSeries.data.stored i = + extendedSeries.data.stored (rawDataIndex i) := by + exact castSeriesStored hroundsEq extendedSeries i + _ = appendedData.stored (rawDataIndex i) := by + rw [hextendedData] + _ = corr.replacementSeries.data.stored j := by + rw [hraw] + simp [appendedData, TashkinovSeriesDataAppend] + _ = originalPrefix.series.data.stored j := + corr.storedColorsAgree j + _ = ett.series.data.stored (Fin.castLE (by omega) j) := + (hprefixData j).2.1 + _ = ett.series.data.stored i := by rw [hmap] + · constructor + · calc + finalSeries.data.connectingEdges i = + extendedSeries.data.connectingEdges + (rawDataIndex i) := by + exact castSeriesEdges hroundsEq + extendedSeries i + _ = appendedData.connectingEdges + (rawDataIndex i) := by rw [hextendedData] + _ = corr.replacementSeries.data.connectingEdges j := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = originalPrefix.series.data.connectingEdges j := + corr.connectingEdgesAgree j + _ = ett.series.data.connectingEdges + (Fin.castLE (by omega) j) := + (hprefixData j).2.2.1 + _ = ett.series.data.connectingEdges i := by rw [hmap] + · calc + finalSeries.data.kind i = + extendedSeries.data.kind (rawDataIndex i) := by + exact castSeriesKind hroundsEq extendedSeries i + _ = appendedData.kind (rawDataIndex i) := by + rw [hextendedData] + _ = corr.replacementSeries.data.kind j := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = originalPrefix.series.data.kind j := + corr.extensionKindsAgree j + _ = ett.series.data.kind + (Fin.castLE (by omega) j) := + (hprefixData j).2.2.2.1 + _ = ett.series.data.kind i := by rw [hmap] + · have hilast : i = Fin.last ett.rounds := by + apply Fin.ext + simp + omega + subst i + have hraw : rawDataIndex (Fin.last ett.rounds) = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [rawDataIndex] + constructor + · calc + finalSeries.data.stored (Fin.last ett.rounds) = + extendedSeries.data.stored + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesStored hroundsEq extendedSeries _ + _ = appendedData.stored + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = newStored := by + rw [hraw] + simp [appendedData, TashkinovSeriesDataAppend] + _ = {available.delta, available.gamma} := rfl + _ = ett.series.data.stored (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentStored.symm + · constructor + · calc + finalSeries.data.connectingEdges + (Fin.last ett.rounds) = + extendedSeries.data.connectingEdges + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesEdges hroundsEq + extendedSeries _ + _ = appendedData.connectingEdges + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = newEdges := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = {available.edge} := rfl + _ = ett.series.data.connectingEdges + (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentEdges.symm + · calc + finalSeries.data.kind (Fin.last ett.rounds) = + extendedSeries.data.kind + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesKind hroundsEq extendedSeries _ + _ = appendedData.kind + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = newKind := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = some TashkinovExtensionKind.RE := rfl + _ = ett.series.data.kind + (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentKind.symm + +theorem helper_hseriesTreeAgree_6351.{u_1, u_2} : + treeAgreementStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqCast + available hroundLarge originalPrefix hr hprefixTrees hprefixData corr earlierPrefixBound + earlierPrefix hearlierMap hearlierPositive hreplacementEarlierKind oldi oldChoice oldGamma + holdTarget newi newChoice _ newCurrentDelta newCurrentGamma hnewIndex htree oldChoiceOnNew + holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma holdDeltaAvailable + holdGammaAvailable hnewDeltaAvailable hnewGammaAvailable replacementLast hreplacementLastMap + hgammaDeltaNe sigmaReturnGraph returnEdgeTransfer sigmaReturnPath hsigmaReturnIsPath + hsigmaReturnSupport hreturnInNewEarlier replacementCycle hcycleFull hreplacementCurrentTree + havailableCurrentTree currentTree hreturnCycle houtsideCycle rootedCycle outsideIndices + outsideIndicesNonempty firstOutside firstOutsideNotOne firstOutsideAtLeastTwo + firstCrossingIndex beforeFirstCrossingIndex laterInsideIndices laterInsideNonempty firstReturn + hreturnNotNext hreturnGap returnCrossingIndex beforeReturnCrossingIndex hreplacementColor + castReturnWalk castReturnWalkIsPath castReturnWalkSupport castCycle castCycleSupport + hsigmaPathOnCycle newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData appendedCertificate extendedSeries hextendedData hroundsEq castSeries + castSeriesTree finalSeries hfinalPenultimateTree rawTreeIndex i + by_cases hi : i.val < originalPrefix.rounds + · let j : Fin originalPrefix.rounds := ⟨i.val, hi⟩ + have hraw : rawTreeIndex i.succ.castSucc = + j.succ.castSucc.castSucc := by + apply Fin.ext + rfl + have hmap : Fin.castLE (by omega) j.succ.castSucc = + i.succ.castSucc := by + apply Fin.ext + rfl + calc + finalSeries.data.tree i.succ.castSucc = + extendedSeries.data.tree + (rawTreeIndex i.succ.castSucc) := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree + (rawTreeIndex i.succ.castSucc) := by + rw [hextendedData] + _ = corr.replacementSeries.data.tree + j.succ.castSucc := by + rw [hraw] + simp only [appendedData, + TashkinovSeriesDataAppend] + convert (Fin.lastCases_castSucc + j.succ.castSucc) using 1; + + _ = originalPrefix.series.data.tree + j.succ.castSucc := corr.ladderTreesAgree j + _ = ett.series.data.tree + (Fin.castLE (by omega) j.succ.castSucc) := + hprefixTrees j.succ.castSucc + _ = ett.series.data.tree i.succ.castSucc := by rw [hmap] + · let ilast : Fin ett.rounds := + ⟨ett.rounds - 1, by omega⟩ + have hilast : i = ilast := by + apply Fin.ext + have hiBound := i.isLt + have hprefixRounds := hr + simp [ilast] + omega + rw [hilast] + have hindex : + ilast.succ.castSucc = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + simp [ilast] + omega + rw [hindex] + exact hfinalPenultimateTree + +theorem helper_hseriesColorProperties_6404.{u_1, u_2} : + coloringPropertiesStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne _ + closureTree q hqCast available hroundLarge originalPrefix hr hprefixData corr + earlierPrefixBound earlierPrefix hearlierMap hearlierPositive hreplacementEarlierKind oldi + oldChoice oldGamma holdTarget newi newChoice _ newCurrentDelta newCurrentGamma hnewIndex htree + oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable hnewDeltaAvailable hnewGammaAvailable replacementLast + hreplacementLastMap hgammaDeltaNe sigmaReturnGraph returnEdgeTransfer sigmaReturnPath + hsigmaReturnIsPath hsigmaReturnSupport hreturnInNewEarlier replacementCycle hcycleFull + hreplacementCurrentTree havailableCurrentTree currentTree hreturnCycle houtsideCycle + rootedCycle outsideIndices outsideIndicesNonempty firstOutside firstOutsideNotOne + firstOutsideAtLeastTwo firstCrossingIndex beforeFirstCrossingIndex laterInsideIndices + laterInsideNonempty firstReturn hreturnNotNext hreturnGap returnCrossingIndex + beforeReturnCrossingIndex hreplacementColor castReturnWalk castReturnWalkIsPath + castReturnWalkSupport castCycle castCycleSupport hsigmaPathOnCycle newStored newEdges newKind + newVertex newOutside newDelta newGamma appendedData appendedCertificate extendedSeries + hextendedData hroundsEq castSeries castSeriesColoring finalSeries hfinalColor rawDataIndex i + by_cases hi : i.val < ett.rounds + · let j : Fin (originalPrefix.rounds + 1) := + ⟨i.val, by rw [hroundsEq]; exact hi⟩ + have hraw : rawDataIndex i = j.castSucc := by + apply Fin.ext + rfl + have hcolor : finalSeries.data.coloring i = + corr.replacementSeries.data.coloring j := by + calc + finalSeries.data.coloring i = + extendedSeries.data.coloring (rawDataIndex i) := by + exact castSeriesColoring hroundsEq + extendedSeries i + _ = appendedData.coloring (rawDataIndex i) := by + rw [hextendedData] + _ = corr.replacementSeries.data.coloring j := by + rw [hraw] + simp [appendedData, TashkinovSeriesDataAppend] + rw [hcolor] + exact ⟨corr.replacementProper j, + corr.replacementOneUncolored j⟩ + · have hilast : i = Fin.last ett.rounds := by + apply Fin.ext + simp + have hiBound := i.isLt + omega + rw [hilast, hfinalColor] + exact ⟨hsigmaProper, hsigmaOne⟩ + +theorem helper_hseriesStable_6436.{u_1, u_2} : + coloringStabilityStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma hsigmaStable _ closureTree q + hqCast available hroundLarge originalPrefix hr hprefixTrees hprefixData corr + earlierPrefixBound earlierPrefix hearlierMap hearlierPositive hreplacementEarlierKind oldi + oldChoice oldGamma holdTarget newi newChoice _ newCurrentDelta newCurrentGamma hnewIndex htree + oldChoiceOnNew holdColorCast holdColorNe hnewColorNe hidentifiedDelta hidentifiedGamma + holdDeltaAvailable holdGammaAvailable hnewDeltaAvailable hnewGammaAvailable replacementLast + hreplacementLastMap hgammaDeltaNe sigmaReturnGraph returnEdgeTransfer sigmaReturnPath + hsigmaReturnIsPath hsigmaReturnSupport hreturnInNewEarlier replacementCycle hcycleFull + hreplacementCurrentTree havailableCurrentTree currentTree hreturnCycle houtsideCycle + rootedCycle outsideIndices outsideIndicesNonempty firstOutside firstOutsideNotOne + firstOutsideAtLeastTwo firstCrossingIndex beforeFirstCrossingIndex laterInsideIndices + laterInsideNonempty firstReturn hreturnNotNext hreturnGap returnCrossingIndex + beforeReturnCrossingIndex hreplacementColor castReturnWalk castReturnWalkIsPath + castReturnWalkSupport castCycle castCycleSupport hsigmaPathOnCycle newStored newEdges newKind + newVertex newOutside newDelta newGamma appendedData appendedCertificate extendedSeries + hextendedData hroundsEq castSeries castSeriesColoring finalSeries hfinalColor rawDataIndex i + by_cases hi : i.val < originalPrefix.rounds + · let j : Fin originalPrefix.rounds := ⟨i.val, hi⟩ + have hmap : Fin.castLE (by omega) j.succ = i.succ := by + apply Fin.ext + rfl + have htreeMap : Fin.castLE (by omega) + j.succ.castSucc = i.succ.castSucc := by + apply Fin.ext + rfl + have htreeEq : originalPrefix.series.data.tree + j.succ.castSucc = + ett.series.data.tree i.succ.castSucc := by + calc + originalPrefix.series.data.tree j.succ.castSucc = + ett.series.data.tree + (Fin.castLE (by omega) j.succ.castSucc) := + hprefixTrees j.succ.castSucc + _ = ett.series.data.tree i.succ.castSucc := by + rw [htreeMap] + have hstoredEq : TashkinovStoredColors + originalPrefix.series.data j.succ = + TashkinovStoredColors ett.series.data i.succ := by + calc + TashkinovStoredColors originalPrefix.series.data + j.succ = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) j.succ) := + (hprefixData j.succ).2.2.2.2 + _ = TashkinovStoredColors ett.series.data i.succ := by + rw [hmap] + have holdColorEq : originalPrefix.series.data.coloring + j.succ = ett.series.data.coloring i.succ := by + calc + originalPrefix.series.data.coloring j.succ = + ett.series.data.coloring + (Fin.castLE (by omega) j.succ) := + (hprefixData j.succ).1 + _ = ett.series.data.coloring i.succ := by rw [hmap] + have hraw : rawDataIndex i.succ = + j.succ.castSucc := by + apply Fin.ext + rfl + have hnewColorEq : finalSeries.data.coloring i.succ = + corr.replacementSeries.data.coloring j.succ := by + calc + finalSeries.data.coloring i.succ = + extendedSeries.data.coloring + (rawDataIndex i.succ) := by + exact castSeriesColoring hroundsEq + extendedSeries i.succ + _ = appendedData.coloring + (rawDataIndex i.succ) := by rw [hextendedData] + _ = corr.replacementSeries.data.coloring j.succ := by + rw [hraw] + simp only [appendedData, + TashkinovSeriesDataAppend] + exact Fin.lastCases_castSucc j.succ + have hstable := corr.replacementStable j + rw [htreeEq, hstoredEq, holdColorEq] at hstable + rw [hnewColorEq] + exact hstable + · let ilast : Fin ett.rounds := + ⟨ett.rounds - 1, by omega⟩ + have hilast : i = ilast := by + apply Fin.ext + have hiBound := i.isLt + have hprefixRounds := hr + simp [ilast] + omega + have hindex : ilast.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [ilast] + omega + rw [hilast, hindex, hfinalColor] + exact hsigmaStable + +private theorem revisitingSeriesAgreement.{u_1, u_2} : revisitingSeriesAgreementStatement.{u_1, u_2} + := by + classical + intro «V» «E» «inst» «inst_1» «inst_2» «inst_3» «G» «k» «e0» «input» «T» «generating» «ett» + «hpositive» «hlower» «sigma» «hsigmaProper» «hsigmaOne» «hsigmaStable» «Tstar» «hTnTstar» + «hstrict» «fstar» «seed» «hfinalEdges» «hadjoin» «closureTree» «hseedClosure» «hTstarClosure» + «hTnClosure» «q» «hqSucc» «hqCast» «adjoined» «previousProper» «previousOneUncolored» + «previousClosed» «available» «currentStored» «currentEdges» «currentKind» «hroundLarge» + «originalPrefix» «hr» «hprefixTrees» «hprefixData» «corr» «hcorrFinalTree» «hcorrFinalColor» + «hcorrMP» «earlierPrefixBound» «earlierPrefix» «hearlierMap» «hearlierPositive» + «hreplacementEarlierKind» «oldi» «oldChoice» «oldGamma» «holdTarget» «newi» «newChoice» + «newGamma» «newCurrentDelta» «newCurrentGamma» «hnewIndex» «htree» «oldChoiceOnNew» + «holdColorCast» «hends» «holdColorNe» «hnewColorNe» «hidentifiedDelta» «hidentifiedGamma» + «holdDeltaAvailable» «holdGammaAvailable» «hnewDeltaAvailable» «hnewGammaAvailable» + «replacementLast» «hreplacementLastMap» «hnewDeltaSigma» «hgammaDeltaNe» «hnewVertexTn» + «hpathComponent» «hpathMeetsTn» «hsigmaPrevStableQ» «sigmaReturnGraph» «returnEdgeTransfer» + «sigmaReturnPath» «hsigmaReturnIsPath» «hsigmaReturnSupport» «hreturnInQ» «houtsideInQ» + «hreturnInNewEarlier» «hreturnInTn» «hcomponentDistinct» «hQMeetsTn» «hcorrRoundsPositive» + «hcorrRoundsLess» «correspondingTerminalTree» «hseriesTree» «hlowerColor» «hstableLower» + «hlowerTree» «hdeltaLower» «hlowerPackage» «hinterchangeLower» «hinterchangeTn» + «replacementCycle» «hcycleFull» «hclosedSigma» «hclosedFinal» «hreplacementCurrentTree» + «havailableCurrentIndex» «havailableCurrentTree» «currentTree» «hreturnCycle» «houtsideCycle» + «hreturnCurrent» «houtsideNotCurrent» «rootedCycle» «rootedIsCycle» «houtsideRooted» + «outsideIndices» «outsideIndicesNonempty» «firstOutside» «outsideOne» «houtsideOneAt» + «houtsideOneNot» «beforeFirstOutside» «firstOutsidePositive» «firstOutsideLt» + «firstOutsideNotOne» «firstOutsideAtLeastTwo» «firstCrossingAdj» «firstCrossingIndex» + «firstEdge» «hfirstEdgeAt» «hfirstOutsideIncident» «hfirstEdgeActive» «beforeFirstCrossingAdj» + «beforeFirstCrossingIndex» «insideOne» «hinsideOneAt» «hinsideOneCurrent» «hinsideOneIncident» + «endpointIdentity» «hinsideOutsideOne» «hfirstEnds» «hfirstBoundary» «laterInsideIndices» + «laterInsideNonempty» «firstReturn» «hfirstReturnMem» «hfirstReturnAfter» «insideTwo» + «hinsideTwoAt» «hinsideTwoCurrent» «hreturnNotNext» «hreturnGap» «returnCrossingAdj» + «returnCrossingIndex» «secondEdge» «hsecondEdgeAt» «hinsideTwoIncident» «hsecondEdgeActive» + «beforeReturnCrossingAdj» «beforeReturnCrossingIndex» «outsideTwo» «houtsideTwoAt» + «houtsideTwoNot» «houtsideTwoIncident» «houtsideInsideTwo» «hsecondEnds» «hsecondBoundary» + «hcrossingEdgesNe» «hnewVertexCurrent» «hfirstGamma» «hsecondGamma» «hnotStrongSigma» + «hreplacementColor» «castReturnWalk» «castReturnWalkIsPath» «castReturnWalkSupport» + «castCycle» «castCycleSupport» «replacementCycleForPrefix» «replacementReturnPath» + «hsigmaPathInQ» «hsigmaPathOnCycle» «replacementCertificate» «hfstar» «newStored» «newEdges» + «newKind» «newVertex» «newOutside» «newDelta» «newGamma» «appendedData» «appendedCertificate» + «happGamma» «happDelta» «happEdge» «happInside» «happOutside» «hstrictClosure» «lastStep» + «extendedSeries» «hextendedData» «hroundsEq» «castSeries» «castSeriesTree» + «castSeriesColoring» «castSeriesStored» «castSeriesEdges» «castSeriesKind» «finalSeries» + «rawPenultimate» «hrawPenultimate» «hfinalPenultimateTree» «rawFinalTree» «hrawFinalTree» + «hfinalTree» «rawFinalColor» «hrawFinalColor» «hfinalColor» «rawDataIndex» «hseriesDataAgree» + «rawTreeIndex» + let rawTreeIndex (i : Fin (ett.rounds + 2)) : + Fin (originalPrefix.rounds + 3) := + Fin.cast + (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) i + have hseriesTreeAgree : ∀ i : Fin ett.rounds, + finalSeries.data.tree i.succ.castSucc = + ett.series.data.tree i.succ.castSucc := by + exact @helper_hseriesTreeAgree_6351 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@hqCast) (@available) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixTrees) (@hprefixData) (@corr) (@earlierPrefixBound) (@hearlierMap) + (@hearlierPositive) (@hreplacementEarlierKind) (@oldi) (@oldChoice) (@oldGamma) + (@holdTarget) (@newi) (@newChoice) _ (@newCurrentDelta) (@newCurrentGamma) (@hnewIndex) + (@htree) (@holdColorCast) (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) + (@hidentifiedGamma) (@holdDeltaAvailable) (@holdGammaAvailable) (@hnewDeltaAvailable) + (@hnewGammaAvailable) (@hreplacementLastMap) (@hgammaDeltaNe) (@returnEdgeTransfer) + (@hsigmaReturnIsPath) (@hsigmaReturnSupport) (@hreturnInNewEarlier) (@replacementCycle) + (@hcycleFull) (@hreplacementCurrentTree) (@havailableCurrentTree) (@hreturnCycle) + (@houtsideCycle) (@outsideIndicesNonempty) (@firstOutsideNotOne) (@firstOutsideAtLeastTwo) + (@firstCrossingIndex) (@beforeFirstCrossingIndex) (@laterInsideNonempty) (@hreturnNotNext) + (@hreturnGap) (@returnCrossingIndex) (@beforeReturnCrossingIndex) (@hreplacementColor) + (@castReturnWalkIsPath) (@castReturnWalkSupport) (@castCycleSupport) (@hsigmaPathOnCycle) + (@appendedCertificate) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) + (@hfinalPenultimateTree) + have hseriesColorProperties : ∀ i : Fin (ett.rounds + 1), + IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ + IsOneEdgeUncolored (finalSeries.data.coloring i) e0 := by + exact @helper_hseriesColorProperties_6404 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@hsigmaProper) (@hsigmaOne) (@Tstar) (@closureTree) (@hqCast) (@available) (@hroundLarge) + (@originalPrefix) (@hr) (@hprefixData) (@corr) (@earlierPrefixBound) (@hearlierMap) + (@hearlierPositive) (@hreplacementEarlierKind) (@oldi) (@oldChoice) (@oldGamma) + (@holdTarget) (@newi) (@newChoice) _ (@newCurrentDelta) (@newCurrentGamma) (@hnewIndex) + (@htree) (@holdColorCast) (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) + (@hidentifiedGamma) (@holdDeltaAvailable) (@holdGammaAvailable) (@hnewDeltaAvailable) + (@hnewGammaAvailable) (@hreplacementLastMap) (@hgammaDeltaNe) (@returnEdgeTransfer) + (@hsigmaReturnIsPath) (@hsigmaReturnSupport) (@hreturnInNewEarlier) (@replacementCycle) + (@hcycleFull) (@hreplacementCurrentTree) (@havailableCurrentTree) (@hreturnCycle) + (@houtsideCycle) (@outsideIndicesNonempty) (@firstOutsideNotOne) (@firstOutsideAtLeastTwo) + (@firstCrossingIndex) (@beforeFirstCrossingIndex) (@laterInsideNonempty) (@hreturnNotNext) + (@hreturnGap) (@returnCrossingIndex) (@beforeReturnCrossingIndex) (@hreplacementColor) + (@castReturnWalkIsPath) (@castReturnWalkSupport) (@castCycleSupport) (@hsigmaPathOnCycle) + (@appendedCertificate) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesColoring) + (@hfinalColor) + have hseriesStable : ∀ i : Fin ett.rounds, + StableColoring + (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) + (ett.series.data.coloring i.succ) + (finalSeries.data.coloring i.succ) := by + exact @helper_hseriesStable_6436 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@hsigmaStable) (@Tstar) (@closureTree) (@hqCast) (@available) (@hroundLarge) + (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) (@earlierPrefixBound) + (@hearlierMap) (@hearlierPositive) (@hreplacementEarlierKind) (@oldi) (@oldChoice) + (@oldGamma) (@holdTarget) (@newi) (@newChoice) _ (@newCurrentDelta) (@newCurrentGamma) + (@hnewIndex) (@htree) (@holdColorCast) (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) + (@hidentifiedGamma) (@holdDeltaAvailable) (@holdGammaAvailable) (@hnewDeltaAvailable) + (@hnewGammaAvailable) (@hreplacementLastMap) (@hgammaDeltaNe) (@returnEdgeTransfer) + (@hsigmaReturnIsPath) (@hsigmaReturnSupport) (@hreturnInNewEarlier) (@replacementCycle) + (@hcycleFull) (@hreplacementCurrentTree) (@havailableCurrentTree) (@hreturnCycle) + (@houtsideCycle) (@outsideIndicesNonempty) (@firstOutsideNotOne) (@firstOutsideAtLeastTwo) + (@firstCrossingIndex) (@beforeFirstCrossingIndex) (@laterInsideNonempty) (@hreturnNotNext) + (@hreturnGap) (@returnCrossingIndex) (@beforeReturnCrossingIndex) (@hreplacementColor) + (@castReturnWalkIsPath) (@castReturnWalkSupport) (@castCycleSupport) (@hsigmaPathOnCycle) + (@appendedCertificate) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesColoring) + (@hfinalColor) + let replacementETT : ExtendedTashkinovTree G k e0 + corr.replacementInput Tstar sigma := { + rounds := ett.rounds + roundsPositive := ett.roundsPositive + series := finalSeries + abovePenultimate := by + rw [hfinalPenultimateTree] + exact hTnTstar + strictAbovePenultimate := by + rw [hfinalPenultimateTree] + exact hstrict + belowFinal := by + rw [hfinalTree] + exact hTstarClosure + generatingColoring := hfinalColor.symm + } + refine ⟨{ + replacementInput := corr.replacementInput + replacementSeries := finalSeries + replacementETT := replacementETT + rungAgreement := rfl + seriesPresentation := by dsimp [replacementETT]; rfl + finalGeneratingColoring := hfinalColor.symm + ladderTreesAgree := hseriesTreeAgree + storedColorsAgree := fun i => (hseriesDataAgree i).1 + connectingEdgesAgree := fun i => (hseriesDataAgree i).2.1 + extensionKindsAgree := fun i => (hseriesDataAgree i).2.2 + replacementProper := fun i => + (hseriesColorProperties i).1 + replacementOneUncolored := fun i => + (hseriesColorProperties i).2 + replacementStable := hseriesStable + }⟩ + +private theorem revisitingFinalSeries.{u_1, u_2} : revisitingFinalSeriesStatement.{u_1, u_2} := by + classical + intro V E inst inst_1 inst_2 inst_3 G k e0 input T generating ett hpositive hlower sigma + hsigmaProper hsigmaOne hsigmaStable Tstar hTnTstar hstrict fstar seed hfinalEdges hadjoin + closureTree hseedClosure hTstarClosure hTnClosure q hqSucc hqCast adjoined previousProper + previousOneUncolored previousClosed available currentStored currentEdges currentKind hroundLarge + originalPrefix hr hprefixTrees hprefixData corr hcorrFinalTree hcorrFinalColor hcorrMP + earlierPrefixBound earlierPrefix hearlierMap hearlierPositive hreplacementEarlierKind oldi + oldChoice oldGamma holdTarget newi newChoice newGamma newCurrentDelta newCurrentGamma hnewIndex + htree oldChoiceOnNew holdColorCast hends holdColorNe hnewColorNe hidentifiedDelta + hidentifiedGamma holdDeltaAvailable holdGammaAvailable hnewDeltaAvailable hnewGammaAvailable + replacementLast hreplacementLastMap hnewDeltaSigma hgammaDeltaNe hnewVertexTn hpathComponent + hpathMeetsTn hsigmaPrevStableQ sigmaReturnGraph returnEdgeTransfer sigmaReturnPath + hsigmaReturnIsPath hsigmaReturnSupport hreturnInQ houtsideInQ hreturnInNewEarlier hreturnInTn + hcomponentDistinct hQMeetsTn hcorrRoundsPositive hcorrRoundsLess correspondingTerminalTree + hseriesTree hlowerColor hstableLower hlowerTree hdeltaLower hlowerPackage hinterchangeLower + hinterchangeTn replacementCycle hcycleFull hclosedSigma hclosedFinal hreplacementCurrentTree + havailableCurrentIndex havailableCurrentTree currentTree hreturnCycle houtsideCycle + hreturnCurrent houtsideNotCurrent rootedCycle rootedIsCycle houtsideRooted outsideIndices + outsideIndicesNonempty firstOutside outsideOne houtsideOneAt houtsideOneNot beforeFirstOutside + firstOutsidePositive firstOutsideLt firstOutsideNotOne firstOutsideAtLeastTwo firstCrossingAdj + firstCrossingIndex firstEdge hfirstEdgeAt hfirstOutsideIncident hfirstEdgeActive + beforeFirstCrossingAdj beforeFirstCrossingIndex insideOne hinsideOneAt hinsideOneCurrent + hinsideOneIncident endpointIdentity hinsideOutsideOne hfirstEnds hfirstBoundary + laterInsideIndices laterInsideNonempty firstReturn hfirstReturnMem hfirstReturnAfter insideTwo + hinsideTwoAt hinsideTwoCurrent hreturnNotNext hreturnGap returnCrossingAdj returnCrossingIndex + secondEdge hsecondEdgeAt hinsideTwoIncident hsecondEdgeActive beforeReturnCrossingAdj + beforeReturnCrossingIndex outsideTwo houtsideTwoAt houtsideTwoNot houtsideTwoIncident + houtsideInsideTwo hsecondEnds hsecondBoundary hcrossingEdgesNe hnewVertexCurrent hfirstGamma + hsecondGamma hnotStrongSigma hreplacementColor castReturnWalk castReturnWalkIsPath + castReturnWalkSupport castCycle castCycleSupport replacementCycleForPrefix replacementReturnPath + hsigmaPathInQ hsigmaPathOnCycle replacementCertificate hfstar newStored newEdges newKind + newVertex newOutside newDelta newGamma appendedData appendedCertificate happGamma happDelta + happEdge happInside happOutside hstrictClosure lastStep extendedSeries hextendedData + have hroundsEq : originalPrefix.rounds + 1 = ett.rounds := by + rw [hr] + omega + let castSeries {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) : + TashkinovSeries G k b e0 corr.replacementInput := by + subst b + exact S + have castSeriesTree : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + 2)), + (castSeries h S).data.tree i = + S.data.tree (Fin.cast (congrArg (fun m : ℕ => m + 2) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesColoring : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + 1)), + (castSeries h S).data.coloring i = + S.data.coloring (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesStored : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + 1)), + (castSeries h S).data.stored i = + S.data.stored (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesEdges : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + 1)), + (castSeries h S).data.connectingEdges i = + S.data.connectingEdges (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesKind : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + 1)), + (castSeries h S).data.kind i = + S.data.kind (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := + castSeries hroundsEq extendedSeries + let rawPenultimate : Fin (originalPrefix.rounds + 3) := + Fin.cast (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) + have hrawPenultimate : rawPenultimate = replacementLast.succ.castSucc := by + apply Fin.ext + simp [rawPenultimate, replacementLast] + omega + have hfinalPenultimateTree : + finalSeries.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + exact + @helper_hfinalPenultimateTree_6172 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@hqCast) (@available) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixData) (@corr) (@earlierPrefixBound) (@hearlierMap) (@hearlierPositive) + (@hreplacementEarlierKind) (@oldi) (@oldChoice) (@oldGamma) (@holdTarget) (@newi) + (@newChoice) _ (@newCurrentDelta) (@newCurrentGamma) (@hnewIndex) (@htree) (@holdColorCast) + (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@hnewDeltaAvailable) (@hnewGammaAvailable) (@hreplacementLastMap) + (@hgammaDeltaNe) (@returnEdgeTransfer) (@hsigmaReturnIsPath) (@hsigmaReturnSupport) + (@hreturnInNewEarlier) (@replacementCycle) (@hcycleFull) (@hreplacementCurrentTree) + (@havailableCurrentTree) (@hreturnCycle) (@houtsideCycle) (@outsideIndicesNonempty) + (@firstOutsideNotOne) (@firstOutsideAtLeastTwo) (@firstCrossingIndex) + (@beforeFirstCrossingIndex) (@laterInsideNonempty) (@hreturnNotNext) (@hreturnGap) + (@returnCrossingIndex) (@beforeReturnCrossingIndex) (@hreplacementColor) + (@castReturnWalkIsPath) (@castReturnWalkSupport) (@castCycleSupport) (@hsigmaPathOnCycle) + (@appendedCertificate) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) + (@hrawPenultimate) + let rawFinalTree : Fin (originalPrefix.rounds + 3) := + Fin.cast (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) (Fin.last (ett.rounds + 1)) + have hrawFinalTree : rawFinalTree = Fin.last (originalPrefix.rounds + 2) := by + apply Fin.ext + simp [rawFinalTree] + have hfinalTree := + helper_hfinalTree_2464 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@available) (@originalPrefix) (@corr) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesTree) (@hrawFinalTree) + let rawFinalColor : Fin (originalPrefix.rounds + 2) := + Fin.cast (congrArg (fun m : ℕ => m + 1) hroundsEq.symm) (Fin.last ett.rounds) + have hrawFinalColor : rawFinalColor = Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [rawFinalColor] + have hfinalColor := + helper_hfinalColor_2482 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@available) (@originalPrefix) (@corr) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesColoring) (@hrawFinalColor) + let rawDataIndex (i : Fin (ett.rounds + 1)) : Fin (originalPrefix.rounds + 2) := + Fin.cast (congrArg (fun m : ℕ => m + 1) hroundsEq.symm) i + have hseriesDataAgree : + ∀ i : Fin (ett.rounds + 1), + finalSeries.data.stored i = ett.series.data.stored i ∧ + finalSeries.data.connectingEdges i = ett.series.data.connectingEdges i ∧ + finalSeries.data.kind i = ett.series.data.kind i := by + exact + @helper_hseriesDataAgree_6220 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@hqSucc) (@hqCast) (@available) (@currentStored) (@currentEdges) + (@currentKind) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixData) (@corr) + (@earlierPrefixBound) (@hearlierMap) (@hearlierPositive) (@hreplacementEarlierKind) (@oldi) + (@oldChoice) (@oldGamma) (@holdTarget) (@newi) (@newChoice) _ (@newCurrentDelta) + (@newCurrentGamma) (@hnewIndex) (@htree) (@holdColorCast) (@holdColorNe) (@hnewColorNe) + (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) (@holdGammaAvailable) + (@hnewDeltaAvailable) (@hnewGammaAvailable) (@hreplacementLastMap) (@hgammaDeltaNe) + (@returnEdgeTransfer) (@hsigmaReturnIsPath) (@hsigmaReturnSupport) (@hreturnInNewEarlier) + (@replacementCycle) (@hcycleFull) (@hreplacementCurrentTree) (@havailableCurrentTree) + (@hreturnCycle) (@houtsideCycle) (@outsideIndicesNonempty) (@firstOutsideNotOne) + (@firstOutsideAtLeastTwo) (@firstCrossingIndex) (@beforeFirstCrossingIndex) + (@laterInsideNonempty) (@hreturnNotNext) (@hreturnGap) (@returnCrossingIndex) + (@beforeReturnCrossingIndex) (@hreplacementColor) (@castReturnWalkIsPath) + (@castReturnWalkSupport) (@castCycleSupport) (@hsigmaPathOnCycle) (@appendedCertificate) + (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesStored) (@castSeriesEdges) + (@castSeriesKind) + exact + @revisitingSeriesAgreement (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@hlower) (@sigma) + (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@fstar) (@seed) + (@hfinalEdges) (@hadjoin) (@closureTree) (@hseedClosure) (@hTstarClosure) (@hTnClosure) + (@hqSucc) (@hqCast) (@adjoined) (@previousProper) (@previousOneUncolored) (@previousClosed) + (@available) (@currentStored) (@currentEdges) (@currentKind) (@hroundLarge) (@originalPrefix) + (@hr) (@hprefixTrees) (@hprefixData) (@corr) (@hcorrFinalTree) (@hcorrFinalColor) (@hcorrMP) + (@earlierPrefixBound) (@hearlierMap) (@hearlierPositive) (@hreplacementEarlierKind) (@oldi) + (@oldChoice) (@oldGamma) (@holdTarget) (@newi) (@newChoice) (by assumption) (@newCurrentDelta) + (@newCurrentGamma) (@hnewIndex) (@htree) (@holdColorCast) (@hends) (@holdColorNe) + (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@hnewDeltaAvailable) (@hnewGammaAvailable) (@hreplacementLastMap) + (@hnewDeltaSigma) (@hgammaDeltaNe) (@hnewVertexTn) (@hpathComponent) (@hpathMeetsTn) + (@hsigmaPrevStableQ) (@returnEdgeTransfer) (@hsigmaReturnIsPath) (@hsigmaReturnSupport) + (@hreturnInQ) (@houtsideInQ) (@hreturnInNewEarlier) (@hreturnInTn) (@hcomponentDistinct) + (@hQMeetsTn) (@hcorrRoundsPositive) (@hcorrRoundsLess) (@correspondingTerminalTree) + (@hseriesTree) (@hlowerColor) (@hstableLower) (@hlowerTree) (@hdeltaLower) (@hlowerPackage) + (@hinterchangeLower) (@hinterchangeTn) (@replacementCycle) (@hcycleFull) (@hclosedSigma) + (@hclosedFinal) (@hreplacementCurrentTree) (@havailableCurrentIndex) (@havailableCurrentTree) + (@hreturnCycle) (@houtsideCycle) (@hreturnCurrent) (@houtsideNotCurrent) (@rootedIsCycle) + (@houtsideRooted) (@outsideIndicesNonempty) (@outsideOne) (@houtsideOneAt) (@houtsideOneNot) + (@beforeFirstOutside) (@firstOutsidePositive) (@firstOutsideLt) (@firstOutsideNotOne) + (@firstOutsideAtLeastTwo) (@firstCrossingAdj) (@firstCrossingIndex) (@firstEdge) + (@hfirstEdgeAt) (@hfirstOutsideIncident) (@hfirstEdgeActive) (@beforeFirstCrossingAdj) + (@beforeFirstCrossingIndex) (@insideOne) (@hinsideOneAt) (@hinsideOneCurrent) + (@hinsideOneIncident) (@endpointIdentity) (@hinsideOutsideOne) (@hfirstEnds) (@hfirstBoundary) + (@laterInsideNonempty) (@hfirstReturnMem) (@hfirstReturnAfter) (@insideTwo) (@hinsideTwoAt) + (@hinsideTwoCurrent) (@hreturnNotNext) (@hreturnGap) (@returnCrossingAdj) + (@returnCrossingIndex) (@secondEdge) (@hsecondEdgeAt) (@hinsideTwoIncident) + (@hsecondEdgeActive) (@beforeReturnCrossingAdj) (@beforeReturnCrossingIndex) (@outsideTwo) + (@houtsideTwoAt) (@houtsideTwoNot) (@houtsideTwoIncident) (@houtsideInsideTwo) (@hsecondEnds) + (@hsecondBoundary) (@hcrossingEdgesNe) (@hnewVertexCurrent) (@hfirstGamma) (@hsecondGamma) + (@hnotStrongSigma) (@hreplacementColor) (@castReturnWalkIsPath) (@castReturnWalkSupport) + (@castCycleSupport) (@hsigmaPathInQ) (@hsigmaPathOnCycle) (@hfstar) (@appendedCertificate) + (@happGamma) (@happDelta) (@happEdge) (@happInside) (@happOutside) (@hstrictClosure) + (@lastStep) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) + (@castSeriesColoring) (@castSeriesStored) (@castSeriesEdges) (@castSeriesKind) + (@hrawPenultimate) (@hfinalPenultimateTree) (@hrawFinalTree) (@hfinalTree) (@hrawFinalColor) + (@hfinalColor) (@hseriesDataAgree) + +private theorem revisitingCertificateTransport.{u_1, u_2} : + revisitingCertificateTransportStatement.{u_1, u_2} := by + classical + intro V E inst inst_1 inst_2 inst_3 G k e0 input T generating ett hpositive hlower sigma + hsigmaProper hsigmaOne hsigmaStable Tstar hTnTstar hstrict fstar seed hfinalEdges hadjoin + closureTree hseedClosure hTstarClosure hTnClosure q hqSucc hqCast adjoined previousProper + previousOneUncolored previousClosed available currentStored currentEdges currentKind hroundLarge + originalPrefix hr hprefixTrees hprefixData corr hcorrFinalTree hcorrFinalColor hcorrMP + earlierPrefixBound earlierPrefix hearlierMap hearlierPositive hreplacementEarlierKind oldi + oldChoice oldGamma holdTarget newi newChoice newGamma newCurrentDelta newCurrentGamma hnewIndex + htree oldChoiceOnNew holdColorCast hends holdColorNe hnewColorNe hidentifiedDelta + hidentifiedGamma holdDeltaAvailable holdGammaAvailable hnewDeltaAvailable hnewGammaAvailable + replacementLast hreplacementLastMap hnewDeltaSigma hgammaDeltaNe hnewVertexTn hpathComponent + hpathMeetsTn hsigmaPrevStableQ sigmaReturnGraph returnEdgeTransfer sigmaReturnPath + hsigmaReturnIsPath hsigmaReturnSupport hreturnInQ houtsideInQ hreturnInNewEarlier hreturnInTn + hcomponentDistinct hQMeetsTn hcorrRoundsPositive hcorrRoundsLess correspondingTerminalTree + hseriesTree hlowerColor hstableLower hlowerTree hdeltaLower hlowerPackage hinterchangeLower + hinterchangeTn replacementCycle hcycleFull hclosedSigma hclosedFinal hreplacementCurrentTree + havailableCurrentIndex havailableCurrentTree currentTree hreturnCycle houtsideCycle + hreturnCurrent houtsideNotCurrent rootedCycle rootedIsCycle houtsideRooted outsideIndices + outsideIndicesNonempty firstOutside outsideOne houtsideOneAt houtsideOneNot beforeFirstOutside + firstOutsidePositive firstOutsideLt firstOutsideNotOne firstOutsideAtLeastTwo firstCrossingAdj + firstCrossingIndex firstEdge hfirstEdgeAt hfirstOutsideIncident hfirstEdgeActive + beforeFirstCrossingAdj beforeFirstCrossingIndex insideOne hinsideOneAt hinsideOneCurrent + hinsideOneIncident endpointIdentity hinsideOutsideOne hfirstEnds hfirstBoundary + laterInsideIndices laterInsideNonempty firstReturn hfirstReturnMem hfirstReturnAfter insideTwo + hinsideTwoAt hinsideTwoCurrent hreturnNotNext hreturnGap returnCrossingAdj returnCrossingIndex + secondEdge hsecondEdgeAt hinsideTwoIncident hsecondEdgeActive beforeReturnCrossingAdj + beforeReturnCrossingIndex outsideTwo houtsideTwoAt houtsideTwoNot houtsideTwoIncident + houtsideInsideTwo hsecondEnds hsecondBoundary hcrossingEdgesNe hnewVertexCurrent hfirstGamma + hsecondGamma hnotStrongSigma hreplacementColor castReturnWalk castReturnWalkIsPath + castReturnWalkSupport castCycle + have castCycleSupport : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) z, + z ∈ (castCycle phi psi hphi C).walk.support ↔ z ∈ C.walk.support := by + intro phi psi hphi C z + subst psi + rfl + let replacementCycleForPrefix := + castCycle (corr.replacementSeries.data.coloring replacementLast) sigma hreplacementColor + replacementCycle + let replacementReturnPath := + castReturnWalk (corr.replacementSeries.data.coloring replacementLast) sigma hreplacementColor + sigmaReturnPath + have hsigmaPathInQ := + helper_hsigmaPathInQ_2135 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@Tstar) (@available) (@returnEdgeTransfer) + have hsigmaPathOnCycle : ∀ z, z ∈ sigmaReturnPath.support → z ∈ replacementCycle.walk.support := + by + intro z hz + exact (hcycleFull z).2 (hsigmaPathInQ z hz) + let replacementCertificate : + RevisitingExtensionCertificate corr.replacementSeries.data replacementLast := + { earlier := earlierPrefix + earlierPositive := hearlierPositive + earlierAtMost := Nat.le_of_lt_succ earlierPrefix.isLt, earlierPE := hreplacementEarlierKind + interveningRevisiting := by + exact + @helper_interveningRevisiting_4368 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@hqCast) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixData) + (@corr) (@earlierPrefixBound) (@hearlierMap) (@oldi) (@oldChoice) (@oldGamma) (@newi) + (@newChoice) (@newGamma) (@htree) (@holdColorCast) (@holdColorNe) (@hnewColorNe) + (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) (@holdGammaAvailable) + (@hreplacementLastMap) (@hgammaDeltaNe) (@replacementCycle) (@hreturnCycle) + (@outsideIndicesNonempty) (@firstOutsideNotOne) (@firstOutsideAtLeastTwo) + (@firstCrossingIndex) (@beforeFirstCrossingIndex) (@laterInsideNonempty) + (@hreturnNotNext) (@hreturnGap) (@returnCrossingIndex) (@beforeReturnCrossingIndex) + gamma := available.gamma + delta := available.delta + earlierGamma := by rw [← hnewIndex, newCurrentGamma, hnewGammaAvailable] + earlierDelta := by rw [← hnewIndex, newCurrentDelta, hnewDeltaAvailable] + cycle := replacementCycleForPrefix + meetsEarlier := by + refine ⟨available.returnVertex, hreturnInNewEarlier, ?_⟩ + exact (castCycleSupport _ _ hreplacementColor replacementCycle _).2 hreturnCycle + leavesCurrent := by + exact + @helper_leavesCurrent_4395 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@available) + (@hroundLarge) (@originalPrefix) (@corr) (@replacementCycle) (@hreplacementCurrentTree) + (@havailableCurrentTree) (@houtsideCycle) (@hreplacementColor) (@castCycleSupport) + edge := available.edge + edgeOnCycle := + (castCycleSupport _ _ hreplacementColor replacementCycle _).2 ((hcycleFull _).2 rfl) + edgeBoundary := by + rw [hreplacementCurrentTree, ← havailableCurrentTree] + exact available.edgeBoundary + insideEndpoint := available.insideEndpoint + outsideEndpoint := available.outsideEndpoint + insideInCurrent := by + rw [hreplacementCurrentTree, ← havailableCurrentTree] + exact available.insideInCurrent + outsideNotCurrent := by + rw [hreplacementCurrentTree, ← havailableCurrentTree] + exact available.outsideNotCurrent + edgeEnds := available.edgeEnds + returnVertex := available.returnVertex + returnInEarlier := hreturnInNewEarlier + returnPath := replacementReturnPath + returnPathIsPath := + castReturnWalkIsPath _ _ hreplacementColor sigmaReturnPath hsigmaReturnIsPath + returnPathOnCycle := by + exact + @helper_returnPathOnCycle_4421 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@available) (@hroundLarge) (@originalPrefix) (@corr) (@returnEdgeTransfer) + (@replacementCycle) (@hreplacementColor) (@castReturnWalkSupport) (@castCycleSupport) + (@hsigmaPathOnCycle) + returnPathInternal := by + exact + @helper_returnPathInternal_4428 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@available) (@hroundLarge) (@originalPrefix) (@corr) (@returnEdgeTransfer) + (@hsigmaReturnSupport) (@hreplacementCurrentTree) (@havailableCurrentTree) + (@hreplacementColor) (@castReturnWalkSupport) } + have hfstar := + helper_hfstar_2233 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@fstar) (@hfinalEdges) (@hqSucc) (@available) (@currentEdges) + let newStored : Finset (Fin k) := { available.delta, available.gamma } + let newEdges : Finset E := { available.edge } + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.RE + let newVertex : Option V := some available.insideEndpoint + let newOutside : Option V := some available.outsideEndpoint + let newDelta : Option (Fin k) := some available.delta + let newGamma : Option (Fin k) := some available.gamma + let appendedData := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma + obtain ⟨appendedCertificate, happGamma, happDelta, happEdge, happInside, happOutside⟩ := + (RevisitingExtensionCertificateAppend corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma replacementLast).2 + replacementCertificate + have hstrictClosure : + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < closureTree.length := + lt_of_lt_of_le hstrict hTstarClosure.1 + have lastStep : + TashkinovSeriesStep G k (originalPrefix.rounds + 1) e0 corr.replacementInput appendedData + (Fin.last (originalPrefix.rounds + 1)) := by + exact + @helper_lastStep_6001 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@Tstar) (@fstar) (@seed) (@hadjoin) (@closureTree) (@hseedClosure) + (@hTnClosure) (@hqSucc) (@hqCast) (@adjoined) (@previousProper) (@previousOneUncolored) + (@previousClosed) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixData) (@corr) + (@hcorrFinalTree) (@earlierPrefixBound) (@hearlierMap) (@hearlierPositive) + (@hreplacementEarlierKind) (@oldi) (@oldChoice) (@oldGamma) (@holdTarget) (@newi) + (@newChoice) _ (@newCurrentDelta) (@newCurrentGamma) (@hnewIndex) (@htree) (@holdColorCast) + (@hends) (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) + (@holdDeltaAvailable) (@holdGammaAvailable) (@hnewDeltaAvailable) (@hnewGammaAvailable) + (@hreplacementLastMap) (@hgammaDeltaNe) (@hsigmaPrevStableQ) (@returnEdgeTransfer) + (@hsigmaReturnIsPath) (@hsigmaReturnSupport) (@hreturnInNewEarlier) (@replacementCycle) + (@hcycleFull) (@hclosedFinal) (@hreplacementCurrentTree) (@havailableCurrentTree) + (@hreturnCycle) (@houtsideCycle) (@outsideIndicesNonempty) (@firstOutsideNotOne) + (@firstOutsideAtLeastTwo) (@firstCrossingIndex) (@beforeFirstCrossingIndex) + (@laterInsideNonempty) (@hreturnNotNext) (@hreturnGap) (@returnCrossingIndex) + (@beforeReturnCrossingIndex) (@hnotStrongSigma) (@hreplacementColor) (@castReturnWalkIsPath) + (@castReturnWalkSupport) (@castCycleSupport) (@hsigmaPathOnCycle) (@hfstar) + (@appendedCertificate) (@happGamma) (@happDelta) (@happEdge) (@happInside) (@happOutside) + (@hstrictClosure) + obtain ⟨extendedSeries, hextendedData⟩ := + TashkinovSeriesAppend G k originalPrefix.rounds e0 corr.replacementInput corr.replacementSeries + closureTree sigma newStored newEdges newKind newVertex newOutside newDelta newGamma lastStep + exact + @revisitingFinalSeries (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@hlower) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@fstar) (@seed) (@hfinalEdges) + (@hadjoin) (@closureTree) (@hseedClosure) (@hTstarClosure) (@hTnClosure) (@hqSucc) (@hqCast) + (@adjoined) (@previousProper) (@previousOneUncolored) (@previousClosed) (@available) + (@currentStored) (@currentEdges) (@currentKind) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixTrees) (@hprefixData) (@corr) (@hcorrFinalTree) (@hcorrFinalColor) (@hcorrMP) + (@earlierPrefixBound) (@hearlierMap) (@hearlierPositive) (@hreplacementEarlierKind) (@oldi) + (@oldChoice) (@oldGamma) (@holdTarget) (@newi) (@newChoice) (by assumption) (@newCurrentDelta) + (@newCurrentGamma) (@hnewIndex) (@htree) (@holdColorCast) (@hends) (@holdColorNe) + (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@hnewDeltaAvailable) (@hnewGammaAvailable) (@hreplacementLastMap) + (@hnewDeltaSigma) (@hgammaDeltaNe) (@hnewVertexTn) (@hpathComponent) (@hpathMeetsTn) + (@hsigmaPrevStableQ) (@returnEdgeTransfer) (@hsigmaReturnIsPath) (@hsigmaReturnSupport) + (@hreturnInQ) (@houtsideInQ) (@hreturnInNewEarlier) (@hreturnInTn) (@hcomponentDistinct) + (@hQMeetsTn) (@hcorrRoundsPositive) (@hcorrRoundsLess) (@correspondingTerminalTree) + (@hseriesTree) (@hlowerColor) (@hstableLower) (@hlowerTree) (@hdeltaLower) (@hlowerPackage) + (@hinterchangeLower) (@hinterchangeTn) (@replacementCycle) (@hcycleFull) (@hclosedSigma) + (@hclosedFinal) (@hreplacementCurrentTree) (@havailableCurrentIndex) (@havailableCurrentTree) + (@hreturnCycle) (@houtsideCycle) (@hreturnCurrent) (@houtsideNotCurrent) (@rootedIsCycle) + (@houtsideRooted) (@outsideIndicesNonempty) (@outsideOne) (@houtsideOneAt) (@houtsideOneNot) + (@beforeFirstOutside) (@firstOutsidePositive) (@firstOutsideLt) (@firstOutsideNotOne) + (@firstOutsideAtLeastTwo) (@firstCrossingAdj) (@firstCrossingIndex) (@firstEdge) + (@hfirstEdgeAt) (@hfirstOutsideIncident) (@hfirstEdgeActive) (@beforeFirstCrossingAdj) + (@beforeFirstCrossingIndex) (@insideOne) (@hinsideOneAt) (@hinsideOneCurrent) + (@hinsideOneIncident) (@endpointIdentity) (@hinsideOutsideOne) (@hfirstEnds) (@hfirstBoundary) + (@laterInsideNonempty) (@hfirstReturnMem) (@hfirstReturnAfter) (@insideTwo) (@hinsideTwoAt) + (@hinsideTwoCurrent) (@hreturnNotNext) (@hreturnGap) (@returnCrossingAdj) + (@returnCrossingIndex) (@secondEdge) (@hsecondEdgeAt) (@hinsideTwoIncident) + (@hsecondEdgeActive) (@beforeReturnCrossingAdj) (@beforeReturnCrossingIndex) (@outsideTwo) + (@houtsideTwoAt) (@houtsideTwoNot) (@houtsideTwoIncident) (@houtsideInsideTwo) (@hsecondEnds) + (@hsecondBoundary) (@hcrossingEdgesNe) (@hnewVertexCurrent) (@hfirstGamma) (@hsecondGamma) + (@hnotStrongSigma) (@hreplacementColor) (@castReturnWalkIsPath) (@castReturnWalkSupport) + (@castCycleSupport) (@hsigmaPathInQ) (@hsigmaPathOnCycle) (@hfstar) (@appendedCertificate) + (@happGamma) (@happDelta) (@happEdge) (@happInside) (@happOutside) (@hstrictClosure) + (@lastStep) (@extendedSeries) (@hextendedData) + +private theorem revisitingReturnCrossing.{u_1, u_2} : + revisitingReturnCrossingStatement.{u_1, u_2} := by + classical + intro V E inst inst_1 inst_2 inst_3 G k e0 input T generating ett hpositive hlower sigma + hsigmaProper hsigmaOne hsigmaStable Tstar hTnTstar hstrict fstar seed hfinalEdges hadjoin + closureTree hseedClosure hTstarClosure hTnClosure q hqSucc hqCast adjoined previousProper + previousOneUncolored previousClosed available currentStored currentEdges currentKind hroundLarge + originalPrefix hr hprefixTrees hprefixData corr hcorrFinalTree hcorrFinalColor hcorrMP + earlierPrefixBound earlierPrefix hearlierMap hearlierPositive hreplacementEarlierKind oldi + oldChoice oldGamma holdTarget newi newChoice newGamma newCurrentDelta newCurrentGamma hnewIndex + htree oldChoiceOnNew holdColorCast hends holdColorNe hnewColorNe hidentifiedDelta + hidentifiedGamma holdDeltaAvailable holdGammaAvailable hnewDeltaAvailable hnewGammaAvailable + replacementLast hreplacementLastMap hnewDeltaSigma hgammaDeltaNe hnewVertexTn hpathComponent + hpathMeetsTn hsigmaPrevStableQ sigmaReturnGraph returnEdgeTransfer sigmaReturnPath + hsigmaReturnIsPath hsigmaReturnSupport hreturnInQ houtsideInQ hreturnInNewEarlier hreturnInTn + hcomponentDistinct hQMeetsTn hcorrRoundsPositive hcorrRoundsLess correspondingTerminalTree + hseriesTree hlowerColor hstableLower hlowerTree hdeltaLower hlowerPackage hinterchangeLower + hinterchangeTn replacementCycle hcycleFull hclosedSigma hclosedFinal hreplacementCurrentTree + havailableCurrentIndex havailableCurrentTree currentTree hreturnCycle houtsideCycle + hreturnCurrent houtsideNotCurrent rootedCycle rootedIsCycle houtsideRooted outsideIndices + outsideIndicesNonempty firstOutside outsideOne houtsideOneAt houtsideOneNot beforeFirstOutside + firstOutsidePositive firstOutsideLt firstOutsideNotOne firstOutsideAtLeastTwo firstCrossingAdj + firstCrossingIndex firstEdge hfirstEdgeAt hfirstOutsideIncident hfirstEdgeActive + beforeFirstCrossingAdj beforeFirstCrossingIndex insideOne hinsideOneAt hinsideOneCurrent + hinsideOneIncident endpointIdentity hinsideOutsideOne hfirstEnds hfirstBoundary + laterInsideIndices laterInsideNonempty firstReturn hfirstReturnMem hfirstReturnAfter insideTwo + hinsideTwoAt hinsideTwoCurrent hreturnNotNext + have hreturnGap : firstOutside.val + 2 ≤ firstReturn.val := by omega + have returnCrossingAdj := rootedCycle.adj_getVert_succ (i := firstReturn.val - 1) (by omega) + have returnCrossingIndex : firstReturn.val - 1 + 1 = firstReturn.val := by omega + obtain ⟨secondEdge, hsecondEdgeAt⟩ : + ∃ f : E, rootedCycle.getVert (firstReturn.val - 1) = Sum.inr f := by + cases hnode : rootedCycle.getVert (firstReturn.val - 1) with + | inl v => + exfalso + rw [returnCrossingIndex, hinsideTwoAt, hnode] at returnCrossingAdj + simp [TwoColorIncidenceGraph] at returnCrossingAdj + | inr f => exact ⟨f, rfl⟩ + have hinsideTwoIncident : Incident G insideTwo secondEdge := by + rw [returnCrossingIndex, hinsideTwoAt, hsecondEdgeAt] at returnCrossingAdj + simpa [TwoColorIncidenceGraph] using returnCrossingAdj.1 + have hsecondEdgeActive : + sigma secondEdge = some available.gamma ∨ sigma secondEdge = some available.delta := by + rw [returnCrossingIndex, hinsideTwoAt, hsecondEdgeAt] at returnCrossingAdj + simpa [TwoColorIncidenceGraph] using returnCrossingAdj.2 + have beforeReturnCrossingAdj := rootedCycle.adj_getVert_succ (i := firstReturn.val - 2) (by omega) + have beforeReturnCrossingIndex : firstReturn.val - 2 + 1 = firstReturn.val - 1 := by omega + obtain ⟨outsideTwo, houtsideTwoAt⟩ : + ∃ y : V, rootedCycle.getVert (firstReturn.val - 2) = Sum.inl y := by + cases hnode : rootedCycle.getVert (firstReturn.val - 2) with + | inl y => exact ⟨y, rfl⟩ + | inr f => + exfalso + rw [beforeReturnCrossingIndex, hsecondEdgeAt, hnode] at beforeReturnCrossingAdj + simp [TwoColorIncidenceGraph] at beforeReturnCrossingAdj + have houtsideTwoNot : outsideTwo ∉ currentTree := by + exact + @helper_houtsideTwoNot_4210 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@earlierPrefixBound) (@oldi) + (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) (@holdColorCast) + (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@replacementCycle) (@hreturnCycle) (@outsideIndicesNonempty) + (@outsideOne) (@houtsideOneAt) (@houtsideOneNot) (@firstCrossingIndex) + (@beforeFirstCrossingIndex) (@laterInsideNonempty) (@hreturnGap) (@returnCrossingIndex) + (@beforeReturnCrossingIndex) (@outsideTwo) (@houtsideTwoAt) + have houtsideTwoIncident : Incident G outsideTwo secondEdge := by + rw [beforeReturnCrossingIndex, hsecondEdgeAt, houtsideTwoAt] at beforeReturnCrossingAdj + simpa [TwoColorIncidenceGraph] using beforeReturnCrossingAdj.1 + have houtsideInsideTwo : outsideTwo ≠ insideTwo := by + intro heq + exact houtsideTwoNot (heq ▸ hinsideTwoCurrent) + have hsecondEnds : G.ends secondEdge = s(insideTwo, outsideTwo) := by + rw [Sym2.eq_swap] + exact endpointIdentity houtsideTwoIncident hinsideTwoIncident houtsideInsideTwo + have hsecondBoundary : secondEdge ∈ BoundaryEdges G currentTree := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨insideTwo, hinsideTwoCurrent, outsideTwo, houtsideTwoNot, hsecondEnds⟩ + have hcrossingEdgesNe : firstEdge ≠ secondEdge := by + exact + @helper_hcrossingEdgesNe_4255 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@earlierPrefixBound) + (@oldi) (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) (@holdColorCast) + (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@replacementCycle) (@hreturnCycle) (@rootedIsCycle) + (@outsideIndicesNonempty) (@firstOutsideLt) (@firstOutsideAtLeastTwo) (@firstCrossingIndex) + (@firstEdge) (@hfirstEdgeAt) (@beforeFirstCrossingIndex) (@laterInsideNonempty) + (@hreturnGap) (@returnCrossingIndex) (@secondEdge) (@hsecondEdgeAt) + (@beforeReturnCrossingIndex) + have hnewVertexCurrent : newChoice.vertex ∈ currentTree := by + simpa [currentTree, hqSucc] using hnewVertexTn + have hfirstGamma := + helper_hfirstGamma_2063 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@available) (@originalPrefix) (@corr) (@newi) (@newChoice) (@hnewDeltaSigma) + (@hclosedSigma) (@firstEdge) (@hfirstEdgeActive) (@hfirstBoundary) (@hnewVertexCurrent) + have hsecondGamma := + helper_hsecondGamma_2070 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@Tstar) (@available) (@originalPrefix) (@corr) (@newi) (@newChoice) + (@hnewDeltaSigma) (@hclosedSigma) (@secondEdge) (@hsecondEdgeActive) (@hsecondBoundary) + (@hnewVertexCurrent) + have hnotStrongSigma : ¬ColoredVertexSetStronglyClosed G sigma currentTree := by + intro hstrong + exact (hstrong.2 hfirstBoundary hsecondBoundary hcrossingEdgesNe hfirstGamma) hsecondGamma + have hreplacementColor : corr.replacementSeries.data.coloring replacementLast = sigma := by + simpa [replacementLast] using hcorrFinalColor + let castReturnWalk (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk (Sum.inr available.edge) + (Sum.inl available.returnVertex)) : + (TwoColorIncidenceGraph G phi available.gamma available.delta).Walk (Sum.inr available.edge) + (Sum.inl available.returnVertex) := by + subst psi + exact P + have castReturnWalkIsPath : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk (Sum.inr available.edge) + (Sum.inl available.returnVertex)), + P.IsPath → (castReturnWalk phi psi hphi P).IsPath := by + intro phi psi hphi P hP + subst psi + exact hP + have castReturnWalkSupport : + ∀ (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (P : + (TwoColorIncidenceGraph G psi available.gamma available.delta).Walk (Sum.inr available.edge) + (Sum.inl available.returnVertex)) + z, z ∈ (castReturnWalk phi psi hphi P).support ↔ z ∈ P.support := by + intro phi psi hphi P z + subst psi + rfl + let castCycle (phi psi : PartialEdgeColoring E k) (hphi : phi = psi) + (C : TwoColorCycle G psi available.gamma available.delta) : + TwoColorCycle G phi available.gamma available.delta := by + subst psi + exact C + exact + @revisitingCertificateTransport (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@hlower) + (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@fstar) + (@seed) (@hfinalEdges) (@hadjoin) (@closureTree) (@hseedClosure) (@hTstarClosure) + (@hTnClosure) (@hqSucc) (@hqCast) (@adjoined) (@previousProper) (@previousOneUncolored) + (@previousClosed) (@available) (@currentStored) (@currentEdges) (@currentKind) (@hroundLarge) + (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) (@hcorrFinalTree) + (@hcorrFinalColor) (@hcorrMP) (@earlierPrefixBound) (@hearlierMap) (@hearlierPositive) + (@hreplacementEarlierKind) (@oldi) (@oldChoice) (@oldGamma) (@holdTarget) (@newi) (@newChoice) + (@newGamma) (@newCurrentDelta) (@newCurrentGamma) (@hnewIndex) (@htree) (@holdColorCast) + (@hends) (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) + (@holdDeltaAvailable) (@holdGammaAvailable) (@hnewDeltaAvailable) (@hnewGammaAvailable) + (@hreplacementLastMap) (@hnewDeltaSigma) (@hgammaDeltaNe) (@hnewVertexTn) (@hpathComponent) + (@hpathMeetsTn) (@hsigmaPrevStableQ) (@returnEdgeTransfer) (@hsigmaReturnIsPath) + (@hsigmaReturnSupport) (@hreturnInQ) (@houtsideInQ) (@hreturnInNewEarlier) (@hreturnInTn) + (@hcomponentDistinct) (@hQMeetsTn) (@hcorrRoundsPositive) (@hcorrRoundsLess) + (@correspondingTerminalTree) (@hseriesTree) (@hlowerColor) (@hstableLower) (@hlowerTree) + (@hdeltaLower) (@hlowerPackage) (@hinterchangeLower) (@hinterchangeTn) (@replacementCycle) + (@hcycleFull) (@hclosedSigma) (@hclosedFinal) (@hreplacementCurrentTree) + (@havailableCurrentIndex) (@havailableCurrentTree) (@hreturnCycle) (@houtsideCycle) + (@hreturnCurrent) (@houtsideNotCurrent) (@rootedIsCycle) (@houtsideRooted) + (@outsideIndicesNonempty) (@outsideOne) (@houtsideOneAt) (@houtsideOneNot) + (@beforeFirstOutside) (@firstOutsidePositive) (@firstOutsideLt) (@firstOutsideNotOne) + (@firstOutsideAtLeastTwo) (@firstCrossingAdj) (@firstCrossingIndex) (@firstEdge) + (@hfirstEdgeAt) (@hfirstOutsideIncident) (@hfirstEdgeActive) (@beforeFirstCrossingAdj) + (@beforeFirstCrossingIndex) (@insideOne) (@hinsideOneAt) (@hinsideOneCurrent) + (@hinsideOneIncident) (@endpointIdentity) (@hinsideOutsideOne) (@hfirstEnds) (@hfirstBoundary) + (@laterInsideNonempty) (@hfirstReturnMem) (@hfirstReturnAfter) (@insideTwo) (@hinsideTwoAt) + (@hinsideTwoCurrent) (@hreturnNotNext) (@hreturnGap) (@returnCrossingAdj) + (@returnCrossingIndex) (@secondEdge) (@hsecondEdgeAt) (@hinsideTwoIncident) + (@hsecondEdgeActive) (@beforeReturnCrossingAdj) (@beforeReturnCrossingIndex) (@outsideTwo) + (@houtsideTwoAt) (@houtsideTwoNot) (@houtsideTwoIncident) (@houtsideInsideTwo) (@hsecondEnds) + (@hsecondBoundary) (@hcrossingEdgesNe) (@hnewVertexCurrent) (@hfirstGamma) (@hsecondGamma) + (@hnotStrongSigma) (@hreplacementColor) (@castReturnWalkIsPath) (@castReturnWalkSupport) + +private theorem revisitingFirstCrossing.{u_1, u_2} : revisitingFirstCrossingStatement.{u_1, u_2} + := by + classical + intro «V» «E» «inst» «inst_1» «inst_2» «inst_3» «G» «k» «e0» «input» «T» «generating» «ett» + «hpositive» «hlower» «sigma» «hsigmaProper» «hsigmaOne» «hsigmaStable» «Tstar» «hTnTstar» + «hstrict» «fstar» «seed» «hfinalEdges» «hadjoin» «closureTree» «hseedClosure» «hTstarClosure» + «hTnClosure» «q» «hqSucc» «hqCast» «adjoined» «previousProper» «previousOneUncolored» + «previousClosed» «available» «currentStored» «currentEdges» «currentKind» «hroundLarge» + «originalPrefix» «hr» «hprefixTrees» «hprefixData» «corr» «hcorrFinalTree» «hcorrFinalColor» + «hcorrMP» «earlierPrefixBound» «earlierPrefix» «hearlierMap» «hearlierPositive» + «hreplacementEarlierKind» «oldi» «oldChoice» «oldGamma» «holdTarget» «newi» «newChoice» + «newGamma» «newCurrentDelta» «newCurrentGamma» «hnewIndex» «htree» «oldChoiceOnNew» + «holdColorCast» «hends» «holdColorNe» «hnewColorNe» «hidentifiedDelta» «hidentifiedGamma» + «holdDeltaAvailable» «holdGammaAvailable» «hnewDeltaAvailable» «hnewGammaAvailable» + «replacementLast» «hreplacementLastMap» «hnewDeltaSigma» «hgammaDeltaNe» «hnewVertexTn» + «hpathComponent» «hpathMeetsTn» «hsigmaPrevStableQ» «sigmaReturnGraph» «returnEdgeTransfer» + «sigmaReturnPath» «hsigmaReturnIsPath» «hsigmaReturnSupport» «hreturnInQ» «houtsideInQ» + «hreturnInNewEarlier» «hreturnInTn» «hcomponentDistinct» «hQMeetsTn» «hcorrRoundsPositive» + «hcorrRoundsLess» «correspondingTerminalTree» «hseriesTree» «hlowerColor» «hstableLower» + «hlowerTree» «hdeltaLower» «hlowerPackage» «hinterchangeLower» «hinterchangeTn» + «replacementCycle» «hcycleFull» «hclosedSigma» «hclosedFinal» «hreplacementCurrentTree» + «havailableCurrentIndex» «havailableCurrentTree» «currentTree» «hreturnCycle» «houtsideCycle» + «hreturnCurrent» «houtsideNotCurrent» «rootedCycle» «rootedIsCycle» «houtsideRooted» + «outsideIndices» «outsideIndicesNonempty» «firstOutside» + let firstOutside : Fin (rootedCycle.length + 1) := + outsideIndices.min' outsideIndicesNonempty + obtain ⟨outsideOne, houtsideOneAt, houtsideOneNot⟩ := + (Finset.mem_filter.mp + (Finset.min'_mem outsideIndices + outsideIndicesNonempty)).2 + have beforeFirstOutside : ∀ + (idx : Fin (rootedCycle.length + 1)), + idx.val < firstOutside.val → ∀ v : V, + rootedCycle.getVert idx.val = Sum.inl v → + v ∈ currentTree := by + exact @helper_beforeFirstOutside_4031 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@earlierPrefixBound) + (@oldi) (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) (@holdColorCast) + (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@replacementCycle) (@hreturnCycle) (@outsideIndicesNonempty) + have firstOutsidePositive : 0 < firstOutside.val := by + exact @helper_firstOutsidePositive_4043 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@earlierPrefixBound) + (@oldi) (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) (@holdColorCast) + (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@replacementCycle) (@hreturnCycle) (@hreturnCurrent) + (@outsideIndicesNonempty) (@outsideOne) (@houtsideOneAt) (@houtsideOneNot) + have firstOutsideLt : firstOutside.val < + rootedCycle.length := by + exact @helper_firstOutsideLt_4055 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@earlierPrefixBound) + (@oldi) (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) (@holdColorCast) + (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@replacementCycle) (@hreturnCycle) (@hreturnCurrent) + (@outsideIndicesNonempty) (@outsideOne) (@houtsideOneAt) (@houtsideOneNot) + have firstOutsideNotOne : firstOutside.val ≠ 1 := by + exact @helper_firstOutsideNotOne_4070 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@earlierPrefixBound) + (@oldi) (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) (@holdColorCast) + (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@replacementCycle) (@hreturnCycle) (@outsideIndicesNonempty) + (@outsideOne) (@houtsideOneAt) (@firstOutsideLt) + have firstOutsideAtLeastTwo : 2 ≤ firstOutside.val := by omega + have firstCrossingAdj := rootedCycle.adj_getVert_succ + (i := firstOutside.val - 1) (by omega) + have firstCrossingIndex : firstOutside.val - 1 + 1 = + firstOutside.val := by omega + obtain ⟨firstEdge, hfirstEdgeAt⟩ : ∃ f : E, + rootedCycle.getVert (firstOutside.val - 1) = + Sum.inr f := by + cases hnode : rootedCycle.getVert + (firstOutside.val - 1) with + | inl v => + exfalso + rw [firstCrossingIndex, houtsideOneAt, hnode] at firstCrossingAdj + simp [TwoColorIncidenceGraph] at firstCrossingAdj + | inr f => exact ⟨f, rfl⟩ + have hfirstOutsideIncident : Incident G outsideOne firstEdge := by + rw [firstCrossingIndex, houtsideOneAt, hfirstEdgeAt] at firstCrossingAdj + simpa [TwoColorIncidenceGraph] using firstCrossingAdj.1 + have hfirstEdgeActive : sigma firstEdge = + some available.gamma ∨ + sigma firstEdge = some available.delta := by + rw [firstCrossingIndex, houtsideOneAt, hfirstEdgeAt] at firstCrossingAdj + simpa [TwoColorIncidenceGraph] using firstCrossingAdj.2 + have beforeFirstCrossingAdj := rootedCycle.adj_getVert_succ + (i := firstOutside.val - 2) (by omega) + have beforeFirstCrossingIndex : firstOutside.val - 2 + 1 = + firstOutside.val - 1 := by omega + obtain ⟨insideOne, hinsideOneAt⟩ : ∃ x : V, + rootedCycle.getVert (firstOutside.val - 2) = + Sum.inl x := by + cases hnode : rootedCycle.getVert + (firstOutside.val - 2) with + | inl x => exact ⟨x, rfl⟩ + | inr f => + exfalso + rw [beforeFirstCrossingIndex, hfirstEdgeAt, hnode] at beforeFirstCrossingAdj + simp [TwoColorIncidenceGraph] at beforeFirstCrossingAdj + have hinsideOneCurrent : insideOne ∈ currentTree := by + exact @helper_hinsideOneCurrent_4119 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@earlierPrefixBound) + (@oldi) (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) (@holdColorCast) + (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@replacementCycle) (@hreturnCycle) (@outsideIndicesNonempty) + (@beforeFirstOutside) (@firstCrossingIndex) (@beforeFirstCrossingIndex) (@insideOne) + (@hinsideOneAt) + have hinsideOneIncident : Incident G insideOne firstEdge := by + rw [beforeFirstCrossingIndex, hfirstEdgeAt, hinsideOneAt] at beforeFirstCrossingAdj + simpa [TwoColorIncidenceGraph] using + beforeFirstCrossingAdj.1 + have endpointIdentity := + @helper_endpointIdentity_1568 (@V) (@E) (@G) + have hinsideOutsideOne : insideOne ≠ outsideOne := by + intro heq + exact houtsideOneNot (heq ▸ hinsideOneCurrent) + have hfirstEnds : G.ends firstEdge = + s(insideOne, outsideOne) := + endpointIdentity hinsideOneIncident hfirstOutsideIncident + hinsideOutsideOne + have hfirstBoundary : firstEdge ∈ BoundaryEdges G currentTree := by + simp only [BoundaryEdges, Finset.mem_filter, + Finset.mem_univ, true_and] + exact ⟨insideOne, hinsideOneCurrent, outsideOne, + houtsideOneNot, hfirstEnds⟩ + let laterInsideIndices : Finset + (Fin (rootedCycle.length + 1)) := + Finset.univ.filter fun idx => firstOutside.val < idx.val ∧ + ∃ v : V, rootedCycle.getVert idx.val = Sum.inl v ∧ + v ∈ currentTree + have laterInsideNonempty : laterInsideIndices.Nonempty := by + exact @helper_laterInsideNonempty_4150 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@earlierPrefixBound) + (@oldi) (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) (@holdColorCast) + (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@replacementCycle) (@hreturnCycle) (@hreturnCurrent) + (@outsideIndicesNonempty) (@firstOutsideLt) + let firstReturn : Fin (rootedCycle.length + 1) := + laterInsideIndices.min' laterInsideNonempty + have hfirstReturnMem := Finset.min'_mem laterInsideIndices + laterInsideNonempty + have hfirstReturnAfter : firstOutside.val < firstReturn.val := + (Finset.mem_filter.mp hfirstReturnMem).2.1 + obtain ⟨insideTwo, hinsideTwoAt, hinsideTwoCurrent⟩ := + (Finset.mem_filter.mp hfirstReturnMem).2.2 + have hreturnNotNext : firstReturn.val ≠ + firstOutside.val + 1 := by + exact helper_hreturnNotNext_3034 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@Tstar) (@available) (@replacementCycle) (@hreturnCycle) + (@outsideIndicesNonempty) (@outsideOne) (@houtsideOneAt) (@firstOutsideLt) + (@laterInsideNonempty) (@insideTwo) (@hinsideTwoAt) + exact @revisitingReturnCrossing (@«V») (@«E») inferInstance inferInstance inferInstance + inferInstance (@«G») (@«k») (@«e0») (@«input») (@«T») (@«generating») (@«ett») (@«hpositive») + (@«hlower») (@«sigma») (@«hsigmaProper») (@«hsigmaOne») (@«hsigmaStable») (@«Tstar») + (@«hTnTstar») (@«hstrict») (@«fstar») (@«seed») (@«hfinalEdges») (@«hadjoin») (@«closureTree») + (@«hseedClosure») (@«hTstarClosure») (@«hTnClosure») (@«hqSucc») (@«hqCast») (@«adjoined») + (@«previousProper») (@«previousOneUncolored») (@«previousClosed») (@«available») + (@«currentStored») (@«currentEdges») (@«currentKind») (@«hroundLarge») (@«originalPrefix») + (@«hr») (@«hprefixTrees») (@«hprefixData») (@«corr») (@«hcorrFinalTree») (@«hcorrFinalColor») + (@«hcorrMP») (@«earlierPrefixBound») (@«hearlierMap») (@«hearlierPositive») + (@«hreplacementEarlierKind») (@«oldi») (@«oldChoice») (@«oldGamma») (@«holdTarget») (@«newi») + (@«newChoice») (@«newGamma») (@«newCurrentDelta») (@«newCurrentGamma») (@«hnewIndex») + (@«htree») (@«holdColorCast») (@«hends») (@«holdColorNe») (@«hnewColorNe») + (@«hidentifiedDelta») (@«hidentifiedGamma») (@«holdDeltaAvailable») (@«holdGammaAvailable») + (@«hnewDeltaAvailable») (@«hnewGammaAvailable») (@«hreplacementLastMap») (@«hnewDeltaSigma») + (@«hgammaDeltaNe») (@«hnewVertexTn») (@«hpathComponent») (@«hpathMeetsTn») + (@«hsigmaPrevStableQ») (@«returnEdgeTransfer») (@«hsigmaReturnIsPath») + (@«hsigmaReturnSupport») (@«hreturnInQ») (@«houtsideInQ») (@«hreturnInNewEarlier») + (@«hreturnInTn») (@«hcomponentDistinct») (@«hQMeetsTn») (@«hcorrRoundsPositive») + (@«hcorrRoundsLess») (@«correspondingTerminalTree») (@«hseriesTree») (@«hlowerColor») + (@«hstableLower») (@«hlowerTree») (@«hdeltaLower») (@«hlowerPackage») (@«hinterchangeLower») + (@«hinterchangeTn») (@«replacementCycle») (@«hcycleFull») (@«hclosedSigma») (@«hclosedFinal») + (@«hreplacementCurrentTree») (@«havailableCurrentIndex») (@«havailableCurrentTree») + (@«hreturnCycle») (@«houtsideCycle») (@«hreturnCurrent») (@«houtsideNotCurrent») + (@«rootedIsCycle») (@«houtsideRooted») (@«outsideIndicesNonempty») (@«outsideOne») + (@«houtsideOneAt») (@«houtsideOneNot») (@«beforeFirstOutside») (@«firstOutsidePositive») + (@«firstOutsideLt») (@«firstOutsideNotOne») (@«firstOutsideAtLeastTwo») (@«firstCrossingAdj») + (@«firstCrossingIndex») (@«firstEdge») (@«hfirstEdgeAt») (@«hfirstOutsideIncident») + (@«hfirstEdgeActive») (@«beforeFirstCrossingAdj») (@«beforeFirstCrossingIndex») (@«insideOne») + (@«hinsideOneAt») (@«hinsideOneCurrent») (@«hinsideOneIncident») (@«endpointIdentity») + (@«hinsideOutsideOne») (@«hfirstEnds») (@«hfirstBoundary») (@«laterInsideNonempty») + (@«hfirstReturnMem») (@«hfirstReturnAfter») (@«insideTwo») (@«hinsideTwoAt») + (@«hinsideTwoCurrent») (@«hreturnNotNext») + +theorem helper_continuation_3762.{u_1, u_2} : + terminalContinuationStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive hlower sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict fstar seed hfinalEdges hadjoin closureTree hseedClosure + hTstarClosure hTnClosure q hqSucc hqCast adjoined previousProper previousOneUncolored + previousClosed available currentStored currentEdges currentKind hroundLarge originalPrefix + hr hprefixTrees hprefixData corr hcorrFinalTree hcorrFinalColor hcorrMP earlierPrefixBound + earlierPrefix hearlierMap hearlierPositive hreplacementEarlierKind oldi oldChoice oldGamma + holdTarget newi newChoice newGamma newCurrentDelta newCurrentGamma hnewIndex htree + oldChoiceOnNew holdColorCast hends holdColorNe hnewColorNe hidentifiedDelta + hidentifiedGamma holdDeltaAvailable holdGammaAvailable hnewDeltaAvailable + hnewGammaAvailable replacementLast hreplacementLastMap hnewDeltaSigma hgammaDeltaNe + hnewVertexTn hpathComponent hpathMeetsTn hsigmaPrevStableQ sigmaReturnGraph + returnEdgeTransfer sigmaReturnPath hsigmaReturnIsPath hsigmaReturnSupport hreturnInQ + houtsideInQ hreturnInNewEarlier hreturnInTn hcomponentDistinct + have hQMeetsTn : ∃ v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc), + Sum.inl v ∈ TwoColorComponent G sigma available.gamma + available.delta (Sum.inr available.edge) := + ⟨available.returnVertex, hreturnInTn, hreturnInQ⟩ + have hcorrRoundsPositive : 0 < corr.replacementETT.rounds := + corr.replacementETT.roundsPositive + have hcorrRoundsLess : corr.replacementETT.rounds < + ett.rounds := by + rw [corr.rungAgreement, hr] + omega + have correspondingTerminalTree := + helper_correspondingTerminalTree_1299 (@G) (@k) (@e0) (@input) (@T) (@generating) + (@ett) (@hpositive) (@sigma) (@originalPrefix) + have hseriesTree := correspondingTerminalTree corr + have hlowerColor : + corr.replacementETT.series.data.coloring + (Fin.last corr.replacementETT.rounds) = sigma := by + exact corr.replacementETT.generatingColoring.symm + have hstableLower : StableColoring + (corr.replacementETT.series.data.tree + (Fin.last (corr.replacementETT.rounds + 1))) + (TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds)) + (corr.replacementETT.series.data.coloring + (Fin.last corr.replacementETT.rounds)) sigma := by + rw [hlowerColor] + exact ⟨(by intros; rfl), (by intros; rfl)⟩ + have hlowerTree : corr.replacementETT.series.data.tree + (Fin.last (corr.replacementETT.rounds + 1)) = + ett.series.data.tree + (Fin.last ett.rounds).castSucc := + hseriesTree.trans hcorrFinalTree + have hdeltaLower : available.delta ∈ TreeMissingColors sigma + (corr.replacementETT.series.data.tree + (Fin.last (corr.replacementETT.rounds + 1))) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + refine ⟨newChoice.vertex, ?_, hnewDeltaSigma⟩ + rw [hlowerTree] + exact hnewVertexTn + have hlowerPackage := hlower corr.replacementETT + hcorrRoundsPositive hcorrRoundsLess hcorrMP + have hinterchangeLower := hlowerPackage.2.1 sigma + hsigmaProper hsigmaOne hstableLower available.gamma + available.delta (Or.inr hdeltaLower) + have hinterchangeTn : TreeInterchangeable G + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + sigma available.gamma available.delta := by + rw [← hlowerTree] + exact hinterchangeLower + have hcycleComponent := + TwoColorInterchangeableDistinctComponentCycle G + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + sigma available.gamma available.delta hsigmaProper + (Sum.inl newChoice.vertex) (Sum.inr available.edge) + hpathComponent.1 hinterchangeTn hpathMeetsTn hQMeetsTn + hcomponentDistinct + obtain ⟨replacementCycle, hcycleFull⟩ := hcycleComponent + have hclosedSigma : ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) := by + exact helper_hclosedSigma_3647 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@hsigmaProper) (@hsigmaOne) (@Tstar) (@previousProper) + (@previousOneUncolored) (@previousClosed) (@hroundLarge) (@originalPrefix) (@corr) + (@oldi) (@oldChoice) (@newi) (@newChoice) (@htree) (@hends) (@hsigmaPrevStableQ) + have hclosedFinal : ColoredVertexSetClosed G sigma + (TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) := by + rw [← hqSucc] + exact hclosedSigma + have hreplacementCurrentTree := + helper_hreplacementCurrentTree_1736 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@originalPrefix) (@corr) (@hcorrFinalTree) + have havailableCurrentIndex : q.castSucc.succ = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + have hvals := congrArg Fin.val hqSucc + simp only [Fin.val_succ, Fin.val_castSucc] at hvals ⊢ + exact hvals + have havailableCurrentTree : + ett.series.data.tree q.castSucc.succ = + ett.series.data.tree + (Fin.last ett.rounds).castSucc := by + rw [havailableCurrentIndex] + let currentTree := TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) + have hreturnCycle : Sum.inl available.returnVertex ∈ + replacementCycle.walk.support := + (hcycleFull _).2 hreturnInQ + have houtsideCycle : Sum.inl available.outsideEndpoint ∈ + replacementCycle.walk.support := + (hcycleFull _).2 houtsideInQ + have hreturnCurrent : available.returnVertex ∈ currentTree := by + simpa [currentTree, hqSucc] using hreturnInTn + have houtsideNotCurrent : available.outsideEndpoint ∉ + currentTree := by + simpa [currentTree] using available.outsideNotCurrent + let rootedCycle := replacementCycle.walk.rotate + (Sum.inl available.returnVertex) hreturnCycle + have rootedIsCycle : rootedCycle.IsCycle := + replacementCycle.isCycle.rotate hreturnCycle + have houtsideRooted : Sum.inl available.outsideEndpoint ∈ + rootedCycle.support := by + apply (replacementCycle.walk.mem_support_rotate_iff + (Sum.inl available.returnVertex) hreturnCycle).mpr + exact houtsideCycle + let outsideIndices : Finset + (Fin (rootedCycle.length + 1)) := + Finset.univ.filter fun i => ∃ v : V, + rootedCycle.getVert i.val = Sum.inl v ∧ + v ∉ currentTree + have outsideIndicesNonempty : outsideIndices.Nonempty := by + exact @helper_outsideIndicesNonempty_4016 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@earlierPrefixBound) + (@oldi) (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) (@holdColorCast) + (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) + (@holdGammaAvailable) (@replacementCycle) (@hreturnCycle) (@houtsideNotCurrent) + (@houtsideRooted) + exact @revisitingFirstCrossing (@«V») (@«E») inferInstance inferInstance inferInstance + inferInstance (@«G») (@«k») (@«e0») (@«input») (@«T») (@«generating») (@«ett») (@«hpositive») + (@«hlower») (@«sigma») (@«hsigmaProper») (@«hsigmaOne») (@«hsigmaStable») (@«Tstar») + (@«hTnTstar») (@«hstrict») (@«fstar») (@«seed») (@«hfinalEdges») (@«hadjoin») (@«closureTree») + (@«hseedClosure») (@«hTstarClosure») (@«hTnClosure») (@«hqSucc») (@«hqCast») (@«adjoined») + (@«previousProper») (@«previousOneUncolored») (@«previousClosed») (@«available») + (@«currentStored») (@«currentEdges») (@«currentKind») (@«hroundLarge») (@«originalPrefix») + (@«hr») (@«hprefixTrees») (@«hprefixData») (@«corr») (@«hcorrFinalTree») (@«hcorrFinalColor») + (@«hcorrMP») (@«earlierPrefixBound») (@«hearlierMap») (@«hearlierPositive») + (@«hreplacementEarlierKind») (@«oldi») (@«oldChoice») (@«oldGamma») (@«holdTarget») (@«newi») + (@«newChoice») (@«newGamma») (@«newCurrentDelta») (@«newCurrentGamma») (@«hnewIndex») + (@«htree») (@«holdColorCast») (@«hends») (@«holdColorNe») (@«hnewColorNe») + (@«hidentifiedDelta») (@«hidentifiedGamma») (@«holdDeltaAvailable») (@«holdGammaAvailable») + (@«hnewDeltaAvailable») (@«hnewGammaAvailable») (@«hreplacementLastMap») (@«hnewDeltaSigma») + (@«hgammaDeltaNe») (@«hnewVertexTn») (@«hpathComponent») (@«hpathMeetsTn») + (@«hsigmaPrevStableQ») (@«returnEdgeTransfer») (@«hsigmaReturnIsPath») + (@«hsigmaReturnSupport») (@«hreturnInQ») (@«houtsideInQ») (@«hreturnInNewEarlier») + (@«hreturnInTn») (@«hcomponentDistinct») (@«hQMeetsTn») (@«hcorrRoundsPositive») + (@«hcorrRoundsLess») (@«correspondingTerminalTree») (@«hseriesTree») (@«hlowerColor») + (@«hstableLower») (@«hlowerTree») (@«hdeltaLower») (@«hlowerPackage») (@«hinterchangeLower») + (@«hinterchangeTn») (@«replacementCycle») (@«hcycleFull») (@«hclosedSigma») (@«hclosedFinal») + (@«hreplacementCurrentTree») (@«havailableCurrentIndex») (@«havailableCurrentTree») + (@«hreturnCycle») (@«houtsideCycle») (@«hreturnCurrent») (@«houtsideNotCurrent») + (@«rootedIsCycle») (@«houtsideRooted») (@«outsideIndicesNonempty») + +theorem helper_continuation_3509.{u_1, u_2} : + helperContinuation3509Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive hlower sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict fstar seed hfinalEdges hadjoin closureTree hseedClosure + hTstarClosure hTnClosure q hqSucc hqCast adjoined previousProper previousOneUncolored + previousClosed available currentStored currentEdges currentKind hroundLarge originalPrefix + hr hprefixTrees hprefixData corr hcorrFinalTree hcorrFinalColor hcorrMP earlierPrefixBound + earlierPrefix hearlierMap hearlierPositive hreplacementEarlierKind oldi oldChoice oldGamma + holdTarget holdIndex newi newChoice newGamma newGammaRule newSecond newSecondProper + newSecondStable newExit newCurrentColoring newCurrentDelta newCurrentGamma hnewIndex htree + oldChoiceOnNew holdColorCast hends holdDeltaMissing holdColorNe hnewColorNe + hidentifiedDelta hidentifiedGamma holdDeltaAvailable holdGammaAvailable hnewDeltaAvailable + hnewGammaAvailable hnewVertexOld holdColorConstant replacementLast hreplacementLastMap + hnewPostSigma hnewDeltaSigma hgammaDeltaNe hnewTreeFinal hnewVertexTn hpathComponent + hpathMeetsTn hsigmaPrevStableQ hgammaEarlierStored hdeltaEarlierStored colorControlAtQ + have hreturnNotNil : ¬ available.returnPath.Nil := by + intro hnil + have hend := SimpleGraph.Walk.Nil.eq hnil + simp at hend + have oldReturnEdgeData (f : E) + (hf : Sum.inr f ∈ available.returnPath.support) : + TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f ∧ + (ett.series.data.coloring q.castSucc f = + some available.gamma ∨ + ett.series.data.coloring q.castSucc f = + some available.delta) := by + exact @helper_oldReturnEdgeData_978 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@Tstar) (@available) (@hreturnNotNil) (@f) (@hf) + have copyReturnEdge (f : E) + (hf : Sum.inr f ∈ available.returnPath.support) : + sigma f = ett.series.data.coloring q.castSucc f := by + exact @helper_copyReturnEdge_2580 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@available) + (@hsigmaPrevStableQ) (@hgammaEarlierStored) (@hdeltaEarlierStored) (@colorControlAtQ) + (@oldReturnEdgeData) (@f) (@hf) + let oldReturnGraph := TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) available.gamma + available.delta + let sigmaReturnGraph := TwoColorIncidenceGraph G sigma + available.gamma available.delta + have returnEdgeTransfer : ∀ edge, + edge ∈ available.returnPath.edges → + edge ∈ sigmaReturnGraph.edgeSet := by + exact @helper_returnEdgeTransfer_1018 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@Tstar) (@available) (@copyReturnEdge) + let sigmaReturnPath := + available.returnPath.transfer sigmaReturnGraph + returnEdgeTransfer + have hsigmaReturnIsPath : sigmaReturnPath.IsPath := by + exact available.returnPathIsPath.transfer returnEdgeTransfer + have hsigmaReturnSupport : ∀ z, + z ∈ sigmaReturnPath.support ↔ + z ∈ available.returnPath.support := by + intro z + simp [sigmaReturnPath] + have hreturnInQ : Sum.inl available.returnVertex ∈ + TwoColorComponent G sigma available.gamma available.delta + (Sum.inr available.edge) := by + exact @helper_hreturnInQ_1513 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@Tstar) (@available) (@returnEdgeTransfer) + have hedgeSigmaActive : sigma available.edge = + some available.gamma ∨ + sigma available.edge = some available.delta := by + exact @helper_hedgeSigmaActive_1522 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@Tstar) (@available) (@oldReturnEdgeData) + (@copyReturnEdge) + have houtsideInQ : Sum.inl available.outsideEndpoint ∈ + TwoColorComponent G sigma available.gamma available.delta + (Sum.inr available.edge) := by + exact @helper_houtsideInQ_1530 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@Tstar) (@available) (@hedgeSigmaActive) + have hreturnInNewEarlier : available.returnVertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree + earlierPrefix.castSucc) := by + rw [← hnewIndex, htree] + simpa only [holdIndex] using available.returnInEarlier + have hreturnInTn : available.returnVertex ∈ + TreeSequenceVertexSet + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) := by + have hvFinal : available.returnVertex ∈ + TreeSequenceVertexSet + (corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1))) := + TreeSequenceInitialSegmentVertexSetSubset hnewTreeFinal + (by simpa only [hnewIndex] using hreturnInNewEarlier) + exact Eq.mp + (congrArg (fun X => available.returnVertex ∈ + TreeSequenceVertexSet X) hcorrFinalTree) hvFinal + have holdDeltaAtNewVertex : available.delta ∈ MissingColors G + (ett.series.data.coloring q.castSucc) + newChoice.vertex := by + exact @helper_holdDeltaAtNewVertex_2647 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@available) (@originalPrefix) (@corr) (@oldi) (@oldChoice) (@newi) (@newChoice) + (@holdDeltaMissing) (@holdDeltaAvailable) (@hnewVertexOld) (@holdColorConstant) + have holdLeafDegree : @SimpleGraph.degree _ + (TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta) + (Sum.inl newChoice.vertex) (Fintype.ofFinite _) ≤ 1 := by + simpa only [← SimpleGraph.card_neighborSet_eq_degree, Fintype.card_eq_nat_card] + using + (@helper_holdLeafDegree_1372 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) + (@ett) (@hpositive) (@sigma) (@Tstar) (@previousProper) (@available) + (@originalPrefix) (@corr) (@newi) (@newChoice) (@hgammaDeltaNe) + (@holdDeltaAtNewVertex)) + have holdLeaf : Set.Subsingleton + ((TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta).neighborSet + (Sum.inl newChoice.vertex)) := by + let : Fintype + ((TwoColorIncidenceGraph G + (ett.series.data.coloring q.castSucc) + available.gamma available.delta).neighborSet + (Sum.inl newChoice.vertex)) := Fintype.ofFinite _ + rw [← SimpleGraph.card_neighborSet_eq_degree] at holdLeafDegree + have hsub := Fintype.card_le_one_iff.mp holdLeafDegree + intro a ha b hb + exact congrArg Subtype.val (hsub ⟨a, ha⟩ ⟨b, hb⟩) + have hreturnNeNew : available.returnVertex ≠ + newChoice.vertex := by + exact @helper_hreturnNeNew_1406 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) + (@ett) (@hpositive) (@sigma) (@Tstar) (@available) (@originalPrefix) + (@corr) (@newi) (@newChoice) (@holdLeaf) + have hswapGraph : TwoColorIncidenceGraph G + (TwoColorComponentSwap G newSecond newGamma + newChoice.color (Sum.inl newChoice.vertex)) + newGamma newChoice.color = + TwoColorIncidenceGraph G newSecond newGamma + newChoice.color := by + exact @helper_hswapGraph_1429 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@originalPrefix) (@corr) (@newi) (@newChoice) + (@newGamma) (@newSecond) + have hsigmaExitGraph : TwoColorIncidenceGraph G sigma + available.gamma available.delta = + TwoColorIncidenceGraph G newSecond newGamma + newChoice.color := by + exact @helper_hsigmaExitGraph_2697 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@available) + (@originalPrefix) (@corr) (@newi) (@newChoice) (@newGamma) (@newSecond) + (@newCurrentColoring) (@hnewDeltaAvailable) (@hnewGammaAvailable) (@hnewPostSigma) + (@hswapGraph) + have hnewGammaSecond : newGamma ∈ MissingColors G newSecond + newChoice.vertex := by + rw [newSecondStable.2 newChoice.vertex + newChoice.vertexDefective.1] + exact newGammaRule.1 + have hcomponentOnly := TreeExitComponentMeetsTreeOnlyAtExit + (corr.replacementSeries.data.tree newi.succ.castSucc) + newSecond newGamma newChoice.color newChoice.vertex + newSecondProper hnewGammaSecond newExit + have hcomponentDistinct : + TwoColorComponent G sigma available.gamma available.delta + (Sum.inl newChoice.vertex) ≠ + TwoColorComponent G sigma available.gamma available.delta + (Sum.inr available.edge) := by + intro heq + have hreturnExitSigma : Sum.inl available.returnVertex ∈ + TwoColorComponent G sigma available.gamma + available.delta (Sum.inl newChoice.vertex) := by + rw [heq] + exact hreturnInQ + have hreturnExitSecond : Sum.inl available.returnVertex ∈ + TwoColorComponent G newSecond newGamma newChoice.color + (Sum.inl newChoice.vertex) := by + unfold TwoColorComponent at hreturnExitSigma ⊢ + rw [← hsigmaExitGraph] + exact hreturnExitSigma + exact hreturnNeNew + ((hcomponentOnly available.returnVertex + (by simpa only [hnewIndex] using hreturnInNewEarlier)).mp + hreturnExitSecond) + exact @helper_continuation_3762 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@hlower) + (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) + (@fstar) (@seed) (@hfinalEdges) (@hadjoin) (@closureTree) (@hseedClosure) (@hTstarClosure) + (@hTnClosure) (@hqSucc) (@hqCast) (@adjoined) (@previousProper) (@previousOneUncolored) + (@previousClosed) (@available) (@currentStored) (@currentEdges) (@currentKind) + (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) + (@hcorrFinalTree) (@hcorrFinalColor) (@hcorrMP) (@earlierPrefixBound) (@hearlierMap) + (@hearlierPositive) (@hreplacementEarlierKind) (@oldi) (@oldChoice) (@oldGamma) + (@holdTarget) (@newi) (@newChoice) (@newGamma) (@newCurrentDelta) (@newCurrentGamma) + (@hnewIndex) (@htree) (@holdColorCast) (@hends) (@holdColorNe) (@hnewColorNe) + (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) (@holdGammaAvailable) + (@hnewDeltaAvailable) (@hnewGammaAvailable) (@hreplacementLastMap) (@hnewDeltaSigma) + (@hgammaDeltaNe) (@hnewVertexTn) (@hpathComponent) (@hpathMeetsTn) (@hsigmaPrevStableQ) + (@returnEdgeTransfer) (@hsigmaReturnIsPath) (@hsigmaReturnSupport) (@hreturnInQ) + (@houtsideInQ) (@hreturnInNewEarlier) (@hreturnInTn) (@hcomponentDistinct) +theorem helper_continuation_2808.{u_1, u_2} : + helperContinuation2808Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive hlower sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict fstar seed hfinalEdges hadjoin closureTree hseedClosure + hTstarClosure hTnClosure q hqSucc hqCast adjoined previousProper previousOneUncolored + previousClosed available currentStored currentEdges currentKind adjoinedExactly + hsigmaPrevStable hroundLarge originalPrefix hr hprefixTrees hprefixData corr hcorrFinalTree + hcorrFinalColor hcorrMP earlierPrefixBound earlierPrefix hearlierMap hearlierPositive + hreplacementEarlierKind oldi oldChoice oldGamma oldCurrentStored holdTarget holdIndex newi + newChoice newGamma newGammaRule newSecond newSecondProper newSecondStable newExit + newCurrentColoring newCurrentDelta newCurrentGamma hnewTarget hnewIndex htree + oldChoiceOnNew holdColorCast hends holdDeltaMissing holdColorNe hnewDeltaMissing + hnewGammaNotMissing hnewColorNe hidentifiedDelta hidentifiedGamma holdDeltaAvailable + holdGammaAvailable hnewDeltaAvailable hnewGammaAvailable hnewVertexOld holdColorConstant + replacementLast hreplacementLastMap hreplacementColorConstant + have hnewPostSigma : + corr.replacementSeries.data.coloring newi.succ = sigma := by + exact hreplacementColorConstant.symm.trans + (by simpa [replacementLast] using hcorrFinalColor) + have hnewDeltaSigma : available.delta ∈ + MissingColors G sigma newChoice.vertex := by + have hm := hnewDeltaMissing + rw [hnewDeltaAvailable] at hm + exact Eq.mp (congrArg (fun phi => available.delta ∈ + MissingColors G phi newChoice.vertex) hnewPostSigma) hm + have hnewGammaSigmaNot : available.gamma ∉ + MissingColors G sigma newChoice.vertex := by + have hm := hnewGammaNotMissing + rw [hnewGammaAvailable] at hm + exact Eq.mp (congrArg (fun phi => available.gamma ∉ + MissingColors G phi newChoice.vertex) hnewPostSigma) hm + have hgammaDeltaNe : available.gamma ≠ available.delta := by + intro heq + apply hnewColorNe + rw [hnewGammaAvailable, hnewDeltaAvailable, heq] + have stepSegment := + helper_stepSegment_2938 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@Tstar) (@adjoined) (@available) (@adjoinedExactly) (@hroundLarge) + (@originalPrefix) (@hr) (@corr) (@earlierPrefixBound) (@oldi) (@oldChoice) (@oldGamma) + (@newi) (@newChoice) (@newGamma) (@htree) (@holdColorCast) (@holdColorNe) (@hnewColorNe) + (@hidentifiedDelta) (@hidentifiedGamma) (@holdDeltaAvailable) (@holdGammaAvailable) + have segmentTrans := + @helper_segmentTrans_778 (@V) (@E) (@G) (@e0) + have treeToFinal := + helper_treeToFinal_2987 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@Tstar) (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) + (@earlierPrefixBound) (@oldi) (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) + (@htree) (@holdColorCast) (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) + (@hidentifiedGamma) (@holdDeltaAvailable) (@holdGammaAvailable) (@stepSegment) + (@segmentTrans) + have hnewTreeFinal : TreeSequenceInitialSegment + (corr.replacementSeries.data.tree newi.succ.castSucc) + (corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + 1))) := by + apply treeToFinal (originalPrefix.rounds - newi.val) + · simp + omega + · simp + have hnewVertexTn := + helper_hnewVertexTn_1347 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@originalPrefix) (@corr) (@hcorrFinalTree) (@newi) (@newChoice) + (@hnewTreeFinal) + have hgammaPresentSigma : available.gamma ∈ + PresentColors G sigma newChoice.vertex := by + simpa [MissingColors] using hnewGammaSigmaNot + obtain ⟨pathEdge, hpathEdgeIncident, hpathEdgeColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and] using hgammaPresentSigma + have hpathEdgeComponent : Sum.inr pathEdge ∈ + TwoColorComponent G sigma available.gamma available.delta + (Sum.inl newChoice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, + hpathEdgeIncident, hpathEdgeColor] + have hleafDegree : @SimpleGraph.degree _ + (TwoColorIncidenceGraph G sigma available.gamma + available.delta) (Sum.inl newChoice.vertex) + (Fintype.ofFinite _) ≤ 1 := by + have hgraphSwapOrder : + TwoColorIncidenceGraph G sigma available.delta + available.gamma = + TwoColorIncidenceGraph G sigma available.gamma + available.delta := by + ext x y + cases x <;> cases y <;> + simp [TwoColorIncidenceGraph, or_comm] + rw [← hgraphSwapOrder] + exact MissingColorIncidenceEndpoint G sigma available.delta + available.gamma hgammaDeltaNe.symm hsigmaProper + newChoice.vertex hnewDeltaSigma + have hleaf : Set.Subsingleton + ((TwoColorIncidenceGraph G sigma available.gamma + available.delta).neighborSet + (Sum.inl newChoice.vertex)) := by + let : Fintype + ((TwoColorIncidenceGraph G sigma available.gamma + available.delta).neighborSet + (Sum.inl newChoice.vertex)) := Fintype.ofFinite _ + rw [← SimpleGraph.card_neighborSet_eq_degree] at hleafDegree + have hsub := Fintype.card_le_one_iff.mp hleafDegree + intro a ha b hb + exact congrArg Subtype.val + (hsub ⟨a, ha⟩ ⟨b, hb⟩) + have hpathComponent : TwoColorNontrivialPathComponent G sigma + available.gamma available.delta + (Sum.inl newChoice.vertex) := by + refine ⟨⟨hgammaDeltaNe, Sum.inl newChoice.vertex, rfl, + hleaf⟩, pathEdge, hpathEdgeComponent⟩ + have hpathMeetsTn : ∃ v ∈ TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc), + Sum.inl v ∈ TwoColorComponent G sigma available.gamma + available.delta (Sum.inl newChoice.vertex) := + ⟨newChoice.vertex, hnewVertexTn, rfl⟩ + have hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigma := by + rw [hqSucc] + simpa [q] using hsigmaPrevStable + have hgammaEarlierStored : available.gamma ∈ + ett.series.data.stored available.earlier := by + rw [← holdIndex, oldCurrentStored, ← holdGammaAvailable] + simp + have hdeltaEarlierStored : available.delta ∈ + ett.series.data.stored available.earlier := by + rw [← holdIndex, oldCurrentStored, ← holdDeltaAvailable] + simp + let previousPrefixIndex : Fin (originalPrefix.rounds + 2) := + ⟨originalPrefix.rounds, by omega⟩ + have hpreviousPrefixMap : Fin.castLE (by omega) + previousPrefixIndex = q.castSucc.castSucc := by + apply Fin.ext + simp [previousPrefixIndex, q, hr] + have hpreviousToTn : TreeSequenceInitialSegment + (ett.series.data.tree q.castSucc.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + have hseg := originalPrefix.abovePenultimate + rw [hprefixTrees previousPrefixIndex] at hseg + rw [hpreviousPrefixMap] at hseg + simpa [hqSucc] using hseg + have missingPreviousToTn (c : Fin k) + (hc : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.castSucc.castSucc)) := + helper_missingPreviousToTn_1435 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@Tstar) (@hpreviousToTn) (@c) (@hc) + have colorControlAtQ (c : Fin k) + (hc : c ∈ ett.series.data.stored available.earlier) : + c ∈ TreeMissingColors (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.castSucc := by + by_cases hm : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.castSucc.castSucc) + · exact Finset.mem_union_left _ (missingPreviousToTn c hm) + · apply Finset.mem_union_right + unfold TashkinovStoredColors + have hqne : q.castSucc.val ≠ 0 := by + change ett.rounds - 1 ≠ 0 + omega + rw [ite_eq_right hqne] + rw [Finset.mem_sdiff] + refine ⟨?_, hm⟩ + simp only [Finset.mem_biUnion, Finset.mem_univ, true_and] + refine ⟨available.earlier, ?_⟩ + rw [ite_eq_left] + · exact hc + · exact available.earlierAtMost + exact helper_continuation_3509 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@hlower) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) + (@hstrict) (@fstar) (@seed) (@hfinalEdges) (@hadjoin) (@closureTree) (@hseedClosure) + (@hTstarClosure) (@hTnClosure) (@hqSucc) (@hqCast) (@adjoined) (@previousProper) + (@previousOneUncolored) (@previousClosed) (@available) (@currentStored) (@currentEdges) + (@currentKind) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) + (@corr) (@hcorrFinalTree) (@hcorrFinalColor) (@hcorrMP) (@earlierPrefixBound) + (@hearlierMap) (@hearlierPositive) (@hreplacementEarlierKind) (@oldi) (@oldChoice) + (@oldGamma) (@holdTarget) (@holdIndex) (@newi) (@newChoice) (@newGamma) (@newGammaRule) + (@newSecond) (@newSecondProper) (@newSecondStable) (@newExit) (@newCurrentColoring) + (@newCurrentDelta) (@newCurrentGamma) (@hnewIndex) (@htree) (@holdColorCast) (@hends) + (@holdDeltaMissing) (@holdColorNe) (@hnewColorNe) (@hidentifiedDelta) (@hidentifiedGamma) + (@holdDeltaAvailable) (@holdGammaAvailable) (@hnewDeltaAvailable) (@hnewGammaAvailable) + (@hnewVertexOld) (@holdColorConstant) (@hreplacementLastMap) (@hnewPostSigma) + (@hnewDeltaSigma) (@hgammaDeltaNe) (@hnewTreeFinal) (@hnewVertexTn) (@hpathComponent) + (@hpathMeetsTn) (@hsigmaPrevStableQ) (@hgammaEarlierStored) (@hdeltaEarlierStored) + (@colorControlAtQ) +theorem helper_caseContinuation_2517.{u_1, u_2} : + helperCaseContinuation2517Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive hlower sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict fstar seed hfinalEdges hadjoin closureTree hseedClosure + hTstarClosure hTnClosure q hqSucc hqCast adjoined previousProper previousOneUncolored + previousClosed available currentStored currentEdges currentKind adjoinedExactly + hsigmaPrevStable hroundLarge originalPrefix hr hprefixTrees hprefixData corr hcorrFinalTree + hcorrFinalColor hcorrMP earlierPrefixBound earlierPrefix hearlierMap hearlierPositive + hreplacementEarlierKind oldi oldChoice oldGamma oldSecond oldCurrentColoring + oldCurrentStored oldCurrentDelta oldCurrentGamma holdTarget holdIndex newi newChoice + newGamma newGammaRule newSecond newSecondProper newSecondStable newExit newCurrentColoring + newCurrentDelta newCurrentGamma hnewTarget hnewIndex htree oldChoiceOnNew holdVertexCast + holdOtherCast holdColorCast hedgePairs hcolorPairs hends hvertexIdentity pePostStatus + holdDeltaMissing holdGammaNotMissing holdColorNe + obtain ⟨hnewDeltaMissing, hnewGammaNotMissing, hnewColorNe⟩ := + pePostStatus + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc) + newChoice newGamma newSecond newSecondProper + newSecondStable newGammaRule.1 + rw [← oldCurrentColoring] at holdDeltaMissing holdGammaNotMissing + rw [← newCurrentColoring] at hnewDeltaMissing hnewGammaNotMissing + have hbaseTree : originalPrefix.series.data.tree + newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc := by + exact @helper_hbaseTree_1084 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@originalPrefix) (@corr) (@oldi) (@newi) (@htree) + have hbaseColor : originalPrefix.series.data.coloring + newi.succ = ett.series.data.coloring oldi.succ := by + calc + originalPrefix.series.data.coloring newi.succ = + ett.series.data.coloring + (Fin.castLE (by omega) newi.succ) := + (hprefixData newi.succ).1 + _ = ett.series.data.coloring oldi.succ := by + congr 1 + apply Fin.ext + have hvalsOld := congrArg Fin.val holdIndex + have hvalsNew := congrArg Fin.val hnewIndex + have hvalsMap := congrArg Fin.val hearlierMap + simp only [Fin.val_succ] at hvalsOld hvalsNew + simp only [Fin.val_castLE] at hvalsMap ⊢ + omega + have hmissingSameVertex : MissingColors G + (ett.series.data.coloring oldi.succ) oldChoice.vertex = + MissingColors G + (corr.replacementSeries.data.coloring newi.succ) + oldChoice.vertex := by + exact @helper_hmissingSameVertex_1108 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@sigma) (@originalPrefix) (@corr) (@oldi) (@oldChoice) + (@newi) (@hbaseTree) (@hbaseColor) + have hmissingForIdentification : MissingColors G + (ett.series.data.coloring oldi.succ) + oldChoiceOnNew.vertex = + MissingColors G + (corr.replacementSeries.data.coloring newi.succ) + newChoice.vertex := by + calc + MissingColors G (ett.series.data.coloring oldi.succ) + oldChoiceOnNew.vertex = + MissingColors G (ett.series.data.coloring oldi.succ) + oldChoice.vertex := congrArg _ holdVertexCast + _ = MissingColors G + (corr.replacementSeries.data.coloring newi.succ) + oldChoice.vertex := hmissingSameVertex + _ = MissingColors G + (corr.replacementSeries.data.coloring newi.succ) + newChoice.vertex := congrArg _ + (hvertexIdentity.trans holdVertexCast).symm + have holdDeltaForIdentification : oldChoiceOnNew.color ∈ + MissingColors G (ett.series.data.coloring oldi.succ) + oldChoiceOnNew.vertex := by + simpa only [holdColorCast, holdVertexCast] using + holdDeltaMissing + have holdGammaForIdentification : oldGamma ∉ + MissingColors G (ett.series.data.coloring oldi.succ) + oldChoiceOnNew.vertex := by + simpa only [holdVertexCast] using holdGammaNotMissing + have hidentified := TdEarlierPEWitnessIdentification G k e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + newi.castSucc) + (ett.series.data.coloring oldi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc) + oldChoiceOnNew newChoice oldGamma newGamma + (ett.series.data.coloring oldi.succ) + (corr.replacementSeries.data.coloring newi.succ) + hedgePairs hcolorPairs hmissingForIdentification + holdDeltaForIdentification holdGammaForIdentification + hnewDeltaMissing hnewGammaNotMissing + rcases hidentified with ⟨hidentifiedEdge, hidentifiedVertex, + hidentifiedOther, hidentifiedDelta, hidentifiedGamma⟩ + have holdDeltaAvailable : oldChoice.color = available.delta := by + exact Option.some.inj (oldCurrentDelta.symm.trans + ((congrArg ett.series.data.delta holdIndex).trans + available.earlierDelta)) + have holdGammaAvailable : oldGamma = available.gamma := by + exact Option.some.inj (oldCurrentGamma.symm.trans + ((congrArg ett.series.data.gamma holdIndex).trans + available.earlierGamma)) + have hnewDeltaAvailable : newChoice.color = available.delta := by + exact hidentifiedDelta.trans + (holdColorCast.trans holdDeltaAvailable) + have hnewGammaAvailable : newGamma = available.gamma := by + exact hidentifiedGamma.trans holdGammaAvailable + have hnewVertexOld : newChoice.vertex = oldChoice.vertex := + hidentifiedVertex.trans holdVertexCast + have hnewOtherOld : newChoice.otherEndpoint = + oldChoice.otherEndpoint := + hidentifiedOther.trans holdOtherCast + have reStepColoring : ∀ {rounds' : ℕ} + {input' : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds' e0 input') + (j : Fin rounds'), + series.data.kind j.succ = some TashkinovExtensionKind.RE → + series.data.coloring j.succ = + series.data.coloring j.castSucc := by + exact @helper_reStepColoring_2269 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@adjoined) + (@available) (@adjoinedExactly) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@oldi) + (@oldChoice) (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) + have reIntervalColoring : ∀ {rounds' : ℕ} + {input' : PartialEdgeColoring E k} + (series : TashkinovSeries G k rounds' e0 input') + (a b : Fin (rounds' + 1)), + a.val ≤ b.val → + (∀ j : Fin (rounds' + 1), a.val < j.val → + j.val ≤ b.val → + series.data.kind j = some TashkinovExtensionKind.RE) → + series.data.coloring b = series.data.coloring a := by + exact @helper_reIntervalColoring_2281 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@oldi) (@oldChoice) + (@oldGamma) (@newi) (@newChoice) (@newGamma) (@htree) (@reStepColoring) + have holdColorConstant : ett.series.data.coloring q.castSucc = + ett.series.data.coloring oldi.succ := by + exact @helper_holdColorConstant_2295 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@hqCast) + (@available) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@oldi) (@oldChoice) + (@oldGamma) (@holdTarget) (@holdIndex) (@newi) (@newChoice) (@newGamma) (@htree) + (@reIntervalColoring) + let replacementLast : Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds + have hreplacementLastMap : Fin.castLE (by omega) + replacementLast = q.castSucc := by + apply Fin.ext + simp [replacementLast, q, hr] + have hreplacementColorConstant : + corr.replacementSeries.data.coloring replacementLast = + corr.replacementSeries.data.coloring newi.succ := by + apply reIntervalColoring corr.replacementSeries newi.succ + replacementLast + · have hvals := congrArg Fin.val hnewIndex + simp [replacementLast] at hvals ⊢ + · intro j hjLower hjUpper + rw [corr.extensionKindsAgree j, + (hprefixData j).2.2.2.1] + apply available.interveningRevisiting + (Fin.castLE (by omega) j) + · simp only [Fin.val_castLE] + omega + · have hvalsNew := congrArg Fin.val hnewIndex + have hvalsMap := congrArg Fin.val hearlierMap + simp only [Fin.val_succ] at hvalsNew + simp only [Fin.val_castLE] at hvalsMap ⊢ + omega + · have hvalsLast := congrArg Fin.val hreplacementLastMap + simp only [Fin.val_castLE] at hvalsLast ⊢ + omega + exact @helper_continuation_2808 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@hlower) + (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) + (@fstar) (@seed) (@hfinalEdges) (@hadjoin) (@closureTree) (@hseedClosure) (@hTstarClosure) + (@hTnClosure) (@hqSucc) (@hqCast) (@adjoined) (@previousProper) (@previousOneUncolored) + (@previousClosed) (@available) (@currentStored) (@currentEdges) (@currentKind) + (@adjoinedExactly) (@hsigmaPrevStable) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixTrees) (@hprefixData) (@corr) (@hcorrFinalTree) (@hcorrFinalColor) (@hcorrMP) + (@earlierPrefixBound) (@hearlierMap) (@hearlierPositive) (@hreplacementEarlierKind) (@oldi) + (@oldChoice) (@oldGamma) (@oldCurrentStored) (@holdTarget) (@holdIndex) (@newi) + (@newChoice) (@newGamma) (@newGammaRule) (@newSecond) (@newSecondProper) (@newSecondStable) + (@newExit) (@newCurrentColoring) (@newCurrentDelta) (@newCurrentGamma) (@hnewTarget) + (@hnewIndex) (@htree) (@holdColorCast) (@hends) (@holdDeltaMissing) (@holdColorNe) + (@hnewDeltaMissing) (@hnewGammaNotMissing) (@hnewColorNe) (@hidentifiedDelta) + (@hidentifiedGamma) (@holdDeltaAvailable) (@holdGammaAvailable) (@hnewDeltaAvailable) + (@hnewGammaAvailable) (@hnewVertexOld) (@holdColorConstant) (@hreplacementLastMap) + (@hreplacementColorConstant) +theorem helper_branch_4795.{u_1, u_2} : + helperBranch4795Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive hlower sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict fstar seed hfinalEdges hadjoin closureTree hseedClosure + hTstarClosure hTnClosure q hqSucc hqCast adjoined previousProper previousOneUncolored + previousClosed available currentStored currentEdges currentKind adjoinedExactly + hsigmaPrevStable hroundLarge originalPrefix hr hprefixTrees hprefixData corr hcorrFinalTree + hcorrFinalColor hcorrMP earlierPrefixBound earlierPrefix hearlierMap hearlierPositive + hreplacementEarlierKind oldi oldChoice oldGamma oldGammaRule oldSecond oldSecondProper + oldSecondStable oldCurrentColoring oldCurrentStored oldCurrentEdges oldCurrentDelta + oldCurrentGamma holdTarget holdIndex newi newChoice newGamma newGammaRule newSecond + newSecondProper newSecondStable newExit newCurrentColoring newCurrentStored newCurrentEdges + newCurrentDelta newCurrentGamma hnewTarget + have hnewIndex : newi.succ = earlierPrefix := by + simpa using hnewTarget.symm + have htree : + corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree oldi.succ.castSucc := by + calc + corr.replacementSeries.data.tree newi.succ.castSucc = + originalPrefix.series.data.tree newi.succ.castSucc := + corr.ladderTreesAgree newi + _ = ett.series.data.tree + (Fin.castLE (by omega) newi.succ.castSucc) := + hprefixTrees newi.succ.castSucc + _ = ett.series.data.tree oldi.succ.castSucc := by + congr 1 + apply Fin.ext + have hvalsOld := congrArg Fin.val holdIndex + have hvalsNew := congrArg Fin.val hnewIndex + have hvalsMap := congrArg Fin.val hearlierMap + simp only [Fin.val_succ] at hvalsOld hvalsNew + simp only [Fin.val_castLE] at hvalsMap + simp only [Fin.val_castLE, Fin.val_castSucc] + omega + let oldChoiceOnNew : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) := + transportDefectiveChoice htree.symm oldChoice + have transportChoiceFields : ∀ + {A B : TreeSequence G e0} (hAB : A = B) + (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 A C phi), + (hAB ▸ ch).edge = ch.edge ∧ + (hAB ▸ ch).vertex = ch.vertex ∧ + (hAB ▸ ch).otherEndpoint = ch.otherEndpoint ∧ + (hAB ▸ ch).color = ch.color := by + intro A B hAB C phi ch + subst B + exact ⟨rfl, rfl, rfl, rfl⟩ + have htransport := transportChoiceFields htree.symm + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) oldChoice + have holdEdgeCast : oldChoiceOnNew.edge = oldChoice.edge := by + exact htransport.1 + have holdVertexCast : oldChoiceOnNew.vertex = oldChoice.vertex := by + exact htransport.2.1 + have holdOtherCast : oldChoiceOnNew.otherEndpoint = + oldChoice.otherEndpoint := by + exact htransport.2.2.1 + have holdColorCast : oldChoiceOnNew.color = oldChoice.color := by + exact htransport.2.2.2 + have hdataEdges : corr.replacementSeries.data.connectingEdges + earlierPrefix = + ett.series.data.connectingEdges available.earlier := by + calc + corr.replacementSeries.data.connectingEdges earlierPrefix = + originalPrefix.series.data.connectingEdges earlierPrefix := + corr.connectingEdgesAgree earlierPrefix + _ = ett.series.data.connectingEdges + (Fin.castLE (by omega) earlierPrefix) := + (hprefixData earlierPrefix).2.2.1 + _ = ett.series.data.connectingEdges available.earlier := by + rw [hearlierMap] + have hdataStored : corr.replacementSeries.data.stored + earlierPrefix = ett.series.data.stored available.earlier := by + calc + corr.replacementSeries.data.stored earlierPrefix = + originalPrefix.series.data.stored earlierPrefix := + corr.storedColorsAgree earlierPrefix + _ = ett.series.data.stored + (Fin.castLE (by omega) earlierPrefix) := + (hprefixData earlierPrefix).2.1 + _ = ett.series.data.stored available.earlier := by + rw [hearlierMap] + have hedgePairs : ({oldChoiceOnNew.edge} : Finset E) = + {newChoice.edge} := by + have holdEdges : ett.series.data.connectingEdges + available.earlier = {oldChoice.edge} := by + simpa only [holdIndex] using oldCurrentEdges + have hnewEdges : corr.replacementSeries.data.connectingEdges + earlierPrefix = {newChoice.edge} := by + simpa only [hnewIndex] using newCurrentEdges + simpa only [holdEdgeCast] using + holdEdges.symm.trans (hdataEdges.symm.trans hnewEdges) + have hcolorPairs : + ({oldChoiceOnNew.color, oldGamma} : Finset (Fin k)) = + {newChoice.color, newGamma} := by + have holdStored : ett.series.data.stored available.earlier = + {oldChoice.color, oldGamma} := by + simpa only [holdIndex] using oldCurrentStored + have hnewStored : corr.replacementSeries.data.stored + earlierPrefix = {newChoice.color, newGamma} := by + simpa only [hnewIndex] using newCurrentStored + simpa only [holdColorCast] using + holdStored.symm.trans (hdataStored.symm.trans hnewStored) + have hedgeIdentity : newChoice.edge = oldChoiceOnNew.edge := by + apply Finset.mem_singleton.mp + rw [hedgePairs] + exact Finset.mem_singleton_self _ + have hends : s(oldChoiceOnNew.vertex, + oldChoiceOnNew.otherEndpoint) = + s(newChoice.vertex, newChoice.otherEndpoint) := by + calc + s(oldChoiceOnNew.vertex, oldChoiceOnNew.otherEndpoint) = + G.ends oldChoiceOnNew.edge := oldChoiceOnNew.edgeEnds.symm + _ = G.ends newChoice.edge := congrArg G.ends hedgeIdentity.symm + _ = s(newChoice.vertex, newChoice.otherEndpoint) := + newChoice.edgeEnds + have hvertexIdentity : newChoice.vertex = + oldChoiceOnNew.vertex := by + rcases Sym2.eq_iff.mp hends with hstraight | hcross + · exact hstraight.1.symm + · exfalso + exact newChoice.otherOutside + (hcross.1 ▸ oldChoiceOnNew.vertexDefective.1) + have hotherIdentity : newChoice.otherEndpoint = + oldChoiceOnNew.otherEndpoint := by + rcases Sym2.eq_iff.mp hends with hstraight | hcross + · exact hstraight.2.symm + · exfalso + exact oldChoiceOnNew.otherOutside + (hcross.2 ▸ newChoice.vertexDefective.1) + have pePostStatus := + helper_pePostStatus_2097 (@G) (@k) (@e0) + obtain ⟨holdDeltaMissing, holdGammaNotMissing, holdColorNe⟩ := + pePostStatus + (ett.series.data.tree oldi.succ.castSucc) + (TashkinovStoredColors ett.series.data oldi.castSucc) + (ett.series.data.coloring oldi.castSucc) oldChoice oldGamma + oldSecond oldSecondProper oldSecondStable oldGammaRule.1 + exact helper_caseContinuation_2517 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@hlower) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) + (@hTnTstar) (@hstrict) (@fstar) (@seed) (@hfinalEdges) (@hadjoin) (@closureTree) + (@hseedClosure) (@hTstarClosure) (@hTnClosure) (@hqSucc) (@hqCast) (@adjoined) + (@previousProper) (@previousOneUncolored) (@previousClosed) (@available) (@currentStored) + (@currentEdges) (@currentKind) (@adjoinedExactly) (@hsigmaPrevStable) (@hroundLarge) + (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) (@hcorrFinalTree) + (@hcorrFinalColor) (@hcorrMP) (@earlierPrefixBound) (@hearlierMap) (@hearlierPositive) + (@hreplacementEarlierKind) (@oldi) (@oldChoice) (@oldGamma) (@oldSecond) + (@oldCurrentColoring) (@oldCurrentStored) (@oldCurrentDelta) (@oldCurrentGamma) + (@holdTarget) (@holdIndex) (@newi) (@newChoice) (@newGamma) (@newGammaRule) (@newSecond) + (@newSecondProper) (@newSecondStable) (@newExit) (@newCurrentColoring) (@newCurrentDelta) + (@newCurrentGamma) (@hnewTarget) (@hnewIndex) (@htree) (@holdVertexCast) (@holdOtherCast) + (@holdColorCast) (@hedgePairs) (@hcolorPairs) (@hends) (@hvertexIdentity) (@pePostStatus) + (@holdDeltaMissing) (@holdGammaNotMissing) (@holdColorNe) + +theorem helper_branch_5611.{u_1, u_2} : + helperBranch5611Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive hlower sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict fstar seed hfinalEdges hadjoin closureTree hseedClosure + hTstarClosure hTnClosure q hqSucc hqCast adjoined previousProper previousOneUncolored + previousClosed available currentStored currentEdges currentKind adjoinedExactly + hsigmaPrevStable hpositivePrefix + rcases hpositivePrefix with ⟨hroundLarge, originalPrefix, hr, + hprefixMP, hprefixTrees, hprefixData, corr, hcorrFinalTree, + hcorrFinalColor, hcorrMP⟩ + have earlierPrefixBound : available.earlier.val < originalPrefix.rounds + 1 := by + rw [hr] + have hle := available.earlierAtMost + change available.earlier.val ≤ q.castSucc.val at hle + simp [q] at hle ⊢ + omega + let earlierPrefix : Fin (originalPrefix.rounds + 1) := + ⟨available.earlier.val, earlierPrefixBound⟩ + have hearlierMap : Fin.castLE (by omega) earlierPrefix = + available.earlier := by + apply Fin.ext + rfl + have hearlierPositive : 0 < earlierPrefix.val := + available.earlierPositive + have hprefixEarlierKind : originalPrefix.series.data.kind + earlierPrefix = some TashkinovExtensionKind.PE := by + rw [(hprefixData earlierPrefix).2.2.2.1, hearlierMap] + exact available.earlierPE + have hreplacementEarlierKind : corr.replacementSeries.data.kind + earlierPrefix = some TashkinovExtensionKind.PE := by + rw [corr.extensionKindsAgree earlierPrefix] + exact hprefixEarlierKind + have holdStep := ett.series.certified available.earlier + generalize holdTarget : available.earlier = oldTarget at holdStep + cases holdStep with + | initial tripleOld seedLengthOld initialColoringOld initialStoredOld + initialEdgesOld initialKindOld initialVertexOld initialOutsideOld + initialDeltaOld initialGammaOld initialClosureOld => + have hbad := initialKindOld.symm.trans + (by simpa [holdTarget] using available.earlierPE) + simp at hbad + | SE oldi oldPreviousProper oldPreviousOne oldPreviousClosed + oldPreviousNotStrong oldNoRE oldChoice oldAlternative + oldCurrentColoring oldCurrentStored oldCurrentEdges oldCurrentKind + oldCurrentVertex oldCurrentOutside oldCurrentDelta oldCurrentGamma + oldAdjoined oldAdjoinedExactly oldClosedExtension + oldOrderedExtension oldStrictExtension => + have hbad := oldCurrentKind.symm.trans + (by simpa [holdTarget] using available.earlierPE) + cases hbad + | RE oldi oldPreviousProper oldPreviousOne oldPreviousClosed + oldPreviousNotStrong oldAvailable oldCurrentColoring + oldCurrentStored oldCurrentEdges oldCurrentKind oldCurrentVertex + oldCurrentOutside oldCurrentDelta oldCurrentGamma oldAdjoined + oldAdjoinedExactly oldClosedExtension oldOrderedExtension + oldStrictExtension => + have hbad := oldCurrentKind.symm.trans + (by simpa [holdTarget] using available.earlierPE) + cases hbad + | PE oldi oldPreviousProper oldPreviousOne oldPreviousClosed + oldPreviousNotStrong oldNoRE oldChoice oldAlternativeFails oldGamma + oldGammaRule oldSecond oldSecondProper oldSecondOne + oldSecondStable oldExit oldCurrentColoring oldCurrentProper + oldCurrentOne oldCurrentStored oldCurrentEdges oldCurrentKind + oldCurrentVertex oldCurrentOutside oldCurrentDelta oldCurrentGamma + oldClosedExtension oldOrderedExtension oldStrictExtension => + have holdIndex : oldi.succ = available.earlier := by + simpa using holdTarget.symm + have hnewStep := corr.replacementSeries.certified earlierPrefix + generalize hnewTarget : earlierPrefix = newTarget at hnewStep + cases hnewStep with + | initial tripleNew seedLengthNew initialColoringNew initialStoredNew + initialEdgesNew initialKindNew initialVertexNew initialOutsideNew + initialDeltaNew initialGammaNew initialClosureNew => + have hbad := initialKindNew.symm.trans + (by simpa [hnewTarget] using hreplacementEarlierKind) + simp at hbad + | SE newi newPreviousProper newPreviousOne newPreviousClosed + newPreviousNotStrong newNoRE newChoice newAlternative + newCurrentColoring newCurrentStored newCurrentEdges + newCurrentKind newCurrentVertex newCurrentOutside + newCurrentDelta newCurrentGamma newAdjoined + newAdjoinedExactly newClosedExtension newOrderedExtension + newStrictExtension => + have hbad := newCurrentKind.symm.trans + (by simpa [hnewTarget] using hreplacementEarlierKind) + cases hbad + | RE newi newPreviousProper newPreviousOne newPreviousClosed + newPreviousNotStrong newAvailable newCurrentColoring + newCurrentStored newCurrentEdges newCurrentKind + newCurrentVertex newCurrentOutside newCurrentDelta + newCurrentGamma newAdjoined newAdjoinedExactly + newClosedExtension newOrderedExtension newStrictExtension => + have hbad := newCurrentKind.symm.trans + (by simpa [hnewTarget] using hreplacementEarlierKind) + cases hbad + | PE newi newPreviousProper newPreviousOne newPreviousClosed + newPreviousNotStrong newNoRE newChoice newAlternativeFails + newGamma newGammaRule newSecond newSecondProper newSecondOne + newSecondStable newExit newCurrentColoring newCurrentProper + newCurrentOne newCurrentStored newCurrentEdges newCurrentKind + newCurrentVertex newCurrentOutside newCurrentDelta + newCurrentGamma newClosedExtension newOrderedExtension + newStrictExtension => + exact @helper_branch_4795 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + (@hpositive) (@hlower) (@sigma) (@hsigmaProper) (@hsigmaOne) + (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@fstar) (@seed) + (@hfinalEdges) (@hadjoin) (@closureTree) (@hseedClosure) (@hTstarClosure) + (@hTnClosure) (@hqSucc) (@hqCast) (@adjoined) (@previousProper) + (@previousOneUncolored) (@previousClosed) (@available) (@currentStored) + (@currentEdges) (@currentKind) (@adjoinedExactly) (@hsigmaPrevStable) + (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) + (@corr) (@hcorrFinalTree) (@hcorrFinalColor) (@hcorrMP) + (@earlierPrefixBound) (@hearlierMap) (@hearlierPositive) + (@hreplacementEarlierKind) (@oldi) (@oldChoice) (@oldGamma) + (@oldGammaRule) (@oldSecond) (@oldSecondProper) (@oldSecondStable) + (@oldCurrentColoring) (@oldCurrentStored) (@oldCurrentEdges) + (@oldCurrentDelta) (@oldCurrentGamma) (@holdTarget) (@holdIndex) (@newi) + (@newChoice) (@newGamma) (@newGammaRule) (@newSecond) (@newSecondProper) + (@newSecondStable) (@newExit) (@newCurrentColoring) (@newCurrentStored) + (@newCurrentEdges) (@newCurrentDelta) (@newCurrentGamma) (@hnewTarget) + +end GoldbergSeymour.TerminalRebuild + +namespace GoldbergSeymour + +open TerminalRebuild + +theorem TdTerminalRERebuild {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + ett.series.data.kind n = some TashkinovExtensionKind.RE → + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring Tn + (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma → + ModColoring ett sigma := by + classical + dsimp + intro hterminalRE sigma hsigmaProper hsigmaOne hsigmaStable + refine ⟨hsigmaProper, hsigmaOne, ?_⟩ + intro Tstar hTnTstar hstrict heligible + rcases heligible with hparallel | hre + · rw [hterminalRE] at hparallel + simp at hparallel + rcases hre with ⟨hkind, fstar, seed, hfinalEdges, hadjoin, hroute⟩ + obtain ⟨closureTree, hclosure⟩ := + TashkinovClosureExists sigma Tstar + have hrouteClosure : TashkinovAugmentationSequence sigma seed closureTree := + hroute.trans hclosure.1 + have hseedClosure : TashkinovClosure sigma seed closureTree := + ⟨hrouteClosure, hclosure.2⟩ + have hTstarClosure : TreeSequenceInitialSegment Tstar closureTree := + TashkinovAugmentationSequenceInitialSegment sigma Tstar closureTree hclosure.1 + have hTnClosure : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree := by + exact @helper_hTnClosure_110 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@Tstar) (@hTnTstar) (@closureTree) + (@hTstarClosure) + let q : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ + have hqSucc : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + have hqCast : q.castSucc = + (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) := by + apply Fin.ext + rfl + have hfinalStep := ett.series.certified (Fin.last ett.rounds) + generalize htarget : (Fin.last ett.rounds : Fin (ett.rounds + 1)) = + target at hfinalStep + cases hfinalStep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val htarget + simp at hv + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hbad := currentKind.symm.trans (by simpa [htarget] using hterminalRE) + cases hbad + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hbad := currentKind.symm.trans (by simpa [htarget] using hterminalRE) + cases hbad + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i = q := by + exact @helper_hi_768 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@i) (@htarget) + subst i + have hreKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.RE := by + simpa [htarget] using currentKind + have hprefix := TdReplacementPrefixExact G k e0 input T generating ett + hMP hpositive hlower sigma hsigmaProper hsigmaOne + (by simpa [hqSucc] using hsigmaStable) + obtain ⟨sigmaPrev, hsigmaPrevProper, hsigmaPrevOne, + hsigmaPrevStable, hsigmaPrevEq, hparallelPrev, hprefixCases⟩ := hprefix + have hsigmaPrevSigma : sigmaPrev = sigma := + hsigmaPrevEq (Or.inr (by simpa [hqSucc] using hreKind)) + subst sigmaPrev + rcases hprefixCases with hzero | hpositivePrefix + · exact @helper_branch_787 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@hqCast) + (@available) (@hzero) + · exact @helper_branch_5611 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@hlower) (@sigma) + (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@fstar) + (@seed) (@hfinalEdges) (@hadjoin) (@closureTree) (@hseedClosure) (@hTstarClosure) + (@hTnClosure) (@hqSucc) (@hqCast) (@adjoined) (@previousProper) (@previousOneUncolored) + (@previousClosed) (@available) (@currentStored) (@currentEdges) (@currentKind) + (@adjoinedExactly) (@hsigmaPrevStable) (@hpositivePrefix) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TdTerminalSEPERebuild.lean b/LeanPool/GoldbergSeymour/TdTerminalSEPERebuild.lean new file mode 100644 index 0000000000..3768f20ab9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TdTerminalSEPERebuild.lean @@ -0,0 +1,3305 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TerminalSeriesRebuildTransport + +/-! +# Td Terminal SEPERebuild + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open TerminalSeriesRebuild + +private abbrev helperCaseContinuation422Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + ∀ (closureTree : TreeSequence G e0), + TreeSequenceInitialSegment Tstar closureTree → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + ∀ + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = ({ choice.color } : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.SE → + ∀ (sigmaPrev : PartialEdgeColoring E k), + (1 : ℕ) < ett.rounds → + ∀ + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) → + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + (0 : ℕ) < originalPrefix.rounds → + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree q.succ.castSucc → + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := + some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : + TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma; + TashkinovSeriesStep G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput appendedData + (Fin.last (originalPrefix.rounds + (1 : ℕ))) → + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev helperCaseContinuation1078Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + ∀ (closureTree : TreeSequence G e0), + TreeSequenceInitialSegment Tstar closureTree → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = + (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∀ (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (a b : V ⊕ E) (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), + (1 : ℕ) < ett.rounds → + ∀ + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) → + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + (0 : ℕ) < originalPrefix.rounds → + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree q.succ.castSucc → + let newStored : Finset (Fin k) := + (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := + some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : + TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma; + TashkinovSeriesStep G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput appendedData + (Fin.last (originalPrefix.rounds + (1 : ℕ))) → + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev helperBranch1075Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + ∀ (closureTree : TreeSequence G e0), + TashkinovClosure sigma Tstar closureTree → + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = + (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∀ (sigmaPrev : PartialEdgeColoring E k) + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) + (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev) + (hchoiceDefective : + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hsigmaPrevSelf : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + ColoredVertexSetClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + sigma = + TwoColorComponentSwap G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) → + let H : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (a b : V ⊕ E) (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), + TreeExit (ett.series.data.tree q.succ.castSucc) sigmaPrev gamma choice.color + choice.vertex → + (1 : ℕ) < ett.rounds → + ∀ + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) → + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (hcorrFinalColor : + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigmaPrev), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + (0 : ℕ) < originalPrefix.rounds → + ∀ + (hreplacementCurrentTree : + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree q.succ.castSucc) + (hreplacementStored : + TashkinovStoredColors corr.replacementSeries.data replacementLast = + TashkinovStoredColors ett.series.data q.castSucc), + let replacementChoice : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree replacementLast.succ) + (TashkinovStoredColors corr.replacementSeries.data replacementLast) + (corr.replacementSeries.data.coloring replacementLast) := + helperReplacementChoice5196 G k e0 input T generating ett hpositive + previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf originalPrefix corr hcorrFinalColor + hreplacementCurrentTree hreplacementStored; + ¬Nonempty + (RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast) → + (∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring + (corr.replacementSeries.data.tree replacementLast.succ) + (insert replacementChoice.color + (TashkinovStoredColors corr.replacementSeries.data + replacementLast) : + Finset (Fin k)) + replacementChoice.selected rho ∧ + ¬Disjoint (MissingColors G rho replacementChoice.otherEndpoint) + (TreeMissingColors rho + (corr.replacementSeries.data.tree replacementLast.succ))) → + ParallelExtensionColor corr.replacementSeries.data replacementLast + replacementChoice.selected replacementChoice.vertex gamma → + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev helperCaseContinuation1201Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar ∨ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f + seed ∧ + TashkinovAugmentationSequence sigma seed Tstar) → + ∀ (closureTree : TreeSequence G e0), + TashkinovClosure sigma Tstar closureTree → + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0), + ¬Nonempty (RevisitingExtensionCertificate ett.series.data q.castSucc) → + ∀ + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), + ParallelExtensionColor ett.series.data q.castSucc choice.selected + choice.vertex gamma → + ett.series.data.stored q.succ = + (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∀ (sigmaPrev : PartialEdgeColoring E k) + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0), + ((ett.rounds = (1 : ℕ) ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : + TashkinovSeries G k (0 : ℕ) e0 prefixInput), + zeroPrefix.data.tree (Fin.last (1 : ℕ)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigmaPrev) ∨ + (1 : ℕ) < ett.rounds ∧ + ∃ (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix ∧ + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) ∧ + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) i)) ∧ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix + sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigmaPrev ∧ + MaximumProperty corr.replacementETT) → + ∀ + (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev), + choice.vertex ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) → + sigmaPrev = + TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex) → + ∀ + (hchoiceDefective : + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color) + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color) + (hsigmaPrevSelf : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev + sigmaPrev), + let newChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := + helperNewChoice4049 G k e0 input T generating ett hpositive + previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf; + ColoredVertexSetClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) → + (∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) + (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : + Finset (Fin k)) + newChoice.selected rho ∧ + ¬Disjoint (MissingColors G rho newChoice.otherEndpoint) + (TreeMissingColors rho + (ett.series.data.tree q.succ.castSucc))) → + gamma ≠ choice.color → + (∀ (f : E), + Sum.inr f ∈ + TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) → + sigma f = some gamma ∨ sigma f = some choice.color) → + gamma ∈ MissingColors G sigmaPrev choice.vertex → + TwoColorIncidenceGraph G sigmaPrev gamma choice.color = + TwoColorIncidenceGraph G sigma gamma choice.color → + (∀ + w ∈ + TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc), + Sum.inl w ∈ + TwoColorComponent G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) ↔ + w = choice.vertex) → + Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma + Tstar) + +private abbrev helperBranch1497Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + ∀ (closureTree : TreeSequence G e0), + TashkinovClosure sigma Tstar closureTree → + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + ∀ (adjoined : TreeSequence G e0) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = ({ choice.color } : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.SE → + ∀ (sigmaPrev : PartialEdgeColoring E k) + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) + (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev), + sigmaPrev = sigma → + ∀ + (hchoiceDefective : + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hsigmaPrevSelf : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + ColoredVertexSetClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → + (1 : ℕ) < ett.rounds → + ∀ + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE (by omega) i)) → + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = + ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) → + ∀ + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (hcorrFinalColor : + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = + sigmaPrev), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + (0 : ℕ) < originalPrefix.rounds → + ∀ + (hreplacementCurrentTree : + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree q.succ.castSucc) + (hreplacementStored : + TashkinovStoredColors corr.replacementSeries.data replacementLast = + TashkinovStoredColors ett.series.data q.castSucc), + let replacementChoice : + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree replacementLast.succ) + (TashkinovStoredColors corr.replacementSeries.data replacementLast) + (corr.replacementSeries.data.coloring replacementLast) := + helperReplacementChoice3411 G k e0 input T generating ett hpositive + previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf originalPrefix corr hcorrFinalColor + hreplacementCurrentTree hreplacementStored; + ¬Nonempty + (RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast) → + (∀ (pi : PartialEdgeColoring E k), + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring + (corr.replacementSeries.data.tree replacementLast.succ) + (insert replacementChoice.color + (TashkinovStoredColors corr.replacementSeries.data + replacementLast) : + Finset (Fin k)) + replacementChoice.selected pi → + Disjoint (MissingColors G pi replacementChoice.otherEndpoint) + (TreeMissingColors pi + (corr.replacementSeries.data.tree replacementLast.succ))) → + ((ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = + ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed Tstar) → + Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev helperBranch1661Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar ∨ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f + seed ∧ + TashkinovAugmentationSequence sigma seed Tstar) → + ∀ (closureTree : TreeSequence G e0), + TashkinovClosure sigma Tstar closureTree → + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + q.castSucc = (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))) → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma → + ∀ (i : Fin ett.rounds), + IsProperEdgeColoring G (ett.series.data.coloring i.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring i.castSucc) e0 → + ColoredVertexSetClosed G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) → + ¬Nonempty (RevisitingExtensionCertificate ett.series.data i.castSucc) → + ∀ + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)), + (∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree i.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data i.castSucc) : + Finset (Fin k)) + choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (ett.series.data.tree i.succ.castSucc))) → + ∀ (gamma : Fin k), + ParallelExtensionColor ett.series.data i.castSucc choice.selected + choice.vertex gamma → + ∀ (secondStable : PartialEdgeColoring E k), + IsProperEdgeColoring G secondStable → + IsOneEdgeUncolored secondStable e0 → + StableColoring (ett.series.data.tree i.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data i.castSucc) : + Finset (Fin k)) + choice.selected secondStable → + TreeExit (ett.series.data.tree i.succ.castSucc) secondStable + gamma choice.color choice.vertex → + ett.series.data.coloring i.succ = + TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) → + IsProperEdgeColoring G (ett.series.data.coloring i.succ) → + IsOneEdgeUncolored (ett.series.data.coloring i.succ) e0 → + ett.series.data.stored i.succ = + (insert choice.color ({ gamma } : Finset (Fin k)) : + Finset (Fin k)) → + ett.series.data.connectingEdges i.succ = + ({ choice.edge } : Finset E) → + ett.series.data.kind i.succ = + some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex i.succ = some choice.vertex → + ett.series.data.outsideVertex i.succ = + some choice.otherEndpoint → + ett.series.data.delta i.succ = some choice.color → + ett.series.data.gamma i.succ = some gamma → + TashkinovClosure (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ) → + TreeSequenceInitialSegment + (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ) → + (ett.series.data.tree i.succ.castSucc).length < + (ett.series.data.tree i.succ.succ).length → + Fin.last ett.rounds = i.succ → + Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett + sigma Tstar) + +private abbrev helperBranch2237Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length → + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar ∨ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f + seed ∧ + TashkinovAugmentationSequence sigma seed Tstar) → + ∀ (closureTree : TreeSequence G e0), + TashkinovClosure sigma Tstar closureTree → + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ : + Fin ett.rounds); + q.succ = Fin.last ett.rounds → + q.castSucc = (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))) → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma → + ∀ (i : Fin ett.rounds), + IsProperEdgeColoring G (ett.series.data.coloring i.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring i.castSucc) e0 → + ColoredVertexSetClosed G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) → + ¬ColoredVertexSetStronglyClosed G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) → + ¬Nonempty (RevisitingExtensionCertificate ett.series.data i.castSucc) → + ∀ + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)), + (∀ (pi : PartialEdgeColoring E k), + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree i.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data i.castSucc) : + Finset (Fin k)) + choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi (ett.series.data.tree i.succ.castSucc))) → + ett.series.data.coloring i.succ = choice.selected → + ett.series.data.stored i.succ = ({ choice.color } : Finset (Fin k)) → + ett.series.data.connectingEdges i.succ = + ({ choice.edge } : Finset E) → + ett.series.data.kind i.succ = some TashkinovExtensionKind.SE → + ett.series.data.chosenVertex i.succ = some choice.vertex → + ett.series.data.outsideVertex i.succ = some choice.otherEndpoint → + ett.series.data.delta i.succ = some choice.color → + ett.series.data.gamma i.succ = none → + ∀ (adjoined : TreeSequence G e0), + TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) + choice.edge adjoined → + TashkinovClosure (ett.series.data.coloring i.succ) adjoined + (ett.series.data.tree i.succ.succ) → + TreeSequenceInitialSegment + (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ) → + (ett.series.data.tree i.succ.castSucc).length < + (ett.series.data.tree i.succ.succ).length → + Fin.last ett.rounds = i.succ → + Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma + Tstar) + +private abbrev helperContinuation1015Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k) (hsigmaProper : IsProperEdgeColoring G sigma) + (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) + (Tstar : TreeSequence G e0) + (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (closureTree : TreeSequence G e0) (hTstarClosure : TreeSequenceInitialSegment Tstar closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (currentStored : ett.series.data.stored q.succ = ({ choice.color } : Finset (Fin k))) + (currentEdges : ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E)) + (currentKind : ett.series.data.kind q.succ = some TashkinovExtensionKind.SE) + (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hprefixTrees : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) + (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (horiginalPositive : (0 : ℕ) < originalPrefix.rounds), + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + ∀ + (extendedSeries : + TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 corr.replacementInput) + (hextendedData : + extendedSeries.data = + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma) + (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : + {a b : ℕ} → + (h : a = b) → + (S : TashkinovSeries G k a e0 corr.replacementInput) → + TashkinovSeries G k b e0 corr.replacementInput := + fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) ↦ (h ▸ S); + ∀ + (castSeriesTree : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (2 : ℕ))), (castSeries h S).data.tree i = S.data.tree (Fin.cast (by omega) i)) + (castSeriesColoring : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast (by omega) i)) + (castSeriesStored : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.stored i = S.data.stored (Fin.cast (by omega) i)) + (castSeriesEdges : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast (by omega) i)) + (castSeriesKind : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.kind i = S.data.kind (Fin.cast (by omega) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := + castSeries hroundsEq extendedSeries; + ∀ + (hfinalPenultimateTree : + finalSeries.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (hfinalTree : finalSeries.data.tree (Fin.last (ett.rounds + (1 : ℕ))) = closureTree), + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev helperContinuation1218Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k) (hsigmaProper : IsProperEdgeColoring G sigma) + (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) + (Tstar : TreeSequence G e0) + (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (closureTree : TreeSequence G e0) (hTstarClosure : TreeSequenceInitialSegment Tstar closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) (gamma : Fin k) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (currentStored : + ett.series.data.stored q.succ = + (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k))) + (currentEdges : ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E)) + (currentKind : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hprefixTrees : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) + (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (horiginalPositive : (0 : ℕ) < originalPrefix.rounds), + let newStored : Finset (Fin k) := + (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + ∀ + (extendedSeries : + TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 corr.replacementInput) + (hextendedData : + extendedSeries.data = + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma) + (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : + {a b : ℕ} → + (h : a = b) → + (S : TashkinovSeries G k a e0 corr.replacementInput) → + TashkinovSeries G k b e0 corr.replacementInput := + fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) ↦ (h ▸ S); + ∀ + (castSeriesTree : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast (by omega) i)) + (castSeriesColoring : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast (by omega) i)) + (castSeriesStored : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.stored i = S.data.stored (Fin.cast (by omega) i)) + (castSeriesEdges : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast (by omega) i)) + (castSeriesKind : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.kind i = S.data.kind (Fin.cast (by omega) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := + castSeries hroundsEq extendedSeries; + ∀ + (hfinalPenultimateTree : + finalSeries.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc) + (hfinalTree : finalSeries.data.tree (Fin.last (ett.rounds + (1 : ℕ))) = closureTree), + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev helperContinuation1431Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) + (sigma : PartialEdgeColoring E k) (hsigmaProper : IsProperEdgeColoring G sigma) + (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) + (Tstar : TreeSequence G e0) + (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (closureTree : TreeSequence G e0) (hTstarClosure : TreeSequenceInitialSegment Tstar closureTree) + (hTnClosure : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) (gamma : Fin k) + (secondStable : PartialEdgeColoring E k) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (currentStored : + ett.series.data.stored q.succ = + (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k))) + (currentEdges : ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E)) + (currentKind : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) + (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) + (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev) + (hchoiceDefective : + DefectiveColor G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color) + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color) + (hsigmaPrevSelf : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev) + (hclosedPrev : + ColoredVertexSetClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc))) + (hnotStrongPrev : + ¬ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc))) + (hsigmaRecovered : + sigma = TwoColorComponentSwap G sigmaPrev gamma choice.color (Sum.inl choice.vertex)), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (a b : V ⊕ E) (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) + (hnewExit : + TreeExit (ett.series.data.tree q.succ.castSucc) sigmaPrev gamma choice.color choice.vertex) + (hroundLarge : (1 : ℕ) < ett.rounds) + (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) + (hprefixTrees : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) + (hprefixData : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (hcorrFinalColor : + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigmaPrev), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (horiginalPositive : (0 : ℕ) < originalPrefix.rounds) + (hreplacementCurrentTree : + corr.replacementSeries.data.tree replacementLast.succ = ett.series.data.tree q.succ.castSucc) + (hreplacementStored : + TashkinovStoredColors corr.replacementSeries.data replacementLast = + TashkinovStoredColors ett.series.data q.castSucc), + let replacementChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree replacementLast.succ) + (TashkinovStoredColors corr.replacementSeries.data replacementLast) + (corr.replacementSeries.data.coloring replacementLast) := + helperReplacementChoice5196 G k e0 input T generating ett hpositive previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf originalPrefix corr hcorrFinalColor + hreplacementCurrentTree hreplacementStored; + ∀ + (hpeGammaRuleReplacement : + ParallelExtensionColor corr.replacementSeries.data replacementLast + replacementChoice.selected replacementChoice.vertex gamma) + (hterminalClosure : + TashkinovClosure sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let newStored : Finset (Fin k) := + (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ + (happendedTree : + appendedData.tree replacementLast.succ.castSucc = + corr.replacementSeries.data.tree replacementLast.succ) + (happendedStored : + TashkinovStoredColors appendedData replacementLast.castSucc = + TashkinovStoredColors corr.replacementSeries.data replacementLast) + (happendedColor : + appendedData.coloring replacementLast.castSucc = + corr.replacementSeries.data.coloring replacementLast), + let appendedChoice : + MaximumDefectiveChoice G e0 (appendedData.tree replacementLast.succ.castSucc) + (TashkinovStoredColors appendedData replacementLast.castSucc) + (appendedData.coloring replacementLast.castSucc) := + { + selected := replacementChoice.selected, + selectedProper := replacementChoice.selectedProper, + selectedOneUncolored := replacementChoice.selectedOneUncolored, + selectedStable := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + StableColoring _a (TashkinovStoredColors appendedData replacementLast.castSucc) + (appendedData.coloring replacementLast.castSucc) replacementChoice.selected) + happendedTree))) ▸ + ((Eq.symm + (id + (congrArg + (fun (_a : Finset (Fin k)) ↦ + StableColoring (corr.replacementSeries.data.tree replacementLast.succ) _a + (appendedData.coloring replacementLast.castSucc) replacementChoice.selected) + happendedStored))) ▸ + ((Eq.symm + (id + (congrArg + (fun (_a : PartialEdgeColoring E k) ↦ + StableColoring (corr.replacementSeries.data.tree replacementLast.succ) + (TashkinovStoredColors corr.replacementSeries.data replacementLast) _a + replacementChoice.selected) + happendedColor))) ▸ + replacementChoice.selectedStable))), + vertex := replacementChoice.vertex, + vertexDefective := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + DefectiveVertex G replacementChoice.selected (TreeSequenceVertexSet _a) + replacementChoice.vertex) + happendedTree))) ▸ + replacementChoice.vertexDefective), + maximal := + fun (pi : PartialEdgeColoring E k) (w : V) (hpiProper : IsProperEdgeColoring G pi) + (hpiOne : IsOneEdgeUncolored pi e0) + (hpiStable : + StableColoring (appendedData.tree replacementLast.succ.castSucc) + (TashkinovStoredColors appendedData replacementLast.castSucc) + (appendedData.coloring replacementLast.castSucc) pi) + (hw : + DefectiveVertex G pi + (TreeSequenceVertexSet (appendedData.tree replacementLast.succ.castSucc)) w) ↦ + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + w = replacementChoice.vertex ∨ TreeVertexOrder _a w replacementChoice.vertex) + happendedTree))) ▸ + replacementChoice.maximal pi w hpiProper hpiOne + (congrArg + (fun (_a : PartialEdgeColoring E k) ↦ + StableColoring (corr.replacementSeries.data.tree replacementLast.succ) + (TashkinovStoredColors corr.replacementSeries.data replacementLast) _a pi) + happendedColor ▸ + (congrArg + (fun (_a : Finset (Fin k)) ↦ + StableColoring (corr.replacementSeries.data.tree replacementLast.succ) _a + (appendedData.coloring replacementLast.castSucc) pi) + happendedStored ▸ + (congrArg + (fun (_a : TreeSequence G e0) ↦ + StableColoring _a (TashkinovStoredColors appendedData replacementLast.castSucc) + (appendedData.coloring replacementLast.castSucc) pi) + happendedTree ▸ + hpiStable))) + (congrArg + (fun (_a : TreeSequence G e0) ↦ DefectiveVertex G pi (TreeSequenceVertexSet _a) w) + happendedTree ▸ + hw)), + edge := replacementChoice.edge, + edgeDefective := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + DefectiveEdge G replacementChoice.selected (TreeSequenceVertexSet _a) + replacementChoice.edge) + happendedTree))) ▸ + replacementChoice.edgeDefective), + edgeIncident := replacementChoice.edgeIncident, + otherEndpoint := replacementChoice.otherEndpoint, + otherOutside := + ((Eq.symm + (id + (congrArg + (fun (_a : TreeSequence G e0) ↦ + replacementChoice.otherEndpoint ∉ TreeSequenceVertexSet _a) + happendedTree))) ▸ + replacementChoice.otherOutside), + edgeEnds := replacementChoice.edgeEnds, color := replacementChoice.color, + edgeColor := replacementChoice.edgeColor : + MaximumDefectiveChoice G e0 (appendedData.tree replacementLast.succ.castSucc) + (TashkinovStoredColors appendedData replacementLast.castSucc) + (appendedData.coloring replacementLast.castSucc) }; + ∀ + (hnoRevisitingAppended : + ¬Nonempty (RevisitingExtensionCertificate appendedData replacementLast.castSucc)) + (hpeAlternativeAppended : + ∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (appendedData.tree replacementLast.succ.castSucc) + (insert appendedChoice.color + (TashkinovStoredColors appendedData replacementLast.castSucc) : + Finset (Fin k)) + appendedChoice.selected rho ∧ + ¬Disjoint (MissingColors G rho appendedChoice.otherEndpoint) + (TreeMissingColors rho (appendedData.tree replacementLast.succ.castSucc))), + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev helperContinuation1943Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hMP : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (sigma : PartialEdgeColoring E k) (hsigmaProper : IsProperEdgeColoring G sigma) + (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) + (Tstar : TreeSequence G e0) + (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (heligible : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc) + Tstar ∨ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed Tstar) + (closureTree : TreeSequence G e0) (hclosure : TashkinovClosure sigma Tstar closureTree) + (hTstarClosure : TreeSequenceInitialSegment Tstar closureTree) + (hTnClosure : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) (gamma : Fin k) + (secondStable : PartialEdgeColoring E k) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data q.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (gammaRule : + ParallelExtensionColor ett.series.data q.castSucc choice.selected choice.vertex gamma) + (currentStored : + ett.series.data.stored q.succ = + (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k))) + (currentEdges : ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E)) + (currentKind hpeKind : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) + (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) + (hprefixCases : + (ett.rounds = (1 : ℕ) ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : + TashkinovSeries G k (0 : ℕ) e0 prefixInput), + zeroPrefix.data.tree (Fin.last (1 : ℕ)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigmaPrev) ∨ + (1 : ℕ) < ett.rounds ∧ + ∃ (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix ∧ + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) ∧ + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) ∧ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigmaPrev ∧ + MaximumProperty corr.replacementETT) + (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev) + (hchoiceDefective : + DefectiveColor G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color) + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color) + (hsigmaPrevSelf : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := + helperNewChoice4049 G k e0 input T generating ett hpositive previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf; + ∀ + (hclosedPrev : + ColoredVertexSetClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc))) + (hnotStrongPrev : + ¬ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc))) + (hnewAlternativeFails : + ∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) + (insert newChoice.color (TashkinovStoredColors ett.series.data q.castSucc) : + Finset (Fin k)) + newChoice.selected rho ∧ + ¬Disjoint (MissingColors G rho newChoice.otherEndpoint) + (TreeMissingColors rho (ett.series.data.tree q.succ.castSucc))) + (hgammaPrevMissing : gamma ∈ MissingColors G sigmaPrev choice.vertex) + (hsigmaRecovered : + sigma = TwoColorComponentSwap G sigmaPrev gamma choice.color (Sum.inl choice.vertex)), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ + (hedgeComponent : + Sum.inr choice.edge ∈ + TwoColorComponent G sigmaPrev gamma choice.color (Sum.inl choice.vertex)) + (a b : V ⊕ E) (p_1 : (TwoColorIncidenceGraph G sigmaPrev gamma choice.color).Walk a b) + (hp_1 : p_1.IsPath) (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hp : p.IsPath) + (hnewExit : + TreeExit (ett.series.data.tree q.succ.castSucc) sigmaPrev gamma choice.color choice.vertex), + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev helperContinuation2339Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hMP : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (sigma : PartialEdgeColoring E k) (hsigmaProper : IsProperEdgeColoring G sigma) + (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) + (Tstar : TreeSequence G e0) + (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (heligible : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc) + Tstar ∨ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed Tstar) + (closureTree : TreeSequence G e0) (hclosure : TashkinovClosure sigma Tstar closureTree) + (hTstarClosure : TreeSequenceInitialSegment Tstar closureTree) + (hTnClosure : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) + (hsigmaStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma) + (gamma : Fin k) (secondStable : PartialEdgeColoring E k) + (secondStableProper : IsProperEdgeColoring G secondStable) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (previousClosed : + ColoredVertexSetClosed G (ett.series.data.coloring q.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc))) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data q.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (seriesAlternativeFails : + ∃ (rho : PartialEdgeColoring E k), + IsProperEdgeColoring G rho ∧ + IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) + choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho (ett.series.data.tree q.succ.castSucc))) + (gammaRule : + ParallelExtensionColor ett.series.data q.castSucc choice.selected choice.vertex gamma) + (secondStableRelation : + StableColoring (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) + choice.selected secondStable) + (currentColoring : + ett.series.data.coloring q.succ = + TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex)) + (currentStored : + ett.series.data.stored q.succ = + (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k))) + (currentEdges : ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E)) + (currentKind hpeKind : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) + (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) + (hprefixCases : + (ett.rounds = (1 : ℕ) ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : + TashkinovSeries G k (0 : ℕ) e0 prefixInput), + zeroPrefix.data.tree (Fin.last (1 : ℕ)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigmaPrev) ∨ + (1 : ℕ) < ett.rounds ∧ + ∃ (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix ∧ + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) ∧ + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) ∧ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigmaPrev ∧ + MaximumProperty corr.replacementETT) + (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev) + (hchoiceVertex : choice.vertex ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + (hcomponent : + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), + Sum.inl w ∈ TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) ↔ + w = choice.vertex) + (hsigmaPrevFormula : + sigmaPrev = TwoColorComponentSwap G sigma gamma choice.color (Sum.inl choice.vertex)) + (hsigmaPrevEnlarged : + StableColoring (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) + choice.selected sigmaPrev) + (hchoiceDefective : + DefectiveColor G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color) + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color), + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev helperContinuation2265Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (hMP : MaximumProperty ett) + (hpositive : (0 : ℕ) < ett.rounds) (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) + (sigma : PartialEdgeColoring E k) (hsigmaProper : IsProperEdgeColoring G sigma) + (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma) + (Tstar : TreeSequence G e0) + (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (heligible : + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc) + Tstar ∨ + (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges (Fin.last ett.rounds) = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last ett.rounds).castSucc) f seed ∧ + TashkinovAugmentationSequence sigma seed Tstar) + (closureTree : TreeSequence G e0) (hclosure : TashkinovClosure sigma Tstar closureTree) + (hTstarClosure : TreeSequenceInitialSegment Tstar closureTree) + (hTnClosure : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) (adjoined : TreeSequence G e0) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (noRevisiting : ¬Nonempty (RevisitingExtensionCertificate ett.series.data q.castSucc)) + (choice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (currentStored : ett.series.data.stored q.succ = ({ choice.color } : Finset (Fin k))) + (currentEdges : ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E)) + (currentKind hseKind : ett.series.data.kind q.succ = some TashkinovExtensionKind.SE) + (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) + (hprefixCases : + (ett.rounds = (1 : ℕ) ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : + TashkinovSeries G k (0 : ℕ) e0 prefixInput), + zeroPrefix.data.tree (Fin.last (1 : ℕ)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigmaPrev) ∨ + (1 : ℕ) < ett.rounds ∧ + ∃ (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin (ett.rounds + (1 : ℕ))))) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix ∧ + (∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) ∧ + (∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), + originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.stored i = + ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.connectingEdges i = + ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + TashkinovStoredColors originalPrefix.series.data i = + TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) ∧ + ∃ (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigmaPrev ∧ + MaximumProperty corr.replacementETT) + (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev) + (hsigmaPrevSigma : sigmaPrev = sigma) + (hchoiceDefective : + DefectiveColor G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color) + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color) + (hsigmaPrevSelf : + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : + MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := + helperNewChoice2409 G k e0 input T generating ett hpositive previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf; + ∀ + (hclosedPrev : + ColoredVertexSetClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc))) + (hnotStrongPrev : + ¬ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc))) + (hnewAlternative : + ∀ (pi : PartialEdgeColoring E k), + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (insert newChoice.color (TashkinovStoredColors ett.series.data q.castSucc) : + Finset (Fin k)) + newChoice.selected pi → + Disjoint (MissingColors G pi newChoice.otherEndpoint) + (TreeMissingColors pi (ett.series.data.tree q.succ.castSucc))), + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private theorem helper_continuation_1015.{u_1, u_2} : + helperContinuation1015Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hTstarClosure q hqSucc choice currentStored + currentEdges currentKind sigmaPrev hroundLarge originalPrefix hr hprefixTrees hprefixData + corr horiginalPositive newStored newEdges newKind newVertex newOutside newDelta newGamma + extendedSeries hextendedData hroundsEq castSeries castSeriesTree castSeriesColoring + castSeriesStored castSeriesEdges castSeriesKind finalSeries hfinalPenultimateTree hfinalTree + let rawFinalColor : Fin (originalPrefix.rounds + 2) := + Fin.cast + (congrArg (fun m : ℕ => m + 1) hroundsEq.symm) + (Fin.last ett.rounds) + have hrawFinalColor : rawFinalColor = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [rawFinalColor] + have hfinalColor : finalSeries.data.coloring + (Fin.last ett.rounds) = sigma := by + exact @helper_hfinalColor_4432 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) + (@choice) (@sigmaPrev) (@originalPrefix) (@corr) (@extendedSeries) (@hextendedData) + (@hroundsEq) (@castSeriesColoring) (@hrawFinalColor) + let rawDataIndex (i : Fin (ett.rounds + 1)) : + Fin (originalPrefix.rounds + 2) := + Fin.cast + (congrArg (fun m : ℕ => m + 1) hroundsEq.symm) i + have hseriesDataAgree : ∀ i : Fin (ett.rounds + 1), + finalSeries.data.stored i = ett.series.data.stored i ∧ + finalSeries.data.connectingEdges i = + ett.series.data.connectingEdges i ∧ + finalSeries.data.kind i = ett.series.data.kind i := by + intro i + by_cases hi : i.val < ett.rounds + · exact @helper_branch_4454 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) + (@choice) (@sigmaPrev) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixData) (@corr) + (@horiginalPositive) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesStored) + (@castSeriesEdges) (@castSeriesKind) (@i) (@hi) + · exact @helper_branch_4512 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) + (@hqSucc) (@choice) (@currentStored) (@currentEdges) (@currentKind) (@sigmaPrev) + (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@horiginalPositive) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesStored) (@castSeriesEdges) (@castSeriesKind) + (@i) (@hi) + let rawTreeIndex (i : Fin (ett.rounds + 2)) : + Fin (originalPrefix.rounds + 3) := + Fin.cast + (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) i + have hseriesTreeAgree : ∀ i : Fin ett.rounds, + finalSeries.data.tree i.succ.castSucc = + ett.series.data.tree i.succ.castSucc := by + exact @helper_hseriesTreeAgree_4578 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@choice) (@sigmaPrev) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixTrees) (@corr) (@horiginalPositive) (@extendedSeries) (@hextendedData) + (@hroundsEq) (@castSeriesTree) (@hfinalPenultimateTree) + have hseriesColorProperties : ∀ i : Fin (ett.rounds + 1), + IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ + IsOneEdgeUncolored (finalSeries.data.coloring i) e0 := by + exact @helper_hseriesColorProperties_4631 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@Tstar) (@closureTree) (@choice) (@sigmaPrev) (@hroundLarge) + (@originalPrefix) (@hr) (@corr) (@horiginalPositive) (@extendedSeries) (@hextendedData) + (@hroundsEq) (@castSeriesColoring) (@hfinalColor) + have hseriesStable : ∀ i : Fin ett.rounds, + StableColoring + (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) + (ett.series.data.coloring i.succ) + (finalSeries.data.coloring i.succ) := by + exact @helper_hseriesStable_4663 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaStable) + (@Tstar) (@closureTree) (@choice) (@sigmaPrev) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixTrees) (@hprefixData) (@corr) (@horiginalPositive) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesColoring) (@hfinalColor) + let replacementETT : ExtendedTashkinovTree G k e0 + corr.replacementInput Tstar sigma := by + exact { + rounds := ett.rounds + roundsPositive := ett.roundsPositive + series := finalSeries + abovePenultimate := by + rw [hfinalPenultimateTree] + exact hTnTstar + strictAbovePenultimate := by + rw [hfinalPenultimateTree] + exact hstrict + belowFinal := by + rw [hfinalTree] + exact hTstarClosure + generatingColoring := hfinalColor.symm + } + refine ⟨{ + replacementInput := corr.replacementInput + replacementSeries := finalSeries + replacementETT := replacementETT + rungAgreement := rfl + seriesPresentation := by dsimp [replacementETT]; rfl + finalGeneratingColoring := hfinalColor.symm + ladderTreesAgree := hseriesTreeAgree + storedColorsAgree := fun i => (hseriesDataAgree i).1 + connectingEdgesAgree := fun i => (hseriesDataAgree i).2.1 + extensionKindsAgree := fun i => (hseriesDataAgree i).2.2 + replacementProper := fun i => + (hseriesColorProperties i).1 + replacementOneUncolored := fun i => + (hseriesColorProperties i).2 + replacementStable := hseriesStable + }⟩ + +private theorem helper_caseContinuation_422.{u_1, u_2} : + helperCaseContinuation422Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hTstarClosure q hqSucc choice currentStored + currentEdges currentKind sigmaPrev hroundLarge originalPrefix hr hprefixTrees hprefixData + corr replacementLast horiginalPositive hreplacementCurrentTree newStored newEdges newKind + newVertex newOutside newDelta newGamma appendedData lastStep + obtain ⟨extendedSeries, hextendedData⟩ := + TashkinovSeriesAppend G k originalPrefix.rounds e0 + corr.replacementInput corr.replacementSeries closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma + lastStep + have hroundsEq : originalPrefix.rounds + 1 = ett.rounds := by + rw [hr] + omega + let castSeries {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) : + TashkinovSeries G k b e0 corr.replacementInput := by + subst b + exact S + have castSeriesTree : ∀ {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 2)), + (castSeries h S).data.tree i = + S.data.tree + (Fin.cast (congrArg (fun m : ℕ => m + 2) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesColoring : ∀ {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)), + (castSeries h S).data.coloring i = + S.data.coloring + (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesStored : ∀ {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)), + (castSeries h S).data.stored i = + S.data.stored + (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesEdges : ∀ {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)), + (castSeries h S).data.connectingEdges i = + S.data.connectingEdges + (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesKind : ∀ {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)), + (castSeries h S).data.kind i = + S.data.kind + (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + let finalSeries : TashkinovSeries G k ett.rounds e0 + corr.replacementInput := + castSeries hroundsEq extendedSeries + let rawPenultimate : Fin (originalPrefix.rounds + 3) := + Fin.cast + (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) + have hrawPenultimate : rawPenultimate = + replacementLast.succ.castSucc := by + apply Fin.ext + simp [rawPenultimate, replacementLast] + omega + have hfinalPenultimateTree : finalSeries.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + ett.series.data.tree + (Fin.last ett.rounds).castSucc := by + exact @helper_hfinalPenultimateTree_4384 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@hqSucc) (@choice) (@sigmaPrev) (@hroundLarge) (@originalPrefix) (@hr) + (@corr) (@horiginalPositive) (@hreplacementCurrentTree) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesTree) (@hrawPenultimate) + let rawFinalTree : Fin (originalPrefix.rounds + 3) := + Fin.cast + (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) + (Fin.last (ett.rounds + 1)) + have hrawFinalTree : rawFinalTree = + Fin.last (originalPrefix.rounds + 2) := by + apply Fin.ext + simp [rawFinalTree] + have hfinalTree : finalSeries.data.tree + (Fin.last (ett.rounds + 1)) = closureTree := by + exact @helper_hfinalTree_4414 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) + (@choice) (@sigmaPrev) (@originalPrefix) (@corr) (@extendedSeries) (@hextendedData) + (@hroundsEq) (@castSeriesTree) (@hrawFinalTree) + exact @helper_continuation_1015 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@hsigmaOne) + (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hTstarClosure) (@hqSucc) + (@choice) (@currentStored) (@currentEdges) (@currentKind) (@sigmaPrev) (@hroundLarge) + (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) (@horiginalPositive) + (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) (@castSeriesColoring) + (@castSeriesStored) (@castSeriesEdges) (@castSeriesKind) (@hfinalPenultimateTree) + (@hfinalTree) +private theorem helper_continuation_1218.{u_1, u_2} : + helperContinuation1218Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hTstarClosure q hqSucc gamma choice + currentStored currentEdges currentKind sigmaPrev H u p hroundLarge originalPrefix hr + hprefixTrees hprefixData corr horiginalPositive newStored newEdges newKind newVertex + newOutside newDelta newGamma extendedSeries hextendedData hroundsEq castSeries + castSeriesTree castSeriesColoring castSeriesStored castSeriesEdges castSeriesKind + finalSeries hfinalPenultimateTree hfinalTree + let rawFinalColor : Fin (originalPrefix.rounds + 2) := + Fin.cast + (congrArg (fun m : ℕ => m + 1) hroundsEq.symm) + (Fin.last ett.rounds) + have hrawFinalColor : rawFinalColor = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [rawFinalColor] + have hfinalColor : finalSeries.data.coloring + (Fin.last ett.rounds) = sigma := by + exact @helper_hfinalColor_6721 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) + (@gamma) (@choice) (@sigmaPrev) (@originalPrefix) (@corr) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesColoring) (@hrawFinalColor) + let rawDataIndex (i : Fin (ett.rounds + 1)) : + Fin (originalPrefix.rounds + 2) := + Fin.cast + (congrArg (fun m : ℕ => m + 1) hroundsEq.symm) i + have hseriesDataAgree : ∀ i : Fin (ett.rounds + 1), + finalSeries.data.stored i = ett.series.data.stored i ∧ + finalSeries.data.connectingEdges i = + ett.series.data.connectingEdges i ∧ + finalSeries.data.kind i = ett.series.data.kind i := by + intro i + by_cases hi : i.val < ett.rounds + · exact @helper_branch_6743 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) + (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixData) (@corr) (@horiginalPositive) (@extendedSeries) (@hextendedData) + (@hroundsEq) (@castSeriesStored) (@castSeriesEdges) (@castSeriesKind) (@i) (@hi) + · exact @helper_branch_6801 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) + (@hqSucc) (@gamma) (@choice) (@currentStored) (@currentEdges) (@currentKind) (@sigmaPrev) + (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@horiginalPositive) + (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesStored) (@castSeriesEdges) + (@castSeriesKind) (@i) (@hi) + let rawTreeIndex (i : Fin (ett.rounds + 2)) : + Fin (originalPrefix.rounds + 3) := + Fin.cast + (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) i + have hseriesTreeAgree : ∀ i : Fin ett.rounds, + finalSeries.data.tree i.succ.castSucc = + ett.series.data.tree i.succ.castSucc := by + exact @helper_hseriesTreeAgree_6867 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundLarge) (@originalPrefix) + (@hr) (@hprefixTrees) (@corr) (@horiginalPositive) (@extendedSeries) (@hextendedData) + (@hroundsEq) (@castSeriesTree) (@hfinalPenultimateTree) + have hseriesColorProperties : ∀ i : Fin (ett.rounds + 1), + IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ + IsOneEdgeUncolored (finalSeries.data.coloring i) e0 := by + exact @helper_hseriesColorProperties_6920 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@Tstar) (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) + (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@horiginalPositive) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesColoring) (@hfinalColor) + have hseriesStable : ∀ i : Fin ett.rounds, + StableColoring + (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) + (ett.series.data.coloring i.succ) + (finalSeries.data.coloring i.succ) := by + exact @helper_hseriesStable_6952 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaStable) + (@Tstar) (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundLarge) + (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) (@horiginalPositive) + (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesColoring) (@hfinalColor) + let replacementETT : ExtendedTashkinovTree G k e0 + corr.replacementInput Tstar sigma := by + exact { + rounds := ett.rounds + roundsPositive := ett.roundsPositive + series := finalSeries + abovePenultimate := by + rw [hfinalPenultimateTree] + exact hTnTstar + strictAbovePenultimate := by + rw [hfinalPenultimateTree] + exact hstrict + belowFinal := by + rw [hfinalTree] + exact hTstarClosure + generatingColoring := hfinalColor.symm + } + refine ⟨{ + replacementInput := corr.replacementInput + replacementSeries := finalSeries + replacementETT := replacementETT + rungAgreement := rfl + seriesPresentation := by dsimp [replacementETT]; rfl + finalGeneratingColoring := hfinalColor.symm + ladderTreesAgree := hseriesTreeAgree + storedColorsAgree := fun i => (hseriesDataAgree i).1 + connectingEdgesAgree := fun i => (hseriesDataAgree i).2.1 + extensionKindsAgree := fun i => (hseriesDataAgree i).2.2 + replacementProper := fun i => + (hseriesColorProperties i).1 + replacementOneUncolored := fun i => + (hseriesColorProperties i).2 + replacementStable := hseriesStable + }⟩ + +private theorem helper_caseContinuation_1078.{u_1, u_2} : + helperCaseContinuation1078Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hTstarClosure q hqSucc gamma choice + currentStored currentEdges currentKind sigmaPrev H a b u p hroundLarge originalPrefix hr + hprefixTrees hprefixData corr replacementLast horiginalPositive hreplacementCurrentTree + newStored newEdges newKind newVertex newOutside newDelta newGamma appendedData lastStep + obtain ⟨extendedSeries, hextendedData⟩ := + TashkinovSeriesAppend G k originalPrefix.rounds e0 + corr.replacementInput corr.replacementSeries closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma + lastStep + have hroundsEq : originalPrefix.rounds + 1 = ett.rounds := by + rw [hr] + omega + let castSeries {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) : + TashkinovSeries G k b e0 corr.replacementInput := by + subst b + exact S + have castSeriesTree : ∀ {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 2)), + (castSeries h S).data.tree i = + S.data.tree + (Fin.cast (congrArg (fun m : ℕ => m + 2) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesColoring : ∀ {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)), + (castSeries h S).data.coloring i = + S.data.coloring + (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesStored : ∀ {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)), + (castSeries h S).data.stored i = + S.data.stored + (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesEdges : ∀ {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)), + (castSeries h S).data.connectingEdges i = + S.data.connectingEdges + (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesKind : ∀ {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 corr.replacementInput) + (i : Fin (b + 1)), + (castSeries h S).data.kind i = + S.data.kind + (Fin.cast (congrArg (fun m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + let finalSeries : TashkinovSeries G k ett.rounds e0 + corr.replacementInput := + castSeries hroundsEq extendedSeries + let rawPenultimate : Fin (originalPrefix.rounds + 3) := + Fin.cast + (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) + have hrawPenultimate : rawPenultimate = + replacementLast.succ.castSucc := by + apply Fin.ext + simp [rawPenultimate, replacementLast] + omega + have hfinalPenultimateTree : finalSeries.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + ett.series.data.tree + (Fin.last ett.rounds).castSucc := by + exact @helper_hfinalPenultimateTree_6673 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@hqSucc) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundLarge) + (@originalPrefix) (@hr) (@corr) (@horiginalPositive) (@hreplacementCurrentTree) + (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) (@hrawPenultimate) + let rawFinalTree : Fin (originalPrefix.rounds + 3) := + Fin.cast + (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) + (Fin.last (ett.rounds + 1)) + have hrawFinalTree : rawFinalTree = + Fin.last (originalPrefix.rounds + 2) := by + apply Fin.ext + simp [rawFinalTree] + have hfinalTree : finalSeries.data.tree + (Fin.last (ett.rounds + 1)) = closureTree := by + exact @helper_hfinalTree_6703 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) + (@gamma) (@choice) (@sigmaPrev) (@originalPrefix) (@corr) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesTree) (@hrawFinalTree) + exact @helper_continuation_1218 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@hsigmaOne) + (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hTstarClosure) (@hqSucc) + (@gamma) (@choice) (@currentStored) (@currentEdges) (@currentKind) (@sigmaPrev) (@u) (@p) + (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) + (@horiginalPositive) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) + (@castSeriesColoring) (@castSeriesStored) (@castSeriesEdges) (@castSeriesKind) + (@hfinalPenultimateTree) (@hfinalTree) +private theorem helper_continuation_1431.{u_1, u_2} : + helperContinuation1431Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hTstarClosure hTnClosure q hqSucc gamma + secondStable previousProper previousOneUncolored choice currentStored currentEdges + currentKind sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf hclosedPrev hnotStrongPrev hsigmaRecovered H a b u p hnewExit + hroundLarge originalPrefix hr hprefixTrees hprefixData corr hcorrFinalColor replacementLast + horiginalPositive hreplacementCurrentTree hreplacementStored replacementChoice + hpeGammaRuleReplacement hterminalClosure newStored newEdges newKind newVertex newOutside + newDelta newGamma appendedData happendedTree happendedStored happendedColor appendedChoice + hnoRevisitingAppended hpeAlternativeAppended + have hpeGammaRuleAppended : ParallelExtensionColor appendedData + replacementLast.castSucc appendedChoice.selected + appendedChoice.vertex gamma := by + rw [ParallelExtensionColorAppend corr.replacementSeries.data + closureTree sigma newStored newEdges newKind newVertex newOutside + newDelta newGamma replacementLast appendedChoice.selected + appendedChoice.vertex gamma] + simpa [appendedChoice, replacementChoice] using + hpeGammaRuleReplacement + have hstrictClosure : + (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length < + closureTree.length := + lt_of_lt_of_le hstrict hTstarClosure.1 + have lastStep : TashkinovSeriesStep G k + (originalPrefix.rounds + 1) e0 corr.replacementInput + appendedData (Fin.last (originalPrefix.rounds + 1)) := by + have hlast : replacementLast.succ = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [replacementLast] + rw [← hlast] + apply TashkinovSeriesStep.PE (i := replacementLast) + (choice := appendedChoice) (gamma := gamma) + (secondStable := sigmaPrev) + · rw [happendedColor, hcorrFinalColor] + exact hsigmaPrevProper + · rw [happendedColor, hcorrFinalColor] + exact hsigmaPrevOne + · rw [happendedColor, happendedTree, hcorrFinalColor, + hreplacementCurrentTree] + exact hclosedPrev + · rw [happendedColor, happendedTree, hcorrFinalColor, + hreplacementCurrentTree] + exact hnotStrongPrev + · exact hnoRevisitingAppended + · exact hpeAlternativeAppended + · exact hpeGammaRuleAppended + · exact hsigmaPrevProper + · exact hsigmaPrevOne + · exact (sc2 G e0 + (appendedData.tree replacementLast.succ.castSucc) + (insert appendedChoice.color + (TashkinovStoredColors appendedData + replacementLast.castSucc))).refl + ⟨sigmaPrev, hsigmaPrevProper, hsigmaPrevOne⟩ + · change TreeExit + (appendedData.tree replacementLast.succ.castSucc) sigmaPrev + gamma choice.color choice.vertex + rw [happendedTree, hreplacementCurrentTree] + exact hnewExit + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, + hlast, hsigmaRecovered] + · simpa [appendedData, TashkinovSeriesDataAppend, hlast] using + hsigmaProper + · simpa [appendedData, TashkinovSeriesDataAppend, hlast] using + hsigmaOne + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, newStored, hlast] + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, newEdges, hlast] + · simp [appendedData, TashkinovSeriesDataAppend, newKind, hlast] + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, newVertex, hlast] + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, newOutside, hlast] + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, newDelta, hlast] + · simp [appendedData, TashkinovSeriesDataAppend, newGamma, hlast] + · rw [happendedTree, hreplacementCurrentTree] + simpa [appendedData, TashkinovSeriesDataAppend, hlast, hqSucc] + using hterminalClosure + · change TreeSequenceInitialSegment + (appendedData.tree replacementLast.succ.castSucc) + (appendedData.tree (Fin.last (originalPrefix.rounds + 2))) + rw [happendedTree, hreplacementCurrentTree] + simpa [appendedData, TashkinovSeriesDataAppend, hqSucc] using + hTnClosure + · change (appendedData.tree replacementLast.succ.castSucc).length < + (appendedData.tree + (Fin.last (originalPrefix.rounds + 2))).length + rw [happendedTree, hreplacementCurrentTree] + simpa [appendedData, TashkinovSeriesDataAppend, hqSucc] using + hstrictClosure + exact @helper_caseContinuation_1078 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) + (@hTstarClosure) (@hqSucc) (@gamma) (@choice) (@currentStored) (@currentEdges) + (@currentKind) (@sigmaPrev) (@a) (@b) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixTrees) (@hprefixData) (@corr) (@horiginalPositive) (@hreplacementCurrentTree) + (@lastStep) + +private theorem helper_branch_1075.{u_1, u_2} : + helperBranch1075Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hclosure hTstarClosure hTnClosure q hqSucc + gamma secondStable previousProper previousOneUncolored choice currentStored currentEdges + currentKind sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf hclosedPrev hnotStrongPrev hsigmaRecovered H a b u p hnewExit + hroundLarge originalPrefix hr hprefixTrees hprefixData corr hcorrFinalColor replacementLast + horiginalPositive hreplacementCurrentTree hreplacementStored replacementChoice + hnoRevisitingReplacement hpeAlternativeReplacement hpeGammaRuleReplacement hparallel + have hrouteClosure : TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree := hparallel.2.trans hclosure.1 + have hterminalClosure : TashkinovClosure sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree := ⟨hrouteClosure, hclosure.2⟩ + let newStored : Finset (Fin k) := {choice.color, gamma} + let newEdges : Finset E := {choice.edge} + let newKind : Option TashkinovExtensionKind := + some TashkinovExtensionKind.PE + let newVertex : Option V := some choice.vertex + let newOutside : Option V := some choice.otherEndpoint + let newDelta : Option (Fin k) := some choice.color + let newGamma : Option (Fin k) := some gamma + let appendedData := TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma + have happendedTree : + appendedData.tree replacementLast.succ.castSucc = + corr.replacementSeries.data.tree replacementLast.succ := by + simp only [appendedData, TashkinovSeriesDataAppend] + exact Fin.lastCases_castSucc replacementLast.succ + have happendedStored : TashkinovStoredColors appendedData + replacementLast.castSucc = + TashkinovStoredColors corr.replacementSeries.data + replacementLast := + TashkinovStoredColorsAppend corr.replacementSeries.data + closureTree sigma newStored newEdges newKind newVertex newOutside + newDelta newGamma replacementLast + have happendedColor : appendedData.coloring + replacementLast.castSucc = + corr.replacementSeries.data.coloring replacementLast := by + simp [appendedData, TashkinovSeriesDataAppend] + let appendedChoice : MaximumDefectiveChoice G e0 + (appendedData.tree replacementLast.succ.castSucc) + (TashkinovStoredColors appendedData replacementLast.castSucc) + (appendedData.coloring replacementLast.castSucc) := by + exact { + selected := replacementChoice.selected + selectedProper := replacementChoice.selectedProper + selectedOneUncolored := replacementChoice.selectedOneUncolored + selectedStable := by + rw [happendedTree, happendedStored, happendedColor] + exact replacementChoice.selectedStable + vertex := replacementChoice.vertex + vertexDefective := by + rw [happendedTree] + exact replacementChoice.vertexDefective + maximal := by + intro pi w hpiProper hpiOne hpiStable hw + rw [happendedTree, happendedStored, happendedColor] at hpiStable + rw [happendedTree] at hw ⊢ + exact replacementChoice.maximal pi w hpiProper hpiOne hpiStable hw + edge := replacementChoice.edge + edgeDefective := by + rw [happendedTree] + exact replacementChoice.edgeDefective + edgeIncident := replacementChoice.edgeIncident + otherEndpoint := replacementChoice.otherEndpoint + otherOutside := by + rw [happendedTree] + exact replacementChoice.otherOutside + edgeEnds := replacementChoice.edgeEnds + color := replacementChoice.color + edgeColor := replacementChoice.edgeColor } + have hnoRevisitingAppended : ¬ Nonempty + (RevisitingExtensionCertificate appendedData + replacementLast.castSucc) := by + exact @helper_hnoRevisitingAppended_6477 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@originalPrefix) (@corr) + (@hnoRevisitingReplacement) + have hpeAlternativeAppended : ∃ rho : PartialEdgeColoring E k, + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring + (appendedData.tree replacementLast.succ.castSucc) + (insert appendedChoice.color + (TashkinovStoredColors appendedData + replacementLast.castSucc)) appendedChoice.selected rho ∧ + ¬ Disjoint + (MissingColors G rho appendedChoice.otherEndpoint) + (TreeMissingColors rho + (appendedData.tree replacementLast.succ.castSucc)) := by + rcases hpeAlternativeReplacement with + ⟨rho, hrhoProper, hrhoOne, hrhoStable, hrhoNotDisjoint⟩ + refine ⟨rho, hrhoProper, hrhoOne, ?_, ?_⟩ + · change StableColoring + (appendedData.tree replacementLast.succ.castSucc) + (insert replacementChoice.color + (TashkinovStoredColors appendedData + replacementLast.castSucc)) replacementChoice.selected rho + rw [happendedTree, happendedStored] + exact hrhoStable + · change ¬ Disjoint + (MissingColors G rho replacementChoice.otherEndpoint) + (TreeMissingColors rho + (appendedData.tree replacementLast.succ.castSucc)) + rw [happendedTree] + exact hrhoNotDisjoint + exact @helper_continuation_1431 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@hsigmaOne) + (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hTstarClosure) + (@hTnClosure) (@hqSucc) (@gamma) (@secondStable) (@previousProper) (@previousOneUncolored) + (@choice) (@currentStored) (@currentEdges) (@currentKind) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) + (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) (@hsigmaRecovered) (@a) (@b) (@u) (@p) + (@hnewExit) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) + (@hcorrFinalColor) (@horiginalPositive) (@hreplacementCurrentTree) (@hreplacementStored) + (@hpeGammaRuleReplacement) (@hterminalClosure) (@happendedTree) (@happendedStored) + (@happendedColor) (@hnoRevisitingAppended) (@hpeAlternativeAppended) +private theorem helper_continuation_1943.{u_1, u_2} : + helperContinuation1943Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower sigma hsigmaProper + hsigmaOne hsigmaStable Tstar hTnTstar hstrict heligible closureTree hclosure hTstarClosure + hTnClosure q hqSucc gamma secondStable previousProper previousOneUncolored noRevisiting + choice gammaRule currentStored currentEdges currentKind hpeKind sigmaPrev hsigmaPrevProper + hsigmaPrevOne hprefixCases hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf + newChoice hclosedPrev hnotStrongPrev hnewAlternativeFails hgammaPrevMissing hsigmaRecovered + H hedgeComponent a b _ _ u p hp hnewExit + rcases hprefixCases with hzero | hpositivePrefix + · exact @helper_branch_13492 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@hsigmaOne) + (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@heligible) (@closureTree) (@hclosure) + (@hTstarClosure) (@hTnClosure) (@hqSucc) (@gamma) (@secondStable) (@previousProper) + (@previousOneUncolored) (@choice) (@currentStored) (@currentEdges) (@currentKind) + (@hpeKind) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) + (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) + (@hnewAlternativeFails) (@hgammaPrevMissing) (@hsigmaRecovered) (@a) (@b) _ (by assumption) + (@u) (@p) (@hp) (@hnewExit) (@hzero) + · rcases hpositivePrefix with ⟨hroundLarge, originalPrefix, hr, + hprefixMP, hprefixTrees, hprefixData, corr, hcorrFinalTree, + hcorrFinalColor, hcorrMP⟩ + let replacementLast : Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds + have horiginalPositive : 0 < originalPrefix.rounds := by + rw [hr] + omega + let previousReplacement : Fin originalPrefix.rounds := + ⟨originalPrefix.rounds - 1, + Nat.sub_lt horiginalPositive (by omega)⟩ + have hpreviousSucc : previousReplacement.succ = replacementLast := by + apply Fin.ext + simp [previousReplacement, replacementLast] + omega + have hlastMap : Fin.castLE (by omega) replacementLast = + q.castSucc := by + apply Fin.ext + simp [replacementLast, q, hr] + have hreplacementCurrentTree : + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree q.succ.castSucc := by + exact @helper_hreplacementCurrentTree_5844 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@hqSucc) (@sigmaPrev) (@originalPrefix) (@corr) (@hcorrFinalTree) + have horiginalCurrentTree : + originalPrefix.series.data.tree replacementLast.castSucc = + ett.series.data.tree q.castSucc.castSucc := by + exact @helper_horiginalCurrentTree_5852 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) + (@choice) (@sigmaPrev) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) + (@horiginalPositive) + have htreeMissingEq : TreeMissingColors + (corr.replacementSeries.data.coloring replacementLast) + (corr.replacementSeries.data.tree replacementLast.castSucc) = + TreeMissingColors + (originalPrefix.series.data.coloring replacementLast) + (originalPrefix.series.data.tree replacementLast.castSucc) := by + exact @helper_htreeMissingEq_5864 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) + (@sigmaPrev) (@u) (@p) (@originalPrefix) (@corr) (@horiginalPositive) (@hpreviousSucc) + have hreplacementStored : TashkinovStoredColors + corr.replacementSeries.data replacementLast = + TashkinovStoredColors ett.series.data q.castSucc := by + exact @helper_hreplacementStored_5882 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) + (@choice) (@sigmaPrev) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixData) + (@corr) (@horiginalPositive) (@hlastMap) (@htreeMissingEq) + let replacementChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree replacementLast.succ) + (TashkinovStoredColors corr.replacementSeries.data replacementLast) + (corr.replacementSeries.data.coloring replacementLast) := by + exact @helperReplacementChoice5196 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) + (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@originalPrefix) (@corr) (@hcorrFinalColor) + (@hreplacementCurrentTree) (@hreplacementStored) + have hnoRevisitingReplacement : ¬ Nonempty + (RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast) := by + exact @helper_hnoRevisitingReplacement_5934 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) + (@hpositive) (@hlower) (@Tstar) (@gamma) (@previousProper) (@previousOneUncolored) + (@noRevisiting) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) + (@hsigmaPrevStableQ) (@u) (@p) (@hp) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixMP) (@hprefixTrees) (@hprefixData) (@corr) (@hcorrFinalTree) + (@hcorrFinalColor) (@hcorrMP) + have hpeAlternativeReplacement : ∃ rho : PartialEdgeColoring E k, + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring + (corr.replacementSeries.data.tree replacementLast.succ) + (insert replacementChoice.color + (TashkinovStoredColors corr.replacementSeries.data + replacementLast)) replacementChoice.selected rho ∧ + ¬ Disjoint + (MissingColors G rho replacementChoice.otherEndpoint) + (TreeMissingColors rho + (corr.replacementSeries.data.tree replacementLast.succ)) := by + exact @helper_hpeAlternativeReplacement_5946 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) + (@hsigmaPrevSelf) (@hnewAlternativeFails) (@originalPrefix) (@corr) (@hcorrFinalColor) + (@hreplacementCurrentTree) (@hreplacementStored) + have hpeGammaRuleReplacement : ParallelExtensionColor + corr.replacementSeries.data replacementLast + replacementChoice.selected replacementChoice.vertex gamma := by + exact @helper_hpeGammaRuleReplacement_13982 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@gamma) (@previousProper) (@previousOneUncolored) (@choice) (@gammaRule) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) + (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hgammaPrevMissing) (@hedgeComponent) (@u) (@p) + (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) + (@hcorrFinalColor) (@horiginalPositive) (@hreplacementCurrentTree) (@hreplacementStored) + rcases heligible with hparallel | hsimple + · exact @helper_branch_1075 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hclosure) + (@hTstarClosure) (@hTnClosure) (@hqSucc) (@gamma) (@secondStable) (@previousProper) + (@previousOneUncolored) (@choice) (@currentStored) (@currentEdges) (@currentKind) + (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) + (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) + (@hsigmaRecovered) (@a) (@b) (@u) (@p) (@hnewExit) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixTrees) (@hprefixData) (@corr) (@hcorrFinalColor) (@horiginalPositive) + (@hreplacementCurrentTree) (@hreplacementStored) (@hnoRevisitingReplacement) + (@hpeAlternativeReplacement) (@hpeGammaRuleReplacement) (@hparallel) + · exact @helper_branch_7068 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@hqSucc) + (@hpeKind) (@hsimple) + +private theorem helper_caseContinuation_1201.{u_1, u_2} : + helperCaseContinuation1201Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower sigma hsigmaProper + hsigmaOne hsigmaStable Tstar hTnTstar hstrict heligible closureTree hclosure hTstarClosure + hTnClosure q hqSucc gamma secondStable previousProper previousOneUncolored noRevisiting + choice gammaRule currentStored currentEdges currentKind hpeKind sigmaPrev hsigmaPrevProper + hsigmaPrevOne hprefixCases hsigmaPrevStableQ hchoiceVertex hsigmaPrevFormula + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hclosedPrev hnotStrongPrev + hnewAlternativeFails hgammaDeltaNe hsigmaComponentColor hgammaPrevMissing hswapGraph + hcomponentPrev + have hsigmaRecovered : sigma = + TwoColorComponentSwap G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) := by + exact @helper_hsigmaRecovered_2774 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@gamma) (@choice) (@sigmaPrev) (@hsigmaPrevFormula) (@hgammaDeltaNe) + (@hsigmaComponentColor) (@hswapGraph) + let H := TwoColorIncidenceGraph G sigmaPrev gamma choice.color + have hrootLeaf : Set.Subsingleton + (H.neighborSet (Sum.inl choice.vertex)) := by + exact @helper_hrootLeaf_5339 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) + (@sigmaPrev) (@hsigmaPrevProper) (@hgammaDeltaNe) (@hgammaPrevMissing) + have hrootComponent : Sum.inl choice.vertex ∈ + TwoColorComponent G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) := by + change H.connectedComponentMk (Sum.inl choice.vertex) = + H.connectedComponentMk (Sum.inl choice.vertex) + rfl + have hedgeComponent : Sum.inr choice.edge ∈ + TwoColorComponent G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, + (Finset.mem_filter.mp hchoiceEdgeNew).2] + obtain ⟨a, b, p, hp, hps⟩ := + TwoColorComponentSpanningPath G sigmaPrev gamma choice.color + hsigmaPrevProper (Sum.inl choice.vertex) + have hrootSupport : Sum.inl choice.vertex ∈ p.support := by + change Sum.inl choice.vertex ∈ {z | z ∈ p.support} + rw [hps] + exact hrootComponent + have hrootEnd : Sum.inl choice.vertex = a ∨ + Sum.inl choice.vertex = b := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hrootLeaf) hrootSupport + obtain ⟨b, p, hp, hps⟩ : ∃ (b : Sum V E) + (p : H.Walk (Sum.inl choice.vertex) b), + p.IsPath ∧ {z | z ∈ p.support} = + TwoColorComponent G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) := by + rcases hrootEnd with ha | hb + · subst a + exact ⟨b, p, hp, hps⟩ + · exact @helper_branch_5387 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) + (@sigmaPrev) (@a) (@b) (@p) (@hp) (@hps) (@hrootSupport) (@hb) + have hpNotNil : ¬ p.Nil := by + exact @helper_hpNotNil_5395 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) + (@sigmaPrev) (@hedgeComponent) (@b) (@p) (@hps) + have hendNeighbor : ∀ y, H.Adj b y → + y = p.getVert (p.length - 1) := by + exact @helper_hendNeighbor_2869 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@gamma) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hrootLeaf) (@a) _ _ (by assumption) + (by assumption) (@b) (@p) (@hp) (@hps) (@hpNotNil) + have hendLeaf : Set.Subsingleton (H.neighborSet b) := by + intro y hy z hz + exact (hendNeighbor y hy).trans (hendNeighbor z hz).symm + have hpPos : 0 < p.length := + SimpleGraph.Walk.not_nil_iff_lt_length.mp hpNotNil + have hendVertex : ∃ u : V, b = Sum.inl u := by + exact @helper_hendVertex_2974 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) + (@sigmaPrev) (@a) _ (by assumption) (@b) (@p) (@hendLeaf) (@hpPos) + obtain ⟨u, hu⟩ := hendVertex + subst b + have hvu : choice.vertex ≠ u := by + intro hvu + apply hpNotNil + exact hp.nil_iff_eq.mpr (by simp [hvu]) + have hendMissing : gamma ∈ MissingColors G sigmaPrev u ∨ + choice.color ∈ MissingColors G sigmaPrev u := by + exact @helper_hendMissing_3025 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) + (@choice) (@sigmaPrev) (@hgammaDeltaNe) (@u) (@hendLeaf) + have huComponent : Sum.inl u ∈ + TwoColorComponent G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) := by + rw [← hps] + change Sum.inl u ∈ p.support + simpa only [p.getVert_length] using p.getVert_mem_support p.length + have huOutside : u ∉ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := by + intro huTree + exact hvu.symm ((hcomponentPrev u huTree).mp huComponent) + have hpNotOne : p.length ≠ 1 := by + exact @helper_hpNotOne_5434 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) + (@sigmaPrev) (@u) (@p) (@hpPos) + have hnewExit : TreeExit + (ett.series.data.tree q.succ.castSucc) sigmaPrev gamma + choice.color choice.vertex := by + exact @helper_hnewExit_3069 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) + (@sigmaPrev) (@hchoiceVertex) (@hcomponentPrev) (@a) (@b) _ (by assumption) + (by assumption) (@u) (@p) (@hp) (@hps) (@hpPos) (@hendMissing) (@huOutside) (@hpNotOne) + exact @helper_continuation_1943 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) + (@hstrict) (@heligible) (@closureTree) (@hclosure) (@hTstarClosure) (@hTnClosure) (@hqSucc) + (@gamma) (@secondStable) (@previousProper) (@previousOneUncolored) (@noRevisiting) + (@choice) (@gammaRule) (@currentStored) (@currentEdges) (@currentKind) (@hpeKind) + (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hprefixCases) (@hsigmaPrevStableQ) + (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) + (@hnewAlternativeFails) (@hgammaPrevMissing) (@hsigmaRecovered) (@hedgeComponent) (@a) (@b) + _ (by + assumption) (@u) (@p) (@hp) (@hnewExit) +private theorem helper_branch_1497.{u_1, u_2} : + helperBranch1497Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hclosure hTstarClosure hTnClosure q hqSucc + adjoined previousProper previousOneUncolored choice currentStored currentEdges currentKind + sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hsigmaPrevSigma hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf hclosedPrev hnotStrongPrev hroundLarge originalPrefix hr + hprefixTrees hprefixData corr hcorrFinalColor replacementLast horiginalPositive + hreplacementCurrentTree hreplacementStored replacementChoice hnoRevisitingReplacement + hnewAlternativeReplacement hsimple + rcases hsimple with ⟨hkind, fstar, seed, hfinalEdges, + hadjoin, hroute⟩ + have hfstar : fstar = choice.edge := by + apply Finset.mem_singleton.mp + rw [← currentEdges, hqSucc, hfinalEdges] + exact Finset.mem_singleton_self fstar + have hrouteClosure : TashkinovAugmentationSequence sigma seed + closureTree := hroute.trans hclosure.1 + have hseedClosure : TashkinovClosure sigma seed closureTree := + ⟨hrouteClosure, hclosure.2⟩ + let newStored : Finset (Fin k) := {choice.color} + let newEdges : Finset E := {choice.edge} + let newKind : Option TashkinovExtensionKind := + some TashkinovExtensionKind.SE + let newVertex : Option V := some choice.vertex + let newOutside : Option V := some choice.otherEndpoint + let newDelta : Option (Fin k) := some choice.color + let newGamma : Option (Fin k) := none + let appendedData := TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma + have happendedTree : + appendedData.tree replacementLast.succ.castSucc = + corr.replacementSeries.data.tree replacementLast.succ := by + simp only [appendedData, TashkinovSeriesDataAppend] + exact Fin.lastCases_castSucc replacementLast.succ + have happendedStored : TashkinovStoredColors appendedData + replacementLast.castSucc = + TashkinovStoredColors corr.replacementSeries.data + replacementLast := + TashkinovStoredColorsAppend corr.replacementSeries.data + closureTree sigma newStored newEdges newKind newVertex newOutside + newDelta newGamma replacementLast + have happendedColor : appendedData.coloring + replacementLast.castSucc = + corr.replacementSeries.data.coloring replacementLast := by + simp [appendedData, TashkinovSeriesDataAppend] + let appendedChoice : MaximumDefectiveChoice G e0 + (appendedData.tree replacementLast.succ.castSucc) + (TashkinovStoredColors appendedData replacementLast.castSucc) + (appendedData.coloring replacementLast.castSucc) := by + exact { + selected := replacementChoice.selected + selectedProper := replacementChoice.selectedProper + selectedOneUncolored := replacementChoice.selectedOneUncolored + selectedStable := by + rw [happendedTree, happendedStored, happendedColor] + exact replacementChoice.selectedStable + vertex := replacementChoice.vertex + vertexDefective := by + rw [happendedTree] + exact replacementChoice.vertexDefective + maximal := by + intro pi w hpiProper hpiOne hpiStable hw + rw [happendedTree, happendedStored, happendedColor] at hpiStable + rw [happendedTree] at hw ⊢ + exact replacementChoice.maximal pi w hpiProper hpiOne hpiStable hw + edge := replacementChoice.edge + edgeDefective := by + rw [happendedTree] + exact replacementChoice.edgeDefective + edgeIncident := replacementChoice.edgeIncident + otherEndpoint := replacementChoice.otherEndpoint + otherOutside := by + rw [happendedTree] + exact replacementChoice.otherOutside + edgeEnds := replacementChoice.edgeEnds + color := replacementChoice.color + edgeColor := replacementChoice.edgeColor } + have hnoRevisitingAppended : ¬ Nonempty + (RevisitingExtensionCertificate appendedData + replacementLast.castSucc) := by + exact @helper_hnoRevisitingAppended_4214 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@choice) (@sigmaPrev) (@originalPrefix) (@corr) (@hnoRevisitingReplacement) + have hnewAlternativeAppended : ∀ pi : PartialEdgeColoring E k, + IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring + (appendedData.tree replacementLast.succ.castSucc) + (insert appendedChoice.color + (TashkinovStoredColors appendedData + replacementLast.castSucc)) appendedChoice.selected pi → + Disjoint + (MissingColors G pi appendedChoice.otherEndpoint) + (TreeMissingColors pi + (appendedData.tree replacementLast.succ.castSucc)) := by + intro pi hpiProper hpiOne hpiStable + have hpiStable' := hpiStable + change StableColoring + (appendedData.tree replacementLast.succ.castSucc) + (insert replacementChoice.color + (TashkinovStoredColors appendedData + replacementLast.castSucc)) replacementChoice.selected pi + at hpiStable' + rw [happendedTree, happendedStored] at hpiStable' + have hresult := hnewAlternativeReplacement pi hpiProper hpiOne + hpiStable' + change Disjoint + (MissingColors G pi replacementChoice.otherEndpoint) + (TreeMissingColors pi + (appendedData.tree replacementLast.succ.castSucc)) + rw [happendedTree] + exact hresult + have hstrictClosure : + (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length < + closureTree.length := + lt_of_lt_of_le hstrict hTstarClosure.1 + have lastStep : TashkinovSeriesStep G k + (originalPrefix.rounds + 1) e0 corr.replacementInput + appendedData (Fin.last (originalPrefix.rounds + 1)) := by + have hlast : replacementLast.succ = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [replacementLast] + rw [← hlast] + apply TashkinovSeriesStep.SE (i := replacementLast) + (choice := appendedChoice) (adjoined := seed) + · rw [happendedColor, hcorrFinalColor] + exact hsigmaPrevProper + · rw [happendedColor, hcorrFinalColor] + exact hsigmaPrevOne + · rw [happendedColor, happendedTree, hcorrFinalColor, + hreplacementCurrentTree] + exact hclosedPrev + · rw [happendedColor, happendedTree, hcorrFinalColor, + hreplacementCurrentTree] + exact hnotStrongPrev + · exact hnoRevisitingAppended + · exact hnewAlternativeAppended + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, + hlast, hsigmaPrevSigma] + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, newStored, hlast] + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, newEdges, hlast] + · simp [appendedData, TashkinovSeriesDataAppend, newKind, hlast] + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, newVertex, hlast] + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, newOutside, hlast] + · simp [appendedChoice, replacementChoice, appendedData, + TashkinovSeriesDataAppend, newDelta, hlast] + · simp [appendedData, TashkinovSeriesDataAppend, newGamma, hlast] + · change TreeSequenceAdjoinEdge + (appendedData.tree replacementLast.succ.castSucc) + choice.edge seed + rw [happendedTree, hreplacementCurrentTree] + simpa [appendedChoice, replacementChoice, hqSucc, hfstar] using + hadjoin + · simpa [appendedData, TashkinovSeriesDataAppend, hlast] using + hseedClosure + · change TreeSequenceInitialSegment + (appendedData.tree replacementLast.succ.castSucc) + (appendedData.tree (Fin.last (originalPrefix.rounds + 2))) + rw [happendedTree, hreplacementCurrentTree] + simpa [appendedData, TashkinovSeriesDataAppend, hqSucc] using + hTnClosure + · change (appendedData.tree replacementLast.succ.castSucc).length < + (appendedData.tree + (Fin.last (originalPrefix.rounds + 2))).length + rw [happendedTree, hreplacementCurrentTree] + simpa [appendedData, TashkinovSeriesDataAppend, hqSucc] using + hstrictClosure + exact @helper_caseContinuation_422 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) + (@hTstarClosure) (@hqSucc) (@choice) (@currentStored) (@currentEdges) (@currentKind) + (@sigmaPrev) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) + (@horiginalPositive) (@hreplacementCurrentTree) (@lastStep) + +private theorem helper_continuation_2339.{u_1, u_2} : + helperContinuation2339Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower sigma hsigmaProper + hsigmaOne hsigmaStable Tstar hTnTstar hstrict heligible closureTree hclosure hTstarClosure + hTnClosure q hqSucc hsigmaStableQ gamma secondStable secondStableProper previousProper + previousOneUncolored previousClosed noRevisiting choice seriesAlternativeFails gammaRule + secondStableRelation currentColoring currentStored currentEdges currentKind hpeKind + sigmaPrev hsigmaPrevProper hsigmaPrevOne hprefixCases hsigmaPrevStableQ hchoiceVertex + hcomponent hsigmaPrevFormula hsigmaPrevEnlarged hchoiceDefective hchoiceEdgeNew + have hsigmaPrevSelf : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + sigmaPrev sigmaPrev := by + exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc)).refl + ⟨sigmaPrev, hsigmaPrevProper, hsigmaPrevOne⟩ + let newChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := by + exact @helperNewChoice4049 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@previousProper) + (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) + (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) + have hclosedPrev : ColoredVertexSetClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) := by + exact @helper_hclosedPrev_2545 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@Tstar) (@previousProper) (@previousOneUncolored) (@previousClosed) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) + have hnotStrongPrev : ¬ ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) := by + exact @helper_hnotStrongPrev_5207 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@choice) + (@sigmaPrev) (@hchoiceDefective) + have hnewAlternativeFails : ∃ rho : PartialEdgeColoring E k, + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) + (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc)) + newChoice.selected rho ∧ + ¬ Disjoint (MissingColors G rho newChoice.otherEndpoint) + (TreeMissingColors rho + (ett.series.data.tree q.succ.castSucc)) := by + exact @helper_hnewAlternativeFails_5223 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@previousProper) (@previousOneUncolored) (@choice) (@seriesAlternativeFails) + (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) + (@hsigmaPrevEnlarged) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) + have hgammaSecond : gamma ∈ MissingColors G secondStable + choice.vertex := by + rw [secondStableRelation.2 choice.vertex choice.vertexDefective.1] + exact gammaRule.1 + have hchoiceSecond : secondStable choice.edge = some choice.color := by + exact @helper_hchoiceSecond_5266 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@secondStable) + (@choice) (@secondStableRelation) + have hgammaDeltaNe : gamma ≠ choice.color := by + exact @helper_hgammaDeltaNe_5272 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) + (@secondStable) (@choice) (@hgammaSecond) (@hchoiceSecond) + have hchoiceSecondComponent : Sum.inr choice.edge ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hchoiceSecond] + have hdeltaCurrentMissing : choice.color ∈ MissingColors G + (ett.series.data.coloring q.succ) choice.vertex := by + exact @helper_hdeltaCurrentMissing_2652 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@Tstar) (@gamma) (@secondStable) (@secondStableProper) (@choice) (@currentColoring) + (@hgammaSecond) (@hchoiceSecond) (@hgammaDeltaNe) (@hchoiceSecondComponent) + have hdeltaSigmaMissing : choice.color ∈ MissingColors G sigma + choice.vertex := by + rw [hsigmaStableQ.2 choice.vertex hchoiceVertex] + exact hdeltaCurrentMissing + have hsigmaComponentColor : ∀ f, + Sum.inr f ∈ TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) → + sigma f = some gamma ∨ sigma f = some choice.color := by + exact @helper_hsigmaComponentColor_5296 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@gamma) (@choice) + have hgammaPrevMissing : gamma ∈ MissingColors G sigmaPrev + choice.vertex := by + exact @helper_hgammaPrevMissing_2707 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@gamma) (@choice) (@sigmaPrev) (@hsigmaPrevFormula) (@hgammaDeltaNe) + (@hdeltaSigmaMissing) (@hsigmaComponentColor) + have hswapGraph : TwoColorIncidenceGraph G sigmaPrev gamma choice.color = + TwoColorIncidenceGraph G sigma gamma choice.color := by + exact @helper_hswapGraph_2737 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@gamma) + (@choice) (@sigmaPrev) (@hsigmaPrevFormula) (@hgammaDeltaNe) (@hsigmaComponentColor) + have hcomponentPrev : ∀ w, + w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) → + (Sum.inl w ∈ TwoColorComponent G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) ↔ w = choice.vertex) := by + intro w hw + unfold TwoColorComponent + rw [hswapGraph] + exact hcomponent w hw + exact @helper_caseContinuation_1201 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) + (@hstrict) (@heligible) (@closureTree) (@hclosure) (@hTstarClosure) (@hTnClosure) (@hqSucc) + (@gamma) (@secondStable) (@previousProper) (@previousOneUncolored) (@noRevisiting) + (@choice) (@gammaRule) (@currentStored) (@currentEdges) (@currentKind) (@hpeKind) + (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hprefixCases) (@hsigmaPrevStableQ) + (@hchoiceVertex) (@hsigmaPrevFormula) (@hchoiceDefective) (@hchoiceEdgeNew) + (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) (@hnewAlternativeFails) (@hgammaDeltaNe) + (@hsigmaComponentColor) (@hgammaPrevMissing) (@hswapGraph) (@hcomponentPrev) + +private theorem helper_branch_1661.{u_1, u_2} : + helperBranch1661Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower sigma hsigmaProper + hsigmaOne hsigmaStable Tstar hTnTstar hstrict heligible closureTree hclosure hTstarClosure + hTnClosure q hqSucc hqCast hsigmaStableQ i previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails gamma + gammaRule secondStable secondStableProper secondStableOneUncolored secondStableRelation + exitWitness currentColoring currentProper currentOneUncolored currentStored currentEdges + currentKind currentVertex currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension htarget + have hi : i = q := by + exact @helper_hi_4786 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@i) (@htarget) + subst i + have hpeKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE := by + simpa [htarget] using currentKind + have hprefix := TdReplacementPrefixExact G k e0 input T generating ett + hMP hpositive hlower sigma hsigmaProper hsigmaOne + (by simpa [hqSucc] using hsigmaStable) + obtain ⟨sigmaPrev, hsigmaPrevProper, hsigmaPrevOne, + hsigmaPrevStable, hsigmaPrevEq, hparallelPrev, hprefixCases⟩ := hprefix + have hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev := by + simpa [hqSucc, hqCast] using hsigmaPrevStable + have hchoiceVertex : choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) := + choice.vertexDefective.1 + have hcomponent : ∀ w, + w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) → + (Sum.inl w ∈ TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) ↔ w = choice.vertex) := by + exact @helper_hcomponent_4809 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hqSucc) + (@gamma) (@choice) (@currentVertex) (@currentDelta) (@currentGamma) (@hpeKind) + obtain ⟨parallelVertex, parallelGamma, parallelDelta, + hparallelVertex, hparallelGamma, hparallelDelta, + hsigmaPrevSwitch⟩ := hparallelPrev (by simpa [hqSucc] using hpeKind) + have hparallelVertexEq : parallelVertex = choice.vertex := by + apply Option.some.inj + exact hparallelVertex.symm.trans (by simpa [hqSucc] using currentVertex) + have hparallelGammaEq : parallelGamma = gamma := by + apply Option.some.inj + exact hparallelGamma.symm.trans (by simpa [hqSucc] using currentGamma) + have hparallelDeltaEq : parallelDelta = choice.color := by + apply Option.some.inj + exact hparallelDelta.symm.trans (by simpa [hqSucc] using currentDelta) + subst parallelVertex + subst parallelGamma + subst parallelDelta + have hsigmaPrevFormula : sigmaPrev = + TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex) := hsigmaPrevSwitch + have hsigmaPrevEnlarged : StableColoring + (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected sigmaPrev := by + exact @helper_hsigmaPrevEnlarged_12232 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@hsigmaProper) (@hsigmaOne) (@Tstar) (@hsigmaStableQ) (@gamma) (@secondStable) + (@secondStableProper) (@secondStableOneUncolored) (@choice) (@gammaRule) + (@secondStableRelation) (@exitWitness) (@currentColoring) (@currentProper) + (@currentOneUncolored) (@currentStored) (@sigmaPrev) (@hchoiceVertex) (@hcomponent) + (@hsigmaPrevFormula) + have hdeltaBoundary : BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color = + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color := by + exact @helper_hdeltaBoundary_2443 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@Tstar) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) + (@hsigmaPrevEnlarged) + have hchoiceDefective : DefectiveColor G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color := by + exact @helper_hchoiceDefective_5167 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@choice) + (@sigmaPrev) (@hdeltaBoundary) + have hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color := by + exact @helper_hchoiceEdgeNew_5178 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@choice) + (@sigmaPrev) (@hdeltaBoundary) + exact @helper_continuation_2339 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) + (@hstrict) (@heligible) (@closureTree) (@hclosure) (@hTstarClosure) (@hTnClosure) (@hqSucc) + (@hsigmaStableQ) (@gamma) (@secondStable) (@secondStableProper) (@previousProper) + (@previousOneUncolored) (@previousClosed) (@noRevisiting) (@choice) + (@seriesAlternativeFails) (@gammaRule) (@secondStableRelation) (@currentColoring) + (@currentStored) (@currentEdges) (@currentKind) (@hpeKind) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hprefixCases) (@hsigmaPrevStableQ) (@hchoiceVertex) (@hcomponent) + (@hsigmaPrevFormula) (@hsigmaPrevEnlarged) (@hchoiceDefective) (@hchoiceEdgeNew) +private theorem helper_continuation_2265.{u_1, u_2} : + helperContinuation2265Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower sigma hsigmaProper + hsigmaOne hsigmaStable Tstar hTnTstar hstrict heligible closureTree hclosure hTstarClosure + hTnClosure q hqSucc adjoined previousProper previousOneUncolored noRevisiting choice + currentStored currentEdges currentKind hseKind sigmaPrev hsigmaPrevProper hsigmaPrevOne + hprefixCases hsigmaPrevStableQ hsigmaPrevSigma hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf newChoice hclosedPrev hnotStrongPrev hnewAlternative + rcases hprefixCases with hzero | hpositivePrefix + · exact @helper_branch_12854 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@hsigmaOne) + (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@heligible) (@closureTree) (@hclosure) + (@hTstarClosure) (@hTnClosure) (@hqSucc) (@adjoined) (@previousProper) + (@previousOneUncolored) (@choice) (@currentStored) (@currentEdges) (@currentKind) + (@hseKind) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) + (@hsigmaPrevSigma) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hclosedPrev) + (@hnotStrongPrev) (@hnewAlternative) (@hzero) + · rcases hpositivePrefix with ⟨hroundLarge, originalPrefix, hr, + hprefixMP, hprefixTrees, hprefixData, corr, hcorrFinalTree, + hcorrFinalColor, hcorrMP⟩ + let replacementLast : Fin (originalPrefix.rounds + 1) := + Fin.last originalPrefix.rounds + have horiginalPositive : 0 < originalPrefix.rounds := by + rw [hr] + omega + let previousReplacement : Fin originalPrefix.rounds := + ⟨originalPrefix.rounds - 1, + Nat.sub_lt horiginalPositive (by omega)⟩ + have hpreviousSucc : previousReplacement.succ = replacementLast := by + apply Fin.ext + simp [previousReplacement, replacementLast] + omega + have hlastMap : Fin.castLE (by omega) replacementLast = + q.castSucc := by + apply Fin.ext + simp [replacementLast, q, hr] + have hreplacementCurrentTree : + corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree q.succ.castSucc := by + exact @helper_hreplacementCurrentTree_4014 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@hqSucc) (@sigmaPrev) (@originalPrefix) (@corr) (@hcorrFinalTree) + have horiginalCurrentTree : + originalPrefix.series.data.tree replacementLast.castSucc = + ett.series.data.tree q.castSucc.castSucc := by + exact @helper_horiginalCurrentTree_4022 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@hroundLarge) + (@originalPrefix) (@hr) (@hprefixTrees) (@horiginalPositive) + have htreeMissingEq : TreeMissingColors + (corr.replacementSeries.data.coloring replacementLast) + (corr.replacementSeries.data.tree replacementLast.castSucc) = + TreeMissingColors + (originalPrefix.series.data.coloring replacementLast) + (originalPrefix.series.data.tree replacementLast.castSucc) := by + exact @helper_htreeMissingEq_4034 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@sigmaPrev) + (@originalPrefix) (@corr) (@horiginalPositive) (@hpreviousSucc) + have hreplacementStored : TashkinovStoredColors + corr.replacementSeries.data replacementLast = + TashkinovStoredColors ett.series.data q.castSucc := by + exact @helper_hreplacementStored_4052 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@sigmaPrev) + (@hroundLarge) (@originalPrefix) (@hr) (@hprefixData) (@corr) (@horiginalPositive) + (@hlastMap) (@htreeMissingEq) + let replacementChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree replacementLast.succ) + (TashkinovStoredColors corr.replacementSeries.data replacementLast) + (corr.replacementSeries.data.coloring replacementLast) := by + exact @helperReplacementChoice3411 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) + (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@originalPrefix) (@corr) (@hcorrFinalColor) + (@hreplacementCurrentTree) (@hreplacementStored) + have hnoRevisitingReplacement : ¬ Nonempty + (RevisitingExtensionCertificate corr.replacementSeries.data + replacementLast) := by + exact @helper_hnoRevisitingReplacement_4104 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) + (@hpositive) (@hlower) (@Tstar) (@previousProper) (@previousOneUncolored) + (@noRevisiting) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) + (@hroundLarge) (@originalPrefix) (@hr) (@hprefixMP) (@hprefixTrees) (@hprefixData) + (@corr) (@hcorrFinalTree) (@hcorrFinalColor) (@hcorrMP) + have hnewAlternativeReplacement : ∀ pi : PartialEdgeColoring E k, + IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring + (corr.replacementSeries.data.tree replacementLast.succ) + (insert replacementChoice.color + (TashkinovStoredColors corr.replacementSeries.data + replacementLast)) replacementChoice.selected pi → + Disjoint (MissingColors G pi replacementChoice.otherEndpoint) + (TreeMissingColors pi + (corr.replacementSeries.data.tree replacementLast.succ)) := by + exact @helper_hnewAlternativeReplacement_4116 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) + (@hsigmaPrevSelf) (@hnewAlternative) (@originalPrefix) (@corr) (@hcorrFinalColor) + (@hreplacementCurrentTree) (@hreplacementStored) + rcases heligible with hparallel | hsimple + · have hbad := hparallel.1.symm.trans + (by simpa [hqSucc] using hseKind) + cases hbad + · exact @helper_branch_1497 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hclosure) + (@hTstarClosure) (@hTnClosure) (@hqSucc) (@adjoined) (@previousProper) + (@previousOneUncolored) (@choice) (@currentStored) (@currentEdges) (@currentKind) + (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hsigmaPrevSigma) + (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) + (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) + (@hcorrFinalColor) (@horiginalPositive) (@hreplacementCurrentTree) (@hreplacementStored) + (@hnoRevisitingReplacement) (@hnewAlternativeReplacement) (@hsimple) + +private theorem helper_branch_2237.{u_1, u_2} : + helperBranch2237Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hpositive hlower sigma hsigmaProper + hsigmaOne hsigmaStable Tstar hTnTstar hstrict heligible closureTree hclosure hTstarClosure + hTnClosure q hqSucc hqCast hsigmaStableQ i previousProper previousOneUncolored + previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex currentOutside + currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension htarget + have hi : i = q := by + exact @helper_hi_3469 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@i) (@htarget) + subst i + have hseKind : ett.series.data.kind q.succ = + some TashkinovExtensionKind.SE := by + simpa [htarget] using currentKind + have hprefix := TdReplacementPrefixExact G k e0 input T generating ett + hMP hpositive hlower sigma hsigmaProper hsigmaOne + (by simpa [hqSucc] using hsigmaStable) + obtain ⟨sigmaPrev, hsigmaPrevProper, hsigmaPrevOne, + hsigmaPrevStable, hsigmaPrevEq, hparallelPrev, hprefixCases⟩ := hprefix + have hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev := by + simpa [hqSucc, hqCast] using hsigmaPrevStable + have hsigmaPrevSigma : sigmaPrev = sigma := + hsigmaPrevEq (Or.inl (by simpa [hqSucc] using hseKind)) + have hpreviousControl : + TreeMissingColors (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.castSucc ⊆ + TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.succ := + (HkuMissingStoredMonotone G k ett.rounds e0 input ett.series q).1 + have hdeltaCurrentControl : choice.color ∈ + TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.succ := by + exact @helper_hdeltaCurrentControl_3499 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@choice) + (@currentStored) + have henlargedControl : + TreeMissingColors choice.selected + (ett.series.data.tree q.succ.castSucc) ∪ + insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) ⊆ + TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.succ := by + exact @helper_henlargedControl_3516 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@choice) + (@currentColoring) (@hpreviousControl) (@hdeltaCurrentControl) + have hsigmaPrevEnlarged : StableColoring + (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected sigmaPrev := by + exact @helper_hsigmaPrevEnlarged_3532 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@hsigmaStableQ) (@choice) (@currentColoring) (@sigmaPrev) (@hsigmaPrevSigma) + (@henlargedControl) + have hdeltaBoundary : BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color = + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color := by + exact @helper_hdeltaBoundary_254 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@Tstar) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) + (@hsigmaPrevEnlarged) + have hchoiceDefective : DefectiveColor G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color := by + exact @helper_hchoiceDefective_3555 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@choice) + (@sigmaPrev) (@hdeltaBoundary) + have hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color := by + exact @helper_hchoiceEdgeNew_3566 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@choice) + (@sigmaPrev) (@hdeltaBoundary) + have hsigmaPrevSelf : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + sigmaPrev sigmaPrev := by + exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc)).refl + ⟨sigmaPrev, hsigmaPrevProper, hsigmaPrevOne⟩ + let newChoice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := by + exact @helperNewChoice2409 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@previousProper) + (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) + (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) + have hclosedPrev : ColoredVertexSetClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) := by + exact @helper_hclosedPrev_356 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@Tstar) (@previousProper) (@previousOneUncolored) (@previousClosed) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) + have hnotStrongPrev : ¬ ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) := by + exact @helper_hnotStrongPrev_3595 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@choice) + (@sigmaPrev) (@hchoiceDefective) + have hnewAlternative : ∀ pi : PartialEdgeColoring E k, + IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc)) + newChoice.selected pi → + Disjoint (MissingColors G pi newChoice.otherEndpoint) + (TreeMissingColors pi + (ett.series.data.tree q.succ.castSucc)) := by + exact @helper_hnewAlternative_3611 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@previousProper) + (@previousOneUncolored) (@choice) (@seriesAlternative) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hsigmaPrevEnlarged) (@hchoiceDefective) + (@hchoiceEdgeNew) (@hsigmaPrevSelf) + exact @helper_continuation_2265 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) (@hpositive) + (@hlower) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) (@Tstar) (@hTnTstar) + (@hstrict) (@heligible) (@closureTree) (@hclosure) (@hTstarClosure) (@hTnClosure) (@hqSucc) + (@adjoined) (@previousProper) (@previousOneUncolored) (@noRevisiting) (@choice) + (@currentStored) (@currentEdges) (@currentKind) (@hseKind) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hprefixCases) (@hsigmaPrevStableQ) (@hsigmaPrevSigma) + (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) + (@hnewAlternative) +theorem TdTerminalSEPERebuild {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hpositive : 0 < ett.rounds) + (hlower : LowerRoundInductionHypothesis G k e0 ett.rounds) : + let n : Fin (ett.rounds + 1) := Fin.last ett.rounds + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.PE) → + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + StableColoring Tn + (TashkinovStoredColors ett.series.data n) + (ett.series.data.coloring n) sigma → + ModColoring ett sigma := by + classical + dsimp + intro hterminal sigma hsigmaProper hsigmaOne hsigmaStable + refine ⟨hsigmaProper, hsigmaOne, ?_⟩ + intro Tstar hTnTstar hstrict heligible + obtain ⟨closureTree, hclosure⟩ := TashkinovClosureExists sigma Tstar + have hTstarClosure : TreeSequenceInitialSegment Tstar closureTree := + TashkinovAugmentationSequenceInitialSegment sigma Tstar closureTree hclosure.1 + have hTnClosure : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree := by + exact @helper_hTnClosure_112 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@Tstar) (@hTnTstar) (@closureTree) + (@hTstarClosure) + let q : Fin ett.rounds := + ⟨ett.rounds - 1, + Nat.sub_lt (Nat.zero_lt_of_lt hpositive) (by omega)⟩ + have hqSucc : q.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [q] + omega + have hqCast : q.castSucc = + (⟨ett.rounds - 1, by omega⟩ : Fin (ett.rounds + 1)) := by + apply Fin.ext + rfl + have hsigmaStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma := by + simpa [hqSucc] using hsigmaStable + have hfinalStep := ett.series.certified (Fin.last ett.rounds) + generalize htarget : (Fin.last ett.rounds : Fin (ett.rounds + 1)) = + target at hfinalStep + cases hfinalStep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hv := congrArg Fin.val htarget + simp at hv + omega + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + exact @helper_branch_3453 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hterminal) (@sigma) (@Tstar) (@i) + (@currentKind) (@htarget) + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + exact @helper_branch_2237 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) + (@hpositive) (@hlower) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) + (@Tstar) (@hTnTstar) (@hstrict) (@heligible) (@closureTree) (@hclosure) + (@hTstarClosure) (@hTnClosure) (@hqSucc) (@hqCast) (@hsigmaStableQ) (@i) + (@previousProper) (@previousOneUncolored) (@previousClosed) + (@previousNotStronglyClosed) (@noRevisiting) (@choice) (@seriesAlternative) + (@currentColoring) (@currentStored) (@currentEdges) (@currentKind) (@currentVertex) + (@currentOutside) (@currentDelta) (@currentGamma) (@adjoined) (@adjoinedExactly) + (@closedExtension) (@orderedExtension) (@strictExtension) (@htarget) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + exact @helper_branch_1661 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hMP) + (@hpositive) (@hlower) (@sigma) (@hsigmaProper) (@hsigmaOne) (@hsigmaStable) + (@Tstar) (@hTnTstar) (@hstrict) (@heligible) (@closureTree) (@hclosure) + (@hTstarClosure) (@hTnClosure) (@hqSucc) (@hqCast) (@hsigmaStableQ) (@i) + (@previousProper) (@previousOneUncolored) (@previousClosed) + (@previousNotStronglyClosed) (@noRevisiting) (@choice) (@seriesAlternativeFails) + (@gamma) (@gammaRule) (@secondStable) (@secondStableProper) + (@secondStableOneUncolored) (@secondStableRelation) (@exitWitness) + (@currentColoring) (@currentProper) (@currentOneUncolored) (@currentStored) + (@currentEdges) (@currentKind) (@currentVertex) (@currentOutside) (@currentDelta) + (@currentGamma) (@closedExtension) (@orderedExtension) (@strictExtension) (@htarget) +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TechnicalCurrentLadderMissingBoundLarge.lean b/LeanPool/GoldbergSeymour/TechnicalCurrentLadderMissingBoundLarge.lean new file mode 100644 index 0000000000..e210087667 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TechnicalCurrentLadderMissingBoundLarge.lean @@ -0,0 +1,419 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ElementaryClosedMissingColorOdd + +public import LeanPool.GoldbergSeymour.HierarchyBaseExists + +public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary + +public import LeanPool.GoldbergSeymour.TreeMissingColorsCardLowerBound +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetStrict + +/-! +# Technical Current Ladder Missing Bound Large + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_stepFacts_59.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (i : Fin ett.rounds), IsProperEdgeColoring G + (ett.series.data.coloring i.castSucc) ∧ IsOneEdgeUncolored (ett.series.data.coloring + i.castSucc) e0 ∧ ColoredVertexSetClosed G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) ∧ + TreeSequenceInitialSegment (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree + i.succ.succ) ∧ (ett.series.data.tree i.succ.castSucc).length < (ett.series.data.tree + i.succ.succ).length := by + classical + intro V E _ _ _ G k e0 input T generating ett r + have fact := ett.series.certified r.succ + generalize hi : r.succ = z at fact ⊢ + cases fact with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + simp_all [] + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hsame : i = r := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + simpa [hi] using ⟨previousProper, previousOneUncolored, previousClosed, + orderedExtension, strictExtension⟩ + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hsame : i = r := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + simpa [hi] using ⟨previousProper, previousOneUncolored, previousClosed, + orderedExtension, strictExtension⟩ + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hsame : i = r := by + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + subst i + simpa [hi] using ⟨previousProper, previousOneUncolored, previousClosed, + orderedExtension, strictExtension⟩ + +private theorem helper_elementaryAt_110.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → TechnicalInductionContext G k e0 ett.rounds + → (0 : ℕ) < ett.rounds → + ∀ (r : Fin ett.rounds), ColoredVertexSetElementary G (ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP ctx positive r + by_cases hfirst : r.val = 0 + · have hr : r = (⟨0, positive⟩ : Fin ett.rounds) := by + apply Fin.ext + exact hfirst + subst r + exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + · let q : ℕ := r.val + have hrpos : 1 ≤ r.val := Nat.one_le_iff_ne_zero.mpr hfirst + have hrlt := r.isLt + have hqpos : 1 ≤ q := by dsimp [q]; exact hrpos + have hqbefore : q < ett.rounds := by dsimp [q]; exact hrlt + obtain ⟨restricted, hrq, hrestricted, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T generating ett hMP q + (by omega) hqbefore + have he : ColoredVertexSetElementary G + (ett.series.data.coloring ⟨q, by omega⟩) + (TreeSequenceVertexSet (ett.series.data.tree ⟨q + 1, by omega⟩)) := by + exact ctx.lowerOne (input := input) + (T := ett.series.data.tree ⟨q + 1, by omega⟩) + (generating := ett.series.data.coloring ⟨q, by omega⟩) restricted (by omega) + (by simpa [hrq] using hqbefore) hrestricted + have eqcolor : (⟨q, by omega⟩ : Fin (ett.rounds + 1)) = r.castSucc := by + apply Fin.ext + dsimp [q] + have eqtree : (⟨q + 1, by omega⟩ : Fin (ett.rounds + 2)) = r.succ.castSucc := by + apply Fin.ext + dsimp [q] + rw [eqcolor, eqtree] at he + exact he + +private theorem helper_oddAt_143.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumDegree G + (1 : ℕ) ≤ k → ( + ∀ (i : Fin ett.rounds), IsProperEdgeColoring G (ett.series.data.coloring i.castSucc) ∧ + IsOneEdgeUncolored (ett.series.data.coloring i.castSucc) e0 ∧ ColoredVertexSetClosed G + (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + i.succ.castSucc)) ∧ TreeSequenceInitialSegment (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ) ∧ (ett.series.data.tree i.succ.castSucc).length < + (ett.series.data.tree i.succ.succ).length) → ( + ∀ (r : Fin ett.rounds), ColoredVertexSetElementary G (ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc))) → + ∀ (r : Fin ett.rounds), Odd (TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc)).card := by + classical + intro V E _ _ _ G k e0 input T generating ett hdegree stepFacts elementaryAt r + have he : ColoredVertexSetElementary G (ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) := + elementaryAt r + have sf := stepFacts r + have hp : IsProperEdgeColoring G (ett.series.data.coloring r.castSucc) := sf.1 + have hc : ColoredVertexSetClosed G (ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)) := sf.2.2.1 + obtain ⟨alpha, halpha⟩ := Finset.card_pos.mp (by + have hh := TreeMissingColorsCardLowerBound G k e0 + (ett.series.data.coloring r.castSucc) + (ett.series.data.tree r.succ.castSucc) (by simpa using sf.2.1.1) + hdegree he + have hnon : 0 ≤ + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)).card := + Nat.zero_le _ + have hpos : 0 < + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc)).card + 2 := by + omega + exact lt_of_lt_of_le hpos hh) + have hclosed : TreeColorSetClosed G + (ett.series.data.coloring r.castSucc) + (ett.series.data.tree r.succ.castSucc) {alpha} := by + intro beta hbeta + have hba : beta = alpha := by simpa using hbeta + rw [hba] + ext f + constructor + · intro hf + simp only [BoundaryColorEdges, Finset.mem_filter] at hf + obtain ⟨v, hv, hmv⟩ := Finset.mem_biUnion.mp halpha + exact False.elim ((hc hf.1 hv hf.2) hmv) + · intro hf + simp at hf + exact ElementaryClosedMissingColorOdd G k e0 + (ett.series.data.coloring r.castSucc) + (ett.series.data.tree r.succ.castSucc) alpha hp he + (by simpa using halpha) hclosed + +private theorem helper_cardBound_183.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → (11 : ℕ) ≤ TashkinovOrder G → (0 : ℕ) < + ett.rounds → ( + ∀ (i : Fin ett.rounds), IsProperEdgeColoring G (ett.series.data.coloring i.castSucc) ∧ + IsOneEdgeUncolored (ett.series.data.coloring i.castSucc) e0 ∧ ColoredVertexSetClosed G + (ett.series.data.coloring i.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + i.succ.castSucc)) ∧ TreeSequenceInitialSegment (ett.series.data.tree i.succ.castSucc) + (ett.series.data.tree i.succ.succ) ∧ (ett.series.data.tree i.succ.castSucc).length < + (ett.series.data.tree i.succ.succ).length) → ( + ∀ (r : Fin ett.rounds), Odd (TreeSequenceVertexSet (ett.series.data.tree + r.succ.castSucc)).card) → + ∀ (n : ℕ) (hn : n < ett.rounds), (2 : ℕ) * n + (11 : ℕ) ≤ (TreeSequenceVertexSet + (ett.series.data.tree (⟨n, hn⟩ : Fin ett.rounds).succ.castSucc)).card := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hlarge positive stepFacts oddAt n hn + induction n using Nat.strong_induction_on with + | h n ih => + by_cases hz : n = 0 + · subst n + have hbaseEq := hMP.1 + calc + 11 ≤ TashkinovOrder G := hlarge + _ = (TreeSequenceVertexSet + (ett.series.data.tree (⟨1, by omega⟩ : Fin (ett.rounds + 2)))).card := by + simpa using hbaseEq.symm + · let p : Fin ett.rounds := ⟨n - 1, by omega⟩ + have hp := ih (n - 1) (by omega) (by omega) + have sf := stepFacts p + have hseg := TreeSequenceInitialSegmentVertexSetStrict sf.2.2.2.1 sf.2.2.2.2 + have hsegCard := Finset.card_lt_card hseg + have hp' : 2 * (n - 1) + 11 ≤ + (TreeSequenceVertexSet (ett.series.data.tree p.succ.castSucc)).card := by + exact hp + obtain ⟨a, ha⟩ := oddAt p + let cur : Fin ett.rounds := ⟨n, by omega⟩ + obtain ⟨b, hb⟩ := oddAt cur + have heq : cur.succ.castSucc = p.succ.succ := by + apply Fin.ext + dsimp [cur, p] + omega + have hb' : (TreeSequenceVertexSet + (ett.series.data.tree p.succ.succ)).card = 2 * b + 1 := by + rw [← heq] + exact hb + have hnext : 2 * n + 11 ≤ + (TreeSequenceVertexSet (ett.series.data.tree p.succ.succ)).card := by + omega + rw [← heq] at hnext + exact hnext + +private theorem helper_finalFacts_230.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → TechnicalInductionContext G k e0 ett.rounds + → (0 : ℕ) < ett.rounds → ( + ∀ (r : Fin ett.rounds), ColoredVertexSetElementary G (ett.series.data.coloring r.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree r.succ.castSucc))) → + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let finalTree : TreeSequence G e0 := ett.series.data.tree terminal.castSucc; + ColoredVertexSetElementary G generating (TreeSequenceVertexSet finalTree) ∧ + IsProperEdgeColoring G generating ∧ IsOneEdgeUncolored generating e0 := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP ctx positive elementaryAt terminal finalTree + have cert := ett.series.certified terminal + generalize ht : terminal = z at cert + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma initialClosure => + have : (0 : Fin (ett.rounds + 1)) = terminal := by simp [ht] + have : False := by + have hzero : terminal = 0 := by simp [ht] + have hv := congrArg Fin.val hzero + simp [terminal] at hv + omega + exact this.elim + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i.succ = terminal := by simp [ht] + have hprev : ColoredVertexSetElementary G + (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet finalTree) := by + have ee : ColoredVertexSetElementary G + (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) := + elementaryAt i + have htree : ett.series.data.tree i.succ.castSucc = finalTree := by + simp [finalTree, hi] + rw [htree] at ee + unfold ColoredVertexSetElementary at ee ⊢ + intro u hu v hv huv + exact ee hu hv huv + have hgen : generating = choice.selected := by + calc + generating = ett.series.data.coloring terminal := ett.generatingColoring + _ = choice.selected := by rw [← currentColoring]; simp [hi] + rw [hgen] + refine ⟨?_, choice.selectedProper, + by simpa [hgen] using choice.selectedOneUncolored⟩ + intro u hu v hv huv + have hui : u ∈ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc) := by + simpa [finalTree, hi] using hu + have hvi : v ∈ TreeSequenceVertexSet + (ett.series.data.tree i.succ.castSucc) := by + simpa [finalTree, hi] using hv + rw [choice.selectedStable.2 u hui, choice.selectedStable.2 v hvi] + exact hprev hu hv huv + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension orderedExtension + strictExtension => + have hi : i.succ = terminal := by simp [ht] + have hgen : generating = ett.series.data.coloring terminal := by + exact ett.generatingColoring + have base := Classical.choice (HierarchyBaseExists ett) + have stable : StableColoring finalTree + (TashkinovStoredColors ett.series.data terminal) generating generating := by + unfold StableColoring + exact ⟨by intro f hf h; rfl, by intro v hv; rfl⟩ + have coreElem : ColoredVertexSetElementary G generating + (TreeSequenceVertexSet base.core) := + ParallelClosureUnionElementary G k e0 input + T generating ett hMP positive + (by + intro input' T' generating' lowerE hp hb hm + exact ⟨ctx.lowerOne lowerE hp hb hm, + ctx.lowerTwo lowerE hp hb hm, + ctx.lowerThree lowerE hp hb hm, + ctx.lowerFour lowerE hp hb hm, + ctx.lowerFive lowerE hp hb hm, + ctx.lowerSix lowerE hp hb hm⟩) + (by simpa [hi] using currentKind) + generating (by + rw [hgen] + rw [← hi] + exact currentProper) + (by + rw [hgen] + rw [← hi] + exact currentOneUncolored) stable base + obtain ⟨closureFact, union, unionFact⟩ := + base.parallel (by simpa [hi] using currentKind) + obtain ⟨unionFact⟩ := unionFact + have subset := TreeSequenceInitialSegmentVertexSetSubset unionFact.leftSegment + have cp : IsProperEdgeColoring G + (ett.series.data.coloring terminal) := by + rw [← hi] + exact currentProper + have co : IsOneEdgeUncolored + (ett.series.data.coloring terminal) e0 := by + rw [← hi] + exact currentOneUncolored + refine ⟨?_, by rw [hgen]; exact cp, by rw [hgen]; exact co⟩ + intro u hu v hv huv + exact coreElem (subset hu) (subset hv) huv + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hi : i.succ = terminal := by simp [ht] + have hprev : ColoredVertexSetElementary G + (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet finalTree) := by + have ee : ColoredVertexSetElementary G + (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet (ett.series.data.tree i.succ.castSucc)) := + elementaryAt i + have htree : ett.series.data.tree i.succ.castSucc = finalTree := by + simp [finalTree, hi] + rw [htree] at ee + unfold ColoredVertexSetElementary at ee ⊢ + intro u hu v hv huv + exact ee hu hv huv + have hgen : generating = ett.series.data.coloring i.castSucc := by + calc + generating = ett.series.data.coloring terminal := ett.generatingColoring + _ = ett.series.data.coloring i.succ := by rw [hi] + _ = ett.series.data.coloring i.castSucc := currentColoring + refine ⟨?_, by simpa [hgen] using previousProper, + by simpa [hgen] using previousOneUncolored⟩ + rw [hgen] + exact hprev + +theorem TechnicalCurrentLadderMissingBoundLarge + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (ctx : TechnicalInductionContext G k e0 ett.rounds) + (hdegree : MaximumDegree G + 1 <= k) + (hlarge : 11 <= TashkinovOrder G) : + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tn : TreeSequence G e0 := ett.series.data.tree terminal.castSucc + 2 * ett.rounds + 11 <= (TreeMissingColors generating Tn).card := by + classical + dsimp + have positive : 0 < ett.rounds := Nat.lt_of_lt_of_le Nat.zero_lt_one ett.roundsPositive + have stepFacts := @helper_stepFacts_59 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett + have elementaryAt := @helper_elementaryAt_110 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T generating ett hMP ctx positive + have oddAt := @helper_oddAt_143 V E inferInstance inferInstance inferInstance G k e0 input T + generating ett hdegree stepFacts elementaryAt + have cardBound := @helper_cardBound_183 V E inferInstance inferInstance inferInstance G k e0 input + T generating ett hMP hlarge positive stepFacts oddAt + have hvertex : 2 * ett.rounds + 9 ≤ + (TreeSequenceVertexSet + (ett.series.data.tree (Fin.last ett.rounds).castSucc)).card := by + have hh := cardBound (ett.rounds - 1) (by omega) + have heq : ett.rounds - 1 + 1 = ett.rounds := Nat.sub_add_cancel (by omega) + convert hh using 1 <;> simp [Fin.last, heq]; omega + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let finalTree : TreeSequence G e0 := ett.series.data.tree terminal.castSucc + have finalFacts := @helper_finalFacts_230 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T generating ett hMP ctx positive elementaryAt + have hmissing := TreeMissingColorsCardLowerBound G k e0 generating finalTree + (by simpa [finalTree] using finalFacts.2.2.1) hdegree finalFacts.1 + have hv : 2 * ett.rounds + 9 ≤ + (TreeSequenceVertexSet finalTree).card := by + simpa [finalTree, terminal] using hvertex + calc + 2 * ett.rounds + 11 ≤ (TreeSequenceVertexSet finalTree).card + 2 := by omega + _ ≤ (TreeMissingColors generating finalTree).card := hmissing + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TechnicalCurrentRungElementaryLarge.lean b/LeanPool/GoldbergSeymour/TechnicalCurrentRungElementaryLarge.lean new file mode 100644 index 0000000000..ad38f25536 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TechnicalCurrentRungElementaryLarge.lean @@ -0,0 +1,200 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CurrentElementaryOrGoodHierarchyConstructionLarge + +/-! +# Technical Current Rung Elementary Large + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TechnicalCurrentRungElementaryLarge + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (ctx : TechnicalInductionContext G k e0 ett.rounds) + (hdegree : MaximumDegree G + 1 <= k) + (hlarge : 11 <= TashkinovOrder G) : + ColoredVertexSetElementary G generating + (TreeSequenceVertexSet T) := by + rcases CurrentElementaryOrGoodHierarchyConstructionLarge + G k e0 input T generating ett hMP ctx hdegree hlarge with + hElementary | ⟨U, corrU, hMPU, baseU, H, good, _, hvertices⟩ + · exact hElementary + · have hlower : forall {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (lower : ExtendedTashkinovTree G k e0 input' T' generating'), + 0 < lower.rounds -> + lower.rounds < corrU.replacementETT.rounds -> + MaximumProperty lower -> + ColoredVertexSetElementary G generating' + (TreeSequenceVertexSet T') /\ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tnext : TreeSequence G e0 := + lower.series.data.tree (Fin.last (lower.rounds + 1)) + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tnext + (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma -> + forall alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma Tnext \/ + beta ∈ TreeMissingColors sigma Tnext) -> + TreeInterchangeable G Tnext sigma alpha beta) /\ + ((forall (q : Fin lower.rounds) (v : V), + lower.series.data.kind q.succ = + some TashkinovExtensionKind.PE -> + lower.series.data.chosenVertex q.succ = some v -> + forall hvFinal : v ∈ TreeSequenceVertexSet T', + forall j : Fin (lower.rounds + 1), + ETTFirstAppearanceIndex lower v hvFinal = j.val + 1 -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> + IsOneEdgeUncolored sigma e0 -> + StableColoring + (lower.series.data.tree q.succ.castSucc) + (TashkinovStoredColors lower.series.data q.succ) + (lower.series.data.coloring q.succ) sigma -> + StableColoringBeforeVertex T' v hvFinal + (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma /\ + (0 < j.val -> + StableColoring (lower.series.data.tree j.castSucc) + (TashkinovStoredColors lower.series.data j) + (lower.series.data.coloring j) sigma)) /\ + forall (q r : Fin lower.rounds) (vq vr : V), + q ≠ r -> vq ≠ vr -> + lower.series.data.kind q.succ = + some TashkinovExtensionKind.PE -> + lower.series.data.kind r.succ = + some TashkinovExtensionKind.PE -> + lower.series.data.chosenVertex q.succ = some vq -> + lower.series.data.chosenVertex r.succ = some vr -> + forall (hvq : vq ∈ TreeSequenceVertexSet T') + (hvr : vr ∈ TreeSequenceVertexSet T'), + ETTFirstAppearanceIndex lower vq hvq = + ETTFirstAppearanceIndex lower vr hvr -> + Disjoint (lower.series.data.stored q.succ) + (lower.series.data.stored r.succ)) /\ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn : TreeSequence G e0 := + lower.series.data.tree n.castSucc + forall (v : V) (gamma delta : Fin k), + lower.series.data.kind n = some TashkinovExtensionKind.PE -> + lower.series.data.chosenVertex n = some v -> + lower.series.data.gamma n = some gamma -> + lower.series.data.delta n = some delta -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> + IsOneEdgeUncolored sigma e0 -> + StableColoring Tn + (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma -> + forall w, w ∈ TreeSequenceVertexSet Tn -> + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) <-> w = v)) /\ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn : TreeSequence G e0 := + lower.series.data.tree n.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tn + (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma -> + forall (delta : Fin k), + DefectiveColor G sigma (TreeSequenceVertexSet Tn) delta -> + forall (v : V), + BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tn) delta v -> + (exists w, BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tn) delta w /\ + TreeVertexOrder Tn w v) -> + forall (hvFinal : v ∈ TreeSequenceVertexSet T') + (q : Fin lower.rounds) (vi : V), + (lower.series.data.kind q.succ = + some TashkinovExtensionKind.PE \/ + lower.series.data.kind q.succ = + some TashkinovExtensionKind.SE) -> + lower.series.data.chosenVertex q.succ = some vi -> + ETTFirstAppearanceIndex lower v hvFinal <= q.val + 1 -> + v = vi \/ TreeVertexOrder T' v vi) /\ + (let n : Fin (lower.rounds + 1) := Fin.last lower.rounds + let Tn : TreeSequence G e0 := + lower.series.data.tree n.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tn + (TashkinovStoredColors lower.series.data n) + (lower.series.data.coloring n) sigma -> + ModColoring lower sigma) := by + intro input' T' generating' lower hpositive hround hmaximum + have hround' : lower.rounds < ett.rounds := by + simpa [corrU.rungAgreement] using hround + exact ⟨ctx.lowerOne lower hpositive hround' hmaximum, + ctx.lowerTwo lower hpositive hround' hmaximum, + ctx.lowerThree lower hpositive hround' hmaximum, + ctx.lowerFour lower hpositive hround' hmaximum, + ctx.lowerFive lower hpositive hround' hmaximum, + ctx.lowerSix lower hpositive hround' hmaximum⟩ + have hcurrent := fun {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (hround : current.rounds = corrU.replacementETT.rounds) + (hmaximum : MaximumProperty current) => + And.intro + (ctx.currentThree current (hround.trans corrU.rungAgreement) hmaximum) + (And.intro + (ctx.currentFour current (hround.trans corrU.rungAgreement) hmaximum) + (And.intro + (ctx.currentFive current (hround.trans corrU.rungAgreement) hmaximum) + (ctx.currentSix current (hround.trans corrU.rungAgreement) + hmaximum))) + have hbound := fun {input' : PartialEdgeColoring E k} + {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (current : ExtendedTashkinovTree G k e0 input' T' generating') + (hround : current.rounds = corrU.replacementETT.rounds) + (hmaximum : MaximumProperty current) + (_ : HierarchyBase current generating') + (_ : TashkinovHierarchy current ‹HierarchyBase current generating'›) + (_ : GoodHierarchy ‹TashkinovHierarchy current + ‹HierarchyBase current generating'››) => by + have hround' : current.rounds = ett.rounds := + hround.trans corrU.rungAgreement + let currentCtx : TechnicalInductionContext G k e0 current.rounds := + hround'.symm ▸ ctx + exact TechnicalCurrentLadderMissingBoundLarge + G k e0 input' T' generating' current hmaximum currentCtx + hdegree hlarge + have hUElementary : ColoredVertexSetElementary G generating + (TreeSequenceVertexSet U) := by + exact GoodHierarchyElementaryLarge + G k e0 corrU.replacementInput U generating corrU.replacementETT + hMPU baseU H good hlower hcurrent hlarge hbound + have hsubsetFinal := + TreeSequenceInitialSegmentVertexSetSubset ett.belowFinal + have hsubsetU : TreeSequenceVertexSet T ⊆ TreeSequenceVertexSet U := by + simpa [hvertices] using hsubsetFinal + intro u hu v hv huv + exact hUElementary (hsubsetU hu) (hsubsetU hv) huv + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TechnicalInductionContext.lean b/LeanPool/GoldbergSeymour/TechnicalInductionContext.lean new file mode 100644 index 0000000000..5df9f28627 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TechnicalInductionContext.lean @@ -0,0 +1,181 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorVertex +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex + +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.ModColoring + +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex + +public import LeanPool.GoldbergSeymour.TreeInterchangeable + +/-! +# Technical Induction Context + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- +The lower-round and current-round properties available to the simultaneous technical induction. -/ +structure TechnicalInductionContext {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : Nat) (e0 : E) (n : Nat) where + lowerOne : + ∀ {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k e0 input T + generating), 0 < ett.rounds → ett.rounds < n → MaximumProperty ett → + ColoredVertexSetElementary G generating (TreeSequenceVertexSet T) + lowerTwo : + ∀ {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k e0 input T + generating), 0 < ett.rounds → ett.rounds < n → MaximumProperty ett → + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tnext : TreeSequence G e0 := ett.series.data.tree (Fin.last (ett.rounds + 1)) + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tnext (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma → + ∀ alpha beta : Fin k, (alpha ∈ TreeMissingColors sigma Tnext ∨ beta ∈ TreeMissingColors sigma + Tnext) → TreeInterchangeable G Tnext sigma alpha beta + lowerThree : + ∀ {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k e0 input T + generating), 0 < ett.rounds → ett.rounds < n → MaximumProperty ett → (( + ∀ (q : Fin ett.rounds) (v : V), ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T, + ∀ j : Fin (ett.rounds + 1), ETTFirstAppearanceIndex ett v hvFinal = j.val + 1 → + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma ∧ (0 < j.val → StableColoring (ett.series.data.tree + j.castSucc) (TashkinovStoredColors ett.series.data j) (ett.series.data.coloring j) sigma)) + ∧ + ∀ (q r : Fin ett.rounds) (vq vr : V), q ≠ r → vq ≠ vr → ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ett.series.data.kind r.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some vq → ett.series.data.chosenVertex r.succ = some + vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T) (hvr : vr ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett vq hvq = ETTFirstAppearanceIndex ett vr hvr → Disjoint + (ett.series.data.stored q.succ) (ett.series.data.stored r.succ)) + lowerFour : + ∀ {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k e0 input T + generating), 0 < ett.rounds → ett.rounds < n → MaximumProperty ett → + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := ett.series.data.tree terminal.castSucc + ∀ (v : V) (gamma delta : Fin k), ett.series.data.kind terminal = some + TashkinovExtensionKind.PE → ett.series.data.chosenVertex terminal = some v → + ett.series.data.gamma terminal = some gamma → ett.series.data.delta terminal = some delta + → + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tterminal (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma → + ∀ w, w ∈ TreeSequenceVertexSet Tterminal → (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) ↔ w = v) + lowerFive : + ∀ {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k e0 input T + generating), 0 < ett.rounds → ett.rounds < n → MaximumProperty ett → + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := ett.series.data.tree terminal.castSucc + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tterminal (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma → + ∀ delta : Fin k, DefectiveColor G sigma (TreeSequenceVertexSet Tterminal) delta → + ∀ v : V, BoundaryColorVertex G sigma (TreeSequenceVertexSet Tterminal) delta v → (exists w, + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tterminal) delta w ∧ TreeVertexOrder + Tterminal w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (vi : V), (ett.series.data.kind + q.succ = some TashkinovExtensionKind.PE ∨ ett.series.data.kind q.succ = some + TashkinovExtensionKind.SE) → ett.series.data.chosenVertex q.succ = some vi → + ETTFirstAppearanceIndex ett v hvFinal ≤ q.val + 1 → v = vi ∨ TreeVertexOrder T v vi + lowerSix : + ∀ {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k e0 input T + generating), 0 < ett.rounds → ett.rounds < n → MaximumProperty ett → + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := ett.series.data.tree terminal.castSucc + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tterminal (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma → ModColoring ett sigma + currentThree : + ∀ {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k e0 input T + generating), ett.rounds = n → MaximumProperty ett → (( + ∀ (q : Fin ett.rounds) (v : V), ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some v → + ∀ hvFinal : v ∈ TreeSequenceVertexSet T, + ∀ j : Fin (ett.rounds + 1), ETTFirstAppearanceIndex ett v hvFinal = j.val + 1 → + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + StableColoringBeforeVertex T v hvFinal (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma ∧ (0 < j.val → StableColoring (ett.series.data.tree + j.castSucc) (TashkinovStoredColors ett.series.data j) (ett.series.data.coloring j) sigma)) + ∧ + ∀ (q r : Fin ett.rounds) (vq vr : V), q ≠ r → vq ≠ vr → ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ett.series.data.kind r.succ = some TashkinovExtensionKind.PE → + ett.series.data.chosenVertex q.succ = some vq → ett.series.data.chosenVertex r.succ = some + vr → + ∀ (hvq : vq ∈ TreeSequenceVertexSet T) (hvr : vr ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett vq hvq = ETTFirstAppearanceIndex ett vr hvr → Disjoint + (ett.series.data.stored q.succ) (ett.series.data.stored r.succ)) + currentFour : + ∀ {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k e0 input T + generating), ett.rounds = n → MaximumProperty ett → + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := ett.series.data.tree terminal.castSucc + ∀ (v : V) (gamma delta : Fin k), ett.series.data.kind terminal = some + TashkinovExtensionKind.PE → ett.series.data.chosenVertex terminal = some v → + ett.series.data.gamma terminal = some gamma → ett.series.data.delta terminal = some delta + → + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tterminal (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma → + ∀ w, w ∈ TreeSequenceVertexSet Tterminal → (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) ↔ w = v) + currentFive : + ∀ {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k e0 input T + generating), ett.rounds = n → MaximumProperty ett → + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := ett.series.data.tree terminal.castSucc + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tterminal (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma → + ∀ delta : Fin k, DefectiveColor G sigma (TreeSequenceVertexSet Tterminal) delta → + ∀ v : V, BoundaryColorVertex G sigma (TreeSequenceVertexSet Tterminal) delta v → (exists w, + BoundaryColorVertex G sigma (TreeSequenceVertexSet Tterminal) delta w ∧ TreeVertexOrder + Tterminal w v) → + ∀ (hvFinal : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (vi : V), (ett.series.data.kind + q.succ = some TashkinovExtensionKind.PE ∨ ett.series.data.kind q.succ = some + TashkinovExtensionKind.SE) → ett.series.data.chosenVertex q.succ = some vi → + ETTFirstAppearanceIndex ett v hvFinal ≤ q.val + 1 → v = vi ∨ TreeVertexOrder T v vi + currentSix : + ∀ {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} (ett : ExtendedTashkinovTree G k e0 input T + generating), ett.rounds = n → MaximumProperty ett → + let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := ett.series.data.tree terminal.castSucc + ∀ sigma : PartialEdgeColoring E k, IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 + → StableColoring Tterminal (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma → ModColoring ett sigma + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TechnicalTheoremBase.lean b/LeanPool/GoldbergSeymour/TechnicalTheoremBase.lean new file mode 100644 index 0000000000..0ba2888a45 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TechnicalTheoremBase.lean @@ -0,0 +1,226 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TashkinovTree +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TashTree +public import LeanPool.GoldbergSeymour.Tchange +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion + +/-! +# Technical Theorem Base + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TechnicalTheoremBase {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) + (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (series : TashkinovSeries G k rounds e0 input) : + ColoredVertexSetElementary G (series.data.coloring 0) + (TreeSequenceVertexSet (series.data.tree ⟨1, by omega⟩)) ∧ + (let i0 : Fin (rounds + 1) := 0 + let T1 : TreeSequence G e0 := series.data.tree ⟨1, by omega⟩ + ∀ sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + StableColoring T1 (TashkinovStoredColors series.data i0) + (series.data.coloring i0) sigma → + ∀ alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma T1 ∨ beta ∈ TreeMissingColors sigma T1) → + TreeInterchangeable G T1 sigma alpha beta) := by + classical + have initial := series.certified (0 : Fin (rounds + 1)) + cases initial with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have seedTree : TashkinovTree G e0 (series.data.coloring 0) + (series.data.tree 0) := by + intro j hj + rw [seedLength] at j + omega + have triple' : KTriple G k e0 (series.data.coloring 0) := by + simpa [initialColoring] using triple + have treeOne : TashkinovTree G e0 (series.data.coloring 0) + (series.data.tree ⟨1, by omega⟩) := + TashkinovAugmentationSequencePreservesTashkinovTree G e0 + (series.data.coloring 0) (series.data.tree 0) + (series.data.tree ⟨1, by omega⟩) seedTree initialClosure.1 + have elementary : ColoredVertexSetElementary G (series.data.coloring 0) + (TreeSequenceVertexSet (series.data.tree ⟨1, by omega⟩)) := + TashTree G k e0 (series.data.coloring 0) + (series.data.tree ⟨1, by omega⟩) triple' treeOne + refine ⟨elementary, ?_⟩ + dsimp + intro sigma hproper hone hstable alpha beta hmissing + have vertexTransfer {X Y : TreeSequence G e0} + (hab : TreeSequenceInitialSegment X Y) {v : V} + (hv : v ∈ TreeSequenceVertexSet X) : + v ∈ TreeSequenceVertexSet Y := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv ⊢ + rcases hv with ⟨i, hi⟩ + rcases hab with ⟨hlen, hvertices, hedges⟩ + refine ⟨Fin.castLE (Nat.succ_le_succ hlen) i, ?_⟩ + exact (hvertices i).trans hi + have vertexReach {X Y : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hab : TashkinovAugmentationSequence phi X Y) {v : V} + (hv : v ∈ TreeSequenceVertexSet X) : + v ∈ TreeSequenceVertexSet Y := by + unfold TashkinovAugmentationSequence at hab + induction hab using Relation.ReflTransGen.head_induction_on with + | refl => exact hv + | @head X Y hstep htail ih => + rcases hstep with ⟨hlen, hseg, hcolor⟩ + exact ih (vertexTransfer hseg hv) + have incidentTransfer {X Y : TreeSequence G e0} + (hab : TreeSequenceInitialSegment X Y) {f : E} + (hf : TreeIncidentEdge X f) : TreeIncidentEdge Y f := by + rcases hf with ⟨v, hv, hve⟩ + exact ⟨v, vertexTransfer hab hv, hve⟩ + have incidentReach {X Y : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hab : TashkinovAugmentationSequence phi X Y) {f : E} + (hf : TreeIncidentEdge X f) : TreeIncidentEdge Y f := by + unfold TashkinovAugmentationSequence at hab + induction hab using Relation.ReflTransGen.head_induction_on with + | refl => exact hf + | @head X Y hstep htail ih => + rcases hstep with ⟨hlen, hseg, hcolor⟩ + exact ih (incidentTransfer hseg hf) + have closureReach {X Y : TreeSequence G e0} + {phi : PartialEdgeColoring E k} + (hab : TashkinovAugmentationSequence phi X Y) {v : V} + (hv : v ∈ TreeSequenceVertexSet X) : + v ∈ TreeSequenceVertexSet Y := vertexReach hab hv + have sequenceSigma {X : TreeSequence G e0} + (hreach : TashkinovAugmentationSequence + (series.data.coloring 0) X (series.data.tree ⟨1, by omega⟩)) : + TashkinovAugmentationSequence sigma X + (series.data.tree ⟨1, by omega⟩) := by + unfold TashkinovAugmentationSequence at hreach ⊢ + induction hreach using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head X Y hstep htail ih => + refine Relation.ReflTransGen.head ?_ ih + rcases hstep with ⟨hlen, hseg, c, hcolor, hmissing⟩ + rcases hseg with ⟨hle, hvertices, hedges⟩ + let segment : TreeSequenceInitialSegment X Y := + ⟨hle, hvertices, hedges⟩ + refine ⟨hlen, segment, c, ?_, ?_⟩ + · rcases (show c ∈ TreeMissingColors (series.data.coloring 0) _ + from hmissing) with hcm + rw [TreeMissingColors] at hcm + rcases Finset.mem_biUnion.mp hcm with ⟨x, hx, hxc⟩ + have hx1 := closureReach htail + (vertexTransfer segment hx) + have hcm1 : c ∈ TreeMissingColors (series.data.coloring 0) + (series.data.tree ⟨1, by omega⟩) := by + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨x, hx1, hxc⟩ + have hinc : TreeIncidentEdge + (series.data.tree ⟨1, by omega⟩) + (Y.edge (Fin.cast hlen.symm (Fin.last X.length))) := by + let last : Fin Y.length := + Fin.cast hlen.symm (Fin.last X.length) + obtain ⟨i, hi⟩ := Y.attaches last + let q : Fin (X.length + 1) := ⟨i.val, by omega⟩ + let z : Fin (Y.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ last.isLt)) + have hz : Fin.castLE (Nat.succ_le_succ hle) q = z := by + apply Fin.ext + rfl + have hzmem : Y.vertex z ∈ TreeSequenceVertexSet Y := by + simp [TreeSequenceVertexSet] + have hincY : TreeIncidentEdge Y + (Y.edge (Fin.cast hlen.symm (Fin.last X.length))) := by + refine ⟨Y.vertex z, hzmem, ?_⟩ + unfold Incident + change Y.vertex z ∈ G.ends (Y.edge last) + rw [hi] + exact Sym2.mem_mk_right _ _ + exact incidentReach htail hincY + have heq := hstable.1 _ hinc + (by exact ⟨c, Finset.mem_union_left _ hcm1, hcolor⟩) + exact heq.trans hcolor + · rw [TreeMissingColors] at hmissing + rcases Finset.mem_biUnion.mp hmissing with ⟨x, hx, hxc⟩ + have hx1 := closureReach htail (vertexTransfer segment hx) + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨x, hx, by + rw [hstable.2 x hx1] + exact hxc⟩ + have sigmaReach := sequenceSigma initialClosure.1 + exact (Tchange G k e0 sigma (series.data.tree ⟨1, by omega⟩) + ⟨triple'.1, triple'.2.1, triple'.2.2.1, hproper, hone⟩ + (TashkinovAugmentationSequencePreservesTashkinovTree G e0 sigma + (series.data.tree 0) (series.data.tree ⟨1, by omega⟩) + (by intro j hj; omega) sigmaReach) + (by + unfold ColoredVertexSetClosed + intro f c v hf hv hfc hcv + have hmissingSigma : c ∈ TreeMissingColors sigma + (series.data.tree ⟨1, by omega⟩) := by + rw [TreeMissingColors] + exact Finset.mem_biUnion.mpr ⟨v, hv, hcv⟩ + have hmissingPhi : c ∈ TreeMissingColors + (series.data.coloring 0) + (series.data.tree ⟨1, by omega⟩) := by + rw [TreeMissingColors] + rcases Finset.mem_biUnion.mp hmissingSigma with ⟨x, hx, hcx⟩ + exact Finset.mem_biUnion.mpr ⟨x, hx, by + rw [← hstable.2 x hx] + exact hcx⟩ + have boundary := hf + have hinc : TreeIncidentEdge + (series.data.tree ⟨1, by omega⟩) f := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf + rcases hf with ⟨u, hu, w, hw, he⟩ + exact ⟨u, hu, by + unfold Incident + rw [he] + exact Sym2.mem_mk_left _ _⟩ + have hreverse := (sc1 G e0 (series.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors series.data 0) + (series.data.coloring 0) sigma triple'.2.2.2.1 triple'.2.2.2.2 + hproper hone).mp hstable + have heq := hreverse f hinc + (Or.inr ⟨c, Finset.mem_union_left _ hmissingPhi, hfc⟩) + have hphi : (series.data.coloring 0) f = some c := by + rw [← heq] + exact hfc + rw [hstable.2 v hv] at hcv + exact (initialClosure.2 boundary hv hphi) hcv) + alpha beta hmissing) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TechnicalTheoremLarge.lean b/LeanPool/GoldbergSeymour/TechnicalTheoremLarge.lean new file mode 100644 index 0000000000..e603e29004 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TechnicalTheoremLarge.lean @@ -0,0 +1,335 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Basic2 +public import LeanPool.GoldbergSeymour.ExtensionBase +public import LeanPool.GoldbergSeymour.ExtensionRules +public import LeanPool.GoldbergSeymour.RutgersCurrentRungInterchangeability +public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.TechnicalCurrentRungElementaryLarge + +/-! +# Technical Theorem Large + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_buildContext_130.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + MaximumProperty ett → + MaximumDegree G + (1 : ℕ) ≤ k → + (11 : ℕ) ≤ TashkinovOrder G → + ∀ (n : ℕ), + TechnicalInductionContext G k e0 n := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hMP hdegree hlarge n + induction n using Nat.strong_induction_on with + | h n ih => + have completeLower : forall {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating), + 0 < ett.rounds -> ett.rounds < n -> MaximumProperty ett -> + ColoredVertexSetElementary G generating (TreeSequenceVertexSet T) /\ + (let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tnext : TreeSequence G e0 := + ett.series.data.tree (Fin.last (ett.rounds + 1)) + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tnext + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma -> + forall alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma Tnext ∨ + beta ∈ TreeMissingColors sigma Tnext) -> + TreeInterchangeable G Tnext sigma alpha beta) /\ + ((forall (q : Fin ett.rounds) (v : V), + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE -> + ett.series.data.chosenVertex q.succ = some v -> + forall hvFinal : v ∈ TreeSequenceVertexSet T, + forall j : Fin (ett.rounds + 1), + ETTFirstAppearanceIndex ett v hvFinal = j.val + 1 -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> + IsOneEdgeUncolored sigma e0 -> + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma -> + StableColoringBeforeVertex T v hvFinal + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma /\ + (0 < j.val -> + StableColoring (ett.series.data.tree j.castSucc) + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma)) /\ + forall (q r : Fin ett.rounds) (vq vr : V), + q ≠ r -> vq ≠ vr -> + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE -> + ett.series.data.kind r.succ = some TashkinovExtensionKind.PE -> + ett.series.data.chosenVertex q.succ = some vq -> + ett.series.data.chosenVertex r.succ = some vr -> + forall (hvq : vq ∈ TreeSequenceVertexSet T) + (hvr : vr ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett vq hvq = + ETTFirstAppearanceIndex ett vr hvr -> + Disjoint (ett.series.data.stored q.succ) + (ett.series.data.stored r.succ)) /\ + (let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := + ett.series.data.tree terminal.castSucc + forall (v : V) (gamma delta : Fin k), + ett.series.data.kind terminal = some TashkinovExtensionKind.PE -> + ett.series.data.chosenVertex terminal = some v -> + ett.series.data.gamma terminal = some gamma -> + ett.series.data.delta terminal = some delta -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tterminal + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma -> + forall w, w ∈ TreeSequenceVertexSet Tterminal -> + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) <-> w = v)) /\ + (let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := + ett.series.data.tree terminal.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tterminal + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma -> + forall delta : Fin k, + DefectiveColor G sigma (TreeSequenceVertexSet Tterminal) delta -> + forall v : V, + BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tterminal) delta v -> + (exists w, BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tterminal) delta w /\ + TreeVertexOrder Tterminal w v) -> + forall (hvFinal : v ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (vi : V), + (ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ + ett.series.data.kind q.succ = + some TashkinovExtensionKind.SE) -> + ett.series.data.chosenVertex q.succ = some vi -> + ETTFirstAppearanceIndex ett v hvFinal <= q.val + 1 -> + v = vi ∨ TreeVertexOrder T v vi) /\ + (let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := + ett.series.data.tree terminal.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tterminal + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma -> + ModColoring ett sigma) := by + intro input T generating ett hpositive hround hMP + have ctx : TechnicalInductionContext G k e0 ett.rounds := + ih ett.rounds hround + exact And.intro + (TechnicalCurrentRungElementaryLarge G k e0 input T generating + ett hMP ctx hdegree hlarge) + (And.intro + (by + apply RutgersCurrentRungInterchangeability + G k e0 ett hMP hdegree + · intro input' T' generating' current hround' hmaximum + let currentCtx : TechnicalInductionContext + G k e0 current.rounds := hround'.symm ▸ ctx + intro u hu v hv huv + exact TechnicalCurrentRungElementaryLarge + G k e0 input' T' generating' current hmaximum currentCtx + hdegree hlarge hu hv huv + · intro input' T' generating' current hround' hmaximum + exact ctx.currentFour current hround' hmaximum + · intro input' T' generating' current hround' hmaximum + exact ctx.currentSix current hround' hmaximum + · intro input' T' generating' lower hp hlt hmaximum + exact ctx.lowerTwo lower hp hlt hmaximum) + (And.intro (ctx.currentThree ett rfl hMP) + (And.intro (ctx.currentFour ett rfl hMP) + (And.intro (ctx.currentFive ett rfl hMP) + (ctx.currentSix ett rfl hMP))))) + refine { + lowerOne := ?_ + lowerTwo := ?_ + lowerThree := ?_ + lowerFour := ?_ + lowerFive := ?_ + lowerSix := ?_ + currentThree := ?_ + currentFour := ?_ + currentFive := ?_ + currentSix := ?_ } + · intro input T generating ett hpositive hround hMP + exact (completeLower ett hpositive hround hMP).1 + · intro input T generating ett hpositive hround hMP + exact (completeLower ett hpositive hround hMP).2.1 + · intro input T generating ett hpositive hround hMP + exact (completeLower ett hpositive hround hMP).2.2.1 + · intro input T generating ett hpositive hround hMP + exact (completeLower ett hpositive hround hMP).2.2.2.1 + · intro input T generating ett hpositive hround hMP + exact (completeLower ett hpositive hround hMP).2.2.2.2.1 + · intro input T generating ett hpositive hround hMP + exact (completeLower ett hpositive hround hMP).2.2.2.2.2 + · intro input T generating ett hround hMP + have hpositive : 0 < ett.rounds := ett.roundsPositive + apply ExtensionRules G k e0 input T generating ett hMP hpositive + intro T' generating' lower hp hlt hmax + exact completeLower lower hp (by omega) hmax + · intro input T generating ett hround hMP + have hpositive : 0 < ett.rounds := ett.roundsPositive + apply ExtensionBase G k e0 input T generating ett hMP hpositive + intro input' T' generating' lower hp hlt hmax + exact completeLower lower hp (by omega) hmax + · intro input T generating ett hround hMP + have hpositive : 0 < ett.rounds := ett.roundsPositive + apply Basic2 G k e0 input T generating ett hMP hpositive + intro input' T' generating' lower hp hlt hmax + exact completeLower lower hp (by omega) hmax + · intro input T generating ett hround hMP + have hpositive : 0 < ett.rounds := ett.roundsPositive + apply Td G k e0 input T generating ett hMP hpositive + intro input' T' generating' lower hp hlt hmax + exact completeLower lower hp (by omega) hmax + +theorem TechnicalTheoremLarge + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) + (hMP : MaximumProperty ett) + (hdegree : MaximumDegree G + 1 <= k) + (hlarge : 11 <= TashkinovOrder G) : + ColoredVertexSetElementary G generating (TreeSequenceVertexSet T) /\ + (let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tnext : TreeSequence G e0 := + ett.series.data.tree (Fin.last (ett.rounds + 1)) + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tnext + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma -> + forall alpha beta : Fin k, + (alpha ∈ TreeMissingColors sigma Tnext ∨ + beta ∈ TreeMissingColors sigma Tnext) -> + TreeInterchangeable G Tnext sigma alpha beta) /\ + ((forall (q : Fin ett.rounds) (v : V), + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE -> + ett.series.data.chosenVertex q.succ = some v -> + forall hvFinal : v ∈ TreeSequenceVertexSet T, + forall j : Fin (ett.rounds + 1), + ETTFirstAppearanceIndex ett v hvFinal = j.val + 1 -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> + IsOneEdgeUncolored sigma e0 -> + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma -> + StableColoringBeforeVertex T v hvFinal + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma /\ + (0 < j.val -> + StableColoring (ett.series.data.tree j.castSucc) + (TashkinovStoredColors ett.series.data j) + (ett.series.data.coloring j) sigma)) /\ + forall (q r : Fin ett.rounds) (vq vr : V), + q ≠ r -> vq ≠ vr -> + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE -> + ett.series.data.kind r.succ = some TashkinovExtensionKind.PE -> + ett.series.data.chosenVertex q.succ = some vq -> + ett.series.data.chosenVertex r.succ = some vr -> + forall (hvq : vq ∈ TreeSequenceVertexSet T) + (hvr : vr ∈ TreeSequenceVertexSet T), + ETTFirstAppearanceIndex ett vq hvq = + ETTFirstAppearanceIndex ett vr hvr -> + Disjoint (ett.series.data.stored q.succ) + (ett.series.data.stored r.succ)) /\ + (let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := + ett.series.data.tree terminal.castSucc + forall (v : V) (gamma delta : Fin k), + ett.series.data.kind terminal = some TashkinovExtensionKind.PE -> + ett.series.data.chosenVertex terminal = some v -> + ett.series.data.gamma terminal = some gamma -> + ett.series.data.delta terminal = some delta -> + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tterminal + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma -> + forall w, w ∈ TreeSequenceVertexSet Tterminal -> + (Sum.inl w ∈ TwoColorComponent G sigma gamma delta + (Sum.inl v) <-> w = v)) /\ + (let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := + ett.series.data.tree terminal.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tterminal + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma -> + forall delta : Fin k, + DefectiveColor G sigma (TreeSequenceVertexSet Tterminal) delta -> + forall v : V, + BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tterminal) delta v -> + (exists w, BoundaryColorVertex G sigma + (TreeSequenceVertexSet Tterminal) delta w /\ + TreeVertexOrder Tterminal w v) -> + forall (hvFinal : v ∈ TreeSequenceVertexSet T) + (q : Fin ett.rounds) (vi : V), + (ett.series.data.kind q.succ = + some TashkinovExtensionKind.PE ∨ + ett.series.data.kind q.succ = + some TashkinovExtensionKind.SE) -> + ett.series.data.chosenVertex q.succ = some vi -> + ETTFirstAppearanceIndex ett v hvFinal <= q.val + 1 -> + v = vi ∨ TreeVertexOrder T v vi) /\ + (let terminal : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Tterminal : TreeSequence G e0 := + ett.series.data.tree terminal.castSucc + forall sigma : PartialEdgeColoring E k, + IsProperEdgeColoring G sigma -> IsOneEdgeUncolored sigma e0 -> + StableColoring Tterminal + (TashkinovStoredColors ett.series.data terminal) + (ett.series.data.coloring terminal) sigma -> + ModColoring ett sigma) := by + classical + have buildContext := @helper_buildContext_130 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T generating ett hMP hdegree hlarge + have ctx : TechnicalInductionContext G k e0 (ett.rounds + 1) := + buildContext (ett.rounds + 1) + have hround : ett.rounds < ett.rounds + 1 := by omega + exact And.intro + (ctx.lowerOne ett ett.roundsPositive hround hMP) + (And.intro + (ctx.lowerTwo ett ett.roundsPositive hround hMP) + (And.intro + (ctx.lowerThree ett ett.roundsPositive hround hMP) + (And.intro + (ctx.lowerFour ett ett.roundsPositive hround hMP) + (And.intro + (ctx.lowerFive ett ett.roundsPositive hround hMP) + (ctx.lowerSix ett ett.roundsPositive hround hMP))))) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TerminalClosureMaximum.lean b/LeanPool/GoldbergSeymour/TerminalClosureMaximum.lean new file mode 100644 index 0000000000..70b2c669f0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalClosureMaximum.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +/-! +# Terminal Closure Maximum + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Maximality of terminal closures under the stable recolorings and seeds allowed by the terminal +extension kind. +-/ +def TerminalClosureMaximum {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} {input : PartialEdgeColoring E k} + {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} + (ett : ExtendedTashkinovTree G k e0 input T generating) : Prop := + let idx : Fin (ett.rounds + 1) := Fin.last ett.rounds + let Ti : TreeSequence G e0 := ett.series.data.tree idx.castSucc + ∀ (pi : PartialEdgeColoring E k) (seed candidate : TreeSequence G e0), + IsProperEdgeColoring G pi → + IsOneEdgeUncolored pi e0 → + StableColoring Ti (TashkinovStoredColors ett.series.data idx) (ett.series.data.coloring idx) + pi → + ((ett.series.data.kind idx = some TashkinovExtensionKind.PE ∧ seed = Ti) ∨ + ((ett.series.data.kind idx = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind idx = some TashkinovExtensionKind.RE) ∧ + exists f : E, + ett.series.data.connectingEdges idx = { f } ∧ TreeSequenceAdjoinEdge Ti f seed)) → + TashkinovClosure pi seed candidate → + (TreeSequenceVertexSet candidate).card ≤ + (TreeSequenceVertexSet (ett.series.data.tree (Fin.last (ett.rounds + 1)))).card + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixConstruction.lean b/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixConstruction.lean new file mode 100644 index 0000000000..257c42ede3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixConstruction.lean @@ -0,0 +1,445 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TerminalHierarchyPrefixPreparation + +/-! +# Terminal hierarchy prefix constructors + +Supporting constructions for the Goldberg–Seymour edge-coloring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +-/ + +@[expose] public section + +namespace GoldbergSeymour.TerminalHierarchyPrefixPreparation + +open scoped Sym2 + +/-- Typed data construction shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperHB477.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (base : HierarchyBase ett phi) → + (H : TashkinovHierarchy ett base) → + (B : TreeSequence G e0) → + (hAB : + TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) B) → + (hBT : TreeSequenceInitialSegment B T) → + (segmentTrans : + ∀ {A B C : TreeSequence G e0} + (_ : TreeSequenceInitialSegment A B) + (_ : TreeSequenceInitialSegment B C), + TreeSequenceInitialSegment A C) → + (stageSegment : + ∀ (a d : ℕ) + (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + let lastStage : TreeSequence G e0 := + HierarchyStarredStage H (Fin.last H.dividerCount); + (lastZero : + H.dividerCount = (0 : ℕ) → + lastStage = base.core) → + (lastPositive : + have lastStage : TreeSequence G e0 := + HierarchyStarredStage H + (Fin.last H.dividerCount); + H.dividerCount ≠ (0 : ℕ) → + lastStage = + H.stage + (⟨H.dividerCount, by omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (lastToB : + TreeSequenceInitialSegment lastStage B) → + (firstToB : + TreeSequenceInitialSegment + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) + B) → + (strictFirst : + (ett.series.data.tree + (Fin.last + ett.rounds).castSucc).length < + B.length) → + let ettB : + ExtendedTashkinovTree G k e0 input B + generating := + { rounds := ett.rounds, + roundsPositive := ett.roundsPositive, + series := ett.series, + abovePenultimate := firstToB, + strictAbovePenultimate := strictFirst, + belowFinal := + segmentTrans hBT ett.belowFinal, + generatingColoring := + ett.generatingColoring : + ExtendedTashkinovTree G k e0 input B + generating }; + let baseB : HierarchyBase ettB phi := by + exact + @helperBaseB420 (@V) (@E) inferInstance + inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) + (@T) (@generating) (@phi) (@ett) + (@base) (@B) (@hBT) (@segmentTrans) + (@firstToB) (@strictFirst) + let hbStage : + Fin (H.dividerCount + (2 : ℕ)) → + TreeSequence G e0 := + fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if + (↑j : ℕ) = + H.dividerCount + (1 : ℕ) then + B + else + H.stage + (⟨(↑j : ℕ), by omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + (hbStageAt : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))) + (hj : (↑j : ℕ) ≤ H.dividerCount), + hbStage j = + H.stage + (⟨(↑j : ℕ), by omega⟩ : + Fin + (H.dividerCount + (2 : ℕ)))) → + (hbNested : + ∀ + (j : + Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment + ((fun + (j : + Fin + (H.dividerCount + + (2 : ℕ))) ↦ + if + (↑j : ℕ) = + H.dividerCount + + (1 : ℕ) then + B + else + H.stage + (⟨(↑j : ℕ), by omega⟩ : + Fin + (H.dividerCount + + (2 : ℕ)))) + j.castSucc) + ((fun + (j : + Fin + (H.dividerCount + + (2 : ℕ))) ↦ + if + (↑j : ℕ) = + H.dividerCount + + (1 : ℕ) then + B + else + H.stage + (⟨(↑j : ℕ), by omega⟩ : + Fin + (H.dividerCount + + (2 : ℕ)))) + j.succ)) → + (hbStrict : + ∀ + (j : + Fin (H.dividerCount + (1 : ℕ))), + ((fun + (j : + Fin + (H.dividerCount + + (2 : ℕ))) ↦ + if + (↑j : ℕ) = + H.dividerCount + + (1 : ℕ) then + B + else + H.stage + (⟨(↑j : ℕ), by + omega⟩ : + Fin + (H.dividerCount + + (2 : ℕ)))) + j.castSucc).length < + ((fun + (j : + Fin + (H.dividerCount + + (2 : ℕ))) ↦ + if + (↑j : ℕ) = + H.dividerCount + + (1 : ℕ) then + B + else + H.stage + (⟨(↑j : ℕ), by + omega⟩ : + Fin + (H.dividerCount + + (2 : ℕ)))) + j.succ).length) → + TashkinovHierarchy ettB baseB := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H B hAB hBT segmentTrans stageSegment + lastStage lastZero lastPositive lastToB firstToB strictFirst ettB baseB hbStage hbStageAt + hbNested hbStrict + exact { + dividerCount := H.dividerCount + stage := hbStage + baseStage := by + rw [show hbStage 0 = H.stage 0 by simp [hbStage]] + simpa [ettB] using H.baseStage + terminalStage := by simp [hbStage] + nested := hbNested + strict := hbStrict + dividerPosition := fun i => ⟨(H.dividerPosition i).val, by + have hd := H.dividerStage i + have hi : i.val + 1 ≤ H.dividerCount := Nat.succ_le_of_lt i.isLt + have hlastB : TreeSequenceInitialSegment + (H.stage ⟨H.dividerCount, by omega⟩) B := by + rw [← lastPositive (by omega)] + exact lastToB + have hseg := stageSegment (i.val + 1) + (H.dividerCount - (i.val + 1)) (by omega) + have heq : i.val + 1 + (H.dividerCount - (i.val + 1)) = H.dividerCount := + Nat.add_sub_of_le hi + have hseg' : TreeSequenceInitialSegment + (H.stage ⟨i.val + 1, by omega⟩) + (H.stage ⟨H.dividerCount, by omega⟩) := by + convert hseg using 1 + · congr 1 + apply Fin.ext + exact heq.symm + have hp := (segmentTrans hseg' hlastB).1 + have he := congrArg TreeSequence.length hd + have he' : (H.stage ⟨i.val + 1, by omega⟩).length = + (H.dividerPosition i).val := by + rw [TreeSequencePrefix] at he + simpa using he + exact Nat.lt_succ_of_le (by + rw [← he'] + exact hp)⟩ + dividerPositive := by intro i; exact H.dividerPositive i + dividerIncreasing := by intro i j hij; exact H.dividerIncreasing i j hij + dividerStage := by + intro i + have hi : i.val + 1 ≤ H.dividerCount := Nat.succ_le_of_lt i.isLt + have he : hbStage ⟨i.val + 1, by omega⟩ = + H.stage ⟨i.val + 1, by omega⟩ := by + exact hbStageAt ⟨i.val + 1, by omega⟩ hi + rw [he] + have hpos := + @helper_hpos_300 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@B) (@hAB) + (@segmentTrans) (@stageSegment) (@lastPositive) (@i) (@hi) + have hpref := + @helper_hpref_320 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@phi) (@ett) (@base) (@H) (@B) (@hBT) + (@i) (@hpos) + rw [hpref] + simpa [ettB] using H.dividerStage i + coreInsideFirst := by + by_cases hc : H.dividerCount = 0 + · have he : hbStage ⟨1, by omega⟩ = B := by simp [hbStage, hc] + rw [he] + have hab : TreeSequenceInitialSegment base.core B := by + have hh := hAB + have hs : HierarchyStarredStage H (Fin.last H.dividerCount) = base.core := by + simpa [lastStage] using lastZero hc + rw [hs] at hh + exact hh + simpa [baseB] using hab + · have he : hbStage ⟨1, by omega⟩ = H.stage ⟨1, by omega⟩ := + hbStageAt ⟨1, by omega⟩ (Nat.one_le_iff_ne_zero.mpr hc) + rw [he] + simpa [baseB] using H.coreInsideFirst } + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperContinuation904Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (good : GoodHierarchy H) (B : TreeSequence G e0) + (hAB : TreeSequenceInitialSegment (HierarchyStarredStage H (Fin.last H.dividerCount)) B) + (hBT : TreeSequenceInitialSegment B T) + (segmentRefl : ∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A A) + (segmentTrans : + ∀ {A B C : TreeSequence G e0} (hAB : TreeSequenceInitialSegment A B) + (hBC : TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C) + (stageSegment : + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))), + let lastStage : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + ∀ (lastZero : H.dividerCount = (0 : ℕ) → lastStage = base.core) + (lastPositive : + have lastStage : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + H.dividerCount ≠ (0 : ℕ) → + lastStage = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (lastToB : TreeSequenceInitialSegment lastStage B) + (firstToB : TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) B) + (strictFirst : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < B.length), + let ettB : ExtendedTashkinovTree G k e0 input B generating := + { + rounds := ett.rounds, roundsPositive := ett.roundsPositive, series := ett.series, + abovePenultimate := firstToB, strictAbovePenultimate := strictFirst, + belowFinal := segmentTrans hBT ett.belowFinal, generatingColoring := ett.generatingColoring : + ExtendedTashkinovTree G k e0 input B generating }; + ∀ (mpB : MaximumProperty ettB), + let baseB : HierarchyBase ettB phi := + { + core := base.core, closure := base.closure, supportPosition := base.supportPosition, + supportPositive := base.supportPositive, + terminalMissingColors := id base.terminalMissingColors, + parallel := + ((Eq.symm + (id + (implies_congr + (Eq.refl (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE)) + (congrArg + (And + (ett.series.data.chosenVertex (Fin.last ett.rounds) = + some + ((ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex + base.supportPosition))) + (congrArg + (And + (TashkinovClosure phi + (TreeSequencePrefix (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) + base.closure)) + (propext nonempty_prop)))))) ▸ + (implies_congr + (Eq.refl (ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE)) + (congrArg + (And + (ett.series.data.chosenVertex (Fin.last ett.rounds) = + some + ((ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex base.supportPosition))) + (congrArg + (And + (TashkinovClosure phi + (TreeSequencePrefix (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) + base.closure)) + (propext nonempty_prop))) ▸ + base.parallel)), + nonparallel := id base.nonparallel : HierarchyBase ettB phi }; + let hbStage : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then B + else H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + ∀ + (hbStageOld : ∀ (j : Fin (H.dividerCount + (1 : ℕ))), hbStage j.castSucc = H.stage j.castSucc) + (hbStageAt : + ∀ (j : Fin (H.dividerCount + (2 : ℕ))) (hj : (↑j : ℕ) ≤ H.dividerCount), + hbStage j = H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (hbNested : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment + ((fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then B + else H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + j.castSucc) + ((fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then B + else H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + j.succ)) + (hbStrict : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ((fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then B + else H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + j.castSucc).length < + ((fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then B + else H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + j.succ).length), + let HB : TashkinovHierarchy ettB baseB := + helperHB477 G k e0 input T generating phi ett base H B hAB hBT segmentTrans stageSegment + lastZero lastPositive lastToB firstToB strictFirst hbStageAt hbNested hbStrict; + ∀ + (stageOrdNext : + ∀ (i : Fin H.dividerCount), HB.stage i.succ.castSucc = H.stage i.succ.castSucc) + (starredEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage HB j = HierarchyStarredStage H j) + (storedEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt HB j = HierarchyStoredColorsAt H j) + (beforeFirstMissing : + ∀ {A B : TreeSequence G e0} (hAB : TreeSequenceInitialSegment A B) (eta : Fin k) + (i : Fin (A.length + (1 : ℕ))) (hiEnd : (↑i : ℕ) < A.length) + (hi : (↑i : ℕ) < (↑(HierarchyFirstMissingPosition phi A eta) : ℕ)), + let iB : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hAB.1) i; + (↑iB : ℕ) < (↑(HierarchyFirstMissingPosition phi B eta) : ℕ)) + (missingEq : + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStageMissingColors HB j = HierarchyStageMissingColors H j), + ∃ (ettB : ExtendedTashkinovTree G k e0 input B generating), + MaximumProperty ettB ∧ + ettB.rounds = ett.rounds ∧ + ettB.series ≍ ett.series ∧ + ∃ (baseB : HierarchyBase ettB phi), + baseB.core = base.core ∧ + baseB.closure = base.closure ∧ + (↑baseB.supportPosition : ℕ) = (↑base.supportPosition : ℕ) ∧ + ∃ (HB : TashkinovHierarchy ettB baseB) (hcount : HB.dividerCount = H.dividerCount), + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HB.stage j.castSucc = H.stage (Fin.cast (by omega) j).castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H (Fin.cast (by omega) j)) ∧ + (∀ (i : Fin HB.dividerCount), + (↑(HB.dividerPosition i) : ℕ) = (↑(H.dividerPosition (Fin.cast hcount i)) : ℕ)) ∧ + ∃ (goodB : GoodHierarchy HB), + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt HB j = + HierarchyStoredColorsAt H (Fin.cast (by omega) j) ∧ + HierarchyStageMissingColors HB j = + HierarchyStageMissingColors H (Fin.cast (by omega) j) ∧ + ∀ (eta : Fin k), + goodB.gamma j eta = good.gamma (Fin.cast (by omega) j) eta ∧ + HierarchySegmentColors HB j eta ⊆ + HierarchySegmentColors H (Fin.cast (by omega) j) eta + +end GoldbergSeymour.TerminalHierarchyPrefixPreparation + +end diff --git a/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean b/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean new file mode 100644 index 0000000000..d6441a6918 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean @@ -0,0 +1,454 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.GoodHierarchy +public import LeanPool.GoldbergSeymour.HierarchyBase +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.HierarchySegmentColors +public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors +public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.TashkinovHierarchy +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Terminal hierarchy prefix preparation + +Supporting constructions for the Goldberg–Seymour edge-coloring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. +-/ + +@[expose] public section + +namespace GoldbergSeymour.TerminalHierarchyPrefixPreparation + +open scoped Sym2 + +theorem helper_segmentTrans_81.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B + C → TreeSequenceInitialSegment A C := by + classical + intro V E G e0 A B C hAB hBC + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨le_trans hab hbc, ?_, ?_⟩ + · intro i + have hmid := hvbc (Fin.castLE (Nat.succ_le_succ hab) i) + simpa using hmid.trans (hvab i) + · intro i + have hmid := hebc (Fin.castLE hab i) + simpa using hmid.trans (heab i) + +theorem helper_stageSegment_94.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (_ : TreeSequence G e0), + (∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A A) → + (∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H B segmentRefl segmentTrans a d + induction d with + | zero => intro h; simpa using segmentRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + intro h + have hp := ih (by omega) + have hn := H.nested ⟨a + d, by omega⟩ + have hn' : TreeSequenceInitialSegment + (H.stage ⟨a+d, by omega⟩) (H.stage ⟨a+(d+1), by omega⟩) := by + simpa [Nat.add_assoc] using hn + exact segmentTrans hp hn' + +theorem helper_lastPositive_115.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (_ : TreeSequence G e0), + let lastStage : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + H.dividerCount ≠ (0 : ℕ) → + lastStage = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H B lastStage h + unfold lastStage HierarchyStarredStage + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) + · have hz : H.dividerCount = 0 := by + simpa using congrArg Fin.val hzero + exact False.elim (h hz) + · rw [hi] + simp only [Fin.cases_succ] + congr 1 + apply Fin.ext + simpa using (congrArg Fin.val hi).symm + +theorem helper_stageLastPositive_128.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (_ : TreeSequence G e0), + let lastStage : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + (H.dividerCount ≠ (0 : ℕ) → + lastStage = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + H.dividerCount ≠ (0 : ℕ) → + H.stage (Fin.last H.dividerCount).castSucc = lastStage := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H B lastStage lastPositive hp + rw [lastPositive hp] + apply congrArg H.stage + apply Fin.ext + simp + +theorem helper_stageToLast_135.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (_ : TreeSequence G e0), + (∀ (A : TreeSequence G e0), TreeSequenceInitialSegment A A) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + let lastStage : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + (H.dividerCount = (0 : ℕ) → lastStage = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + lastStage = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + lastStage := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H B segmentRefl stageSegment lastStage + lastZero lastPositive + by_cases hq : H.dividerCount = 0 + · by_cases hk : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · obtain ⟨_, _, ⟨u⟩⟩ := base.parallel hk + rw [lastZero hq] + exact u.leftSegment + · have hc : base.core = ett.series.data.tree (Fin.last ett.rounds).castSucc := + base.nonparallel hk + rw [lastZero hq, hc] + exact segmentRefl _ + · have hs := stageSegment 0 H.dividerCount (by omega) + rw [lastPositive hq] + rw [← H.baseStage] + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> simp + +theorem helper_hbNested_194.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (B : TreeSequence G e0), + TreeSequenceInitialSegment (HierarchyStarredStage H (Fin.last H.dividerCount)) B → + (∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → + let lastStage : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + (H.dividerCount ≠ (0 : ℕ) → H.stage (Fin.last H.dividerCount).castSucc = lastStage) → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + lastStage → + let hbStage : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then B + else H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), hbStage j.castSucc = H.stage j.castSucc) → + hbStage (Fin.last (H.dividerCount + (1 : ℕ))) = B → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))) (hj : (↑j : ℕ) ≤ H.dividerCount), + hbStage j = H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (hbStage j.castSucc) (hbStage j.succ) := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H B hAB segmentTrans lastStage + stageLastPositive stageToLast hbStage hbStageOld hbStageLast hbStageAt j + by_cases hj : j.val = H.dividerCount + · have hlast : j = Fin.last H.dividerCount := by + apply Fin.ext + simpa using hj + rw [hlast] + rw [hbStageOld (Fin.last H.dividerCount)] + have hjs : (Fin.last H.dividerCount).succ = Fin.last (H.dividerCount + 1) := by rfl + rw [hjs, hbStageLast] + by_cases hc : H.dividerCount = 0 + · have hs0 : TreeSequenceInitialSegment (H.stage 0) lastStage := by + simpa [H.baseStage] using stageToLast + have hab : TreeSequenceInitialSegment lastStage B := by + change TreeSequenceInitialSegment lastStage B at hAB + exact hAB + have hidx : H.stage (Fin.last H.dividerCount).castSucc = H.stage 0 := by + congr 1 + apply Fin.ext + simp [hc] + rw [hidx] + exact segmentTrans hs0 hab + · rw [stageLastPositive hc] + exact hAB + · have hjlt : j.val < H.dividerCount := by omega + have hsucc : j.val + 1 ≤ H.dividerCount := Nat.succ_le_of_lt hjlt + rw [hbStageAt j.castSucc (Nat.le_of_lt_succ j.isLt), + hbStageAt j.succ hsucc] + have hn := H.nested ⟨j.val, by omega⟩ + convert hn using 1 + +theorem helper_hbStrict_225.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (B : TreeSequence G e0), + (HierarchyStarredStage H (Fin.last H.dividerCount)).length < B.length → + let lastStage : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + (H.dividerCount ≠ (0 : ℕ) → H.stage (Fin.last H.dividerCount).castSucc = lastStage) → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + lastStage → + let hbStage : Fin (H.dividerCount + (2 : ℕ)) → TreeSequence G e0 := + fun (j : Fin (H.dividerCount + (2 : ℕ))) ↦ + if (↑j : ℕ) = H.dividerCount + (1 : ℕ) then B + else H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ))); + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), hbStage j.castSucc = H.stage j.castSucc) → + hbStage (Fin.last (H.dividerCount + (1 : ℕ))) = B → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))) (hj : (↑j : ℕ) ≤ H.dividerCount), + hbStage j = H.stage (⟨(↑j : ℕ), by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (hbStage j.castSucc).length < (hbStage j.succ).length := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H B hABstrict lastStage + stageLastPositive stageToLast hbStage hbStageOld hbStageLast hbStageAt j + by_cases hj : j.val = H.dividerCount + · have hlast : j = Fin.last H.dividerCount := by + apply Fin.ext + simpa using hj + rw [hlast] + rw [hbStageOld (Fin.last H.dividerCount)] + have hjs : (Fin.last H.dividerCount).succ = Fin.last (H.dividerCount + 1) := by rfl + rw [hjs, hbStageLast] + by_cases hc : H.dividerCount = 0 + · have hs0 : TreeSequenceInitialSegment (H.stage 0) lastStage := by + simpa [H.baseStage] using stageToLast + have hlen : lastStage.length < B.length := hABstrict + have hidx : H.stage (Fin.last H.dividerCount).castSucc = H.stage 0 := by + congr 1 + apply Fin.ext + simp [hc] + rw [hidx] + exact lt_of_le_of_lt hs0.1 hlen + · rw [stageLastPositive hc] + exact hABstrict + · have hjlt : j.val < H.dividerCount := by omega + have hsucc : j.val + 1 ≤ H.dividerCount := Nat.succ_le_of_lt hjlt + rw [hbStageAt j.castSucc (Nat.le_of_lt_succ j.isLt), + hbStageAt j.succ hsucc] + have hn := H.strict ⟨j.val, by omega⟩ + convert hn using 1; + +theorem helper_hpos_300.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (B : TreeSequence G e0), + TreeSequenceInitialSegment (HierarchyStarredStage H (Fin.last H.dividerCount)) B → + (∀ {A B C : TreeSequence G e0}, + TreeSequenceInitialSegment A B → + TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + let lastStage : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + (H.dividerCount ≠ (0 : ℕ) → + lastStage = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + ∀ (i : Fin H.dividerCount), + (↑i : ℕ) + (1 : ℕ) ≤ H.dividerCount → + (↑(H.dividerPosition i) : ℕ) ≤ B.length := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H B hAB segmentTrans stageSegment + lastStage lastPositive i hi + have hs := stageSegment (i.val + 1) + (H.dividerCount - (i.val + 1)) (by omega) + have hs' : TreeSequenceInitialSegment + (H.stage ⟨i.val + 1, by omega⟩) + (H.stage ⟨H.dividerCount, by omega⟩) := by + convert hs using 1 + apply congrArg H.stage + apply Fin.ext + exact (Nat.add_sub_of_le hi).symm + have hab : TreeSequenceInitialSegment + (H.stage ⟨H.dividerCount, by omega⟩) B := by + rw [← lastPositive (by omega)] + exact hAB + have hsB := (segmentTrans hs' hab).1 + have hlen := congrArg TreeSequence.length (H.dividerStage i) + rw [TreeSequencePrefix] at hlen + have hval : (H.stage ⟨i.val + 1, by omega⟩).length = + (H.dividerPosition i).val := by simpa using hlen + omega + +/-- Typed data construction shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperBaseB420.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (base : HierarchyBase ett phi) → + (B : TreeSequence G e0) → + (hBT : TreeSequenceInitialSegment B T) → + (segmentTrans : + ∀ {A B C : TreeSequence G e0} + (_ : TreeSequenceInitialSegment A B) + (_ : TreeSequenceInitialSegment B C), + TreeSequenceInitialSegment A C) → + (firstToB : + TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + B) → + (strictFirst : + (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length < + B.length) → + let ettB : + ExtendedTashkinovTree G k e0 input B generating := + { rounds := ett.rounds, + roundsPositive := ett.roundsPositive, + series := ett.series, abovePenultimate := firstToB, + strictAbovePenultimate := strictFirst, + belowFinal := segmentTrans hBT ett.belowFinal, + generatingColoring := ett.generatingColoring : + ExtendedTashkinovTree G k e0 input B generating }; + HierarchyBase ettB phi := by + classical + intro V E inst inst_1 inst_2 inst_3 G k e0 input T generating phi ett base B hBT segmentTrans + firstToB strictFirst ettB + exact { + core := base.core, closure := base.closure, + supportPosition := base.supportPosition, + supportPositive := base.supportPositive, + terminalMissingColors := id base.terminalMissingColors, + parallel := + ((Eq.symm + (id + (implies_congr + (Eq.refl + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE)) + (congrArg + (And + (ett.series.data.chosenVertex + (Fin.last ett.rounds) = + some + ((ett.series.data.tree + (Fin.last ett.rounds).castSucc).vertex + base.supportPosition))) + (congrArg + (And + (TashkinovClosure phi + (TreeSequencePrefix + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) + (↑base.supportPosition : ℕ) + base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) + base.closure)) + (propext nonempty_prop)))))) ▸ + (implies_congr + (Eq.refl + (ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE)) + (congrArg + (And + (ett.series.data.chosenVertex (Fin.last ett.rounds) = + some + ((ett.series.data.tree + (Fin.last ett.rounds).castSucc).vertex + base.supportPosition))) + (congrArg + (And + (TashkinovClosure phi + (TreeSequencePrefix + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) + (↑base.supportPosition : ℕ) base.supportPositive + (Nat.le_of_lt_succ base.supportPosition.isLt)) + base.closure)) + (propext nonempty_prop))) ▸ + base.parallel)), + nonparallel := id base.nonparallel : HierarchyBase ettB phi }; + +/-- Dependent contract shared by the hierarchy construction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperHpref320Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (base : HierarchyBase ett phi) + (H : TashkinovHierarchy ett base) (B : TreeSequence G e0), + TreeSequenceInitialSegment B T → + ∀ (i : Fin H.dividerCount) (hpos : (↑(H.dividerPosition i) : ℕ) ≤ B.length), + TreeSequencePrefix B (↑(H.dividerPosition i) : ℕ) (H.dividerPositive i) hpos = + TreeSequencePrefix T (↑(H.dividerPosition i) : ℕ) (H.dividerPositive i) (by omega) + +theorem helper_hpref_320.{u_1, u_2} : + helperHpref320Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating phi ett base H B hBT i hpos + rw [TreeSequencePrefix, TreeSequencePrefix] + congr + · funext x + have hv := hBT.2.1 (Fin.castLE (Nat.succ_le_succ hpos) x) + simpa using hv.symm + · funext x + have heq := hBT.2.2 (Fin.castLE hpos x) + simpa using heq.symm + +end GoldbergSeymour.TerminalHierarchyPrefixPreparation + +end diff --git a/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean b/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean new file mode 100644 index 0000000000..2fad2e0ab8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean @@ -0,0 +1,772 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyPrefixData +public import LeanPool.GoldbergSeymour.TerminalStoredColors +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix + +public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport + +/-! +# P2752_T2_Terminal Hierarchy Restore + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_firstMissing_334.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + ∀ beta ∈ TreeMissingColors phi (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : + ℕ))), + sigma = TwoColorComponentSwap G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)) → + ∀ (_ : HierarchyPrefixData C (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 + : ℕ))) sigma) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - + (1 : ℕ)); + let _ : TashkinovHierarchy ett base := C.hierarchy; + ∀ (_ : HierarchyBase corr.replacementETT sigma) (eta : Fin k), + HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition phi T eta + := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett base C ctx D beta hmissing hsigma F corr Bplus H + newBase eta + have belowMissing (i : Fin (T.length + 1)) (hi : i.val ≤ Bplus.length) : + MissingColors G sigma (T.vertex i) = MissingColors G phi (T.vertex i) := by + let ib : Fin (Bplus.length + 1) := ⟨i.val, by omega⟩ + have hc : Fin.castLE (Nat.succ_le_succ F.belowFull.1) ib = i := Fin.ext rfl + have hv : T.vertex i = Bplus.vertex ib := by + rw [← hc] + exact F.belowFull.2.1 ib + rw [hv] + apply F.invariant.2 + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨ib, rfl⟩ + have witnessed (w : Fin (T.length + 1)) (hw : w.val ≤ Bplus.length) + (hm : eta ∈ MissingColors G phi (T.vertex w)) : + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta := by + let old : Finset (Fin (T.length + 1)) := + Finset.univ.filter fun i => eta ∈ MissingColors G phi (T.vertex i) + let new : Finset (Fin (T.length + 1)) := + Finset.univ.filter fun i => eta ∈ MissingColors G sigma (T.vertex i) + have hwo : w ∈ old := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hm⟩ + have hwn : w ∈ new := by + apply Finset.mem_filter.mpr + rw [belowMissing w hw] + exact ⟨Finset.mem_univ _, hm⟩ + have ho : old.Nonempty := ⟨w, hwo⟩ + have hn : new.Nonempty := ⟨w, hwn⟩ + have hlo : (old.min' ho).val ≤ w.val := Finset.min'_le old w hwo + have hln : (new.min' hn).val ≤ w.val := Finset.min'_le new w hwn + have hom : old.min' ho ∈ new := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + rw [belowMissing _ (le_trans hlo hw)] + exact (Finset.mem_filter.mp (Finset.min'_mem old ho)).2 + have hnm : new.min' hn ∈ old := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + rw [← belowMissing _ (le_trans hln hw)] + exact (Finset.mem_filter.mp (Finset.min'_mem new hn)).2 + have he : new.min' hn = old.min' ho := + le_antisymm (Finset.min'_le new _ hom) (Finset.min'_le old _ hnm) + change (if h : new.Nonempty then new.min' h else Fin.last T.length) = + (if h : old.Nonempty then old.min' h else Fin.last T.length) + simpa only [dite_eq_left hn, dite_eq_left ho] using he + by_cases ha : eta = D.alpha + · subst eta + apply witnessed D.earlierVertexIndex + · have hbefore := D.earlierVertexBeforePenultimate + have hpen := D.penultimateVertexPosition + have hlen : T.length = Bplus.length + 1 := F.penultimateLength + omega + · exact D.alphaMissingEarlier + by_cases hb : eta = beta + · subst eta + let B := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2) + have hBT : TreeSequenceInitialSegment B T := by + dsimp [B, HierarchyFullTailPrefix] + exact ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hlength : B.length + 2 = T.length := by + have htail := D.tailAtLeastTwo + change 2 ≤ T.length - + (HierarchyStarredStage H (Fin.last H.dividerCount)).length at htail + change min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + (T.length - (HierarchyStarredStage H (Fin.last H.dividerCount)).length - 2)) + T.length + 2 = T.length + omega + rcases Finset.mem_biUnion.mp hmissing with ⟨v, hv, hm⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨i, hiv⟩ + let w := Fin.castLE (Nat.succ_le_succ hBT.1) i + apply witnessed w + · have hip : i.val < B.length + 1 := i.isLt + have hlen : T.length = Bplus.length + 1 := F.penultimateLength + change i.val ≤ Bplus.length + omega + · have he : T.vertex w = v := (hBT.2.1 i).trans hiv + rw [he] + exact hm + · have colorEq (f : E) : sigma f = some eta ↔ phi f = some eta := by + rw [hsigma] + unfold TwoColorComponentSwap + split + · split + · rename_i hc + simp [hc, Ne.symm ha, Ne.symm hb] + · split + · rename_i hc + simp [hc, Ne.symm ha, Ne.symm hb] + · rfl + · rfl + have missingAll (v : V) : + (eta ∈ MissingColors G sigma v) ↔ (eta ∈ MissingColors G phi v) := by + simp only [MissingColors, PresentColors, Finset.mem_sdiff, Finset.mem_univ, + true_and, Finset.mem_filter, colorEq] + have hc : (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G sigma (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + eta ∈ MissingColors G phi (T.vertex i)) := by + apply Finset.filter_congr + intro i hi + exact missingAll _ + unfold HierarchyFirstMissingPosition + simp only [hc] + +private theorem helper_commonBase_214.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) (C : + HierarchyCounterexample base) (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma + T), let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C + - (1 : ℕ)); ∀ (old : ExtendedTashkinovTree G k e0 input Bplus phi), old.rounds = + ett.rounds → old.series ≍ ett.series → ∀ (cp : CorrespondingExtendedTashkinovTree G k e0 + old sigma Bplus) (bp : HierarchyBase cp.replacementETT sigma), ∃ (b : HierarchyBase + corr.replacementETT sigma), b.core = bp.core ∧ b.closure = bp.closure ∧ + (↑b.supportPosition : ℕ) = (↑bp.supportPosition : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett base C corr Bplus old hr hs cp bp + cases old with + | mk rounds positive series above strict below generating => + cases hr + have hseries : series = ett.series := eq_of_heq hs + cases hseries + let cp' : CorrespondingExtendedTashkinovTree G k e0 ett sigma Bplus := + { replacementInput := cp.replacementInput + replacementSeries := cp.replacementSeries + replacementETT := cp.replacementETT + rungAgreement := cp.rungAgreement + seriesPresentation := cp.seriesPresentation + finalGeneratingColoring := cp.finalGeneratingColoring + ladderTreesAgree := cp.ladderTreesAgree + storedColorsAgree := cp.storedColorsAgree + connectingEdgesAgree := cp.connectingEdgesAgree + extensionKindsAgree := cp.extensionKindsAgree + replacementProper := cp.replacementProper + replacementOneUncolored := cp.replacementOneUncolored + replacementStable := cp.replacementStable } + exact GoodHierarchyCommonOriginalBaseTransport G k e0 input T phi sigma + ett Bplus T cp' bp corr + +private theorem helper_stageBelow_335.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (F : HierarchyPrefixData C (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ))) sigma) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 + : ℕ)); + ∀ (_ : HierarchyBase corr.replacementETT sigma) (A : TreeSequence G e0) + (HA : TashkinovHierarchy F.corresponding.replacementETT F.newBase) (j : Fin + (HA.dividerCount + (1 : ℕ))), + A = HA.stage j.castSucc → TreeSequenceInitialSegment A Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett base C F corr Bplus newBase A HA j heq + have trans {A B U : TreeSequence G e0} + (hAB : TreeSequenceInitialSegment A B) (hBU : TreeSequenceInitialSegment B U) : + TreeSequenceInitialSegment A U := by + refine ⟨le_trans hAB.1 hBU.1, ?_, ?_⟩ + · intro i + exact (hBU.2.1 (Fin.castLE (Nat.succ_le_succ hAB.1) i)).trans (hAB.2.1 i) + · intro i + exact (hBU.2.2 (Fin.castLE hAB.1 i)).trans (hAB.2.2 i) + have stages : ∀ (a d : ℕ) (hb : a + d ≤ HA.dividerCount + 1), + TreeSequenceInitialSegment (HA.stage ⟨a, by omega⟩) + (HA.stage ⟨a+d, by omega⟩) := by + intro a d + induction d with + | zero => intro hb; exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ d ih => + intro hb + exact trans (ih (by omega)) (HA.nested ⟨a+d, by omega⟩) + have hs := stages j.val (HA.dividerCount + 1 - j.val) (by omega) + have hl : (⟨j.val + (HA.dividerCount + 1 - j.val), by omega⟩ : + Fin (HA.dividerCount + 2)) = Fin.last (HA.dividerCount + 1) := by + apply Fin.ext + have := j.isLt + simp + rw [hl, HA.terminalStage] at hs + have hj : (⟨j.val, by omega⟩ : Fin (HA.dividerCount + 2)) = j.castSucc := + Fin.ext rfl + rw [hj] at hs + rw [heq] + exact hs + +private theorem helper_segmentOriginal_459.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : HierarchyPrefixData C (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ))) sigma), + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - + (1 : ℕ)); + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (newBase : HierarchyBase corr.replacementETT sigma) (hcore : newBase.core = base.core) + (htree : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + let K : TashkinovHierarchy corr.replacementETT newBase := + { dividerCount := H.dividerCount, stage := H.stage, baseStage := Eq.trans + H.baseStage (Eq.symm htree), + terminalStage := H.terminalStage, nested := H.nested, strict := H.strict, + dividerPosition := H.dividerPosition, dividerPositive := H.dividerPositive, + dividerIncreasing := H.dividerIncreasing, dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (H.stage + (⟨(1 : ℕ), (by omega)⟩ : Fin (H.dividerCount + (2 : ℕ))))) + hcore)) + H.coreInsideFirst : + TashkinovHierarchy corr.replacementETT newBase }; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), HierarchyStarredStage K j = + HierarchyStarredStage H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (H.stage + j.castSucc) Bplus) → + (∀ (eta : Fin k), HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition phi T eta) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors K j eta = HierarchySegmentColors H j eta := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett base C F hfixed corr Bplus H newBase hcore htree + K starred ordinaryBelow firstMissing j eta + have edgeEq (r : Fin (H.stage j.succ).length) : + sigma ((H.stage j.succ).edge r) = phi ((H.stage j.succ).edge r) := by + by_cases hj : j.val = H.dividerCount + · have hi : j.succ = Fin.last (H.dividerCount + 1) := by + apply Fin.ext + simp [hj] + revert r + rw [hi, H.terminalStage] + exact hfixed + · let next : Fin (H.dividerCount + 1) := ⟨j.val + 1, by have := j.isLt; omega⟩ + have hi : next.castSucc = j.succ := Fin.ext rfl + have hseg := ordinaryBelow next + rw [hi] at hseg + have he := (F.belowFull.2.2 (Fin.castLE hseg.1 r)).trans (hseg.2.2 r) + have hf := hfixed (Fin.castLE F.belowFull.1 (Fin.castLE hseg.1 r)) + rw [he] at hf + exact hf + unfold HierarchySegmentColors + dsimp only + rw [starred j, firstMissing eta] + apply Finset.filter_congr + intro c hc + constructor + · rintro ⟨r, hlo, hhi, hcol⟩ + exact ⟨r, hlo, hhi, (edgeEq r).symm.trans hcol⟩ + · rintro ⟨r, hlo, hhi, hcol⟩ + exact ⟨r, hlo, hhi, (edgeEq r).trans hcol⟩ + +private theorem helper_terminalData_340.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (sigma : PartialEdgeColoring + E k) {inp gen : PartialEdgeColoring E k} {U : TreeSequence G e0} (original : + ExtendedTashkinovTree G k e0 inp U gen) (W : TreeSequence G e0) (c : + CorrespondingExtendedTashkinovTree G k e0 original sigma W), + c.replacementETT.series.data.tree (Fin.last c.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + c.replacementETT.series.data.kind (Fin.last c.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) := by + classical + intro V E _ _ _ G k e0 sigma inp gen U original W c + rcases c with ⟨ri, rs, re, hr, hs, hf, ht, hd, he, hk, hp, hu, hst⟩ + cases re with + | mk rounds positive series above strict below generating => + cases hr + have hseries : series = rs := eq_of_heq hs + cases hseries + let i : Fin original.rounds := ⟨original.rounds - 1, by + have := original.roundsPositive + omega⟩ + have hi : i.succ = Fin.last original.rounds := by + apply Fin.ext + have := original.roundsPositive + simp [i] + omega + exact ⟨by simpa [hi] using ht i, hk _⟩ + +private theorem helper_oldMetadata_391.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (F : HierarchyPrefixData C (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ))) sigma), + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + F.oldETT.series.data.tree (Fin.last F.oldETT.rounds).castSucc = ett.series.data.tree + (Fin.last ett.rounds).castSucc ∧ + F.oldETT.series.data.kind (Fin.last F.oldETT.rounds) = ett.series.data.kind (Fin.last + ett.rounds) ∧ + TashkinovStoredColors F.oldETT.series.data (Fin.last F.oldETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett base C F Bplus + have transport + (old : ExtendedTashkinovTree G k e0 input Bplus phi) + (hr : old.rounds = ett.rounds) (hs : HEq old.series ett.series) : + old.series.data.tree (Fin.last old.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + old.series.data.kind (Fin.last old.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors old.series.data (Fin.last old.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + cases old with + | mk rounds positive series above strict below generating => + cases hr + cases eq_of_heq hs + exact ⟨rfl, rfl, rfl⟩ + exact transport F.oldETT F.oldRung F.oldSeries + +private theorem helper_coreBelow_472.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (F : HierarchyPrefixData C (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ))) sigma) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 + : ℕ)); + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (newBase : HierarchyBase corr.replacementETT sigma), + newBase.core = F.newBase.core → + F.newHierarchy.dividerCount = H.dividerCount → + (∀ (A : TreeSequence G e0) (HA : TashkinovHierarchy F.corresponding.replacementETT + F.newBase) + (j : Fin (HA.dividerCount + (1 : ℕ))), A = HA.stage j.castSucc → + TreeSequenceInitialSegment A Bplus) → + TreeSequenceInitialSegment newBase.core Bplus := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett base C F corr Bplus H newBase hcoreP hcount + stageBelow + rw [hcoreP] + have first := F.newHierarchy.coreInsideFirst + by_cases hq : F.newHierarchy.dividerCount = 0 + · have hi : (⟨1, by omega⟩ : Fin (F.newHierarchy.dividerCount + 2)) = + Fin.last (F.newHierarchy.dividerCount + 1) := by apply Fin.ext; simp [hq] + rw [hi, F.newHierarchy.terminalStage] at first + exact first + · have next := stageBelow _ F.newHierarchy ⟨1, by omega⟩ rfl + refine ⟨le_trans first.1 next.1, ?_, ?_⟩ + · intro i + exact + (next.2.1 (Fin.castLE (Nat.succ_le_succ first.1) i)).trans (first.2.1 i) + · intro i + exact + (next.2.2 (Fin.castLE first.1 i)).trans (first.2.2 i) + +private theorem helper_gammaOriginal_542.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (F : HierarchyPrefixData C (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : + ℕ))) sigma), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (hcount : F.newHierarchy.dividerCount = H.dividerCount), + let index : Fin (H.dividerCount + (1 : ℕ)) → Fin (F.newHierarchy.dividerCount + (1 : ℕ)) := + fun (j : Fin (H.dividerCount + (1 : ℕ))) => + Fin.cast (congrArg (fun (n : ℕ) => n + (1 : ℕ)) (Eq.symm hcount)) j; + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ∀ eta ∈ HierarchyStoredColorsAt H j, F.newGood.gamma (index j) eta = C.good.gamma j eta + := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett base C F H hcount index j eta heta + obtain ⟨hc, hgamma⟩ := F.sameGood.2 + let jo : Fin (F.oldHierarchy.dividerCount + 1) := + Fin.cast (congrArg (fun n => n + 1) F.oldCount.symm) j + have hi : Fin.cast (congrArg (fun n => n + 1) hc) jo = index j := Fin.ext rfl + have ho : Fin.cast (congrArg (fun n => n + 1) F.oldCount) jo = j := Fin.ext rfl + have hcolors := F.oldColors jo + have he : eta ∈ HierarchyStoredColorsAt F.oldHierarchy jo := by + rw [hcolors.1] + simpa only [ho] using heta + have hg := (hgamma jo).2 eta he + rw [hi] at hg + exact hg.symm.trans (by simpa only [ho] using (hcolors.2.2 eta).1) + +private theorem helper_continuation_562.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring + E k) + (T : TreeSequence G e0) (phi sigma : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree + G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx), + ∀ beta ∈ TreeMissingColors phi (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : + ℕ))), + sigma = TwoColorComponentSwap G phi D.alpha beta (Sum.inl (T.vertex + D.terminalVertexIndex)) → + ∀ (F : HierarchyPrefixData C (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 + : ℕ))) sigma), + (∀ (t : Fin T.length), sigma (T.edge t) = phi (T.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T), + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C + (HierarchyFullTailLength C - (1 : ℕ)); + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ {inp gen : PartialEdgeColoring E k} {U : TreeSequence G e0} + (original : ExtendedTashkinovTree G k e0 inp U gen) (W : TreeSequence G e0) + (c : CorrespondingExtendedTashkinovTree G k e0 original sigma W), + c.replacementETT.series.data.tree (Fin.last c.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + c.replacementETT.series.data.kind (Fin.last c.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds)) → + ∀ (newBase : HierarchyBase corr.replacementETT sigma), + newBase.core = F.newBase.core → + newBase.closure = F.newBase.closure → + ∀ (hcore : newBase.core = base.core) + (htree : + corr.replacementETT.series.data.tree (Fin.last + corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc), + corr.replacementETT.series.data.kind (Fin.last + corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) → + let K : TashkinovHierarchy corr.replacementETT newBase := + { dividerCount := H.dividerCount, stage := H.stage, + baseStage := Eq.trans H.baseStage (Eq.symm htree), terminalStage + := H.terminalStage, + nested := H.nested, strict := H.strict, dividerPosition := + H.dividerPosition, + dividerPositive := H.dividerPositive, dividerIncreasing := + H.dividerIncreasing, + dividerStage := H.dividerStage, + coreInsideFirst := + Eq.mpr + (id + (congrArg + (fun (_a : TreeSequence G e0) => + TreeSequenceInitialSegment _a + (H.stage + (⟨(1 : ℕ), (by omega)⟩ : + Fin (H.dividerCount + (2 : ℕ))))) + hcore)) + H.coreInsideFirst : + TashkinovHierarchy corr.replacementETT newBase }; + F.oldETT.series.data.tree (Fin.last F.oldETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + F.oldETT.series.data.kind (Fin.last F.oldETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors F.oldETT.series.data (Fin.last + F.oldETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) → + F.oldETT.series.data.kind (Fin.last F.oldETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) → + SameHierarchyStages H K → + ∀ (hcount : F.newHierarchy.dividerCount = H.dividerCount), + let index : + Fin (H.dividerCount + (1 : ℕ)) → Fin + (F.newHierarchy.dividerCount + (1 : ℕ)) := + fun (j : Fin (H.dividerCount + (1 : ℕ))) => + Fin.cast (congrArg (fun (n : ℕ) => + n + (1 : ℕ)) (Eq.symm hcount)) j; + let _ : Fin H.dividerCount → Fin F.newHierarchy.dividerCount := + fun (i : Fin H.dividerCount) => Fin.cast (Eq.symm hcount) i; + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + F.newHierarchy.stage (index j).castSucc = H.stage + j.castSucc) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H j) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage + F.newHierarchy (index j)) → + (∀ (A : TreeSequence G e0) + (HA : TashkinovHierarchy + F.corresponding.replacementETT F.newBase) + (j : Fin (HA.dividerCount + (1 : ℕ))), + A = HA.stage j.castSucc → + TreeSequenceInitialSegment A Bplus) → + ∃ (newBase : HierarchyBase corr.replacementETT sigma) + (K : + TashkinovHierarchy corr.replacementETT newBase) + (good : GoodHierarchy K), + SameGoodHierarchy C.good good := by + classical + intro V E _ _ _ _ G k e0 input T phi sigma ett base C ctx D beta hmissing hsigma F hfixed corr + Bplus H terminalData newBase hcoreP hclosureP hcore htree hkind K oldMetadata oldKind + sameStages hcount index internal prefixStage starred starredP stageBelow + have ordinaryBelow (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (H.stage j.castSucc) Bplus := + stageBelow _ F.newHierarchy (index j) (prefixStage j).symm + have coreBelow := @helper_coreBelow_472 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi sigma ett base C F corr newBase hcoreP hcount stageBelow + have starredBelow (j : Fin (H.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage K j) Bplus := by + cases j using Fin.cases with + | zero => exact coreBelow + | succ i => exact ordinaryBelow i.succ + have missingEq (A : TreeSequence G e0) (hA : TreeSequenceInitialSegment A Bplus) : + TreeMissingColors sigma A = TreeMissingColors phi A := by + unfold TreeMissingColors + apply Finset.biUnion_congr rfl + intro v hv + exact F.invariant.2 v (TreeSequenceInitialSegmentVertexSetSubset hA hv) + have storedOriginal (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H j := by + unfold HierarchyStoredColorsAt + dsimp only + rw [P2752_T2_TerminalStoredColors ett corr, missingEq _ (starredBelow j), starred j] + have missingOriginal (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors K j = HierarchyStageMissingColors H j := by + cases j using Fin.cases with + | zero => + simp only [HierarchyStageMissingColors, Fin.cases_zero] + rw [htree] + exact missingEq _ F.ladderBelow + | succ i => + simp only [HierarchyStageMissingColors, Fin.cases_succ] + exact missingEq _ (ordinaryBelow i.succ) + have prefixTree : F.corresponding.replacementETT.series.data.tree + (Fin.last F.corresponding.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + exact (terminalData F.oldETT Bplus F.corresponding).1.trans oldMetadata.1 + have prefixComputed : TashkinovStoredColors F.corresponding.replacementETT.series.data + (Fin.last F.corresponding.replacementETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + rw [P2752_T2_TerminalStoredColors F.oldETT F.corresponding] + exact oldMetadata.2.2 + have storedP (j : Fin (H.dividerCount + 1)) : + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt F.newHierarchy (index j) := by + unfold HierarchyStoredColorsAt + dsimp only + rw [P2752_T2_TerminalStoredColors ett corr, prefixComputed, starredP j] + have missingP (j : Fin (H.dividerCount + 1)) : + HierarchyStageMissingColors K j = + HierarchyStageMissingColors F.newHierarchy (index j) := by + cases j using Fin.cases with + | zero => + have hi : index 0 = 0 := Fin.ext rfl + simp only [hi, HierarchyStageMissingColors, Fin.cases_zero] + rw [htree, prefixTree] + | succ i => + have hi : index i.succ = (internal i).succ := Fin.ext rfl + simp only [hi, HierarchyStageMissingColors, Fin.cases_succ] + have hs := prefixStage i.succ + rw [hi] at hs + exact congrArg (TreeMissingColors sigma) hs.symm + have gammaOriginal := @helper_gammaOriginal_542 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi sigma ett base C F hcount + have firstMissing := @helper_firstMissing_334 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi sigma ett base C ctx D beta hmissing hsigma F corr newBase + have segmentOriginal := @helper_segmentOriginal_459 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi sigma ett base C F hfixed corr newBase hcore htree starred + ordinaryBelow firstMissing + let good : GoodHierarchy K := + { gamma := fun j eta => F.newGood.gamma (index j) eta + twoColors := by + intro j eta he + exact F.newGood.twoColors (index j) eta ((storedP j) ▸ he) + avoidance := by + intro j eta he + have ho : eta ∈ HierarchyStoredColorsAt H j := (storedOriginal j) ▸ he + rw [gammaOriginal j eta ho, missingOriginal j, segmentOriginal j eta] + exact C.good.avoidance j eta ho + disjointPairs := by + intro j eta theta he ht hne + exact F.newGood.disjointPairs (index j) eta theta + ((storedP j) ▸ he) ((storedP j) ▸ ht) hne + uniqueRefresh := by + intro i + have hi : (internal i).succ = index i.succ := Fin.ext rfl + have hc : (internal i).castSucc = index i.castSucc := Fin.ext rfl + simpa only [hi, hc, storedP, starredP, prefixStage] using + F.newGood.uniqueRefresh (internal i) + parallelBase := by + dsimp only + intro hp + have prefixKind : F.corresponding.replacementETT.series.data.kind + (Fin.last F.corresponding.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) := + (terminalData F.oldETT Bplus F.corresponding).2.trans oldKind + have hg := F.newGood.parallelBase (prefixKind.trans (hkind.symm.trans hp)) + have hi : index 0 = 0 := Fin.ext rfl + simpa only [hcoreP, hclosureP, htree, prefixTree, storedP, hi] using hg + minusClosed := by + intro i + have hi : (internal i).succ = index i.succ := Fin.ext rfl + have hc : (internal i).castSucc = index i.castSucc := Fin.ext rfl + simpa only [hi, hc, storedP, prefixStage] using + F.newGood.minusClosed (internal i) } + refine ⟨newBase, K, good, sameStages, rfl, ?_⟩ + intro j + refine ⟨(storedOriginal j).symm, ?_⟩ + intro eta he + exact (gammaOriginal j eta he).symm + +theorem P2752_T2_TerminalHierarchyRestore {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi sigma : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx) + (beta : Fin k) + (hmissing : beta ∈ TreeMissingColors phi + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 2))) + (_ : beta ∉ MissingColors G phi (T.vertex D.terminalVertexIndex)) + (hsigma : sigma = TwoColorComponentSwap G phi D.alpha beta + (Sum.inl (T.vertex D.terminalVertexIndex))) + (F : HierarchyPrefixData C + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) sigma) + (hfixed : ∀ t : Fin T.length, sigma (T.edge t) = phi (T.edge t)) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma T) : + ∃ newBase : HierarchyBase corr.replacementETT sigma, + ∃ K : TashkinovHierarchy corr.replacementETT newBase, + ∃ good : GoodHierarchy K, SameGoodHierarchy C.good good := by + classical + let Bplus := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + let H := C.hierarchy + have terminalData := @helper_terminalData_340 V E inferInstance inferInstance inferInstance G k e0 + sigma + have commonBase := @helper_commonBase_214 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi sigma ett base C corr + obtain ⟨newBase, hcoreP, hclosureP, hsupportP⟩ := + commonBase F.oldETT F.oldRung F.oldSeries F.corresponding F.newBase + have sameP := F.sameGood.1 + have hcore : newBase.core = base.core := + hcoreP.trans (sameP.1.symm.trans F.oldCore) + have htree := (terminalData ett T corr).1 + have hkind := (terminalData ett T corr).2 + let K : TashkinovHierarchy corr.replacementETT newBase := + { dividerCount := H.dividerCount + stage := H.stage + baseStage := H.baseStage.trans htree.symm + terminalStage := H.terminalStage + nested := H.nested + strict := H.strict + dividerPosition := H.dividerPosition + dividerPositive := H.dividerPositive + dividerIncreasing := H.dividerIncreasing + dividerStage := H.dividerStage + coreInsideFirst := by rw [hcore]; exact H.coreInsideFirst } + have oldMetadata := @helper_oldMetadata_391 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi sigma ett base C F + have oldKind := oldMetadata.2.1 + have sameStages : SameHierarchyStages H K := by + refine ⟨hcore.symm, rfl, HEq.rfl, HEq.rfl, ?_, ?_⟩ + · exact ⟨fun h => hkind.trans h, fun h => hkind.symm.trans h⟩ + · intro hp + have hpOld : F.oldETT.series.data.kind (Fin.last F.oldETT.rounds) = + some TashkinovExtensionKind.PE := oldKind.trans hp + exact F.oldClosure.symm.trans ((sameP.2.2.2.2.2 hpOld).trans hclosureP.symm) + have hcount : F.newHierarchy.dividerCount = H.dividerCount := + sameP.2.1.symm.trans F.oldCount + let index (j : Fin (H.dividerCount + 1)) : + Fin (F.newHierarchy.dividerCount + 1) := + Fin.cast (congrArg (fun n => n + 1) hcount.symm) j + let internal (i : Fin H.dividerCount) : Fin F.newHierarchy.dividerCount := + Fin.cast hcount.symm i + have applyHEq {n m : ℕ} (f : Fin n → TreeSequence G e0) + (g : Fin m → TreeSequence G e0) (h : n = m) (hf : HEq f g) + (i : Fin n) : f i = g (Fin.cast h i) := by + cases h + cases hf + rfl + have prefixStage (j : Fin (H.dividerCount + 1)) : + F.newHierarchy.stage (index j).castSucc = H.stage j.castSucc := by + let jo : Fin (F.oldHierarchy.dividerCount + 1) := + Fin.cast (congrArg (fun n => n + 1) F.oldCount.symm) j + have hs := applyHEq F.oldHierarchy.stage F.newHierarchy.stage + (congrArg (fun n => n + 2) sameP.2.1) sameP.2.2.1 jo.castSucc + have hi : Fin.cast (congrArg (fun n => n + 2) sameP.2.1) jo.castSucc = + (index j).castSucc := Fin.ext rfl + have ho : Fin.cast (congrArg (fun n => n + 1) F.oldCount) jo = j := + Fin.ext rfl + rw [hi] at hs + exact hs.symm.trans (by simpa only [ho] using (F.oldStages jo).1) + have starred (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage H j := by + cases j using Fin.cases with + | zero => exact hcore + | succ i => rfl + have starredP (j : Fin (H.dividerCount + 1)) : + HierarchyStarredStage K j = HierarchyStarredStage F.newHierarchy (index j) := by + cases j using Fin.cases with + | zero => + have hi : index 0 = 0 := Fin.ext rfl + rw [hi] + exact hcoreP + | succ i => + have hi : index i.succ = (internal i).succ := Fin.ext rfl + simp only [hi, HierarchyStarredStage, Fin.cases_succ] + have hs := prefixStage i.succ + rw [hi] at hs + exact hs.symm + have stageBelow := @helper_stageBelow_335 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi sigma ett base C F corr newBase + exact @helper_continuation_562 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi sigma ett base C ctx D beta hmissing hsigma F hfixed corr terminalData + newBase hcoreP hclosureP hcore htree hkind oldMetadata oldKind sameStages hcount + prefixStage starred starredP stageBelow +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean b/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean new file mode 100644 index 0000000000..3f745a4862 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean @@ -0,0 +1,1733 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail + +/-! +# P2963_T1_Terminal Kempe Stage Switch + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private abbrev helperHnotElementary588Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : + TreeSequence G e0) (a b _ : Fin k), a ∈ MissingColors G R.coloring (T.vertex (Fin.last + T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + ∀ (jb : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) (Decidable.byContradiction fun (a : + ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + )).length + (1 : ℕ))), (↑jb : ℕ) ≤ X.length → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); A.length < (↑jb : ℕ) → b ∈ MissingColors G R.coloring (B.vertex jb) → + ∀ (hBT : TreeSequenceInitialSegment B T) (hAB : TreeSequenceInitialSegment A B), X.length ≤ + T.length - (1 : ℕ) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data n; + (H.dividerCount ≠ (0 : ℕ) → HierarchyStarredStage H q = H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (0 : ℕ) < H.dividerCount ∧ a ∈ TreeMissingColors + R.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors + R.coloring Tn → a ≠ b → + ∀ (iaLe : (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length), + (↑(HierarchyFirstMissingPosition R.coloring T b) : ℕ) = (↑jb : ℕ) → + let ja : Fin (B.length + (1 : ℕ)) := (⟨(↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ), + by + have this : A.length ≤ B.length := hAB.1; omega + ⟩ : Fin (B.length + (1 : ℕ))); Fin.castLE (Nat.succ_le_succ hBT.1) ja = + HierarchyFirstMissingPosition R.coloring T a → Fin.castLE (Nat.succ_le_succ hBT.1) jb = + HierarchyFirstMissingPosition R.coloring T b → a ∈ MissingColors G R.coloring (B.vertex + ja) → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint { a, b } Dnq) → sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors R.coloring Tn ∨ Disjoint { a, b } Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + { a } → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G R.coloring x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); (0 : ℕ) < H.dividerCount ∧ a ∈ TreeMissingColors + R.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors + R.coloring Tn ∨ a ∈ TreeMissingColors R.coloring (HierarchyStarredStage H q) ∧ a ∉ Dn ∧ b + ∉ Dn) → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q sigma ∧ + ModColoring R.corresponding.replacementETT sigma ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma), + MaximumProperty ettA) ∧ ((0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), MaximumProperty ettA ∧ ettA.series.data.kind (Fin.last ettA.rounds) = + R.corresponding.replacementETT.series.data.kind (Fin.last + R.corresponding.replacementETT.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = R.replacementBase.core ∧ + baseA.closure = R.replacementBase.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = R.counterexample.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq (Dnq.biUnion (R.counterexample.good.gamma + (⟨R.counterexample.hierarchy.dividerCount - (1 : ℕ), + by + omega + ⟩ : Fin (R.counterexample.hierarchy.dividerCount + (1 : ℕ))))))) → (a ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → b ∈ MissingColors G sigma (T.vertex (Fin.last + T.length))) → (b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → a ∈ + MissingColors G sigma (T.vertex (Fin.last T.length))) → ¬ColoredVertexSetElementary G + sigma (TreeSequenceVertexSet T) + +private abbrev helperContinuation1318Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : + TreeSequence G e0) (a b eta : Fin k), eta ∈ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount) → a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta → + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length → a ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length)) → + ∀ (jb : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) (Decidable.byContradiction fun (a : + ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + ))).length + (1 : ℕ))), (↑jb : ℕ) ≤ X.length → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + )); TreeSequenceInitialSegment A X → A.length < X.length → TreeSequenceInitialSegment X B → + A.length < (↑jb : ℕ) → b ∈ MissingColors G R.coloring (B.vertex jb) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → + ∀ (hBT : TreeSequenceInitialSegment B T) (hAB : TreeSequenceInitialSegment A B), X.length ≤ + T.length - (1 : ℕ) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → ( + ∀ (psi tau : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) → + ∀ (c : Fin k), HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c) + → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data n; + (H.dividerCount ≠ (0 : ℕ) → HierarchyStarredStage H q = H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → TreeSequenceInitialSegment Tn A → (0 : ℕ) < + H.dividerCount ∧ a ∈ TreeMissingColors R.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors + R.coloring Tn → b ∉ TreeMissingColors R.coloring A → a ≠ b → b ∈ TreeMissingColors + R.coloring B → a ∈ TreeMissingColors R.coloring B → + ∀ (iaLe : (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length), + (↑(HierarchyFirstMissingPosition R.coloring T b) : ℕ) = (↑jb : ℕ) → + let ja : Fin (B.length + (1 : ℕ)) := (⟨(↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ), + by + have this : A.length ≤ B.length := hAB.1; omega + ⟩ : Fin (B.length + (1 : ℕ))); Fin.castLE (Nat.succ_le_succ hBT.1) ja = + HierarchyFirstMissingPosition R.coloring T a → Fin.castLE (Nat.succ_le_succ hBT.1) jb = + HierarchyFirstMissingPosition R.coloring T b → a ∈ MissingColors G R.coloring (B.vertex + ja) → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint { a, b } Dnq) → sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors R.coloring Tn ∨ Disjoint { a, b } Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + { a } → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → TwoColorPathComponent G + R.coloring a b (Sum.inl (T.vertex (Fin.last T.length))) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G R.coloring x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); IsOneEdgeUncolored sigma e0 → (0 : ℕ) < H.dividerCount ∧ + a ∈ TreeMissingColors R.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors + R.coloring Tn ∨ a ∈ TreeMissingColors R.coloring (HierarchyStarredStage H q) ∧ a ∉ Dn ∧ b + ∉ Dn) → Disjoint (TwoColorComponent G R.coloring a b (Sum.inl (T.vertex (Fin.last + T.length)))) (TwoColorComponent G R.coloring a b (Sum.inl (T.vertex + (HierarchyFirstMissingPosition R.coloring T a)))) → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q sigma ∧ + ModColoring R.corresponding.replacementETT sigma ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma), + MaximumProperty ettA) ∧ ((0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), MaximumProperty ettA ∧ ettA.series.data.kind (Fin.last ettA.rounds) = + R.corresponding.replacementETT.series.data.kind (Fin.last + R.corresponding.replacementETT.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = R.replacementBase.core ∧ + baseA.closure = R.replacementBase.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = R.counterexample.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq (Dnq.biUnion (R.counterexample.good.gamma + (⟨R.counterexample.hierarchy.dividerCount - (1 : ℕ), + by omega + ⟩ : Fin (R.counterexample.hierarchy.dividerCount + (1 : ℕ))))))) → + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet (TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + ))), MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ ( + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) + = R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) + → b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length))) + +private abbrev helperContinuation1225Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : + TreeSequence G e0) (a b eta : Fin k), eta ∈ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount) → a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta → + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length → a ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length)) → + ∀ (jb : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) (Decidable.byContradiction fun (a : + ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + ))).length + (1 : ℕ))), (↑jb : ℕ) ≤ X.length → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → + ∀ (B : Finset V), ColoredVertexSetElementary G psi B → + ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ + MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0)) → + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + )); TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) X → (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) : TreeSequence G e0).length < X.length → + TreeSequenceInitialSegment X B → (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length < (↑jb : ℕ) → b ∈ MissingColors G + R.coloring (B.vertex jb) → ( + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) → ( + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) B → X.length ≤ T.length - (1 : ℕ) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k), (↑(HierarchyFirstMissingPosition psi T c) : ℕ) + < T.length → c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c))) → + ( + ∀ (psi tau : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) → + ∀ (c : Fin k), HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c) + → ((R.counterexample.hierarchy : TashkinovHierarchy R.corresponding.replacementETT + R.replacementBase).dividerCount ≠ (0 : ℕ) → HierarchyStarredStage + (R.counterexample.hierarchy : TashkinovHierarchy R.corresponding.replacementETT + R.replacementBase) (Fin.last (R.counterexample.hierarchy : TashkinovHierarchy + R.corresponding.replacementETT R.replacementBase).dividerCount : Fin + ((R.counterexample.hierarchy : TashkinovHierarchy R.corresponding.replacementETT + R.replacementBase).dividerCount + (1 : ℕ))) = (R.counterexample.hierarchy : + TashkinovHierarchy R.corresponding.replacementETT R.replacementBase).stage + (⟨(R.counterexample.hierarchy : TashkinovHierarchy R.corresponding.replacementETT + R.replacementBase).dividerCount, + by omega + ⟩ : Fin ((R.counterexample.hierarchy : TashkinovHierarchy R.corresponding.replacementETT + R.replacementBase).dividerCount + (2 : ℕ)))) → TreeSequenceInitialSegment + (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds : Fin (R.corresponding.replacementETT.rounds + (1 : + ℕ))).castSucc : TreeSequence G e0) (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) → (0 : ℕ) < (R.counterexample.hierarchy : + TashkinovHierarchy R.corresponding.replacementETT R.replacementBase).dividerCount ∧ a ∈ + TreeMissingColors R.coloring ((R.counterexample.hierarchy : TashkinovHierarchy + R.corresponding.replacementETT R.replacementBase).stage (⟨(R.counterexample.hierarchy : + TashkinovHierarchy R.corresponding.replacementETT R.replacementBase).dividerCount, + by omega + ⟩ : Fin ((R.counterexample.hierarchy : TashkinovHierarchy R.corresponding.replacementETT + R.replacementBase).dividerCount + (2 : ℕ)))) ∨ (R.counterexample.hierarchy : + TashkinovHierarchy R.corresponding.replacementETT R.replacementBase).dividerCount = (0 : + ℕ) ∧ a ∈ TreeMissingColors R.coloring (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds : Fin + (R.corresponding.replacementETT.rounds + (1 : ℕ))).castSucc : TreeSequence G e0) → b ∉ + TreeMissingColors R.coloring (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) → a ≠ b → b ∈ TreeMissingColors R.coloring + B → a ∈ TreeMissingColors R.coloring B → (↑(HierarchyFirstMissingPosition R.coloring T a) + : ℕ) ≤ (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length → (↑(HierarchyFirstMissingPosition R.coloring T b) : ℕ) = (↑jb : + ℕ) → + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet (TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + ))), MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ ( + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) + = R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) + → b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length))) + +private theorem helper_firstAt_167.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); TreeSequenceInitialSegment B T → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j) → ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k), (↑(HierarchyFirstMissingPosition psi T c) : ℕ) + < T.length → c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c))) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : + Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → + (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R B hBT elementary vertexMem firstLe + firstMem R c j hc + clear * - G T B R c j hc elementary vertexMem firstLe firstMem hBT + have hcT : c ∈ MissingColors G R.coloring + (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) j)) := by + rw [hBT.2.1 j]; exact hc + have hle := firstLe R.coloring c _ hcT + have hlt : (HierarchyFirstMissingPosition R.coloring T c).val < T.length := by + have := j.isLt + change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle + have hblen : B.length = T.length - 1 := rfl + omega + let x : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T c).val, by + change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle + omega⟩ + have hxT : Fin.castLE (Nat.succ_le_succ hBT.1) x = + HierarchyFirstMissingPosition R.coloring T c := Fin.ext rfl + have hcx : c ∈ MissingColors G R.coloring (B.vertex x) := by + rw [← hBT.2.1 x, hxT] + exact firstMem R.coloring c hlt + have he : B.vertex x = B.vertex j := by + by_contra hn + exact Finset.disjoint_left.mp (elementary R (vertexMem B x) (vertexMem B j) hn) hcx hc + exact congrArg Fin.val (B.vertex_injective he) + +private theorem helper_firstFixed_193.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (hTlen : (2 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); TreeSequenceInitialSegment B T → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), c ∈ + MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j) → ( + ∀ (psi : PartialEdgeColoring E k) (c : Fin k), (↑(HierarchyFirstMissingPosition psi T c) : ℕ) + < T.length → c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c))) → + ∀ (psi tau : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) → + ∀ (c : Fin k), HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c + := by + classical + intro V E _ _ G k e0 T hTlen B hBT vertexMem firstLe firstMem psi tau hmissing c + let _ := Fintype.ofFinite V + have early (j : Fin (T.length + 1)) (hj : j.val < T.length) : + MissingColors G tau (T.vertex j) = MissingColors G psi (T.vertex j) := by + let x : Fin (B.length + 1) := ⟨j.val, by dsimp [B, TreeSequencePrefix]; omega⟩ + have hx : Fin.castLE (Nat.succ_le_succ hBT.1) x = j := Fin.ext rfl + rw [← hx, hBT.2.1 x] + exact hmissing _ (vertexMem B x) + apply Fin.ext + apply Nat.le_antisymm + · by_contra hn + have hlt : (HierarchyFirstMissingPosition psi T c).val < T.length := by + have := (HierarchyFirstMissingPosition tau T c).isLt + omega + have hm := firstMem psi c hlt + rw [← early _ hlt] at hm + have := firstLe tau c _ hm + omega + · by_contra hn + have hlt : (HierarchyFirstMissingPosition tau T c).val < T.length := by + have := (HierarchyFirstMissingPosition psi T c).isLt + omega + have hm := firstMem tau c hlt + rw [early _ hlt] at hm + have := firstLe psi c _ hm + omega + +private theorem helper_routes_498.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : + TreeSequence G e0) (a b _ : Fin k) (_ : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by + omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by + omega + )).length + (1 : ℕ))), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); TreeSequenceInitialSegment A X → + ∀ (hAXlt : A.length < X.length), TreeSequenceInitialSegment X B → + ∀ (_ : TreeSequenceInitialSegment B T) (_ : TreeSequenceInitialSegment A B), + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + TreeSequenceInitialSegment Tn A → + ∀ (_ : (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length), ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint { a, b } Dnq) → sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors R.coloring Tn ∨ Disjoint { a, b } Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + { a } → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G R.coloring x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); TreeSequenceInitialSegment X T → + let XM : TreeSequence G e0 := TreeSequencePrefix X (X.length - (1 : ℕ)) ( + have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a_1 : ¬(1 : ℕ) ≤ + X.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a_1 : ¬X.length - (1 : ℕ) ≤ X.length) => + by omega + ); TreeSequenceInitialSegment XM X → ( + ∀ (t : Fin X.length), Tn.length ≤ (↑t : ℕ) → sigma (X.edge t) = R.coloring (X.edge t)) → + (R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X ∨ + (R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + R.corresponding.replacementETT.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X) ∧ + TashkinovAugmentationSequence R.coloring X T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X a b eta jb A trans common B hAX + hAXlt hXB hBT hAB n Tn hTnA iaLe change hmissing sigma hXT XM hXMX prefixFixed + rcases P2813_T1_TerminalRoute G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT with ⟨hp, hseq⟩ | + ⟨hp, f, seed, hedges, hseed, hincident, hcontrol, hseq⟩ + · have hsourceX := trans hTnA hAX + have hpre := TashkinovAugmentationSequenceRestrict R.coloring Tn X T hseq hsourceX hXT + refine ⟨Or.inl ⟨hp, ?_⟩, + TashkinovAugmentationSequenceSuffix R.coloring Tn X T hseq hsourceX hXT⟩ + exact TashkinovAugmentationSequenceColoringTransport R.coloring sigma Tn XM X + hpre hXMX (by dsimp [XM, TreeSequencePrefix]; have := X.positive; omega) prefixFixed + (fun v hv => hmissing v (TreeSequenceInitialSegmentVertexSetSubset + (trans hXMX hXB) hv)) + · have hseedX := common + (TashkinovAugmentationSequenceInitialSegment R.coloring seed T hseq) hXT + (by have hl := hseed.1; have := hTnA.1; change seed.length = Tn.length + 1 at hl; omega) + have hpre := TashkinovAugmentationSequenceRestrict R.coloring seed X T hseq hseedX hXT + refine ⟨Or.inr ⟨hp, f, seed, hedges, hseed, ?_⟩, + TashkinovAugmentationSequenceSuffix R.coloring seed X T hseq hseedX hXT⟩ + exact TashkinovAugmentationSequenceColoringTransport R.coloring sigma seed XM X + hpre hXMX (by dsimp [XM, TreeSequencePrefix]; have := X.positive; omega) + (fun t ht => + prefixFixed t (by have hl := hseed.1; change seed.length = Tn.length + 1 at hl; omega)) + (fun v hv => hmissing v (TreeSequenceInitialSegmentVertexSetSubset + (trans hXMX hXB) hv)) + +private theorem helper_gammaCut_539.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : + TreeSequence G e0) (a b eta : Fin k), eta ∈ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount) → a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta → + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length → + ∀ (_ : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(1 + : ℕ) ≤ T.length - (1 : ℕ)) => + by + omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by + omega + )).length + (1 : ℕ))), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + TreeSequenceInitialSegment Tn A → (0 : ℕ) < H.dividerCount ∧ a ∈ TreeMissingColors + R.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors + R.coloring Tn → b ∉ TreeMissingColors R.coloring A → (↑(HierarchyFirstMissingPosition + R.coloring T a) : ℕ) ≤ A.length → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint { a, b } Dnq) → sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors R.coloring Tn ∨ Disjoint { a, b } Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + { a } → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → + ∀ eta' ∈ HierarchyStoredColorsAt H q, a ∈ R.counterexample.good.gamma q eta' ∨ b ∈ + R.counterexample.good.gamma q eta' → (↑(HierarchyFirstMissingPosition R.coloring T eta') : + ℕ) ≤ X.length := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X a b eta heta haGamma hetaCut jb A + starEq B hBT hAB H q n Tn hTnA stageCase hbOutside iaLe change eta' heta' hh + rcases hh with hh | hh + · have he : eta' = eta := by + by_contra hn + exact Finset.disjoint_left.mp + (R.counterexample.good.disjointPairs q eta' eta heta' heta hn) hh haGamma + simpa only [he] using hetaCut + · have hm := (Finset.mem_sdiff.mp (R.counterexample.good.avoidance q eta' heta' hh)).1 + have hmb : b ∈ TreeMissingColors R.coloring A := by + rcases stageCase with ⟨hq, _⟩ | ⟨hq, _⟩ + · have hhq : H.dividerCount ≠ 0 := by omega + unfold HierarchyStageMissingColors at hm + dsimp only at hm + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · exact (hhq (by simpa [q] using congrArg Fin.val hz)).elim + · rw [hi] at hm + simp only [Fin.cases_succ] at hm + have he : HierarchyStarredStage H q = H.stage i.succ.castSucc := by + change Fin.cases (motive := fun _ => TreeSequence G e0) + R.replacementBase.core (fun i => H.stage i.succ.castSucc) q = _ + rw [hi] + rfl + rw [← starEq R, he] + exact hm + · have hmT : b ∈ TreeMissingColors R.coloring Tn := by + simpa [HierarchyStageMissingColors, q, hq, Fin.last, Tn, n] using hm + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp hmT + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hTnA hv, hc⟩ + exact (hbOutside hmb).elim + +private theorem helper_branch_547.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : + TreeSequence G e0) (a b : Fin k) (jb : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + ))).length + (1 : ℕ))), (↑jb : ℕ) ≤ X.length → + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + )); b ∈ MissingColors G R.coloring (B.vertex jb) → + ∀ (hBT : TreeSequenceInitialSegment B T), TreeSequenceInitialSegment A B → X.length ≤ T.length + - (1 : ℕ) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data n; + (H.dividerCount ≠ (0 : ℕ) → HierarchyStarredStage H q = H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → (0 : ℕ) < H.dividerCount ∧ a ∈ TreeMissingColors + R.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors + R.coloring Tn → a ≠ b → (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length → + (↑(HierarchyFirstMissingPosition R.coloring T b) : ℕ) = (↑jb : ℕ) → Fin.castLE + (Nat.succ_le_succ hBT.1) jb = HierarchyFirstMissingPosition R.coloring T b → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint { a, b } Dnq) → sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors R.coloring Tn ∨ Disjoint { a, b } Dn) → + sameComponent) ∧ (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A + { a } → sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → ( + ∀ x ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length)))) x = MissingColors G R.coloring x) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); (0 : ℕ) < H.dividerCount ∧ a ∈ TreeMissingColors + R.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (a ∈ TreeMissingColors + R.coloring Tn ∨ a ∈ TreeMissingColors R.coloring (HierarchyStarredStage H q) ∧ a ∉ Dn ∧ b + ∉ Dn) → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; HierarchyWeaklyStable H q sigma ∧ + ModColoring R.corresponding.replacementETT sigma ∧ (A = Tn ∨ + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma), + MaximumProperty ettA) ∧ ((0 : ℕ) < H.dividerCount → + ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma) + (baseA : HierarchyBase ettA sigma) (K : TashkinovHierarchy ettA baseA) (goodA : + GoodHierarchy K), MaximumProperty ettA ∧ ettA.series.data.kind (Fin.last ettA.rounds) = + R.corresponding.replacementETT.series.data.kind (Fin.last + R.corresponding.replacementETT.rounds) ∧ + ∃ (hcount : K.dividerCount + (1 : ℕ) = H.dividerCount), baseA.core = R.replacementBase.core ∧ + baseA.closure = R.replacementBase.closure ∧ ( + ∀ (j : Fin (K.dividerCount + (2 : ℕ))), K.stage j = H.stage (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∧ ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + have jH : Fin (H.dividerCount + (1 : ℕ)) := (⟨(↑j : ℕ), + by omega + ⟩ : Fin (H.dividerCount + (1 : ℕ))); HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H + jH ∧ + ∀ eta ∈ HierarchyStoredColorsAt K j, goodA.gamma j eta = R.counterexample.good.gamma jH eta) ∧ + TreeColorSetMinusClosed G sigma Tnq (Dnq.biUnion (R.counterexample.good.gamma + (⟨R.counterexample.hierarchy.dividerCount - (1 : ℕ), + by + omega + ⟩ : Fin (R.counterexample.hierarchy.dividerCount + (1 : ℕ))))))) → (a ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → b ∈ MissingColors G sigma (T.vertex (Fin.last + T.length))) → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) → a ∈ + MissingColors G R.coloring (T.vertex (Fin.last T.length)) → False := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X a b jb hjbX A trans B hb hBT hAB + hXlen vertexMem H q n Tn Dn lastPositive stageCase hne iaLe ibEq jbEq change hmissing sigma + hcase changed hterminalA he hw + have hbNew : b ∈ MissingColors G sigma (B.vertex jb) := by + rw [hmissing _ (vertexMem B jb)]; exact hb + exact Finset.disjoint_left.mp (he + (TreeSequenceInitialSegmentVertexSetSubset hBT (vertexMem B jb)) + (vertexMem T (Fin.last T.length)) (by + intro hh + have hh := T.vertex_injective ((hBT.2.1 jb).trans hh) + have hh := congrArg Fin.val hh + change jb.val = T.length at hh + have := jb.isLt + have hblen : B.length = T.length - 1 := rfl + omega)) + hbNew (hterminalA hw) + +private theorem helper_hnotElementary_588.{u_1, u_2} : + helperHnotElementary588Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X a b eta hw jb hjbX A trans B hjb + hb hBT hAB hXlen vertexMem H q n Tn Dn lastPositive stageCase hne iaLe ibEq ja jaEq jbEq + haFirstB change hmissing sigma hcase changed hterminalA hterminalB he + rcases hw with hw | hw + · exact @helper_branch_547 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hTlen R X a b jb hjbX trans hb hBT hAB hXlen vertexMem + lastPositive stageCase hne iaLe ibEq jbEq change hmissing hcase changed hterminalA he hw + · have haNew : a ∈ MissingColors G sigma (B.vertex ja) := by + rw [hmissing _ (vertexMem B ja)]; exact haFirstB + exact Finset.disjoint_left.mp (he + (TreeSequenceInitialSegmentVertexSetSubset hBT (vertexMem B ja)) + (vertexMem T (Fin.last T.length)) (by + intro hh + have hh := T.vertex_injective ((hBT.2.1 ja).trans hh) + have hh := congrArg Fin.val hh; dsimp [ja] at hh; omega)) + haNew (hterminalB hw) + +private theorem helper_firstMem_689.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (psi : PartialEdgeColoring E k) (c : Fin k), + (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + classical + intro V E _ _ G k e0 T psi c hlt + let _ := Fintype.ofFinite V + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + by_cases hn : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right hn] + rfl + omega + +private theorem helper_chain_722.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : + TreeSequence G e0) (_ : Fin k) (_ : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + ))).length + (1 : ℕ))), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ + j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X eta jb trans H j + induction j with + | zero => + intro hj i hi + have he : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have he : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) (H.nested ⟨j, by omega⟩) + +private theorem helper_stageCase_765.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : + TreeSequence G e0) (a eta : Fin k), eta ∈ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount) → a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta → + ∀ (_ : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) (Decidable.byContradiction fun (a : ¬(1 + : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + ))).length + (1 : ℕ))), + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let _ : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; (0 : + ℕ) < H.dividerCount ∧ a ∈ TreeMissingColors R.coloring (H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ a ∈ TreeMissingColors + R.coloring Tn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X a eta heta haGamma jb H q n Tn + have hm := (Finset.mem_sdiff.mp (R.counterexample.good.avoidance q eta heta haGamma)).1 + by_cases hq : H.dividerCount = 0 + · right + refine ⟨hq, ?_⟩ + simpa [HierarchyStageMissingColors, q, hq, Fin.last, Tn, n] using hm + · left + refine ⟨by omega, ?_⟩ + unfold HierarchyStageMissingColors at hm + dsimp only at hm + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · exact (hq (by simpa [q] using congrArg Fin.val hz)).elim + · rw [hi] at hm + simp only [Fin.cases_succ] at hm + have he : i.succ.castSucc = (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := + Fin.ext (by simpa [q] using (congrArg Fin.val hi).symm) + simpa only [he] using hm + +private theorem helper_hbOutside_792.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : + TreeSequence G e0) (b _ : Fin k) (jb : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + ))).length + (1 : ℕ))), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → TreeSequenceInitialSegment A T → + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + )); A.length < (↑jb : ℕ) → b ∈ MissingColors G R.coloring (B.vertex jb) → + TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U) → b ∉ TreeMissingColors R.coloring A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X b eta jb A trans hAT B hjb hb hBT + hAB elementary vertexMem hm + obtain ⟨v, hvA, hmv⟩ := Finset.mem_biUnion.mp hm + obtain ⟨j, hj⟩ : ∃ j, A.vertex j = v := by simpa [TreeSequenceVertexSet] using hvA + have hne : v ≠ B.vertex jb := by + intro he + have hh := T.vertex_injective ((hAT.2.1 j).trans + (hj.trans (he.trans (hBT.2.1 jb).symm))) + have hh := congrArg Fin.val hh + have := j.isLt + change j.val = jb.val at hh + omega + exact Finset.disjoint_left.mp (elementary R + (TreeSequenceInitialSegmentVertexSetSubset hAB hvA) (vertexMem B jb) hne) hmv hb + +private theorem helper_hsone_900.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ b → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); IsOneEdgeUncolored sigma e0 := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx R a b hne sigma + refine ⟨?_, ?_⟩ + · simp [sigma, TwoColorComponentSwap, R.minimumContext.oneEdgeUncolored.1] + · intro e he + obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 e he + by_cases hm : Sum.inr e ∈ TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length))) + · by_cases hca : c = a + · subst c; exact ⟨b, by simp [sigma, TwoColorComponentSwap, hm, hc]⟩ + · by_cases hcb : c = b + · subst c; exact ⟨a, by simp [sigma, TwoColorComponentSwap, hm, hc, hne.symm]⟩ + · exact ⟨c, by simp [sigma, TwoColorComponentSwap, hm, hc, hca, hcb]⟩ + · exact ⟨c, by simp [sigma, TwoColorComponentSwap, hm, hc]⟩ + +private theorem helper_fixedA_949.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : + TreeSequence G e0) (a b _ : Fin k) (_ : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + ))).length + (1 : ℕ))), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => ( + by omega + )) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => ( + by omega + )); TreeSequenceInitialSegment B T → TreeSequenceInitialSegment A B → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data n; + (↑(HierarchyFirstMissingPosition R.coloring T a) : ℕ) ≤ A.length → ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition R.coloring T a); + have vb : V := T.vertex (HierarchyFirstMissingPosition R.coloring T b); + have sameComponent : Prop := TwoColorComponent G R.coloring a b (Sum.inl va) = + TwoColorComponent G R.coloring a b (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (a ∈ + TreeMissingColors R.coloring Tnq ∨ Disjoint {a, b} Dnq) → sameComponent) ∧ (H.dividerCount + = (0 : ℕ) ∧ (a ∈ TreeMissingColors R.coloring Tn ∨ Disjoint {a, b} Dn) → sameComponent) ∧ + (a ∈ TreeMissingColors R.coloring A ∧ TreeColorSetClosed G R.coloring A { a } → + sameComponent ∧ TreeInterchangeable G A R.coloring a b)) → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); IsOneEdgeUncolored sigma e0 → HierarchyWeaklyStable H q + sigma → (if R.corresponding.replacementETT.series.data.kind n = some + TashkinovExtensionKind.PE then CombinedStableColoring Tn R.replacementBase.closure Dn + R.coloring sigma else StableColoring Tn Dn R.coloring sigma) → + ∀ (t : Fin A.length), sigma (A.edge t) = R.coloring (A.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X a b eta jb A starEq B hBT hAB H q + n Tn Dn iaLe change sigma hsone hweak baseStable + have fixed (j : Fin (H.dividerCount + 1)) : HierarchyWeaklyStable H j sigma → + ∀ t : Fin (HierarchyStarredStage H j).length, + sigma ((HierarchyStarredStage H j).edge t) = R.coloring ((HierarchyStarredStage H j).edge + t) := by + refine Fin.cases ?_ (fun i => ?_) j + · intro _ + exact P2813_T1_BaseDisplayedEdges G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase sigma + R.minimumContext.oneEdgeUncolored hsone baseStable + · intro hh t + change sigma ((H.stage i.succ.castSucc).edge t) = + R.coloring ((H.stage i.succ.castSucc).edge t) + by_cases ht : t.val = 0 + · have he : (H.stage i.succ.castSucc).edge t = e0 := by + rw [show t = ⟨0, (H.stage i.succ.castSucc).positive⟩ from Fin.ext ht] + exact (H.stage i.succ.castSucc).first_edge + rw [he, hsone.1, R.minimumContext.oneEdgeUncolored.1] + · exact hh.2.1 t (by omega) + rw [← starEq R] + exact fixed q hweak + +private theorem helper_continuation_1318.{u_1, u_2} : + helperContinuation1318Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X a b eta heta haGamma hetaCut hw + jb hjbX A trans common starEq B hAX hAXlt hXB hjb hb haUnused hbException hBT hAB hXlen + fullB vertexMem firstFixed H q n Tn Dn lastPositive hTnA stageCase hbOutside hne hbB haB + iaLe ibEq ja jaEq jbEq haFirstB change hpath hmissing sigma hsone hcase hdisFirst changed + have hweak : HierarchyWeaklyStable H q sigma := changed.1 + have baseStable : if R.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.PE then + CombinedStableColoring Tn R.replacementBase.closure Dn R.coloring sigma + else StableColoring Tn Dn R.coloring sigma := by + have extract (j : Fin (H.dividerCount + 1)) : HierarchyWeaklyStable H j sigma → + (if R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE then + CombinedStableColoring Tn R.replacementBase.closure Dn R.coloring sigma + else StableColoring Tn Dn R.coloring sigma) := + Fin.cases (fun h => h) (fun _ h => h.1) j + exact extract q hweak + have stable : StableColoring Tn Dn R.coloring sigma := by + by_cases hp : R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE + · exact (ite_eq_left hp ▸ baseStable).1 + · simpa only [hp, ite_false] using baseStable + have fixedA : ∀ t : Fin A.length, sigma (A.edge t) = R.coloring (A.edge t) := by + exact @helper_fixedA_949 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hTlen R X a b eta jb starEq hBT hAB iaLe change hsone hweak + baseStable + have fixedPrefix : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + sigma (T.edge t) = R.coloring (T.edge t) := by + intro t hlo hhi + by_cases hbcol : R.coloring (T.edge t) = some b + · obtain ⟨hi, hc⟩ := hbException t hlo hhi hbcol + exact stable.1 _ hi ⟨b, Finset.mem_union_right _ hc, hbcol⟩ + · have haNo := haUnused t hlo hhi + simp [sigma, TwoColorComponentSwap, haNo, hbcol] + have hXT := trans hXB hBT + let XM := TreeSequencePrefix X (X.length - 1) (by have := A.positive; omega) (by omega) + have hXMX : TreeSequenceInitialSegment XM X := + ⟨by dsimp [XM, TreeSequencePrefix]; omega, fun _ => rfl, fun _ => rfl⟩ + have prefixFixed (t : Fin X.length) (ht : Tn.length ≤ t.val) : + sigma (X.edge t) = R.coloring (X.edge t) := by + by_cases hlow : t.val < A.length + · let j : Fin A.length := ⟨t.val, hlow⟩ + have he : Fin.castLE hAX.1 j = t := Fin.ext rfl + rw [← he, hAX.2.2 j] + exact fixedA j + · rw [← hXT.2.2 t] + exact fixedPrefix (Fin.castLE hXT.1 t) (by change A.length ≤ t.val; omega) t.isLt + have routes : + ((R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn X) ∨ + ((R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + R.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ f seed, R.corresponding.replacementETT.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X)) ∧ + TashkinovAugmentationSequence R.coloring X T := by + exact @helper_routes_498 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hTlen R X a b eta jb trans common hAX hAXlt hXB hBT hAB hTnA + iaLe change hmissing hXT hXMX prefixFixed + have hsplit : a ∈ TreeMissingColors sigma X ∧ b ∈ TreeMissingColors sigma X := by + have subset (j : Fin (B.length + 1)) (hj : j.val ≤ X.length) : + B.vertex j ∈ TreeSequenceVertexSet X := by + let x : Fin (X.length + 1) := ⟨j.val, by omega⟩ + have hx : Fin.castLE (Nat.succ_le_succ hXB.1) x = j := Fin.ext rfl + rw [← hx, hXB.2.1 x] + exact vertexMem X x + refine ⟨Finset.mem_biUnion.mpr ⟨B.vertex ja, subset ja (by dsimp [ja]; omega), ?_⟩, + Finset.mem_biUnion.mpr ⟨B.vertex jb, subset jb hjbX, ?_⟩⟩ + · rw [hmissing _ (vertexMem B ja)]; exact haFirstB + · rw [hmissing _ (vertexMem B jb)]; exact hb + have gammaCut : ∀ eta', eta' ∈ HierarchyStoredColorsAt H q → + (a ∈ R.counterexample.good.gamma q eta' ∨ b ∈ R.counterexample.good.gamma q eta') → + (HierarchyFirstMissingPosition R.coloring T eta').val ≤ X.length := by + exact @helper_gammaCut_539 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hTlen R X a b eta heta haGamma hetaCut jb starEq hBT hAB hTnA + stageCase hbOutside iaLe change + obtain ⟨_, _, corr, hmaximum, bs, K, goodK, hsameGood⟩ := + StableChangeCasesOneTwoSplitTail G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase R.counterexample R.minimumContext + a b hne (by rw [fullB R]; exact ⟨haB, hbB⟩) + _ hpath sigma rfl hcase hdisFirst X (by dsimp only; rw [starEq R]; exact hAX) + (by dsimp only; rw [starEq R]; exact hAXlt) (by rw [fullB R]; exact hXB) + (by dsimp only; rw [starEq R]; exact fixedPrefix) routes.1 routes.2 hsplit + (by rw [fullB R]; exact hmissing) + (fun c _ => firstFixed R.coloring sigma hmissing c) gammaCut + have terminal := TwoColorComponentSwapMissingBehavior G R.coloring a b hne + R.minimumContext.proper (Sum.inl (T.vertex (Fin.last T.length))) + have hterminalA : a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G sigma (T.vertex (Fin.last T.length)) := + terminal.2.1 _ (by rfl) + have hterminalB : b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + a ∈ MissingColors G sigma (T.vertex (Fin.last T.length)) := + terminal.2.2.1 _ (by rfl) + have hnotElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet T) := by + exact @helper_hnotElementary_588 V E inferInstance inferInstance inferInstance inferInstance + G k e0 input T phi ett base C ctx hTlen R X a b eta hw jb hjbX trans hjb hb hBT hAB hXlen + vertexMem lastPositive stageCase hne iaLe ibEq jaEq jbEq haFirstB change hmissing hcase + changed hterminalA hterminalB + let CS : HierarchyCounterexample bs := { + positive := by rw [corr.rungAgreement]; exact R.counterexample.positive + hierarchy := K + good := goodK + maximum := hmaximum + notElementary := hnotElementary } + obtain ⟨S, hS⟩ := HierarchyReplacementPresentationTrans G k e0 input T phi ett base C ctx + R sigma corr bs CS hsameGood + refine ⟨S, ?_, ?_, ?_, ?_⟩ <;> rw [hS] + · exact hmissing + · exact fixedPrefix + · exact hterminalA + · exact hterminalB + +private theorem helper_continuation_1225.{u_1, u_2} : + helperContinuation1225Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X a b eta heta haGamma hetaCut hw + jb hjbX + set A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) + intro trans common componentData starEq B hAX hAXlt hXB hjb hb haUnused hbException hBT hAB + hXlen fullB elementary vertexMem firstMem firstFixed + set H : TashkinovHierarchy + R.corresponding.replacementETT + R.replacementBase := + R.counterexample.hierarchy + set q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount + set n : Fin (R.corresponding.replacementETT.rounds + 1) := + Fin.last R.corresponding.replacementETT.rounds + set Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc + let Dn : Finset (Fin k) := + TashkinovStoredColors + R.corresponding.replacementETT.series.data + n + intro lastPositive hTnA stageCase hbOutside hne hbB haB iaLe ibEq + have haFirst := firstMem R.coloring a (by + have := hAB.1 + have hblen : B.length = T.length - 1 := rfl + omega) + let ja : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T a).val, + by have := hAB.1; omega⟩ + have jaEq : Fin.castLE (Nat.succ_le_succ hBT.1) ja = + HierarchyFirstMissingPosition R.coloring T a := Fin.ext rfl + have jbEq : Fin.castLE (Nat.succ_le_succ hBT.1) jb = + HierarchyFirstMissingPosition R.coloring T b := Fin.ext ibEq.symm + have haFirstB : a ∈ MissingColors G R.coloring (B.vertex ja) := by + rw [← hBT.2.1 ja, jaEq]; exact haFirst + have hordered : TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition R.coloring T a)) + (T.vertex (HierarchyFirstMissingPosition R.coloring T b)) := + ⟨_, _, rfl, rfl, by omega⟩ + have hunused : a ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, + A.length ≤ t.val ∧ t.val < (HierarchyFirstMissingPosition R.coloring T b).val ∧ + R.coloring (T.edge t) = some c) := by + intro hh + obtain ⟨_, t, hlo, hhi, hc⟩ := Finset.mem_filter.mp hh + exact haUnused t hlo (by omega) hc + have hprefixR : ColoredVertexSetElementary G R.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := by + rw [fullB R] + exact elementary R + have hmissingR : a ∈ TreeMissingColors R.coloring + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1)) ∧ + b ∈ TreeMissingColors R.coloring + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1)) + := by + rw [fullB R] + exact ⟨haB, hbB⟩ + have change := ChangeLemma G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + hprefixR + R.minimumContext.largeMissingSet a b hne + hmissingR + (by + dsimp only + rw [starEq R] + intro _ + exact ⟨hordered, hunused⟩) + have hsame : TwoColorComponent G R.coloring a b (Sum.inl (B.vertex ja)) = + TwoColorComponent G R.coloring a b (Sum.inl (B.vertex jb)) := by + have hh : TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (HierarchyFirstMissingPosition R.coloring T a))) = + TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (HierarchyFirstMissingPosition R.coloring T b))) := by + rcases stageCase with ⟨hq, hm⟩ | ⟨hq, hm⟩ + · exact change.1 ⟨hq, Or.inl hm⟩ + · exact change.2.1 ⟨hq, Or.inl hm⟩ + rw [← jaEq, ← jbEq, hBT.2.1 ja, hBT.2.1 jb] at hh + exact hh + obtain ⟨hdis, hpath, hmissing⟩ := componentData R.coloring a b hne + R.minimumContext.proper (TreeSequenceVertexSet B) (elementary R) + (B.vertex ja) (B.vertex jb) (T.vertex (Fin.last T.length)) + (vertexMem B ja) (vertexMem B jb) + (by intro hh; have := congrArg Fin.val (B.vertex_injective hh); dsimp [ja] at this; omega) + (by intro hh; have hh := T.vertex_injective (hh.trans (hBT.2.1 ja).symm) + have hh := congrArg Fin.val hh + change T.length = ja.val at hh + have := ja.isLt + have hblen : B.length = T.length - 1 := rfl + omega) + (by intro hh; have hh := T.vertex_injective (hh.trans (hBT.2.1 jb).symm) + have hh := congrArg Fin.val hh + change T.length = jb.val at hh + have := jb.isLt + have hblen : B.length = T.length - 1 := rfl + omega) + haFirstB hb hw hsame + let sigma := TwoColorComponentSwap G R.coloring a b (Sum.inl (T.vertex (Fin.last T.length))) + have hsproper : IsProperEdgeColoring G sigma := + TwoColorComponentSwapProper G R.coloring a b hne R.minimumContext.proper _ + have hsone : IsOneEdgeUncolored sigma e0 := by + exact @helper_hsone_900 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx R a b hne + have hcase : + (0 < H.dividerCount ∧ a ∈ TreeMissingColors R.coloring (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ (a ∈ TreeMissingColors R.coloring Tn ∨ + (a ∈ TreeMissingColors R.coloring (HierarchyStarredStage H q) ∧ a ∉ Dn ∧ b ∉ Dn))) := by + rcases stageCase with h | ⟨hq, hm⟩ + · exact Or.inl h + · exact Or.inr ⟨hq, Or.inl hm⟩ + have hdisFirst : Disjoint (TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length)))) + (TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (HierarchyFirstMissingPosition R.coloring T a)))) := by + rw [← jaEq, hBT.2.1 ja] + exact hdis + have changed := StableChangeCasesOneTwo G k e0 R.corresponding.replacementInput T R.coloring + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + hprefixR + R.minimumContext.largeMissingSet a b hne + hmissingR + _ hpath sigma rfl hcase hdisFirst + exact @helper_continuation_1318 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx hTlen R X a b eta heta haGamma hetaCut hw jb hjbX trans + common starEq hAX hAXlt hXB hjb hb haUnused hbException hBT hAB hXlen fullB vertexMem + firstFixed lastPositive hTnA stageCase hbOutside hne hbB haB iaLe ibEq jaEq jbEq haFirstB + change hpath hmissing hsone hcase hdisFirst changed +private theorem helper_continuation_190.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ + T.length) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : + TreeSequence G e0) (a b eta : Fin k), eta ∈ HierarchyStoredColorsAt + R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount) → a ∈ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta → + (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length → a ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex + (Fin.last T.length)) → + ∀ (jb : Fin ((TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by omega + ) ( + by omega + )).length + (1 : ℕ))), (↑jb : ℕ) ≤ X.length → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z + → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → ( + ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → + ∀ (B : Finset V), ColoredVertexSetElementary G psi B → + ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ + MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → + TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl + u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ + ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi + x) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0)) → TreeSequenceInitialSegment + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : TreeSequence G + e0) T → + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) X → (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) : TreeSequence G e0).length < X.length → + TreeSequenceInitialSegment X B → (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0).length < (↑jb : ℕ) → b ∈ MissingColors G + R.coloring (B.vertex jb) → ( + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some + a) → ( + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) : + TreeSequence G e0).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some + b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) : TreeSequence G e0) B → X.length ≤ T.length - (1 : ℕ) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → + ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( + ∀ v ∈ TreeSequenceVertexSet (TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by omega + ) ( + by omega + )), MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ ( + ∀ (t : Fin T.length), (HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount)).length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) + = R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) + → b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G + R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex + (Fin.last T.length))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R X a b eta heta haGamma hetaCut hw + jb hjbX + set A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) + intro trans common componentData starEq hAT B hAX hAXlt hXB hjb hb haUnused hbException hBT hAB + hXlen fullB elementary + have vertexMem (U : TreeSequence G e0) (j : Fin (U.length + 1)) : + U.vertex j ∈ TreeSequenceVertexSet U := by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨j, rfl⟩ + have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) + (j : Fin (T.length + 1)) (hj : c ∈ MissingColors G psi (T.vertex j)) : + HierarchyFirstMissingPosition psi T c ≤ j := by + clear * - G T psi c j hj + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ + have hn : candidates.Nonempty := ⟨j, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates j hm + have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + exact @helper_firstMem_689 V E inferInstance inferInstance G k e0 T psi c hlt + have firstAt (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + 1)) + (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : + (HierarchyFirstMissingPosition R.coloring T c).val = j.val := by + exact @helper_firstAt_167 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hTlen R hBT elementary vertexMem firstLe firstMem R c j hc + have firstFixed (psi tau : PartialEdgeColoring E k) + (hmissing : ∀ v ∈ TreeSequenceVertexSet B, + MissingColors G tau v = MissingColors G psi v) (c : Fin k) : + HierarchyFirstMissingPosition tau T c = HierarchyFirstMissingPosition psi T c := by + exact @helper_firstFixed_193 V E inferInstance inferInstance G k e0 T hTlen hBT vertexMem + firstLe firstMem psi tau hmissing c + let H := R.counterexample.hierarchy + let q := Fin.last H.dividerCount + let n := Fin.last R.corresponding.replacementETT.rounds + let Tn := R.corresponding.replacementETT.series.data.tree n.castSucc + let Dn := TashkinovStoredColors R.corresponding.replacementETT.series.data n + have chain : ∀ (j : ℕ) (hj : j < H.dividerCount + 2) + (i : Fin (H.dividerCount + 2)), i.val ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage ⟨j, hj⟩) := by + exact @helper_chain_722 V E inferInstance inferInstance inferInstance inferInstance G k e0 + input T phi ett base C ctx hTlen R X eta jb trans + have lastPositive (hq : H.dividerCount ≠ 0) : + HierarchyStarredStage H q = H.stage ⟨H.dividerCount, by omega⟩ := by + unfold HierarchyStarredStage + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · exact (hq (by simpa [q] using congrArg Fin.val hz)).elim + · rw [hi] + simp only [Fin.cases_succ] + congr 1 + exact Fin.ext (by simpa [q] using (congrArg Fin.val hi).symm) + have hTnCore : TreeSequenceInitialSegment Tn R.replacementBase.core := by + by_cases hpe : R.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.PE + · exact (R.replacementBase.parallel hpe).2.2.some.leftSegment + · rw [R.replacementBase.nonparallel hpe] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have coreA : TreeSequenceInitialSegment R.replacementBase.core A := by + rw [← starEq R] + by_cases hq : H.dividerCount = 0 + · have he : HierarchyStarredStage H q = R.replacementBase.core := by + simp [HierarchyStarredStage, q, hq, Fin.last] + rw [he] + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · rw [lastPositive hq] + exact trans H.coreInsideFirst (chain H.dividerCount (by omega) ⟨1, by omega⟩ + (by change 1 ≤ H.dividerCount; omega)) + have hTnA := trans hTnCore coreA + have stageCase : + (0 < H.dividerCount ∧ a ∈ TreeMissingColors R.coloring + (H.stage ⟨H.dividerCount, by omega⟩)) ∨ + (H.dividerCount = 0 ∧ a ∈ TreeMissingColors R.coloring Tn) := by + exact @helper_stageCase_765 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx hTlen R X a eta heta haGamma jb + have haA : a ∈ TreeMissingColors R.coloring A := by + rcases stageCase with ⟨hq, hm⟩ | ⟨hq, hm⟩ + · rw [← starEq R, lastPositive (by omega)] + exact hm + · obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp hm + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset hTnA hv, hc⟩ + have hbOutside : b ∉ TreeMissingColors R.coloring A := by + exact @helper_hbOutside_792 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx hTlen R X b eta jb trans hAT hjb hb hBT hAB elementary + vertexMem + have hne : a ≠ b := by rintro rfl; exact hbOutside haA + have hbB : b ∈ TreeMissingColors R.coloring B := + Finset.mem_biUnion.mpr ⟨B.vertex jb, vertexMem B jb, hb⟩ + have haB : a ∈ TreeMissingColors R.coloring B := by + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp haA + exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hAB hv, hc⟩ + have iaLe : (HierarchyFirstMissingPosition R.coloring T a).val ≤ A.length := by + obtain ⟨v, hv, hc⟩ := Finset.mem_biUnion.mp haA + obtain ⟨j, hj⟩ : ∃ j, A.vertex j = v := by simpa [TreeSequenceVertexSet] using hv + have hcT : a ∈ MissingColors G R.coloring + (T.vertex (Fin.castLE (Nat.succ_le_succ hAT.1) j)) := by + rw [hAT.2.1 j, hj]; exact hc + have hh := firstLe R.coloring a _ hcT + change (HierarchyFirstMissingPosition R.coloring T a).val ≤ j.val at hh + have := j.isLt + omega + have ibEq := firstAt R b jb hb + exact @helper_continuation_1225 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx hTlen R X a b eta heta haGamma hetaCut hw jb hjbX trans + common componentData starEq hAX hAXlt hXB hjb hb haUnused hbException hBT hAB hXlen fullB + elementary vertexMem firstMem firstFixed lastPositive hTnA stageCase hbOutside hne hbB haB + iaLe ibEq +theorem P2963_T1_TerminalKempeStageSwitch {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext + G k e0 input T phi ett base C) + (A B : TreeSequence G e0) (hTlen : 2 ≤ T.length) + (hA : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A) + (hB : B = TreeSequencePrefix T (T.length - 1) (by omega) (by omega)) + (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (X : TreeSequence G e0) (hAX : TreeSequenceInitialSegment A X) + (hAXlt : A.length < X.length) (hXB : TreeSequenceInitialSegment X B) + (a b eta : Fin k) + (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)) + (haGamma : a ∈ R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta) + (hetaCut : (HierarchyFirstMissingPosition R.coloring T eta).val ≤ X.length) + (jb : Fin (B.length + 1)) (hjb : A.length < jb.val) + (hjbX : jb.val ≤ X.length) + (hb : b ∈ MissingColors G R.coloring (B.vertex jb)) + (hw : a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) ∨ + b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length))) + (haUnused : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) ≠ some a) + (hbException : ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + b ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds)) : + ∃ S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx, + (∀ v ∈ TreeSequenceVertexSet B, + MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ + (∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + S.coloring (T.edge t) = R.coloring (T.edge t)) ∧ + (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ + (b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → + a ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) := by + classical + subst A + subst B + let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) + have trans {X Y Z : TreeSequence G e0} + (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z) : + TreeSequenceInitialSegment X Z := by + clear * - hXY hYZ + refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + have common {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) + (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : + TreeSequenceInitialSegment X Y := by + clear * - hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + have componentData (psi : PartialEdgeColoring E k) (a b : Fin k) + (hne : a ≠ b) (hproper : IsProperEdgeColoring G psi) + (B : Finset V) (helem : ColoredVertexSetElementary G psi B) + (u v w : V) (hu : u ∈ B) (hv : v ∈ B) (huv : u ≠ v) + (hwu : w ≠ u) (hwv : w ≠ v) + (hau : a ∈ MissingColors G psi u) (hbv : b ∈ MissingColors G psi v) + (hw : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) + (hsame : TwoColorComponent G psi a b (Sum.inl u) = + TwoColorComponent G psi a b (Sum.inl v)) : + Disjoint (TwoColorComponent G psi a b (Sum.inl w)) + (TwoColorComponent G psi a b (Sum.inl u)) ∧ + TwoColorPathComponent G psi a b (Sum.inl w) ∧ + (∀ x ∈ B, + MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = + MissingColors G psi x) := by + exact P2905_T2_ElementaryTerminalComponent G psi a b hne hproper + B helem u v w hu hv hwu hwv hau hbv hw hsame + have sameLast : + ∀ {a b : ℕ} (s : Fin (a + 2) → TreeSequence G e0) (t : Fin (b + 2) → TreeSequence G e0) (u v : + TreeSequence G e0), a = b → HEq s t → u = v → Fin.cases (motive := fun _ => TreeSequence G + e0) u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = Fin.cases (motive := fun _ => + TreeSequence G e0) v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by + clear * - + intro a b s t u v hab hst huv + cases hab + have he : s = t := eq_of_heq hst + cases he + cases huv + rfl + have starEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = A := + (sameLast _ _ _ _ R.sameGood.1.2.1 R.sameGood.1.2.2.1 R.sameGood.1.1).symm + have hAT : TreeSequenceInitialSegment A T := by + have starNext (j : Fin (C.hierarchy.dividerCount + 1)) : + TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy j) + (C.hierarchy.stage j.succ) := + Fin.cases C.hierarchy.coreInsideFirst (fun i => C.hierarchy.nested i.succ) j + simpa only [Fin.succ_last, C.hierarchy.terminalStage] using + starNext (Fin.last C.hierarchy.dividerCount) + let B := TreeSequencePrefix T (T.length - 1) (by omega) (by omega) + change TreeSequenceInitialSegment A X at hAX + change A.length < X.length at hAXlt + change TreeSequenceInitialSegment X B at hXB + change A.length < jb.val at hjb + change b ∈ MissingColors G R.coloring (B.vertex jb) at hb + change ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) ≠ some a at haUnused + change ∀ t : Fin T.length, A.length ≤ t.val → t.val < X.length → + R.coloring (T.edge t) = some b → + TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ + b ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data + (Fin.last R.corresponding.replacementETT.rounds) at hbException + have hBT : TreeSequenceInitialSegment B T := + ⟨by dsimp [B, TreeSequencePrefix]; omega, fun _ => rfl, fun _ => rfl⟩ + have hAB : TreeSequenceInitialSegment A B := trans hAX hXB + have hXlen : X.length ≤ T.length - 1 := hXB.1 + have fullB (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1) = B := by + have hn : min ((HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + + (HierarchyFullTailLength R.counterexample - 1)) T.length = T.length - 1 := by + unfold HierarchyFullTailLength + dsimp only + rw [starEq R] + omega + simp only [HierarchyFullTailPrefix, hn] + rfl + have elementary (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by + have h : ColoredVertexSetElementary G R.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 + R.corresponding.replacementInput T R.coloring R.corresponding.replacementETT + R.replacementBase R.counterexample R.minimumContext.proper + R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + R.minimumContext.largeMissingSet + intro u hu v hv hne + exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne + exact @helper_continuation_190 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx hTlen R X a b eta heta haGamma hetaCut hw jb hjbX trans + common componentData starEq hAT hAX hAXlt hXB hjb hb haUnused hbException hBT hAB hXlen + fullB elementary +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TerminalPrefixReconstruction.lean b/LeanPool/GoldbergSeymour/TerminalPrefixReconstruction.lean new file mode 100644 index 0000000000..e237911905 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalPrefixReconstruction.lean @@ -0,0 +1,224 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyPrefixData +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix + +/-! +# P2752_T2_Prefix Reconstruction + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2752_T2_PrefixReconstruction {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseThreeData G k e0 input T phi ett base C ctx) + (beta : Fin k) + (hunused : ∀ t : Fin T.length, + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length + ≤ t.val → phi (T.edge t) ≠ some beta) + (hpresent : beta ∉ MissingColors G phi (T.vertex D.terminalVertexIndex)) + (houtside : ∀ v : V, + Sum.inl v ∈ TwoColorComponent G phi D.alpha beta + (Sum.inl (T.vertex D.terminalVertexIndex)) → + v ∉ TreeSequenceVertexSet + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1))) : + let yp := T.vertex D.terminalVertexIndex + let Q := TwoColorComponent G phi D.alpha beta (Sum.inl yp) + let sigma := TwoColorComponentSwap G phi D.alpha beta (Sum.inl yp) + Sum.inl yp ∈ Q ∧ + (∃ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ Q) ∧ + (∀ t : Fin T.length, sigma (T.edge t) = phi (T.edge t)) ∧ + StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma ∧ + beta ∈ MissingColors G sigma yp ∧ + Nonempty (HierarchyPrefixData C + (HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1)) sigma) := by + classical + dsimp only + let H := C.hierarchy + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let Bplus := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + let yp := T.vertex D.terminalVertexIndex + let sigma := TwoColorComponentSwap G phi D.alpha beta (Sum.inl yp) + have hroot : Sum.inl yp ∈ TwoColorComponent G phi D.alpha beta (Sum.inl yp) := by + change (TwoColorIncidenceGraph G phi D.alpha beta).connectedComponentMk + (Sum.inl yp) = (TwoColorIncidenceGraph G phi D.alpha beta).connectedComponentMk + (Sum.inl yp) + rfl + have hne : D.alpha ≠ beta := by + intro h + exact hpresent (h ▸ D.alphaMissingTerminal) + have hA : TreeSequenceInitialSegment A T := by + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) + · have hq : H.dividerCount = 0 := by + simpa using congrArg Fin.val hz + have hcore : TreeSequenceInitialSegment base.core T := by + have hh := H.coreInsideFirst + have ht : H.stage ⟨1, by omega⟩ = T := by + convert H.terminalStage using 1; congr 1; apply Fin.ext; simp [hq] + rw [ht] at hh + exact hh + simpa [A, HierarchyStarredStage, hz] using hcore + · have ha : A = H.stage (Fin.last H.dividerCount).castSucc := by + simp [A, HierarchyStarredStage, hi] + rw [ha] + have hh := H.nested (Fin.last H.dividerCount) + simpa [H.terminalStage] using hh + have htail : 2 ≤ T.length - A.length := D.tailAtLeastTwo + have hlen : Bplus.length = T.length - 1 := by + change min (A.length + (T.length - A.length - 1)) T.length = T.length - 1 + omega + have hBT : TreeSequenceInitialSegment Bplus T := by + refine ⟨Nat.min_le_right _ _, ?_, ?_⟩ <;> intro i <;> rfl + have prefixCompare {S : TreeSequence G e0} + (hST : TreeSequenceInitialSegment S T) (hSB : S.length ≤ Bplus.length) : + TreeSequenceInitialSegment S Bplus := by + refine ⟨hSB, ?_, ?_⟩ + · intro i + rw [← hBT.2.1 (Fin.castLE (Nat.succ_le_succ hSB) i)] + convert hST.2.1 i using 1 + congr 1 + · intro i + rw [← hBT.2.2 (Fin.castLE hSB i)] + convert hST.2.2 i using 1 + congr 1 + have hAB : TreeSequenceInitialSegment A Bplus := prefixCompare hA (by omega) + have hABstrict : A.length < Bplus.length := by omega + have hNB : TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) Bplus := by + have hindex : (Fin.last ett.rounds).castSucc = + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + apply prefixCompare + · rw [hindex] + exact ett.abovePenultimate + · have hn := ett.strictAbovePenultimate + rw [hindex] + omega + have hrecolor : OutsideKempeRecoloring Bplus phi sigma D.alpha beta := by + refine ⟨hne, {Sum.inl yp}, ?_, ?_⟩ + · intro z hz v hv + have hz' : z = Sum.inl yp := Finset.mem_singleton.mp hz + subst z + exact houtside v hv + · intro f + simp [sigma, TwoColorComponentSwap] + obtain ⟨hproper, hone, _, hinv, hincident⟩ := + OutsideKempeRecoloringStable G e0 Bplus ∅ phi sigma D.alpha beta + ctx.proper ctx.oneEdgeUncolored hrecolor + have hstable : StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) phi sigma := by + constructor + · intro f hf _ + obtain ⟨v, hv, hvf⟩ := hf + exact hincident f ⟨v, TreeSequenceInitialSegmentVertexSetSubset hNB hv, hvf⟩ + · intro v hv + exact hinv.2 v (TreeSequenceInitialSegmentVertexSetSubset hNB hv) + have hlastAlpha : phi (T.edge D.lastEdgeIndex) ≠ some D.alpha := by + intro hf + obtain ⟨i, hi⟩ := T.attaches D.lastEdgeIndex + have hvertex : D.lastEdgeIndex.succ = D.terminalVertexIndex := by + apply Fin.ext + simpa [Fin.val_succ, D.terminalVertexPosition] using D.lastEdgePosition + have hinc : Incident G yp (T.edge D.lastEdgeIndex) := by + change yp ∈ G.ends (T.edge D.lastEdgeIndex) + rw [hi, hvertex] + exact Sym2.mem_mk_left _ _ + have hmissing : D.alpha ∉ PresentColors G phi yp := + (Finset.mem_sdiff.mp D.alphaMissingTerminal).2 + exact hmissing (by simp only [PresentColors, Finset.mem_filter, + Finset.mem_univ, true_and]; exact ⟨T.edge D.lastEdgeIndex, hinc, hf⟩) + have hlastBeta : phi (T.edge D.lastEdgeIndex) ≠ some beta := by + apply hunused + change A.length ≤ D.lastEdgeIndex.val + have hp := D.lastEdgePosition + omega + have hlast : sigma (T.edge D.lastEdgeIndex) = phi (T.edge D.lastEdgeIndex) := by + simp [sigma, TwoColorComponentSwap, hlastAlpha, hlastBeta] + have hfixed : ∀ t : Fin T.length, sigma (T.edge t) = phi (T.edge t) := by + intro t + by_cases ht : t.val < Bplus.length + · let j : Fin Bplus.length := ⟨t.val, ht⟩ + have he : Bplus.edge j = T.edge t := by + rw [← hBT.2.2 j] + rfl + have hinc : TreeIncidentEdge Bplus (Bplus.edge j) := by + obtain ⟨i, hi⟩ := Bplus.attaches j + refine ⟨Bplus.vertex j.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · change Bplus.vertex j.succ ∈ G.ends (Bplus.edge j) + rw [hi] + exact Sym2.mem_mk_left _ _ + simpa [he] using hincident (Bplus.edge j) hinc + · have ht' : t = D.lastEdgeIndex := by + apply Fin.ext + have hp := D.lastEdgePosition + omega + simpa [ht'] using hlast + obtain ⟨oldETT, oldMP, oldRung, oldSeries, oldBase, oldCore, + oldClosure, oldSupport, oldH, oldCount, oldStages, oldDividers, + oldGood, oldColors⟩ := GoodHierarchyTerminalPrefixRepackage G k e0 input + T phi phi ett C.maximum base H C.good Bplus hAB hABstrict hBT + obtain ⟨_, _, _, _, corr, newMP, newBase, newH, newGood, + sameGood, _⟩ := HierarchyLEMStable G k e0 input Bplus phi sigma oldETT + oldMP (by rw [oldRung]; exact C.positive) + (by + intro input' T' generating' lower hp hlt hm + exact ctx.lowerRung lower hp (by omega) hm) + oldBase oldH oldGood ctx.proper ctx.oneEdgeUncolored D.alpha beta hrecolor + have hbeta := (TwoColorComponentSwapMissingBehavior G phi D.alpha beta hne + ctx.proper (Sum.inl yp)).2.1 yp hroot D.alphaMissingTerminal + refine ⟨hroot, ?_, hfixed, hstable, hbeta, ?_⟩ + · exact ⟨yp, by simp [yp, TreeSequenceVertexSet], hroot⟩ + · exact ⟨{ + belowFull := hBT + penultimateLength := by change T.length = Bplus.length + 1; omega + ladderBelow := hNB + oldETT := oldETT + oldMaximum := oldMP + oldRung := oldRung + oldSeries := oldSeries + oldBase := oldBase + oldCore := oldCore + oldClosure := oldClosure + oldSupport := oldSupport + oldHierarchy := oldH + oldCount := oldCount + oldStages := oldStages + oldDividers := oldDividers + oldGood := oldGood + oldColors := oldColors + proper := hproper + oneUncolored := hone + invariant := hinv + incidentFixed := hincident + corresponding := corr + maximum := newMP + newBase := newBase + newHierarchy := newH + newGood := newGood + sameGood := sameGood }⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TerminalRoute.lean b/LeanPool/GoldbergSeymour/TerminalRoute.lean new file mode 100644 index 0000000000..adf0f44394 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalRoute.lean @@ -0,0 +1,166 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.TreeSequencePrefix + +/-! +# P2813_T1_Terminal Route + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem P2813_T1_TerminalRoute {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) : + let n := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn T) ∨ + ((ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TreeIncidentEdge Tn f ∧ + (∃ c ∈ TreeMissingColors phi Tn ∪ Dn, phi f = some c) ∧ + TashkinovAugmentationSequence phi seed T) := by + classical + let n := Fin.last ett.rounds + let Tn := ett.series.data.tree n.castSucc + let Dn := TashkinovStoredColors ett.series.data n + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) + (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : + TreeSequenceInitialSegment S U := by + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans + (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + have storedOrMissing (c : Fin k) (hc : c ∈ ett.series.data.stored n) : + c ∈ TreeMissingColors phi Tn ∪ Dn := by + by_cases hm : c ∈ TreeMissingColors phi Tn + · exact Finset.mem_union_left _ hm + · apply Finset.mem_union_right + unfold Dn TashkinovStoredColors + have hn : n.val ≠ 0 := by dsimp [n]; have := ett.roundsPositive; omega + simp only [ite_eq_right hn] + refine Finset.mem_sdiff.mpr ⟨?_, ?_⟩ + · exact Finset.mem_biUnion.mpr ⟨n, Finset.mem_univ _, by simp [hc]⟩ + · simpa only [← ett.generatingColoring, Tn, n] using hm + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => have hv := congrArg Fin.val hi; simp [n] at hv; have := ett.roundsPositive; omega + | SE j _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedT : TreeSequenceInitialSegment seed T := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + ett.belowFinal (by + have hl := adjoin.1; rw [hj] at hl + change seed.length = Tn.length + 1 at hl + have hs := ett.strictAbovePenultimate + change Tn.length < T.length at hs + omega) + have hcol : phi choice.edge = some choice.color := by + have hg : phi = choice.selected := by + simpa only [← hj, coloring, n] using ett.generatingColoring + simpa only [hg] using choice.edgeColor + have hc : choice.color ∈ ett.series.data.stored n := by rw [← hj, stored]; simp + exact Or.inr ⟨Or.inl (by simpa [hj] using kind), choice.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + ⟨choice.vertex, by simpa [Tn, hj] using choice.vertexDefective.1, + choice.edgeIncident⟩, + ⟨choice.color, storedOrMissing choice.color hc, hcol⟩, + TashkinovAugmentationSequenceRestrict phi seed T _ hroute hseedT ett.belowFinal⟩ + | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + refine Or.inl ⟨by simpa [hj] using kind, ?_⟩ + apply TashkinovAugmentationSequenceRestrict phi Tn T _ _ ett.abovePenultimate ett.belowFinal + simpa [Tn, hj, hlast, ← ett.generatingColoring, n] using closure.1 + | RE j _ _ _ _ available coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedT : TreeSequenceInitialSegment seed T := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + ett.belowFinal (by + have hl := adjoin.1; rw [hj] at hl + change seed.length = Tn.length + 1 at hl + have hs := ett.strictAbovePenultimate + change Tn.length < T.length at hs + omega) + have hcol : phi available.edge = some available.gamma ∨ + phi available.edge = some available.delta := by + have hg : phi = ett.series.data.coloring j.castSucc := by + simpa only [← hj, coloring, n] using ett.generatingColoring + simp only [hg] + have hadj := available.returnPath.adj_snd + (SimpleGraph.Walk.not_nil_of_ne (by intro he; cases he)) + cases hh : available.returnPath.snd with + | inl v => + have hc : (TwoColorIncidenceGraph G (ett.series.data.coloring j.castSucc) + available.gamma available.delta).Adj (Sum.inr available.edge) (Sum.inl v) := + hh ▸ hadj + exact hc.2 + | inr f => + have hc : (TwoColorIncidenceGraph G (ett.series.data.coloring j.castSucc) + available.gamma available.delta).Adj (Sum.inr available.edge) (Sum.inr f) := + hh ▸ hadj + exact False.elim hc + have hcontrol : ∃ c, phi available.edge = some c ∧ + c ∈ TreeMissingColors phi Tn ∪ Dn := by + rcases hcol with h | h + · exact ⟨available.gamma, h, storedOrMissing _ (by rw [← hj, stored]; simp)⟩ + · exact ⟨available.delta, h, storedOrMissing _ (by rw [← hj, stored]; simp)⟩ + have hincident : TreeIncidentEdge Tn available.edge := by + refine ⟨available.insideEndpoint, ?_, ?_⟩ + · have hidx : j.castSucc.succ = n.castSucc := Fin.ext (by + simpa only [Fin.val_succ, Fin.val_castSucc] using congrArg Fin.val hj) + simpa only [Tn, hidx] using available.insideInCurrent + · rw [Incident, available.edgeEnds] + exact Sym2.mem_mk_left _ _ + exact Or.inr ⟨Or.inr (by simpa [hj] using kind), available.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, hincident, + by obtain ⟨c, hcol, hc⟩ := hcontrol; exact ⟨c, hc, hcol⟩, + TashkinovAugmentationSequenceRestrict phi seed T _ hroute hseedT ett.belowFinal⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean new file mode 100644 index 0000000000..397742e08c --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean @@ -0,0 +1,5777 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Basic2 +public import LeanPool.GoldbergSeymour.PositivePrefixNoRevisiting +public import LeanPool.GoldbergSeymour.TdEarlierPEWitnessIdentification +public import LeanPool.GoldbergSeymour.TdReplacementPrefixExact +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed +public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.DefectiveColor +public import LeanPool.GoldbergSeymour.DefectiveEdge +public import LeanPool.GoldbergSeymour.DefectiveVertex +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.ExtensionBase +public import LeanPool.GoldbergSeymour.ExtensionRules +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.KTriple +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.MaximumPropertyTransport +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.ModColoring +public import LeanPool.GoldbergSeymour.ParallelExtensionColor +public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate +public import LeanPool.GoldbergSeymour.StableColoring +public import LeanPool.GoldbergSeymour.TashkinovAugmentation +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import LeanPool.GoldbergSeymour.TashkinovClosure +public import LeanPool.GoldbergSeymour.TashkinovClosureExists +public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesAppend +public import LeanPool.GoldbergSeymour.TashkinovSeriesFinalETTExists +public import LeanPool.GoldbergSeymour.TashkinovSeriesStep +public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import LeanPool.GoldbergSeymour.TashkinovStoredColorsAppend +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.TreeExit +public import LeanPool.GoldbergSeymour.TreeExitPath +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorCycle +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent +public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent +public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificateAppend +public import LeanPool.GoldbergSeymour.ParallelExtensionColorAppend +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis + +/-! +# Preparatory lemmas for terminal extension reconstruction + +Part of Wesley Pegden’s Trellis formalization of the Goldberg–Seymour theorem, +commit 88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. These lemmas support the +reconstruction of terminal series extensions. +-/ + +@[expose] public section + +namespace GoldbergSeymour.TerminalSeriesRebuild + +/-- Typed data construction shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperNewChoice2409.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (hpositive : (0 : ℕ) < ett.rounds) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → + (choice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) → + (sigmaPrev : PartialEdgeColoring E k) → + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev → + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color → + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color → + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev sigmaPrev → + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf + exact { + selected := sigmaPrev + selectedProper := hsigmaPrevProper + selectedOneUncolored := hsigmaPrevOne + selectedStable := hsigmaPrevSelf + vertex := choice.vertex + vertexDefective := ⟨choice.vertexDefective.1, choice.edge, + ⟨choice.color, hchoiceDefective, hchoiceEdgeNew⟩, + choice.edgeIncident⟩ + maximal := by + intro pi w hpiProper hpiOne hpiStable hw + have hpiOld : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) pi := by + exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc)).trans + (x := ⟨ett.series.data.coloring q.castSucc, + ⟨previousProper, previousOneUncolored⟩⟩) + (y := ⟨sigmaPrev, ⟨hsigmaPrevProper, hsigmaPrevOne⟩⟩) + (z := ⟨pi, ⟨hpiProper, hpiOne⟩⟩) + hsigmaPrevStableQ hpiStable + exact choice.maximal pi w hpiProper hpiOne hpiOld hw + edge := choice.edge + edgeDefective := ⟨choice.color, hchoiceDefective, hchoiceEdgeNew⟩ + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := choice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := (Finset.mem_filter.mp hchoiceEdgeNew).2 } + +/-- Typed data construction shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperNewChoice4049.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (hpositive : (0 : ℕ) < ett.rounds) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → + (choice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) → + (sigmaPrev : PartialEdgeColoring E k) → + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev → + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color → + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color → + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev sigmaPrev → + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf + exact { + selected := sigmaPrev + selectedProper := hsigmaPrevProper + selectedOneUncolored := hsigmaPrevOne + selectedStable := hsigmaPrevSelf + vertex := choice.vertex + vertexDefective := ⟨choice.vertexDefective.1, choice.edge, + ⟨choice.color, hchoiceDefective, hchoiceEdgeNew⟩, + choice.edgeIncident⟩ + maximal := by + intro pi w hpiProper hpiOne hpiStable hw + have hpiOld : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) pi := by + exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc)).trans + (x := ⟨ett.series.data.coloring q.castSucc, + ⟨previousProper, previousOneUncolored⟩⟩) + (y := ⟨sigmaPrev, ⟨hsigmaPrevProper, hsigmaPrevOne⟩⟩) + (z := ⟨pi, ⟨hpiProper, hpiOne⟩⟩) + hsigmaPrevStableQ hpiStable + exact choice.maximal pi w hpiProper hpiOne hpiOld hw + edge := choice.edge + edgeDefective := ⟨choice.color, hchoiceDefective, hchoiceEdgeNew⟩ + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := choice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := (Finset.mem_filter.mp hchoiceEdgeNew).2 } + +/-- Typed data construction shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperAppendedChoice2713.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (hpositive : (0 : ℕ) < ett.rounds) → + (sigma : PartialEdgeColoring E k) → + (closureTree : TreeSequence G e0) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (previousProper : + IsProperEdgeColoring G + (ett.series.data.coloring q.castSucc)) → + (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) + e0) → + (choice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) → + (sigmaPrev : PartialEdgeColoring E k) → + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) → + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) → + (hsigmaPrevStableQ : + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + (ett.series.data.coloring q.castSucc) + sigmaPrev) → + (hchoiceDefective : + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color) → + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc)) + choice.color) → + (hsigmaPrevSelf : + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev sigmaPrev) → + let _ : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev := + helperNewChoice2409 G k e0 input T + generating ett hpositive previousProper + previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf; + (prefixInput : PartialEdgeColoring E k) → + (zeroPrefix : + TashkinovSeries G k (0 : ℕ) e0 + prefixInput) → + let zeroLast : + Fin ((0 : ℕ) + (1 : ℕ)) := + Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := + ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := + ({ choice.edge } : Finset E); + let newKind : + Option TashkinovExtensionKind := + some TashkinovExtensionKind.SE; + let newVertex : Option V := + some choice.vertex; + let newOutside : Option V := + some choice.otherEndpoint; + let newDelta : Option (Fin k) := + some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : + TashkinovSeriesData G k + ((0 : ℕ) + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex + newOutside newDelta newGamma; + appendedData.tree + zeroLast.succ.castSucc = + ett.series.data.tree + q.succ.castSucc → + appendedData.coloring + zeroLast.castSucc = + sigmaPrev → + TashkinovStoredColors appendedData + zeroLast.castSucc = + TashkinovStoredColors + ett.series.data q.castSucc → + MaximumDefectiveChoice G e0 + (appendedData.tree + zeroLast.succ.castSucc) + (TashkinovStoredColors + appendedData + zeroLast.castSucc) + (appendedData.coloring + zeroLast.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree q previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice prefixInput zeroPrefix zeroLast + newStored newEdges newKind newVertex newOutside newDelta newGamma appendedData happendTree + happendColor happendStored + exact { + selected := sigmaPrev + selectedProper := hsigmaPrevProper + selectedOneUncolored := hsigmaPrevOne + selectedStable := by + rw [happendTree, happendStored, happendColor] + exact newChoice.selectedStable + vertex := choice.vertex + vertexDefective := by + rw [happendTree] + exact newChoice.vertexDefective + maximal := by + intro pi w hpiProper hpiOne hpiStable hw + rw [happendTree, happendStored, happendColor] at hpiStable + rw [happendTree] at hw ⊢ + exact newChoice.maximal pi w hpiProper hpiOne hpiStable hw + edge := choice.edge + edgeDefective := by + rw [happendTree] + exact newChoice.edgeDefective + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := by + rw [happendTree] + exact newChoice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := newChoice.edgeColor } + +/-- Typed data construction shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperAppendedChoice4500.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (hpositive : (0 : ℕ) < ett.rounds) → + (sigma : PartialEdgeColoring E k) → + (closureTree : TreeSequence G e0) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (gamma : Fin k) → + (previousProper : + IsProperEdgeColoring G + (ett.series.data.coloring q.castSucc)) → + (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) + e0) → + (choice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) → + (sigmaPrev : PartialEdgeColoring E k) → + (hsigmaPrevProper : + IsProperEdgeColoring G sigmaPrev) → + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) → + (hsigmaPrevStableQ : + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + (ett.series.data.coloring q.castSucc) + sigmaPrev) → + (hchoiceDefective : + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color) → + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree + q.succ.castSucc)) + choice.color) → + (hsigmaPrevSelf : + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev sigmaPrev) → + let _ : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev := + helperNewChoice4049 G k e0 input T + generating ett hpositive + previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; + (prefixInput : PartialEdgeColoring E k) → + (zeroPrefix : + TashkinovSeries G k (0 : ℕ) e0 + prefixInput) → + let zeroLast : + Fin ((0 : ℕ) + (1 : ℕ)) := + Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := + (insert choice.color + ({ gamma } : Finset (Fin k)) : + Finset (Fin k)); + let newEdges : Finset E := + ({ choice.edge } : Finset E); + let newKind : + Option TashkinovExtensionKind := + some TashkinovExtensionKind.PE; + let newVertex : Option V := + some choice.vertex; + let newOutside : Option V := + some choice.otherEndpoint; + let newDelta : Option (Fin k) := + some choice.color; + let newGamma : Option (Fin k) := + some gamma; + let appendedData : + TashkinovSeriesData G k + ((0 : ℕ) + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma + newStored newEdges newKind + newVertex newOutside newDelta + newGamma; + appendedData.tree + zeroLast.succ.castSucc = + ett.series.data.tree + q.succ.castSucc → + appendedData.coloring + zeroLast.castSucc = + sigmaPrev → + TashkinovStoredColors appendedData + zeroLast.castSucc = + TashkinovStoredColors + ett.series.data q.castSucc → + MaximumDefectiveChoice G e0 + (appendedData.tree + zeroLast.succ.castSucc) + (TashkinovStoredColors + appendedData + zeroLast.castSucc) + (appendedData.coloring + zeroLast.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree q gamma previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice prefixInput zeroPrefix zeroLast + newStored newEdges newKind newVertex newOutside newDelta newGamma appendedData happendTree + happendColor happendStored + exact { + selected := sigmaPrev + selectedProper := hsigmaPrevProper + selectedOneUncolored := hsigmaPrevOne + selectedStable := by + rw [happendTree, happendStored, happendColor] + exact newChoice.selectedStable + vertex := choice.vertex + vertexDefective := by + rw [happendTree] + exact newChoice.vertexDefective + maximal := by + intro pi w hpiProper hpiOne hpiStable hw + rw [happendTree, happendStored, happendColor] at hpiStable + rw [happendTree] at hw ⊢ + exact newChoice.maximal pi w hpiProper hpiOne hpiStable hw + edge := choice.edge + edgeDefective := by + rw [happendTree] + exact newChoice.edgeDefective + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := by + rw [happendTree] + exact newChoice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := newChoice.edgeColor } + +/-- Typed data construction shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperReplacementETT3160.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [inst : Fintype V] → + [inst_1 : Fintype E] → + [inst_2 : DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (sigma : PartialEdgeColoring E k) → + (Tstar : TreeSequence G e0) → + TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + Tstar.length → + (closureTree : TreeSequence G e0) → + TreeSequenceInitialSegment Tstar closureTree → + (prefixInput : PartialEdgeColoring E k) → + (extendedSeries : + TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 + prefixInput) → + (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds) → + let castSeries : + {a b : ℕ} → + a = b → + TashkinovSeries G k a e0 prefixInput → + TashkinovSeries G k b e0 prefixInput := + fun {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 prefixInput) ↦ + @Eq.ndrec Nat a + (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b + e0 prefixInput) + S b h; + let finalSeries : + TashkinovSeries G k ett.rounds e0 prefixInput := + castSeries hroundsEq extendedSeries; + finalSeries.data.tree + (Fin.last (ett.rounds + (1 : ℕ))) = + closureTree → + finalSeries.data.tree + (⟨ett.rounds, + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin (ett.rounds + (2 : ℕ))) = + ett.series.data.tree + (Fin.last ett.rounds).castSucc → + finalSeries.data.coloring + (Fin.last ett.rounds) = + sigma → + ExtendedTashkinovTree G k e0 prefixInput Tstar + sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett sigma Tstar hTnTstar hstrict closureTree + hTstarClosure prefixInput extendedSeries hroundsEq castSeries finalSeries hfinalTree + hpenultimateTree hfinalColor + exact { + rounds := ett.rounds + roundsPositive := ett.roundsPositive + series := finalSeries + abovePenultimate := by rw [hpenultimateTree]; exact hTnTstar + strictAbovePenultimate := by rw [hpenultimateTree]; exact hstrict + belowFinal := by rw [hfinalTree]; exact hTstarClosure + generatingColoring := hfinalColor.symm } + +/-- Typed data construction shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperReplacementETT4947.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [inst : Fintype V] → + [inst_1 : Fintype E] → + [inst_2 : DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (hpositive : (0 : ℕ) < ett.rounds) → + (sigma : PartialEdgeColoring E k) → + (Tstar : TreeSequence G e0) → + TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + Tstar → + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + Tstar.length → + (closureTree : TreeSequence G e0) → + TreeSequenceInitialSegment Tstar closureTree → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (gamma : Fin k) → + (choice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + (ett.series.data.coloring q.castSucc)) → + (sigmaPrev : PartialEdgeColoring E k) → + let H : SimpleGraph (V ⊕ E) := + TwoColorIncidenceGraph G sigmaPrev gamma + choice.color; + (u : V) → + (p : + H.Walk (Sum.inl choice.vertex) + (Sum.inl u)) → + (prefixInput : PartialEdgeColoring E k) → + (extendedSeries : + TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) + e0 prefixInput) → + (hroundsEq : + (0 : ℕ) + (1 : ℕ) = ett.rounds) → + let castSeries : + {a b : ℕ} → + a = b → + TashkinovSeries G k a e0 + prefixInput → + TashkinovSeries G k b e0 + prefixInput := + fun {a b : ℕ} (h : a = b) + (S : + TashkinovSeries G k a e0 + prefixInput) ↦ + @Eq.ndrec Nat a + (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 + inst_2 G k b e0 prefixInput) + S b h; + let finalSeries : + TashkinovSeries G k ett.rounds e0 + prefixInput := + castSeries hroundsEq extendedSeries; + finalSeries.data.tree + (Fin.last + (ett.rounds + (1 : ℕ))) = + closureTree → + finalSeries.data.tree + (⟨ett.rounds, + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin (ett.rounds + (2 : ℕ))) = + ett.series.data.tree + (Fin.last ett.rounds).castSucc → + finalSeries.data.coloring + (Fin.last ett.rounds) = + sigma → + ExtendedTashkinovTree G k e0 + prefixInput Tstar sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar hTnTstar hstrict + closureTree hTstarClosure q gamma choice sigmaPrev H u p prefixInput extendedSeries + hroundsEq castSeries finalSeries hfinalTree hpenultimateTree hfinalColor + exact { + rounds := ett.rounds + roundsPositive := ett.roundsPositive + series := finalSeries + abovePenultimate := by rw [hpenultimateTree]; exact hTnTstar + strictAbovePenultimate := by rw [hpenultimateTree]; exact hstrict + belowFinal := by rw [hfinalTree]; exact hTstarClosure + generatingColoring := hfinalColor.symm } + +/-- Typed data construction shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperReplacementChoice3411.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (hpositive : (0 : ℕ) < ett.rounds) → + + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (previousProper : + IsProperEdgeColoring G + (ett.series.data.coloring q.castSucc)) → + (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) + e0) → + (choice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) → + (sigmaPrev : PartialEdgeColoring E k) → + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) → + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) → + (hsigmaPrevStableQ : + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + (ett.series.data.coloring q.castSucc) + sigmaPrev) → + (hchoiceDefective : + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color) → + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color) → + (hsigmaPrevSelf : + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev sigmaPrev) → + let _ : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev := + helperNewChoice2409 G k e0 input T + generating ett hpositive previousProper + previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf; + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin (ett.rounds + (1 : ℕ))))) → + (corr : + CorrespondingExtendedTashkinovTree G k + e0 originalPrefix sigmaPrev + (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) → + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigmaPrev → + let replacementLast : + Fin + (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree + replacementLast.succ = + ett.series.data.tree + q.succ.castSucc → + TashkinovStoredColors + corr.replacementSeries.data + replacementLast = + TashkinovStoredColors + ett.series.data q.castSucc → + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + replacementLast.succ) + (TashkinovStoredColors + corr.replacementSeries.data + replacementLast) + (corr.replacementSeries.data.coloring + replacementLast) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf newChoice originalPrefix corr hcorrFinalColor replacementLast + hreplacementCurrentTree hreplacementStored + exact { + selected := sigmaPrev + selectedProper := hsigmaPrevProper + selectedOneUncolored := hsigmaPrevOne + selectedStable := by + rw [hreplacementCurrentTree, hreplacementStored, hcorrFinalColor] + exact newChoice.selectedStable + vertex := choice.vertex + vertexDefective := by + rw [hreplacementCurrentTree] + exact newChoice.vertexDefective + maximal := by + intro pi w hpiProper hpiOne hpiStable hw + rw [hreplacementCurrentTree, hreplacementStored, hcorrFinalColor] + at hpiStable + rw [hreplacementCurrentTree] at hw ⊢ + exact newChoice.maximal pi w hpiProper hpiOne hpiStable hw + edge := choice.edge + edgeDefective := by + rw [hreplacementCurrentTree] + exact newChoice.edgeDefective + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := by + rw [hreplacementCurrentTree] + exact newChoice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := newChoice.edgeColor } + +/-- Typed data construction shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +noncomputable abbrev helperReplacementChoice5196.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (hpositive : (0 : ℕ) < ett.rounds) → + + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (previousProper : + IsProperEdgeColoring G + (ett.series.data.coloring q.castSucc)) → + (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) + e0) → + (choice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) → + (sigmaPrev : PartialEdgeColoring E k) → + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) → + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) → + (hsigmaPrevStableQ : + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + (ett.series.data.coloring q.castSucc) + sigmaPrev) → + (hchoiceDefective : + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color) → + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color) → + (hsigmaPrevSelf : + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev sigmaPrev) → + let _ : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev := + helperNewChoice4049 G k e0 input T + generating ett hpositive previousProper + previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf; + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin (ett.rounds + (1 : ℕ))))) → + (corr : + CorrespondingExtendedTashkinovTree G k + e0 originalPrefix sigmaPrev + (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) → + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigmaPrev → + let replacementLast : + Fin + (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree + replacementLast.succ = + ett.series.data.tree + q.succ.castSucc → + TashkinovStoredColors + corr.replacementSeries.data + replacementLast = + TashkinovStoredColors + ett.series.data q.castSucc → + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + replacementLast.succ) + (TashkinovStoredColors + corr.replacementSeries.data + replacementLast) + (corr.replacementSeries.data.coloring + replacementLast) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf newChoice originalPrefix corr hcorrFinalColor replacementLast + hreplacementCurrentTree hreplacementStored + exact { + selected := sigmaPrev + selectedProper := hsigmaPrevProper + selectedOneUncolored := hsigmaPrevOne + selectedStable := by + rw [hreplacementCurrentTree, hreplacementStored, hcorrFinalColor] + exact newChoice.selectedStable + vertex := choice.vertex + vertexDefective := by + rw [hreplacementCurrentTree] + exact newChoice.vertexDefective + maximal := by + intro pi w hpiProper hpiOne hpiStable hw + rw [hreplacementCurrentTree, hreplacementStored, hcorrFinalColor] + at hpiStable + rw [hreplacementCurrentTree] at hw ⊢ + exact newChoice.maximal pi w hpiProper hpiOne hpiStable hw + edge := choice.edge + edgeDefective := by + rw [hreplacementCurrentTree] + exact newChoice.edgeDefective + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := by + rw [hreplacementCurrentTree] + exact newChoice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := newChoice.edgeColor } + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperHseriesColorProperties3585Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + ∀ (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.coloring zeroLast.castSucc = sigmaPrev → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let _ : Fin (ett.rounds + (1 : ℕ)) → Fin (2 : ℕ) := fun (i : Fin (ett.rounds + (1 : ℕ))) ↦ + Fin.cast ( + by omega + ) i; finalSeries.data.coloring (Fin.last ett.rounds) = sigma → + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ + IsOneEdgeUncolored (finalSeries.data.coloring i) e0 + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch4454Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), (0 : ℕ) < originalPrefix.rounds → + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.stored i = S.data.stored (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.kind i = S.data.kind (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let _ : Fin (ett.rounds + (1 : ℕ)) → Fin (originalPrefix.rounds + (2 : ℕ)) := fun (i : Fin + (ett.rounds + (1 : ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (↑i : ℕ) < ett.rounds → finalSeries.data.stored i = + ett.series.data.stored i ∧ finalSeries.data.connectingEdges i = + ett.series.data.connectingEdges i ∧ finalSeries.data.kind i = ett.series.data.kind i + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch4512Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = ({ choice.color } : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.SE → + ∀ (sigmaPrev : PartialEdgeColoring E k), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), (0 : ℕ) < originalPrefix.rounds → + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.stored i = S.data.stored (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.kind i = S.data.kind (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let _ : Fin (ett.rounds + (1 : ℕ)) → Fin (originalPrefix.rounds + (2 : ℕ)) := fun (i : Fin + (ett.rounds + (1 : ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; + ∀ (i : Fin (ett.rounds + (1 : ℕ))), ¬(↑i : ℕ) < ett.rounds → finalSeries.data.stored i = + ett.series.data.stored i ∧ finalSeries.data.connectingEdges i = + ett.series.data.connectingEdges i ∧ finalSeries.data.kind i = ett.series.data.kind i + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperHseriesStable4663Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma → + ∀ (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), (0 : ℕ) < originalPrefix.rounds → + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; finalSeries.data.coloring (Fin.last ett.rounds) = sigma → + let _ : Fin (ett.rounds + (1 : ℕ)) → Fin (originalPrefix.rounds + (2 : ℕ)) := fun (i : Fin + (ett.rounds + (1 : ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; + ∀ (i : Fin ett.rounds), StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (finalSeries.data.coloring i.succ) + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch5026Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → IsOneEdgeUncolored secondStable e0 → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + StableColoring (ett.series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) choice.selected + secondStable → ett.series.data.coloring q.succ = TwoColorComponentSwap G secondStable + gamma choice.color (Sum.inl choice.vertex) → ( + ∀ (w : V), gamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G + secondStable w → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k + secondStable gamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q))) + (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) q)) (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) q)) choice)) (@Sum.inl V E w) (@Subtype.fintype (Sum + V E) (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable gamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) + (@Fin.succ (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) q))) (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T + generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) q)) (@TashkinovSeriesData.coloring V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q)) + choice)) (@Sum.inl V E w))) (fun (a : Sum V E) ↦ @SimpleGraph.neighborSet.memDecidable + (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable gamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) + (@Fin.succ (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) q))) (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T + generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) q)) (@TashkinovSeriesData.coloring V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q)) + choice)) (@Sum.inl V E w) (fun (a b : Sum V E) ↦ Classical.propDecidable (@SimpleGraph.Adj + (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable gamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) + (@Fin.succ (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) q))) (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T + generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) q)) (@TashkinovSeriesData.coloring V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q)) + choice)) a b)) a) (@instFintypeSum V E inst inst_1)) ≤ (1 : ℕ)) → + ∀ (u : V) (path : (TwoColorIncidenceGraph G secondStable gamma choice.color).Walk (Sum.inl u) + (Sum.inl choice.vertex)), ( + ∀ (x : V ⊕ E), @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable + gamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E + G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E + inst inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series + V E inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat + Nat (@instHAdd Nat instAddNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) + (@Fin.succ (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) q))) (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T + generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) q)) (@TashkinovSeriesData.coloring V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q)) + choice)) x (@Fintype.ofFinite (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable gamma (@MaximumDefectiveChoice.color V E + inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E + inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q))) + (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) q)) (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) q)) choice)) x)) (@Subtype.finite (Sum V E) + (@Finite.instSum V E (@Finite.of_fintype V inst) (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable gamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) + (@Fin.succ (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) q))) (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T + generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) q)) (@TashkinovSeriesData.coloring V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q)) + choice)) x)))) ≤ (2 : ℕ)) → ( + ∀ x ∈ path.support, + ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G secondStable gamma choice.color).Adj x y → y ∈ + path.support) → ( + ∀ y ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex), y ∈ + path.support) → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex) → secondStable e = some gamma ∨ secondStable e = some choice.color) → + secondStable choice.edge = some choice.color → ( + ∀ (e : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → e = + choice.edge) → ( + ∀ (e : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → e = choice.edge) → + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex); TreeMissingColors secondStable (ett.series.data.tree + q.succ.castSucc) = TreeMissingColors choice.selected (ett.series.data.tree + q.succ.castSucc) → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → + sigma e = some gamma ∨ sigma e = some choice.color) → choice.color ∈ MissingColors G sigma + choice.vertex → ( + ∀ c ∈ TreeMissingColors choice.selected (ett.series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)), c ∈ + TreeMissingColors (ett.series.data.coloring q.succ) (ett.series.data.tree q.succ.castSucc) + ∪ TashkinovStoredColors ett.series.data q.succ) → gamma ∈ TreeMissingColors + choice.selected (ett.series.data.tree q.succ.castSucc) ∪ (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) → + ∀ (f : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) f → ( + ∃ c ∈ TreeMissingColors secondStable (ett.series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)), + secondStable f = some c) → undone f = secondStable f + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch5085Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + ∀ (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)), ett.series.data.coloring q.succ = + TwoColorComponentSwap G secondStable gamma choice.color (Sum.inl choice.vertex) → + IsProperEdgeColoring G (ett.series.data.coloring q.succ) → IsOneEdgeUncolored + (ett.series.data.coloring q.succ) e0 → ( + ∀ (w : V), gamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G + secondStable w → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k + secondStable gamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q))) + (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) q)) (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) q)) choice)) (@Sum.inl V E w) (@Subtype.fintype (Sum + V E) (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable gamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) + (@Fin.succ (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) q))) (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T + generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) q)) (@TashkinovSeriesData.coloring V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q)) + choice)) (@Sum.inl V E w))) (fun (a : Sum V E) ↦ @SimpleGraph.neighborSet.memDecidable + (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable gamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) + (@Fin.succ (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) q))) (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T + generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) q)) (@TashkinovSeriesData.coloring V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q)) + choice)) (@Sum.inl V E w) (fun (a b : Sum V E) ↦ Classical.propDecidable (@SimpleGraph.Adj + (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable gamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) + (@Fin.succ (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) q))) (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T + generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) q)) (@TashkinovSeriesData.coloring V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q)) + choice)) a b)) a) (@instFintypeSum V E inst inst_1)) ≤ (1 : ℕ)) → + ∀ (u : V) (path : (TwoColorIncidenceGraph G secondStable gamma choice.color).Walk (Sum.inl u) + (Sum.inl choice.vertex)), ( + ∀ (x : V ⊕ E), @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable + gamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E + G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E + inst inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series + V E inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat + Nat (@instHAdd Nat instAddNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) + (@Fin.succ (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) q))) (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T + generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) q)) (@TashkinovSeriesData.coloring V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q)) + choice)) x (@Fintype.ofFinite (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) + (@TwoColorIncidenceGraph V E G k secondStable gamma (@MaximumDefectiveChoice.color V E + inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E + inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q))) + (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) q)) (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) q)) choice)) x)) (@Subtype.finite (Sum V E) + (@Finite.instSum V E (@Finite.of_fintype V inst) (@Finite.of_fintype E inst_1)) + (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) + (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable gamma + (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat + (@instHAdd Nat instAddNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) + (@Fin.succ (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) q))) (@TashkinovStoredColors V E inst_1 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 + inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating + ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T + generating ett)) (@Fin.castSucc (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k + e0 input T generating ett) q)) (@TashkinovSeriesData.coloring V E G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + (@TashkinovSeries.data V E inst inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst + inst_1 inst_2 G k e0 input T generating ett) e0 input (@ExtendedTashkinovTree.series V E + inst inst_1 inst_2 G k e0 input T generating ett)) (@Fin.castSucc + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) q)) + choice)) x)))) ≤ (2 : ℕ)) → ( + ∀ x ∈ path.support, + ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G secondStable gamma choice.color).Adj x y → y ∈ + path.support) → ( + ∀ y ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex), y ∈ + path.support) → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex) → secondStable e = some gamma ∨ secondStable e = some choice.color) → + secondStable choice.edge = some choice.color → ( + ∀ (e : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → e = + choice.edge) → ( + ∀ (e : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → e = choice.edge) → + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex); TreeMissingColors secondStable (ett.series.data.tree + q.succ.castSucc) = TreeMissingColors choice.selected (ett.series.data.tree + q.succ.castSucc) → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → + sigma e = some gamma ∨ sigma e = some choice.color) → choice.color ∈ MissingColors G sigma + choice.vertex → ( + ∀ c ∈ TreeMissingColors choice.selected (ett.series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)), c ∈ + TreeMissingColors (ett.series.data.coloring q.succ) (ett.series.data.tree q.succ.castSucc) + ∪ TashkinovStoredColors ett.series.data q.succ) → gamma ∈ TreeMissingColors + choice.selected (ett.series.data.tree q.succ.castSucc) ∪ (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) → + ∀ (f : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) f → ( + ∃ c ∈ TreeMissingColors secondStable (ett.series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)), undone + f = some c) → undone f = secondStable f + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch6743Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), (0 : ℕ) < originalPrefix.rounds → + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.stored i = S.data.stored (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.kind i = S.data.kind (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let _ : Fin (ett.rounds + (1 : ℕ)) → Fin (originalPrefix.rounds + (2 : ℕ)) := fun (i : Fin + (ett.rounds + (1 : ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (↑i : ℕ) < ett.rounds → finalSeries.data.stored i = + ett.series.data.stored i ∧ finalSeries.data.connectingEdges i = + ett.series.data.connectingEdges i ∧ finalSeries.data.kind i = ett.series.data.kind i + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch6801Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)) → ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∀ (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), (0 : ℕ) < originalPrefix.rounds → + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.stored i = S.data.stored (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.kind i = S.data.kind (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let _ : Fin (ett.rounds + (1 : ℕ)) → Fin (originalPrefix.rounds + (2 : ℕ)) := fun (i : Fin + (ett.rounds + (1 : ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; + ∀ (i : Fin (ett.rounds + (1 : ℕ))), ¬(↑i : ℕ) < ett.rounds → finalSeries.data.stored i = + ett.series.data.stored i ∧ finalSeries.data.connectingEdges i = + ett.series.data.connectingEdges i ∧ finalSeries.data.kind i = ett.series.data.kind i + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperHseriesStable6952Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma → + ∀ (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), (0 : ℕ) < originalPrefix.rounds → + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; finalSeries.data.coloring (Fin.last ett.rounds) = sigma → + let _ : Fin (ett.rounds + (1 : ℕ)) → Fin (originalPrefix.rounds + (2 : ℕ)) := fun (i : Fin + (ett.rounds + (1 : ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; + ∀ (i : Fin ett.rounds), StableColoring (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) + (finalSeries.data.coloring i.succ) + +theorem helper_hTnClosure_112.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + ∀ (closureTree : TreeSequence G e0), + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree := by + classical + intro V E _ _ _ G k e0 input T generating ett Tstar hTnTstar closureTree hTstarClosure + rcases hTnTstar with ⟨hlenAB, hvertexAB, hedgeAB⟩ + rcases hTstarClosure with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨Nat.le_trans hlenAB hlenBC, ?_, ?_⟩ + · intro j + calc + closureTree.vertex + (Fin.castLE (Nat.succ_le_succ (Nat.le_trans hlenAB hlenBC)) j) = + closureTree.vertex + (Fin.castLE (Nat.succ_le_succ hlenBC) + (Fin.castLE (Nat.succ_le_succ hlenAB) j)) := by congr 1 + _ = Tstar.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) j) := + hvertexBC _ + _ = (ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex j := + hvertexAB j + · intro j + calc + closureTree.edge (Fin.castLE (Nat.le_trans hlenAB hlenBC) j) = + closureTree.edge (Fin.castLE hlenBC (Fin.castLE hlenAB j)) := by + congr 1 + _ = Tstar.edge (Fin.castLE hlenAB j) := hedgeBC _ + _ = (ett.series.data.tree (Fin.last ett.rounds).castSucc).edge j := + hedgeAB j + +theorem helper_hdeltaBoundary_254.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) + choice.selected sigmaPrev → BoundaryColorEdges G choice.selected (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color = BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevEnlarged + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + constructor + · rintro ⟨hf, hfc⟩ + refine ⟨hf, ?_⟩ + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have hinc : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + refine ⟨x, hx, ?_⟩ + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + exact (hsigmaPrevEnlarged.1 f hinc + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), hfc⟩).trans hfc + · rintro ⟨hf, hfc⟩ + refine ⟨hf, ?_⟩ + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have hinc : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + refine ⟨x, hx, ?_⟩ + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + have hcriterion := (sc1 G e0 + (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected sigmaPrev choice.selectedProper + choice.selectedOneUncolored hsigmaPrevProper hsigmaPrevOne).mp + hsigmaPrevEnlarged + exact (hcriterion f hinc (Or.inr + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), hfc⟩)).symm.trans hfc + +theorem helper_hclosedPrev_356.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) → + ∀ (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → IsOneEdgeUncolored + sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev → ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper + previousOneUncolored previousClosed sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + f c v hf hv hsf hcm + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have hinc : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + refine ⟨x, hx, ?_⟩ + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + have hmissingEq := hsigmaPrevStableQ.2 v hv + have hcTree : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, hmissingEq ▸ hcm⟩ + have hcriterion := (sc1 G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev previousProper + previousOneUncolored hsigmaPrevProper hsigmaPrevOne).mp + hsigmaPrevStableQ + have hcopy := hcriterion f hinc + (Or.inr ⟨c, Finset.mem_union_left _ hcTree, hsf⟩) + have holdf : ett.series.data.coloring q.castSucc f = some c := + hcopy.symm.trans hsf + exact previousClosed hf hv holdf (hmissingEq ▸ hcm) + +theorem helper_hpenultimateTree_713.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc + → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawTreeIndex : Fin (ett.rounds + (2 : ℕ)) → Fin (3 : ℕ) := fun (i : Fin (ett.rounds + (2 : + ℕ))) ↦ Fin.cast ( + by omega + ) i; rawTreeIndex (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = zeroLast.succ.castSucc → finalSeries.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc choice + prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData happendTree extendedSeries hextendedData hroundsEq castSeries + castSeriesTree finalSeries rawTreeIndex hrawPenultimate + calc + finalSeries.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + extendedSeries.data.tree + (rawTreeIndex + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2))) := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree + (rawTreeIndex + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2))) := by + rw [hextendedData] + _ = appendedData.tree zeroLast.succ.castSucc := by + rw [hrawPenultimate] + _ = ett.series.data.tree q.succ.castSucc := happendTree + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rw [hqSucc] + +theorem helper_hprefixFields_744.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), (0 : ℕ) < ett.rounds → + ∀ (_ _ : TreeSequence G e0), ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); (0 : ℕ) + (1 : ℕ) = ett.rounds → + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (↑i : ℕ) < ett.rounds → zeroPrefix.data.stored zeroLast = + ett.series.data.stored i ∧ zeroPrefix.data.connectingEdges zeroLast = + ett.series.data.connectingEdges i ∧ zeroPrefix.data.kind zeroLast = ett.series.data.kind i + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ closureTree hroundOne prefixInput + zeroPrefix zeroLast hroundsEq i hi + have hiZero : i.val = 0 := by + have hr := hroundOne + omega + have hiEq : i = 0 := Fin.ext hiZero + subst i + have hold := zeroPrefix.certified 0 + have hnew := ett.series.certified 0 + cases hold with + | initial triple0 seedLength0 initialColoring0 initialStored0 + initialEdges0 initialKind0 initialVertex0 initialOutside0 + initialDelta0 initialGamma0 initialClosure0 => + cases hnew with + | initial triple1 seedLength1 initialColoring1 initialStored1 + initialEdges1 initialKind1 initialVertex1 initialOutside1 + initialDelta1 initialGamma1 initialClosure1 => + exact ⟨by simpa [zeroLast] using + initialStored0.trans initialStored1.symm, + by simpa [zeroLast] using + initialEdges0.trans initialEdges1.symm, + by simpa [zeroLast] using + initialKind0.trans initialKind1.symm⟩ + +theorem helper_hseriesDataAgree_772.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = ({ choice.color } : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.SE → ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.stored (Fin.last (1 : ℕ)) = newStored → + appendedData.connectingEdges (Fin.last (1 : ℕ)) = newEdges → appendedData.kind (Fin.last + (1 : ℕ)) = newKind → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.stored i = S.data.stored (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.kind i = S.data.kind (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawDataIndex : Fin (ett.rounds + (1 : ℕ)) → Fin (2 : ℕ) := fun (i : Fin (ett.rounds + (1 : + ℕ))) ↦ Fin.cast ( + by omega + ) i; rawDataIndex (Fin.last ett.rounds) = Fin.last (1 : ℕ) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (↑i : ℕ) < ett.rounds → zeroPrefix.data.stored zeroLast = + ett.series.data.stored i ∧ zeroPrefix.data.connectingEdges zeroLast = + ett.series.data.connectingEdges i ∧ zeroPrefix.data.kind zeroLast = ett.series.data.kind + i) → + ∀ (i : Fin (ett.rounds + (1 : ℕ))), finalSeries.data.stored i = ett.series.data.stored i ∧ + finalSeries.data.connectingEdges i = ett.series.data.connectingEdges i ∧ + finalSeries.data.kind i = ett.series.data.kind i := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc choice + currentStored currentEdges currentKind hroundOne prefixInput zeroPrefix zeroLast newStored + newEdges newKind newVertex newOutside newDelta newGamma appendedData happendLastStored + happendLastEdges happendLastKind extendedSeries hextendedData hroundsEq castSeries + castSeriesStored castSeriesEdges castSeriesKind finalSeries rawDataIndex hrawFinalData + hprefixFields i + by_cases hi : i.val < ett.rounds + · have hraw : rawDataIndex i = zeroLast.castSucc := by + apply Fin.ext + have hiZero : i.val = 0 := by + have hr := hroundOne + omega + exact hiZero + have hp := hprefixFields i hi + constructor + · calc + finalSeries.data.stored i = + extendedSeries.data.stored (rawDataIndex i) := by + exact castSeriesStored hroundsEq extendedSeries i + _ = appendedData.stored (rawDataIndex i) := by + rw [hextendedData] + _ = zeroPrefix.data.stored zeroLast := by + rw [hraw] + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + _ = ett.series.data.stored i := hp.1 + · constructor + · calc + finalSeries.data.connectingEdges i = + extendedSeries.data.connectingEdges + (rawDataIndex i) := by + exact castSeriesEdges hroundsEq extendedSeries i + _ = appendedData.connectingEdges (rawDataIndex i) := by + rw [hextendedData] + _ = zeroPrefix.data.connectingEdges zeroLast := by + rw [hraw] + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + _ = ett.series.data.connectingEdges i := hp.2.1 + · calc + finalSeries.data.kind i = + extendedSeries.data.kind (rawDataIndex i) := by + exact castSeriesKind hroundsEq extendedSeries i + _ = appendedData.kind (rawDataIndex i) := by + rw [hextendedData] + _ = zeroPrefix.data.kind zeroLast := by + rw [hraw] + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + _ = ett.series.data.kind i := hp.2.2 + · have hilast : i = Fin.last ett.rounds := by + apply Fin.ext + have hibound := i.isLt + simp + omega + subst i + constructor + · calc + finalSeries.data.stored (Fin.last ett.rounds) = + extendedSeries.data.stored + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesStored hroundsEq extendedSeries _ + _ = appendedData.stored + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = appendedData.stored (Fin.last 1) := by rw [hrawFinalData] + _ = newStored := happendLastStored + _ = {choice.color} := rfl + _ = ett.series.data.stored (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentStored.symm + · constructor + · calc + finalSeries.data.connectingEdges (Fin.last ett.rounds) = + extendedSeries.data.connectingEdges + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesEdges hroundsEq extendedSeries _ + _ = appendedData.connectingEdges + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = appendedData.connectingEdges (Fin.last 1) := by + rw [hrawFinalData] + _ = newEdges := happendLastEdges + _ = {choice.edge} := rfl + _ = ett.series.data.connectingEdges + (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentEdges.symm + · calc + finalSeries.data.kind (Fin.last ett.rounds) = + extendedSeries.data.kind + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesKind hroundsEq extendedSeries _ + _ = appendedData.kind + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = appendedData.kind (Fin.last 1) := by rw [hrawFinalData] + _ = newKind := happendLastKind + _ = some TashkinovExtensionKind.SE := rfl + _ = ett.series.data.kind (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentKind.symm + +theorem helper_hseriesTreeAgree_874.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc + → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let _ : Fin (ett.rounds + (2 : ℕ)) → Fin (3 : ℕ) := fun (i : Fin (ett.rounds + (2 : ℕ))) ↦ + Fin.cast ( + by omega + ) i; + ∀ (j : Fin ett.rounds), finalSeries.data.tree j.succ.castSucc = ett.series.data.tree + j.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc choice + hroundOne prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside + newDelta newGamma appendedData happendTree extendedSeries hextendedData hroundsEq + castSeries castSeriesTree finalSeries rawTreeIndex j + have hj : j.succ = Fin.last ett.rounds := by + apply Fin.ext + have hjbound := j.isLt + simp + have hr := hroundOne + omega + have htreeIndex : rawTreeIndex j.succ.castSucc = + zeroLast.succ.castSucc := by + apply Fin.ext + simp [rawTreeIndex, zeroLast] + calc + finalSeries.data.tree j.succ.castSucc = + extendedSeries.data.tree (rawTreeIndex j.succ.castSucc) := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree (rawTreeIndex j.succ.castSucc) := by + rw [hextendedData] + _ = appendedData.tree zeroLast.succ.castSucc := by rw [htreeIndex] + _ = ett.series.data.tree q.succ.castSucc := happendTree + _ = ett.series.data.tree j.succ.castSucc := by + rw [hj, hqSucc] + +theorem helper_hseriesColorProperties_898.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + ∀ (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.coloring zeroLast.castSucc = sigmaPrev → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let _ : Fin (ett.rounds + (1 : ℕ)) → Fin (2 : ℕ) := fun (i : Fin (ett.rounds + (1 : ℕ))) ↦ + Fin.cast ( + by omega + ) i; finalSeries.data.coloring (Fin.last ett.rounds) = sigma → + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ + IsOneEdgeUncolored (finalSeries.data.coloring i) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne _ + closureTree q choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hroundOne prefixInput + zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendColor extendedSeries hextendedData hroundsEq castSeries + castSeriesColoring finalSeries rawDataIndex hfinalColor i + by_cases hi : i.val < ett.rounds + · have hraw : rawDataIndex i = zeroLast.castSucc := by + apply Fin.ext + have hiZero : i.val = 0 := by + have hr := hroundOne + omega + exact hiZero + have hcolor : finalSeries.data.coloring i = sigmaPrev := by + calc + finalSeries.data.coloring i = + extendedSeries.data.coloring (rawDataIndex i) := by + exact castSeriesColoring hroundsEq extendedSeries i + _ = appendedData.coloring (rawDataIndex i) := by + rw [hextendedData] + _ = appendedData.coloring zeroLast.castSucc := by rw [hraw] + _ = sigmaPrev := happendColor + rw [hcolor] + exact ⟨hsigmaPrevProper, hsigmaPrevOne⟩ + · have hilast : i = Fin.last ett.rounds := by + apply Fin.ext + have hibound := i.isLt + simp + omega + subst i + rw [hfinalColor] + exact ⟨hsigmaProper, hsigmaOne⟩ + +theorem helper_hdegree_1837.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (w : V), gamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G + secondStable w → (TwoColorIncidenceGraph G secondStable gamma choice.color).degree + (Sum.inl w) ≤ (1 : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma secondStable + secondStableProper choice w hw + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro y hy z hz + simp only [SimpleGraph.mem_neighborFinset] at hy hz + cases y with + | inl y => simp [TwoColorIncidenceGraph] at hy + | inr e => + cases z with + | inl z => simp [TwoColorIncidenceGraph] at hz + | inr f => + simp only [TwoColorIncidenceGraph] at hy hz + rcases hw with hw | hw + · have he : secondStable e = some choice.color := + hy.2.resolve_left (by + intro he + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hy.1, he⟩) + have hf : secondStable f = some choice.color := + hz.2.resolve_left (by + intro hf + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hz.1, hf⟩) + by_cases h : e = f + · exact congrArg Sum.inr h + · exact (secondStableProper h ⟨w, hy.1, hz.1⟩ he hf).elim + · have he : secondStable e = some gamma := + hy.2.resolve_right (by + intro he + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hy.1, he⟩) + have hf : secondStable f = some gamma := + hz.2.resolve_right (by + intro hf + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hz.1, hf⟩) + by_cases h : e = f + · exact congrArg Sum.inr h + · exact (secondStableProper h ⟨w, hy.1, hz.1⟩ he hf).elim + +theorem helper_hclosed_1893.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)), gamma ∈ MissingColors G secondStable + choice.vertex → ( + ∀ (w : V), gamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G + secondStable w → (TwoColorIncidenceGraph G secondStable gamma choice.color).degree + (Sum.inl w) ≤ (1 : ℕ)) → + ∀ (u : V) (path : (TwoColorIncidenceGraph G secondStable gamma choice.color).Walk (Sum.inl u) + (Sum.inl choice.vertex)), path.IsPath → (2 : ℕ) ≤ path.length → ( + ∀ (x : V ⊕ E), (TwoColorIncidenceGraph G secondStable gamma choice.color).degree x ≤ (2 : ℕ)) + → (TwoColorIncidenceGraph G secondStable gamma choice.color).degree (Sum.inl u) ≤ (1 : ℕ) + → + ∀ x ∈ path.support, + ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G secondStable gamma choice.color).Adj x y → y ∈ + path.support := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma secondStable choice hmissing + hdegree u path pathIs pathLen hdegreeBound huDegree x hx y hxy + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hx + by_cases hn0 : n = 0 + · subst n + have hx0 : x = Sum.inl u := by simpa using hn.symm + let graph := TwoColorIncidenceGraph G secondStable gamma choice.color + let : Fintype (graph.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (graph.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert huDegree using 1 + cases hx0 + exact congrArg (fun z => @SimpleGraph.degree _ graph (Sum.inl u) z) + (Subsingleton.elim _ _) + have hy' : y ∈ graph.neighborSet x := by simpa [graph, SimpleGraph.mem_neighborSet] using hxy + have hn' : path.getVert 1 ∈ graph.neighborSet x := by + simpa [graph, hx0, SimpleGraph.mem_neighborSet] using + path.adj_getVert_succ (show 0 < path.length by omega) + have heq := Fintype.card_le_one_iff.mp card ⟨y, hy'⟩ ⟨path.getVert 1, hn'⟩ + have hey : y = path.getVert 1 := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support 1 + by_cases hlast : n = path.length + · have hx1 : x = Sum.inl choice.vertex := by + rw [← hn, pathIs.getVert_eq_end_iff hnle] + exact hlast + let graph := TwoColorIncidenceGraph G secondStable gamma choice.color + let : Fintype (graph.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (graph.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert hdegree choice.vertex (Or.inl hmissing) using 1 + cases hx1 + exact congrArg (fun z => @SimpleGraph.degree _ graph (Sum.inl choice.vertex) z) + (Subsingleton.elim _ _) + have hy' : y ∈ graph.neighborSet x := by simpa [graph, SimpleGraph.mem_neighborSet] using hxy + have hp : path.getVert (path.length - 1) ∈ graph.neighborSet x := by + have ha : graph.Adj (Sum.inl choice.vertex) (path.getVert (path.length - 1)) := by + simpa [graph, show path.length - 1 + 1 = path.length by omega] using + (path.adj_getVert_succ (show path.length - 1 < path.length by omega)).symm + simpa [hx1, SimpleGraph.mem_neighborSet] using ha + have heq := Fintype.card_le_one_iff.mp card ⟨y, hy'⟩ ⟨path.getVert (path.length - 1), hp⟩ + have hey : y = path.getVert (path.length - 1) := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support _ + have hl : (TwoColorIncidenceGraph G secondStable gamma choice.color).Adj + (path.getVert n) (path.getVert (n - 1)) := by + rw [← show n - 1 + 1 = n by omega] + exact (path.adj_getVert_succ (by omega)).symm + have hnlt : n < path.length := lt_of_le_of_ne hnle hlast + have hr := path.adj_getVert_succ hnlt + by_contra hyout + rw [← hn] at hxy + have hnl : path.getVert (n - 1) ≠ y := by + intro h; apply hyout; rw [← h]; exact path.getVert_mem_support _ + have hnr : path.getVert (n + 1) ≠ y := by + intro h; apply hyout; rw [← h]; exact path.getVert_mem_support _ + have hnp : path.getVert (n - 1) ≠ path.getVert (n + 1) := by + intro h + have hi := pathIs.getVert_injOn (show n - 1 ≤ path.length by omega) + (show n + 1 ≤ path.length by omega) h + omega + let graph := TwoColorIncidenceGraph G secondStable gamma choice.color + let : Fintype (graph.neighborSet (path.getVert n)) := Fintype.ofFinite _ + have three : 3 ≤ graph.degree (path.getVert n) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset _ := {y, path.getVert (n - 1), path.getVert (n + 1)} + have hs : s ⊆ graph.neighborFinset (path.getVert n) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [graph, SimpleGraph.mem_neighborFinset] using hxy + · simpa [graph, SimpleGraph.mem_neighborFinset] using hl + · simpa [graph, SimpleGraph.mem_neighborFinset] using hr + have hc : 3 ≤ s.card := by simp [s, hnp, hnl.symm, hnr.symm] + exact hc.trans (Finset.card_le_card hs) + have upper : graph.degree (path.getVert n) ≤ 2 := by + simpa only [← SimpleGraph.card_neighborSet_eq_degree, Fintype.card_eq_nat_card] using + hdegreeBound (path.getVert n) + omega + +theorem helper_htreeEdge_2018.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + gamma ∈ MissingColors G secondStable choice.vertex → + ∀ (u : V) (path : (TwoColorIncidenceGraph G secondStable gamma choice.color).Walk (Sum.inl u) + (Sum.inl choice.vertex)), ((gamma ∈ MissingColors G secondStable u ∨ choice.color ∈ + MissingColors G secondStable u) ∧ + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), Sum.inl w ∈ path.support ↔ + w = choice.vertex) → ( + ∀ y ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex), y ∈ + path.support) → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex) → secondStable e = some gamma ∨ secondStable e = some choice.color) → + secondStable choice.edge = some choice.color → + ∀ (e : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → e = + choice.edge := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma secondStable + secondStableProper choice hmissing u path endOnly hpathComponent hcompEdge hchoiceSecond e + heT heC + rcases heT with ⟨w, hw, hwe⟩ + have hwC : Sum.inl w ∈ TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + have hadj : (TwoColorIncidenceGraph G secondStable gamma choice.color).Adj + (Sum.inl w) (Sum.inr e) := by + simp [TwoColorIncidenceGraph, hwe, hcompEdge e heC] + change (TwoColorIncidenceGraph G secondStable gamma choice.color).connectedComponentMk + (Sum.inl w) = _ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans heC + have hwv : w = choice.vertex := (endOnly.2 w hw).mp (hpathComponent _ hwC) + subst w + rcases hcompEdge e heC with hec | hec + · have hnot : secondStable e ≠ some gamma := by + intro heq + have hp : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, heq⟩ + have hm : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + exact hm hp + exact (hnot hec).elim + · by_contra hne + exact (secondStableProper hne ⟨choice.vertex, hwe, choice.edgeIncident⟩ hec + hchoiceSecond).elim + +theorem helper_hsigmaEdge_2047.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → + ∀ (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.coloring q.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) → ett.series.data.stored q.succ = (insert choice.color ({ gamma } + : Finset (Fin k)) : Finset (Fin k)) → choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex) + → gamma ∈ MissingColors G secondStable choice.vertex → + ∀ (_ : V), ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex) → secondStable e = some gamma ∨ secondStable e = some choice.color) → + secondStable choice.edge = some choice.color → gamma ≠ choice.color → Sum.inr choice.edge + ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → + ∀ (e : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → e = choice.edge := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper _ q + hsigmaStableQ gamma secondStable secondStableProper choice currentColoring currentStored + hchoiceVertex hcomponent hmissing u hcompEdge hchoiceSecond hneq hfcomponent e heT heC + rcases heT with ⟨w, hw, hwe⟩ + have hgamma : sigma choice.edge = some gamma := by + have hsc := hsigmaStableQ.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + have hctrl : ∃ c ∈ TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) ∪ TashkinovStoredColors ett.series.data q.succ, + ett.series.data.coloring q.succ choice.edge = some c := by + refine ⟨gamma, ?_, ?_⟩ + · by_cases hm : gamma ∈ TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) + · exact Finset.mem_union.mpr (Or.inl hm) + · apply Finset.mem_union.mpr + right + unfold TashkinovStoredColors + rw [ite_eq_right (by simp)] + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · refine ⟨q.succ, ?_, ?_⟩ + · simp + · simp [currentStored] + · simpa using hm + · rw [currentColoring] + simp [TwoColorComponentSwap, hfcomponent, hchoiceSecond] + exact (hsc hctrl).trans (by + rw [currentColoring] + simp [TwoColorComponentSwap, hfcomponent, hchoiceSecond]) + have hecol : sigma e = some gamma ∨ sigma e = some choice.color := by + have hs : Sum.inr e ∈ + (TwoColorIncidenceGraph G sigma gamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G sigma gamma choice.color) + (u := Sum.inr e) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp heC + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G sigma gamma choice.color).mem_support.mp hs + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + have hwC : Sum.inl w ∈ TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) := by + have hadj : (TwoColorIncidenceGraph G sigma gamma choice.color).Adj + (Sum.inl w) (Sum.inr e) := by + simp [TwoColorIncidenceGraph, hwe, hecol] + change (TwoColorIncidenceGraph G sigma gamma choice.color).connectedComponentMk + (Sum.inl w) = _ + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans heC + have hwv := (hcomponent w hw).mp hwC + subst w + rcases hecol with hec | hec + · have hp : gamma ∈ PresentColors G sigma choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, hec⟩ + by_contra hne + exact (hsigmaProper hne ⟨choice.vertex, hwe, choice.edgeIncident⟩ hec hgamma).elim + · by_contra hne + have hcolor : sigma e = some choice.color := hec + have hmissColor : choice.color ∈ MissingColors G sigma choice.vertex := by + rw [hsigmaStableQ.2 choice.vertex hchoiceVertex] + rw [MissingColors] + simp only [Finset.mem_sdiff] + refine ⟨?_, ?_⟩ + · exact Finset.mem_univ _ + · intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp + rcases hp with ⟨a, hae, hac⟩ + by_cases ha : Sum.inr a ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · rcases hcompEdge a ha with hag | hacs + · have hn : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + exact hn (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨a, hae, hag⟩) + · rw [currentColoring] at hac + simp [TwoColorComponentSwap, ha, hacs, hneq, hneq.symm] at hac + · rw [currentColoring] at hac + have hac' : secondStable a = some choice.color := by + simpa [TwoColorComponentSwap, ha] using hac + have hne : a ≠ choice.edge := by + intro heq + apply ha + exact heq ▸ hfcomponent + exact (secondStableProper hne ⟨choice.vertex, hae, choice.edgeIncident⟩ + hac' hchoiceSecond).elim + have hnot : choice.color ∉ PresentColors G sigma choice.vertex := by + change choice.color ∈ Finset.univ \ PresentColors G sigma choice.vertex at hmissColor + exact (Finset.mem_sdiff.mp hmissColor).2 + exact (hnot (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hwe, hcolor⟩)).elim + +theorem helper_undoneOne_2148.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsOneEdgeUncolored sigma e0 → + ∀ (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + gamma ≠ choice.color → + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex); IsOneEdgeUncolored undone e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaOne _ q gamma choice + hneq undone + unfold IsOneEdgeUncolored + constructor + · by_cases he : Sum.inr e0 ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) + · simp [undone, TwoColorComponentSwap, he, hsigmaOne.1] + · simp [undone, TwoColorComponentSwap, he, hsigmaOne.1] + · intro e he + obtain ⟨c, hc⟩ := hsigmaOne.2 e he + by_cases hec : Sum.inr e ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) + · by_cases hcg : c = gamma + · exact ⟨choice.color, by simp [undone, TwoColorComponentSwap, hec, hc, hcg]⟩ + · by_cases hcd : c = choice.color + · exact ⟨gamma, by simp [undone, TwoColorComponentSwap, hec, hc, hcd, + hneq.symm]⟩ + · exact ⟨c, by simp [undone, TwoColorComponentSwap, hec, hc, hcg, hcd]⟩ + · exact ⟨c, by simp [undone, TwoColorComponentSwap, hec, hc]⟩ + +theorem helper_currentColorMissing_2202.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.coloring q.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) → gamma ∈ MissingColors G secondStable choice.vertex → ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex) → secondStable e = some gamma ∨ secondStable e = some choice.color) → + secondStable choice.edge = some choice.color → gamma ≠ choice.color → Sum.inr choice.edge + ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → + choice.color ∈ MissingColors G (ett.series.data.coloring q.succ) choice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma secondStable + secondStableProper choice currentColoring hmissing hcompEdge hchoiceSecond hneq hfcomponent + rw [MissingColors] + simp only [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hp + rcases hp with ⟨e, he, hec⟩ + rw [currentColoring] at hec + by_cases hecomp : Sum.inr e ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) + · rcases hcompEdge e hecomp with hegamma | hecolor + · have hm : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + apply hm + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, he, hegamma⟩ + · simp [TwoColorComponentSwap, hecomp, hecolor, hneq, hneq.symm] at hec + · have hecolor : secondStable e = some choice.color := by + simpa [TwoColorComponentSwap, hecomp] using hec + by_cases heq : e = choice.edge + · subst e + exact (hecomp hfcomponent).elim + · exact (secondStableProper heq ⟨choice.vertex, he, choice.edgeIncident⟩ + hecolor hchoiceSecond).elim + +theorem helper_currentControl_2238.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)) → TreeMissingColors choice.selected (ett.series.data.tree q.succ.castSucc) = + TreeMissingColors (ett.series.data.coloring q.castSucc) (ett.series.data.tree + q.succ.castSucc) → + ∀ c ∈ TreeMissingColors choice.selected (ett.series.data.tree q.succ.castSucc) ∪ (insert + choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)), c ∈ + TreeMissingColors (ett.series.data.coloring q.succ) (ett.series.data.tree q.succ.castSucc) + ∪ TashkinovStoredColors ett.series.data q.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice currentStored + treeSelectedPrevious c hc + rcases Finset.mem_union.mp hc with hc | hc + · apply (HkuMissingStoredMonotone G k ett.rounds e0 input ett.series q).1 + rw [treeSelectedPrevious] at hc + exact Finset.mem_union.mpr (Or.inl hc) + · rcases Finset.mem_insert.mp hc with rfl | hc + · by_cases hm : choice.color ∈ TreeMissingColors + (ett.series.data.coloring q.succ) (ett.series.data.tree q.succ.castSucc) + · exact Finset.mem_union.mpr (Or.inl hm) + · apply Finset.mem_union.mpr + right + unfold TashkinovStoredColors + rw [ite_eq_right (by simp)] + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + exact ⟨⟨q.succ, by simp, by simp [currentStored]⟩, hm⟩ + · exact (HkuMissingStoredMonotone G k ett.rounds e0 input ett.series q).1 + (Finset.mem_union.mpr (Or.inr hc)) + +theorem helper_stableSelected_2405.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → IsOneEdgeUncolored secondStable e0 → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + StableColoring (ett.series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) choice.selected + secondStable → + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex); IsProperEdgeColoring G undone → IsOneEdgeUncolored undone e0 → + TreeMissingColors secondStable (ett.series.data.tree q.succ.castSucc) = TreeMissingColors + choice.selected (ett.series.data.tree q.succ.castSucc) → StableColoring + (ett.series.data.tree q.succ.castSucc) (insert choice.color (TashkinovStoredColors + ett.series.data q.castSucc) : Finset (Fin k)) secondStable undone → StableColoring + (ett.series.data.tree q.succ.castSucc) (insert choice.color (TashkinovStoredColors + ett.series.data q.castSucc) : Finset (Fin k)) choice.selected undone := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q gamma secondStable + secondStableProper secondStableOneUncolored choice secondStableRelation undone undoneProper + undoneOne treeSecondSelected stableSecond + apply (sc1 G e0 (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected undone choice.selectedProper choice.selectedOneUncolored + undoneProper undoneOne).2 + have stableSecondCriterion := + ((sc1 G e0 (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc)) + secondStable undone secondStableProper secondStableOneUncolored + undoneProper undoneOne).mp stableSecond) + intro f hf h + rcases h with h | h + · rcases h with ⟨c, hc, hcf⟩ + have hrel := secondStableRelation.1 f hf + ⟨c, hc, hcf⟩ + have hc2 := hc + rw [← treeSecondSelected] at hc2 + have hstable := stableSecondCriterion f hf + (Or.inl ⟨c, hc2, hrel.trans hcf⟩) + exact hstable.trans hrel + · rcases h with ⟨c, hc, hcf⟩ + have hc2 := hc + rw [← treeSecondSelected] at hc2 + have hstable := stableSecondCriterion f hf + (Or.inr ⟨c, hc2, hcf⟩) + have hsecond : secondStable f = some c := hstable.symm.trans hcf + have relationCriterion := + ((sc1 G e0 (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected secondStable choice.selectedProper choice.selectedOneUncolored + secondStableProper secondStableOneUncolored).mp secondStableRelation) + have hrel := relationCriterion f hf (Or.inr ⟨c, hc, hsecond⟩) + exact hstable.trans hrel + +theorem helper_hdeltaBoundary_2443.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) + choice.selected sigmaPrev → BoundaryColorEdges G choice.selected (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color = BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevEnlarged + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + constructor + · rintro ⟨hf, hfc⟩ + refine ⟨hf, ?_⟩ + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have hinc : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + refine ⟨x, hx, ?_⟩ + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + exact (hsigmaPrevEnlarged.1 f hinc + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), hfc⟩).trans hfc + · rintro ⟨hf, hfc⟩ + refine ⟨hf, ?_⟩ + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have hinc : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + refine ⟨x, hx, ?_⟩ + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + have hcriterion := (sc1 G e0 + (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected sigmaPrev choice.selectedProper + choice.selectedOneUncolored hsigmaPrevProper hsigmaPrevOne).mp + hsigmaPrevEnlarged + exact (hcriterion f hinc (Or.inr + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), hfc⟩)).symm.trans hfc + +theorem helper_hclosedPrev_2545.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) → + ∀ (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → IsOneEdgeUncolored + sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev → ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper + previousOneUncolored previousClosed sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + f c v hf hv hsf hcm + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have hinc : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + refine ⟨x, hx, ?_⟩ + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + have hmissingEq := hsigmaPrevStableQ.2 v hv + have hcTree : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, hmissingEq ▸ hcm⟩ + have hcriterion := (sc1 G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev previousProper + previousOneUncolored hsigmaPrevProper hsigmaPrevOne).mp + hsigmaPrevStableQ + have hcopy := hcriterion f hinc + (Or.inr ⟨c, Finset.mem_union_left _ hcTree, hsf⟩) + have holdf : ett.series.data.coloring q.castSucc f = some c := + hcopy.symm.trans hsf + exact previousClosed hf hv holdf (hmissingEq ▸ hcm) + +theorem helper_hdeltaCurrentMissing_2652.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.coloring q.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) → gamma ∈ MissingColors G secondStable choice.vertex → + secondStable choice.edge = some choice.color → gamma ≠ choice.color → Sum.inr choice.edge + ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → + choice.color ∈ MissingColors G (ett.series.data.coloring q.succ) choice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma secondStable + secondStableProper choice currentColoring hgammaSecond hchoiceSecond hgammaDeltaNe + hchoiceSecondComponent + rw [MissingColors] + simp only [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + rcases hpresent with ⟨f, hfIncident, hfCurrent⟩ + rw [currentColoring] at hfCurrent + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · by_cases hfg : secondStable f = some gamma + · have hp : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hfIncident, hfg⟩ + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgammaSecond + exact hnot hp + · by_cases hfd : secondStable f = some choice.color + · have heq : choice.color = gamma := by + simpa [TwoColorComponentSwap, hfComponent, hfg, hfd, + hgammaDeltaNe] using hfCurrent + exact hgammaDeltaNe heq.symm + · simp [TwoColorComponentSwap, hfComponent, hfg, hfd] at hfCurrent + · have hfd : secondStable f = some choice.color := by + simpa [TwoColorComponentSwap, hfComponent] using hfCurrent + by_cases hfeq : f = choice.edge + · subst f + exact hfComponent hchoiceSecondComponent + · exact (secondStableProper hfeq + ⟨choice.vertex, hfIncident, choice.edgeIncident⟩ + hfd hchoiceSecond).elim + +theorem helper_hgammaPrevMissing_2707.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), sigmaPrev = TwoColorComponentSwap G sigma gamma + choice.color (Sum.inl choice.vertex) → gamma ≠ choice.color → choice.color ∈ MissingColors + G sigma choice.vertex → ( + ∀ (f : E), Sum.inr f ∈ TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → + sigma f = some gamma ∨ sigma f = some choice.color) → gamma ∈ MissingColors G sigmaPrev + choice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q gamma choice sigmaPrev + hsigmaPrevFormula hgammaDeltaNe hdeltaSigmaMissing hsigmaComponentColor + rw [MissingColors] + simp only [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hpresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hpresent + rcases hpresent with ⟨f, hfIncident, hfPrev⟩ + rw [hsigmaPrevFormula] at hfPrev + by_cases hfComponent : Sum.inr f ∈ + TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) + · rcases hsigmaComponentColor f hfComponent with hfg | hfd + · have heq : choice.color = gamma := by + simpa [TwoColorComponentSwap, hfComponent, hfg, + hgammaDeltaNe] using hfPrev + exact hgammaDeltaNe heq.symm + · have hp : choice.color ∈ PresentColors G sigma choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨f, hfIncident, hfd⟩ + have hnot : choice.color ∉ PresentColors G sigma choice.vertex := by + simpa [MissingColors] using hdeltaSigmaMissing + exact hnot hp + · have hfg : sigma f = some gamma := by + simpa [TwoColorComponentSwap, hfComponent] using hfPrev + apply hfComponent + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, hfIncident, hfg] + +theorem helper_hswapGraph_2737.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), sigmaPrev = TwoColorComponentSwap G sigma gamma + choice.color (Sum.inl choice.vertex) → gamma ≠ choice.color → ( + ∀ (f : E), Sum.inr f ∈ TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → + sigma f = some gamma ∨ sigma f = some choice.color) → TwoColorIncidenceGraph G sigmaPrev + gamma choice.color = TwoColorIncidenceGraph G sigma gamma choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q gamma choice sigmaPrev + hsigmaPrevFormula hgammaDeltaNe hsigmaComponentColor + rw [hsigmaPrevFormula] + ext x y + cases x with + | inl v => + cases y with + | inl w => simp [TwoColorIncidenceGraph] + | inr f => + by_cases hf : Sum.inr f ∈ TwoColorComponent G sigma gamma + choice.color (Sum.inl choice.vertex) + · rcases hsigmaComponentColor f hf with hfg | hfd + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf, + hfg, hgammaDeltaNe] + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf, + hfd, hgammaDeltaNe] + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf] + | inr f => + cases y with + | inl v => + by_cases hf : Sum.inr f ∈ TwoColorComponent G sigma gamma + choice.color (Sum.inl choice.vertex) + · rcases hsigmaComponentColor f hf with hfg | hfd + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf, + hfg, hgammaDeltaNe] + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf, + hfd, hgammaDeltaNe] + · simp [TwoColorIncidenceGraph, TwoColorComponentSwap, hf] + | inr g => simp [TwoColorIncidenceGraph] + +theorem helper_hsigmaRecovered_2774.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), sigmaPrev = TwoColorComponentSwap G sigma gamma + choice.color (Sum.inl choice.vertex) → gamma ≠ choice.color → ( + ∀ (f : E), Sum.inr f ∈ TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → + sigma f = some gamma ∨ sigma f = some choice.color) → TwoColorIncidenceGraph G sigmaPrev + gamma choice.color = TwoColorIncidenceGraph G sigma gamma choice.color → sigma = + TwoColorComponentSwap G sigmaPrev gamma choice.color (Sum.inl choice.vertex) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q gamma choice sigmaPrev + hsigmaPrevFormula hgammaDeltaNe hsigmaComponentColor hswapGraph + funext f + have hcomponentEq : + (Sum.inr f ∈ TwoColorComponent G sigmaPrev gamma choice.color + (Sum.inl choice.vertex)) ↔ + Sum.inr f ∈ TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) := by + unfold TwoColorComponent + rw [hswapGraph] + by_cases hf : Sum.inr f ∈ TwoColorComponent G sigma gamma + choice.color (Sum.inl choice.vertex) + · have hfPrev := hcomponentEq.mpr hf + rcases hsigmaComponentColor f hf with hfg | hfd + · have hprevValue : sigmaPrev f = some choice.color := by + rw [hsigmaPrevFormula, TwoColorComponentSwap, ite_eq_left hf] + simp [hfg] + rw [TwoColorComponentSwap, ite_eq_left hfPrev, hprevValue] + simpa [hgammaDeltaNe, hgammaDeltaNe.symm] using hfg + · have hprevValue : sigmaPrev f = some gamma := by + rw [hsigmaPrevFormula, TwoColorComponentSwap, ite_eq_left hf] + simp [hfd] + rw [TwoColorComponentSwap, ite_eq_left hfPrev, hprevValue] + simpa [hgammaDeltaNe, hgammaDeltaNe.symm] using hfd + · have hfPrev : Sum.inr f ∉ TwoColorComponent G sigmaPrev gamma + choice.color (Sum.inl choice.vertex) := by + simpa [hcomponentEq] using hf + rw [TwoColorComponentSwap, ite_eq_right hfPrev, hsigmaPrevFormula, + TwoColorComponentSwap, ite_eq_right hf] + +theorem helper_hendNeighbor_2869.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + (H.neighborSet (Sum.inl choice.vertex)).Subsingleton → + ∀ (a b_1 : V ⊕ E) (p_1 : (TwoColorIncidenceGraph G sigmaPrev gamma choice.color).Walk a b_1), + p_1.IsPath → {x : V ⊕ E | x ∈ p_1.support} = TwoColorComponent G sigmaPrev gamma + choice.color (Sum.inl choice.vertex) → + ∀ (b : V ⊕ E) (p : H.Walk (Sum.inl choice.vertex) b), p.IsPath → {z : V ⊕ E | z ∈ p.support} = + TwoColorComponent G sigmaPrev gamma choice.color (Sum.inl choice.vertex) → ¬p.Nil → + ∀ (y : V ⊕ E), H.Adj b y → y = p.getVert (p.length - (1 : ℕ)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev + hsigmaPrevProper H hrootLeaf a _ _ _ _ b p hp hps hpNotNil y hby + have hyComponent : y ∈ TwoColorComponent G sigmaPrev gamma + choice.color (Sum.inl choice.vertex) := by + have hbComponent : b ∈ TwoColorComponent G sigmaPrev gamma + choice.color (Sum.inl choice.vertex) := by + rw [← hps] + change b ∈ p.support + simpa only [p.getVert_length] using + p.getVert_mem_support p.length + change H.connectedComponentMk y = + H.connectedComponentMk (Sum.inl choice.vertex) + change H.connectedComponentMk b = + H.connectedComponentMk (Sum.inl choice.vertex) at hbComponent + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hby).symm.trans hbComponent + have hySupport : y ∈ p.support := by + change y ∈ {z | z ∈ p.support} + rw [hps] + exact hyComponent + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hySupport + have hnlt : n < p.length := by + have hnne : n ≠ p.length := by + intro heq + have hyb : y = b := by + rw [← hn, heq, p.getVert_length] + exact hby.ne hyb.symm + omega + by_cases hpen : n + 1 = p.length + · rw [← hn] + congr 1 + omega + by_cases hn0 : n = 0 + · have hnext : H.Adj (Sum.inl choice.vertex) (p.getVert 1) := by + simpa [hn0, p.getVert_zero] using + p.adj_getVert_succ hnlt + have hbstart : H.Adj (Sum.inl choice.vertex) b := by + rw [← hn, hn0, p.getVert_zero] at hby + exact hby.symm + have hneNext : p.getVert 1 ≠ b := by + intro heq + have hindices := hp.getVert_injOn + (show 1 ≤ p.length by omega) + (show p.length ≤ p.length by rfl) + (heq.trans p.getVert_length.symm) + omega + exact False.elim (hneNext (hrootLeaf hnext hbstart)) + · have hnpos : 0 < n := Nat.pos_of_ne_zero hn0 + have hleft : H.Adj y (p.getVert (n - 1)) := by + rw [← hn] + have hadj := p.adj_getVert_succ (i := n - 1) (by omega) + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ n)] using + hadj.symm + have hright : H.Adj y (p.getVert (n + 1)) := by + rw [← hn] + exact p.adj_getVert_succ hnlt + have hbneLeft : b ≠ p.getVert (n - 1) := by + intro heq + have hindices := hp.getVert_injOn + (show p.length ≤ p.length by rfl) + (show n - 1 ≤ p.length by omega) + (p.getVert_length.trans heq) + omega + have hbneRight : b ≠ p.getVert (n + 1) := by + intro heq + have hindices := hp.getVert_injOn + (show p.length ≤ p.length by rfl) + (show n + 1 ≤ p.length by omega) + (p.getVert_length.trans heq) + omega + have hlrne : p.getVert (n - 1) ≠ p.getVert (n + 1) := by + intro heq + have hindices := hp.getVert_injOn + (show n - 1 ≤ p.length by omega) + (show n + 1 ≤ p.length by omega) heq + omega + let : Fintype (H.neighborSet y) := Fintype.ofFinite _ + have hthree : 3 ≤ @SimpleGraph.degree _ H y + (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let ss : Finset (Sum V E) := + {b, p.getVert (n - 1), p.getVert (n + 1)} + have hss : ss ⊆ H.neighborFinset y := by + intro z hz + simp only [ss, Finset.mem_insert, Finset.mem_singleton] at hz + rcases hz with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hby.symm + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc3 : 3 ≤ ss.card := by + simp [ss, hbneLeft, hbneRight, hlrne] + exact hc3.trans (Finset.card_le_card hss) + have htwo : @SimpleGraph.degree _ H y + (Fintype.ofFinite _) ≤ 2 := by + simpa [H] using TwoColorIncidenceDegreeAtMostTwo G sigmaPrev + gamma choice.color hsigmaPrevProper y + omega + +theorem helper_hendVertex_2974.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (a b_1 : V ⊕ E) (_ : (TwoColorIncidenceGraph G sigmaPrev gamma choice.color).Walk a b_1) (b + : V ⊕ E) (p : H.Walk (Sum.inl choice.vertex) b), (H.neighborSet b).Subsingleton → (0 : ℕ) + < p.length → + ∃ (u : V), b = Sum.inl u := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev H a _ _ + b p hendLeaf hpPos + cases hb : b with + | inl u => exact ⟨u, rfl⟩ + | inr e => + have hlastAdj : H.Adj (p.getVert (p.length - 1)) b := by + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ p.length), + p.getVert_length] using + p.adj_getVert_succ (i := p.length - 1) (by omega) + have hecolor : sigmaPrev e = some gamma ∨ + sigmaPrev e = some choice.color := by + cases hprev : p.getVert (p.length - 1) with + | inl w => + rw [hprev, hb] at hlastAdj + have hdata : Incident G w e ∧ + (sigmaPrev e = some gamma ∨ + sigmaPrev e = some choice.color) := by + simpa [H, TwoColorIncidenceGraph] using hlastAdj + exact hdata.2 + | inr f => + rw [hprev, hb] at hlastAdj + have : False := by + simp [H, TwoColorIncidenceGraph] at hlastAdj + exact this.elim + induction hends : G.ends e using Sym2.inductionOn with + | _ u v => + have huv : u ≠ v := by + intro huv + subst v + exact G.loopless e u hends + have huAdj : H.Adj b (Sum.inl u) := by + rw [hb] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G u e ∧ + (sigmaPrev e = some gamma ∨ + sigmaPrev e = some choice.color) from + ⟨by simp [Incident, hends], hecolor⟩) + have hvAdj : H.Adj b (Sum.inl v) := by + rw [hb] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G v e ∧ + (sigmaPrev e = some gamma ∨ + sigmaPrev e = some choice.color) from + ⟨by simp [Incident, hends], hecolor⟩) + exact False.elim + (huv (Sum.inl.inj (hendLeaf huAdj hvAdj))) + +theorem helper_hendMissing_3025.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), gamma ≠ choice.color → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V), (H.neighborSet (Sum.inl u)).Subsingleton → gamma ∈ MissingColors G sigmaPrev u ∨ + choice.color ∈ MissingColors G sigmaPrev u := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev + hgammaDeltaNe H u hendLeaf + by_cases hg : gamma ∈ MissingColors G sigmaPrev u + · exact Or.inl hg + · right + have hgp : gamma ∈ PresentColors G sigmaPrev u := by + simpa [MissingColors] using hg + by_contra hd + have hdp : choice.color ∈ PresentColors G sigmaPrev u := by + simpa [MissingColors] using hd + obtain ⟨eg, heg, hcg⟩ := by simpa [PresentColors] using hgp + obtain ⟨ed, hed, hcd⟩ := by simpa [PresentColors] using hdp + have hag : H.Adj (Sum.inl u) (Sum.inr eg) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G u eg ∧ + (sigmaPrev eg = some gamma ∨ + sigmaPrev eg = some choice.color) from + ⟨heg, Or.inl hcg⟩) + have had : H.Adj (Sum.inl u) (Sum.inr ed) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G u ed ∧ + (sigmaPrev ed = some gamma ∨ + sigmaPrev ed = some choice.color) from + ⟨hed, Or.inr hcd⟩) + have heq : eg = ed := Sum.inr.inj (hendLeaf hag had) + subst ed + exact hgammaDeltaNe (Option.some.inj (hcg.symm.trans hcd)) + +theorem helper_hnewExit_3069.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), Sum.inl w ∈ + TwoColorComponent G sigmaPrev gamma choice.color (Sum.inl choice.vertex) ↔ w = + choice.vertex) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (a b : V ⊕ E) (p_1 : (TwoColorIncidenceGraph G sigmaPrev gamma choice.color).Walk a b), + p_1.IsPath → {x : V ⊕ E | x ∈ p_1.support} = TwoColorComponent G sigmaPrev gamma + choice.color (Sum.inl choice.vertex) → + ∀ (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), p.IsPath → + {z : V ⊕ E | z ∈ p.support} = TwoColorComponent G sigmaPrev gamma choice.color (Sum.inl + choice.vertex) → (0 : ℕ) < p.length → gamma ∈ MissingColors G sigmaPrev u ∨ choice.color ∈ + MissingColors G sigmaPrev u → u ∉ TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc) → p.length ≠ (1 : ℕ) → TreeExit (ett.series.data.tree q.succ.castSucc) + sigmaPrev gamma choice.color choice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev + hchoiceVertex hcomponentPrev H a b _ _ _ u p hp hps hpPos hendMissing huOutside hpNotOne + refine ⟨u, p.reverse, ?_⟩ + unfold TreeExitPath + refine ⟨hp.reverse, ?_, huOutside, hchoiceVertex, + hendMissing, ?_⟩ + · simpa using (show 2 ≤ p.length by omega) + · intro w hw + constructor + · intro hmem + have hmem' : Sum.inl w ∈ p.support := by + simpa [SimpleGraph.Walk.support_reverse] using hmem + have hmemComponent : Sum.inl w ∈ + TwoColorComponent G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) := by + rw [← hps] + exact hmem' + exact (hcomponentPrev w hw).mp hmemComponent + · intro hwv + subst w + simp [SimpleGraph.Walk.support_reverse] + +theorem helper_hpenultimateTree_3400.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (prefixInput : PartialEdgeColoring + E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc + → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawTreeIndex : Fin (ett.rounds + (2 : ℕ)) → Fin (3 : ℕ) := fun (i : Fin (ett.rounds + (2 : + ℕ))) ↦ Fin.cast ( + by omega + ) i; rawTreeIndex (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = zeroLast.succ.castSucc → finalSeries.data.tree (⟨ett.rounds, + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc gamma + choice sigmaPrev H u p prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData happendTree extendedSeries hextendedData + hroundsEq castSeries castSeriesTree finalSeries rawTreeIndex hrawPenultimate + calc + finalSeries.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + extendedSeries.data.tree + (rawTreeIndex + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2))) := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree + (rawTreeIndex + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2))) := by + rw [hextendedData] + _ = appendedData.tree zeroLast.succ.castSucc := by + rw [hrawPenultimate] + _ = ett.series.data.tree q.succ.castSucc := happendTree + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + rw [hqSucc] + +theorem helper_hprefixFields_3431.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ _ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); (0 : ℕ) + (1 : ℕ) = ett.rounds → + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (↑i : ℕ) < ett.rounds → zeroPrefix.data.stored zeroLast = + ett.series.data.stored i ∧ zeroPrefix.data.connectingEdges zeroLast = + ett.series.data.connectingEdges i ∧ zeroPrefix.data.kind zeroLast = ett.series.data.kind i + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ closureTree q gamma choice + sigmaPrev H u p hroundOne prefixInput zeroPrefix zeroLast hroundsEq i hi + have hiZero : i.val = 0 := by + have hr := hroundOne + omega + have hiEq : i = 0 := Fin.ext hiZero + subst i + have hold := zeroPrefix.certified 0 + have hnew := ett.series.certified 0 + cases hold with + | initial triple0 seedLength0 initialColoring0 initialStored0 + initialEdges0 initialKind0 initialVertex0 initialOutside0 + initialDelta0 initialGamma0 initialClosure0 => + cases hnew with + | initial triple1 seedLength1 initialColoring1 initialStored1 + initialEdges1 initialKind1 initialVertex1 initialOutside1 + initialDelta1 initialGamma1 initialClosure1 => + exact ⟨by simpa [zeroLast] using + initialStored0.trans initialStored1.symm, + by simpa [zeroLast] using + initialEdges0.trans initialEdges1.symm, + by simpa [zeroLast] using + initialKind0.trans initialKind1.symm⟩ + +theorem helper_hseriesDataAgree_3459.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)) → ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∀ (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (a b : V ⊕ E) (p_1 : (TwoColorIncidenceGraph G sigmaPrev gamma choice.color).Walk a b), + p_1.IsPath → + ∀ (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), p.IsPath → ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.stored (Fin.last (1 : ℕ)) = newStored → + appendedData.connectingEdges (Fin.last (1 : ℕ)) = newEdges → appendedData.kind (Fin.last + (1 : ℕ)) = newKind → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.stored i = S.data.stored (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.kind i = S.data.kind (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawDataIndex : Fin (ett.rounds + (1 : ℕ)) → Fin (2 : ℕ) := fun (i : Fin (ett.rounds + (1 : + ℕ))) ↦ Fin.cast ( + by omega + ) i; rawDataIndex (Fin.last ett.rounds) = Fin.last (1 : ℕ) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (↑i : ℕ) < ett.rounds → zeroPrefix.data.stored zeroLast = + ett.series.data.stored i ∧ zeroPrefix.data.connectingEdges zeroLast = + ett.series.data.connectingEdges i ∧ zeroPrefix.data.kind zeroLast = ett.series.data.kind + i) → + ∀ (i : Fin (ett.rounds + (1 : ℕ))), finalSeries.data.stored i = ett.series.data.stored i ∧ + finalSeries.data.connectingEdges i = ett.series.data.connectingEdges i ∧ + finalSeries.data.kind i = ett.series.data.kind i := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc gamma + choice currentStored currentEdges currentKind sigmaPrev H a b _ _ u p hp hroundOne + prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData happendLastStored happendLastEdges happendLastKind extendedSeries + hextendedData hroundsEq castSeries castSeriesStored castSeriesEdges castSeriesKind + finalSeries rawDataIndex hrawFinalData hprefixFields i + by_cases hi : i.val < ett.rounds + · have hraw : rawDataIndex i = zeroLast.castSucc := by + apply Fin.ext + have hiZero : i.val = 0 := by + have hr := hroundOne + omega + exact hiZero + have hp := hprefixFields i hi + constructor + · calc + finalSeries.data.stored i = + extendedSeries.data.stored (rawDataIndex i) := by + exact castSeriesStored hroundsEq extendedSeries i + _ = appendedData.stored (rawDataIndex i) := by + rw [hextendedData] + _ = zeroPrefix.data.stored zeroLast := by + rw [hraw] + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + _ = ett.series.data.stored i := hp.1 + · constructor + · calc + finalSeries.data.connectingEdges i = + extendedSeries.data.connectingEdges + (rawDataIndex i) := by + exact castSeriesEdges hroundsEq extendedSeries i + _ = appendedData.connectingEdges (rawDataIndex i) := by + rw [hextendedData] + _ = zeroPrefix.data.connectingEdges zeroLast := by + rw [hraw] + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + _ = ett.series.data.connectingEdges i := hp.2.1 + · calc + finalSeries.data.kind i = + extendedSeries.data.kind (rawDataIndex i) := by + exact castSeriesKind hroundsEq extendedSeries i + _ = appendedData.kind (rawDataIndex i) := by + rw [hextendedData] + _ = zeroPrefix.data.kind zeroLast := by + rw [hraw] + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + _ = ett.series.data.kind i := hp.2.2 + · have hilast : i = Fin.last ett.rounds := by + apply Fin.ext + have hibound := i.isLt + simp + omega + subst i + constructor + · calc + finalSeries.data.stored (Fin.last ett.rounds) = + extendedSeries.data.stored + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesStored hroundsEq extendedSeries _ + _ = appendedData.stored + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = appendedData.stored (Fin.last 1) := by rw [hrawFinalData] + _ = newStored := happendLastStored + _ = {choice.color, gamma} := rfl + _ = ett.series.data.stored (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentStored.symm + · constructor + · calc + finalSeries.data.connectingEdges (Fin.last ett.rounds) = + extendedSeries.data.connectingEdges + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesEdges hroundsEq extendedSeries _ + _ = appendedData.connectingEdges + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = appendedData.connectingEdges (Fin.last 1) := by + rw [hrawFinalData] + _ = newEdges := happendLastEdges + _ = {choice.edge} := rfl + _ = ett.series.data.connectingEdges + (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentEdges.symm + · calc + finalSeries.data.kind (Fin.last ett.rounds) = + extendedSeries.data.kind + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesKind hroundsEq extendedSeries _ + _ = appendedData.kind + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = appendedData.kind (Fin.last 1) := by rw [hrawFinalData] + _ = newKind := happendLastKind + _ = some TashkinovExtensionKind.PE := rfl + _ = ett.series.data.kind (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentKind.symm + +theorem helper_hseriesTreeAgree_3561.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc + → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let _ : Fin (ett.rounds + (2 : ℕ)) → Fin (3 : ℕ) := fun (i : Fin (ett.rounds + (2 : ℕ))) ↦ + Fin.cast ( + by omega + ) i; + ∀ (j : Fin ett.rounds), finalSeries.data.tree j.succ.castSucc = ett.series.data.tree + j.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc gamma + choice sigmaPrev H u p hroundOne prefixInput zeroPrefix zeroLast newStored newEdges newKind + newVertex newOutside newDelta newGamma appendedData happendTree extendedSeries + hextendedData hroundsEq castSeries castSeriesTree finalSeries rawTreeIndex j + have hj : j.succ = Fin.last ett.rounds := by + apply Fin.ext + have hjbound := j.isLt + simp + have hr := hroundOne + omega + have htreeIndex : rawTreeIndex j.succ.castSucc = + zeroLast.succ.castSucc := by + apply Fin.ext + simp [rawTreeIndex, zeroLast] + calc + finalSeries.data.tree j.succ.castSucc = + extendedSeries.data.tree (rawTreeIndex j.succ.castSucc) := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree (rawTreeIndex j.succ.castSucc) := by + rw [hextendedData] + _ = appendedData.tree zeroLast.succ.castSucc := by rw [htreeIndex] + _ = ett.series.data.tree q.succ.castSucc := happendTree + _ = ett.series.data.tree j.succ.castSucc := by + rw [hj, hqSucc] + +theorem helper_hseriesColorProperties_3585.{u_1, u_2} : + helperHseriesColorProperties3585Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne _ + closureTree q gamma choice sigmaPrev hsigmaPrevProper hsigmaPrevOne H u p hroundOne + prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData happendColor extendedSeries hextendedData hroundsEq castSeries + castSeriesColoring finalSeries rawDataIndex hfinalColor i + by_cases hi : i.val < ett.rounds + · have hraw : rawDataIndex i = zeroLast.castSucc := by + apply Fin.ext + have hiZero : i.val = 0 := by + have hr := hroundOne + omega + exact hiZero + have hcolor : finalSeries.data.coloring i = sigmaPrev := by + calc + finalSeries.data.coloring i = + extendedSeries.data.coloring (rawDataIndex i) := by + exact castSeriesColoring hroundsEq extendedSeries i + _ = appendedData.coloring (rawDataIndex i) := by + rw [hextendedData] + _ = appendedData.coloring zeroLast.castSucc := by rw [hraw] + _ = sigmaPrev := happendColor + rw [hcolor] + exact ⟨hsigmaPrevProper, hsigmaPrevOne⟩ + · have hilast : i = Fin.last ett.rounds := by + apply Fin.ext + have hibound := i.isLt + simp + omega + subst i + rw [hfinalColor] + exact ⟨hsigmaProper, hsigmaOne⟩ + +theorem helper_branch_3453.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE → + ∀ (sigma : PartialEdgeColoring E k) (Tstar : TreeSequence G e0) (i : Fin ett.rounds), + ett.series.data.kind i.succ = some TashkinovExtensionKind.RE → + Fin.last ett.rounds = i.succ → + Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) := by + classical + intro V E _ _ _ G k e0 input T generating ett hterminal sigma _ i currentKind htarget + have hbad : some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.SE ∨ + some TashkinovExtensionKind.RE = + some TashkinovExtensionKind.PE := by + simp [htarget, currentKind] at hterminal + rcases hbad with hbad | hbad <;> cases hbad + +theorem helper_hi_3469.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (i : Fin ett.rounds), Fin.last ett.rounds = i.succ → i = q := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q i htarget + apply Fin.ext + have hv : ett.rounds = i.val + 1 := by + simpa using congrArg Fin.val htarget + change i.val = ett.rounds - 1 + omega + +theorem helper_hdeltaCurrentControl_3499.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = ({ choice.color } : Finset (Fin k)) → choice.color ∈ + TreeMissingColors (ett.series.data.coloring q.succ) (ett.series.data.tree q.succ.castSucc) + ∪ TashkinovStoredColors ett.series.data q.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice currentStored + by_cases hm : choice.color ∈ + TreeMissingColors (ett.series.data.coloring q.succ) + (ett.series.data.tree q.succ.castSucc) + · exact Finset.mem_union_left _ hm + · apply Finset.mem_union_right + unfold TashkinovStoredColors + have hqpos : q.succ.val ≠ 0 := by simp + rw [ite_eq_right hqpos, Finset.mem_sdiff] + refine ⟨?_, hm⟩ + simp only [Finset.mem_biUnion, Finset.mem_univ, true_and] + refine ⟨q.succ, ?_⟩ + rw [ite_eq_left le_rfl] + simp [currentStored] + +theorem helper_henlargedControl_3516.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.coloring q.succ = choice.selected → TreeMissingColors + (ett.series.data.coloring q.castSucc) (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.castSucc ⊆ TreeMissingColors + (ett.series.data.coloring q.succ) (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.succ → choice.color ∈ TreeMissingColors + (ett.series.data.coloring q.succ) (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.succ → TreeMissingColors choice.selected + (ett.series.data.tree q.succ.castSucc) ∪ (insert choice.color (TashkinovStoredColors + ett.series.data q.castSucc) : Finset (Fin k)) ⊆ TreeMissingColors + (ett.series.data.coloring q.succ) (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice currentColoring + hpreviousControl hdeltaCurrentControl c hc + rcases Finset.mem_union.mp hc with hc | hc + · apply Finset.mem_union_left + simpa [currentColoring] using hc + · rw [Finset.mem_insert] at hc + rcases hc with rfl | hc + · exact hdeltaCurrentControl + · exact hpreviousControl (Finset.mem_union_right _ hc) + +theorem helper_hsigmaPrevEnlarged_3532.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.coloring q.succ = choice.selected → + ∀ (sigmaPrev : PartialEdgeColoring E k), sigmaPrev = sigma → TreeMissingColors choice.selected + (ett.series.data.tree q.succ.castSucc) ∪ (insert choice.color (TashkinovStoredColors + ett.series.data q.castSucc) : Finset (Fin k)) ⊆ TreeMissingColors + (ett.series.data.coloring q.succ) (ett.series.data.tree q.succ.castSucc) ∪ + TashkinovStoredColors ett.series.data q.succ → StableColoring (ett.series.data.tree + q.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : + Finset (Fin k)) choice.selected sigmaPrev := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q hsigmaStableQ choice + currentColoring sigmaPrev hsigmaPrevSigma henlargedControl + constructor + · intro f hf hcolor + rcases hcolor with ⟨c, hc, hfc⟩ + have hcopy := hsigmaStableQ.1 f hf + ⟨c, henlargedControl hc, by simpa [currentColoring] using hfc⟩ + simpa [currentColoring, hsigmaPrevSigma] using hcopy + · intro v hv + simpa [currentColoring, hsigmaPrevSigma] using hsigmaStableQ.2 v hv + +theorem helper_hchoiceDefective_3555.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color = + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color → DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hdeltaBoundary + obtain ⟨oldColor, holdDefective, holdEdge⟩ := choice.edgeDefective + have holdColor : oldColor = choice.color := by + have holdEdgeColor := (Finset.mem_filter.mp holdEdge).2 + exact Option.some.inj (holdEdgeColor.symm.trans choice.edgeColor) + subst oldColor + unfold DefectiveColor + rw [← hdeltaBoundary] + exact holdDefective + +theorem helper_hchoiceEdgeNew_3566.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color = + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color → choice.edge ∈ BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hdeltaBoundary + rw [← hdeltaBoundary] + obtain ⟨oldColor, holdDefective, holdEdge⟩ := choice.edgeDefective + have holdColor : oldColor = choice.color := by + have holdEdgeColor := (Finset.mem_filter.mp holdEdge).2 + exact Option.some.inj (holdEdgeColor.symm.trans choice.edgeColor) + simpa [holdColor] using holdEdge + +theorem helper_hnotStrongPrev_3595.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color → ¬ColoredVertexSetStronglyClosed G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev + hchoiceDefective hstrong + have hone : 1 < (BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color).card := by + have htwo : 2 ≤ (BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color).card := hchoiceDefective + omega + obtain ⟨f, hf, g, hg, hfg⟩ := Finset.one_lt_card.mp hone + have hfBoundary := (Finset.mem_filter.mp hf).1 + have hgBoundary := (Finset.mem_filter.mp hg).1 + have hfColor := (Finset.mem_filter.mp hf).2 + have hgColor := (Finset.mem_filter.mp hg).2 + exact (hstrong.2 hfBoundary hgBoundary hfg hfColor) hgColor + +theorem helper_hnewAlternative_3611.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) choice.selected pi → + Disjoint (MissingColors G pi choice.otherEndpoint) (TreeMissingColors pi + (ett.series.data.tree q.succ.castSucc))) → + ∀ (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev), StableColoring (ett.series.data.tree + q.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : + Finset (Fin k)) choice.selected sigmaPrev → + ∀ (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hsigmaPrevSelf : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice2409 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected pi + → Disjoint (MissingColors G pi newChoice.otherEndpoint) (TreeMissingColors pi + (ett.series.data.tree q.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper + previousOneUncolored choice seriesAlternative sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hsigmaPrevEnlarged hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf + newChoice pi hpiProper hpiOne hpiStable + have hpiOld : StableColoring + (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected pi := by + exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc))).trans + (x := ⟨choice.selected, + ⟨choice.selectedProper, choice.selectedOneUncolored⟩⟩) + (y := ⟨sigmaPrev, ⟨hsigmaPrevProper, hsigmaPrevOne⟩⟩) + (z := ⟨pi, ⟨hpiProper, hpiOne⟩⟩) + hsigmaPrevEnlarged (by simpa [newChoice] using hpiStable) + simpa [newChoice] using + seriesAlternative pi hpiProper hpiOne hpiOld + +theorem helper_happendTree_3707.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), zeroPrefix.data.tree (Fin.last (1 : ℕ)) = ett.series.data.tree (Fin.last + ett.rounds).castSucc → + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc choice + prefixInput zeroPrefix hzeroTree zeroLast newStored newEdges newKind newVertex newOutside + newDelta newGamma appendedData + calc + appendedData.tree zeroLast.succ.castSucc = + zeroPrefix.data.tree (Fin.last 1) := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + congr 1 + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := hzeroTree + _ = ett.series.data.tree q.succ.castSucc := by rw [hqSucc] + +theorem helper_happendColor_3717.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : + ℕ) e0 prefixInput), zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigmaPrev → + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.coloring zeroLast.castSucc = sigmaPrev := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q choice + sigmaPrev prefixInput zeroPrefix hzeroColor zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData + calc + appendedData.coloring zeroLast.castSucc = + zeroPrefix.data.coloring (Fin.last 0) := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + congr 1 + _ = sigmaPrev := hzeroColor + +theorem helper_hnoRevisitingZero_3741.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; ¬Nonempty (RevisitingExtensionCertificate appendedData zeroLast.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q choice + prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData + rintro ⟨cert⟩ + obtain ⟨oldCert, -, -, -, -, -⟩ := + (RevisitingExtensionCertificateAppend zeroPrefix.data + closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma zeroLast).1 cert + have hle := oldCert.earlierAtMost + have hpos := oldCert.earlierPositive + simp [zeroLast] at hle + omega + +theorem helper_hnewAlternativeZero_3753.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G + sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) sigmaPrev) + (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice2409 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected pi + → Disjoint (MissingColors G pi newChoice.otherEndpoint) (TreeMissingColors pi + (ett.series.data.tree q.succ.castSucc))) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; + ∀ (happendTree : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree + q.succ.castSucc) (happendColor : appendedData.coloring zeroLast.castSucc = sigmaPrev) + (happendStored : TashkinovStoredColors appendedData zeroLast.castSucc = + TashkinovStoredColors ett.series.data q.castSucc), + let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) + (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring + zeroLast.castSucc) := helperAppendedChoice2713 G k e0 input T generating ett hpositive + sigma closureTree previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf prefixInput + zeroPrefix happendTree happendColor happendStored; + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (appendedData.tree zeroLast.succ.castSucc) (insert appendedChoice.color + (TashkinovStoredColors appendedData zeroLast.castSucc) : Finset (Fin k)) + appendedChoice.selected pi → Disjoint (MissingColors G pi appendedChoice.otherEndpoint) + (TreeMissingColors pi (appendedData.tree zeroLast.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q + previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternative + prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData happendTree happendColor happendStored appendedChoice pi hpiProper + hpiOne hpiStable + have hpiStable' := hpiStable + change StableColoring (appendedData.tree zeroLast.succ.castSucc) + (insert choice.color + (TashkinovStoredColors appendedData zeroLast.castSucc)) + sigmaPrev pi at hpiStable' + rw [happendTree, happendStored] at hpiStable' + have hresult := hnewAlternative pi hpiProper hpiOne + (by simpa [appendedChoice, newChoice] using hpiStable') + change Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi + (appendedData.tree zeroLast.succ.castSucc)) + rw [happendTree] + simpa [appendedChoice, newChoice] using hresult + +theorem helper_lastStep_3779.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar closureTree : TreeSequence G e0), TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (_ : TreeSequence G e0) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring + q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring + q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k) + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored + sigmaPrev e0) (hsigmaPrevStableQ : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev), sigmaPrev = sigma → + ∀ (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hsigmaPrevSelf : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput) (fstar : E) (seed : TreeSequence G e0), TreeSequenceAdjoinEdge + (ett.series.data.tree (Fin.last ett.rounds).castSucc) fstar seed → fstar = choice.edge → + TashkinovClosure sigma seed closureTree → + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree (Fin.last (2 : ℕ)) = closureTree → appendedData.coloring + (Fin.last (1 : ℕ)) = sigma → appendedData.stored (Fin.last (1 : ℕ)) = newStored → + appendedData.connectingEdges (Fin.last (1 : ℕ)) = newEdges → appendedData.kind (Fin.last + (1 : ℕ)) = newKind → appendedData.chosenVertex (Fin.last (1 : ℕ)) = newVertex → + appendedData.outsideVertex (Fin.last (1 : ℕ)) = newOutside → appendedData.delta (Fin.last + (1 : ℕ)) = newDelta → appendedData.gamma (Fin.last (1 : ℕ)) = newGamma → + ∀ (happendTree : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree + q.succ.castSucc) (happendColor : appendedData.coloring zeroLast.castSucc = sigmaPrev) + (happendStored : TashkinovStoredColors appendedData zeroLast.castSucc = + TashkinovStoredColors ett.series.data q.castSucc), + let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) + (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring + zeroLast.castSucc) := helperAppendedChoice2713 G k e0 input T generating ett hpositive + sigma closureTree previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf prefixInput + zeroPrefix happendTree happendColor happendStored; ¬Nonempty + (RevisitingExtensionCertificate appendedData zeroLast.castSucc) → ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (appendedData.tree zeroLast.succ.castSucc) (insert appendedChoice.color + (TashkinovStoredColors appendedData zeroLast.castSucc) : Finset (Fin k)) + appendedChoice.selected pi → Disjoint (MissingColors G pi appendedChoice.otherEndpoint) + (TreeMissingColors pi (appendedData.tree zeroLast.succ.castSucc))) → (ett.series.data.tree + (Fin.last ett.rounds).castSucc).length < closureTree.length → TashkinovSeriesStep G k (1 : + ℕ) e0 prefixInput appendedData (Fin.last (1 : ℕ)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree hTnClosure q + hqSucc adjoined previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevStableQ hsigmaPrevSigma hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf hclosedPrev hnotStrongPrev prefixInput zeroPrefix fstar seed hadjoin hfstar + hseedClosure zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendLastTree happendLastColor happendLastStored happendLastEdges + happendLastKind happendLastVertex happendLastOutside happendLastDelta happendLastGamma + happendTree happendColor happendStored appendedChoice hnoRevisitingZero hnewAlternativeZero + hstrictClosure + have hlast : zeroLast.succ = Fin.last 1 := by + apply Fin.ext + rfl + rw [← hlast] + apply TashkinovSeriesStep.SE (i := zeroLast) + (choice := appendedChoice) (adjoined := seed) + · rw [happendColor]; exact hsigmaPrevProper + · rw [happendColor]; exact hsigmaPrevOne + · rw [happendColor, happendTree]; exact hclosedPrev + · rw [happendColor, happendTree]; exact hnotStrongPrev + · exact hnoRevisitingZero + · exact hnewAlternativeZero + · exact happendLastColor.trans hsigmaPrevSigma.symm + · exact happendLastStored.trans (by rfl) + · exact happendLastEdges.trans (by rfl) + · exact happendLastKind.trans (by rfl) + · exact happendLastVertex.trans (by rfl) + · exact happendLastOutside.trans (by rfl) + · exact happendLastDelta.trans (by rfl) + · exact happendLastGamma.trans (by rfl) + · change TreeSequenceAdjoinEdge + (appendedData.tree zeroLast.succ.castSucc) choice.edge seed + rw [happendTree] + simpa [hqSucc, hfstar] using hadjoin + · change TashkinovClosure (appendedData.coloring (Fin.last 1)) + seed (appendedData.tree (Fin.last 2)) + rw [happendLastColor, happendLastTree] + exact hseedClosure + · change TreeSequenceInitialSegment + (appendedData.tree zeroLast.succ.castSucc) + (appendedData.tree (Fin.last 2)) + rw [happendTree] + rw [happendLastTree] + simpa [hqSucc] using hTnClosure + · change (appendedData.tree zeroLast.succ.castSucc).length < + (appendedData.tree (Fin.last 2)).length + rw [happendTree] + rw [happendLastTree] + simpa [hqSucc] using hstrictClosure + +theorem helper_hfinalTree_3891.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree (Fin.last (2 : ℕ)) = closureTree → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawTreeIndex : Fin (ett.rounds + (2 : ℕ)) → Fin (3 : ℕ) := fun (i : Fin (ett.rounds + (2 : + ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; rawTreeIndex (Fin.last (ett.rounds + (1 : ℕ))) = Fin.last (2 : ℕ) → finalSeries.data.tree + (Fin.last (ett.rounds + (1 : ℕ))) = closureTree := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q choice + prefixInput zeroPrefix newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendLastTree extendedSeries hextendedData hroundsEq castSeries + castSeriesTree finalSeries rawTreeIndex hrawFinalTree + calc + finalSeries.data.tree (Fin.last (ett.rounds + 1)) = + extendedSeries.data.tree + (rawTreeIndex (Fin.last (ett.rounds + 1))) := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree + (rawTreeIndex (Fin.last (ett.rounds + 1))) := by + rw [hextendedData] + _ = appendedData.tree (Fin.last 2) := by rw [hrawFinalTree] + _ = closureTree := happendLastTree + +theorem helper_hpenultimateTree_3903.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc + → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawTreeIndex : Fin (ett.rounds + (2 : ℕ)) → Fin (3 : ℕ) := fun (i : Fin (ett.rounds + (2 : + ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; rawTreeIndex (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = zeroLast.succ.castSucc → finalSeries.data.tree (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q hqSucc choice + prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData happendTree extendedSeries hextendedData hroundsEq castSeries + castSeriesTree finalSeries rawTreeIndex hrawPenultimate + exact @helper_hpenultimateTree_713 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@Tstar) (@closureTree) (@hqSucc) (@choice) (@prefixInput) (@zeroPrefix) + (@happendTree) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) + (@hrawPenultimate) + +theorem helper_hfinalColor_3911.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.coloring (Fin.last (1 : ℕ)) = sigma → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawDataIndex : Fin (ett.rounds + (1 : ℕ)) → Fin (2 : ℕ) := fun (i : Fin (ett.rounds + (1 : + ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; rawDataIndex (Fin.last ett.rounds) = Fin.last (1 : ℕ) → finalSeries.data.coloring + (Fin.last ett.rounds) = sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q choice + prefixInput zeroPrefix newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendLastColor extendedSeries hextendedData hroundsEq castSeries + castSeriesColoring finalSeries rawDataIndex hrawFinalData + calc + finalSeries.data.coloring (Fin.last ett.rounds) = + extendedSeries.data.coloring + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesColoring hroundsEq extendedSeries _ + _ = appendedData.coloring + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = appendedData.coloring (Fin.last 1) := by rw [hrawFinalData] + _ = sigma := happendLastColor + +theorem helper_hseriesDataAgree_3932.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = ({ choice.color } : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.SE → ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.stored (Fin.last (1 : ℕ)) = newStored → + appendedData.connectingEdges (Fin.last (1 : ℕ)) = newEdges → appendedData.kind (Fin.last + (1 : ℕ)) = newKind → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.stored i = S.data.stored (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.kind i = S.data.kind (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawDataIndex : Fin (ett.rounds + (1 : ℕ)) → Fin (2 : ℕ) := fun (i : Fin (ett.rounds + (1 : + ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; rawDataIndex (Fin.last ett.rounds) = Fin.last (1 : ℕ) → ( + ∀ (i : Fin (ett.rounds + (1 : ℕ))), (↑i : ℕ) < ett.rounds → zeroPrefix.data.stored zeroLast = + ett.series.data.stored i ∧ zeroPrefix.data.connectingEdges zeroLast = + ett.series.data.connectingEdges i ∧ zeroPrefix.data.kind zeroLast = ett.series.data.kind + i) → + ∀ (i : Fin (ett.rounds + (1 : ℕ))), finalSeries.data.stored i = ett.series.data.stored i ∧ + finalSeries.data.connectingEdges i = ett.series.data.connectingEdges i ∧ + finalSeries.data.kind i = ett.series.data.kind i := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q hqSucc choice + currentStored currentEdges currentKind hroundOne prefixInput zeroPrefix zeroLast newStored + newEdges newKind newVertex newOutside newDelta newGamma appendedData happendLastStored + happendLastEdges happendLastKind extendedSeries hextendedData hroundsEq castSeries + castSeriesStored castSeriesEdges castSeriesKind finalSeries rawDataIndex hrawFinalData + hprefixFields + exact @helper_hseriesDataAgree_772 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@Tstar) (@closureTree) (@hqSucc) (@choice) (@currentStored) + (@currentEdges) (@currentKind) (@hroundOne) (@prefixInput) (@zeroPrefix) + (@happendLastStored) (@happendLastEdges) (@happendLastKind) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesStored) (@castSeriesEdges) + (@castSeriesKind) (@hrawFinalData) (@hprefixFields) + +theorem helper_hseriesTreeAgree_3944.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc + → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + ∀ (j : Fin ett.rounds), finalSeries.data.tree j.succ.castSucc = ett.series.data.tree + j.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q hqSucc choice + hroundOne prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside + newDelta newGamma appendedData happendTree extendedSeries hextendedData hroundsEq + castSeries castSeriesTree finalSeries + exact @helper_hseriesTreeAgree_874 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@Tstar) (@closureTree) (@hqSucc) (@choice) (@hroundOne) (@prefixInput) + (@zeroPrefix) (@happendTree) (@extendedSeries) (@hextendedData) (@hroundsEq) + (@castSeriesTree) + +theorem helper_hseriesColorProperties_3952.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + ∀ (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.coloring zeroLast.castSucc = sigmaPrev → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; finalSeries.data.coloring (Fin.last ett.rounds) = sigma → + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ + IsOneEdgeUncolored (finalSeries.data.coloring i) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne Tstar + closureTree q choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hroundOne prefixInput + zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendColor extendedSeries hextendedData hroundsEq castSeries + castSeriesColoring finalSeries hfinalColor + exact @helper_hseriesColorProperties_898 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@hsigmaProper) (@hsigmaOne) (@Tstar) (@closureTree) (@choice) + (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hroundOne) (@prefixInput) + (@zeroPrefix) (@happendColor) (@extendedSeries) (@hextendedData) (@hroundsEq) + (@castSeriesColoring) (@hfinalColor) + +theorem helper_hseriesStable_3961.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), (0 : ℕ) < ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), StableColoring (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) + (ett.series.data.coloring (Fin.last ett.rounds)) sigma → + ∀ (_ _ : TreeSequence G e0), ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 + : ℕ)) e0 prefixInput) (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; finalSeries.data.coloring (Fin.last ett.rounds) = sigma → + ∀ (j : Fin ett.rounds), StableColoring (ett.series.data.tree j.succ.castSucc) + (TashkinovStoredColors ett.series.data j.succ) (ett.series.data.coloring j.succ) + (finalSeries.data.coloring j.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaStable _ closureTree + hroundOne prefixInput extendedSeries hroundsEq castSeries finalSeries hfinalColor j + have hj : j.succ = Fin.last ett.rounds := by + apply Fin.ext + have hjbound := j.isLt + simp + have hr := hroundOne + omega + rw [hj, hfinalColor] + exact hsigmaStable + +theorem helper_hreplacementCurrentTree_4014.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc → + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree replacementLast.succ = ett.series.data.tree + q.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q hqSucc sigmaPrev originalPrefix + corr hcorrFinalTree replacementLast + have hlastTree : replacementLast.succ = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [replacementLast] + rw [hlastTree, hcorrFinalTree, hqSucc] + +theorem helper_horiginalCurrentTree_4022.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + (0 : ℕ) < originalPrefix.rounds → originalPrefix.series.data.tree replacementLast.castSucc + = ett.series.data.tree q.castSucc.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q hroundLarge originalPrefix hr + hprefixTrees replacementLast horiginalPositive + calc + originalPrefix.series.data.tree replacementLast.castSucc = + ett.series.data.tree + (Fin.castLE (by omega) replacementLast.castSucc) := + hprefixTrees replacementLast.castSucc + _ = ett.series.data.tree q.castSucc.castSucc := by + congr 1 + apply Fin.ext + simp [replacementLast, q, hr] + +theorem helper_htreeMissingEq_4034.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0) + (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (horiginalPositive : (0 : ℕ) < originalPrefix.rounds), + let previousReplacement : Fin originalPrefix.rounds := (⟨originalPrefix.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin originalPrefix.rounds); previousReplacement.succ = replacementLast → TreeMissingColors + (corr.replacementSeries.data.coloring replacementLast) (corr.replacementSeries.data.tree + replacementLast.castSucc) = TreeMissingColors (originalPrefix.series.data.coloring + replacementLast) (originalPrefix.series.data.tree replacementLast.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ sigmaPrev originalPrefix corr + replacementLast horiginalPositive previousReplacement hpreviousSucc + have hstable := corr.replacementStable previousReplacement + rw [hpreviousSucc] at hstable + have htree := corr.ladderTreesAgree previousReplacement + rw [hpreviousSucc] at htree + rw [htree] + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, (hstable.2 v hv).symm ▸ hc⟩ + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, hstable.2 v hv ▸ hc⟩ + +theorem helper_hreplacementStored_4052.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < ett.rounds) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (_ : (0 : ℕ) < originalPrefix.rounds), Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) replacementLast = q.castSucc → TreeMissingColors (corr.replacementSeries.data.coloring + replacementLast) (corr.replacementSeries.data.tree replacementLast.castSucc) = + TreeMissingColors (originalPrefix.series.data.coloring replacementLast) + (originalPrefix.series.data.tree replacementLast.castSucc) → TashkinovStoredColors + corr.replacementSeries.data replacementLast = TashkinovStoredColors ett.series.data + q.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q sigmaPrev hroundLarge + originalPrefix hr hprefixData corr replacementLast horiginalPositive hlastMap htreeMissingEq + have hcorrStored : TashkinovStoredColors + corr.replacementSeries.data replacementLast = + TashkinovStoredColors originalPrefix.series.data + replacementLast := by + unfold TashkinovStoredColors + have hnonzero : replacementLast.val ≠ 0 := by + simp only [Fin.val_last, ne_eq, replacementLast] + exact Nat.ne_of_gt horiginalPositive + rw [ite_eq_right hnonzero, ite_eq_right hnonzero] + ext c + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · rintro ⟨⟨j, hj, hc⟩, hn⟩ + refine ⟨⟨j, hj, ?_⟩, ?_⟩ + · by_cases hle : j.val ≤ replacementLast.val + · simp only [ite_eq_left hle] at hc ⊢ + simpa [corr.storedColorsAgree j] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rw [htreeMissingEq] at hn + exact hn + · rintro ⟨⟨j, hj, hc⟩, hn⟩ + refine ⟨⟨j, hj, ?_⟩, ?_⟩ + · by_cases hle : j.val ≤ replacementLast.val + · simp only [ite_eq_left hle] at hc ⊢ + simpa [corr.storedColorsAgree j] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rw [← htreeMissingEq] at hn + exact hn + calc + TashkinovStoredColors corr.replacementSeries.data replacementLast = + TashkinovStoredColors originalPrefix.series.data + replacementLast := hcorrStored + _ = TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) replacementLast) := + (hprefixData replacementLast).2.2.2.2 + _ = TashkinovStoredColors ett.series.data q.castSucc := by + rw [hlastMap] + +theorem helper_hnoRevisitingReplacement_4104.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → ¬Nonempty + (RevisitingExtensionCertificate ett.series.data q.castSucc) → + ∀ (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → IsOneEdgeUncolored + sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev → (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix → ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + (1 : ℕ))) = ett.series.data.tree (Fin.last + ett.rounds).castSucc → corr.replacementSeries.data.coloring (Fin.last + originalPrefix.rounds) = sigmaPrev → MaximumProperty corr.replacementETT → + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ¬Nonempty (RevisitingExtensionCertificate corr.replacementSeries.data replacementLast) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower _ q previousProper + previousOneUncolored noRevisiting sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hroundLarge originalPrefix hr hprefixMP hprefixTrees hprefixData corr hcorrFinalTree + hcorrFinalColor hcorrMP replacementLast + exact P2971_T1_PositivePrefixNoRevisiting G k e0 input T generating + ett hMP hroundLarge + (fun lower hp hl hm => + ⟨(hlower lower hp hl hm).2.1, + (hlower lower hp hl hm).2.2.2.1⟩) + sigmaPrev hsigmaPrevProper hsigmaPrevOne previousProper + previousOneUncolored hsigmaPrevStableQ originalPrefix hr + hprefixMP hprefixTrees hprefixData corr hcorrFinalTree + hcorrFinalColor hcorrMP noRevisiting + +theorem helper_hnewAlternativeReplacement_4116.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G + sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) sigmaPrev) + (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice2409 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected pi + → Disjoint (MissingColors G pi newChoice.otherEndpoint) (TreeMissingColors pi + (ett.series.data.tree q.succ.castSucc))) → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (hcorrFinalColor : corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = + sigmaPrev), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (hreplacementCurrentTree : corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree q.succ.castSucc) (hreplacementStored : TashkinovStoredColors + corr.replacementSeries.data replacementLast = TashkinovStoredColors ett.series.data + q.castSucc), + let replacementChoice : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + replacementLast.succ) (TashkinovStoredColors corr.replacementSeries.data replacementLast) + (corr.replacementSeries.data.coloring replacementLast) := helperReplacementChoice3411 G k + e0 input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf originalPrefix corr hcorrFinalColor hreplacementCurrentTree + hreplacementStored; + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (corr.replacementSeries.data.tree replacementLast.succ) (insert + replacementChoice.color (TashkinovStoredColors corr.replacementSeries.data + replacementLast) : Finset (Fin k)) replacementChoice.selected pi → Disjoint (MissingColors + G pi replacementChoice.otherEndpoint) (TreeMissingColors pi + (corr.replacementSeries.data.tree replacementLast.succ)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternative originalPrefix + corr hcorrFinalColor replacementLast hreplacementCurrentTree hreplacementStored + replacementChoice pi hpiProper hpiOne hpiStable + have hpiStable' := hpiStable + change StableColoring + (corr.replacementSeries.data.tree replacementLast.succ) + (insert choice.color + (TashkinovStoredColors corr.replacementSeries.data + replacementLast)) sigmaPrev pi at hpiStable' + rw [hreplacementCurrentTree, hreplacementStored] at hpiStable' + have hresult := hnewAlternative pi hpiProper hpiOne + (by simpa [replacementChoice, newChoice] using hpiStable') + change Disjoint (MissingColors G pi choice.otherEndpoint) + (TreeMissingColors pi + (corr.replacementSeries.data.tree replacementLast.succ)) + rw [hreplacementCurrentTree] + simpa [replacementChoice, newChoice] using hresult + +end GoldbergSeymour.TerminalSeriesRebuild + +end diff --git a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean new file mode 100644 index 0000000000..b2d08aa3a6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean @@ -0,0 +1,7016 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TerminalSeriesRebuildPreparation + +/-! +# Transport lemmas for terminal extension reconstruction + +Part of Wesley Pegden’s Trellis formalization of the Goldberg–Seymour theorem, +commit 88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12. These lemmas support the +reconstruction of terminal series extensions. +-/ + +@[expose] public section + +namespace GoldbergSeymour.TerminalSeriesRebuild + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperRetainedPEFields13584Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring + q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring + q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k) + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored + sigmaPrev e0) (hsigmaPrevStableQ : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev) (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice4049 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (horiginalPositive : (0 : ℕ) < + originalPrefix.rounds), ( + ∀ (j : Fin (originalPrefix.rounds + (1 : ℕ))), corr.replacementSeries.data.kind j = + ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j)) → ( + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch : + MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + IsProperEdgeColoring G second → StableColoring X (insert ch.color C : Finset (Fin k)) + ch.selected second → g ∈ MissingColors G ch.selected ch.vertex → + let post : PartialEdgeColoring E k := TwoColorComponentSwap G second g ch.color (Sum.inl + ch.vertex); ch.color ∈ MissingColors G post ch.vertex ∧ g ∉ MissingColors G post ch.vertex + ∧ g ≠ ch.color) → + ∀ (j : Fin (originalPrefix.rounds + (1 : ℕ))), (0 : ℕ) < (↑j : ℕ) → + corr.replacementSeries.data.kind j = some TashkinovExtensionKind.PE → + corr.replacementSeries.data.chosenVertex j = ett.series.data.chosenVertex (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j) ∧ corr.replacementSeries.data.delta j = ett.series.data.delta (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j) ∧ corr.replacementSeries.data.gamma j = ett.series.data.gamma (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j) + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch11555Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring (Fin.last ett.rounds)) + sigma → + ∀ (Tstar : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) Tstar → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length + < Tstar.length → + ∀ (closureTree : TreeSequence G e0), TashkinovClosure sigma Tstar closureTree → + TreeSequenceInitialSegment Tstar closureTree → TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (adjoined : TreeSequence G e0) (previousProper : IsProperEdgeColoring G + (ett.series.data.coloring q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored + (ett.series.data.coloring q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), ett.series.data.stored q.succ = ({ choice.color } + : Finset (Fin k)) → ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) + → ett.series.data.kind q.succ = some TashkinovExtensionKind.SE → + ∀ (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev), sigmaPrev = sigma → + ∀ (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hsigmaPrevSelf : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice2409 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected pi + → Disjoint (MissingColors G pi newChoice.otherEndpoint) (TreeMissingColors pi + (ett.series.data.tree q.succ.castSucc))) → ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), zeroPrefix.data.tree (Fin.last (1 : ℕ)) = ett.series.data.tree (Fin.last + ett.rounds).castSucc → zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigmaPrev → + ((ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last + ett.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence sigma seed Tstar) → Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +private abbrev helperContinuation4951Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring (Fin.last ett.rounds)) + sigma → + ∀ (Tstar : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) Tstar → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length + < Tstar.length → + ∀ (closureTree : TreeSequence G e0), TreeSequenceInitialSegment Tstar closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.stored q.succ = ({ choice.color } : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.SE → + ∀ (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → IsOneEdgeUncolored + sigmaPrev e0 → ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree (Fin.last (2 : ℕ)) = closureTree → appendedData.coloring + (Fin.last (1 : ℕ)) = sigma → appendedData.stored (Fin.last (1 : ℕ)) = newStored → + appendedData.connectingEdges (Fin.last (1 : ℕ)) = newEdges → appendedData.kind (Fin.last + (1 : ℕ)) = newKind → appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree + q.succ.castSucc → appendedData.coloring zeroLast.castSucc = sigmaPrev → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → (0 : ℕ) + (1 : ℕ) = + ett.rounds → + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.stored i = S.data.stored (Fin.cast ( + by omega + ) i)) → ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast ( + by omega + ) i)) → Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperHsigmaPrevEnlarged12232Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + ∀ (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → IsOneEdgeUncolored secondStable e0 → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ParallelExtensionColor ett.series.data q.castSucc choice.selected choice.vertex gamma → + StableColoring (ett.series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) choice.selected + secondStable → TreeExit (ett.series.data.tree q.succ.castSucc) secondStable gamma + choice.color choice.vertex → ett.series.data.coloring q.succ = TwoColorComponentSwap G + secondStable gamma choice.color (Sum.inl choice.vertex) → IsProperEdgeColoring G + (ett.series.data.coloring q.succ) → IsOneEdgeUncolored (ett.series.data.coloring q.succ) + e0 → ett.series.data.stored q.succ = (insert choice.color ({ gamma } : Finset (Fin k)) : + Finset (Fin k)) → + ∀ (sigmaPrev : PartialEdgeColoring E k), choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex) + → sigmaPrev = TwoColorComponentSwap G sigma gamma choice.color (Sum.inl choice.vertex) → + StableColoring (ett.series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) choice.selected + sigmaPrev + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch12991Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : (0 : ℕ) < + originalPrefix.rounds), ( + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch : + MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + IsProperEdgeColoring G second → StableColoring X (insert ch.color C : Finset (Fin k)) + ch.selected second → g ∈ MissingColors G ch.selected ch.vertex → + let post : PartialEdgeColoring E k := TwoColorComponentSwap G second g ch.color (Sum.inl + ch.vertex); ch.color ∈ MissingColors G post ch.vertex ∧ g ∉ MissingColors G post ch.vertex + ∧ g ≠ ch.color) → + ∀ (j : Fin (originalPrefix.rounds + (1 : ℕ))), + let fullj : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j; + ∀ (fulli : Fin ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (fullGamma : Fin k), ParallelExtensionColor + ett.series.data fulli.castSucc fullChoice.selected fullChoice.vertex fullGamma → + ∀ (fullSecond : PartialEdgeColoring E k), IsProperEdgeColoring G fullSecond → StableColoring + (ett.series.data.tree fulli.succ.castSucc) (insert fullChoice.color (TashkinovStoredColors + ett.series.data fulli.castSucc) : Finset (Fin k)) fullChoice.selected fullSecond → + ett.series.data.coloring fulli.succ = TwoColorComponentSwap G fullSecond fullGamma + fullChoice.color (Sum.inl fullChoice.vertex) → ett.series.data.stored fulli.succ = (insert + fullChoice.color ({ fullGamma } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.connectingEdges fulli.succ = ({ fullChoice.edge } : Finset E) → + ett.series.data.chosenVertex fulli.succ = some fullChoice.vertex → ett.series.data.delta + fulli.succ = some fullChoice.color → ett.series.data.gamma fulli.succ = some fullGamma → + fullj = fulli.succ → fulli.succ = fullj → + ∀ (newi : Fin originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (newGamma : Fin k), ParallelExtensionColor corr.replacementSeries.data + newi.castSucc newChoice.selected newChoice.vertex newGamma → + ∀ (newSecond : PartialEdgeColoring E k), IsProperEdgeColoring G newSecond → StableColoring + (corr.replacementSeries.data.tree newi.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) : Finset (Fin k)) + newChoice.selected newSecond → corr.replacementSeries.data.coloring newi.succ = + TwoColorComponentSwap G newSecond newGamma newChoice.color (Sum.inl newChoice.vertex) → + corr.replacementSeries.data.stored newi.succ = (insert newChoice.color ({ newGamma } : + Finset (Fin k)) : Finset (Fin k)) → corr.replacementSeries.data.connectingEdges newi.succ + = ({ newChoice.edge } : Finset E) → corr.replacementSeries.data.chosenVertex newi.succ = + some newChoice.vertex → corr.replacementSeries.data.delta newi.succ = some newChoice.color + → corr.replacementSeries.data.gamma newi.succ = some newGamma → j = newi.succ → + corr.replacementSeries.data.chosenVertex newi.succ = ett.series.data.chosenVertex + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) newi.succ) ∧ corr.replacementSeries.data.delta newi.succ = ett.series.data.delta (Fin.castLE + ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) newi.succ) ∧ corr.replacementSeries.data.gamma newi.succ = ett.series.data.gamma (Fin.castLE + ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) newi.succ) + +private abbrev helperContinuation7494Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (hsigmaProper : IsProperEdgeColoring G sigma) (hsigmaOne : IsOneEdgeUncolored sigma e0) + (hsigmaStable : StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma) (Tstar : TreeSequence G e0) (hTnTstar : + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar) + (hstrict : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < Tstar.length) + (closureTree : TreeSequence G e0) (hTstarClosure : TreeSequenceInitialSegment Tstar + closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqSucc : q.succ = Fin.last ett.rounds) (gamma : Fin k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)) (currentStored : ett.series.data.stored + q.succ = (insert choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k))) + (currentEdges : ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E)) + (currentKind : ett.series.data.kind q.succ = some TashkinovExtensionKind.PE) (sigmaPrev : + PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (a b : V ⊕ E) (p_1 : (TwoColorIncidenceGraph G sigmaPrev gamma choice.color).Walk a b) (a_1 + : p_1.IsPath) (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hp : p.IsPath) + (hroundOne : ett.rounds = (1 : ℕ)) (prefixInput : PartialEdgeColoring E k) (zeroPrefix : + TashkinovSeries G k (0 : ℕ) e0 prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; + ∀ (happendLastTree : appendedData.tree (Fin.last (2 : ℕ)) = closureTree) (happendLastColor : + appendedData.coloring (Fin.last (1 : ℕ)) = sigma) (happendLastStored : appendedData.stored + (Fin.last (1 : ℕ)) = newStored) (happendLastEdges : appendedData.connectingEdges (Fin.last + (1 : ℕ)) = newEdges) (happendLastKind : appendedData.kind (Fin.last (1 : ℕ)) = newKind) + (happendTree : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree + q.succ.castSucc) (happendColor : appendedData.coloring zeroLast.castSucc = sigmaPrev) + (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput) (hextendedData : + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma) (hroundsEq : (0 : ℕ) + + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → (h : a = b) → (S : TashkinovSeries G k a e0 prefixInput) → + TashkinovSeries G k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k + a e0 prefixInput) ↦ (h ▸ S); + ∀ (castSeriesTree : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) (castSeriesColoring : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) (castSeriesStored : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.stored i = S.data.stored (Fin.cast ( + by omega + ) i)) (castSeriesEdges : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast ( + by omega + ) i)), Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +/-- Dependent contract shared by the terminal series reconstruction proof modules. + +Keeping this interface separate avoids repeating its dependent hypotheses and data. +-/ +abbrev helperBranch12554Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring (Fin.last ett.rounds)) + sigma → + ∀ (Tstar : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) Tstar → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length + < Tstar.length → + ∀ (closureTree : TreeSequence G e0), TashkinovClosure sigma Tstar closureTree → + TreeSequenceInitialSegment Tstar closureTree → TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (_ : PartialEdgeColoring E k) (previousProper : IsProperEdgeColoring G + (ett.series.data.coloring q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored + (ett.series.data.coloring q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), ett.series.data.stored q.succ = (insert + choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → + ∀ (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev) (hchoiceDefective : DefectiveColor G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice4049 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected + rho ∧ ¬Disjoint (MissingColors G rho newChoice.otherEndpoint) (TreeMissingColors rho + (ett.series.data.tree q.succ.castSucc))) → gamma ∈ MissingColors G sigmaPrev choice.vertex + → sigma = TwoColorComponentSwap G sigmaPrev gamma choice.color (Sum.inl choice.vertex) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (a b : V ⊕ E) (p_1 : (TwoColorIncidenceGraph G sigmaPrev gamma choice.color).Walk a b), + p_1.IsPath → + ∀ (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), p.IsPath → TreeExit + (ett.series.data.tree q.succ.castSucc) sigmaPrev gamma choice.color choice.vertex → + ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), zeroPrefix.data.tree (Fin.last (1 : ℕ)) = ett.series.data.tree (Fin.last + ett.rounds).castSucc → zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigmaPrev → + ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc) + Tstar → Nonempty (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +theorem helper_hnoRevisitingAppended_4214.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ¬Nonempty (RevisitingExtensionCertificate corr.replacementSeries.data replacementLast) → + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let appendedData : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; ¬Nonempty (RevisitingExtensionCertificate + appendedData replacementLast.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q choice + sigmaPrev originalPrefix corr replacementLast hnoRevisitingReplacement newStored newEdges + newKind newVertex newOutside newDelta newGamma appendedData + rintro ⟨cert⟩ + obtain ⟨oldCert, -, -, -, -, -⟩ := + (RevisitingExtensionCertificateAppend + corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma + replacementLast).1 cert + exact hnoRevisitingReplacement ⟨oldCert⟩ + +theorem helper_hfinalPenultimateTree_4384.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < ett.rounds) (originalPrefix + : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (_ : (0 : ℕ) < originalPrefix.rounds), corr.replacementSeries.data.tree replacementLast.succ + = ett.series.data.tree q.succ.castSucc → + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (2 + : ℕ))), (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let rawPenultimate : Fin (originalPrefix.rounds + (3 : ℕ)) := Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))); rawPenultimate = replacementLast.succ.castSucc → + finalSeries.data.tree (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc choice + sigmaPrev hroundLarge originalPrefix hr corr replacementLast horiginalPositive + hreplacementCurrentTree newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesTree finalSeries + rawPenultimate hrawPenultimate + calc + finalSeries.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + extendedSeries.data.tree rawPenultimate := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree rawPenultimate := by + rw [hextendedData] + _ = corr.replacementSeries.data.tree + replacementLast.succ := by + rw [hrawPenultimate] + simp only [appendedData, + TashkinovSeriesDataAppend] + exact Fin.lastCases_castSucc replacementLast.succ + _ = ett.series.data.tree + (Fin.last ett.rounds).castSucc := by + exact hreplacementCurrentTree.trans + (congrArg ett.series.data.tree + (congrArg Fin.castSucc hqSucc)) + +theorem helper_hfinalTree_4414.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (2 + : ℕ))), (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let rawFinalTree : Fin (originalPrefix.rounds + (3 : ℕ)) := Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) (Fin.last (ett.rounds + (1 : ℕ))); rawFinalTree = Fin.last (originalPrefix.rounds + (2 : ℕ)) + → finalSeries.data.tree (Fin.last (ett.rounds + (1 : ℕ))) = closureTree := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q choice + sigmaPrev originalPrefix corr newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesTree + finalSeries rawFinalTree hrawFinalTree + calc + finalSeries.data.tree (Fin.last (ett.rounds + 1)) = + extendedSeries.data.tree rawFinalTree := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree rawFinalTree := by rw [hextendedData] + _ = closureTree := by + rw [hrawFinalTree] + simp [appendedData, TashkinovSeriesDataAppend] + +theorem helper_hfinalColor_4432.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let rawFinalColor : Fin (originalPrefix.rounds + (2 : ℕ)) := Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) (Fin.last ett.rounds); rawFinalColor = Fin.last (originalPrefix.rounds + (1 : ℕ)) → + finalSeries.data.coloring (Fin.last ett.rounds) = sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q choice + sigmaPrev originalPrefix corr newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesColoring + finalSeries rawFinalColor hrawFinalColor + calc + finalSeries.data.coloring (Fin.last ett.rounds) = + extendedSeries.data.coloring rawFinalColor := by + exact castSeriesColoring hroundsEq extendedSeries _ + _ = appendedData.coloring rawFinalColor := by + rw [hextendedData] + _ = sigma := by + rw [hrawFinalColor] + simp [appendedData, TashkinovSeriesDataAppend] + +theorem helper_branch_4454.{u_1, u_2} : + helperBranch4454Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q choice + sigmaPrev hroundLarge originalPrefix hr hprefixData corr horiginalPositive newStored + newEdges newKind newVertex newOutside newDelta newGamma appendedData extendedSeries + hextendedData hroundsEq castSeries castSeriesStored castSeriesEdges castSeriesKind + finalSeries rawDataIndex i hi + let j : Fin (originalPrefix.rounds + 1) := + ⟨i.val, by rw [hroundsEq]; exact hi⟩ + have hraw : rawDataIndex i = j.castSucc := by + apply Fin.ext + rfl + have hmap : Fin.castLE (by omega) j = i := by + apply Fin.ext + rfl + constructor + · calc + finalSeries.data.stored i = + extendedSeries.data.stored (rawDataIndex i) := by + exact castSeriesStored hroundsEq extendedSeries i + _ = appendedData.stored (rawDataIndex i) := by + rw [hextendedData] + _ = corr.replacementSeries.data.stored j := by + rw [hraw] + simp [appendedData, TashkinovSeriesDataAppend] + _ = originalPrefix.series.data.stored j := + corr.storedColorsAgree j + _ = ett.series.data.stored (Fin.castLE (by omega) j) := + (hprefixData j).2.1 + _ = ett.series.data.stored i := by rw [hmap] + · constructor + · calc + finalSeries.data.connectingEdges i = + extendedSeries.data.connectingEdges + (rawDataIndex i) := by + exact castSeriesEdges hroundsEq + extendedSeries i + _ = appendedData.connectingEdges + (rawDataIndex i) := by rw [hextendedData] + _ = corr.replacementSeries.data.connectingEdges j := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = originalPrefix.series.data.connectingEdges j := + corr.connectingEdgesAgree j + _ = ett.series.data.connectingEdges + (Fin.castLE (by omega) j) := + (hprefixData j).2.2.1 + _ = ett.series.data.connectingEdges i := by rw [hmap] + · calc + finalSeries.data.kind i = + extendedSeries.data.kind (rawDataIndex i) := by + exact castSeriesKind hroundsEq extendedSeries i + _ = appendedData.kind (rawDataIndex i) := by + rw [hextendedData] + _ = corr.replacementSeries.data.kind j := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = originalPrefix.series.data.kind j := + corr.extensionKindsAgree j + _ = ett.series.data.kind + (Fin.castLE (by omega) j) := + (hprefixData j).2.2.2.1 + _ = ett.series.data.kind i := by rw [hmap] + +theorem helper_branch_4512.{u_1, u_2} : + helperBranch4512Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc choice + currentStored currentEdges currentKind sigmaPrev hroundLarge originalPrefix hr corr + horiginalPositive newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesStored + castSeriesEdges castSeriesKind finalSeries rawDataIndex i hi + have hilast : i = Fin.last ett.rounds := by + apply Fin.ext + simp + omega + subst i + have hraw : rawDataIndex (Fin.last ett.rounds) = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [rawDataIndex] + constructor + · calc + finalSeries.data.stored (Fin.last ett.rounds) = + extendedSeries.data.stored + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesStored hroundsEq extendedSeries _ + _ = appendedData.stored + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = newStored := by + rw [hraw] + simp [appendedData, TashkinovSeriesDataAppend] + _ = {choice.color} := rfl + _ = ett.series.data.stored (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentStored.symm + · constructor + · calc + finalSeries.data.connectingEdges + (Fin.last ett.rounds) = + extendedSeries.data.connectingEdges + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesEdges hroundsEq + extendedSeries _ + _ = appendedData.connectingEdges + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = newEdges := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = {choice.edge} := rfl + _ = ett.series.data.connectingEdges + (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentEdges.symm + · calc + finalSeries.data.kind (Fin.last ett.rounds) = + extendedSeries.data.kind + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesKind hroundsEq extendedSeries _ + _ = appendedData.kind + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = newKind := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = some TashkinovExtensionKind.SE := rfl + _ = ett.series.data.kind + (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentKind.symm + +theorem helper_hseriesTreeAgree_4578.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < ett.rounds) (originalPrefix + : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : (0 : ℕ) < + originalPrefix.rounds), + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (2 + : ℕ))), (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; finalSeries.data.tree (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc → + let _ : Fin (ett.rounds + (2 : ℕ)) → Fin (originalPrefix.rounds + (3 : ℕ)) := fun (i : Fin + (ett.rounds + (2 : ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; + ∀ (i : Fin ett.rounds), finalSeries.data.tree i.succ.castSucc = ett.series.data.tree + i.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q choice + sigmaPrev hroundLarge originalPrefix hr hprefixTrees corr horiginalPositive newStored + newEdges newKind newVertex newOutside newDelta newGamma appendedData extendedSeries + hextendedData hroundsEq castSeries castSeriesTree finalSeries hfinalPenultimateTree + rawTreeIndex i + by_cases hi : i.val < originalPrefix.rounds + · let j : Fin originalPrefix.rounds := ⟨i.val, hi⟩ + have hraw : rawTreeIndex i.succ.castSucc = + j.succ.castSucc.castSucc := by + apply Fin.ext + rfl + have hmap : Fin.castLE (by omega) j.succ.castSucc = + i.succ.castSucc := by + apply Fin.ext + rfl + calc + finalSeries.data.tree i.succ.castSucc = + extendedSeries.data.tree + (rawTreeIndex i.succ.castSucc) := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree + (rawTreeIndex i.succ.castSucc) := by + rw [hextendedData] + _ = corr.replacementSeries.data.tree + j.succ.castSucc := by + rw [hraw] + simp only [appendedData, + TashkinovSeriesDataAppend] + convert (Fin.lastCases_castSucc + j.succ.castSucc) using 1 + _ = originalPrefix.series.data.tree + j.succ.castSucc := corr.ladderTreesAgree j + _ = ett.series.data.tree + (Fin.castLE (by omega) j.succ.castSucc) := + hprefixTrees j.succ.castSucc + _ = ett.series.data.tree i.succ.castSucc := by rw [hmap] + · let ilast : Fin ett.rounds := + ⟨ett.rounds - 1, by omega⟩ + have hilast : i = ilast := by + apply Fin.ext + have hiBound := i.isLt + have hprefixRounds := hr + simp [ilast] + omega + rw [hilast] + have hindex : + ilast.succ.castSucc = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + simp [ilast] + omega + rw [hindex] + exact hfinalPenultimateTree + +theorem helper_hseriesColorProperties_4631.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + ∀ (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), (0 : ℕ) < originalPrefix.rounds → + let newStored : Finset (Fin k) := ({ choice.color } : Finset (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.SE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := none; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; finalSeries.data.coloring (Fin.last ett.rounds) = sigma → + let _ : Fin (ett.rounds + (1 : ℕ)) → Fin (originalPrefix.rounds + (2 : ℕ)) := fun (i : Fin + (ett.rounds + (1 : ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ + IsOneEdgeUncolored (finalSeries.data.coloring i) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne _ + closureTree q choice sigmaPrev hroundLarge originalPrefix hr corr horiginalPositive + newStored newEdges newKind newVertex newOutside newDelta newGamma appendedData + extendedSeries hextendedData hroundsEq castSeries castSeriesColoring finalSeries + hfinalColor rawDataIndex i + by_cases hi : i.val < ett.rounds + · let j : Fin (originalPrefix.rounds + 1) := + ⟨i.val, by rw [hroundsEq]; exact hi⟩ + have hraw : rawDataIndex i = j.castSucc := by + apply Fin.ext + rfl + have hcolor : finalSeries.data.coloring i = + corr.replacementSeries.data.coloring j := by + calc + finalSeries.data.coloring i = + extendedSeries.data.coloring (rawDataIndex i) := by + exact castSeriesColoring hroundsEq + extendedSeries i + _ = appendedData.coloring (rawDataIndex i) := by + rw [hextendedData] + _ = corr.replacementSeries.data.coloring j := by + rw [hraw] + simp [appendedData, TashkinovSeriesDataAppend] + rw [hcolor] + exact ⟨corr.replacementProper j, + corr.replacementOneUncolored j⟩ + · have hilast : i = Fin.last ett.rounds := by + apply Fin.ext + simp + have hiBound := i.isLt + omega + rw [hilast, hfinalColor] + exact ⟨hsigmaProper, hsigmaOne⟩ + +theorem helper_hseriesStable_4663.{u_1, u_2} : + helperHseriesStable4663Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaStable _ closureTree q + choice sigmaPrev hroundLarge originalPrefix hr hprefixTrees hprefixData corr + horiginalPositive newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesColoring + finalSeries hfinalColor rawDataIndex i + by_cases hi : i.val < originalPrefix.rounds + · let j : Fin originalPrefix.rounds := ⟨i.val, hi⟩ + have hmap : Fin.castLE (by omega) j.succ = i.succ := by + apply Fin.ext + rfl + have htreeMap : Fin.castLE (by omega) + j.succ.castSucc = i.succ.castSucc := by + apply Fin.ext + rfl + have htreeEq : originalPrefix.series.data.tree + j.succ.castSucc = + ett.series.data.tree i.succ.castSucc := by + calc + originalPrefix.series.data.tree j.succ.castSucc = + ett.series.data.tree + (Fin.castLE (by omega) j.succ.castSucc) := + hprefixTrees j.succ.castSucc + _ = ett.series.data.tree i.succ.castSucc := by + rw [htreeMap] + have hstoredEq : TashkinovStoredColors + originalPrefix.series.data j.succ = + TashkinovStoredColors ett.series.data i.succ := by + calc + TashkinovStoredColors originalPrefix.series.data + j.succ = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) j.succ) := + (hprefixData j.succ).2.2.2.2 + _ = TashkinovStoredColors ett.series.data i.succ := by + rw [hmap] + have holdColorEq : originalPrefix.series.data.coloring + j.succ = ett.series.data.coloring i.succ := by + calc + originalPrefix.series.data.coloring j.succ = + ett.series.data.coloring + (Fin.castLE (by omega) j.succ) := + (hprefixData j.succ).1 + _ = ett.series.data.coloring i.succ := by rw [hmap] + have hraw : rawDataIndex i.succ = + j.succ.castSucc := by + apply Fin.ext + rfl + have hnewColorEq : finalSeries.data.coloring i.succ = + corr.replacementSeries.data.coloring j.succ := by + calc + finalSeries.data.coloring i.succ = + extendedSeries.data.coloring + (rawDataIndex i.succ) := by + exact castSeriesColoring hroundsEq + extendedSeries i.succ + _ = appendedData.coloring + (rawDataIndex i.succ) := by rw [hextendedData] + _ = corr.replacementSeries.data.coloring j.succ := by + rw [hraw] + simp only [appendedData, + TashkinovSeriesDataAppend] + exact Fin.lastCases_castSucc j.succ + have hstable := corr.replacementStable j + rw [htreeEq, hstoredEq, holdColorEq] at hstable + rw [hnewColorEq] + exact hstable + · let ilast : Fin ett.rounds := + ⟨ett.rounds - 1, by omega⟩ + have hilast : i = ilast := by + apply Fin.ext + have hiBound := i.isLt + have hprefixRounds := hr + simp [ilast] + omega + have hindex : ilast.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [ilast] + omega + rw [hilast, hindex, hfinalColor] + exact hsigmaStable + +theorem helper_hi_4786.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (i : Fin ett.rounds), Fin.last ett.rounds = i.succ → i = q := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q i htarget + apply Fin.ext + have hv : ett.rounds = i.val + 1 := by + simpa using congrArg Fin.val htarget + change i.val = ett.rounds - 1 + omega + +theorem helper_hcomponent_4809.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma + e0 → StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma → + ∀ (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.chosenVertex q.succ = some choice.vertex → ett.series.data.delta q.succ = + some choice.color → ett.series.data.gamma q.succ = some gamma → ett.series.data.kind + q.succ = some TashkinovExtensionKind.PE → + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex + := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower sigma hsigmaProper hsigmaOne + hsigmaStable _ q hqSucc gamma choice currentVertex currentDelta currentGamma hpeKind + have hbase := ExtensionBase G k e0 input T generating ett hMP hpositive + hlower choice.vertex gamma choice.color + (by simpa [hqSucc] using hpeKind) + (by simpa [hqSucc] using currentVertex) + (by simpa [hqSucc] using currentGamma) + (by simpa [hqSucc] using currentDelta) + sigma hsigmaProper hsigmaOne + (by simpa [hqSucc] using hsigmaStable) + simpa [hqSucc] using hbase + +theorem helper_hpathComponent_4867.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)) (u : V) (path : (TwoColorIncidenceGraph + G secondStable gamma choice.color).Walk (Sum.inl u) (Sum.inl choice.vertex)), ( + ∀ x ∈ path.support, + ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G secondStable gamma choice.color).Adj x y → y ∈ + path.support) → + ∀ y ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex), y ∈ + path.support := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma secondStable choice u + path hclosed y hy + let graph := TwoColorIncidenceGraph G secondStable gamma choice.color + have reach : graph.Reachable (Sum.inl choice.vertex) y := by + change graph.connectedComponentMk y = graph.connectedComponentMk (Sum.inl + choice.vertex) at hy + exact SimpleGraph.ConnectedComponent.eq.mp hy |>.symm + exact reach.mem_subgraphVerts (H := (⊤ : graph.Subgraph).induce {x | x ∈ path.support}) + (fun x hx z hadj => ⟨by simpa using hx, hclosed x (by simpa using hx) z hadj, hadj⟩) + (by simp) + +theorem helper_hcompEdge_4879.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)) (_ : V) (e : E), Sum.inr e ∈ + TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → secondStable + e = some gamma ∨ secondStable e = some choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma secondStable choice u e he + have hs : Sum.inr e ∈ + (TwoColorIncidenceGraph G secondStable gamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G secondStable gamma choice.color) + (u := Sum.inr e) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp he + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G secondStable gamma choice.color).mem_support.mp hs + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + +theorem helper_hchoiceSecond_4895.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), StableColoring (ett.series.data.tree + q.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : + Finset (Fin k)) choice.selected secondStable → secondStable choice.edge = some + choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q secondStable choice + secondStableRelation + have heq := secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union.mpr (Or.inr (Finset.mem_insert_self _ _)), + choice.edgeColor⟩ + exact heq.trans choice.edgeColor + +theorem helper_hneq_4901.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)), gamma ∈ MissingColors G secondStable + choice.vertex → secondStable choice.edge = some choice.color → gamma ≠ choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma secondStable choice + hmissing hchoiceSecond heq + have hp : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, heq ▸ hchoiceSecond⟩ + have hpnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hmissing + exact hpnot hp + +theorem helper_hsigmaEdge_4922.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → + ∀ (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma → + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ett.series.data.coloring q.succ = TwoColorComponentSwap G secondStable gamma choice.color + (Sum.inl choice.vertex) → ett.series.data.stored q.succ = (insert choice.color ({ gamma } + : Finset (Fin k)) : Finset (Fin k)) → choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex) + → gamma ∈ MissingColors G secondStable choice.vertex → + ∀ (_ : V), ( + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex) → secondStable e = some gamma ∨ secondStable e = some choice.color) → + secondStable choice.edge = some choice.color → gamma ≠ choice.color → Sum.inr choice.edge + ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex) → + ∀ (e : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → e = choice.edge := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper Tstar q + hsigmaStableQ gamma secondStable secondStableProper choice currentColoring currentStored + hchoiceVertex hcomponent hmissing u hcompEdge hchoiceSecond hneq hfcomponent + exact @helper_hsigmaEdge_2047 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@Tstar) (@hsigmaStableQ) (@gamma) (@secondStable) (@secondStableProper) (@choice) + (@currentColoring) (@currentStored) (@hchoiceVertex) (@hcomponent) (@hmissing) (@u) + (@hcompEdge) (@hchoiceSecond) (@hneq) (@hfcomponent) + +theorem helper_treeMissingTransport_4940.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (a b : PartialEdgeColoring E k), ( + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), MissingColors G a w = + MissingColors G b w) → TreeMissingColors a (ett.series.data.tree q.succ.castSucc) = + TreeMissingColors b (ett.series.data.tree q.succ.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q a b hab + ext c + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + constructor + · rintro ⟨w, hw, hc⟩ + exact ⟨w, hw, by rw [hab w hw] at hc; exact hc⟩ + · rintro ⟨w, hw, hc⟩ + exact ⟨w, hw, by rw [hab w hw]; exact hc⟩ + +theorem helper_sigmaComponentColor_4960.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (_ : V) (e : E), Sum.inr e ∈ TwoColorComponent G sigma gamma choice.color (Sum.inl + choice.vertex) → sigma e = some gamma ∨ sigma e = some choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q gamma choice u e he + have hs : Sum.inr e ∈ + (TwoColorIncidenceGraph G sigma gamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G sigma gamma choice.color) + (u := Sum.inr e) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp he + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G sigma gamma choice.color).mem_support.mp hs + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + +theorem helper_gammaControl_5005.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)), StableColoring (ett.series.data.tree + q.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : + Finset (Fin k)) choice.selected secondStable → choice.vertex ∈ TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc) → gamma ∈ MissingColors G secondStable + choice.vertex → gamma ∈ TreeMissingColors choice.selected (ett.series.data.tree + q.succ.castSucc) ∪ (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) + : Finset (Fin k)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma secondStable choice + secondStableRelation hchoiceVertex hmissing + apply Finset.mem_union.mpr + left + unfold TreeMissingColors + simp only [Finset.mem_biUnion] + refine ⟨choice.vertex, hchoiceVertex, ?_⟩ + rw [← secondStableRelation.2 choice.vertex + choice.vertexDefective.1] + exact hmissing + +theorem helper_branch_5026.{u_1, u_2} : + helperBranch5026Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q hsigmaStableQ gamma + secondStable secondStableProper secondStableOneUncolored choice secondStableRelation + currentColoring hdegree u path hdegreeBound hclosed hpathComponent hcompEdge hchoiceSecond + htreeEdge hsigmaEdge undone treeSecondSelected sigmaComponentColor sigmaColorMissing + currentControl gammaControl f hf h + rcases h with ⟨c, hc, hcf⟩ + rw [treeSecondSelected] at hc + have h' := ((sc1 G e0 (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected secondStable choice.selectedProper choice.selectedOneUncolored + secondStableProper secondStableOneUncolored).mp secondStableRelation) f hf + (Or.inr ⟨c, hc, hcf⟩) + have hs := hsigmaStableQ.1 f hf + by_cases hsf : Sum.inr f ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) + · have ef := hsigmaEdge f hf hsf + subst f + rcases sigmaComponentColor choice.edge hsf with hec | hec + · simp [undone, TwoColorComponentSwap, hsf, hec, hchoiceSecond] + · exfalso + have hnot : choice.color ∉ PresentColors G sigma choice.vertex := by + simpa [MissingColors] using sigmaColorMissing + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, hec⟩ + · have hu : undone f = sigma f := by + change (if Sum.inr f ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) then + (if sigma f = some gamma then some choice.color + else if sigma f = some choice.color then some gamma else sigma f) + else sigma f) = sigma f + exact ite_eq_right hsf + rw [hu] + clear hdegree hdegreeBound hclosed hpathComponent hcompEdge + hsigmaEdge sigmaComponentColor + by_cases ha : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · have he := htreeEdge f hf ha + subst f + have hcGamma := currentControl gamma gammaControl + have hsGamma := hsigmaStableQ.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨gamma, hcGamma, by + rw [currentColoring] + simp [TwoColorComponentSwap, ha, hchoiceSecond]⟩ + have hcurGamma : ett.series.data.coloring q.succ choice.edge = + some gamma := by + rw [currentColoring] + simp [TwoColorComponentSwap, ha, hchoiceSecond] + have hsigGamma : sigma choice.edge = some gamma := + hsGamma.trans hcurGamma + have hmem : Sum.inr choice.edge ∈ + TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hsigGamma] + exact (hsf hmem).elim + · have hcur : ett.series.data.coloring q.succ f = some c := by + rw [currentColoring] + simp [TwoColorComponentSwap, ha, hcf] + have hsig := hsigmaStableQ.1 f hf + ⟨c, currentControl c hc, hcur⟩ + exact hsig.trans (hcur.trans hcf.symm) + +theorem helper_branch_5085.{u_1, u_2} : + helperBranch5085Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne _ q + hsigmaStableQ gamma secondStable choice currentColoring currentProper currentOneUncolored + hdegree u path hdegreeBound hclosed hpathComponent hcompEdge hchoiceSecond htreeEdge + hsigmaEdge undone treeSecondSelected sigmaComponentColor sigmaColorMissing currentControl + gammaControl f hf h + rcases h with ⟨c, hc, hcf⟩ + by_cases hsf : Sum.inr f ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) + · have ef := hsigmaEdge f hf hsf + subst f + rcases sigmaComponentColor choice.edge hsf with hec | hec + · simp [undone, TwoColorComponentSwap, hsf, hec, hchoiceSecond] + · exfalso + have hnot : choice.color ∉ PresentColors G sigma choice.vertex := by + simpa [MissingColors] using sigmaColorMissing + apply hnot + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨choice.edge, choice.edgeIncident, hec⟩ + · have hu : undone f = sigma f := by + change (if Sum.inr f ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) then + (if sigma f = some gamma then some choice.color + else if sigma f = some choice.color then some gamma else sigma f) + else sigma f) = sigma f + exact ite_eq_right hsf + rw [hu] + clear hdegree hdegreeBound hclosed hpathComponent hcompEdge + hsigmaEdge sigmaComponentColor + rw [treeSecondSelected] at hc + by_cases ha : Sum.inr f ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) + · have he := htreeEdge f hf ha + subst f + have hcGamma := currentControl gamma gammaControl + have hsGamma := hsigmaStableQ.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨gamma, hcGamma, by + rw [currentColoring] + simp [TwoColorComponentSwap, ha, hchoiceSecond]⟩ + have hcurGamma : ett.series.data.coloring q.succ choice.edge = + some gamma := by + rw [currentColoring] + simp [TwoColorComponentSwap, ha, hchoiceSecond] + have hsigGamma : sigma choice.edge = some gamma := + hsGamma.trans hcurGamma + have hmem : Sum.inr choice.edge ∈ + TwoColorComponent G sigma gamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hsigGamma] + exact (hsf hmem).elim + · have hsigmaValue : sigma f = some c := hu.symm.trans hcf + have hsig := ((sc1 G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.succ) + (ett.series.data.coloring q.succ) sigma currentProper currentOneUncolored + hsigmaProper hsigmaOne).mp hsigmaStableQ) f hf + (Or.inr ⟨c, currentControl c hc, hsigmaValue⟩) + have hcur : ett.series.data.coloring q.succ f = some c := + (Eq.symm hsig).trans hsigmaValue + have hsecond : secondStable f = some c := by + have hcs : ett.series.data.coloring q.succ f = secondStable f := by + rw [currentColoring] + simp [TwoColorComponentSwap, ha] + exact hcs.symm.trans hcur + exact hsig.trans (hcur.trans hsecond.symm) + +theorem helper_stableSelected_5146.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k), IsProperEdgeColoring G + secondStable → IsOneEdgeUncolored secondStable e0 → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + StableColoring (ett.series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) choice.selected + secondStable → + let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex); IsProperEdgeColoring G undone → IsOneEdgeUncolored undone e0 → + TreeMissingColors secondStable (ett.series.data.tree q.succ.castSucc) = TreeMissingColors + choice.selected (ett.series.data.tree q.succ.castSucc) → StableColoring + (ett.series.data.tree q.succ.castSucc) (insert choice.color (TashkinovStoredColors + ett.series.data q.castSucc) : Finset (Fin k)) secondStable undone → StableColoring + (ett.series.data.tree q.succ.castSucc) (insert choice.color (TashkinovStoredColors + ett.series.data q.castSucc) : Finset (Fin k)) choice.selected undone := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar q gamma secondStable + secondStableProper secondStableOneUncolored choice secondStableRelation undone + undoneProper undoneOne treeSecondSelected stableSecond + exact @helper_stableSelected_2405 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@Tstar) (@gamma) (@secondStable) (@secondStableProper) + (@secondStableOneUncolored) (@choice) (@secondStableRelation) (@undoneProper) + (@undoneOne) (@treeSecondSelected) (@stableSecond) + +theorem helper_hchoiceDefective_5167.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color = + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color → DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hdeltaBoundary + obtain ⟨oldColor, holdDefective, holdEdge⟩ := choice.edgeDefective + have holdColor : oldColor = choice.color := by + have holdEdgeColor := (Finset.mem_filter.mp holdEdge).2 + exact Option.some.inj (holdEdgeColor.symm.trans choice.edgeColor) + subst oldColor + unfold DefectiveColor + rw [← hdeltaBoundary] + exact holdDefective + +theorem helper_hchoiceEdgeNew_5178.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color = + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color → choice.edge ∈ BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hdeltaBoundary + rw [← hdeltaBoundary] + obtain ⟨oldColor, holdDefective, holdEdge⟩ := choice.edgeDefective + have holdColor : oldColor = choice.color := by + have holdEdgeColor := (Finset.mem_filter.mp holdEdge).2 + exact Option.some.inj (holdEdgeColor.symm.trans choice.edgeColor) + simpa [holdColor] using holdEdge + +theorem helper_hnotStrongPrev_5207.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color → ¬ColoredVertexSetStronglyClosed G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev + hchoiceDefective hstrong + have hone : 1 < (BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color).card := by + have htwo : 2 ≤ (BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color).card := hchoiceDefective + omega + obtain ⟨f, hf, g, hg, hfg⟩ := Finset.one_lt_card.mp hone + have hfBoundary := (Finset.mem_filter.mp hf).1 + have hgBoundary := (Finset.mem_filter.mp hg).1 + have hfColor := (Finset.mem_filter.mp hf).2 + have hgColor := (Finset.mem_filter.mp hg).2 + exact (hstrong.2 hfBoundary hgBoundary hfg hfColor) hgColor + +theorem helper_hnewAlternativeFails_5223.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)), + ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) choice.selected rho ∧ + ¬Disjoint (MissingColors G rho choice.otherEndpoint) (TreeMissingColors rho + (ett.series.data.tree q.succ.castSucc))) → + ∀ (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev), StableColoring (ett.series.data.tree + q.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : + Finset (Fin k)) choice.selected sigmaPrev → + ∀ (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hsigmaPrevSelf : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice4049 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected + rho ∧ ¬Disjoint (MissingColors G rho newChoice.otherEndpoint) (TreeMissingColors rho + (ett.series.data.tree q.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper + previousOneUncolored choice seriesAlternativeFails sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hsigmaPrevEnlarged hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice + rcases seriesAlternativeFails with + ⟨rho, hrhoProper, hrhoOne, hrhoStable, hrhoIntersection⟩ + have hreverse : StableColoring + (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc)) + sigmaPrev choice.selected := by + exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc))).symm + (x := ⟨choice.selected, + ⟨choice.selectedProper, choice.selectedOneUncolored⟩⟩) + (y := ⟨sigmaPrev, ⟨hsigmaPrevProper, hsigmaPrevOne⟩⟩) + hsigmaPrevEnlarged + have hrhoNew : StableColoring + (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc)) + sigmaPrev rho := by + exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc))).trans + (x := ⟨sigmaPrev, ⟨hsigmaPrevProper, hsigmaPrevOne⟩⟩) + (y := ⟨choice.selected, + ⟨choice.selectedProper, choice.selectedOneUncolored⟩⟩) + (z := ⟨rho, ⟨hrhoProper, hrhoOne⟩⟩) + hreverse hrhoStable + refine ⟨rho, hrhoProper, hrhoOne, ?_, ?_⟩ + · simpa [newChoice] using hrhoNew + · simpa [newChoice] using hrhoIntersection + +theorem helper_hchoiceSecond_5266.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), StableColoring (ett.series.data.tree + q.succ.castSucc) (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : + Finset (Fin k)) choice.selected secondStable → secondStable choice.edge = some + choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q secondStable choice + secondStableRelation + have hfix := secondStableRelation.1 choice.edge + ⟨choice.vertex, choice.vertexDefective.1, choice.edgeIncident⟩ + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), choice.edgeColor⟩ + exact hfix.trans choice.edgeColor + +theorem helper_hgammaDeltaNe_5272.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (secondStable : PartialEdgeColoring E k) (choice : MaximumDefectiveChoice G + e0 (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data + q.castSucc) (ett.series.data.coloring q.castSucc)), gamma ∈ MissingColors G secondStable + choice.vertex → secondStable choice.edge = some choice.color → gamma ≠ choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma secondStable choice + hgammaSecond hchoiceSecond heq + have hpresent : gamma ∈ PresentColors G secondStable choice.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨choice.edge, choice.edgeIncident, heq ▸ hchoiceSecond⟩ + have hnot : gamma ∉ PresentColors G secondStable choice.vertex := by + simpa [MissingColors] using hgammaSecond + exact hnot hpresent + +theorem helper_hsigmaComponentColor_5296.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (f : E), Sum.inr f ∈ TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) + → sigma f = some gamma ∨ sigma f = some choice.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q gamma choice f hf + have hs : Sum.inr f ∈ + (TwoColorIncidenceGraph G sigma gamma choice.color).support := by + apply SimpleGraph.mem_support_of_reachable + (G := TwoColorIncidenceGraph G sigma gamma choice.color) + (u := Sum.inr f) (v := Sum.inl choice.vertex) (by simp) + exact SimpleGraph.ConnectedComponent.eq.mp hf + obtain ⟨r, hr⟩ := + (TwoColorIncidenceGraph G sigma gamma choice.color).mem_support.mp hs + cases r with + | inl x => exact hr.2 + | inr x => simp [TwoColorIncidenceGraph] at hr + +theorem helper_hrootLeaf_5339.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → gamma ≠ + choice.color → gamma ∈ MissingColors G sigmaPrev choice.vertex → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + (H.neighborSet (Sum.inl choice.vertex)).Subsingleton := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev + hsigmaPrevProper hgammaDeltaNe hgammaPrevMissing H + have hdegree : @SimpleGraph.degree _ H (Sum.inl choice.vertex) + (Fintype.ofFinite _) ≤ 1 := by + simpa [H] using MissingColorIncidenceEndpoint G sigmaPrev gamma + choice.color hgammaDeltaNe hsigmaPrevProper choice.vertex + hgammaPrevMissing + let : Fintype (H.neighborSet (Sum.inl choice.vertex)) := + Fintype.ofFinite _ + intro x hx y hy + have hcard : Fintype.card (H.neighborSet (Sum.inl choice.vertex)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hdegree + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hcard ⟨x, hx⟩ ⟨y, hy⟩) + +theorem helper_branch_5387.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (a b : V ⊕ E) (p : (TwoColorIncidenceGraph G sigmaPrev gamma choice.color).Walk a b), + p.IsPath → {x : V ⊕ E | x ∈ p.support} = TwoColorComponent G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) → Sum.inl choice.vertex ∈ p.support → Sum.inl choice.vertex = b → + ∃ (b : V ⊕ E) (p : H.Walk (Sum.inl choice.vertex) b), p.IsPath ∧ {z : V ⊕ E | z ∈ p.support} = + TwoColorComponent G sigmaPrev gamma choice.color (Sum.inl choice.vertex) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev H a b p + hp hps hrootSupport hb + subst b + refine ⟨a, p.reverse, hp.reverse, ?_⟩ + ext z + change z ∈ p.reverse.support ↔ z ∈ + TwoColorComponent G sigmaPrev gamma choice.color + (Sum.inl choice.vertex) + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] + exact Set.ext_iff.mp hps z + +theorem helper_hpNotNil_5395.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; Sum.inr + choice.edge ∈ TwoColorComponent G sigmaPrev gamma choice.color (Sum.inl choice.vertex) → + ∀ (b : V ⊕ E) (p : H.Walk (Sum.inl choice.vertex) b), {z : V ⊕ E | z ∈ p.support} = + TwoColorComponent G sigmaPrev gamma choice.color (Sum.inl choice.vertex) → ¬p.Nil := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev H + hedgeComponent b p hps hnil + have hedgeSupport : Sum.inr choice.edge ∈ p.support := by + change Sum.inr choice.edge ∈ {z | z ∈ p.support} + rw [hps] + exact hedgeComponent + rw [SimpleGraph.Walk.nil_iff_support_eq.mp hnil] at hedgeSupport + simp at hedgeSupport + +theorem helper_hpNotOne_5434.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), (0 : ℕ) < p.length → p.length ≠ (1 + : ℕ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev H u p + hpPos hone + have hadj := p.adj_getVert_succ (i := 0) (by omega) + have hend := p.getVert_length + rw [hone] at hend + rw [p.getVert_zero, hend] at hadj + simp [H, TwoColorIncidenceGraph] at hadj + +theorem helper_happendTree_5509.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), zeroPrefix.data.tree (Fin.last (1 : ℕ)) = ett.series.data.tree (Fin.last + ett.rounds).castSucc → + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc + := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc gamma + choice prefixInput zeroPrefix hzeroTree zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData + calc + appendedData.tree zeroLast.succ.castSucc = + zeroPrefix.data.tree (Fin.last 1) := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + congr 1 + _ = ett.series.data.tree (Fin.last ett.rounds).castSucc := hzeroTree + _ = ett.series.data.tree q.succ.castSucc := by rw [hqSucc] + +theorem helper_happendColor_5519.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : + ℕ) e0 prefixInput), zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigmaPrev → + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.coloring zeroLast.castSucc = sigmaPrev := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma choice + sigmaPrev prefixInput zeroPrefix hzeroColor zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData + calc + appendedData.coloring zeroLast.castSucc = + zeroPrefix.data.coloring (Fin.last 0) := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_castSucc] + congr 1 + _ = sigmaPrev := hzeroColor + +theorem helper_hpeNoRevisitingZero_5543.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (prefixInput : PartialEdgeColoring + E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; ¬Nonempty (RevisitingExtensionCertificate appendedData zeroLast.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma choice + sigmaPrev H u p prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData + rintro ⟨cert⟩ + obtain ⟨oldCert, -, -, -, -, -⟩ := + (RevisitingExtensionCertificateAppend zeroPrefix.data + closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma zeroLast).1 cert + have hle := oldCert.earlierAtMost + have hpos := oldCert.earlierPositive + simp [zeroLast] at hle + omega + +theorem helper_hpeAlternativeZero_5555.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring + q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring + q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k) + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored + sigmaPrev e0) (hsigmaPrevStableQ : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev) (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice4049 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected + rho ∧ ¬Disjoint (MissingColors G rho newChoice.otherEndpoint) (TreeMissingColors rho + (ett.series.data.tree q.succ.castSucc))) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; + ∀ (happendTree : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree + q.succ.castSucc) (happendColor : appendedData.coloring zeroLast.castSucc = sigmaPrev) + (happendStored : TashkinovStoredColors appendedData zeroLast.castSucc = + TashkinovStoredColors ett.series.data q.castSucc), + let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) + (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring + zeroLast.castSucc) := helperAppendedChoice4500 G k e0 input T generating ett hpositive + sigma closureTree gamma previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf prefixInput zeroPrefix happendTree happendColor happendStored; + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (appendedData.tree zeroLast.succ.castSucc) (insert appendedChoice.color + (TashkinovStoredColors appendedData zeroLast.castSucc) : Finset (Fin k)) + appendedChoice.selected rho ∧ ¬Disjoint (MissingColors G rho appendedChoice.otherEndpoint) + (TreeMissingColors rho (appendedData.tree zeroLast.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma + previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice + hnewAlternativeFails prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData happendTree happendColor happendStored + appendedChoice + rcases hnewAlternativeFails with + ⟨rho, hrhoProper, hrhoOne, hrhoStable, hrhoNotDisjoint⟩ + refine ⟨rho, hrhoProper, hrhoOne, ?_, ?_⟩ + · change StableColoring + (appendedData.tree zeroLast.succ.castSucc) + (insert choice.color + (TashkinovStoredColors appendedData zeroLast.castSucc)) + sigmaPrev rho + rw [happendTree, happendStored] + simpa [appendedChoice, newChoice] using hrhoStable + · change ¬ Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho + (appendedData.tree zeroLast.succ.castSucc)) + rw [happendTree] + simpa [appendedChoice, newChoice] using hrhoNotDisjoint + +theorem helper_hpeGammaRuleZero_5579.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring + q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring + q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k) + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored + sigmaPrev e0) (hsigmaPrevStableQ : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev) (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let _ : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice4049 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; gamma ∈ MissingColors G sigmaPrev choice.vertex → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (prefixInput : PartialEdgeColoring + E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; + ∀ (happendTree : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree + q.succ.castSucc) (happendColor : appendedData.coloring zeroLast.castSucc = sigmaPrev) + (happendStored : TashkinovStoredColors appendedData zeroLast.castSucc = + TashkinovStoredColors ett.series.data q.castSucc), + let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) + (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring + zeroLast.castSucc) := helperAppendedChoice4500 G k e0 input T generating ett hpositive + sigma closureTree gamma previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf prefixInput zeroPrefix happendTree happendColor happendStored; + ParallelExtensionColor appendedData zeroLast.castSucc appendedChoice.selected + appendedChoice.vertex gamma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma + previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice + hgammaPrevMissing H u p prefixInput zeroPrefix zeroLast newStored newEdges newKind + newVertex newOutside newDelta newGamma appendedData happendTree happendColor happendStored + appendedChoice + rw [ParallelExtensionColorAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma + zeroLast appendedChoice.selected appendedChoice.vertex gamma] + refine ⟨?_, Or.inr ?_⟩ + · simpa [appendedChoice, newChoice] using hgammaPrevMissing + · intro h hhPositive hhAtMost hhPE + simp [zeroLast] at hhAtMost + omega + +theorem helper_lastStep_5593.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + ∀ (Tstar closureTree : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree + (Fin.last ett.rounds).castSucc) closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (_ : PartialEdgeColoring E k) (previousProper : IsProperEdgeColoring G + (ett.series.data.coloring q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored + (ett.series.data.coloring q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k) + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored + sigmaPrev e0) (hsigmaPrevStableQ : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev) (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) → sigma = TwoColorComponentSwap G sigmaPrev gamma + choice.color (Sum.inl choice.vertex) → TreeExit (ett.series.data.tree q.succ.castSucc) + sigmaPrev gamma choice.color choice.vertex → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), TashkinovClosure sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree → + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree (Fin.last (2 : ℕ)) = closureTree → appendedData.coloring + (Fin.last (1 : ℕ)) = sigma → appendedData.stored (Fin.last (1 : ℕ)) = newStored → + appendedData.connectingEdges (Fin.last (1 : ℕ)) = newEdges → appendedData.kind (Fin.last + (1 : ℕ)) = newKind → appendedData.chosenVertex (Fin.last (1 : ℕ)) = newVertex → + appendedData.outsideVertex (Fin.last (1 : ℕ)) = newOutside → appendedData.delta (Fin.last + (1 : ℕ)) = newDelta → appendedData.gamma (Fin.last (1 : ℕ)) = newGamma → + ∀ (happendTree : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree + q.succ.castSucc) (happendColor : appendedData.coloring zeroLast.castSucc = sigmaPrev) + (happendStored : TashkinovStoredColors appendedData zeroLast.castSucc = + TashkinovStoredColors ett.series.data q.castSucc), + let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) + (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring + zeroLast.castSucc) := helperAppendedChoice4500 G k e0 input T generating ett hpositive + sigma closureTree gamma previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf prefixInput zeroPrefix happendTree happendColor happendStored; ¬Nonempty + (RevisitingExtensionCertificate appendedData zeroLast.castSucc) → ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (appendedData.tree zeroLast.succ.castSucc) (insert appendedChoice.color + (TashkinovStoredColors appendedData zeroLast.castSucc) : Finset (Fin k)) + appendedChoice.selected rho ∧ ¬Disjoint (MissingColors G rho appendedChoice.otherEndpoint) + (TreeMissingColors rho (appendedData.tree zeroLast.succ.castSucc))) → + ParallelExtensionColor appendedData zeroLast.castSucc appendedChoice.selected + appendedChoice.vertex gamma → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length + < closureTree.length → TashkinovSeriesStep G k (1 : ℕ) e0 prefixInput appendedData + (Fin.last (1 : ℕ)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne _ + closureTree hTnClosure q hqSucc gamma secondStable previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf hclosedPrev hnotStrongPrev hsigmaRecovered hnewExit + prefixInput zeroPrefix hterminalClosure zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData happendLastTree happendLastColor + happendLastStored happendLastEdges happendLastKind happendLastVertex happendLastOutside + happendLastDelta happendLastGamma happendTree happendColor happendStored appendedChoice + hpeNoRevisitingZero hpeAlternativeZero hpeGammaRuleZero hstrictClosure + have hlast : zeroLast.succ = Fin.last 1 := by + apply Fin.ext + rfl + rw [← hlast] + apply TashkinovSeriesStep.PE (i := zeroLast) + (choice := appendedChoice) (gamma := gamma) + (secondStable := sigmaPrev) + · rw [happendColor]; exact hsigmaPrevProper + · rw [happendColor]; exact hsigmaPrevOne + · rw [happendColor, happendTree]; exact hclosedPrev + · rw [happendColor, happendTree]; exact hnotStrongPrev + · exact hpeNoRevisitingZero + · exact hpeAlternativeZero + · exact hpeGammaRuleZero + · exact hsigmaPrevProper + · exact hsigmaPrevOne + · exact (sc2 G e0 + (appendedData.tree zeroLast.succ.castSucc) + (insert appendedChoice.color + (TashkinovStoredColors appendedData zeroLast.castSucc))).refl + ⟨sigmaPrev, hsigmaPrevProper, hsigmaPrevOne⟩ + · change TreeExit (appendedData.tree zeroLast.succ.castSucc) + sigmaPrev gamma choice.color choice.vertex + rw [happendTree] + exact hnewExit + · exact happendLastColor.trans hsigmaRecovered + · rw [hlast, happendLastColor] + exact hsigmaProper + · rw [hlast, happendLastColor] + exact hsigmaOne + · exact happendLastStored.trans (by rfl) + · exact happendLastEdges.trans (by rfl) + · exact happendLastKind.trans (by rfl) + · exact happendLastVertex.trans (by rfl) + · exact happendLastOutside.trans (by rfl) + · exact happendLastDelta.trans (by rfl) + · exact happendLastGamma.trans (by rfl) + · change TashkinovClosure + (appendedData.coloring (Fin.last 1)) + (appendedData.tree zeroLast.succ.castSucc) + (appendedData.tree (Fin.last 2)) + rw [happendLastColor, happendTree, happendLastTree] + simpa [hqSucc] using hterminalClosure + · change TreeSequenceInitialSegment + (appendedData.tree zeroLast.succ.castSucc) + (appendedData.tree (Fin.last 2)) + rw [happendTree] + rw [happendLastTree] + simpa [hqSucc] using hTnClosure + · change (appendedData.tree zeroLast.succ.castSucc).length < + (appendedData.tree (Fin.last 2)).length + rw [happendTree] + rw [happendLastTree] + simpa [hqSucc] using hstrictClosure + +theorem helper_hfinalTree_5720.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree (Fin.last (2 : ℕ)) = closureTree → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawTreeIndex : Fin (ett.rounds + (2 : ℕ)) → Fin (3 : ℕ) := fun (i : Fin (ett.rounds + (2 : + ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; rawTreeIndex (Fin.last (ett.rounds + (1 : ℕ))) = Fin.last (2 : ℕ) → finalSeries.data.tree + (Fin.last (ett.rounds + (1 : ℕ))) = closureTree := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma choice + prefixInput zeroPrefix newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendLastTree extendedSeries hextendedData hroundsEq castSeries + castSeriesTree finalSeries rawTreeIndex hrawFinalTree + calc + finalSeries.data.tree (Fin.last (ett.rounds + 1)) = + extendedSeries.data.tree + (rawTreeIndex (Fin.last (ett.rounds + 1))) := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree + (rawTreeIndex (Fin.last (ett.rounds + 1))) := by + rw [hextendedData] + _ = appendedData.tree (Fin.last 2) := by rw [hrawFinalTree] + _ = closureTree := happendLastTree + +theorem helper_hpenultimateTree_5732.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (prefixInput : PartialEdgeColoring + E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc + → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawTreeIndex : Fin (ett.rounds + (2 : ℕ)) → Fin (3 : ℕ) := fun (i : Fin (ett.rounds + (2 : + ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; rawTreeIndex (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = zeroLast.succ.castSucc → finalSeries.data.tree (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q hqSucc gamma + choice sigmaPrev H u p prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData happendTree extendedSeries hextendedData + hroundsEq castSeries castSeriesTree finalSeries rawTreeIndex hrawPenultimate + exact @helper_hpenultimateTree_3400 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@Tstar) (@closureTree) (@hqSucc) (@gamma) (@choice) (@sigmaPrev) (@u) + (@p) (@prefixInput) (@zeroPrefix) (@happendTree) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesTree) (@hrawPenultimate) + +theorem helper_hfinalColor_5740.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.coloring (Fin.last (1 : ℕ)) = sigma → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawDataIndex : Fin (ett.rounds + (1 : ℕ)) → Fin (2 : ℕ) := fun (i : Fin (ett.rounds + (1 : + ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; rawDataIndex (Fin.last ett.rounds) = Fin.last (1 : ℕ) → finalSeries.data.coloring + (Fin.last ett.rounds) = sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma choice + prefixInput zeroPrefix newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendLastColor extendedSeries hextendedData hroundsEq castSeries + castSeriesColoring finalSeries rawDataIndex hrawFinalData + calc + finalSeries.data.coloring (Fin.last ett.rounds) = + extendedSeries.data.coloring + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesColoring hroundsEq extendedSeries _ + _ = appendedData.coloring + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = appendedData.coloring (Fin.last 1) := by rw [hrawFinalData] + _ = sigma := happendLastColor + +theorem helper_hseriesTreeAgree_5768.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc + → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + ∀ (j : Fin ett.rounds), finalSeries.data.tree j.succ.castSucc = ett.series.data.tree + j.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q hqSucc gamma + choice sigmaPrev H u p hroundOne prefixInput zeroPrefix zeroLast newStored newEdges newKind + newVertex newOutside newDelta newGamma appendedData happendTree extendedSeries + hextendedData hroundsEq castSeries castSeriesTree finalSeries + exact @helper_hseriesTreeAgree_3561 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@Tstar) (@closureTree) (@hqSucc) (@gamma) (@choice) (@sigmaPrev) (@u) + (@p) (@hroundOne) (@prefixInput) (@zeroPrefix) (@happendTree) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesTree) + +theorem helper_hseriesColorProperties_5776.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + ∀ (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; appendedData.coloring zeroLast.castSucc = sigmaPrev → + ∀ (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput), + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma → + ∀ (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; finalSeries.data.coloring (Fin.last ett.rounds) = sigma → + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ + IsOneEdgeUncolored (finalSeries.data.coloring i) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne Tstar + closureTree q gamma choice sigmaPrev hsigmaPrevProper hsigmaPrevOne H u p hroundOne + prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData happendColor extendedSeries hextendedData hroundsEq castSeries + castSeriesColoring finalSeries hfinalColor + exact @helper_hseriesColorProperties_3585 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@hsigmaProper) (@hsigmaOne) (@Tstar) (@closureTree) (@gamma) (@choice) + (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@u) (@p) (@hroundOne) + (@prefixInput) (@zeroPrefix) (@happendColor) (@extendedSeries) (@hextendedData) + (@hroundsEq) (@castSeriesColoring) (@hfinalColor) + +theorem helper_hseriesStable_5785.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), StableColoring (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring + (Fin.last ett.rounds)) sigma → + ∀ (_ _ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), ett.rounds = (1 : ℕ) → + ∀ (prefixInput : PartialEdgeColoring E k) (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 + : ℕ)) e0 prefixInput) (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 prefixInput → TashkinovSeries G + k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) + ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + prefixInput) S b h; + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; finalSeries.data.coloring (Fin.last ett.rounds) = sigma → + ∀ (j : Fin ett.rounds), StableColoring (ett.series.data.tree j.succ.castSucc) + (TashkinovStoredColors ett.series.data j.succ) (ett.series.data.coloring j.succ) + (finalSeries.data.coloring j.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaStable _ closureTree q + gamma choice sigmaPrev H u p hroundOne prefixInput extendedSeries hroundsEq castSeries + finalSeries hfinalColor j + have hj : j.succ = Fin.last ett.rounds := by + apply Fin.ext + have hjbound := j.isLt + simp + have hr := hroundOne + omega + rw [hj, hfinalColor] + exact hsigmaStable + +theorem helper_branch_5820.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ((ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last + ett.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence sigma seed Tstar) → Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q hqSucc hpeKind hsimple + rcases hsimple.1 with hse | hre + · have hbad := hpeKind.symm.trans (by simpa [hqSucc] using hse) + cases hbad + · have hbad := hpeKind.symm.trans (by simpa [hqSucc] using hre) + cases hbad + +theorem helper_hreplacementCurrentTree_5844.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc → + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree replacementLast.succ = ett.series.data.tree + q.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q hqSucc sigmaPrev originalPrefix + corr hcorrFinalTree replacementLast + have hlastTree : replacementLast.succ = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [replacementLast] + rw [hlastTree, hcorrFinalTree, hqSucc] + +theorem helper_horiginalCurrentTree_5852.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + (0 : ℕ) < originalPrefix.rounds → originalPrefix.series.data.tree replacementLast.castSucc + = ett.series.data.tree q.castSucc.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev H u p + hroundLarge originalPrefix hr hprefixTrees replacementLast horiginalPositive + calc + originalPrefix.series.data.tree replacementLast.castSucc = + ett.series.data.tree + (Fin.castLE (by omega) replacementLast.castSucc) := + hprefixTrees replacementLast.castSucc + _ = ett.series.data.tree q.castSucc.castSucc := by + congr 1 + apply Fin.ext + simp [replacementLast, q, hr] + +theorem helper_htreeMissingEq_5864.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (originalPrefix : + ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (horiginalPositive : (0 : ℕ) < originalPrefix.rounds), + let previousReplacement : Fin originalPrefix.rounds := (⟨originalPrefix.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin originalPrefix.rounds); previousReplacement.succ = replacementLast → TreeMissingColors + (corr.replacementSeries.data.coloring replacementLast) (corr.replacementSeries.data.tree + replacementLast.castSucc) = TreeMissingColors (originalPrefix.series.data.coloring + replacementLast) (originalPrefix.series.data.tree replacementLast.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev H u p + originalPrefix corr replacementLast horiginalPositive previousReplacement hpreviousSucc + have hstable := corr.replacementStable previousReplacement + rw [hpreviousSucc] at hstable + have htree := corr.ladderTreesAgree previousReplacement + rw [hpreviousSucc] at htree + rw [htree] + ext c + simp only [TreeMissingColors, Finset.mem_biUnion] + constructor + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, (hstable.2 v hv).symm ▸ hc⟩ + · rintro ⟨v, hv, hc⟩ + exact ⟨v, hv, hstable.2 v hv ▸ hc⟩ + +theorem helper_hreplacementStored_5882.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (_ : (0 : ℕ) < originalPrefix.rounds), Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) replacementLast = q.castSucc → TreeMissingColors (corr.replacementSeries.data.coloring + replacementLast) (corr.replacementSeries.data.tree replacementLast.castSucc) = + TreeMissingColors (originalPrefix.series.data.coloring replacementLast) + (originalPrefix.series.data.tree replacementLast.castSucc) → TashkinovStoredColors + corr.replacementSeries.data replacementLast = TashkinovStoredColors ett.series.data + q.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev H u p + hroundLarge originalPrefix hr hprefixData corr replacementLast horiginalPositive hlastMap + htreeMissingEq + have hcorrStored : TashkinovStoredColors + corr.replacementSeries.data replacementLast = + TashkinovStoredColors originalPrefix.series.data + replacementLast := by + unfold TashkinovStoredColors + have hnonzero : replacementLast.val ≠ 0 := by + simp only [Fin.val_last, ne_eq, replacementLast] + exact Nat.ne_of_gt horiginalPositive + rw [ite_eq_right hnonzero, ite_eq_right hnonzero] + ext c + simp only [Finset.mem_sdiff, Finset.mem_biUnion] + constructor + · rintro ⟨⟨j, hj, hc⟩, hn⟩ + refine ⟨⟨j, hj, ?_⟩, ?_⟩ + · by_cases hle : j.val ≤ replacementLast.val + · simp only [ite_eq_left hle] at hc ⊢ + simpa [corr.storedColorsAgree j] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rw [htreeMissingEq] at hn + exact hn + · rintro ⟨⟨j, hj, hc⟩, hn⟩ + refine ⟨⟨j, hj, ?_⟩, ?_⟩ + · by_cases hle : j.val ≤ replacementLast.val + · simp only [ite_eq_left hle] at hc ⊢ + simpa [corr.storedColorsAgree j] using hc + · simp only [ite_eq_right hle] at hc ⊢ + exact hc + · rw [← htreeMissingEq] at hn + exact hn + calc + TashkinovStoredColors corr.replacementSeries.data replacementLast = + TashkinovStoredColors originalPrefix.series.data + replacementLast := hcorrStored + _ = TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) replacementLast) := + (hprefixData replacementLast).2.2.2.2 + _ = TashkinovStoredColors ett.series.data q.castSucc := by + rw [hlastMap] + +theorem helper_hnoRevisitingReplacement_5934.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), MaximumProperty ett → + ∀ (hpositive : (0 : ℕ) < ett.rounds), LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k), IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → ¬Nonempty + (RevisitingExtensionCertificate ett.series.data q.castSucc) → + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), p.IsPath → (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), + MaximumProperty originalPrefix → ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), corr.replacementSeries.data.tree + (Fin.last (originalPrefix.rounds + (1 : ℕ))) = ett.series.data.tree (Fin.last + ett.rounds).castSucc → corr.replacementSeries.data.coloring (Fin.last + originalPrefix.rounds) = sigmaPrev → MaximumProperty corr.replacementETT → + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ¬Nonempty (RevisitingExtensionCertificate corr.replacementSeries.data replacementLast) := by + classical + intro V E _ _ _ G k e0 input T generating ett hMP hpositive hlower _ q gamma previousProper + previousOneUncolored noRevisiting choice sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ H u p hp hroundLarge originalPrefix hr hprefixMP hprefixTrees hprefixData + corr hcorrFinalTree hcorrFinalColor hcorrMP replacementLast + exact P2971_T1_PositivePrefixNoRevisiting G k e0 input T generating + ett hMP hroundLarge + (fun lower hp hl hm => + ⟨(hlower lower hp hl hm).2.1, + (hlower lower hp hl hm).2.2.2.1⟩) + sigmaPrev hsigmaPrevProper hsigmaPrevOne previousProper + previousOneUncolored hsigmaPrevStableQ originalPrefix hr + hprefixMP hprefixTrees hprefixData corr hcorrFinalTree + hcorrFinalColor hcorrMP noRevisiting + +theorem helper_hpeAlternativeReplacement_5946.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G + sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) sigmaPrev) + (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice4049 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected + rho ∧ ¬Disjoint (MissingColors G rho newChoice.otherEndpoint) (TreeMissingColors rho + (ett.series.data.tree q.succ.castSucc))) → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)) + (hcorrFinalColor : corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = + sigmaPrev), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (hreplacementCurrentTree : corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree q.succ.castSucc) (hreplacementStored : TashkinovStoredColors + corr.replacementSeries.data replacementLast = TashkinovStoredColors ett.series.data + q.castSucc), + let replacementChoice : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + replacementLast.succ) (TashkinovStoredColors corr.replacementSeries.data replacementLast) + (corr.replacementSeries.data.coloring replacementLast) := helperReplacementChoice5196 G k + e0 input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf originalPrefix corr hcorrFinalColor hreplacementCurrentTree + hreplacementStored; + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (corr.replacementSeries.data.tree replacementLast.succ) (insert + replacementChoice.color (TashkinovStoredColors corr.replacementSeries.data + replacementLast) : Finset (Fin k)) replacementChoice.selected rho ∧ ¬Disjoint + (MissingColors G rho replacementChoice.otherEndpoint) (TreeMissingColors rho + (corr.replacementSeries.data.tree replacementLast.succ)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternativeFails + originalPrefix corr hcorrFinalColor replacementLast hreplacementCurrentTree + hreplacementStored replacementChoice + rcases hnewAlternativeFails with + ⟨rho, hrhoProper, hrhoOne, hrhoStable, hrhoNotDisjoint⟩ + refine ⟨rho, hrhoProper, hrhoOne, ?_, ?_⟩ + · change StableColoring + (corr.replacementSeries.data.tree replacementLast.succ) + (insert choice.color + (TashkinovStoredColors corr.replacementSeries.data + replacementLast)) sigmaPrev rho + rw [hreplacementCurrentTree, hreplacementStored] + simpa [replacementChoice, newChoice] using hrhoStable + · change ¬ Disjoint (MissingColors G rho choice.otherEndpoint) + (TreeMissingColors rho + (corr.replacementSeries.data.tree replacementLast.succ)) + rw [hreplacementCurrentTree] + simpa [replacementChoice, newChoice] using hrhoNotDisjoint + +theorem helper_hne_6004.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch + : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), g ∈ + MissingColors G second ch.vertex → second ch.edge = some ch.color → g ≠ ch.color := by + classical + intro V E _ _ G k e0 X C phi ch g second hgSecond hedgeSecond heq + have hpresent : g ∈ PresentColors G second ch.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨ch.edge, ch.edgeIncident, by simpa [heq] using hedgeSecond⟩ + have hnotPresent : g ∉ PresentColors G second ch.vertex := by + simpa [MissingColors] using hgSecond + exact hnotPresent hpresent + +theorem helper_hindexMap_6123.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : (0 : ℕ) < originalPrefix.rounds) (j : Fin + (originalPrefix.rounds + (1 : ℕ))), + let fullj : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j; + ∀ (fulli : Fin ett.rounds), fulli.succ = fullj → + ∀ (newi : Fin originalPrefix.rounds), j = newi.succ → newi.succ = j → Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) newi.succ = fulli.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev H u p + hroundLarge originalPrefix hr corr horiginalPositive j fullj fulli hfullIndex newi + hnewTarget hnewIndex + apply Fin.ext + have hf := congrArg Fin.val hfullIndex + have hn := congrArg Fin.val hnewIndex + simp [fullj] at hf hn ⊢ + omega + +theorem helper_htree_6130.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : (0 : ℕ) < + originalPrefix.rounds) (j : Fin (originalPrefix.rounds + (1 : ℕ))), + let fullj : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j; + ∀ (fulli : Fin ett.rounds), fulli.succ = fullj → + ∀ (newi : Fin originalPrefix.rounds), j = newi.succ → newi.succ = j → + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + fulli.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev H u p + hroundLarge originalPrefix hr hprefixTrees corr horiginalPositive j fullj fulli hfullIndex + newi hnewTarget hnewIndex + calc + corr.replacementSeries.data.tree newi.succ.castSucc = + originalPrefix.series.data.tree + newi.succ.castSucc := corr.ladderTreesAgree newi + _ = ett.series.data.tree + (Fin.castLE (by omega) newi.succ.castSucc) := + hprefixTrees newi.succ.castSucc + _ = ett.series.data.tree fulli.succ.castSucc := by + congr 1 + apply Fin.ext + have hf := congrArg Fin.val hfullIndex + have hn := congrArg Fin.val hnewIndex + simp [fullj] at hf hn ⊢ + omega + +theorem helper_hprefixPostFull_6259.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : (0 : ℕ) < + originalPrefix.rounds) (j : Fin (originalPrefix.rounds + (1 : ℕ))), + let fullj : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j; + ∀ (fulli : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)), fullj = fulli.succ → + ∀ (newi : Fin originalPrefix.rounds), newi.succ = j → corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree fulli.succ.castSucc → + originalPrefix.series.data.coloring newi.succ = ett.series.data.coloring fulli.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev H u p + hroundLarge originalPrefix hr hprefixData corr horiginalPositive j fullj fulli fullChoice + hfullTarget newi hnewIndex htree + calc + originalPrefix.series.data.coloring newi.succ = + originalPrefix.series.data.coloring j := by + rw [hnewIndex] + _ = ett.series.data.coloring + (Fin.castLE (by omega) j) := + (hprefixData j).1 + _ = ett.series.data.coloring fulli.succ := by + congr 1 + +theorem helper_branch_6368.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring + q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring + q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), ParallelExtensionColor ett.series.data q.castSucc + choice.selected choice.vertex gamma → + ∀ (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev) (hchoiceDefective : DefectiveColor G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + sigmaPrev sigmaPrev), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (hcorrFinalColor : corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = sigmaPrev), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (_ : (0 : ℕ) < originalPrefix.rounds) (hreplacementCurrentTree : + corr.replacementSeries.data.tree replacementLast.succ = ett.series.data.tree + q.succ.castSucc) (hreplacementStored : TashkinovStoredColors corr.replacementSeries.data + replacementLast = TashkinovStoredColors ett.series.data q.castSucc), + let replacementChoice : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + replacementLast.succ) (TashkinovStoredColors corr.replacementSeries.data replacementLast) + (corr.replacementSeries.data.coloring replacementLast) := helperReplacementChoice5196 G k + e0 input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf originalPrefix corr hcorrFinalColor hreplacementCurrentTree + hreplacementStored; ( + ∀ (j : Fin (originalPrefix.rounds + (1 : ℕ))), corr.replacementSeries.data.kind j = + ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j)) → ( + ∀ (j : Fin (originalPrefix.rounds + (1 : ℕ))), (0 : ℕ) < (↑j : ℕ) → + corr.replacementSeries.data.kind j = some TashkinovExtensionKind.PE → + corr.replacementSeries.data.chosenVertex j = ett.series.data.chosenVertex (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j) ∧ corr.replacementSeries.data.delta j = ett.series.data.delta (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j) ∧ corr.replacementSeries.data.gamma j = ett.series.data.gamma (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) j)) → ( + ∃ (h : Fin (originalPrefix.rounds + (1 : ℕ))), (0 : ℕ) < (↑h : ℕ) ∧ (↑h : ℕ) ≤ + (↑replacementLast : ℕ) ∧ corr.replacementSeries.data.kind h = some + TashkinovExtensionKind.PE ∧ corr.replacementSeries.data.chosenVertex h = some + replacementChoice.vertex ∧ corr.replacementSeries.data.delta h = some gamma ∧ + ∀ (j : Fin (originalPrefix.rounds + (1 : ℕ))), (0 : ℕ) < (↑j : ℕ) → (↑j : ℕ) ≤ + (↑replacementLast : ℕ) → corr.replacementSeries.data.kind j = some + TashkinovExtensionKind.PE → corr.replacementSeries.data.chosenVertex j = some + replacementChoice.vertex → (↑j : ℕ) ≤ (↑h : ℕ)) ∨ + ∀ (h : Fin (originalPrefix.rounds + (1 : ℕ))), (0 : ℕ) < (↑h : ℕ) → (↑h : ℕ) ≤ + (↑replacementLast : ℕ) → corr.replacementSeries.data.kind h = some + TashkinovExtensionKind.PE → corr.replacementSeries.data.chosenVertex h ≠ some + replacementChoice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma previousProper + previousOneUncolored choice gammaRule sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf H u p hroundLarge + originalPrefix hr corr hcorrFinalColor replacementLast horiginalPositive + hreplacementCurrentTree hreplacementStored replacementChoice retainedKind retainedPEFields + rcases gammaRule.2 with history | noHistory + · rcases history with + ⟨h, hhPositive, hhAtMost, hhPE, hhVertex, hhDelta, hhMax⟩ + let j : Fin (originalPrefix.rounds + 1) := + ⟨h.val, by + have hb := h.isLt + simp [hr, q] at hhAtMost ⊢ + omega⟩ + have hjFull : Fin.castLE (by omega) j = h := by + apply Fin.ext + rfl + have hjPE : corr.replacementSeries.data.kind j = + some TashkinovExtensionKind.PE := by + rw [retainedKind j, hjFull] + exact hhPE + have hfields := retainedPEFields j hhPositive hjPE + refine Or.inl ⟨j, hhPositive, ?_, hjPE, ?_, ?_, ?_⟩ + · simp [j, replacementLast, q, hr] at hhAtMost ⊢ + omega + · rw [hfields.1, hjFull] + exact hhVertex + · rw [hfields.2.1, hjFull] + exact hhDelta + · intro r hrPositive hrAtMost hrPE hrVertex + let fullr : Fin (ett.rounds + 1) := Fin.castLE (by omega) r + have hrFields := retainedPEFields r hrPositive hrPE + apply hhMax fullr + · exact hrPositive + · simp [fullr, replacementLast, q, hr] at hrAtMost ⊢ + omega + · simpa [fullr] using (retainedKind r).symm.trans hrPE + · simpa [fullr, replacementChoice] using + hrFields.1.symm.trans hrVertex + · refine Or.inr ?_ + intro j hjPositive hjAtMost hjPE hjVertex + let fullj : Fin (ett.rounds + 1) := Fin.castLE (by omega) j + have hfields := retainedPEFields j hjPositive hjPE + apply noHistory fullj hjPositive + · simp [fullj, replacementLast, q, hr] at hjAtMost ⊢ + omega + · simpa [fullj] using (retainedKind j).symm.trans hjPE + · simpa [fullj, replacementChoice] using + hfields.1.symm.trans hjVertex + +theorem helper_hnoRevisitingAppended_6477.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ¬Nonempty (RevisitingExtensionCertificate corr.replacementSeries.data replacementLast) → + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; ¬Nonempty (RevisitingExtensionCertificate + appendedData replacementLast.castSucc) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma choice + sigmaPrev originalPrefix corr replacementLast hnoRevisitingReplacement newStored newEdges + newKind newVertex newOutside newDelta newGamma appendedData + rintro ⟨cert⟩ + obtain ⟨oldCert, -, -, -, -, -⟩ := + (RevisitingExtensionCertificateAppend + corr.replacementSeries.data closureTree sigma newStored + newEdges newKind newVertex newOutside newDelta newGamma + replacementLast).1 cert + exact hnoRevisitingReplacement ⟨oldCert⟩ + +theorem helper_hfinalPenultimateTree_6673.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + ∀ (_ : (0 : ℕ) < originalPrefix.rounds), corr.replacementSeries.data.tree replacementLast.succ + = ett.series.data.tree q.succ.castSucc → + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (2 + : ℕ))), (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let rawPenultimate : Fin (originalPrefix.rounds + (3 : ℕ)) := Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))); rawPenultimate = replacementLast.succ.castSucc → + finalSeries.data.tree (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc gamma + choice sigmaPrev H u p hroundLarge originalPrefix hr corr replacementLast horiginalPositive + hreplacementCurrentTree newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesTree finalSeries + rawPenultimate hrawPenultimate + calc + finalSeries.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + extendedSeries.data.tree rawPenultimate := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree rawPenultimate := by + rw [hextendedData] + _ = corr.replacementSeries.data.tree + replacementLast.succ := by + rw [hrawPenultimate] + simp only [appendedData, + TashkinovSeriesDataAppend] + exact Fin.lastCases_castSucc replacementLast.succ + _ = ett.series.data.tree + (Fin.last ett.rounds).castSucc := by + exact hreplacementCurrentTree.trans + (congrArg ett.series.data.tree + (congrArg Fin.castSucc hqSucc)) + +theorem helper_hfinalTree_6703.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (2 + : ℕ))), (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let rawFinalTree : Fin (originalPrefix.rounds + (3 : ℕ)) := Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) (Fin.last (ett.rounds + (1 : ℕ))); rawFinalTree = Fin.last (originalPrefix.rounds + (2 : ℕ)) + → finalSeries.data.tree (Fin.last (ett.rounds + (1 : ℕ))) = closureTree := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma choice + sigmaPrev originalPrefix corr newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesTree + finalSeries rawFinalTree hrawFinalTree + calc + finalSeries.data.tree (Fin.last (ett.rounds + 1)) = + extendedSeries.data.tree rawFinalTree := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree rawFinalTree := by rw [hextendedData] + _ = closureTree := by + rw [hrawFinalTree] + simp [appendedData, TashkinovSeriesDataAppend] + +theorem helper_hfinalColor_6721.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let rawFinalColor : Fin (originalPrefix.rounds + (2 : ℕ)) := Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) (Fin.last ett.rounds); rawFinalColor = Fin.last (originalPrefix.rounds + (1 : ℕ)) → + finalSeries.data.coloring (Fin.last ett.rounds) = sigma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma choice + sigmaPrev originalPrefix corr newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesColoring + finalSeries rawFinalColor hrawFinalColor + calc + finalSeries.data.coloring (Fin.last ett.rounds) = + extendedSeries.data.coloring rawFinalColor := by + exact castSeriesColoring hroundsEq extendedSeries _ + _ = appendedData.coloring rawFinalColor := by + rw [hextendedData] + _ = sigma := by + rw [hrawFinalColor] + simp [appendedData, TashkinovSeriesDataAppend] + +theorem helper_branch_6743.{u_1, u_2} : + helperBranch6743Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma choice + sigmaPrev H u p hroundLarge originalPrefix hr hprefixData corr horiginalPositive newStored + newEdges newKind newVertex newOutside newDelta newGamma appendedData extendedSeries + hextendedData hroundsEq castSeries castSeriesStored castSeriesEdges castSeriesKind + finalSeries rawDataIndex i hi + let j : Fin (originalPrefix.rounds + 1) := + ⟨i.val, by rw [hroundsEq]; exact hi⟩ + have hraw : rawDataIndex i = j.castSucc := by + apply Fin.ext + rfl + have hmap : Fin.castLE (by omega) j = i := by + apply Fin.ext + rfl + constructor + · calc + finalSeries.data.stored i = + extendedSeries.data.stored (rawDataIndex i) := by + exact castSeriesStored hroundsEq extendedSeries i + _ = appendedData.stored (rawDataIndex i) := by + rw [hextendedData] + _ = corr.replacementSeries.data.stored j := by + rw [hraw] + simp [appendedData, TashkinovSeriesDataAppend] + _ = originalPrefix.series.data.stored j := + corr.storedColorsAgree j + _ = ett.series.data.stored (Fin.castLE (by omega) j) := + (hprefixData j).2.1 + _ = ett.series.data.stored i := by rw [hmap] + · constructor + · calc + finalSeries.data.connectingEdges i = + extendedSeries.data.connectingEdges + (rawDataIndex i) := by + exact castSeriesEdges hroundsEq + extendedSeries i + _ = appendedData.connectingEdges + (rawDataIndex i) := by rw [hextendedData] + _ = corr.replacementSeries.data.connectingEdges j := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = originalPrefix.series.data.connectingEdges j := + corr.connectingEdgesAgree j + _ = ett.series.data.connectingEdges + (Fin.castLE (by omega) j) := + (hprefixData j).2.2.1 + _ = ett.series.data.connectingEdges i := by rw [hmap] + · calc + finalSeries.data.kind i = + extendedSeries.data.kind (rawDataIndex i) := by + exact castSeriesKind hroundsEq extendedSeries i + _ = appendedData.kind (rawDataIndex i) := by + rw [hextendedData] + _ = corr.replacementSeries.data.kind j := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = originalPrefix.series.data.kind j := + corr.extensionKindsAgree j + _ = ett.series.data.kind + (Fin.castLE (by omega) j) := + (hprefixData j).2.2.2.1 + _ = ett.series.data.kind i := by rw [hmap] + +theorem helper_branch_6801.{u_1, u_2} : + helperBranch6801Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q hqSucc gamma + choice currentStored currentEdges currentKind sigmaPrev H u p hroundLarge originalPrefix hr + corr horiginalPositive newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesStored + castSeriesEdges castSeriesKind finalSeries rawDataIndex i hi + have hilast : i = Fin.last ett.rounds := by + apply Fin.ext + simp + omega + subst i + have hraw : rawDataIndex (Fin.last ett.rounds) = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [rawDataIndex] + constructor + · calc + finalSeries.data.stored (Fin.last ett.rounds) = + extendedSeries.data.stored + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesStored hroundsEq extendedSeries _ + _ = appendedData.stored + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = newStored := by + rw [hraw] + simp [appendedData, TashkinovSeriesDataAppend] + _ = {choice.color, gamma} := rfl + _ = ett.series.data.stored (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentStored.symm + · constructor + · calc + finalSeries.data.connectingEdges + (Fin.last ett.rounds) = + extendedSeries.data.connectingEdges + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesEdges hroundsEq + extendedSeries _ + _ = appendedData.connectingEdges + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = newEdges := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = {choice.edge} := rfl + _ = ett.series.data.connectingEdges + (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentEdges.symm + · calc + finalSeries.data.kind (Fin.last ett.rounds) = + extendedSeries.data.kind + (rawDataIndex (Fin.last ett.rounds)) := by + exact castSeriesKind hroundsEq extendedSeries _ + _ = appendedData.kind + (rawDataIndex (Fin.last ett.rounds)) := by + rw [hextendedData] + _ = newKind := by + rw [hraw] + simp [appendedData, + TashkinovSeriesDataAppend] + _ = some TashkinovExtensionKind.PE := rfl + _ = ett.series.data.kind + (Fin.last ett.rounds) := by + rw [← hqSucc] + exact currentKind.symm + +private theorem helper_branch_5283.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < ett.rounds) (originalPrefix + : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + omega + ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput) (_ : extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma) (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ (h ▸ S); + ∀ (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (2 + : ℕ))), (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by + omega + ) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + let _ : Fin (ett.rounds + (2 : ℕ)) → Fin (originalPrefix.rounds + (3 : ℕ)) := fun (i : Fin + (ett.rounds + (2 : ℕ))) ↦ Fin.cast ( + by + omega + ) i; + ∀ (i : Fin ett.rounds) (_ : (↑i : ℕ) < originalPrefix.rounds), finalSeries.data.tree + i.succ.castSucc = ett.series.data.tree i.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree q gamma choice + sigmaPrev hroundLarge originalPrefix hr hprefixTrees corr newStored newEdges newKind + newVertex newOutside newDelta newGamma appendedData extendedSeries hextendedData hroundsEq + castSeries castSeriesTree finalSeries rawTreeIndex i hi + let j : Fin originalPrefix.rounds := ⟨i.val, hi⟩ + have hraw : rawTreeIndex i.succ.castSucc = + j.succ.castSucc.castSucc := by + apply Fin.ext + rfl + have hmap : Fin.castLE (by omega) j.succ.castSucc = + i.succ.castSucc := by + apply Fin.ext + rfl + calc + finalSeries.data.tree i.succ.castSucc = + extendedSeries.data.tree + (rawTreeIndex i.succ.castSucc) := by + exact castSeriesTree hroundsEq extendedSeries _ + _ = appendedData.tree + (rawTreeIndex i.succ.castSucc) := by + rw [hextendedData] + _ = corr.replacementSeries.data.tree + j.succ.castSucc := by + rw [hraw] + simp only [appendedData, + TashkinovSeriesDataAppend] + convert (Fin.lastCases_castSucc + j.succ.castSucc) using 1 + _ = originalPrefix.series.data.tree + j.succ.castSucc := corr.ladderTreesAgree j + _ = ett.series.data.tree + (Fin.castLE (by omega) j.succ.castSucc) := + hprefixTrees j.succ.castSucc + _ = ett.series.data.tree i.succ.castSucc := by rw [hmap] + +private theorem helper_branch_5314.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (_ : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (extendedSeries : TashkinovSeries G k + (originalPrefix.rounds + (1 : ℕ)) e0 corr.replacementInput) (hroundsEq : + originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ (h ▸ S); + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; + ∀ (_ : finalSeries.data.tree (⟨ett.rounds, + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc) (i : + Fin ett.rounds) (_ : ¬(↑i : ℕ) < originalPrefix.rounds), finalSeries.data.tree + i.succ.castSucc = ett.series.data.tree i.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett sigmaPrev hroundLarge originalPrefix hr corr + extendedSeries hroundsEq castSeries finalSeries hfinalPenultimateTree i hi + let ilast : Fin ett.rounds := + ⟨ett.rounds - 1, by omega⟩ + have hilast : i = ilast := by + apply Fin.ext + have hiBound := i.isLt + have hprefixRounds := hr + simp [ilast] + omega + rw [hilast] + have hindex : + ilast.succ.castSucc = + (Fin.last ett.rounds).castSucc := by + apply Fin.ext + simp [ilast] + omega + rw [hindex] + exact hfinalPenultimateTree + +theorem helper_hseriesTreeAgree_6867.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : (0 : ℕ) < + originalPrefix.rounds), + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (2 + : ℕ))), (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; finalSeries.data.tree (⟨ett.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc → + let _ : Fin (ett.rounds + (2 : ℕ)) → Fin (originalPrefix.rounds + (3 : ℕ)) := fun (i : Fin + (ett.rounds + (2 : ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; + ∀ (i : Fin ett.rounds), finalSeries.data.tree i.succ.castSucc = ett.series.data.tree + i.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma choice + sigmaPrev H u p hroundLarge originalPrefix hr hprefixTrees corr horiginalPositive newStored + newEdges newKind newVertex newOutside newDelta newGamma appendedData extendedSeries + hextendedData hroundsEq castSeries castSeriesTree finalSeries hfinalPenultimateTree + rawTreeIndex i + by_cases hi : i.val < originalPrefix.rounds + · apply helper_branch_5283 <;> assumption + · apply helper_branch_5314 <;> assumption +theorem helper_hseriesColorProperties_6920.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq + E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → + ∀ (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), originalPrefix.rounds = ett.rounds - (1 : ℕ) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)), (0 : ℕ) < originalPrefix.rounds → + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let _ : TashkinovSeriesData G k (originalPrefix.rounds + (1 : ℕ)) e0 := + TashkinovSeriesDataAppend corr.replacementSeries.data closureTree sigma newStored newEdges + newKind newVertex newOutside newDelta newGamma; + ∀ (extendedSeries : TashkinovSeries G k (originalPrefix.rounds + (1 : ℕ)) e0 + corr.replacementInput), extendedSeries.data = TashkinovSeriesDataAppend + corr.replacementSeries.data closureTree sigma newStored newEdges newKind newVertex + newOutside newDelta newGamma → + ∀ (hroundsEq : originalPrefix.rounds + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → a = b → TashkinovSeries G k a e0 corr.replacementInput → + TashkinovSeries G k b e0 corr.replacementInput := fun {a b : ℕ} (h : a = b) (S : + TashkinovSeries G k a e0 corr.replacementInput) ↦ @Eq.ndrec Nat a (fun {b : Nat} ↦ + @TashkinovSeries V E inst inst_1 inst_2 G k b e0 + (@CorrespondingExtendedTashkinovTree.replacementInput V E inst inst_1 inst_2 G k e0 input + (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G + k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + (@TashkinovSeriesData.coloring V E G k (@ExtendedTashkinovTree.rounds V E inst inst_1 + inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) e0 + input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 input T generating + ett)) (@Fin.mk (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@HSub.hSub Nat Nat Nat + (@instHSub Nat instSubNat) (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 + input T generating ett) (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ))) originalPrefix sigmaPrev (@TashkinovSeriesData.tree V E G k (@ExtendedTashkinovTree.rounds + V E inst inst_1 inst_2 G k e0 input T generating ett) e0 (@TashkinovSeries.data V E inst + inst_1 inst_2 G k (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T + generating ett) e0 input (@ExtendedTashkinovTree.series V E inst inst_1 inst_2 G k e0 + input T generating ett)) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett) + (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (Fin.last + (@ExtendedTashkinovTree.rounds V E inst inst_1 inst_2 G k e0 input T generating ett)))) + corr)) S b h; ( + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 corr.replacementInput) (i : Fin (b + (1 + : ℕ))), (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by omega + ) i)) → + let finalSeries : TashkinovSeries G k ett.rounds e0 corr.replacementInput := castSeries + hroundsEq extendedSeries; finalSeries.data.coloring (Fin.last ett.rounds) = sigma → + let _ : Fin (ett.rounds + (1 : ℕ)) → Fin (originalPrefix.rounds + (2 : ℕ)) := fun (i : Fin + (ett.rounds + (1 : ℕ))) ↦ Fin.cast ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i; + ∀ (i : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ + IsOneEdgeUncolored (finalSeries.data.coloring i) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne _ + closureTree q gamma choice sigmaPrev H u p hroundLarge originalPrefix hr corr + horiginalPositive newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesColoring + finalSeries hfinalColor rawDataIndex i + by_cases hi : i.val < ett.rounds + · let j : Fin (originalPrefix.rounds + 1) := + ⟨i.val, by rw [hroundsEq]; exact hi⟩ + have hraw : rawDataIndex i = j.castSucc := by + apply Fin.ext + rfl + have hcolor : finalSeries.data.coloring i = + corr.replacementSeries.data.coloring j := by + calc + finalSeries.data.coloring i = + extendedSeries.data.coloring (rawDataIndex i) := by + exact castSeriesColoring hroundsEq + extendedSeries i + _ = appendedData.coloring (rawDataIndex i) := by + rw [hextendedData] + _ = corr.replacementSeries.data.coloring j := by + rw [hraw] + simp [appendedData, TashkinovSeriesDataAppend] + rw [hcolor] + exact ⟨corr.replacementProper j, + corr.replacementOneUncolored j⟩ + · have hilast : i = Fin.last ett.rounds := by + apply Fin.ext + simp + have hiBound := i.isLt + omega + rw [hilast, hfinalColor] + exact ⟨hsigmaProper, hsigmaOne⟩ + +theorem helper_hseriesStable_6952.{u_1, u_2} : + helperHseriesStable6952Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaStable _ closureTree q + gamma choice sigmaPrev H u p hroundLarge originalPrefix hr hprefixTrees hprefixData corr + horiginalPositive newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData extendedSeries hextendedData hroundsEq castSeries castSeriesColoring + finalSeries hfinalColor rawDataIndex i + by_cases hi : i.val < originalPrefix.rounds + · let j : Fin originalPrefix.rounds := ⟨i.val, hi⟩ + have hmap : Fin.castLE (by omega) j.succ = i.succ := by + apply Fin.ext + rfl + have htreeMap : Fin.castLE (by omega) + j.succ.castSucc = i.succ.castSucc := by + apply Fin.ext + rfl + have htreeEq : originalPrefix.series.data.tree + j.succ.castSucc = + ett.series.data.tree i.succ.castSucc := by + calc + originalPrefix.series.data.tree j.succ.castSucc = + ett.series.data.tree + (Fin.castLE (by omega) j.succ.castSucc) := + hprefixTrees j.succ.castSucc + _ = ett.series.data.tree i.succ.castSucc := by + rw [htreeMap] + have hstoredEq : TashkinovStoredColors + originalPrefix.series.data j.succ = + TashkinovStoredColors ett.series.data i.succ := by + calc + TashkinovStoredColors originalPrefix.series.data + j.succ = + TashkinovStoredColors ett.series.data + (Fin.castLE (by omega) j.succ) := + (hprefixData j.succ).2.2.2.2 + _ = TashkinovStoredColors ett.series.data i.succ := by + rw [hmap] + have holdColorEq : originalPrefix.series.data.coloring + j.succ = ett.series.data.coloring i.succ := by + calc + originalPrefix.series.data.coloring j.succ = + ett.series.data.coloring + (Fin.castLE (by omega) j.succ) := + (hprefixData j.succ).1 + _ = ett.series.data.coloring i.succ := by rw [hmap] + have hraw : rawDataIndex i.succ = + j.succ.castSucc := by + apply Fin.ext + rfl + have hnewColorEq : finalSeries.data.coloring i.succ = + corr.replacementSeries.data.coloring j.succ := by + calc + finalSeries.data.coloring i.succ = + extendedSeries.data.coloring + (rawDataIndex i.succ) := by + exact castSeriesColoring hroundsEq + extendedSeries i.succ + _ = appendedData.coloring + (rawDataIndex i.succ) := by rw [hextendedData] + _ = corr.replacementSeries.data.coloring j.succ := by + rw [hraw] + simp only [appendedData, + TashkinovSeriesDataAppend] + exact Fin.lastCases_castSucc j.succ + have hstable := corr.replacementStable j + rw [htreeEq, hstoredEq, holdColorEq] at hstable + rw [hnewColorEq] + exact hstable + · let ilast : Fin ett.rounds := + ⟨ett.rounds - 1, by omega⟩ + have hilast : i = ilast := by + apply Fin.ext + have hiBound := i.isLt + have hprefixRounds := hr + simp [ilast] + omega + have hindex : ilast.succ = Fin.last ett.rounds := by + apply Fin.ext + simp [ilast] + omega + rw [hilast, hindex, hfinalColor] + exact hsigmaStable + +theorem helper_branch_7068.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ((ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last + ett.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence sigma seed Tstar) → Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q hqSucc hpeKind hsimple + rcases hsimple.1 with hse | hre + · have hbad := hpeKind.symm.trans (by simpa [hqSucc] using hse) + cases hbad + · have hbad := hpeKind.symm.trans (by simpa [hqSucc] using hre) + cases hbad + +private theorem helper_continuation_4951.{u_1, u_2} : + helperContinuation4951Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hTstarClosure q hqSucc choice currentStored + currentEdges currentKind sigmaPrev hsigmaPrevProper hsigmaPrevOne hroundOne prefixInput + zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendLastTree happendLastColor happendLastStored happendLastEdges + happendLastKind happendTree happendColor extendedSeries hextendedData hroundsEq castSeries + castSeriesTree castSeriesColoring castSeriesStored castSeriesEdges + have castSeriesKind : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + 1)), + (castSeries h S).data.kind i = S.data.kind (Fin.cast (congrArg (fun m : ℕ => m + 1) + h.symm) i) := by + intro a b h S i + subst b + rfl + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := + castSeries hroundsEq extendedSeries + let rawTreeIndex (i : Fin (ett.rounds + 2)) : Fin 3 := + Fin.cast (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) i + let rawDataIndex (i : Fin (ett.rounds + 1)) : Fin 2 := + Fin.cast (congrArg (fun m : ℕ => m + 1) hroundsEq.symm) i + have hrawPenultimate : rawTreeIndex + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + zeroLast.succ.castSucc := by + apply Fin.ext + simp [rawTreeIndex, zeroLast] + omega + have hrawFinalTree : rawTreeIndex (Fin.last (ett.rounds + 1)) = + Fin.last 2 := by + apply Fin.ext + simp [rawTreeIndex] + have hrawFinalData : rawDataIndex (Fin.last ett.rounds) = + Fin.last 1 := by + apply Fin.ext + simp [rawDataIndex] + have hfinalTree := @helper_hfinalTree_3891 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@choice) (@prefixInput) (@zeroPrefix) (@happendLastTree) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesTree) (@hrawFinalTree) + have hpenultimateTree := @helper_hpenultimateTree_3903 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@hqSucc) (@choice) (@prefixInput) (@zeroPrefix) (@happendTree) + (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) (@hrawPenultimate) + have hfinalColor := @helper_hfinalColor_3911 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@choice) (@prefixInput) (@zeroPrefix) (@happendLastColor) (@extendedSeries) + (@hextendedData) (@hroundsEq) (@castSeriesColoring) (@hrawFinalData) + have hprefixFields := @helper_hprefixFields_744 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@closureTree) (@hroundOne) (@prefixInput) (@zeroPrefix) (@hroundsEq) + have hseriesDataAgree := @helper_hseriesDataAgree_3932 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@hqSucc) (@choice) (@currentStored) (@currentEdges) (@currentKind) + (@hroundOne) (@prefixInput) (@zeroPrefix) (@happendLastStored) (@happendLastEdges) + (@happendLastKind) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesStored) + (@castSeriesEdges) (@castSeriesKind) (@hrawFinalData) (@hprefixFields) + have hseriesTreeAgree := @helper_hseriesTreeAgree_3944 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@hqSucc) (@choice) (@hroundOne) (@prefixInput) (@zeroPrefix) + (@happendTree) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) + have hseriesColorProperties := @helper_hseriesColorProperties_3952 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@hsigmaProper) (@hsigmaOne) (@Tstar) (@closureTree) (@choice) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@hroundOne) (@prefixInput) (@zeroPrefix) (@happendColor) + (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesColoring) (@hfinalColor) + have hseriesStable := @helper_hseriesStable_3961 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@hsigmaStable) (@Tstar) (@closureTree) (@hroundOne) (@prefixInput) (@extendedSeries) + (@hroundsEq) (@hfinalColor) + let replacementETT := @helperReplacementETT3160 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@sigma) + (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hTstarClosure) (@prefixInput) + (@extendedSeries) (@hroundsEq) (@hfinalTree) (@hpenultimateTree) (@hfinalColor) + refine ⟨{ + replacementInput := prefixInput + replacementSeries := finalSeries + replacementETT := replacementETT + rungAgreement := rfl + seriesPresentation := by dsimp [replacementETT]; rfl + finalGeneratingColoring := hfinalColor.symm + ladderTreesAgree := hseriesTreeAgree + storedColorsAgree := fun i => (hseriesDataAgree i).1 + connectingEdgesAgree := fun i => (hseriesDataAgree i).2.1 + extensionKindsAgree := fun i => (hseriesDataAgree i).2.2 + replacementProper := fun i => (hseriesColorProperties i).1 + replacementOneUncolored := fun i => (hseriesColorProperties i).2 + replacementStable := hseriesStable }⟩ + +theorem helper_branch_11555.{u_1, u_2} : + helperBranch11555Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hclosure hTstarClosure hTnClosure q hqSucc + adjoined previousProper previousOneUncolored choice currentStored currentEdges currentKind + sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hsigmaPrevSigma hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf newChoice hclosedPrev hnotStrongPrev hnewAlternative + hroundOne prefixInput zeroPrefix hzeroTree hzeroColor hsimple + rcases hsimple with ⟨hkind, fstar, seed, hfinalEdges, + hadjoin, hroute⟩ + have hfstar : fstar = choice.edge := by + apply Finset.mem_singleton.mp + rw [← currentEdges, hqSucc, hfinalEdges] + exact Finset.mem_singleton_self fstar + have hrouteClosure : TashkinovAugmentationSequence sigma seed + closureTree := hroute.trans hclosure.1 + have hseedClosure : TashkinovClosure sigma seed closureTree := + ⟨hrouteClosure, hclosure.2⟩ + let zeroLast : Fin (0 + 1) := Fin.last 0 + let newStored : Finset (Fin k) := {choice.color} + let newEdges : Finset E := {choice.edge} + let newKind : Option TashkinovExtensionKind := + some TashkinovExtensionKind.SE + let newVertex : Option V := some choice.vertex + let newOutside : Option V := some choice.otherEndpoint + let newDelta : Option (Fin k) := some choice.color + let newGamma : Option (Fin k) := none + let appendedData := TashkinovSeriesDataAppend zeroPrefix.data + closureTree sigma newStored newEdges newKind newVertex newOutside + newDelta newGamma + have happendLastTree : appendedData.tree (Fin.last 2) = + closureTree := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastColor : appendedData.coloring (Fin.last 1) = + sigma := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastStored : appendedData.stored (Fin.last 1) = + newStored := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastEdges : appendedData.connectingEdges (Fin.last 1) = + newEdges := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastKind : appendedData.kind (Fin.last 1) = + newKind := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastVertex : appendedData.chosenVertex (Fin.last 1) = + newVertex := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastOutside : appendedData.outsideVertex (Fin.last 1) = + newOutside := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastDelta : appendedData.delta (Fin.last 1) = + newDelta := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastGamma : appendedData.gamma (Fin.last 1) = + newGamma := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have hstoredZero : TashkinovStoredColors appendedData + zeroLast.castSucc = TashkinovStoredColors zeroPrefix.data + zeroLast := by + exact TashkinovStoredColorsAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma + zeroLast + have happendTree := @helper_happendTree_3707 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@hqSucc) (@choice) (@prefixInput) (@zeroPrefix) (@hzeroTree) + have happendColor := @helper_happendColor_3717 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@choice) (@sigmaPrev) (@prefixInput) (@zeroPrefix) (@hzeroColor) + have happendStored : TashkinovStoredColors appendedData + zeroLast.castSucc = + TashkinovStoredColors ett.series.data q.castSucc := by + unfold TashkinovStoredColors + simp [zeroLast, q, hroundOne] + let appendedChoice := @helperAppendedChoice2713 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@closureTree) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) + (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@prefixInput) (@zeroPrefix) (@happendTree) + (@happendColor) (@happendStored) + have hnoRevisitingZero := @helper_hnoRevisitingZero_3741 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@choice) (@prefixInput) (@zeroPrefix) + have hnewAlternativeZero := @helper_hnewAlternativeZero_3753 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) + (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hnewAlternative) (@prefixInput) (@zeroPrefix) + (@happendTree) (@happendColor) (@happendStored) + have hstrictClosure : + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + closureTree.length := lt_of_lt_of_le hstrict hTstarClosure.1 + have lastStep := @helper_lastStep_3779 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) + (@hTnClosure) (@hqSucc) (@adjoined) (@previousProper) (@previousOneUncolored) (@choice) + (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hsigmaPrevSigma) + (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) + (@prefixInput) (@zeroPrefix) (@fstar) (@seed) (@hadjoin) (@hfstar) (@hseedClosure) + (@happendLastTree) (@happendLastColor) (@happendLastStored) (@happendLastEdges) + (@happendLastKind) (@happendLastVertex) (@happendLastOutside) (@happendLastDelta) + (@happendLastGamma) (@happendTree) (@happendColor) (@happendStored) (@hnoRevisitingZero) + (@hnewAlternativeZero) (@hstrictClosure) + obtain ⟨extendedSeries, hextendedData⟩ := + TashkinovSeriesAppend G k 0 e0 prefixInput zeroPrefix closureTree + sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma lastStep + have hroundsEq : 0 + 1 = ett.rounds := by omega + let castSeries {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 prefixInput) : + TashkinovSeries G k b e0 prefixInput := by + subst b + exact S + have castSeriesTree : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + 2)), + (castSeries h S).data.tree i = S.data.tree (Fin.cast (congrArg (fun m : ℕ => m + 2) + h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesColoring : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + 1)), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast (congrArg (fun m : ℕ => m + + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesStored : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + 1)), + (castSeries h S).data.stored i = S.data.stored (Fin.cast (congrArg (fun m : ℕ => m + 1) + h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesEdges : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + 1)), + (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast (congrArg (fun + m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + apply helper_continuation_4951 <;> assumption +private theorem helper_hsigmaEdge_6158.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : IsProperEdgeColoring G sigma) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma) (gamma : Fin k) + (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G secondStable) (choice + : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (_ : ett.series.data.coloring q.succ = TwoColorComponentSwap G secondStable gamma + choice.color (Sum.inl choice.vertex)) (_ : ett.series.data.stored q.succ = (insert + choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k))) (_ : choice.vertex ∈ + TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) (_ : + ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), Sum.inl w ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex) + (_ : gamma ∈ MissingColors G secondStable choice.vertex) (_ : V) (_ : + ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl + choice.vertex) → secondStable e = some gamma ∨ secondStable e = some choice.color) (_ : + secondStable choice.edge = some choice.color) (_ : gamma ≠ choice.color) (_ : Sum.inr + choice.edge ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex)) + (e : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) e → Sum.inr e ∈ + TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → e = choice.edge := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper Tstar q + hsigmaStableQ gamma secondStable secondStableProper choice currentColoring currentStored + hchoiceVertex hcomponent hmissing u hcompEdge hchoiceSecond hneq hfcomponent + exact @helper_hsigmaEdge_4922 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@Tstar) + (@hsigmaStableQ) (@gamma) (@secondStable) (@secondStableProper) (@choice) + (@currentColoring) (@currentStored) (@hchoiceVertex) (@hcomponent) (@hmissing) (@u) + (@hcompEdge) (@hchoiceSecond) (@hneq) (@hfcomponent) + +theorem helper_hsigmaPrevEnlarged_12232.{u_1, u_2} : + helperHsigmaPrevEnlarged12232Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne Tstar q + hsigmaStableQ gamma secondStable secondStableProper secondStableOneUncolored choice + gammaRule secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored sigmaPrev hchoiceVertex hcomponent hsigmaPrevFormula + have hmissing : gamma ∈ MissingColors G secondStable choice.vertex := by + exact (secondStableRelation.2 choice.vertex choice.vertexDefective.1).symm ▸ gammaRule.1 + have hdegree := @helper_hdegree_1837 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@secondStable) + (@secondStableProper) (@choice) + rcases exitWitness with ⟨u, path, pathData⟩ + rcases pathData with ⟨pathIs, pathLen, uOut, endTree, endOnly⟩ + have hdegreeBound : ∀ x, @SimpleGraph.degree _ + (TwoColorIncidenceGraph G secondStable gamma choice.color) x + (Fintype.ofFinite _) ≤ 2 := by + intro x + exact TwoColorIncidenceDegreeAtMostTwo G secondStable gamma choice.color + secondStableProper x + have huDegree := hdegree u endOnly.1 + have hclosed : ∀ x, x ∈ path.support → ∀ y, + (TwoColorIncidenceGraph G secondStable gamma choice.color).Adj x y → + y ∈ path.support := by + exact @helper_hclosed_1893 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) + (@secondStable) (@choice) (@hmissing) (@hdegree) (@u) (@path) (@pathIs) (@pathLen) + (by + intro x + simpa only [← SimpleGraph.card_neighborSet_eq_degree, Fintype.card_eq_nat_card] using + hdegreeBound x) (@huDegree) + have hpathComponent := @helper_hpathComponent_4867 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@gamma) (@secondStable) (@choice) (@u) (@path) (@hclosed) + have hcompEdge := @helper_hcompEdge_4879 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@secondStable) + (@choice) (@u) + have hchoiceSecond := @helper_hchoiceSecond_4895 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@secondStable) (@choice) (@secondStableRelation) + have hneq := @helper_hneq_4901 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@secondStable) (@choice) + (@hmissing) (@hchoiceSecond) + have hfcomponent : Sum.inr choice.edge ∈ + TwoColorComponent G secondStable gamma choice.color + (Sum.inl choice.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, choice.edgeIncident, hchoiceSecond] + have htreeEdge := @helper_htreeEdge_2018 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@secondStable) + (@secondStableProper) (@choice) (@hmissing) (@u) (@path) (@endOnly) (@hpathComponent) + (@hcompEdge) (@hchoiceSecond) + have hsigmaEdge := @helper_hsigmaEdge_6158 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@Tstar) (@hsigmaStableQ) (@gamma) (@secondStable) (@secondStableProper) (@choice) + (@currentColoring) (@currentStored) (@hchoiceVertex) (@hcomponent) (@hmissing) (@u) + (@hcompEdge) (@hchoiceSecond) (@hneq) (@hfcomponent) + let undone := TwoColorComponentSwap G sigma gamma choice.color + (Sum.inl choice.vertex) + have undoneProper : IsProperEdgeColoring G undone := by + exact TwoColorComponentSwapProper G sigma gamma choice.color hneq + hsigmaProper (Sum.inl choice.vertex) + have undoneOne := @helper_undoneOne_2148 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaOne) (@Tstar) + (@gamma) (@choice) (@hneq) + have treeMissingTransport := @helper_treeMissingTransport_4940 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@Tstar) + have treeSecondSelected : + TreeMissingColors secondStable (ett.series.data.tree q.succ.castSucc) = + TreeMissingColors choice.selected (ett.series.data.tree q.succ.castSucc) := + treeMissingTransport secondStable choice.selected (by + intro w hw + exact secondStableRelation.2 w hw) + have sigmaComponentColor := @helper_sigmaComponentColor_4960 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@gamma) (@choice) (@u) + have currentColorMissing := @helper_currentColorMissing_2202 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@gamma) (@secondStable) (@secondStableProper) (@choice) (@currentColoring) (@hmissing) + (@hcompEdge) (@hchoiceSecond) (@hneq) (@hfcomponent) + have sigmaColorMissing : choice.color ∈ + MissingColors G sigma choice.vertex := by + rw [hsigmaStableQ.2 choice.vertex hchoiceVertex] + exact currentColorMissing + have treeSelectedPrevious : + TreeMissingColors choice.selected (ett.series.data.tree q.succ.castSucc) = + TreeMissingColors (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) := + treeMissingTransport choice.selected (ett.series.data.coloring q.castSucc) (by + intro w hw + exact choice.selectedStable.2 w hw) + have currentControl := @helper_currentControl_2238 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@gamma) (@choice) (@currentStored) (@treeSelectedPrevious) + have selectedStableFact := choice.selectedStable + have sigmaStableFact := hsigmaStableQ + have relationFact := secondStableRelation + have gammaControl := @helper_gammaControl_5005 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) + (@secondStable) (@choice) (@secondStableRelation) (@hchoiceVertex) (@hmissing) + have stableSecond : StableColoring + (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc)) + secondStable undone := by + apply (sc1 G e0 (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc)) + secondStable undone secondStableProper secondStableOneUncolored + undoneProper undoneOne).2 + intro f hf h + rcases h with h | h + · exact @helper_branch_5026 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@hsigmaStableQ) + (@gamma) (@secondStable) (@secondStableProper) (@secondStableOneUncolored) (@choice) + (@secondStableRelation) (@currentColoring) (@hdegree) (@u) (@path) (@hdegreeBound) + (@hclosed) (@hpathComponent) (@hcompEdge) (@hchoiceSecond) (@htreeEdge) (@hsigmaEdge) + (@treeSecondSelected) (@sigmaComponentColor) (@sigmaColorMissing) (@currentControl) + (@gammaControl) (@f) (@hf) (@h) + · exact @helper_branch_5085 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@Tstar) (@hsigmaStableQ) (@gamma) (@secondStable) (@choice) + (@currentColoring) (@currentProper) (@currentOneUncolored) (@hdegree) (@u) (@path) + (@hdegreeBound) (@hclosed) (@hpathComponent) (@hcompEdge) (@hchoiceSecond) (@htreeEdge) + (@hsigmaEdge) (@treeSecondSelected) (@sigmaComponentColor) (@sigmaColorMissing) + (@currentControl) (@gammaControl) (@f) (@hf) (@h) + have stableSelected := @helper_stableSelected_5146 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@gamma) (@secondStable) (@secondStableProper) (@secondStableOneUncolored) (@choice) + (@secondStableRelation) (@undoneProper) (@undoneOne) (@treeSecondSelected) (@stableSecond) + rw [hsigmaPrevFormula] + exact stableSelected + +private theorem helper_hprefixFields_6306.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ _ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (_ : ett.rounds = (1 : ℕ)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + ∀ (_ : (0 : ℕ) + (1 : ℕ) = ett.rounds) (i : Fin (ett.rounds + (1 : ℕ))), (↑i : ℕ) < ett.rounds + → zeroPrefix.data.stored zeroLast = ett.series.data.stored i ∧ + zeroPrefix.data.connectingEdges zeroLast = ett.series.data.connectingEdges i ∧ + zeroPrefix.data.kind zeroLast = ett.series.data.kind i := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive Tstar closureTree q gamma choice + sigmaPrev H u p hroundOne prefixInput zeroPrefix zeroLast hroundsEq + exact @helper_hprefixFields_3431 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundOne) + (@prefixInput) (@zeroPrefix) (@hroundsEq) + +private theorem helper_hpeAlternativeZero_6498.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring + q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring + q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k) + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored + sigmaPrev e0) (hsigmaPrevStableQ : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev) (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice4049 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; + ∀ (_ : + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected + rho ∧ ¬Disjoint (MissingColors G rho newChoice.otherEndpoint) (TreeMissingColors rho + (ett.series.data.tree q.succ.castSucc))) (prefixInput : PartialEdgeColoring E k) + (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; + ∀ (happendTree : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree + q.succ.castSucc) (happendColor : appendedData.coloring zeroLast.castSucc = sigmaPrev) + (happendStored : TashkinovStoredColors appendedData zeroLast.castSucc = + TashkinovStoredColors ett.series.data q.castSucc), + let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) + (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring + zeroLast.castSucc) := helperAppendedChoice4500 G k e0 input T generating ett hpositive + sigma closureTree gamma previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf prefixInput zeroPrefix happendTree happendColor happendStored; + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (appendedData.tree zeroLast.succ.castSucc) (insert appendedChoice.color + (TashkinovStoredColors appendedData zeroLast.castSucc) : Finset (Fin k)) + appendedChoice.selected rho ∧ ¬Disjoint (MissingColors G rho appendedChoice.otherEndpoint) + (TreeMissingColors rho (appendedData.tree zeroLast.succ.castSucc)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q gamma + previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice + hnewAlternativeFails prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData happendTree happendColor happendStored + appendedChoice + exact @helper_hpeAlternativeZero_5555 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@gamma) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) + (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hnewAlternativeFails) (@prefixInput) (@zeroPrefix) + (@happendTree) (@happendColor) (@happendStored) + +private theorem helper_hpeGammaRuleZero_6513.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring + q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring + q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k) + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored + sigmaPrev e0) (hsigmaPrevStableQ : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev) (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev) + (_ : gamma ∈ MissingColors G sigmaPrev choice.vertex), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (prefixInput : PartialEdgeColoring + E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; + ∀ (happendTree : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree + q.succ.castSucc) (happendColor : appendedData.coloring zeroLast.castSucc = sigmaPrev) + (happendStored : TashkinovStoredColors appendedData zeroLast.castSucc = + TashkinovStoredColors ett.series.data q.castSucc), + let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) + (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring + zeroLast.castSucc) := helperAppendedChoice4500 G k e0 input T generating ett hpositive + sigma closureTree gamma previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf prefixInput zeroPrefix happendTree happendColor happendStored; + ParallelExtensionColor appendedData zeroLast.castSucc appendedChoice.selected + appendedChoice.vertex gamma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q gamma + previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf hgammaPrevMissing H u p + prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData happendTree happendColor happendStored appendedChoice + exact @helper_hpeGammaRuleZero_5579 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@gamma) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) + (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hgammaPrevMissing) (@u) (@p) (@prefixInput) + (@zeroPrefix) (@happendTree) (@happendColor) (@happendStored) + +private theorem helper_lastStep_6525.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (Tstar closureTree + : TreeSequence G e0) (_ : TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) closureTree), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : q.succ = Fin.last ett.rounds) (gamma : Fin k) (_ : PartialEdgeColoring E k) + (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) + (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) + (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G + sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : + StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors + ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) sigmaPrev) + (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev) + (_ : ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc))) (_ : ¬ColoredVertexSetStronglyClosed G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc))) (_ : sigma = TwoColorComponentSwap G sigmaPrev + gamma choice.color (Sum.inl choice.vertex)) (_ : TreeExit (ett.series.data.tree + q.succ.castSucc) sigmaPrev gamma choice.color choice.vertex) (prefixInput : + PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput) (_ : + TashkinovClosure sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; + ∀ (_ : appendedData.tree (Fin.last (2 : ℕ)) = closureTree) (_ : appendedData.coloring + (Fin.last (1 : ℕ)) = sigma) (_ : appendedData.stored (Fin.last (1 : ℕ)) = newStored) (_ : + appendedData.connectingEdges (Fin.last (1 : ℕ)) = newEdges) (_ : appendedData.kind + (Fin.last (1 : ℕ)) = newKind) (_ : appendedData.chosenVertex (Fin.last (1 : ℕ)) = + newVertex) (_ : appendedData.outsideVertex (Fin.last (1 : ℕ)) = newOutside) (_ : + appendedData.delta (Fin.last (1 : ℕ)) = newDelta) (_ : appendedData.gamma (Fin.last (1 : + ℕ)) = newGamma) (happendTree : appendedData.tree zeroLast.succ.castSucc = + ett.series.data.tree q.succ.castSucc) (happendColor : appendedData.coloring + zeroLast.castSucc = sigmaPrev) (happendStored : TashkinovStoredColors appendedData + zeroLast.castSucc = TashkinovStoredColors ett.series.data q.castSucc), + let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) + (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring + zeroLast.castSucc) := helperAppendedChoice4500 G k e0 input T generating ett hpositive + sigma closureTree gamma previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf prefixInput zeroPrefix happendTree happendColor happendStored; + ∀ (_ : ¬Nonempty (RevisitingExtensionCertificate appendedData zeroLast.castSucc)) (_ : + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (appendedData.tree zeroLast.succ.castSucc) (insert appendedChoice.color + (TashkinovStoredColors appendedData zeroLast.castSucc) : Finset (Fin k)) + appendedChoice.selected rho ∧ ¬Disjoint (MissingColors G rho appendedChoice.otherEndpoint) + (TreeMissingColors rho (appendedData.tree zeroLast.succ.castSucc))) (_ : + ParallelExtensionColor appendedData zeroLast.castSucc appendedChoice.selected + appendedChoice.vertex gamma) (_ : (ett.series.data.tree (Fin.last + ett.rounds).castSucc).length < closureTree.length), TashkinovSeriesStep G k (1 : ℕ) e0 + prefixInput appendedData (Fin.last (1 : ℕ)) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne Tstar + closureTree hTnClosure q hqSucc gamma secondStable previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf hclosedPrev hnotStrongPrev hsigmaRecovered hnewExit + prefixInput zeroPrefix hterminalClosure zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData happendLastTree happendLastColor + happendLastStored happendLastEdges happendLastKind happendLastVertex happendLastOutside + happendLastDelta happendLastGamma happendTree happendColor happendStored appendedChoice + hpeNoRevisitingZero hpeAlternativeZero hpeGammaRuleZero hstrictClosure + exact @helper_lastStep_5593 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@Tstar) (@closureTree) (@hTnClosure) (@hqSucc) (@gamma) (@secondStable) + (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) + (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) (@hsigmaRecovered) (@hnewExit) + (@prefixInput) (@zeroPrefix) (@hterminalClosure) (@happendLastTree) (@happendLastColor) + (@happendLastStored) (@happendLastEdges) (@happendLastKind) (@happendLastVertex) + (@happendLastOutside) (@happendLastDelta) (@happendLastGamma) (@happendTree) + (@happendColor) (@happendStored) (@hpeNoRevisitingZero) (@hpeAlternativeZero) + (@hpeGammaRuleZero) (@hstrictClosure) + +private theorem helper_hpenultimateTree_6615.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : q.succ = Fin.last ett.rounds) (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (prefixInput : PartialEdgeColoring + E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; + ∀ (_ : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc) + (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput) (_ : + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma) (hroundsEq : (0 : ℕ) + + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → (h : a = b) → (S : TashkinovSeries G k a e0 prefixInput) → + TashkinovSeries G k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k + a e0 prefixInput) ↦ (h ▸ S); + ∀ (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by + omega + ) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + let rawTreeIndex : (i : Fin (ett.rounds + (2 : ℕ))) → Fin (3 : ℕ) := fun (i : Fin (ett.rounds + + (2 : ℕ))) ↦ Fin.cast ( + by + omega + ) i; + ∀ (_ : rawTreeIndex (⟨ett.rounds, + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = zeroLast.succ.castSucc), finalSeries.data.tree (⟨ett.rounds, + by + omega + ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q hqSucc gamma + choice sigmaPrev H u p prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex + newOutside newDelta newGamma appendedData happendTree extendedSeries hextendedData + hroundsEq castSeries castSeriesTree finalSeries rawTreeIndex hrawPenultimate + exact @helper_hpenultimateTree_5732 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@hqSucc) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@prefixInput) + (@zeroPrefix) (@happendTree) (@extendedSeries) (@hextendedData) (@hroundsEq) + (@castSeriesTree) (@hrawPenultimate) + +private theorem helper_hseriesTreeAgree_7410.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ closureTree : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin ett.rounds); + ∀ (_ : q.succ = Fin.last ett.rounds) (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (_ : ett.rounds = (1 : ℕ)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; + ∀ (_ : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc) + (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput) (_ : + extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma) (hroundsEq : (0 : ℕ) + + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → (h : a = b) → (S : TashkinovSeries G k a e0 prefixInput) → + TashkinovSeries G k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k + a e0 prefixInput) ↦ (h ▸ S); + ∀ (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), + (castSeries h S).data.tree i = S.data.tree (Fin.cast ( + by + omega + ) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + ∀ (j : Fin ett.rounds), finalSeries.data.tree j.succ.castSucc = ett.series.data.tree + j.succ.castSucc := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q hqSucc gamma + choice sigmaPrev H u p hroundOne prefixInput zeroPrefix zeroLast newStored newEdges newKind + newVertex newOutside newDelta newGamma appendedData happendTree extendedSeries + hextendedData hroundsEq castSeries castSeriesTree finalSeries + exact @helper_hseriesTreeAgree_5768 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@hqSucc) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundOne) + (@prefixInput) (@zeroPrefix) (@happendTree) (@extendedSeries) (@hextendedData) + (@hroundsEq) (@castSeriesTree) + +private theorem helper_hseriesColorProperties_7486.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (_ closureTree : + TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigmaPrev) (_ : + IsOneEdgeUncolored sigmaPrev e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (_ : ett.rounds = (1 : ℕ)) + (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), + let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); + let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset + (Fin k)); + let newEdges : Finset E := ({ choice.edge } : Finset E); + let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; + let newVertex : Option V := some choice.vertex; + let newOutside : Option V := some choice.otherEndpoint; + let newDelta : Option (Fin k) := some choice.color; + let newGamma : Option (Fin k) := some gamma; + let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend + zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma; + ∀ (_ : appendedData.coloring zeroLast.castSucc = sigmaPrev) (extendedSeries : TashkinovSeries + G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput) (_ : extendedSeries.data = + TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma newStored newEdges newKind + newVertex newOutside newDelta newGamma) (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), + let castSeries : {a b : ℕ} → (h : a = b) → (S : TashkinovSeries G k a e0 prefixInput) → + TashkinovSeries G k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k + a e0 prefixInput) ↦ (h ▸ S); + ∀ (_ : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( + by + omega + ) i)), + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq + extendedSeries; + ∀ (_ : finalSeries.data.coloring (Fin.last ett.rounds) = sigma) (i : Fin (ett.rounds + (1 : + ℕ))), IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ IsOneEdgeUncolored + (finalSeries.data.coloring i) e0 := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne Tstar + closureTree q gamma choice sigmaPrev hsigmaPrevProper hsigmaPrevOne H u p hroundOne + prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta + newGamma appendedData happendColor extendedSeries hextendedData hroundsEq castSeries + castSeriesColoring finalSeries hfinalColor + exact @helper_hseriesColorProperties_5776 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) + (@hsigmaOne) (@Tstar) (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@u) (@p) (@hroundOne) (@prefixInput) (@zeroPrefix) (@happendColor) + (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesColoring) (@hfinalColor) + +private theorem helper_continuation_7494.{u_1, u_2} : + helperContinuation7494Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hTstarClosure q hqSucc gamma choice + currentStored currentEdges currentKind sigmaPrev hsigmaPrevProper hsigmaPrevOne H + auxiliaryStart b auxiliaryWalk auxiliaryPath u p hp hroundOne prefixInput zeroPrefix + zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma appendedData + happendLastTree happendLastColor happendLastStored happendLastEdges happendLastKind + happendTree happendColor extendedSeries hextendedData hroundsEq castSeries castSeriesTree + castSeriesColoring castSeriesStored castSeriesEdges + have castSeriesKind : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + 1)), + (castSeries h S).data.kind i = S.data.kind (Fin.cast (congrArg (fun m : ℕ => m + 1) + h.symm) i) := by + intro a b h S i + subst b + rfl + let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := + castSeries hroundsEq extendedSeries + let rawTreeIndex (i : Fin (ett.rounds + 2)) : Fin 3 := + Fin.cast (congrArg (fun m : ℕ => m + 2) hroundsEq.symm) i + let rawDataIndex (i : Fin (ett.rounds + 1)) : Fin 2 := + Fin.cast (congrArg (fun m : ℕ => m + 1) hroundsEq.symm) i + have hrawPenultimate : rawTreeIndex + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + zeroLast.succ.castSucc := by + apply Fin.ext + simp [rawTreeIndex, zeroLast] + omega + have hrawFinalTree : rawTreeIndex (Fin.last (ett.rounds + 1)) = + Fin.last 2 := by + apply Fin.ext + simp [rawTreeIndex] + have hrawFinalData : rawDataIndex (Fin.last ett.rounds) = + Fin.last 1 := by + apply Fin.ext + simp [rawDataIndex] + have hfinalTree := @helper_hfinalTree_5720 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@gamma) (@choice) (@prefixInput) (@zeroPrefix) (@happendLastTree) + (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) (@hrawFinalTree) + have hpenultimateTree : finalSeries.data.tree + (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + apply helper_hpenultimateTree_6615 <;> assumption + have hfinalColor := @helper_hfinalColor_5740 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@gamma) (@choice) (@prefixInput) (@zeroPrefix) (@happendLastColor) + (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesColoring) (@hrawFinalData) + have hprefixFields : + ∀ (i : Fin (ett.rounds + 1)), i.val < ett.rounds → zeroPrefix.data.stored zeroLast = + ett.series.data.stored i ∧ zeroPrefix.data.connectingEdges zeroLast = + ett.series.data.connectingEdges i ∧ zeroPrefix.data.kind zeroLast = ett.series.data.kind i + := by + apply helper_hprefixFields_6306 <;> assumption + have hseriesDataAgree := @helper_hseriesDataAgree_3459 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@hqSucc) (@gamma) (@choice) (@currentStored) (@currentEdges) + (@currentKind) (@sigmaPrev) (@auxiliaryStart) (@b) (@auxiliaryWalk) (@auxiliaryPath) (@u) (@p) + (@hp) (@hroundOne) (@prefixInput) (@zeroPrefix) (@happendLastStored) (@happendLastEdges) + (@happendLastKind) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesStored) + (@castSeriesEdges) (@castSeriesKind) (@hrawFinalData) (@hprefixFields) + have hseriesTreeAgree := @helper_hseriesTreeAgree_7410 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@hqSucc) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundOne) + (@prefixInput) (@zeroPrefix) (@happendTree) (@extendedSeries) (@hextendedData) (@hroundsEq) + (@castSeriesTree) + have hseriesColorProperties := @helper_hseriesColorProperties_7486 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) + (@sigma) (@hsigmaProper) (@hsigmaOne) (@Tstar) (@closureTree) (@gamma) (@choice) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) (@u) (@p) (@hroundOne) (@prefixInput) (@zeroPrefix) + (@happendColor) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesColoring) + (@hfinalColor) + have hseriesStable := @helper_hseriesStable_5785 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@hsigmaStable) (@Tstar) (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundOne) + (@prefixInput) (@extendedSeries) (@hroundsEq) (@hfinalColor) + let replacementETT := @helperReplacementETT4947 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hTstarClosure) (@gamma) (@choice) + (@sigmaPrev) (@u) (@p) (@prefixInput) (@extendedSeries) (@hroundsEq) (@hfinalTree) + (@hpenultimateTree) (@hfinalColor) + refine ⟨{ + replacementInput := prefixInput + replacementSeries := finalSeries + replacementETT := replacementETT + rungAgreement := rfl + seriesPresentation := by dsimp [replacementETT]; rfl + finalGeneratingColoring := hfinalColor.symm + ladderTreesAgree := hseriesTreeAgree + storedColorsAgree := fun i => (hseriesDataAgree i).1 + connectingEdgesAgree := fun i => (hseriesDataAgree i).2.1 + extensionKindsAgree := fun i => (hseriesDataAgree i).2.2 + replacementProper := fun i => (hseriesColorProperties i).1 + replacementOneUncolored := fun i => (hseriesColorProperties i).2 + replacementStable := hseriesStable }⟩ + +theorem helper_branch_12554.{u_1, u_2} : + helperBranch12554Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict closureTree hclosure hTstarClosure hTnClosure q hqSucc + gamma secondStable previousProper previousOneUncolored choice currentStored currentEdges + currentKind sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf newChoice hclosedPrev hnotStrongPrev hnewAlternativeFails + hgammaPrevMissing hsigmaRecovered H auxiliaryStart b auxiliaryWalk auxiliaryPath u p hp + hnewExit hroundOne prefixInput + zeroPrefix hzeroTree hzeroColor hparallel + have hrouteClosure : TashkinovAugmentationSequence sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree := hparallel.2.trans hclosure.1 + have hterminalClosure : TashkinovClosure sigma + (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree := ⟨hrouteClosure, hclosure.2⟩ + let zeroLast : Fin (0 + 1) := Fin.last 0 + let newStored : Finset (Fin k) := {choice.color, gamma} + let newEdges : Finset E := {choice.edge} + let newKind : Option TashkinovExtensionKind := + some TashkinovExtensionKind.PE + let newVertex : Option V := some choice.vertex + let newOutside : Option V := some choice.otherEndpoint + let newDelta : Option (Fin k) := some choice.color + let newGamma : Option (Fin k) := some gamma + let appendedData := TashkinovSeriesDataAppend zeroPrefix.data + closureTree sigma newStored newEdges newKind newVertex newOutside + newDelta newGamma + have happendLastTree : appendedData.tree (Fin.last 2) = + closureTree := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastColor : appendedData.coloring (Fin.last 1) = + sigma := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastStored : appendedData.stored (Fin.last 1) = + newStored := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastEdges : appendedData.connectingEdges (Fin.last 1) = + newEdges := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastKind : appendedData.kind (Fin.last 1) = + newKind := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastVertex : appendedData.chosenVertex (Fin.last 1) = + newVertex := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastOutside : appendedData.outsideVertex (Fin.last 1) = + newOutside := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastDelta : appendedData.delta (Fin.last 1) = + newDelta := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have happendLastGamma : appendedData.gamma (Fin.last 1) = + newGamma := by + simp only [appendedData, TashkinovSeriesDataAppend, + Fin.lastCases_last] + have hstoredZero : TashkinovStoredColors appendedData + zeroLast.castSucc = TashkinovStoredColors zeroPrefix.data + zeroLast := by + exact TashkinovStoredColorsAppend zeroPrefix.data closureTree sigma + newStored newEdges newKind newVertex newOutside newDelta newGamma + zeroLast + have happendTree := @helper_happendTree_5509 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@hqSucc) (@gamma) (@choice) (@prefixInput) (@zeroPrefix) (@hzeroTree) + have happendColor := @helper_happendColor_5519 (@V) (@E) inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@prefixInput) (@zeroPrefix) (@hzeroColor) + have happendStored : TashkinovStoredColors appendedData + zeroLast.castSucc = + TashkinovStoredColors ett.series.data q.castSucc := by + unfold TashkinovStoredColors + simp [zeroLast, q, hroundOne] + let appendedChoice := @helperAppendedChoice4500 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@closureTree) (@gamma) (@previousProper) (@previousOneUncolored) (@choice) + (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) + (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@prefixInput) (@zeroPrefix) (@happendTree) + (@happendColor) (@happendStored) + have hpeNoRevisitingZero := @helper_hpeNoRevisitingZero_5543 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) + (@Tstar) (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@prefixInput) (@zeroPrefix) + have hpeAlternativeZero : ∃ rho : PartialEdgeColoring E k, + IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (appendedData.tree zeroLast.succ.castSucc) + (insert appendedChoice.color + (TashkinovStoredColors appendedData zeroLast.castSucc)) + appendedChoice.selected rho ∧ + ¬ Disjoint (MissingColors G rho appendedChoice.otherEndpoint) + (TreeMissingColors rho + (appendedData.tree zeroLast.succ.castSucc)) := by + apply helper_hpeAlternativeZero_6498 <;> assumption + have hpeGammaRuleZero : ParallelExtensionColor appendedData + zeroLast.castSucc appendedChoice.selected appendedChoice.vertex + gamma := by + apply helper_hpeGammaRuleZero_6513 <;> assumption + have hstrictClosure : + (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < + closureTree.length := lt_of_lt_of_le hstrict hTstarClosure.1 + have lastStep : TashkinovSeriesStep G k 1 e0 prefixInput + appendedData (Fin.last 1) := by + apply helper_lastStep_6525 <;> assumption + obtain ⟨extendedSeries, hextendedData⟩ := + TashkinovSeriesAppend G k 0 e0 prefixInput zeroPrefix closureTree + sigma newStored newEdges newKind newVertex newOutside newDelta + newGamma lastStep + have hroundsEq : 0 + 1 = ett.rounds := by omega + let castSeries {a b : ℕ} (h : a = b) + (S : TashkinovSeries G k a e0 prefixInput) : + TashkinovSeries G k b e0 prefixInput := by + subst b + exact S + have castSeriesTree : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + 2)), + (castSeries h S).data.tree i = S.data.tree (Fin.cast (congrArg (fun m : ℕ => m + 2) + h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesColoring : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + 1)), + (castSeries h S).data.coloring i = S.data.coloring (Fin.cast (congrArg (fun m : ℕ => m + + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesStored : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + 1)), + (castSeries h S).data.stored i = S.data.stored (Fin.cast (congrArg (fun m : ℕ => m + 1) + h.symm) i) := by + intro a b h S i + subst b + rfl + have castSeriesEdges : + ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + 1)), + (castSeries h S).data.connectingEdges i = S.data.connectingEdges (Fin.cast (congrArg (fun + m : ℕ => m + 1) h.symm) i) := by + intro a b h S i + subst b + rfl + exact @helper_continuation_7494 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@hsigmaOne) + (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hTstarClosure) (@hqSucc) + (@gamma) (@choice) (@currentStored) (@currentEdges) (@currentKind) (@sigmaPrev) + (@hsigmaPrevProper) (@hsigmaPrevOne) _ (@b) _ (by + assumption) (@u) (@p) (@hp) (@hroundOne) (@prefixInput) (@zeroPrefix) (@happendLastTree) + (@happendLastColor) (@happendLastStored) (@happendLastEdges) (@happendLastKind) + (@happendTree) (@happendColor) (@extendedSeries) (@hextendedData) (@hroundsEq) + (@castSeriesTree) (@castSeriesColoring) (@castSeriesStored) (@castSeriesEdges) +theorem helper_pePostStatus_12865.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), Sum.inr choice.edge ∈ TwoColorComponent G sigmaPrev + gamma choice.color (Sum.inl choice.vertex) → + ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch : + MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + IsProperEdgeColoring G second → StableColoring X (insert ch.color C : Finset (Fin k)) + ch.selected second → g ∈ MissingColors G ch.selected ch.vertex → + let post : PartialEdgeColoring E k := TwoColorComponentSwap G second g ch.color (Sum.inl + ch.vertex); ch.color ∈ MissingColors G post ch.vertex ∧ g ∉ MissingColors G post ch.vertex + ∧ g ≠ ch.color := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma choice sigmaPrev + hedgeComponent X C phi ch g second hsecondProper hsecondStable hgSelected + dsimp + have hgSecond : g ∈ MissingColors G second ch.vertex := by + rw [hsecondStable.2 ch.vertex ch.vertexDefective.1] + exact hgSelected + have hedgeSecond : second ch.edge = some ch.color := by + exact (hsecondStable.1 ch.edge + ⟨ch.vertex, ch.vertexDefective.1, ch.edgeIncident⟩ + ⟨ch.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), ch.edgeColor⟩).trans ch.edgeColor + have hne := @helper_hne_6004 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@X) (@C) + (@phi) (@ch) (@g) (@second) (@hgSecond) (@hedgeSecond) + have hedgeComponent : Sum.inr ch.edge ∈ + TwoColorComponent G second g ch.color + (Sum.inl ch.vertex) := by + apply SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + simp [TwoColorIncidenceGraph, + ch.edgeIncident, hedgeSecond] + have hmissingDelta : ch.color ∈ MissingColors G + (TwoColorComponentSwap G second g ch.color + (Sum.inl ch.vertex)) ch.vertex := by + exact (TwoColorComponentSwapMissingBehavior G second g ch.color + hne hsecondProper (Sum.inl ch.vertex)).2.1 ch.vertex rfl hgSecond + have hedgePost : TwoColorComponentSwap G second g ch.color + (Sum.inl ch.vertex) ch.edge = some g := by + simp [TwoColorComponentSwap, hedgeComponent, hedgeSecond, + hne.symm] + have hgammaPresent : g ∈ PresentColors G + (TwoColorComponentSwap G second g ch.color + (Sum.inl ch.vertex)) ch.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨ch.edge, ch.edgeIncident, hedgePost⟩ + exact ⟨hmissingDelta, + by simpa [MissingColors] using hgammaPresent, hne⟩ + +private theorem helper_continuation_6083.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (_ : Fin k) (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 + : ℕ) < ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (corr : + CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) (_ : Fin (originalPrefix.rounds + (1 : ℕ))) (fulli : Fin + ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (fullGamma : Fin k) (_ : + ett.series.data.chosenVertex fulli.succ = some fullChoice.vertex) (_ : + ett.series.data.delta fulli.succ = some fullChoice.color) (_ : ett.series.data.gamma + fulli.succ = some fullGamma) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (newGamma : Fin k) (_ : + corr.replacementSeries.data.chosenVertex newi.succ = some newChoice.vertex) (_ : + corr.replacementSeries.data.delta newi.succ = some newChoice.color) (_ : + corr.replacementSeries.data.gamma newi.succ = some newGamma) (_ : Fin.castLE ( + by + omega + ) newi.succ = fulli.succ) (htree : corr.replacementSeries.data.tree newi.succ.castSucc = + ett.series.data.tree fulli.succ.castSucc), + let fullChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) := (Eq.symm htree ▸ fullChoice); + ∀ (_ : fullChoiceOnNew.vertex = fullChoice.vertex) (_ : fullChoiceOnNew.color = + fullChoice.color) (_ : ({ fullChoiceOnNew.edge } : Finset E) = ({ newChoice.edge } : + Finset E)) (_ : (insert fullChoiceOnNew.color ({ fullGamma } : Finset (Fin k)) : Finset + (Fin k)) = (insert newChoice.color ({ newGamma } : Finset (Fin k)) : Finset (Fin k))) (_ : + fullChoice.color ∈ MissingColors G (ett.series.data.coloring fulli.succ) + fullChoice.vertex) (_ : fullGamma ∉ MissingColors G (ett.series.data.coloring fulli.succ) + fullChoice.vertex) (_ : newChoice.color ∈ MissingColors G + (corr.replacementSeries.data.coloring newi.succ) newChoice.vertex) (_ : newGamma ∉ + MissingColors G (corr.replacementSeries.data.coloring newi.succ) newChoice.vertex) (_ : + MissingColors G (ett.series.data.coloring fulli.succ) fullChoiceOnNew.vertex = + MissingColors G (corr.replacementSeries.data.coloring newi.succ) newChoice.vertex), + corr.replacementSeries.data.chosenVertex newi.succ = ett.series.data.chosenVertex + (Fin.castLE ( + by + omega + ) newi.succ) ∧ corr.replacementSeries.data.delta newi.succ = ett.series.data.delta (Fin.castLE + ( + by + omega + ) newi.succ) ∧ corr.replacementSeries.data.gamma newi.succ = ett.series.data.gamma (Fin.castLE + ( + by + omega + ) newi.succ) := by + classical + intro V E _ _ _ G k e0 input T generating ett gamma sigmaPrev hroundLarge originalPrefix hr + corr j fulli fullChoice fullGamma fullCurrentVertex fullCurrentDelta fullCurrentGamma newi + newChoice newGamma newCurrentVertex newCurrentDelta newCurrentGamma hindexMap htree + fullChoiceOnNew hfullVertexCast hfullColorCast hedgePairs hcolorPairs hfullDeltaMissing + hfullGammaNotMissing hnewDeltaMissing hnewGammaNotMissing hmissing + have hfullDeltaForIdentification : + fullChoiceOnNew.color ∈ MissingColors G + (ett.series.data.coloring fulli.succ) + fullChoiceOnNew.vertex := by + simpa only [hfullColorCast, hfullVertexCast] using + hfullDeltaMissing + have hfullGammaForIdentification : fullGamma ∉ + MissingColors G + (ett.series.data.coloring fulli.succ) + fullChoiceOnNew.vertex := by + simpa only [hfullVertexCast] using hfullGammaNotMissing + have hidentified := TdEarlierPEWitnessIdentification G k e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data fulli.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + newi.castSucc) + (ett.series.data.coloring fulli.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc) + fullChoiceOnNew newChoice fullGamma newGamma + (ett.series.data.coloring fulli.succ) + (corr.replacementSeries.data.coloring newi.succ) + hedgePairs hcolorPairs hmissing + hfullDeltaForIdentification hfullGammaForIdentification + hnewDeltaMissing hnewGammaNotMissing + rcases hidentified with ⟨-, hidentifiedVertex, -, + hidentifiedDelta, hidentifiedGamma⟩ + constructor + · calc + corr.replacementSeries.data.chosenVertex newi.succ = + some newChoice.vertex := newCurrentVertex + _ = some fullChoiceOnNew.vertex := + congrArg some hidentifiedVertex + _ = some fullChoice.vertex := + congrArg some hfullVertexCast + _ = ett.series.data.chosenVertex fulli.succ := + fullCurrentVertex.symm + _ = ett.series.data.chosenVertex + (Fin.castLE (by omega) newi.succ) := + congrArg _ hindexMap.symm + · constructor + · calc + corr.replacementSeries.data.delta newi.succ = + some newChoice.color := newCurrentDelta + _ = some fullChoiceOnNew.color := + congrArg some hidentifiedDelta + _ = some fullChoice.color := + congrArg some hfullColorCast + _ = ett.series.data.delta fulli.succ := + fullCurrentDelta.symm + _ = ett.series.data.delta + (Fin.castLE (by omega) newi.succ) := + congrArg _ hindexMap.symm + · calc + corr.replacementSeries.data.gamma newi.succ = + some newGamma := newCurrentGamma + _ = some fullGamma := congrArg some hidentifiedGamma + _ = ett.series.data.gamma fulli.succ := + fullCurrentGamma.symm + _ = ett.series.data.gamma + (Fin.castLE (by omega) newi.succ) := + congrArg _ hindexMap.symm + +private theorem helper_hedgePairs_6811.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + omega + ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (j : Fin (originalPrefix.rounds + + (1 : ℕ))), + let fullj : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( + by + omega + ) j; + ∀ (fulli : Fin ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (_ : ett.series.data.connectingEdges fulli.succ + = ({ fullChoice.edge } : Finset E)) (_ : fulli.succ = fullj) (newi : Fin + originalPrefix.rounds) (newChoice : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) (TashkinovStoredColors + corr.replacementSeries.data newi.castSucc) (corr.replacementSeries.data.coloring + newi.castSucc)) (_ : corr.replacementSeries.data.connectingEdges newi.succ = + ({ newChoice.edge } : Finset E)) (_ : newi.succ = j) (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + fulli.succ.castSucc), + let fullChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) := (Eq.symm htree ▸ fullChoice); + ∀ (_ : fullChoiceOnNew.edge = fullChoice.edge), ({ fullChoiceOnNew.edge } : Finset E) = + ({ newChoice.edge } : Finset E) := by + classical + intro V E _ _ _ G k e0 input T generating ett sigmaPrev hroundLarge originalPrefix hr + hprefixData corr j fullj fulli fullChoice fullCurrentEdges hfullIndex newi newChoice + newCurrentEdges hnewIndex htree fullChoiceOnNew hfullEdgeCast + have hfullEdges : ett.series.data.connectingEdges fullj = + {fullChoice.edge} := by + simpa [hfullIndex] using fullCurrentEdges + have hnewEdges : + corr.replacementSeries.data.connectingEdges j = + {newChoice.edge} := by + simpa [hnewIndex] using newCurrentEdges + calc + {fullChoiceOnNew.edge} = {fullChoice.edge} := by + rw [hfullEdgeCast] + _ = ett.series.data.connectingEdges fullj := + hfullEdges.symm + _ = originalPrefix.series.data.connectingEdges j := + (hprefixData j).2.2.1.symm + _ = corr.replacementSeries.data.connectingEdges j := + (corr.connectingEdgesAgree j).symm + _ = {newChoice.edge} := hnewEdges + +private theorem helper_hcolorPairs_6830.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + omega + ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (j : Fin (originalPrefix.rounds + + (1 : ℕ))), + let fullj : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( + by + omega + ) j; + ∀ (fulli : Fin ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (fullGamma : Fin k) (_ : ett.series.data.stored + fulli.succ = (insert fullChoice.color ({ fullGamma } : Finset (Fin k)) : Finset (Fin k))) + (_ : fulli.succ = fullj) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (newGamma : Fin k) (_ : + corr.replacementSeries.data.stored newi.succ = (insert newChoice.color ({ newGamma } : + Finset (Fin k)) : Finset (Fin k))) (_ : newi.succ = j) (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + fulli.succ.castSucc), + let fullChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) := (Eq.symm htree ▸ fullChoice); + ∀ (_ : fullChoiceOnNew.color = fullChoice.color), (insert fullChoiceOnNew.color ({ fullGamma } + : Finset (Fin k)) : Finset (Fin k)) = (insert newChoice.color ({ newGamma } : Finset (Fin + k)) : Finset (Fin k)) := by + classical + intro V E _ _ _ G k e0 input T generating ett sigmaPrev hroundLarge originalPrefix hr + hprefixData corr j fullj fulli fullChoice fullGamma fullCurrentStored hfullIndex newi + newChoice newGamma newCurrentStored hnewIndex htree fullChoiceOnNew hfullColorCast + have hfullStored : ett.series.data.stored fullj = + {fullChoice.color, fullGamma} := by + simpa [hfullIndex] using fullCurrentStored + have hnewStored : corr.replacementSeries.data.stored j = + {newChoice.color, newGamma} := by + simpa [hnewIndex] using newCurrentStored + calc + {fullChoiceOnNew.color, fullGamma} = + {fullChoice.color, fullGamma} := by rw [hfullColorCast] + _ = ett.series.data.stored fullj := hfullStored.symm + _ = originalPrefix.series.data.stored j := + (hprefixData j).2.1.symm + _ = corr.replacementSeries.data.stored j := + (corr.storedColorsAgree j).symm + _ = {newChoice.color, newGamma} := hnewStored + +private theorem helper_hends_6853.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (fulli : + Fin ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + fulli.succ.castSucc), + let fullChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) := (Eq.symm htree ▸ fullChoice); + ∀ (_ : newChoice.edge = fullChoiceOnNew.edge), s(fullChoiceOnNew.vertex, + fullChoiceOnNew.otherEndpoint) = s(newChoice.vertex, newChoice.otherEndpoint) := by + classical + intro V E _ _ _ G k e0 input T generating ett sigmaPrev hroundLarge originalPrefix corr fulli + fullChoice newi newChoice htree fullChoiceOnNew hedgeIdentity + calc + s(fullChoiceOnNew.vertex, + fullChoiceOnNew.otherEndpoint) = + G.ends fullChoiceOnNew.edge := + fullChoiceOnNew.edgeEnds.symm + _ = G.ends newChoice.edge := + congrArg G.ends hedgeIdentity.symm + _ = s(newChoice.vertex, newChoice.otherEndpoint) := + newChoice.edgeEnds + +private theorem helper_hvertexIdentity_6865.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (fulli : + Fin ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + fulli.succ.castSucc), + let fullChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) := (Eq.symm htree ▸ fullChoice); + ∀ (_ : s(fullChoiceOnNew.vertex, fullChoiceOnNew.otherEndpoint) = s(newChoice.vertex, + newChoice.otherEndpoint)), newChoice.vertex = fullChoiceOnNew.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett sigmaPrev hroundLarge originalPrefix corr fulli + fullChoice newi newChoice htree fullChoiceOnNew hends + rcases Sym2.eq_iff.mp hends with hstraight | hcross + · exact hstraight.1.symm + · exfalso + exact newChoice.otherOutside + (hcross.1 ▸ fullChoiceOnNew.vertexDefective.1) + +private theorem helper_hotherIdentity_6872.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (fulli : + Fin ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + fulli.succ.castSucc), + let fullChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) := (Eq.symm htree ▸ fullChoice); + ∀ (_ : s(fullChoiceOnNew.vertex, fullChoiceOnNew.otherEndpoint) = s(newChoice.vertex, + newChoice.otherEndpoint)), newChoice.otherEndpoint = fullChoiceOnNew.otherEndpoint := by + classical + intro V E _ _ _ G k e0 input T generating ett sigmaPrev hroundLarge originalPrefix corr fulli + fullChoice newi newChoice htree fullChoiceOnNew hends + rcases Sym2.eq_iff.mp hends with hstraight | hcross + · exact hstraight.2.symm + · exfalso + exact fullChoiceOnNew.otherOutside + (hcross.2 ▸ newChoice.vertexDefective.1) + +private theorem helper_hmissing_6909.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (fulli : + Fin ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + fulli.succ.castSucc), + let fullChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) := (Eq.symm htree ▸ fullChoice); + ∀ (_ : fullChoiceOnNew.vertex = fullChoice.vertex) (_ : newChoice.vertex = + fullChoiceOnNew.vertex) (_ : originalPrefix.series.data.coloring newi.succ = + ett.series.data.coloring fulli.succ) (_ : MissingColors G + (corr.replacementSeries.data.coloring newi.succ) fullChoice.vertex = MissingColors G + (originalPrefix.series.data.coloring newi.succ) fullChoice.vertex), MissingColors G + (ett.series.data.coloring fulli.succ) fullChoiceOnNew.vertex = MissingColors G + (corr.replacementSeries.data.coloring newi.succ) newChoice.vertex := by + classical + intro V E _ _ _ G k e0 input T generating ett sigmaPrev hroundLarge originalPrefix corr fulli + fullChoice newi newChoice htree fullChoiceOnNew hfullVertexCast hvertexIdentity + hprefixPostFull hstableMissing + calc + MissingColors G + (ett.series.data.coloring fulli.succ) + fullChoiceOnNew.vertex = + MissingColors G + (ett.series.data.coloring fulli.succ) + fullChoice.vertex := congrArg _ hfullVertexCast + _ = MissingColors G + (originalPrefix.series.data.coloring newi.succ) + fullChoice.vertex := congrArg + (fun phi => MissingColors G phi fullChoice.vertex) + hprefixPostFull.symm + _ = MissingColors G + (corr.replacementSeries.data.coloring newi.succ) + fullChoice.vertex := hstableMissing.symm + _ = MissingColors G + (corr.replacementSeries.data.coloring newi.succ) + newChoice.vertex := congrArg _ + (hvertexIdentity.trans hfullVertexCast).symm + +private theorem helper_hcolorPairs_7591.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + omega + ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (j : Fin (originalPrefix.rounds + + (1 : ℕ))), + let fullj : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( + by + omega + ) j; + ∀ (fulli : Fin ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (fullGamma : Fin k) (_ : ett.series.data.stored + fulli.succ = (insert fullChoice.color ({ fullGamma } : Finset (Fin k)) : Finset (Fin k))) + (_ : fulli.succ = fullj) (newi : Fin originalPrefix.rounds) (newChoice : + MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc)) (newGamma : Fin k) (_ : + corr.replacementSeries.data.stored newi.succ = (insert newChoice.color ({ newGamma } : + Finset (Fin k)) : Finset (Fin k))) (_ : newi.succ = j) (htree : + corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree + fulli.succ.castSucc), + let fullChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + newi.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) := (Eq.symm htree ▸ fullChoice); + ∀ (_ : fullChoiceOnNew.color = fullChoice.color), (insert fullChoiceOnNew.color ({ fullGamma } + : Finset (Fin k)) : Finset (Fin k)) = (insert newChoice.color ({ newGamma } : Finset (Fin + k)) : Finset (Fin k)) := by + classical + intro V E _ _ _ G k e0 input T generating ett sigmaPrev hroundLarge originalPrefix hr + hprefixData corr j fullj fulli fullChoice fullGamma fullCurrentStored hfullIndex newi + newChoice newGamma newCurrentStored hnewIndex htree fullChoiceOnNew hfullColorCast + apply helper_hcolorPairs_6830 <;> assumption +private theorem helper_hprefixPostFull_7637.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < + ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + omega + ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : (0 : ℕ) < + originalPrefix.rounds) (j : Fin (originalPrefix.rounds + (1 : ℕ))), + let fullj : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( + by + omega + ) j; + ∀ (fulli : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 (ett.series.data.tree + fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc)) (_ : fullj = fulli.succ) (newi : Fin + originalPrefix.rounds) (_ : newi.succ = j) (_ : corr.replacementSeries.data.tree + newi.succ.castSucc = ett.series.data.tree fulli.succ.castSucc), + originalPrefix.series.data.coloring newi.succ = ett.series.data.coloring fulli.succ := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive Tstar q gamma choice sigmaPrev H u p + hroundLarge originalPrefix hr hprefixData corr horiginalPositive j fullj fulli fullChoice + hfullTarget newi hnewIndex htree + exact @helper_hprefixPostFull_6259 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) + (@sigmaPrev) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixData) (@corr) + (@horiginalPositive) (@j) (@fulli) (@fullChoice) (@hfullTarget) (@newi) (@hnewIndex) + (@htree) + +theorem helper_branch_12991.{u_1, u_2} : + helperBranch12991Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive Tstar q gamma choice sigmaPrev H u p + hroundLarge originalPrefix hr hprefixTrees hprefixData corr horiginalPositive pePostStatus + j fullj fulli fullChoice fullGamma fullGammaRule fullSecond fullSecondProper + fullSecondStable fullCurrentColoring fullCurrentStored fullCurrentEdges fullCurrentVertex + fullCurrentDelta fullCurrentGamma hfullTarget hfullIndex newi newChoice newGamma + newGammaRule newSecond newSecondProper newSecondStable newCurrentColoring newCurrentStored + newCurrentEdges newCurrentVertex newCurrentDelta newCurrentGamma hnewTarget + have hnewIndex : newi.succ = j := by + simpa using hnewTarget.symm + have hindexMap := @helper_hindexMap_6123 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) + (@sigmaPrev) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@horiginalPositive) + (@j) (@fulli) (@hfullIndex) (@newi) (@hnewTarget) (@hnewIndex) + have htree := @helper_htree_6130 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) (@sigmaPrev) + (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) (@corr) (@horiginalPositive) + (@j) (@fulli) (@hfullIndex) (@newi) (@hnewTarget) (@hnewIndex) + let fullChoiceOnNew : MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) := + htree.symm ▸ fullChoice + have transportChoiceFields : + ∀ {A B : TreeSequence G e0} (hAB : A = B) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 A C phi), (hAB ▸ ch).edge = ch.edge ∧ (hAB ▸ ch).vertex + = ch.vertex ∧ (hAB ▸ ch).otherEndpoint = ch.otherEndpoint ∧ (hAB ▸ ch).color = ch.color + := by + intro A B hAB C phi ch + subst B + exact ⟨rfl, rfl, rfl, rfl⟩ + have htransport := transportChoiceFields htree.symm + (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) fullChoice + have hfullEdgeCast : fullChoiceOnNew.edge = + fullChoice.edge := htransport.1 + have hfullVertexCast : fullChoiceOnNew.vertex = + fullChoice.vertex := htransport.2.1 + have hfullOtherCast : fullChoiceOnNew.otherEndpoint = + fullChoice.otherEndpoint := htransport.2.2.1 + have hfullColorCast : fullChoiceOnNew.color = + fullChoice.color := htransport.2.2.2 + have hedgePairs : ({fullChoiceOnNew.edge} : Finset E) = + {newChoice.edge} := by + apply helper_hedgePairs_6811 <;> assumption + have hcolorPairs : + ({fullChoiceOnNew.color, fullGamma} : Finset (Fin k)) = + {newChoice.color, newGamma} := by + apply helper_hcolorPairs_7591 <;> assumption + have hedgeIdentity : newChoice.edge = + fullChoiceOnNew.edge := by + apply Finset.mem_singleton.mp + rw [hedgePairs] + exact Finset.mem_singleton_self _ + have hends : s(fullChoiceOnNew.vertex, + fullChoiceOnNew.otherEndpoint) = + s(newChoice.vertex, newChoice.otherEndpoint) := by + apply helper_hends_6853 <;> assumption + have hvertexIdentity : newChoice.vertex = + fullChoiceOnNew.vertex := by + apply helper_hvertexIdentity_6865 <;> assumption + have hotherIdentity : newChoice.otherEndpoint = + fullChoiceOnNew.otherEndpoint := by + apply helper_hotherIdentity_6872 <;> assumption + obtain ⟨hfullDeltaMissing, hfullGammaNotMissing, -⟩ := + pePostStatus + (ett.series.data.tree fulli.succ.castSucc) + (TashkinovStoredColors ett.series.data fulli.castSucc) + (ett.series.data.coloring fulli.castSucc) fullChoice + fullGamma fullSecond fullSecondProper fullSecondStable + fullGammaRule.1 + obtain ⟨hnewDeltaMissing, hnewGammaNotMissing, -⟩ := + pePostStatus + (corr.replacementSeries.data.tree newi.succ.castSucc) + (TashkinovStoredColors corr.replacementSeries.data + newi.castSucc) + (corr.replacementSeries.data.coloring newi.castSucc) + newChoice newGamma newSecond newSecondProper + newSecondStable newGammaRule.1 + rw [← fullCurrentColoring] at hfullDeltaMissing hfullGammaNotMissing + rw [← newCurrentColoring] at hnewDeltaMissing hnewGammaNotMissing + have hprefixPostFull := @helper_hprefixPostFull_7637 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixData) (@corr) (@horiginalPositive) (@j) (@fulli) (@fullChoice) (@hfullTarget) (@newi) + (@hnewIndex) (@htree) + have hvPrefix : fullChoice.vertex ∈ + TreeSequenceVertexSet + (originalPrefix.series.data.tree + newi.succ.castSucc) := by + rw [← corr.ladderTreesAgree newi] + simpa [hfullVertexCast] using + fullChoiceOnNew.vertexDefective.1 + have hstableMissing := + (corr.replacementStable newi).2 fullChoice.vertex hvPrefix + have hmissing : MissingColors G + (ett.series.data.coloring fulli.succ) + fullChoiceOnNew.vertex = + MissingColors G + (corr.replacementSeries.data.coloring newi.succ) + newChoice.vertex := by + apply helper_hmissing_6909 <;> assumption + exact helper_continuation_6083 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@gamma) + (@sigmaPrev) (@hroundLarge) (@originalPrefix) (@hr) (@corr) (@j) (@fulli) (@fullChoice) + (@fullGamma) (@fullCurrentVertex) (@fullCurrentDelta) (@fullCurrentGamma) (@newi) + (@newChoice) (@newGamma) (@newCurrentVertex) (@newCurrentDelta) (@newCurrentGamma) + (@hindexMap) (@htree) (@hfullVertexCast) (@hfullColorCast) (@hedgePairs) (@hcolorPairs) + (@hfullDeltaMissing) (@hfullGammaNotMissing) (@hnewDeltaMissing) (@hnewGammaNotMissing) + (@hmissing) +theorem helper_branch_12854.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring (Fin.last ett.rounds)) + sigma → + ∀ (Tstar : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) Tstar → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length + < Tstar.length → (ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc) Tstar ∨ (ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last + ett.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence sigma seed Tstar) → + ∀ (closureTree : TreeSequence G e0), TashkinovClosure sigma Tstar closureTree → + TreeSequenceInitialSegment Tstar closureTree → TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (_ : TreeSequence G e0) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring + q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring + q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), ett.series.data.stored q.succ = ({ choice.color } + : Finset (Fin k)) → ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) + → ett.series.data.kind q.succ = some TashkinovExtensionKind.SE → ett.series.data.kind + q.succ = some TashkinovExtensionKind.SE → + ∀ (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev), sigmaPrev = sigma → + ∀ (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hsigmaPrevSelf : StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice2409 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → ( + ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected pi + → Disjoint (MissingColors G pi newChoice.otherEndpoint) (TreeMissingColors pi + (ett.series.data.tree q.succ.castSucc))) → (ett.rounds = (1 : ℕ) ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), zeroPrefix.data.tree (Fin.last (1 : ℕ)) = ett.series.data.tree (Fin.last + ett.rounds).castSucc ∧ zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigmaPrev) → Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict heligible closureTree hclosure hTstarClosure hTnClosure + q hqSucc adjoined previousProper previousOneUncolored choice currentStored currentEdges + currentKind hseKind sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hsigmaPrevSigma hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hclosedPrev + hnotStrongPrev hnewAlternative hzero + rcases hzero with ⟨hroundOne, prefixInput, zeroPrefix, + hzeroTree, hzeroColor⟩ + rcases heligible with hparallel | hsimple + · have hbad := hparallel.1.symm.trans + (by simpa [hqSucc] using hseKind) + cases hbad + · exact @helper_branch_11555 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@hsigmaOne) + (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hclosure) (@hTstarClosure) + (@hTnClosure) (@hqSucc) (@adjoined) (@previousProper) (@previousOneUncolored) (@choice) + (@currentStored) (@currentEdges) (@currentKind) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hsigmaPrevSigma) (@hchoiceDefective) + (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) (@hnewAlternative) + (@hroundOne) (@prefixInput) (@zeroPrefix) (@hzeroTree) (@hzeroColor) (@hsimple) + +theorem helper_branch_13492.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → StableColoring + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (TashkinovStoredColors + ett.series.data (Fin.last ett.rounds)) (ett.series.data.coloring (Fin.last ett.rounds)) + sigma → + ∀ (Tstar : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + ett.rounds).castSucc) Tstar → (ett.series.data.tree (Fin.last ett.rounds).castSucc).length + < Tstar.length → (ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence sigma (ett.series.data.tree + (Fin.last ett.rounds).castSucc) Tstar ∨ (ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last + ett.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence sigma seed Tstar) → + ∀ (closureTree : TreeSequence G e0), TashkinovClosure sigma Tstar closureTree → + TreeSequenceInitialSegment Tstar closureTree → TreeSequenceInitialSegment + (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree → + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (gamma : Fin k) (_ : PartialEdgeColoring E k) (previousProper : IsProperEdgeColoring G + (ett.series.data.coloring q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored + (ett.series.data.coloring q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), ett.series.data.stored q.succ = (insert + choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k)) → + ett.series.data.connectingEdges q.succ = ({ choice.edge } : Finset E) → + ett.series.data.kind q.succ = some TashkinovExtensionKind.PE → ett.series.data.kind q.succ + = some TashkinovExtensionKind.PE → + ∀ (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev) (hchoiceDefective : DefectiveColor G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + sigmaPrev sigmaPrev), + let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice4049 G k e0 + input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf; ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) → ¬ColoredVertexSetStronglyClosed G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) → ( + ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ + StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color + (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected + rho ∧ ¬Disjoint (MissingColors G rho newChoice.otherEndpoint) (TreeMissingColors rho + (ett.series.data.tree q.succ.castSucc))) → gamma ∈ MissingColors G sigmaPrev choice.vertex + → sigma = TwoColorComponentSwap G sigmaPrev gamma choice.color (Sum.inl choice.vertex) → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; + ∀ (a b : V ⊕ E) (p_1 : (TwoColorIncidenceGraph G sigmaPrev gamma choice.color).Walk a b), + p_1.IsPath → + ∀ (u : V) (p : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), p.IsPath → TreeExit + (ett.series.data.tree q.succ.castSucc) sigmaPrev gamma choice.color choice.vertex → + (ett.rounds = (1 : ℕ) ∧ + ∃ (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 + prefixInput), zeroPrefix.data.tree (Fin.last (1 : ℕ)) = ett.series.data.tree (Fin.last + ett.rounds).castSucc ∧ zeroPrefix.data.coloring (Fin.last (0 : ℕ)) = sigmaPrev) → Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne + hsigmaStable Tstar hTnTstar hstrict heligible closureTree hclosure hTstarClosure hTnClosure + q hqSucc gamma secondStable previousProper previousOneUncolored choice currentStored + currentEdges currentKind hpeKind sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hclosedPrev hnotStrongPrev + hnewAlternativeFails hgammaPrevMissing hsigmaRecovered H auxiliaryStart b auxiliaryWalk + auxiliaryPath u p hp hnewExit hzero + rcases hzero with ⟨hroundOne, prefixInput, zeroPrefix, + hzeroTree, hzeroColor⟩ + rcases heligible with hparallel | hsimple + · exact @helper_branch_12554 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@hsigmaOne) + (@hsigmaStable) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hclosure) (@hTstarClosure) + (@hTnClosure) (@hqSucc) (@gamma) (@secondStable) (@previousProper) (@previousOneUncolored) + (@choice) (@currentStored) (@currentEdges) (@currentKind) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) + (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) (@hnewAlternativeFails) + (@hgammaPrevMissing) (@hsigmaRecovered) (@auxiliaryStart) (@b) (@auxiliaryWalk) + (@auxiliaryPath) (@u) (@p) (@hp) + (@hnewExit) (@hroundOne) (@prefixInput) (@zeroPrefix) (@hzeroTree) (@hzeroColor) (@hparallel) + · exact @helper_branch_5820 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@hqSucc) (@hpeKind) + (@hsimple) + +theorem helper_retainedPEFields_13584.{u_1, u_2} : + helperRetainedPEFields13584Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive Tstar q gamma previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice H u p hroundLarge originalPrefix + hr hprefixTrees hprefixData corr horiginalPositive retainedKind pePostStatus j hjPositive hjPE + let fullj : Fin (ett.rounds + 1) := Fin.castLE (by omega) j + have hfullPE : ett.series.data.kind fullj = + some TashkinovExtensionKind.PE := by + simpa [fullj] using (retainedKind j).symm.trans hjPE + have hfullStep := ett.series.certified fullj + generalize hfullTarget : fullj = fullTarget at hfullStep + cases hfullStep with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hbad := initialKind.symm.trans + (by simpa [hfullTarget] using hfullPE) + simp at hbad + | SE fulli fullPreviousProper fullPreviousOne fullPreviousClosed + fullPreviousNotStrong fullNoRE fullChoice fullAlternative + fullCurrentColoring fullCurrentStored fullCurrentEdges + fullCurrentKind fullCurrentVertex fullCurrentOutside + fullCurrentDelta fullCurrentGamma fullAdjoined + fullAdjoinedExactly fullClosed fullOrdered fullStrict => + have hbad := fullCurrentKind.symm.trans + (by simpa [hfullTarget] using hfullPE) + cases hbad + | RE fulli fullPreviousProper fullPreviousOne fullPreviousClosed + fullPreviousNotStrong fullAvailable fullCurrentColoring + fullCurrentStored fullCurrentEdges fullCurrentKind + fullCurrentVertex fullCurrentOutside fullCurrentDelta + fullCurrentGamma fullAdjoined fullAdjoinedExactly fullClosed + fullOrdered fullStrict => + have hbad := fullCurrentKind.symm.trans + (by simpa [hfullTarget] using hfullPE) + cases hbad + | PE fulli fullPreviousProper fullPreviousOne fullPreviousClosed + fullPreviousNotStrong fullNoRE fullChoice fullAlternativeFails + fullGamma fullGammaRule fullSecond fullSecondProper fullSecondOne + fullSecondStable fullExit fullCurrentColoring fullCurrentProper + fullCurrentOne fullCurrentStored fullCurrentEdges fullCurrentKind + fullCurrentVertex fullCurrentOutside fullCurrentDelta + fullCurrentGamma fullClosed fullOrdered fullStrict => + have hfullIndex : fulli.succ = fullj := by + simpa using hfullTarget.symm + have hnewStep := corr.replacementSeries.certified j + generalize hnewTarget : j = newTarget at hnewStep + cases hnewStep with + | initial triple seedLength initialColoring initialStored + initialEdges initialKind initialVertex initialOutside + initialDelta initialGamma initialClosure => + have hbad := initialKind.symm.trans + (by simpa [hnewTarget] using hjPE) + simp at hbad + | SE newi newPreviousProper newPreviousOne newPreviousClosed + newPreviousNotStrong newNoRE newChoice newAlternative + newCurrentColoring newCurrentStored newCurrentEdges + newCurrentKind newCurrentVertex newCurrentOutside + newCurrentDelta newCurrentGamma newAdjoined + newAdjoinedExactly newClosed newOrdered newStrict => + have hbad := newCurrentKind.symm.trans + (by simpa [hnewTarget] using hjPE) + cases hbad + | RE newi newPreviousProper newPreviousOne newPreviousClosed + newPreviousNotStrong newAvailable newCurrentColoring + newCurrentStored newCurrentEdges newCurrentKind + newCurrentVertex newCurrentOutside newCurrentDelta + newCurrentGamma newAdjoined newAdjoinedExactly newClosed + newOrdered newStrict => + have hbad := newCurrentKind.symm.trans + (by simpa [hnewTarget] using hjPE) + cases hbad + | PE newi newPreviousProper newPreviousOne newPreviousClosed + newPreviousNotStrong newNoRE newChoice newAlternativeFails + newGamma newGammaRule newSecond newSecondProper newSecondOne + newSecondStable newExit newCurrentColoring newCurrentProper + newCurrentOne newCurrentStored newCurrentEdges newCurrentKind + newCurrentVertex newCurrentOutside newCurrentDelta + newCurrentGamma newClosed newOrdered newStrict => + exact @helper_branch_12991 (@V) (@E) inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) + (@choice) (@sigmaPrev) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) + (@hprefixTrees) (@hprefixData) (@corr) (@horiginalPositive) (@pePostStatus) + (@j) (@fulli) (@fullChoice) (@fullGamma) (@fullGammaRule) (@fullSecond) + (@fullSecondProper) (@fullSecondStable) (@fullCurrentColoring) + (@fullCurrentStored) (@fullCurrentEdges) (@fullCurrentVertex) + (@fullCurrentDelta) (@fullCurrentGamma) (@hfullTarget) (@hfullIndex) (@newi) + (@newChoice) (@newGamma) (@newGammaRule) (@newSecond) (@newSecondProper) + (@newSecondStable) (@newCurrentColoring) (@newCurrentStored) (@newCurrentEdges) + (@newCurrentVertex) (@newCurrentDelta) (@newCurrentGamma) (@hnewTarget) + +theorem helper_hpeGammaRuleReplacement_13982.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (gamma : Fin k) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring + q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring + q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)), ParallelExtensionColor ett.series.data q.castSucc + choice.selected choice.vertex gamma → + ∀ (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev) (hchoiceDefective : DefectiveColor G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color) + (hchoiceEdgeNew : choice.edge ∈ BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring + (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) + sigmaPrev sigmaPrev), gamma ∈ MissingColors G sigmaPrev choice.vertex → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; Sum.inr + choice.edge ∈ TwoColorComponent G sigmaPrev gamma choice.color (Sum.inl choice.vertex) → + ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)), (1 : ℕ) < ett.rounds → + ∀ (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last + ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( + ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), originalPrefix.series.data.tree i = + ett.series.data.tree (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → ( + ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = + ett.series.data.coloring (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges + (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors + ett.series.data (Fin.castLE ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) i)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (hcorrFinalColor : + corr.replacementSeries.data.coloring (Fin.last originalPrefix.rounds) = sigmaPrev), + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + (0 : ℕ) < originalPrefix.rounds → + ∀ (hreplacementCurrentTree : corr.replacementSeries.data.tree replacementLast.succ = + ett.series.data.tree q.succ.castSucc) (hreplacementStored : TashkinovStoredColors + corr.replacementSeries.data replacementLast = TashkinovStoredColors ett.series.data + q.castSucc), + let replacementChoice : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree + replacementLast.succ) (TashkinovStoredColors corr.replacementSeries.data replacementLast) + (corr.replacementSeries.data.coloring replacementLast) := helperReplacementChoice5196 G k + e0 input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf originalPrefix corr hcorrFinalColor hreplacementCurrentTree + hreplacementStored; ParallelExtensionColor corr.replacementSeries.data replacementLast + replacementChoice.selected replacementChoice.vertex gamma := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive Tstar q gamma previousProper + previousOneUncolored choice gammaRule sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf hgammaPrevMissing H + hedgeComponent u p hroundLarge originalPrefix hr hprefixTrees hprefixData corr + hcorrFinalColor replacementLast horiginalPositive hreplacementCurrentTree + hreplacementStored replacementChoice + have retainedKind : ∀ j : Fin (originalPrefix.rounds + 1), + corr.replacementSeries.data.kind j = + ett.series.data.kind (Fin.castLE (by omega) j) := by + intro j + exact (corr.extensionKindsAgree j).trans + (hprefixData j).2.2.2.1 + have pePostStatus := @helper_pePostStatus_12865 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@gamma) (@choice) (@sigmaPrev) (@hedgeComponent) + have retainedPEFields := @helper_retainedPEFields_13584 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + (@gamma) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) + (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) + (@horiginalPositive) (@retainedKind) (@pePostStatus) + refine ⟨?_, ?_⟩ + · simpa [replacementChoice] using hgammaPrevMissing + · exact @helper_branch_6368 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@previousProper) + (@previousOneUncolored) (@choice) (@gammaRule) (@sigmaPrev) (@hsigmaPrevProper) + (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) + (@hsigmaPrevSelf) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@corr) + (@hcorrFinalColor) (@horiginalPositive) (@hreplacementCurrentTree) (@hreplacementStored) + (@retainedKind) (@retainedPEFields) + +end GoldbergSeymour.TerminalSeriesRebuild + +end diff --git a/LeanPool/GoldbergSeymour/TerminalStableRoute.lean b/LeanPool/GoldbergSeymour/TerminalStableRoute.lean new file mode 100644 index 0000000000..e2fbcb8b12 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalStableRoute.lean @@ -0,0 +1,236 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion + +/-! +# P2647_T1_Terminal Stable Route + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem P2647_T1_TerminalStableRoute + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} + {generating : PartialEdgeColoring E k} + (original : ExtendedTashkinovTree G k e0 input T generating) + (sigma : PartialEdgeColoring E k) + (hproper : IsProperEdgeColoring G sigma) + (hone : IsOneEdgeUncolored sigma e0) + (hstable : StableColoring + (original.series.data.tree (Fin.last (original.rounds + 1))) + (TashkinovStoredColors original.series.data (Fin.last original.rounds)) + (original.series.data.coloring (Fin.last original.rounds)) sigma) : + let n := Fin.last original.rounds + let Tn := original.series.data.tree n.castSucc + let F := original.series.data.tree (Fin.last (original.rounds + 1)) + let phi := original.series.data.coloring n + let D := TashkinovStoredColors original.series.data n + IsProperEdgeColoring G phi ∧ IsOneEdgeUncolored phi e0 ∧ + TreeSequenceInitialSegment Tn F ∧ Tn.length < F.length ∧ + StableColoring Tn D phi sigma ∧ + ((original.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovClosure sigma Tn F) ∨ + ((original.series.data.kind n = some TashkinovExtensionKind.SE ∨ + original.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + original.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovClosure sigma seed F)) := by + classical + let n := Fin.last original.rounds + let Tn := original.series.data.tree n.castSucc + let F := original.series.data.tree (Fin.last (original.rounds + 1)) + let phi := original.series.data.coloring n + let D := TashkinovStoredColors original.series.data n + let q : Fin original.rounds := ⟨original.rounds - 1, by + have := original.roundsPositive + omega⟩ + have hq : q.succ = n := by + apply Fin.ext + dsimp [q, n] + have := original.roundsPositive + omega + have hnFinal : n.succ = Fin.last (original.rounds + 1) := rfl + have transport {S : TreeSequence G e0} + (hp : IsProperEdgeColoring G phi) (ho : IsOneEdgeUncolored phi e0) + (hclosure : TashkinovClosure phi S F) : + TashkinovClosure sigma S F := by + as_aux_lemma => + have routeTransport (A : TreeSequence G e0) + (hroute : TashkinovAugmentationSequence phi A F) : + TashkinovAugmentationSequence sigma A F := by + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hstep htail ih => + obtain ⟨hlen, hAB, c, hcolor, hc⟩ := hstep + have hBF := TashkinovAugmentationSequenceInitialSegment phi B F htail + have hAF := TashkinovAugmentationSequenceInitialSegment phi A F + (Relation.ReflTransGen.head ⟨hlen, hAB, c, hcolor, hc⟩ htail) + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hvF := TreeSequenceInitialSegmentVertexSetSubset hAF hv + have hcF : c ∈ TreeMissingColors phi F := + Finset.mem_biUnion.mpr ⟨v, hvF, hcv⟩ + let j : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + have hj : TreeIncidentEdge F (B.edge j) := by + obtain ⟨i, hi⟩ := B.attaches j + refine ⟨B.vertex j.succ, ?_, ?_⟩ + · apply TreeSequenceInitialSegmentVertexSetSubset hBF + simp only [TreeSequenceVertexSet, Finset.mem_image, + Finset.mem_univ, true_and] + exact ⟨j.succ, rfl⟩ + · simp [Incident, hi] + have hfixed : sigma (B.edge j) = phi (B.edge j) := + hstable.1 _ hj ⟨c, Finset.mem_union_left D hcF, hcolor⟩ + have hcSigma : c ∈ TreeMissingColors sigma A := by + apply Finset.mem_biUnion.mpr + refine ⟨v, hv, ?_⟩ + rw [hstable.2 v hvF] + exact hcv + exact Relation.ReflTransGen.head + ⟨hlen, hAB, c, hfixed.trans hcolor, hcSigma⟩ ih + refine ⟨routeTransport S hclosure.1, ?_⟩ + intro f c v hf hv hfc hcv + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf + obtain ⟨u, hu, w, hw, hend⟩ := hf + have hincident : TreeIncidentEdge F f := by + refine ⟨u, hu, ?_⟩ + simp [Incident, hend] + have hcphi : c ∈ MissingColors G phi v := by + rw [← hstable.2 v hv] + exact hcv + have hcF : c ∈ TreeMissingColors phi F := + Finset.mem_biUnion.mpr ⟨v, hv, hcphi⟩ + have hfixed := (sc1 G e0 F D phi sigma hp ho hproper hone).mp hstable + f hincident (Or.inr ⟨c, Finset.mem_union_left D hcF, hfc⟩) + have hboundary : f ∈ BoundaryEdges G (TreeSequenceVertexSet F) := by + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨u, hu, w, hw, hend⟩ + exact hclosure.2 hboundary hv (hfixed.symm.trans hfc) hcphi + have cert := original.series.certified n + generalize hn : n = target at cert + have facts : IsProperEdgeColoring G phi ∧ IsOneEdgeUncolored phi e0 ∧ + TreeSequenceInitialSegment Tn F ∧ Tn.length < F.length ∧ + ((original.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovClosure sigma Tn F) ∨ + ((original.series.data.kind n = some TashkinovExtensionKind.SE ∨ + original.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + original.series.data.connectingEdges n = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ + TashkinovClosure sigma seed F)) := by + cases cert with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + have hzero : original.rounds = 0 := congrArg Fin.val hn + have := original.roundsPositive + omega + | SE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hvals := congrArg Fin.val hn + simp only [n, Fin.val_last, Fin.val_succ] at hvals + dsimp [q] + omega + subst i + have hp : IsProperEdgeColoring G phi := by + simpa [phi, ← hq, currentColoring] using choice.selectedProper + have ho : IsOneEdgeUncolored phi e0 := by + simpa [phi, ← hq, currentColoring] using choice.selectedOneUncolored + refine ⟨hp, ho, ?_, ?_, Or.inr ⟨Or.inl ?_, choice.edge, + adjoined, ?_, ?_, ?_⟩⟩ + · simpa only [Tn, F, hq, hnFinal] using orderedExtension + · simpa only [Tn, F, hq, hnFinal] using strictExtension + · simpa [hq] using currentKind + · simpa [hq] using currentEdges + · simpa [Tn, hq] using adjoinedExactly + · exact transport hp ho (by simpa only [phi, F, hq, hnFinal] using closedExtension) + | PE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper secondStableOneUncolored + secondStableRelation exitWitness currentColoring currentProper + currentOneUncolored currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma closedExtension + orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hvals := congrArg Fin.val hn + simp only [n, Fin.val_last, Fin.val_succ] at hvals + dsimp [q] + omega + subst i + have hp : IsProperEdgeColoring G phi := by simpa [phi, hq] using currentProper + have ho : IsOneEdgeUncolored phi e0 := by simpa [phi, hq] using currentOneUncolored + refine ⟨hp, ho, ?_, ?_, Or.inl ⟨?_, ?_⟩⟩ + · simpa only [Tn, F, hq, hnFinal] using orderedExtension + · simpa only [Tn, F, hq, hnFinal] using strictExtension + · simpa [hq] using currentKind + · exact transport hp ho (by simpa only [phi, Tn, F, hq, hnFinal] using closedExtension) + | RE i previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension + orderedExtension strictExtension => + have hi : i = q := by + apply Fin.ext + have hvals := congrArg Fin.val hn + simp only [n, Fin.val_last, Fin.val_succ] at hvals + dsimp [q] + omega + subst i + have hp : IsProperEdgeColoring G phi := by + simpa [phi, ← hq, currentColoring] using previousProper + have ho : IsOneEdgeUncolored phi e0 := by + simpa [phi, ← hq, currentColoring] using previousOneUncolored + refine ⟨hp, ho, ?_, ?_, Or.inr ⟨Or.inr ?_, available.edge, + adjoined, ?_, ?_, ?_⟩⟩ + · simpa only [Tn, F, hq, hnFinal] using orderedExtension + · simpa only [Tn, F, hq, hnFinal] using strictExtension + · simpa [hq] using currentKind + · simpa [hq] using currentEdges + · simpa [Tn, hq] using adjoinedExactly + · exact transport hp ho (by simpa only [phi, F, hq, hnFinal] using closedExtension) + have hsubset := TreeSequenceInitialSegmentVertexSetSubset facts.2.2.1 + have hmonotone := (HkuMissingStoredMonotone G k original.rounds e0 input + original.series q).2 + have hmonotone' : TreeMissingColors phi Tn ∪ D ⊆ TreeMissingColors phi F ∪ D := by + simpa only [Tn, F, phi, D, hq, hnFinal] using hmonotone + have ladderStable : StableColoring Tn D phi sigma := by + refine ⟨?_, fun v hv => hstable.2 v (hsubset hv)⟩ + intro f hf hc + obtain ⟨v, hv, hi⟩ := hf + apply hstable.1 f ⟨v, hsubset hv, hi⟩ + obtain ⟨c, hc, hfc⟩ := hc + exact ⟨c, hmonotone' hc, hfc⟩ + exact ⟨facts.1, facts.2.1, facts.2.2.1, facts.2.2.2.1, + ladderStable, facts.2.2.2.2⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TerminalStoredColors.lean b/LeanPool/GoldbergSeymour/TerminalStoredColors.lean new file mode 100644 index 0000000000..46d35e2e5d --- /dev/null +++ b/LeanPool/GoldbergSeymour/TerminalStoredColors.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree + +/-! +# P2752_T2_Terminal Stored Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2752_T2_TerminalStoredColors {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input phi sigma : PartialEdgeColoring E k} {T U : TreeSequence G e0} + (ett : ExtendedTashkinovTree G k e0 input T phi) + (corr : CorrespondingExtendedTashkinovTree G k e0 ett sigma U) : + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + classical + rcases corr with ⟨replacementInput, replacementSeries, replacementETT, + rungAgreement, seriesPresentation, finalGeneratingColoring, + ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, + extensionKindsAgree, replacementProper, replacementOneUncolored, + replacementStable⟩ + cases replacementETT with + | mk rounds roundsPositive series above strict below generating => + cases rungAgreement + have hseries : series = replacementSeries := eq_of_heq seriesPresentation + cases hseries + let i : Fin ett.rounds := ⟨ett.rounds - 1, by have hp := ett.roundsPositive; omega⟩ + have hi : i.succ = Fin.last ett.rounds := by + apply Fin.ext + change ett.rounds - 1 + 1 = ett.rounds + exact Nat.sub_add_cancel ett.roundsPositive + have htree : replacementSeries.data.tree (Fin.last ett.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc := by + simpa [hi] using ladderTreesAgree i + have hs := replacementStable i + rw [hi] at hs + have hmissing : TreeMissingColors + (replacementSeries.data.coloring (Fin.last ett.rounds)) + (replacementSeries.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors (ett.series.data.coloring (Fin.last ett.rounds)) + (ett.series.data.tree (Fin.last ett.rounds).castSucc) := by + rw [htree] + unfold TreeMissingColors + exact Finset.biUnion_congr rfl hs.2 + change TashkinovStoredColors replacementSeries.data (Fin.last ett.rounds) = _ + unfold TashkinovStoredColors + simp only [storedColorsAgree, hmissing] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ThetaExclusion.lean b/LeanPool/GoldbergSeymour/ThetaExclusion.lean new file mode 100644 index 0000000000..1ffcab0bf2 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ThetaExclusion.lean @@ -0,0 +1,138 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix + +/-! +# P2880_T1_Theta Exclusion + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem P2880_T1_ThetaExclusion + {V E : Type*} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (mu : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T mu) + (base : HierarchyBase ett mu) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T mu ett base C) + (j : Nat) (hpositive : 1 ≤ j) (hbefore : j < HierarchyFullTailLength C) : + let H := C.hierarchy + let q := Fin.last H.dividerCount + let Y := HierarchyFullTailPrefix C j + ∀ theta ∈ MissingColors G mu (Y.vertex (Fin.last Y.length)), + theta ∉ (HierarchyStoredColorsAt H q).biUnion (C.good.gamma q) := by + classical + dsimp only + let H := C.hierarchy + let q := Fin.last H.dividerCount + let A := HierarchyStarredStage H q + let Y := HierarchyFullTailPrefix C j + let Z := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) + have helementary : ColoredVertexSetElementary G mu (TreeSequenceVertexSet Z) := + HierarchyCounterexamplePenultimateElementary G k e0 input T mu ett base C + ctx.proper ctx.oneEdgeUncolored ctx.lowerRung ctx.fewerDividers + ctx.lexicographicMinimality ctx.largeMissingSet + have reflSegment (U : TreeSequence G e0) : TreeSequenceInitialSegment U U := + ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + have hAT : TreeSequenceInitialSegment A T := by + have hnext : TreeSequenceInitialSegment (HierarchyStarredStage H q) + (H.stage q.succ) := by + refine Fin.cases ?_ (fun i => ?_) q + · exact H.coreInsideFirst + · exact H.nested i.succ + have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl + simpa only [hlast, H.terminalStage] using hnext + have hordinary : TreeSequenceInitialSegment (H.stage q.castSucc) A := by + change TreeSequenceInitialSegment (H.stage q.castSucc) (HierarchyStarredStage H q) + refine Fin.cases ?_ (fun i => ?_) q + · change TreeSequenceInitialSegment (H.stage 0) base.core + rw [H.baseStage] + by_cases hp : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE + · exact (Classical.choice (base.parallel hp).2.2).leftSegment + · rw [base.nonparallel hp] + exact reflSegment _ + · exact reflSegment _ + have hstageMissing : + HierarchyStageMissingColors H q = + TreeMissingColors mu (H.stage q.castSucc) := by + refine Fin.cases ?_ (fun i => ?_) q + · change TreeMissingColors mu (ett.series.data.tree (Fin.last ett.rounds).castSucc) = + TreeMissingColors mu (H.stage 0) + rw [H.baseStage] + · simp only [HierarchyStageMissingColors, Fin.cases_succ] + have hYlen : Y.length = A.length + j := by + change min (A.length + j) T.length = A.length + j + have htail : j < T.length - A.length := hbefore + omega + have hZlen : Z.length = T.length - 1 := by + change min (A.length + (T.length - A.length - 1)) T.length = T.length - 1 + have htail : j < T.length - A.length := hbefore + omega + have hYT : TreeSequenceInitialSegment Y T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hZT : TreeSequenceInitialSegment Z T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have commonPrefix {U W : TreeSequence G e0} + (hu : TreeSequenceInitialSegment U T) + (hw : TreeSequenceInitialSegment W T) (hlen : U.length ≤ W.length) : + TreeSequenceInitialSegment U W := by + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hw.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans + (hu.2.1 i) + · intro i + exact (hw.2.2 (Fin.castLE hlen i)).symm.trans (hu.2.2 i) + have hAY : TreeSequenceInitialSegment A Y := + commonPrefix hAT hYT (by rw [hYlen]; omega) + have hYZ : TreeSequenceInitialSegment Y Z := by + apply commonPrefix hYT hZT + rw [hYlen, hZlen] + have htail : j < T.length - A.length := hbefore + omega + have hnew : Y.vertex (Fin.last Y.length) ∉ TreeSequenceVertexSet A := by + intro hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + have he := Y.vertex_injective ((hAY.2.1 i).trans hi) + have heval := congrArg Fin.val he + have hibound := i.isLt + simp only [Fin.val_castLE, Fin.val_last] at heval + rw [hYlen] at heval + omega + intro theta hmissing hgamma + obtain ⟨eta, heta, htheta⟩ := Finset.mem_biUnion.mp hgamma + have hstage : theta ∈ HierarchyStageMissingColors H q := + (Finset.mem_sdiff.mp (C.good.avoidance q eta heta htheta)).1 + rw [hstageMissing] at hstage + obtain ⟨v, hv, hvMissing⟩ := Finset.mem_biUnion.mp hstage + have hvA := TreeSequenceInitialSegmentVertexSetSubset hordinary hv + have hvY := TreeSequenceInitialSegmentVertexSetSubset hAY hvA + have hvZ := TreeSequenceInitialSegmentVertexSetSubset hYZ hvY + have hyZ : Y.vertex (Fin.last Y.length) ∈ TreeSequenceVertexSet Z := + TreeSequenceInitialSegmentVertexSetSubset hYZ (by + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨Fin.last Y.length, rfl⟩) + have hne : v ≠ Y.vertex (Fin.last Y.length) := by + intro heq + exact hnew (heq ▸ hvA) + exact Finset.disjoint_left.mp (helementary hvZ hyZ hne) hvMissing hmissing + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ThmGS.lean b/LeanPool/GoldbergSeymour/ThmGS.lean new file mode 100644 index 0000000000..41b8ab3932 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ThmGS.lean @@ -0,0 +1,37 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.GeneralHighIndexElementary + +/-! +# Thm GS + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ThmGS {V E : Type*} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) : + ChromaticIndex G ≤ max (MaximumDegree G + 1) (DensityCeil G) := by + classical + by_cases hbound : ChromaticIndex G ≤ MaximumDegree G + 1 + · exact le_max_of_le_left hbound + · have hhigh : MaximumDegree G + 2 ≤ ChromaticIndex G := by + omega + have helementary : Elementary G := GeneralHighIndexElementary G hhigh + have hequality : ChromaticIndex G = DensityCeil G := helementary + rw [hequality] + exact le_max_of_le_right (le_refl _) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ThmGS2.lean b/LeanPool/GoldbergSeymour/ThmGS2.lean new file mode 100644 index 0000000000..da24372ef5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/ThmGS2.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IncidentCoreReduction +public import LeanPool.GoldbergSeymour.LargeOrderTerminalWitness +public import LeanPool.GoldbergSeymour.ThmScheide + +/-! +# Thm GS2 + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ThmGS2 {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (hG : MaximumDegree G + 2 ≤ ChromaticIndex G) + (hcrit : Critical G) : Elementary G := by + classical + let H := IncidentCore G + have reduction := IncidentCoreReduction G + change + (forall e : E, + Sym2.map (fun x : IncidentVertex G => x.1) (H.ends e) = G.ends e) /\ + (forall x : IncidentVertex G, exists e : E, Incident H x e) /\ + (Critical H <-> Critical G) /\ + ChromaticIndex H = ChromaticIndex G /\ + MaximumDegree H = MaximumDegree G /\ + TashkinovOrder H = TashkinovOrder G /\ + (Elementary H -> Elementary G) at reduction + rcases reduction with + ⟨hendpoints, hnoisolated, hcriticalEq, hindexEq, hdegreeEq, + horderEq, helementaryTransfer⟩ + have hcriticalH : Critical H := hcriticalEq.mpr hcrit + have hhighH : MaximumDegree H + 2 <= ChromaticIndex H := by + omega + by_cases hsmall : TashkinovOrder H < 11 + · exact helementaryTransfer + (ThmScheide H hcriticalH hnoisolated hhighH hsmall) + · let k := ChromaticIndex H - 1 + have hindexH : ChromaticIndex H = k + 1 := by + dsimp [k] + omega + have hdegreeH : MaximumDegree H + 1 <= k := by + dsimp [k] + omega + have hlargeH : 11 <= TashkinovOrder H := by omega + obtain ⟨e0, phi, X, hproper, hone, hends, helementary, hstrong⟩ := + LargeOrderTerminalWitness H k hcriticalH hindexH hdegreeH + hlargeH + have character := egraph2 H k hcriticalH hindexH hdegreeH hnoisolated + apply helementaryTransfer + exact character.1.mpr (character.2.1.mpr (character.2.2.mpr + ⟨e0, phi, X, hproper, hone, hends, helementary, hstrong⟩)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ThmScheide.lean b/LeanPool/GoldbergSeymour/ThmScheide.lean new file mode 100644 index 0000000000..efa420584c --- /dev/null +++ b/LeanPool/GoldbergSeymour/ThmScheide.lean @@ -0,0 +1,43 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideOrderNineStructuralConfiguration + +/-! +# Thm Scheide + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem ThmScheide {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (hcritical : Critical G) + (hnoisolated : ∀ v : V, ∃ e : E, Incident G v e) + (hdegree : MaximumDegree G + 2 ≤ ChromaticIndex G) + (horder : TashkinovOrder G < 11) : Elementary G := by + classical + let k := ChromaticIndex G - 1 + have hindex : ChromaticIndex G = k + 1 := by + dsimp [k] + omega + have hkdegree : MaximumDegree G + 1 ≤ k := by + dsimp [k] + omega + by_contra hnonelementary + obtain ⟨e0, phi, T, ⟨C⟩⟩ := + ScheideOrderNineStructuralConfiguration G k hcritical hindex hkdegree + hnoisolated hnonelementary horder + exact hnonelementary (ScheideStructuralLemma G k e0 phi T C) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeColorSetClosed.lean b/LeanPool/GoldbergSeymour/TreeColorSetClosed.lean new file mode 100644 index 0000000000..92f46e2c61 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeColorSetClosed.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tree Color Set Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- No boundary edge carries a color from the specified color set. -/ +def TreeColorSetClosed {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (C : Finset (Fin k)) : Prop := + ∀ alpha ∈ C, BoundaryColorEdges G phi (TreeSequenceVertexSet T) alpha = ∅ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeColorSetMinusClosed.lean b/LeanPool/GoldbergSeymour/TreeColorSetMinusClosed.lean new file mode 100644 index 0000000000..3600521a70 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeColorSetMinusClosed.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeColorSetClosed +public import LeanPool.GoldbergSeymour.TreeMissingColors + +/-! +# Tree Color Set Minus Closed + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The tree is closed for all its missing colors outside the specified exception set. -/ +def TreeColorSetMinusClosed {V E : Type*} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) + {k : ℕ} {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (C : Finset (Fin k)) : + Prop := + TreeColorSetClosed G phi T (TreeMissingColors phi T \ C) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeColorUnusedThrough.lean b/LeanPool/GoldbergSeymour/TreeColorUnusedThrough.lean new file mode 100644 index 0000000000..beda705962 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeColorUnusedThrough.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.PartialEdgeColoring + +/-! +# Tree Color Unused Through + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The color does not occur on noninitial tree edges before the specified position. -/ +def TreeColorUnusedThrough {V E : Type*} {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (alpha : Fin k) (j : Fin (T.length + 1)) : + Prop := + ∀ r : Fin T.length, 1 ≤ r.val → r.val < j.val → phi (T.edge r) ≠ some alpha + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeColoringInvariant.lean b/LeanPool/GoldbergSeymour/TreeColoringInvariant.lean new file mode 100644 index 0000000000..fbdb45c6af --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeColoringInvariant.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColors + +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tree Coloring Invariant + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The noninitial tree-edge colors and every tree vertex's missing-color set are unchanged. -/ +def TreeColoringInvariant {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} + {e0 : E} (T : TreeSequence G e0) (phi pi : PartialEdgeColoring E k) : Prop := + (∀ j : Fin T.length, 1 ≤ j.val → pi (T.edge j) = phi (T.edge j)) ∧ + ∀ v ∈ TreeSequenceVertexSet T, MissingColors G pi v = MissingColors G phi v + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeExit.lean b/LeanPool/GoldbergSeymour/TreeExit.lean new file mode 100644 index 0000000000..0ad0b053c9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeExit.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeExitPath + +/-! +# Tree Exit + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- An outside-to-inside two-color path ending at the given tree vertex and meeting the tree only +there. +-/ +def TreeExit {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (v : V) : Prop := + ∃ (u : V) (p : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)), + TreeExitPath T phi alpha beta u v p + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeExitComponentMeetsTreeOnlyAtExit.lean b/LeanPool/GoldbergSeymour/TreeExitComponentMeetsTreeOnlyAtExit.lean new file mode 100644 index 0000000000..458518a3ea --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeExitComponentMeetsTreeOnlyAtExit.lean @@ -0,0 +1,203 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeExit + +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo + +/-! +# Tree Exit Component Meets Tree Only At Exit + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TreeExitComponentMeetsTreeOnlyAtExit + {V E : Type*} [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k : Nat} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (alpha beta : Fin k) (v : V) + (hproper : IsProperEdgeColoring G phi) + (hmissing : alpha ∈ MissingColors G phi v) + (hexit : TreeExit T phi alpha beta v) : + ∀ w, w ∈ TreeSequenceVertexSet T → + (Sum.inl w ∈ TwoColorComponent G phi alpha beta (Sum.inl v) ↔ w = v) := by + classical + let _ := Fintype.ofFinite V + have hdegree : ∀ w, alpha ∈ MissingColors G phi w ∨ + beta ∈ MissingColors G phi w → + (TwoColorIncidenceGraph G phi alpha beta).degree (Sum.inl w) ≤ 1 := by + intro w hw + rw [← SimpleGraph.card_neighborFinset_eq_degree] + apply Finset.card_le_one.mpr + intro y hy z hz + simp only [SimpleGraph.mem_neighborFinset] at hy hz + cases y with + | inl y => simp [TwoColorIncidenceGraph] at hy + | inr e => + cases z with + | inl z => simp [TwoColorIncidenceGraph] at hz + | inr f => + simp only [TwoColorIncidenceGraph] at hy hz + rcases hw with hw | hw + · have he : phi e = some beta := hy.2.resolve_left (by + intro he + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hy.1, he⟩) + have hf : phi f = some beta := hz.2.resolve_left (by + intro hf + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hz.1, hf⟩) + by_cases h : e = f + · exact congrArg Sum.inr h + · exact (hproper h ⟨w, hy.1, hz.1⟩ he hf).elim + · have he : phi e = some alpha := hy.2.resolve_right (by + intro he + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hy.1, he⟩) + have hf : phi f = some alpha := hz.2.resolve_right (by + intro hf + apply (by simpa [MissingColors] using hw) + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨f, hz.1, hf⟩) + by_cases h : e = f + · exact congrArg Sum.inr h + · exact (hproper h ⟨w, hy.1, hz.1⟩ he hf).elim + rcases hexit with ⟨u, path, pathData⟩ + rcases pathData with ⟨pathIs, pathLen, uOut, endTree, endOnly⟩ + have hdegreeBound : ∀ x, @SimpleGraph.degree _ + (TwoColorIncidenceGraph G phi alpha beta) x + (Fintype.ofFinite _) ≤ 2 := by + intro x + exact TwoColorIncidenceDegreeAtMostTwo G phi alpha beta hproper x + have huDegree := hdegree u endOnly.1 + have hclosed : ∀ x, x ∈ path.support → ∀ y, + (TwoColorIncidenceGraph G phi alpha beta).Adj x y → + y ∈ path.support := by + intro x hx y hxy + obtain ⟨n, hn, hnle⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hx + by_cases hn0 : n = 0 + · subst n + have hx0 : x = Sum.inl u := by simpa using hn.symm + let graph := TwoColorIncidenceGraph G phi alpha beta + let : Fintype (graph.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (graph.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert huDegree using 1 + cases hx0 + exact congrArg (fun z => @SimpleGraph.degree _ graph (Sum.inl u) z) + (Subsingleton.elim _ _) + have hy' : y ∈ graph.neighborSet x := by + simpa [graph, SimpleGraph.mem_neighborSet] using hxy + have hn' : path.getVert 1 ∈ graph.neighborSet x := by + simpa [graph, hx0, SimpleGraph.mem_neighborSet] using + path.adj_getVert_succ (show 0 < path.length by omega) + have heq := Fintype.card_le_one_iff.mp card + ⟨y, hy'⟩ ⟨path.getVert 1, hn'⟩ + have hey : y = path.getVert 1 := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support 1 + by_cases hlast : n = path.length + · have hx1 : x = Sum.inl v := by + rw [← hn, pathIs.getVert_eq_end_iff hnle] + exact hlast + let graph := TwoColorIncidenceGraph G phi alpha beta + let : Fintype (graph.neighborSet x) := Fintype.ofFinite _ + have card : Fintype.card (graph.neighborSet x) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + convert hdegree v (Or.inl hmissing) using 1 + cases hx1 + exact congrArg (fun z => @SimpleGraph.degree _ graph (Sum.inl v) z) + (Subsingleton.elim _ _) + have hy' : y ∈ graph.neighborSet x := by + simpa [graph, SimpleGraph.mem_neighborSet] using hxy + have hp : path.getVert (path.length - 1) ∈ graph.neighborSet x := by + have ha : graph.Adj (Sum.inl v) (path.getVert (path.length - 1)) := by + simpa [graph, show path.length - 1 + 1 = path.length by omega] using + (path.adj_getVert_succ + (show path.length - 1 < path.length by omega)).symm + simpa [hx1, SimpleGraph.mem_neighborSet] using ha + have heq := Fintype.card_le_one_iff.mp card + ⟨y, hy'⟩ ⟨path.getVert (path.length - 1), hp⟩ + have hey : y = path.getVert (path.length - 1) := congrArg Subtype.val heq + rw [hey] + exact path.getVert_mem_support _ + have hl : (TwoColorIncidenceGraph G phi alpha beta).Adj + (path.getVert n) (path.getVert (n - 1)) := by + rw [← show n - 1 + 1 = n by omega] + exact (path.adj_getVert_succ (by omega)).symm + have hnlt : n < path.length := lt_of_le_of_ne hnle hlast + have hr := path.adj_getVert_succ hnlt + by_contra hyout + rw [← hn] at hxy + have hnl : path.getVert (n - 1) ≠ y := by + intro h + apply hyout + rw [← h] + exact path.getVert_mem_support _ + have hnr : path.getVert (n + 1) ≠ y := by + intro h + apply hyout + rw [← h] + exact path.getVert_mem_support _ + have hnp : path.getVert (n - 1) ≠ path.getVert (n + 1) := by + intro h + have hi := pathIs.getVert_injOn + (show n - 1 ≤ path.length by omega) + (show n + 1 ≤ path.length by omega) h + omega + let graph := TwoColorIncidenceGraph G phi alpha beta + let : Fintype (graph.neighborSet (path.getVert n)) := Fintype.ofFinite _ + have three : 3 ≤ graph.degree (path.getVert n) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset _ := {y, path.getVert (n - 1), path.getVert (n + 1)} + have hs : s ⊆ graph.neighborFinset (path.getVert n) := by + intro t ht + simp only [s, Finset.mem_insert, Finset.mem_singleton] at ht + rcases ht with rfl | rfl | rfl + · simpa [graph, SimpleGraph.mem_neighborFinset] using hxy + · simpa [graph, SimpleGraph.mem_neighborFinset] using hl + · simpa [graph, SimpleGraph.mem_neighborFinset] using hr + have hc : 3 ≤ s.card := by + simp [s, hnp, hnl.symm, hnr.symm] + exact hc.trans (Finset.card_le_card hs) + have upper : graph.degree (path.getVert n) ≤ 2 := + hdegreeBound (path.getVert n) + omega + intro w hw + constructor + · intro hwC + let graph := TwoColorIncidenceGraph G phi alpha beta + have reach : graph.Reachable (Sum.inl v) (Sum.inl w) := by + change graph.connectedComponentMk (Sum.inl w) = + graph.connectedComponentMk (Sum.inl v) at hwC + exact SimpleGraph.ConnectedComponent.eq.mp hwC |>.symm + have ws : Sum.inl w ∈ path.support := by + apply reach.mem_subgraphVerts + (H := (⊤ : graph.Subgraph).induce {x | x ∈ path.support}) + (fun x hx y hadj => + ⟨by simpa using hx, hclosed x (by simpa using hx) y hadj, hadj⟩) + (by simp) + exact (endOnly.2 w hw).mp ws + · rintro rfl + change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl w) = (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl w) + rfl + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeExitPath.lean b/LeanPool/GoldbergSeymour/TreeExitPath.lean new file mode 100644 index 0000000000..5b0c68c105 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeExitPath.lean @@ -0,0 +1,39 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Tree Exit Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A simple two-color path of length at least two meeting the tree only at its inside endpoint, +with a missing color outside. +-/ +def TreeExitPath {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (u v : V) + (p : (TwoColorIncidenceGraph G phi alpha beta).Walk (Sum.inl u) (Sum.inl v)) : Prop := + p.IsPath ∧ + 2 ≤ p.length ∧ + u ∉ TreeSequenceVertexSet T ∧ + v ∈ TreeSequenceVertexSet T ∧ + (alpha ∈ MissingColors G phi u ∨ beta ∈ MissingColors G phi u) ∧ + ∀ w ∈ TreeSequenceVertexSet T, (Sum.inl w ∈ p.support ↔ w = v) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeFreeColors.lean b/LeanPool/GoldbergSeymour/TreeFreeColors.lean new file mode 100644 index 0000000000..a68872932f --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeFreeColors.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeUsedColors + +/-! +# Tree Free Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Colors missing somewhere on the tree and unused on its noninitial edges. -/ +noncomputable def TreeFreeColors {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) : Finset (Fin k) := by + classical + exact TreeMissingColors phi T \ TreeUsedColors phi T + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeIncidentEdge.lean b/LeanPool/GoldbergSeymour/TreeIncidentEdge.lean new file mode 100644 index 0000000000..1e46a7966f --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeIncidentEdge.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tree Incident Edge + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- An edge incident to at least one tree vertex. -/ +def TreeIncidentEdge {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} (T : TreeSequence G e0) + (f : E) : Prop := + ∃ v ∈ TreeSequenceVertexSet T, Incident G v f + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeInterchangeable.lean b/LeanPool/GoldbergSeymour/TreeInterchangeable.lean new file mode 100644 index 0000000000..adacd86c3a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeInterchangeable.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Tree Interchangeable + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Every two-color path component meeting the tree is the same component. -/ +def TreeInterchangeable {V E : Type*} (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) : Prop := + ∀ z w : Sum V E, + TwoColorPathComponent G phi alpha beta z → + TwoColorPathComponent G phi alpha beta w → + (∃ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G phi alpha beta z) → + (∃ v ∈ TreeSequenceVertexSet T, Sum.inl v ∈ TwoColorComponent G phi alpha beta w) → + TwoColorComponent G phi alpha beta z = TwoColorComponent G phi alpha beta w + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeMissingColors.lean b/LeanPool/GoldbergSeymour/TreeMissingColors.lean new file mode 100644 index 0000000000..1b7a32cbf8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeMissingColors.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tree Missing Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The union of the missing-color sets over all tree vertices. -/ +noncomputable def TreeMissingColors {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0) : Finset (Fin k) := by + classical + exact (TreeSequenceVertexSet T).biUnion fun v => MissingColors G phi v + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeMissingColorsCardLowerBound.lean b/LeanPool/GoldbergSeymour/TreeMissingColorsCardLowerBound.lean new file mode 100644 index 0000000000..b6f6053c0a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeMissingColorsCardLowerBound.lean @@ -0,0 +1,334 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.Degree +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PartialEdgeColoring +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tree Missing Colors Card Lower Bound + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem helper_present_le_without_root_106.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0), + phi e0 = none → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) → + let X : Finset V := TreeSequenceVertexSet T; + let D : Finset V := (G.ends e0).toFinset; + D ⊆ X → + D.card = (2 : ℕ) → + (∀ v ∈ D, Incident G v e0) → + ∀ (v : V), + Incident G v e0 → + (PresentColors G phi v).card ≤ ({e : E | Incident G v e ∧ e ≠ e0} : Finset E).card := by + classical + intro V E _ _ G k e0 phi T hroot helem X D hDsub hDcard hDinc v he0 + let _ := Fintype.ofFinite V + let target : Finset E := Finset.univ.filter (fun e => Incident G v e ∧ e ≠ e0) + let chooseEdge : Fin k → E := fun c => if hc : c ∈ PresentColors G phi v then + Classical.choose (show ∃ e, Incident G v e ∧ phi e = some c by + simpa [PresentColors] using hc) else e0 + have choose_mem : ∀ c, c ∈ PresentColors G phi v → chooseEdge c ∈ target := by + intro c hc + have hw := Classical.choose_spec (show ∃ e, Incident G v e ∧ phi e = some c by + simpa [PresentColors] using hc) + have hne0 : Classical.choose (show ∃ e, Incident G v e ∧ phi e = some c by + simpa [PresentColors] using hc) ≠ e0 := by + intro he + subst he + rw [hroot] at hw + simp at hw + have hne : chooseEdge c ≠ e0 := by simpa [chooseEdge, hc] using hne0 + have hinc : Incident G v (chooseEdge c) := by simpa [chooseEdge, hc] using hw.1 + change chooseEdge c ∈ target + simp [target, hinc, hne] + have choose_eq : ∀ c, c ∈ PresentColors G phi v → + phi (chooseEdge c) = some c := by + intro c hc + have hh := Classical.choose_spec (show ∃ e, Incident G v e ∧ phi e = some c by + simpa [PresentColors] using hc) + simpa [chooseEdge, dite_eq_left hc] using hh.2 + apply Finset.card_le_card_of_injOn chooseEdge + · intro c hc + exact choose_mem c hc + · intro a ha b hb hab + have ea := choose_eq a ha + have eb := choose_eq b hb + rw [hab] at ea + exact Option.some.inj (ea.symm.trans eb) + +private theorem helper_hmiss2_142.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k), + MaximumDegree G + (1 : ℕ) ≤ k → + (∀ (v : V), Degree G v ≤ MaximumDegree G) → + (∀ (v : V), + Incident G v e0 → + (PresentColors G phi v).card ≤ + ({e : E | Incident G v e ∧ e ≠ e0} : Finset E).card) → + ∀ (v : V), + Incident G v e0 → + (2 : ℕ) ≤ (MissingColors G phi v).card := by + classical + intro V E _ _ G k e0 phi hdegree hdeg present_le_without_root v hv + have hcard : (Finset.univ.filter (fun e => Incident G v e ∧ e ≠ e0)).card + ≤ Degree G v - 1 := by + have he : e0 ∈ Finset.univ.filter (fun e => Incident G v e) := by simp [hv] + have hc := Finset.card_erase_add_one he + have hsub : (Finset.univ.filter (fun e => Incident G v e ∧ e ≠ e0)) = + (Finset.univ.filter (fun e => Incident G v e)).erase e0 := by + ext e + simp [and_comm] + rw [hsub] + change ((Finset.univ.filter (fun e => Incident G v e)).erase e0).card ≤ + (Finset.univ.filter (fun e => Incident G v e)).card - 1 + omega + have hp := (present_le_without_root v hv).trans hcard + have hm : (MissingColors G phi v).card = + k - (PresentColors G phi v).card := by + simp [MissingColors, Finset.card_sdiff] + rw [hm] + have hdpos : 0 < Degree G v := by + unfold Degree + simp only [Finset.card_pos] + exact ⟨e0, by simp [hv]⟩ + have hplt : (PresentColors G phi v).card < Degree G v := + (Nat.le_sub_one_iff_lt hdpos).mp hp + have hdeg' : Degree G v + 1 <= MaximumDegree G + 1 := + Nat.add_le_add_right (hdeg v) 1 + have hpk' : (PresentColors G phi v).card + 2 <= Degree G v + 1 := by + omega + have hkm := le_trans hpk' (le_trans hdeg' hdegree) + omega + +private theorem helper_hinj_211.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) + (T : TreeSequence G e0), + let X : Finset V := TreeSequenceVertexSet T; + let D : Finset V := (G.ends e0).toFinset; + ∀ (hDsub : D ⊆ X), + ((↑X : Set V).PairwiseDisjoint fun (v : V) ↦ MissingColors G phi v) → + ∀ (hnonempty : ∀ v ∈ X, (MissingColors G phi v).Nonempty), + let firstColor : (v : V) → v ∈ X → Fin k := fun (v : V) (hv : v ∈ X) ↦ + Classical.choose (hnonempty v hv); + (∀ (v : V) (hv : v ∈ X), firstColor v hv ∈ MissingColors G phi v) → + ∀ + (hsecond : + ∀ (v : V) (hv : v ∈ D), + ((MissingColors G phi v).erase (firstColor v (hDsub hv))).Nonempty), + let extraColor : (v : V) → v ∈ D → Fin k := fun (v : V) (hv : v ∈ D) ↦ + Classical.choose (hsecond v hv); + (∀ (v : V) (hv : v ∈ D), + extraColor v hv ∈ (MissingColors G phi v).erase (firstColor v (hDsub hv))) → + let domain : Type u_1 := ↥X ⊕ ↥D; + let color : domain → Fin k := fun (p : domain) ↦ + match p with + | Sum.inl v => firstColor (↑v : V) v.property + | Sum.inr v => extraColor (↑v : V) v.property; + Function.Injective color := by + classical + intro V E _ _ G k e0 phi T X D hDsub hdisj hnonempty firstColor firstMem hsecond extraColor + extraMem domain color p q hpq + let _ := Fintype.ofFinite V + rcases p with p | p <;> rcases q with q | q + · have hu : p.1 = q.1 := by + by_contra hn + have hd := hdisj p.2 q.2 hn + have hpq' : firstColor p.1 p.2 = firstColor q.1 q.2 := by simpa [color] using hpq + exact (Finset.disjoint_left.mp hd) (firstMem p.1 p.2) + (by simpa only [hpq'] using firstMem q.1 q.2) + cases Subtype.ext hu + rfl + · have hu : p.1 = q.1 := by + by_contra hn + have hd := hdisj p.2 (hDsub q.2) hn + have hpq' : firstColor p.1 p.2 = extraColor q.1 q.2 := by simpa [color] using hpq + exact (Finset.disjoint_left.mp hd) (firstMem p.1 p.2) + (by simpa only [hpq'] using (Finset.mem_erase.mp (extraMem q.1 q.2)).2) + have he := Finset.mem_erase.mp (extraMem q.1 q.2) + exact False.elim (he.1 (by simpa [color, hu] using hpq.symm)) + · have hu : p.1 = q.1 := by + by_contra hn + have hd := hdisj (hDsub p.2) q.2 hn + have hpq' : extraColor p.1 p.2 = firstColor q.1 q.2 := by simpa [color] using hpq + exact (Finset.disjoint_left.mp hd) (Finset.mem_erase.mp (extraMem p.1 p.2)).2 + (by simpa only [hpq'] using firstMem q.1 q.2) + have he := Finset.mem_erase.mp (extraMem p.1 p.2) + exact False.elim (he.1 (by simpa [color, hu] using hpq)) + · have hu : p.1 = q.1 := by + by_contra hn + have hd := hdisj (hDsub p.2) (hDsub q.2) hn + have hpq' : extraColor p.1 p.2 = extraColor q.1 q.2 := by simpa [color] using hpq + exact (Finset.disjoint_left.mp hd) (Finset.mem_erase.mp (extraMem p.1 p.2)).2 + (by simpa only [hpq'] using (Finset.mem_erase.mp (extraMem q.1 q.2)).2) + cases Subtype.ext hu + rfl + +theorem TreeMissingColorsCardLowerBound {V E : Type*} + [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : Nat) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (hroot : phi e0 = none) + (hdegree : MaximumDegree G + 1 <= k) + (helem : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T)) : + (TreeSequenceVertexSet T).card + 2 <= (TreeMissingColors phi T).card := by + classical + let X := TreeSequenceVertexSet T + let D := (G.ends e0).toFinset + have hDsub : D ⊆ X := by + intro v hv + have hv' : v ∈ G.ends e0 := Sym2.mem_toFinset.mp hv + rw [← T.first_edge] at hv' + obtain ⟨i, hi⟩ := T.attaches ⟨0, T.positive⟩ + rw [hi, Sym2.mem_iff] at hv' + rcases hv' with hv | hv <;> subst v <;> + simp [X, TreeSequenceVertexSet] + have hDcard : D.card = 2 := by + have hn : Not (G.ends e0).IsDiag := by + intro hd + induction he : G.ends e0 using Sym2.inductionOn with + | _ a b => + rw [he] at hd + rw [Sym2.mk_isDiag_iff] at hd + apply G.loopless e0 a + rw [he, hd] + exact Sym2.card_toFinset_of_not_isDiag _ hn + have hDinc : ∀ v ∈ D, Incident G v e0 := by + intro v hv + exact Sym2.mem_toFinset.mp hv + have hdeg : ∀ v : V, Degree G v ≤ MaximumDegree G := by + intro v + unfold MaximumDegree + exact Finset.le_max' _ _ (Finset.mem_insert.mpr + (Or.inr (Finset.mem_image.mpr ⟨v, by simp⟩))) + have present_le_degree : ∀ v : V, + (PresentColors G phi v).card ≤ Degree G v := by + intro v + have chooseData (c : {c : Fin k // c ∈ PresentColors G phi v}) : + ∃ e, Incident G v e ∧ phi e = some c.1 := by + simpa [PresentColors] using c.property + let choices : {c : Fin k // c ∈ PresentColors G phi v} → + {e : E // Incident G v e} := fun c => + ⟨Classical.choose (chooseData c), (Classical.choose_spec (chooseData c)).1⟩ + have choice_spec : ∀ c : {c : Fin k // c ∈ PresentColors G phi v}, + phi (choices c).1 = some c.1 := by + intro c + exact (Classical.choose_spec (chooseData c)).2 + have inj : Function.Injective choices := by + intro a b hab + have ha := choice_spec a + have hb := choice_spec b + apply Subtype.ext + apply Option.some.inj + calc + some (a : Fin k) = phi (choices a).1 := ha.symm + _ = phi (choices b).1 := by rw [hab] + _ = some (b : Fin k) := hb + let : Fintype {c : Fin k // c ∈ PresentColors G phi v} := Fintype.ofFinite _ + have hc := Fintype.card_le_of_injective choices inj + change (PresentColors G phi v).card ≤ + (Finset.univ.filter (fun e => Incident G v e)).card + simpa [Fintype.card_subtype] using hc + have hmiss1 : ∀ v : V, 1 ≤ (MissingColors G phi v).card := by + intro v + have hp := present_le_degree v + have hm : (MissingColors G phi v).card = + k - (PresentColors G phi v).card := by + simp [MissingColors, Finset.card_sdiff] + have hpmax := hp.trans (hdeg v) + rw [hm] + omega + have present_le_without_root := @helper_present_le_without_root_106 (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@hroot) (@helem) (@hDsub) (@hDcard) (@hDinc) + have hmiss2 := @helper_hmiss2_142 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) + (@hdegree) (@hdeg) (@present_le_without_root) + have hdisj : (X : Set V).PairwiseDisjoint (fun v => MissingColors G phi v) := by + intro u hu v hv huv + exact helem hu hv huv + have hnonempty : ∀ v ∈ X, (MissingColors G phi v).Nonempty := by + intro v hv + exact Finset.card_pos.mp (by have := hmiss1 v; omega) + let firstColor : (v : V) → v ∈ X → Fin k := fun v hv => + Classical.choose (hnonempty v hv) + have firstMem : ∀ (v : V) (hv : v ∈ X), + firstColor v hv ∈ MissingColors G phi v := by + intro v hv + exact Classical.choose_spec (hnonempty v hv) + have hsecond : ∀ (v : V) (hv : v ∈ D), + ((MissingColors G phi v).erase (firstColor v (hDsub hv))).Nonempty := by + intro v hv + apply Finset.card_pos.mp + rw [Finset.card_erase_of_mem (firstMem v (hDsub hv))] + have hh := hmiss2 v (hDinc v hv) + omega + let extraColor : (v : V) → v ∈ D → Fin k := fun v hv => + Classical.choose (hsecond v hv) + have extraMem : ∀ (v : V) (hv : v ∈ D), + extraColor v hv ∈ (MissingColors G phi v).erase + (firstColor v (hDsub hv)) := by + intro v hv + exact Classical.choose_spec (hsecond v hv) + let domain := Sum {v : V // v ∈ X} {v : V // v ∈ D} + let color : domain → Fin k := fun p => match p with + | Sum.inl v => firstColor v.1 v.2 + | Sum.inr v => extraColor v.1 v.2 + have hmap : ∀ p : domain, color p ∈ TreeMissingColors phi T := by + intro p + rcases p with p | p + · apply Finset.mem_biUnion.mpr + exact ⟨p.1, p.2, firstMem p.1 p.2⟩ + · apply Finset.mem_biUnion.mpr + exact ⟨p.1, hDsub p.2, (Finset.mem_erase.mp (extraMem p.1 p.2)).2⟩ + have hinj := @helper_hinj_211 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) + (@hDsub) (@hdisj) (@hnonempty) (@firstMem) (@hsecond) (@extraMem) + let A : Finset domain := + X.attach.map ⟨Sum.inl, Sum.inl_injective⟩ ∪ + D.attach.map ⟨Sum.inr, Sum.inr_injective⟩ + have hAdisj : Disjoint + (X.attach.map ⟨Sum.inl, Sum.inl_injective⟩) + (D.attach.map ⟨Sum.inr, Sum.inr_injective⟩) := by + rw [Finset.disjoint_left] + intro z hz1 hz2 + rw [Finset.mem_map] at hz1 hz2 + rcases hz1 with ⟨u, hu, rfl⟩ + rcases hz2 with ⟨v, hv, h⟩ + cases h + have hAc : A.card = X.card + 2 := by + dsimp [A] + rw [Finset.card_union_of_disjoint hAdisj] + simp [hDcard] + have hle : A.card ≤ (TreeMissingColors phi T).card := by + apply Finset.card_le_card_of_injOn color + · intro p hp + exact hmap p + · exact hinj.injOn + simpa [X, hAc] using hle + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequence.lean b/LeanPool/GoldbergSeymour/TreeSequence.lean new file mode 100644 index 0000000000..d7b482bd26 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequence.lean @@ -0,0 +1,46 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.LooplessMultigraph + +/-! +# Tree Sequence + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +/-- An ordered tree with distinct vertices and edges, a distinguished first edge and an earlier +attachment for each edge. +-/ +structure TreeSequence {V E : Type*} (G : LooplessMultigraph V E) (e0 : E) where + /-- The positive number of edges in the tree sequence. -/ + length : ℕ + positive : 1 ≤ length + /-- The selected vertex, or ordered vertices when the field is indexed. -/ + vertex : Fin (length + 1) → V + /-- The selected edge, or ordered edges when the field is indexed. -/ + edge : Fin length → E + vertex_injective : Function.Injective vertex + edge_injective : Function.Injective edge + first_edge : edge ⟨0, positive⟩ = e0 + attaches : + ∀ j : Fin length, + ∃ i : Fin (j.val + 1), + G.ends (edge j) = + s(vertex j.succ, vertex (Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ j.isLt)))) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdge.lean b/LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdge.lean new file mode 100644 index 0000000000..6943e68d41 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdge.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment + +/-! +# Tree Sequence Adjoin Edge + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- An initial-segment extension adding exactly the specified final edge. -/ +def TreeSequenceAdjoinEdge {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} + (T : TreeSequence G e0) (f : E) (Tplus : TreeSequence G e0) : Prop := + ∃ hlen : Tplus.length = T.length + 1, + TreeSequenceInitialSegment T Tplus ∧ Tplus.edge (Fin.cast hlen.symm (Fin.last T.length)) = f + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdgeUnique.lean b/LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdgeUnique.lean new file mode 100644 index 0000000000..a9a1a921c1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdgeUnique.lean @@ -0,0 +1,158 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge + +/-! +# Tree Sequence Adjoin Edge Unique + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem TreeSequenceAdjoinEdgeUnique + {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} + (T : TreeSequence G e0) (f : E) (U W : TreeSequence G e0) + (hU : TreeSequenceAdjoinEdge T f U) + (hW : TreeSequenceAdjoinEdge T f W) : U = W := by + cases U with + | mk ulen upos uvertex uedge uvinj ueinj ufirst uattaches => + cases W with + | mk wlen wpos wvertex wedge wvinj weinj wfirst wattaches => + rcases hU with ⟨hlenU, hinitU, hedgeU⟩ + rcases hW with ⟨hlenW, hinitW, hedgeW⟩ + change ulen = T.length + 1 at hlenU + change wlen = T.length + 1 at hlenW + subst ulen + subst wlen + rcases hinitU with ⟨_, hvertU, hedgesU⟩ + rcases hinitW with ⟨_, hvertW, hedgesW⟩ + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + by_cases hi : i.val < T.length + 1 + · let iT : Fin (T.length + 1) := ⟨i.val, hi⟩ + have hcastU : + Fin.castLE (Nat.succ_le_succ (by omega : T.length ≤ T.length + 1)) iT = + i := by + apply Fin.ext + rfl + have hcastW : + Fin.castLE (Nat.succ_le_succ (by omega : T.length ≤ T.length + 1)) iT = + i := by + apply Fin.ext + rfl + calc + uvertex i = uvertex (Fin.castLE _ iT) := + congrArg uvertex hcastU.symm + _ = T.vertex iT := by simpa using hvertU iT + _ = wvertex (Fin.castLE _ iT) := by + simpa using (hvertW iT).symm + _ = wvertex i := congrArg wvertex hcastW + · have hilast : i = Fin.last (T.length + 1) := by + apply Fin.ext + simp only [Fin.last] + omega + subst i + let j : Fin (T.length + 1) := Fin.last T.length + obtain ⟨qU, hqU⟩ := uattaches j + obtain ⟨qW, hqW⟩ := wattaches j + have hedgeU' : uedge j = f := by + simpa [j] using hedgeU + have hedgeW' : wedge j = f := by + simpa [j] using hedgeW + have hvertUq : + uvertex (Fin.castLT qU (by omega)) = T.vertex qU := by + have hcast : + Fin.castLE + (Nat.succ_le_succ (by omega : T.length ≤ T.length + 1)) qU = + Fin.castLT qU (by omega) := by + apply Fin.ext + rfl + rw [← hcast] + simpa using hvertU qU + have hvertWq : + wvertex (Fin.castLT qW (by omega)) = T.vertex qW := by + have hcast : + Fin.castLE + (Nat.succ_le_succ (by omega : T.length ≤ T.length + 1)) qW = + Fin.castLT qW (by omega) := by + apply Fin.ext + rfl + rw [← hcast] + simpa using hvertW qW + have hvertUqW : + uvertex (Fin.castLT qW (by omega)) = T.vertex qW := by + have hcast : + Fin.castLE + (Nat.succ_le_succ (by omega : T.length ≤ T.length + 1)) qW = + Fin.castLT qW (by omega) := by + apply Fin.ext + rfl + rw [← hcast] + simpa using hvertU qW + have hends : + Sym2.mk (uvertex (Fin.last (T.length + 1))) (T.vertex qU) = + Sym2.mk (wvertex (Fin.last (T.length + 1))) (T.vertex qW) := by + have hu : G.ends f = + Sym2.mk (uvertex (Fin.last (T.length + 1))) (T.vertex qU) := by + rw [← hedgeU'] + simpa [j, hvertUq] using hqU + have hw : G.ends f = + Sym2.mk (wvertex (Fin.last (T.length + 1))) (T.vertex qW) := by + rw [← hedgeW'] + simpa [j, hvertWq] using hqW + exact hu.symm.trans hw + rcases (Sym2.eq_iff.mp hends) with horiented | hswapped + · exact horiented.1 + · exfalso + have hnewFresh : + uvertex (Fin.last (T.length + 1)) ≠ + uvertex (Fin.castLT qW (by omega)) := by + intro heq + have hind := uvinj heq + have : (Fin.last (T.length + 1) : Fin (T.length + 2)).val = qW.val := + congrArg Fin.val hind + simp only [Fin.last] at this + omega + apply hnewFresh + exact hswapped.1.trans hvertUqW.symm + · apply heq_of_eq + funext i + by_cases hi : i.val < T.length + · let iT : Fin T.length := ⟨i.val, hi⟩ + have hcastU : + Fin.castLE (by omega : T.length ≤ T.length + 1) iT = i := by + apply Fin.ext + rfl + have hcastW : + Fin.castLE (by omega : T.length ≤ T.length + 1) iT = i := by + apply Fin.ext + rfl + calc + uedge i = uedge (Fin.castLE _ iT) := congrArg uedge hcastU.symm + _ = T.edge iT := by simpa using hedgesU iT + _ = wedge (Fin.castLE _ iT) := by simpa using (hedgesW iT).symm + _ = wedge i := congrArg wedge hcastW + · have hilast : i = Fin.last T.length := by + apply Fin.ext + simp only [Fin.last] + omega + subst i + exact hedgeU.trans hedgeW.symm + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceBoundaryEdgeAppendExists.lean b/LeanPool/GoldbergSeymour/TreeSequenceBoundaryEdgeAppendExists.lean new file mode 100644 index 0000000000..3f16a76168 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceBoundaryEdgeAppendExists.lean @@ -0,0 +1,174 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BoundaryEdges +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tree Sequence Boundary Edge Append Exists + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TreeSequenceBoundaryEdgeAppendExists + {V E : Type*} [Fintype V] [Fintype E] + {G : LooplessMultigraph V E} {e0 : E} + (T : TreeSequence G e0) (f : E) + (hf : f ∈ BoundaryEdges G (TreeSequenceVertexSet T)) : + ∃ U : TreeSequence G e0, TreeSequenceAdjoinEdge T f U := by + classical + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf + obtain ⟨x, hx, y, hy, hxy⟩ := hf + have vertex_mem : ∀ i : Fin (T.length + 1), + T.vertex i ∈ TreeSequenceVertexSet T := by + intro i + simp [TreeSequenceVertexSet] + have edge_new : ∀ i : Fin T.length, f ≠ T.edge i := by + intro i he + obtain ⟨q, hq⟩ := T.attaches i + have hyend : y ∈ G.ends (T.edge i) := by + rw [← he, hxy] + exact Sym2.mem_iff.mpr (Or.inr rfl) + rw [hq] at hyend + rcases Sym2.mem_iff.mp hyend with hqv | hqv + · exact hy (by simpa [← hqv] using vertex_mem i.succ) + · exact hy (by simpa [← hqv] using vertex_mem (Fin.castLT q (by omega))) + let U : TreeSequence G e0 := + { length := T.length + 1 + positive := by omega + vertex := Fin.lastCases y (fun i => T.vertex i) + edge := Fin.lastCases f (fun i => T.edge i) + vertex_injective := by + intro i j + revert j + refine Fin.lastCases ?_ (fun i => ?_) i + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij + apply Fin.ext + rfl + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at hij + exact (hy (hij ▸ vertex_mem j)).elim + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_last] at hij + exact (hy (hij ▸ vertex_mem i)).elim + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_castSucc] at hij + exact congrArg Fin.castSucc (T.vertex_injective hij) + edge_injective := by + intro i j + revert j + refine Fin.lastCases ?_ (fun i => ?_) i + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij + apply Fin.ext + rfl + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_last, Fin.reverseInduction_castSucc] at hij + exact False.elim (edge_new j hij) + · intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_last] at hij + exact False.elim (edge_new i hij.symm) + · intro hij + dsimp only [Fin.lastCases] at hij + rw [Fin.reverseInduction_castSucc, Fin.reverseInduction_castSucc] at hij + exact congrArg Fin.castSucc (T.edge_injective hij) + first_edge := by + have hzero : (⟨0, Nat.succ_pos _⟩ : Fin (T.length + 1)) = + (⟨0, T.positive⟩ : Fin T.length).castSucc := by rfl + rw [hzero] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + exact T.first_edge + attaches := by + intro j + by_cases hj : j = Fin.last T.length + · subst j + obtain ⟨i, hi⟩ := by + simpa [TreeSequenceVertexSet] using hx + refine ⟨i, ?_⟩ + have hc : (Fin.castLT i (by omega) : Fin (T.length + 1 + 1)) = + i.castSucc := by + apply Fin.ext + rfl + rw [hc] + simp only [Fin.lastCases_last, Fin.succ_last, Nat.succ_eq_add_one, Fin.lastCases_castSucc] + rw [← hi] at hxy + rw [hxy] + exact (Sym2.eq_iff).2 (Or.inr ⟨rfl, rfl⟩) + · have hjle : j.val ≤ T.length := Nat.lt_succ_iff.mp j.isLt + have hjne : j.val ≠ T.length := by + intro he + apply hj + apply Fin.ext + simpa using he + have hj' : j.val < T.length := Nat.lt_of_le_of_ne hjle hjne + obtain ⟨i, hi⟩ := T.attaches (j.castPred hj) + have hjform : j = (j.castPred hj).castSucc := by + apply Fin.ext + rfl + have hji : (j.castPred hj).val + 1 ≤ j.val + 1 := by + rw [show (j.castPred hj).val = j.val by rfl] + refine ⟨Fin.castLE hji i, ?_⟩ + convert hi using 1 + · apply congrArg G.ends + conv_lhs => rw [hjform] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + · apply (Sym2.eq_iff).2 + left + constructor + · have hjs : j.succ = (j.castPred hj).succ.castSucc := by + apply Fin.ext + rfl + rw [hjs] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] + · have ibound : i.val < T.length + 1 := by omega + have hq : + (Fin.castLE hji i).castLT (by omega) = + (i.castLT ibound).castSucc := by + apply Fin.ext + rfl + rw [hq] + simp only [Fin.lastCases, Fin.reverseInduction_castSucc] } + refine ⟨U, ?_⟩ + refine ⟨by simp [U], ?_, ?_⟩ + · refine ⟨Nat.le_succ _, ?_, ?_⟩ + · intro i + have hc : Fin.castLE (Nat.succ_le_succ (Nat.le_succ T.length)) i = + i.castSucc := by + apply Fin.ext + rfl + rw [hc] + simp [U, Fin.lastCases, Fin.reverseInduction_castSucc] + · intro j + have hc : Fin.castLE (Nat.le_succ T.length) j = j.castSucc := by + apply Fin.ext + rfl + rw [hc] + simp [U, Fin.lastCases, Fin.reverseInduction_castSucc] + · simp [U, Fin.lastCases] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceEdgeSet.lean b/LeanPool/GoldbergSeymour/TreeSequenceEdgeSet.lean new file mode 100644 index 0000000000..3bf69c3b2a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceEdgeSet.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.Fin + +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Tree Sequence Edge Set + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The finite set of edges occurring in the tree sequence. -/ +noncomputable def TreeSequenceEdgeSet {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} + (T : TreeSequence G e0) : Finset E := by classical exact Finset.univ.image T.edge + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegment.lean b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegment.lean new file mode 100644 index 0000000000..ccbcda527c --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegment.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Tree Sequence Initial Segment + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The shorter tree's ordered vertices and edges agree with the beginning of the longer tree. -/ +def TreeSequenceInitialSegment {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} + (T T' : TreeSequence G e0) : Prop := + ∃ hlen : T.length ≤ T'.length, + (∀ i : Fin (T.length + 1), T'.vertex (Fin.castLE (Nat.succ_le_succ hlen) i) = T.vertex i) ∧ + ∀ j : Fin T.length, T'.edge (Fin.castLE hlen j) = T.edge j + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentFacts.lean b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentFacts.lean new file mode 100644 index 0000000000..d6ec5ee279 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentFacts.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Initial segments of Tashkinov tree sequences + +Shared order and vertex-set facts used by the Goldberg–Seymour construction. +The proofs collect repeated arguments from Wesley Pegden's Trellis formalization. +-/ + +@[expose] public section + +namespace GoldbergSeymour.TreeSequenceInitialSegment + +variable {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} + +theorem refl (tree : TreeSequence G e0) : TreeSequenceInitialSegment tree tree := by + exact ⟨le_rfl, fun _ ↦ rfl, fun _ ↦ rfl⟩ + +theorem trans {first second third : TreeSequence G e0} + (firstSecond : TreeSequenceInitialSegment first second) + (secondThird : TreeSequenceInitialSegment second third) : + TreeSequenceInitialSegment first third := by + obtain ⟨firstLength, firstVertices, firstEdges⟩ := firstSecond + obtain ⟨secondLength, secondVertices, secondEdges⟩ := secondThird + refine ⟨le_trans firstLength secondLength, ?_, ?_⟩ + · intro index + simpa only [Fin.castLE] using + (secondVertices (Fin.castLE (Nat.succ_le_succ firstLength) index)).trans + (firstVertices index) + · intro index + simpa only [Fin.castLE] using + (secondEdges (Fin.castLE firstLength index)).trans (firstEdges index) + +theorem vertexSet_subset {first second : TreeSequence G e0} + (segment : TreeSequenceInitialSegment first second) : + TreeSequenceVertexSet first ⊆ TreeSequenceVertexSet second := by + classical + obtain ⟨lengthBound, vertices, _⟩ := segment + intro vertex membership + obtain ⟨index, _, rfl⟩ := Finset.mem_image.mp membership + exact Finset.mem_image.mpr + ⟨Fin.castLE (Nat.succ_le_succ lengthBound) index, Finset.mem_univ _, vertices index⟩ + +theorem of_common_extension {first second extension : TreeSequence G e0} + (firstExtension : TreeSequenceInitialSegment first extension) + (secondExtension : TreeSequenceInitialSegment second extension) + (lengthBound : second.length ≤ first.length) : + TreeSequenceInitialSegment second first := by + obtain ⟨firstLength, firstVertices, firstEdges⟩ := firstExtension + obtain ⟨secondLength, secondVertices, secondEdges⟩ := secondExtension + refine ⟨lengthBound, ?_, ?_⟩ + · intro index + calc + first.vertex (Fin.castLE (Nat.succ_le_succ lengthBound) index) = + extension.vertex (Fin.castLE (Nat.succ_le_succ firstLength) + (Fin.castLE (Nat.succ_le_succ lengthBound) index)) := + (firstVertices _).symm + _ = extension.vertex (Fin.castLE (Nat.succ_le_succ secondLength) index) := by + congr 1 + _ = second.vertex index := secondVertices index + · intro index + calc + first.edge (Fin.castLE lengthBound index) = + extension.edge (Fin.castLE firstLength (Fin.castLE lengthBound index)) := + (firstEdges _).symm + _ = extension.edge (Fin.castLE secondLength index) := by congr 1 + _ = second.edge index := secondEdges index + +end GoldbergSeymour.TreeSequenceInitialSegment + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetEq.lean b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetEq.lean new file mode 100644 index 0000000000..012e3edb14 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetEq.lean @@ -0,0 +1,57 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tree Sequence Initial Segment Vertex Set Eq + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TreeSequenceInitialSegmentVertexSetEq + {V E : Type*} + {G : LooplessMultigraph V E} {e0 : E} + (A B : TreeSequence G e0) + (hAB : TreeSequenceInitialSegment A B) + (hvertices : TreeSequenceVertexSet A = TreeSequenceVertexSet B) : + A = B := by + have hcard (S : TreeSequence G e0) : + (TreeSequenceVertexSet S).card = S.length + 1 := by + classical + rw [TreeSequenceVertexSet, Finset.card_image_of_injective _ S.vertex_injective] + simp + have hlength : A.length = B.length := by + have := congrArg Finset.card hvertices + rw [hcard A, hcard B] at this + omega + rcases hAB with ⟨hlen, hvertex, hedge⟩ + cases A with + | mk la pa va ea via eia fa aa => + cases B with + | mk lb pb vb eb vib eib fb ab => + simp only at hlength + subst lb + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hvertex i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hedge i).symm + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetStrict.lean b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetStrict.lean new file mode 100644 index 0000000000..20440ebe83 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetStrict.lean @@ -0,0 +1,46 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Tree Sequence Initial Segment Vertex Set Strict + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TreeSequenceInitialSegmentVertexSetStrict + {V E : Type*} [Finite V] [Finite E] {G : LooplessMultigraph V E} {e0 : E} {A B : TreeSequence + G e0} + (hAB : TreeSequenceInitialSegment A B) (hlen : A.length < B.length) : + TreeSequenceVertexSet A < TreeSequenceVertexSet B := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + have hsubset := TreeSequenceInitialSegmentVertexSetSubset hAB + refine Finset.ssubset_iff_subset_ne.mpr ⟨hsubset, ?_⟩ + intro heq + have hcard : (TreeSequenceVertexSet A).card = + (TreeSequenceVertexSet B).card := congrArg Finset.card heq + have hcardA : (TreeSequenceVertexSet A).card = A.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + A.vertex_injective] + have hcardB : (TreeSequenceVertexSet B).card = B.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + B.vertex_injective] + rw [hcardA, hcardB] at hcard + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetSubset.lean b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetSubset.lean new file mode 100644 index 0000000000..a27cddb49a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetSubset.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + +/-! +# Tree Sequence Initial Segment Vertex Set Subset + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TreeSequenceInitialSegmentVertexSetSubset + {V E : Type*} [Finite V] [Finite E] {G : LooplessMultigraph V E} {e0 : E} {A B : TreeSequence + G e0} + (hAB : TreeSequenceInitialSegment A B) : + TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨i, rfl⟩ := hv + obtain ⟨hlen, hvertices, _⟩ := hAB + exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, hvertices i⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequencePrefix.lean b/LeanPool/GoldbergSeymour/TreeSequencePrefix.lean new file mode 100644 index 0000000000..3f5a0edabc --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequencePrefix.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Tree Sequence Prefix + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The first specified positive number of edges and their vertices, with inherited tree +certificates. +-/ +noncomputable def TreeSequencePrefix {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} + (T : TreeSequence G e0) (q : ℕ) (hq : 1 ≤ q) (hqt : q ≤ T.length) : TreeSequence G e0 := by + classical + refine + { length := q + positive := hq + vertex := fun i => T.vertex (Fin.castLE (Nat.succ_le_succ hqt) i) + edge := fun i => T.edge (Fin.castLE hqt i) + vertex_injective := ?_ + edge_injective := ?_ + first_edge := ?_ + attaches := ?_ } + · intro i j hij + apply Fin.ext + simpa only [Fin.castLE] using + congrArg (fun x => x.val) (T.vertex_injective hij) + · intro i j hij + apply Fin.ext + simpa only [Fin.castLE] using + congrArg (fun x => x.val) (T.edge_injective hij) + · simpa only [Fin.castLE] using T.first_edge + · intro j + obtain ⟨i, hi⟩ := T.attaches (Fin.castLE hqt j) + refine ⟨i, ?_⟩ + simpa only [Fin.castLE, Fin.castLT, Fin.succ] using hi + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceVertexSet.lean b/LeanPool/GoldbergSeymour/TreeSequenceVertexSet.lean new file mode 100644 index 0000000000..caec6bf1fc --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceVertexSet.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.Fin + +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Tree Sequence Vertex Set + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The finite set of vertices occurring in the tree sequence. -/ +noncomputable def TreeSequenceVertexSet {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} + (T : TreeSequence G e0) : Finset V := by classical exact Finset.univ.image T.vertex + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeUsedColors.lean b/LeanPool/GoldbergSeymour/TreeUsedColors.lean new file mode 100644 index 0000000000..b44062081f --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeUsedColors.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.Fin + +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.PartialEdgeColoring + +/-! +# Tree Used Colors + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Colors assigned to noninitial tree edges. -/ +noncomputable def TreeUsedColors {V E : Type*} {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) : Finset (Fin k) := by + classical + exact Finset.univ.filter fun alpha => + ∃ j : Fin T.length, 1 ≤ j.val ∧ phi (T.edge j) = some alpha + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeVertexOrder.lean b/LeanPool/GoldbergSeymour/TreeVertexOrder.lean new file mode 100644 index 0000000000..a4720d2926 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeVertexOrder.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequence + +/-! +# Tree Vertex Order + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- One vertex occurs strictly before the other in the tree sequence. -/ +def TreeVertexOrder {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} (T : TreeSequence G e0) + (u v : V) : Prop := + ∃ i j : Fin (T.length + 1), T.vertex i = u ∧ T.vertex j = v ∧ i.val < j.val + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TreeVerticesBefore.lean b/LeanPool/GoldbergSeymour/TreeVerticesBefore.lean new file mode 100644 index 0000000000..8ab77953e6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeVerticesBefore.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TreeVertexOrder + +/-! +# Tree Vertices Before + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The tree vertices occurring strictly before the specified vertex. -/ +noncomputable def TreeVerticesBefore {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} + (T : TreeSequence G e0) (v : V) (_hv : v ∈ TreeSequenceVertexSet T) : Finset V := by + classical + exact (TreeSequenceVertexSet T).filter fun w => TreeVertexOrder T w v + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TrunkRotation.lean b/LeanPool/GoldbergSeymour/TrunkRotation.lean new file mode 100644 index 0000000000..0cef3b9e6e --- /dev/null +++ b/LeanPool/GoldbergSeymour/TrunkRotation.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple +public import LeanPool.GoldbergSeymour.NormalCycleEdge + +/-! +# Trunk Rotation + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- +The coloring shift and cyclic trunk-position agreements specifying a rotation of normal triples. -/ +def TrunkRotation {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} {T : TreeSequence G e0} + (N : NormalGlobalMaximumTriple G k e0 phi T) (j : Fin N.height) (e1 : E) + (psi : PartialEdgeColoring E k) (T' : TreeSequence G e1) + (N' : NormalGlobalMaximumTriple G k e1 psi T') : Prop := + 1 ≤ j.val ∧ + e1 = NormalCycleEdge N j ∧ + psi e1 = none ∧ + (∀ i : Fin j.val, + psi (NormalCycleEdge N (Fin.castLE (Nat.le_of_lt j.isLt) i)) = + phi + (NormalCycleEdge N + ⟨i.val + 1, by + have hi := i.isLt + have hj := j.isLt + omega⟩)) ∧ + (∀ f : E, + (∀ i : Fin (j.val + 1), f ≠ NormalCycleEdge N (Fin.castLE (Nat.succ_le_iff.mpr j.isLt) i)) → + psi f = phi f) ∧ + T'.length = T.length ∧ + N'.height = N.height ∧ + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + (∀ r : Fin (T'.length + 1), + r.val < N.height → + ∃ i : Fin N.height, + i.val = (j.val + r.val) % N.height ∧ + T'.vertex r = T.vertex (Fin.castLE N.height_upper i)) ∧ + (∀ r : Fin (T'.length + 1), + N.height ≤ r.val → ∃ s : Fin (T.length + 1), s.val = r.val ∧ T'.vertex r = T.vertex s) ∧ + (∀ r : Fin T'.length, + r.val + 1 < N.height → + ∃ i : Fin N.height, + i.val = (j.val + r.val) % N.height ∧ T'.edge r = NormalCycleEdge N i) ∧ + (∀ r : Fin T'.length, + N.height - 1 ≤ r.val → ∃ s : Fin T.length, s.val = r.val ∧ T'.edge r = T.edge s) ∧ + ∃ pred : Fin N.height, + pred.val = (j.val + N.height - 1) % N.height ∧ N'.closingEdge = NormalCycleEdge N pred + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponent.lean b/LeanPool/GoldbergSeymour/TwoColorComponent.lean new file mode 100644 index 0000000000..dda86aab70 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponent.lean @@ -0,0 +1,29 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Two Color Component + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The connected component in the incidence graph restricted to the two specified colors. -/ +def TwoColorComponent {V E : Type*} (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (z : Sum V E) : Set (Sum V E) := + (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk z + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentCycle.lean b/LeanPool/GoldbergSeymour/TwoColorComponentCycle.lean new file mode 100644 index 0000000000..4b2b103b4c --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentCycle.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorCycle + +/-! +# Two Color Component Cycle + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The component is exactly the support of a simple two-color cycle. -/ +def TwoColorComponentCycle {V E : Type*} (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (z : Sum V E) : Prop := + ∃ cycle : TwoColorCycle G phi alpha beta, + ∀ x : Sum V E, x ∈ cycle.walk.support ↔ x ∈ TwoColorComponent G phi alpha beta z + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentNearestSegment.lean b/LeanPool/GoldbergSeymour/TwoColorComponentNearestSegment.lean new file mode 100644 index 0000000000..13911602a5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentNearestSegment.lean @@ -0,0 +1,534 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.LooplessMultigraph +public import LeanPool.GoldbergSeymour.TreeSequence +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Two Color Component Nearest Segment + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +private theorem TwoColorComponentNearestSegment_oriented_82_hshape_120.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Finite E] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) (alpha beta : Fin k), + let H := TwoColorIncidenceGraph G phi alpha beta; + ∀ (a b : V ⊕ E) (_ : (TwoColorIncidenceGraph G phi alpha beta).Walk a b) (_ _ : ℕ) + {a' b' : V ⊕ E} (q : H.Walk a' b') (_ iy : ℕ), + let P := fun (d : ℕ) => + d ≤ iy ∧ ∃ (v : V), q.getVert (iy - d) = Sum.inl v ∧ v ∈ TreeSequenceVertexSet S; + ∀ (hex : ∃ (d : ℕ), P d), + let d := Nat.find hex; + ∀ (v0 : V), + let start := iy - d; + let r := (q.drop start).take d; + r.length = d → + r.getVert 0 = Sum.inl v0 → + ∀ n ≤ d, + (n % 2 = 0 → ∃ (v : V), r.getVert n = Sum.inl v) ∧ + (n % 2 = 1 → ∃ (e : E), r.getVert n = Sum.inr e) := by + classical + intro V E _ _ _ _ G k e0 phi S alpha beta H a b p iu iy a' b' q iu iy P hex d v0 start r hrlen + hrstart n + let := Fintype.ofFinite E + induction n with + | zero => + intro hn + constructor + · intro _ + exact ⟨v0, hrstart⟩ + · omega + | succ n ih => + intro hn + have hnlt : n < r.length := by rw [hrlen]; omega + have hadj := r.adj_getVert_succ hnlt + have hprev := ih (by omega) + constructor + · intro heven + obtain ⟨e, he⟩ := hprev.2 (by omega) + cases hnext : r.getVert (n + 1) with + | inl v => exact ⟨v, rfl⟩ + | inr e' => + rw [he, hnext] at hadj + simp [H, TwoColorIncidenceGraph] at hadj + · intro hodd + obtain ⟨v, hv⟩ := hprev.1 (by omega) + cases hnext : r.getVert (n + 1) with + | inl v' => + rw [hv, hnext] at hadj + simp [H, TwoColorIncidenceGraph] at hadj + | inr e => exact ⟨e, rfl⟩ + +private theorem TwoColorComponentNearestSegment_oriented_82_hvertexInjective_199.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) (alpha beta : Fin k), + let H := TwoColorIncidenceGraph G phi alpha beta; + ∀ (a b : V ⊕ E) (_ : (TwoColorIncidenceGraph G phi alpha beta).Walk a b) (_ _ : ℕ) + {a' b' : V ⊕ E} (q : H.Walk a' b') (_ iy : ℕ), + let P := fun (d : ℕ) => + d ≤ iy ∧ ∃ (v : V), q.getVert (iy - d) = Sum.inl v ∧ v ∈ TreeSequenceVertexSet S; + ∀ (hex : ∃ (d : ℕ), P d), + let d := Nat.find hex; + let start := iy - d; + let r := (q.drop start).take d; + r.length = d → + r.IsPath → + ∀ (m : ℕ), + d = 2 * m → + ∀ (hvAt : ∀ (i : Fin (m + 1)), ∃ (v : V), r.getVert (2 * (↑i : ℕ)) = Sum.inl v), + let pathVertex := fun (i : Fin (m + 1)) => (hvAt i).choose; + (∀ (i : Fin (m + 1)), r.getVert (2 * (↑i : ℕ)) = Sum.inl (pathVertex i)) → + Function.Injective pathVertex := by + classical + intro V E _ _ _ G k e0 phi S alpha beta H a b p iu iy a' b' q iu iy P hex d start r hrlen + hrpath m hdm hvAt pathVertex hvSpec i j hij + have hget : r.getVert (2 * i.val) = r.getVert (2 * j.val) := by + rw [hvSpec i, hvSpec j, hij] + have hibound : 2 * i.val ≤ r.length := by + rw [hrlen, hdm] + exact Nat.mul_le_mul_left 2 (Nat.lt_succ_iff.mp i.isLt) + have hjbound : 2 * j.val ≤ r.length := by + rw [hrlen, hdm] + exact Nat.mul_le_mul_left 2 (Nat.lt_succ_iff.mp j.isLt) + have hidx := hrpath.getVert_injOn hibound hjbound hget + apply Fin.ext + omega + +private theorem TwoColorComponentNearestSegment_oriented_82_hedgeInjective_212.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) (alpha beta : Fin k), + let H := TwoColorIncidenceGraph G phi alpha beta; + ∀ (a b : V ⊕ E) (_ : (TwoColorIncidenceGraph G phi alpha beta).Walk a b) (_ _ : ℕ) + {a' b' : V ⊕ E} (q : H.Walk a' b') (_ iy : ℕ), + let P := fun (d : ℕ) => + d ≤ iy ∧ ∃ (v : V), q.getVert (iy - d) = Sum.inl v ∧ v ∈ TreeSequenceVertexSet S; + ∀ (hex : ∃ (d : ℕ), P d), + let d := Nat.find hex; + let start := iy - d; + let r := (q.drop start).take d; + r.length = d → + r.IsPath → + ∀ (m : ℕ), + d = 2 * m → + ∀ (heAt : ∀ (i : Fin m), ∃ (e : E), r.getVert (2 * (↑i : ℕ) + 1) = Sum.inr e), + let pathEdge := fun (i : Fin m) => (heAt i).choose; + (∀ (i : Fin m), r.getVert (2 * (↑i : ℕ) + 1) = Sum.inr (pathEdge i)) → + Function.Injective pathEdge := by + classical + intro V E _ _ _ G k e0 phi S alpha beta H a b p iu iy a' b' q iu iy P hex d start r hrlen + hrpath m hdm heAt pathEdge heSpec i j hij + have hget : r.getVert (2 * i.val + 1) = r.getVert (2 * j.val + 1) := by + rw [heSpec i, heSpec j, hij] + have hibound : 2 * i.val + 1 ≤ r.length := by + rw [hrlen, hdm] + omega + have hjbound : 2 * j.val + 1 ≤ r.length := by + rw [hrlen, hdm] + omega + have hidx := hrpath.getVert_injOn hibound hjbound hget + apply Fin.ext + omega + +private theorem TwoColorComponentNearestSegment_oriented_82_hstep_259.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) (alpha beta : Fin k), + let H := TwoColorIncidenceGraph G phi alpha beta; + ∀ (a b : V ⊕ E) (_ : (TwoColorIncidenceGraph G phi alpha beta).Walk a b) (_ _ : ℕ) + {a' b' : V ⊕ E} (q : H.Walk a' b') (_ iy : ℕ), + let P := fun (d : ℕ) => + d ≤ iy ∧ ∃ (v : V), q.getVert (iy - d) = Sum.inl v ∧ v ∈ TreeSequenceVertexSet S; + ∀ (hex : ∃ (d : ℕ), P d), + let d := Nat.find hex; + let start := iy - d; + let r := (q.drop start).take d; + r.length = d → + ∀ (m : ℕ), + d = 2 * m → + ∀ (hvAt : ∀ (i : Fin (m + 1)), ∃ (v : V), r.getVert (2 * (↑i : ℕ)) = Sum.inl v) + (heAt : ∀ (i : Fin m), ∃ (e : E), r.getVert (2 * (↑i : ℕ) + 1) = Sum.inr e), + let pathVertex := fun (i : Fin (m + 1)) => (hvAt i).choose; + let pathEdge := fun (i : Fin m) => (heAt i).choose; + (∀ (i : Fin (m + 1)), r.getVert (2 * (↑i : ℕ)) = Sum.inl (pathVertex i)) → + (∀ (i : Fin m), r.getVert (2 * (↑i : ℕ) + 1) = Sum.inr (pathEdge i)) → + ∀ (i : Fin m), + Incident G (pathVertex i.castSucc) (pathEdge i) ∧ + Incident G (pathVertex i.succ) (pathEdge i) ∧ + (phi (pathEdge i) = some alpha ∨ phi (pathEdge i) = some beta) := by + classical + intro V E _ _ _ G k e0 phi S alpha beta H a b p iu iy a' b' q iu iy P hex d start r hrlen m hdm + hvAt heAt pathVertex pathEdge hvSpec heSpec i + have hleft := r.adj_getVert_succ + (i := 2 * i.val) (by rw [hrlen, hdm]; omega) + have hright := r.adj_getVert_succ + (i := 2 * i.val + 1) (by rw [hrlen, hdm]; omega) + have hleft' : H.Adj (Sum.inl (pathVertex i.castSucc)) + (Sum.inr (pathEdge i)) := by + rw [← hvSpec i.castSucc, ← heSpec i] + simpa using hleft + have hnext : 2 * i.val + 1 + 1 = 2 * i.succ.val := by simp; omega + have hright' : H.Adj (Sum.inr (pathEdge i)) + (Sum.inl (pathVertex i.succ)) := by + rw [← heSpec i, ← hvSpec i.succ] + simpa [hnext] + simp only [H, TwoColorIncidenceGraph] at hleft' hright' + exact ⟨hleft'.1, hright'.1, hleft'.2⟩ + +private theorem TwoColorComponentNearestSegment_oriented_82_hends_280.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) {k : ℕ} {e0 : E} (phi : PartialEdgeColoring E k) (S : TreeSequence + G e0) (alpha beta : Fin k) (y : V), alpha ≠ beta → y ∉ TreeSequenceVertexSet S → + let H := TwoColorIncidenceGraph G phi alpha beta; + ∀ (_ _ : V ⊕ E) {a' b' : V ⊕ E} (q : H.Walk a' b') (iy : ℕ), + let P := fun (d : ℕ) => d ≤ iy ∧ + ∃ (v : V), q.getVert (iy - d) = Sum.inl v ∧ v ∈ TreeSequenceVertexSet S; + ∀ (hex : + ∃ (d : ℕ), P d), + let d := Nat.find hex; + let start := iy - d; + let r := (q.drop start).take d; + ∀ (m : ℕ) (hvAt : + ∀ (i : Fin (m + 1)), + ∃ (v : V), r.getVert (2 * (↑i : ℕ)) = Sum.inl v) (heAt : + ∀ (i : Fin m), + ∃ (e : E), r.getVert (2 * (↑i : ℕ) + 1) = Sum.inr e), + let pathVertex := fun (i : Fin (m + 1)) => (hvAt i).choose; + let pathEdge := fun (i : Fin m) => (heAt i).choose; Function.Injective pathVertex → ( + ∀ (i : Fin m), Incident G (pathVertex i.castSucc) (pathEdge i) ∧ Incident G (pathVertex + i.succ) (pathEdge i) ∧ (phi (pathEdge i) = some alpha ∨ phi (pathEdge i) = some beta)) → + ∀ (i : Fin m), G.ends (pathEdge i) = s(pathVertex i.castSucc, pathVertex i.succ) := by + classical + intro V E _ _ _ G k e0 phi S alpha beta y _ hy H a b a' b' q iy P hex d start r m hvAt heAt + pathVertex pathEdge hvertexInjective hstep i + have hneVertices : pathVertex i.castSucc ≠ pathVertex i.succ := by + intro heq + have := hvertexInjective heq + have hv := congrArg Fin.val this + simp at hv + have ends_eq_of_mem : ∀ {z : Sym2 V} {x y : V}, + x ∈ z → y ∈ z → x ≠ y → z = s(x, y) := by + intro z x y hx hy hxy + induction z using Sym2.inductionOn with + | _ a b => + simp only [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> + simp_all [] + exact ends_eq_of_mem (hstep i).1 (hstep i).2.1 hneVertices + +private theorem TwoColorComponentNearestSegment_oriented_82_hedgeFresh_298.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [DecidableEq V] + [DecidableEq E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) (alpha beta : Fin k), + let H := TwoColorIncidenceGraph G phi alpha beta; + ∀ {a' b' : V ⊕ E} (q : H.Walk a' b') (iy : ℕ), + let P := fun (d : ℕ) => + d ≤ iy ∧ ∃ (v : V), q.getVert (iy - d) = Sum.inl v ∧ v ∈ TreeSequenceVertexSet S; + ∀ (hex : ∃ (d : ℕ), P d), + let d := Nat.find hex; + let start := iy - d; + let r := (q.drop start).take d; + ∀ (m : ℕ) (hvAt : ∀ (i : Fin (m + 1)), ∃ (v : V), r.getVert (2 * (↑i : ℕ)) = Sum.inl v) + (heAt : ∀ (i : Fin m), ∃ (e : E), r.getVert (2 * (↑i : ℕ) + 1) = Sum.inr e), + let pathVertex := fun (i : Fin (m + 1)) => (hvAt i).choose; + let pathEdge := fun (i : Fin m) => (heAt i).choose; + (∀ (i : Fin m), pathVertex i.succ ∉ TreeSequenceVertexSet S) → + (∀ (i : Fin m), G.ends (pathEdge i) = s(pathVertex i.castSucc, pathVertex i.succ)) → + ∀ (i : Fin m) (j : Fin S.length), + pathEdge i ≠ S.edge j := by + classical + intro V E _ _ _ G k e0 phi S alpha beta H a' b' q iy P hex d start r m hvAt heAt pathVertex + pathEdge houtside hends i j heq + rcases S.attaches j with ⟨t, ht⟩ + have hinc : pathVertex i.succ ∈ G.ends (S.edge j) := by + rw [← heq, hends i] + simp [Sym2.mem_iff] + rw [ht] at hinc + simp only [Sym2.mem_iff] at hinc + apply houtside i + rcases hinc with hnew | hold + · rw [hnew] + simp [TreeSequenceVertexSet] + · rw [hold] + simp [TreeSequenceVertexSet] + +private theorem TwoColorComponentNearestSegment_oriented_82.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : ℕ} + {e0 : E} (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) (alpha beta : Fin k) (y : + V), alpha ≠ beta → y ∉ TreeSequenceVertexSet S → + let H := TwoColorIncidenceGraph G phi alpha beta; + let C := TwoColorComponent G phi alpha beta (Sum.inl y); + ∀ (a b : V ⊕ E) (p : (TwoColorIncidenceGraph G phi alpha beta).Walk a b), + ∀ u ∈ TreeSequenceVertexSet S, + ∀ iu ≤ p.length, + ∀ iy ≤ p.length, + ∀ {a' b' : V ⊕ E} (q : H.Walk a' b'), q.IsPath → {x : V ⊕ E | x ∈ q.support} = C → + ∀ (iu iy : ℕ), iu ≤ q.length → iy ≤ q.length → iu ≤ iy → q.getVert iu = Sum.inl u → q.getVert + iy = Sum.inl y → + ∃ (m : ℕ) (_ : 1 ≤ m) (pathVertex : Fin (m + 1) → V) (pathEdge : Fin m → E), + Function.Injective pathVertex ∧ Function.Injective pathEdge ∧ pathVertex 0 ∈ + TreeSequenceVertexSet S ∧ pathVertex (Fin.last m) = y ∧ ( + ∀ (i : Fin m), pathVertex i.succ ∉ TreeSequenceVertexSet S) ∧ ( + ∀ (i : Fin (m + 1)), Sum.inl (pathVertex i) ∈ C) ∧ ( + ∀ (i : Fin m), Sum.inr (pathEdge i) ∈ C) ∧ ( + ∀ (i : Fin m), phi (pathEdge i) = some alpha ∨ phi (pathEdge i) = some beta) ∧ ( + ∀ (i : Fin m), G.ends (pathEdge i) = s(pathVertex i.castSucc, pathVertex i.succ)) ∧ + ∀ (i : Fin m) (j : Fin S.length), pathEdge i ≠ S.edge j := by + classical + intro V E _ _ G k e0 phi S alpha beta y _ hy H C a b p u huS iu hiu iy hiy a' b' q hq hqsupp iu + iy hiu hiy hiule hqu hqy + let := Fintype.ofFinite V + let := Fintype.ofFinite E + let P : Nat → Prop := fun d => + d ≤ iy ∧ ∃ v : V, + q.getVert (iy - d) = Sum.inl v ∧ v ∈ TreeSequenceVertexSet S + have hex : ∃ d, P d := by + refine ⟨iy - iu, by omega, u, ?_, huS⟩ + have hidx : iy - (iy - iu) = iu := by omega + rw [hidx] + exact hqu + let d := Nat.find hex + have hdP : P d := Nat.find_spec hex + obtain ⟨hdle, v0, hv0, hv0S⟩ := hdP + have hdpos : 0 < d := by + by_contra hn + have hd0 : d = 0 := by omega + have hv0y : v0 = y := by + have hv0' := hv0 + rw [hd0] at hv0' + have heq : (Sum.inl v0 : Sum V E) = Sum.inl y := by + simpa using hv0'.symm.trans hqy + exact Sum.inl.inj heq + apply hy + rw [← hv0y] + exact hv0S + let start := iy - d + let r := (q.drop start).take d + have hrlen : r.length = d := by + simp only [r, SimpleGraph.Walk.take_length, SimpleGraph.Walk.drop_length] + rw [Nat.min_eq_left] + omega + have hrget : ∀ n ≤ d, r.getVert n = q.getVert (start + n) := by + intro n hn + simp only [r, SimpleGraph.Walk.take_getVert, SimpleGraph.Walk.drop_getVert] + rw [Nat.min_eq_right hn] + have hrstart : r.getVert 0 = Sum.inl v0 := by + rw [hrget 0 (by omega)] + simpa [start] using hv0 + have hrend : r.getVert d = Sum.inl y := by + rw [hrget d (by omega)] + have hidx : start + d = iy := by simp [start]; omega + rw [hidx] + exact hqy + have hrpath : r.IsPath := (hq.drop start).take d + have hrout : ∀ n, 0 < n → n ≤ d → ∀ v : V, + r.getVert n = Sum.inl v → v ∉ TreeSequenceVertexSet S := by + intro n hnpos hnle v hrv hvS + have hsmall : d - n < d := by omega + have hnotP := Nat.find_min hex hsmall + apply hnotP + refine ⟨by omega, v, ?_, hvS⟩ + have hidx : iy - (d - n) = start + n := by simp [start]; omega + rw [hidx, ← hrget n hnle] + exact hrv + have hshape : ∀ n ≤ d, + (n % 2 = 0 → ∃ v : V, r.getVert n = Sum.inl v) ∧ + (n % 2 = 1 → ∃ e : E, r.getVert n = Sum.inr e) := by + exact @TwoColorComponentNearestSegment_oriented_82_hshape_120 V E inferInstance inferInstance + inferInstance inferInstance G k e0 phi S alpha beta a b p iu iy a' b' q iu iy hex v0 + hrlen hrstart + have hdeven : d % 2 = 0 := by + by_contra hnot + have hodd : d % 2 = 1 := by omega + obtain ⟨e, he⟩ := (hshape d (by omega)).2 hodd + rw [hrend] at he + cases he + obtain ⟨m, hdm⟩ : ∃ m : Nat, d = 2 * m := + even_iff_exists_two_mul.mp (Nat.even_iff.mpr hdeven) + have hm : 1 ≤ m := by omega + have hvAt : ∀ i : Fin (m + 1), ∃ v : V, + r.getVert (2 * i.val) = Sum.inl v := by + intro i + apply (hshape (2 * i.val) (by omega)).1 + omega + have heAt : ∀ i : Fin m, ∃ e : E, + r.getVert (2 * i.val + 1) = Sum.inr e := by + intro i + apply (hshape (2 * i.val + 1) (by omega)).2 + omega + let pathVertex : Fin (m + 1) → V := fun i => (hvAt i).choose + let pathEdge : Fin m → E := fun i => (heAt i).choose + have hvSpec (i : Fin (m + 1)) : + r.getVert (2 * i.val) = Sum.inl (pathVertex i) := + (hvAt i).choose_spec + have heSpec (i : Fin m) : + r.getVert (2 * i.val + 1) = Sum.inr (pathEdge i) := + (heAt i).choose_spec + have hvertexInjective : Function.Injective pathVertex := by + exact @TwoColorComponentNearestSegment_oriented_82_hvertexInjective_199 V E inferInstance + inferInstance inferInstance G k e0 phi S alpha beta a b p iu iy a' b' q iu iy hex hrlen + hrpath m hdm hvAt hvSpec + have hedgeInjective : Function.Injective pathEdge := by + exact @TwoColorComponentNearestSegment_oriented_82_hedgeInjective_212 V E inferInstance + inferInstance inferInstance G k e0 phi S alpha beta a b p iu iy a' b' q iu iy hex hrlen + hrpath m hdm heAt heSpec + have hstart : pathVertex 0 ∈ TreeSequenceVertexSet S := by + have hs : pathVertex 0 = v0 := by + apply Sum.inl.inj + rw [← hvSpec 0] + simpa using hrstart + rw [hs] + exact hv0S + have hlast : pathVertex (Fin.last m) = y := by + apply Sum.inl.inj + rw [← hvSpec (Fin.last m)] + simpa [hdm] using hrend + have houtside : ∀ i : Fin m, + pathVertex i.succ ∉ TreeSequenceVertexSet S := by + intro i + have hibound : 2 * i.succ.val ≤ d := by + rw [hdm] + exact Nat.mul_le_mul_left 2 (Nat.lt_succ_iff.mp i.succ.isLt) + apply hrout (2 * i.succ.val) (by simp only [Fin.val_succ]; omega) hibound + (pathVertex i.succ) + exact hvSpec i.succ + have hrComponent : ∀ n ≤ d, r.getVert n ∈ C := by + intro n hn + rw [← hqsupp] + rw [hrget n hn] + exact q.getVert_mem_support _ + have hvertexComponent : ∀ i : Fin (m + 1), + Sum.inl (pathVertex i) ∈ C := by + intro i + rw [← hvSpec i] + exact hrComponent _ (by rw [hdm]; omega) + have hedgeComponent : ∀ i : Fin m, Sum.inr (pathEdge i) ∈ C := by + intro i + rw [← heSpec i] + exact hrComponent _ (by rw [hdm]; omega) + have hstep : + ∀ i : Fin m, Incident G (pathVertex i.castSucc) (pathEdge i) ∧ Incident G (pathVertex i.succ) + (pathEdge i) ∧ (phi (pathEdge i) = some alpha ∨ phi (pathEdge i) = some beta) := by + exact @TwoColorComponentNearestSegment_oriented_82_hstep_259 V E inferInstance inferInstance + inferInstance G k e0 phi S alpha beta a b p iu iy a' b' q iu iy hex hrlen m hdm hvAt heAt + hvSpec heSpec + have hends : + ∀ i : Fin m, G.ends (pathEdge i) = s(pathVertex i.castSucc, pathVertex i.succ) := by + exact @TwoColorComponentNearestSegment_oriented_82_hends_280 V E inferInstance inferInstance + inferInstance G k e0 phi S alpha beta y (by assumption) hy a b a' b' q iy hex m hvAt heAt + hvertexInjective hstep + have hedgeFresh : ∀ i : Fin m, ∀ j : Fin S.length, + pathEdge i ≠ S.edge j := by + exact @TwoColorComponentNearestSegment_oriented_82_hedgeFresh_298 V E inferInstance + inferInstance inferInstance G k e0 phi S alpha beta a' b' q iy hex m hvAt heAt houtside + hends + exact ⟨m, hm, pathVertex, pathEdge, hvertexInjective, + hedgeInjective, hstart, hlast, houtside, hvertexComponent, + hedgeComponent, fun i => (hstep i).2.2, hends, hedgeFresh⟩ + +theorem TwoColorComponentNearestSegment + {V E : Type*} + [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) + (alpha beta : Fin k) (y : V) + (hproper : IsProperEdgeColoring G phi) + (_ : alpha ≠ beta) + (hy : y ∉ TreeSequenceVertexSet S) + (hmeets : ∃ u ∈ TreeSequenceVertexSet S, + Sum.inl u ∈ TwoColorComponent G phi alpha beta (Sum.inl y)) : + ∃ (m : Nat) (_ : 1 ≤ m) (pathVertex : Fin (m + 1) → V) (pathEdge : Fin m → E), + Function.Injective pathVertex ∧ + Function.Injective pathEdge ∧ + pathVertex 0 ∈ TreeSequenceVertexSet S ∧ + pathVertex (Fin.last m) = y ∧ + (∀ i : Fin m, pathVertex i.succ ∉ TreeSequenceVertexSet S) ∧ + (∀ i : Fin (m + 1), + Sum.inl (pathVertex i) ∈ TwoColorComponent G phi alpha beta (Sum.inl y)) ∧ + (∀ i : Fin m, + Sum.inr (pathEdge i) ∈ TwoColorComponent G phi alpha beta (Sum.inl y)) ∧ + (∀ i : Fin m, + phi (pathEdge i) = some alpha ∨ phi (pathEdge i) = some beta) ∧ + (∀ i : Fin m, + G.ends (pathEdge i) = s(pathVertex i.castSucc, pathVertex i.succ)) ∧ + ∀ i : Fin m, ∀ j : Fin S.length, pathEdge i ≠ S.edge j := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + let H := TwoColorIncidenceGraph G phi alpha beta + let C := TwoColorComponent G phi alpha beta (Sum.inl y) + obtain ⟨a, b, p, hp, hsupp⟩ := + TwoColorComponentSpanningPath G phi alpha beta hproper (Sum.inl y) + obtain ⟨u, huS, huC⟩ := hmeets + have huP : Sum.inl u ∈ p.support := by + change Sum.inl u ∈ {x | x ∈ p.support} + rw [hsupp] + exact huC + have hyC : Sum.inl y ∈ C := by + change H.connectedComponentMk (Sum.inl y) = H.connectedComponentMk (Sum.inl y) + rfl + have hyP : Sum.inl y ∈ p.support := by + change Sum.inl y ∈ {x | x ∈ p.support} + rw [hsupp] + exact hyC + obtain ⟨iu, hpu, hiu⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp huP + obtain ⟨iy, hpy, hiy⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hyP + have oriented : + ∀ {a' b' : Sum V E} (q : H.Walk a' b') (hq : q.IsPath) (hqsupp : {x | x ∈ q.support} = C) (iu + iy : Nat) (hiu : iu ≤ q.length) (hiy : iy ≤ q.length) (hiule : iu ≤ iy) (hqu : q.getVert + iu = Sum.inl u) (hqy : q.getVert iy = Sum.inl y), + ∃ (m : Nat) (_ : 1 ≤ m) (pathVertex : Fin (m + 1) → V) (pathEdge : Fin m → E), + Function.Injective pathVertex ∧ Function.Injective pathEdge ∧ pathVertex 0 ∈ + TreeSequenceVertexSet S ∧ pathVertex (Fin.last m) = y ∧ ( + ∀ i : Fin m, pathVertex i.succ ∉ TreeSequenceVertexSet S) ∧ ( + ∀ i : Fin (m + 1), Sum.inl (pathVertex i) ∈ C) ∧ ( + ∀ i : Fin m, Sum.inr (pathEdge i) ∈ C) ∧ ( + ∀ i : Fin m, phi (pathEdge i) = some alpha ∨ phi (pathEdge i) = some beta) ∧ ( + ∀ i : Fin m, G.ends (pathEdge i) = s(pathVertex i.castSucc, pathVertex i.succ)) ∧ + ∀ i : Fin m, + ∀ j : Fin S.length, pathEdge i ≠ S.edge j := by + exact @TwoColorComponentNearestSegment_oriented_82 V E inferInstance inferInstance + G k e0 phi S alpha beta y (by assumption) hy a b p u huS iu + hiu iy hiy + by_cases horder : iu ≤ iy + · exact oriented p hp hsupp iu iy hiu hiy horder hpu hpy + · have hrevSupp : {x | x ∈ p.reverse.support} = C := by + ext x + simp only [Set.mem_ofPred_eq, SimpleGraph.Walk.support_reverse, List.mem_reverse] + exact Set.ext_iff.mp hsupp x + apply oriented p.reverse hp.reverse hrevSupp (p.length - iu) (p.length - iy) + · simp + · simp + · omega + · rw [SimpleGraph.Walk.getVert_reverse] + have hidx : p.length - (p.length - iu) = iu := by omega + rw [hidx] + exact hpu + · rw [SimpleGraph.Walk.getVert_reverse] + have hidx : p.length - (p.length - iy) = iy := by omega + rw [hidx] + exact hpy + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSpanningPath.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSpanningPath.lean new file mode 100644 index 0000000000..0dbf682641 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSpanningPath.lean @@ -0,0 +1,165 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo + +/-! +# Two Color Component Spanning Path + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TwoColorComponentSpanningPath {V E : Type*} + [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) + (alpha beta : Fin k) (hproper : IsProperEdgeColoring G phi) + (z : Sum V E) : + ∃ (u v : Sum V E) (p : (TwoColorIncidenceGraph G phi alpha beta).Walk u v), + p.IsPath ∧ {x | x ∈ p.support} = TwoColorComponent G phi alpha beta z := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + let H := TwoColorIncidenceGraph G phi alpha beta + let C := H.connectedComponentMk z + let : Nonempty C := ⟨⟨z, by + change z ∈ C.supp + rw [SimpleGraph.ConnectedComponent.mem_supp_iff] + ⟩⟩ + obtain ⟨a, b, q, hq, hmax⟩ := + SimpleGraph.Walk.exists_isPath_forall_isPath_length_le_length C.toSimpleGraph + have hqall : ∀ x : C, x ∈ q.support := by + intro x + by_contra hx + have hboundary : ∃ v w : C, v ∈ q.support ∧ w ∉ q.support ∧ + C.toSimpleGraph.Adj v w := by + by_contra hno + push Not at hno + have hr : C.toSimpleGraph.Reachable a x := + C.connected_toSimpleGraph.preconnected a x + have hm := hr.mem_subgraphVerts + (H := (⊤ : C.toSimpleGraph.Subgraph).induce {y | y ∈ q.support}) + (fun v hv w hadj => by + have hv' : v ∈ q.support := by simpa using hv + have hw' : w ∈ q.support := by + by_contra hw' + exact hno v w hv' hw' (by simpa using hadj) + exact ⟨hv', hw', hadj⟩) + (by simp) + have : x ∈ q.support := by simpa using hm + exact hx this + obtain ⟨v, w, hv, hw, hvw⟩ := hboundary + obtain ⟨i, hvi, hi⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hv + have hle : i ≤ q.length := hi + have hvi' : q.getVert i = v := hvi + by_cases hi0 : i = 0 + · have hvstart : v = a := by + calc + v = q.getVert i := hvi'.symm + _ = q.getVert 0 := congrArg q.getVert hi0 + _ = a := q.getVert_zero + subst v + have hend : C.toSimpleGraph.Adj a w := by simpa [hvi', hi0] using hvw + have hnew : (q.reverse.concat hend).IsPath := + hq.reverse.concat (by simpa using hw) hend + have hlong := hmax _ _ _ hnew + simp at hlong + by_cases hil : i = q.length + · have hvend : v = b := by + rw [← hvi', hq.getVert_eq_end_iff hle] + exact hil + subst v + have hend : C.toSimpleGraph.Adj b w := by simpa [hvi', hil] using hvw + have hnew : (q.concat hend).IsPath := hq.concat hw hend + have hlong := hmax _ _ _ hnew + simp at hlong + have hi_prev : i - 1 ≤ q.length := by omega + have hi_next : i + 1 ≤ q.length := by omega + have hleft : C.toSimpleGraph.Adj (q.getVert i) (q.getVert (i - 1)) := by + have hi_eq : i - 1 + 1 = i := by omega + rw [← hi_eq] + exact (q.adj_getVert_succ (by omega : i - 1 < q.length)).symm + have hright : C.toSimpleGraph.Adj (q.getVert i) (q.getVert (i + 1)) := by + exact q.adj_getVert_succ (by omega : i < q.length) + have hne_left : q.getVert (i - 1) ≠ w := by + intro he + apply hw + rw [← he] + exact q.getVert_mem_support _ + have hne_right : q.getVert (i + 1) ≠ w := by + intro he + apply hw + rw [← he] + exact q.getVert_mem_support _ + have hne_lr : q.getVert (i - 1) ≠ q.getVert (i + 1) := by + intro he + have := hq.getVert_injOn + (show i - 1 ≤ q.length by omega) (show i + 1 ≤ q.length by omega) he + omega + let : Fintype (H.neighborSet (v : Sum V E)) := Fintype.ofFinite _ + have hthree : 3 ≤ @SimpleGraph.degree _ H (v : Sum V E) (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let s : Finset (Sum V E) := + {(w : Sum V E), (q.getVert (i - 1) : Sum V E), (q.getVert (i + 1) : Sum V E)} + have hs : s ⊆ (H.neighborFinset (v : Sum V E)) := by + intro y hy + simp only [s, Finset.mem_insert, Finset.mem_singleton] at hy + rcases hy with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using + (C.toSimpleGraph_adj v.property w.property).mp hvw + · have hleft' : C.toSimpleGraph.Adj v (q.getVert (i - 1)) := by + rw [← hvi'] + exact hleft + simpa [SimpleGraph.mem_neighborFinset] using + (C.toSimpleGraph_adj v.property (q.getVert (i - 1)).property).mp hleft' + · have hright' : C.toSimpleGraph.Adj v (q.getVert (i + 1)) := by + rw [← hvi'] + exact hright + simpa [SimpleGraph.mem_neighborFinset] using + (C.toSimpleGraph_adj v.property (q.getVert (i + 1)).property).mp hright' + have hc : 3 ≤ s.card := by + have hwl : (w : Sum V E) ≠ (q.getVert (i - 1) : Sum V E) := by + intro he + apply hne_left + exact Subtype.ext he.symm + have hwr : (w : Sum V E) ≠ (q.getVert (i + 1) : Sum V E) := by + intro he + apply hne_right + exact Subtype.ext he.symm + have hlr : (q.getVert (i - 1) : Sum V E) ≠ + (q.getVert (i + 1) : Sum V E) := by + intro he + apply hne_lr + exact Subtype.ext he + simp [s, hwl, hwr, hlr] + exact le_trans hc (Finset.card_le_card hs) + have hdegree : @SimpleGraph.degree _ H v (Fintype.ofFinite _) ≤ 2 := by + simpa [H] using TwoColorIncidenceDegreeAtMostTwo G phi alpha beta hproper (v : Sum V E) + omega + let p := q.map C.toSimpleGraph_hom + refine ⟨C.toSimpleGraph_hom a, C.toSimpleGraph_hom b, p, ?_, ?_⟩ + · exact hq.map (by intro x y h; exact Subtype.ext h) + · ext x + constructor + · intro hx + rw [SimpleGraph.Walk.support_map] at hx + obtain ⟨y, hy, hxy⟩ := List.mem_map.mp hx + exact hxy ▸ y.property + · intro hx + have hy : (⟨x, hx⟩ : C) ∈ q.support := hqall ⟨x, hx⟩ + change x ∈ (q.map C.toSimpleGraph_hom).support + rw [SimpleGraph.Walk.support_map] + exact List.mem_map.mpr ⟨⟨x, hx⟩, hy, rfl⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwap.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwap.lean new file mode 100644 index 0000000000..87bc8bb6d1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwap.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorComponent + +/-! +# Two Color Component Swap + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Interchange two colors on the selected incidence-graph component and preserve every other edge +color. +-/ +noncomputable def TwoColorComponentSwap {V E : Type*} (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (z : Sum V E) : PartialEdgeColoring E k + := by + classical + exact fun e => + if Sum.inr e ∈ TwoColorComponent G phi alpha beta z then + if phi e = some alpha then some beta + else if phi e = some beta then some alpha + else phi e + else phi e + +/-- Completeness survives a component swap, including coincident swap colors. -/ +theorem TwoColorComponentSwapColored {V E : Type*} {G : LooplessMultigraph V E} {k : ℕ} + {phi : PartialEdgeColoring E k} {alpha beta : Fin k} {vertex : Sum V E} {edge : E} + {color : Fin k} (colored : phi edge = some color) : + ∃ newColor, TwoColorComponentSwap G phi alpha beta vertex edge = some newColor := by + classical + unfold TwoColorComponentSwap + split + · split + · exact ⟨beta, rfl⟩ + · split + · exact ⟨alpha, rfl⟩ + · exact ⟨color, colored⟩ + · exact ⟨color, colored⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapDisjointPairGraph.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapDisjointPairGraph.lean new file mode 100644 index 0000000000..70641d6def --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapDisjointPairGraph.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Two Color Component Swap Disjoint Pair Graph + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TwoColorComponentSwapDisjointPairGraph {V E : Type*} + (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta gamma delta : Fin k) + (z : Sum V E) + (hdisjoint : Disjoint ({alpha, beta} : Finset (Fin k)) {gamma, delta}) : + TwoColorIncidenceGraph G (TwoColorComponentSwap G phi gamma delta z) alpha beta = + TwoColorIncidenceGraph G phi alpha beta := by + classical + have hag : alpha ≠ gamma := by + intro h + subst gamma + have := Finset.disjoint_left.mp hdisjoint (Finset.mem_insert_self alpha {beta}) + (Finset.mem_insert_self alpha {delta}) + exact this + have had : alpha ≠ delta := by + intro h + subst delta + have := Finset.disjoint_left.mp hdisjoint (Finset.mem_insert_self alpha {beta}) + (Finset.mem_insert_of_mem (Finset.mem_singleton_self alpha)) + exact this + have hbg : beta ≠ gamma := by + intro h + subst gamma + have := Finset.disjoint_left.mp hdisjoint + (Finset.mem_insert_of_mem (Finset.mem_singleton_self beta)) + (Finset.mem_insert_self beta {delta}) + exact this + have hbd : beta ≠ delta := by + intro h + subst delta + have := Finset.disjoint_left.mp hdisjoint + (Finset.mem_insert_of_mem (Finset.mem_singleton_self beta)) + (Finset.mem_insert_of_mem (Finset.mem_singleton_self beta)) + exact this + have hga : gamma ≠ alpha := Ne.symm hag + have hgb : gamma ≠ beta := Ne.symm hbg + have hda : delta ≠ alpha := Ne.symm had + have hdb : delta ≠ beta := Ne.symm hbd + ext x y + cases x with + | inl v => + cases y with + | inl w => simp [TwoColorIncidenceGraph] + | inr e => + simp only [TwoColorIncidenceGraph, and_congr_right_iff] + intro hinc + simp only [TwoColorComponentSwap] + by_cases he : Sum.inr e ∈ TwoColorComponent G phi gamma delta z + · simp only [ite_eq_left he] + by_cases heg : phi e = some gamma + · simp [heg, hga, hgb, hda, hdb] + · by_cases hed : phi e = some delta + · have hgd : gamma ≠ delta := by + intro hgd + apply heg + simpa [hgd] using hed + simp [hed, hgd.symm, hga, hgb, hda, hdb] + · simp [heg, hed] + · simp [he] + | inr e => + cases y with + | inl v => + simp only [TwoColorIncidenceGraph, and_congr_right_iff] + intro hinc + simp only [TwoColorComponentSwap] + by_cases he : Sum.inr e ∈ TwoColorComponent G phi gamma delta z + · simp only [ite_eq_left he] + by_cases heg : phi e = some gamma + · simp [heg, hga, hgb, hda, hdb] + · by_cases hed : phi e = some delta + · have hgd : gamma ≠ delta := by + intro hgd + apply heg + simpa [hgd] using hed + simp [hed, hgd.symm, hga, hgb, hda, hdb] + · simp [heg, hed] + · simp [he] + | inr f => simp [TwoColorIncidenceGraph] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapMissingBehavior.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapMissingBehavior.lean new file mode 100644 index 0000000000..628a6aa7b3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapMissingBehavior.lean @@ -0,0 +1,163 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Two Color Component Swap Missing Behavior + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TwoColorComponentSwapMissingBehavior {V E : Type*} + [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (_ : IsProperEdgeColoring G phi) (z : Sum V E) : + let C := TwoColorComponent G phi alpha beta z + let phi' := TwoColorComponentSwap G phi alpha beta z + (∀ v : V, Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ v : V, + Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ + (∀ v : V, + Sum.inl v ∈ C → beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ v : V, + ∀ c : Fin k, + c ≠ alpha → + c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v) := by + classical + let _ := Fintype.ofFinite V + dsimp only + let H := TwoColorIncidenceGraph G phi alpha beta + let C := TwoColorComponent G phi alpha beta z + let phi' := TwoColorComponentSwap G phi alpha beta z + have vertex_of_edge {v : V} {e : E} (heC : Sum.inr e ∈ C) + (hve : Incident G v e) + (hecolor : phi e = some alpha ∨ phi e = some beta) : + Sum.inl v ∈ C := by + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z at heC + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using And.intro hve hecolor + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans heC + have edge_of_vertex {v : V} {e : E} (hvC : Sum.inl v ∈ C) + (hve : Incident G v e) + (hecolor : phi e = some alpha ∨ phi e = some beta) : + Sum.inr e ∈ C := by + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z at hvC + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z + have hadj : H.Adj (Sum.inr e) (Sum.inl v) := by + simpa [H, TwoColorIncidenceGraph] using And.intro hve hecolor + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hvC + have fixed_outside_vertex {v : V} (hvC : Sum.inl v ∉ C) {e : E} + (hve : Incident G v e) : phi' e = phi e := by + by_cases heC : Sum.inr e ∈ C + · by_cases hea : phi e = some alpha + · exact False.elim (hvC (vertex_of_edge heC hve (Or.inl hea))) + · by_cases heb : phi e = some beta + · exact False.elim (hvC (vertex_of_edge heC hve (Or.inr heb))) + · simp [phi', TwoColorComponentSwap, C, heC, hea, heb] + · simp [phi', TwoColorComponentSwap, C, heC] + have unaffected_value (e : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : + phi' e = some c ↔ phi e = some c := by + by_cases heC : Sum.inr e ∈ C + · by_cases hea : phi e = some alpha + · simp [phi', TwoColorComponentSwap, C, heC, hea, hca.symm, hcb.symm] + · by_cases heb : phi e = some beta + · simp [phi', TwoColorComponentSwap, C, heC, heb, hne.symm, + hca.symm, hcb.symm] + · simp [phi', TwoColorComponentSwap, C, heC, hea, heb] + · simp [phi', TwoColorComponentSwap, C, heC] + refine ⟨?_, ?_, ?_, ?_⟩ + · intro v hvC + apply Finset.ext + intro c + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + constructor + · intro hc hold + rcases hold with ⟨e, hve, hec⟩ + exact hc ⟨e, hve, (fixed_outside_vertex hvC hve).trans hec⟩ + · intro hc hnew + rcases hnew with ⟨e, hve, hec⟩ + exact hc ⟨e, hve, (fixed_outside_vertex hvC hve).symm.trans hec⟩ + · intro v hvC haMissing + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro hbPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hbPresent + rcases hbPresent with ⟨e, hve, hnew⟩ + by_cases heC : Sum.inr e ∈ C + · have hold : phi e = some alpha := by + by_cases hea : phi e = some alpha + · exact hea + · by_cases heb : phi e = some beta + · have hba : beta = alpha := by + simpa [phi', TwoColorComponentSwap, C, heC, hea, heb, hne] using hnew + exact False.elim (hne hba.symm) + · have : phi e = some beta := by + simp [TwoColorComponentSwap, C, heC, hea, heb] at hnew + exact False.elim (heb this) + have haNotPresent : alpha ∉ PresentColors G phi v := by + simpa [MissingColors] using haMissing + exact haNotPresent + (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hve, hold⟩) + · have hold : phi e = some beta := by + simpa [phi', TwoColorComponentSwap, C, heC] using hnew + exact heC (edge_of_vertex hvC hve (Or.inr hold)) + · intro v hvC hbMissing + apply Finset.mem_sdiff.mpr + refine ⟨Finset.mem_univ _, ?_⟩ + intro haPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at haPresent + rcases haPresent with ⟨e, hve, hnew⟩ + by_cases heC : Sum.inr e ∈ C + · have hold : phi e = some beta := by + by_cases hea : phi e = some alpha + · have hba : beta = alpha := by + simpa [phi', TwoColorComponentSwap, C, heC, hea, hne] using hnew + exact False.elim (hne hba.symm) + · by_cases heb : phi e = some beta + · exact heb + · have : phi e = some alpha := by + simp [TwoColorComponentSwap, C, heC, hea, heb] at hnew + exact False.elim (hea this) + have hbNotPresent : beta ∉ PresentColors G phi v := by + simpa [MissingColors] using hbMissing + exact hbNotPresent + (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨e, hve, hold⟩) + · have hold : phi e = some alpha := by + simpa [phi', TwoColorComponentSwap, C, heC] using hnew + exact heC (edge_of_vertex hvC hve (Or.inl hold)) + · intro v c hca hcb + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter] + constructor + · intro hc hold + rcases hold with ⟨e, hve, hec⟩ + exact hc ⟨e, hve, (unaffected_value e c hca hcb).mpr hec⟩ + · intro hc hnew + rcases hnew with ⟨e, hve, hec⟩ + exact hc ⟨e, hve, (unaffected_value e c hca hcb).mp hec⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapNonElementary.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapNonElementary.lean new file mode 100644 index 0000000000..ec49e60605 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapNonElementary.lean @@ -0,0 +1,335 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Two Color Component Swap Non Elementary + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +private theorem TwoColorComponentSwapNonElementary_branch_218.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (z : V ⊕ E) (X : Finset V) (u v : V), + v ∈ X → Sum.inl v ∈ TwoColorComponent G phi alpha beta z → + let C := TwoColorComponent G phi alpha beta z; + let phi' := TwoColorComponentSwap G phi alpha beta z; ( + ∀ {w : V}, Sum.inl w ∈ C → alpha ∈ MissingColors G phi w → w = u) → ( + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi alpha beta z → MissingColors G + (TwoColorComponentSwap G phi alpha beta z) v = MissingColors G phi v) → alpha ∈ + MissingColors G phi' v → ( + ∀ {u : V}, u ∈ X → + ∀ {v : V}, v ∈ X → u ≠ v → Disjoint (MissingColors G (TwoColorComponentSwap G phi alpha beta + z) u) (MissingColors G (TwoColorComponentSwap G phi alpha beta z) v)) → + ∀ x ∈ X, + ∀ y ∈ X, x ≠ y → + ∀ c ∈ MissingColors G phi x, c ∈ MissingColors G phi y → c = alpha → False := by + classical + intro V E _ _ G k phi alpha beta z X u v hvX hvC C phi' unique_alpha outside_fixed hv_alpha_new + helementary x hxX y hyX hxy c hcx hcy hca + let _ := Fintype.ofFinite V + subst c + by_cases hxC : Sum.inl x ∈ C + · have hxu : x = u := unique_alpha hxC hcx + subst x + by_cases hyC : Sum.inl y ∈ C + · have hyu : y = u := unique_alpha hyC hcy + exact hxy hyu.symm + · have hy_new : alpha ∈ MissingColors G phi' y := by + rw [outside_fixed y hyC] + exact hcy + exact (Finset.disjoint_left.mp + (helementary hvX hyX (by + intro hvy + subst y + exact hyC hvC))) hv_alpha_new hy_new + · have hx_new : alpha ∈ MissingColors G phi' x := by + rw [outside_fixed x hxC] + exact hcx + by_cases hyC : Sum.inl y ∈ C + · have hyu : y = u := unique_alpha hyC hcy + subst y + exact (Finset.disjoint_left.mp + (helementary hxX hvX (by + intro hxv + subst x + exact hxC hvC))) hx_new hv_alpha_new + · have hy_new : alpha ∈ MissingColors G phi' y := by + rw [outside_fixed y hyC] + exact hcy + exact (Finset.disjoint_left.mp (helementary hxX hyX hxy)) hx_new hy_new + +private theorem TwoColorComponentSwapNonElementary_branch_248.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (z : V ⊕ E) (X : Finset V) (u v : V), + u ∈ X → Sum.inl u ∈ TwoColorComponent G phi alpha beta z → + let C := TwoColorComponent G phi alpha beta z; + let phi' := TwoColorComponentSwap G phi alpha beta z; ( + ∀ {w : V}, Sum.inl w ∈ C → beta ∈ MissingColors G phi w → w = v) → ( + ∀ (v : V), Sum.inl v ∉ TwoColorComponent G phi alpha beta z → MissingColors G + (TwoColorComponentSwap G phi alpha beta z) v = MissingColors G phi v) → ( + ∀ (v : V) (c : Fin k), c ≠ alpha → c ≠ beta → (c ∈ MissingColors G (TwoColorComponentSwap G + phi alpha beta z) v ↔ c ∈ MissingColors G phi v)) → beta ∈ MissingColors G phi' u → ( + ∀ {u : V}, u ∈ X → + ∀ {v : V}, v ∈ X → u ≠ v → Disjoint (MissingColors G (TwoColorComponentSwap G phi alpha beta + z) u) (MissingColors G (TwoColorComponentSwap G phi alpha beta z) v)) → + ∀ x ∈ X, + ∀ y ∈ X, x ≠ y → + ∀ c ∈ MissingColors G phi x, c ∈ MissingColors G phi y → ¬c = alpha → False := by + classical + intro V E _ _ G k phi alpha beta z X u v huX huC C phi' unique_beta outside_fixed unaffected + hu_beta_new helementary x hxX y hyX hxy c hcx hcy hca + let _ := Fintype.ofFinite V + by_cases hcb : c = beta + · subst c + by_cases hxC : Sum.inl x ∈ C + · have hxv : x = v := unique_beta hxC hcx + subst x + by_cases hyC : Sum.inl y ∈ C + · have hyv : y = v := unique_beta hyC hcy + exact hxy hyv.symm + · have hy_new : beta ∈ MissingColors G phi' y := by + rw [outside_fixed y hyC] + exact hcy + exact (Finset.disjoint_left.mp + (helementary huX hyX (by + intro huy + subst y + exact hyC huC))) hu_beta_new hy_new + · have hx_new : beta ∈ MissingColors G phi' x := by + rw [outside_fixed x hxC] + exact hcx + by_cases hyC : Sum.inl y ∈ C + · have hyv : y = v := unique_beta hyC hcy + subst y + exact (Finset.disjoint_left.mp + (helementary hxX huX (by + intro hxu + subst x + exact hxC huC))) hx_new hu_beta_new + · have hy_new : beta ∈ MissingColors G phi' y := by + rw [outside_fixed y hyC] + exact hcy + exact (Finset.disjoint_left.mp (helementary hxX hyX hxy)) hx_new hy_new + · have hcx_new : c ∈ MissingColors G phi' x := + (unaffected x c hca hcb).mpr hcx + have hcy_new : c ∈ MissingColors G phi' y := + (unaffected y c hca hcb).mpr hcy + exact (Finset.disjoint_left.mp (helementary hxX hyX hxy)) hcx_new hcy_new + +theorem TwoColorComponentSwapNonElementary {V E : Type*} + [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hproper : IsProperEdgeColoring G phi) (z : Sum V E) + (X : Finset V) (u v : V) (huX : u ∈ X) (hvX : v ∈ X) + (huv : u ≠ v) + (huC : Sum.inl u ∈ TwoColorComponent G phi alpha beta z) + (hvC : Sum.inl v ∈ TwoColorComponent G phi alpha beta z) + (hua : alpha ∈ MissingColors G phi u) + (hvb : beta ∈ MissingColors G phi v) + (hnot : ¬ ColoredVertexSetElementary G phi X) : + ¬ColoredVertexSetElementary G (TwoColorComponentSwap G phi alpha beta z) X := by + classical + let _ := Fintype.ofFinite V + let H := TwoColorIncidenceGraph G phi alpha beta + let C := TwoColorComponent G phi alpha beta z + let phi' := TwoColorComponentSwap G phi alpha beta z + obtain ⟨a, b, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G phi alpha beta hproper z + have support_of_component {w : V} (hwC : Sum.inl w ∈ C) : + Sum.inl w ∈ p.support := by + change Sum.inl w ∈ {x | x ∈ p.support} + rw [hsupport] + exact hwC + have hpu : Sum.inl u ∈ p.support := support_of_component huC + have hpv : Sum.inl v ∈ p.support := support_of_component hvC + have endpoint_of_missing_alpha {w : V} (hwC : Sum.inl w ∈ C) + (hw : alpha ∈ MissingColors G phi w) : Sum.inl w = a ∨ Sum.inl w = b := by + have hdegree : @SimpleGraph.degree _ H (Sum.inl w) (Fintype.ofFinite _) ≤ 1 := by + simpa [H] using + MissingColorIncidenceEndpoint G phi alpha beta hne hproper w hw + have hleaf : (H.neighborSet (Sum.inl w)).Subsingleton := by + let : Fintype (H.neighborSet (Sum.inl w)) := Fintype.ofFinite _ + intro x hx y hy + have hcard : Fintype.card (H.neighborSet (Sum.inl w)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hdegree + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hcard ⟨x, hx⟩ ⟨y, hy⟩) + by_contra hend + push Not at hend + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hend.1 hend.2 hleaf) (support_of_component hwC) + have endpoint_of_missing_beta {w : V} (hwC : Sum.inl w ∈ C) + (hw : beta ∈ MissingColors G phi w) : Sum.inl w = a ∨ Sum.inl w = b := by + have hgraph : TwoColorIncidenceGraph G phi beta alpha = H := by + ext x y + cases x <;> cases y <;> simp [H, TwoColorIncidenceGraph, or_comm] + have hdegree : @SimpleGraph.degree _ H (Sum.inl w) (Fintype.ofFinite _) ≤ 1 := by + rw [← hgraph] + exact MissingColorIncidenceEndpoint G phi beta alpha hne.symm hproper w hw + have hleaf : (H.neighborSet (Sum.inl w)).Subsingleton := by + let : Fintype (H.neighborSet (Sum.inl w)) := Fintype.ofFinite _ + intro x hx y hy + have hcard : Fintype.card (H.neighborSet (Sum.inl w)) ≤ 1 := by + rw [SimpleGraph.card_neighborSet_eq_degree] + exact hdegree + exact congrArg Subtype.val + (Fintype.card_le_one_iff.mp hcard ⟨x, hx⟩ ⟨y, hy⟩) + by_contra hend + push Not at hend + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hend.1 hend.2 hleaf) (support_of_component hwC) + have hu_end : Sum.inl u = a ∨ Sum.inl u = b := + endpoint_of_missing_alpha huC hua + have hv_end : Sum.inl v = a ∨ Sum.inl v = b := + endpoint_of_missing_beta hvC hvb + have hab : a ≠ b := by + intro hab + rcases hu_end with hua' | hub' + · rcases hv_end with hva' | hvb' + · exact huv (Sum.inl.inj (hua'.trans hva'.symm)) + · exact huv (Sum.inl.inj (hua'.trans (hab.trans hvb'.symm))) + · rcases hv_end with hva' | hvb' + · exact huv (Sum.inl.inj (hub'.trans (hab.symm.trans hva'.symm))) + · exact huv (Sum.inl.inj (hub'.trans hvb'.symm)) + have hp_nontrivial : ¬ p.Nil := SimpleGraph.Walk.not_nil_of_ne hab + have affected_edge_of_endpoint {w : V} + (hw : Sum.inl w = a ∨ Sum.inl w = b) : + ∃ e : E, Incident G w e ∧ (phi e = some alpha ∨ phi e = some beta) := by + rcases hw with hwa | hwb + · have hadj := p.adj_snd hp_nontrivial + have hadj' : H.Adj (Sum.inl w) p.snd := by + simpa only [H, hwa] using hadj + cases hsnd : p.snd with + | inl x => + rw [hsnd] at hadj' + simp [H, TwoColorIncidenceGraph] at hadj' + | inr e => + rw [hsnd] at hadj' + refine ⟨e, ?_⟩ + simpa [H, TwoColorIncidenceGraph] using hadj' + · have hrev : ¬ p.reverse.Nil := by simpa using hp_nontrivial + have hadj := p.reverse.adj_snd hrev + have hadj' : H.Adj (Sum.inl w) p.reverse.snd := by + simpa only [H, hwb] using hadj + cases hsnd : p.reverse.snd with + | inl x => + rw [hsnd] at hadj' + simp [H, TwoColorIncidenceGraph] at hadj' + | inr e => + rw [hsnd] at hadj' + refine ⟨e, ?_⟩ + simpa [H, TwoColorIncidenceGraph] using hadj' + obtain ⟨eu, heu_incident, heu_color⟩ := affected_edge_of_endpoint hu_end + obtain ⟨ev, hev_incident, hev_color⟩ := affected_edge_of_endpoint hv_end + have alpha_not_present_u : alpha ∉ PresentColors G phi u := by + simpa [MissingColors] using hua + have beta_not_present_v : beta ∉ PresentColors G phi v := by + simpa [MissingColors] using hvb + have heu_beta : phi eu = some beta := by + rcases heu_color with heu_alpha | heu_beta + · exact False.elim (alpha_not_present_u (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨eu, heu_incident, heu_alpha⟩)) + · exact heu_beta + have hev_alpha : phi ev = some alpha := by + rcases hev_color with hev_alpha | hev_beta + · exact hev_alpha + · exact False.elim (beta_not_present_v (by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨ev, hev_incident, hev_beta⟩)) + have beta_not_missing_u : beta ∉ MissingColors G phi u := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, not_not] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨eu, heu_incident, heu_beta⟩ + have alpha_not_missing_v : alpha ∉ MissingColors G phi v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, not_not] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨ev, hev_incident, hev_alpha⟩ + have endpoint_is_u_or_v {w : V} + (hw : Sum.inl w = a ∨ Sum.inl w = b) : w = u ∨ w = v := by + rcases hu_end with hua' | hub' + · rcases hv_end with hva' | hvb' + · exact False.elim (huv (Sum.inl.inj (hua'.trans hva'.symm))) + · rcases hw with hwa' | hwb' + · exact Or.inl (Sum.inl.inj (hwa'.trans hua'.symm)) + · exact Or.inr (Sum.inl.inj (hwb'.trans hvb'.symm)) + · rcases hv_end with hva' | hvb' + · rcases hw with hwa' | hwb' + · exact Or.inr (Sum.inl.inj (hwa'.trans hva'.symm)) + · exact Or.inl (Sum.inl.inj (hwb'.trans hub'.symm)) + · exact False.elim (huv (Sum.inl.inj (hub'.trans hvb'.symm))) + have unique_alpha {w : V} (hwC : Sum.inl w ∈ C) + (hw : alpha ∈ MissingColors G phi w) : w = u := by + rcases endpoint_is_u_or_v (endpoint_of_missing_alpha hwC hw) with rfl | rfl + · rfl + · exact False.elim (alpha_not_missing_v hw) + have unique_beta {w : V} (hwC : Sum.inl w ∈ C) + (hw : beta ∈ MissingColors G phi w) : w = v := by + rcases endpoint_is_u_or_v (endpoint_of_missing_beta hwC hw) with rfl | rfl + · exact False.elim (beta_not_missing_u hw) + · rfl + have edge_of_vertex {w : V} {e : E} (hwC : Sum.inl w ∈ C) + (hwe : Incident G w e) + (hecolor : phi e = some alpha ∨ phi e = some beta) : Sum.inr e ∈ C := by + change H.connectedComponentMk (Sum.inl w) = H.connectedComponentMk z at hwC + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z + have hadj : H.Adj (Sum.inr e) (Sum.inl w) := by + simpa [H, TwoColorIncidenceGraph] using And.intro hwe hecolor + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hwC + have heuC : Sum.inr eu ∈ C := + edge_of_vertex huC heu_incident (Or.inr heu_beta) + have hevC : Sum.inr ev ∈ C := + edge_of_vertex hvC hev_incident (Or.inl hev_alpha) + have heu_new : phi' eu = some alpha := by + simp [phi', TwoColorComponentSwap, C, heuC, heu_beta] + have hev_new : phi' ev = some beta := by + simp [phi', TwoColorComponentSwap, C, hevC, hev_alpha] + have alpha_not_missing_new_u : alpha ∉ MissingColors G phi' u := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, not_not] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨eu, heu_incident, heu_new⟩ + have beta_not_missing_new_v : beta ∉ MissingColors G phi' v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, not_not] + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨ev, hev_incident, hev_new⟩ + obtain ⟨outside_fixed, alpha_to_beta, beta_to_alpha, unaffected⟩ := + TwoColorComponentSwapMissingBehavior G phi alpha beta hne hproper z + have hu_beta_new : beta ∈ MissingColors G phi' u := alpha_to_beta u huC hua + have hv_alpha_new : alpha ∈ MissingColors G phi' v := beta_to_alpha v hvC hvb + intro helementary + rw [ColoredVertexSetElementary] at hnot helementary + push Not at hnot + obtain ⟨x, hxX, y, hyX, hxy, hxy_not_disjoint⟩ := hnot + rw [Finset.not_disjoint_iff] at hxy_not_disjoint + obtain ⟨c, hcx, hcy⟩ := hxy_not_disjoint + by_cases hca : c = alpha + · exact @TwoColorComponentSwapNonElementary_branch_218 V E inferInstance inferInstance G k phi + alpha beta z X u v hvX hvC unique_alpha outside_fixed hv_alpha_new helementary x hxX y hyX + hxy c hcx hcy hca + · exact @TwoColorComponentSwapNonElementary_branch_248 V E inferInstance inferInstance G k phi + alpha beta z X u v huX huC unique_beta outside_fixed unaffected hu_beta_new helementary x + hxX y hyX hxy c hcx hcy hca +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapPreservesDisjointComponent.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapPreservesDisjointComponent.lean new file mode 100644 index 0000000000..488143ace4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapPreservesDisjointComponent.lean @@ -0,0 +1,143 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Two Color Component Swap Preserves Disjoint Component + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TwoColorComponentSwapPreservesDisjointComponent {V E : Type*} + (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta gamma delta : Fin k) + (z x : Sum V E) + (hactive : ∀ e : E, + Sum.inr e ∈ TwoColorComponent G phi gamma delta z → + phi e = some gamma ∨ phi e = some delta) + (hdisjoint : Disjoint (TwoColorComponent G phi alpha beta x) + (TwoColorComponent G phi gamma delta z)) : + TwoColorComponent G (TwoColorComponentSwap G phi gamma delta z) alpha beta x = + TwoColorComponent G phi alpha beta x := by + classical + let H := TwoColorIncidenceGraph G phi alpha beta + let Hstar := TwoColorIncidenceGraph G + (TwoColorComponentSwap G phi gamma delta z) alpha beta + let C := TwoColorComponent G phi alpha beta x + let K := TwoColorComponent G phi gamma delta z + have old_neighbor {a b : Sum V E} (ha : a ∈ C) (hab : H.Adj a b) : b ∈ C := by + let component := H.connectedComponentMk x + exact (component.mem_supp_congr_adj hab).mp ha + have forward_step {a b : Sum V E} (ha : a ∈ C) (hab : H.Adj a b) : + b ∈ C ∧ Hstar.Adj a b := by + have hb := old_neighbor ha hab + refine ⟨hb, ?_⟩ + cases a with + | inl v => + cases b with + | inl w => simp [H, TwoColorIncidenceGraph] at hab + | inr e => + have heNotK : Sum.inr e ∉ K := by + intro heK + exact Set.disjoint_left.mp hdisjoint hb heK + simpa [H, Hstar, TwoColorIncidenceGraph, TwoColorComponentSwap, + K, heNotK] using hab + | inr e => + cases b with + | inl v => + have heNotK : Sum.inr e ∉ K := by + intro heK + exact Set.disjoint_left.mp hdisjoint ha heK + simpa [H, Hstar, TwoColorIncidenceGraph, TwoColorComponentSwap, + K, heNotK] using hab + | inr f => simp [H, TwoColorIncidenceGraph] at hab + have reverse_step {a b : Sum V E} (ha : a ∈ C) (hab : Hstar.Adj a b) : + b ∈ C ∧ H.Adj a b := by + cases a with + | inl v => + cases b with + | inl w => simp [Hstar, TwoColorIncidenceGraph] at hab + | inr e => + have heNotK : Sum.inr e ∉ K := by + intro heK + have heColor := hactive e (by simpa [K] using heK) + have hvK : Sum.inl v ∈ K := by + change (TwoColorIncidenceGraph G phi gamma delta).connectedComponentMk + (Sum.inl v) = + (TwoColorIncidenceGraph G phi gamma delta).connectedComponentMk z + have hedge : (TwoColorIncidenceGraph G phi gamma delta).Adj + (Sum.inl v) (Sum.inr e) := by + have hinc : Incident G v e := by + simpa [Hstar, TwoColorIncidenceGraph] using hab.1 + simpa [TwoColorIncidenceGraph] using ⟨hinc, heColor⟩ + have heComponent : + (TwoColorIncidenceGraph G phi gamma delta).connectedComponentMk + (Sum.inr e) = + (TwoColorIncidenceGraph G phi gamma delta).connectedComponentMk z := + heK + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hedge).trans heComponent + exact Set.disjoint_left.mp hdisjoint ha hvK + have hold : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, Hstar, TwoColorIncidenceGraph, TwoColorComponentSwap, + K, heNotK] using hab + exact ⟨old_neighbor ha hold, hold⟩ + | inr e => + cases b with + | inl v => + have heNotK : Sum.inr e ∉ K := by + intro heK + exact Set.disjoint_left.mp hdisjoint ha heK + have hold : H.Adj (Sum.inr e) (Sum.inl v) := by + simpa [H, Hstar, TwoColorIncidenceGraph, TwoColorComponentSwap, + K, heNotK] using hab + exact ⟨old_neighbor ha hold, hold⟩ + | inr f => simp [Hstar, TwoColorIncidenceGraph] at hab + have forward_walk {a b : Sum V E} (ha : a ∈ C) (p : H.Walk a b) : + b ∈ C ∧ Nonempty (Hstar.Walk a b) := by + induction p with + | nil => exact ⟨ha, ⟨SimpleGraph.Walk.nil⟩⟩ + | @cons u v w huv p ih => + obtain ⟨hv, huvStar⟩ := forward_step ha huv + obtain ⟨hw, ⟨pStar⟩⟩ := ih hv + exact ⟨hw, ⟨SimpleGraph.Walk.cons huvStar pStar⟩⟩ + have reverse_walk {a b : Sum V E} (ha : a ∈ C) (p : Hstar.Walk a b) : + b ∈ C ∧ Nonempty (H.Walk a b) := by + induction p with + | nil => exact ⟨ha, ⟨SimpleGraph.Walk.nil⟩⟩ + | @cons u v w huv p ih => + obtain ⟨hv, huvOld⟩ := reverse_step ha huv + obtain ⟨hw, ⟨pOld⟩⟩ := ih hv + exact ⟨hw, ⟨SimpleGraph.Walk.cons huvOld pOld⟩⟩ + ext y + constructor + · intro hy + change Hstar.connectedComponentMk y = Hstar.connectedComponentMk x at hy + have p : Hstar.Reachable x y := + SimpleGraph.ConnectedComponent.exact hy.symm + obtain ⟨hyC, -⟩ := reverse_walk (a := x) (b := y) (by rfl) p.some + exact hyC + · intro hy + change y ∈ C at hy + change Hstar.connectedComponentMk y = Hstar.connectedComponentMk x + have p : H.Reachable x y := by + exact SimpleGraph.ConnectedComponent.exact hy.symm + obtain ⟨-, hp⟩ := forward_walk (a := x) (b := y) (by rfl) p.some + exact (SimpleGraph.ConnectedComponent.sound hp).symm + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapProper.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapProper.lean new file mode 100644 index 0000000000..b5ea61ba68 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapProper.lean @@ -0,0 +1,106 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Two Color Component Swap Proper + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TwoColorComponentSwapProper {V E : Type*} + (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) + (alpha beta : Fin k) (hne : alpha ≠ beta) + (hproper : IsProperEdgeColoring G phi) (z : Sum V E) : + IsProperEdgeColoring G (TwoColorComponentSwap G phi alpha beta z) := by + classical + let changeColor : Option (Fin k) → Option (Fin k) := fun value => + if value = some alpha then some beta + else if value = some beta then some alpha else value + have changeColor_injective : Function.Injective changeColor := by + intro x y hxy + cases x <;> cases y <;> + simp_all [changeColor] <;> + aesop + have changeColor_cases : ∀ x y, changeColor x = y → + x = y ∨ (x = some alpha ∧ y = some beta) ∨ + (x = some beta ∧ y = some alpha) := by + intro x y hxy + by_cases h : x = y + · exact Or.inl h + · right + cases x <;> cases y <;> + simp_all [changeColor] <;> aesop + intro e f c hef hadj he hf + rcases hadj with ⟨v, hev, hfv⟩ + have component_transfer : + ∀ (e f : E) (v : V), Incident G v e → Incident G v f → (phi e = some alpha ∧ phi f = some + beta) ∨ (phi e = some beta ∧ phi f = some alpha) → Sum.inr e ∈ TwoColorComponent G phi + alpha beta z → Sum.inr f ∈ TwoColorComponent G phi alpha beta z := by + intro e f v hev hfv hcolors heK + let H := TwoColorIncidenceGraph G phi alpha beta + have p : H.Adj (Sum.inr e) (Sum.inl v) := by + rcases hcolors with ⟨hea, hfb⟩ | ⟨heb, hfa⟩ + · simp [H, TwoColorIncidenceGraph, hev, hea] + · simp [H, TwoColorIncidenceGraph, hev, heb] + have q : H.Adj (Sum.inl v) (Sum.inr f) := by + rcases hcolors with ⟨hea, hfb⟩ | ⟨heb, hfa⟩ + · simp [H, TwoColorIncidenceGraph, hfv, hfb] + · simp [H, TwoColorIncidenceGraph, hfv, hfa] + have hp := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj p + have hq := SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj q + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z at heK + change H.connectedComponentMk (Sum.inr f) = H.connectedComponentMk z + exact hq.symm.trans (hp.symm.trans heK) + by_cases heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z + · by_cases hfK : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · have hs : changeColor (phi e) = changeColor (phi f) := by + simpa [TwoColorComponentSwap, changeColor, heK, hfK] using he.trans hf.symm + have ho := changeColor_injective hs + cases pe : phi e with + | none => simp [TwoColorComponentSwap, pe, heK] at he + | some d => + have pf : phi f = some d := ho.symm.trans pe + exact (hproper hef ⟨v, hev, hfv⟩ pe) pf + · have hs : changeColor (phi e) = phi f := by + simpa [TwoColorComponentSwap, changeColor, heK, hfK] using he.trans hf.symm + rcases changeColor_cases (phi e) (phi f) hs with hsame | ⟨hea, hfb⟩ | ⟨heb, hfa⟩ + · have hfix : changeColor (phi e) = phi e := by simpa [hsame] using hs + have he0 : changeColor (phi e) = some c := by + simpa [TwoColorComponentSwap, changeColor, heK] using he + have he1 : phi e = some c := hfix.symm.trans he0 + exact (hproper hef ⟨v, hev, hfv⟩ he1) (by simpa [hsame] using he1) + · exact hfK (component_transfer e f v hev hfv (Or.inl ⟨hea, hfb⟩) heK) + · exact hfK (component_transfer e f v hev hfv (Or.inr ⟨heb, hfa⟩) heK) + · by_cases hfK : Sum.inr f ∈ TwoColorComponent G phi alpha beta z + · have hs : phi e = changeColor (phi f) := by + simpa [TwoColorComponentSwap, changeColor, heK, hfK] using he.trans hf.symm + rcases changeColor_cases (phi f) (phi e) hs.symm with hsame | ⟨hfa, heb⟩ | ⟨hfb, hea⟩ + · have hfix : changeColor (phi f) = phi f := by simpa [hsame] using hs.symm + have hf0 : changeColor (phi f) = some c := by + simpa [TwoColorComponentSwap, changeColor, hfK] using hf + have hf1 : phi f = some c := hfix.symm.trans hf0 + exact (hproper hef ⟨v, hev, hfv⟩ (by simpa [hsame] using hf1)) hf1 + · exact heK (component_transfer f e v hfv hev (Or.inl ⟨hfa, heb⟩) hfK) + · exact heK (component_transfer f e v hfv hev (Or.inr ⟨hfb, hea⟩) hfK) + · have he0 : phi e = some c := by simpa [TwoColorComponentSwap, heK] using he + have hf0 : phi f = some c := by simpa [TwoColorComponentSwap, hfK] using hf + exact (hproper hef ⟨v, hev, hfv⟩ he0) hf0 + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentTashkinovSplice.lean b/LeanPool/GoldbergSeymour/TwoColorComponentTashkinovSplice.lean new file mode 100644 index 0000000000..c7d969bd64 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentTashkinovSplice.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.TashkinovAlternatingSegmentAppend +public import LeanPool.GoldbergSeymour.TwoColorComponentNearestSegment + +/-! +# Two Color Component Tashkinov Splice + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +theorem TwoColorComponentTashkinovSplice + {V E : Type*} + [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : Nat} {e0 : E} + (phi : PartialEdgeColoring E k) (S : TreeSequence G e0) + (alpha beta : Fin k) (y : V) + (hproper : IsProperEdgeColoring G phi) + (hne : alpha ≠ beta) + (halpha : alpha ∈ TreeMissingColors phi S) + (hbeta : beta ∈ TreeMissingColors phi S) + (hy : y ∉ TreeSequenceVertexSet S) + (hmeets : ∃ u ∈ TreeSequenceVertexSet S, + Sum.inl u ∈ TwoColorComponent G phi alpha beta (Sum.inl y)) : + ∃ (u : V) (S' : TreeSequence G e0), + u ∈ TreeSequenceVertexSet S /\ + Sum.inl u ∈ + TwoColorComponent G phi alpha beta (Sum.inl y) /\ + TreeSequenceInitialSegment S S' /\ + S.length < S'.length /\ + TashkinovAugmentationSequence phi S S' /\ + S'.vertex (Fin.last S'.length) = y /\ + ∀ r : Fin S'.length, S.length ≤ r.val → + S'.vertex r.succ ∉ TreeSequenceVertexSet S /\ + Sum.inr (S'.edge r) ∈ + TwoColorComponent G phi alpha beta (Sum.inl y) /\ + Sum.inl (S'.vertex r.succ) ∈ + TwoColorComponent G phi alpha beta (Sum.inl y) /\ + (phi (S'.edge r) = some alpha ∨ + phi (S'.edge r) = some beta) /\ + G.ends (S'.edge r) = + if r.val = S.length then + s(u, S'.vertex r.succ) + else + s(S'.vertex r.castSucc, S'.vertex r.succ) := by + classical + let _ := Fintype.ofFinite V + obtain ⟨m, hm, pathVertex, pathEdge, hvertexInjective, + hedgeInjective, hstart, hlast, houtside, hvertexComponent, + hedgeComponent, hcolors, hends, hedgeFresh⟩ := + TwoColorComponentNearestSegment G phi S alpha beta y hproper hne hy hmeets + obtain ⟨S', hSS', _hlengthEq, _hsegmentEntries, hlength, haugment, + hlastVertex, hnew⟩ := + TashkinovAlternatingSegmentAppend G phi S alpha beta y m hm + pathVertex pathEdge hvertexInjective hedgeInjective hstart houtside + hvertexComponent hedgeComponent hcolors hends hedgeFresh halpha hbeta + refine ⟨pathVertex 0, S', hstart, hvertexComponent 0, hSS', hlength, + haugment, ?_, hnew⟩ + rw [hlastVertex, hlast] + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentsDisjoint.lean b/LeanPool/GoldbergSeymour/TwoColorComponentsDisjoint.lean new file mode 100644 index 0000000000..7f18dd246d --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentsDisjoint.lean @@ -0,0 +1,38 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorComponent + +/-! +# Two Color Components Disjoint + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TwoColorComponentsDisjoint {V E : Type*} (G : LooplessMultigraph V E) + {k : ℕ} (phi : PartialEdgeColoring E k) (alpha beta : Fin k) + (z w : Sum V E) : + TwoColorComponent G phi alpha beta z = TwoColorComponent G phi alpha beta w ∨ + Disjoint (TwoColorComponent G phi alpha beta z) + (TwoColorComponent G phi alpha beta w) := by + classical + let H := TwoColorIncidenceGraph G phi alpha beta + by_cases h : H.connectedComponentMk z = H.connectedComponentMk w + · left + simp [TwoColorComponent, H, h] + · right + exact SimpleGraph.pairwise_disjoint_supp_connectedComponent H h + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorCycle.lean b/LeanPool/GoldbergSeymour/TwoColorCycle.lean new file mode 100644 index 0000000000..787aa5a0e5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorCycle.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Combinatorics.SimpleGraph.Paths +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Two Color Cycle + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A closed walk certified to be a simple cycle in the two-color incidence graph. -/ +structure TwoColorCycle {V E : Type*} (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) where + /-- The incidence-graph node at which the cycle starts and ends. -/ + base : Sum V E + /-- The closed two-color walk certified to be a simple cycle. -/ + walk : (TwoColorIncidenceGraph G phi alpha beta).Walk base base + isCycle : walk.IsCycle + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorIncidenceDegreeAtMostTwo.lean b/LeanPool/GoldbergSeymour/TwoColorIncidenceDegreeAtMostTwo.lean new file mode 100644 index 0000000000..bc1a66bff9 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorIncidenceDegreeAtMostTwo.lean @@ -0,0 +1,161 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Basic.Finite.Sum + +public import LeanPool.GoldbergSeymour.AdjacentEdges +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph + +/-! +# Two Color Incidence Degree At Most Two + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TwoColorIncidenceDegreeAtMostTwo {V E : Type*} + [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) + (alpha beta : Fin k) (hproper : IsProperEdgeColoring G phi) + (z : Sum V E) : + @SimpleGraph.degree _ (TwoColorIncidenceGraph G phi alpha beta) z (Fintype.ofFinite _) ≤ + 2 := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + rw [← SimpleGraph.card_neighborSet_eq_degree] + cases z with + | inl v => + let neighbors := {x : E // Sum.inr x ∈ (TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl v)} + let : Fintype neighbors := Fintype.ofFinite neighbors + let chooseColor : neighbors → Fin 2 := fun x => + if phi x.1 = some alpha then 0 else 1 + have chooseColor_injective : Function.Injective chooseColor := by + intro x y hxy + apply Subtype.ext + by_contra hne + have hx := x.2 + have hy := y.2 + have hxraw := x.2 + have hyraw := y.2 + simp only [TwoColorIncidenceGraph, SimpleGraph.mem_neighborSet] at hx hy + rcases hx with ⟨hxinc, hxcol⟩ + rcases hy with ⟨hyinc, hycol⟩ + by_cases hxa : phi x.1 = some alpha + · have hya : phi y.1 = some alpha := by simpa [chooseColor, hxa] using hxy + exact (hproper hne (⟨v, hxinc, hyinc⟩) hxa) hya + · have hxb : phi x.1 = some beta := hxcol.resolve_left hxa + have hyb : phi y.1 = some beta := hycol.resolve_left (by + intro hya + have hzero : chooseColor ⟨y.1, hyraw⟩ = 0 := by simp [chooseColor, hya] + have hone : chooseColor ⟨x.1, hxraw⟩ = 1 := by simp [chooseColor, hxa] + have : (1 : Fin 2) = 0 := hone.symm.trans (hxy.trans hzero) + exact Fin.zero_ne_one this.symm) + exact (hproper hne (⟨v, hxinc, hyinc⟩) hxb) hyb + have hc : Fintype.card neighbors ≤ Fintype.card (Fin 2) := + Fintype.card_le_of_injective chooseColor chooseColor_injective + have existsEdge (x : {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha + beta).neighborSet (Sum.inl v)}) : + ∃ e, x.1 = Sum.inr e := by + cases hx : x.1 with + | inl w => + have hp := x.2; rw [hx] at hp; simp [SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] at hp + | inr e => simp [] + let edgeOf (x : {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl v)}) : E := + Classical.choose (existsEdge x) + have edgeOf_spec (x : {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha + beta).neighborSet (Sum.inl v)}) : + x.1 = Sum.inr (edgeOf x) := Classical.choose_spec (existsEdge x) + have fullInjective : Function.Injective (fun x => chooseColor ⟨edgeOf x, by + rw [← edgeOf_spec x] at * + exact x.2⟩) := by + intro x y h + apply Subtype.ext + rw [edgeOf_spec x, edgeOf_spec y] + have hx := x.2 + have hy := y.2 + rw [edgeOf_spec x] at hx + rw [edgeOf_spec y] at hy + simp only [TwoColorIncidenceGraph, SimpleGraph.mem_neighborSet] at hx hy + by_cases heq : edgeOf x = edgeOf y + · exact congrArg Sum.inr heq + exfalso + by_cases ha : phi (edgeOf x) = some alpha + · have hb : phi (edgeOf y) = some alpha := by simpa [chooseColor, ha] using h + exact (hproper heq (⟨v, hx.1, hy.1⟩) ha) hb + · have hb : phi (edgeOf x) = some beta := by + exact hx.2.resolve_left ha + have hc : phi (edgeOf y) = some beta := by + have : ¬ phi (edgeOf y) = some alpha := by + intro hy + have : (0 : Fin 2) = 1 := by simpa [chooseColor, ha, hy] using h.symm + exact Fin.zero_ne_one this + exact hy.2.resolve_left this + exact (hproper heq (⟨v, hx.1, hy.1⟩) hb) hc + let : Fintype {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inl v)} := Fintype.ofFinite _ + have fullBound : Fintype.card {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha + beta).neighborSet (Sum.inl v)} ≤ 2 := by + simpa using Fintype.card_le_of_injective _ fullInjective + exact fullBound + | inr e => + let neighbors := {x : V // Sum.inl x ∈ (TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inr e)} + let endpoints := (G.ends e).toFinset + let : Fintype neighbors := Fintype.ofFinite neighbors + have map_injective : Function.Injective (fun x : neighbors => (⟨x.1, Sym2.mem_toFinset.mpr + x.2.1⟩ : endpoints)) := by + intro x y h + apply Subtype.ext + exact congrArg (fun q => q.1) h + have hc : Fintype.card neighbors ≤ Fintype.card endpoints := + Fintype.card_le_of_injective _ map_injective + have he : Fintype.card endpoints ≤ 2 := by + rw [Fintype.card_coe, Sym2.card_toFinset] + split <;> omega + have existsVertex (x : {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha + beta).neighborSet (Sum.inr e)}) : + ∃ v, x.1 = Sum.inl v := by + cases hx : x.1 with + | inl v => simp [] + | inr f => + have hp := x.2; rw [hx] at hp; simp [SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] at hp + let vertexOf (x : {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inr e)}) : V := + Classical.choose (existsVertex x) + have vertexOf_spec (x : {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha + beta).neighborSet (Sum.inr e)}) : + x.1 = Sum.inl (vertexOf x) := Classical.choose_spec (existsVertex x) + let : Fintype {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha beta).neighborSet + (Sum.inr e)} := Fintype.ofFinite _ + let map : {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha beta).neighborSet (Sum.inr + e)} → endpoints := fun x => ⟨vertexOf x, by + have hp := x.2 + rw [vertexOf_spec x] at hp + simp only [TwoColorIncidenceGraph, SimpleGraph.mem_neighborSet] at hp + exact Sym2.mem_toFinset.mpr hp.1⟩ + have fullBound : Fintype.card {x : Sum V E // x ∈ (TwoColorIncidenceGraph G phi alpha + beta).neighborSet (Sum.inr e)} ≤ Fintype.card endpoints := by + apply Fintype.card_le_of_injective map + intro x y h + apply Subtype.ext + rw [vertexOf_spec x, vertexOf_spec y] + exact congrArg Sum.inl (congrArg Subtype.val h) + exact fullBound.trans he + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorIncidenceGraph.lean b/LeanPool/GoldbergSeymour/TwoColorIncidenceGraph.lean new file mode 100644 index 0000000000..764a5e6336 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorIncidenceGraph.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected +public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.PartialEdgeColoring + +/-! +# Two Color Incidence Graph + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- The bipartite incidence graph on vertices and edges whose assigned color is one of the specified +pair. +-/ +def TwoColorIncidenceGraph {V E : Type*} (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) : SimpleGraph (Sum V E) + where + Adj x + y := + match x, y with + | Sum.inl v, Sum.inr e => Incident G v e ∧ (phi e = some alpha ∨ phi e = some beta) + | Sum.inr e, Sum.inl v => Incident G v e ∧ (phi e = some alpha ∨ phi e = some beta) + | _, _ => False + symm.symm := by + intro x y + cases x <;> cases y <;> simp_all + loopless.irrefl := by + intro x + cases x <;> simp + +/-- Read colors directly from incidence adjacency when constructing paths. -/ +theorem TwoColorIncidenceEdgeColors {V E : Type*} {G : LooplessMultigraph V E} {k : ℕ} + {phi : PartialEdgeColoring E k} {alpha beta : Fin k} {edge : E} {vertex : Sum V E} + (adjacent : (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inr edge) vertex) : + phi edge = some alpha ∨ phi edge = some beta := by + cases vertex with + | inl _ => exact adjacent.2 + | inr _ => exact False.elim adjacent + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorInterchangeableDistinctComponentCycle.lean b/LeanPool/GoldbergSeymour/TwoColorInterchangeableDistinctComponentCycle.lean new file mode 100644 index 0000000000..e94155a800 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorInterchangeableDistinctComponentCycle.lean @@ -0,0 +1,208 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring +public import LeanPool.GoldbergSeymour.TreeInterchangeable +public import LeanPool.GoldbergSeymour.TwoColorComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Two Color Interchangeable Distinct Component Cycle + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TwoColorInterchangeableDistinctComponentCycle {V E : Type*} + [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : ℕ} {e0 : E} + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (alpha beta : Fin k) (hproper : IsProperEdgeColoring G phi) + (z w : Sum V E) + (hzPath : TwoColorPathComponent G phi alpha beta z) + (hinterchangeable : TreeInterchangeable G T phi alpha beta) + (hzMeets : ∃ v ∈ TreeSequenceVertexSet T, + Sum.inl v ∈ TwoColorComponent G phi alpha beta z) + (hwMeets : ∃ v ∈ TreeSequenceVertexSet T, + Sum.inl v ∈ TwoColorComponent G phi alpha beta w) + (hdistinct : TwoColorComponent G phi alpha beta z ≠ + TwoColorComponent G phi alpha beta w) : + TwoColorComponentCycle G phi alpha beta w := by + classical + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + rcases hzPath with ⟨hab, hzpoint, hzpoint_mem⟩ + have no_singleton : ∀ x ∈ TwoColorComponent G phi alpha beta w, + ¬ Set.Subsingleton ((TwoColorIncidenceGraph G phi alpha beta).neighborSet x) := by + intro x hx hs + apply hdistinct + exact hinterchangeable z w + ⟨hab, hzpoint, hzpoint_mem⟩ + ⟨hab, x, hx, hs⟩ hzMeets hwMeets + obtain ⟨u, v, p, hp, hsupport⟩ := + TwoColorComponentSpanningPath G phi alpha beta hproper w + have p_nontrivial : ¬ p.Nil := by + intro hnil + have hucomp : u ∈ TwoColorComponent G phi alpha beta w := by + rw [← hsupport] + simp + let component := (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk w + apply no_singleton u hucomp + intro x hx y hy + have hxcomp : x ∈ TwoColorComponent G phi alpha beta w := by + exact (component.mem_supp_congr_adj hx).mp (by + exact hucomp) + have hycomp : y ∈ TwoColorComponent G phi alpha beta w := by + exact (component.mem_supp_congr_adj hy).mp (by + exact hucomp) + have hxpath : x ∈ p.support := by + change x ∈ {x | x ∈ p.support} + rw [hsupport] + exact hxcomp + have hypath : y ∈ p.support := by + change y ∈ {x | x ∈ p.support} + rw [hsupport] + exact hycomp + cases hnil + simp only [SimpleGraph.Walk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hxpath hypath + have hxu : x = u := hxpath + have hyu : y = u := hypath + exact hxu.trans hyu.symm + cases p with + | nil => exact False.elim (p_nontrivial (by simp)) + | cons h q => + have hpq : q.IsPath := by + apply SimpleGraph.Walk.IsPath.mk' + have hnodup := hp.support_nodup + exact List.Pairwise.of_cons hnodup + have ha_mem : u ∈ TwoColorComponent G phi alpha beta w := by + rw [← hsupport] + simp + have hnot_single : ¬ Set.Subsingleton + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet u) := + no_singleton u ha_mem + have exists_extra : ∃ a', + (TwoColorIncidenceGraph G phi alpha beta).Adj u a' ∧ + a' ≠ q.getVert 0 := by + by_contra hn + push Not at hn + apply hnot_single + intro x hx y hy + exact (hn x hx).trans (hn y hy).symm + obtain ⟨a', ha'a, ha'a'⟩ := exists_extra + have ha'comp : a' ∈ TwoColorComponent G phi alpha beta w := by + let component := (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk w + exact (component.mem_supp_congr_adj ha'a).mp (by + exact ha_mem) + have ha'path : a' ∈ (SimpleGraph.Walk.cons h q).support := by + change a' ∈ {x | x ∈ (SimpleGraph.Walk.cons h q).support} + rw [hsupport] + exact ha'comp + obtain ⟨i, hi_eq', hi_le⟩ := SimpleGraph.Walk.mem_support_iff_exists_getVert.mp ha'path + have hi_not_zero : i ≠ 0 := by + intro hi0 + have : a' = u := by simpa [hi0] using hi_eq'.symm + exact False.elim (ha'a.ne this.symm) + by_cases hi_end : i = (SimpleGraph.Walk.cons h q).length + · have hav : a' = v := by simpa [hi_end] using hi_eq'.symm + have hclose : (TwoColorIncidenceGraph G phi alpha beta).Adj v u := by + rw [← hi_eq', hi_end] at ha'a + simpa using ha'a.symm + refine ⟨⟨v, SimpleGraph.Walk.cons hclose (SimpleGraph.Walk.cons h q), ?_⟩, ?_⟩ + · apply (SimpleGraph.Walk.cons_isCycle_iff _ hclose).mpr + constructor + · exact hp + · intro he + have he' : s(u, v) ∈ (SimpleGraph.Walk.cons h q).edges := by + have hsuv : s(v, u) = s(u, v) := by simp + rw [← hsuv] + exact he + have hvfirst := hp.eq_snd_of_mem_edges he' + exact ha'a' (hav.trans (by simpa [hi_end] using hvfirst)) + · intro x + rw [← hsupport] + simp only [SimpleGraph.Walk.support_cons, List.mem_cons, Set.mem_ofPred_eq, + or_iff_right_iff_imp] + intro hx + subst x + exact Or.inr (by simp) + · have hi_lt : i < (SimpleGraph.Walk.cons h q).length := + Nat.lt_of_le_of_ne hi_le hi_end + have hleft : (TwoColorIncidenceGraph G phi alpha beta).Adj + ((SimpleGraph.Walk.cons h q).getVert i) + ((SimpleGraph.Walk.cons h q).getVert (i - 1)) := by + have hh := (SimpleGraph.Walk.cons h q).adj_getVert_succ (i := i - 1) (by omega) + simpa only [Nat.sub_add_cancel (Nat.one_le_iff_ne_zero.mpr hi_not_zero)] using hh.symm + have hright : (TwoColorIncidenceGraph G phi alpha beta).Adj + ((SimpleGraph.Walk.cons h q).getVert i) + ((SimpleGraph.Walk.cons h q).getVert (i + 1)) := + (SimpleGraph.Walk.cons h q).adj_getVert_succ hi_lt + rw [hi_eq'] at hleft hright + have hne_left : u ≠ (SimpleGraph.Walk.cons h q).getVert (i - 1) := by + intro he + have he' : (SimpleGraph.Walk.cons h q).getVert 0 = + (SimpleGraph.Walk.cons h q).getVert (i - 1) := + (by simpa using he) + have hinj := hp.getVert_injOn (by simp) (Nat.le_trans (Nat.sub_le _ _) hi_le) he' + have hi1 : i = 1 := by omega + exact ha'a' (by simpa [hi1] using hi_eq'.symm) + have hne_right : u ≠ (SimpleGraph.Walk.cons h q).getVert (i + 1) := by + intro he + have he' : (SimpleGraph.Walk.cons h q).getVert 0 = + (SimpleGraph.Walk.cons h q).getVert (i + 1) := + (by simpa using he) + have hinj := hp.getVert_injOn (by simp) (Nat.succ_le_iff.mpr hi_lt) he' + exact hi_not_zero (by omega) + have hne_lr : + (SimpleGraph.Walk.cons h q).getVert (i - 1) ≠ + (SimpleGraph.Walk.cons h q).getVert (i + 1) := by + intro he + have hinj := hp.getVert_injOn + (Nat.le_trans (Nat.sub_le _ _) hi_le) (Nat.succ_le_iff.mpr hi_lt) he + exact (Nat.ne_of_lt (by omega)) hinj + let : Fintype ((TwoColorIncidenceGraph G phi alpha beta).neighborSet a') := + Fintype.ofFinite _ + have hthree : 3 ≤ Fintype.card + ((TwoColorIncidenceGraph G phi alpha beta).neighborSet a') := by + rw [SimpleGraph.card_neighborSet_eq_degree + (TwoColorIncidenceGraph G phi alpha beta) a'] + let s : Finset (Sum V E) := + {u, (SimpleGraph.Walk.cons h q).getVert (i - 1), + (SimpleGraph.Walk.cons h q).getVert (i + 1)} + have hs : s ⊆ (TwoColorIncidenceGraph G phi alpha beta).neighborFinset a' := by + intro x hx + simp only [s, Finset.mem_insert, Finset.mem_singleton] at hx + rcases hx with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using ha'a.symm + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc : 3 ≤ s.card := by + have hnl := hne_left + have hnr := hne_right + have hnlr := hne_lr + simp at hnl hnr hnlr + simp [s, hnl, hnr, hnlr] + exact le_trans hc (Finset.card_le_card hs) + have hdegree : @SimpleGraph.degree _ + (TwoColorIncidenceGraph G phi alpha beta) a' + (Fintype.ofFinite _) ≤ 2 := by + simpa using TwoColorIncidenceDegreeAtMostTwo G phi alpha beta hproper a' + rw [SimpleGraph.card_neighborSet_eq_degree + (TwoColorIncidenceGraph G phi alpha beta) a'] at hthree + omega + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorNontrivialPathComponent.lean b/LeanPool/GoldbergSeymour/TwoColorNontrivialPathComponent.lean new file mode 100644 index 0000000000..c2b760312a --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorNontrivialPathComponent.lean @@ -0,0 +1,30 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Two Color Nontrivial Path Component + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A two-color path component containing at least one edge node. -/ +def TwoColorNontrivialPathComponent {V E : Type*} (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (z : Sum V E) : Prop := + TwoColorPathComponent G phi alpha beta z ∧ + ∃ f : E, Sum.inr f ∈ TwoColorComponent G phi alpha beta z + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorPathComponent.lean b/LeanPool/GoldbergSeymour/TwoColorPathComponent.lean new file mode 100644 index 0000000000..ff74299669 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorPathComponent.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorComponent + +/-! +# Two Color Path Component + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Distinct colors with a component containing a node of degree at most one. -/ +def TwoColorPathComponent {V E : Type*} (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (z : Sum V E) : Prop := + alpha ≠ beta ∧ + ∃ x ∈ TwoColorComponent G phi alpha beta z, + Set.Subsingleton ((TwoColorIncidenceGraph G phi alpha beta).neighborSet x) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorPathComponentNotCycle.lean b/LeanPool/GoldbergSeymour/TwoColorPathComponentNotCycle.lean new file mode 100644 index 0000000000..e4015657c0 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorPathComponentNotCycle.lean @@ -0,0 +1,42 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Two Color Path Component Not Cycle + +Part of the dependency closure of the Goldberg–Seymour edge-colouring theorem. +Adapted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; module paths and namespace changed. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +theorem TwoColorPathComponentNotCycle {V E : Type*} + (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (z : Sum V E) + (hpath : TwoColorPathComponent G phi alpha beta z) : + ¬TwoColorComponentCycle G phi alpha beta z := by + classical + rintro ⟨cycle, hcycle⟩ + obtain ⟨_, x, hxComponent, hxLeaf⟩ := hpath + have hxSupport : x ∈ cycle.walk.support := (hcycle x).2 hxComponent + let rotated := cycle.walk.rotate x hxSupport + have hrotated : rotated.IsCycle := cycle.isCycle.rotate hxSupport + have hfirst : (TwoColorIncidenceGraph G phi alpha beta).Adj x rotated.snd := + rotated.adj_snd hrotated.not_nil + have hlast : (TwoColorIncidenceGraph G phi alpha beta).Adj x rotated.penultimate := + (rotated.adj_penultimate hrotated.not_nil).symm + exact hrotated.snd_ne_penultimate (hxLeaf hfirst hlast) + +end GoldbergSeymour + +end diff --git a/LeanPool/projects/goldberg-seymour.yaml b/LeanPool/projects/goldberg-seymour.yaml new file mode 100644 index 0000000000..6e6c8f5dd6 --- /dev/null +++ b/LeanPool/projects/goldberg-seymour.yaml @@ -0,0 +1,53 @@ +slug: goldberg-seymour +title: The Goldberg–Seymour edge-coloring theorem +summary: >- + Proves the Goldberg–Seymour bound for every finite loopless multigraph, + with distinct identities for parallel edges: the chromatic index is at most + the maximum of the maximum degree plus one and the ceiling of the odd-set + density. Preserves proper partial edge colorings, Kempe components, + critical subgraphs, Tashkinov trees, extension sequences, and good hierarchies. + The import contains the dependency closure of the full theorem; it does not + claim an executable edge-coloring algorithm or its polynomial running time. +branch: combinatorics +entry_module: LeanPool.GoldbergSeymour +authors: + - Wesley Pegden +source: + title: Proof of the Goldberg-Seymour Conjecture on Edge-Colorings of Multigraphs + authors: + - Guantao Chen + - Guangming Jing + - Wenan Zang + arxiv: 1901.10316v2 + url: https://github.com/wpegden/goldberg_seymour/tree/88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 + github_repo: wpegden/goldberg_seymour + commit: 88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 + completion_url: https://www.math.cmu.edu/~wes/trellis.php + completion_date: '2026-10-12' + formalization_system: Trellis +license: Apache-2.0 +status: verified +provenance: AI +main_declarations: + - GoldbergSeymour.goldbergSeymour + - GoldbergSeymour.GeneralHighIndexElementary +main_results: + - declaration: GoldbergSeymour.goldbergSeymour + informal: >- + Every finite loopless multigraph G has chromatic index at most + max(Delta(G) + 1, ceil(Gamma(G))), where Delta is the maximum vertex + degree and Gamma is the maximum of zero and 2|E(U)|/(|U| - 1) over + odd vertex sets U of size at least three. E(U) contains every edge + whose two endpoints lie in U, including parallel edges separately. + - declaration: GoldbergSeymour.GeneralHighIndexElementary + informal: >- + If a finite loopless multigraph has chromatic index at least its + maximum degree plus two, its chromatic index equals the ceiling + of its odd-set density. +tags: + - graph-theory + - edge-coloring + - multigraphs + - tashkinov-trees +msc: + - 05C15 From 4a7384d4a1695de7d4f4fb23fad3fd886a60bc00 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Thu, 5 Nov 2026 19:28:43 +0000 Subject: [PATCH 02/11] Prune unused Goldberg-Seymour interfaces and narrow dependencies --- .../AbsentOwnerReplacement.lean | 2 - LeanPool/GoldbergSeymour/AbsorbingVertex.lean | 2 - .../AlgorithmFiveFiveBaseStage.lean | 2 +- ...AlgorithmFiveFiveInitialGoodHierarchy.lean | 4 +- LeanPool/GoldbergSeymour/BaseControl.lean | 26 +--- .../GoldbergSeymour/BaseExtraReplacement.lean | 3 - .../GoldbergSeymour/Basic2TerminalSERE.lean | 8 +- .../GoldbergSeymour/BoundaryColorVertex.lean | 1 + LeanPool/GoldbergSeymour/BoundaryEdges.lean | 2 +- .../CertifiedETTRestriction.lean | 3 +- .../ChangeLemmaBothInside.lean | 8 +- .../ChangeLemmaBothOutside.lean | 50 ------- .../ChangeLemmaBothOutside/Preparation1.lean | 45 ------ .../ChangeLemmaBothOutside/Preparation3.lean | 2 +- .../ChangeLemmaBothOutside/Preparation4.lean | 2 +- .../ChangeLemmaBothOutside/Preparation5.lean | 2 +- .../ChangeLemmaBothOutside/Preparation6.lean | 5 +- .../ChangeLemmaMixedClosedFinal.lean | 6 +- .../ChangeLemmaMixedLargestClosed.lean | 5 +- .../ChangeLemmaMixedNoClosed.lean | 66 --------- .../ChangeLemmaMixedZeroNonclosed.lean | 70 ---------- .../ChromaticIndexRestrict.lean | 1 - .../GoldbergSeymour/ChromaticIndexSpec.lean | 1 - .../CombinedStableClosurePreserved.lean | 1 + ...mmonMissingColorsAtUncoloredEndpoints.lean | 4 +- .../CorrespondingExtendedTashkinovTree.lean | 4 +- .../GoldbergSeymour/CriticalCoreExists.lean | 6 +- .../CriticalGraphElementaryWitness.lean | 10 -- .../DefectiveColorComponentPath.lean | 18 --- LeanPool/GoldbergSeymour/DefectiveColors.lean | 3 +- LeanPool/GoldbergSeymour/DefectiveVertex.lean | 1 + LeanPool/GoldbergSeymour/DisplayedEdges.lean | 3 - ...lierPECycleFirstNonrevisitingInternal.lean | 5 - ...ntaryClosedExitPairDistinctComponents.lean | 4 - ...ElementaryClosedExitPairSameComponent.lean | 4 - ...edNoninterchangeableDisjointExitPaths.lean | 5 - ...ntaryClosedNoninterchangeableExitPair.lean | 1 + .../ElementaryEndpointExclusion.lean | 1 + .../EligibleIndexBoundPreparation.lean | 80 ----------- LeanPool/GoldbergSeymour/EligibleOddSet.lean | 4 +- .../EmptyCommonMissingLocation.lean | 2 - LeanPool/GoldbergSeymour/ExtensionBase.lean | 2 + .../ExtensionBaseAlgorithmA.lean | 5 +- .../ExtensionBaseAlgorithmAInduction.lean | 3 - .../ExtensionBaseAlgorithmB.lean | 4 - .../ExtensionBaseAlgorithmBInduction.lean | 2 - .../ExtensionBaseAlgorithmBSingleStep.lean | 3 - .../ExtensionBaseAlgorithmBTrace.lean | 1 - .../ExtensionBaseAlgorithmC.lean | 23 ---- .../ExtensionBaseAuxiliary.lean | 54 +------- .../ExtensionBaseBranchLemmas.lean | 17 ++- .../ExtensionBaseBranchPreparation.lean | 1 + .../ExtensionBaseCaseOneSelection.lean | 4 +- .../ExtensionBaseCaseTwoContradiction.lean | 9 +- .../ExtensionBaseCaseTwoObservation23.lean | 4 +- .../GoldbergSeymour/ExtensionBaseClaim43.lean | 1 - .../ExtensionBaseClaim43MissingColors.lean | 4 - .../GoldbergSeymour/ExtensionBaseClaim44.lean | 19 --- .../ExtensionBaseClaim45Singleton.lean | 5 - .../GoldbergSeymour/ExtensionBaseClaim46.lean | 22 --- ...tensionBaseClaimStrongInterchangeable.lean | 4 - .../ExtensionBasePreparations.lean | 8 +- .../ExtensionBaseStepLemmas.lean | 4 +- .../ExtensionBaseStoredPairOverlap.lean | 13 -- .../ExtensionBaseStrictDeltaExclusion.lean | 4 +- LeanPool/GoldbergSeymour/ExtensionRules.lean | 50 ------- .../ExtensionRulesEarlierIndices.lean | 4 - ...tensionRulesTerminalEarlierAppearance.lean | 25 ---- .../ExtensionRulesTerminalLastAppearance.lean | 7 - .../ExtensionRulesTerminalStoredDisjoint.lean | 32 ----- .../FiniteStrictGrowthReachesTerminal.lean | 5 +- .../GoldbergSeymour/FirstEntryClipping.lean | 2 - .../GeneralHighIndexElementary.lean | 4 - .../GoodHierarchyElementaryLarge.lean | 36 ----- .../GoodHierarchyPrefixConstruction.lean | 1 + .../GoodHierarchyPrefixPreparation.lean | 4 - .../GoodHierarchyPrefixRepackage.lean | 1 + ...oodHierarchySameDividerReconstruction.lean | 6 - .../GoodHierarchyTerminalPrefixRepackage.lean | 13 -- .../HierarchyCaseThreePreparation.lean | 61 -------- .../GoldbergSeymour/HierarchyClaimNine.lean | 31 ----- .../HierarchyClaimNineFirstUseAfterSeed.lean | 66 --------- .../HierarchyClaimNineFirstUseSeed.lean | 77 ----------- .../HierarchyClaimNinePENormalization.lean | 68 --------- .../HierarchyClaimNineUnusedTailColor.lean | 48 ------- .../HierarchyCounterexampleLess.lean | 9 +- ...eOneAdditionPositiveDividerImpossible.lean | 70 ---------- ...ampleOneAdditionZeroDividerImpossible.lean | 55 -------- ...hyCounterexamplePenultimateElementary.lean | 3 +- ...HierarchyEligibleCommonMissingIndices.lean | 1 + ...archyFirstMissingPositionPrefixCutoff.lean | 2 +- .../HierarchyFullTailPrefix.lean | 2 +- .../GoldbergSeymour/HierarchyLEMStable.lean | 24 ---- .../GoldbergSeymour/HierarchyMeasures.lean | 3 +- ...HierarchyMinimumCounterexampleContext.lean | 13 +- .../HierarchyNormalizationLemmas.lean | 71 ---------- .../HierarchyOrderedExitReduction.lean | 15 -- .../GoldbergSeymour/HierarchyPrefixData.lean | 5 +- ...rarchySituationOneAdvanceInsideStored.lean | 68 --------- ...archySituationOneAdvanceOutsideStored.lean | 70 ---------- .../HierarchySituationOneImpossible.lean | 1 + ...ySituationOnePenultimateCommonMissing.lean | 2 - ...hySituationOneShorteningContradiction.lean | 53 ------- ...rchySituationThreeClaimJMinusOneEmpty.lean | 66 --------- ...ySituationThreeClaimJMinusOneNonempty.lean | 73 ---------- .../HierarchySituationThreeColorChoice.lean | 15 -- ...nThreeComponentIntersectionShortening.lean | 52 ------- ...rchySituationThreeDisjointPreparation.lean | 63 --------- ...ionThreeDisjointThetaStoredImpossible.lean | 65 --------- ...ointThetaUnstoredBetaStoredImpossible.lean | 63 --------- ...isjointThetaUnstoredOutsideImpossible.lean | 64 --------- ...archySituationThreeEligibleIndexBound.lean | 4 + .../HierarchySituationThreeImpossible.lean | 2 + .../HierarchySituationTwoCaseOneTwoData.lean | 2 - ...chySituationTwoCaseThreeNormalization.lean | 1 + .../HierarchySituationTwoImpossible.lean | 29 ---- .../HierarchySituationTwoReorderedTrees.lean | 2 +- ...hySituationTwoReorderedTreesCertified.lean | 44 ------ .../Preparation1.lean | 35 ----- .../Preparation2.lean | 1 + ...tuationTwoSubcaseOneOneNonexceptional.lean | 29 ---- ...uationTwoSubcaseOneOneStoredException.lean | 61 -------- .../HierarchySituationTwoSubcaseOneTwo.lean | 64 --------- .../HierarchySituationTwoSubcaseThreeOne.lean | 74 ---------- .../Preparation1.lean | 68 +-------- .../HierarchySituationTwoSubcaseThreeTwo.lean | 70 ---------- ...tuationTwoSubcaseTwoOneNonexceptional.lean | 64 +++------ ...uationTwoSubcaseTwoOneStoredException.lean | 39 ------ .../HierarchySituationTwoSubcaseTwoTwo.lean | 69 ---------- .../GoldbergSeymour/HierarchySplitter.lean | 5 - .../HierarchyStageMissingColors.lean | 2 +- .../HierarchyTailMissingColorExclusion.lean | 30 ---- .../HierarchyTerminalStoredColors.lean | 2 +- ...erarchyTerminalStoredColorsSubsetLast.lean | 1 + .../HierarchyWeaklyStable.lean | 3 +- .../HkuIncidentColorPreserved.lean | 11 -- .../HkuMissingStoredMonotone.lean | 2 - .../HkuParallelBoundaryStructure.lean | 5 +- .../HkuTreeColorsControlled.lean | 12 -- .../HkuUnsupportedVertexColors.lean | 2 - .../IncidentCoreChromaticIndex.lean | 2 +- .../IncidentCoreColoringTransport.lean | 1 - .../GoldbergSeymour/IncidentCoreDegree.lean | 1 - .../IncidentCoreMaximumDegree.lean | 1 + .../IncidentCoreMissingColors.lean | 2 +- .../IncidentVertexFintype.lean | 3 +- .../InterchangePEClosureConstituent.lean | 42 ------ .../InterchangePECommonMissingClosed.lean | 8 +- .../InterchangePETreeAwayFromDelta.lean | 42 ------ .../InterchangePETreeConstituent.lean | 32 ----- .../LargeOrderTerminalWitness.lean | 5 - .../GoldbergSeymour/LateOwnerReplacement.lean | 7 - .../GoldbergSeymour/LooplessMultigraph.lean | 2 +- .../LowerRoundInductionHypothesis.lean | 11 -- .../GoldbergSeymour/LowerRoundProperties.lean | 5 - .../MaximumStableClosureExists.lean | 2 +- .../MissingColorIncidenceEndpoint.lean | 8 +- .../MissingColorsNonemptyOfMaximumDegree.lean | 1 + .../MixedNoClosedTransport.lean | 69 ---------- LeanPool/GoldbergSeymour/NineN.lean | 17 --- .../NormalGlobalMaximumTriple.lean | 3 +- .../NormalizePositiveTerminalMaximum.lean | 5 - .../OneAdditionPreparatoryLemmas.lean | 68 --------- .../GoldbergSeymour/OneDividerRefresh.lean | 1 - .../GoldbergSeymour/OrderedTreeUnion.lean | 1 - .../GoldbergSeymour/OutsideExitTransport.lean | 3 - .../GoldbergSeymour/OutsidePrefixBranch.lean | 9 -- .../ParallelBaseFourCommonMissingColors.lean | 2 +- .../ParallelClosureUnionElementary.lean | 2 +- .../ParallelCoreAugmentationStrict.lean | 26 ---- .../ParallelExtensionColorAppend.lean | 1 + .../ParallelExtensionUndoStable.lean | 20 --- .../ParallelSpecialClosurePreparation.lean | 5 - .../ParallelStepRootComponentSetup.lean | 13 -- .../ParallelSupportClosureProperties.lean | 25 ---- .../ParallelTerminalAwayInterchangeable.lean | 15 -- .../ParallelTerminalPEPreprocessing.lean | 35 ----- .../GoldbergSeymour/PartialEdgeColoring.lean | 6 +- .../PositivePrefixNoRevisiting.lean | 18 --- LeanPool/GoldbergSeymour/Preamble.lean | 5 +- LeanPool/GoldbergSeymour/PresentColors.lean | 3 +- ...ctedAugmentationCorrespondingEndpoint.lean | 9 -- .../GoldbergSeymour/RetainedHierarchy.lean | 1 - .../RevisitingCertificatePreparation.lean | 27 ---- .../RevisitingTerminalPreparation.lean | 55 +------- ...utgersMiddleExitOutsideTerminalLadder.lean | 40 ------ .../RutgersStrictShortening.lean | 37 ----- .../ScheideAbsorbingElementary.lean | 2 - .../ScheideBalancedCandidateMaximumOrder.lean | 19 --- .../ScheideBalancedFromMaxNormal.lean | 3 - .../ScheideDefectiveChainBoundaryEdges.lean | 26 ---- ...ScheideDefectiveChainLastReturnNoFree.lean | 6 +- .../ScheideDefectiveCrossingSelection.lean | 15 -- .../ScheideDefectiveDeletedTreePair.lean | 20 --- .../ScheideDefectiveLastReturnExists.lean | 19 --- .../ScheideDefectiveNoCross.lean | 47 ------- .../ScheideDefectiveReturnContradiction.lean | 35 ----- ...heideDefectiveSecondTerminalComponent.lean | 20 --- .../ScheideDefectiveSetup.lean | 1 - .../ScheideDefectiveTerminalComponent.lean | 11 -- .../ScheideDefectiveThirdBoundaryEdge.lean | 35 ----- .../ScheideDepartureReturn.lean | 1 - .../ScheideEnlargedClosed.lean | 19 --- .../ScheideEnlargedStrictAugmentation.lean | 2 +- .../ScheideEnlargedSwitchTransport.lean | 30 ---- .../GoldbergSeymour/ScheideExitNoFree.lean | 31 ----- .../GoldbergSeymour/ScheideExitVertex.lean | 1 - .../ScheideGlobalMaximumBoundaryFacts.lean | 4 - .../ScheideGraphHeightOdd.lean | 9 -- .../ScheideHeightFiveGammaEdges.lean | 23 ---- .../ScheideHeightFiveOutsideLinks.lean | 19 --- .../ScheideKempePathHeightBound.lean | 15 -- .../ScheideLargeHeightElementary.lean | 9 -- .../ScheideLargeHeightFullTrunk.lean | 18 --- .../ScheideLargeHeightOneTailPair.lean | 25 ---- .../ScheideMaximalExtendsEveryTree.lean | 3 - .../ScheideMaximalKempePath.lean | 10 -- .../ScheideMaximalOddOrder.lean | 3 - .../ScheideMaximumExtensionNormalWitness.lean | 3 - .../GoldbergSeymour/ScheideNormalisation.lean | 15 -- .../ScheideOrderNineBlockCompletion.lean | 20 --- .../ScheideOrderNineBlockStructure.lean | 39 +----- .../ScheideOrderNineExitLocalization.lean | 20 --- .../ScheideOrderNineParameters.lean | 7 - .../ScheideOrderNineRebasingPreparation.lean | 38 +---- .../ScheideOriginalDefectiveConfinement.lean | 19 --- ...cheideOriginalNondefectiveConfinement.lean | 14 -- .../ScheideReplacementAbsorbing.lean | 26 ---- ...cheideReplacementBoundaryAtLeastThree.lean | 26 ---- ...ScheideReplacementBoundaryAtMostThree.lean | 15 -- .../ScheideReplacementBoundaryParity.lean | 20 --- .../ScheideReplacementBoundaryUnique.lean | 2 +- .../ScheideReplacementConfinement.lean | 31 ----- .../ScheideReplacementData.lean | 1 - .../ScheideReplacementInternalMissing.lean | 2 - .../ScheideReplacementMaximum.lean | 9 -- ...eideReplacementMissingDeletedInternal.lean | 12 -- .../ScheideReplacementPairFixed.lean | 2 +- .../ScheideReplacementPairsLaminar.lean | 1 - .../ScheideReplacementPathPrefix.lean | 7 - .../ScheideReplacementTreeSplice.lean | 5 - .../ScheideReplacementUnionClosed.lean | 1 - .../ScheideReplacementUsedWitness.lean | 6 - .../ScheideReversedKempePathTree.lean | 1 + .../ScheideReversedPathCertificate.lean | 2 +- .../ScheideReversedPathPreparation.lean | 14 +- .../ScheideSelectedBlockDeletion.lean | 3 - .../ScheideSingleBoundaryCrossing.lean | 2 - .../ScheideSmallHeightElementary.lean | 25 ---- .../ScheideStructuralExitsInBase.lean | 5 - .../ScheideStructuralInternalPair.lean | 25 ---- .../ScheideStructuralLemma.lean | 2 - .../ScheideStructuralReducedAssembly.lean | 7 - .../ScheideStructuralReordering.lean | 15 -- .../ScheideSymmetricDefectiveInternal.lean | 38 ----- ...ideSymmetricOriginalBoundaryAvoidance.lean | 6 - .../ScheideSymmetricOriginalFreePath.lean | 8 -- .../ScheideSymmetricOriginalPathOrder.lean | 12 -- ...SymmetricReplacementBoundaryAvoidance.lean | 6 - ...etricReplacementBoundaryConfiguration.lean | 8 -- .../ScheideSymmetricReplacementFreePath.lean | 20 --- .../ScheideSymmetricReplacementPathOrder.lean | 28 ---- .../ScheideTrunkRotationColoring.lean | 8 -- .../ScheideTrunkRotationCycle.lean | 12 -- .../ScheideTrunkRotationNormal.lean | 7 - .../ScheideTrunkRotationPreserves.lean | 15 -- .../ScheideTrunkRotationTree.lean | 10 -- .../ScheideTwoColorLastExitPath.lean | 20 --- .../SimpleExtensionSeedStoredColor.lean | 12 -- LeanPool/GoldbergSeymour/SplitSwapData.lean | 5 +- .../GoldbergSeymour/SplitSwapPreparation.lean | 11 +- .../StableChangeCaseThree.lean | 25 +--- .../StableChangeCaseThree/Preparation1.lean | 20 +-- .../StableChangeCaseThree/Preparation2.lean | 4 +- .../StableChangeCaseThree/Preparation3.lean | 2 + .../StableChangeCaseThree/Preparation4.lean | 1 + .../StableChangeCaseThree/Preparation5.lean | 1 + .../StableChangeCasesOneTwo.lean | 38 ----- .../StableChangeCasesOneTwoFullTail.lean | 47 ------- .../StableChangeCasesOneTwoSplitTail.lean | 42 ------ .../StableChangeCasesOneTwoStarredTail.lean | 53 ------- .../StableColoringExitExtension.lean | 4 - .../StableColoringFullCertificate.lean | 2 +- .../StableColoringIncidentEdgeCriterion.lean | 3 +- .../StableSeriesCycleComponentTransport.lean | 8 -- .../StarredPrefixPreparation.lean | 19 --- .../Step1CaseOneInsidePositiveDivider.lean | 6 - .../Step1CaseOneInsideStar.lean | 67 --------- .../Step1CaseOneInsideZeroNonPE.lean | 2 +- .../Step1CaseOneInsideZeroPE.lean | 70 ---------- .../Step1CaseOneOutsideStar.lean | 74 ---------- .../Step1CaseTwoInsidePositiveDivider.lean | 67 --------- .../Step1CaseTwoInsideZeroNonPE.lean | 65 --------- .../Step1CaseTwoInsideZeroPE.lean | 71 ---------- .../Step1CaseTwoOutsidePrefixHierarchy.lean | 48 ------- .../Step1CaseTwoOutsidePrefixTwoEdges.lean | 70 ---------- .../Step1CaseTwoOutsideRecoloredPrefix.lean | 41 +----- ...1CaseTwoOutsideRestrictedAugmentation.lean | 8 -- .../Step1CaseTwoOutsideTwoEdgeExtension.lean | 31 ----- .../Step1ExitLegGlobalMinimum.lean | 2 +- .../Step1ExitLegMinimumExists.lean | 7 - .../Step1ExitLegPresentationExists.lean | 5 - .../Step1ExitLegThetaPositive.lean | 11 -- .../Step1ExitLegThetaZeroNonparallel.lean | 16 --- .../Step1ExitLegThetaZeroParallel.lean | 2 - .../Step1ZeroDividerAnchorNonPE.lean | 69 ---------- .../Step1ZeroDividerAnchorPE.lean | 72 ---------- ...trongInterchangeabilityKempePreserved.lean | 14 -- .../StronglyClosedWitnessElementary.lean | 13 -- .../SupportingPEColorChain.lean | 3 - .../SupportingPEMissingTransport.lean | 8 -- .../SupportingPEStoredIntersection.lean | 8 -- .../TashTreeCasePathIndexLast.lean | 2 - .../TashTreeControlledInterchange.lean | 17 --- .../TashTreeEarlyBetaNormalization.lean | 16 --- .../TashTreeFourUnusedColors.lean | 15 -- .../TashTreeGammaEpsilonSetup.lean | 9 -- .../TashTreeLastIndexDeletion.lean | 10 -- .../TashTreeLastIndexFirstNormalForm.lean | 17 --- .../TashTreeLastIndexSecondNormalForm.lean | 15 -- .../TashTreeLastIndexThirdNormalForm.lean | 16 --- .../TashTreeNoMinimumBadPair.lean | 1 + ...hTreeNoRepeatedIntersectionShortening.lean | 12 -- .../TashTreePathIndexTwoReplacement.lean | 8 -- .../TashTreeSuffixAdvance.lean | 14 -- .../TashTreeSuffixTerminalReplacement.lean | 15 -- .../TashkinovAlternatingSegmentAppend.lean | 5 - ...AugmentationSequenceColoringTransport.lean | 1 + ...inovAugmentationSequenceComponentSwap.lean | 5 - ...novAugmentationSequenceInitialSegment.lean | 1 + ...ntationSequencePreservesTashkinovTree.lean | 2 +- ...TashkinovAugmentationSequenceRestrict.lean | 1 + .../TashkinovAugmentationSequenceSuffix.lean | 1 + .../TashkinovClosureExists.lean | 2 +- .../TashkinovExtensionKind.lean | 5 +- .../TashkinovStoredColorsAppend.lean | 1 + .../TashkinovStoredColorsCardinality.lean | 19 --- .../TashkinovStoredColorsPrefix.lean | 1 + ...inovTreeComponentSwapWitnessTransport.lean | 6 - .../TashkinovTreeFromLengthOnePrefix.lean | 1 + .../TchangeKempeClosurePreparation.lean | 17 --- .../TchangeOutsideSwapPreparation.lean | 5 - .../TchangeStrictShortening.lean | 13 -- .../TdEarlierPEWitnessIdentification.lean | 1 - .../TdReplacementPrefixExact.lean | 48 ------- .../GoldbergSeymour/TdTerminalRERebuild.lean | 4 +- .../TdTerminalSEPERebuild.lean | 11 +- .../GoldbergSeymour/TechnicalTheoremBase.lean | 17 --- .../TechnicalTheoremLarge.lean | 4 - .../TerminalHierarchyPrefixConstruction.lean | 2 + .../TerminalHierarchyPrefixPreparation.lean | 13 -- .../TerminalHierarchyRestore.lean | 2 +- .../TerminalKempeStageSwitch.lean | 10 -- .../TerminalPrefixReconstruction.lean | 2 + LeanPool/GoldbergSeymour/TerminalRoute.lean | 4 - .../TerminalSeriesRebuildPreparation.lean | 106 +++----------- .../TerminalSeriesRebuildTransport.lean | 130 +++++++++--------- LeanPool/GoldbergSeymour/ThetaExclusion.lean | 1 + LeanPool/GoldbergSeymour/TreeExitPath.lean | 1 + .../TreeMissingColorsCardLowerBound.lean | 9 +- .../GoldbergSeymour/TreeSequenceEdgeSet.lean | 3 +- ...TreeSequenceInitialSegmentVertexSetEq.lean | 1 + ...SequenceInitialSegmentVertexSetSubset.lean | 1 + .../TreeSequenceVertexSet.lean | 3 +- LeanPool/GoldbergSeymour/TreeUsedColors.lean | 3 +- LeanPool/GoldbergSeymour/TrunkRotation.lean | 1 - .../GoldbergSeymour/TwoColorComponent.lean | 1 + .../TwoColorComponentNearestSegment.lean | 4 - ...woColorComponentSwapDisjointPairGraph.lean | 1 - .../TwoColorComponentSwapMissingBehavior.lean | 3 - .../TwoColorComponentSwapNonElementary.lean | 3 - ...mponentSwapPreservesDisjointComponent.lean | 2 - .../TwoColorComponentSwapProper.lean | 2 - .../TwoColorIncidenceDegreeAtMostTwo.lean | 3 +- .../TwoColorIncidenceGraph.lean | 3 +- ...InterchangeableDistinctComponentCycle.lean | 3 - 376 files changed, 328 insertions(+), 6181 deletions(-) diff --git a/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean b/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean index 10b4588e3a..fb98ed0968 100644 --- a/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean +++ b/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean @@ -7,11 +7,9 @@ module public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint public import LeanPool.GoldbergSeymour.NineN public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior /-! # P2905_T2_Absent Owner Replacement diff --git a/LeanPool/GoldbergSeymour/AbsorbingVertex.lean b/LeanPool/GoldbergSeymour/AbsorbingVertex.lean index c8ae295373..303f7492f9 100644 --- a/LeanPool/GoldbergSeymour/AbsorbingVertex.lean +++ b/LeanPool/GoldbergSeymour/AbsorbingVertex.lean @@ -5,8 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple - public import LeanPool.GoldbergSeymour.TreeFreeColors public import LeanPool.GoldbergSeymour.TwoColorComponent diff --git a/LeanPool/GoldbergSeymour/AlgorithmFiveFiveBaseStage.lean b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveBaseStage.lean index 4e1b3bf69a..78ca5e7e6d 100644 --- a/LeanPool/GoldbergSeymour/AlgorithmFiveFiveBaseStage.lean +++ b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveBaseStage.lean @@ -7,8 +7,8 @@ module public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveInitialGoodHierarchy public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveParallelStrictGrowth - public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedAugmentation +public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveSeed /-! # Algorithm Five Five Base Stage diff --git a/LeanPool/GoldbergSeymour/AlgorithmFiveFiveInitialGoodHierarchy.lean b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveInitialGoodHierarchy.lean index bdb08044ef..36a8b48c36 100644 --- a/LeanPool/GoldbergSeymour/AlgorithmFiveFiveInitialGoodHierarchy.lean +++ b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveInitialGoodHierarchy.lean @@ -5,13 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveSeed - public import LeanPool.GoldbergSeymour.GoodHierarchy public import LeanPool.GoldbergSeymour.GoodHierarchyInitialPairsNonPE public import LeanPool.GoldbergSeymour.GoodHierarchyInitialPairsPE - public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree /-! # Algorithm Five Five Initial Good Hierarchy diff --git a/LeanPool/GoldbergSeymour/BaseControl.lean b/LeanPool/GoldbergSeymour/BaseControl.lean index 6c23b36288..db5171514c 100644 --- a/LeanPool/GoldbergSeymour/BaseControl.lean +++ b/LeanPool/GoldbergSeymour/BaseControl.lean @@ -5,36 +5,12 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix - public import LeanPool.GoldbergSeymour.ChangeLemmaBothInside public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.OrderedTreeUnion public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.ParallelInterchangeability public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction -public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion -public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength /-! # P2813_T1_Base Control diff --git a/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean b/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean index 3097e6a5fa..7dd44dd6ad 100644 --- a/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean +++ b/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean @@ -7,11 +7,8 @@ module public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoStarredTail public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior /-! # P2905_T2_Base Extra Replacement diff --git a/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean b/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean index a272391d74..83520e642a 100644 --- a/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean +++ b/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean @@ -5,9 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ExtensionBase - -public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis +public import LeanPool.GoldbergSeymour.CertifiedETTRestriction +public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Basic2Terminal SERE diff --git a/LeanPool/GoldbergSeymour/BoundaryColorVertex.lean b/LeanPool/GoldbergSeymour/BoundaryColorVertex.lean index c26b6b60ed..05a25ea35e 100644 --- a/LeanPool/GoldbergSeymour/BoundaryColorVertex.lean +++ b/LeanPool/GoldbergSeymour/BoundaryColorVertex.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.BoundaryColorEdges +public import LeanPool.GoldbergSeymour.Incident /-! # Boundary Color Vertex diff --git a/LeanPool/GoldbergSeymour/BoundaryEdges.lean b/LeanPool/GoldbergSeymour/BoundaryEdges.lean index 0796615442..cc6085abb8 100644 --- a/LeanPool/GoldbergSeymour/BoundaryEdges.lean +++ b/LeanPool/GoldbergSeymour/BoundaryEdges.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Incident +public import LeanPool.GoldbergSeymour.LooplessMultigraph /-! # Boundary Edges diff --git a/LeanPool/GoldbergSeymour/CertifiedETTRestriction.lean b/LeanPool/GoldbergSeymour/CertifiedETTRestriction.lean index f38c9cd95d..e7cdf16c55 100644 --- a/LeanPool/GoldbergSeymour/CertifiedETTRestriction.lean +++ b/LeanPool/GoldbergSeymour/CertifiedETTRestriction.lean @@ -5,7 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.MaximumPropertyPrefix +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTreePrefix /-! # Certified ETTRestriction diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean index 65ac8e716c..3b4c243dee 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean @@ -5,14 +5,10 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess - -public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction - public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability - -public import Mathlib.Tactic.ClearExcept +public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure /-! # Change Lemma Both Inside diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean index 15e801161a..ff3bad6f78 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean @@ -6,58 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation6 - -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean index 13ad25fa2b..371476e744 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean @@ -5,56 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchySegmentColors public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.SameGoodHierarchy public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation3.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation3.lean index 7eab39223a..42652a4498 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation3.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation3.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation2 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation1 /-! # ChangeLemmaBothOutside: supporting constructions, part 3 diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation4.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation4.lean index b113eb724a..33e4bfff06 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation4.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation4.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation3 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation1 /-! # ChangeLemmaBothOutside: supporting constructions, part 4 diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation5.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation5.lean index 4feb049649..24ccd8d97e 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation5.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation5.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation4 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation1 /-! # ChangeLemmaBothOutside: supporting constructions, part 5 diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean index 16a3c01f17..f6e62aaff3 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean @@ -6,6 +6,10 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation5 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation4 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation3 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside.Preparation2 +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage /-! # ChangeLemmaBothOutside: supporting constructions, part 6 @@ -41,7 +45,6 @@ noncomputable abbrev helperGoodS6400.{u_1, u_2} : (base : HierarchyBase ett phi) → (C : HierarchyCounterexample base) → (alpha beta : Fin k) → - let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean index bbbe1a1d9f..11c11b2999 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean @@ -6,12 +6,10 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess - -public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction - public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability - public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure /-! # Change Lemma Mixed Closed Final diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean index 9ccb1a37b9..e9dbc09f76 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean @@ -6,12 +6,11 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess - public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction - public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability - public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure /-! # Change Lemma Mixed Largest Closed diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean index 6212bcf94b..2948c18066 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean @@ -5,80 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent public import LeanPool.GoldbergSeymour.ParallelInterchangeability public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis - public import LeanPool.GoldbergSeymour.MixedNoClosedTransport /-! diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean index 6c51b581b1..53e13bfbb5 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean @@ -5,84 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability -public import LeanPool.GoldbergSeymour.InterchangePECommonMissingClosed -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts - /-! # Change Lemma Mixed Zero Nonclosed diff --git a/LeanPool/GoldbergSeymour/ChromaticIndexRestrict.lean b/LeanPool/GoldbergSeymour/ChromaticIndexRestrict.lean index 79b60e5d04..ab5e42d2be 100644 --- a/LeanPool/GoldbergSeymour/ChromaticIndexRestrict.lean +++ b/LeanPool/GoldbergSeymour/ChromaticIndexRestrict.lean @@ -5,7 +5,6 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.ChromaticIndexSpec public import LeanPool.GoldbergSeymour.ProperColoringRestricts diff --git a/LeanPool/GoldbergSeymour/ChromaticIndexSpec.lean b/LeanPool/GoldbergSeymour/ChromaticIndexSpec.lean index bdc60faad4..c2a582a1b9 100644 --- a/LeanPool/GoldbergSeymour/ChromaticIndexSpec.lean +++ b/LeanPool/GoldbergSeymour/ChromaticIndexSpec.lean @@ -5,7 +5,6 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.ChromaticIndex /-! diff --git a/LeanPool/GoldbergSeymour/CombinedStableClosurePreserved.lean b/LeanPool/GoldbergSeymour/CombinedStableClosurePreserved.lean index 5dd067a4e3..c565b972d5 100644 --- a/LeanPool/GoldbergSeymour/CombinedStableClosurePreserved.lean +++ b/LeanPool/GoldbergSeymour/CombinedStableClosurePreserved.lean @@ -8,6 +8,7 @@ module public import LeanPool.GoldbergSeymour.CombinedStableColoring public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled +public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Combined Stable Closure Preserved diff --git a/LeanPool/GoldbergSeymour/CommonMissingColorsAtUncoloredEndpoints.lean b/LeanPool/GoldbergSeymour/CommonMissingColorsAtUncoloredEndpoints.lean index 89813cb64a..0e003b81bd 100644 --- a/LeanPool/GoldbergSeymour/CommonMissingColorsAtUncoloredEndpoints.lean +++ b/LeanPool/GoldbergSeymour/CommonMissingColorsAtUncoloredEndpoints.lean @@ -6,13 +6,11 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary - public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored public import LeanPool.GoldbergSeymour.IsProperEdgeColoring - public import LeanPool.GoldbergSeymour.MaximumDegree - public import LeanPool.GoldbergSeymour.TreeMissingColors +public import Mathlib.Data.Fintype.Card /-! # Common Missing Colors At Uncolored Endpoints diff --git a/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTree.lean b/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTree.lean index e3f86e83e0..d78d8ccd75 100644 --- a/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTree.lean +++ b/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTree.lean @@ -5,9 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ExtendedTashkinovColoringSequence -public import LeanPool.GoldbergSeymour.ExtendedTashkinovLadderStage -public import LeanPool.GoldbergSeymour.ExtendedTashkinovRungNumber +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree /-! # Corresponding Extended Tashkinov Tree diff --git a/LeanPool/GoldbergSeymour/CriticalCoreExists.lean b/LeanPool/GoldbergSeymour/CriticalCoreExists.lean index dad90d66e1..918be346b9 100644 --- a/LeanPool/GoldbergSeymour/CriticalCoreExists.lean +++ b/LeanPool/GoldbergSeymour/CriticalCoreExists.lean @@ -5,11 +5,11 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Finset.Powerset -public import Mathlib.Order.Northcott - public import LeanPool.GoldbergSeymour.ChromaticIndexRestrict public import LeanPool.GoldbergSeymour.Critical +public import Mathlib.Data.Fintype.Powerset +public import Mathlib.Data.Finset.Max +public import Mathlib.Tactic.Bound.Init /-! # Critical Core Exists diff --git a/LeanPool/GoldbergSeymour/CriticalGraphElementaryWitness.lean b/LeanPool/GoldbergSeymour/CriticalGraphElementaryWitness.lean index 015fdeec24..f1a67e83e1 100644 --- a/LeanPool/GoldbergSeymour/CriticalGraphElementaryWitness.lean +++ b/LeanPool/GoldbergSeymour/CriticalGraphElementaryWitness.lean @@ -6,21 +6,11 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed -public import LeanPool.GoldbergSeymour.ChromaticIndexSpec public import LeanPool.GoldbergSeymour.Critical -public import LeanPool.GoldbergSeymour.Density -public import LeanPool.GoldbergSeymour.DensityCeil -public import LeanPool.GoldbergSeymour.DensityLowerBound -public import LeanPool.GoldbergSeymour.DensityValue public import LeanPool.GoldbergSeymour.Elementary -public import LeanPool.GoldbergSeymour.Incident public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.StronglyClosedWitnessElementary /-! diff --git a/LeanPool/GoldbergSeymour/DefectiveColorComponentPath.lean b/LeanPool/GoldbergSeymour/DefectiveColorComponentPath.lean index f9e39e35bc..70c0d8faa7 100644 --- a/LeanPool/GoldbergSeymour/DefectiveColorComponentPath.lean +++ b/LeanPool/GoldbergSeymour/DefectiveColorComponentPath.lean @@ -5,27 +5,9 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # P2968_T1_Defective Color Component Path diff --git a/LeanPool/GoldbergSeymour/DefectiveColors.lean b/LeanPool/GoldbergSeymour/DefectiveColors.lean index bdbcb51dd9..bcf2559e27 100644 --- a/LeanPool/GoldbergSeymour/DefectiveColors.lean +++ b/LeanPool/GoldbergSeymour/DefectiveColors.lean @@ -5,9 +5,8 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.Fin - public import LeanPool.GoldbergSeymour.DefectiveColor +public import Mathlib.Data.Fintype.Basic /-! # Defective Colors diff --git a/LeanPool/GoldbergSeymour/DefectiveVertex.lean b/LeanPool/GoldbergSeymour/DefectiveVertex.lean index 73ba3aee5b..654d7b2bb8 100644 --- a/LeanPool/GoldbergSeymour/DefectiveVertex.lean +++ b/LeanPool/GoldbergSeymour/DefectiveVertex.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.DefectiveEdge +public import LeanPool.GoldbergSeymour.Incident /-! # Defective Vertex diff --git a/LeanPool/GoldbergSeymour/DisplayedEdges.lean b/LeanPool/GoldbergSeymour/DisplayedEdges.lean index 163ee138ac..2a7454098c 100644 --- a/LeanPool/GoldbergSeymour/DisplayedEdges.lean +++ b/LeanPool/GoldbergSeymour/DisplayedEdges.lean @@ -6,11 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction -public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed public import LeanPool.GoldbergSeymour.BaseDisplayedEdges public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable /-! diff --git a/LeanPool/GoldbergSeymour/EarlierPECycleFirstNonrevisitingInternal.lean b/LeanPool/GoldbergSeymour/EarlierPECycleFirstNonrevisitingInternal.lean index 71b3e74888..1733850211 100644 --- a/LeanPool/GoldbergSeymour/EarlierPECycleFirstNonrevisitingInternal.lean +++ b/LeanPool/GoldbergSeymour/EarlierPECycleFirstNonrevisitingInternal.lean @@ -5,14 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.InternalEdges -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Earlier PECycle First Nonrevisiting Internal diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean index 4b70ff7f19..dfa32dbb75 100644 --- a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean +++ b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean @@ -7,14 +7,10 @@ module public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary - public import LeanPool.GoldbergSeymour.TreeMissingColors - public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent - /-! # Elementary Closed Exit Pair Distinct Components diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean index 35a86d1697..1e1ac6b9b0 100644 --- a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean +++ b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean @@ -7,14 +7,10 @@ module public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary - public import LeanPool.GoldbergSeymour.TreeMissingColors - public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent - /-! # Elementary Closed Exit Pair Same Component diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableDisjointExitPaths.lean b/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableDisjointExitPaths.lean index 04640992ab..c2f90d6437 100644 --- a/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableDisjointExitPaths.lean +++ b/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableDisjointExitPaths.lean @@ -6,17 +6,12 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary - public import LeanPool.GoldbergSeymour.TreeColorSetClosed public import LeanPool.GoldbergSeymour.TreeExitPath public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors - public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent - /-! # Elementary Closed Noninterchangeable Disjoint Exit Paths diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableExitPair.lean b/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableExitPair.lean index 307df50928..f85b77bb75 100644 --- a/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableExitPair.lean +++ b/LeanPool/GoldbergSeymour/ElementaryClosedNoninterchangeableExitPair.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge public import LeanPool.GoldbergSeymour.ElementaryClosedNoninterchangeableDisjointExitPaths +public import LeanPool.GoldbergSeymour.TreeMissingColors /-! # Elementary Closed Noninterchangeable Exit Pair diff --git a/LeanPool/GoldbergSeymour/ElementaryEndpointExclusion.lean b/LeanPool/GoldbergSeymour/ElementaryEndpointExclusion.lean index 05d3f1d627..7b557ea516 100644 --- a/LeanPool/GoldbergSeymour/ElementaryEndpointExclusion.lean +++ b/LeanPool/GoldbergSeymour/ElementaryEndpointExclusion.lean @@ -9,6 +9,7 @@ public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.TreeColorSetClosed public import LeanPool.GoldbergSeymour.TreeExitPath public import LeanPool.GoldbergSeymour.TreeMissingColors +public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected /-! # P2716_T2_Elementary Endpoint Exclusion diff --git a/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean b/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean index abb1d99f42..95b8524259 100644 --- a/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean +++ b/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean @@ -5,90 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo -public import LeanPool.GoldbergSeymour.TreeSequencePrefix public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableChangeCaseThree -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Hierarchy Situation Three Eligible Index Bound diff --git a/LeanPool/GoldbergSeymour/EligibleOddSet.lean b/LeanPool/GoldbergSeymour/EligibleOddSet.lean index 088ab90de2..18620e0cd0 100644 --- a/LeanPool/GoldbergSeymour/EligibleOddSet.lean +++ b/LeanPool/GoldbergSeymour/EligibleOddSet.lean @@ -6,8 +6,8 @@ Authors: Wesley Pegden module public import Mathlib.Algebra.Ring.Parity - -public import LeanPool.GoldbergSeymour.Preamble +public import Mathlib.Data.Sym.Sym2.Init +public import Mathlib.Data.Finset.Card /-! # Eligible Odd Set diff --git a/LeanPool/GoldbergSeymour/EmptyCommonMissingLocation.lean b/LeanPool/GoldbergSeymour/EmptyCommonMissingLocation.lean index e0ac02f712..78b2331b49 100644 --- a/LeanPool/GoldbergSeymour/EmptyCommonMissingLocation.lean +++ b/LeanPool/GoldbergSeymour/EmptyCommonMissingLocation.lean @@ -7,8 +7,6 @@ module public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset - /-! # P2905_T2_Empty Common Missing Location diff --git a/LeanPool/GoldbergSeymour/ExtensionBase.lean b/LeanPool/GoldbergSeymour/ExtensionBase.lean index 621ebaf89e..8f045e1bc4 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBase.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBase.lean @@ -6,6 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ExtensionBaseBranchLemmas +public import LeanPool.GoldbergSeymour.ExtensionBaseBranchPreparation +public import LeanPool.GoldbergSeymour.ExtensionBaseStoredPairOverlap import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmA.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmA.lean index 096bb754c1..23fc64c0ed 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmA.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmA.lean @@ -7,10 +7,7 @@ module public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmAInduction public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmATraceExists -public import LeanPool.GoldbergSeymour.ExtensionBaseClaimMissingColors -public import LeanPool.GoldbergSeymour.ExtensionBaseClaimStrongInterchangeable - -public import LeanPool.GoldbergSeymour.ExtensionBaseStoredPairOverlap +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmAColorState /-! # Extension Base Algorithm A diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAInduction.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAInduction.lean index 87f72ec427..4c8d63b96b 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAInduction.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmAInduction.lean @@ -5,11 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmAColorState public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmASingleStep - public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationInvariant - public import LeanPool.GoldbergSeymour.StrongInterchangeabilityKempePreserved /-! diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmB.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmB.lean index e5520f915d..0dd12c40a1 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmB.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmB.lean @@ -6,13 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBInduction - public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBInvariant - public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTraceExists -public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors - /-! # Extension Base Algorithm B diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean index 2a78e05670..d85ab087b5 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean @@ -5,10 +5,8 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBSingleStep public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace - public import LeanPool.GoldbergSeymour.StrongInterchangeabilityKempePreserved /-! diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBSingleStep.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBSingleStep.lean index 9f657242cb..fa5f93aa81 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBSingleStep.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBSingleStep.lean @@ -6,9 +6,6 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable - -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath - public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent public import LeanPool.GoldbergSeymour.TwoColorPathComponentNotCycle diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTrace.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTrace.lean index 7c9577df65..a6f79b7d03 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTrace.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBTrace.lean @@ -6,7 +6,6 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneIndices -public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass /-! # Extension Base Algorithm BTrace diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean index 6d58f9bae3..550a1d47b8 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean @@ -5,31 +5,8 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmCInvariant -public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmCTrace -public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass -public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.StrongInterchangeabilityKempePreserved -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentCycle -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent /-! # Extension Base Algorithm C diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean index 63aca64cd8..27b4e9e6fc 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean @@ -5,56 +5,16 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmA -public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmB -public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmC -public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneSelection -public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoContradiction -public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation19 -public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation20 -public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation21 -public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation23 -public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43 -public import LeanPool.GoldbergSeymour.ExtensionBaseClaim44 -public import LeanPool.GoldbergSeymour.ExtensionBaseClaim45 public import LeanPool.GoldbergSeymour.ExtensionBaseClaim45Singleton -public import LeanPool.GoldbergSeymour.ExtensionBaseClaim46 -public import LeanPool.GoldbergSeymour.ExtensionBaseClaimMissingColors -public import LeanPool.GoldbergSeymour.ExtensionBaseClaimStrongInterchangeable -public import LeanPool.GoldbergSeymour.ExtensionBaseClaimTreeEdgeColors -public import LeanPool.GoldbergSeymour.ExtensionBaseClosure -public import LeanPool.GoldbergSeymour.ExtensionBaseDeltaExclusion -public import LeanPool.GoldbergSeymour.ExtensionBaseStoredPairOverlap -public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors -public import LeanPool.GoldbergSeymour.ExtensionBaseSupportOrder -public import LeanPool.GoldbergSeymour.ExtensionRules -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.TashTree -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable +public import LeanPool.GoldbergSeymour.InternalEdges /-! # Extension Base Auxiliary Lemmas diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean b/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean index 853a906141..7b9977178f 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean @@ -5,12 +5,19 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ExtensionBaseBranchPreparation -import all LeanPool.GoldbergSeymour.ExtensionBaseBranchPreparation - -import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary - public import LeanPool.GoldbergSeymour.ExtensionBaseStepLemmas +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim44 +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoContradiction +public import LeanPool.GoldbergSeymour.ExtensionBaseClaim45 +public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneSelection +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmB +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmA +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassEnumeration +public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimStrongInterchangeable +public import LeanPool.GoldbergSeymour.ExtensionBaseClaimMissingColors +public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure /-! # Preparatory lemmas for the extension base diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean b/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean index 99945c7b5f..4eed1a0bf8 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean @@ -8,6 +8,7 @@ module import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary public import LeanPool.GoldbergSeymour.ExtensionBaseStepLemmas +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap /-! # Preparatory lemmas for the extension base diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseOneSelection.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseOneSelection.lean index e8abe4c521..0253ea7cab 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseCaseOneSelection.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseOneSelection.lean @@ -6,12 +6,10 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneIndices -public import LeanPool.GoldbergSeymour.ExtensionBaseClosure public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass - public import LeanPool.GoldbergSeymour.TreeSequencePrefix - public import LeanPool.GoldbergSeymour.TreeVerticesBefore +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary /-! # Extension Base Case One Selection diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean index 1f0d8f1bc1..9acdaad7a0 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean @@ -5,19 +5,16 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.ExtensionBaseClaim45 - public import LeanPool.GoldbergSeymour.MaximumPropertyTransport - public import LeanPool.GoldbergSeymour.OrderedTreeUnionExists - public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix public import LeanPool.GoldbergSeymour.TashkinovClosureExists - public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary /-! # Extension Base Case Two Contradiction diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation23.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation23.lean index 19ed42ddf3..c3f5ea06de 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation23.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoObservation23.lean @@ -6,12 +6,10 @@ Authors: Wesley Pegden module public import Mathlib.Data.Finset.Max - public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary - public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence - public import LeanPool.GoldbergSeymour.TreeVerticesBefore +public import Mathlib.Data.Fintype.EquivFin /-! # Extension Base Case Two Observation23 diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim43.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43.lean index 45388ce359..056a2a0a55 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseClaim43.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43.lean @@ -9,7 +9,6 @@ public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43EdgeEffects public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43MissingColors public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43Stability public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43TreeEdges -public import LeanPool.GoldbergSeymour.ExtensionRules /-! # Extension Base Claim43 diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim43MissingColors.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43MissingColors.lean index 5f24e9f6cc..87ef73fcf8 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseClaim43MissingColors.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim43MissingColors.lean @@ -5,12 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ExtensionBaseClaimMissingColors - public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationInvariant -public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors - /-! # Extension Base Claim43Missing Colors diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean index 601e866dcb..ae0bf56ce8 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean @@ -5,29 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmB public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBInvariant -public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace -public import LeanPool.GoldbergSeymour.ExtensionBaseCaseOneIndices public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeVerticesBefore -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent /-! # Extension Base Claim44 diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean index cf4373a505..e51449fc6d 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean @@ -5,16 +5,11 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.BoundaryColorEdges - public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable - public import LeanPool.GoldbergSeymour.OutsideSwapPrefixEffects public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex - public import LeanPool.GoldbergSeymour.TashkinovClosure - public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean index 8efbd70722..a6fead0ba1 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean @@ -5,10 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation19 @@ -16,31 +12,13 @@ public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation20 public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation21 public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation23 public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass -public import LeanPool.GoldbergSeymour.Incident public import LeanPool.GoldbergSeymour.InternalEdges -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.LooplessMultigraph public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.OutsideSwapPrefixEffects -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVerticesBefore -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Extension Base Claim46 diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaimStrongInterchangeable.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaimStrongInterchangeable.lean index d6e367ebf3..e6b4487fd0 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseClaimStrongInterchangeable.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaimStrongInterchangeable.lean @@ -7,12 +7,8 @@ module public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable public import LeanPool.GoldbergSeymour.EarlierPECycleFirstNonrevisitingInternal - public import LeanPool.GoldbergSeymour.ExtensionBaseActiveIndices - public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent - public import LeanPool.GoldbergSeymour.ParallelStepRootComponentSetup public import LeanPool.GoldbergSeymour.StableSeriesCycleComponentTransport diff --git a/LeanPool/GoldbergSeymour/ExtensionBasePreparations.lean b/LeanPool/GoldbergSeymour/ExtensionBasePreparations.lean index fcc85df47b..5bb4d7fcea 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBasePreparations.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBasePreparations.lean @@ -7,7 +7,13 @@ module import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary -public import LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace +public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.OrderedTreeUnion +public import LeanPool.GoldbergSeymour.InternalEdges /-! # Preparatory lemmas for the extension base diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean b/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean index 5996b3e508..44270df944 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean @@ -7,8 +7,10 @@ module import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary -public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.ExtensionBasePreparations +public import LeanPool.GoldbergSeymour.ExtensionBaseClosure +public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBInvariant +public import LeanPool.GoldbergSeymour.ParallelStepRootComponentSetup /-! # Preparatory lemmas for the extension base diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseStoredPairOverlap.lean b/LeanPool/GoldbergSeymour/ExtensionBaseStoredPairOverlap.lean index 39f318dc6a..74dabd902b 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseStoredPairOverlap.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseStoredPairOverlap.lean @@ -5,25 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex public import LeanPool.GoldbergSeymour.ExtensionBaseActiveIndices public import LeanPool.GoldbergSeymour.ExtensionBaseDeltaExclusion public import LeanPool.GoldbergSeymour.ExtensionBaseSameSupportStoredPairOverlap -public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClass public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassEnumeration -public import LeanPool.GoldbergSeymour.ExtensionBaseSupportClassColors -public import LeanPool.GoldbergSeymour.ExtensionBaseSupportOrder public import LeanPool.GoldbergSeymour.ExtensionRules -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet - public import LeanPool.GoldbergSeymour.LowerRoundProperties /-! diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseStrictDeltaExclusion.lean b/LeanPool/GoldbergSeymour/ExtensionBaseStrictDeltaExclusion.lean index 43e188fe84..68278e0186 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseStrictDeltaExclusion.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseStrictDeltaExclusion.lean @@ -6,12 +6,10 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary - public import LeanPool.GoldbergSeymour.ExtensionBaseSupportOrder - public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved - public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Extension Base Strict Delta Exclusion diff --git a/LeanPool/GoldbergSeymour/ExtensionRules.lean b/LeanPool/GoldbergSeymour/ExtensionRules.lean index eddb350e24..4d0931ad3e 100644 --- a/LeanPool/GoldbergSeymour/ExtensionRules.lean +++ b/LeanPool/GoldbergSeymour/ExtensionRules.lean @@ -5,61 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveEdge -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.ExtensionRulesEarlierIndices -public import LeanPool.GoldbergSeymour.ExtensionRulesPEFirstAppearanceBound public import LeanPool.GoldbergSeymour.ExtensionRulesTerminalEarlierAppearance public import LeanPool.GoldbergSeymour.ExtensionRulesTerminalLastAppearance public import LeanPool.GoldbergSeymour.ExtensionRulesTerminalStoredDisjoint -public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone -public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure -public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors -public import LeanPool.GoldbergSeymour.InternalEdges -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeExit -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeVerticesBefore -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion - public import LeanPool.GoldbergSeymour.LowerRoundProperties /-! diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesEarlierIndices.lean b/LeanPool/GoldbergSeymour/ExtensionRulesEarlierIndices.lean index ce25d69f69..cce3b9fc81 100644 --- a/LeanPool/GoldbergSeymour/ExtensionRulesEarlierIndices.lean +++ b/LeanPool/GoldbergSeymour/ExtensionRulesEarlierIndices.lean @@ -5,13 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.CertifiedETTRestriction - public import LeanPool.GoldbergSeymour.ExtensionRulesPEFirstAppearanceBound - public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex - public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset /-! diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalEarlierAppearance.lean b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalEarlierAppearance.lean index b5371b1830..a483c5efd2 100644 --- a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalEarlierAppearance.lean +++ b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalEarlierAppearance.lean @@ -6,38 +6,13 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.DefectiveEdge -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.DefectiveColor public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovLadderStage -public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TreeVerticesBefore -public import LeanPool.GoldbergSeymour.StableColoringEquivalence - public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalLastAppearance.lean b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalLastAppearance.lean index f0bd23bdf8..f6380d89d3 100644 --- a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalLastAppearance.lean +++ b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalLastAppearance.lean @@ -6,19 +6,12 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex - public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone - public import LeanPool.GoldbergSeymour.MaximumProperty - public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex - public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit - public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.StableColoringEquivalence - /-! # Extension Rules Terminal Last Appearance diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean index 63b538edc3..c2dd596391 100644 --- a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean +++ b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean @@ -7,47 +7,15 @@ module public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex public import LeanPool.GoldbergSeymour.EarlierPECycleFirstNonrevisitingInternal -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.CertifiedETTRestriction public import LeanPool.GoldbergSeymour.ExtensionRulesPEFirstAppearanceBound -public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure -public import LeanPool.GoldbergSeymour.InternalEdges -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors public import LeanPool.GoldbergSeymour.TechnicalTheoremBase public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeExit -public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentCycle -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion - public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! diff --git a/LeanPool/GoldbergSeymour/FiniteStrictGrowthReachesTerminal.lean b/LeanPool/GoldbergSeymour/FiniteStrictGrowthReachesTerminal.lean index e23c5b51d5..3c3d637ac0 100644 --- a/LeanPool/GoldbergSeymour/FiniteStrictGrowthReachesTerminal.lean +++ b/LeanPool/GoldbergSeymour/FiniteStrictGrowthReachesTerminal.lean @@ -6,10 +6,7 @@ Authors: Wesley Pegden module public import Mathlib.Data.Fintype.EquivFin - -public import Mathlib.Data.Fintype.Basic - -public import LeanPool.GoldbergSeymour.Preamble +public import Mathlib.Data.Sym.Sym2.Init /-! # Finite Strict Growth Reaches Terminal diff --git a/LeanPool/GoldbergSeymour/FirstEntryClipping.lean b/LeanPool/GoldbergSeymour/FirstEntryClipping.lean index 4669db04a2..cbc99860b0 100644 --- a/LeanPool/GoldbergSeymour/FirstEntryClipping.lean +++ b/LeanPool/GoldbergSeymour/FirstEntryClipping.lean @@ -6,8 +6,6 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TreeExitPath -public import Mathlib.Combinatorics.SimpleGraph.Walk.Decomp -public import Mathlib.Combinatorics.SimpleGraph.Paths /-! # P2716_T2_First Entry Clipping diff --git a/LeanPool/GoldbergSeymour/GeneralHighIndexElementary.lean b/LeanPool/GoldbergSeymour/GeneralHighIndexElementary.lean index 594d471f17..e95e5fee92 100644 --- a/LeanPool/GoldbergSeymour/GeneralHighIndexElementary.lean +++ b/LeanPool/GoldbergSeymour/GeneralHighIndexElementary.lean @@ -7,10 +7,6 @@ module public import LeanPool.GoldbergSeymour.CriticalCoreExists public import LeanPool.GoldbergSeymour.ElementaryTransfer - -public import - LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible - public import LeanPool.GoldbergSeymour.MaximumDegreeRestrict public import LeanPool.GoldbergSeymour.ThmGS2 diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyElementaryLarge.lean b/LeanPool/GoldbergSeymour/GoodHierarchyElementaryLarge.lean index 64d2efe703..8cd6945227 100644 --- a/LeanPool/GoldbergSeymour/GoodHierarchyElementaryLarge.lean +++ b/LeanPool/GoldbergSeymour/GoodHierarchyElementaryLarge.lean @@ -5,48 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePathNumberBounds -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext public import LeanPool.GoldbergSeymour.HierarchySituationOneImpossible public import LeanPool.GoldbergSeymour.HierarchySituationTwoImpossible public import LeanPool.GoldbergSeymour.HierarchySituationThreeImpossible -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumDegree public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent - public import LeanPool.GoldbergSeymour.LowerRoundProperties /-! diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixConstruction.lean b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixConstruction.lean index 75761c5146..82479b7da1 100644 --- a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixConstruction.lean +++ b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixConstruction.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixPreparation +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! # Good Hierarchy Prefix Repackage diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean index 145cb77945..346eb7bea0 100644 --- a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean +++ b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean @@ -6,10 +6,6 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.TreeSequencePrefix - -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! # Good Hierarchy Prefix Repackage diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixRepackage.lean b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixRepackage.lean index 271cf9fed3..31dc2034fb 100644 --- a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixRepackage.lean +++ b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixRepackage.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixConstruction +public import LeanPool.GoldbergSeymour.MaximumProperty /-! # Good Hierarchy Prefix Repackage diff --git a/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean b/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean index d9b35ccf29..04de9fd93a 100644 --- a/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean +++ b/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean @@ -7,14 +7,8 @@ module public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix - public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyTerminalPrefixRepackage.lean b/LeanPool/GoldbergSeymour/GoodHierarchyTerminalPrefixRepackage.lean index a8a41aa820..b3d574ae75 100644 --- a/LeanPool/GoldbergSeymour/GoodHierarchyTerminalPrefixRepackage.lean +++ b/LeanPool/GoldbergSeymour/GoodHierarchyTerminalPrefixRepackage.lean @@ -6,21 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TerminalHierarchyPrefixConstruction - -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment - public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! diff --git a/LeanPool/GoldbergSeymour/HierarchyCaseThreePreparation.lean b/LeanPool/GoldbergSeymour/HierarchyCaseThreePreparation.lean index 031c16cb01..a668ba24ce 100644 --- a/LeanPool/GoldbergSeymour/HierarchyCaseThreePreparation.lean +++ b/LeanPool/GoldbergSeymour/HierarchyCaseThreePreparation.lean @@ -6,72 +6,12 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyPathNumber public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalizedData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCommonTailData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoOutsidePenultimateReconstruction -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring public import LeanPool.GoldbergSeymour.NineN -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph public import LeanPool.GoldbergSeymour.NormalizedDatum -public import Mathlib.Data.Finset.Option -public import LeanPool.GoldbergSeymour.TashkinovAlternatingSegmentAppend -public import LeanPool.GoldbergSeymour.TwoColorComponentNearestSegment -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff public import LeanPool.GoldbergSeymour.MinimumContextTransport -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges /-! # Preparatory lemmas for hierarchy case-three normalization @@ -337,7 +277,6 @@ Keeping this interface separate avoids repeating its dependent hypotheses and da -/ abbrev hierarchyExtensionConstructorType.{u_1, u_2} (V : Type u_1) (E : Type u_2) := open scoped Classical in - [Fintype V] → [Fintype E] → [DecidableEq V] → diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNine.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNine.lean index 49957f5b75..539ca44b0b 100644 --- a/LeanPool/GoldbergSeymour/HierarchyClaimNine.lean +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNine.lean @@ -5,41 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyClaimNineFirstUseAfterSeed public import LeanPool.GoldbergSeymour.HierarchyClaimNineFirstUseSeed public import LeanPool.GoldbergSeymour.HierarchyClaimNinePENormalization -public import LeanPool.GoldbergSeymour.HierarchyClaimNineUnusedTailColor -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTerminalCommonMissing public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.HierarchyMeasures /-! # Hierarchy Claim Nine diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean index 35c648b36c..ab4e6ef1b7 100644 --- a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean @@ -5,79 +5,13 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HierarchyClaimNineUnusedTailColor public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.HierarchyClaimNinePENormalization -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.TreeMissingColors public import LeanPool.GoldbergSeymour.HierarchyMeasures -public import LeanPool.GoldbergSeymour.BaseControl -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TerminalRoute public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment /-! # Hierarchy Claim Nine First Use After Seed diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean index e394f139f3..f86cd677ce 100644 --- a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean @@ -5,86 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.HierarchyMeasures -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.TreeIncidentEdge public import LeanPool.GoldbergSeymour.HierarchyClaimNineFirstUseAfterSeed public import LeanPool.GoldbergSeymour.HierarchyClaimNineUnusedTailColor -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyClaimNinePENormalization -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Hierarchy Claim Nine First Use Seed diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNinePENormalization.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNinePENormalization.lean index a06a1d9849..b490ab39e0 100644 --- a/LeanPool/GoldbergSeymour/HierarchyClaimNinePENormalization.lean +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNinePENormalization.lean @@ -5,79 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset public import LeanPool.GoldbergSeymour.BaseControl -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans -public import Mathlib.Algebra.BigOperators.Group.Finset.Basic - public import LeanPool.GoldbergSeymour.HierarchyNormalizationLemmas /-! diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNineUnusedTailColor.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNineUnusedTailColor.lean index bef1156db6..86e3a65232 100644 --- a/LeanPool/GoldbergSeymour/HierarchyClaimNineUnusedTailColor.lean +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNineUnusedTailColor.lean @@ -7,58 +7,10 @@ module public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans -public import LeanPool.GoldbergSeymour.HierarchyClaimNinePENormalization -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.BaseControl public import LeanPool.GoldbergSeymour.HierarchyMeasures public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior /-! # Hierarchy Claim Nine Unused Tail Color diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexampleLess.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexampleLess.lean index 43adabf188..298ed03b4b 100644 --- a/LeanPool/GoldbergSeymour/HierarchyCounterexampleLess.lean +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexampleLess.lean @@ -5,7 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import Mathlib.Combinatorics.SimpleGraph.Init +public import Mathlib.Data.Sym.Sym2.Init +public import Mathlib.Tactic.Bound.Init +public import Mathlib.Data.Finset.Attr +public import Mathlib.Tactic.SetLike +public import Mathlib.Tactic.Finiteness.Attr +public import Mathlib.Data.Nat.Notation +public import Mathlib.Tactic.ToDual /-! # Hierarchy Counterexample Less diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionPositiveDividerImpossible.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionPositiveDividerImpossible.lean index fd3da051e0..99268c0e85 100644 --- a/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionPositiveDividerImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionPositiveDividerImpossible.lean @@ -5,81 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.ChangeLemmaBothInside -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableChange -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis - -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts - public import LeanPool.GoldbergSeymour.OneAdditionPreparatoryLemmas /-! diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionZeroDividerImpossible.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionZeroDividerImpossible.lean index ed7b0e8d8c..e06cc83389 100644 --- a/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionZeroDividerImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexampleOneAdditionZeroDividerImpossible.lean @@ -5,66 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.ClosedSetTwoColorComponentAvoidance -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyLEMStable public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.InterchangePECommonMissingClosed -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.StableChange -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent public import LeanPool.GoldbergSeymour.ParallelInterchangeability - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/HierarchyCounterexamplePenultimateElementary.lean b/LeanPool/GoldbergSeymour/HierarchyCounterexamplePenultimateElementary.lean index 357ef3f6e4..f2284d4d3d 100644 --- a/LeanPool/GoldbergSeymour/HierarchyCounterexamplePenultimateElementary.lean +++ b/LeanPool/GoldbergSeymour/HierarchyCounterexamplePenultimateElementary.lean @@ -7,10 +7,9 @@ module public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage - public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess - public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure /-! # Hierarchy Counterexample Penultimate Elementary diff --git a/LeanPool/GoldbergSeymour/HierarchyEligibleCommonMissingIndices.lean b/LeanPool/GoldbergSeymour/HierarchyEligibleCommonMissingIndices.lean index d128459a0b..2d44658c5e 100644 --- a/LeanPool/GoldbergSeymour/HierarchyEligibleCommonMissingIndices.lean +++ b/LeanPool/GoldbergSeymour/HierarchyEligibleCommonMissingIndices.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength /-! # Hierarchy Eligible Common Missing Indices diff --git a/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean b/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean index f93a975d09..4d33d928fc 100644 --- a/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean +++ b/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean @@ -6,8 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition - public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import Mathlib.Data.Fintype.EquivFin /-! # Hierarchy First Missing Position Prefix Cutoff diff --git a/LeanPool/GoldbergSeymour/HierarchyFullTailPrefix.lean b/LeanPool/GoldbergSeymour/HierarchyFullTailPrefix.lean index 17ef61b414..64472feb9e 100644 --- a/LeanPool/GoldbergSeymour/HierarchyFullTailPrefix.lean +++ b/LeanPool/GoldbergSeymour/HierarchyFullTailPrefix.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyCounterexample /-! # Hierarchy Full Tail Prefix diff --git a/LeanPool/GoldbergSeymour/HierarchyLEMStable.lean b/LeanPool/GoldbergSeymour/HierarchyLEMStable.lean index a1bf5a7a23..cec55a5fb0 100644 --- a/LeanPool/GoldbergSeymour/HierarchyLEMStable.lean +++ b/LeanPool/GoldbergSeymour/HierarchyLEMStable.lean @@ -5,35 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.HierarchyOutsideKempeStable public import LeanPool.GoldbergSeymour.HierarchySplitter public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.ModColoring public import LeanPool.GoldbergSeymour.OutsideKempeGoodHierarchy -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/HierarchyMeasures.lean b/LeanPool/GoldbergSeymour/HierarchyMeasures.lean index 168ad7e3f7..be709e8554 100644 --- a/LeanPool/GoldbergSeymour/HierarchyMeasures.lean +++ b/LeanPool/GoldbergSeymour/HierarchyMeasures.lean @@ -6,8 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.HierarchyPathNumber /-! # P2752_T2_Hierarchy Measures diff --git a/LeanPool/GoldbergSeymour/HierarchyMinimumCounterexampleContext.lean b/LeanPool/GoldbergSeymour/HierarchyMinimumCounterexampleContext.lean index e46589cbbf..f6e1657e90 100644 --- a/LeanPool/GoldbergSeymour/HierarchyMinimumCounterexampleContext.lean +++ b/LeanPool/GoldbergSeymour/HierarchyMinimumCounterexampleContext.lean @@ -5,20 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.BoundaryColorVertex - -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex - public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess - -public import LeanPool.GoldbergSeymour.ModColoring - -public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex - -public import LeanPool.GoldbergSeymour.TreeInterchangeable - public import LeanPool.GoldbergSeymour.LowerRoundProperties +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure /-! # Hierarchy Minimum Counterexample Context diff --git a/LeanPool/GoldbergSeymour/HierarchyNormalizationLemmas.lean b/LeanPool/GoldbergSeymour/HierarchyNormalizationLemmas.lean index 1a21cd47ac..a361e5eb48 100644 --- a/LeanPool/GoldbergSeymour/HierarchyNormalizationLemmas.lean +++ b/LeanPool/GoldbergSeymour/HierarchyNormalizationLemmas.lean @@ -5,78 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.BaseControl -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans -public import Mathlib.Algebra.BigOperators.Group.Finset.Basic /-! # Preparatory lemmas for hierarchy normalization diff --git a/LeanPool/GoldbergSeymour/HierarchyOrderedExitReduction.lean b/LeanPool/GoldbergSeymour/HierarchyOrderedExitReduction.lean index ddf3d02360..773692b516 100644 --- a/LeanPool/GoldbergSeymour/HierarchyOrderedExitReduction.lean +++ b/LeanPool/GoldbergSeymour/HierarchyOrderedExitReduction.lean @@ -5,27 +5,13 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.OrderedTreeUnion public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeIncidentEdge public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet -public import LeanPool.GoldbergSeymour.TreeSequencePrefix public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import Mathlib.Tactic.ClearExcept /-! # rutcor @@ -688,7 +674,6 @@ private theorem helper_continuation_896.{u_1, u_2} : | omega | ( have := GoldbergSeymour.TreeSequence.positive T have := GoldbergSeymour.ExtendedTashkinovTree.roundsPositive ett - all_goals omega) ⟩ : Fin ett.rounds); let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; diff --git a/LeanPool/GoldbergSeymour/HierarchyPrefixData.lean b/LeanPool/GoldbergSeymour/HierarchyPrefixData.lean index c6ebcc2bab..6f176f8cb7 100644 --- a/LeanPool/GoldbergSeymour/HierarchyPrefixData.lean +++ b/LeanPool/GoldbergSeymour/HierarchyPrefixData.lean @@ -5,9 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyLEMStable +public import LeanPool.GoldbergSeymour.SameGoodHierarchy +public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree /-! # P2752_T2_Prefix Data diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean index 721304045b..ec91af27d8 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean @@ -6,76 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Hierarchy Situation One Advance Inside Stored diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean index 4a29a62ebf..68fd22fc9d 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean @@ -6,79 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.Incident public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages public import LeanPool.GoldbergSeymour.StableChangeCaseThree -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Hierarchy Situation One Advance Outside Stored diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneImpossible.lean index a8ce838394..82875ba93e 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneImpossible.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.HierarchySituationOnePenultimateCommonMissing public import LeanPool.GoldbergSeymour.HierarchySituationOneShorteningContradiction +public import LeanPool.GoldbergSeymour.HierarchyClaimNine /-! # Hierarchy Situation One Impossible diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOnePenultimateCommonMissing.lean b/LeanPool/GoldbergSeymour/HierarchySituationOnePenultimateCommonMissing.lean index fa3f599264..e61582836b 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOnePenultimateCommonMissing.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOnePenultimateCommonMissing.lean @@ -5,8 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HierarchyClaimNine - public import LeanPool.GoldbergSeymour.HierarchySituationOneAdvanceInsideStored public import LeanPool.GoldbergSeymour.HierarchySituationOneAdvanceOutsideStored diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean index 77722275a9..ba427290a9 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean @@ -5,62 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.HierarchySplitter /-! # Hierarchy Situation One Shortening Contradiction diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean index 875cd93d76..597276e43f 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean @@ -9,75 +9,9 @@ public import LeanPool.GoldbergSeymour.EmptyCommonMissingLocation public import LeanPool.GoldbergSeymour.BaseExtraReplacement public import LeanPool.GoldbergSeymour.AbsentOwnerReplacement public import LeanPool.GoldbergSeymour.LateOwnerReplacement -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTerminalCommonMissing public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation public import LeanPool.GoldbergSeymour.HierarchySituationThreeClaimJMinusOneNonempty -public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.NineN -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoStarredTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable /-! # Hierarchy Situation Three Claim JMinus One Empty diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean index 7ca5d7ff93..9bf9e85d25 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean @@ -5,82 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring public import LeanPool.GoldbergSeymour.NineN -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableChangeCaseThree -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Hierarchy Situation Three Claim JMinus One Nonempty diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeColorChoice.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeColorChoice.lean index 085bd70484..08c71bc989 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeColorChoice.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeColorChoice.lean @@ -5,26 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.NineN -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix /-! # Hierarchy Situation Three Color Choice diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean index bee4f2f58b..d47cb2de71 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean @@ -6,65 +6,13 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyPathNumber public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySituationThreeColorChoice -public import LeanPool.GoldbergSeymour.HierarchySituationThreeClaimJMinusOneEmpty -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentTashkinovSplice -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion -public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff public import LeanPool.GoldbergSeymour.TerminalRoute public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset /-! # Hierarchy Situation Three Component Intersection Shortening diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointPreparation.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointPreparation.lean index 4ed6f6a90d..9cd73ed1da 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointPreparation.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointPreparation.lean @@ -5,78 +5,15 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.SplitSwapPreparation public import LeanPool.GoldbergSeymour.KempeOrientation public import LeanPool.GoldbergSeymour.OutsidePrefixBranch public import LeanPool.GoldbergSeymour.ConditionNineTransport public import LeanPool.GoldbergSeymour.ThetaExclusion public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.HierarchyMeasures -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData -public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent /-! # Hierarchy Situation Three Disjoint Preparation diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean index 3a5563d31b..4391523030 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean @@ -5,74 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.HierarchySegmentColors public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior /-! # Hierarchy Situation Three Disjoint Theta Stored Impossible diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean index 3a01fadccb..1cf9ea3e44 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean @@ -5,72 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.HierarchySegmentColors public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent /-! # Hierarchy Situation Three Disjoint Theta Unstored Beta Stored Impossible diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible.lean index 8acbb4846a..2d324b1785 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible.lean @@ -5,73 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableChangeCaseThree -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent /-! # Hierarchy Situation Three Disjoint Theta Unstored Outside Impossible diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean index fa4d493d96..dfd79182a5 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean @@ -6,6 +6,10 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.EligibleIndexBoundConstruction +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo +public import LeanPool.GoldbergSeymour.StableChangeCaseThree +public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch /-! # Hierarchy Situation Three Eligible Index Bound diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeImpossible.lean index 8b2bc3dad5..190415d444 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeImpossible.lean @@ -11,6 +11,8 @@ public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaStore public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointThetaUnstoredOutsideImpossible +public import LeanPool.GoldbergSeymour.HierarchySituationThreeClaimJMinusOneEmpty +public import LeanPool.GoldbergSeymour.HierarchySituationThreeColorChoice /-! # Hierarchy Situation Three Impossible diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneTwoData.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneTwoData.lean index 45f07252f4..3c7c3aafe6 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneTwoData.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseOneTwoData.lean @@ -7,8 +7,6 @@ module public import LeanPool.GoldbergSeymour.HierarchySituationTwoCommonTailData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData - /-! # Hierarchy Situation Two Case One Two Data diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalization.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalization.lean index f3d1db1343..0b6cb3780c 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalization.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoCaseThreeNormalization.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyCaseThreePreparation +public import LeanPool.GoldbergSeymour.HierarchySituationTwoOutsidePenultimateReconstruction /-! # Hierarchy Situation Two Case Three Normalization diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoImpossible.lean index ff9883fe0a..9a13af57ea 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoImpossible.lean @@ -5,43 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTerminalCommonMissing -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneTwoData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalization -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalizedData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeOneData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeTwoData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoTwoData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCommonTailData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneTwo public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeOne public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeTwo -public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoTwo -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeMissingColors /-! # Hierarchy Situation Two Impossible diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTrees.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTrees.lean index 5c84288858..aa69beb9cd 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTrees.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTrees.lean @@ -6,8 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix - public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData +public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet /-! # Hierarchy Situation Two Reordered Trees diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified.lean index 3185356d37..67e52eeeca 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified.lean @@ -6,51 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified.Preparation2 - -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees -public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion -public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport -public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeUnique -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix /-! # Hierarchy Situation Two Reordered Trees Certified diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation1.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation1.lean index ce08f38ee1..7142f41f09 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation1.lean @@ -5,46 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees -public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion public import LeanPool.GoldbergSeymour.HierarchyBaseCorrespondingTransport -public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeUnique public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation2.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation2.lean index fd1f8345c2..51744041e9 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation2.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoReorderedTreesCertified/Preparation2.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified.Preparation1 +public import LeanPool.GoldbergSeymour.Td /-! # HierarchySituationTwoReorderedTreesCertified: supporting constructions, part 2 diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean index b692bbb69a..cb3760223d 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean @@ -6,38 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchySegmentColors public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified -public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint /-! # Hierarchy Situation Two Subcase One One Nonexceptional diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean index 72ca360344..cdade20fbc 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean @@ -5,76 +5,15 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring public import LeanPool.GoldbergSeymour.NineN -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOneNonexceptional -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import Mathlib.Data.Finset.Option /-! # Hierarchy Situation Two Subcase One One Stored Exception diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean index 80b6d6681f..57590d1210 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean @@ -5,72 +5,8 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneTwoData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset /-! # Hierarchy Situation Two Subcase One Two diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne.lean index dc29467964..0507a19e90 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne.lean @@ -6,81 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseThreeOne.Preparation2 - -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalization public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeOneData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees -public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified -public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne -public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.MinimumContextTransport -public import LeanPool.GoldbergSeymour.HierarchyMeasures -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.TerminalStoredColors -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix /-! # Hierarchy Situation Two Subcase Three One diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean index 9c6710b58f..49a8c9fb3a 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean @@ -5,80 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyPathNumber public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalization public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeOneData public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees -public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne -public import LeanPool.GoldbergSeymour.HierarchySituationTwoTailData -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior public import LeanPool.GoldbergSeymour.MinimumContextTransport -public import LeanPool.GoldbergSeymour.HierarchyMeasures -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint public import LeanPool.GoldbergSeymour.TerminalStoredColors -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix /-! # HierarchySituationTwoSubcaseThreeOne: supporting constructions, part 1 @@ -2304,7 +2238,7 @@ theorem helper_separateVertices_1307.{u_1, u_2} : change Sum.inl x ∈ {z | z ∈ p.support} rw [hsupport] exact hx - exact hpPath.isTrail.not_mem_support_of_subsingleton_neighborSet + exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet hn.1 hn.2 (leafComponent rho a b hne hp x hm) hs have hue := endpoint u (he ▸ selfComponent rho a b u) (Or.inl hu) have hve := endpoint v (by rw [he, hsame]; exact selfComponent rho a b v) (Or.inr hv) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean index 8313a40213..630fca0146 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean @@ -5,79 +5,9 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeNormalizedData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeTwoData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.StableChangeCaseThree -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TerminalRoute /-! # Hierarchy Situation Two Subcase Three Two diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean index 24dcbe3be5..e84bbfe886 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean @@ -6,35 +6,10 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyPathNumber public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoExclusions -public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTreesCertified -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint public import LeanPool.GoldbergSeymour.NineN -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovStoredColorsCardinality -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo /-! # Hierarchy Situation Two Subcase Two One Nonexceptional @@ -237,7 +212,7 @@ private noncomputable abbrev helperCStar1926.{u_1, u_2} : notElementary := @Eq.mpr (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx @@ -245,12 +220,12 @@ private noncomputable abbrev helperCStar1926.{u_1, u_2} : E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) R)))) (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 T))) (@id (@Eq Prop (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx @@ -259,7 +234,7 @@ private noncomputable abbrev helperCStar1926.{u_1, u_2} : ctx D) R)))) (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 T)))) (@congrArg (Finset V) Prop (@TreeSequenceVertexSet V E G e0 @@ -270,7 +245,7 @@ private noncomputable abbrev helperCStar1926.{u_1, u_2} : R)) (@TreeSequenceVertexSet V E G e0 T) (fun (_a : Finset V) ↦ - Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E @@ -787,11 +762,10 @@ private abbrev helperContinuation4235Conditions.{u_1, u_2} : Prop := private abbrev transferredGoodHierarchyConstructorType.{u_1, u_2} (V : Type u_1) (E : Type u_2) := open scoped Classical in - - [ Fintype V] → - [ Fintype E] → - [ DecidableEq V] → - [ DecidableEq E] → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → (G : LooplessMultigraph V E) → (k : ℕ) → (e0 : E) → @@ -2907,7 +2881,7 @@ private theorem helper_hstarPath_824.{u_1, u_2} : notElementary := @Eq.mpr (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx @@ -2915,12 +2889,12 @@ private theorem helper_hstarPath_824.{u_1, u_2} : inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) R)))) (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 T))) (@id (@Eq Prop (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx @@ -2929,7 +2903,7 @@ private theorem helper_hstarPath_824.{u_1, u_2} : D) R)))) (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 T)))) (@congrArg (Finset V) Prop (@TreeSequenceVertexSet V E G e0 @@ -2940,7 +2914,7 @@ private theorem helper_hstarPath_824.{u_1, u_2} : R)) (@TreeSequenceVertexSet V E G e0 T) (fun (_a : Finset V) ↦ - Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E @@ -3101,7 +3075,7 @@ private theorem helper_hstarMeasure_839.{u_1, u_2} : notElementary := @Eq.mpr (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx @@ -3109,12 +3083,12 @@ private theorem helper_hstarMeasure_839.{u_1, u_2} : inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx D) R)))) (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 T))) (@id (@Eq Prop (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 (@HierarchySituationTwoReorderedTrees.star V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx @@ -3123,7 +3097,7 @@ private theorem helper_hstarMeasure_839.{u_1, u_2} : D) R)))) (Not - (@ColoredVertexSetElementary V E inst_1 G k phi + (@ColoredVertexSetElementary V E inst_1 G k phi (@TreeSequenceVertexSet V E G e0 T)))) (@congrArg (Finset V) Prop (@TreeSequenceVertexSet V E G e0 @@ -3134,7 +3108,7 @@ private theorem helper_hstarMeasure_839.{u_1, u_2} : R)) (@TreeSequenceVertexSet V E G e0 T) (fun (_a : Finset V) ↦ - Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) + Not (@ColoredVertexSetElementary V E inst_1 G k phi _a)) (@HierarchySituationTwoReorderedTrees.starVertexSet V E inst inst_1 inst_2 inst_3 G k e0 input T phi ett base C ctx (@HierarchySituationTwoCaseTwoData.toHierarchySituationTwoTailData V E diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean index 6e21c9dcea..0413d0519e 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean @@ -5,48 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoExclusions public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset /-! # Hierarchy Situation Two Subcase Two One Stored Exception diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean index 8315152d7c..4aafa9f84a 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean @@ -5,78 +5,9 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFullTailLength -public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix -public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoTwoData -public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.NineN -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.StableChangeCaseThree -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoFullTail -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TerminalRoute /-! # Hierarchy Situation Two Subcase Two Two diff --git a/LeanPool/GoldbergSeymour/HierarchySplitter.lean b/LeanPool/GoldbergSeymour/HierarchySplitter.lean index a365b47821..2b1c2162f9 100644 --- a/LeanPool/GoldbergSeymour/HierarchySplitter.lean +++ b/LeanPool/GoldbergSeymour/HierarchySplitter.lean @@ -7,13 +7,8 @@ module public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.ModColoring public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.Td - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/HierarchyStageMissingColors.lean b/LeanPool/GoldbergSeymour/HierarchyStageMissingColors.lean index 75df977852..a2dcf1beec 100644 --- a/LeanPool/GoldbergSeymour/HierarchyStageMissingColors.lean +++ b/LeanPool/GoldbergSeymour/HierarchyStageMissingColors.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HierarchyStarredStage +public import LeanPool.GoldbergSeymour.TashkinovHierarchy /-! # Hierarchy Stage Missing Colors diff --git a/LeanPool/GoldbergSeymour/HierarchyTailMissingColorExclusion.lean b/LeanPool/GoldbergSeymour/HierarchyTailMissingColorExclusion.lean index 151f711b69..949e4d15ab 100644 --- a/LeanPool/GoldbergSeymour/HierarchyTailMissingColorExclusion.lean +++ b/LeanPool/GoldbergSeymour/HierarchyTailMissingColorExclusion.lean @@ -6,42 +6,12 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyTailPrefix - -public import LeanPool.GoldbergSeymour.AdjacentEdges public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate public import LeanPool.GoldbergSeymour.RevisitingExtensionSeedStoredColor public import LeanPool.GoldbergSeymour.SimpleExtensionSeedStoredColor -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Hierarchy Tail Missing Color Exclusion diff --git a/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColors.lean b/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColors.lean index 3e3aaadbb4..d7570417cd 100644 --- a/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColors.lean +++ b/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColors.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt +public import LeanPool.GoldbergSeymour.TashkinovHierarchy /-! # Hierarchy Terminal Stored Colors diff --git a/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColorsSubsetLast.lean b/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColorsSubsetLast.lean index 8d8204de1a..29fb6e73e0 100644 --- a/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColorsSubsetLast.lean +++ b/LeanPool/GoldbergSeymour/HierarchyTerminalStoredColorsSubsetLast.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors +public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt /-! # Hierarchy Terminal Stored Colors Subset Last diff --git a/LeanPool/GoldbergSeymour/HierarchyWeaklyStable.lean b/LeanPool/GoldbergSeymour/HierarchyWeaklyStable.lean index 2439de5ef0..2c06acbd96 100644 --- a/LeanPool/GoldbergSeymour/HierarchyWeaklyStable.lean +++ b/LeanPool/GoldbergSeymour/HierarchyWeaklyStable.lean @@ -6,9 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt - public import LeanPool.GoldbergSeymour.TreeColoringInvariant +public import LeanPool.GoldbergSeymour.TashkinovHierarchy /-! # Hierarchy Weakly Stable diff --git a/LeanPool/GoldbergSeymour/HkuIncidentColorPreserved.lean b/LeanPool/GoldbergSeymour/HkuIncidentColorPreserved.lean index 3d287413ac..0759bdb0c9 100644 --- a/LeanPool/GoldbergSeymour/HkuIncidentColorPreserved.lean +++ b/LeanPool/GoldbergSeymour/HkuIncidentColorPreserved.lean @@ -6,19 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeExit -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Hku Incident Color Preserved diff --git a/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean b/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean index 5e035784df..bfc7d74299 100644 --- a/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean +++ b/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean @@ -7,8 +7,6 @@ module public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo - /-! # Hku Missing Stored Monotone diff --git a/LeanPool/GoldbergSeymour/HkuParallelBoundaryStructure.lean b/LeanPool/GoldbergSeymour/HkuParallelBoundaryStructure.lean index 75463ea3a6..f497557515 100644 --- a/LeanPool/GoldbergSeymour/HkuParallelBoundaryStructure.lean +++ b/LeanPool/GoldbergSeymour/HkuParallelBoundaryStructure.lean @@ -6,12 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary - public import LeanPool.GoldbergSeymour.TashkinovSeries - public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo - -public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion /-! # Hku Parallel Boundary Structure diff --git a/LeanPool/GoldbergSeymour/HkuTreeColorsControlled.lean b/LeanPool/GoldbergSeymour/HkuTreeColorsControlled.lean index fe02e0301f..a3046cbee8 100644 --- a/LeanPool/GoldbergSeymour/HkuTreeColorsControlled.lean +++ b/LeanPool/GoldbergSeymour/HkuTreeColorsControlled.lean @@ -6,19 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HkuIncidentColorPreserved -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeUsedColors /-! diff --git a/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean b/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean index 7566665698..78a6bb57fb 100644 --- a/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean +++ b/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean @@ -6,9 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TashkinovSeries - public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Hku Unsupported Vertex Colors diff --git a/LeanPool/GoldbergSeymour/IncidentCoreChromaticIndex.lean b/LeanPool/GoldbergSeymour/IncidentCoreChromaticIndex.lean index c4402886b3..acd2a5e83a 100644 --- a/LeanPool/GoldbergSeymour/IncidentCoreChromaticIndex.lean +++ b/LeanPool/GoldbergSeymour/IncidentCoreChromaticIndex.lean @@ -5,9 +5,9 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.ChromaticIndexSpec public import LeanPool.GoldbergSeymour.IncidentCoreColoringTransport +public import LeanPool.GoldbergSeymour.IncidentVertexFintype /-! # Incident Core Chromatic Index diff --git a/LeanPool/GoldbergSeymour/IncidentCoreColoringTransport.lean b/LeanPool/GoldbergSeymour/IncidentCoreColoringTransport.lean index 8983c35678..34973e1166 100644 --- a/LeanPool/GoldbergSeymour/IncidentCoreColoringTransport.lean +++ b/LeanPool/GoldbergSeymour/IncidentCoreColoringTransport.lean @@ -7,7 +7,6 @@ module public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.IncidentCoreIncidence -public import LeanPool.GoldbergSeymour.IncidentVertexFintype public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.RestrictEdges diff --git a/LeanPool/GoldbergSeymour/IncidentCoreDegree.lean b/LeanPool/GoldbergSeymour/IncidentCoreDegree.lean index ca25cca4c6..918a075fa0 100644 --- a/LeanPool/GoldbergSeymour/IncidentCoreDegree.lean +++ b/LeanPool/GoldbergSeymour/IncidentCoreDegree.lean @@ -8,7 +8,6 @@ module public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.Degree public import LeanPool.GoldbergSeymour.IncidentCoreIncidence -public import LeanPool.GoldbergSeymour.IncidentVertexFintype /-! # Incident Core Degree diff --git a/LeanPool/GoldbergSeymour/IncidentCoreMaximumDegree.lean b/LeanPool/GoldbergSeymour/IncidentCoreMaximumDegree.lean index b76159c30c..8a5afbfae5 100644 --- a/LeanPool/GoldbergSeymour/IncidentCoreMaximumDegree.lean +++ b/LeanPool/GoldbergSeymour/IncidentCoreMaximumDegree.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.IncidentCoreDegree public import LeanPool.GoldbergSeymour.MaximumDegree +public import LeanPool.GoldbergSeymour.IncidentVertexFintype /-! # Incident Core Maximum Degree diff --git a/LeanPool/GoldbergSeymour/IncidentCoreMissingColors.lean b/LeanPool/GoldbergSeymour/IncidentCoreMissingColors.lean index 1391c382af..64b0cef048 100644 --- a/LeanPool/GoldbergSeymour/IncidentCoreMissingColors.lean +++ b/LeanPool/GoldbergSeymour/IncidentCoreMissingColors.lean @@ -6,8 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.IncidentCoreIncidence -public import LeanPool.GoldbergSeymour.IncidentVertexFintype public import LeanPool.GoldbergSeymour.MissingColors +public import Mathlib.Data.Fintype.EquivFin /-! # Incident Core Missing Colors diff --git a/LeanPool/GoldbergSeymour/IncidentVertexFintype.lean b/LeanPool/GoldbergSeymour/IncidentVertexFintype.lean index b5413564ee..7bd1be038d 100644 --- a/LeanPool/GoldbergSeymour/IncidentVertexFintype.lean +++ b/LeanPool/GoldbergSeymour/IncidentVertexFintype.lean @@ -5,9 +5,8 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.Basic - public import LeanPool.GoldbergSeymour.IncidentVertex +public import Mathlib.Data.Fintype.Sets /-! # Incident Vertex Fintype diff --git a/LeanPool/GoldbergSeymour/InterchangePEClosureConstituent.lean b/LeanPool/GoldbergSeymour/InterchangePEClosureConstituent.lean index 4f1b817240..3797a7c3b5 100644 --- a/LeanPool/GoldbergSeymour/InterchangePEClosureConstituent.lean +++ b/LeanPool/GoldbergSeymour/InterchangePEClosureConstituent.lean @@ -5,53 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtensionRules public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PartialEdgeColoring public import LeanPool.GoldbergSeymour.ParallelTerminalFacts -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesData -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/InterchangePECommonMissingClosed.lean b/LeanPool/GoldbergSeymour/InterchangePECommonMissingClosed.lean index 83dea96992..c90517b623 100644 --- a/LeanPool/GoldbergSeymour/InterchangePECommonMissingClosed.lean +++ b/LeanPool/GoldbergSeymour/InterchangePECommonMissingClosed.lean @@ -5,10 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved - -public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase +public import LeanPool.GoldbergSeymour.CombinedStableColoring +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Interchange PECommon Missing Closed diff --git a/LeanPool/GoldbergSeymour/InterchangePETreeAwayFromDelta.lean b/LeanPool/GoldbergSeymour/InterchangePETreeAwayFromDelta.lean index 64f152620c..756311bc45 100644 --- a/LeanPool/GoldbergSeymour/InterchangePETreeAwayFromDelta.lean +++ b/LeanPool/GoldbergSeymour/InterchangePETreeAwayFromDelta.lean @@ -5,54 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.DefectiveColor public import LeanPool.GoldbergSeymour.ElementarySingleBoundaryInterchangeable -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtensionBase public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable -public import LeanPool.GoldbergSeymour.PartialEdgeColoring -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/InterchangePETreeConstituent.lean b/LeanPool/GoldbergSeymour/InterchangePETreeConstituent.lean index f94ee5b270..761d33c39a 100644 --- a/LeanPool/GoldbergSeymour/InterchangePETreeConstituent.lean +++ b/LeanPool/GoldbergSeymour/InterchangePETreeConstituent.lean @@ -5,41 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.InterchangePEClosedCore -public import LeanPool.GoldbergSeymour.InterchangePECommonMissingClosed -public import LeanPool.GoldbergSeymour.InterchangePETreeAwayFromDelta -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.PartialEdgeColoring -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/LargeOrderTerminalWitness.lean b/LeanPool/GoldbergSeymour/LargeOrderTerminalWitness.lean index 0cdd0dc724..751355612d 100644 --- a/LeanPool/GoldbergSeymour/LargeOrderTerminalWitness.lean +++ b/LeanPool/GoldbergSeymour/LargeOrderTerminalWitness.lean @@ -6,13 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.AlgorithmThreeOneInitialSeriesExists -public import LeanPool.GoldbergSeymour.AlgorithmThreeOneStepExists -public import LeanPool.GoldbergSeymour.MaximumProperty public import LeanPool.GoldbergSeymour.PositiveWellDefinedness public import LeanPool.GoldbergSeymour.CertifiedSeriesRoundsBound -public import LeanPool.GoldbergSeymour.TashkinovSeriesDataAppend -public import LeanPool.GoldbergSeymour.TashkinovSeriesFinalETTExists -public import LeanPool.GoldbergSeymour.TechnicalTheoremLarge /-! # Large Order Terminal Witness diff --git a/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean b/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean index 448a88b7fa..cabdea181d 100644 --- a/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean +++ b/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean @@ -7,16 +7,9 @@ module public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport /-! # P2905_T2_Late Owner Replacement diff --git a/LeanPool/GoldbergSeymour/LooplessMultigraph.lean b/LeanPool/GoldbergSeymour/LooplessMultigraph.lean index 63a33853a9..75127d97c4 100644 --- a/LeanPool/GoldbergSeymour/LooplessMultigraph.lean +++ b/LeanPool/GoldbergSeymour/LooplessMultigraph.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Preamble +public import Mathlib.Data.Sym.Sym2 /-! # Loopless Multigraph diff --git a/LeanPool/GoldbergSeymour/LowerRoundInductionHypothesis.lean b/LeanPool/GoldbergSeymour/LowerRoundInductionHypothesis.lean index f9fc9e765f..f7133ae859 100644 --- a/LeanPool/GoldbergSeymour/LowerRoundInductionHypothesis.lean +++ b/LeanPool/GoldbergSeymour/LowerRoundInductionHypothesis.lean @@ -5,18 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary - -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex - public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.ModColoring - -public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex - -public import LeanPool.GoldbergSeymour.TreeInterchangeable - public import LeanPool.GoldbergSeymour.LowerRoundProperties /-! diff --git a/LeanPool/GoldbergSeymour/LowerRoundProperties.lean b/LeanPool/GoldbergSeymour/LowerRoundProperties.lean index af456fe36d..b72e5da838 100644 --- a/LeanPool/GoldbergSeymour/LowerRoundProperties.lean +++ b/LeanPool/GoldbergSeymour/LowerRoundProperties.lean @@ -7,14 +7,9 @@ module public import LeanPool.GoldbergSeymour.BoundaryColorVertex public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary - public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex - -public import LeanPool.GoldbergSeymour.MaximumProperty public import LeanPool.GoldbergSeymour.ModColoring - public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex - public import LeanPool.GoldbergSeymour.TreeInterchangeable /-! diff --git a/LeanPool/GoldbergSeymour/MaximumStableClosureExists.lean b/LeanPool/GoldbergSeymour/MaximumStableClosureExists.lean index 8da376f399..cae9c009c3 100644 --- a/LeanPool/GoldbergSeymour/MaximumStableClosureExists.lean +++ b/LeanPool/GoldbergSeymour/MaximumStableClosureExists.lean @@ -6,11 +6,11 @@ Authors: Wesley Pegden module public import Mathlib.Data.Finset.Max - public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.TashkinovClosure +public import Mathlib.Data.Fintype.Card /-! # Maximum Stable Closure Exists diff --git a/LeanPool/GoldbergSeymour/MissingColorIncidenceEndpoint.lean b/LeanPool/GoldbergSeymour/MissingColorIncidenceEndpoint.lean index e2d0f8c396..daa3ee2ffc 100644 --- a/LeanPool/GoldbergSeymour/MissingColorIncidenceEndpoint.lean +++ b/LeanPool/GoldbergSeymour/MissingColorIncidenceEndpoint.lean @@ -5,11 +5,11 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin - public import LeanPool.GoldbergSeymour.MissingColors - -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo +public import Mathlib.Basic.Finite.Sum +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import Mathlib.Combinatorics.SimpleGraph.Finite +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring /-! # Missing Color Incidence Endpoint diff --git a/LeanPool/GoldbergSeymour/MissingColorsNonemptyOfMaximumDegree.lean b/LeanPool/GoldbergSeymour/MissingColorsNonemptyOfMaximumDegree.lean index 8d8ba81512..da4bac7057 100644 --- a/LeanPool/GoldbergSeymour/MissingColorsNonemptyOfMaximumDegree.lean +++ b/LeanPool/GoldbergSeymour/MissingColorsNonemptyOfMaximumDegree.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.MaximumDegree public import LeanPool.GoldbergSeymour.MissingColors +public import Mathlib.Data.Fintype.EquivFin /-! # Missing Colors Nonempty Of Maximum Degree diff --git a/LeanPool/GoldbergSeymour/MixedNoClosedTransport.lean b/LeanPool/GoldbergSeymour/MixedNoClosedTransport.lean index 1116adfb7d..36e1771c04 100644 --- a/LeanPool/GoldbergSeymour/MixedNoClosedTransport.lean +++ b/LeanPool/GoldbergSeymour/MixedNoClosedTransport.lean @@ -5,78 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed -public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchyPathNumber -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent -public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! # Preparatory lemmas for hierarchy normalization diff --git a/LeanPool/GoldbergSeymour/NineN.lean b/LeanPool/GoldbergSeymour/NineN.lean index ace10543ed..1ba8c2efb3 100644 --- a/LeanPool/GoldbergSeymour/NineN.lean +++ b/LeanPool/GoldbergSeymour/NineN.lean @@ -6,29 +6,12 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.Degree public import LeanPool.GoldbergSeymour.GoodHierarchy public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequencePrefix public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import Mathlib.Algebra.BigOperators.Group.Finset.Basic public import Mathlib.Algebra.Order.BigOperators.Group.Finset -public import Mathlib.Order.Fin.Basic /-! # Nine N diff --git a/LeanPool/GoldbergSeymour/NormalGlobalMaximumTriple.lean b/LeanPool/GoldbergSeymour/NormalGlobalMaximumTriple.lean index 64f059c13c..b1dfaece3e 100644 --- a/LeanPool/GoldbergSeymour/NormalGlobalMaximumTriple.lean +++ b/LeanPool/GoldbergSeymour/NormalGlobalMaximumTriple.lean @@ -5,10 +5,9 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Combinatorics.SimpleGraph.Walk.Traversal public import LeanPool.GoldbergSeymour.GlobalMaximumTriple - public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import Mathlib.Combinatorics.SimpleGraph.Paths /-! # Normal Global Maximum Triple diff --git a/LeanPool/GoldbergSeymour/NormalizePositiveTerminalMaximum.lean b/LeanPool/GoldbergSeymour/NormalizePositiveTerminalMaximum.lean index 7d512cce7d..2da162e077 100644 --- a/LeanPool/GoldbergSeymour/NormalizePositiveTerminalMaximum.lean +++ b/LeanPool/GoldbergSeymour/NormalizePositiveTerminalMaximum.lean @@ -5,14 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.CorrespondingTerminalClosureEq -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport public import LeanPool.GoldbergSeymour.MaximumStableClosureExists public import LeanPool.GoldbergSeymour.TechnicalTheoremLarge public import LeanPool.GoldbergSeymour.TerminalClosureMaximum -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeUnique -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Normalize Positive Terminal Maximum diff --git a/LeanPool/GoldbergSeymour/OneAdditionPreparatoryLemmas.lean b/LeanPool/GoldbergSeymour/OneAdditionPreparatoryLemmas.lean index e1710381ec..ccdf63e6f5 100644 --- a/LeanPool/GoldbergSeymour/OneAdditionPreparatoryLemmas.lean +++ b/LeanPool/GoldbergSeymour/OneAdditionPreparatoryLemmas.lean @@ -5,78 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.ChangeLemmaBothInside -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport -public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchyNonparallelFirstEdge -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableChange -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability -public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! # Preparatory lemmas for hierarchy normalization diff --git a/LeanPool/GoldbergSeymour/OneDividerRefresh.lean b/LeanPool/GoldbergSeymour/OneDividerRefresh.lean index 5c5dc6f939..232d3e64b9 100644 --- a/LeanPool/GoldbergSeymour/OneDividerRefresh.lean +++ b/LeanPool/GoldbergSeymour/OneDividerRefresh.lean @@ -10,7 +10,6 @@ public import LeanPool.GoldbergSeymour.GoodHierarchy public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary diff --git a/LeanPool/GoldbergSeymour/OrderedTreeUnion.lean b/LeanPool/GoldbergSeymour/OrderedTreeUnion.lean index 6b72b9c824..3530a5aff0 100644 --- a/LeanPool/GoldbergSeymour/OrderedTreeUnion.lean +++ b/LeanPool/GoldbergSeymour/OrderedTreeUnion.lean @@ -5,7 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet diff --git a/LeanPool/GoldbergSeymour/OutsideExitTransport.lean b/LeanPool/GoldbergSeymour/OutsideExitTransport.lean index e098374a5b..c0c3e46cfd 100644 --- a/LeanPool/GoldbergSeymour/OutsideExitTransport.lean +++ b/LeanPool/GoldbergSeymour/OutsideExitTransport.lean @@ -5,14 +5,11 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap public import LeanPool.GoldbergSeymour.TreeColorSetClosed public import LeanPool.GoldbergSeymour.TreeExitPath -public import Mathlib.Combinatorics.SimpleGraph.Paths - /-! # P2716_T1_Outside Exit Transport diff --git a/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean b/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean index 4beb349945..b7abbf89d9 100644 --- a/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean +++ b/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean @@ -8,19 +8,10 @@ module public import LeanPool.GoldbergSeymour.SplitSwapData public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.TerminalStoredColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerTransport public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerReconstruction public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTransTrees -public import LeanPool.GoldbergSeymour.LowerRoundProperties - /-! # P2880_T1_Outside Prefix Branch diff --git a/LeanPool/GoldbergSeymour/ParallelBaseFourCommonMissingColors.lean b/LeanPool/GoldbergSeymour/ParallelBaseFourCommonMissingColors.lean index 0463d7063a..cce42d4b5e 100644 --- a/LeanPool/GoldbergSeymour/ParallelBaseFourCommonMissingColors.lean +++ b/LeanPool/GoldbergSeymour/ParallelBaseFourCommonMissingColors.lean @@ -26,7 +26,7 @@ open scoped Sym2 theorem ParallelBaseFourCommonMissingColors {V E : Type*} [Fintype V] [Fintype E] - [ DecidableEq V] [ DecidableEq E] + [DecidableEq V] [DecidableEq E] {G : LooplessMultigraph V E} {k : Nat} {e0 : E} {input : PartialEdgeColoring E k} {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} diff --git a/LeanPool/GoldbergSeymour/ParallelClosureUnionElementary.lean b/LeanPool/GoldbergSeymour/ParallelClosureUnionElementary.lean index 9cac2cd146..a821f0928f 100644 --- a/LeanPool/GoldbergSeymour/ParallelClosureUnionElementary.lean +++ b/LeanPool/GoldbergSeymour/ParallelClosureUnionElementary.lean @@ -9,8 +9,8 @@ public import LeanPool.GoldbergSeymour.ParallelSupportClosureProperties public import LeanPool.GoldbergSeymour.ParallelTerminalAwayInterchangeable public import LeanPool.GoldbergSeymour.ParallelTerminalPEPreprocessing public import LeanPool.GoldbergSeymour.ParallelTwoConstituentPathContradiction - public import LeanPool.GoldbergSeymour.Td +public import LeanPool.GoldbergSeymour.Basic2 /-! # Parallel Closure Union Elementary diff --git a/LeanPool/GoldbergSeymour/ParallelCoreAugmentationStrict.lean b/LeanPool/GoldbergSeymour/ParallelCoreAugmentationStrict.lean index db61cd05b2..46492444f9 100644 --- a/LeanPool/GoldbergSeymour/ParallelCoreAugmentationStrict.lean +++ b/LeanPool/GoldbergSeymour/ParallelCoreAugmentationStrict.lean @@ -5,35 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveEdge -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OrderedTreeUnion public import LeanPool.GoldbergSeymour.OrderedTreeUnionAugmentationSequence -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Parallel Core Augmentation Strict diff --git a/LeanPool/GoldbergSeymour/ParallelExtensionColorAppend.lean b/LeanPool/GoldbergSeymour/ParallelExtensionColorAppend.lean index ffe774a921..07cfb3eb01 100644 --- a/LeanPool/GoldbergSeymour/ParallelExtensionColorAppend.lean +++ b/LeanPool/GoldbergSeymour/ParallelExtensionColorAppend.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.ParallelExtensionColor public import LeanPool.GoldbergSeymour.TashkinovSeriesDataAppend +public import Mathlib.Data.Fintype.EquivFin /-! # Parallel Extension Color Append diff --git a/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean b/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean index b954122540..d3366d18b6 100644 --- a/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean +++ b/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean @@ -5,31 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.DefectiveVertex public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeExit -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Parallel Extension Undo Stable diff --git a/LeanPool/GoldbergSeymour/ParallelSpecialClosurePreparation.lean b/LeanPool/GoldbergSeymour/ParallelSpecialClosurePreparation.lean index 6198560d51..87452c54da 100644 --- a/LeanPool/GoldbergSeymour/ParallelSpecialClosurePreparation.lean +++ b/LeanPool/GoldbergSeymour/ParallelSpecialClosurePreparation.lean @@ -6,16 +6,11 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.AlgorithmFiveFiveBaseStage - public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTransTrees - public import LeanPool.GoldbergSeymour.ParallelBaseFourCommonMissingColors public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed public import LeanPool.GoldbergSeymour.ParallelCoreAugmentationStrict - -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceStrictBoundaryWitness - public import LeanPool.GoldbergSeymour.PredecessorElementary public import LeanPool.GoldbergSeymour.ClosedCoreElementary public import LeanPool.GoldbergSeymour.CoreClosurePresentation diff --git a/LeanPool/GoldbergSeymour/ParallelStepRootComponentSetup.lean b/LeanPool/GoldbergSeymour/ParallelStepRootComponentSetup.lean index acb3596e45..a2f19cc702 100644 --- a/LeanPool/GoldbergSeymour/ParallelStepRootComponentSetup.lean +++ b/LeanPool/GoldbergSeymour/ParallelStepRootComponentSetup.lean @@ -5,21 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeExit -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo public import LeanPool.GoldbergSeymour.TwoColorPathComponent diff --git a/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean b/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean index 62a1ebf6f7..ab38922676 100644 --- a/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean +++ b/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean @@ -6,36 +6,11 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.InternalEdges -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.KTriple public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep public import LeanPool.GoldbergSeymour.TechnicalInductionContext public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Parallel Support Closure Properties diff --git a/LeanPool/GoldbergSeymour/ParallelTerminalAwayInterchangeable.lean b/LeanPool/GoldbergSeymour/ParallelTerminalAwayInterchangeable.lean index 076213b642..05caa09c6f 100644 --- a/LeanPool/GoldbergSeymour/ParallelTerminalAwayInterchangeable.lean +++ b/LeanPool/GoldbergSeymour/ParallelTerminalAwayInterchangeable.lean @@ -6,24 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ParallelExtensionColor public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.TechnicalInductionContext public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent /-! # Parallel Terminal Away Interchangeable diff --git a/LeanPool/GoldbergSeymour/ParallelTerminalPEPreprocessing.lean b/LeanPool/GoldbergSeymour/ParallelTerminalPEPreprocessing.lean index 4aef0050a0..25e93b3f72 100644 --- a/LeanPool/GoldbergSeymour/ParallelTerminalPEPreprocessing.lean +++ b/LeanPool/GoldbergSeymour/ParallelTerminalPEPreprocessing.lean @@ -5,44 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Basic2 -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveEdge -public import LeanPool.GoldbergSeymour.DefectiveVertex public import LeanPool.GoldbergSeymour.ExtensionBase public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep public import LeanPool.GoldbergSeymour.TechnicalInductionContext -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Parallel Terminal PEPreprocessing diff --git a/LeanPool/GoldbergSeymour/PartialEdgeColoring.lean b/LeanPool/GoldbergSeymour/PartialEdgeColoring.lean index 1dd5eafbae..642f50e41f 100644 --- a/LeanPool/GoldbergSeymour/PartialEdgeColoring.lean +++ b/LeanPool/GoldbergSeymour/PartialEdgeColoring.lean @@ -5,7 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Preamble +public import Mathlib.Data.Sym.Sym2.Init +public import Mathlib.Data.Finset.Attr +public import Mathlib.Tactic.SetLike +public import Mathlib.Tactic.Finiteness.Attr +public import Mathlib.Data.Nat.Notation /-! # Partial Edge Coloring diff --git a/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean b/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean index 1b683d25f0..204f7211e3 100644 --- a/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean +++ b/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean @@ -7,33 +7,15 @@ module public import LeanPool.GoldbergSeymour.CertifiedETTRestriction public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice public import LeanPool.GoldbergSeymour.MaximumProperty public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors public import LeanPool.GoldbergSeymour.TdEarlierPEWitnessIdentification public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent -public import LeanPool.GoldbergSeymour.TwoColorPathComponent public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion - public import LeanPool.GoldbergSeymour.RevisitingCertificatePreparation /-! diff --git a/LeanPool/GoldbergSeymour/Preamble.lean b/LeanPool/GoldbergSeymour/Preamble.lean index 02e1c3f1fc..378c6fff8a 100644 --- a/LeanPool/GoldbergSeymour/Preamble.lean +++ b/LeanPool/GoldbergSeymour/Preamble.lean @@ -5,7 +5,10 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Sym.Sym2 +public import Mathlib.Data.Sym.Sym2.Init +public import Mathlib.Data.Finset.Attr +public import Mathlib.Tactic.SetLike +public import Mathlib.Tactic.Finiteness.Attr /-! # Preamble diff --git a/LeanPool/GoldbergSeymour/PresentColors.lean b/LeanPool/GoldbergSeymour/PresentColors.lean index 16b754fb9b..93598df188 100644 --- a/LeanPool/GoldbergSeymour/PresentColors.lean +++ b/LeanPool/GoldbergSeymour/PresentColors.lean @@ -5,10 +5,9 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.Fin - public import LeanPool.GoldbergSeymour.Incident public import LeanPool.GoldbergSeymour.PartialEdgeColoring +public import Mathlib.Data.Fintype.Basic /-! # Present Colors diff --git a/LeanPool/GoldbergSeymour/RestrictedAugmentationCorrespondingEndpoint.lean b/LeanPool/GoldbergSeymour/RestrictedAugmentationCorrespondingEndpoint.lean index 04950ca69a..418a4f58b7 100644 --- a/LeanPool/GoldbergSeymour/RestrictedAugmentationCorrespondingEndpoint.lean +++ b/LeanPool/GoldbergSeymour/RestrictedAugmentationCorrespondingEndpoint.lean @@ -5,20 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.MaximumProperty public import LeanPool.GoldbergSeymour.MaximumPropertyTransport public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment /-! # Restricted Augmentation Corresponding Endpoint diff --git a/LeanPool/GoldbergSeymour/RetainedHierarchy.lean b/LeanPool/GoldbergSeymour/RetainedHierarchy.lean index d9c2ccea10..45b33079c8 100644 --- a/LeanPool/GoldbergSeymour/RetainedHierarchy.lean +++ b/LeanPool/GoldbergSeymour/RetainedHierarchy.lean @@ -9,7 +9,6 @@ public import LeanPool.GoldbergSeymour.MinusClosedTransport public import LeanPool.GoldbergSeymour.PrefixSegmentTransport public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.BoundaryColorEdges /-! # P2813_T1_Retained Hierarchy diff --git a/LeanPool/GoldbergSeymour/RevisitingCertificatePreparation.lean b/LeanPool/GoldbergSeymour/RevisitingCertificatePreparation.lean index f956cc3373..e8df9e3bcd 100644 --- a/LeanPool/GoldbergSeymour/RevisitingCertificatePreparation.lean +++ b/LeanPool/GoldbergSeymour/RevisitingCertificatePreparation.lean @@ -5,34 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TdEarlierPEWitnessIdentification -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion /-! # Revisiting extension kinds in certified prefixes diff --git a/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean b/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean index 535b8515d4..82804d0787 100644 --- a/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean +++ b/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean @@ -6,60 +6,13 @@ Authors: Wesley Pegden module -public import LeanPool.GoldbergSeymour.Basic2 -public import LeanPool.GoldbergSeymour.TdEarlierPEWitnessIdentification -public import LeanPool.GoldbergSeymour.TdReplacementPrefixExact -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveEdge -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtensionBase -public import LeanPool.GoldbergSeymour.ExtensionRules -public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovClosureExists -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesAppend -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeExit -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion -public import LeanPool.GoldbergSeymour.StableColoringEquivalence public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis +public import LeanPool.GoldbergSeymour.TashkinovSeriesDataAppend +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset /-! # Preparation for a revisiting terminal rebuild diff --git a/LeanPool/GoldbergSeymour/RutgersMiddleExitOutsideTerminalLadder.lean b/LeanPool/GoldbergSeymour/RutgersMiddleExitOutsideTerminalLadder.lean index 72616cde2d..d17d409d5f 100644 --- a/LeanPool/GoldbergSeymour/RutgersMiddleExitOutsideTerminalLadder.lean +++ b/LeanPool/GoldbergSeymour/RutgersMiddleExitOutsideTerminalLadder.lean @@ -5,56 +5,16 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone public import LeanPool.GoldbergSeymour.HkuParallelBoundaryStructure -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable -public import LeanPool.GoldbergSeymour.ParallelExtensionColor public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RutgersClosedPresentation public import LeanPool.GoldbergSeymour.RutgersCounterexample -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors public import LeanPool.GoldbergSeymour.TreeMissingColorsCardLowerBound -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorComponentSwapDisjointPairGraph -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # Rutgers Middle Exit Outside Terminal Ladder diff --git a/LeanPool/GoldbergSeymour/RutgersStrictShortening.lean b/LeanPool/GoldbergSeymour/RutgersStrictShortening.lean index 2e6a7f7348..fd1201bc5a 100644 --- a/LeanPool/GoldbergSeymour/RutgersStrictShortening.lean +++ b/LeanPool/GoldbergSeymour/RutgersStrictShortening.lean @@ -5,57 +5,20 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTransTrees -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumProperty public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RutgersClosedPresentation -public import LeanPool.GoldbergSeymour.RutgersCounterexample public import LeanPool.GoldbergSeymour.RutgersCounterexampleMeasure -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure public import LeanPool.GoldbergSeymour.TashkinovClosureExists -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.StableColoringEquivalence public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge diff --git a/LeanPool/GoldbergSeymour/ScheideAbsorbingElementary.lean b/LeanPool/GoldbergSeymour/ScheideAbsorbingElementary.lean index fca220cce1..4d7ba43eb6 100644 --- a/LeanPool/GoldbergSeymour/ScheideAbsorbingElementary.lean +++ b/LeanPool/GoldbergSeymour/ScheideAbsorbingElementary.lean @@ -5,8 +5,6 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin - public import LeanPool.GoldbergSeymour.AbsorbingVertices public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFourFree diff --git a/LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumOrder.lean b/LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumOrder.lean index 8ccfcc4733..9e99c4bbf8 100644 --- a/LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumOrder.lean +++ b/LeanPool/GoldbergSeymour/ScheideBalancedCandidateMaximumOrder.lean @@ -5,29 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.NormalTripleTrunk -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideBalancedCandidate public import LeanPool.GoldbergSeymour.TashTree -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors - public import LeanPool.GoldbergSeymour.TashkinovOrderBound /-! diff --git a/LeanPool/GoldbergSeymour/ScheideBalancedFromMaxNormal.lean b/LeanPool/GoldbergSeymour/ScheideBalancedFromMaxNormal.lean index 4589728dcb..a886d4a7a8 100644 --- a/LeanPool/GoldbergSeymour/ScheideBalancedFromMaxNormal.lean +++ b/LeanPool/GoldbergSeymour/ScheideBalancedFromMaxNormal.lean @@ -6,9 +6,6 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple - -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder - public import LeanPool.GoldbergSeymour.ScheideBalancedCandidateMaximumExists public import LeanPool.GoldbergSeymour.ScheideBalancedCandidateMaximumOrder public import LeanPool.GoldbergSeymour.ScheideBalancedCandidateNormalTransport diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveChainBoundaryEdges.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveChainBoundaryEdges.lean index 9b00b59d33..6852ba1dae 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveChainBoundaryEdges.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveChainBoundaryEdges.lean @@ -5,37 +5,11 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph - -public import LeanPool.GoldbergSeymour.TashkinovOrderBound /-! # Scheide Defective Chain Boundary Edges diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveChainLastReturnNoFree.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveChainLastReturnNoFree.lean index 4e16c2abe8..51a487aac2 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveChainLastReturnNoFree.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveChainLastReturnNoFree.lean @@ -6,10 +6,10 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable - -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainDepartureReturn - public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.ScheideDepartureReturn +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused +public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts /-! # Scheide Defective Chain Last Return No Free diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveCrossingSelection.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveCrossingSelection.lean index bb4493813d..8361b65a04 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveCrossingSelection.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveCrossingSelection.lean @@ -5,23 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Defective Crossing Selection diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean index fc6341b91a..ddf687739d 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean @@ -6,34 +6,14 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData public import LeanPool.GoldbergSeymour.ScheideDefectiveSecondTerminalComponent public import LeanPool.GoldbergSeymour.ScheideDefectiveTerminalComponent public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration public import LeanPool.GoldbergSeymour.ScheideSelectedBlockDeletion -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Defective Deleted Tree Pair diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveLastReturnExists.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveLastReturnExists.lean index b4f0d1eacd..b29f1d3d06 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveLastReturnExists.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveLastReturnExists.lean @@ -5,27 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Defective Last Return Exists diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean index 255306e08e..a9e610a825 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean @@ -5,57 +5,10 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath public import LeanPool.GoldbergSeymour.ScheideDefectiveCrossingSelection public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup public import LeanPool.GoldbergSeymour.ScheideDefectiveTerminalComponent -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair public import LeanPool.GoldbergSeymour.ScheideSelectedBlockDeletion -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph - -public import LeanPool.GoldbergSeymour.TashkinovOrderBound /-! # Scheide Defective No Cross diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean index 7568aa9409..872ca0c87e 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean @@ -5,45 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveDeletedTreePair public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideDefectiveSecondTerminalComponent -public import LeanPool.GoldbergSeymour.ScheideDefectiveTerminalComponent public import LeanPool.GoldbergSeymour.ScheideDefectiveThirdBoundaryEdge public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper /-! # Scheide Defective Return Contradiction diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveSecondTerminalComponent.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveSecondTerminalComponent.lean index 93f9c89764..330e4a8195 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveSecondTerminalComponent.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveSecondTerminalComponent.lean @@ -5,32 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Defective Second Terminal Component diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveSetup.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveSetup.lean index 953361c1e3..b676b74d2b 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveSetup.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveSetup.lean @@ -6,7 +6,6 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.TreeMissingColors /-! # Scheide Defective Setup diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveTerminalComponent.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveTerminalComponent.lean index c72b0c7d6c..496373fd7a 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveTerminalComponent.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveTerminalComponent.lean @@ -5,22 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Defective Terminal Component diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean index fda172bed9..85a5490f25 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean @@ -5,46 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.InternalEdges -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideDefectiveDeletedTreePair public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData -public import LeanPool.GoldbergSeymour.ScheideDefectiveSecondTerminalComponent -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideDefectiveTerminalComponent -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph - -public import LeanPool.GoldbergSeymour.TashkinovOrderBound /-! # Scheide Defective Third Boundary Edge diff --git a/LeanPool/GoldbergSeymour/ScheideDepartureReturn.lean b/LeanPool/GoldbergSeymour/ScheideDepartureReturn.lean index 023b2e0f75..b6fffcc6e3 100644 --- a/LeanPool/GoldbergSeymour/ScheideDepartureReturn.lean +++ b/LeanPool/GoldbergSeymour/ScheideDepartureReturn.lean @@ -5,7 +5,6 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Combinatorics.SimpleGraph.Walk.Traversal public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath /-! diff --git a/LeanPool/GoldbergSeymour/ScheideEnlargedClosed.lean b/LeanPool/GoldbergSeymour/ScheideEnlargedClosed.lean index 0bb44b7c84..d5cc51580a 100644 --- a/LeanPool/GoldbergSeymour/ScheideEnlargedClosed.lean +++ b/LeanPool/GoldbergSeymour/ScheideEnlargedClosed.lean @@ -6,29 +6,10 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.ClosedSetTwoColorComponentAvoidance -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup public import LeanPool.GoldbergSeymour.ScheideEnlargedElementary public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReplacementData -public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum public import LeanPool.GoldbergSeymour.ScheideReplacementPairsLaminar public import LeanPool.GoldbergSeymour.ScheideReplacementUnionClosed -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper /-! # Scheide Enlarged Closed diff --git a/LeanPool/GoldbergSeymour/ScheideEnlargedStrictAugmentation.lean b/LeanPool/GoldbergSeymour/ScheideEnlargedStrictAugmentation.lean index 2ae1991f34..bf3e19b7d7 100644 --- a/LeanPool/GoldbergSeymour/ScheideEnlargedStrictAugmentation.lean +++ b/LeanPool/GoldbergSeymour/ScheideEnlargedStrictAugmentation.lean @@ -6,8 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ScheideReplacementData - public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap /-! # Scheide Enlarged Strict Augmentation diff --git a/LeanPool/GoldbergSeymour/ScheideEnlargedSwitchTransport.lean b/LeanPool/GoldbergSeymour/ScheideEnlargedSwitchTransport.lean index 80a59a1815..6a19755022 100644 --- a/LeanPool/GoldbergSeymour/ScheideEnlargedSwitchTransport.lean +++ b/LeanPool/GoldbergSeymour/ScheideEnlargedSwitchTransport.lean @@ -5,39 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect public import LeanPool.GoldbergSeymour.ScheideEnlargedBoundarySelection public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideReplacementData -public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase -public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Enlarged Switch Transport diff --git a/LeanPool/GoldbergSeymour/ScheideExitNoFree.lean b/LeanPool/GoldbergSeymour/ScheideExitNoFree.lean index 111a7f7054..68b59843a1 100644 --- a/LeanPool/GoldbergSeymour/ScheideExitNoFree.lean +++ b/LeanPool/GoldbergSeymour/ScheideExitNoFree.lean @@ -5,43 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColors public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges public import LeanPool.GoldbergSeymour.ScheideDefectiveChainDepartureReturn public import LeanPool.GoldbergSeymour.ScheideDefectiveChainLastReturnNoFree -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists -public import LeanPool.GoldbergSeymour.ScheideDepartureReturn -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertexTreeExit public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Exit No Free diff --git a/LeanPool/GoldbergSeymour/ScheideExitVertex.lean b/LeanPool/GoldbergSeymour/ScheideExitVertex.lean index 319996ec0d..ff9a74172f 100644 --- a/LeanPool/GoldbergSeymour/ScheideExitVertex.lean +++ b/LeanPool/GoldbergSeymour/ScheideExitVertex.lean @@ -5,7 +5,6 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Combinatorics.SimpleGraph.Walk.Traversal public import LeanPool.GoldbergSeymour.DefectiveColors public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath diff --git a/LeanPool/GoldbergSeymour/ScheideGlobalMaximumBoundaryFacts.lean b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumBoundaryFacts.lean index d31f57a396..c8e764ecab 100644 --- a/LeanPool/GoldbergSeymour/ScheideGlobalMaximumBoundaryFacts.lean +++ b/LeanPool/GoldbergSeymour/ScheideGlobalMaximumBoundaryFacts.lean @@ -6,11 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed - public import LeanPool.GoldbergSeymour.DefectiveColors - -public import LeanPool.GoldbergSeymour.InternalEdges - public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder /-! diff --git a/LeanPool/GoldbergSeymour/ScheideGraphHeightOdd.lean b/LeanPool/GoldbergSeymour/ScheideGraphHeightOdd.lean index 801ae5a3cd..2dcd20d433 100644 --- a/LeanPool/GoldbergSeymour/ScheideGraphHeightOdd.lean +++ b/LeanPool/GoldbergSeymour/ScheideGraphHeightOdd.lean @@ -5,17 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideGraphHeight public import LeanPool.GoldbergSeymour.ScheideNormalisation -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Graph Height Odd diff --git a/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean b/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean index 9588fb5407..ca7c77d531 100644 --- a/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean +++ b/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean @@ -5,32 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideGraphHeight public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound -public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Height Five Gamma Edges diff --git a/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean b/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean index c015482f0a..a99b696a88 100644 --- a/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean +++ b/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean @@ -5,27 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple public import LeanPool.GoldbergSeymour.ScheideGraphHeight public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound -public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph - public import LeanPool.GoldbergSeymour.TashkinovOrderBound /-! diff --git a/LeanPool/GoldbergSeymour/ScheideKempePathHeightBound.lean b/LeanPool/GoldbergSeymour/ScheideKempePathHeightBound.lean index ab628f8547..d96ac26c6a 100644 --- a/LeanPool/GoldbergSeymour/ScheideKempePathHeightBound.lean +++ b/LeanPool/GoldbergSeymour/ScheideKempePathHeightBound.lean @@ -5,27 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple public import LeanPool.GoldbergSeymour.ScheideGraphHeight public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal public import LeanPool.GoldbergSeymour.ScheideMaximumExtensionNormalWitness -public import LeanPool.GoldbergSeymour.ScheideMaximalExtendsEveryTree public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath public import LeanPool.GoldbergSeymour.ScheideReversedKempePathTree -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Kempe Path Height Bound diff --git a/LeanPool/GoldbergSeymour/ScheideLargeHeightElementary.lean b/LeanPool/GoldbergSeymour/ScheideLargeHeightElementary.lean index 99508ff4f4..00cde5a9b1 100644 --- a/LeanPool/GoldbergSeymour/ScheideLargeHeightElementary.lean +++ b/LeanPool/GoldbergSeymour/ScheideLargeHeightElementary.lean @@ -5,21 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Critical public import LeanPool.GoldbergSeymour.Elementary -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple public import LeanPool.GoldbergSeymour.GlobalMaximumTripleExists -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple public import LeanPool.GoldbergSeymour.ScheideBalancedExists -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideGraphHeight -public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd public import LeanPool.GoldbergSeymour.ScheideLargeHeightFullTrunk public import LeanPool.GoldbergSeymour.ScheideLargeHeightOneTailPair -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TreeSequence /-! # Scheide Large Height Elementary diff --git a/LeanPool/GoldbergSeymour/ScheideLargeHeightFullTrunk.lean b/LeanPool/GoldbergSeymour/ScheideLargeHeightFullTrunk.lean index e9983f3e47..413f4763ac 100644 --- a/LeanPool/GoldbergSeymour/ScheideLargeHeightFullTrunk.lean +++ b/LeanPool/GoldbergSeymour/ScheideLargeHeightFullTrunk.lean @@ -6,27 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.DefectiveColors public import LeanPool.GoldbergSeymour.Elementary -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainDepartureReturn -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists -public import LeanPool.GoldbergSeymour.ScheideDepartureReturn public import LeanPool.GoldbergSeymour.ScheideExitNoFree -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideGraphHeight -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors public import LeanPool.GoldbergSeymour.CriticalGraphElementaryWitness /-! diff --git a/LeanPool/GoldbergSeymour/ScheideLargeHeightOneTailPair.lean b/LeanPool/GoldbergSeymour/ScheideLargeHeightOneTailPair.lean index 2d12a82dc8..5ace570bb5 100644 --- a/LeanPool/GoldbergSeymour/ScheideLargeHeightOneTailPair.lean +++ b/LeanPool/GoldbergSeymour/ScheideLargeHeightOneTailPair.lean @@ -5,36 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.Elementary -public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.ScheideExitNoFree -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideGraphHeight public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound -public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration public import LeanPool.GoldbergSeymour.ScheideStructuralLemma -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Large Height One Tail Pair diff --git a/LeanPool/GoldbergSeymour/ScheideMaximalExtendsEveryTree.lean b/LeanPool/GoldbergSeymour/ScheideMaximalExtendsEveryTree.lean index 84b7c622a1..cbc3d6ea13 100644 --- a/LeanPool/GoldbergSeymour/ScheideMaximalExtendsEveryTree.lean +++ b/LeanPool/GoldbergSeymour/ScheideMaximalExtendsEveryTree.lean @@ -7,10 +7,7 @@ module public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree public import LeanPool.GoldbergSeymour.ScheideMaximalContainsEveryTree -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Maximal Extends Every Tree diff --git a/LeanPool/GoldbergSeymour/ScheideMaximalKempePath.lean b/LeanPool/GoldbergSeymour/ScheideMaximalKempePath.lean index 4b2fd5da27..96ef79db72 100644 --- a/LeanPool/GoldbergSeymour/ScheideMaximalKempePath.lean +++ b/LeanPool/GoldbergSeymour/ScheideMaximalKempePath.lean @@ -6,19 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.ScheideMaximalContainsEveryTree -public import LeanPool.GoldbergSeymour.ScheideMaximalElementaryClosed -public import LeanPool.GoldbergSeymour.TashTree -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TashkinovTreeComponentSwapWitnessTransport /-! # Scheide Maximal Kempe Path diff --git a/LeanPool/GoldbergSeymour/ScheideMaximalOddOrder.lean b/LeanPool/GoldbergSeymour/ScheideMaximalOddOrder.lean index 6b34e72649..4a31bc5605 100644 --- a/LeanPool/GoldbergSeymour/ScheideMaximalOddOrder.lean +++ b/LeanPool/GoldbergSeymour/ScheideMaximalOddOrder.lean @@ -5,9 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideMaximalElementaryClosed /-! diff --git a/LeanPool/GoldbergSeymour/ScheideMaximumExtensionNormalWitness.lean b/LeanPool/GoldbergSeymour/ScheideMaximumExtensionNormalWitness.lean index 73f77cd0a7..0c5b5f9f22 100644 --- a/LeanPool/GoldbergSeymour/ScheideMaximumExtensionNormalWitness.lean +++ b/LeanPool/GoldbergSeymour/ScheideMaximumExtensionNormalWitness.lean @@ -6,12 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple public import LeanPool.GoldbergSeymour.ScheideMaximalExtendsEveryTree public import LeanPool.GoldbergSeymour.ScheideReversedPathCertificate -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Maximum Extension Normal Witness diff --git a/LeanPool/GoldbergSeymour/ScheideNormalisation.lean b/LeanPool/GoldbergSeymour/ScheideNormalisation.lean index 1469db6c1a..e07a44ca8e 100644 --- a/LeanPool/GoldbergSeymour/ScheideNormalisation.lean +++ b/LeanPool/GoldbergSeymour/ScheideNormalisation.lean @@ -5,28 +5,13 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.NormalTripleTrunk public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumFixedPairMaximal public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts -public import LeanPool.GoldbergSeymour.ScheideMaximalExtendsEveryTree public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath public import LeanPool.GoldbergSeymour.ScheideMaximumExtensionNormalWitness public import LeanPool.GoldbergSeymour.ScheideReversedKempePathTree -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Normalisation diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineBlockCompletion.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineBlockCompletion.lean index 2ddd86afa9..7582b8f717 100644 --- a/LeanPool/GoldbergSeymour/ScheideOrderNineBlockCompletion.lean +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineBlockCompletion.lean @@ -7,31 +7,11 @@ module public import Mathlib.Tactic.FinCases public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideGraphHeight public import LeanPool.GoldbergSeymour.ScheideHeightFiveGammaEdges public import LeanPool.GoldbergSeymour.ScheideHeightFiveOutsideLinks -public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle public import LeanPool.GoldbergSeymour.ScheideTrunkRotationNormal public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # P2968_T2_Scheide Order Nine Block Completion diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean index 1f1eeac51c..17b1e880e5 100644 --- a/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean @@ -6,42 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ScheideOrderNineRebasingPreparation - -public import LeanPool.GoldbergSeymour.AdjacentEdges public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideOrderNineBlockCompletion -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideHeightFiveGammaEdges -public import LeanPool.GoldbergSeymour.ScheideHeightFiveOutsideLinks -public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationNormal -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationPreserves -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TrunkRotation -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import Mathlib.Tactic.FinCases /-! # Scheide Order Nine Block Structure @@ -1123,8 +1088,8 @@ private theorem helper_continuation_1913.{u_1, u_2} : scheideBlockContinuationSt obtain ⟨tc1, htc1⟩ := firstEight pc1' obtain ⟨tw, htw⟩ := firstSeven w let S' : TreeSequence G e := by - exact @helperS3810 (@V) (@E) inferInstance (@G) (@k) (@e) - (@S) (@hlen) (@f1) (@f2) (@v1) (@v2) (@hf1ends') (@hf2ends') (@beta56) + exact @helperS3810 (@V) (@E) inferInstance (@G) (@e) + (@S) (@hlen) (@f1) (@f2) (@v1) (@v2) (@hf1ends') (@hf2ends') (@beta56) (@hbeta56ends) (@ha1ends) (@ha3ends) (@w) (@pc) (@hc0ends) (@ha0eq) (@ha0ends) (@hedgeListLength) (@nv0) (@nv1) (@nv2) (@nv3) (@nv4) (@nv5) (@nv6) (@nv7) (@nv8) (@ne0) (@ne1) (@ne2) (@ne3) (@ne4) (@ne5) (@ne6) (@ne7) (@newVertex_injective) diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineExitLocalization.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineExitLocalization.lean index 2927bcb70f..ffec8c7229 100644 --- a/LeanPool/GoldbergSeymour/ScheideOrderNineExitLocalization.lean +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineExitLocalization.lean @@ -5,30 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideExitNoFree -public import LeanPool.GoldbergSeymour.ScheideExitVertex public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts -public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Order Nine Exit Localization diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineParameters.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineParameters.lean index 5f949df10e..3dc4155dd8 100644 --- a/LeanPool/GoldbergSeymour/ScheideOrderNineParameters.lean +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineParameters.lean @@ -6,15 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Critical public import LeanPool.GoldbergSeymour.Elementary -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd -public import LeanPool.GoldbergSeymour.ScheideLargeHeightElementary public import LeanPool.GoldbergSeymour.ScheideSmallHeightElementary -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Order Nine Parameters diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineRebasingPreparation.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineRebasingPreparation.lean index d7ce490074..70664da43a 100644 --- a/LeanPool/GoldbergSeymour/ScheideOrderNineRebasingPreparation.lean +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineRebasingPreparation.lean @@ -5,41 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideOrderNineBlockCompletion -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideHeightFiveGammaEdges -public import LeanPool.GoldbergSeymour.ScheideHeightFiveOutsideLinks -public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationNormal -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationPreserves -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TrunkRotation -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import Mathlib.Tactic.FinCases /-! # Scheide Order Nine Block Structure @@ -1119,12 +1088,9 @@ noncomputable abbrev helperS3810.{u_1, u_2} : open scoped Classical in {V : Type u_1} → {E : Type u_2} → - [ DecidableEq E] → (G : LooplessMultigraph V E) → - (k : ℕ) → {e : E} → - (S : TreeSequence G e) → (hlen : S.length = (8 : ℕ)) → let y0 : V := @@ -1462,7 +1428,7 @@ noncomputable abbrev helperS3810.{u_1, u_2} : G e := by classical - intro V E _ G k e S hlen y0 y1 y2 y3 y4 y7 y8 a1 a3 b0 c0 c1 f1 f2 v1 v2 hf1ends' hf2ends' beta56 + intro V E _ G e S hlen y0 y1 y2 y3 y4 y7 y8 a1 a3 b0 c0 c1 f1 f2 v1 v2 hf1ends' hf2ends' beta56 hbeta56ends ha1ends ha3ends r6' r7' w pc pc' hc0ends a0 ha0eq ha0ends cast9 permA permB newVertex edgeList hedgeListLength newEdge nv0 nv1 nv2 nv3 nv4 nv5 nv6 nv7 nv8 ne0 ne1 ne2 ne3 ne4 ne5 ne6 ne7 newVertex_injective newEdge_injective pc1 pc1' hc1ends tc0 htc0 tc1 htc1 @@ -1687,7 +1653,7 @@ abbrev helperHS'tash4523Conditions.{u_1, u_2} : Prop := ) tc1) = S.vertex (⟨(↑pc1' : ℕ), by omega ⟩ : Fin (S.length + (1 : ℕ)))) (tw : Fin (7 : ℕ)), - let S' : TreeSequence G e := helperS3810 G k S hlen f1 f2 v1 v2 hf1ends' hf2ends' beta56 + let S' : TreeSequence G e := helperS3810 G S hlen f1 f2 v1 v2 hf1ends' hf2ends' beta56 hbeta56ends ha1ends ha3ends w pc hc0ends ha0eq ha0ends hedgeListLength nv0 nv1 nv2 nv3 nv4 nv5 nv6 nv7 nv8 ne0 ne1 ne2 ne3 ne4 ne5 ne6 ne7 newVertex_injective newEdge_injective pc1 hc1ends tc0 htc0 tc1 htc1; diff --git a/LeanPool/GoldbergSeymour/ScheideOriginalDefectiveConfinement.lean b/LeanPool/GoldbergSeymour/ScheideOriginalDefectiveConfinement.lean index 51d3cc4c27..ba35681445 100644 --- a/LeanPool/GoldbergSeymour/ScheideOriginalDefectiveConfinement.lean +++ b/LeanPool/GoldbergSeymour/ScheideOriginalDefectiveConfinement.lean @@ -5,27 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet public import LeanPool.GoldbergSeymour.ScheideLastExitPath -public import LeanPool.GoldbergSeymour.ScheideReplacementData public import LeanPool.GoldbergSeymour.ScheideReplacementUnionClosed -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Original Defective Confinement diff --git a/LeanPool/GoldbergSeymour/ScheideOriginalNondefectiveConfinement.lean b/LeanPool/GoldbergSeymour/ScheideOriginalNondefectiveConfinement.lean index 0258c80850..51e46ba912 100644 --- a/LeanPool/GoldbergSeymour/ScheideOriginalNondefectiveConfinement.lean +++ b/LeanPool/GoldbergSeymour/ScheideOriginalNondefectiveConfinement.lean @@ -5,22 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideLastExitPath -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Original Nondefective Confinement diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementAbsorbing.lean b/LeanPool/GoldbergSeymour/ScheideReplacementAbsorbing.lean index f59fd54f47..76f66dacf7 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementAbsorbing.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementAbsorbing.lean @@ -5,36 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AbsorbingVertex public import LeanPool.GoldbergSeymour.AbsorbingVertices -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColors public import LeanPool.GoldbergSeymour.ElementarySingleBoundaryInterchangeable -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration public import LeanPool.GoldbergSeymour.ScheideReplacementData -public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal public import LeanPool.GoldbergSeymour.ScheideSymmetricMissingInternal -public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Replacement Absorbing diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtLeastThree.lean b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtLeastThree.lean index 28d9d258e7..c503389a32 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtLeastThree.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtLeastThree.lean @@ -5,35 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryParity -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Replacement Boundary At Least Three diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean index ba61c46ba3..58c286cfa5 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean @@ -5,23 +5,9 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryParity -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Replacement Boundary At Most Three @@ -455,7 +441,6 @@ private theorem helper_continuation_668.{u_1, u_2} : GoldbergSeymour.ScheideStructuralConfiguration.p_ge_two (ScheideReducedConfiguration.toScheideStructuralConfiguration C) - all_goals omega) ⟩ : Fin C.p) ∈ TreeSequenceVertexSet T \ (insert (C.blockVertex (D.gammaIndex d) (0 : Fin (2 : ℕ))) ({C.blockVertex (D.gammaIndex d) (1 : Fin (2 : ℕ))} : Finset V) : Finset V) ∧ ( diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryParity.lean b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryParity.lean index 779b1cd43c..4bc6e78ae4 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryParity.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryParity.lean @@ -5,29 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident public import LeanPool.GoldbergSeymour.InternalEdges -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Replacement Boundary Parity diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryUnique.lean b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryUnique.lean index 2a1b4eafb2..d2b86e5bea 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryUnique.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryUnique.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ScheideReplacementPathPrefix +public import LeanPool.GoldbergSeymour.ScheideLastExitPath /-! # Scheide Replacement Boundary Unique diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementConfinement.lean b/LeanPool/GoldbergSeymour/ScheideReplacementConfinement.lean index 24d194a696..314e6d57c4 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementConfinement.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementConfinement.lean @@ -5,44 +5,13 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect -public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet -public import LeanPool.GoldbergSeymour.ScheideExitNoFree -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideLastExitPath -public import LeanPool.GoldbergSeymour.ScheideReplacementData public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryUnique public import LeanPool.GoldbergSeymour.ScheideReplacementExitNotDefective -public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum public import LeanPool.GoldbergSeymour.ScheideReplacementPathPrefix -public import LeanPool.GoldbergSeymour.ScheideReplacementUsedWitness -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Replacement Confinement diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementData.lean b/LeanPool/GoldbergSeymour/ScheideReplacementData.lean index 57e8863bb7..b998c0889a 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementData.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementData.lean @@ -6,7 +6,6 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap /-! # Scheide Replacement Data diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementInternalMissing.lean b/LeanPool/GoldbergSeymour/ScheideReplacementInternalMissing.lean index 6f08388c34..be1e67c3b8 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementInternalMissing.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementInternalMissing.lean @@ -5,9 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum -public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed /-! # Scheide Replacement Internal Missing diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementMaximum.lean b/LeanPool/GoldbergSeymour/ScheideReplacementMaximum.lean index bfb8513173..ef81c12d78 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementMaximum.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementMaximum.lean @@ -5,18 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.KTriple public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration public import LeanPool.GoldbergSeymour.ScheideReplacementData public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Replacement Maximum diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean b/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean index 0a4e7ec463..b11a8e8969 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean @@ -5,20 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.ClosedSetTwoColorComponentAvoidance -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum -public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed -public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Replacement Missing Deleted Internal diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementPairFixed.lean b/LeanPool/GoldbergSeymour/ScheideReplacementPairFixed.lean index d388a1c264..d98cdd5d22 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementPairFixed.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementPairFixed.lean @@ -5,8 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect public import LeanPool.GoldbergSeymour.ScheideReplacementData +public import LeanPool.GoldbergSeymour.ScheideDefectiveTailExternal /-! # Scheide Replacement Pair Fixed diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementPairsLaminar.lean b/LeanPool/GoldbergSeymour/ScheideReplacementPairsLaminar.lean index 26a62402d4..f12f240da1 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementPairsLaminar.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementPairsLaminar.lean @@ -5,7 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.ScheideReplacementInternalMissing /-! diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementPathPrefix.lean b/LeanPool/GoldbergSeymour/ScheideReplacementPathPrefix.lean index 6fb3b21891..85f9222153 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementPathPrefix.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementPathPrefix.lean @@ -5,15 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideLastExitPath -public import LeanPool.GoldbergSeymour.ScheideReplacementData public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TwoColorComponentSwap /-! diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementTreeSplice.lean b/LeanPool/GoldbergSeymour/ScheideReplacementTreeSplice.lean index 0b41b77886..8bbdeb56ee 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementTreeSplice.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementTreeSplice.lean @@ -6,13 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration public import LeanPool.GoldbergSeymour.ScheideSelectedBlockDeletion -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Replacement Tree Splice diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementUnionClosed.lean b/LeanPool/GoldbergSeymour/ScheideReplacementUnionClosed.lean index 391e090282..5606d73e22 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementUnionClosed.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementUnionClosed.lean @@ -5,7 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum public import LeanPool.GoldbergSeymour.ScheideSymmetricMissingInternal /-! diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementUsedWitness.lean b/LeanPool/GoldbergSeymour/ScheideReplacementUsedWitness.lean index a7c1982eff..ac6bc73ba7 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementUsedWitness.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementUsedWitness.lean @@ -5,14 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect public import LeanPool.GoldbergSeymour.ScheideReplacementData -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TreeUsedColors /-! diff --git a/LeanPool/GoldbergSeymour/ScheideReversedKempePathTree.lean b/LeanPool/GoldbergSeymour/ScheideReversedKempePathTree.lean index 069e4cefd4..d0cfd04830 100644 --- a/LeanPool/GoldbergSeymour/ScheideReversedKempePathTree.lean +++ b/LeanPool/GoldbergSeymour/ScheideReversedKempePathTree.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ScheideReversedPathPreparation +public import LeanPool.GoldbergSeymour.ScheideReversedPathCertificate /-! # Scheide Reversed Kempe Path Tree diff --git a/LeanPool/GoldbergSeymour/ScheideReversedPathCertificate.lean b/LeanPool/GoldbergSeymour/ScheideReversedPathCertificate.lean index cd50990953..c6fd532b52 100644 --- a/LeanPool/GoldbergSeymour/ScheideReversedPathCertificate.lean +++ b/LeanPool/GoldbergSeymour/ScheideReversedPathCertificate.lean @@ -6,8 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TashkinovTree - public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import Mathlib.Combinatorics.SimpleGraph.Walk.Basic /-! # Scheide Reversed Path Certificate diff --git a/LeanPool/GoldbergSeymour/ScheideReversedPathPreparation.lean b/LeanPool/GoldbergSeymour/ScheideReversedPathPreparation.lean index b5c4383448..b683186b4e 100644 --- a/LeanPool/GoldbergSeymour/ScheideReversedPathPreparation.lean +++ b/LeanPool/GoldbergSeymour/ScheideReversedPathPreparation.lean @@ -5,17 +5,15 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Tactic.NormNum - -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ScheideReversedPathCertificate -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import Mathlib.Combinatorics.SimpleGraph.Paths +public import Mathlib.Tactic.NormNum.OfScientific +public import Mathlib.Tactic.NormNum.DivMod +public import Mathlib.Tactic.NormNum.Abs +public import Mathlib.Data.Rat.Cast.Order +public import Mathlib.Tactic.NormNum.Pow /-! # Preparatory lemmas for a reversed Kempe-path tree diff --git a/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean b/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean index 1e2ad7f680..bfe32afdd2 100644 --- a/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean +++ b/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean @@ -5,10 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Incident public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Selected Block Deletion diff --git a/LeanPool/GoldbergSeymour/ScheideSingleBoundaryCrossing.lean b/LeanPool/GoldbergSeymour/ScheideSingleBoundaryCrossing.lean index 1c86a46a56..e7abd6562b 100644 --- a/LeanPool/GoldbergSeymour/ScheideSingleBoundaryCrossing.lean +++ b/LeanPool/GoldbergSeymour/ScheideSingleBoundaryCrossing.lean @@ -5,11 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ScheideReplacementFamilyExists public import LeanPool.GoldbergSeymour.ScheideOriginalDefectiveConfinement public import LeanPool.GoldbergSeymour.ScheideOriginalNondefectiveConfinement public import LeanPool.GoldbergSeymour.ScheideReplacementConfinement - public import LeanPool.GoldbergSeymour.ScheideTwoColorLastExitPath /-! diff --git a/LeanPool/GoldbergSeymour/ScheideSmallHeightElementary.lean b/LeanPool/GoldbergSeymour/ScheideSmallHeightElementary.lean index 15adf87f62..2bdedbbfa0 100644 --- a/LeanPool/GoldbergSeymour/ScheideSmallHeightElementary.lean +++ b/LeanPool/GoldbergSeymour/ScheideSmallHeightElementary.lean @@ -5,35 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.Critical public import LeanPool.GoldbergSeymour.Elementary -public import LeanPool.GoldbergSeymour.FixedPairMaximalTashkinovTree -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.GlobalMaximumTripleExists -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideBalancedExists -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideGraphHeight -public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd -public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound public import LeanPool.GoldbergSeymour.ScheideLargeHeightElementary -public import LeanPool.GoldbergSeymour.ScheideMaximalKempePath public import LeanPool.GoldbergSeymour.ScheideTrunkRotationPreserves -public import LeanPool.GoldbergSeymour.TashkinovOrder -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TrunkRotation -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Small Height Elementary diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralExitsInBase.lean b/LeanPool/GoldbergSeymour/ScheideStructuralExitsInBase.lean index 391f13dfa0..8778559b2d 100644 --- a/LeanPool/GoldbergSeymour/ScheideStructuralExitsInBase.lean +++ b/LeanPool/GoldbergSeymour/ScheideStructuralExitsInBase.lean @@ -5,13 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ScheideExitNoFree public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors /-! # Scheide Structural Exits In Base diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralInternalPair.lean b/LeanPool/GoldbergSeymour/ScheideStructuralInternalPair.lean index 8d6955041c..78ca73fd56 100644 --- a/LeanPool/GoldbergSeymour/ScheideStructuralInternalPair.lean +++ b/LeanPool/GoldbergSeymour/ScheideStructuralInternalPair.lean @@ -5,33 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath public import LeanPool.GoldbergSeymour.ScheideExitNoFree -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors /-! # Scheide Structural Internal Pair diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralLemma.lean b/LeanPool/GoldbergSeymour/ScheideStructuralLemma.lean index 9cd0883c96..fc5322699e 100644 --- a/LeanPool/GoldbergSeymour/ScheideStructuralLemma.lean +++ b/LeanPool/GoldbergSeymour/ScheideStructuralLemma.lean @@ -6,9 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ScheideDefectiveSetupExists -public import LeanPool.GoldbergSeymour.ScheideEnlargedElementary public import LeanPool.GoldbergSeymour.ScheideEnlargedStronglyClosed -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumBoundaryFacts public import LeanPool.GoldbergSeymour.ScheideReplacementFamilyExists public import LeanPool.GoldbergSeymour.ScheideStructuralReduction public import LeanPool.GoldbergSeymour.CriticalGraphElementaryWitness diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean b/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean index 8763a1ca0a..1b58914c6a 100644 --- a/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean +++ b/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean @@ -5,16 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration public import LeanPool.GoldbergSeymour.ScheideStructuralReorderingData -public import LeanPool.GoldbergSeymour.ScheideStructuralSelectionData -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Structural Reduced Assembly diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralReordering.lean b/LeanPool/GoldbergSeymour/ScheideStructuralReordering.lean index 64524c2145..672d4dcb1c 100644 --- a/LeanPool/GoldbergSeymour/ScheideStructuralReordering.lean +++ b/LeanPool/GoldbergSeymour/ScheideStructuralReordering.lean @@ -6,22 +6,7 @@ Authors: Wesley Pegden module public import Mathlib.Logic.Equiv.Fin.Basic - -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration public import LeanPool.GoldbergSeymour.ScheideStructuralReorderingData -public import LeanPool.GoldbergSeymour.ScheideStructuralSelectionData -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Structural Reordering diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricDefectiveInternal.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricDefectiveInternal.lean index fad645332e..4fda6ab6d9 100644 --- a/LeanPool/GoldbergSeymour/ScheideSymmetricDefectiveInternal.lean +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricDefectiveInternal.lean @@ -5,49 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists -public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect -public import LeanPool.GoldbergSeymour.ScheideExitNoFree -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration public import LeanPool.GoldbergSeymour.ScheideReplacementData -public import LeanPool.GoldbergSeymour.ScheideReplacementInternalMissing -public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum -public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase -public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalBoundaryAvoidance public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalFreePath public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryAvoidance -public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryConfiguration public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementFreePath -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Symmetric Defective Internal diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalBoundaryAvoidance.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalBoundaryAvoidance.lean index 4f07158816..899cd274a1 100644 --- a/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalBoundaryAvoidance.lean +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalBoundaryAvoidance.lean @@ -5,14 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath -public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideReplacementData -public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalPathOrder -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Symmetric Original Boundary Avoidance diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalFreePath.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalFreePath.lean index 6c31a215fb..40a317dfac 100644 --- a/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalFreePath.lean +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalFreePath.lean @@ -5,18 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration public import LeanPool.GoldbergSeymour.ScheideReplacementData -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeUsedColors /-! # Scheide Symmetric Original Free Path diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalPathOrder.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalPathOrder.lean index f0648c23f7..f560878f99 100644 --- a/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalPathOrder.lean +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricOriginalPathOrder.lean @@ -5,20 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration public import LeanPool.GoldbergSeymour.ScheideReplacementData public import LeanPool.GoldbergSeymour.ScheideReplacementInternalMissing -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase -public import LeanPool.GoldbergSeymour.ScheideSymmetricOriginalFreePath -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo /-! # Scheide Symmetric Original Path Order diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryAvoidance.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryAvoidance.lean index 397a002c65..7919e18a0a 100644 --- a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryAvoidance.lean +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryAvoidance.lean @@ -5,13 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideReplacementInternalMissing -public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed -public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryConfiguration public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementPathOrder /-! diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryConfiguration.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryConfiguration.lean index 5cd6b29fcb..9f59f47b35 100644 --- a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryConfiguration.lean +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementBoundaryConfiguration.lean @@ -5,16 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideReplacementData public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum -public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase -public import LeanPool.GoldbergSeymour.TreeSequence /-! # Scheide Symmetric Replacement Boundary Configuration diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementFreePath.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementFreePath.lean index 83881629be..e5d85ef8f6 100644 --- a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementFreePath.lean +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementFreePath.lean @@ -5,29 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.DefectiveColors -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPathExists -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused public import LeanPool.GoldbergSeymour.ScheideReplacementData -public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum -public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryConfiguration -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors /-! # Scheide Symmetric Replacement Free Path diff --git a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementPathOrder.lean b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementPathOrder.lean index d88fe42fd3..02646d9cae 100644 --- a/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementPathOrder.lean +++ b/LeanPool/GoldbergSeymour/ScheideSymmetricReplacementPathOrder.lean @@ -5,37 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ScheideExitNoFree -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainBoundaryEdges -public import LeanPool.GoldbergSeymour.ScheideDefectiveChainPath -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup -public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect -public import LeanPool.GoldbergSeymour.ScheideExitVertex -public import LeanPool.GoldbergSeymour.ScheideExitVertices -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder -public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumUnused public import LeanPool.GoldbergSeymour.ScheideReplacementData -public import LeanPool.GoldbergSeymour.ScheideReplacementMaximum -public import LeanPool.GoldbergSeymour.ScheideReplacementPairFixed -public import LeanPool.GoldbergSeymour.ScheideStructuralInternalPair -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralExitsInBase public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementBoundaryConfiguration -public import LeanPool.GoldbergSeymour.ScheideSymmetricReplacementFreePath -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Symmetric Replacement Path Order diff --git a/LeanPool/GoldbergSeymour/ScheideTrunkRotationColoring.lean b/LeanPool/GoldbergSeymour/ScheideTrunkRotationColoring.lean index fc1b672e6b..60d95baf75 100644 --- a/LeanPool/GoldbergSeymour/ScheideTrunkRotationColoring.lean +++ b/LeanPool/GoldbergSeymour/ScheideTrunkRotationColoring.lean @@ -6,16 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.NormalCycleEdge -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle -public import LeanPool.GoldbergSeymour.TreeSequence /-! # Scheide Trunk Rotation Coloring diff --git a/LeanPool/GoldbergSeymour/ScheideTrunkRotationCycle.lean b/LeanPool/GoldbergSeymour/ScheideTrunkRotationCycle.lean index 566fe23237..cfd4169044 100644 --- a/LeanPool/GoldbergSeymour/ScheideTrunkRotationCycle.lean +++ b/LeanPool/GoldbergSeymour/ScheideTrunkRotationCycle.lean @@ -5,21 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.NormalCycleEdge -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd -public import LeanPool.GoldbergSeymour.ScheideGraphHeight -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Trunk Rotation Cycle diff --git a/LeanPool/GoldbergSeymour/ScheideTrunkRotationNormal.lean b/LeanPool/GoldbergSeymour/ScheideTrunkRotationNormal.lean index beab21f709..89ace4ab43 100644 --- a/LeanPool/GoldbergSeymour/ScheideTrunkRotationNormal.lean +++ b/LeanPool/GoldbergSeymour/ScheideTrunkRotationNormal.lean @@ -6,15 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.NormalCycleEdge -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Trunk Rotation Normal diff --git a/LeanPool/GoldbergSeymour/ScheideTrunkRotationPreserves.lean b/LeanPool/GoldbergSeymour/ScheideTrunkRotationPreserves.lean index 1fbdf6d013..3553f701db 100644 --- a/LeanPool/GoldbergSeymour/ScheideTrunkRotationPreserves.lean +++ b/LeanPool/GoldbergSeymour/ScheideTrunkRotationPreserves.lean @@ -5,26 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.NormalCycleEdge -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideGraphHeightOdd public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring public import LeanPool.GoldbergSeymour.ScheideTrunkRotationNormal public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TrunkRotation -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Scheide Trunk Rotation Preserves diff --git a/LeanPool/GoldbergSeymour/ScheideTrunkRotationTree.lean b/LeanPool/GoldbergSeymour/ScheideTrunkRotationTree.lean index c6ce8756a7..ddb149c629 100644 --- a/LeanPool/GoldbergSeymour/ScheideTrunkRotationTree.lean +++ b/LeanPool/GoldbergSeymour/ScheideTrunkRotationTree.lean @@ -6,18 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.NormalCycleEdge -public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple -public import LeanPool.GoldbergSeymour.ScheideTrunkRotationColoring public import LeanPool.GoldbergSeymour.ScheideTrunkRotationCycle -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Scheide Trunk Rotation Tree diff --git a/LeanPool/GoldbergSeymour/ScheideTwoColorLastExitPath.lean b/LeanPool/GoldbergSeymour/ScheideTwoColorLastExitPath.lean index 129feb932e..44bcf3f7b6 100644 --- a/LeanPool/GoldbergSeymour/ScheideTwoColorLastExitPath.lean +++ b/LeanPool/GoldbergSeymour/ScheideTwoColorLastExitPath.lean @@ -5,28 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.GlobalMaximumTriple -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup public import LeanPool.GoldbergSeymour.ScheideEnlargedClosed -public import LeanPool.GoldbergSeymour.ScheideEnlargedElementary -public import LeanPool.GoldbergSeymour.ScheideEnlargedVertexSet public import LeanPool.GoldbergSeymour.ScheideLastExitPath -public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration -public import LeanPool.GoldbergSeymour.ScheideStructuralConfiguration -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo /-! # Scheide Two Color Last Exit Path diff --git a/LeanPool/GoldbergSeymour/SimpleExtensionSeedStoredColor.lean b/LeanPool/GoldbergSeymour/SimpleExtensionSeedStoredColor.lean index 5b49318fbd..bfa633fe55 100644 --- a/LeanPool/GoldbergSeymour/SimpleExtensionSeedStoredColor.lean +++ b/LeanPool/GoldbergSeymour/SimpleExtensionSeedStoredColor.lean @@ -5,19 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Simple Extension Seed Stored Color diff --git a/LeanPool/GoldbergSeymour/SplitSwapData.lean b/LeanPool/GoldbergSeymour/SplitSwapData.lean index d2d68daf40..1cfc3b7312 100644 --- a/LeanPool/GoldbergSeymour/SplitSwapData.lean +++ b/LeanPool/GoldbergSeymour/SplitSwapData.lean @@ -6,10 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix - public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation - -public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.TreeColoringInvariant /-! # P2880_T1_Split Swap Data diff --git a/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean b/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean index 9e09b57c1a..d88509b62a 100644 --- a/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean +++ b/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean @@ -11,13 +11,8 @@ public import LeanPool.GoldbergSeymour.HierarchyMeasures public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint /-! # P2880_T1_Common Preparation @@ -78,7 +73,7 @@ private theorem helper_hsigmaOne_150.{u_1, u_2} : dsimp [sigma] refine ⟨?_, ?_⟩ · simp [TwoColorComponentSwap, P.minimumContext.oneEdgeUncolored.1] - · apply helper_branch_51; assumption + · apply helper_branch_51; exact hne private theorem helper_branch_75.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) @@ -218,7 +213,7 @@ private theorem helper_coreA_303.{u_1, u_2} : classical intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q A prefixTrans stageSegment by_cases hz : H.dividerCount = 0 - · apply helper_branch_110; assumption + · apply helper_branch_110; exact hz · apply helper_branch_122 <;> assumption private theorem helper_hlenBX_410.{u_1, u_2} : open scoped Classical in @@ -1393,7 +1388,7 @@ private theorem helper_firstPositionOnB_1140.{u_1, u_2} : P.coloring B eta := by classical intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_missingEq eta - apply helper_firstPositionOnB_760; assumption + apply helper_firstPositionOnB_760; exact hB_missingEq private theorem helper_firstPositionBoundOnT_1144.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree.lean index cf450e7d49..5c95ec98ba 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCaseThree.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree.lean @@ -6,34 +6,11 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix - public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation5 - -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.HierarchySplitter public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.OrderedTreeUnion public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength /-! # Stable Change Case Three diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean index 3cc29f554b..c82d308a0e 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean @@ -5,30 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage public import LeanPool.GoldbergSeymour.HierarchySplitter public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis +public import LeanPool.GoldbergSeymour.HierarchyCounterexample /-! # StableChangeCaseThree: supporting constructions, part 1 diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation2.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation2.lean index 7e6aad8f22..ac1f7c7fef 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation2.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation2.lean @@ -5,7 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation1 +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset +public import LeanPool.GoldbergSeymour.HierarchyCounterexample /-! # StableChangeCaseThree: supporting constructions, part 2 diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation3.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation3.lean index e0f1b0a5a4..2d20e4006d 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation3.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation3.lean @@ -6,6 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation2 +public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation1 +public import LeanPool.GoldbergSeymour.SameGoodHierarchy /-! # StableChangeCaseThree: supporting constructions, part 3 diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation4.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation4.lean index 50e876af9a..88dca9b1b1 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation4.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation4.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation3 +public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage /-! # StableChangeCaseThree: supporting constructions, part 4 diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation5.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation5.lean index 1a18aa608b..88dacdfa87 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation5.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation5.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.StableChangeCaseThree.Preparation4 +public import LeanPool.GoldbergSeymour.ChangeLemmaBothOutside /-! # StableChangeCaseThree: supporting constructions, part 5 diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean index 327a062de0..1e35b8f603 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean @@ -5,49 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.BaseControl public import LeanPool.GoldbergSeymour.DisplayedEdges public import LeanPool.GoldbergSeymour.RecoloredPrefixReconstruction public import LeanPool.GoldbergSeymour.RetainedHierarchy -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchySplitter public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean index fce18f169a..ebe9adabb7 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean @@ -5,64 +5,17 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorPathComponent public import LeanPool.GoldbergSeymour.BaseControl public import LeanPool.GoldbergSeymour.DisplayedEdges public import LeanPool.GoldbergSeymour.RecoloredPrefixReconstruction public import LeanPool.GoldbergSeymour.MinusClosedTransport public import LeanPool.GoldbergSeymour.PrefixSegmentTransport -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition /-! # Stable Change Cases One Two Full Tail diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean index 5df997c912..5343363575 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean @@ -5,56 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.BaseControl -public import LeanPool.GoldbergSeymour.DisplayedEdges -public import LeanPool.GoldbergSeymour.MinusClosedTransport -public import LeanPool.GoldbergSeymour.PrefixSegmentTransport -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset /-! # Stable Change Cases One Two Split Tail diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean index 8e2bf95604..b52673054a 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean @@ -5,67 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CombinedStableClosurePreserved -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyCounterexample public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary -public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchySplitter -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion public import LeanPool.GoldbergSeymour.SameGoodHierarchy public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeColoringInvariant -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.BaseControl -public import LeanPool.GoldbergSeymour.DisplayedEdges -public import LeanPool.GoldbergSeymour.RecoloredPrefixReconstruction -public import LeanPool.GoldbergSeymour.TerminalRoute -public import LeanPool.GoldbergSeymour.MinusClosedTransport -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix /-! # Stable Change Cases One Two Starred Tail diff --git a/LeanPool/GoldbergSeymour/StableColoringExitExtension.lean b/LeanPool/GoldbergSeymour/StableColoringExitExtension.lean index 28da137afe..b26e793b2c 100644 --- a/LeanPool/GoldbergSeymour/StableColoringExitExtension.lean +++ b/LeanPool/GoldbergSeymour/StableColoringExitExtension.lean @@ -5,7 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored public import LeanPool.GoldbergSeymour.IsProperEdgeColoring @@ -13,10 +12,7 @@ public import LeanPool.GoldbergSeymour.MaximumDegree public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.TreeExit -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeMissingColors public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion -public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! # LEM_extable diff --git a/LeanPool/GoldbergSeymour/StableColoringFullCertificate.lean b/LeanPool/GoldbergSeymour/StableColoringFullCertificate.lean index add2910e41..cb2dcdff30 100644 --- a/LeanPool/GoldbergSeymour/StableColoringFullCertificate.lean +++ b/LeanPool/GoldbergSeymour/StableColoringFullCertificate.lean @@ -7,8 +7,8 @@ module public import LeanPool.GoldbergSeymour.HierarchyPrefixData public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext - public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.Td /-! # P2752_T2_Full Certificate diff --git a/LeanPool/GoldbergSeymour/StableColoringIncidentEdgeCriterion.lean b/LeanPool/GoldbergSeymour/StableColoringIncidentEdgeCriterion.lean index 8b4204a983..35071cdb16 100644 --- a/LeanPool/GoldbergSeymour/StableColoringIncidentEdgeCriterion.lean +++ b/LeanPool/GoldbergSeymour/StableColoringIncidentEdgeCriterion.lean @@ -5,11 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Degree public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored public import LeanPool.GoldbergSeymour.IsProperEdgeColoring - public import LeanPool.GoldbergSeymour.StableColoring +public import Mathlib.Data.Fintype.EquivFin /-! # sc1 diff --git a/LeanPool/GoldbergSeymour/StableSeriesCycleComponentTransport.lean b/LeanPool/GoldbergSeymour/StableSeriesCycleComponentTransport.lean index 895a20b92a..23730fee1b 100644 --- a/LeanPool/GoldbergSeymour/StableSeriesCycleComponentTransport.lean +++ b/LeanPool/GoldbergSeymour/StableSeriesCycleComponentTransport.lean @@ -5,18 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone -public import LeanPool.GoldbergSeymour.InternalEdges -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Stable Series Cycle Component Transport diff --git a/LeanPool/GoldbergSeymour/StarredPrefixPreparation.lean b/LeanPool/GoldbergSeymour/StarredPrefixPreparation.lean index e1b1a90aa8..fe83d7c4f5 100644 --- a/LeanPool/GoldbergSeymour/StarredPrefixPreparation.lean +++ b/LeanPool/GoldbergSeymour/StarredPrefixPreparation.lean @@ -5,29 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ElementaryClosedMissingColorOdd public import LeanPool.GoldbergSeymour.GoodHierarchyElementaryLarge -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast -public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.ParallelClosureUnionElementary -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed public import LeanPool.GoldbergSeymour.PredecessorElementary public import LeanPool.GoldbergSeymour.TechnicalInductionContext public import LeanPool.GoldbergSeymour.TechnicalCurrentLadderMissingBoundLarge -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.StableColoringEquivalence - -public import LeanPool.GoldbergSeymour.LowerRoundProperties /-! # P2940_T1_Starred Prefix Preparation diff --git a/LeanPool/GoldbergSeymour/Step1CaseOneInsidePositiveDivider.lean b/LeanPool/GoldbergSeymour/Step1CaseOneInsidePositiveDivider.lean index 8fe5ce9cfb..33b11d692a 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseOneInsidePositiveDivider.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseOneInsidePositiveDivider.lean @@ -5,12 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint - -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone - -public import LeanPool.GoldbergSeymour.ParallelInterchangeability - public import LeanPool.GoldbergSeymour.OutsideExitTransport public import LeanPool.GoldbergSeymour.PositivePrefixPresentation diff --git a/LeanPool/GoldbergSeymour/Step1CaseOneInsideStar.lean b/LeanPool/GoldbergSeymour/Step1CaseOneInsideStar.lean index 0860745f4e..967910e66b 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseOneInsideStar.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseOneInsideStar.lean @@ -5,78 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.StableColoringEquivalence public import LeanPool.GoldbergSeymour.Step1CaseOneInsidePositiveDivider public import LeanPool.GoldbergSeymour.Step1CaseOneInsideZeroNonPE public import LeanPool.GoldbergSeymour.Step1CaseOneInsideZeroPE - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroNonPE.lean b/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroNonPE.lean index 58c6970eda..cedf770a9b 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroNonPE.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroNonPE.lean @@ -6,8 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.OutsideExitTransport - public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchorNonPE +public import LeanPool.GoldbergSeymour.HierarchyLEMStable /-! # Step1Case One Inside Zero Non PE diff --git a/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroPE.lean b/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroPE.lean index d71c0ff91a..00a272e50a 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroPE.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseOneInsideZeroPE.lean @@ -5,80 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.StableColoringEquivalence public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchorPE - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/Step1CaseOneOutsideStar.lean b/LeanPool/GoldbergSeymour/Step1CaseOneOutsideStar.lean index 2afec4e0c6..e36336987b 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseOneOutsideStar.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseOneOutsideStar.lean @@ -5,88 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.StableColoringEquivalence public import LeanPool.GoldbergSeymour.OutsideExitTransport -public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast -public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoInsidePositiveDivider.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoInsidePositiveDivider.lean index 10e0cd2729..f576790b7a 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseTwoInsidePositiveDivider.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoInsidePositiveDivider.lean @@ -5,77 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.StableColoringEquivalence -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroNonPE.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroNonPE.lean index f9d018a148..5c6b60d558 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroNonPE.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroNonPE.lean @@ -5,78 +5,13 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.ParallelInterchangeability public import LeanPool.GoldbergSeymour.StableColoringEquivalence - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroPE.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroPE.lean index 71cce30030..875baebcc6 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroPE.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoInsideZeroPE.lean @@ -5,81 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.StableColoringEquivalence public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchorPE -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixHierarchy.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixHierarchy.lean index c2ba1550a8..5c3324bb04 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixHierarchy.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixHierarchy.lean @@ -5,60 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis - public import LeanPool.GoldbergSeymour.LowerRoundProperties /-! diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixTwoEdges.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixTwoEdges.lean index e56cd08b24..20f151d42b 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixTwoEdges.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsidePrefixTwoEdges.lean @@ -5,81 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.Td -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.StableColoringEquivalence public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsidePrefixHierarchy public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsideRecoloredPrefix public import LeanPool.GoldbergSeymour.Step1CaseTwoOutsideTwoEdgeExtension - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRecoloredPrefix.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRecoloredPrefix.lean index 97fc174bfc..622673f402 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRecoloredPrefix.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRecoloredPrefix.lean @@ -5,52 +5,13 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.StableColoringEquivalence public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset @@ -885,7 +846,7 @@ private theorem helper_sigma_properties_1696.{u_1, u_2} : have hzS : z ∈ S := by cases z with | inl w => simpa [roots, S] using hz - | inr f => exact False.elim (by simpa [roots] using hz) + | inr _ => simp [roots] at hz have hr : J.Reachable z (Sum.inl v) := by change J.connectedComponentMk (Sum.inl v) = J.connectedComponentMk z at hv exact (SimpleGraph.ConnectedComponent.eq.mp hv).symm diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRestrictedAugmentation.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRestrictedAugmentation.lean index d94f2b1dd0..a0dcbd105f 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRestrictedAugmentation.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideRestrictedAugmentation.lean @@ -5,17 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex public import LeanPool.GoldbergSeymour.GoodHierarchyRestrictedAugmentation -public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeVertexOrder public import LeanPool.GoldbergSeymour.ElementaryEndpointExclusion public import LeanPool.GoldbergSeymour.FirstEntryClipping -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean index b0e2ed386c..196d318336 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean @@ -5,45 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.BoundaryMissingColorAugmentation -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerReconstruction public import LeanPool.GoldbergSeymour.GoodHierarchySameDividerTransport -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.TashkinovAugmentation public import LeanPool.GoldbergSeymour.RestrictedAugmentationCorrespondingEndpoint -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Step1Case Two Outside Two Edge Extension diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegGlobalMinimum.lean b/LeanPool/GoldbergSeymour/Step1ExitLegGlobalMinimum.lean index 1d1fdafea4..0d51f35dff 100644 --- a/LeanPool/GoldbergSeymour/Step1ExitLegGlobalMinimum.lean +++ b/LeanPool/GoldbergSeymour/Step1ExitLegGlobalMinimum.lean @@ -5,13 +5,13 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Step1ZeroDividerAnchor public import LeanPool.GoldbergSeymour.Step1ExitLegMinimumExists public import LeanPool.GoldbergSeymour.Step1ExitLegPrecoloringElementary public import LeanPool.GoldbergSeymour.Step1ExitLegPresentationExists public import LeanPool.GoldbergSeymour.Step1ExitLegThetaPositive public import LeanPool.GoldbergSeymour.Step1ExitLegThetaZeroNonparallel public import LeanPool.GoldbergSeymour.Step1ExitLegThetaZeroParallel +public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! # Step1Exit Leg Global Minimum diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegMinimumExists.lean b/LeanPool/GoldbergSeymour/Step1ExitLegMinimumExists.lean index db97f89087..8560b737c2 100644 --- a/LeanPool/GoldbergSeymour/Step1ExitLegMinimumExists.lean +++ b/LeanPool/GoldbergSeymour/Step1ExitLegMinimumExists.lean @@ -5,15 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree public import LeanPool.GoldbergSeymour.ElementaryClosedExitPairExtendsTriple public import LeanPool.GoldbergSeymour.Step1ExitLegMinimum -public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder /-! # Step1Exit Leg Minimum Exists diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegPresentationExists.lean b/LeanPool/GoldbergSeymour/Step1ExitLegPresentationExists.lean index 0cfc154d3c..ebc5a1dd53 100644 --- a/LeanPool/GoldbergSeymour/Step1ExitLegPresentationExists.lean +++ b/LeanPool/GoldbergSeymour/Step1ExitLegPresentationExists.lean @@ -7,12 +7,7 @@ module public import LeanPool.GoldbergSeymour.ElementaryClosedNoninterchangeableExitPair public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeVertexOrder /-! # Step1Exit Leg Presentation Exists diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegThetaPositive.lean b/LeanPool/GoldbergSeymour/Step1ExitLegThetaPositive.lean index 0163a3d4bb..7fa5fd8492 100644 --- a/LeanPool/GoldbergSeymour/Step1ExitLegThetaPositive.lean +++ b/LeanPool/GoldbergSeymour/Step1ExitLegThetaPositive.lean @@ -5,19 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyStarredStage public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.OrderedTreeUnion public import LeanPool.GoldbergSeymour.Step1ExitLegMinimum -public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment /-! # Step1Exit Leg Theta Positive diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroNonparallel.lean b/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroNonparallel.lean index 2ccc32f991..2080463e87 100644 --- a/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroNonparallel.lean +++ b/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroNonparallel.lean @@ -5,24 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyStarredStage public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeMissingColors public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! diff --git a/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroParallel.lean b/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroParallel.lean index 3d6a915281..ef18a4d14e 100644 --- a/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroParallel.lean +++ b/LeanPool/GoldbergSeymour/Step1ExitLegThetaZeroParallel.lean @@ -5,8 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality - public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed public import LeanPool.GoldbergSeymour.Step1ExitLegPresentation diff --git a/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorNonPE.lean b/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorNonPE.lean index bc65b36ee9..2873dd0bde 100644 --- a/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorNonPE.lean +++ b/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorNonPE.lean @@ -5,81 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchyOutsideKempeStable -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.Td public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent -public import LeanPool.GoldbergSeymour.ParallelInterchangeability public import LeanPool.GoldbergSeymour.StableColoringEquivalence - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorPE.lean b/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorPE.lean index 1daf585c46..88a2c98455 100644 --- a/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorPE.lean +++ b/LeanPool/GoldbergSeymour/Step1ZeroDividerAnchorPE.lean @@ -5,81 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryColorVertex -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.CombinedStableColoring -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.GoodHierarchyPrefixRepackage -public import LeanPool.GoldbergSeymour.GoodHierarchyReservedDisjoint -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyLEMStable -public import LeanPool.GoldbergSeymour.HierarchyOutsideKempeStable -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAntitone -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsCardinality -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloring -public import LeanPool.GoldbergSeymour.OutsideKempeRecoloringStable -public import LeanPool.GoldbergSeymour.ParallelCommonMissingClosed -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.SameGoodHierarchy -public import LeanPool.GoldbergSeymour.SameHierarchyStages -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovExtensionKind -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.Td public import LeanPool.GoldbergSeymour.TreeColorSetClosed -public import LeanPool.GoldbergSeymour.TreeColorSetMinusClosed -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent public import LeanPool.GoldbergSeymour.ParallelInterchangeability -public import LeanPool.GoldbergSeymour.StableColoringEquivalence - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/StrongInterchangeabilityKempePreserved.lean b/LeanPool/GoldbergSeymour/StrongInterchangeabilityKempePreserved.lean index 00ee96aca9..56f7e12ff6 100644 --- a/LeanPool/GoldbergSeymour/StrongInterchangeabilityKempePreserved.lean +++ b/LeanPool/GoldbergSeymour/StrongInterchangeabilityKempePreserved.lean @@ -6,24 +6,10 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentCycle -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorComponentSwapDisjointPairGraph public import LeanPool.GoldbergSeymour.TwoColorComponentSwapPreservesDisjointComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent public import LeanPool.GoldbergSeymour.TwoColorPathComponentNotCycle diff --git a/LeanPool/GoldbergSeymour/StronglyClosedWitnessElementary.lean b/LeanPool/GoldbergSeymour/StronglyClosedWitnessElementary.lean index 116cc9c0b4..0bcd7ba748 100644 --- a/LeanPool/GoldbergSeymour/StronglyClosedWitnessElementary.lean +++ b/LeanPool/GoldbergSeymour/StronglyClosedWitnessElementary.lean @@ -5,25 +5,12 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.ChromaticIndex -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.Density -public import LeanPool.GoldbergSeymour.DensityCeil public import LeanPool.GoldbergSeymour.DensityLowerBound -public import LeanPool.GoldbergSeymour.DensityValue public import LeanPool.GoldbergSeymour.Elementary -public import LeanPool.GoldbergSeymour.InternalEdges public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors /-! # Strongly Closed Witness Elementary diff --git a/LeanPool/GoldbergSeymour/SupportingPEColorChain.lean b/LeanPool/GoldbergSeymour/SupportingPEColorChain.lean index 3f8ea5c0f0..8c6413870a 100644 --- a/LeanPool/GoldbergSeymour/SupportingPEColorChain.lean +++ b/LeanPool/GoldbergSeymour/SupportingPEColorChain.lean @@ -5,10 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ParallelExtensionColor public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Supporting PEColor Chain diff --git a/LeanPool/GoldbergSeymour/SupportingPEMissingTransport.lean b/LeanPool/GoldbergSeymour/SupportingPEMissingTransport.lean index 2f3acb59e0..42804ec5da 100644 --- a/LeanPool/GoldbergSeymour/SupportingPEMissingTransport.lean +++ b/LeanPool/GoldbergSeymour/SupportingPEMissingTransport.lean @@ -6,16 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.SupportingPEColorChain public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap /-! # Supporting PEMissing Transport diff --git a/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean b/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean index 6a444db3fc..9829ecab7a 100644 --- a/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean +++ b/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean @@ -6,16 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.SupportingPEColorChain public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap /-! # Supporting PEStored Intersection diff --git a/LeanPool/GoldbergSeymour/TashTreeCasePathIndexLast.lean b/LeanPool/GoldbergSeymour/TashTreeCasePathIndexLast.lean index ef3040a544..834f525bb3 100644 --- a/LeanPool/GoldbergSeymour/TashTreeCasePathIndexLast.lean +++ b/LeanPool/GoldbergSeymour/TashTreeCasePathIndexLast.lean @@ -5,8 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPathIndex - public import LeanPool.GoldbergSeymour.TashTreeLastIndexDeletion public import LeanPool.GoldbergSeymour.TashTreeLastIndexFirstNormalForm public import LeanPool.GoldbergSeymour.TashTreeLastIndexSecondNormalForm diff --git a/LeanPool/GoldbergSeymour/TashTreeControlledInterchange.lean b/LeanPool/GoldbergSeymour/TashTreeControlledInterchange.lean index 34ad7c990d..73935515b9 100644 --- a/LeanPool/GoldbergSeymour/TashTreeControlledInterchange.lean +++ b/LeanPool/GoldbergSeymour/TashTreeControlledInterchange.lean @@ -5,31 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreePathIndex public import LeanPool.GoldbergSeymour.TashTreeProperInitialSegmentRankLess -public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary -public import LeanPool.GoldbergSeymour.TashTreeRankLess -public import LeanPool.GoldbergSeymour.TashTreeSuffixPath -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TashkinovTreeComponentSwapWitnessTransport public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior public import LeanPool.GoldbergSeymour.TwoColorComponentSwapNonElementary public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph public import LeanPool.GoldbergSeymour.TwoColorPathComponent /-! diff --git a/LeanPool/GoldbergSeymour/TashTreeEarlyBetaNormalization.lean b/LeanPool/GoldbergSeymour/TashTreeEarlyBetaNormalization.lean index 1ea1f2a162..31f7c6c8f9 100644 --- a/LeanPool/GoldbergSeymour/TashTreeEarlyBetaNormalization.lean +++ b/LeanPool/GoldbergSeymour/TashTreeEarlyBetaNormalization.lean @@ -5,27 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange public import LeanPool.GoldbergSeymour.TashTreeFourUnusedColors public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Tash Tree Early Beta Normalization diff --git a/LeanPool/GoldbergSeymour/TashTreeFourUnusedColors.lean b/LeanPool/GoldbergSeymour/TashTreeFourUnusedColors.lean index 0bf24c1a21..074f46bf4a 100644 --- a/LeanPool/GoldbergSeymour/TashTreeFourUnusedColors.lean +++ b/LeanPool/GoldbergSeymour/TashTreeFourUnusedColors.lean @@ -5,25 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors /-! # Tash Tree Four Unused Colors diff --git a/LeanPool/GoldbergSeymour/TashTreeGammaEpsilonSetup.lean b/LeanPool/GoldbergSeymour/TashTreeGammaEpsilonSetup.lean index 544e23d04c..ea1cf0d60f 100644 --- a/LeanPool/GoldbergSeymour/TashTreeGammaEpsilonSetup.lean +++ b/LeanPool/GoldbergSeymour/TashTreeGammaEpsilonSetup.lean @@ -5,21 +5,12 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.KTriple public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeFourUnusedColors public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough -public import LeanPool.GoldbergSeymour.TreeFreeColors public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TreeUsedColors /-! # Tash Tree Gamma Epsilon Setup diff --git a/LeanPool/GoldbergSeymour/TashTreeLastIndexDeletion.lean b/LeanPool/GoldbergSeymour/TashTreeLastIndexDeletion.lean index cb43daefb2..6919831f7e 100644 --- a/LeanPool/GoldbergSeymour/TashTreeLastIndexDeletion.lean +++ b/LeanPool/GoldbergSeymour/TashTreeLastIndexDeletion.lean @@ -5,18 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreePathIndex -public import LeanPool.GoldbergSeymour.TashTreeRankLess -public import LeanPool.GoldbergSeymour.TashTreeSuffixPath -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Tash Tree Last Index Deletion diff --git a/LeanPool/GoldbergSeymour/TashTreeLastIndexFirstNormalForm.lean b/LeanPool/GoldbergSeymour/TashTreeLastIndexFirstNormalForm.lean index ceeb8f032b..63a0a87be6 100644 --- a/LeanPool/GoldbergSeymour/TashTreeLastIndexFirstNormalForm.lean +++ b/LeanPool/GoldbergSeymour/TashTreeLastIndexFirstNormalForm.lean @@ -5,30 +5,13 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange public import LeanPool.GoldbergSeymour.TashTreeDisjointComponentNormalization public import LeanPool.GoldbergSeymour.TashTreeFourUnusedColors public import LeanPool.GoldbergSeymour.TashTreeLastIndexIntersectionShortening public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreePathIndex -public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary -public import LeanPool.GoldbergSeymour.TashTreeSuffixPath -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior /-! # Tash Tree Last Index First Normal Form diff --git a/LeanPool/GoldbergSeymour/TashTreeLastIndexSecondNormalForm.lean b/LeanPool/GoldbergSeymour/TashTreeLastIndexSecondNormalForm.lean index 1c4ed3f377..ebf9866611 100644 --- a/LeanPool/GoldbergSeymour/TashTreeLastIndexSecondNormalForm.lean +++ b/LeanPool/GoldbergSeymour/TashTreeLastIndexSecondNormalForm.lean @@ -5,25 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreePathIndex public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequencePrefix public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Tash Tree Last Index Second Normal Form diff --git a/LeanPool/GoldbergSeymour/TashTreeLastIndexThirdNormalForm.lean b/LeanPool/GoldbergSeymour/TashTreeLastIndexThirdNormalForm.lean index c0b3e92b52..72caf7b0bf 100644 --- a/LeanPool/GoldbergSeymour/TashTreeLastIndexThirdNormalForm.lean +++ b/LeanPool/GoldbergSeymour/TashTreeLastIndexThirdNormalForm.lean @@ -5,26 +5,10 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange public import LeanPool.GoldbergSeymour.TashTreeFourUnusedColors public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreePathIndex -public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeFreeColors -public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeUsedColors -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior /-! # Tash Tree Last Index Third Normal Form diff --git a/LeanPool/GoldbergSeymour/TashTreeNoMinimumBadPair.lean b/LeanPool/GoldbergSeymour/TashTreeNoMinimumBadPair.lean index 1d5534800c..82761f6249 100644 --- a/LeanPool/GoldbergSeymour/TashTreeNoMinimumBadPair.lean +++ b/LeanPool/GoldbergSeymour/TashTreeNoMinimumBadPair.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.TashTreeCaseNoRepeatedOnPath public import LeanPool.GoldbergSeymour.TashTreeCasePathIndexLast +public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPathIndex /-! # Tash Tree No Minimum Bad Pair diff --git a/LeanPool/GoldbergSeymour/TashTreeNoRepeatedIntersectionShortening.lean b/LeanPool/GoldbergSeymour/TashTreeNoRepeatedIntersectionShortening.lean index d23357e540..33b444e7b5 100644 --- a/LeanPool/GoldbergSeymour/TashTreeNoRepeatedIntersectionShortening.lean +++ b/LeanPool/GoldbergSeymour/TashTreeNoRepeatedIntersectionShortening.lean @@ -5,21 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.KTriple public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreeBadPair -public import LeanPool.GoldbergSeymour.TashTreePathIndex -public import LeanPool.GoldbergSeymour.TashTreeRankLess -public import LeanPool.GoldbergSeymour.TashTreeSuffixPath -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentTashkinovSplice diff --git a/LeanPool/GoldbergSeymour/TashTreePathIndexTwoReplacement.lean b/LeanPool/GoldbergSeymour/TashTreePathIndexTwoReplacement.lean index 446e8ddab1..0982ac380b 100644 --- a/LeanPool/GoldbergSeymour/TashTreePathIndexTwoReplacement.lean +++ b/LeanPool/GoldbergSeymour/TashTreePathIndexTwoReplacement.lean @@ -5,15 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreePathIndex -public import LeanPool.GoldbergSeymour.TashTreeRankLess -public import LeanPool.GoldbergSeymour.TashTreeSuffixPath -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Tash Tree Path Index Two Replacement diff --git a/LeanPool/GoldbergSeymour/TashTreeSuffixAdvance.lean b/LeanPool/GoldbergSeymour/TashTreeSuffixAdvance.lean index 4eaf731379..713a0f7b2c 100644 --- a/LeanPool/GoldbergSeymour/TashTreeSuffixAdvance.lean +++ b/LeanPool/GoldbergSeymour/TashTreeSuffixAdvance.lean @@ -5,24 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeControlledInterchange public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreePathIndex public import LeanPool.GoldbergSeymour.TashTreeProperPrefixElementary -public import LeanPool.GoldbergSeymour.TashTreeSuffixPath -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior /-! # Tash Tree Suffix Advance diff --git a/LeanPool/GoldbergSeymour/TashTreeSuffixTerminalReplacement.lean b/LeanPool/GoldbergSeymour/TashTreeSuffixTerminalReplacement.lean index cbbf379bdc..49a3e4f947 100644 --- a/LeanPool/GoldbergSeymour/TashTreeSuffixTerminalReplacement.lean +++ b/LeanPool/GoldbergSeymour/TashTreeSuffixTerminalReplacement.lean @@ -5,24 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.TashTreeBadPair public import LeanPool.GoldbergSeymour.TashTreeMinimumBadPair -public import LeanPool.GoldbergSeymour.TashTreePathIndex public import LeanPool.GoldbergSeymour.TashTreeProperInitialSegmentRankLess -public import LeanPool.GoldbergSeymour.TashTreeRankLess -public import LeanPool.GoldbergSeymour.TashTreeSuffixPath -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet /-! # Tash Tree Suffix Terminal Replacement diff --git a/LeanPool/GoldbergSeymour/TashkinovAlternatingSegmentAppend.lean b/LeanPool/GoldbergSeymour/TashkinovAlternatingSegmentAppend.lean index ef5e6c4cd1..c0c709f463 100644 --- a/LeanPool/GoldbergSeymour/TashkinovAlternatingSegmentAppend.lean +++ b/LeanPool/GoldbergSeymour/TashkinovAlternatingSegmentAppend.lean @@ -5,12 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TashkinovAugmentation public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TwoColorComponent /-! diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceColoringTransport.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceColoringTransport.lean index 9fa3c9973e..50a8a5259d 100644 --- a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceColoringTransport.lean +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceColoringTransport.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import Mathlib.Data.Fintype.EquivFin /-! # Tashkinov Augmentation Sequence Coloring Transport diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceComponentSwap.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceComponentSwap.lean index 9b1418d318..1bbf9a382e 100644 --- a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceComponentSwap.lean +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceComponentSwap.lean @@ -5,12 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.TashkinovAugmentation public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TwoColorComponentSwap /-! diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean index 6e3a364ddc..5e31b5a7c7 100644 --- a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import Mathlib.Data.Fintype.EquivFin /-! # Tashkinov Augmentation Sequence Initial Segment diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePreservesTashkinovTree.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePreservesTashkinovTree.lean index 7f4cd91fe2..a074b5d923 100644 --- a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePreservesTashkinovTree.lean +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequencePreservesTashkinovTree.lean @@ -6,8 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence - public import LeanPool.GoldbergSeymour.TashkinovTree +public import Mathlib.Data.Fintype.EquivFin /-! # Tashkinov Augmentation Sequence Preserves Tashkinov Tree diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceRestrict.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceRestrict.lean index 0193e1db55..ad49a26e01 100644 --- a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceRestrict.lean +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceRestrict.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import Mathlib.Data.Fintype.EquivFin /-! # Tashkinov Augmentation Sequence Restrict diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceSuffix.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceSuffix.lean index 955d92b079..9c4d1b95eb 100644 --- a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceSuffix.lean +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceSuffix.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence +public import Mathlib.Data.Fintype.EquivFin /-! # Tashkinov Augmentation Sequence Suffix diff --git a/LeanPool/GoldbergSeymour/TashkinovClosureExists.lean b/LeanPool/GoldbergSeymour/TashkinovClosureExists.lean index 23bad069c2..aa84158724 100644 --- a/LeanPool/GoldbergSeymour/TashkinovClosureExists.lean +++ b/LeanPool/GoldbergSeymour/TashkinovClosureExists.lean @@ -6,8 +6,8 @@ Authors: Wesley Pegden module public import Mathlib.Data.Finset.Max - public import LeanPool.GoldbergSeymour.TashkinovClosure +public import Mathlib.Data.Fintype.Card /-! # Tashkinov Closure Exists diff --git a/LeanPool/GoldbergSeymour/TashkinovExtensionKind.lean b/LeanPool/GoldbergSeymour/TashkinovExtensionKind.lean index cf39f1bb8c..e0bf33f544 100644 --- a/LeanPool/GoldbergSeymour/TashkinovExtensionKind.lean +++ b/LeanPool/GoldbergSeymour/TashkinovExtensionKind.lean @@ -5,7 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Preamble +public import Mathlib.Data.Sym.Sym2.Init +public import Mathlib.Data.Finset.Attr +public import Mathlib.Tactic.SetLike +public import Mathlib.Tactic.Finiteness.Attr /-! # Tashkinov Extension Kind diff --git a/LeanPool/GoldbergSeymour/TashkinovStoredColorsAppend.lean b/LeanPool/GoldbergSeymour/TashkinovStoredColorsAppend.lean index 6954810ffa..8aec7162ae 100644 --- a/LeanPool/GoldbergSeymour/TashkinovStoredColorsAppend.lean +++ b/LeanPool/GoldbergSeymour/TashkinovStoredColorsAppend.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.TashkinovSeriesDataAppend public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import Mathlib.Data.Fintype.EquivFin /-! # Tashkinov Stored Colors Append diff --git a/LeanPool/GoldbergSeymour/TashkinovStoredColorsCardinality.lean b/LeanPool/GoldbergSeymour/TashkinovStoredColorsCardinality.lean index 13ca3a634f..b9ccbeed71 100644 --- a/LeanPool/GoldbergSeymour/TashkinovStoredColorsCardinality.lean +++ b/LeanPool/GoldbergSeymour/TashkinovStoredColorsCardinality.lean @@ -5,26 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.StableColoring public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TreeExit -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Tashkinov Stored Colors Cardinality diff --git a/LeanPool/GoldbergSeymour/TashkinovStoredColorsPrefix.lean b/LeanPool/GoldbergSeymour/TashkinovStoredColorsPrefix.lean index bf23284b50..8429cebf7c 100644 --- a/LeanPool/GoldbergSeymour/TashkinovStoredColorsPrefix.lean +++ b/LeanPool/GoldbergSeymour/TashkinovStoredColorsPrefix.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.TashkinovSeriesDataPrefix public import LeanPool.GoldbergSeymour.TashkinovStoredColors +public import Mathlib.Data.Fintype.EquivFin /-! # Tashkinov Stored Colors Prefix diff --git a/LeanPool/GoldbergSeymour/TashkinovTreeComponentSwapWitnessTransport.lean b/LeanPool/GoldbergSeymour/TashkinovTreeComponentSwapWitnessTransport.lean index a01d287450..c267b1ea8f 100644 --- a/LeanPool/GoldbergSeymour/TashkinovTreeComponentSwapWitnessTransport.lean +++ b/LeanPool/GoldbergSeymour/TashkinovTreeComponentSwapWitnessTransport.lean @@ -6,17 +6,11 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeColorUnusedThrough -public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Tashkinov Tree Component Swap Witness Transport diff --git a/LeanPool/GoldbergSeymour/TashkinovTreeFromLengthOnePrefix.lean b/LeanPool/GoldbergSeymour/TashkinovTreeFromLengthOnePrefix.lean index 51c4c88321..74a95b7cce 100644 --- a/LeanPool/GoldbergSeymour/TashkinovTreeFromLengthOnePrefix.lean +++ b/LeanPool/GoldbergSeymour/TashkinovTreeFromLengthOnePrefix.lean @@ -8,6 +8,7 @@ module public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import Mathlib.Data.Fintype.EquivFin /-! # Tashkinov Tree From Length One Prefix diff --git a/LeanPool/GoldbergSeymour/TchangeKempeClosurePreparation.lean b/LeanPool/GoldbergSeymour/TchangeKempeClosurePreparation.lean index 3ac0b73d96..51599dd656 100644 --- a/LeanPool/GoldbergSeymour/TchangeKempeClosurePreparation.lean +++ b/LeanPool/GoldbergSeymour/TchangeKempeClosurePreparation.lean @@ -5,31 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple public import LeanPool.GoldbergSeymour.TashTree -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovClosureExists -public import LeanPool.GoldbergSeymour.TashkinovTree public import LeanPool.GoldbergSeymour.TchangeKempeClosureData public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit -public import LeanPool.GoldbergSeymour.TreeExitPath public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequencePrefix public import LeanPool.GoldbergSeymour.TreeVertexOrder -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo /-! # Tchange Kempe Closure Preparation diff --git a/LeanPool/GoldbergSeymour/TchangeOutsideSwapPreparation.lean b/LeanPool/GoldbergSeymour/TchangeOutsideSwapPreparation.lean index f6c70ac9bd..c1ec09c1a0 100644 --- a/LeanPool/GoldbergSeymour/TchangeOutsideSwapPreparation.lean +++ b/LeanPool/GoldbergSeymour/TchangeOutsideSwapPreparation.lean @@ -5,15 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.MissingColorsNonemptyOfMaximumDegree public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable public import LeanPool.GoldbergSeymour.TchangeCounterexampleMeasure -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeExitPath public import LeanPool.GoldbergSeymour.TreeVertexOrder /-! diff --git a/LeanPool/GoldbergSeymour/TchangeStrictShortening.lean b/LeanPool/GoldbergSeymour/TchangeStrictShortening.lean index d5ad89431b..b8030127ab 100644 --- a/LeanPool/GoldbergSeymour/TchangeStrictShortening.lean +++ b/LeanPool/GoldbergSeymour/TchangeStrictShortening.lean @@ -5,21 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.TchangeCounterexampleMeasure public import LeanPool.GoldbergSeymour.TchangeKempeClosureData -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph /-! diff --git a/LeanPool/GoldbergSeymour/TdEarlierPEWitnessIdentification.lean b/LeanPool/GoldbergSeymour/TdEarlierPEWitnessIdentification.lean index 5153b1171e..64761a46c6 100644 --- a/LeanPool/GoldbergSeymour/TdEarlierPEWitnessIdentification.lean +++ b/LeanPool/GoldbergSeymour/TdEarlierPEWitnessIdentification.lean @@ -6,7 +6,6 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MissingColors /-! # Td Earlier PEWitness Identification diff --git a/LeanPool/GoldbergSeymour/TdReplacementPrefixExact.lean b/LeanPool/GoldbergSeymour/TdReplacementPrefixExact.lean index 891f6f8540..3a959e4a43 100644 --- a/LeanPool/GoldbergSeymour/TdReplacementPrefixExact.lean +++ b/LeanPool/GoldbergSeymour/TdReplacementPrefixExact.lean @@ -5,57 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Basic2 -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree public import LeanPool.GoldbergSeymour.CorrespondingTerminalClosureEq -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveEdge -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree public import LeanPool.GoldbergSeymour.ExtensionBase -public import LeanPool.GoldbergSeymour.ExtensionRules -public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.ParallelExtensionColor public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovClosureExists -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeExit -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent -public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion -public import LeanPool.GoldbergSeymour.StableColoringEquivalence - public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! diff --git a/LeanPool/GoldbergSeymour/TdTerminalRERebuild.lean b/LeanPool/GoldbergSeymour/TdTerminalRERebuild.lean index d33540092d..c439ba0822 100644 --- a/LeanPool/GoldbergSeymour/TdTerminalRERebuild.lean +++ b/LeanPool/GoldbergSeymour/TdTerminalRERebuild.lean @@ -7,6 +7,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.RevisitingTerminalStatements +public import LeanPool.GoldbergSeymour.TashkinovSeriesAppend +public import LeanPool.GoldbergSeymour.TdReplacementPrefixExact +public import LeanPool.GoldbergSeymour.TdEarlierPEWitnessIdentification /-! # Rebuilding a revisiting terminal extension @@ -5695,7 +5698,6 @@ theorem helper_hseriesTreeAgree_6351.{u_1, u_2} : TashkinovSeriesDataAppend] convert (Fin.lastCases_castSucc j.succ.castSucc) using 1; - _ = originalPrefix.series.data.tree j.succ.castSucc := corr.ladderTreesAgree j _ = ett.series.data.tree diff --git a/LeanPool/GoldbergSeymour/TdTerminalSEPERebuild.lean b/LeanPool/GoldbergSeymour/TdTerminalSEPERebuild.lean index 3768f20ab9..94e9c5c08e 100644 --- a/LeanPool/GoldbergSeymour/TdTerminalSEPERebuild.lean +++ b/LeanPool/GoldbergSeymour/TdTerminalSEPERebuild.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TerminalSeriesRebuildTransport +public import LeanPool.GoldbergSeymour.TdReplacementPrefixExact /-! # Td Terminal SEPERebuild @@ -1107,7 +1108,7 @@ private abbrev helperContinuation1431Conditions.{u_1, u_2} : Prop := MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree replacementLast.succ) (TashkinovStoredColors corr.replacementSeries.data replacementLast) (corr.replacementSeries.data.coloring replacementLast) := - helperReplacementChoice5196 G k e0 input T generating ett hpositive previousProper + helperReplacementChoice5196 G k e0 input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf originalPrefix corr hcorrFinalColor hreplacementCurrentTree hreplacementStored; @@ -2402,7 +2403,7 @@ private theorem helper_continuation_1943.{u_1, u_2} : (TreeMissingColors rho (corr.replacementSeries.data.tree replacementLast.succ)) := by exact @helper_hpeAlternativeReplacement_5946 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hnewAlternativeFails) (@originalPrefix) (@corr) (@hcorrFinalColor) @@ -2759,7 +2760,7 @@ private theorem helper_continuation_2339.{u_1, u_2} : (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := by exact @helperNewChoice4049 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@previousProper) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) have hclosedPrev : ColoredVertexSetClosed G sigmaPrev @@ -3047,7 +3048,7 @@ private theorem helper_continuation_2265.{u_1, u_2} : (TreeMissingColors pi (corr.replacementSeries.data.tree replacementLast.succ)) := by exact @helper_hnewAlternativeReplacement_4116 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hnewAlternative) (@originalPrefix) (@corr) (@hcorrFinalColor) @@ -3164,7 +3165,7 @@ private theorem helper_branch_2237.{u_1, u_2} : (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := by exact @helperNewChoice2409 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@previousProper) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) have hclosedPrev : ColoredVertexSetClosed G sigmaPrev diff --git a/LeanPool/GoldbergSeymour/TechnicalTheoremBase.lean b/LeanPool/GoldbergSeymour/TechnicalTheoremBase.lean index 0ba2888a45..6cbeb55b7c 100644 --- a/LeanPool/GoldbergSeymour/TechnicalTheoremBase.lean +++ b/LeanPool/GoldbergSeymour/TechnicalTheoremBase.lean @@ -5,26 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTashkinovTree -public import LeanPool.GoldbergSeymour.TashkinovClosure public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TashkinovTree -public import LeanPool.GoldbergSeymour.TreeIncidentEdge public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet -public import LeanPool.GoldbergSeymour.TashTree public import LeanPool.GoldbergSeymour.Tchange public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion diff --git a/LeanPool/GoldbergSeymour/TechnicalTheoremLarge.lean b/LeanPool/GoldbergSeymour/TechnicalTheoremLarge.lean index e603e29004..648d8d5992 100644 --- a/LeanPool/GoldbergSeymour/TechnicalTheoremLarge.lean +++ b/LeanPool/GoldbergSeymour/TechnicalTheoremLarge.lean @@ -5,11 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Basic2 -public import LeanPool.GoldbergSeymour.ExtensionBase -public import LeanPool.GoldbergSeymour.ExtensionRules public import LeanPool.GoldbergSeymour.RutgersCurrentRungInterchangeability -public import LeanPool.GoldbergSeymour.Td public import LeanPool.GoldbergSeymour.TechnicalCurrentRungElementaryLarge /-! diff --git a/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixConstruction.lean b/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixConstruction.lean index 257c42ede3..51f7295364 100644 --- a/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixConstruction.lean +++ b/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixConstruction.lean @@ -6,6 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TerminalHierarchyPrefixPreparation +public import LeanPool.GoldbergSeymour.MaximumProperty +public import LeanPool.GoldbergSeymour.GoodHierarchy /-! # Terminal hierarchy prefix constructors diff --git a/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean b/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean index d6441a6918..bbc3bd8d6f 100644 --- a/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean +++ b/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean @@ -5,20 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.GoodHierarchy -public import LeanPool.GoldbergSeymour.HierarchyBase -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.HierarchySegmentColors -public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors public import LeanPool.GoldbergSeymour.HierarchyStarredStage -public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.OrderedTreeUnion -public import LeanPool.GoldbergSeymour.TashkinovHierarchy -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! # Terminal hierarchy prefix preparation diff --git a/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean b/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean index 2fad2e0ab8..077b53c8de 100644 --- a/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean +++ b/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean @@ -9,8 +9,8 @@ public import LeanPool.GoldbergSeymour.HierarchyPrefixData public import LeanPool.GoldbergSeymour.TerminalStoredColors public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix - public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset /-! # P2752_T2_Terminal Hierarchy Restore diff --git a/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean b/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean index 3f745a4862..ff0992690b 100644 --- a/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean +++ b/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean @@ -6,18 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans -public import LeanPool.GoldbergSeymour.BaseDisplayedEdges -public import LeanPool.GoldbergSeymour.TerminalRoute public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport public import LeanPool.GoldbergSeymour.ChangeLemma -public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail /-! diff --git a/LeanPool/GoldbergSeymour/TerminalPrefixReconstruction.lean b/LeanPool/GoldbergSeymour/TerminalPrefixReconstruction.lean index e237911905..360718c37c 100644 --- a/LeanPool/GoldbergSeymour/TerminalPrefixReconstruction.lean +++ b/LeanPool/GoldbergSeymour/TerminalPrefixReconstruction.lean @@ -8,6 +8,8 @@ module public import LeanPool.GoldbergSeymour.HierarchyPrefixData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage +public import LeanPool.GoldbergSeymour.HierarchyLEMStable /-! # P2752_T2_Prefix Reconstruction diff --git a/LeanPool/GoldbergSeymour/TerminalRoute.lean b/LeanPool/GoldbergSeymour/TerminalRoute.lean index adf0f44394..484bcdb7e5 100644 --- a/LeanPool/GoldbergSeymour/TerminalRoute.lean +++ b/LeanPool/GoldbergSeymour/TerminalRoute.lean @@ -6,13 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree - public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset -public import LeanPool.GoldbergSeymour.TreeSequencePrefix - /-! # P2813_T1_Terminal Route diff --git a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean index 397742e08c..2c4d1e0e8f 100644 --- a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean +++ b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean @@ -5,68 +5,9 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Basic2 public import LeanPool.GoldbergSeymour.PositivePrefixNoRevisiting -public import LeanPool.GoldbergSeymour.TdEarlierPEWitnessIdentification -public import LeanPool.GoldbergSeymour.TdReplacementPrefixExact -public import LeanPool.GoldbergSeymour.AdjacentEdges -public import LeanPool.GoldbergSeymour.BoundaryColorEdges -public import LeanPool.GoldbergSeymour.BoundaryEdges -public import LeanPool.GoldbergSeymour.CertifiedETTRestriction -public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed -public import LeanPool.GoldbergSeymour.ColoredVertexSetStronglyClosed -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.DefectiveColor -public import LeanPool.GoldbergSeymour.DefectiveEdge -public import LeanPool.GoldbergSeymour.DefectiveVertex -public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.ExtensionBase -public import LeanPool.GoldbergSeymour.ExtensionRules public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone -public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled -public import LeanPool.GoldbergSeymour.IsOneEdgeUncolored -public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.KTriple -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice -public import LeanPool.GoldbergSeymour.MaximumProperty -public import LeanPool.GoldbergSeymour.MaximumPropertyTransport -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.ModColoring -public import LeanPool.GoldbergSeymour.ParallelExtensionColor -public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificate -public import LeanPool.GoldbergSeymour.StableColoring -public import LeanPool.GoldbergSeymour.TashkinovAugmentation -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import LeanPool.GoldbergSeymour.TashkinovClosure -public import LeanPool.GoldbergSeymour.TashkinovClosureExists -public import LeanPool.GoldbergSeymour.TashkinovSeries -public import LeanPool.GoldbergSeymour.TashkinovSeriesAppend -public import LeanPool.GoldbergSeymour.TashkinovSeriesFinalETTExists -public import LeanPool.GoldbergSeymour.TashkinovSeriesStep -public import LeanPool.GoldbergSeymour.TashkinovStoredColors -public import LeanPool.GoldbergSeymour.TashkinovStoredColorsAppend -public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.TreeExit -public import LeanPool.GoldbergSeymour.TreeExitPath -public import LeanPool.GoldbergSeymour.TreeIncidentEdge -public import LeanPool.GoldbergSeymour.TreeInterchangeable -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TwoColorComponent -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorCycle -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent -public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificateAppend -public import LeanPool.GoldbergSeymour.ParallelExtensionColorAppend -public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion public import LeanPool.GoldbergSeymour.StableColoringEquivalence public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis @@ -798,7 +739,6 @@ noncomputable abbrev helperReplacementChoice3411.{u_1, u_2} : (generating : PartialEdgeColoring E k) → (ett : ExtendedTashkinovTree G k e0 input T generating) → (hpositive : (0 : ℕ) < ett.rounds) → - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by @@ -950,7 +890,6 @@ noncomputable abbrev helperReplacementChoice5196.{u_1, u_2} : (generating : PartialEdgeColoring E k) → (ett : ExtendedTashkinovTree G k e0 input T generating) → (hpositive : (0 : ℕ) < ett.rounds) → - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by @@ -4783,7 +4722,7 @@ theorem helper_hnewAlternativeZero_3753.{u_1, u_2} : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (Tstar closureTree : TreeSequence G e0), + k) (closureTree : TreeSequence G e0), let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by have := GoldbergSeymour.TreeSequence.positive T @@ -4841,12 +4780,12 @@ theorem helper_hnewAlternativeZero_3753.{u_1, u_2} : appendedChoice.selected pi → Disjoint (MissingColors G pi appendedChoice.otherEndpoint) (TreeMissingColors pi (appendedData.tree zeroLast.succ.castSucc)) := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q - previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne - hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternative - prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta - newGamma appendedData happendTree happendColor happendStored appendedChoice pi hpiProper - hpiOne hpiStable + intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree q previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternative prefixInput + zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendTree happendColor happendStored appendedChoice pi hpiProper hpiOne + hpiStable have hpiStable' := hpiStable change StableColoring (appendedData.tree zeroLast.succ.castSucc) (insert choice.color @@ -4867,7 +4806,7 @@ theorem helper_lastStep_3779.{u_1, u_2} : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (Tstar closureTree : TreeSequence G e0), TreeSequenceInitialSegment + k) (closureTree : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree → let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by @@ -4930,15 +4869,14 @@ theorem helper_lastStep_3779.{u_1, u_2} : (Fin.last ett.rounds).castSucc).length < closureTree.length → TashkinovSeriesStep G k (1 : ℕ) e0 prefixInput appendedData (Fin.last (1 : ℕ)) := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree hTnClosure q - hqSucc adjoined previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper - hsigmaPrevOne hsigmaPrevStableQ hsigmaPrevSigma hchoiceDefective hchoiceEdgeNew - hsigmaPrevSelf hclosedPrev hnotStrongPrev prefixInput zeroPrefix fstar seed hadjoin hfstar - hseedClosure zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma - appendedData happendLastTree happendLastColor happendLastStored happendLastEdges - happendLastKind happendLastVertex happendLastOutside happendLastDelta happendLastGamma - happendTree happendColor happendStored appendedChoice hnoRevisitingZero hnewAlternativeZero - hstrictClosure + intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree hTnClosure q hqSucc + adjoined previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hsigmaPrevSigma hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf hclosedPrev + hnotStrongPrev prefixInput zeroPrefix fstar seed hadjoin hfstar hseedClosure zeroLast + newStored newEdges newKind newVertex newOutside newDelta newGamma appendedData happendLastTree + happendLastColor happendLastStored happendLastEdges happendLastKind happendLastVertex + happendLastOutside happendLastDelta happendLastGamma happendTree happendColor happendStored + appendedChoice hnoRevisitingZero hnewAlternativeZero hstrictClosure have hlast : zeroLast.succ = Fin.last 1 := by apply Fin.ext rfl @@ -5695,7 +5633,7 @@ theorem helper_hnewAlternativeReplacement_4116.{u_1, u_2} : ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (Tstar : TreeSequence G e0), + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) , let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by have := GoldbergSeymour.TreeSequence.positive T @@ -5752,11 +5690,11 @@ theorem helper_hnewAlternativeReplacement_4116.{u_1, u_2} : G pi replacementChoice.otherEndpoint) (TreeMissingColors pi (corr.replacementSeries.data.tree replacementLast.succ)) := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper - previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ - hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternative originalPrefix - corr hcorrFinalColor replacementLast hreplacementCurrentTree hreplacementStored - replacementChoice pi hpiProper hpiOne hpiStable + intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternative originalPrefix corr hcorrFinalColor + replacementLast hreplacementCurrentTree hreplacementStored replacementChoice pi hpiProper + hpiOne hpiStable have hpiStable' := hpiStable change StableColoring (corr.replacementSeries.data.tree replacementLast.succ) diff --git a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean index b2d08aa3a6..de42979745 100644 --- a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean +++ b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean @@ -6,6 +6,8 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TerminalSeriesRebuildPreparation +public import LeanPool.GoldbergSeymour.TashkinovSeriesAppend +public import LeanPool.GoldbergSeymour.ExtensionBase /-! # Transport lemmas for terminal extension reconstruction @@ -2385,7 +2387,7 @@ theorem helper_hpeAlternativeZero_5555.{u_1, u_2} : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (Tstar closureTree : TreeSequence G e0), + k) (closureTree : TreeSequence G e0), let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by have := GoldbergSeymour.TreeSequence.positive T @@ -2444,12 +2446,11 @@ theorem helper_hpeAlternativeZero_5555.{u_1, u_2} : appendedChoice.selected rho ∧ ¬Disjoint (MissingColors G rho appendedChoice.otherEndpoint) (TreeMissingColors rho (appendedData.tree zeroLast.succ.castSucc)) := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma - previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne - hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice - hnewAlternativeFails prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex - newOutside newDelta newGamma appendedData happendTree happendColor happendStored - appendedChoice + intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree q gamma previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternativeFails prefixInput + zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendTree happendColor happendStored appendedChoice rcases hnewAlternativeFails with ⟨rho, hrhoProper, hrhoOne, hrhoStable, hrhoNotDisjoint⟩ refine ⟨rho, hrhoProper, hrhoOne, ?_, ?_⟩ @@ -2472,7 +2473,7 @@ theorem helper_hpeGammaRuleZero_5579.{u_1, u_2} : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (Tstar closureTree : TreeSequence G e0), + k) (closureTree : TreeSequence G e0), let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by have := GoldbergSeymour.TreeSequence.positive T @@ -2524,12 +2525,11 @@ theorem helper_hpeGammaRuleZero_5579.{u_1, u_2} : ParallelExtensionColor appendedData zeroLast.castSucc appendedChoice.selected appendedChoice.vertex gamma := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ closureTree q gamma - previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne - hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice - hgammaPrevMissing H u p prefixInput zeroPrefix zeroLast newStored newEdges newKind - newVertex newOutside newDelta newGamma appendedData happendTree happendColor happendStored - appendedChoice + intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree q gamma previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hgammaPrevMissing H u p prefixInput + zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendTree happendColor happendStored appendedChoice rw [ParallelExtensionColorAppend zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta newGamma zeroLast appendedChoice.selected appendedChoice.vertex gamma] @@ -2546,7 +2546,7 @@ theorem helper_lastStep_5593.{u_1, u_2} : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E k), IsProperEdgeColoring G sigma → IsOneEdgeUncolored sigma e0 → - ∀ (Tstar closureTree : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree + ∀ (closureTree : TreeSequence G e0), TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree → let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by @@ -2612,15 +2612,15 @@ theorem helper_lastStep_5593.{u_1, u_2} : < closureTree.length → TashkinovSeriesStep G k (1 : ℕ) e0 prefixInput appendedData (Fin.last (1 : ℕ)) := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne _ - closureTree hTnClosure q hqSucc gamma secondStable previousProper previousOneUncolored - choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective - hchoiceEdgeNew hsigmaPrevSelf hclosedPrev hnotStrongPrev hsigmaRecovered hnewExit - prefixInput zeroPrefix hterminalClosure zeroLast newStored newEdges newKind newVertex - newOutside newDelta newGamma appendedData happendLastTree happendLastColor - happendLastStored happendLastEdges happendLastKind happendLastVertex happendLastOutside - happendLastDelta happendLastGamma happendTree happendColor happendStored appendedChoice - hpeNoRevisitingZero hpeAlternativeZero hpeGammaRuleZero hstrictClosure + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne closureTree + hTnClosure q hqSucc gamma secondStable previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf hclosedPrev hnotStrongPrev hsigmaRecovered hnewExit prefixInput zeroPrefix + hterminalClosure zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendLastTree happendLastColor happendLastStored happendLastEdges + happendLastKind happendLastVertex happendLastOutside happendLastDelta happendLastGamma + happendTree happendColor happendStored appendedChoice hpeNoRevisitingZero hpeAlternativeZero + hpeGammaRuleZero hstrictClosure have hlast : zeroLast.succ = Fin.last 1 := by apply Fin.ext rfl @@ -3383,7 +3383,7 @@ theorem helper_hpeAlternativeReplacement_5946.{u_1, u_2} : ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (Tstar : TreeSequence G e0), + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) , let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by have := GoldbergSeymour.TreeSequence.positive T @@ -3440,11 +3440,10 @@ theorem helper_hpeAlternativeReplacement_5946.{u_1, u_2} : (MissingColors G rho replacementChoice.otherEndpoint) (TreeMissingColors rho (corr.replacementSeries.data.tree replacementLast.succ)) := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper - previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ - hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternativeFails - originalPrefix corr hcorrFinalColor replacementLast hreplacementCurrentTree - hreplacementStored replacementChoice + intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternativeFails originalPrefix corr + hcorrFinalColor replacementLast hreplacementCurrentTree hreplacementStored replacementChoice rcases hnewAlternativeFails with ⟨rho, hrhoProper, hrhoOne, hrhoStable, hrhoNotDisjoint⟩ refine ⟨rho, hrhoProper, hrhoOne, ?_, ?_⟩ @@ -3661,7 +3660,7 @@ theorem helper_branch_6368.{u_1, u_2} : ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (Tstar : TreeSequence G e0), + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) , let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by have := GoldbergSeymour.TreeSequence.positive T @@ -3739,7 +3738,7 @@ theorem helper_branch_6368.{u_1, u_2} : TashkinovExtensionKind.PE → corr.replacementSeries.data.chosenVertex h ≠ some replacementChoice.vertex := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q gamma previousProper + intro V E _ _ _ G k e0 input T generating ett hpositive q gamma previousProper previousOneUncolored choice gammaRule sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf H u p hroundLarge originalPrefix hr corr hcorrFinalColor replacementLast horiginalPositive @@ -4852,7 +4851,7 @@ private theorem helper_continuation_4951.{u_1, u_2} : (@hsigmaStable) (@Tstar) (@closureTree) (@hroundOne) (@prefixInput) (@extendedSeries) (@hroundsEq) (@hfinalColor) let replacementETT := @helperReplacementETT3160 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@sigma) + inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@sigma) (@Tstar) (@hTnTstar) (@hstrict) (@closureTree) (@hTstarClosure) (@prefixInput) (@extendedSeries) (@hroundsEq) (@hfinalTree) (@hpenultimateTree) (@hfinalColor) refine ⟨{ @@ -4965,7 +4964,7 @@ theorem helper_branch_11555.{u_1, u_2} : (@Tstar) (@closureTree) (@choice) (@prefixInput) (@zeroPrefix) have hnewAlternativeZero := @helper_hnewAlternativeZero_3753 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) - (@Tstar) (@closureTree) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) + (@closureTree) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hnewAlternative) (@prefixInput) (@zeroPrefix) (@happendTree) (@happendColor) (@happendStored) @@ -4973,7 +4972,7 @@ theorem helper_branch_11555.{u_1, u_2} : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < closureTree.length := lt_of_lt_of_le hstrict hTstarClosure.1 have lastStep := @helper_lastStep_3779 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@closureTree) (@hTnClosure) (@hqSucc) (@adjoined) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hsigmaPrevSigma) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) @@ -5084,7 +5083,7 @@ theorem helper_hsigmaPrevEnlarged_12232.{u_1, u_2} : have hclosed : ∀ x, x ∈ path.support → ∀ y, (TwoColorIncidenceGraph G secondStable gamma choice.color).Adj x y → y ∈ path.support := by - exact @helper_hclosed_1893 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_hclosed_1893 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@secondStable) (@choice) (@hmissing) (@hdegree) (@u) (@path) (@pathIs) (@pathLen) (by @@ -5228,7 +5227,7 @@ private theorem helper_hpeAlternativeZero_6498.{u_1, u_2} : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (Tstar closureTree : TreeSequence G e0), + k) (closureTree : TreeSequence G e0), let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega @@ -5286,14 +5285,13 @@ private theorem helper_hpeAlternativeZero_6498.{u_1, u_2} : appendedChoice.selected rho ∧ ¬Disjoint (MissingColors G rho appendedChoice.otherEndpoint) (TreeMissingColors rho (appendedData.tree zeroLast.succ.castSucc)) := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q gamma - previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne - hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice - hnewAlternativeFails prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex - newOutside newDelta newGamma appendedData happendTree happendColor happendStored - appendedChoice + intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree q gamma previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternativeFails prefixInput + zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendTree happendColor happendStored appendedChoice exact @helper_hpeAlternativeZero_5555 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@closureTree) (@gamma) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hnewAlternativeFails) (@prefixInput) (@zeroPrefix) @@ -5305,7 +5303,7 @@ private theorem helper_hpeGammaRuleZero_6513.{u_1, u_2} : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (Tstar closureTree : TreeSequence G e0), + k) (closureTree : TreeSequence G e0), let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega @@ -5352,13 +5350,13 @@ private theorem helper_hpeGammaRuleZero_6513.{u_1, u_2} : ParallelExtensionColor appendedData zeroLast.castSucc appendedChoice.selected appendedChoice.vertex gamma := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q gamma - previousProper previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne - hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf hgammaPrevMissing H u p - prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta - newGamma appendedData happendTree happendColor happendStored appendedChoice + intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree q gamma previousProper + previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf hgammaPrevMissing H u p prefixInput zeroPrefix + zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma appendedData + happendTree happendColor happendStored appendedChoice exact @helper_hpeGammaRuleZero_5579 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) + (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@closureTree) (@gamma) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hgammaPrevMissing) (@u) (@p) (@prefixInput) @@ -5370,8 +5368,8 @@ private theorem helper_lastStep_6525.{u_1, u_2} : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (Tstar closureTree - : TreeSequence G e0) (_ : TreeSequenceInitialSegment (ett.series.data.tree (Fin.last + k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (closureTree : + TreeSequence G e0) (_ : TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by @@ -5437,18 +5435,18 @@ private theorem helper_lastStep_6525.{u_1, u_2} : ett.rounds).castSucc).length < closureTree.length), TashkinovSeriesStep G k (1 : ℕ) e0 prefixInput appendedData (Fin.last (1 : ℕ)) := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne Tstar - closureTree hTnClosure q hqSucc gamma secondStable previousProper previousOneUncolored - choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective - hchoiceEdgeNew hsigmaPrevSelf hclosedPrev hnotStrongPrev hsigmaRecovered hnewExit - prefixInput zeroPrefix hterminalClosure zeroLast newStored newEdges newKind newVertex - newOutside newDelta newGamma appendedData happendLastTree happendLastColor - happendLastStored happendLastEdges happendLastKind happendLastVertex happendLastOutside - happendLastDelta happendLastGamma happendTree happendColor happendStored appendedChoice - hpeNoRevisitingZero hpeAlternativeZero hpeGammaRuleZero hstrictClosure + intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne closureTree + hTnClosure q hqSucc gamma secondStable previousProper previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew + hsigmaPrevSelf hclosedPrev hnotStrongPrev hsigmaRecovered hnewExit prefixInput zeroPrefix + hterminalClosure zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma + appendedData happendLastTree happendLastColor happendLastStored happendLastEdges + happendLastKind happendLastVertex happendLastOutside happendLastDelta happendLastGamma + happendTree happendColor happendStored appendedChoice hpeNoRevisitingZero hpeAlternativeZero + hpeGammaRuleZero hstrictClosure exact @helper_lastStep_5593 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) - (@hsigmaOne) (@Tstar) (@closureTree) (@hTnClosure) (@hqSucc) (@gamma) (@secondStable) + (@hsigmaOne) (@closureTree) (@hTnClosure) (@hqSucc) (@gamma) (@secondStable) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) (@hsigmaRecovered) (@hnewExit) @@ -5845,7 +5843,7 @@ theorem helper_branch_12554.{u_1, u_2} : ¬ Disjoint (MissingColors G rho appendedChoice.otherEndpoint) (TreeMissingColors rho (appendedData.tree zeroLast.succ.castSucc)) := by - apply helper_hpeAlternativeZero_6498 <;> assumption + apply helper_hpeAlternativeZero_6498; assumption have hpeGammaRuleZero : ParallelExtensionColor appendedData zeroLast.castSucc appendedChoice.selected appendedChoice.vertex gamma := by @@ -6902,7 +6900,7 @@ theorem helper_hpeGammaRuleReplacement_13982.{u_1, u_2} : ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (Tstar : TreeSequence G e0), + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by have := GoldbergSeymour.TreeSequence.positive T @@ -7004,7 +7002,7 @@ theorem helper_hpeGammaRuleReplacement_13982.{u_1, u_2} : refine ⟨?_, ?_⟩ · simpa [replacementChoice] using hgammaPrevMissing · exact @helper_branch_6368 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) - (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@previousProper) + (@input) (@T) (@generating) (@ett) (@hpositive) (@gamma) (@previousProper) (@previousOneUncolored) (@choice) (@gammaRule) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@corr) diff --git a/LeanPool/GoldbergSeymour/ThetaExclusion.lean b/LeanPool/GoldbergSeymour/ThetaExclusion.lean index 1ffcab0bf2..d26198368a 100644 --- a/LeanPool/GoldbergSeymour/ThetaExclusion.lean +++ b/LeanPool/GoldbergSeymour/ThetaExclusion.lean @@ -8,6 +8,7 @@ module public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength /-! # P2880_T1_Theta Exclusion diff --git a/LeanPool/GoldbergSeymour/TreeExitPath.lean b/LeanPool/GoldbergSeymour/TreeExitPath.lean index 5b0c68c105..e6b5f1836a 100644 --- a/LeanPool/GoldbergSeymour/TreeExitPath.lean +++ b/LeanPool/GoldbergSeymour/TreeExitPath.lean @@ -8,6 +8,7 @@ module public import LeanPool.GoldbergSeymour.MissingColors public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import Mathlib.Combinatorics.SimpleGraph.Paths /-! # Tree Exit Path diff --git a/LeanPool/GoldbergSeymour/TreeMissingColorsCardLowerBound.lean b/LeanPool/GoldbergSeymour/TreeMissingColorsCardLowerBound.lean index b6f6053c0a..e96ebde27d 100644 --- a/LeanPool/GoldbergSeymour/TreeMissingColorsCardLowerBound.lean +++ b/LeanPool/GoldbergSeymour/TreeMissingColorsCardLowerBound.lean @@ -6,16 +6,9 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary -public import LeanPool.GoldbergSeymour.Degree -public import LeanPool.GoldbergSeymour.Incident -public import LeanPool.GoldbergSeymour.LooplessMultigraph public import LeanPool.GoldbergSeymour.MaximumDegree -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PartialEdgeColoring -public import LeanPool.GoldbergSeymour.PresentColors public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequence -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import Mathlib.Data.Fintype.EquivFin /-! # Tree Missing Colors Card Lower Bound diff --git a/LeanPool/GoldbergSeymour/TreeSequenceEdgeSet.lean b/LeanPool/GoldbergSeymour/TreeSequenceEdgeSet.lean index 3bf69c3b2a..30c31c76fb 100644 --- a/LeanPool/GoldbergSeymour/TreeSequenceEdgeSet.lean +++ b/LeanPool/GoldbergSeymour/TreeSequenceEdgeSet.lean @@ -5,9 +5,8 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.Fin - public import LeanPool.GoldbergSeymour.TreeSequence +public import Mathlib.Data.Fintype.Basic /-! # Tree Sequence Edge Set diff --git a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetEq.lean b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetEq.lean index 012e3edb14..52f18e9f94 100644 --- a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetEq.lean +++ b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetEq.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import Mathlib.Data.Fintype.Card /-! # Tree Sequence Initial Segment Vertex Set Eq diff --git a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetSubset.lean b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetSubset.lean index a27cddb49a..532750dc2c 100644 --- a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetSubset.lean +++ b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentVertexSetSubset.lean @@ -7,6 +7,7 @@ module public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import Mathlib.Data.Fintype.EquivFin /-! # Tree Sequence Initial Segment Vertex Set Subset diff --git a/LeanPool/GoldbergSeymour/TreeSequenceVertexSet.lean b/LeanPool/GoldbergSeymour/TreeSequenceVertexSet.lean index caec6bf1fc..7019da3088 100644 --- a/LeanPool/GoldbergSeymour/TreeSequenceVertexSet.lean +++ b/LeanPool/GoldbergSeymour/TreeSequenceVertexSet.lean @@ -5,9 +5,8 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.Fin - public import LeanPool.GoldbergSeymour.TreeSequence +public import Mathlib.Data.Fintype.Basic /-! # Tree Sequence Vertex Set diff --git a/LeanPool/GoldbergSeymour/TreeUsedColors.lean b/LeanPool/GoldbergSeymour/TreeUsedColors.lean index b44062081f..ddce158718 100644 --- a/LeanPool/GoldbergSeymour/TreeUsedColors.lean +++ b/LeanPool/GoldbergSeymour/TreeUsedColors.lean @@ -5,10 +5,9 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.Fin - public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.PartialEdgeColoring +public import Mathlib.Data.Fintype.Basic /-! # Tree Used Colors diff --git a/LeanPool/GoldbergSeymour/TrunkRotation.lean b/LeanPool/GoldbergSeymour/TrunkRotation.lean index 0cef3b9e6e..c61ea56b59 100644 --- a/LeanPool/GoldbergSeymour/TrunkRotation.lean +++ b/LeanPool/GoldbergSeymour/TrunkRotation.lean @@ -5,7 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.BalancedGlobalMaximumTriple public import LeanPool.GoldbergSeymour.NormalCycleEdge /-! diff --git a/LeanPool/GoldbergSeymour/TwoColorComponent.lean b/LeanPool/GoldbergSeymour/TwoColorComponent.lean index dda86aab70..59ac57cc31 100644 --- a/LeanPool/GoldbergSeymour/TwoColorComponent.lean +++ b/LeanPool/GoldbergSeymour/TwoColorComponent.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected /-! # Two Color Component diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentNearestSegment.lean b/LeanPool/GoldbergSeymour/TwoColorComponentNearestSegment.lean index 13911602a5..b1e7460edd 100644 --- a/LeanPool/GoldbergSeymour/TwoColorComponentNearestSegment.lean +++ b/LeanPool/GoldbergSeymour/TwoColorComponentNearestSegment.lean @@ -5,14 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.Incident public import LeanPool.GoldbergSeymour.IsProperEdgeColoring -public import LeanPool.GoldbergSeymour.LooplessMultigraph -public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Two Color Component Nearest Segment diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapDisjointPairGraph.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapDisjointPairGraph.lean index 70641d6def..cc7b0888b5 100644 --- a/LeanPool/GoldbergSeymour/TwoColorComponentSwapDisjointPairGraph.lean +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapDisjointPairGraph.lean @@ -6,7 +6,6 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Two Color Component Swap Disjoint Pair Graph diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapMissingBehavior.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapMissingBehavior.lean index 628a6aa7b3..d8eaee1d13 100644 --- a/LeanPool/GoldbergSeymour/TwoColorComponentSwapMissingBehavior.lean +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapMissingBehavior.lean @@ -7,10 +7,7 @@ module public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.PresentColors -public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Two Color Component Swap Missing Behavior diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapNonElementary.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapNonElementary.lean index ec49e60605..b867d0557e 100644 --- a/LeanPool/GoldbergSeymour/TwoColorComponentSwapNonElementary.lean +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapNonElementary.lean @@ -8,12 +8,9 @@ module public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint -public import LeanPool.GoldbergSeymour.MissingColors -public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Two Color Component Swap Non Elementary diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapPreservesDisjointComponent.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapPreservesDisjointComponent.lean index 488143ace4..64b8ca5fc1 100644 --- a/LeanPool/GoldbergSeymour/TwoColorComponentSwapPreservesDisjointComponent.lean +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapPreservesDisjointComponent.lean @@ -5,9 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Two Color Component Swap Preserves Disjoint Component diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapProper.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapProper.lean index b5ea61ba68..eccc5cbf1b 100644 --- a/LeanPool/GoldbergSeymour/TwoColorComponentSwapProper.lean +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapProper.lean @@ -5,10 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.AdjacentEdges public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.TwoColorComponentSwap -public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph /-! # Two Color Component Swap Proper diff --git a/LeanPool/GoldbergSeymour/TwoColorIncidenceDegreeAtMostTwo.lean b/LeanPool/GoldbergSeymour/TwoColorIncidenceDegreeAtMostTwo.lean index bc1a66bff9..cc32986ec7 100644 --- a/LeanPool/GoldbergSeymour/TwoColorIncidenceDegreeAtMostTwo.lean +++ b/LeanPool/GoldbergSeymour/TwoColorIncidenceDegreeAtMostTwo.lean @@ -6,10 +6,9 @@ Authors: Wesley Pegden module public import Mathlib.Basic.Finite.Sum - -public import LeanPool.GoldbergSeymour.AdjacentEdges public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import Mathlib.Combinatorics.SimpleGraph.Finite /-! # Two Color Incidence Degree At Most Two diff --git a/LeanPool/GoldbergSeymour/TwoColorIncidenceGraph.lean b/LeanPool/GoldbergSeymour/TwoColorIncidenceGraph.lean index 764a5e6336..281b71f7ea 100644 --- a/LeanPool/GoldbergSeymour/TwoColorIncidenceGraph.lean +++ b/LeanPool/GoldbergSeymour/TwoColorIncidenceGraph.lean @@ -5,9 +5,10 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected public import LeanPool.GoldbergSeymour.Incident public import LeanPool.GoldbergSeymour.PartialEdgeColoring +public import Mathlib.Combinatorics.SimpleGraph.Basic +public import Mathlib.Tactic.Bound.Init /-! # Two Color Incidence Graph diff --git a/LeanPool/GoldbergSeymour/TwoColorInterchangeableDistinctComponentCycle.lean b/LeanPool/GoldbergSeymour/TwoColorInterchangeableDistinctComponentCycle.lean index e94155a800..13f54c5227 100644 --- a/LeanPool/GoldbergSeymour/TwoColorInterchangeableDistinctComponentCycle.lean +++ b/LeanPool/GoldbergSeymour/TwoColorInterchangeableDistinctComponentCycle.lean @@ -5,13 +5,10 @@ Authors: Wesley Pegden -/ module -public import Mathlib.Data.Fintype.EquivFin public import LeanPool.GoldbergSeymour.IsProperEdgeColoring public import LeanPool.GoldbergSeymour.TreeInterchangeable public import LeanPool.GoldbergSeymour.TwoColorComponentCycle public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath -public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo -public import LeanPool.GoldbergSeymour.TwoColorPathComponent /-! # Two Color Interchangeable Distinct Component Cycle From 3661f7454c7eb9e48f60f72a45b4a981ae3fabad Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Thu, 5 Nov 2026 19:29:46 +0000 Subject: [PATCH 03/11] Preserve private helper imports during dependency minimization --- LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean b/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean index 7b9977178f..387df4e2a1 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +import all LeanPool.GoldbergSeymour.ExtensionBaseBranchPreparation +import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary public import LeanPool.GoldbergSeymour.ExtensionBaseStepLemmas public import LeanPool.GoldbergSeymour.ExtensionBaseClaim44 public import LeanPool.GoldbergSeymour.ExtensionBaseClaim43 From f1f8c0a82cccbfb8a5ebb4a64bbd14d80c2a1ed3 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Thu, 5 Nov 2026 20:10:51 +0000 Subject: [PATCH 04/11] Share index-bound proofs across dependent hierarchy contracts --- .../PositivePrefixNoRevisiting.lean | 596 ++++++++++-------- LeanPool/GoldbergSeymour/Preamble.lean | 10 + 2 files changed, 350 insertions(+), 256 deletions(-) diff --git a/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean b/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean index 204f7211e3..1bf212d3f4 100644 --- a/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean +++ b/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.Preamble + public import LeanPool.GoldbergSeymour.CertifiedETTRestriction public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree public import LeanPool.GoldbergSeymour.MaximumProperty @@ -75,26 +77,26 @@ private abbrev positivePrefixContradictionStatement.{u_1, u_2} : Prop := IsProperEdgeColoring G (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin ett.rounds).castSucc) → IsOneEdgeUncolored (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin ett.rounds).castSucc) e0 → StableColoring (ett.series.data.tree (⟨ett.rounds - (1 : ℕ), - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin ett.rounds).succ.castSucc) (TashkinovStoredColors ett.series.data (⟨ett.rounds - (1 : ℕ), - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by omega⟩ : + positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin ett.rounds).castSucc) sigmaPrev → ∀ @@ -102,8 +104,7 @@ private abbrev positivePrefixContradictionStatement.{u_1, u_2} : Prop := ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by - omega⟩ : + positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin ett.rounds).castSucc)) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), MaximumProperty originalPrefix → @@ -112,40 +113,34 @@ private abbrev positivePrefixContradictionStatement.{u_1, u_2} : Prop := originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE - (Decidable.byContradiction - fun (a : ¬originalPrefix.rounds + (2 : ℕ) ≤ ett.rounds + (2 : ℕ)) ↦ by omega) + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds 2 hr) i)) → ( ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE - (Decidable.byContradiction - fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds 1 hr) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE - (Decidable.byContradiction - fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds 1 hr) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges (Fin.castLE - (Decidable.byContradiction - fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds 1 hr) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE - (Decidable.byContradiction - fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds 1 hr) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors ett.series.data (Fin.castLE - (Decidable.byContradiction - fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds 1 hr) i)) → ∀ (corr : @@ -156,30 +151,31 @@ private abbrev positivePrefixContradictionStatement.{u_1, u_2} : Prop := ¬Nonempty (RevisitingExtensionCertificate ett.series.data (⟨ett.rounds - (1 : ℕ), - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by - omega⟩ : + positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin ett.rounds).castSucc) → - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ = + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin ett.rounds) + : Fin ett.rounds).succ = Fin.last ett.rounds → (0 : ℕ) < originalPrefix.rounds → Fin.castLE - (Decidable.byContradiction - fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by - omega) + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds 1 hr) (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))) = - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc → corr.replacementSeries.data.tree (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))).succ = ett.series.data.tree - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).succ.castSucc → originalPrefix.series.data.tree (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))).castSucc = ett.series.data.tree - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc.castSucc → ( ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} @@ -1652,35 +1648,47 @@ private abbrev helperBranch280Conditions.{u_1, u_2} : Prop := (_ : IsOneEdgeUncolored sigmaPrev e0) (_ : IsProperEdgeColoring G - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc)) (_ : IsOneEdgeUncolored - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) e0) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc) e0) (_ : StableColoring - (ett.series.data.tree (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).succ.castSucc) + (ett.series.data.tree (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).succ.castSucc) (TashkinovStoredColors ett.series.data - (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc) sigmaPrev) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc)) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : MaximumProperty originalPrefix) (_ : ( ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), - originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i))) + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i))) (_ : ( ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), - originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ - originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ originalPrefix.series.data.connectingEdges i = - ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ - originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + ett.series.data.connectingEdges (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ TashkinovStoredColors originalPrefix.series.data i = - TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i))) + TashkinovStoredColors ett.series.data (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i))) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)) @@ -1689,9 +1697,11 @@ private abbrev helperBranch280Conditions.{u_1, u_2} : Prop := (_ : ¬Nonempty (RevisitingExtensionCertificate ett.series.data - (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds).castSucc)) (_ : - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ = + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).succ = Fin.last ett.rounds) (_ : (0 : ℕ) < originalPrefix.rounds) (_ : @@ -1699,17 +1709,20 @@ private abbrev helperBranch280Conditions.{u_1, u_2} : Prop := (Decidable.byContradiction fun (a : ¬originalPrefix.rounds + (1 : ℕ) ≤ ett.rounds + (1 : ℕ)) ↦ by omega) (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))) = - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc) + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) (_ : corr.replacementSeries.data.tree (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))).succ = ett.series.data.tree - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc) + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).succ.castSucc) (_ : originalPrefix.series.data.tree (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))).castSucc = ett.series.data.tree - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc.castSucc) + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc.castSucc) (_ : ( ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} @@ -1767,11 +1780,13 @@ private abbrev helperHtreePrefixFull719Conditions.{u_1, u_2} : Prop := (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc)) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), - originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) → + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i)) → ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev @@ -1786,10 +1801,12 @@ private abbrev helperHtreePrefixFull719Conditions.{u_1, u_2} : Prop := (_ : Fin k), (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) = oldi.succ → oldi.succ = (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) → - ∀ (horiginalRoundsLess : originalPrefix.rounds < ett.rounds), + ∀ (_ : originalPrefix.rounds < ett.rounds), ∀ (fulli : Fin ett.rounds), fulli.succ = - (Fin.castLE (by omega) (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) : + (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) (available.earlier : Fin + (originalPrefix.rounds + (1 : ℕ))) : Fin (ett.rounds + (1 : ℕ))) → originalPrefix.series.data.tree oldi.succ.castSucc = ett.series.data.tree fulli.succ.castSucc @@ -2070,39 +2087,51 @@ private abbrev helperContinuation1990Conditions.{u_1, u_2} : Prop := (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds); ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc)) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) - (hprefixTrees : + (_ : ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), - originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) - (hprefixData : + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i)) + (_ : ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), - originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ - originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ originalPrefix.series.data.connectingEdges i = - ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ - originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + ett.series.data.connectingEdges (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ TashkinovStoredColors originalPrefix.series.data i = - TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + TashkinovStoredColors ett.series.data (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)) - (noRevisiting : + (_ : ¬Nonempty (RevisitingExtensionCertificate ett.series.data - (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds).castSucc)), let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; ∀ - (hlastMap : - Fin.castLE (by omega) replacementLast = - (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) - (hreplacementCurrentTree : + (_ : + Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) replacementLast = + (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds).castSucc) + (_ : corr.replacementSeries.data.tree replacementLast.succ = - ett.series.data.tree (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).succ.castSucc) + ett.series.data.tree (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).succ.castSucc) (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; ∀ (oldi : Fin originalPrefix.rounds) @@ -2110,9 +2139,9 @@ private abbrev helperContinuation1990Conditions.{u_1, u_2} : Prop := MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) (originalPrefix.series.data.coloring oldi.castSucc)) - (oldGamma : Fin k) (holdDeltaAvailable : oldChoice.color = available.delta) - (holdGammaAvailable : oldGamma = available.gamma) - (hreturnInOldEarlier : + (oldGamma : Fin k) (_ : oldChoice.color = available.delta) + (_ : oldGamma = available.gamma) + (_ : available.returnVertex ∈ TreeSequenceVertexSet (originalPrefix.series.data.tree earlierPrefix.castSucc)), let originalReturnGraph : SimpleGraph (V ⊕ E) := @@ -2124,43 +2153,48 @@ private abbrev helperContinuation1990Conditions.{u_1, u_2} : Prop := let originalReturnPath : originalReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := available.returnPath.transfer originalReturnGraph returnEdgeTransfer; - ∀ (horiginalReturnIsPath : originalReturnPath.IsPath) - (horiginalReturnSupport : + ∀ (_ : originalReturnPath.IsPath) + (_ : ∀ (z : V ⊕ E), z ∈ originalReturnPath.support ↔ z ∈ available.returnPath.support) - (hreturnInQ : + (_ : Sum.inl available.returnVertex ∈ TwoColorComponent G - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc) available.gamma available.delta (Sum.inr available.edge)) - (houtsideInQ : + (_ : Sum.inl available.outsideEndpoint ∈ TwoColorComponent G - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc) available.gamma available.delta (Sum.inr available.edge)) - (horiginalRoundsLess : originalPrefix.rounds < ett.rounds) + (_ : originalPrefix.rounds < ett.rounds) (originalCycle : TwoColorCycle G - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc) available.gamma available.delta) - (hcycleFull : + (_ : ∀ (x : V ⊕ E), x ∈ originalCycle.walk.support ↔ x ∈ TwoColorComponent G - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc) available.gamma available.delta (Sum.inr available.edge)), - let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE (by omega) earlierPrefix; - ∀ (hfullEarlierKind : ett.series.data.kind oldEarlier = some TashkinovExtensionKind.PE) + let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) earlierPrefix; + ∀ (_ : ett.series.data.kind oldEarlier = some TashkinovExtensionKind.PE) (fulli : Fin ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) (ett.series.data.coloring fulli.castSucc)) (fullGamma : Fin k) - (fullCurrentDelta : ett.series.data.delta fulli.succ = some fullChoice.color) - (fullCurrentGamma : ett.series.data.gamma fulli.succ = some fullGamma) - (hfullIndex : fulli.succ = oldEarlier) + (_ : ett.series.data.delta fulli.succ = some fullChoice.color) + (_ : ett.series.data.gamma fulli.succ = some fullGamma) + (_ : fulli.succ = oldEarlier) (htreePrefixFull : originalPrefix.series.data.tree oldi.succ.castSucc = ett.series.data.tree fulli.succ.castSucc), @@ -2169,26 +2203,26 @@ private abbrev helperContinuation1990Conditions.{u_1, u_2} : Prop := (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) (originalPrefix.series.data.coloring oldi.castSucc) := (htreePrefixFull ▸ oldChoice); - ∀ (hprefColorCast : prefixChoiceOnFull.color = oldChoice.color) - (hfullEdgePairs : + ∀ (_ : prefixChoiceOnFull.color = oldChoice.color) + (_ : ({ prefixChoiceOnFull.edge } : Finset E) = ({ fullChoice.edge } : Finset E)) - (hfullColorPairs : + (_ : (insert prefixChoiceOnFull.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k)) = (insert fullChoice.color ({ fullGamma } : Finset (Fin k)) : Finset (Fin k))) - (hfullDeltaMissing : + (_ : fullChoice.color ∈ MissingColors G (ett.series.data.coloring fulli.succ) fullChoice.vertex) - (hfullGammaNotMissing : + (_ : fullGamma ∉ MissingColors G (ett.series.data.coloring fulli.succ) fullChoice.vertex) - (hmissingPrefixFull : + (_ : MissingColors G (originalPrefix.series.data.coloring oldi.succ) prefixChoiceOnFull.vertex = MissingColors G (ett.series.data.coloring fulli.succ) fullChoice.vertex) - (hprefDeltaForFull : + (_ : prefixChoiceOnFull.color ∈ MissingColors G (originalPrefix.series.data.coloring oldi.succ) prefixChoiceOnFull.vertex) - (hprefGammaForFull : + (_ : oldGamma ∉ MissingColors G (originalPrefix.series.data.coloring oldi.succ) prefixChoiceOnFull.vertex), @@ -2203,34 +2237,45 @@ private abbrev helperBranch1721Conditions.{u_1, u_2} : Prop := ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc)) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), ( ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), - originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) → + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i)) → ( ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), - originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ - originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ originalPrefix.series.data.connectingEdges i = - ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ - originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + ett.series.data.connectingEdges (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ TashkinovStoredColors originalPrefix.series.data i = - TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) → + TashkinovStoredColors ett.series.data (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i)) → ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), ¬Nonempty (RevisitingExtensionCertificate ett.series.data - (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) → - Fin.castLE (by omega) + (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds).castSucc) → + Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))) = - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).castSucc → + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc → corr.replacementSeries.data.tree (Fin.last originalPrefix.rounds : Fin (originalPrefix.rounds + (1 : ℕ))).succ = ett.series.data.tree - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : Fin ett.rounds).succ.castSucc → + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).succ.castSucc → ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data @@ -2307,21 +2352,24 @@ private abbrev helperBranch1721Conditions.{u_1, u_2} : Prop := edge ∈ (TwoColorIncidenceGraph G (ett.series.data.coloring - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta : SimpleGraph (V ⊕ E)).edgeSet), (available.returnPath.transfer (TwoColorIncidenceGraph G (ett.series.data.coloring - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta : SimpleGraph (V ⊕ E)) returnEdgeTransfer : (TwoColorIncidenceGraph G (ett.series.data.coloring - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta : SimpleGraph (V ⊕ E)).Walk @@ -2332,14 +2380,16 @@ private abbrev helperBranch1721Conditions.{u_1, u_2} : Prop := (available.returnPath.transfer (TwoColorIncidenceGraph G (ett.series.data.coloring - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta : SimpleGraph (V ⊕ E)) returnEdgeTransfer : (TwoColorIncidenceGraph G (ett.series.data.coloring - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta : SimpleGraph (V ⊕ E)).Walk @@ -2349,20 +2399,23 @@ private abbrev helperBranch1721Conditions.{u_1, u_2} : Prop := Sum.inl available.returnVertex ∈ TwoColorComponent G (ett.series.data.coloring - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta (Sum.inr available.edge) → Sum.inl available.outsideEndpoint ∈ TwoColorComponent G (ett.series.data.coloring - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta (Sum.inr available.edge) → - ∀ (horiginalRoundsLess : originalPrefix.rounds < ett.rounds) + ∀ (_ : originalPrefix.rounds < ett.rounds) (originalCycle : TwoColorCycle G (ett.series.data.coloring - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta), ( @@ -2371,11 +2424,13 @@ private abbrev helperBranch1721Conditions.{u_1, u_2} : Prop := x ∈ TwoColorComponent G (ett.series.data.coloring - ((⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds) : + ((⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds) : Fin ett.rounds).castSucc) available.gamma available.delta (Sum.inr available.edge)) → ett.series.data.kind - (Fin.castLE (by omega) + (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) : Fin (ett.rounds + (1 : ℕ))) = some TashkinovExtensionKind.PE → @@ -2405,7 +2460,8 @@ private abbrev helperBranch1721Conditions.{u_1, u_2} : Prop := ({ fullChoice.edge } : Finset E) → ett.series.data.delta fulli.succ = some fullChoice.color → ett.series.data.gamma fulli.succ = some fullGamma → - (Fin.castLE (by omega) + (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) (available.earlier : Fin (originalPrefix.rounds + (1 : ℕ))) : Fin (ett.rounds + (1 : ℕ))) = @@ -2430,7 +2486,7 @@ private abbrev helperContinuation4070Conditions.{u_1, u_2} : Prop := (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds) - (hlower : + (_ : ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' generating'), @@ -2463,47 +2519,61 @@ private abbrev helperContinuation4070Conditions.{u_1, u_2} : Prop := (lower.series.data.coloring n) sigma → ∀ w ∈ TreeSequenceVertexSet Tn, Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ w = v), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds); ∀ (sigmaPrev : PartialEdgeColoring E k) - (previousProper : + (_ : IsProperEdgeColoring G - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) - (previousOneUncolored : + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc)) + (_ : IsOneEdgeUncolored - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) e0) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc) e0) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) - (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (hprefixMP : MaximumProperty originalPrefix) - (hprefixTrees : + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : MaximumProperty originalPrefix) + (_ : ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), - originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) - (hprefixData : + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i)) + (_ : ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), - originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ - originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ originalPrefix.series.data.connectingEdges i = - ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ - originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + ett.series.data.connectingEdges (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ TashkinovStoredColors originalPrefix.series.data i = - TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + TashkinovStoredColors ett.series.data (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)) - (hcorrMP : MaximumProperty corr.replacementETT) - (noRevisiting : + (_ : MaximumProperty corr.replacementETT) + (_ : ¬Nonempty (RevisitingExtensionCertificate ett.series.data - (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds).castSucc)), let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; - ∀ (horiginalPositive : (0 : ℕ) < originalPrefix.rounds) - (hlastMap : - Fin.castLE (by omega) replacementLast = - (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) - (hreplacementCurrentTree : + ∀ (_ : (0 : ℕ) < originalPrefix.rounds) + (_ : + Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) replacementLast = + (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds).castSucc) + (_ : corr.replacementSeries.data.tree replacementLast.succ = - ett.series.data.tree (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).succ.castSucc) - (peRootOnly : + ett.series.data.tree (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).succ.castSucc) + (_ : ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (base : ExtendedTashkinovTree G k e0 input' T' generating'), @@ -2528,7 +2598,7 @@ private abbrev helperContinuation4070Conditions.{u_1, u_2} : Prop := (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; ∀ - (hbaseEarlierKind : + (_ : originalPrefix.series.data.kind earlierPrefix = some TashkinovExtensionKind.PE) (oldi : Fin originalPrefix.rounds) (oldChoice : @@ -2536,30 +2606,30 @@ private abbrev helperContinuation4070Conditions.{u_1, u_2} : Prop := (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) (originalPrefix.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) - (oldCurrentProper : IsProperEdgeColoring G (originalPrefix.series.data.coloring oldi.succ)) - (oldCurrentOne : IsOneEdgeUncolored (originalPrefix.series.data.coloring oldi.succ) e0) - (oldCurrentStored : + (_ : IsProperEdgeColoring G (originalPrefix.series.data.coloring oldi.succ)) + (_ : IsOneEdgeUncolored (originalPrefix.series.data.coloring oldi.succ) e0) + (_ : originalPrefix.series.data.stored oldi.succ = (insert oldChoice.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k))) - (oldCurrentEdges : + (_ : originalPrefix.series.data.connectingEdges oldi.succ = ({ oldChoice.edge } : Finset E)) - (oldCurrentKind : originalPrefix.series.data.kind oldi.succ = some TashkinovExtensionKind.PE) - (oldCurrentVertex : originalPrefix.series.data.chosenVertex oldi.succ = some oldChoice.vertex) - (oldCurrentDelta : originalPrefix.series.data.delta oldi.succ = some oldChoice.color) - (oldCurrentGamma : originalPrefix.series.data.gamma oldi.succ = some oldGamma) - (hbaseTarget : earlierPrefix = oldi.succ) (holdIndex : oldi.succ = earlierPrefix) + (_ : originalPrefix.series.data.kind oldi.succ = some TashkinovExtensionKind.PE) + (_ : originalPrefix.series.data.chosenVertex oldi.succ = some oldChoice.vertex) + (_ : originalPrefix.series.data.delta oldi.succ = some oldChoice.color) + (_ : originalPrefix.series.data.gamma oldi.succ = some oldGamma) + (_ : earlierPrefix = oldi.succ) (_ : oldi.succ = earlierPrefix) (newGamma : Fin k) (newChoicePE : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) (corr.replacementSeries.data.coloring oldi.castSucc)) - (newCurrentProper : IsProperEdgeColoring G (corr.replacementSeries.data.coloring oldi.succ)) - (newCurrentOne : IsOneEdgeUncolored (corr.replacementSeries.data.coloring oldi.succ) e0) - (newCurrentKind : corr.replacementSeries.data.kind oldi.succ = some TashkinovExtensionKind.PE) - (newCurrentVertex : + (_ : IsProperEdgeColoring G (corr.replacementSeries.data.coloring oldi.succ)) + (_ : IsOneEdgeUncolored (corr.replacementSeries.data.coloring oldi.succ) e0) + (_ : corr.replacementSeries.data.kind oldi.succ = some TashkinovExtensionKind.PE) + (_ : corr.replacementSeries.data.chosenVertex oldi.succ = some newChoicePE.vertex) - (newCurrentDelta : corr.replacementSeries.data.delta oldi.succ = some newChoicePE.color) - (newCurrentGamma : corr.replacementSeries.data.gamma oldi.succ = some newGamma) + (_ : corr.replacementSeries.data.delta oldi.succ = some newChoicePE.color) + (_ : corr.replacementSeries.data.gamma oldi.succ = some newGamma) (hbaseTree : corr.replacementSeries.data.tree oldi.succ.castSucc = originalPrefix.series.data.tree oldi.succ.castSucc), @@ -2569,14 +2639,14 @@ private abbrev helperContinuation4070Conditions.{u_1, u_2} : Prop := (originalPrefix.series.data.coloring oldi.castSucc) := (Eq.symm hbaseTree ▸ oldChoice); ∀ - (transportChoiceFields : + (_ : ∀ {A B : TreeSequence G e0} (hAB : A = B) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch : MaximumDefectiveChoice G e0 A C phi), (hAB ▸ ch).edge = ch.edge ∧ (hAB ▸ ch).vertex = ch.vertex ∧ (hAB ▸ ch).otherEndpoint = ch.otherEndpoint ∧ (hAB ▸ ch).color = ch.color) - (holdColorCast : oldChoiceOnNew.color = oldChoice.color) - (pePostStatus : + (_ : oldChoiceOnNew.color = oldChoice.color) + (_ : ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), IsProperEdgeColoring G second → @@ -2586,35 +2656,35 @@ private abbrev helperContinuation4070Conditions.{u_1, u_2} : Prop := TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex); ch.color ∈ MissingColors G post ch.vertex ∧ g ∉ MissingColors G post ch.vertex ∧ g ≠ ch.color) - (holdDeltaMissing : + (_ : oldChoice.color ∈ MissingColors G (originalPrefix.series.data.coloring oldi.succ) oldChoice.vertex) - (holdGammaNotMissing : + (_ : oldGamma ∉ MissingColors G (originalPrefix.series.data.coloring oldi.succ) oldChoice.vertex) - (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma ≠ newChoicePE.color) - (hidentifiedDelta : newChoicePE.color = oldChoiceOnNew.color) - (hidentifiedGamma : newGamma = oldGamma) - (hnewDeltaAvailable : newChoicePE.color = available.delta) - (hnewGammaAvailable : newGamma = available.gamma) - (holdDeltaAvailable : oldChoice.color = available.delta) - (holdGammaAvailable : oldGamma = available.gamma) - (hnewVertexOld : newChoicePE.vertex = oldChoice.vertex) - (hnewPostSigmaPrev : corr.replacementSeries.data.coloring oldi.succ = sigmaPrev) - (hbaseFinalColor : + (_ : oldGamma ≠ oldChoice.color) (_ : newGamma ≠ newChoicePE.color) + (_ : newChoicePE.color = oldChoiceOnNew.color) + (_ : newGamma = oldGamma) + (_ : newChoicePE.color = available.delta) + (_ : newGamma = available.gamma) + (_ : oldChoice.color = available.delta) + (_ : oldGamma = available.gamma) + (_ : newChoicePE.vertex = oldChoice.vertex) + (_ : corr.replacementSeries.data.coloring oldi.succ = sigmaPrev) + (_ : originalPrefix.series.data.coloring replacementLast = ett.series.data.coloring q.castSucc) - (holdPostOriginal : + (_ : originalPrefix.series.data.coloring oldi.succ = ett.series.data.coloring q.castSucc) - (holdDeltaOriginal : + (_ : available.delta ∈ MissingColors G (ett.series.data.coloring q.castSucc) oldChoice.vertex) - (hgammaDeltaNe : available.gamma ≠ available.delta) - (holdVertexFinal : + (_ : available.gamma ≠ available.delta) + (_ : oldChoice.vertex ∈ TreeSequenceVertexSet (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))))) - (hreturnInOldEarlier : + (_ : available.returnVertex ∈ TreeSequenceVertexSet (originalPrefix.series.data.tree earlierPrefix.castSucc)) - (hreturnInFinal : + (_ : available.returnVertex ∈ TreeSequenceVertexSet (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))))), @@ -2627,22 +2697,22 @@ private abbrev helperContinuation4070Conditions.{u_1, u_2} : Prop := let originalReturnPath : originalReturnGraph.Walk (Sum.inr available.edge) (Sum.inl available.returnVertex) := available.returnPath.transfer originalReturnGraph returnEdgeTransfer; - ∀ (horiginalReturnIsPath : originalReturnPath.IsPath) - (horiginalReturnSupport : + ∀ (_ : originalReturnPath.IsPath) + (_ : ∀ (z : V ⊕ E), z ∈ originalReturnPath.support ↔ z ∈ available.returnPath.support) - (hreturnInQ : + (_ : Sum.inl available.returnVertex ∈ TwoColorComponent G (ett.series.data.coloring q.castSucc) available.gamma available.delta (Sum.inr available.edge)) - (houtsideInQ : + (_ : Sum.inl available.outsideEndpoint ∈ TwoColorComponent G (ett.series.data.coloring q.castSucc) available.gamma available.delta (Sum.inr available.edge)) - (hpathComponent : + (_ : TwoColorNontrivialPathComponent G (ett.series.data.coloring q.castSucc) available.gamma available.delta (Sum.inl oldChoice.vertex)) - (hpathMeetsFinal : + (_ : ∃ v ∈ TreeSequenceVertexSet @@ -2650,7 +2720,7 @@ private abbrev helperContinuation4070Conditions.{u_1, u_2} : Prop := Sum.inl v ∈ TwoColorComponent G (ett.series.data.coloring q.castSucc) available.gamma available.delta (Sum.inl oldChoice.vertex)) - (hreplacementLeaf : + (_ : ((TwoColorIncidenceGraph G (corr.replacementSeries.data.coloring replacementLast) available.gamma available.delta).neighborSet (Sum.inl newChoicePE.vertex)).Subsingleton), @@ -2662,7 +2732,7 @@ private abbrev helperContinuation4611Conditions.{u_1, u_2} : Prop := (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds) - (hlower : + (_ : ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (lower : ExtendedTashkinovTree G k e0 input' T' generating'), @@ -2695,48 +2765,62 @@ private abbrev helperContinuation4611Conditions.{u_1, u_2} : Prop := (lower.series.data.coloring n) sigma → ∀ w ∈ TreeSequenceVertexSet Tn, Sum.inl w ∈ TwoColorComponent G sigma gamma delta (Sum.inl v) ↔ w = v), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds); - ∀ (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) - (previousProper : + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds); + ∀ (sigmaPrev : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigmaPrev) + (_ : IsProperEdgeColoring G - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) - (previousOneUncolored : + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc)) + (_ : IsOneEdgeUncolored - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) e0) + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc) e0) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)) - (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (hprefixMP : MaximumProperty originalPrefix) - (hprefixTrees : + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).castSucc)) + (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : MaximumProperty originalPrefix) + (_ : ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), - originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE (by omega) i)) - (hprefixData : + originalPrefix.series.data.tree i = ett.series.data.tree (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i)) + (_ : ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), - originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE (by omega) i) ∧ - originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE (by omega) i) ∧ + originalPrefix.series.data.coloring i = ett.series.data.coloring (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ + originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ originalPrefix.series.data.connectingEdges i = - ett.series.data.connectingEdges (Fin.castLE (by omega) i) ∧ - originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE (by omega) i) ∧ + ett.series.data.connectingEdges (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ + originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i) ∧ TashkinovStoredColors originalPrefix.series.data i = - TashkinovStoredColors ett.series.data (Fin.castLE (by omega) i)) + TashkinovStoredColors ett.series.data (Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)) - (hcorrMP : MaximumProperty corr.replacementETT) - (noRevisiting : + (_ : MaximumProperty corr.replacementETT) + (_ : ¬Nonempty (RevisitingExtensionCertificate ett.series.data - (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), + (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds).castSucc)), let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; - ∀ (hcorrFinalColor : corr.replacementSeries.data.coloring replacementLast = sigmaPrev) - (horiginalPositive : (0 : ℕ) < originalPrefix.rounds) - (hlastMap : - Fin.castLE (by omega) replacementLast = - (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc) - (hreplacementCurrentTree : + ∀ (_ : corr.replacementSeries.data.coloring replacementLast = sigmaPrev) + (_ : (0 : ℕ) < originalPrefix.rounds) + (_ : + Fin.castLE + (positivePrefixPrefixBound ett.rounds originalPrefix.rounds _ hr) replacementLast = + (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds hroundLarge⟩ : Fin + ett.rounds).castSucc) + (_ : corr.replacementSeries.data.tree replacementLast.succ = - ett.series.data.tree (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).succ.castSucc) - (peRootOnly : + ett.series.data.tree (⟨ett.rounds - (1 : ℕ), positivePrefixPredecessorBound ett.rounds + hroundLarge⟩ : Fin ett.rounds).succ.castSucc) + (_ : ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} {generating' : PartialEdgeColoring E k} (base : ExtendedTashkinovTree G k e0 input' T' generating'), @@ -2761,7 +2845,7 @@ private abbrev helperContinuation4611Conditions.{u_1, u_2} : Prop := (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; ∀ - (hbaseEarlierKind : + (_ : originalPrefix.series.data.kind earlierPrefix = some TashkinovExtensionKind.PE) (oldi : Fin originalPrefix.rounds) (oldChoice : @@ -2769,30 +2853,30 @@ private abbrev helperContinuation4611Conditions.{u_1, u_2} : Prop := (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) (originalPrefix.series.data.coloring oldi.castSucc)) (oldGamma : Fin k) - (oldCurrentProper : IsProperEdgeColoring G (originalPrefix.series.data.coloring oldi.succ)) - (oldCurrentOne : IsOneEdgeUncolored (originalPrefix.series.data.coloring oldi.succ) e0) - (oldCurrentStored : + (_ : IsProperEdgeColoring G (originalPrefix.series.data.coloring oldi.succ)) + (_ : IsOneEdgeUncolored (originalPrefix.series.data.coloring oldi.succ) e0) + (_ : originalPrefix.series.data.stored oldi.succ = (insert oldChoice.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k))) - (oldCurrentEdges : + (_ : originalPrefix.series.data.connectingEdges oldi.succ = ({ oldChoice.edge } : Finset E)) - (oldCurrentKind : originalPrefix.series.data.kind oldi.succ = some TashkinovExtensionKind.PE) - (oldCurrentVertex : originalPrefix.series.data.chosenVertex oldi.succ = some oldChoice.vertex) - (oldCurrentDelta : originalPrefix.series.data.delta oldi.succ = some oldChoice.color) - (oldCurrentGamma : originalPrefix.series.data.gamma oldi.succ = some oldGamma) - (hbaseTarget : earlierPrefix = oldi.succ) (holdIndex : oldi.succ = earlierPrefix) + (_ : originalPrefix.series.data.kind oldi.succ = some TashkinovExtensionKind.PE) + (_ : originalPrefix.series.data.chosenVertex oldi.succ = some oldChoice.vertex) + (_ : originalPrefix.series.data.delta oldi.succ = some oldChoice.color) + (_ : originalPrefix.series.data.gamma oldi.succ = some oldGamma) + (_ : earlierPrefix = oldi.succ) (_ : oldi.succ = earlierPrefix) (newGamma : Fin k) (newChoicePE : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) (corr.replacementSeries.data.coloring oldi.castSucc)) - (newCurrentProper : IsProperEdgeColoring G (corr.replacementSeries.data.coloring oldi.succ)) - (newCurrentOne : IsOneEdgeUncolored (corr.replacementSeries.data.coloring oldi.succ) e0) - (newCurrentKind : corr.replacementSeries.data.kind oldi.succ = some TashkinovExtensionKind.PE) - (newCurrentVertex : + (_ : IsProperEdgeColoring G (corr.replacementSeries.data.coloring oldi.succ)) + (_ : IsOneEdgeUncolored (corr.replacementSeries.data.coloring oldi.succ) e0) + (_ : corr.replacementSeries.data.kind oldi.succ = some TashkinovExtensionKind.PE) + (_ : corr.replacementSeries.data.chosenVertex oldi.succ = some newChoicePE.vertex) - (newCurrentDelta : corr.replacementSeries.data.delta oldi.succ = some newChoicePE.color) - (newCurrentGamma : corr.replacementSeries.data.gamma oldi.succ = some newGamma) + (_ : corr.replacementSeries.data.delta oldi.succ = some newChoicePE.color) + (_ : corr.replacementSeries.data.gamma oldi.succ = some newGamma) (hbaseTree : corr.replacementSeries.data.tree oldi.succ.castSucc = originalPrefix.series.data.tree oldi.succ.castSucc), @@ -2802,14 +2886,14 @@ private abbrev helperContinuation4611Conditions.{u_1, u_2} : Prop := (originalPrefix.series.data.coloring oldi.castSucc) := (Eq.symm hbaseTree ▸ oldChoice); ∀ - (transportChoiceFields : + (_ : ∀ {A B : TreeSequence G e0} (hAB : A = B) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch : MaximumDefectiveChoice G e0 A C phi), (hAB ▸ ch).edge = ch.edge ∧ (hAB ▸ ch).vertex = ch.vertex ∧ (hAB ▸ ch).otherEndpoint = ch.otherEndpoint ∧ (hAB ▸ ch).color = ch.color) - (holdColorCast : oldChoiceOnNew.color = oldChoice.color) - (pePostStatus : + (_ : oldChoiceOnNew.color = oldChoice.color) + (_ : ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), IsProperEdgeColoring G second → @@ -2819,47 +2903,47 @@ private abbrev helperContinuation4611Conditions.{u_1, u_2} : Prop := TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex); ch.color ∈ MissingColors G post ch.vertex ∧ g ∉ MissingColors G post ch.vertex ∧ g ≠ ch.color) - (holdDeltaMissing : + (_ : oldChoice.color ∈ MissingColors G (originalPrefix.series.data.coloring oldi.succ) oldChoice.vertex) - (holdGammaNotMissing : + (_ : oldGamma ∉ MissingColors G (originalPrefix.series.data.coloring oldi.succ) oldChoice.vertex) - (holdColorNe : oldGamma ≠ oldChoice.color) (hnewColorNe : newGamma ≠ newChoicePE.color) - (hidentifiedDelta : newChoicePE.color = oldChoiceOnNew.color) - (hidentifiedGamma : newGamma = oldGamma) - (hnewDeltaAvailable : newChoicePE.color = available.delta) - (hnewGammaAvailable : newGamma = available.gamma) - (holdDeltaAvailable : oldChoice.color = available.delta) - (holdGammaAvailable : oldGamma = available.gamma) - (hnewVertexOld : newChoicePE.vertex = oldChoice.vertex) - (hnewPostSigmaPrev : corr.replacementSeries.data.coloring oldi.succ = sigmaPrev) - (hbaseFinalColor : + (_ : oldGamma ≠ oldChoice.color) (_ : newGamma ≠ newChoicePE.color) + (_ : newChoicePE.color = oldChoiceOnNew.color) + (_ : newGamma = oldGamma) + (_ : newChoicePE.color = available.delta) + (_ : newGamma = available.gamma) + (_ : oldChoice.color = available.delta) + (_ : oldGamma = available.gamma) + (_ : newChoicePE.vertex = oldChoice.vertex) + (_ : corr.replacementSeries.data.coloring oldi.succ = sigmaPrev) + (_ : originalPrefix.series.data.coloring replacementLast = ett.series.data.coloring q.castSucc) - (holdPostOriginal : + (_ : originalPrefix.series.data.coloring oldi.succ = ett.series.data.coloring q.castSucc) - (hnewDeltaSigmaPrev : available.delta ∈ MissingColors G sigmaPrev newChoicePE.vertex) - (holdDeltaOriginal : + (_ : available.delta ∈ MissingColors G sigmaPrev newChoicePE.vertex) + (_ : available.delta ∈ MissingColors G (ett.series.data.coloring q.castSucc) oldChoice.vertex) - (holdGammaOriginalNot : + (_ : available.gamma ∉ MissingColors G (ett.series.data.coloring q.castSucc) oldChoice.vertex) - (hgammaDeltaNe : available.gamma ≠ available.delta) - (holdVertexFinal : + (_ : available.gamma ≠ available.delta) + (_ : oldChoice.vertex ∈ TreeSequenceVertexSet (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))))) - (hreturnInOldEarlier : + (_ : available.returnVertex ∈ TreeSequenceVertexSet (originalPrefix.series.data.tree earlierPrefix.castSucc)) - (hreturnInFinal : + (_ : available.returnVertex ∈ TreeSequenceVertexSet (originalPrefix.series.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))))) - (replacementReturnEdgeData : - ∀ (f : E) (hf : Sum.inr f ∈ available.returnPath.support), + (_ : + ∀ (f : E) (_ : Sum.inr f ∈ available.returnPath.support), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) f ∧ (sigmaPrev f = some available.gamma ∨ sigmaPrev f = some available.delta)) - (copyReturnEdge : - ∀ (f : E) (hf : Sum.inr f ∈ available.returnPath.support), + (_ : + ∀ (f : E) (_ : Sum.inr f ∈ available.returnPath.support), sigmaPrev f = ett.series.data.coloring q.castSucc f), False diff --git a/LeanPool/GoldbergSeymour/Preamble.lean b/LeanPool/GoldbergSeymour/Preamble.lean index 378c6fff8a..168b3c046a 100644 --- a/LeanPool/GoldbergSeymour/Preamble.lean +++ b/LeanPool/GoldbergSeymour/Preamble.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module +public import Mathlib.Data.Nat.Basic public import Mathlib.Data.Sym.Sym2.Init public import Mathlib.Data.Finset.Attr public import Mathlib.Tactic.SetLike @@ -22,6 +23,15 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour +/-- A natural number above one strictly bounds its truncated predecessor. -/ +theorem positivePrefixPredecessorBound (n : ℕ) (hn : 1 < n) : n - 1 < n := + Nat.sub_lt (lt_trans Nat.zero_lt_one hn) Nat.zero_lt_one + +/-- A predecessor bound is preserved after adding the same offset. -/ +theorem positivePrefixPrefixBound (n m offset : ℕ) (h : m = n - 1) : + m + offset ≤ n + offset := + Nat.add_le_add_right (le_trans (le_of_eq h) (Nat.sub_le n 1)) offset + end GoldbergSeymour end From 95be6b219559f04be188eba96aeb4a49bf033052 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Thu, 5 Nov 2026 20:47:55 +0000 Subject: [PATCH 05/11] Generalize hierarchy utilities and bridge Mathlib multigraphs --- LeanPool/GoldbergSeymour.lean | 2 +- .../AbsentOwnerReplacement.lean | 886 ++---------------- LeanPool/GoldbergSeymour/Imports.lean | 1 + LeanPool/GoldbergSeymour/MathlibGraph.lean | 80 ++ LeanPool/projects/goldberg-seymour.yaml | 2 + 5 files changed, 185 insertions(+), 786 deletions(-) create mode 100644 LeanPool/GoldbergSeymour/MathlibGraph.lean diff --git a/LeanPool/GoldbergSeymour.lean b/LeanPool/GoldbergSeymour.lean index ff79f86024..5bca213ebe 100644 --- a/LeanPool/GoldbergSeymour.lean +++ b/LeanPool/GoldbergSeymour.lean @@ -6,7 +6,7 @@ Authors: Wesley Pegden module -public import LeanPool.GoldbergSeymour.ThmGS +public import LeanPool.GoldbergSeymour.MathlibGraph /-! # The Goldberg–Seymour edge-coloring theorem diff --git a/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean b/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean index fb98ed0968..c3b63b9483 100644 --- a/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean +++ b/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean @@ -23,563 +23,33 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private abbrev helperHNcard363Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hell : ell = T.length - A.length) (hNine : (2 : ℕ) - * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun (i : ℕ) ↦ - TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) - T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree - (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : - ℕ) ↦ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) - = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ - (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H - (Fin.last H.dividerCount)).length + i) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree - (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : - ℕ) ↦ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) - = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last - H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ - HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → - ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ - ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ - TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H - (Fin.last H.dividerCount)).length + i) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - )) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : - Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) - = some c} : Finset (Fin k))) (ell - (2 : ℕ))))) (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 - : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H - (Fin.last H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy - (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last - ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi - (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + - (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - - (2 : ℕ))) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last - ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last - H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ - HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → - ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ - ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ - TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last - H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) - ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k)))), - let r0 : Fin T.length := (⟨T.length - (2 : ℕ), - have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : - ¬T.length - (2 : ℕ) < T.length) ↦ - by omega - ⟩ : Fin T.length); - let r1 : Fin T.length := (⟨T.length - (1 : ℕ), - have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : - ¬T.length - (1 : ℕ) < T.length) ↦ - by omega - ⟩ : Fin T.length); - let N : Finset (Fin k) := (phi (T.edge r0)).toList.toFinset ∪ (phi (T.edge - r1)).toList.toFinset; N.card ≤ (2 : ℕ) - -private abbrev helperHSuffixN373Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hell : ell = T.length - A.length), X.length = - T.length - (2 : ℕ) → - ∀ (hNine : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun (i : - ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length - + i) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree - (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : - ℕ) ↦ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) - = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ - (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H - (Fin.last H.dividerCount)).length + i) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree - (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : - ℕ) ↦ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) - = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last - H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ - HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → - ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ - ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ - TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H - (Fin.last H.dividerCount)).length + i) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - )) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : - Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) - = some c} : Finset (Fin k))) (ell - (2 : ℕ))))) (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 - : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H - (Fin.last H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy - (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last - ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi - (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + - (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - - (2 : ℕ))) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last - ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last - H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ - HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → - ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ - ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ - TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last - H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) - ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k)))), - let r0 : Fin T.length := (⟨T.length - (2 : ℕ), - have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : - ¬T.length - (2 : ℕ) < T.length) ↦ - by omega - ⟩ : Fin T.length); - let r1 : Fin T.length := (⟨T.length - (1 : ℕ), - have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : - ¬T.length - (1 : ℕ) < T.length) ↦ - by omega - ⟩ : Fin T.length); - let N : Finset (Fin k) := (phi (T.edge r0)).toList.toFinset ∪ (phi (T.edge - r1)).toList.toFinset; (↑r0 : ℕ) = T.length - (2 : ℕ) → (↑r1 : ℕ) = T.length - (1 : ℕ) → - ∀ (c : Fin k) (r : Fin T.length), X.length ≤ (↑r : ℕ) → phi (T.edge r) = some c → c ∈ N - private abbrev helperHbetaExists392Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; - let D : Finset (Fin k) := HierarchyStoredColorsAt H q; - let Gamma : Finset (Fin k) := D.biUnion (C.good.gamma q); - let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet - Tn).biUnion fun (v : V) ↦ MissingColors G phi v; - ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hell : ell = T.length - A.length), - TreeSequenceVertexSet base.core ⊆ TreeSequenceVertexSet A → - ∀ (hNine : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun (i : - ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length - + i) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree - (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : - ℕ) ↦ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) - = some c} : Finset (Fin k))) i) (ell - (2 : ℕ))).card ∧ (((fun (i : ℕ) ↦ - (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H - (Fin.last H.dividerCount)).length + i) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree - (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : - ℕ) ↦ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) - = some c} : Finset (Fin k))) i) (ell - (2 : ℕ)) \ ((HierarchyStoredColorsAt H (Fin.last - H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ - HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → - ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ - ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ - TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H - (Fin.last H.dividerCount)).length + i) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - )) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : - Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) - = some c} : Finset (Fin k))) (ell - (2 : ℕ))))), - let U : Finset (Fin k) := ({c : Fin k | - ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi - (T.edge r) = some c} : Finset (Fin k)); - let Avail : Finset (Fin k) := (TreeMissingColors phi X \ M0) \ U; - ∀ (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix - T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) - T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last - ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi - (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + - (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - - (2 : ℕ))) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last - ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last - H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ - HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → - ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ - ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ - TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last - H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Tn : TreeSequence G e0 := ett.series.data.tree (Fin.last ett.rounds).castSucc; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + let Gamma : Finset (Fin k) := D.biUnion (C.good.gamma q); + let M0 : Finset (Fin k) := (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet + Tn).biUnion fun (v : V) ↦ MissingColors G phi v; + ∀ (htailA : (3 : ℕ) ≤ T.length - A.length) (hell : ell = T.length - A.length), + TreeSequenceVertexSet base.core ⊆ TreeSequenceVertexSet A → + ∀ (hNine : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun (i : + ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + + i) T.length) ( by have := GoldbergSeymour.TreeSequence.positive T have := GoldbergSeymour.TreeSequence.positive (HierarchyStarredStage H (Fin.last H.dividerCount)) have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) omega ) ( by @@ -588,62 +58,7 @@ private abbrev helperHbetaExists392Conditions.{u_1, u_2} : Prop := GoldbergSeymour.TreeSequence.positive (HierarchyStarredStage H (Fin.last H.dividerCount)) have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) omega - )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) - ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k)))), Disjoint Gamma D → - let r0 : Fin T.length := (⟨T.length - (2 : ℕ), - have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : - ¬T.length - (2 : ℕ) < T.length) ↦ - by omega - ⟩ : Fin T.length); - let r1 : Fin T.length := (⟨T.length - (1 : ℕ), - have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : - ¬T.length - (1 : ℕ) < T.length) ↦ - by omega - ⟩ : Fin T.length); - let N : Finset (Fin k) := (phi (T.edge r0)).toList.toFinset ∪ (phi (T.edge - r1)).toList.toFinset; N.card ≤ (2 : ℕ) → - let Free : Finset (Fin k) := Avail \ (Gamma ∪ D); ((Avail \ (Gamma ∪ D)).card ≤ (4 : ℕ) → - ∃ (rho : Fin (7 : ℕ) → Fin k), Function.Injective rho ∧ - ∀ (i : Fin (7 : ℕ)), rho i ∈ D ∧ rho i ∈ TreeMissingColors phi X ∧ Disjoint (C.good.gamma q - (rho i) ∪ ({rho i} : Finset (Fin k))) U) → - ∃ beta ∈ TreeMissingColors phi X, beta ∉ M0 ∧ beta ∉ Gamma ∧ beta ∉ U ∧ beta ∉ N - -private abbrev helperFirstMem500Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; (3 : ℕ) ≤ T.length - A.length → ell = T.length - - A.length → (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((fun (i : ℕ) ↦ (TreeMissingColors phi ((fun - (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last - H.dividerCount)).length + i) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : ℕ) ↦ ({c : Fin k | @@ -653,20 +68,20 @@ private abbrev helperFirstMem500Conditions.{u_1, u_2} : Prop := (TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ( by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega ) ( by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega )) i) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ (fun (i : ℕ) ↦ ({c : Fin k | @@ -680,122 +95,33 @@ private abbrev helperFirstMem500Conditions.{u_1, u_2} : Prop := TreeMissingColors phi ((fun (i : ℕ) ↦ TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + i) T.length) ( by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega ) ( by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - omega + have := GoldbergSeymour.TreeSequence.positive T + have := + GoldbergSeymour.TreeSequence.positive + (HierarchyStarredStage H (Fin.last H.dividerCount)) + have := GoldbergSeymour.TreeSequence.positive T + omega )) (ell - (2 : ℕ))) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) ((fun (i : ℕ) ↦ ({c : Fin k | ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + i ∧ phi (T.edge r) - = some c} : Finset (Fin k))) (ell - (2 : ℕ)))) → (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ - ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last - H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last - ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k))).card ∧ ((((TreeMissingColors phi - (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + - (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - - (2 : ℕ))) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) \ (TreeSequenceVertexSet base.core \ TreeSequenceVertexSet (ett.series.data.tree (Fin.last - ett.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v) \ ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k))) \ ((HierarchyStoredColorsAt H (Fin.last - H.dividerCount)).biUnion (C.good.gamma (Fin.last H.dividerCount)) ∪ - HierarchyStoredColorsAt H (Fin.last H.dividerCount))).card ≤ (4 : ℕ) → - ∃ (eta : Fin (7 : ℕ) → Fin k), Function.Injective eta ∧ - ∀ (h : Fin (7 : ℕ)), eta h ∈ HierarchyStoredColorsAt H (Fin.last H.dividerCount) ∧ eta h ∈ - TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last - H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage H (Fin.last H.dividerCount)) - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.TreeSequence.positive - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)) - omega - )) ∧ Disjoint (C.good.gamma (Fin.last H.dividerCount) (eta h) ∪ ({eta h} : Finset (Fin k))) - ({c : Fin k | - ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k))) → (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ - ((TreeMissingColors phi (TreeSequencePrefix T (min ((HierarchyStarredStage H (Fin.last - H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount)).length - (2 : ℕ))) T.length) ( + = some c} : Finset (Fin k))) (ell - (2 : ℕ))))), + let U : Finset (Fin k) := ({c : Fin k | + ∃ (r : Fin T.length), A.length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi + (T.edge r) = some c} : Finset (Fin k)); + let Avail : Finset (Fin k) := (TreeMissingColors phi X \ M0) \ U; + ∀ (hNineAt hNi : (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ ((TreeMissingColors phi (TreeSequencePrefix + T (min ((HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - + (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ))) + T.length) ( by have := GoldbergSeymour.TreeSequence.positive T have := @@ -886,9 +212,24 @@ private abbrev helperFirstMem500Conditions.{u_1, u_2} : Prop := ∃ (r : Fin T.length), (HierarchyStarredStage H (Fin.last H.dividerCount)).length ≤ (↑r : ℕ) ∧ (↑r : ℕ) < (HierarchyStarredStage H (Fin.last H.dividerCount)).length + (T.length - (HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount)).length - (2 : ℕ)) - ∧ phi (T.edge r) = some c} : Finset (Fin k))) → - ∀ (c : Fin k), (↑(HierarchyFirstMissingPosition phi T c) : ℕ) < T.length → c ∈ MissingColors G - phi (T.vertex (HierarchyFirstMissingPosition phi T c)) + ∧ phi (T.edge r) = some c} : Finset (Fin k)))), Disjoint Gamma D → + let r0 : Fin T.length := (⟨T.length - (2 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let r1 : Fin T.length := (⟨T.length - (1 : ℕ), + have this : (3 : ℕ) ≤ T.length - A.length := htailA; Decidable.byContradiction fun (a : + ¬T.length - (1 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let N : Finset (Fin k) := (phi (T.edge r0)).toList.toFinset ∪ (phi (T.edge + r1)).toList.toFinset; N.card ≤ (2 : ℕ) → + let Free : Finset (Fin k) := Avail \ (Gamma ∪ D); ((Avail \ (Gamma ∪ D)).card ≤ (4 : ℕ) → + ∃ (rho : Fin (7 : ℕ) → Fin k), Function.Injective rho ∧ + ∀ (i : Fin (7 : ℕ)), rho i ∈ D ∧ rho i ∈ TreeMissingColors phi X ∧ Disjoint (C.good.gamma q + (rho i) ∪ ({rho i} : Finset (Fin k))) U) → + ∃ beta ∈ TreeMissingColors phi X, beta ∉ M0 ∧ beta ∉ Gamma ∧ beta ∉ U ∧ beta ∉ N private abbrev helperHibLt530Conditions.{u_1, u_2} : Prop := open scoped Classical in @@ -1804,14 +1145,13 @@ private abbrev helperContinuation212Conditions.{u_1, u_2} : Prop := private theorem helper_firstLe_242.{u_1, u_2} : open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + ∀ {V : Type u_1} {E : Type u_2} [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), c ∈ MissingColors G phi (T.vertex i) → (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ (↑i : ℕ) := by classical - intro V E _ _ G k e0 T phi c i hi - let _ := Fintype.ofFinite V + intro V E _ G k e0 T phi c i hi let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => c ∈ MissingColors G phi (T.vertex j) have hm : i ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ @@ -1914,26 +1254,6 @@ private theorem helper_vertexMemB_487.{u_1, u_2} : exact hBprefix.2.1 j exact hvEq.symm -private theorem helper_firstLeFor_501.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - (psi : PartialEdgeColoring E k) (c : Fin k) (i : Fin (T.length + (1 : ℕ))), - c ∈ MissingColors G psi (T.vertex i) → - (↑(HierarchyFirstMissingPosition psi T c) : ℕ) ≤ (↑i : ℕ) := by - classical - intro V E _ _ G k e0 T psi c i hi - let _ := Fintype.ofFinite V - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G psi (T.vertex j) - have hm : i ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ - have hn : candidates.Nonempty := ⟨i, hm⟩ - unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - have hle := Finset.min'_le candidates i hm - change (candidates.min' hn).val ≤ i.val at hle - exact hle - private theorem helper_seriesFacts_583.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : @@ -2051,33 +1371,29 @@ private theorem helper_branch_724.{u_1, u_2} : ⟨v, Finset.mem_sdiff.mpr ⟨hvCoreOld, hvNotTn⟩, hbetaPhi⟩ exact hbM0 hbetaM0 -private theorem helper_hNcard_363.{u_1, u_2} : - helperHNcard363Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell htailA hell hNine hNineAt hNi r0 r1 N - dsimp [N] +private theorem optionPair_card_le_two {α : Type*} [DecidableEq α] + (first second : Option α) : + (first.toList.toFinset ∪ second.toList.toFinset).card ≤ 2 := by calc - _ ≤ (phi (T.edge r0)).toList.length + (phi (T.edge r1)).toList.length := + _ ≤ first.toList.length + second.toList.length := (Finset.card_union_le _ _).trans (Nat.add_le_add (List.toFinset_card_le _) (List.toFinset_card_le _)) - _ ≤ 2 := by - cases phi (T.edge r0) <;> cases phi (T.edge r1) <;> simp + _ ≤ 2 := by cases first <;> cases second <;> simp -private theorem helper_hSuffixN_373.{u_1, u_2} : - helperHSuffixN373Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell X htailA hell hlenX hNine hNineAt hNi - r0 r1 N hr0val hr1val c r hr hc - have hindex : r.val = r0.val ∨ r.val = r1.val := by - have := hlenX - omega +private theorem color_mem_final_pair {α : Type*} [DecidableEq α] {length : ℕ} + (color : Fin length → Option α) (first second : Fin length) + (hfirst : first.val = length - 2) (hsecond : second.val = length - 1) + (position : Fin length) (hposition : length - 2 ≤ position.val) + {c : α} (hc : color position = some c) : + c ∈ (color first).toList.toFinset ∪ (color second).toList.toFinset := by + have hindex : position.val = first.val ∨ position.val = second.val := by omega rcases hindex with hindex | hindex - · have hr0 : r = r0 := Fin.ext hindex - subst r - simp [N, hc] - · have hr1 : r = r1 := Fin.ext hindex - subst r - simp [N, hc] + · have hsame : position = first := Fin.ext hindex + subst position + simp [hc] + · have hsame : position = second := Fin.ext hindex + subst position + simp [hc] private theorem helper_hbetaExists_392.{u_1, u_2} : helperHbetaExists392Conditions.{u_1, u_2} := by @@ -2162,10 +1478,12 @@ private theorem helper_hbetaExists_392.{u_1, u_2} : (Finset.mem_union_right _ (Finset.mem_singleton.mpr rfl)) hb) refine ⟨beta, hbTailMissing, hbM0, hbGamma, hbU, hbN⟩ -private theorem helper_firstMem_500.{u_1, u_2} : - helperFirstMem500Conditions.{u_1, u_2} := by +private theorem firstMissingPosition_mem_of_lt {V E : Type*} [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition phi T c).val < T.length) : + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell htailA hell hNine hNineAt hNi c hlt let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => c ∈ MissingColors G phi (T.vertex j) by_cases hn : candidates.Nonempty @@ -2426,7 +1744,7 @@ private theorem helper_continuation_2387.{u_1, u_2} : simp [sigma, TwoColorComponentSwap, hnotAlpha, hnotBeta] have vertexMemB := @helper_vertexMemB_487 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBprefix) (@hlenB) - have firstLeFor := @helper_firstLeFor_501 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) + have firstLeFor := @helper_firstLe_242 (@V) (@E) inferInstance (@G) (@k) (@e0) (@T) have firstMemFor (psi : PartialEdgeColoring E k) (c : Fin k) (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : @@ -2532,14 +1850,14 @@ private theorem helper_continuation_212.{u_1, u_2} : let r0 : Fin T.length := ⟨T.length - 2, by have := htailA; omega⟩ let r1 : Fin T.length := ⟨T.length - 1, by have := htailA; omega⟩ let N := (phi (T.edge r0)).toList.toFinset ∪ (phi (T.edge r1)).toList.toFinset - have hNcard := @helper_hNcard_363 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htailA) (@hell) - (@hNine) (@hNineAt) (@hNi) + have hNcard : N.card ≤ 2 := optionPair_card_le_two (phi (T.edge r0)) (phi (T.edge r1)) have hr0val : r0.val = T.length - 2 := by simp [r0] have hr1val : r1.val = T.length - 1 := by simp [r1] - have hSuffixN := @helper_hSuffixN_373 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htailA) (@hell) - (@hlenX) (@hNine) (@hNineAt) (@hNi) (@hr0val) (@hr1val) + have hSuffixN : ∀ (c : Fin k) (r : Fin T.length), + X.length ≤ r.val → phi (T.edge r) = some c → c ∈ N := by + intro c r hr hc + exact color_mem_final_pair (fun position => phi (T.edge position)) r0 r1 + hr0val hr1val r (hlenX ▸ hr) hc let Free := Avail \ (Gamma ∪ D) have hNineSmall := hNi.2 change (Avail \ (Gamma ∪ D)).card ≤ 4 → @@ -2573,11 +1891,9 @@ private theorem helper_continuation_212.{u_1, u_2} : obtain ⟨ubIdx, hubIdx⟩ : ∃ i : Fin (X.length + 1), X.vertex i = ub := by simpa only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] using hub - have firstLe := @helper_firstLe_242 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + have firstLe := @helper_firstLe_242 (@V) (@E) inferInstance (@G) (@k) (@e0) (@T) (@phi) - have firstMem := @helper_firstMem_500 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htailA) (@hell) - (@hNine) (@hNineAt) (@hNi) + have firstMem := firstMissingPosition_mem_of_lt G k e0 T phi have hiaLe : (HierarchyFirstMissingPosition phi T alpha).val ≤ A.length := by let iT := Fin.castLE (Nat.succ_le_succ hA.1) uaIdx have hmiss : alpha ∈ MissingColors G phi (T.vertex iT) := by diff --git a/LeanPool/GoldbergSeymour/Imports.lean b/LeanPool/GoldbergSeymour/Imports.lean index dc6e768ca2..eed322ff9a 100644 --- a/LeanPool/GoldbergSeymour/Imports.lean +++ b/LeanPool/GoldbergSeymour/Imports.lean @@ -327,6 +327,7 @@ public import LeanPool.GoldbergSeymour.LateOwnerReplacement public import LeanPool.GoldbergSeymour.LooplessMultigraph public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis public import LeanPool.GoldbergSeymour.LowerRoundProperties +public import LeanPool.GoldbergSeymour.MathlibGraph public import LeanPool.GoldbergSeymour.MaximumDefectiveChoice public import LeanPool.GoldbergSeymour.MaximumDefectiveChoiceExists public import LeanPool.GoldbergSeymour.MaximumDegree diff --git a/LeanPool/GoldbergSeymour/MathlibGraph.lean b/LeanPool/GoldbergSeymour/MathlibGraph.lean new file mode 100644 index 0000000000..08cd897b77 --- /dev/null +++ b/LeanPool/GoldbergSeymour/MathlibGraph.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 Lean Pool contributors. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Lean Pool contributors +-/ +module + +public import Mathlib.Combinatorics.Graph.Simple +public import LeanPool.GoldbergSeymour.ThmGS + +/-! +# Mathlib multigraph interface + +The imported development uses total endpoint pairs on vertex and edge types. +Mathlib uses vertex and edge sets in ambient types. Restricting to these sets +preserves edge identities, incidence, and isolated vertices. This conversion +API connects Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 to Mathlib’s set-based graph vocabulary. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +open scoped Sym2 + +variable {V E : Type*} + +/-- The unordered endpoints of an active Mathlib edge, in its active vertex type. -/ +noncomputable def graphEndpointPair (G : Graph V E) (e : G.edgeSet) : + Sym2 G.vertexSet := + let witness := G.exists_isLink_of_mem_edgeSet e.property + let link := witness.choose_spec.choose_spec + s(⟨witness.choose, link.left_mem⟩, ⟨witness.choose_spec.choose, link.right_mem⟩) + +/-- Endpoint pairs characterize Mathlib links, independently of their chosen ordering. -/ +theorem graphEndpointPair_eq_iff (G : Graph V E) (e : G.edgeSet) + (x y : G.vertexSet) : graphEndpointPair G e = s(x, y) ↔ G.IsLink e.val x.val y.val := by + classical + let witness := G.exists_isLink_of_mem_edgeSet e.property + have link := witness.choose_spec.choose_spec + constructor + · intro h + have endpoints := congrArg (Sym2.map Subtype.val) h + exact link.isLink_iff_sym2_eq.mpr endpoints + · intro h + apply Sym2.eq_iff.mpr + rcases link.eq_and_eq_or_eq_and_eq h with h | h + · exact Or.inl ⟨Subtype.ext h.1, Subtype.ext h.2⟩ + · exact Or.inr ⟨Subtype.ext h.1, Subtype.ext h.2⟩ + +/-- Convert a Mathlib loopless multigraph using its actual vertex and edge sets as types. -/ +noncomputable def LooplessMultigraph.ofGraph (G : Graph V E) [G.Loopless] : + LooplessMultigraph G.vertexSet G.edgeSet where + ends := graphEndpointPair G + loopless e v h := ((graphEndpointPair_eq_iff G e v v).mp h).ne rfl + +/-- Conversion preserves incidence and keeps each original edge identity. -/ +@[simp] theorem LooplessMultigraph.ofGraph_incident (G : Graph V E) [G.Loopless] + (v : G.vertexSet) (e : G.edgeSet) : + Incident (LooplessMultigraph.ofGraph G) v e ↔ G.Inc e.val v.val := by + change v ∈ graphEndpointPair G e ↔ ∃ w, G.IsLink e.val v.val w + rw [Sym2.mem_iff_exists] + constructor + · rintro ⟨w, hw⟩ + exact ⟨w.val, (graphEndpointPair_eq_iff G e v w).mp hw⟩ + · rintro ⟨w, hw⟩ + exact ⟨⟨w, hw.right_mem⟩, (graphEndpointPair_eq_iff G e v ⟨w, hw.right_mem⟩).mpr hw⟩ + +/-- The Goldberg–Seymour bound applies to every Mathlib loopless graph with finite active sets. -/ +theorem goldbergSeymour_ofGraph (G : Graph V E) [G.Loopless] + [Fintype G.vertexSet] [Fintype G.edgeSet] : + ChromaticIndex (LooplessMultigraph.ofGraph G) ≤ + max (MaximumDegree (LooplessMultigraph.ofGraph G) + 1) + (DensityCeil (LooplessMultigraph.ofGraph G)) := + ThmGS (LooplessMultigraph.ofGraph G) + +end GoldbergSeymour + +end diff --git a/LeanPool/projects/goldberg-seymour.yaml b/LeanPool/projects/goldberg-seymour.yaml index 6e6c8f5dd6..c65f060f26 100644 --- a/LeanPool/projects/goldberg-seymour.yaml +++ b/LeanPool/projects/goldberg-seymour.yaml @@ -6,6 +6,8 @@ summary: >- the maximum of the maximum degree plus one and the ceiling of the odd-set density. Preserves proper partial edge colorings, Kempe components, critical subgraphs, Tashkinov trees, extension sequences, and good hierarchies. + An incidence-preserving bridge supports Mathlib graphs on their actual vertex + and edge sets, including isolated vertices and independently identified parallel edges. The import contains the dependency closure of the full theorem; it does not claim an executable edge-coloring algorithm or its polynomial running time. branch: combinatorics From 8b8bd48522f16d020e364500412cd608536aec36 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Thu, 5 Nov 2026 22:12:42 +0000 Subject: [PATCH 06/11] refactor(GoldbergSeymour): share coloring and assembly facts --- .../AbsentOwnerReplacement.lean | 39 +- .../AlgorithmFiveFiveSeed.lean | 56 +- ...dingExtendedTashkinovTreeTerminalData.lean | 86 + .../ExtensionBaseAlgorithmBInduction.lean | 104 +- .../ExtensionBaseAlgorithmC.lean | 114 +- ...rarchySituationOneAdvanceInsideStored.lean | 61 +- ...archySituationOneAdvanceOutsideStored.lean | 57 +- ...ointThetaUnstoredBetaStoredImpossible.lean | 155 +- ...archySituationThreeEligibleIndexBound.lean | 55 +- ...tuationTwoSubcaseOneOneNonexceptional.lean | 233 +- .../HierarchySituationTwoSubcaseOneTwo.lean | 233 +- .../HierarchySituationTwoSubcaseThreeTwo.lean | 325 +-- ...tuationTwoSubcaseTwoOneNonexceptional.lean | 69 +- .../HierarchySituationTwoSubcaseTwoTwo.lean | 260 +- LeanPool/GoldbergSeymour/Imports.lean | 4 + .../ScheideStructuralReducedAssembly.lean | 2453 ++--------------- .../ScheideStructuralReorderingData.lean | 55 + .../TerminalHierarchyRestore.lean | 19 +- .../TerminalKempeStageSwitch.lean | 56 +- .../TreeSequenceColoringFacts.lean | 118 + .../TwoColorComponentColoringFacts.lean | 177 ++ .../TwoColorComponentSwapPresentColors.lean | 127 + 22 files changed, 860 insertions(+), 3996 deletions(-) create mode 100644 LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTerminalData.lean create mode 100644 LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentColoringFacts.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentSwapPresentColors.lean diff --git a/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean b/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean index c3b63b9483..e5ab30c29e 100644 --- a/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean +++ b/LeanPool/GoldbergSeymour/AbsentOwnerReplacement.lean @@ -1254,42 +1254,6 @@ private theorem helper_vertexMemB_487.{u_1, u_2} : exact hBprefix.2.1 j exact hvEq.symm -private theorem helper_seriesFacts_583.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G - (ett.series.data.coloring j) ∧ IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by - classical - intro V E _ _ _ G k e0 input T phi ett j - have certificate := ett.series.certified j - cases certificate with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => - exact ⟨currentProper, currentOneUncolored⟩ - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact ⟨previousProper, previousOneUncolored⟩ - private theorem helper_branch_724.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1549,8 +1513,7 @@ private theorem helper_continuation_2632.{u_1, u_2} : hib hvB hterminalPath sigma hbetaTerminal hbetaX hcut hstable rcases hstable with ⟨_, _, _, _, hCorr⟩ obtain ⟨corr, hmax, baseT, K, goodT, sameGood⟩ := hCorr - have seriesFacts := @helper_seriesFacts_583 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + have seriesFacts := ett.series.coloringProperties let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := { replacementInput := input replacementSeries := ett.series diff --git a/LeanPool/GoldbergSeymour/AlgorithmFiveFiveSeed.lean b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveSeed.lean index 05623c333c..a5cd3edeb5 100644 --- a/LeanPool/GoldbergSeymour/AlgorithmFiveFiveSeed.lean +++ b/LeanPool/GoldbergSeymour/AlgorithmFiveFiveSeed.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TashkinovSeriesColoringProperties + public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree public import LeanPool.GoldbergSeymour.MaximumProperty @@ -532,61 +534,11 @@ theorem AlgorithmFiveFiveSeed {V E : Type*} have seriesProper : ∀ j : Fin (ett.rounds + 1), IsProperEdgeColoring G (ett.series.data.coloring j) := by intro j - have certificate := ett.series.certified j - cases certificate with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.1 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedProper - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => - exact currentProper - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact previousProper + exact (ett.series.coloringProperties j).1 have seriesOneUncolored : ∀ j : Fin (ett.rounds + 1), IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by intro j - have certificate := ett.series.certified j - cases certificate with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.2 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedOneUncolored - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => - exact currentOneUncolored - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact previousOneUncolored + exact (ett.series.coloringProperties j).2 have selfStable : ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (q : PartialEdgeColoring E k), StableColoring X C q q := by intro X C q diff --git a/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTerminalData.lean b/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTerminalData.lean new file mode 100644 index 0000000000..69c86b4582 --- /dev/null +++ b/LeanPool/GoldbergSeymour/CorrespondingExtendedTashkinovTreeTerminalData.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree + +/-! +# Terminal Data of Corresponding Extended Trees + +Shared facts extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 and generalized during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Corresponding trees have the same terminal ladder tree and extension kind, +even when their final colorings differ. -/ +theorem CorrespondingExtendedTashkinovTree.terminalTreeKind.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (sigma : PartialEdgeColoring + E k) {inp gen : PartialEdgeColoring E k} {U : TreeSequence G e0} (original : + ExtendedTashkinovTree G k e0 inp U gen) (W : TreeSequence G e0) (c : + CorrespondingExtendedTashkinovTree G k e0 original sigma W), + c.replacementETT.series.data.tree (Fin.last c.replacementETT.rounds).castSucc = + original.series.data.tree (Fin.last original.rounds).castSucc ∧ + c.replacementETT.series.data.kind (Fin.last c.replacementETT.rounds) = + original.series.data.kind (Fin.last original.rounds) := by + classical + intro V E _ _ _ G k e0 sigma inp gen U original W c + rcases c with ⟨ri, rs, re, hr, hs, hf, ht, hd, he, hk, hp, hu, hst⟩ + cases re with + | mk rounds positive series above strict below generating => + cases hr + have hseries : series = rs := eq_of_heq hs + cases hseries + let i : Fin original.rounds := ⟨original.rounds - 1, by + have := original.roundsPositive + omega⟩ + have hi : i.succ = Fin.last original.rounds := by + apply Fin.ext + have := original.roundsPositive + simp [i] + omega + exact ⟨by simpa [hi] using ht i, hk _⟩ + +/-- Corresponding extended trees agree on their terminal ladder tree, kind and stored colors. -/ +theorem CorrespondingExtendedTashkinovTree.terminalData {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {input : PartialEdgeColoring E k} {T : TreeSequence G e0} {phi : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input T phi} {U : TreeSequence G e0} + (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + ett.series.data.kind (Fin.last ett.rounds) ∧ + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by + classical + have terminalFacts := CorrespondingExtendedTashkinovTree.terminalTreeKind + G k e0 phi ett U corr + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hf, + ht, hd, he, hk, hp, ho, hstable⟩ + cases newETT with + | mk rounds positive data above strict below generating => + cases hr + have hseries : data = newSeries := eq_of_heq hs + cases hseries + refine ⟨terminalFacts.1, terminalFacts.2, ?_⟩ + unfold TashkinovStoredColors + have hn : (Fin.last ett.rounds).val ≠ 0 := by + have := ett.roundsPositive + simpa using Nat.ne_of_gt (Nat.zero_lt_of_lt ett.roundsPositive) + simp only [ite_eq_right hn] + simp_rw [hd] + rw [← hf, ← ett.generatingColoring, terminalFacts.1] + + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean index d85ab087b5..114a8b49b8 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapPresentColors + public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBSingleStep public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace public import LeanPool.GoldbergSeymour.StrongInterchangeabilityKempePreserved @@ -87,97 +89,6 @@ private theorem helper_root_swap_exchange_230.{u_1, u_2} : exact ⟨eAlpha, heAlphaIncident, by simp [TwoColorComponentSwap, heAlphaComponent, heAlphaColor]⟩ -private theorem helper_swap_preserves_present_295.{u_1, u_2} : - open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : - LooplessMultigraph V E} {k : ℕ}, (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta c - : Fin k} {z : V ⊕ E}, c ∈ PresentColors G phi v → c ≠ alpha → c ≠ beta → c ∈ PresentColors - G (TwoColorComponentSwap G phi alpha beta z) v) → ∀ {phi : PartialEdgeColoring E k} {v : - V} {alpha beta : Fin k} {z : V ⊕ E}, alpha ∈ PresentColors G phi v → beta ∈ PresentColors - G phi v → ∀ c ∈ PresentColors G phi v, c ∈ PresentColors G (TwoColorComponentSwap G phi - alpha beta z) v := by - classical - intro V E _ _ G k swap_present_other phi v alpha beta z halpha hbeta c hc - let _ := Fintype.ofFinite V - by_cases hca : c = alpha - · subst c - by_cases hvK : Sum.inl v ∈ TwoColorComponent G phi alpha beta z - · obtain ⟨e, hev, heColor⟩ := by - simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] using hbeta - have heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by - let H := TwoColorIncidenceGraph G phi alpha beta - have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by - simpa [H, TwoColorIncidenceGraph] using - And.intro hev (Or.inr heColor) - change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z - change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z - at hvK - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hadj).symm.trans hvK - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨e, hev, by - simp [TwoColorComponentSwap, heK, heColor]⟩ - · obtain ⟨e, hev, heColor⟩ := by - simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] using halpha - have heK : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by - intro heK - apply hvK - let H := TwoColorIncidenceGraph G phi alpha beta - have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by - simpa [H, TwoColorIncidenceGraph] using - And.intro hev (Or.inl heColor) - change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z - at heK - change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hadj).trans heK - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨e, hev, by - simpa [TwoColorComponentSwap, heK] using heColor⟩ - · by_cases hcb : c = beta - · subst c - by_cases hvK : Sum.inl v ∈ TwoColorComponent G phi alpha beta z - · obtain ⟨e, hev, heColor⟩ := by - simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] using halpha - have heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by - let H := TwoColorIncidenceGraph G phi alpha beta - have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by - simpa [H, TwoColorIncidenceGraph] using - And.intro hev (Or.inl heColor) - change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z - change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z - at hvK - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hadj).symm.trans hvK - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨e, hev, by - simp [TwoColorComponentSwap, heK, heColor]⟩ - · obtain ⟨e, hev, heColor⟩ := by - simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] using hbeta - have heK : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by - intro heK - apply hvK - let H := TwoColorIncidenceGraph G phi alpha beta - have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by - simpa [H, TwoColorIncidenceGraph] using - And.intro hev (Or.inr heColor) - change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z - at heK - change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hadj).trans heK - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨e, hev, by - simpa [TwoColorComponentSwap, heK] using heColor⟩ - · exact swap_present_other hc hca hcb - private theorem helper_branch_318.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] @@ -682,13 +593,7 @@ theorem ExtensionBaseAlgorithmBInduction {V E : Type*} (hc : c ∈ PresentColors G phi v) (hca : c ≠ alpha) (hcb : c ≠ beta) : c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] at hc ⊢ - rcases hc with ⟨e, hev, hec⟩ - refine ⟨e, hev, ?_⟩ - by_cases heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z - · simp [TwoColorComponentSwap, heK, hec, hca, hcb] - · simpa [TwoColorComponentSwap, heK] using hec + exact TwoColorComponentSwapPreservesOther hc hca hcb have root_swap_exchange := @helper_root_swap_exchange_230 V E inferInstance inferInstance G k have swap_preserves_present {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : Sum V E} @@ -698,8 +603,7 @@ theorem ExtensionBaseAlgorithmBInduction {V E : Type*} ∀ c : Fin k, c ∈ PresentColors G phi v → c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by - exact @helper_swap_preserves_present_295 V E inferInstance inferInstance G k - swap_present_other phi v alpha beta z halpha hbeta + exact TwoColorComponentSwapPreservesPresent halpha hbeta have invariant := @helper_invariant_383 V E inferInstance inferInstance inferInstance G k e0 input T generating ett terminalSupport rho1 u p indices gamma delta b trace hposition htraceDelta hproper hone hchain hselected trace_colors_ne future_gamma_ne next_delta_eq_gamma slot_mem diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean index 550a1d47b8..c99d0e95db 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapPresentColors + public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmCInvariant public import LeanPool.GoldbergSeymour.StrongInterchangeabilityKempePreserved @@ -638,107 +640,6 @@ private theorem helper_root_swap_exchange_437.{u_1, u_2} : exact ⟨eAlpha, heAlphaIncident, by simp [TwoColorComponentSwap, heAlphaComponent, heAlphaColor]⟩ -private theorem helper_swap_preserves_present_502.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} - {k : ℕ} - (_ : - (∀ {phi : PartialEdgeColoring E k} {v : V} {alpha beta c : Fin k} {z : V ⊕ E} - (_ : c ∈ PresentColors G phi v) (_ : c ≠ alpha) (_ : c ≠ beta), - c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v)) - {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : V ⊕ E} - (_ : alpha ∈ PresentColors G phi v) (_ : beta ∈ PresentColors G phi v), - ∀ c ∈ PresentColors G phi v, - c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by - classical - intro V E _ _ G k swap_present_other phi v alpha beta z halpha hbeta c hc - let _ := Fintype.ofFinite V - by_cases hca : c = alpha - · subst c - by_cases hvK : Sum.inl v ∈ TwoColorComponent G phi alpha beta z - · obtain ⟨e, hev, heColor⟩ := by - simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] using hbeta - have heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by - let H := TwoColorIncidenceGraph G phi alpha beta - have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by - simpa [H, TwoColorIncidenceGraph] using - And.intro hev (Or.inr heColor) - change H.connectedComponentMk (Sum.inr e) = - H.connectedComponentMk z - change H.connectedComponentMk (Sum.inl v) = - H.connectedComponentMk z at hvK - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hadj).symm.trans hvK - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨e, hev, by - simp [TwoColorComponentSwap, heK, heColor]⟩ - · obtain ⟨e, hev, heColor⟩ := by - simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] using halpha - have heK : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by - intro heK - apply hvK - let H := TwoColorIncidenceGraph G phi alpha beta - have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by - simpa [H, TwoColorIncidenceGraph] using - And.intro hev (Or.inl heColor) - change H.connectedComponentMk (Sum.inr e) = - H.connectedComponentMk z at heK - change H.connectedComponentMk (Sum.inl v) = - H.connectedComponentMk z - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hadj).trans heK - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨e, hev, by - simpa [TwoColorComponentSwap, heK] using heColor⟩ - · by_cases hcb : c = beta - · subst c - by_cases hvK : Sum.inl v ∈ TwoColorComponent G phi alpha beta z - · obtain ⟨e, hev, heColor⟩ := by - simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] using halpha - have heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by - let H := TwoColorIncidenceGraph G phi alpha beta - have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by - simpa [H, TwoColorIncidenceGraph] using - And.intro hev (Or.inl heColor) - change H.connectedComponentMk (Sum.inr e) = - H.connectedComponentMk z - change H.connectedComponentMk (Sum.inl v) = - H.connectedComponentMk z at hvK - exact - (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hadj).symm.trans hvK - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨e, hev, by - simp [TwoColorComponentSwap, heK, heColor]⟩ - · obtain ⟨e, hev, heColor⟩ := by - simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] using hbeta - have heK : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by - intro heK - apply hvK - let H := TwoColorIncidenceGraph G phi alpha beta - have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by - simpa [H, TwoColorIncidenceGraph] using - And.intro hev (Or.inr heColor) - change H.connectedComponentMk (Sum.inr e) = - H.connectedComponentMk z at heK - change H.connectedComponentMk (Sum.inl v) = - H.connectedComponentMk z - exact - (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hadj).trans heK - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨e, hev, by - simpa [TwoColorComponentSwap, heK] using heColor⟩ - · exact swap_present_other hc hca hcb - private theorem helper_branch_509.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] @@ -1723,13 +1624,7 @@ private theorem helper_continuation_1280.{u_1, u_2} : (hc : c ∈ PresentColors G phi v) (hca : c ≠ alpha) (hcb : c ≠ beta) : c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] at hc ⊢ - rcases hc with ⟨e, hev, hec⟩ - refine ⟨e, hev, ?_⟩ - by_cases heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z - · simp [TwoColorComponentSwap, heK, hec, hca, hcb] - · simpa [TwoColorComponentSwap, heK] using hec + exact TwoColorComponentSwapPreservesOther hc hca hcb have root_swap_exchange := @helper_root_swap_exchange_437 V E inferInstance inferInstance G k have swap_preserves_present {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : Sum V E} @@ -1739,8 +1634,7 @@ private theorem helper_continuation_1280.{u_1, u_2} : ∀ c : Fin k, c ∈ PresentColors G phi v → c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by - exact @helper_swap_preserves_present_502 V E inferInstance inferInstance G k - swap_present_other phi v alpha beta z halpha hbeta + exact TwoColorComponentSwapPreservesPresent halpha hbeta exact @helper_continuation_1578 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@terminalSlot) (@jSlot) (@mu0) (@u) (@p) (@indices) (@gamma) (@delta) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean index ec91af27d8..4f27524e6c 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts + public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion @@ -463,58 +465,6 @@ private theorem helper_advance_428.{u_1, u_2} : exact nextMember P2 theta (by rw [hmissing2 _ (vertexMem B jnext)]; exact htheta1) (hterminal2 hgLast) -private theorem helper_firstAt_634.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (hlen : (4 : - ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => - by omega - ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => - by omega - ); - ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U)) (_ : ( - ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))) (_ : c ∈ - MissingColors G psi (T.vertex j)), HierarchyFirstMissingPosition psi T c ≤ j)) (_ : ( - ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (_ : (↑(HierarchyFirstMissingPosition psi T c) : - ℕ) < T.length), c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T - c)))) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) - (j : Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), - (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx i hlen B hBT elementary vertexMem firstLe - firstMem R c j hc - clear * - G T B R c j hc elementary vertexMem firstLe firstMem hBT - have hcT : c ∈ MissingColors G R.coloring - (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) j)) := by - rw [hBT.2.1 j]; exact hc - have hle := firstLe R.coloring c _ hcT - have hlt : (HierarchyFirstMissingPosition R.coloring T c).val < T.length := by - have := j.isLt - change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle - have hblen : B.length = T.length - 1 := rfl - omega - let x : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T c).val, by - change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle - omega⟩ - have hxT : Fin.castLE (Nat.succ_le_succ hBT.1) x = - HierarchyFirstMissingPosition R.coloring T c := Fin.ext rfl - have hcx : c ∈ MissingColors G R.coloring (B.vertex x) := by - rw [← hBT.2.1 x, hxT] - exact firstMem R.coloring c hlt - have he : B.vertex x = B.vertex j := by - by_contra hn - exact Finset.disjoint_left.mp (elementary R (vertexMem B x) (vertexMem B j) hn) hcx hc - exact congrArg Fin.val (B.vertex_injective he) - private theorem helper_firstMem_669.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) @@ -942,8 +892,11 @@ theorem HierarchySituationOneAdvanceInsideStored {V E : Type*} inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hsituation) (@i) (@hiLower) (@hiUpper) have firstMem := @helper_firstMem_669 V E inferInstance inferInstance G k e0 T - have firstAt := @helper_firstAt_634 V E inferInstance inferInstance inferInstance inferInstance - G k e0 input T phi ett base C ctx i hlen hBT elementary vertexMem firstLe firstMem + have firstAt (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (c : Fin k) (j : Fin (B.length + 1)) + (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : + (HierarchyFirstMissingPosition R.coloring T c).val = j.val := by + exact TreeSequenceFirstMissingPositionEqCast hBT (elementary R) hc have stageSwitch := P2963_T1_TerminalKempeStageSwitch G k e0 input T phi ett base C ctx A B (by omega) rfl rfl have lastData := @helper_lastData_900 (@V) (@E) inferInstance inferInstance inferInstance diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean index 68fd22fc9d..f0e78ada5f 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts + public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion @@ -989,58 +991,6 @@ private theorem helper_advance_481.{u_1, u_2} : input T phi ett base C ctx hsituation P alpha componentData trans starEq hAT hlen hBT fullB elementary vertexMem firstAt outsideA notRaw m hmLower P alpha ha haLast hAlphaStored hmT haM theta htheta nextMember excM hThetaStored -private theorem helper_firstAt_864.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (hlen : (4 : - ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => - by omega - ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => - by omega - ); - ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U)) (_ : ( - ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))) (_ : c ∈ - MissingColors G psi (T.vertex j)), HierarchyFirstMissingPosition psi T c ≤ j)) (_ : ( - ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (_ : (↑(HierarchyFirstMissingPosition psi T c) : - ℕ) < T.length), c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T - c)))) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) - (j : Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), - (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx i hlen B hBT elementary vertexMem firstLe - firstMem R c j hc - clear * - G T B R c j hc elementary vertexMem firstLe firstMem hBT - have hcT : c ∈ MissingColors G R.coloring - (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) j)) := by - rw [hBT.2.1 j]; exact hc - have hle := firstLe R.coloring c _ hcT - have hlt : (HierarchyFirstMissingPosition R.coloring T c).val < T.length := by - have := j.isLt - change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle - have hblen : B.length = T.length - 1 := rfl - omega - let x : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T c).val, by - change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle - omega⟩ - have hxT : Fin.castLE (Nat.succ_le_succ hBT.1) x = - HierarchyFirstMissingPosition R.coloring T c := Fin.ext rfl - have hcx : c ∈ MissingColors G R.coloring (B.vertex x) := by - rw [← hBT.2.1 x, hxT] - exact firstMem R.coloring c hlt - have he : B.vertex x = B.vertex j := by - by_contra hn - exact Finset.disjoint_left.mp (elementary R (vertexMem B x) (vertexMem B j) hn) hcx hc - exact congrArg Fin.val (B.vertex_injective he) - private theorem helper_firstMem_1185.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) @@ -1937,8 +1887,7 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} (c : Fin k) (j : Fin (B.length + 1)) (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : (HierarchyFirstMissingPosition R.coloring T c).val = j.val := by - exact helper_firstAt_864 G k e0 input T phi ett base C ctx i hlen hBT elementary vertexMem - firstLe firstMem R c j hc + exact TreeSequenceFirstMissingPositionEqCast hBT (elementary R) hc have stageSwitch := P2963_T1_TerminalKempeStageSwitch G k e0 input T phi ett base C ctx A B (by omega) rfl rfl have lastData (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean index 1cf9ea3e44..30d76b1ca5 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts + public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound @@ -1075,75 +1077,6 @@ private theorem helper_hthetaFirstIndex_397.{u_1, u_2} : exact Finset.disjoint_left.mp (hElemZ iZ yZ hvne) hthetaFirst.1 hthetaMissingY -private theorem helper_prefixMissing_770.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (_ : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let _ : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - ∀ (W : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → - IsProperEdgeColoring G rho → ColoredVertexSetElementary G rho (TreeSequenceVertexSet W) → - ∀ (u v : V), u ∈ TreeSequenceVertexSet W → v ∈ TreeSequenceVertexSet W → a ∈ MissingColors G - rho u → b ∈ MissingColors G rho v → Sum.inl u ∉ TwoColorComponent G rho a b z → Sum.inl v - ∉ TwoColorComponent G rho a b z → - ∀ w ∈ TreeSequenceVertexSet W, MissingColors G (TwoColorComponentSwap G rho a b z) w = - MissingColors G rho w := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d z W z rho a b hne hp helem u - v huB hvB hu hv hdu hdv - as_aux_lemma => - clear * - G rho a b hne hp helem u v huB hvB hu hv hdu hdv W z - have behavior := TwoColorComponentSwapMissingBehavior G rho a b hne hp z - intro w hwB - by_cases hw : Sum.inl w ∈ TwoColorComponent G rho a b z - · have hwa : a ∉ MissingColors G rho w := by - intro hm - have hwu : w ≠ u := fun he => hdu (he ▸ hw) - exact Finset.disjoint_left.mp (helem hwB huB hwu) hm hu - have hwb : b ∉ MissingColors G rho w := by - intro hm - have hwv : w ≠ v := fun he => hdv (he ▸ hw) - exact Finset.disjoint_left.mp (helem hwB hvB hwv) hm hv - have presentSwapped (c d : Fin k) - (hd : d ∉ MissingColors G rho w) - (hdab : (d = a ∧ c = b) ∨ (d = b ∧ c = a)) : - c ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by - have hpres : d ∈ PresentColors G rho w := by simpa [MissingColors] using hd - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpres - rcases hpres with ⟨e, hwe, he⟩ - have hadj : (TwoColorIncidenceGraph G rho a b).Adj (Sum.inr e) (Sum.inl w) := by - simp only [TwoColorIncidenceGraph] - exact ⟨hwe, hdab.elim (fun h => Or.inl (he.trans (congrArg some h.1))) - (fun h => Or.inr (he.trans (congrArg some h.1)))⟩ - have heC : Sum.inr e ∈ TwoColorComponent G rho a b z := by - change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = _ at hw - change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inr e) = _ - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hw - have heSwap : TwoColorComponentSwap G rho a b z e = some c := by - rcases hdab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ - · simp [TwoColorComponentSwap, heC, he] - · simp [TwoColorComponentSwap, heC, he] - have hpresent : c ∈ PresentColors G (TwoColorComponentSwap G rho a b z) w := by - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] - exact ⟨e, hwe, heSwap⟩ - simpa [MissingColors] using hpresent - have hnewa := presentSwapped a b hwb (Or.inr ⟨rfl, rfl⟩) - have hnewb := presentSwapped b a hwa (Or.inl ⟨rfl, rfl⟩) - apply Finset.ext - intro c - by_cases hca : c = a - · subst c - simp only [hnewa, hwa] - · by_cases hcb : c = b - · subst c - simp only [hnewb, hwb] - · exact behavior.2.2.2 w c hca hcb - · exact behavior.1 w hw - private theorem helper_routeToY_1012.{u_1, u_2} : helperRouteToY1012Conditions.{u_1, u_2} := by classical @@ -1768,74 +1701,6 @@ private theorem helper_sameGammaBeta_943.{u_1, u_2} : exact hgammaA exact firstChange.1 ⟨Nat.pos_of_ne_zero hzero, Or.inl hgammaLast⟩ -private theorem helper_componentLeaf_969.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) - (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → - ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G - rho a b).neighborSet (Sum.inl v)).Subsingleton := by - classical - intro V E _ _ G k rho a b hne hp v hm - let _ := Fintype.ofFinite V - as_aux_lemma => - have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G rho a b) - (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by - rcases hm with ha | hb - · exact MissingColorIncidenceEndpoint G rho a b hne hp v ha - · have he : TwoColorIncidenceGraph G rho a b = - TwoColorIncidenceGraph G rho b a := by - ext x y - cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] - rw [he] - exact MissingColorIncidenceEndpoint G rho b a hne.symm hp v hb - rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd - intro x hx y hy - exact Finset.card_le_one_iff.mp hd - (by simpa [SimpleGraph.mem_neighborFinset] using hx) - (by simpa [SimpleGraph.mem_neighborFinset] using hy) - -private theorem helper_separateComponents_991.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ), ( - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a - b (Sum.inl v)) → ( - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → - ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G - rho a b).neighborSet (Sum.inl v)).Subsingleton) → - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → - ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → - a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b - (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho - a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u)) := by - classical - intro V E _ _ G k componentSelf componentLeaf rho a b hne hp u v w huv huw hvw hu hv hw hsame - let _ := Fintype.ofFinite V - as_aux_lemma => - rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd - · exfalso - obtain ⟨s, t, p, hpPath, hsupport⟩ := - TwoColorComponentSpanningPath G rho a b hp (Sum.inl w) - have ends (x : V) (hx : Sum.inl x ∈ TwoColorComponent G rho a b (Sum.inl w)) - (hm : a ∈ MissingColors G rho x ∨ b ∈ MissingColors G rho x) : - Sum.inl x = s ∨ Sum.inl x = t := by - by_contra hnot - push Not at hnot - have hs : Sum.inl x ∈ p.support := by - change Sum.inl x ∈ {z | z ∈ p.support} - rw [hsupport] - exact hx - exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet - hnot.1 hnot.2 (componentLeaf rho a b hne hp x hm) hs - have hue := ends u (he ▸ componentSelf rho a b u) (Or.inl hu) - have hve := ends v (by rw [he, hsame]; exact componentSelf rho a b v) (Or.inr hv) - have hwe := ends w (componentSelf rho a b w) hw - rcases hue with hu | hu <;> rcases hve with hv | hv <;> rcases hwe with hw | hw - all_goals first - | exact huv (Sum.inl.inj (hu.trans hv.symm)) - | exact huw (Sum.inl.inj (hu.trans hw.symm)) - | exact hvw (Sum.inl.inj (hv.trans hw.symm)) - · exact hd - private theorem helper_hBlt_1027.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -3597,9 +3462,8 @@ private theorem helper_continuation_2662.{u_1, u_2} : (hdv : Sum.inl v ∉ TwoColorComponent G rho a b z) : ∀ w ∈ TreeSequenceVertexSet W, MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by - exact helper_prefixMissing_770 G k e0 input T phi ett base C ctx P alpha beta d W z rho a b - hne hp helem u v huB hvB hu hv - hdu hdv + exact TwoColorComponentSwapMissingOnElementarySet (TreeSequenceVertexSet W) rho a b + hne hp helem z u v huB hvB hu hv hdu hdv have firstPreserved (W : TreeSequence G e0) (hWT : TreeSequenceInitialSegment W T) (rho sigma : PartialEdgeColoring E k) (c : Fin k) (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet W)) @@ -3783,12 +3647,7 @@ private theorem helper_continuation_2578.{u_1, u_2} : Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := by change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl v) = _ rfl - have componentLeaf (rho : PartialEdgeColoring E k) (a b : Fin k) - (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (v : V) - (hm : a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v) : - Set.Subsingleton - ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)) := by - exact helper_componentLeaf_969 (@G) (@k) (@rho) (@a) (@b) (@hne) (@hp) (@v) (@hm) + have componentLeaf := TwoColorMissingVertexLeaf G k have separateComponents (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (u v w : V) (huv : u ≠ v) (huw : u ≠ w) (hvw : v ≠ w) @@ -3798,9 +3657,7 @@ private theorem helper_continuation_2578.{u_1, u_2} : TwoColorComponent G rho a b (Sum.inl v)) : Disjoint (TwoColorComponent G rho a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u)) := by - exact helper_separateComponents_991 (@G) (@k) (@componentSelf) (@componentLeaf) (@rho) (@a) - (@b) (@hne) (@hp) - (@u) (@v) (@w) (@huv) (@huw) (@hvw) (@hu) (@hv) (@hw) (@hsame) + exact TwoColorMissingVerticesDisjoint G k rho a b hne hp u v w huv huw hvw hu hv hw hsame have hBlt : B.length < T.length := by exact helper_hBlt_1027 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@fullPrefixEq) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean index dfd79182a5..b1bebdbf05 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts + public import LeanPool.GoldbergSeymour.EligibleIndexBoundConstruction public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo @@ -1044,56 +1046,6 @@ private theorem helper_advance_1257.{u_1, u_2} : input T phi ett base C ctx componentData trans starEq hAT hlen hBT fullB elementary vertexMem firstAt stageSwitch gammaTransport outsideA notRaw gammaChoice m P alpha ha haLast hm hmT hAX hXB hAXlt haM theta htheta nextMember excNext excM avoidNext hAlphaStored -private theorem helper_firstAt_1681.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hlen : (4 : ℕ) ≤ - T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ - by omega - ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ - by omega - ); TreeSequenceInitialSegment B T → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U) → ( - ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), c ∈ - MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j) → ( - ∀ (psi : PartialEdgeColoring E k) (c : Fin k), (↑(HierarchyFirstMissingPosition psi T c) : ℕ) - < T.length → c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c))) → - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → - (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx hlen B hBT elementary vertexMem firstLe - firstMem R c j hc - have hcT : c ∈ MissingColors G R.coloring - (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) j)) := by - rw [hBT.2.1 j]; exact hc - have hle := firstLe R.coloring c _ hcT - have hlt : (HierarchyFirstMissingPosition R.coloring T c).val < T.length := by - have := j.isLt - change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle - have hblen : B.length = T.length - 1 := rfl - omega - let x : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T c).val, by - change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle - omega⟩ - have hxT : Fin.castLE (Nat.succ_le_succ hBT.1) x = - HierarchyFirstMissingPosition R.coloring T c := Fin.ext rfl - have hcx : c ∈ MissingColors G R.coloring (B.vertex x) := by - rw [← hBT.2.1 x, hxT] - exact firstMem R.coloring c hlt - have he : B.vertex x = B.vertex j := by - by_contra hn - exact Finset.disjoint_left.mp (elementary R (vertexMem B x) (vertexMem B j) hn) hcx hc - exact congrArg Fin.val (B.vertex_injective he) - private theorem helper_firstMem_2558.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] @@ -1585,8 +1537,7 @@ theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} (c : Fin k) (j : Fin (B.length + 1)) (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : (HierarchyFirstMissingPosition R.coloring T c).val = j.val := by - exact helper_firstAt_1681 G k e0 input T phi ett base C ctx hlen hBT elementary vertexMem - firstLe firstMem R c j hc + exact TreeSequenceFirstMissingPositionEqCast hBT (elementary R) hc have stageSwitch := P2963_T1_TerminalKempeStageSwitch G k e0 input T phi ett base C ctx A B (by omega) rfl rfl have lastData (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean index cb3760223d..0a2c26e15a 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTerminalData + +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts + public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData @@ -1584,58 +1588,6 @@ private abbrev helperContinuation227Conditions.{u_1, u_2} : Prop := HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → False -private theorem helper_terminalData_137.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (U : TreeSequence G e0) - (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U), - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = - ett.series.data.tree (Fin.last ett.rounds).castSucc ∧ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - ett.series.data.kind (Fin.last ett.rounds) ∧ - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D R corrMinus baseMinus HMinus corrStar - baseStar HStar U corr - rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hf, - ht, hd, he, hk, hp, ho, hstable⟩ - cases newETT with - | mk rounds positive data above strict below generating => - cases hr - have hseries : data = newSeries := eq_of_heq hs - cases hseries - let i : Fin ett.rounds := ⟨ett.rounds - 1, by have := ett.roundsPositive; omega⟩ - have hi : i.succ = Fin.last ett.rounds := Fin.ext (by - simp [i]; have := ett.roundsPositive; omega) - have htree : newSeries.data.tree (Fin.last ett.rounds).castSucc = - ett.series.data.tree (Fin.last ett.rounds).castSucc := by - rw [← hi] - exact ht i - refine ⟨htree, hk _, ?_⟩ - unfold TashkinovStoredColors - have hn : (Fin.last ett.rounds).val ≠ 0 := by - have := ett.roundsPositive - simpa using Nat.ne_of_gt (Nat.zero_lt_of_lt ett.roundsPositive) - simp only [ite_eq_right hn] - simp_rw [hd] - rw [← hf, ← ett.generatingColoring, htree] - private theorem helper_hstar_188.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -2184,122 +2136,6 @@ private theorem helper_stageMissingA_494.{u_1, u_2} : change TreeMissingColors phi (H.stage i.succ.castSucc) ⊆ _ rw [show A = H.stage i.succ.castSucc by dsimp only [A]; rw [hi]; rfl] -private theorem helper_igBound_526.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - TreeSequenceInitialSegment A T → - (∀ (X : TreeSequence G e0) (c : Fin k) (i : Fin (X.length + (1 : ℕ))), - c ∈ MissingColors G phi (X.vertex i) → - (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ)) → - ∀ - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar), - D.gammaOne ∈ TreeMissingColors phi A → - let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; - (↑ig : ℕ) ≤ A.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hAT firstLe R corrMinus baseMinus - HMinus corrStar baseStar HStar gammaA ig - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp gammaA - obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv - have hm : D.gammaOne ∈ MissingColors G phi - (T.vertex (Fin.castLE (Nat.succ_le_succ hAT.1) i)) := by - rw [hAT.2.1 i] - exact hcv - have hh := firstLe T D.gammaOne _ hm - have := i.isLt - simp only [Fin.val_castLE] at hh - omega - -private theorem helper_vgA_537.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - TreeSequenceInitialSegment A T → - (∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), - X.vertex i ∈ TreeSequenceVertexSet X) → - ∀ - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar), - let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; - let vg : V := T.vertex ig; - (↑ig : ℕ) ≤ A.length → - vg ∈ TreeSequenceVertexSet A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A hAT vertexMem R corrMinus baseMinus - HMinus corrStar baseStar HStar ig vg igBound - let i : Fin (A.length + 1) := ⟨ig.val, by omega⟩ - have hi : Fin.castLE (Nat.succ_le_succ hAT.1) i = ig := Fin.ext rfl - dsimp only [vg] - rw [← hi, hAT.2.1 i] - exact vertexMem A _ - -private theorem helper_penTerminal_553.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); - let P : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - B.length + (2 : ℕ) = T.length → - P.length + (1 : ℕ) = T.length → - ∀ - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar), - R.minus.length = B.length + (1 : ℕ) → - T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B P hBL hPL R corrMinus baseMinus HMinus - corrStar baseStar HStar minusLength he - have hh := congrArg Fin.val (T.vertex_injective he) - have := D.penultimateVertexPosition - have := D.terminalVertexPosition - omega - private theorem helper_oldOrderedUnused_568.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] @@ -3399,43 +3235,6 @@ private theorem helper_missingSubset_3241.{u_1, u_2} : exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hcv⟩ -private theorem helper_penInP_3291.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); - let P : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - ∀ (_ : B.length + (2 : ℕ) = T.length) (_ : P.length + (1 : ℕ) = T.length) - (_ : TreeSequenceInitialSegment P T) - (_ : - ∀ (X : TreeSequence G e0) (i : Fin (X.length + (1 : ℕ))), - X.vertex i ∈ TreeSequenceVertexSet X) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar) - (_ : R.minus.length = B.length + (1 : ℕ)), - T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet P := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B P hBL hPL hPT vertexMem R corrMinus - baseMinus HMinus corrStar baseStar HStar minusLength - have he : Fin.castLE (Nat.succ_le_succ hPT.1) (Fin.last P.length) = - D.penultimateVertexIndex := Fin.ext (by simp; have := D.penultimateVertexPosition; omega) - rw [← he, hPT.2.1] - exact vertexMem P _ - private theorem helper_gammaNotTerminal_3372.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -3746,13 +3545,9 @@ private theorem helper_continuation_3038.{u_1, u_2} : have gammaT := missingSubset hAT gammaA have gammaAt : D.gammaOne ∈ MissingColors G phi vg := firstMissing T D.gammaOne gammaT have igBound : ig.val ≤ A.length := by - exact helper_igBound_526 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hAT) (@firstLe) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) - (@HStar) (@gammaA) + exact TreeSequenceFirstMissingPositionLePrefix hAT gammaA have vgA : vg ∈ TreeSequenceVertexSet A := by - exact helper_vgA_537 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hAT) (@vertexMem) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) - (@HStar) (@igBound) + exact TreeSequenceInitialSegmentVertexMem hAT igBound have vgPen : vg ≠ T.vertex D.penultimateVertexIndex := by intro he have hh := congrArg Fin.val (T.vertex_injective he) @@ -3764,11 +3559,16 @@ private theorem helper_continuation_3038.{u_1, u_2} : have := D.terminalVertexPosition omega have penTerminal : T.vertex D.penultimateVertexIndex ≠ T.vertex D.terminalVertexIndex := by - exact helper_penTerminal_553 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@D) (@hBL) (@hPL) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) - (@HStar) (@minusLength) + exact by + intro equal + have equalIndex := congrArg Fin.val (T.vertex_injective equal) + have := D.penultimateVertexPosition + have := D.terminalVertexPosition + omega have penInP : T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet P := by - apply helper_penInP_3291 <;> assumption + exact TreeSequenceInitialSegmentVertexMem hPT (by + have := D.penultimateVertexPosition + omega) have oldPrefixMissing : D.gammaOne ∈ TreeMissingColors phi P ∧ D.alpha ∈ TreeMissingColors phi P := ⟨missingSubset (transSegment hAB hBP) gammaA, @@ -4300,8 +4100,7 @@ private theorem helper_continuation_227.{u_1, u_2} : TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = TashkinovStoredColors ett.series.data (Fin.last ett.rounds) := by - exact helper_terminalData_137 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@D) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@U) (@corr) + exact corr.terminalData have dataMinus := terminalData R.minus corrMinus have dataStar := terminalData R.star corrStar have hierarchyData (U : TreeSequence G e0) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean index 57590d1210..c5ab0d27d7 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts + +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts + public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne @@ -707,42 +711,6 @@ private theorem helper_hBterminal_152.{u_1, u_2} : simp only [Fin.val_castLE, Fin.val_last] omega -private theorem helper_firstAt_166.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : - HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - B.length + (1 : ℕ) = T.length → T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet - B → ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → - ∀ {c : Fin k}, c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → - HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hyB hElementary c hc - let candidates := Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G phi (T.vertex i) - have hy : D.penultimateVertexIndex ∈ candidates := by simp [candidates, hc] - have hn : candidates.Nonempty := ⟨_, hy⟩ - have hmin := Finset.min'_le candidates _ hy - have hm : c ∈ MissingColors G phi (T.vertex (candidates.min' hn)) := - (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - have hmem : T.vertex (candidates.min' hn) ∈ TreeSequenceVertexSet B := by - let j : Fin (B.length + 1) := ⟨(candidates.min' hn).val, by - have hp := D.penultimateVertexPosition - change (candidates.min' hn).val ≤ D.penultimateVertexIndex.val at hmin - omega⟩ - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - refine ⟨j, ?_⟩ - rfl - have heq : candidates.min' hn = D.penultimateVertexIndex := by - by_contra hne - have hvne := fun h => hne (T.vertex_injective h) - exact Finset.disjoint_left.mp (hElementary hmem hyB hvne) hm hc - simpa only [HierarchyFirstMissingPosition, candidates, dite_eq_left hn] using heq - private theorem helper_hnotA_191.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -890,71 +858,6 @@ private theorem helper_hcase_297.{u_1, u_2} : Fin.castSucc_mk] at hg convert hg using 1; congr 2; apply Fin.ext; simp; omega -private theorem helper_leaf_350.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) - (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → - ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G - rho a b).neighborSet (Sum.inl v)).Subsingleton := by - classical - intro V E _ _ G k rho a b hne hp v hm - let _ := Fintype.ofFinite V - have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G rho a b) - (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by - rcases hm with ha | hb - · exact MissingColorIncidenceEndpoint G rho a b hne hp v ha - · have he : TwoColorIncidenceGraph G rho a b = TwoColorIncidenceGraph G rho b a := by - ext x y - cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] - rw [he] - exact MissingColorIncidenceEndpoint G rho b a hne.symm hp v hb - rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd - intro x hx y hy - exact Finset.card_le_one_iff.mp hd - (by simpa [SimpleGraph.mem_neighborFinset] using hx) - (by simpa [SimpleGraph.mem_neighborFinset] using hy) - -private theorem helper_separate_369.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ), ( - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a - b (Sum.inl v)) → ( - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → - ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G - rho a b).neighborSet (Sum.inl v)).Subsingleton) → - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → - ∀ (u v w : V), u ≠ v → u ≠ w → v ≠ w → a ∈ MissingColors G rho u → b ∈ MissingColors G rho v → - a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → TwoColorComponent G rho a b - (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → Disjoint (TwoColorComponent G rho - a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u)) := by - classical - intro V E _ _ G k self leaf rho a b hne hp u v w huv huw hvw hu hv hw hsame - let _ := Fintype.ofFinite V - rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd - · exfalso - obtain ⟨s, t, p, hpPath, hsupport⟩ := - TwoColorComponentSpanningPath G rho a b hp (Sum.inl w) - have ends (x : V) (hx : Sum.inl x ∈ TwoColorComponent G rho a b (Sum.inl w)) - (hm : a ∈ MissingColors G rho x ∨ b ∈ MissingColors G rho x) : - Sum.inl x = s ∨ Sum.inl x = t := by - by_contra hnot - push Not at hnot - have hs : Sum.inl x ∈ p.support := by - change Sum.inl x ∈ {z | z ∈ p.support} - rw [hsupport] - exact hx - exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet - hnot.1 hnot.2 (leaf rho a b hne hp x hm) hs - have hue := ends u (he ▸ self rho a b u) (Or.inl hu) - have hve := ends v (by rw [he, hsame]; exact self rho a b v) (Or.inr hv) - have hwe := ends w (self rho a b w) hw - rcases hue with hu | hu <;> rcases hve with hv | hv <;> rcases hwe with hw | hw - all_goals first - | exact huv (Sum.inl.inj (hu.trans hv.symm)) - | exact huw (Sum.inl.inj (hu.trans hw.symm)) - | exact hvw (Sum.inl.inj (hv.trans hw.symm)) - · exact hd - private theorem helper_hgy_403.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1088,73 +991,6 @@ private theorem helper_hyt_415.{u_1, u_2} : have ht := D.terminalVertexPosition omega -private theorem helper_prefixMissing_439.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (D : - HierarchySituationTwoCaseOneTwoData G k e0 input T phi ett base C ctx), - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - ∀ (u v : V), u ∈ TreeSequenceVertexSet B → v ∈ TreeSequenceVertexSet B → a ∈ MissingColors G - rho u → b ∈ MissingColors G rho v → Sum.inl u ∉ TwoColorComponent G rho a b z → Sum.inl v - ∉ TwoColorComponent G rho a b z → - ∀ w ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G rho a b z) w = - MissingColors G rho w := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B z rho a b hne hp helem u v huB hvB hu - hv hdu hdv - have behavior := TwoColorComponentSwapMissingBehavior G rho a b hne hp z - intro w hwB - by_cases hw : Sum.inl w ∈ TwoColorComponent G rho a b z - · have hwa : a ∉ MissingColors G rho w := by - intro hm - have hwu : w ≠ u := fun he => hdu (he ▸ hw) - exact Finset.disjoint_left.mp (helem hwB huB hwu) hm hu - have hwb : b ∉ MissingColors G rho w := by - intro hm - have hwv : w ≠ v := fun he => hdv (he ▸ hw) - exact Finset.disjoint_left.mp (helem hwB hvB hwv) hm hv - have presentSwapped (c d : Fin k) - (hd : d ∉ MissingColors G rho w) - (hdab : (d = a ∧ c = b) ∨ (d = b ∧ c = a)) : - c ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by - have hpres : d ∈ PresentColors G rho w := by simpa [MissingColors] using hd - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpres - rcases hpres with ⟨e, hwe, he⟩ - have hadj : (TwoColorIncidenceGraph G rho a b).Adj (Sum.inr e) (Sum.inl w) := by - simp only [TwoColorIncidenceGraph] - exact ⟨hwe, hdab.elim (fun h => Or.inl (he.trans (congrArg some h.1))) - (fun h => Or.inr (he.trans (congrArg some h.1)))⟩ - have heC : Sum.inr e ∈ TwoColorComponent G rho a b z := by - change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = _ at hw - change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inr e) = _ - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hw - have heSwap : TwoColorComponentSwap G rho a b z e = some c := by - rcases hdab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ - · simp [TwoColorComponentSwap, heC, he] - · simp [TwoColorComponentSwap, heC, he] - have hpresent : c ∈ PresentColors G (TwoColorComponentSwap G rho a b z) w := by - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] - exact ⟨e, hwe, heSwap⟩ - simpa [MissingColors] using hpresent - have hnewa := presentSwapped a b hwb (Or.inr ⟨rfl, rfl⟩) - have hnewb := presentSwapped b a hwa (Or.inl ⟨rfl, rfl⟩) - apply Finset.ext - intro c - by_cases hca : c = a - · subst c - simp only [hnewa, hwa] - · by_cases hcb : c = b - · subst c - simp only [hnewb, hwb] - · exact behavior.2.2.2 w c hca hcb - · exact behavior.1 w hw - private theorem helper_predecessorIncident_507.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (e0 : E) (T @@ -1351,42 +1187,6 @@ private theorem helper_hstoredOne_643.{u_1, u_2} : exact firstPreserved phi muOne D.alpha hmissingOne hmissing.2 · exact firstUnaffected phi D.gammaOne D.alpha c hgammaAlpha ctx.proper hcg hca -private theorem helper_seriesFacts_678.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G - (ett.series.data.coloring j) ∧ IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by - classical - intro V E _ _ _ G k e0 input T phi ett j - have certificate := ett.series.certified j - cases certificate with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => - exact ⟨currentProper, currentOneUncolored⟩ - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact ⟨previousProper, previousOneUncolored⟩ - private theorem helper_sameStar_734.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -2779,9 +2579,8 @@ private theorem helper_continuation_1912.{u_1, u_2} : (hdv : Sum.inl v ∉ TwoColorComponent G rho a b z) : ∀ w ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by - exact @helper_prefixMissing_439 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@rho) - (@a) (@b) (@hne) (@hp) (@helem) (@u) (@v) (@huB) (@hvB) (@hu) (@hv) (@hdu) (@hdv) + exact TwoColorComponentSwapMissingOnElementarySet (TreeSequenceVertexSet B) rho a b + hne hp helem z u v huB hvB hu hv hdu hdv have houtsideGamma : Sum.inl (T.vertex ig) ∉ TwoColorComponent G phi D.gammaOne D.alpha z := by intro hm exact Set.disjoint_left.mp hdisjoint hm (self phi D.gammaOne D.alpha _) @@ -2872,8 +2671,7 @@ private theorem helper_continuation_1912.{u_1, u_2} : have seriesFacts : ∀ j : Fin (ett.rounds + 1), IsProperEdgeColoring G (ett.series.data.coloring j) ∧ IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by - exact @helper_seriesFacts_678 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@input) (@T) (@phi) (@ett) + exact ett.series.coloringProperties let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := { replacementInput := input replacementSeries := ett.series @@ -2985,9 +2783,9 @@ theorem HierarchySituationTwoSubcaseOneTwo {V E : Type*} have firstAt {c : Fin k} (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by - exact @helper_firstAt_166 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hyB) - (@hElementary) (@c) (@hc) + exact TreeSequenceFirstMissingPositionEq hBT hElementary (by + have := D.penultimateVertexPosition + omega) hc have hfirstAlpha := firstAt D.alphaMissingPenultimate have hfirstTheta := firstAt D.thetaMissingPenultimate have hnotA {c : Fin k} @@ -3087,12 +2885,7 @@ theorem HierarchySituationTwoSubcaseOneTwo {V E : Type*} Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := by change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl v) = _ rfl - have leaf (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) - (hp : IsProperEdgeColoring G rho) (v : V) - (hm : a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v) : - Set.Subsingleton ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)) := by - exact @helper_leaf_350 (@V) (@E) inferInstance inferInstance (@G) (@k) (@rho) (@a) (@b) - (@hne) (@hp) (@v) (@hm) + have leaf := TwoColorMissingVertexLeaf G k have separate (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (u v w : V) (huv : u ≠ v) (huw : u ≠ w) (hvw : v ≠ w) @@ -3102,9 +2895,7 @@ theorem HierarchySituationTwoSubcaseOneTwo {V E : Type*} TwoColorComponent G rho a b (Sum.inl v)) : Disjoint (TwoColorComponent G rho a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u)) := by - exact @helper_separate_369 (@V) (@E) inferInstance inferInstance - (@G) (@k) (@self) (@leaf) (@rho) (@a) (@b) (@hne) (@hp) (@u) (@v) (@w) (@huv) (@huw) - (@hvw) (@hu) (@hv) (@hw) (@hsame) + exact TwoColorMissingVerticesDisjoint G k rho a b hne hp u v w huv huw hvw hu hv hw hsame have hgy : T.vertex ig ≠ T.vertex D.penultimateVertexIndex := by exact @helper_hgy_403 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hApositive) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean index 630fca0146..b6f2de0b48 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts + +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts + public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne public import LeanPool.GoldbergSeymour.StableChangeCaseThree @@ -1347,46 +1351,6 @@ private theorem helper_hBterminal_159.{u_1, u_2} : simp only [Fin.val_castLE, Fin.val_last] omega -private theorem helper_firstAt_173.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - B.length + (1 : ℕ) = T.length → - T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → - ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → - ∀ {c : Fin k}, - c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → - HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hyB hElementary c hc - let candidates := Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G phi (T.vertex i) - have hy : D.penultimateVertexIndex ∈ candidates := by simp [candidates, hc] - have hn : candidates.Nonempty := ⟨_, hy⟩ - have hmin := Finset.min'_le candidates _ hy - have hm : c ∈ MissingColors G phi (T.vertex (candidates.min' hn)) := - (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - have hmem : T.vertex (candidates.min' hn) ∈ TreeSequenceVertexSet B := by - let j : Fin (B.length + 1) := ⟨(candidates.min' hn).val, by - have hp := D.penultimateVertexPosition - change (candidates.min' hn).val ≤ D.penultimateVertexIndex.val at hmin - omega⟩ - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - refine ⟨j, ?_⟩ - rfl - have heq : candidates.min' hn = D.penultimateVertexIndex := by - by_contra hne - have hvne := fun h => hne (T.vertex_injective h) - exact Finset.disjoint_left.mp (hElementary hmem hyB hvne) hm hc - simpa only [HierarchyFirstMissingPosition, candidates, dite_eq_left hn] using heq - private theorem helper_hnotA_197.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -1534,221 +1498,6 @@ private theorem helper_missingSubset_269.{u_1, u_2} : exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hm⟩ -private theorem helper_leaf_278.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (rho : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - ∀ (v : V), - a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → - ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton := by - classical - intro V E _ _ G k rho a b hne hp v hm - let _ := Fintype.ofFinite V - have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G rho a b) - (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by - rcases hm with ha | hb - · exact MissingColorIncidenceEndpoint G rho a b hne hp v ha - · have he : TwoColorIncidenceGraph G rho a b = TwoColorIncidenceGraph G rho b a := by - ext x y - cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] - rw [he] - exact MissingColorIncidenceEndpoint G rho b a hne.symm hp v hb - rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd - intro x hx y hy - exact Finset.card_le_one_iff.mp hd - (by simpa [SimpleGraph.mem_neighborFinset] using hx) - (by simpa [SimpleGraph.mem_neighborFinset] using hy) - -private theorem helper_separate_297.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ), - (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), - Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → - (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - ∀ (v : V), - a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → - ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton) → - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - ∀ (u v w : V), - u ≠ v → - u ≠ w → - v ≠ w → - a ∈ MissingColors G rho u → - b ∈ MissingColors G rho v → - a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → - TwoColorComponent G rho a b (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → - Disjoint (TwoColorComponent G rho a b (Sum.inl w)) - (TwoColorComponent G rho a b (Sum.inl u)) := by - classical - intro V E _ _ G k self leaf rho a b hne hp u v w huv huw hvw hu hv hw hsame - let _ := Fintype.ofFinite V - rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd - · exfalso - obtain ⟨s, t, p, hpPath, hsupport⟩ := - TwoColorComponentSpanningPath G rho a b hp (Sum.inl w) - have ends (x : V) (hx : Sum.inl x ∈ TwoColorComponent G rho a b (Sum.inl w)) - (hm : a ∈ MissingColors G rho x ∨ b ∈ MissingColors G rho x) : - Sum.inl x = s ∨ Sum.inl x = t := by - by_contra hnot - push Not at hnot - have hs : Sum.inl x ∈ p.support := by - change Sum.inl x ∈ {z | z ∈ p.support} - rw [hsupport] - exact hx - exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet - hnot.1 hnot.2 (leaf rho a b hne hp x hm) hs - have hue := ends u (he ▸ self rho a b u) (Or.inl hu) - have hve := ends v (by rw [he, hsame]; exact self rho a b v) (Or.inr hv) - have hwe := ends w (self rho a b w) hw - rcases hue with hu | hu <;> rcases hve with hv | hv <;> rcases hwe with hw | hw - all_goals first - | exact huv (Sum.inl.inj (hu.trans hv.symm)) - | exact huw (Sum.inl.inj (hu.trans hw.symm)) - | exact hvw (Sum.inl.inj (hv.trans hw.symm)) - · exact hd - -private theorem helper_separateAny_332.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ), - (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), - Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → - (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - ∀ (u v w : V), - u ≠ v → - u ≠ w → - v ≠ w → - a ∈ MissingColors G rho u → - b ∈ MissingColors G rho v → - a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → - TwoColorComponent G rho a b (Sum.inl u) = - TwoColorComponent G rho a b (Sum.inl v) → - Disjoint (TwoColorComponent G rho a b (Sum.inl w)) - (TwoColorComponent G rho a b (Sum.inl u))) → - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - ∀ (u v w : V), - u ≠ w → - v ≠ w → - a ∈ MissingColors G rho u → - b ∈ MissingColors G rho v → - a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → - TwoColorComponent G rho a b (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → - Disjoint (TwoColorComponent G rho a b (Sum.inl w)) - (TwoColorComponent G rho a b (Sum.inl u)) := by - classical - intro V E _ _ G k self separate rho a b hne hp u v w huw hvw hu hv hw hsame - let _ := Fintype.ofFinite V - by_cases huv : u = v - · subst v - rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd - · have noColor (c : Fin k) (hc : c ∈ MissingColors G rho u) - (f : E) (hf : Incident G u f) : rho f ≠ some c := by - intro hcol - exact (Finset.mem_sdiff.mp hc).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hf, hcol⟩) - have hn : (TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl u) = ∅ := by - apply Set.eq_empty_iff_forall_notMem.mpr - intro x hx - cases x with - | inl x => exact hx - | inr f => - rcases hx with ⟨hi, hc⟩ - exact hc.elim (noColor a hu f hi) (noColor b hv f hi) - have hwIn : Sum.inl w ∈ TwoColorComponent G rho a b (Sum.inl u) := - he ▸ self rho a b w - change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = - (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl u) at hwIn - exact False.elim (SimpleGraph.not_reachable_of_neighborSet_left_eq_empty - (fun h => huw (Sum.inl.inj h)) hn - (SimpleGraph.ConnectedComponent.exact hwIn).symm) - · exact hd - · exact separate rho a b hne hp u v w huv huw hvw hu hv hw hsame - -private theorem helper_prefixMissing_366.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - ∀ (u v : V), - u ∈ TreeSequenceVertexSet B → - v ∈ TreeSequenceVertexSet B → - a ∈ MissingColors G rho u → - b ∈ MissingColors G rho v → - Sum.inl u ∉ TwoColorComponent G rho a b z → - Sum.inl v ∉ TwoColorComponent G rho a b z → - ∀ w ∈ TreeSequenceVertexSet B, - MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C B z rho a b hne hp helem u v huB hvB hu hv hdu hdv - as_aux_lemma => - clear_value B - clear * - G rho a b hne hp helem u v huB hvB hu hv hdu hdv B z - have behavior := TwoColorComponentSwapMissingBehavior G rho a b hne hp z - intro w hwB - by_cases hw : Sum.inl w ∈ TwoColorComponent G rho a b z - · have hwa : a ∉ MissingColors G rho w := by - intro hm - have hwu : w ≠ u := fun he => hdu (he ▸ hw) - exact Finset.disjoint_left.mp (helem hwB huB hwu) hm hu - have hwb : b ∉ MissingColors G rho w := by - intro hm - have hwv : w ≠ v := fun he => hdv (he ▸ hw) - exact Finset.disjoint_left.mp (helem hwB hvB hwv) hm hv - have presentSwapped (c d : Fin k) - (hd : d ∉ MissingColors G rho w) - (hdab : (d = a ∧ c = b) ∨ (d = b ∧ c = a)) : - c ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by - have hpres : d ∈ PresentColors G rho w := by simpa [MissingColors] using hd - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpres - rcases hpres with ⟨e, hwe, he⟩ - have hadj : (TwoColorIncidenceGraph G rho a b).Adj (Sum.inr e) (Sum.inl w) := by - simp only [TwoColorIncidenceGraph] - exact ⟨hwe, hdab.elim (fun h => Or.inl (he.trans (congrArg some h.1))) - (fun h => Or.inr (he.trans (congrArg some h.1)))⟩ - have heC : Sum.inr e ∈ TwoColorComponent G rho a b z := by - change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = _ at hw - change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inr e) = _ - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hw - have heSwap : TwoColorComponentSwap G rho a b z e = some c := by - rcases hdab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ - · simp [TwoColorComponentSwap, heC, he] - · simp [TwoColorComponentSwap, heC, he] - have hpresent : c ∈ PresentColors G (TwoColorComponentSwap G rho a b z) w := by - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] - exact ⟨e, hwe, heSwap⟩ - simpa [MissingColors] using hpresent - have hnewa := presentSwapped a b hwb (Or.inr ⟨rfl, rfl⟩) - have hnewb := presentSwapped b a hwa (Or.inl ⟨rfl, rfl⟩) - apply Finset.ext - intro c - by_cases hca : c = a - · subst c - simp only [hnewa, hwa] - · by_cases hcb : c = b - · subst c - simp only [hnewb, hwb] - · exact behavior.2.2.2 w c hca hcb - · exact behavior.1 w hw - private theorem helper_firstPreserved_424.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -1817,43 +1566,6 @@ private theorem helper_firstUnaffected_449.{u_1, u_2} : unfold HierarchyFirstMissingPosition rw [he] -private theorem helper_seriesFacts_464.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (j : Fin (ett.rounds + (1 : ℕ))), - IsProperEdgeColoring G (ett.series.data.coloring j) ∧ - IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by - classical - intro V E _ _ _ G k e0 input T phi ett j - have certificate := ett.series.certified j - cases certificate with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => - exact ⟨currentProper, currentOneUncolored⟩ - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact ⟨previousProper, previousOneUncolored⟩ - private theorem helper_sameStar_518.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -4426,9 +4138,9 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} have firstAt {c : Fin k} (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by - exact @helper_firstAt_173 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hyB) - (@hElementary) (@c) (@hc) + exact TreeSequenceFirstMissingPositionEq hBT hElementary (by + have := D.penultimateVertexPosition + omega) hc have hfirstTheta := firstAt D.thetaMissingPenultimate have hnotA {c : Fin k} (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : @@ -4466,12 +4178,7 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} TreeMissingColors rho X ⊆ TreeMissingColors rho Y := by exact @helper_missingSubset_269 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@rho) (@X) (@Y) (@hXY) - have leaf (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) - (hp : IsProperEdgeColoring G rho) (v : V) - (hm : a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v) : - Set.Subsingleton ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)) := by - exact @helper_leaf_278 (@V) (@E) inferInstance inferInstance (@G) (@k) (@rho) (@a) (@b) - (@hne) (@hp) (@v) (@hm) + have leaf := TwoColorMissingVertexLeaf G k have separate (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (u v w : V) (huv : u ≠ v) (huw : u ≠ w) (hvw : v ≠ w) @@ -4481,9 +4188,7 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} TwoColorComponent G rho a b (Sum.inl v)) : Disjoint (TwoColorComponent G rho a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u)) := by - exact @helper_separate_297 (@V) (@E) inferInstance inferInstance - (@G) (@k) (@self) (@leaf) (@rho) (@a) (@b) (@hne) (@hp) (@u) (@v) (@w) (@huv) (@huw) - (@hvw) (@hu) (@hv) (@hw) (@hsame) + exact TwoColorMissingVerticesDisjoint G k rho a b hne hp u v w huv huw hvw hu hv hw hsame -- Coincident first witnesses miss both colors, so their component is isolated. have separateAny (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (u v w : V) @@ -4494,9 +4199,7 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} TwoColorComponent G rho a b (Sum.inl v)) : Disjoint (TwoColorComponent G rho a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u)) := by - exact @helper_separateAny_332 (@V) (@E) inferInstance inferInstance (@G) (@k) - (@self) (@separate) (@rho) (@a) (@b) (@hne) (@hp) (@u) (@v) (@w) (@huw) (@hvw) (@hu) - (@hv) (@hw) (@hsame) + exact TwoColorMissingVerticesDisjointAny G k rho a b hne hp u v w huw hvw hu hv hw hsame have prefixMissing (z : Sum V E) (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B)) @@ -4506,9 +4209,8 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} (hdv : Sum.inl v ∉ TwoColorComponent G rho a b z) : ∀ w ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by - exact @helper_prefixMissing_366 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@z) (@rho) (@a) - (@b) (@hne) (@hp) (@helem) (@u) (@v) (@huB) (@hvB) (@hu) (@hv) (@hdu) (@hdv) + exact TwoColorComponentSwapMissingOnElementarySet (TreeSequenceVertexSet B) rho a b + hne hp helem z u v huB hvB hu hv hdu hdv have firstPreserved (rho sigma : PartialEdgeColoring E k) (c : Fin k) (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B)) (hmiss : ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) @@ -4526,8 +4228,7 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} have seriesFacts : ∀ j : Fin (ett.rounds + 1), IsProperEdgeColoring G (ett.series.data.coloring j) ∧ IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by - exact @helper_seriesFacts_464 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@input) (@T) (@phi) (@ett) + exact ett.series.coloringProperties let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := { replacementInput := input replacementSeries := ett.series diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean index e84bbfe886..4913837cdf 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTerminalData + public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoExclusions @@ -1937,69 +1939,6 @@ private theorem helper_hstarSecondEdge_484.{u_1, u_2} : rw [hi] exact hstarEdge -private theorem helper_terminalData_494.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - ∀ - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar) (_ : Fin k) - (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U), - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = - ett.series.data.tree n.castSucc ∧ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - ett.series.data.kind n ∧ - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D n Dn R corrMinus baseMinus HMinus - corrStar baseStar HStar beta U corr - rcases corr with ⟨replacementInput, replacementSeries, replacementETT, - rungAgreement, seriesPresentation, finalGeneratingColoring, - ladderTreesAgree, storedColorsAgree, connectingEdgesAgree, - extensionKindsAgree, replacementProper, replacementOneUncolored, - replacementStable⟩ - cases replacementETT with - | mk rounds roundsPositive replacementData above strict below generating => - cases rungAgreement - have seriesSame : replacementData = replacementSeries := - eq_of_heq seriesPresentation - cases seriesSame - let i : Fin ett.rounds := ⟨ett.rounds - 1, by have hp := C.positive; omega⟩ - have hi : i.succ = n := by - apply Fin.ext - simp only [Fin.val_succ] - change ett.rounds - 1 + 1 = ett.rounds - have hp := C.positive - omega - have htree : replacementSeries.data.tree n.castSucc = - ett.series.data.tree n.castSucc := by - rw [← hi] - exact ladderTreesAgree i - refine ⟨htree, extensionKindsAgree n, ?_⟩ - change TashkinovStoredColors replacementSeries.data n = Dn - dsimp [Dn] - unfold TashkinovStoredColors - have hn : n.val ≠ 0 := by simpa [n] using Nat.ne_of_gt C.positive - simp only [ite_eq_right hn] - simp_rw [storedColorsAgree] - rw [← finalGeneratingColoring, htree, ← ett.generatingColoring] - private theorem helper_hApositive_533.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] @@ -4439,9 +4378,7 @@ private theorem helper_continuation_4235.{u_1, u_2} : ett.series.data.kind n ∧ TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = Dn := by - exact @helper_terminalData_494 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@R) - (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@beta) (@U) (@corr) + exact corr.terminalData have hApositive (hq : 0 < H.dividerCount) : A = H.stage q.castSucc := by exact @helper_hApositive_533 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@R) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean index 4aafa9f84a..7d2eb6634a 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts + +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts + public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne public import LeanPool.GoldbergSeymour.StableChangeCaseThree @@ -1894,46 +1898,6 @@ private theorem helper_hBterminal_158.{u_1, u_2} : simp only [Fin.val_castLE, Fin.val_last] omega -private theorem helper_firstAt_172.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - B.length + (1 : ℕ) = T.length → - T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → - ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → - ∀ {c : Fin k}, - c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → - HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D B hBlen hyB hElementary c hc - let candidates := Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G phi (T.vertex i) - have hy : D.penultimateVertexIndex ∈ candidates := by simp [candidates, hc] - have hn : candidates.Nonempty := ⟨_, hy⟩ - have hmin := Finset.min'_le candidates _ hy - have hm : c ∈ MissingColors G phi (T.vertex (candidates.min' hn)) := - (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - have hmem : T.vertex (candidates.min' hn) ∈ TreeSequenceVertexSet B := by - let j : Fin (B.length + 1) := ⟨(candidates.min' hn).val, by - have hp := D.penultimateVertexPosition - change (candidates.min' hn).val ≤ D.penultimateVertexIndex.val at hmin - omega⟩ - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - refine ⟨j, ?_⟩ - rfl - have heq : candidates.min' hn = D.penultimateVertexIndex := by - by_contra hne - have hvne := fun h => hne (T.vertex_injective h) - exact Finset.disjoint_left.mp (hElementary hmem hyB hvne) hm hc - simpa only [HierarchyFirstMissingPosition, candidates, dite_eq_left hn] using heq - private theorem helper_hnotA_197.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -2224,160 +2188,6 @@ private theorem helper_missingWithoutExtra_331.{u_1, u_2} : exact hc (Finset.mem_biUnion.mpr ⟨v, Finset.mem_sdiff.mpr ⟨hv, hn⟩, hvc⟩) exact Finset.mem_biUnion.mpr ⟨v, hvY, hvc⟩ -private theorem helper_leaf_344.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (rho : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - ∀ (v : V), - a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → - ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton := by - classical - intro V E _ _ G k rho a b hne hp v hm - let _ := Fintype.ofFinite V - have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G rho a b) - (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by - rcases hm with ha | hb - · exact MissingColorIncidenceEndpoint G rho a b hne hp v ha - · have he : TwoColorIncidenceGraph G rho a b = TwoColorIncidenceGraph G rho b a := by - ext x y - cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] - rw [he] - exact MissingColorIncidenceEndpoint G rho b a hne.symm hp v hb - rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd - intro x hx y hy - exact Finset.card_le_one_iff.mp hd - (by simpa [SimpleGraph.mem_neighborFinset] using hx) - (by simpa [SimpleGraph.mem_neighborFinset] using hy) - -private theorem helper_separate_363.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ), - (∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), - Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v)) → - (∀ (rho : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - ∀ (v : V), - a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → - ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)).Subsingleton) → - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - ∀ (u v w : V), - u ≠ v → - u ≠ w → - v ≠ w → - a ∈ MissingColors G rho u → - b ∈ MissingColors G rho v → - a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w → - TwoColorComponent G rho a b (Sum.inl u) = TwoColorComponent G rho a b (Sum.inl v) → - Disjoint (TwoColorComponent G rho a b (Sum.inl w)) - (TwoColorComponent G rho a b (Sum.inl u)) := by - classical - intro V E _ _ G k self leaf rho a b hne hp u v w huv huw hvw hu hv hw hsame - let _ := Fintype.ofFinite V - rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd - · exfalso - obtain ⟨s, t, p, hpPath, hsupport⟩ := - TwoColorComponentSpanningPath G rho a b hp (Sum.inl w) - have ends (x : V) (hx : Sum.inl x ∈ TwoColorComponent G rho a b (Sum.inl w)) - (hm : a ∈ MissingColors G rho x ∨ b ∈ MissingColors G rho x) : - Sum.inl x = s ∨ Sum.inl x = t := by - by_contra hnot - push Not at hnot - have hs : Sum.inl x ∈ p.support := by - change Sum.inl x ∈ {z | z ∈ p.support} - rw [hsupport] - exact hx - exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet - hnot.1 hnot.2 (leaf rho a b hne hp x hm) hs - have hue := ends u (he ▸ self rho a b u) (Or.inl hu) - have hve := ends v (by rw [he, hsame]; exact self rho a b v) (Or.inr hv) - have hwe := ends w (self rho a b w) hw - rcases hue with hu | hu <;> rcases hve with hv | hv <;> rcases hwe with hw | hw - all_goals first - | exact huv (Sum.inl.inj (hu.trans hv.symm)) - | exact huw (Sum.inl.inj (hu.trans hw.symm)) - | exact hvw (Sum.inl.inj (hv.trans hw.symm)) - · exact hd - -private theorem helper_prefixMissing_397.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - ∀ (u v : V), - u ∈ TreeSequenceVertexSet B → - v ∈ TreeSequenceVertexSet B → - a ∈ MissingColors G rho u → - b ∈ MissingColors G rho v → - Sum.inl u ∉ TwoColorComponent G rho a b z → - Sum.inl v ∉ TwoColorComponent G rho a b z → - ∀ w ∈ TreeSequenceVertexSet B, - MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C B z rho a b hne hp helem u v huB hvB hu hv hdu hdv - as_aux_lemma => - clear_value B - clear * - G rho a b hne hp helem u v huB hvB hu hv hdu hdv B z - have behavior := TwoColorComponentSwapMissingBehavior G rho a b hne hp z - intro w hwB - by_cases hw : Sum.inl w ∈ TwoColorComponent G rho a b z - · have hwa : a ∉ MissingColors G rho w := by - intro hm - have hwu : w ≠ u := fun he => hdu (he ▸ hw) - exact Finset.disjoint_left.mp (helem hwB huB hwu) hm hu - have hwb : b ∉ MissingColors G rho w := by - intro hm - have hwv : w ≠ v := fun he => hdv (he ▸ hw) - exact Finset.disjoint_left.mp (helem hwB hvB hwv) hm hv - have presentSwapped (c d : Fin k) - (hd : d ∉ MissingColors G rho w) - (hdab : (d = a ∧ c = b) ∨ (d = b ∧ c = a)) : - c ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by - have hpres : d ∈ PresentColors G rho w := by simpa [MissingColors] using hd - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hpres - rcases hpres with ⟨e, hwe, he⟩ - have hadj : (TwoColorIncidenceGraph G rho a b).Adj (Sum.inr e) (Sum.inl w) := by - simp only [TwoColorIncidenceGraph] - exact ⟨hwe, hdab.elim (fun h => Or.inl (he.trans (congrArg some h.1))) - (fun h => Or.inr (he.trans (congrArg some h.1)))⟩ - have heC : Sum.inr e ∈ TwoColorComponent G rho a b z := by - change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = _ at hw - change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inr e) = _ - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hw - have heSwap : TwoColorComponentSwap G rho a b z e = some c := by - rcases hdab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ - · simp [TwoColorComponentSwap, heC, he] - · simp [TwoColorComponentSwap, heC, he] - have hpresent : c ∈ PresentColors G (TwoColorComponentSwap G rho a b z) w := by - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] - exact ⟨e, hwe, heSwap⟩ - simpa [MissingColors] using hpresent - have hnewa := presentSwapped a b hwb (Or.inr ⟨rfl, rfl⟩) - have hnewb := presentSwapped b a hwa (Or.inl ⟨rfl, rfl⟩) - apply Finset.ext - intro c - by_cases hca : c = a - · subst c - simp only [hnewa, hwa] - · by_cases hcb : c = b - · subst c - simp only [hnewb, hwb] - · exact behavior.2.2.2 w c hca hcb - · exact behavior.1 w hw - private theorem helper_firstPreserved_455.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -2446,43 +2256,6 @@ private theorem helper_firstUnaffected_480.{u_1, u_2} : unfold HierarchyFirstMissingPosition rw [he] -private theorem helper_seriesFacts_495.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (j : Fin (ett.rounds + (1 : ℕ))), - IsProperEdgeColoring G (ett.series.data.coloring j) ∧ - IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by - classical - intro V E _ _ _ G k e0 input T phi ett j - have certificate := ett.series.certified j - cases certificate with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact ⟨choice.selectedProper, choice.selectedOneUncolored⟩ - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => - exact ⟨currentProper, currentOneUncolored⟩ - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact ⟨previousProper, previousOneUncolored⟩ - private theorem helper_sameStar_549.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -5895,8 +5668,7 @@ private theorem helper_continuation_4157.{u_1, u_2} : have seriesFacts : ∀ j : Fin (ett.rounds + 1), IsProperEdgeColoring G (ett.series.data.coloring j) ∧ IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by - exact @helper_seriesFacts_495 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@input) (@T) (@phi) (@ett) + exact ett.series.coloringProperties let corrRefl : CorrespondingExtendedTashkinovTree G k e0 ett phi T := { replacementInput := input replacementSeries := ett.series @@ -6071,9 +5843,9 @@ theorem HierarchySituationTwoSubcaseTwoTwo {V E : Type*} have firstAt {c : Fin k} (hc : c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex)) : HierarchyFirstMissingPosition phi T c = D.penultimateVertexIndex := by - exact @helper_firstAt_172 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hyB) - (@hElementary) (@c) (@hc) + exact TreeSequenceFirstMissingPositionEq hBT hElementary (by + have := D.penultimateVertexPosition + omega) hc have hfirstAlpha := firstAt D.alphaMissingPenultimate have hfirstTheta := firstAt D.thetaMissingPenultimate have hnotA {c : Fin k} @@ -6140,12 +5912,7 @@ theorem HierarchySituationTwoSubcaseTwoTwo {V E : Type*} c ∈ TreeMissingColors rho X → c ∈ TreeMissingColors rho Y := by exact @helper_missingWithoutExtra_331 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@rho) (@X) (@Y) (@c) (@hc) - have leaf (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) - (hp : IsProperEdgeColoring G rho) (v : V) - (hm : a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v) : - Set.Subsingleton ((TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl v)) := by - exact @helper_leaf_344 (@V) (@E) inferInstance inferInstance (@G) (@k) (@rho) (@a) (@b) - (@hne) (@hp) (@v) (@hm) + have leaf := TwoColorMissingVertexLeaf G k have separate (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (u v w : V) (huv : u ≠ v) (huw : u ≠ w) (hvw : v ≠ w) @@ -6155,9 +5922,7 @@ theorem HierarchySituationTwoSubcaseTwoTwo {V E : Type*} TwoColorComponent G rho a b (Sum.inl v)) : Disjoint (TwoColorComponent G rho a b (Sum.inl w)) (TwoColorComponent G rho a b (Sum.inl u)) := by - exact @helper_separate_363 (@V) (@E) inferInstance inferInstance - (@G) (@k) (@self) (@leaf) (@rho) (@a) (@b) (@hne) (@hp) (@u) (@v) (@w) (@huv) (@huw) - (@hvw) (@hu) (@hv) (@hw) (@hsame) + exact TwoColorMissingVerticesDisjoint G k rho a b hne hp u v w huv huw hvw hu hv hw hsame have prefixMissing (z : Sum V E) (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B)) @@ -6167,9 +5932,8 @@ theorem HierarchySituationTwoSubcaseTwoTwo {V E : Type*} (hdv : Sum.inl v ∉ TwoColorComponent G rho a b z) : ∀ w ∈ TreeSequenceVertexSet B, MissingColors G (TwoColorComponentSwap G rho a b z) w = MissingColors G rho w := by - exact @helper_prefixMissing_397 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@z) (@rho) (@a) - (@b) (@hne) (@hp) (@helem) (@u) (@v) (@huB) (@hvB) (@hu) (@hv) (@hdu) (@hdv) + exact TwoColorComponentSwapMissingOnElementarySet (TreeSequenceVertexSet B) rho a b + hne hp helem z u v huB hvB hu hv hdu hdv have firstPreserved (rho sigma : PartialEdgeColoring E k) (c : Fin k) (helem : ColoredVertexSetElementary G rho (TreeSequenceVertexSet B)) (hmiss : ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) diff --git a/LeanPool/GoldbergSeymour/Imports.lean b/LeanPool/GoldbergSeymour/Imports.lean index eed322ff9a..d7c09dc0bf 100644 --- a/LeanPool/GoldbergSeymour/Imports.lean +++ b/LeanPool/GoldbergSeymour/Imports.lean @@ -64,6 +64,7 @@ public import LeanPool.GoldbergSeymour.ConditionNineTransport public import LeanPool.GoldbergSeymour.CopyAugmentationPrefix public import LeanPool.GoldbergSeymour.CoreClosurePresentation public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTerminalData public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTrans public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTransTrees public import LeanPool.GoldbergSeymour.CorrespondingTerminalClosureEq @@ -704,6 +705,7 @@ public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeUnique public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts @@ -717,6 +719,7 @@ public import LeanPool.GoldbergSeymour.TreeVertexOrder public import LeanPool.GoldbergSeymour.TreeVerticesBefore public import LeanPool.GoldbergSeymour.TrunkRotation public import LeanPool.GoldbergSeymour.TwoColorComponent +public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts public import LeanPool.GoldbergSeymour.TwoColorComponentCycle public import LeanPool.GoldbergSeymour.TwoColorComponentNearestSegment public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath @@ -724,6 +727,7 @@ public import LeanPool.GoldbergSeymour.TwoColorComponentSwap public import LeanPool.GoldbergSeymour.TwoColorComponentSwapDisjointPairGraph public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior public import LeanPool.GoldbergSeymour.TwoColorComponentSwapNonElementary +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapPresentColors public import LeanPool.GoldbergSeymour.TwoColorComponentSwapPreservesDisjointComponent public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper public import LeanPool.GoldbergSeymour.TwoColorComponentTashkinovSplice diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean b/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean index 1b58914c6a..27fbf47295 100644 --- a/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean +++ b/LeanPool/GoldbergSeymour/ScheideStructuralReducedAssembly.lean @@ -21,2262 +21,17 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private abbrev helperBranch504Conditions.{u_1, u_2} : Prop := - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) - (C : ScheideStructuralConfiguration G k e0 phi T) - (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) - (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), - let newP : ℕ := C.p + (2 : ℕ) * D.absorbedCount; - let newS : ℕ := D.retainedCount; - let newVertex : Fin newP → V := fun (q : Fin newP) => - T'.vertex - (⟨(↑q : ℕ), - have hq : (↑q : ℕ) < newP := q.isLt; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a + (1 : ℕ)) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by omega)⟩ : - Fin (T'.length + (1 : ℕ))); - let newGamma : Fin newS → Fin k := fun (t : Fin newS) => C.gamma (D.retained t); - let newBlockVertex : Fin newS → Fin (2 : ℕ) → V := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - T'.vertex - (⟨C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - have ht : (↑t : ℕ) < newS := t.isLt; - have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a + (1 : ℕ)) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : - ¬C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) => - by omega)⟩ : - Fin (T'.length + (1 : ℕ))); - let newBaseEdge : Fin (newP - (1 : ℕ)) → E := fun (q : Fin (newP - (1 : ℕ))) => - T'.edge - (⟨(↑q : ℕ), - have hq : (↑q : ℕ) < newP - (1 : ℕ) := q.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega)⟩ : - Fin T'.length); - let newBlockEdge : Fin newS → Fin (2 : ℕ) → E := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - T'.edge - (⟨C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - have ht : (↑t : ℕ) < newS := t.isLt; - have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : - ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length) => - by omega)⟩ : - Fin T'.length); - ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ (q : Fin C.p), C.y q = v), - let assembled : ScheideReducedConfiguration G k e0 phi T' := - { - p := newP, s := newS, - p_ge_two := - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - id - (Decidable.byContradiction fun (a : ¬(2 : ℕ) ≤ C.p + (2 : ℕ) * D.absorbedCount) => by omega), - gamma := newGamma, - gamma_injective := fun ⦃a b : Fin newS⦄ (hab : newGamma a = newGamma b) => - D.retained_injective (C.gamma_injective hab), - y := newVertex, baseEdge := newBaseEdge, blockVertex := newBlockVertex, - blockEdge := newBlockEdge, - length_eq := - id - (have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - _a + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : ¬T.length + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) => - by omega)), - base_vertex_position := fun (q : Fin newP) => - Eq.refl - (T'.vertex - (⟨(↑q : ℕ), - (by - have := (q).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin (T'.length + (1 : ℕ)))), - block_vertex_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - Eq.refl - (T'.vertex - (⟨newP + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - (by - have := (t).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin (T'.length + (1 : ℕ)))), - base_edge_position := fun (q : Fin (newP - (1 : ℕ))) => - Eq.refl - (T'.edge - (⟨(↑q : ℕ), - (by - have := (q).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length)), - block_edge_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - id - (congrArg T'.edge - (Fin.ext - (id - (have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - Decidable.byContradiction - fun - (a : - ¬C.p + (2 : ℕ) * D.absorbedCount - (1 : ℕ) + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) = - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ)) => - by omega)))), - block_attaches_to_base := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - have h : - ∃ (q : Fin C.p), - G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j) := - C.block_attaches_to_base (D.retained t) j; - Exists.casesOn h - fun (q : Fin C.p) - (hq : G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j)) => - let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); - Exists.intro qnew - (Eq.mpr - (id - (congrArg (fun (_a : E) => G.ends _a = s(newVertex qnew, newBlockVertex t j)) - (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := - id (Q.retained_edge_position t j); - this))) - (Eq.mpr - (id - (congrArg - (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(_a, newBlockVertex t j)) - (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); - this))) - (Eq.mpr - (id - (congrArg (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(C.y q, _a)) - (have this : newBlockVertex t j = C.blockVertex (D.retained t) j := - id (Q.retained_vertex_position t j); - this))) - hq))), - block_color := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - Eq.mpr - (id - (congrArg (fun (_a : E) => phi _a = some (newGamma t)) - (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := - id (Q.retained_edge_position t j); - this))) - (C.block_color (D.retained t) j), - block_color_missing_on_base := fun (t : Fin newS) => - let v : V := (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V); - have hv : v ∈ ScheideExitVertices T phi := - ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property; - Exists.casesOn (oldExitBase v hv) fun (q : Fin C.p) (hq : C.y q = v) => - let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); - Exists.intro qnew - (Eq.mpr - (id - (congrArg (fun (_a : Fin k) => _a ∈ MissingColors G phi (newVertex qnew)) - (have this : newGamma t = C.gamma (D.retained t) := Eq.refl (newGamma t); - this))) - (Eq.mpr - (id - (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) - (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); - this))) - (Eq.mpr - (id (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) hq)) - (D.retained_missing t)))), - initial_nonfirst_avoids_blocks := - fun (q : Fin (newP - (1 : ℕ))) (hq : (1 : ℕ) ≤ (↑q : ℕ)) (c : Fin k) - (hc : phi (newBaseEdge q) = some c) (r : Fin newS) => - let split : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount) := - (⟨(↑q : ℕ), by omega⟩ : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)); - have core : - ∀ (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), - (1 : ℕ) ≤ (↑n : ℕ) → - ∀ (d : Fin k), - phi - (T'.edge - (⟨(↑n : ℕ), - have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d → - ∀ (r : Fin D.retainedCount), d ≠ C.gamma (D.retained r) := - fun (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) (hn : (1 : ℕ) ≤ (↑n : ℕ)) - (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑n : ℕ), - have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - Fin.addCases (motive := fun (x : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) => - (1 : ℕ) ≤ (↑x : ℕ) → - ∀ (x_2 : Fin k), - phi - (T'.edge - (⟨(↑x : ℕ), - have hn : (↑x : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := x.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑x : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑x : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some x_2 → - ∀ (x : Fin D.retainedCount), x_2 ≠ C.gamma (D.retained x)) - (fun (u : Fin (C.p - (1 : ℕ))) - (hn : (1 : ℕ) ≤ (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ)) (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ), - have hn : - (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.castAdd ((2 : ℕ) * D.absorbedCount) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < T.length) => by - omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - have hold : - T'.edge - (⟨(↑u : ℕ), - (by - have := (u).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length) = - C.baseEdge u := - Q.base_edge_position u; - id - (fun (hn : (1 : ℕ) ≤ (↑u : ℕ)) => - C.initial_nonfirst_avoids_blocks u hn d - (Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hold))) hdedge) - (D.retained rr)) - hn) - (fun (u : Fin ((2 : ℕ) * D.absorbedCount)) - (hn : (1 : ℕ) ≤ (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ)) (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ), - have hn : - (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - let paired : Fin (D.absorbedCount * (2 : ℕ)) := - Fin.cast (Nat.mul_comm (2 : ℕ) D.absorbedCount) u; - let h : Fin D.absorbedCount := paired.divNat; - let j : Fin (2 : ℕ) := paired.modNat; - have huv : (↑u : ℕ) = (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) := - id - (Decidable.byContradiction - fun (a : ¬(↑u : ℕ) = (2 : ℕ) * ((↑u : ℕ) / (2 : ℕ)) + (↑u : ℕ) % (2 : ℕ)) => by omega); - have hedge : - T'.edge - (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), - (by - have := (h).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length) = - C.blockEdge - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j := - Q.absorbed_edge_position h j; - have hblock : - phi - (C.blockEdge - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j) = - some d := - Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hedge))) - (Eq.mpr - (id - (congrFun' - (congrArg Eq - (congrArg phi - (congrArg T'.edge - (Fin.mk.congr_simp (C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ)) - (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) - (Nat.add_assoc (C.p - (1 : ℕ)) ((2 : ℕ) * (↑h : ℕ)) (↑j : ℕ)) - ((by - have := (h).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - omega)))))) - (some d))) - (Eq.mp - (congrFun' - (congrArg Eq - (congrArg phi - (congrArg T'.edge - (Fin.mk.congr_simp (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) - (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) - (congrArg (HAdd.hAdd (C.p - (1 : ℕ))) huv) - (have hn : - (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)))))) - (some d)) - hdedge)); - have hcolor : - phi - (C.blockEdge - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j) = - some - (C.gamma - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s)) := - C.block_color - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j; - have heq : - d = - C.gamma - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) := - Eq.mp - (Option.some.injEq d - (C.gamma - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s))) - (Eq.symm (Eq.mp (congrArg (fun (_a : Option (Fin k)) => _a = some d) hcolor) hblock)); - fun (hbad : d = C.gamma (D.retained rr)) => - ((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h).property - (Exists.intro rr - (C.gamma_injective - (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) (Eq.symm heq))) - (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) hbad)) - (Eq.refl (C.gamma (D.retained rr)))))))) - n hn d hdedge rr; - core split hq c (id hc) r, - exit_covered := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => - Exists.casesOn - (Equiv.surjective D.exitEquiv - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) - fun (t : Fin D.retainedCount) - (ht : - (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) => - have htv : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := - congrArg Subtype.val ht; - Exists.intro t - (Eq.mpr (id (congrArg (fun (_a : V) => newGamma t ∈ MissingColors G phi _a) (Eq.symm htv))) - (D.retained_missing t)), - no_isolated := C.no_isolated, - globally_maximum := - (⟨C.globally_maximum.left, - (⟨Q.tashkinov, - Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = TashkinovOrder G) Q.vertex_set_eq)) - C.globally_maximum.right.right⟩ : - TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G)⟩ : - KTriple G k e0 phi ∧ - TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G), - exit_card_eq := - Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = newS) Q.exit_set_eq)) - (Eq.symm D.exit_count_eq), - exit_exactly_one := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => - Exists.casesOn - (Equiv.surjective D.exitEquiv - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) - fun (t : Fin D.retainedCount) - (ht : - (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) => - have htv : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := - congrArg Subtype.val ht; - Exists.intro t - (⟨Eq.mpr - (id - (congrArg - (fun (_a : V) => (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi _a) t) - (Eq.symm htv))) - (D.retained_missing t), - fun (t' : Fin newS) (hm : newGamma t' ∈ MissingColors G phi v) => - D.selected_unique t t' - (Eq.mp (congrArg (fun (_a : V) => newGamma t' ∈ MissingColors G phi _a) (Eq.symm htv)) - hm)⟩ : - (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) t ∧ - ∀ (y : Fin newS), (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) y → y = t), - every_block_color_at_exit := fun (t : Fin newS) => - Exists.intro (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) - (⟨Eq.mpr - (id - (congrArg - (fun (_a : Finset V) => - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ _a) - Q.exit_set_eq)) - ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property, - D.retained_missing t⟩ : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ - ScheideExitVertices T' phi ∧ - newGamma t ∈ - MissingColors G phi - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V)) : - ScheideReducedConfiguration G k e0 phi T' }; - ∀ (i : Fin C.s), - (∃! h : Fin D.absorbedCount, - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) h) : - Fin C.s) = - i) → - (∃ (r : Fin assembled.s), - C.gamma i = assembled.gamma r ∧ - ∀ (j : Fin (2 : ℕ)), - C.blockVertex i j = assembled.blockVertex r j ∧ - C.blockEdge i j = assembled.blockEdge r j) ∨ - ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image assembled.y Finset.univ - -private abbrev helperBranch516Conditions.{u_1, u_2} : Prop := - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) - (C : ScheideStructuralConfiguration G k e0 phi T) - (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) - (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), - let newP : ℕ := C.p + (2 : ℕ) * D.absorbedCount; - let newS : ℕ := D.retainedCount; - let newVertex : Fin newP → V := fun (q : Fin newP) => - T'.vertex - (⟨(↑q : ℕ), - have hq : (↑q : ℕ) < newP := q.isLt; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a + (1 : ℕ)) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by omega)⟩ : - Fin (T'.length + (1 : ℕ))); - let newGamma : Fin newS → Fin k := fun (t : Fin newS) => C.gamma (D.retained t); - let newBlockVertex : Fin newS → Fin (2 : ℕ) → V := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - T'.vertex - (⟨C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - have ht : (↑t : ℕ) < newS := t.isLt; - have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a + (1 : ℕ)) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : - ¬C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) => - by omega)⟩ : - Fin (T'.length + (1 : ℕ))); - let newBaseEdge : Fin (newP - (1 : ℕ)) → E := fun (q : Fin (newP - (1 : ℕ))) => - T'.edge - (⟨(↑q : ℕ), - have hq : (↑q : ℕ) < newP - (1 : ℕ) := q.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega)⟩ : - Fin T'.length); - let newBlockEdge : Fin newS → Fin (2 : ℕ) → E := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - T'.edge - (⟨C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - have ht : (↑t : ℕ) < newS := t.isLt; - have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : - ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length) => - by omega)⟩ : - Fin T'.length); - ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ (q : Fin C.p), C.y q = v), - let assembled : ScheideReducedConfiguration G k e0 phi T' := - { - p := newP, s := newS, - p_ge_two := - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - id - (Decidable.byContradiction fun (a : ¬(2 : ℕ) ≤ C.p + (2 : ℕ) * D.absorbedCount) => by omega), - gamma := newGamma, - gamma_injective := fun ⦃a b : Fin newS⦄ (hab : newGamma a = newGamma b) => - D.retained_injective (C.gamma_injective hab), - y := newVertex, baseEdge := newBaseEdge, blockVertex := newBlockVertex, - blockEdge := newBlockEdge, - length_eq := - id - (have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - _a + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : ¬T.length + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) => - by omega)), - base_vertex_position := fun (q : Fin newP) => - Eq.refl - (T'.vertex - (⟨(↑q : ℕ), - (by - have := (q).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin (T'.length + (1 : ℕ)))), - block_vertex_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - Eq.refl - (T'.vertex - (⟨newP + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - (by - have := (t).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin (T'.length + (1 : ℕ)))), - base_edge_position := fun (q : Fin (newP - (1 : ℕ))) => - Eq.refl - (T'.edge - (⟨(↑q : ℕ), - (by - have := (q).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length)), - block_edge_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - id - (congrArg T'.edge - (Fin.ext - (id - (have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - Decidable.byContradiction - fun - (a : - ¬C.p + (2 : ℕ) * D.absorbedCount - (1 : ℕ) + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) = - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ)) => - by omega)))), - block_attaches_to_base := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - have h : - ∃ (q : Fin C.p), - G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j) := - C.block_attaches_to_base (D.retained t) j; - Exists.casesOn h - fun (q : Fin C.p) - (hq : G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j)) => - let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); - Exists.intro qnew - (Eq.mpr - (id - (congrArg (fun (_a : E) => G.ends _a = s(newVertex qnew, newBlockVertex t j)) - (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := - id (Q.retained_edge_position t j); - this))) - (Eq.mpr - (id - (congrArg - (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(_a, newBlockVertex t j)) - (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); - this))) - (Eq.mpr - (id - (congrArg (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(C.y q, _a)) - (have this : newBlockVertex t j = C.blockVertex (D.retained t) j := - id (Q.retained_vertex_position t j); - this))) - hq))), - block_color := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - Eq.mpr - (id - (congrArg (fun (_a : E) => phi _a = some (newGamma t)) - (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := - id (Q.retained_edge_position t j); - this))) - (C.block_color (D.retained t) j), - block_color_missing_on_base := fun (t : Fin newS) => - let v : V := (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V); - have hv : v ∈ ScheideExitVertices T phi := - ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property; - Exists.casesOn (oldExitBase v hv) fun (q : Fin C.p) (hq : C.y q = v) => - let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); - Exists.intro qnew - (Eq.mpr - (id - (congrArg (fun (_a : Fin k) => _a ∈ MissingColors G phi (newVertex qnew)) - (have this : newGamma t = C.gamma (D.retained t) := Eq.refl (newGamma t); - this))) - (Eq.mpr - (id - (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) - (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); - this))) - (Eq.mpr - (id (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) hq)) - (D.retained_missing t)))), - initial_nonfirst_avoids_blocks := - fun (q : Fin (newP - (1 : ℕ))) (hq : (1 : ℕ) ≤ (↑q : ℕ)) (c : Fin k) - (hc : phi (newBaseEdge q) = some c) (r : Fin newS) => - let split : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount) := - (⟨(↑q : ℕ), by omega⟩ : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)); - have core : - ∀ (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), - (1 : ℕ) ≤ (↑n : ℕ) → - ∀ (d : Fin k), - phi - (T'.edge - (⟨(↑n : ℕ), - have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d → - ∀ (r : Fin D.retainedCount), d ≠ C.gamma (D.retained r) := - fun (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) (hn : (1 : ℕ) ≤ (↑n : ℕ)) - (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑n : ℕ), - have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - Fin.addCases (motive := fun (x : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) => - (1 : ℕ) ≤ (↑x : ℕ) → - ∀ (x_2 : Fin k), - phi - (T'.edge - (⟨(↑x : ℕ), - have hn : (↑x : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := x.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑x : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑x : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some x_2 → - ∀ (x : Fin D.retainedCount), x_2 ≠ C.gamma (D.retained x)) - (fun (u : Fin (C.p - (1 : ℕ))) - (hn : (1 : ℕ) ≤ (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ)) (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ), - have hn : - (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.castAdd ((2 : ℕ) * D.absorbedCount) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < T.length) => by - omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - have hold : - T'.edge - (⟨(↑u : ℕ), - (by - have := (u).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length) = - C.baseEdge u := - Q.base_edge_position u; - id - (fun (hn : (1 : ℕ) ≤ (↑u : ℕ)) => - C.initial_nonfirst_avoids_blocks u hn d - (Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hold))) hdedge) - (D.retained rr)) - hn) - (fun (u : Fin ((2 : ℕ) * D.absorbedCount)) - (hn : (1 : ℕ) ≤ (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ)) (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ), - have hn : - (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - let paired : Fin (D.absorbedCount * (2 : ℕ)) := - Fin.cast (Nat.mul_comm (2 : ℕ) D.absorbedCount) u; - let h : Fin D.absorbedCount := paired.divNat; - let j : Fin (2 : ℕ) := paired.modNat; - have huv : (↑u : ℕ) = (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) := - id - (Decidable.byContradiction - fun (a : ¬(↑u : ℕ) = (2 : ℕ) * ((↑u : ℕ) / (2 : ℕ)) + (↑u : ℕ) % (2 : ℕ)) => by omega); - have hedge : - T'.edge - (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), - (by - have := (h).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length) = - C.blockEdge - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j := - Q.absorbed_edge_position h j; - have hblock : - phi - (C.blockEdge - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j) = - some d := - Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hedge))) - (Eq.mpr - (id - (congrFun' - (congrArg Eq - (congrArg phi - (congrArg T'.edge - (Fin.mk.congr_simp (C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ)) - (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) - (Nat.add_assoc (C.p - (1 : ℕ)) ((2 : ℕ) * (↑h : ℕ)) (↑j : ℕ)) - ((by - have := (h).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - omega)))))) - (some d))) - (Eq.mp - (congrFun' - (congrArg Eq - (congrArg phi - (congrArg T'.edge - (Fin.mk.congr_simp (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) - (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) - (congrArg (HAdd.hAdd (C.p - (1 : ℕ))) huv) - (have hn : - (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)))))) - (some d)) - hdedge)); - have hcolor : - phi - (C.blockEdge - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j) = - some - (C.gamma - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s)) := - C.block_color - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j; - have heq : - d = - C.gamma - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) := - Eq.mp - (Option.some.injEq d - (C.gamma - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s))) - (Eq.symm (Eq.mp (congrArg (fun (_a : Option (Fin k)) => _a = some d) hcolor) hblock)); - fun (hbad : d = C.gamma (D.retained rr)) => - ((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h).property - (Exists.intro rr - (C.gamma_injective - (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) (Eq.symm heq))) - (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) hbad)) - (Eq.refl (C.gamma (D.retained rr)))))))) - n hn d hdedge rr; - core split hq c (id hc) r, - exit_covered := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => - Exists.casesOn - (Equiv.surjective D.exitEquiv - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) - fun (t : Fin D.retainedCount) - (ht : - (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) => - have htv : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := - congrArg Subtype.val ht; - Exists.intro t - (Eq.mpr (id (congrArg (fun (_a : V) => newGamma t ∈ MissingColors G phi _a) (Eq.symm htv))) - (D.retained_missing t)), - no_isolated := C.no_isolated, - globally_maximum := - (⟨C.globally_maximum.left, - (⟨Q.tashkinov, - Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = TashkinovOrder G) Q.vertex_set_eq)) - C.globally_maximum.right.right⟩ : - TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G)⟩ : - KTriple G k e0 phi ∧ - TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G), - exit_card_eq := - Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = newS) Q.exit_set_eq)) - (Eq.symm D.exit_count_eq), - exit_exactly_one := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => - Exists.casesOn - (Equiv.surjective D.exitEquiv - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) - fun (t : Fin D.retainedCount) - (ht : - (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) => - have htv : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := - congrArg Subtype.val ht; - Exists.intro t - (⟨Eq.mpr - (id - (congrArg - (fun (_a : V) => (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi _a) t) - (Eq.symm htv))) - (D.retained_missing t), - fun (t' : Fin newS) (hm : newGamma t' ∈ MissingColors G phi v) => - D.selected_unique t t' - (Eq.mp (congrArg (fun (_a : V) => newGamma t' ∈ MissingColors G phi _a) (Eq.symm htv)) - hm)⟩ : - (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) t ∧ - ∀ (y : Fin newS), (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) y → y = t), - every_block_color_at_exit := fun (t : Fin newS) => - Exists.intro (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) - (⟨Eq.mpr - (id - (congrArg - (fun (_a : Finset V) => - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ _a) - Q.exit_set_eq)) - ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property, - D.retained_missing t⟩ : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ - ScheideExitVertices T' phi ∧ - newGamma t ∈ - MissingColors G phi - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V)) : - ScheideReducedConfiguration G k e0 phi T' }; - ∀ (i : Fin C.s), - (∃! t : Fin D.retainedCount, D.retained t = i) → - (∃ (r : Fin assembled.s), - C.gamma i = assembled.gamma r ∧ - ∀ (j : Fin (2 : ℕ)), - C.blockVertex i j = assembled.blockVertex r j ∧ - C.blockEdge i j = assembled.blockEdge r j) ∨ - ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image assembled.y Finset.univ - -private abbrev helperBranch513Conditions.{u_1, u_2} : Prop := - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) - (C : ScheideStructuralConfiguration G k e0 phi T) - (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) - (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), - let newP : ℕ := C.p + (2 : ℕ) * D.absorbedCount; - let newS : ℕ := D.retainedCount; - let newVertex : Fin newP → V := fun (q : Fin newP) => - T'.vertex - (⟨(↑q : ℕ), - have hq : (↑q : ℕ) < newP := q.isLt; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a + (1 : ℕ)) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by omega)⟩ : - Fin (T'.length + (1 : ℕ))); - let newGamma : Fin newS → Fin k := fun (t : Fin newS) => C.gamma (D.retained t); - let newBlockVertex : Fin newS → Fin (2 : ℕ) → V := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - T'.vertex - (⟨C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - have ht : (↑t : ℕ) < newS := t.isLt; - have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a + (1 : ℕ)) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : - ¬C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) => - by omega)⟩ : - Fin (T'.length + (1 : ℕ))); - let newBaseEdge : Fin (newP - (1 : ℕ)) → E := fun (q : Fin (newP - (1 : ℕ))) => - T'.edge - (⟨(↑q : ℕ), - have hq : (↑q : ℕ) < newP - (1 : ℕ) := q.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega)⟩ : - Fin T'.length); - let newBlockEdge : Fin newS → Fin (2 : ℕ) → E := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - T'.edge - (⟨C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - have ht : (↑t : ℕ) < newS := t.isLt; - have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : - ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length) => - by omega)⟩ : - Fin T'.length); - ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ (q : Fin C.p), C.y q = v), - let assembled : ScheideReducedConfiguration G k e0 phi T' := - { - p := newP, s := newS, - p_ge_two := - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - id - (Decidable.byContradiction fun (a : ¬(2 : ℕ) ≤ C.p + (2 : ℕ) * D.absorbedCount) => by omega), - gamma := newGamma, - gamma_injective := fun ⦃a b : Fin newS⦄ (hab : newGamma a = newGamma b) => - D.retained_injective (C.gamma_injective hab), - y := newVertex, baseEdge := newBaseEdge, blockVertex := newBlockVertex, - blockEdge := newBlockEdge, - length_eq := - id - (have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - _a + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : ¬T.length + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) => - by omega)), - base_vertex_position := fun (q : Fin newP) => - Eq.refl - (T'.vertex - (⟨(↑q : ℕ), - (by - have := (q).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin (T'.length + (1 : ℕ)))), - block_vertex_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - Eq.refl - (T'.vertex - (⟨newP + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - (by - have := (t).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin (T'.length + (1 : ℕ)))), - base_edge_position := fun (q : Fin (newP - (1 : ℕ))) => - Eq.refl - (T'.edge - (⟨(↑q : ℕ), - (by - have := (q).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length)), - block_edge_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - id - (congrArg T'.edge - (Fin.ext - (id - (have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - Decidable.byContradiction - fun - (a : - ¬C.p + (2 : ℕ) * D.absorbedCount - (1 : ℕ) + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) = - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ)) => - by omega)))), - block_attaches_to_base := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - have h : - ∃ (q : Fin C.p), - G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j) := - C.block_attaches_to_base (D.retained t) j; - Exists.casesOn h - fun (q : Fin C.p) - (hq : G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j)) => - let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); - Exists.intro qnew - (Eq.mpr - (id - (congrArg (fun (_a : E) => G.ends _a = s(newVertex qnew, newBlockVertex t j)) - (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := - id (Q.retained_edge_position t j); - this))) - (Eq.mpr - (id - (congrArg - (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(_a, newBlockVertex t j)) - (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); - this))) - (Eq.mpr - (id - (congrArg (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(C.y q, _a)) - (have this : newBlockVertex t j = C.blockVertex (D.retained t) j := - id (Q.retained_vertex_position t j); - this))) - hq))), - block_color := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - Eq.mpr - (id - (congrArg (fun (_a : E) => phi _a = some (newGamma t)) - (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := - id (Q.retained_edge_position t j); - this))) - (C.block_color (D.retained t) j), - block_color_missing_on_base := fun (t : Fin newS) => - let v : V := (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V); - have hv : v ∈ ScheideExitVertices T phi := - ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property; - Exists.casesOn (oldExitBase v hv) fun (q : Fin C.p) (hq : C.y q = v) => - let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); - Exists.intro qnew - (Eq.mpr - (id - (congrArg (fun (_a : Fin k) => _a ∈ MissingColors G phi (newVertex qnew)) - (have this : newGamma t = C.gamma (D.retained t) := Eq.refl (newGamma t); - this))) - (Eq.mpr - (id - (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) - (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); - this))) - (Eq.mpr - (id (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) hq)) - (D.retained_missing t)))), - initial_nonfirst_avoids_blocks := - fun (q : Fin (newP - (1 : ℕ))) (hq : (1 : ℕ) ≤ (↑q : ℕ)) (c : Fin k) - (hc : phi (newBaseEdge q) = some c) (r : Fin newS) => - let split : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount) := - (⟨(↑q : ℕ), by omega⟩ : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)); - have core : - ∀ (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), - (1 : ℕ) ≤ (↑n : ℕ) → - ∀ (d : Fin k), - phi - (T'.edge - (⟨(↑n : ℕ), - have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d → - ∀ (r : Fin D.retainedCount), d ≠ C.gamma (D.retained r) := - fun (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) (hn : (1 : ℕ) ≤ (↑n : ℕ)) - (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑n : ℕ), - have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - Fin.addCases (motive := fun (x : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) => - (1 : ℕ) ≤ (↑x : ℕ) → - ∀ (x_2 : Fin k), - phi - (T'.edge - (⟨(↑x : ℕ), - have hn : (↑x : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := x.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑x : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑x : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some x_2 → - ∀ (x : Fin D.retainedCount), x_2 ≠ C.gamma (D.retained x)) - (fun (u : Fin (C.p - (1 : ℕ))) - (hn : (1 : ℕ) ≤ (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ)) (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ), - have hn : - (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.castAdd ((2 : ℕ) * D.absorbedCount) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < T.length) => by - omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - have hold : - T'.edge - (⟨(↑u : ℕ), - (by - have := (u).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length) = - C.baseEdge u := - Q.base_edge_position u; - id - (fun (hn : (1 : ℕ) ≤ (↑u : ℕ)) => - C.initial_nonfirst_avoids_blocks u hn d - (Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hold))) hdedge) - (D.retained rr)) - hn) - (fun (u : Fin ((2 : ℕ) * D.absorbedCount)) - (hn : (1 : ℕ) ≤ (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ)) (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ), - have hn : - (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - let paired : Fin (D.absorbedCount * (2 : ℕ)) := - Fin.cast (Nat.mul_comm (2 : ℕ) D.absorbedCount) u; - let h : Fin D.absorbedCount := paired.divNat; - let j : Fin (2 : ℕ) := paired.modNat; - have huv : (↑u : ℕ) = (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) := - id - (Decidable.byContradiction - fun (a : ¬(↑u : ℕ) = (2 : ℕ) * ((↑u : ℕ) / (2 : ℕ)) + (↑u : ℕ) % (2 : ℕ)) => by omega); - have hedge : - T'.edge - (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), - (by - have := (h).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length) = - C.blockEdge - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j := - Q.absorbed_edge_position h j; - have hblock : - phi - (C.blockEdge - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j) = - some d := - Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hedge))) - (Eq.mpr - (id - (congrFun' - (congrArg Eq - (congrArg phi - (congrArg T'.edge - (Fin.mk.congr_simp (C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ)) - (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) - (Nat.add_assoc (C.p - (1 : ℕ)) ((2 : ℕ) * (↑h : ℕ)) (↑j : ℕ)) - ((by - have := (h).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - omega)))))) - (some d))) - (Eq.mp - (congrFun' - (congrArg Eq - (congrArg phi - (congrArg T'.edge - (Fin.mk.congr_simp (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) - (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) - (congrArg (HAdd.hAdd (C.p - (1 : ℕ))) huv) - (have hn : - (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)))))) - (some d)) - hdedge)); - have hcolor : - phi - (C.blockEdge - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j) = - some - (C.gamma - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s)) := - C.block_color - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j; - have heq : - d = - C.gamma - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) := - Eq.mp - (Option.some.injEq d - (C.gamma - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s))) - (Eq.symm (Eq.mp (congrArg (fun (_a : Option (Fin k)) => _a = some d) hcolor) hblock)); - fun (hbad : d = C.gamma (D.retained rr)) => - ((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h).property - (Exists.intro rr - (C.gamma_injective - (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) (Eq.symm heq))) - (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) hbad)) - (Eq.refl (C.gamma (D.retained rr)))))))) - n hn d hdedge rr; - core split hq c (id hc) r, - exit_covered := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => - Exists.casesOn - (Equiv.surjective D.exitEquiv - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) - fun (t : Fin D.retainedCount) - (ht : - (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) => - have htv : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := - congrArg Subtype.val ht; - Exists.intro t - (Eq.mpr (id (congrArg (fun (_a : V) => newGamma t ∈ MissingColors G phi _a) (Eq.symm htv))) - (D.retained_missing t)), - no_isolated := C.no_isolated, - globally_maximum := - (⟨C.globally_maximum.left, - (⟨Q.tashkinov, - Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = TashkinovOrder G) Q.vertex_set_eq)) - C.globally_maximum.right.right⟩ : - TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G)⟩ : - KTriple G k e0 phi ∧ - TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G), - exit_card_eq := - Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = newS) Q.exit_set_eq)) - (Eq.symm D.exit_count_eq), - exit_exactly_one := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => - Exists.casesOn - (Equiv.surjective D.exitEquiv - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) - fun (t : Fin D.retainedCount) - (ht : - (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) => - have htv : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := - congrArg Subtype.val ht; - Exists.intro t - (⟨Eq.mpr - (id - (congrArg - (fun (_a : V) => (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi _a) t) - (Eq.symm htv))) - (D.retained_missing t), - fun (t' : Fin newS) (hm : newGamma t' ∈ MissingColors G phi v) => - D.selected_unique t t' - (Eq.mp (congrArg (fun (_a : V) => newGamma t' ∈ MissingColors G phi _a) (Eq.symm htv)) - hm)⟩ : - (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) t ∧ - ∀ (y : Fin newS), (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) y → y = t), - every_block_color_at_exit := fun (t : Fin newS) => - Exists.intro (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) - (⟨Eq.mpr - (id - (congrArg - (fun (_a : Finset V) => - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ _a) - Q.exit_set_eq)) - ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property, - D.retained_missing t⟩ : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ - ScheideExitVertices T' phi ∧ - newGamma t ∈ - MissingColors G phi - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V)) : - ScheideReducedConfiguration G k e0 phi T' }; - ∀ (i : Fin C.s), - (∃ (r : Fin assembled.s), - C.gamma i = assembled.gamma r ∧ - ∀ (j : Fin (2 : ℕ)), - C.blockVertex i j = assembled.blockVertex r j ∧ C.blockEdge i j = assembled.blockEdge r j) ∨ - ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image assembled.y Finset.univ - -private abbrev helperContinuation263Conditions.{u_1, u_2} : Prop := - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) - (C : ScheideStructuralConfiguration G k e0 phi T) - (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) - (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), - let newP : ℕ := C.p + (2 : ℕ) * D.absorbedCount; - let newS : ℕ := D.retainedCount; - let newVertex : Fin newP → V := fun (q : Fin newP) => - T'.vertex - (⟨(↑q : ℕ), - have hq : (↑q : ℕ) < newP := q.isLt; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a + (1 : ℕ)) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by omega)⟩ : - Fin (T'.length + (1 : ℕ))); - let newGamma : Fin newS → Fin k := fun (t : Fin newS) => C.gamma (D.retained t); - let newBlockVertex : Fin newS → Fin (2 : ℕ) → V := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - T'.vertex - (⟨C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - have ht : (↑t : ℕ) < newS := t.isLt; - have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a + (1 : ℕ)) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : - ¬C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length + (1 : ℕ)) => - by omega)⟩ : - Fin (T'.length + (1 : ℕ))); - let newBaseEdge : Fin (newP - (1 : ℕ)) → E := fun (q : Fin (newP - (1 : ℕ))) => - T'.edge - (⟨(↑q : ℕ), - have hq : (↑q : ℕ) < newP - (1 : ℕ) := q.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑q : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega)⟩ : - Fin T'.length); - let newBlockEdge : Fin newS → Fin (2 : ℕ) → E := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - T'.edge - (⟨C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - have ht : (↑t : ℕ) < newS := t.isLt; - have hj : (↑j : ℕ) < (2 : ℕ) := j.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : - ¬C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) < T.length) => - by omega)⟩ : - Fin T'.length); - ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ (q : Fin C.p), C.y q = v), - let assembled : ScheideReducedConfiguration G k e0 phi T' := - { - p := newP, s := newS, - p_ge_two := - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - id - (Decidable.byContradiction fun (a : ¬(2 : ℕ) ≤ C.p + (2 : ℕ) * D.absorbedCount) => by omega), - gamma := newGamma, - gamma_injective := fun ⦃a b : Fin newS⦄ (hab : newGamma a = newGamma b) => - D.retained_injective (C.gamma_injective hab), - y := newVertex, baseEdge := newBaseEdge, blockVertex := newBlockVertex, - blockEdge := newBlockEdge, - length_eq := - id - (have hc : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => - _a + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) - Q.length_eq)) - (Decidable.byContradiction - fun - (a : ¬T.length + (1 : ℕ) = C.p + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * D.retainedCount) => - by omega)), - base_vertex_position := fun (q : Fin newP) => - Eq.refl - (T'.vertex - (⟨(↑q : ℕ), - (by - have := (q).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin (T'.length + (1 : ℕ)))), - block_vertex_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - Eq.refl - (T'.vertex - (⟨newP + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ), - (by - have := (t).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin (T'.length + (1 : ℕ)))), - base_edge_position := fun (q : Fin (newP - (1 : ℕ))) => - Eq.refl - (T'.edge - (⟨(↑q : ℕ), - (by - have := (q).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length)), - block_edge_position := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - id - (congrArg T'.edge - (Fin.ext - (id - (have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - Decidable.byContradiction - fun - (a : - ¬C.p + (2 : ℕ) * D.absorbedCount - (1 : ℕ) + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ) = - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount + (2 : ℕ) * (↑t : ℕ) + (↑j : ℕ)) => - by omega)))), - block_attaches_to_base := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - have h : - ∃ (q : Fin C.p), - G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j) := - C.block_attaches_to_base (D.retained t) j; - Exists.casesOn h - fun (q : Fin C.p) - (hq : G.ends (C.blockEdge (D.retained t) j) = s(C.y q, C.blockVertex (D.retained t) j)) => - let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); - Exists.intro qnew - (Eq.mpr - (id - (congrArg (fun (_a : E) => G.ends _a = s(newVertex qnew, newBlockVertex t j)) - (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := - id (Q.retained_edge_position t j); - this))) - (Eq.mpr - (id - (congrArg - (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(_a, newBlockVertex t j)) - (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); - this))) - (Eq.mpr - (id - (congrArg (fun (_a : V) => G.ends (C.blockEdge (D.retained t) j) = s(C.y q, _a)) - (have this : newBlockVertex t j = C.blockVertex (D.retained t) j := - id (Q.retained_vertex_position t j); - this))) - hq))), - block_color := fun (t : Fin newS) (j : Fin (2 : ℕ)) => - Eq.mpr - (id - (congrArg (fun (_a : E) => phi _a = some (newGamma t)) - (have this : newBlockEdge t j = C.blockEdge (D.retained t) j := - id (Q.retained_edge_position t j); - this))) - (C.block_color (D.retained t) j), - block_color_missing_on_base := fun (t : Fin newS) => - let v : V := (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V); - have hv : v ∈ ScheideExitVertices T phi := - ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property; - Exists.casesOn (oldExitBase v hv) fun (q : Fin C.p) (hq : C.y q = v) => - let qnew : Fin newP := (⟨(↑q : ℕ), by omega⟩ : Fin newP); - Exists.intro qnew - (Eq.mpr - (id - (congrArg (fun (_a : Fin k) => _a ∈ MissingColors G phi (newVertex qnew)) - (have this : newGamma t = C.gamma (D.retained t) := Eq.refl (newGamma t); - this))) - (Eq.mpr - (id - (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) - (have this : newVertex qnew = C.y q := id (Q.base_vertex_position q); - this))) - (Eq.mpr - (id (congrArg (fun (_a : V) => C.gamma (D.retained t) ∈ MissingColors G phi _a) hq)) - (D.retained_missing t)))), - initial_nonfirst_avoids_blocks := - fun (q : Fin (newP - (1 : ℕ))) (hq : (1 : ℕ) ≤ (↑q : ℕ)) (c : Fin k) - (hc : phi (newBaseEdge q) = some c) (r : Fin newS) => - let split : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount) := - (⟨(↑q : ℕ), by omega⟩ : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)); - have core : - ∀ (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), - (1 : ℕ) ≤ (↑n : ℕ) → - ∀ (d : Fin k), - phi - (T'.edge - (⟨(↑n : ℕ), - have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d → - ∀ (r : Fin D.retainedCount), d ≠ C.gamma (D.retained r) := - fun (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) (hn : (1 : ℕ) ≤ (↑n : ℕ)) - (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑n : ℕ), - have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - Fin.addCases (motive := fun (x : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)) => - (1 : ℕ) ≤ (↑x : ℕ) → - ∀ (x_2 : Fin k), - phi - (T'.edge - (⟨(↑x : ℕ), - have hn : (↑x : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := x.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑x : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑x : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some x_2 → - ∀ (x : Fin D.retainedCount), x_2 ≠ C.gamma (D.retained x)) - (fun (u : Fin (C.p - (1 : ℕ))) - (hn : (1 : ℕ) ≤ (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ)) (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ), - have hn : - (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.castAdd ((2 : ℕ) * D.absorbedCount) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg - (fun (_a : ℕ) => (↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.castAdd ((2 : ℕ) * D.absorbedCount) u) : ℕ) < T.length) => by - omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - have hold : - T'.edge - (⟨(↑u : ℕ), - (by - have := (u).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length) = - C.baseEdge u := - Q.base_edge_position u; - id - (fun (hn : (1 : ℕ) ≤ (↑u : ℕ)) => - C.initial_nonfirst_avoids_blocks u hn d - (Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hold))) hdedge) - (D.retained rr)) - hn) - (fun (u : Fin ((2 : ℕ) * D.absorbedCount)) - (hn : (1 : ℕ) ≤ (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ)) (d : Fin k) - (hdedge : - phi - (T'.edge - (⟨(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ), - have hn : - (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d) - (rr : Fin D.retainedCount) => - let paired : Fin (D.absorbedCount * (2 : ℕ)) := - Fin.cast (Nat.mul_comm (2 : ℕ) D.absorbedCount) u; - let h : Fin D.absorbedCount := paired.divNat; - let j : Fin (2 : ℕ) := paired.modNat; - have huv : (↑u : ℕ) = (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ) := - id - (Decidable.byContradiction - fun (a : ¬(↑u : ℕ) = (2 : ℕ) * ((↑u : ℕ) / (2 : ℕ)) + (↑u : ℕ) % (2 : ℕ)) => by omega); - have hedge : - T'.edge - (⟨C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ), - (by - have := (h).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - dsimp only [newP, newS] at * - omega)⟩ : - Fin T'.length) = - C.blockEdge - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j := - Q.absorbed_edge_position h j; - have hblock : - phi - (C.blockEdge - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j) = - some d := - Eq.mpr (id (congrArg (fun (_a : E) => phi _a = some d) (Eq.symm hedge))) - (Eq.mpr - (id - (congrFun' - (congrArg Eq - (congrArg phi - (congrArg T'.edge - (Fin.mk.congr_simp (C.p - (1 : ℕ) + (2 : ℕ) * (↑h : ℕ) + (↑j : ℕ)) - (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) - (Nat.add_assoc (C.p - (1 : ℕ)) ((2 : ℕ) * (↑h : ℕ)) (↑j : ℕ)) - ((by - have := (h).isLt - have := (j).isLt - have := C.length_eq - have := D.count_eq - have := Q.length_eq - have := C.p_ge_two - omega)))))) - (some d))) - (Eq.mp - (congrFun' - (congrArg Eq - (congrArg phi - (congrArg T'.edge - (Fin.mk.congr_simp (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) - (C.p - (1 : ℕ) + ((2 : ℕ) * (↑h : ℕ) + (↑j : ℕ))) - (congrArg (HAdd.hAdd (C.p - (1 : ℕ))) huv) - (have hn : - (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < - C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := - (Fin.natAdd (C.p - (1 : ℕ)) u).isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr - (id - (congrArg (fun (_a : ℕ) => (↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < _a) - Q.length_eq)) - (Decidable.byContradiction - fun (a : ¬(↑(Fin.natAdd (C.p - (1 : ℕ)) u) : ℕ) < T.length) => by omega)))))) - (some d)) - hdedge)); - have hcolor : - phi - (C.blockEdge - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j) = - some - (C.gamma - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s)) := - C.block_color - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) - j; - have heq : - d = - C.gamma - (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s) := - Eq.mp - (Option.some.injEq d - (C.gamma - (↑((D.absorbedEquiv : - Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h) : - Fin C.s))) - (Eq.symm (Eq.mp (congrArg (fun (_a : Option (Fin k)) => _a = some d) hcolor) hblock)); - fun (hbad : d = C.gamma (D.retained rr)) => - ((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) - h).property - (Exists.intro rr - (C.gamma_injective - (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) (Eq.symm heq))) - (Eq.mpr (id (congrArg (fun (_a : Fin k) => C.gamma (D.retained rr) = _a) hbad)) - (Eq.refl (C.gamma (D.retained rr)))))))) - n hn d hdedge rr; - core split hq c (id hc) r, - exit_covered := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => - Exists.casesOn - (Equiv.surjective D.exitEquiv - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) - fun (t : Fin D.retainedCount) - (ht : - (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) => - have htv : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := - congrArg Subtype.val ht; - Exists.intro t - (Eq.mpr (id (congrArg (fun (_a : V) => newGamma t ∈ MissingColors G phi _a) (Eq.symm htv))) - (D.retained_missing t)), - no_isolated := C.no_isolated, - globally_maximum := - (⟨C.globally_maximum.left, - (⟨Q.tashkinov, - Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = TashkinovOrder G) Q.vertex_set_eq)) - C.globally_maximum.right.right⟩ : - TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G)⟩ : - KTriple G k e0 phi ∧ - TashkinovTree G e0 phi T' ∧ (TreeSequenceVertexSet T').card = TashkinovOrder G), - exit_card_eq := - Eq.mpr (id (congrArg (fun (_a : Finset V) => _a.card = newS) Q.exit_set_eq)) - (Eq.symm D.exit_count_eq), - exit_exactly_one := fun (v : V) (hv : v ∈ ScheideExitVertices T' phi) => - Exists.casesOn - (Equiv.surjective D.exitEquiv - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) - fun (t : Fin D.retainedCount) - (ht : - (D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t = - (⟨v, Eq.mp (congrArg (fun (_a : Finset V) => v ∈ _a) Q.exit_set_eq) hv⟩ : - ↥(ScheideExitVertices T phi))) => - have htv : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) = v := - congrArg Subtype.val ht; - Exists.intro t - (⟨Eq.mpr - (id - (congrArg - (fun (_a : V) => (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi _a) t) - (Eq.symm htv))) - (D.retained_missing t), - fun (t' : Fin newS) (hm : newGamma t' ∈ MissingColors G phi v) => - D.selected_unique t t' - (Eq.mp (congrArg (fun (_a : V) => newGamma t' ∈ MissingColors G phi _a) (Eq.symm htv)) - hm)⟩ : - (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) t ∧ - ∀ (y : Fin newS), (fun (i : Fin newS) => newGamma i ∈ MissingColors G phi v) y → y = t), - every_block_color_at_exit := fun (t : Fin newS) => - Exists.intro (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) - (⟨Eq.mpr - (id - (congrArg - (fun (_a : Finset V) => - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ _a) - Q.exit_set_eq)) - ((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t).property, - D.retained_missing t⟩ : - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V) ∈ - ScheideExitVertices T' phi ∧ - newGamma t ∈ - MissingColors G phi - (↑((D.exitEquiv : Fin D.retainedCount → ↥(ScheideExitVertices T phi)) t) : V)) : - ScheideReducedConfiguration G k e0 phi T' }; - ∃ (R : ScheideReducedConfiguration G k e0 phi T'), - TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ - (∀ (q : Fin C.p), C.y q ∈ Finset.image R.y Finset.univ) ∧ - ∀ (i : Fin C.s), - (∃ (r : Fin R.s), - C.gamma i = R.gamma r ∧ - ∀ (j : Fin (2 : ℕ)), - C.blockVertex i j = R.blockVertex r j ∧ C.blockEdge i j = R.blockEdge r j) ∨ - ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image R.y Finset.univ - -private theorem helper_branch_504.{u_1, u_2} : - helperBranch504Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 phi T C D T' Q newP newS newVertex newGamma newBlockVertex newBaseEdge - newBlockEdge oldExitBase assembled i ha - obtain ⟨h, hi, _⟩ := ha - right - intro j - simp only [Finset.mem_image, Finset.mem_univ, true_and] - refine ⟨⟨C.p + 2 * h.val + j.val, ?_⟩, ?_⟩ - · change C.p + 2 * h.val + j.val < C.p + 2 * D.absorbedCount - have hh := h.isLt - have hj := j.isLt - omega - · dsimp [assembled, newVertex] - rw [Q.absorbed_vertex_position h j] - rw [hi] - -private theorem helper_branch_516.{u_1, u_2} : - helperBranch516Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 phi T C D T' Q newP newS newVertex newGamma newBlockVertex newBaseEdge - newBlockEdge oldExitBase assembled i hr - obtain ⟨t, ht, _⟩ := hr - left - refine ⟨t, ?_, ?_⟩ - · dsimp [assembled, newGamma] - rw [ht] - · intro j - constructor - · dsimp [assembled, newBlockVertex] - rw [← ht] - exact (Q.retained_vertex_position t j).symm - · dsimp [assembled, newBlockEdge] - rw [← ht] - exact (Q.retained_edge_position t j).symm - -private theorem helper_branch_513.{u_1, u_2} : - helperBranch513Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 phi T C D T' Q newP newS newVertex newGamma newBlockVertex newBaseEdge - newBlockEdge oldExitBase assembled i - rcases D.partition i with ha | hr - · exact @helper_branch_504 V E inferInstance inferInstance inferInstance inferInstance G k e0 - phi T C D T' Q oldExitBase i ha - · exact @helper_branch_516 V E inferInstance inferInstance inferInstance inferInstance G k e0 - phi T C D T' Q oldExitBase i hr -private theorem helper_continuation_263.{u_1, u_2} : - helperContinuation263Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 phi T C D T' Q newP newS newVertex newGamma newBlockVertex newBaseEdge - newBlockEdge oldExitBase assembled - refine ⟨assembled, Q.vertex_set_eq, ?_, ?_⟩ - · intro q - simp only [Finset.mem_image, Finset.mem_univ, true_and] - refine ⟨⟨q.val, ?_⟩, ?_⟩ - · have hq := q.isLt - change q.val < C.p + 2 * D.absorbedCount - omega - · dsimp [assembled, newVertex] - exact Q.base_vertex_position q - · exact @helper_branch_513 V E inferInstance inferInstance inferInstance inferInstance G k e0 - phi T C D T' Q oldExitBase -private theorem helper_oldExitBase_593.{u_1, u_2} : - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) - (C : ScheideStructuralConfiguration G k e0 phi T), - ∀ v ∈ ScheideExitVertices T phi, - ∃ (q : Fin C.p), - C.y q = v := by - classical - intro V E _ _ _ G k e0 phi T C v hv - have hstructure := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum - have helementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := - hstructure.2.2.2.1 - have hvertex : v ∈ TreeSequenceVertexSet T := by - let : DecidablePred (fun w : V => ScheideExitVertex T phi w) := Classical.decPred _ - rcases (Finset.mem_filter.mp hv).2 with ⟨u, color, defect, hu, hmiss, hdefect, - z, path, hpath, index, hindex, hvertex, hafter⟩ - exact hvertex - have baseInTree : ∀ q : Fin C.p, C.y q ∈ TreeSequenceVertexSet T := by - intro q - have hlength := C.length_eq - have witness := - (@Finset.mem_image (Fin (T.length + 1)) V (Classical.decEq V)).mpr - (⟨⟨q.val, by omega⟩, Finset.mem_univ _, C.base_vertex_position q⟩ : - ∃ a ∈ (Finset.univ : Finset (Fin (T.length + 1))), T.vertex a = C.y q) - simpa only [TreeSequenceVertexSet] using witness - obtain ⟨colorIndex, hcolor⟩ := C.exit_covered v hv - obtain ⟨base, hbase⟩ := C.block_color_missing_on_base colorIndex - have hne : v = C.y base := by - by_contra hne - have hdisjoint := helementary hvertex (baseInTree base) hne - exact (Finset.disjoint_left.mp hdisjoint) hcolor hbase - exact ⟨base, hne.symm⟩ - -private theorem helper_core_699.{u_1, u_2} : - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) - (C : ScheideStructuralConfiguration G k e0 phi T) - (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) - (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), - let newP : ℕ := C.p + (2 : ℕ) * D.absorbedCount; - ∀ (_ : Fin (newP - (1 : ℕ))) (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), - (1 : ℕ) ≤ (↑n : ℕ) → - ∀ (d : Fin k), - phi - (T'.edge - (⟨(↑n : ℕ), - have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; - have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; - have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; - have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; - Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) - (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : - Fin T'.length)) = - some d → - ∀ (r : Fin D.retainedCount), - d ≠ C.gamma (D.retained r) := by - classical - intro V E _ _ _ _ G k e0 phi T C D T' Q newP q n hn d hdedge rr - refine Fin.addCases ?_ ?_ n hn d hdedge rr - · intro u hn d hdedge rr - have hold := Q.base_edge_position u - change 1 ≤ u.val at hn - apply C.initial_nonfirst_avoids_blocks u hn d (by - rw [← hold] - exact hdedge) (D.retained rr) - · intro u hn d hdedge rr - let paired : Fin (D.absorbedCount * 2) := - Fin.cast (Nat.mul_comm 2 D.absorbedCount) u - let h := paired.divNat - let j := paired.modNat - have huv : u.val = 2 * h.val + j.val := by - dsimp [h, j, paired, Fin.divNat, Fin.modNat] - omega - have hedge := Q.absorbed_edge_position h j - have hblock : phi (C.blockEdge (D.absorbedEquiv h).1 j) = some d := by - rw [← hedge] - simpa [huv, Nat.add_assoc] using hdedge - have hcolor := C.block_color (D.absorbedEquiv h).1 j - have heq : d = C.gamma (D.absorbedEquiv h).1 := by - rw [hcolor] at hblock - simpa using hblock.symm - intro hbad - apply (D.absorbedEquiv h).2 - refine ⟨rr, ?_⟩ - apply C.gamma_injective - rw [← heq, hbad] - -theorem ScheideStructuralReducedAssembly {V E : Type*} +private noncomputable def assembledConfiguration {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) (C : ScheideStructuralConfiguration G k e0 phi T) (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) - (Q : ScheideStructuralReorderingData G k e0 phi T C D T') : - ∃ R : ScheideReducedConfiguration G k e0 phi T', - TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ - (∀ q : Fin C.p, C.y q ∈ Finset.univ.image R.y) ∧ - (∀ i : Fin C.s, - (∃ r : Fin R.s, - C.gamma i = R.gamma r ∧ - ∀ j : Fin 2, - C.blockVertex i j = R.blockVertex r j ∧ - C.blockEdge i j = R.blockEdge r j) ∨ - ∀ j : Fin 2, C.blockVertex i j ∈ Finset.univ.image R.y) := by + (Q : ScheideStructuralReorderingData G k e0 phi T C D T') + (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ q : Fin C.p, C.y q = v) : + ScheideReducedConfiguration G k e0 phi T' := by + classical let newP := C.p + 2 * D.absorbedCount let newS := D.retainedCount let newVertex : Fin newP → V := fun q => @@ -2312,8 +67,6 @@ theorem ScheideStructuralReducedAssembly {V E : Type*} have hd := D.count_eq rw [Q.length_eq] omega⟩ - have oldExitBase := @helper_oldExitBase_593 V E inferInstance inferInstance inferInstance G k e0 - phi T C let assembled : ScheideReducedConfiguration G k e0 phi T' := { p := newP, s := newS, @@ -2394,8 +147,9 @@ theorem ScheideStructuralReducedAssembly {V E : Type*} let split : Fin ((C.p - 1) + 2 * D.absorbedCount) := ⟨q.val, by dsimp [newP] at q ⊢ omega⟩ - have core := @helper_core_699 V E inferInstance inferInstance inferInstance inferInstance G k - e0 phi T C D T' Q q + have core := @ScheideStructuralReorderingData.initialNonfirstAvoidsRetainedColor V E + inferInstance inferInstance inferInstance inferInstance G k + e0 phi T C D T' Q apply core split (by exact hq) c · simpa [split, newBaseEdge] using hc exit_covered := by @@ -2433,8 +187,199 @@ theorem ScheideStructuralReducedAssembly {V E : Type*} exact (D.exitEquiv t).2 · exact D.retained_missing t } + exact assembled + +private theorem helper_oldExitBase_593.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T), + ∀ v ∈ ScheideExitVertices T phi, + ∃ (q : Fin C.p), + C.y q = v := by + classical + intro V E _ _ _ G k e0 phi T C v hv + have hstructure := ScheideGlobalMaximumOrder G k e0 phi T C.globally_maximum + have helementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet T) := + hstructure.2.2.2.1 + have hvertex : v ∈ TreeSequenceVertexSet T := by + let : DecidablePred (fun w : V => ScheideExitVertex T phi w) := Classical.decPred _ + rcases (Finset.mem_filter.mp hv).2 with ⟨u, color, defect, hu, hmiss, hdefect, + z, path, hpath, index, hindex, hvertex, hafter⟩ + exact hvertex + have baseInTree : ∀ q : Fin C.p, C.y q ∈ TreeSequenceVertexSet T := by + intro q + have hlength := C.length_eq + have witness := + (@Finset.mem_image (Fin (T.length + 1)) V (Classical.decEq V)).mpr + (⟨⟨q.val, by omega⟩, Finset.mem_univ _, C.base_vertex_position q⟩ : + ∃ a ∈ (Finset.univ : Finset (Fin (T.length + 1))), T.vertex a = C.y q) + simpa only [TreeSequenceVertexSet] using witness + obtain ⟨colorIndex, hcolor⟩ := C.exit_covered v hv + obtain ⟨base, hbase⟩ := C.block_color_missing_on_base colorIndex + have hne : v = C.y base := by + by_contra hne + have hdisjoint := helementary hvertex (baseInTree base) hne + exact (Finset.disjoint_left.mp hdisjoint) hcolor hbase + exact ⟨base, hne.symm⟩ + +private abbrev helperBranch504Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), + ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ q : Fin C.p, C.y q = v), + let assembled := assembledConfiguration G k e0 phi T C D T' Q oldExitBase; + ∀ (i : Fin C.s), + (∃! h : Fin D.absorbedCount, + (↑((D.absorbedEquiv : Fin D.absorbedCount → { i : Fin C.s // i ∉ Set.range D.retained }) h) : + Fin C.s) = + i) → + (∃ (r : Fin assembled.s), + C.gamma i = assembled.gamma r ∧ + ∀ (j : Fin (2 : ℕ)), + C.blockVertex i j = assembled.blockVertex r j ∧ + C.blockEdge i j = assembled.blockEdge r j) ∨ + ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image assembled.y Finset.univ + +private abbrev helperBranch516Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), + ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ q : Fin C.p, C.y q = v), + let assembled := assembledConfiguration G k e0 phi T C D T' Q oldExitBase; + ∀ (i : Fin C.s), + (∃! t : Fin D.retainedCount, D.retained t = i) → + (∃ (r : Fin assembled.s), + C.gamma i = assembled.gamma r ∧ + ∀ (j : Fin (2 : ℕ)), + C.blockVertex i j = assembled.blockVertex r j ∧ + C.blockEdge i j = assembled.blockEdge r j) ∨ + ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image assembled.y Finset.univ + +private abbrev helperBranch513Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), + ∀ (oldExitBase : ∀ v ∈ ScheideExitVertices T phi, ∃ q : Fin C.p, C.y q = v), + let assembled := assembledConfiguration G k e0 phi T C D T' Q oldExitBase; + ∀ (i : Fin C.s), + (∃ (r : Fin assembled.s), + C.gamma i = assembled.gamma r ∧ + ∀ (j : Fin (2 : ℕ)), + C.blockVertex i j = assembled.blockVertex r j ∧ C.blockEdge i j = assembled.blockEdge r j) ∨ + ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image assembled.y Finset.univ + +private abbrev helperContinuation263Conditions.{u_1, u_2} : Prop := + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) + (_ : ScheideStructuralReorderingData G k e0 phi T C D T'), + ∀ (_ : ∀ v ∈ ScheideExitVertices T phi, ∃ q : Fin C.p, C.y q = v), + ∃ (R : ScheideReducedConfiguration G k e0 phi T'), + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + (∀ (q : Fin C.p), C.y q ∈ Finset.image R.y Finset.univ) ∧ + ∀ (i : Fin C.s), + (∃ (r : Fin R.s), + C.gamma i = R.gamma r ∧ + ∀ (j : Fin (2 : ℕ)), + C.blockVertex i j = R.blockVertex r j ∧ C.blockEdge i j = R.blockEdge r j) ∨ + ∀ (j : Fin (2 : ℕ)), C.blockVertex i j ∈ Finset.image R.y Finset.univ + +private theorem helper_branch_504.{u_1, u_2} : + helperBranch504Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D T' Q oldExitBase assembled i ha + obtain ⟨h, hi, _⟩ := ha + right + intro j + simp only [Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨⟨C.p + 2 * h.val + j.val, ?_⟩, ?_⟩ + · change C.p + 2 * h.val + j.val < C.p + 2 * D.absorbedCount + have hh := h.isLt + have hj := j.isLt + omega + · dsimp [assembled, assembledConfiguration] + rw [Q.absorbed_vertex_position h j] + rw [hi] + +private theorem helper_branch_516.{u_1, u_2} : + helperBranch516Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D T' Q oldExitBase assembled i hr + obtain ⟨t, ht, _⟩ := hr + left + refine ⟨t, ?_, ?_⟩ + · dsimp [assembled, assembledConfiguration] + rw [ht] + · intro j + constructor + · dsimp [assembled, assembledConfiguration] + rw [← ht] + exact (Q.retained_vertex_position t j).symm + · dsimp [assembled, assembledConfiguration] + rw [← ht] + exact (Q.retained_edge_position t j).symm + +private theorem helper_branch_513.{u_1, u_2} : + helperBranch513Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D T' Q oldExitBase _ i + rcases D.partition i with ha | hr + · exact @helper_branch_504 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D T' Q oldExitBase i ha + · exact @helper_branch_516 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D T' Q oldExitBase i hr +private theorem helper_continuation_263.{u_1, u_2} : + helperContinuation263Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D T' Q oldExitBase + let assembled := assembledConfiguration G k e0 phi T C D T' Q oldExitBase + refine ⟨assembled, Q.vertex_set_eq, ?_, ?_⟩ + · intro q + simp only [Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨⟨q.val, ?_⟩, ?_⟩ + · have hq := q.isLt + change q.val < C.p + 2 * D.absorbedCount + omega + · dsimp [assembled, assembledConfiguration] + exact Q.base_vertex_position q + · exact @helper_branch_513 V E inferInstance inferInstance inferInstance inferInstance G k e0 + phi T C D T' Q oldExitBase +theorem ScheideStructuralReducedAssembly {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) + (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T') : + ∃ R : ScheideReducedConfiguration G k e0 phi T', + TreeSequenceVertexSet T' = TreeSequenceVertexSet T ∧ + (∀ q : Fin C.p, C.y q ∈ Finset.univ.image R.y) ∧ + (∀ i : Fin C.s, + (∃ r : Fin R.s, + C.gamma i = R.gamma r ∧ + ∀ j : Fin 2, + C.blockVertex i j = R.blockVertex r j ∧ + C.blockEdge i j = R.blockEdge r j) ∨ + ∀ j : Fin 2, C.blockVertex i j ∈ Finset.univ.image R.y) := by + classical + have oldExitBase := @helper_oldExitBase_593 V E inferInstance inferInstance inferInstance G k e0 + phi T C exact @helper_continuation_263 V E inferInstance inferInstance inferInstance inferInstance G k e0 phi T C D T' Q oldExitBase + end GoldbergSeymour end diff --git a/LeanPool/GoldbergSeymour/ScheideStructuralReorderingData.lean b/LeanPool/GoldbergSeymour/ScheideStructuralReorderingData.lean index 05b93f4f2d..48b215e9f8 100644 --- a/LeanPool/GoldbergSeymour/ScheideStructuralReorderingData.lean +++ b/LeanPool/GoldbergSeymour/ScheideStructuralReorderingData.lean @@ -97,6 +97,61 @@ structure ScheideStructuralReorderingData {V E : Type*} [Fintype V] [Fintype E] vertex_set_eq : TreeSequenceVertexSet T' = TreeSequenceVertexSet T exit_set_eq : ScheideExitVertices T' phi = ScheideExitVertices T phi +/-- Nonfirst initial edges of the reordered configuration avoid all retained block colors. -/ +theorem ScheideStructuralReorderingData.initialNonfirstAvoidsRetainedColor.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideStructuralConfiguration G k e0 phi T) + (D : ScheideStructuralSelectionData G k e0 phi T C) (T' : TreeSequence G e0) + (Q : ScheideStructuralReorderingData G k e0 phi T C D T'), + ∀ (n : Fin (C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount)), + (1 : ℕ) ≤ (↑n : ℕ) → + ∀ (d : Fin k), + phi + (T'.edge + (⟨(↑n : ℕ), + have hn : (↑n : ℕ) < C.p - (1 : ℕ) + (2 : ℕ) * D.absorbedCount := n.isLt; + have hp : (2 : ℕ) ≤ C.p := C.p_ge_two; + have hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s := C.length_eq; + have hd : C.s = D.absorbedCount + D.retainedCount := D.count_eq; + Eq.mpr (id (congrArg (fun (_a : ℕ) => (↑n : ℕ) < _a) Q.length_eq)) + (Decidable.byContradiction fun (a : ¬(↑n : ℕ) < T.length) => by omega)⟩ : + Fin T'.length)) = + some d → + ∀ (r : Fin D.retainedCount), + d ≠ C.gamma (D.retained r) := by + classical + intro V E _ _ _ _ G k e0 phi T C D T' Q n hn d hdedge rr + refine Fin.addCases ?_ ?_ n hn d hdedge rr + · intro u hn d hdedge rr + have hold := Q.base_edge_position u + change 1 ≤ u.val at hn + apply C.initial_nonfirst_avoids_blocks u hn d (by + rw [← hold] + exact hdedge) (D.retained rr) + · intro u hn d hdedge rr + let paired : Fin (D.absorbedCount * 2) := + Fin.cast (Nat.mul_comm 2 D.absorbedCount) u + let h := paired.divNat + let j := paired.modNat + have huv : u.val = 2 * h.val + j.val := by + dsimp [h, j, paired, Fin.divNat, Fin.modNat] + omega + have hedge := Q.absorbed_edge_position h j + have hblock : phi (C.blockEdge (D.absorbedEquiv h).1 j) = some d := by + rw [← hedge] + simpa [huv, Nat.add_assoc] using hdedge + have hcolor := C.block_color (D.absorbedEquiv h).1 j + have heq : d = C.gamma (D.absorbedEquiv h).1 := by + rw [hcolor] at hblock + simpa using hblock.symm + intro hbad + apply (D.absorbedEquiv h).2 + refine ⟨rr, ?_⟩ + apply C.gamma_injective + rw [← heq, hbad] + end GoldbergSeymour end diff --git a/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean b/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean index 077b53c8de..a0a4e47c06 100644 --- a/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean +++ b/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTerminalData + public import LeanPool.GoldbergSeymour.HierarchyPrefixData public import LeanPool.GoldbergSeymour.TerminalStoredColors public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeData @@ -323,23 +325,8 @@ private theorem helper_terminalData_340.{u_1, u_2} : original.series.data.tree (Fin.last original.rounds).castSucc ∧ c.replacementETT.series.data.kind (Fin.last c.replacementETT.rounds) = original.series.data.kind (Fin.last original.rounds) := by - classical intro V E _ _ _ G k e0 sigma inp gen U original W c - rcases c with ⟨ri, rs, re, hr, hs, hf, ht, hd, he, hk, hp, hu, hst⟩ - cases re with - | mk rounds positive series above strict below generating => - cases hr - have hseries : series = rs := eq_of_heq hs - cases hseries - let i : Fin original.rounds := ⟨original.rounds - 1, by - have := original.roundsPositive - omega⟩ - have hi : i.succ = Fin.last original.rounds := by - apply Fin.ext - have := original.roundsPositive - simp [i] - omega - exact ⟨by simpa [hi] using ht i, hk _⟩ + exact CorrespondingExtendedTashkinovTree.terminalTreeKind G k e0 sigma original W c private theorem helper_oldMetadata_391.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean b/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean index ff0992690b..ca7c62a1d5 100644 --- a/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean +++ b/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts + public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent public import LeanPool.GoldbergSeymour.ChangeLemma @@ -424,57 +426,6 @@ private abbrev helperContinuation1225Conditions.{u_1, u_2} : Prop := R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) -private theorem helper_firstAt_167.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hTlen : (2 : ℕ) ≤ - T.length) (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => - by omega - ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => - by omega - ); TreeSequenceInitialSegment B T → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U) → ( - ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), c ∈ - MissingColors G psi (T.vertex j) → HierarchyFirstMissingPosition psi T c ≤ j) → ( - ∀ (psi : PartialEdgeColoring E k) (c : Fin k), (↑(HierarchyFirstMissingPosition psi T c) : ℕ) - < T.length → c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c))) → - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → - (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx hTlen R B hBT elementary vertexMem firstLe - firstMem R c j hc - clear * - G T B R c j hc elementary vertexMem firstLe firstMem hBT - have hcT : c ∈ MissingColors G R.coloring - (T.vertex (Fin.castLE (Nat.succ_le_succ hBT.1) j)) := by - rw [hBT.2.1 j]; exact hc - have hle := firstLe R.coloring c _ hcT - have hlt : (HierarchyFirstMissingPosition R.coloring T c).val < T.length := by - have := j.isLt - change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle - have hblen : B.length = T.length - 1 := rfl - omega - let x : Fin (B.length + 1) := ⟨(HierarchyFirstMissingPosition R.coloring T c).val, by - change (HierarchyFirstMissingPosition R.coloring T c).val ≤ j.val at hle - omega⟩ - have hxT : Fin.castLE (Nat.succ_le_succ hBT.1) x = - HierarchyFirstMissingPosition R.coloring T c := Fin.ext rfl - have hcx : c ∈ MissingColors G R.coloring (B.vertex x) := by - rw [← hBT.2.1 x, hxT] - exact firstMem R.coloring c hlt - have he : B.vertex x = B.vertex j := by - by_contra hn - exact Finset.disjoint_left.mp (elementary R (vertexMem B x) (vertexMem B j) hn) hcx hc - exact congrArg Fin.val (B.vertex_injective he) - private theorem helper_firstFixed_193.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Finite V] [ Fintype E] (G : LooplessMultigraph V E) (k : ℕ) @@ -1480,8 +1431,7 @@ private theorem helper_continuation_190.{u_1, u_2} : (c : Fin k) (j : Fin (B.length + 1)) (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : (HierarchyFirstMissingPosition R.coloring T c).val = j.val := by - exact @helper_firstAt_167 V E inferInstance inferInstance inferInstance inferInstance G k e0 - input T phi ett base C ctx hTlen R hBT elementary vertexMem firstLe firstMem R c j hc + exact TreeSequenceFirstMissingPositionEqCast hBT (elementary R) hc have firstFixed (psi tau : PartialEdgeColoring E k) (hmissing : ∀ v ∈ TreeSequenceVertexSet B, MissingColors G tau v = MissingColors G psi v) (c : Fin k) : diff --git a/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean b/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean new file mode 100644 index 0000000000..f4205560dc --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean @@ -0,0 +1,118 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +/-! +# Coloring Facts for Initial Segments + +Shared facts extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 and generalized during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Every vertex position inside an initial segment belongs to that segment's vertex set. -/ +theorem TreeSequenceInitialSegmentVertexMem {V E : Type*} {G : LooplessMultigraph V E} + {e0 : E} {initialSegment tree : TreeSequence G e0} + (segment : TreeSequenceInitialSegment initialSegment tree) + {index : Fin (tree.length + 1)} (bound : index.val ≤ initialSegment.length) : + tree.vertex index ∈ TreeSequenceVertexSet initialSegment := by + classical + let position : Fin (initialSegment.length + 1) := ⟨index.val, by omega⟩ + have equal : Fin.castLE (Nat.succ_le_succ segment.1) position = index := Fin.ext rfl + rw [← equal, segment.2.1 position] + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨position, rfl⟩ + +/-- A missing-color witness bounds the first missing position. -/ +theorem TreeSequenceFirstMissingPositionLe {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {tree : TreeSequence G e0} {color : Fin k} {index : Fin (tree.length + 1)} + (missing : color ∈ MissingColors G phi (tree.vertex index)) : + (HierarchyFirstMissingPosition phi tree color).val ≤ index.val := by + classical + let candidates := Finset.univ.filter fun i : Fin (tree.length + 1) => + color ∈ MissingColors G phi (tree.vertex i) + have member : index ∈ candidates := by simp [candidates, missing] + have nonempty : candidates.Nonempty := ⟨index, member⟩ + simpa only [HierarchyFirstMissingPosition, candidates, dite_eq_left nonempty] using + (show (candidates.min' nonempty).val ≤ index.val from + Finset.min'_le candidates index member) + +/-- A color missing somewhere in an initial segment first goes missing within that segment. -/ +theorem TreeSequenceFirstMissingPositionLePrefix {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {initialSegment tree : TreeSequence G e0} + (segment : TreeSequenceInitialSegment initialSegment tree) + {color : Fin k} (missing : color ∈ TreeMissingColors phi initialSegment) : + (HierarchyFirstMissingPosition phi tree color).val ≤ initialSegment.length := by + classical + obtain ⟨vertex, member, missing⟩ := Finset.mem_biUnion.mp missing + obtain ⟨index, _, rfl⟩ := Finset.mem_image.mp member + have witness : color ∈ MissingColors G phi + (tree.vertex (Fin.castLE (Nat.succ_le_succ segment.1) index)) := by + rw [segment.2.1 index] + exact missing + have bound := TreeSequenceFirstMissingPositionLe witness + have := index.isLt + simp only [Fin.val_castLE] at bound + omega + +/-- In an elementary initial segment a missing color has its unique vertex at the first missing +position. -/ +theorem TreeSequenceFirstMissingPositionEq {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {initialSegment tree : TreeSequence G e0} + (segment : TreeSequenceInitialSegment initialSegment tree) + (elementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet initialSegment)) + {index : Fin (tree.length + 1)} (bound : index.val ≤ initialSegment.length) {color : Fin k} + (missing : color ∈ MissingColors G phi (tree.vertex index)) : + HierarchyFirstMissingPosition phi tree color = index := by + classical + let candidates := Finset.univ.filter fun i : Fin (tree.length + 1) => + color ∈ MissingColors G phi (tree.vertex i) + have member : index ∈ candidates := by simp [candidates, missing] + have nonempty : candidates.Nonempty := ⟨index, member⟩ + have minimum := Finset.min'_le candidates index member + have missingMinimum : color ∈ MissingColors G phi (tree.vertex (candidates.min' nonempty)) := + (Finset.mem_filter.mp (Finset.min'_mem candidates nonempty)).2 + have memberMinimum := TreeSequenceInitialSegmentVertexMem segment + (Nat.le_trans minimum bound) + have memberIndex := TreeSequenceInitialSegmentVertexMem segment bound + have equal : candidates.min' nonempty = index := by + by_contra different + have verticesDifferent := fun h => different (tree.vertex_injective h) + exact Finset.disjoint_left.mp + (elementary memberMinimum memberIndex verticesDifferent) missingMinimum missing + simpa only [HierarchyFirstMissingPosition, candidates, dite_eq_left nonempty] using equal + +/-- A witness in an elementary initial segment determines the first missing position in the tree. -/ +theorem TreeSequenceFirstMissingPositionEqCast {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {initialSegment tree : TreeSequence G e0} + (segment : TreeSequenceInitialSegment initialSegment tree) + (elementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet initialSegment)) + {position : Fin (initialSegment.length + 1)} {color : Fin k} + (missing : color ∈ MissingColors G phi (initialSegment.vertex position)) : + (HierarchyFirstMissingPosition phi tree color).val = position.val := by + have witness : color ∈ MissingColors G phi + (tree.vertex (Fin.castLE (Nat.succ_le_succ segment.1) position)) := by + rw [segment.2.1 position] + exact missing + exact congrArg Fin.val (TreeSequenceFirstMissingPositionEq segment elementary + (show position.val ≤ initialSegment.length from Nat.le_of_lt_succ position.isLt) witness) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentColoringFacts.lean b/LeanPool/GoldbergSeymour/TwoColorComponentColoringFacts.lean new file mode 100644 index 0000000000..a26c479378 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentColoringFacts.lean @@ -0,0 +1,177 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColorIncidenceEndpoint +public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapPresentColors +public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary + +/-! +# Missing-Color Endpoints and Component Swaps + +Shared facts extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 and generalized during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A vertex missing either swap color has at most one incidence-graph neighbor. -/ +theorem TwoColorMissingVertexLeaf.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (rho : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G rho → + ∀ (v : V), a ∈ MissingColors G rho v ∨ b ∈ MissingColors G rho v → ((TwoColorIncidenceGraph G + rho a b).neighborSet (Sum.inl v)).Subsingleton := by + classical + intro V E _ _ G k rho a b hne hp v hm + let _ := Fintype.ofFinite V + have hd : @SimpleGraph.degree _ (TwoColorIncidenceGraph G rho a b) + (Sum.inl v) (Fintype.ofFinite _) ≤ 1 := by + rcases hm with ha | hb + · exact MissingColorIncidenceEndpoint G rho a b hne hp v ha + · have he : TwoColorIncidenceGraph G rho a b = TwoColorIncidenceGraph G rho b a := by + ext x y + cases x <;> cases y <;> simp [TwoColorIncidenceGraph, or_comm] + rw [he] + exact MissingColorIncidenceEndpoint G rho b a hne.symm hp v hb + rw [← SimpleGraph.card_neighborFinset_eq_degree] at hd + intro x hx y hy + exact Finset.card_le_one_iff.mp hd + (by simpa [SimpleGraph.mem_neighborFinset] using hx) + (by simpa [SimpleGraph.mem_neighborFinset] using hy) + +/-- Three distinct missing-color endpoints cannot lie in the same two-color path component. -/ +theorem TwoColorMissingVerticesDisjoint {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (rho : PartialEdgeColoring E k) (a b : Fin k) + (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (u v w : V) + (huv : u ≠ v) (huw : u ≠ w) (hvw : v ≠ w) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hw : a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w) + (hsame : TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v)) : + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + classical + let _ := Fintype.ofFinite V + have self (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := rfl + have leaf := TwoColorMissingVertexLeaf G k + rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd + · exfalso + obtain ⟨s, t, p, hpPath, hsupport⟩ := + TwoColorComponentSpanningPath G rho a b hp (Sum.inl w) + have ends (x : V) (hx : Sum.inl x ∈ TwoColorComponent G rho a b (Sum.inl w)) + (hm : a ∈ MissingColors G rho x ∨ b ∈ MissingColors G rho x) : + Sum.inl x = s ∨ Sum.inl x = t := by + by_contra hnot + push Not at hnot + have hs : Sum.inl x ∈ p.support := by + change Sum.inl x ∈ {z | z ∈ p.support} + rw [hsupport] + exact hx + exact hpPath.isTrail.notMem_support_of_subsingleton_neighborSet + hnot.1 hnot.2 (leaf rho a b hne hp x hm) hs + have hue := ends u (he ▸ self rho a b u) (Or.inl hu) + have hve := ends v (by rw [he, hsame]; exact self rho a b v) (Or.inr hv) + have hwe := ends w (self rho a b w) hw + rcases hue with hu | hu <;> rcases hve with hv | hv <;> rcases hwe with hw | hw + all_goals first + | exact huv (Sum.inl.inj (hu.trans hv.symm)) + | exact huw (Sum.inl.inj (hu.trans hw.symm)) + | exact hvw (Sum.inl.inj (hv.trans hw.symm)) + · exact hd + +/-- A third missing-color endpoint is disjoint even when the two initial endpoints coincide. -/ +theorem TwoColorMissingVerticesDisjointAny {V E : Type*} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (rho : PartialEdgeColoring E k) (a b : Fin k) + (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (u v w : V) + (huw : u ≠ w) (hvw : v ≠ w) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (hw : a ∈ MissingColors G rho w ∨ b ∈ MissingColors G rho w) + (hsame : TwoColorComponent G rho a b (Sum.inl u) = + TwoColorComponent G rho a b (Sum.inl v)) : + Disjoint (TwoColorComponent G rho a b (Sum.inl w)) + (TwoColorComponent G rho a b (Sum.inl u)) := by + classical + let _ := Fintype.ofFinite V + have self (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : + Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := rfl + have separate := TwoColorMissingVerticesDisjoint G k + by_cases huv : u = v + · subst v + rcases TwoColorComponentsDisjoint G rho a b (Sum.inl w) (Sum.inl u) with he | hd + · have noColor (c : Fin k) (hc : c ∈ MissingColors G rho u) + (f : E) (hf : Incident G u f) : rho f ≠ some c := by + intro hcol + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hf, hcol⟩) + have hn : (TwoColorIncidenceGraph G rho a b).neighborSet (Sum.inl u) = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro x hx + cases x with + | inl x => exact hx + | inr f => + rcases hx with ⟨hi, hc⟩ + exact hc.elim (noColor a hu f hi) (noColor b hv f hi) + have hwIn : Sum.inl w ∈ TwoColorComponent G rho a b (Sum.inl u) := + he ▸ self rho a b w + change (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl w) = + (TwoColorIncidenceGraph G rho a b).connectedComponentMk (Sum.inl u) at hwIn + exact False.elim (SimpleGraph.not_reachable_of_neighborSet_left_eq_empty + (fun h => huw (Sum.inl.inj h)) hn + (SimpleGraph.ConnectedComponent.exact hwIn).symm) + · exact hd + · exact separate rho a b hne hp u v w huv huw hvw hu hv hw hsame + +/-- Missing colors on an elementary set are unchanged when both witnesses avoid the swap +component. -/ +theorem TwoColorComponentSwapMissingOnElementarySet {V E : Type*} [Finite V] [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} (vertices : Finset V) (rho : PartialEdgeColoring E k) + (a b : Fin k) (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) + (elementary : ColoredVertexSetElementary G rho vertices) (z : Sum V E) + (u v : V) (huSet : u ∈ vertices) (hvSet : v ∈ vertices) + (hu : a ∈ MissingColors G rho u) (hv : b ∈ MissingColors G rho v) + (huOutside : Sum.inl u ∉ TwoColorComponent G rho a b z) + (hvOutside : Sum.inl v ∉ TwoColorComponent G rho a b z) : + ∀ w ∈ vertices, MissingColors G (TwoColorComponentSwap G rho a b z) w = + MissingColors G rho w := by + classical + have behavior := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + intro w member + by_cases component : Sum.inl w ∈ TwoColorComponent G rho a b z + · have missingA : a ∉ MissingColors G rho w := by + intro missing + have different : w ≠ u := fun equal => huOutside (equal ▸ component) + exact Finset.disjoint_left.mp (elementary member huSet different) missing hu + have missingB : b ∉ MissingColors G rho w := by + intro missing + have different : w ≠ v := fun equal => hvOutside (equal ▸ component) + exact Finset.disjoint_left.mp (elementary member hvSet different) missing hv + have presentA : a ∈ PresentColors G rho w := by simpa [MissingColors] using missingA + have presentB : b ∈ PresentColors G rho w := by simpa [MissingColors] using missingB + have newA : a ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by + simpa [MissingColors] using TwoColorComponentSwapPreservesPresent presentA presentB a presentA + have newB : b ∉ MissingColors G (TwoColorComponentSwap G rho a b z) w := by + simpa [MissingColors] using TwoColorComponentSwapPreservesPresent presentA presentB b presentB + apply Finset.ext + intro color + by_cases equalA : color = a + · subst color + simp only [newA, missingA] + · by_cases equalB : color = b + · subst color + simp only [newB, missingB] + · exact behavior.2.2.2 w color equalA equalB + · exact behavior.1 w component + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapPresentColors.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapPresentColors.lean new file mode 100644 index 0000000000..293b69b9a1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapPresentColors.lean @@ -0,0 +1,127 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap + +/-! +# Present Colors Under Component Swaps + +Shared facts extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 and generalized during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A component swap preserves every present color other than its two swap colors. -/ +theorem TwoColorComponentSwapPreservesOther {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {phi : PartialEdgeColoring E k} + {v : V} {alpha beta c : Fin k} {z : Sum V E} + (hc : c ∈ PresentColors G phi v) (hca : c ≠ alpha) (hcb : c ≠ beta) : + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by + classical + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] at hc ⊢ + rcases hc with ⟨edge, incident, colored⟩ + refine ⟨edge, incident, ?_⟩ + by_cases member : Sum.inr edge ∈ TwoColorComponent G phi alpha beta z + · simp [TwoColorComponentSwap, member, colored, hca, hcb] + · simpa [TwoColorComponentSwap, member] using colored + +/-- If both swap colors occur at a vertex, every present color survives the component swap. -/ +theorem TwoColorComponentSwapPreservesPresent {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {phi : PartialEdgeColoring E k} + {v : V} {alpha beta : Fin k} {z : Sum V E} + (halpha : alpha ∈ PresentColors G phi v) (hbeta : beta ∈ PresentColors G phi v) + (c : Fin k) (hc : c ∈ PresentColors G phi v) : + c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by + classical + by_cases hca : c = alpha + · subst c + by_cases hvK : Sum.inl v ∈ TwoColorComponent G phi alpha beta z + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hbeta + have heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inr heColor) + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z + at hvK + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm.trans hvK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simp [TwoColorComponentSwap, heK, heColor]⟩ + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halpha + have heK : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by + intro heK + apply hvK + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inl heColor) + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z + at heK + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans heK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simpa [TwoColorComponentSwap, heK] using heColor⟩ + · by_cases hcb : c = beta + · subst c + by_cases hvK : Sum.inl v ∈ TwoColorComponent G phi alpha beta z + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halpha + have heK : Sum.inr e ∈ TwoColorComponent G phi alpha beta z := by + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inl heColor) + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z + at hvK + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm.trans hvK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simp [TwoColorComponentSwap, heK, heColor]⟩ + · obtain ⟨e, hev, heColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using hbeta + have heK : Sum.inr e ∉ TwoColorComponent G phi alpha beta z := by + intro heK + apply hvK + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr e) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro hev (Or.inr heColor) + change H.connectedComponentMk (Sum.inr e) = H.connectedComponentMk z + at heK + change H.connectedComponentMk (Sum.inl v) = H.connectedComponentMk z + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).trans heK + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, by + simpa [TwoColorComponentSwap, heK] using heColor⟩ + · exact TwoColorComponentSwapPreservesOther hc hca hcb + + +end GoldbergSeymour + +end From 45810e743d89ee3d7340b11f426cd9bc57a3a655 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Fri, 6 Nov 2026 00:00:19 +0000 Subject: [PATCH 07/11] =?UTF-8?q?Share=20Goldberg=E2=80=93Seymour=20transp?= =?UTF-8?q?ort=20proofs=20and=20elementary=20facts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LeanPool/GoldbergSeymour/BaseControl.lean | 86 +- .../GoldbergSeymour/BaseExtraReplacement.lean | 51 +- .../GoldbergSeymour/Basic2TerminalPE.lean | 140 +- .../GoldbergSeymour/Basic2TerminalSERE.lean | 141 +- .../ChangeLemmaBothOutside/Preparation1.lean | 59 +- .../ChangeLemmaMixedClosedFinal.lean | 2008 +--------------- .../ChangeLemmaMixedLargestClosed.lean | 450 +--- .../ChangeLemmaMixedNoClosed.lean | 2014 +---------------- .../ChangeLemmaMixedZeroNonclosed.lean | 18 +- LeanPool/GoldbergSeymour/DisplayedEdges.lean | 18 +- .../EligibleIndexBoundPreparation.lean | 132 +- .../ExtensionBaseAuxiliary.lean | 1130 ++------- .../ExtensionBaseBranchPreparation.lean | 343 +-- .../ExtensionBaseClaim45Singleton.lean | 38 +- .../GoldbergSeymour/ExtensionBaseClaim46.lean | 38 +- .../ExtensionBaseStepLemmas.lean | 37 +- .../GoodHierarchyPrefixPreparation.lean | 20 +- .../HierarchyClaimNineFirstUseAfterSeed.lean | 17 +- ...rarchySituationOneAdvanceInsideStored.lean | 169 +- ...archySituationOneAdvanceOutsideStored.lean | 359 +-- ...hySituationOneShorteningContradiction.lean | 622 +---- ...rchySituationThreeClaimJMinusOneEmpty.lean | 143 +- ...ySituationThreeClaimJMinusOneNonempty.lean | 333 +-- ...ionThreeDisjointThetaStoredImpossible.lean | 1047 +-------- ...ointThetaUnstoredBetaStoredImpossible.lean | 1044 +-------- ...archySituationThreeEligibleIndexBound.lean | 239 +- ...uationTwoSubcaseOneOneStoredException.lean | 254 +-- .../HierarchySituationTwoSubcaseOneTwo.lean | 54 +- .../Preparation1.lean | 100 +- .../HierarchySituationTwoSubcaseThreeTwo.lean | 432 +--- ...uationTwoSubcaseTwoOneStoredException.lean | 121 +- .../HierarchySituationTwoSubcaseTwoTwo.lean | 1155 +--------- .../HkuUnsupportedVertexColors.lean | 51 +- LeanPool/GoldbergSeymour/Imports.lean | 36 + .../GoldbergSeymour/LateOwnerReplacement.lean | 53 +- .../ParallelSupportClosureProperties.lean | 32 +- .../RevisitingTerminalPreparation.lean | 70 +- .../ScheideDefectiveDeletedTreePair.lean | 55 +- .../ScheideDefectiveNoCross.lean | 19 +- .../ScheideDefectiveReturnContradiction.lean | 131 +- .../ScheideDefectiveThirdBoundaryEdge.lean | 69 +- ...eideDeletedMissingReplacementInternal.lean | 32 +- .../ScheideHeightFiveGammaEdges.lean | 114 +- .../ScheideHeightFiveOutsideLinks.lean | 114 +- ...ScheideReplacementBoundaryAtMostThree.lean | 17 +- ...eideReplacementMissingDeletedInternal.lean | 32 +- .../ScheideSelectedBlockDeletion.lean | 294 +-- .../SharedFacts/BaseControl.lean | 113 + .../SharedFacts/Basic2TerminalPE.lean | 166 ++ .../ChangeLemmaBothOutsidePreparation1.lean | 90 + .../SharedFacts/DisjointThetaTransport.lean | 1073 +++++++++ .../ExtensionBaseClaim45Singleton.lean | 64 + .../SharedFacts/ExtensionBaseStepLemmas.lean | 69 + .../ExtensionBranchPreparation.lean | 181 ++ .../SharedFacts/ExtensionBranches.lean | 469 ++++ .../SharedFacts/FirstSubcaseTransport.lean | 79 + .../SharedFacts/FullTailTransport.lean | 65 + .../GoodHierarchyPrefixPreparation.lean | 47 + .../SharedFacts/InsideAdvancement.lean | 168 ++ .../SharedFacts/LargestClosedTransport.lean | 174 ++ .../SharedFacts/MixedChangeTransport.lean | 14 + .../MixedChangeTransport/Preparation1.lean | 1278 +++++++++++ .../MixedChangeTransport/Preparation2.lean | 811 +++++++ .../SharedFacts/OutsideAdvancement.lean | 224 ++ .../ParallelSupportClosureProperties.lean | 57 + .../RevisitingTerminalPreparation.lean | 103 + .../ScheideDefectiveDeletedTreePair.lean | 82 + .../SharedFacts/ScheideDefectiveNoCross.lean | 45 + .../ScheideDefectiveThirdBoundaryEdge.lean | 95 + ...eideDeletedMissingReplacementInternal.lean | 58 + .../ScheideHeightFiveGammaEdges.lean | 146 ++ .../ScheideSelectedBlockDeletion.lean | 171 ++ .../SharedFacts/SecondSituationTransport.lean | 409 ++++ .../SharedFacts/SecondSubcaseTransport.lean | 259 +++ .../SharedFacts/ShorteningTransport.lean | 279 +++ .../StableChangeCasesOneTwoSplitTail.lean | 54 + .../SharedFacts/StoredExceptionTransport.lean | 194 ++ .../SubcaseThreeOnePreparation1.lean | 97 + .../SharedFacts/TerminalKempeStageSwitch.lean | 53 + .../SharedFacts/TerminalRebuild.lean | 513 +++++ .../SharedFacts/TerminalRebuildTransport.lean | 55 + .../SharedFacts/UnsupportedVertexColors.lean | 74 + .../SharedFacts/ZeroNonclosedTransport.lean | 43 + .../StableChangeCaseThree/Preparation1.lean | 61 +- .../StableChangeCasesOneTwo.lean | 97 +- .../StableChangeCasesOneTwoFullTail.lean | 68 +- .../StableChangeCasesOneTwoSplitTail.lean | 28 +- .../StableChangeCasesOneTwoStarredTail.lean | 40 +- .../SupportingPEStoredIntersection.lean | 51 +- .../TerminalHierarchyPrefixPreparation.lean | 20 +- .../TerminalKempeStageSwitch.lean | 53 +- .../TerminalSeriesRebuildPreparation.lean | 885 +------- .../TerminalSeriesRebuildTransport.lean | 224 +- .../TreeSequenceColoringFacts.lean | 20 +- 94 files changed, 8943 insertions(+), 14407 deletions(-) create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/BaseControl.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/Basic2TerminalPE.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ChangeLemmaBothOutsidePreparation1.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ExtensionBaseClaim45Singleton.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ExtensionBaseStepLemmas.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranchPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranches.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/FirstSubcaseTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/FullTailTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/GoodHierarchyPrefixPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/InsideAdvancement.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/LargestClosedTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation1.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation2.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/OutsideAdvancement.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ParallelSupportClosureProperties.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/RevisitingTerminalPreparation.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveDeletedTreePair.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveNoCross.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveThirdBoundaryEdge.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ScheideDeletedMissingReplacementInternal.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ScheideHeightFiveGammaEdges.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ScheideSelectedBlockDeletion.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/SecondSituationTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/SecondSubcaseTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ShorteningTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/StableChangeCasesOneTwoSplitTail.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/StoredExceptionTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/SubcaseThreeOnePreparation1.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/TerminalKempeStageSwitch.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/TerminalRebuild.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/TerminalRebuildTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/UnsupportedVertexColors.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ZeroNonclosedTransport.lean diff --git a/LeanPool/GoldbergSeymour/BaseControl.lean b/LeanPool/GoldbergSeymour/BaseControl.lean index db5171514c..6bab519b12 100644 --- a/LeanPool/GoldbergSeymour/BaseControl.lean +++ b/LeanPool/GoldbergSeymour/BaseControl.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.BaseControl + public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix public import LeanPool.GoldbergSeymour.ChangeLemmaBothInside public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext @@ -239,49 +241,6 @@ private abbrev helperContinuation1245Conditions.{u_1, u_2} : Prop := (HierarchyStarredStage H r) ({ c } : Finset (Fin k)) → OutsideKempeRecoloring (HierarchyStarredStage H r) phi sigma alpha beta -private theorem helper_trans_125.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W - Z → TreeSequenceInitialSegment U Z := by - classical - intro V E G e0 U W Z hUW hWZ - refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ - · intro j - exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) j)).trans - (hUW.2.1 j) - · intro j - exact (hWZ.2.2 (Fin.castLE hUW.1 j)).trans (hUW.2.2 j) - -private theorem helper_stageChain_136.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; ( - ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z - → TreeSequenceInitialSegment U Z) → - ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ - j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : - ℕ)))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H trans j - induction j with - | zero => - intro hj i hi - have hi0 : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) - subst i - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - | succ j ih => - intro hj i hi - by_cases heq : i.val = j + 1 - · have heq' : i = ⟨j + 1, hj⟩ := Fin.ext heq - subst i - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - · exact trans (ih (by omega) i (by omega)) - (H.nested ⟨j, by omega⟩) - private theorem helper_starChain_162.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1001,39 +960,6 @@ private theorem helper_missingAtMax_731.{u_1, u_2} : subst d exact hnew -private theorem helper_branch_773.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - ∀ {u : V}, ett.rounds = (1 : ℕ) → u ∈ TreeSequenceVertexSet Tn → - ∀ {v : V}, v ∈ TreeSequenceVertexSet Tn → u ≠ v → Disjoint (MissingColors G - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), - have this : (0 : ℕ) < ett.rounds := C.positive; Decidable.byContradiction fun (a : ¬ett.rounds - - (1 : ℕ) < ett.rounds) ↦ - by - omega - ⟩ : Fin ett.rounds).castSucc) u) (MissingColors G (ett.series.data.coloring (⟨ett.rounds - (1 - : ℕ), - have this : (0 : ℕ) < ett.rounds := C.positive; Decidable.byContradiction fun (a : ¬ett.rounds - - (1 : ℕ) < ett.rounds) ↦ - by - omega - ⟩ : Fin ett.rounds).castSucc) v) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C n Tn _ hn - have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = - 0 := - Fin.ext (by simp [hn]) - have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := - Fin.ext (by simp [n, hn]) - dsimp only [Tn] - rw [hcolor, htree] - exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 - private theorem helper_branch_781.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1472,7 +1398,8 @@ private theorem helper_continuation_1245.{u_1, u_2} : (TreeSequenceVertexSet Tn) := by dsimp only by_cases hn : ett.rounds = 1 - · exact @helper_branch_773 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + · exact @SharedFacts.BaseControl.branch (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) _ (@hn) · exact @helper_branch_781 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hlower) _ (@hn) @@ -1565,8 +1492,9 @@ theorem P2813_T1_BaseControl {V E : Type*} (min (A.length + ((T.length - A.length) - 1)) T.length) (by have hA := A.positive; have hT := T.positive; omega) (Nat.min_le_right _ _) - have trans := @helper_trans_125 (@V) (@E) (@G) (@e0) - have stageChain := @helper_stageChain_136 (@V) (@E) inferInstance inferInstance inferInstance + have trans := @SharedFacts.BaseControl.trans (@V) (@E) (@G) (@e0) + have stageChain := @SharedFacts.BaseControl.stageChain (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) have starStage (r : Fin (H.dividerCount + 1)) : TreeSequenceInitialSegment (HierarchyStarredStage H r) diff --git a/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean b/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean index 7dd44dd6ad..4e6c784e83 100644 --- a/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean +++ b/LeanPool/GoldbergSeymour/BaseExtraReplacement.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoStarredTail public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans @@ -591,30 +592,7 @@ private theorem helper_seriesProper_846.{u_1, u_2} : IsProperEdgeColoring G (ett.series.data.coloring j) := by classical intro V E _ _ _ G k e0 input T phi ett j - cases ett.series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.1 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedProper - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => exact currentProper - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact previousProper + exact (ett.series.coloringProperties j).1 private theorem helper_seriesOne_873.{u_1, u_2} : open scoped Classical in @@ -626,30 +604,7 @@ private theorem helper_seriesOne_873.{u_1, u_2} : IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by classical intro V E _ _ _ G k e0 input T phi ett j - cases ett.series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.2 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedOneUncolored - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => exact currentOneUncolored - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact previousOneUncolored + exact (ett.series.coloringProperties j).2 private theorem helper_hMdis_717.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean b/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean index 3f36f23b28..ad5e8c71c9 100644 --- a/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean +++ b/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.Basic2TerminalPE + public import LeanPool.GoldbergSeymour.ExtensionBase public import LeanPool.GoldbergSeymour.ParallelExtensionUndoStable @@ -172,110 +174,6 @@ private theorem helper_targetEdgeOutside_444.{u_1, u_2} : true_and] exact ⟨f, by simpa [hxEq] using hxf, hfc⟩ -private theorem helper_appearanceInStage_289.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating), - let _ : DecidableEq V := Classical.decEq V; - ∀ - (_ : - (∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), - TreeSequenceInitialSegment - (ett.series.data.tree (⟨a, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) - (ett.series.data.tree (⟨b, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))))) - (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin ett.rounds) (x : V) - (hxFinal : x ∈ TreeSequenceVertexSet T) (s : ℕ) (_ : (1 : ℕ) ≤ s) - (_hsRound : s ≤ ett.rounds) (_ : ETTFirstAppearanceIndex ett x hxFinal ≤ s), - x ∈ - TreeSequenceVertexSet - (ett.series.data.tree (⟨s, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) := by - classical - intro V E _ _ _ G k e0 input T generating ett this stageToStage v hvFinal q x hxFinal s - hsPositive hsRound hbound - unfold ETTFirstAppearanceIndex at hbound - dsimp at hbound - let candidates : Finset (Fin (ett.rounds + 1)) := - Finset.univ.filter fun i => - x ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) - have hnonempty : candidates.Nonempty := by - refine ⟨Fin.last ett.rounds, ?_⟩ - simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] - rw [show ExtendedTashkinovLadderStage ett - (Fin.last ett.rounds) = T by - unfold ExtendedTashkinovLadderStage - exact Fin.lastCases_last] - exact hxFinal - let m := candidates.min' hnonempty - have hmBound : m.val + 1 ≤ s := by - dsimp [m, candidates] - convert hbound using 1 - have hmRounds : m.val < ett.rounds := by omega - let mi : Fin ett.rounds := ⟨m.val, hmRounds⟩ - have hmEq : m = mi.castSucc := by - apply Fin.ext - rfl - have hmem := Finset.min'_mem candidates hnonempty - change m ∈ candidates at hmem - have hxStart : x ∈ TreeSequenceVertexSet - (ett.series.data.tree ⟨m.val + 1, by omega⟩) := by - rw [hmEq] at hmem - have hstage : ExtendedTashkinovLadderStage ett mi.castSucc = - ett.series.data.tree mi.succ.castSucc := by - unfold ExtendedTashkinovLadderStage - exact @Fin.lastCases_castSucc ett.rounds - (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T - (fun j => ett.series.data.tree j.succ.castSucc) mi - have hxMi : x ∈ TreeSequenceVertexSet - (ett.series.data.tree mi.succ.castSucc) := by - simpa only [candidates, Finset.mem_filter, Finset.mem_univ, - true_and, hstage] using hmem - convert hxMi using 1 - apply congrArg TreeSequenceVertexSet - apply congrArg ett.series.data.tree - apply Fin.ext - simp [mi] - exact TreeSequenceInitialSegmentVertexSetSubset - (stageToStage (m.val + 1) s (by omega) hmBound hsRound) hxStart - -private theorem helper_earlierInPrefix_364.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating), - ∀ v ∈ TreeSequenceVertexSet T, - ∀ (_ : Fin ett.rounds) {A B : TreeSequence G e0} (x y : V), TreeSequenceInitialSegment A B → y - ∈ TreeSequenceVertexSet A → TreeVertexOrder B x y → x ∈ TreeSequenceVertexSet A ∧ - TreeVertexOrder A x y := by - classical - intro V E _ _ _ G k e0 input T generating ett v hvFinal q A B x y hAB hyA hxy - rcases hAB with ⟨hlen, hvertices, _⟩ - rcases Finset.mem_image.mp hyA with ⟨iyA, _, hiyA⟩ - rcases hxy with ⟨ixB, iyB, hixB, hiyB, hlt⟩ - let iyCast := Fin.castLE (Nat.succ_le_succ hlen) iyA - have hiyEq : iyB = iyCast := by - apply B.vertex_injective - exact hiyB.trans ((hvertices iyA).trans hiyA).symm - have hixBound : ixB.val < A.length + 1 := by - rw [hiyEq] at hlt - simp [iyCast] at hlt - omega - let ixA : Fin (A.length + 1) := ⟨ixB.val, hixBound⟩ - have hixCast : Fin.castLE (Nat.succ_le_succ hlen) ixA = ixB := by - apply Fin.ext - rfl - have hixA : A.vertex ixA = x := by - exact (hvertices ixA).symm.trans (by simpa [hixCast] using hixB) - constructor - · apply Finset.mem_image.mpr - exact ⟨ixA, Finset.mem_univ _, hixA⟩ - · refine ⟨ixA, iyA, hixA, hiyA, ?_⟩ - rw [hiyEq] at hlt - simpa [ixA, iyCast] using hlt - private theorem helper_hstableR_473.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -662,7 +560,8 @@ private theorem helper_branch_567.{u_1, u_2} : simpa [terminal] using heq omega have appearanceInStage := - @helper_appearanceInStage_289 V E inferInstance inferInstance inferInstance G k e0 + @SharedFacts.Basic2TerminalPE.appearanceInStage V E inferInstance inferInstance + inferInstance G k e0 input T generating ett stageToStage v hvFinal q let r := ett.rounds - 1 have hrPositive : 1 ≤ r := by @@ -689,7 +588,8 @@ private theorem helper_branch_567.{u_1, u_2} : exact stageToStage r ett.rounds hrPositive (by dsimp [r]; omega) le_rfl have earlierInPrefix := - @helper_earlierInPrefix_364 V E inferInstance inferInstance inferInstance G k e0 input + @SharedFacts.Basic2TerminalPE.earlierInPrefix V E inferInstance inferInstance + inferInstance G k e0 input T generating ett v hvFinal q obtain ⟨hwR, hwvR⟩ := earlierInPrefix w v hRTerminal hvR hwv have hzaR : za ∉ TreeSequenceVertexSet @@ -861,31 +761,6 @@ private theorem helper_hcomponentEdgeColor_904.{u_1, u_2} : | inl x => exact hr.2 | inr x => simp [TwoColorIncidenceGraph] at hr -private theorem helper_boundaryEndpoint_945.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (sigma : PartialEdgeColoring E k) (delta : Fin k), - let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), - ∀ f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree - terminal.castSucc)) delta, Incident G x f → - ∃ z ∉ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), G.ends f = s(x, z) := by - classical - intro V E _ _ _ G k e0 input T generating ett sigma delta terminal x hx f hf hxf - have hfBoundary := (Finset.mem_filter.mp hf).1 - rcases (by - simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, - true_and] using hfBoundary) with ⟨u, hu, z, hz, hends⟩ - have hxEnds : x = u ∨ x = z := by - change x ∈ G.ends f at hxf - rw [hends] at hxf - simpa using hxf - rcases hxEnds with hxu | hxz - · exact ⟨z, hz, by simpa [hxu] using hends⟩ - · exact (hz (hxz ▸ hx)).elim - private theorem helper_branch_1001.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -1034,7 +909,8 @@ private theorem helper_continuation_1207.{u_1, u_2} : simp only [BoundaryColorEdges, Finset.mem_filter] exact ⟨(Finset.mem_filter.mp hbColor).1, hbRecoveredValue⟩ have boundaryEndpoint := - @helper_boundaryEndpoint_945 V E inferInstance inferInstance inferInstance G k e0 input + @SharedFacts.Basic2TerminalPE.boundaryEndpoint V E inferInstance inferInstance + inferInstance G k e0 input T generating ett sigma delta obtain ⟨za, hzaOutside, haEnds⟩ := boundaryEndpoint v hvN a haColor hva diff --git a/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean b/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean index 83520e642a..17cdcbba3d 100644 --- a/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean +++ b/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean @@ -5,10 +5,11 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.Basic2TerminalPE + public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis public import LeanPool.GoldbergSeymour.CertifiedETTRestriction public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset public import LeanPool.GoldbergSeymour.StableColoringEquivalence /-! @@ -283,110 +284,6 @@ private theorem helper_branch_305.{u_1, u_2} : exact ett.abovePenultimate exact orderTransfer hsegment v vi (by simpa [hslot, hchoice] using horder) -private theorem helper_appearanceInStage_400.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating), - let _ : DecidableEq V := Classical.decEq V; - ∀ (_ : ( - ∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), - TreeSequenceInitialSegment (ett.series.data.tree (⟨a, - by omega - ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (⟨b, - by omega - ⟩ : Fin (ett.rounds + (2 : ℕ)))))) (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin - ett.rounds) (x : V) (hxFinal : x ∈ TreeSequenceVertexSet T) (s : ℕ) (_ : (1 : ℕ) ≤ s) - (_hsRound : s ≤ ett.rounds) (_ : ETTFirstAppearanceIndex ett x hxFinal ≤ s), x ∈ - TreeSequenceVertexSet (ett.series.data.tree (⟨s, - by omega - ⟩ : Fin (ett.rounds + (2 : ℕ)))) := by - classical - intro V E _ _ _ G k e0 input T generating ett this stageToStage v hvFinal q x hxFinal s - hsPositive hsRound hbound - unfold ETTFirstAppearanceIndex at hbound - dsimp at hbound - let candidates : Finset (Fin (ett.rounds + 1)) := - Finset.univ.filter fun i => - x ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) - have hnonempty : candidates.Nonempty := by - refine ⟨Fin.last ett.rounds, ?_⟩ - simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] - rw [show ExtendedTashkinovLadderStage ett - (Fin.last ett.rounds) = T by - unfold ExtendedTashkinovLadderStage - exact Fin.lastCases_last] - exact hxFinal - let m := candidates.min' hnonempty - have hmBound : m.val + 1 ≤ s := by - dsimp [m, candidates] - convert hbound using 1 - have hmRounds : m.val < ett.rounds := by omega - let mi : Fin ett.rounds := ⟨m.val, hmRounds⟩ - have hmEq : m = mi.castSucc := by - apply Fin.ext - rfl - have hmem := Finset.min'_mem candidates hnonempty - change m ∈ candidates at hmem - have hxStart : x ∈ TreeSequenceVertexSet - (ett.series.data.tree ⟨m.val + 1, by omega⟩) := by - rw [hmEq] at hmem - have hstage : ExtendedTashkinovLadderStage ett mi.castSucc = - ett.series.data.tree mi.succ.castSucc := by - unfold ExtendedTashkinovLadderStage - exact @Fin.lastCases_castSucc ett.rounds - (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T - (fun j => ett.series.data.tree j.succ.castSucc) mi - have hxMi : x ∈ TreeSequenceVertexSet - (ett.series.data.tree mi.succ.castSucc) := by - simpa only [candidates, Finset.mem_filter, Finset.mem_univ, true_and, - hstage] using hmem - convert hxMi using 1 - apply congrArg TreeSequenceVertexSet - apply congrArg ett.series.data.tree - apply Fin.ext - simp [mi] - exact TreeSequenceInitialSegmentVertexSetSubset - (stageToStage (m.val + 1) s (by omega) hmBound hsRound) hxStart - -private theorem helper_earlierInPrefix_473.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating), - ∀ v ∈ TreeSequenceVertexSet T, - ∀ (_ : Fin ett.rounds) {A B : TreeSequence G e0} (x y : V), - TreeSequenceInitialSegment A B → - y ∈ TreeSequenceVertexSet A → - TreeVertexOrder B x y → x ∈ TreeSequenceVertexSet A ∧ TreeVertexOrder A x y := by - classical - intro V E _ _ _ G k e0 input T generating ett v hvFinal q A B x y hAB hyA hxy - rcases hAB with ⟨hlen, hvertices, _⟩ - rcases Finset.mem_image.mp hyA with ⟨iyA, _, hiyA⟩ - rcases hxy with ⟨ixB, iyB, hixB, hiyB, hlt⟩ - let iyCast := Fin.castLE (Nat.succ_le_succ hlen) iyA - have hiyEq : iyB = iyCast := by - apply B.vertex_injective - exact hiyB.trans ((hvertices iyA).trans hiyA).symm - have hixBound : ixB.val < A.length + 1 := by - rw [hiyEq] at hlt - simp [iyCast] at hlt - omega - let ixA : Fin (A.length + 1) := ⟨ixB.val, hixBound⟩ - have hixCast : Fin.castLE (Nat.succ_le_succ hlen) ixA = ixB := by - apply Fin.ext - rfl - have hixA : A.vertex ixA = x := by - exact (hvertices ixA).symm.trans (by simpa [hixCast] using hixB) - constructor - · apply Finset.mem_image.mpr - exact ⟨ixA, Finset.mem_univ _, hixA⟩ - · refine ⟨ixA, iyA, hixA, hiyA, ?_⟩ - rw [hiyEq] at hlt - simpa [ixA, iyCast] using hlt - private theorem helper_hfirstLower_662.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -447,31 +344,6 @@ private theorem helper_hfirstLower_662.{u_1, u_2} : have hnat := Fin.le_iff_val_le_val.mp hle simpa [qLower] using Nat.succ_le_succ hnat -private theorem helper_boundaryEndpoint_620.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (sigma : PartialEdgeColoring E k) (delta : Fin k), - let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), - ∀ f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree - terminal.castSucc)) delta, Incident G x f → - ∃ z ∉ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), G.ends f = s(x, z) := by - classical - intro V E _ _ _ G k e0 input T generating ett sigma delta terminal x hx f hf hxf - have hfBoundary := (Finset.mem_filter.mp hf).1 - rcases (by - simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, - true_and] using hfBoundary) with ⟨u, hu, z, hz, hends⟩ - have hxEnds : x = u ∨ x = z := by - change x ∈ G.ends f at hxf - rw [hends] at hxf - simpa using hxf - rcases hxEnds with hxu | hxz - · exact ⟨z, hz, by simpa [hxu] using hends⟩ - · exact (hz (hxz ▸ hx)).elim - private theorem helper_hstableR_735.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -741,7 +613,8 @@ private theorem helper_branch_373.{u_1, u_2} : simpa [terminal] using heq omega have appearanceInStage := - @helper_appearanceInStage_400 V E inferInstance inferInstance inferInstance G k e0 + @SharedFacts.Basic2TerminalPE.appearanceInStage V E inferInstance inferInstance + inferInstance G k e0 input T generating ett stageToStage v hvFinal q let r := ett.rounds - 1 have hrPositive : 1 ≤ r := by @@ -766,11 +639,13 @@ private theorem helper_branch_373.{u_1, u_2} : rw [htreeTerminal] exact stageToStage r ett.rounds hrPositive (by dsimp [r]; omega) le_rfl have earlierInPrefix := - @helper_earlierInPrefix_473 V E inferInstance inferInstance inferInstance G k e0 input + @SharedFacts.Basic2TerminalPE.earlierInPrefix V E inferInstance inferInstance + inferInstance G k e0 input T generating ett v hvFinal q obtain ⟨hwR, hwvR⟩ := earlierInPrefix w v hRTerminal hvR hwv have boundaryEndpoint := - @helper_boundaryEndpoint_620 V E inferInstance inferInstance inferInstance G k e0 input + @SharedFacts.Basic2TerminalPE.boundaryEndpoint V E inferInstance inferInstance + inferInstance G k e0 input T generating ett sigma delta obtain ⟨za, hzaOutside, haEnds⟩ := boundaryEndpoint v hvN a haColor hva diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean index 371476e744..ca21f71cbb 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 + public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure public import LeanPool.GoldbergSeymour.HierarchySplitter @@ -1812,36 +1814,15 @@ theorem helper_pathLe_1004.{u_1, u_2} : rw [dite_eq_left hnB, dite_eq_left hnT] exact hminB +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_segTrans_973.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → - TreeSequenceInitialSegment S W := by - classical - intro V E G e0 S U W hSU hUW - refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + SharedFacts.ChangeLemmaBothOutsidePreparation1.initialSegmentTransitiveStatement.{u_1, u_2} := + SharedFacts.ChangeLemmaBothOutsidePreparation1.initialSegmentTransitive.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_commonPrefix_982.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S W → - TreeSequenceInitialSegment U W → - S.length ≤ U.length → - TreeSequenceInitialSegment S U := by - classical - intro V E G e0 S U W hSW hUW hlen - refine ⟨hlen, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + SharedFacts.ChangeLemmaBothOutsidePreparation1.comparableInitialSegmentsStatement.{u_1, u_2} := + SharedFacts.ChangeLemmaBothOutsidePreparation1.comparableInitialSegments.{u_1, u_2} theorem helper_stageToT_998.{u_1, u_2} : open scoped Classical in @@ -2023,27 +2004,11 @@ theorem helper_firstMissing_1057.{u_1, u_2} : have hval : (candidates.min' hnon).val ≤ it.val := hle simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_outsideIndex_1087.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (_ _ : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - TreeSequenceInitialSegment A T → - ∀ (i : Fin (T.length + (1 : ℕ))), - T.vertex i ∉ TreeSequenceVertexSet A → - A.length < (↑i : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A AToT i hi - by_contra h - have hle : i.val ≤ A.length := by omega - apply hi - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ + SharedFacts.ChangeLemmaBothOutsidePreparation1.missingPositionOutsidePrefixStatement.{u_1, + u_2} := + SharedFacts.ChangeLemmaBothOutsidePreparation1.missingPositionOutsidePrefix.{u_1, u_2} theorem helper_missingNotA_1098.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean index 11c11b2999..2928a3e7fc 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean @@ -5,11 +5,13 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation2 /-! # Change Lemma Mixed Closed Final @@ -448,384 +450,6 @@ private abbrev helperContinuation5074Conditions.{u_1, u_2} : Prop := TwoColorComponent G phi alpha beta (Sum.inl vb); sameComponent ∧ TreeInterchangeable G A phi alpha beta -private theorem helper_segTrans_199.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → - TreeSequenceInitialSegment S W := by - classical - intro V E G e0 S U W hSU hUW - refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) - -private theorem helper_commonPrefix_209.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S W → - TreeSequenceInitialSegment U W → - S.length ≤ U.length → - TreeSequenceInitialSegment S U := by - classical - intro V E G e0 S U W hSW hUW hlen - refine ⟨hlen, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) - -private theorem helper_stageSegment_219.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H segRefl segTrans a d hbound - induction d with - | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) - | succ d ih => - exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) - -private theorem helper_stageToT_227.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - ∀ (j : Fin (H.dividerCount + (2 : ℕ))), - TreeSequenceInitialSegment (H.stage j) T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H stageSegment j - have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) - have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : - Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := - Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) - simpa [he, H.terminalStage] using hs - -private theorem helper_lastPositive_238.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A hz - obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q - · have hv := congrArg Fin.val hzero - simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv - exact (hz hv).elim - · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] - congr 1 - apply Fin.ext - have hv := congrArg Fin.val hi - simpa [q] using hv.symm - -private theorem helper_coreToA_250.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - (H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → - TreeSequenceInitialSegment base.core A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A segRefl segTrans stageSegment lastZero - lastPositive - by_cases hz : H.dividerCount = 0 - · rw [lastZero hz] - exact segRefl _ - · rw [lastPositive hz] - have hs := stageSegment 1 (H.dividerCount - 1) (by omega) - have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega - simpa [he] using segTrans H.coreInsideFirst hs - -private theorem helper_TnToCore_259.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi), - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - TreeSequenceInitialSegment Tn base.core := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base n Tn segRefl - by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE - · exact (Classical.choice (base.parallel hp).2.2).leftSegment - · rw [base.nonparallel hp] - exact segRefl _ - -private theorem helper_AToT_266.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - (H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → - TreeSequenceInitialSegment A T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A segTrans stageToT lastZero lastPositive - by_cases hz : H.dividerCount = 0 - · rw [lastZero hz] - exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) - · rw [lastPositive hz] - exact stageToT _ - -private theorem helper_ordinaryToA_273.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - (H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → - TreeSequenceInitialSegment Tn A → - ∀ (j : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (H.stage j.castSucc) A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A n Tn stageSegment lastZero lastPositive - TnToA j - by_cases hz : H.dividerCount = 0 - · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) - rw [hj, H.baseStage] - exact TnToA - · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) - rw [lastPositive hz] - convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> - simp only [Fin.val_castSucc]; omega - -private theorem helper_firstMissing_293.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - TreeSequenceInitialSegment Y T → - ∀ c ∈ TreeMissingColors phi Y, - c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ - (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell yLength Y YToT c hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - obtain ⟨i, hi⟩ := hv - let it := Fin.castLE (Nat.succ_le_succ YToT.1) i - have hci : c ∈ MissingColors G phi (T.vertex it) := by - rw [YToT.2.1 i, hi] - exact hcv - let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) - have hit : it ∈ candidates := by simp [candidates, hci] - have hnon : candidates.Nonempty := ⟨it, hit⟩ - have hmem := Finset.min'_mem candidates hnon - have hle := Finset.min'_le candidates it hit - refine ⟨?_, ?_⟩ - · simpa [HierarchyFirstMissingPosition, candidates, hnon] using - (Finset.mem_filter.mp hmem).2 - · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt - have hval : (candidates.min' hnon).val ≤ it.val := hle - simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv - -private theorem helper_outsideIndex_325.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - TreeSequenceInitialSegment A T → - ∀ (i : Fin (T.length + (1 : ℕ))), - T.vertex i ∉ TreeSequenceVertexSet A → - A.length < (↑i : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A AToT i hi - by_contra h - have hle : i.val ≤ A.length := by omega - apply hi - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ - -private theorem helper_missingNotA_336.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - alpha ≠ beta → - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - TreeSequenceInitialSegment A Y → - ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), - c ∈ MissingColors G phi (T.vertex i) → - T.vertex i ∈ TreeSequenceVertexSet Y → - T.vertex i ∉ TreeSequenceVertexSet A → - c ∉ TreeMissingColors phi A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ell yLength Y hElementaryY - AToY c i hmi hiy hia - clear * - hmi hiy hia AToY hElementaryY - intro hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) - exact (Finset.disjoint_left.mp - (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi - -private theorem helper_habIndex_350.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k), - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) - (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - alpha ∉ - ({c : Fin k | - ∃ (t : Fin T.length), - (HierarchyStarredStage C.hierarchy - (Fin.last C.hierarchy.dividerCount)).length ≤ - (↑t : ℕ) ∧ - (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ - phi (T.edge t) = some c} : - Finset (Fin k)) → - (↑ia : ℕ) < (↑ib : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta ia ib horder - obtain ⟨i, j, hi, hj, hij⟩ := horder.1 - have hei := T.vertex_injective hi - have hej := T.vertex_injective hj - simpa [hei, hej] using hij - -private theorem helper_BstrictT_369.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - A.length < B.length → - TreeSequenceInitialSegment B Y → - B.length < T.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib ell yLength Y AToT hAib B - ABstrict BToY - clear * - AToT BToY ABstrict Y - have hAT := AToT.1 - have hY : Y.length = min (A.length + (T.length - A.length - 1)) T.length := rfl - have hBY := BToY.1 - have hAB := ABstrict - omega - private theorem helper_branch_392.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -1014,38 +638,6 @@ private theorem helper_branch_481.{u_1, u_2} : · exact hne · simpa [hi, ← lastPositive hz] using halphaClosed -private theorem helper_pathMissing_495.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (phi : PartialEdgeColoring E k), - IsProperEdgeColoring G phi → - ∀ (v : V) (c d : Fin k), - c ≠ d → - c ∈ MissingColors G phi v → - TwoColorPathComponent G phi c d (Sum.inl v) := by - classical - intro V E _ _ G k phi hproper v c d hcd hc - let _ := Fintype.ofFinite V - refine ⟨hcd, Sum.inl v, rfl, ?_⟩ - intro x hx y hy - cases x with - | inr f => - cases y with - | inr g => - have hfc : phi f = some d := hx.2.resolve_left (by - intro he - exact (Finset.mem_sdiff.mp hc).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) - have hgc : phi g = some d := hy.2.resolve_left (by - intro he - exact (Finset.mem_sdiff.mp hc).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) - congr 1 - by_contra hfg - exact hproper hfg ⟨v, hx.1, hy.1⟩ hfc hgc - | inl w => exact False.elim hy - | inl w => exact False.elim hx - private theorem helper_pathB_520.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -1095,59 +687,14 @@ private theorem helper_pathB_520.{u_1, u_2} : | inl w => exact False.elim hy | inl w => exact False.elim hx -private theorem helper_unaffected_555.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), - alpha ≠ beta → - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta - (Sum.inl vb); - ∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ib vb ell yLength Y ha hb - K sigma f c hca hcb - clear * - hca hcb K sigma hne - by_cases hf : Sum.inr f ∈ K - · by_cases ha : phi f = some alpha - · simp [sigma, TwoColorComponentSwap, K, hf, ha, hca.symm, hcb.symm] - · by_cases hb : phi f = some beta - · simp [sigma, TwoColorComponentSwap, K, hf, hb, hne.symm, - hca.symm, hcb.symm] - · simp [sigma, TwoColorComponentSwap, K, hf, ha, hb] - · simp [sigma, TwoColorComponentSwap, K, hf] - -private theorem helper_sigmaOne_572.{u_1, u_2} : +private theorem helper_incidentFixed_651.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - IsOneEdgeUncolored phi e0 → - ∀ (alpha beta : Fin k), - alpha ≠ beta → + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; @@ -1165,162 +712,14 @@ private theorem helper_sigmaOne_572.{u_1, u_2} : (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → - IsOneEdgeUncolored sigma e0 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta hne H q A ib vb ell yLength Y - ha hb K sigma unaffected - clear * - hone sigma K unaffected hne - refine ⟨?_, ?_⟩ - · simp [sigma, TwoColorComponentSwap, hone.1] - · intro f hf - obtain ⟨c, hc⟩ := hone.2 f hf - by_cases ha : c = alpha - · subst c - by_cases hK : Sum.inr f ∈ K - · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ - · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ - · by_cases hb : c = beta - · subst c - by_cases hK : Sum.inr f ∈ K - · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc, hne.symm]⟩ - · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ - · exact ⟨c, (unaffected f c ha hb).mpr hc⟩ - -private theorem helper_missingBefore_597.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - alpha ≠ beta → - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let va : V := T.vertex ia; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - va ∈ TreeSequenceVertexSet Y → - vb ∈ TreeSequenceVertexSet Y → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B Y → - let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - Sum.inl va ∉ K → - (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - have phi' : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ - (∀ (v : V), - Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ - (∀ (v : V), - Sum.inl v ∈ C → - beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ - ∀ (v : V) (c : Fin k), - c ≠ alpha → - c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → - (∀ {v : V} {f : E}, - Sum.inl v ∈ K → - Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ K) → - ∀ v ∈ TreeSequenceVertexSet B, - v ≠ vb → - MissingColors G sigma v = MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ia ib va vb ell yLength Y - hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb - by_cases hvK : Sum.inl v ∈ K - · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) - have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv - have han : alpha ∉ MissingColors G phi v := fun hc => - Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 - have hbn : beta ∉ MissingColors G phi v := fun hc => - Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 - have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by - simpa [MissingColors, PresentColors] using han - have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by - simpa [MissingColors, PresentColors] using hbn - obtain ⟨fa, hfa, hfca⟩ := hpa - obtain ⟨fb, hfb, hfcb⟩ := hpb - have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) - have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) - have hnewa : sigma fb = some alpha := by - simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] - have hnewb : sigma fa = some beta := by - simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] - have hana : alpha ∉ MissingColors G sigma v := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, - PresentColors, Finset.mem_filter, not_not] - exact ⟨fb, hfb, hnewa⟩ - have hbnb : beta ∉ MissingColors G sigma v := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, - PresentColors, Finset.mem_filter, not_not] - exact ⟨fa, hfa, hnewb⟩ - ext c - by_cases hca : c = alpha - · subst c; simp [hana, han] - · by_cases hcb : c = beta - · subst c; simp [hbnb, hbn] - · exact behavior.2.2.2 v c hca hcb - · exact behavior.1 v hvK - -private theorem helper_incidentFixed_651.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet A, Sum.inl v ∉ K) → - (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → - ∀ (f : E), - TreeIncidentEdge A f → - sigma f = phi f := by + (∀ v ∈ TreeSequenceVertexSet A, Sum.inl v ∉ K) → + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + ∀ (f : E), + TreeIncidentEdge A f → + sigma f = phi f := by classical intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell yLength Y ha hb K sigma avoidA fixedValue f hf @@ -1686,70 +1085,6 @@ private theorem helper_edgesFixed_804.{u_1, u_2} : simpa [hi] using seedFixed f seed hadjoin · exact augmentationFixed seed hs t (by have := hadjoin.1; omega) -private theorem helper_routeTransport_823.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet B, - v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (S : TreeSequence G e0), - TashkinovAugmentationSequence phi S B → - TashkinovAugmentationSequence sigma S B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb segTrans hAib B BToT - sigma missingBefore edgesFixed S hs - unfold TashkinovAugmentationSequence at hs ⊢ - induction hs using Relation.ReflTransGen.head_induction_on with - | refl => exact Relation.ReflTransGen.refl - | @head U W hstep htail ih => - have hWB := TashkinovAugmentationSequenceInitialSegment phi W B htail - obtain ⟨hlen, hUW, c, hcol, hm⟩ := hstep - have hUB := segTrans hUW hWB - have hlt : U.length < B.length := by have := hWB.1; omega - refine Relation.ReflTransGen.head ⟨hlen, hUW, c, ?_, ?_⟩ ih - · have hf := edgesFixed (Fin.castLE hWB.1 (Fin.cast hlen.symm (Fin.last U.length))) - rw [hWB.2.2] at hf - exact hf.trans hcol - · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm - have hvB := TreeSequenceInitialSegmentVertexSetSubset hUB hv - have hvb : v ≠ vb := by - intro he - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - obtain ⟨i, hi⟩ := hv - have ht := hUB.2.1 i - have htT := BToT.2.1 (Fin.castLE (Nat.succ_le_succ hUB.1) i) - have eqv : T.vertex (Fin.castLE (Nat.succ_le_succ BToT.1) - (Fin.castLE (Nat.succ_le_succ hUB.1) i)) = T.vertex ib := htT.trans (ht.trans - (hi.trans he)) - have hh := congrArg Fin.val (T.vertex_injective eqv) - have := i.isLt - change i.val = ib.val at hh - change U.length < ib.val at hlt - omega - exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [missingBefore v hvB hvb]; exact hcv⟩ - private theorem helper_replacement_855.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -1917,173 +1252,6 @@ private theorem helper_replacement_855.{u_1, u_2} : · exact ⟨fun hp => (hPE hp).elim, fun hp => (hPE (hkind.symm.trans hp)).elim⟩ · intro hp; exact (hPE hp).elim -private theorem helper_storedS_942.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib vb TnToA hAib B rpB - aboveB strictB belowB genB ettB sigma treeMissingEq corr - rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, - hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ - rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ - cases hr - have heq : series = newSeries := eq_of_heq hs - cases heq - let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ - have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) - have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j - have hm := treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) - unfold Dn TashkinovStoredColors - simp only [ettB, hstored, ← hgen, ← ett.generatingColoring, htree, hm, n, Tn] - -private theorem helper_stageBToB_968.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi) - (HB : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB) - (j : Fin (HB.dividerCount + (2 : ℕ))), - TreeSequenceInitialSegment (HB.stage j) B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib segRefl segTrans hAib B rpB - aboveB strictB belowB genB baseB HB j - clear * - HB j B segRefl segTrans - exact Fin.reverseInduction - (motive := fun j => TreeSequenceInitialSegment (HB.stage j) B) - (by simpa only [HB.terminalStage] using segRefl B) - (fun i hi => segTrans (HB.nested i) hi) j - -private theorem helper_closureBToA_975.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - TreeSequenceInitialSegment base.core A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - baseB.core = base.core → - ett.series.data.kind n = some TashkinovExtensionKind.PE → - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib coreToA hAib B rpB aboveB - strictB belowB genB baseB hcoreB hp - clear * - hp baseB coreToA hcoreB - obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hp - intro v hv - apply TreeSequenceInitialSegmentVertexSetSubset coreToA - rw [← hcoreB, u.vertexSet] - exact Finset.mem_union_right _ hv - private theorem helper_minusEq_983.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -2125,1067 +1293,6 @@ private theorem helper_minusEq_983.{u_1, u_2} : exact ⟨fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).symm.trans (hs c hc), fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).trans (hs c hc)⟩ -private theorem helper_storedEq_1020.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn → - ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - change TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) \ TreeMissingColors sigma (HierarchyStarredStage HS - j) = - Dn \ TreeMissingColors phi (HierarchyStarredStage HB j) - rw [storedS, starEq, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starBToA j))] - -private theorem helper_missingEq_1027.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - refine Fin.cases ?_ (fun i => ?_) j - · change TreeMissingColors sigma (corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn - have htree : corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc = Tn := - hsbase.symm.trans hbbase - rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] - · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) - -private theorem helper_firstLe_1038.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), - eta ∈ MissingColors G psi (B.vertex i) → - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib hAib B psi eta i hc - clear * - psi eta i hc - let candidates := Finset.univ.filter fun j => eta ∈ MissingColors G psi (B.vertex j) - have hi : i ∈ candidates := by simp [candidates, hc] - have hn : candidates.Nonempty := ⟨i, hi⟩ - simpa [HierarchyFirstMissingPosition, candidates, hn] using - (show (candidates.min' hn).val ≤ i.val from Finset.min'_le candidates i hi) - -private theorem helper_firstStrict_1047.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (psi : PartialEdgeColoring E k) (eta : Fin k), - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → - eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib hAib B psi eta h - clear * - psi eta h - unfold HierarchyFirstMissingPosition at h ⊢ - dsimp only at h ⊢ - split_ifs with hn - · exact (Finset.mem_filter.mp (Finset.min'_mem _ hn)).2 - · simp only [dite_eq_right hn, Fin.val_last] at h - omega - -private theorem helper_firstEq_1057.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet B, - v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → - (∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), - eta ∈ MissingColors G psi (B.vertex i) → - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ)) → - (∀ (psi : PartialEdgeColoring E k) (eta : Fin k), - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → - eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta))) → - ∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B BToT sigma - missingBefore firstLe firstStrict eta - have beforeLast (i : Fin (B.length + 1)) (hi : i.val < B.length) : - MissingColors G sigma (B.vertex i) = MissingColors G phi (B.vertex i) := by - apply missingBefore - · simp [TreeSequenceVertexSet] - · intro he - have heT := (BToT.2.1 i).trans he - have heval := congrArg Fin.val (T.vertex_injective heT) - have hbLen : B.length = ib.val := rfl - change i.val = ib.val at heval - omega - apply Fin.ext - apply Nat.le_antisymm - · by_cases h : (HierarchyFirstMissingPosition phi B eta).val < B.length - · apply firstLe sigma eta - rw [beforeLast _ h] - exact firstStrict phi eta h - · have := (HierarchyFirstMissingPosition sigma B eta).isLt - omega - · by_cases h : (HierarchyFirstMissingPosition sigma B eta).val < B.length - · apply firstLe phi eta - rw [← beforeLast _ h] - exact firstStrict sigma eta h - · have := (HierarchyFirstMissingPosition phi B eta).isLt - omega - -private theorem helper_segmentEq_1084.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - (∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = - HierarchyFirstMissingPosition phi B eta) → - ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - have hedge (t : Fin (stages j.succ).length) : - sigma ((stages j.succ).edge t) = phi ((stages j.succ).edge t) := by - have hSB := stageBToB j.succ - have hf := edgesFixed (Fin.castLE hSB.1 t) - rw [hSB.2.2] at hf - exact hf - unfold HierarchySegmentColors - simp only [starEq, firstEq eta, HS, HB, hedge] - -private theorem helper_refreshEq_1096.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - rw [starEq] - apply Finset.biUnion_congr rfl - intro v hv - exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ) - (Finset.mem_sdiff.mp hv).1) - -private theorem helper_hstarLast_1150.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (hcountB : - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount = - H.dividerCount), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc = - H.stage jo.castSucc ∧ - HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j = - HierarchyStarredStage H jo) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - HierarchyStarredStage HS (Fin.last count) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested - hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - rw [starEq] - have hs := (hstagesB (Fin.last count)).2 - have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := - Fin.ext (by simp [q]) - simpa only [hj] using hs - -private theorem helper_pathLe_1162.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let _ : ℕ := T.length - A.length; - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - A.length < B.length → - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - HierarchyStarredStage HS (Fin.last count) = A → - HierarchyPathNumber HS ≤ HierarchyPathNumber H := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell AToT hAib B BToT - ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - let tailB := B.length - A.length - let candidatesT := (Finset.Icc 1 ell).filter fun i => - ∀ t : Fin T.length, A.length + i ≤ t.val → - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) - let candidatesB := (Finset.Icc 1 tailB).filter fun i => - ∀ t : Fin B.length, A.length + i ≤ t.val → - G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) - have htail : 1 ≤ tailB := by dsimp [tailB]; omega - have htailT : 1 ≤ ell := by dsimp [ell]; omega - have htmem : ell ∈ candidatesT := by - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htailT, le_rfl⟩, ?_⟩ - intro t ht - have hAT := AToT.1 - have := t.isLt - dsimp [ell] at ht - omega - have hbmem : tailB ∈ candidatesB := by - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htail, le_rfl⟩, ?_⟩ - intro t ht - have := t.isLt - dsimp [tailB] at ht - omega - have hnT : candidatesT.Nonempty := ⟨ell, htmem⟩ - have hnB : candidatesB.Nonempty := ⟨tailB, hbmem⟩ - have hmT := Finset.min'_mem candidatesT hnT - have hbounds := Finset.mem_Icc.mp (Finset.mem_filter.mp hmT).1 - have hminB : candidatesB.min' hnB ≤ candidatesT.min' hnT := by - by_cases ht : candidatesT.min' hnT ≤ tailB - · apply Finset.min'_le - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hbounds.1, ht⟩, ?_⟩ - intro t hpos - have he := (Finset.mem_filter.mp hmT).2 (Fin.castLE BToT.1 t) hpos - have hv0 := BToT.2.1 t.castSucc - have hv1 := BToT.2.1 t.succ - have hi0 : (Fin.castLE BToT.1 t).castSucc = - Fin.castLE (Nat.succ_le_succ BToT.1) t.castSucc := Fin.ext rfl - have hi1 : (Fin.castLE BToT.1 t).succ = - Fin.castLE (Nat.succ_le_succ BToT.1) t.succ := Fin.ext rfl - simpa only [BToT.2.2, hi0, hi1, hv0, hv1] using he - · exact le_trans (Finset.min'_le candidatesB tailB hbmem) (by omega) - unfold HierarchyPathNumber - rw [hstarLast] - change (if h : candidatesB.Nonempty then candidatesB.min' h else tailB) ≤ - (if h : candidatesT.Nonempty then candidatesT.min' h else ell) - rw [dite_eq_left hnB, dite_eq_left hnT] - exact hminB - private theorem helper_hinter_3043.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -3489,7 +1596,8 @@ private theorem helper_storedEq_3248.{u_1, u_2} : hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq j - exact @helper_storedEq_1020 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.storedColorsEquality (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) @@ -3648,7 +1756,8 @@ private theorem helper_missingEq_3257.{u_1, u_2} : hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS j - exact @helper_missingEq_1027 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.missingColorsEquality (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) @@ -3807,7 +1916,8 @@ private theorem helper_segmentEq_3284.{u_1, u_2} : hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq firstEq j eta - exact @helper_segmentEq_1084 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.initialSegmentEquality (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) @@ -3967,7 +2077,8 @@ private theorem helper_refreshEq_3294.{u_1, u_2} : strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact @helper_refreshEq_1096 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.refreshedHierarchyEquality (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) @@ -4147,7 +2258,8 @@ private theorem helper_hstarLast_3349.{u_1, u_2} : strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - exact @helper_hstarLast_1150 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.lastStarredStageEquality (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) @@ -4230,7 +2342,8 @@ private theorem helper_pathLe_3363.{u_1, u_2} : intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb AToT hAib B BToT ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - exact @helper_pathLe_1162 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.pathLengthUpperBound (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) @@ -5244,7 +3357,8 @@ private theorem helper_continuation_5185.{u_1, u_2} : storedS hrS stageBToA starBToA stageBToB have closureBToA (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by - exact @helper_closureBToA_975 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.closureInitialSegmentOfStarredStage (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@hcoreB) (@hp) have minusEq (S : TreeSequence G e0) @@ -5293,18 +3407,21 @@ private theorem helper_continuation_5185.{u_1, u_2} : have firstLe (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + 1)) (hc : eta ∈ MissingColors G psi (B.vertex i)) : (HierarchyFirstMissingPosition psi B eta).val ≤ i.val := by - exact @helper_firstLe_1038 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.firstMissingPositionUpperBound (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@psi) (@eta) (@i) (@hc) have firstStrict (psi : PartialEdgeColoring E k) (eta : Fin k) (h : (HierarchyFirstMissingPosition psi B eta).val < B.length) : eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by - exact @helper_firstStrict_1047 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.beforeFirstMissingPosition (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@psi) (@eta) (@h) have firstEq (eta : Fin k) : HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by - exact @helper_firstEq_1057 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.firstMissingPositionEquality (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@BToT) (@missingBefore) (@firstLe) (@firstStrict) (@eta) have segmentEq (j : Fin (count + 1)) (eta : Fin k) @@ -5482,7 +3599,8 @@ private theorem helper_continuation_5094.{u_1, u_2} : (@augmentationFixed) (@seedFixed) (@t) have routeTransport (S : TreeSequence G e0) (hs : TashkinovAugmentationSequence phi S B) : TashkinovAugmentationSequence sigma S B := by - exact @helper_routeTransport_823 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.routeTransport (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@segTrans) (@hAib) (@BToT) (@missingBefore) (@edgesFixed) (@S) (@hs) have replacement : @@ -5499,7 +3617,8 @@ private theorem helper_continuation_5094.{u_1, u_2} : obtain ⟨corr, hMPS, baseS, HS, hsame⟩ := replacement have storedS : TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = Dn := by - exact @helper_storedS_942 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.storedColorsAtReplacementStage (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@treeMissingEq) (@corr) have hrS : corr.replacementETT.rounds = ett.rounds := corr.rungAgreement @@ -5515,7 +3634,8 @@ private theorem helper_continuation_5094.{u_1, u_2} : exact starredToA _ have stageBToB (j : Fin (HB.dividerCount + 2)) : TreeSequenceInitialSegment (HB.stage j) B := by - exact @helper_stageBToB_968 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.replacementStageInitialSegmentOfPrefix (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@segRefl) (@segTrans) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@HB) (@j) exact @helper_continuation_5185 (@V) (@E) inferInstance inferInstance inferInstance @@ -5537,7 +3657,8 @@ private theorem helper_continuation_5074.{u_1, u_2} : have hbetaA : beta ∉ TreeMissingColors phi A := missingNotA beta ib hb.1 hbY hout.2 have horder := horderedUnused (Or.inr hbetaA) have habIndex : ia.val < ib.val := by - exact @helper_habIndex_350 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.distinctMissingPositionIndices (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@horder) have havb : va ≠ vb := by clear * - habIndex @@ -5553,7 +3674,8 @@ private theorem helper_continuation_5074.{u_1, u_2} : have ABstrict : A.length < B.length := hAib have BToY : TreeSequenceInitialSegment B Y := commonPrefix BToT YToT hb.2 have BstrictT : B.length < T.length := by - exact @helper_BstrictT_369 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.prefixStrictlyShorterThanFinalTree (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) (@ABstrict) (@BToY) obtain ⟨ettB, hMPB, hrB, hsB, baseB, hcoreB, hclosureB, hsupportB, @@ -5578,7 +3700,8 @@ private theorem helper_continuation_5074.{u_1, u_2} : have pathMissing (v : V) (c d : Fin k) (hcd : c ≠ d) (hc : c ∈ MissingColors G phi v) : TwoColorPathComponent G phi c d (Sum.inl v) := by - exact @helper_pathMissing_495 (@V) (@E) inferInstance inferInstance (@G) (@k) + exact @SharedFacts.MixedChangeTransport.pathMissing (@V) (@E) inferInstance inferInstance + (@G) (@k) (@phi) (@hproper) (@v) (@c) (@d) (@hcd) (@hc) have pathA : TwoColorPathComponent G phi alpha beta (Sum.inl va) := pathMissing va alpha beta hne ha.1 @@ -5602,7 +3725,8 @@ private theorem helper_continuation_5074.{u_1, u_2} : exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv have unaffected (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : sigma f = some c ↔ phi f = some c := by - exact @helper_unaffected_555 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.otherColorsUnaffected (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@ha) (@hb) (@f) (@c) (@hca) (@hcb) have fixedValue (f : E) (ha : phi f ≠ some alpha) (hb : phi f ≠ some beta) : @@ -5612,7 +3736,8 @@ private theorem helper_continuation_5074.{u_1, u_2} : have sigmaProper : IsProperEdgeColoring G sigma := TwoColorComponentSwapProper G phi alpha beta hne hproper _ have sigmaOne : IsOneEdgeUncolored sigma e0 := by - exact @helper_sigmaOne_572 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.swappedColoringOneUncolored (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hone) (@alpha) (@beta) (@hne) (@ha) (@hb) (@unaffected) have vertexB (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : @@ -5625,7 +3750,8 @@ private theorem helper_continuation_5074.{u_1, u_2} : -- Elementarity fixes missing sets before the swapped endpoint, even inside its component. have missingBefore (v : V) (hv : v ∈ TreeSequenceVertexSet B) (hvb : v ≠ vb) : MissingColors G sigma v = MissingColors G phi v := by - exact @helper_missingBefore_597 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.notMissingBeforeFirstPosition (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@hElementaryY) (@ha) (@hb) (@haY) (@hbY) (@hAib) (@BToY) (@haK) (@behavior) (@edgeOfVertex) (@v) (@hv) (@hvb) @@ -5754,44 +3880,53 @@ theorem ChangeLemmaMixedClosedFinal {V E : Type*} (hSU : TreeSequenceInitialSegment S U) (hUW : TreeSequenceInitialSegment U W) : TreeSequenceInitialSegment S W := by - exact @helper_segTrans_199 (@V) (@E) (@G) (@e0) (@S) (@U) (@W) (@hSU) (@hUW) + exact @SharedFacts.MixedChangeTransport.initialSegmentTransitive (@V) (@E) (@G) (@e0) (@S) + (@U) (@W) (@hSU) (@hUW) have commonPrefix {S U W : TreeSequence G e0} (hSW : TreeSequenceInitialSegment S W) (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : TreeSequenceInitialSegment S U := by - exact @helper_commonPrefix_209 (@V) (@E) (@G) (@e0) (@S) (@U) (@W) (@hSW) (@hUW) (@hlen) + exact @SharedFacts.MixedChangeTransport.comparableInitialSegments (@V) (@E) (@G) (@e0) + (@S) (@U) (@W) (@hSW) (@hUW) (@hlen) have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) (H.stage ⟨a + d, by omega⟩) := by - exact @helper_stageSegment_219 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.stageInitialSegment (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@segRefl) (@segTrans) (@a) (@d) (@hbound) have stageToT (j : Fin (H.dividerCount + 2)) : TreeSequenceInitialSegment (H.stage j) T := by - exact @helper_stageToT_227 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.stageInitialSegmentOfFinalTree (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@stageSegment) (@j) have lastZero (hz : H.dividerCount = 0) : A = base.core := by clear * - hz A q simp [A, q, HierarchyStarredStage, hz, Fin.last] have lastPositive (hz : H.dividerCount ≠ 0) : A = H.stage ⟨H.dividerCount, by omega⟩ := by - exact @helper_lastPositive_238 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.lastStagePositive (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hz) have coreToA : TreeSequenceInitialSegment base.core A := by - exact @helper_coreToA_250 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.coreInitialSegmentOfStarredStage (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@segRefl) (@segTrans) (@stageSegment) (@lastZero) (@lastPositive) have TnToCore : TreeSequenceInitialSegment Tn base.core := by - exact @helper_TnToCore_259 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.terminalStageInitialSegmentOfCore (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@segRefl) have TnToA := segTrans TnToCore coreToA have AToT : TreeSequenceInitialSegment A T := by - exact @helper_AToT_266 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @SharedFacts.MixedChangeTransport.starredStageInitialSegmentOfFinalTree (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@segTrans) (@stageToT) (@lastZero) (@lastPositive) have ordinaryToA (j : Fin (H.dividerCount + 1)) : TreeSequenceInitialSegment (H.stage j.castSucc) A := by - exact @helper_ordinaryToA_273 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.ordinaryStageInitialSegmentOfStarredStage (@V) + (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@stageSegment) (@lastZero) (@lastPositive) (@TnToA) (@j) have starredToA (j : Fin (H.dividerCount + 1)) : @@ -5806,7 +3941,8 @@ theorem ChangeLemmaMixedClosedFinal {V E : Type*} have firstMissing (c : Fin k) (hc : c ∈ TreeMissingColors phi Y) : c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ (HierarchyFirstMissingPosition phi T c).val ≤ Y.length := by - exact @helper_firstMissing_293 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.firstMissingPositionWitness (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@YToT) (@c) (@hc) have ha := firstMissing alpha hmissingY.1 have hb := firstMissing beta hmissingY.2 @@ -5820,7 +3956,8 @@ theorem ChangeLemmaMixedClosedFinal {V E : Type*} have hout : va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A := hlocation have outsideIndex (i : Fin (T.length + 1)) (hi : T.vertex i ∉ TreeSequenceVertexSet A) : A.length < i.val := by - exact @helper_outsideIndex_325 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.missingPositionOutsidePrefix (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@AToT) (@i) (@hi) have hAib := outsideIndex ib hout.2 have AToY : TreeSequenceInitialSegment A Y := @@ -5829,7 +3966,8 @@ theorem ChangeLemmaMixedClosedFinal {V E : Type*} (hmi : c ∈ MissingColors G phi (T.vertex i)) (hiy : T.vertex i ∈ TreeSequenceVertexSet Y) (hia : T.vertex i ∉ TreeSequenceVertexSet A) : c ∉ TreeMissingColors phi A := by - exact @helper_missingNotA_336 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.colorNotMissingOnStarredStage (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@hElementaryY) (@AToY) (@c) (@i) (@hmi) (@hiy) (@hia) exact @helper_continuation_5074 (@V) (@E) inferInstance inferInstance inferInstance diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean index e9dbc09f76..19c6bb080a 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean @@ -5,12 +5,16 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.LargestClosedTransport + + public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure +public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation2 /-! # Change Lemma Mixed Largest Closed @@ -1952,154 +1956,6 @@ private abbrev helperParallelBase6126Conditions.{u_1, u_2} : Prop := (HierarchyStoredColorsAt HS (0 : Fin (HS.dividerCount + (1 : ℕ)))).biUnion (goodB.gamma (0 : Fin (HS.dividerCount + (1 : ℕ))))).card -private abbrev helperStoredEq7501Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (treeMissingEq : - ∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) - (storedS : - TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = - Dn) - (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (starBToA : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { - dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, - nested := hsnested, strict := hsstrict, dividerPosition := positionsS, - dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (starEq : - ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j - private abbrev helperSegmentEq7714Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] @@ -2528,191 +2384,12 @@ private abbrev helperRefreshEq8147Conditions.{u_1, u_2} : Prop := TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion fun (v : V) ↦ MissingColors G phi v -private abbrev helperStoredEq8334Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (treeMissingEq : - ∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) - (storedS : - TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = - Dn) - (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (starBToA : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { - dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, - nested := hsnested, strict := hsstrict, dividerPosition := positionsS, - dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (starEq : - ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j - private theorem lexicographicMeasureDecreases {a b c d : ℕ} (hab : a ≤ b) (hcd : c < d) : HierarchyCounterexampleLess (a, c) (b, d) := by rcases lt_or_eq_of_le hab with h | h · exact Or.inl h · exact Or.inr ⟨h, hcd⟩ -private theorem helper_segTrans_213.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → - TreeSequenceInitialSegment S W := by - classical - intro V E G e0 S U W hSU hUW - refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) - -private theorem helper_commonPrefix_223.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S W → - TreeSequenceInitialSegment U W → - S.length ≤ U.length → - TreeSequenceInitialSegment S U := by - classical - intro V E G e0 S U W hSW hUW hlen - refine ⟨hlen, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) - private theorem helper_stageSegment_233.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -2822,23 +2499,6 @@ private theorem helper_coreToA_264.{u_1, u_2} : have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega simpa [he] using segTrans H.coreInsideFirst hs -private theorem helper_TnToCore_273.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi), - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - TreeSequenceInitialSegment Tn base.core := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base n Tn segRefl - by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE - · exact (Classical.choice (base.parallel hp).2.2).leftSegment - · rw [base.nonparallel hp] - exact segRefl _ - private theorem helper_AToT_280.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -3044,28 +2704,6 @@ private theorem helper_firstMissing_354.{u_1, u_2} : have hval : (candidates.min' hnon).val ≤ it.val := hle simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv -private theorem helper_outsideIndex_386.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - TreeSequenceInitialSegment A T → - ∀ (i : Fin (T.length + (1 : ℕ))), - T.vertex i ∉ TreeSequenceVertexSet A → - A.length < (↑i : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A AToT i hi - by_contra h - have hle : i.val ≤ A.length := by omega - apply hi - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ - private theorem helper_missingNotA_397.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -3334,34 +2972,6 @@ private theorem helper_branch_501.{u_1, u_2} : simpa only [Tn, ht1] using hv simpa only [hj0] using he hu' hv' huv -private theorem helper_habIndex_519.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k), - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) - (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - alpha ∉ - ({c : Fin k | - ∃ (t : Fin T.length), - (HierarchyStarredStage C.hierarchy - (Fin.last C.hierarchy.dividerCount)).length ≤ - (↑t : ℕ) ∧ - (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ - phi (T.edge t) = some c} : - Finset (Fin k)) → - (↑ia : ℕ) < (↑ib : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta ia ib horder - obtain ⟨i, j, hi, hj, hij⟩ := horder.1 - have hei := T.vertex_injective hi - have hej := T.vertex_injective hj - simpa [hei, hej] using hij - private theorem helper_BstrictT_538.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -3587,38 +3197,6 @@ private theorem helper_branch_650.{u_1, u_2} : · exact hne · simpa [hi, ← rPositive hz] using hclosed -private theorem helper_pathMissing_662.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] - (G : LooplessMultigraph V E) (k : ℕ) (phi : PartialEdgeColoring E k), - IsProperEdgeColoring G phi → - ∀ (v : V) (c d : Fin k), - c ≠ d → - c ∈ MissingColors G phi v → - TwoColorPathComponent G phi c d (Sum.inl v) := by - classical - intro V E _ _ G k phi hproper v c d hcd hc - let _ := Fintype.ofFinite V - refine ⟨hcd, Sum.inl v, rfl, ?_⟩ - intro x hx y hy - cases x with - | inr f => - cases y with - | inr g => - have hfc : phi f = some d := hx.2.resolve_left (by - intro he - exact (Finset.mem_sdiff.mp hc).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) - have hgc : phi g = some d := hy.2.resolve_left (by - intro he - exact (Finset.mem_sdiff.mp hc).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) - congr 1 - by_contra hfg - exact hproper hfg ⟨v, hx.1, hy.1⟩ hfc hgc - | inl w => exact False.elim hy - | inl w => exact False.elim hx - private theorem helper_pathB_687.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -8085,7 +7663,7 @@ private theorem helper_refreshEq_7327.{u_1, u_2} : (@hsdivider) (@hscore) (@starEq) (@i) private theorem helper_storedEq_7501.{u_1, u_2} : - helperStoredEq7501Conditions.{u_1, u_2} := by + SharedFacts.LargestClosedTransport.storedEq7501Conditions.{u_1, u_2} := by classical intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase @@ -8144,7 +7722,7 @@ private theorem helper_refreshEq_8147.{u_1, u_2} : (@hsdivider) (@hscore) (@starEq) (@i) private theorem helper_storedEq_8334.{u_1, u_2} : - helperStoredEq8334Conditions.{u_1, u_2} := by + SharedFacts.LargestClosedTransport.storedEq7501Conditions.{u_1, u_2} := by classical intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase @@ -8375,7 +7953,8 @@ private theorem helper_continuation_4559.{u_1, u_2} : let sigma := TwoColorComponentSwap G phi alpha beta (Sum.inl vb) have pathMissing (v : V) (c d : Fin k) (hcd : c ≠ d) (hc : c ∈ MissingColors G phi v) := - helper_pathMissing_662 (@G) (@k) (@phi) (@hproper) (@v) (@c) (@d) (@hcd) (@hc) + SharedFacts.MixedChangeTransport.pathMissing (@G) (@k) (@phi) (@hproper) (@v) (@c) (@d) + (@hcd) (@hc) have pathA : TwoColorPathComponent G phi alpha beta (Sum.inl va) := pathMissing va alpha beta hne ha.1 have pathB := @@ -8514,7 +8093,8 @@ private theorem helper_continuation_4549.{u_1, u_2} : have hout : va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A := hlocation have outsideIndex (i : Fin (T.length + 1)) (hi : T.vertex i ∉ TreeSequenceVertexSet A) : A.length < i.val := by - exact helper_outsideIndex_386 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.MixedChangeTransport.missingPositionOutsidePrefix (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@AToT) (@i) (@hi) have hAib := outsideIndex ib hout.2 have AToY : TreeSequenceInitialSegment A Y := @@ -8565,7 +8145,8 @@ private theorem helper_continuation_4549.{u_1, u_2} : have hbetaA : beta ∉ TreeMissingColors phi A := missingNotA beta ib hb.1 hbY hout.2 have horder := horderedUnused (Or.inr hbetaA) have habIndex := - helper_habIndex_519 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + SharedFacts.MixedChangeTransport.distinctMissingPositionIndices (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@horder) have havb : va ≠ vb := by clear * - habIndex @@ -8725,11 +8306,11 @@ theorem ChangeLemmaMixedLargestClosed {V E : Type*} have segTrans {S U W : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U) (hUW : TreeSequenceInitialSegment U W) := - helper_segTrans_213 (@G) (@e0) (@hSU) (@hUW) + SharedFacts.MixedChangeTransport.initialSegmentTransitive (@G) (@e0) (@hSU) (@hUW) have commonPrefix {S U W : TreeSequence G e0} (hSW : TreeSequenceInitialSegment S W) (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) := - helper_commonPrefix_223 (@G) (@e0) (@hSW) (@hUW) (@hlen) + SharedFacts.MixedChangeTransport.comparableInitialSegments (@G) (@e0) (@hSW) (@hUW) (@hlen) have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) := helper_stageSegment_233 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) (@segRefl) (@segTrans) (@a) (@d) (@hbound) @@ -8745,7 +8326,8 @@ theorem ChangeLemmaMixedLargestClosed {V E : Type*} helper_coreToA_264 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) (@segRefl) (@segTrans) (@stageSegment) (@lastZero) (@lastPositive) have TnToCore := - helper_TnToCore_273 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@segRefl) + SharedFacts.MixedChangeTransport.terminalStageInitialSegmentOfCore (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@segRefl) have TnToA := segTrans TnToCore coreToA have AToT := helper_AToT_280 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean index 2948c18066..b99fc250b7 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure @@ -14,6 +15,7 @@ public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis public import LeanPool.GoldbergSeymour.MixedNoClosedTransport +public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation2 /-! # Change Lemma Mixed No Closed @@ -1161,384 +1163,6 @@ private abbrev helperHless4484Conditions.{u_1, u_2} : Prop := HierarchyCounterexampleLess (HierarchyCounterexampleMeasure CS) (HierarchyCounterexampleMeasure C) -private theorem helper_segTrans_202.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → - TreeSequenceInitialSegment S W := by - classical - intro V E G e0 S U W hSU hUW - refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) - -private theorem helper_commonPrefix_212.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S W → - TreeSequenceInitialSegment U W → - S.length ≤ U.length → - TreeSequenceInitialSegment S U := by - classical - intro V E G e0 S U W hSW hUW hlen - refine ⟨hlen, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) - -private theorem helper_stageSegment_222.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H segRefl segTrans a d hbound - induction d with - | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) - | succ d ih => - exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) - -private theorem helper_stageToT_230.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - ∀ (j : Fin (H.dividerCount + (2 : ℕ))), - TreeSequenceInitialSegment (H.stage j) T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H stageSegment j - have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) - have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : - Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := - Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) - simpa [he, H.terminalStage] using hs - -private theorem helper_lastPositive_241.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A hz - obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q - · have hv := congrArg Fin.val hzero - simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv - exact (hz hv).elim - · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] - congr 1 - apply Fin.ext - have hv := congrArg Fin.val hi - simpa [q] using hv.symm - -private theorem helper_coreToA_253.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - (H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → - TreeSequenceInitialSegment base.core A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A segRefl segTrans stageSegment lastZero - lastPositive - by_cases hz : H.dividerCount = 0 - · rw [lastZero hz] - exact segRefl _ - · rw [lastPositive hz] - have hs := stageSegment 1 (H.dividerCount - 1) (by omega) - have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega - simpa [he] using segTrans H.coreInsideFirst hs - -private theorem helper_TnToCore_262.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi), - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - TreeSequenceInitialSegment Tn base.core := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base n Tn segRefl - by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE - · exact (Classical.choice (base.parallel hp).2.2).leftSegment - · rw [base.nonparallel hp] - exact segRefl _ - -private theorem helper_AToT_269.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - (H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → - TreeSequenceInitialSegment A T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A segTrans stageToT lastZero lastPositive - by_cases hz : H.dividerCount = 0 - · rw [lastZero hz] - exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) - · rw [lastPositive hz] - exact stageToT _ - -private theorem helper_ordinaryToA_276.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - (H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → - TreeSequenceInitialSegment Tn A → - ∀ (j : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (H.stage j.castSucc) A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A n Tn stageSegment lastZero lastPositive - TnToA j - by_cases hz : H.dividerCount = 0 - · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) - rw [hj, H.baseStage] - exact TnToA - · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) - rw [lastPositive hz] - convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> - simp only [Fin.val_castSucc]; omega - -private theorem helper_firstMissing_296.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - TreeSequenceInitialSegment Y T → - ∀ c ∈ TreeMissingColors phi Y, - c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ - (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell yLength Y YToT c hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - obtain ⟨i, hi⟩ := hv - let it := Fin.castLE (Nat.succ_le_succ YToT.1) i - have hci : c ∈ MissingColors G phi (T.vertex it) := by - rw [YToT.2.1 i, hi] - exact hcv - let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) - have hit : it ∈ candidates := by simp [candidates, hci] - have hnon : candidates.Nonempty := ⟨it, hit⟩ - have hmem := Finset.min'_mem candidates hnon - have hle := Finset.min'_le candidates it hit - refine ⟨?_, ?_⟩ - · simpa [HierarchyFirstMissingPosition, candidates, hnon] using - (Finset.mem_filter.mp hmem).2 - · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt - have hval : (candidates.min' hnon).val ≤ it.val := hle - simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv - -private theorem helper_outsideIndex_328.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - TreeSequenceInitialSegment A T → - ∀ (i : Fin (T.length + (1 : ℕ))), - T.vertex i ∉ TreeSequenceVertexSet A → - A.length < (↑i : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A AToT i hi - by_contra h - have hle : i.val ≤ A.length := by omega - apply hi - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ - -private theorem helper_missingNotA_339.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - alpha ≠ beta → - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - TreeSequenceInitialSegment A Y → - ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), - c ∈ MissingColors G phi (T.vertex i) → - T.vertex i ∈ TreeSequenceVertexSet Y → - T.vertex i ∉ TreeSequenceVertexSet A → - c ∉ TreeMissingColors phi A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ell yLength Y hElementaryY - AToY c i hmi hiy hia - clear * - hmi hiy hia AToY hElementaryY - intro hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) - exact (Finset.disjoint_left.mp - (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi - -private theorem helper_habIndex_353.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k), - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) - (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - alpha ∉ - ({c : Fin k | - ∃ (t : Fin T.length), - (HierarchyStarredStage C.hierarchy - (Fin.last C.hierarchy.dividerCount)).length ≤ - (↑t : ℕ) ∧ - (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ - phi (T.edge t) = some c} : - Finset (Fin k)) → - (↑ia : ℕ) < (↑ib : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta ia ib horder - obtain ⟨i, j, hi, hj, hij⟩ := horder.1 - have hei := T.vertex_injective hi - have hej := T.vertex_injective hj - simpa [hei, hej] using hij - -private theorem helper_BstrictT_372.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - A.length < B.length → - TreeSequenceInitialSegment B Y → - B.length < T.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib ell yLength Y AToT hAib B - ABstrict BToY - clear * - AToT BToY ABstrict Y - have hAT := AToT.1 - have hY : Y.length = min (A.length + (T.length - A.length - 1)) T.length := rfl - have hBY := BToY.1 - have hAB := ABstrict - omega - private theorem helper_branch_398.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -1728,62 +1352,19 @@ private theorem helper_pathB_451.{u_1, u_2} : | inl w => exact False.elim hy | inl w => exact False.elim hx -private theorem helper_unaffected_486.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), - alpha ≠ beta → - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta - (Sum.inl vb); - ∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ib vb ell yLength Y ha hb - K sigma f c hca hcb - clear * - hca hcb K sigma hne - by_cases hf : Sum.inr f ∈ K - · by_cases ha : phi f = some alpha - · simp [sigma, TwoColorComponentSwap, K, hf, ha, hca.symm, hcb.symm] - · by_cases hb : phi f = some beta - · simp [sigma, TwoColorComponentSwap, K, hf, hb, hne.symm, - hca.symm, hcb.symm] - · simp [sigma, TwoColorComponentSwap, K, hf, ha, hb] - · simp [sigma, TwoColorComponentSwap, K, hf] - -private theorem helper_sigmaOne_503.{u_1, u_2} : +private theorem helper_incidentFixed_582.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - IsOneEdgeUncolored phi e0 → - ∀ (alpha beta : Fin k), - alpha ≠ beta → + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; let ell : ℕ := T.length - A.length; @@ -1798,195 +1379,45 @@ private theorem helper_sigmaOne_503.{u_1, u_2} : (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → - IsOneEdgeUncolored sigma e0 := by + (∀ v ∈ TreeSequenceVertexSet Tn, Sum.inl v ∉ K) → + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + ∀ (f : E), + TreeIncidentEdge Tn f → + sigma f = phi f := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta hne H q A ib vb ell yLength Y - ha hb K sigma unaffected - clear * - hone sigma K unaffected hne - refine ⟨?_, ?_⟩ - · simp [sigma, TwoColorComponentSwap, hone.1] - · intro f hf - obtain ⟨c, hc⟩ := hone.2 f hf - by_cases ha : c = alpha - · subst c - by_cases hK : Sum.inr f ∈ K - · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ - · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ - · by_cases hb : c = beta - · subst c - by_cases hK : Sum.inr f ∈ K - · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc, hne.symm]⟩ - · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ - · exact ⟨c, (unaffected f c ha hb).mpr hc⟩ + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb ell yLength Y ha hb + K sigma avoidTn fixedValue f hf + clear * - hf sigma K avoidTn fixedValue + obtain ⟨v, hv, hvf⟩ := hf + by_cases hK : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · exact False.elim (avoidTn v hv + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, Or.inl ha⟩)).trans hK)) + · by_cases hb : phi f = some beta + · exact False.elim (avoidTn v hv + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, Or.inr hb⟩)).trans hK)) + · exact fixedValue f ha hb + · simp [sigma, TwoColorComponentSwap, K, hK] -private theorem helper_missingBefore_528.{u_1, u_2} : +private theorem helper_terminalRoute_605.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - alpha ≠ beta → + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let va : V := T.vertex ia; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - va ∈ TreeSequenceVertexSet Y → - vb ∈ TreeSequenceVertexSet Y → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B Y → - let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - Sum.inl va ∉ K → - (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - have phi' : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ - (∀ (v : V), - Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ - (∀ (v : V), - Sum.inl v ∈ C → - beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ - ∀ (v : V) (c : Fin k), - c ≠ alpha → - c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → - (∀ {v : V} {f : E}, - Sum.inl v ∈ K → - Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ K) → - ∀ v ∈ TreeSequenceVertexSet B, - v ≠ vb → - MissingColors G sigma v = MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ia ib va vb ell yLength Y - hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb - by_cases hvK : Sum.inl v ∈ K - · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) - have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv - have han : alpha ∉ MissingColors G phi v := fun hc => - Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 - have hbn : beta ∉ MissingColors G phi v := fun hc => - Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 - have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by - simpa [MissingColors, PresentColors] using han - have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by - simpa [MissingColors, PresentColors] using hbn - obtain ⟨fa, hfa, hfca⟩ := hpa - obtain ⟨fb, hfb, hfcb⟩ := hpb - have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) - have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) - have hnewa : sigma fb = some alpha := by - simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] - have hnewb : sigma fa = some beta := by - simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] - have hana : alpha ∉ MissingColors G sigma v := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, - PresentColors, Finset.mem_filter, not_not] - exact ⟨fb, hfb, hnewa⟩ - have hbnb : beta ∉ MissingColors G sigma v := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, - PresentColors, Finset.mem_filter, not_not] - exact ⟨fa, hfa, hnewb⟩ - ext c - by_cases hca : c = alpha - · subst c; simp [hana, han] - · by_cases hcb : c = beta - · subst c; simp [hbnb, hbn] - · exact behavior.2.2.2 v c hca hcb - · exact behavior.1 v hvK - -private theorem helper_incidentFixed_582.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet Tn, Sum.inl v ∉ K) → - (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → - ∀ (f : E), - TreeIncidentEdge Tn f → - sigma f = phi f := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb ell yLength Y ha hb - K sigma avoidTn fixedValue f hf - clear * - hf sigma K avoidTn fixedValue - obtain ⟨v, hv, hvf⟩ := hf - by_cases hK : Sum.inr f ∈ K - · by_cases ha : phi f = some alpha - · exact False.elim (avoidTn v hv - ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) - from ⟨hvf, Or.inl ha⟩)).trans hK)) - · by_cases hb : phi f = some beta - · exact False.elim (avoidTn v hv - ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) - from ⟨hvf, Or.inr hb⟩)).trans hK)) - · exact fixedValue f ha hb - · simp [sigma, TwoColorComponentSwap, K, hK] - -private theorem helper_terminalRoute_605.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := @@ -2206,70 +1637,6 @@ private theorem helper_edgesFixed_695.{u_1, u_2} : exact incidentFixed _ (displayedIncident Tn (segRefl Tn) _) · exact augmentationFixed t (by omega) -private theorem helper_routeTransport_704.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet B, - v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (S : TreeSequence G e0), - TashkinovAugmentationSequence phi S B → - TashkinovAugmentationSequence sigma S B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb segTrans hAib B BToT - sigma missingBefore edgesFixed S hs - unfold TashkinovAugmentationSequence at hs ⊢ - induction hs using Relation.ReflTransGen.head_induction_on with - | refl => exact Relation.ReflTransGen.refl - | @head U W hstep htail ih => - have hWB := TashkinovAugmentationSequenceInitialSegment phi W B htail - obtain ⟨hlen, hUW, c, hcol, hm⟩ := hstep - have hUB := segTrans hUW hWB - have hlt : U.length < B.length := by have := hWB.1; omega - refine Relation.ReflTransGen.head ⟨hlen, hUW, c, ?_, ?_⟩ ih - · have hf := edgesFixed (Fin.castLE hWB.1 (Fin.cast hlen.symm (Fin.last U.length))) - rw [hWB.2.2] at hf - exact hf.trans hcol - · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm - have hvB := TreeSequenceInitialSegmentVertexSetSubset hUB hv - have hvb : v ≠ vb := by - intro he - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - obtain ⟨i, hi⟩ := hv - have ht := hUB.2.1 i - have htT := BToT.2.1 (Fin.castLE (Nat.succ_le_succ hUB.1) i) - have eqv : T.vertex (Fin.castLE (Nat.succ_le_succ BToT.1) - (Fin.castLE (Nat.succ_le_succ hUB.1) i)) = T.vertex ib := htT.trans (ht.trans - (hi.trans he)) - have hh := congrArg Fin.val (T.vertex_injective eqv) - have := i.isLt - change i.val = ib.val at hh - change U.length < ib.val at hlt - omega - exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [missingBefore v hvB hvb]; exact hcv⟩ - private theorem helper_closureSubset_736.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -2442,173 +1809,6 @@ private theorem helper_stableClosure_758.{u_1, u_2} : exact fixedValue f (fun he => hca (Option.some.inj (hfc.symm.trans he))) (fun he => hcb (Option.some.inj (hfc.symm.trans he))) -private theorem helper_storedS_778.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib vb TnToA hAib B rpB - aboveB strictB belowB genB ettB sigma treeMissingEq corr - rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, - hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ - rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ - cases hr - have heq : series = newSeries := eq_of_heq hs - cases heq - let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ - have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) - have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j - have hm := treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) - unfold Dn TashkinovStoredColors - simp only [ettB, hstored, ← hgen, ← ett.generatingColoring, htree, hm, n, Tn] - -private theorem helper_stageBToB_804.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi) - (HB : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB) - (j : Fin (HB.dividerCount + (2 : ℕ))), - TreeSequenceInitialSegment (HB.stage j) B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib segRefl segTrans hAib B rpB - aboveB strictB belowB genB baseB HB j - clear * - HB j B segRefl segTrans - exact Fin.reverseInduction - (motive := fun j => TreeSequenceInitialSegment (HB.stage j) B) - (by simpa only [HB.terminalStage] using segRefl B) - (fun i hi => segTrans (HB.nested i) hi) j - -private theorem helper_closureBToA_811.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - TreeSequenceInitialSegment base.core A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - baseB.core = base.core → - ett.series.data.kind n = some TashkinovExtensionKind.PE → - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib coreToA hAib B rpB aboveB - strictB belowB genB baseB hcoreB hp - clear * - hp baseB coreToA hcoreB - obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hp - intro v hv - apply TreeSequenceInitialSegmentVertexSetSubset coreToA - rw [← hcoreB, u.vertexSet] - exact Finset.mem_union_right _ hv - private theorem helper_reservedB_819.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -2803,1067 +2003,6 @@ private theorem helper_minusEq_845.{u_1, u_2} : exact ⟨fun hs c hc => (boundaryEq c hc).symm.trans (hs c hc), fun hs c hc => (boundaryEq c hc).trans (hs c hc)⟩ -private theorem helper_storedEq_884.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn → - ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - change TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) \ TreeMissingColors sigma (HierarchyStarredStage HS - j) = - Dn \ TreeMissingColors phi (HierarchyStarredStage HB j) - rw [storedS, starEq, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starBToA j))] - -private theorem helper_missingEq_891.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - refine Fin.cases ?_ (fun i => ?_) j - · change TreeMissingColors sigma (corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn - have htree : corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc = Tn := - hsbase.symm.trans hbbase - rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] - · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) - -private theorem helper_firstLe_902.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), - eta ∈ MissingColors G psi (B.vertex i) → - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib hAib B psi eta i hc - clear * - psi eta i hc - let candidates := Finset.univ.filter fun j => eta ∈ MissingColors G psi (B.vertex j) - have hi : i ∈ candidates := by simp [candidates, hc] - have hn : candidates.Nonempty := ⟨i, hi⟩ - simpa [HierarchyFirstMissingPosition, candidates, hn] using - (show (candidates.min' hn).val ≤ i.val from Finset.min'_le candidates i hi) - -private theorem helper_firstStrict_911.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (psi : PartialEdgeColoring E k) (eta : Fin k), - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → - eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib hAib B psi eta h - clear * - psi eta h - unfold HierarchyFirstMissingPosition at h ⊢ - dsimp only at h ⊢ - split_ifs with hn - · exact (Finset.mem_filter.mp (Finset.min'_mem _ hn)).2 - · simp only [dite_eq_right hn, Fin.val_last] at h - omega - -private theorem helper_firstEq_921.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet B, - v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → - (∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), - eta ∈ MissingColors G psi (B.vertex i) → - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ)) → - (∀ (psi : PartialEdgeColoring E k) (eta : Fin k), - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → - eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta))) → - ∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B BToT sigma - missingBefore firstLe firstStrict eta - have beforeLast (i : Fin (B.length + 1)) (hi : i.val < B.length) : - MissingColors G sigma (B.vertex i) = MissingColors G phi (B.vertex i) := by - apply missingBefore - · simp [TreeSequenceVertexSet] - · intro he - have heT := (BToT.2.1 i).trans he - have heval := congrArg Fin.val (T.vertex_injective heT) - have hbLen : B.length = ib.val := rfl - change i.val = ib.val at heval - omega - apply Fin.ext - apply Nat.le_antisymm - · by_cases h : (HierarchyFirstMissingPosition phi B eta).val < B.length - · apply firstLe sigma eta - rw [beforeLast _ h] - exact firstStrict phi eta h - · have := (HierarchyFirstMissingPosition sigma B eta).isLt - omega - · by_cases h : (HierarchyFirstMissingPosition sigma B eta).val < B.length - · apply firstLe phi eta - rw [← beforeLast _ h] - exact firstStrict sigma eta h - · have := (HierarchyFirstMissingPosition phi B eta).isLt - omega - -private theorem helper_segmentEq_948.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - (∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = - HierarchyFirstMissingPosition phi B eta) → - ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - have hedge (t : Fin (stages j.succ).length) : - sigma ((stages j.succ).edge t) = phi ((stages j.succ).edge t) := by - have hSB := stageBToB j.succ - have hf := edgesFixed (Fin.castLE hSB.1 t) - rw [hSB.2.2] at hf - exact hf - unfold HierarchySegmentColors - simp only [starEq, firstEq eta, HS, HB, hedge] - -private theorem helper_refreshEq_960.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - rw [starEq] - apply Finset.biUnion_congr rfl - intro v hv - exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ) - (Finset.mem_sdiff.mp hv).1) - -private theorem helper_hstarLast_1016.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (hcountB : - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount = - H.dividerCount), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc = - H.stage jo.castSucc ∧ - HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j = - HierarchyStarredStage H jo) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - HierarchyStarredStage HS (Fin.last count) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested - hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - rw [starEq] - have hs := (hstagesB (Fin.last count)).2 - have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := - Fin.ext (by simp [q]) - simpa only [hj] using hs - -private theorem helper_pathLe_1028.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let _ : ℕ := T.length - A.length; - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - A.length < B.length → - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - HierarchyStarredStage HS (Fin.last count) = A → - HierarchyPathNumber HS ≤ HierarchyPathNumber H := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell AToT hAib B BToT - ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - let tailB := B.length - A.length - let candidatesT := (Finset.Icc 1 ell).filter fun i => - ∀ t : Fin T.length, A.length + i ≤ t.val → - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) - let candidatesB := (Finset.Icc 1 tailB).filter fun i => - ∀ t : Fin B.length, A.length + i ≤ t.val → - G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) - have htail : 1 ≤ tailB := by dsimp [tailB]; omega - have htailT : 1 ≤ ell := by dsimp [ell]; omega - have htmem : ell ∈ candidatesT := by - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htailT, le_rfl⟩, ?_⟩ - intro t ht - have hAT := AToT.1 - have := t.isLt - dsimp [ell] at ht - omega - have hbmem : tailB ∈ candidatesB := by - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htail, le_rfl⟩, ?_⟩ - intro t ht - have := t.isLt - dsimp [tailB] at ht - omega - have hnT : candidatesT.Nonempty := ⟨ell, htmem⟩ - have hnB : candidatesB.Nonempty := ⟨tailB, hbmem⟩ - have hmT := Finset.min'_mem candidatesT hnT - have hbounds := Finset.mem_Icc.mp (Finset.mem_filter.mp hmT).1 - have hminB : candidatesB.min' hnB ≤ candidatesT.min' hnT := by - by_cases ht : candidatesT.min' hnT ≤ tailB - · apply Finset.min'_le - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hbounds.1, ht⟩, ?_⟩ - intro t hpos - have he := (Finset.mem_filter.mp hmT).2 (Fin.castLE BToT.1 t) hpos - have hv0 := BToT.2.1 t.castSucc - have hv1 := BToT.2.1 t.succ - have hi0 : (Fin.castLE BToT.1 t).castSucc = - Fin.castLE (Nat.succ_le_succ BToT.1) t.castSucc := Fin.ext rfl - have hi1 : (Fin.castLE BToT.1 t).succ = - Fin.castLE (Nat.succ_le_succ BToT.1) t.succ := Fin.ext rfl - simpa only [BToT.2.2, hi0, hi1, hv0, hv1] using he - · exact le_trans (Finset.min'_le candidatesB tailB hbmem) (by omega) - unfold HierarchyPathNumber - rw [hstarLast] - change (if h : candidatesB.Nonempty then candidatesB.min' h else tailB) ≤ - (if h : candidatesT.Nonempty then candidatesT.min' h else ell) - rw [dite_eq_left hnB, dite_eq_left hnT] - exact hminB - private theorem helper_storedEq_3219.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -4032,7 +2171,8 @@ private theorem helper_storedEq_3219.{u_1, u_2} : hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq j - exact helper_storedEq_884 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.storedColorsEquality (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) @@ -4203,7 +2343,8 @@ private theorem helper_missingEq_3228.{u_1, u_2} : hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS j - exact helper_missingEq_891 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.missingColorsEquality (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) @@ -4374,7 +2515,8 @@ private theorem helper_segmentEq_3255.{u_1, u_2} : hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq firstEq j eta - exact helper_segmentEq_948 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.initialSegmentEquality (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) @@ -4546,7 +2688,8 @@ private theorem helper_refreshEq_3265.{u_1, u_2} : strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact helper_refreshEq_960 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.refreshedHierarchyEquality (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) @@ -4751,7 +2894,8 @@ private theorem helper_hstarLast_3322.{u_1, u_2} : strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - exact helper_hstarLast_1016 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.lastStarredStageEquality (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) @@ -4765,7 +2909,8 @@ private theorem helper_pathLe_3336.{u_1, u_2} : intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb AToT hAib B BToT ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - exact helper_pathLe_1028 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.pathLengthUpperBound (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) @@ -4810,18 +2955,21 @@ private theorem helper_continuation_4887.{u_1, u_2} : have firstLe (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + 1)) (hc : eta ∈ MissingColors G psi (B.vertex i)) : (HierarchyFirstMissingPosition psi B eta).val ≤ i.val := by - exact helper_firstLe_902 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.firstMissingPositionUpperBound (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@psi) (@eta) (@i) (@hc) have firstStrict (psi : PartialEdgeColoring E k) (eta : Fin k) (h : (HierarchyFirstMissingPosition psi B eta).val < B.length) : eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by - exact helper_firstStrict_911 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.MixedChangeTransport.beforeFirstMissingPosition (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@psi) (@eta) (@h) have firstEq (eta : Fin k) : HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by - exact helper_firstEq_921 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.firstMissingPositionEquality (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@BToT) (@missingBefore) (@firstLe) (@firstStrict) (@eta) have segmentEq (j : Fin (count + 1)) (eta : Fin k) @@ -5319,7 +3467,8 @@ private theorem helper_continuation_5697.{u_1, u_2} : obtain ⟨corr, hMPS, baseS, HS, hsame⟩ := replacement have storedS : TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = Dn := by - exact helper_storedS_778 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.storedColorsAtReplacementStage (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@treeMissingEq) (@corr) have hrS : corr.replacementETT.rounds = ett.rounds := corr.rungAgreement @@ -5335,10 +3484,11 @@ private theorem helper_continuation_5697.{u_1, u_2} : exact starredToA _ have stageBToB (j : Fin (HB.dividerCount + 2)) : TreeSequenceInitialSegment (HB.stage j) B := by - apply helper_stageBToB_804 <;> assumption + apply SharedFacts.MixedChangeTransport.replacementStageInitialSegmentOfPrefix <;> assumption have closureBToA (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE) : TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by - exact helper_closureBToA_811 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.MixedChangeTransport.closureInitialSegmentOfStarredStage (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@hcoreB) (@hp) have reservedB (i : Fin HB.dividerCount) : @@ -5411,7 +3561,8 @@ private theorem helper_continuation_2989.{u_1, u_2} : have hbetaA : beta ∉ TreeMissingColors phi A := missingNotA beta ib hb.1 hbY hout.2 have horder := horderedUnused (Or.inr hbetaA) have habIndex : ia.val < ib.val := by - exact helper_habIndex_353 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.distinctMissingPositionIndices (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@horder) have havb : va ≠ vb := by clear * - habIndex @@ -5427,7 +3578,8 @@ private theorem helper_continuation_2989.{u_1, u_2} : have ABstrict : A.length < B.length := hAib have BToY : TreeSequenceInitialSegment B Y := commonPrefix BToT YToT hb.2 have BstrictT : B.length < T.length := by - exact helper_BstrictT_372 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.prefixStrictlyShorterThanFinalTree (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) (@ABstrict) (@BToY) obtain ⟨ettB, hMPB, hrB, hsB, baseB, hcoreB, hclosureB, hsupportB, @@ -5491,7 +3643,8 @@ private theorem helper_continuation_2989.{u_1, u_2} : exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj).trans hv have unaffected (f : E) (c : Fin k) (hca : c ≠ alpha) (hcb : c ≠ beta) : sigma f = some c ↔ phi f = some c := by - exact helper_unaffected_486 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact SharedFacts.MixedChangeTransport.otherColorsUnaffected (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@ha) (@hb) (@f) (@c) (@hca) (@hcb) have fixedValue (f : E) (ha : phi f ≠ some alpha) (hb : phi f ≠ some beta) : @@ -5501,7 +3654,8 @@ private theorem helper_continuation_2989.{u_1, u_2} : have sigmaProper : IsProperEdgeColoring G sigma := TwoColorComponentSwapProper G phi alpha beta hne hproper _ have sigmaOne : IsOneEdgeUncolored sigma e0 := by - exact helper_sigmaOne_503 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hone) + exact SharedFacts.MixedChangeTransport.swappedColoringOneUncolored (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@hone) (@alpha) (@beta) (@hne) (@ha) (@hb) (@unaffected) have vertexB (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : @@ -5514,7 +3668,8 @@ private theorem helper_continuation_2989.{u_1, u_2} : -- Elementarity fixes missing sets before the swapped endpoint, even inside its component. have missingBefore (v : V) (hv : v ∈ TreeSequenceVertexSet B) (hvb : v ≠ vb) : MissingColors G sigma v = MissingColors G phi v := by - exact @helper_missingBefore_528 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.notMissingBeforeFirstPosition (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@hElementaryY) (@ha) (@hb) (@haY) (@hbY) (@hAib) (@BToY) (@haK) (@behavior) (@edgeOfVertex) (@v) (@hv) (@hvb) @@ -5566,7 +3721,8 @@ private theorem helper_continuation_2989.{u_1, u_2} : (@segRefl) (@hAib) (@incidentFixed) (@TnToB) (@displayedIncident) (@augmentationFixed) (@t) have routeTransport (S : TreeSequence G e0) (hs : TashkinovAugmentationSequence phi S B) : TashkinovAugmentationSequence sigma S B := by - exact @helper_routeTransport_704 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.routeTransport (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@segTrans) (@hAib) (@BToT) (@missingBefore) (@edgesFixed) (@S) (@hs) have closureSubset : TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by @@ -5696,36 +3852,41 @@ theorem ChangeLemmaMixedNoClosed {V E : Type*} (hSU : TreeSequenceInitialSegment S U) (hUW : TreeSequenceInitialSegment U W) : TreeSequenceInitialSegment S W := by - exact helper_segTrans_202 (@G) (@e0) (@hSU) (@hUW) + exact SharedFacts.MixedChangeTransport.initialSegmentTransitive (@G) (@e0) (@hSU) (@hUW) have commonPrefix {S U W : TreeSequence G e0} (hSW : TreeSequenceInitialSegment S W) (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : TreeSequenceInitialSegment S U := by - exact helper_commonPrefix_212 (@G) (@e0) (@hSW) (@hUW) (@hlen) + exact SharedFacts.MixedChangeTransport.comparableInitialSegments (@G) (@e0) (@hSW) (@hUW) + (@hlen) have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) (H.stage ⟨a + d, by omega⟩) := by - apply helper_stageSegment_222 <;> assumption + apply SharedFacts.MixedChangeTransport.stageInitialSegment <;> assumption have stageToT (j : Fin (H.dividerCount + 2)) : TreeSequenceInitialSegment (H.stage j) T := by - exact helper_stageToT_230 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.MixedChangeTransport.stageInitialSegmentOfFinalTree (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@stageSegment) (@j) have lastZero (hz : H.dividerCount = 0) : A = base.core := by clear * - hz A q simp [A, q, HierarchyStarredStage, hz, Fin.last] have lastPositive (hz : H.dividerCount ≠ 0) : A = H.stage ⟨H.dividerCount, by omega⟩ := by - exact helper_lastPositive_241 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hz) + exact SharedFacts.MixedChangeTransport.lastStagePositive (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@hz) have coreToA : TreeSequenceInitialSegment base.core A := by - apply helper_coreToA_253 <;> assumption + apply SharedFacts.MixedChangeTransport.coreInitialSegmentOfStarredStage <;> assumption have TnToCore : TreeSequenceInitialSegment Tn base.core := by - exact helper_TnToCore_262 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@segRefl) + exact SharedFacts.MixedChangeTransport.terminalStageInitialSegmentOfCore (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@segRefl) have TnToA := segTrans TnToCore coreToA have AToT : TreeSequenceInitialSegment A T := by - apply helper_AToT_269 <;> assumption + apply SharedFacts.MixedChangeTransport.starredStageInitialSegmentOfFinalTree <;> assumption have ordinaryToA (j : Fin (H.dividerCount + 1)) : TreeSequenceInitialSegment (H.stage j.castSucc) A := by - exact helper_ordinaryToA_276 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.MixedChangeTransport.ordinaryStageInitialSegmentOfStarredStage (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@stageSegment) (@lastZero) (@lastPositive) (@TnToA) (@j) have starredToA (j : Fin (H.dividerCount + 1)) : @@ -5740,7 +3901,8 @@ theorem ChangeLemmaMixedNoClosed {V E : Type*} have firstMissing (c : Fin k) (hc : c ∈ TreeMissingColors phi Y) : c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ (HierarchyFirstMissingPosition phi T c).val ≤ Y.length := by - exact helper_firstMissing_296 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.MixedChangeTransport.firstMissingPositionWitness (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@YToT) (@c) (@hc) have ha := firstMissing alpha hmissingY.1 have hb := firstMissing beta hmissingY.2 @@ -5754,7 +3916,8 @@ theorem ChangeLemmaMixedNoClosed {V E : Type*} have hout : va ∈ TreeSequenceVertexSet A ∧ vb ∉ TreeSequenceVertexSet A := hlocation have outsideIndex (i : Fin (T.length + 1)) (hi : T.vertex i ∉ TreeSequenceVertexSet A) : A.length < i.val := by - exact helper_outsideIndex_328 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.MixedChangeTransport.missingPositionOutsidePrefix (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@AToT) (@i) (@hi) have hAib := outsideIndex ib hout.2 have AToY : TreeSequenceInitialSegment A Y := @@ -5763,7 +3926,8 @@ theorem ChangeLemmaMixedNoClosed {V E : Type*} (hmi : c ∈ MissingColors G phi (T.vertex i)) (hiy : T.vertex i ∈ TreeSequenceVertexSet Y) (hia : T.vertex i ∉ TreeSequenceVertexSet A) : c ∉ TreeMissingColors phi A := by - exact helper_missingNotA_339 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.MixedChangeTransport.colorNotMissingOnStarredStage (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@hElementaryY) (@AToY) (@c) (@i) (@hmi) (@hiy) (@hia) apply helper_continuation_2989 <;> assumption diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean index 53e13bfbb5..20e72da19e 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ZeroNonclosedTransport + public import LeanPool.GoldbergSeymour.GoodHierarchyTerminalPrefixRepackage public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyCounterexampleMeasure @@ -1295,19 +1297,6 @@ private theorem helper_hcombined_604.{u_1, u_2} : (fun hm => Finset.disjoint_left.mp hd (by simp) hm), stableOutside base.closure ∅ (outsideFromInterchange base.closure hvaR hi)⟩ -private theorem helper_commonPrefix_629.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y - Z → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by - classical - intro V E G e0 X Y Z hXZ hYZ hXY - refine ⟨hXY, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) - private theorem helper_hroute_652.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] @@ -2453,7 +2442,8 @@ private theorem helper_caseContinuation_2060.{u_1, u_2} : have commonPrefix {X Y Z : TreeSequence G e0} (hXZ : TreeSequenceInitialSegment X Z) (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : TreeSequenceInitialSegment X Y := by - exact helper_commonPrefix_629 (@G) (@e0) (@hXZ) (@hYZ) (@hXY) + exact SharedFacts.ZeroNonclosedTransport.comparableInitialSegments (@G) (@e0) (@hXZ) + (@hYZ) (@hXY) have hAib : A.length < ib.val := by have hi := (prefixPosition hAT ib).not.mp hvbA omega diff --git a/LeanPool/GoldbergSeymour/DisplayedEdges.lean b/LeanPool/GoldbergSeymour/DisplayedEdges.lean index 2a7454098c..e7cd4d6939 100644 --- a/LeanPool/GoldbergSeymour/DisplayedEdges.lean +++ b/LeanPool/GoldbergSeymour/DisplayedEdges.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.BaseControl + public import LeanPool.GoldbergSeymour.HierarchyOrderedExitReduction public import LeanPool.GoldbergSeymour.BaseDisplayedEdges public import LeanPool.GoldbergSeymour.TerminalRoute @@ -153,20 +155,6 @@ private theorem P2813_T1_DisplayedEdges_branch_320.{u_1, u_2} : exact hnStable.1 f hincident hcontrol · exact fixedValue _ ha hb -private theorem helper_trans_227.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W - Z → TreeSequenceInitialSegment U Z := by - classical - intro V E G e0 U W Z hUW hWZ - refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ - · intro j - exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) j)).trans - (hUW.2.1 j) - · intro j - exact (hWZ.2.2 (Fin.castLE hUW.1 j)).trans (hUW.2.2 j) - private theorem helper_stageChain_238.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -422,7 +410,7 @@ theorem P2813_T1_DisplayedEdges {V E : Type*} (min (A.length + ((T.length - A.length) - 1)) T.length) (by have hA := A.positive; have hT := T.positive; omega) (Nat.min_le_right _ _) - have trans := @helper_trans_227 (@V) (@E) (@G) (@e0) + have trans := @SharedFacts.BaseControl.trans (@V) (@E) (@G) (@e0) have stageChain := @helper_stageChain_238 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@H) (@trans) have starStage (r : Fin (H.dividerCount + 1)) : diff --git a/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean b/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean index 95b8524259..6fcfc592db 100644 --- a/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean +++ b/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean @@ -5,6 +5,9 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.SubcaseThreeOnePreparation1 + + public import LeanPool.GoldbergSeymour.TerminalRoute public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices public import LeanPool.GoldbergSeymour.HierarchySplitter @@ -3295,20 +3298,10 @@ theorem helper_hpUpper_1652.{u_1, u_2} : rw [hAold] at hh exact hh +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_trans_1665.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → - TreeSequenceInitialSegment X Z := by - classical - intro V E G e0 X Y Z hXY hYZ - refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + SharedFacts.SubcaseThreeOnePreparation1.initialSegmentTransitiveStatement.{u_1, u_2} := + SharedFacts.SubcaseThreeOnePreparation1.initialSegmentTransitive.{u_1, u_2} theorem helper_hTnCore_1684.{u_1, u_2} : open scoped Classical in @@ -4235,119 +4228,6 @@ theorem helper_earlyMissing_2244.{u_1, u_2} : simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] exact ⟨i, by rw [← he, hXB.2.1 i]⟩ -theorem helper_firstLe_2252.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := TreeSequence.positive T - omega) - (by - have := TreeSequence.positive T - omega); - ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (B.length + (1 : ℕ))), - c ∈ MissingColors G psi (B.vertex j) → - (↑(HierarchyFirstMissingPosition psi B c) : ℕ) ≤ (↑j : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hlenT B psi c j hj - let candidates := Finset.univ.filter fun j : Fin (B.length + 1) => - c ∈ MissingColors G psi (B.vertex j) - have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ - have hn : candidates.Nonempty := ⟨j, hm⟩ - unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - exact Finset.min'_le candidates j hm - -theorem helper_firstMem_2262.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := TreeSequence.positive T - omega) - (by - have := TreeSequence.positive T - omega); - B.length = T.length - (1 : ℕ) → - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (_ : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (psi : PartialEdgeColoring E k) (c : Fin k), - (↑(HierarchyFirstMissingPosition psi B c) : ℕ) < B.length → - c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B hBlength S hSBlen positiveB - aboveB strictB belowB generatingB baseB HB psi c hlt - let candidates := Finset.univ.filter fun j : Fin (B.length + 1) => - c ∈ MissingColors G psi (B.vertex j) - by_cases hn : candidates.Nonempty - · unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - · have hh : (HierarchyFirstMissingPosition psi B c).val = B.length := by - unfold HierarchyFirstMissingPosition - rw [dite_eq_right hn] - rfl - omega - theorem helper_segmentEq_2283.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean index 27b4e9e6fc..c8136905c8 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean @@ -5,14 +5,15 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBranches + +public import LeanPool.GoldbergSeymour.SharedFacts.ParallelSupportClosureProperties + public import LeanPool.GoldbergSeymour.CertifiedETTRestriction public import LeanPool.GoldbergSeymour.ExtensionBaseClaim45Singleton public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace public import LeanPool.GoldbergSeymour.TechnicalTheoremBase -public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable public import LeanPool.GoldbergSeymour.InternalEdges @@ -1389,31 +1390,8 @@ private theorem helper_transportStep_1463.{u_1, u_2} : exact haddedFixed.trans hcolor private theorem helper_commonPrefix_1530.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B - C → A.length ≤ B.length → TreeSequenceInitialSegment A B := by - classical - intro V E G e0 A B C hAC hBC hlen - rcases hAC with ⟨hACLen, hACVertices, hACEdges⟩ - rcases hBC with ⟨hBCLen, hBCVertices, hBCEdges⟩ - refine ⟨hlen, ?_, ?_⟩ - · intro i - calc - B.vertex (Fin.castLE (Nat.succ_le_succ hlen) i) = - C.vertex (Fin.castLE (Nat.succ_le_succ hBCLen) - (Fin.castLE (Nat.succ_le_succ hlen) i)) := - (hBCVertices _).symm - _ = C.vertex (Fin.castLE (Nat.succ_le_succ hACLen) i) := by - congr 1 - _ = A.vertex i := hACVertices i - · intro i - calc - B.edge (Fin.castLE hlen i) = - C.edge (Fin.castLE hBCLen (Fin.castLE hlen i)) := - (hBCEdges _).symm - _ = C.edge (Fin.castLE hACLen i) := by congr 1 - _ = A.edge i := hACEdges i + SharedFacts.ParallelSupportClosureProperties.comparableInitialSegmentsStatement.{u_1, u_2} := + SharedFacts.ParallelSupportClosureProperties.comparableInitialSegments.{u_1, u_2} private theorem helper_hvNotPrevious_1574.{u_1, u_2} : open scoped Classical in @@ -2272,69 +2250,8 @@ private theorem helper_hpreviousStrict_2394.{u_1, u_2} : exact hvertex.symm.trans hterminalAt private theorem helper_branch_2422.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), - let _ : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( - ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : - TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A - B)) (_ : (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))).length = (1 : ℕ)) (_ : - TashkinovClosure (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) - (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (1 : Fin - (ett.rounds + (2 : ℕ))))) (_ : jSlot.castSucc = (0 : Fin (ett.rounds + (1 : ℕ)))), - TashkinovAugmentationSequence (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) - seed (ett.series.data.tree jSlot.succ.castSucc) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed - hseedTj commonPrefix seedLength initialClosure htarget - have htargetZero : jSlot.val = 0 := by - have := congrArg Fin.val htarget - simpa using this - have htreeOne : ett.series.data.tree 1 = - ett.series.data.tree jSlot.succ.castSucc := by - congr 1 - apply Fin.ext - simp [htargetZero] - have hinitialTj : TreeSequenceInitialSegment - (ett.series.data.tree 0) - (ett.series.data.tree jSlot.succ.castSucc) := by - have h := TashkinovAugmentationSequenceInitialSegment _ _ _ - initialClosure.1 - rw [htreeOne] at h - exact h - have hbaseSeed : TreeSequenceInitialSegment - (ett.series.data.tree 0) seed := by - apply commonPrefix hinitialTj hseedTj - rw [seedLength] - exact seed.positive - have hrouteOld : TashkinovAugmentationSequence - (ett.series.data.coloring 0) (ett.series.data.tree 0) - (ett.series.data.tree jSlot.succ.castSucc) := by - rw [← htreeOne] - exact initialClosure.1 - have hroute := TashkinovAugmentationSequenceSuffix - (ett.series.data.coloring 0) (ett.series.data.tree 0) seed - (ett.series.data.tree jSlot.succ.castSucc) hrouteOld hbaseSeed - hseedTj - simpa [htargetZero] using hroute + SharedFacts.ExtensionBranches.branchStatement.{u_1, u_2} := + SharedFacts.ExtensionBranches.branch.{u_1, u_2} private theorem helper_branch_2455.{u_1, u_2} : open scoped Classical in @@ -2535,39 +2452,8 @@ private theorem helper_branch_2512.{u_1, u_2} : hadjoinedSeed hseedTj) private theorem helper_equalPrefixes_2607.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {A B D : TreeSequence G e0}, TreeSequenceInitialSegment A D → TreeSequenceInitialSegment B - D → A.length = B.length → A = B := by - classical - intro V E G e0 A B D hAD hBD hlen - rcases hAD with ⟨hlenAD, hvertexAD, hedgeAD⟩ - rcases hBD with ⟨hlenBD, hvertexBD, hedgeBD⟩ - cases A with - | mk alen apos avertex aedge avinj aeinf afirst aattach => - cases B with - | mk blen bpos bvertex bedge bvinj beinj bfirst battach => - simp only at hlen - subst blen - rw [TreeSequence.mk.injEq] - refine ⟨rfl, ?_, ?_⟩ - · apply heq_of_eq - funext i - calc - avertex i = D.vertex - (Fin.castLE (Nat.succ_le_succ hlenAD) i) := - (hvertexAD i).symm - _ = D.vertex - (Fin.castLE (Nat.succ_le_succ hlenBD) i) := by - congr 1 - _ = bvertex i := hvertexBD i - · apply heq_of_eq - funext i - calc - aedge i = D.edge (Fin.castLE hlenAD i) := - (hedgeAD i).symm - _ = D.edge (Fin.castLE hlenBD i) := by congr 1 - _ = bedge i := hedgeBD i + SharedFacts.ExtensionBranches.equalPrefixesStatement.{u_1, u_2} := + SharedFacts.ExtensionBranches.equalPrefixes.{u_1, u_2} private theorem helper_hiSeed_2699.{u_1, u_2} : open scoped Classical in @@ -2767,11 +2653,24 @@ private theorem helper_transportSeedStep2_2940.{u_1, u_2} : exact haddedFixed.trans hcolor private theorem helper_branch_3050.{u_1, u_2} : + SharedFacts.ExtensionBranches.branch3050Statement.{u_1, u_2} := + SharedFacts.ExtensionBranches.branch3050.{u_1, u_2} + +private theorem helper_branch_3107.{u_1, u_2} : + SharedFacts.ExtensionBranches.branch3107Statement.{u_1, u_2} := + SharedFacts.ExtensionBranches.branch3107.{u_1, u_2} + +private theorem helper_branch_3129.{u_1, u_2} : + SharedFacts.ExtensionBranches.branch3129Statement.{u_1, u_2} := + SharedFacts.ExtensionBranches.branch3129.{u_1, u_2} + +private theorem helper_hstablePrevious_3232.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega ⟩ : Fin ett.rounds); @@ -2781,97 +2680,64 @@ private theorem helper_branch_3050.{u_1, u_2} : let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ + TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin + (p0 + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed - (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( - ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : - TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A - B)), + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 + indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); + ∀ (_ : StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) (traceB.coloring (Fin.last traceB.steps))), let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; ∀ (_ : ( - ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) - (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree - i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) - (ett.series.data.coloring i.castSucc)) (_ : ett.series.data.connectingEdges i.succ = - { choice.edge }) (_ : ett.series.data.kind i.succ = some TashkinovExtensionKind.SE) - (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree - i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring - i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), - ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ - (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind - i.succ = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ - TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence - (ett.series.data.coloring i.succ) adjoinSeed seed := by + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (_ : ( + ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) + {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore (ett.series.data.tree + jSlot.succ.castSucc) v hterminalJ)) (_ : (0 : ℕ) < (↑jSlot : ℕ)), StableColoring Tprevious + (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring + jSlot.castSucc) rho2 := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed - hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict hjPositive i choice currentEdges - currentKind adjoined adjoinedExactly closedExtension htarget - have hi : i.succ = jSlot.castSucc := htarget.symm - have hroute : TashkinovAugmentationSequence - (ett.series.data.coloring jSlot.castSucc) adjoined - (ett.series.data.tree jSlot.succ.castSucc) := by - have h := closedExtension.1 - rw [hi, hjTreeIndex] at h - exact h - have hadjoinedTj : TreeSequenceInitialSegment adjoined - (ett.series.data.tree jSlot.succ.castSucc) := - TashkinovAugmentationSequenceInitialSegment _ _ _ hroute - have hadjoinedLength : adjoined.length ≤ seed.length := by - rcases adjoinedExactly with ⟨hlen, -, -⟩ - have hiCast : i.succ.castSucc = - jSlot.castSucc.castSucc := by - apply Fin.ext - simpa using congrArg Fin.val hi - have hprev : ett.series.data.tree i.succ.castSucc = - Tprevious := by rw [hiCast] - rw [hprev] at hlen - rw [hlen] - exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) - have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := - commonPrefix hadjoinedTj hseedTj hadjoinedLength - right - refine ⟨Or.inl (by simpa [htarget] using currentKind), - choice.edge, adjoined, ?_, ?_, ?_⟩ - · simpa [htarget] using currentEdges - · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ - have hiCast : i.castSucc.succ = - jSlot.castSucc.castSucc := by - apply Fin.ext - simpa using congrArg Fin.val hi - have hlenNew : adjoined.length = Tprevious.length + 1 := by - simpa [Tprevious, hiCast] using hlen - have hsegmentNew : - TreeSequenceInitialSegment Tprevious adjoined := by - simpa [Tprevious, hiCast] using hsegment - refine ⟨hlenNew, hsegmentNew, ?_⟩ - have haddedIndex : - Fin.cast hlenNew.symm (Fin.last Tprevious.length) = - Fin.cast hlen.symm - (Fin.last - (ett.series.data.tree i.succ.castSucc).length) := by - apply Fin.ext - simp [Tprevious, hiCast] - rw [haddedIndex] - exact hedge - · simpa [hi] using - (TashkinovAugmentationSequenceRestrict - (ett.series.data.coloring jSlot.castSucc) adjoined seed - (ett.series.data.tree jSlot.succ.castSucc) hroute - hadjoinedSeed hseedTj) + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace hterminalJ p0 indices0 rho1 terminalPosition + hterminalPositionPositive hterminalPositionBound seed u b traceB rho2 c1 Tprevious + hpreviousStrict hpreviousSeed segmentVertexBeforeJ hjPositive + constructor + · intro f hfIncident hfControlled + obtain ⟨x, hxPrevious, hxf⟩ := hfIncident + apply c1.1 f + ⟨x, segmentVertexBeforeJ (hpreviousSeed hjPositive) + (hpreviousStrict hjPositive) hxPrevious, hxf⟩ + obtain ⟨color, hcControlled, hfc⟩ := hfControlled + refine ⟨color, ?_, hfc⟩ + rcases Finset.mem_union.mp hcControlled with hcMissing | hcStored + · apply Finset.mem_union_left + unfold TreeMissingColors at hcMissing + obtain ⟨z, hzPrevious, hcz⟩ := + Finset.mem_biUnion.mp hcMissing + exact Finset.mem_biUnion.mpr + ⟨z, segmentVertexBeforeJ (hpreviousSeed hjPositive) + (hpreviousStrict hjPositive) hzPrevious, hcz⟩ + · exact Finset.mem_union_right _ hcStored + · intro x hxPrevious + exact c1.2 x + (segmentVertexBeforeJ (hpreviousSeed hjPositive) + (hpreviousStrict hjPositive) hxPrevious) -private theorem helper_branch_3107.{u_1, u_2} : +private theorem helper_hcorrNonempty_3307.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega ⟩ : Fin ett.rounds); @@ -2881,51 +2747,65 @@ private theorem helper_branch_3107.{u_1, u_2} : let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega ⟩ : Fin ett.rounds); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed - (ett.series.data.tree jSlot.succ.castSucc)), + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + + (1 : ℕ)) → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 + indices0 b), + let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; - ∀ (_ : ( - ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (_ : (0 : ℕ) < - (↑jSlot : ℕ)) (i : Fin ett.rounds) (_ : ett.series.data.kind i.succ = some - TashkinovExtensionKind.PE) (_ : TashkinovClosure (ett.series.data.coloring i.succ) - (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree i.succ.succ)) (_ : - jSlot.castSucc = i.succ), ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ - (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind - i.succ = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ - TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence - (ett.series.data.coloring i.succ) adjoinSeed seed := by + ∀ (C : TreeSequence G e0) (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree + (⟨(↑jSlot : ℕ) + (1 : ℕ), + by omega + ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑jSlot : ℕ), + by omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))), + let nLower : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; + ∀ (_ : lower.series.data.tree nLower.castSucc = Tprevious) (_ : ModColoring lower rho2) (_ : + TreeSequenceInitialSegment Tprevious C) (_ : Tprevious.length < C.length) (_ : + (lower.series.data.kind nLower = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho2 Tprevious C ∨ (lower.series.data.kind nLower = some + TashkinovExtensionKind.SE ∨ lower.series.data.kind nLower = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), lower.series.data.connectingEdges nLower = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence rho2 + adjoinSeed C)), Nonempty (CorrespondingExtendedTashkinovTree G k e0 lower rho2 C) := by classical - intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed - hjTreeIndex hseedTj Tprevious hpreviousSeed hjPositive i currentKind closedExtension htarget - have hi : i.succ = jSlot.castSucc := htarget.symm - have hroute : TashkinovAugmentationSequence - (ett.series.data.coloring jSlot.castSucc) Tprevious - (ett.series.data.tree jSlot.succ.castSucc) := by - have h := closedExtension.1 - rw [hi, hjTreeIndex] at h - simpa [Tprevious, hi] using h - left - refine ⟨by simpa [htarget] using currentKind, ?_⟩ - simpa [hi] using - (TashkinovAugmentationSequenceRestrict - (ett.series.data.coloring jSlot.castSucc) Tprevious seed - (ett.series.data.tree jSlot.succ.castSucc) hroute - (hpreviousSeed hjPositive) hseedTj) + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace p0 indices0 rho1 u b traceB rho2 Tprevious C lower + nLower hLowerTree hmod hPreviousC hPreviousStrictC hLowerEligible + have hmod' := hmod + unfold ModColoring at hmod' + dsimp only at hmod' + apply hmod'.2.2 C + · rw [hLowerTree] + exact hPreviousC + · rw [hLowerTree] + exact hPreviousStrictC + · change + (lower.series.data.kind nLower = + some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence rho2 + (lower.series.data.tree nLower.castSucc) C) ∨ + ((lower.series.data.kind nLower = + some TashkinovExtensionKind.SE ∨ + lower.series.data.kind nLower = + some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), + lower.series.data.connectingEdges nLower = {f} ∧ + TreeSequenceAdjoinEdge + (lower.series.data.tree nLower.castSucc) f adjoinSeed ∧ + TashkinovAugmentationSequence rho2 adjoinSeed C) + rw [hLowerTree] + exact hLowerEligible -private theorem helper_branch_3129.{u_1, u_2} : +private theorem helper_hbound_3342.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (v : + V) (sigma : PartialEdgeColoring E k), let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega ⟩ : Fin ett.rounds); @@ -2935,245 +2815,10 @@ private theorem helper_branch_3129.{u_1, u_2} : let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega ⟩ : Fin ett.rounds); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed - (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( - ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : - TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A - B)), - let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; - ∀ (_ : ( - ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) - (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data - i.castSucc) (_ : ett.series.data.connectingEdges i.succ = { available.edge }) (_ : - ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) (adjoined : TreeSequence G - e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) available.edge - adjoined) (_ : TashkinovClosure (ett.series.data.coloring i.succ) adjoined - (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), ett.series.data.kind - i.succ = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence - (ett.series.data.coloring i.succ) Tprevious seed ∨ (ett.series.data.kind i.succ = some - TashkinovExtensionKind.SE ∨ ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) - ∧ - ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ - TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence - (ett.series.data.coloring i.succ) adjoinSeed seed := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed - hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict hjPositive i available - currentEdges currentKind adjoined adjoinedExactly closedExtension htarget - have hi : i.succ = jSlot.castSucc := htarget.symm - have hroute : TashkinovAugmentationSequence - (ett.series.data.coloring jSlot.castSucc) adjoined - (ett.series.data.tree jSlot.succ.castSucc) := by - have h := closedExtension.1 - rw [hi, hjTreeIndex] at h - exact h - have hadjoinedTj : TreeSequenceInitialSegment adjoined - (ett.series.data.tree jSlot.succ.castSucc) := - TashkinovAugmentationSequenceInitialSegment _ _ _ hroute - have hadjoinedLength : adjoined.length ≤ seed.length := by - rcases adjoinedExactly with ⟨hlen, -, -⟩ - have hiCast : i.succ.castSucc = - jSlot.castSucc.castSucc := by - apply Fin.ext - simpa using congrArg Fin.val hi - have hprev : ett.series.data.tree i.succ.castSucc = - Tprevious := by rw [hiCast] - rw [hprev] at hlen - rw [hlen] - exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) - have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := - commonPrefix hadjoinedTj hseedTj hadjoinedLength - right - refine ⟨Or.inr (by simpa [htarget] using currentKind), - available.edge, adjoined, ?_, ?_, ?_⟩ - · simpa [htarget] using currentEdges - · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ - have hiCast : i.castSucc.succ = - jSlot.castSucc.castSucc := by - apply Fin.ext - simpa using congrArg Fin.val hi - have hlenNew : adjoined.length = Tprevious.length + 1 := by - simpa [Tprevious, hiCast] using hlen - have hsegmentNew : - TreeSequenceInitialSegment Tprevious adjoined := by - simpa [Tprevious, hiCast] using hsegment - refine ⟨hlenNew, hsegmentNew, ?_⟩ - have haddedIndex : - Fin.cast hlenNew.symm (Fin.last Tprevious.length) = - Fin.cast hlen.symm - (Fin.last - (ett.series.data.tree i.succ.castSucc).length) := by - apply Fin.ext - simp [Tprevious, hiCast] - rw [haddedIndex] - exact hedge - · simpa [hi] using - (TashkinovAugmentationSequenceRestrict - (ett.series.data.coloring jSlot.castSucc) adjoined seed - (ett.series.data.tree jSlot.succ.castSucc) hroute - hadjoinedSeed hseedTj) - -private theorem helper_hstablePrevious_3232.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : - PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (hterminalJ : v ∈ - TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (p0 : ℕ) (indices0 : Fin - (p0 + (1 : ℕ)) → Fin ett.rounds), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 - indices0 b), - let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); - ∀ (_ : StableColoringBeforeVertex (ett.series.data.tree jSlot.succ.castSucc) v hterminalJ - (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring - jSlot.castSucc) (traceB.coloring (Fin.last traceB.steps))), - let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; - ∀ (_ : ( - ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : ( - ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (_ : ( - ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A seed) (_ : A.length < seed.length) - {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore (ett.series.data.tree - jSlot.succ.castSucc) v hterminalJ)) (_ : (0 : ℕ) < (↑jSlot : ℕ)), StableColoring Tprevious - (TashkinovStoredColors ett.series.data jSlot.castSucc) (ett.series.data.coloring - jSlot.castSucc) rho2 := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal - hfirstUpper hfirstPositive jSlot trace hterminalJ p0 indices0 rho1 terminalPosition - hterminalPositionPositive hterminalPositionBound seed u b traceB rho2 c1 Tprevious - hpreviousStrict hpreviousSeed segmentVertexBeforeJ hjPositive - constructor - · intro f hfIncident hfControlled - obtain ⟨x, hxPrevious, hxf⟩ := hfIncident - apply c1.1 f - ⟨x, segmentVertexBeforeJ (hpreviousSeed hjPositive) - (hpreviousStrict hjPositive) hxPrevious, hxf⟩ - obtain ⟨color, hcControlled, hfc⟩ := hfControlled - refine ⟨color, ?_, hfc⟩ - rcases Finset.mem_union.mp hcControlled with hcMissing | hcStored - · apply Finset.mem_union_left - unfold TreeMissingColors at hcMissing - obtain ⟨z, hzPrevious, hcz⟩ := - Finset.mem_biUnion.mp hcMissing - exact Finset.mem_biUnion.mpr - ⟨z, segmentVertexBeforeJ (hpreviousSeed hjPositive) - (hpreviousStrict hjPositive) hzPrevious, hcz⟩ - · exact Finset.mem_union_right _ hcStored - · intro x hxPrevious - exact c1.2 x - (segmentVertexBeforeJ (hpreviousSeed hjPositive) - (hpreviousStrict hjPositive) hxPrevious) - -private theorem helper_hcorrNonempty_3307.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : - PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + - (1 : ℕ)) → Fin ett.rounds), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 - indices0 b), - let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); - let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; - ∀ (C : TreeSequence G e0) (lower : ExtendedTashkinovTree G k e0 input (ett.series.data.tree - (⟨(↑jSlot : ℕ) + (1 : ℕ), - by omega - ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨(↑jSlot : ℕ), - by omega - ⟩ : Fin (ett.rounds + (1 : ℕ))))), - let nLower : Fin (lower.rounds + (1 : ℕ)) := Fin.last lower.rounds; - ∀ (_ : lower.series.data.tree nLower.castSucc = Tprevious) (_ : ModColoring lower rho2) (_ : - TreeSequenceInitialSegment Tprevious C) (_ : Tprevious.length < C.length) (_ : - (lower.series.data.kind nLower = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence rho2 Tprevious C ∨ (lower.series.data.kind nLower = some - TashkinovExtensionKind.SE ∨ lower.series.data.kind nLower = some - TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (adjoinSeed : TreeSequence G e0), lower.series.data.connectingEdges nLower = { f } ∧ - TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence rho2 - adjoinSeed C)), Nonempty (CorrespondingExtendedTashkinovTree G k e0 lower rho2 C) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v sigma q hqTerminal hvFinal - hfirstUpper hfirstPositive jSlot trace p0 indices0 rho1 u b traceB rho2 Tprevious C lower - nLower hLowerTree hmod hPreviousC hPreviousStrictC hLowerEligible - have hmod' := hmod - unfold ModColoring at hmod' - dsimp only at hmod' - apply hmod'.2.2 C - · rw [hLowerTree] - exact hPreviousC - · rw [hLowerTree] - exact hPreviousStrictC - · change - (lower.series.data.kind nLower = - some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence rho2 - (lower.series.data.tree nLower.castSucc) C) ∨ - ((lower.series.data.kind nLower = - some TashkinovExtensionKind.SE ∨ - lower.series.data.kind nLower = - some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (adjoinSeed : TreeSequence G e0), - lower.series.data.connectingEdges nLower = {f} ∧ - TreeSequenceAdjoinEdge - (lower.series.data.tree nLower.castSucc) f adjoinSeed ∧ - TashkinovAugmentationSequence rho2 adjoinSeed C) - rw [hLowerTree] - exact hLowerEligible - -private theorem helper_hbound_3342.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (_ : MaximumProperty ett) (hpositive : (0 : ℕ) < ett.rounds) (v : - V) (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (trace : - ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) - → Fin ett.rounds), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) (trace : + ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), @@ -4447,11 +4092,16 @@ private theorem helper_hpreviousStrict_4568.{u_1, u_2} : exact hvertex.symm.trans hterminalAt private theorem helper_branch_4596.{u_1, u_2} : + SharedFacts.ExtensionBranches.branchStatement.{u_1, u_2} := + SharedFacts.ExtensionBranches.branch.{u_1, u_2} + +private theorem helper_branch_4629.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), let _ : DecidableEq V := Classical.decEq V; let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), by omega @@ -4462,98 +4112,32 @@ private theorem helper_branch_4596.{u_1, u_2} : let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by omega ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A - B)) (_ : (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))).length = (1 : ℕ)) (_ : - TashkinovClosure (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) - (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (1 : Fin - (ett.rounds + (2 : ℕ))))) (_ : jSlot.castSucc = (0 : Fin (ett.rounds + (1 : ℕ)))), - TashkinovAugmentationSequence (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) - seed (ett.series.data.tree jSlot.succ.castSucc) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed - hseedTj commonPrefix seedLength initialClosure htarget - have htargetZero : jSlot.val = 0 := by - have := congrArg Fin.val htarget - simpa using this - have htreeOne : ett.series.data.tree 1 = - ett.series.data.tree jSlot.succ.castSucc := by - congr 1 - apply Fin.ext - simp [htargetZero] - have hinitialTj : TreeSequenceInitialSegment - (ett.series.data.tree 0) - (ett.series.data.tree jSlot.succ.castSucc) := by - have h := TashkinovAugmentationSequenceInitialSegment _ _ _ - initialClosure.1 - rw [htreeOne] at h - exact h - have hbaseSeed : TreeSequenceInitialSegment - (ett.series.data.tree 0) seed := by - apply commonPrefix hinitialTj hseedTj - rw [seedLength] - exact seed.positive - have hrouteOld : TashkinovAugmentationSequence - (ett.series.data.coloring 0) (ett.series.data.tree 0) - (ett.series.data.tree jSlot.succ.castSucc) := by - rw [← htreeOne] - exact initialClosure.1 - have hroute := TashkinovAugmentationSequenceSuffix - (ett.series.data.coloring 0) (ett.series.data.tree 0) seed - (ett.series.data.tree jSlot.succ.castSucc) hrouteOld hbaseSeed - hseedTj - simpa [htargetZero] using hroute - -private theorem helper_branch_4629.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let _ : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) - → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed - (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( - ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : - TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A - B)), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 - gamma delta).Walk (Sum.inl x) (Sum.inl u)), - let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; - ∀ (_ : ( - ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (i : Fin ett.rounds) (choice - : MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) - (TashkinovStoredColors ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)) - (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree - i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring - i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), - TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed (ett.series.data.tree - jSlot.succ.castSucc) := by + B)), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (i : Fin ett.rounds) (choice + : MaximumDefectiveChoice G e0 (ett.series.data.tree i.succ.castSucc) + (TashkinovStoredColors ett.series.data i.castSucc) (ett.series.data.coloring i.castSucc)) + (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) seed (ett.series.data.tree + jSlot.succ.castSucc) := by classical intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 @@ -4957,67 +4541,8 @@ private theorem helper_hclaim45Package_4916.{u_1, u_2} : hd30⟩ private theorem helper_hUsegmentVertexBefore_5198.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) - → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : - TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 - gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree - jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet - TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (uPosition : Fin - (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; - ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( - ∀ (i : Fin (TjPrime.length + (1 : ℕ))) (_ : (↑i : ℕ) < (↑uPosition : ℕ)), TjPrime.vertex i ∈ - TreeVerticesBefore TjPrime u0 huPrime0)) {A : TreeSequence G e0} (_ : - TreeSequenceInitialSegment A U) (_ : A.length < U.length) {y : V} (_ : y ∈ - TreeSequenceVertexSet A), y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition - huPositionPositive huPositionBound U hUPrime hprimeVertexBefore A hAU hAlen y hyA - obtain ⟨hAULen, hAUVertices, -⟩ := hAU - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hyA - obtain ⟨i, rfl⟩ := hyA - let iU : Fin (U.length + 1) := - Fin.castLE (Nat.succ_le_succ hAULen) i - let iPrime : Fin (TjPrime.length + 1) := - Fin.castLE (Nat.succ_le_succ hUPrime.1) iU - have hiPrime : iPrime.val < uPosition.val := by - change i.val < uPosition.val - have hUlen : U.length = uPosition.val := by - simp [U, TreeSequencePrefix] - omega - rw [← hAUVertices i, ← hUPrime.2.1 iU] - exact hprimeVertexBefore iPrime hiPrime + SharedFacts.ExtensionBranches.usegmentVertexBeforeStatement.{u_1, u_2} := + SharedFacts.ExtensionBranches.usegmentVertexBefore.{u_1, u_2} private theorem helper_transportUStep_5236.{u_1, u_2} : open scoped Classical in @@ -5729,320 +5254,20 @@ private theorem helper_branch_5609.{u_1, u_2} : (Finset.card_lt_card hTjStrictC) private theorem helper_branch_5782.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed - (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( - ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : - TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A - B)), - let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; - ∀ (_ : ( - ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) - (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree - i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) - (ett.series.data.coloring i.castSucc)) (_ : ett.series.data.connectingEdges i.succ = - { choice.edge }) (_ : ett.series.data.kind i.succ = some TashkinovExtensionKind.SE) - (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree - i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring - i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), - ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ - (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind - i.succ = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ - TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence - (ett.series.data.coloring i.succ) adjoinSeed seed := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed - hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict hjPositive i choice currentEdges - currentKind adjoined adjoinedExactly closedExtension htarget - have hi : i.succ = jSlot.castSucc := htarget.symm - have hroute : TashkinovAugmentationSequence - (ett.series.data.coloring jSlot.castSucc) adjoined - (ett.series.data.tree jSlot.succ.castSucc) := by - have h := closedExtension.1 - rw [hi, hjTreeIndex] at h - exact h - have hadjoinedTj : TreeSequenceInitialSegment adjoined - (ett.series.data.tree jSlot.succ.castSucc) := - TashkinovAugmentationSequenceInitialSegment _ _ _ hroute - have hadjoinedLength : adjoined.length ≤ seed.length := by - rcases adjoinedExactly with ⟨hlen, -, -⟩ - have hiCast : i.succ.castSucc = - jSlot.castSucc.castSucc := by - apply Fin.ext - simpa using congrArg Fin.val hi - have hprev : ett.series.data.tree i.succ.castSucc = - Tprevious := by rw [hiCast] - rw [hprev] at hlen - rw [hlen] - exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) - have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := - commonPrefix hadjoinedTj hseedTj hadjoinedLength - right - refine ⟨Or.inl (by simpa [htarget] using currentKind), - choice.edge, adjoined, ?_, ?_, ?_⟩ - · simpa [htarget] using currentEdges - · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ - have hiCast : i.castSucc.succ = - jSlot.castSucc.castSucc := by - apply Fin.ext - simpa using congrArg Fin.val hi - have hlenNew : adjoined.length = Tprevious.length + 1 := by - simpa [Tprevious, hiCast] using hlen - have hsegmentNew : - TreeSequenceInitialSegment Tprevious adjoined := by - simpa [Tprevious, hiCast] using hsegment - refine ⟨hlenNew, hsegmentNew, ?_⟩ - have haddedIndex : - Fin.cast hlenNew.symm (Fin.last Tprevious.length) = - Fin.cast hlen.symm - (Fin.last - (ett.series.data.tree i.succ.castSucc).length) := by - apply Fin.ext - simp [Tprevious, hiCast] - rw [haddedIndex] - exact hedge - · simpa [hi] using - (TashkinovAugmentationSequenceRestrict - (ett.series.data.coloring jSlot.castSucc) adjoined seed - (ett.series.data.tree jSlot.succ.castSucc) hroute - hadjoinedSeed hseedTj) + SharedFacts.ExtensionBranches.branch3050Statement.{u_1, u_2} := + SharedFacts.ExtensionBranches.branch3050.{u_1, u_2} private theorem helper_branch_5839.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed - (ett.series.data.tree jSlot.succ.castSucc)), - let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; - ∀ (_ : ( - ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (_ : (0 : ℕ) < - (↑jSlot : ℕ)) (i : Fin ett.rounds) (_ : ett.series.data.kind i.succ = some - TashkinovExtensionKind.PE) (_ : TashkinovClosure (ett.series.data.coloring i.succ) - (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree i.succ.succ)) (_ : - jSlot.castSucc = i.succ), ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ - (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind - i.succ = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ - TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence - (ett.series.data.coloring i.succ) adjoinSeed seed := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed - hjTreeIndex hseedTj Tprevious hpreviousSeed hjPositive i currentKind closedExtension htarget - have hi : i.succ = jSlot.castSucc := htarget.symm - have hroute : TashkinovAugmentationSequence - (ett.series.data.coloring jSlot.castSucc) Tprevious - (ett.series.data.tree jSlot.succ.castSucc) := by - have h := closedExtension.1 - rw [hi, hjTreeIndex] at h - simpa [Tprevious, hi] using h - left - refine ⟨by simpa [htarget] using currentKind, ?_⟩ - simpa [hi] using - (TashkinovAugmentationSequenceRestrict - (ett.series.data.coloring jSlot.castSucc) Tprevious seed - (ett.series.data.tree jSlot.succ.castSucc) hroute - (hpreviousSeed hjPositive) hseedTj) + SharedFacts.ExtensionBranches.branch3107Statement.{u_1, u_2} := + SharedFacts.ExtensionBranches.branch3107.{u_1, u_2} private theorem helper_branch_5861.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed - (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( - ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : - TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A - B)), - let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; - ∀ (_ : ( - ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) - (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data - i.castSucc) (_ : ett.series.data.connectingEdges i.succ = { available.edge }) (_ : - ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) (adjoined : TreeSequence G - e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) available.edge - adjoined) (_ : TashkinovClosure (ett.series.data.coloring i.succ) adjoined - (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), ett.series.data.kind - i.succ = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence - (ett.series.data.coloring i.succ) Tprevious seed ∨ (ett.series.data.kind i.succ = some - TashkinovExtensionKind.SE ∨ ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) - ∧ - ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ - TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence - (ett.series.data.coloring i.succ) adjoinSeed seed := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed - hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict hjPositive i available - currentEdges currentKind adjoined adjoinedExactly closedExtension htarget - have hi : i.succ = jSlot.castSucc := htarget.symm - have hroute : TashkinovAugmentationSequence - (ett.series.data.coloring jSlot.castSucc) adjoined - (ett.series.data.tree jSlot.succ.castSucc) := by - have h := closedExtension.1 - rw [hi, hjTreeIndex] at h - exact h - have hadjoinedTj : TreeSequenceInitialSegment adjoined - (ett.series.data.tree jSlot.succ.castSucc) := - TashkinovAugmentationSequenceInitialSegment _ _ _ hroute - have hadjoinedLength : adjoined.length ≤ seed.length := by - rcases adjoinedExactly with ⟨hlen, -, -⟩ - have hiCast : i.succ.castSucc = - jSlot.castSucc.castSucc := by - apply Fin.ext - simpa using congrArg Fin.val hi - have hprev : ett.series.data.tree i.succ.castSucc = - Tprevious := by rw [hiCast] - rw [hprev] at hlen - rw [hlen] - exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) - have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := - commonPrefix hadjoinedTj hseedTj hadjoinedLength - right - refine ⟨Or.inr (by simpa [htarget] using currentKind), - available.edge, adjoined, ?_, ?_, ?_⟩ - · simpa [htarget] using currentEdges - · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ - have hiCast : i.castSucc.succ = - jSlot.castSucc.castSucc := by - apply Fin.ext - simpa using congrArg Fin.val hi - have hlenNew : adjoined.length = Tprevious.length + 1 := by - simpa [Tprevious, hiCast] using hlen - have hsegmentNew : - TreeSequenceInitialSegment Tprevious adjoined := by - simpa [Tprevious, hiCast] using hsegment - refine ⟨hlenNew, hsegmentNew, ?_⟩ - have haddedIndex : - Fin.cast hlenNew.symm (Fin.last Tprevious.length) = - Fin.cast hlen.symm - (Fin.last - (ett.series.data.tree i.succ.castSucc).length) := by - apply Fin.ext - simp [Tprevious, hiCast] - rw [haddedIndex] - exact hedge - · simpa [hi] using - (TashkinovAugmentationSequenceRestrict - (ett.series.data.coloring jSlot.castSucc) adjoined seed - (ett.series.data.tree jSlot.succ.castSucc) hroute - hadjoinedSeed hseedTj) + SharedFacts.ExtensionBranches.branch3129Statement.{u_1, u_2} := + SharedFacts.ExtensionBranches.branch3129.{u_1, u_2} private theorem helper_hUsegmentVertexBefore_6032.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) - → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : - TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 - gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree - jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet - TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (uPosition : Fin - (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; - ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( - ∀ (i : Fin (TjPrime.length + (1 : ℕ))) (_ : (↑i : ℕ) < (↑uPosition : ℕ)), TjPrime.vertex i ∈ - TreeVerticesBefore TjPrime u0 huPrime0)) {A : TreeSequence G e0} (_ : - TreeSequenceInitialSegment A U) (_ : A.length < U.length) {y : V} (_ : y ∈ - TreeSequenceVertexSet A), y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition - huPositionPositive huPositionBound U hUPrime hprimeVertexBefore A hAU hAlen y hyA - obtain ⟨hAULen, hAUVertices, -⟩ := hAU - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hyA - obtain ⟨i, rfl⟩ := hyA - let iU : Fin (U.length + 1) := - Fin.castLE (Nat.succ_le_succ hAULen) i - let iPrime : Fin (TjPrime.length + 1) := - Fin.castLE (Nat.succ_le_succ hUPrime.1) iU - have hiPrime : iPrime.val < uPosition.val := by - change i.val < uPosition.val - have hUlen : U.length = uPosition.val := by - simp [U, TreeSequencePrefix] - omega - rw [← hAUVertices i, ← hUPrime.2.1 iU] - exact hprimeVertexBefore iPrime hiPrime + SharedFacts.ExtensionBranches.usegmentVertexBeforeStatement.{u_1, u_2} := + SharedFacts.ExtensionBranches.usegmentVertexBefore.{u_1, u_2} private theorem helper_transportUStep_6071.{u_1, u_2} : open scoped Classical in @@ -6131,39 +5356,8 @@ private theorem helper_transportUStep_6071.{u_1, u_2} : exact ⟨hlen, hAB, c, haddedFixed.trans hcolor, hcMissingRho⟩ private theorem helper_equalPrefixes_6220.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {A B D : TreeSequence G e0}, TreeSequenceInitialSegment A D → TreeSequenceInitialSegment B - D → A.length = B.length → A = B := by - classical - intro V E G e0 A B D hAD hBD hlen - rcases hAD with ⟨hlenAD, hvertexAD, hedgeAD⟩ - rcases hBD with ⟨hlenBD, hvertexBD, hedgeBD⟩ - cases A with - | mk alen apos avertex aedge avinj aeinf afirst aattach => - cases B with - | mk blen bpos bvertex bedge bvinj beinj bfirst battach => - simp only at hlen - subst blen - rw [TreeSequence.mk.injEq] - refine ⟨rfl, ?_, ?_⟩ - · apply heq_of_eq - funext i - calc - avertex i = D.vertex - (Fin.castLE (Nat.succ_le_succ hlenAD) i) := - (hvertexAD i).symm - _ = D.vertex - (Fin.castLE (Nat.succ_le_succ hlenBD) i) := by - congr 1 - _ = bvertex i := hvertexBD i - · apply heq_of_eq - funext i - calc - aedge i = D.edge (Fin.castLE hlenAD i) := - (hedgeAD i).symm - _ = D.edge (Fin.castLE hlenBD i) := by congr 1 - _ = bedge i := hedgeBD i + SharedFacts.ExtensionBranches.equalPrefixesStatement.{u_1, u_2} := + SharedFacts.ExtensionBranches.equalPrefixes.{u_1, u_2} private theorem helper_transportSeedStep_6612.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean b/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean index 4eed1a0bf8..f4b62d6442 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBranchPreparation + +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseStepLemmas + import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary public import LeanPool.GoldbergSeymour.ExtensionBaseStepLemmas @@ -1188,160 +1192,30 @@ theorem helper_hvBeforePrime_3939.{u_1, u_2} : · change seed.length < uPosition.val exact hseedBeforeU +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hUPrime_3958.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (TjPrime : TreeSequence - G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ - (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; TreeSequenceInitialSegment U TjPrime := by - classical - intro V E G e0 TjPrime uPosition huPositionPositive huPositionBound U - refine ⟨huPositionBound, ?_, ?_⟩ - · intro i - simp [U, TreeSequencePrefix] - · intro i - simp [U, TreeSequencePrefix] + SharedFacts.ExtensionBaseStepLemmas.uPrimeStatement.{u_1, u_2} := + SharedFacts.ExtensionBaseStepLemmas.uPrime.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hbeforePrimeNeU_3983.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) - → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → - ∀ (TjPrime : TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 - gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree - jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet - TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : Fin - (TjPrime.length + (1 : ℕ))) {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0 - := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition y hy - unfold TreeVerticesBefore at hy - obtain ⟨-, i, j, hiy, hju, hij⟩ := Finset.mem_filter.mp hy - intro hyu - have hijEq : i = j := TjPrime.vertex_injective - (hiy.trans (hyu.trans hju.symm)) - omega + SharedFacts.ExtensionBranchPreparation.hbeforePrimeNeUStatement.{u_1, u_2} := + SharedFacts.ExtensionBranchPreparation.hbeforePrimeNeU.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hbeforePrimeMissing_3991.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : - PartialEdgeColoring E k), - let this : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (z0 : - V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (rho3 : - PartialEdgeColoring E k), ( - ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : - Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase - u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → (z0 ∈ TreeVerticesBefore - TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 z0) → ( - ∀ {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0) → - ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, MissingColors G rho3 y = MissingColors G rho1 y - := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal - hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hd2z - hbeforePrimeNeU y hy - by_cases hyz : y = z0 - · subst y - exact hd2z hy - · apply hd2Missing y - apply Finset.mem_erase.mpr - refine ⟨hyz, Finset.mem_erase.mpr ⟨hbeforePrimeNeU hy, ?_⟩⟩ - exact Finset.mem_union_right _ (Finset.mem_union_left _ hy) + SharedFacts.ExtensionBranchPreparation.hbeforePrimeMissingStatement.{u_1, u_2} := + SharedFacts.ExtensionBranchPreparation.hbeforePrimeMissing.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_transportURoute_4006.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (v : V) (sigma : PartialEdgeColoring E k) (hvFinal : v ∈ - TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (TjPrime : TreeSequence G e0) (rho3 : PartialEdgeColoring E k) (uPosition : Fin - (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; ( - ∀ {A B : TreeSequence G e0}, TashkinovAugmentation rho1 A B → TreeSequenceInitialSegment B U → - TashkinovAugmentation rho3 A B) → - ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence rho1 S U → - TashkinovAugmentationSequence rho3 S U := by - classical - intro V E _ _ _ G k e0 input T generating ett v sigma hvFinal trace rho1 TjPrime rho3 uPosition - huPositionPositive huPositionBound U transportUStep S hroute - unfold TashkinovAugmentationSequence at hroute ⊢ - induction hroute using Relation.ReflTransGen.head_induction_on with - | refl => exact Relation.ReflTransGen.refl - | @head A B hAB hBU ih => - have hBsegment : TreeSequenceInitialSegment B U := - TashkinovAugmentationSequenceInitialSegment rho1 B U hBU - exact Relation.ReflTransGen.head - (transportUStep hAB hBsegment) ih + SharedFacts.ExtensionBranchPreparation.transportURouteStatement.{u_1, u_2} := + SharedFacts.ExtensionBranchPreparation.transportURoute.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_huU_4024.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - (TjPrime : TreeSequence G e0) (u0 : V) (uPosition : Fin (TjPrime.length + (1 : ℕ))), - TjPrime.vertex uPosition = u0 → - ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := - TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; - u0 ∈ TreeSequenceVertexSet U := by - classical - intro V E G e0 TjPrime u0 uPosition huPosition huPositionPositive huPositionBound U - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - refine ⟨Fin.last U.length, ?_⟩ - change TjPrime.vertex (Fin.castLE (Nat.succ_le_succ huPositionBound) - (Fin.last uPosition.val)) = u0 - have hindex : Fin.castLE (Nat.succ_le_succ huPositionBound) - (Fin.last uPosition.val) = uPosition := by - apply Fin.ext - rfl - rw [hindex] - exact huPosition + SharedFacts.ExtensionBranchPreparation.huUStatement.{u_1, u_2} := + SharedFacts.ExtensionBranchPreparation.huU.{u_1, u_2} theorem helper_segmentVertexBefore_4061.{u_1, u_2} : open scoped Classical in @@ -1472,20 +1346,10 @@ theorem helper_hzChoiceForContradiction_4107.{u_1, u_2} : (fun hval => heq (Fin.ext hval)) · exact Or.inl hlast.1 +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hUPrime_4274.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (TjPrime : TreeSequence - G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ - (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; TreeSequenceInitialSegment U TjPrime := by - classical - intro V E G e0 TjPrime uPosition huPositionPositive huPositionBound U - refine ⟨huPositionBound, ?_, ?_⟩ - · intro i - simp [U, TreeSequencePrefix] - · intro i - simp [U, TreeSequencePrefix] + SharedFacts.ExtensionBaseStepLemmas.uPrimeStatement.{u_1, u_2} := + SharedFacts.ExtensionBaseStepLemmas.uPrime.{u_1, u_2} theorem helper_hZTj_4280.{u_1, u_2} : open scoped Classical in @@ -1518,121 +1382,20 @@ theorem helper_hZTj_4280.{u_1, u_2} : · intro i simp [Z, TreeSequencePrefix] +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hbeforePrimeNeU_4309.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) - → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → - ∀ (TjPrime : TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 - gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree - jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet - TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : Fin - (TjPrime.length + (1 : ℕ))) {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0 - := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition y hy - unfold TreeVerticesBefore at hy - obtain ⟨-, i, j, hiy, hju, hij⟩ := Finset.mem_filter.mp hy - intro hyu - have hijEq : i = j := TjPrime.vertex_injective - (hiy.trans (hyu.trans hju.symm)) - omega + SharedFacts.ExtensionBranchPreparation.hbeforePrimeNeUStatement.{u_1, u_2} := + SharedFacts.ExtensionBranchPreparation.hbeforePrimeNeU.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hbeforePrimeMissing_4318.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : - PartialEdgeColoring E k), - let this : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (z0 : - V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (rho3 : - PartialEdgeColoring E k), ( - ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : - Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase - u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → (z0 ∈ TreeVerticesBefore - TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 z0) → ( - ∀ {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0) → - ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, MissingColors G rho3 y = MissingColors G rho1 y - := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal - hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hd2z - hbeforePrimeNeU y hy - by_cases hyz : y = z0 - · subst y - exact hd2z hy - · apply hd2Missing y - apply Finset.mem_erase.mpr - refine ⟨hyz, Finset.mem_erase.mpr ⟨hbeforePrimeNeU hy, ?_⟩⟩ - exact Finset.mem_union_right _ (Finset.mem_union_left _ hy) + SharedFacts.ExtensionBranchPreparation.hbeforePrimeMissingStatement.{u_1, u_2} := + SharedFacts.ExtensionBranchPreparation.hbeforePrimeMissing.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_transportURoute_4333.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (v : V) (sigma : PartialEdgeColoring E k) (hvFinal : v ∈ - TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (TjPrime : TreeSequence G e0) (rho3 : PartialEdgeColoring E k) (uPosition : Fin - (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; ( - ∀ {A B : TreeSequence G e0}, TashkinovAugmentation rho1 A B → TreeSequenceInitialSegment B U → - TashkinovAugmentation rho3 A B) → - ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence rho1 S U → - TashkinovAugmentationSequence rho3 S U := by - classical - intro V E _ _ _ G k e0 input T generating ett v sigma hvFinal trace rho1 TjPrime rho3 uPosition - huPositionPositive huPositionBound U transportUStep S hroute - unfold TashkinovAugmentationSequence at hroute ⊢ - induction hroute using Relation.ReflTransGen.head_induction_on with - | refl => exact Relation.ReflTransGen.refl - | @head A B hAB hBU ih => - have hBsegment : TreeSequenceInitialSegment B U := - TashkinovAugmentationSequenceInitialSegment rho1 B U hBU - exact Relation.ReflTransGen.head - (transportUStep hAB hBsegment) ih + SharedFacts.ExtensionBranchPreparation.transportURouteStatement.{u_1, u_2} := + SharedFacts.ExtensionBranchPreparation.transportURoute.{u_1, u_2} theorem helper_hterminalMissingEq_4347.{u_1, u_2} : open scoped Classical in @@ -1757,29 +1520,10 @@ theorem helper_hbeforeZData_4365.{u_1, u_2} : (hiy.trans (hyz.trans hjz.symm)) omega +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_huU_4386.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - (TjPrime : TreeSequence G e0) (u0 : V) (uPosition : Fin (TjPrime.length + (1 : ℕ))), - TjPrime.vertex uPosition = u0 → - ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := - TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; - u0 ∈ TreeSequenceVertexSet U := by - classical - intro V E G e0 TjPrime u0 uPosition huPosition huPositionPositive huPositionBound U - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - refine ⟨Fin.last U.length, ?_⟩ - change TjPrime.vertex (Fin.castLE (Nat.succ_le_succ huPositionBound) - (Fin.last uPosition.val)) = u0 - have hindex : Fin.castLE (Nat.succ_le_succ huPositionBound) - (Fin.last uPosition.val) = uPosition := by - apply Fin.ext - rfl - rw [hindex] - exact huPosition + SharedFacts.ExtensionBranchPreparation.huUStatement.{u_1, u_2} := + SharedFacts.ExtensionBranchPreparation.huU.{u_1, u_2} theorem helper_prefixSegment_4407.{u_1, u_2} : open scoped Classical in @@ -1845,23 +1589,10 @@ theorem helper_prefixPrefix_4416.{u_1, u_2} : change A.edge _ = A.edge _ congr 1 +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_prefixSelf_4429.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - (A : TreeSequence G e0), - TreeSequencePrefix A A.length A.positive le_rfl = A := by - classical - intro V E G e0 A - cases A with - | mk len pos vertex edge vinj einj first attach => - rw [TreeSequence.mk.injEq] - refine ⟨rfl, ?_, ?_⟩ - · apply heq_of_eq - funext i - rfl - · apply heq_of_eq - funext i - rfl + SharedFacts.ExtensionBaseStepLemmas.prefixSelfStatement.{u_1, u_2} := + SharedFacts.ExtensionBaseStepLemmas.prefixSelf.{u_1, u_2} theorem helper_hleftX_4557.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean index e51449fc6d..9baf42b908 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim45Singleton.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseClaim45Singleton + public import LeanPool.GoldbergSeymour.BoundaryColorEdges public import LeanPool.GoldbergSeymour.OutsideTreeColorSwapStable public import LeanPool.GoldbergSeymour.OutsideSwapPrefixEffects @@ -831,39 +833,6 @@ private theorem helper_before_seed_817.{u_1, u_2} : rw [← hvertices iSeed, hiCast] exact hiw -private theorem helper_rho0_unaffected_871.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} - {k : ℕ} {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) - (deltaN beta : Fin k), - let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; - ∀ (c : Fin k) (_ : c ≠ beta) (_ : c ≠ deltaN) (f : E), - rho0 f = some c ↔ rho1 f = some c := by - classical - intro V E _ _ G k e0 TjPrime rho1 deltaN beta rho0 c hcb hcd f - let _ := Fintype.ofFinite V - let _ := Fintype.ofFinite E - unfold rho0 OutsideTreeColorSwap - by_cases ht : TreeIncidentEdge TjPrime f - · simp [ht] - · simp only [ite_eq_right ht] - by_cases hfb : rho1 f = some beta - · rw [ite_eq_left hfb] - constructor - · intro h - exact False.elim (hcd (Option.some.inj h).symm) - · intro h - exact False.elim (hcb (Option.some.inj (h.symm.trans hfb))) - · rw [ite_eq_right hfb] - by_cases hfd : rho1 f = some deltaN - · rw [ite_eq_left hfd] - constructor - · intro h - exact False.elim (hcb (Option.some.inj h).symm) - · intro h - exact False.elim (hcd (Option.some.inj (h.symm.trans hfd))) - · rw [ite_eq_right hfd] - private theorem helper_continuation_1155.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] @@ -988,7 +957,8 @@ private theorem helper_continuation_1155.{u_1, u_2} : TjPrime rho1 gammaFirst gammaN deltaN beta u x exitPath zPosition hmuRho1PrimeFixed have rho0_unaffected : ∀ (c : Fin k), c ≠ beta → c ≠ deltaN → ∀ f : E, (rho0 f = some c ↔ rho1 f = some c) := by - exact @helper_rho0_unaffected_871 V E inferInstance inferInstance G k e0 TjPrime rho1 deltaN + exact @SharedFacts.ExtensionBaseClaim45Singleton.rho0_unaffected V E inferInstance + inferInstance G k e0 TjPrime rho1 deltaN beta have hE2 := P2966_T1_OutsideSwapPrefixEffects Tn Tj seed TjPrime phiJ rho1 rho0 rho3 deltaN beta terminalSupport u z zPosition diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean index a6fead0ba1..455c6f0ed6 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim46.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseClaim45Singleton + public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable public import LeanPool.GoldbergSeymour.ExtensionBaseCaseTwoObservation19 @@ -1300,39 +1302,6 @@ private theorem helper_before_seed_1330.{u_1, u_2} : rw [← hvertices iSeed, hiCast] exact hiw -private theorem helper_rho0_unaffected_1392.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} - {k : ℕ} {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) - (deltaN beta : Fin k), - let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; - ∀ (c : Fin k) (_ : c ≠ beta) (_ : c ≠ deltaN) (f : E), - rho0 f = some c ↔ rho1 f = some c := by - classical - intro V E _ _ G k e0 TjPrime rho1 deltaN beta rho0 c hcb hcd f - let _ := Fintype.ofFinite V - let _ := Fintype.ofFinite E - unfold rho0 OutsideTreeColorSwap - by_cases ht : TreeIncidentEdge TjPrime f - · simp [ht] - · simp only [ite_eq_right ht] - by_cases hfb : rho1 f = some beta - · rw [ite_eq_left hfb] - constructor - · intro h - exact False.elim (hcd (Option.some.inj h).symm) - · intro h - exact False.elim (hcb (Option.some.inj (h.symm.trans hfb))) - · rw [ite_eq_right hfb] - by_cases hfd : rho1 f = some deltaN - · rw [ite_eq_left hfd] - constructor - · intro h - exact False.elim (hcb (Option.some.inj h).symm) - · intro h - exact False.elim (hcd (Option.some.inj (h.symm.trans hfd))) - · rw [ite_eq_right hfd] - private theorem helper_initial_trans_1331.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} @@ -1587,7 +1556,8 @@ private theorem helper_continuation_1644.{u_1, u_2} : htreeEdgeFixed have rho0_unaffected : ∀ (c : Fin k), c ≠ beta → c ≠ deltaN → ∀ f : E, (rho0 f = some c ↔ rho1 f = some c) := by - exact @helper_rho0_unaffected_1392 V E inferInstance inferInstance G k e0 TjPrime rho1 deltaN + exact @SharedFacts.ExtensionBaseClaim45Singleton.rho0_unaffected V E inferInstance + inferInstance G k e0 TjPrime rho1 deltaN beta have hE4 : ∀ (s : Fin ett.rounds) (gammaS deltaS : Fin k), s ∈ (ExtensionBaseSupportClass ett diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean b/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean index 44270df944..c3fc9cae20 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseStepLemmas + import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary public import LeanPool.GoldbergSeymour.ExtensionBasePreparations @@ -3662,20 +3664,10 @@ theorem helper_hprefixSubset_2691.{u_1, u_2} : obtain ⟨a, ha, rfl⟩ := Finset.mem_image.mp ht exact Finset.mem_biUnion.mpr ⟨a, Finset.mem_univ _, hct⟩ +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hUPrime_2738.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (TjPrime : TreeSequence - G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ - (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; TreeSequenceInitialSegment U TjPrime := by - classical - intro V E G e0 TjPrime uPosition huPositionPositive huPositionBound U - refine ⟨huPositionBound, ?_, ?_⟩ - · intro i - simp [U, TreeSequencePrefix] - · intro i - simp [U, TreeSequencePrefix] + SharedFacts.ExtensionBaseStepLemmas.uPrimeStatement.{u_1, u_2} := + SharedFacts.ExtensionBaseStepLemmas.uPrime.{u_1, u_2} theorem helper_hprimeVertexBefore_2750.{u_1, u_2} : open scoped Classical in @@ -3848,23 +3840,10 @@ theorem helper_prefixPrefix_2877.{u_1, u_2} : change A.edge _ = A.edge _ congr 1 +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_prefixSelf_2890.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - (A : TreeSequence G e0), - TreeSequencePrefix A A.length A.positive le_rfl = A := by - classical - intro V E G e0 A - cases A with - | mk len pos vertex edge vinj einj first attach => - rw [TreeSequence.mk.injEq] - refine ⟨rfl, ?_, ?_⟩ - · apply heq_of_eq - funext i - rfl - · apply heq_of_eq - funext i - rfl + SharedFacts.ExtensionBaseStepLemmas.prefixSelfStatement.{u_1, u_2} := + SharedFacts.ExtensionBaseStepLemmas.prefixSelf.{u_1, u_2} theorem helper_hleftX_3005.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean index 346eb7bea0..7500ff78cd 100644 --- a/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean +++ b/LeanPool/GoldbergSeymour/GoodHierarchyPrefixPreparation.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.GoodHierarchyPrefixPreparation + public import LeanPool.GoldbergSeymour.GoodHierarchy /-! @@ -21,22 +23,10 @@ namespace GoldbergSeymour namespace GoodHierarchyPrefix +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_segmentTrans_64.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B - C → TreeSequenceInitialSegment A C := by - classical - intro V E G e0 A B C hAB hBC - rcases hAB with ⟨hab, hvab, heab⟩ - rcases hBC with ⟨hbc, hvbc, hebc⟩ - refine ⟨le_trans hab hbc, ?_, ?_⟩ - · intro i - have hmid := hvbc (Fin.castLE (Nat.succ_le_succ hab) i) - simpa using hmid.trans (hvab i) - · intro i - have hmid := hebc (Fin.castLE hab i) - simpa using hmid.trans (heab i) + SharedFacts.GoodHierarchyPrefixPreparation.segmentTransStatement.{u_1, u_2} := + SharedFacts.GoodHierarchyPrefixPreparation.segmentTrans.{u_1, u_2} theorem helper_stageSegment_77.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean index ab4e6ef1b7..8ec4afec14 100644 --- a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion @@ -235,19 +236,6 @@ private theorem helper_hAT_246.{u_1, u_2} : have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl simpa only [hlast, H.terminalStage] using hs -private theorem helper_commonPrefix_268.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S W → TreeSequenceInitialSegment U - W → S.length ≤ U.length → TreeSequenceInitialSegment S U := by - classical - intro V E G e0 S U W hSW hUW hlen - refine ⟨hlen, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) - private theorem helper_hyNotB_289.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1623,7 +1611,8 @@ theorem HierarchyClaimNineFirstUseAfterSeed {V E : Type*} ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ have hXT : TreeSequenceInitialSegment X T := ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ - have commonPrefix := @helper_commonPrefix_268 (@V) (@E) (@G) (@e0) + have commonPrefix := @SharedFacts.MixedChangeTransport.comparableInitialSegments (@V) (@E) + (@G) (@e0) have hAX : TreeSequenceInitialSegment A X := commonPrefix hAT hXT (by omega) have hXB : TreeSequenceInitialSegment X B := commonPrefix hXT hBT hXleB have hAB : TreeSequenceInitialSegment A B := commonPrefix hAT hBT (by omega) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean index 4f27524e6c..931cdaa133 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean @@ -5,11 +5,11 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts +public import LeanPool.GoldbergSeymour.SharedFacts.InsideAdvancement + public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion /-! # Hierarchy Situation One Advance Inside Stored @@ -23,108 +23,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private theorem helper_tailException_322.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (_ : ( - ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : - TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); - ∀ (_ : ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A)) (_ : TreeSequenceInitialSegment A T) (hlen - : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => - by omega - ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => - by omega - ); - ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), - HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j)) (_ : ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = B)) (_ : ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U)) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : - (1 : ℕ) ≤ j) (_ : j < T.length - A.length), - ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last - (HierarchyFullTailPrefix C j).length)), - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = - some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx i trans A starEq hAT hlen B hBT fullEq - fullB elementary vertexMem R j hj hjlt c hc t hlo hhi hcol - clear * - R j hj hjlt c hc t hlo hhi hcol starEq hAT hBT fullEq fullB elementary vertexMem - let U := HierarchyFullTailPrefix R.counterexample j - have hUlen : U.length = A.length + j := by - simp only [U, HierarchyFullTailPrefix, TreeSequencePrefix] - rw [starEq R] - exact min_eq_left (by have := hAT.1; omega) - have hUT : TreeSequenceInitialSegment U T := - ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ - let u : Fin U.length := ⟨t.val, by rw [hUlen]; omega⟩ - have hut : Fin.castLE hUT.1 u = t := Fin.ext rfl - have hcU : c ∈ MissingColors G R.coloring (U.vertex (Fin.last U.length)) := by - dsimp only [U] - rw [fullEq R] - exact hc - have hcolU : R.coloring (U.edge u) = some c := by - rw [← hUT.2.2 u, hut]; exact hcol - have hex := HierarchyTailMissingColorExclusion G k e0 R.corresponding.replacementInput T - R.coloring R.corresponding.replacementETT R.replacementBase R.counterexample.hierarchy - (by - change ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet - (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1))) - rw [fullB R] - exact elementary R) - j hj (by - rw [starEq R] - exact hjlt) c hcU u - (by - change (HierarchyStarredStage R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount)).length ≤ t.val - rw [starEq R] - exact hlo) - (by - change t.val < (HierarchyStarredStage R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount)).length + j - rw [starEq R] - exact hhi) hcolU - obtain ⟨hzero, hcore, hval, f, hstep, hkind, hedges, hedge, hcF, hstored⟩ := hex - have hAval : t.val = A.length := by - change u.val = _ at hval - rw [starEq R] at hval - exact hval - have hAn : A = R.corresponding.replacementETT.series.data.tree - (Fin.last R.corresponding.replacementETT.rounds).castSucc := by - rw [← starEq R] - have hs : HierarchyStarredStage R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount) = R.replacementBase.core := by - simp [HierarchyStarredStage, hzero, Fin.last] - exact hs.trans hcore - obtain ⟨i, hi⟩ := T.attaches t - let a : Fin (A.length + 1) := ⟨i.val, by simpa only [hAval] using i.isLt⟩ - let old : Fin (T.length + 1) := - Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ t.isLt)) - have ha : Fin.castLE (Nat.succ_le_succ hAT.1) a = old := Fin.ext rfl - refine ⟨⟨T.vertex old, ?_, ?_⟩, hstored⟩ - · rw [← hAn, ← ha, hAT.2.1 a] - exact vertexMem A a - · rw [Incident, hi] - exact Sym2.mem_mk_right _ _ - private theorem helper_excM_401.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -465,58 +363,6 @@ private theorem helper_advance_428.{u_1, u_2} : exact nextMember P2 theta (by rw [hmissing2 _ (vertexMem B jnext)]; exact htheta1) (hterminal2 hgLast) -private theorem helper_firstMem_669.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (T : TreeSequence G e0) (psi : PartialEdgeColoring E k) (c : Fin k), - (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → - c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by - classical - intro V E _ _ G k e0 T psi c hlt - let _ := Fintype.ofFinite V - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G psi (T.vertex j) - by_cases hn : candidates.Nonempty - · unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by - unfold HierarchyFirstMissingPosition - rw [dite_eq_right hn] - rfl - omega - -private theorem helper_consecutive_751.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (_ : ℕ) - (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), - let A : TreeSequence G e0 := - HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); - ∀ (t : Fin T.length) (_ : A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ)), - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C i hpathUpper A t ht - clear * - G T A C t ht hpathUpper - let candidates := (Finset.Icc 1 (T.length - A.length)).filter fun i => - ∀ t : Fin T.length, A.length + i ≤ t.val → - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) - have hp : HierarchyPathNumber C.hierarchy = - (if h : candidates.Nonempty then candidates.min' h else T.length - A.length) := rfl - have hn : candidates.Nonempty := by - by_contra hn - rw [dite_eq_right hn] at hp - have hu : HierarchyPathNumber C.hierarchy < T.length - A.length := hpathUpper - omega - have hm : candidates.min' hn = HierarchyPathNumber C.hierarchy := by - simpa only [dite_eq_left hn] using hp.symm - have hh := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - rw [hm] at hh - exact hh t ht - private theorem helper_trans_785.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -891,7 +737,10 @@ theorem HierarchySituationOneAdvanceInsideStored {V E : Type*} have firstLe := @helper_firstLe_877 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hsituation) (@i) (@hiLower) (@hiUpper) - have firstMem := @helper_firstMem_669 V E inferInstance inferInstance G k e0 T + have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) + (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : + c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by + exact TreeSequenceFirstMissingPositionMem hlt have firstAt (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : Fin (B.length + 1)) (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : @@ -908,10 +757,12 @@ theorem HierarchySituationOneAdvanceInsideStored {V E : Type*} have gammaUnused := @helper_gammaUnused_930 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hsituation) (@i) (@hiLower) (@hiUpper) (@starEq) - have tailException := @helper_tailException_322 V E inferInstance inferInstance inferInstance + have tailException := @SharedFacts.InsideAdvancement.tailException V E inferInstance + inferInstance inferInstance inferInstance G k e0 input T phi ett base C ctx i trans starEq hAT hlen hBT fullEq fullB elementary vertexMem - have consecutive := @helper_consecutive_751 V E inferInstance inferInstance inferInstance + have consecutive := @SharedFacts.InsideAdvancement.consecutive V E inferInstance + inferInstance inferInstance inferInstance G k e0 input T phi ett base C i hpathUpper have gammaChoice := @helper_gammaChoice_968 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hsituation) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean index f0e78ada5f..f5d6b7a747 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean @@ -5,11 +5,13 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts +public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement + +public import LeanPool.GoldbergSeymour.SharedFacts.InsideAdvancement + public import LeanPool.GoldbergSeymour.TerminalKempeStageSwitch public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion public import LeanPool.GoldbergSeymour.StableChangeCaseThree /-! @@ -381,108 +383,6 @@ private abbrev helperAdvance481Conditions.{u_1, u_2} : Prop := (Fin.last P.counterexample.hierarchy.dividerCount) → m + (1 : ℕ) ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx -private theorem helper_tailException_375.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (_ : ( - ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : - TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); - ∀ (_ : ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A)) (_ : TreeSequenceInitialSegment A T) (hlen - : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => - by omega - ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => - by omega - ); - ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), - HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j)) (_ : ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = B)) (_ : ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U)) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : - (1 : ℕ) ≤ j) (_ : j < T.length - A.length), - ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last - (HierarchyFullTailPrefix C j).length)), - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = - some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx i trans A starEq hAT hlen B hBT fullEq - fullB elementary vertexMem R j hj hjlt c hc t hlo hhi hcol - clear * - R j hj hjlt c hc t hlo hhi hcol starEq hAT hBT fullEq fullB elementary vertexMem - let U := HierarchyFullTailPrefix R.counterexample j - have hUlen : U.length = A.length + j := by - simp only [U, HierarchyFullTailPrefix, TreeSequencePrefix] - rw [starEq R] - exact min_eq_left (by have := hAT.1; omega) - have hUT : TreeSequenceInitialSegment U T := - ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ - let u : Fin U.length := ⟨t.val, by rw [hUlen]; omega⟩ - have hut : Fin.castLE hUT.1 u = t := Fin.ext rfl - have hcU : c ∈ MissingColors G R.coloring (U.vertex (Fin.last U.length)) := by - dsimp only [U] - rw [fullEq R] - exact hc - have hcolU : R.coloring (U.edge u) = some c := by - rw [← hUT.2.2 u, hut]; exact hcol - have hex := HierarchyTailMissingColorExclusion G k e0 R.corresponding.replacementInput T - R.coloring R.corresponding.replacementETT R.replacementBase R.counterexample.hierarchy - (by - change ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet - (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1))) - rw [fullB R] - exact elementary R) - j hj (by - rw [starEq R] - exact hjlt) c hcU u - (by - change (HierarchyStarredStage R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount)).length ≤ t.val - rw [starEq R] - exact hlo) - (by - change t.val < (HierarchyStarredStage R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount)).length + j - rw [starEq R] - exact hhi) hcolU - obtain ⟨hzero, hcore, hval, f, hstep, hkind, hedges, hedge, hcF, hstored⟩ := hex - have hAval : t.val = A.length := by - change u.val = _ at hval - rw [starEq R] at hval - exact hval - have hAn : A = R.corresponding.replacementETT.series.data.tree - (Fin.last R.corresponding.replacementETT.rounds).castSucc := by - rw [← starEq R] - have hs : HierarchyStarredStage R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount) = R.replacementBase.core := by - simp [HierarchyStarredStage, hzero, Fin.last] - exact hs.trans hcore - obtain ⟨i, hi⟩ := T.attaches t - let a : Fin (A.length + 1) := ⟨i.val, by simpa only [hAval] using i.isLt⟩ - let old : Fin (T.length + 1) := - Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ t.isLt)) - have ha : Fin.castLE (Nat.succ_le_succ hAT.1) a = old := Fin.ext rfl - refine ⟨⟨T.vertex old, ?_, ?_⟩, hstored⟩ - · rw [← hAn, ← ha, hAT.2.1 a] - exact vertexMem A a - · rw [Incident, hi] - exact Sym2.mem_mk_right _ _ - private theorem helper_branch_520.{u_1, u_2} : helperBranch520Conditions.{u_1, u_2} := by classical @@ -991,27 +891,6 @@ private theorem helper_advance_481.{u_1, u_2} : input T phi ett base C ctx hsituation P alpha componentData trans starEq hAT hlen hBT fullB elementary vertexMem firstAt outsideA notRaw m hmLower P alpha ha haLast hAlphaStored hmT haM theta htheta nextMember excM hThetaStored -private theorem helper_firstMem_1185.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (T : TreeSequence G e0) (psi : PartialEdgeColoring E k) (c : Fin k), - (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → - c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by - classical - intro V E _ _ G k e0 T psi c hlt - let _ := Fintype.ofFinite V - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G psi (T.vertex j) - by_cases hn : candidates.Nonempty - · unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by - unfold HierarchyFirstMissingPosition - rw [dite_eq_right hn] - rfl - omega - private theorem helper_outsideA_1255.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1055,37 +934,6 @@ private theorem helper_outsideA_1255.{u_1, u_2} : exact Finset.disjoint_left.mp (elementary R (TreeSequenceInitialSegmentVertexSetSubset hAB hv) (vertexMem B j) hne) hcv hc -private theorem helper_consecutive_1298.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (_ : ℕ) - (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), - let A : TreeSequence G e0 := - HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); - ∀ (t : Fin T.length) (_ : A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ)), - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C i hpathUpper A t ht - clear * - G T A C t ht hpathUpper - let candidates := (Finset.Icc 1 (T.length - A.length)).filter fun i => - ∀ t : Fin T.length, A.length + i ≤ t.val → - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) - have hp : HierarchyPathNumber C.hierarchy = - (if h : candidates.Nonempty then candidates.min' h else T.length - A.length) := rfl - have hn : candidates.Nonempty := by - by_contra hn - rw [dite_eq_right hn] at hp - have hu : HierarchyPathNumber C.hierarchy < T.length - A.length := hpathUpper - omega - have hm : candidates.min' hn = HierarchyPathNumber C.hierarchy := by - simpa only [dite_eq_left hn] using hp.symm - have hh := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - rw [hm] at hh - exact hh t ht - private theorem helper_trans_1517.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (_ : ℕ) @@ -1207,162 +1055,6 @@ private theorem helper_elementary_1593.{u_1, u_2} : intro u hu v hv hne exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne -private theorem helper_firstLe_1610.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (T : TreeSequence G e0) (psi : PartialEdgeColoring E k) (c : Fin k) - (j : Fin (T.length + (1 : ℕ))), - c ∈ MissingColors G psi (T.vertex j) → - HierarchyFirstMissingPosition psi T c ≤ j := by - classical - intro V E _ _ G k e0 T psi c j hj - let _ := Fintype.ofFinite V - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G psi (T.vertex j) - have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ - have hn : candidates.Nonempty := ⟨j, hm⟩ - unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - exact Finset.min'_le candidates j hm - -private theorem helper_lastData_1633.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = - HierarchyStoredColorsAt R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), - C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx R - obtain ⟨hcount, hdata⟩ := R.sameGood.2 - have hh := hdata (Fin.last C.hierarchy.dividerCount) - have hidx : Fin.cast (congrArg (fun q => q + 1) hcount) - (Fin.last C.hierarchy.dividerCount) = - Fin.last R.counterexample.hierarchy.dividerCount := Fin.ext hcount - simpa only [hidx] using hh - -private theorem helper_gammaTransport_1647.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = - HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma - (Fin.last C.hierarchy.dividerCount) eta = R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta) → - ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = - S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans lastData R S eta heta - clear * - R S eta heta lastData - have hOrig : eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) - := by - rw [(lastData R).1]; exact heta - refine ⟨?_, ((lastData R).2 eta hOrig).symm.trans ((lastData S).2 eta hOrig)⟩ - rw [← (lastData S).1] - exact hOrig - -private theorem helper_gammaUnused_1663.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) → - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), - eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition - R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R eta a heta ha t hlo hhi hc - have hnot := (Finset.mem_sdiff.mp (R.counterexample.good.avoidance - (Fin.last R.counterexample.hierarchy.dividerCount) eta heta ha)).2 - apply hnot - unfold HierarchySegmentColors - dsimp only - rw [starEq R, Fin.succ_last, R.counterexample.hierarchy.terminalStage] - exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, - lt_min hhi t.isLt, hc⟩ - -private theorem helper_notRaw_1688.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) → - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R c hcA hcD hm - apply hcD - unfold HierarchyStoredColorsAt - dsimp only - rw [starEq R] - exact Finset.mem_sdiff.mpr ⟨hm, hcA⟩ - -private theorem helper_gammaChoice_1720.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), - ∀ (f : E), - ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, - R.coloring f ≠ some a := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans R eta heta f - clear * - R eta heta f - by_contra hn - push Not at hn - have hc : (R.counterexample.good.gamma - (Fin.last R.counterexample.hierarchy.dividerCount) eta).card ≤ 1 := by - apply Finset.card_le_one.mpr - intro a ha b hb - exact Option.some.inj ((hn a ha).symm.trans (hn b hb)) - rw [R.counterexample.good.twoColors _ eta heta] at hc - omega - private theorem helper_advance_1736.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1624,21 +1316,6 @@ private theorem helper_advance_2294.{u_1, u_2} : (@gammaTransport) (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) (@gammaChoice) (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored) -private theorem helper_sameLast_2427.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {a b : ℕ} (s : Fin (a + - (2 : ℕ)) → TreeSequence G e0) (t : Fin (b + (2 : ℕ)) → TreeSequence G e0) (u v : - TreeSequence G e0), a = b → s ≍ t → u = v → (Fin.cases u (fun (i : Fin a) ↦ s - i.castSucc.succ) (Fin.last a) : TreeSequence G e0) = (Fin.cases v (fun (i : Fin b) ↦ t - i.castSucc.succ) (Fin.last b) : TreeSequence G e0) := by - classical - intro V E G e0 a b s t u v hab hst huv - cases hab - have he : s = t := eq_of_heq hst - cases he - cases huv - rfl - private theorem helper_advance_2571.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1837,7 +1514,7 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} TreeSequence G e0), a = b → HEq s t → u = v → Fin.cases (motive := fun _ => TreeSequence G e0) u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = Fin.cases (motive := fun _ => TreeSequence G e0) v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by - exact @helper_sameLast_2427 (@V) (@E) (@G) (@e0) + exact @SharedFacts.OutsideAdvancement.sameLast (@V) (@E) (@G) (@e0) let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) have starEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : HierarchyStarredStage R.counterexample.hierarchy @@ -1878,11 +1555,12 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + 1)) (hj : c ∈ MissingColors G psi (T.vertex j)) : HierarchyFirstMissingPosition psi T c ≤ j := by - exact helper_firstLe_1610 (@G) (@k) (@e0) (@T) (@psi) (@c) (@j) (@hj) + exact SharedFacts.OutsideAdvancement.firstMissingPositionUpperBound (@G) (@k) (@e0) (@T) + (@psi) (@c) (@j) (@hj) have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by - exact helper_firstMem_1185 G k e0 T psi c hlt + exact TreeSequenceFirstMissingPositionMem hlt have firstAt (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : Fin (B.length + 1)) (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : @@ -1897,7 +1575,8 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta := by - exact helper_lastData_1633 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.OutsideAdvancement.lastData (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@R) have gammaTransport (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) @@ -1908,7 +1587,8 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} (Fin.last S.counterexample.hierarchy.dividerCount) ∧ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by - exact @helper_gammaTransport_1647 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.OutsideAdvancement.gammaTransport (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@trans) (@lastData) (@R) (@S) (@eta) (@heta) have gammaUnused (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) @@ -1920,7 +1600,8 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} (t : Fin T.length) (hlo : A.length ≤ t.val) (hhi : t.val < (HierarchyFirstMissingPosition R.coloring T eta).val) : R.coloring (T.edge t) ≠ some a := by - exact helper_gammaUnused_1663 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.OutsideAdvancement.gammaUnused (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@starEq) (@R) (@eta) (@a) (@heta) (@ha) (@t) (@hlo) (@hhi) have outsideA (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) @@ -1935,7 +1616,8 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} (Fin.last R.counterexample.hierarchy.dividerCount)) : c ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last R.corresponding.replacementETT.rounds) := by - exact helper_notRaw_1688 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.OutsideAdvancement.notRaw (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@base) (@C) (@ctx) (@starEq) (@R) (@c) (@hcA) (@hcD) have tailException (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) @@ -1949,20 +1631,23 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last R.corresponding.replacementETT.rounds) := by - exact helper_tailException_375 G k e0 input T phi ett base C ctx i trans starEq hAT hlen + exact SharedFacts.InsideAdvancement.tailException G k e0 input T phi ett base C ctx i + trans starEq hAT hlen hBT fullEq fullB elementary vertexMem R j hj hjlt c hc t hlo hhi hcol have consecutive (t : Fin T.length) (ht : A.length + HierarchyPathNumber C.hierarchy ≤ t.val) : G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by - exact helper_consecutive_1298 G k e0 input T phi ett base C i hpathUpper t ht + exact SharedFacts.InsideAdvancement.consecutive G k e0 input T phi ett base C i + hpathUpper t ht have gammaChoice (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta : Fin k) (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)) (f : E) : ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, R.coloring f ≠ some a := by - exact @helper_gammaChoice_1720 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.OutsideAdvancement.gammaChoice (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@trans) (@R) (@eta) (@heta) (@f) have advance (m : ℕ) (hmLower : HierarchyPathNumber C.hierarchy ≤ m) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean index ba427290a9..ae5f1bd2c6 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean @@ -5,6 +5,12 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningTransport + +public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement + +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts + public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices public import LeanPool.GoldbergSeymour.TerminalRoute @@ -393,84 +399,6 @@ private noncomputable abbrev helperK358.{u_1, u_2} : dividerStage := HB.dividerStage coreInsideFirst := HB.coreInsideFirst } -private noncomputable abbrev helperEB1665.{u_1, u_2} : - open scoped Classical in - {V : Type u_1} → - {E : Type u_2} → - [ Fintype V] → - [ Fintype E] → - [ DecidableEq V] → - [ DecidableEq E] → - (G : LooplessMultigraph V E) → - (k : ℕ) → - (e0 : E) → - (input : PartialEdgeColoring E k) → - (T : TreeSequence G e0) → - (phi : PartialEdgeColoring E k) → - (ett : ExtendedTashkinovTree G k e0 input T phi) → - (base : HierarchyBase ett phi) → - (C : HierarchyCounterexample base) → - (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett - base C) → - (P : - HierarchyReplacementPresentation G k e0 input T phi ett - base C ctx) → - let mu : PartialEdgeColoring E k := P.coloring; - (hlenT : (3 : ℕ) ≤ T.length) → - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - (1 : ℕ) ≤ P.corresponding.replacementETT.rounds → - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := - GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin - (P.corresponding.replacementETT.rounds + - (2 : ℕ)))) - B → - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := - GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin - (P.corresponding.replacementETT.rounds + - (2 : ℕ)))).length < - B.length → - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last - (P.corresponding.replacementETT.rounds + - (1 : ℕ)))) → - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last - P.corresponding.replacementETT.rounds) → - ExtendedTashkinovTree G k e0 - P.corresponding.replacementInput B mu := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B positiveB aboveB strictB - belowB generatingB - exact { - rounds := P.corresponding.replacementETT.rounds - roundsPositive := positiveB - series := P.corresponding.replacementETT.series - abovePenultimate := aboveB - strictAbovePenultimate := strictB - belowFinal := belowB - generatingColoring := generatingB } - private abbrev helperLastStar3754Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] @@ -561,7 +489,8 @@ private abbrev helperLastStar3754Conditions.{u_1, u_2} : Prop := omega) j)) → let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -701,7 +630,8 @@ private abbrev helperHpS3760Conditions.{u_1, u_2} : Prop := ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -844,7 +774,8 @@ private abbrev helperUniqueRefresh4832Conditions.{u_1, u_2} : Prop := baseB) (goodB : GoodHierarchy HB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -927,161 +858,6 @@ private abbrev helperUniqueRefresh4832Conditions.{u_1, u_2} : Prop := ∀ theta ∈ HierarchyStoredColorsAt KF i.succ, theta ≠ eta → goodB.gamma i.succ theta = goodB.gamma i.castSucc theta -private abbrev helperParallelBase5019Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); - let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); - ∀ (hTnX : TreeSequenceInitialSegment Tn X), - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ - (missingTree : - ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), - TreeMissingColors sigma U = TreeMissingColors mu U) - (minusEq : - ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) - (R : Finset (Fin k)), - TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R) - (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (goodB : GoodHierarchy HB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB - generatingB; - ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) - (closureBX : - ∀ (hpe : EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE), - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) - (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) - (hpe : - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind - (Fin.last - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) - (hclosure : - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { - dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (terminalTree : - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn) - (storedEq : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j), - let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last corr.replacementETT.rounds; - let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; - corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → - ¬TreeColorSetMinusClosed G sigma bs.core - ((HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion - (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))) ∧ - (4 : ℕ) ≤ - ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma bs.closure : Finset (Fin k)) \ - (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion - (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card - private abbrev helperTerminalStored5253Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] @@ -1148,7 +924,8 @@ private abbrev helperTerminalStored5253Conditions.{u_1, u_2} : Prop := ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (hmaximum : MaximumProperty corr.replacementETT) @@ -1238,161 +1015,6 @@ private abbrev helperTerminalStored5253Conditions.{u_1, u_2} : Prop := (Fin.last corr.replacementETT.rounds) = TashkinovStoredColors EB.series.data (Fin.last EB.rounds) -private abbrev helperParallelBase5330Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); - let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); - ∀ (hTnX : TreeSequenceInitialSegment Tn X), - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ - (missingTree : - ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), - TreeMissingColors sigma U = TreeMissingColors mu U) - (minusEq : - ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) - (R : Finset (Fin k)), - TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R) - (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (goodB : GoodHierarchy HB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB - generatingB; - ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) - (closureBX : - ∀ (hpe : EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE), - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) - (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) - (hpe : - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind - (Fin.last - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) - (hclosure : - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { - dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (terminalTree : - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn) - (storedEq : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j), - let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last corr.replacementETT.rounds; - let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; - corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → - ¬TreeColorSetMinusClosed G sigma bs.core - ((HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion - (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))) ∧ - (4 : ℕ) ≤ - ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma bs.closure : Finset (Fin k)) \ - (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion - (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card - private abbrev helperLastStar5360Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] @@ -1453,7 +1075,8 @@ private abbrev helperLastStar5360Conditions.{u_1, u_2} : Prop := HB.stage j.castSucc = H.stage (Fin.cast (by omega) j).castSucc ∧ HierarchyStarredStage HB j = HierarchyStarredStage H (Fin.cast (by omega) j)), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -1559,7 +1182,8 @@ private abbrev helperHpS5366Conditions.{u_1, u_2} : Prop := ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -1693,7 +1317,8 @@ private abbrev helperContinuation6826Conditions.{u_1, u_2} : Prop := HierarchyStarredStage HB j = HierarchyStarredStage H (Fin.cast (by omega) j)) (goodB : GoodHierarchy HB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) (closureBX : @@ -2942,21 +2567,6 @@ private theorem helper_firstEq_1146.{u_1, u_2} : have := firstLe mu c _ hm omega -private theorem helper_trans_1493.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → - TreeSequenceInitialSegment X Z := by - classical - intro V E G e0 X Y Z hXY hYZ - refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) - private theorem helper_hTnCore_1512.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -3599,7 +3209,8 @@ private theorem helper_closureBX_1732.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } mu), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X → EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → @@ -3700,7 +3311,8 @@ private theorem helper_stageMissingEq_1787.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -3876,119 +3488,6 @@ private theorem helper_earlyMissing_1796.{u_1, u_2} : simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] exact ⟨i, by rw [← he, hXB.2.1 i]⟩ -private theorem helper_firstLe_1804.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (B.length + (1 : ℕ))), - c ∈ MissingColors G psi (B.vertex j) → - (↑(HierarchyFirstMissingPosition psi B c) : ℕ) ≤ (↑j : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hlenT B psi c j hj - let candidates := Finset.univ.filter fun j : Fin (B.length + 1) => - c ∈ MissingColors G psi (B.vertex j) - have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ - have hn : candidates.Nonempty := ⟨j, hm⟩ - unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - exact Finset.min'_le candidates j hm - -private theorem helper_firstMem_1814.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - B.length = T.length - (1 : ℕ) → - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (_ : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (psi : PartialEdgeColoring E k) (c : Fin k), - (↑(HierarchyFirstMissingPosition psi B c) : ℕ) < B.length → - c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B hBlength S hSBlen positiveB - aboveB strictB belowB generatingB baseB HB psi c hlt - let candidates := Finset.univ.filter fun j : Fin (B.length + 1) => - c ∈ MissingColors G psi (B.vertex j) - by_cases hn : candidates.Nonempty - · unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - · have hh : (HierarchyFirstMissingPosition psi B c).val = B.length := by - unfold HierarchyFirstMissingPosition - rw [dite_eq_right hn] - rfl - omega - private theorem helper_segmentEq_1835.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -4063,7 +3562,8 @@ private theorem helper_segmentEq_1835.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -4221,7 +3721,8 @@ private theorem helper_branch_1894.{u_1, u_2} : baseB) (goodB : GoodHierarchy HB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → @@ -4528,7 +4029,8 @@ private theorem helper_lastStar_1932.{u_1, u_2} : HB.stage j.castSucc = H.stage jo.castSucc ∧ HierarchyStarredStage HB j = HierarchyStarredStage H jo) → let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -4757,7 +4259,8 @@ private theorem helper_terminalTree_3611.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), MaximumProperty corr.replacementETT → @@ -4962,7 +4465,8 @@ private theorem helper_terminalStored_3618.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), MaximumProperty corr.replacementETT → @@ -5164,7 +4668,8 @@ private theorem helper_stageMissingEq_3631.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -5412,7 +4917,8 @@ private theorem helper_segmentEq_3669.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -5568,7 +5074,8 @@ private theorem helper_branch_3726.{u_1, u_2} : baseB) (goodB : GoodHierarchy HB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → @@ -5732,7 +5239,7 @@ private theorem helper_uniqueRefresh_4832.{u_1, u_2} : exact goodB.uniqueRefresh i private theorem helper_parallelBase_5019.{u_1, u_2} : - helperParallelBase5019Conditions.{u_1, u_2} := by + SharedFacts.ShorteningTransport.parallelBase5019Conditions.{u_1, u_2} := by classical intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f sigma missingTree minusEq positiveB aboveB strictB belowB generatingB baseB HB goodB EB @@ -5754,24 +5261,6 @@ private theorem helper_parallelBase_5019.{u_1, u_2} : (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@terminalTree) (@storedEq) (@hpB) (@hcl) (@hcard) -private theorem helper_sameLast_4923.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {a b : ℕ} - (s : Fin (a + (2 : ℕ)) → TreeSequence G e0) - (t : Fin (b + (2 : ℕ)) → TreeSequence G e0) (u v : TreeSequence G e0), - a = b → - s ≍ t → - u = v → - (Fin.cases u (fun (i : Fin a) ↦ s i.castSucc.succ) (Fin.last a) : TreeSequence G e0) = - (Fin.cases v (fun (i : Fin b) ↦ t i.castSucc.succ) (Fin.last b) : TreeSequence G e0) := by - classical - intro V E G e0 a b s t u v hab hst huv - cases hab - have he : s = t := eq_of_heq hst - cases he - cases huv - rfl - private theorem helper_terminalTree_5246.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -5843,7 +5332,8 @@ private theorem helper_terminalTree_5246.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (_ : MaximumProperty corr.replacementETT) @@ -6043,7 +5533,8 @@ private theorem helper_stageMissingEq_5267.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -6171,7 +5662,8 @@ private theorem helper_segmentEq_5302.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -6309,7 +5801,8 @@ private theorem helper_uniqueRefresh_5324.{u_1, u_2} : baseB) (goodB : GoodHierarchy HB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - helperEB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB generatingB; ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) (bs : HierarchyBase corr.replacementETT sigma) @@ -6380,7 +5873,7 @@ private theorem helper_uniqueRefresh_5324.{u_1, u_2} : (@increasingK) (@dividerStageK) (@starredEq) (@stageBX) (@storedEq) private theorem helper_parallelBase_5330.{u_1, u_2} : - helperParallelBase5330Conditions.{u_1, u_2} := by + SharedFacts.ShorteningTransport.parallelBase5019Conditions.{u_1, u_2} := by classical intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f sigma missingTree minusEq positiveB aboveB strictB belowB generatingB baseB HB goodB EB @@ -6447,15 +5940,11 @@ private theorem helper_continuation_6826.{u_1, u_2} : have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (B.length + 1)) (hj : c ∈ MissingColors G psi (B.vertex j)) : (HierarchyFirstMissingPosition psi B c).val ≤ j.val := by - exact helper_firstLe_1804 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) (@hlenT) (@psi) (@c) (@j) (@hj) + exact TreeSequenceFirstMissingPositionLe hj have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) (hlt : (HierarchyFirstMissingPosition psi B c).val < B.length) : c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c)) := by - exact helper_firstMem_1814 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) - (@hlenT) (@hBlength) (@S) (@hSBlen) (@positiveB) (@aboveB) (@strictB) (@belowB) - (@generatingB) (@baseB) (@HB) (@psi) (@c) (@hlt) + exact TreeSequenceFirstMissingPositionMem hlt have firstEq (c : Fin k) : HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c := by exact helper_firstEq_1146 G k e0 input T phi ett base C ctx P alpha hlenT hBlength S hSBlen @@ -6606,7 +6095,8 @@ private theorem helper_continuation_7103.{u_1, u_2} : have hs : seriesB = P.corresponding.replacementETT.series := eq_of_heq hseriesB cases hs let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := by - exact @helperEB1665 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.ShorteningTransport.eB1665 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) have coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X := by @@ -6723,7 +6213,7 @@ theorem HierarchySituationOneShorteningContradiction {V E : Type*} u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = Fin.cases (motive := fun _ => TreeSequence G e0) v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by - exact @helper_sameLast_4923 (@V) (@E) (@G) (@e0) + exact @SharedFacts.OutsideAdvancement.sameLast (@V) (@E) (@G) (@e0) have hAold : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A := sameLast _ _ _ _ P.sameGood.1.2.1 P.sameGood.1.2.2.1 P.sameGood.1.1 @@ -6742,7 +6232,7 @@ theorem HierarchySituationOneShorteningContradiction {V E : Type*} (hXY : TreeSequenceInitialSegment X Y) (hYZ : TreeSequenceInitialSegment Y Z) : TreeSequenceInitialSegment X Z := by - exact helper_trans_1493 (@G) (@e0) (@hXY) (@hYZ) + exact SharedFacts.ShorteningTransport.trans (@G) (@e0) (@hXY) (@hYZ) have chain : ∀ (j : ℕ) (hj : j < H.dividerCount + 2) (i : Fin (H.dividerCount + 2)), i.val ≤ j → TreeSequenceInitialSegment (H.stage i) (H.stage ⟨j, hj⟩) := by diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean index 597276e43f..605fed603f 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneEmpty.lean @@ -5,6 +5,9 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.StoredExceptionTransport + + public import LeanPool.GoldbergSeymour.EmptyCommonMissingLocation public import LeanPool.GoldbergSeymour.BaseExtraReplacement public import LeanPool.GoldbergSeymour.AbsentOwnerReplacement @@ -807,86 +810,6 @@ private theorem helper_continuation_671.{u_1, u_2} : alpha haTerminal haA hextra hgamma exact ⟨P, beta, hterm, missingMono P.coloring hAY hbA, Or.inl hbad⟩ -private noncomputable abbrev helperSelfCorr880.{u_1, u_2} : - open scoped Classical in - {V : Type u_1} → - {E : Type u_2} → - [Fintype V] → - [Fintype E] → - [DecidableEq E] → - (G : LooplessMultigraph V E) → - (k : ℕ) → - (e0 : E) → - (input : PartialEdgeColoring E k) → - (T : TreeSequence G e0) → - (phi : PartialEdgeColoring E k) → - (ett : ExtendedTashkinovTree G k e0 input T phi) → - (∀ (j : Fin (ett.rounds + (1 : ℕ))), - IsProperEdgeColoring G (ett.series.data.coloring j)) → - (∀ (j : Fin (ett.rounds + (1 : ℕ))), - IsOneEdgeUncolored (ett.series.data.coloring j) e0) → - CorrespondingExtendedTashkinovTree G k e0 ett phi T := by - classical - intro V E _ _ _ G k e0 input T phi ett seriesProper seriesOne - exact { - replacementInput := input - replacementSeries := ett.series - replacementETT := ett - rungAgreement := rfl - seriesPresentation := HEq.rfl - finalGeneratingColoring := ett.generatingColoring - ladderTreesAgree := fun _ => rfl - storedColorsAgree := fun _ => rfl - connectingEdgesAgree := fun _ => rfl - extensionKindsAgree := fun _ => rfl - replacementProper := seriesProper - replacementOneUncolored := seriesOne - replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } - -private noncomputable abbrev helperP0917.{u_1, u_2} : - open scoped Classical in - {V : Type u_1} → - {E : Type u_2} → - [Fintype V] → - [Fintype E] → - [DecidableEq V] → - [DecidableEq E] → - (G : LooplessMultigraph V E) → - (k : ℕ) → - (e0 : E) → - (input : PartialEdgeColoring E k) → - (T : TreeSequence G e0) → - (phi : PartialEdgeColoring E k) → - (ett : ExtendedTashkinovTree G k e0 input T phi) → - (base : HierarchyBase ett phi) → - (C : HierarchyCounterexample base) → - (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett - base C) → - (seriesProper : - ∀ (j : Fin (ett.rounds + (1 : ℕ))), - IsProperEdgeColoring G (ett.series.data.coloring j)) → - (seriesOne : - ∀ (j : Fin (ett.rounds + (1 : ℕ))), - IsOneEdgeUncolored (ett.series.data.coloring j) e0) → - let _ : - CorrespondingExtendedTashkinovTree G k e0 ett phi T := - helperSelfCorr880 G k e0 input T phi ett seriesProper - seriesOne; - HierarchyReplacementPresentation G k e0 input T phi ett - base C ctx := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx seriesProper seriesOne selfCorr - exact { - coloring := phi - corresponding := selfCorr - maximum := C.maximum - replacementBase := base - counterexample := C - sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, - rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ - minimumContext := ctx } - theorem HierarchySituationThreeClaimJMinusOneEmpty {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) @@ -937,62 +860,18 @@ theorem HierarchySituationThreeClaimJMinusOneEmpty {V E : Type*} · intro i exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) have seriesProper : ∀ j : Fin (ett.rounds + 1), - IsProperEdgeColoring G (ett.series.data.coloring j) := by as_aux_lemma => + IsProperEdgeColoring G (ett.series.data.coloring j) := by intro j - cases ett.series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.1 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedProper - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => exact currentProper - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact previousProper + exact (ett.series.coloringProperties j).1 have seriesOne : ∀ j : Fin (ett.rounds + 1), - IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by as_aux_lemma => + IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by intro j - cases ett.series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.2 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedOneUncolored - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => exact currentOneUncolored - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact previousOneUncolored - let selfCorr := @helperSelfCorr880 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + exact (ett.series.coloringProperties j).2 + let selfCorr := @SharedFacts.StoredExceptionTransport.selfCorr425 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@seriesProper) (@seriesOne) - let P0 := @helperP0917 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + let P0 := @SharedFacts.StoredExceptionTransport.p0462 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@seriesProper) (@seriesOne) let j := HierarchyPathNumber C.hierarchy let ell := HierarchyFullTailLength C diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean index 9bf9e85d25..d3a7fe074c 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound public import LeanPool.GoldbergSeymour.NineN @@ -1896,31 +1897,6 @@ private theorem helper_hsame_650.{u_1, u_2} : rw [← jaEq, ← jbEq, hBT.2.1 ja, hBT.2.1 jb] at hh exact hh -private theorem helper_hsone_681.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (R : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ b → - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl - (T.vertex (Fin.last T.length))); IsOneEdgeUncolored sigma e0 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx R a b hne sigma - refine ⟨?_, ?_⟩ - · simp [sigma, TwoColorComponentSwap, R.minimumContext.oneEdgeUncolored.1] - · intro e he - obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 e he - by_cases hm : Sum.inr e ∈ TwoColorComponent G R.coloring a b - (Sum.inl (T.vertex (Fin.last T.length))) - · by_cases hca : c = a - · subst c; exact ⟨b, by simp [sigma, TwoColorComponentSwap, hm, hc]⟩ - · by_cases hcb : c = b - · subst c; exact ⟨a, by simp [sigma, TwoColorComponentSwap, hm, hc, hne.symm]⟩ - · exact ⟨c, by simp [sigma, TwoColorComponentSwap, hm, hc, hca, hcb]⟩ - · exact ⟨c, by simp [sigma, TwoColorComponentSwap, hm, hc]⟩ - private theorem helper_baseStable_716.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -3129,292 +3105,6 @@ private theorem helper_hjbA_1449.{u_1, u_2} : exact Finset.mem_biUnion.mpr ⟨A.vertex x, vertexMem A x, by rw [← hAB.2.1 x, hx]; exact hb⟩ -private theorem helper_hdisD_1496.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : - (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : - ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); - ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); - ∀ (hBT : TreeSequenceInitialSegment B T), - let Extra : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin - k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ - (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet - (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G - R.coloring v; - let Gamma : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin - k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ - (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount)); - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - ∀ (hYB : TreeSequenceInitialSegment Y B), - let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; - let i : ℕ := I.max' hnonempty; - ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last - (HierarchyFullTailPrefix C i).length)), alpha ∈ MissingColors G P.coloring (T.vertex - (Fin.last T.length)) → - ∀ (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), - let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, - have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) - ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ - by - omega - ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); alpha ∈ MissingColors G P.coloring (B.vertex ja) → - alpha ∉ TreeMissingColors P.coloring A → alpha ∉ Gamma P ∪ Extra P → - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last - P.counterexample.hierarchy.dividerCount); - let used : ℕ → Finset (Fin k) := fun (r : ℕ) ↦ ({c : Fin k | - ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + r ∧ P.coloring (T.edge t) = - some c} : Finset (Fin k)); - ∀ beta ∈ TreeMissingColors P.coloring Y, beta ∉ D → beta ∉ used (j - (1 : ℕ)) → (beta ∉ Gamma - P ∪ Extra P ∨ - ∃ eta ∈ D, beta ∈ P.counterexample.good.gamma (Fin.last - P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring - T eta) : ℕ) ≤ Y.length) → - ∀ (vbeta : V), beta ∈ MissingColors G P.coloring vbeta → - ∀ (yb : Fin (Y.length + (1 : ℕ))), - let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; beta ∈ - MissingColors G P.coloring (B.vertex jb) → (↑(HierarchyFirstMissingPosition P.coloring T - alpha) : ℕ) = X.length → alpha ≠ beta → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some - beta) → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) = some - alpha → TreeIncidentEdge (P.corresponding.replacementETT.series.data.tree (Fin.last - P.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ alpha ∈ - TashkinovStoredColors P.corresponding.replacementETT.series.data (Fin.last - P.corresponding.replacementETT.rounds)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring - T eta) : ℕ) ≤ Y.length) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → - beta ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → beta ∈ - TreeMissingColors R.coloring Y ∧ (beta ∉ Gamma R ∪ Extra R ∨ - ∃ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition R.coloring - T eta) : ℕ) ≤ Y.length)) → alpha ∉ D → beta ∉ HierarchyStageMissingColors - P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → beta ∉ - Gamma P ∪ Extra P → beta ∉ TreeMissingColors P.coloring A → alpha ∉ TashkinovStoredColors - P.corresponding.replacementETT.series.data (Fin.last - P.corresponding.replacementETT.rounds) → beta ∉ TashkinovStoredColors - P.corresponding.replacementETT.series.data (Fin.last - P.corresponding.replacementETT.rounds) → (↑(HierarchyFirstMissingPosition P.coloring T - beta) : ℕ) = (↑jb : ℕ) → (↑(HierarchyFirstMissingPosition P.coloring T alpha) : ℕ) = (↑ja - : ℕ) → Fin.castLE (Nat.succ_le_succ hBT.1) jb = HierarchyFirstMissingPosition P.coloring T - beta → Fin.castLE (Nat.succ_le_succ hBT.1) ja = HierarchyFirstMissingPosition P.coloring T - alpha → TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)) - (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) → beta ∉ ({c : Fin k | - ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition - P.coloring T alpha) : ℕ) ∧ P.coloring (T.edge t) = some c} : Finset (Fin k)) → beta ∈ - TreeMissingColors P.coloring (HierarchyFullTailPrefix P.counterexample - (HierarchyFullTailLength P.counterexample - (1 : ℕ))) ∧ alpha ∈ TreeMissingColors - P.coloring (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength - P.counterexample - (1 : ℕ))) → ( - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - P.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); - have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = - TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta - ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ - TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ - TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ - TreeInterchangeable G A P.coloring beta alpha)) → Disjoint (insert beta ({ alpha } : - Finset (Fin k)) : Finset (Fin k)) D := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper A htail - hlen B hBT Extra Gamma Y hYB I i hiUpper P alpha haPrefix haTerminal hSlen ja ha haOutside - haGood X D used beta hbY hbD hbUsed hbChoice vbeta hbeta yb jb hb haFirst habNe hbUnused - haException cutBeta finish hAlphaStored hbStage hbOutsideChoice hbOutside haRaw hbRaw ibEq - iaEq jbEq jaEq hordered hunused hmissingP change - apply Finset.disjoint_left.mpr - intro c hc hd - simp only [Finset.mem_insert, Finset.mem_singleton] at hc - rcases hc with rfl | rfl - · exact hbD hd - · exact hAlphaStored hd - -private theorem helper_hdisRaw_1503.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (hnonempty : - (HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx).Nonempty) (j : - ℕ) (_ : (2 : ℕ) ≤ j) (hpathUpper : j < HierarchyFullTailLength C), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); - ∀ (htail : (3 : ℕ) ≤ T.length - A.length) (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); - ∀ (hBT : TreeSequenceInitialSegment B T), - let Extra : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin - k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ - (TreeSequenceVertexSet R.replacementBase.core \ TreeSequenceVertexSet - (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G - R.coloring v; - let Gamma : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx → Finset (Fin - k) := fun (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) ↦ - (HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount)).biUnion (R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount)); - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - ∀ (hYB : TreeSequenceInitialSegment Y B), - let I : Finset ℕ := HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx; - let i : ℕ := I.max' hnonempty; - ∀ (hiUpper : i < j) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C i).vertex (Fin.last - (HierarchyFullTailPrefix C i).length)), alpha ∈ MissingColors G P.coloring (T.vertex - (Fin.last T.length)) → - ∀ (hSlen : (HierarchyFullTailPrefix C i).length = A.length + i), - let ja : Fin (B.length + (1 : ℕ)) := (⟨A.length + i, - have hb : B.length = T.length - (1 : ℕ) := rfl; id (fun (hpathUpper : j < T.length - A.length) - ↦ Decidable.byContradiction fun (a : ¬A.length + i < B.length + (1 : ℕ)) ↦ - by - omega - ) hpathUpper⟩ : Fin (B.length + (1 : ℕ))); alpha ∈ MissingColors G P.coloring (B.vertex ja) → - alpha ∉ TreeMissingColors P.coloring A → alpha ∉ Gamma P ∪ Extra P → - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let D : Finset (Fin k) := HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last - P.counterexample.hierarchy.dividerCount); - let used : ℕ → Finset (Fin k) := fun (r : ℕ) ↦ ({c : Fin k | - ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < A.length + r ∧ P.coloring (T.edge t) = - some c} : Finset (Fin k)); - ∀ beta ∈ TreeMissingColors P.coloring Y, beta ∉ D → beta ∉ used (j - (1 : ℕ)) → (beta ∉ Gamma - P ∪ Extra P ∨ - ∃ eta ∈ D, beta ∈ P.counterexample.good.gamma (Fin.last - P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring - T eta) : ℕ) ≤ Y.length) → - ∀ (vbeta : V), beta ∈ MissingColors G P.coloring vbeta → - ∀ (yb : Fin (Y.length + (1 : ℕ))), - let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; beta ∈ - MissingColors G P.coloring (B.vertex jb) → (↑(HierarchyFirstMissingPosition P.coloring T - alpha) : ℕ) = X.length → alpha ≠ beta → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) ≠ some - beta) → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → P.coloring (T.edge t) = some - alpha → TreeIncidentEdge (P.corresponding.replacementETT.series.data.tree (Fin.last - P.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ alpha ∈ - TashkinovStoredColors P.corresponding.replacementETT.series.data (Fin.last - P.corresponding.replacementETT.rounds)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring - T eta) : ℕ) ≤ Y.length) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G R.coloring v = MissingColors G P.coloring v) → - beta ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → beta ∈ - TreeMissingColors R.coloring Y ∧ (beta ∉ Gamma R ∪ Extra R ∨ - ∃ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), beta ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition R.coloring - T eta) : ℕ) ≤ Y.length)) → alpha ∉ D → beta ∉ HierarchyStageMissingColors - P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) → beta ∉ - Gamma P ∪ Extra P → beta ∉ TreeMissingColors P.coloring A → alpha ∉ TashkinovStoredColors - P.corresponding.replacementETT.series.data (Fin.last - P.corresponding.replacementETT.rounds) → beta ∉ TashkinovStoredColors - P.corresponding.replacementETT.series.data (Fin.last - P.corresponding.replacementETT.rounds) → (↑(HierarchyFirstMissingPosition P.coloring T - beta) : ℕ) = (↑jb : ℕ) → (↑(HierarchyFirstMissingPosition P.coloring T alpha) : ℕ) = (↑ja - : ℕ) → Fin.castLE (Nat.succ_le_succ hBT.1) jb = HierarchyFirstMissingPosition P.coloring T - beta → Fin.castLE (Nat.succ_le_succ hBT.1) ja = HierarchyFirstMissingPosition P.coloring T - alpha → TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)) - (T.vertex (HierarchyFirstMissingPosition P.coloring T alpha)) → beta ∉ ({c : Fin k | - ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition - P.coloring T alpha) : ℕ) ∧ P.coloring (T.edge t) = some c} : Finset (Fin k)) → beta ∈ - TreeMissingColors P.coloring (HierarchyFullTailPrefix P.counterexample - (HierarchyFullTailLength P.counterexample - (1 : ℕ))) ∧ alpha ∈ TreeMissingColors - P.coloring (HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength - P.counterexample - (1 : ℕ))) → ( - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - P.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); - have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = - TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta - ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ - TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ - TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ - TreeInterchangeable G A P.coloring beta alpha)) → Disjoint (insert beta ({ alpha } : - Finset (Fin k)) : Finset (Fin k)) D → Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) (TashkinovStoredColors P.corresponding.replacementETT.series.data - (Fin.last P.corresponding.replacementETT.rounds)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx hnonempty j hpathLower hpathUpper A htail - hlen B hBT Extra Gamma Y hYB I i hiUpper P alpha haPrefix haTerminal hSlen ja ha haOutside - haGood X D used beta hbY hbD hbUsed hbChoice vbeta hbeta yb jb hb haFirst habNe hbUnused - haException cutBeta finish hAlphaStored hbStage hbOutsideChoice hbOutside haRaw hbRaw ibEq - iaEq jbEq jaEq hordered hunused hmissingP change hdisD - apply Finset.disjoint_left.mpr - intro c hc hd - simp only [Finset.mem_insert, Finset.mem_singleton] at hc - rcases hc with rfl | rfl - · exact hbRaw hd - · exact haRaw hd - private theorem helper_hsame_1512.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -3663,23 +3353,13 @@ private theorem helper_continuation_4396.{u_1, u_2} : P.minimumContext.largeMissingSet beta alpha habNe.symm hmissingP (by dsimp only; rw [starEq P]; intro _; exact ⟨hordered, hunused⟩) have hdisD : Disjoint ({beta, alpha} : Finset (Fin k)) D := by - exact helper_hdisD_1496 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@hnonempty) (@j) (@hpathLower) (@hpathUpper) (@htail) (@hlen) (@hBT) (@hYB) (@hiUpper) - (@P) (@alpha) (@haPrefix) (@haTerminal) (@hSlen) (@ha) (@haOutside) (@haGood) (@beta) - (@hbY) (@hbD) (@hbUsed) (@hbChoice) (@vbeta) (@hbeta) (@yb) (@hb) (@haFirst) (@habNe) - (@hbUnused) (@haException) (@cutBeta) (@finish) (@hAlphaStored) (@hbStage) - (@hbOutsideChoice) (@hbOutside) (@haRaw) (@hbRaw) (@ibEq) (@iaEq) (@jbEq) (@jaEq) - (@hordered) (@hunused) (@hmissingP) (@change) + exact Finset.disjoint_insert_left.mpr + ⟨hbD, Finset.disjoint_singleton_left.mpr hAlphaStored⟩ have hdisRaw : Disjoint ({beta, alpha} : Finset (Fin k)) (TashkinovStoredColors P.corresponding.replacementETT.series.data (Fin.last P.corresponding.replacementETT.rounds)) := by - exact helper_hdisRaw_1503 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@hnonempty) (@j) (@hpathLower) (@hpathUpper) (@htail) (@hlen) (@hBT) (@hYB) (@hiUpper) - (@P) (@alpha) (@haPrefix) (@haTerminal) (@hSlen) (@ha) (@haOutside) (@haGood) (@beta) - (@hbY) (@hbD) (@hbUsed) (@hbChoice) (@vbeta) (@hbeta) (@yb) (@hb) (@haFirst) (@habNe) - (@hbUnused) (@haException) (@cutBeta) (@finish) (@hAlphaStored) (@hbStage) - (@hbOutsideChoice) (@hbOutside) (@haRaw) (@hbRaw) (@ibEq) (@iaEq) (@jbEq) (@jaEq) - (@hordered) (@hunused) (@hmissingP) (@change) (@hdisD) + exact Finset.disjoint_insert_left.mpr + ⟨hbRaw, Finset.disjoint_singleton_left.mpr haRaw⟩ have hsame : TwoColorComponent G P.coloring beta alpha (Sum.inl (B.vertex jb)) = TwoColorComponent G P.coloring beta alpha (Sum.inl (B.vertex ja)) := by exact helper_hsame_1512 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) @@ -4495,7 +4175,8 @@ private theorem helper_continuation_3692.{u_1, u_2} : have hsproper : IsProperEdgeColoring G sigma := TwoColorComponentSwapProper G R.coloring a b hne R.minimumContext.proper _ have hsone : IsOneEdgeUncolored sigma e0 := by - exact helper_hsone_681 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@R) + exact SharedFacts.TerminalKempeStageSwitch.hsone (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@R) (@a) (@b) (@hne) exact @helper_caseContinuation_5383 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@j) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean index 4391523030..494551bb89 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaTransport + +public import LeanPool.GoldbergSeymour.SharedFacts.SecondSituationTransport + public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound @@ -529,64 +533,6 @@ private abbrev helperContinuation3542Conditions.{u_1, u_2} : Prop := ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A d.switched.coloring gamma beta)), False -private theorem helper_hthetaFirstIndex_395.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let ell : ℕ := HierarchyFullTailLength C; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); d.theta ∈ - MissingColors G sigma (Y.vertex (Fin.last Y.length)) → TreeSequenceInitialSegment Y T → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → - ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) → ( - ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → - ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) - → d.theta ∈ MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma T - d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) ≤ Y.length → - (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma ell Y Z - hthetaMissingY hYtoT hYtoZ hZtoT hElemZ vertexMemT hthetaFirst - as_aux_lemma => - clear_value Y Z - apply Nat.le_antisymm hthetaFirst.2 - by_contra hne - have hlt : (HierarchyFirstMissingPosition sigma T d.theta).val < Y.length := - Nat.lt_of_not_ge hne - have iZ : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ∈ - TreeSequenceVertexSet Z := vertexMemT Z hZtoT - (HierarchyFirstMissingPosition sigma T d.theta) - (Nat.le_trans (Nat.le_of_lt hlt) hYtoZ.1) - have yZ : Y.vertex (Fin.last Y.length) ∈ TreeSequenceVertexSet Z := - TreeSequenceInitialSegmentVertexSetSubset hYtoZ - (by simp [TreeSequenceVertexSet]) - have hvne : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ - Y.vertex (Fin.last Y.length) := by - intro heq - let jY : Fin (Y.length + 1) := - ⟨(HierarchyFirstMissingPosition sigma T d.theta).val, - Nat.lt_succ_of_le (Nat.le_of_lt hlt)⟩ - have hcast : Fin.castLE (Nat.succ_le_succ hYtoT.1) jY = - HierarchyFirstMissingPosition sigma T d.theta := Fin.ext rfl - have heqY : Y.vertex jY = Y.vertex (Fin.last Y.length) := by - have htree := hYtoT.2.1 jY - have hcastV := congrArg T.vertex hcast - exact htree.symm.trans (hcastV.trans heq) - have hidx := Y.vertex_injective heqY - have hval := congrArg Fin.val hidx - dsimp [jY] at hval - exact (Nat.ne_of_lt hlt) hval - exact Finset.disjoint_left.mp (hElemZ iZ yZ hvne) - hthetaFirst.1 hthetaMissingY - private theorem helper_routeToY_837.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -859,41 +805,6 @@ private theorem helper_hfixed3_1220.{u_1, u_2} : ⟨d.theta, Finset.mem_union_right _ hraw, htheta⟩ · simp only [mu3, TwoColorComponentSwap, hga, htheta, ite_false, ite_self] -private theorem helper_firstWitness_671.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), - TreeSequenceInitialSegment W T → - ∀ c ∈ TreeMissingColors rho W, - c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ - (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ W.length := by - classical - intro V E _ _ G k e0 T rho W hWT c hc - let _ := Fintype.ofFinite V - as_aux_lemma => - rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hcv⟩ - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hv - rcases hv with ⟨i, rfl⟩ - let candidates := Finset.univ.filter fun a : Fin (T.length + 1) => - c ∈ MissingColors G rho (T.vertex a) - have hi : Fin.castLE (Nat.succ_le_succ hWT.1) i ∈ candidates := by - simp [candidates, hWT.2.1 i, hcv] - have hn : candidates.Nonempty := ⟨_, hi⟩ - have hmin := Finset.min'_le candidates _ hi - have hmiss : c ∈ MissingColors G rho (T.vertex (candidates.min' hn)) := - (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - have hpos : HierarchyFirstMissingPosition rho T c = candidates.min' hn := by - simp [HierarchyFirstMissingPosition, candidates, hn] - constructor - · simpa [HierarchyFirstMissingPosition, candidates, hn] using hmiss - · rw [hpos] - have hle : (candidates.min' hn).val ≤ i.val := by - change (candidates.min' hn).val ≤ (Fin.castLE (Nat.succ_le_succ hWT.1) i).val at hmin - simpa using hmin - exact le_trans hle (Nat.le_of_lt_succ i.isLt) - private theorem helper_caseGamma_1171.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1080,208 +991,6 @@ private theorem helper_hbetaUnused_658.{u_1, u_2} : · exact hc.2.1 hm · exact Finset.disjoint_left.mp hc.2.2 (by simp) hm -private theorem helper_hthetaMissingY_676.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), HierarchyPathNumber C.hierarchy = j → - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma - (Y.vertex (Fin.last Y.length)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R sigma Y - have ht := d.thetaMissingAtJ - change d.theta ∈ MissingColors G d.switched.coloring - ((HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy)).vertex - (Fin.last (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy)).length)) at ht - rw [hj] at ht - exact ht - -private theorem helper_sameStar_697.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let _ : TreeSequence G e0 := HierarchyFullTailPrefix C j; HierarchyStarredStage C.hierarchy - (Fin.last C.hierarchy.dividerCount) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A X Y - as_aux_lemma => - clear * - G e0 base C R H q A - have helper : - ∀ (n m : ℕ) (X Y : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → - TreeSequence G e0), n = m → X = Y → HEq s t → Fin.cases (motive := fun _ => TreeSequence G - e0) X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => - TreeSequence G e0) Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by - intro n m X Y s t hnm hXY hst - subst m - have hs : s = t := eq_of_heq hst - simp [hXY, hs] - simpa [A, q, HierarchyStarredStage] using (helper _ _ base.core R.replacementBase.core - C.hierarchy.stage - H.stage R.sameGood.1.2.1 R.sameGood.1.1 - R.sameGood.1.2.2.1) - -private theorem helper_hcutJstrict_730.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), HierarchyPathNumber C.hierarchy = j → - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount) = A → TreeSequenceInitialSegment A T → j < ell → A.length + j < - T.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R H q A ell sameStar - hAtoT hjUpper - have hj : j < T.length - A.length := by - simpa only [ell, HierarchyFullTailLength, sameStar] using hjUpper - have hAT := hAtoT.1 - clear * - hj hAT - clear_value A - omega - -private theorem helper_prefixToTree_743.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - (T : TreeSequence G e0) (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmT : m ≤ T.length), - TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T := by - classical - intro V E G e0 T m hm hmT - as_aux_lemma => - refine ⟨hmT, ?_, ?_⟩ - · intro i - simp [TreeSequencePrefix] - · intro i - simp [TreeSequencePrefix] - -private theorem helper_commonPrefix_752.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) - {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T - → U.length ≤ W.length → TreeSequenceInitialSegment U W := by - classical - intro V E G e0 T U W hUT hWT hUW - as_aux_lemma => - rcases hUT with ⟨hu, huv, hue⟩ - rcases hWT with ⟨hw, hwv, hwe⟩ - refine ⟨hUW, ?_, ?_⟩ - · intro i - calc - W.vertex (Fin.castLE (Nat.succ_le_succ hUW) i) = - T.vertex (Fin.castLE (Nat.succ_le_succ hw) - (Fin.castLE (Nat.succ_le_succ hUW) i)) := (hwv _).symm - _ = T.vertex (Fin.castLE (Nat.succ_le_succ hu) i) := by congr 1 - _ = U.vertex i := huv i - · intro i - calc - W.edge (Fin.castLE hUW i) = T.edge (Fin.castLE hw (Fin.castLE hUW i)) := - (hwe _).symm - _ = T.edge (Fin.castLE hu i) := by congr 1 - _ = U.edge i := hue i - -private theorem helper_hElemZ_837.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let ell : ℕ := HierarchyFullTailLength C; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = Z → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma ell Z - penultimatePrefixEq - as_aux_lemma => - have hp : ColoredVertexSetElementary G sigma - (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - 1))) := - HierarchyCounterexamplePenultimateElementary G k e0 - R.corresponding.replacementInput T sigma R.corresponding.replacementETT - R.replacementBase R.counterexample R.minimumContext.proper - R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung - R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality - R.minimumContext.largeMissingSet - intro u hu v hv huv - apply hp - · rw [penultimatePrefixEq]; exact hu - · rw [penultimatePrefixEq]; exact hv - · exact huv - -private theorem helper_vertexMemT_866.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T W : TreeSequence G - e0), TreeSequenceInitialSegment W T → - ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W - := by - classical - intro V E G e0 T W hWT i hi - as_aux_lemma => - let jW : Fin (W.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ - have hcast : Fin.castLE (Nat.succ_le_succ hWT.1) jW = i := Fin.ext rfl - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - refine ⟨jW, ?_⟩ - rw [← hWT.2.1 jW, hcast] - -private theorem helper_hthetaY_887.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma - (Y.vertex (Fin.last Y.length)) → ( - ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet - W) → ( - ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) (v : V) (c : Fin k), v ∈ - TreeSequenceVertexSet W → c ∈ MissingColors G rho v → c ∈ TreeMissingColors rho W) → - d.theta ∈ TreeMissingColors sigma Y := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma Y hthetaMissingY - vertexMemSelf treeMissingIntro - as_aux_lemma => - clear_value Y - exact treeMissingIntro sigma Y (Y.vertex (Fin.last Y.length)) d.theta - (vertexMemSelf Y (Fin.last Y.length)) hthetaMissingY - private theorem helper_hgammaUnused_907.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1375,27 +1084,6 @@ private theorem helper_horderedUnusedGammaBeta_921.{u_1, u_2} : exact hgammaUnused t hlo (hhi.trans_le (hbetaFirstLe.trans (hBtoX.1.trans hXtoY.1))) he -private theorem helper_treeMissingSubset_949.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ - TreeMissingColors sigma W := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma U W hUW - as_aux_lemma => - intro c hc - obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hc - exact Finset.mem_biUnion.mpr ⟨v, - TreeSequenceInitialSegmentVertexSetSubset hUW hv, hmiss⟩ - private theorem helper_firstChange_985.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1469,110 +1157,6 @@ private theorem helper_firstChange_985.{u_1, u_2} : sigma (T.edge t) = some c) exact horderedUnusedGammaBeta) -private theorem helper_hApositive_1008.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; (0 : ℕ) < H.dividerCount → A = H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q A hq - as_aux_lemma => - have hlast : q = - (⟨H.dividerCount - 1, Nat.sub_lt hq (by decide)⟩ : Fin H.dividerCount).succ := by - apply Fin.ext - change H.dividerCount = H.dividerCount - 1 + 1 - exact (Nat.sub_add_cancel hq).symm - change HierarchyStarredStage H q = _ - rw [hlast] - change H.stage _ = H.stage _ - congr 1 - apply Fin.ext - change H.dividerCount - 1 + 1 = H.dividerCount - exact Nat.sub_add_cancel hq - -private theorem helper_sameGammaBeta_1024.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ gamma ∈ TreeMissingColors sigma A, ( - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - R.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition sigma T gamma); - have vb : V := T.vertex (HierarchyFirstMissingPosition sigma T beta); - have sameComponent : Prop := TwoColorComponent G sigma gamma beta (Sum.inl va) = - TwoColorComponent G sigma gamma beta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ - TreeMissingColors sigma Tnq ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset - (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - sigma Tn ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → - sameComponent) ∧ ( gamma ∈ TreeMissingColors sigma A ∧ TreeColorSetClosed G sigma A - ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A sigma gamma beta)) - → gamma ∈ HierarchyStageMissingColors H q → ( (0 : ℕ) < H.dividerCount → A = H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma hgammaA - firstChange hgammaStageMissing hApositive - by_cases hzero : H.dividerCount = 0 - · have hgammaRaw : gamma ∈ TreeMissingColors sigma - (R.corresponding.replacementETT.series.data.tree - (Fin.last R.corresponding.replacementETT.rounds).castSucc) := by - have hq0 : q = 0 := by - apply Fin.ext - simp [q, hzero] - rw [hq0] at hgammaStageMissing - simpa [HierarchyStageMissingColors] using hgammaStageMissing - exact firstChange.2.1 ⟨hzero, Or.inl hgammaRaw⟩ - · have hgammaLast : gamma ∈ TreeMissingColors sigma - (H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩) := by - have hstar : A = H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ := - hApositive (Nat.pos_of_ne_zero hzero) - rw [← hstar] - exact hgammaA - exact firstChange.1 ⟨Nat.pos_of_ne_zero hzero, Or.inl hgammaLast⟩ - private theorem helper_hgammaTerminalDistinct_1048.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1631,72 +1215,6 @@ private theorem helper_hbetaTerminalDistinct_1056.{u_1, u_2} : exact Nat.ne_of_lt ((hbetaFirstLe.trans (hBtoX.1.trans hXtoY.1)).trans_lt hlt) hv -private theorem helper_hmu2One_1080.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - ∀ (gamma : Fin k), - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; - IsOneEdgeUncolored mu2 e0 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma z mu2 - as_aux_lemma => - constructor - · have he0 : sigma e0 = none := R.minimumContext.oneEdgeUncolored.1 - simp [mu2, TwoColorComponentSwap, he0] - · intro e he0 - obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 e he0 - by_cases heK : Sum.inr e ∈ TwoColorComponent G sigma gamma beta z - · by_cases heGamma : sigma e = some gamma - · exact ⟨beta, by simp [mu2, TwoColorComponentSwap, heK, heGamma] - ⟩ - · by_cases heBeta : sigma e = some beta - · exact ⟨gamma, by - simp [mu2, TwoColorComponentSwap, heK, heBeta] - ⟩ - · exact ⟨c, by - simpa [mu2, TwoColorComponentSwap, heK, heGamma, heBeta] using hc⟩ - · exact ⟨c, by simpa [mu2, TwoColorComponentSwap, heK] using hc⟩ - -private theorem helper_hfirstBetaOutside_1105.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - ∀ (gamma : Fin k), TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) → ( - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a - b (Sum.inl v)) → Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex - (Fin.last T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T gamma)))) → - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T beta)) ∉ TwoColorComponent G sigma gamma beta z := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma sameGammaBeta - componentSelf hterminalDisjoint z hv - have hv' : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∈ - TwoColorComponent G sigma gamma beta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) := by - rw [sameGammaBeta] - exact componentSelf sigma gamma beta - (T.vertex (HierarchyFirstMissingPosition sigma T beta)) - exact (Set.disjoint_left.mp hterminalDisjoint) hv hv' - private theorem helper_hfixedThroughY_1130.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1732,132 +1250,6 @@ private theorem helper_hfixedThroughY_1130.{u_1, u_2} : have hbe := hbetaUnused t hlo hhi simp only [mu2, TwoColorComponentSwap, hga, hbe, ite_false, ite_self] -private theorem helper_firstPreserved_1137.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (T : TreeSequence G e0) (_ : ℕ), ( - ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → - ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex - (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) - ≤ W.length) → - ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → - ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho - (TreeSequenceVertexSet W) → ( - ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ - TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = - HierarchyFirstMissingPosition rho T c := by - classical - intro V E _ _ G k e0 T j firstWitness W hWT rho sigma c helem hmiss hc - let _ := Fintype.ofFinite V - as_aux_lemma => - clear * - G T W rho sigma c helem hmiss hc firstWitness hWT - have hr := firstWitness rho W hWT c hc - have hc' : c ∈ TreeMissingColors sigma W := by - obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc - exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ - have hs := firstWitness sigma W hWT c hc' - have pref (i : Fin (T.length + 1)) (hi : i.val ≤ W.length) : - T.vertex i ∈ TreeSequenceVertexSet W := by - let j : Fin (W.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ - have he : Fin.castLE (Nat.succ_le_succ hWT.1) j = i := Fin.ext rfl - exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr - ⟨j, Finset.mem_univ _, (hWT.2.1 j).symm.trans (congrArg T.vertex he)⟩ - by_contra hne - have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ - T.vertex (HierarchyFirstMissingPosition rho T c) := - fun he => hne (T.vertex_injective he) - have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 - exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 - -private theorem helper_firstUnaffected_1162.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (T : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin - k), a ≠ b → IsProperEdgeColoring G rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition - (TwoColorComponentSwap G rho a b z) T c = HierarchyFirstMissingPosition rho T c := by - classical - intro V E _ _ G k e0 T z rho a b c hne hp hca hcb - let _ := Fintype.ofFinite V - have hb := TwoColorComponentSwapMissingBehavior G rho a b hne hp z - have he : (Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G (TwoColorComponentSwap G rho a b z) (T.vertex i)) = - (Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G rho (T.vertex i)) := by - ext i - simp only [Finset.mem_filter, Finset.mem_univ, true_and] - exact hb.2.2.2 _ c hca hcb - unfold HierarchyFirstMissingPosition - rw [he] - -private theorem helper_missingTransport_1179.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let ell : ℕ := HierarchyFullTailLength C; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - ∀ (old new : PartialEdgeColoring E k), ( - ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) → - ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W Z → TreeMissingColors new W = - TreeMissingColors old W := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ell Z old new hm W hWZ - as_aux_lemma => - clear_value Z - clear * - old new hm W hWZ Z - unfold TreeMissingColors - exact Finset.biUnion_congr rfl (fun v hv => - hm v (TreeSequenceInitialSegmentVertexSetSubset hWZ hv)) - -private theorem helper_hstoredMu2_1190.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - let D : Finset (Fin k) := HierarchyStoredColorsAt H q; - ∀ gamma ∈ TreeMissingColors sigma A, gamma ≠ beta → TreeSequenceInitialSegment Z T → - ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) → beta ∈ TreeMissingColors - sigma Z → - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; ( - ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → - ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho - (TreeSequenceVertexSet W) → ( - ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ - TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = - HierarchyFirstMissingPosition rho T c) → ( - ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G - rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T - c = HierarchyFirstMissingPosition rho T c) → ( - ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v) → - ∀ eta ∈ D, HierarchyFirstMissingPosition mu2 T eta = HierarchyFirstMissingPosition sigma T eta - := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A ell Z D gamma - hgammaA hgammaNeBeta hZtoT hElemZ hbetaMissingZ z mu2 firstPreserved firstUnaffected - hmissingMu2 eta heta - have hneGamma : eta ≠ gamma := by - intro he - exact (Finset.mem_sdiff.mp heta).2 (he.symm ▸ hgammaA) - by_cases he : eta = beta - · subst eta - exact firstPreserved Z hZtoT sigma mu2 beta hElemZ hmissingMu2 hbetaMissingZ - · exact firstUnaffected z sigma gamma beta eta hgammaNeBeta - R.minimumContext.proper hneGamma he - private theorem helper_hgammaCutoff_1202.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1893,210 +1285,6 @@ private theorem helper_hgammaCutoff_1202.{u_1, u_2} : subst eta exact hthetaFirst.2 -private theorem helper_originalStar_1216.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (S : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyStarredStage - C.hierarchy (Fin.last C.hierarchy.dividerCount) = HierarchyStarredStage - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx S - as_aux_lemma => - have helper : - ∀ (n m : ℕ) (U W : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → - TreeSequence G e0), n = m → U = W → HEq s t → Fin.cases (motive := fun _ => TreeSequence G - e0) U (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => - TreeSequence G e0) W (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by - intro n m U W s t hnm hUW hst - subst m - have he : s = t := eq_of_heq hst - simp only [hUW, he] - exact helper _ _ _ _ _ _ S.sameGood.1.2.1 S.sameGood.1.1 S.sameGood.1.2.2.1 - -private theorem helper_lastData_1247.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = - HierarchyStoredColorsAt S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), - C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = - S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx S - as_aux_lemma => - obtain ⟨hc, hd⟩ := S.sameGood.2 - have hi : Fin.cast (congrArg (fun n => n + 1) hc) - (Fin.last C.hierarchy.dividerCount) = - Fin.last S.counterexample.hierarchy.dividerCount := Fin.ext hc - simpa only [hi] using hd (Fin.last C.hierarchy.dividerCount) - -private theorem helper_sameLast_1262.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let D : Finset (Fin k) := HierarchyStoredColorsAt H q; ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = - HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma - (Fin.last C.hierarchy.dividerCount) eta = S.counterexample.good.gamma (Fin.last - S.counterexample.hierarchy.dividerCount) eta) → - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = - HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last - S.counterexample.hierarchy.dividerCount) eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q D lastData S - refine ⟨(lastData R).1.symm.trans (lastData S).1, ?_⟩ - intro eta heta - have hc : eta ∈ HierarchyStoredColorsAt C.hierarchy - (Fin.last C.hierarchy.dividerCount) := (lastData R).1.symm ▸ heta - exact ((lastData R).2 eta hc).symm.trans ((lastData S).2 eta hc) - -private theorem helper_weakEdges_1273.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : - ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : - TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → - IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → - ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new - ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage - K (Fin.last K.dividerCount)).edge t) := by - classical - intro V E _ _ _ _ G k e0 T input' old new et bs K hw ho hn - as_aux_lemma => - by_cases hz : K.dividerCount = 0 - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz - rw [hi] at hw ⊢ - exact P2813_T1_BaseDisplayedEdges G k e0 input' T old et bs new ho hn hw - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := - Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) - rw [hi] at hw ⊢ - intro t - by_cases ht : 1 ≤ t.val - · exact hw.2.1 t ht - · let W := HierarchyStarredStage K - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ - have he : t = ⟨0, W.positive⟩ := Fin.ext (by change t.val = 0; omega) - rw [he, W.first_edge, hn.1, ho.1] - -private theorem helper_hXYlen_1299.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; TreeSequenceInitialSegment A T → j ≤ - T.length - A.length → ( - ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - omega - )) → Y.length = X.length + (1 : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A X Y - hAtoT htail fullPrefixEq - change (HierarchyFullTailPrefix C j).length = - (HierarchyFullTailPrefix C (j - 1)).length + 1 - rw [fullPrefixEq j, fullPrefixEq (j - 1)] - simp only [TreeSequencePrefix] - have hj : 2 ≤ j := hpathLower - have hl : A.length + j ≤ T.length := by - have hAT := hAtoT.1 - clear * - htail hAT - omega - clear * - hj hl - omega - -private theorem helper_hweak1_1358.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (gamma : Fin k), gamma ≠ beta → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet - (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)))) → gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma - (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ))) → Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (Fin.last - T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T gamma)))) → - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; (0 : ℕ) < - H.dividerCount ∧ gamma ∈ TreeMissingColors sigma (H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - sigma (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) ∨ gamma ∈ TreeMissingColors sigma A ∧ - gamma ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds) ∧ beta ∉ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → TwoColorPathComponent G sigma gamma beta z → - HierarchyWeaklyStable H q mu2 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma - hgammaNeBeta hchangeElementary hchangeMissing hterminalDisjoint z mu2 hcase1 hpath1 - as_aux_lemma => - exact (StableChangeCasesOneTwo G k e0 R.corresponding.replacementInput T sigma - R.corresponding.replacementETT R.replacementBase R.counterexample - R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung - R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality - hchangeElementary R.minimumContext.largeMissingSet gamma beta hgammaNeBeta - hchangeMissing z hpath1 mu2 rfl hcase1 hterminalDisjoint).1 - private theorem helper_sameGammaTheta_1456.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -2193,89 +1381,6 @@ private theorem helper_hthetaTerminalDistinct_1473.{u_1, u_2} : have hlt : Y.length < T.length := hYlen.symm ▸ hcutJstrict exact Nat.ne_of_lt hlt hv -private theorem helper_swapOne_1493.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (T : TreeSequence G e0), - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - ∀ (old : PartialEdgeColoring E k) (a b : Fin k), - IsOneEdgeUncolored old e0 → - IsOneEdgeUncolored (TwoColorComponentSwap G old a b z) e0 := by - classical - intro V E G k e0 T z old a b ho - as_aux_lemma => - constructor - · simp only [TwoColorComponentSwap, ho.1, reduceCtorEq, ite_false, ite_self] - · intro e he - obtain ⟨c, hc⟩ := ho.2 e he - by_cases hm : Sum.inr e ∈ TwoColorComponent G old a b z - · by_cases ha : old e = some a - · exact ⟨b, by simp only [TwoColorComponentSwap, hm, ha, ite_true]⟩ - · by_cases hb : old e = some b - · refine ⟨a, ?_⟩ - unfold TwoColorComponentSwap - rw [ite_eq_left hm, ite_eq_right ha, ite_eq_left hb] - · exact ⟨c, by simpa only [TwoColorComponentSwap, hm, ha, hb, ite_true, ite_false] - using hc⟩ - · exact ⟨c, by simpa only [TwoColorComponentSwap, hm, ite_false] using hc⟩ - -private theorem helper_hweak3_1551.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let ell : ℕ := HierarchyFullTailLength C; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - ∀ (gamma : Fin k), gamma ≠ d.theta → - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : - ℕ)) = Z) → - ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho - (TreeSequenceVertexSet Z) → - let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; - TwoColorPathComponent G rho gamma d.theta z → ( - let K : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := - R1.counterexample.hierarchy; (0 : ℕ) < K.dividerCount ∧ gamma ∈ TreeMissingColors rho - (K.stage (⟨K.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (K.dividerCount + (2 : ℕ)))) ∨ K.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - rho (R1.corresponding.replacementETT.series.data.tree (Fin.last - R1.corresponding.replacementETT.rounds).castSucc) ∨ gamma ∈ TreeMissingColors rho - (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ gamma ∉ TashkinovStoredColors - R1.corresponding.replacementETT.series.data (Fin.last - R1.corresponding.replacementETT.rounds) ∧ d.theta ∉ TashkinovStoredColors - R1.corresponding.replacementETT.series.data (Fin.last - R1.corresponding.replacementETT.rounds))) → Disjoint (TwoColorComponent G rho gamma - d.theta z) (TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition rho T gamma)))) → gamma ∈ TreeMissingColors rho - (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - (1 - : ℕ))) ∧ d.theta ∈ TreeMissingColors rho (HierarchyFullTailPrefix R1.counterexample - (HierarchyFullTailLength R1.counterexample - (1 : ℕ))) → HierarchyWeaklyStable - R1.counterexample.hierarchy (Fin.last R1.counterexample.hierarchy.dividerCount) mu3 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d ell Z gamma hgammaNeTheta z - samePenultimate R1 rho hElemRho mu3 hpath3 hcase3 hdisjoint3First hmissingPairCurrent - as_aux_lemma => - exact (StableChangeCasesOneTwo G k e0 R1.corresponding.replacementInput T rho - R1.corresponding.replacementETT R1.replacementBase R1.counterexample - R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung - R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality - (by - change ColoredVertexSetElementary G rho - (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample - (HierarchyFullTailLength R1.counterexample - 1))) - rw [samePenultimate R1] - exact hElemRho) R1.minimumContext.largeMissingSet - gamma d.theta hgammaNeTheta hmissingPairCurrent z hpath3 mu3 rfl hcase3 hdisjoint3First).1 - private theorem helper_hstored3_1568.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -2383,63 +1488,6 @@ private theorem helper_hgammaCutoff3_1581.{u_1, u_2} : rw [hfirstThetaRho] exact hthetaFirst.2 -private theorem helper_hYTerminalDistinct_1628.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; A.length + j < T.length → Y.length = - A.length + j → TreeSequenceInitialSegment Y T → Y.vertex (Fin.last Y.length) ≠ T.vertex - (Fin.last T.length) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A Y hcutJstrict - hYlen hYtoT he - have hi := T.vertex_injective ((hYtoT.2.1 (Fin.last Y.length)).trans he) - have hv := congrArg Fin.val hi - simp only [Fin.val_castLE, Fin.val_last] at hv - exact Nat.ne_of_lt (hYlen.symm ▸ hcutJstrict) hv - -private theorem helper_hjEligible_1647.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - ∀ (gamma : Fin k), - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := R1.coloring; - let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; d.theta ∈ - MissingColors G mu3 (T.vertex (Fin.last T.length)) → d.theta ∈ MissingColors G mu3 - (Y.vertex (Fin.last Y.length)) → - ∀ (R2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), R2.coloring = mu3 - → j ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hpathLower hpathUpper Y - gamma z R1 rho mu3 hthetaTerminalMu3 hthetaYMu3 R2 hR2 - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨?_, ?_⟩, R2, d.theta, ?_, ?_⟩ - · exact (by decide : 1 ≤ 2).trans hpathLower - · exact Nat.le_sub_one_of_lt hpathUpper - · rw [hR2] - exact hthetaYMu3 - · rw [hR2] - exact hthetaTerminalMu3 - private theorem helper_continuation_3145.{u_1, u_2} : helperContinuation3145Conditions.{u_1, u_2} := by classical @@ -2482,7 +1530,8 @@ private theorem helper_continuation_3145.{u_1, u_2} : exact hpairMissingRho have hweak3 : HierarchyWeaklyStable R1.counterexample.hierarchy (Fin.last R1.counterexample.hierarchy.dividerCount) mu3 := by - exact @helper_hweak3_1551 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.hweak3 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaNeTheta) (@samePenultimate) (@R1) (@hElemRho) (@hpath3) (@hcase3) (@hdisjoint3First) (@hmissingPairCurrent) @@ -2540,7 +1589,8 @@ private theorem helper_continuation_3145.{u_1, u_2} : (vertexMemSelf Y (Fin.last Y.length)))] exact hthetaYRho have hYTerminalDistinct : Y.vertex (Fin.last Y.length) ≠ T.vertex (Fin.last T.length) := by - exact @helper_hYTerminalDistinct_1628 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.yTerminalDistinct (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@hYlen) (@hYtoT) let C2 : HierarchyCounterexample bs2 := { @@ -2558,7 +1608,8 @@ private theorem helper_continuation_3145.{u_1, u_2} : ett base C ctx R1 mu3 corr2 bs2 C2 same2 have hjEligible : j ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - exact @helper_hjEligible_1647 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.hjEligible (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hpathLower) (@hpathUpper) (@gamma) (@R1) (@hthetaTerminalMu3) (@hthetaYMu3) (@R2) (@hR2) @@ -2597,7 +1648,8 @@ private theorem helper_continuation_2545.{u_1, u_2} : · exact Or.inr ⟨hz, Or.inl hm⟩ have hpath1 : TwoColorPathComponent G sigma gamma beta z := separation1.2.1 have hweak1 : HierarchyWeaklyStable H q mu2 := by - exact @helper_hweak1_1358 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.hweak1 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaNeBeta) (@hchangeElementary) (@hchangeMissing) (@hterminalDisjoint) (@hcase1) (@hpath1) @@ -2726,7 +1778,8 @@ private theorem helper_continuation_2545.{u_1, u_2} : have swapOne (old : PartialEdgeColoring E k) (a b : Fin k) (ho : IsOneEdgeUncolored old e0) : IsOneEdgeUncolored (TwoColorComponentSwap G old a b z) e0 := by - exact @helper_swapOne_1493 (@V) (@E) (@G) (@k) (@e0) (@T) (@old) (@a) (@b) (@ho) + exact @SharedFacts.DisjointThetaTransport.swapOne (@V) (@E) (@G) (@k) (@e0) (@T) (@old) + (@a) (@b) (@ho) have hmu3One : IsOneEdgeUncolored mu3 e0 := swapOne rho gamma d.theta R1.minimumContext.oneEdgeUncolored have hgammaOutside3 : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) ∉ @@ -2768,7 +1821,8 @@ private theorem helper_continuation_2327.{u_1, u_2} : (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (hca : c ≠ a) (hcb : c ≠ b) : HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = HierarchyFirstMissingPosition rho T c := by - exact @helper_firstUnaffected_1162 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + exact @SharedFacts.SecondSituationTransport.firstUnaffected (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@z) (@rho) (@a) (@b) (@c) (@hne) (@hp) (@hca) (@hcb) have hmissingMu2 : ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v := separation1.2.2 @@ -2777,13 +1831,15 @@ private theorem helper_continuation_2327.{u_1, u_2} : MissingColors G new v = MissingColors G old v) (W : TreeSequence G e0) (hWZ : TreeSequenceInitialSegment W Z) : TreeMissingColors new W = TreeMissingColors old W := by - exact @helper_missingTransport_1179 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.missingTransport (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@old) (@new) (@hm) (@W) (@hWZ) have hstoredMu2 : ∀ eta ∈ D, HierarchyFirstMissingPosition mu2 T eta = HierarchyFirstMissingPosition sigma T eta := by - exact @helper_hstoredMu2_1190 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.hstoredMu2 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaA) (@hgammaNeBeta) (@hZtoT) (@hElemZ) (@hbetaMissingZ) (@firstPreserved) (@firstUnaffected) (@hmissingMu2) @@ -2799,7 +1855,8 @@ private theorem helper_continuation_2327.{u_1, u_2} : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = HierarchyStarredStage S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) := by - exact @helper_originalStar_1216 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.originalStar (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@S) have sameStarAll (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : @@ -2820,7 +1877,8 @@ private theorem helper_continuation_2327.{u_1, u_2} : ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by - exact @helper_lastData_1247 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.lastData (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@S) have sameLast (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : @@ -2828,7 +1886,8 @@ private theorem helper_continuation_2327.{u_1, u_2} : (Fin.last S.counterexample.hierarchy.dividerCount) ∧ ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by - exact @helper_sameLast_1262 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.sameLast (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@lastData) (@S) have weakEdges {input' : PartialEdgeColoring E k} @@ -2840,11 +1899,13 @@ private theorem helper_continuation_2327.{u_1, u_2} : ∀ t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length, new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by - exact @helper_weakEdges_1273 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.weakEdges (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@T) (@input') (@old) (@new) (@et) (@bs) (@K) (@hw) (@ho) (@hn) have hXYlen : Y.length = X.length + 1 := by - exact @helper_hXYlen_1299 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.xYlen (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hj) (@hpathLower) (@hAtoT) (@htail) (@fullPrefixEq) have routeToY (S : HierarchyReplacementPresentation @@ -2910,7 +1971,8 @@ private theorem helper_continuation_3542.{u_1, u_2} : (R.counterexample.good.avoidance q d.theta hthetaStored' hgammaTheta)).1 have hApositive (hq : 0 < H.dividerCount) : A = H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ := by - exact @helper_hApositive_1008 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.apositive (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@hq) have sameGammaBeta : @@ -2918,7 +1980,8 @@ private theorem helper_continuation_3542.{u_1, u_2} : (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) := by - exact @helper_sameGammaBeta_1024 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.sameGammaBeta (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaA) (@firstChange) (@hgammaStageMissing) (@hApositive) have componentSelf (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : @@ -2951,7 +2014,8 @@ private theorem helper_continuation_3542.{u_1, u_2} : exact TwoColorComponentSwapProper G sigma gamma beta hgammaNeBeta R.minimumContext.proper z have hmu2One : IsOneEdgeUncolored mu2 e0 := by - exact @helper_hmu2One_1080 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.hmu2One (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) have hfirstGammaOutside : Sum.inl @@ -2964,7 +2028,8 @@ private theorem helper_continuation_3542.{u_1, u_2} : have hfirstBetaOutside : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∉ TwoColorComponent G sigma gamma beta z := by - exact @helper_hfirstBetaOutside_1105 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.hfirstBetaOutside (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@sameGammaBeta) (@componentSelf) (@hterminalDisjoint) have hswapBehavior := TwoColorComponentSwapMissingBehavior G sigma gamma beta @@ -2992,7 +2057,8 @@ private theorem helper_continuation_3542.{u_1, u_2} : (hmiss : ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) (hc : c ∈ TreeMissingColors rho W) : HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by - exact @helper_firstPreserved_1137 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + exact @SharedFacts.DisjointThetaTransport.firstPreserved (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@j) (@firstWitness) (@W) (@hWT) (@rho) (@sigma) (@c) (@helem) (@hmiss) (@hc) exact @helper_continuation_2327 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) @@ -3028,7 +2094,8 @@ private theorem helper_continuation_2252.{u_1, u_2} : clear * - rho W v c hv hc exact Finset.mem_biUnion.mpr ⟨v, hv, hc⟩ have hthetaY : d.theta ∈ TreeMissingColors sigma Y := by - exact @helper_hthetaY_887 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.hthetaY (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hthetaMissingY) (@vertexMemSelf) (@treeMissingIntro) have hthetaFirst : d.theta ∈ MissingColors G sigma @@ -3039,7 +2106,8 @@ private theorem helper_continuation_2252.{u_1, u_2} : clear_value Y exact firstWitness sigma Y hYtoT d.theta hthetaY have hthetaFirstIndex : (HierarchyFirstMissingPosition sigma T d.theta).val = Y.length := by - exact @helper_hthetaFirstIndex_395 V E inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.hthetaFirstIndex V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C ctx P alpha beta d j hthetaMissingY hYtoT hYtoZ hZtoT hElemZ vertexMemT hthetaFirst have hthetaOutsideGamma : d.theta ∉ D.biUnion (R.counterexample.good.gamma q) := by @@ -3073,7 +2141,8 @@ private theorem helper_continuation_2252.{u_1, u_2} : have treeMissingSubset {U W : TreeSequence G e0} (hUW : TreeSequenceInitialSegment U W) : TreeMissingColors sigma U ⊆ TreeMissingColors sigma W := by - exact @helper_treeMissingSubset_949 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.treeMissingSubset (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@U) (@W) (@hUW) have hgammaMissingZ : gamma ∈ TreeMissingColors sigma Z := @@ -3169,7 +2238,8 @@ theorem HierarchySituationThreeDisjointThetaStoredImpossible (@alpha) (@beta) (@d) (@j) (@hj) have hthetaMissingY : d.theta ∈ MissingColors G sigma (Y.vertex (Fin.last Y.length)) := by - exact @helper_hthetaMissingY_676 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.hthetaMissingY (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hj) obtain ⟨gamma, gamma₂, hgammaNe₂, hgammaPair⟩ := @@ -3187,7 +2257,8 @@ theorem HierarchySituationThreeDisjointThetaStoredImpossible exact d.betaOutsideGamma (heq ▸ hgammaInGammaUnion) have sameStar : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A := by - exact @helper_sameStar_697 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.sameStar (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) have starNext (i : Fin (H.dividerCount + 1)) : @@ -3206,7 +2277,8 @@ theorem HierarchySituationThreeDisjointThetaStoredImpossible clear_value A omega have hcutJstrict : A.length + j < T.length := by - exact @helper_hcutJstrict_730 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.hcutJstrict (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hj) (@sameStar) (@hAtoT) (@hjUpper) have fullPrefixEq (m : ℕ) : HierarchyFullTailPrefix C m = @@ -3217,12 +2289,14 @@ theorem HierarchySituationThreeDisjointThetaStoredImpossible simp only [sameStar] have prefixToTree (m : ℕ) (hm : 1 ≤ m) (hmT : m ≤ T.length) : TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T := by - exact @helper_prefixToTree_743 (@V) (@E) (@G) (@e0) (@T) (@m) (@hm) (@hmT) + exact @SharedFacts.DisjointThetaTransport.prefixToTree (@V) (@E) (@G) (@e0) (@T) (@m) + (@hm) (@hmT) have commonPrefix {U W : TreeSequence G e0} (hUT : TreeSequenceInitialSegment U T) (hWT : TreeSequenceInitialSegment W T) (hUW : U.length ≤ W.length) : TreeSequenceInitialSegment U W := by - exact @helper_commonPrefix_752 (@V) (@E) (@G) (@e0) (@T) (@U) (@W) (@hUT) (@hWT) (@hUW) + exact @SharedFacts.DisjointThetaTransport.comparableInitialSegments (@V) (@E) (@G) (@e0) + (@T) (@U) (@W) (@hUT) (@hWT) (@hUW) have hYlen : Y.length = A.length + j := by change (HierarchyFullTailPrefix C j).length = A.length + j rw [fullPrefixEq j] @@ -3286,7 +2360,8 @@ theorem HierarchySituationThreeDisjointThetaStoredImpossible simp only [Z, ell, HierarchyFullTailPrefix, HierarchyFullTailLength, sameStar] rfl have hElemZ : ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) := by - exact @helper_hElemZ_837 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.elemZ (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@penultimatePrefixEq) have firstWitness (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) @@ -3294,7 +2369,8 @@ theorem HierarchySituationThreeDisjointThetaStoredImpossible (hc : c ∈ TreeMissingColors rho W) : c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ (HierarchyFirstMissingPosition rho T c).val ≤ W.length := by - exact @helper_firstWitness_671 V E inferInstance inferInstance G k e0 T rho W hWT c hc + exact @SharedFacts.DisjointThetaTransport.firstWitness V E inferInstance inferInstance G + k e0 T rho W hWT c hc have hgammaFirst := firstWitness sigma A hAtoT gamma hgammaA have hbetaFirst := firstWitness sigma B hBtoT beta hbetaB have hgammaFirstLe : (HierarchyFirstMissingPosition sigma T gamma).val ≤ A.length := @@ -3304,7 +2380,8 @@ theorem HierarchySituationThreeDisjointThetaStoredImpossible have vertexMemT (W : TreeSequence G e0) (hWT : TreeSequenceInitialSegment W T) (i : Fin (T.length + 1)) (hi : i.val ≤ W.length) : T.vertex i ∈ TreeSequenceVertexSet W := by - exact @helper_vertexMemT_866 (@V) (@E) (@G) (@e0) (@T) (@W) (@hWT) (@i) (@hi) + exact @SharedFacts.DisjointThetaTransport.vertexMemT (@V) (@E) (@G) (@e0) (@T) (@W) + (@hWT) (@i) (@hi) exact @helper_continuation_2252 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean index 30d76b1ca5..f01cbb186b 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaTransport + +public import LeanPool.GoldbergSeymour.SharedFacts.SecondSituationTransport + public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts public import LeanPool.GoldbergSeymour.HierarchyFullTailLength @@ -1019,64 +1023,6 @@ private abbrev helperContinuation3933Conditions.{u_1, u_2} : Prop := TreeSequence G e0) (hWZ : TreeSequenceInitialSegment W Z), TreeMissingColors new W = TreeMissingColors old W), False -private theorem helper_hthetaFirstIndex_397.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let ell : ℕ := HierarchyFullTailLength C; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); d.theta ∈ - MissingColors G sigma (Y.vertex (Fin.last Y.length)) → TreeSequenceInitialSegment Y T → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → - ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) → ( - ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → - ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) - → d.theta ∈ MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma T - d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) ≤ Y.length → - (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma ell Y Z - hthetaMissingY hYtoT hYtoZ hZtoT hElemZ vertexMemT hthetaFirst - as_aux_lemma => - clear_value Y Z - apply Nat.le_antisymm hthetaFirst.2 - by_contra hne - have hlt : (HierarchyFirstMissingPosition sigma T d.theta).val < Y.length := - Nat.lt_of_not_ge hne - have iZ : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ∈ - TreeSequenceVertexSet Z := vertexMemT Z hZtoT - (HierarchyFirstMissingPosition sigma T d.theta) - (Nat.le_trans (Nat.le_of_lt hlt) hYtoZ.1) - have yZ : Y.vertex (Fin.last Y.length) ∈ TreeSequenceVertexSet Z := - TreeSequenceInitialSegmentVertexSetSubset hYtoZ - (by simp [TreeSequenceVertexSet]) - have hvne : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ - Y.vertex (Fin.last Y.length) := by - intro heq - let jY : Fin (Y.length + 1) := - ⟨(HierarchyFirstMissingPosition sigma T d.theta).val, - Nat.lt_succ_of_le (Nat.le_of_lt hlt)⟩ - have hcast : Fin.castLE (Nat.succ_le_succ hYtoT.1) jY = - HierarchyFirstMissingPosition sigma T d.theta := Fin.ext rfl - have heqY : Y.vertex jY = Y.vertex (Fin.last Y.length) := by - have htree := hYtoT.2.1 jY - have hcastV := congrArg T.vertex hcast - exact htree.symm.trans (hcastV.trans heq) - have hidx := Y.vertex_injective heqY - have hval := congrArg Fin.val hidx - dsimp [jY] at hval - exact (Nat.ne_of_lt hlt) hval - exact Finset.disjoint_left.mp (hElemZ iZ yZ hvne) - hthetaFirst.1 hthetaMissingY - private theorem helper_routeToY_1012.{u_1, u_2} : helperRouteToY1012Conditions.{u_1, u_2} := by classical @@ -1165,29 +1111,6 @@ private theorem helper_routeToY_1012.{u_1, u_2} : exact Or.inr ⟨hk, f, seed, he, ha, transport seed (TashkinovAugmentationSequenceRestrict S.coloring seed Y T hr hseedY hYtoT)⟩ -private theorem helper_hthetaMissingY_553.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), HierarchyPathNumber C.hierarchy = j → - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma - (Y.vertex (Fin.last Y.length)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R sigma Y - have ht := d.thetaMissingAtJ - change d.theta ∈ MissingColors G d.switched.coloring - ((HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy)).vertex - (Fin.last (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy)).length)) at ht - rw [hj] at ht - exact ht - private theorem helper_hgammaNeBeta_569.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1213,220 +1136,6 @@ private theorem helper_hgammaNeBeta_569.{u_1, u_2} : exact (Finset.mem_sdiff.mp hbetaStored).2 hmiss exact hnot (heq ▸ hgammaA) -private theorem helper_sameStar_577.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let _ : TreeSequence G e0 := HierarchyFullTailPrefix C j; HierarchyStarredStage C.hierarchy - (Fin.last C.hierarchy.dividerCount) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A X Y - as_aux_lemma => - clear * - G e0 base C R H q A - have helper : - ∀ (n m : ℕ) (X Y : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → - TreeSequence G e0), n = m → X = Y → HEq s t → Fin.cases (motive := fun _ => TreeSequence G - e0) X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => - TreeSequence G e0) Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by - intro n m X Y s t hnm hXY hst - subst m - have hs : s = t := eq_of_heq hst - simp [hXY, hs] - simpa [A, q, HierarchyStarredStage] using (helper _ _ base.core R.replacementBase.core - C.hierarchy.stage - H.stage R.sameGood.1.2.1 R.sameGood.1.1 - R.sameGood.1.2.2.1) - -private theorem helper_hcutJstrict_610.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), HierarchyPathNumber C.hierarchy = j → - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount) = A → TreeSequenceInitialSegment A T → j < ell → A.length + j < - T.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R H q A ell sameStar - hAtoT hjUpper - have hj : j < T.length - A.length := by - simpa only [ell, HierarchyFullTailLength, sameStar] using hjUpper - have hAT := hAtoT.1 - clear * - hj hAT - clear_value A - omega - -private theorem helper_prefixToTree_623.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - (T : TreeSequence G e0) (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmT : m ≤ T.length), - TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T := by - classical - intro V E G e0 T m hm hmT - as_aux_lemma => - refine ⟨hmT, ?_, ?_⟩ - · intro i - simp [TreeSequencePrefix] - · intro i - simp [TreeSequencePrefix] - -private theorem helper_commonPrefix_632.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) - {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T - → U.length ≤ W.length → TreeSequenceInitialSegment U W := by - classical - intro V E G e0 T U W hUT hWT hUW - as_aux_lemma => - rcases hUT with ⟨hu, huv, hue⟩ - rcases hWT with ⟨hw, hwv, hwe⟩ - refine ⟨hUW, ?_, ?_⟩ - · intro i - calc - W.vertex (Fin.castLE (Nat.succ_le_succ hUW) i) = - T.vertex (Fin.castLE (Nat.succ_le_succ hw) - (Fin.castLE (Nat.succ_le_succ hUW) i)) := (hwv _).symm - _ = T.vertex (Fin.castLE (Nat.succ_le_succ hu) i) := by congr 1 - _ = U.vertex i := huv i - · intro i - calc - W.edge (Fin.castLE hUW i) = T.edge (Fin.castLE hw (Fin.castLE hUW i)) := - (hwe _).symm - _ = T.edge (Fin.castLE hu i) := by congr 1 - _ = U.edge i := hue i - -private theorem helper_hElemZ_717.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let ell : ℕ := HierarchyFullTailLength C; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = Z → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma ell Z - penultimatePrefixEq - as_aux_lemma => - have hp : ColoredVertexSetElementary G sigma - (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - 1))) := - HierarchyCounterexamplePenultimateElementary G k e0 - R.corresponding.replacementInput T sigma R.corresponding.replacementETT - R.replacementBase R.counterexample R.minimumContext.proper - R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung - R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality - R.minimumContext.largeMissingSet - intro u hu v hv huv - apply hp - · rw [penultimatePrefixEq]; exact hu - · rw [penultimatePrefixEq]; exact hv - · exact huv - -private theorem helper_firstWitness_734.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), - TreeSequenceInitialSegment W T → - ∀ c ∈ TreeMissingColors rho W, - c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ - (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ W.length := by - classical - intro V E _ _ G k e0 T rho W hWT c hc - let _ := Fintype.ofFinite V - as_aux_lemma => - rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hcv⟩ - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hv - rcases hv with ⟨i, rfl⟩ - let candidates := Finset.univ.filter fun a : Fin (T.length + 1) => - c ∈ MissingColors G rho (T.vertex a) - have hi : Fin.castLE (Nat.succ_le_succ hWT.1) i ∈ candidates := by - simp [candidates, hWT.2.1 i, hcv] - have hn : candidates.Nonempty := ⟨_, hi⟩ - have hmin := Finset.min'_le candidates _ hi - have hmiss : c ∈ MissingColors G rho (T.vertex (candidates.min' hn)) := - (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - have hpos : HierarchyFirstMissingPosition rho T c = candidates.min' hn := by - simp [HierarchyFirstMissingPosition, candidates, hn] - constructor - · simpa [HierarchyFirstMissingPosition, candidates, hn] using hmiss - · rw [hpos] - have hle : (candidates.min' hn).val ≤ i.val := by - change (candidates.min' hn).val ≤ (Fin.castLE (Nat.succ_le_succ hWT.1) i).val at hmin - simpa using hmin - exact le_trans hle (Nat.le_of_lt_succ i.isLt) - -private theorem helper_vertexMemT_768.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T W : TreeSequence G - e0), TreeSequenceInitialSegment W T → - ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W - := by - classical - intro V E G e0 T W hWT i hi - as_aux_lemma => - let jW : Fin (W.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ - have hcast : Fin.castLE (Nat.succ_le_succ hWT.1) jW = i := Fin.ext rfl - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - refine ⟨jW, ?_⟩ - rw [← hWT.2.1 jW, hcast] - -private theorem helper_hthetaY_789.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma - (Y.vertex (Fin.last Y.length)) → ( - ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet - W) → ( - ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) (v : V) (c : Fin k), v ∈ - TreeSequenceVertexSet W → c ∈ MissingColors G rho v → c ∈ TreeMissingColors rho W) → - d.theta ∈ TreeMissingColors sigma Y := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma Y hthetaMissingY - vertexMemSelf treeMissingIntro - as_aux_lemma => - clear_value Y - exact treeMissingIntro sigma Y (Y.vertex (Fin.last Y.length)) d.theta - (vertexMemSelf Y (Fin.last Y.length)) hthetaMissingY - private theorem helper_hbetaAfterA_813.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1503,27 +1212,6 @@ private theorem helper_hgammaUnusedBeforeBeta_834.{u_1, u_2} : (Finset.mem_union.mpr (Or.inl hgammaBeta)) exact htailMem -private theorem helper_treeMissingSubset_868.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ - TreeMissingColors sigma W := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma U W hUW - as_aux_lemma => - intro c hc - obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hc - exact Finset.mem_biUnion.mpr ⟨v, - TreeSequenceInitialSegmentVertexSetSubset hUW hv, hmiss⟩ - private theorem helper_firstChange_904.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1597,110 +1285,6 @@ private theorem helper_firstChange_904.{u_1, u_2} : sigma (T.edge t) = some c) exact horderedUnusedGammaBeta) -private theorem helper_hApositive_927.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; (0 : ℕ) < H.dividerCount → A = H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q A hq - as_aux_lemma => - have hlast : q = - (⟨H.dividerCount - 1, Nat.sub_lt hq (by decide)⟩ : Fin H.dividerCount).succ := by - apply Fin.ext - change H.dividerCount = H.dividerCount - 1 + 1 - exact (Nat.sub_add_cancel hq).symm - change HierarchyStarredStage H q = _ - rw [hlast] - change H.stage _ = H.stage _ - congr 1 - apply Fin.ext - change H.dividerCount - 1 + 1 = H.dividerCount - exact Nat.sub_add_cancel hq - -private theorem helper_sameGammaBeta_943.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ gamma ∈ TreeMissingColors sigma A, ( - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - R.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition sigma T gamma); - have vb : V := T.vertex (HierarchyFirstMissingPosition sigma T beta); - have sameComponent : Prop := TwoColorComponent G sigma gamma beta (Sum.inl va) = - TwoColorComponent G sigma gamma beta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ - TreeMissingColors sigma Tnq ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset - (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - sigma Tn ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → - sameComponent) ∧ ( gamma ∈ TreeMissingColors sigma A ∧ TreeColorSetClosed G sigma A - ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A sigma gamma beta)) - → gamma ∈ HierarchyStageMissingColors H q → ( (0 : ℕ) < H.dividerCount → A = H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma hgammaA - firstChange hgammaStageMissing hApositive - by_cases hzero : H.dividerCount = 0 - · have hgammaRaw : gamma ∈ TreeMissingColors sigma - (R.corresponding.replacementETT.series.data.tree - (Fin.last R.corresponding.replacementETT.rounds).castSucc) := by - have hq0 : q = 0 := by - apply Fin.ext - simp [q, hzero] - rw [hq0] at hgammaStageMissing - simpa [HierarchyStageMissingColors] using hgammaStageMissing - exact firstChange.2.1 ⟨hzero, Or.inl hgammaRaw⟩ - · have hgammaLast : gamma ∈ TreeMissingColors sigma - (H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩) := by - have hstar : A = H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ := - hApositive (Nat.pos_of_ne_zero hzero) - rw [← hstar] - exact hgammaA - exact firstChange.1 ⟨Nat.pos_of_ne_zero hzero, Or.inl hgammaLast⟩ - private theorem helper_hBlt_1027.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1789,72 +1373,6 @@ private theorem helper_hbetaTerminalDistinct_1049.{u_1, u_2} : simp only [Fin.val_last] at hv exact (Nat.ne_of_lt (hbetaFirstLe.trans_lt hBlt)) hv -private theorem helper_hmu2One_1069.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - ∀ (gamma : Fin k), - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; - IsOneEdgeUncolored mu2 e0 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma z mu2 - as_aux_lemma => - constructor - · have he0 : sigma e0 = none := R.minimumContext.oneEdgeUncolored.1 - simp [mu2, TwoColorComponentSwap, he0] - · intro e he0 - obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 e he0 - by_cases heK : Sum.inr e ∈ TwoColorComponent G sigma gamma beta z - · by_cases heGamma : sigma e = some gamma - · exact ⟨beta, by simp [mu2, TwoColorComponentSwap, heK, heGamma] - ⟩ - · by_cases heBeta : sigma e = some beta - · exact ⟨gamma, by - simp [mu2, TwoColorComponentSwap, heK, heBeta] - ⟩ - · exact ⟨c, by - simpa [mu2, TwoColorComponentSwap, heK, heGamma, heBeta] using hc⟩ - · exact ⟨c, by simpa [mu2, TwoColorComponentSwap, heK] using hc⟩ - -private theorem helper_hfirstBetaOutside_1094.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - ∀ (gamma : Fin k), TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) → ( - ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a - b (Sum.inl v)) → Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex - (Fin.last T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T gamma)))) → - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T beta)) ∉ TwoColorComponent G sigma gamma beta z := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma sameGammaBeta - componentSelf hterminalDisjoint z hv - have hv' : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∈ - TwoColorComponent G sigma gamma beta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) := by - rw [sameGammaBeta] - exact componentSelf sigma gamma beta - (T.vertex (HierarchyFirstMissingPosition sigma T beta)) - exact (Set.disjoint_left.mp hterminalDisjoint) hv hv' - private theorem helper_hfixedThroughY_1119.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1906,63 +1424,6 @@ private theorem helper_hfixedThroughY_1119.{u_1, u_2} : · simp [mu2, TwoColorComponentSwap, hcomponent, hgammaUnused, hbetaUnused] · simp [mu2, TwoColorComponentSwap, hcomponent] -private theorem helper_firstPreserved_1154.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (T : TreeSequence G e0) (_ : ℕ), ( - ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → - ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex - (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) - ≤ W.length) → - ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → - ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho - (TreeSequenceVertexSet W) → ( - ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ - TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = - HierarchyFirstMissingPosition rho T c := by - classical - intro V E _ _ G k e0 T j firstWitness W hWT rho sigma c helem hmiss hc - let _ := Fintype.ofFinite V - as_aux_lemma => - clear * - G T W rho sigma c helem hmiss hc firstWitness hWT - have hr := firstWitness rho W hWT c hc - have hc' : c ∈ TreeMissingColors sigma W := by - obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc - exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ - have hs := firstWitness sigma W hWT c hc' - have pref (i : Fin (T.length + 1)) (hi : i.val ≤ W.length) : - T.vertex i ∈ TreeSequenceVertexSet W := by - let j : Fin (W.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ - have he : Fin.castLE (Nat.succ_le_succ hWT.1) j = i := Fin.ext rfl - exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr - ⟨j, Finset.mem_univ _, (hWT.2.1 j).symm.trans (congrArg T.vertex he)⟩ - by_contra hne - have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ - T.vertex (HierarchyFirstMissingPosition rho T c) := - fun he => hne (T.vertex_injective he) - have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 - exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 - -private theorem helper_firstUnaffected_1179.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (T : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin - k), a ≠ b → IsProperEdgeColoring G rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition - (TwoColorComponentSwap G rho a b z) T c = HierarchyFirstMissingPosition rho T c := by - classical - intro V E _ _ G k e0 T z rho a b c hne hp hca hcb - let _ := Fintype.ofFinite V - have hb := TwoColorComponentSwapMissingBehavior G rho a b hne hp z - have he : (Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G (TwoColorComponentSwap G rho a b z) (T.vertex i)) = - (Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G rho (T.vertex i)) := by - ext i - simp only [Finset.mem_filter, Finset.mem_univ, true_and] - exact hb.2.2.2 _ c hca hcb - unfold HierarchyFirstMissingPosition - rw [he] - private theorem helper_hmissingMu2_1194.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -2021,75 +1482,6 @@ private theorem helper_hmissingMu2_1194.{u_1, u_2} : (T.vertex (HierarchyFirstMissingPosition sigma T beta)) hgZ hbZ hgammaFirst.1 hbetaFirst.1 hfirstGammaOutside hfirstBetaOutside v hv -private theorem helper_missingTransport_1207.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let ell : ℕ := HierarchyFullTailLength C; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - ∀ (old new : PartialEdgeColoring E k), ( - ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) → - ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W Z → TreeMissingColors new W = - TreeMissingColors old W := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ell Z old new hm W hWZ - as_aux_lemma => - clear_value Z - clear * - old new hm W hWZ Z - unfold TreeMissingColors - exact Finset.biUnion_congr rfl (fun v hv => - hm v (TreeSequenceInitialSegmentVertexSetSubset hWZ hv)) - -private theorem helper_hstoredMu2_1218.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - let D : Finset (Fin k) := HierarchyStoredColorsAt H q; - ∀ gamma ∈ TreeMissingColors sigma A, gamma ≠ beta → TreeSequenceInitialSegment Z T → - ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) → beta ∈ TreeMissingColors - sigma Z → - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; ( - ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → - ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho - (TreeSequenceVertexSet W) → ( - ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ - TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = - HierarchyFirstMissingPosition rho T c) → ( - ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G - rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T - c = HierarchyFirstMissingPosition rho T c) → ( - ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v) → - ∀ eta ∈ D, HierarchyFirstMissingPosition mu2 T eta = HierarchyFirstMissingPosition sigma T eta - := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A ell Z D gamma - hgammaA hgammaNeBeta hZtoT hElemZ hbetaMissingZ z mu2 firstPreserved firstUnaffected - hmissingMu2 eta heta - have hneGamma : eta ≠ gamma := by - intro he - exact (Finset.mem_sdiff.mp heta).2 (he.symm ▸ hgammaA) - by_cases he : eta = beta - · subst eta - exact firstPreserved Z hZtoT sigma mu2 beta hElemZ hmissingMu2 hbetaMissingZ - · exact firstUnaffected z sigma gamma beta eta hgammaNeBeta - R.minimumContext.proper hneGamma he - private theorem helper_hgammaCutoff_1230.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -2127,162 +1519,6 @@ private theorem helper_hgammaCutoff_1230.{u_1, u_2} : subst eta exact hbetaFirstLe.trans (hBtoX.1.trans hXtoY.1) -private theorem helper_originalStar_1244.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (S : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyStarredStage - C.hierarchy (Fin.last C.hierarchy.dividerCount) = HierarchyStarredStage - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx S - as_aux_lemma => - have helper : - ∀ (n m : ℕ) (U W : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → - TreeSequence G e0), n = m → U = W → HEq s t → Fin.cases (motive := fun _ => TreeSequence G - e0) U (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => - TreeSequence G e0) W (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by - intro n m U W s t hnm hUW hst - subst m - have he : s = t := eq_of_heq hst - simp only [hUW, he] - exact helper _ _ _ _ _ _ S.sameGood.1.2.1 S.sameGood.1.1 S.sameGood.1.2.2.1 - -private theorem helper_lastData_1275.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = - HierarchyStoredColorsAt S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), - C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = - S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx S - as_aux_lemma => - obtain ⟨hc, hd⟩ := S.sameGood.2 - have hi : Fin.cast (congrArg (fun n => n + 1) hc) - (Fin.last C.hierarchy.dividerCount) = - Fin.last S.counterexample.hierarchy.dividerCount := Fin.ext hc - simpa only [hi] using hd (Fin.last C.hierarchy.dividerCount) - -private theorem helper_sameLast_1290.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let D : Finset (Fin k) := HierarchyStoredColorsAt H q; ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = - HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma - (Fin.last C.hierarchy.dividerCount) eta = S.counterexample.good.gamma (Fin.last - S.counterexample.hierarchy.dividerCount) eta) → - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = - HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last - S.counterexample.hierarchy.dividerCount) eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q D lastData S - refine ⟨(lastData R).1.symm.trans (lastData S).1, ?_⟩ - intro eta heta - have hc : eta ∈ HierarchyStoredColorsAt C.hierarchy - (Fin.last C.hierarchy.dividerCount) := (lastData R).1.symm ▸ heta - exact ((lastData R).2 eta hc).symm.trans ((lastData S).2 eta hc) - -private theorem helper_weakEdges_1301.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : - ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : - TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → - IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → - ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new - ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage - K (Fin.last K.dividerCount)).edge t) := by - classical - intro V E _ _ _ _ G k e0 T input' old new et bs K hw ho hn - as_aux_lemma => - by_cases hz : K.dividerCount = 0 - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz - rw [hi] at hw ⊢ - exact P2813_T1_BaseDisplayedEdges G k e0 input' T old et bs new ho hn hw - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := - Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) - rw [hi] at hw ⊢ - intro t - by_cases ht : 1 ≤ t.val - · exact hw.2.1 t ht - · let W := HierarchyStarredStage K - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ - have he : t = ⟨0, W.positive⟩ := Fin.ext (by change t.val = 0; omega) - rw [he, W.first_edge, hn.1, ho.1] - -private theorem helper_hXYlen_1327.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; TreeSequenceInitialSegment A T → j ≤ - T.length - A.length → ( - ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - omega - )) → Y.length = X.length + (1 : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A X Y - hAtoT htail fullPrefixEq - change (HierarchyFullTailPrefix C j).length = - (HierarchyFullTailPrefix C (j - 1)).length + 1 - rw [fullPrefixEq j, fullPrefixEq (j - 1)] - simp only [TreeSequencePrefix] - have hj : 2 ≤ j := hpathLower - have hl : A.length + j ≤ T.length := by - have hAT := hAtoT.1 - clear * - htail hAT - omega - clear * - hj hl - omega - private theorem helper_caseGamma_1360.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -2344,54 +1580,6 @@ private theorem helper_caseGamma_1360.{u_1, u_2} : rw [hc] at hm exact hm -private theorem helper_hweak1_1415.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (gamma : Fin k), gamma ≠ beta → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet - (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)))) → gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma - (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ))) → Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (Fin.last - T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T gamma)))) → - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; (0 : ℕ) < - H.dividerCount ∧ gamma ∈ TreeMissingColors sigma (H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - sigma (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) ∨ gamma ∈ TreeMissingColors sigma A ∧ - gamma ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds) ∧ beta ∉ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → TwoColorPathComponent G sigma gamma beta z → - HierarchyWeaklyStable H q mu2 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma - hgammaNeBeta hchangeElementary hchangeMissing hterminalDisjoint z mu2 hcase1 hpath1 - as_aux_lemma => - exact (StableChangeCasesOneTwo G k e0 R.corresponding.replacementInput T sigma - R.corresponding.replacementETT R.replacementBase R.counterexample - R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung - R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality - hchangeElementary R.minimumContext.largeMissingSet gamma beta hgammaNeBeta - hchangeMissing z hpath1 mu2 rfl hcase1 hterminalDisjoint).1 - private theorem helper_thetaRawIfUsed_1463.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -2660,89 +1848,6 @@ private theorem helper_hthetaTerminalDistinct_1589.{u_1, u_2} : have hlt : Y.length < T.length := hYlen.symm ▸ hcutJstrict exact Nat.ne_of_lt hlt hv -private theorem helper_swapOne_1608.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (T : TreeSequence G e0), - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - ∀ (old : PartialEdgeColoring E k) (a b : Fin k), - IsOneEdgeUncolored old e0 → - IsOneEdgeUncolored (TwoColorComponentSwap G old a b z) e0 := by - classical - intro V E G k e0 T z old a b ho - as_aux_lemma => - constructor - · simp only [TwoColorComponentSwap, ho.1, reduceCtorEq, ite_false, ite_self] - · intro e he - obtain ⟨c, hc⟩ := ho.2 e he - by_cases hm : Sum.inr e ∈ TwoColorComponent G old a b z - · by_cases ha : old e = some a - · exact ⟨b, by simp only [TwoColorComponentSwap, hm, ha, ite_true]⟩ - · by_cases hb : old e = some b - · refine ⟨a, ?_⟩ - unfold TwoColorComponentSwap - rw [ite_eq_left hm, ite_eq_right ha, ite_eq_left hb] - · exact ⟨c, by simpa only [TwoColorComponentSwap, hm, ha, hb, ite_true, ite_false] - using hc⟩ - · exact ⟨c, by simpa only [TwoColorComponentSwap, hm, ite_false] using hc⟩ - -private theorem helper_hweak3_1679.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let ell : ℕ := HierarchyFullTailLength C; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - ∀ (gamma : Fin k), gamma ≠ d.theta → - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : - ℕ)) = Z) → - ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho - (TreeSequenceVertexSet Z) → - let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; - TwoColorPathComponent G rho gamma d.theta z → ( - let K : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := - R1.counterexample.hierarchy; (0 : ℕ) < K.dividerCount ∧ gamma ∈ TreeMissingColors rho - (K.stage (⟨K.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (K.dividerCount + (2 : ℕ)))) ∨ K.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - rho (R1.corresponding.replacementETT.series.data.tree (Fin.last - R1.corresponding.replacementETT.rounds).castSucc) ∨ gamma ∈ TreeMissingColors rho - (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ gamma ∉ TashkinovStoredColors - R1.corresponding.replacementETT.series.data (Fin.last - R1.corresponding.replacementETT.rounds) ∧ d.theta ∉ TashkinovStoredColors - R1.corresponding.replacementETT.series.data (Fin.last - R1.corresponding.replacementETT.rounds))) → Disjoint (TwoColorComponent G rho gamma - d.theta z) (TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition rho T gamma)))) → gamma ∈ TreeMissingColors rho - (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - (1 - : ℕ))) ∧ d.theta ∈ TreeMissingColors rho (HierarchyFullTailPrefix R1.counterexample - (HierarchyFullTailLength R1.counterexample - (1 : ℕ))) → HierarchyWeaklyStable - R1.counterexample.hierarchy (Fin.last R1.counterexample.hierarchy.dividerCount) mu3 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d ell Z gamma hgammaNeTheta z - samePenultimate R1 rho hElemRho mu3 hpath3 hcase3 hdisjoint3First hmissingPairCurrent - as_aux_lemma => - exact (StableChangeCasesOneTwo G k e0 R1.corresponding.replacementInput T rho - R1.corresponding.replacementETT R1.replacementBase R1.counterexample - R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung - R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality - (by - change ColoredVertexSetElementary G rho - (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample - (HierarchyFullTailLength R1.counterexample - 1))) - rw [samePenultimate R1] - exact hElemRho) R1.minimumContext.largeMissingSet - gamma d.theta hgammaNeTheta hmissingPairCurrent z hpath3 mu3 rfl hcase3 hdisjoint3First).1 - private theorem helper_hstored3_1693.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -2840,63 +1945,6 @@ private theorem helper_hgammaCutoff3_1706.{u_1, u_2} : rw [hfirstBetaRho] exact hbetaFirstLe.trans (hBtoX.1.trans hXtoY.1) -private theorem helper_hYTerminalDistinct_1753.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; A.length + j < T.length → Y.length = - A.length + j → TreeSequenceInitialSegment Y T → Y.vertex (Fin.last Y.length) ≠ T.vertex - (Fin.last T.length) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A Y hcutJstrict - hYlen hYtoT he - have hi := T.vertex_injective ((hYtoT.2.1 (Fin.last Y.length)).trans he) - have hv := congrArg Fin.val hi - simp only [Fin.val_castLE, Fin.val_last] at hv - exact Nat.ne_of_lt (hYlen.symm ▸ hcutJstrict) hv - -private theorem helper_hjEligible_1763.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - ∀ (gamma : Fin k), - let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); - ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := R1.coloring; - let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; d.theta ∈ - MissingColors G mu3 (T.vertex (Fin.last T.length)) → d.theta ∈ MissingColors G mu3 - (Y.vertex (Fin.last Y.length)) → - ∀ (R2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), R2.coloring = mu3 - → j ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hpathLower hpathUpper Y - gamma z R1 rho mu3 hthetaTerminalMu3 hthetaYMu3 R2 hR2 - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨?_, ?_⟩, R2, d.theta, ?_, ?_⟩ - · exact (by decide : 1 ≤ 2).trans hpathLower - · exact Nat.le_sub_one_of_lt hpathUpper - · rw [hR2] - exact hthetaYMu3 - · rw [hR2] - exact hthetaTerminalMu3 - private theorem helper_continuation_3731.{u_1, u_2} : helperContinuation3731Conditions.{u_1, u_2} := by classical @@ -2924,7 +1972,7 @@ private theorem helper_continuation_3731.{u_1, u_2} : have swapOne (old : PartialEdgeColoring E k) (a b : Fin k) (ho : IsOneEdgeUncolored old e0) : IsOneEdgeUncolored (TwoColorComponentSwap G old a b z) e0 := by - exact helper_swapOne_1608 (@G) (@k) (@e0) (@T) (@old) (@a) (@b) (@ho) + exact SharedFacts.DisjointThetaTransport.swapOne (@G) (@k) (@e0) (@T) (@old) (@a) (@b) (@ho) have hmu3One : IsOneEdgeUncolored mu3 e0 := swapOne rho gamma d.theta R1.minimumContext.oneEdgeUncolored have hgammaOutside3 : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) ∉ @@ -2983,7 +2031,8 @@ private theorem helper_continuation_3731.{u_1, u_2} : exact hpairMissingRho have hweak3 : HierarchyWeaklyStable R1.counterexample.hierarchy (Fin.last R1.counterexample.hierarchy.dividerCount) mu3 := by - exact helper_hweak3_1679 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + exact SharedFacts.DisjointThetaTransport.hweak3 (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaNeTheta) (@samePenultimate) (@R1) (@hElemRho) (@hpath3) (@hcase3) (@hdisjoint3First) (@hmissingPairCurrent) @@ -3035,7 +2084,8 @@ private theorem helper_continuation_3731.{u_1, u_2} : (vertexMemSelf Y (Fin.last Y.length)))] exact hthetaYRho have hYTerminalDistinct : Y.vertex (Fin.last Y.length) ≠ T.vertex (Fin.last T.length) := by - exact helper_hYTerminalDistinct_1753 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.DisjointThetaTransport.yTerminalDistinct (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@hYlen) (@hYtoT) let C2 : HierarchyCounterexample bs2 := by exact @helperC21693 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) @@ -3046,7 +2096,8 @@ private theorem helper_continuation_3731.{u_1, u_2} : ett base C ctx R1 mu3 corr2 bs2 C2 same2 have hjEligible : j ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - exact helper_hjEligible_1763 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.DisjointThetaTransport.hjEligible (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hpathLower) (@hpathUpper) (@gamma) (@R1) (@hthetaTerminalMu3) (@hthetaYMu3) (@R2) (@hR2) have hbound := HierarchySituationThreeEligibleIndexBound G k e0 input T phi ett base C ctx @@ -3215,7 +2266,8 @@ private theorem helper_continuation_3042.{u_1, u_2} : componentLeaf sigma gamma beta hgammaNeBeta R.minimumContext.proper _ (Or.inr d.betaMissingTerminal)⟩ have hweak1 : HierarchyWeaklyStable H q mu2 := by - exact helper_hweak1_1415 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + exact SharedFacts.DisjointThetaTransport.hweak1 (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaNeBeta) (@hchangeElementary) (@hchangeMissing) (@hterminalDisjoint) (@hcase1) (@hpath1) @@ -3291,7 +2343,8 @@ private theorem helper_continuation_3933.{u_1, u_2} : have hstoredMu2 : ∀ eta ∈ D, HierarchyFirstMissingPosition mu2 T eta = HierarchyFirstMissingPosition sigma T eta := by - exact helper_hstoredMu2_1218 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.DisjointThetaTransport.hstoredMu2 (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaA) (@hgammaNeBeta) (@hZtoT) (@hElemZ) (@hbetaMissingZ) (@firstPreserved) (@firstUnaffected) (@hmissingMu2) have hgammaCutoff : ∀ eta ∈ D, @@ -3307,7 +2360,8 @@ private theorem helper_continuation_3933.{u_1, u_2} : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = HierarchyStarredStage S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) := by - exact helper_originalStar_1244 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.DisjointThetaTransport.originalStar (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@S) have sameStarAll (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : @@ -3328,14 +2382,16 @@ private theorem helper_continuation_3933.{u_1, u_2} : ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by - exact helper_lastData_1275 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@S) + exact SharedFacts.DisjointThetaTransport.lastData (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@S) have sameLast (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : D = HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by - exact helper_sameLast_1290 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.DisjointThetaTransport.sameLast (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@lastData) (@S) have weakEdges {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) @@ -3346,10 +2402,12 @@ private theorem helper_continuation_3933.{u_1, u_2} : ∀ t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length, new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by - exact helper_weakEdges_1301 (@G) (@k) (@e0) (@T) (@old) (@new) (@et) (@bs) (@K) (@hw) (@ho) + exact SharedFacts.DisjointThetaTransport.weakEdges (@G) (@k) (@e0) (@T) (@old) (@new) + (@et) (@bs) (@K) (@hw) (@ho) (@hn) have hXYlen : Y.length = X.length + 1 := by - exact helper_hXYlen_1327 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + exact SharedFacts.DisjointThetaTransport.xYlen (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hj) (@hpathLower) (@hAtoT) (@htail) (@fullPrefixEq) have routeToY (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : PartialEdgeColoring E k) @@ -3419,7 +2477,8 @@ private theorem helper_continuation_2662.{u_1, u_2} : exact TwoColorComponentSwapProper G sigma gamma beta hgammaNeBeta R.minimumContext.proper z have hmu2One : IsOneEdgeUncolored mu2 e0 := by - exact helper_hmu2One_1069 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.DisjointThetaTransport.hmu2One (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) have hfirstGammaOutside : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) ∉ @@ -3431,7 +2490,8 @@ private theorem helper_continuation_2662.{u_1, u_2} : have hfirstBetaOutside : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∉ TwoColorComponent G sigma gamma beta z := by - exact helper_hfirstBetaOutside_1094 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.DisjointThetaTransport.hfirstBetaOutside (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@sameGammaBeta) (@componentSelf) (@hterminalDisjoint) have hswapBehavior := TwoColorComponentSwapMissingBehavior G sigma gamma beta @@ -3470,13 +2530,15 @@ private theorem helper_continuation_2662.{u_1, u_2} : (hmiss : ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) (hc : c ∈ TreeMissingColors rho W) : HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by - exact helper_firstPreserved_1154 (@G) (@k) (@e0) (@T) (@j) (@firstWitness) (@W) (@hWT) (@rho) + exact SharedFacts.DisjointThetaTransport.firstPreserved (@G) (@k) (@e0) (@T) (@j) + (@firstWitness) (@W) (@hWT) (@rho) (@sigma) (@c) (@helem) (@hmiss) (@hc) have firstUnaffected (z : Sum V E) (rho : PartialEdgeColoring E k) (a b c : Fin k) (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (hca : c ≠ a) (hcb : c ≠ b) : HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = HierarchyFirstMissingPosition rho T c := by - exact helper_firstUnaffected_1179 (@G) (@k) (@e0) (@T) (@z) (@rho) (@a) (@b) (@c) (@hne) + exact SharedFacts.SecondSituationTransport.firstUnaffected (@G) (@k) (@e0) (@T) (@z) + (@rho) (@a) (@b) (@c) (@hne) (@hp) (@hca) (@hcb) have hmissingMu2 : ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v := by @@ -3489,7 +2551,8 @@ private theorem helper_continuation_2662.{u_1, u_2} : MissingColors G new v = MissingColors G old v) (W : TreeSequence G e0) (hWZ : TreeSequenceInitialSegment W Z) : TreeMissingColors new W = TreeMissingColors old W := by - exact helper_missingTransport_1207 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.DisjointThetaTransport.missingTransport (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@old) (@new) (@hm) (@W) (@hWZ) exact @helper_continuation_3933 (@V) (@E) inferInstance inferInstance inferInstance @@ -3526,7 +2589,8 @@ private theorem helper_continuation_2578.{u_1, u_2} : clear * - rho W v c hv hc exact Finset.mem_biUnion.mpr ⟨v, hv, hc⟩ have hthetaY : d.theta ∈ TreeMissingColors sigma Y := by - exact helper_hthetaY_789 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + exact SharedFacts.DisjointThetaTransport.hthetaY (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hthetaMissingY) (@vertexMemSelf) (@treeMissingIntro) have hthetaFirst : d.theta ∈ MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma T d.theta)) ∧ @@ -3536,7 +2600,8 @@ private theorem helper_continuation_2578.{u_1, u_2} : clear_value Y exact firstWitness sigma Y hYtoT d.theta hthetaY have hthetaFirstIndex := - helper_hthetaFirstIndex_397 G k e0 input T phi ett base C ctx P alpha beta d j hthetaMissingY + SharedFacts.DisjointThetaTransport.hthetaFirstIndex G k e0 input T phi ett base C ctx P + alpha beta d j hthetaMissingY hYtoT hYtoZ hZtoT hElemZ vertexMemT hthetaFirst have hthetaOutsideGamma : d.theta ∉ D.biUnion (R.counterexample.good.gamma q) := by @@ -3594,7 +2659,8 @@ private theorem helper_continuation_2578.{u_1, u_2} : have treeMissingSubset {U W : TreeSequence G e0} (hUW : TreeSequenceInitialSegment U W) : TreeMissingColors sigma U ⊆ TreeMissingColors sigma W := by - exact @helper_treeMissingSubset_868 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaTransport.treeMissingSubset (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@U) (@W) (@hUW) have hgammaMissingZ : gamma ∈ TreeMissingColors sigma Z := @@ -3633,14 +2699,16 @@ private theorem helper_continuation_2578.{u_1, u_2} : (R.counterexample.good.avoidance q beta hbetaStored hgammaBeta)).1 have hApositive (hq : 0 < H.dividerCount) : A = H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ := by - exact helper_hApositive_927 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.DisjointThetaTransport.apositive (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@hq) have sameGammaBeta : TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) := by - exact helper_sameGammaBeta_943 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.DisjointThetaTransport.sameGammaBeta (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaA) (@firstChange) (@hgammaStageMissing) (@hApositive) have componentSelf (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : @@ -3747,7 +2815,8 @@ theorem HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible rcases hcondition with ⟨hbetaStored, hbetaB, hbetaTail⟩ have hthetaMissingY : d.theta ∈ MissingColors G sigma (Y.vertex (Fin.last Y.length)) := by - exact helper_hthetaMissingY_553 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.DisjointThetaTransport.hthetaMissingY (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hj) obtain ⟨gamma, gamma₂, hgammaNe₂, hgammaPair⟩ := Finset.card_eq_two.mp (R.counterexample.good.twoColors q beta hbetaStored) @@ -3764,7 +2833,8 @@ theorem HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible simpa [R, H, q, D] using hthetaUnstored have sameStar : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A := by - exact helper_sameStar_577 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.DisjointThetaTransport.sameStar (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) have starNext (i : Fin (H.dividerCount + 1)) : TreeSequenceInitialSegment (HierarchyStarredStage H i) (H.stage i.succ) := @@ -3782,7 +2852,8 @@ theorem HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible clear_value A omega have hcutJstrict : A.length + j < T.length := by - exact helper_hcutJstrict_610 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.DisjointThetaTransport.hcutJstrict (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hj) (@sameStar) (@hAtoT) (@hjUpper) have fullPrefixEq (m : ℕ) : HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) @@ -3792,12 +2863,13 @@ theorem HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible simp only [sameStar] have prefixToTree (m : ℕ) (hm : 1 ≤ m) (hmT : m ≤ T.length) : TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T := by - exact helper_prefixToTree_623 (@G) (@e0) (@T) (@m) (@hm) (@hmT) + exact SharedFacts.DisjointThetaTransport.prefixToTree (@G) (@e0) (@T) (@m) (@hm) (@hmT) have commonPrefix {U W : TreeSequence G e0} (hUT : TreeSequenceInitialSegment U T) (hWT : TreeSequenceInitialSegment W T) (hUW : U.length ≤ W.length) : TreeSequenceInitialSegment U W := by - exact helper_commonPrefix_632 (@G) (@e0) (@T) (@hUT) (@hWT) (@hUW) + exact SharedFacts.DisjointThetaTransport.comparableInitialSegments (@G) (@e0) (@T) + (@hUT) (@hWT) (@hUW) have hYlen : Y.length = A.length + j := by change (HierarchyFullTailPrefix C j).length = A.length + j rw [fullPrefixEq j] @@ -3861,14 +2933,16 @@ theorem HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible simp only [Z, ell, HierarchyFullTailPrefix, HierarchyFullTailLength, sameStar] rfl have hElemZ : ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) := by - exact helper_hElemZ_717 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.DisjointThetaTransport.elemZ (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@penultimatePrefixEq) have firstWitness (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) (hWT : TreeSequenceInitialSegment W T) (c : Fin k) (hc : c ∈ TreeMissingColors rho W) : c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ (HierarchyFirstMissingPosition rho T c).val ≤ W.length := by - exact helper_firstWitness_734 (@G) (@k) (@e0) (@T) (@rho) (@W) (@hWT) (@c) (@hc) + exact SharedFacts.DisjointThetaTransport.firstWitness (@G) (@k) (@e0) (@T) (@rho) (@W) + (@hWT) (@c) (@hc) have hgammaFirst := firstWitness sigma A hAtoT gamma hgammaA have hbetaFirst := firstWitness sigma B hBtoT beta hbetaB have hgammaFirstLe : (HierarchyFirstMissingPosition sigma T gamma).val ≤ A.length := @@ -3878,7 +2952,7 @@ theorem HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible have vertexMemT (W : TreeSequence G e0) (hWT : TreeSequenceInitialSegment W T) (i : Fin (T.length + 1)) (hi : i.val ≤ W.length) : T.vertex i ∈ TreeSequenceVertexSet W := by - exact helper_vertexMemT_768 (@G) (@e0) (@T) (@W) (@hWT) (@i) (@hi) + exact SharedFacts.DisjointThetaTransport.vertexMemT (@G) (@e0) (@T) (@W) (@hWT) (@i) (@hi) exact @helper_continuation_2578 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean index b1bebdbf05..35ed67b949 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean @@ -5,7 +5,10 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts +public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningTransport + +public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement + public import LeanPool.GoldbergSeymour.EligibleIndexBoundConstruction public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion @@ -86,14 +89,11 @@ private theorem helper_continuation_5341.{u_1, u_2} : have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (B.length + 1)) (hj : c ∈ MissingColors G psi (B.vertex j)) : (HierarchyFirstMissingPosition psi B c).val ≤ j.val := by - exact helper_firstLe_2252 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) (@hlenT) (@psi) (@c) (@j) (@hj) + exact TreeSequenceFirstMissingPositionLe hj have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) (hlt : (HierarchyFirstMissingPosition psi B c).val < B.length) : c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c)) := by - exact helper_firstMem_2262 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) (@hlenT) (@hBlength) (@S) (@hSBlen) (@positiveB) (@aboveB) (@strictB) (@belowB) - (@generatingB) (@baseB) (@HB) (@psi) (@c) (@hlt) + exact TreeSequenceFirstMissingPositionMem hlt have firstEq (c : Fin k) : HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c := by exact helper_firstEq_1174 G k e0 input T phi ett base C ctx P alpha hlenT hBlength S hSBlen @@ -1046,28 +1046,6 @@ private theorem helper_advance_1257.{u_1, u_2} : input T phi ett base C ctx componentData trans starEq hAT hlen hBT fullB elementary vertexMem firstAt stageSwitch gammaTransport outsideA notRaw gammaChoice m P alpha ha haLast hm hmT hAX hXB hAXlt haM theta htheta nextMember excNext excM avoidNext hAlphaStored -private theorem helper_firstMem_2558.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - (psi : PartialEdgeColoring E k) (c : Fin k), - (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → - c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by - classical - intro V E _ _ G k e0 T psi c hlt - let _ := Fintype.ofFinite V - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G psi (T.vertex j) - by_cases hn : candidates.Nonempty - · unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by - unfold HierarchyFirstMissingPosition - rw [dite_eq_right hn] - rfl - omega - private theorem helper_outsideA_2628.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1140,19 +1118,6 @@ private theorem helper_consecutive_2671.{u_1, u_2} : rw [hm] at hh exact hh t ht -private theorem helper_trans_3344.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y - Z → TreeSequenceInitialSegment X Z := by - classical - intro V E G e0 X Y Z hXY hYZ - refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) - private theorem helper_common_3354.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E), ( @@ -1260,176 +1225,6 @@ private theorem helper_elementary_3419.{u_1, u_2} : intro u hu v hv hne exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne -private theorem helper_firstLe_3436.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + (1 : ℕ))), - c ∈ MissingColors G psi (T.vertex j) → - HierarchyFirstMissingPosition psi T c ≤ j := by - classical - intro V E _ _ G k e0 T psi c j hj - let _ := Fintype.ofFinite V - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G psi (T.vertex j) - have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ - have hn : candidates.Nonempty := ⟨j, hm⟩ - unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - exact Finset.min'_le candidates j hm - -private theorem helper_lastData_3458.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = - HierarchyStoredColorsAt R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), - C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx R - obtain ⟨hcount, hdata⟩ := R.sameGood.2 - have hh := hdata (Fin.last C.hierarchy.dividerCount) - have hidx : Fin.cast (congrArg (fun q => q + 1) hcount) - (Fin.last C.hierarchy.dividerCount) = - Fin.last R.counterexample.hierarchy.dividerCount := Fin.ext hcount - simpa only [hidx] using hh - -private theorem helper_gammaTransport_3472.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = - HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma - (Fin.last C.hierarchy.dividerCount) eta = R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta) → - ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = - S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans lastData R S eta heta - clear * - R S eta heta lastData - have hOrig : eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) := by - rw [(lastData R).1]; exact heta - refine ⟨?_, ((lastData R).2 eta hOrig).symm.trans ((lastData S).2 eta hOrig)⟩ - rw [← (lastData S).1] - exact hOrig - -private theorem helper_gammaUnused_3487.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) → - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), - eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition - R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R eta a heta ha t hlo hhi hc - have hnot := (Finset.mem_sdiff.mp (R.counterexample.good.avoidance - (Fin.last R.counterexample.hierarchy.dividerCount) eta heta ha)).2 - apply hnot - unfold HierarchySegmentColors - dsimp only - rw [starEq R, Fin.succ_last, R.counterexample.hierarchy.terminalStage] - exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, - lt_min hhi t.isLt, hc⟩ - -private theorem helper_notRaw_3511.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) → - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R c hcA hcD hm - apply hcD - unfold HierarchyStoredColorsAt - dsimp only - rw [starEq R] - exact Finset.mem_sdiff.mpr ⟨hm, hcA⟩ - -private theorem helper_gammaChoice_3540.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), - ∀ (f : E), - ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, - R.coloring f ≠ some a := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans R eta heta f - clear * - R eta heta f - by_contra hn - push Not at hn - have hc : (R.counterexample.good.gamma - (Fin.last R.counterexample.hierarchy.dividerCount) eta).card ≤ 1 := by - apply Finset.card_le_one.mpr - intro a ha b hb - exact Option.some.inj ((hn a ha).symm.trans (hn b hb)) - rw [R.counterexample.good.twoColors _ eta heta] at hc - omega - -private theorem helper_sameLast_6615.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {a b : ℕ} (s : Fin (a + - (2 : ℕ)) → TreeSequence G e0) (t : Fin (b + (2 : ℕ)) → TreeSequence G e0) (u v : - TreeSequence G e0), a = b → s ≍ t → u = v → (Fin.cases u (fun (i : Fin a) ↦ s - i.castSucc.succ) (Fin.last a) : TreeSequence G e0) = (Fin.cases v (fun (i : Fin b) ↦ t - i.castSucc.succ) (Fin.last b) : TreeSequence G e0) := by - classical - intro V E G e0 a b s t u v hab hst huv - cases hab - have he : s = t := eq_of_heq hst - cases he - cases huv - rfl - theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) @@ -1478,7 +1273,7 @@ theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} (hXY : TreeSequenceInitialSegment X Y) (hYZ : TreeSequenceInitialSegment Y Z) : TreeSequenceInitialSegment X Z := by - exact helper_trans_3344 (@G) (@e0) (@hXY) (@hYZ) + exact SharedFacts.ShorteningTransport.trans (@G) (@e0) (@hXY) (@hYZ) have common {X Y Z : TreeSequence G e0} (hXZ : TreeSequenceInitialSegment X Z) (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : @@ -1489,7 +1284,7 @@ theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} TreeSequence G e0), a = b → HEq s t → u = v → Fin.cases (motive := fun _ => TreeSequence G e0) u (fun i : Fin a => s i.castSucc.succ) (Fin.last a) = Fin.cases (motive := fun _ => TreeSequence G e0) v (fun i : Fin b => t i.castSucc.succ) (Fin.last b) := by - apply helper_sameLast_6615 + apply SharedFacts.OutsideAdvancement.sameLast let A := HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) have starEq (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : HierarchyStarredStage R.counterexample.hierarchy @@ -1528,11 +1323,12 @@ theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} have firstLe (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (T.length + 1)) (hj : c ∈ MissingColors G psi (T.vertex j)) : HierarchyFirstMissingPosition psi T c ≤ j := by - exact helper_firstLe_3436 (@G) (@k) (@e0) (@T) (@psi) (@c) (@j) (@hj) + exact SharedFacts.OutsideAdvancement.firstMissingPositionUpperBound (@G) (@k) (@e0) (@T) + (@psi) (@c) (@j) (@hj) have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by - exact helper_firstMem_2558 G k e0 T psi c hlt + exact TreeSequenceFirstMissingPositionMem hlt have firstAt (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : Fin (B.length + 1)) (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : @@ -1547,7 +1343,8 @@ theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta := by - exact helper_lastData_3458 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.OutsideAdvancement.lastData (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@R) have gammaTransport (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) @@ -1558,7 +1355,7 @@ theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} (Fin.last S.counterexample.hierarchy.dividerCount) ∧ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta := by - apply helper_gammaTransport_3472 <;> assumption + apply SharedFacts.OutsideAdvancement.gammaTransport <;> assumption have gammaUnused (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k) (heta : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy @@ -1568,7 +1365,8 @@ theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} (t : Fin T.length) (hlo : A.length ≤ t.val) (hhi : t.val < (HierarchyFirstMissingPosition R.coloring T eta).val) : R.coloring (T.edge t) ≠ some a := by - exact helper_gammaUnused_3487 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.OutsideAdvancement.gammaUnused (@G) (@k) (@e0) (@input) (@T) (@phi) + (@ett) (@base) (@C) (@ctx) (@starEq) (@R) (@eta) (@a) (@heta) (@ha) (@t) (@hlo) (@hhi) have outsideA (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : Fin (B.length + 1)) (hj : A.length < j.val) @@ -1581,7 +1379,8 @@ theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} (Fin.last R.counterexample.hierarchy.dividerCount)) : c ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last R.corresponding.replacementETT.rounds) := by - exact helper_notRaw_3511 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.OutsideAdvancement.notRaw (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@base) (@C) (@ctx) (@starEq) (@R) (@c) (@hcA) (@hcD) have tailException (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (hj : 1 ≤ j) (hjlt : j < T.length - A.length) @@ -1605,7 +1404,7 @@ theorem HierarchySituationThreeEligibleIndexBound {V E : Type*} (Fin.last R.counterexample.hierarchy.dividerCount)) (f : E) : ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, R.coloring f ≠ some a := by - apply helper_gammaChoice_3540 <;> assumption + apply SharedFacts.OutsideAdvancement.gammaChoice <;> assumption have advance (m : ℕ) (hmLower : HierarchyPathNumber C.hierarchy ≤ m) (hmUpper : m < HierarchyFullTailLength C - 1) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean index cdade20fbc..3d7b285692 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneStoredException.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.StoredExceptionTransport + + + public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion @@ -27,88 +31,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private noncomputable abbrev helperSelfCorr425.{u_1, u_2} : - open scoped Classical in - {V : Type u_1} → - {E : Type u_2} → - [Fintype V] → - [Fintype E] → - [DecidableEq E] → - (G : LooplessMultigraph V E) → - (k : ℕ) → - (e0 : E) → - (input : PartialEdgeColoring E k) → - (T : TreeSequence G e0) → - (phi : PartialEdgeColoring E k) → - (ett : ExtendedTashkinovTree G k e0 input T phi) → - ( - ∀ (j : Fin (ett.rounds + (1 : ℕ))), - IsProperEdgeColoring G (ett.series.data.coloring j)) → - ( - ∀ (j : Fin (ett.rounds + (1 : ℕ))), - IsOneEdgeUncolored (ett.series.data.coloring j) e0) → - CorrespondingExtendedTashkinovTree G k e0 ett phi T := by - classical - intro V E _ _ _ G k e0 input T phi ett seriesProper seriesOne - exact { - replacementInput := input - replacementSeries := ett.series - replacementETT := ett - rungAgreement := rfl - seriesPresentation := HEq.rfl - finalGeneratingColoring := ett.generatingColoring - ladderTreesAgree := fun _ => rfl - storedColorsAgree := fun _ => rfl - connectingEdgesAgree := fun _ => rfl - extensionKindsAgree := fun _ => rfl - replacementProper := seriesProper - replacementOneUncolored := seriesOne - replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } - -private noncomputable abbrev helperP0462.{u_1, u_2} : - open scoped Classical in - {V : Type u_1} → - {E : Type u_2} → - [Fintype V] → - [Fintype E] → - [DecidableEq V] → - [DecidableEq E] → - (G : LooplessMultigraph V E) → - (k : ℕ) → - (e0 : E) → - (input : PartialEdgeColoring E k) → - (T : TreeSequence G e0) → - (phi : PartialEdgeColoring E k) → - (ett : ExtendedTashkinovTree G k e0 input T phi) → - (base : HierarchyBase ett phi) → - (C : HierarchyCounterexample base) → - (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett - base C) → - (seriesProper : - ∀ (j : Fin (ett.rounds + (1 : ℕ))), - IsProperEdgeColoring G (ett.series.data.coloring j)) → - (seriesOne : - ∀ (j : Fin (ett.rounds + (1 : ℕ))), - IsOneEdgeUncolored (ett.series.data.coloring j) e0) → - let _ : - CorrespondingExtendedTashkinovTree G k e0 ett phi T := - helperSelfCorr425 G k e0 input T phi ett seriesProper - seriesOne; - HierarchyReplacementPresentation G k e0 input T phi ett - base C ctx := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx seriesProper seriesOne selfCorr - exact { - coloring := phi - corresponding := selfCorr - maximum := C.maximum - replacementBase := base - counterexample := C - sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, - rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ - minimumContext := ctx } - private noncomputable abbrev helperD41837.{u_1, u_2} : open scoped Classical in {V : Type u_1} → @@ -282,7 +204,8 @@ private abbrev helperContinuation3592Conditions.{u_1, u_2} : Prop := ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) (seriesOne : ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), - let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := helperP0462 G k + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + SharedFacts.StoredExceptionTransport.p0462 G k e0 input T phi ett base C ctx seriesProper seriesOne; ( ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ∀ a ∈ HierarchyStageMissingColors P.counterexample.hierarchy (Fin.last @@ -363,7 +286,8 @@ private abbrev helperContinuation3568Conditions.{u_1, u_2} : Prop := ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) (seriesOne : ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), - let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := helperP0462 G k + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + SharedFacts.StoredExceptionTransport.p0462 G k e0 input T phi ett base C ctx seriesProper seriesOne; ( ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ∀ a ∈ HierarchyStageMissingColors P.counterexample.hierarchy (Fin.last @@ -847,97 +771,6 @@ private abbrev storedExceptionSwapStepStatement.{u_1, u_2} : Prop := ∀ v ∈ TreeSequenceVertexSet X, MissingColors G P'.coloring v = MissingColors G P.coloring v) ∧ ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → P'.coloring (T.edge t) = P.coloring (T.edge t) -private theorem helper_segmentTrans_302.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y - Z → TreeSequenceInitialSegment X Z := by - classical - intro V E G e0 X Y Z hXY hYZ - refine ⟨le_trans hXY.1 hYZ.1, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) - -private theorem helper_commonPrefix_311.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y - Z → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by - classical - intro V E G e0 X Y Z hXZ hYZ hXY - refine ⟨hXY, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) - -private theorem helper_hierarchyGeometry_320.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0), ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → - ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} - {b : HierarchyBase J col} (H : TashkinovHierarchy J b), TreeSequenceInitialSegment - (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ TreeSequenceInitialSegment - (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last - H.dividerCount)) := by - classical - intro V E _ _ _ _ G k e0 T segmentTrans inp col J b H - have forward : ∀ (a d : ℕ), (hbound : a + d ≤ H.dividerCount + 1) → - TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) - (H.stage ⟨a + d, by omega⟩) := by - intro a d - induction d with - | zero => intro h; exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ - | succ d ih => - intro h - exact segmentTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) - let A := HierarchyStarredStage H (Fin.last H.dividerCount) - let Tn := J.series.data.tree (Fin.last J.rounds).castSucc - change TreeSequenceInitialSegment A T ∧ TreeSequenceInitialSegment Tn A - have hTnCore : TreeSequenceInitialSegment Tn b.core := by - by_cases hp : J.series.data.kind (Fin.last J.rounds) = - some TashkinovExtensionKind.PE - · exact (b.parallel hp).2.2.some.leftSegment - · rw [b.nonparallel hp] - exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ - by_cases hq : H.dividerCount = 0 - · have hA : A = b.core := by - simp [A, HierarchyStarredStage, Fin.last, hq] - have hlast : H.stage ⟨1, by omega⟩ = T := by - convert H.terminalStage using 1 - apply congrArg H.stage - apply Fin.ext - simp [hq] - constructor - · rw [hA] - exact Eq.mp (congrArg (fun W : TreeSequence G e0 => - TreeSequenceInitialSegment b.core W) hlast) H.coreInsideFirst - · rw [hA] - exact hTnCore - · have hpos : 0 < H.dividerCount := Nat.pos_of_ne_zero hq - have hindex : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = - (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by - apply Fin.ext - simp - omega - have hA : A = H.stage ⟨H.dividerCount, by omega⟩ := by - dsimp [A, HierarchyStarredStage] - rw [hindex] - dsimp - apply congrArg H.stage - apply Fin.ext - simp - omega - have hlast : H.stage ⟨H.dividerCount + 1, by omega⟩ = T := H.terminalStage - have hTnStage : H.stage (0 : Fin (H.dividerCount + 2)) = Tn := H.baseStage - refine ⟨?_, ?_⟩ - · simpa [hA, hlast] using forward H.dividerCount 1 (by omega) - · simpa [hA, hTnStage] using forward 0 H.dividerCount (by omega) - private theorem helper_firstMissing_387.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) @@ -1085,30 +918,7 @@ private theorem helper_seriesProper_562.{u_1, u_2} : IsProperEdgeColoring G (ett.series.data.coloring j) := by classical intro V E _ _ _ G k e0 input T phi ett gamma j - cases ett.series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.1 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedProper - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => exact currentProper - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact previousProper + exact (ett.series.coloringProperties j).1 private theorem helper_seriesOne_589.{u_1, u_2} : open scoped Classical in @@ -1120,30 +930,7 @@ private theorem helper_seriesOne_589.{u_1, u_2} : IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by classical intro V E _ _ _ G k e0 input T phi ett gamma j - cases ett.series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.2 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedOneUncolored - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => exact currentOneUncolored - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact previousOneUncolored + exact (ett.series.coloringProperties j).2 private theorem helper_caseFor_622.{u_1, u_2} : open scoped Classical in @@ -2276,7 +2063,8 @@ private theorem helper_gammaTerminal1_1366.{u_1, u_2} : ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) (seriesOne : ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), - let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := helperP0462 G k + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + SharedFacts.StoredExceptionTransport.p0462 G k e0 input T phi ett base C ctx seriesProper seriesOne; ∀ (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), P1.coloring = TwoColorComponentSwap G P0.coloring gamma D.alpha (Sum.inl (T.vertex @@ -2371,7 +2159,8 @@ private theorem helper_pairMissing2_1439.{u_1, u_2} : ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsProperEdgeColoring G (ett.series.data.coloring j)) (seriesOne : ∀ (j : Fin (ett.rounds + (1 : ℕ))), IsOneEdgeUncolored (ett.series.data.coloring j) e0), - let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := helperP0462 G k + let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := + SharedFacts.StoredExceptionTransport.p0462 G k e0 input T phi ett base C ctx seriesProper seriesOne; ∀ (P1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( ∀ v ∈ TreeSequenceVertexSet X, MissingColors G P1.coloring v = MissingColors G P0.coloring v) @@ -4121,10 +3910,12 @@ private theorem helper_continuation_3406.{u_1, u_2} : exact @helper_seriesOne_589 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@gamma) let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := by - exact @helperSelfCorr425 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + exact @SharedFacts.StoredExceptionTransport.selfCorr425 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@seriesProper) (@seriesOne) let P0 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := by - exact @helperP0462 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @SharedFacts.StoredExceptionTransport.p0462 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@seriesProper) (@seriesOne) have caseFor (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) @@ -4208,12 +3999,14 @@ theorem HierarchySituationTwoSubcaseOneOneStoredException {V E : Type*} (hXY : TreeSequenceInitialSegment X Y) (hYZ : TreeSequenceInitialSegment Y Z) : TreeSequenceInitialSegment X Z := by - exact @helper_segmentTrans_302 (@V) (@E) (@G) (@e0) (@X) (@Y) (@Z) (@hXY) (@hYZ) + exact @SharedFacts.StoredExceptionTransport.segmentTrans (@V) (@E) (@G) (@e0) (@X) (@Y) + (@Z) (@hXY) (@hYZ) have commonPrefix {X Y Z : TreeSequence G e0} (hXZ : TreeSequenceInitialSegment X Z) (hYZ : TreeSequenceInitialSegment Y Z) (hXY : X.length ≤ Y.length) : TreeSequenceInitialSegment X Y := by - exact @helper_commonPrefix_311 (@V) (@E) (@G) (@e0) (@X) (@Y) (@Z) (@hXZ) (@hYZ) (@hXY) + exact @SharedFacts.ZeroNonclosedTransport.comparableInitialSegments (@V) (@E) (@G) (@e0) + (@X) (@Y) (@Z) (@hXZ) (@hYZ) (@hXY) have hierarchyGeometry {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} @@ -4223,7 +4016,8 @@ theorem HierarchySituationTwoSubcaseOneOneStoredException {V E : Type*} TreeSequenceInitialSegment (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last H.dividerCount)) := by - exact @helper_hierarchyGeometry_320 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.StoredExceptionTransport.hierarchyGeometry (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@T) (@segmentTrans) (@inp) (@col) (@J) (@b) (@H) have missingMono {X Y : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) (col : PartialEdgeColoring E k) : diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean index c5ab0d27d7..30f3433032 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneTwo.lean @@ -5,9 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.FirstSubcaseTransport + public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts -public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne @@ -592,23 +593,6 @@ private abbrev helperContinuation2860Conditions.{u_1, u_2} : Prop := let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; ( ∀ v ∈ TreeSequenceVertexSet B, MissingColors G rho v = MissingColors G phi v) → False -private theorem helper_hBT_109.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment B T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C B hBlen - refine ⟨?_, ?_, ?_⟩ - · omega - · intro i - rfl - · intro i - rfl - private theorem helper_hApositive_116.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1187,34 +1171,6 @@ private theorem helper_hstoredOne_643.{u_1, u_2} : exact firstPreserved phi muOne D.alpha hmissingOne hmissing.2 · exact firstUnaffected phi D.gammaOne D.alpha c hgammaAlpha ctx.proper hcg hca -private theorem helper_sameStar_734.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy (Fin.last - P.counterexample.hierarchy.dividerCount) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A P - have helper : - ∀ (n m : ℕ) (X Y : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → - TreeSequence G e0), n = m → X = Y → HEq s t → Fin.cases (motive := fun _ => TreeSequence G - e0) X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => - TreeSequence G e0) Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by - intro n m X Y s t hnm hXY hst - subst m - have he := eq_of_heq hst - simp [hXY, he] - exact (helper _ _ base.core P.replacementBase.core H.stage - P.counterexample.hierarchy.stage P.sameGood.1.2.1 P.sameGood.1.1 - P.sameGood.1.2.2.1).symm - private theorem helper_hpairDataOne_800.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -2700,7 +2656,8 @@ private theorem helper_continuation_1912.{u_1, u_2} : have sameStar (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : HierarchyStarredStage P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) = A := by - exact @helper_sameStar_734 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.FirstSubcaseTransport.sameStar (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) have samePrefix (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1) = B @@ -2751,7 +2708,8 @@ theorem HierarchySituationTwoSubcaseOneTwo {V E : Type*} change min (A.length + (T.length - A.length - 1)) T.length + 1 = T.length omega have hBT : TreeSequenceInitialSegment B T := by - exact @helper_hBT_109 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @SharedFacts.FirstSubcaseTransport.bT (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBlen) have hApositive (hq : 0 < H.dividerCount) : A = H.stage ⟨H.dividerCount, by omega⟩ := by diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean index 49a8c9fb3a..e203649458 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.SubcaseThreeOnePreparation1 + public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeOneData @@ -1346,44 +1348,15 @@ theorem helper_hAT_359.{u_1, u_2} : have hs : H.stage q.succ = T := by convert H.terminalStage using 1; congr 1 simpa only [hs] using H.nested q +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_firstLe_400.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : TreeSequence G e0) (c : Fin k) - (i : Fin (X.length + (1 : ℕ))), - c ∈ MissingColors G phi (X.vertex i) → - (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ) := by - classical - intro V E _ _ G k e0 phi X c i hi - let _ := Fintype.ofFinite V - as_aux_lemma => - unfold HierarchyFirstMissingPosition - dsimp only - have hm : i ∈ Finset.univ.filter - (fun j => c ∈ MissingColors G phi (X.vertex j)) := - Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ - rw [dite_eq_left ⟨i, hm⟩] - exact Finset.min'_le _ _ hm + SharedFacts.SubcaseThreeOnePreparation1.firstMissingPositionUpperBoundStatement.{u_1, u_2} := + SharedFacts.SubcaseThreeOnePreparation1.firstMissingPositionUpperBound.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_firstMissing_411.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : TreeSequence G e0), - ∀ c ∈ TreeMissingColors phi X, - c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by - classical - intro V E _ _ G k e0 phi X c hc - let _ := Fintype.ofFinite V - as_aux_lemma => - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv - unfold HierarchyFirstMissingPosition - dsimp only - have hm : i ∈ Finset.univ.filter - (fun j => c ∈ MissingColors G phi (X.vertex j)) := - Finset.mem_filter.mpr ⟨Finset.mem_univ _, hcv⟩ - rw [dite_eq_left ⟨i, hm⟩] - exact (Finset.mem_filter.mp (Finset.min'_mem _ ⟨i, hm⟩)).2 + SharedFacts.SubcaseThreeOnePreparation1.firstMissingPositionWitnessStatement.{u_1, u_2} := + SharedFacts.SubcaseThreeOnePreparation1.firstMissingPositionWitness.{u_1, u_2} theorem helper_oldAvoid_453.{u_1, u_2} : open scoped Classical in @@ -1634,44 +1607,15 @@ theorem helper_hABplusouter_986.{u_1, u_2} : · intro i exact hATouter.2.2 i +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_firstMissingOuter_1008.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : TreeSequence G e0), - ∀ c ∈ TreeMissingColors phi X, - c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) := by - classical - intro V E _ _ G k e0 phi X c hc - let _ := Fintype.ofFinite V - as_aux_lemma => - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv - unfold HierarchyFirstMissingPosition - dsimp only - have hm : i ∈ Finset.univ.filter - (fun j => c ∈ MissingColors G phi (X.vertex j)) := - Finset.mem_filter.mpr ⟨Finset.mem_univ _, hcv⟩ - rw [dite_eq_left ⟨i, hm⟩] - exact (Finset.mem_filter.mp (Finset.min'_mem _ ⟨i, hm⟩)).2 + SharedFacts.SubcaseThreeOnePreparation1.firstMissingPositionWitnessStatement.{u_1, u_2} := + SharedFacts.SubcaseThreeOnePreparation1.firstMissingPositionWitness.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_firstLeOuter_1021.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : TreeSequence G e0) (c : Fin k) - (i : Fin (X.length + (1 : ℕ))), - c ∈ MissingColors G phi (X.vertex i) → - (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ) := by - classical - intro V E _ _ G k e0 phi X c i hi - let _ := Fintype.ofFinite V - as_aux_lemma => - unfold HierarchyFirstMissingPosition - dsimp only - have hm : i ∈ Finset.univ.filter - (fun j => c ∈ MissingColors G phi (X.vertex j)) := - Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ - rw [dite_eq_left ⟨i, hm⟩] - exact Finset.min'_le _ _ hm + SharedFacts.SubcaseThreeOnePreparation1.firstMissingPositionUpperBoundStatement.{u_1, u_2} := + SharedFacts.SubcaseThreeOnePreparation1.firstMissingPositionUpperBound.{u_1, u_2} theorem helper_firstBoundByPrefix_1032.{u_1, u_2} : open scoped Classical in @@ -2721,20 +2665,10 @@ theorem helper_hlastEdgeInOne_1608.{u_1, u_2} : (Sum.inr (T.edge lastIndex)) = _ exact SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj hadj +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_segTrans_1626.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → - TreeSequenceInitialSegment X Z := by - classical - intro V E G e0 X Y Z hXY hYZ - refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + SharedFacts.SubcaseThreeOnePreparation1.initialSegmentTransitiveStatement.{u_1, u_2} := + SharedFacts.SubcaseThreeOnePreparation1.initialSegmentTransitive.{u_1, u_2} theorem helper_stageSegment_1634.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean index b6f2de0b48..b13cebc3a0 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean @@ -5,9 +5,12 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.SecondSituationTransport + +public import LeanPool.GoldbergSeymour.SharedFacts.FirstSubcaseTransport + public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts -public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne @@ -1210,124 +1213,6 @@ private abbrev helperFinish3305Conditions.{u_1, u_2} : Prop := POne.corresponding.replacementETT.rounds)) → False -private theorem helper_hBT_116.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - B.length + (1 : ℕ) = T.length → - TreeSequenceInitialSegment B T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C B hBlen - refine ⟨?_, ?_, ?_⟩ - · omega - · intro i - rfl - · intro i - rfl - -private theorem helper_hApositive_123.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - (0 : ℕ) < H.dividerCount → - A = - H.stage - (⟨H.dividerCount, by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A hq - have hi : q = (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by - apply Fin.ext - simp [q] - omega - change HierarchyStarredStage H q = _ - rw [hi] - simp only [HierarchyStarredStage, Fin.cases_succ] - congr 1 - apply Fin.ext - simp - omega - -private theorem helper_hAT_141.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ((0 : ℕ) < H.dividerCount → - A = - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - TreeSequenceInitialSegment A T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A hApositive hAzero - by_cases hz : H.dividerCount = 0 - · have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = - Fin.last (H.dividerCount + 1) := by apply Fin.ext; simp [hz] - simpa [hAzero hz, hi, H.terminalStage] using H.coreInsideFirst - · rw [hApositive (Nat.pos_of_ne_zero hz)] - have hi : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = - q.castSucc := Fin.ext rfl - have hj : H.stage q.succ = T := by - convert H.terminalStage using 1 - congr 1 - simpa only [hi, hj] using H.nested q - -private theorem helper_hAB_153.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - (2 : ℕ) ≤ T.length - A.length → - B.length + (1 : ℕ) = T.length → - ((0 : ℕ) < H.dividerCount → - A = - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - TreeSequenceInitialSegment A T → - TreeSequenceInitialSegment A B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A B htail hBlen hApositive hAzero hAT - refine ⟨by omega, ?_, ?_⟩ - · intro i - exact hAT.2.1 i - · intro i - exact hAT.2.2 i - private theorem helper_hBterminal_159.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -1449,171 +1334,6 @@ private theorem helper_hterminalIncident_226.{u_1, u_2} : rw [hi, hj] exact Sym2.mem_mk_left _ _ -private theorem helper_firstWitness_238.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (T : TreeSequence G e0) (rho : PartialEdgeColoring E k) - (X : TreeSequence G e0), - TreeSequenceInitialSegment X T → - ∀ c ∈ TreeMissingColors rho X, - c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ - (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length := by - classical - intro V E _ _ G k e0 T rho X hXT c hc - let _ := Fintype.ofFinite V - as_aux_lemma => - rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hvc⟩ - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - rcases hv with ⟨i, rfl⟩ - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G rho (T.vertex j) - have hi : Fin.castLE (Nat.succ_le_succ hXT.1) i ∈ candidates := by - simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] - rw [hXT.2.1 i] - exact hvc - have hn : candidates.Nonempty := ⟨_, hi⟩ - have hm := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - have hle := Finset.min'_le candidates _ hi - have hib := i.isLt - unfold HierarchyFirstMissingPosition - change (c ∈ MissingColors G rho (T.vertex (if h : candidates.Nonempty then - candidates.min' h else Fin.last T.length))) ∧ _ - rw [dite_eq_left hn] - refine ⟨hm, ?_⟩ - change (candidates.min' hn).val ≤ i.val at hle - omega - -private theorem helper_missingSubset_269.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeMissingColors rho X ⊆ TreeMissingColors rho Y := by - classical - intro V E _ _ G k e0 rho X Y hXY - let _ := Fintype.ofFinite V - as_aux_lemma => - intro c hc - obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc - exact Finset.mem_biUnion.mpr - ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hm⟩ - -private theorem helper_firstPreserved_424.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - TreeSequenceInitialSegment B T → - (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), - TreeSequenceInitialSegment X T → - ∀ c ∈ TreeMissingColors rho X, - c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ - (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → - ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → - c ∈ TreeMissingColors rho B → - HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C B hBT firstWitness rho sigma c helem hmiss hc - as_aux_lemma => - clear_value B - clear * - G T B rho sigma c helem hmiss hc firstWitness hBT - have hr := firstWitness rho B hBT c hc - have hc' : c ∈ TreeMissingColors sigma B := by - obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc - exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ - have hs := firstWitness sigma B hBT c hc' - have pref (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : - T.vertex i ∈ TreeSequenceVertexSet B := by - let j : Fin (B.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ - have he : Fin.castLE (Nat.succ_le_succ hBT.1) j = i := Fin.ext rfl - exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr - ⟨j, Finset.mem_univ _, (hBT.2.1 j).symm.trans (congrArg T.vertex he)⟩ - by_contra hne - have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ - T.vertex (HierarchyFirstMissingPosition rho T c) := - fun he => hne (T.vertex_injective he) - have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 - exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 - -private theorem helper_firstUnaffected_449.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (T : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) - (a b c : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - c ≠ a → - c ≠ b → - HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = - HierarchyFirstMissingPosition rho T c := by - classical - intro V E _ _ G k e0 T z rho a b c hne hp hca hcb - let _ := Fintype.ofFinite V - have hb := TwoColorComponentSwapMissingBehavior G rho a b hne hp z - have he : (Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G (TwoColorComponentSwap G rho a b z) (T.vertex i)) = - (Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G rho (T.vertex i)) := by - ext i - simp only [Finset.mem_filter, Finset.mem_univ, true_and] - exact hb.2.2.2 _ c hca hcb - unfold HierarchyFirstMissingPosition - rw [he] - -private theorem helper_sameStar_518.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A P - have helper : ∀ (n m : ℕ) (X Y : TreeSequence G e0) - (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → TreeSequence G e0), - n = m → X = Y → HEq s t → - Fin.cases (motive := fun _ => TreeSequence G e0) - X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = - Fin.cases (motive := fun _ => TreeSequence G e0) - Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by - intro n m X Y s t hnm hXY hst - subst m - have he := eq_of_heq hst - simp [hXY, he] - exact (helper _ _ base.core P.replacementBase.core H.stage - P.counterexample.hierarchy.stage P.sameGood.1.2.1 P.sameGood.1.1 - P.sameGood.1.2.2.1).symm - -private theorem helper_commonPrefix_557.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {X Y F : TreeSequence G e0}, - TreeSequenceInitialSegment X F → - TreeSequenceInitialSegment Y F → - X.length ≤ Y.length → - TreeSequenceInitialSegment X Y := by - classical - intro V E G e0 X Y F hXF hYF hXY - refine ⟨hXY, ?_, ?_⟩ - · intro i - exact (hYF.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXF.2.1 i) - · intro i - exact (hYF.2.2 (Fin.castLE hXY i)).symm.trans (hXF.2.2 i) - private theorem helper_hcoreLength_566.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -1647,80 +1367,6 @@ private theorem helper_hcoreLength_566.{u_1, u_2} : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) ≤ ⟨H.dividerCount, by omega⟩ from Nat.pos_of_ne_zero hz)) -private theorem helper_predecessorIncident_575.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) - (e0 : E) (T X : TreeSequence G e0), - TreeSequenceInitialSegment X T → - ∀ (t : Fin T.length), - (↑t : ℕ) = X.length → - TreeIncidentEdge X (T.edge t) := by - classical - intro V E _ _ G e0 T X hXT t ht - let _ := Fintype.ofFinite V - let _ := Fintype.ofFinite E - obtain ⟨i, hi⟩ := T.attaches t - let j : Fin (X.length + 1) := ⟨i.val, by have := i.isLt; omega⟩ - have he : Fin.castLE (Nat.succ_le_succ hXT.1) j = - Fin.castLE (by omega : t.val + 1 ≤ T.length + 1) i := Fin.ext rfl - refine ⟨X.vertex j, (@Finset.mem_image _ _ (Classical.decEq V)).mpr - ⟨j, Finset.mem_univ _, rfl⟩, ?_⟩ - rw [← hXT.2.1 j, he, Incident, hi] - exact Sym2.mem_mk_right _ _ - -private theorem helper_seedStable_587.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) - (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) - (K : TashkinovHierarchy ett' base'), - HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → - K.dividerCount = (0 : ℕ) → - StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) - (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma := by - classical - intro V E _ _ _ _ G k e0 T input' rho sigma ett' base' K hw hq - have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hq - rw [hi] at hw - change (if ett'.series.data.kind (Fin.last ett'.rounds) = - some TashkinovExtensionKind.PE then _ else _) at hw - split_ifs at hw with hpe - · exact hw.1 - · exact hw - -private theorem helper_weakEdges_603.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) - (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) - (K : TashkinovHierarchy ett' base'), - HierarchyWeaklyStable K (Fin.last K.dividerCount) new → - IsOneEdgeUncolored old e0 → - IsOneEdgeUncolored new e0 → - ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), - new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = - old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by - classical - intro V E _ _ _ _ G k e0 T input' old new ett' base' K hw ho hno - by_cases hz : K.dividerCount = 0 - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz - rw [hi] at hw ⊢ - exact P2813_T1_BaseDisplayedEdges G k e0 input' T old ett' base' new ho hno hw - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := - Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) - rw [hi] at hw ⊢ - intro t - have hinv := hw.2 - by_cases ht : 1 ≤ t.val - · exact hinv.1 t ht - · let S := HierarchyStarredStage K - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ - have he : t = ⟨0, S.positive⟩ := Fin.ext (by change t.val = 0; omega) - rw [he, S.first_edge, hno.1, ho.1] - private theorem helper_hbetaTheta_660.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -1812,34 +1458,6 @@ private theorem helper_hyt_686.{u_1, u_2} : clear * - hi hp ht omega -private theorem helper_firstAfter_699.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - TreeSequenceInitialSegment A T → - ∀ (rho : PartialEdgeColoring E k), - ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), - c ∉ TreeMissingColors rho A → - A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A hAT rho c hc hn - by_contra h - have hi : (HierarchyFirstMissingPosition rho T c).val ≤ A.length := Nat.le_of_not_gt h - let i : Fin (A.length + 1) := ⟨(HierarchyFirstMissingPosition rho T c).val, by omega⟩ - have he : Fin.castLE (Nat.succ_le_succ hAT.1) i = - HierarchyFirstMissingPosition rho T c := Fin.ext rfl - apply hn - refine Finset.mem_biUnion.mpr ⟨A.vertex i, (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, - Finset.mem_univ _, rfl⟩, ?_⟩ - rw [← hAT.2.1 i, he] - exact hc - private theorem helper_hcaseOne_757.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -3823,7 +3441,8 @@ private theorem helper_finish_3305.{u_1, u_2} : (hc : c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c))) (hn : c ∉ TreeMissingColors rho A) : A.length < (HierarchyFirstMissingPosition rho T c).val := by - exact @helper_firstAfter_699 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.SecondSituationTransport.firstAfter (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) (@rho) (@c) (@hc) (@hn) let rho := POne.coloring @@ -3976,7 +3595,8 @@ private theorem helper_continuation_3031.{u_1, u_2} : have sameStar (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : HierarchyStarredStage P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) = A := by - exact @helper_sameStar_518 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.FirstSubcaseTransport.sameStar (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) have samePrefix (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1) = B @@ -4004,7 +3624,8 @@ private theorem helper_continuation_3031.{u_1, u_2} : have commonPrefix {X Y F : TreeSequence G e0} (hXF : TreeSequenceInitialSegment X F) (hYF : TreeSequenceInitialSegment Y F) (hXY : X.length ≤ Y.length) : TreeSequenceInitialSegment X Y := by - exact @helper_commonPrefix_557 (@V) (@E) (@G) (@e0) (@X) (@Y) (@F) (@hXF) (@hYF) (@hXY) + exact @SharedFacts.SecondSituationTransport.comparableInitialSegments (@V) (@E) (@G) (@e0) + (@X) (@Y) (@F) (@hXF) (@hYF) (@hXY) have hcoreLength : base.core.length ≤ A.length := by exact @helper_hcoreLength_566 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) @@ -4012,7 +3633,8 @@ private theorem helper_continuation_3031.{u_1, u_2} : have predecessorIncident (X : TreeSequence G e0) (hXT : TreeSequenceInitialSegment X T) (t : Fin T.length) (ht : t.val = X.length) : TreeIncidentEdge X (T.edge t) := by - exact @helper_predecessorIncident_575 (@V) (@E) inferInstance inferInstance (@G) (@e0) (@T) + exact @SharedFacts.SecondSituationTransport.predecessorIncident (@V) (@E) inferInstance + inferInstance (@G) (@e0) (@T) (@X) (@hXT) (@t) (@ht) have seedStable {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) @@ -4022,7 +3644,8 @@ private theorem helper_continuation_3031.{u_1, u_2} : (hq : K.dividerCount = 0) : StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma := by - exact @helper_seedStable_587 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.SecondSituationTransport.seedStable (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@T) (@input') (@rho) (@sigma) (@ett') (@base') (@K) (@hw) (@hq) have weakEdges {input' : PartialEdgeColoring E k} @@ -4034,7 +3657,8 @@ private theorem helper_continuation_3031.{u_1, u_2} : ∀ t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length, new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by - exact @helper_weakEdges_603 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.SecondSituationTransport.weakEdges (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@T) (@input') (@old) (@new) (@ett') (@base') (@K) (@hw) (@ho) (@hno) -- Swap the last-edge color, preserving the certified prefix route and Gamma cutoffs. have finish (beta : Fin k) @@ -4106,11 +3730,13 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} change min (A.length + (T.length - A.length - 1)) T.length + 1 = T.length omega have hBT : TreeSequenceInitialSegment B T := by - exact @helper_hBT_116 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @SharedFacts.FirstSubcaseTransport.bT (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBlen) have hApositive (hq : 0 < H.dividerCount) : A = H.stage ⟨H.dividerCount, by omega⟩ := by - exact @helper_hApositive_123 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.SecondSituationTransport.apositive (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hq) have hAzero (hq : H.dividerCount = 0) : A = base.core := by have hi : q = 0 := by apply Fin.ext; simp [q, hq] @@ -4118,10 +3744,12 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} rw [hi] rfl have hAT : TreeSequenceInitialSegment A T := by - exact @helper_hAT_141 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @SharedFacts.SecondSituationTransport.aT (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hApositive) (@hAzero) have hAB : TreeSequenceInitialSegment A B := by - exact @helper_hAB_153 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @SharedFacts.SecondSituationTransport.aB (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htail) (@hBlen) (@hApositive) (@hAzero) (@hAT) have hBterminal : B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex := by @@ -4167,7 +3795,8 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} (hc : c ∈ TreeMissingColors rho X) : c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ (HierarchyFirstMissingPosition rho T c).val ≤ X.length := by - exact @helper_firstWitness_238 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + exact @SharedFacts.SecondSituationTransport.firstWitness (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@rho) (@X) (@hXT) (@c) (@hc) have self (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := by @@ -4176,7 +3805,8 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} have missingSubset (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) : TreeMissingColors rho X ⊆ TreeMissingColors rho Y := by - exact @helper_missingSubset_269 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@rho) + exact @SharedFacts.SecondSituationTransport.missingSubset (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@rho) (@X) (@Y) (@hXY) have leaf := TwoColorMissingVertexLeaf G k have separate (rho : PartialEdgeColoring E k) (a b : Fin k) (hne : a ≠ b) @@ -4216,14 +3846,16 @@ theorem HierarchySituationTwoSubcaseThreeTwo {V E : Type*} (hmiss : ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) (hc : c ∈ TreeMissingColors rho B) : HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by - exact @helper_firstPreserved_424 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.SecondSituationTransport.firstPreserved (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBT) (@firstWitness) (@rho) (@sigma) (@c) (@helem) (@hmiss) (@hc) have firstUnaffected (z : Sum V E) (rho : PartialEdgeColoring E k) (a b c : Fin k) (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (hca : c ≠ a) (hcb : c ≠ b) : HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = HierarchyFirstMissingPosition rho T c := by - exact @helper_firstUnaffected_449 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + exact @SharedFacts.SecondSituationTransport.firstUnaffected (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@z) (@rho) (@a) (@b) (@c) (@hne) (@hp) (@hca) (@hcb) have seriesFacts : ∀ j : Fin (ett.rounds + 1), IsProperEdgeColoring G (ett.series.data.coloring j) ∧ diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean index 0413d0519e..4502da7f9e 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneStoredException.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module + + public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoExclusions public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseOneOne @@ -608,72 +610,6 @@ private abbrev helperBranch993Conditions.{u_1, u_2} : Prop := A.length ≤ (↑t : ℕ) → P1.coloring (T.edge t) = P0.coloring (T.edge t)) → gamma ∈ MissingColors G P1.coloring (T.vertex D.terminalVertexIndex) → False -private theorem helper_hierarchyGeometry_101.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0), - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} - {b : HierarchyBase J col} (H : TashkinovHierarchy J b), - TreeSequenceInitialSegment (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ - TreeSequenceInitialSegment (J.series.data.tree (Fin.last J.rounds).castSucc) - (HierarchyStarredStage H (Fin.last H.dividerCount)) := by - classical - intro V E _ _ _ _ G k e0 T segmentTrans inp col J b H - have forward : ∀ (a d : ℕ), (hbound : a + d ≤ H.dividerCount + 1) → - TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) - (H.stage ⟨a + d, by omega⟩) := by - intro a d - induction d with - | zero => intro h; exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ - | succ d ih => - intro h - exact segmentTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) - let A := HierarchyStarredStage H (Fin.last H.dividerCount) - let Tn := J.series.data.tree (Fin.last J.rounds).castSucc - change TreeSequenceInitialSegment A T ∧ TreeSequenceInitialSegment Tn A - have hTnCore : TreeSequenceInitialSegment Tn b.core := by - by_cases hp : J.series.data.kind (Fin.last J.rounds) = - some TashkinovExtensionKind.PE - · exact (b.parallel hp).2.2.some.leftSegment - · rw [b.nonparallel hp] - exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ - by_cases hq : H.dividerCount = 0 - · have hA : A = b.core := by - simp [A, HierarchyStarredStage, Fin.last, hq] - have hlast : H.stage ⟨1, by omega⟩ = T := by - convert H.terminalStage using 1 - apply congrArg H.stage - apply Fin.ext - simp [hq] - constructor - · rw [hA] - exact Eq.mp (congrArg (fun W : TreeSequence G e0 => - TreeSequenceInitialSegment b.core W) hlast) H.coreInsideFirst - · rw [hA] - exact hTnCore - · have hpos : 0 < H.dividerCount := Nat.pos_of_ne_zero hq - have hindex : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = - (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by - apply Fin.ext - simp - omega - have hA : A = H.stage ⟨H.dividerCount, by omega⟩ := by - dsimp [A, HierarchyStarredStage] - rw [hindex] - dsimp - apply congrArg H.stage - apply Fin.ext - simp - omega - have hlast : H.stage ⟨H.dividerCount + 1, by omega⟩ = T := H.terminalStage - have hTnStage : H.stage (0 : Fin (H.dividerCount + 2)) = Tn := H.baseStage - refine ⟨?_, ?_⟩ - · simpa [hA, hlast] using forward H.dividerCount 1 (by omega) - · simpa [hA, hTnStage] using forward 0 H.dividerCount (by omega) - private theorem helper_hgammaTail_297.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -1712,57 +1648,11 @@ private theorem helper_continuation_1111.{u_1, u_2} : have seriesProper : ∀ j : Fin (ett.rounds + 1), IsProperEdgeColoring G (ett.series.data.coloring j) := by intro j - cases ett.series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.1 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedProper - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => exact currentProper - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact previousProper + exact (ett.series.coloringProperties j).1 have seriesOne : ∀ j : Fin (ett.rounds + 1), IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by intro j - cases ett.series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.2 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedOneUncolored - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => exact currentOneUncolored - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored currentEdges - currentKind currentVertex currentOutside currentDelta currentGamma adjoined - adjoinedExactly closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact previousOneUncolored + exact (ett.series.coloringProperties j).2 let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := { replacementInput := input replacementSeries := ett.series @@ -1849,7 +1739,8 @@ theorem HierarchySituationTwoSubcaseTwoOneStoredException {V E : Type*} exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) · intro i exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) - have hierarchyGeometry := @helper_hierarchyGeometry_101 V E inferInstance inferInstance + have hierarchyGeometry := @SharedFacts.StoredExceptionTransport.hierarchyGeometry V E + inferInstance inferInstance inferInstance inferInstance G k e0 T segmentTrans have missingMono {X Y : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) (col : PartialEdgeColoring E k) : diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean index 7d2eb6634a..892c87d782 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean @@ -5,9 +5,15 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.SecondSubcaseTransport + +public import LeanPool.GoldbergSeymour.SharedFacts.SecondSituationTransport + +public import LeanPool.GoldbergSeymour.SharedFacts.FirstSubcaseTransport + + public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts -public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoTwoData public import LeanPool.GoldbergSeymour.HierarchySituationTwoSubcaseTwoOne @@ -25,238 +31,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private abbrev helperHsameTwo964Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - (∀ {c : Fin k}, - c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ TreeMissingColors phi A) → - let Bshort : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt H q = - HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt H q, - C.good.gamma q eta = - P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta) → - ∀ beta ∈ TreeMissingColors phi Bshort, - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → - beta ∉ HierarchyStoredColorsAt H q → - (H.dividerCount = (0 : ℕ) → - beta ∈ TreeMissingColors phi A → - beta ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → - (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → - (∀ eta ∈ HierarchyStoredColorsAt H q, - beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → - beta ≠ D.alpha → - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → - T.vertex ib ∈ TreeSequenceVertexSet B → - T.vertex ib ≠ T.vertex D.penultimateVertexIndex → - T.vertex ib ≠ T.vertex D.terminalVertexIndex → - TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → - (beta ∉ TreeMissingColors phi A → - beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → - beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → - (let H : TashkinovHierarchy ett base := C.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); - have sameComponent : Prop := - TwoColorComponent G phi beta D.alpha (Sum.inl va) = - TwoColorComponent G phi beta D.alpha (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (beta ∈ TreeMissingColors phi Tnq ∨ - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (beta ∈ TreeMissingColors phi Tn ∨ - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - Dn) → - sameComponent) ∧ - (beta ∈ TreeMissingColors phi A ∧ - TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → - sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → - TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = - TwoColorComponent G phi beta D.alpha - (Sum.inl (T.vertex D.penultimateVertexIndex)) → - let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); - let muOne : PartialEdgeColoring E k := - TwoColorComponentSwap G phi beta D.alpha z; - Disjoint - (TwoColorComponent G phi beta D.alpha - (Sum.inl (T.vertex D.terminalVertexIndex))) - (TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib))) → - TwoColorPathComponent G phi beta D.alpha z → - Sum.inl (T.vertex ib) ∉ TwoColorComponent G phi beta D.alpha z → - Sum.inl (T.vertex D.penultimateVertexIndex) ∉ - TwoColorComponent G phi beta D.alpha z → - (∀ w ∈ TreeSequenceVertexSet B, - MissingColors G (TwoColorComponentSwap G phi beta D.alpha z) w = - MissingColors G phi w) → - (∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → - (∀ c ∈ HierarchyStoredColorsAt H q, - HierarchyFirstMissingPosition muOne T c = - HierarchyFirstMissingPosition phi T c) → - (beta ∈ TreeMissingColors phi A → - (0 : ℕ) < H.dividerCount ∧ - beta ∈ - TreeMissingColors phi - (H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) ∨ - H.dividerCount = (0 : ℕ) ∧ - beta ∈ - TreeMissingColors phi - (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → - ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T), - MaximumProperty corrOne.replacementETT → - ∀ (baseOne : HierarchyBase corrOne.replacementETT muOne) - (KOne : TashkinovHierarchy corrOne.replacementETT baseOne) - (goodOne : GoodHierarchy KOne), - SameGoodHierarchy C.good goodOne → - beta ∈ MissingColors G muOne (T.vertex D.terminalVertexIndex) → - ∀ - (POne : - HierarchyReplacementPresentation G k e0 input T phi ett base C - ctx), - POne.coloring = muOne → - let rho : PartialEdgeColoring E k := POne.coloring; - let ettOne : - ExtendedTashkinovTree G k e0 - POne.corresponding.replacementInput T POne.coloring := - POne.corresponding.replacementETT; - let baseOne' : - HierarchyBase POne.corresponding.replacementETT - POne.coloring := - POne.replacementBase; - let COne' : HierarchyCounterexample POne.replacementBase := - POne.counterexample; - let HOne : - TashkinovHierarchy POne.corresponding.replacementETT - POne.replacementBase := - COne'.hierarchy; - let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := - Fin.last HOne.dividerCount; - TreeMissingColors rho A = TreeMissingColors phi A → - beta ∉ HierarchyStoredColorsAt HOne qOne → - beta ∉ - MissingColors G rho (T.vertex D.penultimateVertexIndex) → - beta ∈ - MissingColors G rho (T.vertex D.terminalVertexIndex) → - beta ∈ MissingColors G rho (T.vertex ib) → - HierarchyFirstMissingPosition rho T beta = ib → - HierarchyFirstMissingPosition rho T D.theta = - D.penultimateVertexIndex → - (∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → - (beta ∈ TreeMissingColors phi A → - (0 : ℕ) < HOne.dividerCount ∧ - beta ∈ - TreeMissingColors rho - (HOne.stage - (⟨HOne.dividerCount, - by - have := - GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (HOne.dividerCount + (2 : ℕ)))) ∨ - HOne.dividerCount = (0 : ℕ) ∧ - beta ∈ - TreeMissingColors rho - (ettOne.series.data.tree - (Fin.last ettOne.rounds).castSucc)) → - beta ∈ TreeMissingColors rho B ∧ - D.theta ∈ TreeMissingColors rho B → - (let H : TashkinovHierarchy ettOne baseOne' := - COne'.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := - Fin.last H.dividerCount; - have n : Fin (ettOne.rounds + (1 : ℕ)) := - Fin.last ettOne.rounds; - have A : TreeSequence G e0 := - HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := - ettOne.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := - TashkinovStoredColors ettOne.series.data n; - have Dnq : Finset (Fin k) := - HierarchyStoredColorsAt H q; - have va : V := - T.vertex - (HierarchyFirstMissingPosition rho T beta); - have vb : V := - T.vertex - (HierarchyFirstMissingPosition rho T D.theta); - have sameComponent : Prop := - TwoColorComponent G rho beta D.theta - (Sum.inl va) = - TwoColorComponent G rho beta D.theta - (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (beta ∈ TreeMissingColors rho Tnq ∨ - Disjoint - (insert beta ({ D.theta } : Finset (Fin k)) : - Finset (Fin k)) - Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (beta ∈ TreeMissingColors rho Tn ∨ - Disjoint - (insert beta ({ D.theta } : Finset (Fin k)) : - Finset (Fin k)) - Dn) → - sameComponent) ∧ - (beta ∈ TreeMissingColors rho A ∧ - TreeColorSetClosed G rho A - ({ beta } : Finset (Fin k)) → - sameComponent ∧ - TreeInterchangeable G A rho beta D.theta)) → - TwoColorComponent G rho beta D.theta - (Sum.inl (T.vertex ib)) = - TwoColorComponent G rho beta D.theta - (Sum.inl (T.vertex D.penultimateVertexIndex)) - private abbrev helperBranch3242Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] @@ -417,238 +191,6 @@ private abbrev helperBranch3242Conditions.{u_1, u_2} : Prop := (goodTwo : GoodHierarchy KTwo), SameGoodHierarchy COne'.good goodTwo -private abbrev helperHsameTwo3799Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - (∀ {c : Fin k}, - c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ TreeMissingColors phi A) → - let Bshort : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt H q = - HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt H q, - C.good.gamma q eta = - P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta) → - ∀ beta ∈ TreeMissingColors phi Bshort, - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → - beta ∉ HierarchyStoredColorsAt H q → - (H.dividerCount = (0 : ℕ) → - beta ∈ TreeMissingColors phi A → - beta ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → - (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → - (∀ eta ∈ HierarchyStoredColorsAt H q, - beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → - beta ≠ D.alpha → - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → - T.vertex ib ∈ TreeSequenceVertexSet B → - T.vertex ib ≠ T.vertex D.penultimateVertexIndex → - T.vertex ib ≠ T.vertex D.terminalVertexIndex → - TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → - (beta ∉ TreeMissingColors phi A → - beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → - beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → - (let H : TashkinovHierarchy ett base := C.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); - have sameComponent : Prop := - TwoColorComponent G phi beta D.alpha (Sum.inl va) = - TwoColorComponent G phi beta D.alpha (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (beta ∈ TreeMissingColors phi Tnq ∨ - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (beta ∈ TreeMissingColors phi Tn ∨ - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - Dn) → - sameComponent) ∧ - (beta ∈ TreeMissingColors phi A ∧ - TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → - sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → - TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = - TwoColorComponent G phi beta D.alpha - (Sum.inl (T.vertex D.penultimateVertexIndex)) → - let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); - let muOne : PartialEdgeColoring E k := - TwoColorComponentSwap G phi beta D.alpha z; - Disjoint - (TwoColorComponent G phi beta D.alpha - (Sum.inl (T.vertex D.terminalVertexIndex))) - (TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib))) → - TwoColorPathComponent G phi beta D.alpha z → - Sum.inl (T.vertex ib) ∉ TwoColorComponent G phi beta D.alpha z → - Sum.inl (T.vertex D.penultimateVertexIndex) ∉ - TwoColorComponent G phi beta D.alpha z → - (∀ w ∈ TreeSequenceVertexSet B, - MissingColors G (TwoColorComponentSwap G phi beta D.alpha z) w = - MissingColors G phi w) → - (∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → - (∀ c ∈ HierarchyStoredColorsAt H q, - HierarchyFirstMissingPosition muOne T c = - HierarchyFirstMissingPosition phi T c) → - (beta ∈ TreeMissingColors phi A → - (0 : ℕ) < H.dividerCount ∧ - beta ∈ - TreeMissingColors phi - (H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) ∨ - H.dividerCount = (0 : ℕ) ∧ - beta ∈ - TreeMissingColors phi - (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → - ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T), - MaximumProperty corrOne.replacementETT → - ∀ (baseOne : HierarchyBase corrOne.replacementETT muOne) - (KOne : TashkinovHierarchy corrOne.replacementETT baseOne) - (goodOne : GoodHierarchy KOne), - SameGoodHierarchy C.good goodOne → - beta ∈ MissingColors G muOne (T.vertex D.terminalVertexIndex) → - ∀ - (POne : - HierarchyReplacementPresentation G k e0 input T phi ett base C - ctx), - POne.coloring = muOne → - let rho : PartialEdgeColoring E k := POne.coloring; - let ettOne : - ExtendedTashkinovTree G k e0 - POne.corresponding.replacementInput T POne.coloring := - POne.corresponding.replacementETT; - let baseOne' : - HierarchyBase POne.corresponding.replacementETT - POne.coloring := - POne.replacementBase; - let COne' : HierarchyCounterexample POne.replacementBase := - POne.counterexample; - let HOne : - TashkinovHierarchy POne.corresponding.replacementETT - POne.replacementBase := - COne'.hierarchy; - let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := - Fin.last HOne.dividerCount; - TreeMissingColors rho A = TreeMissingColors phi A → - beta ∉ HierarchyStoredColorsAt HOne qOne → - beta ∉ - MissingColors G rho (T.vertex D.penultimateVertexIndex) → - beta ∈ - MissingColors G rho (T.vertex D.terminalVertexIndex) → - beta ∈ MissingColors G rho (T.vertex ib) → - HierarchyFirstMissingPosition rho T beta = ib → - HierarchyFirstMissingPosition rho T D.theta = - D.penultimateVertexIndex → - (∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → - (beta ∈ TreeMissingColors phi A → - (0 : ℕ) < HOne.dividerCount ∧ - beta ∈ - TreeMissingColors rho - (HOne.stage - (⟨HOne.dividerCount, - by - have := - GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (HOne.dividerCount + (2 : ℕ)))) ∨ - HOne.dividerCount = (0 : ℕ) ∧ - beta ∈ - TreeMissingColors rho - (ettOne.series.data.tree - (Fin.last ettOne.rounds).castSucc)) → - beta ∈ TreeMissingColors rho B ∧ - D.theta ∈ TreeMissingColors rho B → - (let H : TashkinovHierarchy ettOne baseOne' := - COne'.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := - Fin.last H.dividerCount; - have n : Fin (ettOne.rounds + (1 : ℕ)) := - Fin.last ettOne.rounds; - have A : TreeSequence G e0 := - HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := - ettOne.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := - TashkinovStoredColors ettOne.series.data n; - have Dnq : Finset (Fin k) := - HierarchyStoredColorsAt H q; - have va : V := - T.vertex - (HierarchyFirstMissingPosition rho T beta); - have vb : V := - T.vertex - (HierarchyFirstMissingPosition rho T D.theta); - have sameComponent : Prop := - TwoColorComponent G rho beta D.theta - (Sum.inl va) = - TwoColorComponent G rho beta D.theta - (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (beta ∈ TreeMissingColors rho Tnq ∨ - Disjoint - (insert beta ({ D.theta } : Finset (Fin k)) : - Finset (Fin k)) - Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (beta ∈ TreeMissingColors rho Tn ∨ - Disjoint - (insert beta ({ D.theta } : Finset (Fin k)) : - Finset (Fin k)) - Dn) → - sameComponent) ∧ - (beta ∈ TreeMissingColors rho A ∧ - TreeColorSetClosed G rho A - ({ beta } : Finset (Fin k)) → - sameComponent ∧ - TreeInterchangeable G A rho beta D.theta)) → - TwoColorComponent G rho beta D.theta - (Sum.inl (T.vertex ib)) = - TwoColorComponent G rho beta D.theta - (Sum.inl (T.vertex D.penultimateVertexIndex)) - private abbrev helperContinuation4157Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] @@ -756,238 +298,6 @@ private abbrev helperContinuation4157Conditions.{u_1, u_2} : Prop := HierarchyFirstMissingPosition rho T c) → False -private abbrev helperHsameTwo4804Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - (∀ {c : Fin k}, - c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ TreeMissingColors phi A) → - let Bshort : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt H q = - HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt H q, - C.good.gamma q eta = - P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta) → - ∀ beta ∈ TreeMissingColors phi Bshort, - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → - beta ∉ HierarchyStoredColorsAt H q → - (H.dividerCount = (0 : ℕ) → - beta ∈ TreeMissingColors phi A → - beta ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → - (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → - (∀ eta ∈ HierarchyStoredColorsAt H q, - beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → - beta ≠ D.alpha → - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → - T.vertex ib ∈ TreeSequenceVertexSet B → - T.vertex ib ≠ T.vertex D.penultimateVertexIndex → - T.vertex ib ≠ T.vertex D.terminalVertexIndex → - TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → - (beta ∉ TreeMissingColors phi A → - beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → - beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → - (let H : TashkinovHierarchy ett base := C.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); - have sameComponent : Prop := - TwoColorComponent G phi beta D.alpha (Sum.inl va) = - TwoColorComponent G phi beta D.alpha (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (beta ∈ TreeMissingColors phi Tnq ∨ - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (beta ∈ TreeMissingColors phi Tn ∨ - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - Dn) → - sameComponent) ∧ - (beta ∈ TreeMissingColors phi A ∧ - TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → - sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → - TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = - TwoColorComponent G phi beta D.alpha - (Sum.inl (T.vertex D.penultimateVertexIndex)) → - let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); - let muOne : PartialEdgeColoring E k := - TwoColorComponentSwap G phi beta D.alpha z; - Disjoint - (TwoColorComponent G phi beta D.alpha - (Sum.inl (T.vertex D.terminalVertexIndex))) - (TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib))) → - TwoColorPathComponent G phi beta D.alpha z → - Sum.inl (T.vertex ib) ∉ TwoColorComponent G phi beta D.alpha z → - Sum.inl (T.vertex D.penultimateVertexIndex) ∉ - TwoColorComponent G phi beta D.alpha z → - (∀ w ∈ TreeSequenceVertexSet B, - MissingColors G (TwoColorComponentSwap G phi beta D.alpha z) w = - MissingColors G phi w) → - (∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → - (∀ c ∈ HierarchyStoredColorsAt H q, - HierarchyFirstMissingPosition muOne T c = - HierarchyFirstMissingPosition phi T c) → - (beta ∈ TreeMissingColors phi A → - (0 : ℕ) < H.dividerCount ∧ - beta ∈ - TreeMissingColors phi - (H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) ∨ - H.dividerCount = (0 : ℕ) ∧ - beta ∈ - TreeMissingColors phi - (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → - ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T), - MaximumProperty corrOne.replacementETT → - ∀ (baseOne : HierarchyBase corrOne.replacementETT muOne) - (KOne : TashkinovHierarchy corrOne.replacementETT baseOne) - (goodOne : GoodHierarchy KOne), - SameGoodHierarchy C.good goodOne → - beta ∈ MissingColors G muOne (T.vertex D.terminalVertexIndex) → - ∀ - (POne : - HierarchyReplacementPresentation G k e0 input T phi ett base C - ctx), - POne.coloring = muOne → - let rho : PartialEdgeColoring E k := POne.coloring; - let ettOne : - ExtendedTashkinovTree G k e0 - POne.corresponding.replacementInput T POne.coloring := - POne.corresponding.replacementETT; - let baseOne' : - HierarchyBase POne.corresponding.replacementETT - POne.coloring := - POne.replacementBase; - let COne' : HierarchyCounterexample POne.replacementBase := - POne.counterexample; - let HOne : - TashkinovHierarchy POne.corresponding.replacementETT - POne.replacementBase := - COne'.hierarchy; - let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := - Fin.last HOne.dividerCount; - TreeMissingColors rho A = TreeMissingColors phi A → - beta ∉ HierarchyStoredColorsAt HOne qOne → - beta ∉ - MissingColors G rho (T.vertex D.penultimateVertexIndex) → - beta ∈ - MissingColors G rho (T.vertex D.terminalVertexIndex) → - beta ∈ MissingColors G rho (T.vertex ib) → - HierarchyFirstMissingPosition rho T beta = ib → - HierarchyFirstMissingPosition rho T D.theta = - D.penultimateVertexIndex → - (∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → - (beta ∈ TreeMissingColors phi A → - (0 : ℕ) < HOne.dividerCount ∧ - beta ∈ - TreeMissingColors rho - (HOne.stage - (⟨HOne.dividerCount, - by - have := - GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (HOne.dividerCount + (2 : ℕ)))) ∨ - HOne.dividerCount = (0 : ℕ) ∧ - beta ∈ - TreeMissingColors rho - (ettOne.series.data.tree - (Fin.last ettOne.rounds).castSucc)) → - beta ∈ TreeMissingColors rho B ∧ - D.theta ∈ TreeMissingColors rho B → - (let H : TashkinovHierarchy ettOne baseOne' := - COne'.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := - Fin.last H.dividerCount; - have n : Fin (ettOne.rounds + (1 : ℕ)) := - Fin.last ettOne.rounds; - have A : TreeSequence G e0 := - HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := - ettOne.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := - TashkinovStoredColors ettOne.series.data n; - have Dnq : Finset (Fin k) := - HierarchyStoredColorsAt H q; - have va : V := - T.vertex - (HierarchyFirstMissingPosition rho T beta); - have vb : V := - T.vertex - (HierarchyFirstMissingPosition rho T D.theta); - have sameComponent : Prop := - TwoColorComponent G rho beta D.theta - (Sum.inl va) = - TwoColorComponent G rho beta D.theta - (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (beta ∈ TreeMissingColors rho Tnq ∨ - Disjoint - (insert beta ({ D.theta } : Finset (Fin k)) : - Finset (Fin k)) - Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (beta ∈ TreeMissingColors rho Tn ∨ - Disjoint - (insert beta ({ D.theta } : Finset (Fin k)) : - Finset (Fin k)) - Dn) → - sameComponent) ∧ - (beta ∈ TreeMissingColors rho A ∧ - TreeColorSetClosed G rho A - ({ beta } : Finset (Fin k)) → - sameComponent ∧ - TreeInterchangeable G A rho beta D.theta)) → - TwoColorComponent G rho beta D.theta - (Sum.inl (T.vertex ib)) = - TwoColorComponent G rho beta D.theta - (Sum.inl (T.vertex D.penultimateVertexIndex)) - private abbrev helperReduction4203Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] @@ -1757,124 +1067,6 @@ private abbrev helperContinuation5379Conditions.{u_1, u_2} : Prop := TreeMissingColors phi X) → False -private theorem helper_hBT_115.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - B.length + (1 : ℕ) = T.length → - TreeSequenceInitialSegment B T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C B hBlen - refine ⟨?_, ?_, ?_⟩ - · omega - · intro i - rfl - · intro i - rfl - -private theorem helper_hApositive_122.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - (0 : ℕ) < H.dividerCount → - A = - H.stage - (⟨H.dividerCount, by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A hq - have hi : q = (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by - apply Fin.ext - simp [q] - omega - change HierarchyStarredStage H q = _ - rw [hi] - simp only [HierarchyStarredStage, Fin.cases_succ] - congr 1 - apply Fin.ext - simp - omega - -private theorem helper_hAT_140.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ((0 : ℕ) < H.dividerCount → - A = - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - TreeSequenceInitialSegment A T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A hApositive hAzero - by_cases hz : H.dividerCount = 0 - · have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = - Fin.last (H.dividerCount + 1) := by apply Fin.ext; simp [hz] - simpa [hAzero hz, hi, H.terminalStage] using H.coreInsideFirst - · rw [hApositive (Nat.pos_of_ne_zero hz)] - have hi : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = - q.castSucc := Fin.ext rfl - have hj : H.stage q.succ = T := by - convert H.terminalStage using 1 - congr 1 - simpa only [hi, hj] using H.nested q - -private theorem helper_hAB_152.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - (2 : ℕ) ≤ T.length - A.length → - B.length + (1 : ℕ) = T.length → - ((0 : ℕ) < H.dividerCount → - A = - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - TreeSequenceInitialSegment A T → - TreeSequenceInitialSegment A B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A B htail hBlen hApositive hAzero hAT - refine ⟨by omega, ?_, ?_⟩ - · intro i - exact hAT.2.1 i - · intro i - exact hAT.2.2 i - private theorem helper_hBterminal_158.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -2117,55 +1309,6 @@ private theorem helper_halphaUnused_265.{u_1, u_2} : (by change tB.val < A.length + (T.length - A.length - 1); omega) heB exact halphaNotRaw hs -private theorem helper_firstWitness_291.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (T : TreeSequence G e0) (rho : PartialEdgeColoring E k) - (X : TreeSequence G e0), - TreeSequenceInitialSegment X T → - ∀ c ∈ TreeMissingColors rho X, - c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ - (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length := by - classical - intro V E _ _ G k e0 T rho X hXT c hc - let _ := Fintype.ofFinite V - as_aux_lemma => - rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hvc⟩ - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - rcases hv with ⟨i, rfl⟩ - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G rho (T.vertex j) - have hi : Fin.castLE (Nat.succ_le_succ hXT.1) i ∈ candidates := by - simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] - rw [hXT.2.1 i] - exact hvc - have hn : candidates.Nonempty := ⟨_, hi⟩ - have hm := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - have hle := Finset.min'_le candidates _ hi - have hib := i.isLt - unfold HierarchyFirstMissingPosition - change (c ∈ MissingColors G rho (T.vertex (if h : candidates.Nonempty then - candidates.min' h else Fin.last T.length))) ∧ _ - rw [dite_eq_left hn] - refine ⟨hm, ?_⟩ - change (candidates.min' hn).val ≤ i.val at hle - omega - -private theorem helper_missingSubset_322.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeMissingColors rho X ⊆ TreeMissingColors rho Y := by - classical - intro V E _ _ G k e0 rho X Y hXY - let _ := Fintype.ofFinite V - as_aux_lemma => - intro c hc - obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc - exact Finset.mem_biUnion.mpr - ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hm⟩ - private theorem helper_missingWithoutExtra_331.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] @@ -2188,122 +1331,6 @@ private theorem helper_missingWithoutExtra_331.{u_1, u_2} : exact hc (Finset.mem_biUnion.mpr ⟨v, Finset.mem_sdiff.mpr ⟨hv, hn⟩, hvc⟩) exact Finset.mem_biUnion.mpr ⟨v, hvY, hvc⟩ -private theorem helper_firstPreserved_455.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - TreeSequenceInitialSegment B T → - (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), - TreeSequenceInitialSegment X T → - ∀ c ∈ TreeMissingColors rho X, - c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ - (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → - ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → - c ∈ TreeMissingColors rho B → - HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C B hBT firstWitness rho sigma c helem hmiss hc - as_aux_lemma => - clear_value B - clear * - G T B rho sigma c helem hmiss hc firstWitness hBT - have hr := firstWitness rho B hBT c hc - have hc' : c ∈ TreeMissingColors sigma B := by - obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc - exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ - have hs := firstWitness sigma B hBT c hc' - have pref (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : - T.vertex i ∈ TreeSequenceVertexSet B := by - let j : Fin (B.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ - have he : Fin.castLE (Nat.succ_le_succ hBT.1) j = i := Fin.ext rfl - exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr - ⟨j, Finset.mem_univ _, (hBT.2.1 j).symm.trans (congrArg T.vertex he)⟩ - by_contra hne - have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ - T.vertex (HierarchyFirstMissingPosition rho T c) := - fun he => hne (T.vertex_injective he) - have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 - exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 - -private theorem helper_firstUnaffected_480.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (T : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) - (a b c : Fin k), - a ≠ b → - IsProperEdgeColoring G rho → - c ≠ a → - c ≠ b → - HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = - HierarchyFirstMissingPosition rho T c := by - classical - intro V E _ _ G k e0 T z rho a b c hne hp hca hcb - let _ := Fintype.ofFinite V - have hb := TwoColorComponentSwapMissingBehavior G rho a b hne hp z - have he : (Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G (TwoColorComponentSwap G rho a b z) (T.vertex i)) = - (Finset.univ.filter fun i : Fin (T.length + 1) => - c ∈ MissingColors G rho (T.vertex i)) := by - ext i - simp only [Finset.mem_filter, Finset.mem_univ, true_and] - exact hb.2.2.2 _ c hca hcb - unfold HierarchyFirstMissingPosition - rw [he] - -private theorem helper_sameStar_549.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A P - have helper : ∀ (n m : ℕ) (X Y : TreeSequence G e0) - (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → TreeSequence G e0), - n = m → X = Y → HEq s t → - Fin.cases (motive := fun _ => TreeSequence G e0) - X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = - Fin.cases (motive := fun _ => TreeSequence G e0) - Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by - intro n m X Y s t hnm hXY hst - subst m - have he := eq_of_heq hst - simp [hXY, he] - exact (helper _ _ base.core P.replacementBase.core H.stage - P.counterexample.hierarchy.stage P.sameGood.1.2.1 P.sameGood.1.1 - P.sameGood.1.2.2.1).symm - -private theorem helper_commonPrefix_588.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {X Y F : TreeSequence G e0}, - TreeSequenceInitialSegment X F → - TreeSequenceInitialSegment Y F → - X.length ≤ Y.length → - TreeSequenceInitialSegment X Y := by - classical - intro V E G e0 X Y F hXF hYF hXY - refine ⟨hXY, ?_, ?_⟩ - · intro i - exact (hYF.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXF.2.1 i) - · intro i - exact (hYF.2.2 (Fin.castLE hXY i)).symm.trans (hXF.2.2 i) - private theorem helper_hcoreLength_597.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -2337,80 +1364,6 @@ private theorem helper_hcoreLength_597.{u_1, u_2} : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) ≤ ⟨H.dividerCount, by omega⟩ from Nat.pos_of_ne_zero hz)) -private theorem helper_predecessorIncident_606.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) - (e0 : E) (T X : TreeSequence G e0), - TreeSequenceInitialSegment X T → - ∀ (t : Fin T.length), - (↑t : ℕ) = X.length → - TreeIncidentEdge X (T.edge t) := by - classical - intro V E _ _ G e0 T X hXT t ht - let _ := Fintype.ofFinite V - let _ := Fintype.ofFinite E - obtain ⟨i, hi⟩ := T.attaches t - let j : Fin (X.length + 1) := ⟨i.val, by have := i.isLt; omega⟩ - have he : Fin.castLE (Nat.succ_le_succ hXT.1) j = - Fin.castLE (by omega : t.val + 1 ≤ T.length + 1) i := Fin.ext rfl - refine ⟨X.vertex j, (@Finset.mem_image _ _ (Classical.decEq V)).mpr - ⟨j, Finset.mem_univ _, rfl⟩, ?_⟩ - rw [← hXT.2.1 j, he, Incident, hi] - exact Sym2.mem_mk_right _ _ - -private theorem helper_seedStable_618.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) - (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) - (K : TashkinovHierarchy ett' base'), - HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → - K.dividerCount = (0 : ℕ) → - StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) - (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma := by - classical - intro V E _ _ _ _ G k e0 T input' rho sigma ett' base' K hw hq - have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hq - rw [hi] at hw - change (if ett'.series.data.kind (Fin.last ett'.rounds) = - some TashkinovExtensionKind.PE then _ else _) at hw - split_ifs at hw with hpe - · exact hw.1 - · exact hw - -private theorem helper_weakEdges_634.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) - {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) - (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) - (K : TashkinovHierarchy ett' base'), - HierarchyWeaklyStable K (Fin.last K.dividerCount) new → - IsOneEdgeUncolored old e0 → - IsOneEdgeUncolored new e0 → - ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), - new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = - old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by - classical - intro V E _ _ _ _ G k e0 T input' old new ett' base' K hw ho hno - by_cases hz : K.dividerCount = 0 - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz - rw [hi] at hw ⊢ - exact P2813_T1_BaseDisplayedEdges G k e0 input' T old ett' base' new ho hno hw - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := - Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) - rw [hi] at hw ⊢ - intro t - have hinv := hw.2 - by_cases ht : 1 ≤ t.val - · exact hinv.1 t ht - · let S := HierarchyStarredStage K - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ - have he : t = ⟨0, S.positive⟩ := Fin.ext (by change t.val = 0; omega) - rw [he, S.first_edge, hno.1, ho.1] - private theorem helper_hbetaTheta_676.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -2502,34 +1455,6 @@ private theorem helper_hyt_702.{u_1, u_2} : clear * - hi hp ht omega -private theorem helper_firstAfter_715.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - TreeSequenceInitialSegment A T → - ∀ (rho : PartialEdgeColoring E k), - ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), - c ∉ TreeMissingColors rho A → - A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A hAT rho c hc hn - by_contra h - have hi : (HierarchyFirstMissingPosition rho T c).val ≤ A.length := Nat.le_of_not_gt h - let i : Fin (A.length + 1) := ⟨(HierarchyFirstMissingPosition rho T c).val, by omega⟩ - have he : Fin.castLE (Nat.succ_le_succ hAT.1) i = - HierarchyFirstMissingPosition rho T c := Fin.ext rfl - apply hn - refine Finset.mem_biUnion.mpr ⟨A.vertex i, (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, - Finset.mem_univ _, rfl⟩, ?_⟩ - rw [← hAT.2.1 i, he] - exact hc - private theorem helper_hsame_747.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -2837,7 +1762,7 @@ private theorem helper_hcaseOne_906.{u_1, u_2} : exact hm private theorem helper_hsameTwo_964.{u_1, u_2} : - helperHsameTwo964Conditions.{u_1, u_2} := by + SharedFacts.SecondSubcaseTransport.hsameTwo964Conditions.{u_1, u_2} := by classical intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib @@ -3570,21 +2495,6 @@ private theorem helper_unused_1456.{u_1, u_2} : · exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, he⟩) · exact Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, he⟩) -private theorem helper_segmentTrans_1475.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → - TreeSequenceInitialSegment X Z := by - classical - intro V E G e0 X Y Z hXY hYZ - refine ⟨le_trans hXY.1 hYZ.1, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) - private theorem helper_forward_1483.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -4357,7 +3267,8 @@ private theorem helper_branch_3441.{u_1, u_2} : have segmentTrans {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) (hYZ : TreeSequenceInitialSegment Y Z) : TreeSequenceInitialSegment X Z := by - exact @helper_segmentTrans_1475 (@V) (@E) (@G) (@e0) (@X) (@Y) (@Z) (@hXY) (@hYZ) + exact @SharedFacts.StoredExceptionTransport.segmentTrans (@V) (@E) (@G) (@e0) (@X) (@Y) + (@Z) (@hXY) (@hYZ) have forward : ∀ a d : ℕ, ∀ hb : a + d ≤ H.dividerCount + 1, TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) (H.stage ⟨a + d, by omega⟩) := by @@ -4503,7 +3414,7 @@ private theorem helper_hsame_3634.{u_1, u_2} : (@horder) (@hrawBeta) (@hmissing) (@hchange) private theorem helper_hsameTwo_3799.{u_1, u_2} : - helperHsameTwo3799Conditions.{u_1, u_2} := by + SharedFacts.SecondSubcaseTransport.hsameTwo964Conditions.{u_1, u_2} := by classical intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib @@ -4823,7 +3734,7 @@ private theorem helper_hsame_4639.{u_1, u_2} : (@hbt) (@horder) (@hrawBeta) (@hmissing) (@hchange) private theorem helper_hsameTwo_4804.{u_1, u_2} : - helperHsameTwo4804Conditions.{u_1, u_2} := by + SharedFacts.SecondSubcaseTransport.hsameTwo964Conditions.{u_1, u_2} := by classical intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib @@ -5519,7 +4430,8 @@ private theorem helper_reduction_4203.{u_1, u_2} : (hc : c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c))) (hn : c ∉ TreeMissingColors rho A) : A.length < (HierarchyFirstMissingPosition rho T c).val := by - exact @helper_firstAfter_715 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.SecondSituationTransport.firstAfter (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) (@rho) (@c) (@hc) (@hn) have hrawBeta (hn : beta ∉ TreeMissingColors phi A) : @@ -5663,7 +4575,8 @@ private theorem helper_continuation_4157.{u_1, u_2} : (hne : a ≠ b) (hp : IsProperEdgeColoring G rho) (hca : c ≠ a) (hcb : c ≠ b) : HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = HierarchyFirstMissingPosition rho T c := by - exact @helper_firstUnaffected_480 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + exact @SharedFacts.SecondSituationTransport.firstUnaffected (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@z) (@rho) (@a) (@b) (@c) (@hne) (@hp) (@hca) (@hcb) have seriesFacts : ∀ j : Fin (ett.rounds + 1), IsProperEdgeColoring G (ett.series.data.coloring j) ∧ @@ -5695,7 +4608,8 @@ private theorem helper_continuation_4157.{u_1, u_2} : have sameStar (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : HierarchyStarredStage P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount) = A := by - exact @helper_sameStar_549 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.FirstSubcaseTransport.sameStar (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) have samePrefix (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - 1) = B @@ -5723,7 +4637,8 @@ private theorem helper_continuation_4157.{u_1, u_2} : have commonPrefix {X Y F : TreeSequence G e0} (hXF : TreeSequenceInitialSegment X F) (hYF : TreeSequenceInitialSegment Y F) (hXY : X.length ≤ Y.length) : TreeSequenceInitialSegment X Y := by - exact @helper_commonPrefix_588 (@V) (@E) (@G) (@e0) (@X) (@Y) (@F) (@hXF) (@hYF) (@hXY) + exact @SharedFacts.SecondSituationTransport.comparableInitialSegments (@V) (@E) (@G) (@e0) + (@X) (@Y) (@F) (@hXF) (@hYF) (@hXY) have hcoreLength : base.core.length ≤ A.length := by exact @helper_hcoreLength_597 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) @@ -5731,7 +4646,8 @@ private theorem helper_continuation_4157.{u_1, u_2} : have predecessorIncident (X : TreeSequence G e0) (hXT : TreeSequenceInitialSegment X T) (t : Fin T.length) (ht : t.val = X.length) : TreeIncidentEdge X (T.edge t) := by - exact @helper_predecessorIncident_606 (@V) (@E) inferInstance inferInstance (@G) (@e0) (@T) + exact @SharedFacts.SecondSituationTransport.predecessorIncident (@V) (@E) inferInstance + inferInstance (@G) (@e0) (@T) (@X) (@hXT) (@t) (@ht) have seedStable {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) @@ -5741,7 +4657,8 @@ private theorem helper_continuation_4157.{u_1, u_2} : (hq : K.dividerCount = 0) : StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma := by - exact @helper_seedStable_618 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.SecondSituationTransport.seedStable (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@T) (@input') (@rho) (@sigma) (@ett') (@base') (@K) (@hw) (@hq) have weakEdges {input' : PartialEdgeColoring E k} @@ -5753,7 +4670,8 @@ private theorem helper_continuation_4157.{u_1, u_2} : ∀ t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length, new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) := by - exact @helper_weakEdges_634 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @SharedFacts.SecondSituationTransport.weakEdges (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@T) (@input') (@old) (@new) (@ett') (@base') (@K) (@hw) (@ho) (@hno) have reduction (beta : Fin k) (hbetaMissing : beta ∈ TreeMissingColors phi Bshort) @@ -5811,11 +4729,13 @@ theorem HierarchySituationTwoSubcaseTwoTwo {V E : Type*} change min (A.length + (T.length - A.length - 1)) T.length + 1 = T.length omega have hBT : TreeSequenceInitialSegment B T := by - exact @helper_hBT_115 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @SharedFacts.FirstSubcaseTransport.bT (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBlen) have hApositive (hq : 0 < H.dividerCount) : A = H.stage ⟨H.dividerCount, by omega⟩ := by - exact @helper_hApositive_122 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.SecondSituationTransport.apositive (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hq) have hAzero (hq : H.dividerCount = 0) : A = base.core := by have hi : q = 0 := by apply Fin.ext; simp [q, hq] @@ -5823,10 +4743,12 @@ theorem HierarchySituationTwoSubcaseTwoTwo {V E : Type*} rw [hi] rfl have hAT : TreeSequenceInitialSegment A T := by - exact @helper_hAT_140 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @SharedFacts.SecondSituationTransport.aT (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hApositive) (@hAzero) have hAB : TreeSequenceInitialSegment A B := by - exact @helper_hAB_152 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @SharedFacts.SecondSituationTransport.aB (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@htail) (@hBlen) (@hApositive) (@hAzero) (@hAT) have hBterminal : B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex := by @@ -5894,7 +4816,8 @@ theorem HierarchySituationTwoSubcaseTwoTwo {V E : Type*} (hc : c ∈ TreeMissingColors rho X) : c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ (HierarchyFirstMissingPosition rho T c).val ≤ X.length := by - exact @helper_firstWitness_291 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) + exact @SharedFacts.SecondSituationTransport.firstWitness (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@T) (@rho) (@X) (@hXT) (@c) (@hc) have self (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V) : Sum.inl v ∈ TwoColorComponent G rho a b (Sum.inl v) := by @@ -5903,7 +4826,8 @@ theorem HierarchySituationTwoSubcaseTwoTwo {V E : Type*} have missingSubset (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) : TreeMissingColors rho X ⊆ TreeMissingColors rho Y := by - exact @helper_missingSubset_322 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@rho) + exact @SharedFacts.SecondSituationTransport.missingSubset (@V) (@E) inferInstance + inferInstance (@G) (@k) (@e0) (@rho) (@X) (@Y) (@hXY) have missingWithoutExtra (rho : PartialEdgeColoring E k) (X Y : TreeSequence G e0) (c : Fin k) @@ -5939,7 +4863,8 @@ theorem HierarchySituationTwoSubcaseTwoTwo {V E : Type*} (hmiss : ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) (hc : c ∈ TreeMissingColors rho B) : HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c := by - exact @helper_firstPreserved_455 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.SecondSituationTransport.firstPreserved (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hBT) (@firstWitness) (@rho) (@sigma) (@c) (@helem) (@hmiss) (@hc) exact @helper_continuation_4157 (@V) (@E) inferInstance inferInstance inferInstance diff --git a/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean b/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean index 78a6bb57fb..6c64f4a629 100644 --- a/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean +++ b/LeanPool/GoldbergSeymour/HkuUnsupportedVertexColors.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.UnsupportedVertexColors + public import LeanPool.GoldbergSeymour.TashkinovSeries public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo @@ -396,52 +398,6 @@ private theorem helper_one_step_55.{u_1, u_2} : currentColoring currentProper currentOneUncolored currentStored currentEdges currentKind currentVertex currentOutside currentDelta currentGamma closedExtension orderedExtension strictExtension hj hno -private theorem helper_next_segment_342.{u_1, u_2} : - open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + - (1 : ℕ))) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment (series.data.tree - i.succ.castSucc) (series.data.tree i.succ.succ) := by - classical - intro V E _ _ _ G k rounds e0 input series j i hj - cases series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges - initialKind initialVertex initialOutside initialDelta initialGamma - initialClosure => - exact (Fin.succ_ne_zero i) hj.symm |>.elim - | SE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hj - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | RE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma adjoined adjoinedExactly closedExtension orderedExtension - strictExtension => - have hvals := congrArg Fin.val hj - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | PE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper - secondStableOneUncolored secondStableRelation exitWitness - currentColoring currentProper currentOneUncolored currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hj - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - private theorem helper_chain_383.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : @@ -515,7 +471,8 @@ theorem HkuUnsupportedVertexColors {V E : Type*} [Fintype V] [Fintype E] simpa using (hvertex i)⟩ have one_step := @helper_one_step_55 V E inferInstance inferInstance inferInstance G k rounds e0 input series q p v - have next_segment := @helper_next_segment_342 V E inferInstance inferInstance inferInstance G k + have next_segment := @SharedFacts.UnsupportedVertexColors.next_segment V E inferInstance + inferInstance inferInstance G k rounds e0 input series have chain := @helper_chain_383 V E inferInstance inferInstance inferInstance G k rounds e0 input series q p vertex_transfer one_step next_segment diff --git a/LeanPool/GoldbergSeymour/Imports.lean b/LeanPool/GoldbergSeymour/Imports.lean index d7c09dc0bf..bf1dcbea62 100644 --- a/LeanPool/GoldbergSeymour/Imports.lean +++ b/LeanPool/GoldbergSeymour/Imports.lean @@ -530,6 +530,42 @@ public import LeanPool.GoldbergSeymour.ScheideTrunkRotationNormal public import LeanPool.GoldbergSeymour.ScheideTrunkRotationPreserves public import LeanPool.GoldbergSeymour.ScheideTrunkRotationTree public import LeanPool.GoldbergSeymour.ScheideTwoColorLastExitPath +public import LeanPool.GoldbergSeymour.SharedFacts.BaseControl +public import LeanPool.GoldbergSeymour.SharedFacts.Basic2TerminalPE +public import LeanPool.GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 +public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaTransport +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseClaim45Singleton +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseStepLemmas +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBranchPreparation +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBranches +public import LeanPool.GoldbergSeymour.SharedFacts.FirstSubcaseTransport +public import LeanPool.GoldbergSeymour.SharedFacts.FullTailTransport +public import LeanPool.GoldbergSeymour.SharedFacts.GoodHierarchyPrefixPreparation +public import LeanPool.GoldbergSeymour.SharedFacts.InsideAdvancement +public import LeanPool.GoldbergSeymour.SharedFacts.LargestClosedTransport +public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport +public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation1 +public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation2 +public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement +public import LeanPool.GoldbergSeymour.SharedFacts.ParallelSupportClosureProperties +public import LeanPool.GoldbergSeymour.SharedFacts.RevisitingTerminalPreparation +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveDeletedTreePair +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveNoCross +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveThirdBoundaryEdge +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDeletedMissingReplacementInternal +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideHeightFiveGammaEdges +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideSelectedBlockDeletion +public import LeanPool.GoldbergSeymour.SharedFacts.SecondSituationTransport +public import LeanPool.GoldbergSeymour.SharedFacts.SecondSubcaseTransport +public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningTransport +public import LeanPool.GoldbergSeymour.SharedFacts.StableChangeCasesOneTwoSplitTail +public import LeanPool.GoldbergSeymour.SharedFacts.StoredExceptionTransport +public import LeanPool.GoldbergSeymour.SharedFacts.SubcaseThreeOnePreparation1 +public import LeanPool.GoldbergSeymour.SharedFacts.TerminalKempeStageSwitch +public import LeanPool.GoldbergSeymour.SharedFacts.TerminalRebuild +public import LeanPool.GoldbergSeymour.SharedFacts.TerminalRebuildTransport +public import LeanPool.GoldbergSeymour.SharedFacts.UnsupportedVertexColors +public import LeanPool.GoldbergSeymour.SharedFacts.ZeroNonclosedTransport public import LeanPool.GoldbergSeymour.SimpleExtensionSeedStoredColor public import LeanPool.GoldbergSeymour.SplitSwapData public import LeanPool.GoldbergSeymour.SplitSwapPreparation diff --git a/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean b/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean index cabdea181d..c5ba7a4c69 100644 --- a/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean +++ b/LeanPool/GoldbergSeymour/LateOwnerReplacement.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwoSplitTail public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion @@ -592,59 +593,11 @@ private theorem helper_continuation_769.{u_1, u_2} : have seriesProper : ∀ j : Fin (ett.rounds + 1), IsProperEdgeColoring G (ett.series.data.coloring j) := by intro j - cases ett.series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.1 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedProper - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => exact currentProper - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma adjoined adjoinedExactly closedExtension orderedExtension - strictExtension => - rw [currentColoring] - exact previousProper + exact (ett.series.coloringProperties j).1 have seriesOne : ∀ j : Fin (ett.rounds + 1), IsOneEdgeUncolored (ett.series.data.coloring j) e0 := by intro j - cases ett.series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges initialKind - initialVertex initialOutside initialDelta initialGamma initialClosure => - simpa [initialColoring] using triple.2.2.2.2 - | SE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - rw [currentColoring] - exact choice.selectedOneUncolored - | PE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper secondStableOneUncolored - secondStableRelation exitWitness currentColoring currentProper - currentOneUncolored currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma closedExtension orderedExtension - strictExtension => exact currentOneUncolored - | RE i previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma adjoined adjoinedExactly closedExtension orderedExtension - strictExtension => - rw [currentColoring] - exact previousOneUncolored + exact (ett.series.coloringProperties j).2 let selfCorr : CorrespondingExtendedTashkinovTree G k e0 ett phi T := { replacementInput := input replacementSeries := ett.series diff --git a/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean b/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean index ab38922676..e6264d6b26 100644 --- a/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean +++ b/LeanPool/GoldbergSeymour/ParallelSupportClosureProperties.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ParallelSupportClosureProperties + public import LeanPool.GoldbergSeymour.CertifiedETTRestriction public import LeanPool.GoldbergSeymour.HierarchyBase public import LeanPool.GoldbergSeymour.MaximumPropertyTransport @@ -1195,33 +1197,6 @@ private theorem helper_stageToStage_923.{u_1, u_2} : have hchain := chain (b - a) (by omega) convert hchain using 1; congr 1; apply Fin.ext; simp; omega -private theorem helper_commonPrefix_1011.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B - C → A.length ≤ B.length → TreeSequenceInitialSegment A B := by - classical - intro V E G e0 A B C hAC hBC hlen - rcases hAC with ⟨hACLen, hACVertices, hACEdges⟩ - rcases hBC with ⟨hBCLen, hBCVertices, hBCEdges⟩ - refine ⟨hlen, ?_, ?_⟩ - · intro i - calc - B.vertex (Fin.castLE (Nat.succ_le_succ hlen) i) = - C.vertex (Fin.castLE (Nat.succ_le_succ hBCLen) - (Fin.castLE (Nat.succ_le_succ hlen) i)) := - (hBCVertices _).symm - _ = C.vertex (Fin.castLE (Nat.succ_le_succ hACLen) i) := by - congr 1 - _ = A.vertex i := hACVertices i - · intro i - calc - B.edge (Fin.castLE hlen i) = - C.edge (Fin.castLE hBCLen (Fin.castLE hlen i)) := - (hBCEdges _).symm - _ = C.edge (Fin.castLE hACLen i) := by congr 1 - _ = A.edge i := hACEdges i - private theorem helper_hvStage_1145.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1592,7 +1567,8 @@ theorem ParallelSupportClosureProperties {V E : Type*} (hvbc (Fin.castLE (Nat.succ_le_succ hab) i)).trans (hvab i) · intro i simpa using (hebc (Fin.castLE hab i)).trans (heab i) - have commonPrefix := @helper_commonPrefix_1011 V E G e0 + have commonPrefix := @SharedFacts.ParallelSupportClosureProperties.comparableInitialSegments + V E G e0 have vertexTransfer {A B : TreeSequence G e0} (hAB : TreeSequenceInitialSegment A B) : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by diff --git a/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean b/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean index 82804d0787..81bc4b3a0e 100644 --- a/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean +++ b/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean @@ -6,6 +6,8 @@ Authors: Wesley Pegden module +public import LeanPool.GoldbergSeymour.SharedFacts.RevisitingTerminalPreparation + public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent public import LeanPool.GoldbergSeymour.StableColoringIncidentEdgeCriterion public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis @@ -1008,37 +1010,10 @@ abbrev helperInterveningRevisiting4368Conditions.{u_1, u_2} : Prop := (↑replacementLast : ℕ) → corr.replacementSeries.data.kind j = some TashkinovExtensionKind.RE +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hTnClosure_110.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) (Tstar : TreeSequence G e0), - TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → - ∀ (closureTree : TreeSequence G e0), - TreeSequenceInitialSegment Tstar closureTree → - TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) - closureTree := by - classical - intro V E _ _ _ G k e0 input T generating ett Tstar hTnTstar closureTree hTstarClosure - rcases hTnTstar with ⟨hlenAB, hvertexAB, hedgeAB⟩ - rcases hTstarClosure with ⟨hlenBC, hvertexBC, hedgeBC⟩ - refine ⟨Nat.le_trans hlenAB hlenBC, ?_, ?_⟩ - · intro j - calc - closureTree.vertex (Fin.castLE (Nat.succ_le_succ (Nat.le_trans hlenAB hlenBC)) j) = - closureTree.vertex - (Fin.castLE (Nat.succ_le_succ hlenBC) (Fin.castLE (Nat.succ_le_succ hlenAB) j)) := - by congr 1 - _ = Tstar.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) j) := hvertexBC _ - _ = (ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex j := hvertexAB j - · intro j - calc - closureTree.edge (Fin.castLE (Nat.le_trans hlenAB hlenBC) j) = - closureTree.edge (Fin.castLE hlenBC (Fin.castLE hlenAB j)) := - by congr 1 - _ = Tstar.edge (Fin.castLE hlenAB j) := hedgeBC _ - _ = (ett.series.data.tree (Fin.last ett.rounds).castSucc).edge j := hedgeAB j + SharedFacts.RevisitingTerminalPreparation.tnClosureStatement.{u_1, u_2} := + SharedFacts.RevisitingTerminalPreparation.tnClosure.{u_1, u_2} theorem helper_reStepColoring_588.{u_1, u_2} : open scoped Classical in @@ -1561,24 +1536,10 @@ theorem helper_hsigmaExitGraph_1471.{u_1, u_2} : by rw [hnewGammaAvailable, hnewDeltaAvailable] _ = TwoColorIncidenceGraph G newSecond newGamma newChoice.color := hswapGraph +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hi_768.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (i : Fin ett.rounds), Fin.last ett.rounds = i.succ → i = q := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q i htarget - apply Fin.ext - have hv : ett.rounds = i.val + 1 := by simpa using congrArg Fin.val htarget - change i.val = ett.rounds - 1 - omega + SharedFacts.RevisitingTerminalPreparation.hiStatement.{u_1, u_2} := + SharedFacts.RevisitingTerminalPreparation.hi.{u_1, u_2} theorem helper_branch_787.{u_1, u_2} : open scoped Classical in @@ -1611,19 +1572,10 @@ theorem helper_branch_787.{u_1, u_2} : have hearlierPositive := available.earlierPositive omega +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hne_1035.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) - (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), - g ∈ MissingColors G second ch.vertex → second ch.edge = some ch.color → g ≠ ch.color := by - classical - intro V E _ _ G k e0 X C phi ch g second hgSecond hedgeSecond heq - have hpresent : g ∈ PresentColors G second ch.vertex := by - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] - exact ⟨ch.edge, ch.edgeIncident, by simpa [heq] using hedgeSecond⟩ - have hnotPresent : g ∉ PresentColors G second ch.vertex := by simpa [MissingColors] using hgSecond - exact hnotPresent hpresent + SharedFacts.RevisitingTerminalPreparation.hneStatement.{u_1, u_2} := + SharedFacts.RevisitingTerminalPreparation.hne.{u_1, u_2} theorem helper_hbaseTree_1084.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean index ddf687739d..23e32bef5a 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveDeletedTreePair + public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData public import LeanPool.GoldbergSeymour.ScheideDefectiveSecondTerminalComponent @@ -499,56 +501,6 @@ private theorem helper_tashkinov_adjoinJ_443.{u_1, u_2} : rw [← hindex, hvert a, ha] simpa [newVertexIndex, hvertex] using hmiss -private theorem helper_adjoin_vertex_set_500.{u_1, u_2} : - open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : - LooplessMultigraph V E) (e0 : E) (A B : TreeSequence G e0) (f : E) (x y : V), G.ends f = - s(x, y) → y ∉ TreeSequenceVertexSet A → TreeSequenceAdjoinEdge A f B → - TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by - classical - intro V E _ G e0 A B f x y hxy hyA hAB - rcases hAB with ⟨hlen, hinit, hlast⟩ - rcases hinit with ⟨hle, hvertices, hedges⟩ - have holdSubset : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by - intro v hv - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hv ⊢ - obtain ⟨q, hq⟩ := hv - refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ - rw [hvertices] - exact hq - have hyB : y ∈ TreeSequenceVertexSet B := by - let q : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) - obtain ⟨a, ha⟩ := B.attaches q - have hyEnds : y ∈ G.ends (B.edge q) := by - rw [hlast, hxy] - simp - rw [ha] at hyEnds - rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold - · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - exact ⟨q.succ, hynew.symm⟩ - · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - exact ⟨Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)), - hyold.symm⟩ - have hinsert : insert y (TreeSequenceVertexSet A) ⊆ - TreeSequenceVertexSet B := by - intro v hv - simp only [Finset.mem_insert] at hv - rcases hv with rfl | hv - · exact hyB - · exact holdSubset hv - have hAcard : (TreeSequenceVertexSet A).card = A.length + 1 := by - simp [TreeSequenceVertexSet, Finset.card_image_of_injective, - A.vertex_injective] - have hBcard : (TreeSequenceVertexSet B).card = B.length + 1 := by - simp [TreeSequenceVertexSet, Finset.card_image_of_injective, - B.vertex_injective] - have hcard : (TreeSequenceVertexSet B).card ≤ - (insert y (TreeSequenceVertexSet A)).card := by - rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] - exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm - private theorem helper_continuation_619.{u_1, u_2} : helperContinuation619Conditions.{u_1, u_2} := by classical @@ -586,7 +538,8 @@ private theorem helper_continuation_619.{u_1, u_2} : (hyA : y ∉ TreeSequenceVertexSet A) (hAB : TreeSequenceAdjoinEdge A f B) : TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by - exact @helper_adjoin_vertex_set_500 V E inferInstance G e0 A B f x y hxy hyA hAB + exact @SharedFacts.ScheideDefectiveDeletedTreePair.adjoin_vertex_set V E inferInstance G + e0 A B f x y hxy hyA hAB have hv0Gamma : D.v0 d ∈ TreeSequenceVertexSet Tgamma := by obtain ⟨a, _, ha⟩ := Finset.mem_image.mp (ScheideStructuralExitsInBase G k e0 phi T C (D.v0_is_exit d)) diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean index a9e610a825..580b239b64 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveNoCross + public import LeanPool.GoldbergSeymour.ScheideDefectiveCrossingSelection public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup public import LeanPool.GoldbergSeymour.ScheideDefectiveTerminalComponent @@ -185,20 +187,6 @@ private theorem helper_adjoin_vertex_set_343.{u_1, u_2} : rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm -private theorem helper_tree_edge_incident_279.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] - (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) (q : Fin T.length), - TreeIncidentEdge T (T.edge q) := by - classical - intro V E _ _ G e0 T q - let _ := Fintype.ofFinite V - let _ := Fintype.ofFinite E - obtain ⟨a, ha⟩ := T.attaches q - refine ⟨T.vertex q.succ, ?_, ?_⟩ - · simp [TreeSequenceVertexSet] - · simp [Incident, ha] - private theorem helper_component_vertex_of_edge_285.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : @@ -614,7 +602,8 @@ theorem ScheideDefectiveNoCross {V E : Type*} ⟨hproper1, hone1, hstable1, hfixed1, htailK, hf0K, hKtree, htreeEdgesOutside, hKcolors⟩ have tree_edge_incident : ∀ q : Fin T.length, TreeIncidentEdge T (T.edge q) := by - exact @helper_tree_edge_incident_279 (@V) (@E) inferInstance inferInstance (@G) (@e0) (@T) + exact @SharedFacts.ScheideDefectiveNoCross.tree_edge_incident (@V) (@E) inferInstance + inferInstance (@G) (@e0) (@T) have component_vertex_of_edge {v : V} {e : E} (heK : Sum.inr e ∈ K) (hve : Incident G v e) (hecolor : phi1 e = some gamma ∨ phi1 e = some d.1) : diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean index 872ca0c87e..817ddf4286 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module + + public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData public import LeanPool.GoldbergSeymour.ScheideDefectiveThirdBoundaryEdge public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts @@ -119,129 +121,6 @@ private abbrev helperContinuation291Conditions.{u_1, u_2} : Prop := c ∈ MissingColors G rho v → TashkinovTree G e0 rho U) → False -private theorem helper_tashkinov_adjoin_165.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) - (T : TreeSequence G e0) (C : ScheideReducedConfiguration G k e0 phi T) - (D : ScheideDefectiveSetup G k e0 phi T C) - (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) - (_ : ScheideDefectiveReturnData G k e0 phi T C D d) (rho : PartialEdgeColoring E k) - (S U : TreeSequence G e0) (f : E), - TreeSequenceAdjoinEdge S f U → - TashkinovTree G e0 rho S → - ∀ (c : Fin k), - rho f = some c → - ∀ v ∈ TreeSequenceVertexSet S, - c ∈ MissingColors G rho v → - TashkinovTree G e0 rho U := by - classical - intro V E _ _ _ _ G k e0 phi T C D d R rho S U f hadjoin hS c hf v hv hmiss - rcases hadjoin with ⟨hlen, hinitial, hlast⟩ - rcases hinitial with ⟨hle, hvert, hedge⟩ - intro q hq - by_cases hold : q.val < S.length - · let qS : Fin S.length := ⟨q.val, hold⟩ - obtain ⟨a, color, hcolor, hcolorMissing⟩ := - hS qS (by simpa [qS] using hq) - let aU : Fin (q.val + 1) := ⟨a.val, by simpa [qS] using a.isLt⟩ - refine ⟨aU, color, ?_, ?_⟩ - · have hqeq : Fin.castLE hle qS = q := by - apply Fin.ext - rfl - have hUedge : U.edge q = S.edge qS := by - rw [← hqeq] - exact hedge qS - rw [hUedge] - exact hcolor - · let oldVertexIndex : Fin (S.length + 1) := - Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ qS.isLt)) - let newVertexIndex : Fin (U.length + 1) := - Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) - have hindex : Fin.castLE (Nat.succ_le_succ hle) oldVertexIndex = - newVertexIndex := by - apply Fin.ext - rfl - have hvertex : U.vertex newVertexIndex = S.vertex oldVertexIndex := by - rw [← hindex] - exact hvert oldVertexIndex - simpa [oldVertexIndex, newVertexIndex] using - hvertex.symm ▸ hcolorMissing - · have hqval : q.val = S.length := by - have hqbound : q.val < S.length + 1 := by simpa [hlen] using q.isLt - omega - obtain ⟨a, ha⟩ : ∃ a : Fin (S.length + 1), S.vertex a = v := by - simpa [TreeSequenceVertexSet] using hv - let aU : Fin (q.val + 1) := ⟨a.val, by simpa [hqval] using a.isLt⟩ - refine ⟨aU, c, ?_, ?_⟩ - · have hqlast : q = Fin.cast hlen.symm (Fin.last S.length) := by - apply Fin.ext - simpa using hqval - rw [hqlast, hlast] - exact hf - · let newVertexIndex : Fin (U.length + 1) := - Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) - have hindex : Fin.castLE (Nat.succ_le_succ hle) a = - newVertexIndex := by - apply Fin.ext - rfl - have hvertex : U.vertex newVertexIndex = v := by - rw [← hindex, hvert a, ha] - simpa [newVertexIndex, hvertex] using hmiss - -private theorem helper_adjoin_vertex_set_223.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) (e0 : E) - (A B : TreeSequence G e0) (f : E) (x y : V), - G.ends f = s(x, y) → - y ∉ TreeSequenceVertexSet A → - TreeSequenceAdjoinEdge A f B → - TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by - classical - intro V E _ G e0 A B f x y hxy hyA hAB - rcases hAB with ⟨hlen, hinit, hlast⟩ - rcases hinit with ⟨hle, hvertices, hedges⟩ - have holdSubset : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by - intro v hv - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hv ⊢ - obtain ⟨q, hq⟩ := hv - refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ - rw [hvertices] - exact hq - have hyB : y ∈ TreeSequenceVertexSet B := by - let q : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) - obtain ⟨a, ha⟩ := B.attaches q - have hyEnds : y ∈ G.ends (B.edge q) := by - rw [hlast, hxy] - simp - rw [ha] at hyEnds - rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold - · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - exact ⟨q.succ, hynew.symm⟩ - · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - exact ⟨Fin.castLT a (Nat.lt_trans a.isLt - (Nat.succ_lt_succ q.isLt)), hyold.symm⟩ - have hinsert : insert y (TreeSequenceVertexSet A) ⊆ - TreeSequenceVertexSet B := by - intro v hv - simp only [Finset.mem_insert] at hv - rcases hv with rfl | hv - · exact hyB - · exact holdSubset hv - have hAcard : (TreeSequenceVertexSet A).card = A.length + 1 := by - simp [TreeSequenceVertexSet, Finset.card_image_of_injective, - A.vertex_injective] - have hBcard : (TreeSequenceVertexSet B).card = B.length + 1 := by - simp [TreeSequenceVertexSet, Finset.card_image_of_injective, - B.vertex_injective] - have hcard : (TreeSequenceVertexSet B).card ≤ - (insert y (TreeSequenceVertexSet A)).card := by - rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] - exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm - private theorem helper_hone2_388.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] @@ -1016,7 +895,8 @@ private theorem helper_continuation_291.{u_1, u_2} : (hyA : y ∉ TreeSequenceVertexSet A) (hAB : TreeSequenceAdjoinEdge A f B) : TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by - exact @helper_adjoin_vertex_set_223 V E inferInstance G e0 A B f x y hxy hyA hAB + exact @SharedFacts.ScheideDefectiveDeletedTreePair.adjoin_vertex_set V E inferInstance G + e0 A B f x y hxy hyA hAB have hz2Sgamma : z2 ∈ TreeSequenceVertexSet Sgamma := by rw [hSgammaVertices] apply Finset.mem_union.mpr @@ -1229,7 +1109,8 @@ theorem ScheideDefectiveReturnContradiction {V E : Type*} (hf : rho f = some c) (v : V) (hv : v ∈ TreeSequenceVertexSet S) (hmiss : c ∈ MissingColors G rho v) : TashkinovTree G e0 rho U := by - exact @helper_tashkinov_adjoin_165 V E inferInstance inferInstance inferInstance + exact @SharedFacts.ScheideDefectiveThirdBoundaryEdge.tashkinov_adjoin V E inferInstance + inferInstance inferInstance inferInstance G k e0 phi T C D d R rho S U f hadjoin hS c hf v hv hmiss exact @helper_continuation_291 V E inferInstance inferInstance inferInstance inferInstance G k e0 phi T C D d R hproper1 hone1 hstable1 hproperJ2 honeJ2 hdeltaMissingJ2 Sgamma SgammaJ diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean index 85a5490f25..8c21f4b877 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveThirdBoundaryEdge + public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap public import LeanPool.GoldbergSeymour.ScheideDefectiveDeletedTreePair public import LeanPool.GoldbergSeymour.ScheideDefectiveNoCross @@ -92,70 +94,6 @@ private abbrev helperContinuation1024Conditions.{u_1, u_2} : Prop := (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) f2 = some (↑d : Fin k) ∧ u2 ≠ D.u0 d ∧ u2 ≠ R.u1 -private theorem helper_tashkinov_adjoin_589.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi - T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (_ : - ScheideDefectiveReturnData G k e0 phi T C D d) (rho : PartialEdgeColoring E k) (S U : - TreeSequence G e0) (f : E), TreeSequenceAdjoinEdge S f U → TashkinovTree G e0 rho S → - ∀ (c : Fin k), rho f = some c → - ∀ v ∈ TreeSequenceVertexSet S, c ∈ MissingColors G rho v → TashkinovTree G e0 rho U := by - classical - intro V E _ _ _ _ G k e0 phi T C D d R rho S U f hadjoin hS c hf v hv hmiss - rcases hadjoin with ⟨hlen, hinitial, hlast⟩ - rcases hinitial with ⟨hle, hvert, hedge⟩ - intro q hq - by_cases hold : q.val < S.length - · let qS : Fin S.length := ⟨q.val, hold⟩ - obtain ⟨a, color, hcolor, hcolorMissing⟩ := - hS qS (by simpa [qS] using hq) - let aU : Fin (q.val + 1) := ⟨a.val, by simpa [qS] using a.isLt⟩ - refine ⟨aU, color, ?_, ?_⟩ - · have hqeq : Fin.castLE hle qS = q := by - apply Fin.ext - rfl - have hUedge : U.edge q = S.edge qS := by - rw [← hqeq] - exact hedge qS - rw [hUedge] - exact hcolor - · let oldVertexIndex : Fin (S.length + 1) := - Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ qS.isLt)) - let newVertexIndex : Fin (U.length + 1) := - Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) - have hindex : Fin.castLE (Nat.succ_le_succ hle) oldVertexIndex = - newVertexIndex := by - apply Fin.ext - rfl - have hvertex : U.vertex newVertexIndex = S.vertex oldVertexIndex := by - rw [← hindex] - exact hvert oldVertexIndex - simpa [oldVertexIndex, newVertexIndex] using - hvertex.symm ▸ hcolorMissing - · have hqval : q.val = S.length := by - have hqbound : q.val < S.length + 1 := by simpa [hlen] using q.isLt - omega - obtain ⟨a, ha⟩ : ∃ a : Fin (S.length + 1), S.vertex a = v := by - simpa [TreeSequenceVertexSet] using hv - let aU : Fin (q.val + 1) := ⟨a.val, by simpa [hqval] using a.isLt⟩ - refine ⟨aU, c, ?_, ?_⟩ - · have hqlast : q = Fin.cast hlen.symm (Fin.last S.length) := by - apply Fin.ext - simpa using hqval - rw [hqlast, hlast] - exact hf - · let newVertexIndex : Fin (U.length + 1) := - Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) - have hindex : Fin.castLE (Nat.succ_le_succ hle) a = - newVertexIndex := by - apply Fin.ext - rfl - have hvertex : U.vertex newVertexIndex = v := by - rw [← hindex, hvert a, ha] - simpa [newVertexIndex, hvertex] using hmiss - private theorem helper_adjoin_vertex_set_647.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) (e0 : E) (A0 A1 : @@ -872,7 +810,8 @@ private theorem helper_continuation_1024.{u_1, u_2} : exact (Finset.mem_sdiff.mp hz2Z).2 (Finset.mem_union.mpr (Or.inl hz2Ui)) · simp [Incident, hf2ends] - have tashkinov_adjoin := @helper_tashkinov_adjoin_589 V E inferInstance inferInstance + have tashkinov_adjoin := @SharedFacts.ScheideDefectiveThirdBoundaryEdge.tashkinov_adjoin V E + inferInstance inferInstance inferInstance inferInstance G k e0 phi T C D d R have adjoin_vertex_set (A0 A1 : TreeSequence G e0) (f : E) (x y : V) (hxy : G.ends f = s(x, y)) (hxA : x ∈ TreeSequenceVertexSet A0) diff --git a/LeanPool/GoldbergSeymour/ScheideDeletedMissingReplacementInternal.lean b/LeanPool/GoldbergSeymour/ScheideDeletedMissingReplacementInternal.lean index e0223f70d3..b524ee78c0 100644 --- a/LeanPool/GoldbergSeymour/ScheideDeletedMissingReplacementInternal.lean +++ b/LeanPool/GoldbergSeymour/ScheideDeletedMissingReplacementInternal.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDeletedMissingReplacementInternal + public import LeanPool.GoldbergSeymour.ClosedSetTwoColorComponentAvoidance public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal @@ -394,33 +396,6 @@ private theorem helper_hAlphaDelta_507.{u_1, u_2} : simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] exact ⟨fDeltaPair, hfDeltaUg1, by simpa [h] using hfDeltaPairColor⟩ -private theorem helper_hPhiDAlpha0_550.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi - T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), - let gamma : Fin k := C.gamma (D.gammaIndex d); - let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl - (D.v0 d)); gamma ≠ (↑d : Fin k) → D.alpha0 ≠ gamma → D.alpha0 ≠ (↑d : Fin k) → - ∀ (f : E), phiD f = some D.alpha0 ↔ phi f = some D.alpha0 := by - classical - intro V E _ _ _ G k e0 phi T C D d gamma phiD hGammaDelta hAlpha0Gamma hAlpha0Delta f - simp only [phiD, TwoColorComponentSwap] - by_cases hf : Sum.inr f ∈ - TwoColorComponent G phi gamma d.1 (Sum.inl (D.v0 d)) - · by_cases hfg : phi f = some gamma - · simp only [hf, ite_eq_left, hfg, Option.some.injEq] - constructor - · intro h - exact False.elim (hAlpha0Delta h.symm) - · intro h - exact False.elim (hAlpha0Gamma h.symm) - · by_cases hfd : phi f = some d.1 - · simp [hf, hfd, hGammaDelta.symm, hAlpha0Gamma.symm, hAlpha0Delta.symm] - · simp [hf, hfg, hfd] - · simp [hf] - private theorem helper_hPhiDAlpha_567.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : @@ -752,7 +727,8 @@ private theorem helper_continuation_705.{u_1, u_2} : simpa [y0, h] using D.alpha0_missing_at_y0 have hPhiDAlpha0 : ∀ f : E, phiD f = some D.alpha0 ↔ phi f = some D.alpha0 := by - exact @helper_hPhiDAlpha0_550 V E inferInstance inferInstance inferInstance G k e0 phi T C D + exact @SharedFacts.ScheideDeletedMissingReplacementInternal.phiDAlpha0 V E inferInstance + inferInstance inferInstance G k e0 phi T C D d hGammaDelta hAlpha0Gamma hAlpha0Delta have hPhiDAlpha : ∀ f : E, phiD f = some alpha ↔ phi f = some alpha := by diff --git a/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean b/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean index ca7c77d531..9ab87578a1 100644 --- a/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean +++ b/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideHeightFiveGammaEdges + public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumOrder public import LeanPool.GoldbergSeymour.ScheideGraphHeight public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound @@ -900,32 +902,6 @@ private theorem helper_gamma_present_127.{u_1, u_2} : exact (Finset.disjoint_left.mp hd) hxmiss hgamma0 simpa [MissingColors] using hnot -private theorem helper_hqends_222.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), - let y0 : V := T.vertex (⟨(0 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y4 : V := T.vertex (⟨(4 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let q : E := N.closingEdge; G.ends q = s(y4, y0) := by - classical - intro V E _ _ _ G k e0 phi T N hNheight y0 y4 q - have hlast : N.lastIndex = ⟨4, by have := N.height_upper; omega⟩ := by - apply Fin.ext - have := N.lastIndex_height - simp - rw [hNheight] at this - omega - simpa [q, y0, y4, hlast] using N.closing_ends - private theorem helper_missing_excludes_231.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) @@ -1127,42 +1103,6 @@ private theorem helper_ha3q_313.{u_1, u_2} : · rw [hqends] simp -private theorem helper_ha3qne_319.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), - let y0 : V := T.vertex (⟨(0 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y3 : V := T.vertex (⟨(3 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y4 : V := T.vertex (⟨(4 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let r3 : Fin T.length := (⟨(3 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(3 : ℕ) < T.length) ↦ - by omega - ⟩ : Fin T.length); - let a3 : E := T.edge r3; - let q : E := N.closingEdge; y0 ≠ y3 → y3 ≠ y4 → G.ends a3 = s(y3, y4) → G.ends q = s(y4, y0) → - a3 ≠ q := by - classical - intro V E _ _ _ G k e0 phi T N hNheight y0 y3 y4 r3 a3 q hy03 hy34 ha3ends hqends h - have hpairs : s(y3, y4) = s(y4, y0) := by - rw [← ha3ends, h, hqends] - rcases Sym2.eq_iff.mp hpairs with hd | hs - · exact hy34 hd.1 - · exact hy03 hs.1.symm - private theorem helper_halpha_beta_330.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -1236,47 +1176,6 @@ private theorem helper_hqa1_406.{u_1, u_2} : · exact hy14 hd.1.symm · exact hy24 hs.1.symm -private theorem helper_hqa2_413.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), - let y0 : V := T.vertex (⟨(0 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y2 : V := T.vertex (⟨(2 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y3 : V := T.vertex (⟨(3 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y4 : V := T.vertex (⟨(4 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let r2 : Fin T.length := (⟨(2 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(2 : ℕ) < T.length) ↦ - by omega - ⟩ : Fin T.length); - let a2 : E := T.edge r2; - let q : E := N.closingEdge; y2 ≠ y4 → y3 ≠ y4 → G.ends a2 = s(y2, y3) → G.ends q = s(y4, y0) → - q ≠ a2 := by - classical - intro V E _ _ _ G k e0 phi T N hNheight y0 y2 y3 y4 r2 a2 q hy24 hy34 ha2ends hqends h - have hpairs : s(y4, y0) = s(y2, y3) := by - rw [← hqends, h, ha2ends] - rcases Sym2.eq_iff.mp hpairs with hd | hs - · exact hy24 hd.1.symm - · exact hy34 hs.1.symm - private theorem helper_hgamma_alpha_425.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -2890,7 +2789,8 @@ private theorem helper_caseContinuation_3777.{u_1, u_2} : edge_step_C1 hy1C1 hbinc (Or.inl hbcolor) have hqa1 := @helper_hqa1_406 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hy14) (@hy24) (@ha1ends) (@hqends) - have hqa2 := @helper_hqa2_413 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + have hqa2 := @SharedFacts.ScheideHeightFiveGammaEdges.hqa2 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hy24) (@hy34) (@ha2ends) (@hqends) have hqa3 : q ≠ a3 := ha3qne.symm have ha13ne : a1 ≠ a3 := by @@ -3019,7 +2919,8 @@ private theorem helper_caseContinuation_4022.{u_1, u_2} : · exact False.elim ((hproper ha23ne ha2a3 ha2color) h) have ha3q := @helper_ha3q_313 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@ha3ends) (@hqends) - have ha3qne := @helper_ha3qne_319 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + have ha3qne := @SharedFacts.ScheideHeightFiveGammaEdges.ha3qne (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hy03) (@hy34) (@ha3ends) (@hqends) have hqcolor : phi q = some N.beta := by rcases edge_color_of_closing_support q hqsupport with h | h @@ -3264,7 +3165,8 @@ theorem ScheideHeightFiveGammaEdges {V E : Type*} have ha3ends : G.ends a3 = s(y3, y4) := by simpa [a3, r3, y3, y4, hNheight] using N.trunk_edge_ends r3 (by simp [r3]) (by simp [r3, hNheight]) - have hqends := @helper_hqends_222 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + have hqends := @SharedFacts.ScheideHeightFiveGammaEdges.hqends (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) have hproper : IsProperEdgeColoring G phi := N.global.1.2.2.2.1 have missing_excludes := @helper_missing_excludes_231 (@V) (@E) inferInstance inferInstance (@G) diff --git a/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean b/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean index a99b696a88..ec9adf93de 100644 --- a/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean +++ b/LeanPool/GoldbergSeymour/ScheideHeightFiveOutsideLinks.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideHeightFiveGammaEdges + public import LeanPool.GoldbergSeymour.ScheideGraphHeight public import LeanPool.GoldbergSeymour.ScheideKempePathHeightBound public import LeanPool.GoldbergSeymour.TashkinovOrderBound @@ -266,32 +268,6 @@ private abbrev helperContinuation2127Conditions.{u_1, u_2} : Prop := ∃ (alphaEdge : E) (betaEdge : E), G.ends alphaEdge = s(v1, v2) ∧ phi alphaEdge = some N.alpha ∧ G.ends betaEdge = s(v1, v2) ∧ phi betaEdge = some N.beta ∧ alphaEdge ≠ betaEdge -private theorem helper_hqends_137.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), - let y0 : V := T.vertex (⟨(0 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y4 : V := T.vertex (⟨(4 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let q : E := N.closingEdge; G.ends q = s(y4, y0) := by - classical - intro V E _ _ _ G k e0 phi T N hNheight y0 y4 q - have hlast : N.lastIndex = ⟨4, by have := N.height_upper; omega⟩ := by - apply Fin.ext - have := N.lastIndex_height - simp - rw [hNheight] at this - omega - simpa [q, y0, y4, hlast] using N.closing_ends - private theorem helper_missing_excludes_146.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) @@ -493,42 +469,6 @@ private theorem helper_ha3q_226.{u_1, u_2} : · rw [hqends] simp [Sym2.mem_iff] -private theorem helper_ha3qne_232.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), - let y0 : V := T.vertex (⟨(0 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y3 : V := T.vertex (⟨(3 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y4 : V := T.vertex (⟨(4 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let r3 : Fin T.length := (⟨(3 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(3 : ℕ) < T.length) ↦ - by omega - ⟩ : Fin T.length); - let a3 : E := T.edge r3; - let q : E := N.closingEdge; y0 ≠ y3 → y3 ≠ y4 → G.ends a3 = s(y3, y4) → G.ends q = s(y4, y0) → - a3 ≠ q := by - classical - intro V E _ _ _ G k e0 phi T N hNheight y0 y3 y4 r3 a3 q hy03 hy34 ha3ends hqends h - have hpairs : s(y3, y4) = s(y4, y0) := by - rw [← ha3ends, h, hqends] - rcases Sym2.eq_iff.mp hpairs with hd | hs - · exact hy34 hd.1 - · exact hy03 hs.1.symm - private theorem helper_hgamma_beta_243.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -954,47 +894,6 @@ private theorem helper_hfixed_509.{u_1, u_2} : Finset.eq_of_subset_of_card_le hsub hcard exact heq.symm.subset -private theorem helper_hqa2_588.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), - let y0 : V := T.vertex (⟨(0 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y2 : V := T.vertex (⟨(2 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y3 : V := T.vertex (⟨(3 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y4 : V := T.vertex (⟨(4 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ - by omega - ⟩ : Fin (T.length + (1 : ℕ))); - let r2 : Fin T.length := (⟨(2 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(2 : ℕ) < T.length) ↦ - by omega - ⟩ : Fin T.length); - let a2 : E := T.edge r2; - let q : E := N.closingEdge; y2 ≠ y4 → y3 ≠ y4 → G.ends a2 = s(y2, y3) → G.ends q = s(y4, y0) → - q ≠ a2 := by - classical - intro V E _ _ _ G k e0 phi T N hNheight y0 y2 y3 y4 r2 a2 q hy24 hy34 ha2ends hqends h - have hpairs : s(y4, y0) = s(y2, y3) := by - rw [← hqends, h, ha2ends] - rcases Sym2.eq_iff.mp hpairs with hd | hs - · exact hy24 hd.1.symm - · exact hy34 hs.1.symm - private theorem helper_hK0sub_601.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -2008,7 +1907,8 @@ private theorem helper_continuation_2127.{u_1, u_2} : have hc : some N.beta = some N.alpha := by rw [← hqcolor, h, ha3color] exact hab (Option.some.inj hc).symm have hqa2 : q ≠ a2 := by - exact @helper_hqa2_588 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + exact @SharedFacts.ScheideHeightFiveGammaEdges.hqa2 (@V) (@E) inferInstance inferInstance + inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hy24) (@hy34) (@ha2ends) (@hqends) let K0 : Finset (Sum V E) := {Sum.inl y0, Sum.inl y1, Sum.inl y2, Sum.inl y3, Sum.inl y4, @@ -2396,7 +2296,8 @@ theorem ScheideHeightFiveOutsideLinks {V E : Type*} simpa [a3, r3, y3, y4, hNheight] using N.trunk_edge_ends r3 (by simp [r3]) (by simp [r3, hNheight]) have hqends : G.ends q = s(y4, y0) := by - exact @helper_hqends_137 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + exact @SharedFacts.ScheideHeightFiveGammaEdges.hqends (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) have hproper : IsProperEdgeColoring G phi := N.global.1.2.2.2.1 have missing_excludes {c : Fin k} {v : V} {f : E} @@ -2448,7 +2349,8 @@ theorem ScheideHeightFiveOutsideLinks {V E : Type*} exact @helper_ha3q_226 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@ha3ends) (@hqends) have ha3qne : a3 ≠ q := by - exact @helper_ha3qne_232 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + exact @SharedFacts.ScheideHeightFiveGammaEdges.ha3qne (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hy03) (@hy34) (@ha3ends) (@hqends) have hqcolor : phi q = some N.beta := by rcases edge_color_of_closing_support q hqsupport with h | h diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean index 58c286cfa5..c599df6cc3 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementBoundaryAtMostThree.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup public import LeanPool.GoldbergSeymour.ScheideDefectiveSwitchEffect public import LeanPool.GoldbergSeymour.ScheideReplacementBoundaryParity @@ -66,20 +67,6 @@ private theorem helper_hdeltaNotMissing_146.{u_1, u_2} : omega) exact hclosed (Finset.mem_filter.mp hb).1 hv (Finset.mem_filter.mp hb).2 hm -private theorem helper_tree_edge_incident_157.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] - (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) (q : Fin T.length), - TreeIncidentEdge T (T.edge q) := by - classical - intro V E _ _ G e0 T q - let _ := Fintype.ofFinite V - let _ := Fintype.ofFinite E - obtain ⟨a, ha⟩ := T.attaches q - refine ⟨T.vertex q.succ, ?_, ?_⟩ - · simp [TreeSequenceVertexSet] - · simp [Incident, ha] - private theorem helper_edge_color_D_163.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : @@ -673,7 +660,7 @@ theorem ScheideReplacementBoundaryAtMostThree {V E : Type*} have hdeltaNotMissing : ∀ v, v ∈ X → d.1 ∉ MissingColors G phi v := by apply helper_hdeltaNotMissing_146 <;> assumption have tree_edge_incident : ∀ q : Fin T.length, TreeIncidentEdge T (T.edge q) := by - apply helper_tree_edge_incident_157 + apply SharedFacts.ScheideDefectiveNoCross.tree_edge_incident have edge_color_D (q : Fin T.length) (c : Fin k) (hc : phi (T.edge q) = some c) : phiD (T.edge q) = some c := by apply helper_edge_color_D_163 <;> assumption diff --git a/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean b/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean index b11a8e8969..b96c76c3b6 100644 --- a/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean +++ b/LeanPool/GoldbergSeymour/ScheideReplacementMissingDeletedInternal.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDeletedMissingReplacementInternal + public import LeanPool.GoldbergSeymour.ClosedSetTwoColorComponentAvoidance public import LeanPool.GoldbergSeymour.ScheideSymmetricDefectiveInternal @@ -334,33 +336,6 @@ private theorem helper_hAlphaGamma_439.{u_1, u_2} : simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] exact ⟨fGamma, hfGammaU2, by simpa [gamma, h] using hfGammaColor⟩ -private theorem helper_hPhiDAlpha0_483.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi - T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), - let gamma : Fin k := C.gamma (D.gammaIndex d); - let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl - (D.v0 d)); gamma ≠ (↑d : Fin k) → D.alpha0 ≠ gamma → D.alpha0 ≠ (↑d : Fin k) → - ∀ (f : E), phiD f = some D.alpha0 ↔ phi f = some D.alpha0 := by - classical - intro V E _ _ _ G k e0 phi T C D d gamma phiD hGammaDelta hAlpha0Gamma hAlpha0Delta f - simp only [phiD, TwoColorComponentSwap] - by_cases hf : Sum.inr f ∈ - TwoColorComponent G phi gamma d.1 (Sum.inl (D.v0 d)) - · by_cases hfg : phi f = some gamma - · simp only [hf, ite_eq_left, hfg, Option.some.injEq] - constructor - · intro h - exact False.elim (hAlpha0Delta h.symm) - · intro h - exact False.elim (hAlpha0Gamma h.symm) - · by_cases hfd : phi f = some d.1 - · simp [hf, hfd, hGammaDelta.symm, hAlpha0Gamma.symm, hAlpha0Delta.symm] - · simp [hf, hfg, hfd] - · simp [hf] - private theorem helper_hPhiDAlpha_500.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : @@ -736,7 +711,8 @@ private theorem helper_continuation_675.{u_1, u_2} : simpa [y0, h] using D.alpha0_missing_at_y0 have hPhiDAlpha0 : ∀ f : E, phiD f = some D.alpha0 ↔ phi f = some D.alpha0 := by - exact @helper_hPhiDAlpha0_483 V E inferInstance inferInstance inferInstance G k e0 phi T C D + exact @SharedFacts.ScheideDeletedMissingReplacementInternal.phiDAlpha0 V E inferInstance + inferInstance inferInstance G k e0 phi T C D d hGammaDelta hAlpha0Gamma hAlpha0Delta have hPhiDAlpha : ∀ f : E, phiD f = some alpha ↔ phi f = some alpha := by diff --git a/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean b/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean index bfe32afdd2..2637fbcbe1 100644 --- a/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean +++ b/LeanPool/GoldbergSeymour/ScheideSelectedBlockDeletion.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ScheideSelectedBlockDeletion + public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration /-! @@ -162,149 +164,6 @@ private theorem helper_hatt_115.{u_1, u_2} : rw [hrb, C.base_vertex_position] exact hb.trans Sym2.eq_swap -private theorem helper_edge_class_global_229.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) - (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (hi : (↑i : ℕ) < C.s) - (hp : (2 : ℕ) ≤ C.p) (hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) - (hn : (3 : ℕ) ≤ T.length), - let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); - let d : ℕ := C.p - (1 : ℕ) + (2 : ℕ) * (↑i : ℕ); - let rV : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := - fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => - if h : (↑q : ℕ) < m then - (⟨(↑q : ℕ), - Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by - omega⟩ : - Fin (T.length + (1 : ℕ))) - else - (⟨(↑q : ℕ) + (2 : ℕ), - Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) => - by omega⟩ : - Fin (T.length + (1 : ℕ))); - let rE : Fin (T.length - (2 : ℕ)) → Fin T.length := - fun (q : Fin (T.length - (2 : ℕ))) => - if _ : (↑q : ℕ) < d then - (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega⟩ : - Fin T.length) - else - (⟨(↑q : ℕ) + (2 : ℕ), - Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) => by - omega⟩ : - Fin T.length); - (∀ (q : Fin (T.length - (2 : ℕ))), - (↑(rE q) : ℕ) = if (↑q : ℕ) < d then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → - m + (1 : ℕ) ≤ T.length → - d + (1 : ℕ) < T.length → - ∀ - (hfirst : - rE - (⟨(0 : ℕ), - Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by - omega⟩ : - Fin (T.length - (2 : ℕ))) = - (⟨(0 : ℕ), T.positive⟩ : Fin T.length)), - let nv : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → V := - fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => T.vertex (rV q); - let ne : Fin (T.length - (2 : ℕ)) → E := fun (q : Fin (T.length - (2 : ℕ))) => - T.edge (rE q); - ∀ (nv_inj : Function.Injective nv) (ne_inj : Function.Injective ne) - (hatt : - ∀ (q : Fin (T.length - (2 : ℕ))), - ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), - G.ends (ne q) = - s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), - let S : TreeSequence G e0 := - { length := T.length - (2 : ℕ), - positive := - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => by omega, - vertex := nv, edge := ne, vertex_injective := nv_inj, edge_injective := ne_inj, - first_edge := - have he : - rE - (⟨(0 : ℕ), - Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by - omega⟩ : - Fin (T.length - (2 : ℕ))) = - (⟨(0 : ℕ), T.positive⟩ : Fin T.length) := - hfirst; - id - (Eq.mpr (id (congrArg (fun (_a : Fin T.length) => T.edge _a = e0) he)) - T.first_edge), - attaches := hatt : TreeSequence G e0 }; - ∀ (q : Fin (T.length - (2 : ℕ))), - (∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ S.edge q = C.baseEdge a) ∨ - ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), - r ≠ i ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ S.edge q = C.blockEdge r j := by - classical - intro V E _ _ _ G k e0 phi T C i hi hp hl hn m d rV rE rE_val hm hd hfirst nv ne nv_inj ne_inj - hatt S q - by_cases hq : q.val < d - · by_cases hb : q.val < C.p - 1 - · left - refine ⟨⟨q.val, hb⟩, rfl, ?_⟩ - have he : rE q = ⟨q.val, by omega⟩ := by - apply Fin.ext - rw [rE_val] - simp [hq] - change T.edge (rE q) = C.baseEdge ⟨q.val, hb⟩ - rw [he] - exact C.base_edge_position ⟨q.val, hb⟩ - · right - let x := q.val - (C.p - 1) - let rr := x / 2 - let jj := x % 2 - have hx : q.val = C.p - 1 + x := by dsimp [x]; omega - have hj : jj < 2 := by dsimp [jj]; omega - have hr : rr < C.s := by - dsimp [rr, x] - omega - let r : Fin C.s := ⟨rr, hr⟩ - let j : Fin 2 := ⟨jj, hj⟩ - have hri : r.val < i.val := by dsimp [r, rr, x]; omega - refine ⟨r, j, ?_, ?_, ?_⟩ - · intro h - exact (Nat.ne_of_lt hri) (congrArg Fin.val h) - · omega - · have he : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by - apply Fin.ext - rw [rE_val] - simp [hq] - dsimp [r, j, rr, jj] - omega - change T.edge (rE q) = C.blockEdge r j - rw [he] - exact C.block_edge_position r j - · right - let x := q.val + 2 - (C.p - 1) - let rr := x / 2 - let jj := x % 2 - have hx : q.val + 2 = C.p - 1 + x := by dsimp [x]; omega - have hdiv : x = 2 * rr + jj := by dsimp [rr, jj]; omega - have hj : jj < 2 := by dsimp [jj]; omega - have hr : rr < C.s := by - dsimp [rr, x] - omega - let r : Fin C.s := ⟨rr, hr⟩ - let j : Fin 2 := ⟨jj, hj⟩ - have hri : i.val < r.val := by - dsimp [r, rr, x] - omega - refine ⟨r, j, ?_, ?_, ?_⟩ - · intro heq - exact (Nat.ne_of_gt hri) (congrArg Fin.val heq) - · omega - · have he : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by - apply Fin.ext - rw [rE_val] - simp only [ite_eq_right hq] - dsimp [r, j, rr, jj] - omega - change T.edge (rE q) = C.blockEdge r j - rw [he, C.block_edge_position] - private theorem helper_branch_298.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -558,149 +417,6 @@ private theorem helper_branch_381.{u_1, u_2} : omega rw [he, C.block_edge_position] -private theorem helper_edge_class_455.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) - (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (hi : (↑i : ℕ) < C.s) - (hp : (2 : ℕ) ≤ C.p) (hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) - (hn : (3 : ℕ) ≤ T.length), - let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); - let d : ℕ := C.p - (1 : ℕ) + (2 : ℕ) * (↑i : ℕ); - let rV : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := - fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => - if h : (↑q : ℕ) < m then - (⟨(↑q : ℕ), - Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by - omega⟩ : - Fin (T.length + (1 : ℕ))) - else - (⟨(↑q : ℕ) + (2 : ℕ), - Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) => - by omega⟩ : - Fin (T.length + (1 : ℕ))); - let rE : Fin (T.length - (2 : ℕ)) → Fin T.length := - fun (q : Fin (T.length - (2 : ℕ))) => - if _ : (↑q : ℕ) < d then - (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega⟩ : - Fin T.length) - else - (⟨(↑q : ℕ) + (2 : ℕ), - Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) => by - omega⟩ : - Fin T.length); - (∀ (q : Fin (T.length - (2 : ℕ))), - (↑(rE q) : ℕ) = if (↑q : ℕ) < d then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → - m + (1 : ℕ) ≤ T.length → - d + (1 : ℕ) < T.length → - ∀ - (hfirst : - rE - (⟨(0 : ℕ), - Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by - omega⟩ : - Fin (T.length - (2 : ℕ))) = - (⟨(0 : ℕ), T.positive⟩ : Fin T.length)), - let nv : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → V := - fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => T.vertex (rV q); - let ne : Fin (T.length - (2 : ℕ)) → E := fun (q : Fin (T.length - (2 : ℕ))) => - T.edge (rE q); - ∀ (nv_inj : Function.Injective nv) (ne_inj : Function.Injective ne) - (hatt : - ∀ (q : Fin (T.length - (2 : ℕ))), - ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), - G.ends (ne q) = - s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), - let S : TreeSequence G e0 := - { length := T.length - (2 : ℕ), - positive := - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => by omega, - vertex := nv, edge := ne, vertex_injective := nv_inj, edge_injective := ne_inj, - first_edge := - have he : - rE - (⟨(0 : ℕ), - Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by - omega⟩ : - Fin (T.length - (2 : ℕ))) = - (⟨(0 : ℕ), T.positive⟩ : Fin T.length) := - hfirst; - id - (Eq.mpr (id (congrArg (fun (_a : Fin T.length) => T.edge _a = e0) he)) - T.first_edge), - attaches := hatt : TreeSequence G e0 }; - ∀ (q : Fin (T.length - (2 : ℕ))), - (∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ S.edge q = C.baseEdge a) ∨ - ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), - r ≠ i ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ S.edge q = C.blockEdge r j := by - classical - intro V E _ _ _ G k e0 phi T C i hi hp hl hn m d rV rE rE_val hm hd hfirst nv ne nv_inj ne_inj - hatt S q - by_cases hq : q.val < d - · by_cases hb : q.val < C.p - 1 - · left - refine ⟨⟨q.val, hb⟩, rfl, ?_⟩ - have he : rE q = ⟨q.val, by omega⟩ := by - apply Fin.ext - rw [rE_val] - simp [hq] - change T.edge (rE q) = C.baseEdge ⟨q.val, hb⟩ - rw [he] - exact C.base_edge_position ⟨q.val, hb⟩ - · right - let x := q.val - (C.p - 1) - let rr := x / 2 - let jj := x % 2 - have hx : q.val = C.p - 1 + x := by dsimp [x]; omega - have hj : jj < 2 := by dsimp [jj]; omega - have hr : rr < C.s := by - dsimp [rr, x] - omega - let r : Fin C.s := ⟨rr, hr⟩ - let j : Fin 2 := ⟨jj, hj⟩ - have hri : r.val < i.val := by dsimp [r, rr, x]; omega - refine ⟨r, j, ?_, ?_, ?_⟩ - · intro h - exact (Nat.ne_of_lt hri) (congrArg Fin.val h) - · omega - · have he : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by - apply Fin.ext - rw [rE_val] - simp [hq] - dsimp [r, j, rr, jj] - omega - change T.edge (rE q) = C.blockEdge r j - rw [he] - exact C.block_edge_position r j - · right - let x := q.val + 2 - (C.p - 1) - let rr := x / 2 - let jj := x % 2 - have hx : q.val + 2 = C.p - 1 + x := by dsimp [x]; omega - have hdiv : x = 2 * rr + jj := by dsimp [rr, jj]; omega - have hj : jj < 2 := by dsimp [jj]; omega - have hr : rr < C.s := by - dsimp [rr, x] - omega - let r : Fin C.s := ⟨rr, hr⟩ - let j : Fin 2 := ⟨jj, hj⟩ - have hri : i.val < r.val := by - dsimp [r, rr, x] - omega - refine ⟨r, j, ?_, ?_, ?_⟩ - · intro heq - exact (Nat.ne_of_gt hri) (congrArg Fin.val heq) - · omega - · have he : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by - apply Fin.ext - rw [rE_val] - simp only [ite_eq_right hq] - dsimp [r, j, rr, jj] - omega - change T.edge (rE q) = C.blockEdge r j - rw [he, C.block_edge_position] - private theorem helper_branch_529.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -996,7 +712,8 @@ theorem ScheideSelectedBlockDeletion {V E : Type*} attaches := hatt } refine ⟨S, ?_⟩ dsimp [S] - have edge_class_global := @helper_edge_class_global_229 V E inferInstance inferInstance + have edge_class_global := @SharedFacts.ScheideSelectedBlockDeletion.edge_class_global V E + inferInstance inferInstance inferInstance G k e0 phi T C i hi hp hl hn rE_val hm hd hfirst nv_inj ne_inj hatt refine ⟨?_, by omega, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ · exact @helper_branch_298 V E inferInstance inferInstance inferInstance inferInstance G k e0 @@ -1031,7 +748,8 @@ theorem ScheideSelectedBlockDeletion {V E : Type*} rw [hr, C.base_edge_position] · exact @helper_branch_381 V E inferInstance inferInstance inferInstance G k e0 phi T C i hi hp hl hn rV_val rE_val hm hd - · have edge_class := @helper_edge_class_455 V E inferInstance inferInstance inferInstance G k e0 + · have edge_class := @SharedFacts.ScheideSelectedBlockDeletion.edge_class_global V E + inferInstance inferInstance inferInstance G k e0 phi T C i hi hp hl hn rE_val hm hd hfirst nv_inj ne_inj hatt intro q diff --git a/LeanPool/GoldbergSeymour/SharedFacts/BaseControl.lean b/LeanPool/GoldbergSeymour/SharedFacts/BaseControl.lean new file mode 100644 index 0000000000..6ae4c5904a --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/BaseControl.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase + +/-! +# Shared facts for BaseControl + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.BaseControl + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev transStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W + Z → TreeSequenceInitialSegment U Z + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev stageChainStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; ( + ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z + → TreeSequenceInitialSegment U Z) → + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ + j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : + ℕ)))) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev branchStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ∀ {u : V}, ett.rounds = (1 : ℕ) → u ∈ TreeSequenceVertexSet Tn → + ∀ {v : V}, v ∈ TreeSequenceVertexSet Tn → u ≠ v → Disjoint (MissingColors G + (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; Decidable.byContradiction fun (a : ¬ett.rounds + - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds).castSucc) u) (MissingColors G (ett.series.data.coloring (⟨ett.rounds - (1 + : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; Decidable.byContradiction fun (a : ¬ett.rounds + - (1 : ℕ) < ett.rounds) ↦ + by + omega + ⟩ : Fin ett.rounds).castSucc) v) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem trans.{u_1, u_2} : transStatement.{u_1, u_2} := by + classical + intro V E G e0 U W Z hUW hWZ + refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ + · intro j + exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) j)).trans + (hUW.2.1 j) + · intro j + exact (hWZ.2.2 (Fin.castLE hUW.1 j)).trans (hUW.2.2 j) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem stageChain.{u_1, u_2} : stageChainStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H trans j + induction j with + | zero => + intro hj i hi + have hi0 : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have heq' : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) + (H.nested ⟨j, by omega⟩) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem branch.{u_1, u_2} : branchStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C n Tn _ hn + have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = + 0 := + Fin.ext (by simp [hn]) + have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn]) + dsimp only [Tn] + rw [hcolor, htree] + exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + +end GoldbergSeymour.SharedFacts.BaseControl + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/Basic2TerminalPE.lean b/LeanPool/GoldbergSeymour/SharedFacts/Basic2TerminalPE.lean new file mode 100644 index 0000000000..a11e85038f --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/Basic2TerminalPE.lean @@ -0,0 +1,166 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Shared facts for Basic2TerminalPE + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.Basic2TerminalPE + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev appearanceInStageStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating), + let _ : DecidableEq V := Classical.decEq V; + ∀ + (_ : + (∀ (a b : ℕ) (_ : (1 : ℕ) ≤ a) (_hab : a ≤ b) (_hb : b ≤ ett.rounds), + TreeSequenceInitialSegment + (ett.series.data.tree (⟨a, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + (ett.series.data.tree (⟨b, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))))) + (v : V) (_ : v ∈ TreeSequenceVertexSet T) (_ : Fin ett.rounds) (x : V) + (hxFinal : x ∈ TreeSequenceVertexSet T) (s : ℕ) (_ : (1 : ℕ) ≤ s) + (_hsRound : s ≤ ett.rounds) (_ : ETTFirstAppearanceIndex ett x hxFinal ≤ s), + x ∈ + TreeSequenceVertexSet + (ett.series.data.tree (⟨s, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev earlierInPrefixStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating), + ∀ v ∈ TreeSequenceVertexSet T, + ∀ (_ : Fin ett.rounds) {A B : TreeSequence G e0} (x y : V), TreeSequenceInitialSegment A B → y + ∈ TreeSequenceVertexSet A → TreeVertexOrder B x y → x ∈ TreeSequenceVertexSet A ∧ + TreeVertexOrder A x y + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev boundaryEndpointStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (sigma : PartialEdgeColoring E k) (delta : Fin k), + let terminal : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), + ∀ f ∈ BoundaryColorEdges G sigma (TreeSequenceVertexSet (ett.series.data.tree + terminal.castSucc)) delta, Incident G x f → + ∃ z ∉ TreeSequenceVertexSet (ett.series.data.tree terminal.castSucc), G.ends f = s(x, z) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem appearanceInStage.{u_1, u_2} : appearanceInStageStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett this stageToStage v hvFinal q x hxFinal s + hsPositive hsRound hbound + unfold ETTFirstAppearanceIndex at hbound + dsimp at hbound + let candidates : Finset (Fin (ett.rounds + 1)) := + Finset.univ.filter fun i => + x ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett i) + have hnonempty : candidates.Nonempty := by + refine ⟨Fin.last ett.rounds, ?_⟩ + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett + (Fin.last ett.rounds) = T by + unfold ExtendedTashkinovLadderStage + exact Fin.lastCases_last] + exact hxFinal + let m := candidates.min' hnonempty + have hmBound : m.val + 1 ≤ s := by + dsimp [m, candidates] + convert hbound using 1 + have hmRounds : m.val < ett.rounds := by omega + let mi : Fin ett.rounds := ⟨m.val, hmRounds⟩ + have hmEq : m = mi.castSucc := by + apply Fin.ext + rfl + have hmem := Finset.min'_mem candidates hnonempty + change m ∈ candidates at hmem + have hxStart : x ∈ TreeSequenceVertexSet + (ett.series.data.tree ⟨m.val + 1, by omega⟩) := by + rw [hmEq] at hmem + have hstage : ExtendedTashkinovLadderStage ett mi.castSucc = + ett.series.data.tree mi.succ.castSucc := by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) T + (fun j => ett.series.data.tree j.succ.castSucc) mi + have hxMi : x ∈ TreeSequenceVertexSet + (ett.series.data.tree mi.succ.castSucc) := by + simpa only [candidates, Finset.mem_filter, Finset.mem_univ, + true_and, hstage] using hmem + convert hxMi using 1 + apply congrArg TreeSequenceVertexSet + apply congrArg ett.series.data.tree + apply Fin.ext + simp [mi] + exact TreeSequenceInitialSegmentVertexSetSubset + (stageToStage (m.val + 1) s (by omega) hmBound hsRound) hxStart + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem earlierInPrefix.{u_1, u_2} : earlierInPrefixStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett v hvFinal q A B x y hAB hyA hxy + rcases hAB with ⟨hlen, hvertices, _⟩ + rcases Finset.mem_image.mp hyA with ⟨iyA, _, hiyA⟩ + rcases hxy with ⟨ixB, iyB, hixB, hiyB, hlt⟩ + let iyCast := Fin.castLE (Nat.succ_le_succ hlen) iyA + have hiyEq : iyB = iyCast := by + apply B.vertex_injective + exact hiyB.trans ((hvertices iyA).trans hiyA).symm + have hixBound : ixB.val < A.length + 1 := by + rw [hiyEq] at hlt + simp [iyCast] at hlt + omega + let ixA : Fin (A.length + 1) := ⟨ixB.val, hixBound⟩ + have hixCast : Fin.castLE (Nat.succ_le_succ hlen) ixA = ixB := by + apply Fin.ext + rfl + have hixA : A.vertex ixA = x := by + exact (hvertices ixA).symm.trans (by simpa [hixCast] using hixB) + constructor + · apply Finset.mem_image.mpr + exact ⟨ixA, Finset.mem_univ _, hixA⟩ + · refine ⟨ixA, iyA, hixA, hiyA, ?_⟩ + rw [hiyEq] at hlt + simpa [ixA, iyCast] using hlt + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem boundaryEndpoint.{u_1, u_2} : boundaryEndpointStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett sigma delta terminal x hx f hf hxf + have hfBoundary := (Finset.mem_filter.mp hf).1 + rcases (by + simpa only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, + true_and] using hfBoundary) with ⟨u, hu, z, hz, hends⟩ + have hxEnds : x = u ∨ x = z := by + change x ∈ G.ends f at hxf + rw [hends] at hxf + simpa using hxf + rcases hxEnds with hxu | hxz + · exact ⟨z, hz, by simpa [hxu] using hends⟩ + · exact (hz (hxz ▸ hx)).elim + +end GoldbergSeymour.SharedFacts.Basic2TerminalPE + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ChangeLemmaBothOutsidePreparation1.lean b/LeanPool/GoldbergSeymour/SharedFacts/ChangeLemmaBothOutsidePreparation1.lean new file mode 100644 index 0000000000..3a10e39cc3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ChangeLemmaBothOutsidePreparation1.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyCounterexample + +/-! +# Shared facts for Preparation1 + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev initialSegmentTransitiveStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev comparableInitialSegmentsStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev missingPositionOutsidePrefixStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ _ : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + ∀ (i : Fin (T.length + (1 : ℕ))), + T.vertex i ∉ TreeSequenceVertexSet A → + A.length < (↑i : ℕ) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem initialSegmentTransitive.{u_1, u_2} : initialSegmentTransitiveStatement.{u_1, u_2} := by + classical + intro V E G e0 S U W hSU hUW + refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem comparableInitialSegments.{u_1, u_2} : comparableInitialSegmentsStatement.{u_1, u_2} := by + classical + intro V E G e0 S U W hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem missingPositionOutsidePrefix.{u_1, u_2} : missingPositionOutsidePrefixStatement.{u_1, + u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A AToT i hi + by_contra h + have hle : i.val ≤ A.length := by omega + apply hi + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ + +end GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaTransport.lean new file mode 100644 index 0000000000..0f89485970 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaTransport.lean @@ -0,0 +1,1073 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.StableChangeCasesOneTwo + +/-! +# Shared facts for HierarchySituationThreeDisjointThetaStoredImpossible + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.DisjointThetaTransport + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hthetaFirstIndexStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let ell : ℕ := HierarchyFullTailLength C; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); d.theta ∈ + MissingColors G sigma (Y.vertex (Fin.last Y.length)) → TreeSequenceInitialSegment Y T → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment Z T → + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) → ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W) + → d.theta ∈ MissingColors G sigma (T.vertex (HierarchyFirstMissingPosition sigma T + d.theta)) ∧ (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) ≤ Y.length → + (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstWitnessStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), + TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ W.length + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hthetaMissingYStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma + (Y.vertex (Fin.last Y.length)) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev sameStarStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let _ : TreeSequence G e0 := HierarchyFullTailPrefix C j; HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount) = A + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hcutJstrictStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A → TreeSequenceInitialSegment A T → j < ell → A.length + j < + T.length + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev prefixToTreeStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (T : TreeSequence G e0) (m : ℕ) (hm : (1 : ℕ) ≤ m) (hmT : m ≤ T.length), + TreeSequenceInitialSegment (TreeSequencePrefix T m hm hmT) T + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev comparableInitialSegmentsStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) + {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T + → U.length ≤ W.length → TreeSequenceInitialSegment U W + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev elemZStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = Z → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev vertexMemTStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (T W : TreeSequence G + e0), TreeSequenceInitialSegment W T → + ∀ (i : Fin (T.length + (1 : ℕ))), (↑i : ℕ) ≤ W.length → T.vertex i ∈ TreeSequenceVertexSet W + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hthetaYStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; d.theta ∈ MissingColors G sigma + (Y.vertex (Fin.last Y.length)) → ( + ∀ (W : TreeSequence G e0) (i : Fin (W.length + (1 : ℕ))), W.vertex i ∈ TreeSequenceVertexSet + W) → ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0) (v : V) (c : Fin k), v ∈ + TreeSequenceVertexSet W → c ∈ MissingColors G rho v → c ∈ TreeMissingColors rho W) → + d.theta ∈ TreeMissingColors sigma Y + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev treeMissingSubsetStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ + TreeMissingColors sigma W + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev apositiveStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; (0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev sameGammaBetaStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ gamma ∈ TreeMissingColors sigma A, ( + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition sigma T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition sigma T beta); + have sameComponent : Prop := TwoColorComponent G sigma gamma beta (Sum.inl va) = + TwoColorComponent G sigma gamma beta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors sigma Tnq ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + sigma Tn ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ ( gamma ∈ TreeMissingColors sigma A ∧ TreeColorSetClosed G sigma A + ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A sigma gamma beta)) + → gamma ∈ HierarchyStageMissingColors H q → ( (0 : ℕ) < H.dividerCount → A = H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) → TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hmu2OneStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ (gamma : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; + IsOneEdgeUncolored mu2 e0 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hfirstBetaOutsideStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + ∀ (gamma : Fin k), TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta))) → ( + ∀ (rho : PartialEdgeColoring E k) (a b : Fin k) (v : V), Sum.inl v ∈ TwoColorComponent G rho a + b (Sum.inl v)) → Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (Fin.last T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)))) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T beta)) ∉ TwoColorComponent G sigma gamma beta z + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstPreservedStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (T : TreeSequence G e0) (_ : ℕ), ( + ∀ (rho : PartialEdgeColoring E k) (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ c ∈ TreeMissingColors rho W, c ∈ MissingColors G rho (T.vertex + (HierarchyFirstMissingPosition rho T c)) ∧ (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + ≤ W.length) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev missingTransportStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (old new : PartialEdgeColoring E k), ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G new v = MissingColors G old v) → + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W Z → TreeMissingColors new W = + TreeMissingColors old W + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hstoredMu2Statement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; + ∀ gamma ∈ TreeMissingColors sigma A, gamma ≠ beta → TreeSequenceInitialSegment Z T → + ColoredVertexSetElementary G sigma (TreeSequenceVertexSet Z) → beta ∈ TreeMissingColors + sigma Z → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; ( + ∀ (W : TreeSequence G e0), TreeSequenceInitialSegment W T → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), ColoredVertexSetElementary G rho + (TreeSequenceVertexSet W) → ( + ∀ v ∈ TreeSequenceVertexSet W, MissingColors G sigma v = MissingColors G rho v) → c ∈ + TreeMissingColors rho W → HierarchyFirstMissingPosition sigma T c = + HierarchyFirstMissingPosition rho T c) → ( + ∀ (z : V ⊕ E) (rho : PartialEdgeColoring E k) (a b c : Fin k), a ≠ b → IsProperEdgeColoring G + rho → c ≠ a → c ≠ b → HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T + c = HierarchyFirstMissingPosition rho T c) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G mu2 v = MissingColors G sigma v) → + ∀ eta ∈ D, HierarchyFirstMissingPosition mu2 T eta = HierarchyFirstMissingPosition sigma T eta + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev originalStarStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (S : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyStarredStage + C.hierarchy (Fin.last C.hierarchy.dividerCount) = HierarchyStarredStage + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev lastDataStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev sameLastStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let D : Finset (Fin k) := HierarchyStoredColorsAt H q; ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma + (Fin.last C.hierarchy.dividerCount) eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta) → + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), D = + HierarchyStoredColorsAt S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ D, R.counterexample.good.gamma q eta = S.counterexample.good.gamma (Fin.last + S.counterexample.hierarchy.dividerCount) eta + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev weakEdgesStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : + ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : + TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage + K (Fin.last K.dividerCount)).edge t) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev xYlenStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; TreeSequenceInitialSegment A T → j ≤ + T.length - A.length → ( + ∀ (m : ℕ), HierarchyFullTailPrefix C m = TreeSequencePrefix T (min (A.length + m) T.length) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega + )) → Y.length = X.length + (1 : ℕ) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hweak1Statement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (gamma : Fin k), gamma ≠ beta → ColoredVertexSetElementary G sigma (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)))) → gamma ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) ∧ beta ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ))) → Disjoint (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex (Fin.last + T.length)))) (TwoColorComponent G sigma gamma beta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition sigma T gamma)))) → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + let mu2 : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma beta z; (0 : ℕ) < + H.dividerCount ∧ gamma ∈ TreeMissingColors sigma (H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ)))) ∨ H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + sigma (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) ∨ gamma ∈ TreeMissingColors sigma A ∧ + gamma ∉ TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) ∧ beta ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds)) → TwoColorPathComponent G sigma gamma beta z → + HierarchyWeaklyStable H q mu2 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev swapOneStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (T : TreeSequence G e0), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + ∀ (old : PartialEdgeColoring E k) (a b : Fin k), + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored (TwoColorComponentSwap G old a b z) e0 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hweak3Statement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let ell : ℕ := HierarchyFullTailLength C; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (gamma : Fin k), gamma ≠ d.theta → + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Z) → + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; + TwoColorPathComponent G rho gamma d.theta z → ( + let K : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := + R1.counterexample.hierarchy; (0 : ℕ) < K.dividerCount ∧ gamma ∈ TreeMissingColors rho + (K.stage (⟨K.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (K.dividerCount + (2 : ℕ)))) ∨ K.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + rho (R1.corresponding.replacementETT.series.data.tree (Fin.last + R1.corresponding.replacementETT.rounds).castSucc) ∨ gamma ∈ TreeMissingColors rho + (HierarchyStarredStage K (Fin.last K.dividerCount)) ∧ gamma ∉ TashkinovStoredColors + R1.corresponding.replacementETT.series.data (Fin.last + R1.corresponding.replacementETT.rounds) ∧ d.theta ∉ TashkinovStoredColors + R1.corresponding.replacementETT.series.data (Fin.last + R1.corresponding.replacementETT.rounds))) → Disjoint (TwoColorComponent G rho gamma + d.theta z) (TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex + (HierarchyFirstMissingPosition rho T gamma)))) → gamma ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - (1 + : ℕ))) ∧ d.theta ∈ TreeMissingColors rho (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - (1 : ℕ))) → HierarchyWeaklyStable + R1.counterexample.hierarchy (Fin.last R1.counterexample.hierarchy.dividerCount) mu3 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev yTerminalDistinctStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; A.length + j < T.length → Y.length = + A.length + j → TreeSequenceInitialSegment Y T → Y.vertex (Fin.last Y.length) ≠ T.vertex + (Fin.last T.length) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hjEligibleStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), (2 : ℕ) ≤ j → j < HierarchyFullTailLength C → + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + ∀ (gamma : Fin k), + let z : V ⊕ E := Sum.inl (T.vertex (Fin.last T.length)); + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; + let mu3 : PartialEdgeColoring E k := TwoColorComponentSwap G rho gamma d.theta z; d.theta ∈ + MissingColors G mu3 (T.vertex (Fin.last T.length)) → d.theta ∈ MissingColors G mu3 + (Y.vertex (Fin.last Y.length)) → + ∀ (R2 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), R2.coloring = mu3 + → j ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hthetaFirstIndex.{u_1, u_2} : hthetaFirstIndexStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma ell Y Z + hthetaMissingY hYtoT hYtoZ hZtoT hElemZ vertexMemT hthetaFirst + as_aux_lemma => + clear_value Y Z + apply Nat.le_antisymm hthetaFirst.2 + by_contra hne + have hlt : (HierarchyFirstMissingPosition sigma T d.theta).val < Y.length := + Nat.lt_of_not_ge hne + have iZ : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ∈ + TreeSequenceVertexSet Z := vertexMemT Z hZtoT + (HierarchyFirstMissingPosition sigma T d.theta) + (Nat.le_trans (Nat.le_of_lt hlt) hYtoZ.1) + have yZ : Y.vertex (Fin.last Y.length) ∈ TreeSequenceVertexSet Z := + TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (by simp [TreeSequenceVertexSet]) + have hvne : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ + Y.vertex (Fin.last Y.length) := by + intro heq + let jY : Fin (Y.length + 1) := + ⟨(HierarchyFirstMissingPosition sigma T d.theta).val, + Nat.lt_succ_of_le (Nat.le_of_lt hlt)⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hYtoT.1) jY = + HierarchyFirstMissingPosition sigma T d.theta := Fin.ext rfl + have heqY : Y.vertex jY = Y.vertex (Fin.last Y.length) := by + have htree := hYtoT.2.1 jY + have hcastV := congrArg T.vertex hcast + exact htree.symm.trans (hcastV.trans heq) + have hidx := Y.vertex_injective heqY + have hval := congrArg Fin.val hidx + dsimp [jY] at hval + exact (Nat.ne_of_lt hlt) hval + exact Finset.disjoint_left.mp (hElemZ iZ yZ hvne) + hthetaFirst.1 hthetaMissingY + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstWitness.{u_1, u_2} : firstWitnessStatement.{u_1, u_2} := by + classical + intro V E _ _ G k e0 T rho W hWT c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hcv⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv + rcases hv with ⟨i, rfl⟩ + let candidates := Finset.univ.filter fun a : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex a) + have hi : Fin.castLE (Nat.succ_le_succ hWT.1) i ∈ candidates := by + simp [candidates, hWT.2.1 i, hcv] + have hn : candidates.Nonempty := ⟨_, hi⟩ + have hmin := Finset.min'_le candidates _ hi + have hmiss : c ∈ MissingColors G rho (T.vertex (candidates.min' hn)) := + (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hpos : HierarchyFirstMissingPosition rho T c = candidates.min' hn := by + simp [HierarchyFirstMissingPosition, candidates, hn] + constructor + · simpa [HierarchyFirstMissingPosition, candidates, hn] using hmiss + · rw [hpos] + have hle : (candidates.min' hn).val ≤ i.val := by + change (candidates.min' hn).val ≤ (Fin.castLE (Nat.succ_le_succ hWT.1) i).val at hmin + simpa using hmin + exact le_trans hle (Nat.le_of_lt_succ i.isLt) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hthetaMissingY.{u_1, u_2} : hthetaMissingYStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R sigma Y + have ht := d.thetaMissingAtJ + change d.theta ∈ MissingColors G d.switched.coloring + ((HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy)).vertex + (Fin.last (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy)).length)) at ht + rw [hj] at ht + exact ht + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem sameStar.{u_1, u_2} : sameStarStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A X Y + as_aux_lemma => + clear * - G e0 base C R H q A + have helper : + ∀ (n m : ℕ) (X Y : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → + TreeSequence G e0), n = m → X = Y → HEq s t → Fin.cases (motive := fun _ => TreeSequence G + e0) X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => + TreeSequence G e0) Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by + intro n m X Y s t hnm hXY hst + subst m + have hs : s = t := eq_of_heq hst + simp [hXY, hs] + simpa [A, q, HierarchyStarredStage] using (helper _ _ base.core R.replacementBase.core + C.hierarchy.stage + H.stage R.sameGood.1.2.1 R.sameGood.1.1 + R.sameGood.1.2.2.1) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hcutJstrict.{u_1, u_2} : hcutJstrictStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj R H q A ell sameStar + hAtoT hjUpper + have hj : j < T.length - A.length := by + simpa only [ell, HierarchyFullTailLength, sameStar] using hjUpper + have hAT := hAtoT.1 + clear * - hj hAT + clear_value A + omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem prefixToTree.{u_1, u_2} : prefixToTreeStatement.{u_1, u_2} := by + classical + intro V E G e0 T m hm hmT + as_aux_lemma => + refine ⟨hmT, ?_, ?_⟩ + · intro i + simp [TreeSequencePrefix] + · intro i + simp [TreeSequencePrefix] + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem comparableInitialSegments.{u_1, u_2} : comparableInitialSegmentsStatement.{u_1, u_2} := by + classical + intro V E G e0 T U W hUT hWT hUW + as_aux_lemma => + rcases hUT with ⟨hu, huv, hue⟩ + rcases hWT with ⟨hw, hwv, hwe⟩ + refine ⟨hUW, ?_, ?_⟩ + · intro i + calc + W.vertex (Fin.castLE (Nat.succ_le_succ hUW) i) = + T.vertex (Fin.castLE (Nat.succ_le_succ hw) + (Fin.castLE (Nat.succ_le_succ hUW) i)) := (hwv _).symm + _ = T.vertex (Fin.castLE (Nat.succ_le_succ hu) i) := by congr 1 + _ = U.vertex i := huv i + · intro i + calc + W.edge (Fin.castLE hUW i) = T.edge (Fin.castLE hw (Fin.castLE hUW i)) := + (hwe _).symm + _ = T.edge (Fin.castLE hu i) := by congr 1 + _ = U.edge i := hue i + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem elemZ.{u_1, u_2} : elemZStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma ell Z + penultimatePrefixEq + as_aux_lemma => + have hp : ColoredVertexSetElementary G sigma + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := + HierarchyCounterexamplePenultimateElementary G k e0 + R.corresponding.replacementInput T sigma R.corresponding.replacementETT + R.replacementBase R.counterexample R.minimumContext.proper + R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + R.minimumContext.largeMissingSet + intro u hu v hv huv + apply hp + · rw [penultimatePrefixEq]; exact hu + · rw [penultimatePrefixEq]; exact hv + · exact huv + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem vertexMemT.{u_1, u_2} : vertexMemTStatement.{u_1, u_2} := by + classical + intro V E G e0 T W hWT i hi + as_aux_lemma => + let jW : Fin (W.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have hcast : Fin.castLE (Nat.succ_le_succ hWT.1) jW = i := Fin.ext rfl + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + refine ⟨jW, ?_⟩ + rw [← hWT.2.1 jW, hcast] + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hthetaY.{u_1, u_2} : hthetaYStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma Y hthetaMissingY + vertexMemSelf treeMissingIntro + as_aux_lemma => + clear_value Y + exact treeMissingIntro sigma Y (Y.vertex (Fin.last Y.length)) d.theta + (vertexMemSelf Y (Fin.last Y.length)) hthetaMissingY + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem treeMissingSubset.{u_1, u_2} : treeMissingSubsetStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma U W hUW + as_aux_lemma => + intro c hc + obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, + TreeSequenceInitialSegmentVertexSetSubset hUW hv, hmiss⟩ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem apositive.{u_1, u_2} : apositiveStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q A hq + as_aux_lemma => + have hlast : q = + (⟨H.dividerCount - 1, Nat.sub_lt hq (by decide)⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + change H.dividerCount = H.dividerCount - 1 + 1 + exact (Nat.sub_add_cancel hq).symm + change HierarchyStarredStage H q = _ + rw [hlast] + change H.stage _ = H.stage _ + congr 1 + apply Fin.ext + change H.dividerCount - 1 + 1 = H.dividerCount + exact Nat.sub_add_cancel hq + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem sameGammaBeta.{u_1, u_2} : sameGammaBetaStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma hgammaA + firstChange hgammaStageMissing hApositive + by_cases hzero : H.dividerCount = 0 + · have hgammaRaw : gamma ∈ TreeMissingColors sigma + (R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc) := by + have hq0 : q = 0 := by + apply Fin.ext + simp [q, hzero] + rw [hq0] at hgammaStageMissing + simpa [HierarchyStageMissingColors] using hgammaStageMissing + exact firstChange.2.1 ⟨hzero, Or.inl hgammaRaw⟩ + · have hgammaLast : gamma ∈ TreeMissingColors sigma + (H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩) := by + have hstar : A = H.stage ⟨H.dividerCount, Nat.lt_add_of_pos_right (by decide)⟩ := + hApositive (Nat.pos_of_ne_zero hzero) + rw [← hstar] + exact hgammaA + exact firstChange.1 ⟨Nat.pos_of_ne_zero hzero, Or.inl hgammaLast⟩ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hmu2One.{u_1, u_2} : hmu2OneStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma z mu2 + as_aux_lemma => + constructor + · have he0 : sigma e0 = none := R.minimumContext.oneEdgeUncolored.1 + simp [mu2, TwoColorComponentSwap, he0] + · intro e he0 + obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 e he0 + by_cases heK : Sum.inr e ∈ TwoColorComponent G sigma gamma beta z + · by_cases heGamma : sigma e = some gamma + · exact ⟨beta, by simp [mu2, TwoColorComponentSwap, heK, heGamma] + ⟩ + · by_cases heBeta : sigma e = some beta + · exact ⟨gamma, by + simp [mu2, TwoColorComponentSwap, heK, heBeta] + ⟩ + · exact ⟨c, by + simpa [mu2, TwoColorComponentSwap, heK, heGamma, heBeta] using hc⟩ + · exact ⟨c, by simpa [mu2, TwoColorComponentSwap, heK] using hc⟩ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hfirstBetaOutside.{u_1, u_2} : hfirstBetaOutsideStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma sameGammaBeta + componentSelf hterminalDisjoint z hv + have hv' : Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∈ + TwoColorComponent G sigma gamma beta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) := by + rw [sameGammaBeta] + exact componentSelf sigma gamma beta + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) + exact (Set.disjoint_left.mp hterminalDisjoint) hv hv' + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstPreserved.{u_1, u_2} : firstPreservedStatement.{u_1, u_2} := by + classical + intro V E _ _ G k e0 T j firstWitness W hWT rho sigma c helem hmiss hc + let _ := Fintype.ofFinite V + as_aux_lemma => + clear * - G T W rho sigma c helem hmiss hc firstWitness hWT + have hr := firstWitness rho W hWT c hc + have hc' : c ∈ TreeMissingColors sigma W := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ + have hs := firstWitness sigma W hWT c hc' + have pref (i : Fin (T.length + 1)) (hi : i.val ≤ W.length) : + T.vertex i ∈ TreeSequenceVertexSet W := by + let j : Fin (W.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hWT.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, (hWT.2.1 j).symm.trans (congrArg T.vertex he)⟩ + by_contra hne + have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ + T.vertex (HierarchyFirstMissingPosition rho T c) := + fun he => hne (T.vertex_injective he) + have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 + exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem missingTransport.{u_1, u_2} : missingTransportStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ell Z old new hm W hWZ + as_aux_lemma => + clear_value Z + clear * - old new hm W hWZ Z + unfold TreeMissingColors + exact Finset.biUnion_congr rfl (fun v hv => + hm v (TreeSequenceInitialSegmentVertexSetSubset hWZ hv)) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hstoredMu2.{u_1, u_2} : hstoredMu2Statement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A ell Z D gamma + hgammaA hgammaNeBeta hZtoT hElemZ hbetaMissingZ z mu2 firstPreserved firstUnaffected + hmissingMu2 eta heta + have hneGamma : eta ≠ gamma := by + intro he + exact (Finset.mem_sdiff.mp heta).2 (he.symm ▸ hgammaA) + by_cases he : eta = beta + · subst eta + exact firstPreserved Z hZtoT sigma mu2 beta hElemZ hmissingMu2 hbetaMissingZ + · exact firstUnaffected z sigma gamma beta eta hgammaNeBeta + R.minimumContext.proper hneGamma he + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem originalStar.{u_1, u_2} : originalStarStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx S + as_aux_lemma => + have helper : + ∀ (n m : ℕ) (U W : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → + TreeSequence G e0), n = m → U = W → HEq s t → Fin.cases (motive := fun _ => TreeSequence G + e0) U (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => + TreeSequence G e0) W (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by + intro n m U W s t hnm hUW hst + subst m + have he : s = t := eq_of_heq hst + simp only [hUW, he] + exact helper _ _ _ _ _ _ S.sameGood.1.2.1 S.sameGood.1.1 S.sameGood.1.2.2.1 + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem lastData.{u_1, u_2} : lastDataStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx S + as_aux_lemma => + obtain ⟨hc, hd⟩ := S.sameGood.2 + have hi : Fin.cast (congrArg (fun n => n + 1) hc) + (Fin.last C.hierarchy.dividerCount) = + Fin.last S.counterexample.hierarchy.dividerCount := Fin.ext hc + simpa only [hi] using hd (Fin.last C.hierarchy.dividerCount) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem sameLast.{u_1, u_2} : sameLastStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R H q D lastData S + refine ⟨(lastData R).1.symm.trans (lastData S).1, ?_⟩ + intro eta heta + have hc : eta ∈ HierarchyStoredColorsAt C.hierarchy + (Fin.last C.hierarchy.dividerCount) := (lastData R).1.symm ▸ heta + exact ((lastData R).2 eta hc).symm.trans ((lastData S).2 eta hc) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem weakEdges.{u_1, u_2} : weakEdgesStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 T input' old new et bs K hw ho hn + as_aux_lemma => + by_cases hz : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz + rw [hi] at hw ⊢ + exact P2813_T1_BaseDisplayedEdges G k e0 input' T old et bs new ho hn hw + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := + Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) + rw [hi] at hw ⊢ + intro t + by_cases ht : 1 ≤ t.val + · exact hw.2.1 t ht + · let W := HierarchyStarredStage K + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ + have he : t = ⟨0, W.positive⟩ := Fin.ext (by change t.val = 0; omega) + rw [he, W.first_edge, hn.1, ho.1] + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem xYlen.{u_1, u_2} : xYlenStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A X Y + hAtoT htail fullPrefixEq + change (HierarchyFullTailPrefix C j).length = + (HierarchyFullTailPrefix C (j - 1)).length + 1 + rw [fullPrefixEq j, fullPrefixEq (j - 1)] + simp only [TreeSequencePrefix] + have hj : 2 ≤ j := hpathLower + have hl : A.length + j ≤ T.length := by + have hAT := hAtoT.1 + clear * - htail hAT + omega + clear * - hj hl + omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hweak1.{u_1, u_2} : hweak1Statement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma + hgammaNeBeta hchangeElementary hchangeMissing hterminalDisjoint z mu2 hcase1 hpath1 + as_aux_lemma => + exact (StableChangeCasesOneTwo G k e0 R.corresponding.replacementInput T sigma + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + hchangeElementary R.minimumContext.largeMissingSet gamma beta hgammaNeBeta + hchangeMissing z hpath1 mu2 rfl hcase1 hterminalDisjoint).1 + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem swapOne.{u_1, u_2} : swapOneStatement.{u_1, u_2} := by + classical + intro V E G k e0 T z old a b ho + as_aux_lemma => + constructor + · simp only [TwoColorComponentSwap, ho.1, reduceCtorEq, ite_false, ite_self] + · intro e he + obtain ⟨c, hc⟩ := ho.2 e he + by_cases hm : Sum.inr e ∈ TwoColorComponent G old a b z + · by_cases ha : old e = some a + · exact ⟨b, by simp only [TwoColorComponentSwap, hm, ha, ite_true]⟩ + · by_cases hb : old e = some b + · refine ⟨a, ?_⟩ + unfold TwoColorComponentSwap + rw [ite_eq_left hm, ite_eq_right ha, ite_eq_left hb] + · exact ⟨c, by simpa only [TwoColorComponentSwap, hm, ha, hb, ite_true, ite_false] + using hc⟩ + · exact ⟨c, by simpa only [TwoColorComponentSwap, hm, ite_false] using hc⟩ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hweak3.{u_1, u_2} : hweak3Statement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d ell Z gamma hgammaNeTheta z + samePenultimate R1 rho hElemRho mu3 hpath3 hcase3 hdisjoint3First hmissingPairCurrent + as_aux_lemma => + exact (StableChangeCasesOneTwo G k e0 R1.corresponding.replacementInput T rho + R1.corresponding.replacementETT R1.replacementBase R1.counterexample + R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung + R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality + (by + change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - 1))) + rw [samePenultimate R1] + exact hElemRho) R1.minimumContext.largeMissingSet + gamma d.theta hgammaNeTheta hmissingPairCurrent z hpath3 mu3 rfl hcase3 hdisjoint3First).1 + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem yTerminalDistinct.{u_1, u_2} : yTerminalDistinctStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R H q A Y hcutJstrict + hYlen hYtoT he + have hi := T.vertex_injective ((hYtoT.2.1 (Fin.last Y.length)).trans he) + have hv := congrArg Fin.val hi + simp only [Fin.val_castLE, Fin.val_last] at hv + exact Nat.ne_of_lt (hYlen.symm ▸ hcutJstrict) hv + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hjEligible.{u_1, u_2} : hjEligibleStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hpathLower hpathUpper Y + gamma z R1 rho mu3 hthetaTerminalMu3 hthetaYMu3 R2 hR2 + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨?_, ?_⟩, R2, d.theta, ?_, ?_⟩ + · exact (by decide : 1 ≤ 2).trans hpathLower + · exact Nat.le_sub_one_of_lt hpathUpper + · rw [hR2] + exact hthetaYMu3 + · rw [hR2] + exact hthetaTerminalMu3 + +end GoldbergSeymour.SharedFacts.DisjointThetaTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBaseClaim45Singleton.lean b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBaseClaim45Singleton.lean new file mode 100644 index 0000000000..c9be988a8e --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBaseClaim45Singleton.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap +public import Mathlib.Combinatorics.SimpleGraph.Init +public import Mathlib.Data.Fintype.EquivFin +public import Mathlib.Tactic.Bound.Init + +/-! +# Shared facts for ExtensionBaseClaim45Singleton + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ExtensionBaseClaim45Singleton + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev rho0UnaffectedStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] {G : LooplessMultigraph V E} + {k : ℕ} {e0 : E} (TjPrime : TreeSequence G e0) (rho1 : PartialEdgeColoring E k) + (deltaN beta : Fin k), + let rho0 : PartialEdgeColoring E k := OutsideTreeColorSwap TjPrime rho1 beta deltaN; + ∀ (c : Fin k) (_ : c ≠ beta) (_ : c ≠ deltaN) (f : E), + rho0 f = some c ↔ rho1 f = some c + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem rho0_unaffected.{u_1, u_2} : rho0UnaffectedStatement.{u_1, u_2} := by + classical + intro V E _ _ G k e0 TjPrime rho1 deltaN beta rho0 c hcb hcd f + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + unfold rho0 OutsideTreeColorSwap + by_cases ht : TreeIncidentEdge TjPrime f + · simp [ht] + · simp only [ite_eq_right ht] + by_cases hfb : rho1 f = some beta + · rw [ite_eq_left hfb] + constructor + · intro h + exact False.elim (hcd (Option.some.inj h).symm) + · intro h + exact False.elim (hcb (Option.some.inj (h.symm.trans hfb))) + · rw [ite_eq_right hfb] + by_cases hfd : rho1 f = some deltaN + · rw [ite_eq_left hfd] + constructor + · intro h + exact False.elim (hcb (Option.some.inj h).symm) + · intro h + exact False.elim (hcd (Option.some.inj (h.symm.trans hfd))) + · rw [ite_eq_right hfd] + +end GoldbergSeymour.SharedFacts.ExtensionBaseClaim45Singleton + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBaseStepLemmas.lean b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBaseStepLemmas.lean new file mode 100644 index 0000000000..d4c5a1a510 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBaseStepLemmas.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import Mathlib.Combinatorics.SimpleGraph.Init +public import Mathlib.Tactic.Bound.Init + +/-! +# Shared facts for ExtensionBaseStepLemmas + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ExtensionBaseStepLemmas + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev uPrimeStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) (TjPrime : TreeSequence + G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ + (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; TreeSequenceInitialSegment U TjPrime + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev prefixSelfStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (A : TreeSequence G e0), + TreeSequencePrefix A A.length A.positive le_rfl = A + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem uPrime.{u_1, u_2} : uPrimeStatement.{u_1, u_2} := by + classical + intro V E G e0 TjPrime uPosition huPositionPositive huPositionBound U + refine ⟨huPositionBound, ?_, ?_⟩ + · intro i + simp [U, TreeSequencePrefix] + · intro i + simp [U, TreeSequencePrefix] + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem prefixSelf.{u_1, u_2} : prefixSelfStatement.{u_1, u_2} := by + classical + intro V E G e0 A + cases A with + | mk len pos vertex edge vinj einj first attach => + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + rfl + · apply heq_of_eq + funext i + rfl + +end GoldbergSeymour.SharedFacts.ExtensionBaseStepLemmas + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranchPreparation.lean b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranchPreparation.lean new file mode 100644 index 0000000000..a39368219a --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranchPreparation.lean @@ -0,0 +1,181 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeVerticesBefore + +/-! +# Shared facts for ExtensionBaseBranchPreparation + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ExtensionBranchPreparation + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hbeforePrimeNeUStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → + ∀ (TjPrime : TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet + TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : Fin + (TjPrime.length + (1 : ℕ))) {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hbeforePrimeMissingStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : + PartialEdgeColoring E k), + let this : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (z0 : + V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (rho3 : + PartialEdgeColoring E k), ( + ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : + Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase + u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → (z0 ∈ TreeVerticesBefore + TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 z0) → ( + ∀ {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0) → + ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, MissingColors G rho3 y = MissingColors G rho1 y + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev transportURouteStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (v : V) (sigma : PartialEdgeColoring E k) (hvFinal : v ∈ + TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (TjPrime : TreeSequence G e0) (rho3 : PartialEdgeColoring E k) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; ( + ∀ {A B : TreeSequence G e0}, TashkinovAugmentation rho1 A B → TreeSequenceInitialSegment B U → + TashkinovAugmentation rho3 A B) → + ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence rho1 S U → + TashkinovAugmentationSequence rho3 S U + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev huUStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + (TjPrime : TreeSequence G e0) (u0 : V) (uPosition : Fin (TjPrime.length + (1 : ℕ))), + TjPrime.vertex uPosition = u0 → + ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := + TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; + u0 ∈ TreeSequenceVertexSet U + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hbeforePrimeNeU.{u_1, u_2} : hbeforePrimeNeUStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition y hy + unfold TreeVerticesBefore at hy + obtain ⟨-, i, j, hiy, hju, hij⟩ := Finset.mem_filter.mp hy + intro hyu + have hijEq : i = j := TjPrime.vertex_injective + (hiy.trans (hyu.trans hju.symm)) + omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hbeforePrimeMissing.{u_1, u_2} : hbeforePrimeMissingStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal + hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hd2z + hbeforePrimeNeU y hy + by_cases hyz : y = z0 + · subst y + exact hd2z hy + · apply hd2Missing y + apply Finset.mem_erase.mpr + refine ⟨hyz, Finset.mem_erase.mpr ⟨hbeforePrimeNeU hy, ?_⟩⟩ + exact Finset.mem_union_right _ (Finset.mem_union_left _ hy) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem transportURoute.{u_1, u_2} : transportURouteStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett v sigma hvFinal trace rho1 TjPrime rho3 uPosition + huPositionPositive huPositionBound U transportUStep S hroute + unfold TashkinovAugmentationSequence at hroute ⊢ + induction hroute using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B hAB hBU ih => + have hBsegment : TreeSequenceInitialSegment B U := + TashkinovAugmentationSequenceInitialSegment rho1 B U hBU + exact Relation.ReflTransGen.head + (transportUStep hAB hBsegment) ih + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem huU.{u_1, u_2} : huUStatement.{u_1, u_2} := by + classical + intro V E G e0 TjPrime u0 uPosition huPosition huPositionPositive huPositionBound U + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + refine ⟨Fin.last U.length, ?_⟩ + change TjPrime.vertex (Fin.castLE (Nat.succ_le_succ huPositionBound) + (Fin.last uPosition.val)) = u0 + have hindex : Fin.castLE (Nat.succ_le_succ huPositionBound) + (Fin.last uPosition.val) = uPosition := by + apply Fin.ext + rfl + rw [hindex] + exact huPosition + +end GoldbergSeymour.SharedFacts.ExtensionBranchPreparation + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranches.lean b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranches.lean new file mode 100644 index 0000000000..90ed2f9137 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranches.lean @@ -0,0 +1,469 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequencePrefix +public import LeanPool.GoldbergSeymour.TreeVerticesBefore + +/-! +# Shared facts for ExtensionBaseAuxiliary + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ExtensionBranches + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev branchStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let _ : DecidableEq V := Classical.decEq V; + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)) (_ : (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))).length = (1 : ℕ)) (_ : + TashkinovClosure (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) + (ett.series.data.tree (0 : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.tree (1 : Fin + (ett.rounds + (2 : ℕ))))) (_ : jSlot.castSucc = (0 : Fin (ett.rounds + (1 : ℕ)))), + TashkinovAugmentationSequence (ett.series.data.coloring (0 : Fin (ett.rounds + (1 : ℕ)))) + seed (ett.series.data.tree jSlot.succ.castSucc) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev equalPrefixesStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B D : TreeSequence G e0}, TreeSequenceInitialSegment A D → TreeSequenceInitialSegment B + D → A.length = B.length → A = B + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev branch3050Statement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) + (i : Fin ett.rounds) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree + i.succ.castSucc) (TashkinovStoredColors ett.series.data i.castSucc) + (ett.series.data.coloring i.castSucc)) (_ : ett.series.data.connectingEdges i.succ = + { choice.edge }) (_ : ett.series.data.kind i.succ = some TashkinovExtensionKind.SE) + (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree + i.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (ett.series.data.coloring + i.succ) adjoined (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), + ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ + (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev branch3107Statement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), TreeSequenceInitialSegment Tprevious seed)) (_ : (0 : ℕ) < + (↑jSlot : ℕ)) (i : Fin ett.rounds) (_ : ett.series.data.kind i.succ = some + TashkinovExtensionKind.PE) (_ : TashkinovClosure (ett.series.data.coloring i.succ) + (ett.series.data.tree i.succ.castSucc) (ett.series.data.tree i.succ.succ)) (_ : + jSlot.castSucc = i.succ), ett.series.data.kind i.succ = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence (ett.series.data.coloring i.succ) Tprevious seed ∨ + (ett.series.data.kind i.succ = some TashkinovExtensionKind.SE ∨ ett.series.data.kind + i.succ = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev branch3129Statement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) (_ : TreeSequenceInitialSegment seed + (ett.series.data.tree jSlot.succ.castSucc)) (_ : ( + ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A C) (_ : + TreeSequenceInitialSegment B C) (_ : A.length ≤ B.length), TreeSequenceInitialSegment A + B)), + let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; + ∀ (_ : ( + ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ)), Tprevious.length < seed.length)) (_ : (0 : ℕ) < (↑jSlot : ℕ)) + (i : Fin ett.rounds) (available : RevisitingExtensionCertificate ett.series.data + i.castSucc) (_ : ett.series.data.connectingEdges i.succ = { available.edge }) (_ : + ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) (adjoined : TreeSequence G + e0) (_ : TreeSequenceAdjoinEdge (ett.series.data.tree i.succ.castSucc) available.edge + adjoined) (_ : TashkinovClosure (ett.series.data.coloring i.succ) adjoined + (ett.series.data.tree i.succ.succ)) (_ : jSlot.castSucc = i.succ), ett.series.data.kind + i.succ = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) Tprevious seed ∨ (ett.series.data.kind i.succ = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind i.succ = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (adjoinSeed : TreeSequence G e0), ett.series.data.connectingEdges i.succ = { f } ∧ + TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence + (ett.series.data.coloring i.succ) adjoinSeed seed + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev usegmentVertexBeforeStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) + (sigma : PartialEdgeColoring E k), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) + (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive + : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), + let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) + → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), + let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); + ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) + (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : + (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), + let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) + (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; + ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : + TreeSequence G e0), + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; + ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 + gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree + jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet + TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) + (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (uPosition : Fin + (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) + (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), + let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive + huPositionBound; + ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( + ∀ (i : Fin (TjPrime.length + (1 : ℕ))) (_ : (↑i : ℕ) < (↑uPosition : ℕ)), TjPrime.vertex i ∈ + TreeVerticesBefore TjPrime u0 huPrime0)) {A : TreeSequence G e0} (_ : + TreeSequenceInitialSegment A U) (_ : A.length < U.length) {y : V} (_ : y ∈ + TreeSequenceVertexSet A), y ∈ TreeVerticesBefore TjPrime u0 huPrime0 + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem branch.{u_1, u_2} : branchStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v this q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hseedTj commonPrefix seedLength initialClosure htarget + have htargetZero : jSlot.val = 0 := by + have := congrArg Fin.val htarget + simpa using this + have htreeOne : ett.series.data.tree 1 = + ett.series.data.tree jSlot.succ.castSucc := by + congr 1 + apply Fin.ext + simp [htargetZero] + have hinitialTj : TreeSequenceInitialSegment + (ett.series.data.tree 0) + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := TashkinovAugmentationSequenceInitialSegment _ _ _ + initialClosure.1 + rw [htreeOne] at h + exact h + have hbaseSeed : TreeSequenceInitialSegment + (ett.series.data.tree 0) seed := by + apply commonPrefix hinitialTj hseedTj + rw [seedLength] + exact seed.positive + have hrouteOld : TashkinovAugmentationSequence + (ett.series.data.coloring 0) (ett.series.data.tree 0) + (ett.series.data.tree jSlot.succ.castSucc) := by + rw [← htreeOne] + exact initialClosure.1 + have hroute := TashkinovAugmentationSequenceSuffix + (ett.series.data.coloring 0) (ett.series.data.tree 0) seed + (ett.series.data.tree jSlot.succ.castSucc) hrouteOld hbaseSeed + hseedTj + simpa [htargetZero] using hroute + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem equalPrefixes.{u_1, u_2} : equalPrefixesStatement.{u_1, u_2} := by + classical + intro V E G e0 A B D hAD hBD hlen + rcases hAD with ⟨hlenAD, hvertexAD, hedgeAD⟩ + rcases hBD with ⟨hlenBD, hvertexBD, hedgeBD⟩ + cases A with + | mk alen apos avertex aedge avinj aeinf afirst aattach => + cases B with + | mk blen bpos bvertex bedge bvinj beinj bfirst battach => + simp only at hlen + subst blen + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + calc + avertex i = D.vertex + (Fin.castLE (Nat.succ_le_succ hlenAD) i) := + (hvertexAD i).symm + _ = D.vertex + (Fin.castLE (Nat.succ_le_succ hlenBD) i) := by + congr 1 + _ = bvertex i := hvertexBD i + · apply heq_of_eq + funext i + calc + aedge i = D.edge (Fin.castLE hlenAD i) := + (hedgeAD i).symm + _ = D.edge (Fin.castLE hlenBD i) := by congr 1 + _ = bedge i := hedgeBD i + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem branch3050.{u_1, u_2} : branch3050Statement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict hjPositive i choice currentEdges + currentKind adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + right + refine ⟨Or.inl (by simpa [htarget] using currentKind), + choice.edge, adjoined, ?_, ?_, ?_⟩ + · simpa [htarget] using currentEdges + · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ + have hiCast : i.castSucc.succ = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hlenNew : adjoined.length = Tprevious.length + 1 := by + simpa [Tprevious, hiCast] using hlen + have hsegmentNew : + TreeSequenceInitialSegment Tprevious adjoined := by + simpa [Tprevious, hiCast] using hsegment + refine ⟨hlenNew, hsegmentNew, ?_⟩ + have haddedIndex : + Fin.cast hlenNew.symm (Fin.last Tprevious.length) = + Fin.cast hlen.symm + (Fin.last + (ett.series.data.tree i.succ.castSucc).length) := by + apply Fin.ext + simp [Tprevious, hiCast] + rw [haddedIndex] + exact hedge + · simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) adjoined seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + hadjoinedSeed hseedTj) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem branch3107.{u_1, u_2} : branch3107Statement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj Tprevious hpreviousSeed hjPositive i currentKind closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) Tprevious + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + simpa [Tprevious, hi] using h + left + refine ⟨by simpa [htarget] using currentKind, ?_⟩ + simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) Tprevious seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + (hpreviousSeed hjPositive) hseedTj) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem branch3129.{u_1, u_2} : branch3129Statement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper + hfirstPositive jSlot terminalPosition hterminalPositionPositive hterminalPositionBound seed + hjTreeIndex hseedTj commonPrefix Tprevious hpreviousStrict hjPositive i available + currentEdges currentKind adjoined adjoinedExactly closedExtension htarget + have hi : i.succ = jSlot.castSucc := htarget.symm + have hroute : TashkinovAugmentationSequence + (ett.series.data.coloring jSlot.castSucc) adjoined + (ett.series.data.tree jSlot.succ.castSucc) := by + have h := closedExtension.1 + rw [hi, hjTreeIndex] at h + exact h + have hadjoinedTj : TreeSequenceInitialSegment adjoined + (ett.series.data.tree jSlot.succ.castSucc) := + TashkinovAugmentationSequenceInitialSegment _ _ _ hroute + have hadjoinedLength : adjoined.length ≤ seed.length := by + rcases adjoinedExactly with ⟨hlen, -, -⟩ + have hiCast : i.succ.castSucc = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hprev : ett.series.data.tree i.succ.castSucc = + Tprevious := by rw [hiCast] + rw [hprev] at hlen + rw [hlen] + exact Nat.succ_le_of_lt (hpreviousStrict hjPositive) + have hadjoinedSeed : TreeSequenceInitialSegment adjoined seed := + commonPrefix hadjoinedTj hseedTj hadjoinedLength + right + refine ⟨Or.inr (by simpa [htarget] using currentKind), + available.edge, adjoined, ?_, ?_, ?_⟩ + · simpa [htarget] using currentEdges + · rcases adjoinedExactly with ⟨hlen, hsegment, hedge⟩ + have hiCast : i.castSucc.succ = + jSlot.castSucc.castSucc := by + apply Fin.ext + simpa using congrArg Fin.val hi + have hlenNew : adjoined.length = Tprevious.length + 1 := by + simpa [Tprevious, hiCast] using hlen + have hsegmentNew : + TreeSequenceInitialSegment Tprevious adjoined := by + simpa [Tprevious, hiCast] using hsegment + refine ⟨hlenNew, hsegmentNew, ?_⟩ + have haddedIndex : + Fin.cast hlenNew.symm (Fin.last Tprevious.length) = + Fin.cast hlen.symm + (Fin.last + (ett.series.data.tree i.succ.castSucc).length) := by + apply Fin.ext + simp [Tprevious, hiCast] + rw [haddedIndex] + exact hedge + · simpa [hi] using + (TashkinovAugmentationSequenceRestrict + (ett.series.data.coloring jSlot.castSucc) adjoined seed + (ett.series.data.tree jSlot.succ.castSucc) hroute + hadjoinedSeed hseedTj) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem usegmentVertexBefore.{u_1, u_2} : usegmentVertexBeforeStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal + hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 + terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x + componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition + huPositionPositive huPositionBound U hUPrime hprimeVertexBefore A hAU hAlen y hyA + obtain ⟨hAULen, hAUVertices, -⟩ := hAU + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hyA + obtain ⟨i, rfl⟩ := hyA + let iU : Fin (U.length + 1) := + Fin.castLE (Nat.succ_le_succ hAULen) i + let iPrime : Fin (TjPrime.length + 1) := + Fin.castLE (Nat.succ_le_succ hUPrime.1) iU + have hiPrime : iPrime.val < uPosition.val := by + change i.val < uPosition.val + have hUlen : U.length = uPosition.val := by + simp [U, TreeSequencePrefix] + omega + rw [← hAUVertices i, ← hUPrime.2.1 iU] + exact hprimeVertexBefore iPrime hiPrime + +end GoldbergSeymour.SharedFacts.ExtensionBranches + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/FirstSubcaseTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/FirstSubcaseTransport.lean new file mode 100644 index 0000000000..0c4e6a7025 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/FirstSubcaseTransport.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +/-! +# Shared facts for HierarchySituationTwoSubcaseOneTwo + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.FirstSubcaseTransport + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev bTStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + B.length + (1 : ℕ) = T.length → TreeSequenceInitialSegment B T + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev sameStarStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy (Fin.last + P.counterexample.hierarchy.dividerCount) = A + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem bT.{u_1, u_2} : bTStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C B hBlen + refine ⟨?_, ?_, ?_⟩ + · omega + · intro i + rfl + · intro i + rfl + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem sameStar.{u_1, u_2} : sameStarStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx H q A P + have helper : + ∀ (n m : ℕ) (X Y : TreeSequence G e0) (s : Fin (n + 2) → TreeSequence G e0) (t : Fin (m + 2) → + TreeSequence G e0), n = m → X = Y → HEq s t → Fin.cases (motive := fun _ => TreeSequence G + e0) X (fun i : Fin n => s i.succ.castSucc) (Fin.last n) = Fin.cases (motive := fun _ => + TreeSequence G e0) Y (fun i : Fin m => t i.succ.castSucc) (Fin.last m) := by + intro n m X Y s t hnm hXY hst + subst m + have he := eq_of_heq hst + simp [hXY, he] + exact (helper _ _ base.core P.replacementBase.core H.stage + P.counterexample.hierarchy.stage P.sameGood.1.2.1 P.sameGood.1.1 + P.sameGood.1.2.2.1).symm + +end GoldbergSeymour.SharedFacts.FirstSubcaseTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/FullTailTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/FullTailTransport.lean new file mode 100644 index 0000000000..5fd30baa44 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/FullTailTransport.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext +public import LeanPool.GoldbergSeymour.CertifiedETTPredecessor +public import LeanPool.GoldbergSeymour.TechnicalTheoremBase + +/-! +# Shared facts for StableChangeCasesOneTwoFullTail + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.FullTailTransport + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev preStepElementaryStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let i : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), by have this : (0 : ℕ) < ett.rounds := C.positive; omega⟩ : + Fin ett.rounds); + ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) + (TreeSequenceVertexSet Tn) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem preStepElementary.{u_1, u_2} : preStepElementaryStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx n Tn + dsimp only + by_cases hn : ett.rounds = 1 + · have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = 0 := + Fin.ext (by simp [hn]) + have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn]) + dsimp only [Tn] + rw [hcolor, htree] + exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + · have hmore : 1 < ett.rounds := by have := C.positive; omega + obtain ⟨predecessor, hr, hmaximum, _, _⟩ := + CertifiedETTPredecessor G k e0 input T phi ett C.maximum hmore + have htree : n.castSucc = (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext rfl + dsimp only [Tn] + rw [htree] + exact (ctx.lowerRung predecessor (by omega) (by omega) hmaximum).1 + +end GoldbergSeymour.SharedFacts.FullTailTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/GoodHierarchyPrefixPreparation.lean b/LeanPool/GoldbergSeymour/SharedFacts/GoodHierarchyPrefixPreparation.lean new file mode 100644 index 0000000000..8b5f34dad6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/GoodHierarchyPrefixPreparation.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import Mathlib.Combinatorics.SimpleGraph.Init +public import Mathlib.Tactic.Bound.Init + +/-! +# Shared facts for GoodHierarchyPrefixPreparation + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.GoodHierarchyPrefixPreparation + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev segmentTransStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B + C → TreeSequenceInitialSegment A C + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem segmentTrans.{u_1, u_2} : segmentTransStatement.{u_1, u_2} := by + classical + intro V E G e0 A B C hAB hBC + rcases hAB with ⟨hab, hvab, heab⟩ + rcases hBC with ⟨hbc, hvbc, hebc⟩ + refine ⟨le_trans hab hbc, ?_, ?_⟩ + · intro i + have hmid := hvbc (Fin.castLE (Nat.succ_le_succ hab) i) + simpa using hmid.trans (hvab i) + · intro i + have hmid := hebc (Fin.castLE hab i) + simpa using hmid.trans (heab i) + +end GoldbergSeymour.SharedFacts.GoodHierarchyPrefixPreparation + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/InsideAdvancement.lean b/LeanPool/GoldbergSeymour/SharedFacts/InsideAdvancement.lean new file mode 100644 index 0000000000..d720855695 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/InsideAdvancement.lean @@ -0,0 +1,168 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +/-! +# Shared facts for HierarchySituationOneAdvanceInsideStored + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.InsideAdvancement + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev tailExceptionStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) (_ : ( + ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : + TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z)), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); + ∀ (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A)) (_ : TreeSequenceInitialSegment A T) (hlen + : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) => + by omega + ) (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) => + by omega + ); + ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), + HierarchyFullTailPrefix R.counterexample j = HierarchyFullTailPrefix C j)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B)) (_ : ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B))) (_ : ( + ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet + U)) (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : + (1 : ℕ) ≤ j) (_ : j < T.length - A.length), + ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last + (HierarchyFullTailPrefix C j).length)), + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = + some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last + R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev consecutiveStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (_ : ℕ) + (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), + let A : TreeSequence G e0 := + HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount); + ∀ (t : Fin T.length) (_ : A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ)), + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem tailException.{u_1, u_2} : tailExceptionStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx i trans A starEq hAT hlen B hBT fullEq + fullB elementary vertexMem R j hj hjlt c hc t hlo hhi hcol + clear * - R j hj hjlt c hc t hlo hhi hcol starEq hAT hBT fullEq fullB elementary vertexMem + let U := HierarchyFullTailPrefix R.counterexample j + have hUlen : U.length = A.length + j := by + simp only [U, HierarchyFullTailPrefix, TreeSequencePrefix] + rw [starEq R] + exact min_eq_left (by have := hAT.1; omega) + have hUT : TreeSequenceInitialSegment U T := + ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + let u : Fin U.length := ⟨t.val, by rw [hUlen]; omega⟩ + have hut : Fin.castLE hUT.1 u = t := Fin.ext rfl + have hcU : c ∈ MissingColors G R.coloring (U.vertex (Fin.last U.length)) := by + dsimp only [U] + rw [fullEq R] + exact hc + have hcolU : R.coloring (U.edge u) = some c := by + rw [← hUT.2.2 u, hut]; exact hcol + have hex := HierarchyTailMissingColorExclusion G k e0 R.corresponding.replacementInput T + R.coloring R.corresponding.replacementETT R.replacementBase R.counterexample.hierarchy + (by + change ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1))) + rw [fullB R] + exact elementary R) + j hj (by + rw [starEq R] + exact hjlt) c hcU u + (by + change (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length ≤ t.val + rw [starEq R] + exact hlo) + (by + change t.val < (HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + j + rw [starEq R] + exact hhi) hcolU + obtain ⟨hzero, hcore, hval, f, hstep, hkind, hedges, hedge, hcF, hstored⟩ := hex + have hAval : t.val = A.length := by + change u.val = _ at hval + rw [starEq R] at hval + exact hval + have hAn : A = R.corresponding.replacementETT.series.data.tree + (Fin.last R.corresponding.replacementETT.rounds).castSucc := by + rw [← starEq R] + have hs : HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) = R.replacementBase.core := by + simp [HierarchyStarredStage, hzero, Fin.last] + exact hs.trans hcore + obtain ⟨i, hi⟩ := T.attaches t + let a : Fin (A.length + 1) := ⟨i.val, by simpa only [hAval] using i.isLt⟩ + let old : Fin (T.length + 1) := + Fin.castLT i (Nat.lt_trans i.isLt (Nat.succ_lt_succ t.isLt)) + have ha : Fin.castLE (Nat.succ_le_succ hAT.1) a = old := Fin.ext rfl + refine ⟨⟨T.vertex old, ?_, ?_⟩, hstored⟩ + · rw [← hAn, ← ha, hAT.2.1 a] + exact vertexMem A a + · rw [Incident, hi] + exact Sym2.mem_mk_right _ _ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem consecutive.{u_1, u_2} : consecutiveStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C i hpathUpper A t ht + clear * - G T A C t ht hpathUpper + let candidates := (Finset.Icc 1 (T.length - A.length)).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + have hp : HierarchyPathNumber C.hierarchy = + (if h : candidates.Nonempty then candidates.min' h else T.length - A.length) := rfl + have hn : candidates.Nonempty := by + by_contra hn + rw [dite_eq_right hn] at hp + have hu : HierarchyPathNumber C.hierarchy < T.length - A.length := hpathUpper + omega + have hm : candidates.min' hn = HierarchyPathNumber C.hierarchy := by + simpa only [dite_eq_left hn] using hp.symm + have hh := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + rw [hm] at hh + exact hh t ht + +end GoldbergSeymour.SharedFacts.InsideAdvancement + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/LargestClosedTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/LargestClosedTransport.lean new file mode 100644 index 0000000000..ac5261cfd4 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/LargestClosedTransport.lean @@ -0,0 +1,174 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyCounterexample + +/-! +# Shared facts for ChangeLemmaMixedLargestClosed + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.LargestClosedTransport + +/-- Shared dependent data used by more than one proof branch. -/ +abbrev storedEq7501Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + (baseB : + HierarchyBase + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ + (treeMissingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) + (storedS : + TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = + Dn) + (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) + (Nat.le_of_lt_succ (positions i).isLt)) + (hbcore : + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (starBToA : + ∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { + dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) + (Nat.le_of_lt_succ (positionsS i).isLt)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (starEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) + (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j + +end GoldbergSeymour.SharedFacts.LargestClosedTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport.lean new file mode 100644 index 0000000000..7f467454df --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport.lean @@ -0,0 +1,14 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation2 + +/-! +# Shared MixedChangeTransport facts + +The complete interface and proof collection for these related proof branches. +-/ diff --git a/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation1.lean b/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation1.lean new file mode 100644 index 0000000000..8d14be0fa1 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation1.lean @@ -0,0 +1,1278 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree +public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.TwoColorPathComponent + +/-! +# Shared facts for ChangeLemmaMixedClosedFinal + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.MixedChangeTransport + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev initialSegmentTransitiveStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → + TreeSequenceInitialSegment S W + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev comparableInitialSegmentsStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → + TreeSequenceInitialSegment S U + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev stageInitialSegmentStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev stageInitialSegmentOfFinalTreeStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (H.stage j) T + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev lastStagePositiveStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev coreInitialSegmentOfStarredStageStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment base.core A + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev terminalStageInitialSegmentOfCoreStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi), + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + TreeSequenceInitialSegment Tn base.core + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev starredStageInitialSegmentOfFinalTreeStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment A T + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev ordinaryStageInitialSegmentOfStarredStageStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment Tn A → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstMissingPositionWitnessStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment Y T → + ∀ c ∈ TreeMissingColors phi Y, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev missingPositionOutsidePrefixStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + ∀ (i : Fin (T.length + (1 : ℕ))), + T.vertex i ∉ TreeSequenceVertexSet A → + A.length < (↑i : ℕ) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev colorNotMissingOnStarredStageStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + TreeSequenceInitialSegment A Y → + ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev distinctMissingPositionIndicesStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k), + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → + (↑ia : ℕ) < (↑ib : ℕ) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev prefixStrictlyShorterThanFinalTreeStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + A.length < B.length → + TreeSequenceInitialSegment B Y → + B.length < T.length + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev pathMissingStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (phi : PartialEdgeColoring E k), + IsProperEdgeColoring G phi → + ∀ (v : V) (c d : Fin k), + c ≠ d → + c ∈ MissingColors G phi v → + TwoColorPathComponent G phi c d (Sum.inl v) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev otherColorsUnaffectedStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta + (Sum.inl vb); + ∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev swappedColoringOneUncoloredStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + IsOneEdgeUncolored sigma e0 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev notMissingBeforeFirstPositionStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + va ∈ TreeSequenceVertexSet Y → + vb ∈ TreeSequenceVertexSet Y → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B Y → + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + Sum.inl va ∉ K → + (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → + (∀ {v : V} {f : E}, + Sum.inl v ∈ K → + Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ K) → + ∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → + MissingColors G sigma v = MissingColors G phi v + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev routeTransportStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + TashkinovAugmentationSequence sigma S B + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev storedColorsAtReplacementStageStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev replacementStageInitialSegmentOfPrefixStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi) + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB) + (j : Fin (HB.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (HB.stage j) B + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev closureInitialSegmentOfStarredStageStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + TreeSequenceInitialSegment base.core A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev storedColorsEqualityStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev missingColorsEqualityStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstMissingPositionUpperBoundStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), + eta ∈ MissingColors G psi (B.vertex i) → + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev beforeFirstMissingPositionStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k), + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstMissingPositionEqualityStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + (∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), + eta ∈ MissingColors G psi (B.vertex i) → + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ)) → + (∀ (psi : PartialEdgeColoring E k) (eta : Fin k), + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta))) → + ∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev initialSegmentEqualityStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j) + B) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev refreshedHierarchyEqualityStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v + +end GoldbergSeymour.SharedFacts.MixedChangeTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation2.lean b/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation2.lean new file mode 100644 index 0000000000..cda55c024b --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation2.lean @@ -0,0 +1,811 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation1 +public import LeanPool.GoldbergSeymour.HierarchyPathNumber +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset + +/-! +# Shared facts for ChangeLemmaMixedClosedFinal + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.MixedChangeTransport + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev lastStarredStageEqualityStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (hbbase : + stages (0 : Fin (count + (2 : ℕ))) = + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + (Fin.last + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) + (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hbnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hbstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (positions : Fin count → Fin (B.length + (1 : ℕ))) + (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) + (hbincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) + (hbdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) + (hbcore : + TreeSequenceInitialSegment baseB.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev pathLengthUpperBoundStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let _ : ℕ := T.length - A.length; + TreeSequenceInitialSegment A T → + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) + (hsincreasing : + ∀ (i j : Fin count), + (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) + (hsbase : + stages (0 : Fin (count + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) + (hsnested : + ∀ (j : Fin (count + (1 : ℕ))), + TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) + (hsstrict : + ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) + (hsdivider : + ∀ (i : Fin count), + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) + (hscore : + TreeSequenceInitialSegment baseS.core + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HS : TashkinovHierarchy corr.replacementETT baseS := + { dividerCount := count, stage := stages, baseStage := hsbase, + terminalStage := hsterminal, nested := hsnested, strict := hsstrict, + dividerPosition := positionsS, dividerPositive := hspositive, + dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem initialSegmentTransitive.{u_1, u_2} : initialSegmentTransitiveStatement.{u_1, u_2} := by + classical + intro V E G e0 S U W hSU hUW + refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem comparableInitialSegments.{u_1, u_2} : comparableInitialSegmentsStatement.{u_1, u_2} := by + classical + intro V E G e0 S U W hSW hUW hlen + refine ⟨hlen, ?_, ?_⟩ + · intro i + exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) + · intro i + exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem stageInitialSegment.{u_1, u_2} : stageInitialSegmentStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H segRefl segTrans a d hbound + induction d with + | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem stageInitialSegmentOfFinalTree.{u_1, u_2} : + stageInitialSegmentOfFinalTreeStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H stageSegment j + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) + simpa [he, H.terminalStage] using hs + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem lastStagePositive.{u_1, u_2} : lastStagePositiveStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hz + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem coreInitialSegmentOfStarredStage.{u_1, u_2} : + coreInitialSegmentOfStarredStageStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A segRefl segTrans stageSegment lastZero + lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segRefl _ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem terminalStageInitialSegmentOfCore.{u_1, u_2} : + terminalStageInitialSegmentOfCoreStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base n Tn segRefl + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact (Classical.choice (base.parallel hp).2.2).leftSegment + · rw [base.nonparallel hp] + exact segRefl _ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem starredStageInitialSegmentOfFinalTree.{u_1, u_2} : + starredStageInitialSegmentOfFinalTreeStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A segTrans stageToT lastZero lastPositive + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) + · rw [lastPositive hz] + exact stageToT _ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem ordinaryStageInitialSegmentOfStarredStage.{u_1, u_2} : + ordinaryStageInitialSegmentOfStarredStageStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A n Tn stageSegment lastZero lastPositive + TnToA j + by_cases hz : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) + rw [hj, H.baseStage] + exact TnToA + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + rw [lastPositive hz] + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> + simp only [Fin.val_castSucc]; omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstMissingPositionWitness.{u_1, u_2} : firstMissingPositionWitnessStatement.{u_1, + u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell yLength Y YToT c hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let it := Fin.castLE (Nat.succ_le_succ YToT.1) i + have hci : c ∈ MissingColors G phi (T.vertex it) := by + rw [YToT.2.1 i, hi] + exact hcv + let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) + have hit : it ∈ candidates := by simp [candidates, hci] + have hnon : candidates.Nonempty := ⟨it, hit⟩ + have hmem := Finset.min'_mem candidates hnon + have hle := Finset.min'_le candidates it hit + refine ⟨?_, ?_⟩ + · simpa [HierarchyFirstMissingPosition, candidates, hnon] using + (Finset.mem_filter.mp hmem).2 + · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt + have hval : (candidates.min' hnon).val ≤ it.val := hle + simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem missingPositionOutsidePrefix.{u_1, u_2} : missingPositionOutsidePrefixStatement.{u_1, + u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A AToT i hi + by_contra h + have hle : i.val ≤ A.length := by omega + apply hi + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem colorNotMissingOnStarredStage.{u_1, u_2} : + colorNotMissingOnStarredStageStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ell yLength Y hElementaryY + AToY c i hmi hiy hia + clear * - hmi hiy hia AToY hElementaryY + intro hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) + exact (Finset.disjoint_left.mp + (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem distinctMissingPositionIndices.{u_1, u_2} : + distinctMissingPositionIndicesStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta ia ib horder + obtain ⟨i, j, hi, hj, hij⟩ := horder.1 + have hei := T.vertex_injective hi + have hej := T.vertex_injective hj + simpa [hei, hej] using hij + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem prefixStrictlyShorterThanFinalTree.{u_1, u_2} : + prefixStrictlyShorterThanFinalTreeStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib ell yLength Y AToT hAib B + ABstrict BToY + clear * - AToT BToY ABstrict Y + have hAT := AToT.1 + have hY : Y.length = min (A.length + (T.length - A.length - 1)) T.length := rfl + have hBY := BToY.1 + have hAB := ABstrict + omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem pathMissing.{u_1, u_2} : pathMissingStatement.{u_1, u_2} := by + classical + intro V E _ _ G k phi hproper v c d hcd hc + let _ := Fintype.ofFinite V + refine ⟨hcd, Sum.inl v, rfl, ?_⟩ + intro x hx y hy + cases x with + | inr f => + cases y with + | inr g => + have hfc : phi f = some d := hx.2.resolve_left (by + intro he + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) + have hgc : phi g = some d := hy.2.resolve_left (by + intro he + exact (Finset.mem_sdiff.mp hc).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) + congr 1 + by_contra hfg + exact hproper hfg ⟨v, hx.1, hy.1⟩ hfc hgc + | inl w => exact False.elim hy + | inl w => exact False.elim hx + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem otherColorsUnaffected.{u_1, u_2} : otherColorsUnaffectedStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ib vb ell yLength Y ha hb + K sigma f c hca hcb + clear * - hca hcb K sigma hne + by_cases hf : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hca.symm, hcb.symm] + · by_cases hb : phi f = some beta + · simp [sigma, TwoColorComponentSwap, K, hf, hb, hne.symm, + hca.symm, hcb.symm] + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hb] + · simp [sigma, TwoColorComponentSwap, K, hf] + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem swappedColoringOneUncolored.{u_1, u_2} : swappedColoringOneUncoloredStatement.{u_1, + u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta hne H q A ib vb ell yLength Y + ha hb K sigma unaffected + clear * - hone sigma K unaffected hne + refine ⟨?_, ?_⟩ + · simp [sigma, TwoColorComponentSwap, hone.1] + · intro f hf + obtain ⟨c, hc⟩ := hone.2 f hf + by_cases ha : c = alpha + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · by_cases hb : c = beta + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc, hne.symm]⟩ + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨c, (unaffected f c ha hb).mpr hc⟩ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem notMissingBeforeFirstPosition.{u_1, u_2} : + notMissingBeforeFirstPositionStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ia ib va vb ell yLength Y + hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb + by_cases hvK : Sum.inl v ∈ K + · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) + have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv + have han : alpha ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 + have hbn : beta ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 + have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by + simpa [MissingColors, PresentColors] using han + have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by + simpa [MissingColors, PresentColors] using hbn + obtain ⟨fa, hfa, hfca⟩ := hpa + obtain ⟨fb, hfb, hfcb⟩ := hpb + have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) + have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) + have hnewa : sigma fb = some alpha := by + simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] + have hnewb : sigma fa = some beta := by + simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] + have hana : alpha ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fb, hfb, hnewa⟩ + have hbnb : beta ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fa, hfa, hnewb⟩ + ext c + by_cases hca : c = alpha + · subst c; simp [hana, han] + · by_cases hcb : c = beta + · subst c; simp [hbnb, hbn] + · exact behavior.2.2.2 v c hca hcb + · exact behavior.1 v hvK + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem routeTransport.{u_1, u_2} : routeTransportStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb segTrans hAib B BToT + sigma missingBefore edgesFixed S hs + unfold TashkinovAugmentationSequence at hs ⊢ + induction hs using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head U W hstep htail ih => + have hWB := TashkinovAugmentationSequenceInitialSegment phi W B htail + obtain ⟨hlen, hUW, c, hcol, hm⟩ := hstep + have hUB := segTrans hUW hWB + have hlt : U.length < B.length := by have := hWB.1; omega + refine Relation.ReflTransGen.head ⟨hlen, hUW, c, ?_, ?_⟩ ih + · have hf := edgesFixed (Fin.castLE hWB.1 (Fin.cast hlen.symm (Fin.last U.length))) + rw [hWB.2.2] at hf + exact hf.trans hcol + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + have hvB := TreeSequenceInitialSegmentVertexSetSubset hUB hv + have hvb : v ≠ vb := by + intro he + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + have ht := hUB.2.1 i + have htT := BToT.2.1 (Fin.castLE (Nat.succ_le_succ hUB.1) i) + have eqv : T.vertex (Fin.castLE (Nat.succ_le_succ BToT.1) + (Fin.castLE (Nat.succ_le_succ hUB.1) i)) = T.vertex ib := htT.trans (ht.trans + (hi.trans he)) + have hh := congrArg Fin.val (T.vertex_injective eqv) + have := i.isLt + change i.val = ib.val at hh + change U.length < ib.val at hlt + omega + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [missingBefore v hvB hvb]; exact hcv⟩ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem storedColorsAtReplacementStage.{u_1, u_2} : + storedColorsAtReplacementStageStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn Dn ib vb TnToA hAib B rpB + aboveB strictB belowB genB ettB sigma treeMissingEq corr + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ + rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j + have hm := treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) + unfold Dn TashkinovStoredColors + simp only [ettB, hstored, ← hgen, ← ett.generatingColoring, htree, hm, n, Tn] + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem replacementStageInitialSegmentOfPrefix.{u_1, u_2} : + replacementStageInitialSegmentOfPrefixStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib segRefl segTrans hAib B rpB + aboveB strictB belowB genB baseB HB j + clear * - HB j B segRefl segTrans + exact Fin.reverseInduction + (motive := fun j => TreeSequenceInitialSegment (HB.stage j) B) + (by simpa only [HB.terminalStage] using segRefl B) + (fun i hi => segTrans (HB.nested i) hi) j + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem closureInitialSegmentOfStarredStage.{u_1, u_2} : + closureInitialSegmentOfStarredStageStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib coreToA hAib B rpB aboveB + strictB belowB genB baseB hcoreB hp + clear * - hp baseB coreToA hcoreB + obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hp + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [← hcoreB, u.vertexSet] + exact Finset.mem_union_right _ hv + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem storedColorsEquality.{u_1, u_2} : storedColorsEqualityStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + change TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) \ TreeMissingColors sigma (HierarchyStarredStage HS + j) = + Dn \ TreeMissingColors phi (HierarchyStarredStage HB j) + rw [storedS, starEq, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starBToA j))] + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem missingColorsEquality.{u_1, u_2} : missingColorsEqualityStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := + hsbase.symm.trans hbbase + rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] + · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstMissingPositionUpperBound.{u_1, u_2} : + firstMissingPositionUpperBoundStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib hAib B psi eta i hc + clear * - psi eta i hc + let candidates := Finset.univ.filter fun j => eta ∈ MissingColors G psi (B.vertex j) + have hi : i ∈ candidates := by simp [candidates, hc] + have hn : candidates.Nonempty := ⟨i, hi⟩ + simpa [HierarchyFirstMissingPosition, candidates, hn] using + (show (candidates.min' hn).val ≤ i.val from Finset.min'_le candidates i hi) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem beforeFirstMissingPosition.{u_1, u_2} : beforeFirstMissingPositionStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib hAib B psi eta h + clear * - psi eta h + unfold HierarchyFirstMissingPosition at h ⊢ + dsimp only at h ⊢ + split_ifs with hn + · exact (Finset.mem_filter.mp (Finset.min'_mem _ hn)).2 + · simp only [dite_eq_right hn, Fin.val_last] at h + omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstMissingPositionEquality.{u_1, u_2} : firstMissingPositionEqualityStatement.{u_1, + u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B BToT sigma + missingBefore firstLe firstStrict eta + have beforeLast (i : Fin (B.length + 1)) (hi : i.val < B.length) : + MissingColors G sigma (B.vertex i) = MissingColors G phi (B.vertex i) := by + apply missingBefore + · simp [TreeSequenceVertexSet] + · intro he + have heT := (BToT.2.1 i).trans he + have heval := congrArg Fin.val (T.vertex_injective heT) + have hbLen : B.length = ib.val := rfl + change i.val = ib.val at heval + omega + apply Fin.ext + apply Nat.le_antisymm + · by_cases h : (HierarchyFirstMissingPosition phi B eta).val < B.length + · apply firstLe sigma eta + rw [beforeLast _ h] + exact firstStrict phi eta h + · have := (HierarchyFirstMissingPosition sigma B eta).isLt + omega + · by_cases h : (HierarchyFirstMissingPosition sigma B eta).val < B.length + · apply firstLe phi eta + rw [← beforeLast _ h] + exact firstStrict sigma eta h + · have := (HierarchyFirstMissingPosition phi B eta).isLt + omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem initialSegmentEquality.{u_1, u_2} : initialSegmentEqualityStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + have hedge (t : Fin (stages j.succ).length) : + sigma ((stages j.succ).edge t) = phi ((stages j.succ).edge t) := by + have hSB := stageBToB j.succ + have hf := edgesFixed (Fin.castLE hSB.1 t) + rw [hSB.2.2] at hf + exact hf + unfold HierarchySegmentColors + simp only [starEq, firstEq eta, HS, HB, hedge] + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem refreshedHierarchyEquality.{u_1, u_2} : refreshedHierarchyEqualityStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + rw [starEq] + apply Finset.biUnion_congr rfl + intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ) + (Finset.mem_sdiff.mp hv).1) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem lastStarredStageEquality.{u_1, u_2} : lastStarredStageEqualityStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + rw [starEq] + have hs := (hstagesB (Fin.last count)).2 + have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := + Fin.ext (by simp [q]) + simpa only [hj] using hs + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem pathLengthUpperBound.{u_1, u_2} : pathLengthUpperBoundStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb ell AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + let tailB := B.length - A.length + let candidatesT := (Finset.Icc 1 ell).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + let candidatesB := (Finset.Icc 1 tailB).filter fun i => + ∀ t : Fin B.length, A.length + i ≤ t.val → + G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) + have htail : 1 ≤ tailB := by dsimp [tailB]; omega + have htailT : 1 ≤ ell := by dsimp [ell]; omega + have htmem : ell ∈ candidatesT := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htailT, le_rfl⟩, ?_⟩ + intro t ht + have hAT := AToT.1 + have := t.isLt + dsimp [ell] at ht + omega + have hbmem : tailB ∈ candidatesB := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htail, le_rfl⟩, ?_⟩ + intro t ht + have := t.isLt + dsimp [tailB] at ht + omega + have hnT : candidatesT.Nonempty := ⟨ell, htmem⟩ + have hnB : candidatesB.Nonempty := ⟨tailB, hbmem⟩ + have hmT := Finset.min'_mem candidatesT hnT + have hbounds := Finset.mem_Icc.mp (Finset.mem_filter.mp hmT).1 + have hminB : candidatesB.min' hnB ≤ candidatesT.min' hnT := by + by_cases ht : candidatesT.min' hnT ≤ tailB + · apply Finset.min'_le + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hbounds.1, ht⟩, ?_⟩ + intro t hpos + have he := (Finset.mem_filter.mp hmT).2 (Fin.castLE BToT.1 t) hpos + have hv0 := BToT.2.1 t.castSucc + have hv1 := BToT.2.1 t.succ + have hi0 : (Fin.castLE BToT.1 t).castSucc = + Fin.castLE (Nat.succ_le_succ BToT.1) t.castSucc := Fin.ext rfl + have hi1 : (Fin.castLE BToT.1 t).succ = + Fin.castLE (Nat.succ_le_succ BToT.1) t.succ := Fin.ext rfl + simpa only [BToT.2.2, hi0, hi1, hv0, hv1] using he + · exact le_trans (Finset.min'_le candidatesB tailB hbmem) (by omega) + unfold HierarchyPathNumber + rw [hstarLast] + change (if h : candidatesB.Nonempty then candidatesB.min' h else tailB) ≤ + (if h : candidatesT.Nonempty then candidatesT.min' h else ell) + rw [dite_eq_left hnB, dite_eq_left hnT] + exact hminB + +end GoldbergSeymour.SharedFacts.MixedChangeTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/OutsideAdvancement.lean b/LeanPool/GoldbergSeymour/SharedFacts/OutsideAdvancement.lean new file mode 100644 index 0000000000..0e36e12cea --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/OutsideAdvancement.lean @@ -0,0 +1,224 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +/-! +# Shared facts for HierarchySituationOneAdvanceOutsideStored + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.OutsideAdvancement + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstMissingPositionUpperBoundStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (psi : PartialEdgeColoring E k) (c : Fin k) + (j : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G psi (T.vertex j) → + HierarchyFirstMissingPosition psi T c ≤ j + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev lastDataStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), + C.good.gamma (Fin.last C.hierarchy.dividerCount) eta = + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev gammaTransportStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) = + HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount), C.good.gamma + (Fin.last C.hierarchy.dividerCount) eta = R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta) → + ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ + R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = + S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev gammaUnusedStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), + eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last + R.counterexample.hierarchy.dividerCount) eta → + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition + R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev notRawStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors + R.corresponding.replacementETT.series.data (Fin.last + R.corresponding.replacementETT.rounds) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev gammaChoiceStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount), + ∀ (f : E), + ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, + R.coloring f ≠ some a + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev sameLastStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {a b : ℕ} (s : Fin (a + + (2 : ℕ)) → TreeSequence G e0) (t : Fin (b + (2 : ℕ)) → TreeSequence G e0) (u v : + TreeSequence G e0), a = b → s ≍ t → u = v → (Fin.cases u (fun (i : Fin a) ↦ s + i.castSucc.succ) (Fin.last a) : TreeSequence G e0) = (Fin.cases v (fun (i : Fin b) ↦ t + i.castSucc.succ) (Fin.last b) : TreeSequence G e0) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstMissingPositionUpperBound.{u_1, u_2} : + firstMissingPositionUpperBoundStatement.{u_1, u_2} := by + classical + intro V E _ _ G k e0 T psi c j hj + let _ := Fintype.ofFinite V + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G psi (T.vertex j) + have hm : j ∈ candidates := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hj⟩ + have hn : candidates.Nonempty := ⟨j, hm⟩ + unfold HierarchyFirstMissingPosition + rw [dite_eq_left hn] + exact Finset.min'_le candidates j hm + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem lastData.{u_1, u_2} : lastDataStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx R + obtain ⟨hcount, hdata⟩ := R.sameGood.2 + have hh := hdata (Fin.last C.hierarchy.dividerCount) + have hidx : Fin.cast (congrArg (fun q => q + 1) hcount) + (Fin.last C.hierarchy.dividerCount) = + Fin.last R.counterexample.hierarchy.dividerCount := Fin.ext hcount + simpa only [hidx] using hh + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem gammaTransport.{u_1, u_2} : gammaTransportStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans lastData R S eta heta + clear * - R S eta heta lastData + have hOrig : eta ∈ HierarchyStoredColorsAt C.hierarchy (Fin.last C.hierarchy.dividerCount) + := by + rw [(lastData R).1]; exact heta + refine ⟨?_, ((lastData R).2 eta hOrig).symm.trans ((lastData S).2 eta hOrig)⟩ + rw [← (lastData S).1] + exact hOrig + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem gammaUnused.{u_1, u_2} : gammaUnusedStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R eta a heta ha t hlo hhi hc + have hnot := (Finset.mem_sdiff.mp (R.counterexample.good.avoidance + (Fin.last R.counterexample.hierarchy.dividerCount) eta heta ha)).2 + apply hnot + unfold HierarchySegmentColors + dsimp only + rw [starEq R, Fin.succ_last, R.counterexample.hierarchy.terminalStage] + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hlo, + lt_min hhi t.isLt, hc⟩ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem notRaw.{u_1, u_2} : notRawStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx A starEq R c hcA hcD hm + apply hcD + unfold HierarchyStoredColorsAt + dsimp only + rw [starEq R] + exact Finset.mem_sdiff.mpr ⟨hm, hcA⟩ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem gammaChoice.{u_1, u_2} : gammaChoiceStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx trans R eta heta f + clear * - R eta heta f + by_contra hn + push Not at hn + have hc : (R.counterexample.good.gamma + (Fin.last R.counterexample.hierarchy.dividerCount) eta).card ≤ 1 := by + apply Finset.card_le_one.mpr + intro a ha b hb + exact Option.some.inj ((hn a ha).symm.trans (hn b hb)) + rw [R.counterexample.good.twoColors _ eta heta] at hc + omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem sameLast.{u_1, u_2} : sameLastStatement.{u_1, u_2} := by + classical + intro V E G e0 a b s t u v hab hst huv + cases hab + have he : s = t := eq_of_heq hst + cases he + cases huv + rfl + +end GoldbergSeymour.SharedFacts.OutsideAdvancement + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ParallelSupportClosureProperties.lean b/LeanPool/GoldbergSeymour/SharedFacts/ParallelSupportClosureProperties.lean new file mode 100644 index 0000000000..a3bdbcb02d --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ParallelSupportClosureProperties.lean @@ -0,0 +1,57 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import Mathlib.Combinatorics.SimpleGraph.Init +public import Mathlib.Tactic.Bound.Init + +/-! +# Shared facts for ParallelSupportClosureProperties + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ParallelSupportClosureProperties + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev comparableInitialSegmentsStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A C → TreeSequenceInitialSegment B + C → A.length ≤ B.length → TreeSequenceInitialSegment A B + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem comparableInitialSegments.{u_1, u_2} : comparableInitialSegmentsStatement.{u_1, u_2} := by + classical + intro V E G e0 A B C hAC hBC hlen + rcases hAC with ⟨hACLen, hACVertices, hACEdges⟩ + rcases hBC with ⟨hBCLen, hBCVertices, hBCEdges⟩ + refine ⟨hlen, ?_, ?_⟩ + · intro i + calc + B.vertex (Fin.castLE (Nat.succ_le_succ hlen) i) = + C.vertex (Fin.castLE (Nat.succ_le_succ hBCLen) + (Fin.castLE (Nat.succ_le_succ hlen) i)) := + (hBCVertices _).symm + _ = C.vertex (Fin.castLE (Nat.succ_le_succ hACLen) i) := by + congr 1 + _ = A.vertex i := hACVertices i + · intro i + calc + B.edge (Fin.castLE hlen i) = + C.edge (Fin.castLE hBCLen (Fin.castLE hlen i)) := + (hBCEdges _).symm + _ = C.edge (Fin.castLE hACLen i) := by congr 1 + _ = A.edge i := hACEdges i + +end GoldbergSeymour.SharedFacts.ParallelSupportClosureProperties + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/RevisitingTerminalPreparation.lean b/LeanPool/GoldbergSeymour/SharedFacts/RevisitingTerminalPreparation.lean new file mode 100644 index 0000000000..3441f55003 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/RevisitingTerminalPreparation.lean @@ -0,0 +1,103 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ExtendedTashkinovTree + +/-! +# Shared facts for RevisitingTerminalPreparation + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.RevisitingTerminalPreparation + +open scoped Sym2 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev tnClosureStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T generating) (Tstar : TreeSequence G e0), + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → + ∀ (closureTree : TreeSequence G e0), + TreeSequenceInitialSegment Tstar closureTree → + TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) + closureTree + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hiStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (i : Fin ett.rounds), Fin.last ett.rounds = i.succ → i = q + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hneStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) + (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), + g ∈ MissingColors G second ch.vertex → second ch.edge = some ch.color → g ≠ ch.color + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem tnClosure.{u_1, u_2} : tnClosureStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett Tstar hTnTstar closureTree hTstarClosure + rcases hTnTstar with ⟨hlenAB, hvertexAB, hedgeAB⟩ + rcases hTstarClosure with ⟨hlenBC, hvertexBC, hedgeBC⟩ + refine ⟨Nat.le_trans hlenAB hlenBC, ?_, ?_⟩ + · intro j + calc + closureTree.vertex (Fin.castLE (Nat.succ_le_succ (Nat.le_trans hlenAB hlenBC)) j) = + closureTree.vertex + (Fin.castLE (Nat.succ_le_succ hlenBC) (Fin.castLE (Nat.succ_le_succ hlenAB) j)) := + by congr 1 + _ = Tstar.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) j) := hvertexBC _ + _ = (ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex j := hvertexAB j + · intro j + calc + closureTree.edge (Fin.castLE (Nat.le_trans hlenAB hlenBC) j) = + closureTree.edge (Fin.castLE hlenBC (Fin.castLE hlenAB j)) := + by congr 1 + _ = Tstar.edge (Fin.castLE hlenAB j) := hedgeBC _ + _ = (ett.series.data.tree (Fin.last ett.rounds).castSucc).edge j := hedgeAB j + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hi.{u_1, u_2} : hiStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q i htarget + apply Fin.ext + have hv : ett.rounds = i.val + 1 := by simpa using congrArg Fin.val htarget + change i.val = ett.rounds - 1 + omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hne.{u_1, u_2} : hneStatement.{u_1, u_2} := by + classical + intro V E _ _ G k e0 X C phi ch g second hgSecond hedgeSecond heq + have hpresent : g ∈ PresentColors G second ch.vertex := by + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨ch.edge, ch.edgeIncident, by simpa [heq] using hedgeSecond⟩ + have hnotPresent : g ∉ PresentColors G second ch.vertex := by simpa [MissingColors] using hgSecond + exact hnotPresent hpresent + +end GoldbergSeymour.SharedFacts.RevisitingTerminalPreparation + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveDeletedTreePair.lean b/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveDeletedTreePair.lean new file mode 100644 index 0000000000..72460a125b --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveDeletedTreePair.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import Mathlib.Combinatorics.SimpleGraph.Init +public import Mathlib.Data.Fintype.Card +public import Mathlib.Tactic.Bound.Init + +/-! +# Shared facts for ScheideDefectiveDeletedTreePair + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ScheideDefectiveDeletedTreePair + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev adjoinVertexSetStatement.{u_1, u_2} : Prop := + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : + LooplessMultigraph V E) (e0 : E) (A B : TreeSequence G e0) (f : E) (x y : V), G.ends f = + s(x, y) → y ∉ TreeSequenceVertexSet A → TreeSequenceAdjoinEdge A f B → + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem adjoin_vertex_set.{u_1, u_2} : adjoinVertexSetStatement.{u_1, u_2} := by + classical + intro V E _ G e0 A B f x y hxy hyA hAB + rcases hAB with ⟨hlen, hinit, hlast⟩ + rcases hinit with ⟨hle, hvertices, hedges⟩ + have holdSubset : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by + intro v hv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] at hv ⊢ + obtain ⟨q, hq⟩ := hv + refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ + rw [hvertices] + exact hq + have hyB : y ∈ TreeSequenceVertexSet B := by + let q : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) + obtain ⟨a, ha⟩ := B.attaches q + have hyEnds : y ∈ G.ends (B.edge q) := by + rw [hlast, hxy] + simp + rw [ha] at hyEnds + rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨q.succ, hynew.symm⟩ + · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, + true_and] + exact ⟨Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt)), + hyold.symm⟩ + have hinsert : insert y (TreeSequenceVertexSet A) ⊆ + TreeSequenceVertexSet B := by + intro v hv + simp only [Finset.mem_insert] at hv + rcases hv with rfl | hv + · exact hyB + · exact holdSubset hv + have hAcard : (TreeSequenceVertexSet A).card = A.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + A.vertex_injective] + have hBcard : (TreeSequenceVertexSet B).card = B.length + 1 := by + simp [TreeSequenceVertexSet, Finset.card_image_of_injective, + B.vertex_injective] + have hcard : (TreeSequenceVertexSet B).card ≤ + (insert y (TreeSequenceVertexSet A)).card := by + rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] + exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm + +end GoldbergSeymour.SharedFacts.ScheideDefectiveDeletedTreePair + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveNoCross.lean b/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveNoCross.lean new file mode 100644 index 0000000000..3312b1d442 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveNoCross.lean @@ -0,0 +1,45 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeIncidentEdge +public import Mathlib.Combinatorics.SimpleGraph.Init +public import Mathlib.Data.Fintype.EquivFin +public import Mathlib.Tactic.Bound.Init + +/-! +# Shared facts for ScheideDefectiveNoCross + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ScheideDefectiveNoCross + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev treeEdgeIncidentStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] + (G : LooplessMultigraph V E) (e0 : E) (T : TreeSequence G e0) (q : Fin T.length), + TreeIncidentEdge T (T.edge q) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem tree_edge_incident.{u_1, u_2} : treeEdgeIncidentStatement.{u_1, u_2} := by + classical + intro V E _ _ G e0 T q + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨a, ha⟩ := T.attaches q + refine ⟨T.vertex q.succ, ?_, ?_⟩ + · simp [TreeSequenceVertexSet] + · simp [Incident, ha] + +end GoldbergSeymour.SharedFacts.ScheideDefectiveNoCross + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveThirdBoundaryEdge.lean b/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveThirdBoundaryEdge.lean new file mode 100644 index 0000000000..67e64cd608 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveThirdBoundaryEdge.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge + +/-! +# Shared facts for ScheideDefectiveThirdBoundaryEdge + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ScheideDefectiveThirdBoundaryEdge + +open scoped Sym2 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev tashkinovAdjoinStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))) (_ : + ScheideDefectiveReturnData G k e0 phi T C D d) (rho : PartialEdgeColoring E k) (S U : + TreeSequence G e0) (f : E), TreeSequenceAdjoinEdge S f U → TashkinovTree G e0 rho S → + ∀ (c : Fin k), rho f = some c → + ∀ v ∈ TreeSequenceVertexSet S, c ∈ MissingColors G rho v → TashkinovTree G e0 rho U + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem tashkinov_adjoin.{u_1, u_2} : tashkinovAdjoinStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 phi T C D d R rho S U f hadjoin hS c hf v hv hmiss + rcases hadjoin with ⟨hlen, hinitial, hlast⟩ + rcases hinitial with ⟨hle, hvert, hedge⟩ + intro q hq + by_cases hold : q.val < S.length + · let qS : Fin S.length := ⟨q.val, hold⟩ + obtain ⟨a, color, hcolor, hcolorMissing⟩ := + hS qS (by simpa [qS] using hq) + let aU : Fin (q.val + 1) := ⟨a.val, by simpa [qS] using a.isLt⟩ + refine ⟨aU, color, ?_, ?_⟩ + · have hqeq : Fin.castLE hle qS = q := by + apply Fin.ext + rfl + have hUedge : U.edge q = S.edge qS := by + rw [← hqeq] + exact hedge qS + rw [hUedge] + exact hcolor + · let oldVertexIndex : Fin (S.length + 1) := + Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ qS.isLt)) + let newVertexIndex : Fin (U.length + 1) := + Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) oldVertexIndex = + newVertexIndex := by + apply Fin.ext + rfl + have hvertex : U.vertex newVertexIndex = S.vertex oldVertexIndex := by + rw [← hindex] + exact hvert oldVertexIndex + simpa [oldVertexIndex, newVertexIndex] using + hvertex.symm ▸ hcolorMissing + · have hqval : q.val = S.length := by + have hqbound : q.val < S.length + 1 := by simpa [hlen] using q.isLt + omega + obtain ⟨a, ha⟩ : ∃ a : Fin (S.length + 1), S.vertex a = v := by + simpa [TreeSequenceVertexSet] using hv + let aU : Fin (q.val + 1) := ⟨a.val, by simpa [hqval] using a.isLt⟩ + refine ⟨aU, c, ?_, ?_⟩ + · have hqlast : q = Fin.cast hlen.symm (Fin.last S.length) := by + apply Fin.ext + simpa using hqval + rw [hqlast, hlast] + exact hf + · let newVertexIndex : Fin (U.length + 1) := + Fin.castLT aU (Nat.lt_trans aU.isLt (Nat.succ_lt_succ q.isLt)) + have hindex : Fin.castLE (Nat.succ_le_succ hle) a = + newVertexIndex := by + apply Fin.ext + rfl + have hvertex : U.vertex newVertexIndex = v := by + rw [← hindex, hvert a, ha] + simpa [newVertexIndex, hvertex] using hmiss + +end GoldbergSeymour.SharedFacts.ScheideDefectiveThirdBoundaryEdge + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ScheideDeletedMissingReplacementInternal.lean b/LeanPool/GoldbergSeymour/SharedFacts/ScheideDeletedMissingReplacementInternal.lean new file mode 100644 index 0000000000..c220d4768b --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ScheideDeletedMissingReplacementInternal.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideDefectiveSetup +public import LeanPool.GoldbergSeymour.TwoColorComponentSwap + +/-! +# Shared facts for ScheideDeletedMissingReplacementInternal + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ScheideDeletedMissingReplacementInternal + +open scoped Sym2 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev phiDAlpha0Statement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (C : ScheideReducedConfiguration G k e0 phi T) (D : ScheideDefectiveSetup G k e0 phi + T C) (d : ↥(DefectiveColors G phi (TreeSequenceVertexSet T))), + let gamma : Fin k := C.gamma (D.gammaIndex d); + let phiD : PartialEdgeColoring E k := TwoColorComponentSwap G phi gamma (↑d : Fin k) (Sum.inl + (D.v0 d)); gamma ≠ (↑d : Fin k) → D.alpha0 ≠ gamma → D.alpha0 ≠ (↑d : Fin k) → + ∀ (f : E), phiD f = some D.alpha0 ↔ phi f = some D.alpha0 + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem phiDAlpha0.{u_1, u_2} : phiDAlpha0Statement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T C D d gamma phiD hGammaDelta hAlpha0Gamma hAlpha0Delta f + simp only [phiD, TwoColorComponentSwap] + by_cases hf : Sum.inr f ∈ + TwoColorComponent G phi gamma d.1 (Sum.inl (D.v0 d)) + · by_cases hfg : phi f = some gamma + · simp only [hf, ite_eq_left, hfg, Option.some.injEq] + constructor + · intro h + exact False.elim (hAlpha0Delta h.symm) + · intro h + exact False.elim (hAlpha0Gamma h.symm) + · by_cases hfd : phi f = some d.1 + · simp [hf, hfd, hGammaDelta.symm, hAlpha0Gamma.symm, hAlpha0Delta.symm] + · simp [hf, hfg, hfd] + · simp [hf] + +end GoldbergSeymour.SharedFacts.ScheideDeletedMissingReplacementInternal + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ScheideHeightFiveGammaEdges.lean b/LeanPool/GoldbergSeymour/SharedFacts/ScheideHeightFiveGammaEdges.lean new file mode 100644 index 0000000000..b35c723ba8 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ScheideHeightFiveGammaEdges.lean @@ -0,0 +1,146 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.NormalGlobalMaximumTriple +public import Mathlib.Data.Rat.Cast.Order +public import Mathlib.Tactic.NormNum.Abs +public import Mathlib.Tactic.NormNum.DivMod +public import Mathlib.Tactic.NormNum.OfScientific +public import Mathlib.Tactic.NormNum.Pow + +/-! +# Shared facts for ScheideHeightFiveGammaEdges + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ScheideHeightFiveGammaEdges + +open scoped Sym2 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hqendsStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let q : E := N.closingEdge; G.ends q = s(y4, y0) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev ha3qneStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r3 : Fin T.length := (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a3 : E := T.edge r3; + let q : E := N.closingEdge; y0 ≠ y3 → y3 ≠ y4 → G.ends a3 = s(y3, y4) → G.ends q = s(y4, y0) → + a3 ≠ q + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hqa2Statement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence + G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)), + let y0 : V := T.vertex (⟨(0 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y2 : V := T.vertex (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y3 : V := T.vertex (⟨(3 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let y4 : V := T.vertex (⟨(4 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ + by omega + ⟩ : Fin (T.length + (1 : ℕ))); + let r2 : Fin T.length := (⟨(2 : ℕ), + have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a + : ¬(2 : ℕ) < T.length) ↦ + by omega + ⟩ : Fin T.length); + let a2 : E := T.edge r2; + let q : E := N.closingEdge; y2 ≠ y4 → y3 ≠ y4 → G.ends a2 = s(y2, y3) → G.ends q = s(y4, y0) → + q ≠ a2 + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hqends.{u_1, u_2} : hqendsStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y4 q + have hlast : N.lastIndex = ⟨4, by have := N.height_upper; omega⟩ := by + apply Fin.ext + have := N.lastIndex_height + simp + rw [hNheight] at this + omega + simpa [q, y0, y4, hlast] using N.closing_ends + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem ha3qne.{u_1, u_2} : ha3qneStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y3 y4 r3 a3 q hy03 hy34 ha3ends hqends h + have hpairs : s(y3, y4) = s(y4, y0) := by + rw [← ha3ends, h, hqends] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hy34 hd.1 + · exact hy03 hs.1.symm + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hqa2.{u_1, u_2} : hqa2Statement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T N hNheight y0 y2 y3 y4 r2 a2 q hy24 hy34 ha2ends hqends h + have hpairs : s(y4, y0) = s(y2, y3) := by + rw [← hqends, h, ha2ends] + rcases Sym2.eq_iff.mp hpairs with hd | hs + · exact hy24 hd.1.symm + · exact hy34 hs.1.symm + +end GoldbergSeymour.SharedFacts.ScheideHeightFiveGammaEdges + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ScheideSelectedBlockDeletion.lean b/LeanPool/GoldbergSeymour/SharedFacts/ScheideSelectedBlockDeletion.lean new file mode 100644 index 0000000000..720bdda8d5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ScheideSelectedBlockDeletion.lean @@ -0,0 +1,171 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.ScheideReducedConfiguration + +/-! +# Shared facts for ScheideSelectedBlockDeletion + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ScheideSelectedBlockDeletion + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev edgeClassGlobalStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (phi : PartialEdgeColoring E k) (T : TreeSequence G e0) + (C : ScheideReducedConfiguration G k e0 phi T) (i : Fin C.s) (hi : (↑i : ℕ) < C.s) + (hp : (2 : ℕ) ≤ C.p) (hl : T.length + (1 : ℕ) = C.p + (2 : ℕ) * C.s) + (hn : (3 : ℕ) ≤ T.length), + let m : ℕ := C.p + (2 : ℕ) * (↑i : ℕ); + let d : ℕ := C.p - (1 : ℕ) + (2 : ℕ) * (↑i : ℕ); + let rV : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → Fin (T.length + (1 : ℕ)) := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => + if h : (↑q : ℕ) < m then + (⟨(↑q : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length + (1 : ℕ)) => by + omega⟩ : + Fin (T.length + (1 : ℕ))) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length + (1 : ℕ)) => + by omega⟩ : + Fin (T.length + (1 : ℕ))); + let rE : Fin (T.length - (2 : ℕ)) → Fin T.length := + fun (q : Fin (T.length - (2 : ℕ))) => + if _ : (↑q : ℕ) < d then + (⟨(↑q : ℕ), Decidable.byContradiction fun (a : ¬(↑q : ℕ) < T.length) => by omega⟩ : + Fin T.length) + else + (⟨(↑q : ℕ) + (2 : ℕ), + Decidable.byContradiction fun (a : ¬(↑q : ℕ) + (2 : ℕ) < T.length) => by + omega⟩ : + Fin T.length); + (∀ (q : Fin (T.length - (2 : ℕ))), + (↑(rE q) : ℕ) = if (↑q : ℕ) < d then (↑q : ℕ) else (↑q : ℕ) + (2 : ℕ)) → + m + (1 : ℕ) ≤ T.length → + d + (1 : ℕ) < T.length → + ∀ + (hfirst : + rE + (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by + omega⟩ : + Fin (T.length - (2 : ℕ))) = + (⟨(0 : ℕ), T.positive⟩ : Fin T.length)), + let nv : Fin (T.length - (2 : ℕ) + (1 : ℕ)) → V := + fun (q : Fin (T.length - (2 : ℕ) + (1 : ℕ))) => T.vertex (rV q); + let ne : Fin (T.length - (2 : ℕ)) → E := fun (q : Fin (T.length - (2 : ℕ))) => + T.edge (rE q); + ∀ (nv_inj : Function.Injective nv) (ne_inj : Function.Injective ne) + (hatt : + ∀ (q : Fin (T.length - (2 : ℕ))), + ∃ (a : Fin ((↑q : ℕ) + (1 : ℕ))), + G.ends (ne q) = + s(nv q.succ, nv (a.castLT (Nat.lt_trans a.isLt (Nat.succ_lt_succ q.isLt))))), + let S : TreeSequence G e0 := + { length := T.length - (2 : ℕ), + positive := + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) => by omega, + vertex := nv, edge := ne, vertex_injective := nv_inj, edge_injective := ne_inj, + first_edge := + have he : + rE + (⟨(0 : ℕ), + Decidable.byContradiction fun (a : ¬(0 : ℕ) < T.length - (2 : ℕ)) => by + omega⟩ : + Fin (T.length - (2 : ℕ))) = + (⟨(0 : ℕ), T.positive⟩ : Fin T.length) := + hfirst; + id + (Eq.mpr (id (congrArg (fun (_a : Fin T.length) => T.edge _a = e0) he)) + T.first_edge), + attaches := hatt : TreeSequence G e0 }; + ∀ (q : Fin (T.length - (2 : ℕ))), + (∃ (a : Fin (C.p - (1 : ℕ))), (↑q : ℕ) = (↑a : ℕ) ∧ S.edge q = C.baseEdge a) ∨ + ∃ (r : Fin C.s) (j : Fin (2 : ℕ)), + r ≠ i ∧ C.p - (1 : ℕ) ≤ (↑q : ℕ) ∧ S.edge q = C.blockEdge r j + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem edge_class_global.{u_1, u_2} : edgeClassGlobalStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 phi T C i hi hp hl hn m d rV rE rE_val hm hd hfirst nv ne nv_inj ne_inj + hatt S q + by_cases hq : q.val < d + · by_cases hb : q.val < C.p - 1 + · left + refine ⟨⟨q.val, hb⟩, rfl, ?_⟩ + have he : rE q = ⟨q.val, by omega⟩ := by + apply Fin.ext + rw [rE_val] + simp [hq] + change T.edge (rE q) = C.baseEdge ⟨q.val, hb⟩ + rw [he] + exact C.base_edge_position ⟨q.val, hb⟩ + · right + let x := q.val - (C.p - 1) + let rr := x / 2 + let jj := x % 2 + have hx : q.val = C.p - 1 + x := by dsimp [x]; omega + have hj : jj < 2 := by dsimp [jj]; omega + have hr : rr < C.s := by + dsimp [rr, x] + omega + let r : Fin C.s := ⟨rr, hr⟩ + let j : Fin 2 := ⟨jj, hj⟩ + have hri : r.val < i.val := by dsimp [r, rr, x]; omega + refine ⟨r, j, ?_, ?_, ?_⟩ + · intro h + exact (Nat.ne_of_lt hri) (congrArg Fin.val h) + · omega + · have he : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply Fin.ext + rw [rE_val] + simp [hq] + dsimp [r, j, rr, jj] + omega + change T.edge (rE q) = C.blockEdge r j + rw [he] + exact C.block_edge_position r j + · right + let x := q.val + 2 - (C.p - 1) + let rr := x / 2 + let jj := x % 2 + have hx : q.val + 2 = C.p - 1 + x := by dsimp [x]; omega + have hdiv : x = 2 * rr + jj := by dsimp [rr, jj]; omega + have hj : jj < 2 := by dsimp [jj]; omega + have hr : rr < C.s := by + dsimp [rr, x] + omega + let r : Fin C.s := ⟨rr, hr⟩ + let j : Fin 2 := ⟨jj, hj⟩ + have hri : i.val < r.val := by + dsimp [r, rr, x] + omega + refine ⟨r, j, ?_, ?_, ?_⟩ + · intro heq + exact (Nat.ne_of_gt hri) (congrArg Fin.val heq) + · omega + · have he : rE q = ⟨C.p - 1 + 2 * r.val + j.val, by omega⟩ := by + apply Fin.ext + rw [rE_val] + simp only [ite_eq_right hq] + dsimp [r, j, rr, jj] + omega + change T.edge (rE q) = C.blockEdge r j + rw [he, C.block_edge_position] + +end GoldbergSeymour.SharedFacts.ScheideSelectedBlockDeletion + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/SecondSituationTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/SecondSituationTransport.lean new file mode 100644 index 0000000000..29de91a816 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/SecondSituationTransport.lean @@ -0,0 +1,409 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.BaseDisplayedEdges +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.TwoColorComponentSwapMissingBehavior + +/-! +# Shared facts for HierarchySituationTwoSubcaseThreeTwo + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.SecondSituationTransport + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev apositiveStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev aTStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev aBStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (2 : ℕ) ≤ T.length - A.length → + B.length + (1 : ℕ) = T.length → + ((0 : ℕ) < H.dividerCount → + A = + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + TreeSequenceInitialSegment A T → + TreeSequenceInitialSegment A B + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstWitnessStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (rho : PartialEdgeColoring E k) + (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev missingSubsetStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (rho : PartialEdgeColoring E k) {X Y : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeMissingColors rho X ⊆ TreeMissingColors rho Y + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstPreservedStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let B : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + TreeSequenceInitialSegment B T → + (∀ (rho : PartialEdgeColoring E k) (X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ c ∈ TreeMissingColors rho X, + c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)) ∧ + (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ X.length) → + ∀ (rho sigma : PartialEdgeColoring E k) (c : Fin k), + ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → + (∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G rho v) → + c ∈ TreeMissingColors rho B → + HierarchyFirstMissingPosition sigma T c = HierarchyFirstMissingPosition rho T c + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstUnaffectedStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (T : TreeSequence G e0) (z : V ⊕ E) (rho : PartialEdgeColoring E k) + (a b c : Fin k), + a ≠ b → + IsProperEdgeColoring G rho → + c ≠ a → + c ≠ b → + HierarchyFirstMissingPosition (TwoColorComponentSwap G rho a b z) T c = + HierarchyFirstMissingPosition rho T c + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev comparableInitialSegmentsStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y F : TreeSequence G e0}, + TreeSequenceInitialSegment X F → + TreeSequenceInitialSegment Y F → + X.length ≤ Y.length → + TreeSequenceInitialSegment X Y + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev predecessorIncidentStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) + (e0 : E) (T X : TreeSequence G e0), + TreeSequenceInitialSegment X T → + ∀ (t : Fin T.length), + (↑t : ℕ) = X.length → + TreeIncidentEdge X (T.edge t) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev seedStableStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → + K.dividerCount = (0 : ℕ) → + StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) + (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev weakEdgesStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0) + {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) + (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) + (K : TashkinovHierarchy ett' base'), + HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → + IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), + new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = + old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstAfterStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + TreeSequenceInitialSegment A T → + ∀ (rho : PartialEdgeColoring E k), + ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), + c ∉ TreeMissingColors rho A → + A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem apositive.{u_1, u_2} : apositiveStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hq + have hi : q = (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp [q] + omega + change HierarchyStarredStage H q = _ + rw [hi] + simp only [HierarchyStarredStage, Fin.cases_succ] + congr 1 + apply Fin.ext + simp + omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem aT.{u_1, u_2} : aTStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hApositive hAzero + by_cases hz : H.dividerCount = 0 + · have hi : (⟨1, by omega⟩ : Fin (H.dividerCount + 2)) = + Fin.last (H.dividerCount + 1) := by apply Fin.ext; simp [hz] + simpa [hAzero hz, hi, H.terminalStage] using H.coreInsideFirst + · rw [hApositive (Nat.pos_of_ne_zero hz)] + have hi : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) = + q.castSucc := Fin.ext rfl + have hj : H.stage q.succ = T := by + convert H.terminalStage using 1 + congr 1 + simpa only [hi, hj] using H.nested q + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem aB.{u_1, u_2} : aBStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A B htail hBlen hApositive hAzero hAT + refine ⟨by omega, ?_, ?_⟩ + · intro i + exact hAT.2.1 i + · intro i + exact hAT.2.2 i + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstWitness.{u_1, u_2} : firstWitnessStatement.{u_1, u_2} := by + classical + intro V E _ _ G k e0 T rho X hXT c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + rcases Finset.mem_biUnion.mp hc with ⟨v, hv, hvc⟩ + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + rcases hv with ⟨i, rfl⟩ + let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex j) + have hi : Fin.castLE (Nat.succ_le_succ hXT.1) i ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [hXT.2.1 i] + exact hvc + have hn : candidates.Nonempty := ⟨_, hi⟩ + have hm := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + have hle := Finset.min'_le candidates _ hi + have hib := i.isLt + unfold HierarchyFirstMissingPosition + change (c ∈ MissingColors G rho (T.vertex (if h : candidates.Nonempty then + candidates.min' h else Fin.last T.length))) ∧ _ + rw [dite_eq_left hn] + refine ⟨hm, ?_⟩ + change (candidates.min' hn).val ≤ i.val at hle + omega + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem missingSubset.{u_1, u_2} : missingSubsetStatement.{u_1, u_2} := by + classical + intro V E _ _ G k e0 rho X Y hXY + let _ := Fintype.ofFinite V + as_aux_lemma => + intro c hc + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr + ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hm⟩ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstPreserved.{u_1, u_2} : firstPreservedStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C B hBT firstWitness rho sigma c helem hmiss hc + as_aux_lemma => + clear_value B + clear * - G T B rho sigma c helem hmiss hc firstWitness hBT + have hr := firstWitness rho B hBT c hc + have hc' : c ∈ TreeMissingColors sigma B := by + obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc + exact Finset.mem_biUnion.mpr ⟨v, hv, (hmiss v hv).symm ▸ hm⟩ + have hs := firstWitness sigma B hBT c hc' + have pref (i : Fin (T.length + 1)) (hi : i.val ≤ B.length) : + T.vertex i ∈ TreeSequenceVertexSet B := by + let j : Fin (B.length + 1) := ⟨i.val, Nat.lt_succ_of_le hi⟩ + have he : Fin.castLE (Nat.succ_le_succ hBT.1) j = i := Fin.ext rfl + exact (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, (hBT.2.1 j).symm.trans (congrArg T.vertex he)⟩ + by_contra hne + have hvne : T.vertex (HierarchyFirstMissingPosition sigma T c) ≠ + T.vertex (HierarchyFirstMissingPosition rho T c) := + fun he => hne (T.vertex_injective he) + have hsOld := (hmiss _ (pref _ hs.2)) ▸ hs.1 + exact Finset.disjoint_left.mp (helem (pref _ hs.2) (pref _ hr.2) hvne) hsOld hr.1 + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstUnaffected.{u_1, u_2} : firstUnaffectedStatement.{u_1, u_2} := by + classical + intro V E _ _ G k e0 T z rho a b c hne hp hca hcb + let _ := Fintype.ofFinite V + have hb := TwoColorComponentSwapMissingBehavior G rho a b hne hp z + have he : (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G (TwoColorComponentSwap G rho a b z) (T.vertex i)) = + (Finset.univ.filter fun i : Fin (T.length + 1) => + c ∈ MissingColors G rho (T.vertex i)) := by + ext i + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + exact hb.2.2.2 _ c hca hcb + unfold HierarchyFirstMissingPosition + rw [he] + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem comparableInitialSegments.{u_1, u_2} : comparableInitialSegmentsStatement.{u_1, u_2} := by + classical + intro V E G e0 X Y F hXF hYF hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYF.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXF.2.1 i) + · intro i + exact (hYF.2.2 (Fin.castLE hXY i)).symm.trans (hXF.2.2 i) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem predecessorIncident.{u_1, u_2} : predecessorIncidentStatement.{u_1, u_2} := by + classical + intro V E _ _ G e0 T X hXT t ht + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨i, hi⟩ := T.attaches t + let j : Fin (X.length + 1) := ⟨i.val, by have := i.isLt; omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hXT.1) j = + Fin.castLE (by omega : t.val + 1 ≤ T.length + 1) i := Fin.ext rfl + refine ⟨X.vertex j, (@Finset.mem_image _ _ (Classical.decEq V)).mpr + ⟨j, Finset.mem_univ _, rfl⟩, ?_⟩ + rw [← hXT.2.1 j, he, Incident, hi] + exact Sym2.mem_mk_right _ _ + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem seedStable.{u_1, u_2} : seedStableStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 T input' rho sigma ett' base' K hw hq + have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hq + rw [hi] at hw + change (if ett'.series.data.kind (Fin.last ett'.rounds) = + some TashkinovExtensionKind.PE then _ else _) at hw + split_ifs at hw with hpe + · exact hw.1 + · exact hw + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem weakEdges.{u_1, u_2} : weakEdgesStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 T input' old new ett' base' K hw ho hno + by_cases hz : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz + rw [hi] at hw ⊢ + exact P2813_T1_BaseDisplayedEdges G k e0 input' T old ett' base' new ho hno hw + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := + Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) + rw [hi] at hw ⊢ + intro t + have hinv := hw.2 + by_cases ht : 1 ≤ t.val + · exact hinv.1 t ht + · let S := HierarchyStarredStage K + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ + have he : t = ⟨0, S.positive⟩ := Fin.ext (by change t.val = 0; omega) + rw [he, S.first_edge, hno.1, ho.1] + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstAfter.{u_1, u_2} : firstAfterStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hAT rho c hc hn + by_contra h + have hi : (HierarchyFirstMissingPosition rho T c).val ≤ A.length := Nat.le_of_not_gt h + let i : Fin (A.length + 1) := ⟨(HierarchyFirstMissingPosition rho T c).val, by omega⟩ + have he : Fin.castLE (Nat.succ_le_succ hAT.1) i = + HierarchyFirstMissingPosition rho T c := Fin.ext rfl + apply hn + refine Finset.mem_biUnion.mpr ⟨A.vertex i, (@Finset.mem_image _ _ (Classical.decEq V)).mpr ⟨i, + Finset.mem_univ _, rfl⟩, ?_⟩ + rw [← hAT.2.1 i, he] + exact hc + +end GoldbergSeymour.SharedFacts.SecondSituationTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/SecondSubcaseTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/SecondSubcaseTransport.lean new file mode 100644 index 0000000000..cfab6d111b --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/SecondSubcaseTransport.lean @@ -0,0 +1,259 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseTwoTwoData +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +/-! +# Shared facts for HierarchySituationTwoSubcaseTwoTwo + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.SecondSubcaseTransport + +/-- Shared dependent data used by more than one proof branch. -/ +abbrev hsameTwo964Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); + (∀ {c : Fin k}, + c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → c ∉ TreeMissingColors phi A) → + let Bshort : TreeSequence G e0 := + HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) = + A) → + (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStoredColorsAt H q = + HierarchyStoredColorsAt P.counterexample.hierarchy + (Fin.last P.counterexample.hierarchy.dividerCount) ∧ + ∀ eta ∈ HierarchyStoredColorsAt H q, + C.good.gamma q eta = + P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) eta) → + ∀ beta ∈ TreeMissingColors phi Bshort, + (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → + beta ∉ HierarchyStoredColorsAt H q → + (H.dividerCount = (0 : ℕ) → + beta ∈ TreeMissingColors phi A → + beta ∈ TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → + (∀ eta ∈ HierarchyStoredColorsAt H q, + beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → + beta ≠ D.alpha → + beta ≠ D.theta → + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → + T.vertex ib ∈ TreeSequenceVertexSet B → + T.vertex ib ≠ T.vertex D.penultimateVertexIndex → + T.vertex ib ≠ T.vertex D.terminalVertexIndex → + TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → + (beta ∉ TreeMissingColors phi A → + beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → + beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → + (let H : TashkinovHierarchy ett base := C.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); + have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); + have sameComponent : Prop := + TwoColorComponent G phi beta D.alpha (Sum.inl va) = + TwoColorComponent G phi beta D.alpha (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors phi Tnq ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors phi Tn ∨ + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors phi A ∧ + TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → + sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → + TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = + TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.penultimateVertexIndex)) → + let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); + let muOne : PartialEdgeColoring E k := + TwoColorComponentSwap G phi beta D.alpha z; + Disjoint + (TwoColorComponent G phi beta D.alpha + (Sum.inl (T.vertex D.terminalVertexIndex))) + (TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib))) → + TwoColorPathComponent G phi beta D.alpha z → + Sum.inl (T.vertex ib) ∉ TwoColorComponent G phi beta D.alpha z → + Sum.inl (T.vertex D.penultimateVertexIndex) ∉ + TwoColorComponent G phi beta D.alpha z → + (∀ w ∈ TreeSequenceVertexSet B, + MissingColors G (TwoColorComponentSwap G phi beta D.alpha z) w = + MissingColors G phi w) → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → + (∀ c ∈ HierarchyStoredColorsAt H q, + HierarchyFirstMissingPosition muOne T c = + HierarchyFirstMissingPosition phi T c) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < H.dividerCount ∧ + beta ∈ + TreeMissingColors phi + (H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) ∨ + H.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors phi + (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → + ∀ (corrOne : CorrespondingExtendedTashkinovTree G k e0 ett muOne T), + MaximumProperty corrOne.replacementETT → + ∀ (baseOne : HierarchyBase corrOne.replacementETT muOne) + (KOne : TashkinovHierarchy corrOne.replacementETT baseOne) + (goodOne : GoodHierarchy KOne), + SameGoodHierarchy C.good goodOne → + beta ∈ MissingColors G muOne (T.vertex D.terminalVertexIndex) → + ∀ + (POne : + HierarchyReplacementPresentation G k e0 input T phi ett base C + ctx), + POne.coloring = muOne → + let rho : PartialEdgeColoring E k := POne.coloring; + let ettOne : + ExtendedTashkinovTree G k e0 + POne.corresponding.replacementInput T POne.coloring := + POne.corresponding.replacementETT; + let baseOne' : + HierarchyBase POne.corresponding.replacementETT + POne.coloring := + POne.replacementBase; + let COne' : HierarchyCounterexample POne.replacementBase := + POne.counterexample; + let HOne : + TashkinovHierarchy POne.corresponding.replacementETT + POne.replacementBase := + COne'.hierarchy; + let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := + Fin.last HOne.dividerCount; + TreeMissingColors rho A = TreeMissingColors phi A → + beta ∉ HierarchyStoredColorsAt HOne qOne → + beta ∉ + MissingColors G rho (T.vertex D.penultimateVertexIndex) → + beta ∈ + MissingColors G rho (T.vertex D.terminalVertexIndex) → + beta ∈ MissingColors G rho (T.vertex ib) → + HierarchyFirstMissingPosition rho T beta = ib → + HierarchyFirstMissingPosition rho T D.theta = + D.penultimateVertexIndex → + (∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → + (beta ∈ TreeMissingColors phi A → + (0 : ℕ) < HOne.dividerCount ∧ + beta ∈ + TreeMissingColors rho + (HOne.stage + (⟨HOne.dividerCount, + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (HOne.dividerCount + (2 : ℕ)))) ∨ + HOne.dividerCount = (0 : ℕ) ∧ + beta ∈ + TreeMissingColors rho + (ettOne.series.data.tree + (Fin.last ettOne.rounds).castSucc)) → + beta ∈ TreeMissingColors rho B ∧ + D.theta ∈ TreeMissingColors rho B → + (let H : TashkinovHierarchy ettOne baseOne' := + COne'.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + have n : Fin (ettOne.rounds + (1 : ℕ)) := + Fin.last ettOne.rounds; + have A : TreeSequence G e0 := + HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := + H.stage + (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := + ettOne.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := + TashkinovStoredColors ettOne.series.data n; + have Dnq : Finset (Fin k) := + HierarchyStoredColorsAt H q; + have va : V := + T.vertex + (HierarchyFirstMissingPosition rho T beta); + have vb : V := + T.vertex + (HierarchyFirstMissingPosition rho T D.theta); + have sameComponent : Prop := + TwoColorComponent G rho beta D.theta + (Sum.inl va) = + TwoColorComponent G rho beta D.theta + (Sum.inl vb); + ((0 : ℕ) < H.dividerCount ∧ + (beta ∈ TreeMissingColors rho Tnq ∨ + Disjoint + (insert beta ({ D.theta } : Finset (Fin k)) : + Finset (Fin k)) + Dnq) → + sameComponent) ∧ + (H.dividerCount = (0 : ℕ) ∧ + (beta ∈ TreeMissingColors rho Tn ∨ + Disjoint + (insert beta ({ D.theta } : Finset (Fin k)) : + Finset (Fin k)) + Dn) → + sameComponent) ∧ + (beta ∈ TreeMissingColors rho A ∧ + TreeColorSetClosed G rho A + ({ beta } : Finset (Fin k)) → + sameComponent ∧ + TreeInterchangeable G A rho beta D.theta)) → + TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex ib)) = + TwoColorComponent G rho beta D.theta + (Sum.inl (T.vertex D.penultimateVertexIndex)) + +end GoldbergSeymour.SharedFacts.SecondSubcaseTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ShorteningTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/ShorteningTransport.lean new file mode 100644 index 0000000000..c78ca991b5 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ShorteningTransport.lean @@ -0,0 +1,279 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +/-! +# Shared facts for HierarchySituationOneShorteningContradiction + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ShorteningTransport + +/-- Shared dependent data used by more than one proof branch. -/ +noncomputable abbrev eB1665.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq V] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (P : + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx) → + let mu : PartialEdgeColoring E k := P.coloring; + (hlenT : (3 : ℕ) ≤ T.length) → + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + (1 : ℕ) ≤ P.corresponding.replacementETT.rounds → + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))) + B → + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + by + have := + GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin + (P.corresponding.replacementETT.rounds + + (2 : ℕ)))).length < + B.length → + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last + (P.corresponding.replacementETT.rounds + + (1 : ℕ)))) → + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last + P.corresponding.replacementETT.rounds) → + ExtendedTashkinovTree G k e0 + P.corresponding.replacementInput B mu := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B positiveB aboveB strictB + belowB generatingB + exact { + rounds := P.corresponding.replacementETT.rounds + roundsPositive := positiveB + series := P.corresponding.replacementETT.series + abovePenultimate := aboveB + strictAbovePenultimate := strictB + belowFinal := belowB + generatingColoring := generatingB } + +/-- Shared dependent data used by more than one proof branch. -/ +abbrev parallelBase5019Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); + ∀ (hTnX : TreeSequenceInitialSegment Tn X), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ + (missingTree : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U) + (minusEq : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) + (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB + aboveB strictB belowB + generatingB; + ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) + (closureBX : + ∀ (hpe : EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) + (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) + (hpe : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { + dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (terminalTree : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn) + (storedEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j), + let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last corr.replacementETT.rounds; + let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; + corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma bs.closure : Finset (Fin k)) \ + (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev transStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem trans.{u_1, u_2} : transStatement.{u_1, u_2} := by + classical + intro V E G e0 X Y Z hXY hYZ + refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +end GoldbergSeymour.SharedFacts.ShorteningTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/StableChangeCasesOneTwoSplitTail.lean b/LeanPool/GoldbergSeymour/SharedFacts/StableChangeCasesOneTwoSplitTail.lean new file mode 100644 index 0000000000..041c1dd857 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/StableChangeCasesOneTwoSplitTail.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import Mathlib.Combinatorics.SimpleGraph.Init +public import Mathlib.Tactic.Bound.Init + +/-! +# Shared facts for StableChangeCasesOneTwoSplitTail + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.StableChangeCasesOneTwoSplitTail + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev equalTreesStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {S U : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + S.length = U.length → + S = U + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem equalTrees.{u_1, u_2} : equalTreesStatement.{u_1, u_2} := by + classical + intro V E G e0 S U hSU hlen + cases S with + | mk ls ps vs es vis eis fs aas => + cases U with + | mk lu pu vu eu viu eiu fu aau => + simp only at hlen + subst lu + rw [TreeSequence.mk.injEq] + refine ⟨rfl, ?_, ?_⟩ + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.1 i).symm + · apply heq_of_eq + funext i + simpa only [Fin.castLE] using (hSU.2.2 i).symm + +end GoldbergSeymour.SharedFacts.StableChangeCasesOneTwoSplitTail + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/StoredExceptionTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/StoredExceptionTransport.lean new file mode 100644 index 0000000000..b8571ede70 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/StoredExceptionTransport.lean @@ -0,0 +1,194 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +/-! +# Shared facts for HierarchySituationTwoSubcaseOneOneStoredException + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.StoredExceptionTransport + +/-- Shared dependent data used by more than one proof branch. -/ +noncomputable abbrev selfCorr425.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + ( + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j)) → + ( + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (ett.series.data.coloring j) e0) → + CorrespondingExtendedTashkinovTree G k e0 ett phi T := by + classical + intro V E _ _ _ G k e0 input T phi ett seriesProper seriesOne + exact { + replacementInput := input + replacementSeries := ett.series + replacementETT := ett + rungAgreement := rfl + seriesPresentation := HEq.rfl + finalGeneratingColoring := ett.generatingColoring + ladderTreesAgree := fun _ => rfl + storedColorsAgree := fun _ => rfl + connectingEdgesAgree := fun _ => rfl + extensionKindsAgree := fun _ => rfl + replacementProper := seriesProper + replacementOneUncolored := seriesOne + replacementStable := fun _ => ⟨fun _ _ _ => rfl, fun _ _ => rfl⟩ } + +/-- Shared dependent data used by more than one proof branch. -/ +noncomputable abbrev p0462.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (seriesProper : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsProperEdgeColoring G (ett.series.data.coloring j)) → + (seriesOne : + ∀ (j : Fin (ett.rounds + (1 : ℕ))), + IsOneEdgeUncolored (ett.series.data.coloring j) e0) → + let _ : + CorrespondingExtendedTashkinovTree G k e0 ett phi T := + SharedFacts.StoredExceptionTransport.selfCorr425 G k e0 input T phi ett seriesProper + seriesOne; + HierarchyReplacementPresentation G k e0 input T phi ett + base C ctx := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx seriesProper seriesOne selfCorr + exact { + coloring := phi + corresponding := selfCorr + maximum := C.maximum + replacementBase := base + counterexample := C + sameGood := ⟨⟨rfl, rfl, HEq.rfl, HEq.rfl, Iff.rfl, fun _ => rfl⟩, + rfl, fun _ => ⟨rfl, fun _ _ => rfl⟩⟩ + minimumContext := ctx } + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev segmentTransStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y + Z → TreeSequenceInitialSegment X Z + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hierarchyGeometryStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (T : TreeSequence G e0), ( + ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z + → TreeSequenceInitialSegment X Z) → + ∀ {inp col : PartialEdgeColoring E k} {J : ExtendedTashkinovTree G k e0 inp T col} + {b : HierarchyBase J col} (H : TashkinovHierarchy J b), TreeSequenceInitialSegment + (HierarchyStarredStage H (Fin.last H.dividerCount)) T ∧ TreeSequenceInitialSegment + (J.series.data.tree (Fin.last J.rounds).castSucc) (HierarchyStarredStage H (Fin.last + H.dividerCount)) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem segmentTrans.{u_1, u_2} : segmentTransStatement.{u_1, u_2} := by + classical + intro V E G e0 X Y Z hXY hYZ + refine ⟨le_trans hXY.1 hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hierarchyGeometry.{u_1, u_2} : hierarchyGeometryStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 T segmentTrans inp col J b H + have forward : ∀ (a d : ℕ), (hbound : a + d ≤ H.dividerCount + 1) → + TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) + (H.stage ⟨a + d, by omega⟩) := by + intro a d + induction d with + | zero => intro h; exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + | succ d ih => + intro h + exact segmentTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) + let A := HierarchyStarredStage H (Fin.last H.dividerCount) + let Tn := J.series.data.tree (Fin.last J.rounds).castSucc + change TreeSequenceInitialSegment A T ∧ TreeSequenceInitialSegment Tn A + have hTnCore : TreeSequenceInitialSegment Tn b.core := by + by_cases hp : J.series.data.kind (Fin.last J.rounds) = + some TashkinovExtensionKind.PE + · exact (b.parallel hp).2.2.some.leftSegment + · rw [b.nonparallel hp] + exact ⟨le_rfl, (by intro i; rfl), (by intro i; rfl)⟩ + by_cases hq : H.dividerCount = 0 + · have hA : A = b.core := by + simp [A, HierarchyStarredStage, Fin.last, hq] + have hlast : H.stage ⟨1, by omega⟩ = T := by + convert H.terminalStage using 1 + apply congrArg H.stage + apply Fin.ext + simp [hq] + constructor + · rw [hA] + exact Eq.mp (congrArg (fun W : TreeSequence G e0 => + TreeSequenceInitialSegment b.core W) hlast) H.coreInsideFirst + · rw [hA] + exact hTnCore + · have hpos : 0 < H.dividerCount := Nat.pos_of_ne_zero hq + have hindex : (Fin.last H.dividerCount : Fin (H.dividerCount + 1)) = + (⟨H.dividerCount - 1, by omega⟩ : Fin H.dividerCount).succ := by + apply Fin.ext + simp + omega + have hA : A = H.stage ⟨H.dividerCount, by omega⟩ := by + dsimp [A, HierarchyStarredStage] + rw [hindex] + dsimp + apply congrArg H.stage + apply Fin.ext + simp + omega + have hlast : H.stage ⟨H.dividerCount + 1, by omega⟩ = T := H.terminalStage + have hTnStage : H.stage (0 : Fin (H.dividerCount + 2)) = Tn := H.baseStage + refine ⟨?_, ?_⟩ + · simpa [hA, hlast] using forward H.dividerCount 1 (by omega) + · simpa [hA, hTnStage] using forward 0 H.dividerCount (by omega) + +end GoldbergSeymour.SharedFacts.StoredExceptionTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/SubcaseThreeOnePreparation1.lean b/LeanPool/GoldbergSeymour/SharedFacts/SubcaseThreeOnePreparation1.lean new file mode 100644 index 0000000000..24ecaaead3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/SubcaseThreeOnePreparation1.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition +public import LeanPool.GoldbergSeymour.TreeMissingColors +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import Mathlib.Combinatorics.SimpleGraph.Init +public import Mathlib.Data.Fintype.EquivFin +public import Mathlib.Tactic.Bound.Init + +/-! +# Shared facts for Preparation1 + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.SubcaseThreeOnePreparation1 + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstMissingPositionUpperBoundStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : TreeSequence G e0) (c : Fin k) + (i : Fin (X.length + (1 : ℕ))), + c ∈ MissingColors G phi (X.vertex i) → + (↑(HierarchyFirstMissingPosition phi X c) : ℕ) ≤ (↑i : ℕ) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev firstMissingPositionWitnessStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) + (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (X : TreeSequence G e0), + ∀ c ∈ TreeMissingColors phi X, + c ∈ MissingColors G phi (X.vertex (HierarchyFirstMissingPosition phi X c)) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev initialSegmentTransitiveStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → + TreeSequenceInitialSegment X Z + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstMissingPositionUpperBound.{u_1, u_2} : + firstMissingPositionUpperBoundStatement.{u_1, u_2} := by + classical + intro V E _ _ G k e0 phi X c i hi + let _ := Fintype.ofFinite V + as_aux_lemma => + unfold HierarchyFirstMissingPosition + dsimp only + have hm : i ∈ Finset.univ.filter + (fun j => c ∈ MissingColors G phi (X.vertex j)) := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi⟩ + rw [dite_eq_left ⟨i, hm⟩] + exact Finset.min'_le _ _ hm + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem firstMissingPositionWitness.{u_1, u_2} : firstMissingPositionWitnessStatement.{u_1, + u_2} := by + classical + intro V E _ _ G k e0 phi X c hc + let _ := Fintype.ofFinite V + as_aux_lemma => + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + obtain ⟨i, _, rfl⟩ := (@Finset.mem_image _ _ (Classical.decEq V)).mp hv + unfold HierarchyFirstMissingPosition + dsimp only + have hm : i ∈ Finset.univ.filter + (fun j => c ∈ MissingColors G phi (X.vertex j)) := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hcv⟩ + rw [dite_eq_left ⟨i, hm⟩] + exact (Finset.mem_filter.mp (Finset.min'_mem _ ⟨i, hm⟩)).2 + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem initialSegmentTransitive.{u_1, u_2} : initialSegmentTransitiveStatement.{u_1, u_2} := by + classical + intro V E G e0 X Y Z hXY hYZ + refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) + +end GoldbergSeymour.SharedFacts.SubcaseThreeOnePreparation1 + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/TerminalKempeStageSwitch.lean b/LeanPool/GoldbergSeymour/SharedFacts/TerminalKempeStageSwitch.lean new file mode 100644 index 0000000000..3d861f670e --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/TerminalKempeStageSwitch.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation + +/-! +# Shared facts for TerminalKempeStageSwitch + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.TerminalKempeStageSwitch + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hsoneStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (R : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ b → + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl + (T.vertex (Fin.last T.length))); IsOneEdgeUncolored sigma e0 + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hsone.{u_1, u_2} : hsoneStatement.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx R a b hne sigma + refine ⟨?_, ?_⟩ + · simp [sigma, TwoColorComponentSwap, R.minimumContext.oneEdgeUncolored.1] + · intro e he + obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 e he + by_cases hm : Sum.inr e ∈ TwoColorComponent G R.coloring a b + (Sum.inl (T.vertex (Fin.last T.length))) + · by_cases hca : c = a + · subst c; exact ⟨b, by simp [sigma, TwoColorComponentSwap, hm, hc]⟩ + · by_cases hcb : c = b + · subst c; exact ⟨a, by simp [sigma, TwoColorComponentSwap, hm, hc, hne.symm]⟩ + · exact ⟨c, by simp [sigma, TwoColorComponentSwap, hm, hc, hca, hcb]⟩ + · exact ⟨c, by simp [sigma, TwoColorComponentSwap, hm, hc]⟩ + +end GoldbergSeymour.SharedFacts.TerminalKempeStageSwitch + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/TerminalRebuild.lean b/LeanPool/GoldbergSeymour/SharedFacts/TerminalRebuild.lean new file mode 100644 index 0000000000..cc85659b75 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/TerminalRebuild.lean @@ -0,0 +1,513 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.StableColoringEquivalence +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree + +/-! +# Shared facts for TerminalSeriesRebuildPreparation + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.TerminalRebuild + +/-- Shared dependent data used by more than one proof branch. -/ +noncomputable abbrev newChoice2409.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (hpositive : (0 : ℕ) < ett.rounds) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → + (choice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) → + (sigmaPrev : PartialEdgeColoring E k) → + IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → + StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev → + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color → + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color → + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev sigmaPrev → + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf + exact { + selected := sigmaPrev + selectedProper := hsigmaPrevProper + selectedOneUncolored := hsigmaPrevOne + selectedStable := hsigmaPrevSelf + vertex := choice.vertex + vertexDefective := ⟨choice.vertexDefective.1, choice.edge, + ⟨choice.color, hchoiceDefective, hchoiceEdgeNew⟩, + choice.edgeIncident⟩ + maximal := by + intro pi w hpiProper hpiOne hpiStable hw + have hpiOld : StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) pi := by + exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc)).trans + (x := ⟨ett.series.data.coloring q.castSucc, + ⟨previousProper, previousOneUncolored⟩⟩) + (y := ⟨sigmaPrev, ⟨hsigmaPrevProper, hsigmaPrevOne⟩⟩) + (z := ⟨pi, ⟨hpiProper, hpiOne⟩⟩) + hsigmaPrevStableQ hpiStable + exact choice.maximal pi w hpiProper hpiOne hpiOld hw + edge := choice.edge + edgeDefective := ⟨choice.color, hchoiceDefective, hchoiceEdgeNew⟩ + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := choice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := (Finset.mem_filter.mp hchoiceEdgeNew).2 } + +/-- Shared dependent data used by more than one proof branch. -/ +noncomputable abbrev replacementChoice3411.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [ Fintype V] → + [ Fintype E] → + [ DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (generating : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T generating) → + (hpositive : (0 : ℕ) < ett.rounds) → + let q : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin ett.rounds); + (previousProper : + IsProperEdgeColoring G + (ett.series.data.coloring q.castSucc)) → + (previousOneUncolored : + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) + e0) → + (choice : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc)) → + (sigmaPrev : PartialEdgeColoring E k) → + (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) → + (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) → + (hsigmaPrevStableQ : + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + (ett.series.data.coloring q.castSucc) + sigmaPrev) → + (hchoiceDefective : + DefectiveColor G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color) → + (hchoiceEdgeNew : + choice.edge ∈ + BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + choice.color) → + (hsigmaPrevSelf : + StableColoring + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev sigmaPrev) → + let _ : + MaximumDefectiveChoice G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data + q.castSucc) + sigmaPrev := + SharedFacts.TerminalRebuild.newChoice2409 G k e0 input T + generating ett hpositive previousProper + previousOneUncolored choice sigmaPrev + hsigmaPrevProper hsigmaPrevOne + hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf; + (originalPrefix : + ExtendedTashkinovTree G k e0 input + (ett.series.data.tree + (Fin.last ett.rounds).castSucc) + (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := + GoldbergSeymour.TreeSequence.positive + T + omega⟩ : + Fin (ett.rounds + (1 : ℕ))))) → + (corr : + CorrespondingExtendedTashkinovTree G k + e0 originalPrefix sigmaPrev + (ett.series.data.tree + (Fin.last ett.rounds).castSucc)) → + corr.replacementSeries.data.coloring + (Fin.last originalPrefix.rounds) = + sigmaPrev → + let replacementLast : + Fin + (originalPrefix.rounds + (1 : ℕ)) := + Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree + replacementLast.succ = + ett.series.data.tree + q.succ.castSucc → + TashkinovStoredColors + corr.replacementSeries.data + replacementLast = + TashkinovStoredColors + ett.series.data q.castSucc → + MaximumDefectiveChoice G e0 + (corr.replacementSeries.data.tree + replacementLast.succ) + (TashkinovStoredColors + corr.replacementSeries.data + replacementLast) + (corr.replacementSeries.data.coloring + replacementLast) := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored + choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective + hchoiceEdgeNew hsigmaPrevSelf newChoice originalPrefix corr hcorrFinalColor replacementLast + hreplacementCurrentTree hreplacementStored + exact { + selected := sigmaPrev + selectedProper := hsigmaPrevProper + selectedOneUncolored := hsigmaPrevOne + selectedStable := by + rw [hreplacementCurrentTree, hreplacementStored, hcorrFinalColor] + exact newChoice.selectedStable + vertex := choice.vertex + vertexDefective := by + rw [hreplacementCurrentTree] + exact newChoice.vertexDefective + maximal := by + intro pi w hpiProper hpiOne hpiStable hw + rw [hreplacementCurrentTree, hreplacementStored, hcorrFinalColor] + at hpiStable + rw [hreplacementCurrentTree] at hw ⊢ + exact newChoice.maximal pi w hpiProper hpiOne hpiStable hw + edge := choice.edge + edgeDefective := by + rw [hreplacementCurrentTree] + exact newChoice.edgeDefective + edgeIncident := choice.edgeIncident + otherEndpoint := choice.otherEndpoint + otherOutside := by + rw [hreplacementCurrentTree] + exact newChoice.otherOutside + edgeEnds := choice.edgeEnds + color := choice.color + edgeColor := newChoice.edgeColor } + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hdeltaBoundaryStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → + IsOneEdgeUncolored sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) + (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) + choice.selected sigmaPrev → BoundaryColorEdges G choice.selected (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color = BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hclosedPrevStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by omega + ⟩ : Fin ett.rounds); IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → + IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → ColoredVertexSetClosed G + (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) → + ∀ (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → IsOneEdgeUncolored + sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) + sigmaPrev → ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hchoiceDefectiveStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color = + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color → DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hchoiceEdgeNewStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), BoundaryColorEdges G choice.selected + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color = + BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree + q.succ.castSucc)) choice.color → choice.edge ∈ BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hnotStrongPrevStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); + ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) + (sigmaPrev : PartialEdgeColoring E k), DefectiveColor G sigmaPrev (TreeSequenceVertexSet + (ett.series.data.tree q.succ.castSucc)) choice.color → ¬ColoredVertexSetStronglyClosed G + sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev hreplacementCurrentTreeStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → + ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input + (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring + (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 + originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), + corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = + ett.series.data.tree (Fin.last ett.rounds).castSucc → + let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; + corr.replacementSeries.data.tree replacementLast.succ = ett.series.data.tree + q.succ.castSucc + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hdeltaBoundary.{u_1, u_2} : hdeltaBoundaryStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hsigmaPrevProper + hsigmaPrevOne hsigmaPrevEnlarged + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + constructor + · rintro ⟨hf, hfc⟩ + refine ⟨hf, ?_⟩ + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have hinc : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + refine ⟨x, hx, ?_⟩ + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + exact (hsigmaPrevEnlarged.1 f hinc + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), hfc⟩).trans hfc + · rintro ⟨hf, hfc⟩ + refine ⟨hf, ?_⟩ + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have hinc : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + refine ⟨x, hx, ?_⟩ + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + have hcriterion := (sc1 G e0 + (ett.series.data.tree q.succ.castSucc) + (insert choice.color + (TashkinovStoredColors ett.series.data q.castSucc)) + choice.selected sigmaPrev choice.selectedProper + choice.selectedOneUncolored hsigmaPrevProper hsigmaPrevOne).mp + hsigmaPrevEnlarged + exact (hcriterion f hinc (Or.inr + ⟨choice.color, Finset.mem_union_right _ + (Finset.mem_insert_self _ _), hfc⟩)).symm.trans hfc + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hclosedPrev.{u_1, u_2} : hclosedPrevStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper + previousOneUncolored previousClosed sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ + f c v hf hv hsf hcm + obtain ⟨x, hx, y, hy, hends⟩ := by + simpa [BoundaryEdges] using hf + have hinc : TreeIncidentEdge + (ett.series.data.tree q.succ.castSucc) f := by + refine ⟨x, hx, ?_⟩ + unfold Incident + rw [hends] + exact Sym2.mem_mk_left _ _ + have hmissingEq := hsigmaPrevStableQ.2 v hv + have hcTree : c ∈ TreeMissingColors + (ett.series.data.coloring q.castSucc) + (ett.series.data.tree q.succ.castSucc) := by + simp only [TreeMissingColors, Finset.mem_biUnion] + exact ⟨v, hv, hmissingEq ▸ hcm⟩ + have hcriterion := (sc1 G e0 + (ett.series.data.tree q.succ.castSucc) + (TashkinovStoredColors ett.series.data q.castSucc) + (ett.series.data.coloring q.castSucc) sigmaPrev previousProper + previousOneUncolored hsigmaPrevProper hsigmaPrevOne).mp + hsigmaPrevStableQ + have hcopy := hcriterion f hinc + (Or.inr ⟨c, Finset.mem_union_left _ hcTree, hsf⟩) + have holdf : ett.series.data.coloring q.castSucc f = some c := + hcopy.symm.trans hsf + exact previousClosed hf hv holdf (hmissingEq ▸ hcm) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hchoiceDefective.{u_1, u_2} : hchoiceDefectiveStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hdeltaBoundary + obtain ⟨oldColor, holdDefective, holdEdge⟩ := choice.edgeDefective + have holdColor : oldColor = choice.color := by + have holdEdgeColor := (Finset.mem_filter.mp holdEdge).2 + exact Option.some.inj (holdEdgeColor.symm.trans choice.edgeColor) + subst oldColor + unfold DefectiveColor + rw [← hdeltaBoundary] + exact holdDefective + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hchoiceEdgeNew.{u_1, u_2} : hchoiceEdgeNewStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hdeltaBoundary + rw [← hdeltaBoundary] + obtain ⟨oldColor, holdDefective, holdEdge⟩ := choice.edgeDefective + have holdColor : oldColor = choice.color := by + have holdEdgeColor := (Finset.mem_filter.mp holdEdge).2 + exact Option.some.inj (holdEdgeColor.symm.trans choice.edgeColor) + simpa [holdColor] using holdEdge + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hnotStrongPrev.{u_1, u_2} : hnotStrongPrevStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev + hchoiceDefective hstrong + have hone : 1 < (BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color).card := by + have htwo : 2 ≤ (BoundaryColorEdges G sigmaPrev + (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) + choice.color).card := hchoiceDefective + omega + obtain ⟨f, hf, g, hg, hfg⟩ := Finset.one_lt_card.mp hone + have hfBoundary := (Finset.mem_filter.mp hf).1 + have hgBoundary := (Finset.mem_filter.mp hg).1 + have hfColor := (Finset.mem_filter.mp hf).2 + have hgColor := (Finset.mem_filter.mp hg).2 + exact (hstrong.2 hfBoundary hgBoundary hfg hfColor) hgColor + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem hreplacementCurrentTree.{u_1, u_2} : hreplacementCurrentTreeStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive _ q hqSucc sigmaPrev originalPrefix + corr hcorrFinalTree replacementLast + have hlastTree : replacementLast.succ = + Fin.last (originalPrefix.rounds + 1) := by + apply Fin.ext + simp [replacementLast] + rw [hlastTree, hcorrFinalTree, hqSucc] + +end GoldbergSeymour.SharedFacts.TerminalRebuild + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/TerminalRebuildTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/TerminalRebuildTransport.lean new file mode 100644 index 0000000000..d8fc163c2c --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/TerminalRebuildTransport.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree + +/-! +# Shared facts for TerminalSeriesRebuildTransport + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.TerminalRebuildTransport + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev branchStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k + e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E + k) (Tstar : TreeSequence G e0), + let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → ett.series.data.kind q.succ = some + TashkinovExtensionKind.PE → ((ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) = some + TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = + ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last + ett.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence sigma seed Tstar) → Nonempty + (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem branch.{u_1, u_2} : branchStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q hqSucc hpeKind hsimple + rcases hsimple.1 with hse | hre + · have hbad := hpeKind.symm.trans (by simpa [hqSucc] using hse) + cases hbad + · have hbad := hpeKind.symm.trans (by simpa [hqSucc] using hre) + cases hbad + +end GoldbergSeymour.SharedFacts.TerminalRebuildTransport + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/UnsupportedVertexColors.lean b/LeanPool/GoldbergSeymour/SharedFacts/UnsupportedVertexColors.lean new file mode 100644 index 0000000000..3dad552b5b --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/UnsupportedVertexColors.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeries + +/-! +# Shared facts for HkuUnsupportedVertexColors + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.UnsupportedVertexColors + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev nextSegmentStatement.{u_1, u_2} : Prop := + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] + [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) (series : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + + (1 : ℕ))) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment (series.data.tree + i.succ.castSucc) (series.data.tree i.succ.succ) + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem next_segment.{u_1, u_2} : nextSegmentStatement.{u_1, u_2} := by + classical + intro V E _ _ _ G k rounds e0 input series j i hj + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero i) hj.symm |>.elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hj + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + +end GoldbergSeymour.SharedFacts.UnsupportedVertexColors + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ZeroNonclosedTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/ZeroNonclosedTransport.lean new file mode 100644 index 0000000000..d3e364fffc --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ZeroNonclosedTransport.lean @@ -0,0 +1,43 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment +public import Mathlib.Combinatorics.SimpleGraph.Init +public import Mathlib.Tactic.Bound.Init + +/-! +# Shared facts for ChangeLemmaMixedZeroNonclosed + +These interfaces and proofs are shared across the imported proof branches. +Extracted from Wesley Pegden’s Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ZeroNonclosedTransport + +/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ +abbrev comparableInitialSegmentsStatement.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) + {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y + Z → X.length ≤ Y.length → TreeSequenceInitialSegment X Y + +/-- A common proof used by the branches of this transport or construction argument. -/ +theorem comparableInitialSegments.{u_1, u_2} : comparableInitialSegmentsStatement.{u_1, u_2} := by + classical + intro V E G e0 X Y Z hXZ hYZ hXY + refine ⟨hXY, ?_, ?_⟩ + · intro i + exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) + · intro i + exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) + +end GoldbergSeymour.SharedFacts.ZeroNonclosedTransport + +end diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean index c82d308a0e..10cfe8dfe1 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean @@ -5,12 +5,13 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 + public import LeanPool.GoldbergSeymour.HierarchySplitter public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceComponentSwap public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis -public import LeanPool.GoldbergSeymour.HierarchyCounterexample /-! # StableChangeCaseThree: supporting constructions, part 1 @@ -420,36 +421,15 @@ theorem helper_fullBase_847.{u_1, u_2} : exact ⟨corr, MaximumPropertyTransport G k e0 ett sigma hmod T corr C.maximum, baseT, rfl, rfl⟩ +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_segTrans_511.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → - TreeSequenceInitialSegment S W := by - classical - intro V E G e0 S U W hSU hUW - refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) + SharedFacts.ChangeLemmaBothOutsidePreparation1.initialSegmentTransitiveStatement.{u_1, u_2} := + SharedFacts.ChangeLemmaBothOutsidePreparation1.initialSegmentTransitive.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_commonPrefix_520.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S W → - TreeSequenceInitialSegment U W → - S.length ≤ U.length → - TreeSequenceInitialSegment S U := by - classical - intro V E G e0 S U W hSW hUW hlen - refine ⟨hlen, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) + SharedFacts.ChangeLemmaBothOutsidePreparation1.comparableInitialSegmentsStatement.{u_1, u_2} := + SharedFacts.ChangeLemmaBothOutsidePreparation1.comparableInitialSegments.{u_1, u_2} theorem helper_equalTrees_536.{u_1, u_2} : open scoped Classical in @@ -724,28 +704,11 @@ theorem helper_hout_642.{u_1, u_2} : change j.val = ia.val at hvj omega +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_outsideIndex_658.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (_ _ : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - TreeSequenceInitialSegment A T → - ∀ (i : Fin (T.length + (1 : ℕ))), - T.vertex i ∉ TreeSequenceVertexSet A → - A.length < (↑i : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A AToT i hi - by_contra h - have hle : i.val ≤ A.length := by omega - apply hi - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ + SharedFacts.ChangeLemmaBothOutsidePreparation1.missingPositionOutsidePrefixStatement.{u_1, + u_2} := + SharedFacts.ChangeLemmaBothOutsidePreparation1.missingPositionOutsidePrefix.{u_1, u_2} theorem helper_missingNotA_674.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean index 1e35b8f603..d9aa1747ec 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwo.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.BaseControl public import LeanPool.GoldbergSeymour.DisplayedEdges public import LeanPool.GoldbergSeymour.RecoloredPrefixReconstruction @@ -617,48 +618,6 @@ private theorem helper_corrData_414.{u_1, u_2} : TashkinovStoredColors old.series.data (Fin.last old.rounds) simp only [TashkinovStoredColors, storedColorsAgree, hm, hmOld] -private theorem helper_branch_267.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - ∀ {u : V}, - ett.rounds = (1 : ℕ) → - u ∈ TreeSequenceVertexSet Tn → - ∀ {v : V}, - v ∈ TreeSequenceVertexSet Tn → - u ≠ v → - Disjoint - (MissingColors G - (ett.series.data.coloring - (⟨ett.rounds - (1 : ℕ), - have this : (0 : ℕ) < ett.rounds := C.positive; - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by - omega⟩ : - Fin ett.rounds).castSucc) - u) - (MissingColors G - (ett.series.data.coloring - (⟨ett.rounds - (1 : ℕ), - have this : (0 : ℕ) < ett.rounds := C.positive; - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by - omega⟩ : - Fin ett.rounds).castSucc) - v) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C n Tn _ hn - have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = 0 := - Fin.ext (by simp [hn]) - have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := - Fin.ext (by simp [n, hn]) - dsimp only [Tn] - rw [hcolor, htree] - exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 - private theorem helper_branch_274.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -787,54 +746,6 @@ private theorem helper_hweak_291.{u_1, u_2} : simpa only [hA] using hmissing exact ⟨fun t _ => he t, hm⟩ -private theorem helper_trans_321.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {U W Z : TreeSequence G e0}, - TreeSequenceInitialSegment U W → - TreeSequenceInitialSegment W Z → - TreeSequenceInitialSegment U Z := by - classical - intro V E G e0 U W Z hUW hWZ - refine ⟨hUW.1.trans hWZ.1, ?_, ?_⟩ - · intro j - exact (hWZ.2.1 (Fin.castLE (Nat.succ_le_succ hUW.1) j)).trans - (hUW.2.1 j) - · intro j - exact (hWZ.2.2 (Fin.castLE hUW.1 j)).trans (hUW.2.2 j) - -private theorem helper_stageChain_332.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ {U W Z : TreeSequence G e0}, - TreeSequenceInitialSegment U W → - TreeSequenceInitialSegment W Z → TreeSequenceInitialSegment U Z) → - ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), - (↑i : ℕ) ≤ j → - TreeSequenceInitialSegment (H.stage i) - (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H trans j - induction j with - | zero => - intro hj i hi - have hi0 : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) - subst i - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - | succ j ih => - intro hj i hi - by_cases heq : i.val = j + 1 - · have heq' : i = ⟨j + 1, hj⟩ := Fin.ext heq - subst i - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - · exact trans (ih (by omega) i (by omega)) - (H.nested ⟨j, by omega⟩) - private theorem helper_starPositive_351.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] @@ -967,7 +878,7 @@ private theorem helper_preStepElementary_574.{u_1, u_2} : intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hminimal hlarge n Tn dsimp only by_cases hn : ett.rounds = 1 - · apply helper_branch_267 <;> assumption + · apply SharedFacts.BaseControl.branch <;> assumption · apply helper_branch_274 <;> assumption private theorem helper_caseContinuation_868.{u_1, u_2} : helperCaseContinuation868Conditions.{u_1, u_2} := by @@ -1435,11 +1346,11 @@ theorem StableChangeCasesOneTwo {V E : Type*} (hUW : TreeSequenceInitialSegment U W) (hWZ : TreeSequenceInitialSegment W Z) : TreeSequenceInitialSegment U Z := by - exact helper_trans_321 (@G) (@e0) (@hUW) (@hWZ) + exact SharedFacts.BaseControl.trans (@G) (@e0) (@hUW) (@hWZ) have stageChain : ∀ (j : ℕ) (hj : j < H.dividerCount + 2) (i : Fin (H.dividerCount + 2)), i.val ≤ j → TreeSequenceInitialSegment (H.stage i) (H.stage ⟨j, hj⟩) := by - apply helper_stageChain_332; assumption + apply SharedFacts.BaseControl.stageChain; assumption have starPositive := helper_starPositive_351 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) have hA : A = H.stage q.castSucc := starPositive q hq diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean index ebe9adabb7..0259ceed06 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoFullTail.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.FullTailTransport + +public import LeanPool.GoldbergSeymour.SharedFacts.StableChangeCasesOneTwoSplitTail + public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix public import LeanPool.GoldbergSeymour.HierarchyMinimumCounterexampleContext @@ -1048,65 +1052,6 @@ private theorem helper_positivePackage_887.{u_1, u_2} : (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + 2)) := Fin.ext rfl simpa [K, goodT, storedEq, q, he] using hminusA -private theorem helper_preStepElementary_896.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let i : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), by have this : (0 : ℕ) < ett.rounds := C.positive; omega⟩ : - Fin ett.rounds); - ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) - (TreeSequenceVertexSet Tn) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx n Tn - dsimp only - by_cases hn : ett.rounds = 1 - · have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = 0 := - Fin.ext (by simp [hn]) - have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := - Fin.ext (by simp [n, hn]) - dsimp only [Tn] - rw [hcolor, htree] - exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 - · have hmore : 1 < ett.rounds := by have := C.positive; omega - obtain ⟨predecessor, hr, hmaximum, _, _⟩ := - CertifiedETTPredecessor G k e0 input T phi ett C.maximum hmore - have htree : n.castSucc = (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := - Fin.ext rfl - dsimp only [Tn] - rw [htree] - exact (ctx.lowerRung predecessor (by omega) (by omega) hmaximum).1 - -private theorem helper_equalTrees_948.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - S.length = U.length → - S = U := by - classical - intro V E G e0 S U hSU hlen - cases S with - | mk ls ps vs es vis eis fs aas => - cases U with - | mk lu pu vu eu viu eiu fu aau => - simp only at hlen - subst lu - rw [TreeSequence.mk.injEq] - refine ⟨rfl, ?_, ?_⟩ - · apply heq_of_eq - funext i - simpa only [Fin.castLE] using (hSU.2.1 i).symm - · apply heq_of_eq - funext i - simpa only [Fin.castLE] using (hSU.2.2 i).symm - private theorem helper_ordinaryToA_1012.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -1506,7 +1451,8 @@ theorem StableChangeCasesOneTwoFullTail {V E : Type*} obtain ⟨hbase, missingA, sigmaProper, sigmaOne, outside⟩ := P2813_T1_BaseControl G k e0 input T phi ett base C ctx helem alpha beta hne hmissingPrefix z hpath sigma hsigma hcase hdisjoint - have preStepElementary := @helper_preStepElementary_896 V E inferInstance inferInstance + have preStepElementary := @SharedFacts.FullTailTransport.preStepElementary V E inferInstance + inferInstance inferInstance inferInstance G k e0 input T phi ett base C ctx have fixedA := P2813_T1_DisplayedEdges G k e0 input T phi ett base H C.good ctx.proper ctx.oneEdgeUncolored preStepElementary helem alpha beta z sigma hsigma @@ -1538,7 +1484,7 @@ theorem StableChangeCasesOneTwoFullTail {V E : Type*} exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) · intro i exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) - have equalTrees := @helper_equalTrees_948 V E G e0 + have equalTrees := @SharedFacts.StableChangeCasesOneTwoSplitTail.equalTrees V E G e0 have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) (H.stage ⟨a + d, by omega⟩) := by diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean index 5343363575..dbe6a27cc4 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoSplitTail.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.StableChangeCasesOneTwoSplitTail + public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix @@ -614,30 +616,6 @@ private theorem helper_preStepElementary_566.{u_1, u_2} : rw [htree] exact (ctx.lowerRung predecessor (by omega) (by omega) hmaximum).1 -private theorem helper_equalTrees_615.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - S.length = U.length → - S = U := by - classical - intro V E G e0 S U hSU hlen - cases S with - | mk ls ps vs es vis eis fs aas => - cases U with - | mk lu pu vu eu viu eiu fu aau => - simp only at hlen - subst lu - rw [TreeSequence.mk.injEq] - refine ⟨rfl, ?_, ?_⟩ - · apply heq_of_eq - funext i - simpa only [Fin.castLE] using (hSU.2.1 i).symm - · apply heq_of_eq - funext i - simpa only [Fin.castLE] using (hSU.2.2 i).symm - private theorem helper_branch_846.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -1130,7 +1108,7 @@ theorem StableChangeCasesOneTwoSplitTail {V E : Type*} exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) · intro i exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) - have equalTrees := @helper_equalTrees_615 V E G e0 + have equalTrees := @SharedFacts.StableChangeCasesOneTwoSplitTail.equalTrees V E G e0 have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) (H.stage ⟨a + d, by omega⟩) := by diff --git a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean index b52673054a..e017a18f28 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCasesOneTwoStarredTail.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.FullTailTransport + public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix @@ -530,41 +532,6 @@ private theorem helper_segmentEq_708.{u_1, u_2} : rw [← hUA.2.2 r]; exact hfixed _ exact he.trans hcol -private theorem helper_preStepElementary_508.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C → - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let i : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), by have this : (0 : ℕ) < ett.rounds := C.positive; omega⟩ : - Fin ett.rounds); - ColoredVertexSetElementary G (ett.series.data.coloring i.castSucc) - (TreeSequenceVertexSet Tn) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx n Tn - dsimp only - by_cases hn : ett.rounds = 1 - · have hcolor : (⟨ett.rounds - 1, by have := C.positive; omega⟩ : Fin ett.rounds).castSucc = 0 := - Fin.ext (by simp [hn]) - have htree : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := - Fin.ext (by simp [n, hn]) - dsimp only [Tn] - rw [hcolor, htree] - exact (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 - · have hmore : 1 < ett.rounds := by have := C.positive; omega - obtain ⟨predecessor, hr, hmaximum, _, _⟩ := - CertifiedETTPredecessor G k e0 input T phi ett C.maximum hmore - have htree : n.castSucc = (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) := - Fin.ext rfl - dsimp only [Tn] - rw [htree] - exact (ctx.lowerRung predecessor (by omega) (by omega) hmaximum).1 - private theorem helper_weak_543.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -1147,7 +1114,8 @@ theorem StableChangeCasesOneTwoStarredTail {V E : Type*} have controls := P2813_T1_BaseControl G k e0 input T phi ett base C ctx helem alpha beta hne hmissingPrefix z hpath sigma hsigma hcase hdisjoint rcases controls with ⟨hbase, hmissing, hsproper, hsone, houtside⟩ - have preStepElementary := @helper_preStepElementary_508 V E inferInstance inferInstance + have preStepElementary := @SharedFacts.FullTailTransport.preStepElementary V E inferInstance + inferInstance inferInstance inferInstance G k e0 input T phi ett base C ctx have hfixed := P2813_T1_DisplayedEdges G k e0 input T phi ett base H C.good ctx.proper ctx.oneEdgeUncolored preStepElementary helem alpha beta z sigma hsigma diff --git a/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean b/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean index 9829ecab7a..8c8f4cea3f 100644 --- a/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean +++ b/LeanPool/GoldbergSeymour/SupportingPEStoredIntersection.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.HkuUnsupportedVertexColors public import LeanPool.GoldbergSeymour.SupportingPEColorChain public import LeanPool.GoldbergSeymour.TashkinovSeries @@ -324,53 +325,6 @@ private theorem helper_hlocal_273.{u_1, u_2} : · exact hp.2.2 · exact hstored -private theorem helper_next_segment_336.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series - : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + (1 : ℕ))) (i : Fin rounds), j = - i.succ → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree - i.succ.succ) := by - classical - intro V E _ _ _ G k rounds e0 input series j i hj - cases series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges - initialKind initialVertex initialOutside initialDelta initialGamma - initialClosure => - exact (Fin.succ_ne_zero i) hj.symm |>.elim - | SE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hj - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | RE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma adjoined adjoinedExactly closedExtension orderedExtension - strictExtension => - have hvals := congrArg Fin.val hj - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | PE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper - secondStableOneUncolored secondStableRelation exitWitness - currentColoring currentProper currentOneUncolored currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hj - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - private theorem helper_hgap_377.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : @@ -791,7 +745,8 @@ theorem SupportingPEStoredIntersection {V E : Type*} obtain ⟨i, hi, rfl⟩ := hx rcases h with ⟨hlen, hvertex, hedge⟩ exact ⟨Fin.castLE (Nat.succ_le_succ hlen) i, by simpa using hvertex i⟩ - have next_segment := @helper_next_segment_336 V E inferInstance inferInstance inferInstance G k + have next_segment := @SharedFacts.UnsupportedVertexColors.next_segment V E inferInstance + inferInstance inferInstance G k rounds e0 input series have hgap := @helper_hgap_377 V E inferInstance inferInstance inferInstance G k rounds p e0 input series q u indices hincreasing henumerates support_tree transfer_tree next_segment diff --git a/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean b/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean index bbc3bd8d6f..e3696c5343 100644 --- a/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean +++ b/LeanPool/GoldbergSeymour/TerminalHierarchyPrefixPreparation.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.GoodHierarchyPrefixPreparation + public import LeanPool.GoldbergSeymour.HierarchyStarredStage /-! @@ -21,22 +23,10 @@ namespace GoldbergSeymour.TerminalHierarchyPrefixPreparation open scoped Sym2 +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_segmentTrans_81.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B - C → TreeSequenceInitialSegment A C := by - classical - intro V E G e0 A B C hAB hBC - rcases hAB with ⟨hab, hvab, heab⟩ - rcases hBC with ⟨hbc, hvbc, hebc⟩ - refine ⟨le_trans hab hbc, ?_, ?_⟩ - · intro i - have hmid := hvbc (Fin.castLE (Nat.succ_le_succ hab) i) - simpa using hmid.trans (hvab i) - · intro i - have hmid := hebc (Fin.castLE hab i) - simpa using hmid.trans (heab i) + SharedFacts.GoodHierarchyPrefixPreparation.segmentTransStatement.{u_1, u_2} := + SharedFacts.GoodHierarchyPrefixPreparation.segmentTrans.{u_1, u_2} theorem helper_stageSegment_94.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean b/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean index ca7c62a1d5..838b26f6b8 100644 --- a/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean +++ b/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.TerminalKempeStageSwitch + public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans @@ -826,27 +828,6 @@ private theorem helper_hnotElementary_588.{u_1, u_2} : have hh := congrArg Fin.val hh; dsimp [ja] at hh; omega)) haNew (hterminalB hw) -private theorem helper_firstMem_689.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) - (k : ℕ) (e0 : E) (T : TreeSequence G e0) (psi : PartialEdgeColoring E k) (c : Fin k), - (↑(HierarchyFirstMissingPosition psi T c) : ℕ) < T.length → - c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by - classical - intro V E _ _ G k e0 T psi c hlt - let _ := Fintype.ofFinite V - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G psi (T.vertex j) - by_cases hn : candidates.Nonempty - · unfold HierarchyFirstMissingPosition - rw [dite_eq_left hn] - exact (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - · have hh : (HierarchyFirstMissingPosition psi T c).val = T.length := by - unfold HierarchyFirstMissingPosition - rw [dite_eq_right hn] - rfl - omega - private theorem helper_chain_722.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -975,31 +956,6 @@ private theorem helper_hbOutside_792.{u_1, u_2} : exact Finset.disjoint_left.mp (elementary R (TreeSequenceInitialSegmentVertexSetSubset hAB hvA) (vertexMem B jb) hne) hmv hb -private theorem helper_hsone_900.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (R : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (a b : Fin k), a ≠ b → - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G R.coloring a b (Sum.inl - (T.vertex (Fin.last T.length))); IsOneEdgeUncolored sigma e0 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx R a b hne sigma - refine ⟨?_, ?_⟩ - · simp [sigma, TwoColorComponentSwap, R.minimumContext.oneEdgeUncolored.1] - · intro e he - obtain ⟨c, hc⟩ := R.minimumContext.oneEdgeUncolored.2 e he - by_cases hm : Sum.inr e ∈ TwoColorComponent G R.coloring a b - (Sum.inl (T.vertex (Fin.last T.length))) - · by_cases hca : c = a - · subst c; exact ⟨b, by simp [sigma, TwoColorComponentSwap, hm, hc]⟩ - · by_cases hcb : c = b - · subst c; exact ⟨a, by simp [sigma, TwoColorComponentSwap, hm, hc, hne.symm]⟩ - · exact ⟨c, by simp [sigma, TwoColorComponentSwap, hm, hc, hca, hcb]⟩ - · exact ⟨c, by simp [sigma, TwoColorComponentSwap, hm, hc]⟩ - private theorem helper_fixedA_949.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1296,7 +1252,8 @@ private theorem helper_continuation_1225.{u_1, u_2} : have hsproper : IsProperEdgeColoring G sigma := TwoColorComponentSwapProper G R.coloring a b hne R.minimumContext.proper _ have hsone : IsOneEdgeUncolored sigma e0 := by - exact @helper_hsone_900 V E inferInstance inferInstance inferInstance inferInstance G k e0 + exact @SharedFacts.TerminalKempeStageSwitch.hsone V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C ctx R a b hne have hcase : (0 < H.dividerCount ∧ a ∈ TreeMissingColors R.coloring (H.stage ⟨H.dividerCount, by omega⟩)) ∨ @@ -1426,7 +1383,7 @@ private theorem helper_continuation_190.{u_1, u_2} : have firstMem (psi : PartialEdgeColoring E k) (c : Fin k) (hlt : (HierarchyFirstMissingPosition psi T c).val < T.length) : c ∈ MissingColors G psi (T.vertex (HierarchyFirstMissingPosition psi T c)) := by - exact @helper_firstMem_689 V E inferInstance inferInstance G k e0 T psi c hlt + exact TreeSequenceFirstMissingPositionMem hlt have firstAt (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : Fin (B.length + 1)) (hc : c ∈ MissingColors G R.coloring (B.vertex j)) : diff --git a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean index 2c4d1e0e8f..b3545c4063 100644 --- a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean +++ b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildPreparation.lean @@ -5,10 +5,13 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.TerminalRebuild + +public import LeanPool.GoldbergSeymour.SharedFacts.RevisitingTerminalPreparation + public import LeanPool.GoldbergSeymour.PositivePrefixNoRevisiting public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone public import LeanPool.GoldbergSeymour.RevisitingExtensionCertificateAppend -public import LeanPool.GoldbergSeymour.StableColoringEquivalence public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis /-! @@ -27,187 +30,19 @@ namespace GoldbergSeymour.TerminalSeriesRebuild Keeping this interface separate avoids repeating its dependent hypotheses and data. -/ -noncomputable abbrev helperNewChoice2409.{u_1, u_2} : - open scoped Classical in - {V : Type u_1} → - {E : Type u_2} → - [ Fintype V] → - [ Fintype E] → - [ DecidableEq E] → - (G : LooplessMultigraph V E) → - (k : ℕ) → - (e0 : E) → - (input : PartialEdgeColoring E k) → - (T : TreeSequence G e0) → - (generating : PartialEdgeColoring E k) → - (ett : ExtendedTashkinovTree G k e0 input T generating) → - (hpositive : (0 : ℕ) < ett.rounds) → - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → - IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → - (choice : - MaximumDefectiveChoice G e0 - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc)) → - (sigmaPrev : PartialEdgeColoring E k) → - IsProperEdgeColoring G sigmaPrev → - IsOneEdgeUncolored sigmaPrev e0 → - StableColoring (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc) sigmaPrev → - DefectiveColor G sigmaPrev - (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) - choice.color → - choice.edge ∈ - BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) - choice.color → - StableColoring - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data - q.castSucc) - sigmaPrev sigmaPrev → - MaximumDefectiveChoice G e0 - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data - q.castSucc) - sigmaPrev := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored - choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective - hchoiceEdgeNew hsigmaPrevSelf - exact { - selected := sigmaPrev - selectedProper := hsigmaPrevProper - selectedOneUncolored := hsigmaPrevOne - selectedStable := hsigmaPrevSelf - vertex := choice.vertex - vertexDefective := ⟨choice.vertexDefective.1, choice.edge, - ⟨choice.color, hchoiceDefective, hchoiceEdgeNew⟩, - choice.edgeIncident⟩ - maximal := by - intro pi w hpiProper hpiOne hpiStable hw - have hpiOld : StableColoring - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc) pi := by - exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc)).trans - (x := ⟨ett.series.data.coloring q.castSucc, - ⟨previousProper, previousOneUncolored⟩⟩) - (y := ⟨sigmaPrev, ⟨hsigmaPrevProper, hsigmaPrevOne⟩⟩) - (z := ⟨pi, ⟨hpiProper, hpiOne⟩⟩) - hsigmaPrevStableQ hpiStable - exact choice.maximal pi w hpiProper hpiOne hpiOld hw - edge := choice.edge - edgeDefective := ⟨choice.color, hchoiceDefective, hchoiceEdgeNew⟩ - edgeIncident := choice.edgeIncident - otherEndpoint := choice.otherEndpoint - otherOutside := choice.otherOutside - edgeEnds := choice.edgeEnds - color := choice.color - edgeColor := (Finset.mem_filter.mp hchoiceEdgeNew).2 } +noncomputable abbrev helperNewChoice2409.{u_1, u_2} := + @SharedFacts.TerminalRebuild.newChoice2409.{u_1, u_2} + + /-- Typed data construction shared by the terminal series reconstruction proof modules. Keeping this interface separate avoids repeating its dependent hypotheses and data. -/ -noncomputable abbrev helperNewChoice4049.{u_1, u_2} : - open scoped Classical in - {V : Type u_1} → - {E : Type u_2} → - [ Fintype V] → - [ Fintype E] → - [ DecidableEq E] → - (G : LooplessMultigraph V E) → - (k : ℕ) → - (e0 : E) → - (input : PartialEdgeColoring E k) → - (T : TreeSequence G e0) → - (generating : PartialEdgeColoring E k) → - (ett : ExtendedTashkinovTree G k e0 input T generating) → - (hpositive : (0 : ℕ) < ett.rounds) → - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → - IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → - (choice : - MaximumDefectiveChoice G e0 - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc)) → - (sigmaPrev : PartialEdgeColoring E k) → - IsProperEdgeColoring G sigmaPrev → - IsOneEdgeUncolored sigmaPrev e0 → - StableColoring (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc) sigmaPrev → - DefectiveColor G sigmaPrev - (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) - choice.color → - choice.edge ∈ - BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) - choice.color → - StableColoring - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data - q.castSucc) - sigmaPrev sigmaPrev → - MaximumDefectiveChoice G e0 - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data - q.castSucc) - sigmaPrev := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored - choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective - hchoiceEdgeNew hsigmaPrevSelf - exact { - selected := sigmaPrev - selectedProper := hsigmaPrevProper - selectedOneUncolored := hsigmaPrevOne - selectedStable := hsigmaPrevSelf - vertex := choice.vertex - vertexDefective := ⟨choice.vertexDefective.1, choice.edge, - ⟨choice.color, hchoiceDefective, hchoiceEdgeNew⟩, - choice.edgeIncident⟩ - maximal := by - intro pi w hpiProper hpiOne hpiStable hw - have hpiOld : StableColoring - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc) pi := by - exact (sc2 G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc)).trans - (x := ⟨ett.series.data.coloring q.castSucc, - ⟨previousProper, previousOneUncolored⟩⟩) - (y := ⟨sigmaPrev, ⟨hsigmaPrevProper, hsigmaPrevOne⟩⟩) - (z := ⟨pi, ⟨hpiProper, hpiOne⟩⟩) - hsigmaPrevStableQ hpiStable - exact choice.maximal pi w hpiProper hpiOne hpiOld hw - edge := choice.edge - edgeDefective := ⟨choice.color, hchoiceDefective, hchoiceEdgeNew⟩ - edgeIncident := choice.edgeIncident - otherEndpoint := choice.otherEndpoint - otherOutside := choice.otherOutside - edgeEnds := choice.edgeEnds - color := choice.color - edgeColor := (Finset.mem_filter.mp hchoiceEdgeNew).2 } +noncomputable abbrev helperNewChoice4049.{u_1, u_2} := + @SharedFacts.TerminalRebuild.newChoice2409.{u_1, u_2} + + /-- Typed data construction shared by the terminal series reconstruction proof modules. @@ -724,303 +559,19 @@ noncomputable abbrev helperReplacementETT4947.{u_1, u_2} : Keeping this interface separate avoids repeating its dependent hypotheses and data. -/ -noncomputable abbrev helperReplacementChoice3411.{u_1, u_2} : - open scoped Classical in - {V : Type u_1} → - {E : Type u_2} → - [ Fintype V] → - [ Fintype E] → - [ DecidableEq E] → - (G : LooplessMultigraph V E) → - (k : ℕ) → - (e0 : E) → - (input : PartialEdgeColoring E k) → - (T : TreeSequence G e0) → - (generating : PartialEdgeColoring E k) → - (ett : ExtendedTashkinovTree G k e0 input T generating) → - (hpositive : (0 : ℕ) < ett.rounds) → - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - (previousProper : - IsProperEdgeColoring G - (ett.series.data.coloring q.castSucc)) → - (previousOneUncolored : - IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) - e0) → - (choice : - MaximumDefectiveChoice G e0 - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc)) → - (sigmaPrev : PartialEdgeColoring E k) → - (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) → - (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) → - (hsigmaPrevStableQ : - StableColoring - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data - q.castSucc) - (ett.series.data.coloring q.castSucc) - sigmaPrev) → - (hchoiceDefective : - DefectiveColor G sigmaPrev - (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) - choice.color) → - (hchoiceEdgeNew : - choice.edge ∈ - BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) - choice.color) → - (hsigmaPrevSelf : - StableColoring - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data - q.castSucc) - sigmaPrev sigmaPrev) → - let _ : - MaximumDefectiveChoice G e0 - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data - q.castSucc) - sigmaPrev := - helperNewChoice2409 G k e0 input T - generating ett hpositive previousProper - previousOneUncolored choice sigmaPrev - hsigmaPrevProper hsigmaPrevOne - hsigmaPrevStableQ hchoiceDefective - hchoiceEdgeNew hsigmaPrevSelf; - (originalPrefix : - ExtendedTashkinovTree G k e0 input - (ett.series.data.tree - (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring - (⟨ett.rounds - (1 : ℕ), - by - have := - GoldbergSeymour.TreeSequence.positive - T - omega⟩ : - Fin (ett.rounds + (1 : ℕ))))) → - (corr : - CorrespondingExtendedTashkinovTree G k - e0 originalPrefix sigmaPrev - (ett.series.data.tree - (Fin.last ett.rounds).castSucc)) → - corr.replacementSeries.data.coloring - (Fin.last originalPrefix.rounds) = - sigmaPrev → - let replacementLast : - Fin - (originalPrefix.rounds + (1 : ℕ)) := - Fin.last originalPrefix.rounds; - corr.replacementSeries.data.tree - replacementLast.succ = - ett.series.data.tree - q.succ.castSucc → - TashkinovStoredColors - corr.replacementSeries.data - replacementLast = - TashkinovStoredColors - ett.series.data q.castSucc → - MaximumDefectiveChoice G e0 - (corr.replacementSeries.data.tree - replacementLast.succ) - (TashkinovStoredColors - corr.replacementSeries.data - replacementLast) - (corr.replacementSeries.data.coloring - replacementLast) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored - choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective - hchoiceEdgeNew hsigmaPrevSelf newChoice originalPrefix corr hcorrFinalColor replacementLast - hreplacementCurrentTree hreplacementStored - exact { - selected := sigmaPrev - selectedProper := hsigmaPrevProper - selectedOneUncolored := hsigmaPrevOne - selectedStable := by - rw [hreplacementCurrentTree, hreplacementStored, hcorrFinalColor] - exact newChoice.selectedStable - vertex := choice.vertex - vertexDefective := by - rw [hreplacementCurrentTree] - exact newChoice.vertexDefective - maximal := by - intro pi w hpiProper hpiOne hpiStable hw - rw [hreplacementCurrentTree, hreplacementStored, hcorrFinalColor] - at hpiStable - rw [hreplacementCurrentTree] at hw ⊢ - exact newChoice.maximal pi w hpiProper hpiOne hpiStable hw - edge := choice.edge - edgeDefective := by - rw [hreplacementCurrentTree] - exact newChoice.edgeDefective - edgeIncident := choice.edgeIncident - otherEndpoint := choice.otherEndpoint - otherOutside := by - rw [hreplacementCurrentTree] - exact newChoice.otherOutside - edgeEnds := choice.edgeEnds - color := choice.color - edgeColor := newChoice.edgeColor } +noncomputable abbrev helperReplacementChoice3411.{u_1, u_2} := + @SharedFacts.TerminalRebuild.replacementChoice3411.{u_1, u_2} + + /-- Typed data construction shared by the terminal series reconstruction proof modules. Keeping this interface separate avoids repeating its dependent hypotheses and data. -/ -noncomputable abbrev helperReplacementChoice5196.{u_1, u_2} : - open scoped Classical in - {V : Type u_1} → - {E : Type u_2} → - [ Fintype V] → - [ Fintype E] → - [ DecidableEq E] → - (G : LooplessMultigraph V E) → - (k : ℕ) → - (e0 : E) → - (input : PartialEdgeColoring E k) → - (T : TreeSequence G e0) → - (generating : PartialEdgeColoring E k) → - (ett : ExtendedTashkinovTree G k e0 input T generating) → - (hpositive : (0 : ℕ) < ett.rounds) → - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - (previousProper : - IsProperEdgeColoring G - (ett.series.data.coloring q.castSucc)) → - (previousOneUncolored : - IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) - e0) → - (choice : - MaximumDefectiveChoice G e0 - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc)) → - (sigmaPrev : PartialEdgeColoring E k) → - (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) → - (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) → - (hsigmaPrevStableQ : - StableColoring - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data - q.castSucc) - (ett.series.data.coloring q.castSucc) - sigmaPrev) → - (hchoiceDefective : - DefectiveColor G sigmaPrev - (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) - choice.color) → - (hchoiceEdgeNew : - choice.edge ∈ - BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) - choice.color) → - (hsigmaPrevSelf : - StableColoring - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data - q.castSucc) - sigmaPrev sigmaPrev) → - let _ : - MaximumDefectiveChoice G e0 - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data - q.castSucc) - sigmaPrev := - helperNewChoice4049 G k e0 input T - generating ett hpositive previousProper - previousOneUncolored choice sigmaPrev - hsigmaPrevProper hsigmaPrevOne - hsigmaPrevStableQ hchoiceDefective - hchoiceEdgeNew hsigmaPrevSelf; - (originalPrefix : - ExtendedTashkinovTree G k e0 input - (ett.series.data.tree - (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring - (⟨ett.rounds - (1 : ℕ), - by - have := - GoldbergSeymour.TreeSequence.positive - T - omega⟩ : - Fin (ett.rounds + (1 : ℕ))))) → - (corr : - CorrespondingExtendedTashkinovTree G k - e0 originalPrefix sigmaPrev - (ett.series.data.tree - (Fin.last ett.rounds).castSucc)) → - corr.replacementSeries.data.coloring - (Fin.last originalPrefix.rounds) = - sigmaPrev → - let replacementLast : - Fin - (originalPrefix.rounds + (1 : ℕ)) := - Fin.last originalPrefix.rounds; - corr.replacementSeries.data.tree - replacementLast.succ = - ett.series.data.tree - q.succ.castSucc → - TashkinovStoredColors - corr.replacementSeries.data - replacementLast = - TashkinovStoredColors - ett.series.data q.castSucc → - MaximumDefectiveChoice G e0 - (corr.replacementSeries.data.tree - replacementLast.succ) - (TashkinovStoredColors - corr.replacementSeries.data - replacementLast) - (corr.replacementSeries.data.coloring - replacementLast) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive q previousProper previousOneUncolored - choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective - hchoiceEdgeNew hsigmaPrevSelf newChoice originalPrefix corr hcorrFinalColor replacementLast - hreplacementCurrentTree hreplacementStored - exact { - selected := sigmaPrev - selectedProper := hsigmaPrevProper - selectedOneUncolored := hsigmaPrevOne - selectedStable := by - rw [hreplacementCurrentTree, hreplacementStored, hcorrFinalColor] - exact newChoice.selectedStable - vertex := choice.vertex - vertexDefective := by - rw [hreplacementCurrentTree] - exact newChoice.vertexDefective - maximal := by - intro pi w hpiProper hpiOne hpiStable hw - rw [hreplacementCurrentTree, hreplacementStored, hcorrFinalColor] - at hpiStable - rw [hreplacementCurrentTree] at hw ⊢ - exact newChoice.maximal pi w hpiProper hpiOne hpiStable hw - edge := choice.edge - edgeDefective := by - rw [hreplacementCurrentTree] - exact newChoice.edgeDefective - edgeIncident := choice.edgeIncident - otherEndpoint := choice.otherEndpoint - otherOutside := by - rw [hreplacementCurrentTree] - exact newChoice.otherOutside - edgeEnds := choice.edgeEnds - color := choice.color - edgeColor := newChoice.edgeColor } +noncomputable abbrev helperReplacementChoice5196.{u_1, u_2} := + @SharedFacts.TerminalRebuild.replacementChoice3411.{u_1, u_2} + + /-- Dependent contract shared by the terminal series reconstruction proof modules. @@ -2206,145 +1757,20 @@ abbrev helperHseriesStable6952Conditions.{u_1, u_2} : Prop := (TashkinovStoredColors ett.series.data i.succ) (ett.series.data.coloring i.succ) (finalSeries.data.coloring i.succ) +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hTnClosure_112.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) (Tstar : TreeSequence G e0), - TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) Tstar → - ∀ (closureTree : TreeSequence G e0), - TreeSequenceInitialSegment Tstar closureTree → - TreeSequenceInitialSegment (ett.series.data.tree (Fin.last ett.rounds).castSucc) - closureTree := by - classical - intro V E _ _ _ G k e0 input T generating ett Tstar hTnTstar closureTree hTstarClosure - rcases hTnTstar with ⟨hlenAB, hvertexAB, hedgeAB⟩ - rcases hTstarClosure with ⟨hlenBC, hvertexBC, hedgeBC⟩ - refine ⟨Nat.le_trans hlenAB hlenBC, ?_, ?_⟩ - · intro j - calc - closureTree.vertex - (Fin.castLE (Nat.succ_le_succ (Nat.le_trans hlenAB hlenBC)) j) = - closureTree.vertex - (Fin.castLE (Nat.succ_le_succ hlenBC) - (Fin.castLE (Nat.succ_le_succ hlenAB) j)) := by congr 1 - _ = Tstar.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) j) := - hvertexBC _ - _ = (ett.series.data.tree (Fin.last ett.rounds).castSucc).vertex j := - hvertexAB j - · intro j - calc - closureTree.edge (Fin.castLE (Nat.le_trans hlenAB hlenBC) j) = - closureTree.edge (Fin.castLE hlenBC (Fin.castLE hlenAB j)) := by - congr 1 - _ = Tstar.edge (Fin.castLE hlenAB j) := hedgeBC _ - _ = (ett.series.data.tree (Fin.last ett.rounds).castSucc).edge j := - hedgeAB j + SharedFacts.RevisitingTerminalPreparation.tnClosureStatement.{u_1, u_2} := + SharedFacts.RevisitingTerminalPreparation.tnClosure.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hdeltaBoundary_254.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → - IsOneEdgeUncolored sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) - (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) - choice.selected sigmaPrev → BoundaryColorEdges G choice.selected (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) choice.color = BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hsigmaPrevProper - hsigmaPrevOne hsigmaPrevEnlarged - ext f - simp only [BoundaryColorEdges, Finset.mem_filter] - constructor - · rintro ⟨hf, hfc⟩ - refine ⟨hf, ?_⟩ - obtain ⟨x, hx, y, hy, hends⟩ := by - simpa [BoundaryEdges] using hf - have hinc : TreeIncidentEdge - (ett.series.data.tree q.succ.castSucc) f := by - refine ⟨x, hx, ?_⟩ - unfold Incident - rw [hends] - exact Sym2.mem_mk_left _ _ - exact (hsigmaPrevEnlarged.1 f hinc - ⟨choice.color, Finset.mem_union_right _ - (Finset.mem_insert_self _ _), hfc⟩).trans hfc - · rintro ⟨hf, hfc⟩ - refine ⟨hf, ?_⟩ - obtain ⟨x, hx, y, hy, hends⟩ := by - simpa [BoundaryEdges] using hf - have hinc : TreeIncidentEdge - (ett.series.data.tree q.succ.castSucc) f := by - refine ⟨x, hx, ?_⟩ - unfold Incident - rw [hends] - exact Sym2.mem_mk_left _ _ - have hcriterion := (sc1 G e0 - (ett.series.data.tree q.succ.castSucc) - (insert choice.color - (TashkinovStoredColors ett.series.data q.castSucc)) - choice.selected sigmaPrev choice.selectedProper - choice.selectedOneUncolored hsigmaPrevProper hsigmaPrevOne).mp - hsigmaPrevEnlarged - exact (hcriterion f hinc (Or.inr - ⟨choice.color, Finset.mem_union_right _ - (Finset.mem_insert_self _ _), hfc⟩)).symm.trans hfc + SharedFacts.TerminalRebuild.hdeltaBoundaryStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hdeltaBoundary.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hclosedPrev_356.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → - IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → ColoredVertexSetClosed G - (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet (ett.series.data.tree - q.succ.castSucc)) → - ∀ (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → IsOneEdgeUncolored - sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) - sigmaPrev → ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper - previousOneUncolored previousClosed sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ - f c v hf hv hsf hcm - obtain ⟨x, hx, y, hy, hends⟩ := by - simpa [BoundaryEdges] using hf - have hinc : TreeIncidentEdge - (ett.series.data.tree q.succ.castSucc) f := by - refine ⟨x, hx, ?_⟩ - unfold Incident - rw [hends] - exact Sym2.mem_mk_left _ _ - have hmissingEq := hsigmaPrevStableQ.2 v hv - have hcTree : c ∈ TreeMissingColors - (ett.series.data.coloring q.castSucc) - (ett.series.data.tree q.succ.castSucc) := by - simp only [TreeMissingColors, Finset.mem_biUnion] - exact ⟨v, hv, hmissingEq ▸ hcm⟩ - have hcriterion := (sc1 G e0 - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc) sigmaPrev previousProper - previousOneUncolored hsigmaPrevProper hsigmaPrevOne).mp - hsigmaPrevStableQ - have hcopy := hcriterion f hinc - (Or.inr ⟨c, Finset.mem_union_left _ hcTree, hsf⟩) - have holdf : ett.series.data.coloring q.castSucc f = some c := - hcopy.symm.trans hsf - exact previousClosed hf hv holdf (hmissingEq ▸ hcm) + SharedFacts.TerminalRebuild.hclosedPrevStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hclosedPrev.{u_1, u_2} theorem helper_hpenultimateTree_713.{u_1, u_2} : open scoped Classical in @@ -3310,109 +2736,15 @@ theorem helper_stableSelected_2405.{u_1, u_2} : have hrel := relationCriterion f hf (Or.inr ⟨c, hc, hsecond⟩) exact hstable.trans hrel +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hdeltaBoundary_2443.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → - IsOneEdgeUncolored sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) - (insert choice.color (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) - choice.selected sigmaPrev → BoundaryColorEdges G choice.selected (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) choice.color = BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hsigmaPrevProper - hsigmaPrevOne hsigmaPrevEnlarged - ext f - simp only [BoundaryColorEdges, Finset.mem_filter] - constructor - · rintro ⟨hf, hfc⟩ - refine ⟨hf, ?_⟩ - obtain ⟨x, hx, y, hy, hends⟩ := by - simpa [BoundaryEdges] using hf - have hinc : TreeIncidentEdge - (ett.series.data.tree q.succ.castSucc) f := by - refine ⟨x, hx, ?_⟩ - unfold Incident - rw [hends] - exact Sym2.mem_mk_left _ _ - exact (hsigmaPrevEnlarged.1 f hinc - ⟨choice.color, Finset.mem_union_right _ - (Finset.mem_insert_self _ _), hfc⟩).trans hfc - · rintro ⟨hf, hfc⟩ - refine ⟨hf, ?_⟩ - obtain ⟨x, hx, y, hy, hends⟩ := by - simpa [BoundaryEdges] using hf - have hinc : TreeIncidentEdge - (ett.series.data.tree q.succ.castSucc) f := by - refine ⟨x, hx, ?_⟩ - unfold Incident - rw [hends] - exact Sym2.mem_mk_left _ _ - have hcriterion := (sc1 G e0 - (ett.series.data.tree q.succ.castSucc) - (insert choice.color - (TashkinovStoredColors ett.series.data q.castSucc)) - choice.selected sigmaPrev choice.selectedProper - choice.selectedOneUncolored hsigmaPrevProper hsigmaPrevOne).mp - hsigmaPrevEnlarged - exact (hcriterion f hinc (Or.inr - ⟨choice.color, Finset.mem_union_right _ - (Finset.mem_insert_self _ _), hfc⟩)).symm.trans hfc + SharedFacts.TerminalRebuild.hdeltaBoundaryStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hdeltaBoundary.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hclosedPrev_2545.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); IsProperEdgeColoring G (ett.series.data.coloring q.castSucc) → - IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0 → ColoredVertexSetClosed G - (ett.series.data.coloring q.castSucc) (TreeSequenceVertexSet (ett.series.data.tree - q.succ.castSucc)) → - ∀ (sigmaPrev : PartialEdgeColoring E k), IsProperEdgeColoring G sigmaPrev → IsOneEdgeUncolored - sigmaPrev e0 → StableColoring (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) - sigmaPrev → ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q previousProper - previousOneUncolored previousClosed sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ - f c v hf hv hsf hcm - obtain ⟨x, hx, y, hy, hends⟩ := by - simpa [BoundaryEdges] using hf - have hinc : TreeIncidentEdge - (ett.series.data.tree q.succ.castSucc) f := by - refine ⟨x, hx, ?_⟩ - unfold Incident - rw [hends] - exact Sym2.mem_mk_left _ _ - have hmissingEq := hsigmaPrevStableQ.2 v hv - have hcTree : c ∈ TreeMissingColors - (ett.series.data.coloring q.castSucc) - (ett.series.data.tree q.succ.castSucc) := by - simp only [TreeMissingColors, Finset.mem_biUnion] - exact ⟨v, hv, hmissingEq ▸ hcm⟩ - have hcriterion := (sc1 G e0 - (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc) sigmaPrev previousProper - previousOneUncolored hsigmaPrevProper hsigmaPrevOne).mp - hsigmaPrevStableQ - have hcopy := hcriterion f hinc - (Or.inr ⟨c, Finset.mem_union_left _ hcTree, hsf⟩) - have holdf : ett.series.data.coloring q.castSucc f = some c := - hcopy.symm.trans hsf - exact previousClosed hf hv holdf (hmissingEq ▸ hcm) + SharedFacts.TerminalRebuild.hclosedPrevStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hclosedPrev.{u_1, u_2} theorem helper_hdeltaCurrentMissing_2652.{u_1, u_2} : open scoped Classical in @@ -4320,25 +3652,10 @@ theorem helper_branch_3453.{u_1, u_2} : simp [htarget, currentKind] at hterminal rcases hbad with hbad | hbad <;> cases hbad +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hi_3469.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (i : Fin ett.rounds), Fin.last ett.rounds = i.succ → i = q := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q i htarget - apply Fin.ext - have hv : ett.rounds = i.val + 1 := by - simpa using congrArg Fin.val htarget - change i.val = ett.rounds - 1 - omega + SharedFacts.RevisitingTerminalPreparation.hiStatement.{u_1, u_2} := + SharedFacts.RevisitingTerminalPreparation.hi.{u_1, u_2} theorem helper_hdeltaCurrentControl_3499.{u_1, u_2} : open scoped Classical in @@ -4442,94 +3759,20 @@ theorem helper_hsigmaPrevEnlarged_3532.{u_1, u_2} : · intro v hv simpa [currentColoring, hsigmaPrevSigma] using hsigmaStableQ.2 v hv +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hchoiceDefective_3555.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k), BoundaryColorEdges G choice.selected - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color = - BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree - q.succ.castSucc)) choice.color → DefectiveColor G sigmaPrev (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) choice.color := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hdeltaBoundary - obtain ⟨oldColor, holdDefective, holdEdge⟩ := choice.edgeDefective - have holdColor : oldColor = choice.color := by - have holdEdgeColor := (Finset.mem_filter.mp holdEdge).2 - exact Option.some.inj (holdEdgeColor.symm.trans choice.edgeColor) - subst oldColor - unfold DefectiveColor - rw [← hdeltaBoundary] - exact holdDefective + SharedFacts.TerminalRebuild.hchoiceDefectiveStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hchoiceDefective.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hchoiceEdgeNew_3566.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k), BoundaryColorEdges G choice.selected - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color = - BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree - q.succ.castSucc)) choice.color → choice.edge ∈ BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hdeltaBoundary - rw [← hdeltaBoundary] - obtain ⟨oldColor, holdDefective, holdEdge⟩ := choice.edgeDefective - have holdColor : oldColor = choice.color := by - have holdEdgeColor := (Finset.mem_filter.mp holdEdge).2 - exact Option.some.inj (holdEdgeColor.symm.trans choice.edgeColor) - simpa [holdColor] using holdEdge + SharedFacts.TerminalRebuild.hchoiceEdgeNewStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hchoiceEdgeNew.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hnotStrongPrev_3595.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k), DefectiveColor G sigmaPrev (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) choice.color → ¬ColoredVertexSetStronglyClosed G - sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev - hchoiceDefective hstrong - have hone : 1 < (BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) - choice.color).card := by - have htwo : 2 ≤ (BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) - choice.color).card := hchoiceDefective - omega - obtain ⟨f, hf, g, hg, hfg⟩ := Finset.one_lt_card.mp hone - have hfBoundary := (Finset.mem_filter.mp hf).1 - have hgBoundary := (Finset.mem_filter.mp hg).1 - have hfColor := (Finset.mem_filter.mp hf).2 - have hgColor := (Finset.mem_filter.mp hg).2 - exact (hstrong.2 hfBoundary hgBoundary hfg hfColor) hgColor + SharedFacts.TerminalRebuild.hnotStrongPrevStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hnotStrongPrev.{u_1, u_2} theorem helper_hnewAlternative_3611.{u_1, u_2} : open scoped Classical in @@ -5340,38 +4583,10 @@ theorem helper_hseriesStable_3961.{u_1, u_2} : rw [hj, hfinalColor] exact hsigmaStable +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hreplacementCurrentTree_4014.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → - ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input - (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 - originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), - corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = - ett.series.data.tree (Fin.last ett.rounds).castSucc → - let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; - corr.replacementSeries.data.tree replacementLast.succ = ett.series.data.tree - q.succ.castSucc := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q hqSucc sigmaPrev originalPrefix - corr hcorrFinalTree replacementLast - have hlastTree : replacementLast.succ = - Fin.last (originalPrefix.rounds + 1) := by - apply Fin.ext - simp [replacementLast] - rw [hlastTree, hcorrFinalTree, hqSucc] + SharedFacts.TerminalRebuild.hreplacementCurrentTreeStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hreplacementCurrentTree.{u_1, u_2} theorem helper_horiginalCurrentTree_4022.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean index de42979745..b0a256f66e 100644 --- a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean +++ b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.TerminalRebuildTransport + + + public import LeanPool.GoldbergSeymour.TerminalSeriesRebuildPreparation public import LeanPool.GoldbergSeymour.TashkinovSeriesAppend public import LeanPool.GoldbergSeymour.ExtensionBase @@ -1410,25 +1414,10 @@ theorem helper_hseriesStable_4663.{u_1, u_2} : rw [hilast, hindex, hfinalColor] exact hsigmaStable +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hi_4786.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (i : Fin ett.rounds), Fin.last ett.rounds = i.succ → i = q := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q i htarget - apply Fin.ext - have hv : ett.rounds = i.val + 1 := by - simpa using congrArg Fin.val htarget - change i.val = ett.rounds - 1 - omega + SharedFacts.RevisitingTerminalPreparation.hiStatement.{u_1, u_2} := + SharedFacts.RevisitingTerminalPreparation.hi.{u_1, u_2} theorem helper_hcomponent_4809.{u_1, u_2} : open scoped Classical in @@ -1886,94 +1875,20 @@ theorem helper_stableSelected_5146.{u_1, u_2} : (@secondStableOneUncolored) (@choice) (@secondStableRelation) (@undoneProper) (@undoneOne) (@treeSecondSelected) (@stableSecond) +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hchoiceDefective_5167.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k), BoundaryColorEdges G choice.selected - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color = - BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree - q.succ.castSucc)) choice.color → DefectiveColor G sigmaPrev (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) choice.color := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hdeltaBoundary - obtain ⟨oldColor, holdDefective, holdEdge⟩ := choice.edgeDefective - have holdColor : oldColor = choice.color := by - have holdEdgeColor := (Finset.mem_filter.mp holdEdge).2 - exact Option.some.inj (holdEdgeColor.symm.trans choice.edgeColor) - subst oldColor - unfold DefectiveColor - rw [← hdeltaBoundary] - exact holdDefective + SharedFacts.TerminalRebuild.hchoiceDefectiveStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hchoiceDefective.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hchoiceEdgeNew_5178.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k), BoundaryColorEdges G choice.selected - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color = - BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree - q.succ.castSucc)) choice.color → choice.edge ∈ BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) choice.color := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev hdeltaBoundary - rw [← hdeltaBoundary] - obtain ⟨oldColor, holdDefective, holdEdge⟩ := choice.edgeDefective - have holdColor : oldColor = choice.color := by - have holdEdgeColor := (Finset.mem_filter.mp holdEdge).2 - exact Option.some.inj (holdEdgeColor.symm.trans choice.edgeColor) - simpa [holdColor] using holdEdge + SharedFacts.TerminalRebuild.hchoiceEdgeNewStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hchoiceEdgeNew.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hnotStrongPrev_5207.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k), DefectiveColor G sigmaPrev (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) choice.color → ¬ColoredVertexSetStronglyClosed G - sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q choice sigmaPrev - hchoiceDefective hstrong - have hone : 1 < (BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) - choice.color).card := by - have htwo : 2 ≤ (BoundaryColorEdges G sigmaPrev - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) - choice.color).card := hchoiceDefective - omega - obtain ⟨f, hf, g, hg, hfg⟩ := Finset.one_lt_card.mp hone - have hfBoundary := (Finset.mem_filter.mp hf).1 - have hgBoundary := (Finset.mem_filter.mp hg).1 - have hfColor := (Finset.mem_filter.mp hf).2 - have hgColor := (Finset.mem_filter.mp hg).2 - exact (hstrong.2 hfBoundary hgBoundary hfg hfColor) hgColor + SharedFacts.TerminalRebuild.hnotStrongPrevStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hnotStrongPrev.{u_1, u_2} theorem helper_hnewAlternativeFails_5223.{u_1, u_2} : open scoped Classical in @@ -3039,65 +2954,15 @@ theorem helper_hseriesStable_5785.{u_1, u_2} : rw [hj, hfinalColor] exact hsigmaStable +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_branch_5820.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (Tstar : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → ett.series.data.kind q.succ = some - TashkinovExtensionKind.PE → ((ett.series.data.kind (Fin.last ett.rounds) = some - TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) = some - TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = - ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last - ett.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence sigma seed Tstar) → Nonempty - (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q hqSucc hpeKind hsimple - rcases hsimple.1 with hse | hre - · have hbad := hpeKind.symm.trans (by simpa [hqSucc] using hse) - cases hbad - · have hbad := hpeKind.symm.trans (by simpa [hqSucc] using hre) - cases hbad + SharedFacts.TerminalRebuildTransport.branchStatement.{u_1, u_2} := + SharedFacts.TerminalRebuildTransport.branch.{u_1, u_2} +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hreplacementCurrentTree_5844.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → - ∀ (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree G k e0 input - (ett.series.data.tree (Fin.last ett.rounds).castSucc) (ett.series.data.coloring - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (ett.rounds + (1 : ℕ))))) (corr : CorrespondingExtendedTashkinovTree G k e0 - originalPrefix sigmaPrev (ett.series.data.tree (Fin.last ett.rounds).castSucc)), - corr.replacementSeries.data.tree (Fin.last (originalPrefix.rounds + (1 : ℕ))) = - ett.series.data.tree (Fin.last ett.rounds).castSucc → - let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last originalPrefix.rounds; - corr.replacementSeries.data.tree replacementLast.succ = ett.series.data.tree - q.succ.castSucc := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive _ q hqSucc sigmaPrev originalPrefix - corr hcorrFinalTree replacementLast - have hlastTree : replacementLast.succ = - Fin.last (originalPrefix.rounds + 1) := by - apply Fin.ext - simp [replacementLast] - rw [hlastTree, hcorrFinalTree, hqSucc] + SharedFacts.TerminalRebuild.hreplacementCurrentTreeStatement.{u_1, u_2} := + SharedFacts.TerminalRebuild.hreplacementCurrentTree.{u_1, u_2} theorem helper_horiginalCurrentTree_5852.{u_1, u_2} : open scoped Classical in @@ -3460,21 +3325,10 @@ theorem helper_hpeAlternativeReplacement_5946.{u_1, u_2} : rw [hreplacementCurrentTree] simpa [replacementChoice, newChoice] using hrhoNotDisjoint +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_hne_6004.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) (ch - : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), g ∈ - MissingColors G second ch.vertex → second ch.edge = some ch.color → g ≠ ch.color := by - classical - intro V E _ _ G k e0 X C phi ch g second hgSecond hedgeSecond heq - have hpresent : g ∈ PresentColors G second ch.vertex := by - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨ch.edge, ch.edgeIncident, by simpa [heq] using hedgeSecond⟩ - have hnotPresent : g ∉ PresentColors G second ch.vertex := by - simpa [MissingColors] using hgSecond - exact hnotPresent hpresent + SharedFacts.RevisitingTerminalPreparation.hneStatement.{u_1, u_2} := + SharedFacts.RevisitingTerminalPreparation.hne.{u_1, u_2} theorem helper_hindexMap_6123.{u_1, u_2} : open scoped Classical in @@ -4752,32 +4606,10 @@ theorem helper_hseriesStable_6952.{u_1, u_2} : rw [hilast, hindex, hfinalColor] exact hsigmaStable +/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_branch_7068.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (Tstar : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); q.succ = Fin.last ett.rounds → ett.series.data.kind q.succ = some - TashkinovExtensionKind.PE → ((ett.series.data.kind (Fin.last ett.rounds) = some - TashkinovExtensionKind.SE ∨ ett.series.data.kind (Fin.last ett.rounds) = some - TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), ett.series.data.connectingEdges (Fin.last ett.rounds) = - ({ f } : Finset E) ∧ TreeSequenceAdjoinEdge (ett.series.data.tree (Fin.last - ett.rounds).castSucc) f seed ∧ TashkinovAugmentationSequence sigma seed Tstar) → Nonempty - (CorrespondingExtendedTashkinovTree G k e0 ett sigma Tstar) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q hqSucc hpeKind hsimple - rcases hsimple.1 with hse | hre - · have hbad := hpeKind.symm.trans (by simpa [hqSucc] using hse) - cases hbad - · have hbad := hpeKind.symm.trans (by simpa [hqSucc] using hre) - cases hbad + SharedFacts.TerminalRebuildTransport.branchStatement.{u_1, u_2} := + SharedFacts.TerminalRebuildTransport.branch.{u_1, u_2} private theorem helper_continuation_4951.{u_1, u_2} : helperContinuation4951Conditions.{u_1, u_2} := by diff --git a/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean b/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean index f4205560dc..a215e042cd 100644 --- a/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean +++ b/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean @@ -6,7 +6,6 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition public import LeanPool.GoldbergSeymour.TreeMissingColors public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary @@ -113,6 +112,25 @@ theorem TreeSequenceFirstMissingPositionEqCast {V E : Type*} [Fintype E] exact congrArg Fin.val (TreeSequenceFirstMissingPositionEq segment elementary (show position.val ≤ initialSegment.length from Nat.le_of_lt_succ position.isLt) witness) +/-- A first missing position strictly before the fallback endpoint is an actual missing witness. -/ +theorem TreeSequenceFirstMissingPositionMem {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {tree : TreeSequence G e0} {color : Fin k} + (beforeLast : (HierarchyFirstMissingPosition phi tree color).val < tree.length) : + color ∈ MissingColors G phi (tree.vertex (HierarchyFirstMissingPosition phi tree color)) := by + classical + let candidates := Finset.univ.filter fun index : Fin (tree.length + 1) => + color ∈ MissingColors G phi (tree.vertex index) + by_cases nonempty : candidates.Nonempty + · unfold HierarchyFirstMissingPosition + rw [dite_eq_left nonempty] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates nonempty)).2 + · have last : (HierarchyFirstMissingPosition phi tree color).val = tree.length := by + unfold HierarchyFirstMissingPosition + rw [dite_eq_right nonempty] + rfl + omega + end GoldbergSeymour end From b3795278cbdd83738da8e985c700590383ba4fc6 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Fri, 6 Nov 2026 02:11:35 +0000 Subject: [PATCH 08/11] Share tree and Kempe facts and remove redundant proof contracts --- .../AlgorithmThreeOneStepExists.lean | 1 - .../ChangeLemmaBothInside.lean | 368 +--- .../ChangeLemmaMixedClosedFinal.lean | 1107 +---------- .../ChangeLemmaMixedLargestClosed.lean | 1771 ++--------------- .../ChangeLemmaMixedNoClosed.lean | 193 +- ...ntaryClosedExitPairDistinctComponents.lean | 305 +-- ...ElementaryClosedExitPairSameComponent.lean | 303 +-- .../ExtensionBaseAlgorithmBInduction.lean | 68 +- .../ExtensionBaseAlgorithmC.lean | 70 +- .../ExtensionBaseAuxiliary.lean | 314 +-- .../ExtensionBaseBranchLemmas.lean | 710 +------ .../ExtensionBaseBranchPreparation.lean | 133 -- .../ExtensionBaseCaseTwoContradiction.lean | 153 +- .../ExtensionBaseClaimTreeEdgeColors.lean | 50 +- .../ExtensionBaseStepLemmas.lean | 32 - .../ExtensionRulesTerminalStoredDisjoint.lean | 1 - ...oodHierarchySameDividerReconstruction.lean | 1 - .../GoodHierarchySameDividerTransport.lean | 1 - .../HierarchyClaimNineFirstUseSeed.lean | 24 +- ...rarchySituationOneAdvanceInsideStored.lean | 53 +- ...hySituationOneShorteningContradiction.lean | 611 +----- ...ionThreeDisjointThetaStoredImpossible.lean | 6 +- ...ointThetaUnstoredBetaStoredImpossible.lean | 6 +- ...tuationTwoSubcaseOneOneNonexceptional.lean | 84 +- .../HierarchySituationTwoSubcaseThreeTwo.lean | 145 +- ...tuationTwoSubcaseTwoOneNonexceptional.lean | 104 +- .../HierarchySituationTwoSubcaseTwoTwo.lean | 604 +----- .../HkuMissingStoredMonotone.lean | 50 +- LeanPool/GoldbergSeymour/Imports.lean | 7 +- .../GoldbergSeymour/OutsidePrefixBranch.lean | 47 +- ...rallelTwoConstituentPathContradiction.lean | 68 +- .../SameColorSeriesPreserved.lean | 49 +- .../ScheideDefectiveDeletedTreePair.lean | 4 +- .../ScheideDefectiveNoCross.lean | 53 +- .../ScheideDefectiveReturnContradiction.lean | 3 +- .../ScheideDefectiveThirdBoundaryEdge.lean | 54 +- .../SharedFacts/DisjointThetaTransport.lean | 23 - .../ExtensionBranchPreparation.lean | 125 +- .../SharedFacts/ExtensionBranches.lean | 68 +- .../SharedFacts/UnsupportedVertexColors.lean | 42 +- .../GoldbergSeymour/SplitSwapPreparation.lean | 395 +--- .../Step1CaseTwoOutsideTwoEdgeExtension.lean | 61 +- ...novAugmentationSequenceInitialSegment.lean | 33 +- ...ashkinovAugmentationSequenceTransport.lean | 69 + .../TashkinovSeriesTreeFacts.lean | 70 + .../TerminalSeriesRebuildTransport.lean | 61 +- ...n => TreeSequenceAdjoinEdgeVertexSet.lean} | 25 +- .../TreeSequenceColoringFacts.lean | 12 + .../TreeVerticesBeforeFacts.lean | 79 + .../TwoColorComponentLeafPaths.lean | 220 ++ .../TwoColorComponentSwapPresentColors.lean | 69 +- .../TwoColorMissingVertexNeighbors.lean | 123 ++ 52 files changed, 1055 insertions(+), 7973 deletions(-) create mode 100644 LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceTransport.lean create mode 100644 LeanPool/GoldbergSeymour/TashkinovSeriesTreeFacts.lean rename LeanPool/GoldbergSeymour/{SharedFacts/ScheideDefectiveDeletedTreePair.lean => TreeSequenceAdjoinEdgeVertexSet.lean} (79%) create mode 100644 LeanPool/GoldbergSeymour/TreeVerticesBeforeFacts.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorComponentLeafPaths.lean create mode 100644 LeanPool/GoldbergSeymour/TwoColorMissingVertexNeighbors.lean diff --git a/LeanPool/GoldbergSeymour/AlgorithmThreeOneStepExists.lean b/LeanPool/GoldbergSeymour/AlgorithmThreeOneStepExists.lean index 4ec04618ad..d031c0d79e 100644 --- a/LeanPool/GoldbergSeymour/AlgorithmThreeOneStepExists.lean +++ b/LeanPool/GoldbergSeymour/AlgorithmThreeOneStepExists.lean @@ -15,7 +15,6 @@ public import LeanPool.GoldbergSeymour.TreeExitComponentMeetsTreeOnlyAtExit public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists public import LeanPool.GoldbergSeymour.TwoColorComponentSwapProper -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! # Algorithm Three One Step Exists diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean index 3b4c243dee..e8b8107241 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean @@ -629,34 +629,6 @@ private theorem helper_nonPEMissingClosed_914.{u_1, u_2} : phi f = some c := by simpa [BoundaryColorEdges] using hf exact hnonPEClosed hnonPE hfd.1 hx hfd.2 hcx -private theorem helper_trans_889.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) - (_ : TreeSequenceInitialSegment W Z), - TreeSequenceInitialSegment U Z := by - classical - intro V E G e0 U W Z hUW hWZ - exact @helper_trans_800 (@V) (@E) (@G) (@e0) (@U) (@W) (@Z) (@hUW) (@hWZ) - -private theorem helper_stageChain_894.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - ∀ (_ : ( - ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : - TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (j : ℕ) (hj : j < - H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : ℕ) ≤ j), - TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : - ℕ)))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H trans - exact @helper_stageChain_600 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) - private theorem helper_starStage_899.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -673,28 +645,6 @@ private theorem helper_starStage_899.{u_1, u_2} : · exact H.coreInsideFirst · exact H.nested i.succ -private theorem helper_starChain_906.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - ∀ (_ : ( - ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : - TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : ( - ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : - ℕ) ≤ j), TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + - (2 : ℕ)))))) (_ : ( - ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H r) - (H.stage r.succ))) (r s : Fin (H.dividerCount + (1 : ℕ))) (_ : r ≤ s), - TreeSequenceInitialSegment (HierarchyStarredStage H r) (HierarchyStarredStage H s) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H trans stageChain starStage r s hrs - exact @helper_starChain_626 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) (@stageChain) - (@starStage) (@r) (@s) (@hrs) - private theorem helper_hAT_912.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -713,31 +663,6 @@ private theorem helper_hAT_912.{u_1, u_2} : have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl simpa [hlast, H.terminalStage] using hh -private theorem helper_hATy_916.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Ty : TreeSequence G e0 := - TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction - fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ - by omega) - (by omega); - ∀ (_ : TreeSequenceInitialSegment A T), - TreeSequenceInitialSegment A Ty := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hAT - exact @helper_hATy_738 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) - private theorem helper_helemStar_926.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -759,55 +684,6 @@ private theorem helper_helemStar_926.{u_1, u_2} : intro u hu v hv hne' exact helemA (hsub hu) (hsub hv) hne' -private theorem helper_missingFirst_933.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Ty : TreeSequence G e0 := - TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction - fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ - by omega) - (by omega); - ∀ (_ : TreeSequenceInitialSegment Ty T), - ∀ c ∈ TreeMissingColors phi Ty, - c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hTyT c hc - exact @helper_missingFirst_764 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hTyT) (@c) (@hc) - -private theorem helper_pathMissing_944.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : - IsProperEdgeColoring G phi) (alpha beta : Fin k) (_ : ( - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T - (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | - ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : - Finset (Fin k)))) (c d : Fin k) (_ : c ≠ d) (v : V) (_ : c ∈ MissingColors G phi v), - TwoColorPathComponent G phi c d (Sum.inl v) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper alpha beta _ c d hcd v hc - exact @helper_pathMissing_696 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) - (@alpha) (@beta) (by assumption) (@c) (@d) (@hcd) (@v) (@hc) - private theorem helper_graphSwap_950.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -842,44 +718,6 @@ private theorem helper_componentSwap_955.{u_1, u_2} : unfold TwoColorComponent rw [graphSwap] -private theorem helper_interchangeableSwap_959.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 - : E) (phi : PartialEdgeColoring E k) (_ : ( - ∀ (c d : Fin k), TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c)) (_ : ( - ∀ (c d : Fin k) (z : V ⊕ E), TwoColorComponent G phi c d z = TwoColorComponent G phi d c z)) - (B : TreeSequence G e0) (c d : Fin k) (_ : TreeInterchangeable G B phi c d), - TreeInterchangeable G B phi d c := by - classical - intro V E _ _ G k e0 phi graphSwap componentSwap B c d hi - let _ := Fintype.ofFinite V - let _ := Fintype.ofFinite E - exact @helper_interchangeableSwap_801 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) - (@phi) (@graphSwap) (@componentSwap) (@B) (@c) (@d) (@hi) - -private theorem helper_equalFromInterchange_964.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (alpha beta : Fin k) (_ : - alpha ≠ beta), - let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); - let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); - ∀ (_ : alpha ∈ MissingColors G phi a) (_ : beta ∈ MissingColors G phi b) (_ : ( - ∀ (c d : Fin k) (_ : c ≠ d) (v : V) (_ : c ∈ MissingColors G phi v), TwoColorPathComponent G - phi c d (Sum.inl v))) (_ : ( - ∀ (c d : Fin k), TwoColorIncidenceGraph G phi c d = TwoColorIncidenceGraph G phi d c)) (_ : ( - ∀ (c d : Fin k) (z : V ⊕ E), TwoColorComponent G phi c d z = TwoColorComponent G phi d c z)) - (B : TreeSequence G e0) (_ : a ∈ TreeSequenceVertexSet B) (_ : b ∈ TreeSequenceVertexSet - B) (_ : TreeInterchangeable G B phi alpha beta), TwoColorComponent G phi alpha beta - (Sum.inl a) = TwoColorComponent G phi alpha beta (Sum.inl b) := by - classical - intro V E _ _ G k e0 T phi alpha beta hne a b haMissing hbMissing pathMissing graphSwap - componentSwap B haB hbB hi - let _ := Fintype.ofFinite V - exact @helper_equalFromInterchange_881 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) - (@T) (@phi) (@alpha) (@beta) (@hne) (@haMissing) (@hbMissing) (@pathMissing) (@graphSwap) - (@componentSwap) (@B) (@haB) (@hbB) (@hi) - private theorem helper_bothClosed_972.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) @@ -896,186 +734,6 @@ private theorem helper_bothClosed_972.{u_1, u_2} : rw [hd beta (Finset.mem_singleton_self _)] simp -private theorem helper_hnonPEClosed_987.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : - IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (alpha beta : Fin k) (_ : ( - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T - (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | - ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : - Finset (Fin k)))), - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - ∀ (_ : ( - ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : - TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : - ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), ColoredVertexSetClosed G phi - (TreeSequenceVertexSet Tn) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone alpha beta _ n Tn trans hnonPE - exact @helper_hnonPEClosed_372 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) - (@alpha) (@beta) (by assumption) (@trans) (@hnonPE) - -private theorem helper_nonPEMissingClosed_993.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta - : Fin k) (_ : ( - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - ∀ (_ : alpha ∉ TreeMissingColors phi A ∨ beta ∉ TreeMissingColors phi A), TreeVertexOrder T - (T.vertex ia) (T.vertex ib) ∧ alpha ∉ ({c : Fin k | - ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑ib : ℕ) ∧ phi (T.edge t) = some c} : - Finset (Fin k)))), - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - ∀ (_ : ( - ∀ (_ : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), ColoredVertexSetClosed G phi - (TreeSequenceVertexSet Tn))) (_ : ett.series.data.kind n ≠ some - TashkinovExtensionKind.PE), - ∀ c ∈ TreeMissingColors phi Tn, TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta _ n Tn hnonPEClosed hnonPE c hc - exact @helper_nonPEMissingClosed_914 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) - (by assumption) (@hnonPEClosed) (@hnonPE) (@c) (@hc) - -private theorem helper_closedStar_1000.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : - IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (_ : - LowerRoundInductionHypothesis G k e0 ett.rounds) (_ : ( - ∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} - {generating' : PartialEdgeColoring E k} (other : ExtendedTashkinovTree G k e0 input' T' - generating') (_ : other.rounds = ett.rounds) (_ : MaximumProperty other) (base' : - HierarchyBase other generating') (K : TashkinovHierarchy other base') (_ : GoodHierarchy - K) (_ : K.dividerCount < C.hierarchy.dividerCount), ColoredVertexSetElementary G - generating' (TreeSequenceVertexSet T'))) (_ : ( - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; (2 : ℕ) * ett.rounds + (11 : ℕ) - ≤ (TreeMissingColors phi Tn).card)), - let H : TashkinovHierarchy ett base := C.hierarchy; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - ∀ (_ : ( - ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi - (TreeSequenceVertexSet (HierarchyStarredStage H r)))) (_ : CombinedStableColoring Tn - base.closure (TashkinovStoredColors ett.series.data n) phi phi) (_ : ( - ∀ (_ : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), - ∀ c ∈ TreeMissingColors phi Tn, TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k)))) (r : - Fin (H.dividerCount + (1 : ℕ))) (c d : Fin k) (_ : c ≠ d) (_ : c ∈ TreeMissingColors phi - (HierarchyStarredStage H r)) (_ : d ∈ TreeMissingColors phi (HierarchyStarredStage H r)) - (_ : TreeColorSetClosed G phi (HierarchyStarredStage H r) ({ c } : Finset (Fin k))), - TreeInterchangeable G (HierarchyStarredStage H r) phi c d := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge H n Tn - helemStar hcombined nonPEMissingClosed r c d hcd hc hd hclosed - exact @helper_closedStar_471 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) - (@hlower) (@hfewer) (@hlarge) (@helemStar) (@hcombined) (@nonPEMissingClosed) (@r) (@c) - (@d) (@hcd) (@hc) (@hd) (@hclosed) - -private theorem helper_coreSame_1010.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : - IsProperEdgeColoring G phi) (_ : IsOneEdgeUncolored phi e0) (_ : - LowerRoundInductionHypothesis G k e0 ett.rounds) (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); - let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); - ∀ (_ : ( - ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi - (TreeSequenceVertexSet (HierarchyStarredStage H r)))) (_ : alpha ∈ MissingColors G phi a) - (_ : beta ∈ MissingColors G phi b) (_ : ( - ∀ (B : TreeSequence G e0) (c d : Fin k) (_ : TreeInterchangeable G B phi c d), - TreeInterchangeable G B phi d c)) (_ : ( - ∀ (B : TreeSequence G e0) (_ : a ∈ TreeSequenceVertexSet B) (_ : b ∈ TreeSequenceVertexSet B) - (_ : TreeInterchangeable G B phi alpha beta), TwoColorComponent G phi alpha beta (Sum.inl - a) = TwoColorComponent G phi alpha beta (Sum.inl b))) (_ : ( - ∀ (B : TreeSequence G e0) (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B)) (_ - : TreeColorSetClosed G phi B ({ alpha } : Finset (Fin k))) (_ : TreeColorSetClosed G phi B - ({ beta } : Finset (Fin k))), TreeInterchangeable G B phi alpha beta)) (_ : - CombinedStableColoring Tn base.closure (TashkinovStoredColors ett.series.data n) phi phi) - (_ : ( - ∀ (_ : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE), - ∀ c ∈ TreeMissingColors phi Tn, TreeColorSetClosed G phi Tn ({ c } : Finset (Fin k)))) (_ : a - ∈ TreeSequenceVertexSet base.core) (_ : b ∈ TreeSequenceVertexSet base.core), - TwoColorComponent G phi alpha beta (Sum.inl a) = TwoColorComponent G phi alpha beta - (Sum.inl b) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H n Tn a b - helemStar haMissing hbMissing interchangeableSwap equalFromInterchange bothClosed hcombined - nonPEMissingClosed haCore hbCore - exact @helper_coreSame_500 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) - (@alpha) (@beta) (@helemStar) (@haMissing) (@hbMissing) (@interchangeableSwap) - (@equalFromInterchange) (@bothClosed) (@hcombined) (@nonPEMissingClosed) (@haCore) (@hbCore) - -private theorem helper_hsame_1022.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta - : Fin k) (_ : alpha ≠ beta), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let a : V := T.vertex (HierarchyFirstMissingPosition phi T alpha); - let b : V := T.vertex (HierarchyFirstMissingPosition phi T beta); - ∀ (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A)) (_ : ( - ∀ (r : Fin (H.dividerCount + (1 : ℕ))), ColoredVertexSetElementary G phi - (TreeSequenceVertexSet (HierarchyStarredStage H r)))) (_ : alpha ∈ MissingColors G phi a) - (_ : beta ∈ MissingColors G phi b) (_ : a ∈ TreeSequenceVertexSet A) (_ : b ∈ - TreeSequenceVertexSet A) (_ : ( - ∀ (B : TreeSequence G e0) (c d : Fin k) (_ : TreeInterchangeable G B phi c d), - TreeInterchangeable G B phi d c)) (_ : ( - ∀ (B : TreeSequence G e0) (_ : a ∈ TreeSequenceVertexSet B) (_ : b ∈ TreeSequenceVertexSet B) - (_ : TreeInterchangeable G B phi alpha beta), TwoColorComponent G phi alpha beta (Sum.inl - a) = TwoColorComponent G phi alpha beta (Sum.inl b))) (_ : ( - ∀ (B : TreeSequence G e0) (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet B)) (_ - : TreeColorSetClosed G phi B ({ alpha } : Finset (Fin k))) (_ : TreeColorSetClosed G phi B - ({ beta } : Finset (Fin k))), TreeInterchangeable G B phi alpha beta)) (_ : ( - ∀ (r : Fin (H.dividerCount + (1 : ℕ))) (c d : Fin k) (_ : c ≠ d) (_ : c ∈ TreeMissingColors - phi (HierarchyStarredStage H r)) (_ : d ∈ TreeMissingColors phi (HierarchyStarredStage H - r)) (_ : TreeColorSetClosed G phi (HierarchyStarredStage H r) ({ c } : Finset (Fin k))), - TreeInterchangeable G (HierarchyStarredStage H r) phi c d)) (_ : ( - ∀ (_ : a ∈ TreeSequenceVertexSet base.core) (_ : b ∈ TreeSequenceVertexSet base.core), - TwoColorComponent G phi alpha beta (Sum.inl a) = TwoColorComponent G phi alpha beta - (Sum.inl b))) (_ : alpha ∈ TreeMissingColors phi A) (_ : beta ∈ TreeMissingColors phi A), - TwoColorComponent G phi alpha beta (Sum.inl a) = TwoColorComponent G phi alpha beta - (Sum.inl b) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A a b helemA helemStar - haMissing hbMissing haA hbA interchangeableSwap equalFromInterchange bothClosed closedStar - coreSame haMissingA hbMissingA - exact @helper_hsame_542 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) - (@helemA) (@helemStar) (@haMissing) (@hbMissing) (@haA) (@hbA) (@interchangeableSwap) - (@equalFromInterchange) (@bothClosed) (@closedStar) (@coreSame) (@haMissingA) (@hbMissingA) - private theorem helper_continuation_1524.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1152,20 +810,20 @@ private theorem helper_continuation_1524.{u_1, u_2} : have hnonPEClosed (hnonPE : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE) : ColoredVertexSetClosed G phi (TreeSequenceVertexSet Tn) := by - exact @helper_hnonPEClosed_987 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_hnonPEClosed_372 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@alpha) (@beta) (by assumption) (@trans) (@hnonPE) have nonPEMissingClosed (hnonPE : ett.series.data.kind n ≠ some TashkinovExtensionKind.PE) (c : Fin k) (hc : c ∈ TreeMissingColors phi Tn) : TreeColorSetClosed G phi Tn {c} := by - exact @helper_nonPEMissingClosed_993 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_nonPEMissingClosed_914 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (by assumption) (@hnonPEClosed) (@hnonPE) (@c) (@hc) - have closedStar := @helper_closedStar_1000 (@V) (@E) inferInstance inferInstance inferInstance + have closedStar := @helper_closedStar_471 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) (@hfewer) (@hlarge) (@helemStar) (@hcombined) (@nonPEMissingClosed) - have coreSame := @helper_coreSame_1010 (@V) (@E) inferInstance inferInstance inferInstance + have coreSame := @helper_coreSame_500 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) (@alpha) (@beta) (@helemStar) (@haMissing) (@hbMissing) (@interchangeableSwap) (@equalFromInterchange) (@bothClosed) (@hcombined) (@nonPEMissingClosed) @@ -1174,7 +832,7 @@ private theorem helper_continuation_1524.{u_1, u_2} : have hbMissingA : beta ∈ TreeMissingColors phi A := Finset.mem_biUnion.mpr ⟨b, hbA, hbMissing⟩ have hsame := - @helper_hsame_1022 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + @helper_hsame_542 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@helemA) (@helemStar) (@haMissing) (@hbMissing) (@haA) (@hbA) (@interchangeableSwap) (@equalFromInterchange) (@bothClosed) (@closedStar) (@coreSame) (@haMissingA) (@hbMissingA) @@ -1293,20 +951,20 @@ theorem ChangeLemmaBothInside {V E : Type*} (min (A.length + ((T.length - A.length) - 1)) T.length) (by have hA := A.positive; have hT := T.positive; omega) (Nat.min_le_right _ _) - have trans := @helper_trans_889 (@V) (@E) (@G) (@e0) + have trans := @helper_trans_800 (@V) (@E) (@G) (@e0) have stageChain := - @helper_stageChain_894 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + @helper_stageChain_600 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) have starStage := @helper_starStage_899 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - have starChain := @helper_starChain_906 (@V) (@E) inferInstance inferInstance inferInstance + have starChain := @helper_starChain_626 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) (@stageChain) (@starStage) have hAT := @helper_hAT_912 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@starStage) have hATy := - @helper_hATy_916 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) + @helper_hATy_738 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) have hTyT : TreeSequenceInitialSegment Ty T := ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ @@ -1317,7 +975,7 @@ theorem ChangeLemmaBothInside {V E : Type*} (TreeSequenceInitialSegmentVertexSetSubset hATy hv) hne' have helemStar := @helper_helemStar_926 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@starChain) (@helemA) - have missingFirst := @helper_missingFirst_933 (@V) (@E) inferInstance inferInstance inferInstance + have missingFirst := @helper_missingFirst_764 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hTyT) have haMissing : alpha ∈ MissingColors G phi a := missingFirst alpha hmissingPrefix.1 @@ -1328,7 +986,7 @@ theorem ChangeLemmaBothInside {V E : Type*} have pathMissing (c d : Fin k) (hcd : c ≠ d) (v : V) (hc : c ∈ MissingColors G phi v) : TwoColorPathComponent G phi c d (Sum.inl v) := by - exact @helper_pathMissing_944 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_pathMissing_696 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@alpha) (@beta) (by assumption) (@c) (@d) (@hcd) (@v) (@hc) have graphSwap (c d : Fin k) : @@ -1337,9 +995,9 @@ theorem ChangeLemmaBothInside {V E : Type*} (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (by assumption) (@c) (@d) have componentSwap := @helper_componentSwap_955 (@V) (@E) (@G) (@k) (@phi) (@graphSwap) - have interchangeableSwap := @helper_interchangeableSwap_959 (@V) (@E) inferInstance inferInstance + have interchangeableSwap := @helper_interchangeableSwap_801 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@graphSwap) (@componentSwap) - have equalFromInterchange := @helper_equalFromInterchange_964 (@V) (@E) inferInstance + have equalFromInterchange := @helper_equalFromInterchange_881 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) (@T) (@phi) (@alpha) (@beta) (@hne) (@haMissing) (@hbMissing) (@pathMissing) (@graphSwap) (@componentSwap) have bothClosed := @helper_bothClosed_972 (@V) (@E) inferInstance inferInstance (@G) (@k) (@e0) diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean index 2928a3e7fc..3fa1112696 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean @@ -1345,101 +1345,6 @@ private theorem helper_hinter_3043.{u_1, u_2} : (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) (@hfewer) (@hlarge) (@alpha) (@beta) (@hne) (@lastPositive) (@halphaA) (@halphaClosed) (@hz) -private theorem helper_replacement_3186.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - IsProperEdgeColoring G phi → - IsOneEdgeUncolored phi e0 → - LowerRoundInductionHypothesis G k e0 ett.rounds → - ∀ (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment base.core A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - MaximumProperty - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } → - ∀ - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - baseB.core = base.core → - ∀ - (HB : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - IsProperEdgeColoring G sigma → - IsOneEdgeUncolored sigma e0 → - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - ∀ (D : Finset (Fin k)), StableColoring S D phi sigma) → - StableColoring Tn Dn phi sigma → - TreeSequenceInitialSegment Tn B → - Tn.length < B.length → - (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence phi Tn B ∨ - (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ - ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), - ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → - (∀ (S : TreeSequence G e0), - TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → - ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), - MaximumProperty corr.replacementETT ∧ - ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : - TashkinovHierarchy corr.replacementETT baseS), SameHierarchyStages HB HS := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn Dn ib - vb coreToA hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma - sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport - exact @helper_replacement_855 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) - (@hlower) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) - (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) - (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) - private theorem helper_storedEq_3248.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -2349,1004 +2254,6 @@ private theorem helper_pathLe_3363.{u_1, u_2} : (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) -private theorem helper_replacement_4227.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - IsProperEdgeColoring G phi → - IsOneEdgeUncolored phi e0 → - LowerRoundInductionHypothesis G k e0 ett.rounds → - ∀ (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment base.core A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - MaximumProperty - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } → - ∀ - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - baseB.core = base.core → - ∀ - (HB : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - IsProperEdgeColoring G sigma → - IsOneEdgeUncolored sigma e0 → - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - ∀ (D : Finset (Fin k)), StableColoring S D phi sigma) → - StableColoring Tn Dn phi sigma → - TreeSequenceInitialSegment Tn B → - Tn.length < B.length → - (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence phi Tn B ∨ - (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ - ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), - ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → - (∀ (S : TreeSequence G e0), - TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → - ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), - MaximumProperty corr.replacementETT ∧ - ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : - TashkinovHierarchy corr.replacementETT baseS), SameHierarchyStages HB HS := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta H q A n Tn Dn ib - vb coreToA hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma - sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport - exact @helper_replacement_3186 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) - (@hlower) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) - (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) - (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) - -private theorem helper_storedEq_4289.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn → - ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - exact @helper_storedEq_3248 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) - (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) - (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) - -private theorem helper_missingEq_4298.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - exact @helper_missingEq_3257 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) - (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) - (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@j) - -private theorem helper_segmentEq_4325.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - (∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = - HierarchyFirstMissingPosition phi B eta) → - ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - exact @helper_segmentEq_3284 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) - (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) - -private theorem helper_refreshEq_4335.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact @helper_refreshEq_3294 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) - (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@i) - -private theorem helper_hstarLast_4390.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (hcountB : - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount = - H.dividerCount), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc = - H.stage jo.castSucc ∧ - HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j = - HierarchyStarredStage H jo) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - HierarchyStarredStage HS (Fin.last count) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested - hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - exact @helper_hstarLast_3349 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) - (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) - (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) - (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) (@hspositive) - (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) - (@starEq) - -private theorem helper_pathLe_4404.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - A.length < B.length → - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - HierarchyStarredStage HS (Fin.last count) = A → - HierarchyPathNumber HS ≤ HierarchyPathNumber H := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb AToT hAib B BToT - ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - exact @helper_pathLe_3363 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) - (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) - (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) - (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) - private theorem helper_continuation_5185.{u_1, u_2} : helperContinuation5185Conditions.{u_1, u_2} := by classical @@ -3387,7 +2294,7 @@ private theorem helper_continuation_5185.{u_1, u_2} : exact Fin.cases hcore.symm (fun i => rfl) j have storedEq (j : Fin (count + 1)) : HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - exact @helper_storedEq_4289 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @helper_storedEq_3248 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) @@ -3396,7 +2303,7 @@ private theorem helper_continuation_5185.{u_1, u_2} : (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) have missingEq (j : Fin (count + 1)) : HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - exact @helper_missingEq_4298 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_missingEq_3257 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) @@ -3427,7 +2334,7 @@ private theorem helper_continuation_5185.{u_1, u_2} : have segmentEq (j : Fin (count + 1)) (eta : Fin k) (he : eta ∈ HierarchyStoredColorsAt HB j) : HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by - exact @helper_segmentEq_4325 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_segmentEq_3284 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) @@ -3441,7 +2348,7 @@ private theorem helper_continuation_5185.{u_1, u_2} : ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion fun v => MissingColors G phi v) := by - exact @helper_refreshEq_4335 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_refreshEq_3294 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) @@ -3490,7 +2397,7 @@ private theorem helper_continuation_5185.{u_1, u_2} : maximum := hMPS notElementary := sigmaNotElementary } have hstarLast : HierarchyStarredStage HS (Fin.last count) = A := by - exact @helper_hstarLast_4390 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_hstarLast_3349 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) @@ -3504,7 +2411,7 @@ private theorem helper_continuation_5185.{u_1, u_2} : simpa only [hj] using hs -- Path candidates restrict to the shorter prefix; the second measure decreases strictly. have pathLe : HierarchyPathNumber HS ≤ HierarchyPathNumber H := by - exact @helper_pathLe_4404 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @helper_pathLe_3363 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) @@ -3609,7 +2516,7 @@ private theorem helper_continuation_5094.{u_1, u_2} : ∃ baseS : HierarchyBase corr.replacementETT sigma, ∃ HS : TashkinovHierarchy corr.replacementETT baseS, SameHierarchyStages HB HS := by - exact @helper_replacement_4227 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_replacement_855 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) (@alpha) (@beta) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean index 19c6bb080a..ec8291091b 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean @@ -5433,180 +5433,7 @@ private theorem helper_hinter_3502.{u_1, u_2} : (@hone) (@hlower) (@hfewer) (@hlarge) (@alpha) (@beta) (@hne) (@r) (@hrq) (@hclosed) (@rPositive) (@halphaR) (@hz) -private theorem helper_augmentationFixed_3623.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - TreeSequenceInitialSegment R A → - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - (∀ (i : Fin (T.length + (1 : ℕ))), - (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → - vb ∈ TreeSequenceVertexSet Y → - ∀ (hAib : A.length < (↑ib : ℕ)), - alpha ∉ - ({c : Fin k | ∃ (t : Fin A.length), R.length ≤ (↑t : ℕ) ∧ phi (A.edge t) = some c} : - Finset (Fin k)) → - TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) - (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - alpha ∉ - ({c : Fin k | - ∃ (t : Fin T.length), - (HierarchyStarredStage C.hierarchy - (Fin.last C.hierarchy.dividerCount)).length ≤ - (↑t : ℕ) ∧ - (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ - phi (T.edge t) = some c} : - Finset (Fin k)) → - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - TreeSequenceInitialSegment A B → - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → - (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → - (∀ (S : TreeSequence G e0), - TreeSequenceInitialSegment S R → - ∀ (t : Fin S.length), TreeIncidentEdge R (S.edge t)) → - ∀ (S : TreeSequence G e0), - TashkinovAugmentationSequence phi S B → - ∀ (t : Fin B.length), - S.length ≤ (↑t : ℕ) → - sigma (B.edge t) = phi (B.edge t) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb ell yLength Y - segRefl segTrans RToA hElementaryY hb vertexY hbY hAib unusedRA horder B BToT AToB sigma - fixedValue incidentFixed displayedIncident S hseq t ht - exact helper_augmentationFixed_904 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@alpha) (@beta) (@r) (@segRefl) (@segTrans) (@RToA) (@hElementaryY) (@hb) (@vertexY) - (@hbY) (@hAib) (@unusedRA) (@horder) (@BToT) (@AToB) (@fixedValue) (@incidentFixed) - (@displayedIncident) (@S) (@hseq) (@t) (@ht) - -private theorem helper_replacement_3646.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - IsProperEdgeColoring G phi → - IsOneEdgeUncolored phi e0 → - LowerRoundInductionHypothesis G k e0 ett.rounds → - ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment base.core R → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - MaximumProperty - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } → - ∀ - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - baseB.core = base.core → - ∀ - (HB : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - IsProperEdgeColoring G sigma → - IsOneEdgeUncolored sigma e0 → - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → - ∀ (D : Finset (Fin k)), StableColoring S D phi sigma) → - StableColoring Tn Dn phi sigma → - TreeSequenceInitialSegment Tn B → - Tn.length < B.length → - (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence phi Tn B ∨ - (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ - ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), - ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → - (∀ (S : TreeSequence G e0), - TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → - ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), - MaximumProperty corr.replacementETT ∧ - ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : - TashkinovHierarchy corr.replacementETT baseS), - SameHierarchyStages HB HS := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R q A n Tn - Dn ib vb coreToR hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma - sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport - exact helper_replacement_1032 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@hproper) (@hone) - (@hlower) (@alpha) (@beta) (@r) (@coreToR) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) - (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) - (@TnToB) (@TnStrictB) (@terminalRoute) (@routeTransport) - -private theorem helper_storedEq_3710.{u_1, u_2} : +private theorem helper_hstarLast_3855.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -5617,8 +5444,6 @@ private theorem helper_storedEq_3710.{u_1, u_2} : let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; ∀ (hAib : A.length < (↑ib : ℕ)), @@ -5650,15 +5475,9 @@ private theorem helper_storedEq_3710.{u_1, u_2} : generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn → - ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) + (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) (hbbase : stages (0 : Fin (count + (2 : ℕ))) = { rounds := ett.1, roundsPositive := rpB, series := ett.series, @@ -5666,1325 +5485,7 @@ private theorem helper_storedEq_3710.{u_1, u_2} : belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - exact helper_storedEq_1197 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) - (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) - (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) - -private theorem helper_missingEq_3719.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - exact helper_missingEq_1204 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) - (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) - (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) - (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) - (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@j) - -private theorem helper_segmentEq_3746.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - (∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = - HierarchyFirstMissingPosition phi B eta) → - ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - exact helper_segmentEq_1261 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) - (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) - -private theorem helper_refreshEq_3756.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact helper_refreshEq_1273 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) - (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@i) - -private theorem helper_hstarLast_3855.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (hcountB : - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount = - H.dividerCount), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc = - H.stage jo.castSucc ∧ - HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j = - HierarchyStarredStage H jo) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - HierarchyStarredStage HS (Fin.last count) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested - hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - exact helper_hstarLast_1371 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) - (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) - -private theorem helper_pathLe_3869.{u_1, u_2} : - helperPathLe3869Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb AToT hAib B BToT - ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - exact helper_pathLe_1383 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@AToT) - (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) - (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) - (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) - -private theorem helper_storedEq_5179.{u_1, u_2} : - helperStoredEq5179Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - exact helper_storedEq_3710 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) - (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) - (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) - -private theorem helper_segmentEq_5215.{u_1, u_2} : - helperSegmentEq5215Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - exact helper_segmentEq_3746 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) - (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) - -private theorem helper_refreshEq_5225.{u_1, u_2} : - helperRefreshEq5225Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact helper_refreshEq_3756 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) - (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@i) - -private theorem helper_hstarLast_5324.{u_1, u_2} : - helperHstarLast5324Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested - hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - exact helper_hstarLast_3855 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) - (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) - -private theorem helper_missingEq_5953.{u_1, u_2} : - helperMissingEq5953Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - exact helper_missingEq_3719 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) - (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) - (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) - (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) - (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@j) - -private theorem helper_pathLe_6085.{u_1, u_2} : - helperPathLe6085Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb AToT hAib B BToT - ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - exact helper_pathLe_3869 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@AToT) - (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) - (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) - (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) - -private theorem helper_parallelBase_6126.{u_1, u_2} : - helperParallelBase6126Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A n Tn ib vb TnToA coreToR - hAib B rpB aboveB strictB belowB genB baseB hcoreB ettB sigma treeMissingEq corr baseS - closureBToA minusEq count stages hbbase hbterminal hbnested hbstrict positions hbpositive - hbincreasing hbdivider hbcore goodB hcore hpe hclosure positionsS hspositive hsincreasing - hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS storedEq - dsimp only - intro hp - have hpOld := hpe.mpr hp - have hc := hclosure hpOld - have htree : corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc = Tn := hsbase.symm.trans hbbase - change ¬TreeColorSetMinusClosed G sigma baseS.core - ((HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)) ∧ - 4 ≤ ((TreeMissingColors sigma (corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) ∩ - TreeMissingColors sigma baseS.closure) \ - (HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)).card - rw [← hcore, ← hc, storedEq, htree, - treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA), - treeMissingEq _ (closureBToA hpOld), - minusEq _ (by rw [hcoreB]; exact TreeSequenceInitialSegmentVertexSetSubset coreToR)] - exact goodB.parallelBase hpOld - -private theorem helper_segmentEq_6319.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (by - omega) - (by - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) - (strictB : - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (_ : ∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))) - (_ : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (_ : - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (_ : - ∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = - HierarchyFirstMissingPosition phi B eta) - (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - exact helper_segmentEq_5215 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) - (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) - -private theorem helper_missingEq_6484.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (_ : TreeSequenceInitialSegment Tn A) (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (by - omega) - (by - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) - (strictB : - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (_ : - ∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))) - (_ : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - exact helper_missingEq_5953 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) - (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) - (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@j) - -private theorem helper_refreshEq_6699.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (by - omega) - (by - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) - (strictB : - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (_ : - ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) @@ -7001,49 +5502,68 @@ private theorem helper_refreshEq_6699.{u_1, u_2} : (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) (hbdivider : ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) (hbcore : TreeSequenceInitialSegment baseB.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))) - (_ : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin ({ dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, nested := hbnested, strict := hbstrict, dividerPosition := positions, dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } baseB }.stage - j.castSucc) - A) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) (hsincreasing : ∀ (i j : Fin count), @@ -7060,18 +5580,11 @@ private theorem helper_refreshEq_6699.{u_1, u_2} : ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) (hsdivider : ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) (hscore : TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))), + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), let HB : TashkinovHierarchy ettB baseB := { dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, nested := hbnested, strict := hbstrict, @@ -7084,30 +5597,148 @@ private theorem helper_refreshEq_6699.{u_1, u_2} : dividerPosition := positionsS, dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (_ : - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v := by + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + exact helper_hstarLast_1371 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) + (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) + +private theorem helper_pathLe_3869.{u_1, u_2} : + helperPathLe3869Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + exact helper_pathLe_1383 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@AToT) + (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) + (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) + (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) + +private theorem helper_storedEq_5179.{u_1, u_2} : + helperStoredEq5179Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + exact helper_storedEq_1197 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) + (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) + (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) + (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) + (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) + (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + +private theorem helper_segmentEq_5215.{u_1, u_2} : + helperSegmentEq5215Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + firstEq j eta + exact helper_segmentEq_1261 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) + (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + +private theorem helper_refreshEq_5225.{u_1, u_2} : + helperRefreshEq5225Conditions.{u_1, u_2} := by classical intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact helper_refreshEq_5225 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact helper_refreshEq_1273 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) - (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@corr) + (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@i) -private theorem helper_segmentEq_6920.{u_1, u_2} : +private theorem helper_hstarLast_5324.{u_1, u_2} : + helperHstarLast5324Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + exact helper_hstarLast_3855 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) + (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) + (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) + (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) + (@hsdivider) (@hscore) (@starEq) + +private theorem helper_missingEq_5953.{u_1, u_2} : + helperMissingEq5953Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + exact helper_missingEq_1204 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) + (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) + (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) + (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) + (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@j) + +private theorem helper_pathLe_6085.{u_1, u_2} : + helperPathLe6085Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + exact helper_pathLe_3869 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + (@beta) (@r) (@AToT) + (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) + (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) + (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) + +private theorem helper_parallelBase_6126.{u_1, u_2} : + helperParallelBase6126Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A n Tn ib vb TnToA coreToR + hAib B rpB aboveB strictB belowB genB baseB hcoreB ettB sigma treeMissingEq corr baseS + closureBToA minusEq count stages hbbase hbterminal hbnested hbstrict positions hbpositive + hbincreasing hbdivider hbcore goodB hcore hpe hclosure positionsS hspositive hsincreasing + hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS storedEq + dsimp only + intro hp + have hpOld := hpe.mpr hp + have hc := hclosure hpOld + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := hsbase.symm.trans hbbase + change ¬TreeColorSetMinusClosed G sigma baseS.core + ((HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)) ∧ + 4 ≤ ((TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseS.closure) \ + (HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)).card + rw [← hcore, ← hc, storedEq, htree, + treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA), + treeMissingEq _ (closureBToA hpOld), + minusEq _ (by rw [hcoreB]; exact TreeSequenceInitialSegmentVertexSetSubset coreToR)] + exact goodB.parallelBase hpOld + +private theorem helper_segmentEq_6319.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -7285,14 +5916,14 @@ private theorem helper_segmentEq_6920.{u_1, u_2} : hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq firstEq j eta - exact helper_segmentEq_6319 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact helper_segmentEq_5215 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) -private theorem helper_missingEq_7097.{u_1, u_2} : +private theorem helper_missingEq_6484.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -7468,14 +6099,14 @@ private theorem helper_missingEq_7097.{u_1, u_2} : hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS j - exact helper_missingEq_6484 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact helper_missingEq_5953 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@j) -private theorem helper_refreshEq_7327.{u_1, u_2} : +private theorem helper_refreshEq_6699.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -7655,7 +6286,7 @@ private theorem helper_refreshEq_7327.{u_1, u_2} : strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact helper_refreshEq_6699 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact helper_refreshEq_5225 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) @@ -7685,7 +6316,7 @@ private theorem helper_segmentEq_7714.{u_1, u_2} : hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq firstEq j eta - exact helper_segmentEq_6920 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact helper_segmentEq_6319 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) @@ -7700,7 +6331,7 @@ private theorem helper_missingEq_7904.{u_1, u_2} : hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS j - exact helper_missingEq_7097 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact helper_missingEq_6484 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) @@ -7714,7 +6345,7 @@ private theorem helper_refreshEq_8147.{u_1, u_2} : strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact helper_refreshEq_7327 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact helper_refreshEq_6699 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) @@ -8038,7 +6669,7 @@ private theorem helper_continuation_4559.{u_1, u_2} : helper_displayedIncident_896 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@r) have augmentationFixed := - helper_augmentationFixed_3623 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + helper_augmentationFixed_904 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@segRefl) (@segTrans) (@RToA) (@hElementaryY) (@hb) (@vertexY) (@hbY) (@hAib) (@unusedRA) (@horder) (@BToT) (@AToB) (@fixedValue) (@incidentFixed) (@displayedIncident) @@ -8055,7 +6686,7 @@ private theorem helper_continuation_4559.{u_1, u_2} : helper_routeTransport_1000 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@segTrans) (@hAib) (@BToT) (@missingBefore) (@edgesFixed) have replacement := - helper_replacement_3646 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + helper_replacement_1032 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) (@alpha) (@beta) (@r) (@coreToR) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@hMPB) (@baseB) (@hcoreB) (@HB) (@sigmaProper) (@sigmaOne) (@stable) (@stableTn) diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean index b99fc250b7..c0809bc751 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean @@ -3239,197 +3239,6 @@ private theorem helper_storedEq_5399.{u_1, u_2} : (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) -private theorem helper_storedEq_5598.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by - omega) - (Nat.le_of_lt_succ ib.isLt); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.1, by - omega⟩ : - Fin (ett.1 + (2 : ℕ)))) - B) - (strictB : - (ett.series.data.tree - (⟨ett.1, by - omega⟩ : - Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (_ : - ∀ (S : TreeSequence G e0) (_ : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A), - TreeMissingColors sigma S = TreeMissingColors phi S) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) - (_ : - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn) - (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))) - (_ : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (_ : - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - exact @helper_storedEq_5399 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) - (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) - (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) - private theorem helper_continuation_5697.{u_1, u_2} : helperContinuation5697Conditions.{u_1, u_2} := by classical @@ -3530,7 +3339,7 @@ private theorem helper_continuation_5697.{u_1, u_2} : exact Fin.cases hcore.symm (fun i => rfl) j have storedEq (j : Fin (count + 1)) : HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - exact @helper_storedEq_5598 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @helper_storedEq_5399 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean index dfa32dbb75..ad7b181adf 100644 --- a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean +++ b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairDistinctComponents.lean @@ -5,10 +5,13 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TwoColorComponentLeafPaths + +public import LeanPool.GoldbergSeymour.TwoColorMissingVertexNeighbors + public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint /-! @@ -23,263 +26,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private theorem ElementaryClosedExitPairDistinctComponents_missing_leaf_104.{u_1, u_2} : - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} - (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → - ∀ (a b : Fin k), - let H := TwoColorIncidenceGraph G phi a b; - ∀ (v : V), a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v → (H.neighborSet (Sum.inl - v)).Subsingleton := by - classical - intro V E _ _ G k phi hproper a b H v hmissing z hz w hw - let _ := Fintype.ofFinite V - cases hzv : z with - | inl u => - rw [hzv] at hz - simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz - | inr e => - cases hwv : w with - | inl u => - rw [hwv] at hw - simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw - | inr f => - rw [hzv] at hz - rw [hwv] at hw - have he : Incident G v e ∧ - (phi e = some a ∨ phi e = some b) := by - simpa [H, SimpleGraph.mem_neighborSet, - TwoColorIncidenceGraph] using hz - have hf : Incident G v f ∧ - (phi f = some a ∨ phi f = some b) := by - simpa [H, SimpleGraph.mem_neighborSet, - TwoColorIncidenceGraph] using hw - apply congrArg Sum.inr - by_contra hef - rcases hmissing with ha | hb - · have hna : a ∉ PresentColors G phi v := by - simpa [MissingColors] using ha - have hea : phi e = some b := he.2.resolve_left (by - intro hea - apply hna - simpa [PresentColors] using - (show ∃ q, Incident G v q ∧ phi q = some a from - ⟨e, he.1, hea⟩)) - have hfa : phi f = some b := hf.2.resolve_left (by - intro hfa - apply hna - simpa [PresentColors] using - (show ∃ q, Incident G v q ∧ phi q = some a from - ⟨f, hf.1, hfa⟩)) - exact (hproper hef ⟨v, he.1, hf.1⟩ hea) hfa - · have hnb : b ∉ PresentColors G phi v := by - simpa [MissingColors] using hb - have heb : phi e = some a := he.2.resolve_right (by - intro heb - apply hnb - simpa [PresentColors] using - (show ∃ q, Incident G v q ∧ phi q = some b from - ⟨e, he.1, heb⟩)) - have hfb : phi f = some a := hf.2.resolve_right (by - intro hfb - apply hnb - simpa [PresentColors] using - (show ∃ q, Incident G v q ∧ phi q = some b from - ⟨f, hf.1, hfb⟩)) - exact (hproper hef ⟨v, he.1, hf.1⟩ heb) hfb - -private theorem ElementaryClosedExitPairDistinctComponents_fullPathFromLeaf_172.{u_1, u_2} : - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : - ℕ} (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → ∀ (a b : Fin k), a ≠ b → - let H := TwoColorIncidenceGraph G phi a b; (∀ (v : V), (H.neighborSet (Sum.inl - v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v) → ∀ (v : V) (c : - V ⊕ E), Sum.inl v ∈ TwoColorComponent G phi a b c → (H.neighborSet (Sum.inl - v)).Subsingleton → (∃ (e : E), Sum.inr e ∈ TwoColorComponent G phi a b c) → ∃ (s : V) (p : - H.Walk (Sum.inl v) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ p.support} = - TwoColorComponent G phi a b c ∧ v ≠ s ∧ (a ∈ MissingColors G phi s ∨ b ∈ MissingColors G - phi s) := by - classical - intro V E _ _ G k phi hproper a b hne H endpoint_missing v c hvC hvleaf hnontrivial - let _ := Fintype.ofFinite V - obtain ⟨u, w, p, hp, hps⟩ := - TwoColorComponentSpanningPath G phi a b hproper c - have hvP : Sum.inl v ∈ p.support := by - change Sum.inl v ∈ {y | y ∈ p.support} - rw [hps] - exact hvC - have hvEnd : Sum.inl v = u ∨ Sum.inl v = w := by - by_contra hn - push Not at hn - exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet - hn.1 hn.2 hvleaf) hvP - obtain ⟨t, q, hq, hqs⟩ : ∃ (t : Sum V E) - (q : H.Walk (Sum.inl v) t), - q.IsPath ∧ {y | y ∈ q.support} = - TwoColorComponent G phi a b c := by - rcases hvEnd with hvu | hvw - · subst u - exact ⟨w, p, hp, hps⟩ - · subst w - refine ⟨u, p.reverse, hp.reverse, ?_⟩ - ext y - change y ∈ p.reverse.support ↔ - y ∈ TwoColorComponent G phi a b c - rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] - exact Set.ext_iff.mp hps y - have hqnon : ¬ q.Nil := by - intro hnil - obtain ⟨e, heC⟩ := hnontrivial - have heQ : Sum.inr e ∈ q.support := by - change Sum.inr e ∈ {y | y ∈ q.support} - rw [hqs] - exact heC - rw [SimpleGraph.Walk.nil_iff_support_eq.mp hnil] at heQ - simp at heQ - have hend_neighbor : ∀ y, H.Adj t y → - y = q.getVert (q.length - 1) := by - intro y hty - have hyC : y ∈ TwoColorComponent G phi a b c := by - have htC : t ∈ TwoColorComponent G phi a b c := by - rw [← hqs] - change t ∈ q.support - simpa only [q.getVert_length] using - q.getVert_mem_support q.length - change H.connectedComponentMk y = H.connectedComponentMk c - change H.connectedComponentMk t = H.connectedComponentMk c at htC - exact - (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hty).symm.trans htC - have hySupport : y ∈ q.support := by - change y ∈ {z | z ∈ q.support} - rw [hqs] - exact hyC - obtain ⟨n, hn, hnle⟩ := - SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hySupport - have hnlt : n < q.length := by - have hnne : n ≠ q.length := by - intro heq - have hyt : y = t := by rw [← hn, heq, q.getVert_length] - exact hty.ne hyt.symm - omega - by_cases hpen : n + 1 = q.length - · rw [← hn] - congr 1 - omega - by_cases hn0 : n = 0 - · have hnext : H.Adj (Sum.inl v) (q.getVert 1) := by - simpa [hn0, q.getVert_zero] using q.adj_getVert_succ hnlt - have htstart : H.Adj (Sum.inl v) t := by - rw [← hn, hn0, q.getVert_zero] at hty - exact hty.symm - have hneNext : q.getVert 1 ≠ t := by - intro heq - have hindices := hq.getVert_injOn - (show 1 ≤ q.length by omega) (show q.length ≤ q.length by rfl) - (heq.trans q.getVert_length.symm) - omega - exact False.elim (hneNext (hvleaf hnext htstart)) - · have hleft : H.Adj y (q.getVert (n - 1)) := by - rw [← hn] - have hadj := q.adj_getVert_succ (i := n - 1) (by omega) - simpa only [Nat.sub_add_cancel (by omega : 1 ≤ n)] using - hadj.symm - have hright : H.Adj y (q.getVert (n + 1)) := by - rw [← hn] - exact q.adj_getVert_succ hnlt - have htneLeft : t ≠ q.getVert (n - 1) := by - intro heq - have hindices := hq.getVert_injOn - (show q.length ≤ q.length by rfl) - (show n - 1 ≤ q.length by omega) - (q.getVert_length.trans heq) - omega - have htneRight : t ≠ q.getVert (n + 1) := by - intro heq - have hindices := hq.getVert_injOn - (show q.length ≤ q.length by rfl) - (show n + 1 ≤ q.length by omega) - (q.getVert_length.trans heq) - omega - have hlrne : q.getVert (n - 1) ≠ q.getVert (n + 1) := by - intro heq - have hindices := hq.getVert_injOn - (show n - 1 ≤ q.length by omega) - (show n + 1 ≤ q.length by omega) heq - omega - let : Fintype (H.neighborSet y) := Fintype.ofFinite _ - have hthree : 3 ≤ @SimpleGraph.degree _ H y - (Fintype.ofFinite _) := by - rw [← SimpleGraph.card_neighborFinset_eq_degree] - let ss : Finset (Sum V E) := - {t, q.getVert (n - 1), q.getVert (n + 1)} - have hss : ss ⊆ H.neighborFinset y := by - intro r hr - simp only [ss, Finset.mem_insert, Finset.mem_singleton] at hr - rcases hr with rfl | rfl | rfl - · simpa [SimpleGraph.mem_neighborFinset] using hty.symm - · simpa [SimpleGraph.mem_neighborFinset] using hleft - · simpa [SimpleGraph.mem_neighborFinset] using hright - have hc3 : 3 ≤ ss.card := by - simp [ss, htneLeft, htneRight, hlrne] - exact hc3.trans (Finset.card_le_card hss) - have htwo : @SimpleGraph.degree _ H y - (Fintype.ofFinite _) ≤ 2 := by - simpa [H] using - TwoColorIncidenceDegreeAtMostTwo G phi a b hproper y - omega - have hendLeaf : Set.Subsingleton (H.neighborSet t) := by - intro y hy y' hy' - exact (hend_neighbor y hy).trans (hend_neighbor y' hy').symm - have hqpos : 0 < q.length := - SimpleGraph.Walk.not_nil_iff_lt_length.mp hqnon - have hendVertex : ∃ s : V, t = Sum.inl s := by - cases ht : t with - | inl s => exact ⟨s, rfl⟩ - | inr e => - have hlastAdj : H.Adj (q.getVert (q.length - 1)) t := by - simpa only [Nat.sub_add_cancel (by omega : 1 ≤ q.length), - q.getVert_length] using - q.adj_getVert_succ (i := q.length - 1) (by omega) - have hecolor : phi e = some a ∨ phi e = some b := by - cases hprev : q.getVert (q.length - 1) with - | inl r => - rw [hprev, ht] at hlastAdj - have hdata : Incident G r e ∧ - (phi e = some a ∨ phi e = some b) := by - simpa [H, TwoColorIncidenceGraph] using hlastAdj - exact hdata.2 - | inr f => - rw [hprev, ht] at hlastAdj - have : False := by - simp [H, TwoColorIncidenceGraph] at hlastAdj - exact this.elim - induction hends : G.ends e using Sym2.inductionOn with - | _ r s => - have hrs : r ≠ s := by - intro hrs - subst s - exact G.loopless e r hends - have hrAdj : H.Adj t (Sum.inl r) := by - rw [ht] - simpa [H, TwoColorIncidenceGraph, Incident, hends] using - (show Incident G r e ∧ - (phi e = some a ∨ phi e = some b) from - ⟨by simp [Incident, hends], hecolor⟩) - have hsAdj : H.Adj t (Sum.inl s) := by - rw [ht] - simpa [H, TwoColorIncidenceGraph, Incident, hends] using - (show Incident G s e ∧ - (phi e = some a ∨ phi e = some b) from - ⟨by simp [Incident, hends], hecolor⟩) - exact False.elim - (hrs (Sum.inl.inj (hendLeaf hrAdj hsAdj))) - obtain ⟨s, hs⟩ := hendVertex - subst t - have hvs : v ≠ s := by - intro hvs - apply hqnon - exact hq.nil_iff_eq.mpr (by simp [hvs]) - exact ⟨s, q, hq, hqs, hvs, endpoint_missing s hendLeaf⟩ - private theorem ElementaryClosedExitPairDistinctComponents_chooseFirst_361.{u_1, u_2} : ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E @@ -698,39 +444,6 @@ private theorem ElementaryClosedExitPairDistinctComponents_oppositeExit_626.{u_1 exact ⟨c, L, f, hExit, hdis, hus.symm, hcv, by simpa [X] using hfB, hcf, hfL, hLcomponent⟩ -private theorem ElementaryClosedExitPairDistinctComponents_endpoint_missing_781.{u_1, u_2} : - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} - (phi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → - let H := TwoColorIncidenceGraph G phi a b; - ∀ (v : V), (H.neighborSet (Sum.inl v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ - MissingColors G phi v := by - classical - intro V E _ _ G k phi a b hne H v hleaf - let _ := Fintype.ofFinite V - by_cases ha : a ∈ MissingColors G phi v - · exact Or.inl ha - · right - have hap : a ∈ PresentColors G phi v := by - simpa [MissingColors] using ha - by_contra hb - have hbp : b ∈ PresentColors G phi v := by - simpa [MissingColors] using hb - obtain ⟨ea, hea, hca⟩ := by simpa [PresentColors] using hap - obtain ⟨eb, heb, hcb⟩ := by simpa [PresentColors] using hbp - have hada : H.Adj (Sum.inl v) (Sum.inr ea) := by - simpa [H, TwoColorIncidenceGraph] using - (show Incident G v ea ∧ - (phi ea = some a ∨ phi ea = some b) from - ⟨hea, Or.inl hca⟩) - have hadb : H.Adj (Sum.inl v) (Sum.inr eb) := by - simpa [H, TwoColorIncidenceGraph] using - (show Incident G v eb ∧ - (phi eb = some a ∨ phi eb = some b) from - ⟨heb, Or.inr hcb⟩) - have heab : ea = eb := Sum.inr.inj (hleaf hada hadb) - subst eb - exact hne (Option.some.inj (hca.symm.trans hcb)) - private theorem ElementaryClosedExitPairDistinctComponents_neighbor_of_two_851.{u_1, u_2} : ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k), IsProperEdgeColoring G phi → @@ -800,14 +513,12 @@ lemma ElementaryClosedExitPairDistinctComponents {V E : Type*} have endpoint_missing (v : V) (hleaf : Set.Subsingleton (H.neighborSet (Sum.inl v))) : a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v := by - exact @ElementaryClosedExitPairDistinctComponents_endpoint_missing_781 V E inferInstance - inferInstance G k phi a b hne v hleaf + exact @TwoColorMissingOfVertexNeighborsSubsingleton V E inferInstance G k phi a b hne v hleaf have missing_leaf (v : V) (hmissing : a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v) : Set.Subsingleton (H.neighborSet (Sum.inl v)) := by - exact @ElementaryClosedExitPairDistinctComponents_missing_leaf_104 V E inferInstance - inferInstance G k phi hproper a b v hmissing + exact TwoColorMissingVertexNeighborsSubsingleton G phi hproper a b v hmissing have walk_support_component : ∀ {u v : Sum V E} (p : H.Walk u v) {z : Sum V E}, z ∈ p.support → z ∈ TwoColorComponent G phi a b u := by @@ -818,8 +529,8 @@ lemma ElementaryClosedExitPairDistinctComponents {V E : Type*} rw [← hi] exact (SimpleGraph.ConnectedComponent.sound (p.take i).reachable).symm have fullPathFromLeaf := - @ElementaryClosedExitPairDistinctComponents_fullPathFromLeaf_172 V E inferInstance - inferInstance G k phi hproper a b hne endpoint_missing + @TwoColorComponent.pathFromLeaf V E inferInstance + inferInstance G k phi hproper a b endpoint_missing have chooseFirst := @ElementaryClosedExitPairDistinctComponents_chooseFirst_361 V E inferInstance inferInstance inferInstance inferInstance G k phi a b hne diff --git a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean index 1e1ac6b9b0..1ada1e0079 100644 --- a/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean +++ b/LeanPool/GoldbergSeymour/ElementaryClosedExitPairSameComponent.lean @@ -5,10 +5,13 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TwoColorComponentLeafPaths + +public import LeanPool.GoldbergSeymour.TwoColorMissingVertexNeighbors + public import LeanPool.GoldbergSeymour.ClosedColorExitPathBoundaryEdge public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath public import LeanPool.GoldbergSeymour.TwoColorComponentsDisjoint /-! @@ -23,262 +26,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private theorem helper_missing_leaf_103.{u_1, u_2} : - open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : - LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k), IsProperEdgeColoring G - phi → ∀ (a b : Fin k), let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; ∀ - (v : V), a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v → (H.neighborSet (Sum.inl - v)).Subsingleton := by - classical - intro V E _ _ G k phi hproper a b H v hmissing z hz w hw - let _ := Fintype.ofFinite V - cases hzv : z with - | inl u => - rw [hzv] at hz - simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz - | inr e => - cases hwv : w with - | inl u => - rw [hwv] at hw - simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw - | inr f => - rw [hzv] at hz - rw [hwv] at hw - have he : Incident G v e ∧ - (phi e = some a ∨ phi e = some b) := by - simpa [H, SimpleGraph.mem_neighborSet, - TwoColorIncidenceGraph] using hz - have hf : Incident G v f ∧ - (phi f = some a ∨ phi f = some b) := by - simpa [H, SimpleGraph.mem_neighborSet, - TwoColorIncidenceGraph] using hw - apply congrArg Sum.inr - by_contra hef - rcases hmissing with ha | hb - · have hna : a ∉ PresentColors G phi v := by - simpa [MissingColors] using ha - have hea : phi e = some b := he.2.resolve_left (by - intro hea - apply hna - simpa [PresentColors] using - (show ∃ q, Incident G v q ∧ phi q = some a from - ⟨e, he.1, hea⟩)) - have hfa : phi f = some b := hf.2.resolve_left (by - intro hfa - apply hna - simpa [PresentColors] using - (show ∃ q, Incident G v q ∧ phi q = some a from - ⟨f, hf.1, hfa⟩)) - exact (hproper hef ⟨v, he.1, hf.1⟩ hea) hfa - · have hnb : b ∉ PresentColors G phi v := by - simpa [MissingColors] using hb - have heb : phi e = some a := he.2.resolve_right (by - intro heb - apply hnb - simpa [PresentColors] using - (show ∃ q, Incident G v q ∧ phi q = some b from - ⟨e, he.1, heb⟩)) - have hfb : phi f = some a := hf.2.resolve_right (by - intro hfb - apply hnb - simpa [PresentColors] using - (show ∃ q, Incident G v q ∧ phi q = some b from - ⟨f, hf.1, hfb⟩)) - exact (hproper hef ⟨v, he.1, hf.1⟩ heb) hfb - -private theorem helper_fullPathFromLeaf_170.{u_1, u_2} : - open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : - LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k), IsProperEdgeColoring G - phi → ∀ (a b : Fin k), let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; (∀ - (v : V), (H.neighborSet (Sum.inl v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ - MissingColors G phi v) → ∀ (v : V) (c : V ⊕ E), Sum.inl v ∈ TwoColorComponent G phi a b c - → (H.neighborSet (Sum.inl v)).Subsingleton → (∃ (e : E), Sum.inr e ∈ TwoColorComponent G - phi a b c) → ∃ (s : V) (p : H.Walk (Sum.inl v) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ - p.support} = TwoColorComponent G phi a b c ∧ v ≠ s ∧ (a ∈ MissingColors G phi s ∨ b ∈ - MissingColors G phi s) := by - classical - intro V E _ _ G k phi hproper a b H endpoint_missing v c hvC hvleaf hnontrivial - let _ := Fintype.ofFinite V - obtain ⟨u, w, p, hp, hps⟩ := - TwoColorComponentSpanningPath G phi a b hproper c - have hvP : Sum.inl v ∈ p.support := by - change Sum.inl v ∈ {y | y ∈ p.support} - rw [hps] - exact hvC - have hvEnd : Sum.inl v = u ∨ Sum.inl v = w := by - by_contra hn - push Not at hn - exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet - hn.1 hn.2 hvleaf) hvP - obtain ⟨t, q, hq, hqs⟩ : ∃ (t : Sum V E) - (q : H.Walk (Sum.inl v) t), - q.IsPath ∧ {y | y ∈ q.support} = - TwoColorComponent G phi a b c := by - rcases hvEnd with hvu | hvw - · subst u - exact ⟨w, p, hp, hps⟩ - · subst w - refine ⟨u, p.reverse, hp.reverse, ?_⟩ - ext y - change y ∈ p.reverse.support ↔ - y ∈ TwoColorComponent G phi a b c - rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] - exact Set.ext_iff.mp hps y - have hqnon : ¬ q.Nil := by - intro hnil - obtain ⟨e, heC⟩ := hnontrivial - have heQ : Sum.inr e ∈ q.support := by - change Sum.inr e ∈ {y | y ∈ q.support} - rw [hqs] - exact heC - rw [SimpleGraph.Walk.nil_iff_support_eq.mp hnil] at heQ - simp at heQ - have hend_neighbor : ∀ y, H.Adj t y → - y = q.getVert (q.length - 1) := by - intro y hty - have hyC : y ∈ TwoColorComponent G phi a b c := by - have htC : t ∈ TwoColorComponent G phi a b c := by - rw [← hqs] - change t ∈ q.support - simpa only [q.getVert_length] using - q.getVert_mem_support q.length - change H.connectedComponentMk y = H.connectedComponentMk c - change H.connectedComponentMk t = H.connectedComponentMk c at htC - exact - (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hty).symm.trans htC - have hySupport : y ∈ q.support := by - change y ∈ {z | z ∈ q.support} - rw [hqs] - exact hyC - obtain ⟨n, hn, hnle⟩ := - SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hySupport - have hnlt : n < q.length := by - have hnne : n ≠ q.length := by - intro heq - have hyt : y = t := by rw [← hn, heq, q.getVert_length] - exact hty.ne hyt.symm - omega - by_cases hpen : n + 1 = q.length - · rw [← hn] - congr 1 - omega - by_cases hn0 : n = 0 - · have hnext : H.Adj (Sum.inl v) (q.getVert 1) := by - simpa [hn0, q.getVert_zero] using q.adj_getVert_succ hnlt - have htstart : H.Adj (Sum.inl v) t := by - rw [← hn, hn0, q.getVert_zero] at hty - exact hty.symm - have hneNext : q.getVert 1 ≠ t := by - intro heq - have hindices := hq.getVert_injOn - (show 1 ≤ q.length by omega) (show q.length ≤ q.length by rfl) - (heq.trans q.getVert_length.symm) - omega - exact False.elim (hneNext (hvleaf hnext htstart)) - · have hleft : H.Adj y (q.getVert (n - 1)) := by - rw [← hn] - have hadj := q.adj_getVert_succ (i := n - 1) (by omega) - simpa only [Nat.sub_add_cancel (by omega : 1 ≤ n)] using - hadj.symm - have hright : H.Adj y (q.getVert (n + 1)) := by - rw [← hn] - exact q.adj_getVert_succ hnlt - have htneLeft : t ≠ q.getVert (n - 1) := by - intro heq - have hindices := hq.getVert_injOn - (show q.length ≤ q.length by rfl) - (show n - 1 ≤ q.length by omega) - (q.getVert_length.trans heq) - omega - have htneRight : t ≠ q.getVert (n + 1) := by - intro heq - have hindices := hq.getVert_injOn - (show q.length ≤ q.length by rfl) - (show n + 1 ≤ q.length by omega) - (q.getVert_length.trans heq) - omega - have hlrne : q.getVert (n - 1) ≠ q.getVert (n + 1) := by - intro heq - have hindices := hq.getVert_injOn - (show n - 1 ≤ q.length by omega) - (show n + 1 ≤ q.length by omega) heq - omega - let : Fintype (H.neighborSet y) := Fintype.ofFinite _ - have hthree : 3 ≤ @SimpleGraph.degree _ H y - (Fintype.ofFinite _) := by - rw [← SimpleGraph.card_neighborFinset_eq_degree] - let ss : Finset (Sum V E) := - {t, q.getVert (n - 1), q.getVert (n + 1)} - have hss : ss ⊆ H.neighborFinset y := by - intro r hr - simp only [ss, Finset.mem_insert, Finset.mem_singleton] at hr - rcases hr with rfl | rfl | rfl - · simpa [SimpleGraph.mem_neighborFinset] using hty.symm - · simpa [SimpleGraph.mem_neighborFinset] using hleft - · simpa [SimpleGraph.mem_neighborFinset] using hright - have hc3 : 3 ≤ ss.card := by - simp [ss, htneLeft, htneRight, hlrne] - exact hc3.trans (Finset.card_le_card hss) - have htwo : @SimpleGraph.degree _ H y - (Fintype.ofFinite _) ≤ 2 := by - simpa [H] using - TwoColorIncidenceDegreeAtMostTwo G phi a b hproper y - omega - have hendLeaf : Set.Subsingleton (H.neighborSet t) := by - intro y hy y' hy' - exact (hend_neighbor y hy).trans (hend_neighbor y' hy').symm - have hqpos : 0 < q.length := - SimpleGraph.Walk.not_nil_iff_lt_length.mp hqnon - have hendVertex : ∃ s : V, t = Sum.inl s := by - cases ht : t with - | inl s => exact ⟨s, rfl⟩ - | inr e => - have hlastAdj : H.Adj (q.getVert (q.length - 1)) t := by - simpa only [Nat.sub_add_cancel (by omega : 1 ≤ q.length), - q.getVert_length] using - q.adj_getVert_succ (i := q.length - 1) (by omega) - have hecolor : phi e = some a ∨ phi e = some b := by - cases hprev : q.getVert (q.length - 1) with - | inl r => - rw [hprev, ht] at hlastAdj - have hdata : Incident G r e ∧ - (phi e = some a ∨ phi e = some b) := by - simpa [H, TwoColorIncidenceGraph] using hlastAdj - exact hdata.2 - | inr f => - rw [hprev, ht] at hlastAdj - have : False := by - simp [H, TwoColorIncidenceGraph] at hlastAdj - exact this.elim - induction hends : G.ends e using Sym2.inductionOn with - | _ r s => - have hrs : r ≠ s := by - intro hrs - subst s - exact G.loopless e r hends - have hrAdj : H.Adj t (Sum.inl r) := by - rw [ht] - simpa [H, TwoColorIncidenceGraph, Incident, hends] using - (show Incident G r e ∧ - (phi e = some a ∨ phi e = some b) from - ⟨by simp [Incident, hends], hecolor⟩) - have hsAdj : H.Adj t (Sum.inl s) := by - rw [ht] - simpa [H, TwoColorIncidenceGraph, Incident, hends] using - (show Incident G s e ∧ - (phi e = some a ∨ phi e = some b) from - ⟨by simp [Incident, hends], hecolor⟩) - exact False.elim - (hrs (Sum.inl.inj (hendLeaf hrAdj hsAdj))) - obtain ⟨s, hs⟩ := hendVertex - subst t - have hvs : v ≠ s := by - intro hvs - apply hqnon - exact hq.nil_iff_eq.mpr (by simp [hvs]) - exact ⟨s, q, hq, hqs, hvs, endpoint_missing s hendLeaf⟩ - private theorem helper_chooseFirst_359.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k) (a b : Fin k) (a1 b1 @@ -387,41 +134,6 @@ private theorem helper_firstEntry_398.{u_1, u_2} : simp [H, TwoColorIncidenceGraph] at hadj exact ⟨c, hcX, hqQ, hLpath, hLlen, hrX, hcX, hmissing, hLc⟩ -private theorem helper_endpoint_missing_454.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} - (phi : PartialEdgeColoring E k) (a b : Fin k), - a ≠ b → - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; - ∀ (v : V), (H.neighborSet (Sum.inl v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ - MissingColors G phi v := by - classical - intro V E _ _ G k phi a b hne H v hleaf - let _ := Fintype.ofFinite V - by_cases ha : a ∈ MissingColors G phi v - · exact Or.inl ha - · right - have hap : a ∈ PresentColors G phi v := by - simpa [MissingColors] using ha - by_contra hb - have hbp : b ∈ PresentColors G phi v := by - simpa [MissingColors] using hb - obtain ⟨ea, hea, hca⟩ := by simpa [PresentColors] using hap - obtain ⟨eb, heb, hcb⟩ := by simpa [PresentColors] using hbp - have hada : H.Adj (Sum.inl v) (Sum.inr ea) := by - simpa [H, TwoColorIncidenceGraph] using - (show Incident G v ea ∧ - (phi ea = some a ∨ phi ea = some b) from - ⟨hea, Or.inl hca⟩) - have hadb : H.Adj (Sum.inl v) (Sum.inr eb) := by - simpa [H, TwoColorIncidenceGraph] using - (show Incident G v eb ∧ - (phi eb = some a ∨ phi eb = some b) from - ⟨heb, Or.inr hcb⟩) - have heab : ea = eb := Sum.inr.inj (hleaf hada hadb) - subst eb - exact hne (Option.some.inj (hca.symm.trans hcb)) - private theorem helper_hCnontrivial_540.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} @@ -522,9 +234,10 @@ lemma ElementaryClosedExitPairSameComponent {V E : Type*} classical let H := TwoColorIncidenceGraph G phi a b let X := TreeSequenceVertexSet T - have endpoint_missing := @helper_endpoint_missing_454 V E inferInstance inferInstance G k phi a b + have endpoint_missing := @TwoColorMissingOfVertexNeighborsSubsingleton V E inferInstance G k + phi a b hne - have missing_leaf := @helper_missing_leaf_103 V E inferInstance inferInstance G k phi hproper a b + have missing_leaf := TwoColorMissingVertexNeighborsSubsingleton G phi hproper a b have walk_support_component : ∀ {u v : Sum V E} (p : H.Walk u v) {z : Sum V E}, z ∈ p.support → z ∈ TwoColorComponent G phi a b u := by @@ -534,7 +247,7 @@ lemma ElementaryClosedExitPairSameComponent {V E : Type*} change H.connectedComponentMk z = H.connectedComponentMk u rw [← hi] exact (SimpleGraph.ConnectedComponent.sound (p.take i).reachable).symm - have fullPathFromLeaf := @helper_fullPathFromLeaf_170 V E inferInstance inferInstance G k phi + have fullPathFromLeaf := @TwoColorComponent.pathFromLeaf V E inferInstance inferInstance G k phi hproper a b endpoint_missing have chooseFirst : ∀ {u v : Sum V E} (p : H.Walk u v) (S : Finset (Sum V E)), diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean index 114a8b49b8..5ad5b0ffcb 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmBInduction.lean @@ -23,72 +23,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private theorem helper_root_swap_exchange_230.{u_1, u_2} : - open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : - LooplessMultigraph V E} {k : ℕ} {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin - k}, alpha ≠ beta → beta ∈ MissingColors G phi v → alpha ∈ PresentColors G phi v → alpha ∈ - MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ∧ beta ∈ - PresentColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v := by - classical - intro V E _ _ G k phi v alpha beta hne hbeta halpha - let _ := Fintype.ofFinite V - have hbetaNotPresent : beta ∉ PresentColors G phi v := by - simpa [MissingColors] using hbeta - obtain ⟨eAlpha, heAlphaIncident, heAlphaColor⟩ := by - simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] using halpha - have heAlphaComponent : Sum.inr eAlpha ∈ - TwoColorComponent G phi alpha beta (Sum.inl v) := by - let H := TwoColorIncidenceGraph G phi alpha beta - have hadj : H.Adj (Sum.inl v) (Sum.inr eAlpha) := by - simpa [H, TwoColorIncidenceGraph] using - And.intro heAlphaIncident (Or.inl heAlphaColor) - change H.connectedComponentMk (Sum.inr eAlpha) = - H.connectedComponentMk (Sum.inl v) - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hadj).symm - constructor - · unfold MissingColors - rw [Finset.mem_sdiff] - refine ⟨Finset.mem_univ _, ?_⟩ - intro hp - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] at hp - rcases hp with ⟨e, hev, heColor⟩ - by_cases heK : - Sum.inr e ∈ TwoColorComponent G phi alpha beta (Sum.inl v) - · have heBeta : phi e = some beta := by - unfold TwoColorComponentSwap at heColor - rw [ite_eq_left heK] at heColor - by_cases heAlpha : phi e = some alpha - · rw [ite_eq_left heAlpha] at heColor - exact False.elim (hne (Option.some.inj heColor).symm) - · by_cases heBeta : phi e = some beta - · exact heBeta - · rw [ite_eq_right heAlpha, ite_eq_right heBeta] at heColor - exact False.elim (heAlpha heColor) - apply hbetaNotPresent - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨e, hev, heBeta⟩ - · have heOldAlpha : phi e = some alpha := by - simpa [TwoColorComponentSwap, heK] using heColor - have heAdj : (TwoColorIncidenceGraph G phi alpha beta).Adj - (Sum.inl v) (Sum.inr e) := by - simpa [TwoColorIncidenceGraph] using - And.intro hev (Or.inl heOldAlpha) - apply heK - change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk - (Sum.inr e) = - (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk - (Sum.inl v) - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - heAdj).symm - · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨eAlpha, heAlphaIncident, by - simp [TwoColorComponentSwap, heAlphaComponent, heAlphaColor]⟩ - private theorem helper_branch_318.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] @@ -594,7 +528,7 @@ theorem ExtensionBaseAlgorithmBInduction {V E : Type*} (hcb : c ≠ beta) : c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by exact TwoColorComponentSwapPreservesOther hc hca hcb - have root_swap_exchange := @helper_root_swap_exchange_230 V E inferInstance inferInstance G k + have root_swap_exchange := @TwoColorComponentSwapExchangesRootColors V E inferInstance G k have swap_preserves_present {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : Sum V E} (hne : alpha ≠ beta) diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean index c99d0e95db..d23635207d 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAlgorithmC.lean @@ -572,74 +572,6 @@ private theorem helper_single_step_295.{u_1, u_2} : And.intro heBetaNIncident (Or.inr heBetaNColor) exact hedgeNe (Sum.inr.inj (hsub hAlphaNeighbor hBetaNeighbor)) -private theorem helper_root_swap_exchange_437.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] {G : LooplessMultigraph V E} - {k : ℕ} {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} - (_ : alpha ≠ beta) (_ : beta ∈ MissingColors G phi v) - (_ : alpha ∈ PresentColors G phi v), - alpha ∈ MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ∧ - beta ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v := by - classical - intro V E _ _ G k phi v alpha beta hne hbeta halpha - let _ := Fintype.ofFinite V - have hbetaNotPresent : beta ∉ PresentColors G phi v := by - simpa [MissingColors] using hbeta - obtain ⟨eAlpha, heAlphaIncident, heAlphaColor⟩ := by - simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] using halpha - have heAlphaComponent : Sum.inr eAlpha ∈ - TwoColorComponent G phi alpha beta (Sum.inl v) := by - let H := TwoColorIncidenceGraph G phi alpha beta - have hadj : H.Adj (Sum.inl v) (Sum.inr eAlpha) := by - simpa [H, TwoColorIncidenceGraph] using - And.intro heAlphaIncident (Or.inl heAlphaColor) - change H.connectedComponentMk (Sum.inr eAlpha) = - H.connectedComponentMk (Sum.inl v) - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - hadj).symm - constructor - · unfold MissingColors - rw [Finset.mem_sdiff] - refine ⟨Finset.mem_univ _, ?_⟩ - intro hpresent - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] at hpresent - rcases hpresent with ⟨e, hev, heColor⟩ - by_cases heK : - Sum.inr e ∈ TwoColorComponent G phi alpha beta (Sum.inl v) - · have heBeta : phi e = some beta := by - unfold TwoColorComponentSwap at heColor - rw [ite_eq_left heK] at heColor - by_cases heAlpha : phi e = some alpha - · rw [ite_eq_left heAlpha] at heColor - exact False.elim (hne (Option.some.inj heColor).symm) - · by_cases heBeta : phi e = some beta - · exact heBeta - · rw [ite_eq_right heAlpha, ite_eq_right heBeta] at heColor - exact False.elim (heAlpha heColor) - apply hbetaNotPresent - simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨e, hev, heBeta⟩ - · have heOldAlpha : phi e = some alpha := by - simpa [TwoColorComponentSwap, heK] using heColor - have heAdj : (TwoColorIncidenceGraph G phi alpha beta).Adj - (Sum.inl v) (Sum.inr e) := by - simpa [TwoColorIncidenceGraph] using - And.intro hev (Or.inl heOldAlpha) - apply heK - change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk - (Sum.inr e) = - (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk - (Sum.inl v) - exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - heAdj).symm - · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, - true_and] - exact ⟨eAlpha, heAlphaIncident, by - simp [TwoColorComponentSwap, heAlphaComponent, heAlphaColor]⟩ - private theorem helper_branch_509.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] @@ -1625,7 +1557,7 @@ private theorem helper_continuation_1280.{u_1, u_2} : (hcb : c ≠ beta) : c ∈ PresentColors G (TwoColorComponentSwap G phi alpha beta z) v := by exact TwoColorComponentSwapPreservesOther hc hca hcb - have root_swap_exchange := @helper_root_swap_exchange_437 V E inferInstance inferInstance G k + have root_swap_exchange := @TwoColorComponentSwapExchangesRootColors V E inferInstance G k have swap_preserves_present {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin k} {z : Sum V E} (hne : alpha ≠ beta) diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean b/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean index c8136905c8..dc3cc9f7e3 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseAuxiliary.lean @@ -16,6 +16,7 @@ public import LeanPool.GoldbergSeymour.ExtensionBaseAlgorithmBTrace public import LeanPool.GoldbergSeymour.TechnicalTheoremBase public import LeanPool.GoldbergSeymour.ETTStrongInterchangeable public import LeanPool.GoldbergSeymour.InternalEdges +public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace /-! # Extension Base Auxiliary Lemmas @@ -2000,139 +2001,6 @@ private theorem helper_hprefixAvoids_2180.{u_1, u_2} : exact Finset.mem_inter.mpr ⟨hcBefore, hcDifference⟩ simp at hcEmpty -private theorem helper_hUsegmentVertexBefore_2265.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin - ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : (1 : ℕ) ≤ - (↑terminalPosition : ℕ)) (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree - jSlot.succ.castSucc).length) (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ - TreeSequenceVertexSet TjPrime) (uPosition : Fin (TjPrime.length + (1 : ℕ))) - (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ - TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; - ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( - ∀ (i : Fin (TjPrime.length + (1 : ℕ))) (_ : (↑i : ℕ) < (↑uPosition : ℕ)), TjPrime.vertex i ∈ - TreeVerticesBefore TjPrime u huPrime)) {A : TreeSequence G e0} (_ : - TreeSequenceInitialSegment A U) (_ : A.length < U.length) {x : V} (_ : x ∈ - TreeSequenceVertexSet A), x ∈ TreeVerticesBefore TjPrime u huPrime := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive - hterminalPositionBound TjPrime u huPrime uPosition huPositionPositive huPositionBound U - hUPrime hprimeVertexBefore A hAU hAlen x hxA - obtain ⟨hAULen, hAUVertices, -⟩ := hAU - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hxA - obtain ⟨i, rfl⟩ := hxA - let iU : Fin (U.length + 1) := - Fin.castLE (Nat.succ_le_succ hAULen) i - let iPrime : Fin (TjPrime.length + 1) := - Fin.castLE (Nat.succ_le_succ hUPrime.1) iU - have hiPrime : iPrime.val < uPosition.val := by - change i.val < uPosition.val - have hUlen : U.length = uPosition.val := by - simp [U, TreeSequencePrefix] - omega - rw [← hAUVertices i, ← hUPrime.2.1 iU] - exact hprimeVertexBefore iPrime hiPrime - -private theorem helper_transportUStep_2285.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : - PartialEdgeColoring E k), - let this : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (_ : ( - ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : - TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (trace : - ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + (1 : ℕ)) - → Fin ett.rounds), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : - (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (_ : (↑terminalPosition : ℕ) ≤ (ett.series.data.tree - jSlot.succ.castSucc).length) (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ - TreeSequenceVertexSet TjPrime) (b : Fin (p0 + (1 : ℕ))) (traceB : - ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), - let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); - ∀ (_ : (( - ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore - TjPrime u huPrime, MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = - MissingColors G rho1 x) ∧ - ∀ (f : E), (( - ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree - jSlot.succ.castSucc).edge a = f) ∨ - ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : - ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → traceB.coloring (Fin.last traceB.steps) f = rho1 f)) - (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : TjPrime.vertex uPosition = u) - (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ - TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; - ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( - ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A U) (_ : A.length < U.length) - {x : V} (_ : x ∈ TreeSequenceVertexSet A), x ∈ TreeVerticesBefore TjPrime u huPrime)) - {A B : TreeSequence G e0} (_ : TashkinovAugmentation rho1 A B) (_ : - TreeSequenceInitialSegment B U), TashkinovAugmentation rho2 A B := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal - hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 rho1 terminalPosition - hterminalPositionPositive hterminalPositionBound TjPrime u huPrime b traceB rho2 c2 - uPosition huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore A B - hstep hBU - rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ - have hAU : TreeSequenceInitialSegment A U := segmentTrans hAB hBU - have hAlen : A.length < U.length := - lt_of_lt_of_le (by omega) hBU.1 - have hcMissingRho : c ∈ TreeMissingColors rho2 A := by - unfold TreeMissingColors at hcMissing ⊢ - obtain ⟨x, hxA, hcx⟩ := Finset.mem_biUnion.mp hcMissing - refine Finset.mem_biUnion.mpr ⟨x, hxA, ?_⟩ - rw [c2.1 x (Finset.mem_union_right _ - (hUsegmentVertexBefore hAU hAlen hxA))] - exact hcx - let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) - let addedU : Fin U.length := Fin.castLE hBU.1 added - let addedPrime : Fin TjPrime.length := Fin.castLE hUPrime.1 addedU - have haddedPosition : addedPrime.val < uPosition.val := by - change A.length < uPosition.val - have hUlen : U.length = uPosition.val := by - simp [U, TreeSequencePrefix] - omega - have haddedIdentity : TjPrime.edge addedPrime = B.edge added := - (hUPrime.2.2 addedU).trans (hBU.2.2 added) - have haddedFixed : rho2 (B.edge added) = rho1 (B.edge added) := by - apply c2.2 (B.edge added) - exact Or.inr ⟨addedPrime, uPosition, huPosition, - haddedPosition, haddedIdentity⟩ - refine ⟨hlen, hAB, c, ?_, hcMissingRho⟩ - change rho2 (B.edge added) = some c - exact haddedFixed.trans hcolor - private theorem helper_hvNotPrevious_2347.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -4540,96 +4408,6 @@ private theorem helper_hclaim45Package_4916.{u_1, u_2} : hrho3One0, hd10, hd2Missing0, hd2Edges0, hdeltaZ0, hd2z0, hd30⟩ -private theorem helper_hUsegmentVertexBefore_5198.{u_1, u_2} : - SharedFacts.ExtensionBranches.usegmentVertexBeforeStatement.{u_1, u_2} := - SharedFacts.ExtensionBranches.usegmentVertexBefore.{u_1, u_2} - -private theorem helper_transportUStep_5236.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (_ : ( - ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : - TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (trace : - ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin - ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : - TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 - gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree - jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet - TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : - PartialEdgeColoring E k) (_ : ( - ∀ (f : E) (_ : (( - ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : - ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ - ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex - uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 f)) - (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : TjPrime.vertex uPosition = u0) - (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ - TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; - ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( - ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A U) (_ : A.length < U.length) - {y : V} (_ : y ∈ TreeSequenceVertexSet A), y ∈ TreeVerticesBefore TjPrime u0 huPrime0)) (_ - : ( - ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, MissingColors G rho3 y = MissingColors G rho1 - y)) {A B : TreeSequence G e0} (_ : TashkinovAugmentation rho1 A B) (_ : - TreeSequenceInitialSegment B U), TashkinovAugmentation rho3 A B := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 rho3 hd2Edges uPosition - huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore - hbeforePrimeMissing A B hstep hBU - rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ - have hAU : TreeSequenceInitialSegment A U := segmentTrans hAB hBU - have hAlen : A.length < U.length := - lt_of_lt_of_le (by omega) hBU.1 - have hcMissingRho : c ∈ TreeMissingColors rho3 A := by - unfold TreeMissingColors at hcMissing - obtain ⟨y, hyA, hcy⟩ := Finset.mem_biUnion.mp hcMissing - refine Finset.mem_biUnion.mpr ⟨y, hyA, ?_⟩ - rw [hbeforePrimeMissing y (hUsegmentVertexBefore hAU hAlen hyA)] - exact hcy - let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) - let addedU : Fin U.length := Fin.castLE hBU.1 added - let addedPrime : Fin TjPrime.length := Fin.castLE hUPrime.1 addedU - have haddedPosition : addedPrime.val < uPosition.val := by - change A.length < uPosition.val - have hUlen : U.length = uPosition.val := by - simp [U, TreeSequencePrefix] - omega - have haddedIdentity : TjPrime.edge addedPrime = B.edge added := - (hUPrime.2.2 addedU).trans (hBU.2.2 added) - have haddedFixed : rho3 (B.edge added) = rho1 (B.edge added) := by - apply hd2Edges (B.edge added) - exact Or.inr ⟨addedPrime, uPosition, huPosition, - haddedPosition, haddedIdentity⟩ - refine ⟨hlen, hAB, c, haddedFixed.trans hcolor, hcMissingRho⟩ - private theorem helper_hTjC_5298.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -5265,96 +5043,6 @@ private theorem helper_branch_5861.{u_1, u_2} : SharedFacts.ExtensionBranches.branch3129Statement.{u_1, u_2} := SharedFacts.ExtensionBranches.branch3129.{u_1, u_2} -private theorem helper_hUsegmentVertexBefore_6032.{u_1, u_2} : - SharedFacts.ExtensionBranches.usegmentVertexBeforeStatement.{u_1, u_2} := - SharedFacts.ExtensionBranches.usegmentVertexBefore.{u_1, u_2} - -private theorem helper_transportUStep_6071.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (_ : ( - ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : - TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (trace : - ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin - ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : - TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 - gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree - jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet - TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (rho3 : - PartialEdgeColoring E k) (_ : ( - ∀ (f : E) (_ : (( - ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), seed.length ≤ (↑a : ℕ) ∧ (↑a : - ℕ) < (↑zPosition0 : ℕ) ∧ (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ - ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex - uPosition = u0 ∧ (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 f)) - (uPosition : Fin (TjPrime.length + (1 : ℕ))) (_ : TjPrime.vertex uPosition = u0) - (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ - TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; - ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( - ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A U) (_ : A.length < U.length) - {y : V} (_ : y ∈ TreeSequenceVertexSet A), y ∈ TreeVerticesBefore TjPrime u0 huPrime0)) (_ - : ( - ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, MissingColors G rho3 y = MissingColors G rho1 - y)) {A B : TreeSequence G e0} (_ : TashkinovAugmentation rho1 A B) (_ : - TreeSequenceInitialSegment B U), TashkinovAugmentation rho3 A B := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 rho3 hd2Edges uPosition - huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore - hbeforePrimeMissing A B hstep hBU - rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ - have hAU : TreeSequenceInitialSegment A U := segmentTrans hAB hBU - have hAlen : A.length < U.length := - lt_of_lt_of_le (by omega) hBU.1 - have hcMissingRho : c ∈ TreeMissingColors rho3 A := by - unfold TreeMissingColors at hcMissing ⊢ - obtain ⟨y, hyA, hcy⟩ := Finset.mem_biUnion.mp hcMissing - refine Finset.mem_biUnion.mpr ⟨y, hyA, ?_⟩ - rw [hbeforePrimeMissing y (hUsegmentVertexBefore hAU hAlen hyA)] - exact hcy - let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) - let addedU : Fin U.length := Fin.castLE hBU.1 added - let addedPrime : Fin TjPrime.length := Fin.castLE hUPrime.1 addedU - have haddedPosition : addedPrime.val < uPosition.val := by - change A.length < uPosition.val - have hUlen : U.length = uPosition.val := by - simp [U, TreeSequencePrefix] - omega - have haddedIdentity : TjPrime.edge addedPrime = B.edge added := - (hUPrime.2.2 addedU).trans (hBU.2.2 added) - have haddedFixed : rho3 (B.edge added) = rho1 (B.edge added) := by - apply hd2Edges (B.edge added) - exact Or.inr ⟨addedPrime, uPosition, huPosition, - haddedPosition, haddedIdentity⟩ - exact ⟨hlen, hAB, c, haddedFixed.trans hcolor, hcMissingRho⟩ - private theorem helper_equalPrefixes_6220.{u_1, u_2} : SharedFacts.ExtensionBranches.equalPrefixesStatement.{u_1, u_2} := SharedFacts.ExtensionBranches.equalPrefixes.{u_1, u_2} diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean b/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean index 387df4e2a1..2e985bc5d9 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module + + import all LeanPool.GoldbergSeymour.ExtensionBaseBranchPreparation import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary public import LeanPool.GoldbergSeymour.ExtensionBaseStepLemmas @@ -149,287 +151,6 @@ theorem helper_hvBeforePrime_7074.{u_1, u_2} : (@hseedPrime) (@hterminalSeed) (@u0) (@huPrime0) (@uPosition) (@huPosition) (@hseedBeforeU) -theorem helper_hUsegmentVertexBefore_7104.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := - TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) - hterminalPositionPositive hterminalPositionBound; - TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → - ∀ (TjPrime : TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) - (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) - (_ : - (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (uPosition : Fin (TjPrime.length + (1 : ℕ))) - (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := - TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; - TreeSequenceInitialSegment U TjPrime → - (∀ (i : Fin (TjPrime.length + (1 : ℕ))), - (↑i : ℕ) < (↑uPosition : ℕ) → - TjPrime.vertex i ∈ TreeVerticesBefore TjPrime u0 huPrime0) → - ∀ {A : TreeSequence G e0}, - TreeSequenceInitialSegment A U → - A.length < U.length → - ∀ {y : V}, - y ∈ TreeSequenceVertexSet A → - y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition - huPositionPositive huPositionBound U hUPrime hprimeVertexBefore A hAU hAlen y hyA - exact @helper_hUsegmentVertexBefore_5198 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) - (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) - (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) - (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) - (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) - (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) (@huPositionPositive) - (@huPositionBound) (@hUPrime) (@hprimeVertexBefore) (@A) (@hAU) (@hAlen) (@y) (@hyA) - -theorem helper_hbeforePrimeNeU_7117.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := - TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) - hterminalPositionPositive hterminalPositionBound; - TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → - ∀ (TjPrime : TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) - (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) - (_ : - (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (_ : Fin (TjPrime.length + (1 : ℕ))) {y : V}, - y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → - y ≠ u0 := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition y hy - exact @helper_hbeforePrimeNeU_3983 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) - (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) - (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) - (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) - (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@huPrime0) (@exitPath0) - (@zPosition0) (@uPosition) (@y) (@hy) - -theorem helper_hbeforePrimeMissing_7126.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), - let this : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) - (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) - (rho3 : PartialEdgeColoring E k), - (∀ - y ∈ - ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ - ({ z0 } : Finset V) ∪ - (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase - u0).erase - z0, - MissingColors G rho3 y = MissingColors G rho1 y) → - (z0 ∈ TreeVerticesBefore TjPrime u0 huPrime0 → - MissingColors G rho3 z0 = MissingColors G rho1 z0) → - (∀ {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0) → - ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, - MissingColors G rho3 y = MissingColors G rho1 y := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal - hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hd2z - hbeforePrimeNeU y hy - exact @helper_hbeforePrimeMissing_3991 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) - (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) - (@TjPrime) (@u0) (@huPrime0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hd2z) - (@hbeforePrimeNeU) (@y) (@hy) - -theorem helper_transportUStep_7134.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - (∀ {A B C : TreeSequence G e0}, - TreeSequenceInitialSegment A B → - TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := - TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) - hterminalPositionPositive hterminalPositionBound; - TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → - ∀ (TjPrime : TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) - (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) - (_ : - (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (rho3 : PartialEdgeColoring E k), - (∀ (f : E), - ((∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), - seed.length ≤ (↑a : ℕ) ∧ - (↑a : ℕ) < (↑zPosition0 : ℕ) ∧ - (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ - ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), - TjPrime.vertex uPosition = u0 ∧ - (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → - rho3 f = rho1 f) → - ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), - TjPrime.vertex uPosition = u0 → - ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := - TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; - TreeSequenceInitialSegment U TjPrime → - (∀ {A : TreeSequence G e0}, - TreeSequenceInitialSegment A U → - A.length < U.length → - ∀ {y : V}, - y ∈ TreeSequenceVertexSet A → y ∈ TreeVerticesBefore TjPrime u0 huPrime0) → - (∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, - MissingColors G rho3 y = MissingColors G rho1 y) → - ∀ {A B : TreeSequence G e0}, - TashkinovAugmentation rho1 A B → - TreeSequenceInitialSegment B U → - TashkinovAugmentation rho3 A B := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 rho3 hd2Edges uPosition - huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore - hbeforePrimeMissing A B hstep hBU - exact @helper_transportUStep_5236 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) - (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) - (@segmentTrans) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) - (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) - (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@huPrime0) (@exitPath0) - (@zPosition0) (@rho3) (@hd2Edges) (@uPosition) (@huPosition) (@huPositionPositive) - (@huPositionBound) (@hUPrime) (@hUsegmentVertexBefore) (@hbeforePrimeMissing) (@A) - (@B) (@hstep) (@hBU) - theorem helper_segmentVertexBefore_7192.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -590,287 +311,6 @@ theorem helper_hzChoiceForContradiction_7230.{u_1, u_2} : (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@beta0) (@z0) (@zPosition0) (@hzChoice0) -theorem helper_hUsegmentVertexBefore_7424.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := - TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) - hterminalPositionPositive hterminalPositionBound; - TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → - ∀ (TjPrime : TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) - (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) - (_ : - (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (uPosition : Fin (TjPrime.length + (1 : ℕ))) - (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := - TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; - TreeSequenceInitialSegment U TjPrime → - (∀ (i : Fin (TjPrime.length + (1 : ℕ))), - (↑i : ℕ) < (↑uPosition : ℕ) → - TjPrime.vertex i ∈ TreeVerticesBefore TjPrime u0 huPrime0) → - ∀ {A : TreeSequence G e0}, - TreeSequenceInitialSegment A U → - A.length < U.length → - ∀ {y : V}, - y ∈ TreeSequenceVertexSet A → - y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition - huPositionPositive huPositionBound U hUPrime hprimeVertexBefore A hAU hAlen y hyA - exact @helper_hUsegmentVertexBefore_6032 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) - (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) - (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) - (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) - (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) - (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) (@huPositionPositive) - (@huPositionBound) (@hUPrime) (@hprimeVertexBefore) (@A) (@hAU) (@hAlen) (@y) (@hyA) - -theorem helper_hbeforePrimeNeU_7437.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := - TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) - hterminalPositionPositive hterminalPositionBound; - TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → - ∀ (TjPrime : TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) - (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) - (_ : - (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (_ : Fin (TjPrime.length + (1 : ℕ))) {y : V}, - y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → - y ≠ u0 := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition y hy - exact @helper_hbeforePrimeNeU_4309 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) - (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) - (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) - (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) - (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) - (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) (@y) (@hy) - -theorem helper_hbeforePrimeMissing_7447.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), - let this : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) - (z0 : V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) - (rho3 : PartialEdgeColoring E k), - (∀ - y ∈ - ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ - ({ z0 } : Finset V) ∪ - (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase - u0).erase - z0, - MissingColors G rho3 y = MissingColors G rho1 y) → - (z0 ∈ TreeVerticesBefore TjPrime u0 huPrime0 → - MissingColors G rho3 z0 = MissingColors G rho1 z0) → - (∀ {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0) → - ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, - MissingColors G rho3 y = MissingColors G rho1 y := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal - hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hd2z - hbeforePrimeNeU y hy - exact @helper_hbeforePrimeMissing_4318 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) - (@v) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) - (@TjPrime) (@u0) (@huPrime0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hd2z) - (@hbeforePrimeNeU) (@y) (@hy) - -theorem helper_transportUStep_7455.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - (∀ {A B C : TreeSequence G e0}, - TreeSequenceInitialSegment A B → - TreeSequenceInitialSegment B C → TreeSequenceInitialSegment A C) → - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := - TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) - hterminalPositionPositive hterminalPositionBound; - TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → - ∀ (TjPrime : TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) - (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) - (_ : - (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (zPosition0 : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (rho3 : PartialEdgeColoring E k), - (∀ (f : E), - ((∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), - seed.length ≤ (↑a : ℕ) ∧ - (↑a : ℕ) < (↑zPosition0 : ℕ) ∧ - (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ - ∃ (a : Fin TjPrime.length) (uPosition : Fin (TjPrime.length + (1 : ℕ))), - TjPrime.vertex uPosition = u0 ∧ - (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f) → - rho3 f = rho1 f) → - ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), - TjPrime.vertex uPosition = u0 → - ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := - TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; - TreeSequenceInitialSegment U TjPrime → - (∀ {A : TreeSequence G e0}, - TreeSequenceInitialSegment A U → - A.length < U.length → - ∀ {y : V}, - y ∈ TreeSequenceVertexSet A → y ∈ TreeVerticesBefore TjPrime u0 huPrime0) → - (∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, - MissingColors G rho3 y = MissingColors G rho1 y) → - ∀ {A B : TreeSequence G e0}, - TashkinovAugmentation rho1 A B → - TreeSequenceInitialSegment B U → - TashkinovAugmentation rho3 A B := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 rho3 hd2Edges uPosition - huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore - hbeforePrimeMissing A B hstep hBU - exact @helper_transportUStep_6071 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) - (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) - (@segmentTrans) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) - (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) - (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) - (@huPrime0) (@exitPath0) (@zPosition0) (@rho3) (@hd2Edges) (@uPosition) - (@huPosition) (@huPositionPositive) (@huPositionBound) (@hUPrime) - (@hUsegmentVertexBefore) (@hbeforePrimeMissing) (@A) (@B) (@hstep) (@hBU) - theorem helper_hterminalMissingEq_7478.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -1697,49 +1137,29 @@ theorem helper_branch_13441.{u_1, u_2} : (hAlen : A.length < U.length) {y : V} (hyA : y ∈ TreeSequenceVertexSet A) : y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by - exact @helper_hUsegmentVertexBefore_7104 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) - (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) - (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) - (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) - (@zPosition) (@u0) (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) - (@huPositionPositive) (@huPositionBound) (@hUPrime) (@hprimeVertexBefore) (@A) (@hAU) - (@hAlen) (@y) (@hyA) - have hbeforePrimeNeU {y : V} - (hy : y ∈ TreeVerticesBefore TjPrime u0 huPrime0) : y ≠ u0 := by - exact @helper_hbeforePrimeNeU_7117 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) - (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) - (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) - (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) - (@zPosition) (@u0) (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) (@y) (@hy) + exact TreeSequenceInitialSegment.mem_before_of_length hAU hUPrime hAlen + hprimeVertexBefore hyA have hbeforePrimeMissing (y : V) (hy : y ∈ TreeVerticesBefore TjPrime u0 huPrime0) : MissingColors G rho3 y = MissingColors G rho1 y := by - exact @helper_hbeforePrimeMissing_7126 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) - (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@TjPrime) (@u0) - (@huPrime0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hd2z) (@hbeforePrimeNeU) (@y) (@hy) - have transportUStep {A B : TreeSequence G e0} - (hstep : TashkinovAugmentation rho1 A B) - (hBU : TreeSequenceInitialSegment B U) : - TashkinovAugmentation rho3 A B := by - exact @helper_transportUStep_7134 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) - (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) - (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) - (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) - (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@huPrime0) (@exitPath0) - (@zPosition0) (@rho3) (@hd2Edges) (@uPosition) (@huPosition) (@huPositionPositive) - (@huPositionBound) (@hUPrime) (@hUsegmentVertexBefore) (@hbeforePrimeMissing) (@A) (@B) - (@hstep) (@hBU) + exact TreeVerticesBefore.missingColors_eq_of_erase hd2Missing hd2z hy have transportURoute (S : TreeSequence G e0) (hroute : TashkinovAugmentationSequence rho1 S U) : TashkinovAugmentationSequence rho3 S U := by - exact @helper_transportURoute_4006 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@sigma) (@hvFinal) - (@trace) (@TjPrime) (@rho3) (@uPosition) (@huPositionPositive) (@huPositionBound) - (@transportUStep) (@S) (@hroute) + apply TashkinovAugmentationSequence.transport_of_fixed (target := U) ?_ ?_ hroute + · intro index + let primeIndex : Fin TjPrime.length := Fin.castLE hUPrime.1 index + have atPosition : primeIndex.val < uPosition.val := by + change index.val < uPosition.val + exact index.isLt + have agreement : rho3 (TjPrime.edge primeIndex) = + rho1 (TjPrime.edge primeIndex) := by + apply hd2Edges (TjPrime.edge primeIndex) + exact Or.inr ⟨primeIndex, uPosition, huPosition, atPosition, rfl⟩ + rw [show TjPrime.edge primeIndex = U.edge index from hUPrime.2.2 index] at agreement + exact agreement + · intro A hAU hAlen vertex member + exact hbeforePrimeMissing vertex (hUsegmentVertexBefore hAU hAlen member) have hrouteRhoThreeU : TashkinovAugmentationSequence rho3 seed U := transportURoute seed hrouteRhoOneU obtain ⟨C, hclosureUC⟩ := TashkinovClosureExists rho3 U @@ -2863,50 +2283,29 @@ theorem helper_branch_15847.{u_1, u_2} : (hAlen : A.length < U.length) {y : V} (hyA : y ∈ TreeSequenceVertexSet A) : y ∈ TreeVerticesBefore TjPrime u0 huPrime0 := by - exact @helper_hUsegmentVertexBefore_7424 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) - (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) - (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) - (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) - (@zPosition) (@u0) (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) - (@huPositionPositive) (@huPositionBound) (@hUPrime) (@hprimeVertexBefore) (@A) (@hAU) - (@hAlen) (@y) (@hyA) - have hbeforePrimeNeU {y : V} - (hy : y ∈ TreeVerticesBefore TjPrime u0 huPrime0) : - y ≠ u0 := by - exact @helper_hbeforePrimeNeU_7437 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) - (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) - (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) - (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) (@componentPath) (@u) (@exitPath) - (@zPosition) (@u0) (@huPrime0) (@exitPath0) (@zPosition0) (@uPosition) (@y) (@hy) + exact TreeSequenceInitialSegment.mem_before_of_length hAU hUPrime hAlen + hprimeVertexBefore hyA have hbeforePrimeMissing (y : V) (hy : y ∈ TreeVerticesBefore TjPrime u0 huPrime0) : MissingColors G rho3 y = MissingColors G rho1 y := by - exact @helper_hbeforePrimeMissing_7447 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) - (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@TjPrime) (@u0) - (@huPrime0) (@z0) (@hz0) (@rho3) (@hd2Missing) (@hd2z) (@hbeforePrimeNeU) (@y) (@hy) - have transportUStep {A B : TreeSequence G e0} - (hstep : TashkinovAugmentation rho1 A B) - (hBU : TreeSequenceInitialSegment B U) : - TashkinovAugmentation rho3 A B := by - exact @helper_transportUStep_7455 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) - (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) - (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) - (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) (@TjPrime) (@x) - (@componentPath) (@u) (@exitPath) (@zPosition) (@u0) (@huPrime0) (@exitPath0) - (@zPosition0) (@rho3) (@hd2Edges) (@uPosition) (@huPosition) (@huPositionPositive) - (@huPositionBound) (@hUPrime) (@hUsegmentVertexBefore) (@hbeforePrimeMissing) (@A) (@B) - (@hstep) (@hBU) + exact TreeVerticesBefore.missingColors_eq_of_erase hd2Missing hd2z hy have transportURoute (S : TreeSequence G e0) (hroute : TashkinovAugmentationSequence rho1 S U) : TashkinovAugmentationSequence rho3 S U := by - exact @helper_transportURoute_4333 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@sigma) - (@hvFinal) (@trace) (@TjPrime) (@rho3) (@uPosition) (@huPositionPositive) - (@huPositionBound) (@transportUStep) (@S) (@hroute) + apply TashkinovAugmentationSequence.transport_of_fixed (target := U) ?_ ?_ hroute + · intro index + let primeIndex : Fin TjPrime.length := Fin.castLE hUPrime.1 index + have atPosition : primeIndex.val < uPosition.val := by + change index.val < uPosition.val + exact index.isLt + have agreement : rho3 (TjPrime.edge primeIndex) = + rho1 (TjPrime.edge primeIndex) := by + apply hd2Edges (TjPrime.edge primeIndex) + exact Or.inr ⟨primeIndex, uPosition, huPosition, atPosition, rfl⟩ + rw [show TjPrime.edge primeIndex = U.edge index from hUPrime.2.2 index] at agreement + exact agreement + · intro A hAU hAlen vertex member + exact hbeforePrimeMissing vertex (hUsegmentVertexBefore hAU hAlen member) have hrouteRhoThreeU : TashkinovAugmentationSequence rho3 seed U := transportURoute seed hrouteRhoOneU have hterminalNeU : v ≠ u0 := hu0Terminal.symm @@ -5223,29 +4622,26 @@ theorem helper_continuation_14753.{u_1, u_2} : (hAlen : A.length < U.length) {x : V} (hxA : x ∈ TreeSequenceVertexSet A) : x ∈ TreeVerticesBefore TjPrime u huPrime := by - exact @helper_hUsegmentVertexBefore_5797 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) - (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) - (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) - (@u) (@huPrime) (@uPosition) (@huPositionPositive) (@huPositionBound) (@hUPrime) - (@hprimeVertexBefore) (@A) (@hAU) (@hAlen) (@x) (@hxA) - have transportUStep {A B : TreeSequence G e0} - (hstep : TashkinovAugmentation rho1 A B) - (hBU : TreeSequenceInitialSegment B U) : - TashkinovAugmentation rho2 A B := by - exact @helper_transportUStep_5808 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) - (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) (@trace) (@p0) (@indices0) - (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) - (@u) (@huPrime) (@b) (@traceB) (@c2) (@uPosition) (@huPosition) (@huPositionPositive) - (@huPositionBound) (@hUPrime) (@hUsegmentVertexBefore) (@A) (@B) (@hstep) (@hBU) + exact TreeSequenceInitialSegment.mem_before_of_length hAU hUPrime hAlen + hprimeVertexBefore hxA have transportURoute (S : TreeSequence G e0) (hroute : TashkinovAugmentationSequence rho1 S U) : TashkinovAugmentationSequence rho2 S U := by - exact @helper_transportURoute_2771 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@v) (@sigma) (@hvFinal) (@trace) - (@p0) (@indices0) (@TjPrime) (@u) (@b) (@traceB) (@uPosition) (@huPositionPositive) - (@huPositionBound) (@transportUStep) (@S) (@hroute) + apply TashkinovAugmentationSequence.transport_of_fixed (target := U) ?_ ?_ hroute + · intro index + let primeIndex : Fin TjPrime.length := Fin.castLE hUPrime.1 index + have atPosition : primeIndex.val < uPosition.val := by + change index.val < uPosition.val + exact index.isLt + have agreement : rho2 (TjPrime.edge primeIndex) = + rho1 (TjPrime.edge primeIndex) := by + apply c2.2 (TjPrime.edge primeIndex) + exact Or.inr ⟨primeIndex, uPosition, huPosition, atPosition, rfl⟩ + rw [show TjPrime.edge primeIndex = U.edge index from hUPrime.2.2 index] at agreement + exact agreement + · intro A hAU hAlen vertex member + exact c2.1 vertex (Finset.mem_union_right _ + (hUsegmentVertexBefore hAU hAlen member)) have hrouteRhoTwoU : TashkinovAugmentationSequence rho2 seed U := transportURoute seed hrouteRhoOneU have hterminalMissingEq : MissingColors G rho2 v = diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean b/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean index f4b62d6442..6608081378 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseBranchPreparation.lean @@ -1197,20 +1197,8 @@ theorem helper_hUPrime_3958.{u_1, u_2} : SharedFacts.ExtensionBaseStepLemmas.uPrimeStatement.{u_1, u_2} := SharedFacts.ExtensionBaseStepLemmas.uPrime.{u_1, u_2} -/-- Existing proof-module entry point for the shared interface or construction. -/ -theorem helper_hbeforePrimeNeU_3983.{u_1, u_2} : - SharedFacts.ExtensionBranchPreparation.hbeforePrimeNeUStatement.{u_1, u_2} := - SharedFacts.ExtensionBranchPreparation.hbeforePrimeNeU.{u_1, u_2} -/-- Existing proof-module entry point for the shared interface or construction. -/ -theorem helper_hbeforePrimeMissing_3991.{u_1, u_2} : - SharedFacts.ExtensionBranchPreparation.hbeforePrimeMissingStatement.{u_1, u_2} := - SharedFacts.ExtensionBranchPreparation.hbeforePrimeMissing.{u_1, u_2} -/-- Existing proof-module entry point for the shared interface or construction. -/ -theorem helper_transportURoute_4006.{u_1, u_2} : - SharedFacts.ExtensionBranchPreparation.transportURouteStatement.{u_1, u_2} := - SharedFacts.ExtensionBranchPreparation.transportURoute.{u_1, u_2} /-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_huU_4024.{u_1, u_2} : @@ -1382,20 +1370,7 @@ theorem helper_hZTj_4280.{u_1, u_2} : · intro i simp [Z, TreeSequencePrefix] -/-- Existing proof-module entry point for the shared interface or construction. -/ -theorem helper_hbeforePrimeNeU_4309.{u_1, u_2} : - SharedFacts.ExtensionBranchPreparation.hbeforePrimeNeUStatement.{u_1, u_2} := - SharedFacts.ExtensionBranchPreparation.hbeforePrimeNeU.{u_1, u_2} -/-- Existing proof-module entry point for the shared interface or construction. -/ -theorem helper_hbeforePrimeMissing_4318.{u_1, u_2} : - SharedFacts.ExtensionBranchPreparation.hbeforePrimeMissingStatement.{u_1, u_2} := - SharedFacts.ExtensionBranchPreparation.hbeforePrimeMissing.{u_1, u_2} - -/-- Existing proof-module entry point for the shared interface or construction. -/ -theorem helper_transportURoute_4333.{u_1, u_2} : - SharedFacts.ExtensionBranchPreparation.transportURouteStatement.{u_1, u_2} := - SharedFacts.ExtensionBranchPreparation.transportURoute.{u_1, u_2} theorem helper_hterminalMissingEq_4347.{u_1, u_2} : open scoped Classical in @@ -2088,114 +2063,6 @@ theorem helper_hseedBeforeU_5770.{u_1, u_2} : (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@hseedPrime) (@u) (@uPosition) (@huPosition) (@huNotSeed) -theorem helper_hUsegmentVertexBefore_5797.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) (terminalPosition : Fin - ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (1 : ℕ) ≤ - (↑terminalPosition : ℕ) → (↑terminalPosition : ℕ) ≤ (ett.series.data.tree - jSlot.succ.castSucc).length → - ∀ (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) - (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : - ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; TreeSequenceInitialSegment U TjPrime → ( - ∀ (i : Fin (TjPrime.length + (1 : ℕ))), (↑i : ℕ) < (↑uPosition : ℕ) → TjPrime.vertex i ∈ - TreeVerticesBefore TjPrime u huPrime) → - ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A U → A.length < U.length → - ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore TjPrime u huPrime := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive - hterminalPositionBound TjPrime u huPrime uPosition huPositionPositive huPositionBound U - hUPrime hprimeVertexBefore A hAU hAlen x hxA - exact @helper_hUsegmentVertexBefore_2265 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) - (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) - (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) - (@u) (@huPrime) (@uPosition) (@huPositionPositive) (@huPositionBound) (@hUPrime) - (@hprimeVertexBefore) (@A) (@hAU) (@hAlen) (@x) (@hxA) - -theorem helper_transportUStep_5808.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : - PartialEdgeColoring E k), - let this : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin ett.rounds); ( - ∀ {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B C - → TreeSequenceInitialSegment A C) → - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (indices0 : Fin (p0 + - (1 : ℕ)) → Fin ett.rounds), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), (1 : - ℕ) ≤ (↑terminalPosition : ℕ) → (↑terminalPosition : ℕ) ≤ (ett.series.data.tree - jSlot.succ.castSucc).length → - ∀ (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (b : Fin - (p0 + (1 : ℕ))) (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), - let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); (( - ∀ x ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ TreeVerticesBefore - TjPrime u huPrime, MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = - MissingColors G rho1 x) ∧ - ∀ (f : E), (( - ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree - jSlot.succ.castSucc).edge a = f) ∨ - ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : - ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → traceB.coloring (Fin.last traceB.steps) f = rho1 f) - → - ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex uPosition = u → - ∀ (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ - TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; TreeSequenceInitialSegment U TjPrime → ( - ∀ {A : TreeSequence G e0}, TreeSequenceInitialSegment A U → A.length < U.length → - ∀ {x : V}, x ∈ TreeSequenceVertexSet A → x ∈ TreeVerticesBefore TjPrime u huPrime) → - ∀ {A B : TreeSequence G e0}, TashkinovAugmentation rho1 A B → TreeSequenceInitialSegment B U → - TashkinovAugmentation rho2 A B := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal - hfirstUpper hfirstPositive jSlot segmentTrans trace p0 indices0 rho1 terminalPosition - hterminalPositionPositive hterminalPositionBound TjPrime u huPrime b traceB rho2 c2 - uPosition huPosition huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore A B - hstep hBU - exact @helper_transportUStep_2285 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) - (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@segmentTrans) (@trace) - (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) - (@hterminalPositionBound) (@TjPrime) (@u) (@huPrime) (@b) (@traceB) (@c2) - (@uPosition) (@huPosition) (@huPositionPositive) (@huPositionBound) (@hUPrime) - (@hUsegmentVertexBefore) (@A) (@B) (@hstep) (@hBU) - theorem helper_hterminalInclusion_5831.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean index 9acdaad7a0..fb8d79497a 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean @@ -5,9 +5,12 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceTransport + +public import LeanPool.GoldbergSeymour.TreeVerticesBeforeFacts + public import LeanPool.GoldbergSeymour.MaximumPropertyTransport public import LeanPool.GoldbergSeymour.OrderedTreeUnionExists -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix public import LeanPool.GoldbergSeymour.TashkinovClosureExists @@ -802,64 +805,6 @@ private theorem helper_hbound_937.{u_1, u_2} : hclosureAdjoinC simpa only [hTjStored] using hraw -private theorem helper_transportUStep_875.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] - {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} - {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : - ExtendedTashkinovTree G k e0 input T generating) {lowerInput : PartialEdgeColoring E k} - {lowerTree : TreeSequence G e0} {lowerGenerating : PartialEdgeColoring E k} (_ : - ExtendedTashkinovTree G k e0 lowerInput lowerTree lowerGenerating) (_ : Fin ett.rounds) - (Tj _ TjPrime : TreeSequence G e0) (rho1 rho3 : PartialEdgeColoring E k) (u : V) (huPrime - : u ∈ TreeSequenceVertexSet TjPrime) (zPosition : Fin (Tj.length + (1 : ℕ))) (uPosition : - Fin (TjPrime.length + (1 : ℕ))) (_ : ( - ∀ (f : E) (_ : (( - ∃ (a : Fin Tj.length), (↑a : ℕ) < (↑zPosition : ℕ) ∧ Tj.edge a = f) ∨ - ∃ (a : Fin TjPrime.length), (↑a : ℕ) < (↑uPosition : ℕ) ∧ TjPrime.edge a = f)), rho3 f = rho1 - f)) (_ : ( - ∀ {A B C : TreeSequence G e0} (_ : TreeSequenceInitialSegment A B) (_ : - TreeSequenceInitialSegment B C), TreeSequenceInitialSegment A C)) (huPositionPositive : (1 - : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; - ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( - ∀ {A : TreeSequence G e0} (_ : TreeSequenceInitialSegment A U) (_ : A.length < U.length) - {v : V} (_ : v ∈ TreeSequenceVertexSet A), v ∈ TreeVerticesBefore TjPrime u huPrime)) (_ : - ( - ∀ w ∈ TreeVerticesBefore TjPrime u huPrime, MissingColors G rho3 w = MissingColors G rho1 w)) - {A B : TreeSequence G e0} (_ : TashkinovAugmentation rho1 A B) (_ : - TreeSequenceInitialSegment B U), TashkinovAugmentation rho3 A B := by - classical - intro V E _ _ _ G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot - Tj seed TjPrime rho1 rho3 u huPrime zPosition uPosition hd2Edges segmentTrans - huPositionPositive huPositionBound U hUPrime hUsegmentVertexBefore hbeforePrimeMissing A B - hstep hBU - rcases hstep with ⟨hlen, hAB, c, hcolor, hcMissing⟩ - have hAU : TreeSequenceInitialSegment A U := segmentTrans hAB hBU - have hAlen : A.length < U.length := - lt_of_lt_of_le (by omega) hBU.1 - have hcMissingRho : c ∈ TreeMissingColors rho3 A := by - unfold TreeMissingColors at hcMissing ⊢ - obtain ⟨w, hwA, hcw⟩ := Finset.mem_biUnion.mp hcMissing - refine Finset.mem_biUnion.mpr ⟨w, hwA, ?_⟩ - rw [hbeforePrimeMissing w (hUsegmentVertexBefore hAU hAlen hwA)] - exact hcw - let added : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) - let addedU : Fin U.length := Fin.castLE hBU.1 added - let addedPrime : Fin TjPrime.length := Fin.castLE hUPrime.1 addedU - have haddedPosition : addedPrime.val < uPosition.val := by - change A.length < uPosition.val - have hUlen : U.length = uPosition.val := by simp [U, TreeSequencePrefix] - omega - have haddedIdentity : TjPrime.edge addedPrime = B.edge added := by - exact (hUPrime.2.2 addedU).trans (hBU.2.2 added) - have haddedFixed : rho3 (B.edge added) = rho1 (B.edge added) := by - apply hd2Edges (B.edge added) - exact Or.inr ⟨addedPrime, haddedPosition, haddedIdentity⟩ - refine ⟨hlen, hAB, c, ?_, hcMissingRho⟩ - change rho3 (B.edge added) = some c - exact haddedFixed.trans hcolor - private theorem helper_branch_1101.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] @@ -1010,44 +955,6 @@ private theorem helper_hseedVertexBefore_888.{u_1, u_2} : · exact (hseedJ.2.1 (Fin.last seed.length)).trans hseedTerminal · simpa [p, q] using hi -private theorem helper_hUsegmentVertexBefore_1004.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] - {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} - {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : - ExtendedTashkinovTree G k e0 input T generating) {lowerInput : PartialEdgeColoring E k} - {lowerTree : TreeSequence G e0} {lowerGenerating : PartialEdgeColoring E k} (_ : - ExtendedTashkinovTree G k e0 lowerInput lowerTree lowerGenerating) (_ : Fin ett.rounds) - (Tj _ TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) - (_ : Fin (Tj.length + (1 : ℕ))) (uPosition : Fin (TjPrime.length + (1 : ℕ))) - (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ - TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; - ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( - ∀ (i : Fin (TjPrime.length + (1 : ℕ))) (_ : (↑i : ℕ) < (↑uPosition : ℕ)), TjPrime.vertex i ∈ - TreeVerticesBefore TjPrime u huPrime)) {A : TreeSequence G e0} (_ : - TreeSequenceInitialSegment A U) (_ : A.length < U.length) {v : V} (_ : v ∈ - TreeSequenceVertexSet A), v ∈ TreeVerticesBefore TjPrime u huPrime := by - classical - intro V E _ _ _ G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot - Tj seed TjPrime u huPrime zPosition uPosition huPositionPositive huPositionBound U hUPrime - hprimeVertexBefore A hAU hAlen v hvA - obtain ⟨hAULen, hAUVertices, -⟩ := hAU - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hvA - obtain ⟨i, rfl⟩ := hvA - let iU : Fin (U.length + 1) := - Fin.castLE (Nat.succ_le_succ hAULen) i - let iPrime : Fin (TjPrime.length + 1) := - Fin.castLE (Nat.succ_le_succ hUPrime.1) iU - have hiPrime : iPrime.val < uPosition.val := by - change i.val < uPosition.val - have hUlen : U.length = uPosition.val := by simp [U, TreeSequencePrefix] - omega - rw [← hAUVertices i, ← hUPrime.2.1 iU] - exact hprimeVertexBefore iPrime hiPrime - private theorem helper_hbeforeZMissing_1101.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] [DecidableEq V] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} (Tj TjPrime : TreeSequence G @@ -1382,43 +1289,33 @@ private theorem helper_continuation_1295.{u_1, u_2} : exact ⟨i, rfl⟩ · unfold TreeVertexOrder exact ⟨i, uPosition, rfl, huPosition, hi⟩ - have hUsegmentVertexBefore := @helper_hUsegmentVertexBefore_1004 V E inferInstance inferInstance - inferInstance G k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot - Tj seed TjPrime u huPrime zPosition uPosition huPositionPositive huPositionBound hUPrime - hprimeVertexBefore - have hbeforePrimeNeU {w : V} - (hw : w ∈ TreeVerticesBefore TjPrime u huPrime) : w ≠ u := by - unfold TreeVerticesBefore at hw - obtain ⟨-, i, j, hiw, hju, hij⟩ := Finset.mem_filter.mp hw - intro hwu - have hijEq : i = j := TjPrime.vertex_injective - (hiw.trans (hwu.trans hju.symm)) - omega + have hUsegmentVertexBefore {A : TreeSequence G e0} + (hAU : TreeSequenceInitialSegment A U) (hAlen : A.length < U.length) + {w : V} (hwA : w ∈ TreeSequenceVertexSet A) : + w ∈ TreeVerticesBefore TjPrime u huPrime := by + exact TreeSequenceInitialSegment.mem_before_of_length hAU hUPrime hAlen + hprimeVertexBefore hwA have hbeforePrimeMissing (w : V) (hw : w ∈ TreeVerticesBefore TjPrime u huPrime) : MissingColors G rho3 w = MissingColors G rho1 w := by - by_cases hwz : w = z - · subst w - exact hd2Z hw - · apply hd2Missing w - apply Finset.mem_erase.mpr - refine ⟨hwz, Finset.mem_erase.mpr ⟨hbeforePrimeNeU hw, ?_⟩⟩ - apply Finset.mem_union_right - exact Finset.mem_union_left _ hw - have transportUStep := @helper_transportUStep_875 V E inferInstance inferInstance inferInstance G - k e0 input T generating ett lowerInput lowerTree lowerGenerating lower jSlot Tj seed TjPrime - rho1 rho3 u huPrime zPosition uPosition hd2Edges segmentTrans huPositionPositive - huPositionBound hUPrime hUsegmentVertexBefore hbeforePrimeMissing + exact TreeVerticesBefore.missingColors_eq_of_erase hd2Missing hd2Z hw have transportURoute (S : TreeSequence G e0) (hroute : TashkinovAugmentationSequence rho1 S U) : TashkinovAugmentationSequence rho3 S U := by - unfold TashkinovAugmentationSequence at hroute ⊢ - induction hroute using Relation.ReflTransGen.head_induction_on with - | refl => exact Relation.ReflTransGen.refl - | @head A B hAB hBU ih => - have hBsegment : TreeSequenceInitialSegment B U := - TashkinovAugmentationSequenceInitialSegment rho1 B U hBU - exact Relation.ReflTransGen.head (transportUStep hAB hBsegment) ih + apply TashkinovAugmentationSequence.transport_of_fixed (target := U) ?_ ?_ hroute + · intro index + let primeIndex : Fin TjPrime.length := Fin.castLE hUPrime.1 index + have atPosition : primeIndex.val < uPosition.val := by + change index.val < uPosition.val + exact index.isLt + have agreement : rho3 (TjPrime.edge primeIndex) = + rho1 (TjPrime.edge primeIndex) := by + apply hd2Edges (TjPrime.edge primeIndex) + exact Or.inr ⟨primeIndex, atPosition, rfl⟩ + rw [show TjPrime.edge primeIndex = U.edge index from hUPrime.2.2 index] at agreement + exact agreement + · intro A hAU hAlen vertex member + exact hbeforePrimeMissing vertex (hUsegmentVertexBefore hAU hAlen member) have hrouteRhoThreeU : TashkinovAugmentationSequence rho3 seed U := transportURoute seed hrouteRhoOneU have hterminalNeZ : terminalSupport ≠ z := by diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaimTreeEdgeColors.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaimTreeEdgeColors.lean index eef553b848..4dfdf8bc64 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseClaimTreeEdgeColors.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaimTreeEdgeColors.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.HkuTreeColorsControlled public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved @@ -21,52 +22,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private theorem helper_segment_61.{u_1, u_2} : - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (rounds : ℕ) - (series : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + (1 : ℕ))) (i : Fin - rounds), j = i.succ → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) - (series.data.tree i.succ.succ) := by - classical - intro V E _ _ _ G k e0 input rounds series j i hji - cases series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges - initialKind initialVertex initialOutside initialDelta initialGamma - initialClosure => - exact (Fin.succ_ne_zero i) hji.symm |>.elim - | SE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hji - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | PE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper - secondStableOneUncolored secondStableRelation exitWitness - currentColoring currentProper currentOneUncolored currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hji - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | RE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma adjoined adjoinedExactly closedExtension orderedExtension - strictExtension => - have hvals := congrArg Fin.val hji - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - private theorem helper_setTransfer_118.{u_1, u_2} : ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (rounds : ℕ) @@ -225,8 +180,7 @@ theorem ExtensionBaseClaimTreeEdgeColors {V E : Type*} exact ((by classical let : DecidableEq V := Classical.decEq V - have segment := @helper_segment_61 V E inferInstance inferInstance inferInstance G k e0 input - rounds series + have segment := TashkinovSeries.stepInitialSegment G k rounds e0 input series have vertexTransfer {A B : TreeSequence G e0} (hab : TreeSequenceInitialSegment A B) {v : V} (hv : v ∈ TreeSequenceVertexSet A) : diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean b/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean index c3fc9cae20..3fa26e9661 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean @@ -3687,38 +3687,6 @@ theorem helper_hprimeVertexBefore_2750.{u_1, u_2} : exact ⟨i, rfl⟩ · exact ⟨i, uPosition, rfl, huPosition, hi⟩ -theorem helper_transportURoute_2771.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (v : V) (sigma : PartialEdgeColoring E k) (hvFinal : v ∈ - TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : - ℕ) (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (TjPrime : TreeSequence G e0) (u : V) (b : Fin (p0 + (1 : ℕ))) (traceB : - ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), - let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); - ∀ (uPosition : Fin (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : - ℕ)) (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; ( - ∀ {A B : TreeSequence G e0}, TashkinovAugmentation rho1 A B → TreeSequenceInitialSegment B U → - TashkinovAugmentation rho2 A B) → - ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence rho1 S U → - TashkinovAugmentationSequence rho2 S U := by - classical - intro V E _ _ _ G k e0 input T generating ett v sigma hvFinal trace p0 indices0 rho1 TjPrime u - b traceB rho2 uPosition huPositionPositive huPositionBound U transportUStep S hroute - unfold TashkinovAugmentationSequence at hroute ⊢ - induction hroute using Relation.ReflTransGen.head_induction_on with - | refl => exact Relation.ReflTransGen.refl - | @head A B hAB hBU ih => - have hBsegment : TreeSequenceInitialSegment B U := - TashkinovAugmentationSequenceInitialSegment rho1 B U hBU - exact Relation.ReflTransGen.head - (transportUStep hAB hBsegment) ih - theorem helper_hterminalInclusion_2787.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean index c2dd596391..42a93dba35 100644 --- a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean +++ b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean @@ -16,7 +16,6 @@ public import LeanPool.GoldbergSeymour.SameColorSeriesPreserved public import LeanPool.GoldbergSeymour.TechnicalTheoremBase public import LeanPool.GoldbergSeymour.TreeInterchangeable public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! # Extension Rules Terminal Stored Disjoint diff --git a/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean b/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean index 04de9fd93a..30672dd724 100644 --- a/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean +++ b/LeanPool/GoldbergSeymour/GoodHierarchySameDividerReconstruction.lean @@ -9,7 +9,6 @@ public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree public import LeanPool.GoldbergSeymour.HierarchyStageMissingColors public import LeanPool.GoldbergSeymour.HierarchyStoredColorsAt public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! # Good Hierarchy Same Divider Reconstruction diff --git a/LeanPool/GoldbergSeymour/GoodHierarchySameDividerTransport.lean b/LeanPool/GoldbergSeymour/GoodHierarchySameDividerTransport.lean index fc58fae917..bf4a889f09 100644 --- a/LeanPool/GoldbergSeymour/GoodHierarchySameDividerTransport.lean +++ b/LeanPool/GoldbergSeymour/GoodHierarchySameDividerTransport.lean @@ -12,7 +12,6 @@ public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts /-! # Good Hierarchy Same Divider Transport diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean index f86cd677ce..ae213b9106 100644 --- a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseSeed.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.HierarchyClaimNineFirstUseAfterSeed public import LeanPool.GoldbergSeymour.HierarchyClaimNineUnusedTailColor public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices @@ -1997,25 +1998,6 @@ private theorem helper_hfixedX_1181.{u_1, u_2} : rw [← hXT.2.2 t, he, hAT.2.2 tA] exact hfixedA tA -private theorem helper_segTrans_1202.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), HierarchyPathNumber - P.counterexample.hierarchy = (1 : ℕ) → - ∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W - → TreeSequenceInitialSegment S W := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hsituation S U W hSU hUW - refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ - · intro j - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) j)).trans (hSU.2.1 j) - · intro j - exact (hUW.2.2 (Fin.castLE hSU.1 j)).trans (hSU.2.2 j) - private theorem helper_coreToA_1217.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -2852,9 +2834,7 @@ private theorem helper_continuation_2492.{u_1, u_2} : have segTrans {S U W : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U) (hUW : TreeSequenceInitialSegment U W) : TreeSequenceInitialSegment S W := by - exact @helper_segTrans_1202 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hsituation) (@S) - (@U) (@W) (@hSU) (@hUW) + exact hSU.trans hUW have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) (H.stage ⟨a + d, by omega⟩) := by diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean index 931cdaa133..63cd02caf3 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceInsideStored.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.SharedFacts.InsideAdvancement @@ -363,47 +364,6 @@ private theorem helper_advance_428.{u_1, u_2} : exact nextMember P2 theta (by rw [hmissing2 _ (vertexMem B jnext)]; exact htheta1) (hterminal2 hgLast) -private theorem helper_trans_785.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - HierarchyPathNumber C.hierarchy = (1 : ℕ) → - ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hsituation i hiLower hiUpper X Y Z hXY hYZ - clear * - hXY hYZ - refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) - -private theorem helper_common_795.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - HierarchyPathNumber C.hierarchy = (1 : ℕ) → - ∀ (i : ℕ), (1 : ℕ) ≤ i → i < HierarchyFullTailLength C - (1 : ℕ) → ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z - → X.length ≤ Y.length → TreeSequenceInitialSegment X Y := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hsituation i hiLower hiUpper trans X Y Z hXZ - hYZ hXY - clear * - hXZ hYZ hXY - refine ⟨hXY, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY) i)).symm.trans (hXZ.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) - private theorem helper_hAT_826.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -683,12 +643,11 @@ theorem HierarchySituationOneAdvanceInsideStored {V E : Type*} omega classical open scoped Sym2 in - have trans := @helper_trans_785 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hsituation) (@i) - (@hiLower) (@hiUpper) - have common := @helper_common_795 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hsituation) (@i) - (@hiLower) (@hiUpper) (@trans) + have trans := @TreeSequenceInitialSegment.trans V E G e0 + have common {X Y Z : TreeSequence G e0} + (hXZ : TreeSequenceInitialSegment X Z) (hYZ : TreeSequenceInitialSegment Y Z) + (hXY : X.length ≤ Y.length) : TreeSequenceInitialSegment X Y := by + exact TreeSequenceInitialSegment.of_common_extension hYZ hXZ hXY have sameLast : ∀ {a b : ℕ} (s : Fin (a + 2) → TreeSequence G e0) (t : Fin (b + 2) → TreeSequence G e0) (u v : TreeSequence G e0), a = b → HEq s t → u = v → Fin.cases (motive := fun _ => TreeSequence G diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean index ae5f1bd2c6..ecd48422ea 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean @@ -4581,609 +4581,6 @@ private theorem helper_terminalStored_3618.{u_1, u_2} : hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK hstage hposition starredEq terminalTree -private theorem helper_stageMissingEq_3631.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - TreeSequenceInitialSegment Tn X → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (U : TreeSequence G e0), - TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → - TreeMissingColors sigma U = TreeMissingColors mu U) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) X) → - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = - Tn → - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma - missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF stageBX - terminalTree j - exact helper_stageMissingEq_1787 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) - (@belowB) - (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) - (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@stageBX) - (@terminalTree) (@j) - -private theorem helper_earlyMissing_3639.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - B.length = T.length - (1 : ℕ) → - X.length = T.length - (2 : ℕ) → - TreeSequenceInitialSegment X B → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length) (beta : Fin k), - alpha ≠ beta → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → - (H.dividerCount ≠ (0 : ℕ) → - A = - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (_ : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (j : Fin (B.length + (1 : ℕ))), - (↑j : ℕ) < B.length → - MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B X hBlength - hXlength hXB r f S hSBlen beta hab sigma missingFixed lastPositive positiveB aboveB strictB - belowB generatingB baseB HB j hj - exact helper_earlyMissing_1796 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) (@alpha) (@hlenT) (@hBlength) (@hXlength) (@hXB) (@S) (@hSBlen) (@beta) (@hab) - (@missingFixed) (@lastPositive) (@positiveB) (@aboveB) (@strictB) (@belowB) - (@generatingB) (@baseB) (@HB) (@j) (@hj) - -private theorem helper_segmentEq_3669.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - (∀ (c : Fin k), - HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c) → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (t : Fin (HB.stage j.succ).length), - sigma ((HB.stage j.succ).edge t) = mu ((HB.stage j.succ).edge t)) → - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (c : Fin k), - HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B r f sigma - positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK - nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq firstEq - stageFixed j c - exact @helper_segmentEq_1835 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@trans) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) - (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) - (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) (@firstEq) - (@stageFixed) (@j) (@c) - -private theorem helper_branch_3726.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - TreeSequenceInitialSegment Tn X → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (U : TreeSequence G e0), - TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → - TreeMissingColors sigma U = TreeMissingColors mu U) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (goodB : GoodHierarchy HB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = - Tn → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) → - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE → - bs.closure = baseB.closure → - (4 : ℕ) ≤ - ((TreeMissingColors mu - ({ rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.tree - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds).castSucc) ∩ - TreeMissingColors mu baseB.closure : - Finset (Fin k)) \ - (HierarchyStoredColorsAt HB (0 : Fin (HB.dividerCount + (1 : ℕ)))).biUnion - (goodB.gamma (0 : Fin (HB.dividerCount + (1 : ℕ))))).card → - (4 : ℕ) ≤ - ((TreeMissingColors sigma - (corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) ∩ - TreeMissingColors sigma bs.closure : - Finset (Fin k)) \ - (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion - (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma - missingTree positiveB aboveB strictB belowB generatingB baseB HB goodB EB closureBX corr bs - baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK - KF terminalTree storedEq hpB hcl hcard - exact helper_branch_1894 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) - (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@closureBX) (@corr) (@bs) - (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) - (@increasingK) (@dividerStageK) (@terminalTree) (@storedEq) (@hpB) (@hcl) (@hcard) - private theorem helper_lastStar_3754.{u_1, u_2} : helperLastStar3754Conditions.{u_1, u_2} := by classical @@ -5255,7 +4652,7 @@ private theorem helper_parallelBase_5019.{u_1, u_2} : ((HierarchyStoredColorsAt KF 0).biUnion (goodB.gamma 0)) rw [← hcore, storedEq 0, minusEq baseB.core coreBX] exact hnot - · exact helper_branch_3726 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + · exact helper_branch_1894 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@closureBX) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) @@ -5589,7 +4986,7 @@ private theorem helper_stageMissingEq_5267.{u_1, u_2} : missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF stageBX terminalTree j - exact helper_stageMissingEq_3631 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact helper_stageMissingEq_1787 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) @@ -5720,7 +5117,7 @@ private theorem helper_segmentEq_5302.{u_1, u_2} : positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq firstEq stageFixed j c - exact @helper_segmentEq_3669 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_segmentEq_1835 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@trans) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) @@ -5932,7 +5329,7 @@ private theorem helper_continuation_6826.{u_1, u_2} : (@terminalTree) (@j) have earlyMissing (j : Fin (B.length + 1)) (hj : j.val < B.length) : MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j) := by - exact helper_earlyMissing_3639 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact helper_earlyMissing_1796 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@hBlength) (@hXlength) (@hXB) (@S) (@hSBlen) (@beta) (@hab) (@missingFixed) (@lastPositive) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@j) (@hj) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean index 494551bb89..18e6a9a947 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaTransport public import LeanPool.GoldbergSeymour.SharedFacts.SecondSituationTransport @@ -2141,10 +2142,7 @@ private theorem helper_continuation_2252.{u_1, u_2} : have treeMissingSubset {U W : TreeSequence G e0} (hUW : TreeSequenceInitialSegment U W) : TreeMissingColors sigma U ⊆ TreeMissingColors sigma W := by - exact @SharedFacts.DisjointThetaTransport.treeMissingSubset (@V) (@E) inferInstance - inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@beta) (@d) (@U) (@W) (@hUW) + exact TreeSequenceInitialSegment.treeMissingColors_subset hUW have hgammaMissingZ : gamma ∈ TreeMissingColors sigma Z := treeMissingSubset hAtoZ hgammaA have hbetaMissingZ : beta ∈ TreeMissingColors sigma Z := diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean index f01cbb186b..e854351e99 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaTransport public import LeanPool.GoldbergSeymour.SharedFacts.SecondSituationTransport @@ -2659,10 +2660,7 @@ private theorem helper_continuation_2578.{u_1, u_2} : have treeMissingSubset {U W : TreeSequence G e0} (hUW : TreeSequenceInitialSegment U W) : TreeMissingColors sigma U ⊆ TreeMissingColors sigma W := by - exact @SharedFacts.DisjointThetaTransport.treeMissingSubset (@V) (@E) inferInstance - inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@beta) (@d) (@U) (@W) (@hUW) + exact TreeSequenceInitialSegment.treeMissingColors_subset hUW have hgammaMissingZ : gamma ∈ TreeMissingColors sigma Z := treeMissingSubset hAtoZ hgammaA have hbetaMissingZ : beta ∈ TreeMissingColors sigma Z := diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean index 0a2c26e15a..12a19bba87 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean @@ -3317,88 +3317,6 @@ private theorem helper_gammaNotTerminal_3372.{u_1, u_2} : mpMinus baseMinus HMinus corrStar baseStar HStar minusLength countMinus goodMinus gammaNe ig vg gammaAt vgTerminal changeOld lastMinus pathBound vgMinus terminalMinus apply helper_gammaNotTerminal_634 <;> assumption -private theorem helper_gammaNotTerminal_3460.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); - let P : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - ∀ (_ : (2 : ℕ) ≤ T.length - A.length) (_ : B.length + (2 : ℕ) = T.length) - (_ : P.length + (1 : ℕ) = T.length) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (_ : MaximumProperty corrMinus.replacementETT) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar) - (_ : R.minus.length = B.length + (1 : ℕ)) - (_ : HMinus.dividerCount = H.dividerCount) (_ : GoodHierarchy HMinus) - (_ : D.gammaOne ≠ D.alpha), - let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; - let vg : V := T.vertex ig; - ∀ (_ : D.gammaOne ∈ MissingColors G phi vg) - (_ : vg ≠ T.vertex D.terminalVertexIndex) - (_ : - let H : TashkinovHierarchy ett base := C.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, by - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); - have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); - have sameComponent : Prop := - TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = - TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ - Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (D.gammaOne ∈ TreeMissingColors phi Tn ∨ - Disjoint - (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - Dn) → - sameComponent) ∧ - (D.gammaOne ∈ TreeMissingColors phi A ∧ - TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → - sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)) - (_ : HierarchyStarredStage HMinus (Fin.last HMinus.dividerCount) = A) - (_ : - ∀ {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} - {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} - (K : TashkinovHierarchy et b), - HierarchyPathNumber K ≤ - U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length) - (_ : vg ∈ TreeSequenceVertexSet R.minus) - (_ : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet R.minus), - D.gammaOne ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL R corrMinus - mpMinus baseMinus HMinus corrStar baseStar HStar minusLength countMinus goodMinus gammaNe - ig vg gammaAt vgTerminal changeOld lastMinus pathBound vgMinus terminalMinus - apply helper_gammaNotTerminal_3372 <;> assumption private theorem helper_continuation_3550.{u_1, u_2} : helperContinuation3550Conditions.{u_1, u_2} := by classical @@ -3617,7 +3535,7 @@ private theorem helper_continuation_3038.{u_1, u_2} : rw [← R.minusTerminalVertex] exact vertexMem R.minus _ have gammaNotTerminal : D.gammaOne ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) := by - apply helper_gammaNotTerminal_3460 <;> assumption + apply helper_gammaNotTerminal_3372 <;> assumption let CS : HierarchyCounterexample baseStar := { positive := by rw [corrStar.rungAgreement]; exact C.positive hierarchy := HStar diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean index b13cebc3a0..f3ea61005f 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean @@ -2887,149 +2887,6 @@ private theorem helper_continuation_3433.{u_1, u_2} : (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hnotA) (@seriesFacts) (@finish) (@gammaReduction) (@hthetaStored) -private theorem helper_hsameTwo_3578.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - (∀ {c : Fin k}, - c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → - c ∉ TreeMissingColors phi A) → - let Bshort : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt H q = - HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt H q, - C.good.gamma q eta = - P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) - eta) → - ∀ beta ∈ TreeMissingColors phi Bshort, - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → - beta ∉ HierarchyStoredColorsAt H q → - (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → - (∀ eta ∈ HierarchyStoredColorsAt H q, - beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → - ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - beta ∈ MissingColors G POne.coloring (T.vertex D.terminalVertexIndex) → - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → POne.coloring (T.edge t) ≠ some beta) → - (POne.counterexample.hierarchy.dividerCount = (0 : ℕ) → - beta ∈ TreeMissingColors POne.coloring A → - beta ∈ - TreeMissingColors POne.coloring - (POne.corresponding.replacementETT.series.data.tree - (Fin.last POne.corresponding.replacementETT.rounds).castSucc) ∨ - beta ∉ - TashkinovStoredColors POne.corresponding.replacementETT.series.data - (Fin.last POne.corresponding.replacementETT.rounds) ∧ - D.theta ∉ - TashkinovStoredColors POne.corresponding.replacementETT.series.data - (Fin.last POne.corresponding.replacementETT.rounds)) → - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → - T.vertex ib ∈ TreeSequenceVertexSet B → - T.vertex ib ≠ T.vertex D.penultimateVertexIndex → - T.vertex ib ≠ T.vertex D.terminalVertexIndex → - TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → - let rho : PartialEdgeColoring E k := POne.coloring; - let ettOne : - ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := - POne.corresponding.replacementETT; - let baseOne' : HierarchyBase POne.corresponding.replacementETT POne.coloring := - POne.replacementBase; - let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; - let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := - COne'.hierarchy; - let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; - TreeMissingColors rho A = TreeMissingColors phi A → - beta ∉ HierarchyStoredColorsAt HOne qOne → - beta ∉ MissingColors G rho (T.vertex D.penultimateVertexIndex) → - beta ∈ MissingColors G rho (T.vertex D.terminalVertexIndex) → - beta ∈ MissingColors G rho (T.vertex ib) → - HierarchyFirstMissingPosition rho T beta = ib → - HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → - (beta ∈ TreeMissingColors phi A → - (0 : ℕ) < HOne.dividerCount ∧ - beta ∈ - TreeMissingColors rho - (HOne.stage - (⟨HOne.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (HOne.dividerCount + (2 : ℕ)))) ∨ - HOne.dividerCount = (0 : ℕ) ∧ - (beta ∈ - TreeMissingColors rho - (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) ∨ - beta ∈ TreeMissingColors rho A ∧ - beta ∉ TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds) ∧ - D.theta ∉ - TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds))) → - beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → - (let H : TashkinovHierarchy ettOne baseOne' := COne'.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (ettOne.rounds + (1 : ℕ)) := Fin.last ettOne.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := ettOne.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors ettOne.series.data n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition rho T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition rho T D.theta); - have sameComponent : Prop := - TwoColorComponent G rho beta D.theta (Sum.inl va) = - TwoColorComponent G rho beta D.theta (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (beta ∈ TreeMissingColors rho Tnq ∨ - Disjoint (insert beta ({ D.theta } : Finset (Fin k)) : Finset (Fin k)) Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (beta ∈ TreeMissingColors rho Tn ∨ - Disjoint (insert beta ({ D.theta } : Finset (Fin k)) : Finset (Fin k)) Dn) → - sameComponent) ∧ - (beta ∈ TreeMissingColors rho A ∧ - TreeColorSetClosed G rho A ({ beta } : Finset (Fin k)) → - sameComponent ∧ TreeInterchangeable G A rho beta D.theta)) → - TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib)) = - TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.penultimateVertexIndex)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast - beta hbetaMissing hbetaUnused hbetaStored houtside hcutoff POne hterm hUnused hzero - hbetaTheta ib hbFirst hibB hby hbt horder rho ettOne baseOne' COne' HOne qOne hmissingA - hbetaStoredOne hgammaPenOne hgammaTermOne hgammaWitnessOne' hfirstGammaOne hfirstThetaOne - hgammaUnusedOne hcaseOne hmissingPairOne hchangeOne - exact @helper_hsameTwo_814 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hnotA) (@sameStar) (@sameLast) (@beta) (@hbetaMissing) (@hbetaUnused) - (@hbetaStored) (@houtside) (@hcutoff) (@POne) (@hterm) (@hUnused) (@hzero) - (@hbetaTheta) (@hbFirst) (@hibB) (@hby) (@hbt) (@horder) (@hmissingA) - (@hbetaStoredOne) (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') - (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) - (@hchangeOne) - private theorem helper_branch_3639.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -3533,7 +3390,7 @@ private theorem helper_finish_3305.{u_1, u_2} : have hsameTwo : TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib)) = TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.penultimateVertexIndex)) := by - exact @helper_hsameTwo_3578 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_hsameTwo_814 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hnotA) (@sameStar) (@sameLast) (@beta) (@hbetaMissing) (@hbetaUnused) (@hbetaStored) (@houtside) (@hcutoff) (@POne) (@hterm) (@hUnused) (@hzero) (@hbetaTheta) (@hbFirst) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean index 4913837cdf..87f617cc71 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean @@ -3689,46 +3689,6 @@ private theorem helper_firstLowerInOld_3203.{u_1, u_2} : HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta firstMissingLe firstMissingMemBelow U hBU eta r hrB hrU apply helper_firstLowerInOld_356 <;> assumption -private theorem helper_hpt_3623.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), - let ell : ℕ := HierarchyFullTailLength C; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (_ : HMinus.dividerCount = C.hierarchy.dividerCount) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) - (_ : HStar.dividerCount = C.hierarchy.dividerCount) - (_ : R.star.length = R.minus.length + (1 : ℕ)) - (hminusStar : TreeSequenceInitialSegment R.minus R.star) - (_ : R.minus.length = B.length + (1 : ℕ)) - (_ : R.star.length = T.length) (beta : Fin k) - (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length), - let iaStar : Fin (R.star.length + (1 : ℕ)) := - Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length); - ∀ (_ : (↑iaStar : ℕ) = R.minus.length) - (_ : HierarchyFirstMissingPosition phi R.star D.alpha = iaStar), - let yp : V := T.vertex D.penultimateVertexIndex; - let yt : V := T.vertex D.terminalVertexIndex; - yp ≠ yt := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen hBT R corrMinus baseMinus - HMinus hminusCount corrStar baseStar HStar hstarCount hstarLen hminusStar hminusLen - hstarLength beta hbetaFirstBound iaStar hiaStar halphaFirstStar yp yt - apply helper_hpt_3177 <;> assumption private theorem helper_horderedUnused_3229.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] @@ -3876,66 +3836,6 @@ private theorem helper_hstarPath_3572.{u_1, u_2} : corrMinus baseMinus HMinus hminusCount corrStar hstarMP baseStar HStar hstarCount hstarLen hminusLen hstarLength beta hbetaFirstBound goodStar hstarStarred pathLeFull apply helper_hstarPath_824 <;> assumption -private theorem helper_halphaStar_3689.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) - (_ : - D.alpha ∉ TreeMissingColors phi B ∧ - D.alpha ∉ Dn ∧ - ∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → - phi (T.edge t) ≠ some D.alpha) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (_ : HMinus.dividerCount = C.hierarchy.dividerCount) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) - (_ : HStar.dividerCount = C.hierarchy.dividerCount) - (hminusStar : TreeSequenceInitialSegment R.minus R.star) - (_ : R.minus.length = B.length + (1 : ℕ)) (beta : Fin k) - (_ : - ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) - (_ : c ∈ MissingColors G phi (S.vertex i)), - HierarchyFirstMissingPosition phi S c ≤ i) - (_ : - ∀ (S : TreeSequence G e0) (c : Fin k) (_ : c ∈ TreeMissingColors phi S), - c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) - (_ : - ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), - S.vertex i ∈ TreeSequenceVertexSet S) - (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) - (_ : TreeSequenceInitialSegment B R.star), - let iaStar : Fin (R.star.length + (1 : ℕ)) := - Fin.castLE (Nat.succ_le_succ hminusStar.1) (Fin.last R.minus.length); - ∀ (_ : (↑iaStar : ℕ) = R.minus.length) - (_ : R.star.vertex iaStar = T.vertex D.terminalVertexIndex) - (_ : D.alpha ∈ TreeMissingColors phi R.star), - HierarchyFirstMissingPosition phi R.star D.alpha = iaStar := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn hBlen hBT halpha R - corrMinus baseMinus HMinus hminusCount corrStar baseStar HStar hstarCount hminusStar - hminusLen beta firstMissingLe firstMissingMem vertexMem hbetaFirstBound hBstar iaStar - hiaStar halphaStarVertex halphaStar - apply helper_halphaStar_2928 <;> assumption private theorem helper_hDnDisjoint_3416.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] @@ -4082,7 +3982,7 @@ private theorem helper_continuation_3768.{u_1, u_2} : have hp := D.terminalVertexPosition omega have hpt : yp ≠ yt := by - exact @helper_hpt_3623 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @helper_hpt_3177 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@hminusCount) (@corrStar) (@baseStar) (@HStar) (@hstarCount) (@hstarLen) (@hminusStar) (@hminusLen) (@hstarLength) (@beta) @@ -4216,7 +4116,7 @@ private theorem helper_continuation_3898.{u_1, u_2} : have halphaStar : D.alpha ∈ TreeMissingColors phi R.star := missingMono hminusStar halphaMinus have halphaFirstStar : HierarchyFirstMissingPosition phi R.star D.alpha = iaStar := by - exact @helper_halphaStar_3689 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_halphaStar_2928 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hBT) (@halpha) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@hminusCount) (@corrStar) (@baseStar) (@HStar) (@hstarCount) (@hminusStar) (@hminusLen) (@beta) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean index 892c87d782..a34878c6a1 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean @@ -3332,87 +3332,6 @@ private theorem helper_branch_3441.{u_1, u_2} : · exact @helper_branch_1685 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@beta) (@hbetaGamma) -private theorem helper_hsame_3634.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → - D.alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) → - let Bshort : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); - ∀ beta ∈ TreeMissingColors phi Bshort, - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → - beta ∉ HierarchyStoredColorsAt H q → - (H.dividerCount = (0 : ℕ) → - beta ∈ TreeMissingColors phi A → - beta ∈ - TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → - (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → - (∀ eta ∈ HierarchyStoredColorsAt H q, - beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → - beta ≠ D.alpha → - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → - T.vertex ib ∈ TreeSequenceVertexSet B → - T.vertex ib ≠ T.vertex D.penultimateVertexIndex → - T.vertex ib ≠ T.vertex D.terminalVertexIndex → - TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → - (beta ∉ TreeMissingColors phi A → - beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → - beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → - (let H : TashkinovHierarchy ett base := C.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); - have sameComponent : Prop := - TwoColorComponent G phi beta D.alpha (Sum.inl va) = - TwoColorComponent G phi beta D.alpha (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (beta ∈ TreeMissingColors phi Tnq ∨ - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (beta ∈ TreeMissingColors phi Tn ∨ - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → - sameComponent) ∧ - (beta ∈ TreeMissingColors phi A ∧ - TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → - sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → - TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = - TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hfirstAlpha halphaNotRaw Bshort - beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib - hbFirst hibB hby hbt horder hrawBeta hmissing hchange - exact @helper_hsame_747 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hfirstAlpha) - (@halphaNotRaw) (@beta) (@hbetaMissing) (@hbetaUnused) (@hbetaStored) (@hzero) - (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) (@hibB) (@hby) (@hbt) - (@horder) (@hrawBeta) (@hmissing) (@hchange) - private theorem helper_hsameTwo_3799.{u_1, u_2} : SharedFacts.SecondSubcaseTransport.hsameTwo964Conditions.{u_1, u_2} := by classical @@ -3434,305 +3353,6 @@ private theorem helper_hsameTwo_3799.{u_1, u_2} : (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hchangeOne) -private theorem helper_branch_3865.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - (2 : ℕ) ≤ T.length - A.length → - B.length + (1 : ℕ) = T.length → - TreeSequenceInitialSegment B T → - (H.dividerCount = (0 : ℕ) → A = base.core) → - TreeSequenceInitialSegment A T → - TreeSequenceInitialSegment A B → - B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → - T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → - ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → - (∀ {c : Fin k}, - c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → - c ∉ TreeMissingColors phi A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix P.counterexample - (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = - B) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - P.corresponding.replacementETT.series.data.tree - (Fin.last P.corresponding.replacementETT.rounds).castSucc = - ett.series.data.tree (Fin.last ett.rounds).castSucc) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt H q = - HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt H q, - C.good.gamma q eta = - P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) - eta) → - (∀ {X Y F : TreeSequence G e0}, - TreeSequenceInitialSegment X F → - TreeSequenceInitialSegment Y F → - X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → - base.core.length ≤ A.length → - (∀ (X : TreeSequence G e0), - TreeSequenceInitialSegment X T → - ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → - (∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) - (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) - (K : TashkinovHierarchy ett' base'), - HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → - K.dividerCount = (0 : ℕ) → - StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) - (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma) → - (∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) - (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) - (K : TashkinovHierarchy ett' base'), - HierarchyWeaklyStable K (Fin.last K.dividerCount) new → - IsOneEdgeUncolored old e0 → - IsOneEdgeUncolored new e0 → - ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), - new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = - old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t)) → - ∀ (beta : Fin k), - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - T.vertex ib ∈ TreeSequenceVertexSet B → - let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); - let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta D.alpha z; - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → - ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - POne.coloring = muOne → - let rho : PartialEdgeColoring E k := POne.coloring; - let ettOne : - ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := - POne.corresponding.replacementETT; - let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; - let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := - COne'.hierarchy; - let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) → - beta ∈ MissingColors G rho (T.vertex ib) → - HierarchyFirstMissingPosition rho T beta = ib → - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → - (beta ∈ TreeMissingColors phi A → - (0 : ℕ) < HOne.dividerCount ∧ - beta ∈ - TreeMissingColors rho - (HOne.stage - (⟨HOne.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (HOne.dividerCount + (2 : ℕ)))) ∨ - HOne.dividerCount = (0 : ℕ) ∧ - beta ∈ - TreeMissingColors rho - (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc)) → - beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → - Disjoint - (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.terminalVertexIndex))) - (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib))) → - let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; - TwoColorPathComponent G rho beta D.theta z → - (∀ w ∈ TreeSequenceVertexSet B, - MissingColors G (TwoColorComponentSwap G rho beta D.theta z) w = - MissingColors G rho w) → - (∀ c ∈ HierarchyStoredColorsAt HOne qOne, - HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c) → - TashkinovAugmentationSequence rho B T → - (∀ c ∈ HierarchyStoredColorsAt HOne qOne, - beta ∈ POne.counterexample.good.gamma qOne c ∨ - D.theta ∈ POne.counterexample.good.gamma qOne c → - (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ B.length) → - beta ∈ TreeMissingColors phi A → - ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), - MaximumProperty corrTwo.replacementETT ∧ - ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : - TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), - SameGoodHierarchy COne'.good goodTwo := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB - hBterminal hyB hElementary hnotA sameStar samePrefix sameTn sameLast commonPrefix - hcoreLength predecessorIncident seedStable weakEdges beta hbetaTheta ib hibB z muOne - hfixedOne POne hPOne rho ettOne COne' HOne qOne hElementaryOne hthetaPenOne - hgammaWitnessOne' hfirstGammaOne hgammaUnusedOne hcaseOne hmissingPairOne hdisjointTwo - muTwo hpathTwo hmissingTwo hstoredTwo hsuffix hgammaCutoff hm - exact @helper_branch_3242 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@htail) (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) - (@hnotA) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) - (@hcoreLength) (@predecessorIncident) (@seedStable) (@weakEdges) (@beta) - (@hbetaTheta) (@hibB) (@hfixedOne) (@POne) (@hPOne) (@hElementaryOne) (@hthetaPenOne) - (@hgammaWitnessOne') (@hfirstGammaOne) (@hgammaUnusedOne) (@hcaseOne) - (@hmissingPairOne) (@hdisjointTwo) (@hpathTwo) (@hmissingTwo) (@hstoredTwo) - (@hsuffix) (@hgammaCutoff) (@hm) - -private theorem helper_branch_3874.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - TreeSequenceInitialSegment A T → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix P.counterexample - (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = - B) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt H q = - HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt H q, - C.good.gamma q eta = - P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) - eta) → - ∀ beta ∉ HierarchyStoredColorsAt H q, - (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → - (∀ (rho : PartialEdgeColoring E k), - ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), - c ∉ TreeMissingColors rho A → - A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ)) → - let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); - ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := POne.coloring; - let ettOne : - ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := - POne.corresponding.replacementETT; - let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - TreeMissingColors rho A = TreeMissingColors phi A → - beta ∈ MissingColors G rho (T.vertex ib) → - HierarchyFirstMissingPosition rho T beta = ib → - HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → - beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → - let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; - beta ∉ TreeMissingColors phi A → - ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), - MaximumProperty corrTwo.replacementETT ∧ - ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : - TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), - SameGoodHierarchy COne'.good goodTwo := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT sameStar samePrefix sameLast - beta hbetaStored houtside hbetaTheta ib horder firstAfter z POne rho ettOne COne' - hElementaryOne hmissingA hgammaWitnessOne' hfirstGammaOne hfirstThetaOne hgammaUnusedOne - hmissingPairOne muTwo hm - exact @helper_branch_1228 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hAT) (@sameStar) (@samePrefix) (@sameLast) (@beta) (@hbetaStored) (@houtside) - (@hbetaTheta) (@horder) (@firstAfter) (@POne) (@hElementaryOne) (@hmissingA) - (@hgammaWitnessOne') (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) - (@hmissingPairOne) (@hm) - -private theorem helper_hsame_4639.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex → - D.alpha ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds) → - let Bshort : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); - ∀ beta ∈ TreeMissingColors phi Bshort, - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → phi (T.edge t) ≠ some beta) → - beta ∉ HierarchyStoredColorsAt H q → - (H.dividerCount = (0 : ℕ) → - beta ∈ TreeMissingColors phi A → - beta ∈ - TreeMissingColors phi (ett.series.data.tree (Fin.last ett.rounds).castSucc)) → - (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → - (∀ eta ∈ HierarchyStoredColorsAt H q, - beta ∈ C.good.gamma q eta → eta = D.theta ∨ eta ∈ TreeMissingColors phi Bshort) → - beta ≠ D.alpha → - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Bshort.length → - T.vertex ib ∈ TreeSequenceVertexSet B → - T.vertex ib ≠ T.vertex D.penultimateVertexIndex → - T.vertex ib ≠ T.vertex D.terminalVertexIndex → - TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → - (beta ∉ TreeMissingColors phi A → - beta ∉ TashkinovStoredColors ett.series.data (Fin.last ett.rounds)) → - beta ∈ TreeMissingColors phi B ∧ D.alpha ∈ TreeMissingColors phi B → - (let H : TashkinovHierarchy ett base := C.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition phi T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); - have sameComponent : Prop := - TwoColorComponent G phi beta D.alpha (Sum.inl va) = - TwoColorComponent G phi beta D.alpha (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (beta ∈ TreeMissingColors phi Tnq ∨ - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (beta ∈ TreeMissingColors phi Tn ∨ - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) → - sameComponent) ∧ - (beta ∈ TreeMissingColors phi A ∧ - TreeColorSetClosed G phi A ({ beta } : Finset (Fin k)) → - sameComponent ∧ TreeInterchangeable G A phi beta D.alpha)) → - TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = - TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hfirstAlpha halphaNotRaw Bshort - beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib - hbFirst hibB hby hbt horder hrawBeta hmissing hchange - exact @helper_hsame_3634 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hfirstAlpha) (@halphaNotRaw) (@beta) (@hbetaMissing) (@hbetaUnused) (@hbetaStored) - (@hzero) (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) (@hibB) (@hby) - (@hbt) (@horder) (@hrawBeta) (@hmissing) (@hchange) - private theorem helper_hsameTwo_4804.{u_1, u_2} : SharedFacts.SecondSubcaseTransport.hsameTwo964Conditions.{u_1, u_2} := by classical @@ -3754,224 +3374,6 @@ private theorem helper_hsameTwo_4804.{u_1, u_2} : (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hchangeOne) -private theorem helper_branch_4870.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - (2 : ℕ) ≤ T.length - A.length → - B.length + (1 : ℕ) = T.length → - TreeSequenceInitialSegment B T → - (H.dividerCount = (0 : ℕ) → A = base.core) → - TreeSequenceInitialSegment A T → - TreeSequenceInitialSegment A B → - B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → - T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → - ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → - (∀ {c : Fin k}, - c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → - c ∉ TreeMissingColors phi A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix P.counterexample - (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = - B) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - P.corresponding.replacementETT.series.data.tree - (Fin.last P.corresponding.replacementETT.rounds).castSucc = - ett.series.data.tree (Fin.last ett.rounds).castSucc) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt H q = - HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt H q, - C.good.gamma q eta = - P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) - eta) → - (∀ {X Y F : TreeSequence G e0}, - TreeSequenceInitialSegment X F → - TreeSequenceInitialSegment Y F → - X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → - base.core.length ≤ A.length → - (∀ (X : TreeSequence G e0), - TreeSequenceInitialSegment X T → - ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → - (∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) - (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) - (K : TashkinovHierarchy ett' base'), - HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → - K.dividerCount = (0 : ℕ) → - StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) - (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma) → - (∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) - (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) - (K : TashkinovHierarchy ett' base'), - HierarchyWeaklyStable K (Fin.last K.dividerCount) new → - IsOneEdgeUncolored old e0 → - IsOneEdgeUncolored new e0 → - ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), - new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = - old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t)) → - ∀ (beta : Fin k), - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - T.vertex ib ∈ TreeSequenceVertexSet B → - let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); - let muOne : PartialEdgeColoring E k := TwoColorComponentSwap G phi beta D.alpha z; - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → muOne (T.edge t) = phi (T.edge t)) → - ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - POne.coloring = muOne → - let rho : PartialEdgeColoring E k := POne.coloring; - let ettOne : - ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := - POne.corresponding.replacementETT; - let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; - let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := - COne'.hierarchy; - let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) → - beta ∈ MissingColors G rho (T.vertex ib) → - HierarchyFirstMissingPosition rho T beta = ib → - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → - (beta ∈ TreeMissingColors phi A → - (0 : ℕ) < HOne.dividerCount ∧ - beta ∈ - TreeMissingColors rho - (HOne.stage - (⟨HOne.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (HOne.dividerCount + (2 : ℕ)))) ∨ - HOne.dividerCount = (0 : ℕ) ∧ - beta ∈ - TreeMissingColors rho - (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc)) → - beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → - Disjoint - (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.terminalVertexIndex))) - (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib))) → - let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; - TwoColorPathComponent G rho beta D.theta z → - (∀ w ∈ TreeSequenceVertexSet B, - MissingColors G (TwoColorComponentSwap G rho beta D.theta z) w = - MissingColors G rho w) → - (∀ c ∈ HierarchyStoredColorsAt HOne qOne, - HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c) → - TashkinovAugmentationSequence rho B T → - (∀ c ∈ HierarchyStoredColorsAt HOne qOne, - beta ∈ POne.counterexample.good.gamma qOne c ∨ - D.theta ∈ POne.counterexample.good.gamma qOne c → - (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ B.length) → - beta ∈ TreeMissingColors phi A → - ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), - MaximumProperty corrTwo.replacementETT ∧ - ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : - TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), - SameGoodHierarchy COne'.good goodTwo := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB - hBterminal hyB hElementary hnotA sameStar samePrefix sameTn sameLast commonPrefix - hcoreLength predecessorIncident seedStable weakEdges beta hbetaTheta ib hibB z muOne - hfixedOne POne hPOne rho ettOne COne' HOne qOne hElementaryOne hthetaPenOne - hgammaWitnessOne' hfirstGammaOne hgammaUnusedOne hcaseOne hmissingPairOne hdisjointTwo - muTwo hpathTwo hmissingTwo hstoredTwo hsuffix hgammaCutoff hm - exact @helper_branch_3865 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@htail) (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) - (@hnotA) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) - (@hcoreLength) (@predecessorIncident) (@seedStable) (@weakEdges) (@beta) - (@hbetaTheta) (@hibB) (@hfixedOne) (@POne) (@hPOne) (@hElementaryOne) (@hthetaPenOne) - (@hgammaWitnessOne') (@hfirstGammaOne) (@hgammaUnusedOne) (@hcaseOne) - (@hmissingPairOne) (@hdisjointTwo) (@hpathTwo) (@hmissingTwo) (@hstoredTwo) - (@hsuffix) (@hgammaCutoff) (@hm) - -private theorem helper_branch_4879.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - TreeSequenceInitialSegment A T → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix P.counterexample - (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = - B) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt H q = - HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt H q, - C.good.gamma q eta = - P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) - eta) → - ∀ beta ∉ HierarchyStoredColorsAt H q, - (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → - (∀ (rho : PartialEdgeColoring E k), - ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), - c ∉ TreeMissingColors rho A → - A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ)) → - let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); - ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := POne.coloring; - let ettOne : - ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := - POne.corresponding.replacementETT; - let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - TreeMissingColors rho A = TreeMissingColors phi A → - beta ∈ MissingColors G rho (T.vertex ib) → - HierarchyFirstMissingPosition rho T beta = ib → - HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → - beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → - let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; - beta ∉ TreeMissingColors phi A → - ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), - MaximumProperty corrTwo.replacementETT ∧ - ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : - TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), - SameGoodHierarchy COne'.good goodTwo := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT sameStar samePrefix sameLast - beta hbetaStored houtside hbetaTheta ib horder firstAfter z POne rho ettOne COne' - hElementaryOne hmissingA hgammaWitnessOne' hfirstGammaOne hfirstThetaOne hgammaUnusedOne - hmissingPairOne muTwo hm - exact @helper_branch_3874 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hAT) (@sameStar) (@samePrefix) (@sameLast) (@beta) (@hbetaStored) (@houtside) - (@hbetaTheta) (@horder) (@firstAfter) (@POne) (@hElementaryOne) (@hmissingA) - (@hgammaWitnessOne') (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) - (@hmissingPairOne) (@hm) - private noncomputable abbrev helperTailTwo6007.{u_1, u_2} : open scoped Classical in {V : Type u_1} → @@ -4327,7 +3729,7 @@ private theorem helper_continuation_5379.{u_1, u_2} : ∃ KTwo : TashkinovHierarchy corrTwo.replacementETT baseTwo, ∃ goodTwo : GoodHierarchy KTwo, SameGoodHierarchy COne'.good goodTwo := by by_cases hm : beta ∈ TreeMissingColors phi A - · exact @helper_branch_4870 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + · exact @helper_branch_3242 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) (@hnotA) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) (@hcoreLength) (@predecessorIncident) @@ -4335,7 +3737,7 @@ private theorem helper_continuation_5379.{u_1, u_2} : (@hElementaryOne) (@hthetaPenOne) (@hgammaWitnessOne') (@hfirstGammaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hdisjointTwo) (@hpathTwo) (@hmissingTwo) (@hstoredTwo) (@hsuffix) (@hgammaCutoff) (@hm) - · exact @helper_branch_4879 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + · exact @helper_branch_1228 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) (@sameStar) (@samePrefix) (@sameLast) (@beta) (@hbetaStored) (@houtside) (@hbetaTheta) (@horder) (@firstAfter) (@POne) (@hElementaryOne) (@hmissingA) (@hgammaWitnessOne') @@ -4455,7 +3857,7 @@ private theorem helper_reduction_4203.{u_1, u_2} : have hsame : TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex ib)) = TwoColorComponent G phi beta D.alpha (Sum.inl (T.vertex D.penultimateVertexIndex)) := by - exact @helper_hsame_4639 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @helper_hsame_747 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hfirstAlpha) (@halphaNotRaw) (@beta) (@hbetaMissing) (@hbetaUnused) (@hbetaStored) (@hzero) (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) (@hibB) (@hby) (@hbt) diff --git a/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean b/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean index bfc7d74299..0387248329 100644 --- a/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean +++ b/LeanPool/GoldbergSeymour/HkuMissingStoredMonotone.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TashkinovSeriesTreeFacts + public import LeanPool.GoldbergSeymour.TashkinovSeries /-! @@ -19,52 +21,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private theorem HkuMissingStoredMonotone_segment_78.{u_1, u_2} : - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series - : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ - → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree - i.succ.succ) := by - classical - intro V E _ _ _ G k rounds e0 input series j i hji - cases series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges - initialKind initialVertex initialOutside initialDelta initialGamma - initialClosure => - exact (Fin.succ_ne_zero i) hji.symm |>.elim - | SE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hji - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | PE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper - secondStableOneUncolored secondStableRelation exitWitness - currentColoring currentProper currentOneUncolored currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hji - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | RE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma adjoined adjoinedExactly closedExtension orderedExtension - strictExtension => - have hvals := congrArg Fin.val hji - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - private theorem HkuMissingStoredMonotone_branch_237.{u_1, u_2} : ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series @@ -217,7 +173,7 @@ theorem HkuMissingStoredMonotone {V E : Type*} [Fintype V] [Fintype E] have segment : ∀ (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree i.succ.succ) := by - exact @HkuMissingStoredMonotone_segment_78 V E inferInstance inferInstance inferInstance G k + exact @TashkinovSeries.stepInitialSegment V E inferInstance inferInstance inferInstance G k rounds e0 input series have missingTransfer {A B : TreeSequence G e0} (hab : ∀ v, v ∈ TreeSequenceVertexSet A → diff --git a/LeanPool/GoldbergSeymour/Imports.lean b/LeanPool/GoldbergSeymour/Imports.lean index bf1dcbea62..9714ec7329 100644 --- a/LeanPool/GoldbergSeymour/Imports.lean +++ b/LeanPool/GoldbergSeymour/Imports.lean @@ -549,7 +549,6 @@ public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparat public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement public import LeanPool.GoldbergSeymour.SharedFacts.ParallelSupportClosureProperties public import LeanPool.GoldbergSeymour.SharedFacts.RevisitingTerminalPreparation -public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveDeletedTreePair public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveNoCross public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveThirdBoundaryEdge public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDeletedMissingReplacementInternal @@ -667,6 +666,7 @@ public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePreservesTas public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceStrictBoundaryWitness public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceTransport public import LeanPool.GoldbergSeymour.TashkinovClosure public import LeanPool.GoldbergSeymour.TashkinovClosureExists public import LeanPool.GoldbergSeymour.TashkinovClosureOfRouteAndAllMissingClosed @@ -686,6 +686,7 @@ public import LeanPool.GoldbergSeymour.TashkinovSeriesPrefix public import LeanPool.GoldbergSeymour.TashkinovSeriesStep public import LeanPool.GoldbergSeymour.TashkinovSeriesStepAppend public import LeanPool.GoldbergSeymour.TashkinovSeriesStepPrefix +public import LeanPool.GoldbergSeymour.TashkinovSeriesTreeFacts public import LeanPool.GoldbergSeymour.TashkinovStoredColors public import LeanPool.GoldbergSeymour.TashkinovStoredColorsAppend public import LeanPool.GoldbergSeymour.TashkinovStoredColorsCardinality @@ -740,6 +741,7 @@ public import LeanPool.GoldbergSeymour.TreeMissingColorsCardLowerBound public import LeanPool.GoldbergSeymour.TreeSequence public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeUnique +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeVertexSet public import LeanPool.GoldbergSeymour.TreeSequenceBoundaryEdgeAppendExists public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts public import LeanPool.GoldbergSeymour.TreeSequenceEdgeSet @@ -753,10 +755,12 @@ public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import LeanPool.GoldbergSeymour.TreeUsedColors public import LeanPool.GoldbergSeymour.TreeVertexOrder public import LeanPool.GoldbergSeymour.TreeVerticesBefore +public import LeanPool.GoldbergSeymour.TreeVerticesBeforeFacts public import LeanPool.GoldbergSeymour.TrunkRotation public import LeanPool.GoldbergSeymour.TwoColorComponent public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts public import LeanPool.GoldbergSeymour.TwoColorComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorComponentLeafPaths public import LeanPool.GoldbergSeymour.TwoColorComponentNearestSegment public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath public import LeanPool.GoldbergSeymour.TwoColorComponentSwap @@ -772,6 +776,7 @@ public import LeanPool.GoldbergSeymour.TwoColorCycle public import LeanPool.GoldbergSeymour.TwoColorIncidenceDegreeAtMostTwo public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph public import LeanPool.GoldbergSeymour.TwoColorInterchangeableDistinctComponentCycle +public import LeanPool.GoldbergSeymour.TwoColorMissingVertexNeighbors public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent public import LeanPool.GoldbergSeymour.TwoColorPathComponent public import LeanPool.GoldbergSeymour.TwoColorPathComponentNotCycle diff --git a/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean b/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean index b7abbf89d9..0c2749033b 100644 --- a/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean +++ b/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean @@ -1291,51 +1291,6 @@ private theorem helper_hfull_1473.{u_1, u_2} : hclosureX HX goodX hsigmaProper hsigmaOne hstableX n Tn Dn hstableTn hmod hroute hNT hNstrict corrPrefix basePrefix KPrefix goodPrefix samePrefix hkindX apply helper_hfull_1262 <;> assumption -private theorem helper_hfull_1535.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (sigma : PartialEdgeColoring E k) (_ : P2880_T1_SplitSwapData G k e0 input T phi ett base - C ctx P alpha beta sigma), - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : - ℕ)); - let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := - P.corresponding.replacementETT; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : - HierarchyBase ettX P.coloring) (_ : baseX.closure = P.replacementBase.closure) (HX : - TashkinovHierarchy ettX baseX) (goodX : GoodHierarchy HX) (_ : IsProperEdgeColoring G - sigma) (_ : IsOneEdgeUncolored sigma e0) (_ : StableColoring X (TashkinovStoredColors - ettX.series.data (Fin.last ettX.rounds)) P.coloring sigma), - let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; - let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors m.series.data n; - ∀ (_ : StableColoring Tn Dn P.coloring sigma) (_ : ModColoring m sigma) (_ : - m.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence - sigma Tn T ∨ (m.series.data.kind n = some TashkinovExtensionKind.SE ∨ m.series.data.kind n - = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), m.series.data.connectingEdges n = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T) (_ : - TreeSequenceInitialSegment Tn T) (_ : Tn.length < T.length) (corrPrefix : - CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : HierarchyBase - corrPrefix.replacementETT sigma) (KPrefix : TashkinovHierarchy corrPrefix.replacementETT - basePrefix) (goodPrefix : GoodHierarchy KPrefix) (_ : SameGoodHierarchy goodX goodPrefix) - (_ : ettX.series.data.kind (Fin.last ettX.rounds) = m.series.data.kind n), - ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), MaximumProperty - corr.replacementETT ∧ - ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy - corr.replacementETT newBase), newBase.closure = basePrefix.closure ∧ SameHierarchyStages H - K := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m H ettX baseX - hclosureX HX goodX hsigmaProper hsigmaOne hstableX n Tn Dn hstableTn hmod hroute hNT - hNstrict corrPrefix basePrefix KPrefix goodPrefix samePrefix hkindX - apply helper_hfull_1473 <;> assumption private theorem helper_continuation_1640.{u_1, u_2} : helperContinuation1640Conditions.{u_1, u_2} := by classical @@ -1491,7 +1446,7 @@ private theorem helper_continuation_1844.{u_1, u_2} : ∃ newBase : HierarchyBase corr.replacementETT sigma, ∃ K : TashkinovHierarchy corr.replacementETT newBase, newBase.closure = basePrefix.closure ∧ SameHierarchyStages H K := by - apply helper_hfull_1535 <;> assumption + apply helper_hfull_1473 <;> assumption rcases hfull with ⟨corrFull, hmaximumFull, baseFull, KFull, hclosure, hsameFull⟩ have hcoreFull : baseFull.core = basePrefix.core := by have hprefixCore := samePrefix.1.1 diff --git a/LeanPool/GoldbergSeymour/ParallelTwoConstituentPathContradiction.lean b/LeanPool/GoldbergSeymour/ParallelTwoConstituentPathContradiction.lean index 7f0233d700..50110d7ac7 100644 --- a/LeanPool/GoldbergSeymour/ParallelTwoConstituentPathContradiction.lean +++ b/LeanPool/GoldbergSeymour/ParallelTwoConstituentPathContradiction.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TwoColorMissingVertexNeighbors + public import LeanPool.GoldbergSeymour.ColoredVertexSetClosed public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary @@ -27,69 +29,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private theorem ParallelTwoConstituentPathContradiction_missing_leaf_163.{u_1, u_2} : - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : - ℕ) (e0 : E) (sigma : PartialEdgeColoring E k) (right : TreeSequence G e0), - IsProperEdgeColoring G sigma → ColoredVertexSetClosed G sigma (TreeSequenceVertexSet - right) → ∀ (alpha beta : Fin k), let H := TwoColorIncidenceGraph G sigma alpha beta; ∀ (x - : V), alpha ∈ MissingColors G sigma x ∨ beta ∈ MissingColors G sigma x → (H.neighborSet - (Sum.inl x)).Subsingleton := by - classical - intro V E _ _ G k e0 sigma right hproper _ alpha beta H x hmissing z hz w hw - cases hzv : z with - | inl y => - rw [hzv] at hz - simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz - | inr e => - cases hwv : w with - | inl y => - rw [hwv] at hw - simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw - | inr f => - rw [hzv] at hz - rw [hwv] at hw - have he : Incident G x e ∧ - (sigma e = some alpha ∨ sigma e = some beta) := by - simpa [H, SimpleGraph.mem_neighborSet, - TwoColorIncidenceGraph] using hz - have hf : Incident G x f ∧ - (sigma f = some alpha ∨ sigma f = some beta) := by - simpa [H, SimpleGraph.mem_neighborSet, - TwoColorIncidenceGraph] using hw - apply congrArg Sum.inr - by_contra hef - rcases hmissing with ha | hb - · have hna : alpha ∉ PresentColors G sigma x := by - simpa [MissingColors] using ha - have heBeta : sigma e = some beta := he.2.resolve_left (by - intro heAlpha - apply hna - simpa [PresentColors] using - (show ∃ q, Incident G x q ∧ sigma q = some alpha from - ⟨e, he.1, heAlpha⟩)) - have hfBeta : sigma f = some beta := hf.2.resolve_left (by - intro hfAlpha - apply hna - simpa [PresentColors] using - (show ∃ q, Incident G x q ∧ sigma q = some alpha from - ⟨f, hf.1, hfAlpha⟩)) - exact (hproper hef ⟨x, he.1, hf.1⟩ heBeta) hfBeta - · have hnb : beta ∉ PresentColors G sigma x := by - simpa [MissingColors] using hb - have heAlpha : sigma e = some alpha := he.2.resolve_right (by - intro heBeta - apply hnb - simpa [PresentColors] using - (show ∃ q, Incident G x q ∧ sigma q = some beta from - ⟨e, he.1, heBeta⟩)) - have hfAlpha : sigma f = some alpha := hf.2.resolve_right (by - intro hfBeta - apply hnb - simpa [PresentColors] using - (show ∃ q, Incident G x q ∧ sigma q = some beta from - ⟨f, hf.1, hfBeta⟩)) - exact (hproper hef ⟨x, he.1, hf.1⟩ heAlpha) hfAlpha - private theorem ParallelTwoConstituentPathContradiction_continuation_235.{u_1, u_2} : ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (sigma : PartialEdgeColoring E k) (left right : TreeSequence G e0), @@ -349,8 +288,7 @@ theorem ParallelTwoConstituentPathContradiction {V E : Type*} (hmissing : alpha ∈ MissingColors G sigma x ∨ beta ∈ MissingColors G sigma x) : Set.Subsingleton (H.neighborSet (Sum.inl x)) := by - exact @ParallelTwoConstituentPathContradiction_missing_leaf_163 V E inferInstance - inferInstance G k e0 sigma right hproper (by assumption) alpha beta x hmissing + exact TwoColorMissingVertexNeighborsSubsingleton G sigma hproper alpha beta x hmissing exact @ParallelTwoConstituentPathContradiction_continuation_235 V E inferInstance inferInstance G k e0 sigma left right hproper hleftElementary hrightElementary (by assumption) support common hcommonLeft hcommonRight alpha u v huLeft diff --git a/LeanPool/GoldbergSeymour/SameColorSeriesPreserved.lean b/LeanPool/GoldbergSeymour/SameColorSeriesPreserved.lean index e24779924d..7f0bd1bc71 100644 --- a/LeanPool/GoldbergSeymour/SameColorSeriesPreserved.lean +++ b/LeanPool/GoldbergSeymour/SameColorSeriesPreserved.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.HkuIncidentColorPreserved public import LeanPool.GoldbergSeymour.InternalEdges @@ -21,52 +22,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private theorem SameColorSeriesPreserved_segment_52.{u_1, u_2} : - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series - : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ - → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree - i.succ.succ) := by - classical - intro V E _ _ _ G k rounds e0 input series j i hji - cases series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges - initialKind initialVertex initialOutside initialDelta initialGamma - initialClosure => - exact (Fin.succ_ne_zero i) hji.symm |>.elim - | SE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hji - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | PE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper - secondStableOneUncolored secondStableRelation exitWitness - currentColoring currentProper currentOneUncolored currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hji - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | RE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma adjoined adjoinedExactly closedExtension orderedExtension - strictExtension => - have hvals := congrArg Fin.val hji - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - private theorem SameColorSeriesPreserved_intervalClaim_110.{u_1, u_2} : ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series @@ -303,7 +258,7 @@ theorem SameColorSeriesPreserved {V E : Type*} have segment : ∀ (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree i.succ.succ) := by - exact @SameColorSeriesPreserved_segment_52 V E inferInstance inferInstance inferInstance G k + exact @TashkinovSeries.stepInitialSegment V E inferInstance inferInstance inferInstance G k rounds e0 input series have vertexTransfer {A B : TreeSequence G e0} (hab : TreeSequenceInitialSegment A B) {v : V} diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean index 23e32bef5a..a4d5757788 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveDeletedTreePair.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveDeletedTreePair +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeVertexSet public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData @@ -538,7 +538,7 @@ private theorem helper_continuation_619.{u_1, u_2} : (hyA : y ∉ TreeSequenceVertexSet A) (hAB : TreeSequenceAdjoinEdge A f B) : TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by - exact @SharedFacts.ScheideDefectiveDeletedTreePair.adjoin_vertex_set V E inferInstance G + exact @TreeSequenceAdjoinEdge.vertexSet_eq_insert V E inferInstance G e0 A B f x y hxy hyA hAB have hv0Gamma : D.v0 d ∈ TreeSequenceVertexSet Tgamma := by obtain ⟨a, _, ha⟩ := Finset.mem_image.mp diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean index 580b239b64..ecf5f5d603 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveNoCross.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeVertexSet + public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveNoCross public import LeanPool.GoldbergSeymour.ScheideDefectiveCrossingSelection @@ -138,55 +140,6 @@ private theorem helper_htreeS_255.{u_1, u_2} : rw [← C.base_vertex_position b] simp [X, TreeSequenceVertexSet]) (C.gamma r) hrgamma hrdelta).mpr hbmissing -private theorem helper_adjoin_vertex_set_343.{u_1, u_2} : - open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : - LooplessMultigraph V E) (e0 : E) (A B : TreeSequence G e0) (f : E) (x y : V), G.ends f = - s(x, y) → y ∉ TreeSequenceVertexSet A → TreeSequenceAdjoinEdge A f B → - TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by - classical - intro V E _ G e0 A B f x y hxy hyA hAB - rcases hAB with ⟨hlen, hinit, hlast⟩ - rcases hinit with ⟨hle, hvertices, hedges⟩ - have holdSubset : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by - intro v hv - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hv ⊢ - obtain ⟨q, hq⟩ := hv - refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ - rw [hvertices] - exact hq - have hyB : y ∈ TreeSequenceVertexSet B := by - let j : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) - obtain ⟨a, ha⟩ := B.attaches j - have hyEnds : y ∈ G.ends (B.edge j) := by - rw [hlast, hxy] - simp - rw [ha] at hyEnds - rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold - · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - exact ⟨j.succ, hynew.symm⟩ - · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - exact ⟨Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt)), - hyold.symm⟩ - have hinsert : insert y (TreeSequenceVertexSet A) ⊆ TreeSequenceVertexSet B := by - intro v hv - simp only [Finset.mem_insert] at hv - rcases hv with rfl | hv - · exact hyB - · exact holdSubset hv - have hAcard : (TreeSequenceVertexSet A).card = A.length + 1 := by - simp [TreeSequenceVertexSet, Finset.card_image_of_injective, - A.vertex_injective] - have hBcard : (TreeSequenceVertexSet B).card = B.length + 1 := by - simp [TreeSequenceVertexSet, Finset.card_image_of_injective, - B.vertex_injective] - have hcard : (TreeSequenceVertexSet B).card ≤ - (insert y (TreeSequenceVertexSet A)).card := by - rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] - exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm - private theorem helper_component_vertex_of_edge_285.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : @@ -701,7 +654,7 @@ theorem ScheideDefectiveNoCross {V E : Type*} (hyA : y ∉ TreeSequenceVertexSet A) (hAB : TreeSequenceAdjoinEdge A f B) : TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by - exact @helper_adjoin_vertex_set_343 V E inferInstance G e0 A B f x y hxy hyA hAB + exact @TreeSequenceAdjoinEdge.vertexSet_eq_insert V E inferInstance G e0 A B f x y hxy hyA hAB have hSverticesZ : TreeSequenceVertexSet S = Z := by simpa [Z, X, U, i] using hSvertices have hv0S : D.v0 d ∈ TreeSequenceVertexSet S := by diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean index 817ddf4286..77026dc597 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveReturnContradiction.lean @@ -7,6 +7,7 @@ module + public import LeanPool.GoldbergSeymour.ScheideDefectiveReturnData public import LeanPool.GoldbergSeymour.ScheideDefectiveThirdBoundaryEdge public import LeanPool.GoldbergSeymour.ScheideGlobalMaximumMissingCounts @@ -895,7 +896,7 @@ private theorem helper_continuation_291.{u_1, u_2} : (hyA : y ∉ TreeSequenceVertexSet A) (hAB : TreeSequenceAdjoinEdge A f B) : TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by - exact @SharedFacts.ScheideDefectiveDeletedTreePair.adjoin_vertex_set V E inferInstance G + exact @TreeSequenceAdjoinEdge.vertexSet_eq_insert V E inferInstance G e0 A B f x y hxy hyA hAB have hz2Sgamma : z2 ∈ TreeSequenceVertexSet Sgamma := by rw [hSgammaVertices] diff --git a/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean b/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean index 8c21f4b877..0661803bed 100644 --- a/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean +++ b/LeanPool/GoldbergSeymour/ScheideDefectiveThirdBoundaryEdge.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveThirdBoundaryEdge public import LeanPool.GoldbergSeymour.OutsideTreeColorSwap @@ -94,57 +95,6 @@ private abbrev helperContinuation1024Conditions.{u_1, u_2} : Prop := (OutsideTreeColorSwap T phi (C.gamma (D.gammaIndex d)) (C.gamma R.blockIndex)) (C.gamma R.blockIndex) (↑d : Fin k) (Sum.inl R.v1) f2 = some (↑d : Fin k) ∧ u2 ≠ D.u0 d ∧ u2 ≠ R.u1 -private theorem helper_adjoin_vertex_set_647.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) (e0 : E) (A0 A1 : - TreeSequence G e0) (f : E) (x y : V), G.ends f = s(x, y) → y ∉ TreeSequenceVertexSet A0 → - TreeSequenceAdjoinEdge A0 f A1 → TreeSequenceVertexSet A1 = insert y - (TreeSequenceVertexSet A0) := by - classical - intro V E _ G e0 A0 A1 f x y hxy hyA hAA - rcases hAA with ⟨hlen, hinit, hlast⟩ - rcases hinit with ⟨hle, hvertices, hedges⟩ - have holdSubset : TreeSequenceVertexSet A0 ⊆ TreeSequenceVertexSet A1 := by - intro v hv - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hv ⊢ - obtain ⟨q, hq⟩ := hv - refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ - rw [hvertices] - exact hq - have hyB : y ∈ TreeSequenceVertexSet A1 := by - let q : Fin A1.length := Fin.cast hlen.symm (Fin.last A0.length) - obtain ⟨a, ha⟩ := A1.attaches q - have hyEnds : y ∈ G.ends (A1.edge q) := by - rw [hlast, hxy] - simp - rw [ha] at hyEnds - rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold - · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - exact ⟨q.succ, hynew.symm⟩ - · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - exact ⟨Fin.castLT a (Nat.lt_trans a.isLt - (Nat.succ_lt_succ q.isLt)), hyold.symm⟩ - have hinsert : insert y (TreeSequenceVertexSet A0) ⊆ - TreeSequenceVertexSet A1 := by - intro v hv - simp only [Finset.mem_insert] at hv - rcases hv with rfl | hv - · exact hyB - · exact holdSubset hv - have hAcard : (TreeSequenceVertexSet A0).card = A0.length + 1 := by - simp [TreeSequenceVertexSet, Finset.card_image_of_injective, - A0.vertex_injective] - have hBcard : (TreeSequenceVertexSet A1).card = A1.length + 1 := by - simp [TreeSequenceVertexSet, Finset.card_image_of_injective, - A1.vertex_injective] - have hcard : (TreeSequenceVertexSet A1).card ≤ - (insert y (TreeSequenceVertexSet A0)).card := by - rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] - exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm - private theorem helper_hfinalVertices_391.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -818,7 +768,7 @@ private theorem helper_continuation_1024.{u_1, u_2} : (hyA : y ∉ TreeSequenceVertexSet A0) (hAA : TreeSequenceAdjoinEdge A0 f A1) : TreeSequenceVertexSet A1 = insert y (TreeSequenceVertexSet A0) := by - exact @helper_adjoin_vertex_set_647 V E inferInstance G e0 A0 A1 f x y hxy hyA hAA + exact @TreeSequenceAdjoinEdge.vertexSet_eq_insert V E inferInstance G e0 A0 A1 f x y hxy hyA hAA have hu2Uj := @helper_hu2Uj_695 V E inferInstance inferInstance inferInstance inferInstance G k e0 phi T C D d R horder block_mem_X base_mem_Z hj01 hblocksSub hv1Z f2 z2 hz2Z u2 hu2Z hf2ends hz2X hu2u0 hu2u1 hproperJ1 hstableJ1 hfixedJ1 hproperJ2 honeJ2 hdeltaMissingJ2 hf0colorJ2 diff --git a/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaTransport.lean index 0f89485970..06978d748c 100644 --- a/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaTransport.lean +++ b/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaTransport.lean @@ -173,20 +173,6 @@ abbrev hthetaYStatement.{u_1, u_2} : Prop := TreeSequenceVertexSet W → c ∈ MissingColors G rho v → c ∈ TreeMissingColors rho W) → d.theta ∈ TreeMissingColors sigma Y -/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ -abbrev treeMissingSubsetStatement.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeMissingColors sigma U ⊆ - TreeMissingColors sigma W /-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ abbrev apositiveStatement.{u_1, u_2} : Prop := @@ -782,15 +768,6 @@ theorem hthetaY.{u_1, u_2} : hthetaYStatement.{u_1, u_2} := by exact treeMissingIntro sigma Y (Y.vertex (Fin.last Y.length)) d.theta (vertexMemSelf Y (Fin.last Y.length)) hthetaMissingY -/-- A common proof used by the branches of this transport or construction argument. -/ -theorem treeMissingSubset.{u_1, u_2} : treeMissingSubsetStatement.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma U W hUW - as_aux_lemma => - intro c hc - obtain ⟨v, hv, hmiss⟩ := Finset.mem_biUnion.mp hc - exact Finset.mem_biUnion.mpr ⟨v, - TreeSequenceInitialSegmentVertexSetSubset hUW hv, hmiss⟩ /-- A common proof used by the branches of this transport or construction argument. -/ theorem apositive.{u_1, u_2} : apositiveStatement.{u_1, u_2} := by diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranchPreparation.lean b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranchPreparation.lean index a39368219a..9a0160e52e 100644 --- a/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranchPreparation.lean +++ b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranchPreparation.lean @@ -5,10 +5,9 @@ Authors: Wesley Pegden -/ module -import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary -public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeVerticesBefore /-! # Shared facts for ExtensionBaseBranchPreparation @@ -22,89 +21,8 @@ Extracted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour.SharedFacts.ExtensionBranchPreparation -/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ -abbrev hbeforePrimeNeUStatement.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) - → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc) → - ∀ (TjPrime : TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 - gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree - jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet - TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (_ : Fin - (TjPrime.length + (1 : ℕ))) {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0 -/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ -abbrev hbeforePrimeMissingStatement.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : - PartialEdgeColoring E k), - let this : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (TjPrime : TreeSequence G e0) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet TjPrime) (z0 : - V) (hz0 : z0 ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) (rho3 : - PartialEdgeColoring E k), ( - ∀ y ∈ ((TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z0 hz0 ∪ ({ z0 } : - Finset V) ∪ (TreeVerticesBefore TjPrime u0 huPrime0 ∪ ({ u0 } : Finset V))).erase - u0).erase z0, MissingColors G rho3 y = MissingColors G rho1 y) → (z0 ∈ TreeVerticesBefore - TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 z0) → ( - ∀ {y : V}, y ∈ TreeVerticesBefore TjPrime u0 huPrime0 → y ≠ u0) → - ∀ y ∈ TreeVerticesBefore TjPrime u0 huPrime0, MissingColors G rho3 y = MissingColors G rho1 y -/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ -abbrev transportURouteStatement.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (v : V) (sigma : PartialEdgeColoring E k) (hvFinal : v ∈ - TreeSequenceVertexSet T) (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (TjPrime : TreeSequence G e0) (rho3 : PartialEdgeColoring E k) (uPosition : Fin - (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; ( - ∀ {A B : TreeSequence G e0}, TashkinovAugmentation rho1 A B → TreeSequenceInitialSegment B U → - TashkinovAugmentation rho3 A B) → - ∀ (S : TreeSequence G e0), TashkinovAugmentationSequence rho1 S U → - TashkinovAugmentationSequence rho3 S U /-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ abbrev huUStatement.{u_1, u_2} : Prop := @@ -118,47 +36,8 @@ abbrev huUStatement.{u_1, u_2} : Prop := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; u0 ∈ TreeSequenceVertexSet U -/-- A common proof used by the branches of this transport or construction argument. -/ -theorem hbeforePrimeNeU.{u_1, u_2} : hbeforePrimeNeUStatement.{u_1, u_2} := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition y hy - unfold TreeVerticesBefore at hy - obtain ⟨-, i, j, hiy, hju, hij⟩ := Finset.mem_filter.mp hy - intro hyu - have hijEq : i = j := TjPrime.vertex_injective - (hiy.trans (hyu.trans hju.symm)) - omega -/-- A common proof used by the branches of this transport or construction argument. -/ -theorem hbeforePrimeMissing.{u_1, u_2} : hbeforePrimeMissingStatement.{u_1, u_2} := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal - hfirstUpper hfirstPositive jSlot trace rho1 TjPrime u0 huPrime0 z0 hz0 rho3 hd2Missing hd2z - hbeforePrimeNeU y hy - by_cases hyz : y = z0 - · subst y - exact hd2z hy - · apply hd2Missing y - apply Finset.mem_erase.mpr - refine ⟨hyz, Finset.mem_erase.mpr ⟨hbeforePrimeNeU hy, ?_⟩⟩ - exact Finset.mem_union_right _ (Finset.mem_union_left _ hy) -/-- A common proof used by the branches of this transport or construction argument. -/ -theorem transportURoute.{u_1, u_2} : transportURouteStatement.{u_1, u_2} := by - classical - intro V E _ _ _ G k e0 input T generating ett v sigma hvFinal trace rho1 TjPrime rho3 uPosition - huPositionPositive huPositionBound U transportUStep S hroute - unfold TashkinovAugmentationSequence at hroute ⊢ - induction hroute using Relation.ReflTransGen.head_induction_on with - | refl => exact Relation.ReflTransGen.refl - | @head A B hAB hBU ih => - have hBsegment : TreeSequenceInitialSegment B U := - TashkinovAugmentationSequenceInitialSegment rho1 B U hBU - exact Relation.ReflTransGen.head - (transportUStep hAB hBsegment) ih /-- A common proof used by the branches of this transport or construction argument. -/ theorem huU.{u_1, u_2} : huUStatement.{u_1, u_2} := by diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranches.lean b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranches.lean index 90ed2f9137..120175a478 100644 --- a/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranches.lean +++ b/LeanPool/GoldbergSeymour/SharedFacts/ExtensionBranches.lean @@ -7,10 +7,9 @@ module public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.ExtensionBaseRestorationTrace public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequencePrefix -public import LeanPool.GoldbergSeymour.TreeVerticesBefore +public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex /-! # Shared facts for ExtensionBaseAuxiliary @@ -187,48 +186,6 @@ abbrev branch3129Statement.{u_1, u_2} : Prop := TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ TashkinovAugmentationSequence (ett.series.data.coloring i.succ) adjoinSeed seed -/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ -abbrev usegmentVertexBeforeStatement.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) (hfirstPositive - : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), - by omega - ⟩ : Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) - → Fin ett.rounds) (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) - (↑terminalPosition : ℕ) hterminalPositionPositive hterminalPositionBound; - ∀ (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) (TjPrime : - TreeSequence G e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) (_ : (TwoColorIncidenceGraph G rho1 - gamma delta).Walk (Sum.inl x) (Sum.inl u)) (_ : Fin ((ett.series.data.tree - jSlot.succ.castSucc).length + (1 : ℕ))) (u0 : V) (huPrime0 : u0 ∈ TreeSequenceVertexSet - TjPrime) (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) (uPosition : Fin - (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; - ∀ (_ : TreeSequenceInitialSegment U TjPrime) (_ : ( - ∀ (i : Fin (TjPrime.length + (1 : ℕ))) (_ : (↑i : ℕ) < (↑uPosition : ℕ)), TjPrime.vertex i ∈ - TreeVerticesBefore TjPrime u0 huPrime0)) {A : TreeSequence G e0} (_ : - TreeSequenceInitialSegment A U) (_ : A.length < U.length) {y : V} (_ : y ∈ - TreeSequenceVertexSet A), y ∈ TreeVerticesBefore TjPrime u0 huPrime0 /-- A common proof used by the branches of this transport or construction argument. -/ theorem branch.{u_1, u_2} : branchStatement.{u_1, u_2} := by @@ -440,29 +397,6 @@ theorem branch3129.{u_1, u_2} : branch3129Statement.{u_1, u_2} := by (ett.series.data.tree jSlot.succ.castSucc) hroute hadjoinedSeed hseedTj) -/-- A common proof used by the branches of this transport or construction argument. -/ -theorem usegmentVertexBefore.{u_1, u_2} : usegmentVertexBeforeStatement.{u_1, u_2} := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hseedTj TjPrime H x - componentPath u exitPath zPosition u0 huPrime0 exitPath0 zPosition0 uPosition - huPositionPositive huPositionBound U hUPrime hprimeVertexBefore A hAU hAlen y hyA - obtain ⟨hAULen, hAUVertices, -⟩ := hAU - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hyA - obtain ⟨i, rfl⟩ := hyA - let iU : Fin (U.length + 1) := - Fin.castLE (Nat.succ_le_succ hAULen) i - let iPrime : Fin (TjPrime.length + 1) := - Fin.castLE (Nat.succ_le_succ hUPrime.1) iU - have hiPrime : iPrime.val < uPosition.val := by - change i.val < uPosition.val - have hUlen : U.length = uPosition.val := by - simp [U, TreeSequencePrefix] - omega - rw [← hAUVertices i, ← hUPrime.2.1 iU] - exact hprimeVertexBefore iPrime hiPrime end GoldbergSeymour.SharedFacts.ExtensionBranches diff --git a/LeanPool/GoldbergSeymour/SharedFacts/UnsupportedVertexColors.lean b/LeanPool/GoldbergSeymour/SharedFacts/UnsupportedVertexColors.lean index 3dad552b5b..334fc7177f 100644 --- a/LeanPool/GoldbergSeymour/SharedFacts/UnsupportedVertexColors.lean +++ b/LeanPool/GoldbergSeymour/SharedFacts/UnsupportedVertexColors.lean @@ -5,7 +5,7 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TashkinovSeries +public import LeanPool.GoldbergSeymour.TashkinovSeriesTreeFacts /-! # Shared facts for HkuUnsupportedVertexColors @@ -29,45 +29,9 @@ abbrev nextSegmentStatement.{u_1, u_2} : Prop := /-- A common proof used by the branches of this transport or construction argument. -/ theorem next_segment.{u_1, u_2} : nextSegmentStatement.{u_1, u_2} := by - classical intro V E _ _ _ G k rounds e0 input series j i hj - cases series.certified j with - | initial triple seedLength initialColoring initialStored initialEdges - initialKind initialVertex initialOutside initialDelta initialGamma - initialClosure => - exact (Fin.succ_ne_zero i) hj.symm |>.elim - | SE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternative - currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly - closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hj - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | RE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed available currentColoring currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma adjoined adjoinedExactly closedExtension orderedExtension - strictExtension => - have hvals := congrArg Fin.val hj - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension - | PE ci previousProper previousOneUncolored previousClosed - previousNotStronglyClosed noRevisiting choice seriesAlternativeFails - gamma gammaRule secondStable secondStableProper - secondStableOneUncolored secondStableRelation exitWitness - currentColoring currentProper currentOneUncolored currentStored - currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma closedExtension orderedExtension strictExtension => - have hvals := congrArg Fin.val hj - simp at hvals - have hieq : ci = i := by apply Fin.ext; omega - subst ci - exact orderedExtension + exact TashkinovSeries.stepInitialSegment G k rounds e0 input series j i hj + end GoldbergSeymour.SharedFacts.UnsupportedVertexColors diff --git a/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean b/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean index d88509b62a..24f27d3d37 100644 --- a/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean +++ b/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean @@ -1039,28 +1039,6 @@ private theorem helper_hZeq_1049.{u_1, u_2} : intro V E _ _ _ _ G k e0 input T phi ett base C ctx P htailP hprefixP Z rw [htailP, hprefixP] -private theorem helper_hX_Z_1054.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (_ : (2 : ℕ) ≤ - HierarchyPathNumber C.hierarchy) (_ : HierarchyPathNumber C.hierarchy < - HierarchyFullTailLength C), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - ∀ (_ : ( - ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : - TreeSequenceInitialSegment U W) (_ : S.length ≤ U.length), TreeSequenceInitialSegment S - U)) (_ : TreeSequenceInitialSegment X T), - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - ∀ (_ : TreeSequenceInitialSegment Z T), TreeSequenceInitialSegment X Z := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper j X commonPrefix - hX_T Z hZ_T - apply helper_hX_Z_634 <;> assumption private theorem helper_hZElementary_1056.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1136,78 +1114,6 @@ private theorem helper_hfixedX_1077.{u_1, u_2} : rw [hi] exact Sym2.mem_mk_left _ _ -private theorem helper_hlenBX_1085.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] - [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) - (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - X.length = B.length + (1 : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper j B X - apply helper_hlenBX_410 <;> assumption -private theorem helper_hAXstrict_1087.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] - [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) - (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let j : ℕ := HierarchyPathNumber C.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - ∀ (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A), - A.length < X.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper H q j A X hstar - apply helper_hAXstrict_676 <;> assumption -private theorem helper_seedPrefixX_1089.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let j : ℕ := HierarchyPathNumber C.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - ∀ (_ : ( - ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : - TreeSequenceInitialSegment U W) (_ : S.length ≤ U.length), TreeSequenceInitialSegment S - U)) (_ : TreeSequenceInitialSegment A B) (_ : TreeSequenceInitialSegment X T) (_ : - TreeSequenceInitialSegment B X) (_ : ( - ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : - TreeSequenceInitialSegment U W), TreeSequenceInitialSegment S W)) (_ : - TreeSequenceInitialSegment Tn A) (_ : X.length = B.length + (1 : ℕ)) (_ : A.length < - X.length) {f : E} {seed : TreeSequence G e0} (_ : TreeSequenceAdjoinEdge Tn f seed) (_ : - TashkinovAugmentationSequence P.coloring seed T), TreeSequenceInitialSegment seed X := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H q j A B X n Tn commonPrefix hprefixA_B - hX_T hprefixB_X prefixTrans hTnA hlenBX hAXstrict f seed hadjoin hroute - apply helper_seedPrefixX_688 <;> assumption private theorem helper_switchedRoute_1094.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1272,50 +1178,6 @@ private theorem helper_oldSuffix_1100.{u_1, u_2} : · exact TashkinovAugmentationSequenceSuffix P.coloring seed X T hroute (seedPrefixX hadjoin hroute) hX_T -private theorem helper_routeToX_1107.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : TreeSequenceInitialSegment X T) (_ : TreeSequenceInitialSegment Tn X) (_ : ( - have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - P.corresponding.replacementETT.rounds; - have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data - n; P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence P.coloring Tn T ∨ - (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ - P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), - P.corresponding.replacementETT.series.data.connectingEdges n = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TreeIncidentEdge Tn f ∧ ( - ∃ c ∈ TreeMissingColors P.coloring Tn ∪ Dn, P.coloring f = some c) ∧ - TashkinovAugmentationSequence P.coloring seed T)) (_ : ( - ∀ {f : E} {seed : TreeSequence G e0} (_ : TreeSequenceAdjoinEdge Tn f seed) (_ : - TashkinovAugmentationSequence P.coloring seed T), TreeSequenceInitialSegment seed X)) (_ : - ( - ∀ {S : TreeSequence G e0} (_ : TashkinovAugmentationSequence P.coloring S X), - TashkinovAugmentationSequence sigma S X)), P.corresponding.replacementETT.series.data.kind - n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence sigma Tn X ∨ - (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ - P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), - P.corresponding.replacementETT.series.data.connectingEdges n = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed X := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j X n Tn sigma hX_T hTnX - terminalRoute seedPrefixX switchedRoute - apply helper_routeToX_714 <;> assumption private theorem helper_hAlphaMissingX_1120.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1370,235 +1232,6 @@ private theorem helper_hBetaMissingX_1127.{u_1, u_2} : rw [hB_missingEq v hv] exact hmiss -private theorem helper_firstPositionOnB_1140.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) (eta : - Fin k), HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition - P.coloring B eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_missingEq eta - apply helper_firstPositionOnB_760; exact hB_missingEq -private theorem helper_firstPositionBoundOnT_1144.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - ∀ (_ : alpha ≠ beta) (_ : TreeSequenceInitialSegment B T) {rho : PartialEdgeColoring E k} - {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), (↑(HierarchyFirstMissingPosition rho T - eta) : ℕ) ≤ B.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B hne hB_T rho eta hm - apply helper_firstPositionBoundOnT_530 <;> assumption -private theorem helper_firstPositionEqualOnTail_1148.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) (_ : ( - ∀ (eta : Fin k), HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition - P.coloring B eta)) (_ : ( - ∀ {rho : PartialEdgeColoring E k} {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), - (↑(HierarchyFirstMissingPosition rho T eta) : ℕ) ≤ B.length)), - ∀ eta ∈ TreeMissingColors P.coloring B, HierarchyFirstMissingPosition sigma T eta = - HierarchyFirstMissingPosition P.coloring T eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_T hB_missingEq - firstPositionOnB firstPositionBoundOnT eta hm - exact @helper_firstPositionEqualOnTail_554 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) - (@beta) (@hB_T) (@hB_missingEq) (@firstPositionOnB) (@firstPositionBoundOnT) (@eta) (@hm) - -private theorem helper_firstPositionGloballyEqual_1153.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : alpha ≠ beta) (eta : Fin k) (_ : eta ≠ alpha) (_ : eta ≠ beta), - HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition P.coloring T eta - := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma hne eta hα hβ - apply helper_firstPositionGloballyEqual_786 <;> assumption -private theorem helper_hstoredFirst_1158.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let D : Finset (Fin k) := HierarchyStoredColorsAt H q; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (HierarchyPathNumber - C.hierarchy - (2 : ℕ)))) (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix - C (HierarchyPathNumber C.hierarchy - (2 : ℕ)))) (_ : ( - ∀ eta ∈ TreeMissingColors P.coloring B, HierarchyFirstMissingPosition sigma T eta = - HierarchyFirstMissingPosition P.coloring T eta)) (_ : ( - ∀ (eta : Fin k) (_ : eta ≠ alpha) (_ : eta ≠ beta), HierarchyFirstMissingPosition sigma T eta - = HierarchyFirstMissingPosition P.coloring T eta)), - ∀ eta ∈ D, HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition - P.coloring T eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j B D sigma hAlphaB hBetaB - firstPositionEqualOnTail firstPositionGloballyEqual - exact @helper_hstoredFirst_804 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) - (@beta) (@hAlphaB) (@hBetaB) (@firstPositionEqualOnTail) (@firstPositionGloballyEqual) - -private theorem helper_hgammaCutoff_1162.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let D : Finset (Fin k) := HierarchyStoredColorsAt H q; - ∀ (_ : ((alpha ∉ (HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last - P.counterexample.hierarchy.dividerCount)).biUnion (P.counterexample.good.gamma (Fin.last - P.counterexample.hierarchy.dividerCount)) ∪ (TreeSequenceVertexSet P.replacementBase.core - \ TreeSequenceVertexSet (P.corresponding.replacementETT.series.data.tree (Fin.last - P.corresponding.replacementETT.rounds).castSucc)).biUnion fun (v : V) ↦ MissingColors G - P.coloring v) ∨ - ∃ eta ∈ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last - P.counterexample.hierarchy.dividerCount), alpha ∈ P.counterexample.good.gamma (Fin.last - P.counterexample.hierarchy.dividerCount) eta ∧ (↑(HierarchyFirstMissingPosition P.coloring - T eta) : ℕ) ≤ (HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (2 : - ℕ))).length)) (_ : beta ∉ (HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last - P.counterexample.hierarchy.dividerCount)).biUnion (P.counterexample.good.gamma (Fin.last - P.counterexample.hierarchy.dividerCount))) (_ : TreeSequenceInitialSegment B X), - ∀ eta ∈ D, alpha ∈ P.counterexample.good.gamma q eta ∨ beta ∈ P.counterexample.good.gamma q - eta → (↑(HierarchyFirstMissingPosition P.coloring T eta) : ℕ) ≤ X.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j B X D hAlphaChoice - hBetaNotGamma hprefixB_X - exact @helper_hgammaCutoff_610 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) - (@beta) (@hAlphaChoice) (@hBetaNotGamma) (@hprefixB_X) - -private theorem helper_fixedUntilSplitEnd_1169.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : TreeSequenceInitialSegment X T) (_ : ( - ∀ v ∈ TreeSequenceVertexSet X, - ∀ (f : E), Incident G v f → TwoColorComponentSwap G P.coloring alpha beta (Sum.inl (T.vertex - (Fin.last T.length))) f = P.coloring f)) (_ : X.length = B.length + (1 : ℕ)) (r : Fin - T.length) (_ : (↑r : ℕ) ≤ X.length), sigma (T.edge r) = P.coloring (T.edge r) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B X sigma hX_T - hincidentFixed hlenBX r hr - exact @helper_fixedUntilSplitEnd_822 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) - (@beta) (@hX_T) (@hincidentFixed) (@hlenBX) (@r) (@hr) - -private theorem helper_hXlen_1172.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] - [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (_ : (2 : ℕ) ≤ HierarchyPathNumber C.hierarchy) - (_ : HierarchyPathNumber C.hierarchy < HierarchyFullTailLength C), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let j : ℕ := HierarchyPathNumber C.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - ∀ (_ : HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A), - X.length = A.length + (j - (1 : ℕ)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P hpathLower hpathUpper H q j A X hstar - exact @helper_hXlen_837 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hpathLower) (@hpathUpper) - (@hstar) - -private theorem helper_hseparated_1174.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let j : ℕ := HierarchyPathNumber C.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let K : Set (V ⊕ E) := TwoColorComponent G P.coloring alpha beta (Sum.inl (T.vertex (Fin.last - T.length))); - ∀ (_ : ( - ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ K)) (_ : TreeSequenceInitialSegment B T) (_ : - TreeSequenceInitialSegment B X) (_ : X.length = B.length + (1 : ℕ)) (_ : ( - ∀ {rho : PartialEdgeColoring E k} {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), - (↑(HierarchyFirstMissingPosition rho T eta) : ℕ) ≤ B.length)) (_ : X.length = A.length + - (j - (1 : ℕ))), - ∀ c ∈ TreeMissingColors P.coloring B, Disjoint K (TwoColorComponent G P.coloring alpha beta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition P.coloring T c)))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j A B X K hsplitAvoid hB_T - hprefixB_X hlenBX firstPositionBoundOnT hXlen c hc - exact @helper_hseparated_657 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) - (@hsplitAvoid) (@hB_T) (@hprefixB_X) (@hlenBX) (@firstPositionBoundOnT) (@hXlen) (@c) (@hc) - private theorem helper_missingOnB_1178.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1888,25 +1521,25 @@ private theorem helper_continuation_2539.{u_1, u_2} : hAXstrict oldSuffix routeToX hsplitMissing switchedSuffix firstPositionBoundOnT firstPositionEqualOnTail with_reducible_and_instances - have firstPositionGloballyEqual := @helper_firstPositionGloballyEqual_1153 (@V) (@E) + have firstPositionGloballyEqual := @helper_firstPositionGloballyEqual_786 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hne) - have hstoredFirst := @helper_hstoredFirst_1158 (@V) (@E) inferInstance inferInstance + have hstoredFirst := @helper_hstoredFirst_804 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hAlphaB) (@hBetaB) (@firstPositionEqualOnTail) (@firstPositionGloballyEqual) - have hgammaCutoff := @helper_hgammaCutoff_1162 (@V) (@E) inferInstance inferInstance + have hgammaCutoff := @helper_hgammaCutoff_610 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hAlphaChoice) (@hBetaNotGamma) (@hprefixB_X) have hAX : TreeSequenceInitialSegment A X := prefixTrans hprefixA_B hprefixB_X - have fixedUntilSplitEnd := @helper_fixedUntilSplitEnd_1169 (@V) (@E) inferInstance inferInstance + have fixedUntilSplitEnd := @helper_fixedUntilSplitEnd_822 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hX_T) (@hincidentFixed) (@hlenBX) - have hXlen := @helper_hXlen_1172 (@V) (@E) inferInstance inferInstance inferInstance + have hXlen := @helper_hXlen_837 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hpathLower) (@hpathUpper) (@hstar) - have hseparated := @helper_hseparated_1174 (@V) (@E) inferInstance inferInstance inferInstance + have hseparated := @helper_hseparated_657 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hsplitAvoid) (@hB_T) (@hprefixB_X) (@hlenBX) (@firstPositionBoundOnT) (@hXlen) have missingOnB := @helper_missingOnB_1178 (@V) (@E) inferInstance inferInstance inferInstance @@ -2074,7 +1707,7 @@ private theorem helper_continuation_1137.{u_1, u_2} : have hZ_T : TreeSequenceInitialSegment Z T := by unfold TreeSequenceInitialSegment Z HierarchyFullTailPrefix TreeSequencePrefix exact ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ - have hX_Z := @helper_hX_Z_1054 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + have hX_Z := @helper_hX_Z_634 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hpathLower) (@hpathUpper) (@commonPrefix) (@hX_T) (@hZ_T) have hZElementary := @helper_hZElementary_1056 (@V) (@E) inferInstance inferInstance @@ -2089,13 +1722,13 @@ private theorem helper_continuation_1137.{u_1, u_2} : have hfixedX := @helper_hfixedX_1077 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hincidentFixed) - have hlenBX := @helper_hlenBX_1085 (@V) (@E) inferInstance inferInstance inferInstance + have hlenBX := @helper_hlenBX_410 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hpathLower) (@hpathUpper) - have hAXstrict := @helper_hAXstrict_1087 (@V) (@E) inferInstance inferInstance inferInstance + have hAXstrict := @helper_hAXstrict_676 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hpathLower) (@hpathUpper) (@hstar) - have seedPrefixX := @helper_seedPrefixX_1089 (@V) (@E) inferInstance inferInstance inferInstance + have seedPrefixX := @helper_seedPrefixX_688 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@commonPrefix) (@hprefixA_B) (@hX_T) (@hprefixB_X) (@prefixTrans) (@hTnA) (@hlenBX) (@hAXstrict) @@ -2105,7 +1738,7 @@ private theorem helper_continuation_1137.{u_1, u_2} : have oldSuffix := @helper_oldSuffix_1100 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hX_T) (@hTnX) (@terminalRoute) (@seedPrefixX) - have routeToX := @helper_routeToX_1107 (@V) (@E) inferInstance inferInstance inferInstance + have routeToX := @helper_routeToX_714 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hX_T) (@hTnX) (@terminalRoute) (@seedPrefixX) (@switchedRoute) have hAlphaMissingX := @helper_hAlphaMissingX_1120 (@V) (@E) inferInstance inferInstance @@ -2120,13 +1753,13 @@ private theorem helper_continuation_1137.{u_1, u_2} : TashkinovAugmentationSequenceComponentSwap G k e0 P.coloring alpha beta hne (Sum.inl (T.vertex (Fin.last T.length))) X T oldSuffix hsplitMissing.1 hsplitMissing.2 - have firstPositionOnB := @helper_firstPositionOnB_1140 (@V) (@E) inferInstance inferInstance + have firstPositionOnB := @helper_firstPositionOnB_760 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hB_missingEq) - have firstPositionBoundOnT := @helper_firstPositionBoundOnT_1144 (@V) (@E) inferInstance + have firstPositionBoundOnT := @helper_firstPositionBoundOnT_530 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hne) (@hB_T) - have firstPositionEqualOnTail := @helper_firstPositionEqualOnTail_1148 (@V) (@E) inferInstance + have firstPositionEqualOnTail := @helper_firstPositionEqualOnTail_554 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hB_T) (@hB_missingEq) (@firstPositionOnB) (@firstPositionBoundOnT) diff --git a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean index 196d318336..74c134672c 100644 --- a/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean +++ b/LeanPool/GoldbergSeymour/Step1CaseTwoOutsideTwoEdgeExtension.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdgeVertexSet + public import LeanPool.GoldbergSeymour.BoundaryMissingColorAugmentation public import LeanPool.GoldbergSeymour.GoodHierarchy public import LeanPool.GoldbergSeymour.GoodHierarchyCommonOriginalBaseTransport @@ -26,56 +28,6 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private theorem helper_adjoin_vertex_set_147.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) (e0 : E) (A B : - TreeSequence G e0) (f : E) (x y : V), G.ends f = s(x, y) → y ∉ TreeSequenceVertexSet A → - TreeSequenceAdjoinEdge A f B → TreeSequenceVertexSet B = (insert y (TreeSequenceVertexSet - A) : Finset V) := by - classical - intro V E _ G e0 A B f x y hxy hyA hAB - rcases hAB with ⟨hlen, hinit, hlast⟩ - rcases hinit with ⟨hle, hvertices, hedges⟩ - have holdSubset : TreeSequenceVertexSet A ⊆ TreeSequenceVertexSet B := by - intro v hv - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hv ⊢ - obtain ⟨q, hq⟩ := hv - refine ⟨Fin.castLE (Nat.succ_le_succ hle) q, ?_⟩ - rw [hvertices] - exact hq - have hyB : y ∈ TreeSequenceVertexSet B := by - let j : Fin B.length := Fin.cast hlen.symm (Fin.last A.length) - obtain ⟨a, ha⟩ := B.attaches j - have hyEnds : y ∈ G.ends (B.edge j) := by - rw [hlast, hxy] - simp - rw [ha] at hyEnds - rcases (by simpa only [Sym2.mem_iff] using hyEnds) with hynew | hyold - · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - exact ⟨j.succ, hynew.symm⟩ - · simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] - exact ⟨Fin.castLT a (Nat.lt_trans a.isLt (Nat.succ_lt_succ j.isLt)), - hyold.symm⟩ - have hinsert : insert y (TreeSequenceVertexSet A) ⊆ TreeSequenceVertexSet B := by - intro v hv - simp only [Finset.mem_insert] at hv - rcases hv with rfl | hv - · exact hyB - · exact holdSubset hv - have hAcard : (TreeSequenceVertexSet A).card = A.length + 1 := by - simp [TreeSequenceVertexSet, Finset.card_image_of_injective, - A.vertex_injective] - have hBcard : (TreeSequenceVertexSet B).card = B.length + 1 := by - simp [TreeSequenceVertexSet, Finset.card_image_of_injective, - B.vertex_injective] - have hcard : (TreeSequenceVertexSet B).card ≤ - (insert y (TreeSequenceVertexSet A)).card := by - rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] - exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm - private theorem helper_havoid_232.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -332,15 +284,16 @@ lemma Step1CaseTwoOutsideTwoEdgeExtension {V E : Type*} simpa using hxy obtain ⟨x₁, y₁, hx₁, hy₁, hxy₁⟩ := hends₁ have adjoin_vertex_set (A B : TreeSequence G e0) (f : E) (x y : V) - (hxy : G.ends f = s(x, y)) (hxA : x ∈ TreeSequenceVertexSet A) + (hxy : G.ends f = s(x, y)) (hyA : y ∉ TreeSequenceVertexSet A) (hAB : TreeSequenceAdjoinEdge A f B) : TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by - exact @helper_adjoin_vertex_set_147 (@V) (@E) inferInstance (@G) (@e0) (@A) (@B) (@f) (@x) + exact @TreeSequenceAdjoinEdge.vertexSet_eq_insert (@V) (@E) inferInstance (@G) (@e0) (@A) + (@B) (@f) (@x) (@y) (@hxy) (@hyA) (@hAB) have hJ1vertices : TreeSequenceVertexSet J₁ = insert y₁ (TreeSequenceVertexSet C) := - adjoin_vertex_set C J₁ f₁ x₁ y₁ hxy₁ hx₁ hy₁ had₁ + adjoin_vertex_set C J₁ f₁ x₁ y₁ hxy₁ hy₁ had₁ have hboundary₂ : f₂ ∈ BoundaryColorEdges G mu (TreeSequenceVertexSet J₁) beta := by simp only [BoundaryColorEdges, BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf₂ ⊢ @@ -456,7 +409,7 @@ lemma Step1CaseTwoOutsideTwoEdgeExtension {V E : Type*} have hJvertices : TreeSequenceVertexSet J = insert y₂ (TreeSequenceVertexSet J₁) := adjoin_vertex_set J₁ J f₂ x₂ y₂ hxy₂ - (by rw [hJ1vertices]; exact Finset.mem_insert_of_mem hx₂) hy₂J₁ had₂ + hy₂J₁ had₂ have hf₁J : ∀ v, Incident G v f₁ → v ∈ TreeSequenceVertexSet J := by intro v hv have hv' : v ∈ G.ends f₁ := hv diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean index 5e31b5a7c7..bdbc385340 100644 --- a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceInitialSegment.lean @@ -5,8 +5,9 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequence -public import Mathlib.Data.Fintype.EquivFin /-! # Tashkinov Augmentation Sequence Initial Segment @@ -21,37 +22,17 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour theorem TashkinovAugmentationSequenceInitialSegment - {V E : Type*} [Finite V] [Fintype E] + {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} {k : Nat} {e0 : E} (phi : PartialEdgeColoring E k) (A B : TreeSequence G e0) (hAB : TashkinovAugmentationSequence phi A B) : TreeSequenceInitialSegment A B := by - classical - let _ := Fintype.ofFinite V unfold TashkinovAugmentationSequence at hAB induction hAB with - | refl => - exact ⟨le_rfl, (fun _ => rfl), (fun _ => rfl)⟩ - | @tail B C hAB hBC ih => - rcases hBC with ⟨hlenEq, hsegBC, _⟩ - rcases ih with ⟨hlenAB, hvertexAB, hedgeAB⟩ - rcases hsegBC with ⟨hlenBC, hvertexBC, hedgeBC⟩ - refine ⟨Nat.le_trans hlenAB hlenBC, ?_, ?_⟩ - · intro i - calc - C.vertex (Fin.castLE - (Nat.succ_le_succ (Nat.le_trans hlenAB hlenBC)) i) = - C.vertex (Fin.castLE (Nat.succ_le_succ hlenBC) - (Fin.castLE (Nat.succ_le_succ hlenAB) i)) := by congr 1 - _ = B.vertex (Fin.castLE (Nat.succ_le_succ hlenAB) i) := - hvertexBC _ - _ = A.vertex i := hvertexAB i - · intro i - calc - C.edge (Fin.castLE (Nat.le_trans hlenAB hlenBC) i) = - C.edge (Fin.castLE hlenBC (Fin.castLE hlenAB i)) := by congr 1 - _ = B.edge (Fin.castLE hlenAB i) := hedgeBC _ - _ = A.edge i := hedgeAB i + | refl => exact TreeSequenceInitialSegment.refl _ + | @tail B C hAB hBC initial => + obtain ⟨_, segment, _⟩ := hBC + exact initial.trans segment end GoldbergSeymour diff --git a/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceTransport.lean b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceTransport.lean new file mode 100644 index 0000000000..0949265e00 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovAugmentationSequenceTransport.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment + +/-! +# Transporting Augmentation Routes + +Shared facts from Wesley Pegden's Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12, generalized during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A step transport below the target tree transports any augmentation route to that target. -/ +theorem TashkinovAugmentationSequence.transport {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {first second : PartialEdgeColoring E k} {source target : TreeSequence G e0} + (transportStep : ∀ {A B : TreeSequence G e0}, TashkinovAugmentation first A B → + TreeSequenceInitialSegment B target → TashkinovAugmentation second A B) + (route : TashkinovAugmentationSequence first source target) : + TashkinovAugmentationSequence second source target := by + unfold TashkinovAugmentationSequence at route ⊢ + induction route using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head A B step remainder transported => + have segment := TashkinovAugmentationSequenceInitialSegment first B target remainder + exact Relation.ReflTransGen.head (transportStep step segment) transported + +/-- Fixed edge colors and preserved missing colors on strict prefixes transport a route. -/ +theorem TashkinovAugmentationSequence.transport_of_fixed {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {first second : PartialEdgeColoring E k} {source target : TreeSequence G e0} + (fixedEdges : ∀ index : Fin target.length, + second (target.edge index) = first (target.edge index)) + (fixedMissing : ∀ {initial : TreeSequence G e0}, + TreeSequenceInitialSegment initial target → initial.length < target.length → + ∀ vertex ∈ TreeSequenceVertexSet initial, + MissingColors G second vertex = MissingColors G first vertex) + (route : TashkinovAugmentationSequence first source target) : + TashkinovAugmentationSequence second source target := by + classical + apply TashkinovAugmentationSequence.transport ?_ route + intro A B step segment + obtain ⟨lengthEqual, base, color, colored, missing⟩ := step + have initial : TreeSequenceInitialSegment A target := base.trans segment + have strict : A.length < target.length := by + have := segment.1 + omega + have missingSecond : color ∈ TreeMissingColors second A := by + unfold TreeMissingColors at missing ⊢ + obtain ⟨vertex, inTree, absent⟩ := Finset.mem_biUnion.mp missing + refine Finset.mem_biUnion.mpr ⟨vertex, inTree, ?_⟩ + rw [fixedMissing initial strict vertex inTree] + exact absent + let added : Fin B.length := Fin.cast lengthEqual.symm (Fin.last A.length) + have agreement := fixedEdges (Fin.castLE segment.1 added) + rw [segment.2.2 added] at agreement + exact ⟨lengthEqual, base, color, agreement.trans colored, missingSecond⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesTreeFacts.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesTreeFacts.lean new file mode 100644 index 0000000000..ea9ae85d1b --- /dev/null +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesTreeFacts.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TashkinovSeries + +/-! +# Tree Facts for Certified Tashkinov Series + +Shared facts from Wesley Pegden's Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12, generalized during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- Consecutive noninitial stages of a certified series are nested tree sequences. -/ +theorem TashkinovSeries.stepInitialSegment.{u_1, u_2} : + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : + LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series + : TashkinovSeries G k rounds e0 input) (j : Fin (rounds + 1)) (i : Fin rounds), j = i.succ + → TreeSequenceInitialSegment (series.data.tree i.succ.castSucc) (series.data.tree + i.succ.succ) := by + classical + intro V E _ _ _ G k rounds e0 input series j i hji + cases series.certified j with + | initial triple seedLength initialColoring initialStored initialEdges + initialKind initialVertex initialOutside initialDelta initialGamma + initialClosure => + exact (Fin.succ_ne_zero i) hji.symm |>.elim + | SE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternative + currentColoring currentStored currentEdges currentKind currentVertex + currentOutside currentDelta currentGamma adjoined adjoinedExactly + closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | PE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed noRevisiting choice seriesAlternativeFails + gamma gammaRule secondStable secondStableProper + secondStableOneUncolored secondStableRelation exitWitness + currentColoring currentProper currentOneUncolored currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma closedExtension orderedExtension strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + | RE ci previousProper previousOneUncolored previousClosed + previousNotStronglyClosed available currentColoring currentStored + currentEdges currentKind currentVertex currentOutside currentDelta + currentGamma adjoined adjoinedExactly closedExtension orderedExtension + strictExtension => + have hvals := congrArg Fin.val hji + simp at hvals + have hieq : ci = i := by apply Fin.ext; omega + subst ci + exact orderedExtension + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean index b0a256f66e..831b66c23f 100644 --- a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean +++ b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean @@ -6226,65 +6226,6 @@ private theorem helper_hmissing_6909.{u_1, u_2} : newChoice.vertex := congrArg _ (hvertexIdentity.trans hfullVertexCast).symm -private theorem helper_hcolorPairs_7591.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (sigmaPrev : PartialEdgeColoring E k) (hroundLarge : (1 : ℕ) < - ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree - (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : - ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = - ett.series.data.coloring (Fin.castLE ( - by - omega - ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( - by - omega - ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges - (Fin.castLE ( - by - omega - ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( - by - omega - ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors - ett.series.data (Fin.castLE ( - by - omega - ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev - (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (j : Fin (originalPrefix.rounds + - (1 : ℕ))), - let fullj : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( - by - omega - ) j; - ∀ (fulli : Fin ett.rounds) (fullChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree - fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) - (ett.series.data.coloring fulli.castSucc)) (fullGamma : Fin k) (_ : ett.series.data.stored - fulli.succ = (insert fullChoice.color ({ fullGamma } : Finset (Fin k)) : Finset (Fin k))) - (_ : fulli.succ = fullj) (newi : Fin originalPrefix.rounds) (newChoice : - MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree newi.succ.castSucc) - (TashkinovStoredColors corr.replacementSeries.data newi.castSucc) - (corr.replacementSeries.data.coloring newi.castSucc)) (newGamma : Fin k) (_ : - corr.replacementSeries.data.stored newi.succ = (insert newChoice.color ({ newGamma } : - Finset (Fin k)) : Finset (Fin k))) (_ : newi.succ = j) (htree : - corr.replacementSeries.data.tree newi.succ.castSucc = ett.series.data.tree - fulli.succ.castSucc), - let fullChoiceOnNew : MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree - newi.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) - (ett.series.data.coloring fulli.castSucc) := (Eq.symm htree ▸ fullChoice); - ∀ (_ : fullChoiceOnNew.color = fullChoice.color), (insert fullChoiceOnNew.color ({ fullGamma } - : Finset (Fin k)) : Finset (Fin k)) = (insert newChoice.color ({ newGamma } : Finset (Fin - k)) : Finset (Fin k)) := by - classical - intro V E _ _ _ G k e0 input T generating ett sigmaPrev hroundLarge originalPrefix hr - hprefixData corr j fullj fulli fullChoice fullGamma fullCurrentStored hfullIndex newi - newChoice newGamma newCurrentStored hnewIndex htree fullChoiceOnNew hfullColorCast - apply helper_hcolorPairs_6830 <;> assumption private theorem helper_hprefixPostFull_7637.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -6396,7 +6337,7 @@ theorem helper_branch_12991.{u_1, u_2} : have hcolorPairs : ({fullChoiceOnNew.color, fullGamma} : Finset (Fin k)) = {newChoice.color, newGamma} := by - apply helper_hcolorPairs_7591 <;> assumption + apply helper_hcolorPairs_6830 <;> assumption have hedgeIdentity : newChoice.edge = fullChoiceOnNew.edge := by apply Finset.mem_singleton.mp diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveDeletedTreePair.lean b/LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdgeVertexSet.lean similarity index 79% rename from LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveDeletedTreePair.lean rename to LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdgeVertexSet.lean index 72460a125b..5f82e46cdd 100644 --- a/LeanPool/GoldbergSeymour/SharedFacts/ScheideDefectiveDeletedTreePair.lean +++ b/LeanPool/GoldbergSeymour/TreeSequenceAdjoinEdgeVertexSet.lean @@ -5,33 +5,30 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge -public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet public import Mathlib.Combinatorics.SimpleGraph.Init public import Mathlib.Data.Fintype.Card public import Mathlib.Tactic.Bound.Init +public import LeanPool.GoldbergSeymour.TreeSequenceAdjoinEdge +public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet + /-! -# Shared facts for ScheideDefectiveDeletedTreePair +# Vertex Sets of Adjoined Trees -These interfaces and proofs are shared across the imported proof branches. -Extracted from Wesley Pegden’s Trellis formalization at -88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. +Shared facts from Wesley Pegden's Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12, generalized during the Lean Pool port. -/ @[expose] public section -namespace GoldbergSeymour.SharedFacts.ScheideDefectiveDeletedTreePair +namespace GoldbergSeymour -/-- Dependent interface shared by the proof branches, so its assumptions stay synchronized. -/ -abbrev adjoinVertexSetStatement.{u_1, u_2} : Prop := +/-- Adjoining an edge to a fresh endpoint inserts exactly that endpoint into the tree. -/ +theorem TreeSequenceAdjoinEdge.vertexSet_eq_insert.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [DecidableEq V] (G : LooplessMultigraph V E) (e0 : E) (A B : TreeSequence G e0) (f : E) (x y : V), G.ends f = s(x, y) → y ∉ TreeSequenceVertexSet A → TreeSequenceAdjoinEdge A f B → - TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) - -/-- A common proof used by the branches of this transport or construction argument. -/ -theorem adjoin_vertex_set.{u_1, u_2} : adjoinVertexSetStatement.{u_1, u_2} := by + TreeSequenceVertexSet B = insert y (TreeSequenceVertexSet A) := by classical intro V E _ G e0 A B f x y hxy hyA hAB rcases hAB with ⟨hlen, hinit, hlast⟩ @@ -77,6 +74,6 @@ theorem adjoin_vertex_set.{u_1, u_2} : adjoinVertexSetStatement.{u_1, u_2} := by rw [hBcard, Finset.card_insert_of_notMem hyA, hAcard, hlen] exact (Finset.eq_of_subset_of_card_le hinsert hcard).symm -end GoldbergSeymour.SharedFacts.ScheideDefectiveDeletedTreePair +end GoldbergSeymour end diff --git a/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean b/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean index a215e042cd..75036094bb 100644 --- a/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean +++ b/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition public import LeanPool.GoldbergSeymour.TreeMissingColors @@ -131,6 +133,16 @@ theorem TreeSequenceFirstMissingPositionMem {V E : Type*} [Fintype E] rfl omega +/-- Enlarging a tree by an initial-segment extension can only add missing colors. -/ +theorem TreeSequenceInitialSegment.treeMissingColors_subset {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {coloring : PartialEdgeColoring E k} + {initial tree : TreeSequence G e0} (segment : TreeSequenceInitialSegment initial tree) : + TreeMissingColors coloring initial ⊆ TreeMissingColors coloring tree := by + classical + intro color membership + obtain ⟨vertex, inInitial, missing⟩ := Finset.mem_biUnion.mp membership + exact Finset.mem_biUnion.mpr ⟨vertex, segment.vertexSet_subset inInitial, missing⟩ + end GoldbergSeymour end diff --git a/LeanPool/GoldbergSeymour/TreeVerticesBeforeFacts.lean b/LeanPool/GoldbergSeymour/TreeVerticesBeforeFacts.lean new file mode 100644 index 0000000000..173095c41e --- /dev/null +++ b/LeanPool/GoldbergSeymour/TreeVerticesBeforeFacts.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TreeVerticesBefore +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts +public import LeanPool.GoldbergSeymour.MissingColors + +/-! +# Facts About Strict Tree Prefixes + +Shared facts from Wesley Pegden's Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12, generalized during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A vertex strictly before another vertex cannot equal it. -/ +theorem TreeVerticesBefore.ne_self {V E : Type*} {G : LooplessMultigraph V E} {e0 : E} + {tree : TreeSequence G e0} {vertex value : V} + {member : vertex ∈ TreeSequenceVertexSet tree} + (membership : value ∈ TreeVerticesBefore tree vertex member) : value ≠ vertex := by + classical + unfold TreeVerticesBefore at membership + obtain ⟨-, first, last, firstValue, lastVertex, ordered⟩ := Finset.mem_filter.mp membership + intro equal + have samePosition : first = last := tree.vertex_injective + (firstValue.trans (equal.trans lastVertex.symm)) + omega + +/-- Equality away from two erased vertices gives equality throughout a strict tree prefix. -/ +theorem TreeVerticesBefore.missingColors_eq_of_erase {V E : Type*} + [DecidableEq V] [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} + {tree : TreeSequence G e0} {vertex special : V} + {member : vertex ∈ TreeSequenceVertexSet tree} {extra : Finset V} + {first second : PartialEdgeColoring E k} + (offSpecial : ∀ value ∈ ((extra ∪ + (TreeVerticesBefore tree vertex member ∪ {vertex})).erase vertex).erase special, + MissingColors G second value = MissingColors G first value) + (atSpecial : special ∈ TreeVerticesBefore tree vertex member → + MissingColors G second special = MissingColors G first special) + {value : V} (membership : value ∈ TreeVerticesBefore tree vertex member) : + MissingColors G second value = MissingColors G first value := by + classical + by_cases equal : value = special + · subst value + exact atSpecial membership + · apply offSpecial value + apply Finset.mem_erase.mpr + refine ⟨equal, Finset.mem_erase.mpr ⟨TreeVerticesBefore.ne_self membership, ?_⟩⟩ + exact Finset.mem_union_right _ (Finset.mem_union_left _ membership) + +/-- A strictly shorter initial segment lies before any supplied cutoff for the middle tree. -/ +theorem TreeSequenceInitialSegment.mem_before_of_length {V E : Type*} + {G : LooplessMultigraph V E} {e0 : E} {initial middle tree : TreeSequence G e0} + (initialMiddle : TreeSequenceInitialSegment initial middle) + (middleTree : TreeSequenceInitialSegment middle tree) + (strictLength : initial.length < middle.length) {vertex : V} + {member : vertex ∈ TreeSequenceVertexSet tree} + (beforePositions : ∀ index : Fin (tree.length + 1), index.val < middle.length → + tree.vertex index ∈ TreeVerticesBefore tree vertex member) + {value : V} (membership : value ∈ TreeSequenceVertexSet initial) : + value ∈ TreeVerticesBefore tree vertex member := by + classical + obtain ⟨index, _, rfl⟩ := Finset.mem_image.mp membership + have segment := initialMiddle.trans middleTree + have bound : index.val ≤ initial.length := Nat.le_of_lt_succ index.isLt + rw [← segment.2.1 index] + exact beforePositions (Fin.castLE (Nat.succ_le_succ segment.1) index) + (lt_of_le_of_lt bound strictLength) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentLeafPaths.lean b/LeanPool/GoldbergSeymour/TwoColorComponentLeafPaths.lean new file mode 100644 index 0000000000..14d977faea --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorComponentLeafPaths.lean @@ -0,0 +1,220 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.MissingColors + +public import LeanPool.GoldbergSeymour.TwoColorComponentSpanningPath + +/-! +# Paths Starting at Incidence Leaves + +Shared facts from Wesley Pegden's Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12, generalized during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- A leaf of a nontrivial component starts a spanning path +whose other endpoint is missing a color. -/ +theorem TwoColorComponent.pathFromLeaf.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : + LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k), IsProperEdgeColoring G + phi → ∀ (a b : Fin k), let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; (∀ + (v : V), (H.neighborSet (Sum.inl v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ + MissingColors G phi v) → ∀ (v : V) (c : V ⊕ E), Sum.inl v ∈ TwoColorComponent G phi a b c + → (H.neighborSet (Sum.inl v)).Subsingleton → (∃ (e : E), Sum.inr e ∈ TwoColorComponent G + phi a b c) → ∃ (s : V) (p : H.Walk (Sum.inl v) (Sum.inl s)), p.IsPath ∧ {y : V ⊕ E | y ∈ + p.support} = TwoColorComponent G phi a b c ∧ v ≠ s ∧ (a ∈ MissingColors G phi s ∨ b ∈ + MissingColors G phi s) := by + classical + intro V E _ _ G k phi hproper a b H endpoint_missing v c hvC hvleaf hnontrivial + let _ := Fintype.ofFinite V + obtain ⟨u, w, p, hp, hps⟩ := + TwoColorComponentSpanningPath G phi a b hproper c + have hvP : Sum.inl v ∈ p.support := by + change Sum.inl v ∈ {y | y ∈ p.support} + rw [hps] + exact hvC + have hvEnd : Sum.inl v = u ∨ Sum.inl v = w := by + by_contra hn + push Not at hn + exact (hp.isTrail.notMem_support_of_subsingleton_neighborSet + hn.1 hn.2 hvleaf) hvP + obtain ⟨t, q, hq, hqs⟩ : ∃ (t : Sum V E) + (q : H.Walk (Sum.inl v) t), + q.IsPath ∧ {y | y ∈ q.support} = + TwoColorComponent G phi a b c := by + rcases hvEnd with hvu | hvw + · subst u + exact ⟨w, p, hp, hps⟩ + · subst w + refine ⟨u, p.reverse, hp.reverse, ?_⟩ + ext y + change y ∈ p.reverse.support ↔ + y ∈ TwoColorComponent G phi a b c + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] + exact Set.ext_iff.mp hps y + have hqnon : ¬ q.Nil := by + intro hnil + obtain ⟨e, heC⟩ := hnontrivial + have heQ : Sum.inr e ∈ q.support := by + change Sum.inr e ∈ {y | y ∈ q.support} + rw [hqs] + exact heC + rw [SimpleGraph.Walk.nil_iff_support_eq.mp hnil] at heQ + simp at heQ + have hend_neighbor : ∀ y, H.Adj t y → + y = q.getVert (q.length - 1) := by + intro y hty + have hyC : y ∈ TwoColorComponent G phi a b c := by + have htC : t ∈ TwoColorComponent G phi a b c := by + rw [← hqs] + change t ∈ q.support + simpa only [q.getVert_length] using + q.getVert_mem_support q.length + change H.connectedComponentMk y = H.connectedComponentMk c + change H.connectedComponentMk t = H.connectedComponentMk c at htC + exact + (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hty).symm.trans htC + have hySupport : y ∈ q.support := by + change y ∈ {z | z ∈ q.support} + rw [hqs] + exact hyC + obtain ⟨n, hn, hnle⟩ := + SimpleGraph.Walk.mem_support_iff_exists_getVert.mp hySupport + have hnlt : n < q.length := by + have hnne : n ≠ q.length := by + intro heq + have hyt : y = t := by rw [← hn, heq, q.getVert_length] + exact hty.ne hyt.symm + omega + by_cases hpen : n + 1 = q.length + · rw [← hn] + congr 1 + omega + by_cases hn0 : n = 0 + · have hnext : H.Adj (Sum.inl v) (q.getVert 1) := by + simpa [hn0, q.getVert_zero] using q.adj_getVert_succ hnlt + have htstart : H.Adj (Sum.inl v) t := by + rw [← hn, hn0, q.getVert_zero] at hty + exact hty.symm + have hneNext : q.getVert 1 ≠ t := by + intro heq + have hindices := hq.getVert_injOn + (show 1 ≤ q.length by omega) (show q.length ≤ q.length by rfl) + (heq.trans q.getVert_length.symm) + omega + exact False.elim (hneNext (hvleaf hnext htstart)) + · have hleft : H.Adj y (q.getVert (n - 1)) := by + rw [← hn] + have hadj := q.adj_getVert_succ (i := n - 1) (by omega) + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ n)] using + hadj.symm + have hright : H.Adj y (q.getVert (n + 1)) := by + rw [← hn] + exact q.adj_getVert_succ hnlt + have htneLeft : t ≠ q.getVert (n - 1) := by + intro heq + have hindices := hq.getVert_injOn + (show q.length ≤ q.length by rfl) + (show n - 1 ≤ q.length by omega) + (q.getVert_length.trans heq) + omega + have htneRight : t ≠ q.getVert (n + 1) := by + intro heq + have hindices := hq.getVert_injOn + (show q.length ≤ q.length by rfl) + (show n + 1 ≤ q.length by omega) + (q.getVert_length.trans heq) + omega + have hlrne : q.getVert (n - 1) ≠ q.getVert (n + 1) := by + intro heq + have hindices := hq.getVert_injOn + (show n - 1 ≤ q.length by omega) + (show n + 1 ≤ q.length by omega) heq + omega + let : Fintype (H.neighborSet y) := Fintype.ofFinite _ + have hthree : 3 ≤ @SimpleGraph.degree _ H y + (Fintype.ofFinite _) := by + rw [← SimpleGraph.card_neighborFinset_eq_degree] + let ss : Finset (Sum V E) := + {t, q.getVert (n - 1), q.getVert (n + 1)} + have hss : ss ⊆ H.neighborFinset y := by + intro r hr + simp only [ss, Finset.mem_insert, Finset.mem_singleton] at hr + rcases hr with rfl | rfl | rfl + · simpa [SimpleGraph.mem_neighborFinset] using hty.symm + · simpa [SimpleGraph.mem_neighborFinset] using hleft + · simpa [SimpleGraph.mem_neighborFinset] using hright + have hc3 : 3 ≤ ss.card := by + simp [ss, htneLeft, htneRight, hlrne] + exact hc3.trans (Finset.card_le_card hss) + have htwo : @SimpleGraph.degree _ H y + (Fintype.ofFinite _) ≤ 2 := by + simpa [H] using + TwoColorIncidenceDegreeAtMostTwo G phi a b hproper y + omega + have hendLeaf : Set.Subsingleton (H.neighborSet t) := by + intro y hy y' hy' + exact (hend_neighbor y hy).trans (hend_neighbor y' hy').symm + have hqpos : 0 < q.length := + SimpleGraph.Walk.not_nil_iff_lt_length.mp hqnon + have hendVertex : ∃ s : V, t = Sum.inl s := by + cases ht : t with + | inl s => exact ⟨s, rfl⟩ + | inr e => + have hlastAdj : H.Adj (q.getVert (q.length - 1)) t := by + simpa only [Nat.sub_add_cancel (by omega : 1 ≤ q.length), + q.getVert_length] using + q.adj_getVert_succ (i := q.length - 1) (by omega) + have hecolor : phi e = some a ∨ phi e = some b := by + cases hprev : q.getVert (q.length - 1) with + | inl r => + rw [hprev, ht] at hlastAdj + have hdata : Incident G r e ∧ + (phi e = some a ∨ phi e = some b) := by + simpa [H, TwoColorIncidenceGraph] using hlastAdj + exact hdata.2 + | inr f => + rw [hprev, ht] at hlastAdj + have : False := by + simp [H, TwoColorIncidenceGraph] at hlastAdj + exact this.elim + induction hends : G.ends e using Sym2.inductionOn with + | _ r s => + have hrs : r ≠ s := by + intro hrs + subst s + exact G.loopless e r hends + have hrAdj : H.Adj t (Sum.inl r) := by + rw [ht] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G r e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨by simp [Incident, hends], hecolor⟩) + have hsAdj : H.Adj t (Sum.inl s) := by + rw [ht] + simpa [H, TwoColorIncidenceGraph, Incident, hends] using + (show Incident G s e ∧ + (phi e = some a ∨ phi e = some b) from + ⟨by simp [Incident, hends], hecolor⟩) + exact False.elim + (hrs (Sum.inl.inj (hendLeaf hrAdj hsAdj))) + obtain ⟨s, hs⟩ := hendVertex + subst t + have hvs : v ≠ s := by + intro hvs + apply hqnon + exact hq.nil_iff_eq.mpr (by simp [hvs]) + exact ⟨s, q, hq, hqs, hvs, endpoint_missing s hendLeaf⟩ + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/TwoColorComponentSwapPresentColors.lean b/LeanPool/GoldbergSeymour/TwoColorComponentSwapPresentColors.lean index 293b69b9a1..ca5dd0a388 100644 --- a/LeanPool/GoldbergSeymour/TwoColorComponentSwapPresentColors.lean +++ b/LeanPool/GoldbergSeymour/TwoColorComponentSwapPresentColors.lean @@ -5,7 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.PresentColors +public import LeanPool.GoldbergSeymour.MissingColors + public import LeanPool.GoldbergSeymour.TwoColorComponentSwap /-! @@ -122,6 +123,72 @@ theorem TwoColorComponentSwapPreservesPresent {V E : Type*} [Fintype E] · exact TwoColorComponentSwapPreservesOther hc hca hcb +/-- Swapping at a root exchanges a present color with a missing color there. -/ +theorem TwoColorComponentSwapExchangesRootColors.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype E] {G : + LooplessMultigraph V E} {k : ℕ} {phi : PartialEdgeColoring E k} {v : V} {alpha beta : Fin + k}, alpha ≠ beta → beta ∈ MissingColors G phi v → alpha ∈ PresentColors G phi v → alpha ∈ + MissingColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v ∧ beta ∈ + PresentColors G (TwoColorComponentSwap G phi alpha beta (Sum.inl v)) v := by + classical + intro V E _ G k phi v alpha beta hne hbeta halpha + have hbetaNotPresent : beta ∉ PresentColors G phi v := by + simpa [MissingColors] using hbeta + obtain ⟨eAlpha, heAlphaIncident, heAlphaColor⟩ := by + simpa only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] using halpha + have heAlphaComponent : Sum.inr eAlpha ∈ + TwoColorComponent G phi alpha beta (Sum.inl v) := by + let H := TwoColorIncidenceGraph G phi alpha beta + have hadj : H.Adj (Sum.inl v) (Sum.inr eAlpha) := by + simpa [H, TwoColorIncidenceGraph] using + And.intro heAlphaIncident (Or.inl heAlphaColor) + change H.connectedComponentMk (Sum.inr eAlpha) = + H.connectedComponentMk (Sum.inl v) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + hadj).symm + constructor + · unfold MissingColors + rw [Finset.mem_sdiff] + refine ⟨Finset.mem_univ _, ?_⟩ + intro hp + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] at hp + rcases hp with ⟨e, hev, heColor⟩ + by_cases heK : + Sum.inr e ∈ TwoColorComponent G phi alpha beta (Sum.inl v) + · have heBeta : phi e = some beta := by + unfold TwoColorComponentSwap at heColor + rw [ite_eq_left heK] at heColor + by_cases heAlpha : phi e = some alpha + · rw [ite_eq_left heAlpha] at heColor + exact False.elim (hne (Option.some.inj heColor).symm) + · by_cases heBeta : phi e = some beta + · exact heBeta + · rw [ite_eq_right heAlpha, ite_eq_right heBeta] at heColor + exact False.elim (heAlpha heColor) + apply hbetaNotPresent + simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨e, hev, heBeta⟩ + · have heOldAlpha : phi e = some alpha := by + simpa [TwoColorComponentSwap, heK] using heColor + have heAdj : (TwoColorIncidenceGraph G phi alpha beta).Adj + (Sum.inl v) (Sum.inr e) := by + simpa [TwoColorIncidenceGraph] using + And.intro hev (Or.inl heOldAlpha) + apply heK + change (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inr e) = + (TwoColorIncidenceGraph G phi alpha beta).connectedComponentMk + (Sum.inl v) + exact (SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + heAdj).symm + · simp only [PresentColors, Finset.mem_filter, Finset.mem_univ, + true_and] + exact ⟨eAlpha, heAlphaIncident, by + simp [TwoColorComponentSwap, heAlphaComponent, heAlphaColor]⟩ + end GoldbergSeymour end diff --git a/LeanPool/GoldbergSeymour/TwoColorMissingVertexNeighbors.lean b/LeanPool/GoldbergSeymour/TwoColorMissingVertexNeighbors.lean new file mode 100644 index 0000000000..6f762b72d6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/TwoColorMissingVertexNeighbors.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.TwoColorIncidenceGraph +public import LeanPool.GoldbergSeymour.MissingColors +public import LeanPool.GoldbergSeymour.IsProperEdgeColoring + +/-! +# Missing Colors Give Incidence Leaves + +Shared facts from Wesley Pegden's Trellis formalization at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12, generalized during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +/-- If one color is missing, a proper two-color incidence graph has at most one neighbor. -/ +theorem TwoColorMissingVertexNeighborsSubsingleton.{u_1, u_2} : + open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype E] (G : + LooplessMultigraph V E) {k : ℕ} (phi : PartialEdgeColoring E k), IsProperEdgeColoring G + phi → ∀ (a b : Fin k), let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; ∀ + (v : V), a ∈ MissingColors G phi v ∨ b ∈ MissingColors G phi v → (H.neighborSet (Sum.inl + v)).Subsingleton := by + classical + intro V E _ G k phi hproper a b H v hmissing z hz w hw + cases hzv : z with + | inl u => + rw [hzv] at hz + simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hz + | inr e => + cases hwv : w with + | inl u => + rw [hwv] at hw + simp [H, SimpleGraph.mem_neighborSet, TwoColorIncidenceGraph] at hw + | inr f => + rw [hzv] at hz + rw [hwv] at hw + have he : Incident G v e ∧ + (phi e = some a ∨ phi e = some b) := by + simpa [H, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hz + have hf : Incident G v f ∧ + (phi f = some a ∨ phi f = some b) := by + simpa [H, SimpleGraph.mem_neighborSet, + TwoColorIncidenceGraph] using hw + apply congrArg Sum.inr + by_contra hef + rcases hmissing with ha | hb + · have hna : a ∉ PresentColors G phi v := by + simpa [MissingColors] using ha + have hea : phi e = some b := he.2.resolve_left (by + intro hea + apply hna + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some a from + ⟨e, he.1, hea⟩)) + have hfa : phi f = some b := hf.2.resolve_left (by + intro hfa + apply hna + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some a from + ⟨f, hf.1, hfa⟩)) + exact (hproper hef ⟨v, he.1, hf.1⟩ hea) hfa + · have hnb : b ∉ PresentColors G phi v := by + simpa [MissingColors] using hb + have heb : phi e = some a := he.2.resolve_right (by + intro heb + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some b from + ⟨e, he.1, heb⟩)) + have hfb : phi f = some a := hf.2.resolve_right (by + intro hfb + apply hnb + simpa [PresentColors] using + (show ∃ q, Incident G v q ∧ phi q = some b from + ⟨f, hf.1, hfb⟩)) + exact (hproper hef ⟨v, he.1, hf.1⟩ heb) hfb + +/-- A vertex with at most one incidence neighbor must miss one of two distinct colors. -/ +theorem TwoColorMissingOfVertexNeighborsSubsingleton.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype E] (G : LooplessMultigraph V E) {k : ℕ} + (phi : PartialEdgeColoring E k) (a b : Fin k), + a ≠ b → + let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G phi a b; + ∀ (v : V), (H.neighborSet (Sum.inl v)).Subsingleton → a ∈ MissingColors G phi v ∨ b ∈ + MissingColors G phi v := by + classical + intro V E _ G k phi a b hne H v hleaf + by_cases ha : a ∈ MissingColors G phi v + · exact Or.inl ha + · right + have hap : a ∈ PresentColors G phi v := by + simpa [MissingColors] using ha + by_contra hb + have hbp : b ∈ PresentColors G phi v := by + simpa [MissingColors] using hb + obtain ⟨ea, hea, hca⟩ := by simpa [PresentColors] using hap + obtain ⟨eb, heb, hcb⟩ := by simpa [PresentColors] using hbp + have hada : H.Adj (Sum.inl v) (Sum.inr ea) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v ea ∧ + (phi ea = some a ∨ phi ea = some b) from + ⟨hea, Or.inl hca⟩) + have hadb : H.Adj (Sum.inl v) (Sum.inr eb) := by + simpa [H, TwoColorIncidenceGraph] using + (show Incident G v eb ∧ + (phi eb = some a ∨ phi eb = some b) from + ⟨heb, Or.inr hcb⟩) + have heab : ea = eb := Sum.inr.inj (hleaf hada hadb) + subst eb + exact hne (Option.some.inj (hca.symm.trans hcb)) + +end GoldbergSeymour + +end From c8299d3aae8f2d347abe5da7db6c5de13dc41fd9 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Fri, 6 Nov 2026 03:04:48 +0000 Subject: [PATCH 09/11] Generalize missing-color transport and simplify split-swap preparation --- ...archyFirstMissingPositionPrefixCutoff.lean | 32 +- ...hySituationOneShorteningContradiction.lean | 1 - ...tuationTwoSubcaseOneOneNonexceptional.lean | 1 - .../PrefixSegmentTransport.lean | 1 + .../GoldbergSeymour/SplitSwapPreparation.lean | 366 ++---------------- .../TerminalKempeStageSwitch.lean | 1 - .../TreeSequenceColoringFacts.lean | 35 ++ 7 files changed, 100 insertions(+), 337 deletions(-) diff --git a/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean b/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean index 4d33d928fc..a142551418 100644 --- a/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean +++ b/LeanPool/GoldbergSeymour/HierarchyFirstMissingPositionPrefixCutoff.lean @@ -7,7 +7,7 @@ module public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import Mathlib.Data.Fintype.EquivFin +public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts /-! # Hierarchy First Missing Position Prefix Cutoff @@ -22,7 +22,7 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour lemma HierarchyFirstMissingPositionPrefixCutoff {V E : Type*} - [Finite V] [Fintype E] + [Fintype E] {G : LooplessMultigraph V E} {k : Nat} {e0 : E} (phi : PartialEdgeColoring E k) (A T : TreeSequence G e0) (hAT : TreeSequenceInitialSegment A T) (eta : Fin k) @@ -30,7 +30,6 @@ lemma HierarchyFirstMissingPositionPrefixCutoff {V E : Type*} min (HierarchyFirstMissingPosition phi A eta).val uLength = min (HierarchyFirstMissingPosition phi T eta).val uLength := by classical - let _ := Fintype.ofFinite V let candidatesA : Finset (Fin (A.length + 1)) := {i | eta ∈ MissingColors G phi (A.vertex i)} let candidatesT : Finset (Fin (T.length + 1)) := @@ -108,6 +107,33 @@ lemma HierarchyFirstMissingPositionPrefixCutoff {V E : Type*} have hlen := hAT.1 omega + +/-- Preserving missing colors on a prefix preserves first positions of its missing colors. -/ +theorem TreeSequenceFirstMissingPositionCongrOfPrefix {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {initial tree : TreeSequence G e0} + {first second : PartialEdgeColoring E k} + (segment : TreeSequenceInitialSegment initial tree) + (equal : ∀ vertex ∈ TreeSequenceVertexSet initial, + MissingColors G first vertex = MissingColors G second vertex) + {color : Fin k} (missing : color ∈ TreeMissingColors second initial) : + HierarchyFirstMissingPosition first tree color = + HierarchyFirstMissingPosition second tree color := by + have missingFirst : color ∈ TreeMissingColors first initial := by + rwa [TreeMissingColors.congr equal] + have firstCut := HierarchyFirstMissingPositionPrefixCutoff first initial tree segment + color initial.length le_rfl + have secondCut := HierarchyFirstMissingPositionPrefixCutoff second initial tree segment + color initial.length le_rfl + have positionsEqual := TreeSequenceFirstMissingPositionCongr equal color + have truncated := firstCut.symm.trans + ((congrArg (fun position : Fin (initial.length + 1) => min position.val initial.length) + positionsEqual).trans secondCut) + have firstBound := TreeSequenceFirstMissingPositionLePrefix segment missingFirst + have secondBound := TreeSequenceFirstMissingPositionLePrefix segment missing + apply Fin.ext + rw [min_eq_left firstBound, min_eq_left secondBound] at truncated + exact truncated + end GoldbergSeymour end diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean index ecd48422ea..b8fbf2a39e 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean @@ -9,7 +9,6 @@ public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningTransport public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement -public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean index 12a19bba87..e7fb628a16 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean @@ -7,7 +7,6 @@ module public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTreeTerminalData -public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary diff --git a/LeanPool/GoldbergSeymour/PrefixSegmentTransport.lean b/LeanPool/GoldbergSeymour/PrefixSegmentTransport.lean index 66c4f7320d..95f4671372 100644 --- a/LeanPool/GoldbergSeymour/PrefixSegmentTransport.lean +++ b/LeanPool/GoldbergSeymour/PrefixSegmentTransport.lean @@ -8,6 +8,7 @@ module public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPositionPrefixCutoff public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet +public import Mathlib.Data.Fintype.EquivFin /-! # P2813_T1_Prefix Segment Transport diff --git a/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean b/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean index 24f27d3d37..3942a02bf4 100644 --- a/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean +++ b/LeanPool/GoldbergSeymour/SplitSwapPreparation.lean @@ -74,47 +74,6 @@ private theorem helper_hsigmaOne_150.{u_1, u_2} : refine ⟨?_, ?_⟩ · simp [TwoColorComponentSwap, P.minimumContext.oneEdgeUncolored.1] · apply helper_branch_51; exact hne -private theorem helper_branch_75.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0} (hSU : S.length ≤ U.length) (hSWl : S.length ≤ W.length) - (_ : - (∀ (i : Fin (S.length + (1 : ℕ))), - W.vertex (Fin.castLE (by omega) i) = S.vertex i)) - (hUWl : U.length ≤ W.length) - (_ : - (∀ (i : Fin (U.length + (1 : ℕ))), - W.vertex (Fin.castLE (by omega) i) = U.vertex i)) - (i : Fin (S.length + (1 : ℕ))), U.vertex (Fin.castLE (by omega) i) = S.vertex i := by - classical - intro V E G e0 S U W hSU hSWl hSWv hUWl hUWv i - calc - U.vertex (Fin.castLE (Nat.succ_le_succ hSU) i) = - W.vertex (Fin.castLE (Nat.succ_le_succ hUWl) - (Fin.castLE (Nat.succ_le_succ hSU) i)) := - (hUWv _).symm - _ = W.vertex (Fin.castLE (Nat.succ_le_succ hSWl) i) := by congr 1 - _ = S.vertex i := hSWv i - -private theorem helper_commonPrefix_190.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) - (_ : TreeSequenceInitialSegment U W) (_ : S.length ≤ U.length), - TreeSequenceInitialSegment S U := by - classical - intro V E G e0 S U W hSW hUW hSU - rcases hSW with ⟨hSWl, hSWv, hSWe⟩ - rcases hUW with ⟨hUWl, hUWv, hUWe⟩ - refine ⟨hSU, ?_, ?_⟩ - · apply helper_branch_75 <;> assumption - · intro i - calc - U.edge (Fin.castLE hSU i) = W.edge (Fin.castLE hUWl (Fin.castLE hSU i)) := - (hUWe _).symm - _ = W.edge (Fin.castLE hSWl i) := by congr 1 - _ = S.edge i := hSWe i - private theorem helper_branch_110.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -251,90 +210,6 @@ private theorem helper_hlenBX_410.{u_1, u_2} : (Fin.last C.hierarchy.dividerCount)).length + (j - 2) ≤ T.length)] omega -private theorem helper_firstPositionBoundOnT_530.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - ∀ (_ : alpha ≠ beta) (_ : TreeSequenceInitialSegment B T) {rho : PartialEdgeColoring E k} - {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), (↑(HierarchyFirstMissingPosition rho T - eta) : ℕ) ≤ B.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B hne hB_T rho eta hm - unfold TreeMissingColors at hm - rcases Finset.mem_biUnion.mp hm with ⟨v, hv, hmiss⟩ - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, - true_and] at hv - rcases hv with ⟨i, rfl⟩ - let it : Fin (T.length + 1) := Fin.castLE - (Nat.succ_le_succ hB_T.1) i - have hmissT : eta ∈ MissingColors G rho (T.vertex it) := by - rw [hB_T.2.1 i] - exact hmiss - have hne : (Finset.univ : Finset (Fin (T.length + 1))).filter - (fun r => eta ∈ MissingColors G rho (T.vertex r)) |>.Nonempty := by - exact ⟨it, by simp [hmissT]⟩ - unfold HierarchyFirstMissingPosition - dsimp only - rw [dite_eq_left hne] - have hle := Finset.min'_le - ((Finset.univ : Finset (Fin (T.length + 1))).filter - (fun r => eta ∈ MissingColors G rho (T.vertex r))) it - (by simp [hmissT]) - exact le_trans hle (by simp [it]; omega) - -private theorem helper_firstPositionEqualOnTail_554.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : TreeSequenceInitialSegment B T) (_ : ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) (_ : ( - ∀ (eta : Fin k), HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition - P.coloring B eta)) (_ : ( - ∀ {rho : PartialEdgeColoring E k} {eta : Fin k} (_ : eta ∈ TreeMissingColors rho B), - (↑(HierarchyFirstMissingPosition rho T eta) : ℕ) ≤ B.length)), - ∀ eta ∈ TreeMissingColors P.coloring B, HierarchyFirstMissingPosition sigma T eta = - HierarchyFirstMissingPosition P.coloring T eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_T hB_missingEq - firstPositionOnB firstPositionBoundOnT eta hm - have hmSigma : eta ∈ TreeMissingColors sigma B := by - simp only [TreeMissingColors, Finset.mem_biUnion] at hm ⊢ - rcases hm with ⟨v, hv, hmiss⟩ - exact ⟨v, hv, by rw [hB_missingEq v hv]; exact hmiss⟩ - have hcutSigma := HierarchyFirstMissingPositionPrefixCutoff - sigma B T hB_T eta B.length le_rfl - have hcutPhi := HierarchyFirstMissingPositionPrefixCutoff - P.coloring B T hB_T eta B.length le_rfl - have htrunc : - min (HierarchyFirstMissingPosition sigma T eta).val B.length = - min (HierarchyFirstMissingPosition P.coloring T eta).val - B.length := by - calc - _ = min (HierarchyFirstMissingPosition sigma B eta).val - B.length := hcutSigma.symm - _ = min (HierarchyFirstMissingPosition P.coloring B eta).val - B.length := by rw [firstPositionOnB eta] - _ = _ := hcutPhi - have hboundSigma := firstPositionBoundOnT hmSigma - have hboundPhi := firstPositionBoundOnT hm - apply Fin.ext - rw [min_eq_left hboundSigma, min_eq_left hboundPhi] at htrunc - exact htrunc - private theorem helper_branch_303.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -812,39 +687,6 @@ private theorem helper_routeToX_714.{u_1, u_2} : hroute (seedPrefixX hadjoin hroute) hX_T)⟩ -private theorem helper_firstPositionOnB_760.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) (eta : - Fin k), HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition - P.coloring B eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_missingEq eta - let cs : Finset (Fin (B.length + 1)) := Finset.univ.filter - fun i => eta ∈ MissingColors G sigma (B.vertex i) - let cp : Finset (Fin (B.length + 1)) := Finset.univ.filter - fun i => eta ∈ MissingColors G P.coloring (B.vertex i) - have hsets : cs = cp := by - ext i - simp only [cs, cp, Finset.mem_filter, Finset.mem_univ, true_and] - have hv : B.vertex i ∈ TreeSequenceVertexSet B := by - simp [TreeSequenceVertexSet] - rw [hB_missingEq (B.vertex i) hv] - unfold HierarchyFirstMissingPosition - change (if h : cs.Nonempty then cs.min' h else Fin.last B.length) = - (if h : cp.Nonempty then cp.min' h else Fin.last B.length) - rw [hsets] - private theorem helper_firstPositionGloballyEqual_786.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -875,42 +717,6 @@ private theorem helper_firstPositionGloballyEqual_786.{u_1, u_2} : (if h : cp.Nonempty then cp.min' h else Fin.last T.length) rw [hsets] -private theorem helper_hstoredFirst_804.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let D : Finset (Fin k) := HierarchyStoredColorsAt H q; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (HierarchyPathNumber - C.hierarchy - (2 : ℕ)))) (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix - C (HierarchyPathNumber C.hierarchy - (2 : ℕ)))) (_ : ( - ∀ eta ∈ TreeMissingColors P.coloring B, HierarchyFirstMissingPosition sigma T eta = - HierarchyFirstMissingPosition P.coloring T eta)) (_ : ( - ∀ (eta : Fin k) (_ : eta ≠ alpha) (_ : eta ≠ beta), HierarchyFirstMissingPosition sigma T eta - = HierarchyFirstMissingPosition P.coloring T eta)), - ∀ eta ∈ D, HierarchyFirstMissingPosition sigma T eta = HierarchyFirstMissingPosition - P.coloring T eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H q j B D sigma hAlphaB hBetaB - firstPositionEqualOnTail firstPositionGloballyEqual eta hD - by_cases hα : eta = alpha - · subst eta - exact firstPositionEqualOnTail alpha hAlphaB - · by_cases hβ : eta = beta - · subst eta - exact firstPositionEqualOnTail beta hBetaB - · exact firstPositionGloballyEqual eta hα hβ - private theorem helper_fixedUntilSplitEnd_822.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1178,80 +984,6 @@ private theorem helper_oldSuffix_1100.{u_1, u_2} : · exact TashkinovAugmentationSequenceSuffix P.coloring seed X T hroute (seedPrefixX hadjoin hroute) hX_T -private theorem helper_hAlphaMissingX_1120.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (HierarchyPathNumber - C.hierarchy - (2 : ℕ)))) (_ : TreeSequenceInitialSegment B X) (_ : ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)), alpha - ∈ TreeMissingColors sigma X := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B X sigma hAlphaB hprefixB_X - hB_missingEq - unfold TreeMissingColors at hAlphaB ⊢ - rcases Finset.mem_biUnion.mp hAlphaB with ⟨v, hv, hmiss⟩ - refine Finset.mem_biUnion.mpr ⟨v, - TreeSequenceInitialSegmentVertexSetSubset hprefixB_X hv, ?_⟩ - rw [hB_missingEq v hv] - exact hmiss - -private theorem helper_hBetaMissingX_1127.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (HierarchyPathNumber - C.hierarchy - (2 : ℕ)))) (_ : TreeSequenceInitialSegment B X) (_ : ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)), beta - ∈ TreeMissingColors sigma X := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B X sigma hBetaB hprefixB_X - hB_missingEq - unfold TreeMissingColors at hBetaB ⊢ - rcases Finset.mem_biUnion.mp hBetaB with ⟨v, hv, hmiss⟩ - refine Finset.mem_biUnion.mpr ⟨v, - TreeSequenceInitialSegmentVertexSetSubset hprefixB_X hv, ?_⟩ - rw [hB_missingEq v hv] - exact hmiss - -private theorem helper_missingOnB_1178.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G P.coloring alpha beta (Sum.inl - (T.vertex (Fin.last T.length))); - ∀ (_ : ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G sigma v = MissingColors G P.coloring v)) - {c : Fin k} (_ : c ∈ TreeMissingColors P.coloring B), c ∈ TreeMissingColors sigma B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B sigma hB_missingEq c hc - obtain ⟨v, hv, hm⟩ := Finset.mem_biUnion.mp hc - exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [hB_missingEq v hv]; exact hm⟩ - private theorem helper_oldMissingOnZ_1182.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1377,32 +1109,6 @@ private theorem helper_branch_1223.{u_1, u_2} : have hj : 2 ≤ j := hpathLower omega -private theorem helper_branch_1230.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let j : ℕ := HierarchyPathNumber C.hierarchy; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - ∀ (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (HierarchyPathNumber - C.hierarchy - (2 : ℕ)))) (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix - C (HierarchyPathNumber C.hierarchy - (2 : ℕ)))), - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - ∀ (_ : HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength P.counterexample - (1 - : ℕ)) = Z) (_ : ( - ∀ {c : Fin k} (_ : c ∈ TreeMissingColors P.coloring B), c ∈ TreeMissingColors P.coloring Z)), - let B : TreeSequence G e0 := HierarchyFullTailPrefix P.counterexample (HierarchyFullTailLength - P.counterexample - (1 : ℕ)); alpha ∈ TreeMissingColors P.coloring B ∧ beta ∈ - TreeMissingColors P.coloring B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta j B hAlphaB hBetaB Z hZeq - oldMissingOnZ - rw [hZeq] - exact ⟨oldMissingOnZ hAlphaB, oldMissingOnZ hBetaB⟩ - private theorem helper_branch_1232.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1524,10 +1230,16 @@ private theorem helper_continuation_2539.{u_1, u_2} : have firstPositionGloballyEqual := @helper_firstPositionGloballyEqual_786 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hne) - have hstoredFirst := @helper_hstoredFirst_804 (@V) (@E) inferInstance inferInstance - inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) (@alpha) (@beta) (@hAlphaB) (@hBetaB) (@firstPositionEqualOnTail) - (@firstPositionGloballyEqual) + have hstoredFirst : ∀ eta ∈ D, HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition P.coloring T eta := by + intro eta _ + by_cases isAlpha : eta = alpha + · subst eta + exact firstPositionEqualOnTail alpha hAlphaB + · by_cases isBeta : eta = beta + · subst eta + exact firstPositionEqualOnTail beta hBetaB + · exact firstPositionGloballyEqual eta isAlpha isBeta have hgammaCutoff := @helper_hgammaCutoff_610 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hAlphaChoice) (@hBetaNotGamma) (@hprefixB_X) @@ -1542,9 +1254,9 @@ private theorem helper_continuation_2539.{u_1, u_2} : have hseparated := @helper_hseparated_657 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hsplitAvoid) (@hB_T) (@hprefixB_X) (@hlenBX) (@firstPositionBoundOnT) (@hXlen) - have missingOnB := @helper_missingOnB_1178 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) - (@beta) (@hB_missingEq) + have missingOnB {color : Fin k} (member : color ∈ TreeMissingColors P.coloring B) : + color ∈ TreeMissingColors sigma B := by + rwa [TreeMissingColors.congr hB_missingEq] have oldMissingOnZ := @helper_oldMissingOnZ_1182 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hprefixB_X) (@hX_Z) @@ -1587,9 +1299,8 @@ private theorem helper_continuation_2539.{u_1, u_2} : · exact @helper_branch_1223 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hpathLower) (@fixedUntilSplitEnd) (@hXlen) - · exact @helper_branch_1230 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) - (@hAlphaB) (@hBetaB) (@hZeq) (@oldMissingOnZ) + · rw [hZeq] + exact ⟨oldMissingOnZ hAlphaB, oldMissingOnZ hBetaB⟩ · exact @helper_branch_1232 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hAlphaTerminal) (@hne) @@ -1741,28 +1452,26 @@ private theorem helper_continuation_1137.{u_1, u_2} : have routeToX := @helper_routeToX_714 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hX_T) (@hTnX) (@terminalRoute) (@seedPrefixX) (@switchedRoute) - have hAlphaMissingX := @helper_hAlphaMissingX_1120 (@V) (@E) inferInstance inferInstance - inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) (@alpha) (@beta) (@hAlphaB) (@hprefixB_X) (@hB_missingEq) - have hBetaMissingX := @helper_hBetaMissingX_1127 (@V) (@E) inferInstance inferInstance - inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) (@alpha) (@beta) (@hBetaB) (@hprefixB_X) (@hB_missingEq) + have hAlphaMissingX : alpha ∈ TreeMissingColors sigma X := by + apply TreeSequenceInitialSegment.treeMissingColors_subset hprefixB_X + rwa [TreeMissingColors.congr hB_missingEq] + have hBetaMissingX : beta ∈ TreeMissingColors sigma X := by + apply TreeSequenceInitialSegment.treeMissingColors_subset hprefixB_X + rwa [TreeMissingColors.congr hB_missingEq] have hsplitMissing : alpha ∈ TreeMissingColors sigma X ∧ beta ∈ TreeMissingColors sigma X := ⟨hAlphaMissingX, hBetaMissingX⟩ have switchedSuffix : TashkinovAugmentationSequence sigma X T := TashkinovAugmentationSequenceComponentSwap G k e0 P.coloring alpha beta hne (Sum.inl (T.vertex (Fin.last T.length))) X T oldSuffix hsplitMissing.1 hsplitMissing.2 - have firstPositionOnB := @helper_firstPositionOnB_760 (@V) (@E) inferInstance inferInstance - inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) (@alpha) (@beta) (@hB_missingEq) - have firstPositionBoundOnT := @helper_firstPositionBoundOnT_530 (@V) (@E) inferInstance - inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) - (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hne) (@hB_T) - have firstPositionEqualOnTail := @helper_firstPositionEqualOnTail_554 (@V) (@E) inferInstance - inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) - (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hB_T) (@hB_missingEq) (@firstPositionOnB) - (@firstPositionBoundOnT) + have firstPositionBoundOnT {rho : PartialEdgeColoring E k} {eta : Fin k} + (missing : eta ∈ TreeMissingColors rho B) : + (HierarchyFirstMissingPosition rho T eta).val ≤ B.length := + TreeSequenceFirstMissingPositionLePrefix hB_T missing + have firstPositionEqualOnTail (eta : Fin k) (missing : eta ∈ TreeMissingColors P.coloring B) : + HierarchyFirstMissingPosition sigma T eta = + HierarchyFirstMissingPosition P.coloring T eta := + TreeSequenceFirstMissingPositionCongrOfPrefix hB_T hB_missingEq missing exact @helper_continuation_2539 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hpathLower) (@hpathUpper) (@hAlphaTerminal) (@hAlphaB) (@hAlphaChoice) @@ -1889,7 +1598,10 @@ theorem P2880_T1_CommonPreparation have hA_T : TreeSequenceInitialSegment A T := by rw [← hstar] exact hstarToTOriginal - have commonPrefix := @helper_commonPrefix_190 (@V) (@E) (@G) (@e0) + have commonPrefix {S U W : TreeSequence G e0} + (hSW : TreeSequenceInitialSegment S W) (hUW : TreeSequenceInitialSegment U W) + (bound : S.length ≤ U.length) : TreeSequenceInitialSegment S U := + hUW.of_common_extension hSW bound have hprefixA_B := @helper_hprefixA_B_507 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hpathLower) (@hstar) (@hstarToTOriginal) @@ -1923,16 +1635,8 @@ theorem P2880_T1_CommonPreparation (Fin.last C.hierarchy.dividerCount)).length + j) T.length exact min_le_min (by omega) le_rfl have prefixTrans {S U W : TreeSequence G e0} - (hSU : TreeSequenceInitialSegment S U) - (hUW : TreeSequenceInitialSegment U W) : - TreeSequenceInitialSegment S W := by - rcases hSU with ⟨hSUl, hSUv, hSUe⟩ - rcases hUW with ⟨hUWl, hUWv, hUWe⟩ - refine ⟨hSUl.trans hUWl, ?_, ?_⟩ - · intro i - exact (hUWv (Fin.castLE (Nat.succ_le_succ hSUl) i)).trans (hSUv i) - · intro i - exact (hUWe (Fin.castLE hSUl i)).trans (hSUe i) + (hSU : TreeSequenceInitialSegment S U) (hUW : TreeSequenceInitialSegment U W) : + TreeSequenceInitialSegment S W := hSU.trans hUW have stageSegment := @helper_stageSegment_583 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@prefixTrans) diff --git a/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean b/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean index 838b26f6b8..ae5f644976 100644 --- a/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean +++ b/LeanPool/GoldbergSeymour/TerminalKempeStageSwitch.lean @@ -7,7 +7,6 @@ module public import LeanPool.GoldbergSeymour.SharedFacts.TerminalKempeStageSwitch -public import LeanPool.GoldbergSeymour.TreeSequenceColoringFacts public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentationTrans public import LeanPool.GoldbergSeymour.ElementaryTerminalComponent diff --git a/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean b/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean index 75036094bb..79625b4062 100644 --- a/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean +++ b/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean @@ -143,6 +143,41 @@ theorem TreeSequenceInitialSegment.treeMissingColors_subset {V E : Type*} [Finty obtain ⟨vertex, inInitial, missing⟩ := Finset.mem_biUnion.mp membership exact Finset.mem_biUnion.mpr ⟨vertex, segment.vertexSet_subset inInitial, missing⟩ + +/-- Pointwise equality of missing colors on a tree preserves its missing-color union. -/ +theorem TreeMissingColors.congr {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {tree : TreeSequence G e0} + {first second : PartialEdgeColoring E k} + (equal : ∀ vertex ∈ TreeSequenceVertexSet tree, + MissingColors G first vertex = MissingColors G second vertex) : + TreeMissingColors first tree = TreeMissingColors second tree := by + classical + unfold TreeMissingColors + apply Finset.biUnion_congr rfl + exact equal + +/-- Pointwise equality of missing colors preserves the first missing position. -/ +theorem TreeSequenceFirstMissingPositionCongr {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {tree : TreeSequence G e0} + {first second : PartialEdgeColoring E k} + (equal : ∀ vertex ∈ TreeSequenceVertexSet tree, + MissingColors G first vertex = MissingColors G second vertex) (color : Fin k) : + HierarchyFirstMissingPosition first tree color = + HierarchyFirstMissingPosition second tree color := by + classical + let firstCandidates := Finset.univ.filter + fun index : Fin (tree.length + 1) => color ∈ MissingColors G first (tree.vertex index) + let secondCandidates := Finset.univ.filter + fun index : Fin (tree.length + 1) => color ∈ MissingColors G second (tree.vertex index) + have candidatesEqual : firstCandidates = secondCandidates := by + ext index + simp only [firstCandidates, secondCandidates, Finset.mem_filter, Finset.mem_univ, true_and] + rw [equal (tree.vertex index) (by simp [TreeSequenceVertexSet])] + unfold HierarchyFirstMissingPosition + change (if h : firstCandidates.Nonempty then firstCandidates.min' h else Fin.last tree.length) = + (if h : secondCandidates.Nonempty then secondCandidates.min' h else Fin.last tree.length) + rw [candidatesEqual] + end GoldbergSeymour end From 83a7892fd2c13461c8c03ebcbd7c406906574979 Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Thu, 5 Nov 2026 21:41:55 -0800 Subject: [PATCH 10/11] Share Goldberg-Seymour proof facts and remove private forwarding layers --- .../ChangeLemmaBothOutside/Preparation1.lean | 75 +- .../ChangeLemmaMixedLargestClosed.lean | 139 +- .../EligibleIndexBoundPreparation.lean | 87 +- ...archySituationOneAdvanceOutsideStored.lean | 400 +---- ...hySituationOneShorteningContradiction.lean | 1396 +---------------- ...ySituationThreeClaimJMinusOneNonempty.lean | 151 +- ...ionThreeDisjointThetaStoredImpossible.lean | 230 +-- ...ointThetaUnstoredBetaStoredImpossible.lean | 236 +-- LeanPool/GoldbergSeymour/Imports.lean | 2 + .../SharedFacts/DisjointThetaProofs.lean | 251 +++ .../SharedFacts/ShorteningProofs.lean | 473 ++++++ 11 files changed, 892 insertions(+), 2548 deletions(-) create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaProofs.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ShorteningProofs.lean diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean index ca21f71cbb..090395682e 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean @@ -13,6 +13,7 @@ public import LeanPool.GoldbergSeymour.HierarchySplitter public import LeanPool.GoldbergSeymour.SameHierarchyStages public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequencePosition public import LeanPool.GoldbergSeymour.LowerRoundInductionHypothesis +public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation2 /-! # ChangeLemmaBothOutside: supporting constructions, part 1 @@ -1074,43 +1075,7 @@ theorem helper_missingBefore_438.{u_1, u_2} : ∀ v ∈ TreeSequenceVertexSet B, v ≠ vb → MissingColors G sigma v = MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ia ib va vb ell yLength Y - hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb - by_cases hvK : Sum.inl v ∈ K - · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) - have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv - have han : alpha ∉ MissingColors G phi v := fun hc => - Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 - have hbn : beta ∉ MissingColors G phi v := fun hc => - Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 - have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by - simpa [MissingColors, PresentColors] using han - have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by - simpa [MissingColors, PresentColors] using hbn - obtain ⟨fa, hfa, hfca⟩ := hpa - obtain ⟨fb, hfb, hfcb⟩ := hpb - have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) - have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) - have hnewa : sigma fb = some alpha := by - simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] - have hnewb : sigma fa = some beta := by - simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] - have hana : alpha ∉ MissingColors G sigma v := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, - PresentColors, Finset.mem_filter, not_not] - exact ⟨fb, hfb, hnewa⟩ - have hbnb : beta ∉ MissingColors G sigma v := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, - PresentColors, Finset.mem_filter, not_not] - exact ⟨fa, hfa, hnewb⟩ - ext c - by_cases hca : c = alpha - · subst c; simp [hana, han] - · by_cases hcb : c = beta - · subst c; simp [hbnb, hbn] - · exact behavior.2.2.2 v c hca hcb - · exact behavior.1 v hvK + exact @GoldbergSeymour.SharedFacts.MixedChangeTransport.notMissingBeforeFirstPosition theorem helper_terminalRoute_532.{u_1, u_2} : open scoped Classical in @@ -1983,26 +1948,7 @@ theorem helper_firstMissing_1057.{u_1, u_2} : ∀ c ∈ TreeMissingColors phi Y, c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell yLength Y YToT c hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - obtain ⟨i, hi⟩ := hv - let it := Fin.castLE (Nat.succ_le_succ YToT.1) i - have hci : c ∈ MissingColors G phi (T.vertex it) := by - rw [YToT.2.1 i, hi] - exact hcv - let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) - have hit : it ∈ candidates := by simp [candidates, hci] - have hnon : candidates.Nonempty := ⟨it, hit⟩ - have hmem := Finset.min'_mem candidates hnon - have hle := Finset.min'_le candidates it hit - refine ⟨?_, ?_⟩ - · simpa [HierarchyFirstMissingPosition, candidates, hnon] using - (Finset.mem_filter.mp hmem).2 - · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt - have hval : (candidates.min' hnon).val ≤ it.val := hle - simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv + exact @GoldbergSeymour.SharedFacts.MixedChangeTransport.firstMissingPositionWitness /-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_outsideIndex_1087.{u_1, u_2} : @@ -3171,20 +3117,7 @@ theorem helper_missingEq_1447.{u_1, u_2} : coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; ∀ (j : Fin (count + (1 : ℕ))), HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - refine Fin.cases ?_ (fun i => ?_) j - · change TreeMissingColors sigma (corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn - have htree : corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc = Tn := - hsbase.symm.trans hbbase - rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] - · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) + exact @GoldbergSeymour.SharedFacts.MixedChangeTransport.missingColorsEquality theorem helper_firstEq_1458.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean index ec8291091b..3c28c97ed8 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean @@ -4164,112 +4164,30 @@ private theorem helper_storedS_1119.{u_1, u_2} : unfold Dn TashkinovStoredColors simp only [ettB, hstored, ← hgen, ← ett.generatingColoring, htree, hm, n, Tn] -private theorem helper_stageBToB_1145.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi) - (HB : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB) - (j : Fin (HB.dividerCount + (2 : ℕ))), - TreeSequenceInitialSegment (HB.stage j) B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib segRefl segTrans hAib B - rpB aboveB strictB belowB genB baseB HB j - clear * - HB j B segRefl segTrans +private theorem hierarchyStageInitialSegment {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {tree : TreeSequence G e0} {generating coloring : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input tree generating} {base : HierarchyBase ett coloring} + (hierarchy : TashkinovHierarchy ett base) (index : Fin (hierarchy.dividerCount + 2)) : + TreeSequenceInitialSegment (hierarchy.stage index) tree := by exact Fin.reverseInduction - (motive := fun j => TreeSequenceInitialSegment (HB.stage j) B) - (by simpa only [HB.terminalStage] using segRefl B) - (fun i hi => segTrans (HB.nested i) hi) j + (motive := fun index => TreeSequenceInitialSegment (hierarchy.stage index) tree) + (by simpa only [hierarchy.terminalStage] using TreeSequenceInitialSegment.refl tree) + (fun index segment => (hierarchy.nested index).trans segment) index -private theorem helper_closureBToA_1152.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - TreeSequenceInitialSegment base.core A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - baseB.core = base.core → - ett.series.data.kind n = some TashkinovExtensionKind.PE → - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by +private theorem parallelClosureVertexSubsetCore {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} + {tree : TreeSequence G e0} {generating coloring : PartialEdgeColoring E k} + {ett : ExtendedTashkinovTree G k e0 input tree generating} (base : HierarchyBase ett coloring) + (parallel : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet base.core := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n ib coreToA hAib B rpB - aboveB strictB belowB genB baseB hcoreB hp - clear * - hp baseB coreToA hcoreB - obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hp - intro v hv - apply TreeSequenceInitialSegmentVertexSetSubset coreToA - rw [← hcoreB, u.vertexSet] - exact Finset.mem_union_right _ hv + obtain ⟨_, _, ⟨union⟩⟩ := base.parallel parallel + intro vertex member + rw [union.vertexSet] + exact Finset.mem_union_right _ member private theorem helper_minusEq_1160.{u_1, u_2} : open scoped Classical in @@ -6387,14 +6305,13 @@ private theorem helper_continuation_5082.{u_1, u_2} : clear * - hstagesB starredToA j rw [(hstagesB j).2] exact starredToA _ - have stageBToB := - helper_stageBToB_1145 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@segRefl) (@segTrans) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) - (@baseB) (@HB) - have closureBToA := - helper_closureBToA_1152 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@alpha) (@beta) (@r) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) - (@baseB) (@hcoreB) + have stageBToB := hierarchyStageInitialSegment HB + have closureBToA (parallel : ett.series.data.kind n = some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + intro vertex member + apply TreeSequenceInitialSegmentVertexSetSubset coreToA + rw [← hcoreB] + exact parallelClosureVertexSubsetCore baseB parallel member have minusEq := helper_minusEq_1160 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@RToA) diff --git a/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean b/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean index 6fcfc592db..b21be1f887 100644 --- a/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean +++ b/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean @@ -12,6 +12,7 @@ public import LeanPool.GoldbergSeymour.TerminalRoute public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices public import LeanPool.GoldbergSeymour.HierarchySplitter public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport +public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningProofs /-! # Hierarchy Situation Three Eligible Index Bound @@ -2208,36 +2209,7 @@ theorem helper_hsproper_329.{u_1, u_2} : let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; (∀ (e : E), e ≠ f → sigma e = mu e) → IsProperEdgeColoring G sigma := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha haT mu trans hlenT B halphaB r f y - w hends sigma fixed e g c heg hadj he hg - by_cases hef : e = f - · subst e - have hgf : g ≠ f := heg.symm - have hc : c = alpha := by simpa [sigma] using he.symm - subst c - rw [fixed g hgf] at hg - obtain ⟨v, hvf, hvg⟩ := hadj - have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf - rcases hv with rfl | rfl - · exact (Finset.mem_sdiff.mp halphaB).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) - · exact (Finset.mem_sdiff.mp haT).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) - · by_cases hgf : g = f - · subst g - have hc : c = alpha := by simpa [sigma] using hg.symm - subst c - rw [fixed e hef] at he - obtain ⟨v, hve, hvf⟩ := hadj - have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf - rcases hv with rfl | rfl - · exact (Finset.mem_sdiff.mp halphaB).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) - · exact (Finset.mem_sdiff.mp haT).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) - · exact P.minimumContext.proper heg hadj ((fixed e hef).symm.trans he) - ((fixed g hgf).symm.trans hg) + exact @GoldbergSeymour.SharedFacts.ShorteningProofs.properRecoloring theorem helper_hdata_519.{u_1, u_2} : open scoped Classical in @@ -2611,28 +2583,11 @@ theorem helper_terminalStored_647.{u_1, u_2} : S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree - rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ - rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ - cases hr - have hs : data = rs := eq_of_heq hp - cases hs - let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ - have hj : j.succ = Fin.last EB.rounds := Fin.ext (by - dsimp [j]; have := EB.roundsPositive; omega) - have ht : rs.data.tree (Fin.last EB.rounds).castSucc = Tn := by - change rs.data.tree (Fin.last EB.rounds).castSucc = - EB.series.data.tree (Fin.last EB.rounds).castSucc - rw [← hj]; exact hl j - have hm : TreeMissingColors (rs.data.coloring (Fin.last EB.rounds)) - (rs.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by - rw [← hc, ht] - exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX) - have hmOld : TreeMissingColors (EB.series.data.coloring (Fin.last EB.rounds)) - (EB.series.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by - rw [← EB.generatingColoring] - change TashkinovStoredColors rs.data (Fin.last EB.rounds) = - TashkinovStoredColors EB.series.data (Fin.last EB.rounds) - simp only [TashkinovStoredColors, hstored, hm, hmOld] + exact GoldbergSeymour.SharedFacts.ShorteningProofs.terminalStoredColors + G k e0 input T phi ett base C ctx P alpha hlenT hTnX S hSBlen missingTree positiveB aboveB + strictB belowB generatingB baseB HB corr hmaximum bs hcore hpe hclosure baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK hstage + hposition starredEq terminalTree theorem helper_hpS_844.{u_1, u_2} : open scoped Classical in @@ -4858,33 +4813,7 @@ theorem helper_lastOrdinary_2387.{u_1, u_2} : theorem helper_uniqueRefresh_4523.{u_1, u_2} : helperUniqueRefresh4523Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f sigma missingFixed - positiveB aboveB strictB belowB generatingB baseB HB goodB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq - stageBX storedEq i - have hnew : - ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun v => MissingColors G sigma v) = - ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun v => MissingColors G mu v) := by - apply Finset.biUnion_congr rfl - intro v hv - exact missingFixed v (TreeSequenceInitialSegmentVertexSetSubset (stageBX i.succ) - (Finset.mem_sdiff.mp hv).1) - change ∃! c : Fin k, - c ∈ HierarchyStoredColorsAt KF i.succ ∧ - goodB.gamma i.succ c ⊆ - ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion - fun v => MissingColors G sigma v) ∧ - ∀ d ∈ HierarchyStoredColorsAt KF i.succ, d ≠ c → - goodB.gamma i.succ d = goodB.gamma i.castSucc d - rw [starredEq i.castSucc, hnew] - simp only [storedEq] - exact goodB.uniqueRefresh i + exact @GoldbergSeymour.SharedFacts.ShorteningProofs.uniqueRefreshTransport theorem helper_parallelBase_4547.{u_1, u_2} : helperParallelBase4547Conditions.{u_1, u_2} := by diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean index f5d6b7a747..57805b8998 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean @@ -1055,395 +1055,6 @@ private theorem helper_elementary_1593.{u_1, u_2} : intro u hu v hv hne exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne -private theorem helper_advance_1736.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber - C.hierarchy = (1 : ℕ) → ( - ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → - ∀ (v : V), (MissingColors G mu v).Nonempty) → - ∀ (_ : ℕ), ( - ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → - ∀ (B : Finset V), ColoredVertexSetElementary G psi B → - ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ - MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → - TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → - Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl - u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ - ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi - x) → ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z - → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) → TreeSequenceInitialSegment A T → - ∀ (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); TreeSequenceInitialSegment B T → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = B) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → - (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G - e0), TreeSequenceInitialSegment A X → A.length < X.length → TreeSequenceInitialSegment X B - → - ∀ (a b eta : Fin k), eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring - T eta) : ℕ) ≤ X.length → - ∀ (jb : Fin (B.length + (1 : ℕ))), A.length < (↑jb : ℕ) → (↑jb : ℕ) ≤ X.length → b ∈ - MissingColors G R.coloring (B.vertex jb) → a ∈ MissingColors G R.coloring (T.vertex - (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some - a) → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some - b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → - ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ - ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = - R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → - b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G - R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex - (Fin.last T.length)))) → ( - ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = - S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), - eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition - R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))), A.length < (↑j : ℕ) → c ∈ MissingColors G R.coloring (B.vertex - j) → c ∉ TreeMissingColors R.coloring A) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), (1 : ℕ) ≤ - j → j < T.length - A.length → - ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last - (HierarchyFullTailPrefix C j).length)), - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = - some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → ( - ∀ (t : Fin T.length), A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ) → G.ends (T.edge - t) = s(T.vertex t.castSucc, T.vertex t.succ)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), - ∀ (f : E), - ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, - R.coloring f ≠ some a) → - ∀ (m : ℕ), HierarchyPathNumber C.hierarchy ≤ m → m < HierarchyFullTailLength C - (1 : ℕ) → - ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C m).vertex (Fin.last - (HierarchyFullTailPrefix C m).length)), alpha ∈ MissingColors G P.coloring (T.vertex - (Fin.last T.length)) → alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) → m + (1 : ℕ) ∈ - HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i componentData - trans common A starEq hAT hlen B hBT fullB elementary vertexMem firstAt stageSwitch - gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m hmLower - hmUpper P alpha ha haLast hAlphaStored - exact @helper_advance_481 V E inferInstance inferInstance inferInstance inferInstance G k - e0 input T phi ett base C ctx hsituation hvertexMissing i P alpha componentData trans - common starEq hAT hlen hBT fullB elementary vertexMem firstAt stageSwitch - gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m - hmLower hmUpper P alpha ha haLast hAlphaStored - -private theorem helper_advance_2294.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber - C.hierarchy = (1 : ℕ) → ( - ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → - ∀ (v : V), (MissingColors G mu v).Nonempty) → - ∀ (_ : ℕ), ( - ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → - ∀ (B : Finset V), ColoredVertexSetElementary G psi B → - ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ - MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → - TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → - Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl - u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ - ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi - x) → ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z - → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) → ( - have A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); TreeSequenceInitialSegment A T) → - ∀ (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); TreeSequenceInitialSegment B T → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = B) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → - (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G - e0), TreeSequenceInitialSegment A X → A.length < X.length → TreeSequenceInitialSegment X B - → - ∀ (a b eta : Fin k), eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring - T eta) : ℕ) ≤ X.length → - ∀ (jb : Fin (B.length + (1 : ℕ))), A.length < (↑jb : ℕ) → (↑jb : ℕ) ≤ X.length → b ∈ - MissingColors G R.coloring (B.vertex jb) → a ∈ MissingColors G R.coloring (T.vertex - (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some - a) → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some - b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → - ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ - ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = - R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → - b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G - R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex - (Fin.last T.length)))) → ( - ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = - S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), - eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition - R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))), A.length < (↑j : ℕ) → c ∈ MissingColors G R.coloring (B.vertex - j) → c ∉ TreeMissingColors R.coloring A) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), (1 : ℕ) ≤ - j → j < T.length - A.length → - ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last - (HierarchyFullTailPrefix C j).length)), - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = - some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → ( - ∀ (t : Fin T.length), A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ) → G.ends (T.edge - t) = s(T.vertex t.castSucc, T.vertex t.succ)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), - ∀ (f : E), - ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, - R.coloring f ≠ some a) → - ∀ (m : ℕ), HierarchyPathNumber C.hierarchy ≤ m → m < HierarchyFullTailLength C - (1 : ℕ) → - ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C m).vertex (Fin.last - (HierarchyFullTailPrefix C m).length)), alpha ∈ MissingColors G P.coloring (T.vertex - (Fin.last T.length)) → alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) → m + (1 : ℕ) ∈ - HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i componentData - trans common A starEq hAT hlen B hBT fullB elementary vertexMem firstAt stageSwitch - gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m hmLower - hmUpper P alpha ha haLast hAlphaStored - exact @helper_advance_1736 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@hsituation) (@hvertexMissing) (@i) (@componentData) (@trans) (@common) (@starEq) - (@hAT) (@hlen) (@hBT) (@fullB) (@elementary) (@vertexMem) (@firstAt) (@stageSwitch) - (@gammaTransport) (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) - (@gammaChoice) (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored) - -private theorem helper_advance_2571.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : - HierarchyPathNumber C.hierarchy = (1 : ℕ)) (_ : - ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → - ∀ (v : V), (MissingColors G mu v).Nonempty) (_ : ℕ) (_ : - ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (_ : a ≠ b) (_ : IsProperEdgeColoring G psi) - (B : Finset V) (_ : ColoredVertexSetElementary G psi B) (u v w : V) (_ : u ∈ B) (_ : v ∈ - B) (_ : u ≠ v) (_ : w ≠ u) (_ : w ≠ v) (_ : a ∈ MissingColors G psi u) (_ : b ∈ - MissingColors G psi v) (_ : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) (_ : - TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v)), - Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl - u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ - ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi - x) (_ : - ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : - TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) (_ : - ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : - TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X - Y), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); - ∀ (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) (_ : - have A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); TreeSequenceInitialSegment A T) (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - omega - ) ( - by - omega - ); - ∀ (_ : TreeSequenceInitialSegment B T) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = B) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) (_ : - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), - (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G - e0) (_ : TreeSequenceInitialSegment A X) (_ : A.length < X.length) (_ : - TreeSequenceInitialSegment X B) (a b eta : Fin k) (_ : eta ∈ HierarchyStoredColorsAt - R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)) (_ : a ∈ - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) (_ : - (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length) (jb : Fin (B.length + - (1 : ℕ))) (_ : A.length < (↑jb : ℕ)) (_ : (↑jb : ℕ) ≤ X.length) (_ : b ∈ MissingColors G - R.coloring (B.vertex jb)) (_ : a ∈ MissingColors G R.coloring (T.vertex (Fin.last - T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length))) (_ : - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some - a) (_ : - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some - b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)), - ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ - ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = - R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → - b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G - R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex - (Fin.last T.length)))) (_ : - ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta : Fin k) (_ - : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount)), eta ∈ HierarchyStoredColorsAt - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = - S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k) (_ - : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount)) (_ : a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta) (t : Fin T.length) (_ : A.length ≤ (↑t : ℕ)) - (_ : (↑t : ℕ) < (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ)), R.coloring - (T.edge t) ≠ some a) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))) (_ : A.length < (↑j : ℕ)) (_ : c ∈ MissingColors G R.coloring - (B.vertex j)), c ∉ TreeMissingColors R.coloring A) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (_ : c - ∉ TreeMissingColors R.coloring A) (_ : c ∉ HierarchyStoredColorsAt - R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)), c ∉ - TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : (1 : - ℕ) ≤ j) (_ : j < T.length - A.length) (c : Fin k) (_ : c ∈ MissingColors G R.coloring - ((HierarchyFullTailPrefix C j).vertex (Fin.last (HierarchyFullTailPrefix C j).length))) (t - : Fin T.length) (_ : A.length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < A.length + j) (_ : R.coloring - (T.edge t) = some c), TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree - (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ - TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) (_ : - ∀ (t : Fin T.length) (_ : A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ)), G.ends - (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta : Fin k) (_ : - eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount)) (f : E), - ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, - R.coloring f ≠ some a) (m : ℕ) (_ : HierarchyPathNumber C.hierarchy ≤ m) (_ : m < - HierarchyFullTailLength C - (1 : ℕ)) (P : HierarchyReplacementPresentation G k e0 input T - phi ett base C ctx) (alpha : Fin k) (_ : alpha ∈ MissingColors G P.coloring - ((HierarchyFullTailPrefix C m).vertex (Fin.last (HierarchyFullTailPrefix C m).length))) (_ - : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) (_ : alpha ∉ - HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last - P.counterexample.hierarchy.dividerCount)), m + (1 : ℕ) ∈ - HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i componentData - trans common A starEq hAT hlen B hBT fullB elementary vertexMem firstAt stageSwitch - gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m hmLower - hmUpper P alpha ha haLast hAlphaStored - exact @helper_advance_2294 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@hsituation) (@hvertexMissing) (@i) (@componentData) (@trans) (@common) (@starEq) - (@hAT) (@hlen) (@hBT) (@fullB) (@elementary) (@vertexMem) (@firstAt) (@stageSwitch) - (@gammaTransport) (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) - (@gammaChoice) (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored) - theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) @@ -1660,12 +1271,11 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} (hAlphaStored : alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount)) : m + 1 ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - exact @helper_advance_2571 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@hsituation) (@hvertexMissing) (@i) (@componentData) (@trans) (@common) (@starEq) - (@hAT) (@hlen) (@hBT) (@fullB) (@elementary) (@vertexMem) (@firstAt) (@stageSwitch) - (@gammaTransport) (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) - (@gammaChoice) (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored) + exact @helper_advance_481 V E inferInstance inferInstance inferInstance inferInstance G k + e0 input T phi ett base C ctx hsituation hvertexMissing i P alpha componentData trans + common starEq hAT hlen hBT fullB elementary vertexMem firstAt stageSwitch + gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m + hmLower hmUpper P alpha ha haLast hAlphaStored exact advance i (by simpa only [hsituation] using hiLower) hiUpper P alpha hcommon.1 hcommon.2 houtside diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean index b8fbf2a39e..e7fb9d0ab9 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean @@ -13,6 +13,7 @@ public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningProofs /-! # Hierarchy Situation One Shortening Contradiction @@ -857,163 +858,6 @@ private abbrev helperUniqueRefresh4832Conditions.{u_1, u_2} : Prop := ∀ theta ∈ HierarchyStoredColorsAt KF i.succ, theta ≠ eta → goodB.gamma i.succ theta = goodB.gamma i.castSucc theta -private abbrev helperTerminalStored5253Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); - let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); - ∀ (hTnX : TreeSequenceInitialSegment Tn X), - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length), - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ - (missingTree : - ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), - TreeMissingColors sigma U = TreeMissingColors mu U) - (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB belowB - generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (hmaximum : MaximumProperty corr.replacementETT) - (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) - (hpe : - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind - (Fin.last - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) - (hclosure : - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { - dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (hstage : - HB.stage ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }.stage) - (hposition : - HB.dividerPosition ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.dividerPosition) - (starredEq : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) - (terminalTree : - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - TashkinovStoredColors EB.series.data (Fin.last EB.rounds) - private abbrev helperLastStar5360Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] @@ -1719,36 +1563,7 @@ private theorem helper_hsproper_482.{u_1, u_2} : let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; (∀ (e : E), e ≠ f → sigma e = mu e) → IsProperEdgeColoring G sigma := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha haT mu trans hlenT B halphaB r f y - w hends sigma fixed e g c heg hadj he hg - by_cases hef : e = f - · subst e - have hgf : g ≠ f := heg.symm - have hc : c = alpha := by simpa [sigma] using he.symm - subst c - rw [fixed g hgf] at hg - obtain ⟨v, hvf, hvg⟩ := hadj - have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf - rcases hv with rfl | rfl - · exact (Finset.mem_sdiff.mp halphaB).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) - · exact (Finset.mem_sdiff.mp haT).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) - · by_cases hgf : g = f - · subst g - have hc : c = alpha := by simpa [sigma] using hg.symm - subst c - rw [fixed e hef] at he - obtain ⟨v, hve, hvf⟩ := hadj - have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf - rcases hv with rfl | rfl - · exact (Finset.mem_sdiff.mp halphaB).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) - · exact (Finset.mem_sdiff.mp haT).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) - · exact P.minimumContext.proper heg hadj ((fixed e hef).symm.trans he) - ((fixed g hgf).symm.trans hg) + exact @GoldbergSeymour.SharedFacts.ShorteningProofs.properRecoloring private theorem helper_terminalStored_720.{u_1, u_2} : open scoped Classical in @@ -1923,28 +1738,11 @@ private theorem helper_terminalStored_720.{u_1, u_2} : S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree - rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ - rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ - cases hr - have hs : data = rs := eq_of_heq hp - cases hs - let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ - have hj : j.succ = Fin.last EB.rounds := Fin.ext (by - dsimp [j]; have := EB.roundsPositive; omega) - have ht : rs.data.tree (Fin.last EB.rounds).castSucc = Tn := by - change rs.data.tree (Fin.last EB.rounds).castSucc = - EB.series.data.tree (Fin.last EB.rounds).castSucc - rw [← hj]; exact hl j - have hm : TreeMissingColors (rs.data.coloring (Fin.last EB.rounds)) - (rs.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by - rw [← hc, ht] - exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX) - have hmOld : TreeMissingColors (EB.series.data.coloring (Fin.last EB.rounds)) - (EB.series.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by - rw [← EB.generatingColoring] - change TashkinovStoredColors rs.data (Fin.last EB.rounds) = - TashkinovStoredColors EB.series.data (Fin.last EB.rounds) - simp only [TashkinovStoredColors, hstored, hm, hmOld] + exact GoldbergSeymour.SharedFacts.ShorteningProofs.terminalStoredColors + G k e0 input T phi ett base C ctx P alpha hlenT hTnX S hSBlen missingTree positiveB aboveB + strictB belowB generatingB baseB HB corr hmaximum bs hcore hpe hclosure baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK hstage + hposition starredEq terminalTree private theorem helper_hpS_917.{u_1, u_2} : open scoped Classical in @@ -4177,1096 +3975,56 @@ private theorem helper_lastOrdinary_1941.{u_1, u_2} : Fin.ext hcountB simpa only [hi] using hh -private theorem helper_terminalTree_3611.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - HierarchyPathNumber H = (1 : ℕ) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), - MaximumProperty corr.replacementETT → - ∀ (bs : HierarchyBase corr.replacementETT sigma), - baseB.core = bs.core → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) → - ∀ - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - HB.stage ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.stage → - HB.dividerPosition ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.dividerPosition → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B r f S - hSBlen sigma positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore - hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK - dividerStageK KF hstage hposition starredEq - exact helper_terminalTree_1082 G k e0 input T phi ett base C ctx P alpha hp hlenT S hSBlen - positiveB aboveB strictB - belowB generatingB baseB HB corr hmaximum bs hcore hpe hclosure baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK hstage - hposition starredEq - -private theorem helper_terminalStored_3618.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - HierarchyPathNumber H = (1 : ℕ) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - TreeSequenceInitialSegment Tn X → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (U : TreeSequence G e0), - TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → - TreeMissingColors sigma U = TreeMissingColors mu U) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), - MaximumProperty corr.replacementETT → - ∀ (bs : HierarchyBase corr.replacementETT sigma), - baseB.core = bs.core → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) → - ∀ - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - HB.stage ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.stage → - HB.dividerPosition ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.dividerPosition → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = - Tn → - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f - S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr - hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK - positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree - exact helper_terminalStored_720 G k e0 input T phi ett base C ctx P alpha hp hlenT hTnX S hSBlen - missingTree positiveB aboveB strictB belowB generatingB baseB HB corr hmaximum bs hcore - hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK - increasingK dividerStageK hstage hposition starredEq terminalTree - -private theorem helper_lastStar_3754.{u_1, u_2} : - helperLastStar3754Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B r f sigma - positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq - exact helper_lastStar_1932 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) - (@HB) (@hcountB) (@hstagesB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) - (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) - -private theorem helper_hpS_3760.{u_1, u_2} : - helperHpS3760Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu htail hlenT B hBlength - hBT r f consecutive S hSBlen beta hab sigma lastPositive positiveB aboveB strictB belowB - generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK coreInsideK - positiveK increasingK dividerStageK KF lastStar - exact helper_hpS_917 G k e0 input T phi ett base C ctx P alpha htail hlenT hBlength hBT - consecutive S hSBlen beta - hab lastPositive positiveB aboveB strictB belowB generatingB baseB HB corr bs - baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK - dividerStageK lastStar - -private theorem helper_uniqueRefresh_4832.{u_1, u_2} : - helperUniqueRefresh4832Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f sigma missingFixed - positiveB aboveB strictB belowB generatingB baseB HB goodB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq - stageBX storedEq i - have hnew : - ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun v => MissingColors G sigma v) = - ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun v => MissingColors G mu v) := by - apply Finset.biUnion_congr rfl - intro v hv - exact missingFixed v (TreeSequenceInitialSegmentVertexSetSubset (stageBX i.succ) - (Finset.mem_sdiff.mp hv).1) - change ∃! c : Fin k, - c ∈ HierarchyStoredColorsAt KF i.succ ∧ - goodB.gamma i.succ c ⊆ - ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion - fun v => MissingColors G sigma v) ∧ - ∀ d ∈ HierarchyStoredColorsAt KF i.succ, d ≠ c → - goodB.gamma i.succ d = goodB.gamma i.castSucc d - rw [starredEq i.castSucc, hnew] - simp only [storedEq] - exact goodB.uniqueRefresh i - -private theorem helper_parallelBase_5019.{u_1, u_2} : - SharedFacts.ShorteningTransport.parallelBase5019Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f - sigma missingTree minusEq positiveB aboveB strictB belowB generatingB baseB HB goodB EB - coreBX closureBX corr bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK - coreInsideK positiveK increasingK dividerStageK KF terminalTree storedEq - dsimp only - intro hp - have hpB := hpe.mpr hp - have hcl : bs.closure = baseB.closure := (hclosure hpB).symm - obtain ⟨hnot, hcard⟩ := goodB.parallelBase hpB - constructor - · change ¬ TreeColorSetMinusClosed G sigma bs.core - ((HierarchyStoredColorsAt KF 0).biUnion (goodB.gamma 0)) - rw [← hcore, storedEq 0, minusEq baseB.core coreBX] - exact hnot - · exact helper_branch_1894 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) - (@generatingB) (@baseB) (@HB) (@goodB) (@closureBX) (@corr) (@bs) (@baseStageK) - (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) - (@dividerStageK) (@terminalTree) (@storedEq) (@hpB) (@hcl) (@hcard) - -private theorem helper_terminalTree_5246.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (_ : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - omega) - (by - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), by - omega⟩ : - Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length), - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (_ : MaximumProperty corr.replacementETT) - (bs : HierarchyBase corr.replacementETT sigma) (_ : baseB.core = bs.core) - (_ : - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) - (_ : - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (_ : - HB.stage ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.stage) - (_ : - HB.dividerPosition ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.dividerPosition) - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j), - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B r f S - hSBlen sigma positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore - hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK - dividerStageK KF hstage hposition starredEq - exact helper_terminalTree_3611 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@ctx) (@P) (@alpha) (@hp) (@hlenT) (@S) (@hSBlen) (@positiveB) (@aboveB) (@strictB) - (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) (@hcore) (@hpe) - (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) - (@positiveK) (@increasingK) (@dividerStageK) (@hstage) (@hposition) (@starredEq) - -private theorem helper_terminalStored_5253.{u_1, u_2} : - helperTerminalStored5253Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f - S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr - hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK - positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree - exact helper_terminalStored_3618 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@ctx) (@P) (@alpha) (@hp) (@hlenT) (@hTnX) (@S) (@hSBlen) (@missingTree) (@positiveB) - (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) - (@hcore) (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) - (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@hstage) (@hposition) - (@starredEq) (@terminalTree) - -private theorem helper_stageMissingEq_5267.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - omega) - (by - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - omega) - (by - omega); - ∀ (_ : TreeSequenceInitialSegment Tn X), - let r : Fin T.length := - (⟨T.length - (1 : ℕ), by - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ - (_ : - ∀ (U : TreeSequence G e0) (_ : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), - TreeMissingColors sigma U = TreeMissingColors mu U) - (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) X) - (_ : - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc = - Tn) - (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma - missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF stageBX - terminalTree j - exact helper_stageMissingEq_1787 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) - (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) - (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) - (@stageBX) (@terminalTree) (@j) - -private theorem helper_segmentEq_5302.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ - (_ : - ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) - (_ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) - (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - omega) - (by - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), by - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) - (_ : - ∀ (c : Fin k), - HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c) - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (t : Fin (HB.stage j.succ).length), - sigma ((HB.stage j.succ).edge t) = mu ((HB.stage j.succ).edge t)) - (j : Fin (HB.dividerCount + (1 : ℕ))) (c : Fin k), - HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by +private theorem helper_lastStar_3754.{u_1, u_2} : + helperLastStar3754Conditions.{u_1, u_2} := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B r f sigma - positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK - nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq firstEq - stageFixed j c - exact @helper_segmentEq_1835 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@trans) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) - (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) - (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) (@firstEq) - (@stageFixed) (@j) (@c) + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B r f sigma + positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq + exact helper_lastStar_1932 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) + (@HB) (@hcountB) (@hstagesB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) + (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) -private theorem helper_uniqueRefresh_5324.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - omega) - (by - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - omega) - (by - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), by - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ - (_ : - ∀ (v : V) (_ : v ∈ TreeSequenceVertexSet X), - MissingColors G sigma v = MissingColors G mu v) - (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (goodB : GoodHierarchy HB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) X) - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) - (i : Fin KF.dividerCount), - ∃! eta : Fin k, - eta ∈ HierarchyStoredColorsAt KF i.succ ∧ - (goodB.gamma i.succ eta ⊆ - (TreeSequenceVertexSet (KF.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) ∧ - ∀ theta ∈ HierarchyStoredColorsAt KF i.succ, - theta ≠ eta → goodB.gamma i.succ theta = goodB.gamma i.castSucc theta := by +private theorem helper_hpS_3760.{u_1, u_2} : + helperHpS3760Conditions.{u_1, u_2} := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f sigma missingFixed - positiveB aboveB strictB belowB generatingB baseB HB goodB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq - stageBX storedEq - exact helper_uniqueRefresh_4832 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) - (@C) (@ctx) (@P) (@alpha) (@hlenT) (@missingFixed) (@positiveB) (@aboveB) - (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@corr) (@bs) - (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) - (@increasingK) (@dividerStageK) (@starredEq) (@stageBX) (@storedEq) + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu htail hlenT B hBlength + hBT r f consecutive S hSBlen beta hab sigma lastPositive positiveB aboveB strictB belowB + generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK KF lastStar + exact helper_hpS_917 G k e0 input T phi ett base C ctx P alpha htail hlenT hBlength hBT + consecutive S hSBlen beta + hab lastPositive positiveB aboveB strictB belowB generatingB baseB HB corr bs + baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK + dividerStageK lastStar + +private theorem helper_uniqueRefresh_4832.{u_1, u_2} : + helperUniqueRefresh4832Conditions.{u_1, u_2} := by + exact @GoldbergSeymour.SharedFacts.ShorteningProofs.uniqueRefreshTransport + +private theorem helper_parallelBase_5019.{u_1, u_2} : + SharedFacts.ShorteningTransport.parallelBase5019Conditions.{u_1, u_2} := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f + sigma missingTree minusEq positiveB aboveB strictB belowB generatingB baseB HB goodB EB + coreBX closureBX corr bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK + coreInsideK positiveK increasingK dividerStageK KF terminalTree storedEq + dsimp only + intro hp + have hpB := hpe.mpr hp + have hcl : bs.closure = baseB.closure := (hclosure hpB).symm + obtain ⟨hnot, hcard⟩ := goodB.parallelBase hpB + constructor + · change ¬ TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt KF 0).biUnion (goodB.gamma 0)) + rw [← hcore, storedEq 0, minusEq baseB.core coreBX] + exact hnot + · exact helper_branch_1894 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@goodB) (@closureBX) (@corr) (@bs) (@baseStageK) + (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) + (@dividerStageK) (@terminalTree) (@storedEq) (@hpB) (@hcl) (@hcard) private theorem helper_parallelBase_5330.{u_1, u_2} : SharedFacts.ShorteningTransport.parallelBase5019Conditions.{u_1, u_2} := by @@ -5320,12 +4078,11 @@ private theorem helper_continuation_6826.{u_1, u_2} : storedEq have stageMissingEq (j : Fin (HB.dividerCount + 1)) : HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by - exact @helper_stageMissingEq_5267 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) - (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) - (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@stageBX) - (@terminalTree) (@j) + exact helper_stageMissingEq_1787 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) + (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) + (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) + (@stageBX) (@terminalTree) (@j) have earlyMissing (j : Fin (B.length + 1)) (hj : j.val < B.length) : MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j) := by exact helper_earlyMissing_1796 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) @@ -5352,7 +4109,7 @@ private theorem helper_continuation_6826.{u_1, u_2} : exact fixedB _ have segmentEq (j : Fin (HB.dividerCount + 1)) (c : Fin k) : HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by - exact @helper_segmentEq_5302 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_segmentEq_1835 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@trans) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) @@ -5373,12 +4130,11 @@ private theorem helper_continuation_6826.{u_1, u_2} : exact goodB.disjointPairs j c d (by rw [storedEq j] at hc; exact hc) (by rw [storedEq j] at hd; exact hd) hne uniqueRefresh := by - exact @helper_uniqueRefresh_5324 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hlenT) (@missingFixed) (@positiveB) (@aboveB) (@strictB) (@belowB) - (@generatingB) (@baseB) (@HB) (@goodB) (@corr) (@bs) (@baseStageK) (@terminalStageK) - (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) - (@starredEq) (@stageBX) (@storedEq) + exact helper_uniqueRefresh_4832 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) + (@C) (@ctx) (@P) (@alpha) (@hlenT) (@missingFixed) (@positiveB) (@aboveB) + (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@corr) (@bs) + (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) + (@increasingK) (@dividerStageK) (@starredEq) (@stageBX) (@storedEq) parallelBase := by exact @helper_parallelBase_5330 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) @@ -5545,22 +4301,18 @@ private theorem helper_continuation_7103.{u_1, u_2} : (fun i hi => trans (HB.nested i) hi) j have terminalTree : corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by - exact @helper_terminalTree_5246 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hp) (@hlenT) (@S) (@hSBlen) (@positiveB) (@aboveB) (@strictB) (@belowB) - (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) (@hcore) (@hpe) (@hclosure) - (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) - (@increasingK) (@dividerStageK) (@hstage) (@hposition) (@starredEq) + exact helper_terminalTree_1082 G k e0 input T phi ett base C ctx P alpha hp hlenT S hSBlen + positiveB aboveB strictB + belowB generatingB baseB HB corr hmaximum bs hcore hpe hclosure baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK hstage + hposition starredEq have terminalStored : TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by - exact @helper_terminalStored_5253 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hp) (@hlenT) (@hTnX) (@S) (@hSBlen) (@missingTree) (@positiveB) (@aboveB) - (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) (@hcore) - (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) - (@positiveK) (@increasingK) (@dividerStageK) (@hstage) (@hposition) (@starredEq) - (@terminalTree) + exact helper_terminalStored_720 G k e0 input T phi ett base C ctx P alpha hp hlenT hTnX S hSBlen + missingTree positiveB aboveB strictB belowB generatingB baseB HB corr hmaximum bs hcore + hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK + increasingK dividerStageK hstage hposition starredEq terminalTree have storedEq (j : Fin (HB.dividerCount + 1)) : HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j := by unfold HierarchyStoredColorsAt diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean index d3a7fe074c..ad1e45bd82 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean @@ -3193,125 +3193,33 @@ private theorem helper_hsame_1512.{u_1, u_2} : rw [← jbEq, ← jaEq, hBT.2.1 jb, hBT.2.1 ja] at hh exact hh -private theorem helper_terminalNe_1523.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → - ∀ (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); TreeSequenceInitialSegment B T → - ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin - k), ( - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - P.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); - have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = - TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta - ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ - TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ - TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ - TreeInterchangeable G A P.coloring beta alpha)) → - ∀ (z : Fin (B.length + (1 : ℕ))), T.vertex (Fin.last T.length) ≠ B.vertex z := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans hlen B hBT P alpha beta change z hh - have hh := T.vertex_injective (hh.trans (hBT.2.1 z).symm) - have hv := congrArg Fin.val hh - have hz := z.isLt - have hblen : B.length = T.length - 1 := rfl - change T.length = z.val at hv - clear * - hv hz hblen hlen - omega +private theorem terminalVertexNePrefixVertex {V E : Type*} + {G : LooplessMultigraph V E} {e0 : E} {initial tree : TreeSequence G e0} + (segment : TreeSequenceInitialSegment initial tree) (shorter : initial.length < tree.length) + (index : Fin (initial.length + 1)) : + tree.vertex (Fin.last tree.length) ≠ initial.vertex index := by + intro equal + have indices := tree.vertex_injective (equal.trans (segment.2.1 index).symm) + have values := congrArg Fin.val indices + change tree.length = index.val at values + have below : index.val < tree.length := + lt_of_le_of_lt (Nat.le_of_lt_succ index.isLt) shorter + exact (ne_of_lt below) values.symm -private theorem helper_hprecedes_1539.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (j : ℕ), ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); TreeSequenceInitialSegment A T → - ∀ (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - ∀ (hYB : TreeSequenceInitialSegment Y B) (P : HierarchyReplacementPresentation G k e0 input T - phi ett base C ctx) (alpha beta : Fin k) (yb : Fin (Y.length + (1 : ℕ))), - let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; A.length < (↑jb : - ℕ) → (↑(HierarchyFirstMissingPosition P.coloring T beta) : ℕ) = (↑jb : ℕ) → ( - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - P.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); - have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = - TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta - ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ - TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ - TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ - TreeInterchangeable G A P.coloring beta alpha)) → - ∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u (T.vertex (HierarchyFirstMissingPosition - P.coloring T beta)) := by +private theorem prefixVertexPrecedesPosition {V E : Type*} + {G : LooplessMultigraph V E} {e0 : E} {initial tree : TreeSequence G e0} + (segment : TreeSequenceInitialSegment initial tree) (position : Fin (tree.length + 1)) + (afterPrefix : initial.length < position.val) : + ∀ vertex ∈ TreeSequenceVertexSet initial, + TreeVertexOrder tree vertex (tree.vertex position) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans A hAT hlen B Y hYB P alpha beta yb - jb hjbA ibEq change u hu - obtain ⟨z, hz⟩ : ∃ z, A.vertex z = u := by simpa [TreeSequenceVertexSet] using hu - refine ⟨Fin.castLE (Nat.succ_le_succ hAT.1) z, _, (hAT.2.1 z).trans hz, rfl, ?_⟩ - have hzlt := z.isLt - change z.val < (HierarchyFirstMissingPosition P.coloring T beta).val - clear * - hzlt hjbA ibEq - omega + intro vertex member + obtain ⟨index, atVertex⟩ : ∃ index, initial.vertex index = vertex := by + simpa [TreeSequenceVertexSet] using member + refine ⟨Fin.castLE (Nat.succ_le_succ segment.1) index, position, + (segment.2.1 index).trans atVertex, rfl, ?_⟩ + change index.val < position.val + exact lt_of_le_of_lt (Nat.le_of_lt_succ index.isLt) afterPrefix private theorem helper_hunusedBetween_1548.{u_1, u_2} : helperHunusedBetween1548Conditions.{u_1, u_2} := by @@ -3367,7 +3275,9 @@ private theorem helper_continuation_4396.{u_1, u_2} : (@hiUpper) (@P) (@alpha) (@hSlen) (@hiEq) (@hXlen) (@hXB) (@hYXlen) (@hjaX) (@beta) (@yb) (@jbEq) (@jaEq) (@change) (@hdisD) (@hdisRaw) have terminalNe (z : Fin (B.length + 1)) : T.vertex (Fin.last T.length) ≠ B.vertex z := by - apply helper_terminalNe_1523 <;> assumption + exact terminalVertexNePrefixVertex hBT (by + change T.length - 1 < T.length + omega) z obtain ⟨_, _, hmissing⟩ := componentData P.coloring beta alpha habNe.symm P.minimumContext.proper (TreeSequenceVertexSet B) (elementary P) (B.vertex jb) (B.vertex ja) (T.vertex (Fin.last T.length)) @@ -3377,7 +3287,10 @@ private theorem helper_continuation_4396.{u_1, u_2} : (Sum.inl (T.vertex (Fin.last T.length))) have hprecedes : ∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)) := by - apply helper_hprecedes_1539 <;> assumption + exact prefixVertexPrecedesPosition hAT + (HierarchyFirstMissingPosition P.coloring T beta) (by + rw [ibEq] + exact hjbA) have hunusedBetween : beta ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, (HierarchyFirstMissingPosition P.coloring T beta).val ≤ t.val ∧ t.val < (HierarchyFirstMissingPosition P.coloring T alpha).val ∧ diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean index 18e6a9a947..ade9ff0c19 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean @@ -13,6 +13,7 @@ public import LeanPool.GoldbergSeymour.SharedFacts.SecondSituationTransport public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound +public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaProofs /-! # Hierarchy Situation Three Disjoint Theta Stored Impossible @@ -534,140 +535,7 @@ private abbrev helperContinuation3542Conditions.{u_1, u_2} : Prop := ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A d.switched.coloring gamma beta)), False -private theorem helper_routeToY_837.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - TreeSequenceInitialSegment A T → ( - ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → - U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → - TreeSequenceInitialSegment Y T → TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment A Y → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) = A) → ( - ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : - ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : - TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → - IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → - ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new - ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage - K (Fin.last K.dividerCount)).edge t)) → Y.length = X.length + (1 : ℕ) → - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : - PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring - (T.edge t)) → ( - ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → - let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := - S.corresponding.replacementETT; - let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; - let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some - TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n - = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) - ∧ - ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = { f } ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A ell - X Y Z hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn - hw hf hm - as_aux_lemma => - have hj : 2 ≤ j := hpathLower - clear * - G k e0 input T phi ett base C ctx S nu hn hw hf hm - A X Y Z hAtoT hYtoT hXtoY hYtoZ hXYlen hAtoY hYlen hj j sameStarAll - commonPrefix weakEdges - clear_value A X Y Z - let et := S.corresponding.replacementETT - let K := S.counterexample.hierarchy - let Tn := et.series.data.tree (Fin.last et.rounds).castSucc - have hTnT : TreeSequenceInitialSegment Tn T := et.abovePenultimate - have hTnA : Tn.length ≤ A.length := by - by_cases hz : K.dividerCount = 0 - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz - have hs := sameStarAll S - change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs - rw [hi] at hs - change S.replacementBase.core = A at hs - by_cases hp : et.series.data.kind (Fin.last et.rounds) = - some TashkinovExtensionKind.PE - · rw [← hs]; exact (Classical.choice (S.replacementBase.parallel hp).2.2).leftSegment.1 - · rw [← hs, S.replacementBase.nonparallel hp] - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := - Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) - have hs := sameStarAll S - change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs - rw [hi] at hs - have hmono : Monotone (fun i : Fin (K.dividerCount + 2) => (K.stage i).length) := - Fin.monotone_iff_le_succ.mpr (fun i => (K.nested i).1) - rw [← hs] - change Tn.length ≤ (K.stage _).length - rw [show Tn = K.stage 0 from K.baseStage.symm] - exact hmono (Fin.zero_le _) - have hAYstrict : A.length < Y.length := by - clear * - hj hYlen - omega - have fixedA : ∀ t : Fin A.length, nu (A.edge t) = S.coloring (A.edge t) := by - have he := weakEdges S.coloring nu et S.replacementBase K hw - S.minimumContext.oneEdgeUncolored hn - change ∀ t : Fin (HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).length, - nu ((HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) = - S.coloring ((HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) at he - rw [sameStarAll S] at he - exact he - have fixedY : ∀ t : Fin Y.length, nu (Y.edge t) = S.coloring (Y.edge t) := by - intro t - let tT : Fin T.length := Fin.castLE hYtoT.1 t - have he : T.edge tT = Y.edge t := hYtoT.2.2 t - by_cases ht : t.val < A.length - · let tA : Fin A.length := ⟨t.val, ht⟩ - have hcast : Fin.castLE hAtoT.1 tA = tT := Fin.ext rfl - rw [← he, ← hcast, hAtoT.2.2 tA] - exact fixedA tA - · rw [← he] - exact hf tT (Nat.le_of_not_gt ht) t.isLt - have transport (W : TreeSequence G e0) - (hr : TashkinovAugmentationSequence S.coloring W Y) : - TashkinovAugmentationSequence nu W Y := - TashkinovAugmentationSequenceColoringTransport S.coloring nu W X Y hr - hXtoY hXYlen (fun t _ => fixedY t) - (fun v hv => hm v (TreeSequenceInitialSegmentVertexSetSubset hYtoZ - (TreeSequenceInitialSegmentVertexSetSubset hXtoY hv))) - rcases P2813_T1_TerminalRoute G k e0 S.corresponding.replacementInput T - S.coloring et with ⟨hp, hr⟩ | ⟨hk, f, seed, he, ha, _, _, hr⟩ - · have hTY : TreeSequenceInitialSegment Tn Y := - commonPrefix hTnT hYtoT (hTnA.trans hAtoY.1) - exact Or.inl ⟨hp, transport Tn - (TashkinovAugmentationSequenceRestrict S.coloring Tn Y T hr hTY hYtoT)⟩ - · have hseedT : TreeSequenceInitialSegment seed T := - TashkinovAugmentationSequenceInitialSegment S.coloring seed T hr - have hseedY : TreeSequenceInitialSegment seed Y := - commonPrefix hseedT hYtoT (by - have hl := ha.1 - change seed.length = Tn.length + 1 at hl - clear * - hl hTnA hAYstrict - omega) - exact Or.inr ⟨hk, f, seed, he, ha, transport seed - (TashkinovAugmentationSequenceRestrict S.coloring seed Y T hr hseedY hYtoT)⟩ + private theorem helper_hfixed3_1220.{u_1, u_2} : open scoped Classical in @@ -865,93 +733,7 @@ private theorem helper_caseGamma_1171.{u_1, u_2} : rw [hc] at hm exact hm -private theorem helper_changeRho_1319.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - ∀ (gamma : Fin k), (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length → gamma ≠ - d.theta → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) = A) → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : - ℕ)) = Z) → - ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho - (TreeSequenceVertexSet Z) → HierarchyFirstMissingPosition rho T gamma = - HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta - = HierarchyFirstMissingPosition sigma T d.theta → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) - → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) < (↑(HierarchyFirstMissingPosition - sigma T d.theta) : ℕ) → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho - Z → - let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := - R1.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - R1.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition rho T gamma); - have vb : V := T.vertex (HierarchyFirstMissingPosition rho T d.theta); - have sameComponent : Prop := TwoColorComponent G rho gamma d.theta (Sum.inl va) = - TwoColorComponent G rho gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ - TreeMissingColors rho Tnq ∨ Disjoint { gamma, d.theta } Dnq) → sameComponent) ∧ ( - H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors rho Tn ∨ Disjoint { gamma, d.theta } - Dn) → sameComponent) ∧ ( gamma ∈ TreeMissingColors rho A ∧ TreeColorSetClosed G rho A - { gamma } → sameComponent ∧ TreeInterchangeable G A rho gamma d.theta) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A ell Y Z - gamma hthetaFirstIndex hgammaNeTheta sameStarAll samePenultimate R1 rho hElemRho - hfirstGammaRho hfirstThetaRho hgammaUnusedRho hgammaBeforeTheta hpairMissingRho - as_aux_lemma => - exact ChangeLemma G k e0 R1.corresponding.replacementInput T rho - R1.corresponding.replacementETT R1.replacementBase R1.counterexample - R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung - R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality - (by change ColoredVertexSetElementary G rho - (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample - (HierarchyFullTailLength R1.counterexample - 1))) - rw [samePenultimate R1]; exact hElemRho) - R1.minimumContext.largeMissingSet gamma d.theta hgammaNeTheta - (by change gamma ∈ TreeMissingColors rho - (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - - 1)) ∧ - d.theta ∈ TreeMissingColors rho - (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength - R1.counterexample - 1)) - rw [samePenultimate R1]; exact hpairMissingRho) - (by - dsimp only - rw [sameStarAll R1, hfirstGammaRho, hfirstThetaRho] - intro _ - refine ⟨⟨_, _, rfl, rfl, hgammaBeforeTheta⟩, ?_⟩ - intro hc - obtain ⟨_, t, hlo, hhi, he⟩ := Finset.mem_filter.mp hc - rw [hthetaFirstIndex] at hhi - exact hgammaUnusedRho t hlo hhi he) + private theorem helper_hbetaUnused_658.{u_1, u_2} : open scoped Classical in @@ -1743,7 +1525,8 @@ private theorem helper_continuation_2545.{u_1, u_2} : rw [he] exact ⟨hgammaMissingZ, hthetaMissingZ⟩ have changeRho := by - exact @helper_changeRho_1319 V E inferInstance inferInstance inferInstance inferInstance G k + exact @GoldbergSeymour.SharedFacts.DisjointThetaProofs.changeLemmaForReplacementColoring + V E inferInstance inferInstance inferInstance inferInstance G k e0 input T phi ett base C ctx P alpha beta d j gamma hthetaFirstIndex hgammaNeTheta sameStarAll samePenultimate R1 hElemRho hfirstGammaRho hfirstThetaRho hgammaUnusedRho hgammaBeforeTheta hpairMissingRho @@ -1929,7 +1712,8 @@ private theorem helper_continuation_2327.{u_1, u_2} : et.series.data.connectingEdges n = {f} ∧ TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y) := by - exact @helper_routeToY_837 V E inferInstance inferInstance inferInstance inferInstance G k e0 + exact @GoldbergSeymour.SharedFacts.DisjointThetaProofs.terminalRouteToPrefix + V E inferInstance inferInstance inferInstance inferInstance G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn hw hf hm have caseGamma (S : HierarchyReplacementPresentation diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean index e854351e99..bcd32d0aab 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean @@ -15,6 +15,7 @@ public import LeanPool.GoldbergSeymour.TwoColorComponentColoringFacts public import LeanPool.GoldbergSeymour.HierarchyFullTailLength public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound +public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaProofs /-! # Hierarchy Situation Three Disjoint Theta Unstored Beta Stored Impossible @@ -28,55 +29,7 @@ Adapted from Wesley Pegden’s Trellis formalization at namespace GoldbergSeymour -private abbrev helperRouteToY1012Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - TreeSequenceInitialSegment A T → ( - ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → - U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → - TreeSequenceInitialSegment Y T → TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment A Y → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) = A) → ( - ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : - ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : - TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → - IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → - ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new - ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage - K (Fin.last K.dividerCount)).edge t)) → Y.length = X.length + (1 : ℕ) → - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : - PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring - (T.edge t)) → ( - ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → - let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := - S.corresponding.replacementETT; - let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; - let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some - TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n - = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) - ∧ - ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = { f } ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y + private abbrev helperContinuation2578Conditions.{u_1, u_2} : Prop := open scoped Classical in @@ -1024,93 +977,7 @@ private abbrev helperContinuation3933Conditions.{u_1, u_2} : Prop := TreeSequence G e0) (hWZ : TreeSequenceInitialSegment W Z), TreeMissingColors new W = TreeMissingColors old W), False -private theorem helper_routeToY_1012.{u_1, u_2} : - helperRouteToY1012Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A ell - X Y Z hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn - hw hf hm - as_aux_lemma => - have hj : 2 ≤ j := hpathLower - clear * - G k e0 input T phi ett base C ctx S nu hn hw hf hm - A X Y Z hAtoT hYtoT hXtoY hYtoZ hXYlen hAtoY hYlen hj j sameStarAll - commonPrefix weakEdges - clear_value A X Y Z - let et := S.corresponding.replacementETT - let K := S.counterexample.hierarchy - let Tn := et.series.data.tree (Fin.last et.rounds).castSucc - have hTnT : TreeSequenceInitialSegment Tn T := et.abovePenultimate - have hTnA : Tn.length ≤ A.length := by - by_cases hz : K.dividerCount = 0 - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz - have hs := sameStarAll S - change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs - rw [hi] at hs - change S.replacementBase.core = A at hs - by_cases hp : et.series.data.kind (Fin.last et.rounds) = - some TashkinovExtensionKind.PE - · rw [← hs]; exact (Classical.choice (S.replacementBase.parallel hp).2.2).leftSegment.1 - · rw [← hs, S.replacementBase.nonparallel hp] - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := - Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) - have hs := sameStarAll S - change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs - rw [hi] at hs - have hmono : Monotone (fun i : Fin (K.dividerCount + 2) => (K.stage i).length) := - Fin.monotone_iff_le_succ.mpr (fun i => (K.nested i).1) - rw [← hs] - change Tn.length ≤ (K.stage _).length - rw [show Tn = K.stage 0 from K.baseStage.symm] - exact hmono (Fin.zero_le _) - have hAYstrict : A.length < Y.length := by - clear * - hj hYlen - omega - have fixedA : ∀ t : Fin A.length, nu (A.edge t) = S.coloring (A.edge t) := by - have he := weakEdges S.coloring nu et S.replacementBase K hw - S.minimumContext.oneEdgeUncolored hn - change ∀ t : Fin (HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).length, - nu ((HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) = - S.coloring ((HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) at he - rw [sameStarAll S] at he - exact he - have fixedY : ∀ t : Fin Y.length, nu (Y.edge t) = S.coloring (Y.edge t) := by - intro t - let tT : Fin T.length := Fin.castLE hYtoT.1 t - have he : T.edge tT = Y.edge t := hYtoT.2.2 t - by_cases ht : t.val < A.length - · let tA : Fin A.length := ⟨t.val, ht⟩ - have hcast : Fin.castLE hAtoT.1 tA = tT := Fin.ext rfl - rw [← he, ← hcast, hAtoT.2.2 tA] - exact fixedA tA - · rw [← he] - exact hf tT (Nat.le_of_not_gt ht) t.isLt - have transport (W : TreeSequence G e0) - (hr : TashkinovAugmentationSequence S.coloring W Y) : - TashkinovAugmentationSequence nu W Y := - TashkinovAugmentationSequenceColoringTransport S.coloring nu W X Y hr - hXtoY hXYlen (fun t _ => fixedY t) - (fun v hv => hm v (TreeSequenceInitialSegmentVertexSetSubset hYtoZ - (TreeSequenceInitialSegmentVertexSetSubset hXtoY hv))) - rcases P2813_T1_TerminalRoute G k e0 S.corresponding.replacementInput T - S.coloring et with ⟨hp, hr⟩ | ⟨hk, f, seed, he, ha, _, _, hr⟩ - · have hTY : TreeSequenceInitialSegment Tn Y := - commonPrefix hTnT hYtoT (hTnA.trans hAtoY.1) - exact Or.inl ⟨hp, transport Tn - (TashkinovAugmentationSequenceRestrict S.coloring Tn Y T hr hTY hYtoT)⟩ - · have hseedT : TreeSequenceInitialSegment seed T := - TashkinovAugmentationSequenceInitialSegment S.coloring seed T hr - have hseedY : TreeSequenceInitialSegment seed Y := - commonPrefix hseedT hYtoT (by - have hl := ha.1 - change seed.length = Tn.length + 1 at hl - clear * - hl hTnA hAYstrict - omega) - exact Or.inr ⟨hk, f, seed, he, ha, transport seed - (TashkinovAugmentationSequenceRestrict S.coloring seed Y T hr hseedY hYtoT)⟩ + private theorem helper_hgammaNeBeta_569.{u_1, u_2} : open scoped Classical in @@ -1663,96 +1530,7 @@ private theorem helper_hthetaUnused_1483.{u_1, u_2} : exact hc exact hthetaNotRaw (thetaRawIfUsed tY hlo (hYlen ▸ hhi) he) -private theorem helper_changeRho_1547.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - ∀ (gamma : Fin k), (↑(HierarchyFirstMissingPosition d.switched.coloring T d.theta) : ℕ) = - (HierarchyFullTailPrefix C j).length → gamma ≠ d.theta → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) = A) → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : - ℕ)) = Z) → - ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho - (TreeSequenceVertexSet Z) → HierarchyFirstMissingPosition rho T gamma = - HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta - = HierarchyFirstMissingPosition sigma T d.theta → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) - → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) < (↑(HierarchyFirstMissingPosition - sigma T d.theta) : ℕ) → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho - Z → - let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := - R1.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - R1.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition rho T gamma); - have vb : V := T.vertex (HierarchyFirstMissingPosition rho T d.theta); - have sameComponent : Prop := TwoColorComponent G rho gamma d.theta (Sum.inl va) = - TwoColorComponent G rho gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ - TreeMissingColors rho Tnq ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : Finset - (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - rho Tn ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : Finset (Fin k)) Dn) → - sameComponent) ∧ ( gamma ∈ TreeMissingColors rho A ∧ TreeColorSetClosed G rho A ({ gamma } - : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A rho gamma d.theta) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A ell Y Z - gamma hthetaFirstIndex hgammaNeTheta sameStarAll samePenultimate R1 rho hElemRho - hfirstGammaRho hfirstThetaRho hgammaUnusedRho hgammaBeforeTheta hpairMissingRho - as_aux_lemma => - exact ChangeLemma G k e0 R1.corresponding.replacementInput T rho - R1.corresponding.replacementETT R1.replacementBase R1.counterexample - R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung - R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality - (by change ColoredVertexSetElementary G rho - (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample - (HierarchyFullTailLength R1.counterexample - 1))) - rw [samePenultimate R1]; exact hElemRho) - R1.minimumContext.largeMissingSet gamma d.theta hgammaNeTheta - (by change gamma ∈ TreeMissingColors rho - (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - - 1)) ∧ - d.theta ∈ TreeMissingColors rho - (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength - R1.counterexample - 1)) - rw [samePenultimate R1]; exact hpairMissingRho) - (by - dsimp only - rw [sameStarAll R1, hfirstGammaRho, hfirstThetaRho] - intro _ - refine ⟨⟨_, _, rfl, rfl, hgammaBeforeTheta⟩, ?_⟩ - intro hc - obtain ⟨_, t, hlo, hhi, he⟩ := Finset.mem_filter.mp hc - rw [hthetaFirstIndex] at hhi - exact hgammaUnusedRho t hlo hhi he) + private theorem helper_sameGammaTheta_1572.{u_1, u_2} : open scoped Classical in @@ -2187,7 +1965,8 @@ private theorem helper_continuation_3727.{u_1, u_2} : rw [he] exact ⟨hgammaMissingZ, hthetaMissingZ⟩ have changeRho := by - exact helper_changeRho_1547 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact GoldbergSeymour.SharedFacts.DisjointThetaProofs.changeLemmaForReplacementColoring + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@gamma) (@hthetaFirstIndex) (@hgammaNeTheta) (@sameStarAll) (@samePenultimate) (@R1) (@hElemRho) (@hfirstGammaRho) (@hfirstThetaRho) (@hgammaUnusedRho) (@hgammaBeforeTheta) (@hpairMissingRho) @@ -2430,7 +2209,8 @@ private theorem helper_continuation_3933.{u_1, u_2} : et.series.data.connectingEdges n = {f} ∧ TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y) := by - exact @helper_routeToY_1012 V E inferInstance inferInstance inferInstance inferInstance G k + exact @GoldbergSeymour.SharedFacts.DisjointThetaProofs.terminalRouteToPrefix + V E inferInstance inferInstance inferInstance inferInstance G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn hw hf hm exact @helper_continuation_3042 (@V) (@E) inferInstance inferInstance inferInstance diff --git a/LeanPool/GoldbergSeymour/Imports.lean b/LeanPool/GoldbergSeymour/Imports.lean index 9714ec7329..4b70041ce1 100644 --- a/LeanPool/GoldbergSeymour/Imports.lean +++ b/LeanPool/GoldbergSeymour/Imports.lean @@ -533,6 +533,7 @@ public import LeanPool.GoldbergSeymour.ScheideTwoColorLastExitPath public import LeanPool.GoldbergSeymour.SharedFacts.BaseControl public import LeanPool.GoldbergSeymour.SharedFacts.Basic2TerminalPE public import LeanPool.GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 +public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaProofs public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaTransport public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseClaim45Singleton public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseStepLemmas @@ -556,6 +557,7 @@ public import LeanPool.GoldbergSeymour.SharedFacts.ScheideHeightFiveGammaEdges public import LeanPool.GoldbergSeymour.SharedFacts.ScheideSelectedBlockDeletion public import LeanPool.GoldbergSeymour.SharedFacts.SecondSituationTransport public import LeanPool.GoldbergSeymour.SharedFacts.SecondSubcaseTransport +public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningProofs public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningTransport public import LeanPool.GoldbergSeymour.SharedFacts.StableChangeCasesOneTwoSplitTail public import LeanPool.GoldbergSeymour.SharedFacts.StoredExceptionTransport diff --git a/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaProofs.lean b/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaProofs.lean new file mode 100644 index 0000000000..beeb47ecb3 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaProofs.lean @@ -0,0 +1,251 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaTransport +public import LeanPool.GoldbergSeymour.SharedFacts.SecondSituationTransport +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData +public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound + +/-! +# Shared terminal-route and replacement-colouring proofs + +Shared proofs used by the Goldberg–Seymour construction branches. +Extracted from the credited Trellis port at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; the original branch contracts remain available. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.DisjointThetaProofs + +theorem terminalRouteToPrefix.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → + TreeSequenceInitialSegment Y T → TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment A Y → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : + ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : + TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage + K (Fin.last K.dividerCount)).edge t)) → Y.length = X.length + (1 : ℕ) → + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : + PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring + (T.edge t)) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → + let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := + S.corresponding.replacementETT; + let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; + let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n + = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A ell + X Y Z hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn + hw hf hm + as_aux_lemma => + have hj : 2 ≤ j := hpathLower + clear * - G k e0 input T phi ett base C ctx S nu hn hw hf hm + A X Y Z hAtoT hYtoT hXtoY hYtoZ hXYlen hAtoY hYlen hj j sameStarAll + commonPrefix weakEdges + clear_value A X Y Z + let et := S.corresponding.replacementETT + let K := S.counterexample.hierarchy + let Tn := et.series.data.tree (Fin.last et.rounds).castSucc + have hTnT : TreeSequenceInitialSegment Tn T := et.abovePenultimate + have hTnA : Tn.length ≤ A.length := by + by_cases hz : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz + have hs := sameStarAll S + change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs + rw [hi] at hs + change S.replacementBase.core = A at hs + by_cases hp : et.series.data.kind (Fin.last et.rounds) = + some TashkinovExtensionKind.PE + · rw [← hs]; exact (Classical.choice (S.replacementBase.parallel hp).2.2).leftSegment.1 + · rw [← hs, S.replacementBase.nonparallel hp] + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := + Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) + have hs := sameStarAll S + change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs + rw [hi] at hs + have hmono : Monotone (fun i : Fin (K.dividerCount + 2) => (K.stage i).length) := + Fin.monotone_iff_le_succ.mpr (fun i => (K.nested i).1) + rw [← hs] + change Tn.length ≤ (K.stage _).length + rw [show Tn = K.stage 0 from K.baseStage.symm] + exact hmono (Fin.zero_le _) + have hAYstrict : A.length < Y.length := by + clear * - hj hYlen + omega + have fixedA : ∀ t : Fin A.length, nu (A.edge t) = S.coloring (A.edge t) := by + have he := weakEdges S.coloring nu et S.replacementBase K hw + S.minimumContext.oneEdgeUncolored hn + change ∀ t : Fin (HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).length, + nu ((HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) = + S.coloring ((HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) at he + rw [sameStarAll S] at he + exact he + have fixedY : ∀ t : Fin Y.length, nu (Y.edge t) = S.coloring (Y.edge t) := by + intro t + let tT : Fin T.length := Fin.castLE hYtoT.1 t + have he : T.edge tT = Y.edge t := hYtoT.2.2 t + by_cases ht : t.val < A.length + · let tA : Fin A.length := ⟨t.val, ht⟩ + have hcast : Fin.castLE hAtoT.1 tA = tT := Fin.ext rfl + rw [← he, ← hcast, hAtoT.2.2 tA] + exact fixedA tA + · rw [← he] + exact hf tT (Nat.le_of_not_gt ht) t.isLt + have transport (W : TreeSequence G e0) + (hr : TashkinovAugmentationSequence S.coloring W Y) : + TashkinovAugmentationSequence nu W Y := + TashkinovAugmentationSequenceColoringTransport S.coloring nu W X Y hr + hXtoY hXYlen (fun t _ => fixedY t) + (fun v hv => hm v (TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (TreeSequenceInitialSegmentVertexSetSubset hXtoY hv))) + rcases P2813_T1_TerminalRoute G k e0 S.corresponding.replacementInput T + S.coloring et with ⟨hp, hr⟩ | ⟨hk, f, seed, he, ha, _, _, hr⟩ + · have hTY : TreeSequenceInitialSegment Tn Y := + commonPrefix hTnT hYtoT (hTnA.trans hAtoY.1) + exact Or.inl ⟨hp, transport Tn + (TashkinovAugmentationSequenceRestrict S.coloring Tn Y T hr hTY hYtoT)⟩ + · have hseedT : TreeSequenceInitialSegment seed T := + TashkinovAugmentationSequenceInitialSegment S.coloring seed T hr + have hseedY : TreeSequenceInitialSegment seed Y := + commonPrefix hseedT hYtoT (by + have hl := ha.1 + change seed.length = Tn.length + 1 at hl + clear * - hl hTnA hAYstrict + omega) + exact Or.inr ⟨hk, f, seed, he, ha, transport seed + (TashkinovAugmentationSequenceRestrict S.coloring seed Y T hr hseedY hYtoT)⟩ + +theorem changeLemmaForReplacementColoring.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (gamma : Fin k), (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length → gamma ≠ + d.theta → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Z) → HierarchyFirstMissingPosition rho T gamma = + HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta + = HierarchyFirstMissingPosition sigma T d.theta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) + → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) < (↑(HierarchyFirstMissingPosition + sigma T d.theta) : ℕ) → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho + Z → + let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := + R1.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R1.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition rho T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition rho T d.theta); + have sameComponent : Prop := TwoColorComponent G rho gamma d.theta (Sum.inl va) = + TwoColorComponent G rho gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors rho Tnq ∨ Disjoint { gamma, d.theta } Dnq) → sameComponent) ∧ ( + H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors rho Tn ∨ Disjoint { gamma, d.theta } + Dn) → sameComponent) ∧ ( gamma ∈ TreeMissingColors rho A ∧ TreeColorSetClosed G rho A + { gamma } → sameComponent ∧ TreeInterchangeable G A rho gamma d.theta) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A ell Y Z + gamma hthetaFirstIndex hgammaNeTheta sameStarAll samePenultimate R1 rho hElemRho + hfirstGammaRho hfirstThetaRho hgammaUnusedRho hgammaBeforeTheta hpairMissingRho + as_aux_lemma => + exact ChangeLemma G k e0 R1.corresponding.replacementInput T rho + R1.corresponding.replacementETT R1.replacementBase R1.counterexample + R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung + R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality + (by change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - 1))) + rw [samePenultimate R1]; exact hElemRho) + R1.minimumContext.largeMissingSet gamma d.theta hgammaNeTheta + (by change gamma ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample + - 1)) ∧ + d.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength + R1.counterexample - 1)) + rw [samePenultimate R1]; exact hpairMissingRho) + (by + dsimp only + rw [sameStarAll R1, hfirstGammaRho, hfirstThetaRho] + intro _ + refine ⟨⟨_, _, rfl, rfl, hgammaBeforeTheta⟩, ?_⟩ + intro hc + obtain ⟨_, t, hlo, hhi, he⟩ := Finset.mem_filter.mp hc + rw [hthetaFirstIndex] at hhi + exact hgammaUnusedRho t hlo hhi he) + +end GoldbergSeymour.SharedFacts.DisjointThetaProofs + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ShorteningProofs.lean b/LeanPool/GoldbergSeymour/SharedFacts/ShorteningProofs.lean new file mode 100644 index 0000000000..87866dad47 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ShorteningProofs.lean @@ -0,0 +1,473 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.SharedFacts.SubcaseThreeOnePreparation1 +public import LeanPool.GoldbergSeymour.TerminalRoute +public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices +public import LeanPool.GoldbergSeymour.HierarchySplitter +public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceColoringTransport + +/-! +# Shared recolouring and shortened-hierarchy proofs + +Shared proofs used by the Goldberg–Seymour construction branches. +Extracted from the credited Trellis port at +88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12; the original branch contracts remain available. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ShorteningProofs + +theorem properRecoloring.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), + let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + alpha ∈ MissingColors G mu (B.vertex (Fin.last B.length)) → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + let w : V := T.vertex (Fin.last T.length); + G.ends f = s(y, w) → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), e ≠ f → sigma e = mu e) → + IsProperEdgeColoring G sigma := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha haT mu trans hlenT B halphaB r f y + w hends sigma fixed e g c heg hadj he hg + by_cases hef : e = f + · subst e + have hgf : g ≠ f := heg.symm + have hc : c = alpha := by simpa [sigma] using he.symm + subst c + rw [fixed g hgf] at hg + obtain ⟨v, hvf, hvg⟩ := hadj + have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf + rcases hv with rfl | rfl + · exact (Finset.mem_sdiff.mp halphaB).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) + · exact (Finset.mem_sdiff.mp haT).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) + · by_cases hgf : g = f + · subst g + have hc : c = alpha := by simpa [sigma] using hg.symm + subst c + rw [fixed e hef] at he + obtain ⟨v, hve, hvf⟩ := hadj + have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf + rcases hv with rfl | rfl + · exact (Finset.mem_sdiff.mp halphaB).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) + · exact (Finset.mem_sdiff.mp haT).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) + · exact P.minimumContext.proper heg hadj ((fixed e hef).symm.trans he) + ((fixed g hgf).symm.trans hg) + +theorem terminalStoredColors.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let _ : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + TreeSequenceInitialSegment Tn X → + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (U : TreeSequence G e0), + TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → + TreeMissingColors sigma U = TreeMissingColors mu U) → + ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma), + baseB.core = bs.core → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) → + ∀ + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → + (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + HB.stage ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.stage → + HB.dividerPosition ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.dividerPosition → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = + Tn → + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hlenT B X hTnX r f + S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr + hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK + positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ + have hj : j.succ = Fin.last EB.rounds := Fin.ext (by + dsimp [j]; have := EB.roundsPositive; omega) + have ht : rs.data.tree (Fin.last EB.rounds).castSucc = Tn := by + change rs.data.tree (Fin.last EB.rounds).castSucc = + EB.series.data.tree (Fin.last EB.rounds).castSucc + rw [← hj]; exact hl j + have hm : TreeMissingColors (rs.data.coloring (Fin.last EB.rounds)) + (rs.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by + rw [← hc, ht] + exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX) + have hmOld : TreeMissingColors (EB.series.data.coloring (Fin.last EB.rounds)) + (EB.series.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by + rw [← EB.generatingColoring] + change TashkinovStoredColors rs.data (Fin.last EB.rounds) = + TashkinovStoredColors EB.series.data (Fin.last EB.rounds) + simp only [TashkinovStoredColors, hstored, hm, hmOld] + +theorem uniqueRefreshTransport.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + let r : Fin T.length := + (⟨T.length - (1 : ℕ), + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) < T.length) ↦ by omega⟩ : + Fin T.length); + let f : E := T.edge r; + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (_ : ∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + (aboveB : + TreeSequenceInitialSegment + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun + (a : + ¬P.corresponding.replacementETT.rounds < + P.corresponding.replacementETT.rounds + (2 : ℕ)) ↦ + by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) + B) + (strictB : + (P.corresponding.replacementETT.series.data.tree + (⟨P.corresponding.replacementETT.rounds, + have _ : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun + (a : + ¬P.corresponding.replacementETT.rounds < + P.corresponding.replacementETT.rounds + (2 : ℕ)) ↦ + by omega⟩ : + Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B + (P.corresponding.replacementETT.series.data.tree + (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) + (generatingB : + mu = + P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) + (baseB : + HierarchyBase + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + mu) + (HB : + TashkinovHierarchy + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } + baseB) + (goodB : GoodHierarchy HB), + let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) + (baseStageK : + HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) + (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) + (nestedK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) + (strictK : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + (HB.stage j.castSucc).length < (HB.stage j.succ).length) + (coreInsideK : + TreeSequenceInitialSegment bs.core + (HB.stage + (⟨(1 : ℕ), + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) < HB.dividerCount + (2 : ℕ)) ↦ by omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))))) + (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) + (increasingK : + ∀ (i j : Fin HB.dividerCount), + (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) + (dividerStageK : + ∀ (i : Fin HB.dividerCount), + HB.stage + (⟨(↑i : ℕ) + (1 : ℕ), + have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction fun (a : ¬(↑i : ℕ) + (1 : ℕ) < HB.dividerCount + (2 : ℕ)) ↦ by + omega⟩ : + Fin (HB.dividerCount + (2 : ℕ))) = + TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) + (have _ : (1 : ℕ) ≤ T.length := T.positive; + have _ : (1 : ℕ) ≤ B.length := B.positive; + Decidable.byContradiction fun (a : ¬(↑(HB.dividerPosition i) : ℕ) ≤ B.length) ↦ by + omega)), + let KF : TashkinovHierarchy corr.replacementETT bs := + { dividerCount := HB.dividerCount, + stage := HB.stage, + baseStage := baseStageK, + terminalStage := terminalStageK, + nested := nestedK, + strict := strictK, + dividerPosition := HB.dividerPosition, + dividerPositive := positiveK, + dividerIncreasing := increasingK, + dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; + ∀ + (_ : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) + (_ : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HB.stage j.castSucc) X) + (_ : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) + (i : Fin KF.dividerCount), + ∃! eta : Fin k, + eta ∈ HierarchyStoredColorsAt KF i.succ ∧ + (goodB.gamma i.succ eta ⊆ + (TreeSequenceVertexSet (KF.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt KF i.succ, + theta ≠ eta → goodB.gamma i.succ theta = goodB.gamma i.castSucc theta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f sigma missingFixed + positiveB aboveB strictB belowB generatingB baseB HB goodB EB corr bs baseStageK + terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq + stageBX storedEq i + have hnew : + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun v => MissingColors G sigma v) = + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun v => MissingColors G mu v) := by + apply Finset.biUnion_congr rfl + intro v hv + exact missingFixed v (TreeSequenceInitialSegmentVertexSetSubset (stageBX i.succ) + (Finset.mem_sdiff.mp hv).1) + change ∃! c : Fin k, + c ∈ HierarchyStoredColorsAt KF i.succ ∧ + goodB.gamma i.succ c ⊆ + ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion + fun v => MissingColors G sigma v) ∧ + ∀ d ∈ HierarchyStoredColorsAt KF i.succ, d ≠ c → + goodB.gamma i.succ d = goodB.gamma i.castSucc d + rw [starredEq i.castSucc, hnew] + simp only [storedEq] + exact goodB.uniqueRefresh i + +end GoldbergSeymour.SharedFacts.ShorteningProofs + +end From 48f409772189ec5a8403e9d8cb3b032907b40f5a Mon Sep 17 00:00:00 2001 From: Vasily Ilin Date: Fri, 6 Nov 2026 06:05:37 +0000 Subject: [PATCH 11/11] Share and generalize Goldberg-Seymour proof infrastructure --- LeanPool/GoldbergSeymour/BaseControl.lean | 134 +- .../GoldbergSeymour/Basic2TerminalPE.lean | 71 +- .../GoldbergSeymour/Basic2TerminalSERE.lean | 71 +- .../ChangeLemmaBothInside.lean | 193 +- .../ChangeLemmaBothOutside.lean | 3 +- .../ChangeLemmaBothOutside/Preparation1.lean | 396 +- .../ChangeLemmaBothOutside/Preparation6.lean | 3 +- .../ChangeLemmaMixedClosedFinal.lean | 927 +-- .../ChangeLemmaMixedLargestClosed.lean | 6743 +++++------------ .../ChangeLemmaMixedNoClosed.lean | 1196 +-- .../ChangeLemmaMixedZeroNonclosed.lean | 129 +- .../ETTFirstAppearanceIndex.lean | 24 + .../EligibleIndexBoundPreparation.lean | 6 +- .../ExtensionBaseBranchLemmas.lean | 630 +- .../ExtensionBaseCaseTwoContradiction.lean | 79 +- .../GoldbergSeymour/ExtensionBaseClaim44.lean | 101 +- .../ExtensionBaseStepLemmas.lean | 16 +- .../ExtensionRulesTerminalStoredDisjoint.lean | 36 +- .../HierarchyClaimNineFirstUseAfterSeed.lean | 17 +- ...archySituationOneAdvanceOutsideStored.lean | 509 +- ...hySituationOneShorteningContradiction.lean | 5211 ++----------- ...ySituationThreeClaimJMinusOneNonempty.lean | 228 +- ...nThreeComponentIntersectionShortening.lean | 610 +- ...ionThreeDisjointThetaStoredImpossible.lean | 426 +- ...ointThetaUnstoredBetaStoredImpossible.lean | 382 +- ...archySituationThreeEligibleIndexBound.lean | 3 +- ...tuationTwoSubcaseOneOneNonexceptional.lean | 84 +- .../Preparation1.lean | 1 - .../HierarchySituationTwoSubcaseThreeTwo.lean | 225 +- ...tuationTwoSubcaseTwoOneNonexceptional.lean | 712 +- .../HierarchySituationTwoSubcaseTwoTwo.lean | 214 +- .../GoldbergSeymour/HierarchyTreeFacts.lean | 108 + LeanPool/GoldbergSeymour/Imports.lean | 4 +- .../GoldbergSeymour/OutsidePrefixBranch.lean | 47 +- .../ParallelExtensionUndoStable.lean | 342 +- .../PositivePrefixNoRevisiting.lean | 550 +- .../RevisitingTerminalPreparation.lean | 62 +- .../ScheideHeightFiveGammaEdges.lean | 222 +- .../ScheideOrderNineBlockStructure.lean | 443 +- .../ChangeLemmaBothOutsidePreparation1.lean | 101 + .../SharedFacts/DisjointThetaRoutes.lean | 326 + .../SharedFacts/LargestClosedTransport.lean | 174 - .../MixedChangeTransport/Preparation2.lean | 25 +- .../SharedFacts/ReplacementPrefixes.lean | 101 + .../SubcaseThreeOnePreparation1.lean | 20 +- .../StableChangeCaseThree/Preparation1.lean | 125 +- .../TashkinovSeriesColoringProperties.lean | 85 + .../TerminalHierarchyRestore.lean | 16 +- .../TerminalSeriesRebuildTransport.lean | 572 +- .../TreeSequenceColoringFacts.lean | 18 + .../TreeSequenceInitialSegmentFacts.lean | 42 + 51 files changed, 4121 insertions(+), 18642 deletions(-) create mode 100644 LeanPool/GoldbergSeymour/HierarchyTreeFacts.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaRoutes.lean delete mode 100644 LeanPool/GoldbergSeymour/SharedFacts/LargestClosedTransport.lean create mode 100644 LeanPool/GoldbergSeymour/SharedFacts/ReplacementPrefixes.lean diff --git a/LeanPool/GoldbergSeymour/BaseControl.lean b/LeanPool/GoldbergSeymour/BaseControl.lean index 6bab519b12..1f1c556a89 100644 --- a/LeanPool/GoldbergSeymour/BaseControl.lean +++ b/LeanPool/GoldbergSeymour/BaseControl.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module + + public import LeanPool.GoldbergSeymour.SharedFacts.BaseControl public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix @@ -241,112 +243,6 @@ private abbrev helperContinuation1245Conditions.{u_1, u_2} : Prop := (HierarchyStarredStage H r) ({ c } : Finset (Fin k)) → OutsideKempeRecoloring (HierarchyStarredStage H r) phi sigma alpha beta -private theorem helper_starChain_162.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; ( - ∀ {U W Z : TreeSequence G e0}, TreeSequenceInitialSegment U W → TreeSequenceInitialSegment W Z - → TreeSequenceInitialSegment U Z) → ( - ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), (↑i : ℕ) ≤ - j → TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : - ℕ))))) → ( - ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H r) - (H.stage r.succ)) → - ∀ (r s : Fin (H.dividerCount + (1 : ℕ))), r ≤ s → TreeSequenceInitialSegment - (HierarchyStarredStage H r) (HierarchyStarredStage H s) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H trans stageChain starStage r s hrs - by_cases heq : r = s - · subst s - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - · have hrlt : r.val < s.val := by - have := Fin.le_iff_val_le_val.mp hrs - have : r.val ≠ s.val := fun h => heq (Fin.ext h) - omega - have hs : s ≠ 0 := by intro hs; subst s; simp at hrlt - have hstar : HierarchyStarredStage H s = H.stage s.castSucc := by - rw [← Fin.succ_pred s hs] - rfl - rw [hstar] - exact trans (starStage r) - (stageChain s.val (by omega) r.succ (by simp; omega)) - -private theorem helper_hATy_184.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 - : ℕ))) T.length) ( - have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ min - (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ - by omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - omega - ); TreeSequenceInitialSegment A T → TreeSequenceInitialSegment A Ty := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hAT - have hlen : A.length ≤ Ty.length := by - change A.length ≤ min (A.length + ((T.length - A.length) - 1)) T.length - exact Nat.le_min.mpr ⟨Nat.le_add_right _ _, hAT.1⟩ - refine ⟨hlen, ?_, ?_⟩ - · intro j - change T.vertex _ = A.vertex j - exact hAT.2.1 j - · intro j - change T.edge _ = A.edge j - exact hAT.2.2 j - -private theorem helper_missingFirst_210.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Ty : TreeSequence G e0 := - TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction - fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ - by omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - omega); - TreeSequenceInitialSegment Ty T → - ∀ c ∈ TreeMissingColors phi Ty, - c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hTyT c hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - have hvT := TreeSequenceInitialSegmentVertexSetSubset hTyT hv - obtain ⟨j, hj⟩ : ∃ j, T.vertex j = v := by - simpa [TreeSequenceVertexSet] using hvT - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G phi (T.vertex j) - have hcandidates : candidates.Nonempty := by - refine ⟨j, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩⟩ - simpa [hj] using hcv - unfold HierarchyFirstMissingPosition - rw [dite_eq_left hcandidates] - exact (Finset.mem_filter.mp (Finset.min'_mem candidates hcandidates)).2 - private theorem helper_pathMissing_230.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) @@ -1496,24 +1392,13 @@ theorem P2813_T1_BaseControl {V E : Type*} have stageChain := @SharedFacts.BaseControl.stageChain (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) - have starStage (r : Fin (H.dividerCount + 1)) : - TreeSequenceInitialSegment (HierarchyStarredStage H r) - (H.stage r.succ) := by - clear * - H r - refine Fin.cases ?_ (fun i => ?_) r - · exact H.coreInsideFirst - · exact H.nested i.succ - have starChain := @helper_starChain_162 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) (@stageChain) - (@starStage) - have hAT : TreeSequenceInitialSegment A T := by - have hh := starStage q - have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl - simpa [hlast, H.terminalStage] using hh - have hATy := @helper_hATy_184 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) + have starChain := H.starredStageInitialSegmentOfLE + have hAT : TreeSequenceInitialSegment A T := H.lastStarredInitialSegment have hTyT : TreeSequenceInitialSegment Ty T := ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hATy : TreeSequenceInitialSegment A Ty := hTyT.of_common_extension hAT (by + change A.length ≤ min (A.length + ((T.length - A.length) - 1)) T.length + exact Nat.le_min.mpr ⟨Nat.le_add_right _ _, hAT.1⟩) have helemA : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by intro u hu v hv hne' exact hprefixElementary @@ -1526,8 +1411,9 @@ theorem P2813_T1_BaseControl {V E : Type*} (starChain r q (Fin.le_last r)) intro u hu v hv hne' exact helemA (hsub hu) (hsub hv) hne' - have missingFirst := @helper_missingFirst_210 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hTyT) + have missingFirst (color : Fin k) (member : color ∈ TreeMissingColors phi Ty) : + color ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T color)) := + TreeSequenceFirstMissingPositionMemOfMissing (hTyT.treeMissingColors_subset member) have haMissing : alpha ∈ MissingColors G phi a := missingFirst alpha hmissingPrefix.1 have hbMissing : beta ∈ MissingColors G phi b := diff --git a/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean b/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean index ad5e8c71c9..252fe28905 100644 --- a/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean +++ b/LeanPool/GoldbergSeymour/Basic2TerminalPE.lean @@ -231,66 +231,6 @@ private theorem helper_hstableR_473.{u_1, u_2} : exact hrecoveredStable.2 x (TreeSequenceInitialSegmentVertexSetSubset hRTerminal hx) -private theorem helper_hfirstLower_518.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), - let _ : DecidableEq V := Classical.decEq V; - ∀ (v : V) (_ : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (hqBefore : (↑q : ℕ) + (1 : - ℕ) < ett.rounds), - let r : ℕ := ett.rounds - (1 : ℕ); - ∀ (hrBefore : r < ett.rounds) (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨(↑q : ℕ) - + (1 : ℕ), - by omega - ⟩ : Fin (ett.rounds + (2 : ℕ))))) (lower : ExtendedTashkinovTree G k e0 input - (ett.series.data.tree (⟨r + (1 : ℕ), - by omega - ⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, - by omega - ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = r) (_ : ( - ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree - (Fin.castLE ( - by omega - ) i))) (hvLower : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨r + (1 : ℕ), - by omega - ⟩ : Fin (ett.rounds + (2 : ℕ))))), - let qLower : Fin lower.rounds := (⟨(↑q : ℕ), - by omega - ⟩ : Fin lower.rounds); ETTFirstAppearanceIndex lower v hvLower ≤ (↑qLower : ℕ) + (1 : ℕ) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive this v hvFinal q hqBefore r hrBefore - hvAtQ lower hr htree hvLower qLower - unfold ETTFirstAppearanceIndex - dsimp - have hqTreeCast : Fin.castLE (by omega) qLower.succ.castSucc = - (⟨q.val + 1, by omega⟩ : Fin (ett.rounds + 2)) := by - apply Fin.ext - rfl - have hmem : qLower.castSucc ∈ - Finset.univ.filter - (fun i : Fin (lower.rounds + 1) => - v ∈ TreeSequenceVertexSet - (ExtendedTashkinovLadderStage lower i)) := by - simp only [Finset.mem_filter, Finset.mem_univ, true_and] - rw [show ExtendedTashkinovLadderStage lower qLower.castSucc = - lower.series.data.tree qLower.succ.castSucc by - unfold ExtendedTashkinovLadderStage - exact @Fin.lastCases_castSucc lower.rounds - (fun _ : Fin (lower.rounds + 1) => TreeSequence G e0) - (ett.series.data.tree ⟨r + 1, by omega⟩) - (fun j => lower.series.data.tree j.succ.castSucc) qLower] - rw [htree qLower.succ.castSucc, hqTreeCast] - exact hvAtQ - have hle := Finset.min'_le - (Finset.univ.filter - (fun i : Fin (lower.rounds + 1) => - v ∈ TreeSequenceVertexSet - (ExtendedTashkinovLadderStage lower i))) qLower.castSucc hmem - have hnat := Fin.le_iff_val_le_val.mp hle - simpa [qLower] using Nat.succ_le_succ hnat - private theorem helper_continuation_618.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -466,9 +406,14 @@ private theorem helper_continuation_618.{u_1, u_2} : some vi := by rw [hqVertex, hqCast] exact hchosen - have hfirstLower := - @helper_hfirstLower_518 V E inferInstance inferInstance inferInstance G k e0 input T - generating ett hpositive v hvFinal q hqBefore hrBefore hvAtQ lower hr htree hvLower + have hfirstLower : ETTFirstAppearanceIndex lower v hvLower ≤ qLower.val + 1 := by + apply ETTFirstAppearanceIndex.le_of_series_mem lower v hvLower qLower + have castEqual : Fin.castLE (by omega) qLower.succ.castSucc = + (⟨q.val + 1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + rw [htree qLower.succ.castSucc, castEqual] + exact hvAtQ have hdefectiveLower : DefectiveColor G recovered (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) delta := by diff --git a/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean b/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean index 17cdcbba3d..f55a1492b8 100644 --- a/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean +++ b/LeanPool/GoldbergSeymour/Basic2TerminalSERE.lean @@ -284,66 +284,6 @@ private theorem helper_branch_305.{u_1, u_2} : exact ett.abovePenultimate exact orderTransfer hsegment v vi (by simpa [hslot, hchoice] using horder) -private theorem helper_hfirstLower_662.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds), - let _ : DecidableEq V := Classical.decEq V; - ∀ (v : V) (_ : v ∈ TreeSequenceVertexSet T) (q : Fin ett.rounds) (hqBefore : (↑q : ℕ) + (1 : - ℕ) < ett.rounds), - let r : ℕ := ett.rounds - (1 : ℕ); - ∀ (hrBefore : r < ett.rounds) (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨(↑q : ℕ) - + (1 : ℕ), - by omega - ⟩ : Fin (ett.rounds + (2 : ℕ))))) (lower : ExtendedTashkinovTree G k e0 input - (ett.series.data.tree (⟨r + (1 : ℕ), ( - by omega - )⟩ : Fin (ett.rounds + (2 : ℕ)))) (ett.series.data.coloring (⟨r, ( - by omega - )⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : lower.rounds = r) (_ : ( - ∀ (i : Fin (lower.rounds + (2 : ℕ))), lower.series.data.tree i = ett.series.data.tree - (Fin.castLE (( - by omega - )) i))) (hvLower : v ∈ TreeSequenceVertexSet (ett.series.data.tree (⟨r + (1 : ℕ), - by omega - ⟩ : Fin (ett.rounds + (2 : ℕ))))), - let qLower : Fin lower.rounds := (⟨(↑q : ℕ), - by omega - ⟩ : Fin lower.rounds); ETTFirstAppearanceIndex lower v hvLower ≤ (↑qLower : ℕ) + (1 : ℕ) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive this v hvFinal q hqBefore r hrBefore - hvAtQ lower hr htree hvLower qLower - unfold ETTFirstAppearanceIndex - dsimp - have hqTreeCast : Fin.castLE (by omega) qLower.succ.castSucc = - (⟨q.val + 1, by omega⟩ : Fin (ett.rounds + 2)) := by - apply Fin.ext - rfl - have hmem : qLower.castSucc ∈ - Finset.univ.filter - (fun i : Fin (lower.rounds + 1) => - v ∈ TreeSequenceVertexSet - (ExtendedTashkinovLadderStage lower i)) := by - simp only [Finset.mem_filter, Finset.mem_univ, true_and] - rw [show ExtendedTashkinovLadderStage lower qLower.castSucc = - lower.series.data.tree qLower.succ.castSucc by - unfold ExtendedTashkinovLadderStage - exact @Fin.lastCases_castSucc lower.rounds - (fun _ : Fin (lower.rounds + 1) => TreeSequence G e0) - (ett.series.data.tree ⟨r + 1, by omega⟩) - (fun j => lower.series.data.tree j.succ.castSucc) qLower] - rw [htree qLower.succ.castSucc, hqTreeCast] - exact hvAtQ - have hle := Finset.min'_le - (Finset.univ.filter - (fun i : Fin (lower.rounds + 1) => - v ∈ TreeSequenceVertexSet - (ExtendedTashkinovLadderStage lower i))) qLower.castSucc hmem - have hnat := Fin.le_iff_val_le_val.mp hle - simpa [qLower] using Nat.succ_le_succ hnat - private theorem helper_hstableR_735.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -525,9 +465,14 @@ private theorem helper_continuation_767.{u_1, u_2} : have hchosenLower : lower.series.data.chosenVertex qLower.succ = some vi := by rw [hqVertex, hqCast] exact hchosen - have hfirstLower := - @helper_hfirstLower_662 V E inferInstance inferInstance inferInstance G k e0 input T - generating ett hpositive v hvFinal q hqBefore hrBefore hvAtQ lower hr htree hvLower + have hfirstLower : ETTFirstAppearanceIndex lower v hvLower ≤ qLower.val + 1 := by + apply ETTFirstAppearanceIndex.le_of_series_mem lower v hvLower qLower + have castEqual : Fin.castLE (by omega) qLower.succ.castSucc = + (⟨q.val + 1, by omega⟩ : Fin (ett.rounds + 2)) := by + apply Fin.ext + rfl + rw [htree qLower.succ.castSucc, castEqual] + exact hvAtQ have hdefectiveLower : DefectiveColor G sigma (TreeSequenceVertexSet (lower.series.data.tree nLower.castSucc)) delta := by diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean index e8b8107241..af073cee99 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothInside.lean @@ -5,6 +5,9 @@ Authors: Wesley Pegden -/ module + +public import LeanPool.GoldbergSeymour.HierarchyTreeFacts + public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess public import LeanPool.GoldbergSeymour.HierarchyStageInterchangeability public import LeanPool.GoldbergSeymour.GoodHierarchyNewMissingClosed @@ -363,69 +366,6 @@ private theorem helper_hsame_542.{u_1, u_2} : exact equalFromInterchange (H.stage i.succ.castSucc) haCurrent hbCurrent (closedStar i.succ alpha beta hne ham hbm hclosed) -private theorem helper_stageChain_600.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - ∀ (_ : ( - ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : - TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (j : ℕ) (hj : j < - H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : ℕ) ≤ j), - TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : - ℕ)))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H trans j - induction j with - | zero => - intro hj i hi - have hi0 : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) - subst i - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - | succ j ih => - intro hj i hi - by_cases heq : i.val = j + 1 - · have heq' : i = ⟨j + 1, hj⟩ := Fin.ext heq - subst i - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - · exact trans (ih (by omega) i (by omega)) - (H.nested ⟨j, by omega⟩) - -private theorem helper_starChain_626.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - ∀ (_ : ( - ∀ {U W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment U W) (_ : - TreeSequenceInitialSegment W Z), TreeSequenceInitialSegment U Z)) (_ : ( - ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : - ℕ) ≤ j), TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + - (2 : ℕ)))))) (_ : ( - ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H r) - (H.stage r.succ))) (r s : Fin (H.dividerCount + (1 : ℕ))) (_ : r ≤ s), - TreeSequenceInitialSegment (HierarchyStarredStage H r) (HierarchyStarredStage H s) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H trans stageChain starStage r s hrs - by_cases heq : r = s - · subst s - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - · have hrlt : r.val < s.val := by - have := Fin.le_iff_val_le_val.mp hrs - have : r.val ≠ s.val := fun h => heq (Fin.ext h) - omega - have hs : s ≠ 0 := by intro hs; subst s; simp at hrlt - have hstar : HierarchyStarredStage H s = H.stage s.castSucc := by - rw [← Fin.succ_pred s hs] - rfl - rw [hstar] - exact trans (starStage r) - (stageChain s.val (by omega) r.succ (by simp; omega)) - private theorem helper_pathMissing_696.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -462,75 +402,6 @@ private theorem helper_pathMissing_696.{u_1, u_2} : exact congrArg Subtype.val (Fintype.card_le_one_iff.mp hcard ⟨x, hx⟩ ⟨y, hy⟩) -private theorem helper_hATy_738.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Ty : TreeSequence G e0 := - TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction - fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ - by omega) - (by omega); - ∀ (_ : TreeSequenceInitialSegment A T), - TreeSequenceInitialSegment A Ty := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hAT - have hlen : A.length ≤ Ty.length := by - change A.length ≤ min (A.length + ((T.length - A.length) - 1)) T.length - exact Nat.le_min.mpr ⟨Nat.le_add_right _ _, hAT.1⟩ - refine ⟨hlen, ?_, ?_⟩ - · intro j - change T.vertex _ = A.vertex j - exact hAT.2.1 j - · intro j - change T.edge _ = A.edge j - exact hAT.2.2 j - -private theorem helper_missingFirst_764.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Ty : TreeSequence G e0 := - TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 : ℕ))) T.length) - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction - fun (a : ¬(1 : ℕ) ≤ min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ - by omega) - (by omega); - ∀ (_ : TreeSequenceInitialSegment Ty T), - ∀ c ∈ TreeMissingColors phi Ty, - c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A Ty hTyT c hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - have hvT := TreeSequenceInitialSegmentVertexSetSubset hTyT hv - obtain ⟨j, hj⟩ : ∃ j, T.vertex j = v := by - simpa [TreeSequenceVertexSet] using hvT - let candidates := Finset.univ.filter fun j : Fin (T.length + 1) => - c ∈ MissingColors G phi (T.vertex j) - have hcandidates : candidates.Nonempty := by - refine ⟨j, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩⟩ - simpa [hj] using hcv - unfold HierarchyFirstMissingPosition - rw [dite_eq_left hcandidates] - exact (Finset.mem_filter.mp (Finset.min'_mem candidates hcandidates)).2 - private theorem helper_interchangeableSwap_801.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Finite E] (G : LooplessMultigraph V E) (k : ℕ) (e0 @@ -629,40 +500,6 @@ private theorem helper_nonPEMissingClosed_914.{u_1, u_2} : phi f = some c := by simpa [BoundaryColorEdges] using hf exact hnonPEClosed hnonPE hfd.1 hx hfd.2 hcx -private theorem helper_starStage_899.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - ∀ (r : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HierarchyStarredStage H r) (H.stage r.succ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H r - refine Fin.cases ?_ (fun i => ?_) r - · exact H.coreInsideFirst - · exact H.nested i.succ - -private theorem helper_hAT_912.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (_ : ( - ∀ (r : Fin (H.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment (HierarchyStarredStage H r) - (H.stage r.succ))), TreeSequenceInitialSegment A T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A starStage - have hh := starStage q - have hlast : q.succ = Fin.last (H.dividerCount + 1) := Fin.ext rfl - simpa [hlast, H.terminalStage] using hh - private theorem helper_helemStar_926.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -952,22 +789,13 @@ theorem ChangeLemmaBothInside {V E : Type*} (by have hA := A.positive; have hT := T.positive; omega) (Nat.min_le_right _ _) have trans := @helper_trans_800 (@V) (@E) (@G) (@e0) - have stageChain := - @helper_stageChain_600 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) - have starStage := @helper_starStage_899 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - have starChain := @helper_starChain_626 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@trans) (@stageChain) - (@starStage) - have hAT := - @helper_hAT_912 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@starStage) - have hATy := - @helper_hATy_738 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hAT) + have starChain := H.starredStageInitialSegmentOfLE + have hAT : TreeSequenceInitialSegment A T := H.lastStarredInitialSegment have hTyT : TreeSequenceInitialSegment Ty T := ⟨Nat.min_le_right _ _, fun _ => rfl, fun _ => rfl⟩ + have hATy : TreeSequenceInitialSegment A Ty := hTyT.of_common_extension hAT (by + change A.length ≤ min (A.length + ((T.length - A.length) - 1)) T.length + exact Nat.le_min.mpr ⟨Nat.le_add_right _ _, hAT.1⟩) have helemA : ColoredVertexSetElementary G phi (TreeSequenceVertexSet A) := by intro u hu v hv hne' exact hprefixElementary @@ -975,8 +803,9 @@ theorem ChangeLemmaBothInside {V E : Type*} (TreeSequenceInitialSegmentVertexSetSubset hATy hv) hne' have helemStar := @helper_helemStar_926 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@starChain) (@helemA) - have missingFirst := @helper_missingFirst_764 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hTyT) + have missingFirst (color : Fin k) (member : color ∈ TreeMissingColors phi Ty) : + color ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T color)) := + TreeSequenceFirstMissingPositionMemOfMissing (hTyT.treeMissingColors_subset member) have haMissing : alpha ∈ MissingColors G phi a := missingFirst alpha hmissingPrefix.1 have hbMissing : beta ∈ MissingColors G phi b := diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean index ff3bad6f78..9b26c72a07 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside.lean @@ -196,7 +196,8 @@ theorem ChangeLemmaBothOutside {V E : Type*} have firstMissing (c : Fin k) (hc : c ∈ TreeMissingColors phi Y) : c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ (HierarchyFirstMissingPosition phi T c).val ≤ Y.length := by - exact @helper_firstMissing_1057 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.firstMissingPositionWitness (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@YToT) (@c) (@hc) have ha := firstMissing alpha hmissingY.1 have hb := firstMissing beta hmissingY.2 diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean index ca21f71cbb..aceceb3243 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation1.lean @@ -5,6 +5,9 @@ Authors: Wesley Pegden -/ module + +public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation2 + public import LeanPool.GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess @@ -1012,105 +1015,14 @@ abbrev helperContinuation4653Conditions.{u_1, u_2} : Prop := phi f ≠ some beta) → False -theorem helper_missingBefore_438.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : alpha ≠ beta), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let va : V := T.vertex ia; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - ∀ (_ : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y)) - (_ : - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length) - (_ : - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length) - (_ : va ∈ TreeSequenceVertexSet Y) (_ : vb ∈ TreeSequenceVertexSet Y) - (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (_ : TreeSequenceInitialSegment B Y), - let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (_ : Sum.inl va ∉ K) - (_ : - (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - have phi' : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ - (∀ (v : V), - Sum.inl v ∈ C → - alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ - (∀ (v : V), - Sum.inl v ∈ C → - beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ - ∀ (v : V) (c : Fin k), - c ≠ alpha → - c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v))) - (_ : - (∀ {v : V} {f : E} (_ : Sum.inl v ∈ K) (_ : Incident G v f) - (_ : phi f = some alpha ∨ phi f = some beta), Sum.inr f ∈ K)), - ∀ v ∈ TreeSequenceVertexSet B, - v ≠ vb → - MissingColors G sigma v = MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ia ib va vb ell yLength Y - hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb - by_cases hvK : Sum.inl v ∈ K - · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) - have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv - have han : alpha ∉ MissingColors G phi v := fun hc => - Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 - have hbn : beta ∉ MissingColors G phi v := fun hc => - Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 - have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by - simpa [MissingColors, PresentColors] using han - have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by - simpa [MissingColors, PresentColors] using hbn - obtain ⟨fa, hfa, hfca⟩ := hpa - obtain ⟨fb, hfb, hfcb⟩ := hpb - have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) - have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) - have hnewa : sigma fb = some alpha := by - simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] - have hnewb : sigma fa = some beta := by - simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] - have hana : alpha ∉ MissingColors G sigma v := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, - PresentColors, Finset.mem_filter, not_not] - exact ⟨fb, hfb, hnewa⟩ - have hbnb : beta ∉ MissingColors G sigma v := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, - PresentColors, Finset.mem_filter, not_not] - exact ⟨fa, hfa, hnewb⟩ - ext c - by_cases hca : c = alpha - · subst c; simp [hana, han] - · by_cases hcb : c = beta - · subst c; simp [hbnb, hbn] - · exact behavior.2.2.2 v c hca hcb - · exact behavior.1 v hvK +alias helper_lastPositive_1007 := + SharedFacts.ChangeLemmaBothOutsidePreparation1.lastStarredStageOfPositiveCount + +alias helper_stageToT_998 := + SharedFacts.ChangeLemmaBothOutsidePreparation1.ordinaryStageInitialSegmentOfTerminal + +alias helper_missingNotA_1098 := + SharedFacts.ChangeLemmaBothOutsidePreparation1.missingColorOutsideStarredPrefix theorem helper_terminalRoute_532.{u_1, u_2} : open scoped Classical in @@ -1824,51 +1736,6 @@ theorem helper_commonPrefix_982.{u_1, u_2} : SharedFacts.ChangeLemmaBothOutsidePreparation1.comparableInitialSegmentsStatement.{u_1, u_2} := SharedFacts.ChangeLemmaBothOutsidePreparation1.comparableInitialSegments.{u_1, u_2} -theorem helper_stageToT_998.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - ∀ (j : Fin (H.dividerCount + (2 : ℕ))), - TreeSequenceInitialSegment (H.stage j) T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H stageSegment j - have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) - have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : - Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := - Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) - simpa [he, H.terminalStage] using hs - -theorem helper_lastPositive_1007.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A hz - obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q - · have hv := congrArg Fin.val hzero - simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv - exact (hz hv).elim - · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] - congr 1 - apply Fin.ext - have hv := congrArg Fin.val hi - simpa [q] using hv.symm theorem helper_coreToA_1018.{u_1, u_2} : open scoped Classical in @@ -1961,89 +1828,11 @@ theorem helper_ordinaryToA_1038.{u_1, u_2} : convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> simp only [Fin.val_castSucc]; omega -theorem helper_firstMissing_1057.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - TreeSequenceInitialSegment Y T → - ∀ c ∈ TreeMissingColors phi Y, - c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ - (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A ell yLength Y YToT c hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - obtain ⟨i, hi⟩ := hv - let it := Fin.castLE (Nat.succ_le_succ YToT.1) i - have hci : c ∈ MissingColors G phi (T.vertex it) := by - rw [YToT.2.1 i, hi] - exact hcv - let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) - have hit : it ∈ candidates := by simp [candidates, hci] - have hnon : candidates.Nonempty := ⟨it, hit⟩ - have hmem := Finset.min'_mem candidates hnon - have hle := Finset.min'_le candidates it hit - refine ⟨?_, ?_⟩ - · simpa [HierarchyFirstMissingPosition, candidates, hnon] using - (Finset.mem_filter.mp hmem).2 - · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt - have hval : (candidates.min' hnon).val ≤ it.val := hle - simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv - -/-- Existing proof-module entry point for the shared interface or construction. -/ theorem helper_outsideIndex_1087.{u_1, u_2} : SharedFacts.ChangeLemmaBothOutsidePreparation1.missingPositionOutsidePrefixStatement.{u_1, u_2} := SharedFacts.ChangeLemmaBothOutsidePreparation1.missingPositionOutsidePrefix.{u_1, u_2} -theorem helper_missingNotA_1098.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - alpha ≠ beta → - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - TreeSequenceInitialSegment A Y → - ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), - c ∈ MissingColors G phi (T.vertex i) → - T.vertex i ∈ TreeSequenceVertexSet Y → - T.vertex i ∉ TreeSequenceVertexSet A → - c ∉ TreeMissingColors phi A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ell yLength Y hElementaryY - AToY c i hmi hiy hia hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) - exact (Finset.disjoint_left.mp - (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi theorem helper_BstrictT_1127.{u_1, u_2} : open scoped Classical in @@ -3026,166 +2815,6 @@ theorem helper_storedEq_1440.{u_1, u_2} : Dn \ TreeMissingColors phi (HierarchyStarredStage HB j) rw [storedS, starEq, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starBToA j))] -theorem helper_missingEq_1447.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - refine Fin.cases ?_ (fun i => ?_) j - · change TreeMissingColors sigma (corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn - have htree : corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc = Tn := - hsbase.symm.trans hbbase - rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] - · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) - theorem helper_firstEq_1458.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -4353,7 +3982,8 @@ theorem helper_missingEq_3382.{u_1, u_2} : hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS j - exact @helper_missingEq_1447 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.missingColorsEquality (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean index f6e62aaff3..133302d313 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaBothOutside/Preparation6.lean @@ -1096,7 +1096,8 @@ theorem helper_finish_4308.{u_1, u_2} : -- Elementarity fixes missing sets before the swapped endpoint, even inside its component. have missingBefore (v : V) (hv : v ∈ TreeSequenceVertexSet B) (hvb : v ≠ vb) : MissingColors G sigma v = MissingColors G phi v := by - exact @helper_missingBefore_438 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.MixedChangeTransport.notMissingBeforeFirstPosition (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hne) (@hElementaryY) (@ha) (@hb) (@haY) (@hbY) (@hAib) (@BToY) (@haK) (@behavior) (@edgeOfVertex) (@v) (@hv) (@hvb) diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean index 3fa1112696..80ac91b3e5 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedClosedFinal.lean @@ -1345,915 +1345,6 @@ private theorem helper_hinter_3043.{u_1, u_2} : (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) (@hfewer) (@hlarge) (@alpha) (@beta) (@hne) (@lastPositive) (@halphaA) (@halphaClosed) (@hz) -private theorem helper_storedEq_3248.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn → - ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - exact @SharedFacts.MixedChangeTransport.storedColorsEquality (@V) (@E) inferInstance - inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) - (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) - (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) - -private theorem helper_missingEq_3257.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - exact @SharedFacts.MixedChangeTransport.missingColorsEquality (@V) (@E) inferInstance - inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) - (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) - (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@j) - -private theorem helper_segmentEq_3284.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - (∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = - HierarchyFirstMissingPosition phi B eta) → - ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - exact @SharedFacts.MixedChangeTransport.initialSegmentEquality (@V) (@E) inferInstance - inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) - (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) - -private theorem helper_refreshEq_3294.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact @SharedFacts.MixedChangeTransport.refreshedHierarchyEquality (@V) (@E) inferInstance - inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) - (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@i) - -private theorem helper_hstarLast_3349.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (hcountB : - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount = - H.dividerCount), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc = - H.stage jo.castSucc ∧ - HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j = - HierarchyStarredStage H jo) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - HierarchyStarredStage HS (Fin.last count) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested - hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - exact @SharedFacts.MixedChangeTransport.lastStarredStageEquality (@V) (@E) inferInstance - inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) - (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) - (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) - (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) (@hspositive) - (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) - (@starEq) - -private theorem helper_pathLe_3363.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - A.length < B.length → - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - HierarchyStarredStage HS (Fin.last count) = A → - HierarchyPathNumber HS ≤ HierarchyPathNumber H := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb AToT hAib B BToT - ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - exact @SharedFacts.MixedChangeTransport.pathLengthUpperBound (@V) (@E) inferInstance - inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) - (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) - (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) - (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) - private theorem helper_continuation_5185.{u_1, u_2} : helperContinuation5185Conditions.{u_1, u_2} := by classical @@ -2294,7 +1385,8 @@ private theorem helper_continuation_5185.{u_1, u_2} : exact Fin.cases hcore.symm (fun i => rfl) j have storedEq (j : Fin (count + 1)) : HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - exact @helper_storedEq_3248 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @GoldbergSeymour.SharedFacts.MixedChangeTransport.storedColorsEquality (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) @@ -2303,7 +1395,8 @@ private theorem helper_continuation_5185.{u_1, u_2} : (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) have missingEq (j : Fin (count + 1)) : HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - exact @helper_missingEq_3257 (@V) (@E) inferInstance inferInstance inferInstance + exact @GoldbergSeymour.SharedFacts.MixedChangeTransport.missingColorsEquality (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) @@ -2334,7 +1427,8 @@ private theorem helper_continuation_5185.{u_1, u_2} : have segmentEq (j : Fin (count + 1)) (eta : Fin k) (he : eta ∈ HierarchyStoredColorsAt HB j) : HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by - exact @helper_segmentEq_3284 (@V) (@E) inferInstance inferInstance inferInstance + exact @GoldbergSeymour.SharedFacts.MixedChangeTransport.initialSegmentEquality (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) @@ -2348,7 +1442,8 @@ private theorem helper_continuation_5185.{u_1, u_2} : ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion fun v => MissingColors G phi v) := by - exact @helper_refreshEq_3294 (@V) (@E) inferInstance inferInstance inferInstance + exact @GoldbergSeymour.SharedFacts.MixedChangeTransport.refreshedHierarchyEquality (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) @@ -2397,7 +1492,8 @@ private theorem helper_continuation_5185.{u_1, u_2} : maximum := hMPS notElementary := sigmaNotElementary } have hstarLast : HierarchyStarredStage HS (Fin.last count) = A := by - exact @helper_hstarLast_3349 (@V) (@E) inferInstance inferInstance inferInstance + exact @GoldbergSeymour.SharedFacts.MixedChangeTransport.lastStarredStageEquality (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) @@ -2411,7 +1507,8 @@ private theorem helper_continuation_5185.{u_1, u_2} : simpa only [hj] using hs -- Path candidates restrict to the shorter prefix; the second measure decreases strictly. have pathLe : HierarchyPathNumber HS ≤ HierarchyPathNumber H := by - exact @helper_pathLe_3363 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @GoldbergSeymour.SharedFacts.MixedChangeTransport.pathLengthUpperBound (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean index ec8291091b..c66dd74837 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedLargestClosed.lean @@ -5,7 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.SharedFacts.LargestClosedTransport +public import LeanPool.GoldbergSeymour.HierarchyTreeFacts + public import LeanPool.GoldbergSeymour.HierarchyCounterexampleLess @@ -450,239 +451,6 @@ private abbrev helperContinuation4559Conditions.{u_1, u_2} : Prop := (Sum.inl vb); sameComponent -private abbrev helperHstarLast5324Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - have this_1 : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (have this : (1 : ℕ) ≤ T.length := T.positive; - by - have := GoldbergSeymour.TreeSequence.positive T - have := Fin.isLt beta - have := Fin.isLt ib - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, - have this : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) - (strictB : - (ett.series.data.tree - (⟨ett.rounds, - have this : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - have := Fin.isLt i - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - have := Fin.isLt beta - have := Fin.isLt q - have := Fin.isLt ib - have := Fin.isLt i - have := aboveB.1 - have := belowB.1 - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (hcountB : - { dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, - dividerStage := hbdivider, coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount = - H.dividerCount), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - have jo : Fin (H.dividerCount + (1 : ℕ)) := - Fin.cast - (have this : (1 : ℕ) ≤ T.length := T.positive; - have this : (1 : ℕ) ≤ A.length := A.positive; - have this : (1 : ℕ) ≤ B.length := B.positive; - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - have := Fin.isLt beta - have := Fin.isLt q - have := Fin.isLt ib - have := aboveB.1 - have := belowB.1 - have := hbcore.1 - omega) - j; - { dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, - dividerStage := hbdivider, coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc = - H.stage jo.castSucc ∧ - HierarchyStarredStage - { - dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB } - j = - HierarchyStarredStage H jo) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - have := Fin.isLt i - have := hbcore.1 - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - have := Fin.isLt beta - have := Fin.isLt q - have := Fin.isLt ib - have := Fin.isLt i - have := aboveB.1 - have := belowB.1 - have := hbcore.1 - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - have := hbcore.1 - omega⟩ : - Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, - dividerStage := hbdivider, coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, - nested := hsnested, strict := hsstrict, dividerPosition := positionsS, - dividerPositive := hspositive, dividerIncreasing := hsincreasing, - dividerStage := hsdivider, coreInsideFirst := hscore : - TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - HierarchyStarredStage HS (Fin.last count) = A - private abbrev helperContinuation5082Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] @@ -869,76 +637,7 @@ private abbrev helperContinuation5082Conditions.{u_1, u_2} : Prop := Dn → False -private abbrev helperPathLe3869Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - A.length < B.length → - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) - (belowB : TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : - TashkinovHierarchy corr.replacementETT baseS }; - HierarchyStarredStage HS (Fin.last count) = A → - HierarchyPathNumber HS ≤ HierarchyPathNumber H - -private abbrev helperStoredEq5179Conditions.{u_1, u_2} : Prop := +private abbrev helperParallelBase6126Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) @@ -947,40 +646,22 @@ private abbrev helperStoredEq5179Conditions.{u_1, u_2} : Prop := (C : HierarchyCounterexample base) (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - have this_1 : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (have this : (1 : ℕ) ≤ T.length := T.positive; - by - have := GoldbergSeymour.TreeSequence.positive T - have := Fin.isLt beta - have := Fin.isLt ib - have := GoldbergSeymour.TreeSequence.positive T - omega); + ∀ (TnToA : TreeSequenceInitialSegment Tn A) (coreToR : TreeSequenceInitialSegment base.core R) + (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); ∀ (rpB : (1 : ℕ) ≤ ett.rounds) (aboveB : TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, - have this : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) (strictB : - (ett.series.data.tree - (⟨ett.rounds, - have this : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < + (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < B.length) (belowB : TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) @@ -991,27 +672,35 @@ private abbrev helperStoredEq5179Conditions.{u_1, u_2} : Prop := rounds := ett.rounds, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), + phi) + (hcoreB : baseB.core = base.core), let ettB : ExtendedTashkinovTree G k e0 input B phi := { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma), - TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = - Dn → - ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + ∀ + (treeMissingEq : + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) + (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (baseS : HierarchyBase corr.replacementETT sigma) + (closureBToA : + ∀ (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A) + (minusEq : + ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R) + (D : Finset (Fin k)), + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D) + (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) (hbbase : stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree (Fin.last { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, @@ -1030,257 +719,49 @@ private abbrev helperStoredEq5179Conditions.{u_1, u_2} : Prop := ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) (hbdivider : ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - have := Fin.isLt i - omega⟩ : - Fin (count + (2 : ℕ))) = + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - have := Fin.isLt beta - have := Fin.isLt q - have := Fin.isLt ib - have := Fin.isLt i - have := aboveB.1 - have := belowB.1 - have := GoldbergSeymour.TreeSequence.positive B - omega)) + (Nat.le_of_lt_succ (positions i).isLt)) (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { - dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - have := Fin.isLt i - have := hbcore.1 - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - have := Fin.isLt beta - have := Fin.isLt q - have := Fin.isLt ib - have := Fin.isLt i - have := aboveB.1 - have := belowB.1 - have := hbcore.1 - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - have := hbcore.1 - omega⟩ : - Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j - -private abbrev helperSegmentEq5215Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - have this_1 : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (have this : (1 : ℕ) ≤ T.length := T.positive; - by - have := GoldbergSeymour.TreeSequence.positive T - have := Fin.isLt beta - have := Fin.isLt ib - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, - have this : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) - (strictB : - (ett.series.data.tree - (⟨ett.rounds, - have this : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last + TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (goodB : + GoodHierarchy + { + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, + dividerStage := hbdivider, coreInsideFirst := hbcore : + TashkinovHierarchy + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } + baseB }) + (hcore : baseB.core = baseS.core) + (hpe : + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.kind + (Fin.last { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - have := Fin.isLt i - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - have := Fin.isLt beta - have := Fin.isLt q - have := Fin.isLt ib - have := Fin.isLt i - have := aboveB.1 - have := belowB.1 - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.kind + (Fin.last + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = baseS.closure) + (positionsS : Fin count → Fin (B.length + (1 : ℕ))) (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) (hsincreasing : ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) @@ -1295,2074 +776,324 @@ private abbrev helperSegmentEq5215Conditions.{u_1, u_2} : Prop := ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) (hsdivider : ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - have := Fin.isLt i - have := hbcore.1 - omega⟩ : - Fin (count + (2 : ℕ))) = + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - have := Fin.isLt beta - have := Fin.isLt q - have := Fin.isLt ib - have := Fin.isLt i - have := aboveB.1 - have := belowB.1 - have := hbcore.1 - have := GoldbergSeymour.TreeSequence.positive B - omega)) + (Nat.le_of_lt_succ (positionsS i).isLt)) (hscore : TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - have := hbcore.1 - omega⟩ : - Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : - TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : - TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - (∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta) → - ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta - -private abbrev helperRefreshEq5225Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - have this_1 : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (have this : (1 : ℕ) ≤ T.length := T.positive; - by - have := GoldbergSeymour.TreeSequence.positive T - have := Fin.isLt beta - have := Fin.isLt ib - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, - have this : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) - (strictB : - (ett.series.data.tree - (⟨ett.rounds, - have this : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - have := Fin.isLt i - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - have := Fin.isLt beta - have := Fin.isLt q - have := Fin.isLt ib - have := Fin.isLt i - have := aboveB.1 - have := belowB.1 - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - have := Fin.isLt i - have := hbcore.1 - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - have := Fin.isLt beta - have := Fin.isLt q - have := Fin.isLt ib - have := Fin.isLt i - have := aboveB.1 - have := belowB.1 - have := hbcore.1 - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - have := hbcore.1 - omega⟩ : - Fin (count + (2 : ℕ))))), let HB : TashkinovHierarchy ettB baseB := { - dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : - TashkinovHierarchy ettB baseB }; + dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, + nested := hbnested, strict := hbstrict, dividerPosition := positions, + dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; let HS : TashkinovHierarchy corr.replacementETT baseS := { - dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : - TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v + dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, + nested := hsnested, strict := hsstrict, dividerPosition := positionsS, + dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, + coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; + ∀ + (storedEq : + ∀ (j : Fin (count + (1 : ℕ))), HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j), + let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last corr.replacementETT.rounds; + let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; + corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → + ¬TreeColorSetMinusClosed G sigma baseS.core + ((HierarchyStoredColorsAt HS (0 : Fin (HS.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (HS.dividerCount + (1 : ℕ))))) ∧ + (4 : ℕ) ≤ + ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma baseS.closure : Finset (Fin k)) \ + (HierarchyStoredColorsAt HS (0 : Fin (HS.dividerCount + (1 : ℕ)))).biUnion + (goodB.gamma (0 : Fin (HS.dividerCount + (1 : ℕ))))).card -private abbrev helperMissingEq5953Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - have this_1 : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (have this : (1 : ℕ) ≤ T.length := T.positive; - by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, - have this : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) - (strictB : - (ett.series.data.tree - (⟨ett.rounds, - have this : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j - -private abbrev helperPathLe6085Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - have _ : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (have _ : (1 : ℕ) ≤ T.length := T.positive; - by omega); - TreeSequenceInitialSegment B T → - A.length < B.length → - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, - have _ : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) - (strictB : - (ett.series.data.tree - (⟨ett.rounds, - have _ : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬ett.rounds < ett.rounds + (2 : ℕ)) ↦ by omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : - TashkinovHierarchy corr.replacementETT baseS }; - HierarchyStarredStage HS (Fin.last count) = A → - HierarchyPathNumber HS ≤ HierarchyPathNumber H - -private abbrev helperParallelBase6126Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (TnToA : TreeSequenceInitialSegment Tn A) (coreToR : TreeSequenceInitialSegment base.core R) - (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi) - (hcoreB : baseB.core = base.core), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (treeMissingEq : - ∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) - (closureBToA : - ∀ (hp : ett.series.data.kind n = some TashkinovExtensionKind.PE), - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A) - (minusEq : - ∀ (S : TreeSequence G e0) (hS : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R) - (D : Finset (Fin k)), - TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D) - (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (goodB : - GoodHierarchy - { - dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, - dividerStage := hbdivider, coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }) - (hcore : baseB.core = baseS.core) - (hpe : - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.kind - (Fin.last - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) - (hclosure : - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.kind - (Fin.last - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = baseS.closure) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, - nested := hsnested, strict := hsstrict, dividerPosition := positionsS, - dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (storedEq : - ∀ (j : Fin (count + (1 : ℕ))), HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j), - let n : Fin (corr.replacementETT.rounds + (1 : ℕ)) := Fin.last corr.replacementETT.rounds; - let Tn : TreeSequence G e0 := corr.replacementETT.series.data.tree n.castSucc; - corr.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE → - ¬TreeColorSetMinusClosed G sigma baseS.core - ((HierarchyStoredColorsAt HS (0 : Fin (HS.dividerCount + (1 : ℕ)))).biUnion - (goodB.gamma (0 : Fin (HS.dividerCount + (1 : ℕ))))) ∧ - (4 : ℕ) ≤ - ((TreeMissingColors sigma Tn ∩ TreeMissingColors sigma baseS.closure : Finset (Fin k)) \ - (HierarchyStoredColorsAt HS (0 : Fin (HS.dividerCount + (1 : ℕ)))).biUnion - (goodB.gamma (0 : Fin (HS.dividerCount + (1 : ℕ))))).card - -private abbrev helperSegmentEq7714Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (edgesFixed : ∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (stageBToB : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, - nested := hsnested, strict := hsstrict, dividerPosition := positionsS, - dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (starEq : - ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (firstEq : - ∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta) - (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta - -private abbrev helperMissingEq7904Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (TnToA : TreeSequenceInitialSegment Tn A) (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (treeMissingEq : - ∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (stageBToA : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, - nested := hsnested, strict := hsstrict, dividerPosition := positionsS, - dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j - -private abbrev helperRefreshEq8147Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (missingA : ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (stageBToA : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, - nested := hsnested, strict := hsstrict, dividerPosition := positionsS, - dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (starEq : - ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v - -private theorem lexicographicMeasureDecreases {a b c d : ℕ} - (hab : a ≤ b) (hcd : c < d) : HierarchyCounterexampleLess (a, c) (b, d) := by - rcases lt_or_eq_of_le hab with h | h - · exact Or.inl h - · exact Or.inr ⟨h, hcd⟩ - -private theorem helper_stageSegment_233.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H segRefl segTrans a d hbound - clear * - H hbound segRefl segTrans - induction d with - | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) - | succ d ih => - exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) - -private theorem helper_stageToT_241.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - ∀ (j : Fin (H.dividerCount + (2 : ℕ))), - TreeSequenceInitialSegment (H.stage j) T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H stageSegment j - clear * - H j stageSegment - have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) - have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : - Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := - Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) - simpa [he, H.terminalStage] using hs - -private theorem helper_lastPositive_252.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H q A hz - clear * - hz A q - obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q - · have hv := congrArg Fin.val hzero - simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv - exact (hz hv).elim - · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] - congr 1 - apply Fin.ext - have hv := congrArg Fin.val hi - simpa [q] using hv.symm - -private theorem helper_coreToA_264.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - (H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → - TreeSequenceInitialSegment base.core A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H q A segRefl segTrans stageSegment lastZero - lastPositive - clear * - H base A lastZero lastPositive segRefl segTrans stageSegment - by_cases hz : H.dividerCount = 0 - · rw [lastZero hz] - exact segRefl _ - · rw [lastPositive hz] - have hs := stageSegment 1 (H.dividerCount - 1) (by omega) - have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega - simpa [he] using segTrans H.coreInsideFirst hs - -private theorem helper_AToT_280.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - (H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → - TreeSequenceInitialSegment A T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H q A segTrans stageToT lastZero lastPositive - clear * - H A lastZero lastPositive segTrans stageToT - by_cases hz : H.dividerCount = 0 - · rw [lastZero hz] - exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) - · rw [lastPositive hz] - exact stageToT _ - -private theorem helper_ordinaryToA_287.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - (H.dividerCount = (0 : ℕ) → A = base.core) → - (H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → - TreeSequenceInitialSegment Tn A → - ∀ (j : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (H.stage j.castSucc) A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H q A n Tn stageSegment lastZero lastPositive - TnToA j - clear * - H A TnToA stageSegment lastZero lastPositive - by_cases hz : H.dividerCount = 0 - · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) - rw [hj, H.baseStage] - exact TnToA - · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) - rw [lastPositive hz] - convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> - simp only [Fin.val_castSucc]; omega - -private theorem helper_starPositive_301.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - ∀ (j : Fin (H.dividerCount + (1 : ℕ))), - (↑j : ℕ) ≠ (0 : ℕ) → - HierarchyStarredStage H j = H.stage j.castSucc := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H j hj - obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ j - · exact (hj (congrArg Fin.val hz)).elim - · rw [hi] - rfl - -private theorem helper_coreToStar_308.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - (∀ (j : Fin (H.dividerCount + (1 : ℕ))), - (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → - ∀ (j : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment base.core (HierarchyStarredStage H j) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H segRefl segTrans stageSegment starPositive j - clear * - j H segRefl segTrans stageSegment starPositive - by_cases hz : j.val = 0 - · have hj : j = 0 := Fin.ext hz - rw [hj] - exact segRefl _ - · rw [starPositive j hz] - have hs := stageSegment 1 (j.val - 1) (by omega) - have he : 1 + (j.val - 1) = j.val := by omega - convert segTrans H.coreInsideFirst hs using 1 - apply congrArg H.stage - apply Fin.ext - simpa using he.symm - -private theorem helper_ordinaryToR_330.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - (↑r : ℕ) < H.dividerCount → - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - ((↑r : ℕ) = (0 : ℕ) → R = base.core) → - ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → - TreeSequenceInitialSegment Tn R → - ∀ (j : Fin (H.dividerCount + (1 : ℕ))), - (↑j : ℕ) ≤ (↑r : ℕ) → - TreeSequenceInitialSegment (H.stage j.castSucc) R := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H R hrq n Tn stageSegment rZero rPositive - TnToR j hj - by_cases hr : r.val = 0 - · have hj0 : j.castSucc = (0 : Fin (H.dividerCount + 2)) := by - apply Fin.ext - simp only [Fin.val_castSucc, Fin.val_zero] - omega - rw [hj0, H.baseStage] - exact TnToR - · rw [rPositive hr] - have hs := stageSegment j.val (r.val - j.val) (by omega) - convert hs using 1 - · exact congrArg H.stage (Fin.ext rfl) - · apply congrArg H.stage - apply Fin.ext - simp only [Fin.val_castSucc] - omega - -private theorem helper_firstMissing_354.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - TreeSequenceInitialSegment Y T → - ∀ c ∈ TreeMissingColors phi Y, - c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ - (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H q A ell yLength Y YToT c hc - clear * - hc YToT - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - obtain ⟨i, hi⟩ := hv - let it := Fin.castLE (Nat.succ_le_succ YToT.1) i - have hci : c ∈ MissingColors G phi (T.vertex it) := by - rw [YToT.2.1 i, hi] - exact hcv - let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) - have hit : it ∈ candidates := by simp [candidates, hci] - have hnon : candidates.Nonempty := ⟨it, hit⟩ - have hmem := Finset.min'_mem candidates hnon - have hle := Finset.min'_le candidates it hit - refine ⟨?_, ?_⟩ - · simpa [HierarchyFirstMissingPosition, candidates, hnon] using - (Finset.mem_filter.mp hmem).2 - · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt - have hval : (candidates.min' hnon).val ≤ it.val := hle - simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv - -private theorem helper_missingNotA_397.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - alpha ≠ beta → - ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - TreeSequenceInitialSegment A Y → - ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), - c ∈ MissingColors G phi (T.vertex i) → - T.vertex i ∈ TreeSequenceVertexSet Y → - T.vertex i ∉ TreeSequenceVertexSet A → - c ∉ TreeMissingColors phi A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H q A ell yLength Y - hElementaryY AToY c i hmi hiy hia - clear * - hmi hiy hia AToY hElementaryY - intro hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) - exact (Finset.disjoint_left.mp - (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi - -private theorem helper_elementaryStar_409.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - (∀ (j : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - TreeSequenceInitialSegment A Y → - ∀ (j : Fin (H.dividerCount + (1 : ℕ))), - ColoredVertexSetElementary G phi (TreeSequenceVertexSet (HierarchyStarredStage H j)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H q A ell yLength Y segTrans starredToA - hElementaryY AToY j - clear * - j starredToA AToY hElementaryY segTrans - intro u hu v hv huv - have hs := segTrans (starredToA j) AToY - exact hElementaryY (TreeSequenceInitialSegmentVertexSetSubset hs hu) - (TreeSequenceInitialSegmentVertexSetSubset hs hv) huv - -private theorem helper_descend_417.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k), - alpha ≠ beta → - ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ (s : Fin (H.dividerCount + (1 : ℕ))), - (↑r : ℕ) < (↑s : ℕ) → - ¬TreeColorSetClosed G phi (HierarchyStarredStage H s) - ({ alpha } : Finset (Fin k))) → - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - alpha ∈ TreeMissingColors phi A → - (∀ (j : Fin (H.dividerCount + (1 : ℕ))), - ColoredVertexSetElementary G phi - (TreeSequenceVertexSet (HierarchyStarredStage H j))) → - ∀ (d : ℕ) (j : Fin (H.dividerCount + (1 : ℕ))), - H.dividerCount ≤ (↑j : ℕ) + d → - (↑r : ℕ) ≤ (↑j : ℕ) → - alpha ∈ TreeMissingColors phi (HierarchyStarredStage H j) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H hmaximal q A halphaA - elementaryStar - clear * - halphaA q C hmaximal elementaryStar r H - intro d - induction d with - | zero => - intro j hj _ - have hjq : j = q := Fin.ext (by simp [q]; omega) - simpa [hjq, q] using halphaA - | succ d ih => - intro j hj hrj - by_cases hjq : j = q - · simpa [hjq, q] using halphaA - · have hjlt : j.val < H.dividerCount := by - have hne : j.val ≠ H.dividerCount := by - intro hh; apply hjq; apply Fin.ext; simpa [q] using hh - omega - let i : Fin H.dividerCount := ⟨j.val, hjlt⟩ - have hic : i.castSucc = j := Fin.ext rfl - have hnext := ih i.succ (by dsimp [i]; omega) (by dsimp [i]; omega) - by_contra hold - obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hnext - have hvo : v ∉ TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc) := by - intro hvo - exact hold (Finset.mem_biUnion.mpr ⟨v, by simpa [hic] using hvo, hvm⟩) - have hnew : alpha ∈ - ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion - fun v => MissingColors G phi v) := - Finset.mem_biUnion.mpr ⟨v, Finset.mem_sdiff.mpr ⟨hv, hvo⟩, hvm⟩ - have hc := GoodHierarchyNewMissingClosed C.good i (elementaryStar i.succ) alpha hnew - apply hmaximal i.succ (by dsimp [i]; omega) - intro c hc' - have : c = alpha := Finset.mem_singleton.mp hc' - subst c - exact hc - -private theorem helper_haR_458.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let va : V := T.vertex ia; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → - TreeSequenceInitialSegment A T → - TreeSequenceInitialSegment R A → - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - alpha ∈ TreeMissingColors phi R → - va ∈ TreeSequenceVertexSet R := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha r H R q A ia va ell yLength Y segTrans - AToT RToA ha halphaR - have hRT := segTrans RToA AToT - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp halphaR - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - obtain ⟨i, hi⟩ := hv - let it := Fin.castLE (Nat.succ_le_succ hRT.1) i - have hci : alpha ∈ MissingColors G phi (T.vertex it) := by - rw [hRT.2.1 i, hi] - exact hcv - let candidates := Finset.univ.filter fun j => alpha ∈ MissingColors G phi (T.vertex j) - have hit : it ∈ candidates := by simp [candidates, hci] - have hn : candidates.Nonempty := ⟨it, hit⟩ - have hle : ia.val ≤ R.length := by - have hmin : (candidates.min' hn).val ≤ it.val := Finset.min'_le candidates it hit - have hiv : it.val ≤ R.length := Nat.le_of_lt_succ i.isLt - simpa [ia, HierarchyFirstMissingPosition, candidates, hn] using le_trans hmin hiv - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - exact ⟨⟨ia.val, by omega⟩, (hRT.2.1 ⟨ia.val, by omega⟩).symm⟩ - -private theorem helper_branch_487.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - LowerRoundInductionHypothesis G k e0 ett.rounds → - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let j : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - have this : (0 : ℕ) < ett.rounds := C.positive; - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by - omega⟩ : - Fin ett.rounds); - ∀ {u : V}, - u ∈ TreeSequenceVertexSet Tn → - ∀ {v : V}, - v ∈ TreeSequenceVertexSet Tn → - u ≠ v → - (1 : ℕ) < ett.rounds → - Disjoint (MissingColors G (ett.series.data.coloring j.castSucc) u) - (MissingColors G (ett.series.data.coloring j.castSucc) v) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hlower n Tn j u hu v hv huv hn - obtain ⟨lower, hr, hmax, _, _⟩ := - CertifiedETTRestriction G k e0 input T phi ett C.maximum - (ett.rounds - 1) (by omega) (by omega) - have he : ColoredVertexSetElementary G - (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) - (TreeSequenceVertexSet (ett.series.data.tree ⟨ett.rounds - 1 + 1, by omega⟩)) := - (hlower lower (by omega) (by omega) hmax).1 - have ht : (⟨ett.rounds - 1 + 1, by omega⟩ : Fin (ett.rounds + 2)) = n.castSucc := - Fin.ext (by simp [n]; omega) - have hu' : u ∈ TreeSequenceVertexSet (ett.series.data.tree - ⟨ett.rounds - 1 + 1, by omega⟩) := by simpa only [ht] using hu - have hv' : v ∈ TreeSequenceVertexSet (ett.series.data.tree - ⟨ett.rounds - 1 + 1, by omega⟩) := by simpa only [ht] using hv - exact he hu' hv' huv - -private theorem helper_branch_501.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let j : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), - have this : (0 : ℕ) < ett.rounds := C.positive; - Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by - omega⟩ : - Fin ett.rounds); - ∀ {u : V}, - u ∈ TreeSequenceVertexSet Tn → - ∀ {v : V}, - v ∈ TreeSequenceVertexSet Tn → - u ≠ v → - ¬(1 : ℕ) < ett.rounds → - Disjoint (MissingColors G (ett.series.data.coloring j.castSucc) u) - (MissingColors G (ett.series.data.coloring j.castSucc) v) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C n Tn j u hu v hv huv hn - have hn1 : ett.rounds = 1 := by have := C.positive; omega - have hj0 : j.castSucc = (0 : Fin (ett.rounds + 1)) := Fin.ext (by simp [j, hn1]) - have ht1 : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := - Fin.ext (by simp [n, hn1]) - have he : ColoredVertexSetElementary G (ett.series.data.coloring 0) - (TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩)) := - (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 - have hu' : u ∈ TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩) := by - simpa only [Tn, ht1] using hu - have hv' : v ∈ TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩) := by - simpa only [Tn, ht1] using hv - simpa only [hj0] using he hu' hv' huv +private theorem lexicographicMeasureDecreases {a b c d : ℕ} + (hab : a ≤ b) (hcd : c < d) : HierarchyCounterexampleLess (a, c) (b, d) := by + rcases lt_or_eq_of_le hab with h | h + · exact Or.inl h + · exact Or.inr ⟨h, hcd⟩ -private theorem helper_BstrictT_538.{u_1, u_2} : +private theorem helper_stageSegment_233.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - A.length < B.length → - TreeSequenceInitialSegment B Y → - B.length < T.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib ell yLength Y AToT hAib B - ABstrict BToY - clear * - AToT BToY ABstrict Y - have hAT := AToT.1 - have hY : Y.length = min (A.length + (T.length - A.length - 1)) T.length := rfl - have hBY := BToY.1 - have hAB := ABstrict - omega - -private theorem helper_branch_561.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - IsProperEdgeColoring G phi → - IsOneEdgeUncolored phi e0 → - LowerRoundInductionHypothesis G k e0 ett.rounds → - ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - ((↑r : ℕ) = (0 : ℕ) → R = base.core) → - alpha ∈ TreeMissingColors phi R → - (↑r : ℕ) = (0 : ℕ) → - ett.series.data.kind n = some TashkinovExtensionKind.PE → - TreeInterchangeable G base.core phi alpha beta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R hclosed n - Tn Dn rZero halphaR hz hp - have hs : CombinedStableColoring Tn base.closure Dn phi phi := - ⟨⟨(by intros; rfl), (by intros; rfl)⟩, - ⟨(by intros; rfl), (by intros; rfl)⟩⟩ - exact (interchange G k e0 input T phi phi ett C.maximum C.positive - hlower hp base hproper hone hs alpha beta).2.2.1 - (by simpa [rZero hz] using halphaR) - (by simpa [rZero hz] using hclosed) - -private theorem helper_branch_568.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - IsProperEdgeColoring G phi → - IsOneEdgeUncolored phi e0 → - LowerRoundInductionHypothesis G k e0 ett.rounds → - ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; - ((↑r : ℕ) = (0 : ℕ) → R = base.core) → - alpha ∈ TreeMissingColors phi R → - (↑r : ℕ) = (0 : ℕ) → - ¬ett.series.data.kind n = some TashkinovExtensionKind.PE → - TreeInterchangeable G base.core phi alpha beta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R n Tn rZero - halphaR hz hp - rw [base.nonparallel hp] - let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ - have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) - have hprev : StableColoring Tn - (TashkinovStoredColors ett.series.data j.castSucc) - (ett.series.data.coloring j.castSucc) phi := by - have step := ett.series.certified n - generalize hi : n = i at step - cases step with - | initial => - have hv := congrArg Fin.val hi - simp [n] at hv - have := C.positive - omega - | SE ji _ _ _ _ _ choice _ coloring stored edges kind vertex outside - delta gamma seed adjoin closure ordered strict => - have hji : ji = j := Fin.ext (by - have hv := congrArg Fin.val hi - simp [n, j] at hv ⊢ - omega) - subst ji - have hc : phi = choice.selected := by - simpa only [← hj, coloring, n] using ett.generatingColoring - simpa only [hj, Tn, hc] using choice.selectedStable - | RE ji _ _ _ _ available coloring stored edges kind vertex outside - delta gamma seed adjoin closure ordered strict => - have hji : ji = j := Fin.ext (by - have hv := congrArg Fin.val hi - simp [n, j] at hv ⊢ - omega) - subst ji - have hc : phi = ett.series.data.coloring j.castSucc := by - simpa only [← hj, coloring, n] using ett.generatingColoring - refine ⟨?_, ?_⟩ - · intro f _ _ - exact congrFun hc f - · intro v _ - exact congrArg (fun psi => MissingColors G psi v) hc - | PE ji _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper - one stored edges kind vertex outside delta gammaEq closure ordered strict => - exact (hp (by simpa [← hi] using kind)).elim - have hm : alpha ∈ TreeMissingColors phi Tn := by - simpa only [rZero hz, base.nonparallel hp] using halphaR - by_cases hn : 1 < ett.rounds - · obtain ⟨lower, hr, hmax, htrees, hdata⟩ := - CertifiedETTRestriction G k e0 input T phi ett C.maximum - (ett.rounds - 1) (by omega) (by omega) - let nl : Fin (lower.rounds + 1) := Fin.last lower.rounds - have hcidx : Fin.castLE (by omega) nl = j.castSucc := - Fin.ext (by simp [nl, j, hr]) - have htidx : Fin.castLE (by omega) (Fin.last (lower.rounds + 1)) = - n.castSucc := Fin.ext (by simp [n, hr]; omega) - have ht : lower.series.data.tree (Fin.last (lower.rounds + 1)) = Tn := - (htrees _).trans (congrArg ett.series.data.tree htidx) - obtain ⟨hc, _, _, _, _, _, _, _, hd, _⟩ := hdata nl - rw [hcidx] at hc hd - have hs : StableColoring - (lower.series.data.tree (Fin.last (lower.rounds + 1))) - (TashkinovStoredColors lower.series.data nl) - (lower.series.data.coloring nl) phi := by - rw [ht, hc, hd] - exact hprev - have hi := (hlower lower (by omega) (by omega) hmax).2.1 - phi hproper hone hs alpha beta (Or.inl (by rw [ht]; exact hm)) - simpa only [ht] using hi - · have hn1 : ett.rounds = 1 := by have := C.positive; omega - have hj0 : j.castSucc = (0 : Fin (ett.rounds + 1)) := - Fin.ext (by simp [j, hn1]) - have ht1 : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := - Fin.ext (by simp [n, hn1]) - have hs : StableColoring (ett.series.data.tree ⟨1, by omega⟩) - (TashkinovStoredColors ett.series.data 0) - (ett.series.data.coloring 0) phi := by - simpa only [Tn, ht1, hj0] using hprev - have hi := (TechnicalTheoremBase G k ett.rounds e0 input ett.series).2 - phi hproper hone hs alpha beta - (Or.inl (by simpa only [Tn, ht1] using hm)) - have hTn1 : Tn = ett.series.data.tree ⟨1, by omega⟩ := - congrArg ett.series.data.tree ht1 - change TreeInterchangeable G Tn phi alpha beta - rw [hTn1] - exact hi + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + ∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H segRefl segTrans a d hbound + clear * - H hbound segRefl segTrans + induction d with + | zero => simpa using segRefl (H.stage ⟨a, by omega⟩) + | succ d ih => + exact segTrans (ih (by omega)) (H.nested ⟨a + d, by omega⟩) -private theorem helper_branch_650.{u_1, u_2} : +private theorem helper_stageToT_241.{u_1, u_2} : open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - IsProperEdgeColoring G phi → - IsOneEdgeUncolored phi e0 → - LowerRoundInductionHypothesis G k e0 ett.rounds → - (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} - {generating' : PartialEdgeColoring E k} - (other : ExtendedTashkinovTree G k e0 input' T' generating'), - other.rounds = ett.rounds → - MaximumProperty other → - ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') - (_ : GoodHierarchy K), - K.dividerCount < C.hierarchy.dividerCount → - ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → - (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → - ∀ (alpha beta : Fin k), - alpha ≠ beta → - ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - (↑r : ℕ) < H.dividerCount → - TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → - ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → - alpha ∈ TreeMissingColors phi R → - ¬(↑r : ℕ) = (0 : ℕ) → - TreeInterchangeable G R phi alpha beta := by + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (H.stage j) T := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge alpha beta - hne r H R hrq hclosed rPositive halphaR hz - let i : Fin H.dividerCount := ⟨r.val - 1, by omega⟩ - have hi : i.succ.castSucc = r.castSucc := Fin.ext (by simp [i]; omega) - rw [rPositive hz] - rw [← hi] - apply step1 G k e0 input T phi ett C.maximum C.positive hproper hone - hlower base H C.good hfewer hlarge i alpha beta - · simpa [hi, ← rPositive hz] using halphaR - · exact hne - · simpa [hi, ← rPositive hz] using hclosed + intro V E _ _ _ _ G k e0 input T phi ett base C r H stageSegment j + clear * - H j stageSegment + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) + simpa [he, H.terminalStage] using hs -private theorem helper_pathB_687.{u_1, u_2} : +private theorem helper_lastPositive_252.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - IsProperEdgeColoring G phi → - ∀ (alpha beta : Fin k), - alpha ≠ beta → - ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - TwoColorPathComponent G phi alpha beta (Sum.inl vb) := by + H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper alpha beta hne r H q A ib vb ell - yLength Y hb - clear * - hb hproper hne - refine ⟨hne, Sum.inl vb, rfl, ?_⟩ - intro x hx y hy - cases x with - | inr f => - cases y with - | inr g => - have hfc : phi f = some alpha := hx.2.resolve_right (by - intro he - exact (Finset.mem_sdiff.mp hb.1).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) - have hgc : phi g = some alpha := hy.2.resolve_right (by - intro he - exact (Finset.mem_sdiff.mp hb.1).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) - congr 1 - by_contra hfg - exact hproper hfg ⟨vb, hx.1, hy.1⟩ hfc hgc - | inl w => exact False.elim hy - | inl w => exact False.elim hx + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A hz + clear * - hz A q + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm -private theorem helper_unaffected_722.{u_1, u_2} : +private theorem helper_coreToA_264.{u_1, u_2} : open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), - alpha ≠ beta → - ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta - (Sum.inl vb); - ∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c) - := by + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment base.core A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A segRefl segTrans stageSegment lastZero + lastPositive + clear * - H base A lastZero lastPositive segRefl segTrans stageSegment + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segRefl _ + · rw [lastPositive hz] + have hs := stageSegment 1 (H.dividerCount - 1) (by omega) + have he : 1 + (H.dividerCount - 1) = H.dividerCount := by omega + simpa [he] using segTrans H.coreInsideFirst hs + +private theorem helper_AToT_280.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (j : Fin (H.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (H.stage j) T) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment A T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A segTrans stageToT lastZero lastPositive + clear * - H A lastZero lastPositive segTrans stageToT + by_cases hz : H.dividerCount = 0 + · rw [lastZero hz] + exact segTrans H.coreInsideFirst (stageToT ⟨1, by omega⟩) + · rw [lastPositive hz] + exact stageToT _ + +private theorem helper_ordinaryToA_287.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (H.dividerCount = (0 : ℕ) → A = base.core) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → + TreeSequenceInitialSegment Tn A → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (H.stage j.castSucc) A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A n Tn stageSegment lastZero lastPositive + TnToA j + clear * - H A TnToA stageSegment lastZero lastPositive + by_cases hz : H.dividerCount = 0 + · have hj : j.castSucc = (0 : Fin (H.dividerCount + 2)) := Fin.ext (by simp; omega) + rw [hj, H.baseStage] + exact TnToA + · have hs := stageSegment j.val (H.dividerCount - j.val) (by omega) + rw [lastPositive hz] + convert hs using 1 <;> apply congrArg H.stage <;> apply Fin.ext <;> + simp only [Fin.val_castSucc]; omega + +private theorem helper_starPositive_301.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → + HierarchyStarredStage H j = H.stage j.castSucc := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H q A ib vb ell yLength Y ha - hb K sigma f c hca hcb - clear * - hca hcb K sigma hne - by_cases hf : Sum.inr f ∈ K - · by_cases ha : phi f = some alpha - · simp [sigma, TwoColorComponentSwap, K, hf, ha, hca.symm, hcb.symm] - · by_cases hb : phi f = some beta - · simp [sigma, TwoColorComponentSwap, K, hf, hb, hne.symm, - hca.symm, hcb.symm] - · simp [sigma, TwoColorComponentSwap, K, hf, ha, hb] - · simp [sigma, TwoColorComponentSwap, K, hf] + intro V E _ _ _ _ G k e0 input T phi ett base C H j hj + obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ j + · exact (hj (congrArg Fin.val hz)).elim + · rw [hi] + rfl -private theorem helper_sigmaOne_739.{u_1, u_2} : +private theorem helper_coreToStar_308.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - IsOneEdgeUncolored phi e0 → - ∀ (alpha beta : Fin k), - alpha ≠ beta → - ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let ell : ℕ := T.length - A.length; - let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T yLength - (have hA : (1 : ℕ) ≤ A.length := A.positive; - have hT : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) - (by omega); - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → - IsOneEdgeUncolored sigma e0 := by + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≠ (0 : ℕ) → HierarchyStarredStage H j = H.stage j.castSucc) → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment base.core (HierarchyStarredStage H j) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta hne r H q A ib vb ell yLength Y - ha hb K sigma unaffected - clear * - hone sigma K unaffected hne - refine ⟨?_, ?_⟩ - · simp [sigma, TwoColorComponentSwap, hone.1] - · intro f hf - obtain ⟨c, hc⟩ := hone.2 f hf - by_cases ha : c = alpha - · subst c - by_cases hK : Sum.inr f ∈ K - · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ - · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ - · by_cases hb : c = beta - · subst c - by_cases hK : Sum.inr f ∈ K - · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc, hne.symm]⟩ - · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ - · exact ⟨c, (unaffected f c ha hb).mpr hc⟩ + intro V E _ _ _ _ G k e0 input T phi ett base C r H segRefl segTrans stageSegment starPositive j + clear * - j H segRefl segTrans stageSegment starPositive + by_cases hz : j.val = 0 + · have hj : j = 0 := Fin.ext hz + rw [hj] + exact segRefl _ + · rw [starPositive j hz] + have hs := stageSegment 1 (j.val - 1) (by omega) + have he : 1 + (j.val - 1) = j.val := by omega + convert segTrans H.coreInsideFirst hs using 1 + apply congrArg H.stage + apply Fin.ext + simpa using he.symm -private theorem helper_missingBefore_764.{u_1, u_2} : +private theorem helper_ordinaryToR_330.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - alpha ≠ beta → - ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + (↑r : ℕ) < H.dividerCount → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage (⟨a, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (H.stage (⟨a + d, by omega⟩ : Fin (H.dividerCount + (2 : ℕ))))) → + ((↑r : ℕ) = (0 : ℕ) → R = base.core) → + ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → + TreeSequenceInitialSegment Tn R → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + (↑j : ℕ) ≤ (↑r : ℕ) → + TreeSequenceInitialSegment (H.stage j.castSucc) R := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C r H R hrq n Tn stageSegment rZero rPositive + TnToR j hj + by_cases hr : r.val = 0 + · have hj0 : j.castSucc = (0 : Fin (H.dividerCount + 2)) := by + apply Fin.ext + simp only [Fin.val_castSucc, Fin.val_zero] + omega + rw [hj0, H.baseStage] + exact TnToR + · rw [rPositive hr] + have hs := stageSegment j.val (r.val - j.val) (by omega) + convert hs using 1 + · exact congrArg H.stage (Fin.ext rfl) + · apply congrArg H.stage + apply Fin.ext + simp only [Fin.val_castSucc] + omega + +private theorem helper_firstMissing_354.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let va : V := T.vertex ia; - let vb : V := T.vertex ib; let ell : ℕ := T.length - A.length; let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; let Y : TreeSequence G e0 := @@ -3371,95 +1102,45 @@ private theorem helper_missingBefore_764.{u_1, u_2} : have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) (by omega); - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - va ∈ TreeSequenceVertexSet Y → - vb ∈ TreeSequenceVertexSet Y → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B Y → - let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - Sum.inl va ∉ K → - (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - have phi' : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ - (∀ (v : V), - Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ - (∀ (v : V), - Sum.inl v ∈ C → - beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ - ∀ (v : V) (c : Fin k), - c ≠ alpha → - c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → - (∀ {v : V} {f : E}, - Sum.inl v ∈ K → - Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ K) → - ∀ v ∈ TreeSequenceVertexSet B, - v ≠ vb → - MissingColors G sigma v = MissingColors G phi v := by + TreeSequenceInitialSegment Y T → + ∀ c ∈ TreeMissingColors phi Y, + c ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T c)) ∧ + (↑(HierarchyFirstMissingPosition phi T c) : ℕ) ≤ Y.length := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H q A ia ib va vb ell yLength - Y hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb - clear * - hv hvb K haK haY hbY ha hb hElementaryY BToY behavior edgeOfVertex sigma hne - by_cases hvK : Sum.inl v ∈ K - · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) - have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv - have han : alpha ∉ MissingColors G phi v := fun hc => - Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 - have hbn : beta ∉ MissingColors G phi v := fun hc => - Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 - have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by - simpa [MissingColors, PresentColors] using han - have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by - simpa [MissingColors, PresentColors] using hbn - obtain ⟨fa, hfa, hfca⟩ := hpa - obtain ⟨fb, hfb, hfcb⟩ := hpb - have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) - have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) - have hnewa : sigma fb = some alpha := by - simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] - have hnewb : sigma fa = some beta := by - simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] - have hana : alpha ∉ MissingColors G sigma v := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, - PresentColors, Finset.mem_filter, not_not] - exact ⟨fb, hfb, hnewa⟩ - have hbnb : beta ∉ MissingColors G sigma v := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, - PresentColors, Finset.mem_filter, not_not] - exact ⟨fa, hfa, hnewb⟩ - ext c - by_cases hca : c = alpha - · subst c; simp [hana, han] - · by_cases hcb : c = beta - · subst c; simp [hbnb, hbn] - · exact behavior.2.2.2 v c hca hcb - · exact behavior.1 v hvK + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A ell yLength Y YToT c hc + clear * - hc YToT + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let it := Fin.castLE (Nat.succ_le_succ YToT.1) i + have hci : c ∈ MissingColors G phi (T.vertex it) := by + rw [YToT.2.1 i, hi] + exact hcv + let candidates := Finset.univ.filter fun j => c ∈ MissingColors G phi (T.vertex j) + have hit : it ∈ candidates := by simp [candidates, hci] + have hnon : candidates.Nonempty := ⟨it, hit⟩ + have hmem := Finset.min'_mem candidates hnon + have hle := Finset.min'_le candidates it hit + refine ⟨?_, ?_⟩ + · simpa [HierarchyFirstMissingPosition, candidates, hnon] using + (Finset.mem_filter.mp hmem).2 + · have hiv : it.val ≤ Y.length := Nat.le_of_lt_succ i.isLt + have hval : (candidates.min' hnon).val ≤ it.val := hle + simpa [HierarchyFirstMissingPosition, candidates, hnon] using le_trans hval hiv -private theorem helper_incidentFixed_818.{u_1, u_2} : +private theorem helper_missingNotA_397.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; let ell : ℕ := T.length - A.length; let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; let Y : TreeSequence G e0 := @@ -3468,189 +1149,136 @@ private theorem helper_incidentFixed_818.{u_1, u_2} : have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) (by omega); - alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet R, Sum.inl v ∉ K) → - (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → - ∀ (f : E), - TreeIncidentEdge R f → - sigma f = phi f := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb ell yLength Y ha hb - K sigma avoidR fixedValue f hf - clear * - hf sigma K avoidR fixedValue - obtain ⟨v, hv, hvf⟩ := hf - by_cases hK : Sum.inr f ∈ K - · by_cases ha : phi f = some alpha - · exact False.elim (avoidR v hv - ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) - from ⟨hvf, Or.inl ha⟩)).trans hK)) - · by_cases hb : phi f = some beta - · exact False.elim (avoidR v hv - ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj - (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) - from ⟨hvf, Or.inr hb⟩)).trans hK)) - · exact fixedValue f ha hb - · simp [sigma, TwoColorComponentSwap, K, hK] - -private theorem helper_stable_834.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment R A → - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → - (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → - ∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → - ∀ (D : Finset (Fin k)), - StableColoring S D phi sigma := by + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + TreeSequenceInitialSegment A Y → + ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb RToA sigma missingA - incidentFixed S hS D - refine ⟨?_, fun v hv => missingA v (TreeSequenceInitialSegmentVertexSetSubset RToA (hS hv))⟩ - intro f hf _ - obtain ⟨v, hv, hvf⟩ := hf - exact incidentFixed f ⟨v, hS hv, hvf⟩ + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H q A ell yLength Y + hElementaryY AToY c i hmi hiy hia + clear * - hmi hiy hia AToY hElementaryY + intro hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) + exact (Finset.disjoint_left.mp + (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi -private theorem helper_terminalRoute_847.{u_1, u_2} : +private theorem helper_elementaryStar_409.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S W → - TreeSequenceInitialSegment U W → - S.length ≤ U.length → TreeSequenceInitialSegment S U) → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) (by omega); - TreeSequenceInitialSegment Tn B → - Tn.length < B.length → - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ)))) → - ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence phi Tn B ∨ - (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ - ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), - ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B := by + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HierarchyStarredStage H j) A) → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + TreeSequenceInitialSegment A Y → + ∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ColoredVertexSetElementary G phi (TreeSequenceVertexSet (HierarchyStarredStage H j)) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib commonPrefix hAib B - TnToB TnStrictB BToFinal - clear * - ett C n Tn B BToFinal TnToB TnStrictB commonPrefix - have step := ett.series.certified n - generalize hi : n = i at step - cases step with - | initial => have hv := congrArg Fin.val hi; simp [n] at hv; have := C.positive; omega - | SE j _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma - seed adjoin closure ordered strict => - have hj : j.succ = n := hi.symm - have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := - Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) - have hroute : TashkinovAugmentationSequence phi seed - (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by - simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 - have hseedB : TreeSequenceInitialSegment seed B := - commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) - BToFinal (by - have hl := adjoin.1 - rw [hj] at hl - change seed.length = Tn.length + 1 at hl - omega) - exact Or.inr ⟨Or.inl (by simpa [hj] using kind), choice.edge, seed, - by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, - TashkinovAugmentationSequenceRestrict phi seed B _ hroute hseedB BToFinal⟩ - | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored - edges kind vertex outside delta gammaEq closure ordered strict => - have hj : j.succ = n := hi.symm - have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := - Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) - refine Or.inl ⟨by simpa [hj] using kind, ?_⟩ - apply TashkinovAugmentationSequenceRestrict phi Tn B _ _ TnToB BToFinal - simpa [Tn, hj, hlast, ← ett.generatingColoring, n] using closure.1 - | RE j _ _ _ _ available coloring stored edges kind vertex outside delta gamma - seed adjoin closure ordered strict => - have hj : j.succ = n := hi.symm - have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := - Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) - have hroute : TashkinovAugmentationSequence phi seed - (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by - simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 - have hseedB : TreeSequenceInitialSegment seed B := - commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) - BToFinal (by - have hl := adjoin.1 - rw [hj] at hl - change seed.length = Tn.length + 1 at hl - omega) - exact Or.inr ⟨Or.inr (by simpa [hj] using kind), available.edge, seed, - by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, - TashkinovAugmentationSequenceRestrict phi seed B _ hroute hseedB BToFinal⟩ + intro V E _ _ _ _ G k e0 input T phi ett base C r H q A ell yLength Y segTrans starredToA + hElementaryY AToY j + clear * - j starredToA AToY hElementaryY segTrans + intro u hu v hv huv + have hs := segTrans (starredToA j) AToY + exact hElementaryY (TreeSequenceInitialSegmentVertexSetSubset hs hu) + (TreeSequenceInitialSegmentVertexSetSubset hs hv) huv -private theorem helper_displayedIncident_896.{u_1, u_2} : +private theorem helper_descend_417.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (C : HierarchyCounterexample base) (alpha beta : Fin k), + alpha ≠ beta → + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - ∀ (S : TreeSequence G e0), - TreeSequenceInitialSegment S R → - ∀ (t : Fin S.length), - TreeIncidentEdge R (S.edge t) := by + (∀ (s : Fin (H.dividerCount + (1 : ℕ))), + (↑r : ℕ) < (↑s : ℕ) → + ¬TreeColorSetClosed G phi (HierarchyStarredStage H s) + ({ alpha } : Finset (Fin k))) → + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + alpha ∈ TreeMissingColors phi A → + (∀ (j : Fin (H.dividerCount + (1 : ℕ))), + ColoredVertexSetElementary G phi + (TreeSequenceVertexSet (HierarchyStarredStage H j))) → + ∀ (d : ℕ) (j : Fin (H.dividerCount + (1 : ℕ))), + H.dividerCount ≤ (↑j : ℕ) + d → + (↑r : ℕ) ≤ (↑j : ℕ) → + alpha ∈ TreeMissingColors phi (HierarchyStarredStage H j) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C r H R S hSA t - obtain ⟨i, hi⟩ := S.attaches t - refine ⟨S.vertex t.succ, TreeSequenceInitialSegmentVertexSetSubset hSA - (by simp [TreeSequenceVertexSet]), ?_⟩ - simp [Incident, hi] + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H hmaximal q A halphaA + elementaryStar + clear * - halphaA q C hmaximal elementaryStar r H + intro d + induction d with + | zero => + intro j hj _ + have hjq : j = q := Fin.ext (by simp [q]; omega) + simpa [hjq, q] using halphaA + | succ d ih => + intro j hj hrj + by_cases hjq : j = q + · simpa [hjq, q] using halphaA + · have hjlt : j.val < H.dividerCount := by + have hne : j.val ≠ H.dividerCount := by + intro hh; apply hjq; apply Fin.ext; simpa [q] using hh + omega + let i : Fin H.dividerCount := ⟨j.val, hjlt⟩ + have hic : i.castSucc = j := Fin.ext rfl + have hnext := ih i.succ (by dsimp [i]; omega) (by dsimp [i]; omega) + by_contra hold + obtain ⟨v, hv, hvm⟩ := Finset.mem_biUnion.mp hnext + have hvo : v ∉ TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc) := by + intro hvo + exact hold (Finset.mem_biUnion.mpr ⟨v, by simpa [hic] using hvo, hvm⟩) + have hnew : alpha ∈ + ((TreeSequenceVertexSet (H.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage H i.castSucc)).biUnion + fun v => MissingColors G phi v) := + Finset.mem_biUnion.mpr ⟨v, Finset.mem_sdiff.mpr ⟨hv, hvo⟩, hvm⟩ + have hc := GoodHierarchyNewMissingClosed C.good i (elementaryStar i.succ) alpha hnew + apply hmaximal i.succ (by dsimp [i]; omega) + intro c hc' + have : c = alpha := Finset.mem_singleton.mp hc' + subst c + exact hc -private theorem helper_augmentationFixed_904.{u_1, u_2} : +private theorem helper_haR_458.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; let R : TreeSequence G e0 := HierarchyStarredStage H r; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; + let va : V := T.vertex ia; let ell : ℕ := T.length - A.length; let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; let Y : TreeSequence G e0 := @@ -3659,280 +1287,341 @@ private theorem helper_augmentationFixed_904.{u_1, u_2} : have hT : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) (by omega); - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → (∀ {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + TreeSequenceInitialSegment A T → TreeSequenceInitialSegment R A → - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → - (∀ (i : Fin (T.length + (1 : ℕ))), - (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → - vb ∈ TreeSequenceVertexSet Y → - ∀ (hAib : A.length < (↑ib : ℕ)), - alpha ∉ - ({c : Fin k | ∃ (t : Fin A.length), R.length ≤ (↑t : ℕ) ∧ phi (A.edge t) = some c} : - Finset (Fin k)) → - TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) - (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ - alpha ∉ - ({c : Fin k | - ∃ (t : Fin T.length), - (HierarchyStarredStage C.hierarchy - (Fin.last C.hierarchy.dividerCount)).length ≤ - (↑t : ℕ) ∧ - (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ - phi (T.edge t) = some c} : - Finset (Fin k)) → - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - TreeSequenceInitialSegment A B → - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → - (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → - (∀ (S : TreeSequence G e0), - TreeSequenceInitialSegment S R → - ∀ (t : Fin S.length), TreeIncidentEdge R (S.edge t)) → - ∀ (S : TreeSequence G e0), - TashkinovAugmentationSequence phi S B → - ∀ (t : Fin B.length), - S.length ≤ (↑t : ℕ) → - sigma (B.edge t) = phi (B.edge t) := by + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + alpha ∈ TreeMissingColors phi R → + va ∈ TreeSequenceVertexSet R := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb ell yLength Y - segRefl segTrans RToA hElementaryY hb vertexY hbY hAib unusedRA horder B BToT AToB sigma - fixedValue incidentFixed displayedIncident S hseq t ht - by_cases htA : t.val < R.length - · have hRB := segTrans RToA AToB - have he := hRB.2.2 ⟨t.val, htA⟩ - have hi : Fin.castLE hRB.1 ⟨t.val, htA⟩ = t := Fin.ext rfl - rw [hi] at he - rw [he] - exact incidentFixed _ (displayedIncident R (segRefl R) _) - · have hstep := (TashkinovAugmentationSequencePosition phi S B hseq t ht).1 - obtain ⟨hl, hinit, c, hcol, hm⟩ := hstep - have hcolB : phi (B.edge t) = some c := by - convert hcol using 1 - congr 2 - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - obtain ⟨iv, hiv⟩ := hv - let ivT : Fin (T.length + 1) := ⟨iv.val, by - have htB := BToT.1 - have := iv.isLt - simp only [TreeSequencePrefix] at this - omega⟩ - have hcvT : c ∈ MissingColors G phi (T.vertex ivT) := by - have he : (TreeSequencePrefix B t.val (le_trans S.positive ht) - (Nat.le_of_lt t.isLt)).vertex iv = T.vertex ivT := rfl - rw [← he, hiv] - exact hcv - have hnotA : c ≠ alpha := by - intro he - subst c - by_cases htLast : t.val < A.length - · apply unusedRA - let u : Fin A.length := ⟨t.val, htLast⟩ - have he := AToB.2.2 u - have hi : Fin.castLE AToB.1 u = t := Fin.ext rfl - rw [hi] at he - exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, u, - by change R.length ≤ t.val; omega, - by rw [← he]; exact hcolB⟩ - · apply horder.2 - exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, Fin.castLE BToT.1 t, - by change A.length ≤ t.val; omega, t.isLt, - by rw [BToT.2.2 t]; exact hcolB⟩ - have hnotB : c ≠ beta := by - intro he - subst c - have hivB : ivT.val < ib.val := by - have := iv.isLt - simp only [TreeSequencePrefix] at this - have htB : t.val < ib.val := t.isLt - dsimp [ivT] - omega - have hvY := vertexY ivT (by omega) - have hneV : T.vertex ivT ≠ vb := by - intro he - have hi := congrArg Fin.val (T.vertex_injective he) - omega - exact Finset.disjoint_left.mp (hElementaryY hvY hbY hneV) hcvT hb.1 - exact fixedValue _ (fun hc => hnotA (Option.some.inj (hcolB.symm.trans hc))) - (fun hc => hnotB (Option.some.inj (hcolB.symm.trans hc))) + intro V E _ _ _ _ G k e0 input T phi ett base C alpha r H R q A ia va ell yLength Y segTrans + AToT RToA ha halphaR + have hRT := segTrans RToA AToT + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp halphaR + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + let it := Fin.castLE (Nat.succ_le_succ hRT.1) i + have hci : alpha ∈ MissingColors G phi (T.vertex it) := by + rw [hRT.2.1 i, hi] + exact hcv + let candidates := Finset.univ.filter fun j => alpha ∈ MissingColors G phi (T.vertex j) + have hit : it ∈ candidates := by simp [candidates, hci] + have hn : candidates.Nonempty := ⟨it, hit⟩ + have hle : ia.val ≤ R.length := by + have hmin : (candidates.min' hn).val ≤ it.val := Finset.min'_le candidates it hit + have hiv : it.val ≤ R.length := Nat.le_of_lt_succ i.isLt + simpa [ia, HierarchyFirstMissingPosition, candidates, hn] using le_trans hmin hiv + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] + exact ⟨⟨ia.val, by omega⟩, (hRT.2.1 ⟨ia.val, by omega⟩).symm⟩ -private theorem helper_seedFixed_967.{u_1, u_2} : +private theorem helper_branch_487.{u_1, u_2} : open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + LowerRoundInductionHypothesis G k e0 ett.rounds → let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn R → - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → - ∀ (f : E) (seed : TreeSequence G e0), - TreeSequenceAdjoinEdge Tn f seed → - sigma f = phi f := by + let j : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + ∀ {u : V}, + u ∈ TreeSequenceVertexSet Tn → + ∀ {v : V}, + v ∈ TreeSequenceVertexSet Tn → + u ≠ v → + (1 : ℕ) < ett.rounds → + Disjoint (MissingColors G (ett.series.data.coloring j.castSucc) u) + (MissingColors G (ett.series.data.coloring j.castSucc) v) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R n Tn ib vb TnToR sigma - incidentFixed f seed hadjoin - obtain ⟨i, hi⟩ := seed.attaches (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) - let j : Fin (Tn.length + 1) := ⟨i.val, by have := i.isLt; simpa using this⟩ - have hv : seed.vertex (Fin.castLT i - (Nat.lt_trans i.isLt (Nat.succ_lt_succ - (Fin.cast hadjoin.1.symm (Fin.last Tn.length)).isLt))) = Tn.vertex j := - hadjoin.2.1.2.1 j - apply incidentFixed - refine ⟨Tn.vertex j, TreeSequenceInitialSegmentVertexSetSubset TnToR - (by simp [TreeSequenceVertexSet]), ?_⟩ - rw [← hadjoin.2.2, Incident, hi] - simp [← hv] + intro V E _ _ _ _ G k e0 input T phi ett base C hlower n Tn j u hu v hv huv hn + obtain ⟨lower, hr, hmax, _, _⟩ := + CertifiedETTRestriction G k e0 input T phi ett C.maximum + (ett.rounds - 1) (by omega) (by omega) + have he : ColoredVertexSetElementary G + (ett.series.data.coloring ⟨ett.rounds - 1, by omega⟩) + (TreeSequenceVertexSet (ett.series.data.tree ⟨ett.rounds - 1 + 1, by omega⟩)) := + (hlower lower (by omega) (by omega) hmax).1 + have ht : (⟨ett.rounds - 1 + 1, by omega⟩ : Fin (ett.rounds + 2)) = n.castSucc := + Fin.ext (by simp [n]; omega) + have hu' : u ∈ TreeSequenceVertexSet (ett.series.data.tree + ⟨ett.rounds - 1 + 1, by omega⟩) := by simpa only [ht] using hu + have hv' : v ∈ TreeSequenceVertexSet (ett.series.data.tree + ⟨ett.rounds - 1 + 1, by omega⟩) := by simpa only [ht] using hv + exact he hu' hv' huv -private theorem helper_edgesFixed_981.{u_1, u_2} : +private theorem helper_branch_501.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn R → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → - TreeSequenceInitialSegment Tn B → - (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence phi Tn B ∨ - (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ - ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), - ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → - (∀ (S : TreeSequence G e0), - TreeSequenceInitialSegment S R → - ∀ (t : Fin S.length), TreeIncidentEdge R (S.edge t)) → - (∀ (S : TreeSequence G e0), - TashkinovAugmentationSequence phi S B → - ∀ (t : Fin B.length), S.length ≤ (↑t : ℕ) → sigma (B.edge t) = phi (B.edge t)) → - (∀ (f : E) (seed : TreeSequence G e0), - TreeSequenceAdjoinEdge Tn f seed → sigma f = phi f) → - ∀ (t : Fin B.length), - sigma (B.edge t) = phi (B.edge t) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A n Tn ib vb TnToR hAib B - sigma incidentFixed TnToB terminalRoute displayedIncident augmentationFixed seedFixed t - by_cases ht : t.val < Tn.length - · have he := TnToB.2.2 ⟨t.val, ht⟩ - have hi : Fin.castLE TnToB.1 ⟨t.val, ht⟩ = t := Fin.ext rfl - rw [hi] at he - rw [he] - exact incidentFixed _ (displayedIncident Tn TnToR _) - · rcases terminalRoute with ⟨hp, hs⟩ | ⟨hk, f, seed, hedges, hadjoin, hs⟩ - · exact augmentationFixed Tn hs t (by omega) - · by_cases he : t.val = Tn.length - · have hSB := TashkinovAugmentationSequenceInitialSegment phi seed B hs - have hi := hSB.2.2 (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) - have hj : Fin.castLE hSB.1 (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) = t := - Fin.ext (by simpa using he.symm) - rw [hj, hadjoin.2.2] at hi - simpa [hi] using seedFixed f seed hadjoin - · exact augmentationFixed seed hs t (by have := hadjoin.1; omega) + let j : Fin ett.rounds := + (⟨ett.rounds - (1 : ℕ), + have this : (0 : ℕ) < ett.rounds := C.positive; + Decidable.byContradiction fun (a : ¬ett.rounds - (1 : ℕ) < ett.rounds) ↦ by + omega⟩ : + Fin ett.rounds); + ∀ {u : V}, + u ∈ TreeSequenceVertexSet Tn → + ∀ {v : V}, + v ∈ TreeSequenceVertexSet Tn → + u ≠ v → + ¬(1 : ℕ) < ett.rounds → + Disjoint (MissingColors G (ett.series.data.coloring j.castSucc) u) + (MissingColors G (ett.series.data.coloring j.castSucc) v) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C n Tn j u hu v hv huv hn + have hn1 : ett.rounds = 1 := by have := C.positive; omega + have hj0 : j.castSucc = (0 : Fin (ett.rounds + 1)) := Fin.ext (by simp [j, hn1]) + have ht1 : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn1]) + have he : ColoredVertexSetElementary G (ett.series.data.coloring 0) + (TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩)) := + (TechnicalTheoremBase G k ett.rounds e0 input ett.series).1 + have hu' : u ∈ TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩) := by + simpa only [Tn, ht1] using hu + have hv' : v ∈ TreeSequenceVertexSet (ett.series.data.tree ⟨1, by omega⟩) := by + simpa only [Tn, ht1] using hv + simpa only [hj0] using he hu' hv' huv -private theorem helper_routeTransport_1000.{u_1, u_2} : +private theorem helper_BstrictT_538.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + TreeSequenceInitialSegment A T → ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) (by omega); - TreeSequenceInitialSegment B T → - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet B, - v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (S : TreeSequence G e0), - TashkinovAugmentationSequence phi S B → - TashkinovAugmentationSequence sigma S B := by + A.length < B.length → + TreeSequenceInitialSegment B Y → + B.length < T.length := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb segTrans hAib B BToT - sigma missingBefore edgesFixed S hs - clear * - S hs edgesFixed BToT segTrans missingBefore - unfold TashkinovAugmentationSequence at hs ⊢ - induction hs using Relation.ReflTransGen.head_induction_on with - | refl => exact Relation.ReflTransGen.refl - | @head U W hstep htail ih => - have hWB := TashkinovAugmentationSequenceInitialSegment phi W B htail - obtain ⟨hlen, hUW, c, hcol, hm⟩ := hstep - have hUB := segTrans hUW hWB - have hlt : U.length < B.length := by have := hWB.1; omega - refine Relation.ReflTransGen.head ⟨hlen, hUW, c, ?_, ?_⟩ ih - · have hf := edgesFixed (Fin.castLE hWB.1 (Fin.cast hlen.symm (Fin.last U.length))) - rw [hWB.2.2] at hf - exact hf.trans hcol - · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm - have hvB := TreeSequenceInitialSegmentVertexSetSubset hUB hv - have hvb : v ≠ vb := by - intro he - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv - obtain ⟨i, hi⟩ := hv - have ht := hUB.2.1 i - have htT := BToT.2.1 (Fin.castLE (Nat.succ_le_succ hUB.1) i) - have eqv : T.vertex (Fin.castLE (Nat.succ_le_succ BToT.1) - (Fin.castLE (Nat.succ_le_succ hUB.1) i)) = T.vertex ib := htT.trans (ht.trans - (hi.trans he)) - have hh := congrArg Fin.val (T.vertex_injective eqv) - have := i.isLt - change i.val = ib.val at hh - change U.length < ib.val at hlt - omega - exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [missingBefore v hvB hvb]; exact hcv⟩ + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib ell yLength Y AToT hAib B + ABstrict BToY + clear * - AToT BToY ABstrict Y + have hAT := AToT.1 + have hY : Y.length = min (A.length + (T.length - A.length - 1)) T.length := rfl + have hBY := BToY.1 + have hAB := ABstrict + omega + +private theorem helper_branch_561.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ((↑r : ℕ) = (0 : ℕ) → R = base.core) → + alpha ∈ TreeMissingColors phi R → + (↑r : ℕ) = (0 : ℕ) → + ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeInterchangeable G base.core phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R hclosed n + Tn Dn rZero halphaR hz hp + have hs : CombinedStableColoring Tn base.closure Dn phi phi := + ⟨⟨(by intros; rfl), (by intros; rfl)⟩, + ⟨(by intros; rfl), (by intros; rfl)⟩⟩ + exact (interchange G k e0 input T phi phi ett C.maximum C.positive + hlower hp base hproper hone hs alpha beta).2.2.1 + (by simpa [rZero hz] using halphaR) + (by simpa [rZero hz] using hclosed) + +private theorem helper_branch_568.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + ((↑r : ℕ) = (0 : ℕ) → R = base.core) → + alpha ∈ TreeMissingColors phi R → + (↑r : ℕ) = (0 : ℕ) → + ¬ett.series.data.kind n = some TashkinovExtensionKind.PE → + TreeInterchangeable G base.core phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R n Tn rZero + halphaR hz hp + rw [base.nonparallel hp] + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have hprev : StableColoring Tn + (TashkinovStoredColors ett.series.data j.castSucc) + (ett.series.data.coloring j.castSucc) phi := by + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => + have hv := congrArg Fin.val hi + simp [n] at hv + have := C.positive + omega + | SE ji _ _ _ _ _ choice _ coloring stored edges kind vertex outside + delta gamma seed adjoin closure ordered strict => + have hji : ji = j := Fin.ext (by + have hv := congrArg Fin.val hi + simp [n, j] at hv ⊢ + omega) + subst ji + have hc : phi = choice.selected := by + simpa only [← hj, coloring, n] using ett.generatingColoring + simpa only [hj, Tn, hc] using choice.selectedStable + | RE ji _ _ _ _ available coloring stored edges kind vertex outside + delta gamma seed adjoin closure ordered strict => + have hji : ji = j := Fin.ext (by + have hv := congrArg Fin.val hi + simp [n, j] at hv ⊢ + omega) + subst ji + have hc : phi = ett.series.data.coloring j.castSucc := by + simpa only [← hj, coloring, n] using ett.generatingColoring + refine ⟨?_, ?_⟩ + · intro f _ _ + exact congrFun hc f + · intro v _ + exact congrArg (fun psi => MissingColors G psi v) hc + | PE ji _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper + one stored edges kind vertex outside delta gammaEq closure ordered strict => + exact (hp (by simpa [← hi] using kind)).elim + have hm : alpha ∈ TreeMissingColors phi Tn := by + simpa only [rZero hz, base.nonparallel hp] using halphaR + by_cases hn : 1 < ett.rounds + · obtain ⟨lower, hr, hmax, htrees, hdata⟩ := + CertifiedETTRestriction G k e0 input T phi ett C.maximum + (ett.rounds - 1) (by omega) (by omega) + let nl : Fin (lower.rounds + 1) := Fin.last lower.rounds + have hcidx : Fin.castLE (by omega) nl = j.castSucc := + Fin.ext (by simp [nl, j, hr]) + have htidx : Fin.castLE (by omega) (Fin.last (lower.rounds + 1)) = + n.castSucc := Fin.ext (by simp [n, hr]; omega) + have ht : lower.series.data.tree (Fin.last (lower.rounds + 1)) = Tn := + (htrees _).trans (congrArg ett.series.data.tree htidx) + obtain ⟨hc, _, _, _, _, _, _, _, hd, _⟩ := hdata nl + rw [hcidx] at hc hd + have hs : StableColoring + (lower.series.data.tree (Fin.last (lower.rounds + 1))) + (TashkinovStoredColors lower.series.data nl) + (lower.series.data.coloring nl) phi := by + rw [ht, hc, hd] + exact hprev + have hi := (hlower lower (by omega) (by omega) hmax).2.1 + phi hproper hone hs alpha beta (Or.inl (by rw [ht]; exact hm)) + simpa only [ht] using hi + · have hn1 : ett.rounds = 1 := by have := C.positive; omega + have hj0 : j.castSucc = (0 : Fin (ett.rounds + 1)) := + Fin.ext (by simp [j, hn1]) + have ht1 : n.castSucc = (⟨1, by omega⟩ : Fin (ett.rounds + 2)) := + Fin.ext (by simp [n, hn1]) + have hs : StableColoring (ett.series.data.tree ⟨1, by omega⟩) + (TashkinovStoredColors ett.series.data 0) + (ett.series.data.coloring 0) phi := by + simpa only [Tn, ht1, hj0] using hprev + have hi := (TechnicalTheoremBase G k ett.rounds e0 input ett.series).2 + phi hproper hone hs alpha beta + (Or.inl (by simpa only [Tn, ht1] using hm)) + have hTn1 : Tn = ett.series.data.tree ⟨1, by omega⟩ := + congrArg ett.series.data.tree ht1 + change TreeInterchangeable G Tn phi alpha beta + rw [hTn1] + exact hi + +private theorem helper_branch_650.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + (↑r : ℕ) < H.dividerCount → + TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → + ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → + alpha ∈ TreeMissingColors phi R → + ¬(↑r : ℕ) = (0 : ℕ) → + TreeInterchangeable G R phi alpha beta := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge alpha beta + hne r H R hrq hclosed rPositive halphaR hz + let i : Fin H.dividerCount := ⟨r.val - 1, by omega⟩ + have hi : i.succ.castSucc = r.castSucc := Fin.ext (by simp [i]; omega) + rw [rPositive hz] + rw [← hi] + apply step1 G k e0 input T phi ett C.maximum C.positive hproper hone + hlower base H C.good hfewer hlarge i alpha beta + · simpa [hi, ← rPositive hz] using halphaR + · exact hne + · simpa [hi, ← rPositive hz] using hclosed -private theorem helper_replacement_1032.{u_1, u_2} : +private theorem helper_pathB_687.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -3940,338 +1629,301 @@ private theorem helper_replacement_1032.{u_1, u_2} : (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), IsProperEdgeColoring G phi → - IsOneEdgeUncolored phi e0 → - LowerRoundInductionHypothesis G k e0 ett.rounds → - ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; - TreeSequenceInitialSegment base.core R → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - MaximumProperty - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } → - ∀ - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - baseB.core = base.core → - ∀ - (HB : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - IsProperEdgeColoring G sigma → - IsOneEdgeUncolored sigma e0 → - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → - ∀ (D : Finset (Fin k)), StableColoring S D phi sigma) → - StableColoring Tn Dn phi sigma → - TreeSequenceInitialSegment Tn B → - Tn.length < B.length → - (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence phi Tn B ∨ - (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ - ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), - ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → - (∀ (S : TreeSequence G e0), - TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → - ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), - MaximumProperty corr.replacementETT ∧ - ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : - TashkinovHierarchy corr.replacementETT baseS), - SameHierarchyStages HB HS := by + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + TwoColorPathComponent G phi alpha beta (Sum.inl vb) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R q A n Tn - Dn ib vb coreToR hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma - sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport - by_cases hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE - · have closureSubset : TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet R := by - obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hPE - intro v hv - apply TreeSequenceInitialSegmentVertexSetSubset coreToR - rw [← hcoreB, u.vertexSet] - exact Finset.mem_union_right _ hv - have hcombined : CombinedStableColoring Tn baseB.closure Dn phi sigma := - ⟨stableTn, stable baseB.closure closureSubset ∅⟩ - have hseq : TashkinovAugmentationSequence sigma Tn B := by - rcases terminalRoute with ⟨_, hs⟩ | ⟨hk, _⟩ - · exact routeTransport Tn hs - · rcases hk with hk | hk <;> rw [hPE] at hk <;> cases hk - exact HierarchySplitter G k e0 input B phi sigma ettB hMPB C.positive - hlower baseB HB hPE hproper hone sigmaProper sigmaOne hcombined hseq - · have hmod : ModColoring ettB sigma := - Td G k e0 input B phi ettB hMPB C.positive hlower sigma sigmaProper sigmaOne - (by simpa only [ettB, ← ett.generatingColoring, n, Tn, Dn] using stableTn) - have hroute : - ((ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence sigma Tn B) ∨ - ((ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.SE ∨ - ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), - ettB.series.data.connectingEdges (Fin.last ettB.rounds) = {f} ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed B)) := by - rcases terminalRoute with ⟨hp, _⟩ | ⟨hk, f, seed, hedges, hadjoin, hs⟩ - · exact (hPE hp).elim - · exact Or.inr ⟨hk, f, seed, hedges, hadjoin, routeTransport seed hs⟩ - obtain ⟨corr⟩ := hmod.2.2 B TnToB TnStrictB hroute - have hMP := MaximumPropertyTransport G k e0 ettB sigma hmod B corr hMPB - refine ⟨corr, hMP, ?_⟩ - rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, - hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ - rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ - cases hr - have heq : series = newSeries := eq_of_heq hs - cases heq - let rep : ExtendedTashkinovTree G k e0 newInput B sigma := - ⟨ett.rounds, rp, newSeries, above, strict, below, gen⟩ - let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ - have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) - have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j - have hkind := hkinds n - let pos : Fin ((newSeries.data.tree n.castSucc).length + 1) := - Fin.cast (congrArg (fun S : TreeSequence G e0 => S.length + 1) htree.symm) - baseB.supportPosition - let baseS : HierarchyBase rep sigma := - { core := baseB.core - closure := baseB.closure - supportPosition := pos - supportPositive := by simpa [pos] using baseB.supportPositive - terminalMissingColors := rfl - parallel := by - dsimp only [rep] - intro hp - exact (hPE (hkind.symm.trans hp)).elim - nonparallel := by - dsimp only [rep] - intro hp - exact (baseB.nonparallel hPE).trans htree.symm } - let HS : TashkinovHierarchy rep baseS := - { dividerCount := HB.dividerCount - stage := HB.stage - baseStage := HB.baseStage.trans htree.symm - terminalStage := HB.terminalStage - nested := HB.nested - strict := HB.strict - dividerPosition := HB.dividerPosition - dividerPositive := HB.dividerPositive - dividerIncreasing := HB.dividerIncreasing - dividerStage := HB.dividerStage - coreInsideFirst := HB.coreInsideFirst } - refine ⟨baseS, HS, ?_⟩ - refine ⟨rfl, rfl, HEq.rfl, HEq.rfl, ?_, ?_⟩ - · exact ⟨fun hp => (hPE hp).elim, fun hp => (hPE (hkind.symm.trans hp)).elim⟩ - · intro hp; exact (hPE hp).elim + intro V E _ _ _ _ G k e0 input T phi ett base C hproper alpha beta hne r H q A ib vb ell + yLength Y hb + clear * - hb hproper hne + refine ⟨hne, Sum.inl vb, rfl, ?_⟩ + intro x hx y hy + cases x with + | inr f => + cases y with + | inr g => + have hfc : phi f = some alpha := hx.2.resolve_right (by + intro he + exact (Finset.mem_sdiff.mp hb.1).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hx.1, he⟩)) + have hgc : phi g = some alpha := hy.2.resolve_right (by + intro he + exact (Finset.mem_sdiff.mp hb.1).2 + (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hy.1, he⟩)) + congr 1 + by_contra hfg + exact hproper hfg ⟨vb, hx.1, hy.1⟩ hfc hgc + | inl w => exact False.elim hy + | inl w => exact False.elim hx + +private theorem helper_unaffected_722.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : + PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k), + alpha ≠ beta → + ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta + (Sum.inl vb); + ∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H q A ib vb ell yLength Y ha + hb K sigma f c hca hcb + clear * - hca hcb K sigma hne + by_cases hf : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hca.symm, hcb.symm] + · by_cases hb : phi f = some beta + · simp [sigma, TwoColorComponentSwap, K, hf, hb, hne.symm, + hca.symm, hcb.symm] + · simp [sigma, TwoColorComponentSwap, K, hf, ha, hb] + · simp [sigma, TwoColorComponentSwap, K, hf] -private theorem helper_storedS_1119.{u_1, u_2} : +private theorem helper_sigmaOne_739.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsOneEdgeUncolored phi e0 → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let _ : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn := by + (∀ (f : E) (c : Fin k), c ≠ alpha → c ≠ beta → (sigma f = some c ↔ phi f = some c)) → + IsOneEdgeUncolored sigma e0 := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn Dn ib vb TnToA hAib B - rpB aboveB strictB belowB genB ettB sigma treeMissingEq corr - clear * - corr ett n Tn Dn ettB C treeMissingEq TnToA - rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, - hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ - rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ - cases hr - have heq : series = newSeries := eq_of_heq hs - cases heq - let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ - have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) - have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j - have hm := treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) - unfold Dn TashkinovStoredColors - simp only [ettB, hstored, ← hgen, ← ett.generatingColoring, htree, hm, n, Tn] + intro V E _ _ _ _ G k e0 input T phi ett base C hone alpha beta hne r H q A ib vb ell yLength Y + ha hb K sigma unaffected + clear * - hone sigma K unaffected hne + refine ⟨?_, ?_⟩ + · simp [sigma, TwoColorComponentSwap, hone.1] + · intro f hf + obtain ⟨c, hc⟩ := hone.2 f hf + by_cases ha : c = alpha + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · by_cases hb : c = beta + · subst c + by_cases hK : Sum.inr f ∈ K + · exact ⟨alpha, by simp [sigma, TwoColorComponentSwap, K, hK, hc, hne.symm]⟩ + · exact ⟨beta, by simp [sigma, TwoColorComponentSwap, K, hK, hc]⟩ + · exact ⟨c, (unaffected f c ha hb).mpr hc⟩ -private theorem helper_stageBToB_1145.{u_1, u_2} : +private theorem helper_missingBefore_764.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + ∀ (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S U → - TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + let va : V := T.vertex ia; + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + va ∈ TreeSequenceVertexSet Y → + vb ∈ TreeSequenceVertexSet Y → ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi) - (HB : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB) - (j : Fin (HB.dividerCount + (2 : ℕ))), - TreeSequenceInitialSegment (HB.stage j) B := by + TreeSequenceInitialSegment B Y → + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + Sum.inl va ∉ K → + (have C : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + have phi' : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (v : V), Sum.inl v ∉ C → MissingColors G phi' v = MissingColors G phi v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → alpha ∈ MissingColors G phi v → beta ∈ MissingColors G phi' v) ∧ + (∀ (v : V), + Sum.inl v ∈ C → + beta ∈ MissingColors G phi v → alpha ∈ MissingColors G phi' v) ∧ + ∀ (v : V) (c : Fin k), + c ≠ alpha → + c ≠ beta → (c ∈ MissingColors G phi' v ↔ c ∈ MissingColors G phi v)) → + (∀ {v : V} {f : E}, + Sum.inl v ∈ K → + Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ K) → + ∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → + MissingColors G sigma v = MissingColors G phi v := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib segRefl segTrans hAib B - rpB aboveB strictB belowB genB baseB HB j - clear * - HB j B segRefl segTrans - exact Fin.reverseInduction - (motive := fun j => TreeSequenceInitialSegment (HB.stage j) B) - (by simpa only [HB.terminalStage] using segRefl B) - (fun i hi => segTrans (HB.nested i) hi) j + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne r H q A ia ib va vb ell yLength + Y hElementaryY ha hb haY hbY hAib B BToY K sigma haK behavior edgeOfVertex v hv hvb + clear * - hv hvb K haK haY hbY ha hb hElementaryY BToY behavior edgeOfVertex sigma hne + by_cases hvK : Sum.inl v ∈ K + · have hva : v ≠ va := by intro he; exact haK (he ▸ hvK) + have hvY := TreeSequenceInitialSegmentVertexSetSubset BToY hv + have han : alpha ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY haY hva) hc ha.1 + have hbn : beta ∉ MissingColors G phi v := fun hc => + Finset.disjoint_left.mp (hElementaryY hvY hbY hvb) hc hb.1 + have hpa : ∃ f, Incident G v f ∧ phi f = some alpha := by + simpa [MissingColors, PresentColors] using han + have hpb : ∃ f, Incident G v f ∧ phi f = some beta := by + simpa [MissingColors, PresentColors] using hbn + obtain ⟨fa, hfa, hfca⟩ := hpa + obtain ⟨fb, hfb, hfcb⟩ := hpb + have hfaK := edgeOfVertex hvK hfa (Or.inl hfca) + have hfbK := edgeOfVertex hvK hfb (Or.inr hfcb) + have hnewa : sigma fb = some alpha := by + simp [sigma, TwoColorComponentSwap, K, hfbK, hfcb, hne.symm] + have hnewb : sigma fa = some beta := by + simp [sigma, TwoColorComponentSwap, K, hfaK, hfca] + have hana : alpha ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fb, hfb, hnewa⟩ + have hbnb : beta ∉ MissingColors G sigma v := by + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and, + PresentColors, Finset.mem_filter, not_not] + exact ⟨fa, hfa, hnewb⟩ + ext c + by_cases hca : c = alpha + · subst c; simp [hana, han] + · by_cases hcb : c = beta + · subst c; simp [hbnb, hbn] + · exact behavior.2.2.2 v c hca hcb + · exact behavior.1 v hvK -private theorem helper_closureBToA_1152.{u_1, u_2} : +private theorem helper_incidentFixed_818.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - TreeSequenceInitialSegment base.core A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + let vb : V := T.vertex ib; + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - baseB.core = base.core → - ett.series.data.kind n = some TashkinovExtensionKind.PE → - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ + (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Y.length → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + let K : Set (V ⊕ E) := TwoColorComponent G phi alpha beta (Sum.inl vb); + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet R, Sum.inl v ∉ K) → + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + ∀ (f : E), + TreeIncidentEdge R f → + sigma f = phi f := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n ib coreToA hAib B rpB - aboveB strictB belowB genB baseB hcoreB hp - clear * - hp baseB coreToA hcoreB - obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hp - intro v hv - apply TreeSequenceInitialSegmentVertexSetSubset coreToA - rw [← hcoreB, u.vertexSet] - exact Finset.mem_union_right _ hv + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb ell yLength Y ha hb + K sigma avoidR fixedValue f hf + clear * - hf sigma K avoidR fixedValue + obtain ⟨v, hv, hvf⟩ := hf + by_cases hK : Sum.inr f ∈ K + · by_cases ha : phi f = some alpha + · exact False.elim (avoidR v hv + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, Or.inl ha⟩)).trans hK)) + · by_cases hb : phi f = some beta + · exact False.elim (avoidR v hv + ((SimpleGraph.ConnectedComponent.connectedComponentMk_eq_of_adj + (show (TwoColorIncidenceGraph G phi alpha beta).Adj (Sum.inl v) (Sum.inr f) + from ⟨hvf, Or.inr hb⟩)).trans hK)) + · exact fixedValue f ha hb + · simp [sigma, TwoColorComponentSwap, K, hK] -private theorem helper_minusEq_1160.{u_1, u_2} : +private theorem helper_stable_834.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) @@ -4288,478 +1940,592 @@ private theorem helper_minusEq_1160.{u_1, u_2} : TreeSequenceInitialSegment R A → let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → ∀ (S : TreeSequence G e0), TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → ∀ (D : Finset (Fin k)), - TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D := by + StableColoring S D phi sigma := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb RToA sigma - treeMissingEq incidentFixed S hS D - unfold TreeColorSetMinusClosed TreeColorSetClosed - rw [treeMissingEq S (fun v hv => TreeSequenceInitialSegmentVertexSetSubset RToA (hS hv))] - have boundaryEq (c : Fin k) (hc : c ∈ TreeMissingColors phi S) : - BoundaryColorEdges G sigma (TreeSequenceVertexSet S) c = - BoundaryColorEdges G phi (TreeSequenceVertexSet S) c := by - ext f - simp only [BoundaryColorEdges, Finset.mem_filter] - apply and_congr_right - intro hf - simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf - obtain ⟨u, hu, v, hv, he⟩ := hf - have hfix : sigma f = phi f := incidentFixed f ⟨u, hS hu, by simp [Incident, he]⟩ - rw [hfix] - exact ⟨fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).symm.trans (hs c hc), - fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).trans (hs c hc)⟩ + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb RToA sigma missingA + incidentFixed S hS D + refine ⟨?_, fun v hv => missingA v (TreeSequenceInitialSegmentVertexSetSubset RToA (hS hv))⟩ + intro f hf _ + obtain ⟨v, hv, hvf⟩ := hf + exact incidentFixed f ⟨v, hS hv, hvf⟩ -private theorem helper_storedEq_1197.{u_1, u_2} : +private theorem helper_terminalRoute_847.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S W → + TreeSequenceInitialSegment U W → + S.length ≤ U.length → TreeSequenceInitialSegment S U) → ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn → - ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ)))) → + ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib commonPrefix hAib B + TnToB TnStrictB BToFinal + clear * - ett C n Tn B BToFinal TnToB TnStrictB commonPrefix + have step := ett.series.certified n + generalize hi : n = i at step + cases step with + | initial => have hv := congrArg Fin.val hi; simp [n] at hv; have := C.positive; omega + | SE j _ _ _ _ _ choice _ coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedB : TreeSequenceInitialSegment seed B := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + BToFinal (by + have hl := adjoin.1 + rw [hj] at hl + change seed.length = Tn.length + 1 at hl + omega) + exact Or.inr ⟨Or.inl (by simpa [hj] using kind), choice.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + TashkinovAugmentationSequenceRestrict phi seed B _ hroute hseedB BToFinal⟩ + | PE j _ _ _ _ _ choice _ gamma _ second _ _ _ exit coloring proper one stored + edges kind vertex outside delta gammaEq closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + refine Or.inl ⟨by simpa [hj] using kind, ?_⟩ + apply TashkinovAugmentationSequenceRestrict phi Tn B _ _ TnToB BToFinal + simpa [Tn, hj, hlast, ← ett.generatingColoring, n] using closure.1 + | RE j _ _ _ _ available coloring stored edges kind vertex outside delta gamma + seed adjoin closure ordered strict => + have hj : j.succ = n := hi.symm + have hlast : j.succ.succ = Fin.last (ett.rounds + 1) := + Fin.ext (by have hv := congrArg Fin.val hj; simp [n] at hv ⊢; omega) + have hroute : TashkinovAugmentationSequence phi seed + (ett.series.data.tree (Fin.last (ett.rounds + 1))) := by + simpa [hj, hlast, ← ett.generatingColoring, n] using closure.1 + have hseedB : TreeSequenceInitialSegment seed B := + commonPrefix (TashkinovAugmentationSequenceInitialSegment phi _ _ hroute) + BToFinal (by + have hl := adjoin.1 + rw [hj] at hl + change seed.length = Tn.length + 1 at hl + omega) + exact Or.inr ⟨Or.inr (by simpa [hj] using kind), available.edge, seed, + by simpa [hj] using edges, by simpa [Tn, hj] using adjoin, + TashkinovAugmentationSequenceRestrict phi seed B _ hroute hseedB BToFinal⟩ + +private theorem helper_displayedIncident_896.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + ∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S R → + ∀ (t : Fin S.length), + TreeIncidentEdge R (S.edge t) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - change TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) \ TreeMissingColors sigma (HierarchyStarredStage HS - j) = - Dn \ TreeMissingColors phi (HierarchyStarredStage HB j) - rw [storedS, starEq, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starBToA j))] + intro V E _ _ _ _ G k e0 input T phi ett base C r H R S hSA t + obtain ⟨i, hi⟩ := S.attaches t + refine ⟨S.vertex t.succ, TreeSequenceInitialSegmentVertexSetSubset hSA + (by simp [TreeSequenceVertexSet]), ?_⟩ + simp [Incident, hi] -private theorem helper_missingEq_1204.{u_1, u_2} : +private theorem helper_augmentationFixed_904.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → + let ell : ℕ := T.length - A.length; + let yLength : ℕ := min (A.length + (ell - (1 : ℕ))) T.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T yLength + (have hA : (1 : ℕ) ≤ A.length := A.positive; + have hT : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ yLength) ↦ by omega) + (by omega); + (∀ (S : TreeSequence G e0), TreeSequenceInitialSegment S S) → + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → + TreeSequenceInitialSegment R A → + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + beta ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ Y.length → + (∀ (i : Fin (T.length + (1 : ℕ))), + (↑i : ℕ) ≤ Y.length → T.vertex i ∈ TreeSequenceVertexSet Y) → + vb ∈ TreeSequenceVertexSet Y → ∀ (hAib : A.length < (↑ib : ℕ)), + alpha ∉ + ({c : Fin k | ∃ (t : Fin A.length), R.length ≤ (↑t : ℕ) ∧ phi (A.edge t) = some c} : + Finset (Fin k)) → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T alpha)) + (T.vertex (HierarchyFirstMissingPosition phi T beta)) ∧ + alpha ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + (HierarchyStarredStage C.hierarchy + (Fin.last C.hierarchy.dividerCount)).length ≤ + (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k)) → let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; + TreeSequenceInitialSegment B T → + TreeSequenceInitialSegment A B → let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), phi f ≠ some alpha → phi f ≠ some beta → sigma f = phi f) → + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + TreeSequenceInitialSegment S R → + ∀ (t : Fin S.length), TreeIncidentEdge R (S.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), + S.length ≤ (↑t : ℕ) → + sigma (B.edge t) = phi (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb ell yLength Y + segRefl segTrans RToA hElementaryY hb vertexY hbY hAib unusedRA horder B BToT AToB sigma + fixedValue incidentFixed displayedIncident S hseq t ht + by_cases htA : t.val < R.length + · have hRB := segTrans RToA AToB + have he := hRB.2.2 ⟨t.val, htA⟩ + have hi : Fin.castLE hRB.1 ⟨t.val, htA⟩ = t := Fin.ext rfl + rw [hi] at he + rw [he] + exact incidentFixed _ (displayedIncident R (segRefl R) _) + · have hstep := (TashkinovAugmentationSequencePosition phi S B hseq t ht).1 + obtain ⟨hl, hinit, c, hcol, hm⟩ := hstep + have hcolB : phi (B.edge t) = some c := by + convert hcol using 1 + congr 2 + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨iv, hiv⟩ := hv + let ivT : Fin (T.length + 1) := ⟨iv.val, by + have htB := BToT.1 + have := iv.isLt + simp only [TreeSequencePrefix] at this + omega⟩ + have hcvT : c ∈ MissingColors G phi (T.vertex ivT) := by + have he : (TreeSequencePrefix B t.val (le_trans S.positive ht) + (Nat.le_of_lt t.isLt)).vertex iv = T.vertex ivT := rfl + rw [← he, hiv] + exact hcv + have hnotA : c ≠ alpha := by + intro he + subst c + by_cases htLast : t.val < A.length + · apply unusedRA + let u : Fin A.length := ⟨t.val, htLast⟩ + have he := AToB.2.2 u + have hi : Fin.castLE AToB.1 u = t := Fin.ext rfl + rw [hi] at he + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, u, + by change R.length ≤ t.val; omega, + by rw [← he]; exact hcolB⟩ + · apply horder.2 + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, Fin.castLE BToT.1 t, + by change A.length ≤ t.val; omega, t.isLt, + by rw [BToT.2.2 t]; exact hcolB⟩ + have hnotB : c ≠ beta := by + intro he + subst c + have hivB : ivT.val < ib.val := by + have := iv.isLt + simp only [TreeSequencePrefix] at this + have htB : t.val < ib.val := t.isLt + dsimp [ivT] + omega + have hvY := vertexY ivT (by omega) + have hneV : T.vertex ivT ≠ vb := by + intro he + have hi := congrArg Fin.val (T.vertex_injective he) + omega + exact Finset.disjoint_left.mp (hElementaryY hvY hbY hneV) hcvT hb.1 + exact fixedValue _ (fun hc => hnotA (Option.some.inj (hcolB.symm.trans hc))) + (fun hc => hnotB (Option.some.inj (hcolB.symm.trans hc))) + +private theorem helper_seedFixed_967.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn R → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → + ∀ (f : E) (seed : TreeSequence G e0), + TreeSequenceAdjoinEdge Tn f seed → + sigma f = phi f := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - refine Fin.cases ?_ (fun i => ?_) j - · change TreeMissingColors sigma (corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn - have htree : corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc = Tn := - hsbase.symm.trans hbbase - rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] - · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R n Tn ib vb TnToR sigma + incidentFixed f seed hadjoin + obtain ⟨i, hi⟩ := seed.attaches (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) + let j : Fin (Tn.length + 1) := ⟨i.val, by have := i.isLt; simpa using this⟩ + have hv : seed.vertex (Fin.castLT i + (Nat.lt_trans i.isLt (Nat.succ_lt_succ + (Fin.cast hadjoin.1.symm (Fin.last Tn.length)).isLt))) = Tn.vertex j := + hadjoin.2.1.2.1 j + apply incidentFixed + refine ⟨Tn.vertex j, TreeSequenceInitialSegmentVertexSetSubset TnToR + (by simp [TreeSequenceVertexSet]), ?_⟩ + rw [← hadjoin.2.2, Incident, hi] + simp [← hv] -private theorem helper_firstLe_1215.{u_1, u_2} : +private theorem helper_edgesFixed_981.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn R → ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) (by omega); - ∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), - eta ∈ MissingColors G psi (B.vertex i) → - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ) := by + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → + TreeSequenceInitialSegment Tn B → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → + (∀ (S : TreeSequence G e0), + TreeSequenceInitialSegment S R → + ∀ (t : Fin S.length), TreeIncidentEdge R (S.edge t)) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + ∀ (t : Fin B.length), S.length ≤ (↑t : ℕ) → sigma (B.edge t) = phi (B.edge t)) → + (∀ (f : E) (seed : TreeSequence G e0), + TreeSequenceAdjoinEdge Tn f seed → sigma f = phi f) → + ∀ (t : Fin B.length), + sigma (B.edge t) = phi (B.edge t) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib hAib B psi eta i hc - clear * - psi eta i hc - let candidates := Finset.univ.filter fun j => eta ∈ MissingColors G psi (B.vertex j) - have hi : i ∈ candidates := by simp [candidates, hc] - have hn : candidates.Nonempty := ⟨i, hi⟩ - simpa [HierarchyFirstMissingPosition, candidates, hn] using - (show (candidates.min' hn).val ≤ i.val from Finset.min'_le candidates i hi) + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A n Tn ib vb TnToR hAib B + sigma incidentFixed TnToB terminalRoute displayedIncident augmentationFixed seedFixed t + by_cases ht : t.val < Tn.length + · have he := TnToB.2.2 ⟨t.val, ht⟩ + have hi : Fin.castLE TnToB.1 ⟨t.val, ht⟩ = t := Fin.ext rfl + rw [hi] at he + rw [he] + exact incidentFixed _ (displayedIncident Tn TnToR _) + · rcases terminalRoute with ⟨hp, hs⟩ | ⟨hk, f, seed, hedges, hadjoin, hs⟩ + · exact augmentationFixed Tn hs t (by omega) + · by_cases he : t.val = Tn.length + · have hSB := TashkinovAugmentationSequenceInitialSegment phi seed B hs + have hi := hSB.2.2 (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) + have hj : Fin.castLE hSB.1 (Fin.cast hadjoin.1.symm (Fin.last Tn.length)) = t := + Fin.ext (by simpa using he.symm) + rw [hj, hadjoin.2.2] at hi + simpa [hi] using seedFixed f seed hadjoin + · exact augmentationFixed seed hs t (by have := hadjoin.1; omega) -private theorem helper_firstStrict_1224.{u_1, u_2} : +private theorem helper_routeTransport_1000.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + (∀ {S U W : TreeSequence G e0}, + TreeSequenceInitialSegment S U → + TreeSequenceInitialSegment U W → TreeSequenceInitialSegment S W) → ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) (by omega); - ∀ (psi : PartialEdgeColoring E k) (eta : Fin k), - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → - eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by + TreeSequenceInitialSegment B T → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → + ∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → + TashkinovAugmentationSequence sigma S B := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib hAib B psi eta h - clear * - psi eta h - unfold HierarchyFirstMissingPosition at h ⊢ - dsimp only at h ⊢ - split_ifs with hn - · exact (Finset.mem_filter.mp (Finset.min'_mem _ hn)).2 - · simp only [dite_eq_right hn, Fin.val_last] at h - omega + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb segTrans hAib B BToT + sigma missingBefore edgesFixed S hs + clear * - S hs edgesFixed BToT segTrans missingBefore + unfold TashkinovAugmentationSequence at hs ⊢ + induction hs using Relation.ReflTransGen.head_induction_on with + | refl => exact Relation.ReflTransGen.refl + | @head U W hstep htail ih => + have hWB := TashkinovAugmentationSequenceInitialSegment phi W B htail + obtain ⟨hlen, hUW, c, hcol, hm⟩ := hstep + have hUB := segTrans hUW hWB + have hlt : U.length < B.length := by have := hWB.1; omega + refine Relation.ReflTransGen.head ⟨hlen, hUW, c, ?_, ?_⟩ ih + · have hf := edgesFixed (Fin.castLE hWB.1 (Fin.cast hlen.symm (Fin.last U.length))) + rw [hWB.2.2] at hf + exact hf.trans hcol + · obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hm + have hvB := TreeSequenceInitialSegmentVertexSetSubset hUB hv + have hvb : v ≠ vb := by + intro he + simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] at hv + obtain ⟨i, hi⟩ := hv + have ht := hUB.2.1 i + have htT := BToT.2.1 (Fin.castLE (Nat.succ_le_succ hUB.1) i) + have eqv : T.vertex (Fin.castLE (Nat.succ_le_succ BToT.1) + (Fin.castLE (Nat.succ_le_succ hUB.1) i)) = T.vertex ib := htT.trans (ht.trans + (hi.trans he)) + have hh := congrArg Fin.val (T.vertex_injective eqv) + have := i.isLt + change i.val = ib.val at hh + change U.length < ib.val at hlt + omega + exact Finset.mem_biUnion.mpr ⟨v, hv, by rw [missingBefore v hvB hvb]; exact hcv⟩ -private theorem helper_firstEq_1234.{u_1, u_2} : +private theorem helper_replacement_1032.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + ∀ (alpha beta : Fin k) (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; + TreeSequenceInitialSegment base.core R → ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) (by omega); - TreeSequenceInitialSegment B T → + ∀ (rpB : (1 : ℕ) ≤ ett.1) + (aboveB : + TreeSequenceInitialSegment + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) + (strictB : + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < + B.length) + (belowB : + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), + MaximumProperty + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } → + ∀ + (baseB : + HierarchyBase + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + phi), + baseB.core = base.core → + ∀ + (HB : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB), + let ettB : ExtendedTashkinovTree G k e0 input B phi := + { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet B, - v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → - (∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), - eta ∈ MissingColors G psi (B.vertex i) → - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ)) → - (∀ (psi : PartialEdgeColoring E k) (eta : Fin k), - (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → - eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta))) → - ∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B BToT sigma - missingBefore firstLe firstStrict eta - clear * - eta B BToT ib missingBefore firstLe firstStrict - have beforeLast (i : Fin (B.length + 1)) (hi : i.val < B.length) : - MissingColors G sigma (B.vertex i) = MissingColors G phi (B.vertex i) := by - apply missingBefore - · simp [TreeSequenceVertexSet] - · intro he - have heT := (BToT.2.1 i).trans he - have heval := congrArg Fin.val (T.vertex_injective heT) - have hbLen : B.length = ib.val := rfl - change i.val = ib.val at heval - omega - apply Fin.ext - apply Nat.le_antisymm - · by_cases h : (HierarchyFirstMissingPosition phi B eta).val < B.length - · apply firstLe sigma eta - rw [beforeLast _ h] - exact firstStrict phi eta h - · have := (HierarchyFirstMissingPosition sigma B eta).isLt - omega - · by_cases h : (HierarchyFirstMissingPosition sigma B eta).val < B.length - · apply firstLe phi eta - rw [← beforeLast _ h] - exact firstStrict sigma eta h - · have := (HierarchyFirstMissingPosition phi B eta).isLt - omega + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → + ∀ (D : Finset (Fin k)), StableColoring S D phi sigma) → + StableColoring Tn Dn phi sigma → + TreeSequenceInitialSegment Tn B → + Tn.length < B.length → + (ett.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence phi Tn B ∨ + (ett.series.data.kind n = some TashkinovExtensionKind.SE ∨ + ett.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ett.series.data.connectingEdges n = ({ f } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence phi seed B) → + (∀ (S : TreeSequence G e0), + TashkinovAugmentationSequence phi S B → TashkinovAugmentationSequence sigma S B) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (baseS : HierarchyBase corr.replacementETT sigma) (HS : + TashkinovHierarchy corr.replacementETT baseS), + SameHierarchyStages HB HS := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta r H R q A n Tn + Dn ib vb coreToR hAib B rpB aboveB strictB belowB genB hMPB baseB hcoreB HB ettB sigma + sigmaProper sigmaOne stable stableTn TnToB TnStrictB terminalRoute routeTransport + by_cases hPE : ett.series.data.kind n = some TashkinovExtensionKind.PE + · have closureSubset : TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet R := by + obtain ⟨_, _, ⟨u⟩⟩ := baseB.parallel hPE + intro v hv + apply TreeSequenceInitialSegmentVertexSetSubset coreToR + rw [← hcoreB, u.vertexSet] + exact Finset.mem_union_right _ hv + have hcombined : CombinedStableColoring Tn baseB.closure Dn phi sigma := + ⟨stableTn, stable baseB.closure closureSubset ∅⟩ + have hseq : TashkinovAugmentationSequence sigma Tn B := by + rcases terminalRoute with ⟨_, hs⟩ | ⟨hk, _⟩ + · exact routeTransport Tn hs + · rcases hk with hk | hk <;> rw [hPE] at hk <;> cases hk + exact HierarchySplitter G k e0 input B phi sigma ettB hMPB C.positive + hlower baseB HB hPE hproper hone sigmaProper sigmaOne hcombined hseq + · have hmod : ModColoring ettB sigma := + Td G k e0 input B phi ettB hMPB C.positive hlower sigma sigmaProper sigmaOne + (by simpa only [ettB, ← ett.generatingColoring, n, Tn, Dn] using stableTn) + have hroute : + ((ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B) ∨ + ((ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.SE ∨ + ettB.series.data.kind (Fin.last ettB.rounds) = some TashkinovExtensionKind.RE) ∧ + ∃ (f : E) (seed : TreeSequence G e0), + ettB.series.data.connectingEdges (Fin.last ettB.rounds) = {f} ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed B)) := by + rcases terminalRoute with ⟨hp, _⟩ | ⟨hk, f, seed, hedges, hadjoin, hs⟩ + · exact (hPE hp).elim + · exact Or.inr ⟨hk, f, seed, hedges, hadjoin, routeTransport seed hs⟩ + obtain ⟨corr⟩ := hmod.2.2 B TnToB TnStrictB hroute + have hMP := MaximumPropertyTransport G k e0 ettB sigma hmod B corr hMPB + refine ⟨corr, hMP, ?_⟩ + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ + rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let rep : ExtendedTashkinovTree G k e0 newInput B sigma := + ⟨ett.rounds, rp, newSeries, above, strict, below, gen⟩ + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j + have hkind := hkinds n + let pos : Fin ((newSeries.data.tree n.castSucc).length + 1) := + Fin.cast (congrArg (fun S : TreeSequence G e0 => S.length + 1) htree.symm) + baseB.supportPosition + let baseS : HierarchyBase rep sigma := + { core := baseB.core + closure := baseB.closure + supportPosition := pos + supportPositive := by simpa [pos] using baseB.supportPositive + terminalMissingColors := rfl + parallel := by + dsimp only [rep] + intro hp + exact (hPE (hkind.symm.trans hp)).elim + nonparallel := by + dsimp only [rep] + intro hp + exact (baseB.nonparallel hPE).trans htree.symm } + let HS : TashkinovHierarchy rep baseS := + { dividerCount := HB.dividerCount + stage := HB.stage + baseStage := HB.baseStage.trans htree.symm + terminalStage := HB.terminalStage + nested := HB.nested + strict := HB.strict + dividerPosition := HB.dividerPosition + dividerPositive := HB.dividerPositive + dividerIncreasing := HB.dividerIncreasing + dividerStage := HB.dividerStage + coreInsideFirst := HB.coreInsideFirst } + refine ⟨baseS, HS, ?_⟩ + refine ⟨rfl, rfl, HEq.rfl, HEq.rfl, ?_, ?_⟩ + · exact ⟨fun hp => (hPE hp).elim, fun hp => (hPE (hkind.symm.trans hp)).elim⟩ + · intro hp; exact (hPE hp).elim -private theorem helper_segmentEq_1261.{u_1, u_2} : +private theorem helper_storedS_1119.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -4770,8 +2536,12 @@ private theorem helper_segmentEq_1261.{u_1, u_2} : let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) @@ -4787,140 +2557,82 @@ private theorem helper_segmentEq_1261.{u_1, u_2} : B.length) (belowB : TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), let ettB : ExtendedTashkinovTree G k e0 input B phi := { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - (∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = - HierarchyFirstMissingPosition phi B eta) → - ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn Dn ib vb TnToA hAib B + rpB aboveB strictB belowB genB ettB sigma treeMissingEq corr + clear * - corr ett n Tn Dn ettB C treeMissingEq TnToA + rcases corr with ⟨newInput, newSeries, newETT, hr, hs, hgen, htrees, hstored, + hedges, hkinds, hproperSeries, honeSeries, hstableSeries⟩ + rcases newETT with ⟨r, rp, series, above, strict, below, gen⟩ + cases hr + have heq : series = newSeries := eq_of_heq hs + cases heq + let j : Fin ett.rounds := ⟨ett.rounds - 1, by have := C.positive; omega⟩ + have hj : j.succ = n := Fin.ext (by simp [j, n]; have := C.positive; omega) + have htree : newSeries.data.tree n.castSucc = Tn := by simpa [hj, ettB, Tn] using htrees j + have hm := treeMissingEq Tn (TreeSequenceInitialSegmentVertexSetSubset TnToA) + unfold Dn TashkinovStoredColors + simp only [ettB, hstored, ← hgen, ← ett.generatingColoring, htree, hm, n, Tn] + +private theorem helper_minusEq_1160.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) (alpha beta : Fin k) + (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + TreeSequenceInitialSegment R A → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → + (∀ (f : E), TreeIncidentEdge R f → sigma f = phi f) → + ∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet R → + ∀ (D : Finset (Fin k)), + TreeColorSetMinusClosed G sigma S D ↔ TreeColorSetMinusClosed G phi S D := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - clear * - j eta starEq firstEq edgesFixed stageBToB - have hedge (t : Fin (stages j.succ).length) : - sigma ((stages j.succ).edge t) = phi ((stages j.succ).edge t) := by - have hSB := stageBToB j.succ - have hf := edgesFixed (Fin.castLE hSB.1 t) - rw [hSB.2.2] at hf - exact hf - unfold HierarchySegmentColors - simp only [starEq, firstEq eta, HS, HB, hedge] + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A ib vb RToA sigma + treeMissingEq incidentFixed S hS D + unfold TreeColorSetMinusClosed TreeColorSetClosed + rw [treeMissingEq S (fun v hv => TreeSequenceInitialSegmentVertexSetSubset RToA (hS hv))] + have boundaryEq (c : Fin k) (hc : c ∈ TreeMissingColors phi S) : + BoundaryColorEdges G sigma (TreeSequenceVertexSet S) c = + BoundaryColorEdges G phi (TreeSequenceVertexSet S) c := by + ext f + simp only [BoundaryColorEdges, Finset.mem_filter] + apply and_congr_right + intro hf + simp only [BoundaryEdges, Finset.mem_filter, Finset.mem_univ, true_and] at hf + obtain ⟨u, hu, v, hv, he⟩ := hf + have hfix : sigma f = phi f := incidentFixed f ⟨u, hS hu, by simp [Incident, he]⟩ + rw [hfix] + exact ⟨fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).symm.trans (hs c hc), + fun hs c hc => (boundaryEq c (Finset.mem_sdiff.mp hc).1).trans (hs c hc)⟩ -private theorem helper_refreshEq_1273.{u_1, u_2} : +private theorem helper_storedEq_1197.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -4931,6 +2643,8 @@ private theorem helper_refreshEq_1273.{u_1, u_2} : let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; ∀ (hAib : A.length < (↑ib : ℕ)), @@ -4962,10 +2676,15 @@ private theorem helper_refreshEq_1273.{u_1, u_2} : generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) + (baseS : HierarchyBase corr.replacementETT sigma), + TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) = + Dn → + ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) (hbbase : stages (0 : Fin (count + (2 : ℕ))) = { rounds := ett.1, roundsPositive := rpB, series := ett.series, @@ -5011,18 +2730,19 @@ private theorem helper_refreshEq_1273.{u_1, u_2} : baseB }.dividerCount + (1 : ℕ))), TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) + (HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j) A) → ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) @@ -5060,26 +2780,21 @@ private theorem helper_refreshEq_1273.{u_1, u_2} : coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v := by + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - clear * - i starEq missingA stageBToA - rw [starEq] - apply Finset.biUnion_congr rfl - intro v hv - exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ) - (Finset.mem_sdiff.mp hv).1) + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS starEq j + change TashkinovStoredColors corr.replacementETT.series.data + (Fin.last corr.replacementETT.rounds) \ TreeMissingColors sigma (HierarchyStarredStage HS + j) = + Dn \ TreeMissingColors phi (HierarchyStarredStage HB j) + rw [storedS, starEq, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (starBToA j))] -private theorem helper_hstarLast_1371.{u_1, u_2} : +private theorem helper_missingEq_1204.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -5090,9 +2805,11 @@ private theorem helper_hstarLast_1371.{u_1, u_2} : let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; + TreeSequenceInitialSegment Tn A → ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) @@ -5122,6 +2839,9 @@ private theorem helper_hstarLast_1371.{u_1, u_2} : generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (S : TreeSequence G e0), + TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → + TreeMissingColors sigma S = TreeMissingColors phi S) → ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) @@ -5153,20 +2873,7 @@ private theorem helper_hstarLast_1371.{u_1, u_2} : TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) (hbcore : TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (hcountB : - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount = - H.dividerCount), + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), (∀ (j : Fin @@ -5179,128 +2886,24 @@ private theorem helper_hstarLast_1371.{u_1, u_2} : { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc = - H.stage jo.castSucc ∧ - HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j = - HierarchyStarredStage H jo) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - HierarchyStarredStage HS (Fin.last count) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested - hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - rw [starEq] - have hs := (hstagesB (Fin.last count)).2 - have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := - Fin.ext (by simp [q]) - simpa only [hj] using hs - -private theorem helper_pathLe_1383.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) - (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - let _ : ℕ := T.length - A.length; - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by omega); - TreeSequenceInitialSegment B T → - A.length < B.length → - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) (hsincreasing : ∀ (i j : Fin count), @@ -5322,118 +2925,158 @@ private theorem helper_pathLe_1383.{u_1, u_2} : (hscore : TreeSequenceInitialSegment baseS.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + let HB : TashkinovHierarchy ettB baseB := + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; let HS : TashkinovHierarchy corr.replacementETT baseS := { dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, nested := hsnested, strict := hsstrict, dividerPosition := positionsS, dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - HierarchyStarredStage HS (Fin.last count) = A → - HierarchyPathNumber HS ≤ HierarchyPathNumber H := by + ∀ (j : Fin (count + (1 : ℕ))), + HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb ell AToT hAib B BToT - ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - clear * - HS H A T B q ell count hstarLast BToT AToT ABstrict - let tailB := B.length - A.length - let candidatesT := (Finset.Icc 1 ell).filter fun i => - ∀ t : Fin T.length, A.length + i ≤ t.val → - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) - let candidatesB := (Finset.Icc 1 tailB).filter fun i => - ∀ t : Fin B.length, A.length + i ≤ t.val → - G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) - have htail : 1 ≤ tailB := by dsimp [tailB]; omega - have htailT : 1 ≤ ell := by dsimp [ell]; omega - have htmem : ell ∈ candidatesT := by - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htailT, le_rfl⟩, ?_⟩ - intro t ht - have hAT := AToT.1 - have := t.isLt - dsimp [ell] at ht - omega - have hbmem : tailB ∈ candidatesB := by - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htail, le_rfl⟩, ?_⟩ - intro t ht - have := t.isLt - dsimp [tailB] at ht + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB + aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase + hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA + positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB + HS j + refine Fin.cases ?_ (fun i => ?_) j + · change TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) = TreeMissingColors phi Tn + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := + hsbase.symm.trans hbbase + rw [htree, treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA)] + · exact treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ)) + +private theorem helper_firstLe_1215.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), + eta ∈ MissingColors G psi (B.vertex i) → + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib hAib B psi eta i hc + clear * - psi eta i hc + let candidates := Finset.univ.filter fun j => eta ∈ MissingColors G psi (B.vertex j) + have hi : i ∈ candidates := by simp [candidates, hc] + have hn : candidates.Nonempty := ⟨i, hi⟩ + simpa [HierarchyFirstMissingPosition, candidates, hn] using + (show (candidates.min' hn).val ≤ i.val from Finset.min'_le candidates i hi) + +private theorem helper_firstStrict_1224.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (psi : PartialEdgeColoring E k) (eta : Fin k), + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta)) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib hAib B psi eta h + clear * - psi eta h + unfold HierarchyFirstMissingPosition at h ⊢ + dsimp only at h ⊢ + split_ifs with hn + · exact (Finset.mem_filter.mp (Finset.min'_mem _ hn)).2 + · simp only [dite_eq_right hn, Fin.val_last] at h omega - have hnT : candidatesT.Nonempty := ⟨ell, htmem⟩ - have hnB : candidatesB.Nonempty := ⟨tailB, hbmem⟩ - have hmT := Finset.min'_mem candidatesT hnT - have hbounds := Finset.mem_Icc.mp (Finset.mem_filter.mp hmT).1 - have hminB : candidatesB.min' hnB ≤ candidatesT.min' hnT := by - by_cases ht : candidatesT.min' hnT ≤ tailB - · apply Finset.min'_le - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hbounds.1, ht⟩, ?_⟩ - intro t hpos - have he := (Finset.mem_filter.mp hmT).2 (Fin.castLE BToT.1 t) hpos - have hv0 := BToT.2.1 t.castSucc - have hv1 := BToT.2.1 t.succ - have hi0 : (Fin.castLE BToT.1 t).castSucc = - Fin.castLE (Nat.succ_le_succ BToT.1) t.castSucc := Fin.ext rfl - have hi1 : (Fin.castLE BToT.1 t).succ = - Fin.castLE (Nat.succ_le_succ BToT.1) t.succ := Fin.ext rfl - simpa only [BToT.2.2, hi0, hi1, hv0, hv1] using he - · exact le_trans (Finset.min'_le candidatesB tailB hbmem) (by omega) - unfold HierarchyPathNumber - rw [hstarLast] - change (if h : candidatesB.Nonempty then candidatesB.min' h else tailB) ≤ - (if h : candidatesT.Nonempty then candidatesT.min' h else ell) - rw [dite_eq_left hnB, dite_eq_left hnT] - exact hminB -private theorem helper_hinter_3502.{u_1, u_2} : +private theorem helper_firstEq_1234.{u_1, u_2} : open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - IsProperEdgeColoring G phi → - IsOneEdgeUncolored phi e0 → - LowerRoundInductionHypothesis G k e0 ett.rounds → - (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} - {generating' : PartialEdgeColoring E k} - (other : ExtendedTashkinovTree G k e0 input' T' generating'), - other.rounds = ett.rounds → - MaximumProperty other → - ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') - (_ : GoodHierarchy K), - K.dividerCount < C.hierarchy.dividerCount → - ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → - (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → - ∀ (alpha beta : Fin k), - alpha ≠ beta → - ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (alpha beta : Fin k) + (_ : Fin (C.hierarchy.dividerCount + (1 : ℕ))), let H : TashkinovHierarchy ett base := C.hierarchy; - let R : TreeSequence G e0 := HierarchyStarredStage H r; - (0 : ℕ) < H.dividerCount → - (↑r : ℕ) < H.dividerCount → - TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - ((↑r : ℕ) = (0 : ℕ) → R = base.core) → - ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → - alpha ∈ TreeMissingColors phi R → - TreeInterchangeable G R phi alpha beta := by + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; + let vb : V := T.vertex ib; + ∀ (hAib : A.length < (↑ib : ℕ)), + let B : TreeSequence G e0 := + TreeSequencePrefix T (↑ib : ℕ) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + let sigma : PartialEdgeColoring E k := + TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ v ∈ TreeSequenceVertexSet B, + v ≠ vb → MissingColors G sigma v = MissingColors G phi v) → + (∀ (psi : PartialEdgeColoring E k) (eta : Fin k) (i : Fin (B.length + (1 : ℕ))), + eta ∈ MissingColors G psi (B.vertex i) → + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) ≤ (↑i : ℕ)) → + (∀ (psi : PartialEdgeColoring E k) (eta : Fin k), + (↑(HierarchyFirstMissingPosition psi B eta) : ℕ) < B.length → + eta ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B eta))) → + ∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = HierarchyFirstMissingPosition phi B eta := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge alpha beta - hne r H R hq hrq hclosed n Tn Dn rZero rPositive halphaR - by_cases hz : r.val = 0 - · rw [rZero hz] - by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE - · exact helper_branch_561 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) - (@hone) (@hlower) (@alpha) (@beta) (@r) (@hclosed) (@rZero) (@halphaR) (@hz) (@hp) - · exact helper_branch_568 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) - (@hone) (@hlower) (@alpha) (@beta) (@r) (@rZero) (@halphaR) (@hz) (@hp) - · exact helper_branch_650 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) - (@hone) (@hlower) (@hfewer) (@hlarge) (@alpha) (@beta) (@hne) (@r) (@hrq) (@hclosed) - (@rPositive) (@halphaR) (@hz) + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B BToT sigma + missingBefore firstLe firstStrict eta + clear * - eta B BToT ib missingBefore firstLe firstStrict + have beforeLast (i : Fin (B.length + 1)) (hi : i.val < B.length) : + MissingColors G sigma (B.vertex i) = MissingColors G phi (B.vertex i) := by + apply missingBefore + · simp [TreeSequenceVertexSet] + · intro he + have heT := (BToT.2.1 i).trans he + have heval := congrArg Fin.val (T.vertex_injective heT) + have hbLen : B.length = ib.val := rfl + change i.val = ib.val at heval + omega + apply Fin.ext + apply Nat.le_antisymm + · by_cases h : (HierarchyFirstMissingPosition phi B eta).val < B.length + · apply firstLe sigma eta + rw [beforeLast _ h] + exact firstStrict phi eta h + · have := (HierarchyFirstMissingPosition sigma B eta).isLt + omega + · by_cases h : (HierarchyFirstMissingPosition sigma B eta).val < B.length + · apply firstLe phi eta + rw [← beforeLast _ h] + exact firstStrict sigma eta h + · have := (HierarchyFirstMissingPosition phi B eta).isLt + omega -private theorem helper_hstarLast_3855.{u_1, u_2} : +private theorem helper_segmentEq_1261.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -5475,6 +3118,7 @@ private theorem helper_hstarLast_3855.{u_1, u_2} : generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); + (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) @@ -5506,20 +3150,7 @@ private theorem helper_hstarLast_3855.{u_1, u_2} : TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) (hbcore : TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (hcountB : - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount = - H.dividerCount), + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), (∀ (j : Fin @@ -5534,23 +3165,9 @@ private theorem helper_hstarLast_3855.{u_1, u_2} : belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } baseB }.dividerCount + - (1 : ℕ))), - have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc = - H.stage jo.castSucc ∧ - HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, + (2 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, nested := hbnested, strict := hbstrict, dividerPosition := positions, dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, @@ -5560,9 +3177,9 @@ private theorem helper_hstarLast_3855.{u_1, u_2} : abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB } - j = - HierarchyStarredStage H jo) → + baseB }.stage + j) + B) → ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) (hsincreasing : @@ -5599,146 +3216,28 @@ private theorem helper_hstarLast_3855.{u_1, u_2} : coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; (∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - HierarchyStarredStage HS (Fin.last count) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested - hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - exact helper_hstarLast_1371 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) - (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) - -private theorem helper_pathLe_3869.{u_1, u_2} : - helperPathLe3869Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb AToT hAib B BToT - ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - exact helper_pathLe_1383 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@AToT) - (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) - (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) - (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) - -private theorem helper_storedEq_5179.{u_1, u_2} : - helperStoredEq5179Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - exact helper_storedEq_1197 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) - (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) - (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) - -private theorem helper_segmentEq_5215.{u_1, u_2} : - helperSegmentEq5215Conditions.{u_1, u_2} := by + (∀ (eta : Fin k), + HierarchyFirstMissingPosition sigma B eta = + HierarchyFirstMissingPosition phi B eta) → + ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), + HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by classical intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq firstEq j eta - exact helper_segmentEq_1261 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) - (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) - -private theorem helper_refreshEq_5225.{u_1, u_2} : - helperRefreshEq5225Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact helper_refreshEq_1273 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) - (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@i) - -private theorem helper_hstarLast_5324.{u_1, u_2} : - helperHstarLast5324Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested - hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - exact helper_hstarLast_3855 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) - (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) - -private theorem helper_missingEq_5953.{u_1, u_2} : - helperMissingEq5953Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - exact helper_missingEq_1204 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) - (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) - (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) - (@stageBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) - (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@j) - -private theorem helper_pathLe_6085.{u_1, u_2} : - helperPathLe6085Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb AToT hAib B BToT - ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - exact helper_pathLe_3869 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@AToT) - (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) - (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) - (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) - -private theorem helper_parallelBase_6126.{u_1, u_2} : - helperParallelBase6126Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A n Tn ib vb TnToA coreToR - hAib B rpB aboveB strictB belowB genB baseB hcoreB ettB sigma treeMissingEq corr baseS - closureBToA minusEq count stages hbbase hbterminal hbnested hbstrict positions hbpositive - hbincreasing hbdivider hbcore goodB hcore hpe hclosure positionsS hspositive hsincreasing - hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS storedEq - dsimp only - intro hp - have hpOld := hpe.mpr hp - have hc := hclosure hpOld - have htree : corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc = Tn := hsbase.symm.trans hbbase - change ¬TreeColorSetMinusClosed G sigma baseS.core - ((HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)) ∧ - 4 ≤ ((TreeMissingColors sigma (corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) ∩ - TreeMissingColors sigma baseS.closure) \ - (HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)).card - rw [← hcore, ← hc, storedEq, htree, - treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA), - treeMissingEq _ (closureBToA hpOld), - minusEq _ (by rw [hcoreB]; exact TreeSequenceInitialSegmentVertexSetSubset coreToR)] - exact goodB.parallelBase hpOld + clear * - j eta starEq firstEq edgesFixed stageBToB + have hedge (t : Fin (stages j.succ).length) : + sigma ((stages j.succ).edge t) = phi ((stages j.succ).edge t) := by + have hSB := stageBToB j.succ + have hf := edgesFixed (Fin.castLE hSB.1 t) + rw [hSB.2.2] at hf + exact hf + unfold HierarchySegmentColors + simp only [starEq, firstEq eta, HS, HB, hedge] -private theorem helper_segmentEq_6319.{u_1, u_2} : +private theorem helper_refreshEq_1273.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -5754,31 +3253,22 @@ private theorem helper_segmentEq_6319.{u_1, u_2} : ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) - (by - omega) - (by - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) (aboveB : TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) (strictB : - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) (belowB : - TreeSequenceInitialSegment B - (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) (baseB : HierarchyBase - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } @@ -5789,18 +3279,18 @@ private theorem helper_segmentEq_6319.{u_1, u_2} : generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (_ : ∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) (hbbase : stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree (Fin.last - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) @@ -5817,49 +3307,41 @@ private theorem helper_segmentEq_6319.{u_1, u_2} : (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) (hbdivider : ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) (hbcore : TreeSequenceInitialSegment baseB.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))) - (_ : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), + (∀ + (j : + Fin ({ dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, nested := hbnested, strict := hbstrict, dividerPosition := positions, dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + baseB }.dividerCount + + (1 : ℕ))), + TreeSequenceInitialSegment + ({ dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.stage + j.castSucc) + A) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) (hsincreasing : ∀ (i j : Fin count), @@ -5876,18 +3358,11 @@ private theorem helper_segmentEq_6319.{u_1, u_2} : ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) (hsdivider : ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) (hscore : TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))), + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), let HB : TashkinovHierarchy ettB baseB := { dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, nested := hbnested, strict := hbstrict, @@ -5900,30 +3375,28 @@ private theorem helper_segmentEq_6319.{u_1, u_2} : dividerPosition := positionsS, dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (_ : - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (_ : - ∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = - HierarchyFirstMissingPosition phi B eta) - (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + ∀ (i : Fin count), + ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G sigma v) = + (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v := by classical intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - exact helper_segmentEq_5215 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) - (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) + strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal + hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i + clear * - i starEq missingA stageBToA + rw [starEq] + apply Finset.biUnion_congr rfl + intro v hv + exact missingA v (TreeSequenceInitialSegmentVertexSetSubset (stageBToA i.succ) + (Finset.mem_sdiff.mp hv).1) -private theorem helper_missingEq_6484.{u_1, u_2} : +private theorem helper_hstarLast_1371.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -5934,38 +3407,28 @@ private theorem helper_missingEq_6484.{u_1, u_2} : let H : TashkinovHierarchy ett base := C.hierarchy; let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; - ∀ (_ : TreeSequenceInitialSegment Tn A) (hAib : A.length < (↑ib : ℕ)), + ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) - (by - omega) - (by - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + ∀ (rpB : (1 : ℕ) ≤ ett.1) (aboveB : TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) (strictB : - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) (belowB : - TreeSequenceInitialSegment B - (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)) (baseB : HierarchyBase - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } @@ -5976,22 +3439,17 @@ private theorem helper_missingEq_6484.{u_1, u_2} : generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (_ : - ∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) (hbbase : stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree (Fin.last - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) @@ -6008,49 +3466,68 @@ private theorem helper_missingEq_6484.{u_1, u_2} : (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) (hbdivider : ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) (by omega)) (hbcore : TreeSequenceInitialSegment baseB.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))) - (_ : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) + (hcountB : + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount = + H.dividerCount), + (∀ + (j : + Fin ({ dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, nested := hbnested, strict := hbstrict, dividerPosition := positions, dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB }.dividerCount + + (1 : ℕ))), + have jo : Fin (H.dividerCount + (1 : ℕ)) := Fin.cast (by omega) j; + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } baseB }.stage - j.castSucc) - A) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) + j.castSucc = + H.stage jo.castSucc ∧ + HierarchyStarredStage + { dividerCount := count, stage := stages, baseStage := hbbase, + terminalStage := hbterminal, nested := hbnested, strict := hbstrict, + dividerPosition := positions, dividerPositive := hbpositive, + dividerIncreasing := hbincreasing, dividerStage := hbdivider, + coreInsideFirst := hbcore : + TashkinovHierarchy + { rounds := ett.1, roundsPositive := rpB, series := ett.series, + abovePenultimate := aboveB, strictAbovePenultimate := strictB, + belowFinal := belowB, generatingColoring := genB : + ExtendedTashkinovTree G k e0 input B phi } + baseB } + j = + HierarchyStarredStage H jo) → + ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) (hsincreasing : ∀ (i j : Fin count), @@ -6067,18 +3544,11 @@ private theorem helper_missingEq_6484.{u_1, u_2} : ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) (hsdivider : ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) (hscore : TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))), + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), let HB : TashkinovHierarchy ettB baseB := { dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, nested := hbnested, strict := hbstrict, @@ -6091,22 +3561,21 @@ private theorem helper_missingEq_6484.{u_1, u_2} : dividerPosition := positionsS, dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by + (∀ (j : Fin (count + (1 : ℕ))), + HierarchyStarredStage HS j = HierarchyStarredStage HB j) → + HierarchyStarredStage HS (Fin.last count) = A := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - exact helper_missingEq_5953 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) - (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) - (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@j) + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n ib vb hAib B rpB aboveB + strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested + hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq + rw [starEq] + have hs := (hstagesB (Fin.last count)).2 + have hj : Fin.cast (congrArg (fun n : ℕ => n + 1) hcountB) (Fin.last count) = q := + Fin.ext (by simp [q]) + simpa only [hj] using hs -private theorem helper_refreshEq_6699.{u_1, u_2} : +private theorem helper_pathLe_1383.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -6119,116 +3588,35 @@ private theorem helper_refreshEq_6699.{u_1, u_2} : let A : TreeSequence G e0 := HierarchyStarredStage H q; let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; let vb : V := T.vertex ib; + let _ : ℕ := T.length - A.length; + TreeSequenceInitialSegment A T → ∀ (hAib : A.length < (↑ib : ℕ)), let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) - (by - omega) - (by - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) + (have this : (1 : ℕ) ≤ A.length := A.positive; + Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) + (by omega); + TreeSequenceInitialSegment B T → + A.length < B.length → + ∀ (rpB : (1 : ℕ) ≤ ett.1) (aboveB : TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - B) + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) (strictB : - (ett.series.data.tree - (⟨ett.rounds, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))).length < + (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) (belowB : - TreeSequenceInitialSegment B - (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), + TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) + (genB : phi = ett.series.data.coloring (Fin.last ett.1)), let ettB : ExtendedTashkinovTree G k e0 input B phi := { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (_ : - ∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))) - (_ : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) (positionsS : Fin count → Fin (B.length + (1 : ℕ))) (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) (hsincreasing : @@ -6246,126 +3634,147 @@ private theorem helper_refreshEq_6699.{u_1, u_2} : ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) (hsdivider : ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) + stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = + TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) (by omega)) (hscore : TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; + (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), let HS : TashkinovHierarchy corr.replacementETT baseS := { dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, nested := hsnested, strict := hsstrict, dividerPosition := positionsS, dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (_ : - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact helper_refreshEq_5225 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) - (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@i) - -private theorem helper_storedEq_7501.{u_1, u_2} : - SharedFacts.LargestClosedTransport.storedEq7501Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - exact helper_storedEq_5179 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) - (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) - (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) - (@starBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) - -private theorem helper_segmentEq_7714.{u_1, u_2} : - helperSegmentEq7714Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - exact helper_segmentEq_6319 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) - (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@firstEq) (@j) (@eta) - -private theorem helper_missingEq_7904.{u_1, u_2} : - helperMissingEq7904Conditions.{u_1, u_2} := by + HierarchyStarredStage HS (Fin.last count) = A → + HierarchyPathNumber HS ≤ HierarchyPathNumber H := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - exact helper_missingEq_6484 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) - (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) - (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@j) + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb ell AToT hAib B BToT + ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS + hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast + clear * - HS H A T B q ell count hstarLast BToT AToT ABstrict + let tailB := B.length - A.length + let candidatesT := (Finset.Icc 1 ell).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + let candidatesB := (Finset.Icc 1 tailB).filter fun i => + ∀ t : Fin B.length, A.length + i ≤ t.val → + G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) + have htail : 1 ≤ tailB := by dsimp [tailB]; omega + have htailT : 1 ≤ ell := by dsimp [ell]; omega + have htmem : ell ∈ candidatesT := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htailT, le_rfl⟩, ?_⟩ + intro t ht + have hAT := AToT.1 + have := t.isLt + dsimp [ell] at ht + omega + have hbmem : tailB ∈ candidatesB := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨htail, le_rfl⟩, ?_⟩ + intro t ht + have := t.isLt + dsimp [tailB] at ht + omega + have hnT : candidatesT.Nonempty := ⟨ell, htmem⟩ + have hnB : candidatesB.Nonempty := ⟨tailB, hbmem⟩ + have hmT := Finset.min'_mem candidatesT hnT + have hbounds := Finset.mem_Icc.mp (Finset.mem_filter.mp hmT).1 + have hminB : candidatesB.min' hnB ≤ candidatesT.min' hnT := by + by_cases ht : candidatesT.min' hnT ≤ tailB + · apply Finset.min'_le + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨hbounds.1, ht⟩, ?_⟩ + intro t hpos + have he := (Finset.mem_filter.mp hmT).2 (Fin.castLE BToT.1 t) hpos + have hv0 := BToT.2.1 t.castSucc + have hv1 := BToT.2.1 t.succ + have hi0 : (Fin.castLE BToT.1 t).castSucc = + Fin.castLE (Nat.succ_le_succ BToT.1) t.castSucc := Fin.ext rfl + have hi1 : (Fin.castLE BToT.1 t).succ = + Fin.castLE (Nat.succ_le_succ BToT.1) t.succ := Fin.ext rfl + simpa only [BToT.2.2, hi0, hi1, hv0, hv1] using he + · exact le_trans (Finset.min'_le candidatesB tailB hbmem) (by omega) + unfold HierarchyPathNumber + rw [hstarLast] + change (if h : candidatesB.Nonempty then candidatesB.min' h else tailB) ≤ + (if h : candidatesT.Nonempty then candidatesT.min' h else ell) + rw [dite_eq_left hnB, dite_eq_left hnT] + exact hminB -private theorem helper_refreshEq_8147.{u_1, u_2} : - helperRefreshEq8147Conditions.{u_1, u_2} := by +private theorem helper_hinter_3502.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + IsProperEdgeColoring G phi → + IsOneEdgeUncolored phi e0 → + LowerRoundInductionHypothesis G k e0 ett.rounds → + (∀ {input' : PartialEdgeColoring E k} {T' : TreeSequence G e0} + {generating' : PartialEdgeColoring E k} + (other : ExtendedTashkinovTree G k e0 input' T' generating'), + other.rounds = ett.rounds → + MaximumProperty other → + ∀ (base' : HierarchyBase other generating') (K : TashkinovHierarchy other base') + (_ : GoodHierarchy K), + K.dividerCount < C.hierarchy.dividerCount → + ColoredVertexSetElementary G generating' (TreeSequenceVertexSet T')) → + (let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; + (2 : ℕ) * ett.rounds + (11 : ℕ) ≤ (TreeMissingColors phi Tn).card) → + ∀ (alpha beta : Fin k), + alpha ≠ beta → + ∀ (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), + let H : TashkinovHierarchy ett base := C.hierarchy; + let R : TreeSequence G e0 := HierarchyStarredStage H r; + (0 : ℕ) < H.dividerCount → + (↑r : ℕ) < H.dividerCount → + TreeColorSetClosed G phi R ({ alpha } : Finset (Fin k)) → + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let _ : TreeSequence G e0 := ett.series.data.tree n.castSucc; + let _ : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ((↑r : ℕ) = (0 : ℕ) → R = base.core) → + ((↑r : ℕ) ≠ (0 : ℕ) → R = H.stage r.castSucc) → + alpha ∈ TreeMissingColors phi R → + TreeInterchangeable G R phi alpha beta := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact helper_refreshEq_6699 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) - (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@starEq) (@i) + intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower hfewer hlarge alpha beta + hne r H R hq hrq hclosed n Tn Dn rZero rPositive halphaR + by_cases hz : r.val = 0 + · rw [rZero hz] + by_cases hp : ett.series.data.kind n = some TashkinovExtensionKind.PE + · exact helper_branch_561 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@alpha) (@beta) (@r) (@hclosed) (@rZero) (@halphaR) (@hz) (@hp) + · exact helper_branch_568 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@alpha) (@beta) (@r) (@rZero) (@halphaR) (@hz) (@hp) + · exact helper_branch_650 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) + (@hone) (@hlower) (@hfewer) (@hlarge) (@alpha) (@beta) (@hne) (@r) (@hrq) (@hclosed) + (@rPositive) (@halphaR) (@hz) -private theorem helper_storedEq_8334.{u_1, u_2} : - SharedFacts.LargestClosedTransport.storedEq7501Conditions.{u_1, u_2} := by +private theorem helper_parallelBase_6126.{u_1, u_2} : + helperParallelBase6126Conditions.{u_1, u_2} := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - exact helper_storedEq_7501 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) - (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) - (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) - (@starBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta r H R q A n Tn ib vb TnToA coreToR + hAib B rpB aboveB strictB belowB genB baseB hcoreB ettB sigma treeMissingEq corr baseS + closureBToA minusEq count stages hbbase hbterminal hbnested hbstrict positions hbpositive + hbincreasing hbdivider hbcore goodB hcore hpe hclosure positionsS hspositive hsincreasing + hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS storedEq + dsimp only + intro hp + have hpOld := hpe.mpr hp + have hc := hclosure hpOld + have htree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := hsbase.symm.trans hbbase + change ¬TreeColorSetMinusClosed G sigma baseS.core + ((HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)) ∧ + 4 ≤ ((TreeMissingColors sigma (corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc) ∩ + TreeMissingColors sigma baseS.closure) \ + (HierarchyStoredColorsAt HS 0).biUnion (goodB.gamma 0)).card + rw [← hcore, ← hc, storedEq, htree, + treeMissingEq _ (TreeSequenceInitialSegmentVertexSetSubset TnToA), + treeMissingEq _ (closureBToA hpOld), + minusEq _ (by rw [hcoreB]; exact TreeSequenceInitialSegmentVertexSetSubset coreToR)] + exact goodB.parallelBase hpOld private theorem helper_continuation_5082.{u_1, u_2} : helperContinuation5082Conditions.{u_1, u_2} := by @@ -6387,14 +3796,14 @@ private theorem helper_continuation_5082.{u_1, u_2} : clear * - hstagesB starredToA j rw [(hstagesB j).2] exact starredToA _ - have stageBToB := - helper_stageBToB_1145 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@r) (@segRefl) (@segTrans) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) - (@baseB) (@HB) - have closureBToA := - helper_closureBToA_1152 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@alpha) (@beta) (@r) (@coreToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) - (@baseB) (@hcoreB) + have stageBToB := HB.stageInitialSegment + have closureBToA (parallel : ett.series.data.kind (Fin.last ett.rounds) = + some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet A := by + have coreBToA : TreeSequenceInitialSegment baseB.core A := by + rw [hcoreB] + exact coreToA + exact (baseB.closure_vertexSet_subset_core parallel).trans coreBToA.vertexSet_subset have minusEq := helper_minusEq_1160 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@RToA) @@ -6419,14 +3828,14 @@ private theorem helper_continuation_5082.{u_1, u_2} : exact Fin.cases hcore.symm (fun i => rfl) j have storedEq (j : Fin (count + 1)) : HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - exact helper_storedEq_8334 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact helper_storedEq_1197 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) have missingEq := - helper_missingEq_7904 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + helper_missingEq_1204 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) @@ -6445,7 +3854,7 @@ private theorem helper_continuation_5082.{u_1, u_2} : (@BToT) (@missingBefore) (@firstLe) (@firstStrict) have segmentEq (j : Fin (count + 1)) (eta : Fin k) (he : eta ∈ HierarchyStoredColorsAt HB j) := - helper_segmentEq_7714 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + helper_segmentEq_1261 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) @@ -6458,7 +3867,7 @@ private theorem helper_continuation_5082.{u_1, u_2} : ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion fun v => MissingColors G phi v) := by - exact helper_refreshEq_8147 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact helper_refreshEq_1273 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) @@ -6540,7 +3949,7 @@ private theorem helper_continuation_5082.{u_1, u_2} : maximum := hMPS notElementary := sigmaNotElementary } have hstarLast := - helper_hstarLast_5324 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + helper_hstarLast_1371 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) @@ -6553,7 +3962,7 @@ private theorem helper_continuation_5082.{u_1, u_2} : simpa only [hj] using hs -- Path candidates restrict to the shorter prefix; the second measure decreases strictly. have pathLe := - helper_pathLe_6085 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + helper_pathLe_1383 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@r) (@AToT) (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean index c0809bc751..fc9d423584 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedNoClosed.lean @@ -695,81 +695,6 @@ private abbrev helperContinuation2989Conditions.{u_1, u_2} : Prop := TwoColorComponent G phi alpha beta (Sum.inl vb); sameComponent -private abbrev helperPathLe3336Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment A T → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - TreeSequenceInitialSegment B T → - A.length < B.length → - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < B.length) - (belowB : TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, coreInsideFirst := hscore : - TashkinovHierarchy corr.replacementETT baseS }; - HierarchyStarredStage HS (Fin.last count) = A → - HierarchyPathNumber HS ≤ HierarchyPathNumber H - private abbrev helperHless4484Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] @@ -2003,919 +1928,6 @@ private theorem helper_minusEq_845.{u_1, u_2} : exact ⟨fun hs c hc => (boundaryEq c hc).symm.trans (hs c hc), fun hs c hc => (boundaryEq c hc).trans (hs c hc)⟩ -private theorem helper_storedEq_3219.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn → - ∀ (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - exact SharedFacts.MixedChangeTransport.storedColorsEquality (@G) (@k) (@e0) (@input) (@T) - (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@hAib) (@rpB) - (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) - (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) - (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) - -private theorem helper_missingEq_3228.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - TreeSequenceInitialSegment Tn A → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Tn ib vb TnToA hAib B rpB - aboveB strictB belowB genB baseB ettB sigma treeMissingEq corr baseS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS j - exact SharedFacts.MixedChangeTransport.missingColorsEquality (@G) (@k) (@e0) (@input) (@T) - (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@TnToA) - (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) - (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) - (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) - (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) - (@hsdivider) (@hscore) (@j) - -private theorem helper_segmentEq_3255.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ (t : Fin B.length), sigma (B.edge t) = phi (B.edge t)) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (2 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j) - B) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - (∀ (eta : Fin k), - HierarchyFirstMissingPosition sigma B eta = - HierarchyFirstMissingPosition phi B eta) → - ∀ (j : Fin (count + (1 : ℕ))) (eta : Fin k), - HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma edgesFixed corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - firstEq j eta - exact SharedFacts.MixedChangeTransport.initialSegmentEquality (@G) (@k) (@e0) (@input) (@T) - (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@hAib) (@rpB) - (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) (@baseS) (@count) - (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) - (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) (@positionsS) (@hspositive) - (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) - (@starEq) (@firstEq) (@j) (@eta) - -private theorem helper_refreshEq_3265.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - (∀ v ∈ TreeSequenceVertexSet A, MissingColors G sigma v = MissingColors G phi v) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc) - A) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - ∀ (i : Fin count), - ((TreeSequenceVertexSet (HS.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HS i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) = - (TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma missingA corr baseS count stages hbbase hbterminal - hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore stageBToA positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq i - exact SharedFacts.MixedChangeTransport.refreshedHierarchyEquality (@G) (@k) (@e0) (@input) - (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@hAib) (@rpB) - (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) (@baseS) (@count) - (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) - (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) (@positionsS) (@hspositive) - (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) - (@starEq) (@i) - -private theorem helper_hstarLast_3322.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.1, by omega⟩ : Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) (count : ℕ) - (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (hcountB : - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount = - H.dividerCount), - (∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.stage - j.castSucc = - H.stage - (Fin.cast - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega) - j).castSucc ∧ - HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j = - HierarchyStarredStage H - (Fin.cast - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega) - j)) → - ∀ (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - have := GoldbergSeymour.TreeSequence.positive B - omega)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - (∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) → - HierarchyStarredStage HS (Fin.last count) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma corr baseS count stages hbbase hbterminal hbnested - hbstrict positions hbpositive hbincreasing hbdivider hbcore hcountB hstagesB positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq - exact SharedFacts.MixedChangeTransport.lastStarredStageEquality (@G) (@k) (@e0) (@input) - (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) - (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) - (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) - (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) (@hspositive) - (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) - (@starEq) - -private theorem helper_pathLe_3336.{u_1, u_2} : - helperPathLe3336Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A ib vb AToT hAib B BToT - ABstrict rpB aboveB strictB belowB genB ettB sigma corr baseS count stages positionsS - hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HS hstarLast - exact SharedFacts.MixedChangeTransport.pathLengthUpperBound (@G) (@k) (@e0) (@input) (@T) - (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@AToT) (@hAib) - (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) - (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) - (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) - private theorem helper_hless_4484.{u_1, u_2} : helperHless4484Conditions.{u_1, u_2} := by classical @@ -2945,7 +1957,8 @@ private theorem helper_continuation_4887.{u_1, u_2} : hsbase hsterminal hsnested hsstrict hsdivider hscore HB HS starEq storedEq have missingEq (j : Fin (count + 1)) : HierarchyStageMissingColors HS j = HierarchyStageMissingColors HB j := by - exact helper_missingEq_3228 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact GoldbergSeymour.SharedFacts.MixedChangeTransport.missingColorsEquality (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@TnToA) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) @@ -2975,7 +1988,8 @@ private theorem helper_continuation_4887.{u_1, u_2} : have segmentEq (j : Fin (count + 1)) (eta : Fin k) (he : eta ∈ HierarchyStoredColorsAt HB j) : HierarchySegmentColors HS j eta = HierarchySegmentColors HB j eta := by - exact helper_segmentEq_3255 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact GoldbergSeymour.SharedFacts.MixedChangeTransport.initialSegmentEquality (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@edgesFixed) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToB) @@ -2988,7 +2002,8 @@ private theorem helper_continuation_4887.{u_1, u_2} : ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion fun v => MissingColors G phi v) := by - exact helper_refreshEq_3265 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact GoldbergSeymour.SharedFacts.MixedChangeTransport.refreshedHierarchyEquality (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@missingA) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@stageBToA) @@ -3021,7 +2036,8 @@ private theorem helper_continuation_4887.{u_1, u_2} : maximum := hMPS notElementary := sigmaNotElementary } have hstarLast : HierarchyStarredStage HS (Fin.last count) = A := by - exact helper_hstarLast_3322 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact GoldbergSeymour.SharedFacts.MixedChangeTransport.lastStarredStageEquality (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@corr) (@baseS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@hcountB) (@hstagesB) (@positionsS) @@ -3034,7 +2050,8 @@ private theorem helper_continuation_4887.{u_1, u_2} : simpa only [hj] using hs -- Path candidates restrict to the shorter prefix; the second measure decreases strictly. have pathLe : HierarchyPathNumber HS ≤ HierarchyPathNumber H := by - exact helper_pathLe_3336 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) + exact GoldbergSeymour.SharedFacts.MixedChangeTransport.pathLengthUpperBound (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@AToT) (@hAib) (@BToT) (@ABstrict) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@corr) (@baseS) (@count) (@stages) (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) (@hsstrict) (@hsdivider) (@hscore) (@hstarLast) @@ -3049,196 +2066,6 @@ private theorem helper_continuation_4887.{u_1, u_2} : apply helper_hless_4484 <;> assumption exact hminimal CS hrS hcountB hless -private theorem helper_storedEq_5399.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := - TreeSequencePrefix T (↑ib : ℕ) - (have this : (1 : ℕ) ≤ A.length := A.positive; - Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ (↑ib : ℕ)) ↦ by - omega) - (Nat.le_of_lt_succ ib.isLt); - ∀ (rpB : (1 : ℕ) ≤ ett.1) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨ett.1, by - omega⟩ : - Fin (ett.1 + (2 : ℕ)))) - B) - (strictB : - (ett.series.data.tree - (⟨ett.1, by - omega⟩ : - Fin (ett.1 + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.1 + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.1)) - (baseB : - HierarchyBase - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := - TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (_ : - ∀ (S : TreeSequence G e0) (_ : TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A), - TreeMissingColors sigma S = TreeMissingColors phi S) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) - (_ : - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - Dn) - (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))) - (_ : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { rounds := ett.1, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), - (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages - (⟨(1 : ℕ), by - omega⟩ : - Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { dividerCount := count, stage := stages, baseStage := hsbase, - terminalStage := hsterminal, nested := hsnested, strict := hsstrict, - dividerPosition := positionsS, dividerPositive := hspositive, - dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (_ : - ∀ (j : Fin (count + (1 : ℕ))), - HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta H q A n Dn ib vb hAib B rpB aboveB - strictB belowB genB baseB ettB sigma treeMissingEq corr baseS storedS count stages hbbase - hbterminal hbnested hbstrict positions hbpositive hbincreasing hbdivider hbcore starBToA - positionsS hspositive hsincreasing hsbase hsterminal hsnested hsstrict hsdivider hscore HB - HS starEq j - exact helper_storedEq_3219 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) - (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) - (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) - (@hbstrict) (@positions) (@hbpositive) (@hbincreasing) (@hbdivider) (@hbcore) (@starBToA) - (@positionsS) (@hspositive) (@hsincreasing) (@hsbase) (@hsterminal) (@hsnested) - (@hsstrict) (@hsdivider) (@hscore) (@starEq) (@j) - private theorem helper_continuation_5697.{u_1, u_2} : helperContinuation5697Conditions.{u_1, u_2} := by classical @@ -3339,7 +2166,8 @@ private theorem helper_continuation_5697.{u_1, u_2} : exact Fin.cases hcore.symm (fun i => rfl) j have storedEq (j : Fin (count + 1)) : HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j := by - exact @helper_storedEq_5399 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @GoldbergSeymour.SharedFacts.MixedChangeTransport.storedColorsEquality (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@alpha) (@beta) (@hAib) (@rpB) (@aboveB) (@strictB) (@belowB) (@genB) (@baseB) (@treeMissingEq) (@corr) (@baseS) (@storedS) (@count) (@stages) (@hbbase) (@hbterminal) (@hbnested) (@hbstrict) diff --git a/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean b/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean index 20e72da19e..0a92055e80 100644 --- a/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean +++ b/LeanPool/GoldbergSeymour/ChangeLemmaMixedZeroNonclosed.lean @@ -1989,131 +1989,6 @@ private theorem helper_pathLE_1072.{u_1, u_2} : · exact le_trans (Finset.min'_le newCandidates ellB hnewMem) (Nat.le_of_lt (Nat.lt_of_not_ge hr)) -private theorem helper_hcombined_1980.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - IsProperEdgeColoring G phi → IsOneEdgeUncolored phi e0 → LowerRoundInductionHypothesis G k - e0 ett.rounds → - ∀ (alpha beta : Fin k), ( - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; H.dividerCount = (0 : ℕ) ∧ - ¬TreeColorSetClosed G phi A ({ alpha } : Finset (Fin k)) ∧ (alpha ∈ TreeMissingColors phi - Tn ∨ Disjoint (insert alpha ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn)) → - let A : TreeSequence G e0 := base.core; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let va : V := T.vertex ia; - let vb : V := T.vertex ib; - let Ty : TreeSequence G e0 := TreeSequencePrefix T (min (A.length + (T.length - A.length - (1 - : ℕ))) T.length) ( - have this : (1 : ℕ) ≤ A.length := A.positive; - have this_1 : (1 : ℕ) ≤ T.length := T.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ - min (A.length + (T.length - A.length - (1 : ℕ))) T.length) ↦ - by omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - omega - ); (alpha ∈ MissingColors G phi (T.vertex (HierarchyFirstMissingPosition phi T alpha)) ∧ - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ Ty.length ∧ - ∀ (j : Fin (T.length + (1 : ℕ))), alpha ∈ MissingColors G phi (T.vertex j) → - (↑(HierarchyFirstMissingPosition phi T alpha) : ℕ) ≤ (↑j : ℕ)) → ett.series.data.kind n = - some TashkinovExtensionKind.PE → TreeSequenceInitialSegment Tn A → TreeSequenceVertexSet - base.closure ⊆ TreeSequenceVertexSet A → CombinedStableColoring Tn base.closure Dn phi phi - → va ∈ TreeSequenceVertexSet Tn ∧ va ∉ TreeSequenceVertexSet base.closure ∨ va ∈ - TreeSequenceVertexSet base.closure ∧ va ∉ TreeSequenceVertexSet Tn → - let root : V ⊕ E := Sum.inl vb; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; - let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; ( - ∀ (X : TreeSequence G e0), TreeSequenceVertexSet X ⊆ TreeSequenceVertexSet A → va ∉ - TreeSequenceVertexSet X → alpha ∉ TreeMissingColors phi X ∧ beta ∉ TreeMissingColors phi - X) → ( - ∀ (X : TreeSequence G e0) (D : Finset (Fin k)), alpha ∉ TreeMissingColors phi X → beta ∉ - TreeMissingColors phi X → alpha ∉ D → beta ∉ D → StableColoring X D phi sigma) → ( - ∀ (X : TreeSequence G e0) (D : Finset (Fin k)), ( - ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ component) → StableColoring X D phi sigma) → ( - ∀ (X : TreeSequence G e0), va ∈ TreeSequenceVertexSet X → TreeInterchangeable G X phi alpha - beta → - ∀ v ∈ TreeSequenceVertexSet X, Sum.inl v ∉ component) → CombinedStableColoring Tn base.closure - Dn phi sigma := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hproper hone hlower alpha beta hbranch A n Tn - Dn ia ib va vb Ty ha terminalPE hTnA hRA hidentity hsplit root sigma component noMissing - stableNoMissing stableOutside outsideFromInterchange - exact helper_hcombined_604 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) - (@hone) (@hlower) (@alpha) (@beta) (@hbranch) (@ha) (@terminalPE) (@hTnA) (@hRA) - (@hidentity) (@hsplit) (@noMissing) (@stableNoMissing) (@stableOutside) - (@outsideFromInterchange) - -private theorem helper_hnotMinus_2199.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (_ : HierarchyCounterexample base), - LowerRoundInductionHypothesis G k e0 ett.rounds → - ∀ (alpha beta : Fin k), - let A : TreeSequence G e0 := base.core; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ia : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T alpha; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let va : V := T.vertex ia; - let vb : V := T.vertex ib; va ∈ TreeSequenceVertexSet A → beta ∉ TreeMissingColors phi A → - alpha ∈ TreeMissingColors phi A → ett.series.data.kind n = some TashkinovExtensionKind.PE - → TwoColorPathComponent G phi alpha beta (Sum.inl va) → TwoColorPathComponent G phi alpha - beta (Sum.inl vb) → ¬TwoColorComponent G phi alpha beta (Sum.inl va) = TwoColorComponent G - phi alpha beta (Sum.inl vb) → - let root : V ⊕ E := Sum.inl vb; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta root; - let component : Set (V ⊕ E) := TwoColorComponent G phi alpha beta root; IsProperEdgeColoring G - sigma → IsOneEdgeUncolored sigma e0 → ( - ∀ (f : E) (v : V), Incident G v f → phi f = some alpha ∨ phi f = some beta → Sum.inr f ∈ - component → Sum.inl v ∈ component) → TwoColorIncidenceGraph G sigma alpha beta = - TwoColorIncidenceGraph G phi alpha beta → ( - ∀ (z : V ⊕ E), TwoColorComponent G sigma alpha beta z = TwoColorComponent G phi alpha beta z) - → CombinedStableColoring Tn base.closure Dn phi sigma → - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) ( - have this : (1 : ℕ) ≤ A.length := A.positive; Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ - (↑ib : ℕ)) ↦ - by omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); TreeMissingColors sigma A = TreeMissingColors phi A → - ∀ (ettB : ExtendedTashkinovTree G k e0 input B phi) (baseB : HierarchyBase ettB phi), - baseB.core = base.core → - ∀ (HB : TashkinovHierarchy ettB baseB) (goodB : GoodHierarchy HB), ettB.series.data.tree - (Fin.last ettB.rounds).castSucc = Tn ∧ TashkinovStoredColors ettB.series.data (Fin.last - ettB.rounds) = Dn ∧ ettB.series.data.kind (Fin.last ettB.rounds) = some - TashkinovExtensionKind.PE → - let reserved : Finset (Fin k) := (HierarchyStoredColorsAt HB (0 : Fin (HB.dividerCount + (1 : - ℕ)))).biUnion (goodB.gamma (0 : Fin (HB.dividerCount + (1 : ℕ)))); - ¬TreeColorSetMinusClosed G sigma A reserved := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C hlower alpha beta A n Tn Dn ia ib va vb hvaA - hbetaA halphaA terminalPE hpathA hpathB hdistinct root sigma component hsProper hsOne - edgeVertex hgraph hcomponents hcombined hAib B hmissingTreeA ettB baseB hcoreB HB goodB - hBdata reserved - exact helper_hnotMinus_969 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hlower) - (@alpha) (@beta) (@hvaA) (@hbetaA) (@halphaA) (@terminalPE) (@hpathA) (@hpathB) - (@hdistinct) (@hsProper) (@hsOne) (@edgeVertex) (@hgraph) (@hcomponents) (@hcombined) - (@hAib) (@hmissingTreeA) (@ettB) (@baseB) (@hcoreB) (@HB) (@goodB) (@hBdata) - private theorem helper_continuation_2160.{u_1, u_2} : helperContinuation2160Conditions.{u_1, u_2} := by classical @@ -2203,7 +2078,7 @@ private theorem helper_continuation_2160.{u_1, u_2} : (@hcoreNew) (@halphaNotStored) (@hfirstEq) (@hnextHB) (@hnextK) (@eta) (@heta) let reserved := (HierarchyStoredColorsAt HB 0).biUnion (goodB.gamma 0) have hnotMinus : ¬ TreeColorSetMinusClosed G sigma A reserved := by - exact helper_hnotMinus_2199 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact helper_hnotMinus_969 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hlower) (@alpha) (@beta) (@hvaA) (@hbetaA) (@halphaA) (@terminalPE) (@hpathA) (@hpathB) (@hdistinct) (@hsProper) (@hsOne) (@edgeVertex) (@hgraph) (@hcomponents) (@hcombined) (@hAib) (@hmissingTreeA) (@ettB) (@baseB) (@hcoreB) (@HB) (@goodB) (@hBdata) @@ -2431,7 +2306,7 @@ private theorem helper_caseContinuation_2060.{u_1, u_2} : exact hdistinct (hinter (Sum.inl va) root hpathA hpathB ⟨va, hva, by change _ = _; rfl⟩ ⟨v, hv, hvc⟩) have hcombined : CombinedStableColoring Tn base.closure Dn phi sigma := by - exact helper_hcombined_1980 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact helper_hcombined_604 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@hproper) (@hone) (@hlower) (@alpha) (@beta) (@hbranch) (@ha) (@terminalPE) (@hTnA) (@hRA) (@hidentity) (@hsplit) (@noMissing) (@stableNoMissing) (@stableOutside) (@outsideFromInterchange) diff --git a/LeanPool/GoldbergSeymour/ETTFirstAppearanceIndex.lean b/LeanPool/GoldbergSeymour/ETTFirstAppearanceIndex.lean index 0e8f02fc3d..d274584ece 100644 --- a/LeanPool/GoldbergSeymour/ETTFirstAppearanceIndex.lean +++ b/LeanPool/GoldbergSeymour/ETTFirstAppearanceIndex.lean @@ -39,6 +39,30 @@ noncomputable def ETTFirstAppearanceIndex {V E : Type*} [Fintype V] [Fintype E] exact hv exact (candidates.min' ⟨Fin.last ett.rounds, hlast⟩).val + 1 +/-- A vertex already present in a nonterminal ladder stage appears no later than that stage. -/ +theorem ETTFirstAppearanceIndex.le_of_series_mem {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input generating : PartialEdgeColoring E k} + {tree : TreeSequence G e0} (ett : ExtendedTashkinovTree G k e0 input tree generating) + (vertex : V) (member : vertex ∈ TreeSequenceVertexSet tree) (index : Fin ett.rounds) + (stageMember : vertex ∈ TreeSequenceVertexSet (ett.series.data.tree index.succ.castSucc)) : + ETTFirstAppearanceIndex ett vertex member ≤ index.val + 1 := by + classical + unfold ETTFirstAppearanceIndex + dsimp + have candidate : index.castSucc ∈ Finset.univ.filter + (fun position : Fin (ett.rounds + 1) => + vertex ∈ TreeSequenceVertexSet (ExtendedTashkinovLadderStage ett position)) := by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + rw [show ExtendedTashkinovLadderStage ett index.castSucc = + ett.series.data.tree index.succ.castSucc by + unfold ExtendedTashkinovLadderStage + exact @Fin.lastCases_castSucc ett.rounds + (fun _ : Fin (ett.rounds + 1) => TreeSequence G e0) tree + (fun index => ett.series.data.tree index.succ.castSucc) index] + exact stageMember + exact Nat.succ_le_succ (Fin.le_iff_val_le_val.mp (Finset.min'_le _ _ candidate)) + end GoldbergSeymour end diff --git a/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean b/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean index 6fcfc592db..ae41125905 100644 --- a/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean +++ b/LeanPool/GoldbergSeymour/EligibleIndexBoundPreparation.lean @@ -2445,15 +2445,11 @@ theorem helper_terminalStored_647.{u_1, u_2} : (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last P.corresponding.replacementETT.rounds; let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; let mu : PartialEdgeColoring E k := P.coloring; - HierarchyPathNumber H = HierarchyPathNumber C.hierarchy → ∀ (hlenT : (3 : ℕ) ≤ T.length), let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) @@ -2607,7 +2603,7 @@ theorem helper_terminalStored_647.{u_1, u_2} : (Fin.last corr.replacementETT.rounds) = TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean b/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean index 2e985bc5d9..23f1724236 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseBranchLemmas.lean @@ -1345,94 +1345,6 @@ private theorem helper_hTpreviousBefore_6081.{u_1, u_2} : exact lt_of_le_of_lt (Nat.lt_succ_iff.mp i.isLt) (hpreviousStrict hjPositive) -private theorem helper_hseedBuild_6103.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (hjSlot : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) - (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := - TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) - hterminalPositionPositive hterminalPositionBound; - ∀ (_ : jSlot.castSucc.succ = jSlot.succ.castSucc) - (_ : TreeSequenceInitialSegment seed (ett.series.data.tree jSlot.succ.castSucc)) - (_ : - ∀ {A B C : TreeSequence G e0}, - TreeSequenceInitialSegment A C → - TreeSequenceInitialSegment B C → - A.length ≤ B.length → TreeSequenceInitialSegment A B) - (TjPrime : TreeSequence G e0) (hqLast : indices0 (Fin.last p0) = q), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) - (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)), - let Tprevious : TreeSequence G e0 := ett.series.data.tree jSlot.castSucc.castSucc; - ∀ (_ : (0 : ℕ) < (↑jSlot : ℕ) → Tprevious.length < seed.length) - (_ : (0 : ℕ) < (↑jSlot : ℕ) → TreeSequenceInitialSegment Tprevious seed) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (u0 : V) - (_ : - (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u0)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (_ : Fin (TjPrime.length + (1 : ℕ))) (_ : (0 : ℕ) < (↑jSlot : ℕ)) - (lower : - ExtendedTashkinovTree G k e0 input - (ett.series.data.tree - (⟨(↑jSlot : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - (ett.series.data.coloring - (⟨(↑jSlot : ℕ), by - omega⟩ : - Fin (ett.rounds + (1 : ℕ))))) - (_ : lower.rounds = (↑jSlot : ℕ)), - ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) Tprevious - seed ∨ - (ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.SE ∨ - ett.series.data.kind jSlot.castSucc = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (adjoinSeed : TreeSequence G e0), - ett.series.data.connectingEdges jSlot.castSucc = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tprevious f adjoinSeed ∧ - TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) - adjoinSeed seed := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot hjSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound seed hjTreeIndex hseedTj - commonPrefix TjPrime hqLast H x componentPath u exitPath Tprevious hpreviousStrict - hpreviousSeed zPosition u0 exitPath0 zPosition0 uPosition hjPositive lower hround - exact @helper_hseedBuild_3505 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) - (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) - (@hjSlot) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) - (@hterminalPositionPositive) (@hterminalPositionBound) (@hjTreeIndex) (@hseedTj) - (@commonPrefix) (@TjPrime) (@hqLast) (@x) (@componentPath) (@u) (@exitPath) - (@hpreviousStrict) (@hpreviousSeed) (@zPosition) (@u0) (@exitPath0) (@zPosition0) - (@uPosition) (@hjPositive) (@lower) (@hround) - private theorem helper_hLowerI_6128.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -1717,7 +1629,7 @@ theorem helper_branch_13578.{u_1, u_2} : TashkinovAugmentationSequence (ett.series.data.coloring jSlot.castSucc) adjoinSeed seed) := by - exact @helper_hseedBuild_6103 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + exact @helper_hseedBuild_3505 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) @@ -2499,327 +2411,6 @@ theorem helper_continuation_12157.{u_1, u_2} : (@rho3) (@hrho3Proper) (@hrho3One) (@hd1) (@hd2Missing) (@hd2Edges) (@hdeltaZ) (@hd2z) (@hd3) (@hu0Terminal) (@uPosition) (@huPosition) (@hseedBeforeU) (@hterminalInTj) (@hterminalInTjVal) (@hzv) (@hterminalBeforeZ) (@hzChoiceForContradiction) (@hjPositive) -private theorem helper_hcaseTwoObservationPackage_7053.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let this : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := - TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) - hterminalPositionPositive hterminalPositionBound; - let supportColors : Finset (Fin k) := - Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ - ett.series.data.stored (indices0 a).succ; - ∀ (TjPrime : TreeSequence G e0) (fN : E), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (componentPath : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) - (exitPath : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) - (_ : exitPath.IsPath) (_ : (2 : ℕ) ≤ exitPath.length) - (_ : ∀ y ∈ exitPath.support, y ∈ componentPath.support) - (_ : - ∀ - w ∈ - TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ - TreeSequenceVertexSet TjPrime, - Sum.inl w ∈ exitPath.support ↔ w = u) - (_ : - ∃ - g ∈ - BoundaryColorEdges G rho1 - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ - TreeSequenceVertexSet TjPrime) - gamma, - Incident G u g ∧ Sum.inr g ∈ exitPath.support) - (_ : ¬Incident G u fN) (_ : u ∈ TreeSequenceVertexSet TjPrime) - (_ : u ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) - (beta : Fin k) (_ : beta ∈ MissingColors G rho1 u) - (_ : beta ∉ supportColors) (z : V) - (hz : z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc)) - (zPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (_ : (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z) - (_ : seed.length ≤ (↑zPosition : ℕ)) - (_ : - (seed.length < (↑zPosition : ℕ) ∧ - beta ∈ MissingColors G rho1 z ∧ - ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), - seed.length < (↑r : ℕ) → - (↑r : ℕ) < (↑zPosition : ℕ) → - beta ∉ - MissingColors G rho1 - ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∨ - zPosition = Fin.last (ett.series.data.tree jSlot.succ.castSucc).length ∧ - ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), - seed.length < (↑r : ℕ) → - beta ∉ - MissingColors G rho1 - ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) - (_ : - ∀ w ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, - beta ∉ MissingColors G rho1 w) - (_ : - ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), - seed.length ≤ (↑a : ℕ) → - (↑a : ℕ) < (↑zPosition : ℕ) → - rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some beta), - (u ∈ TreeSequenceVertexSet TjPrime ∧ - u ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) ∧ - (exitPath.IsPath ∧ - (2 : ℕ) ≤ exitPath.length ∧ - (∀ y ∈ exitPath.support, y ∈ componentPath.support) ∧ - (∀ - y ∈ - TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ - TreeSequenceVertexSet TjPrime, - Sum.inl y ∈ exitPath.support ↔ y = u) ∧ - (∃ - g ∈ - BoundaryColorEdges G rho1 - (TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) ∪ - TreeSequenceVertexSet TjPrime) - gamma, - Incident G u g ∧ Sum.inr g ∈ exitPath.support) ∧ - ¬Incident G u fN) ∧ - (beta ∈ MissingColors G rho1 u ∧ beta ∉ supportColors) ∧ - z ∈ TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∧ - (ett.series.data.tree jSlot.succ.castSucc).vertex zPosition = z ∧ - seed.length ≤ (↑zPosition : ℕ) ∧ - ((seed.length < (↑zPosition : ℕ) ∧ - beta ∈ MissingColors G rho1 z ∧ - ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), - seed.length < (↑r : ℕ) → - (↑r : ℕ) < (↑zPosition : ℕ) → - beta ∉ - MissingColors G rho1 - ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∨ - zPosition = Fin.last (ett.series.data.tree jSlot.succ.castSucc).length ∧ - ∀ (r : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), - seed.length < (↑r : ℕ) → - beta ∉ - MissingColors G rho1 - ((ett.series.data.tree jSlot.succ.castSucc).vertex r)) ∧ - (∀ y ∈ TreeVerticesBefore (ett.series.data.tree jSlot.succ.castSucc) z hz, - beta ∉ MissingColors G rho1 y) ∧ - ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), - seed.length ≤ (↑a : ℕ) → - (↑a : ℕ) < (↑zPosition : ℕ) → - rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some beta := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 rho1 terminalPosition - hterminalPositionPositive hterminalPositionBound seed supportColors TjPrime fN H x - componentPath u exitPath hexitPath hexitLength hexitSupport hexitIntersection hexitBoundary - huNotFN huPrime huOutside beta hbeta hbetaSupport z hz zPosition hzPosition hzAfter - hzChoice hzBefore hzEdges - exact @helper_hcaseTwoObservationPackage_6796 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) - (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) - (@trace) (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) - (@hterminalPositionBound) (@TjPrime) (@fN) (@x) (@componentPath) (@u) (@exitPath) - (@hexitPath) (@hexitLength) (@hexitSupport) (@hexitIntersection) (@hexitBoundary) - (@huNotFN) (@huPrime) (@huOutside) (@beta) (@hbeta) (@hbetaSupport) (@z) (@hz) - (@zPosition) (@hzPosition) (@hzAfter) (@hzChoice) (@hzBefore) (@hzEdges) - -private theorem helper_hpreterminalGammaPresent_7105.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let this : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) - (_ : v ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) - (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (gamma0 delta0 : Fin (p0 + (1 : ℕ)) → Fin k) - (_ : ∀ (a : Fin p0), gamma0 a.succ = delta0 a.castSucc) - (_ : - Function.Injective (Fin.cons (gamma0 (0 : Fin (p0 + (1 : ℕ)))) delta0)), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (_ : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let supportColors : Finset (Fin k) := - Finset.univ.biUnion fun (a : Fin (p0 + (1 : ℕ))) ↦ - ett.series.data.stored (indices0 a).succ; - ∀ (TjPrime : TreeSequence G e0) - (_ : - ∀ (a : Fin (p0 + (1 : ℕ))), - ett.series.data.stored (indices0 a).succ = - (insert (gamma0 a) ({delta0 a} : Finset (Fin k)) : Finset (Fin k))) - (_ : - ∀ x ∈ (TreeSequenceVertexSet TjPrime).erase v, - (MissingColors G rho1 x ∩ supportColors : Finset (Fin k)) = ∅) - (_ : gamma0 (Fin.last p0) = gamma), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (_ : V ⊕ E) (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) - (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) - (_ : u ∈ (TreeSequenceVertexSet TjPrime).erase v) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (u : V) (beta : Fin k), - u ∈ TreeSequenceVertexSet TjPrime → - u ∉ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc) → - beta ∈ MissingColors G rho1 u → - ∀ (a : Fin p0), - gamma0 a.castSucc ∈ - PresentColors G - (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta delta) gamma beta - (Sum.inl u)) - u := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal - hvStage hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 hchain0 - hinjective0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound - supportColors TjPrime hstored0 hcaseTwoPointwise hgammaLast H a x componentPath u exitPath - huErase zPosition - exact @helper_hpreterminalGammaPresent_6848 (@V) (@E) inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) - (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) (@hfirstUpper) - (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@hchain0) - (@hinjective0) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) - (@TjPrime) (@hstored0) (@hcaseTwoPointwise) (@hgammaLast) (@a) (@x) (@componentPath) (@u) - (@exitPath) (@huErase) (@zPosition) - -private theorem helper_hTjInitialEarlier_7122.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (gamma delta : Fin k) - (sigma : PartialEdgeColoring E k), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (_ : (↑jSlot : ℕ) + (1 : ℕ) = ETTFirstAppearanceIndex ett v hvFinal) - (_ : - ∀ (a b : ℕ), - (1 : ℕ) ≤ a → - ∀ (_hab : a ≤ b) (_hb : b ≤ ett.rounds), - TreeSequenceInitialSegment - (ett.series.data.tree - (⟨a, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ)))) - (ett.series.data.tree - (⟨b, by - omega⟩ : - Fin (ett.rounds + (2 : ℕ))))) - (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (_ _ : Fin (p0 + (1 : ℕ)) → Fin k), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (_ : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length) - (_ : indices0 (Fin.last p0) = q), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G rho1 gamma delta; - ∀ (x : V) (_ : H.Walk (Sum.inl v) (Sum.inl x)) (u : V) - (_ : (TwoColorIncidenceGraph G rho1 gamma delta).Walk (Sum.inl x) (Sum.inl u)) - (_ : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))), - ∀ s ∈ (ExtensionBaseSupportClass ett v hvFinal v).erase q, - TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) - (ett.series.data.tree s.succ.castSucc) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot hjSlot stageToStage trace p0 indices0 gamma0 - delta0 rho1 terminalPosition hterminalPositionPositive hterminalPositionBound hqLast H x - componentPath u exitPath zPosition - exact @helper_hTjInitialEarlier_6865 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) - (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) - (@stageToStage) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) - (@hterminalPositionPositive) (@hterminalPositionBound) (@hqLast) (@x) (@componentPath) - (@u) (@exitPath) (@zPosition) - -private theorem helper_hpositiveClaim45_7133.{u_1, u_2} : - helperHpositiveClaim457133Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma q hqTerminal - hvFinal hfirstUpper hfirstPositive jSlot trace p0 indices0 gamma0 delta0 rho1 - terminalPosition hterminalPositionPositive hterminalPositionBound hgammaLast gammaFirst H x - componentPath u exitPath zPosition hp0 - exact @helper_hgammaFirstZero_6905 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) - (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) - (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) - (@hterminalPositionBound) (@hgammaLast) (@x) (@componentPath) (@u) (@exitPath) - (@zPosition) (@hp0) - -private theorem helper_hclaim45Package_7169.{u_1, u_2} : - helperHclaim45Package7169Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v gamma delta sigma this q hqTerminal - hvStage hvFinal hfirstUpper hfirstPositive jSlot trace hterminalJ p0 indices0 gamma0 rho1 - hrho1Proper hrho1One hb2Missing terminalPosition hterminalPositionPositive - hterminalPositionBound seed hseedTj hseedTerminal hTjQ supportColors TjPrime hclosure - hprimeElementary hseedPrime hb1Tj hcaseTwoPointwise gammaFirst hgammaSupport hdeltaSupport - hgammaDelta hb2EdgesFromSeed hdeltaPhiJ hterminalSeed fN hdeltaMissing H C a x - componentPath hcomponentPath hcomponentSupport hxOutside u exitPath hexitPath hexitLength - hexitSupport hexitIntersection hexitBoundary huNotFN huPrime huOutside hdegree beta hbeta - hbetaSupport haugmentation z hz zPosition hzPosition hzAfter hzChoice hzBefore hzEdges - hpositiveClaim45 hgammaFirstZero - exact @helper_hclaim45Package_6912 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) - (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) - (@hterminalJ) (@p0) (@indices0) (@gamma0) (@hrho1Proper) (@hrho1One) (@hb2Missing) - (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@hseedTj) - (@hseedTerminal) (@hTjQ) (@TjPrime) (@hclosure) (@hprimeElementary) (@hseedPrime) - (@hb1Tj) (@hcaseTwoPointwise) (@hgammaSupport) (@hdeltaSupport) (@hgammaDelta) - (@hb2EdgesFromSeed) (@hdeltaPhiJ) (@hterminalSeed) (@fN) (@hdeltaMissing) (@a) (@x) - (@componentPath) (@hcomponentPath) (@hcomponentSupport) (@hxOutside) (@u) (@exitPath) - (@hexitPath) (@hexitLength) (@hexitSupport) (@hexitIntersection) (@hexitBoundary) - (@huNotFN) (@huPrime) (@huOutside) (@hdegree) (@beta) (@hbeta) (@hbetaSupport) - (@haugmentation) (@z) (@hz) (@zPosition) (@hzPosition) (@hzAfter) (@hzChoice) (@hzBefore) - (@hzEdges) (@hpositiveClaim45) (@hgammaFirstZero) - private theorem helper_continuation_8265.{u_1, u_2} : helperContinuation8265Conditions.{u_1, u_2} := by classical @@ -2918,7 +2509,7 @@ private theorem helper_continuation_8265.{u_1, u_2} : (z0 ∈ TreeVerticesBefore TjPrime u0 huPrime0 → MissingColors G rho3 z0 = MissingColors G rho1 z0) ∧ gammaFirst ∈ MissingColors G rho3 u0 := by - exact @helper_hclaim45Package_7169 (@V) (@E) inferInstance inferInstance inferInstance (@G) + exact @helper_hclaim45Package_6912 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@hterminalJ) (@p0) (@indices0) (@gamma0) (@hrho1Proper) (@hrho1One) (@hb2Missing) @@ -3009,7 +2600,7 @@ theorem helper_continuation_11325.{u_1, u_2} : seed.length ≤ a.val → a.val < zPosition.val → rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) ≠ some beta) := by - exact @helper_hcaseTwoObservationPackage_7053 (@V) (@E) inferInstance inferInstance + exact @helper_hcaseTwoObservationPackage_6796 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) @@ -3027,7 +2618,7 @@ theorem helper_continuation_11325.{u_1, u_2} : (TwoColorComponentSwap G (OutsideTreeColorSwap TjPrime rho1 beta delta) gamma beta (Sum.inl u)) u := by - exact @helper_hpreterminalGammaPresent_7105 (@V) (@E) inferInstance inferInstance + exact @helper_hpreterminalGammaPresent_6848 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvStage) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@hchain0) @@ -3039,7 +2630,7 @@ theorem helper_continuation_11325.{u_1, u_2} : TreeSequenceInitialSegment (ett.series.data.tree jSlot.succ.castSucc) (ett.series.data.tree s.succ.castSucc) := by - exact @helper_hTjInitialEarlier_7122 (@V) (@E) inferInstance inferInstance inferInstance (@G) + exact @helper_hTjInitialEarlier_6865 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@hjSlot) (@stageToStage) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) @@ -3075,7 +2666,7 @@ theorem helper_continuation_11325.{u_1, u_2} : hgamma0 hdelta0 hstored0 hchain0 hinjective0 rfl hTjInitialEarlier rfl hpreterminalGammaPresent have hgammaFirstZero (hp0 : p0 = 0) : gammaFirst = gamma := by - exact @helper_hpositiveClaim45_7133 (@V) (@E) inferInstance inferInstance inferInstance (@G) + exact @helper_hgammaFirstZero_6905 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@gamma) (@delta) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) (@gamma0) (@delta0) (@terminalPosition) (@hterminalPositionPositive) @@ -3784,105 +3375,6 @@ private theorem helper_hmissingX_7828.{u_1, u_2} : (Finset.mem_erase.mpr ⟨hxTerminal, hxTj'⟩)] exact hcx -private theorem helper_hrightOutside_8201.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (_ : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length) - (TjPrime : TreeSequence G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) - (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := - TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; - let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; - ∀ (M : TreeSequence G e0) (_ : TreeSequenceInitialSegment U M) (n : ℕ) - (_ : U.length ≤ n) (hnM : n + (1 : ℕ) ≤ M.length), - let mIndex : Fin M.length := - (⟨n, by - omega⟩ : - Fin M.length); - ∀ (i : Fin Tj0.length) (_ : M.vertex mIndex.succ = Tj0.vertex i.succ), - Tj0.vertex i.succ ∉ TreeSequenceVertexSet U := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive - hterminalPositionBound TjPrime uPosition huPositionPositive huPositionBound U Tj0 M - hleftSegment n hnU hnM mIndex i hvertexMTj - exact @helper_hrightOutside_6001 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) - (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) - (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@uPosition) - (@huPositionPositive) (@huPositionBound) (@M) (@hleftSegment) (@n) (@hnU) (@hnM) (@i) - (@hvertexMTj) - -private theorem helper_hiSeed_8209.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (p0 : ℕ) (_ : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (hterminalPositionPositive : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (hterminalPositionBound : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length), - let seed : TreeSequence G e0 := - TreeSequencePrefix (ett.series.data.tree jSlot.succ.castSucc) (↑terminalPosition : ℕ) - hterminalPositionPositive hterminalPositionBound; - ∀ (TjPrime : TreeSequence G e0) (uPosition : Fin (TjPrime.length + (1 : ℕ))) - (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := - TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; - ∀ (_ : TreeSequenceInitialSegment seed U), - let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; - ∀ (_ : TreeSequence G e0) (_ : TreeSequenceInitialSegment seed Tj0) (_ : ℕ) - (i : Fin Tj0.length) (_ : Tj0.vertex i.succ ∉ TreeSequenceVertexSet U), - seed.length ≤ (↑i : ℕ) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v q hqTerminal hvFinal hfirstUpper - hfirstPositive jSlot p0 indices0 terminalPosition hterminalPositionPositive - hterminalPositionBound seed TjPrime uPosition huPositionPositive huPositionBound U hseedU - Tj0 M hseedTjSegment n i hrightOutside - exact @helper_hiSeed_6009 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) - (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) - (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) - (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@uPosition) - (@huPositionPositive) (@huPositionBound) (@hseedU) (@M) (@hseedTjSegment) (@n) (@i) - (@hrightOutside) - private theorem helper_hseedRX_8219.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -4004,110 +3496,6 @@ private theorem helper_hcolorTj_8249.{u_1, u_2} : rw [← hcast, hTjai, haiLast] exact hcolorA -private theorem helper_hXY_8271.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) - (hpositive : (0 : ℕ) < ett.rounds) (v : V) (sigma : PartialEdgeColoring E k), - let this : DecidableEq V := Classical.decEq V; - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (hqTerminal : (↑q : ℕ) + (1 : ℕ) = ett.rounds) (hvFinal : v ∈ TreeSequenceVertexSet T) - (hfirstUpper : ETTFirstAppearanceIndex ett v hvFinal ≤ (↑q : ℕ) + (1 : ℕ)) - (hfirstPositive : (0 : ℕ) < ETTFirstAppearanceIndex ett v hvFinal), - let jSlot : Fin ett.rounds := - (⟨ETTFirstAppearanceIndex ett v hvFinal - (1 : ℕ), by - omega⟩ : - Fin ett.rounds); - ∀ (trace : ExtensionBaseRestorationTrace ett v hvFinal sigma) (p0 : ℕ) - (indices0 : Fin (p0 + (1 : ℕ)) → Fin ett.rounds) - (_ : - (∀ v_1 ∈ (TreeSequenceVertexSet (ett.series.data.tree jSlot.castSucc.succ)).erase v, - MissingColors G (trace.coloring (Fin.last trace.steps)) v_1 = - MissingColors G (ett.series.data.coloring jSlot.castSucc) v_1) ∧ - MissingColors G (trace.coloring (Fin.last trace.steps)) v = - MissingColors G sigma v), - let rho1 : PartialEdgeColoring E k := trace.coloring (Fin.last trace.steps); - ∀ - (_ : - ∀ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), - rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge a) = - sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) ∧ - sigma ((ett.series.data.tree jSlot.succ.castSucc).edge a) = - ett.series.data.coloring jSlot.castSucc - ((ett.series.data.tree jSlot.succ.castSucc).edge a)) - (terminalPosition : Fin ((ett.series.data.tree jSlot.succ.castSucc).length + (1 : ℕ))) - (_ : (1 : ℕ) ≤ (↑terminalPosition : ℕ)) - (_ : - (↑terminalPosition : ℕ) ≤ (ett.series.data.tree jSlot.succ.castSucc).length) - (TjPrime : TreeSequence G e0) (u : V) (huPrime : u ∈ TreeSequenceVertexSet TjPrime) - (b : Fin (p0 + (1 : ℕ))) - (traceB : ExtensionBaseAlgorithmBTrace ett v rho1 u p0 indices0 b), - let rho2 : PartialEdgeColoring E k := traceB.coloring (Fin.last traceB.steps); - ∀ - (_ : - (∀ - x ∈ - TreeSequenceVertexSet (ett.series.data.tree jSlot.succ.castSucc) ∪ - TreeVerticesBefore TjPrime u huPrime, - MissingColors G (traceB.coloring (Fin.last traceB.steps)) x = - MissingColors G rho1 x) ∧ - ∀ (f : E), - ((∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), - (ett.series.data.tree jSlot.succ.castSucc).edge a = f) ∨ - ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), - TjPrime.vertex z = u ∧ (↑a : ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → - traceB.coloring (Fin.last traceB.steps) f = rho1 f) - (uPosition : Fin (TjPrime.length + (1 : ℕ))) - (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length), - let U : TreeSequence G e0 := - TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive huPositionBound; - let Tj0 : TreeSequence G e0 := ett.series.data.tree jSlot.succ.castSucc; - ∀ (M : TreeSequence G e0) - (_ : - ∀ (A : TreeSequence G e0) (r : ℕ) (hr : (1 : ℕ) ≤ r) (hrA : r + (1 : ℕ) ≤ A.length), - TreeSequenceInitialSegment - (TreeSequencePrefix A r hr - (by - omega)) - (TreeSequencePrefix A (r + (1 : ℕ)) - (by - omega) - hrA)) - (n : ℕ) (hnU : U.length ≤ n) (hnM hnSuccM : n + (1 : ℕ) ≤ M.length) - (hnM' : n ≤ M.length), - let X : TreeSequence G e0 := TreeSequencePrefix M n (Nat.le_trans U.positive hnU) hnM'; - let Y : TreeSequence G e0 := - TreeSequencePrefix M (n + (1 : ℕ)) - (Nat.le_trans U.positive (Nat.le_trans hnU (Nat.le_succ n))) hnSuccM; - let mIndex : Fin M.length := - (⟨n, by - omega⟩ : - Fin M.length); - ∀ (i : Fin Tj0.length) (_ : M.edge mIndex = Tj0.edge i) (c : Fin k) - (_ : ett.series.data.coloring jSlot.castSucc (Tj0.edge i) = some c) - (_ : c ∈ TreeMissingColors rho2 X), - TashkinovAugmentation rho2 X Y := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive v sigma this q hqTerminal hvFinal - hfirstUpper hfirstPositive jSlot trace p0 indices0 hb2 rho1 hb2TreeEdges terminalPosition - hterminalPositionPositive hterminalPositionBound TjPrime u huPrime b traceB rho2 c2 - uPosition huPositionPositive huPositionBound U Tj0 M prefixPrefix n hnU hnM hnSuccM hnM' X - Y mIndex i hedgeMTj c hcolorTj hmissingX - exact @helper_hXY_6159 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) - (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) (@hvFinal) - (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) (@hb2) (@hb2TreeEdges) - (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) - (@u) (@huPrime) (@b) (@traceB) (@c2) (@uPosition) (@huPositionPositive) - (@huPositionBound) (@M) (@prefixPrefix) (@n) (@hnU) (@hnM) (@hnSuccM) (@hnM') (@i) - (@hedgeMTj) (@c) (@hcolorTj) (@hmissingX) - theorem helper_branch_15456.{u_1, u_2} : helperBranch15456Conditions.{u_1, u_2} := by classical @@ -4134,14 +3522,14 @@ theorem helper_branch_15456.{u_1, u_2} : hnewEntryFromRight mIndex hnU have hrightOutside : Tj0.vertex i.succ ∉ TreeSequenceVertexSet U := by - exact @helper_hrightOutside_8201 (@V) (@E) inferInstance inferInstance inferInstance (@G) + exact @helper_hrightOutside_6001 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@uPosition) (@huPositionPositive) (@huPositionBound) (@M) (@hleftSegment) (@n) (@hnU) (@hnM) (@i) (@hvertexMTj) have hiSeed : seed.length ≤ i.val := by - exact @helper_hiSeed_8209 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + exact @helper_hiSeed_6009 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@p0) (@indices0) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) (@uPosition) @@ -4195,7 +3583,7 @@ theorem helper_branch_15456.{u_1, u_2} : (@hrightOutside) (@hiSeed) (@hiTj) (@hRXTj) (@hRXlen) (@A) (@hlenA) (@c) (@hmissingRX) (@hleftX) have hXY : TashkinovAugmentation rho2 X Y := by - exact @helper_hXY_8271 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + exact @helper_hXY_6159 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@v) (@sigma) (@hqTerminal) (@hvFinal) (@hfirstUpper) (@hfirstPositive) (@trace) (@p0) (@indices0) (@hb2) (@hb2TreeEdges) (@terminalPosition) (@hterminalPositionPositive) (@hterminalPositionBound) (@TjPrime) diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean index fb8d79497a..bd218e555e 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseCaseTwoContradiction.lean @@ -5,14 +5,15 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBranches + + public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceTransport public import LeanPool.GoldbergSeymour.TreeVerticesBeforeFacts public import LeanPool.GoldbergSeymour.MaximumPropertyTransport public import LeanPool.GoldbergSeymour.OrderedTreeUnionExists -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceRestrict -public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceSuffix public import LeanPool.GoldbergSeymour.TashkinovClosureExists public import LeanPool.GoldbergSeymour.TreeSequencePrefix public import LeanPool.GoldbergSeymour.StableColoringBeforeVertex @@ -100,72 +101,6 @@ private theorem helper_transportStep_250.{u_1, u_2} : change rho3 (B.edge added) = some c exact haddedFixed.trans hcolor -private theorem helper_equalPrefixes_181.{u_1, u_2} : - open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 - : E} {A B D : TreeSequence G e0}, TreeSequenceInitialSegment A D → - TreeSequenceInitialSegment B D → A.length = B.length → A = B := by - classical - intro V E G e0 A B D hAD hBD hlen - rcases hAD with ⟨hlenAD, hvertexAD, hedgeAD⟩ - rcases hBD with ⟨hlenBD, hvertexBD, hedgeBD⟩ - cases A with - | mk alen apos avertex aedge avinj aeinf afirst aattach => - cases B with - | mk blen bpos bvertex bedge bvinj beinj bfirst battach => - simp only at hlen - subst blen - rw [TreeSequence.mk.injEq] - refine ⟨rfl, ?_, ?_⟩ - · apply heq_of_eq - funext i - calc - avertex i = D.vertex - (Fin.castLE (Nat.succ_le_succ hlenAD) i) := - (hvertexAD i).symm - _ = D.vertex (Fin.castLE (Nat.succ_le_succ hlenBD) i) := by - congr 1 - _ = bvertex i := hvertexBD i - · apply heq_of_eq - funext i - calc - aedge i = D.edge (Fin.castLE hlenAD i) := (hedgeAD i).symm - _ = D.edge (Fin.castLE hlenBD i) := by congr 1 - _ = bedge i := hedgeBD i - -private theorem helper_hrightOutside_219.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (Tj TjPrime : - TreeSequence G e0) (zPosition : Fin (Tj.length + (1 : ℕ))) (uPosition : Fin - (TjPrime.length + (1 : ℕ))) (huPositionPositive : (1 : ℕ) ≤ (↑uPosition : ℕ)) - (huPositionBound : (↑uPosition : ℕ) ≤ TjPrime.length) (hzPositionPositive : (1 : ℕ) ≤ - (↑zPosition : ℕ)) (hzPositionBound : (↑zPosition : ℕ) ≤ Tj.length), - let U : TreeSequence G e0 := TreeSequencePrefix TjPrime (↑uPosition : ℕ) huPositionPositive - huPositionBound; - let Z : TreeSequence G e0 := TreeSequencePrefix Tj (↑zPosition : ℕ) hzPositionPositive - hzPositionBound; - ∀ (M : TreeSequence G e0) (_ : TreeSequenceInitialSegment U M) (n : ℕ) (_ : U.length ≤ n) (hnM - : n + (1 : ℕ) ≤ M.length), - let j : Fin M.length := (⟨n, Decidable.byContradiction fun (a : ¬n < M.length) ↦ - by omega - ⟩ : Fin M.length); - ∀ (i : Fin Z.length) (_ : M.vertex j.succ = Z.vertex i.succ), Z.vertex i.succ ∉ - TreeSequenceVertexSet U := by - classical - intro V E G e0 Tj TjPrime zPosition uPosition huPositionPositive huPositionBound - hzPositionPositive hzPositionBound U Z M hleftSegment n hnU hnM j i hvertexMZ hmem - simp only [TreeSequenceVertexSet, Finset.mem_image, - Finset.mem_univ, true_and] at hmem - obtain ⟨a, ha⟩ := hmem - have hmvertex : M.vertex - (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) = - U.vertex a := hleftSegment.2.1 a - have heq : M.vertex j.succ = - M.vertex (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) := - hvertexMZ.trans (ha.symm.trans hmvertex.symm) - have hindex := congrArg Fin.val (M.vertex_injective heq) - simp [j] at hindex - omega - private theorem helper_hiSeed_234.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} {G : LooplessMultigraph V E} {e0 : E} (Tj seed TjPrime : @@ -509,9 +444,9 @@ private theorem helper_branch_209.{u_1, u_2} : hnSuccM let j : Fin M.length := ⟨n, by omega⟩ obtain ⟨i, hedgeMZ, hvertexMZ⟩ := hnewEntryFromRight j hnU - have hrightOutside := @helper_hrightOutside_219 V E G e0 Tj TjPrime zPosition uPosition - huPositionPositive huPositionBound hzPositionPositive hzPositionBound M hleftSegment n hnU hnM - i hvertexMZ + have hrightOutside : Z.vertex i.succ ∉ TreeSequenceVertexSet U := by + rw [← hvertexMZ] + exact hleftSegment.vertex_not_mem_after (by change U.length < n + 1; omega) have hiSeed := @helper_hiSeed_234 V E G e0 Tj seed TjPrime zPosition uPosition huPositionPositive huPositionBound hzPositionPositive hzPositionBound hseedU M hseedZSegment n i hrightOutside have hiZ : i.val < Z.length := i.isLt @@ -709,7 +644,7 @@ private theorem helper_hrouteUM_530.{u_1, u_2} : · apply heq_of_eq funext i rfl - have equalPrefixes := @helper_equalPrefixes_181 V E G e0 + have equalPrefixes := @SharedFacts.ExtensionBranches.equalPrefixes V E G e0 have prefixAtLeft : TreeSequencePrefix M U.length U.positive hleftSegment.1 = U := by apply equalPrefixes diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean b/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean index ae0bf56ce8..dfff265d04 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseClaim44.lean @@ -1161,105 +1161,6 @@ private theorem helper_hsequenceInitialSegment_1207.{u_1, u_2} : | @head A D hstep htail ih => exact hinitialSegmentTrans hstep.2.1 ih -private theorem helper_branch_1233.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] - {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} - {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : - ExtendedTashkinovTree G k e0 input T generating), - ∀ terminalSupport ∈ TreeSequenceVertexSet T, - ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (TjPrime seed : - TreeSequence G e0) (terminalPosition : Fin ((ett.series.data.tree - jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ - (↑terminalPosition : ℕ)), seed = TreeSequencePrefix (ett.series.data.tree - jSlot.succ.castSucc) (↑terminalPosition : ℕ) hterminalPositionPositive ( - by omega - ) → - ∀ (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin - ett.rounds) (_ _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : - ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), TashkinovClosure - rho1 seed TjPrime → ( - ∀ (a : Fin trace.steps) (f : E) (c : Fin k), c ≠ trace.gamma a → c ≠ trace.delta a → - (trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c)) → ( - ∀ (a : Fin trace.steps) {v : V}, v ∈ TreeVerticesBefore TjPrime u huPrime → trace.gamma a ∉ - MissingColors G rho1 v ∧ trace.delta a ∉ MissingColors G rho1 v) → ( - ∀ (n : Fin (trace.steps + (1 : ℕ))) (q : Fin (ett.series.data.tree - jSlot.succ.castSucc).length), trace.coloring n ((ett.series.data.tree - jSlot.succ.castSucc).edge q) = rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge q)) → - ( - ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 A B → - TreeSequenceInitialSegment A B) → ( - ∀ {B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 seed B → - ∀ (a : Fin B.length), seed.length ≤ (↑a : ℕ) → - ∃ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑a : ℕ) ∧ - ∃ (c : Fin k), rho1 (B.edge a) = some c ∧ c ∈ MissingColors G rho1 (B.vertex i)) → - ∀ (f : E), (( - ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree - jSlot.succ.castSucc).edge a = f) ∨ - ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : - ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → trace.coloring (Fin.last trace.steps) f = rho1 f := by - classical - intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u - TjPrime seed terminalPosition hterminalPositionPositive hseed huPrime p indices gamma delta - b trace hclosure hunaffectedValue hprefixColorsNotMissing hstageEdgesPreserved - hsequenceInitialSegment haugmentationEdgeMissing - exact @helper_branch_851 V E inferInstance inferInstance inferInstance G k e0 input T - generating ett terminalSupport hterminalSupport jSlot rho1 u TjPrime seed terminalPosition - hterminalPositionPositive hseed huPrime p indices gamma delta b trace hclosure - hunaffectedValue hprefixColorsNotMissing hstageEdgesPreserved hsequenceInitialSegment - haugmentationEdgeMissing - -private theorem helper_branch_1767.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] - {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input : PartialEdgeColoring E k} - {T : TreeSequence G e0} {generating : PartialEdgeColoring E k} (ett : - ExtendedTashkinovTree G k e0 input T generating), - ∀ terminalSupport ∈ TreeSequenceVertexSet T, - ∀ (jSlot : Fin ett.rounds) (rho1 : PartialEdgeColoring E k) (u : V) (TjPrime seed : - TreeSequence G e0) (terminalPosition : Fin ((ett.series.data.tree - jSlot.succ.castSucc).length + (1 : ℕ))) (hterminalPositionPositive : (1 : ℕ) ≤ - (↑terminalPosition : ℕ)), seed = TreeSequencePrefix (ett.series.data.tree - jSlot.succ.castSucc) (↑terminalPosition : ℕ) hterminalPositionPositive ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) → - ∀ (huPrime : u ∈ TreeSequenceVertexSet TjPrime) (p : ℕ) (indices : Fin (p + (1 : ℕ)) → Fin - ett.rounds) (_ _ : Fin (p + (1 : ℕ)) → Fin k) (b : Fin (p + (1 : ℕ))) (trace : - ExtensionBaseAlgorithmBTrace ett terminalSupport rho1 u p indices b), TashkinovClosure - rho1 seed TjPrime → ( - ∀ (a : Fin trace.steps) (f : E) (c : Fin k), c ≠ trace.gamma a → c ≠ trace.delta a → - (trace.coloring a.succ f = some c ↔ trace.coloring a.castSucc f = some c)) → ( - ∀ (a : Fin trace.steps) {v : V}, v ∈ TreeVerticesBefore TjPrime u huPrime → trace.gamma a ∉ - MissingColors G rho1 v ∧ trace.delta a ∉ MissingColors G rho1 v) → ( - ∀ (n : Fin (trace.steps + (1 : ℕ))) (q : Fin (ett.series.data.tree - jSlot.succ.castSucc).length), trace.coloring n ((ett.series.data.tree - jSlot.succ.castSucc).edge q) = rho1 ((ett.series.data.tree jSlot.succ.castSucc).edge q)) → - ( - ∀ {A B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 A B → - TreeSequenceInitialSegment A B) → ( - ∀ {B : TreeSequence G e0}, TashkinovAugmentationSequence rho1 seed B → - ∀ (a : Fin B.length), seed.length ≤ (↑a : ℕ) → - ∃ (i : Fin (B.length + (1 : ℕ))), (↑i : ℕ) ≤ (↑a : ℕ) ∧ - ∃ (c : Fin k), rho1 (B.edge a) = some c ∧ c ∈ MissingColors G rho1 (B.vertex i)) → - ∀ (f : E), (( - ∃ (a : Fin (ett.series.data.tree jSlot.succ.castSucc).length), (ett.series.data.tree - jSlot.succ.castSucc).edge a = f) ∨ - ∃ (a : Fin TjPrime.length) (z : Fin (TjPrime.length + (1 : ℕ))), TjPrime.vertex z = u ∧ (↑a : - ℕ) < (↑z : ℕ) ∧ TjPrime.edge a = f) → trace.coloring (Fin.last trace.steps) f = rho1 f := by - classical - intro V E _ _ _ G k e0 input T generating ett terminalSupport hterminalSupport jSlot rho1 u - TjPrime seed terminalPosition hterminalPositionPositive hseed huPrime p indices gamma delta - b trace hclosure hunaffectedValue hprefixColorsNotMissing hstageEdgesPreserved - hsequenceInitialSegment haugmentationEdgeMissing - exact @helper_branch_1233 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) - (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@jSlot) (@rho1) - (@u) (@TjPrime) (@seed) (@terminalPosition) (@hterminalPositionPositive) (@hseed) - (@huPrime) (@p) (@indices) (@gamma) (@delta) (@b) (@trace) (@hclosure) (@hunaffectedValue) - (@hprefixColorsNotMissing) (@hstageEdgesPreserved) (@hsequenceInitialSegment) - (@haugmentationEdgeMissing) - private theorem helper_hpositionBelowAnti_1591.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] @@ -1511,7 +1412,7 @@ private theorem helper_continuation_1854.{u_1, u_2} : constructor · intro v hv exact hmissingPreserved (Fin.last trace.steps) v hv - · exact @helper_branch_1767 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + · exact @helper_branch_851 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@terminalSupport) (@hterminalSupport) (@jSlot) (@rho1) (@u) (@TjPrime) (@seed) (@terminalPosition) (@hterminalPositionPositive) (@hseed) (@huPrime) (@p) (@indices) (@gamma) (@delta) (@b) (@trace) (@hclosure) (@hunaffectedValue) diff --git a/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean b/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean index 3fa26e9661..c91c97ba02 100644 --- a/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean +++ b/LeanPool/GoldbergSeymour/ExtensionBaseStepLemmas.lean @@ -5,6 +5,7 @@ Authors: Wesley Pegden -/ module + public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseStepLemmas import all LeanPool.GoldbergSeymour.ExtensionBaseAuxiliary @@ -3132,18 +3133,9 @@ theorem helper_hrightOutside_3985.{u_1, u_2} : x componentPath u exitPath zPosition u0 exitPath0 zPosition0 uPosition huPositionPositive huPositionBound hzPositionPositive hzPositionBound U Z M hleftSegment n hnU hnM j i hvertexMZ hmem - simp only [TreeSequenceVertexSet, Finset.mem_image, - Finset.mem_univ, true_and] at hmem - obtain ⟨a, ha⟩ := hmem - have hmvertex : M.vertex - (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) = - U.vertex a := hleftSegment.2.1 a - have heq : M.vertex j.succ = M.vertex - (Fin.castLE (Nat.succ_le_succ hleftSegment.1) a) := - hvertexMZ.trans (ha.symm.trans hmvertex.symm) - have hindex := congrArg Fin.val (M.vertex_injective heq) - simp [j] at hindex - omega + apply hleftSegment.vertex_not_mem_after (position := j.succ) + (by change U.length < n + 1; omega) + rwa [hvertexMZ] theorem helper_hvFinal_2051.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean index 42a93dba35..6e02121033 100644 --- a/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean +++ b/LeanPool/GoldbergSeymour/ExtensionRulesTerminalStoredDisjoint.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.ExtensionBaseStepLemmas + public import LeanPool.GoldbergSeymour.ETTFirstAppearanceIndex public import LeanPool.GoldbergSeymour.EarlierPECycleFirstNonrevisitingInternal public import LeanPool.GoldbergSeymour.ColoredVertexSetElementary @@ -105,37 +107,6 @@ private abbrev helperContinuation1661Conditions.{u_1, u_2} : Prop := TwoColorIncidenceGraph G secondStableR gammaR choiceR.color → Disjoint (ett.series.data.stored q.succ) (ett.series.data.stored r.succ) -private theorem helper_segmentTrans_108.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {A B C : TreeSequence G e0}, TreeSequenceInitialSegment A B → TreeSequenceInitialSegment B - C → TreeSequenceInitialSegment A C := by - classical - intro V E G e0 A B C hAB hBC - rcases hAB with ⟨hab, hvab, heab⟩ - rcases hBC with ⟨hbc, hvbc, hebc⟩ - refine ⟨hab.trans hbc, ?_, ?_⟩ - · intro i - simpa using (hvbc (Fin.castLE (Nat.succ_le_succ hab) i)).trans (hvab i) - · intro i - simpa using (hebc (Fin.castLE hab i)).trans (heab i) - -private theorem helper_stepSegment_119.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (i : Fin (ett.rounds + (1 : ℕ))), (0 : ℕ) < (↑i : ℕ) → - TreeSequenceInitialSegment (ett.series.data.tree i.castSucc) (ett.series.data.tree i.succ) - := by - classical - intro V E _ _ _ G k e0 input T generating ett i hi - cases ett.series.certified i with - | initial => simp at hi - | SE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption - | PE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption - | RE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ => assumption - private theorem helper_stageToStage_128.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : @@ -1752,7 +1723,8 @@ theorem ExtensionRulesTerminalStoredDisjoint {V E : Type*} TreeSequenceInitialSegment A C := by apply TreeSequenceInitialSegment.trans <;> assumption have stepSegment := - @helper_stepSegment_119 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + @_root_.GoldbergSeymour.ExtensionBaseProof.helper_stepSegment_2099 (@V) (@E) inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) have stageToStage := @helper_stageToStage_128 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@vn) (@vr) (@hvn) (@hvr) (@segmentRefl) diff --git a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean index 8ec4afec14..523e725fd3 100644 --- a/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean +++ b/LeanPool/GoldbergSeymour/HierarchyClaimNineFirstUseAfterSeed.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningTransport + public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices @@ -861,19 +863,6 @@ private theorem helper_hstoredFirst_583.{u_1, u_2} : exact missingOther _ eta hna heb simp only [HierarchyFirstMissingPosition, heq] -private theorem helper_segTrans_616.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) - {S U W : TreeSequence G e0}, TreeSequenceInitialSegment S U → TreeSequenceInitialSegment U - W → TreeSequenceInitialSegment S W := by - classical - intro V E G e0 S U W hSU hUW - refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) - private theorem helper_lastPositive_633.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] @@ -1279,7 +1268,7 @@ private theorem helper_continuation_1607.{u_1, u_2} : (@firstSpec) (@hib) (@missingOther) (@hmissingB) let n := Fin.last em.rounds let Tn := em.series.data.tree n.castSucc - have segTrans := @helper_segTrans_616 (@V) (@E) (@G) (@e0) + have segTrans := @SharedFacts.ShorteningTransport.trans (@V) (@E) (@G) (@e0) have stageSegment (a d : ℕ) (hbound : a + d ≤ H.dividerCount + 1) : TreeSequenceInitialSegment (H.stage ⟨a, by omega⟩) (H.stage ⟨a + d, by omega⟩) := by diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean index f5d6b7a747..25a469adb9 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneAdvanceOutsideStored.lean @@ -5,6 +5,9 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ReplacementPrefixes + + public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement public import LeanPool.GoldbergSeymour.SharedFacts.InsideAdvancement @@ -964,486 +967,6 @@ private theorem helper_common_1527.{u_1, u_2} : · intro i exact (hYZ.2.2 (Fin.castLE hXY i)).symm.trans (hXZ.2.2 i) -private theorem helper_hAT_1558.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : ℕ), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); TreeSequenceInitialSegment A T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C i A - have starNext (j : Fin (C.hierarchy.dividerCount + 1)) : - TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy j) - (C.hierarchy.stage j.succ) := - Fin.cases C.hierarchy.coreInsideFirst (fun i => C.hierarchy.nested i.succ) j - simpa only [Fin.succ_last, C.hierarchy.terminalStage] using - starNext (Fin.last C.hierarchy.dividerCount) - -private theorem helper_fullB_1581.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) → (3 : ℕ) ≤ T.length - A.length → - ∀ (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx i A starEq htail hlen B R - have hn : min ((HierarchyStarredStage R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount)).length + - (HierarchyFullTailLength R.counterexample - 1)) T.length = T.length - 1 := by - unfold HierarchyFullTailLength - dsimp only - rw [starEq R] - omega - simp only [HierarchyFullTailPrefix, hn] - rfl - -private theorem helper_elementary_1593.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) - (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = - B) → - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx i hlen B fullB R - have h : ColoredVertexSetElementary G R.coloring - (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - 1))) := by - exact HierarchyCounterexamplePenultimateElementary G k e0 - R.corresponding.replacementInput T R.coloring R.corresponding.replacementETT - R.replacementBase R.counterexample R.minimumContext.proper - R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung - R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality - R.minimumContext.largeMissingSet - intro u hu v hv hne - exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne - -private theorem helper_advance_1736.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber - C.hierarchy = (1 : ℕ) → ( - ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → - ∀ (v : V), (MissingColors G mu v).Nonempty) → - ∀ (_ : ℕ), ( - ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → - ∀ (B : Finset V), ColoredVertexSetElementary G psi B → - ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ - MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → - TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → - Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl - u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ - ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi - x) → ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z - → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) → TreeSequenceInitialSegment A T → - ∀ (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); TreeSequenceInitialSegment B T → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = B) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → - (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G - e0), TreeSequenceInitialSegment A X → A.length < X.length → TreeSequenceInitialSegment X B - → - ∀ (a b eta : Fin k), eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring - T eta) : ℕ) ≤ X.length → - ∀ (jb : Fin (B.length + (1 : ℕ))), A.length < (↑jb : ℕ) → (↑jb : ℕ) ≤ X.length → b ∈ - MissingColors G R.coloring (B.vertex jb) → a ∈ MissingColors G R.coloring (T.vertex - (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some - a) → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some - b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → - ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ - ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = - R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → - b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G - R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex - (Fin.last T.length)))) → ( - ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = - S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), - eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition - R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))), A.length < (↑j : ℕ) → c ∈ MissingColors G R.coloring (B.vertex - j) → c ∉ TreeMissingColors R.coloring A) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), (1 : ℕ) ≤ - j → j < T.length - A.length → - ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last - (HierarchyFullTailPrefix C j).length)), - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = - some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → ( - ∀ (t : Fin T.length), A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ) → G.ends (T.edge - t) = s(T.vertex t.castSucc, T.vertex t.succ)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), - ∀ (f : E), - ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, - R.coloring f ≠ some a) → - ∀ (m : ℕ), HierarchyPathNumber C.hierarchy ≤ m → m < HierarchyFullTailLength C - (1 : ℕ) → - ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C m).vertex (Fin.last - (HierarchyFullTailPrefix C m).length)), alpha ∈ MissingColors G P.coloring (T.vertex - (Fin.last T.length)) → alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) → m + (1 : ℕ) ∈ - HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i componentData - trans common A starEq hAT hlen B hBT fullB elementary vertexMem firstAt stageSwitch - gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m hmLower - hmUpper P alpha ha haLast hAlphaStored - exact @helper_advance_481 V E inferInstance inferInstance inferInstance inferInstance G k - e0 input T phi ett base C ctx hsituation hvertexMissing i P alpha componentData trans - common starEq hAT hlen hBT fullB elementary vertexMem firstAt stageSwitch - gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m - hmLower hmUpper P alpha ha haLast hAlphaStored - -private theorem helper_advance_2294.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C), HierarchyPathNumber - C.hierarchy = (1 : ℕ) → ( - ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → - ∀ (v : V), (MissingColors G mu v).Nonempty) → - ∀ (_ : ℕ), ( - ∀ (psi : PartialEdgeColoring E k) (a b : Fin k), a ≠ b → IsProperEdgeColoring G psi → - ∀ (B : Finset V), ColoredVertexSetElementary G psi B → - ∀ (u v w : V), u ∈ B → v ∈ B → u ≠ v → w ≠ u → w ≠ v → a ∈ MissingColors G psi u → b ∈ - MissingColors G psi v → a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w → - TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v) → - Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl - u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ - ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi - x) → ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Z → TreeSequenceInitialSegment Y Z - → X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) → ( - have A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); TreeSequenceInitialSegment A T) → - ∀ (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); TreeSequenceInitialSegment B T → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = B) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) → ( - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))), c ∈ MissingColors G R.coloring (B.vertex j) → - (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G - e0), TreeSequenceInitialSegment A X → A.length < X.length → TreeSequenceInitialSegment X B - → - ∀ (a b eta : Fin k), eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → (↑(HierarchyFirstMissingPosition R.coloring - T eta) : ℕ) ≤ X.length → - ∀ (jb : Fin (B.length + (1 : ℕ))), A.length < (↑jb : ℕ) → (↑jb : ℕ) ≤ X.length → b ∈ - MissingColors G R.coloring (B.vertex jb) → a ∈ MissingColors G R.coloring (T.vertex - (Fin.last T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some - a) → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some - b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → - ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ - ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = - R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → - b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G - R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex - (Fin.last T.length)))) → ( - ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), eta ∈ HierarchyStoredColorsAt - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = - S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k), - eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) → a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta → - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < (↑(HierarchyFirstMissingPosition - R.coloring T eta) : ℕ) → R.coloring (T.edge t) ≠ some a) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))), A.length < (↑j : ℕ) → c ∈ MissingColors G R.coloring (B.vertex - j) → c ∉ TreeMissingColors R.coloring A) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ c ∉ TreeMissingColors R.coloring A, c ∉ HierarchyStoredColorsAt R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount) → c ∉ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ), (1 : ℕ) ≤ - j → j < T.length - A.length → - ∀ c ∈ MissingColors G R.coloring ((HierarchyFullTailPrefix C j).vertex (Fin.last - (HierarchyFullTailPrefix C j).length)), - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < A.length + j → R.coloring (T.edge t) = - some c → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) → ( - ∀ (t : Fin T.length), A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ) → G.ends (T.edge - t) = s(T.vertex t.castSucc, T.vertex t.succ)) → ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount), - ∀ (f : E), - ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, - R.coloring f ≠ some a) → - ∀ (m : ℕ), HierarchyPathNumber C.hierarchy ≤ m → m < HierarchyFullTailLength C - (1 : ℕ) → - ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ alpha ∈ MissingColors G P.coloring ((HierarchyFullTailPrefix C m).vertex (Fin.last - (HierarchyFullTailPrefix C m).length)), alpha ∈ MissingColors G P.coloring (T.vertex - (Fin.last T.length)) → alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) → m + (1 : ℕ) ∈ - HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i componentData - trans common A starEq hAT hlen B hBT fullB elementary vertexMem firstAt stageSwitch - gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m hmLower - hmUpper P alpha ha haLast hAlphaStored - exact @helper_advance_1736 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@hsituation) (@hvertexMissing) (@i) (@componentData) (@trans) (@common) (@starEq) - (@hAT) (@hlen) (@hBT) (@fullB) (@elementary) (@vertexMem) (@firstAt) (@stageSwitch) - (@gammaTransport) (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) - (@gammaChoice) (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored) - -private theorem helper_advance_2571.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : - HierarchyPathNumber C.hierarchy = (1 : ℕ)) (_ : - ∀ (mu : PartialEdgeColoring E k), IsProperEdgeColoring G mu → IsOneEdgeUncolored mu e0 → - ∀ (v : V), (MissingColors G mu v).Nonempty) (_ : ℕ) (_ : - ∀ (psi : PartialEdgeColoring E k) (a b : Fin k) (_ : a ≠ b) (_ : IsProperEdgeColoring G psi) - (B : Finset V) (_ : ColoredVertexSetElementary G psi B) (u v w : V) (_ : u ∈ B) (_ : v ∈ - B) (_ : u ≠ v) (_ : w ≠ u) (_ : w ≠ v) (_ : a ∈ MissingColors G psi u) (_ : b ∈ - MissingColors G psi v) (_ : a ∈ MissingColors G psi w ∨ b ∈ MissingColors G psi w) (_ : - TwoColorComponent G psi a b (Sum.inl u) = TwoColorComponent G psi a b (Sum.inl v)), - Disjoint (TwoColorComponent G psi a b (Sum.inl w)) (TwoColorComponent G psi a b (Sum.inl - u)) ∧ TwoColorPathComponent G psi a b (Sum.inl w) ∧ - ∀ x ∈ B, MissingColors G (TwoColorComponentSwap G psi a b (Sum.inl w)) x = MissingColors G psi - x) (_ : - ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) (_ : - TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) (_ : - ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Z) (_ : - TreeSequenceInitialSegment Y Z) (_ : X.length ≤ Y.length), TreeSequenceInitialSegment X - Y), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); - ∀ (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) (_ : - have A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); TreeSequenceInitialSegment A T) (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - omega - ) ( - by - omega - ); - ∀ (_ : TreeSequenceInitialSegment B T) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = B) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B)) (_ : - ∀ (U : TreeSequence G e0) (j : Fin (U.length + (1 : ℕ))), U.vertex j ∈ TreeSequenceVertexSet - U) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))) (_ : c ∈ MissingColors G R.coloring (B.vertex j)), - (↑(HierarchyFirstMissingPosition R.coloring T c) : ℕ) = (↑j : ℕ)) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (X : TreeSequence G - e0) (_ : TreeSequenceInitialSegment A X) (_ : A.length < X.length) (_ : - TreeSequenceInitialSegment X B) (a b eta : Fin k) (_ : eta ∈ HierarchyStoredColorsAt - R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)) (_ : a ∈ - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta) (_ : - (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ) ≤ X.length) (jb : Fin (B.length + - (1 : ℕ))) (_ : A.length < (↑jb : ℕ)) (_ : (↑jb : ℕ) ≤ X.length) (_ : b ∈ MissingColors G - R.coloring (B.vertex jb)) (_ : a ∈ MissingColors G R.coloring (T.vertex (Fin.last - T.length)) ∨ b ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length))) (_ : - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) ≠ some - a) (_ : - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → R.coloring (T.edge t) = some - b → TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree (Fin.last - R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ b ∈ TashkinovStoredColors - R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)), - ∃ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), ( - ∀ v ∈ TreeSequenceVertexSet B, MissingColors G S.coloring v = MissingColors G R.coloring v) ∧ - ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < X.length → S.coloring (T.edge t) = - R.coloring (T.edge t)) ∧ (a ∈ MissingColors G R.coloring (T.vertex (Fin.last T.length)) → - b ∈ MissingColors G S.coloring (T.vertex (Fin.last T.length))) ∧ (b ∈ MissingColors G - R.coloring (T.vertex (Fin.last T.length)) → a ∈ MissingColors G S.coloring (T.vertex - (Fin.last T.length)))) (_ : - ∀ (R S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta : Fin k) (_ - : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount)), eta ∈ HierarchyStoredColorsAt - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) ∧ - R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta = - S.counterexample.good.gamma (Fin.last S.counterexample.hierarchy.dividerCount) eta) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta a : Fin k) (_ - : eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount)) (_ : a ∈ R.counterexample.good.gamma (Fin.last - R.counterexample.hierarchy.dividerCount) eta) (t : Fin T.length) (_ : A.length ≤ (↑t : ℕ)) - (_ : (↑t : ℕ) < (↑(HierarchyFirstMissingPosition R.coloring T eta) : ℕ)), R.coloring - (T.edge t) ≠ some a) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (j : - Fin (B.length + (1 : ℕ))) (_ : A.length < (↑j : ℕ)) (_ : c ∈ MissingColors G R.coloring - (B.vertex j)), c ∉ TreeMissingColors R.coloring A) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (c : Fin k) (_ : c - ∉ TreeMissingColors R.coloring A) (_ : c ∉ HierarchyStoredColorsAt - R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount)), c ∉ - TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (j : ℕ) (_ : (1 : - ℕ) ≤ j) (_ : j < T.length - A.length) (c : Fin k) (_ : c ∈ MissingColors G R.coloring - ((HierarchyFullTailPrefix C j).vertex (Fin.last (HierarchyFullTailPrefix C j).length))) (t - : Fin T.length) (_ : A.length ≤ (↑t : ℕ)) (_ : (↑t : ℕ) < A.length + j) (_ : R.coloring - (T.edge t) = some c), TreeIncidentEdge (R.corresponding.replacementETT.series.data.tree - (Fin.last R.corresponding.replacementETT.rounds).castSucc) (T.edge t) ∧ c ∈ - TashkinovStoredColors R.corresponding.replacementETT.series.data (Fin.last - R.corresponding.replacementETT.rounds)) (_ : - ∀ (t : Fin T.length) (_ : A.length + HierarchyPathNumber C.hierarchy ≤ (↑t : ℕ)), G.ends - (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) (_ : - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (eta : Fin k) (_ : - eta ∈ HierarchyStoredColorsAt R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount)) (f : E), - ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, - R.coloring f ≠ some a) (m : ℕ) (_ : HierarchyPathNumber C.hierarchy ≤ m) (_ : m < - HierarchyFullTailLength C - (1 : ℕ)) (P : HierarchyReplacementPresentation G k e0 input T - phi ett base C ctx) (alpha : Fin k) (_ : alpha ∈ MissingColors G P.coloring - ((HierarchyFullTailPrefix C m).vertex (Fin.last (HierarchyFullTailPrefix C m).length))) (_ - : alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length))) (_ : alpha ∉ - HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last - P.counterexample.hierarchy.dividerCount)), m + (1 : ℕ) ∈ - HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx hsituation hvertexMissing i componentData - trans common A starEq hAT hlen B hBT fullB elementary vertexMem firstAt stageSwitch - gammaTransport gammaUnused outsideA notRaw tailException consecutive gammaChoice m hmLower - hmUpper P alpha ha haLast hAlphaStored - exact @helper_advance_2294 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@hsituation) (@hvertexMissing) (@i) (@componentData) (@trans) (@common) (@starEq) - (@hAT) (@hlen) (@hBT) (@fullB) (@elementary) (@vertexMem) (@firstAt) (@stageSwitch) - (@gammaTransport) (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) - (@gammaChoice) (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored) - theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) @@ -1520,8 +1043,7 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} HierarchyStarredStage R.counterexample.hierarchy (Fin.last R.counterexample.hierarchy.dividerCount) = A := (sameLast _ _ _ _ R.sameGood.1.2.1 R.sameGood.1.2.2.1 R.sameGood.1.1).symm - have hAT := - helper_hAT_1558 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@i) + have hAT := C.hierarchy.lastStarredInitialSegment have htail : 3 ≤ T.length - A.length := by have hu := hiUpper change i < (T.length - A.length) - 1 at hu @@ -1541,12 +1063,14 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} have fullB (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1) = B := by - exact helper_fullB_1581 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.ReplacementPrefixes.penultimatePrefixEquality (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@i) (@starEq) (@htail) (@hlen) (@R) have elementary (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by - exact helper_elementary_1593 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact SharedFacts.ReplacementPrefixes.penultimatePrefixElementary (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@i) (@hlen) (@fullB) (@R) have vertexMem (U : TreeSequence G e0) (j : Fin (U.length + 1)) : U.vertex j ∈ TreeSequenceVertexSet U := by @@ -1646,9 +1170,8 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} (Fin.last R.counterexample.hierarchy.dividerCount)) (f : E) : ∃ a ∈ R.counterexample.good.gamma (Fin.last R.counterexample.hierarchy.dividerCount) eta, R.coloring f ≠ some a := by - exact @SharedFacts.OutsideAdvancement.gammaChoice (@V) (@E) inferInstance inferInstance - inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@trans) + exact SharedFacts.OutsideAdvancement.gammaChoice (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@base) (@C) (@ctx) (@trans) (@R) (@eta) (@heta) (@f) have advance (m : ℕ) (hmLower : HierarchyPathNumber C.hierarchy ≤ m) (hmUpper : m < HierarchyFullTailLength C - 1) @@ -1660,12 +1183,12 @@ theorem HierarchySituationOneAdvanceOutsideStored {V E : Type*} (hAlphaStored : alpha ∉ HierarchyStoredColorsAt P.counterexample.hierarchy (Fin.last P.counterexample.hierarchy.dividerCount)) : m + 1 ∈ HierarchyEligibleCommonMissingIndices G k e0 input T phi ett base C ctx := by - exact @helper_advance_2571 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@hsituation) (@hvertexMissing) (@i) (@componentData) (@trans) (@common) (@starEq) - (@hAT) (@hlen) (@hBT) (@fullB) (@elementary) (@vertexMem) (@firstAt) (@stageSwitch) - (@gammaTransport) (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) - (@gammaChoice) (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored) + exact (helper_advance_481 (@G) (@k) + (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@hsituation) (@hvertexMissing) + (@i) (@P) (@alpha) (@componentData) (@trans) (@common) (@starEq) (@hAT) (@hlen) (@hBT) + (@fullB) (@elementary) (@vertexMem) (@firstAt) (@stageSwitch) (@gammaTransport) + (@gammaUnused) (@outsideA) (@notRaw) (@tailException) (@consecutive) (@gammaChoice) + (@m) (@hmLower) (@hmUpper) (@P) (@alpha) (@ha) (@haLast) (@hAlphaStored)) exact advance i (by simpa only [hsituation] using hiLower) hiUpper P alpha hcommon.1 hcommon.2 houtside diff --git a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean index b8fbf2a39e..431f56b0ce 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationOneShorteningContradiction.lean @@ -5,14 +5,14 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningTransport +public import LeanPool.GoldbergSeymour.EligibleIndexBoundPreparation + public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement public import LeanPool.GoldbergSeymour.HierarchyCounterexampleTailAtLeastTwo public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices -public import LeanPool.GoldbergSeymour.TerminalRoute /-! # Hierarchy Situation One Shortening Contradiction @@ -398,7 +398,7 @@ private noncomputable abbrev helperK358.{u_1, u_2} : dividerStage := HB.dividerStage coreInsideFirst := HB.coreInsideFirst } -private abbrev helperLastStar3754Conditions.{u_1, u_2} : Prop := +private abbrev helperContinuation6826Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) @@ -410,39 +410,57 @@ private abbrev helperLastStar3754Conditions.{u_1, u_2} : Prop := let old : HierarchyCounterexample P.replacementBase := P.counterexample; let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); + ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (htail : (2 : ℕ) ≤ T.length - A.length) + (trans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) + (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); + ∀ (hBlength : B.length = T.length - (1 : ℕ)) (hXlength : X.length = T.length - (2 : ℕ)) + (hBT : TreeSequenceInitialSegment B T) (hXB : TreeSequenceInitialSegment X B) + (hTnX : TreeSequenceInitialSegment Tn X), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + ∀ + (consecutive : + ∀ (t : Fin T.length) (ht : A.length + (1 : ℕ) ≤ (↑t : ℕ)), + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) + (hyf : Incident G y f) (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length) (beta : Fin k) + (hbetaF : mu f = some beta) (z : V) (hzB : z ∈ TreeSequenceVertexSet B) + (hbetaz : beta ∈ MissingColors G mu z) (hzy : z ≠ y) (hzX : z ∈ TreeSequenceVertexSet X) + (hab : alpha ≠ beta), let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) + ∀ (fixed : ∀ (e : E) (hef : e ≠ f), sigma e = mu e) + (missingFixed : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet X), + MissingColors G sigma v = MissingColors G mu v) + (fixedB : ∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) + (missingTree : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U) + (minusEq : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) + (R : Finset (Fin k)), + TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R) + (lastPositive : + ∀ (hq : H.dividerCount ≠ (0 : ℕ)), + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) + (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) (aboveB : TreeSequenceInitialSegment (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) B) (strictB : (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < B.length) (belowB : @@ -458,7 +476,8 @@ private abbrev helperLastStar3754Conditions.{u_1, u_2} : Prop := { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } mu) (HB : @@ -466,33 +485,58 @@ private abbrev helperLastStar3754Conditions.{u_1, u_2} : Prop := { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB) - (hcountB : HB.dividerCount = H.dividerCount), - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HB.stage j.castSucc = - H.stage - (Fin.cast - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega) - j).castSucc ∧ - HierarchyStarredStage HB j = - HierarchyStarredStage H - (Fin.cast - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega) - j)) → + (hcountB : HB.dividerCount = H.dividerCount) + (hstagesB : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HB.stage j.castSucc = H.stage (Fin.cast (by omega) j).castSucc ∧ + HierarchyStarredStage HB j = HierarchyStarredStage H (Fin.cast (by omega) j)) + (goodB : GoodHierarchy HB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) + ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) + (closureBX : + ∀ (hpe : EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE), + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) + (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (hmaximum : MaximumProperty corr.replacementETT) + (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) + (hpe : + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) + (hclosure : + { + rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) (baseStageK : HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) @@ -505,30 +549,16 @@ private abbrev helperLastStar3754Conditions.{u_1, u_2} : Prop := (HB.stage j.castSucc).length < (HB.stage j.succ).length) (coreInsideK : TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) (increasingK : ∀ (i j : Fin HB.dividerCount), (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) (dividerStageK : ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), let KF : TashkinovHierarchy corr.replacementETT bs := { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, @@ -536,11 +566,23 @@ private abbrev helperLastStar3754Conditions.{u_1, u_2} : Prop := dividerPosition := HB.dividerPosition, dividerPositive := positiveK, dividerIncreasing := increasingK, dividerStage := dividerStageK, coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - HierarchyStarredStage KF (Fin.last KF.dividerCount) = A + ∀ + (starredEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) + (stageBX : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + TreeSequenceInitialSegment (HB.stage j.castSucc) X) + (allStageB : + ∀ (j : Fin (HB.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (HB.stage j) B) + (terminalTree : + corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn) + (storedEq : + ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j), + False -private abbrev helperHpS3760Conditions.{u_1, u_2} : Prop := +private abbrev helperContinuation7103Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) @@ -552,3685 +594,124 @@ private abbrev helperHpS3760Conditions.{u_1, u_2} : Prop := let old : HierarchyCounterexample P.replacementBase := P.counterexample; let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; let mu : PartialEdgeColoring E k := P.coloring; - (2 : ℕ) ≤ T.length - A.length → + ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (htail : (2 : ℕ) ≤ T.length - A.length) + (trans : + ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) + (hYZ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) + (chain : + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) + (coreA : TreeSequenceInitialSegment P.replacementBase.core A) + (hTnA : TreeSequenceInitialSegment Tn A) (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); + let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); + ∀ (hBlength : B.length = T.length - (1 : ℕ)) (hXlength : X.length = T.length - (2 : ℕ)) + (hBT : TreeSequenceInitialSegment B T) (hAX : TreeSequenceInitialSegment A X) + (hXB : TreeSequenceInitialSegment X B) (hTnX : TreeSequenceInitialSegment Tn X) + (hAB : TreeSequenceInitialSegment A B), + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); + let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + let w : V := T.vertex (Fin.last T.length); + ∀ + (consecutive : + ∀ (t : Fin T.length) (ht : A.length + (1 : ℕ) ≤ (↑t : ℕ)), + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) + (hends : G.ends f = s(y, w)) (hyf : Incident G y f) (S : TreeSequence G e0) + (hSBlen : S.length ≤ B.length) (beta : Fin k) (hbetaF : mu f = some beta) (z : V) + (hzB : z ∈ TreeSequenceVertexSet B) (hbetaz : beta ∈ MissingColors G mu z) (hzy : z ≠ y) + (hzX : z ∈ TreeSequenceVertexSet X) (hab : alpha ≠ beta), + let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + ∀ (fixed : ∀ (e : E) (hef : e ≠ f), sigma e = mu e) (hsproper : IsProperEdgeColoring G sigma) + (hsone : IsOneEdgeUncolored sigma e0) + (incidentFixed : ∀ (e : E) (he : TreeIncidentEdge X e), sigma e = mu e) + (missingFixed : + ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet X), + MissingColors G sigma v = MissingColors G mu v) + (fixedB : ∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) + (stable : + StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) + (P.corresponding.replacementETT.series.data.coloring n) sigma) + (hrouteB : + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B ∨ + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = ({ edge } : Finset E) ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ TashkinovAugmentationSequence sigma seed B) + (missingTree : + ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), + TreeMissingColors sigma U = TreeMissingColors mu U), + False + +private theorem helper_hdata_485.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := + Fin.last P.corresponding.replacementETT.rounds; + let Tn : TreeSequence G e0 := + P.corresponding.replacementETT.series.data.tree n.castSucc; + let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = (1 : ℕ) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → ∀ (hlenT : (3 : ℕ) ≤ T.length), let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - B.length = T.length - (1 : ℕ) → - TreeSequenceInitialSegment B T → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); + TreeSequencePrefix T (T.length - (1 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); let f : E := T.edge r; - (∀ (t : Fin T.length), - A.length + (1 : ℕ) ≤ (↑t : ℕ) → - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) → - ∀ (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length) (beta : Fin k), - alpha ≠ beta → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (H.dividerCount ≠ (0 : ℕ) → - A = - H.stage - (⟨H.dividerCount, by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB belowB - generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { - dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - HierarchyStarredStage KF (Fin.last KF.dividerCount) = A → - HierarchyPathNumber KF = (1 : ℕ) - -private abbrev helperUniqueRefresh4832Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement - (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - have := - GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement - (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) - have := aboveB.1 - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (goodB : GoodHierarchy HB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB belowB - generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - have := - GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement - (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) - have := aboveB.1 - have := belowB.1 - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - have := - GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement - (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) - have := Fin.isLt i - have := aboveB.1 - have := belowB.1 - have := coreInsideK.1 - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - have := - GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement - (GoldbergSeymour.HierarchyReplacementPresentation.corresponding P) - have := Fin.isLt i - have := aboveB.1 - have := belowB.1 - have := coreInsideK.1 - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { - dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) X) → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) → - ∀ (i : Fin KF.dividerCount), - ∃! eta : Fin k, - eta ∈ HierarchyStoredColorsAt KF i.succ ∧ - (goodB.gamma i.succ eta ⊆ - (TreeSequenceVertexSet (KF.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) ∧ - ∀ theta ∈ HierarchyStoredColorsAt KF i.succ, - theta ≠ eta → goodB.gamma i.succ theta = goodB.gamma i.castSucc theta - -private abbrev helperTerminalStored5253Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); - let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); - ∀ (hTnX : TreeSequenceInitialSegment Tn X), - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length), - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ - (missingTree : - ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), - TreeMissingColors sigma U = TreeMissingColors mu U) - (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB belowB - generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (hmaximum : MaximumProperty corr.replacementETT) - (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) - (hpe : - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind - (Fin.last - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) - (hclosure : - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { - dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (hstage : - HB.stage ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }.stage) - (hposition : - HB.dividerPosition ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.dividerPosition) - (starredEq : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) - (terminalTree : - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn), - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - TashkinovStoredColors EB.series.data (Fin.last EB.rounds) - -private abbrev helperLastStar5360Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (hcountB : HB.dividerCount = H.dividerCount) - (hstagesB : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HB.stage j.castSucc = H.stage (Fin.cast (by omega) j).castSucc ∧ - HierarchyStarredStage HB j = HierarchyStarredStage H (Fin.cast (by omega) j)), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB belowB - generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { - dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (starredEq : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j), - HierarchyStarredStage KF (Fin.last KF.dividerCount) = A - -private abbrev helperHpS5366Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (htail : (2 : ℕ) ≤ T.length - A.length) (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); - ∀ (hBlength : B.length = T.length - (1 : ℕ)) (hBT : TreeSequenceInitialSegment B T), - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - ∀ - (consecutive : - ∀ (t : Fin T.length) (ht : A.length + (1 : ℕ) ≤ (↑t : ℕ)), - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) - (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length) (beta : Fin k) (hab : alpha ≠ beta), - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ - (lastPositive : - ∀ (hq : H.dividerCount ≠ (0 : ℕ)), - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB belowB - generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { - dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ (lastStar : HierarchyStarredStage KF (Fin.last KF.dividerCount) = A), - HierarchyPathNumber KF = (1 : ℕ) - -private abbrev helperContinuation6826Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (htail : (2 : ℕ) ≤ T.length - A.length) - (trans : - ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) - (hYZ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) - (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); - let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); - ∀ (hBlength : B.length = T.length - (1 : ℕ)) (hXlength : X.length = T.length - (2 : ℕ)) - (hBT : TreeSequenceInitialSegment B T) (hXB : TreeSequenceInitialSegment X B) - (hTnX : TreeSequenceInitialSegment Tn X), - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - let y : V := B.vertex (Fin.last B.length); - ∀ - (consecutive : - ∀ (t : Fin T.length) (ht : A.length + (1 : ℕ) ≤ (↑t : ℕ)), - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) - (hyf : Incident G y f) (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length) (beta : Fin k) - (hbetaF : mu f = some beta) (z : V) (hzB : z ∈ TreeSequenceVertexSet B) - (hbetaz : beta ∈ MissingColors G mu z) (hzy : z ≠ y) (hzX : z ∈ TreeSequenceVertexSet X) - (hab : alpha ≠ beta), - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (fixed : ∀ (e : E) (hef : e ≠ f), sigma e = mu e) - (missingFixed : - ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet X), - MissingColors G sigma v = MissingColors G mu v) - (fixedB : ∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) - (missingTree : - ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), - TreeMissingColors sigma U = TreeMissingColors mu U) - (minusEq : - ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) - (R : Finset (Fin k)), - TreeColorSetMinusClosed G sigma U R ↔ TreeColorSetMinusClosed G mu U R) - (lastPositive : - ∀ (hq : H.dividerCount ≠ (0 : ℕ)), - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) - (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (hcountB : HB.dividerCount = H.dividerCount) - (hstagesB : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HB.stage j.castSucc = H.stage (Fin.cast (by omega) j).castSucc ∧ - HierarchyStarredStage HB j = HierarchyStarredStage H (Fin.cast (by omega) j)) - (goodB : GoodHierarchy HB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB belowB - generatingB; - ∀ (coreBX : TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X) - (closureBX : - ∀ (hpe : EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE), - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) - (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (hmaximum : MaximumProperty corr.replacementETT) - (bs : HierarchyBase corr.replacementETT sigma) (hcore : baseB.core = bs.core) - (hpe : - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind - (Fin.last - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) - (hclosure : - { - rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { - dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (starredEq : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) - (stageBX : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) X) - (allStageB : - ∀ (j : Fin (HB.dividerCount + (2 : ℕ))), TreeSequenceInitialSegment (HB.stage j) B) - (terminalTree : - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn) - (storedEq : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j), - False - -private abbrev helperContinuation7103Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hp : HierarchyPathNumber H = (1 : ℕ)) (htail : (2 : ℕ) ≤ T.length - A.length) - (trans : - ∀ {X Y Z : TreeSequence G e0} (hXY : TreeSequenceInitialSegment X Y) - (hYZ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) - (chain : - ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), - (↑i : ℕ) ≤ j → - TreeSequenceInitialSegment (H.stage i) (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) - (coreA : TreeSequenceInitialSegment P.replacementBase.core A) - (hTnA : TreeSequenceInitialSegment Tn A) (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by omega) (by omega); - let X : TreeSequence G e0 := TreeSequencePrefix T (T.length - (2 : ℕ)) (by omega) (by omega); - ∀ (hBlength : B.length = T.length - (1 : ℕ)) (hXlength : X.length = T.length - (2 : ℕ)) - (hBT : TreeSequenceInitialSegment B T) (hAX : TreeSequenceInitialSegment A X) - (hXB : TreeSequenceInitialSegment X B) (hTnX : TreeSequenceInitialSegment Tn X) - (hAB : TreeSequenceInitialSegment A B), - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - let y : V := B.vertex (Fin.last B.length); - let w : V := T.vertex (Fin.last T.length); - ∀ - (consecutive : - ∀ (t : Fin T.length) (ht : A.length + (1 : ℕ) ≤ (↑t : ℕ)), - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) - (hends : G.ends f = s(y, w)) (hyf : Incident G y f) (S : TreeSequence G e0) - (hSBlen : S.length ≤ B.length) (beta : Fin k) (hbetaF : mu f = some beta) (z : V) - (hzB : z ∈ TreeSequenceVertexSet B) (hbetaz : beta ∈ MissingColors G mu z) (hzy : z ≠ y) - (hzX : z ∈ TreeSequenceVertexSet X) (hab : alpha ≠ beta), - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (fixed : ∀ (e : E) (hef : e ≠ f), sigma e = mu e) (hsproper : IsProperEdgeColoring G sigma) - (hsone : IsOneEdgeUncolored sigma e0) - (incidentFixed : ∀ (e : E) (he : TreeIncidentEdge X e), sigma e = mu e) - (missingFixed : - ∀ (v : V) (hv : v ∈ TreeSequenceVertexSet X), - MissingColors G sigma v = MissingColors G mu v) - (fixedB : ∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) - (stable : - StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) - (P.corresponding.replacementETT.series.data.coloring n) sigma) - (hrouteB : - P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence sigma Tn B ∨ - (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ - P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.RE) ∧ - ∃ (edge : E) (seed : TreeSequence G e0), - P.corresponding.replacementETT.series.data.connectingEdges n = ({ edge } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn edge seed ∧ TashkinovAugmentationSequence sigma seed B) - (missingTree : - ∀ (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), - TreeMissingColors sigma U = TreeMissingColors mu U), - False - -private theorem helper_hdata_485.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - HierarchyPathNumber H = (1 : ℕ) → - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - IsProperEdgeColoring G sigma → - IsOneEdgeUncolored sigma e0 → - (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → - (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → - StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) - (P.corresponding.replacementETT.series.data.coloring n) sigma → - (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence sigma Tn B ∨ - (P.corresponding.replacementETT.series.data.kind n = - some TashkinovExtensionKind.SE ∨ - P.corresponding.replacementETT.series.data.kind n = - some TashkinovExtensionKind.RE) ∧ - ∃ (edge : E) (seed : TreeSequence G e0), - P.corresponding.replacementETT.series.data.connectingEdges n = { edge } ∧ - TreeSequenceAdjoinEdge Tn edge seed ∧ - TashkinovAugmentationSequence sigma seed B) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)), - MaximumProperty - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } → - ∀ - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; - (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → - ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), - MaximumProperty corr.replacementETT ∧ - ∃ (bs : HierarchyBase corr.replacementETT sigma) (K : - TashkinovHierarchy corr.replacementETT bs), SameHierarchyStages HB K := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp trans hlenT B X r - f S hSBlen sigma hsproper hsone incidentFixed missingFixed stable hrouteB positiveB aboveB - strictB belowB generatingB hmaxB baseB HB EB closureBX - by_cases hpe : EB.series.data.kind (Fin.last EB.rounds) = - some TashkinovExtensionKind.PE - · have hb : TashkinovAugmentationSequence sigma Tn B := by - rcases hrouteB with h | h - · exact h.2 - · rcases h.1 with h | h <;> rw [hpe] at h <;> cases h - have hcomb : CombinedStableColoring Tn baseB.closure - (TashkinovStoredColors EB.series.data (Fin.last EB.rounds)) mu sigma := by - refine ⟨?_, ?_⟩ - · have hh := stable - change StableColoring Tn - (TashkinovStoredColors EB.series.data (Fin.last EB.rounds)) - (P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) sigma at hh - rw [← P.corresponding.replacementETT.generatingColoring] at hh - exact hh - · refine ⟨?_, ?_⟩ - · intro edge he _ - obtain ⟨v, hv, hi⟩ := he - exact incidentFixed edge ⟨v, closureBX hpe hv, hi⟩ - · intro v hv - exact missingFixed v (closureBX hpe hv) - exact HierarchySplitter G k e0 P.corresponding.replacementInput B mu sigma EB - hmaxB old.positive P.minimumContext.lowerRung baseB HB hpe - P.minimumContext.proper P.minimumContext.oneEdgeUncolored hsproper hsone hcomb hb - · have hmodB := Td G k e0 P.corresponding.replacementInput B mu EB hmaxB - old.positive P.minimumContext.lowerRung sigma hsproper hsone stable - obtain ⟨corr⟩ := hmodB.2.2 B aboveB strictB hrouteB - have hmaximum := MaximumPropertyTransport G k e0 EB sigma hmodB B corr hmaxB - have terminalTree : corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc = Tn := by - rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ - rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ - cases hr - have hs : data = rs := eq_of_heq hp - cases hs - let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ - have hj : j.succ = Fin.last EB.rounds := Fin.ext (by - dsimp [j]; have := EB.roundsPositive; omega) - change rs.data.tree (Fin.last EB.rounds).castSucc = - EB.series.data.tree (Fin.last EB.rounds).castSucc - rw [← hj] - exact hl j - have terminalKind : corr.replacementETT.series.data.kind - (Fin.last corr.replacementETT.rounds) = EB.series.data.kind (Fin.last EB.rounds) := by - rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ - rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ - cases hr - have hs : data = rs := eq_of_heq hp - cases hs - exact hk _ - let bs : HierarchyBase corr.replacementETT sigma := by - exact @helperBs231 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) (@trans) - (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@hpe) - (@corr) (@terminalTree) (@terminalKind) - let K : TashkinovHierarchy corr.replacementETT bs := by - exact @helperK358 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) (@trans) - (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) - (@hpe) (@corr) (@terminalTree) (@terminalKind) - refine ⟨corr, hmaximum, bs, K, rfl, rfl, heq_of_eq rfl, heq_of_eq rfl, ?_, ?_⟩ - · exact ⟨fun h => (hpe h).elim, fun h => (hpe (terminalKind.symm.trans h)).elim⟩ - · intro _; rfl - -private theorem helper_coreA_353.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - (∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), - (↑i : ℕ) ≤ j → - TreeSequenceInitialSegment (H.stage i) - (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - TreeSequenceInitialSegment P.replacementBase.core A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A trans chain - by_cases hq : H.dividerCount = 0 - · have he : A = P.replacementBase.core := by - simp [A, HierarchyStarredStage, hq, Fin.last] - rw [he] - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - · have he : A = H.stage ⟨H.dividerCount, by omega⟩ := by - unfold A HierarchyStarredStage - obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) - · have hv := congrArg Fin.val hz - simp only [Fin.val_last, Fin.val_zero] at hv - contradiction - · rw [hi] - simp only [Fin.cases_succ] - congr 1 - apply Fin.ext - have hv := congrArg Fin.val hi - simp only [Fin.val_last, Fin.val_succ] at hv - exact hv.symm - rw [he] - exact trans H.coreInsideFirst (chain H.dividerCount (by omega) ⟨1, by omega⟩ - (by change 1 ≤ H.dividerCount; omega)) - -private theorem helper_hsproper_482.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ∀ alpha ∈ MissingColors G P.coloring (T.vertex (Fin.last T.length)), - let mu : PartialEdgeColoring E k := P.coloring; - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); - alpha ∈ MissingColors G mu (B.vertex (Fin.last B.length)) → - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - let y : V := B.vertex (Fin.last B.length); - let w : V := T.vertex (Fin.last T.length); - G.ends f = s(y, w) → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (e : E), e ≠ f → sigma e = mu e) → - IsProperEdgeColoring G sigma := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha haT mu trans hlenT B halphaB r f y - w hends sigma fixed e g c heg hadj he hg - by_cases hef : e = f - · subst e - have hgf : g ≠ f := heg.symm - have hc : c = alpha := by simpa [sigma] using he.symm - subst c - rw [fixed g hgf] at hg - obtain ⟨v, hvf, hvg⟩ := hadj - have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf - rcases hv with rfl | rfl - · exact (Finset.mem_sdiff.mp halphaB).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) - · exact (Finset.mem_sdiff.mp haT).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, g, hvg, hg⟩) - · by_cases hgf : g = f - · subst g - have hc : c = alpha := by simpa [sigma] using hg.symm - subst c - rw [fixed e hef] at he - obtain ⟨v, hve, hvf⟩ := hadj - have hv : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hvf - rcases hv with rfl | rfl - · exact (Finset.mem_sdiff.mp halphaB).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) - · exact (Finset.mem_sdiff.mp haT).2 - (Finset.mem_filter.mpr ⟨Finset.mem_univ _, e, hve, he⟩) - · exact P.minimumContext.proper heg hadj ((fixed e hef).symm.trans he) - ((fixed g hgf).symm.trans hg) - -private theorem helper_terminalStored_720.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - HierarchyPathNumber H = (1 : ℕ) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); - TreeSequenceInitialSegment Tn X → - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (U : TreeSequence G e0), - TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → - TreeMissingColors sigma U = TreeMissingColors mu U) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), - MaximumProperty corr.replacementETT → - ∀ (bs : HierarchyBase corr.replacementETT sigma), - baseB.core = bs.core → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) → - ∀ - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - HB.stage ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.stage → - HB.dividerPosition ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.dividerPosition → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = - Tn → - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f - S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr - hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK - positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree - rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ - rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ - cases hr - have hs : data = rs := eq_of_heq hp - cases hs - let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ - have hj : j.succ = Fin.last EB.rounds := Fin.ext (by - dsimp [j]; have := EB.roundsPositive; omega) - have ht : rs.data.tree (Fin.last EB.rounds).castSucc = Tn := by - change rs.data.tree (Fin.last EB.rounds).castSucc = - EB.series.data.tree (Fin.last EB.rounds).castSucc - rw [← hj]; exact hl j - have hm : TreeMissingColors (rs.data.coloring (Fin.last EB.rounds)) - (rs.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by - rw [← hc, ht] - exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX) - have hmOld : TreeMissingColors (EB.series.data.coloring (Fin.last EB.rounds)) - (EB.series.data.tree (Fin.last EB.rounds).castSucc) = TreeMissingColors mu Tn := by - rw [← EB.generatingColoring] - change TashkinovStoredColors rs.data (Fin.last EB.rounds) = - TashkinovStoredColors EB.series.data (Fin.last EB.rounds) - simp only [TashkinovStoredColors, hstored, hm, hmOld] - -private theorem helper_hpS_917.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - let mu : PartialEdgeColoring E k := P.coloring; - (2 : ℕ) ≤ T.length - A.length → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); - B.length = T.length - (1 : ℕ) → - TreeSequenceInitialSegment B T → - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - (∀ (t : Fin T.length), - A.length + (1 : ℕ) ≤ (↑t : ℕ) → - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) → - ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length) (beta : Fin k), - alpha ≠ beta → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (H.dividerCount ≠ (0 : ℕ) → - A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - HierarchyStarredStage KF (Fin.last KF.dividerCount) = A → - HierarchyPathNumber KF = (1 : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu htail hlenT B hBlength - hBT r f consecutive S hSBlen beta hab sigma lastPositive positiveB aboveB strictB belowB - generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK coreInsideK - positiveK increasingK dividerStageK KF lastStar - let candidates := (Finset.Icc 1 (B.length - A.length)).filter fun i => - ∀ t : Fin B.length, A.length + i ≤ t.val → - G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) - have hm : 1 ∈ candidates := by - refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨le_rfl, by omega⟩, ?_⟩ - intro t ht - rw [← hBT.2.2 t] - have hc := consecutive (Fin.castLE hBT.1 t) ht - have hv1 : (Fin.castLE hBT.1 t).castSucc = - Fin.castLE (Nat.succ_le_succ hBT.1) t.castSucc := Fin.ext rfl - have hv2 : (Fin.castLE hBT.1 t).succ = - Fin.castLE (Nat.succ_le_succ hBT.1) t.succ := Fin.ext rfl - rw [hv1, hv2, hBT.2.1 t.castSucc, hBT.2.1 t.succ] at hc - exact hc - have hn : candidates.Nonempty := ⟨1, hm⟩ - have hlo := (Finset.mem_Icc.mp (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).1).1 - have hhi := Finset.min'_le candidates 1 hm - unfold HierarchyPathNumber - dsimp only - rw [lastStar] - change (if h : candidates.Nonempty then candidates.min' h else B.length - A.length) = 1 - rw [dite_eq_left hn] - omega - -private theorem helper_chain_747.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), - (↑i : ℕ) ≤ j → - TreeSequenceInitialSegment (H.stage i) - (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H trans j - induction j with - | zero => - intro hj i hi - have he : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) - subst i - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - | succ j ih => - intro hj i hi - by_cases heq : i.val = j + 1 - · have he : i = ⟨j + 1, hj⟩ := Fin.ext heq - subst i - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - · exact trans (ih (by omega) i (by omega)) (H.nested ⟨j, by omega⟩) - -private theorem helper_consecutive_824.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - HierarchyPathNumber H = (1 : ℕ) → - (2 : ℕ) ≤ T.length - A.length → - (3 : ℕ) ≤ T.length → - ∀ (t : Fin T.length), - A.length + (1 : ℕ) ≤ (↑t : ℕ) → - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A hp htail hlenT t ht - let candidates := (Finset.Icc 1 (T.length - A.length)).filter fun i => - ∀ t : Fin T.length, A.length + i ≤ t.val → - G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) - have hp' := hp - change (if h : candidates.Nonempty then candidates.min' h else T.length - A.length) = 1 at hp' - have hn : candidates.Nonempty := by - by_contra hn - have hp'' : T.length - A.length = 1 := by - simpa only [dite_eq_right hn] using hp' - omega - have hm : candidates.min' hn = 1 := by - simpa only [dite_eq_left hn] using hp' - have hc := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 - rw [hm] at hc - exact hc t ht - -private theorem helper_noInc_902.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); - X.length = T.length - (2 : ℕ) → - TreeSequenceInitialSegment X T → - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - let y : V := B.vertex (Fin.last B.length); - let w : V := T.vertex (Fin.last T.length); - T.vertex r.castSucc = y → - G.ends f = s(y, w) → - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - ∀ (beta : Fin k), - alpha ≠ beta → - ∀ v ∈ TreeSequenceVertexSet X, - ¬Incident G v f := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha trans hlenT B X hXlength hXT r f y - w hy hends S hSBlen beta hab v hv - obtain ⟨j, hj⟩ : ∃ j, X.vertex j = v := by simpa [TreeSequenceVertexSet] using hv - intro hi - have hv' : v = y ∨ v = w := by simpa only [Incident, hends, Sym2.mem_iff] using hi - rcases hv' with he | he - · have hh := T.vertex_injective ((hXT.2.1 j).trans (hj.trans (he.trans hy.symm))) - have hh := congrArg Fin.val hh - have hj := j.isLt - change j.val = T.length - 1 at hh - change j.val < X.length + 1 at hj - omega - · have hh := T.vertex_injective ((hXT.2.1 j).trans (hj.trans he)) - have hh := congrArg Fin.val hh - have hj := j.isLt - change j.val = T.length at hh - change j.val < X.length + 1 at hj - omega - -private theorem helper_hrouteB_951.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (2 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (2 : ℕ) ≤ T.length) ↦ by omega); - B.length = T.length - (1 : ℕ) → - X.length = T.length - (2 : ℕ) → - TreeSequenceInitialSegment B T → - (∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S W → - TreeSequenceInitialSegment U W → - S.length ≤ U.length → TreeSequenceInitialSegment S U) → - TreeSequenceInitialSegment X B → - TreeSequenceInitialSegment Tn X → - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0) (hSBlen : S.length ≤ B.length), - TashkinovAugmentationSequence mu S T → - TreeSequenceInitialSegment - (TreeSequencePrefix T (↑r : ℕ) - (le_trans S.positive - (id - (Eq.mp - (congrArg (LE.le S.length) - (congrArg TreeSequence.length - (TreeSequencePrefix.eq_1 T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ - by omega) - (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ - by omega)))) - hSBlen))) - (Nat.le_of_lt r.isLt)) - (TreeSequencePrefix T ((↑r : ℕ) + (1 : ℕ)) - (by omega) - (Nat.succ_le_of_lt r.isLt)) → - ∀ (beta : Fin k), - alpha ≠ beta → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → - (∀ (t : Fin B.length), sigma (B.edge t) = mu (B.edge t)) → - P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ - TashkinovAugmentationSequence sigma Tn B ∨ - (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.SE ∨ - P.corresponding.replacementETT.series.data.kind n = - some TashkinovExtensionKind.RE) ∧ - ∃ (edge : E) (seed : TreeSequence G e0), - P.corresponding.replacementETT.series.data.connectingEdges n = { edge } ∧ - TreeSequenceAdjoinEdge Tn edge seed ∧ TashkinovAugmentationSequence sigma seed B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu trans hlenT B X hBlength - hXlength hBT common hXB hTnX r f S hSBlen hseq hpre beta hab sigma missingFixed fixedB - rcases P2813_T1_TerminalRoute G k e0 P.corresponding.replacementInput T mu - P.corresponding.replacementETT with ⟨hpe, hseq⟩ | - ⟨hkind, edge, seed, hedges, hseed, hincident, hcontrol, hseq⟩ - · have hpre := TashkinovAugmentationSequenceRestrict mu Tn B T hseq - (trans hTnX hXB) hBT - exact Or.inl ⟨hpe, TashkinovAugmentationSequenceColoringTransport mu sigma - Tn X B hpre hXB (by omega) (fun t _ => fixedB t) missingFixed⟩ - · have hseedLen : seed.length = Tn.length + 1 := hseed.1 - have hseedB := common - (TashkinovAugmentationSequenceInitialSegment mu seed T hseq) hBT - (by have := hTnX.1; omega) - have hpre := TashkinovAugmentationSequenceRestrict mu seed B T hseq hseedB hBT - exact Or.inr ⟨hkind, edge, seed, hedges, hseed, - TashkinovAugmentationSequenceColoringTransport mu sigma seed X B hpre hXB - (by omega) (fun t _ => fixedB t) missingFixed⟩ - -private theorem helper_terminalTree_1082.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - HierarchyPathNumber H = (1 : ℕ) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), - MaximumProperty corr.replacementETT → - ∀ (bs : HierarchyBase corr.replacementETT sigma), - baseB.core = bs.core → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) → - ∀ - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - HB.stage ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.stage → - HB.dividerPosition ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.dividerPosition → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B r f S - hSBlen sigma positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore - hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK - dividerStageK KF hstage hposition starredEq - rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ - rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ - cases hr - have hs : data = rs := eq_of_heq hp - cases hs - let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ - have hj : j.succ = Fin.last EB.rounds := Fin.ext (by - dsimp [j]; have := EB.roundsPositive; omega) - change rs.data.tree (Fin.last EB.rounds).castSucc = - EB.series.data.tree (Fin.last EB.rounds).castSucc - rw [← hj] - exact hl j - -private theorem helper_firstEq_1146.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) - (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); - B.length = T.length - (1 : ℕ) → - let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (_ : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - (∀ (j : Fin (B.length + (1 : ℕ))), - (↑j : ℕ) < B.length → - MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j)) → - (∀ (psi : PartialEdgeColoring E k) (c : Fin k) (j : Fin (B.length + (1 : ℕ))), - c ∈ MissingColors G psi (B.vertex j) → - (↑(HierarchyFirstMissingPosition psi B c) : ℕ) ≤ (↑j : ℕ)) → - (∀ (psi : PartialEdgeColoring E k) (c : Fin k), - (↑(HierarchyFirstMissingPosition psi B c) : ℕ) < B.length → - c ∈ MissingColors G psi (B.vertex (HierarchyFirstMissingPosition psi B c))) → - ∀ (c : Fin k), - HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B hBlength r f S hSBlen - sigma positiveB aboveB strictB belowB generatingB baseB HB earlyMissing firstLe firstMem c - apply Fin.ext - apply Nat.le_antisymm - · by_contra hn - have hlt : (HierarchyFirstMissingPosition mu B c).val < B.length := by - have := (HierarchyFirstMissingPosition sigma B c).isLt - omega - have hm := firstMem mu c hlt - rw [← earlyMissing _ hlt] at hm - have := firstLe sigma c _ hm - omega - · by_contra hn - have hlt : (HierarchyFirstMissingPosition sigma B c).val < B.length := by - have := (HierarchyFirstMissingPosition mu B c).isLt - omega - have hm := firstMem sigma c hlt - rw [earlyMissing _ hlt] at hm - have := firstLe mu c _ hm - omega - -private theorem helper_hTnCore_1512.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - TreeSequenceInitialSegment Tn P.replacementBase.core := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P n Tn - by_cases hpe : P.corresponding.replacementETT.series.data.kind n = - some TashkinovExtensionKind.PE - · exact (P.replacementBase.parallel hpe).2.2.some.leftSegment - · rw [P.replacementBase.nonparallel hpe] - exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ - -private theorem helper_common_1530.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E), - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ {S U W : TreeSequence G e0}, - TreeSequenceInitialSegment S W → - TreeSequenceInitialSegment U W → - S.length ≤ U.length → - TreeSequenceInitialSegment S U := by - classical - intro V E G e0 trans S U W hSW hUW hlen - refine ⟨hlen, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) - -private theorem helper_hfull_1543.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - HierarchyStarredStage C.hierarchy (Fin.last C.hierarchy.dividerCount) = A → - (2 : ℕ) ≤ T.length - A.length → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)) = B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A hAold htail hlenT B - have hnum : min ((HierarchyStarredStage C.hierarchy - (Fin.last C.hierarchy.dividerCount)).length + - (HierarchyFullTailLength C - 1)) T.length = T.length - 1 := by - unfold HierarchyFullTailLength - dsimp only - rw [hAold] - omega - simp only [HierarchyFullTailPrefix, hnum] - rfl - -private theorem helper_hsource_1573.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - B.length = T.length - (1 : ℕ) → - X.length = T.length - (2 : ℕ) → - TreeSequenceInitialSegment Tn X → - ∃ (S : TreeSequence G e0), - S.length ≤ B.length ∧ TashkinovAugmentationSequence mu S T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P n Tn mu hlenT B X hBlength hXlength hTnX - rcases P2813_T1_TerminalRoute G k e0 P.corresponding.replacementInput T mu - P.corresponding.replacementETT with ⟨hpe, hseq⟩ | - ⟨hkind, edge, seed, hedges, hseed, hincident, hcontrol, hseq⟩ - · exact ⟨Tn, by have := hTnX.1; omega, hseq⟩ - · have hseedLen : seed.length = Tn.length + 1 := hseed.1 - exact ⟨seed, by have := hTnX.1; omega, hseq⟩ - -private theorem helper_hzy_1590.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let y : V := B.vertex (Fin.last B.length); - Incident G y f → - ∀ (beta : Fin k), - mu f = some beta → - ∀ z ∈ TreeSequenceVertexSet B, - beta ∈ MissingColors G mu z → - z ≠ y := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B r f y hyf beta hbetaF z hzB - hbetaz he - subst z - have hnot : beta ∉ MissingColors G mu y := by - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] - exact fun h => h (Finset.mem_filter.mpr ⟨Finset.mem_univ _, f, hyf, hbetaF⟩) - exact hnot hbetaz - -private theorem helper_hzX_1597.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - B.length = T.length - (1 : ℕ) → - X.length = T.length - (2 : ℕ) → - let y : V := B.vertex (Fin.last B.length); - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - ∀ z ∈ TreeSequenceVertexSet B, - z ≠ y → - z ∈ TreeSequenceVertexSet X := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P trans hlenT B X hBlength hXlength y S - hSBlen z hzB hzy - obtain ⟨j, hj⟩ : ∃ j, B.vertex j = z := by simpa [TreeSequenceVertexSet] using hzB - have hjlt : j.val < B.length := by - by_contra hh - have he : j = Fin.last B.length := Fin.ext - (by simpa using Nat.le_antisymm (Nat.le_of_lt_succ j.isLt) (Nat.le_of_not_gt hh)) - exact hzy (hj.symm.trans (congrArg B.vertex he)) - let jX : Fin (X.length + 1) := ⟨j.val, by omega⟩ - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - exact ⟨jX, hj⟩ - -private theorem helper_hfe0_1615.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - ∀ (beta : Fin k), - alpha ≠ beta → - f ≠ e0 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha trans hlenT B r f S hSBlen beta hab he - have hh := T.edge_injective (he.trans T.first_edge.symm) - have hv := congrArg Fin.val hh - dsimp [r] at hv - omega - -private theorem helper_hsone_1621.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (e : E), e ≠ f → sigma e = mu e) → - f ≠ e0 → - IsOneEdgeUncolored sigma e0 := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT r f sigma fixed hfe0 - refine ⟨?_, ?_⟩ - · rw [fixed e0 hfe0.symm] - exact P.minimumContext.oneEdgeUncolored.1 - · intro e he - by_cases hef : e = f - · subst e; exact ⟨alpha, by simp [sigma]⟩ - · rw [fixed e hef] - exact P.minimumContext.oneEdgeUncolored.2 e he - -private theorem helper_missingFixed_1637.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → - ∀ v ∈ TreeSequenceVertexSet X, - MissingColors G sigma v = MissingColors G mu v := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT X r f sigma - incidentFixed v hv - unfold MissingColors PresentColors - congr 1 - ext c - simp only [Finset.mem_filter, Finset.mem_univ, true_and] - constructor <;> rintro ⟨e, hi, hc⟩ - · exact ⟨e, hi, (incidentFixed e ⟨v, hv, hi⟩).symm.trans hc⟩ - · exact ⟨e, hi, (incidentFixed e ⟨v, hv, hi⟩).trans hc⟩ - -private theorem helper_fixedB_1646.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - B.length = T.length - (1 : ℕ) → - TreeSequenceInitialSegment B T → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (e : E), e ≠ f → sigma e = mu e) → - ∀ (t : Fin B.length), - sigma (B.edge t) = mu (B.edge t) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B hBlength hBT r f S - hSBlen sigma fixed t - apply fixed - intro he - have hh := T.edge_injective ((hBT.2.2 t).trans he) - have hh := congrArg Fin.val hh - have ht := t.isLt - change t.val = T.length - 1 at hh - omega - -private theorem helper_stable_1654.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - TreeSequenceInitialSegment Tn X → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → - (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → - StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) - (P.corresponding.replacementETT.series.data.coloring n) sigma := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT X hTnX r f sigma - incidentFixed missingFixed - rw [← P.corresponding.replacementETT.generatingColoring] - refine ⟨?_, ?_⟩ - · intro e he _ - obtain ⟨v, hv, hi⟩ := he - exact incidentFixed e ⟨v, TreeSequenceInitialSegmentVertexSetSubset hTnX hv, hi⟩ - · intro v hv - exact missingFixed v (TreeSequenceInitialSegmentVertexSetSubset hTnX hv) - -private theorem helper_boundaryEq_1679.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let y : V := B.vertex (Fin.last B.length); - let w : V := T.vertex (Fin.last T.length); - G.ends f = s(y, w) → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → - ∀ (U : TreeSequence G e0), - TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → - ∀ (c : Fin k), - BoundaryColorEdges G sigma (TreeSequenceVertexSet U) c = - BoundaryColorEdges G mu (TreeSequenceVertexSet U) c := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f y w hends sigma - incidentFixed U hUX c - apply Finset.filter_congr - intro edge he - obtain ⟨u, hu, v, hv, hends⟩ := by simpa [BoundaryEdges] using he - have hi : TreeIncidentEdge X edge := - ⟨u, hUX hu, by rw [Incident, hends]; exact Sym2.mem_mk_left _ _⟩ - rw [incidentFixed edge hi] - -private theorem helper_lastPositive_1695.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length), - H.dividerCount ≠ (0 : ℕ) → - A = - H.stage - (⟨H.dividerCount, by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A hlenT B S hSBlen hq - unfold A HierarchyStarredStage - obtain hz | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ (Fin.last H.dividerCount) - · exact (hq (by simpa using congrArg Fin.val hz)).elim - · rw [hi] - simp only [Fin.cases_succ] - congr 1 - exact Fin.ext (by simpa using (congrArg Fin.val hi).symm) - -private theorem helper_ordinaryA_1704.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - (∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), - (↑i : ℕ) ≤ j → - TreeSequenceInitialSegment (H.stage i) - (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ))))) → - TreeSequenceInitialSegment Tn A → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length), - (H.dividerCount ≠ (0 : ℕ) → - A = - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) → - ∀ (j : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (H.stage j.castSucc) A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A n Tn chain hTnA hlenT B S hSBlen - lastPositive j - by_cases hq : H.dividerCount = 0 - · have hj : j = 0 := Fin.ext (by have := j.isLt; omega) - subst j - simpa only [Fin.castSucc_zero, H.baseStage] using hTnA - · rw [lastPositive hq] - exact chain H.dividerCount (by omega) j.castSucc - (by change j.val ≤ H.dividerCount; have := j.isLt; omega) - -private theorem helper_closureBX_1732.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X → - EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B X positiveB aboveB strictB - belowB generatingB baseB EB coreBX hpe - obtain ⟨union⟩ := (baseB.parallel hpe).2.2 - intro v hv - apply coreBX - rw [union.vertexSet] - exact Finset.mem_union_right _ hv - -private theorem helper_stageMissingEq_1787.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - TreeSequenceInitialSegment Tn X → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (U : TreeSequence G e0), - TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → - TreeMissingColors sigma U = TreeMissingColors mu U) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) X) → - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = - Tn → - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma - missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF stageBX - terminalTree j - refine Fin.cases ?_ (fun i => ?_) j - · change TreeMissingColors sigma - (corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) = - TreeMissingColors mu Tn - rw [terminalTree] - exact missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX) - · exact missingTree _ (TreeSequenceInitialSegmentVertexSetSubset (stageBX i.succ)) - -private theorem helper_earlyMissing_1796.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - B.length = T.length - (1 : ℕ) → - X.length = T.length - (2 : ℕ) → - TreeSequenceInitialSegment X B → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length) (beta : Fin k), - alpha ≠ beta → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → - (H.dividerCount ≠ (0 : ℕ) → - A = - H.stage - (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (_ : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (j : Fin (B.length + (1 : ℕ))), - (↑j : ℕ) < B.length → - MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B X hBlength - hXlength hXB r f S hSBlen beta hab sigma missingFixed lastPositive positiveB aboveB strictB - belowB generatingB baseB HB j hj - let i : Fin (X.length + 1) := ⟨j.val, by omega⟩ - have he : Fin.castLE (Nat.succ_le_succ hXB.1) i = j := Fin.ext rfl - apply missingFixed - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - exact ⟨i, by rw [← he, hXB.2.1 i]⟩ - -private theorem helper_segmentEq_1835.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - (∀ (c : Fin k), - HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c) → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (t : Fin (HB.stage j.succ).length), - sigma ((HB.stage j.succ).edge t) = mu ((HB.stage j.succ).edge t)) → - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (c : Fin k), - HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B r f sigma - positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK - nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq firstEq - stageFixed j c - unfold HierarchySegmentColors - dsimp only - rw [starredEq j, firstEq c] - apply Finset.filter_congr - intro d _ - constructor <;> rintro ⟨r, hlo, hhi, hcol⟩ - · exact ⟨r, hlo, hhi, (stageFixed j r).symm.trans hcol⟩ - · exact ⟨r, hlo, hhi, (stageFixed j r).trans hcol⟩ - -private theorem helper_branch_1894.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - TreeSequenceInitialSegment Tn X → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (U : TreeSequence G e0), - TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → - TreeMissingColors sigma U = TreeMissingColors mu U) → - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (goodB : GoodHierarchy HB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → - TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = - Tn → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) → - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE → - bs.closure = baseB.closure → - (4 : ℕ) ≤ - ((TreeMissingColors mu - ({ rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.tree - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds).castSucc) ∩ - TreeMissingColors mu baseB.closure : - Finset (Fin k)) \ - (HierarchyStoredColorsAt HB (0 : Fin (HB.dividerCount + (1 : ℕ)))).biUnion - (goodB.gamma (0 : Fin (HB.dividerCount + (1 : ℕ))))).card → - (4 : ℕ) ≤ - ((TreeMissingColors sigma - (corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) ∩ - TreeMissingColors sigma bs.closure : - Finset (Fin k)) \ - (HierarchyStoredColorsAt KF (0 : Fin (KF.dividerCount + (1 : ℕ)))).biUnion - (goodB.gamma (0 : Fin (KF.dividerCount + (1 : ℕ))))).card := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma - missingTree positiveB aboveB strictB belowB generatingB baseB HB goodB EB closureBX corr bs - baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK - KF terminalTree storedEq hpB hcl hcard - change 4 ≤ ((TreeMissingColors sigma - (corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) ∩ - TreeMissingColors sigma bs.closure) \ - (HierarchyStoredColorsAt KF 0).biUnion (goodB.gamma 0)).card - rw [terminalTree, hcl, storedEq 0, - missingTree Tn (TreeSequenceInitialSegmentVertexSetSubset hTnX), - missingTree baseB.closure (closureBX hpB)] - exact hcard - -private theorem helper_hbetaY_1908.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let mu : PartialEdgeColoring E k := P.coloring; - HierarchyPathNumber H = (1 : ℕ) → - (∀ {X Y Z : TreeSequence G e0}, - TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let y : V := B.vertex (Fin.last B.length); - Incident G y f → - ∀ (beta : Fin k), - mu f = some beta → - alpha ≠ beta → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (e : E), e ≠ f → sigma e = mu e) → - beta ∈ MissingColors G sigma y := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H mu hp trans hlenT B r f y hyf - beta hbetaF hab sigma fixed - simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] - intro hp - obtain ⟨edge, hi, hc⟩ := (Finset.mem_filter.mp hp).2 - by_cases hef : edge = f - · subst edge - have he : alpha = beta := by simpa [sigma] using hc - exact hab he - · have hcOld : mu edge = some beta := (fixed edge hef).symm.trans hc - exact P.minimumContext.proper hef ⟨y, hi, hyf⟩ hcOld hbetaF - -private theorem helper_hnotElementary_1918.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let y : V := B.vertex (Fin.last B.length); - ∀ (beta : Fin k), - ∀ z ∈ TreeSequenceVertexSet B, - beta ∈ MissingColors G mu z → - z ≠ y → - z ∈ TreeSequenceVertexSet X → - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → - beta ∈ MissingColors G sigma y → - ¬ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f y beta z hzB - hbetaz hzy hzX sigma missingFixed hbetaY he - have hbetazS : beta ∈ MissingColors G sigma z := by rw [missingFixed z hzX]; exact hbetaz - have hyB : y ∈ TreeSequenceVertexSet B := by - simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] - exact ⟨Fin.last B.length, rfl⟩ - exact Finset.disjoint_left.mp (he hzB hyB hzy) hbetazS hbetaY - -private theorem helper_lastStar_1932.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (hcountB : HB.dividerCount = H.dividerCount), - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - have jo : Fin (H.dividerCount + (1 : ℕ)) := - Fin.cast - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega) - j; - HB.stage j.castSucc = H.stage jo.castSucc ∧ - HierarchyStarredStage HB j = HierarchyStarredStage H jo) → - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - HierarchyStarredStage KF (Fin.last KF.dividerCount) = A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B r f sigma - positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq - rw [starredEq] - have hh := (hstagesB (Fin.last HB.dividerCount)).2 - have hi : Fin.cast (congrArg (fun q => q + 1) hcountB) - (Fin.last HB.dividerCount) = Fin.last H.dividerCount := - Fin.ext hcountB - simpa only [hi] using hh - -private theorem helper_lastOrdinary_1941.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (hcountB : HB.dividerCount = H.dividerCount), - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - have jo : Fin (H.dividerCount + (1 : ℕ)) := - Fin.cast - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega) - j; - HB.stage j.castSucc = H.stage jo.castSucc ∧ - HierarchyStarredStage HB j = HierarchyStarredStage H jo) → - HB.stage (Fin.last HB.dividerCount).castSucc = - H.stage (Fin.last H.dividerCount).castSucc := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H mu hlenT B positiveB aboveB strictB - belowB generatingB baseB HB hcountB hstagesB - have hh := (hstagesB (Fin.last HB.dividerCount)).1 - have hi : Fin.cast (congrArg (fun q => q + 1) hcountB) - (Fin.last HB.dividerCount) = Fin.last H.dividerCount := - Fin.ext hcountB - simpa only [hi] using hh - -private theorem helper_terminalTree_3611.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) - (alpha : Fin k), - let old : HierarchyCounterexample P.replacementBase := P.counterexample; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; - HierarchyPathNumber H = (1 : ℕ) → - ∀ (hlenT : (3 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); - let f : E := T.edge r; - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + IsProperEdgeColoring G sigma → + IsOneEdgeUncolored sigma e0 → + (∀ (e : E), TreeIncidentEdge X e → sigma e = mu e) → + (∀ v ∈ TreeSequenceVertexSet X, MissingColors G sigma v = MissingColors G mu v) → + StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) + (P.corresponding.replacementETT.series.data.coloring n) sigma → + (P.corresponding.replacementETT.series.data.kind n = some TashkinovExtensionKind.PE ∧ + TashkinovAugmentationSequence sigma Tn B ∨ + (P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.SE ∨ + P.corresponding.replacementETT.series.data.kind n = + some TashkinovExtensionKind.RE) ∧ + ∃ (edge : E) (seed : TreeSequence G e0), + P.corresponding.replacementETT.series.data.connectingEdges n = { edge } ∧ + TreeSequenceAdjoinEdge Tn edge seed ∧ + TashkinovAugmentationSequence sigma seed B) → ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) (aboveB : TreeSequenceInitialSegment (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) B) (strictB : (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < B.length) (belowB : @@ -4240,7 +721,14 @@ private theorem helper_terminalTree_3611.{u_1, u_2} : (generatingB : mu = P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) + (Fin.last P.corresponding.replacementETT.rounds)), + MaximumProperty + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } → + ∀ (baseB : HierarchyBase { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, @@ -4258,120 +746,87 @@ private theorem helper_terminalTree_3611.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), - MaximumProperty corr.replacementETT → - ∀ (bs : HierarchyBase corr.replacementETT sigma), - baseB.core = bs.core → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) → - ∀ - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - HB.stage ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.stage → - HB.dividerPosition ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.dividerPosition → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + (EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X) → + ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT ∧ + ∃ (bs : HierarchyBase corr.replacementETT sigma) (K : + TashkinovHierarchy corr.replacementETT bs), SameHierarchyStages HB K := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B r f S - hSBlen sigma positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore - hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK - dividerStageK KF hstage hposition starredEq - exact helper_terminalTree_1082 G k e0 input T phi ett base C ctx P alpha hp hlenT S hSBlen - positiveB aboveB strictB - belowB generatingB baseB HB corr hmaximum bs hcore hpe hclosure baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK hstage - hposition starredEq + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp trans hlenT B X r + f S hSBlen sigma hsproper hsone incidentFixed missingFixed stable hrouteB positiveB aboveB + strictB belowB generatingB hmaxB baseB HB EB closureBX + by_cases hpe : EB.series.data.kind (Fin.last EB.rounds) = + some TashkinovExtensionKind.PE + · have hb : TashkinovAugmentationSequence sigma Tn B := by + rcases hrouteB with h | h + · exact h.2 + · rcases h.1 with h | h <;> rw [hpe] at h <;> cases h + have hcomb : CombinedStableColoring Tn baseB.closure + (TashkinovStoredColors EB.series.data (Fin.last EB.rounds)) mu sigma := by + refine ⟨?_, ?_⟩ + · have hh := stable + change StableColoring Tn + (TashkinovStoredColors EB.series.data (Fin.last EB.rounds)) + (P.corresponding.replacementETT.series.data.coloring + (Fin.last P.corresponding.replacementETT.rounds)) sigma at hh + rw [← P.corresponding.replacementETT.generatingColoring] at hh + exact hh + · refine ⟨?_, ?_⟩ + · intro edge he _ + obtain ⟨v, hv, hi⟩ := he + exact incidentFixed edge ⟨v, closureBX hpe hv, hi⟩ + · intro v hv + exact missingFixed v (closureBX hpe hv) + exact HierarchySplitter G k e0 P.corresponding.replacementInput B mu sigma EB + hmaxB old.positive P.minimumContext.lowerRung baseB HB hpe + P.minimumContext.proper P.minimumContext.oneEdgeUncolored hsproper hsone hcomb hb + · have hmodB := Td G k e0 P.corresponding.replacementInput B mu EB hmaxB + old.positive P.minimumContext.lowerRung sigma hsproper hsone stable + obtain ⟨corr⟩ := hmodB.2.2 B aboveB strictB hrouteB + have hmaximum := MaximumPropertyTransport G k e0 EB sigma hmodB B corr hmaxB + have terminalTree : corr.replacementETT.series.data.tree + (Fin.last corr.replacementETT.rounds).castSucc = Tn := by + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ + have hj : j.succ = Fin.last EB.rounds := Fin.ext (by + dsimp [j]; have := EB.roundsPositive; omega) + change rs.data.tree (Fin.last EB.rounds).castSucc = + EB.series.data.tree (Fin.last EB.rounds).castSucc + rw [← hj] + exact hl j + have terminalKind : corr.replacementETT.series.data.kind + (Fin.last corr.replacementETT.rounds) = EB.series.data.kind (Fin.last EB.rounds) := by + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + exact hk _ + let bs : HierarchyBase corr.replacementETT sigma := by + exact @helperBs231 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) (@trans) + (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@hpe) + (@corr) (@terminalTree) (@terminalKind) + let K : TashkinovHierarchy corr.replacementETT bs := by + exact @helperK358 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) (@trans) + (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) + (@hpe) (@corr) (@terminalTree) (@terminalKind) + refine ⟨corr, hmaximum, bs, K, rfl, rfl, heq_of_eq rfl, heq_of_eq rfl, ?_, ?_⟩ + · exact ⟨fun h => (hpe h).elim, fun h => (hpe (terminalKind.symm.trans h)).elim⟩ + · intro _; rfl -private theorem helper_terminalStored_3618.{u_1, u_2} : +private theorem helper_hpS_917.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -4384,59 +839,36 @@ private theorem helper_terminalStored_3618.{u_1, u_2} : let old : HierarchyCounterexample P.replacementBase := P.counterexample; let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := old.hierarchy; - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); let mu : PartialEdgeColoring E k := P.coloring; - HierarchyPathNumber H = (1 : ℕ) → + (2 : ℕ) ≤ T.length - A.length → ∀ (hlenT : (3 : ℕ) ≤ T.length), let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - TreeSequenceInitialSegment Tn X → - let r : Fin T.length := - (⟨T.length - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin T.length); + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + B.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); let f : E := T.edge r; - ∀ (S : TreeSequence G e0), - S.length ≤ B.length → + (∀ (t : Fin T.length), + A.length + (1 : ℕ) ≤ (↑t : ℕ) → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ)) → + ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length) (beta : Fin k), + alpha ≠ beta → let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - (∀ (U : TreeSequence G e0), - TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X → - TreeMissingColors sigma U = TreeMissingColors mu U) → + (H.dividerCount ≠ (0 : ℕ) → + A = H.stage (⟨H.dividerCount, by omega⟩ : Fin (H.dividerCount + (2 : ℕ)))) → ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) (aboveB : TreeSequenceInitialSegment (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) B) (strictB : (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < B.length) (belowB : @@ -4464,47 +896,13 @@ private theorem helper_terminalStored_3618.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), - MaximumProperty corr.replacementETT → - ∀ (bs : HierarchyBase corr.replacementETT sigma), - baseB.core = bs.core → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) → - ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) → - ∀ + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) + (bs : HierarchyBase corr.replacementETT sigma) (baseStageK : HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = corr.replacementETT.series.data.tree @@ -4518,12 +916,7 @@ private theorem helper_terminalStored_3618.{u_1, u_2} : (HB.stage j.castSucc).length < (HB.stage j.succ).length) (coreInsideK : TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) (increasingK : ∀ (i j : Fin HB.dividerCount), @@ -4531,133 +924,119 @@ private theorem helper_terminalStored_3618.{u_1, u_2} : (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) (dividerStageK : ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive B - omega)), + (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), let KF : TashkinovHierarchy corr.replacementETT bs := { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, terminalStage := terminalStageK, nested := nestedK, strict := strictK, dividerPosition := HB.dividerPosition, dividerPositive := positiveK, dividerIncreasing := increasingK, dividerStage := dividerStageK, coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - HB.stage ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.stage → - HB.dividerPosition ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.dividerPosition → - (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) → - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = - Tn → - TashkinovStoredColors corr.replacementETT.series.data - (Fin.last corr.replacementETT.rounds) = - TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f - S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr - hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK - positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree - exact helper_terminalStored_720 G k e0 input T phi ett base C ctx P alpha hp hlenT hTnX S hSBlen - missingTree positiveB aboveB strictB belowB generatingB baseB HB corr hmaximum bs hcore - hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK - increasingK dividerStageK hstage hposition starredEq terminalTree - -private theorem helper_lastStar_3754.{u_1, u_2} : - helperLastStar3754Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B r f sigma - positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq - exact helper_lastStar_1932 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) - (@HB) (@hcountB) (@hstagesB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) - (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) - -private theorem helper_hpS_3760.{u_1, u_2} : - helperHpS3760Conditions.{u_1, u_2} := by + HierarchyStarredStage KF (Fin.last KF.dividerCount) = A → + HierarchyPathNumber KF = (1 : ℕ) := by classical intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu htail hlenT B hBlength hBT r f consecutive S hSBlen beta hab sigma lastPositive positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF lastStar - exact helper_hpS_917 G k e0 input T phi ett base C ctx P alpha htail hlenT hBlength hBT - consecutive S hSBlen beta - hab lastPositive positiveB aboveB strictB belowB generatingB baseB HB corr bs - baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK - dividerStageK lastStar + let candidates := (Finset.Icc 1 (B.length - A.length)).filter fun i => + ∀ t : Fin B.length, A.length + i ≤ t.val → + G.ends (B.edge t) = s(B.vertex t.castSucc, B.vertex t.succ) + have hm : 1 ∈ candidates := by + refine Finset.mem_filter.mpr ⟨Finset.mem_Icc.mpr ⟨le_rfl, by omega⟩, ?_⟩ + intro t ht + rw [← hBT.2.2 t] + have hc := consecutive (Fin.castLE hBT.1 t) ht + have hv1 : (Fin.castLE hBT.1 t).castSucc = + Fin.castLE (Nat.succ_le_succ hBT.1) t.castSucc := Fin.ext rfl + have hv2 : (Fin.castLE hBT.1 t).succ = + Fin.castLE (Nat.succ_le_succ hBT.1) t.succ := Fin.ext rfl + rw [hv1, hv2, hBT.2.1 t.castSucc, hBT.2.1 t.succ] at hc + exact hc + have hn : candidates.Nonempty := ⟨1, hm⟩ + have hlo := (Finset.mem_Icc.mp (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).1).1 + have hhi := Finset.min'_le candidates 1 hm + unfold HierarchyPathNumber + dsimp only + rw [lastStar] + change (if h : candidates.Nonempty then candidates.min' h else B.length - A.length) = 1 + rw [dite_eq_left hn] + omega -private theorem helper_uniqueRefresh_4832.{u_1, u_2} : - helperUniqueRefresh4832Conditions.{u_1, u_2} := by +private theorem helper_chain_747.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (j : ℕ) (hj : j < H.dividerCount + (2 : ℕ)) (i : Fin (H.dividerCount + (2 : ℕ))), + (↑i : ℕ) ≤ j → + TreeSequenceInitialSegment (H.stage i) + (H.stage (⟨j, hj⟩ : Fin (H.dividerCount + (2 : ℕ)))) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f sigma missingFixed - positiveB aboveB strictB belowB generatingB baseB HB goodB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq - stageBX storedEq i - have hnew : - ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun v => MissingColors G sigma v) = - ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage HB i.castSucc)).biUnion - fun v => MissingColors G mu v) := by - apply Finset.biUnion_congr rfl - intro v hv - exact missingFixed v (TreeSequenceInitialSegmentVertexSetSubset (stageBX i.succ) - (Finset.mem_sdiff.mp hv).1) - change ∃! c : Fin k, - c ∈ HierarchyStoredColorsAt KF i.succ ∧ - goodB.gamma i.succ c ⊆ - ((TreeSequenceVertexSet (HB.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion - fun v => MissingColors G sigma v) ∧ - ∀ d ∈ HierarchyStoredColorsAt KF i.succ, d ≠ c → - goodB.gamma i.succ d = goodB.gamma i.castSucc d - rw [starredEq i.castSucc, hnew] - simp only [storedEq] - exact goodB.uniqueRefresh i - -private theorem helper_parallelBase_5019.{u_1, u_2} : - SharedFacts.ShorteningTransport.parallelBase5019Conditions.{u_1, u_2} := by + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H trans j + induction j with + | zero => + intro hj i hi + have he : i = 0 := Fin.ext (Nat.eq_zero_of_le_zero hi) + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + | succ j ih => + intro hj i hi + by_cases heq : i.val = j + 1 + · have he : i = ⟨j + 1, hj⟩ := Fin.ext heq + subst i + exact ⟨le_rfl, fun _ => rfl, fun _ => rfl⟩ + · exact trans (ih (by omega) i (by omega)) (H.nested ⟨j, by omega⟩) + +private theorem helper_consecutive_824.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) + (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; + let A : TreeSequence G e0 := HierarchyStarredStage H (Fin.last H.dividerCount); + HierarchyPathNumber H = (1 : ℕ) → + (2 : ℕ) ≤ T.length - A.length → + (3 : ℕ) ≤ T.length → + ∀ (t : Fin T.length), + A.length + (1 : ℕ) ≤ (↑t : ℕ) → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f - sigma missingTree minusEq positiveB aboveB strictB belowB generatingB baseB HB goodB EB - coreBX closureBX corr bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK - coreInsideK positiveK increasingK dividerStageK KF terminalTree storedEq - dsimp only - intro hp - have hpB := hpe.mpr hp - have hcl : bs.closure = baseB.closure := (hclosure hpB).symm - obtain ⟨hnot, hcard⟩ := goodB.parallelBase hpB - constructor - · change ¬ TreeColorSetMinusClosed G sigma bs.core - ((HierarchyStoredColorsAt KF 0).biUnion (goodB.gamma 0)) - rw [← hcore, storedEq 0, minusEq baseB.core coreBX] - exact hnot - · exact helper_branch_1894 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) - (@generatingB) (@baseB) (@HB) (@goodB) (@closureBX) (@corr) (@bs) (@baseStageK) - (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) - (@dividerStageK) (@terminalTree) (@storedEq) (@hpB) (@hcl) (@hcard) + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P old H A hp htail hlenT t ht + let candidates := (Finset.Icc 1 (T.length - A.length)).filter fun i => + ∀ t : Fin T.length, A.length + i ≤ t.val → + G.ends (T.edge t) = s(T.vertex t.castSucc, T.vertex t.succ) + have hp' := hp + change (if h : candidates.Nonempty then candidates.min' h else T.length - A.length) = 1 at hp' + have hn : candidates.Nonempty := by + by_contra hn + have hp'' : T.length - A.length = 1 := by + simpa only [dite_eq_right hn] using hp' + omega + have hm : candidates.min' hn = 1 := by + simpa only [dite_eq_left hn] using hp' + have hc := (Finset.mem_filter.mp (Finset.min'_mem candidates hn)).2 + rw [hm] at hc + exact hc t ht -private theorem helper_terminalTree_5246.{u_1, u_2} : +private theorem helper_terminalTree_1082.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -4675,32 +1054,27 @@ private theorem helper_terminalTree_5246.{u_1, u_2} : let Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; let mu : PartialEdgeColoring E k := P.coloring; - ∀ (_ : HierarchyPathNumber H = (1 : ℕ)) (hlenT : (3 : ℕ) ≤ T.length), + HierarchyPathNumber H = (1 : ℕ) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - omega) - (by - omega); - let r : Fin T.length := - (⟨T.length - (1 : ℕ), by - omega⟩ : - Fin T.length); + (Decidable.byContradiction fun (a : ¬(1 : ℕ) ≤ T.length - (1 : ℕ)) ↦ by omega) + (Decidable.byContradiction fun (a : ¬T.length - (1 : ℕ) ≤ T.length) ↦ by omega); + let r : Fin T.length := (⟨T.length - (1 : ℕ), by omega⟩ : Fin T.length); let f : E := T.edge r; - ∀ (S : TreeSequence G e0) (_ : S.length ≤ B.length), + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) (aboveB : TreeSequenceInitialSegment (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) B) (strictB : (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : + (⟨P.corresponding.replacementETT.rounds, by omega⟩ : Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < B.length) (belowB : @@ -4728,47 +1102,49 @@ private theorem helper_terminalTree_5246.{u_1, u_2} : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } baseB), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (_ : MaximumProperty corr.replacementETT) - (bs : HierarchyBase corr.replacementETT sigma) (_ : baseB.core = bs.core) - (_ : - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu }; + ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B), + MaximumProperty corr.replacementETT → + ∀ (bs : HierarchyBase corr.replacementETT sigma), + baseB.core = bs.core → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE ↔ - corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = - some TashkinovExtensionKind.PE) - (_ : - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + mu }.rounds) = + some TashkinovExtensionKind.PE ↔ + corr.replacementETT.series.data.kind (Fin.last corr.replacementETT.rounds) = + some TashkinovExtensionKind.PE) → + ({ rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, + series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, + strictAbovePenultimate := strictB, belowFinal := belowB, + generatingColoring := generatingB : + ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B + mu }.series.data.kind + (Fin.last + { rounds := P.corresponding.replacementETT.rounds, + roundsPositive := positiveB, series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.series.data.kind - (Fin.last - { rounds := P.corresponding.replacementETT.rounds, - roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, - belowFinal := belowB, generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B - mu }.rounds) = - some TashkinovExtensionKind.PE → - baseB.closure = bs.closure) + mu }.rounds) = + some TashkinovExtensionKind.PE → + baseB.closure = bs.closure) → + ∀ (baseStageK : HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = corr.replacementETT.series.data.tree @@ -4782,10 +1158,7 @@ private theorem helper_terminalTree_5246.{u_1, u_2} : (HB.stage j.castSucc).length < (HB.stage j.succ).length) (coreInsideK : TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) + (HB.stage (⟨(1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))))) (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) (increasingK : ∀ (i j : Fin HB.dividerCount), @@ -4793,10 +1166,7 @@ private theorem helper_terminalTree_5246.{u_1, u_2} : (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) (dividerStageK : ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = + HB.stage (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (HB.dividerCount + (2 : ℕ))) = TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), let KF : TashkinovHierarchy corr.replacementETT bs := @@ -4805,53 +1175,42 @@ private theorem helper_terminalTree_5246.{u_1, u_2} : dividerPosition := HB.dividerPosition, dividerPositive := positiveK, dividerIncreasing := increasingK, dividerStage := dividerStageK, coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (_ : - HB.stage ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.stage) - (_ : - HB.dividerPosition ≍ - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : - TashkinovHierarchy corr.replacementETT bs }.dividerPosition) - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j), + HB.stage ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.stage → + HB.dividerPosition ≍ + { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, + terminalStage := terminalStageK, nested := nestedK, strict := strictK, + dividerPosition := HB.dividerPosition, dividerPositive := positiveK, + dividerIncreasing := increasingK, dividerStage := dividerStageK, + coreInsideFirst := coreInsideK : + TashkinovHierarchy corr.replacementETT bs }.dividerPosition → + (∀ (j : Fin (HB.dividerCount + (1 : ℕ))), + HierarchyStarredStage KF j = HierarchyStarredStage HB j) → corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by classical intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B r f S hSBlen sigma positiveB aboveB strictB belowB generatingB baseB HB EB corr hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF hstage hposition starredEq - exact helper_terminalTree_3611 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@ctx) (@P) (@alpha) (@hp) (@hlenT) (@S) (@hSBlen) (@positiveB) (@aboveB) (@strictB) - (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) (@hcore) (@hpe) - (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) - (@positiveK) (@increasingK) (@dividerStageK) (@hstage) (@hposition) (@starredEq) - -private theorem helper_terminalStored_5253.{u_1, u_2} : - helperTerminalStored5253Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f - S hSBlen sigma missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr - hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK - positiveK increasingK dividerStageK KF hstage hposition starredEq terminalTree - exact helper_terminalStored_3618 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@ctx) (@P) (@alpha) (@hp) (@hlenT) (@hTnX) (@S) (@hSBlen) (@missingTree) (@positiveB) - (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) - (@hcore) (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) - (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@hstage) (@hposition) - (@starredEq) (@terminalTree) + rcases corr with ⟨ri, rs, re, hr, hp, hc, hl, hstored, he, hk, hpr, ho, hst⟩ + rcases re with ⟨rounds, positive, data, above, strict, below, generating⟩ + cases hr + have hs : data = rs := eq_of_heq hp + cases hs + let j : Fin EB.rounds := ⟨EB.rounds - 1, by have := EB.roundsPositive; omega⟩ + have hj : j.succ = Fin.last EB.rounds := Fin.ext (by + dsimp [j]; have := EB.roundsPositive; omega) + change rs.data.tree (Fin.last EB.rounds).castSucc = + EB.series.data.tree (Fin.last EB.rounds).castSucc + rw [← hj] + exact hl j -private theorem helper_stageMissingEq_5267.{u_1, u_2} : +private theorem helper_hfe0_1615.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -4859,139 +1218,40 @@ private theorem helper_stageMissingEq_5267.{u_1, u_2} : (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) + (_ : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), - let n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := - Fin.last P.corresponding.replacementETT.rounds; - let Tn : TreeSequence G e0 := - P.corresponding.replacementETT.series.data.tree n.castSucc; - let mu : PartialEdgeColoring E k := P.coloring; + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → ∀ (hlenT : (3 : ℕ) ≤ T.length), let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by + have := GoldbergSeymour.TreeSequence.positive T omega) (by + have := GoldbergSeymour.TreeSequence.positive T omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - omega) - (by - omega); - ∀ (_ : TreeSequenceInitialSegment Tn X), let r : Fin T.length := - (⟨T.length - (1 : ℕ), by + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T omega⟩ : Fin T.length); let f : E := T.edge r; - let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ - (_ : - ∀ (U : TreeSequence G e0) (_ : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X), - TreeMissingColors sigma U = TreeMissingColors mu U) - (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) X) - (_ : - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc = - Tn) - (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → + ∀ (beta : Fin k), + alpha ≠ beta → + f ≠ e0 := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha n Tn mu hlenT B X hTnX r f sigma - missingTree positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF stageBX - terminalTree j - exact helper_stageMissingEq_1787 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) - (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) - (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) - (@stageBX) (@terminalTree) (@j) + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha trans hlenT B r f S hSBlen beta hab he + have hh := T.edge_injective (he.trans T.first_edge.symm) + have hv := congrArg Fin.val hh + dsimp [r] at hv + omega -private theorem helper_segmentEq_5302.{u_1, u_2} : +private theorem helper_fixedB_1646.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -5002,34 +1262,86 @@ private theorem helper_segmentEq_5302.{u_1, u_2} : (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), let mu : PartialEdgeColoring E k := P.coloring; - ∀ - (_ : - ∀ {X Y Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment X Y) - (_ : TreeSequenceInitialSegment Y Z), TreeSequenceInitialSegment X Z) - (hlenT : (3 : ℕ) ≤ T.length), + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → + ∀ (hlenT : (3 : ℕ) ≤ T.length), let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by + have := GoldbergSeymour.TreeSequence.positive T omega) (by + have := GoldbergSeymour.TreeSequence.positive T omega); + B.length = T.length - (1 : ℕ) → + TreeSequenceInitialSegment B T → let r : Fin T.length := - (⟨T.length - (1 : ℕ), by + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T omega⟩ : Fin T.length); let f : E := T.edge r; + ∀ (S : TreeSequence G e0), + S.length ≤ B.length → let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; + (∀ (e : E), e ≠ f → sigma e = mu e) → + ∀ (t : Fin B.length), + sigma (B.edge t) = mu (B.edge t) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B hBlength hBT r f S + hSBlen sigma fixed t + apply fixed + intro he + have hh := T.edge_injective ((hBT.2.2 t).trans he) + have hh := congrArg Fin.val hh + have ht := t.isLt + change t.val = T.length - 1 at hh + omega + +private theorem helper_closureBX_1732.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let mu : PartialEdgeColoring E k := P.coloring; + ∀ (hlenT : (3 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + let X : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (2 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); ∀ (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) (aboveB : TreeSequenceInitialSegment (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T omega⟩ : Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) B) (strictB : (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by + (⟨P.corresponding.replacementETT.rounds, + by + have := GoldbergSeymour.TreeSequence.positive T omega⟩ : Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < B.length) @@ -5048,82 +1360,24 @@ private theorem helper_segmentEq_5302.{u_1, u_2} : strictAbovePenultimate := strictB, belowFinal := belowB, generatingColoring := generatingB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB), + mu), let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB aboveB strictB belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) - (_ : - ∀ (c : Fin k), - HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c) - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))) (t : Fin (HB.stage j.succ).length), - sigma ((HB.stage j.succ).edge t) = mu ((HB.stage j.succ).edge t)) - (j : Fin (HB.dividerCount + (1 : ℕ))) (c : Fin k), - HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by + TreeSequenceVertexSet baseB.core ⊆ TreeSequenceVertexSet X → + EB.series.data.kind (Fin.last EB.rounds) = some TashkinovExtensionKind.PE → + TreeSequenceVertexSet baseB.closure ⊆ TreeSequenceVertexSet X := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu trans hlenT B r f sigma - positiveB aboveB strictB belowB generatingB baseB HB EB corr bs baseStageK terminalStageK - nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq firstEq - stageFixed j c - exact @helper_segmentEq_1835 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@trans) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) - (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) - (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) (@firstEq) - (@stageFixed) (@j) (@c) + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P mu hlenT B X positiveB aboveB strictB + belowB generatingB baseB EB coreBX hpe + obtain ⟨union⟩ := (baseB.parallel hpe).2.2 + intro v hv + apply coreBX + rw [union.vertexSet] + exact Finset.mem_union_right _ hv -private theorem helper_uniqueRefresh_5324.{u_1, u_2} : +private theorem helper_hbetaY_1908.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) @@ -5133,180 +1387,74 @@ private theorem helper_uniqueRefresh_5324.{u_1, u_2} : (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha : Fin k), + let old : HierarchyCounterexample P.replacementBase := P.counterexample; + let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := + old.hierarchy; let mu : PartialEdgeColoring E k := P.coloring; + HierarchyPathNumber H = (1 : ℕ) → + (∀ {X Y Z : TreeSequence G e0}, + TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z) → ∀ (hlenT : (3 : ℕ) ≤ T.length), let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) (by + have := GoldbergSeymour.TreeSequence.positive T omega) (by - omega); - let X : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (2 : ℕ)) - (by - omega) - (by + have := GoldbergSeymour.TreeSequence.positive T omega); let r : Fin T.length := - (⟨T.length - (1 : ℕ), by + (⟨T.length - (1 : ℕ), + by + have := GoldbergSeymour.TreeSequence.positive T omega⟩ : Fin T.length); let f : E := T.edge r; + let y : V := B.vertex (Fin.last B.length); + Incident G y f → + ∀ (beta : Fin k), + mu f = some beta → + alpha ≠ beta → let sigma : PartialEdgeColoring E k := fun (e : E) ↦ if e = f then some alpha else mu e; - ∀ - (_ : - ∀ (v : V) (_ : v ∈ TreeSequenceVertexSet X), - MissingColors G sigma v = MissingColors G mu v) - (positiveB : (1 : ℕ) ≤ P.corresponding.replacementETT.rounds) - (aboveB : - TreeSequenceInitialSegment - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))) - B) - (strictB : - (P.corresponding.replacementETT.series.data.tree - (⟨P.corresponding.replacementETT.rounds, by - omega⟩ : - Fin (P.corresponding.replacementETT.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B - (P.corresponding.replacementETT.series.data.tree - (Fin.last (P.corresponding.replacementETT.rounds + (1 : ℕ))))) - (generatingB : - mu = - P.corresponding.replacementETT.series.data.coloring - (Fin.last P.corresponding.replacementETT.rounds)) - (baseB : - HierarchyBase - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - mu) - (HB : - TashkinovHierarchy - { rounds := P.corresponding.replacementETT.rounds, roundsPositive := positiveB, - series := P.corresponding.replacementETT.series, abovePenultimate := aboveB, - strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := generatingB : - ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu } - baseB) - (goodB : GoodHierarchy HB), - let EB : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput B mu := - SharedFacts.ShorteningTransport.eB1665 G k e0 input T phi ett base C ctx P hlenT positiveB - aboveB strictB - belowB generatingB; - ∀ (corr : CorrespondingExtendedTashkinovTree G k e0 EB sigma B) - (bs : HierarchyBase corr.replacementETT sigma) - (baseStageK : - HB.stage (0 : Fin (HB.dividerCount + (2 : ℕ))) = - corr.replacementETT.series.data.tree - (Fin.last corr.replacementETT.rounds).castSucc) - (terminalStageK : HB.stage (Fin.last (HB.dividerCount + (1 : ℕ))) = B) - (nestedK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) (HB.stage j.succ)) - (strictK : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - (HB.stage j.castSucc).length < (HB.stage j.succ).length) - (coreInsideK : - TreeSequenceInitialSegment bs.core - (HB.stage - (⟨(1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))))) - (positiveK : ∀ (i : Fin HB.dividerCount), (1 : ℕ) ≤ (↑(HB.dividerPosition i) : ℕ)) - (increasingK : - ∀ (i j : Fin HB.dividerCount), - (↑i : ℕ) < (↑j : ℕ) → - (↑(HB.dividerPosition i) : ℕ) < (↑(HB.dividerPosition j) : ℕ)) - (dividerStageK : - ∀ (i : Fin HB.dividerCount), - HB.stage - (⟨(↑i : ℕ) + (1 : ℕ), by - omega⟩ : - Fin (HB.dividerCount + (2 : ℕ))) = - TreeSequencePrefix B (↑(HB.dividerPosition i) : ℕ) (positiveK i) - (Nat.le_of_lt_succ (HB.dividerPosition i).isLt)), - let KF : TashkinovHierarchy corr.replacementETT bs := - { dividerCount := HB.dividerCount, stage := HB.stage, baseStage := baseStageK, - terminalStage := terminalStageK, nested := nestedK, strict := strictK, - dividerPosition := HB.dividerPosition, dividerPositive := positiveK, - dividerIncreasing := increasingK, dividerStage := dividerStageK, - coreInsideFirst := coreInsideK : TashkinovHierarchy corr.replacementETT bs }; - ∀ - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStarredStage KF j = HierarchyStarredStage HB j) - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (HB.stage j.castSucc) X) - (_ : - ∀ (j : Fin (HB.dividerCount + (1 : ℕ))), - HierarchyStoredColorsAt KF j = HierarchyStoredColorsAt HB j) - (i : Fin KF.dividerCount), - ∃! eta : Fin k, - eta ∈ HierarchyStoredColorsAt KF i.succ ∧ - (goodB.gamma i.succ eta ⊆ - (TreeSequenceVertexSet (KF.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage KF i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G sigma v) ∧ - ∀ theta ∈ HierarchyStoredColorsAt KF i.succ, - theta ≠ eta → goodB.gamma i.succ theta = goodB.gamma i.castSucc theta := by + (∀ (e : E), e ≠ f → sigma e = mu e) → + beta ∈ MissingColors G sigma y := by classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha mu hlenT B X r f sigma missingFixed - positiveB aboveB strictB belowB generatingB baseB HB goodB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq - stageBX storedEq - exact helper_uniqueRefresh_4832 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) - (@C) (@ctx) (@P) (@alpha) (@hlenT) (@missingFixed) (@positiveB) (@aboveB) - (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@corr) (@bs) - (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) - (@increasingK) (@dividerStageK) (@starredEq) (@stageBX) (@storedEq) + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H mu hp trans hlenT B r f y hyf + beta hbetaF hab sigma fixed + simp only [MissingColors, Finset.mem_sdiff, Finset.mem_univ, true_and] + intro hp + obtain ⟨edge, hi, hc⟩ := (Finset.mem_filter.mp hp).2 + by_cases hef : edge = f + · subst edge + have he : alpha = beta := by simpa [sigma] using hc + exact hab he + · have hcOld : mu edge = some beta := (fixed edge hef).symm.trans hc + exact P.minimumContext.proper hef ⟨y, hi, hyf⟩ hcOld hbetaF -private theorem helper_parallelBase_5330.{u_1, u_2} : +private theorem helper_parallelBase_5019.{u_1, u_2} : SharedFacts.ShorteningTransport.parallelBase5019Conditions.{u_1, u_2} := by classical intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H n Tn mu hp hlenT B X hTnX r f sigma missingTree minusEq positiveB aboveB strictB belowB generatingB baseB HB goodB EB coreBX closureBX corr bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF terminalTree storedEq - exact @helper_parallelBase_5019 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hp) (@hlenT) (@hTnX) (@missingTree) (@minusEq) (@positiveB) (@aboveB) - (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@coreBX) (@closureBX) - (@corr) (@bs) (@hcore) (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) - (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) - (@terminalTree) (@storedEq) - -private theorem helper_lastStar_5360.{u_1, u_2} : - helperLastStar5360Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu hlenT B r f sigma - positiveB aboveB strictB belowB generatingB baseB HB hcountB hstagesB EB corr bs baseStageK - terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK KF starredEq - exact helper_lastStar_3754 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) (@alpha) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) - (@baseB) (@HB) (@hcountB) (@hstagesB) (@corr) (@bs) (@baseStageK) (@terminalStageK) - (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) - (@starredEq) - -private theorem helper_hpS_5366.{u_1, u_2} : - helperHpS5366Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha old H A mu htail hlenT B hBlength - hBT r f consecutive S hSBlen beta hab sigma lastPositive positiveB aboveB strictB belowB - generatingB baseB HB EB corr bs baseStageK terminalStageK nestedK strictK coreInsideK - positiveK increasingK dividerStageK KF lastStar - exact helper_hpS_3760 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@htail) (@hlenT) (@hBlength) (@hBT) (@consecutive) (@S) (@hSBlen) (@beta) - (@hab) (@lastPositive) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) - (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) - (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@lastStar) + dsimp only + intro hp + have hpB := hpe.mpr hp + have hcl : bs.closure = baseB.closure := (hclosure hpB).symm + obtain ⟨hnot, hcard⟩ := goodB.parallelBase hpB + constructor + · change ¬ TreeColorSetMinusClosed G sigma bs.core + ((HierarchyStoredColorsAt KF 0).biUnion (goodB.gamma 0)) + rw [← hcore, storedEq 0, minusEq baseB.core coreBX] + exact hnot + · exact _root_.GoldbergSeymour.EligibleIndexBound.helper_branch_2341 (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@P) + (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) + (@generatingB) (@baseB) (@HB) (@goodB) (@closureBX) (@corr) (@bs) (@baseStageK) + (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) + (@dividerStageK) (@terminalTree) (@storedEq) (@hpB) (@hcl) (@hcard) private theorem helper_continuation_6826.{u_1, u_2} : helperContinuation6826Conditions.{u_1, u_2} := by @@ -5320,7 +1468,8 @@ private theorem helper_continuation_6826.{u_1, u_2} : storedEq have stageMissingEq (j : Fin (HB.dividerCount + 1)) : HierarchyStageMissingColors KF j = HierarchyStageMissingColors HB j := by - exact @helper_stageMissingEq_5267 (@V) (@E) inferInstance inferInstance inferInstance + exact @EligibleIndexBound.helper_stageMissingEq_2235 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) @@ -5328,7 +1477,8 @@ private theorem helper_continuation_6826.{u_1, u_2} : (@terminalTree) (@j) have earlyMissing (j : Fin (B.length + 1)) (hj : j.val < B.length) : MissingColors G sigma (B.vertex j) = MissingColors G mu (B.vertex j) := by - exact helper_earlyMissing_1796 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_earlyMissing_2244 (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@hBlength) (@hXlength) (@hXB) (@S) (@hSBlen) (@beta) (@hab) (@missingFixed) (@lastPositive) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@j) (@hj) @@ -5343,7 +1493,8 @@ private theorem helper_continuation_6826.{u_1, u_2} : exact TreeSequenceFirstMissingPositionMem hlt have firstEq (c : Fin k) : HierarchyFirstMissingPosition sigma B c = HierarchyFirstMissingPosition mu B c := by - exact helper_firstEq_1146 G k e0 input T phi ett base C ctx P alpha hlenT hBlength S hSBlen + exact EligibleIndexBound.helper_firstEq_1174 G k e0 input T phi ett base C ctx P alpha hlenT + hBlength S hSBlen positiveB aboveB strictB belowB generatingB baseB HB earlyMissing firstLe firstMem c have stageFixed (j : Fin (HB.dividerCount + 1)) (t : Fin (HB.stage j.succ).length) : @@ -5352,7 +1503,8 @@ private theorem helper_continuation_6826.{u_1, u_2} : exact fixedB _ have segmentEq (j : Fin (HB.dividerCount + 1)) (c : Fin k) : HierarchySegmentColors KF j c = HierarchySegmentColors HB j c := by - exact @helper_segmentEq_5302 (@V) (@E) inferInstance inferInstance inferInstance + exact @EligibleIndexBound.helper_segmentEq_2283 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@trans) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) @@ -5373,14 +1525,15 @@ private theorem helper_continuation_6826.{u_1, u_2} : exact goodB.disjointPairs j c d (by rw [storedEq j] at hc; exact hc) (by rw [storedEq j] at hd; exact hd) hne uniqueRefresh := by - exact @helper_uniqueRefresh_5324 (@V) (@E) inferInstance inferInstance inferInstance + exact @EligibleIndexBound.helper_uniqueRefresh_4523 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@missingFixed) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) (@stageBX) (@storedEq) parallelBase := by - exact @helper_parallelBase_5330 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_parallelBase_5019 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) (@hlenT) (@hTnX) (@missingTree) (@minusEq) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@goodB) (@coreBX) (@closureBX) @@ -5399,7 +1552,8 @@ private theorem helper_continuation_6826.{u_1, u_2} : (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) (@trans) (@hlenT) (@hyf) (@beta) (@hbetaF) (@hab) (@fixed) have hnotElementary : ¬ ColoredVertexSetElementary G sigma (TreeSequenceVertexSet B) := by - exact helper_hnotElementary_1918 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_hnotElementary_2365 (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@beta) (@z) (@hzB) (@hbetaz) (@hzy) (@hzX) (@missingFixed) (@hbetaY) let CS : HierarchyCounterexample bs := by @@ -5410,13 +1564,14 @@ private theorem helper_continuation_6826.{u_1, u_2} : maximum := hmaximum notElementary := hnotElementary } have lastStar : HierarchyStarredStage KF (Fin.last KF.dividerCount) = A := by - exact @helper_lastStar_5360 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @_root_.GoldbergSeymour.EligibleIndexBound.helper_lastStar_2378 (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@hcountB) (@hstagesB) (@corr) (@bs) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@starredEq) have hpS : HierarchyPathNumber KF = 1 := by - exact @helper_hpS_5366 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) + exact @helper_hpS_917 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@htail) (@hlenT) (@hBlength) (@hBT) (@consecutive) (@S) (@hSBlen) (@beta) (@hab) (@lastPositive) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@bs) @@ -5424,7 +1579,8 @@ private theorem helper_continuation_6826.{u_1, u_2} : (@increasingK) (@dividerStageK) (@lastStar) have lastOrdinary : HB.stage (Fin.last HB.dividerCount).castSucc = H.stage (Fin.last H.dividerCount).castSucc := by - exact helper_lastOrdinary_1941 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_lastOrdinary_2387 (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hlenT) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@hcountB) (@hstagesB) @@ -5458,7 +1614,8 @@ private theorem helper_continuation_7103.{u_1, u_2} : (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) (c : Fin k) : BoundaryColorEdges G sigma (TreeSequenceVertexSet U) c = BoundaryColorEdges G mu (TreeSequenceVertexSet U) c := by - exact helper_boundaryEq_1679 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_boundaryEq_2121 (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@hends) (@incidentFixed) (@U) (@hUX) (@c) have minusEq (U : TreeSequence G e0) (hUX : TreeSequenceVertexSet U ⊆ TreeSequenceVertexSet X) (R : Finset (Fin k)) : @@ -5468,12 +1625,14 @@ private theorem helper_continuation_7103.{u_1, u_2} : simp only [boundaryEq U hUX] have lastPositive (hq : H.dividerCount ≠ 0) : A = H.stage ⟨H.dividerCount, by omega⟩ := by - exact helper_lastPositive_1695 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_lastPositive_2137 (@G) (@k) (@e0) + (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hlenT) (@S) (@hSBlen) (@hq) have ordinaryA (j : Fin (H.dividerCount + 1)) : TreeSequenceInitialSegment (H.stage j.castSucc) A := by - exact helper_ordinaryA_1704 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_ordinaryA_2146 (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@chain) (@hTnA) (@hlenT) (@S) (@hSBlen) (@lastPositive) (@j) have starA (j : Fin (H.dividerCount + 1)) : @@ -5545,7 +1704,7 @@ private theorem helper_continuation_7103.{u_1, u_2} : (fun i hi => trans (HB.nested i) hi) j have terminalTree : corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc = Tn := by - exact @helper_terminalTree_5246 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_terminalTree_1082 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hp) (@hlenT) (@S) (@hSBlen) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) (@hcore) (@hpe) (@hclosure) @@ -5554,9 +1713,10 @@ private theorem helper_continuation_7103.{u_1, u_2} : have terminalStored : TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by - exact @helper_terminalStored_5253 (@V) (@E) inferInstance inferInstance inferInstance + exact @EligibleIndexBound.helper_terminalStored_647 (@V) (@E) inferInstance inferInstance + inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@hp) (@hlenT) (@hTnX) (@S) (@hSBlen) (@missingTree) (@positiveB) (@aboveB) + (@alpha) (@hlenT) (@hTnX) (@S) (@hSBlen) (@missingTree) (@positiveB) (@aboveB) (@strictB) (@belowB) (@generatingB) (@baseB) (@HB) (@corr) (@hmaximum) (@bs) (@hcore) (@hpe) (@hclosure) (@baseStageK) (@terminalStageK) (@nestedK) (@strictK) (@coreInsideK) (@positiveK) (@increasingK) (@dividerStageK) (@hstage) (@hposition) (@starredEq) @@ -5641,9 +1801,11 @@ theorem HierarchySituationOneShorteningContradiction {V E : Type*} have hh := starNext (Fin.last H.dividerCount) simpa only [Fin.succ_last, H.terminalStage] using hh have hTnCore : TreeSequenceInitialSegment Tn P.replacementBase.core := by - exact helper_hTnCore_1512 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + exact EligibleIndexBound.helper_hTnCore_1684 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) + (@base) (@C) (@ctx) (@P) have coreA : TreeSequenceInitialSegment P.replacementBase.core A := by - exact @helper_coreA_353 V E inferInstance inferInstance inferInstance inferInstance G k e0 + exact @EligibleIndexBound.helper_coreA_200 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C ctx P trans chain have hTnA := trans hTnCore coreA have hlenT : 3 ≤ T.length := by have := A.positive; omega @@ -5659,13 +1821,15 @@ theorem HierarchySituationOneShorteningContradiction {V E : Type*} (hSW : TreeSequenceInitialSegment S W) (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : TreeSequenceInitialSegment S U := by - exact @helper_common_1530 (@V) (@E) (@G) (@e0) (@trans) (@S) (@U) (@W) (@hSW) (@hUW) (@hlen) + exact @EligibleIndexBound.helper_common_1702 (@V) (@E) (@G) (@e0) (@trans) (@S) (@U) (@W) + (@hSW) (@hUW) (@hlen) have hAX : TreeSequenceInitialSegment A X := common hAT hXT (by omega) have hXB : TreeSequenceInitialSegment X B := common hXT hBT (by omega) have hTnX := trans hTnA hAX have hAB := trans hAX hXB have hfull : HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) = B := by - exact helper_hfull_1543 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_hfull_1715 (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hAold) (@htail) (@hlenT) have halphaB : alpha ∈ MissingColors G mu (B.vertex (Fin.last B.length)) := by @@ -5690,7 +1854,8 @@ theorem HierarchySituationOneShorteningContradiction {V E : Type*} have hwf : Incident G w f := by rw [Incident, hends]; exact Sym2.mem_mk_right _ _ have hsource : ∃ S : TreeSequence G e0, S.length ≤ B.length ∧ TashkinovAugmentationSequence mu S T := by - exact helper_hsource_1573 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_hsource_1746 (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hlenT) (@hBlength) (@hXlength) (@hTnX) obtain ⟨S, hSBlen, hseq⟩ := hsource obtain ⟨hlen, hpre, beta, hbetaColor, hbetaMissing⟩ := @@ -5702,11 +1867,13 @@ theorem HierarchySituationOneShorteningContradiction {V E : Type*} have hbetaB : beta ∈ TreeMissingColors mu B := hbetaMissing obtain ⟨z, hzB, hbetaz⟩ := Finset.mem_biUnion.mp hbetaB have hzy : z ≠ y := by - exact helper_hzy_1590 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_hzy_1763 (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@hlenT) (@hyf) (@beta) (@hbetaF) (@z) (@hzB) (@hbetaz) have hzX : z ∈ TreeSequenceVertexSet X := by - exact @helper_hzX_1597 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @_root_.GoldbergSeymour.EligibleIndexBound.helper_hzX_1770 (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@trans) (@hlenT) (@hBlength) (@hXlength) (@S) (@hSBlen) (@z) (@hzB) (@hzy) have hab : alpha ≠ beta := by @@ -5717,18 +1884,21 @@ theorem HierarchySituationOneShorteningContradiction {V E : Type*} let sigma : PartialEdgeColoring E k := fun e => if e = f then some alpha else mu e have fixed (e : E) (hef : e ≠ f) : sigma e = mu e := by simp [sigma, hef] have hsproper : IsProperEdgeColoring G sigma := by - exact @helper_hsproper_482 V E inferInstance inferInstance inferInstance inferInstance G k + exact @EligibleIndexBound.helper_hsproper_329 V E inferInstance inferInstance inferInstance + inferInstance G k e0 input T phi ett base C ctx P alpha haT trans hlenT halphaB hends fixed have hfe0 : f ≠ e0 := by exact @helper_hfe0_1615 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@trans) (@hlenT) (@S) (@hSBlen) (@beta) (@hab) have hsone : IsOneEdgeUncolored sigma e0 := by - exact helper_hsone_1621 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_hsone_1794 (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@fixed) (@hfe0) have noInc (v : V) (hv : v ∈ TreeSequenceVertexSet X) : ¬ Incident G v f := by - exact @helper_noInc_902 V E inferInstance inferInstance inferInstance inferInstance G k e0 + exact @_root_.GoldbergSeymour.EligibleIndexBound.helper_noInc_930 V E inferInstance + inferInstance inferInstance inferInstance G k e0 input T phi ett base C ctx P alpha trans hlenT hXlength hXT hy hends S hSBlen beta hab v hv have incidentFixed (e : E) (he : TreeIncidentEdge X e) : sigma e = mu e := by @@ -5738,7 +1908,8 @@ theorem HierarchySituationOneShorteningContradiction {V E : Type*} exact noInc v hv (hef ▸ hi) have missingFixed (v : V) (hv : v ∈ TreeSequenceVertexSet X) : MissingColors G sigma v = MissingColors G mu v := by - exact @helper_missingFixed_1637 (@V) (@E) inferInstance inferInstance inferInstance + exact @_root_.GoldbergSeymour.EligibleIndexBound.helper_missingFixed_1810 (@V) (@E) + inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@trans) (@hlenT) (@incidentFixed) (@v) (@hv) have fixedB (t : Fin B.length) : sigma (B.edge t) = mu (B.edge t) := by @@ -5748,7 +1919,8 @@ theorem HierarchySituationOneShorteningContradiction {V E : Type*} have stable : StableColoring Tn (TashkinovStoredColors P.corresponding.replacementETT.series.data n) (P.corresponding.replacementETT.series.data.coloring n) sigma := by - exact helper_stable_1654 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact _root_.GoldbergSeymour.EligibleIndexBound.helper_stable_2096 (@G) (@k) (@e0) (@input) + (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@hlenT) (@hTnX) (@incidentFixed) (@missingFixed) have hrouteB : @@ -5760,7 +1932,8 @@ theorem HierarchySituationOneShorteningContradiction {V E : Type*} P.corresponding.replacementETT.series.data.connectingEdges n = {edge} ∧ TreeSequenceAdjoinEdge Tn edge seed ∧ TashkinovAugmentationSequence sigma seed B) := by - exact @helper_hrouteB_951 V E inferInstance inferInstance inferInstance inferInstance G k + exact @_root_.GoldbergSeymour.EligibleIndexBound.helper_hrouteB_979 V E inferInstance + inferInstance inferInstance inferInstance G k e0 input T phi ett base C ctx P alpha trans hlenT hBlength hXlength hBT common hXB hTnX S hSBlen hseq hpre beta hab missingFixed fixedB have missingTree (U : TreeSequence G e0) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean index d3a7fe074c..017470ca8e 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeClaimJMinusOneNonempty.lean @@ -5,6 +5,10 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ReplacementPrefixes + + + public import LeanPool.GoldbergSeymour.HierarchyEligibleCommonMissingIndices public import LeanPool.GoldbergSeymour.HierarchySituationThreeEligibleIndexBound @@ -1333,97 +1337,6 @@ private theorem helper_branch_256 : · intro hc exact Finset.disjoint_left.mp hpairUsed (Finset.mem_union_left _ hbGamma) hc -private theorem helper_hAT_338.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (_ : ℕ), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); TreeSequenceInitialSegment A T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C j A - have starNext (j : Fin (C.hierarchy.dividerCount + 1)) : - TreeSequenceInitialSegment (HierarchyStarredStage C.hierarchy j) - (C.hierarchy.stage j.succ) := - Fin.cases C.hierarchy.coreInsideFirst (fun i => C.hierarchy.nested i.succ) j - simpa only [Fin.succ_last, C.hierarchy.terminalStage] using - starNext (Fin.last C.hierarchy.dividerCount) - -private theorem helper_fullB_360.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); ( - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage R.counterexample.hierarchy (Fin.last - R.counterexample.hierarchy.dividerCount) = A) → (3 : ℕ) ≤ T.length - A.length → - ∀ (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ)) = B := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx j A starEq htail hlen B R - have hn : min ((HierarchyStarredStage R.counterexample.hierarchy - (Fin.last R.counterexample.hierarchy.dividerCount)).length + - (HierarchyFullTailLength R.counterexample - 1)) T.length = T.length - 1 := by - unfold HierarchyFullTailLength - dsimp only - rw [starEq R] - omega - simp only [HierarchyFullTailPrefix, hn] - rfl - -private theorem helper_elementary_372.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) - (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := - TreeSequencePrefix T (T.length - (1 : ℕ)) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - omega); - (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = - B) → - ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx j hlen B fullB R - have h : ColoredVertexSetElementary G R.coloring - (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - 1))) := by - exact HierarchyCounterexamplePenultimateElementary G k e0 - R.corresponding.replacementInput T R.coloring R.corresponding.replacementETT - R.replacementBase R.counterexample R.minimumContext.proper - R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung - R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality - R.minimumContext.largeMissingSet - intro u hu v hv hne - exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne - private theorem helper_branch_410.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Finite V] [Fintype E] (G : LooplessMultigraph V E) @@ -3193,126 +3106,6 @@ private theorem helper_hsame_1512.{u_1, u_2} : rw [← jbEq, ← jaEq, hBT.2.1 jb, hBT.2.1 ja] at hh exact hh -private theorem helper_terminalNe_1523.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → - ∀ (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); TreeSequenceInitialSegment B T → - ∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin - k), ( - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - P.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); - have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = - TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta - ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ - TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ - TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ - TreeInterchangeable G A P.coloring beta alpha)) → - ∀ (z : Fin (B.length + (1 : ℕ))), T.vertex (Fin.last T.length) ≠ B.vertex z := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans hlen B hBT P alpha beta change z hh - have hh := T.vertex_injective (hh.trans (hBT.2.1 z).symm) - have hv := congrArg Fin.val hh - have hz := z.isLt - have hblen : B.length = T.length - 1 := rfl - change T.length = z.val at hv - clear * - hv hz hblen hlen - omega - -private theorem helper_hprecedes_1539.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (j : ℕ), ( - ∀ {X Y Z : TreeSequence G e0}, TreeSequenceInitialSegment X Y → TreeSequenceInitialSegment Y Z - → TreeSequenceInitialSegment X Z) → - let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount); TreeSequenceInitialSegment A T → - ∀ (hlen : (4 : ℕ) ≤ T.length), - let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ) ( - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ); - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - ∀ (hYB : TreeSequenceInitialSegment Y B) (P : HierarchyReplacementPresentation G k e0 input T - phi ett base C ctx) (alpha beta : Fin k) (yb : Fin (Y.length + (1 : ℕ))), - let jb : Fin (B.length + (1 : ℕ)) := Fin.castLE (Nat.succ_le_succ hYB.1) yb; A.length < (↑jb : - ℕ) → (↑(HierarchyFirstMissingPosition P.coloring T beta) : ℕ) = (↑jb : ℕ) → ( - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (P.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - P.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := P.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors P.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition P.coloring T beta); - have vb : V := T.vertex (HierarchyFirstMissingPosition P.coloring T alpha); - have sameComponent : Prop := TwoColorComponent G P.coloring beta alpha (Sum.inl va) = - TwoColorComponent G P.coloring beta alpha (Sum.inl vb); ((0 : ℕ) < H.dividerCount ∧ (beta - ∈ TreeMissingColors P.coloring Tnq ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dnq) → sameComponent) ∧ (H.dividerCount = (0 : ℕ) ∧ (beta ∈ - TreeMissingColors P.coloring Tn ∨ Disjoint (insert beta ({ alpha } : Finset (Fin k)) : - Finset (Fin k)) Dn) → sameComponent) ∧ (beta ∈ TreeMissingColors P.coloring A ∧ - TreeColorSetClosed G P.coloring A ({ beta } : Finset (Fin k)) → sameComponent ∧ - TreeInterchangeable G A P.coloring beta alpha)) → - ∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u (T.vertex (HierarchyFirstMissingPosition - P.coloring T beta)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx j trans A hAT hlen B Y hYB P alpha beta yb - jb hjbA ibEq change u hu - obtain ⟨z, hz⟩ : ∃ z, A.vertex z = u := by simpa [TreeSequenceVertexSet] using hu - refine ⟨Fin.castLE (Nat.succ_le_succ hAT.1) z, _, (hAT.2.1 z).trans hz, rfl, ?_⟩ - have hzlt := z.isLt - change z.val < (HierarchyFirstMissingPosition P.coloring T beta).val - clear * - hzlt hjbA ibEq - omega - private theorem helper_hunusedBetween_1548.{u_1, u_2} : helperHunusedBetween1548Conditions.{u_1, u_2} := by classical @@ -3367,7 +3160,7 @@ private theorem helper_continuation_4396.{u_1, u_2} : (@hiUpper) (@P) (@alpha) (@hSlen) (@hiEq) (@hXlen) (@hXB) (@hYXlen) (@hjaX) (@beta) (@yb) (@jbEq) (@jaEq) (@change) (@hdisD) (@hdisRaw) have terminalNe (z : Fin (B.length + 1)) : T.vertex (Fin.last T.length) ≠ B.vertex z := by - apply helper_terminalNe_1523 <;> assumption + exact hBT.last_vertex_ne (by change T.length - 1 < T.length; omega) z obtain ⟨_, _, hmissing⟩ := componentData P.coloring beta alpha habNe.symm P.minimumContext.proper (TreeSequenceVertexSet B) (elementary P) (B.vertex jb) (B.vertex ja) (T.vertex (Fin.last T.length)) @@ -3377,7 +3170,8 @@ private theorem helper_continuation_4396.{u_1, u_2} : (Sum.inl (T.vertex (Fin.last T.length))) have hprecedes : ∀ u ∈ TreeSequenceVertexSet A, TreeVertexOrder T u (T.vertex (HierarchyFirstMissingPosition P.coloring T beta)) := by - apply helper_hprecedes_1539 <;> assumption + intro vertex member + exact hAT.vertex_precedes (by omega) member have hunusedBetween : beta ∉ (Finset.univ.filter fun c => ∃ t : Fin T.length, (HierarchyFirstMissingPosition P.coloring T beta).val ≤ t.val ∧ t.val < (HierarchyFirstMissingPosition P.coloring T alpha).val ∧ @@ -4285,7 +4079,7 @@ theorem HierarchySituationThreeClaimJMinusOneNonempty {V E : Type*} (Fin.last R.counterexample.hierarchy.dividerCount) = A := (sameLast _ _ _ _ R.sameGood.1.2.1 R.sameGood.1.2.2.1 R.sameGood.1.1).symm have hAT : TreeSequenceInitialSegment A T := by - exact helper_hAT_338 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@j) + exact C.hierarchy.lastStarredInitialSegment have htail : 3 ≤ T.length - A.length := by change j < T.length - A.length at hpathUpper omega @@ -4304,11 +4098,13 @@ theorem HierarchySituationThreeClaimJMinusOneNonempty {V E : Type*} have fullB (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - 1) = B := by - exact helper_fullB_360 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@j) + exact SharedFacts.ReplacementPrefixes.penultimatePrefixEquality (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@j) (@starEq) (@htail) (@hlen) (@R) have elementary (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) : ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by - exact helper_elementary_372 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.ReplacementPrefixes.penultimatePrefixElementary (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@j) (@hlen) (@fullB) (@R) have vertexMem (U : TreeSequence G e0) (j : Fin (U.length + 1)) : U.vertex j ∈ TreeSequenceVertexSet U := by diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean index d47cb2de71..34b18341ad 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeComponentIntersectionShortening.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningTransport + public import LeanPool.GoldbergSeymour.ChangeLemma public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary public import LeanPool.GoldbergSeymour.HierarchyFullTailLength @@ -2441,586 +2443,6 @@ private theorem helper_sameLast_1457.{u_1, u_2} : cases huv rfl -private theorem helper_exceptional_1691.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] - [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E - k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := - P.corresponding.replacementETT; - let mu : PartialEdgeColoring E k := P.coloring; - let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; - let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (j : ℕ), - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let y : V := T.vertex (Fin.last T.length); - ∀ - (_ : - ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : - TreeSequenceInitialSegment U W), - TreeSequenceInitialSegment S W) - (_ : - ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : - TreeSequenceInitialSegment U W) - (_ : S.length ≤ U.length), - TreeSequenceInitialSegment S U) - (_ : HierarchyPathNumber H = j) (_ : TreeSequenceInitialSegment A T) - (_ : - ∀ (_ : H.dividerCount = (0 : ℕ)), - A = P.replacementBase.core) - (_ : B.length = A.length + (j - (2 : ℕ))) (_ : X.length = A.length + (j - (1 : ℕ))) - (_ : TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - (2 : ℕ))) T) - (_ : TreeSequenceInitialSegment (HierarchyFullTailPrefix C (j - (1 : ℕ))) T) - (_ : TreeSequenceInitialSegment A B) (_ : X.length = B.length + (1 : ℕ)) (_ : X.length < - T.length) - (_ : y ∉ TreeSequenceVertexSet B) (_ : alpha ∈ MissingColors G P.coloring (T.vertex - (Fin.last T.length))) - (_ : alpha ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ)))) (_ : - beta ≠ alpha) - (_ : beta ∈ TreeMissingColors P.coloring (HierarchyFullTailPrefix C (j - (2 : ℕ)))) (_ : - alpha ≠ beta) - (_ : - ∀ {S U : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U), - TreeMissingColors mu S ⊆ TreeMissingColors mu U) - (_ : - ∀ {S U : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : S.length = - U.length), - S = U) - (_ : - ∀ (W : TreeSequence G e0) (c : Fin k) (_ : (↑(HierarchyFirstMissingPosition mu W c) : ℕ) - < W.length), - c ∈ MissingColors G mu (W.vertex (HierarchyFirstMissingPosition mu W c))) - (_ : - ∀ {W Z : TreeSequence G e0} (_ : TreeSequenceInitialSegment W Z) (c : Fin k) - (_ : c ∈ TreeMissingColors mu W), - (↑(HierarchyFirstMissingPosition mu Z c) : ℕ) ≤ - W.length) - (_ : - ∀ (_ : R.series.data.kind n ≠ some TashkinovExtensionKind.PE), - ColoredVertexSetClosed G mu (TreeSequenceVertexSet Tn)), - H.dividerCount = (0 : ℕ) → - j = (2 : ℕ) → - R.series.data.kind n ≠ some TashkinovExtensionKind.PE → - ¬∃ u ∈ TreeSequenceVertexSet B, Sum.inl u ∈ TwoColorComponent G mu alpha beta - (Sum.inl y) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H R mu n Tn q A j B X y trans - common hpOld hAT lastZero hBLen hXLen hBT hXT hAB hBXLen hXshort hyB hay haB hba hbB hab - missingMono equalSeg firstMem firstBound nonparallelClosed - exact @helper_exceptional_436 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@beta) (@j) (@trans) (@common) (@hpOld) (@hAT) (@lastZero) (@hBLen) (@hXLen) - (@hBT) (@hXT) (@hAB) (@hBXLen) (@hXshort) (@hyB) (@hay) (@haB) (@hba) (@hbB) (@hab) - (@missingMono) (@equalSeg) (@firstMem) (@firstBound) (@nonparallelClosed) - -private theorem helper_branch_1804.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := - P.corresponding.replacementETT; - let mu : PartialEdgeColoring E k := P.coloring; - let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; - let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (j : ℕ) (_ : (2 : ℕ) ≤ j), - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let y : V := T.vertex (Fin.last T.length); - ∀ - (_ : - ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S U) (_ : - TreeSequenceInitialSegment U W), - TreeSequenceInitialSegment S W) - (_ : - ∀ {S U W : TreeSequence G e0} (_ : TreeSequenceInitialSegment S W) (_ : - TreeSequenceInitialSegment U W) - (_ : S.length ≤ U.length), - TreeSequenceInitialSegment S U) - (_ : HierarchyPathNumber H = j) - (_ : - ∀ (b : ℕ) (hb : b < H.dividerCount + (2 : ℕ)) (a : Fin (H.dividerCount + (2 : ℕ))), - (↑a : ℕ) ≤ b → - TreeSequenceInitialSegment (H.stage a) (H.stage (⟨b, hb⟩ : Fin - (H.dividerCount + (2 : ℕ))))) - (_ : - ∀ (_ : H.dividerCount = (0 : ℕ)), - A = P.replacementBase.core) - (_ : - ∀ (_ : H.dividerCount ≠ (0 : ℕ)), - A = - H.stage - (⟨H.dividerCount, by - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) - (_ : B.length = A.length + (j - (2 : ℕ))) (_ : X.length = A.length + (j - (1 : ℕ))) - (_ : X.length = B.length + (1 : ℕ)) (_ : beta ≠ alpha) (_ : alpha ≠ beta) - (_ : - H.dividerCount = (0 : ℕ) → - j = (2 : ℕ) → - R.series.data.kind n ≠ some TashkinovExtensionKind.PE → - ¬∃ u ∈ TreeSequenceVertexSet B, Sum.inl u ∈ TwoColorComponent G mu alpha beta - (Sum.inl y)) - (S U : TreeSequence G e0) (_ : TreeSequenceInitialSegment B S) (_ : - TashkinovAugmentationSequence mu S U) - (_ : - H.dividerCount = (0 : ℕ) → - j = (2 : ℕ) → - R.series.data.kind n ≠ some - TashkinovExtensionKind.PE → - S = X) - (_ : TreeSequenceInitialSegment S T) (_ : TreeSequenceInitialSegment A S) - (_ : - R.series.data.kind (Fin.last R.rounds) = some TashkinovExtensionKind.SE ∨ - R.series.data.kind (Fin.last R.rounds) = some TashkinovExtensionKind.RE) - (f : E) (seed : TreeSequence G e0) (_ : R.series.data.connectingEdges (Fin.last R.rounds) - = ({f} : Finset E)) - (_ : TreeSequenceAdjoinEdge (R.series.data.tree (Fin.last R.rounds).castSucc) f seed) - (_ : TashkinovAugmentationSequence mu seed T), - R.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence mu - Tn U ∨ - (R.series.data.kind n = some TashkinovExtensionKind.SE ∨ - R.series.data.kind n = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), - R.series.data.connectingEdges n = ({f} : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence mu seed U := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta H R mu n Tn q A j hpathLower B X - y trans common hpOld chain lastZero lastPositive hBLen hXLen hBXLen hba hab exceptional S U - hBS hSUaug hScorner hST hAS hkind f seed hedges hadjoin haug - exact @helper_branch_636 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@beta) (@j) (@hpathLower) (@trans) (@common) (@hpOld) (@chain) (@lastZero) - (@lastPositive) (@hBLen) (@hXLen) (@hBXLen) (@hba) (@hab) (@exceptional) (@S) (@U) - (@hBS) (@hSUaug) (@hScorner) (@hST) (@hAS) (@hkind) (@f) (@seed) (@hedges) (@hadjoin) - (@haug) - -private theorem helper_stageB_1930.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := - P.corresponding.replacementETT; - let mu : PartialEdgeColoring E k := P.coloring; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (j : ℕ), - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (2 : ℕ)); - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - ∀ (_ : B.length = A.length + (j - (2 : ℕ))) (_ : X.length = A.length + (j - (1 : ℕ))) - (_ : X.length = B.length + (1 : ℕ)) (_ U : TreeSequence G e0) (newInput : - PartialEdgeColoring E k) - (newSeries : TashkinovSeries G k R.rounds e0 newInput) (_ : mu = newSeries.data.coloring - (Fin.last R.rounds)) - (_ : - ∀ (i : Fin R.rounds), - newSeries.data.tree i.succ.castSucc = R.series.data.tree - i.succ.castSucc) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.stored i = R.series.data.stored i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.connectingEdges i = - R.series.data.connectingEdges i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.kind i = R.series.data.kind i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - IsProperEdgeColoring G (newSeries.data.coloring i)) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - IsOneEdgeUncolored (newSeries.data.coloring i) e0) - (_ : - ∀ (i : Fin R.rounds), - StableColoring (R.series.data.tree i.succ.castSucc) (TashkinovStoredColors - R.series.data i.succ) - (R.series.data.coloring i.succ) (newSeries.data.coloring i.succ)) - (roundsPositive : (1 : ℕ) ≤ R.1) - (above : - TreeSequenceInitialSegment - (newSeries.data.tree - (⟨R.1, by - omega⟩ : - Fin (R.1 + (2 : ℕ)))) - U) - (strict : - (newSeries.data.tree - (⟨R.1, by - omega⟩ : - Fin (R.1 + (2 : ℕ)))).length < - U.length) - (below : TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) - (generating : mu = newSeries.data.coloring (Fin.last R.1)) - (_ : - { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, abovePenultimate - := above, - strictAbovePenultimate := strict, belowFinal := below, generatingColoring := - generating : - ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ - newSeries), - let RU : ExtendedTashkinovTree G k e0 newInput U mu := - { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, - abovePenultimate := above, - strictAbovePenultimate := strict, belowFinal := below, generatingColoring := - generating : - ExtendedTashkinovTree G k e0 newInput U mu }; - ∀ (_ : HierarchyBase RU mu) - (_ : - ∀ (i : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (H.stage - i.castSucc) B) - (i : Fin H.dividerCount), - (↑(H.dividerPosition i) : ℕ) ≤ B.length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu q A j B X hBLen hXLen hBXLen S U - newInput newSeries hgen htrees hstored hedges hkinds hproper hone hstable roundsPositive above - strict below generating hseries RU baseU stageB i - exact @helper_hdivB_717 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@hBLen) - (@hXLen) (@hBXLen) (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) - (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) - (@below) (@generating) (@hseries) (@baseU) (@stageB) (@i) - -private theorem helper_newNested_2040.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := - P.corresponding.replacementETT; - let mu : PartialEdgeColoring E k := P.coloring; - ∀ (_ : ℕ) (_ U : TreeSequence G e0) (newInput : PartialEdgeColoring E k) - (newSeries : TashkinovSeries G k R.rounds e0 newInput) (_ : mu = newSeries.data.coloring - (Fin.last R.rounds)) - (_ : - ∀ (i : Fin R.rounds), - newSeries.data.tree i.succ.castSucc = R.series.data.tree - i.succ.castSucc) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.stored i = R.series.data.stored i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.connectingEdges i = - R.series.data.connectingEdges i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.kind i = R.series.data.kind i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - IsProperEdgeColoring G (newSeries.data.coloring i)) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - IsOneEdgeUncolored (newSeries.data.coloring i) e0) - (_ : - ∀ (i : Fin R.rounds), - StableColoring (R.series.data.tree i.succ.castSucc) (TashkinovStoredColors R.series.data - i.succ) - (R.series.data.coloring i.succ) (newSeries.data.coloring i.succ)) - (roundsPositive : (1 : ℕ) ≤ R.1) - (above : - TreeSequenceInitialSegment - (newSeries.data.tree - (⟨R.1, by - omega⟩ : - Fin (R.1 + (2 : ℕ)))) - U) - (strict : - (newSeries.data.tree - (⟨R.1, by - omega⟩ : - Fin (R.1 + (2 : ℕ)))).length < - U.length) - (below : TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) - (generating : mu = newSeries.data.coloring (Fin.last R.1)) - (_ : - { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, abovePenultimate - := above, - strictAbovePenultimate := strict, belowFinal := below, generatingColoring := - generating : - ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ - newSeries), - let RU : ExtendedTashkinovTree G k e0 newInput U mu := - { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, - abovePenultimate := above, - strictAbovePenultimate := strict, belowFinal := below, generatingColoring := generating - : - ExtendedTashkinovTree G k e0 newInput U mu }; - ∀ (_ : HierarchyBase RU mu) - (_ : - ∀ (i : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (H.stage - i.castSucc) U), - let newStage : - Fin (H.dividerCount + (2 : ℕ)) → - TreeSequence G e0 := fun (i : Fin - (H.dividerCount + (2 : ℕ))) ↦ - if (↑i : ℕ) = H.dividerCount + (1 : ℕ) then U else H.stage i; - ∀ (_ : - ∀ (i : Fin (H.dividerCount + (1 : ℕ))), - newStage i.castSucc = H.stage i.castSucc) - (_ : newStage (Fin.last (H.dividerCount + (1 : ℕ))) = U) - (_ : - ∀ (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : ℕ) ≤ H.dividerCount), - newStage i - = H.stage i) - (i : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (newStage i.castSucc) - (newStage i.succ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu j S U newInput newSeries hgen htrees - hstored hedges hkinds hproper hone hstable roundsPositive above strict below generating - hseries RU baseU stageU newStage newStageOld newStageLast newStageAt - exact @helper_newNested_748 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) - (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) (@hkinds) - (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) (@below) - (@generating) (@hseries) (@baseU) (@stageU) (@newStageOld) (@newStageLast) (@newStageAt) - -private theorem helper_newStrict_2123.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := - P.corresponding.replacementETT; - let mu : PartialEdgeColoring E k := P.coloring; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (_ : ℕ) (_ U : TreeSequence G e0) (_ : A.length < U.length) (newInput : PartialEdgeColoring - E k) - (newSeries : TashkinovSeries G k R.rounds e0 newInput) (_ : mu = newSeries.data.coloring - (Fin.last R.rounds)) - (_ : - ∀ (i : Fin R.rounds), - newSeries.data.tree i.succ.castSucc = R.series.data.tree - i.succ.castSucc) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.stored i = R.series.data.stored i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.connectingEdges i = - R.series.data.connectingEdges i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.kind i = R.series.data.kind i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - IsProperEdgeColoring G (newSeries.data.coloring i)) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - IsOneEdgeUncolored (newSeries.data.coloring i) e0) - (_ : - ∀ (i : Fin R.rounds), - StableColoring (R.series.data.tree i.succ.castSucc) (TashkinovStoredColors R.series.data - i.succ) - (R.series.data.coloring i.succ) (newSeries.data.coloring i.succ)) - (roundsPositive : (1 : ℕ) ≤ R.1) - (above : - TreeSequenceInitialSegment - (newSeries.data.tree - (⟨R.1, by - omega⟩ : - Fin (R.1 + (2 : ℕ)))) - U) - (strict : - (newSeries.data.tree - (⟨R.1, by - omega⟩ : - Fin (R.1 + (2 : ℕ)))).length < - U.length) - (below : TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) - (generating : mu = newSeries.data.coloring (Fin.last R.1)) - (_ : - { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, abovePenultimate - := above, - strictAbovePenultimate := strict, belowFinal := below, generatingColoring := - generating : - ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ - newSeries), - let RU : ExtendedTashkinovTree G k e0 newInput U mu := - { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, - abovePenultimate := above, - strictAbovePenultimate := strict, belowFinal := below, generatingColoring := generating - : - ExtendedTashkinovTree G k e0 newInput U mu }; - ∀ (_ : HierarchyBase RU mu) - (_ : - ∀ (i : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (H.stage - i.castSucc) A), - let newStage : - Fin (H.dividerCount + (2 : ℕ)) → - TreeSequence G e0 := fun (i : Fin - (H.dividerCount + (2 : ℕ))) ↦ - if (↑i : ℕ) = H.dividerCount + (1 : ℕ) then U else H.stage i; - ∀ (_ : - ∀ (i : Fin (H.dividerCount + (1 : ℕ))), - newStage i.castSucc = H.stage i.castSucc) - (_ : newStage (Fin.last (H.dividerCount + (1 : ℕ))) = U) - (_ : - ∀ (i : Fin (H.dividerCount + (2 : ℕ))) (_ : (↑i : ℕ) ≤ H.dividerCount), - newStage i - = H.stage i) - (i : Fin (H.dividerCount + (1 : ℕ))), - (newStage i.castSucc).length < (newStage - i.succ).length := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu q A j S U hAUstrict newInput - newSeries hgen htrees hstored hedges hkinds hproper hone hstable roundsPositive above strict - below generating hseries RU baseU stageA newStage newStageOld newStageLast newStageAt - exact @helper_newStrict_758 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) - (@S) (@U) (@hAUstrict) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) - (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) (@below) - (@generating) (@hseries) (@baseU) (@stageA) (@newStageOld) (@newStageLast) (@newStageAt) - -private theorem helper_stageA_2164.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) - (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - let R : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := - P.corresponding.replacementETT; - let mu : PartialEdgeColoring E k := P.coloring; - let n : Fin (R.rounds + (1 : ℕ)) := Fin.last R.rounds; - let Tn : TreeSequence G e0 := R.series.data.tree n.castSucc; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (_ : ℕ) - (_ : - ∀ (b : ℕ) (hb : b < H.dividerCount + (2 : ℕ)) (a : Fin (H.dividerCount + (2 : ℕ))), - (↑a : ℕ) ≤ b → - TreeSequenceInitialSegment (H.stage a) (H.stage (⟨b, hb⟩ : Fin - (H.dividerCount + (2 : ℕ))))) - (_ : - ∀ (_ : H.dividerCount ≠ (0 : ℕ)), - A = - H.stage - (⟨H.dividerCount, by - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) - (_ : TreeSequenceInitialSegment Tn A) (_ U : TreeSequence G e0) (newInput : - PartialEdgeColoring E k) - (newSeries : TashkinovSeries G k R.rounds e0 newInput) (_ : mu = newSeries.data.coloring - (Fin.last R.rounds)) - (_ : - ∀ (i : Fin R.rounds), - newSeries.data.tree i.succ.castSucc = R.series.data.tree - i.succ.castSucc) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.stored i = R.series.data.stored i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.connectingEdges i = - R.series.data.connectingEdges i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - newSeries.data.kind i = R.series.data.kind i) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - IsProperEdgeColoring G (newSeries.data.coloring i)) - (_ : - ∀ (i : Fin (R.rounds + (1 : ℕ))), - IsOneEdgeUncolored (newSeries.data.coloring i) e0) - (_ : - ∀ (i : Fin R.rounds), - StableColoring (R.series.data.tree i.succ.castSucc) (TashkinovStoredColors R.series.data - i.succ) - (R.series.data.coloring i.succ) (newSeries.data.coloring i.succ)) - (roundsPositive : (1 : ℕ) ≤ R.1) - (above : - TreeSequenceInitialSegment - (newSeries.data.tree - (⟨R.1, by - omega⟩ : - Fin (R.1 + (2 : ℕ)))) - U) - (strict : - (newSeries.data.tree - (⟨R.1, by - omega⟩ : - Fin (R.1 + (2 : ℕ)))).length < - U.length) - (below : TreeSequenceInitialSegment U (newSeries.data.tree (Fin.last (R.1 + (1 : ℕ))))) - (generating : mu = newSeries.data.coloring (Fin.last R.1)) - (_ : - { rounds := R.1, roundsPositive := roundsPositive, series := newSeries, abovePenultimate - := above, - strictAbovePenultimate := strict, belowFinal := below, generatingColoring := - generating : - ExtendedTashkinovTree G k e0 newInput U mu }.series ≍ - newSeries), - let RU : ExtendedTashkinovTree G k e0 newInput U mu := - { rounds := R.rounds, roundsPositive := roundsPositive, series := newSeries, - abovePenultimate := above, - strictAbovePenultimate := strict, belowFinal := below, generatingColoring := generating - : - ExtendedTashkinovTree G k e0 newInput U mu }; - ∀ (_ : HierarchyBase RU mu) (i : Fin (H.dividerCount + (1 : ℕ))), - TreeSequenceInitialSegment (H.stage i.castSucc) A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P H R mu n Tn q A j chain lastPositive hTnA S - U newInput newSeries hgen htrees hstored hedges hkinds hproper hone hstable roundsPositive - above strict below generating hseries RU baseU i - exact @helper_stageA_704 (@V) (@E) inferInstance inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@chain) - (@lastPositive) (@hTnA) (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) - (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) - (@below) (@generating) (@hseries) (@baseU) (@i) - private theorem helper_equalSeg_2078.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {S U : TreeSequence G e0} @@ -3033,20 +2455,6 @@ private theorem helper_equalSeg_2078.{u_1, u_2} : exact @helper_branch_317 (@V) (@E) (@G) (@e0) (@U) (@sl) (@sp) (@sv) (@se) (@svi) (@sei) (@sf) (@sa) (@hSU) (@hlen) -private theorem helper_trans_1966.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {S U W : TreeSequence G - e0} - (_ : TreeSequenceInitialSegment S U) (_ : TreeSequenceInitialSegment U W), - TreeSequenceInitialSegment S W := by - classical - intro V E G e0 S U W hSU hUW - refine ⟨hSU.1.trans hUW.1, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) - private theorem helper_stableClosed_2136.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) (e0 @@ -3437,14 +2845,14 @@ private theorem helper_continuation_2763.{u_1, u_2} : hstoredEq stageA stageU stageB hdivB prefixEq newStage newStageOld newStageLast newStageAt have newNested : ∀ i : Fin (H.dividerCount + 1), TreeSequenceInitialSegment (newStage i.castSucc) (newStage i.succ) := by - exact @helper_newNested_2040 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @helper_newNested_748 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) (@below) (@generating) (@hseries) (@baseU) (@stageU) (@newStageOld) (@newStageLast) (@newStageAt) have newStrict : ∀ i : Fin (H.dividerCount + 1), (newStage i.castSucc).length < (newStage i.succ).length := by - exact @helper_newStrict_2123 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @helper_newStrict_758 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@S) (@U) (@hAUstrict) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) (@below) (@generating) @@ -3611,7 +3019,7 @@ private theorem componentIntersectionFromSpliceFacts.{u_1, u_2} : with ⟨hpe, haug⟩ | ⟨hkind, f, seed, hedges, hadjoin, hinc, hcolor, haug⟩ · exact Or.inl ⟨hpe, (TashkinovAugmentationSequenceRestrict mu Tn S T haug hTnS hST).trans hSUaug⟩ - · exact @helper_branch_1804 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + · exact @helper_branch_636 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@j) (@hpathLower) (@trans) (@common) (@hpOld) (@chain) (@lastZero) (@lastPositive) (@hBLen) (@hXLen) (@hBXLen) (@hba) (@hab) (@exceptional) (@S) (@U) (@hBS) (@hSUaug) (@hScorner) @@ -3649,7 +3057,7 @@ private theorem componentIntersectionFromSpliceFacts.{u_1, u_2} : (@newSeries) (@hgen) (@hstored) (@hTnEq) have stageA (i : Fin (H.dividerCount + 1)) : TreeSequenceInitialSegment (H.stage i.castSucc) A := by - exact @helper_stageA_2164 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @helper_stageA_704 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@chain) (@lastPositive) (@hTnA) (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) @@ -3659,7 +3067,7 @@ private theorem componentIntersectionFromSpliceFacts.{u_1, u_2} : have stageB (i : Fin (H.dividerCount + 1)) : TreeSequenceInitialSegment (H.stage i.castSucc) B := trans (stageA i) hAB have hdivB (i : Fin H.dividerCount) : (H.dividerPosition i).val ≤ B.length := by - exact @helper_stageB_1930 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @helper_hdivB_717 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@j) (@hBLen) (@hXLen) (@hBXLen) (@S) (@U) (@newInput) (@newSeries) (@hgen) (@htrees) (@hstored) (@hedges) (@hkinds) (@hproper) (@hone) (@hstable) (@roundsPositive) (@above) (@strict) @@ -3788,7 +3196,7 @@ private theorem componentIntersectionFromMissingColors.{u_1, u_2} : R.series.data.kind n ≠ some TashkinovExtensionKind.PE → ¬ ∃ u ∈ TreeSequenceVertexSet B, Sum.inl u ∈ TwoColorComponent G mu alpha beta (Sum.inl y) := by - exact @helper_exceptional_1691 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_exceptional_436 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@j) (@trans) (@common) (@hpOld) (@hAT) (@lastZero) (@hBLen) (@hXLen) (@hBT) (@hXT) (@hAB) (@hBXLen) (@hXshort) (@hyB) (@hay) (@haB) (@hba) (@hbB) (@hab) @@ -3900,7 +3308,7 @@ theorem HierarchySituationThreeComponentIntersectionShortening (hSU : TreeSequenceInitialSegment S U) (hUW : TreeSequenceInitialSegment U W) : TreeSequenceInitialSegment S W := by as_aux_lemma => - exact @helper_trans_1966 (@V) (@E) (@G) (@e0) (@S) (@U) (@W) (@hSU) (@hUW) + exact @SharedFacts.ShorteningTransport.trans (@V) (@E) (@G) (@e0) (@S) (@U) (@W) (@hSU) (@hUW) have common {S U W : TreeSequence G e0} (hSW : TreeSequenceInitialSegment S W) (hUW : TreeSequenceInitialSegment U W) (hlen : S.length ≤ U.length) : diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean index 18e6a9a947..0e2ca679cd 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaStoredImpossible.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaRoutes + public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaTransport @@ -534,141 +536,6 @@ private abbrev helperContinuation3542Conditions.{u_1, u_2} : Prop := ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A d.switched.coloring gamma beta)), False -private theorem helper_routeToY_837.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - TreeSequenceInitialSegment A T → ( - ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → - U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → - TreeSequenceInitialSegment Y T → TreeSequenceInitialSegment X Y → - TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment A Y → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) = A) → ( - ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : - ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : - TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → - IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → - ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new - ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage - K (Fin.last K.dividerCount)).edge t)) → Y.length = X.length + (1 : ℕ) → - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : - PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable - S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring - (T.edge t)) → ( - ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → - let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := - S.corresponding.replacementETT; - let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; - let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some - TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n - = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) - ∧ - ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = { f } ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A ell - X Y Z hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn - hw hf hm - as_aux_lemma => - have hj : 2 ≤ j := hpathLower - clear * - G k e0 input T phi ett base C ctx S nu hn hw hf hm - A X Y Z hAtoT hYtoT hXtoY hYtoZ hXYlen hAtoY hYlen hj j sameStarAll - commonPrefix weakEdges - clear_value A X Y Z - let et := S.corresponding.replacementETT - let K := S.counterexample.hierarchy - let Tn := et.series.data.tree (Fin.last et.rounds).castSucc - have hTnT : TreeSequenceInitialSegment Tn T := et.abovePenultimate - have hTnA : Tn.length ≤ A.length := by - by_cases hz : K.dividerCount = 0 - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz - have hs := sameStarAll S - change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs - rw [hi] at hs - change S.replacementBase.core = A at hs - by_cases hp : et.series.data.kind (Fin.last et.rounds) = - some TashkinovExtensionKind.PE - · rw [← hs]; exact (Classical.choice (S.replacementBase.parallel hp).2.2).leftSegment.1 - · rw [← hs, S.replacementBase.nonparallel hp] - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := - Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) - have hs := sameStarAll S - change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs - rw [hi] at hs - have hmono : Monotone (fun i : Fin (K.dividerCount + 2) => (K.stage i).length) := - Fin.monotone_iff_le_succ.mpr (fun i => (K.nested i).1) - rw [← hs] - change Tn.length ≤ (K.stage _).length - rw [show Tn = K.stage 0 from K.baseStage.symm] - exact hmono (Fin.zero_le _) - have hAYstrict : A.length < Y.length := by - clear * - hj hYlen - omega - have fixedA : ∀ t : Fin A.length, nu (A.edge t) = S.coloring (A.edge t) := by - have he := weakEdges S.coloring nu et S.replacementBase K hw - S.minimumContext.oneEdgeUncolored hn - change ∀ t : Fin (HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).length, - nu ((HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) = - S.coloring ((HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) at he - rw [sameStarAll S] at he - exact he - have fixedY : ∀ t : Fin Y.length, nu (Y.edge t) = S.coloring (Y.edge t) := by - intro t - let tT : Fin T.length := Fin.castLE hYtoT.1 t - have he : T.edge tT = Y.edge t := hYtoT.2.2 t - by_cases ht : t.val < A.length - · let tA : Fin A.length := ⟨t.val, ht⟩ - have hcast : Fin.castLE hAtoT.1 tA = tT := Fin.ext rfl - rw [← he, ← hcast, hAtoT.2.2 tA] - exact fixedA tA - · rw [← he] - exact hf tT (Nat.le_of_not_gt ht) t.isLt - have transport (W : TreeSequence G e0) - (hr : TashkinovAugmentationSequence S.coloring W Y) : - TashkinovAugmentationSequence nu W Y := - TashkinovAugmentationSequenceColoringTransport S.coloring nu W X Y hr - hXtoY hXYlen (fun t _ => fixedY t) - (fun v hv => hm v (TreeSequenceInitialSegmentVertexSetSubset hYtoZ - (TreeSequenceInitialSegmentVertexSetSubset hXtoY hv))) - rcases P2813_T1_TerminalRoute G k e0 S.corresponding.replacementInput T - S.coloring et with ⟨hp, hr⟩ | ⟨hk, f, seed, he, ha, _, _, hr⟩ - · have hTY : TreeSequenceInitialSegment Tn Y := - commonPrefix hTnT hYtoT (hTnA.trans hAtoY.1) - exact Or.inl ⟨hp, transport Tn - (TashkinovAugmentationSequenceRestrict S.coloring Tn Y T hr hTY hYtoT)⟩ - · have hseedT : TreeSequenceInitialSegment seed T := - TashkinovAugmentationSequenceInitialSegment S.coloring seed T hr - have hseedY : TreeSequenceInitialSegment seed Y := - commonPrefix hseedT hYtoT (by - have hl := ha.1 - change seed.length = Tn.length + 1 at hl - clear * - hl hTnA hAYstrict - omega) - exact Or.inr ⟨hk, f, seed, he, ha, transport seed - (TashkinovAugmentationSequenceRestrict S.coloring seed Y T hr hseedY hYtoT)⟩ - private theorem helper_hfixed3_1220.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -865,94 +732,6 @@ private theorem helper_caseGamma_1171.{u_1, u_2} : rw [hc] at hm exact hm -private theorem helper_changeRho_1319.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - ∀ (gamma : Fin k), (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length → gamma ≠ - d.theta → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) = A) → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : - ℕ)) = Z) → - ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho - (TreeSequenceVertexSet Z) → HierarchyFirstMissingPosition rho T gamma = - HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta - = HierarchyFirstMissingPosition sigma T d.theta → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) - → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) < (↑(HierarchyFirstMissingPosition - sigma T d.theta) : ℕ) → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho - Z → - let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := - R1.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - R1.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition rho T gamma); - have vb : V := T.vertex (HierarchyFirstMissingPosition rho T d.theta); - have sameComponent : Prop := TwoColorComponent G rho gamma d.theta (Sum.inl va) = - TwoColorComponent G rho gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ - TreeMissingColors rho Tnq ∨ Disjoint { gamma, d.theta } Dnq) → sameComponent) ∧ ( - H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors rho Tn ∨ Disjoint { gamma, d.theta } - Dn) → sameComponent) ∧ ( gamma ∈ TreeMissingColors rho A ∧ TreeColorSetClosed G rho A - { gamma } → sameComponent ∧ TreeInterchangeable G A rho gamma d.theta) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A ell Y Z - gamma hthetaFirstIndex hgammaNeTheta sameStarAll samePenultimate R1 rho hElemRho - hfirstGammaRho hfirstThetaRho hgammaUnusedRho hgammaBeforeTheta hpairMissingRho - as_aux_lemma => - exact ChangeLemma G k e0 R1.corresponding.replacementInput T rho - R1.corresponding.replacementETT R1.replacementBase R1.counterexample - R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung - R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality - (by change ColoredVertexSetElementary G rho - (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample - (HierarchyFullTailLength R1.counterexample - 1))) - rw [samePenultimate R1]; exact hElemRho) - R1.minimumContext.largeMissingSet gamma d.theta hgammaNeTheta - (by change gamma ∈ TreeMissingColors rho - (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - - 1)) ∧ - d.theta ∈ TreeMissingColors rho - (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength - R1.counterexample - 1)) - rw [samePenultimate R1]; exact hpairMissingRho) - (by - dsimp only - rw [sameStarAll R1, hfirstGammaRho, hfirstThetaRho] - intro _ - refine ⟨⟨_, _, rfl, rfl, hgammaBeforeTheta⟩, ?_⟩ - intro hc - obtain ⟨_, t, hlo, hhi, he⟩ := Finset.mem_filter.mp hc - rw [hthetaFirstIndex] at hhi - exact hgammaUnusedRho t hlo hhi he) - private theorem helper_hbetaUnused_658.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1085,79 +864,6 @@ private theorem helper_horderedUnusedGammaBeta_921.{u_1, u_2} : exact hgammaUnused t hlo (hhi.trans_le (hbetaFirstLe.trans (hBtoX.1.trans hXtoY.1))) he -private theorem helper_firstChange_985.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (gamma : Fin k), gamma ≠ beta → HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount) = A → ( gamma ∉ TreeMissingColors sigma A ∨ beta ∉ - TreeMissingColors sigma A → TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition - sigma T gamma)) (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ gamma ∉ ({c : - Fin k | - ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition sigma - T beta) : ℕ) ∧ sigma (T.edge t) = some c} : Finset (Fin k))) → ColoredVertexSetElementary - G sigma (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - (1 : ℕ)))) → gamma ∈ TreeMissingColors sigma - (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ))) ∧ beta ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - (1 : ℕ))) → - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - R.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition sigma T gamma); - have vb : V := T.vertex (HierarchyFirstMissingPosition sigma T beta); - have sameComponent : Prop := TwoColorComponent G sigma gamma beta (Sum.inl va) = - TwoColorComponent G sigma gamma beta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ - TreeMissingColors sigma Tnq ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset - (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - sigma Tn ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → - sameComponent) ∧ ( gamma ∈ TreeMissingColors sigma A ∧ TreeColorSetClosed G sigma A - ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A sigma gamma beta) - := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma - hgammaNeBeta sameStar horderedUnusedGammaBeta hchangeElementary hchangeMissing - as_aux_lemma => - exact ChangeLemma G k e0 R.corresponding.replacementInput T sigma - R.corresponding.replacementETT R.replacementBase R.counterexample - R.minimumContext.proper R.minimumContext.oneEdgeUncolored - R.minimumContext.lowerRung R.minimumContext.fewerDividers - R.minimumContext.lexicographicMinimality hchangeElementary - R.minimumContext.largeMissingSet gamma beta hgammaNeBeta hchangeMissing - (by - change (gamma ∉ TreeMissingColors sigma A ∨ beta ∉ TreeMissingColors sigma A) → - TreeVertexOrder T - (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) - (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ - gamma ∉ (Finset.univ.filter fun c => - ∃ t : Fin T.length, A.length ≤ t.val ∧ - t.val < (HierarchyFirstMissingPosition sigma T beta).val ∧ - sigma (T.edge t) = some c) - exact horderedUnusedGammaBeta) - private theorem helper_hgammaTerminalDistinct_1048.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1286,102 +992,6 @@ private theorem helper_hgammaCutoff_1202.{u_1, u_2} : subst eta exact hthetaFirst.2 -private theorem helper_sameGammaTheta_1456.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - ∀ (gamma : Fin k), ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (0 : ℕ) < - S.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors S.coloring - (S.counterexample.hierarchy.stage (⟨S.counterexample.hierarchy.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (S.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ - S.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors S.coloring - (S.corresponding.replacementETT.series.data.tree (Fin.last - S.corresponding.replacementETT.rounds).castSucc)) → - ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := R1.coloring; HierarchyFirstMissingPosition rho T gamma = - HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta - = HierarchyFirstMissingPosition sigma T d.theta → ( - let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := - R1.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - R1.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition R1.coloring T gamma); - have vb : V := T.vertex (HierarchyFirstMissingPosition R1.coloring T d.theta); - have sameComponent : Prop := TwoColorComponent G R1.coloring gamma d.theta (Sum.inl va) = - TwoColorComponent G R1.coloring gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ - (gamma ∈ TreeMissingColors R1.coloring Tnq ∨ Disjoint (insert gamma ({ d.theta } : Finset - (Fin k)) : Finset (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ - TreeMissingColors R1.coloring Tn ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : - Finset (Fin k)) Dn) → sameComponent) ∧ ( gamma ∈ TreeMissingColors R1.coloring A ∧ - TreeColorSetClosed G R1.coloring A ({ gamma } : Finset (Fin k)) → sameComponent ∧ - TreeInterchangeable G A R1.coloring gamma d.theta)) → TwoColorComponent G rho gamma - d.theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) = - TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition - sigma T d.theta))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma caseGamma R1 - rho hfirstGammaRho hfirstThetaRho changeRho - have he : TwoColorComponent G rho gamma d.theta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T gamma))) = - TwoColorComponent G rho gamma d.theta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T d.theta))) := by - rcases caseGamma R1 with ⟨hp, hm⟩ | ⟨hz, hm⟩ - · exact changeRho.1 ⟨hp, Or.inl hm⟩ - · exact changeRho.2.1 ⟨hz, Or.inl hm⟩ - rw [hfirstGammaRho, hfirstThetaRho] at he - exact he - -private theorem helper_hthetaTerminalDistinct_1473.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; A.length + j < T.length → Y.length = - A.length + j → (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length → - T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ T.vertex (Fin.last T.length) - := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A Y - hcutJstrict hYlen hthetaFirstIndex he - have hv := congrArg Fin.val (T.vertex_injective he) - simp only [Fin.val_last] at hv - rw [hthetaFirstIndex] at hv - have hlt : Y.length < T.length := hYlen.symm ▸ hcutJstrict - exact Nat.ne_of_lt hlt hv - private theorem helper_hstored3_1568.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1743,7 +1353,8 @@ private theorem helper_continuation_2545.{u_1, u_2} : rw [he] exact ⟨hgammaMissingZ, hthetaMissingZ⟩ have changeRho := by - exact @helper_changeRho_1319 V E inferInstance inferInstance inferInstance inferInstance G k + exact @SharedFacts.DisjointThetaRoutes.changeReplacementColoring V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C ctx P alpha beta d j gamma hthetaFirstIndex hgammaNeTheta sameStarAll samePenultimate R1 hElemRho hfirstGammaRho hfirstThetaRho hgammaUnusedRho hgammaBeforeTheta hpairMissingRho @@ -1751,19 +1362,28 @@ private theorem helper_continuation_2545.{u_1, u_2} : (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T d.theta))) := by - exact @helper_sameGammaTheta_1456 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@beta) (@d) (@gamma) (@caseGamma) (@R1) (@hfirstGammaRho) (@hfirstThetaRho) - (@changeRho) + have equal : TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T gamma))) = + TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T d.theta))) := + (caseGamma R1).elim + (fun missing => changeRho.1 ⟨missing.1, Or.inl missing.2⟩) + (fun missing => changeRho.2.1 ⟨missing.1, Or.inl missing.2⟩) + rw [hfirstGammaRho, hfirstThetaRho] at equal + exact equal have hgammaThetaDistinct : T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex (HierarchyFirstMissingPosition sigma T d.theta) := by intro he exact ne_of_lt hgammaBeforeTheta (congrArg Fin.val (T.vertex_injective he)) have hthetaTerminalDistinct : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ T.vertex (Fin.last T.length) := by - exact @helper_hthetaTerminalDistinct_1473 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) - (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@hYlen) (@hthetaFirstIndex) + apply T.vertex_injective.ne + intro equal + have values := congrArg Fin.val equal + change (HierarchyFirstMissingPosition sigma T d.theta).val = T.length at values + rw [hthetaFirstIndex] at values + have strict : Y.length < T.length := hYlen.symm ▸ hcutJstrict + exact (Nat.ne_of_lt strict) values have separation3 := P2905_T2_ElementaryTerminalComponent G rho gamma d.theta hgammaNeTheta R1.minimumContext.proper (TreeSequenceVertexSet Z) hElemRho (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) @@ -1929,7 +1549,8 @@ private theorem helper_continuation_2327.{u_1, u_2} : et.series.data.connectingEdges n = {f} ∧ TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y) := by - exact @helper_routeToY_837 V E inferInstance inferInstance inferInstance inferInstance G k e0 + exact @SharedFacts.DisjointThetaRoutes.terminalRouteToPrefix V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn hw hf hm have caseGamma (S : HierarchyReplacementPresentation @@ -2171,7 +1792,8 @@ private theorem helper_continuation_2252.{u_1, u_2} : rw [penultimatePrefixEq] exact ⟨hgammaMissingZ, hbetaMissingZ⟩ have firstChange := by - exact @helper_firstChange_985 (@V) (@E) inferInstance inferInstance inferInstance + exact @SharedFacts.DisjointThetaRoutes.firstReplacementChange (@V) (@E) inferInstance + inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaNeBeta) (@sameStar) (@horderedUnusedGammaBeta) (@hchangeElementary) (@hchangeMissing) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean index e854351e99..d93d159817 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeDisjointThetaUnstoredBetaStoredImpossible.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaRoutes + public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaTransport @@ -1024,94 +1026,6 @@ private abbrev helperContinuation3933Conditions.{u_1, u_2} : Prop := TreeSequence G e0) (hWZ : TreeSequenceInitialSegment W Z), TreeMissingColors new W = TreeMissingColors old W), False -private theorem helper_routeToY_1012.{u_1, u_2} : - helperRouteToY1012Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A ell - X Y Z hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn - hw hf hm - as_aux_lemma => - have hj : 2 ≤ j := hpathLower - clear * - G k e0 input T phi ett base C ctx S nu hn hw hf hm - A X Y Z hAtoT hYtoT hXtoY hYtoZ hXYlen hAtoY hYlen hj j sameStarAll - commonPrefix weakEdges - clear_value A X Y Z - let et := S.corresponding.replacementETT - let K := S.counterexample.hierarchy - let Tn := et.series.data.tree (Fin.last et.rounds).castSucc - have hTnT : TreeSequenceInitialSegment Tn T := et.abovePenultimate - have hTnA : Tn.length ≤ A.length := by - by_cases hz : K.dividerCount = 0 - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz - have hs := sameStarAll S - change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs - rw [hi] at hs - change S.replacementBase.core = A at hs - by_cases hp : et.series.data.kind (Fin.last et.rounds) = - some TashkinovExtensionKind.PE - · rw [← hs]; exact (Classical.choice (S.replacementBase.parallel hp).2.2).leftSegment.1 - · rw [← hs, S.replacementBase.nonparallel hp] - · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = - (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := - Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) - have hs := sameStarAll S - change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs - rw [hi] at hs - have hmono : Monotone (fun i : Fin (K.dividerCount + 2) => (K.stage i).length) := - Fin.monotone_iff_le_succ.mpr (fun i => (K.nested i).1) - rw [← hs] - change Tn.length ≤ (K.stage _).length - rw [show Tn = K.stage 0 from K.baseStage.symm] - exact hmono (Fin.zero_le _) - have hAYstrict : A.length < Y.length := by - clear * - hj hYlen - omega - have fixedA : ∀ t : Fin A.length, nu (A.edge t) = S.coloring (A.edge t) := by - have he := weakEdges S.coloring nu et S.replacementBase K hw - S.minimumContext.oneEdgeUncolored hn - change ∀ t : Fin (HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).length, - nu ((HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) = - S.coloring ((HierarchyStarredStage S.counterexample.hierarchy - (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) at he - rw [sameStarAll S] at he - exact he - have fixedY : ∀ t : Fin Y.length, nu (Y.edge t) = S.coloring (Y.edge t) := by - intro t - let tT : Fin T.length := Fin.castLE hYtoT.1 t - have he : T.edge tT = Y.edge t := hYtoT.2.2 t - by_cases ht : t.val < A.length - · let tA : Fin A.length := ⟨t.val, ht⟩ - have hcast : Fin.castLE hAtoT.1 tA = tT := Fin.ext rfl - rw [← he, ← hcast, hAtoT.2.2 tA] - exact fixedA tA - · rw [← he] - exact hf tT (Nat.le_of_not_gt ht) t.isLt - have transport (W : TreeSequence G e0) - (hr : TashkinovAugmentationSequence S.coloring W Y) : - TashkinovAugmentationSequence nu W Y := - TashkinovAugmentationSequenceColoringTransport S.coloring nu W X Y hr - hXtoY hXYlen (fun t _ => fixedY t) - (fun v hv => hm v (TreeSequenceInitialSegmentVertexSetSubset hYtoZ - (TreeSequenceInitialSegmentVertexSetSubset hXtoY hv))) - rcases P2813_T1_TerminalRoute G k e0 S.corresponding.replacementInput T - S.coloring et with ⟨hp, hr⟩ | ⟨hk, f, seed, he, ha, _, _, hr⟩ - · have hTY : TreeSequenceInitialSegment Tn Y := - commonPrefix hTnT hYtoT (hTnA.trans hAtoY.1) - exact Or.inl ⟨hp, transport Tn - (TashkinovAugmentationSequenceRestrict S.coloring Tn Y T hr hTY hYtoT)⟩ - · have hseedT : TreeSequenceInitialSegment seed T := - TashkinovAugmentationSequenceInitialSegment S.coloring seed T hr - have hseedY : TreeSequenceInitialSegment seed Y := - commonPrefix hseedT hYtoT (by - have hl := ha.1 - change seed.length = Tn.length + 1 at hl - clear * - hl hTnA hAYstrict - omega) - exact Or.inr ⟨hk, f, seed, he, ha, transport seed - (TashkinovAugmentationSequenceRestrict S.coloring seed Y T hr hseedY hYtoT)⟩ - private theorem helper_hgammaNeBeta_569.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -1213,79 +1127,6 @@ private theorem helper_hgammaUnusedBeforeBeta_834.{u_1, u_2} : (Finset.mem_union.mpr (Or.inl hgammaBeta)) exact htailMem -private theorem helper_firstChange_904.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - ∀ (gamma : Fin k), gamma ≠ beta → HierarchyStarredStage C.hierarchy (Fin.last - C.hierarchy.dividerCount) = A → beta ∉ TreeMissingColors sigma A → ( gamma ∉ - TreeMissingColors sigma A ∨ beta ∉ TreeMissingColors sigma A → TreeVertexOrder T (T.vertex - (HierarchyFirstMissingPosition sigma T gamma)) (T.vertex (HierarchyFirstMissingPosition - sigma T beta)) ∧ gamma ∉ ({c : Fin k | - ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition sigma - T beta) : ℕ) ∧ sigma (T.edge t) = some c} : Finset (Fin k))) → ColoredVertexSetElementary - G sigma (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - (1 : ℕ)))) → gamma ∈ TreeMissingColors sigma - (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : - ℕ))) ∧ beta ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample - (HierarchyFullTailLength R.counterexample - (1 : ℕ))) → - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - R.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition sigma T gamma); - have vb : V := T.vertex (HierarchyFirstMissingPosition sigma T beta); - have sameComponent : Prop := TwoColorComponent G sigma gamma beta (Sum.inl va) = - TwoColorComponent G sigma gamma beta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ - TreeMissingColors sigma Tnq ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset - (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - sigma Tn ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → - sameComponent) ∧ ( gamma ∈ TreeMissingColors sigma A ∧ TreeColorSetClosed G sigma A - ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A sigma gamma beta) - := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma - hgammaNeBeta sameStar hbetaNotA horderedUnusedGammaBeta hchangeElementary hchangeMissing - as_aux_lemma => - exact ChangeLemma G k e0 R.corresponding.replacementInput T sigma - R.corresponding.replacementETT R.replacementBase R.counterexample - R.minimumContext.proper R.minimumContext.oneEdgeUncolored - R.minimumContext.lowerRung R.minimumContext.fewerDividers - R.minimumContext.lexicographicMinimality hchangeElementary - R.minimumContext.largeMissingSet gamma beta hgammaNeBeta hchangeMissing - (by - change (gamma ∉ TreeMissingColors sigma A ∨ beta ∉ TreeMissingColors sigma A) → - TreeVertexOrder T - (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) - (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ - gamma ∉ (Finset.univ.filter fun c => - ∃ t : Fin T.length, A.length ≤ t.val ∧ - t.val < (HierarchyFirstMissingPosition sigma T beta).val ∧ - sigma (T.edge t) = some c) - exact horderedUnusedGammaBeta) - private theorem helper_hBlt_1027.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G @@ -1663,192 +1504,6 @@ private theorem helper_hthetaUnused_1483.{u_1, u_2} : exact hc exact hthetaNotRaw (thetaRawIfUsed tY hlo (hYlen ▸ hhi) he) -private theorem helper_changeRho_1547.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; - let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - ∀ (gamma : Fin k), (↑(HierarchyFirstMissingPosition d.switched.coloring T d.theta) : ℕ) = - (HierarchyFullTailPrefix C j).length → gamma ≠ d.theta → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage S.counterexample.hierarchy (Fin.last - S.counterexample.hierarchy.dividerCount) = A) → ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : - ℕ)) = Z) → - ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho - (TreeSequenceVertexSet Z) → HierarchyFirstMissingPosition rho T gamma = - HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta - = HierarchyFirstMissingPosition sigma T d.theta → ( - ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) - → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) < (↑(HierarchyFirstMissingPosition - sigma T d.theta) : ℕ) → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho - Z → - let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := - R1.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - R1.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition rho T gamma); - have vb : V := T.vertex (HierarchyFirstMissingPosition rho T d.theta); - have sameComponent : Prop := TwoColorComponent G rho gamma d.theta (Sum.inl va) = - TwoColorComponent G rho gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ - TreeMissingColors rho Tnq ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : Finset - (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - rho Tn ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : Finset (Fin k)) Dn) → - sameComponent) ∧ ( gamma ∈ TreeMissingColors rho A ∧ TreeColorSetClosed G rho A ({ gamma } - : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A rho gamma d.theta) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A ell Y Z - gamma hthetaFirstIndex hgammaNeTheta sameStarAll samePenultimate R1 rho hElemRho - hfirstGammaRho hfirstThetaRho hgammaUnusedRho hgammaBeforeTheta hpairMissingRho - as_aux_lemma => - exact ChangeLemma G k e0 R1.corresponding.replacementInput T rho - R1.corresponding.replacementETT R1.replacementBase R1.counterexample - R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung - R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality - (by change ColoredVertexSetElementary G rho - (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample - (HierarchyFullTailLength R1.counterexample - 1))) - rw [samePenultimate R1]; exact hElemRho) - R1.minimumContext.largeMissingSet gamma d.theta hgammaNeTheta - (by change gamma ∈ TreeMissingColors rho - (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample - - 1)) ∧ - d.theta ∈ TreeMissingColors rho - (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength - R1.counterexample - 1)) - rw [samePenultimate R1]; exact hpairMissingRho) - (by - dsimp only - rw [sameStarAll R1, hfirstGammaRho, hfirstThetaRho] - intro _ - refine ⟨⟨_, _, rfl, rfl, hgammaBeforeTheta⟩, ?_⟩ - intro hc - obtain ⟨_, t, hlo, hhi, he⟩ := Finset.mem_filter.mp hc - rw [hthetaFirstIndex] at hhi - exact hgammaUnusedRho t hlo hhi he) - -private theorem helper_sameGammaTheta_1572.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G - : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - ∀ (gamma : Fin k), ( - ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), (0 : ℕ) < - S.counterexample.hierarchy.dividerCount ∧ gamma ∈ TreeMissingColors S.coloring - (S.counterexample.hierarchy.stage (⟨S.counterexample.hierarchy.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (S.counterexample.hierarchy.dividerCount + (2 : ℕ)))) ∨ - S.counterexample.hierarchy.dividerCount = (0 : ℕ) ∧ gamma ∈ TreeMissingColors S.coloring - (S.corresponding.replacementETT.series.data.tree (Fin.last - S.corresponding.replacementETT.rounds).castSucc)) → - ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let rho : PartialEdgeColoring E k := R1.coloring; HierarchyFirstMissingPosition rho T gamma = - HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta - = HierarchyFirstMissingPosition sigma T d.theta → ( - let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := - R1.counterexample.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last - R1.corresponding.replacementETT.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega - ⟩ : Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data - n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition rho T gamma); - have vb : V := T.vertex (HierarchyFirstMissingPosition rho T d.theta); - have sameComponent : Prop := TwoColorComponent G rho gamma d.theta (Sum.inl va) = - TwoColorComponent G rho gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ - TreeMissingColors rho Tnq ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : Finset - (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors - rho Tn ∨ Disjoint (insert gamma ({ d.theta } : Finset (Fin k)) : Finset (Fin k)) Dn) → - sameComponent) ∧ ( gamma ∈ TreeMissingColors rho A ∧ TreeColorSetClosed G rho A ({ gamma } - : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A rho gamma d.theta)) → - TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition - sigma T gamma))) = TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex - (HierarchyFirstMissingPosition sigma T d.theta))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma gamma caseGamma R1 - rho hfirstGammaRho hfirstThetaRho changeRho - have he : TwoColorComponent G rho gamma d.theta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T gamma))) = - TwoColorComponent G rho gamma d.theta - (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T d.theta))) := by - rcases caseGamma R1 with ⟨hp, hm⟩ | ⟨hz, hm⟩ - · exact changeRho.1 ⟨hp, Or.inl hm⟩ - · exact changeRho.2.1 ⟨hz, Or.inl hm⟩ - rw [hfirstGammaRho, hfirstThetaRho] at he - exact he - -private theorem helper_hthetaTerminalDistinct_1589.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) - (j : ℕ), - let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; - let sigma : PartialEdgeColoring E k := R.coloring; - let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := - R.counterexample.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; A.length + j < T.length → Y.length = - A.length + j → (↑(HierarchyFirstMissingPosition d.switched.coloring T d.theta) : ℕ) = - (HierarchyFullTailPrefix C j).length → T.vertex (HierarchyFirstMissingPosition sigma T - d.theta) ≠ T.vertex (Fin.last T.length) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A Y - hcutJstrict hYlen hthetaFirstIndex he - have hv := congrArg Fin.val (T.vertex_injective he) - simp only [Fin.val_last] at hv - rw [hthetaFirstIndex] at hv - have hlt : Y.length < T.length := hYlen.symm ▸ hcutJstrict - exact Nat.ne_of_lt hlt hv - private theorem helper_hstored3_1693.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : @@ -2187,7 +1842,8 @@ private theorem helper_continuation_3727.{u_1, u_2} : rw [he] exact ⟨hgammaMissingZ, hthetaMissingZ⟩ have changeRho := by - exact helper_changeRho_1547 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) + exact SharedFacts.DisjointThetaRoutes.changeReplacementColoring (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@gamma) (@hthetaFirstIndex) (@hgammaNeTheta) (@sameStarAll) (@samePenultimate) (@R1) (@hElemRho) (@hfirstGammaRho) (@hfirstThetaRho) (@hgammaUnusedRho) (@hgammaBeforeTheta) (@hpairMissingRho) @@ -2195,18 +1851,28 @@ private theorem helper_continuation_3727.{u_1, u_2} : (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T gamma))) = TwoColorComponent G rho gamma d.theta (Sum.inl (T.vertex (HierarchyFirstMissingPosition sigma T d.theta))) := by - exact helper_sameGammaTheta_1572 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) - (@ctx) (@P) (@alpha) (@beta) (@d) (@gamma) (@caseGamma) (@R1) (@hfirstGammaRho) - (@hfirstThetaRho) - (@changeRho) + have equal : TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T gamma))) = + TwoColorComponent G rho gamma d.theta + (Sum.inl (T.vertex (HierarchyFirstMissingPosition rho T d.theta))) := + (caseGamma R1).elim + (fun missing => changeRho.1 ⟨missing.1, Or.inl missing.2⟩) + (fun missing => changeRho.2.1 ⟨missing.1, Or.inl missing.2⟩) + rw [hfirstGammaRho, hfirstThetaRho] at equal + exact equal have hgammaThetaDistinct : T.vertex (HierarchyFirstMissingPosition sigma T gamma) ≠ T.vertex (HierarchyFirstMissingPosition sigma T d.theta) := by intro he exact ne_of_lt hgammaBeforeTheta (congrArg Fin.val (T.vertex_injective he)) have hthetaTerminalDistinct : T.vertex (HierarchyFirstMissingPosition sigma T d.theta) ≠ T.vertex (Fin.last T.length) := by - exact helper_hthetaTerminalDistinct_1589 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) - (@C) (@ctx) (@P) (@alpha) (@beta) (@d) (@j) (@hcutJstrict) (@hYlen) (@hthetaFirstIndex) + apply T.vertex_injective.ne + intro equal + have values := congrArg Fin.val equal + change (HierarchyFirstMissingPosition sigma T d.theta).val = T.length at values + rw [hthetaFirstIndex] at values + have strict : Y.length < T.length := hYlen.symm ▸ hcutJstrict + exact (Nat.ne_of_lt strict) values exact @helper_continuation_3731 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@P) (@alpha) (@beta) (@hvertexMissing) (@d) (@j) (@hj) (@hpathLower) (@hpathUpper) (@hbetaStored) @@ -2430,7 +2096,8 @@ private theorem helper_continuation_3933.{u_1, u_2} : et.series.data.connectingEdges n = {f} ∧ TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y) := by - exact @helper_routeToY_1012 V E inferInstance inferInstance inferInstance inferInstance G k + exact @SharedFacts.DisjointThetaRoutes.terminalRouteToPrefix V E inferInstance inferInstance + inferInstance inferInstance G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn hw hf hm exact @helper_continuation_3042 (@V) (@E) inferInstance inferInstance inferInstance @@ -2689,8 +2356,9 @@ private theorem helper_continuation_2578.{u_1, u_2} : rw [penultimatePrefixEq] exact ⟨hgammaMissingZ, hbetaMissingZ⟩ have firstChange := by - exact helper_firstChange_904 (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) - (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaNeBeta) (@sameStar) (@hbetaNotA) + exact SharedFacts.DisjointThetaRoutes.firstReplacementChange (@G) (@k) (@e0) (@input) (@T) + (@phi) (@ett) (@base) (@C) (@ctx) + (@P) (@alpha) (@beta) (@d) (@gamma) (@hgammaNeBeta) (@sameStar) (@horderedUnusedGammaBeta) (@hchangeElementary) (@hchangeMissing) have hgammaStageMissing : gamma ∈ HierarchyStageMissingColors H q := (Finset.mem_sdiff.mp diff --git a/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean b/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean index 35ed67b949..6fab45e74c 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationThreeEligibleIndexBound.lean @@ -5,7 +5,6 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningTransport public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement @@ -252,7 +251,7 @@ private theorem helper_continuation_5697.{u_1, u_2} : have terminalStored : TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = TashkinovStoredColors EB.series.data (Fin.last EB.rounds) := by - exact helper_terminalStored_647 G k e0 input T phi ett base C ctx P alpha hp hlenT hTnX S + exact helper_terminalStored_647 G k e0 input T phi ett base C ctx P alpha hlenT hTnX S hSBlen missingTree positiveB aboveB strictB belowB generatingB baseB HB corr hmaximum bs hcore hpe hclosure baseStageK terminalStageK nestedK strictK coreInsideK positiveK increasingK dividerStageK hstage hposition starredEq terminalTree diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean index e7fb628a16..9cd1c448ce 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseOneOneNonexceptional.lean @@ -3234,88 +3234,6 @@ private theorem helper_missingSubset_3241.{u_1, u_2} : exact Finset.mem_biUnion.mpr ⟨v, TreeSequenceInitialSegmentVertexSetSubset hXY hv, hcv⟩ -private theorem helper_gammaNotTerminal_3372.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseOneData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ)); - let P : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - ∀ (_ : (2 : ℕ) ≤ T.length - A.length) (_ : B.length + (2 : ℕ) = T.length) - (_ : P.length + (1 : ℕ) = T.length) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (_ : MaximumProperty corrMinus.replacementETT) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar) - (_ : R.minus.length = B.length + (1 : ℕ)) - (_ : HMinus.dividerCount = H.dividerCount) (_ : GoodHierarchy HMinus) - (_ : D.gammaOne ≠ D.alpha), - let ig : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T D.gammaOne; - let vg : V := T.vertex ig; - ∀ (_ : D.gammaOne ∈ MissingColors G phi vg) - (_ : vg ≠ T.vertex D.terminalVertexIndex) - (_ : - let H : TashkinovHierarchy ett base := C.hierarchy; - have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - have n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - have A : TreeSequence G e0 := HierarchyStarredStage H q; - have Tnq : TreeSequence G e0 := - H.stage - (⟨H.dividerCount, by - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))); - have Tn : TreeSequence G e0 := ett.series.data.tree n.castSucc; - have Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; - have va : V := T.vertex (HierarchyFirstMissingPosition phi T D.gammaOne); - have vb : V := T.vertex (HierarchyFirstMissingPosition phi T D.alpha); - have sameComponent : Prop := - TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl va) = - TwoColorComponent G phi D.gammaOne D.alpha (Sum.inl vb); - ((0 : ℕ) < H.dividerCount ∧ - (D.gammaOne ∈ TreeMissingColors phi Tnq ∨ - Disjoint (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - Dnq) → - sameComponent) ∧ - (H.dividerCount = (0 : ℕ) ∧ - (D.gammaOne ∈ TreeMissingColors phi Tn ∨ - Disjoint - (insert D.gammaOne ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - Dn) → - sameComponent) ∧ - (D.gammaOne ∈ TreeMissingColors phi A ∧ - TreeColorSetClosed G phi A ({ D.gammaOne } : Finset (Fin k)) → - sameComponent ∧ TreeInterchangeable G A phi D.gammaOne D.alpha)) - (_ : HierarchyStarredStage HMinus (Fin.last HMinus.dividerCount) = A) - (_ : - ∀ {U : TreeSequence G e0} {inp : PartialEdgeColoring E k} - {et : ExtendedTashkinovTree G k e0 inp U phi} {b : HierarchyBase et phi} - (K : TashkinovHierarchy et b), - HierarchyPathNumber K ≤ - U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length) - (_ : vg ∈ TreeSequenceVertexSet R.minus) - (_ : T.vertex D.terminalVertexIndex ∈ TreeSequenceVertexSet R.minus), - D.gammaOne ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B P htail hBL hPL R corrMinus - mpMinus baseMinus HMinus corrStar baseStar HStar minusLength countMinus goodMinus gammaNe - ig vg gammaAt vgTerminal changeOld lastMinus pathBound vgMinus terminalMinus - apply helper_gammaNotTerminal_634 <;> assumption private theorem helper_continuation_3550.{u_1, u_2} : helperContinuation3550Conditions.{u_1, u_2} := by classical @@ -3534,7 +3452,7 @@ private theorem helper_continuation_3038.{u_1, u_2} : rw [← R.minusTerminalVertex] exact vertexMem R.minus _ have gammaNotTerminal : D.gammaOne ∉ MissingColors G phi (T.vertex D.terminalVertexIndex) := by - apply helper_gammaNotTerminal_3372 <;> assumption + apply helper_gammaNotTerminal_634 <;> assumption let CS : HierarchyCounterexample baseStar := { positive := by rw [corrStar.rungAgreement]; exact C.positive hierarchy := HStar diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean index e203649458..a40dac13ee 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeOne/Preparation1.lean @@ -7,7 +7,6 @@ module public import LeanPool.GoldbergSeymour.SharedFacts.SubcaseThreeOnePreparation1 -public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseOneData public import LeanPool.GoldbergSeymour.HierarchySituationTwoCaseThreeOneData public import LeanPool.GoldbergSeymour.HierarchySituationTwoReorderedTrees diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean index f3ea61005f..201752c7f7 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseThreeTwo.lean @@ -2887,227 +2887,6 @@ private theorem helper_continuation_3433.{u_1, u_2} : (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hnotA) (@seriesFacts) (@finish) (@gammaReduction) (@hthetaStored) -private theorem helper_branch_3639.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - (2 : ℕ) ≤ T.length - A.length → - B.length + (1 : ℕ) = T.length → - TreeSequenceInitialSegment B T → - (H.dividerCount = (0 : ℕ) → A = base.core) → - TreeSequenceInitialSegment A T → - TreeSequenceInitialSegment A B → - B.vertex (Fin.last B.length) = T.vertex D.penultimateVertexIndex → - T.vertex D.penultimateVertexIndex ∈ TreeSequenceVertexSet B → - ColoredVertexSetElementary G phi (TreeSequenceVertexSet B) → - (∀ {c : Fin k}, - c ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) → - c ∉ TreeMissingColors phi A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix P.counterexample - (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = - B) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - P.corresponding.replacementETT.series.data.tree - (Fin.last P.corresponding.replacementETT.rounds).castSucc = - ett.series.data.tree (Fin.last ett.rounds).castSucc) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt H q = - HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt H q, - C.good.gamma q eta = - P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) - eta) → - (∀ {X Y F : TreeSequence G e0}, - TreeSequenceInitialSegment X F → - TreeSequenceInitialSegment Y F → - X.length ≤ Y.length → TreeSequenceInitialSegment X Y) → - base.core.length ≤ A.length → - (∀ (X : TreeSequence G e0), - TreeSequenceInitialSegment X T → - ∀ (t : Fin T.length), (↑t : ℕ) = X.length → TreeIncidentEdge X (T.edge t)) → - (∀ {input' : PartialEdgeColoring E k} (rho sigma : PartialEdgeColoring E k) - (ett' : ExtendedTashkinovTree G k e0 input' T rho) (base' : HierarchyBase ett' rho) - (K : TashkinovHierarchy ett' base'), - HierarchyWeaklyStable K (Fin.last K.dividerCount) sigma → - K.dividerCount = (0 : ℕ) → - StableColoring (ett'.series.data.tree (Fin.last ett'.rounds).castSucc) - (TashkinovStoredColors ett'.series.data (Fin.last ett'.rounds)) rho sigma) → - (∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) - (ett' : ExtendedTashkinovTree G k e0 input' T old) (base' : HierarchyBase ett' old) - (K : TashkinovHierarchy ett' base'), - HierarchyWeaklyStable K (Fin.last K.dividerCount) new → - IsOneEdgeUncolored old e0 → - IsOneEdgeUncolored new e0 → - ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), - new ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = - old ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t)) → - ∀ (beta : Fin k) - (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - (∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → POne.coloring (T.edge t) = phi (T.edge t)) → - let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - T.vertex ib ∈ TreeSequenceVertexSet B → - let rho : PartialEdgeColoring E k := POne.coloring; - let ettOne : - ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := - POne.corresponding.replacementETT; - let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; - let HOne : TashkinovHierarchy POne.corresponding.replacementETT POne.replacementBase := - COne'.hierarchy; - let qOne : Fin (HOne.dividerCount + (1 : ℕ)) := Fin.last HOne.dividerCount; - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - D.theta ∈ MissingColors G rho (T.vertex D.penultimateVertexIndex) → - beta ∈ MissingColors G rho (T.vertex ib) → - HierarchyFirstMissingPosition rho T beta = ib → - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → - (beta ∈ TreeMissingColors phi A → - (0 : ℕ) < HOne.dividerCount ∧ - beta ∈ - TreeMissingColors rho - (HOne.stage - (⟨HOne.dividerCount, - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (HOne.dividerCount + (2 : ℕ)))) ∨ - HOne.dividerCount = (0 : ℕ) ∧ - (beta ∈ - TreeMissingColors rho - (ettOne.series.data.tree (Fin.last ettOne.rounds).castSucc) ∨ - beta ∈ TreeMissingColors rho A ∧ - beta ∉ TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds) ∧ - D.theta ∉ - TashkinovStoredColors ettOne.series.data (Fin.last ettOne.rounds))) → - beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → - Disjoint - (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.terminalVertexIndex))) - (TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib))) → - let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; - TwoColorPathComponent G rho beta D.theta z → - (∀ w ∈ TreeSequenceVertexSet B, - MissingColors G (TwoColorComponentSwap G rho beta D.theta z) w = - MissingColors G rho w) → - (∀ c ∈ HierarchyStoredColorsAt HOne qOne, - HierarchyFirstMissingPosition muTwo T c = HierarchyFirstMissingPosition rho T c) → - TashkinovAugmentationSequence rho B T → - (∀ c ∈ HierarchyStoredColorsAt HOne qOne, - beta ∈ POne.counterexample.good.gamma qOne c ∨ - D.theta ∈ POne.counterexample.good.gamma qOne c → - (↑(HierarchyFirstMissingPosition rho T c) : ℕ) ≤ B.length) → - beta ∈ TreeMissingColors phi A → - ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), - MaximumProperty corrTwo.replacementETT ∧ - ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : - TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), - SameGoodHierarchy COne'.good goodTwo := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B htail hBlen hBT hAzero hAT hAB - hBterminal hyB hElementary hnotA sameStar samePrefix sameTn sameLast commonPrefix - hcoreLength predecessorIncident seedStable weakEdges beta POne hfixed z hbetaTheta ib hibB - rho ettOne COne' HOne qOne hElementaryOne hthetaPenOne hgammaWitnessOne' hfirstGammaOne - hgammaUnusedOne hcaseOne hmissingPairOne hdisjointTwo muTwo hpathTwo hmissingTwo hstoredTwo - hsuffix hgammaCutoff hm - exact @helper_branch_2793 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@htail) (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) - (@hnotA) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) - (@hcoreLength) (@predecessorIncident) (@seedStable) (@weakEdges) (@beta) (@POne) - (@hfixed) (@hbetaTheta) (@hibB) (@hElementaryOne) (@hthetaPenOne) - (@hgammaWitnessOne') (@hfirstGammaOne) (@hgammaUnusedOne) (@hcaseOne) - (@hmissingPairOne) (@hdisjointTwo) (@hpathTwo) (@hmissingTwo) (@hstoredTwo) - (@hsuffix) (@hgammaCutoff) (@hm) - -private theorem helper_branch_3648.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseThreeTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let B : TreeSequence G e0 := - HierarchyFullTailPrefix C (HierarchyFullTailLength C - (1 : ℕ)); - TreeSequenceInitialSegment A T → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) = - A) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyFullTailPrefix P.counterexample - (HierarchyFullTailLength P.counterexample - (1 : ℕ)) = - B) → - (∀ (P : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - HierarchyStoredColorsAt H q = - HierarchyStoredColorsAt P.counterexample.hierarchy - (Fin.last P.counterexample.hierarchy.dividerCount) ∧ - ∀ eta ∈ HierarchyStoredColorsAt H q, - C.good.gamma q eta = - P.counterexample.good.gamma (Fin.last P.counterexample.hierarchy.dividerCount) - eta) → - ∀ beta ∉ HierarchyStoredColorsAt H q, - (beta ∉ TreeMissingColors phi A → D.theta ∉ HierarchyStoredColorsAt H q) → - ∀ (POne : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), - let z : V ⊕ E := Sum.inl (T.vertex D.terminalVertexIndex); - beta ≠ D.theta → - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - TreeVertexOrder T (T.vertex ib) (T.vertex D.penultimateVertexIndex) → - (∀ (rho : PartialEdgeColoring E k), - ∀ c ∈ MissingColors G rho (T.vertex (HierarchyFirstMissingPosition rho T c)), - c ∉ TreeMissingColors rho A → - A.length < (↑(HierarchyFirstMissingPosition rho T c) : ℕ)) → - let rho : PartialEdgeColoring E k := POne.coloring; - let ettOne : - ExtendedTashkinovTree G k e0 POne.corresponding.replacementInput T POne.coloring := - POne.corresponding.replacementETT; - let COne' : HierarchyCounterexample POne.replacementBase := POne.counterexample; - ColoredVertexSetElementary G rho (TreeSequenceVertexSet B) → - TreeMissingColors rho A = TreeMissingColors phi A → - beta ∈ MissingColors G rho (T.vertex ib) → - HierarchyFirstMissingPosition rho T beta = ib → - HierarchyFirstMissingPosition rho T D.theta = D.penultimateVertexIndex → - (∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → rho (T.edge t) ≠ some beta) → - beta ∈ TreeMissingColors rho B ∧ D.theta ∈ TreeMissingColors rho B → - let muTwo : PartialEdgeColoring E k := TwoColorComponentSwap G rho beta D.theta z; - beta ∉ TreeMissingColors phi A → - ∃ (corrTwo : CorrespondingExtendedTashkinovTree G k e0 ettOne muTwo T), - MaximumProperty corrTwo.replacementETT ∧ - ∃ (baseTwo : HierarchyBase corrTwo.replacementETT muTwo) (KTwo : - TashkinovHierarchy corrTwo.replacementETT baseTwo) (goodTwo : GoodHierarchy KTwo), - SameGoodHierarchy COne'.good goodTwo := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hAT sameStar samePrefix sameLast - beta hbetaStored houtside POne z hbetaTheta ib horder firstAfter rho ettOne COne' - hElementaryOne hmissingA hgammaWitnessOne' hfirstGammaOne hfirstThetaOne hgammaUnusedOne - hmissingPairOne muTwo hm - exact @helper_branch_1087 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hAT) (@sameStar) (@samePrefix) (@sameLast) (@beta) (@hbetaStored) (@houtside) - (@POne) (@hbetaTheta) (@horder) (@firstAfter) (@hElementaryOne) (@hmissingA) - (@hgammaWitnessOne') (@hfirstGammaOne) (@hfirstThetaOne) (@hgammaUnusedOne) - (@hmissingPairOne) (@hm) - private theorem helper_continuation_3998.{u_1, u_2} : helperContinuation3998Conditions.{u_1, u_2} := by classical @@ -3144,7 +2923,7 @@ private theorem helper_continuation_3998.{u_1, u_2} : ∃ KTwo : TashkinovHierarchy corrTwo.replacementETT baseTwo, ∃ goodTwo : GoodHierarchy KTwo, SameGoodHierarchy COne'.good goodTwo := by by_cases hm : beta ∈ TreeMissingColors phi A - · exact @helper_branch_3639 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + · exact @helper_branch_2793 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@htail) (@hBlen) (@hBT) (@hAzero) (@hAT) (@hAB) (@hBterminal) (@hyB) (@hElementary) (@hnotA) (@sameStar) (@samePrefix) (@sameTn) (@sameLast) (@commonPrefix) (@hcoreLength) (@predecessorIncident) @@ -3152,7 +2931,7 @@ private theorem helper_continuation_3998.{u_1, u_2} : (@hElementaryOne) (@hthetaPenOne) (@hgammaWitnessOne') (@hfirstGammaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hdisjointTwo) (@hpathTwo) (@hmissingTwo) (@hstoredTwo) (@hsuffix) (@hgammaCutoff) (@hm) - · exact @helper_branch_3648 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + · exact @helper_branch_1087 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hAT) (@sameStar) (@samePrefix) (@sameLast) (@beta) (@hbetaStored) (@houtside) (@POne) (@hbetaTheta) (@horder) (@firstAfter) (@hElementaryOne) (@hmissingA) (@hgammaWitnessOne') diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean index 87f617cc71..2d340b376f 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoOneNonexceptional.lean @@ -1000,6 +1000,179 @@ private abbrev transferredGoodHierarchyConstructorType.{u_1, u_2} (V : Type u_1) GoodHierarchy K +private abbrev helperBranch685Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) + (baseU : HierarchyBase corr.replacementETT phi) + (K : TashkinovHierarchy corr.replacementETT baseU) (hcount : K.dividerCount = H.dividerCount), + let index : + Fin (K.dividerCount + (1 : ℕ)) → + Fin (H.dividerCount + (1 : ℕ)) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ + Fin.cast + (by + have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive U + omega) + j; + let gammaU : + Fin (K.dividerCount + (1 : ℕ)) → + Fin k → + Finset (Fin k) := + fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ C.good.gamma (index j) eta; + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + K.stage j.castSucc = H.stage (index j).castSucc) → + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStarredStage K j = HierarchyStarredStage H (index j)) → + ( + ∀ (j : Fin (K.dividerCount + (1 : ℕ))), + HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H (index j)) → + ∀ (i : Fin K.dividerCount), + let io : Fin H.dividerCount := Fin.cast hcount i; + io.succ = index i.succ → + io.castSucc = index i.castSucc → + ∀ (eta : Fin k), + (∀ (y : Fin k), + (fun (eta : Fin k) ↦ + eta ∈ HierarchyStoredColorsAt C.hierarchy io.succ ∧ + (C.good.gamma io.succ eta ⊆ + (TreeSequenceVertexSet (C.hierarchy.stage io.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage C.hierarchy io.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt C.hierarchy io.succ, + theta ≠ eta → + C.good.gamma io.succ theta = C.good.gamma io.castSucc theta) + y → + y = eta) → + ∀ (y : Fin k), + (fun (eta : Fin k) ↦ + eta ∈ HierarchyStoredColorsAt K i.succ ∧ + (gammaU i.succ eta ⊆ + (TreeSequenceVertexSet (K.stage i.succ.castSucc) \ + TreeSequenceVertexSet (HierarchyStarredStage K i.castSucc)).biUnion + fun (v : V) ↦ MissingColors G phi v) ∧ + ∀ theta ∈ HierarchyStoredColorsAt K i.succ, + theta ≠ eta → + gammaU i.succ theta = gammaU i.castSucc theta) + y → + y = eta + +private abbrev helperContinuation4495Conditions.{u_1, u_2} : Prop := + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] + [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) + (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) + (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) + (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) + (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) + (hnonexceptional : + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + ¬∃ eta ∈ HierarchyStoredColorsAt H q, + eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) ∧ D.theta ∈ C.good.gamma q eta), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); + let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; + let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; + ∀ (htail : (2 : ℕ) ≤ ell) (hell : ell = T.length - A.length) (hsum : A.length + ell = T.length) + (hBlen : B.length = T.length - (2 : ℕ)) (hBT : TreeSequenceInitialSegment B T) + (hprefixElementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus)) + (halpha : + D.alpha ∉ TreeMissingColors phi B ∧ + D.alpha ∉ Dn ∧ + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some D.alpha) + (R : + HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx + D.toHierarchySituationTwoTailData) + (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) + (hminusMP : MaximumProperty corrMinus.replacementETT) + (baseMinus : HierarchyBase corrMinus.replacementETT phi) + (hminusCore : baseMinus.core = base.core) (hminusClosure : baseMinus.closure = base.closure) + (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) + (hminusCount : HMinus.dividerCount = C.hierarchy.dividerCount) + (hminusStages : + ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), + HMinus.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) + (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) + (hstarMP : MaximumProperty corrStar.replacementETT) + (baseStar : HierarchyBase corrStar.replacementETT phi) (hstarCore : baseStar.core = base.core) + (hstarClosure : baseStar.closure = base.closure) + (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) + (hstarCount : HStar.dividerCount = C.hierarchy.dividerCount) + (hstarStages : + ∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), + HStar.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) + (hBminus : + TreeSequenceInitialSegment (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) + R.minus) + (hstarLen : R.star.length = R.minus.length + (1 : ℕ)) + (hminusStar : TreeSequenceInitialSegment R.minus R.star) + (hstarEdge : + R.star.edge (Fin.cast (by omega) (Fin.last R.minus.length)) = T.edge R.penultimateEdgeIndex) + (hminusLen : R.minus.length = B.length + (1 : ℕ)) + (hminusEdge : + R.minus.edge + (Fin.cast (by change B.length + 1 = R.minus.length; exact hminusLen.symm) + (Fin.last (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))).length)) = + T.edge D.lastEdgeIndex) + (hstarLength : R.star.length = T.length) (beta : Fin k) + (hbetaMissing : beta ∈ TreeMissingColors phi B) + (hbetaUnused : + ∀ (t : Fin T.length), + A.length ≤ (↑t : ℕ) → + phi (T.edge t) ≠ some beta) + (hcolorsDistinct : beta ≠ D.alpha) + (firstMissingLe : + ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) + (hc : c ∈ MissingColors G phi (S.vertex i)), + HierarchyFirstMissingPosition phi S c ≤ i) + (firstMissingMem : + ∀ (S : TreeSequence G e0) (c : Fin k) (hc : c ∈ TreeMissingColors phi S), + c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) + (vertexMem : + ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), + S.vertex i ∈ TreeSequenceVertexSet S) + (missingMono : + ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U), + TreeMissingColors phi S ⊆ TreeMissingColors phi U) + (hbetaT : beta ∈ TreeMissingColors phi T) + (hbetaFirstBound : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) + (halphaFirst : HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex) + (hbetaPrefix : beta ∈ TreeMissingColors phi Bplus) + (halphaPrefix : D.alpha ∈ TreeMissingColors phi Bplus) + (horderedUnused : + beta ∉ TreeMissingColors phi A ∨ D.alpha ∉ TreeMissingColors phi A → + TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T beta)) + (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ + beta ∉ + ({c : Fin k | + ∃ (t : Fin T.length), + A.length ≤ (↑t : ℕ) ∧ + (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T D.alpha) : ℕ) ∧ + phi (T.edge t) = some c} : + Finset (Fin k))) + (hDnDisjoint : Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) + (hDnqDisjoint : + Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) + (HierarchyStoredColorsAt H q)), + False + private theorem helper_hfinalCard_138.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] @@ -2355,72 +2528,6 @@ private theorem helper_branch_677.{u_1, u_2} : rw [storedEq, ← hn] at htheta simpa [gammaU, ← hn, ← hp] using heta.2.2 theta htheta hne -private abbrev helperBranch685Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - ∀ (U : TreeSequence G e0) (corr : CorrespondingExtendedTashkinovTree G k e0 ett phi U) - (baseU : HierarchyBase corr.replacementETT phi) - (K : TashkinovHierarchy corr.replacementETT baseU) (hcount : K.dividerCount = H.dividerCount), - let index : - Fin (K.dividerCount + (1 : ℕ)) → - Fin (H.dividerCount + (1 : ℕ)) := - fun (j : Fin (K.dividerCount + (1 : ℕ))) ↦ - Fin.cast - (by - have := GoldbergSeymour.CorrespondingExtendedTashkinovTree.rungAgreement corr - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive U - omega) - j; - let gammaU : - Fin (K.dividerCount + (1 : ℕ)) → - Fin k → - Finset (Fin k) := - fun (j : Fin (K.dividerCount + (1 : ℕ))) (eta : Fin k) ↦ C.good.gamma (index j) eta; - ( - ∀ (j : Fin (K.dividerCount + (1 : ℕ))), - K.stage j.castSucc = H.stage (index j).castSucc) → - ( - ∀ (j : Fin (K.dividerCount + (1 : ℕ))), - HierarchyStarredStage K j = HierarchyStarredStage H (index j)) → - ( - ∀ (j : Fin (K.dividerCount + (1 : ℕ))), - HierarchyStoredColorsAt K j = HierarchyStoredColorsAt H (index j)) → - ∀ (i : Fin K.dividerCount), - let io : Fin H.dividerCount := Fin.cast hcount i; - io.succ = index i.succ → - io.castSucc = index i.castSucc → - ∀ (eta : Fin k), - (∀ (y : Fin k), - (fun (eta : Fin k) ↦ - eta ∈ HierarchyStoredColorsAt C.hierarchy io.succ ∧ - (C.good.gamma io.succ eta ⊆ - (TreeSequenceVertexSet (C.hierarchy.stage io.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage C.hierarchy io.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v) ∧ - ∀ theta ∈ HierarchyStoredColorsAt C.hierarchy io.succ, - theta ≠ eta → - C.good.gamma io.succ theta = C.good.gamma io.castSucc theta) - y → - y = eta) → - ∀ (y : Fin k), - (fun (eta : Fin k) ↦ - eta ∈ HierarchyStoredColorsAt K i.succ ∧ - (gammaU i.succ eta ⊆ - (TreeSequenceVertexSet (K.stage i.succ.castSucc) \ - TreeSequenceVertexSet (HierarchyStarredStage K i.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v) ∧ - ∀ theta ∈ HierarchyStoredColorsAt K i.succ, - theta ≠ eta → - gammaU i.succ theta = gammaU i.castSucc theta) - y → - y = eta - private theorem helper_branch_685.{u_1, u_2} : helperBranch685Conditions.{u_1, u_2} := by classical @@ -3649,272 +3756,6 @@ private theorem helper_hpt_3177.{u_1, u_2} : have ht := D.terminalVertexPosition omega -private theorem helper_firstLowerInOld_3203.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), - let ell : ℕ := HierarchyFullTailLength C; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar) - (_ : R.star.length = R.minus.length + (1 : ℕ)) - (_ : R.minus.length = B.length + (1 : ℕ)) - (_ : R.star.length = T.length) (_ : Fin k) - (_ : - ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) - (_ : c ∈ MissingColors G phi (S.vertex i)), - HierarchyFirstMissingPosition phi S c ≤ i) - (_ : - ∀ (S : TreeSequence G e0) (c : Fin k) - (_ : (↑(HierarchyFirstMissingPosition phi S c) : ℕ) < S.length), - c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) - (U : TreeSequence G e0) (_ : TreeSequenceInitialSegment B U) (eta : Fin k) (r : ℕ) - (_ : r ≤ B.length) (_ : r < (↑(HierarchyFirstMissingPosition phi U eta) : ℕ)), - r < (↑(HierarchyFirstMissingPosition phi T eta) : ℕ) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D ell B hBlen hBT R corrMinus baseMinus - HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta firstMissingLe - firstMissingMemBelow U hBU eta r hrB hrU - apply helper_firstLowerInOld_356 <;> assumption -private theorem helper_horderedUnused_3229.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - ∀ (_ : B.length = T.length - (2 : ℕ)) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar) - (_ : R.star.length = R.minus.length + (1 : ℕ)) - (_ : R.minus.length = B.length + (1 : ℕ)) - (_ : R.star.length = T.length) (beta : Fin k) - (_ : - ∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → - phi (T.edge t) ≠ some beta) - (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) - (_ : - HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex), - beta ∉ TreeMissingColors phi A ∨ D.alpha ∉ TreeMissingColors phi A → - TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T beta)) - (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ - beta ∉ - ({c : Fin k | - ∃ (t : Fin T.length), - A.length ≤ (↑t : ℕ) ∧ - (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T D.alpha) : ℕ) ∧ - phi (T.edge t) = some c} : - Finset (Fin k)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B hBlen R corrMinus baseMinus - HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta hbetaUnused - hbetaFirstBound halphaFirst - apply helper_horderedUnused_290 <;> assumption -private theorem helper_halphaFirst_3258.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - ∀ (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) - (_ : - D.alpha ∉ TreeMissingColors phi B ∧ - D.alpha ∉ Dn ∧ - ∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → - phi (T.edge t) ≠ some D.alpha) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar) - (_ : R.star.length = R.minus.length + (1 : ℕ)) - (_ : R.minus.length = B.length + (1 : ℕ)) - (_ : R.star.length = T.length) (_ : Fin k) - (_ : - ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) - (_ : c ∈ MissingColors G phi (S.vertex i)), - HierarchyFirstMissingPosition phi S c ≤ i) - (_ : - ∀ (S : TreeSequence G e0) (c : Fin k) (_ : c ∈ TreeMissingColors phi S), - c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) - (_ : - ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), - S.vertex i ∈ TreeSequenceVertexSet S) - (_ : D.alpha ∈ TreeMissingColors phi T), - HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B n Dn hBlen hBT halpha R - corrMinus baseMinus HMinus corrStar baseStar HStar hstarLen hminusLen hstarLength beta - firstMissingLe firstMissingMem vertexMem halphaT - apply helper_halphaFirst_256 <;> assumption -private theorem helper_hstarPath_3572.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - ∀ (_ : ell = T.length - A.length) (_ : A.length + ell = T.length) - (_ : B.length = T.length - (2 : ℕ)) (_ : TreeSequenceInitialSegment B T) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (_ : HMinus.dividerCount = C.hierarchy.dividerCount) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (_ : MaximumProperty corrStar.replacementETT) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) - (_ : HStar.dividerCount = C.hierarchy.dividerCount) - (_ : R.star.length = R.minus.length + (1 : ℕ)) - (_ : R.minus.length = B.length + (1 : ℕ)) - (_ : R.star.length = T.length) (beta : Fin k) - (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) - (_ : GoodHierarchy HStar) - (_ : HierarchyStarredStage HStar (Fin.last HStar.dividerCount) = A) - (_ : - ∀ {inputU : PartialEdgeColoring E k} {U : TreeSequence G e0} - {ettU : ExtendedTashkinovTree G k e0 inputU U phi} - {baseU : HierarchyBase ettU phi} (K : TashkinovHierarchy ettU baseU), - HierarchyPathNumber K ≤ - U.length - (HierarchyStarredStage K (Fin.last K.dividerCount)).length), - HierarchyPathNumber HStar = HierarchyPathNumber H := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B hell hsum hBlen hBT R - corrMinus baseMinus HMinus hminusCount corrStar hstarMP baseStar HStar hstarCount hstarLen - hminusLen hstarLength beta hbetaFirstBound goodStar hstarStarred pathLeFull - apply helper_hstarPath_824 <;> assumption -private theorem helper_hDnDisjoint_3416.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - ∀ - (_ : - D.alpha ∉ TreeMissingColors phi B ∧ - D.alpha ∉ Dn ∧ - ∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → - phi (T.edge t) ≠ some D.alpha) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData), - let baseExtraMissing : Finset (Fin k) := - (TreeSequenceVertexSet base.core \ - TreeSequenceVertexSet (ett.series.data.tree n.castSucc)).biUnion - fun (v : V) ↦ MissingColors G phi v; - let prefixUsed : Finset (Fin k) := - ({c : Fin k | - ∃ (r : Fin T.length), - A.length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < A.length + (ell - (2 : ℕ)) ∧ phi (T.edge r) = some c} : - Finset (Fin k)); - let available : Finset (Fin k) := - (TreeMissingColors phi B \ baseExtraMissing) \ prefixUsed; - let finalColors : Finset (Fin k) := - ({c : Fin k | phi (T.edge R.penultimateEdgeIndex) = some c} : Finset (Fin k)) ∪ - ({c : Fin k | phi (T.edge D.lastEdgeIndex) = some c} : Finset (Fin k)); - ∀ (beta : Fin k) (_ : beta ∈ (available \ finalColors) \ Dn) - (_ : beta ∈ available \ finalColors) (_ : beta ∉ Dn) - (_ : beta ∈ available) (_ : beta ∉ finalColors) - (_ : beta ∈ TreeMissingColors phi B \ baseExtraMissing) - (_ : beta ∉ prefixUsed) - (_ : beta ∈ TreeMissingColors phi B) (_ : beta ∉ baseExtraMissing) - (_ : - ∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → - phi (T.edge t) ≠ some beta) - (_ : beta ≠ D.alpha) (_ : beta ∈ TreeMissingColors phi T) - (_ : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) - (_ : beta ∈ TreeMissingColors phi Bplus) - (_ : - beta ∉ TreeMissingColors phi A ∨ D.alpha ∉ TreeMissingColors phi A → - TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T beta)) - (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ - beta ∉ - ({c : Fin k | - ∃ (t : Fin T.length), - A.length ≤ (↑t : ℕ) ∧ - (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T D.alpha) : ℕ) ∧ - phi (T.edge t) = some c} : - Finset (Fin k))), - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A ell B Bplus n Dn halpha R - baseExtraMissing prefixUsed available finalColors beta hbeta hbetaAvailableFinal hbetaDn - hbetaAvailable hbetaFinal hbetaMissingExtra hbetaPrefixUnused hbetaMissing hbetaExtra - hbetaUnused hcolorsDistinct hbetaT hbetaFirstBound hbetaPrefix horderedUnused - exact @helper_hDnDisjoint_310 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@halpha) (@R) (@beta) (@hbeta) (@hbetaAvailableFinal) (@hbetaDn) (@hbetaAvailable) - (@hbetaFinal) (@hbetaMissingExtra) (@hbetaPrefixUnused) (@hbetaMissing) (@hbetaExtra) - (@hbetaUnused) (@hcolorsDistinct) (@hbetaT) (@hbetaFirstBound) (@hbetaPrefix) - (@horderedUnused) - private theorem helper_continuation_3768.{u_1, u_2} : helperContinuation3768Conditions.{u_1, u_2} := by classical @@ -4230,7 +4071,7 @@ private theorem helper_continuation_4102.{u_1, u_2} : maximum := hstarMP notElementary := by rw [R.starVertexSet]; exact C.notElementary } have hstarPath : HierarchyPathNumber HStar = HierarchyPathNumber H := by - exact @helper_hstarPath_3572 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_hstarPath_824 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@hminusCount) (@corrStar) (@hstarMP) (@baseStar) (@HStar) (@hstarCount) (@hstarLen) (@hminusLen) @@ -4366,192 +4207,6 @@ private theorem helper_continuation_4235.{u_1, u_2} : (@hminusTerminalAvoidance) (@hBstar) (@hstarFirstEdge) (@hstarTerminalAvoidance) (@terminalData) (@copyGood) -private theorem helper_terminalAvoidance_4467.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq V] [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) - (_ : - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - ¬∃ eta ∈ HierarchyStoredColorsAt H q, - eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) ∧ - D.theta ∈ C.good.gamma q eta), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - ∀ (_ : (2 : ℕ) ≤ ell) (_ : ell = T.length - A.length) - (_ : A.length + ell = T.length) (_ : B.length = T.length - (2 : ℕ)) - (_ : TreeSequenceInitialSegment B T) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (_ : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (baseStar : HierarchyBase corrStar.replacementETT phi) - (_ : TashkinovHierarchy corrStar.replacementETT baseStar) - (_ : R.star.length = R.minus.length + (1 : ℕ)) - (_ : R.minus.length = B.length + (1 : ℕ)) - (_ : R.star.length = T.length) (_ : Fin k) - (_ : - ∀ (S : TreeSequence G e0) (c : Fin k) - (_ : (↑(HierarchyFirstMissingPosition phi S c) : ℕ) < S.length), - c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) - (_ : - ∀ (U : TreeSequence G e0) (_ : TreeSequenceInitialSegment B U) (eta : Fin k) - (r : ℕ) (_ : r ≤ B.length) - (_ : r < (↑(HierarchyFirstMissingPosition phi U eta) : ℕ)), - r < (↑(HierarchyFirstMissingPosition phi T eta) : ℕ)) - (_ : - ∀ (eta c : Fin k) (r : Fin T.length) (_ : A.length ≤ (↑r : ℕ)) - (_ : (↑r : ℕ) < (↑(HierarchyFirstMissingPosition phi T eta) : ℕ)) - (_ : phi (T.edge r) = some c), - c ∈ HierarchySegmentColors H q eta) - (U : TreeSequence G e0) (_ : TreeSequenceInitialSegment B U) - (_ : U.length ≤ B.length + (2 : ℕ)) - (_ : - ∀ (r : Fin U.length), - (↑r : ℕ) = B.length → - U.edge r = T.edge D.lastEdgeIndex) - (_ : - ∀ (r : Fin U.length), - (↑r : ℕ) = B.length + (1 : ℕ) → - U.edge r = T.edge R.penultimateEdgeIndex), - ∀ eta ∈ HierarchyStoredColorsAt H q, - Disjoint (C.good.gamma q eta) - ({c : Fin k | - ∃ (r : Fin U.length), - A.length ≤ (↑r : ℕ) ∧ - (↑r : ℕ) < min (↑(HierarchyFirstMissingPosition phi U eta) : ℕ) U.length ∧ - phi (U.edge r) = some c} : - Finset (Fin k)) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D hnonexceptional H q A ell B htail hell - hsum hBlen hBT R corrMinus baseMinus HMinus corrStar baseStar HStar hstarLen hminusLen - hstarLength beta firstMissingMemBelow firstLowerInOld oldSegmentMember U hBU hlen - hfirstEdge hsecondEdge - exact @helper_terminalAvoidance_394 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hnonexceptional) (@htail) (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) - (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@hstarLen) (@hminusLen) - (@hstarLength) (@beta) (@firstMissingMemBelow) (@firstLowerInOld) (@oldSegmentMember) - (@U) (@hBU) (@hlen) (@hfirstEdge) (@hsecondEdge) - -private abbrev helperContinuation4495Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) - (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) - (D : HierarchySituationTwoCaseTwoData G k e0 input T phi ett base C ctx) - (hnonexceptional : - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - ¬∃ eta ∈ HierarchyStoredColorsAt H q, - eta ∈ MissingColors G phi (T.vertex D.penultimateVertexIndex) ∧ D.theta ∈ C.good.gamma q eta), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := HierarchyFullTailLength C; - let B : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (2 : ℕ)); - let Bplus : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - ∀ (htail : (2 : ℕ) ≤ ell) (hell : ell = T.length - A.length) (hsum : A.length + ell = T.length) - (hBlen : B.length = T.length - (2 : ℕ)) (hBT : TreeSequenceInitialSegment B T) - (hprefixElementary : ColoredVertexSetElementary G phi (TreeSequenceVertexSet Bplus)) - (halpha : - D.alpha ∉ TreeMissingColors phi B ∧ - D.alpha ∉ Dn ∧ - ∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → - phi (T.edge t) ≠ some D.alpha) - (R : - HierarchySituationTwoReorderedTrees G k e0 input T phi ett base C ctx - D.toHierarchySituationTwoTailData) - (corrMinus : CorrespondingExtendedTashkinovTree G k e0 ett phi R.minus) - (hminusMP : MaximumProperty corrMinus.replacementETT) - (baseMinus : HierarchyBase corrMinus.replacementETT phi) - (hminusCore : baseMinus.core = base.core) (hminusClosure : baseMinus.closure = base.closure) - (HMinus : TashkinovHierarchy corrMinus.replacementETT baseMinus) - (hminusCount : HMinus.dividerCount = C.hierarchy.dividerCount) - (hminusStages : - ∀ (j : Fin (HMinus.dividerCount + (1 : ℕ))), - HMinus.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) - (corrStar : CorrespondingExtendedTashkinovTree G k e0 ett phi R.star) - (hstarMP : MaximumProperty corrStar.replacementETT) - (baseStar : HierarchyBase corrStar.replacementETT phi) (hstarCore : baseStar.core = base.core) - (hstarClosure : baseStar.closure = base.closure) - (HStar : TashkinovHierarchy corrStar.replacementETT baseStar) - (hstarCount : HStar.dividerCount = C.hierarchy.dividerCount) - (hstarStages : - ∀ (j : Fin (HStar.dividerCount + (1 : ℕ))), - HStar.stage j.castSucc = C.hierarchy.stage (Fin.cast (by omega) j).castSucc) - (hBminus : - TreeSequenceInitialSegment (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))) - R.minus) - (hstarLen : R.star.length = R.minus.length + (1 : ℕ)) - (hminusStar : TreeSequenceInitialSegment R.minus R.star) - (hstarEdge : - R.star.edge (Fin.cast (by omega) (Fin.last R.minus.length)) = T.edge R.penultimateEdgeIndex) - (hminusLen : R.minus.length = B.length + (1 : ℕ)) - (hminusEdge : - R.minus.edge - (Fin.cast (by change B.length + 1 = R.minus.length; exact hminusLen.symm) - (Fin.last (HierarchyFullTailPrefix C (HierarchyFullTailLength C - (2 : ℕ))).length)) = - T.edge D.lastEdgeIndex) - (hstarLength : R.star.length = T.length) (beta : Fin k) - (hbetaMissing : beta ∈ TreeMissingColors phi B) - (hbetaUnused : - ∀ (t : Fin T.length), - A.length ≤ (↑t : ℕ) → - phi (T.edge t) ≠ some beta) - (hcolorsDistinct : beta ≠ D.alpha) - (firstMissingLe : - ∀ (S : TreeSequence G e0) (c : Fin k) (i : Fin (S.length + (1 : ℕ))) - (hc : c ∈ MissingColors G phi (S.vertex i)), - HierarchyFirstMissingPosition phi S c ≤ i) - (firstMissingMem : - ∀ (S : TreeSequence G e0) (c : Fin k) (hc : c ∈ TreeMissingColors phi S), - c ∈ MissingColors G phi (S.vertex (HierarchyFirstMissingPosition phi S c))) - (vertexMem : - ∀ (S : TreeSequence G e0) (i : Fin (S.length + (1 : ℕ))), - S.vertex i ∈ TreeSequenceVertexSet S) - (missingMono : - ∀ {S U : TreeSequence G e0} (hSU : TreeSequenceInitialSegment S U), - TreeMissingColors phi S ⊆ TreeMissingColors phi U) - (hbetaT : beta ∈ TreeMissingColors phi T) - (hbetaFirstBound : (↑(HierarchyFirstMissingPosition phi T beta) : ℕ) ≤ B.length) - (halphaFirst : HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex) - (hbetaPrefix : beta ∈ TreeMissingColors phi Bplus) - (halphaPrefix : D.alpha ∈ TreeMissingColors phi Bplus) - (horderedUnused : - beta ∉ TreeMissingColors phi A ∨ D.alpha ∉ TreeMissingColors phi A → - TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition phi T beta)) - (T.vertex (HierarchyFirstMissingPosition phi T D.alpha)) ∧ - beta ∉ - ({c : Fin k | - ∃ (t : Fin T.length), - A.length ≤ (↑t : ℕ) ∧ - (↑t : ℕ) < (↑(HierarchyFirstMissingPosition phi T D.alpha) : ℕ) ∧ - phi (T.edge t) = some c} : - Finset (Fin k))) - (hDnDisjoint : Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) Dn) - (hDnqDisjoint : - Disjoint (insert beta ({ D.alpha } : Finset (Fin k)) : Finset (Fin k)) - (HierarchyStoredColorsAt H q)), - False - private theorem helper_continuation_4495.{u_1, u_2} : helperContinuation4495Conditions.{u_1, u_2} := by classical @@ -4586,11 +4241,12 @@ private theorem helper_continuation_4495.{u_1, u_2} : (hrB : r ≤ B.length) (hrU : r < (HierarchyFirstMissingPosition phi U eta).val) : r < (HierarchyFirstMissingPosition phi T eta).val := by - exact @helper_firstLowerInOld_3203 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) - (@hstarLen) (@hminusLen) (@hstarLength) (@beta) (@firstMissingLe) (@firstMissingMemBelow) - (@U) (@hBU) (@eta) (@r) (@hrB) (@hrU) + exact (@helper_firstLowerInOld_356 (@V) (@E) inferInstance inferInstance inferInstance + inferInstance + (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hBT) + (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@hstarLen) + (@hminusLen) (@hstarLength) (@eta) (@firstMissingLe) (@firstMissingMemBelow) (@U) (@hBU) + (@eta) (@r) (@hrB) (@hrU)) have oldSegmentMember (eta c : Fin k) (r : Fin T.length) (hlo : A.length ≤ r.val) (hhi : r.val < (HierarchyFirstMissingPosition phi T eta).val) @@ -4610,7 +4266,7 @@ private theorem helper_continuation_4495.{u_1, u_2} : A.length ≤ r.val ∧ r.val < min (HierarchyFirstMissingPosition phi U eta).val U.length ∧ phi (U.edge r) = some c) := by - exact @helper_terminalAvoidance_4467 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_terminalAvoidance_394 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hnonexceptional) (@htail) (@hell) (@hsum) (@hBlen) (@hBT) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@hstarLen) (@hminusLen) @@ -4786,7 +4442,7 @@ theorem HierarchySituationTwoSubcaseTwoOneNonexceptional {V E : Type*} (@hstarLen) (@hminusLen) (@hstarLength) (@beta) (@hbetaMissing) (@firstMissingLe) have halphaFirst : HierarchyFirstMissingPosition phi T D.alpha = D.penultimateVertexIndex := by - exact @helper_halphaFirst_3258 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_halphaFirst_256 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@hBT) (@halpha) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@hstarLen) (@hminusLen) (@hstarLength) (@beta) (@firstMissingLe) @@ -4807,13 +4463,13 @@ theorem HierarchySituationTwoSubcaseTwoOneNonexceptional {V E : Type*} A.length ≤ t.val ∧ t.val < (HierarchyFirstMissingPosition phi T D.alpha).val ∧ phi (T.edge t) = some c) := by - exact @helper_horderedUnused_3229 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_horderedUnused_290 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hBlen) (@R) (@corrMinus) (@baseMinus) (@HMinus) (@corrStar) (@baseStar) (@HStar) (@hstarLen) (@hminusLen) (@hstarLength) (@beta) (@hbetaUnused) (@hbetaFirstBound) (@halphaFirst) have hDnDisjoint : Disjoint ({beta, D.alpha} : Finset (Fin k)) Dn := by - exact @helper_hDnDisjoint_3416 (@V) (@E) inferInstance inferInstance inferInstance + exact @helper_hDnDisjoint_310 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@halpha) (@R) (@beta) (@hbeta) (@hbetaAvailableFinal) (@hbetaDn) (@hbetaAvailable) (@hbetaFinal) (@hbetaMissingExtra) (@hbetaPrefixUnused) (@hbetaMissing) (@hbetaExtra) diff --git a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean index a34878c6a1..5926b27b26 100644 --- a/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean +++ b/LeanPool/GoldbergSeymour/HierarchySituationTwoSubcaseTwoTwo.lean @@ -1067,6 +1067,91 @@ private abbrev helperContinuation5379Conditions.{u_1, u_2} : Prop := TreeMissingColors phi X) → False +private noncomputable abbrev helperTailTwo6007.{u_1, u_2} : + open scoped Classical in + {V : Type u_1} → + {E : Type u_2} → + [Fintype V] → + [Fintype E] → + [DecidableEq V] → + [DecidableEq E] → + (G : LooplessMultigraph V E) → + (k : ℕ) → + (e0 : E) → + (input : PartialEdgeColoring E k) → + (T : TreeSequence G e0) → + (phi : PartialEdgeColoring E k) → + (ett : ExtendedTashkinovTree G k e0 input T phi) → + (base : HierarchyBase ett phi) → + (C : HierarchyCounterexample base) → + (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett + base C) → + (D : + HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett + base C ctx) → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := + Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + (2 : ℕ) ≤ T.length - A.length → + (∀ + (P : + HierarchyReplacementPresentation G k e0 input T phi + ett base C ctx), + HierarchyStarredStage P.counterexample.hierarchy + (Fin.last + P.counterexample.hierarchy.dividerCount) = + A) → + (beta : Fin k) → + let z : V ⊕ E := + Sum.inl (T.vertex D.terminalVertexIndex); + (POne : + HierarchyReplacementPresentation G k e0 input T + phi ett base C ctx) → + let rho : PartialEdgeColoring E k := POne.coloring; + let muTwo : PartialEdgeColoring E k := + TwoColorComponentSwap G rho beta D.theta z; + muTwo (T.edge D.lastEdgeIndex) = some beta → + beta ∉ + MissingColors G muTwo + (T.vertex D.penultimateVertexIndex) → + (PTwo : + HierarchyReplacementPresentation G k e0 + input T phi ett base C ctx) → + PTwo.coloring = muTwo → + HierarchySituationTwoTailData G k e0 + PTwo.corresponding.replacementInput T + PTwo.coloring + PTwo.corresponding.replacementETT + PTwo.replacementBase PTwo.counterexample + PTwo.minimumContext := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail sameStar beta z POne rho + muTwo hlastTwo hgammaPenTwo PTwo hPTwo + exact { + tailAtLeastTwo := by + change 2 ≤ T.length - (HierarchyStarredStage PTwo.counterexample.hierarchy + (Fin.last PTwo.counterexample.hierarchy.dividerCount)).length + rw [sameStar PTwo] + exact htail + pathNumberFull := by + have hp := D.pathNumberFull + unfold HierarchyPathNumber HierarchyFullTailLength at hp ⊢ + dsimp only at hp ⊢ + rw [sameStar PTwo] + exact hp + lastEdgeIndex := D.lastEdgeIndex + penultimateVertexIndex := D.penultimateVertexIndex + terminalVertexIndex := D.terminalVertexIndex + lastEdgePosition := D.lastEdgePosition + penultimateVertexPosition := D.penultimateVertexPosition + terminalVertexPosition := D.terminalVertexPosition + lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate + theta := beta + thetaOnLastEdge := hPTwo.symm ▸ hlastTwo + thetaPresentPenultimate := hPTwo.symm ▸ hgammaPenTwo } + private theorem helper_hBterminal_158.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] @@ -3332,133 +3417,6 @@ private theorem helper_branch_3441.{u_1, u_2} : · exact @helper_branch_1685 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@beta) (@hbetaGamma) -private theorem helper_hsameTwo_3799.{u_1, u_2} : - SharedFacts.SecondSubcaseTransport.hsameTwo964Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast - beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib - hbFirst hibB hby hbt horder hrawBeta hmissing hchange hsame z muOne hdisjoint hpath - houtsideBeta houtsideAlpha hmissingOne hfixedOne hstoredOne hcase corrOne hmaxOne baseOne - KOne goodOne hsameOne hbTerminalOne POne hPOne rho ettOne baseOne' COne' HOne qOne - hmissingA hbetaStoredOne hgammaPenOne hgammaTermOne hgammaWitnessOne' hfirstGammaOne - hfirstThetaOne hgammaUnusedOne hcaseOne hmissingPairOne hchangeOne - exact @helper_hsameTwo_964 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hnotA) (@sameStar) (@sameLast) (@beta) (@hbetaMissing) (@hbetaUnused) - (@hbetaStored) (@hzero) (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) - (@hibB) (@hby) (@hbt) (@horder) (@hrawBeta) (@hmissing) (@hchange) (@hsame) - (@hdisjoint) (@hpath) (@houtsideBeta) (@houtsideAlpha) (@hmissingOne) (@hfixedOne) - (@hstoredOne) (@hcase) (@corrOne) (@hmaxOne) (@baseOne) (@KOne) (@goodOne) - (@hsameOne) (@hbTerminalOne) (@POne) (@hPOne) (@hmissingA) (@hbetaStoredOne) - (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') (@hfirstGammaOne) - (@hfirstThetaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hchangeOne) - -private theorem helper_hsameTwo_4804.{u_1, u_2} : - SharedFacts.SecondSubcaseTransport.hsameTwo964Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A B hnotA Bshort sameStar sameLast - beta hbetaMissing hbetaUnused hbetaStored hzero houtside hcutoff hbetaAlpha hbetaTheta ib - hbFirst hibB hby hbt horder hrawBeta hmissing hchange hsame z muOne hdisjoint hpath - houtsideBeta houtsideAlpha hmissingOne hfixedOne hstoredOne hcase corrOne hmaxOne baseOne - KOne goodOne hsameOne hbTerminalOne POne hPOne rho ettOne baseOne' COne' HOne qOne - hmissingA hbetaStoredOne hgammaPenOne hgammaTermOne hgammaWitnessOne' hfirstGammaOne - hfirstThetaOne hgammaUnusedOne hcaseOne hmissingPairOne hchangeOne - exact @helper_hsameTwo_3799 (@V) (@E) inferInstance inferInstance inferInstance - inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) - (@hnotA) (@sameStar) (@sameLast) (@beta) (@hbetaMissing) (@hbetaUnused) - (@hbetaStored) (@hzero) (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) - (@hibB) (@hby) (@hbt) (@horder) (@hrawBeta) (@hmissing) (@hchange) (@hsame) - (@hdisjoint) (@hpath) (@houtsideBeta) (@houtsideAlpha) (@hmissingOne) (@hfixedOne) - (@hstoredOne) (@hcase) (@corrOne) (@hmaxOne) (@baseOne) (@KOne) (@goodOne) - (@hsameOne) (@hbTerminalOne) (@POne) (@hPOne) (@hmissingA) (@hbetaStoredOne) - (@hgammaPenOne) (@hgammaTermOne) (@hgammaWitnessOne') (@hfirstGammaOne) - (@hfirstThetaOne) (@hgammaUnusedOne) (@hcaseOne) (@hmissingPairOne) (@hchangeOne) - -private noncomputable abbrev helperTailTwo6007.{u_1, u_2} : - open scoped Classical in - {V : Type u_1} → - {E : Type u_2} → - [Fintype V] → - [Fintype E] → - [DecidableEq V] → - [DecidableEq E] → - (G : LooplessMultigraph V E) → - (k : ℕ) → - (e0 : E) → - (input : PartialEdgeColoring E k) → - (T : TreeSequence G e0) → - (phi : PartialEdgeColoring E k) → - (ett : ExtendedTashkinovTree G k e0 input T phi) → - (base : HierarchyBase ett phi) → - (C : HierarchyCounterexample base) → - (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett - base C) → - (D : - HierarchySituationTwoCaseTwoTwoData G k e0 input T phi ett - base C ctx) → - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := - Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - (2 : ℕ) ≤ T.length - A.length → - (∀ - (P : - HierarchyReplacementPresentation G k e0 input T phi - ett base C ctx), - HierarchyStarredStage P.counterexample.hierarchy - (Fin.last - P.counterexample.hierarchy.dividerCount) = - A) → - (beta : Fin k) → - let z : V ⊕ E := - Sum.inl (T.vertex D.terminalVertexIndex); - (POne : - HierarchyReplacementPresentation G k e0 input T - phi ett base C ctx) → - let rho : PartialEdgeColoring E k := POne.coloring; - let muTwo : PartialEdgeColoring E k := - TwoColorComponentSwap G rho beta D.theta z; - muTwo (T.edge D.lastEdgeIndex) = some beta → - beta ∉ - MissingColors G muTwo - (T.vertex D.penultimateVertexIndex) → - (PTwo : - HierarchyReplacementPresentation G k e0 - input T phi ett base C ctx) → - PTwo.coloring = muTwo → - HierarchySituationTwoTailData G k e0 - PTwo.corresponding.replacementInput T - PTwo.coloring - PTwo.corresponding.replacementETT - PTwo.replacementBase PTwo.counterexample - PTwo.minimumContext := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx D H q A htail sameStar beta z POne rho - muTwo hlastTwo hgammaPenTwo PTwo hPTwo - exact { - tailAtLeastTwo := by - change 2 ≤ T.length - (HierarchyStarredStage PTwo.counterexample.hierarchy - (Fin.last PTwo.counterexample.hierarchy.dividerCount)).length - rw [sameStar PTwo] - exact htail - pathNumberFull := by - have hp := D.pathNumberFull - unfold HierarchyPathNumber HierarchyFullTailLength at hp ⊢ - dsimp only at hp ⊢ - rw [sameStar PTwo] - exact hp - lastEdgeIndex := D.lastEdgeIndex - penultimateVertexIndex := D.penultimateVertexIndex - terminalVertexIndex := D.terminalVertexIndex - lastEdgePosition := D.lastEdgePosition - penultimateVertexPosition := D.penultimateVertexPosition - terminalVertexPosition := D.terminalVertexPosition - lastEdgeNotIncidentPenultimate := D.lastEdgeNotIncidentPenultimate - theta := beta - thetaOnLastEdge := hPTwo.symm ▸ hlastTwo - thetaPresentPenultimate := hPTwo.symm ▸ hgammaPenTwo } - private theorem helper_branch_6081.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] @@ -3667,7 +3625,7 @@ private theorem helper_continuation_5379.{u_1, u_2} : have hsameTwo : TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex ib)) = TwoColorComponent G rho beta D.theta (Sum.inl (T.vertex D.penultimateVertexIndex)) := by - exact @helper_hsameTwo_4804 (@V) (@E) inferInstance inferInstance inferInstance inferInstance + exact @helper_hsameTwo_964 (@V) (@E) inferInstance inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@phi) (@ett) (@base) (@C) (@ctx) (@D) (@hnotA) (@sameStar) (@sameLast) (@beta) (@hbetaMissing) (@hbetaUnused) (@hbetaStored) (@hzero) (@houtside) (@hcutoff) (@hbetaAlpha) (@hbetaTheta) (@hbFirst) (@hibB) (@hby) (@hbt) (@horder) diff --git a/LeanPool/GoldbergSeymour/HierarchyTreeFacts.lean b/LeanPool/GoldbergSeymour/HierarchyTreeFacts.lean new file mode 100644 index 0000000000..2e4222b755 --- /dev/null +++ b/LeanPool/GoldbergSeymour/HierarchyTreeFacts.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyStarredStage + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +/-! +# Hierarchy stage and closure inclusions + +These facts depend only on the hierarchy or base, independently of coloring-change constructions. +-/ + +@[expose] public section + +namespace GoldbergSeymour + +variable {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {input generating phi : PartialEdgeColoring E k} + {tree : TreeSequence G e0} {ett : ExtendedTashkinovTree G k e0 input tree generating} + {base : HierarchyBase ett phi} + +/-- Every stage of a hierarchy is an initial segment of its terminal tree. -/ +theorem TashkinovHierarchy.stageInitialSegment (hierarchy : TashkinovHierarchy ett base) + (index : Fin (hierarchy.dividerCount + 2)) : + TreeSequenceInitialSegment (hierarchy.stage index) tree := by + exact Fin.reverseInduction + (motive := fun index => TreeSequenceInitialSegment (hierarchy.stage index) tree) + (by simpa only [hierarchy.terminalStage] using TreeSequenceInitialSegment.refl tree) + (fun index next => (hierarchy.nested index).trans next) index + +/-- In the parallel case the closure vertices are contained in the base core. -/ +theorem HierarchyBase.closure_vertexSet_subset_core (base : HierarchyBase ett phi) + (parallel : ett.series.data.kind (Fin.last ett.rounds) = some TashkinovExtensionKind.PE) : + TreeSequenceVertexSet base.closure ⊆ TreeSequenceVertexSet base.core := by + obtain ⟨_, _, ⟨union⟩⟩ := base.parallel parallel + intro vertex member + rw [union.vertexSet] + exact Finset.mem_union_right _ member + +/-- Earlier ordinary hierarchy stages are initial segments of later stages. -/ +theorem TashkinovHierarchy.stageInitialSegmentOfLE (hierarchy : TashkinovHierarchy ett base) + (first last : Fin (hierarchy.dividerCount + 2)) (ordered : first ≤ last) : + TreeSequenceInitialSegment (hierarchy.stage first) (hierarchy.stage last) := by + have nested : ∀ last : Fin (hierarchy.dividerCount + 2), + ∀ first, first ≤ last → + TreeSequenceInitialSegment (hierarchy.stage first) (hierarchy.stage last) := by + intro last + induction last using Fin.induction with + | zero => + intro first ordered + change first.val ≤ 0 at ordered + have equal : first = 0 := by + apply Fin.ext + simpa only [Fin.val_zero] using Nat.eq_zero_of_le_zero ordered + subst first + exact TreeSequenceInitialSegment.refl _ + | succ index induction => + intro first ordered + by_cases equal : first = index.succ + · subst first + exact TreeSequenceInitialSegment.refl _ + · have different : first.val ≠ index.val + 1 := fun same => equal (Fin.ext same) + change first.val ≤ index.val + 1 at ordered + exact (induction first (by change first.val ≤ index.val; omega)).trans + (hierarchy.nested index) + exact nested last first ordered + +/-- Every starred stage is contained in the next ordinary stage. -/ +theorem TashkinovHierarchy.starredStageInitialSegmentNext + (hierarchy : TashkinovHierarchy ett base) (index : Fin (hierarchy.dividerCount + 1)) : + TreeSequenceInitialSegment + (HierarchyStarredStage hierarchy index) (hierarchy.stage index.succ) := + Fin.cases hierarchy.coreInsideFirst (fun index => hierarchy.nested index.succ) index + +/-- The last starred stage is contained in the terminal tree. -/ +theorem TashkinovHierarchy.lastStarredInitialSegment (hierarchy : TashkinovHierarchy ett base) : + TreeSequenceInitialSegment + (HierarchyStarredStage hierarchy (Fin.last hierarchy.dividerCount)) tree := by + simpa only [Fin.succ_last, hierarchy.terminalStage] using + hierarchy.starredStageInitialSegmentNext (Fin.last hierarchy.dividerCount) + +/-- The starred hierarchy stages are nested in their index order. -/ +theorem TashkinovHierarchy.starredStageInitialSegmentOfLE + (hierarchy : TashkinovHierarchy ett base) (first last : Fin (hierarchy.dividerCount + 1)) + (ordered : first ≤ last) : + TreeSequenceInitialSegment + (HierarchyStarredStage hierarchy first) (HierarchyStarredStage hierarchy last) := by + by_cases equal : first = last + · subst last + exact TreeSequenceInitialSegment.refl _ + · have strict : first.val < last.val := by omega + have nonzero : last ≠ 0 := by intro zero; subst last; simp at strict + have lastStage : HierarchyStarredStage hierarchy last = hierarchy.stage last.castSucc := by + rw [← Fin.succ_pred last nonzero] + rfl + rw [lastStage] + exact (hierarchy.starredStageInitialSegmentNext first).trans + (hierarchy.stageInitialSegmentOfLE first.succ last.castSucc + (by change first.val + 1 ≤ last.val; omega)) + +end GoldbergSeymour + +end diff --git a/LeanPool/GoldbergSeymour/Imports.lean b/LeanPool/GoldbergSeymour/Imports.lean index 9714ec7329..705e8fed5d 100644 --- a/LeanPool/GoldbergSeymour/Imports.lean +++ b/LeanPool/GoldbergSeymour/Imports.lean @@ -285,6 +285,7 @@ public import LeanPool.GoldbergSeymour.HierarchyTailMissingColorExclusion public import LeanPool.GoldbergSeymour.HierarchyTailPrefix public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColors public import LeanPool.GoldbergSeymour.HierarchyTerminalStoredColorsSubsetLast +public import LeanPool.GoldbergSeymour.HierarchyTreeFacts public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable public import LeanPool.GoldbergSeymour.HkuIncidentColorPreserved public import LeanPool.GoldbergSeymour.HkuMissingStoredMonotone @@ -533,6 +534,7 @@ public import LeanPool.GoldbergSeymour.ScheideTwoColorLastExitPath public import LeanPool.GoldbergSeymour.SharedFacts.BaseControl public import LeanPool.GoldbergSeymour.SharedFacts.Basic2TerminalPE public import LeanPool.GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 +public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaRoutes public import LeanPool.GoldbergSeymour.SharedFacts.DisjointThetaTransport public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseClaim45Singleton public import LeanPool.GoldbergSeymour.SharedFacts.ExtensionBaseStepLemmas @@ -542,12 +544,12 @@ public import LeanPool.GoldbergSeymour.SharedFacts.FirstSubcaseTransport public import LeanPool.GoldbergSeymour.SharedFacts.FullTailTransport public import LeanPool.GoldbergSeymour.SharedFacts.GoodHierarchyPrefixPreparation public import LeanPool.GoldbergSeymour.SharedFacts.InsideAdvancement -public import LeanPool.GoldbergSeymour.SharedFacts.LargestClosedTransport public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation1 public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation2 public import LeanPool.GoldbergSeymour.SharedFacts.OutsideAdvancement public import LeanPool.GoldbergSeymour.SharedFacts.ParallelSupportClosureProperties +public import LeanPool.GoldbergSeymour.SharedFacts.ReplacementPrefixes public import LeanPool.GoldbergSeymour.SharedFacts.RevisitingTerminalPreparation public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveNoCross public import LeanPool.GoldbergSeymour.SharedFacts.ScheideDefectiveThirdBoundaryEdge diff --git a/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean b/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean index 0c2749033b..70135b551c 100644 --- a/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean +++ b/LeanPool/GoldbergSeymour/OutsidePrefixBranch.lean @@ -1246,51 +1246,6 @@ private theorem helper_hlowerX_1128.{u_1, u_2} : exact hlt exact P.minimumContext.lowerRung lower hpos hlt' hmax -private theorem helper_hfull_1473.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 - input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : - HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : - HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) - (sigma : PartialEdgeColoring E k) (_ : P2880_T1_SplitSwapData G k e0 input T phi ett base - C ctx P alpha beta sigma), - let X : TreeSequence G e0 := HierarchyFullTailPrefix C (HierarchyPathNumber C.hierarchy - (1 : - ℕ)); - let m : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput T P.coloring := - P.corresponding.replacementETT; - let H : TashkinovHierarchy P.corresponding.replacementETT P.replacementBase := - P.counterexample.hierarchy; - ∀ (ettX : ExtendedTashkinovTree G k e0 P.corresponding.replacementInput X P.coloring) (baseX : - HierarchyBase ettX P.coloring) (_ : baseX.closure = P.replacementBase.closure) (HX : - TashkinovHierarchy ettX baseX) (goodX : GoodHierarchy HX) (_ : IsProperEdgeColoring G - sigma) (_ : IsOneEdgeUncolored sigma e0) (_ : StableColoring X (TashkinovStoredColors - ettX.series.data (Fin.last ettX.rounds)) P.coloring sigma), - let n : Fin (m.rounds + (1 : ℕ)) := Fin.last m.rounds; - let Tn : TreeSequence G e0 := m.series.data.tree n.castSucc; - let Dn : Finset (Fin k) := TashkinovStoredColors m.series.data n; - ∀ (_ : StableColoring Tn Dn P.coloring sigma) (_ : ModColoring m sigma) (_ : - m.series.data.kind n = some TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence - sigma Tn T ∨ (m.series.data.kind n = some TashkinovExtensionKind.SE ∨ m.series.data.kind n - = some TashkinovExtensionKind.RE) ∧ - ∃ (f : E) (seed : TreeSequence G e0), m.series.data.connectingEdges n = ({ f } : Finset E) ∧ - TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence sigma seed T) (_ : - TreeSequenceInitialSegment Tn T) (_ : Tn.length < T.length) (corrPrefix : - CorrespondingExtendedTashkinovTree G k e0 m sigma X) (basePrefix : HierarchyBase - corrPrefix.replacementETT sigma) (KPrefix : TashkinovHierarchy corrPrefix.replacementETT - basePrefix) (goodPrefix : GoodHierarchy KPrefix) (_ : SameGoodHierarchy goodX goodPrefix) - (_ : ettX.series.data.kind (Fin.last ettX.rounds) = m.series.data.kind n), - ∃ (corr : CorrespondingExtendedTashkinovTree G k e0 m sigma T), MaximumProperty - corr.replacementETT ∧ - ∃ (newBase : HierarchyBase corr.replacementETT sigma) (K : TashkinovHierarchy - corr.replacementETT newBase), newBase.closure = basePrefix.closure ∧ SameHierarchyStages H - K := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta sigma S X m H ettX baseX - hclosureX HX goodX hsigmaProper hsigmaOne hstableX n Tn Dn hstableTn hmod hroute hNT - hNstrict corrPrefix basePrefix KPrefix goodPrefix samePrefix hkindX - apply helper_hfull_1262 <;> assumption private theorem helper_continuation_1640.{u_1, u_2} : helperContinuation1640Conditions.{u_1, u_2} := by classical @@ -1446,7 +1401,7 @@ private theorem helper_continuation_1844.{u_1, u_2} : ∃ newBase : HierarchyBase corr.replacementETT sigma, ∃ K : TashkinovHierarchy corr.replacementETT newBase, newBase.closure = basePrefix.closure ∧ SameHierarchyStages H K := by - apply helper_hfull_1473 <;> assumption + apply helper_hfull_1262 <;> assumption rcases hfull with ⟨corrFull, hmaximumFull, baseFull, KFull, hclosure, hsameFull⟩ have hcoreFull : baseFull.core = basePrefix.core := by have hprefixCore := samePrefix.1.1 diff --git a/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean b/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean index d3366d18b6..ffeef4681f 100644 --- a/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean +++ b/LeanPool/GoldbergSeymour/ParallelExtensionUndoStable.lean @@ -1218,334 +1218,6 @@ private theorem helper_branch_1407.{u_1, u_2} : (Or.inl ⟨c, hc2, hsel.trans hcf⟩) exact hstable.trans hsel -private theorem helper_branch_1764.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series - : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (v : V) (gamma delta : Fin k) (_ : - series.data.kind q.succ = some TashkinovExtensionKind.PE) (sigma : PartialEdgeColoring E - k) (ci : Fin rounds) (_ : IsProperEdgeColoring G (series.data.coloring ci.castSucc)) (_ : - IsOneEdgeUncolored (series.data.coloring ci.castSucc) e0) (_ : ColoredVertexSetClosed G - (series.data.coloring ci.castSucc) (TreeSequenceVertexSet (series.data.tree - ci.succ.castSucc))) (_ : ¬ColoredVertexSetStronglyClosed G (series.data.coloring - ci.castSucc) (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc))) (_ : ¬Nonempty - (RevisitingExtensionCertificate series.data ci.castSucc)) (choice : MaximumDefectiveChoice - G e0 (series.data.tree ci.succ.castSucc) (TashkinovStoredColors series.data ci.castSucc) - (series.data.coloring ci.castSucc)) (_ : - ∀ (pi : PartialEdgeColoring E k), IsProperEdgeColoring G pi → IsOneEdgeUncolored pi e0 → - StableColoring (series.data.tree ci.succ.castSucc) (insert choice.color - (TashkinovStoredColors series.data ci.castSucc) : Finset (Fin k)) choice.selected pi → - Disjoint (MissingColors G pi choice.otherEndpoint) (TreeMissingColors pi (series.data.tree - ci.succ.castSucc))) (_ : series.data.coloring ci.succ = choice.selected) (_ : - series.data.stored ci.succ = ({ choice.color } : Finset (Fin k))) (_ : - series.data.connectingEdges ci.succ = ({ choice.edge } : Finset E)) (_ : series.data.kind - ci.succ = some TashkinovExtensionKind.SE) (_ : series.data.chosenVertex ci.succ = some - choice.vertex) (_ : series.data.outsideVertex ci.succ = some choice.otherEndpoint) (_ : - series.data.delta ci.succ = some choice.color) (_ : series.data.gamma ci.succ = none) - (adjoined : TreeSequence G e0) (_ : TreeSequenceAdjoinEdge (series.data.tree - ci.succ.castSucc) choice.edge adjoined) (_ : TashkinovClosure (series.data.coloring - ci.succ) adjoined (series.data.tree ci.succ.succ)) (_ : TreeSequenceInitialSegment - (series.data.tree ci.succ.castSucc) (series.data.tree ci.succ.succ)) (_ : - (series.data.tree ci.succ.castSucc).length < (series.data.tree ci.succ.succ).length) (_ : - q.succ = ci.succ), - ∃ (selected : PartialEdgeColoring E k) (secondStable : PartialEdgeColoring E k), - IsProperEdgeColoring G selected ∧ IsOneEdgeUncolored selected e0 ∧ StableColoring - (series.data.tree ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) - (series.data.coloring q.castSucc) selected ∧ IsProperEdgeColoring G secondStable ∧ - IsOneEdgeUncolored secondStable e0 ∧ StableColoring (series.data.tree ci.succ.castSucc) - (insert delta (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) selected - secondStable ∧ series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma - delta (Sum.inl v) ∧ - let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma delta (Sum.inl v); - StableColoring (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors - series.data q.castSucc) : Finset (Fin k)) secondStable undone ∧ StableColoring - (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors series.data - q.castSucc) : Finset (Fin k)) selected undone ∧ StableColoring (series.data.tree - ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) (series.data.coloring - q.castSucc) undone := by - classical - intro V E _ _ _ G k rounds e0 input series q v gamma delta hkind sigma ci previousProper - previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice - seriesAlternative currentColoring currentStored currentEdges currentKind currentVertex - currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension - orderedExtension strictExtension target_eq - apply helper_branch_1099 <;> assumption -private theorem helper_branch_1776.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series - : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (v : V) (gamma delta : Fin k) (_ : - series.data.kind q.succ = some TashkinovExtensionKind.PE) (sigma : PartialEdgeColoring E - k) (ci : Fin rounds) (_ : IsProperEdgeColoring G (series.data.coloring ci.castSucc)) (_ : - IsOneEdgeUncolored (series.data.coloring ci.castSucc) e0) (_ : ColoredVertexSetClosed G - (series.data.coloring ci.castSucc) (TreeSequenceVertexSet (series.data.tree - ci.succ.castSucc))) (_ : ¬ColoredVertexSetStronglyClosed G (series.data.coloring - ci.castSucc) (TreeSequenceVertexSet (series.data.tree ci.succ.castSucc))) (available : - RevisitingExtensionCertificate series.data ci.castSucc) (_ : series.data.coloring ci.succ - = series.data.coloring ci.castSucc) (_ : series.data.stored ci.succ = (insert - available.delta ({ available.gamma } : Finset (Fin k)) : Finset (Fin k))) (_ : - series.data.connectingEdges ci.succ = ({ available.edge } : Finset E)) (_ : - series.data.kind ci.succ = some TashkinovExtensionKind.RE) (_ : series.data.chosenVertex - ci.succ = some available.insideEndpoint) (_ : series.data.outsideVertex ci.succ = some - available.outsideEndpoint) (_ : series.data.delta ci.succ = some available.delta) (_ : - series.data.gamma ci.succ = some available.gamma) (adjoined : TreeSequence G e0) (_ : - TreeSequenceAdjoinEdge (series.data.tree ci.succ.castSucc) available.edge adjoined) (_ : - TashkinovClosure (series.data.coloring ci.succ) adjoined (series.data.tree ci.succ.succ)) - (_ : TreeSequenceInitialSegment (series.data.tree ci.succ.castSucc) (series.data.tree - ci.succ.succ)) (_ : (series.data.tree ci.succ.castSucc).length < (series.data.tree - ci.succ.succ).length) (_ : q.succ = ci.succ), - ∃ (selected : PartialEdgeColoring E k) (secondStable : PartialEdgeColoring E k), - IsProperEdgeColoring G selected ∧ IsOneEdgeUncolored selected e0 ∧ StableColoring - (series.data.tree ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) - (series.data.coloring q.castSucc) selected ∧ IsProperEdgeColoring G secondStable ∧ - IsOneEdgeUncolored secondStable e0 ∧ StableColoring (series.data.tree ci.succ.castSucc) - (insert delta (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) selected - secondStable ∧ series.data.coloring ci.succ = TwoColorComponentSwap G secondStable gamma - delta (Sum.inl v) ∧ - let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma gamma delta (Sum.inl v); - StableColoring (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors - series.data q.castSucc) : Finset (Fin k)) secondStable undone ∧ StableColoring - (series.data.tree ci.succ.castSucc) (insert delta (TashkinovStoredColors series.data - q.castSucc) : Finset (Fin k)) selected undone ∧ StableColoring (series.data.tree - ci.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) (series.data.coloring - q.castSucc) undone := by - classical - intro V E _ _ _ G k rounds e0 input series q v gamma delta hkind sigma ci previousProper - previousOneUncolored previousClosed previousNotStronglyClosed available currentColoring - currentStored currentEdges currentKind currentVertex currentOutside currentDelta - currentGamma adjoined adjoinedExactly closedExtension orderedExtension strictExtension - target_eq - apply helper_branch_1110 <;> assumption -private theorem helper_htreeEdge_1972.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series - : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) - (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G secondStable) (choice - : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) (TashkinovStoredColors - series.data q.castSucc) (series.data.coloring q.castSucc)) (_ : chosenGamma ∈ - MissingColors G secondStable choice.vertex) (u : V) (path : (TwoColorIncidenceGraph G - secondStable chosenGamma choice.color).Walk (Sum.inl u) (Sum.inl choice.vertex)) (_ : - (chosenGamma ∈ MissingColors G secondStable u ∨ choice.color ∈ MissingColors G - secondStable u) ∧ - ∀ w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), Sum.inl w ∈ path.support ↔ w = - choice.vertex) (_ : - ∀ y ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex), y ∈ - path.support) (_ : - ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl - choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) - (_ : secondStable choice.edge = some choice.color) (e : E), TreeIncidentEdge - (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ TwoColorComponent G secondStable - chosenGamma choice.color (Sum.inl choice.vertex) → e = choice.edge := by - classical - intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable secondStableProper choice - hmissing u path endOnly hpathComponent hcompEdge hchoiceSecond - apply helper_htreeEdge_1211 <;> assumption -private theorem helper_hsigmaEdge_1980.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series - : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : PartialEdgeColoring E k) - (_ : IsProperEdgeColoring G sigma) (_ : StableColoring (series.data.tree q.succ.castSucc) - (TashkinovStoredColors series.data q.succ) (series.data.coloring q.succ) sigma) - (chosenGamma : Fin k) (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G - secondStable) (choice : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) - (TashkinovStoredColors series.data q.castSucc) (series.data.coloring q.castSucc)) (_ : - series.data.coloring q.succ = TwoColorComponentSwap G secondStable chosenGamma - choice.color (Sum.inl choice.vertex)) (_ : series.data.stored q.succ = (insert - choice.color ({ chosenGamma } : Finset (Fin k)) : Finset (Fin k))) (_ : series.data.gamma - q.succ = some chosenGamma) (_ : choice.vertex ∈ TreeSequenceVertexSet (series.data.tree - q.succ.castSucc)) (_ : - ∀ w ∈ TreeSequenceVertexSet (series.data.tree q.succ.castSucc), Sum.inl w ∈ TwoColorComponent - G sigma chosenGamma choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex) (_ : - chosenGamma ∈ MissingColors G secondStable choice.vertex) (_ : V) (_ : - ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl - choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) - (_ : secondStable choice.edge = some choice.color) (_ : chosenGamma ≠ choice.color) (_ : - Sum.inr choice.edge ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl - choice.vertex)) (e : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e - ∈ TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) → e = - choice.edge := by - classical - intro V E _ _ _ G k rounds e0 input series q sigma hsigmaProper hsigmaStable chosenGamma - secondStable secondStableProper choice currentColoring currentStored hgamma hv hcomponent - hmissing u hcompEdge hchoiceSecond hneq hfcomponent - apply helper_hsigmaEdge_358 <;> assumption -private theorem helper_currentColorMissing_2017.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series - : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (chosenGamma : Fin k) - (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G secondStable) (choice - : MaximumDefectiveChoice G e0 (series.data.tree q.succ.castSucc) (TashkinovStoredColors - series.data q.castSucc) (series.data.coloring q.castSucc)) (_ : series.data.coloring - q.succ = TwoColorComponentSwap G secondStable chosenGamma choice.color (Sum.inl - choice.vertex)) (_ : chosenGamma ∈ MissingColors G secondStable choice.vertex) (_ : - ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl - choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) - (_ : secondStable choice.edge = some choice.color) (_ : chosenGamma ≠ choice.color) (_ : - Sum.inr choice.edge ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl - choice.vertex)), choice.color ∈ MissingColors G (series.data.coloring q.succ) - choice.vertex := by - classical - intro V E _ _ _ G k rounds e0 input series q chosenGamma secondStable secondStableProper choice - currentColoring hmissing hcompEdge hchoiceSecond hneq hfcomponent - apply helper_currentColorMissing_1304 <;> assumption -private theorem helper_stableSecond_2052.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [inst_2 : DecidableEq - E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (series : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : - PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma - e0) (_ : StableColoring (series.data.tree q.succ.castSucc) (TashkinovStoredColors - series.data q.succ) (series.data.coloring q.succ) sigma) (chosenGamma : Fin k) - (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G secondStable) (_ : - IsOneEdgeUncolored secondStable e0) (choice : MaximumDefectiveChoice G e0 - (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) - (series.data.coloring q.castSucc)) (_ : StableColoring (series.data.tree q.succ.castSucc) - (insert choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) - choice.selected secondStable) (_ : series.data.coloring q.succ = TwoColorComponentSwap G - secondStable chosenGamma choice.color (Sum.inl choice.vertex)) (_ : IsProperEdgeColoring G - (series.data.coloring q.succ)) (_ : IsOneEdgeUncolored (series.data.coloring q.succ) e0) - (_ : - ∀ (w : V), chosenGamma ∈ MissingColors G secondStable w ∨ choice.color ∈ MissingColors G - secondStable w → @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k - secondStable chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 - (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 - G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat - instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ - rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E - inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) - (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 - inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) (@Sum.inl V E w) - (@Subtype.fintype (Sum V E) (@Membership.mem (Sum V E) (Set (Sum V E)) - (@Set.instMembership (Sum V E)) (@SimpleGraph.neighborSet (Sum V E) - (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V - E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V - E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat - (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit - 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 - (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc - rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E - inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) - (@Sum.inl V E w))) (fun (a : Sum V E) ↦ @SimpleGraph.neighborSet.memDecidable (Sum V E) - (@TwoColorIncidenceGraph V E G k secondStable chosenGamma (@MaximumDefectiveChoice.color V - E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V - E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat - (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit - 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 - (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc - rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E - inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) - (@Sum.inl V E w) (fun (a b : Sum V E) ↦ Classical.propDecidable (@SimpleGraph.Adj (Sum V - E) (@TwoColorIncidenceGraph V E G k secondStable chosenGamma - (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 (@TashkinovSeriesData.tree V E G k - rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) - (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat instAddNat) rounds (@OfNat.ofNat Nat - (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ rounds q))) (@TashkinovStoredColors V - E inst_1 G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input - series) (@Fin.castSucc rounds q)) (@TashkinovSeriesData.coloring V E G k rounds e0 - (@TashkinovSeries.data V E inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc - rounds q)) choice)) a b)) a) (@instFintypeSum V E inst inst_1)) ≤ (1 : ℕ)) (u : V) (path : - (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Walk (Sum.inl u) (Sum.inl - choice.vertex)) (_ : - ∀ (x : V ⊕ E), @SimpleGraph.degree (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable - chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 - (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 - G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat - instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ - rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E - inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) - (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 - inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x (@Fintype.ofFinite - (@Set.Elem (Sum V E) (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k - secondStable chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 - (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 - G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat - instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ - rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E - inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) - (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 - inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x)) (@Subtype.finite - (Sum V E) (@Finite.instSum V E (@Finite.of_fintype V inst) (@Finite.of_fintype E inst_1)) - (@Membership.mem (Sum V E) (Set (Sum V E)) (@Set.instMembership (Sum V E)) - (@SimpleGraph.neighborSet (Sum V E) (@TwoColorIncidenceGraph V E G k secondStable - chosenGamma (@MaximumDefectiveChoice.color V E inst inst_1 G k e0 - (@TashkinovSeriesData.tree V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 inst_2 - G k rounds e0 input series) (@Fin.castSucc (@HAdd.hAdd Nat Nat Nat (@instHAdd Nat - instAddNat) rounds (@OfNat.ofNat Nat (nat_lit 1) (instOfNatNat (nat_lit 1)))) (@Fin.succ - rounds q))) (@TashkinovStoredColors V E inst_1 G k rounds e0 (@TashkinovSeries.data V E - inst inst_1 inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) - (@TashkinovSeriesData.coloring V E G k rounds e0 (@TashkinovSeries.data V E inst inst_1 - inst_2 G k rounds e0 input series) (@Fin.castSucc rounds q)) choice)) x)))) ≤ (2 : ℕ)) (_ - : - ∀ x ∈ path.support, - ∀ (y : V ⊕ E), (TwoColorIncidenceGraph G secondStable chosenGamma choice.color).Adj x y → y ∈ - path.support) (_ : - ∀ y ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex), y ∈ - path.support) (_ : - ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl - choice.vertex) → secondStable e = some chosenGamma ∨ secondStable e = some choice.color) - (_ : secondStable choice.edge = some choice.color) (_ : - ∀ (e : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ - TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex) → e = - choice.edge) (_ : - ∀ (e : E), TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ - TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) → e = - choice.edge), - let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color - (Sum.inl choice.vertex); - ∀ (_ : IsProperEdgeColoring G undone) (_ : IsOneEdgeUncolored undone e0) (_ : - TreeMissingColors secondStable (series.data.tree q.succ.castSucc) = TreeMissingColors - choice.selected (series.data.tree q.succ.castSucc)) (_ : - ∀ (e : E), Sum.inr e ∈ TwoColorComponent G sigma chosenGamma choice.color (Sum.inl - choice.vertex) → sigma e = some chosenGamma ∨ sigma e = some choice.color) (_ : - choice.color ∈ MissingColors G sigma choice.vertex) (_ : - ∀ c ∈ TreeMissingColors choice.selected (series.data.tree q.succ.castSucc) ∪ (insert - choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)), c ∈ - TreeMissingColors (series.data.coloring q.succ) (series.data.tree q.succ.castSucc) ∪ - TashkinovStoredColors series.data q.succ) (_ : chosenGamma ∈ TreeMissingColors - choice.selected (series.data.tree q.succ.castSucc) ∪ (insert choice.color - (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k))), StableColoring - (series.data.tree q.succ.castSucc) (insert choice.color (TashkinovStoredColors series.data - q.castSucc) : Finset (Fin k)) secondStable undone := by - classical - intro V E _ _ _ G k rounds e0 input series q sigma hsigmaProper hsigmaOneUncolored hsigmaStable - chosenGamma secondStable secondStableProper secondStableOneUncolored choice - secondStableRelation currentColoring currentProper currentOneUncolored hdegree u path - hdegreeBound hclosed hpathComponent hcompEdge hchoiceSecond htreeEdge hsigmaEdge undone - undoneProper undoneOne treeSecondSelected sigmaComponentColor sigmaColorMissing - currentControl gammaControl - apply helper_stableSecond_588 <;> assumption -private theorem helper_stableSelected_2064.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq E] (G : - LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (series - : TashkinovSeries G k rounds e0 input) (q : Fin rounds) (sigma : PartialEdgeColoring E k) - (chosenGamma : Fin k) (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G - secondStable) (_ : IsOneEdgeUncolored secondStable e0) (choice : MaximumDefectiveChoice G - e0 (series.data.tree q.succ.castSucc) (TashkinovStoredColors series.data q.castSucc) - (series.data.coloring q.castSucc)) (_ : StableColoring (series.data.tree q.succ.castSucc) - (insert choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) - choice.selected secondStable), - let undone : PartialEdgeColoring E k := TwoColorComponentSwap G sigma chosenGamma choice.color - (Sum.inl choice.vertex); - ∀ (_ : IsProperEdgeColoring G undone) (_ : IsOneEdgeUncolored undone e0) (_ : - TreeMissingColors secondStable (series.data.tree q.succ.castSucc) = TreeMissingColors - choice.selected (series.data.tree q.succ.castSucc)) (_ : StableColoring (series.data.tree - q.succ.castSucc) (insert choice.color (TashkinovStoredColors series.data q.castSucc) : - Finset (Fin k)) secondStable undone), StableColoring (series.data.tree q.succ.castSucc) - (insert choice.color (TashkinovStoredColors series.data q.castSucc) : Finset (Fin k)) - choice.selected undone := by - classical - intro V E _ _ _ G k rounds e0 input series q sigma chosenGamma secondStable secondStableProper - secondStableOneUncolored choice secondStableRelation undone undoneProper undoneOne - treeSecondSelected stableSecond - exact @helper_stableSelected_718 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@rounds) (@e0) (@input) (@series) (@q) (@sigma) (@chosenGamma) (@secondStable) - (@secondStableProper) (@secondStableOneUncolored) (@choice) (@secondStableRelation) - (@undoneProper) (@undoneOne) (@treeSecondSelected) (@stableSecond) - theorem ParallelExtensionUndoStable {V E : Type*} [Fintype V] [Fintype E] [DecidableEq E] (G : LooplessMultigraph V E) (k rounds : ℕ) (e0 : E) @@ -1602,13 +1274,13 @@ theorem ParallelExtensionUndoStable {V E : Type*} currentColoring currentStored currentEdges currentKind currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension strictExtension => - apply helper_branch_1764 <;> assumption + apply helper_branch_1099 <;> assumption | RE ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed available currentColoring currentStored currentEdges currentKind currentVertex currentOutside currentDelta currentGamma adjoined adjoinedExactly closedExtension orderedExtension strictExtension => - apply helper_branch_1776 <;> assumption + apply helper_branch_1110 <;> assumption | PE ci previousProper previousOneUncolored previousClosed previousNotStronglyClosed noRevisiting choice seriesAlternativeFails chosenGamma gammaRule secondStable secondStableProper @@ -1673,8 +1345,8 @@ theorem ParallelExtensionUndoStable {V E : Type*} have htreeEdge : ∀ e, TreeIncidentEdge (series.data.tree q.succ.castSucc) e → Sum.inr e ∈ TwoColorComponent G secondStable chosenGamma choice.color (Sum.inl choice.vertex) → e = choice.edge := by - apply helper_htreeEdge_1972 <;> assumption - have hsigmaEdge := @helper_hsigmaEdge_1980 (@V) (@E) inferInstance inferInstance inferInstance + apply helper_htreeEdge_1211 <;> assumption + have hsigmaEdge := @helper_hsigmaEdge_358 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@rounds) (@e0) (@input) (@series) (@q) (@sigma) (@hsigmaProper) (@hsigmaStable) (@chosenGamma) (@secondStable) (@secondStableProper) (@choice) (@currentColoring) (@currentStored) (@hgamma) (@hv) (@hcomponent) (@hmissing) (@u) (@hcompEdge) @@ -1702,7 +1374,7 @@ theorem ParallelExtensionUndoStable {V E : Type*} ∀ e, Sum.inr e ∈ TwoColorComponent G sigma chosenGamma choice.color (Sum.inl choice.vertex) → sigma e = some chosenGamma ∨ sigma e = some choice.color := by apply helper_sigmaComponentColor_1288; assumption - have currentColorMissing := @helper_currentColorMissing_2017 (@V) (@E) inferInstance + have currentColorMissing := @helper_currentColorMissing_1304 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@rounds) (@e0) (@input) (@series) (@q) (@chosenGamma) (@secondStable) (@secondStableProper) (@choice) (@currentColoring) (@hmissing) (@hcompEdge) (@hchoiceSecond) (@hneq) (@hfcomponent) @@ -1734,8 +1406,8 @@ theorem ParallelExtensionUndoStable {V E : Type*} (series.data.tree q.succ.castSucc) (insert choice.color (TashkinovStoredColors series.data q.castSucc)) secondStable undone := by - apply helper_stableSecond_2052 <;> assumption - have stableSelected := @helper_stableSelected_2064 (@V) (@E) inferInstance inferInstance + apply GoldbergSeymour.helper_stableSecond_588 <;> assumption + have stableSelected := @helper_stableSelected_718 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@rounds) (@e0) (@input) (@series) (@q) (@sigma) (@chosenGamma) (@secondStable) (@secondStableProper) (@secondStableOneUncolored) (@choice) (@secondStableRelation) (@undoneProper) (@undoneOne) (@treeSecondSelected) (@stableSecond) diff --git a/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean b/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean index 1bf212d3f4..ad1eed2391 100644 --- a/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean +++ b/LeanPool/GoldbergSeymour/PositivePrefixNoRevisiting.lean @@ -5,6 +5,12 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.RevisitingTerminalPreparation + +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentFacts + +public import LeanPool.GoldbergSeymour.TashkinovSeriesColoringProperties + public import LeanPool.GoldbergSeymour.Preamble public import LeanPool.GoldbergSeymour.CertifiedETTRestriction @@ -1811,237 +1817,6 @@ private abbrev helperHtreePrefixFull719Conditions.{u_1, u_2} : Prop := originalPrefix.series.data.tree oldi.succ.castSucc = ett.series.data.tree fulli.succ.castSucc -private abbrev helperBranch3084Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [inst : Fintype V] [inst_1 : Fintype E] [ DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) - (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < ett.rounds), - let q : Fin ett.rounds := - (⟨ett.rounds - (1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds); - ∀ (sigmaPrev : PartialEdgeColoring E k) - (originalPrefix : - ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds).castSucc)) - (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)), - ( - ∀ (i : Fin (originalPrefix.rounds + (2 : ℕ))), - originalPrefix.series.data.tree i = - ett.series.data.tree - (Fin.castLE - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - i)) → - ( - ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), - originalPrefix.series.data.coloring i = - ett.series.data.coloring - (Fin.castLE - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - i) ∧ - originalPrefix.series.data.stored i = - ett.series.data.stored - (Fin.castLE - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - i) ∧ - originalPrefix.series.data.connectingEdges i = - ett.series.data.connectingEdges - (Fin.castLE - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - i) ∧ - originalPrefix.series.data.kind i = - ett.series.data.kind - (Fin.castLE - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - i) ∧ - TashkinovStoredColors originalPrefix.series.data i = - TashkinovStoredColors ett.series.data - (Fin.castLE - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - i)) → - ∀ - (corr : - CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev - (ett.series.data.tree (Fin.last ett.rounds).castSucc)), - ¬Nonempty - (RevisitingExtensionCertificate ett.series.data - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds).castSucc) → - let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := - Fin.last originalPrefix.rounds; - Fin.castLE - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - replacementLast = - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds).castSucc → - corr.replacementSeries.data.tree replacementLast.succ = - ett.series.data.tree - (⟨ett.rounds - (1 : ℕ), - by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds).succ.castSucc → - ∀ - (available : RevisitingExtensionCertificate corr.replacementSeries.data replacementLast), - let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; - ∀ (oldi : Fin originalPrefix.rounds) - (oldChoice : - MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) - (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) - (originalPrefix.series.data.coloring oldi.castSucc)) - (oldGamma : Fin k), - originalPrefix.series.data.stored oldi.succ = - (insert oldChoice.color ({ oldGamma } : Finset (Fin k)) : Finset (Fin k)) → - originalPrefix.series.data.connectingEdges oldi.succ = - ({ oldChoice.edge } : Finset E) → - earlierPrefix = oldi.succ → - oldi.succ = earlierPrefix → - ∀ (newGamma : Fin k) - (newChoicePE : - MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) - (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) - (corr.replacementSeries.data.coloring oldi.castSucc)) - (hbaseTree : - corr.replacementSeries.data.tree oldi.succ.castSucc = - originalPrefix.series.data.tree oldi.succ.castSucc), - ( - ∀ {A B : TreeSequence G e0} (hAB : A = B) (C : Finset (Fin k)) - (phi : PartialEdgeColoring E k) (ch : MaximumDefectiveChoice G e0 A C phi), - (@Eq.rec (@TreeSequence V E G e0) A - (fun (x : @TreeSequence V E G e0) (h : @Eq (@TreeSequence V E G e0) A x) ↦ - @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) - ch B hAB).edge = - ch.edge ∧ - (@Eq.rec (@TreeSequence V E G e0) A - (fun (x : @TreeSequence V E G e0) (h : @Eq (@TreeSequence V E G e0) A x) ↦ - @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) - ch B hAB).vertex = - ch.vertex ∧ - (@Eq.rec (@TreeSequence V E G e0) A - (fun (x : @TreeSequence V E G e0) (h : @Eq (@TreeSequence V E G e0) A x) ↦ - @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) - ch B hAB).otherEndpoint = - ch.otherEndpoint ∧ - (@Eq.rec (@TreeSequence V E G e0) A - (fun (x : @TreeSequence V E G e0) (h : @Eq (@TreeSequence V E G e0) A x) ↦ - @MaximumDefectiveChoice V E inst inst_1 G k e0 x C phi) - ch B hAB).color = - ch.color) → - ( - ∀ (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) - (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) - (second : PartialEdgeColoring E k), - IsProperEdgeColoring G second → - StableColoring X (insert ch.color C : Finset (Fin k)) ch.selected second → - g ∈ MissingColors G ch.selected ch.vertex → - let post : PartialEdgeColoring E k := - TwoColorComponentSwap G second g ch.color (Sum.inl ch.vertex); - ch.color ∈ MissingColors G post ch.vertex ∧ - g ∉ MissingColors G post ch.vertex ∧ g ≠ ch.color) → - oldChoice.color ∈ - MissingColors G (originalPrefix.series.data.coloring oldi.succ) - oldChoice.vertex → - oldGamma ∉ - MissingColors G (originalPrefix.series.data.coloring oldi.succ) - oldChoice.vertex → - oldChoice.color = available.delta → - oldGamma = available.gamma → - available.returnVertex ∈ - TreeSequenceVertexSet - (originalPrefix.series.data.tree earlierPrefix.castSucc) → - let originalReturnGraph : SimpleGraph (V ⊕ E) := - TwoColorIncidenceGraph G (ett.series.data.coloring q.castSucc) - available.gamma available.delta; - ∀ - (returnEdgeTransfer : - ∀ edge ∈ available.returnPath.edges, edge ∈ originalReturnGraph.edgeSet), - let originalReturnPath : - originalReturnGraph.Walk (Sum.inr available.edge) - (Sum.inl available.returnVertex) := - available.returnPath.transfer originalReturnGraph returnEdgeTransfer; - originalReturnPath.IsPath → - ( - ∀ (z : V ⊕ E), - z ∈ originalReturnPath.support ↔ z ∈ available.returnPath.support) → - Sum.inl available.returnVertex ∈ - TwoColorComponent G (ett.series.data.coloring q.castSucc) - available.gamma available.delta (Sum.inr available.edge) → - Sum.inl available.outsideEndpoint ∈ - TwoColorComponent G (ett.series.data.coloring q.castSucc) - available.gamma available.delta (Sum.inr available.edge) → - ∀ (horiginalRoundsLess : originalPrefix.rounds < ett.rounds) - (originalCycle : - TwoColorCycle G (ett.series.data.coloring q.castSucc) available.gamma - available.delta), - ( - ∀ (x : V ⊕ E), - x ∈ originalCycle.walk.support ↔ - x ∈ - TwoColorComponent G (ett.series.data.coloring q.castSucc) - available.gamma available.delta (Sum.inr available.edge)) → - let oldEarlier : Fin (ett.rounds + (1 : ℕ)) := - Fin.castLE - (by - have := GoldbergSeymour.TreeSequence.positive T - omega) - earlierPrefix; - ett.series.data.kind oldEarlier = some TashkinovExtensionKind.PE → - ∀ (fulli : Fin ett.rounds) - (fullChoice : - MaximumDefectiveChoice G e0 - (ett.series.data.tree fulli.succ.castSucc) - (TashkinovStoredColors ett.series.data fulli.castSucc) - (ett.series.data.coloring fulli.castSucc)) - (fullGamma : Fin k), - ParallelExtensionColor ett.series.data fulli.castSucc - fullChoice.selected fullChoice.vertex fullGamma → - ∀ (fullSecond : PartialEdgeColoring E k), - IsProperEdgeColoring G fullSecond → - StableColoring (ett.series.data.tree fulli.succ.castSucc) - (insert fullChoice.color - (TashkinovStoredColors ett.series.data fulli.castSucc) : - Finset (Fin k)) - fullChoice.selected fullSecond → - ett.series.data.coloring fulli.succ = - TwoColorComponentSwap G fullSecond fullGamma fullChoice.color - (Sum.inl fullChoice.vertex) → - ett.series.data.stored fulli.succ = - (insert fullChoice.color ({ fullGamma } : Finset (Fin k)) : - Finset (Fin k)) → - ett.series.data.connectingEdges fulli.succ = - ({ fullChoice.edge } : Finset E) → - ett.series.data.delta fulli.succ = some fullChoice.color → - ett.series.data.gamma fulli.succ = some fullGamma → - oldEarlier = fulli.succ → - False - private abbrev helperHoriginalPathInQ1511Conditions.{u_1, u_2} : Prop := open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] @@ -3402,148 +3177,6 @@ private theorem helper_peRootOnly_167.{u_1, u_2} : rw [htree] exact hw -private theorem helper_reStepColoring_872.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ - Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < - ett.rounds) (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree - G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), - originalPrefix.rounds = ett.rounds - (1 : ℕ) → - ∀ (corr : - CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree - (Fin.last ett.rounds).castSucc)) (_ : RevisitingExtensionCertificate - corr.replacementSeries.data (Fin.last originalPrefix.rounds)) (oldi : Fin - originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree - oldi.succ.castSucc) (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) - (originalPrefix.series.data.coloring oldi.castSucc)) (_ _ : Fin k) (_ : - MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) - (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) - (corr.replacementSeries.data.coloring oldi.castSucc)), - corr.replacementSeries.data.tree - oldi.succ.castSucc = originalPrefix.series.data.tree oldi.succ.castSucc → - ∀ {rounds' : ℕ} - {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 input') (j : - Fin rounds'), - series.data.kind j.succ = some TashkinovExtensionKind.RE → - series.data.coloring j.succ = series.data.coloring j.castSucc := by - classical - intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr - available oldi oldChoice oldGamma newGamma newChoicePE hbaseTree rounds' input' series j hj - have hstep := series.certified j.succ - generalize hslot : j.succ = slot at hstep - cases hstep with - | initial triple seedLength initialColoring initialStored - initialEdges initialKind initialVertex initialOutside - initialDelta initialGamma initialClosure => - exact (Fin.succ_ne_zero j hslot).elim - | SE i prevProper prevOne prevClosed prevNotStrong noRE - ch alternative coloring stored edges kind vertex - outside delta gamma adjoined adjoinedExactly closed - ordered strict => - have hbad := kind.symm.trans - (by simpa [hslot] using hj) - cases hbad - | PE i prevProper prevOne prevClosed prevNotStrong noRE - ch alternativeFails gamma gammaRule second - secondProper secondOne secondStable exit coloring - coloringProper coloringOne stored edges kind vertex - outside delta gammaValue closed ordered strict => - have hbad := kind.symm.trans - (by simpa [hslot] using hj) - cases hbad - | RE i prevProper prevOne prevClosed prevNotStrong cert - coloring stored edges kind vertex outside delta gamma - adjoined adjoinedExactly closed ordered strict => - have hi : i = j := by - apply Fin.ext - have hv := congrArg Fin.val hslot - simp only [Fin.val_succ] at hv - omega - subst i - simpa [hslot] using coloring - -private theorem helper_reIntervalColoring_913.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ - Fintype E] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : - PartialEdgeColoring E k) (T : TreeSequence G e0) (generating : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T generating) (hroundLarge : (1 : ℕ) < - ett.rounds) (sigmaPrev : PartialEdgeColoring E k) (originalPrefix : ExtendedTashkinovTree - G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), by omega⟩ : Fin ett.rounds).castSucc)), - originalPrefix.rounds = ett.rounds - (1 : ℕ) → - ∀ (corr : - CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev (ett.series.data.tree - (Fin.last ett.rounds).castSucc)) (_ : RevisitingExtensionCertificate - corr.replacementSeries.data (Fin.last originalPrefix.rounds)) (oldi : Fin - originalPrefix.rounds) (_ : MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree - oldi.succ.castSucc) (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) - (originalPrefix.series.data.coloring oldi.castSucc)) (_ _ : Fin k) (_ : - MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree oldi.succ.castSucc) - (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) - (corr.replacementSeries.data.coloring oldi.castSucc)), - corr.replacementSeries.data.tree - oldi.succ.castSucc = originalPrefix.series.data.tree oldi.succ.castSucc → - ( - ∀ {rounds' : ℕ} - {input' : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 input') (j : - Fin rounds'), - series.data.kind j.succ = some TashkinovExtensionKind.RE → - series.data.coloring j.succ = series.data.coloring j.castSucc) → - ∀ {rounds' : ℕ} {input' : - PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 input') (a b : Fin - (rounds' + (1 : ℕ))), - (↑a : ℕ) ≤ (↑b : ℕ) → - ( - ∀ (j : Fin (rounds' + (1 : ℕ))), - (↑a : ℕ) < - (↑j : ℕ) → - (↑j : ℕ) ≤ (↑b : ℕ) → - series.data.kind j = some TashkinovExtensionKind.RE) → - series.data.coloring b = series.data.coloring a := by - classical - intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr - available oldi oldChoice oldGamma newGamma newChoicePE hbaseTree reStepColoring rounds' - input' series a b hab hbetween - have coloringAlong : ∀ m : ℕ, a.val ≤ m → - m ≤ b.val → ∀ x : Fin (rounds' + 1), - x.val = m → - series.data.coloring x = series.data.coloring a := by - intro m ham - induction m, ham using Nat.le_induction with - | base => - intro hmb x hx - have hxa : x = a := by - apply Fin.ext - omega - rw [hxa] - | succ m ham ih => - intro hmb x hx - let j : Fin rounds' := ⟨m, by - have hbLt := b.isLt - omega⟩ - have hjKind : series.data.kind j.succ = - some TashkinovExtensionKind.RE := by - apply hbetween j.succ - · simp [j] - omega - · simp [j] - omega - have hstep := reStepColoring series j hjKind - have hxj : x = j.succ := by - apply Fin.ext - simp [j, hx] - calc - series.data.coloring x = - series.data.coloring j.succ := by rw [hxj] - _ = series.data.coloring j.castSucc := hstep - _ = series.data.coloring a := - ih (by omega) j.castSucc (by simp [j]) - exact coloringAlong b.val hab le_rfl b rfl - private theorem helper_stepSegment_1041.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ @@ -4223,37 +3856,6 @@ private theorem helper_branch_1721.{u_1, u_2} : (@htreePrefixFull) (@hprefColorCast) (@hfullEdgePairs) (@hfullColorPairs) (@hfullDeltaMissing) (@hfullGammaNotMissing) (@hmissingPrefixFull) (@hprefDeltaForFull) (@hprefGammaForFull) -private theorem helper_segmentTrans_1816.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 - : E) (A B C : TreeSequence G e0), - TreeSequenceInitialSegment A B → - TreeSequenceInitialSegment B C → - TreeSequenceInitialSegment A C := by - classical - intro V E G e0 A B C hAB hBC - rcases hAB with ⟨hlenAB, hvertexAB, hedgeAB⟩ - rcases hBC with ⟨hlenBC, hvertexBC, hedgeBC⟩ - refine ⟨hlenAB.trans hlenBC, ?_, ?_⟩ - · intro x - calc - C.vertex (Fin.castLE - (Nat.succ_le_succ (hlenAB.trans hlenBC)) x) = - C.vertex (Fin.castLE (Nat.succ_le_succ hlenBC) - (Fin.castLE (Nat.succ_le_succ hlenAB) x)) := by - congr 1 - _ = B.vertex - (Fin.castLE (Nat.succ_le_succ hlenAB) x) := - hvertexBC _ - _ = A.vertex x := hvertexAB x - · intro x - calc - C.edge (Fin.castLE (hlenAB.trans hlenBC) x) = - C.edge (Fin.castLE hlenBC - (Fin.castLE hlenAB x)) := by congr 1 - _ = B.edge (Fin.castLE hlenAB x) := hedgeBC _ - _ = A.edge x := hedgeAB x - private theorem helper_replacementReturnEdgeData_1963.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ @@ -4594,26 +4196,6 @@ private theorem helper_hedgeSecond_2373.{u_1, u_2} : (Finset.mem_insert_self _ _), ch.edgeColor⟩).trans ch.edgeColor -private theorem helper_hne_2379.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) - (X : TreeSequence G e0) (C : Finset (Fin k)) (phi : PartialEdgeColoring E k) - (ch : MaximumDefectiveChoice G e0 X C phi) (g : Fin k) (second : PartialEdgeColoring E k), - g ∈ MissingColors G second ch.vertex → - second ch.edge = some ch.color → - g ≠ ch.color := by - classical - intro V E _ _ G k e0 X C phi ch g second hgSecond hedgeSecond heq - have hpresent : g ∈ PresentColors G second ch.vertex := by - simp only [PresentColors, Finset.mem_filter, - Finset.mem_univ, true_and] - exact ⟨ch.edge, ch.edgeIncident, - by simpa [heq] using hedgeSecond⟩ - have hnotPresent : g ∉ PresentColors G second ch.vertex := by - simpa [MissingColors] using hgSecond - exact hnotPresent hpresent - private theorem helper_hreplacementColorConstant_2536.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] @@ -4685,66 +4267,6 @@ private theorem helper_hreplacementColorConstant_2536.{u_1, u_2} : omega · exact hjUpper -private theorem helper_hbaseColorConstant_2550.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) - (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T generating) - (hroundLarge : (1 : ℕ) < ett.rounds) (sigmaPrev : PartialEdgeColoring E k) - (originalPrefix : - ExtendedTashkinovTree G k e0 input (ett.series.data.tree (Fin.last ett.rounds).castSucc) - (ett.series.data.coloring - (⟨ett.rounds - (1 : ℕ), by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin ett.rounds).castSucc)), - originalPrefix.rounds = ett.rounds - (1 : ℕ) → - ∀ - (corr : - CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev - (ett.series.data.tree (Fin.last ett.rounds).castSucc)), - let replacementLast : Fin (originalPrefix.rounds + (1 : ℕ)) := Fin.last - originalPrefix.rounds; - ∀ (available : RevisitingExtensionCertificate corr.replacementSeries.data - replacementLast), - let earlierPrefix : Fin (originalPrefix.rounds + (1 : ℕ)) := available.earlier; - (0 : ℕ) < (↑earlierPrefix : ℕ) → - ∀ (oldi : Fin originalPrefix.rounds) - (_ : - MaximumDefectiveChoice G e0 (originalPrefix.series.data.tree oldi.succ.castSucc) - (TashkinovStoredColors originalPrefix.series.data oldi.castSucc) - (originalPrefix.series.data.coloring oldi.castSucc)) - (_ : Fin k), - earlierPrefix = oldi.succ → - oldi.succ = earlierPrefix → - ∀ (_ : Fin k) - (_ : - MaximumDefectiveChoice G e0 (corr.replacementSeries.data.tree - oldi.succ.castSucc) - (TashkinovStoredColors corr.replacementSeries.data oldi.castSucc) - (corr.replacementSeries.data.coloring oldi.castSucc)), - corr.replacementSeries.data.tree oldi.succ.castSucc = - originalPrefix.series.data.tree oldi.succ.castSucc → - ( - ∀ {rounds' : ℕ} {input' : PartialEdgeColoring E k} (series : - TashkinovSeries G k rounds' e0 input') - (a b : Fin (rounds' + (1 : ℕ))), - (↑a : ℕ) ≤ (↑b : ℕ) → - ( - ∀ (j : Fin (rounds' + (1 : ℕ))), - (↑a : ℕ) < (↑j : ℕ) → - (↑j : ℕ) ≤ (↑b : ℕ) → - series.data.kind j = some - TashkinovExtensionKind.RE) → - series.data.coloring b = series.data.coloring a) → - originalPrefix.series.data.coloring replacementLast = - originalPrefix.series.data.coloring oldi.succ := by - classical - intro V E _ _ _ G k e0 input T generating ett hroundLarge sigmaPrev originalPrefix hr corr - replacementLast available earlierPrefix hearlierPositive oldi oldChoice oldGamma - hbaseTarget holdIndex newGamma newChoicePE hbaseTree reIntervalColoring - apply helper_hbaseColorConstant_1908 <;> assumption private theorem helper_hnewDeltaSigmaPrev_2577.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] @@ -5303,31 +4825,6 @@ private theorem helper_branch_3071.{u_1, u_2} : have hbad := fullCurrentKind.symm.trans hk cases hbad -private theorem helper_branch_3084.{u_1, u_2} : - helperBranch3084Conditions.{u_1, u_2} := by - classical - intro V E _ _ _ G k e0 input T generating ett hroundLarge q sigmaPrev originalPrefix hr - hprefixTrees hprefixData corr noRevisiting replacementLast hlastMap hreplacementCurrentTree - available earlierPrefix oldi oldChoice oldGamma oldCurrentStored oldCurrentEdges - hbaseTarget holdIndex newGamma newChoicePE hbaseTree transportChoiceFields pePostStatus - holdDeltaMissing holdGammaNotMissing holdDeltaAvailable holdGammaAvailable - hreturnInOldEarlier originalReturnGraph returnEdgeTransfer originalReturnPath - horiginalReturnIsPath horiginalReturnSupport hreturnInQ houtsideInQ horiginalRoundsLess - originalCycle hcycleFull oldEarlier hfullEarlierKind fulli fullChoice fullGamma - fullGammaRule fullSecond fullSecondProper fullSecondStable fullCurrentColoring - fullCurrentStored fullCurrentEdges fullCurrentDelta fullCurrentGamma hfullTarget - exact helper_branch_1721 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) - (@sigmaPrev) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) (@noRevisiting) - (@hlastMap) (@hreplacementCurrentTree) (@available) (@oldi) (@oldChoice) (@oldGamma) - (@oldCurrentStored) (@oldCurrentEdges) (@hbaseTarget) (@holdIndex) (@newGamma) - (@newChoicePE) (@hbaseTree) (@transportChoiceFields) (@pePostStatus) (@holdDeltaMissing) - (@holdGammaNotMissing) (@holdDeltaAvailable) (@holdGammaAvailable) (@hreturnInOldEarlier) - (@returnEdgeTransfer) (@horiginalReturnIsPath) (@horiginalReturnSupport) (@hreturnInQ) - (@houtsideInQ) (@horiginalRoundsLess) (@originalCycle) (@hcycleFull) (@hfullEarlierKind) - (@fulli) (@fullChoice) (@fullGamma) (@fullGammaRule) (@fullSecond) (@fullSecondProper) - (@fullSecondStable) (@fullCurrentColoring) (@fullCurrentStored) (@fullCurrentEdges) - (@fullCurrentDelta) (@fullCurrentGamma) (@hfullTarget) - private theorem helper_pePostStatus_3432.{u_1, u_2} : helperPePostStatus3432Conditions.{u_1, u_2} := by classical @@ -5339,7 +4836,7 @@ private theorem helper_pePostStatus_3432.{u_1, u_2} : have hedgeSecond : second ch.edge = some ch.color := by apply helper_hedgeSecond_2373; assumption have hne : g ≠ ch.color := by - apply helper_hne_2379 <;> assumption + apply SharedFacts.RevisitingTerminalPreparation.hne <;> assumption have hedgeComponent : Sum.inr ch.edge ∈ TwoColorComponent G second g ch.color (Sum.inl ch.vertex) := by @@ -5529,7 +5026,8 @@ private theorem helper_continuation_4070.{u_1, u_2} : fullCurrentOutside fullCurrentDelta fullCurrentGamma fullClosedExtension fullOrderedExtension fullStrictExtension => - exact helper_branch_3084 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) + exact GoldbergSeymour.helper_branch_1721 (@G) (@k) (@e0) (@input) (@T) (@generating) + (@ett) (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@hprefixTrees) (@hprefixData) (@corr) (@noRevisiting) (@hlastMap) (@hreplacementCurrentTree) (@available) (@oldi) (@oldChoice) (@oldGamma) (@oldCurrentStored) (@oldCurrentEdges) (@hbaseTarget) @@ -6103,26 +5601,22 @@ private theorem positivePrefixColorIdentification.{u_1, u_2} : have hnewOtherOld : newChoicePE.otherEndpoint = oldChoice.otherEndpoint := hidentifiedOther.trans holdOtherCast - have reStepColoring := - @helper_reStepColoring_872 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) (@sigmaPrev) - (@originalPrefix) (@hr) (@corr) (@available) (@oldi) (@oldChoice) (@oldGamma) (@newGamma) - (@newChoicePE) (@hbaseTree) - have reIntervalColoring := - @helper_reIntervalColoring_913 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) (@sigmaPrev) - (@originalPrefix) (@hr) (@corr) (@available) (@oldi) (@oldChoice) (@oldGamma) (@newGamma) - (@newChoicePE) (@hbaseTree) (@reStepColoring) + have reStepColoring := @TashkinovSeries.revisitingStepColoring V E inferInstance inferInstance + inferInstance G k e0 + have reIntervalColoring := @TashkinovSeries.revisitingIntervalColoring V E inferInstance + inferInstance + inferInstance G k e0 have hreplacementColorConstant := helper_hreplacementColorConstant_2536 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) (@hearlierPositive) (@oldi) (@oldChoice) (@oldGamma) (@hbaseTarget) (@newGamma) (@newChoicePE) (@hnewIndex) (@hbaseTree) (@reIntervalColoring) have hbaseColorConstant := - helper_hbaseColorConstant_2550 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) - (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) - (@hearlierPositive) (@oldi) (@oldChoice) (@oldGamma) (@hbaseTarget) (@holdIndex) - (@newGamma) (@newChoicePE) (@hbaseTree) (@reIntervalColoring) + (@GoldbergSeymour.helper_hbaseColorConstant_1908 _ _ inferInstance inferInstance inferInstance + (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) (@sigmaPrev) + (@originalPrefix) (@hr) (@corr) (@available) (@hearlierPositive) (@oldi) (@oldChoice) + (@newGamma) (@hbaseTarget) (@holdIndex) (@newGamma) (@newChoicePE) (@hbaseTree) + (@reIntervalColoring)) have hnewPostSigmaPrev : corr.replacementSeries.data.coloring oldi.succ = sigmaPrev := @@ -6166,8 +5660,10 @@ private theorem positivePrefixColorIdentification.{u_1, u_2} : helper_stepSegment_1041 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) (@oldi) (@oldChoice) (@oldGamma) (@newGamma) (@newChoicePE) (@hbaseTree) - have segmentTrans := - @helper_segmentTrans_1816 (@V) (@E) (@G) (@e0) + have segmentTrans (first second third : TreeSequence G e0) + (firstSecond : TreeSequenceInitialSegment first second) + (secondThird : TreeSequenceInitialSegment second third) : + TreeSequenceInitialSegment first third := firstSecond.trans secondThird have treeToFinal := helper_treeToFinal_1111 (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hroundLarge) (@sigmaPrev) (@originalPrefix) (@hr) (@corr) (@available) (@oldi) (@oldChoice) diff --git a/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean b/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean index 81bc4b3a0e..31b309d92f 100644 --- a/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean +++ b/LeanPool/GoldbergSeymour/RevisitingTerminalPreparation.lean @@ -6,6 +6,8 @@ Authors: Wesley Pegden module +public import LeanPool.GoldbergSeymour.TashkinovSeriesColoringProperties + public import LeanPool.GoldbergSeymour.SharedFacts.RevisitingTerminalPreparation public import LeanPool.GoldbergSeymour.TwoColorNontrivialPathComponent @@ -1048,32 +1050,7 @@ theorem helper_reStepColoring_588.{u_1, u_2} : intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q adjoined available adjoinedExactly hroundLarge originalPrefix hr corr oldi oldChoice oldGamma newi newChoice newGamma htree rounds' input' series j hj - have hstep := series.certified j.succ - generalize hslot : j.succ = slot at hstep - cases hstep with - | initial triple seedLength initialColoring initialStored initialEdges initialKind initialVertex - initialOutside initialDelta initialGamma initialClosure => exact (Fin.succ_ne_zero j hslot).elim - | SE i prevProper prevOne prevClosed prevNotStrong noRE choice alternative coloring stored edges - kind vertex outside delta gamma adjoined adjoinedExactly closed ordered - strict => - have hbad := kind.symm.trans (by simpa [hslot] using hj) - cases hbad - | PE i prevProper prevOne prevClosed prevNotStrong noRE choice alternativeFails gamma gammaRule - second secondProper secondOne secondStable exit coloring coloringProper coloringOne stored edges - kind vertex outside delta gammaValue closed ordered - strict => - have hbad := kind.symm.trans (by simpa [hslot] using hj) - cases hbad - | RE i prevProper prevOne prevClosed prevNotStrong cert coloring stored edges kind vertex outside - delta gamma adjoined adjoinedExactly closed ordered - strict => - have hi : i = j := by - apply Fin.ext - have hv := congrArg Fin.val hslot - simp only [Fin.val_succ] at hv - omega - subst i - simpa [hslot] using coloring + exact series.revisitingStepColoring j hj theorem helper_reIntervalColoring_625.{u_1, u_2} : open scoped Classical in @@ -1110,38 +1087,7 @@ theorem helper_reIntervalColoring_625.{u_1, u_2} : intro V E _ _ _ G k e0 input T generating ett hpositive sigma _ q available hroundLarge originalPrefix hr corr oldi oldChoice oldGamma newi newChoice newGamma htree reStepColoring rounds' input' series a b hab hbetween - have coloringAlong : - ∀ m : ℕ, a.val ≤ m → m ≤ b.val → - ∀ x : Fin (rounds' + 1), x.val = m → series.data.coloring x = series.data.coloring a := by - intro m ham - induction m, ham using Nat.le_induction with - | base => - intro hmb x hx - have hxa : x = a := by - apply Fin.ext - omega - rw [hxa] - | succ m ham ih => - intro hmb x hx - let j : Fin rounds' := - ⟨m, by - have hbLt := b.isLt - omega⟩ - have hjKind : series.data.kind j.succ = some TashkinovExtensionKind.RE := by - apply hbetween j.succ - · simp [j] - omega - · simp [j] - omega - have hstep := reStepColoring series j hjKind - have hxj : x = j.succ := by - apply Fin.ext - simp [j, hx] - calc - series.data.coloring x = series.data.coloring j.succ := by rw [hxj] - _ = series.data.coloring j.castSucc := hstep - _ = series.data.coloring a := ih (by omega) j.castSucc (by simp [j]) - exact coloringAlong b.val hab le_rfl b rfl + exact series.revisitingIntervalColoring a b hab hbetween theorem helper_holdColorConstant_669.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean b/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean index 9ab87578a1..9673704f50 100644 --- a/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean +++ b/LeanPool/GoldbergSeymour/ScheideHeightFiveGammaEdges.lean @@ -2291,222 +2291,6 @@ private theorem helper_f2_eq_f3_2262.{u_1, u_2} : (@hne) exact crossing_contra hz2cases hz3cases -private theorem helper_hgamma_alpha_2298.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (_ : - ScheideGraphHeight G = (5 : ℕ)) (gamma : Fin k) (g : E) (v : V) (_ : phi g = some gamma), - let y0 : V := T.vertex (⟨(0 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y1 : V := T.vertex (⟨(1 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y2 : V := T.vertex (⟨(2 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y3 : V := T.vertex (⟨(3 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y4 : V := T.vertex (⟨(4 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let r1 : Fin T.length := (⟨(1 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(1 : ℕ) < T.length) ↦ - by - omega - ⟩ : Fin T.length); - let r2 : Fin T.length := (⟨(2 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(2 : ℕ) < T.length) ↦ - by - omega - ⟩ : Fin T.length); - let r3 : Fin T.length := (⟨(3 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(3 : ℕ) < T.length) ↦ - by - omega - ⟩ : Fin T.length); - let a1 : E := T.edge r1; - let a2 : E := T.edge r2; - let a3 : E := T.edge r3; - let q : E := N.closingEdge; - ∀ (_ : y0 ≠ y1) (_ : y0 ≠ y2) (_ : y0 ≠ y3) (_ : y0 ≠ y4) (_ : y1 ≠ y2) (_ : y1 ≠ y3) (_ : y1 - ≠ y4) (_ : y2 ≠ y3) (_ : y2 ≠ y4) (_ : y3 ≠ y4) (_ : G.ends a1 = s(y1, y2)) (_ : G.ends a2 - = s(y2, y3)) (_ : G.ends a3 = s(y3, y4)) (_ : phi a1 = some N.alpha) (_ : a1 ≠ a2) (_ : - phi a2 = some N.beta) (_ : a2 ≠ a3) (_ : phi a3 = some N.alpha) (_ : v ≠ y0) (_ : v ≠ y1) - (_ : v ≠ y2) (_ : v ≠ y3) (_ : v ≠ y4) (_ : G.ends g = s(y0, v) ∨ G.ends g = s(y1, v) ∨ - G.ends g = s(y2, v) ∨ G.ends g = s(y3, v) ∨ G.ends g = s(y4, v)) (p1 : - (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), - Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), - Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (_ : p1.IsPath) (_ : (4 : ℕ) ∣ - p1.length) (_ : p1.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G), - let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); - ∀ (_ : Sum.inl y0 ∈ C1) (_ : - ∀ {z : V ⊕ E} (_ : z ∈ C1), z ∈ p1.support) (_ : - ∀ {x : V} {f : E} (_ : Sum.inl x ∈ C1) (_ : Incident G x f) (_ : phi f = some gamma ∨ phi f = - some N.beta), Sum.inr f ∈ C1) (_ : - ∀ {f : E} {x : V} (_ : Sum.inr f ∈ C1) (_ : Incident G x f) (_ : phi f = some gamma ∨ phi f = - some N.beta), Sum.inl x ∈ C1) (_ : Sum.inr q ∈ C1) (_ : Sum.inl y4 ∈ C1) (_ : Sum.inl y1 ∈ - C1) (_ : q ≠ a1) (_ : q ≠ a2) (_ : q ≠ a3) (_ : a1 ≠ a3), gamma ≠ N.alpha := by - classical - intro V E _ _ _ G k e0 phi T N hNheight hGheight gamma g v hgcolor y0 y1 y2 y3 y4 r1 r2 r3 a1 - a2 a3 q hy01 hy02 hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 ha1ends ha2ends ha3ends ha1color - ha12ne ha2color ha23ne ha3color hv0' hv1' hv2' hv3' hv4' hgends' p1 hp1 hp1div hp1bound C1 - hC1root support_of_C1 edge_step_C1 vertex_step_C1 hqC1 hy4C1 hy1C1 hqa1 hqa2 hqa3 ha13ne - exact @helper_hgamma_alpha_425 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@g) (@v) (@hgcolor) - (@hy01) (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) - (@ha1ends) (@ha2ends) (@ha3ends) (@ha1color) (@ha12ne) (@ha2color) (@ha23ne) - (@ha3color) (@hv0') (@hv1') (@hv2') (@hv3') (@hv4') (@hgends') (@p1) (@hp1) (@hp1div) - (@hp1bound) (@hC1root) (@support_of_C1) (@edge_step_C1) (@vertex_step_C1) (@hqC1) - (@hy4C1) (@hy1C1) (@hqa1) (@hqa2) (@hqa3) (@ha13ne) - -private theorem helper_middle_too_large_2342.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (_ : - ScheideGraphHeight G = (5 : ℕ)) (gamma : Fin k) (r : E) (w : V) (_ : phi r = some gamma), - let y0 : V := T.vertex (⟨(0 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y1 : V := T.vertex (⟨(1 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y2 : V := T.vertex (⟨(2 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y3 : V := T.vertex (⟨(3 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y4 : V := T.vertex (⟨(4 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let r2 : Fin T.length := (⟨(2 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(2 : ℕ) < T.length) ↦ - by - omega - ⟩ : Fin T.length); - let a2 : E := T.edge r2; - let q : E := N.closingEdge; - ∀ (_ : y0 ≠ y1) (_ : y0 ≠ y2) (_ : y0 ≠ y3) (_ : y0 ≠ y4) (_ : y1 ≠ y2) (_ : y1 ≠ y3) (_ : y1 - ≠ y4) (_ : y2 ≠ y3) (_ : y2 ≠ y4) (_ : y3 ≠ y4) (_ : phi a2 = some N.beta) (p1 : - (TwoColorIncidenceGraph G phi gamma N.beta).Walk (Sum.inl (T.vertex (⟨(0 : ℕ), - Nat.zero_lt_succ T.length⟩ : Fin (T.length + (1 : ℕ))))) (Sum.inl (T.vertex (⟨(1 : ℕ), - Nat.succ_lt_succ T.positive⟩ : Fin (T.length + (1 : ℕ)))))) (_ : p1.IsPath) (_ : (4 : ℕ) ∣ - p1.length) (_ : p1.length / (2 : ℕ) + (1 : ℕ) ≤ ScheideGraphHeight G), - let C1 : Set (V ⊕ E) := TwoColorComponent G phi gamma N.beta (Sum.inl y0); - ∀ (_ : Sum.inl y0 ∈ C1) (_ : - ∀ {z : V ⊕ E} (_ : z ∈ C1), z ∈ p1.support) (_ : - ∀ {x : V} {f : E} (_ : Sum.inl x ∈ C1) (_ : Incident G x f) (_ : phi f = some gamma ∨ phi f = - some N.beta), Sum.inr f ∈ C1) (_ : Sum.inr q ∈ C1) (_ : Sum.inl y4 ∈ C1) (_ : Sum.inl y1 ∈ - C1) (b : E) (_ : Sum.inr b ∈ C1) (_ : q ≠ a2) (_ : w ≠ y0) (_ : w ≠ y1) (_ : w ≠ y2) (_ : - w ≠ y3) (_ : w ≠ y4) (_ : Incident G y2 a2) (_ : Incident G y2 r ∨ Incident G y3 r) (_ : b - ≠ q) (_ : b ≠ a2) (_ : r ≠ q) (_ : r ≠ a2) (_ : b ≠ r) (_ : Sum.inl y2 ∈ C1) (_ : Sum.inl - y3 ∈ C1) (_ : Sum.inl w ∈ C1), False := by - classical - intro V E _ _ _ G k e0 phi T N hNheight hGheight gamma r w hrcolor y0 y1 y2 y3 y4 r2 a2 q hy01 - hy02 hy03 hy04 hy12 hy13 hy14 hy23 hy24 hy34 ha2color p1 hp1 hp1div hp1bound C1 hC1root - support_of_C1 edge_step_C1 hqC1 hy4C1 hy1C1 b hbC1 hqa2 hw0 hw1 hw2 hw3 hw4 ha2inc2 - hrmiddle hbq hba2 hrq hra2 hbr hy2C hy3C hwC - exact @helper_middle_too_large_561 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@r) (@w) (@hrcolor) - (@hy01) (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) - (@ha2color) (@p1) (@hp1) (@hp1div) (@hp1bound) (@hC1root) (@support_of_C1) - (@edge_step_C1) (@hqC1) (@hy4C1) (@hy1C1) (@b) (@hbC1) (@hqa2) (@hw0) (@hw1) (@hw2) - (@hw3) (@hw4) (@ha2inc2) (@hrmiddle) (@hbq) (@hba2) (@hrq) (@hra2) (@hbr) (@hy2C) - (@hy3C) (@hwC) - -private theorem helper_f2_eq_f3_2563.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : TreeSequence - G e0) (N : NormalGlobalMaximumTriple G k e0 phi T) (hNheight : N.height = (5 : ℕ)) (gamma - : Fin k) (g : E) (v : V) (_ : phi g = some gamma), - let y0 : V := T.vertex (⟨(0 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(0 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y1 : V := T.vertex (⟨(1 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(1 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y2 : V := T.vertex (⟨(2 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(2 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y3 : V := T.vertex (⟨(3 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(3 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - let y4 : V := T.vertex (⟨(4 : ℕ), - have this : N.height ≤ T.length + (1 : ℕ) := N.height_upper; Decidable.byContradiction fun (a - : ¬(4 : ℕ) < T.length + (1 : ℕ)) ↦ - by - omega - ⟩ : Fin (T.length + (1 : ℕ))); - ∀ (_ : gamma ∈ MissingColors G phi y0) (f2 : E) (_ : Incident G y2 f2) (_ : phi f2 = some - gamma) (f3 : E) (_ : Incident G y3 f3) (_ : phi f3 = some gamma) (z2 : V) (_ : G.ends f2 = - s(y2, z2)) (z3 : V) (_ : G.ends f3 = s(y3, z3)) (_ : z2 = y0 ∨ z2 = y1 ∨ z2 = y2 ∨ z2 = y3 - ∨ z2 = y4) (_ : z3 = y0 ∨ z3 = y1 ∨ z3 = y2 ∨ z3 = y3 ∨ z3 = y4) (_ : IsProperEdgeColoring - G phi) (_ : - ∀ {x : V} {f : E} (_ : gamma ∈ MissingColors G phi x) (_ : Incident G x f), phi f ≠ some - gamma) (_ : z2 ≠ y2) (_ : z3 ≠ y3) (_ : z2 ≠ y0) (_ : z3 ≠ y0) (_ : G.ends g = s(y0, v) ∨ - G.ends g = s(y1, v) ∨ G.ends g = s(y2, v) ∨ G.ends g = s(y3, v) ∨ G.ends g = s(y4, v)) (_ - : v ≠ y1) (_ : v ≠ y2) (_ : v ≠ y3) (_ : v ≠ y4) (_ : Incident G v g), f2 = f3 := by - classical - intro V E _ _ _ G k e0 phi T N hNheight gamma g v hgcolor y0 y1 y2 y3 y4 hgamma0 f2 hf2inc - hf2color f3 hf3inc hf3color z2 hf2ends z3 hf3ends hz2trunk hz3trunk hproper - missing_excludes hz22 hz33 hz20 hz30 hgends' hv1' hv2' hv3' hv4' hgvinc - exact @helper_f2_eq_f3_2262 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@g) (@v) (@hgcolor) (@hgamma0) (@f2) - (@hf2inc) (@hf2color) (@f3) (@hf3inc) (@hf3color) (@z2) (@hf2ends) (@z3) (@hf3ends) - (@hz2trunk) (@hz3trunk) (@hproper) (@missing_excludes) (@hz22) (@hz33) (@hz20) (@hz30) - (@hgends') (@hv1') (@hv2') (@hv3') (@hv4') (@hgvinc) - private theorem helper_continuation_2789.{u_1, u_2} : helperContinuation2789Conditions.{u_1, u_2} := by classical @@ -2540,7 +2324,7 @@ private theorem helper_continuation_2789.{u_1, u_2} : have hgvinc : Incident G v g := by rcases hgends' with h | h | h | h | h <;> unfold Incident <;> rw [h] <;> simp - have f2_eq_f3 := @helper_f2_eq_f3_2563 (@V) (@E) inferInstance inferInstance inferInstance (@G) + have f2_eq_f3 := @helper_f2_eq_f3_2262 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@gamma) (@g) (@v) (@hgcolor) (@hgamma0) (@f2) (@hf2inc) (@hf2color) (@f3) (@hf3inc) (@hf3color) (@z2) (@hf2ends) (@z3) (@hf3ends) (@hz2trunk) (@hz3trunk) (@hproper) (@missing_excludes) (@hz22) (@hz33) (@hz20) (@hz30) @@ -2797,7 +2581,7 @@ private theorem helper_caseContinuation_3777.{u_1, u_2} : intro h exact (show r1 ≠ r3 by simp [r1, r3]) (T.edge_injective (by simpa [a1, a3] using h)) - have hgamma_alpha := @helper_hgamma_alpha_2298 (@V) (@E) inferInstance inferInstance inferInstance + have hgamma_alpha := @helper_hgamma_alpha_425 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@g) (@v) (@hgcolor) (@hy01) (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) (@ha1ends) (@ha2ends) (@ha3ends) (@ha1color) (@ha12ne) (@ha2color) (@ha23ne) (@ha3color) (@hv0') (@hv1') (@hv2') @@ -2837,7 +2621,7 @@ private theorem helper_caseContinuation_3777.{u_1, u_2} : exact hgamma_beta (Option.some.inj hrcolor.symm) have hbr := @helper_hbr_549 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@r) (@w) (@hy12) (@hy13) (@b) (@hbinc) (@hrends') (@hw1) - have middle_too_large := @helper_middle_too_large_2342 (@V) (@E) inferInstance inferInstance + have middle_too_large := @helper_middle_too_large_561 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@hNheight) (@hGheight) (@gamma) (@r) (@w) (@hrcolor) (@hy01) (@hy02) (@hy03) (@hy04) (@hy12) (@hy13) (@hy14) (@hy23) (@hy24) (@hy34) (@ha2color) (@p1) (@hp1) (@hp1div) (@hp1bound) (@hC1root) (@support_of_C1) (@edge_step_C1) diff --git a/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean b/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean index 17b1e880e5..b9c6ff2162 100644 --- a/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean +++ b/LeanPool/GoldbergSeymour/ScheideOrderNineBlockStructure.lean @@ -1263,441 +1263,6 @@ private theorem helper_second_ne_of_matching_4215.{u_1, u_2} : exact (hproper hfc0.symm ⟨S.vertex ⟨pc'.val, by omega⟩, hincc, hincf⟩ (by simpa [hEq] using hc0color')) hfcolor -private theorem helper_hcoverG0_4250.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : - TreeSequence G e0) - (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) (S : - TreeSequence G e) - (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)) (g0 : Fin k), - let y1 : V := - S.vertex - (⟨(1 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y2 : V := - S.vertex - (⟨(2 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y3 : V := - S.vertex - (⟨(3 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y4 : V := - S.vertex - (⟨(4 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y5 : V := - S.vertex - (⟨(5 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y6 : V := - S.vertex - (⟨(6 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y7 : V := - S.vertex - (⟨(7 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let b0 : E := - S.edge - (⟨(4 : ℕ), by - omega⟩ : - Fin S.length); - let b1 : E := - S.edge - (⟨(5 : ℕ), by - omega⟩ : - Fin S.length); - let c0 : E := - S.edge - (⟨(6 : ℕ), by - omega⟩ : - Fin S.length); - ∀ (_ : - ∀ {i j : Fin S.length}, - i ≠ j → - S.edge i ≠ S.edge j) (_ : psi b0 = some g0) - (_ : psi b1 = some g0) - (p0 : - Fin - ((↑(⟨(4 : ℕ), by - omega⟩ : - Fin S.length) : - ℕ) + - (1 : ℕ))) - (_ : - G.ends b0 = - s(y5, - S.vertex - (p0.castLT - (by - omega)))) - (p1 : - Fin - ((↑(⟨(5 : ℕ), by - omega⟩ : - Fin S.length) : - ℕ) + - (1 : ℕ))) - (_ : - G.ends b1 = - s(y6, - S.vertex - (p1.castLT - (by - omega)))) - (f1 f2 f3 : E) (v1 v2 : V) (_ : psi f1 = some g0) (_ : psi f2 = some g0) - (_ : psi f3 = some g0) - (_ : G.ends f1 = s(y1, v1)) (_ : G.ends f2 = s(y4, v2)) (_ : G.ends f3 - = s(y2, y3)) - (_ : b0 = f1 ∧ y5 = v1 ∧ b1 = f2 ∧ y6 = v2 ∨ b0 = f2 ∧ y5 = v2 ∧ b1 = f1 ∧ y6 = v1) - (_ : c0 ≠ f3) - (_ : ¬Incident G y7 f1) (_ : ¬Incident G y7 f2) (_ : ¬Incident G y7 f3) - (_ : ¬Incident G y7 b0) - (_ : ¬Incident G y7 b1) (q : Fin (7 : ℕ)), - q ≠ (0 : Fin (7 : ℕ)) → - ∃ (f : E), - f ≠ c0 ∧ - Incident G - (S.vertex - (⟨(↑q : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ)))) - f ∧ - psi f = some g0 ∧ ¬Incident G y7 f := by - classical - intro V E _ _ _ G k e0 phi T N e psi S M hlen g0 y1 y2 y3 y4 y5 y6 y7 b0 b1 c0 hedge_ne h4' h5' p0 - hb0ends p1 hb1ends f1 f2 f3 v1 v2 hf1color hf2color hf3color hf1ends' hf2ends' hf3ends' - horient hc0_ne_f3 hno_f1 hno_f2 hno_f3 hno_b0 hno_b1 - exact @helper_hcoverG0_732 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by - assumption) (@g0) (by - assumption) (by - assumption) (by - assumption) (@p0) (by - assumption) (@p1) (by - assumption) (@f1) (@f2) (@f3) (@v1) (@v2) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) - -private theorem helper_hcoverAlpha_4274.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : - TreeSequence G e0) - (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) (S : - TreeSequence G e) - (M : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), - let y1 : V := - S.vertex - (⟨(1 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y2 : V := - S.vertex - (⟨(2 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y3 : V := - S.vertex - (⟨(3 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y4 : V := - S.vertex - (⟨(4 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y5 : V := - S.vertex - (⟨(5 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y6 : V := - S.vertex - (⟨(6 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y7 : V := - S.vertex - (⟨(7 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let a1 : E := - S.edge - (⟨(1 : ℕ), by - omega⟩ : - Fin S.length); - let a3 : E := - S.edge - (⟨(3 : ℕ), by - omega⟩ : - Fin S.length); - let c0 : E := - S.edge - (⟨(6 : ℕ), by - omega⟩ : - Fin S.length); - ∀ (_ : - ∀ {i j : Fin S.length}, - i ≠ j → - S.edge i ≠ S.edge j) - (_ : - Fin - ((↑(⟨(4 : ℕ), by - omega⟩ : - Fin S.length) : - ℕ) + - (1 : ℕ))) - (_ : - Fin - ((↑(⟨(5 : ℕ), by - omega⟩ : - Fin S.length) : - ℕ) + - (1 : ℕ))) - (alpha56 : E) (_ : psi alpha56 = some M.alpha) (_ : G.ends alpha56 = - s(y5, y6)) - (_ : G.ends a1 = s(y1, y2)) (_ : G.ends a3 = s(y3, y4)) (_ : psi a1 = - some M.alpha) - (_ : psi a3 = some M.alpha) (_ : c0 ≠ alpha56) (_ : ¬Incident G y7 - a1) - (_ : ¬Incident G y7 a3) (_ : ¬Incident G y7 alpha56) (q : Fin (7 : ℕ)), - q ≠ (0 : Fin (7 : ℕ)) → - ∃ (f : E), - f ≠ c0 ∧ - Incident G - (S.vertex - (⟨(↑q : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ)))) - f ∧ - psi f = some M.alpha ∧ ¬Incident G y7 f := by - classical - intro V E _ _ _ G k e0 phi T N e psi S M hlen y1 y2 y3 y4 y5 y6 y7 a1 a3 c0 hedge_ne p0 p1 alpha56 - halpha56color halpha56ends' ha1ends ha3ends ha1color ha3color hc0_ne_alpha56 hno_a1 hno_a3 - hno_alpha56 - exact @helper_hcoverAlpha_795 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by - assumption) (by - assumption) (@p0) (@p1) (@alpha56) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) - -private theorem helper_hcoverBeta_4291.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : - TreeSequence G e0) - (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) (S : - TreeSequence G e) - (M : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)), - let y0 : V := - S.vertex - (⟨(0 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y2 : V := - S.vertex - (⟨(2 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y3 : V := - S.vertex - (⟨(3 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y4 : V := - S.vertex - (⟨(4 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y5 : V := - S.vertex - (⟨(5 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y6 : V := - S.vertex - (⟨(6 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y7 : V := - S.vertex - (⟨(7 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let a2 : E := - S.edge - (⟨(2 : ℕ), by - omega⟩ : - Fin S.length); - let c0 : E := - S.edge - (⟨(6 : ℕ), by - omega⟩ : - Fin S.length); - ∀ (_ : - ∀ {i j : Fin S.length}, - i ≠ j → - S.edge i ≠ S.edge j) - (_ : - Fin - ((↑(⟨(4 : ℕ), by - omega⟩ : - Fin S.length) : - ℕ) + - (1 : ℕ))) - (_ : - Fin - ((↑(⟨(5 : ℕ), by - omega⟩ : - Fin S.length) : - ℕ) + - (1 : ℕ))) - (beta56 : E) (_ : psi beta56 = some M.beta) (_ : G.ends beta56 = s(y5, - y6)) - (_ : G.ends a2 = s(y2, y3)) (_ : G.ends M.closingEdge = s(y4, y0)) - (_ : psi a2 = some M.beta) (_ : psi M.closingEdge = some M.beta) - (_ : c0 ≠ beta56) - (_ : c0 ≠ M.closingEdge) (_ : ¬Incident G y7 a2) (_ : ¬Incident G - y7 M.closingEdge) - (_ : ¬Incident G y7 beta56) (q : Fin (7 : ℕ)), - q ≠ (1 : Fin (7 : ℕ)) → - ∃ (f : E), - f ≠ c0 ∧ - Incident G - (S.vertex - (⟨(↑q : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ)))) - f ∧ - psi f = some M.beta ∧ ¬Incident G y7 f := by - classical - intro V E _ _ _ G k e0 phi T N e psi S M hlen y0 y2 y3 y4 y5 y6 y7 a2 c0 hedge_ne p0 p1 beta56 - hbeta56color hbeta56ends' ha2ends hclosingEnds ha2color hclosingColor hc0_ne_beta56 - hc0_ne_closing hno_a2 hno_close hno_beta56 - exact @helper_hcoverBeta_834 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (by - assumption) (by - assumption) (@p0) (@p1) (@beta56) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) (by - assumption) - -private theorem helper_last_pair_edge_4317.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] - (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (phi : PartialEdgeColoring E k) (T : - TreeSequence G e0) - (_ : NormalGlobalMaximumTriple G k e0 phi T) {e : E} (psi : PartialEdgeColoring E k) (S : - TreeSequence G e) - (_ : NormalGlobalMaximumTriple G k e psi S) (hlen : S.length = (8 : ℕ)) (_ : - IsProperEdgeColoring G psi) - (_ : ColoredVertexSetElementary G psi (TreeSequenceVertexSet S)) - (_ : ColoredVertexSetClosed G psi (TreeSequenceVertexSet S)), - let y7 : V := - S.vertex - (⟨(7 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let y8 : V := - S.vertex - (⟨(8 : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))); - let c0 : E := - S.edge - (⟨(6 : ℕ), by - omega⟩ : - Fin S.length); - ∀ (_ : - ∀ {i j : Fin (S.length + (1 : ℕ))}, - i ≠ j → - S.vertex i ≠ S.vertex j) - (_ : - ∀ (i : Fin (S.length + (1 : ℕ))), - S.vertex i ∈ TreeSequenceVertexSet S) - (_ : - ∀ {c : Fin k} {v : V} {f : E}, - c ∈ MissingColors G psi v → - Incident G v - f → - psi f ≠ some c) - (_ : - Fin - ((↑(⟨(4 : ℕ), by - omega⟩ : - Fin S.length) : - ℕ) + - (1 : ℕ))) - (_ : - Fin - ((↑(⟨(5 : ℕ), by - omega⟩ : - Fin S.length) : - ℕ) + - (1 : ℕ))) - (c : Fin k) (m : Fin (7 : ℕ)) - (_ : - c ∈ - MissingColors G psi - (S.vertex - (⟨(↑m : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ))))) - (_ : - ∀ (q : Fin (7 : ℕ)), - q ≠ m → - ∃ (f : E), - f ≠ c0 ∧ - Incident G - (S.vertex - (⟨(↑q : ℕ), by - omega⟩ : - Fin (S.length + (1 : ℕ)))) - f ∧ - psi f = some c ∧ ¬Incident G y7 f), - ∃ (f : E), G.ends f = s(y7, y8) ∧ psi f = some c := by - classical - intro V E _ _ _ G k e0 phi T N e psi S M hlen hproper helem hclosed y7 y8 c0 hvertex_ne hmem - missing_excludes p0 p1 c m hcmiss hcover - apply helper_last_pair_edge_881 <;> assumption private theorem helper_continuation_1474.{u_1, u_2} : helperContinuation1474Conditions.{u_1, u_2} := by classical @@ -1762,7 +1327,7 @@ private theorem helper_continuation_1474.{u_1, u_2} : have hcoverG0 : ∀ q : Fin 7, q ≠ (0 : Fin 7) → ∃ f : E, f ≠ c0 ∧ Incident G (S.vertex ⟨q.val, by omega⟩) f ∧ psi f = some g0 ∧ ¬ Incident G y7 f := by - exact @helper_hcoverG0_4250 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) + exact @helper_hcoverG0_732 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (@hlen) (@g0) (@hedge_ne) (@h4') (@h5') (@p0) (@hb0ends) (@p1) (@hb1ends) (@f1) (@f2) (@f3) (@v1) (@v2) (@hf1color) (@hf2color) (@hf3color) (@hf1ends') (@hf2ends') (@hf3ends') (@horient) (@hc0_ne_f3) (@hno_f1) (@hno_f2) @@ -1770,14 +1335,14 @@ private theorem helper_continuation_1474.{u_1, u_2} : have hcoverAlpha : ∀ q : Fin 7, q ≠ (0 : Fin 7) → ∃ f : E, f ≠ c0 ∧ Incident G (S.vertex ⟨q.val, by omega⟩) f ∧ psi f = some M.alpha ∧ ¬ Incident G y7 f := by - exact @helper_hcoverAlpha_4274 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + exact @helper_hcoverAlpha_795 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (@hlen) (@hedge_ne) (@p0) (@p1) (@alpha56) (@halpha56color) (@halpha56ends') (@ha1ends) (@ha3ends) (@ha1color) (@ha3color) (@hc0_ne_alpha56) (@hno_a1) (@hno_a3) (@hno_alpha56) have hcoverBeta : ∀ q : Fin 7, q ≠ (1 : Fin 7) → ∃ f : E, f ≠ c0 ∧ Incident G (S.vertex ⟨q.val, by omega⟩) f ∧ psi f = some M.beta ∧ ¬ Incident G y7 f := by - exact @helper_hcoverBeta_4291 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) + exact @helper_hcoverBeta_834 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@phi) (@T) (@N) (@e) (@psi) (@S) (@M) (@hlen) (@hedge_ne) (@p0) (@p1) (@beta56) (@hbeta56color) (@hbeta56ends') (@ha2ends) (@hclosingEnds) (@ha2color) (@hclosingColor) (@hc0_ne_beta56) (@hc0_ne_closing) (@hno_a2) (@hno_close) (@hno_beta56) @@ -1796,7 +1361,7 @@ private theorem helper_continuation_1474.{u_1, u_2} : ∃ f : E, f ≠ c0 ∧ Incident G (S.vertex ⟨q.val, by omega⟩) f ∧ psi f = some c ∧ ¬ Incident G y7 f) : ∃ f : E, G.ends f = s(y7, y8) ∧ psi f = some c := by - apply helper_last_pair_edge_4317 <;> assumption + apply helper_last_pair_edge_881 <;> assumption obtain ⟨g0last, hg0lastEnds, hg0lastColor⟩ := last_pair_edge g0 (0 : Fin 7) (by simpa [y0] using hg0') hcoverG0 obtain ⟨alphaLast, halphaLastEnds, halphaLastColor⟩ := diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ChangeLemmaBothOutsidePreparation1.lean b/LeanPool/GoldbergSeymour/SharedFacts/ChangeLemmaBothOutsidePreparation1.lean index 3a10e39cc3..f76b527697 100644 --- a/LeanPool/GoldbergSeymour/SharedFacts/ChangeLemmaBothOutsidePreparation1.lean +++ b/LeanPool/GoldbergSeymour/SharedFacts/ChangeLemmaBothOutsidePreparation1.lean @@ -6,6 +6,7 @@ Authors: Wesley Pegden module public import LeanPool.GoldbergSeymour.HierarchyCounterexample +public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset /-! # Shared facts for Preparation1 @@ -85,6 +86,106 @@ theorem missingPositionOutsidePrefix.{u_1, u_2} : missingPositionOutsidePrefixSt simp only [TreeSequenceVertexSet, Finset.mem_image, Finset.mem_univ, true_and] exact ⟨⟨i.val, by omega⟩, (AToT.2.1 ⟨i.val, by omega⟩).symm⟩ +/-- A preparation fact shared by the coloring-change constructions. -/ +theorem lastStarredStageOfPositiveCount.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + H.dividerCount ≠ (0 : ℕ) → + A = + H.stage + (⟨H.dividerCount, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H q A hz + obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q + · have hv := congrArg Fin.val hzero + simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv + exact (hz hv).elim + · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] + congr 1 + apply Fin.ext + have hv := congrArg Fin.val hi + simpa [q] using hv.symm + +/-- A preparation fact shared by the coloring-change constructions. -/ +theorem ordinaryStageInitialSegmentOfTerminal.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), + let H : TashkinovHierarchy ett base := C.hierarchy; + (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), + TreeSequenceInitialSegment + (H.stage + (⟨a, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ)))) + (H.stage + (⟨a + d, by + have := GoldbergSeymour.TreeSequence.positive T + omega⟩ : + Fin (H.dividerCount + (2 : ℕ))))) → + ∀ (j : Fin (H.dividerCount + (2 : ℕ))), + TreeSequenceInitialSegment (H.stage j) T := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C H stageSegment j + have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) + have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : + Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := + Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) + simpa [he, H.terminalStage] using hs + +/-- A preparation fact shared by the coloring-change constructions. -/ +theorem missingColorOutsideStarredPrefix.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (alpha beta : Fin k), + alpha ≠ beta → + let H : TashkinovHierarchy ett base := C.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := T.length - A.length; + let Y : TreeSequence G e0 := + TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) + (have this : (1 : ℕ) ≤ A.length := A.positive; + have this_1 : (1 : ℕ) ≤ T.length := T.positive; + Decidable.byContradiction + fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + have := GoldbergSeymour.TreeSequence.positive A + omega); + ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → + TreeSequenceInitialSegment A Y → + ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), + c ∈ MissingColors G phi (T.vertex i) → + T.vertex i ∈ TreeSequenceVertexSet Y → + T.vertex i ∉ TreeSequenceVertexSet A → + c ∉ TreeMissingColors phi A := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ell Y hElementaryY AToY c + i hmi hiy hia hc + obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc + have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) + exact (Finset.disjoint_left.mp + (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi + end GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaRoutes.lean b/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaRoutes.lean new file mode 100644 index 0000000000..98e45507d6 --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/DisjointThetaRoutes.lean @@ -0,0 +1,326 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchySituationThreeDisjointData +public import LeanPool.GoldbergSeymour.ChangeLemma +public import LeanPool.GoldbergSeymour.HierarchyWeaklyStable +public import LeanPool.GoldbergSeymour.TerminalRoute + +/-! +# Disjoint-theta replacement routes + +The stored and unstored branches use these same replacement and route transport proofs. +Extracted from Wesley Pegden's pinned Trellis formalization during the Lean Pool port. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.DisjointThetaRoutes + +/-- Shared transport fact for the two disjoint-theta proof branches. -/ +theorem terminalRouteToPrefix.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] (G : + LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), HierarchyPathNumber C.hierarchy = j → (2 : ℕ) ≤ j → + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let X : TreeSequence G e0 := HierarchyFullTailPrefix C (j - (1 : ℕ)); + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + TreeSequenceInitialSegment A T → ( + ∀ {U W : TreeSequence G e0}, TreeSequenceInitialSegment U T → TreeSequenceInitialSegment W T → + U.length ≤ W.length → TreeSequenceInitialSegment U W) → Y.length = A.length + j → + TreeSequenceInitialSegment Y T → TreeSequenceInitialSegment X Y → + TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment A Y → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ {input' : PartialEdgeColoring E k} (old new : PartialEdgeColoring E k) (et : + ExtendedTashkinovTree G k e0 input' T old) (bs : HierarchyBase et old) (K : + TashkinovHierarchy et bs), HierarchyWeaklyStable K (Fin.last K.dividerCount) new → + IsOneEdgeUncolored old e0 → IsOneEdgeUncolored new e0 → + ∀ (t : Fin (HierarchyStarredStage K (Fin.last K.dividerCount)).length), new + ((HierarchyStarredStage K (Fin.last K.dividerCount)).edge t) = old ((HierarchyStarredStage + K (Fin.last K.dividerCount)).edge t)) → Y.length = X.length + (1 : ℕ) → + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (nu : + PartialEdgeColoring E k), IsOneEdgeUncolored nu e0 → HierarchyWeaklyStable + S.counterexample.hierarchy (Fin.last S.counterexample.hierarchy.dividerCount) nu → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → nu (T.edge t) = S.coloring + (T.edge t)) → ( + ∀ v ∈ TreeSequenceVertexSet Z, MissingColors G nu v = MissingColors G S.coloring v) → + let et : ExtendedTashkinovTree G k e0 S.corresponding.replacementInput T S.coloring := + S.corresponding.replacementETT; + let n : Fin (et.rounds + (1 : ℕ)) := Fin.last et.rounds; + let Tn : TreeSequence G e0 := et.series.data.tree n.castSucc; et.series.data.kind n = some + TashkinovExtensionKind.PE ∧ TashkinovAugmentationSequence nu Tn Y ∨ (et.series.data.kind n + = some TashkinovExtensionKind.SE ∨ et.series.data.kind n = some TashkinovExtensionKind.RE) + ∧ + ∃ (f : E) (seed : TreeSequence G e0), et.series.data.connectingEdges n = { f } ∧ + TreeSequenceAdjoinEdge Tn f seed ∧ TashkinovAugmentationSequence nu seed Y := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j hj hpathLower R H q A ell + X Y Z hAtoT commonPrefix hYlen hYtoT hXtoY hYtoZ hAtoY sameStarAll weakEdges hXYlen S nu hn + hw hf hm + as_aux_lemma => + have hj : 2 ≤ j := hpathLower + clear * - G k e0 input T phi ett base C ctx S nu hn hw hf hm + A X Y Z hAtoT hYtoT hXtoY hYtoZ hXYlen hAtoY hYlen hj j sameStarAll + commonPrefix weakEdges + clear_value A X Y Z + let et := S.corresponding.replacementETT + let K := S.counterexample.hierarchy + let Tn := et.series.data.tree (Fin.last et.rounds).castSucc + have hTnT : TreeSequenceInitialSegment Tn T := et.abovePenultimate + have hTnA : Tn.length ≤ A.length := by + by_cases hz : K.dividerCount = 0 + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = 0 := Fin.ext hz + have hs := sameStarAll S + change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs + rw [hi] at hs + change S.replacementBase.core = A at hs + by_cases hp : et.series.data.kind (Fin.last et.rounds) = + some TashkinovExtensionKind.PE + · rw [← hs]; exact (Classical.choice (S.replacementBase.parallel hp).2.2).leftSegment.1 + · rw [← hs, S.replacementBase.nonparallel hp] + · have hi : (Fin.last K.dividerCount : Fin (K.dividerCount + 1)) = + (⟨K.dividerCount - 1, by omega⟩ : Fin K.dividerCount).succ := + Fin.ext (by simp only [Fin.val_last, Fin.val_succ]; omega) + have hs := sameStarAll S + change HierarchyStarredStage K (Fin.last K.dividerCount) = A at hs + rw [hi] at hs + have hmono : Monotone (fun i : Fin (K.dividerCount + 2) => (K.stage i).length) := + Fin.monotone_iff_le_succ.mpr (fun i => (K.nested i).1) + rw [← hs] + change Tn.length ≤ (K.stage _).length + rw [show Tn = K.stage 0 from K.baseStage.symm] + exact hmono (Fin.zero_le _) + have hAYstrict : A.length < Y.length := by + clear * - hj hYlen + omega + have fixedA : ∀ t : Fin A.length, nu (A.edge t) = S.coloring (A.edge t) := by + have he := weakEdges S.coloring nu et S.replacementBase K hw + S.minimumContext.oneEdgeUncolored hn + change ∀ t : Fin (HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).length, + nu ((HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) = + S.coloring ((HierarchyStarredStage S.counterexample.hierarchy + (Fin.last S.counterexample.hierarchy.dividerCount)).edge t) at he + rw [sameStarAll S] at he + exact he + have fixedY : ∀ t : Fin Y.length, nu (Y.edge t) = S.coloring (Y.edge t) := by + intro t + let tT : Fin T.length := Fin.castLE hYtoT.1 t + have he : T.edge tT = Y.edge t := hYtoT.2.2 t + by_cases ht : t.val < A.length + · let tA : Fin A.length := ⟨t.val, ht⟩ + have hcast : Fin.castLE hAtoT.1 tA = tT := Fin.ext rfl + rw [← he, ← hcast, hAtoT.2.2 tA] + exact fixedA tA + · rw [← he] + exact hf tT (Nat.le_of_not_gt ht) t.isLt + have transport (W : TreeSequence G e0) + (hr : TashkinovAugmentationSequence S.coloring W Y) : + TashkinovAugmentationSequence nu W Y := + TashkinovAugmentationSequenceColoringTransport S.coloring nu W X Y hr + hXtoY hXYlen (fun t _ => fixedY t) + (fun v hv => hm v (TreeSequenceInitialSegmentVertexSetSubset hYtoZ + (TreeSequenceInitialSegmentVertexSetSubset hXtoY hv))) + rcases P2813_T1_TerminalRoute G k e0 S.corresponding.replacementInput T + S.coloring et with ⟨hp, hr⟩ | ⟨hk, f, seed, he, ha, _, _, hr⟩ + · have hTY : TreeSequenceInitialSegment Tn Y := + commonPrefix hTnT hYtoT (hTnA.trans hAtoY.1) + exact Or.inl ⟨hp, transport Tn + (TashkinovAugmentationSequenceRestrict S.coloring Tn Y T hr hTY hYtoT)⟩ + · have hseedT : TreeSequenceInitialSegment seed T := + TashkinovAugmentationSequenceInitialSegment S.coloring seed T hr + have hseedY : TreeSequenceInitialSegment seed Y := + commonPrefix hseedT hYtoT (by + have hl := ha.1 + change seed.length = Tn.length + 1 at hl + clear * - hl hTnA hAYstrict + omega) + exact Or.inr ⟨hk, f, seed, he, ha, transport seed + (TashkinovAugmentationSequenceRestrict S.coloring seed Y T hr hseedY hYtoT)⟩ + +/-- Shared transport fact for the two disjoint-theta proof branches. -/ +theorem changeReplacementColoring.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta) + (j : ℕ), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + let ell : ℕ := HierarchyFullTailLength C; + let Y : TreeSequence G e0 := HierarchyFullTailPrefix C j; + let Z : TreeSequence G e0 := HierarchyFullTailPrefix C (ell - (1 : ℕ)); + ∀ (gamma : Fin k), (↑(HierarchyFirstMissingPosition sigma T d.theta) : ℕ) = Y.length → gamma ≠ + d.theta → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage S.counterexample.hierarchy (Fin.last + S.counterexample.hierarchy.dividerCount) = A) → ( + ∀ (S : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix S.counterexample (HierarchyFullTailLength S.counterexample - (1 : + ℕ)) = Z) → + ∀ (R1 : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + let rho : PartialEdgeColoring E k := R1.coloring; ColoredVertexSetElementary G rho + (TreeSequenceVertexSet Z) → HierarchyFirstMissingPosition rho T gamma = + HierarchyFirstMissingPosition sigma T gamma → HierarchyFirstMissingPosition rho T d.theta + = HierarchyFirstMissingPosition sigma T d.theta → ( + ∀ (t : Fin T.length), A.length ≤ (↑t : ℕ) → (↑t : ℕ) < Y.length → rho (T.edge t) ≠ some gamma) + → (↑(HierarchyFirstMissingPosition sigma T gamma) : ℕ) < (↑(HierarchyFirstMissingPosition + sigma T d.theta) : ℕ) → gamma ∈ TreeMissingColors rho Z ∧ d.theta ∈ TreeMissingColors rho + Z → + let H : TashkinovHierarchy R1.corresponding.replacementETT R1.replacementBase := + R1.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R1.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R1.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R1.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R1.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition rho T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition rho T d.theta); + have sameComponent : Prop := TwoColorComponent G rho gamma d.theta (Sum.inl va) = + TwoColorComponent G rho gamma d.theta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors rho Tnq ∨ Disjoint { gamma, d.theta } Dnq) → sameComponent) ∧ ( + H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors rho Tn ∨ Disjoint { gamma, d.theta } + Dn) → sameComponent) ∧ ( gamma ∈ TreeMissingColors rho A ∧ TreeColorSetClosed G rho A + { gamma } → sameComponent ∧ TreeInterchangeable G A rho gamma d.theta) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d j R sigma H q A ell Y Z + gamma hthetaFirstIndex hgammaNeTheta sameStarAll samePenultimate R1 rho hElemRho + hfirstGammaRho hfirstThetaRho hgammaUnusedRho hgammaBeforeTheta hpairMissingRho + as_aux_lemma => + exact ChangeLemma G k e0 R1.corresponding.replacementInput T rho + R1.corresponding.replacementETT R1.replacementBase R1.counterexample + R1.minimumContext.proper R1.minimumContext.oneEdgeUncolored R1.minimumContext.lowerRung + R1.minimumContext.fewerDividers R1.minimumContext.lexicographicMinimality + (by change ColoredVertexSetElementary G rho + (TreeSequenceVertexSet (HierarchyFullTailPrefix R1.counterexample + (HierarchyFullTailLength R1.counterexample - 1))) + rw [samePenultimate R1]; exact hElemRho) + R1.minimumContext.largeMissingSet gamma d.theta hgammaNeTheta + (by change gamma ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength R1.counterexample + - 1)) ∧ + d.theta ∈ TreeMissingColors rho + (HierarchyFullTailPrefix R1.counterexample (HierarchyFullTailLength + R1.counterexample - 1)) + rw [samePenultimate R1]; exact hpairMissingRho) + (by + dsimp only + rw [sameStarAll R1, hfirstGammaRho, hfirstThetaRho] + intro _ + refine ⟨⟨_, _, rfl, rfl, hgammaBeforeTheta⟩, ?_⟩ + intro hc + obtain ⟨_, t, hlo, hhi, he⟩ := Finset.mem_filter.mp hc + rw [hthetaFirstIndex] at hhi + exact hgammaUnusedRho t hlo hhi he) + +/-- Shared transport fact for the two disjoint-theta proof branches. -/ +theorem firstReplacementChange.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (P : + HierarchyReplacementPresentation G k e0 input T phi ett base C ctx) (alpha beta : Fin k) + (d : HierarchySituationThreeDisjointData G k e0 input T phi ett base C ctx P alpha beta), + let R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx := d.switched; + let sigma : PartialEdgeColoring E k := R.coloring; + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + let A : TreeSequence G e0 := HierarchyStarredStage H q; + ∀ (gamma : Fin k), gamma ≠ beta → HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount) = A → ( gamma ∉ TreeMissingColors sigma A ∨ beta ∉ + TreeMissingColors sigma A → TreeVertexOrder T (T.vertex (HierarchyFirstMissingPosition + sigma T gamma)) (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ gamma ∉ ({c : + Fin k | + ∃ (t : Fin T.length), A.length ≤ (↑t : ℕ) ∧ (↑t : ℕ) < (↑(HierarchyFirstMissingPosition sigma + T beta) : ℕ) ∧ sigma (T.edge t) = some c} : Finset (Fin k))) → ColoredVertexSetElementary + G sigma (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)))) → gamma ∈ TreeMissingColors sigma + (HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ))) ∧ beta ∈ TreeMissingColors sigma (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ))) → + let H : TashkinovHierarchy R.corresponding.replacementETT R.replacementBase := + R.counterexample.hierarchy; + have q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; + have n : Fin (R.corresponding.replacementETT.rounds + (1 : ℕ)) := Fin.last + R.corresponding.replacementETT.rounds; + have A : TreeSequence G e0 := HierarchyStarredStage H q; + have Tnq : TreeSequence G e0 := H.stage (⟨H.dividerCount, + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ⟩ : Fin (H.dividerCount + (2 : ℕ))); + have Tn : TreeSequence G e0 := R.corresponding.replacementETT.series.data.tree n.castSucc; + have Dn : Finset (Fin k) := TashkinovStoredColors R.corresponding.replacementETT.series.data + n; + have Dnq : Finset (Fin k) := HierarchyStoredColorsAt H q; + have va : V := T.vertex (HierarchyFirstMissingPosition sigma T gamma); + have vb : V := T.vertex (HierarchyFirstMissingPosition sigma T beta); + have sameComponent : Prop := TwoColorComponent G sigma gamma beta (Sum.inl va) = + TwoColorComponent G sigma gamma beta (Sum.inl vb); ( (0 : ℕ) < H.dividerCount ∧ (gamma ∈ + TreeMissingColors sigma Tnq ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset + (Fin k)) Dnq) → sameComponent) ∧ ( H.dividerCount = (0 : ℕ) ∧ (gamma ∈ TreeMissingColors + sigma Tn ∨ Disjoint (insert gamma ({ beta } : Finset (Fin k)) : Finset (Fin k)) Dn) → + sameComponent) ∧ ( gamma ∈ TreeMissingColors sigma A ∧ TreeColorSetClosed G sigma A + ({ gamma } : Finset (Fin k)) → sameComponent ∧ TreeInterchangeable G A sigma gamma beta) + := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx P alpha beta d R sigma H q A gamma + hgammaNeBeta sameStar horderedUnusedGammaBeta hchangeElementary hchangeMissing + as_aux_lemma => + exact ChangeLemma G k e0 R.corresponding.replacementInput T sigma + R.corresponding.replacementETT R.replacementBase R.counterexample + R.minimumContext.proper R.minimumContext.oneEdgeUncolored + R.minimumContext.lowerRung R.minimumContext.fewerDividers + R.minimumContext.lexicographicMinimality hchangeElementary + R.minimumContext.largeMissingSet gamma beta hgammaNeBeta hchangeMissing + (by + change (gamma ∉ TreeMissingColors sigma A ∨ beta ∉ TreeMissingColors sigma A) → + TreeVertexOrder T + (T.vertex (HierarchyFirstMissingPosition sigma T gamma)) + (T.vertex (HierarchyFirstMissingPosition sigma T beta)) ∧ + gamma ∉ (Finset.univ.filter fun c => + ∃ t : Fin T.length, A.length ≤ t.val ∧ + t.val < (HierarchyFirstMissingPosition sigma T beta).val ∧ + sigma (T.edge t) = some c) + exact horderedUnusedGammaBeta) + +end GoldbergSeymour.SharedFacts.DisjointThetaRoutes + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/LargestClosedTransport.lean b/LeanPool/GoldbergSeymour/SharedFacts/LargestClosedTransport.lean deleted file mode 100644 index ac5261cfd4..0000000000 --- a/LeanPool/GoldbergSeymour/SharedFacts/LargestClosedTransport.lean +++ /dev/null @@ -1,174 +0,0 @@ -/- -Copyright (c) 2026 Wesley Pegden. All rights reserved. -Released under Apache 2.0 license as described in the file LICENSE. -Authors: Wesley Pegden --/ -module - -public import LeanPool.GoldbergSeymour.CorrespondingExtendedTashkinovTree -public import LeanPool.GoldbergSeymour.HierarchyCounterexample - -/-! -# Shared facts for ChangeLemmaMixedLargestClosed - -These interfaces and proofs are shared across the imported proof branches. -Extracted from Wesley Pegden’s Trellis formalization at -88d98c1d1a59d1f1bf7c4eb58e73f3945f6daf12 during the Lean Pool port. --/ - -@[expose] public section - -namespace GoldbergSeymour.SharedFacts.LargestClosedTransport - -/-- Shared dependent data used by more than one proof branch. -/ -abbrev storedEq7501Conditions.{u_1, u_2} : Prop := - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] - [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) - (input : PartialEdgeColoring E k) (T : TreeSequence G e0) (phi : PartialEdgeColoring E k) - (ett : ExtendedTashkinovTree G k e0 input T phi) (base : HierarchyBase ett phi) - (C : HierarchyCounterexample base) (alpha beta : Fin k) - (r : Fin (C.hierarchy.dividerCount + (1 : ℕ))), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let n : Fin (ett.rounds + (1 : ℕ)) := Fin.last ett.rounds; - let Dn : Finset (Fin k) := TashkinovStoredColors ett.series.data n; - let ib : Fin (T.length + (1 : ℕ)) := HierarchyFirstMissingPosition phi T beta; - let vb : V := T.vertex ib; - ∀ (hAib : A.length < (↑ib : ℕ)), - let B : TreeSequence G e0 := TreeSequencePrefix T (↑ib : ℕ) (by omega) (by omega); - ∀ (rpB : (1 : ℕ) ≤ ett.rounds) - (aboveB : - TreeSequenceInitialSegment - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))) B) - (strictB : - (ett.series.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + (2 : ℕ)))).length < - B.length) - (belowB : - TreeSequenceInitialSegment B (ett.series.data.tree (Fin.last (ett.rounds + (1 : ℕ))))) - (genB : phi = ett.series.data.coloring (Fin.last ett.rounds)) - (baseB : - HierarchyBase - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - phi), - let ettB : ExtendedTashkinovTree G k e0 input B phi := - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }; - let sigma : PartialEdgeColoring E k := TwoColorComponentSwap G phi alpha beta (Sum.inl vb); - ∀ - (treeMissingEq : - ∀ (S : TreeSequence G e0), - TreeSequenceVertexSet S ⊆ TreeSequenceVertexSet A → - TreeMissingColors sigma S = TreeMissingColors phi S) - (corr : CorrespondingExtendedTashkinovTree G k e0 ettB sigma B) - (baseS : HierarchyBase corr.replacementETT sigma) - (storedS : - TashkinovStoredColors corr.replacementETT.series.data (Fin.last corr.replacementETT.rounds) = - Dn) - (count : ℕ) (stages : Fin (count + (2 : ℕ)) → TreeSequence G e0) - (hbbase : - stages (0 : Fin (count + (2 : ℕ))) = - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi }.series.data.tree - (Fin.last - { rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : - ExtendedTashkinovTree G k e0 input B phi }.rounds).castSucc) - (hbterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hbnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hbstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (positions : Fin count → Fin (B.length + (1 : ℕ))) - (hbpositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positions i) : ℕ)) - (hbincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positions i) : ℕ) < (↑(positions j) : ℕ)) - (hbdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positions i) : ℕ) (hbpositive i) - (Nat.le_of_lt_succ (positions i).isLt)) - (hbcore : - TreeSequenceInitialSegment baseB.core (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))) - (starBToA : - ∀ - (j : - Fin - ({ dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB }.dividerCount + - (1 : ℕ))), - TreeSequenceInitialSegment - (HierarchyStarredStage - { - dividerCount := count, stage := stages, baseStage := hbbase, - terminalStage := hbterminal, nested := hbnested, strict := hbstrict, - dividerPosition := positions, dividerPositive := hbpositive, - dividerIncreasing := hbincreasing, dividerStage := hbdivider, coreInsideFirst := hbcore : - TashkinovHierarchy - { - rounds := ett.rounds, roundsPositive := rpB, series := ett.series, - abovePenultimate := aboveB, strictAbovePenultimate := strictB, belowFinal := belowB, - generatingColoring := genB : ExtendedTashkinovTree G k e0 input B phi } - baseB } - j) - A) - (positionsS : Fin count → Fin (B.length + (1 : ℕ))) - (hspositive : ∀ (i : Fin count), (1 : ℕ) ≤ (↑(positionsS i) : ℕ)) - (hsincreasing : - ∀ (i j : Fin count), (↑i : ℕ) < (↑j : ℕ) → (↑(positionsS i) : ℕ) < (↑(positionsS j) : ℕ)) - (hsbase : - stages (0 : Fin (count + (2 : ℕ))) = - corr.replacementETT.series.data.tree (Fin.last corr.replacementETT.rounds).castSucc) - (hsterminal : stages (Fin.last (count + (1 : ℕ))) = B) - (hsnested : - ∀ (j : Fin (count + (1 : ℕ))), - TreeSequenceInitialSegment (stages j.castSucc) (stages j.succ)) - (hsstrict : - ∀ (j : Fin (count + (1 : ℕ))), (stages j.castSucc).length < (stages j.succ).length) - (hsdivider : - ∀ (i : Fin count), - stages (⟨(↑i : ℕ) + (1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))) = - TreeSequencePrefix B (↑(positionsS i) : ℕ) (hspositive i) - (Nat.le_of_lt_succ (positionsS i).isLt)) - (hscore : - TreeSequenceInitialSegment baseS.core - (stages (⟨(1 : ℕ), by omega⟩ : Fin (count + (2 : ℕ))))), - let HB : TashkinovHierarchy ettB baseB := - { - dividerCount := count, stage := stages, baseStage := hbbase, terminalStage := hbterminal, - nested := hbnested, strict := hbstrict, dividerPosition := positions, - dividerPositive := hbpositive, dividerIncreasing := hbincreasing, dividerStage := hbdivider, - coreInsideFirst := hbcore : TashkinovHierarchy ettB baseB }; - let HS : TashkinovHierarchy corr.replacementETT baseS := - { - dividerCount := count, stage := stages, baseStage := hsbase, terminalStage := hsterminal, - nested := hsnested, strict := hsstrict, dividerPosition := positionsS, - dividerPositive := hspositive, dividerIncreasing := hsincreasing, dividerStage := hsdivider, - coreInsideFirst := hscore : TashkinovHierarchy corr.replacementETT baseS }; - ∀ - (starEq : - ∀ (j : Fin (count + (1 : ℕ))), HierarchyStarredStage HS j = HierarchyStarredStage HB j) - (j : Fin (count + (1 : ℕ))), - HierarchyStoredColorsAt HS j = HierarchyStoredColorsAt HB j - -end GoldbergSeymour.SharedFacts.LargestClosedTransport - -end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation2.lean b/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation2.lean index cda55c024b..6b0a69bb2a 100644 --- a/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation2.lean +++ b/LeanPool/GoldbergSeymour/SharedFacts/MixedChangeTransport/Preparation2.lean @@ -5,10 +5,11 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 + public import LeanPool.GoldbergSeymour.SharedFacts.MixedChangeTransport.Preparation1 public import LeanPool.GoldbergSeymour.HierarchyPathNumber public import LeanPool.GoldbergSeymour.TashkinovAugmentationSequenceInitialSegment -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegmentVertexSetSubset /-! # Shared facts for ChangeLemmaMixedClosedFinal @@ -266,25 +267,13 @@ abbrev pathLengthUpperBoundStatement.{u_1, u_2} : Prop := HierarchyStarredStage HS (Fin.last count) = A → HierarchyPathNumber HS ≤ HierarchyPathNumber H -/-- A common proof used by the branches of this transport or construction argument. -/ -theorem initialSegmentTransitive.{u_1, u_2} : initialSegmentTransitiveStatement.{u_1, u_2} := by - classical - intro V E G e0 S U W hSU hUW - refine ⟨le_trans hSU.1 hUW.1, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hSU.1) i)).trans (hSU.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hSU.1 i)).trans (hSU.2.2 i) /-- A common proof used by the branches of this transport or construction argument. -/ -theorem comparableInitialSegments.{u_1, u_2} : comparableInitialSegmentsStatement.{u_1, u_2} := by - classical - intro V E G e0 S U W hSW hUW hlen - refine ⟨hlen, ?_, ?_⟩ - · intro i - exact (hUW.2.1 (Fin.castLE (Nat.succ_le_succ hlen) i)).symm.trans (hSW.2.1 i) - · intro i - exact (hUW.2.2 (Fin.castLE hlen i)).symm.trans (hSW.2.2 i) +alias initialSegmentTransitive := + SharedFacts.ChangeLemmaBothOutsidePreparation1.initialSegmentTransitive + +alias comparableInitialSegments := + SharedFacts.ChangeLemmaBothOutsidePreparation1.comparableInitialSegments /-- A common proof used by the branches of this transport or construction argument. -/ theorem stageInitialSegment.{u_1, u_2} : stageInitialSegmentStatement.{u_1, u_2} := by diff --git a/LeanPool/GoldbergSeymour/SharedFacts/ReplacementPrefixes.lean b/LeanPool/GoldbergSeymour/SharedFacts/ReplacementPrefixes.lean new file mode 100644 index 0000000000..a6d5c3c71f --- /dev/null +++ b/LeanPool/GoldbergSeymour/SharedFacts/ReplacementPrefixes.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 Wesley Pegden. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Wesley Pegden +-/ +module + +public import LeanPool.GoldbergSeymour.HierarchyReplacementPresentation +public import LeanPool.GoldbergSeymour.HierarchyCounterexamplePenultimateElementary +public import LeanPool.GoldbergSeymour.HierarchyFullTailLength +public import LeanPool.GoldbergSeymour.HierarchyFullTailPrefix + +/-! +# Replacement penultimate prefixes + +Shared prefix-identification and elementarity facts extracted from the pinned Trellis proofs. +-/ + +@[expose] public section + +namespace GoldbergSeymour.SharedFacts.ReplacementPrefixes + +/-- A replacement-prefix fact shared by the advancement and nonempty-tail arguments. -/ +theorem penultimatePrefixEquality.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq V] [ DecidableEq E] (G + : LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : + TreeSequence G e0) (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 + input T phi) (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) (ctx : + HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ), + let A : TreeSequence G e0 := HierarchyStarredStage C.hierarchy (Fin.last + C.hierarchy.dividerCount); ( + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyStarredStage R.counterexample.hierarchy (Fin.last + R.counterexample.hierarchy.dividerCount) = A) → (3 : ℕ) ≤ T.length - A.length → + ∀ (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := TreeSequencePrefix T (T.length - (1 : ℕ)) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ) ( + by + have := GoldbergSeymour.TreeSequence.positive T + omega + ); + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample (HierarchyFullTailLength R.counterexample - (1 : + ℕ)) = B := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx i A starEq htail hlen B R + have hn : min ((HierarchyStarredStage R.counterexample.hierarchy + (Fin.last R.counterexample.hierarchy.dividerCount)).length + + (HierarchyFullTailLength R.counterexample - 1)) T.length = T.length - 1 := by + unfold HierarchyFullTailLength + dsimp only + rw [starEq R] + omega + simp only [HierarchyFullTailPrefix, hn] + rfl + +/-- A replacement-prefix fact shared by the advancement and nonempty-tail arguments. -/ +theorem penultimatePrefixElementary.{u_1, u_2} : + open scoped Classical in + ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] + [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) + (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) + (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) + (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) + (ctx : HierarchyMinimumCounterexampleContext G k e0 input T phi ett base C) (_ : ℕ) + (hlen : (4 : ℕ) ≤ T.length), + let B : TreeSequence G e0 := + TreeSequencePrefix T (T.length - (1 : ℕ)) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega) + (by + have := GoldbergSeymour.TreeSequence.positive T + omega); + (∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - (1 : ℕ)) = + B) → + ∀ (R : HierarchyReplacementPresentation G k e0 input T phi ett base C ctx), + ColoredVertexSetElementary G R.coloring (TreeSequenceVertexSet B) := by + classical + intro V E _ _ _ _ G k e0 input T phi ett base C ctx i hlen B fullB R + have h : ColoredVertexSetElementary G R.coloring + (TreeSequenceVertexSet (HierarchyFullTailPrefix R.counterexample + (HierarchyFullTailLength R.counterexample - 1))) := by + exact HierarchyCounterexamplePenultimateElementary G k e0 + R.corresponding.replacementInput T R.coloring R.corresponding.replacementETT + R.replacementBase R.counterexample R.minimumContext.proper + R.minimumContext.oneEdgeUncolored R.minimumContext.lowerRung + R.minimumContext.fewerDividers R.minimumContext.lexicographicMinimality + R.minimumContext.largeMissingSet + intro u hu v hv hne + exact h (by rw [fullB R]; exact hu) (by rw [fullB R]; exact hv) hne + +end GoldbergSeymour.SharedFacts.ReplacementPrefixes + +end diff --git a/LeanPool/GoldbergSeymour/SharedFacts/SubcaseThreeOnePreparation1.lean b/LeanPool/GoldbergSeymour/SharedFacts/SubcaseThreeOnePreparation1.lean index 24ecaaead3..050fcc73f1 100644 --- a/LeanPool/GoldbergSeymour/SharedFacts/SubcaseThreeOnePreparation1.lean +++ b/LeanPool/GoldbergSeymour/SharedFacts/SubcaseThreeOnePreparation1.lean @@ -5,12 +5,8 @@ Authors: Wesley Pegden -/ module -public import LeanPool.GoldbergSeymour.HierarchyFirstMissingPosition -public import LeanPool.GoldbergSeymour.TreeMissingColors -public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment -public import Mathlib.Combinatorics.SimpleGraph.Init -public import Mathlib.Data.Fintype.EquivFin -public import Mathlib.Tactic.Bound.Init +public import LeanPool.GoldbergSeymour.SharedFacts.ShorteningTransport + /-! # Shared facts for Preparation1 @@ -50,6 +46,9 @@ abbrev initialSegmentTransitiveStatement.{u_1, u_2} : Prop := TreeSequenceInitialSegment Y Z → TreeSequenceInitialSegment X Z +alias initialSegmentTransitive := + SharedFacts.ShorteningTransport.trans + /-- A common proof used by the branches of this transport or construction argument. -/ theorem firstMissingPositionUpperBound.{u_1, u_2} : firstMissingPositionUpperBoundStatement.{u_1, u_2} := by @@ -82,15 +81,6 @@ theorem firstMissingPositionWitness.{u_1, u_2} : firstMissingPositionWitnessStat rw [dite_eq_left ⟨i, hm⟩] exact (Finset.mem_filter.mp (Finset.min'_mem _ ⟨i, hm⟩)).2 -/-- A common proof used by the branches of this transport or construction argument. -/ -theorem initialSegmentTransitive.{u_1, u_2} : initialSegmentTransitiveStatement.{u_1, u_2} := by - classical - intro V E G e0 X Y Z hXY hYZ - refine ⟨hXY.1.trans hYZ.1, ?_, ?_⟩ - · intro i - exact (hYZ.2.1 (Fin.castLE (Nat.succ_le_succ hXY.1) i)).trans (hXY.2.1 i) - · intro i - exact (hYZ.2.2 (Fin.castLE hXY.1 i)).trans (hXY.2.2 i) end GoldbergSeymour.SharedFacts.SubcaseThreeOnePreparation1 diff --git a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean index 10cfe8dfe1..bbdb8f2a76 100644 --- a/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean +++ b/LeanPool/GoldbergSeymour/StableChangeCaseThree/Preparation1.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.SharedFacts.StableChangeCasesOneTwoSplitTail + public import LeanPool.GoldbergSeymour.SharedFacts.ChangeLemmaBothOutsidePreparation1 public import LeanPool.GoldbergSeymour.HierarchySplitter @@ -66,6 +68,9 @@ abbrev helperPrefixMaximum1187Conditions.{u_1, u_2} : Prop := ∃ (inputA : PartialEdgeColoring E k) (ettA : ExtendedTashkinovTree G k e0 inputA A sigma), MaximumProperty ettA +alias helper_equalTrees_536 := + SharedFacts.StableChangeCasesOneTwoSplitTail.equalTrees + theorem helper_terminalRoute_392.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] @@ -431,85 +436,12 @@ theorem helper_commonPrefix_520.{u_1, u_2} : SharedFacts.ChangeLemmaBothOutsidePreparation1.comparableInitialSegmentsStatement.{u_1, u_2} := SharedFacts.ChangeLemmaBothOutsidePreparation1.comparableInitialSegments.{u_1, u_2} -theorem helper_equalTrees_536.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} (G : LooplessMultigraph V E) (e0 : E) {S U : TreeSequence G e0}, - TreeSequenceInitialSegment S U → S.length = U.length → S = U := by - classical - intro V E G e0 S U hSU hlen - cases S with - | mk ls ps vs es vis eis fs aas => - cases U with - | mk lu pu vu eu viu eiu fu aau => - simp only at hlen - subst lu - rw [TreeSequence.mk.injEq] - refine ⟨rfl, ?_, ?_⟩ - · apply heq_of_eq - funext i - simpa only [Fin.castLE] using (hSU.2.1 i).symm - · apply heq_of_eq - funext i - simpa only [Fin.castLE] using (hSU.2.2 i).symm -theorem helper_stageToT_552.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - (∀ (a d : ℕ) (hbound : a + d ≤ H.dividerCount + (1 : ℕ)), - TreeSequenceInitialSegment - (H.stage - (⟨a, by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ)))) - (H.stage - (⟨a + d, by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))))) → - ∀ (j : Fin (H.dividerCount + (2 : ℕ))), - TreeSequenceInitialSegment (H.stage j) T := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H stageSegment j - have hs := stageSegment j.val (H.dividerCount + 1 - j.val) (by omega) - have he : (⟨j.val + (H.dividerCount + 1 - j.val), by omega⟩ : - Fin (H.dividerCount + 2)) = Fin.last (H.dividerCount + 1) := - Fin.ext (by simp only [Fin.val_last]; have := j.isLt; omega) - simpa [he, H.terminalStage] using hs +alias helper_stageToT_552 := + SharedFacts.ChangeLemmaBothOutsidePreparation1.ordinaryStageInitialSegmentOfTerminal -theorem helper_lastPositive_561.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base), - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - H.dividerCount ≠ (0 : ℕ) → - A = - H.stage - (⟨H.dividerCount, by - have := GoldbergSeymour.TreeSequence.positive T - omega⟩ : - Fin (H.dividerCount + (2 : ℕ))) := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C H q A hz - obtain hzero | ⟨i, hi⟩ := Fin.eq_zero_or_eq_succ q - · have hv := congrArg Fin.val hzero - simp only [Fin.val_last, Fin.coe_ofNat_eq_mod, Nat.zero_mod, q] at hv - exact (hz hv).elim - · simp only [A, HierarchyStarredStage, hi, Fin.cases_succ] - congr 1 - apply Fin.ext - have hv := congrArg Fin.val hi - simpa [q] using hv.symm +alias helper_lastPositive_561 := + SharedFacts.ChangeLemmaBothOutsidePreparation1.lastStarredStageOfPositiveCount theorem helper_coreToA_572.{u_1, u_2} : open scoped Classical in @@ -710,43 +642,8 @@ theorem helper_outsideIndex_658.{u_1, u_2} : u_2} := SharedFacts.ChangeLemmaBothOutsidePreparation1.missingPositionOutsidePrefix.{u_1, u_2} -theorem helper_missingNotA_674.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] - [ DecidableEq V] [ DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) - (e0 : E) (input : PartialEdgeColoring E k) (T : TreeSequence G e0) - (phi : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k e0 input T phi) - (base : HierarchyBase ett phi) (C : HierarchyCounterexample base) - (alpha beta : Fin k), - alpha ≠ beta → - let H : TashkinovHierarchy ett base := C.hierarchy; - let q : Fin (H.dividerCount + (1 : ℕ)) := Fin.last H.dividerCount; - let A : TreeSequence G e0 := HierarchyStarredStage H q; - let ell : ℕ := T.length - A.length; - let Y : TreeSequence G e0 := - TreeSequencePrefix T (min (A.length + (ell - (1 : ℕ))) T.length) - (have this : (1 : ℕ) ≤ A.length := A.positive; - have this_1 : (1 : ℕ) ≤ T.length := T.positive; - Decidable.byContradiction - fun (a : ¬(1 : ℕ) ≤ min (A.length + (ell - (1 : ℕ))) T.length) ↦ by omega) - (by - have := GoldbergSeymour.TreeSequence.positive T - have := GoldbergSeymour.TreeSequence.positive A - omega); - ColoredVertexSetElementary G phi (TreeSequenceVertexSet Y) → - TreeSequenceInitialSegment A Y → - ∀ (c : Fin k) (i : Fin (T.length + (1 : ℕ))), - c ∈ MissingColors G phi (T.vertex i) → - T.vertex i ∈ TreeSequenceVertexSet Y → - T.vertex i ∉ TreeSequenceVertexSet A → - c ∉ TreeMissingColors phi A := by - classical - intro V E _ _ _ _ G k e0 input T phi ett base C alpha beta hne H q A ell Y hElementaryY AToY c - i hmi hiy hia hc - obtain ⟨v, hv, hcv⟩ := Finset.mem_biUnion.mp hc - have hne : v ≠ T.vertex i := by intro he; exact hia (he ▸ hv) - exact (Finset.disjoint_left.mp - (hElementaryY (TreeSequenceInitialSegmentVertexSetSubset AToY hv) hiy hne)) hcv hmi +alias helper_missingNotA_674 := + SharedFacts.ChangeLemmaBothOutsidePreparation1.missingColorOutsideStarredPrefix theorem helper_hDn_690.{u_1, u_2} : open scoped Classical in diff --git a/LeanPool/GoldbergSeymour/TashkinovSeriesColoringProperties.lean b/LeanPool/GoldbergSeymour/TashkinovSeriesColoringProperties.lean index f0b937bf9e..d2054eaaec 100644 --- a/LeanPool/GoldbergSeymour/TashkinovSeriesColoringProperties.lean +++ b/LeanPool/GoldbergSeymour/TashkinovSeriesColoringProperties.lean @@ -49,6 +49,91 @@ theorem TashkinovSeries.coloringProperties {V E : Type*} IsOneEdgeUncolored (series.data.coloring i) e0 := (series.certified i).coloringProperties +/-- A revisiting extension preserves the preceding stage's coloring. -/ +theorem TashkinovSeries.revisitingStepColoring {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {rounds : ℕ} + {input : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds e0 input) + (j : Fin rounds) (hj : series.data.kind j.succ = some TashkinovExtensionKind.RE) : + series.data.coloring j.succ = series.data.coloring j.castSucc := by + have hstep := series.certified j.succ + generalize hslot : j.succ = slot at hstep + cases hstep with + | initial triple seedLength initialColoring initialStored + initialEdges initialKind initialVertex initialOutside + initialDelta initialGamma initialClosure => + exact (Fin.succ_ne_zero j hslot).elim + | SE i prevProper prevOne prevClosed prevNotStrong noRE + ch alternative coloring stored edges kind vertex + outside delta gamma adjoined adjoinedExactly closed + ordered strict => + have hbad := kind.symm.trans + (by simpa [hslot] using hj) + cases hbad + | PE i prevProper prevOne prevClosed prevNotStrong noRE + ch alternativeFails gamma gammaRule second + secondProper secondOne secondStable exit coloring + coloringProper coloringOne stored edges kind vertex + outside delta gammaValue closed ordered strict => + have hbad := kind.symm.trans + (by simpa [hslot] using hj) + cases hbad + | RE i prevProper prevOne prevClosed prevNotStrong cert + coloring stored edges kind vertex outside delta gamma + adjoined adjoinedExactly closed ordered strict => + have hi : i = j := by + apply Fin.ext + have hv := congrArg Fin.val hslot + simp only [Fin.val_succ] at hv + omega + subst i + simpa [hslot] using coloring + +/-- A block containing only revisiting extensions has constant coloring. -/ +theorem TashkinovSeries.revisitingIntervalColoring {V E : Type*} + [Fintype V] [Fintype E] [DecidableEq E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {rounds' : ℕ} + {input : PartialEdgeColoring E k} (series : TashkinovSeries G k rounds' e0 input) + (a b : Fin (rounds' + 1)) (hab : a.val ≤ b.val) + (hbetween : ∀ j : Fin (rounds' + 1), a.val < j.val → j.val ≤ b.val → + series.data.kind j = some TashkinovExtensionKind.RE) : + series.data.coloring b = series.data.coloring a := by + have coloringAlong : ∀ m : ℕ, a.val ≤ m → + m ≤ b.val → ∀ x : Fin (rounds' + 1), + x.val = m → + series.data.coloring x = series.data.coloring a := by + intro m ham + induction m, ham using Nat.le_induction with + | base => + intro hmb x hx + have hxa : x = a := by + apply Fin.ext + omega + rw [hxa] + | succ m ham ih => + intro hmb x hx + let j : Fin rounds' := ⟨m, by + have hbLt := b.isLt + omega⟩ + have hjKind : series.data.kind j.succ = + some TashkinovExtensionKind.RE := by + apply hbetween j.succ + · simp [j] + omega + · simp [j] + omega + have hstep := series.revisitingStepColoring j hjKind + have hxj : x = j.succ := by + apply Fin.ext + simp [j, hx] + calc + series.data.coloring x = + series.data.coloring j.succ := by rw [hxj] + _ = series.data.coloring j.castSucc := hstep + _ = series.data.coloring a := + ih (by omega) j.castSucc (by simp [j]) + exact coloringAlong b.val hab le_rfl b rfl + end GoldbergSeymour end diff --git a/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean b/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean index a0a4e47c06..83d700fbea 100644 --- a/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean +++ b/LeanPool/GoldbergSeymour/TerminalHierarchyRestore.lean @@ -315,19 +315,6 @@ private theorem helper_segmentOriginal_459.{u_1, u_2} : · rintro ⟨r, hlo, hhi, hcol⟩ exact ⟨r, hlo, hhi, (edgeEq r).trans hcol⟩ -private theorem helper_terminalData_340.{u_1, u_2} : - open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] - [DecidableEq E] (G : LooplessMultigraph V E) (k : ℕ) (e0 : E) (sigma : PartialEdgeColoring - E k) {inp gen : PartialEdgeColoring E k} {U : TreeSequence G e0} (original : - ExtendedTashkinovTree G k e0 inp U gen) (W : TreeSequence G e0) (c : - CorrespondingExtendedTashkinovTree G k e0 original sigma W), - c.replacementETT.series.data.tree (Fin.last c.replacementETT.rounds).castSucc = - original.series.data.tree (Fin.last original.rounds).castSucc ∧ - c.replacementETT.series.data.kind (Fin.last c.replacementETT.rounds) = - original.series.data.kind (Fin.last original.rounds) := by - intro V E _ _ _ G k e0 sigma inp gen U original W c - exact CorrespondingExtendedTashkinovTree.terminalTreeKind G k e0 sigma original W c - private theorem helper_oldMetadata_391.{u_1, u_2} : open scoped Classical in ∀ {V : Type u_1} {E : Type u_2} [Fintype V] [Fintype E] [DecidableEq V] @@ -672,7 +659,8 @@ theorem P2752_T2_TerminalHierarchyRestore {V E : Type*} classical let Bplus := HierarchyFullTailPrefix C (HierarchyFullTailLength C - 1) let H := C.hierarchy - have terminalData := @helper_terminalData_340 V E inferInstance inferInstance inferInstance G k e0 + have terminalData := @GoldbergSeymour.CorrespondingExtendedTashkinovTree.terminalTreeKind V E + inferInstance inferInstance inferInstance G k e0 sigma have commonBase := @helper_commonBase_214 V E inferInstance inferInstance inferInstance inferInstance G k e0 input T phi sigma ett base C corr diff --git a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean index 831b66c23f..5ea5a6e938 100644 --- a/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean +++ b/LeanPool/GoldbergSeymour/TerminalSeriesRebuildTransport.lean @@ -4852,45 +4852,6 @@ theorem helper_branch_11555.{u_1, u_2} : subst b rfl apply helper_continuation_4951 <;> assumption -private theorem helper_hsigmaEdge_6158.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (_ : IsProperEdgeColoring G sigma) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin ett.rounds); - ∀ (_ : StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors - ett.series.data q.succ) (ett.series.data.coloring q.succ) sigma) (gamma : Fin k) - (secondStable : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G secondStable) (choice - : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (_ : ett.series.data.coloring q.succ = TwoColorComponentSwap G secondStable gamma - choice.color (Sum.inl choice.vertex)) (_ : ett.series.data.stored q.succ = (insert - choice.color ({ gamma } : Finset (Fin k)) : Finset (Fin k))) (_ : choice.vertex ∈ - TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc)) (_ : - ∀ w ∈ TreeSequenceVertexSet (ett.series.data.tree q.succ.castSucc), Sum.inl w ∈ - TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) ↔ w = choice.vertex) - (_ : gamma ∈ MissingColors G secondStable choice.vertex) (_ : V) (_ : - ∀ (e : E), Sum.inr e ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl - choice.vertex) → secondStable e = some gamma ∨ secondStable e = some choice.color) (_ : - secondStable choice.edge = some choice.color) (_ : gamma ≠ choice.color) (_ : Sum.inr - choice.edge ∈ TwoColorComponent G secondStable gamma choice.color (Sum.inl choice.vertex)) - (e : E), TreeIncidentEdge (ett.series.data.tree q.succ.castSucc) e → Sum.inr e ∈ - TwoColorComponent G sigma gamma choice.color (Sum.inl choice.vertex) → e = choice.edge := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper Tstar q - hsigmaStableQ gamma secondStable secondStableProper choice currentColoring currentStored - hchoiceVertex hcomponent hmissing u hcompEdge hchoiceSecond hneq hfcomponent - exact @helper_hsigmaEdge_4922 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@Tstar) - (@hsigmaStableQ) (@gamma) (@secondStable) (@secondStableProper) (@choice) - (@currentColoring) (@currentStored) (@hchoiceVertex) (@hcomponent) (@hmissing) (@u) - (@hcompEdge) (@hchoiceSecond) (@hneq) (@hfcomponent) - theorem helper_hsigmaPrevEnlarged_12232.{u_1, u_2} : helperHsigmaPrevEnlarged12232Conditions.{u_1, u_2} := by classical @@ -4943,7 +4904,7 @@ theorem helper_hsigmaPrevEnlarged_12232.{u_1, u_2} : (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@secondStable) (@secondStableProper) (@choice) (@hmissing) (@u) (@path) (@endOnly) (@hpathComponent) (@hcompEdge) (@hchoiceSecond) - have hsigmaEdge := @helper_hsigmaEdge_6158 (@V) (@E) inferInstance inferInstance inferInstance + have hsigmaEdge := @helper_hsigmaEdge_4922 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@Tstar) (@hsigmaStableQ) (@gamma) (@secondStable) (@secondStableProper) (@choice) (@currentColoring) (@currentStored) (@hchoiceVertex) (@hcomponent) (@hmissing) (@u) @@ -5023,460 +4984,6 @@ theorem helper_hsigmaPrevEnlarged_12232.{u_1, u_2} : rw [hsigmaPrevFormula] exact stableSelected -private theorem helper_hprefixFields_6306.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ _ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin ett.rounds); - ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; - ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (_ : ett.rounds = (1 : ℕ)) - (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 - prefixInput), - let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); - ∀ (_ : (0 : ℕ) + (1 : ℕ) = ett.rounds) (i : Fin (ett.rounds + (1 : ℕ))), (↑i : ℕ) < ett.rounds - → zeroPrefix.data.stored zeroLast = ett.series.data.stored i ∧ - zeroPrefix.data.connectingEdges zeroLast = ett.series.data.connectingEdges i ∧ - zeroPrefix.data.kind zeroLast = ett.series.data.kind i := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive Tstar closureTree q gamma choice - sigmaPrev H u p hroundOne prefixInput zeroPrefix zeroLast hroundsEq - exact @helper_hprefixFields_3431 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) - (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundOne) - (@prefixInput) (@zeroPrefix) (@hroundsEq) - -private theorem helper_hpeAlternativeZero_6498.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (closureTree : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin ett.rounds); - ∀ (gamma : Fin k) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring - q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring - q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree - q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k) - (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored - sigmaPrev e0) (hsigmaPrevStableQ : StableColoring (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) - sigmaPrev) (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ - BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree - q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree - q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev), - let newChoice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev := helperNewChoice4049 G k e0 - input T generating ett hpositive previousProper previousOneUncolored choice sigmaPrev - hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew - hsigmaPrevSelf; - ∀ (_ : - ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ - StableColoring (ett.series.data.tree q.succ.castSucc) (insert newChoice.color - (TashkinovStoredColors ett.series.data q.castSucc) : Finset (Fin k)) newChoice.selected - rho ∧ ¬Disjoint (MissingColors G rho newChoice.otherEndpoint) (TreeMissingColors rho - (ett.series.data.tree q.succ.castSucc))) (prefixInput : PartialEdgeColoring E k) - (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput), - let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); - let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset - (Fin k)); - let newEdges : Finset E := ({ choice.edge } : Finset E); - let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; - let newVertex : Option V := some choice.vertex; - let newOutside : Option V := some choice.otherEndpoint; - let newDelta : Option (Fin k) := some choice.color; - let newGamma : Option (Fin k) := some gamma; - let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend - zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta - newGamma; - ∀ (happendTree : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree - q.succ.castSucc) (happendColor : appendedData.coloring zeroLast.castSucc = sigmaPrev) - (happendStored : TashkinovStoredColors appendedData zeroLast.castSucc = - TashkinovStoredColors ett.series.data q.castSucc), - let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) - (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring - zeroLast.castSucc) := helperAppendedChoice4500 G k e0 input T generating ett hpositive - sigma closureTree gamma previousProper previousOneUncolored choice sigmaPrev - hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew - hsigmaPrevSelf prefixInput zeroPrefix happendTree happendColor happendStored; - ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ - StableColoring (appendedData.tree zeroLast.succ.castSucc) (insert appendedChoice.color - (TashkinovStoredColors appendedData zeroLast.castSucc) : Finset (Fin k)) - appendedChoice.selected rho ∧ ¬Disjoint (MissingColors G rho appendedChoice.otherEndpoint) - (TreeMissingColors rho (appendedData.tree zeroLast.succ.castSucc)) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree q gamma previousProper - previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ - hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf newChoice hnewAlternativeFails prefixInput - zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma - appendedData happendTree happendColor happendStored appendedChoice - exact @helper_hpeAlternativeZero_5555 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) - (@closureTree) (@gamma) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) - (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) - (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hnewAlternativeFails) (@prefixInput) (@zeroPrefix) - (@happendTree) (@happendColor) (@happendStored) - -private theorem helper_hpeGammaRuleZero_6513.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (closureTree : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin ett.rounds); - ∀ (gamma : Fin k) (previousProper : IsProperEdgeColoring G (ett.series.data.coloring - q.castSucc)) (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring - q.castSucc) e0) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree - q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k) - (hsigmaPrevProper : IsProperEdgeColoring G sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored - sigmaPrev e0) (hsigmaPrevStableQ : StableColoring (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) - sigmaPrev) (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ - BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree - q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree - q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev) - (_ : gamma ∈ MissingColors G sigmaPrev choice.vertex), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; - ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (prefixInput : PartialEdgeColoring - E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput), - let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); - let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset - (Fin k)); - let newEdges : Finset E := ({ choice.edge } : Finset E); - let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; - let newVertex : Option V := some choice.vertex; - let newOutside : Option V := some choice.otherEndpoint; - let newDelta : Option (Fin k) := some choice.color; - let newGamma : Option (Fin k) := some gamma; - let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend - zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta - newGamma; - ∀ (happendTree : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree - q.succ.castSucc) (happendColor : appendedData.coloring zeroLast.castSucc = sigmaPrev) - (happendStored : TashkinovStoredColors appendedData zeroLast.castSucc = - TashkinovStoredColors ett.series.data q.castSucc), - let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) - (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring - zeroLast.castSucc) := helperAppendedChoice4500 G k e0 input T generating ett hpositive - sigma closureTree gamma previousProper previousOneUncolored choice sigmaPrev - hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew - hsigmaPrevSelf prefixInput zeroPrefix happendTree happendColor happendStored; - ParallelExtensionColor appendedData zeroLast.castSucc appendedChoice.selected - appendedChoice.vertex gamma := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma closureTree q gamma previousProper - previousOneUncolored choice sigmaPrev hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ - hchoiceDefective hchoiceEdgeNew hsigmaPrevSelf hgammaPrevMissing H u p prefixInput zeroPrefix - zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma appendedData - happendTree happendColor happendStored appendedChoice - exact @helper_hpeGammaRuleZero_5579 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) - (@closureTree) (@gamma) (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) - (@hsigmaPrevProper) (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) - (@hchoiceEdgeNew) (@hsigmaPrevSelf) (@hgammaPrevMissing) (@u) (@p) (@prefixInput) - (@zeroPrefix) (@happendTree) (@happendColor) (@happendStored) - -private theorem helper_lastStep_6525.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (closureTree : - TreeSequence G e0) (_ : TreeSequenceInitialSegment (ett.series.data.tree (Fin.last - ett.rounds).castSucc) closureTree), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin ett.rounds); - ∀ (_ : q.succ = Fin.last ett.rounds) (gamma : Fin k) (_ : PartialEdgeColoring E k) - (previousProper : IsProperEdgeColoring G (ett.series.data.coloring q.castSucc)) - (previousOneUncolored : IsOneEdgeUncolored (ett.series.data.coloring q.castSucc) e0) - (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k) (hsigmaPrevProper : IsProperEdgeColoring G - sigmaPrev) (hsigmaPrevOne : IsOneEdgeUncolored sigmaPrev e0) (hsigmaPrevStableQ : - StableColoring (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors - ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc) sigmaPrev) - (hchoiceDefective : DefectiveColor G sigmaPrev (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc)) choice.color) (hchoiceEdgeNew : choice.edge ∈ - BoundaryColorEdges G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree - q.succ.castSucc)) choice.color) (hsigmaPrevSelf : StableColoring (ett.series.data.tree - q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) sigmaPrev sigmaPrev) - (_ : ColoredVertexSetClosed G sigmaPrev (TreeSequenceVertexSet (ett.series.data.tree - q.succ.castSucc))) (_ : ¬ColoredVertexSetStronglyClosed G sigmaPrev (TreeSequenceVertexSet - (ett.series.data.tree q.succ.castSucc))) (_ : sigma = TwoColorComponentSwap G sigmaPrev - gamma choice.color (Sum.inl choice.vertex)) (_ : TreeExit (ett.series.data.tree - q.succ.castSucc) sigmaPrev gamma choice.color choice.vertex) (prefixInput : - PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput) (_ : - TashkinovClosure sigma (ett.series.data.tree (Fin.last ett.rounds).castSucc) closureTree), - let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); - let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset - (Fin k)); - let newEdges : Finset E := ({ choice.edge } : Finset E); - let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; - let newVertex : Option V := some choice.vertex; - let newOutside : Option V := some choice.otherEndpoint; - let newDelta : Option (Fin k) := some choice.color; - let newGamma : Option (Fin k) := some gamma; - let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend - zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta - newGamma; - ∀ (_ : appendedData.tree (Fin.last (2 : ℕ)) = closureTree) (_ : appendedData.coloring - (Fin.last (1 : ℕ)) = sigma) (_ : appendedData.stored (Fin.last (1 : ℕ)) = newStored) (_ : - appendedData.connectingEdges (Fin.last (1 : ℕ)) = newEdges) (_ : appendedData.kind - (Fin.last (1 : ℕ)) = newKind) (_ : appendedData.chosenVertex (Fin.last (1 : ℕ)) = - newVertex) (_ : appendedData.outsideVertex (Fin.last (1 : ℕ)) = newOutside) (_ : - appendedData.delta (Fin.last (1 : ℕ)) = newDelta) (_ : appendedData.gamma (Fin.last (1 : - ℕ)) = newGamma) (happendTree : appendedData.tree zeroLast.succ.castSucc = - ett.series.data.tree q.succ.castSucc) (happendColor : appendedData.coloring - zeroLast.castSucc = sigmaPrev) (happendStored : TashkinovStoredColors appendedData - zeroLast.castSucc = TashkinovStoredColors ett.series.data q.castSucc), - let appendedChoice : MaximumDefectiveChoice G e0 (appendedData.tree zeroLast.succ.castSucc) - (TashkinovStoredColors appendedData zeroLast.castSucc) (appendedData.coloring - zeroLast.castSucc) := helperAppendedChoice4500 G k e0 input T generating ett hpositive - sigma closureTree gamma previousProper previousOneUncolored choice sigmaPrev - hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew - hsigmaPrevSelf prefixInput zeroPrefix happendTree happendColor happendStored; - ∀ (_ : ¬Nonempty (RevisitingExtensionCertificate appendedData zeroLast.castSucc)) (_ : - ∃ (rho : PartialEdgeColoring E k), IsProperEdgeColoring G rho ∧ IsOneEdgeUncolored rho e0 ∧ - StableColoring (appendedData.tree zeroLast.succ.castSucc) (insert appendedChoice.color - (TashkinovStoredColors appendedData zeroLast.castSucc) : Finset (Fin k)) - appendedChoice.selected rho ∧ ¬Disjoint (MissingColors G rho appendedChoice.otherEndpoint) - (TreeMissingColors rho (appendedData.tree zeroLast.succ.castSucc))) (_ : - ParallelExtensionColor appendedData zeroLast.castSucc appendedChoice.selected - appendedChoice.vertex gamma) (_ : (ett.series.data.tree (Fin.last - ett.rounds).castSucc).length < closureTree.length), TashkinovSeriesStep G k (1 : ℕ) e0 - prefixInput appendedData (Fin.last (1 : ℕ)) := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne closureTree - hTnClosure q hqSucc gamma secondStable previousProper previousOneUncolored choice sigmaPrev - hsigmaPrevProper hsigmaPrevOne hsigmaPrevStableQ hchoiceDefective hchoiceEdgeNew - hsigmaPrevSelf hclosedPrev hnotStrongPrev hsigmaRecovered hnewExit prefixInput zeroPrefix - hterminalClosure zeroLast newStored newEdges newKind newVertex newOutside newDelta newGamma - appendedData happendLastTree happendLastColor happendLastStored happendLastEdges - happendLastKind happendLastVertex happendLastOutside happendLastDelta happendLastGamma - happendTree happendColor happendStored appendedChoice hpeNoRevisitingZero hpeAlternativeZero - hpeGammaRuleZero hstrictClosure - exact @helper_lastStep_5593 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) - (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) - (@hsigmaOne) (@closureTree) (@hTnClosure) (@hqSucc) (@gamma) (@secondStable) - (@previousProper) (@previousOneUncolored) (@choice) (@sigmaPrev) (@hsigmaPrevProper) - (@hsigmaPrevOne) (@hsigmaPrevStableQ) (@hchoiceDefective) (@hchoiceEdgeNew) - (@hsigmaPrevSelf) (@hclosedPrev) (@hnotStrongPrev) (@hsigmaRecovered) (@hnewExit) - (@prefixInput) (@zeroPrefix) (@hterminalClosure) (@happendLastTree) (@happendLastColor) - (@happendLastStored) (@happendLastEdges) (@happendLastKind) (@happendLastVertex) - (@happendLastOutside) (@happendLastDelta) (@happendLastGamma) (@happendTree) - (@happendColor) (@happendStored) (@hpeNoRevisitingZero) (@hpeAlternativeZero) - (@hpeGammaRuleZero) (@hstrictClosure) - -private theorem helper_hpenultimateTree_6615.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (_ closureTree : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin ett.rounds); - ∀ (_ : q.succ = Fin.last ett.rounds) (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 - (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; - ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (prefixInput : PartialEdgeColoring - E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 prefixInput), - let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); - let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset - (Fin k)); - let newEdges : Finset E := ({ choice.edge } : Finset E); - let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; - let newVertex : Option V := some choice.vertex; - let newOutside : Option V := some choice.otherEndpoint; - let newDelta : Option (Fin k) := some choice.color; - let newGamma : Option (Fin k) := some gamma; - let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend - zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta - newGamma; - ∀ (_ : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc) - (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput) (_ : - extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma - newStored newEdges newKind newVertex newOutside newDelta newGamma) (hroundsEq : (0 : ℕ) + - (1 : ℕ) = ett.rounds), - let castSeries : {a b : ℕ} → (h : a = b) → (S : TashkinovSeries G k a e0 prefixInput) → - TashkinovSeries G k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k - a e0 prefixInput) ↦ (h ▸ S); - ∀ (_ : - ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), - (castSeries h S).data.tree i = S.data.tree (Fin.cast ( - by - omega - ) i)), - let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq - extendedSeries; - let rawTreeIndex : (i : Fin (ett.rounds + (2 : ℕ))) → Fin (3 : ℕ) := fun (i : Fin (ett.rounds - + (2 : ℕ))) ↦ Fin.cast ( - by - omega - ) i; - ∀ (_ : rawTreeIndex (⟨ett.rounds, - by - omega - ⟩ : Fin (ett.rounds + (2 : ℕ))) = zeroLast.succ.castSucc), finalSeries.data.tree (⟨ett.rounds, - by - omega - ⟩ : Fin (ett.rounds + (2 : ℕ))) = ett.series.data.tree (Fin.last ett.rounds).castSucc := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q hqSucc gamma - choice sigmaPrev H u p prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex - newOutside newDelta newGamma appendedData happendTree extendedSeries hextendedData - hroundsEq castSeries castSeriesTree finalSeries rawTreeIndex hrawPenultimate - exact @helper_hpenultimateTree_5732 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) - (@closureTree) (@hqSucc) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@prefixInput) - (@zeroPrefix) (@happendTree) (@extendedSeries) (@hextendedData) (@hroundsEq) - (@castSeriesTree) (@hrawPenultimate) - -private theorem helper_hseriesTreeAgree_7410.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (_ closureTree : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin ett.rounds); - ∀ (_ : q.succ = Fin.last ett.rounds) (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 - (ett.series.data.tree q.succ.castSucc) (TashkinovStoredColors ett.series.data q.castSucc) - (ett.series.data.coloring q.castSucc)) (sigmaPrev : PartialEdgeColoring E k), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; - ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (_ : ett.rounds = (1 : ℕ)) - (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 - prefixInput), - let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); - let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset - (Fin k)); - let newEdges : Finset E := ({ choice.edge } : Finset E); - let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; - let newVertex : Option V := some choice.vertex; - let newOutside : Option V := some choice.otherEndpoint; - let newDelta : Option (Fin k) := some choice.color; - let newGamma : Option (Fin k) := some gamma; - let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend - zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta - newGamma; - ∀ (_ : appendedData.tree zeroLast.succ.castSucc = ett.series.data.tree q.succ.castSucc) - (extendedSeries : TashkinovSeries G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput) (_ : - extendedSeries.data = TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma - newStored newEdges newKind newVertex newOutside newDelta newGamma) (hroundsEq : (0 : ℕ) + - (1 : ℕ) = ett.rounds), - let castSeries : {a b : ℕ} → (h : a = b) → (S : TashkinovSeries G k a e0 prefixInput) → - TashkinovSeries G k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k - a e0 prefixInput) ↦ (h ▸ S); - ∀ (_ : - ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (2 : ℕ))), - (castSeries h S).data.tree i = S.data.tree (Fin.cast ( - by - omega - ) i)), - let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq - extendedSeries; - ∀ (j : Fin ett.rounds), finalSeries.data.tree j.succ.castSucc = ett.series.data.tree - j.succ.castSucc := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma Tstar closureTree q hqSucc gamma - choice sigmaPrev H u p hroundOne prefixInput zeroPrefix zeroLast newStored newEdges newKind - newVertex newOutside newDelta newGamma appendedData happendTree extendedSeries - hextendedData hroundsEq castSeries castSeriesTree finalSeries - exact @helper_hseriesTreeAgree_5768 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) - (@closureTree) (@hqSucc) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundOne) - (@prefixInput) (@zeroPrefix) (@happendTree) (@extendedSeries) (@hextendedData) - (@hroundsEq) (@castSeriesTree) - -private theorem helper_hseriesColorProperties_7486.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (sigma : PartialEdgeColoring E - k) (_ : IsProperEdgeColoring G sigma) (_ : IsOneEdgeUncolored sigma e0) (_ closureTree : - TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin ett.rounds); - ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k) (_ : IsProperEdgeColoring G sigmaPrev) (_ : - IsOneEdgeUncolored sigmaPrev e0), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; - ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (_ : ett.rounds = (1 : ℕ)) - (prefixInput : PartialEdgeColoring E k) (zeroPrefix : TashkinovSeries G k (0 : ℕ) e0 - prefixInput), - let zeroLast : Fin ((0 : ℕ) + (1 : ℕ)) := Fin.last (0 : ℕ); - let newStored : Finset (Fin k) := (insert choice.color ({ gamma } : Finset (Fin k)) : Finset - (Fin k)); - let newEdges : Finset E := ({ choice.edge } : Finset E); - let newKind : Option TashkinovExtensionKind := some TashkinovExtensionKind.PE; - let newVertex : Option V := some choice.vertex; - let newOutside : Option V := some choice.otherEndpoint; - let newDelta : Option (Fin k) := some choice.color; - let newGamma : Option (Fin k) := some gamma; - let appendedData : TashkinovSeriesData G k ((0 : ℕ) + (1 : ℕ)) e0 := TashkinovSeriesDataAppend - zeroPrefix.data closureTree sigma newStored newEdges newKind newVertex newOutside newDelta - newGamma; - ∀ (_ : appendedData.coloring zeroLast.castSucc = sigmaPrev) (extendedSeries : TashkinovSeries - G k ((0 : ℕ) + (1 : ℕ)) e0 prefixInput) (_ : extendedSeries.data = - TashkinovSeriesDataAppend zeroPrefix.data closureTree sigma newStored newEdges newKind - newVertex newOutside newDelta newGamma) (hroundsEq : (0 : ℕ) + (1 : ℕ) = ett.rounds), - let castSeries : {a b : ℕ} → (h : a = b) → (S : TashkinovSeries G k a e0 prefixInput) → - TashkinovSeries G k b e0 prefixInput := fun {a b : ℕ} (h : a = b) (S : TashkinovSeries G k - a e0 prefixInput) ↦ (h ▸ S); - ∀ (_ : - ∀ {a b : ℕ} (h : a = b) (S : TashkinovSeries G k a e0 prefixInput) (i : Fin (b + (1 : ℕ))), - (castSeries h S).data.coloring i = S.data.coloring (Fin.cast ( - by - omega - ) i)), - let finalSeries : TashkinovSeries G k ett.rounds e0 prefixInput := castSeries hroundsEq - extendedSeries; - ∀ (_ : finalSeries.data.coloring (Fin.last ett.rounds) = sigma) (i : Fin (ett.rounds + (1 : - ℕ))), IsProperEdgeColoring G (finalSeries.data.coloring i) ∧ IsOneEdgeUncolored - (finalSeries.data.coloring i) e0 := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive sigma hsigmaProper hsigmaOne Tstar - closureTree q gamma choice sigmaPrev hsigmaPrevProper hsigmaPrevOne H u p hroundOne - prefixInput zeroPrefix zeroLast newStored newEdges newKind newVertex newOutside newDelta - newGamma appendedData happendColor extendedSeries hextendedData hroundsEq castSeries - castSeriesColoring finalSeries hfinalColor - exact @helper_hseriesColorProperties_5776 (@V) (@E) inferInstance inferInstance inferInstance - (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) - (@hsigmaOne) (@Tstar) (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@hsigmaPrevProper) - (@hsigmaPrevOne) (@u) (@p) (@hroundOne) (@prefixInput) (@zeroPrefix) (@happendColor) - (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesColoring) (@hfinalColor) - private theorem helper_continuation_7494.{u_1, u_2} : helperContinuation7494Conditions.{u_1, u_2} := by classical @@ -5522,7 +5029,7 @@ private theorem helper_continuation_7494.{u_1, u_2} : have hpenultimateTree : finalSeries.data.tree (⟨ett.rounds, by omega⟩ : Fin (ett.rounds + 2)) = ett.series.data.tree (Fin.last ett.rounds).castSucc := by - apply helper_hpenultimateTree_6615 <;> assumption + apply helper_hpenultimateTree_5732 <;> assumption have hfinalColor := @helper_hfinalColor_5740 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) (@gamma) (@choice) (@prefixInput) (@zeroPrefix) (@happendLastColor) @@ -5532,7 +5039,7 @@ private theorem helper_continuation_7494.{u_1, u_2} : ett.series.data.stored i ∧ zeroPrefix.data.connectingEdges zeroLast = ett.series.data.connectingEdges i ∧ zeroPrefix.data.kind zeroLast = ett.series.data.kind i := by - apply helper_hprefixFields_6306 <;> assumption + apply helper_hprefixFields_3431 <;> assumption have hseriesDataAgree := @helper_hseriesDataAgree_3459 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) (@hqSucc) (@gamma) (@choice) (@currentStored) (@currentEdges) @@ -5540,12 +5047,12 @@ private theorem helper_continuation_7494.{u_1, u_2} : (@hp) (@hroundOne) (@prefixInput) (@zeroPrefix) (@happendLastStored) (@happendLastEdges) (@happendLastKind) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesStored) (@castSeriesEdges) (@castSeriesKind) (@hrawFinalData) (@hprefixFields) - have hseriesTreeAgree := @helper_hseriesTreeAgree_7410 (@V) (@E) inferInstance inferInstance + have hseriesTreeAgree := @helper_hseriesTreeAgree_5768 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@Tstar) (@closureTree) (@hqSucc) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundOne) (@prefixInput) (@zeroPrefix) (@happendTree) (@extendedSeries) (@hextendedData) (@hroundsEq) (@castSeriesTree) - have hseriesColorProperties := @helper_hseriesColorProperties_7486 (@V) (@E) inferInstance + have hseriesColorProperties := @helper_hseriesColorProperties_5776 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@sigma) (@hsigmaProper) (@hsigmaOne) (@Tstar) (@closureTree) (@gamma) (@choice) (@sigmaPrev) (@hsigmaPrevProper) (@hsigmaPrevOne) (@u) (@p) (@hroundOne) (@prefixInput) (@zeroPrefix) @@ -5675,17 +5182,17 @@ theorem helper_branch_12554.{u_1, u_2} : ¬ Disjoint (MissingColors G rho appendedChoice.otherEndpoint) (TreeMissingColors rho (appendedData.tree zeroLast.succ.castSucc)) := by - apply helper_hpeAlternativeZero_6498; assumption + apply helper_hpeAlternativeZero_5555; assumption have hpeGammaRuleZero : ParallelExtensionColor appendedData zeroLast.castSucc appendedChoice.selected appendedChoice.vertex gamma := by - apply helper_hpeGammaRuleZero_6513 <;> assumption + apply helper_hpeGammaRuleZero_5579 <;> assumption have hstrictClosure : (ett.series.data.tree (Fin.last ett.rounds).castSucc).length < closureTree.length := lt_of_lt_of_le hstrict hTstarClosure.1 have lastStep : TashkinovSeriesStep G k 1 e0 prefixInput appendedData (Fin.last 1) := by - apply helper_lastStep_6525 <;> assumption + apply helper_lastStep_5593 <;> assumption obtain ⟨extendedSeries, hextendedData⟩ := TashkinovSeriesAppend G k 0 e0 prefixInput zeroPrefix closureTree sigma newStored newEdges newKind newVertex newOutside newDelta @@ -6226,67 +5733,6 @@ private theorem helper_hmissing_6909.{u_1, u_2} : newChoice.vertex := congrArg _ (hvertexIdentity.trans hfullVertexCast).symm -private theorem helper_hprefixPostFull_7637.{u_1, u_2} : - open scoped Classical in - ∀ {V : Type u_1} {E : Type u_2} [ Fintype V] [ Fintype E] [ DecidableEq E] (G : - LooplessMultigraph V E) (k : ℕ) (e0 : E) (input : PartialEdgeColoring E k) (T : - TreeSequence G e0) (generating : PartialEdgeColoring E k) (ett : ExtendedTashkinovTree G k - e0 input T generating) (hpositive : (0 : ℕ) < ett.rounds) (_ : TreeSequence G e0), - let q : Fin ett.rounds := (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin ett.rounds); - ∀ (gamma : Fin k) (choice : MaximumDefectiveChoice G e0 (ett.series.data.tree q.succ.castSucc) - (TashkinovStoredColors ett.series.data q.castSucc) (ett.series.data.coloring q.castSucc)) - (sigmaPrev : PartialEdgeColoring E k), - let H : SimpleGraph (V ⊕ E) := TwoColorIncidenceGraph G sigmaPrev gamma choice.color; - ∀ (u : V) (_ : H.Walk (Sum.inl choice.vertex) (Sum.inl u)) (hroundLarge : (1 : ℕ) < - ett.rounds) (originalPrefix : ExtendedTashkinovTree G k e0 input (ett.series.data.tree - (Fin.last ett.rounds).castSucc) (ett.series.data.coloring (⟨ett.rounds - (1 : ℕ), - by - omega - ⟩ : Fin (ett.rounds + (1 : ℕ))))) (hr : originalPrefix.rounds = ett.rounds - (1 : ℕ)) (_ : - ∀ (i : Fin (originalPrefix.rounds + (1 : ℕ))), originalPrefix.series.data.coloring i = - ett.series.data.coloring (Fin.castLE ( - by - omega - ) i) ∧ originalPrefix.series.data.stored i = ett.series.data.stored (Fin.castLE ( - by - omega - ) i) ∧ originalPrefix.series.data.connectingEdges i = ett.series.data.connectingEdges - (Fin.castLE ( - by - omega - ) i) ∧ originalPrefix.series.data.kind i = ett.series.data.kind (Fin.castLE ( - by - omega - ) i) ∧ TashkinovStoredColors originalPrefix.series.data i = TashkinovStoredColors - ett.series.data (Fin.castLE ( - by - omega - ) i)) (corr : CorrespondingExtendedTashkinovTree G k e0 originalPrefix sigmaPrev - (ett.series.data.tree (Fin.last ett.rounds).castSucc)) (_ : (0 : ℕ) < - originalPrefix.rounds) (j : Fin (originalPrefix.rounds + (1 : ℕ))), - let fullj : Fin (ett.rounds + (1 : ℕ)) := Fin.castLE ( - by - omega - ) j; - ∀ (fulli : Fin ett.rounds) (_ : MaximumDefectiveChoice G e0 (ett.series.data.tree - fulli.succ.castSucc) (TashkinovStoredColors ett.series.data fulli.castSucc) - (ett.series.data.coloring fulli.castSucc)) (_ : fullj = fulli.succ) (newi : Fin - originalPrefix.rounds) (_ : newi.succ = j) (_ : corr.replacementSeries.data.tree - newi.succ.castSucc = ett.series.data.tree fulli.succ.castSucc), - originalPrefix.series.data.coloring newi.succ = ett.series.data.coloring fulli.succ := by - classical - intro V E _ _ _ G k e0 input T generating ett hpositive Tstar q gamma choice sigmaPrev H u p - hroundLarge originalPrefix hr hprefixData corr horiginalPositive j fullj fulli fullChoice - hfullTarget newi hnewIndex htree - exact @helper_hprefixPostFull_6259 (@V) (@E) inferInstance inferInstance inferInstance (@G) - (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) - (@sigmaPrev) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixData) (@corr) - (@horiginalPositive) (@j) (@fulli) (@fullChoice) (@hfullTarget) (@newi) (@hnewIndex) - (@htree) - theorem helper_branch_12991.{u_1, u_2} : helperBranch12991Conditions.{u_1, u_2} := by classical @@ -6370,7 +5816,7 @@ theorem helper_branch_12991.{u_1, u_2} : newSecondStable newGammaRule.1 rw [← fullCurrentColoring] at hfullDeltaMissing hfullGammaNotMissing rw [← newCurrentColoring] at hnewDeltaMissing hnewGammaNotMissing - have hprefixPostFull := @helper_hprefixPostFull_7637 (@V) (@E) inferInstance inferInstance + have hprefixPostFull := @helper_hprefixPostFull_6259 (@V) (@E) inferInstance inferInstance inferInstance (@G) (@k) (@e0) (@input) (@T) (@generating) (@ett) (@hpositive) (@Tstar) (@gamma) (@choice) (@sigmaPrev) (@u) (@p) (@hroundLarge) (@originalPrefix) (@hr) (@hprefixData) (@corr) (@horiginalPositive) (@j) (@fulli) (@fullChoice) (@hfullTarget) (@newi) diff --git a/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean b/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean index 79625b4062..3995df135b 100644 --- a/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean +++ b/LeanPool/GoldbergSeymour/TreeSequenceColoringFacts.lean @@ -114,6 +114,24 @@ theorem TreeSequenceFirstMissingPositionEqCast {V E : Type*} [Fintype E] exact congrArg Fin.val (TreeSequenceFirstMissingPositionEq segment elementary (show position.val ≤ initialSegment.length from Nat.le_of_lt_succ position.isLt) witness) +/-- A color missing somewhere on the tree is missing at its first missing position. -/ +theorem TreeSequenceFirstMissingPositionMemOfMissing {V E : Type*} [Fintype E] + {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} + {tree : TreeSequence G e0} {color : Fin k} (member : color ∈ TreeMissingColors phi tree) : + color ∈ MissingColors G phi (tree.vertex (HierarchyFirstMissingPosition phi tree color)) := by + classical + obtain ⟨vertex, inTree, missing⟩ := Finset.mem_biUnion.mp member + obtain ⟨index, equality⟩ : ∃ index, tree.vertex index = vertex := by + simpa [TreeSequenceVertexSet] using inTree + let candidates := Finset.univ.filter fun index : Fin (tree.length + 1) => + color ∈ MissingColors G phi (tree.vertex index) + have nonempty : candidates.Nonempty := by + refine ⟨index, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩⟩ + simpa [equality] using missing + unfold HierarchyFirstMissingPosition + rw [dite_eq_left nonempty] + exact (Finset.mem_filter.mp (Finset.min'_mem candidates nonempty)).2 + /-- A first missing position strictly before the fallback endpoint is an actual missing witness. -/ theorem TreeSequenceFirstMissingPositionMem {V E : Type*} [Fintype E] {G : LooplessMultigraph V E} {k : ℕ} {e0 : E} {phi : PartialEdgeColoring E k} diff --git a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentFacts.lean b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentFacts.lean index d6ec5ee279..2354033ab4 100644 --- a/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentFacts.lean +++ b/LeanPool/GoldbergSeymour/TreeSequenceInitialSegmentFacts.lean @@ -5,6 +5,8 @@ Authors: Wesley Pegden -/ module +public import LeanPool.GoldbergSeymour.TreeVertexOrder + public import LeanPool.GoldbergSeymour.TreeSequenceInitialSegment public import LeanPool.GoldbergSeymour.TreeSequenceVertexSet @@ -74,6 +76,46 @@ theorem of_common_extension {first second extension : TreeSequence G e0} _ = extension.edge (Fin.castLE secondLength index) := by congr 1 _ = second.edge index := secondEdges index +/-- A tree's last vertex does not occur in a strictly shorter initial segment. -/ +theorem last_vertex_ne {initial tree : TreeSequence G e0} + (segment : TreeSequenceInitialSegment initial tree) (shorter : initial.length < tree.length) + (index : Fin (initial.length + 1)) : + tree.vertex (Fin.last tree.length) ≠ initial.vertex index := by + intro equal + have positions := congrArg Fin.val (tree.vertex_injective (equal.trans (segment.2.1 index).symm)) + have bound := index.isLt + change tree.length = index.val at positions + omega + +/-- Every vertex of a prefix precedes a tree position lying strictly beyond that prefix. -/ +theorem vertex_precedes {initial tree : TreeSequence G e0} + (segment : TreeSequenceInitialSegment initial tree) {position : Fin (tree.length + 1)} + (later : initial.length < position.val) {vertex : V} + (member : vertex ∈ TreeSequenceVertexSet initial) : + TreeVertexOrder tree vertex (tree.vertex position) := by + classical + obtain ⟨index, equality⟩ : ∃ index, initial.vertex index = vertex := by + simpa [TreeSequenceVertexSet] using member + refine ⟨Fin.castLE (Nat.succ_le_succ segment.1) index, position, + (segment.2.1 index).trans equality, rfl, ?_⟩ + have bound := index.isLt + change index.val < position.val + omega + +/-- A tree position beyond an initial segment has a vertex outside that segment. -/ +theorem vertex_not_mem_after {initial tree : TreeSequence G e0} + (segment : TreeSequenceInitialSegment initial tree) {position : Fin (tree.length + 1)} + (later : initial.length < position.val) : + tree.vertex position ∉ TreeSequenceVertexSet initial := by + classical + intro member + obtain ⟨index, equality⟩ : ∃ index, initial.vertex index = tree.vertex position := by + simpa [TreeSequenceVertexSet] using member + have equal := congrArg Fin.val (tree.vertex_injective ((segment.2.1 index).trans equality)) + have bound := index.isLt + change index.val = position.val at equal + omega + end GoldbergSeymour.TreeSequenceInitialSegment end